1 |
commit: 8063d7761c286d92855fd78713a561a970613ebb |
2 |
Author: Alice Ferrazzi <alicef <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Aug 19 09:30:23 2020 +0000 |
4 |
Commit: Alice Ferrazzi <alicef <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Aug 19 09:30:44 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=8063d776 |
7 |
|
8 |
Linux patch 5.7.16 |
9 |
|
10 |
Signed-off-by: Alice Ferrazzi <alicef <AT> gentoo.org> |
11 |
|
12 |
0000_README | 4 + |
13 |
1015_linux-5.7.16.patch | 14445 ++++++++++++++++++++++++++++++++++++++++++++++ |
14 |
2 files changed, 14449 insertions(+) |
15 |
|
16 |
diff --git a/0000_README b/0000_README |
17 |
index dc0ff9b..66f0380 100644 |
18 |
--- a/0000_README |
19 |
+++ b/0000_README |
20 |
@@ -103,6 +103,10 @@ Patch: 1014_linux-5.7.15.patch |
21 |
From: http://www.kernel.org |
22 |
Desc: Linux 5.7.15 |
23 |
|
24 |
+Patch: 1015_linux-5.7.16.patch |
25 |
+From: http://www.kernel.org |
26 |
+Desc: Linux 5.7.16 |
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/1015_linux-5.7.16.patch b/1015_linux-5.7.16.patch |
33 |
new file mode 100644 |
34 |
index 0000000..ff642b6 |
35 |
--- /dev/null |
36 |
+++ b/1015_linux-5.7.16.patch |
37 |
@@ -0,0 +1,14445 @@ |
38 |
+diff --git a/Documentation/ABI/testing/sysfs-bus-iio b/Documentation/ABI/testing/sysfs-bus-iio |
39 |
+index d3e53a6d8331..5c62bfb0f3f5 100644 |
40 |
+--- a/Documentation/ABI/testing/sysfs-bus-iio |
41 |
++++ b/Documentation/ABI/testing/sysfs-bus-iio |
42 |
+@@ -1569,7 +1569,8 @@ What: /sys/bus/iio/devices/iio:deviceX/in_concentrationX_voc_raw |
43 |
+ KernelVersion: 4.3 |
44 |
+ Contact: linux-iio@×××××××××××.org |
45 |
+ Description: |
46 |
+- Raw (unscaled no offset etc.) percentage reading of a substance. |
47 |
++ Raw (unscaled no offset etc.) reading of a substance. Units |
48 |
++ after application of scale and offset are percents. |
49 |
+ |
50 |
+ What: /sys/bus/iio/devices/iio:deviceX/in_resistance_raw |
51 |
+ What: /sys/bus/iio/devices/iio:deviceX/in_resistanceX_raw |
52 |
+diff --git a/Documentation/core-api/cpu_hotplug.rst b/Documentation/core-api/cpu_hotplug.rst |
53 |
+index 4a50ab7817f7..b1ae1ac159cf 100644 |
54 |
+--- a/Documentation/core-api/cpu_hotplug.rst |
55 |
++++ b/Documentation/core-api/cpu_hotplug.rst |
56 |
+@@ -50,13 +50,6 @@ Command Line Switches |
57 |
+ |
58 |
+ This option is limited to the X86 and S390 architecture. |
59 |
+ |
60 |
+-``cede_offline={"off","on"}`` |
61 |
+- Use this option to disable/enable putting offlined processors to an extended |
62 |
+- ``H_CEDE`` state on supported pseries platforms. If nothing is specified, |
63 |
+- ``cede_offline`` is set to "on". |
64 |
+- |
65 |
+- This option is limited to the PowerPC architecture. |
66 |
+- |
67 |
+ ``cpu0_hotplug`` |
68 |
+ Allow to shutdown CPU0. |
69 |
+ |
70 |
+diff --git a/Makefile b/Makefile |
71 |
+index a2fbdb4c952d..627657860aa5 100644 |
72 |
+--- a/Makefile |
73 |
++++ b/Makefile |
74 |
+@@ -1,7 +1,7 @@ |
75 |
+ # SPDX-License-Identifier: GPL-2.0 |
76 |
+ VERSION = 5 |
77 |
+ PATCHLEVEL = 7 |
78 |
+-SUBLEVEL = 15 |
79 |
++SUBLEVEL = 16 |
80 |
+ EXTRAVERSION = |
81 |
+ NAME = Kleptomaniac Octopus |
82 |
+ |
83 |
+diff --git a/arch/arm/boot/dts/exynos5422-odroid-core.dtsi b/arch/arm/boot/dts/exynos5422-odroid-core.dtsi |
84 |
+index ab27ff8bc3dc..afe090578e8f 100644 |
85 |
+--- a/arch/arm/boot/dts/exynos5422-odroid-core.dtsi |
86 |
++++ b/arch/arm/boot/dts/exynos5422-odroid-core.dtsi |
87 |
+@@ -411,12 +411,6 @@ |
88 |
+ status = "okay"; |
89 |
+ }; |
90 |
+ |
91 |
+-&bus_fsys { |
92 |
+- operating-points-v2 = <&bus_fsys2_opp_table>; |
93 |
+- devfreq = <&bus_wcore>; |
94 |
+- status = "okay"; |
95 |
+-}; |
96 |
+- |
97 |
+ &bus_fsys2 { |
98 |
+ operating-points-v2 = <&bus_fsys2_opp_table>; |
99 |
+ devfreq = <&bus_wcore>; |
100 |
+diff --git a/arch/arm/boot/dts/exynos5800.dtsi b/arch/arm/boot/dts/exynos5800.dtsi |
101 |
+index dfb99ab53c3e..526729dad53f 100644 |
102 |
+--- a/arch/arm/boot/dts/exynos5800.dtsi |
103 |
++++ b/arch/arm/boot/dts/exynos5800.dtsi |
104 |
+@@ -23,17 +23,17 @@ |
105 |
+ &cluster_a15_opp_table { |
106 |
+ opp-2000000000 { |
107 |
+ opp-hz = /bits/ 64 <2000000000>; |
108 |
+- opp-microvolt = <1312500>; |
109 |
++ opp-microvolt = <1312500 1312500 1500000>; |
110 |
+ clock-latency-ns = <140000>; |
111 |
+ }; |
112 |
+ opp-1900000000 { |
113 |
+ opp-hz = /bits/ 64 <1900000000>; |
114 |
+- opp-microvolt = <1262500>; |
115 |
++ opp-microvolt = <1262500 1262500 1500000>; |
116 |
+ clock-latency-ns = <140000>; |
117 |
+ }; |
118 |
+ opp-1800000000 { |
119 |
+ opp-hz = /bits/ 64 <1800000000>; |
120 |
+- opp-microvolt = <1237500>; |
121 |
++ opp-microvolt = <1237500 1237500 1500000>; |
122 |
+ clock-latency-ns = <140000>; |
123 |
+ }; |
124 |
+ opp-1700000000 { |
125 |
+diff --git a/arch/arm/boot/dts/r8a7793-gose.dts b/arch/arm/boot/dts/r8a7793-gose.dts |
126 |
+index 79baf06019f5..10c3536b8e3d 100644 |
127 |
+--- a/arch/arm/boot/dts/r8a7793-gose.dts |
128 |
++++ b/arch/arm/boot/dts/r8a7793-gose.dts |
129 |
+@@ -336,7 +336,7 @@ |
130 |
+ reg = <0x20>; |
131 |
+ remote = <&vin1>; |
132 |
+ |
133 |
+- port { |
134 |
++ ports { |
135 |
+ #address-cells = <1>; |
136 |
+ #size-cells = <0>; |
137 |
+ |
138 |
+@@ -394,7 +394,7 @@ |
139 |
+ interrupts = <2 IRQ_TYPE_LEVEL_LOW>; |
140 |
+ default-input = <0>; |
141 |
+ |
142 |
+- port { |
143 |
++ ports { |
144 |
+ #address-cells = <1>; |
145 |
+ #size-cells = <0>; |
146 |
+ |
147 |
+diff --git a/arch/arm/boot/dts/stm32mp15-pinctrl.dtsi b/arch/arm/boot/dts/stm32mp15-pinctrl.dtsi |
148 |
+index 73c07f0dfad2..4b67b682dd53 100644 |
149 |
+--- a/arch/arm/boot/dts/stm32mp15-pinctrl.dtsi |
150 |
++++ b/arch/arm/boot/dts/stm32mp15-pinctrl.dtsi |
151 |
+@@ -1095,15 +1095,15 @@ |
152 |
+ |
153 |
+ uart7_pins_a: uart7-0 { |
154 |
+ pins1 { |
155 |
+- pinmux = <STM32_PINMUX('E', 8, AF7)>; /* UART4_TX */ |
156 |
++ pinmux = <STM32_PINMUX('E', 8, AF7)>; /* UART7_TX */ |
157 |
+ bias-disable; |
158 |
+ drive-push-pull; |
159 |
+ slew-rate = <0>; |
160 |
+ }; |
161 |
+ pins2 { |
162 |
+- pinmux = <STM32_PINMUX('E', 7, AF7)>, /* UART4_RX */ |
163 |
+- <STM32_PINMUX('E', 10, AF7)>, /* UART4_CTS */ |
164 |
+- <STM32_PINMUX('E', 9, AF7)>; /* UART4_RTS */ |
165 |
++ pinmux = <STM32_PINMUX('E', 7, AF7)>, /* UART7_RX */ |
166 |
++ <STM32_PINMUX('E', 10, AF7)>, /* UART7_CTS */ |
167 |
++ <STM32_PINMUX('E', 9, AF7)>; /* UART7_RTS */ |
168 |
+ bias-disable; |
169 |
+ }; |
170 |
+ }; |
171 |
+diff --git a/arch/arm/boot/dts/sunxi-bananapi-m2-plus-v1.2.dtsi b/arch/arm/boot/dts/sunxi-bananapi-m2-plus-v1.2.dtsi |
172 |
+index 22466afd38a3..235994a4a2eb 100644 |
173 |
+--- a/arch/arm/boot/dts/sunxi-bananapi-m2-plus-v1.2.dtsi |
174 |
++++ b/arch/arm/boot/dts/sunxi-bananapi-m2-plus-v1.2.dtsi |
175 |
+@@ -16,15 +16,27 @@ |
176 |
+ regulator-type = "voltage"; |
177 |
+ regulator-boot-on; |
178 |
+ regulator-always-on; |
179 |
+- regulator-min-microvolt = <1100000>; |
180 |
+- regulator-max-microvolt = <1300000>; |
181 |
++ regulator-min-microvolt = <1108475>; |
182 |
++ regulator-max-microvolt = <1308475>; |
183 |
+ regulator-ramp-delay = <50>; /* 4ms */ |
184 |
+ gpios = <&r_pio 0 1 GPIO_ACTIVE_HIGH>; /* PL1 */ |
185 |
+ gpios-states = <0x1>; |
186 |
+- states = <1100000 0>, <1300000 1>; |
187 |
++ states = <1108475 0>, <1308475 1>; |
188 |
+ }; |
189 |
+ }; |
190 |
+ |
191 |
+ &cpu0 { |
192 |
+ cpu-supply = <®_vdd_cpux>; |
193 |
+ }; |
194 |
++ |
195 |
++&cpu1 { |
196 |
++ cpu-supply = <®_vdd_cpux>; |
197 |
++}; |
198 |
++ |
199 |
++&cpu2 { |
200 |
++ cpu-supply = <®_vdd_cpux>; |
201 |
++}; |
202 |
++ |
203 |
++&cpu3 { |
204 |
++ cpu-supply = <®_vdd_cpux>; |
205 |
++}; |
206 |
+diff --git a/arch/arm/kernel/stacktrace.c b/arch/arm/kernel/stacktrace.c |
207 |
+index cc726afea023..76ea4178a55c 100644 |
208 |
+--- a/arch/arm/kernel/stacktrace.c |
209 |
++++ b/arch/arm/kernel/stacktrace.c |
210 |
+@@ -22,6 +22,19 @@ |
211 |
+ * A simple function epilogue looks like this: |
212 |
+ * ldm sp, {fp, sp, pc} |
213 |
+ * |
214 |
++ * When compiled with clang, pc and sp are not pushed. A simple function |
215 |
++ * prologue looks like this when built with clang: |
216 |
++ * |
217 |
++ * stmdb {..., fp, lr} |
218 |
++ * add fp, sp, #x |
219 |
++ * sub sp, sp, #y |
220 |
++ * |
221 |
++ * A simple function epilogue looks like this when built with clang: |
222 |
++ * |
223 |
++ * sub sp, fp, #x |
224 |
++ * ldm {..., fp, pc} |
225 |
++ * |
226 |
++ * |
227 |
+ * Note that with framepointer enabled, even the leaf functions have the same |
228 |
+ * prologue and epilogue, therefore we can ignore the LR value in this case. |
229 |
+ */ |
230 |
+@@ -34,6 +47,16 @@ int notrace unwind_frame(struct stackframe *frame) |
231 |
+ low = frame->sp; |
232 |
+ high = ALIGN(low, THREAD_SIZE); |
233 |
+ |
234 |
++#ifdef CONFIG_CC_IS_CLANG |
235 |
++ /* check current frame pointer is within bounds */ |
236 |
++ if (fp < low + 4 || fp > high - 4) |
237 |
++ return -EINVAL; |
238 |
++ |
239 |
++ frame->sp = frame->fp; |
240 |
++ frame->fp = *(unsigned long *)(fp); |
241 |
++ frame->pc = frame->lr; |
242 |
++ frame->lr = *(unsigned long *)(fp + 4); |
243 |
++#else |
244 |
+ /* check current frame pointer is within bounds */ |
245 |
+ if (fp < low + 12 || fp > high - 4) |
246 |
+ return -EINVAL; |
247 |
+@@ -42,6 +65,7 @@ int notrace unwind_frame(struct stackframe *frame) |
248 |
+ frame->fp = *(unsigned long *)(fp - 12); |
249 |
+ frame->sp = *(unsigned long *)(fp - 8); |
250 |
+ frame->pc = *(unsigned long *)(fp - 4); |
251 |
++#endif |
252 |
+ |
253 |
+ return 0; |
254 |
+ } |
255 |
+diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c |
256 |
+index 074bde64064e..2aab043441e8 100644 |
257 |
+--- a/arch/arm/mach-at91/pm.c |
258 |
++++ b/arch/arm/mach-at91/pm.c |
259 |
+@@ -592,13 +592,13 @@ static void __init at91_pm_sram_init(void) |
260 |
+ sram_pool = gen_pool_get(&pdev->dev, NULL); |
261 |
+ if (!sram_pool) { |
262 |
+ pr_warn("%s: sram pool unavailable!\n", __func__); |
263 |
+- return; |
264 |
++ goto out_put_device; |
265 |
+ } |
266 |
+ |
267 |
+ sram_base = gen_pool_alloc(sram_pool, at91_pm_suspend_in_sram_sz); |
268 |
+ if (!sram_base) { |
269 |
+ pr_warn("%s: unable to alloc sram!\n", __func__); |
270 |
+- return; |
271 |
++ goto out_put_device; |
272 |
+ } |
273 |
+ |
274 |
+ sram_pbase = gen_pool_virt_to_phys(sram_pool, sram_base); |
275 |
+@@ -606,12 +606,17 @@ static void __init at91_pm_sram_init(void) |
276 |
+ at91_pm_suspend_in_sram_sz, false); |
277 |
+ if (!at91_suspend_sram_fn) { |
278 |
+ pr_warn("SRAM: Could not map\n"); |
279 |
+- return; |
280 |
++ goto out_put_device; |
281 |
+ } |
282 |
+ |
283 |
+ /* Copy the pm suspend handler to SRAM */ |
284 |
+ at91_suspend_sram_fn = fncpy(at91_suspend_sram_fn, |
285 |
+ &at91_pm_suspend_in_sram, at91_pm_suspend_in_sram_sz); |
286 |
++ return; |
287 |
++ |
288 |
++out_put_device: |
289 |
++ put_device(&pdev->dev); |
290 |
++ return; |
291 |
+ } |
292 |
+ |
293 |
+ static bool __init at91_is_pm_mode_active(int pm_mode) |
294 |
+diff --git a/arch/arm/mach-exynos/exynos.c b/arch/arm/mach-exynos/exynos.c |
295 |
+index 7a8d1555db40..36c37444485a 100644 |
296 |
+--- a/arch/arm/mach-exynos/exynos.c |
297 |
++++ b/arch/arm/mach-exynos/exynos.c |
298 |
+@@ -193,7 +193,7 @@ static void __init exynos_dt_fixup(void) |
299 |
+ } |
300 |
+ |
301 |
+ DT_MACHINE_START(EXYNOS_DT, "Samsung Exynos (Flattened Device Tree)") |
302 |
+- .l2c_aux_val = 0x3c400001, |
303 |
++ .l2c_aux_val = 0x3c400000, |
304 |
+ .l2c_aux_mask = 0xc20fffff, |
305 |
+ .smp = smp_ops(exynos_smp_ops), |
306 |
+ .map_io = exynos_init_io, |
307 |
+diff --git a/arch/arm/mach-exynos/mcpm-exynos.c b/arch/arm/mach-exynos/mcpm-exynos.c |
308 |
+index 9a681b421ae1..cd861c57d5ad 100644 |
309 |
+--- a/arch/arm/mach-exynos/mcpm-exynos.c |
310 |
++++ b/arch/arm/mach-exynos/mcpm-exynos.c |
311 |
+@@ -26,6 +26,7 @@ |
312 |
+ #define EXYNOS5420_USE_L2_COMMON_UP_STATE BIT(30) |
313 |
+ |
314 |
+ static void __iomem *ns_sram_base_addr __ro_after_init; |
315 |
++static bool secure_firmware __ro_after_init; |
316 |
+ |
317 |
+ /* |
318 |
+ * The common v7_exit_coherency_flush API could not be used because of the |
319 |
+@@ -58,15 +59,16 @@ static void __iomem *ns_sram_base_addr __ro_after_init; |
320 |
+ static int exynos_cpu_powerup(unsigned int cpu, unsigned int cluster) |
321 |
+ { |
322 |
+ unsigned int cpunr = cpu + (cluster * EXYNOS5420_CPUS_PER_CLUSTER); |
323 |
++ bool state; |
324 |
+ |
325 |
+ pr_debug("%s: cpu %u cluster %u\n", __func__, cpu, cluster); |
326 |
+ if (cpu >= EXYNOS5420_CPUS_PER_CLUSTER || |
327 |
+ cluster >= EXYNOS5420_NR_CLUSTERS) |
328 |
+ return -EINVAL; |
329 |
+ |
330 |
+- if (!exynos_cpu_power_state(cpunr)) { |
331 |
+- exynos_cpu_power_up(cpunr); |
332 |
+- |
333 |
++ state = exynos_cpu_power_state(cpunr); |
334 |
++ exynos_cpu_power_up(cpunr); |
335 |
++ if (!state && secure_firmware) { |
336 |
+ /* |
337 |
+ * This assumes the cluster number of the big cores(Cortex A15) |
338 |
+ * is 0 and the Little cores(Cortex A7) is 1. |
339 |
+@@ -258,6 +260,8 @@ static int __init exynos_mcpm_init(void) |
340 |
+ return -ENOMEM; |
341 |
+ } |
342 |
+ |
343 |
++ secure_firmware = exynos_secure_firmware_available(); |
344 |
++ |
345 |
+ /* |
346 |
+ * To increase the stability of KFC reset we need to program |
347 |
+ * the PMU SPARE3 register |
348 |
+diff --git a/arch/arm/mach-socfpga/pm.c b/arch/arm/mach-socfpga/pm.c |
349 |
+index 6ed887cf8dc9..365c0428b21b 100644 |
350 |
+--- a/arch/arm/mach-socfpga/pm.c |
351 |
++++ b/arch/arm/mach-socfpga/pm.c |
352 |
+@@ -49,14 +49,14 @@ static int socfpga_setup_ocram_self_refresh(void) |
353 |
+ if (!ocram_pool) { |
354 |
+ pr_warn("%s: ocram pool unavailable!\n", __func__); |
355 |
+ ret = -ENODEV; |
356 |
+- goto put_node; |
357 |
++ goto put_device; |
358 |
+ } |
359 |
+ |
360 |
+ ocram_base = gen_pool_alloc(ocram_pool, socfpga_sdram_self_refresh_sz); |
361 |
+ if (!ocram_base) { |
362 |
+ pr_warn("%s: unable to alloc ocram!\n", __func__); |
363 |
+ ret = -ENOMEM; |
364 |
+- goto put_node; |
365 |
++ goto put_device; |
366 |
+ } |
367 |
+ |
368 |
+ ocram_pbase = gen_pool_virt_to_phys(ocram_pool, ocram_base); |
369 |
+@@ -67,7 +67,7 @@ static int socfpga_setup_ocram_self_refresh(void) |
370 |
+ if (!suspend_ocram_base) { |
371 |
+ pr_warn("%s: __arm_ioremap_exec failed!\n", __func__); |
372 |
+ ret = -ENOMEM; |
373 |
+- goto put_node; |
374 |
++ goto put_device; |
375 |
+ } |
376 |
+ |
377 |
+ /* Copy the code that puts DDR in self refresh to ocram */ |
378 |
+@@ -81,6 +81,8 @@ static int socfpga_setup_ocram_self_refresh(void) |
379 |
+ if (!socfpga_sdram_self_refresh_in_ocram) |
380 |
+ ret = -EFAULT; |
381 |
+ |
382 |
++put_device: |
383 |
++ put_device(&pdev->dev); |
384 |
+ put_node: |
385 |
+ of_node_put(np); |
386 |
+ |
387 |
+diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi |
388 |
+index cefda145c3c9..342733a20c33 100644 |
389 |
+--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi |
390 |
++++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi |
391 |
+@@ -279,7 +279,7 @@ |
392 |
+ |
393 |
+ ®_dldo4 { |
394 |
+ regulator-min-microvolt = <1800000>; |
395 |
+- regulator-max-microvolt = <3300000>; |
396 |
++ regulator-max-microvolt = <1800000>; |
397 |
+ regulator-name = "vcc-wifi-io"; |
398 |
+ }; |
399 |
+ |
400 |
+diff --git a/arch/arm64/boot/dts/amlogic/meson-khadas-vim3.dtsi b/arch/arm64/boot/dts/amlogic/meson-khadas-vim3.dtsi |
401 |
+index 1ef1e3672b96..ff5ba85b7562 100644 |
402 |
+--- a/arch/arm64/boot/dts/amlogic/meson-khadas-vim3.dtsi |
403 |
++++ b/arch/arm64/boot/dts/amlogic/meson-khadas-vim3.dtsi |
404 |
+@@ -270,7 +270,6 @@ |
405 |
+ |
406 |
+ bus-width = <4>; |
407 |
+ cap-sd-highspeed; |
408 |
+- sd-uhs-sdr50; |
409 |
+ max-frequency = <100000000>; |
410 |
+ |
411 |
+ non-removable; |
412 |
+diff --git a/arch/arm64/boot/dts/amlogic/meson-sm1-khadas-vim3l.dts b/arch/arm64/boot/dts/amlogic/meson-sm1-khadas-vim3l.dts |
413 |
+index dbbf29a0dbf6..026b21708b07 100644 |
414 |
+--- a/arch/arm64/boot/dts/amlogic/meson-sm1-khadas-vim3l.dts |
415 |
++++ b/arch/arm64/boot/dts/amlogic/meson-sm1-khadas-vim3l.dts |
416 |
+@@ -88,6 +88,10 @@ |
417 |
+ status = "okay"; |
418 |
+ }; |
419 |
+ |
420 |
++&sd_emmc_a { |
421 |
++ sd-uhs-sdr50; |
422 |
++}; |
423 |
++ |
424 |
+ &usb { |
425 |
+ phys = <&usb2_phy0>, <&usb2_phy1>; |
426 |
+ phy-names = "usb2-phy0", "usb2-phy1"; |
427 |
+diff --git a/arch/arm64/boot/dts/exynos/exynos7-espresso.dts b/arch/arm64/boot/dts/exynos/exynos7-espresso.dts |
428 |
+index 7af288fa9475..a9412805c1d6 100644 |
429 |
+--- a/arch/arm64/boot/dts/exynos/exynos7-espresso.dts |
430 |
++++ b/arch/arm64/boot/dts/exynos/exynos7-espresso.dts |
431 |
+@@ -157,6 +157,7 @@ |
432 |
+ regulator-min-microvolt = <700000>; |
433 |
+ regulator-max-microvolt = <1150000>; |
434 |
+ regulator-enable-ramp-delay = <125>; |
435 |
++ regulator-always-on; |
436 |
+ }; |
437 |
+ |
438 |
+ ldo8_reg: LDO8 { |
439 |
+diff --git a/arch/arm64/boot/dts/hisilicon/hi3660-hikey960.dts b/arch/arm64/boot/dts/hisilicon/hi3660-hikey960.dts |
440 |
+index e035cf195b19..8c4bfbaf3a80 100644 |
441 |
+--- a/arch/arm64/boot/dts/hisilicon/hi3660-hikey960.dts |
442 |
++++ b/arch/arm64/boot/dts/hisilicon/hi3660-hikey960.dts |
443 |
+@@ -530,6 +530,17 @@ |
444 |
+ status = "ok"; |
445 |
+ compatible = "adi,adv7533"; |
446 |
+ reg = <0x39>; |
447 |
++ adi,dsi-lanes = <4>; |
448 |
++ ports { |
449 |
++ #address-cells = <1>; |
450 |
++ #size-cells = <0>; |
451 |
++ port@0 { |
452 |
++ reg = <0>; |
453 |
++ }; |
454 |
++ port@1 { |
455 |
++ reg = <1>; |
456 |
++ }; |
457 |
++ }; |
458 |
+ }; |
459 |
+ }; |
460 |
+ |
461 |
+diff --git a/arch/arm64/boot/dts/hisilicon/hi6220-hikey.dts b/arch/arm64/boot/dts/hisilicon/hi6220-hikey.dts |
462 |
+index c14205cd6bf5..3e47150c05ec 100644 |
463 |
+--- a/arch/arm64/boot/dts/hisilicon/hi6220-hikey.dts |
464 |
++++ b/arch/arm64/boot/dts/hisilicon/hi6220-hikey.dts |
465 |
+@@ -516,7 +516,7 @@ |
466 |
+ reg = <0x39>; |
467 |
+ interrupt-parent = <&gpio1>; |
468 |
+ interrupts = <1 2>; |
469 |
+- pd-gpio = <&gpio0 4 0>; |
470 |
++ pd-gpios = <&gpio0 4 0>; |
471 |
+ adi,dsi-lanes = <4>; |
472 |
+ #sound-dai-cells = <0>; |
473 |
+ |
474 |
+diff --git a/arch/arm64/boot/dts/qcom/msm8916-pins.dtsi b/arch/arm64/boot/dts/qcom/msm8916-pins.dtsi |
475 |
+index 242aaea68804..1235830ffd0b 100644 |
476 |
+--- a/arch/arm64/boot/dts/qcom/msm8916-pins.dtsi |
477 |
++++ b/arch/arm64/boot/dts/qcom/msm8916-pins.dtsi |
478 |
+@@ -508,7 +508,7 @@ |
479 |
+ pins = "gpio63", "gpio64", "gpio65", "gpio66", |
480 |
+ "gpio67", "gpio68"; |
481 |
+ drive-strength = <8>; |
482 |
+- bias-pull-none; |
483 |
++ bias-disable; |
484 |
+ }; |
485 |
+ }; |
486 |
+ cdc_pdm_lines_sus: pdm_lines_off { |
487 |
+@@ -537,7 +537,7 @@ |
488 |
+ pins = "gpio113", "gpio114", "gpio115", |
489 |
+ "gpio116"; |
490 |
+ drive-strength = <8>; |
491 |
+- bias-pull-none; |
492 |
++ bias-disable; |
493 |
+ }; |
494 |
+ }; |
495 |
+ |
496 |
+@@ -565,7 +565,7 @@ |
497 |
+ pinconf { |
498 |
+ pins = "gpio110"; |
499 |
+ drive-strength = <8>; |
500 |
+- bias-pull-none; |
501 |
++ bias-disable; |
502 |
+ }; |
503 |
+ }; |
504 |
+ |
505 |
+@@ -591,7 +591,7 @@ |
506 |
+ pinconf { |
507 |
+ pins = "gpio116"; |
508 |
+ drive-strength = <8>; |
509 |
+- bias-pull-none; |
510 |
++ bias-disable; |
511 |
+ }; |
512 |
+ }; |
513 |
+ ext_mclk_tlmm_lines_sus: mclk_lines_off { |
514 |
+@@ -619,7 +619,7 @@ |
515 |
+ pins = "gpio112", "gpio117", "gpio118", |
516 |
+ "gpio119"; |
517 |
+ drive-strength = <8>; |
518 |
+- bias-pull-none; |
519 |
++ bias-disable; |
520 |
+ }; |
521 |
+ }; |
522 |
+ ext_sec_tlmm_lines_sus: tlmm_lines_off { |
523 |
+diff --git a/arch/arm64/boot/dts/renesas/r8a774a1.dtsi b/arch/arm64/boot/dts/renesas/r8a774a1.dtsi |
524 |
+index a603d947970e..16b059d7fd01 100644 |
525 |
+--- a/arch/arm64/boot/dts/renesas/r8a774a1.dtsi |
526 |
++++ b/arch/arm64/boot/dts/renesas/r8a774a1.dtsi |
527 |
+@@ -2250,7 +2250,7 @@ |
528 |
+ status = "disabled"; |
529 |
+ }; |
530 |
+ |
531 |
+- sdhi0: sd@ee100000 { |
532 |
++ sdhi0: mmc@ee100000 { |
533 |
+ compatible = "renesas,sdhi-r8a774a1", |
534 |
+ "renesas,rcar-gen3-sdhi"; |
535 |
+ reg = <0 0xee100000 0 0x2000>; |
536 |
+@@ -2262,7 +2262,7 @@ |
537 |
+ status = "disabled"; |
538 |
+ }; |
539 |
+ |
540 |
+- sdhi1: sd@ee120000 { |
541 |
++ sdhi1: mmc@ee120000 { |
542 |
+ compatible = "renesas,sdhi-r8a774a1", |
543 |
+ "renesas,rcar-gen3-sdhi"; |
544 |
+ reg = <0 0xee120000 0 0x2000>; |
545 |
+@@ -2274,7 +2274,7 @@ |
546 |
+ status = "disabled"; |
547 |
+ }; |
548 |
+ |
549 |
+- sdhi2: sd@ee140000 { |
550 |
++ sdhi2: mmc@ee140000 { |
551 |
+ compatible = "renesas,sdhi-r8a774a1", |
552 |
+ "renesas,rcar-gen3-sdhi"; |
553 |
+ reg = <0 0xee140000 0 0x2000>; |
554 |
+@@ -2286,7 +2286,7 @@ |
555 |
+ status = "disabled"; |
556 |
+ }; |
557 |
+ |
558 |
+- sdhi3: sd@ee160000 { |
559 |
++ sdhi3: mmc@ee160000 { |
560 |
+ compatible = "renesas,sdhi-r8a774a1", |
561 |
+ "renesas,rcar-gen3-sdhi"; |
562 |
+ reg = <0 0xee160000 0 0x2000>; |
563 |
+diff --git a/arch/arm64/boot/dts/renesas/r8a774b1.dtsi b/arch/arm64/boot/dts/renesas/r8a774b1.dtsi |
564 |
+index 1e51855c7cd3..6db8b6a4d191 100644 |
565 |
+--- a/arch/arm64/boot/dts/renesas/r8a774b1.dtsi |
566 |
++++ b/arch/arm64/boot/dts/renesas/r8a774b1.dtsi |
567 |
+@@ -2108,7 +2108,7 @@ |
568 |
+ status = "disabled"; |
569 |
+ }; |
570 |
+ |
571 |
+- sdhi0: sd@ee100000 { |
572 |
++ sdhi0: mmc@ee100000 { |
573 |
+ compatible = "renesas,sdhi-r8a774b1", |
574 |
+ "renesas,rcar-gen3-sdhi"; |
575 |
+ reg = <0 0xee100000 0 0x2000>; |
576 |
+@@ -2120,7 +2120,7 @@ |
577 |
+ status = "disabled"; |
578 |
+ }; |
579 |
+ |
580 |
+- sdhi1: sd@ee120000 { |
581 |
++ sdhi1: mmc@ee120000 { |
582 |
+ compatible = "renesas,sdhi-r8a774b1", |
583 |
+ "renesas,rcar-gen3-sdhi"; |
584 |
+ reg = <0 0xee120000 0 0x2000>; |
585 |
+@@ -2132,7 +2132,7 @@ |
586 |
+ status = "disabled"; |
587 |
+ }; |
588 |
+ |
589 |
+- sdhi2: sd@ee140000 { |
590 |
++ sdhi2: mmc@ee140000 { |
591 |
+ compatible = "renesas,sdhi-r8a774b1", |
592 |
+ "renesas,rcar-gen3-sdhi"; |
593 |
+ reg = <0 0xee140000 0 0x2000>; |
594 |
+@@ -2144,7 +2144,7 @@ |
595 |
+ status = "disabled"; |
596 |
+ }; |
597 |
+ |
598 |
+- sdhi3: sd@ee160000 { |
599 |
++ sdhi3: mmc@ee160000 { |
600 |
+ compatible = "renesas,sdhi-r8a774b1", |
601 |
+ "renesas,rcar-gen3-sdhi"; |
602 |
+ reg = <0 0xee160000 0 0x2000>; |
603 |
+diff --git a/arch/arm64/boot/dts/renesas/r8a774c0.dtsi b/arch/arm64/boot/dts/renesas/r8a774c0.dtsi |
604 |
+index 5c72a7efbb03..42171190cce4 100644 |
605 |
+--- a/arch/arm64/boot/dts/renesas/r8a774c0.dtsi |
606 |
++++ b/arch/arm64/boot/dts/renesas/r8a774c0.dtsi |
607 |
+@@ -1618,7 +1618,7 @@ |
608 |
+ status = "disabled"; |
609 |
+ }; |
610 |
+ |
611 |
+- sdhi0: sd@ee100000 { |
612 |
++ sdhi0: mmc@ee100000 { |
613 |
+ compatible = "renesas,sdhi-r8a774c0", |
614 |
+ "renesas,rcar-gen3-sdhi"; |
615 |
+ reg = <0 0xee100000 0 0x2000>; |
616 |
+@@ -1630,7 +1630,7 @@ |
617 |
+ status = "disabled"; |
618 |
+ }; |
619 |
+ |
620 |
+- sdhi1: sd@ee120000 { |
621 |
++ sdhi1: mmc@ee120000 { |
622 |
+ compatible = "renesas,sdhi-r8a774c0", |
623 |
+ "renesas,rcar-gen3-sdhi"; |
624 |
+ reg = <0 0xee120000 0 0x2000>; |
625 |
+@@ -1642,7 +1642,7 @@ |
626 |
+ status = "disabled"; |
627 |
+ }; |
628 |
+ |
629 |
+- sdhi3: sd@ee160000 { |
630 |
++ sdhi3: mmc@ee160000 { |
631 |
+ compatible = "renesas,sdhi-r8a774c0", |
632 |
+ "renesas,rcar-gen3-sdhi"; |
633 |
+ reg = <0 0xee160000 0 0x2000>; |
634 |
+diff --git a/arch/arm64/boot/dts/renesas/r8a77951.dtsi b/arch/arm64/boot/dts/renesas/r8a77951.dtsi |
635 |
+index 61d67d9714ab..9beb8e76d923 100644 |
636 |
+--- a/arch/arm64/boot/dts/renesas/r8a77951.dtsi |
637 |
++++ b/arch/arm64/boot/dts/renesas/r8a77951.dtsi |
638 |
+@@ -2590,7 +2590,7 @@ |
639 |
+ status = "disabled"; |
640 |
+ }; |
641 |
+ |
642 |
+- sdhi0: sd@ee100000 { |
643 |
++ sdhi0: mmc@ee100000 { |
644 |
+ compatible = "renesas,sdhi-r8a7795", |
645 |
+ "renesas,rcar-gen3-sdhi"; |
646 |
+ reg = <0 0xee100000 0 0x2000>; |
647 |
+@@ -2603,7 +2603,7 @@ |
648 |
+ status = "disabled"; |
649 |
+ }; |
650 |
+ |
651 |
+- sdhi1: sd@ee120000 { |
652 |
++ sdhi1: mmc@ee120000 { |
653 |
+ compatible = "renesas,sdhi-r8a7795", |
654 |
+ "renesas,rcar-gen3-sdhi"; |
655 |
+ reg = <0 0xee120000 0 0x2000>; |
656 |
+@@ -2616,7 +2616,7 @@ |
657 |
+ status = "disabled"; |
658 |
+ }; |
659 |
+ |
660 |
+- sdhi2: sd@ee140000 { |
661 |
++ sdhi2: mmc@ee140000 { |
662 |
+ compatible = "renesas,sdhi-r8a7795", |
663 |
+ "renesas,rcar-gen3-sdhi"; |
664 |
+ reg = <0 0xee140000 0 0x2000>; |
665 |
+@@ -2629,7 +2629,7 @@ |
666 |
+ status = "disabled"; |
667 |
+ }; |
668 |
+ |
669 |
+- sdhi3: sd@ee160000 { |
670 |
++ sdhi3: mmc@ee160000 { |
671 |
+ compatible = "renesas,sdhi-r8a7795", |
672 |
+ "renesas,rcar-gen3-sdhi"; |
673 |
+ reg = <0 0xee160000 0 0x2000>; |
674 |
+diff --git a/arch/arm64/boot/dts/renesas/r8a77960.dtsi b/arch/arm64/boot/dts/renesas/r8a77960.dtsi |
675 |
+index 33bf62acffbb..4dfb7f076787 100644 |
676 |
+--- a/arch/arm64/boot/dts/renesas/r8a77960.dtsi |
677 |
++++ b/arch/arm64/boot/dts/renesas/r8a77960.dtsi |
678 |
+@@ -2394,7 +2394,7 @@ |
679 |
+ status = "disabled"; |
680 |
+ }; |
681 |
+ |
682 |
+- sdhi0: sd@ee100000 { |
683 |
++ sdhi0: mmc@ee100000 { |
684 |
+ compatible = "renesas,sdhi-r8a7796", |
685 |
+ "renesas,rcar-gen3-sdhi"; |
686 |
+ reg = <0 0xee100000 0 0x2000>; |
687 |
+@@ -2407,7 +2407,7 @@ |
688 |
+ status = "disabled"; |
689 |
+ }; |
690 |
+ |
691 |
+- sdhi1: sd@ee120000 { |
692 |
++ sdhi1: mmc@ee120000 { |
693 |
+ compatible = "renesas,sdhi-r8a7796", |
694 |
+ "renesas,rcar-gen3-sdhi"; |
695 |
+ reg = <0 0xee120000 0 0x2000>; |
696 |
+@@ -2420,7 +2420,7 @@ |
697 |
+ status = "disabled"; |
698 |
+ }; |
699 |
+ |
700 |
+- sdhi2: sd@ee140000 { |
701 |
++ sdhi2: mmc@ee140000 { |
702 |
+ compatible = "renesas,sdhi-r8a7796", |
703 |
+ "renesas,rcar-gen3-sdhi"; |
704 |
+ reg = <0 0xee140000 0 0x2000>; |
705 |
+@@ -2433,7 +2433,7 @@ |
706 |
+ status = "disabled"; |
707 |
+ }; |
708 |
+ |
709 |
+- sdhi3: sd@ee160000 { |
710 |
++ sdhi3: mmc@ee160000 { |
711 |
+ compatible = "renesas,sdhi-r8a7796", |
712 |
+ "renesas,rcar-gen3-sdhi"; |
713 |
+ reg = <0 0xee160000 0 0x2000>; |
714 |
+diff --git a/arch/arm64/boot/dts/renesas/r8a77961.dtsi b/arch/arm64/boot/dts/renesas/r8a77961.dtsi |
715 |
+index 0d96f2d3492b..8227b68b5646 100644 |
716 |
+--- a/arch/arm64/boot/dts/renesas/r8a77961.dtsi |
717 |
++++ b/arch/arm64/boot/dts/renesas/r8a77961.dtsi |
718 |
+@@ -928,7 +928,7 @@ |
719 |
+ /* placeholder */ |
720 |
+ }; |
721 |
+ |
722 |
+- sdhi0: sd@ee100000 { |
723 |
++ sdhi0: mmc@ee100000 { |
724 |
+ compatible = "renesas,sdhi-r8a77961", |
725 |
+ "renesas,rcar-gen3-sdhi"; |
726 |
+ reg = <0 0xee100000 0 0x2000>; |
727 |
+@@ -940,7 +940,7 @@ |
728 |
+ status = "disabled"; |
729 |
+ }; |
730 |
+ |
731 |
+- sdhi1: sd@ee120000 { |
732 |
++ sdhi1: mmc@ee120000 { |
733 |
+ compatible = "renesas,sdhi-r8a77961", |
734 |
+ "renesas,rcar-gen3-sdhi"; |
735 |
+ reg = <0 0xee120000 0 0x2000>; |
736 |
+@@ -952,7 +952,7 @@ |
737 |
+ status = "disabled"; |
738 |
+ }; |
739 |
+ |
740 |
+- sdhi2: sd@ee140000 { |
741 |
++ sdhi2: mmc@ee140000 { |
742 |
+ compatible = "renesas,sdhi-r8a77961", |
743 |
+ "renesas,rcar-gen3-sdhi"; |
744 |
+ reg = <0 0xee140000 0 0x2000>; |
745 |
+@@ -964,7 +964,7 @@ |
746 |
+ status = "disabled"; |
747 |
+ }; |
748 |
+ |
749 |
+- sdhi3: sd@ee160000 { |
750 |
++ sdhi3: mmc@ee160000 { |
751 |
+ compatible = "renesas,sdhi-r8a77961", |
752 |
+ "renesas,rcar-gen3-sdhi"; |
753 |
+ reg = <0 0xee160000 0 0x2000>; |
754 |
+diff --git a/arch/arm64/boot/dts/renesas/r8a77965.dtsi b/arch/arm64/boot/dts/renesas/r8a77965.dtsi |
755 |
+index 6f7ab39fd282..fe4dc12e2bdf 100644 |
756 |
+--- a/arch/arm64/boot/dts/renesas/r8a77965.dtsi |
757 |
++++ b/arch/arm64/boot/dts/renesas/r8a77965.dtsi |
758 |
+@@ -2120,7 +2120,7 @@ |
759 |
+ status = "disabled"; |
760 |
+ }; |
761 |
+ |
762 |
+- sdhi0: sd@ee100000 { |
763 |
++ sdhi0: mmc@ee100000 { |
764 |
+ compatible = "renesas,sdhi-r8a77965", |
765 |
+ "renesas,rcar-gen3-sdhi"; |
766 |
+ reg = <0 0xee100000 0 0x2000>; |
767 |
+@@ -2133,7 +2133,7 @@ |
768 |
+ status = "disabled"; |
769 |
+ }; |
770 |
+ |
771 |
+- sdhi1: sd@ee120000 { |
772 |
++ sdhi1: mmc@ee120000 { |
773 |
+ compatible = "renesas,sdhi-r8a77965", |
774 |
+ "renesas,rcar-gen3-sdhi"; |
775 |
+ reg = <0 0xee120000 0 0x2000>; |
776 |
+@@ -2146,7 +2146,7 @@ |
777 |
+ status = "disabled"; |
778 |
+ }; |
779 |
+ |
780 |
+- sdhi2: sd@ee140000 { |
781 |
++ sdhi2: mmc@ee140000 { |
782 |
+ compatible = "renesas,sdhi-r8a77965", |
783 |
+ "renesas,rcar-gen3-sdhi"; |
784 |
+ reg = <0 0xee140000 0 0x2000>; |
785 |
+@@ -2159,7 +2159,7 @@ |
786 |
+ status = "disabled"; |
787 |
+ }; |
788 |
+ |
789 |
+- sdhi3: sd@ee160000 { |
790 |
++ sdhi3: mmc@ee160000 { |
791 |
+ compatible = "renesas,sdhi-r8a77965", |
792 |
+ "renesas,rcar-gen3-sdhi"; |
793 |
+ reg = <0 0xee160000 0 0x2000>; |
794 |
+diff --git a/arch/arm64/boot/dts/renesas/r8a77990.dtsi b/arch/arm64/boot/dts/renesas/r8a77990.dtsi |
795 |
+index cd11f24744d4..1991bdc36792 100644 |
796 |
+--- a/arch/arm64/boot/dts/renesas/r8a77990.dtsi |
797 |
++++ b/arch/arm64/boot/dts/renesas/r8a77990.dtsi |
798 |
+@@ -1595,7 +1595,7 @@ |
799 |
+ status = "disabled"; |
800 |
+ }; |
801 |
+ |
802 |
+- sdhi0: sd@ee100000 { |
803 |
++ sdhi0: mmc@ee100000 { |
804 |
+ compatible = "renesas,sdhi-r8a77990", |
805 |
+ "renesas,rcar-gen3-sdhi"; |
806 |
+ reg = <0 0xee100000 0 0x2000>; |
807 |
+@@ -1608,7 +1608,7 @@ |
808 |
+ status = "disabled"; |
809 |
+ }; |
810 |
+ |
811 |
+- sdhi1: sd@ee120000 { |
812 |
++ sdhi1: mmc@ee120000 { |
813 |
+ compatible = "renesas,sdhi-r8a77990", |
814 |
+ "renesas,rcar-gen3-sdhi"; |
815 |
+ reg = <0 0xee120000 0 0x2000>; |
816 |
+@@ -1621,7 +1621,7 @@ |
817 |
+ status = "disabled"; |
818 |
+ }; |
819 |
+ |
820 |
+- sdhi3: sd@ee160000 { |
821 |
++ sdhi3: mmc@ee160000 { |
822 |
+ compatible = "renesas,sdhi-r8a77990", |
823 |
+ "renesas,rcar-gen3-sdhi"; |
824 |
+ reg = <0 0xee160000 0 0x2000>; |
825 |
+diff --git a/arch/arm64/boot/dts/renesas/r8a77995.dtsi b/arch/arm64/boot/dts/renesas/r8a77995.dtsi |
826 |
+index e5617ec0f49c..2c2272f5f5b5 100644 |
827 |
+--- a/arch/arm64/boot/dts/renesas/r8a77995.dtsi |
828 |
++++ b/arch/arm64/boot/dts/renesas/r8a77995.dtsi |
829 |
+@@ -916,7 +916,7 @@ |
830 |
+ status = "disabled"; |
831 |
+ }; |
832 |
+ |
833 |
+- sdhi2: sd@ee140000 { |
834 |
++ sdhi2: mmc@ee140000 { |
835 |
+ compatible = "renesas,sdhi-r8a77995", |
836 |
+ "renesas,rcar-gen3-sdhi"; |
837 |
+ reg = <0 0xee140000 0 0x2000>; |
838 |
+diff --git a/arch/arm64/boot/dts/rockchip/rk3368-lion.dtsi b/arch/arm64/boot/dts/rockchip/rk3368-lion.dtsi |
839 |
+index e17311e09082..216aafd90e7f 100644 |
840 |
+--- a/arch/arm64/boot/dts/rockchip/rk3368-lion.dtsi |
841 |
++++ b/arch/arm64/boot/dts/rockchip/rk3368-lion.dtsi |
842 |
+@@ -156,7 +156,7 @@ |
843 |
+ pinctrl-0 = <&rgmii_pins>; |
844 |
+ snps,reset-active-low; |
845 |
+ snps,reset-delays-us = <0 10000 50000>; |
846 |
+- snps,reset-gpio = <&gpio3 RK_PB3 GPIO_ACTIVE_HIGH>; |
847 |
++ snps,reset-gpio = <&gpio3 RK_PB3 GPIO_ACTIVE_LOW>; |
848 |
+ tx_delay = <0x10>; |
849 |
+ rx_delay = <0x10>; |
850 |
+ status = "okay"; |
851 |
+diff --git a/arch/arm64/boot/dts/rockchip/rk3399-puma.dtsi b/arch/arm64/boot/dts/rockchip/rk3399-puma.dtsi |
852 |
+index 07694b196fdb..72c06abd27ea 100644 |
853 |
+--- a/arch/arm64/boot/dts/rockchip/rk3399-puma.dtsi |
854 |
++++ b/arch/arm64/boot/dts/rockchip/rk3399-puma.dtsi |
855 |
+@@ -101,7 +101,7 @@ |
856 |
+ |
857 |
+ vcc5v0_host: vcc5v0-host-regulator { |
858 |
+ compatible = "regulator-fixed"; |
859 |
+- gpio = <&gpio4 RK_PA3 GPIO_ACTIVE_HIGH>; |
860 |
++ gpio = <&gpio4 RK_PA3 GPIO_ACTIVE_LOW>; |
861 |
+ enable-active-low; |
862 |
+ pinctrl-names = "default"; |
863 |
+ pinctrl-0 = <&vcc5v0_host_en>; |
864 |
+@@ -157,7 +157,7 @@ |
865 |
+ phy-mode = "rgmii"; |
866 |
+ pinctrl-names = "default"; |
867 |
+ pinctrl-0 = <&rgmii_pins>; |
868 |
+- snps,reset-gpio = <&gpio3 RK_PC0 GPIO_ACTIVE_HIGH>; |
869 |
++ snps,reset-gpio = <&gpio3 RK_PC0 GPIO_ACTIVE_LOW>; |
870 |
+ snps,reset-active-low; |
871 |
+ snps,reset-delays-us = <0 10000 50000>; |
872 |
+ tx_delay = <0x10>; |
873 |
+diff --git a/arch/m68k/mac/iop.c b/arch/m68k/mac/iop.c |
874 |
+index 9bfa17015768..c432bfafe63e 100644 |
875 |
+--- a/arch/m68k/mac/iop.c |
876 |
++++ b/arch/m68k/mac/iop.c |
877 |
+@@ -183,7 +183,7 @@ static __inline__ void iop_writeb(volatile struct mac_iop *iop, __u16 addr, __u8 |
878 |
+ |
879 |
+ static __inline__ void iop_stop(volatile struct mac_iop *iop) |
880 |
+ { |
881 |
+- iop->status_ctrl &= ~IOP_RUN; |
882 |
++ iop->status_ctrl = IOP_AUTOINC; |
883 |
+ } |
884 |
+ |
885 |
+ static __inline__ void iop_start(volatile struct mac_iop *iop) |
886 |
+@@ -191,14 +191,9 @@ static __inline__ void iop_start(volatile struct mac_iop *iop) |
887 |
+ iop->status_ctrl = IOP_RUN | IOP_AUTOINC; |
888 |
+ } |
889 |
+ |
890 |
+-static __inline__ void iop_bypass(volatile struct mac_iop *iop) |
891 |
+-{ |
892 |
+- iop->status_ctrl |= IOP_BYPASS; |
893 |
+-} |
894 |
+- |
895 |
+ static __inline__ void iop_interrupt(volatile struct mac_iop *iop) |
896 |
+ { |
897 |
+- iop->status_ctrl |= IOP_IRQ; |
898 |
++ iop->status_ctrl = IOP_IRQ | IOP_RUN | IOP_AUTOINC; |
899 |
+ } |
900 |
+ |
901 |
+ static int iop_alive(volatile struct mac_iop *iop) |
902 |
+@@ -244,7 +239,6 @@ void __init iop_preinit(void) |
903 |
+ } else { |
904 |
+ iop_base[IOP_NUM_SCC] = (struct mac_iop *) SCC_IOP_BASE_QUADRA; |
905 |
+ } |
906 |
+- iop_base[IOP_NUM_SCC]->status_ctrl = 0x87; |
907 |
+ iop_scc_present = 1; |
908 |
+ } else { |
909 |
+ iop_base[IOP_NUM_SCC] = NULL; |
910 |
+@@ -256,7 +250,7 @@ void __init iop_preinit(void) |
911 |
+ } else { |
912 |
+ iop_base[IOP_NUM_ISM] = (struct mac_iop *) ISM_IOP_BASE_QUADRA; |
913 |
+ } |
914 |
+- iop_base[IOP_NUM_ISM]->status_ctrl = 0; |
915 |
++ iop_stop(iop_base[IOP_NUM_ISM]); |
916 |
+ iop_ism_present = 1; |
917 |
+ } else { |
918 |
+ iop_base[IOP_NUM_ISM] = NULL; |
919 |
+@@ -416,7 +410,8 @@ static void iop_handle_send(uint iop_num, uint chan) |
920 |
+ msg->status = IOP_MSGSTATUS_UNUSED; |
921 |
+ msg = msg->next; |
922 |
+ iop_send_queue[iop_num][chan] = msg; |
923 |
+- if (msg) iop_do_send(msg); |
924 |
++ if (msg && iop_readb(iop, IOP_ADDR_SEND_STATE + chan) == IOP_MSG_IDLE) |
925 |
++ iop_do_send(msg); |
926 |
+ } |
927 |
+ |
928 |
+ /* |
929 |
+@@ -490,16 +485,12 @@ int iop_send_message(uint iop_num, uint chan, void *privdata, |
930 |
+ |
931 |
+ if (!(q = iop_send_queue[iop_num][chan])) { |
932 |
+ iop_send_queue[iop_num][chan] = msg; |
933 |
++ iop_do_send(msg); |
934 |
+ } else { |
935 |
+ while (q->next) q = q->next; |
936 |
+ q->next = msg; |
937 |
+ } |
938 |
+ |
939 |
+- if (iop_readb(iop_base[iop_num], |
940 |
+- IOP_ADDR_SEND_STATE + chan) == IOP_MSG_IDLE) { |
941 |
+- iop_do_send(msg); |
942 |
+- } |
943 |
+- |
944 |
+ return 0; |
945 |
+ } |
946 |
+ |
947 |
+diff --git a/arch/mips/cavium-octeon/octeon-usb.c b/arch/mips/cavium-octeon/octeon-usb.c |
948 |
+index cc88a08bc1f7..4017398519cf 100644 |
949 |
+--- a/arch/mips/cavium-octeon/octeon-usb.c |
950 |
++++ b/arch/mips/cavium-octeon/octeon-usb.c |
951 |
+@@ -518,6 +518,7 @@ static int __init dwc3_octeon_device_init(void) |
952 |
+ |
953 |
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
954 |
+ if (res == NULL) { |
955 |
++ put_device(&pdev->dev); |
956 |
+ dev_err(&pdev->dev, "No memory resources\n"); |
957 |
+ return -ENXIO; |
958 |
+ } |
959 |
+@@ -529,8 +530,10 @@ static int __init dwc3_octeon_device_init(void) |
960 |
+ * know the difference. |
961 |
+ */ |
962 |
+ base = devm_ioremap_resource(&pdev->dev, res); |
963 |
+- if (IS_ERR(base)) |
964 |
++ if (IS_ERR(base)) { |
965 |
++ put_device(&pdev->dev); |
966 |
+ return PTR_ERR(base); |
967 |
++ } |
968 |
+ |
969 |
+ mutex_lock(&dwc3_octeon_clocks_mutex); |
970 |
+ dwc3_octeon_clocks_start(&pdev->dev, (u64)base); |
971 |
+diff --git a/arch/mips/pci/pci-xtalk-bridge.c b/arch/mips/pci/pci-xtalk-bridge.c |
972 |
+index 5958217861b8..9b3cc775c55e 100644 |
973 |
+--- a/arch/mips/pci/pci-xtalk-bridge.c |
974 |
++++ b/arch/mips/pci/pci-xtalk-bridge.c |
975 |
+@@ -728,6 +728,7 @@ err_free_resource: |
976 |
+ pci_free_resource_list(&host->windows); |
977 |
+ err_remove_domain: |
978 |
+ irq_domain_remove(domain); |
979 |
++ irq_domain_free_fwnode(fn); |
980 |
+ return err; |
981 |
+ } |
982 |
+ |
983 |
+@@ -735,8 +736,10 @@ static int bridge_remove(struct platform_device *pdev) |
984 |
+ { |
985 |
+ struct pci_bus *bus = platform_get_drvdata(pdev); |
986 |
+ struct bridge_controller *bc = BRIDGE_CONTROLLER(bus); |
987 |
++ struct fwnode_handle *fn = bc->domain->fwnode; |
988 |
+ |
989 |
+ irq_domain_remove(bc->domain); |
990 |
++ irq_domain_free_fwnode(fn); |
991 |
+ pci_lock_rescan_remove(); |
992 |
+ pci_stop_root_bus(bus); |
993 |
+ pci_remove_root_bus(bus); |
994 |
+diff --git a/arch/parisc/include/asm/barrier.h b/arch/parisc/include/asm/barrier.h |
995 |
+index dbaaca84f27f..640d46edf32e 100644 |
996 |
+--- a/arch/parisc/include/asm/barrier.h |
997 |
++++ b/arch/parisc/include/asm/barrier.h |
998 |
+@@ -26,6 +26,67 @@ |
999 |
+ #define __smp_rmb() mb() |
1000 |
+ #define __smp_wmb() mb() |
1001 |
+ |
1002 |
++#define __smp_store_release(p, v) \ |
1003 |
++do { \ |
1004 |
++ typeof(p) __p = (p); \ |
1005 |
++ union { typeof(*p) __val; char __c[1]; } __u = \ |
1006 |
++ { .__val = (__force typeof(*p)) (v) }; \ |
1007 |
++ compiletime_assert_atomic_type(*p); \ |
1008 |
++ switch (sizeof(*p)) { \ |
1009 |
++ case 1: \ |
1010 |
++ asm volatile("stb,ma %0,0(%1)" \ |
1011 |
++ : : "r"(*(__u8 *)__u.__c), "r"(__p) \ |
1012 |
++ : "memory"); \ |
1013 |
++ break; \ |
1014 |
++ case 2: \ |
1015 |
++ asm volatile("sth,ma %0,0(%1)" \ |
1016 |
++ : : "r"(*(__u16 *)__u.__c), "r"(__p) \ |
1017 |
++ : "memory"); \ |
1018 |
++ break; \ |
1019 |
++ case 4: \ |
1020 |
++ asm volatile("stw,ma %0,0(%1)" \ |
1021 |
++ : : "r"(*(__u32 *)__u.__c), "r"(__p) \ |
1022 |
++ : "memory"); \ |
1023 |
++ break; \ |
1024 |
++ case 8: \ |
1025 |
++ if (IS_ENABLED(CONFIG_64BIT)) \ |
1026 |
++ asm volatile("std,ma %0,0(%1)" \ |
1027 |
++ : : "r"(*(__u64 *)__u.__c), "r"(__p) \ |
1028 |
++ : "memory"); \ |
1029 |
++ break; \ |
1030 |
++ } \ |
1031 |
++} while (0) |
1032 |
++ |
1033 |
++#define __smp_load_acquire(p) \ |
1034 |
++({ \ |
1035 |
++ union { typeof(*p) __val; char __c[1]; } __u; \ |
1036 |
++ typeof(p) __p = (p); \ |
1037 |
++ compiletime_assert_atomic_type(*p); \ |
1038 |
++ switch (sizeof(*p)) { \ |
1039 |
++ case 1: \ |
1040 |
++ asm volatile("ldb,ma 0(%1),%0" \ |
1041 |
++ : "=r"(*(__u8 *)__u.__c) : "r"(__p) \ |
1042 |
++ : "memory"); \ |
1043 |
++ break; \ |
1044 |
++ case 2: \ |
1045 |
++ asm volatile("ldh,ma 0(%1),%0" \ |
1046 |
++ : "=r"(*(__u16 *)__u.__c) : "r"(__p) \ |
1047 |
++ : "memory"); \ |
1048 |
++ break; \ |
1049 |
++ case 4: \ |
1050 |
++ asm volatile("ldw,ma 0(%1),%0" \ |
1051 |
++ : "=r"(*(__u32 *)__u.__c) : "r"(__p) \ |
1052 |
++ : "memory"); \ |
1053 |
++ break; \ |
1054 |
++ case 8: \ |
1055 |
++ if (IS_ENABLED(CONFIG_64BIT)) \ |
1056 |
++ asm volatile("ldd,ma 0(%1),%0" \ |
1057 |
++ : "=r"(*(__u64 *)__u.__c) : "r"(__p) \ |
1058 |
++ : "memory"); \ |
1059 |
++ break; \ |
1060 |
++ } \ |
1061 |
++ __u.__val; \ |
1062 |
++}) |
1063 |
+ #include <asm-generic/barrier.h> |
1064 |
+ |
1065 |
+ #endif /* !__ASSEMBLY__ */ |
1066 |
+diff --git a/arch/parisc/include/asm/spinlock.h b/arch/parisc/include/asm/spinlock.h |
1067 |
+index 70fecb8dc4e2..51b6c47f802f 100644 |
1068 |
+--- a/arch/parisc/include/asm/spinlock.h |
1069 |
++++ b/arch/parisc/include/asm/spinlock.h |
1070 |
+@@ -10,34 +10,25 @@ |
1071 |
+ static inline int arch_spin_is_locked(arch_spinlock_t *x) |
1072 |
+ { |
1073 |
+ volatile unsigned int *a = __ldcw_align(x); |
1074 |
+- smp_mb(); |
1075 |
+ return *a == 0; |
1076 |
+ } |
1077 |
+ |
1078 |
+-static inline void arch_spin_lock(arch_spinlock_t *x) |
1079 |
+-{ |
1080 |
+- volatile unsigned int *a; |
1081 |
+- |
1082 |
+- a = __ldcw_align(x); |
1083 |
+- while (__ldcw(a) == 0) |
1084 |
+- while (*a == 0) |
1085 |
+- cpu_relax(); |
1086 |
+-} |
1087 |
++#define arch_spin_lock(lock) arch_spin_lock_flags(lock, 0) |
1088 |
+ |
1089 |
+ static inline void arch_spin_lock_flags(arch_spinlock_t *x, |
1090 |
+ unsigned long flags) |
1091 |
+ { |
1092 |
+ volatile unsigned int *a; |
1093 |
+- unsigned long flags_dis; |
1094 |
+ |
1095 |
+ a = __ldcw_align(x); |
1096 |
+- while (__ldcw(a) == 0) { |
1097 |
+- local_save_flags(flags_dis); |
1098 |
+- local_irq_restore(flags); |
1099 |
++ while (__ldcw(a) == 0) |
1100 |
+ while (*a == 0) |
1101 |
+- cpu_relax(); |
1102 |
+- local_irq_restore(flags_dis); |
1103 |
+- } |
1104 |
++ if (flags & PSW_SM_I) { |
1105 |
++ local_irq_enable(); |
1106 |
++ cpu_relax(); |
1107 |
++ local_irq_disable(); |
1108 |
++ } else |
1109 |
++ cpu_relax(); |
1110 |
+ } |
1111 |
+ #define arch_spin_lock_flags arch_spin_lock_flags |
1112 |
+ |
1113 |
+@@ -46,12 +37,8 @@ static inline void arch_spin_unlock(arch_spinlock_t *x) |
1114 |
+ volatile unsigned int *a; |
1115 |
+ |
1116 |
+ a = __ldcw_align(x); |
1117 |
+-#ifdef CONFIG_SMP |
1118 |
+- (void) __ldcw(a); |
1119 |
+-#else |
1120 |
+- mb(); |
1121 |
+-#endif |
1122 |
+- *a = 1; |
1123 |
++ /* Release with ordered store. */ |
1124 |
++ __asm__ __volatile__("stw,ma %0,0(%1)" : : "r"(1), "r"(a) : "memory"); |
1125 |
+ } |
1126 |
+ |
1127 |
+ static inline int arch_spin_trylock(arch_spinlock_t *x) |
1128 |
+diff --git a/arch/parisc/kernel/entry.S b/arch/parisc/kernel/entry.S |
1129 |
+index 9a03e29c8733..755240ce671e 100644 |
1130 |
+--- a/arch/parisc/kernel/entry.S |
1131 |
++++ b/arch/parisc/kernel/entry.S |
1132 |
+@@ -454,7 +454,6 @@ |
1133 |
+ nop |
1134 |
+ LDREG 0(\ptp),\pte |
1135 |
+ bb,<,n \pte,_PAGE_PRESENT_BIT,3f |
1136 |
+- LDCW 0(\tmp),\tmp1 |
1137 |
+ b \fault |
1138 |
+ stw \spc,0(\tmp) |
1139 |
+ 99: ALTERNATIVE(98b, 99b, ALT_COND_NO_SMP, INSN_NOP) |
1140 |
+@@ -464,23 +463,26 @@ |
1141 |
+ 3: |
1142 |
+ .endm |
1143 |
+ |
1144 |
+- /* Release pa_tlb_lock lock without reloading lock address. */ |
1145 |
+- .macro tlb_unlock0 spc,tmp,tmp1 |
1146 |
++ /* Release pa_tlb_lock lock without reloading lock address. |
1147 |
++ Note that the values in the register spc are limited to |
1148 |
++ NR_SPACE_IDS (262144). Thus, the stw instruction always |
1149 |
++ stores a nonzero value even when register spc is 64 bits. |
1150 |
++ We use an ordered store to ensure all prior accesses are |
1151 |
++ performed prior to releasing the lock. */ |
1152 |
++ .macro tlb_unlock0 spc,tmp |
1153 |
+ #ifdef CONFIG_SMP |
1154 |
+ 98: or,COND(=) %r0,\spc,%r0 |
1155 |
+- LDCW 0(\tmp),\tmp1 |
1156 |
+- or,COND(=) %r0,\spc,%r0 |
1157 |
+- stw \spc,0(\tmp) |
1158 |
++ stw,ma \spc,0(\tmp) |
1159 |
+ 99: ALTERNATIVE(98b, 99b, ALT_COND_NO_SMP, INSN_NOP) |
1160 |
+ #endif |
1161 |
+ .endm |
1162 |
+ |
1163 |
+ /* Release pa_tlb_lock lock. */ |
1164 |
+- .macro tlb_unlock1 spc,tmp,tmp1 |
1165 |
++ .macro tlb_unlock1 spc,tmp |
1166 |
+ #ifdef CONFIG_SMP |
1167 |
+ 98: load_pa_tlb_lock \tmp |
1168 |
+ 99: ALTERNATIVE(98b, 99b, ALT_COND_NO_SMP, INSN_NOP) |
1169 |
+- tlb_unlock0 \spc,\tmp,\tmp1 |
1170 |
++ tlb_unlock0 \spc,\tmp |
1171 |
+ #endif |
1172 |
+ .endm |
1173 |
+ |
1174 |
+@@ -1163,7 +1165,7 @@ dtlb_miss_20w: |
1175 |
+ |
1176 |
+ idtlbt pte,prot |
1177 |
+ |
1178 |
+- tlb_unlock1 spc,t0,t1 |
1179 |
++ tlb_unlock1 spc,t0 |
1180 |
+ rfir |
1181 |
+ nop |
1182 |
+ |
1183 |
+@@ -1189,7 +1191,7 @@ nadtlb_miss_20w: |
1184 |
+ |
1185 |
+ idtlbt pte,prot |
1186 |
+ |
1187 |
+- tlb_unlock1 spc,t0,t1 |
1188 |
++ tlb_unlock1 spc,t0 |
1189 |
+ rfir |
1190 |
+ nop |
1191 |
+ |
1192 |
+@@ -1223,7 +1225,7 @@ dtlb_miss_11: |
1193 |
+ |
1194 |
+ mtsp t1, %sr1 /* Restore sr1 */ |
1195 |
+ |
1196 |
+- tlb_unlock1 spc,t0,t1 |
1197 |
++ tlb_unlock1 spc,t0 |
1198 |
+ rfir |
1199 |
+ nop |
1200 |
+ |
1201 |
+@@ -1256,7 +1258,7 @@ nadtlb_miss_11: |
1202 |
+ |
1203 |
+ mtsp t1, %sr1 /* Restore sr1 */ |
1204 |
+ |
1205 |
+- tlb_unlock1 spc,t0,t1 |
1206 |
++ tlb_unlock1 spc,t0 |
1207 |
+ rfir |
1208 |
+ nop |
1209 |
+ |
1210 |
+@@ -1285,7 +1287,7 @@ dtlb_miss_20: |
1211 |
+ |
1212 |
+ idtlbt pte,prot |
1213 |
+ |
1214 |
+- tlb_unlock1 spc,t0,t1 |
1215 |
++ tlb_unlock1 spc,t0 |
1216 |
+ rfir |
1217 |
+ nop |
1218 |
+ |
1219 |
+@@ -1313,7 +1315,7 @@ nadtlb_miss_20: |
1220 |
+ |
1221 |
+ idtlbt pte,prot |
1222 |
+ |
1223 |
+- tlb_unlock1 spc,t0,t1 |
1224 |
++ tlb_unlock1 spc,t0 |
1225 |
+ rfir |
1226 |
+ nop |
1227 |
+ |
1228 |
+@@ -1420,7 +1422,7 @@ itlb_miss_20w: |
1229 |
+ |
1230 |
+ iitlbt pte,prot |
1231 |
+ |
1232 |
+- tlb_unlock1 spc,t0,t1 |
1233 |
++ tlb_unlock1 spc,t0 |
1234 |
+ rfir |
1235 |
+ nop |
1236 |
+ |
1237 |
+@@ -1444,7 +1446,7 @@ naitlb_miss_20w: |
1238 |
+ |
1239 |
+ iitlbt pte,prot |
1240 |
+ |
1241 |
+- tlb_unlock1 spc,t0,t1 |
1242 |
++ tlb_unlock1 spc,t0 |
1243 |
+ rfir |
1244 |
+ nop |
1245 |
+ |
1246 |
+@@ -1478,7 +1480,7 @@ itlb_miss_11: |
1247 |
+ |
1248 |
+ mtsp t1, %sr1 /* Restore sr1 */ |
1249 |
+ |
1250 |
+- tlb_unlock1 spc,t0,t1 |
1251 |
++ tlb_unlock1 spc,t0 |
1252 |
+ rfir |
1253 |
+ nop |
1254 |
+ |
1255 |
+@@ -1502,7 +1504,7 @@ naitlb_miss_11: |
1256 |
+ |
1257 |
+ mtsp t1, %sr1 /* Restore sr1 */ |
1258 |
+ |
1259 |
+- tlb_unlock1 spc,t0,t1 |
1260 |
++ tlb_unlock1 spc,t0 |
1261 |
+ rfir |
1262 |
+ nop |
1263 |
+ |
1264 |
+@@ -1532,7 +1534,7 @@ itlb_miss_20: |
1265 |
+ |
1266 |
+ iitlbt pte,prot |
1267 |
+ |
1268 |
+- tlb_unlock1 spc,t0,t1 |
1269 |
++ tlb_unlock1 spc,t0 |
1270 |
+ rfir |
1271 |
+ nop |
1272 |
+ |
1273 |
+@@ -1552,7 +1554,7 @@ naitlb_miss_20: |
1274 |
+ |
1275 |
+ iitlbt pte,prot |
1276 |
+ |
1277 |
+- tlb_unlock1 spc,t0,t1 |
1278 |
++ tlb_unlock1 spc,t0 |
1279 |
+ rfir |
1280 |
+ nop |
1281 |
+ |
1282 |
+@@ -1582,7 +1584,7 @@ dbit_trap_20w: |
1283 |
+ |
1284 |
+ idtlbt pte,prot |
1285 |
+ |
1286 |
+- tlb_unlock0 spc,t0,t1 |
1287 |
++ tlb_unlock0 spc,t0 |
1288 |
+ rfir |
1289 |
+ nop |
1290 |
+ #else |
1291 |
+@@ -1608,7 +1610,7 @@ dbit_trap_11: |
1292 |
+ |
1293 |
+ mtsp t1, %sr1 /* Restore sr1 */ |
1294 |
+ |
1295 |
+- tlb_unlock0 spc,t0,t1 |
1296 |
++ tlb_unlock0 spc,t0 |
1297 |
+ rfir |
1298 |
+ nop |
1299 |
+ |
1300 |
+@@ -1628,7 +1630,7 @@ dbit_trap_20: |
1301 |
+ |
1302 |
+ idtlbt pte,prot |
1303 |
+ |
1304 |
+- tlb_unlock0 spc,t0,t1 |
1305 |
++ tlb_unlock0 spc,t0 |
1306 |
+ rfir |
1307 |
+ nop |
1308 |
+ #endif |
1309 |
+diff --git a/arch/parisc/kernel/syscall.S b/arch/parisc/kernel/syscall.S |
1310 |
+index f05c9d5b6b9e..3ad61a177f5b 100644 |
1311 |
+--- a/arch/parisc/kernel/syscall.S |
1312 |
++++ b/arch/parisc/kernel/syscall.S |
1313 |
+@@ -640,11 +640,7 @@ cas_action: |
1314 |
+ sub,<> %r28, %r25, %r0 |
1315 |
+ 2: stw %r24, 0(%r26) |
1316 |
+ /* Free lock */ |
1317 |
+-#ifdef CONFIG_SMP |
1318 |
+-98: LDCW 0(%sr2,%r20), %r1 /* Barrier */ |
1319 |
+-99: ALTERNATIVE(98b, 99b, ALT_COND_NO_SMP, INSN_NOP) |
1320 |
+-#endif |
1321 |
+- stw %r20, 0(%sr2,%r20) |
1322 |
++ stw,ma %r20, 0(%sr2,%r20) |
1323 |
+ #if ENABLE_LWS_DEBUG |
1324 |
+ /* Clear thread register indicator */ |
1325 |
+ stw %r0, 4(%sr2,%r20) |
1326 |
+@@ -658,11 +654,7 @@ cas_action: |
1327 |
+ 3: |
1328 |
+ /* Error occurred on load or store */ |
1329 |
+ /* Free lock */ |
1330 |
+-#ifdef CONFIG_SMP |
1331 |
+-98: LDCW 0(%sr2,%r20), %r1 /* Barrier */ |
1332 |
+-99: ALTERNATIVE(98b, 99b, ALT_COND_NO_SMP, INSN_NOP) |
1333 |
+-#endif |
1334 |
+- stw %r20, 0(%sr2,%r20) |
1335 |
++ stw,ma %r20, 0(%sr2,%r20) |
1336 |
+ #if ENABLE_LWS_DEBUG |
1337 |
+ stw %r0, 4(%sr2,%r20) |
1338 |
+ #endif |
1339 |
+@@ -863,11 +855,7 @@ cas2_action: |
1340 |
+ |
1341 |
+ cas2_end: |
1342 |
+ /* Free lock */ |
1343 |
+-#ifdef CONFIG_SMP |
1344 |
+-98: LDCW 0(%sr2,%r20), %r1 /* Barrier */ |
1345 |
+-99: ALTERNATIVE(98b, 99b, ALT_COND_NO_SMP, INSN_NOP) |
1346 |
+-#endif |
1347 |
+- stw %r20, 0(%sr2,%r20) |
1348 |
++ stw,ma %r20, 0(%sr2,%r20) |
1349 |
+ /* Enable interrupts */ |
1350 |
+ ssm PSW_SM_I, %r0 |
1351 |
+ /* Return to userspace, set no error */ |
1352 |
+@@ -877,11 +865,7 @@ cas2_end: |
1353 |
+ 22: |
1354 |
+ /* Error occurred on load or store */ |
1355 |
+ /* Free lock */ |
1356 |
+-#ifdef CONFIG_SMP |
1357 |
+-98: LDCW 0(%sr2,%r20), %r1 /* Barrier */ |
1358 |
+-99: ALTERNATIVE(98b, 99b, ALT_COND_NO_SMP, INSN_NOP) |
1359 |
+-#endif |
1360 |
+- stw %r20, 0(%sr2,%r20) |
1361 |
++ stw,ma %r20, 0(%sr2,%r20) |
1362 |
+ ssm PSW_SM_I, %r0 |
1363 |
+ ldo 1(%r0),%r28 |
1364 |
+ b lws_exit |
1365 |
+diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile |
1366 |
+index c53a1b8bba8b..e32a9e40a522 100644 |
1367 |
+--- a/arch/powerpc/boot/Makefile |
1368 |
++++ b/arch/powerpc/boot/Makefile |
1369 |
+@@ -119,7 +119,7 @@ src-wlib-y := string.S crt0.S stdio.c decompress.c main.c \ |
1370 |
+ elf_util.c $(zlib-y) devtree.c stdlib.c \ |
1371 |
+ oflib.c ofconsole.c cuboot.c |
1372 |
+ |
1373 |
+-src-wlib-$(CONFIG_PPC_MPC52XX) += mpc52xx-psc.c |
1374 |
++src-wlib-$(CONFIG_PPC_MPC52xx) += mpc52xx-psc.c |
1375 |
+ src-wlib-$(CONFIG_PPC64_BOOT_WRAPPER) += opal-calls.S opal.c |
1376 |
+ ifndef CONFIG_PPC64_BOOT_WRAPPER |
1377 |
+ src-wlib-y += crtsavres.S |
1378 |
+diff --git a/arch/powerpc/boot/serial.c b/arch/powerpc/boot/serial.c |
1379 |
+index 9457863147f9..00179cd6bdd0 100644 |
1380 |
+--- a/arch/powerpc/boot/serial.c |
1381 |
++++ b/arch/powerpc/boot/serial.c |
1382 |
+@@ -128,7 +128,7 @@ int serial_console_init(void) |
1383 |
+ dt_is_compatible(devp, "fsl,cpm2-smc-uart")) |
1384 |
+ rc = cpm_console_init(devp, &serial_cd); |
1385 |
+ #endif |
1386 |
+-#ifdef CONFIG_PPC_MPC52XX |
1387 |
++#ifdef CONFIG_PPC_MPC52xx |
1388 |
+ else if (dt_is_compatible(devp, "fsl,mpc5200-psc-uart")) |
1389 |
+ rc = mpc5200_psc_console_init(devp, &serial_cd); |
1390 |
+ #endif |
1391 |
+diff --git a/arch/powerpc/include/asm/fixmap.h b/arch/powerpc/include/asm/fixmap.h |
1392 |
+index 2ef155a3c821..77ab25a19974 100644 |
1393 |
+--- a/arch/powerpc/include/asm/fixmap.h |
1394 |
++++ b/arch/powerpc/include/asm/fixmap.h |
1395 |
+@@ -52,7 +52,7 @@ enum fixed_addresses { |
1396 |
+ FIX_HOLE, |
1397 |
+ /* reserve the top 128K for early debugging purposes */ |
1398 |
+ FIX_EARLY_DEBUG_TOP = FIX_HOLE, |
1399 |
+- FIX_EARLY_DEBUG_BASE = FIX_EARLY_DEBUG_TOP+((128*1024)/PAGE_SIZE)-1, |
1400 |
++ FIX_EARLY_DEBUG_BASE = FIX_EARLY_DEBUG_TOP+(ALIGN(SZ_128, PAGE_SIZE)/PAGE_SIZE)-1, |
1401 |
+ #ifdef CONFIG_HIGHMEM |
1402 |
+ FIX_KMAP_BEGIN, /* reserved pte's for temporary kernel mappings */ |
1403 |
+ FIX_KMAP_END = FIX_KMAP_BEGIN+(KM_TYPE_NR*NR_CPUS)-1, |
1404 |
+diff --git a/arch/powerpc/include/asm/perf_event.h b/arch/powerpc/include/asm/perf_event.h |
1405 |
+index eed3954082fa..1e8b2e1ec1db 100644 |
1406 |
+--- a/arch/powerpc/include/asm/perf_event.h |
1407 |
++++ b/arch/powerpc/include/asm/perf_event.h |
1408 |
+@@ -12,6 +12,8 @@ |
1409 |
+ |
1410 |
+ #ifdef CONFIG_PPC_PERF_CTRS |
1411 |
+ #include <asm/perf_event_server.h> |
1412 |
++#else |
1413 |
++static inline bool is_sier_available(void) { return false; } |
1414 |
+ #endif |
1415 |
+ |
1416 |
+ #ifdef CONFIG_FSL_EMB_PERF_EVENT |
1417 |
+diff --git a/arch/powerpc/include/asm/ptrace.h b/arch/powerpc/include/asm/ptrace.h |
1418 |
+index e0195e6b892b..71ade62fb897 100644 |
1419 |
+--- a/arch/powerpc/include/asm/ptrace.h |
1420 |
++++ b/arch/powerpc/include/asm/ptrace.h |
1421 |
+@@ -206,7 +206,7 @@ do { \ |
1422 |
+ #endif /* __powerpc64__ */ |
1423 |
+ |
1424 |
+ #define arch_has_single_step() (1) |
1425 |
+-#ifndef CONFIG_BOOK3S_601 |
1426 |
++#ifndef CONFIG_PPC_BOOK3S_601 |
1427 |
+ #define arch_has_block_step() (true) |
1428 |
+ #else |
1429 |
+ #define arch_has_block_step() (false) |
1430 |
+diff --git a/arch/powerpc/include/asm/rtas.h b/arch/powerpc/include/asm/rtas.h |
1431 |
+index 3c1887351c71..bd227e0eab07 100644 |
1432 |
+--- a/arch/powerpc/include/asm/rtas.h |
1433 |
++++ b/arch/powerpc/include/asm/rtas.h |
1434 |
+@@ -368,8 +368,6 @@ extern int rtas_set_indicator_fast(int indicator, int index, int new_value); |
1435 |
+ extern void rtas_progress(char *s, unsigned short hex); |
1436 |
+ extern int rtas_suspend_cpu(struct rtas_suspend_me_data *data); |
1437 |
+ extern int rtas_suspend_last_cpu(struct rtas_suspend_me_data *data); |
1438 |
+-extern int rtas_online_cpus_mask(cpumask_var_t cpus); |
1439 |
+-extern int rtas_offline_cpus_mask(cpumask_var_t cpus); |
1440 |
+ extern int rtas_ibm_suspend_me(u64 handle); |
1441 |
+ |
1442 |
+ struct rtc_time; |
1443 |
+diff --git a/arch/powerpc/include/asm/timex.h b/arch/powerpc/include/asm/timex.h |
1444 |
+index d2d2c4bd8435..6047402b0a4d 100644 |
1445 |
+--- a/arch/powerpc/include/asm/timex.h |
1446 |
++++ b/arch/powerpc/include/asm/timex.h |
1447 |
+@@ -17,7 +17,7 @@ typedef unsigned long cycles_t; |
1448 |
+ |
1449 |
+ static inline cycles_t get_cycles(void) |
1450 |
+ { |
1451 |
+- if (IS_ENABLED(CONFIG_BOOK3S_601)) |
1452 |
++ if (IS_ENABLED(CONFIG_PPC_BOOK3S_601)) |
1453 |
+ return 0; |
1454 |
+ |
1455 |
+ return mftb(); |
1456 |
+diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c |
1457 |
+index c5fa251b8950..01210593d60c 100644 |
1458 |
+--- a/arch/powerpc/kernel/rtas.c |
1459 |
++++ b/arch/powerpc/kernel/rtas.c |
1460 |
+@@ -842,96 +842,6 @@ static void rtas_percpu_suspend_me(void *info) |
1461 |
+ __rtas_suspend_cpu((struct rtas_suspend_me_data *)info, 1); |
1462 |
+ } |
1463 |
+ |
1464 |
+-enum rtas_cpu_state { |
1465 |
+- DOWN, |
1466 |
+- UP, |
1467 |
+-}; |
1468 |
+- |
1469 |
+-#ifndef CONFIG_SMP |
1470 |
+-static int rtas_cpu_state_change_mask(enum rtas_cpu_state state, |
1471 |
+- cpumask_var_t cpus) |
1472 |
+-{ |
1473 |
+- if (!cpumask_empty(cpus)) { |
1474 |
+- cpumask_clear(cpus); |
1475 |
+- return -EINVAL; |
1476 |
+- } else |
1477 |
+- return 0; |
1478 |
+-} |
1479 |
+-#else |
1480 |
+-/* On return cpumask will be altered to indicate CPUs changed. |
1481 |
+- * CPUs with states changed will be set in the mask, |
1482 |
+- * CPUs with status unchanged will be unset in the mask. */ |
1483 |
+-static int rtas_cpu_state_change_mask(enum rtas_cpu_state state, |
1484 |
+- cpumask_var_t cpus) |
1485 |
+-{ |
1486 |
+- int cpu; |
1487 |
+- int cpuret = 0; |
1488 |
+- int ret = 0; |
1489 |
+- |
1490 |
+- if (cpumask_empty(cpus)) |
1491 |
+- return 0; |
1492 |
+- |
1493 |
+- for_each_cpu(cpu, cpus) { |
1494 |
+- struct device *dev = get_cpu_device(cpu); |
1495 |
+- |
1496 |
+- switch (state) { |
1497 |
+- case DOWN: |
1498 |
+- cpuret = device_offline(dev); |
1499 |
+- break; |
1500 |
+- case UP: |
1501 |
+- cpuret = device_online(dev); |
1502 |
+- break; |
1503 |
+- } |
1504 |
+- if (cpuret < 0) { |
1505 |
+- pr_debug("%s: cpu_%s for cpu#%d returned %d.\n", |
1506 |
+- __func__, |
1507 |
+- ((state == UP) ? "up" : "down"), |
1508 |
+- cpu, cpuret); |
1509 |
+- if (!ret) |
1510 |
+- ret = cpuret; |
1511 |
+- if (state == UP) { |
1512 |
+- /* clear bits for unchanged cpus, return */ |
1513 |
+- cpumask_shift_right(cpus, cpus, cpu); |
1514 |
+- cpumask_shift_left(cpus, cpus, cpu); |
1515 |
+- break; |
1516 |
+- } else { |
1517 |
+- /* clear bit for unchanged cpu, continue */ |
1518 |
+- cpumask_clear_cpu(cpu, cpus); |
1519 |
+- } |
1520 |
+- } |
1521 |
+- cond_resched(); |
1522 |
+- } |
1523 |
+- |
1524 |
+- return ret; |
1525 |
+-} |
1526 |
+-#endif |
1527 |
+- |
1528 |
+-int rtas_online_cpus_mask(cpumask_var_t cpus) |
1529 |
+-{ |
1530 |
+- int ret; |
1531 |
+- |
1532 |
+- ret = rtas_cpu_state_change_mask(UP, cpus); |
1533 |
+- |
1534 |
+- if (ret) { |
1535 |
+- cpumask_var_t tmp_mask; |
1536 |
+- |
1537 |
+- if (!alloc_cpumask_var(&tmp_mask, GFP_KERNEL)) |
1538 |
+- return ret; |
1539 |
+- |
1540 |
+- /* Use tmp_mask to preserve cpus mask from first failure */ |
1541 |
+- cpumask_copy(tmp_mask, cpus); |
1542 |
+- rtas_offline_cpus_mask(tmp_mask); |
1543 |
+- free_cpumask_var(tmp_mask); |
1544 |
+- } |
1545 |
+- |
1546 |
+- return ret; |
1547 |
+-} |
1548 |
+- |
1549 |
+-int rtas_offline_cpus_mask(cpumask_var_t cpus) |
1550 |
+-{ |
1551 |
+- return rtas_cpu_state_change_mask(DOWN, cpus); |
1552 |
+-} |
1553 |
+- |
1554 |
+ int rtas_ibm_suspend_me(u64 handle) |
1555 |
+ { |
1556 |
+ long state; |
1557 |
+@@ -939,8 +849,6 @@ int rtas_ibm_suspend_me(u64 handle) |
1558 |
+ unsigned long retbuf[PLPAR_HCALL_BUFSIZE]; |
1559 |
+ struct rtas_suspend_me_data data; |
1560 |
+ DECLARE_COMPLETION_ONSTACK(done); |
1561 |
+- cpumask_var_t offline_mask; |
1562 |
+- int cpuret; |
1563 |
+ |
1564 |
+ if (!rtas_service_present("ibm,suspend-me")) |
1565 |
+ return -ENOSYS; |
1566 |
+@@ -961,9 +869,6 @@ int rtas_ibm_suspend_me(u64 handle) |
1567 |
+ return -EIO; |
1568 |
+ } |
1569 |
+ |
1570 |
+- if (!alloc_cpumask_var(&offline_mask, GFP_KERNEL)) |
1571 |
+- return -ENOMEM; |
1572 |
+- |
1573 |
+ atomic_set(&data.working, 0); |
1574 |
+ atomic_set(&data.done, 0); |
1575 |
+ atomic_set(&data.error, 0); |
1576 |
+@@ -972,24 +877,8 @@ int rtas_ibm_suspend_me(u64 handle) |
1577 |
+ |
1578 |
+ lock_device_hotplug(); |
1579 |
+ |
1580 |
+- /* All present CPUs must be online */ |
1581 |
+- cpumask_andnot(offline_mask, cpu_present_mask, cpu_online_mask); |
1582 |
+- cpuret = rtas_online_cpus_mask(offline_mask); |
1583 |
+- if (cpuret) { |
1584 |
+- pr_err("%s: Could not bring present CPUs online.\n", __func__); |
1585 |
+- atomic_set(&data.error, cpuret); |
1586 |
+- goto out; |
1587 |
+- } |
1588 |
+- |
1589 |
+ cpu_hotplug_disable(); |
1590 |
+ |
1591 |
+- /* Check if we raced with a CPU-Offline Operation */ |
1592 |
+- if (!cpumask_equal(cpu_present_mask, cpu_online_mask)) { |
1593 |
+- pr_info("%s: Raced against a concurrent CPU-Offline\n", __func__); |
1594 |
+- atomic_set(&data.error, -EAGAIN); |
1595 |
+- goto out_hotplug_enable; |
1596 |
+- } |
1597 |
+- |
1598 |
+ /* Call function on all CPUs. One of us will make the |
1599 |
+ * rtas call |
1600 |
+ */ |
1601 |
+@@ -1000,18 +889,11 @@ int rtas_ibm_suspend_me(u64 handle) |
1602 |
+ if (atomic_read(&data.error) != 0) |
1603 |
+ printk(KERN_ERR "Error doing global join\n"); |
1604 |
+ |
1605 |
+-out_hotplug_enable: |
1606 |
+- cpu_hotplug_enable(); |
1607 |
+ |
1608 |
+- /* Take down CPUs not online prior to suspend */ |
1609 |
+- cpuret = rtas_offline_cpus_mask(offline_mask); |
1610 |
+- if (cpuret) |
1611 |
+- pr_warn("%s: Could not restore CPUs to offline state.\n", |
1612 |
+- __func__); |
1613 |
++ cpu_hotplug_enable(); |
1614 |
+ |
1615 |
+-out: |
1616 |
+ unlock_device_hotplug(); |
1617 |
+- free_cpumask_var(offline_mask); |
1618 |
++ |
1619 |
+ return atomic_read(&data.error); |
1620 |
+ } |
1621 |
+ #else /* CONFIG_PPC_PSERIES */ |
1622 |
+diff --git a/arch/powerpc/kernel/vdso.c b/arch/powerpc/kernel/vdso.c |
1623 |
+index f38f26e844b6..1c07df1ad560 100644 |
1624 |
+--- a/arch/powerpc/kernel/vdso.c |
1625 |
++++ b/arch/powerpc/kernel/vdso.c |
1626 |
+@@ -678,7 +678,7 @@ int vdso_getcpu_init(void) |
1627 |
+ node = cpu_to_node(cpu); |
1628 |
+ WARN_ON_ONCE(node > 0xffff); |
1629 |
+ |
1630 |
+- val = (cpu & 0xfff) | ((node & 0xffff) << 16); |
1631 |
++ val = (cpu & 0xffff) | ((node & 0xffff) << 16); |
1632 |
+ mtspr(SPRN_SPRG_VDSO_WRITE, val); |
1633 |
+ get_paca()->sprg_vdso = val; |
1634 |
+ |
1635 |
+diff --git a/arch/powerpc/mm/book3s64/hash_utils.c b/arch/powerpc/mm/book3s64/hash_utils.c |
1636 |
+index 8ed2411c3f39..cf2e1b06e5d4 100644 |
1637 |
+--- a/arch/powerpc/mm/book3s64/hash_utils.c |
1638 |
++++ b/arch/powerpc/mm/book3s64/hash_utils.c |
1639 |
+@@ -660,11 +660,10 @@ static void __init htab_init_page_sizes(void) |
1640 |
+ * Pick a size for the linear mapping. Currently, we only |
1641 |
+ * support 16M, 1M and 4K which is the default |
1642 |
+ */ |
1643 |
+- if (IS_ENABLED(STRICT_KERNEL_RWX) && |
1644 |
++ if (IS_ENABLED(CONFIG_STRICT_KERNEL_RWX) && |
1645 |
+ (unsigned long)_stext % 0x1000000) { |
1646 |
+ if (mmu_psize_defs[MMU_PAGE_16M].shift) |
1647 |
+- pr_warn("Kernel not 16M aligned, " |
1648 |
+- "disabling 16M linear map alignment"); |
1649 |
++ pr_warn("Kernel not 16M aligned, disabling 16M linear map alignment\n"); |
1650 |
+ aligned = false; |
1651 |
+ } |
1652 |
+ |
1653 |
+diff --git a/arch/powerpc/mm/book3s64/pkeys.c b/arch/powerpc/mm/book3s64/pkeys.c |
1654 |
+index 268ce9581676..fa237c8c161f 100644 |
1655 |
+--- a/arch/powerpc/mm/book3s64/pkeys.c |
1656 |
++++ b/arch/powerpc/mm/book3s64/pkeys.c |
1657 |
+@@ -83,13 +83,17 @@ static int pkey_initialize(void) |
1658 |
+ scan_pkey_feature(); |
1659 |
+ |
1660 |
+ /* |
1661 |
+- * Let's assume 32 pkeys on P8 bare metal, if its not defined by device |
1662 |
+- * tree. We make this exception since skiboot forgot to expose this |
1663 |
+- * property on power8. |
1664 |
++ * Let's assume 32 pkeys on P8/P9 bare metal, if its not defined by device |
1665 |
++ * tree. We make this exception since some version of skiboot forgot to |
1666 |
++ * expose this property on power8/9. |
1667 |
+ */ |
1668 |
+- if (!pkeys_devtree_defined && !firmware_has_feature(FW_FEATURE_LPAR) && |
1669 |
+- cpu_has_feature(CPU_FTRS_POWER8)) |
1670 |
+- pkeys_total = 32; |
1671 |
++ if (!pkeys_devtree_defined && !firmware_has_feature(FW_FEATURE_LPAR)) { |
1672 |
++ unsigned long pvr = mfspr(SPRN_PVR); |
1673 |
++ |
1674 |
++ if (PVR_VER(pvr) == PVR_POWER8 || PVR_VER(pvr) == PVR_POWER8E || |
1675 |
++ PVR_VER(pvr) == PVR_POWER8NVL || PVR_VER(pvr) == PVR_POWER9) |
1676 |
++ pkeys_total = 32; |
1677 |
++ } |
1678 |
+ |
1679 |
+ /* |
1680 |
+ * Adjust the upper limit, based on the number of bits supported by |
1681 |
+diff --git a/arch/powerpc/platforms/pseries/hotplug-cpu.c b/arch/powerpc/platforms/pseries/hotplug-cpu.c |
1682 |
+index 3e8cbfe7a80f..6d4ee03d476a 100644 |
1683 |
+--- a/arch/powerpc/platforms/pseries/hotplug-cpu.c |
1684 |
++++ b/arch/powerpc/platforms/pseries/hotplug-cpu.c |
1685 |
+@@ -35,54 +35,10 @@ |
1686 |
+ #include <asm/topology.h> |
1687 |
+ |
1688 |
+ #include "pseries.h" |
1689 |
+-#include "offline_states.h" |
1690 |
+ |
1691 |
+ /* This version can't take the spinlock, because it never returns */ |
1692 |
+ static int rtas_stop_self_token = RTAS_UNKNOWN_SERVICE; |
1693 |
+ |
1694 |
+-static DEFINE_PER_CPU(enum cpu_state_vals, preferred_offline_state) = |
1695 |
+- CPU_STATE_OFFLINE; |
1696 |
+-static DEFINE_PER_CPU(enum cpu_state_vals, current_state) = CPU_STATE_OFFLINE; |
1697 |
+- |
1698 |
+-static enum cpu_state_vals default_offline_state = CPU_STATE_OFFLINE; |
1699 |
+- |
1700 |
+-static bool cede_offline_enabled __read_mostly = true; |
1701 |
+- |
1702 |
+-/* |
1703 |
+- * Enable/disable cede_offline when available. |
1704 |
+- */ |
1705 |
+-static int __init setup_cede_offline(char *str) |
1706 |
+-{ |
1707 |
+- return (kstrtobool(str, &cede_offline_enabled) == 0); |
1708 |
+-} |
1709 |
+- |
1710 |
+-__setup("cede_offline=", setup_cede_offline); |
1711 |
+- |
1712 |
+-enum cpu_state_vals get_cpu_current_state(int cpu) |
1713 |
+-{ |
1714 |
+- return per_cpu(current_state, cpu); |
1715 |
+-} |
1716 |
+- |
1717 |
+-void set_cpu_current_state(int cpu, enum cpu_state_vals state) |
1718 |
+-{ |
1719 |
+- per_cpu(current_state, cpu) = state; |
1720 |
+-} |
1721 |
+- |
1722 |
+-enum cpu_state_vals get_preferred_offline_state(int cpu) |
1723 |
+-{ |
1724 |
+- return per_cpu(preferred_offline_state, cpu); |
1725 |
+-} |
1726 |
+- |
1727 |
+-void set_preferred_offline_state(int cpu, enum cpu_state_vals state) |
1728 |
+-{ |
1729 |
+- per_cpu(preferred_offline_state, cpu) = state; |
1730 |
+-} |
1731 |
+- |
1732 |
+-void set_default_offline_state(int cpu) |
1733 |
+-{ |
1734 |
+- per_cpu(preferred_offline_state, cpu) = default_offline_state; |
1735 |
+-} |
1736 |
+- |
1737 |
+ static void rtas_stop_self(void) |
1738 |
+ { |
1739 |
+ static struct rtas_args args; |
1740 |
+@@ -101,9 +57,7 @@ static void rtas_stop_self(void) |
1741 |
+ |
1742 |
+ static void pseries_mach_cpu_die(void) |
1743 |
+ { |
1744 |
+- unsigned int cpu = smp_processor_id(); |
1745 |
+ unsigned int hwcpu = hard_smp_processor_id(); |
1746 |
+- u8 cede_latency_hint = 0; |
1747 |
+ |
1748 |
+ local_irq_disable(); |
1749 |
+ idle_task_exit(); |
1750 |
+@@ -112,49 +66,6 @@ static void pseries_mach_cpu_die(void) |
1751 |
+ else |
1752 |
+ xics_teardown_cpu(); |
1753 |
+ |
1754 |
+- if (get_preferred_offline_state(cpu) == CPU_STATE_INACTIVE) { |
1755 |
+- set_cpu_current_state(cpu, CPU_STATE_INACTIVE); |
1756 |
+- if (ppc_md.suspend_disable_cpu) |
1757 |
+- ppc_md.suspend_disable_cpu(); |
1758 |
+- |
1759 |
+- cede_latency_hint = 2; |
1760 |
+- |
1761 |
+- get_lppaca()->idle = 1; |
1762 |
+- if (!lppaca_shared_proc(get_lppaca())) |
1763 |
+- get_lppaca()->donate_dedicated_cpu = 1; |
1764 |
+- |
1765 |
+- while (get_preferred_offline_state(cpu) == CPU_STATE_INACTIVE) { |
1766 |
+- while (!prep_irq_for_idle()) { |
1767 |
+- local_irq_enable(); |
1768 |
+- local_irq_disable(); |
1769 |
+- } |
1770 |
+- |
1771 |
+- extended_cede_processor(cede_latency_hint); |
1772 |
+- } |
1773 |
+- |
1774 |
+- local_irq_disable(); |
1775 |
+- |
1776 |
+- if (!lppaca_shared_proc(get_lppaca())) |
1777 |
+- get_lppaca()->donate_dedicated_cpu = 0; |
1778 |
+- get_lppaca()->idle = 0; |
1779 |
+- |
1780 |
+- if (get_preferred_offline_state(cpu) == CPU_STATE_ONLINE) { |
1781 |
+- unregister_slb_shadow(hwcpu); |
1782 |
+- |
1783 |
+- hard_irq_disable(); |
1784 |
+- /* |
1785 |
+- * Call to start_secondary_resume() will not return. |
1786 |
+- * Kernel stack will be reset and start_secondary() |
1787 |
+- * will be called to continue the online operation. |
1788 |
+- */ |
1789 |
+- start_secondary_resume(); |
1790 |
+- } |
1791 |
+- } |
1792 |
+- |
1793 |
+- /* Requested state is CPU_STATE_OFFLINE at this point */ |
1794 |
+- WARN_ON(get_preferred_offline_state(cpu) != CPU_STATE_OFFLINE); |
1795 |
+- |
1796 |
+- set_cpu_current_state(cpu, CPU_STATE_OFFLINE); |
1797 |
+ unregister_slb_shadow(hwcpu); |
1798 |
+ rtas_stop_self(); |
1799 |
+ |
1800 |
+@@ -200,24 +111,13 @@ static void pseries_cpu_die(unsigned int cpu) |
1801 |
+ int cpu_status = 1; |
1802 |
+ unsigned int pcpu = get_hard_smp_processor_id(cpu); |
1803 |
+ |
1804 |
+- if (get_preferred_offline_state(cpu) == CPU_STATE_INACTIVE) { |
1805 |
+- cpu_status = 1; |
1806 |
+- for (tries = 0; tries < 5000; tries++) { |
1807 |
+- if (get_cpu_current_state(cpu) == CPU_STATE_INACTIVE) { |
1808 |
+- cpu_status = 0; |
1809 |
+- break; |
1810 |
+- } |
1811 |
+- msleep(1); |
1812 |
+- } |
1813 |
+- } else if (get_preferred_offline_state(cpu) == CPU_STATE_OFFLINE) { |
1814 |
++ for (tries = 0; tries < 25; tries++) { |
1815 |
++ cpu_status = smp_query_cpu_stopped(pcpu); |
1816 |
++ if (cpu_status == QCSS_STOPPED || |
1817 |
++ cpu_status == QCSS_HARDWARE_ERROR) |
1818 |
++ break; |
1819 |
++ cpu_relax(); |
1820 |
+ |
1821 |
+- for (tries = 0; tries < 25; tries++) { |
1822 |
+- cpu_status = smp_query_cpu_stopped(pcpu); |
1823 |
+- if (cpu_status == QCSS_STOPPED || |
1824 |
+- cpu_status == QCSS_HARDWARE_ERROR) |
1825 |
+- break; |
1826 |
+- cpu_relax(); |
1827 |
+- } |
1828 |
+ } |
1829 |
+ |
1830 |
+ if (cpu_status != 0) { |
1831 |
+@@ -359,28 +259,15 @@ static int dlpar_offline_cpu(struct device_node *dn) |
1832 |
+ if (get_hard_smp_processor_id(cpu) != thread) |
1833 |
+ continue; |
1834 |
+ |
1835 |
+- if (get_cpu_current_state(cpu) == CPU_STATE_OFFLINE) |
1836 |
++ if (!cpu_online(cpu)) |
1837 |
+ break; |
1838 |
+ |
1839 |
+- if (get_cpu_current_state(cpu) == CPU_STATE_ONLINE) { |
1840 |
+- set_preferred_offline_state(cpu, |
1841 |
+- CPU_STATE_OFFLINE); |
1842 |
+- cpu_maps_update_done(); |
1843 |
+- timed_topology_update(1); |
1844 |
+- rc = device_offline(get_cpu_device(cpu)); |
1845 |
+- if (rc) |
1846 |
+- goto out; |
1847 |
+- cpu_maps_update_begin(); |
1848 |
+- break; |
1849 |
+- } |
1850 |
+- |
1851 |
+- /* |
1852 |
+- * The cpu is in CPU_STATE_INACTIVE. |
1853 |
+- * Upgrade it's state to CPU_STATE_OFFLINE. |
1854 |
+- */ |
1855 |
+- set_preferred_offline_state(cpu, CPU_STATE_OFFLINE); |
1856 |
+- WARN_ON(plpar_hcall_norets(H_PROD, thread) != H_SUCCESS); |
1857 |
+- __cpu_die(cpu); |
1858 |
++ cpu_maps_update_done(); |
1859 |
++ timed_topology_update(1); |
1860 |
++ rc = device_offline(get_cpu_device(cpu)); |
1861 |
++ if (rc) |
1862 |
++ goto out; |
1863 |
++ cpu_maps_update_begin(); |
1864 |
+ break; |
1865 |
+ } |
1866 |
+ if (cpu == num_possible_cpus()) { |
1867 |
+@@ -414,8 +301,6 @@ static int dlpar_online_cpu(struct device_node *dn) |
1868 |
+ for_each_present_cpu(cpu) { |
1869 |
+ if (get_hard_smp_processor_id(cpu) != thread) |
1870 |
+ continue; |
1871 |
+- BUG_ON(get_cpu_current_state(cpu) |
1872 |
+- != CPU_STATE_OFFLINE); |
1873 |
+ cpu_maps_update_done(); |
1874 |
+ timed_topology_update(1); |
1875 |
+ find_and_online_cpu_nid(cpu); |
1876 |
+@@ -854,7 +739,6 @@ static int dlpar_cpu_add_by_count(u32 cpus_to_add) |
1877 |
+ parent = of_find_node_by_path("/cpus"); |
1878 |
+ if (!parent) { |
1879 |
+ pr_warn("Could not find CPU root node in device tree\n"); |
1880 |
+- kfree(cpu_drcs); |
1881 |
+ return -1; |
1882 |
+ } |
1883 |
+ |
1884 |
+@@ -1013,27 +897,8 @@ static struct notifier_block pseries_smp_nb = { |
1885 |
+ .notifier_call = pseries_smp_notifier, |
1886 |
+ }; |
1887 |
+ |
1888 |
+-#define MAX_CEDE_LATENCY_LEVELS 4 |
1889 |
+-#define CEDE_LATENCY_PARAM_LENGTH 10 |
1890 |
+-#define CEDE_LATENCY_PARAM_MAX_LENGTH \ |
1891 |
+- (MAX_CEDE_LATENCY_LEVELS * CEDE_LATENCY_PARAM_LENGTH * sizeof(char)) |
1892 |
+-#define CEDE_LATENCY_TOKEN 45 |
1893 |
+- |
1894 |
+-static char cede_parameters[CEDE_LATENCY_PARAM_MAX_LENGTH]; |
1895 |
+- |
1896 |
+-static int parse_cede_parameters(void) |
1897 |
+-{ |
1898 |
+- memset(cede_parameters, 0, CEDE_LATENCY_PARAM_MAX_LENGTH); |
1899 |
+- return rtas_call(rtas_token("ibm,get-system-parameter"), 3, 1, |
1900 |
+- NULL, |
1901 |
+- CEDE_LATENCY_TOKEN, |
1902 |
+- __pa(cede_parameters), |
1903 |
+- CEDE_LATENCY_PARAM_MAX_LENGTH); |
1904 |
+-} |
1905 |
+- |
1906 |
+ static int __init pseries_cpu_hotplug_init(void) |
1907 |
+ { |
1908 |
+- int cpu; |
1909 |
+ int qcss_tok; |
1910 |
+ |
1911 |
+ #ifdef CONFIG_ARCH_CPU_PROBE_RELEASE |
1912 |
+@@ -1056,16 +921,8 @@ static int __init pseries_cpu_hotplug_init(void) |
1913 |
+ smp_ops->cpu_die = pseries_cpu_die; |
1914 |
+ |
1915 |
+ /* Processors can be added/removed only on LPAR */ |
1916 |
+- if (firmware_has_feature(FW_FEATURE_LPAR)) { |
1917 |
++ if (firmware_has_feature(FW_FEATURE_LPAR)) |
1918 |
+ of_reconfig_notifier_register(&pseries_smp_nb); |
1919 |
+- cpu_maps_update_begin(); |
1920 |
+- if (cede_offline_enabled && parse_cede_parameters() == 0) { |
1921 |
+- default_offline_state = CPU_STATE_INACTIVE; |
1922 |
+- for_each_online_cpu(cpu) |
1923 |
+- set_default_offline_state(cpu); |
1924 |
+- } |
1925 |
+- cpu_maps_update_done(); |
1926 |
+- } |
1927 |
+ |
1928 |
+ return 0; |
1929 |
+ } |
1930 |
+diff --git a/arch/powerpc/platforms/pseries/offline_states.h b/arch/powerpc/platforms/pseries/offline_states.h |
1931 |
+deleted file mode 100644 |
1932 |
+index 51414aee2862..000000000000 |
1933 |
+--- a/arch/powerpc/platforms/pseries/offline_states.h |
1934 |
++++ /dev/null |
1935 |
+@@ -1,38 +0,0 @@ |
1936 |
+-/* SPDX-License-Identifier: GPL-2.0 */ |
1937 |
+-#ifndef _OFFLINE_STATES_H_ |
1938 |
+-#define _OFFLINE_STATES_H_ |
1939 |
+- |
1940 |
+-/* Cpu offline states go here */ |
1941 |
+-enum cpu_state_vals { |
1942 |
+- CPU_STATE_OFFLINE, |
1943 |
+- CPU_STATE_INACTIVE, |
1944 |
+- CPU_STATE_ONLINE, |
1945 |
+- CPU_MAX_OFFLINE_STATES |
1946 |
+-}; |
1947 |
+- |
1948 |
+-#ifdef CONFIG_HOTPLUG_CPU |
1949 |
+-extern enum cpu_state_vals get_cpu_current_state(int cpu); |
1950 |
+-extern void set_cpu_current_state(int cpu, enum cpu_state_vals state); |
1951 |
+-extern void set_preferred_offline_state(int cpu, enum cpu_state_vals state); |
1952 |
+-extern void set_default_offline_state(int cpu); |
1953 |
+-#else |
1954 |
+-static inline enum cpu_state_vals get_cpu_current_state(int cpu) |
1955 |
+-{ |
1956 |
+- return CPU_STATE_ONLINE; |
1957 |
+-} |
1958 |
+- |
1959 |
+-static inline void set_cpu_current_state(int cpu, enum cpu_state_vals state) |
1960 |
+-{ |
1961 |
+-} |
1962 |
+- |
1963 |
+-static inline void set_preferred_offline_state(int cpu, enum cpu_state_vals state) |
1964 |
+-{ |
1965 |
+-} |
1966 |
+- |
1967 |
+-static inline void set_default_offline_state(int cpu) |
1968 |
+-{ |
1969 |
+-} |
1970 |
+-#endif |
1971 |
+- |
1972 |
+-extern enum cpu_state_vals get_preferred_offline_state(int cpu); |
1973 |
+-#endif |
1974 |
+diff --git a/arch/powerpc/platforms/pseries/pmem.c b/arch/powerpc/platforms/pseries/pmem.c |
1975 |
+index f860a897a9e0..f827de7087e9 100644 |
1976 |
+--- a/arch/powerpc/platforms/pseries/pmem.c |
1977 |
++++ b/arch/powerpc/platforms/pseries/pmem.c |
1978 |
+@@ -24,7 +24,6 @@ |
1979 |
+ #include <asm/topology.h> |
1980 |
+ |
1981 |
+ #include "pseries.h" |
1982 |
+-#include "offline_states.h" |
1983 |
+ |
1984 |
+ static struct device_node *pmem_node; |
1985 |
+ |
1986 |
+diff --git a/arch/powerpc/platforms/pseries/smp.c b/arch/powerpc/platforms/pseries/smp.c |
1987 |
+index ad61e90032da..a8a070269151 100644 |
1988 |
+--- a/arch/powerpc/platforms/pseries/smp.c |
1989 |
++++ b/arch/powerpc/platforms/pseries/smp.c |
1990 |
+@@ -44,8 +44,6 @@ |
1991 |
+ #include <asm/svm.h> |
1992 |
+ |
1993 |
+ #include "pseries.h" |
1994 |
+-#include "offline_states.h" |
1995 |
+- |
1996 |
+ |
1997 |
+ /* |
1998 |
+ * The Primary thread of each non-boot processor was started from the OF client |
1999 |
+@@ -108,10 +106,7 @@ static inline int smp_startup_cpu(unsigned int lcpu) |
2000 |
+ |
2001 |
+ /* Fixup atomic count: it exited inside IRQ handler. */ |
2002 |
+ task_thread_info(paca_ptrs[lcpu]->__current)->preempt_count = 0; |
2003 |
+-#ifdef CONFIG_HOTPLUG_CPU |
2004 |
+- if (get_cpu_current_state(lcpu) == CPU_STATE_INACTIVE) |
2005 |
+- goto out; |
2006 |
+-#endif |
2007 |
++ |
2008 |
+ /* |
2009 |
+ * If the RTAS start-cpu token does not exist then presume the |
2010 |
+ * cpu is already spinning. |
2011 |
+@@ -126,9 +121,6 @@ static inline int smp_startup_cpu(unsigned int lcpu) |
2012 |
+ return 0; |
2013 |
+ } |
2014 |
+ |
2015 |
+-#ifdef CONFIG_HOTPLUG_CPU |
2016 |
+-out: |
2017 |
+-#endif |
2018 |
+ return 1; |
2019 |
+ } |
2020 |
+ |
2021 |
+@@ -143,10 +135,6 @@ static void smp_setup_cpu(int cpu) |
2022 |
+ vpa_init(cpu); |
2023 |
+ |
2024 |
+ cpumask_clear_cpu(cpu, of_spin_mask); |
2025 |
+-#ifdef CONFIG_HOTPLUG_CPU |
2026 |
+- set_cpu_current_state(cpu, CPU_STATE_ONLINE); |
2027 |
+- set_default_offline_state(cpu); |
2028 |
+-#endif |
2029 |
+ } |
2030 |
+ |
2031 |
+ static int smp_pSeries_kick_cpu(int nr) |
2032 |
+@@ -163,20 +151,6 @@ static int smp_pSeries_kick_cpu(int nr) |
2033 |
+ * the processor will continue on to secondary_start |
2034 |
+ */ |
2035 |
+ paca_ptrs[nr]->cpu_start = 1; |
2036 |
+-#ifdef CONFIG_HOTPLUG_CPU |
2037 |
+- set_preferred_offline_state(nr, CPU_STATE_ONLINE); |
2038 |
+- |
2039 |
+- if (get_cpu_current_state(nr) == CPU_STATE_INACTIVE) { |
2040 |
+- long rc; |
2041 |
+- unsigned long hcpuid; |
2042 |
+- |
2043 |
+- hcpuid = get_hard_smp_processor_id(nr); |
2044 |
+- rc = plpar_hcall_norets(H_PROD, hcpuid); |
2045 |
+- if (rc != H_SUCCESS) |
2046 |
+- printk(KERN_ERR "Error: Prod to wake up processor %d " |
2047 |
+- "Ret= %ld\n", nr, rc); |
2048 |
+- } |
2049 |
+-#endif |
2050 |
+ |
2051 |
+ return 0; |
2052 |
+ } |
2053 |
+diff --git a/arch/powerpc/platforms/pseries/suspend.c b/arch/powerpc/platforms/pseries/suspend.c |
2054 |
+index 0a24a5a185f0..f789693f61f4 100644 |
2055 |
+--- a/arch/powerpc/platforms/pseries/suspend.c |
2056 |
++++ b/arch/powerpc/platforms/pseries/suspend.c |
2057 |
+@@ -132,15 +132,11 @@ static ssize_t store_hibernate(struct device *dev, |
2058 |
+ struct device_attribute *attr, |
2059 |
+ const char *buf, size_t count) |
2060 |
+ { |
2061 |
+- cpumask_var_t offline_mask; |
2062 |
+ int rc; |
2063 |
+ |
2064 |
+ if (!capable(CAP_SYS_ADMIN)) |
2065 |
+ return -EPERM; |
2066 |
+ |
2067 |
+- if (!alloc_cpumask_var(&offline_mask, GFP_KERNEL)) |
2068 |
+- return -ENOMEM; |
2069 |
+- |
2070 |
+ stream_id = simple_strtoul(buf, NULL, 16); |
2071 |
+ |
2072 |
+ do { |
2073 |
+@@ -150,32 +146,16 @@ static ssize_t store_hibernate(struct device *dev, |
2074 |
+ } while (rc == -EAGAIN); |
2075 |
+ |
2076 |
+ if (!rc) { |
2077 |
+- /* All present CPUs must be online */ |
2078 |
+- cpumask_andnot(offline_mask, cpu_present_mask, |
2079 |
+- cpu_online_mask); |
2080 |
+- rc = rtas_online_cpus_mask(offline_mask); |
2081 |
+- if (rc) { |
2082 |
+- pr_err("%s: Could not bring present CPUs online.\n", |
2083 |
+- __func__); |
2084 |
+- goto out; |
2085 |
+- } |
2086 |
+- |
2087 |
+ stop_topology_update(); |
2088 |
+ rc = pm_suspend(PM_SUSPEND_MEM); |
2089 |
+ start_topology_update(); |
2090 |
+- |
2091 |
+- /* Take down CPUs not online prior to suspend */ |
2092 |
+- if (!rtas_offline_cpus_mask(offline_mask)) |
2093 |
+- pr_warn("%s: Could not restore CPUs to offline " |
2094 |
+- "state.\n", __func__); |
2095 |
+ } |
2096 |
+ |
2097 |
+ stream_id = 0; |
2098 |
+ |
2099 |
+ if (!rc) |
2100 |
+ rc = count; |
2101 |
+-out: |
2102 |
+- free_cpumask_var(offline_mask); |
2103 |
++ |
2104 |
+ return rc; |
2105 |
+ } |
2106 |
+ |
2107 |
+diff --git a/arch/s390/include/asm/topology.h b/arch/s390/include/asm/topology.h |
2108 |
+index fbb507504a3b..3a0ac0c7a9a3 100644 |
2109 |
+--- a/arch/s390/include/asm/topology.h |
2110 |
++++ b/arch/s390/include/asm/topology.h |
2111 |
+@@ -86,12 +86,6 @@ static inline const struct cpumask *cpumask_of_node(int node) |
2112 |
+ |
2113 |
+ #define pcibus_to_node(bus) __pcibus_to_node(bus) |
2114 |
+ |
2115 |
+-#define node_distance(a, b) __node_distance(a, b) |
2116 |
+-static inline int __node_distance(int a, int b) |
2117 |
+-{ |
2118 |
+- return 0; |
2119 |
+-} |
2120 |
+- |
2121 |
+ #else /* !CONFIG_NUMA */ |
2122 |
+ |
2123 |
+ #define numa_node_id numa_node_id |
2124 |
+diff --git a/arch/s390/mm/gmap.c b/arch/s390/mm/gmap.c |
2125 |
+index 1a95d8809cc3..d035fcdcf083 100644 |
2126 |
+--- a/arch/s390/mm/gmap.c |
2127 |
++++ b/arch/s390/mm/gmap.c |
2128 |
+@@ -2485,23 +2485,36 @@ void gmap_sync_dirty_log_pmd(struct gmap *gmap, unsigned long bitmap[4], |
2129 |
+ } |
2130 |
+ EXPORT_SYMBOL_GPL(gmap_sync_dirty_log_pmd); |
2131 |
+ |
2132 |
++#ifdef CONFIG_TRANSPARENT_HUGEPAGE |
2133 |
++static int thp_split_walk_pmd_entry(pmd_t *pmd, unsigned long addr, |
2134 |
++ unsigned long end, struct mm_walk *walk) |
2135 |
++{ |
2136 |
++ struct vm_area_struct *vma = walk->vma; |
2137 |
++ |
2138 |
++ split_huge_pmd(vma, pmd, addr); |
2139 |
++ return 0; |
2140 |
++} |
2141 |
++ |
2142 |
++static const struct mm_walk_ops thp_split_walk_ops = { |
2143 |
++ .pmd_entry = thp_split_walk_pmd_entry, |
2144 |
++}; |
2145 |
++ |
2146 |
+ static inline void thp_split_mm(struct mm_struct *mm) |
2147 |
+ { |
2148 |
+-#ifdef CONFIG_TRANSPARENT_HUGEPAGE |
2149 |
+ struct vm_area_struct *vma; |
2150 |
+- unsigned long addr; |
2151 |
+ |
2152 |
+ for (vma = mm->mmap; vma != NULL; vma = vma->vm_next) { |
2153 |
+- for (addr = vma->vm_start; |
2154 |
+- addr < vma->vm_end; |
2155 |
+- addr += PAGE_SIZE) |
2156 |
+- follow_page(vma, addr, FOLL_SPLIT); |
2157 |
+ vma->vm_flags &= ~VM_HUGEPAGE; |
2158 |
+ vma->vm_flags |= VM_NOHUGEPAGE; |
2159 |
++ walk_page_vma(vma, &thp_split_walk_ops, NULL); |
2160 |
+ } |
2161 |
+ mm->def_flags |= VM_NOHUGEPAGE; |
2162 |
+-#endif |
2163 |
+ } |
2164 |
++#else |
2165 |
++static inline void thp_split_mm(struct mm_struct *mm) |
2166 |
++{ |
2167 |
++} |
2168 |
++#endif /* CONFIG_TRANSPARENT_HUGEPAGE */ |
2169 |
+ |
2170 |
+ /* |
2171 |
+ * Remove all empty zero pages from the mapping for lazy refaulting |
2172 |
+diff --git a/arch/s390/net/bpf_jit_comp.c b/arch/s390/net/bpf_jit_comp.c |
2173 |
+index 0f37a1b635f8..95809599ebff 100644 |
2174 |
+--- a/arch/s390/net/bpf_jit_comp.c |
2175 |
++++ b/arch/s390/net/bpf_jit_comp.c |
2176 |
+@@ -489,6 +489,24 @@ static void save_restore_regs(struct bpf_jit *jit, int op, u32 stack_depth) |
2177 |
+ } while (re <= last); |
2178 |
+ } |
2179 |
+ |
2180 |
++static void bpf_skip(struct bpf_jit *jit, int size) |
2181 |
++{ |
2182 |
++ if (size >= 6 && !is_valid_rel(size)) { |
2183 |
++ /* brcl 0xf,size */ |
2184 |
++ EMIT6_PCREL_RIL(0xc0f4000000, size); |
2185 |
++ size -= 6; |
2186 |
++ } else if (size >= 4 && is_valid_rel(size)) { |
2187 |
++ /* brc 0xf,size */ |
2188 |
++ EMIT4_PCREL(0xa7f40000, size); |
2189 |
++ size -= 4; |
2190 |
++ } |
2191 |
++ while (size >= 2) { |
2192 |
++ /* bcr 0,%0 */ |
2193 |
++ _EMIT2(0x0700); |
2194 |
++ size -= 2; |
2195 |
++ } |
2196 |
++} |
2197 |
++ |
2198 |
+ /* |
2199 |
+ * Emit function prologue |
2200 |
+ * |
2201 |
+@@ -1267,8 +1285,12 @@ static noinline int bpf_jit_insn(struct bpf_jit *jit, struct bpf_prog *fp, |
2202 |
+ last = (i == fp->len - 1) ? 1 : 0; |
2203 |
+ if (last) |
2204 |
+ break; |
2205 |
+- /* j <exit> */ |
2206 |
+- EMIT4_PCREL(0xa7f40000, jit->exit_ip - jit->prg); |
2207 |
++ if (!is_first_pass(jit) && can_use_rel(jit, jit->exit_ip)) |
2208 |
++ /* brc 0xf, <exit> */ |
2209 |
++ EMIT4_PCREL_RIC(0xa7040000, 0xf, jit->exit_ip); |
2210 |
++ else |
2211 |
++ /* brcl 0xf, <exit> */ |
2212 |
++ EMIT6_PCREL_RILC(0xc0040000, 0xf, jit->exit_ip); |
2213 |
+ break; |
2214 |
+ /* |
2215 |
+ * Branch relative (number of skipped instructions) to offset on |
2216 |
+@@ -1416,21 +1438,10 @@ branch_ks: |
2217 |
+ } |
2218 |
+ break; |
2219 |
+ branch_ku: |
2220 |
+- is_jmp32 = BPF_CLASS(insn->code) == BPF_JMP32; |
2221 |
+- /* clfi or clgfi %dst,imm */ |
2222 |
+- EMIT6_IMM(is_jmp32 ? 0xc20f0000 : 0xc20e0000, |
2223 |
+- dst_reg, imm); |
2224 |
+- if (!is_first_pass(jit) && |
2225 |
+- can_use_rel(jit, addrs[i + off + 1])) { |
2226 |
+- /* brc mask,off */ |
2227 |
+- EMIT4_PCREL_RIC(0xa7040000, |
2228 |
+- mask >> 12, addrs[i + off + 1]); |
2229 |
+- } else { |
2230 |
+- /* brcl mask,off */ |
2231 |
+- EMIT6_PCREL_RILC(0xc0040000, |
2232 |
+- mask >> 12, addrs[i + off + 1]); |
2233 |
+- } |
2234 |
+- break; |
2235 |
++ /* lgfi %w1,imm (load sign extend imm) */ |
2236 |
++ src_reg = REG_1; |
2237 |
++ EMIT6_IMM(0xc0010000, src_reg, imm); |
2238 |
++ goto branch_xu; |
2239 |
+ branch_xs: |
2240 |
+ is_jmp32 = BPF_CLASS(insn->code) == BPF_JMP32; |
2241 |
+ if (!is_first_pass(jit) && |
2242 |
+@@ -1509,7 +1520,14 @@ static bool bpf_is_new_addr_sane(struct bpf_jit *jit, int i) |
2243 |
+ */ |
2244 |
+ static int bpf_set_addr(struct bpf_jit *jit, int i) |
2245 |
+ { |
2246 |
+- if (!bpf_is_new_addr_sane(jit, i)) |
2247 |
++ int delta; |
2248 |
++ |
2249 |
++ if (is_codegen_pass(jit)) { |
2250 |
++ delta = jit->prg - jit->addrs[i]; |
2251 |
++ if (delta < 0) |
2252 |
++ bpf_skip(jit, -delta); |
2253 |
++ } |
2254 |
++ if (WARN_ON_ONCE(!bpf_is_new_addr_sane(jit, i))) |
2255 |
+ return -1; |
2256 |
+ jit->addrs[i] = jit->prg; |
2257 |
+ return 0; |
2258 |
+diff --git a/arch/x86/crypto/aes_ctrby8_avx-x86_64.S b/arch/x86/crypto/aes_ctrby8_avx-x86_64.S |
2259 |
+index ec437db1fa54..494a3bda8487 100644 |
2260 |
+--- a/arch/x86/crypto/aes_ctrby8_avx-x86_64.S |
2261 |
++++ b/arch/x86/crypto/aes_ctrby8_avx-x86_64.S |
2262 |
+@@ -127,10 +127,6 @@ ddq_add_8: |
2263 |
+ |
2264 |
+ /* generate a unique variable for ddq_add_x */ |
2265 |
+ |
2266 |
+-.macro setddq n |
2267 |
+- var_ddq_add = ddq_add_\n |
2268 |
+-.endm |
2269 |
+- |
2270 |
+ /* generate a unique variable for xmm register */ |
2271 |
+ .macro setxdata n |
2272 |
+ var_xdata = %xmm\n |
2273 |
+@@ -140,9 +136,7 @@ ddq_add_8: |
2274 |
+ |
2275 |
+ .macro club name, id |
2276 |
+ .altmacro |
2277 |
+- .if \name == DDQ_DATA |
2278 |
+- setddq %\id |
2279 |
+- .elseif \name == XDATA |
2280 |
++ .if \name == XDATA |
2281 |
+ setxdata %\id |
2282 |
+ .endif |
2283 |
+ .noaltmacro |
2284 |
+@@ -165,9 +159,8 @@ ddq_add_8: |
2285 |
+ |
2286 |
+ .set i, 1 |
2287 |
+ .rept (by - 1) |
2288 |
+- club DDQ_DATA, i |
2289 |
+ club XDATA, i |
2290 |
+- vpaddq var_ddq_add(%rip), xcounter, var_xdata |
2291 |
++ vpaddq (ddq_add_1 + 16 * (i - 1))(%rip), xcounter, var_xdata |
2292 |
+ vptest ddq_low_msk(%rip), var_xdata |
2293 |
+ jnz 1f |
2294 |
+ vpaddq ddq_high_add_1(%rip), var_xdata, var_xdata |
2295 |
+@@ -180,8 +173,7 @@ ddq_add_8: |
2296 |
+ vmovdqa 1*16(p_keys), xkeyA |
2297 |
+ |
2298 |
+ vpxor xkey0, xdata0, xdata0 |
2299 |
+- club DDQ_DATA, by |
2300 |
+- vpaddq var_ddq_add(%rip), xcounter, xcounter |
2301 |
++ vpaddq (ddq_add_1 + 16 * (by - 1))(%rip), xcounter, xcounter |
2302 |
+ vptest ddq_low_msk(%rip), xcounter |
2303 |
+ jnz 1f |
2304 |
+ vpaddq ddq_high_add_1(%rip), xcounter, xcounter |
2305 |
+diff --git a/arch/x86/crypto/aesni-intel_asm.S b/arch/x86/crypto/aesni-intel_asm.S |
2306 |
+index cad6e1bfa7d5..c216de287742 100644 |
2307 |
+--- a/arch/x86/crypto/aesni-intel_asm.S |
2308 |
++++ b/arch/x86/crypto/aesni-intel_asm.S |
2309 |
+@@ -266,7 +266,7 @@ ALL_F: .octa 0xffffffffffffffffffffffffffffffff |
2310 |
+ PSHUFB_XMM %xmm2, %xmm0 |
2311 |
+ movdqu %xmm0, CurCount(%arg2) # ctx_data.current_counter = iv |
2312 |
+ |
2313 |
+- PRECOMPUTE \SUBKEY, %xmm1, %xmm2, %xmm3, %xmm4, %xmm5, %xmm6, %xmm7, |
2314 |
++ PRECOMPUTE \SUBKEY, %xmm1, %xmm2, %xmm3, %xmm4, %xmm5, %xmm6, %xmm7 |
2315 |
+ movdqu HashKey(%arg2), %xmm13 |
2316 |
+ |
2317 |
+ CALC_AAD_HASH %xmm13, \AAD, \AADLEN, %xmm0, %xmm1, %xmm2, %xmm3, \ |
2318 |
+@@ -978,7 +978,7 @@ _initial_blocks_done\@: |
2319 |
+ * arg1, %arg3, %arg4 are used as pointers only, not modified |
2320 |
+ * %r11 is the data offset value |
2321 |
+ */ |
2322 |
+-.macro GHASH_4_ENCRYPT_4_PARALLEL_ENC TMP1 TMP2 TMP3 TMP4 TMP5 \ |
2323 |
++.macro GHASH_4_ENCRYPT_4_PARALLEL_enc TMP1 TMP2 TMP3 TMP4 TMP5 \ |
2324 |
+ TMP6 XMM0 XMM1 XMM2 XMM3 XMM4 XMM5 XMM6 XMM7 XMM8 operation |
2325 |
+ |
2326 |
+ movdqa \XMM1, \XMM5 |
2327 |
+@@ -1186,7 +1186,7 @@ aes_loop_par_enc_done\@: |
2328 |
+ * arg1, %arg3, %arg4 are used as pointers only, not modified |
2329 |
+ * %r11 is the data offset value |
2330 |
+ */ |
2331 |
+-.macro GHASH_4_ENCRYPT_4_PARALLEL_DEC TMP1 TMP2 TMP3 TMP4 TMP5 \ |
2332 |
++.macro GHASH_4_ENCRYPT_4_PARALLEL_dec TMP1 TMP2 TMP3 TMP4 TMP5 \ |
2333 |
+ TMP6 XMM0 XMM1 XMM2 XMM3 XMM4 XMM5 XMM6 XMM7 XMM8 operation |
2334 |
+ |
2335 |
+ movdqa \XMM1, \XMM5 |
2336 |
+diff --git a/arch/x86/events/intel/uncore_snb.c b/arch/x86/events/intel/uncore_snb.c |
2337 |
+index 3de1065eefc4..1038e9f1e354 100644 |
2338 |
+--- a/arch/x86/events/intel/uncore_snb.c |
2339 |
++++ b/arch/x86/events/intel/uncore_snb.c |
2340 |
+@@ -1085,6 +1085,7 @@ static struct pci_dev *tgl_uncore_get_mc_dev(void) |
2341 |
+ } |
2342 |
+ |
2343 |
+ #define TGL_UNCORE_MMIO_IMC_MEM_OFFSET 0x10000 |
2344 |
++#define TGL_UNCORE_PCI_IMC_MAP_SIZE 0xe000 |
2345 |
+ |
2346 |
+ static void tgl_uncore_imc_freerunning_init_box(struct intel_uncore_box *box) |
2347 |
+ { |
2348 |
+@@ -1112,7 +1113,7 @@ static void tgl_uncore_imc_freerunning_init_box(struct intel_uncore_box *box) |
2349 |
+ addr |= ((resource_size_t)mch_bar << 32); |
2350 |
+ #endif |
2351 |
+ |
2352 |
+- box->io_addr = ioremap(addr, SNB_UNCORE_PCI_IMC_MAP_SIZE); |
2353 |
++ box->io_addr = ioremap(addr, TGL_UNCORE_PCI_IMC_MAP_SIZE); |
2354 |
+ } |
2355 |
+ |
2356 |
+ static struct intel_uncore_ops tgl_uncore_imc_freerunning_ops = { |
2357 |
+diff --git a/arch/x86/include/asm/uaccess.h b/arch/x86/include/asm/uaccess.h |
2358 |
+index d8f283b9a569..d1323c73cf6d 100644 |
2359 |
+--- a/arch/x86/include/asm/uaccess.h |
2360 |
++++ b/arch/x86/include/asm/uaccess.h |
2361 |
+@@ -314,11 +314,14 @@ do { \ |
2362 |
+ |
2363 |
+ #define __get_user_size(x, ptr, size, retval) \ |
2364 |
+ do { \ |
2365 |
++ unsigned char x_u8__; \ |
2366 |
++ \ |
2367 |
+ retval = 0; \ |
2368 |
+ __chk_user_ptr(ptr); \ |
2369 |
+ switch (size) { \ |
2370 |
+ case 1: \ |
2371 |
+- __get_user_asm(x, ptr, retval, "b", "=q"); \ |
2372 |
++ __get_user_asm(x_u8__, ptr, retval, "b", "=q"); \ |
2373 |
++ (x) = x_u8__; \ |
2374 |
+ break; \ |
2375 |
+ case 2: \ |
2376 |
+ __get_user_asm(x, ptr, retval, "w", "=r"); \ |
2377 |
+diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c |
2378 |
+index 57447f03ee87..71c16618ec3c 100644 |
2379 |
+--- a/arch/x86/kernel/apic/io_apic.c |
2380 |
++++ b/arch/x86/kernel/apic/io_apic.c |
2381 |
+@@ -2348,8 +2348,13 @@ static int mp_irqdomain_create(int ioapic) |
2382 |
+ |
2383 |
+ static void ioapic_destroy_irqdomain(int idx) |
2384 |
+ { |
2385 |
++ struct ioapic_domain_cfg *cfg = &ioapics[idx].irqdomain_cfg; |
2386 |
++ struct fwnode_handle *fn = ioapics[idx].irqdomain->fwnode; |
2387 |
++ |
2388 |
+ if (ioapics[idx].irqdomain) { |
2389 |
+ irq_domain_remove(ioapics[idx].irqdomain); |
2390 |
++ if (!cfg->dev) |
2391 |
++ irq_domain_free_fwnode(fn); |
2392 |
+ ioapics[idx].irqdomain = NULL; |
2393 |
+ } |
2394 |
+ } |
2395 |
+diff --git a/arch/x86/kernel/cpu/mce/inject.c b/arch/x86/kernel/cpu/mce/inject.c |
2396 |
+index 3413b41b8d55..dc28a615e340 100644 |
2397 |
+--- a/arch/x86/kernel/cpu/mce/inject.c |
2398 |
++++ b/arch/x86/kernel/cpu/mce/inject.c |
2399 |
+@@ -511,7 +511,7 @@ static void do_inject(void) |
2400 |
+ */ |
2401 |
+ if (inj_type == DFR_INT_INJ) { |
2402 |
+ i_mce.status |= MCI_STATUS_DEFERRED; |
2403 |
+- i_mce.status |= (i_mce.status & ~MCI_STATUS_UC); |
2404 |
++ i_mce.status &= ~MCI_STATUS_UC; |
2405 |
+ } |
2406 |
+ |
2407 |
+ /* |
2408 |
+diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c |
2409 |
+index 5ef9d8f25b0e..cf2cda72a75b 100644 |
2410 |
+--- a/arch/x86/kernel/process_64.c |
2411 |
++++ b/arch/x86/kernel/process_64.c |
2412 |
+@@ -315,7 +315,7 @@ static unsigned long x86_fsgsbase_read_task(struct task_struct *task, |
2413 |
+ */ |
2414 |
+ mutex_lock(&task->mm->context.lock); |
2415 |
+ ldt = task->mm->context.ldt; |
2416 |
+- if (unlikely(idx >= ldt->nr_entries)) |
2417 |
++ if (unlikely(!ldt || idx >= ldt->nr_entries)) |
2418 |
+ base = 0; |
2419 |
+ else |
2420 |
+ base = get_desc_base(ldt->entries + idx); |
2421 |
+diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c |
2422 |
+index 2f24c334a938..e5b2b20a0aee 100644 |
2423 |
+--- a/arch/x86/kernel/smpboot.c |
2424 |
++++ b/arch/x86/kernel/smpboot.c |
2425 |
+@@ -1974,6 +1974,7 @@ static bool core_set_max_freq_ratio(u64 *base_freq, u64 *turbo_freq) |
2426 |
+ static bool intel_set_max_freq_ratio(void) |
2427 |
+ { |
2428 |
+ u64 base_freq, turbo_freq; |
2429 |
++ u64 turbo_ratio; |
2430 |
+ |
2431 |
+ if (slv_set_max_freq_ratio(&base_freq, &turbo_freq)) |
2432 |
+ goto out; |
2433 |
+@@ -1999,15 +2000,23 @@ out: |
2434 |
+ /* |
2435 |
+ * Some hypervisors advertise X86_FEATURE_APERFMPERF |
2436 |
+ * but then fill all MSR's with zeroes. |
2437 |
++ * Some CPUs have turbo boost but don't declare any turbo ratio |
2438 |
++ * in MSR_TURBO_RATIO_LIMIT. |
2439 |
+ */ |
2440 |
+- if (!base_freq) { |
2441 |
+- pr_debug("Couldn't determine cpu base frequency, necessary for scale-invariant accounting.\n"); |
2442 |
++ if (!base_freq || !turbo_freq) { |
2443 |
++ pr_debug("Couldn't determine cpu base or turbo frequency, necessary for scale-invariant accounting.\n"); |
2444 |
+ return false; |
2445 |
+ } |
2446 |
+ |
2447 |
+- arch_turbo_freq_ratio = div_u64(turbo_freq * SCHED_CAPACITY_SCALE, |
2448 |
+- base_freq); |
2449 |
++ turbo_ratio = div_u64(turbo_freq * SCHED_CAPACITY_SCALE, base_freq); |
2450 |
++ if (!turbo_ratio) { |
2451 |
++ pr_debug("Non-zero turbo and base frequencies led to a 0 ratio.\n"); |
2452 |
++ return false; |
2453 |
++ } |
2454 |
++ |
2455 |
++ arch_turbo_freq_ratio = turbo_ratio; |
2456 |
+ arch_set_max_freq_ratio(turbo_disabled()); |
2457 |
++ |
2458 |
+ return true; |
2459 |
+ } |
2460 |
+ |
2461 |
+diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c |
2462 |
+index 7dbfc0bc738c..27c0cc61fb08 100644 |
2463 |
+--- a/arch/x86/kvm/svm/svm.c |
2464 |
++++ b/arch/x86/kvm/svm/svm.c |
2465 |
+@@ -2509,7 +2509,7 @@ static int svm_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr) |
2466 |
+ !guest_cpuid_has(vcpu, X86_FEATURE_AMD_SSBD)) |
2467 |
+ return 1; |
2468 |
+ |
2469 |
+- if (data & ~kvm_spec_ctrl_valid_bits(vcpu)) |
2470 |
++ if (kvm_spec_ctrl_test_value(data)) |
2471 |
+ return 1; |
2472 |
+ |
2473 |
+ svm->spec_ctrl = data; |
2474 |
+diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c |
2475 |
+index 8fafcb2cd103..9938a7e698db 100644 |
2476 |
+--- a/arch/x86/kvm/vmx/vmx.c |
2477 |
++++ b/arch/x86/kvm/vmx/vmx.c |
2478 |
+@@ -2015,7 +2015,7 @@ static int vmx_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info) |
2479 |
+ !guest_cpuid_has(vcpu, X86_FEATURE_SPEC_CTRL)) |
2480 |
+ return 1; |
2481 |
+ |
2482 |
+- if (data & ~kvm_spec_ctrl_valid_bits(vcpu)) |
2483 |
++ if (kvm_spec_ctrl_test_value(data)) |
2484 |
+ return 1; |
2485 |
+ |
2486 |
+ vmx->spec_ctrl = data; |
2487 |
+diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c |
2488 |
+index 738a558c915c..51ccb4dfaad2 100644 |
2489 |
+--- a/arch/x86/kvm/x86.c |
2490 |
++++ b/arch/x86/kvm/x86.c |
2491 |
+@@ -10573,28 +10573,32 @@ bool kvm_arch_no_poll(struct kvm_vcpu *vcpu) |
2492 |
+ } |
2493 |
+ EXPORT_SYMBOL_GPL(kvm_arch_no_poll); |
2494 |
+ |
2495 |
+-u64 kvm_spec_ctrl_valid_bits(struct kvm_vcpu *vcpu) |
2496 |
++ |
2497 |
++int kvm_spec_ctrl_test_value(u64 value) |
2498 |
+ { |
2499 |
+- uint64_t bits = SPEC_CTRL_IBRS | SPEC_CTRL_STIBP | SPEC_CTRL_SSBD; |
2500 |
++ /* |
2501 |
++ * test that setting IA32_SPEC_CTRL to given value |
2502 |
++ * is allowed by the host processor |
2503 |
++ */ |
2504 |
+ |
2505 |
+- /* The STIBP bit doesn't fault even if it's not advertised */ |
2506 |
+- if (!guest_cpuid_has(vcpu, X86_FEATURE_SPEC_CTRL) && |
2507 |
+- !guest_cpuid_has(vcpu, X86_FEATURE_AMD_IBRS)) |
2508 |
+- bits &= ~(SPEC_CTRL_IBRS | SPEC_CTRL_STIBP); |
2509 |
+- if (!boot_cpu_has(X86_FEATURE_SPEC_CTRL) && |
2510 |
+- !boot_cpu_has(X86_FEATURE_AMD_IBRS)) |
2511 |
+- bits &= ~(SPEC_CTRL_IBRS | SPEC_CTRL_STIBP); |
2512 |
++ u64 saved_value; |
2513 |
++ unsigned long flags; |
2514 |
++ int ret = 0; |
2515 |
+ |
2516 |
+- if (!guest_cpuid_has(vcpu, X86_FEATURE_SPEC_CTRL_SSBD) && |
2517 |
+- !guest_cpuid_has(vcpu, X86_FEATURE_AMD_SSBD)) |
2518 |
+- bits &= ~SPEC_CTRL_SSBD; |
2519 |
+- if (!boot_cpu_has(X86_FEATURE_SPEC_CTRL_SSBD) && |
2520 |
+- !boot_cpu_has(X86_FEATURE_AMD_SSBD)) |
2521 |
+- bits &= ~SPEC_CTRL_SSBD; |
2522 |
++ local_irq_save(flags); |
2523 |
+ |
2524 |
+- return bits; |
2525 |
++ if (rdmsrl_safe(MSR_IA32_SPEC_CTRL, &saved_value)) |
2526 |
++ ret = 1; |
2527 |
++ else if (wrmsrl_safe(MSR_IA32_SPEC_CTRL, value)) |
2528 |
++ ret = 1; |
2529 |
++ else |
2530 |
++ wrmsrl(MSR_IA32_SPEC_CTRL, saved_value); |
2531 |
++ |
2532 |
++ local_irq_restore(flags); |
2533 |
++ |
2534 |
++ return ret; |
2535 |
+ } |
2536 |
+-EXPORT_SYMBOL_GPL(kvm_spec_ctrl_valid_bits); |
2537 |
++EXPORT_SYMBOL_GPL(kvm_spec_ctrl_test_value); |
2538 |
+ |
2539 |
+ EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_exit); |
2540 |
+ EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_fast_mmio); |
2541 |
+diff --git a/arch/x86/kvm/x86.h b/arch/x86/kvm/x86.h |
2542 |
+index b968acc0516f..73c62b5d2765 100644 |
2543 |
+--- a/arch/x86/kvm/x86.h |
2544 |
++++ b/arch/x86/kvm/x86.h |
2545 |
+@@ -357,6 +357,6 @@ static inline bool kvm_dr7_valid(u64 data) |
2546 |
+ |
2547 |
+ void kvm_load_guest_xsave_state(struct kvm_vcpu *vcpu); |
2548 |
+ void kvm_load_host_xsave_state(struct kvm_vcpu *vcpu); |
2549 |
+-u64 kvm_spec_ctrl_valid_bits(struct kvm_vcpu *vcpu); |
2550 |
++int kvm_spec_ctrl_test_value(u64 value); |
2551 |
+ |
2552 |
+ #endif |
2553 |
+diff --git a/block/blk-iocost.c b/block/blk-iocost.c |
2554 |
+index ef193389fffe..b5a9cfcd75e9 100644 |
2555 |
+--- a/block/blk-iocost.c |
2556 |
++++ b/block/blk-iocost.c |
2557 |
+@@ -1374,7 +1374,7 @@ static void ioc_timer_fn(struct timer_list *timer) |
2558 |
+ * should have woken up in the last period and expire idle iocgs. |
2559 |
+ */ |
2560 |
+ list_for_each_entry_safe(iocg, tiocg, &ioc->active_iocgs, active_list) { |
2561 |
+- if (!waitqueue_active(&iocg->waitq) && iocg->abs_vdebt && |
2562 |
++ if (!waitqueue_active(&iocg->waitq) && !iocg->abs_vdebt && |
2563 |
+ !iocg_is_idle(iocg)) |
2564 |
+ continue; |
2565 |
+ |
2566 |
+diff --git a/block/blk-zoned.c b/block/blk-zoned.c |
2567 |
+index f87956e0dcaf..0dd17a6d0098 100644 |
2568 |
+--- a/block/blk-zoned.c |
2569 |
++++ b/block/blk-zoned.c |
2570 |
+@@ -478,6 +478,9 @@ int blk_revalidate_disk_zones(struct gendisk *disk) |
2571 |
+ if (WARN_ON_ONCE(!queue_is_mq(q))) |
2572 |
+ return -EIO; |
2573 |
+ |
2574 |
++ if (!get_capacity(disk)) |
2575 |
++ return -EIO; |
2576 |
++ |
2577 |
+ /* |
2578 |
+ * Ensure that all memory allocations in this context are done as if |
2579 |
+ * GFP_NOIO was specified. |
2580 |
+diff --git a/drivers/acpi/acpica/exprep.c b/drivers/acpi/acpica/exprep.c |
2581 |
+index a4e306690a21..4a0f03157e08 100644 |
2582 |
+--- a/drivers/acpi/acpica/exprep.c |
2583 |
++++ b/drivers/acpi/acpica/exprep.c |
2584 |
+@@ -473,10 +473,6 @@ acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info) |
2585 |
+ (u8)access_byte_width; |
2586 |
+ } |
2587 |
+ } |
2588 |
+- /* An additional reference for the container */ |
2589 |
+- |
2590 |
+- acpi_ut_add_reference(obj_desc->field.region_obj); |
2591 |
+- |
2592 |
+ ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, |
2593 |
+ "RegionField: BitOff %X, Off %X, Gran %X, Region %p\n", |
2594 |
+ obj_desc->field.start_field_bit_offset, |
2595 |
+diff --git a/drivers/acpi/acpica/utdelete.c b/drivers/acpi/acpica/utdelete.c |
2596 |
+index c365faf4e6cd..4c0d4e434196 100644 |
2597 |
+--- a/drivers/acpi/acpica/utdelete.c |
2598 |
++++ b/drivers/acpi/acpica/utdelete.c |
2599 |
+@@ -568,11 +568,6 @@ acpi_ut_update_object_reference(union acpi_operand_object *object, u16 action) |
2600 |
+ next_object = object->buffer_field.buffer_obj; |
2601 |
+ break; |
2602 |
+ |
2603 |
+- case ACPI_TYPE_LOCAL_REGION_FIELD: |
2604 |
+- |
2605 |
+- next_object = object->field.region_obj; |
2606 |
+- break; |
2607 |
+- |
2608 |
+ case ACPI_TYPE_LOCAL_BANK_FIELD: |
2609 |
+ |
2610 |
+ next_object = object->bank_field.bank_obj; |
2611 |
+@@ -613,6 +608,7 @@ acpi_ut_update_object_reference(union acpi_operand_object *object, u16 action) |
2612 |
+ } |
2613 |
+ break; |
2614 |
+ |
2615 |
++ case ACPI_TYPE_LOCAL_REGION_FIELD: |
2616 |
+ case ACPI_TYPE_REGION: |
2617 |
+ default: |
2618 |
+ |
2619 |
+diff --git a/drivers/base/dd.c b/drivers/base/dd.c |
2620 |
+index 94037be7f5d7..60bd0a9b9918 100644 |
2621 |
+--- a/drivers/base/dd.c |
2622 |
++++ b/drivers/base/dd.c |
2623 |
+@@ -276,7 +276,7 @@ static void deferred_probe_timeout_work_func(struct work_struct *work) |
2624 |
+ |
2625 |
+ list_for_each_entry_safe(private, p, &deferred_probe_pending_list, deferred_probe) |
2626 |
+ dev_info(private->device, "deferred probe pending"); |
2627 |
+- wake_up(&probe_timeout_waitqueue); |
2628 |
++ wake_up_all(&probe_timeout_waitqueue); |
2629 |
+ } |
2630 |
+ static DECLARE_DELAYED_WORK(deferred_probe_timeout_work, deferred_probe_timeout_work_func); |
2631 |
+ |
2632 |
+@@ -487,7 +487,8 @@ static int really_probe(struct device *dev, struct device_driver *drv) |
2633 |
+ drv->bus->name, __func__, drv->name, dev_name(dev)); |
2634 |
+ if (!list_empty(&dev->devres_head)) { |
2635 |
+ dev_crit(dev, "Resources present before probing\n"); |
2636 |
+- return -EBUSY; |
2637 |
++ ret = -EBUSY; |
2638 |
++ goto done; |
2639 |
+ } |
2640 |
+ |
2641 |
+ re_probe: |
2642 |
+@@ -608,7 +609,7 @@ pinctrl_bind_failed: |
2643 |
+ ret = 0; |
2644 |
+ done: |
2645 |
+ atomic_dec(&probe_count); |
2646 |
+- wake_up(&probe_waitqueue); |
2647 |
++ wake_up_all(&probe_waitqueue); |
2648 |
+ return ret; |
2649 |
+ } |
2650 |
+ |
2651 |
+diff --git a/drivers/base/firmware_loader/fallback_platform.c b/drivers/base/firmware_loader/fallback_platform.c |
2652 |
+index c88c745590fe..723ff8bcf3e7 100644 |
2653 |
+--- a/drivers/base/firmware_loader/fallback_platform.c |
2654 |
++++ b/drivers/base/firmware_loader/fallback_platform.c |
2655 |
+@@ -25,7 +25,10 @@ int firmware_fallback_platform(struct fw_priv *fw_priv, enum fw_opt opt_flags) |
2656 |
+ if (rc) |
2657 |
+ return rc; /* rc == -ENOENT when the fw was not found */ |
2658 |
+ |
2659 |
+- fw_priv->data = vmalloc(size); |
2660 |
++ if (fw_priv->data && size > fw_priv->allocated_size) |
2661 |
++ return -ENOMEM; |
2662 |
++ if (!fw_priv->data) |
2663 |
++ fw_priv->data = vmalloc(size); |
2664 |
+ if (!fw_priv->data) |
2665 |
+ return -ENOMEM; |
2666 |
+ |
2667 |
+diff --git a/drivers/block/loop.c b/drivers/block/loop.c |
2668 |
+index 418bb4621255..6b36fc2f4edc 100644 |
2669 |
+--- a/drivers/block/loop.c |
2670 |
++++ b/drivers/block/loop.c |
2671 |
+@@ -2333,6 +2333,8 @@ static void __exit loop_exit(void) |
2672 |
+ |
2673 |
+ range = max_loop ? max_loop << part_shift : 1UL << MINORBITS; |
2674 |
+ |
2675 |
++ mutex_lock(&loop_ctl_mutex); |
2676 |
++ |
2677 |
+ idr_for_each(&loop_index_idr, &loop_exit_cb, NULL); |
2678 |
+ idr_destroy(&loop_index_idr); |
2679 |
+ |
2680 |
+@@ -2340,6 +2342,8 @@ static void __exit loop_exit(void) |
2681 |
+ unregister_blkdev(LOOP_MAJOR, "loop"); |
2682 |
+ |
2683 |
+ misc_deregister(&loop_misc); |
2684 |
++ |
2685 |
++ mutex_unlock(&loop_ctl_mutex); |
2686 |
+ } |
2687 |
+ |
2688 |
+ module_init(loop_init); |
2689 |
+diff --git a/drivers/bluetooth/btmrvl_sdio.c b/drivers/bluetooth/btmrvl_sdio.c |
2690 |
+index 0f3a020703ab..4c7978cb1786 100644 |
2691 |
+--- a/drivers/bluetooth/btmrvl_sdio.c |
2692 |
++++ b/drivers/bluetooth/btmrvl_sdio.c |
2693 |
+@@ -328,7 +328,7 @@ static const struct btmrvl_sdio_device btmrvl_sdio_sd8897 = { |
2694 |
+ |
2695 |
+ static const struct btmrvl_sdio_device btmrvl_sdio_sd8977 = { |
2696 |
+ .helper = NULL, |
2697 |
+- .firmware = "mrvl/sd8977_uapsta.bin", |
2698 |
++ .firmware = "mrvl/sdsd8977_combo_v2.bin", |
2699 |
+ .reg = &btmrvl_reg_8977, |
2700 |
+ .support_pscan_win_report = true, |
2701 |
+ .sd_blksz_fw_dl = 256, |
2702 |
+@@ -346,7 +346,7 @@ static const struct btmrvl_sdio_device btmrvl_sdio_sd8987 = { |
2703 |
+ |
2704 |
+ static const struct btmrvl_sdio_device btmrvl_sdio_sd8997 = { |
2705 |
+ .helper = NULL, |
2706 |
+- .firmware = "mrvl/sd8997_uapsta.bin", |
2707 |
++ .firmware = "mrvl/sdsd8997_combo_v4.bin", |
2708 |
+ .reg = &btmrvl_reg_8997, |
2709 |
+ .support_pscan_win_report = true, |
2710 |
+ .sd_blksz_fw_dl = 256, |
2711 |
+@@ -1831,6 +1831,6 @@ MODULE_FIRMWARE("mrvl/sd8787_uapsta.bin"); |
2712 |
+ MODULE_FIRMWARE("mrvl/sd8797_uapsta.bin"); |
2713 |
+ MODULE_FIRMWARE("mrvl/sd8887_uapsta.bin"); |
2714 |
+ MODULE_FIRMWARE("mrvl/sd8897_uapsta.bin"); |
2715 |
+-MODULE_FIRMWARE("mrvl/sd8977_uapsta.bin"); |
2716 |
++MODULE_FIRMWARE("mrvl/sdsd8977_combo_v2.bin"); |
2717 |
+ MODULE_FIRMWARE("mrvl/sd8987_uapsta.bin"); |
2718 |
+-MODULE_FIRMWARE("mrvl/sd8997_uapsta.bin"); |
2719 |
++MODULE_FIRMWARE("mrvl/sdsd8997_combo_v4.bin"); |
2720 |
+diff --git a/drivers/bluetooth/btmtksdio.c b/drivers/bluetooth/btmtksdio.c |
2721 |
+index 519788c442ca..11494cd2a982 100644 |
2722 |
+--- a/drivers/bluetooth/btmtksdio.c |
2723 |
++++ b/drivers/bluetooth/btmtksdio.c |
2724 |
+@@ -685,7 +685,7 @@ static int mtk_setup_firmware(struct hci_dev *hdev, const char *fwname) |
2725 |
+ const u8 *fw_ptr; |
2726 |
+ size_t fw_size; |
2727 |
+ int err, dlen; |
2728 |
+- u8 flag; |
2729 |
++ u8 flag, param; |
2730 |
+ |
2731 |
+ err = request_firmware(&fw, fwname, &hdev->dev); |
2732 |
+ if (err < 0) { |
2733 |
+@@ -693,6 +693,20 @@ static int mtk_setup_firmware(struct hci_dev *hdev, const char *fwname) |
2734 |
+ return err; |
2735 |
+ } |
2736 |
+ |
2737 |
++ /* Power on data RAM the firmware relies on. */ |
2738 |
++ param = 1; |
2739 |
++ wmt_params.op = MTK_WMT_FUNC_CTRL; |
2740 |
++ wmt_params.flag = 3; |
2741 |
++ wmt_params.dlen = sizeof(param); |
2742 |
++ wmt_params.data = ¶m; |
2743 |
++ wmt_params.status = NULL; |
2744 |
++ |
2745 |
++ err = mtk_hci_wmt_sync(hdev, &wmt_params); |
2746 |
++ if (err < 0) { |
2747 |
++ bt_dev_err(hdev, "Failed to power on data RAM (%d)", err); |
2748 |
++ return err; |
2749 |
++ } |
2750 |
++ |
2751 |
+ fw_ptr = fw->data; |
2752 |
+ fw_size = fw->size; |
2753 |
+ |
2754 |
+diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c |
2755 |
+index 3d9313c746f3..0c77240fd7dd 100644 |
2756 |
+--- a/drivers/bluetooth/btusb.c |
2757 |
++++ b/drivers/bluetooth/btusb.c |
2758 |
+@@ -1631,6 +1631,7 @@ static int btusb_setup_csr(struct hci_dev *hdev) |
2759 |
+ { |
2760 |
+ struct hci_rp_read_local_version *rp; |
2761 |
+ struct sk_buff *skb; |
2762 |
++ bool is_fake = false; |
2763 |
+ |
2764 |
+ BT_DBG("%s", hdev->name); |
2765 |
+ |
2766 |
+@@ -1650,18 +1651,69 @@ static int btusb_setup_csr(struct hci_dev *hdev) |
2767 |
+ |
2768 |
+ rp = (struct hci_rp_read_local_version *)skb->data; |
2769 |
+ |
2770 |
+- /* Detect controllers which aren't real CSR ones. */ |
2771 |
++ /* Detect a wide host of Chinese controllers that aren't CSR. |
2772 |
++ * |
2773 |
++ * Known fake bcdDevices: 0x0100, 0x0134, 0x1915, 0x2520, 0x7558, 0x8891 |
2774 |
++ * |
2775 |
++ * The main thing they have in common is that these are really popular low-cost |
2776 |
++ * options that support newer Bluetooth versions but rely on heavy VID/PID |
2777 |
++ * squatting of this poor old Bluetooth 1.1 device. Even sold as such. |
2778 |
++ * |
2779 |
++ * We detect actual CSR devices by checking that the HCI manufacturer code |
2780 |
++ * is Cambridge Silicon Radio (10) and ensuring that LMP sub-version and |
2781 |
++ * HCI rev values always match. As they both store the firmware number. |
2782 |
++ */ |
2783 |
+ if (le16_to_cpu(rp->manufacturer) != 10 || |
2784 |
+- le16_to_cpu(rp->lmp_subver) == 0x0c5c) { |
2785 |
++ le16_to_cpu(rp->hci_rev) != le16_to_cpu(rp->lmp_subver)) |
2786 |
++ is_fake = true; |
2787 |
++ |
2788 |
++ /* Known legit CSR firmware build numbers and their supported BT versions: |
2789 |
++ * - 1.1 (0x1) -> 0x0073, 0x020d, 0x033c, 0x034e |
2790 |
++ * - 1.2 (0x2) -> 0x04d9, 0x0529 |
2791 |
++ * - 2.0 (0x3) -> 0x07a6, 0x07ad, 0x0c5c |
2792 |
++ * - 2.1 (0x4) -> 0x149c, 0x1735, 0x1899 (0x1899 is a BlueCore4-External) |
2793 |
++ * - 4.0 (0x6) -> 0x1d86, 0x2031, 0x22bb |
2794 |
++ * |
2795 |
++ * e.g. Real CSR dongles with LMP subversion 0x73 are old enough that |
2796 |
++ * support BT 1.1 only; so it's a dead giveaway when some |
2797 |
++ * third-party BT 4.0 dongle reuses it. |
2798 |
++ */ |
2799 |
++ else if (le16_to_cpu(rp->lmp_subver) <= 0x034e && |
2800 |
++ le16_to_cpu(rp->hci_ver) > BLUETOOTH_VER_1_1) |
2801 |
++ is_fake = true; |
2802 |
++ |
2803 |
++ else if (le16_to_cpu(rp->lmp_subver) <= 0x0529 && |
2804 |
++ le16_to_cpu(rp->hci_ver) > BLUETOOTH_VER_1_2) |
2805 |
++ is_fake = true; |
2806 |
++ |
2807 |
++ else if (le16_to_cpu(rp->lmp_subver) <= 0x0c5c && |
2808 |
++ le16_to_cpu(rp->hci_ver) > BLUETOOTH_VER_2_0) |
2809 |
++ is_fake = true; |
2810 |
++ |
2811 |
++ else if (le16_to_cpu(rp->lmp_subver) <= 0x1899 && |
2812 |
++ le16_to_cpu(rp->hci_ver) > BLUETOOTH_VER_2_1) |
2813 |
++ is_fake = true; |
2814 |
++ |
2815 |
++ else if (le16_to_cpu(rp->lmp_subver) <= 0x22bb && |
2816 |
++ le16_to_cpu(rp->hci_ver) > BLUETOOTH_VER_4_0) |
2817 |
++ is_fake = true; |
2818 |
++ |
2819 |
++ if (is_fake) { |
2820 |
++ bt_dev_warn(hdev, "CSR: Unbranded CSR clone detected; adding workarounds..."); |
2821 |
++ |
2822 |
++ /* Generally these clones have big discrepancies between |
2823 |
++ * advertised features and what's actually supported. |
2824 |
++ * Probably will need to be expanded in the future; |
2825 |
++ * without these the controller will lock up. |
2826 |
++ */ |
2827 |
++ set_bit(HCI_QUIRK_BROKEN_STORED_LINK_KEY, &hdev->quirks); |
2828 |
++ set_bit(HCI_QUIRK_BROKEN_ERR_DATA_REPORTING, &hdev->quirks); |
2829 |
++ |
2830 |
+ /* Clear the reset quirk since this is not an actual |
2831 |
+ * early Bluetooth 1.1 device from CSR. |
2832 |
+ */ |
2833 |
+ clear_bit(HCI_QUIRK_RESET_ON_CLOSE, &hdev->quirks); |
2834 |
+- |
2835 |
+- /* These fake CSR controllers have all a broken |
2836 |
+- * stored link key handling and so just disable it. |
2837 |
+- */ |
2838 |
+- set_bit(HCI_QUIRK_BROKEN_STORED_LINK_KEY, &hdev->quirks); |
2839 |
++ clear_bit(HCI_QUIRK_SIMULTANEOUS_DISCOVERY, &hdev->quirks); |
2840 |
+ } |
2841 |
+ |
2842 |
+ kfree_skb(skb); |
2843 |
+@@ -2826,7 +2878,7 @@ static int btusb_mtk_setup_firmware(struct hci_dev *hdev, const char *fwname) |
2844 |
+ const u8 *fw_ptr; |
2845 |
+ size_t fw_size; |
2846 |
+ int err, dlen; |
2847 |
+- u8 flag; |
2848 |
++ u8 flag, param; |
2849 |
+ |
2850 |
+ err = request_firmware(&fw, fwname, &hdev->dev); |
2851 |
+ if (err < 0) { |
2852 |
+@@ -2834,6 +2886,20 @@ static int btusb_mtk_setup_firmware(struct hci_dev *hdev, const char *fwname) |
2853 |
+ return err; |
2854 |
+ } |
2855 |
+ |
2856 |
++ /* Power on data RAM the firmware relies on. */ |
2857 |
++ param = 1; |
2858 |
++ wmt_params.op = BTMTK_WMT_FUNC_CTRL; |
2859 |
++ wmt_params.flag = 3; |
2860 |
++ wmt_params.dlen = sizeof(param); |
2861 |
++ wmt_params.data = ¶m; |
2862 |
++ wmt_params.status = NULL; |
2863 |
++ |
2864 |
++ err = btusb_mtk_hci_wmt_sync(hdev, &wmt_params); |
2865 |
++ if (err < 0) { |
2866 |
++ bt_dev_err(hdev, "Failed to power on data RAM (%d)", err); |
2867 |
++ return err; |
2868 |
++ } |
2869 |
++ |
2870 |
+ fw_ptr = fw->data; |
2871 |
+ fw_size = fw->size; |
2872 |
+ |
2873 |
+@@ -3891,11 +3957,13 @@ static int btusb_probe(struct usb_interface *intf, |
2874 |
+ if (bcdDevice < 0x117) |
2875 |
+ set_bit(HCI_QUIRK_RESET_ON_CLOSE, &hdev->quirks); |
2876 |
+ |
2877 |
++ /* This must be set first in case we disable it for fakes */ |
2878 |
++ set_bit(HCI_QUIRK_SIMULTANEOUS_DISCOVERY, &hdev->quirks); |
2879 |
++ |
2880 |
+ /* Fake CSR devices with broken commands */ |
2881 |
+- if (bcdDevice <= 0x100 || bcdDevice == 0x134) |
2882 |
++ if (le16_to_cpu(udev->descriptor.idVendor) == 0x0a12 && |
2883 |
++ le16_to_cpu(udev->descriptor.idProduct) == 0x0001) |
2884 |
+ hdev->setup = btusb_setup_csr; |
2885 |
+- |
2886 |
+- set_bit(HCI_QUIRK_SIMULTANEOUS_DISCOVERY, &hdev->quirks); |
2887 |
+ } |
2888 |
+ |
2889 |
+ if (id->driver_info & BTUSB_SNIFFER) { |
2890 |
+diff --git a/drivers/bluetooth/hci_h5.c b/drivers/bluetooth/hci_h5.c |
2891 |
+index 106c110efe56..0ce3d9fe0286 100644 |
2892 |
+--- a/drivers/bluetooth/hci_h5.c |
2893 |
++++ b/drivers/bluetooth/hci_h5.c |
2894 |
+@@ -793,7 +793,7 @@ static int h5_serdev_probe(struct serdev_device *serdev) |
2895 |
+ if (!h5) |
2896 |
+ return -ENOMEM; |
2897 |
+ |
2898 |
+- set_bit(HCI_UART_RESET_ON_INIT, &h5->serdev_hu.flags); |
2899 |
++ set_bit(HCI_UART_RESET_ON_INIT, &h5->serdev_hu.hdev_flags); |
2900 |
+ |
2901 |
+ h5->hu = &h5->serdev_hu; |
2902 |
+ h5->serdev_hu.serdev = serdev; |
2903 |
+diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c |
2904 |
+index 0b1036e5e963..6a3c80e1b19c 100644 |
2905 |
+--- a/drivers/bluetooth/hci_qca.c |
2906 |
++++ b/drivers/bluetooth/hci_qca.c |
2907 |
+@@ -45,7 +45,7 @@ |
2908 |
+ #define HCI_MAX_IBS_SIZE 10 |
2909 |
+ |
2910 |
+ #define IBS_WAKE_RETRANS_TIMEOUT_MS 100 |
2911 |
+-#define IBS_BTSOC_TX_IDLE_TIMEOUT_MS 40 |
2912 |
++#define IBS_BTSOC_TX_IDLE_TIMEOUT_MS 200 |
2913 |
+ #define IBS_HOST_TX_IDLE_TIMEOUT_MS 2000 |
2914 |
+ #define CMD_TRANS_TIMEOUT_MS 100 |
2915 |
+ #define MEMDUMP_TIMEOUT_MS 8000 |
2916 |
+@@ -71,7 +71,8 @@ enum qca_flags { |
2917 |
+ QCA_DROP_VENDOR_EVENT, |
2918 |
+ QCA_SUSPENDING, |
2919 |
+ QCA_MEMDUMP_COLLECTION, |
2920 |
+- QCA_HW_ERROR_EVENT |
2921 |
++ QCA_HW_ERROR_EVENT, |
2922 |
++ QCA_SSR_TRIGGERED |
2923 |
+ }; |
2924 |
+ |
2925 |
+ |
2926 |
+@@ -854,6 +855,13 @@ static int qca_enqueue(struct hci_uart *hu, struct sk_buff *skb) |
2927 |
+ BT_DBG("hu %p qca enq skb %p tx_ibs_state %d", hu, skb, |
2928 |
+ qca->tx_ibs_state); |
2929 |
+ |
2930 |
++ if (test_bit(QCA_SSR_TRIGGERED, &qca->flags)) { |
2931 |
++ /* As SSR is in progress, ignore the packets */ |
2932 |
++ bt_dev_dbg(hu->hdev, "SSR is in progress"); |
2933 |
++ kfree_skb(skb); |
2934 |
++ return 0; |
2935 |
++ } |
2936 |
++ |
2937 |
+ /* Prepend skb with frame type */ |
2938 |
+ memcpy(skb_push(skb, 1), &hci_skb_pkt_type(skb), 1); |
2939 |
+ |
2940 |
+@@ -973,8 +981,11 @@ static void qca_controller_memdump(struct work_struct *work) |
2941 |
+ while ((skb = skb_dequeue(&qca->rx_memdump_q))) { |
2942 |
+ |
2943 |
+ mutex_lock(&qca->hci_memdump_lock); |
2944 |
+- /* Skip processing the received packets if timeout detected. */ |
2945 |
+- if (qca->memdump_state == QCA_MEMDUMP_TIMEOUT) { |
2946 |
++ /* Skip processing the received packets if timeout detected |
2947 |
++ * or memdump collection completed. |
2948 |
++ */ |
2949 |
++ if (qca->memdump_state == QCA_MEMDUMP_TIMEOUT || |
2950 |
++ qca->memdump_state == QCA_MEMDUMP_COLLECTED) { |
2951 |
+ mutex_unlock(&qca->hci_memdump_lock); |
2952 |
+ return; |
2953 |
+ } |
2954 |
+@@ -1085,6 +1096,7 @@ static int qca_controller_memdump_event(struct hci_dev *hdev, |
2955 |
+ struct hci_uart *hu = hci_get_drvdata(hdev); |
2956 |
+ struct qca_data *qca = hu->priv; |
2957 |
+ |
2958 |
++ set_bit(QCA_SSR_TRIGGERED, &qca->flags); |
2959 |
+ skb_queue_tail(&qca->rx_memdump_q, skb); |
2960 |
+ queue_work(qca->workqueue, &qca->ctrl_memdump_evt); |
2961 |
+ |
2962 |
+@@ -1442,9 +1454,8 @@ static void qca_hw_error(struct hci_dev *hdev, u8 code) |
2963 |
+ { |
2964 |
+ struct hci_uart *hu = hci_get_drvdata(hdev); |
2965 |
+ struct qca_data *qca = hu->priv; |
2966 |
+- struct qca_memdump_data *qca_memdump = qca->qca_memdump; |
2967 |
+- char *memdump_buf = NULL; |
2968 |
+ |
2969 |
++ set_bit(QCA_SSR_TRIGGERED, &qca->flags); |
2970 |
+ set_bit(QCA_HW_ERROR_EVENT, &qca->flags); |
2971 |
+ bt_dev_info(hdev, "mem_dump_status: %d", qca->memdump_state); |
2972 |
+ |
2973 |
+@@ -1466,19 +1477,23 @@ static void qca_hw_error(struct hci_dev *hdev, u8 code) |
2974 |
+ qca_wait_for_dump_collection(hdev); |
2975 |
+ } |
2976 |
+ |
2977 |
++ mutex_lock(&qca->hci_memdump_lock); |
2978 |
+ if (qca->memdump_state != QCA_MEMDUMP_COLLECTED) { |
2979 |
+ bt_dev_err(hu->hdev, "clearing allocated memory due to memdump timeout"); |
2980 |
+- mutex_lock(&qca->hci_memdump_lock); |
2981 |
+- if (qca_memdump) |
2982 |
+- memdump_buf = qca_memdump->memdump_buf_head; |
2983 |
+- vfree(memdump_buf); |
2984 |
+- kfree(qca_memdump); |
2985 |
+- qca->qca_memdump = NULL; |
2986 |
++ if (qca->qca_memdump) { |
2987 |
++ vfree(qca->qca_memdump->memdump_buf_head); |
2988 |
++ kfree(qca->qca_memdump); |
2989 |
++ qca->qca_memdump = NULL; |
2990 |
++ } |
2991 |
+ qca->memdump_state = QCA_MEMDUMP_TIMEOUT; |
2992 |
+ cancel_delayed_work(&qca->ctrl_memdump_timeout); |
2993 |
+- skb_queue_purge(&qca->rx_memdump_q); |
2994 |
+- mutex_unlock(&qca->hci_memdump_lock); |
2995 |
++ } |
2996 |
++ mutex_unlock(&qca->hci_memdump_lock); |
2997 |
++ |
2998 |
++ if (qca->memdump_state == QCA_MEMDUMP_TIMEOUT || |
2999 |
++ qca->memdump_state == QCA_MEMDUMP_COLLECTED) { |
3000 |
+ cancel_work_sync(&qca->ctrl_memdump_evt); |
3001 |
++ skb_queue_purge(&qca->rx_memdump_q); |
3002 |
+ } |
3003 |
+ |
3004 |
+ clear_bit(QCA_HW_ERROR_EVENT, &qca->flags); |
3005 |
+@@ -1489,10 +1504,30 @@ static void qca_cmd_timeout(struct hci_dev *hdev) |
3006 |
+ struct hci_uart *hu = hci_get_drvdata(hdev); |
3007 |
+ struct qca_data *qca = hu->priv; |
3008 |
+ |
3009 |
+- if (qca->memdump_state == QCA_MEMDUMP_IDLE) |
3010 |
++ set_bit(QCA_SSR_TRIGGERED, &qca->flags); |
3011 |
++ if (qca->memdump_state == QCA_MEMDUMP_IDLE) { |
3012 |
++ set_bit(QCA_MEMDUMP_COLLECTION, &qca->flags); |
3013 |
+ qca_send_crashbuffer(hu); |
3014 |
+- else |
3015 |
+- bt_dev_info(hdev, "Dump collection is in process"); |
3016 |
++ qca_wait_for_dump_collection(hdev); |
3017 |
++ } else if (qca->memdump_state == QCA_MEMDUMP_COLLECTING) { |
3018 |
++ /* Let us wait here until memory dump collected or |
3019 |
++ * memory dump timer expired. |
3020 |
++ */ |
3021 |
++ bt_dev_info(hdev, "waiting for dump to complete"); |
3022 |
++ qca_wait_for_dump_collection(hdev); |
3023 |
++ } |
3024 |
++ |
3025 |
++ mutex_lock(&qca->hci_memdump_lock); |
3026 |
++ if (qca->memdump_state != QCA_MEMDUMP_COLLECTED) { |
3027 |
++ qca->memdump_state = QCA_MEMDUMP_TIMEOUT; |
3028 |
++ if (!test_bit(QCA_HW_ERROR_EVENT, &qca->flags)) { |
3029 |
++ /* Inject hw error event to reset the device |
3030 |
++ * and driver. |
3031 |
++ */ |
3032 |
++ hci_reset_dev(hu->hdev); |
3033 |
++ } |
3034 |
++ } |
3035 |
++ mutex_unlock(&qca->hci_memdump_lock); |
3036 |
+ } |
3037 |
+ |
3038 |
+ static int qca_wcn3990_init(struct hci_uart *hu) |
3039 |
+@@ -1598,11 +1633,15 @@ static int qca_setup(struct hci_uart *hu) |
3040 |
+ bt_dev_info(hdev, "setting up %s", |
3041 |
+ qca_is_wcn399x(soc_type) ? "wcn399x" : "ROME"); |
3042 |
+ |
3043 |
++ qca->memdump_state = QCA_MEMDUMP_IDLE; |
3044 |
++ |
3045 |
+ retry: |
3046 |
+ ret = qca_power_on(hdev); |
3047 |
+ if (ret) |
3048 |
+ return ret; |
3049 |
+ |
3050 |
++ clear_bit(QCA_SSR_TRIGGERED, &qca->flags); |
3051 |
++ |
3052 |
+ if (qca_is_wcn399x(soc_type)) { |
3053 |
+ set_bit(HCI_QUIRK_USE_BDADDR_PROPERTY, &hdev->quirks); |
3054 |
+ |
3055 |
+@@ -1739,9 +1778,6 @@ static void qca_power_shutdown(struct hci_uart *hu) |
3056 |
+ qca_flush(hu); |
3057 |
+ spin_unlock_irqrestore(&qca->hci_ibs_lock, flags); |
3058 |
+ |
3059 |
+- hu->hdev->hw_error = NULL; |
3060 |
+- hu->hdev->cmd_timeout = NULL; |
3061 |
+- |
3062 |
+ /* Non-serdev device usually is powered by external power |
3063 |
+ * and don't need additional action in driver for power down |
3064 |
+ */ |
3065 |
+@@ -1763,6 +1799,9 @@ static int qca_power_off(struct hci_dev *hdev) |
3066 |
+ struct qca_data *qca = hu->priv; |
3067 |
+ enum qca_btsoc_type soc_type = qca_soc_type(hu); |
3068 |
+ |
3069 |
++ hu->hdev->hw_error = NULL; |
3070 |
++ hu->hdev->cmd_timeout = NULL; |
3071 |
++ |
3072 |
+ /* Stop sending shutdown command if soc crashes. */ |
3073 |
+ if (qca_is_wcn399x(soc_type) |
3074 |
+ && qca->memdump_state == QCA_MEMDUMP_IDLE) { |
3075 |
+@@ -1770,7 +1809,6 @@ static int qca_power_off(struct hci_dev *hdev) |
3076 |
+ usleep_range(8000, 10000); |
3077 |
+ } |
3078 |
+ |
3079 |
+- qca->memdump_state = QCA_MEMDUMP_IDLE; |
3080 |
+ qca_power_shutdown(hu); |
3081 |
+ return 0; |
3082 |
+ } |
3083 |
+@@ -1909,17 +1947,17 @@ static int qca_serdev_probe(struct serdev_device *serdev) |
3084 |
+ } |
3085 |
+ |
3086 |
+ qcadev->susclk = devm_clk_get_optional(&serdev->dev, NULL); |
3087 |
+- if (!qcadev->susclk) { |
3088 |
++ if (IS_ERR(qcadev->susclk)) { |
3089 |
+ dev_warn(&serdev->dev, "failed to acquire clk\n"); |
3090 |
+- } else { |
3091 |
+- err = clk_set_rate(qcadev->susclk, SUSCLK_RATE_32KHZ); |
3092 |
+- if (err) |
3093 |
+- return err; |
3094 |
+- |
3095 |
+- err = clk_prepare_enable(qcadev->susclk); |
3096 |
+- if (err) |
3097 |
+- return err; |
3098 |
++ return PTR_ERR(qcadev->susclk); |
3099 |
+ } |
3100 |
++ err = clk_set_rate(qcadev->susclk, SUSCLK_RATE_32KHZ); |
3101 |
++ if (err) |
3102 |
++ return err; |
3103 |
++ |
3104 |
++ err = clk_prepare_enable(qcadev->susclk); |
3105 |
++ if (err) |
3106 |
++ return err; |
3107 |
+ |
3108 |
+ err = hci_uart_register_device(&qcadev->serdev_hu, &qca_proto); |
3109 |
+ if (err) { |
3110 |
+@@ -1991,8 +2029,6 @@ static int __maybe_unused qca_suspend(struct device *dev) |
3111 |
+ |
3112 |
+ qca->tx_ibs_state = HCI_IBS_TX_ASLEEP; |
3113 |
+ qca->ibs_sent_slps++; |
3114 |
+- |
3115 |
+- qca_wq_serial_tx_clock_vote_off(&qca->ws_tx_vote_off); |
3116 |
+ break; |
3117 |
+ |
3118 |
+ case HCI_IBS_TX_ASLEEP: |
3119 |
+@@ -2020,8 +2056,10 @@ static int __maybe_unused qca_suspend(struct device *dev) |
3120 |
+ qca->rx_ibs_state == HCI_IBS_RX_ASLEEP, |
3121 |
+ msecs_to_jiffies(IBS_BTSOC_TX_IDLE_TIMEOUT_MS)); |
3122 |
+ |
3123 |
+- if (ret > 0) |
3124 |
++ if (ret > 0) { |
3125 |
++ qca_wq_serial_tx_clock_vote_off(&qca->ws_tx_vote_off); |
3126 |
+ return 0; |
3127 |
++ } |
3128 |
+ |
3129 |
+ if (ret == 0) |
3130 |
+ ret = -ETIMEDOUT; |
3131 |
+diff --git a/drivers/bluetooth/hci_serdev.c b/drivers/bluetooth/hci_serdev.c |
3132 |
+index 4652896d4990..ad2f26cb2622 100644 |
3133 |
+--- a/drivers/bluetooth/hci_serdev.c |
3134 |
++++ b/drivers/bluetooth/hci_serdev.c |
3135 |
+@@ -357,7 +357,8 @@ void hci_uart_unregister_device(struct hci_uart *hu) |
3136 |
+ struct hci_dev *hdev = hu->hdev; |
3137 |
+ |
3138 |
+ clear_bit(HCI_UART_PROTO_READY, &hu->flags); |
3139 |
+- hci_unregister_dev(hdev); |
3140 |
++ if (test_bit(HCI_UART_REGISTERED, &hu->flags)) |
3141 |
++ hci_unregister_dev(hdev); |
3142 |
+ hci_free_dev(hdev); |
3143 |
+ |
3144 |
+ cancel_work_sync(&hu->write_work); |
3145 |
+diff --git a/drivers/bus/ti-sysc.c b/drivers/bus/ti-sysc.c |
3146 |
+index 3b0417a01494..ae4cf4667633 100644 |
3147 |
+--- a/drivers/bus/ti-sysc.c |
3148 |
++++ b/drivers/bus/ti-sysc.c |
3149 |
+@@ -1402,6 +1402,10 @@ static const struct sysc_revision_quirk sysc_revision_quirks[] = { |
3150 |
+ SYSC_QUIRK_SWSUP_SIDLE | SYSC_QUIRK_SWSUP_MSTANDBY), |
3151 |
+ SYSC_QUIRK("tptc", 0, 0, -ENODEV, -ENODEV, 0x40007c00, 0xffffffff, |
3152 |
+ SYSC_QUIRK_SWSUP_SIDLE | SYSC_QUIRK_SWSUP_MSTANDBY), |
3153 |
++ SYSC_QUIRK("usb_host_hs", 0, 0, 0x10, 0x14, 0x50700100, 0xffffffff, |
3154 |
++ SYSC_QUIRK_SWSUP_SIDLE | SYSC_QUIRK_SWSUP_MSTANDBY), |
3155 |
++ SYSC_QUIRK("usb_host_hs", 0, 0, 0x10, -ENODEV, 0x50700101, 0xffffffff, |
3156 |
++ SYSC_QUIRK_SWSUP_SIDLE | SYSC_QUIRK_SWSUP_MSTANDBY), |
3157 |
+ SYSC_QUIRK("usb_otg_hs", 0, 0x400, 0x404, 0x408, 0x00000050, |
3158 |
+ 0xffffffff, SYSC_QUIRK_SWSUP_SIDLE | SYSC_QUIRK_SWSUP_MSTANDBY), |
3159 |
+ SYSC_QUIRK("usb_otg_hs", 0, 0, 0x10, -ENODEV, 0x4ea2080d, 0xffffffff, |
3160 |
+@@ -1473,8 +1477,6 @@ static const struct sysc_revision_quirk sysc_revision_quirks[] = { |
3161 |
+ SYSC_QUIRK("tpcc", 0, 0, -ENODEV, -ENODEV, 0x40014c00, 0xffffffff, 0), |
3162 |
+ SYSC_QUIRK("usbhstll", 0, 0, 0x10, 0x14, 0x00000004, 0xffffffff, 0), |
3163 |
+ SYSC_QUIRK("usbhstll", 0, 0, 0x10, 0x14, 0x00000008, 0xffffffff, 0), |
3164 |
+- SYSC_QUIRK("usb_host_hs", 0, 0, 0x10, 0x14, 0x50700100, 0xffffffff, 0), |
3165 |
+- SYSC_QUIRK("usb_host_hs", 0, 0, 0x10, -ENODEV, 0x50700101, 0xffffffff, 0), |
3166 |
+ SYSC_QUIRK("venc", 0x58003000, 0, -ENODEV, -ENODEV, 0x00000002, 0xffffffff, 0), |
3167 |
+ SYSC_QUIRK("vfpe", 0, 0, 0x104, -ENODEV, 0x4d001200, 0xffffffff, 0), |
3168 |
+ #endif |
3169 |
+diff --git a/drivers/char/agp/intel-gtt.c b/drivers/char/agp/intel-gtt.c |
3170 |
+index 3d42fc4290bc..585451a46e44 100644 |
3171 |
+--- a/drivers/char/agp/intel-gtt.c |
3172 |
++++ b/drivers/char/agp/intel-gtt.c |
3173 |
+@@ -304,8 +304,10 @@ static int intel_gtt_setup_scratch_page(void) |
3174 |
+ if (intel_private.needs_dmar) { |
3175 |
+ dma_addr = pci_map_page(intel_private.pcidev, page, 0, |
3176 |
+ PAGE_SIZE, PCI_DMA_BIDIRECTIONAL); |
3177 |
+- if (pci_dma_mapping_error(intel_private.pcidev, dma_addr)) |
3178 |
++ if (pci_dma_mapping_error(intel_private.pcidev, dma_addr)) { |
3179 |
++ __free_page(page); |
3180 |
+ return -EINVAL; |
3181 |
++ } |
3182 |
+ |
3183 |
+ intel_private.scratch_page_dma = dma_addr; |
3184 |
+ } else |
3185 |
+diff --git a/drivers/char/tpm/tpm-chip.c b/drivers/char/tpm/tpm-chip.c |
3186 |
+index 8c77e88012e9..ddaeceb7e109 100644 |
3187 |
+--- a/drivers/char/tpm/tpm-chip.c |
3188 |
++++ b/drivers/char/tpm/tpm-chip.c |
3189 |
+@@ -386,13 +386,8 @@ struct tpm_chip *tpm_chip_alloc(struct device *pdev, |
3190 |
+ chip->cdev.owner = THIS_MODULE; |
3191 |
+ chip->cdevs.owner = THIS_MODULE; |
3192 |
+ |
3193 |
+- chip->work_space.context_buf = kzalloc(PAGE_SIZE, GFP_KERNEL); |
3194 |
+- if (!chip->work_space.context_buf) { |
3195 |
+- rc = -ENOMEM; |
3196 |
+- goto out; |
3197 |
+- } |
3198 |
+- chip->work_space.session_buf = kzalloc(PAGE_SIZE, GFP_KERNEL); |
3199 |
+- if (!chip->work_space.session_buf) { |
3200 |
++ rc = tpm2_init_space(&chip->work_space, TPM2_SPACE_BUFFER_SIZE); |
3201 |
++ if (rc) { |
3202 |
+ rc = -ENOMEM; |
3203 |
+ goto out; |
3204 |
+ } |
3205 |
+diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h |
3206 |
+index 0fbcede241ea..947d1db0a5cc 100644 |
3207 |
+--- a/drivers/char/tpm/tpm.h |
3208 |
++++ b/drivers/char/tpm/tpm.h |
3209 |
+@@ -59,6 +59,9 @@ enum tpm_addr { |
3210 |
+ |
3211 |
+ #define TPM_TAG_RQU_COMMAND 193 |
3212 |
+ |
3213 |
++/* TPM2 specific constants. */ |
3214 |
++#define TPM2_SPACE_BUFFER_SIZE 16384 /* 16 kB */ |
3215 |
++ |
3216 |
+ struct stclear_flags_t { |
3217 |
+ __be16 tag; |
3218 |
+ u8 deactivated; |
3219 |
+@@ -228,7 +231,7 @@ unsigned long tpm2_calc_ordinal_duration(struct tpm_chip *chip, u32 ordinal); |
3220 |
+ int tpm2_probe(struct tpm_chip *chip); |
3221 |
+ int tpm2_get_cc_attrs_tbl(struct tpm_chip *chip); |
3222 |
+ int tpm2_find_cc(struct tpm_chip *chip, u32 cc); |
3223 |
+-int tpm2_init_space(struct tpm_space *space); |
3224 |
++int tpm2_init_space(struct tpm_space *space, unsigned int buf_size); |
3225 |
+ void tpm2_del_space(struct tpm_chip *chip, struct tpm_space *space); |
3226 |
+ void tpm2_flush_space(struct tpm_chip *chip); |
3227 |
+ int tpm2_prepare_space(struct tpm_chip *chip, struct tpm_space *space, u8 *cmd, |
3228 |
+diff --git a/drivers/char/tpm/tpm2-space.c b/drivers/char/tpm/tpm2-space.c |
3229 |
+index 982d341d8837..784b8b3cb903 100644 |
3230 |
+--- a/drivers/char/tpm/tpm2-space.c |
3231 |
++++ b/drivers/char/tpm/tpm2-space.c |
3232 |
+@@ -38,18 +38,21 @@ static void tpm2_flush_sessions(struct tpm_chip *chip, struct tpm_space *space) |
3233 |
+ } |
3234 |
+ } |
3235 |
+ |
3236 |
+-int tpm2_init_space(struct tpm_space *space) |
3237 |
++int tpm2_init_space(struct tpm_space *space, unsigned int buf_size) |
3238 |
+ { |
3239 |
+- space->context_buf = kzalloc(PAGE_SIZE, GFP_KERNEL); |
3240 |
++ space->context_buf = kzalloc(buf_size, GFP_KERNEL); |
3241 |
+ if (!space->context_buf) |
3242 |
+ return -ENOMEM; |
3243 |
+ |
3244 |
+- space->session_buf = kzalloc(PAGE_SIZE, GFP_KERNEL); |
3245 |
++ space->session_buf = kzalloc(buf_size, GFP_KERNEL); |
3246 |
+ if (space->session_buf == NULL) { |
3247 |
+ kfree(space->context_buf); |
3248 |
++ /* Prevent caller getting a dangling pointer. */ |
3249 |
++ space->context_buf = NULL; |
3250 |
+ return -ENOMEM; |
3251 |
+ } |
3252 |
+ |
3253 |
++ space->buf_size = buf_size; |
3254 |
+ return 0; |
3255 |
+ } |
3256 |
+ |
3257 |
+@@ -311,8 +314,10 @@ int tpm2_prepare_space(struct tpm_chip *chip, struct tpm_space *space, u8 *cmd, |
3258 |
+ sizeof(space->context_tbl)); |
3259 |
+ memcpy(&chip->work_space.session_tbl, &space->session_tbl, |
3260 |
+ sizeof(space->session_tbl)); |
3261 |
+- memcpy(chip->work_space.context_buf, space->context_buf, PAGE_SIZE); |
3262 |
+- memcpy(chip->work_space.session_buf, space->session_buf, PAGE_SIZE); |
3263 |
++ memcpy(chip->work_space.context_buf, space->context_buf, |
3264 |
++ space->buf_size); |
3265 |
++ memcpy(chip->work_space.session_buf, space->session_buf, |
3266 |
++ space->buf_size); |
3267 |
+ |
3268 |
+ rc = tpm2_load_space(chip); |
3269 |
+ if (rc) { |
3270 |
+@@ -492,7 +497,7 @@ static int tpm2_save_space(struct tpm_chip *chip) |
3271 |
+ continue; |
3272 |
+ |
3273 |
+ rc = tpm2_save_context(chip, space->context_tbl[i], |
3274 |
+- space->context_buf, PAGE_SIZE, |
3275 |
++ space->context_buf, space->buf_size, |
3276 |
+ &offset); |
3277 |
+ if (rc == -ENOENT) { |
3278 |
+ space->context_tbl[i] = 0; |
3279 |
+@@ -509,9 +514,8 @@ static int tpm2_save_space(struct tpm_chip *chip) |
3280 |
+ continue; |
3281 |
+ |
3282 |
+ rc = tpm2_save_context(chip, space->session_tbl[i], |
3283 |
+- space->session_buf, PAGE_SIZE, |
3284 |
++ space->session_buf, space->buf_size, |
3285 |
+ &offset); |
3286 |
+- |
3287 |
+ if (rc == -ENOENT) { |
3288 |
+ /* handle error saving session, just forget it */ |
3289 |
+ space->session_tbl[i] = 0; |
3290 |
+@@ -557,8 +561,10 @@ int tpm2_commit_space(struct tpm_chip *chip, struct tpm_space *space, |
3291 |
+ sizeof(space->context_tbl)); |
3292 |
+ memcpy(&space->session_tbl, &chip->work_space.session_tbl, |
3293 |
+ sizeof(space->session_tbl)); |
3294 |
+- memcpy(space->context_buf, chip->work_space.context_buf, PAGE_SIZE); |
3295 |
+- memcpy(space->session_buf, chip->work_space.session_buf, PAGE_SIZE); |
3296 |
++ memcpy(space->context_buf, chip->work_space.context_buf, |
3297 |
++ space->buf_size); |
3298 |
++ memcpy(space->session_buf, chip->work_space.session_buf, |
3299 |
++ space->buf_size); |
3300 |
+ |
3301 |
+ return 0; |
3302 |
+ out: |
3303 |
+diff --git a/drivers/char/tpm/tpmrm-dev.c b/drivers/char/tpm/tpmrm-dev.c |
3304 |
+index 7a0a7051a06f..eef0fb06ea83 100644 |
3305 |
+--- a/drivers/char/tpm/tpmrm-dev.c |
3306 |
++++ b/drivers/char/tpm/tpmrm-dev.c |
3307 |
+@@ -21,7 +21,7 @@ static int tpmrm_open(struct inode *inode, struct file *file) |
3308 |
+ if (priv == NULL) |
3309 |
+ return -ENOMEM; |
3310 |
+ |
3311 |
+- rc = tpm2_init_space(&priv->space); |
3312 |
++ rc = tpm2_init_space(&priv->space, TPM2_SPACE_BUFFER_SIZE); |
3313 |
+ if (rc) { |
3314 |
+ kfree(priv); |
3315 |
+ return -ENOMEM; |
3316 |
+diff --git a/drivers/clk/bcm/clk-bcm63xx-gate.c b/drivers/clk/bcm/clk-bcm63xx-gate.c |
3317 |
+index 98e884957db8..911a29bd744e 100644 |
3318 |
+--- a/drivers/clk/bcm/clk-bcm63xx-gate.c |
3319 |
++++ b/drivers/clk/bcm/clk-bcm63xx-gate.c |
3320 |
+@@ -155,6 +155,7 @@ static int clk_bcm63xx_probe(struct platform_device *pdev) |
3321 |
+ |
3322 |
+ for (entry = table; entry->name; entry++) |
3323 |
+ maxbit = max_t(u8, maxbit, entry->bit); |
3324 |
++ maxbit++; |
3325 |
+ |
3326 |
+ hw = devm_kzalloc(&pdev->dev, struct_size(hw, data.hws, maxbit), |
3327 |
+ GFP_KERNEL); |
3328 |
+diff --git a/drivers/clk/clk-scmi.c b/drivers/clk/clk-scmi.c |
3329 |
+index c491f5de0f3f..c754dfbb73fd 100644 |
3330 |
+--- a/drivers/clk/clk-scmi.c |
3331 |
++++ b/drivers/clk/clk-scmi.c |
3332 |
+@@ -103,6 +103,8 @@ static const struct clk_ops scmi_clk_ops = { |
3333 |
+ static int scmi_clk_ops_init(struct device *dev, struct scmi_clk *sclk) |
3334 |
+ { |
3335 |
+ int ret; |
3336 |
++ unsigned long min_rate, max_rate; |
3337 |
++ |
3338 |
+ struct clk_init_data init = { |
3339 |
+ .flags = CLK_GET_RATE_NOCACHE, |
3340 |
+ .num_parents = 0, |
3341 |
+@@ -112,9 +114,23 @@ static int scmi_clk_ops_init(struct device *dev, struct scmi_clk *sclk) |
3342 |
+ |
3343 |
+ sclk->hw.init = &init; |
3344 |
+ ret = devm_clk_hw_register(dev, &sclk->hw); |
3345 |
+- if (!ret) |
3346 |
+- clk_hw_set_rate_range(&sclk->hw, sclk->info->range.min_rate, |
3347 |
+- sclk->info->range.max_rate); |
3348 |
++ if (ret) |
3349 |
++ return ret; |
3350 |
++ |
3351 |
++ if (sclk->info->rate_discrete) { |
3352 |
++ int num_rates = sclk->info->list.num_rates; |
3353 |
++ |
3354 |
++ if (num_rates <= 0) |
3355 |
++ return -EINVAL; |
3356 |
++ |
3357 |
++ min_rate = sclk->info->list.rates[0]; |
3358 |
++ max_rate = sclk->info->list.rates[num_rates - 1]; |
3359 |
++ } else { |
3360 |
++ min_rate = sclk->info->range.min_rate; |
3361 |
++ max_rate = sclk->info->range.max_rate; |
3362 |
++ } |
3363 |
++ |
3364 |
++ clk_hw_set_rate_range(&sclk->hw, min_rate, max_rate); |
3365 |
+ return ret; |
3366 |
+ } |
3367 |
+ |
3368 |
+diff --git a/drivers/clk/qcom/gcc-sc7180.c b/drivers/clk/qcom/gcc-sc7180.c |
3369 |
+index 73380525cb09..b3704b685cca 100644 |
3370 |
+--- a/drivers/clk/qcom/gcc-sc7180.c |
3371 |
++++ b/drivers/clk/qcom/gcc-sc7180.c |
3372 |
+@@ -1041,7 +1041,7 @@ static struct clk_branch gcc_disp_gpll0_clk_src = { |
3373 |
+ .hw = &gpll0.clkr.hw, |
3374 |
+ }, |
3375 |
+ .num_parents = 1, |
3376 |
+- .ops = &clk_branch2_ops, |
3377 |
++ .ops = &clk_branch2_aon_ops, |
3378 |
+ }, |
3379 |
+ }, |
3380 |
+ }; |
3381 |
+diff --git a/drivers/clk/qcom/gcc-sdm845.c b/drivers/clk/qcom/gcc-sdm845.c |
3382 |
+index f6ce888098be..90f7febaf528 100644 |
3383 |
+--- a/drivers/clk/qcom/gcc-sdm845.c |
3384 |
++++ b/drivers/clk/qcom/gcc-sdm845.c |
3385 |
+@@ -1,6 +1,6 @@ |
3386 |
+ // SPDX-License-Identifier: GPL-2.0 |
3387 |
+ /* |
3388 |
+- * Copyright (c) 2018, The Linux Foundation. All rights reserved. |
3389 |
++ * Copyright (c) 2018, 2020, The Linux Foundation. All rights reserved. |
3390 |
+ */ |
3391 |
+ |
3392 |
+ #include <linux/kernel.h> |
3393 |
+@@ -1344,7 +1344,7 @@ static struct clk_branch gcc_disp_gpll0_clk_src = { |
3394 |
+ "gpll0", |
3395 |
+ }, |
3396 |
+ .num_parents = 1, |
3397 |
+- .ops = &clk_branch2_ops, |
3398 |
++ .ops = &clk_branch2_aon_ops, |
3399 |
+ }, |
3400 |
+ }, |
3401 |
+ }; |
3402 |
+diff --git a/drivers/cpufreq/Kconfig.arm b/drivers/cpufreq/Kconfig.arm |
3403 |
+index 15c1a1231516..c65241bfa512 100644 |
3404 |
+--- a/drivers/cpufreq/Kconfig.arm |
3405 |
++++ b/drivers/cpufreq/Kconfig.arm |
3406 |
+@@ -41,6 +41,7 @@ config ARM_ARMADA_37XX_CPUFREQ |
3407 |
+ config ARM_ARMADA_8K_CPUFREQ |
3408 |
+ tristate "Armada 8K CPUFreq driver" |
3409 |
+ depends on ARCH_MVEBU && CPUFREQ_DT |
3410 |
++ select ARMADA_AP_CPU_CLK |
3411 |
+ help |
3412 |
+ This enables the CPUFreq driver support for Marvell |
3413 |
+ Armada8k SOCs. |
3414 |
+diff --git a/drivers/cpufreq/armada-37xx-cpufreq.c b/drivers/cpufreq/armada-37xx-cpufreq.c |
3415 |
+index aa0f06dec959..df1c941260d1 100644 |
3416 |
+--- a/drivers/cpufreq/armada-37xx-cpufreq.c |
3417 |
++++ b/drivers/cpufreq/armada-37xx-cpufreq.c |
3418 |
+@@ -456,6 +456,7 @@ static int __init armada37xx_cpufreq_driver_init(void) |
3419 |
+ /* Now that everything is setup, enable the DVFS at hardware level */ |
3420 |
+ armada37xx_cpufreq_enable_dvfs(nb_pm_base); |
3421 |
+ |
3422 |
++ memset(&pdata, 0, sizeof(pdata)); |
3423 |
+ pdata.suspend = armada37xx_cpufreq_suspend; |
3424 |
+ pdata.resume = armada37xx_cpufreq_resume; |
3425 |
+ |
3426 |
+diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c |
3427 |
+index d03f250f68e4..e3e94a8bb499 100644 |
3428 |
+--- a/drivers/cpufreq/cpufreq.c |
3429 |
++++ b/drivers/cpufreq/cpufreq.c |
3430 |
+@@ -621,6 +621,24 @@ static struct cpufreq_governor *find_governor(const char *str_governor) |
3431 |
+ return NULL; |
3432 |
+ } |
3433 |
+ |
3434 |
++static struct cpufreq_governor *get_governor(const char *str_governor) |
3435 |
++{ |
3436 |
++ struct cpufreq_governor *t; |
3437 |
++ |
3438 |
++ mutex_lock(&cpufreq_governor_mutex); |
3439 |
++ t = find_governor(str_governor); |
3440 |
++ if (!t) |
3441 |
++ goto unlock; |
3442 |
++ |
3443 |
++ if (!try_module_get(t->owner)) |
3444 |
++ t = NULL; |
3445 |
++ |
3446 |
++unlock: |
3447 |
++ mutex_unlock(&cpufreq_governor_mutex); |
3448 |
++ |
3449 |
++ return t; |
3450 |
++} |
3451 |
++ |
3452 |
+ static unsigned int cpufreq_parse_policy(char *str_governor) |
3453 |
+ { |
3454 |
+ if (!strncasecmp(str_governor, "performance", CPUFREQ_NAME_LEN)) |
3455 |
+@@ -640,28 +658,14 @@ static struct cpufreq_governor *cpufreq_parse_governor(char *str_governor) |
3456 |
+ { |
3457 |
+ struct cpufreq_governor *t; |
3458 |
+ |
3459 |
+- mutex_lock(&cpufreq_governor_mutex); |
3460 |
++ t = get_governor(str_governor); |
3461 |
++ if (t) |
3462 |
++ return t; |
3463 |
+ |
3464 |
+- t = find_governor(str_governor); |
3465 |
+- if (!t) { |
3466 |
+- int ret; |
3467 |
+- |
3468 |
+- mutex_unlock(&cpufreq_governor_mutex); |
3469 |
+- |
3470 |
+- ret = request_module("cpufreq_%s", str_governor); |
3471 |
+- if (ret) |
3472 |
+- return NULL; |
3473 |
+- |
3474 |
+- mutex_lock(&cpufreq_governor_mutex); |
3475 |
+- |
3476 |
+- t = find_governor(str_governor); |
3477 |
+- } |
3478 |
+- if (t && !try_module_get(t->owner)) |
3479 |
+- t = NULL; |
3480 |
+- |
3481 |
+- mutex_unlock(&cpufreq_governor_mutex); |
3482 |
++ if (request_module("cpufreq_%s", str_governor)) |
3483 |
++ return NULL; |
3484 |
+ |
3485 |
+- return t; |
3486 |
++ return get_governor(str_governor); |
3487 |
+ } |
3488 |
+ |
3489 |
+ /** |
3490 |
+@@ -815,12 +819,14 @@ static ssize_t show_scaling_available_governors(struct cpufreq_policy *policy, |
3491 |
+ goto out; |
3492 |
+ } |
3493 |
+ |
3494 |
++ mutex_lock(&cpufreq_governor_mutex); |
3495 |
+ for_each_governor(t) { |
3496 |
+ if (i >= (ssize_t) ((PAGE_SIZE / sizeof(char)) |
3497 |
+ - (CPUFREQ_NAME_LEN + 2))) |
3498 |
+- goto out; |
3499 |
++ break; |
3500 |
+ i += scnprintf(&buf[i], CPUFREQ_NAME_PLEN, "%s ", t->name); |
3501 |
+ } |
3502 |
++ mutex_unlock(&cpufreq_governor_mutex); |
3503 |
+ out: |
3504 |
+ i += sprintf(&buf[i], "\n"); |
3505 |
+ return i; |
3506 |
+@@ -1058,15 +1064,17 @@ static int cpufreq_init_policy(struct cpufreq_policy *policy) |
3507 |
+ struct cpufreq_governor *def_gov = cpufreq_default_governor(); |
3508 |
+ struct cpufreq_governor *gov = NULL; |
3509 |
+ unsigned int pol = CPUFREQ_POLICY_UNKNOWN; |
3510 |
++ int ret; |
3511 |
+ |
3512 |
+ if (has_target()) { |
3513 |
+ /* Update policy governor to the one used before hotplug. */ |
3514 |
+- gov = find_governor(policy->last_governor); |
3515 |
++ gov = get_governor(policy->last_governor); |
3516 |
+ if (gov) { |
3517 |
+ pr_debug("Restoring governor %s for cpu %d\n", |
3518 |
+ policy->governor->name, policy->cpu); |
3519 |
+ } else if (def_gov) { |
3520 |
+ gov = def_gov; |
3521 |
++ __module_get(gov->owner); |
3522 |
+ } else { |
3523 |
+ return -ENODATA; |
3524 |
+ } |
3525 |
+@@ -1089,7 +1097,11 @@ static int cpufreq_init_policy(struct cpufreq_policy *policy) |
3526 |
+ return -ENODATA; |
3527 |
+ } |
3528 |
+ |
3529 |
+- return cpufreq_set_policy(policy, gov, pol); |
3530 |
++ ret = cpufreq_set_policy(policy, gov, pol); |
3531 |
++ if (gov) |
3532 |
++ module_put(gov->owner); |
3533 |
++ |
3534 |
++ return ret; |
3535 |
+ } |
3536 |
+ |
3537 |
+ static int cpufreq_add_policy_cpu(struct cpufreq_policy *policy, unsigned int cpu) |
3538 |
+diff --git a/drivers/crypto/caam/caamalg.c b/drivers/crypto/caam/caamalg.c |
3539 |
+index b2f9882bc010..bf90a4fcabd1 100644 |
3540 |
+--- a/drivers/crypto/caam/caamalg.c |
3541 |
++++ b/drivers/crypto/caam/caamalg.c |
3542 |
+@@ -838,7 +838,7 @@ static int xts_skcipher_setkey(struct crypto_skcipher *skcipher, const u8 *key, |
3543 |
+ u32 *desc; |
3544 |
+ |
3545 |
+ if (keylen != 2 * AES_MIN_KEY_SIZE && keylen != 2 * AES_MAX_KEY_SIZE) { |
3546 |
+- dev_err(jrdev, "key size mismatch\n"); |
3547 |
++ dev_dbg(jrdev, "key size mismatch\n"); |
3548 |
+ return -EINVAL; |
3549 |
+ } |
3550 |
+ |
3551 |
+diff --git a/drivers/crypto/caam/caamalg_qi.c b/drivers/crypto/caam/caamalg_qi.c |
3552 |
+index 27e36bdf6163..315d53499ce8 100644 |
3553 |
+--- a/drivers/crypto/caam/caamalg_qi.c |
3554 |
++++ b/drivers/crypto/caam/caamalg_qi.c |
3555 |
+@@ -728,7 +728,7 @@ static int xts_skcipher_setkey(struct crypto_skcipher *skcipher, const u8 *key, |
3556 |
+ int ret = 0; |
3557 |
+ |
3558 |
+ if (keylen != 2 * AES_MIN_KEY_SIZE && keylen != 2 * AES_MAX_KEY_SIZE) { |
3559 |
+- dev_err(jrdev, "key size mismatch\n"); |
3560 |
++ dev_dbg(jrdev, "key size mismatch\n"); |
3561 |
+ return -EINVAL; |
3562 |
+ } |
3563 |
+ |
3564 |
+diff --git a/drivers/crypto/caam/caamalg_qi2.c b/drivers/crypto/caam/caamalg_qi2.c |
3565 |
+index 28669cbecf77..e1b6bc6ef091 100644 |
3566 |
+--- a/drivers/crypto/caam/caamalg_qi2.c |
3567 |
++++ b/drivers/crypto/caam/caamalg_qi2.c |
3568 |
+@@ -1058,7 +1058,7 @@ static int xts_skcipher_setkey(struct crypto_skcipher *skcipher, const u8 *key, |
3569 |
+ u32 *desc; |
3570 |
+ |
3571 |
+ if (keylen != 2 * AES_MIN_KEY_SIZE && keylen != 2 * AES_MAX_KEY_SIZE) { |
3572 |
+- dev_err(dev, "key size mismatch\n"); |
3573 |
++ dev_dbg(dev, "key size mismatch\n"); |
3574 |
+ return -EINVAL; |
3575 |
+ } |
3576 |
+ |
3577 |
+diff --git a/drivers/crypto/cavium/cpt/cptvf_algs.c b/drivers/crypto/cavium/cpt/cptvf_algs.c |
3578 |
+index 1be1adffff1d..2e4bf90c5798 100644 |
3579 |
+--- a/drivers/crypto/cavium/cpt/cptvf_algs.c |
3580 |
++++ b/drivers/crypto/cavium/cpt/cptvf_algs.c |
3581 |
+@@ -200,6 +200,7 @@ static inline int cvm_enc_dec(struct skcipher_request *req, u32 enc) |
3582 |
+ int status; |
3583 |
+ |
3584 |
+ memset(req_info, 0, sizeof(struct cpt_request_info)); |
3585 |
++ req_info->may_sleep = (req->base.flags & CRYPTO_TFM_REQ_MAY_SLEEP) != 0; |
3586 |
+ memset(fctx, 0, sizeof(struct fc_context)); |
3587 |
+ create_input_list(req, enc, enc_iv_len); |
3588 |
+ create_output_list(req, enc_iv_len); |
3589 |
+diff --git a/drivers/crypto/cavium/cpt/cptvf_reqmanager.c b/drivers/crypto/cavium/cpt/cptvf_reqmanager.c |
3590 |
+index 7a24019356b5..e343249c8d05 100644 |
3591 |
+--- a/drivers/crypto/cavium/cpt/cptvf_reqmanager.c |
3592 |
++++ b/drivers/crypto/cavium/cpt/cptvf_reqmanager.c |
3593 |
+@@ -133,7 +133,7 @@ static inline int setup_sgio_list(struct cpt_vf *cptvf, |
3594 |
+ |
3595 |
+ /* Setup gather (input) components */ |
3596 |
+ g_sz_bytes = ((req->incnt + 3) / 4) * sizeof(struct sglist_component); |
3597 |
+- info->gather_components = kzalloc(g_sz_bytes, GFP_KERNEL); |
3598 |
++ info->gather_components = kzalloc(g_sz_bytes, req->may_sleep ? GFP_KERNEL : GFP_ATOMIC); |
3599 |
+ if (!info->gather_components) { |
3600 |
+ ret = -ENOMEM; |
3601 |
+ goto scatter_gather_clean; |
3602 |
+@@ -150,7 +150,7 @@ static inline int setup_sgio_list(struct cpt_vf *cptvf, |
3603 |
+ |
3604 |
+ /* Setup scatter (output) components */ |
3605 |
+ s_sz_bytes = ((req->outcnt + 3) / 4) * sizeof(struct sglist_component); |
3606 |
+- info->scatter_components = kzalloc(s_sz_bytes, GFP_KERNEL); |
3607 |
++ info->scatter_components = kzalloc(s_sz_bytes, req->may_sleep ? GFP_KERNEL : GFP_ATOMIC); |
3608 |
+ if (!info->scatter_components) { |
3609 |
+ ret = -ENOMEM; |
3610 |
+ goto scatter_gather_clean; |
3611 |
+@@ -167,7 +167,7 @@ static inline int setup_sgio_list(struct cpt_vf *cptvf, |
3612 |
+ |
3613 |
+ /* Create and initialize DPTR */ |
3614 |
+ info->dlen = g_sz_bytes + s_sz_bytes + SG_LIST_HDR_SIZE; |
3615 |
+- info->in_buffer = kzalloc(info->dlen, GFP_KERNEL); |
3616 |
++ info->in_buffer = kzalloc(info->dlen, req->may_sleep ? GFP_KERNEL : GFP_ATOMIC); |
3617 |
+ if (!info->in_buffer) { |
3618 |
+ ret = -ENOMEM; |
3619 |
+ goto scatter_gather_clean; |
3620 |
+@@ -195,7 +195,7 @@ static inline int setup_sgio_list(struct cpt_vf *cptvf, |
3621 |
+ } |
3622 |
+ |
3623 |
+ /* Create and initialize RPTR */ |
3624 |
+- info->out_buffer = kzalloc(COMPLETION_CODE_SIZE, GFP_KERNEL); |
3625 |
++ info->out_buffer = kzalloc(COMPLETION_CODE_SIZE, req->may_sleep ? GFP_KERNEL : GFP_ATOMIC); |
3626 |
+ if (!info->out_buffer) { |
3627 |
+ ret = -ENOMEM; |
3628 |
+ goto scatter_gather_clean; |
3629 |
+@@ -421,7 +421,7 @@ int process_request(struct cpt_vf *cptvf, struct cpt_request_info *req) |
3630 |
+ struct cpt_vq_command vq_cmd; |
3631 |
+ union cpt_inst_s cptinst; |
3632 |
+ |
3633 |
+- info = kzalloc(sizeof(*info), GFP_KERNEL); |
3634 |
++ info = kzalloc(sizeof(*info), req->may_sleep ? GFP_KERNEL : GFP_ATOMIC); |
3635 |
+ if (unlikely(!info)) { |
3636 |
+ dev_err(&pdev->dev, "Unable to allocate memory for info_buffer\n"); |
3637 |
+ return -ENOMEM; |
3638 |
+@@ -443,7 +443,7 @@ int process_request(struct cpt_vf *cptvf, struct cpt_request_info *req) |
3639 |
+ * Get buffer for union cpt_res_s response |
3640 |
+ * structure and its physical address |
3641 |
+ */ |
3642 |
+- info->completion_addr = kzalloc(sizeof(union cpt_res_s), GFP_KERNEL); |
3643 |
++ info->completion_addr = kzalloc(sizeof(union cpt_res_s), req->may_sleep ? GFP_KERNEL : GFP_ATOMIC); |
3644 |
+ if (unlikely(!info->completion_addr)) { |
3645 |
+ dev_err(&pdev->dev, "Unable to allocate memory for completion_addr\n"); |
3646 |
+ ret = -ENOMEM; |
3647 |
+diff --git a/drivers/crypto/cavium/cpt/request_manager.h b/drivers/crypto/cavium/cpt/request_manager.h |
3648 |
+index 3514b082eca7..1e8dd9ebcc17 100644 |
3649 |
+--- a/drivers/crypto/cavium/cpt/request_manager.h |
3650 |
++++ b/drivers/crypto/cavium/cpt/request_manager.h |
3651 |
+@@ -62,6 +62,8 @@ struct cpt_request_info { |
3652 |
+ union ctrl_info ctrl; /* User control information */ |
3653 |
+ struct cptvf_request req; /* Request Information (Core specific) */ |
3654 |
+ |
3655 |
++ bool may_sleep; |
3656 |
++ |
3657 |
+ struct buf_ptr in[MAX_BUF_CNT]; |
3658 |
+ struct buf_ptr out[MAX_BUF_CNT]; |
3659 |
+ |
3660 |
+diff --git a/drivers/crypto/ccp/ccp-dev.h b/drivers/crypto/ccp/ccp-dev.h |
3661 |
+index 3f68262d9ab4..87a34d91fdf7 100644 |
3662 |
+--- a/drivers/crypto/ccp/ccp-dev.h |
3663 |
++++ b/drivers/crypto/ccp/ccp-dev.h |
3664 |
+@@ -469,6 +469,7 @@ struct ccp_sg_workarea { |
3665 |
+ unsigned int sg_used; |
3666 |
+ |
3667 |
+ struct scatterlist *dma_sg; |
3668 |
++ struct scatterlist *dma_sg_head; |
3669 |
+ struct device *dma_dev; |
3670 |
+ unsigned int dma_count; |
3671 |
+ enum dma_data_direction dma_dir; |
3672 |
+diff --git a/drivers/crypto/ccp/ccp-ops.c b/drivers/crypto/ccp/ccp-ops.c |
3673 |
+index 422193690fd4..64112c736810 100644 |
3674 |
+--- a/drivers/crypto/ccp/ccp-ops.c |
3675 |
++++ b/drivers/crypto/ccp/ccp-ops.c |
3676 |
+@@ -63,7 +63,7 @@ static u32 ccp_gen_jobid(struct ccp_device *ccp) |
3677 |
+ static void ccp_sg_free(struct ccp_sg_workarea *wa) |
3678 |
+ { |
3679 |
+ if (wa->dma_count) |
3680 |
+- dma_unmap_sg(wa->dma_dev, wa->dma_sg, wa->nents, wa->dma_dir); |
3681 |
++ dma_unmap_sg(wa->dma_dev, wa->dma_sg_head, wa->nents, wa->dma_dir); |
3682 |
+ |
3683 |
+ wa->dma_count = 0; |
3684 |
+ } |
3685 |
+@@ -92,6 +92,7 @@ static int ccp_init_sg_workarea(struct ccp_sg_workarea *wa, struct device *dev, |
3686 |
+ return 0; |
3687 |
+ |
3688 |
+ wa->dma_sg = sg; |
3689 |
++ wa->dma_sg_head = sg; |
3690 |
+ wa->dma_dev = dev; |
3691 |
+ wa->dma_dir = dma_dir; |
3692 |
+ wa->dma_count = dma_map_sg(dev, sg, wa->nents, dma_dir); |
3693 |
+@@ -104,14 +105,28 @@ static int ccp_init_sg_workarea(struct ccp_sg_workarea *wa, struct device *dev, |
3694 |
+ static void ccp_update_sg_workarea(struct ccp_sg_workarea *wa, unsigned int len) |
3695 |
+ { |
3696 |
+ unsigned int nbytes = min_t(u64, len, wa->bytes_left); |
3697 |
++ unsigned int sg_combined_len = 0; |
3698 |
+ |
3699 |
+ if (!wa->sg) |
3700 |
+ return; |
3701 |
+ |
3702 |
+ wa->sg_used += nbytes; |
3703 |
+ wa->bytes_left -= nbytes; |
3704 |
+- if (wa->sg_used == wa->sg->length) { |
3705 |
+- wa->sg = sg_next(wa->sg); |
3706 |
++ if (wa->sg_used == sg_dma_len(wa->dma_sg)) { |
3707 |
++ /* Advance to the next DMA scatterlist entry */ |
3708 |
++ wa->dma_sg = sg_next(wa->dma_sg); |
3709 |
++ |
3710 |
++ /* In the case that the DMA mapped scatterlist has entries |
3711 |
++ * that have been merged, the non-DMA mapped scatterlist |
3712 |
++ * must be advanced multiple times for each merged entry. |
3713 |
++ * This ensures that the current non-DMA mapped entry |
3714 |
++ * corresponds to the current DMA mapped entry. |
3715 |
++ */ |
3716 |
++ do { |
3717 |
++ sg_combined_len += wa->sg->length; |
3718 |
++ wa->sg = sg_next(wa->sg); |
3719 |
++ } while (wa->sg_used > sg_combined_len); |
3720 |
++ |
3721 |
+ wa->sg_used = 0; |
3722 |
+ } |
3723 |
+ } |
3724 |
+@@ -299,7 +314,7 @@ static unsigned int ccp_queue_buf(struct ccp_data *data, unsigned int from) |
3725 |
+ /* Update the structures and generate the count */ |
3726 |
+ buf_count = 0; |
3727 |
+ while (sg_wa->bytes_left && (buf_count < dm_wa->length)) { |
3728 |
+- nbytes = min(sg_wa->sg->length - sg_wa->sg_used, |
3729 |
++ nbytes = min(sg_dma_len(sg_wa->dma_sg) - sg_wa->sg_used, |
3730 |
+ dm_wa->length - buf_count); |
3731 |
+ nbytes = min_t(u64, sg_wa->bytes_left, nbytes); |
3732 |
+ |
3733 |
+@@ -331,11 +346,11 @@ static void ccp_prepare_data(struct ccp_data *src, struct ccp_data *dst, |
3734 |
+ * and destination. The resulting len values will always be <= UINT_MAX |
3735 |
+ * because the dma length is an unsigned int. |
3736 |
+ */ |
3737 |
+- sg_src_len = sg_dma_len(src->sg_wa.sg) - src->sg_wa.sg_used; |
3738 |
++ sg_src_len = sg_dma_len(src->sg_wa.dma_sg) - src->sg_wa.sg_used; |
3739 |
+ sg_src_len = min_t(u64, src->sg_wa.bytes_left, sg_src_len); |
3740 |
+ |
3741 |
+ if (dst) { |
3742 |
+- sg_dst_len = sg_dma_len(dst->sg_wa.sg) - dst->sg_wa.sg_used; |
3743 |
++ sg_dst_len = sg_dma_len(dst->sg_wa.dma_sg) - dst->sg_wa.sg_used; |
3744 |
+ sg_dst_len = min_t(u64, src->sg_wa.bytes_left, sg_dst_len); |
3745 |
+ op_len = min(sg_src_len, sg_dst_len); |
3746 |
+ } else { |
3747 |
+@@ -365,7 +380,7 @@ static void ccp_prepare_data(struct ccp_data *src, struct ccp_data *dst, |
3748 |
+ /* Enough data in the sg element, but we need to |
3749 |
+ * adjust for any previously copied data |
3750 |
+ */ |
3751 |
+- op->src.u.dma.address = sg_dma_address(src->sg_wa.sg); |
3752 |
++ op->src.u.dma.address = sg_dma_address(src->sg_wa.dma_sg); |
3753 |
+ op->src.u.dma.offset = src->sg_wa.sg_used; |
3754 |
+ op->src.u.dma.length = op_len & ~(block_size - 1); |
3755 |
+ |
3756 |
+@@ -386,7 +401,7 @@ static void ccp_prepare_data(struct ccp_data *src, struct ccp_data *dst, |
3757 |
+ /* Enough room in the sg element, but we need to |
3758 |
+ * adjust for any previously used area |
3759 |
+ */ |
3760 |
+- op->dst.u.dma.address = sg_dma_address(dst->sg_wa.sg); |
3761 |
++ op->dst.u.dma.address = sg_dma_address(dst->sg_wa.dma_sg); |
3762 |
+ op->dst.u.dma.offset = dst->sg_wa.sg_used; |
3763 |
+ op->dst.u.dma.length = op->src.u.dma.length; |
3764 |
+ } |
3765 |
+@@ -2028,7 +2043,7 @@ ccp_run_passthru_cmd(struct ccp_cmd_queue *cmd_q, struct ccp_cmd *cmd) |
3766 |
+ dst.sg_wa.sg_used = 0; |
3767 |
+ for (i = 1; i <= src.sg_wa.dma_count; i++) { |
3768 |
+ if (!dst.sg_wa.sg || |
3769 |
+- (dst.sg_wa.sg->length < src.sg_wa.sg->length)) { |
3770 |
++ (sg_dma_len(dst.sg_wa.sg) < sg_dma_len(src.sg_wa.sg))) { |
3771 |
+ ret = -EINVAL; |
3772 |
+ goto e_dst; |
3773 |
+ } |
3774 |
+@@ -2054,8 +2069,8 @@ ccp_run_passthru_cmd(struct ccp_cmd_queue *cmd_q, struct ccp_cmd *cmd) |
3775 |
+ goto e_dst; |
3776 |
+ } |
3777 |
+ |
3778 |
+- dst.sg_wa.sg_used += src.sg_wa.sg->length; |
3779 |
+- if (dst.sg_wa.sg_used == dst.sg_wa.sg->length) { |
3780 |
++ dst.sg_wa.sg_used += sg_dma_len(src.sg_wa.sg); |
3781 |
++ if (dst.sg_wa.sg_used == sg_dma_len(dst.sg_wa.sg)) { |
3782 |
+ dst.sg_wa.sg = sg_next(dst.sg_wa.sg); |
3783 |
+ dst.sg_wa.sg_used = 0; |
3784 |
+ } |
3785 |
+diff --git a/drivers/crypto/ccree/cc_cipher.c b/drivers/crypto/ccree/cc_cipher.c |
3786 |
+index a84335328f37..89f7661f0dce 100644 |
3787 |
+--- a/drivers/crypto/ccree/cc_cipher.c |
3788 |
++++ b/drivers/crypto/ccree/cc_cipher.c |
3789 |
+@@ -159,7 +159,6 @@ static int cc_cipher_init(struct crypto_tfm *tfm) |
3790 |
+ skcipher_alg.base); |
3791 |
+ struct device *dev = drvdata_to_dev(cc_alg->drvdata); |
3792 |
+ unsigned int max_key_buf_size = cc_alg->skcipher_alg.max_keysize; |
3793 |
+- int rc = 0; |
3794 |
+ |
3795 |
+ dev_dbg(dev, "Initializing context @%p for %s\n", ctx_p, |
3796 |
+ crypto_tfm_alg_name(tfm)); |
3797 |
+@@ -171,10 +170,19 @@ static int cc_cipher_init(struct crypto_tfm *tfm) |
3798 |
+ ctx_p->flow_mode = cc_alg->flow_mode; |
3799 |
+ ctx_p->drvdata = cc_alg->drvdata; |
3800 |
+ |
3801 |
++ if (ctx_p->cipher_mode == DRV_CIPHER_ESSIV) { |
3802 |
++ /* Alloc hash tfm for essiv */ |
3803 |
++ ctx_p->shash_tfm = crypto_alloc_shash("sha256-generic", 0, 0); |
3804 |
++ if (IS_ERR(ctx_p->shash_tfm)) { |
3805 |
++ dev_err(dev, "Error allocating hash tfm for ESSIV.\n"); |
3806 |
++ return PTR_ERR(ctx_p->shash_tfm); |
3807 |
++ } |
3808 |
++ } |
3809 |
++ |
3810 |
+ /* Allocate key buffer, cache line aligned */ |
3811 |
+ ctx_p->user.key = kmalloc(max_key_buf_size, GFP_KERNEL); |
3812 |
+ if (!ctx_p->user.key) |
3813 |
+- return -ENOMEM; |
3814 |
++ goto free_shash; |
3815 |
+ |
3816 |
+ dev_dbg(dev, "Allocated key buffer in context. key=@%p\n", |
3817 |
+ ctx_p->user.key); |
3818 |
+@@ -186,21 +194,19 @@ static int cc_cipher_init(struct crypto_tfm *tfm) |
3819 |
+ if (dma_mapping_error(dev, ctx_p->user.key_dma_addr)) { |
3820 |
+ dev_err(dev, "Mapping Key %u B at va=%pK for DMA failed\n", |
3821 |
+ max_key_buf_size, ctx_p->user.key); |
3822 |
+- return -ENOMEM; |
3823 |
++ goto free_key; |
3824 |
+ } |
3825 |
+ dev_dbg(dev, "Mapped key %u B at va=%pK to dma=%pad\n", |
3826 |
+ max_key_buf_size, ctx_p->user.key, &ctx_p->user.key_dma_addr); |
3827 |
+ |
3828 |
+- if (ctx_p->cipher_mode == DRV_CIPHER_ESSIV) { |
3829 |
+- /* Alloc hash tfm for essiv */ |
3830 |
+- ctx_p->shash_tfm = crypto_alloc_shash("sha256-generic", 0, 0); |
3831 |
+- if (IS_ERR(ctx_p->shash_tfm)) { |
3832 |
+- dev_err(dev, "Error allocating hash tfm for ESSIV.\n"); |
3833 |
+- return PTR_ERR(ctx_p->shash_tfm); |
3834 |
+- } |
3835 |
+- } |
3836 |
++ return 0; |
3837 |
+ |
3838 |
+- return rc; |
3839 |
++free_key: |
3840 |
++ kfree(ctx_p->user.key); |
3841 |
++free_shash: |
3842 |
++ crypto_free_shash(ctx_p->shash_tfm); |
3843 |
++ |
3844 |
++ return -ENOMEM; |
3845 |
+ } |
3846 |
+ |
3847 |
+ static void cc_cipher_exit(struct crypto_tfm *tfm) |
3848 |
+diff --git a/drivers/crypto/hisilicon/sec/sec_algs.c b/drivers/crypto/hisilicon/sec/sec_algs.c |
3849 |
+index c27e7160d2df..4ad4ffd90cee 100644 |
3850 |
+--- a/drivers/crypto/hisilicon/sec/sec_algs.c |
3851 |
++++ b/drivers/crypto/hisilicon/sec/sec_algs.c |
3852 |
+@@ -175,7 +175,8 @@ static int sec_alloc_and_fill_hw_sgl(struct sec_hw_sgl **sec_sgl, |
3853 |
+ dma_addr_t *psec_sgl, |
3854 |
+ struct scatterlist *sgl, |
3855 |
+ int count, |
3856 |
+- struct sec_dev_info *info) |
3857 |
++ struct sec_dev_info *info, |
3858 |
++ gfp_t gfp) |
3859 |
+ { |
3860 |
+ struct sec_hw_sgl *sgl_current = NULL; |
3861 |
+ struct sec_hw_sgl *sgl_next; |
3862 |
+@@ -190,7 +191,7 @@ static int sec_alloc_and_fill_hw_sgl(struct sec_hw_sgl **sec_sgl, |
3863 |
+ sge_index = i % SEC_MAX_SGE_NUM; |
3864 |
+ if (sge_index == 0) { |
3865 |
+ sgl_next = dma_pool_zalloc(info->hw_sgl_pool, |
3866 |
+- GFP_KERNEL, &sgl_next_dma); |
3867 |
++ gfp, &sgl_next_dma); |
3868 |
+ if (!sgl_next) { |
3869 |
+ ret = -ENOMEM; |
3870 |
+ goto err_free_hw_sgls; |
3871 |
+@@ -545,14 +546,14 @@ void sec_alg_callback(struct sec_bd_info *resp, void *shadow) |
3872 |
+ } |
3873 |
+ |
3874 |
+ static int sec_alg_alloc_and_calc_split_sizes(int length, size_t **split_sizes, |
3875 |
+- int *steps) |
3876 |
++ int *steps, gfp_t gfp) |
3877 |
+ { |
3878 |
+ size_t *sizes; |
3879 |
+ int i; |
3880 |
+ |
3881 |
+ /* Split into suitable sized blocks */ |
3882 |
+ *steps = roundup(length, SEC_REQ_LIMIT) / SEC_REQ_LIMIT; |
3883 |
+- sizes = kcalloc(*steps, sizeof(*sizes), GFP_KERNEL); |
3884 |
++ sizes = kcalloc(*steps, sizeof(*sizes), gfp); |
3885 |
+ if (!sizes) |
3886 |
+ return -ENOMEM; |
3887 |
+ |
3888 |
+@@ -568,7 +569,7 @@ static int sec_map_and_split_sg(struct scatterlist *sgl, size_t *split_sizes, |
3889 |
+ int steps, struct scatterlist ***splits, |
3890 |
+ int **splits_nents, |
3891 |
+ int sgl_len_in, |
3892 |
+- struct device *dev) |
3893 |
++ struct device *dev, gfp_t gfp) |
3894 |
+ { |
3895 |
+ int ret, count; |
3896 |
+ |
3897 |
+@@ -576,12 +577,12 @@ static int sec_map_and_split_sg(struct scatterlist *sgl, size_t *split_sizes, |
3898 |
+ if (!count) |
3899 |
+ return -EINVAL; |
3900 |
+ |
3901 |
+- *splits = kcalloc(steps, sizeof(struct scatterlist *), GFP_KERNEL); |
3902 |
++ *splits = kcalloc(steps, sizeof(struct scatterlist *), gfp); |
3903 |
+ if (!*splits) { |
3904 |
+ ret = -ENOMEM; |
3905 |
+ goto err_unmap_sg; |
3906 |
+ } |
3907 |
+- *splits_nents = kcalloc(steps, sizeof(int), GFP_KERNEL); |
3908 |
++ *splits_nents = kcalloc(steps, sizeof(int), gfp); |
3909 |
+ if (!*splits_nents) { |
3910 |
+ ret = -ENOMEM; |
3911 |
+ goto err_free_splits; |
3912 |
+@@ -589,7 +590,7 @@ static int sec_map_and_split_sg(struct scatterlist *sgl, size_t *split_sizes, |
3913 |
+ |
3914 |
+ /* output the scatter list before and after this */ |
3915 |
+ ret = sg_split(sgl, count, 0, steps, split_sizes, |
3916 |
+- *splits, *splits_nents, GFP_KERNEL); |
3917 |
++ *splits, *splits_nents, gfp); |
3918 |
+ if (ret) { |
3919 |
+ ret = -ENOMEM; |
3920 |
+ goto err_free_splits_nents; |
3921 |
+@@ -630,13 +631,13 @@ static struct sec_request_el |
3922 |
+ int el_size, bool different_dest, |
3923 |
+ struct scatterlist *sgl_in, int n_ents_in, |
3924 |
+ struct scatterlist *sgl_out, int n_ents_out, |
3925 |
+- struct sec_dev_info *info) |
3926 |
++ struct sec_dev_info *info, gfp_t gfp) |
3927 |
+ { |
3928 |
+ struct sec_request_el *el; |
3929 |
+ struct sec_bd_info *req; |
3930 |
+ int ret; |
3931 |
+ |
3932 |
+- el = kzalloc(sizeof(*el), GFP_KERNEL); |
3933 |
++ el = kzalloc(sizeof(*el), gfp); |
3934 |
+ if (!el) |
3935 |
+ return ERR_PTR(-ENOMEM); |
3936 |
+ el->el_length = el_size; |
3937 |
+@@ -668,7 +669,7 @@ static struct sec_request_el |
3938 |
+ el->sgl_in = sgl_in; |
3939 |
+ |
3940 |
+ ret = sec_alloc_and_fill_hw_sgl(&el->in, &el->dma_in, el->sgl_in, |
3941 |
+- n_ents_in, info); |
3942 |
++ n_ents_in, info, gfp); |
3943 |
+ if (ret) |
3944 |
+ goto err_free_el; |
3945 |
+ |
3946 |
+@@ -679,7 +680,7 @@ static struct sec_request_el |
3947 |
+ el->sgl_out = sgl_out; |
3948 |
+ ret = sec_alloc_and_fill_hw_sgl(&el->out, &el->dma_out, |
3949 |
+ el->sgl_out, |
3950 |
+- n_ents_out, info); |
3951 |
++ n_ents_out, info, gfp); |
3952 |
+ if (ret) |
3953 |
+ goto err_free_hw_sgl_in; |
3954 |
+ |
3955 |
+@@ -720,6 +721,7 @@ static int sec_alg_skcipher_crypto(struct skcipher_request *skreq, |
3956 |
+ int *splits_out_nents = NULL; |
3957 |
+ struct sec_request_el *el, *temp; |
3958 |
+ bool split = skreq->src != skreq->dst; |
3959 |
++ gfp_t gfp = skreq->base.flags & CRYPTO_TFM_REQ_MAY_SLEEP ? GFP_KERNEL : GFP_ATOMIC; |
3960 |
+ |
3961 |
+ mutex_init(&sec_req->lock); |
3962 |
+ sec_req->req_base = &skreq->base; |
3963 |
+@@ -728,13 +730,13 @@ static int sec_alg_skcipher_crypto(struct skcipher_request *skreq, |
3964 |
+ sec_req->len_in = sg_nents(skreq->src); |
3965 |
+ |
3966 |
+ ret = sec_alg_alloc_and_calc_split_sizes(skreq->cryptlen, &split_sizes, |
3967 |
+- &steps); |
3968 |
++ &steps, gfp); |
3969 |
+ if (ret) |
3970 |
+ return ret; |
3971 |
+ sec_req->num_elements = steps; |
3972 |
+ ret = sec_map_and_split_sg(skreq->src, split_sizes, steps, &splits_in, |
3973 |
+ &splits_in_nents, sec_req->len_in, |
3974 |
+- info->dev); |
3975 |
++ info->dev, gfp); |
3976 |
+ if (ret) |
3977 |
+ goto err_free_split_sizes; |
3978 |
+ |
3979 |
+@@ -742,7 +744,7 @@ static int sec_alg_skcipher_crypto(struct skcipher_request *skreq, |
3980 |
+ sec_req->len_out = sg_nents(skreq->dst); |
3981 |
+ ret = sec_map_and_split_sg(skreq->dst, split_sizes, steps, |
3982 |
+ &splits_out, &splits_out_nents, |
3983 |
+- sec_req->len_out, info->dev); |
3984 |
++ sec_req->len_out, info->dev, gfp); |
3985 |
+ if (ret) |
3986 |
+ goto err_unmap_in_sg; |
3987 |
+ } |
3988 |
+@@ -775,7 +777,7 @@ static int sec_alg_skcipher_crypto(struct skcipher_request *skreq, |
3989 |
+ splits_in[i], splits_in_nents[i], |
3990 |
+ split ? splits_out[i] : NULL, |
3991 |
+ split ? splits_out_nents[i] : 0, |
3992 |
+- info); |
3993 |
++ info, gfp); |
3994 |
+ if (IS_ERR(el)) { |
3995 |
+ ret = PTR_ERR(el); |
3996 |
+ goto err_free_elements; |
3997 |
+diff --git a/drivers/crypto/qat/qat_common/qat_algs.c b/drivers/crypto/qat/qat_common/qat_algs.c |
3998 |
+index e14d3dd291f0..1b050391c0c9 100644 |
3999 |
+--- a/drivers/crypto/qat/qat_common/qat_algs.c |
4000 |
++++ b/drivers/crypto/qat/qat_common/qat_algs.c |
4001 |
+@@ -55,6 +55,7 @@ |
4002 |
+ #include <crypto/hmac.h> |
4003 |
+ #include <crypto/algapi.h> |
4004 |
+ #include <crypto/authenc.h> |
4005 |
++#include <crypto/xts.h> |
4006 |
+ #include <linux/dma-mapping.h> |
4007 |
+ #include "adf_accel_devices.h" |
4008 |
+ #include "adf_transport.h" |
4009 |
+@@ -1102,6 +1103,14 @@ static int qat_alg_skcipher_blk_encrypt(struct skcipher_request *req) |
4010 |
+ return qat_alg_skcipher_encrypt(req); |
4011 |
+ } |
4012 |
+ |
4013 |
++static int qat_alg_skcipher_xts_encrypt(struct skcipher_request *req) |
4014 |
++{ |
4015 |
++ if (req->cryptlen < XTS_BLOCK_SIZE) |
4016 |
++ return -EINVAL; |
4017 |
++ |
4018 |
++ return qat_alg_skcipher_encrypt(req); |
4019 |
++} |
4020 |
++ |
4021 |
+ static int qat_alg_skcipher_decrypt(struct skcipher_request *req) |
4022 |
+ { |
4023 |
+ struct crypto_skcipher *stfm = crypto_skcipher_reqtfm(req); |
4024 |
+@@ -1161,6 +1170,15 @@ static int qat_alg_skcipher_blk_decrypt(struct skcipher_request *req) |
4025 |
+ |
4026 |
+ return qat_alg_skcipher_decrypt(req); |
4027 |
+ } |
4028 |
++ |
4029 |
++static int qat_alg_skcipher_xts_decrypt(struct skcipher_request *req) |
4030 |
++{ |
4031 |
++ if (req->cryptlen < XTS_BLOCK_SIZE) |
4032 |
++ return -EINVAL; |
4033 |
++ |
4034 |
++ return qat_alg_skcipher_decrypt(req); |
4035 |
++} |
4036 |
++ |
4037 |
+ static int qat_alg_aead_init(struct crypto_aead *tfm, |
4038 |
+ enum icp_qat_hw_auth_algo hash, |
4039 |
+ const char *hash_name) |
4040 |
+@@ -1354,8 +1372,8 @@ static struct skcipher_alg qat_skciphers[] = { { |
4041 |
+ .init = qat_alg_skcipher_init_tfm, |
4042 |
+ .exit = qat_alg_skcipher_exit_tfm, |
4043 |
+ .setkey = qat_alg_skcipher_xts_setkey, |
4044 |
+- .decrypt = qat_alg_skcipher_blk_decrypt, |
4045 |
+- .encrypt = qat_alg_skcipher_blk_encrypt, |
4046 |
++ .decrypt = qat_alg_skcipher_xts_decrypt, |
4047 |
++ .encrypt = qat_alg_skcipher_xts_encrypt, |
4048 |
+ .min_keysize = 2 * AES_MIN_KEY_SIZE, |
4049 |
+ .max_keysize = 2 * AES_MAX_KEY_SIZE, |
4050 |
+ .ivsize = AES_BLOCK_SIZE, |
4051 |
+diff --git a/drivers/crypto/qat/qat_common/qat_uclo.c b/drivers/crypto/qat/qat_common/qat_uclo.c |
4052 |
+index 6bd8f6a2a24f..aeb03081415c 100644 |
4053 |
+--- a/drivers/crypto/qat/qat_common/qat_uclo.c |
4054 |
++++ b/drivers/crypto/qat/qat_common/qat_uclo.c |
4055 |
+@@ -332,13 +332,18 @@ static int qat_uclo_create_batch_init_list(struct icp_qat_fw_loader_handle |
4056 |
+ } |
4057 |
+ return 0; |
4058 |
+ out_err: |
4059 |
++ /* Do not free the list head unless we allocated it. */ |
4060 |
++ tail_old = tail_old->next; |
4061 |
++ if (flag) { |
4062 |
++ kfree(*init_tab_base); |
4063 |
++ *init_tab_base = NULL; |
4064 |
++ } |
4065 |
++ |
4066 |
+ while (tail_old) { |
4067 |
+ mem_init = tail_old->next; |
4068 |
+ kfree(tail_old); |
4069 |
+ tail_old = mem_init; |
4070 |
+ } |
4071 |
+- if (flag) |
4072 |
+- kfree(*init_tab_base); |
4073 |
+ return -ENOMEM; |
4074 |
+ } |
4075 |
+ |
4076 |
+diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c |
4077 |
+index 6fecd11dafdd..8f6cd0f70fad 100644 |
4078 |
+--- a/drivers/devfreq/devfreq.c |
4079 |
++++ b/drivers/devfreq/devfreq.c |
4080 |
+@@ -1660,8 +1660,7 @@ static int devfreq_summary_show(struct seq_file *s, void *data) |
4081 |
+ unsigned long cur_freq, min_freq, max_freq; |
4082 |
+ unsigned int polling_ms; |
4083 |
+ |
4084 |
+- seq_printf(s, "%-30s %-10s %-10s %-15s %10s %12s %12s %12s\n", |
4085 |
+- "dev_name", |
4086 |
++ seq_printf(s, "%-30s %-30s %-15s %10s %12s %12s %12s\n", |
4087 |
+ "dev", |
4088 |
+ "parent_dev", |
4089 |
+ "governor", |
4090 |
+@@ -1669,10 +1668,9 @@ static int devfreq_summary_show(struct seq_file *s, void *data) |
4091 |
+ "cur_freq_Hz", |
4092 |
+ "min_freq_Hz", |
4093 |
+ "max_freq_Hz"); |
4094 |
+- seq_printf(s, "%30s %10s %10s %15s %10s %12s %12s %12s\n", |
4095 |
++ seq_printf(s, "%30s %30s %15s %10s %12s %12s %12s\n", |
4096 |
++ "------------------------------", |
4097 |
+ "------------------------------", |
4098 |
+- "----------", |
4099 |
+- "----------", |
4100 |
+ "---------------", |
4101 |
+ "----------", |
4102 |
+ "------------", |
4103 |
+@@ -1701,8 +1699,7 @@ static int devfreq_summary_show(struct seq_file *s, void *data) |
4104 |
+ mutex_unlock(&devfreq->lock); |
4105 |
+ |
4106 |
+ seq_printf(s, |
4107 |
+- "%-30s %-10s %-10s %-15s %10d %12ld %12ld %12ld\n", |
4108 |
+- dev_name(devfreq->dev.parent), |
4109 |
++ "%-30s %-30s %-15s %10d %12ld %12ld %12ld\n", |
4110 |
+ dev_name(&devfreq->dev), |
4111 |
+ p_devfreq ? dev_name(&p_devfreq->dev) : "null", |
4112 |
+ devfreq->governor_name, |
4113 |
+diff --git a/drivers/devfreq/rk3399_dmc.c b/drivers/devfreq/rk3399_dmc.c |
4114 |
+index 24f04f78285b..027769e39f9b 100644 |
4115 |
+--- a/drivers/devfreq/rk3399_dmc.c |
4116 |
++++ b/drivers/devfreq/rk3399_dmc.c |
4117 |
+@@ -95,18 +95,20 @@ static int rk3399_dmcfreq_target(struct device *dev, unsigned long *freq, |
4118 |
+ |
4119 |
+ mutex_lock(&dmcfreq->lock); |
4120 |
+ |
4121 |
+- if (target_rate >= dmcfreq->odt_dis_freq) |
4122 |
+- odt_enable = true; |
4123 |
+- |
4124 |
+- /* |
4125 |
+- * This makes a SMC call to the TF-A to set the DDR PD (power-down) |
4126 |
+- * timings and to enable or disable the ODT (on-die termination) |
4127 |
+- * resistors. |
4128 |
+- */ |
4129 |
+- arm_smccc_smc(ROCKCHIP_SIP_DRAM_FREQ, dmcfreq->odt_pd_arg0, |
4130 |
+- dmcfreq->odt_pd_arg1, |
4131 |
+- ROCKCHIP_SIP_CONFIG_DRAM_SET_ODT_PD, |
4132 |
+- odt_enable, 0, 0, 0, &res); |
4133 |
++ if (dmcfreq->regmap_pmu) { |
4134 |
++ if (target_rate >= dmcfreq->odt_dis_freq) |
4135 |
++ odt_enable = true; |
4136 |
++ |
4137 |
++ /* |
4138 |
++ * This makes a SMC call to the TF-A to set the DDR PD |
4139 |
++ * (power-down) timings and to enable or disable the |
4140 |
++ * ODT (on-die termination) resistors. |
4141 |
++ */ |
4142 |
++ arm_smccc_smc(ROCKCHIP_SIP_DRAM_FREQ, dmcfreq->odt_pd_arg0, |
4143 |
++ dmcfreq->odt_pd_arg1, |
4144 |
++ ROCKCHIP_SIP_CONFIG_DRAM_SET_ODT_PD, |
4145 |
++ odt_enable, 0, 0, 0, &res); |
4146 |
++ } |
4147 |
+ |
4148 |
+ /* |
4149 |
+ * If frequency scaling from low to high, adjust voltage first. |
4150 |
+@@ -371,13 +373,14 @@ static int rk3399_dmcfreq_probe(struct platform_device *pdev) |
4151 |
+ } |
4152 |
+ |
4153 |
+ node = of_parse_phandle(np, "rockchip,pmu", 0); |
4154 |
+- if (node) { |
4155 |
+- data->regmap_pmu = syscon_node_to_regmap(node); |
4156 |
+- of_node_put(node); |
4157 |
+- if (IS_ERR(data->regmap_pmu)) { |
4158 |
+- ret = PTR_ERR(data->regmap_pmu); |
4159 |
+- goto err_edev; |
4160 |
+- } |
4161 |
++ if (!node) |
4162 |
++ goto no_pmu; |
4163 |
++ |
4164 |
++ data->regmap_pmu = syscon_node_to_regmap(node); |
4165 |
++ of_node_put(node); |
4166 |
++ if (IS_ERR(data->regmap_pmu)) { |
4167 |
++ ret = PTR_ERR(data->regmap_pmu); |
4168 |
++ goto err_edev; |
4169 |
+ } |
4170 |
+ |
4171 |
+ regmap_read(data->regmap_pmu, RK3399_PMUGRF_OS_REG2, &val); |
4172 |
+@@ -399,6 +402,7 @@ static int rk3399_dmcfreq_probe(struct platform_device *pdev) |
4173 |
+ goto err_edev; |
4174 |
+ }; |
4175 |
+ |
4176 |
++no_pmu: |
4177 |
+ arm_smccc_smc(ROCKCHIP_SIP_DRAM_FREQ, 0, 0, |
4178 |
+ ROCKCHIP_SIP_CONFIG_DRAM_INIT, |
4179 |
+ 0, 0, 0, 0, &res); |
4180 |
+diff --git a/drivers/edac/edac_device_sysfs.c b/drivers/edac/edac_device_sysfs.c |
4181 |
+index 0e7ea3591b78..5e7593753799 100644 |
4182 |
+--- a/drivers/edac/edac_device_sysfs.c |
4183 |
++++ b/drivers/edac/edac_device_sysfs.c |
4184 |
+@@ -275,6 +275,7 @@ int edac_device_register_sysfs_main_kobj(struct edac_device_ctl_info *edac_dev) |
4185 |
+ |
4186 |
+ /* Error exit stack */ |
4187 |
+ err_kobj_reg: |
4188 |
++ kobject_put(&edac_dev->kobj); |
4189 |
+ module_put(edac_dev->owner); |
4190 |
+ |
4191 |
+ err_out: |
4192 |
+diff --git a/drivers/edac/edac_pci_sysfs.c b/drivers/edac/edac_pci_sysfs.c |
4193 |
+index 72c9eb9fdffb..53042af7262e 100644 |
4194 |
+--- a/drivers/edac/edac_pci_sysfs.c |
4195 |
++++ b/drivers/edac/edac_pci_sysfs.c |
4196 |
+@@ -386,7 +386,7 @@ static int edac_pci_main_kobj_setup(void) |
4197 |
+ |
4198 |
+ /* Error unwind statck */ |
4199 |
+ kobject_init_and_add_fail: |
4200 |
+- kfree(edac_pci_top_main_kobj); |
4201 |
++ kobject_put(edac_pci_top_main_kobj); |
4202 |
+ |
4203 |
+ kzalloc_fail: |
4204 |
+ module_put(THIS_MODULE); |
4205 |
+diff --git a/drivers/firmware/arm_scmi/scmi_pm_domain.c b/drivers/firmware/arm_scmi/scmi_pm_domain.c |
4206 |
+index bafbfe358f97..9e44479f0284 100644 |
4207 |
+--- a/drivers/firmware/arm_scmi/scmi_pm_domain.c |
4208 |
++++ b/drivers/firmware/arm_scmi/scmi_pm_domain.c |
4209 |
+@@ -85,7 +85,10 @@ static int scmi_pm_domain_probe(struct scmi_device *sdev) |
4210 |
+ for (i = 0; i < num_domains; i++, scmi_pd++) { |
4211 |
+ u32 state; |
4212 |
+ |
4213 |
+- domains[i] = &scmi_pd->genpd; |
4214 |
++ if (handle->power_ops->state_get(handle, i, &state)) { |
4215 |
++ dev_warn(dev, "failed to get state for domain %d\n", i); |
4216 |
++ continue; |
4217 |
++ } |
4218 |
+ |
4219 |
+ scmi_pd->domain = i; |
4220 |
+ scmi_pd->handle = handle; |
4221 |
+@@ -94,13 +97,10 @@ static int scmi_pm_domain_probe(struct scmi_device *sdev) |
4222 |
+ scmi_pd->genpd.power_off = scmi_pd_power_off; |
4223 |
+ scmi_pd->genpd.power_on = scmi_pd_power_on; |
4224 |
+ |
4225 |
+- if (handle->power_ops->state_get(handle, i, &state)) { |
4226 |
+- dev_warn(dev, "failed to get state for domain %d\n", i); |
4227 |
+- continue; |
4228 |
+- } |
4229 |
+- |
4230 |
+ pm_genpd_init(&scmi_pd->genpd, NULL, |
4231 |
+ state == SCMI_POWER_STATE_GENERIC_OFF); |
4232 |
++ |
4233 |
++ domains[i] = &scmi_pd->genpd; |
4234 |
+ } |
4235 |
+ |
4236 |
+ scmi_pd_data->domains = domains; |
4237 |
+diff --git a/drivers/firmware/qcom_scm.c b/drivers/firmware/qcom_scm.c |
4238 |
+index 4701487573f7..7d9596552366 100644 |
4239 |
+--- a/drivers/firmware/qcom_scm.c |
4240 |
++++ b/drivers/firmware/qcom_scm.c |
4241 |
+@@ -391,7 +391,7 @@ static int __qcom_scm_set_dload_mode(struct device *dev, bool enable) |
4242 |
+ |
4243 |
+ desc.args[1] = enable ? QCOM_SCM_BOOT_SET_DLOAD_MODE : 0; |
4244 |
+ |
4245 |
+- return qcom_scm_call(__scm->dev, &desc, NULL); |
4246 |
++ return qcom_scm_call_atomic(__scm->dev, &desc, NULL); |
4247 |
+ } |
4248 |
+ |
4249 |
+ static void qcom_scm_set_download_mode(bool enable) |
4250 |
+@@ -650,7 +650,7 @@ int qcom_scm_io_readl(phys_addr_t addr, unsigned int *val) |
4251 |
+ int ret; |
4252 |
+ |
4253 |
+ |
4254 |
+- ret = qcom_scm_call(__scm->dev, &desc, &res); |
4255 |
++ ret = qcom_scm_call_atomic(__scm->dev, &desc, &res); |
4256 |
+ if (ret >= 0) |
4257 |
+ *val = res.result[0]; |
4258 |
+ |
4259 |
+@@ -669,8 +669,7 @@ int qcom_scm_io_writel(phys_addr_t addr, unsigned int val) |
4260 |
+ .owner = ARM_SMCCC_OWNER_SIP, |
4261 |
+ }; |
4262 |
+ |
4263 |
+- |
4264 |
+- return qcom_scm_call(__scm->dev, &desc, NULL); |
4265 |
++ return qcom_scm_call_atomic(__scm->dev, &desc, NULL); |
4266 |
+ } |
4267 |
+ EXPORT_SYMBOL(qcom_scm_io_writel); |
4268 |
+ |
4269 |
+diff --git a/drivers/gpio/gpiolib-devres.c b/drivers/gpio/gpiolib-devres.c |
4270 |
+index 5c91c4365da1..7dbce4c4ebdf 100644 |
4271 |
+--- a/drivers/gpio/gpiolib-devres.c |
4272 |
++++ b/drivers/gpio/gpiolib-devres.c |
4273 |
+@@ -487,10 +487,12 @@ static void devm_gpio_chip_release(struct device *dev, void *res) |
4274 |
+ } |
4275 |
+ |
4276 |
+ /** |
4277 |
+- * devm_gpiochip_add_data() - Resource managed gpiochip_add_data() |
4278 |
++ * devm_gpiochip_add_data_with_key() - Resource managed gpiochip_add_data_with_key() |
4279 |
+ * @dev: pointer to the device that gpio_chip belongs to. |
4280 |
+ * @gc: the GPIO chip to register |
4281 |
+ * @data: driver-private data associated with this chip |
4282 |
++ * @lock_key: lockdep class for IRQ lock |
4283 |
++ * @request_key: lockdep class for IRQ request |
4284 |
+ * |
4285 |
+ * Context: potentially before irqs will work |
4286 |
+ * |
4287 |
+@@ -501,8 +503,9 @@ static void devm_gpio_chip_release(struct device *dev, void *res) |
4288 |
+ * gc->base is invalid or already associated with a different chip. |
4289 |
+ * Otherwise it returns zero as a success code. |
4290 |
+ */ |
4291 |
+-int devm_gpiochip_add_data(struct device *dev, struct gpio_chip *gc, |
4292 |
+- void *data) |
4293 |
++int devm_gpiochip_add_data_with_key(struct device *dev, struct gpio_chip *gc, void *data, |
4294 |
++ struct lock_class_key *lock_key, |
4295 |
++ struct lock_class_key *request_key) |
4296 |
+ { |
4297 |
+ struct gpio_chip **ptr; |
4298 |
+ int ret; |
4299 |
+@@ -512,7 +515,7 @@ int devm_gpiochip_add_data(struct device *dev, struct gpio_chip *gc, |
4300 |
+ if (!ptr) |
4301 |
+ return -ENOMEM; |
4302 |
+ |
4303 |
+- ret = gpiochip_add_data(gc, data); |
4304 |
++ ret = gpiochip_add_data_with_key(gc, data, lock_key, request_key); |
4305 |
+ if (ret < 0) { |
4306 |
+ devres_free(ptr); |
4307 |
+ return ret; |
4308 |
+@@ -523,4 +526,4 @@ int devm_gpiochip_add_data(struct device *dev, struct gpio_chip *gc, |
4309 |
+ |
4310 |
+ return 0; |
4311 |
+ } |
4312 |
+-EXPORT_SYMBOL_GPL(devm_gpiochip_add_data); |
4313 |
++EXPORT_SYMBOL_GPL(devm_gpiochip_add_data_with_key); |
4314 |
+diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c |
4315 |
+index ffeb20f11c07..728f76cc536e 100644 |
4316 |
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c |
4317 |
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c |
4318 |
+@@ -552,7 +552,7 @@ struct drm_gem_object *amdgpu_gem_prime_import(struct drm_device *dev, |
4319 |
+ attach = dma_buf_dynamic_attach(dma_buf, dev->dev, |
4320 |
+ &amdgpu_dma_buf_attach_ops, obj); |
4321 |
+ if (IS_ERR(attach)) { |
4322 |
+- drm_gem_object_put(obj); |
4323 |
++ drm_gem_object_put_unlocked(obj); |
4324 |
+ return ERR_CAST(attach); |
4325 |
+ } |
4326 |
+ |
4327 |
+diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c |
4328 |
+index 7531527067df..892c1e9a1eb0 100644 |
4329 |
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c |
4330 |
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c |
4331 |
+@@ -408,7 +408,9 @@ int amdgpu_fence_driver_start_ring(struct amdgpu_ring *ring, |
4332 |
+ ring->fence_drv.gpu_addr = adev->uvd.inst[ring->me].gpu_addr + index; |
4333 |
+ } |
4334 |
+ amdgpu_fence_write(ring, atomic_read(&ring->fence_drv.last_seq)); |
4335 |
+- amdgpu_irq_get(adev, irq_src, irq_type); |
4336 |
++ |
4337 |
++ if (irq_src) |
4338 |
++ amdgpu_irq_get(adev, irq_src, irq_type); |
4339 |
+ |
4340 |
+ ring->fence_drv.irq_src = irq_src; |
4341 |
+ ring->fence_drv.irq_type = irq_type; |
4342 |
+@@ -529,8 +531,9 @@ void amdgpu_fence_driver_fini(struct amdgpu_device *adev) |
4343 |
+ /* no need to trigger GPU reset as we are unloading */ |
4344 |
+ amdgpu_fence_driver_force_completion(ring); |
4345 |
+ } |
4346 |
+- amdgpu_irq_put(adev, ring->fence_drv.irq_src, |
4347 |
+- ring->fence_drv.irq_type); |
4348 |
++ if (ring->fence_drv.irq_src) |
4349 |
++ amdgpu_irq_put(adev, ring->fence_drv.irq_src, |
4350 |
++ ring->fence_drv.irq_type); |
4351 |
+ drm_sched_fini(&ring->sched); |
4352 |
+ del_timer_sync(&ring->fence_drv.fallback_timer); |
4353 |
+ for (j = 0; j <= ring->fence_drv.num_fences_mask; ++j) |
4354 |
+@@ -566,8 +569,9 @@ void amdgpu_fence_driver_suspend(struct amdgpu_device *adev) |
4355 |
+ } |
4356 |
+ |
4357 |
+ /* disable the interrupt */ |
4358 |
+- amdgpu_irq_put(adev, ring->fence_drv.irq_src, |
4359 |
+- ring->fence_drv.irq_type); |
4360 |
++ if (ring->fence_drv.irq_src) |
4361 |
++ amdgpu_irq_put(adev, ring->fence_drv.irq_src, |
4362 |
++ ring->fence_drv.irq_type); |
4363 |
+ } |
4364 |
+ } |
4365 |
+ |
4366 |
+@@ -593,8 +597,9 @@ void amdgpu_fence_driver_resume(struct amdgpu_device *adev) |
4367 |
+ continue; |
4368 |
+ |
4369 |
+ /* enable the interrupt */ |
4370 |
+- amdgpu_irq_get(adev, ring->fence_drv.irq_src, |
4371 |
+- ring->fence_drv.irq_type); |
4372 |
++ if (ring->fence_drv.irq_src) |
4373 |
++ amdgpu_irq_get(adev, ring->fence_drv.irq_src, |
4374 |
++ ring->fence_drv.irq_type); |
4375 |
+ } |
4376 |
+ } |
4377 |
+ |
4378 |
+diff --git a/drivers/gpu/drm/amd/amdgpu/jpeg_v2_5.c b/drivers/gpu/drm/amd/amdgpu/jpeg_v2_5.c |
4379 |
+index c04c2078a7c1..a7fcb55babb8 100644 |
4380 |
+--- a/drivers/gpu/drm/amd/amdgpu/jpeg_v2_5.c |
4381 |
++++ b/drivers/gpu/drm/amd/amdgpu/jpeg_v2_5.c |
4382 |
+@@ -462,7 +462,7 @@ static int jpeg_v2_5_wait_for_idle(void *handle) |
4383 |
+ return ret; |
4384 |
+ } |
4385 |
+ |
4386 |
+- return ret; |
4387 |
++ return 0; |
4388 |
+ } |
4389 |
+ |
4390 |
+ static int jpeg_v2_5_set_clockgating_state(void *handle, |
4391 |
+diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_pp_smu.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_pp_smu.c |
4392 |
+index a2e1a73f66b8..5c6a6ae48d39 100644 |
4393 |
+--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_pp_smu.c |
4394 |
++++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_pp_smu.c |
4395 |
+@@ -106,7 +106,7 @@ bool dm_pp_apply_display_requirements( |
4396 |
+ adev->powerplay.pp_funcs->display_configuration_change( |
4397 |
+ adev->powerplay.pp_handle, |
4398 |
+ &adev->pm.pm_display_cfg); |
4399 |
+- else |
4400 |
++ else if (adev->smu.ppt_funcs) |
4401 |
+ smu_display_configuration_change(smu, |
4402 |
+ &adev->pm.pm_display_cfg); |
4403 |
+ |
4404 |
+@@ -530,6 +530,8 @@ bool dm_pp_get_static_clocks( |
4405 |
+ &pp_clk_info); |
4406 |
+ else if (adev->smu.ppt_funcs) |
4407 |
+ ret = smu_get_current_clocks(&adev->smu, &pp_clk_info); |
4408 |
++ else |
4409 |
++ return false; |
4410 |
+ if (ret) |
4411 |
+ return false; |
4412 |
+ |
4413 |
+@@ -590,7 +592,7 @@ void pp_rv_set_wm_ranges(struct pp_smu *pp, |
4414 |
+ if (pp_funcs && pp_funcs->set_watermarks_for_clocks_ranges) |
4415 |
+ pp_funcs->set_watermarks_for_clocks_ranges(pp_handle, |
4416 |
+ &wm_with_clock_ranges); |
4417 |
+- else |
4418 |
++ else if (adev->smu.ppt_funcs) |
4419 |
+ smu_set_watermarks_for_clock_ranges(&adev->smu, |
4420 |
+ &wm_with_clock_ranges); |
4421 |
+ } |
4422 |
+diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link.c b/drivers/gpu/drm/amd/display/dc/core/dc_link.c |
4423 |
+index 67cfff1586e9..3f157bcc174b 100644 |
4424 |
+--- a/drivers/gpu/drm/amd/display/dc/core/dc_link.c |
4425 |
++++ b/drivers/gpu/drm/amd/display/dc/core/dc_link.c |
4426 |
+@@ -3146,9 +3146,11 @@ void core_link_disable_stream(struct pipe_ctx *pipe_ctx) |
4427 |
+ write_i2c_redriver_setting(pipe_ctx, false); |
4428 |
+ } |
4429 |
+ } |
4430 |
+- dc->hwss.disable_stream(pipe_ctx); |
4431 |
+ |
4432 |
+ disable_link(pipe_ctx->stream->link, pipe_ctx->stream->signal); |
4433 |
++ |
4434 |
++ dc->hwss.disable_stream(pipe_ctx); |
4435 |
++ |
4436 |
+ if (pipe_ctx->stream->timing.flags.DSC) { |
4437 |
+ if (dc_is_dp_signal(pipe_ctx->stream->signal)) |
4438 |
+ dp_set_dsc_enable(pipe_ctx, false); |
4439 |
+diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c b/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c |
4440 |
+index caa090d0b6ac..1ada01322cd2 100644 |
4441 |
+--- a/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c |
4442 |
++++ b/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c |
4443 |
+@@ -1103,6 +1103,10 @@ static inline enum link_training_result perform_link_training_int( |
4444 |
+ dpcd_pattern.v1_4.TRAINING_PATTERN_SET = DPCD_TRAINING_PATTERN_VIDEOIDLE; |
4445 |
+ dpcd_set_training_pattern(link, dpcd_pattern); |
4446 |
+ |
4447 |
++ /* delay 5ms after notifying sink of idle pattern before switching output */ |
4448 |
++ if (link->connector_signal != SIGNAL_TYPE_EDP) |
4449 |
++ msleep(5); |
4450 |
++ |
4451 |
+ /* 4. mainlink output idle pattern*/ |
4452 |
+ dp_set_hw_test_pattern(link, DP_TEST_PATTERN_VIDEO_MODE, NULL, 0); |
4453 |
+ |
4454 |
+@@ -1552,6 +1556,12 @@ bool perform_link_training_with_retries( |
4455 |
+ struct dc_link *link = stream->link; |
4456 |
+ enum dp_panel_mode panel_mode = dp_get_panel_mode(link); |
4457 |
+ |
4458 |
++ /* We need to do this before the link training to ensure the idle pattern in SST |
4459 |
++ * mode will be sent right after the link training |
4460 |
++ */ |
4461 |
++ link->link_enc->funcs->connect_dig_be_to_fe(link->link_enc, |
4462 |
++ pipe_ctx->stream_res.stream_enc->id, true); |
4463 |
++ |
4464 |
+ for (j = 0; j < attempts; ++j) { |
4465 |
+ |
4466 |
+ dp_enable_link_phy( |
4467 |
+@@ -1568,12 +1578,6 @@ bool perform_link_training_with_retries( |
4468 |
+ |
4469 |
+ dp_set_panel_mode(link, panel_mode); |
4470 |
+ |
4471 |
+- /* We need to do this before the link training to ensure the idle pattern in SST |
4472 |
+- * mode will be sent right after the link training |
4473 |
+- */ |
4474 |
+- link->link_enc->funcs->connect_dig_be_to_fe(link->link_enc, |
4475 |
+- pipe_ctx->stream_res.stream_enc->id, true); |
4476 |
+- |
4477 |
+ if (link->aux_access_disabled) { |
4478 |
+ dc_link_dp_perform_link_training_skip_aux(link, link_setting); |
4479 |
+ return true; |
4480 |
+diff --git a/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c b/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c |
4481 |
+index 10527593868c..24ca592c90df 100644 |
4482 |
+--- a/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c |
4483 |
++++ b/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c |
4484 |
+@@ -1090,8 +1090,17 @@ void dce110_blank_stream(struct pipe_ctx *pipe_ctx) |
4485 |
+ dc_link_set_abm_disable(link); |
4486 |
+ } |
4487 |
+ |
4488 |
+- if (dc_is_dp_signal(pipe_ctx->stream->signal)) |
4489 |
++ if (dc_is_dp_signal(pipe_ctx->stream->signal)) { |
4490 |
+ pipe_ctx->stream_res.stream_enc->funcs->dp_blank(pipe_ctx->stream_res.stream_enc); |
4491 |
++ |
4492 |
++ /* |
4493 |
++ * After output is idle pattern some sinks need time to recognize the stream |
4494 |
++ * has changed or they enter protection state and hang. |
4495 |
++ */ |
4496 |
++ if (!dc_is_embedded_signal(pipe_ctx->stream->signal)) |
4497 |
++ msleep(60); |
4498 |
++ } |
4499 |
++ |
4500 |
+ } |
4501 |
+ |
4502 |
+ |
4503 |
+diff --git a/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c b/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c |
4504 |
+index 1ef0923f7190..9ad0e6f18be4 100644 |
4505 |
+--- a/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c |
4506 |
++++ b/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c |
4507 |
+@@ -2035,8 +2035,6 @@ static void arcturus_fill_eeprom_i2c_req(SwI2cRequest_t *req, bool write, |
4508 |
+ { |
4509 |
+ int i; |
4510 |
+ |
4511 |
+- BUG_ON(numbytes > MAX_SW_I2C_COMMANDS); |
4512 |
+- |
4513 |
+ req->I2CcontrollerPort = 0; |
4514 |
+ req->I2CSpeed = 2; |
4515 |
+ req->SlaveAddress = address; |
4516 |
+@@ -2074,6 +2072,12 @@ static int arcturus_i2c_eeprom_read_data(struct i2c_adapter *control, |
4517 |
+ struct smu_table_context *smu_table = &adev->smu.smu_table; |
4518 |
+ struct smu_table *table = &smu_table->driver_table; |
4519 |
+ |
4520 |
++ if (numbytes > MAX_SW_I2C_COMMANDS) { |
4521 |
++ dev_err(adev->dev, "numbytes requested %d is over max allowed %d\n", |
4522 |
++ numbytes, MAX_SW_I2C_COMMANDS); |
4523 |
++ return -EINVAL; |
4524 |
++ } |
4525 |
++ |
4526 |
+ memset(&req, 0, sizeof(req)); |
4527 |
+ arcturus_fill_eeprom_i2c_req(&req, false, address, numbytes, data); |
4528 |
+ |
4529 |
+@@ -2110,6 +2114,12 @@ static int arcturus_i2c_eeprom_write_data(struct i2c_adapter *control, |
4530 |
+ SwI2cRequest_t req; |
4531 |
+ struct amdgpu_device *adev = to_amdgpu_device(control); |
4532 |
+ |
4533 |
++ if (numbytes > MAX_SW_I2C_COMMANDS) { |
4534 |
++ dev_err(adev->dev, "numbytes requested %d is over max allowed %d\n", |
4535 |
++ numbytes, MAX_SW_I2C_COMMANDS); |
4536 |
++ return -EINVAL; |
4537 |
++ } |
4538 |
++ |
4539 |
+ memset(&req, 0, sizeof(req)); |
4540 |
+ arcturus_fill_eeprom_i2c_req(&req, true, address, numbytes, data); |
4541 |
+ |
4542 |
+diff --git a/drivers/gpu/drm/amd/powerplay/smu_v11_0.c b/drivers/gpu/drm/amd/powerplay/smu_v11_0.c |
4543 |
+index 655ba4fb05dc..48af305d42d5 100644 |
4544 |
+--- a/drivers/gpu/drm/amd/powerplay/smu_v11_0.c |
4545 |
++++ b/drivers/gpu/drm/amd/powerplay/smu_v11_0.c |
4546 |
+@@ -159,7 +159,8 @@ int smu_v11_0_init_microcode(struct smu_context *smu) |
4547 |
+ chip_name = "navi12"; |
4548 |
+ break; |
4549 |
+ default: |
4550 |
+- BUG(); |
4551 |
++ dev_err(adev->dev, "Unsupported ASIC type %d\n", adev->asic_type); |
4552 |
++ return -EINVAL; |
4553 |
+ } |
4554 |
+ |
4555 |
+ snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_smc.bin", chip_name); |
4556 |
+diff --git a/drivers/gpu/drm/arm/malidp_planes.c b/drivers/gpu/drm/arm/malidp_planes.c |
4557 |
+index 37715cc6064e..ab45ac445045 100644 |
4558 |
+--- a/drivers/gpu/drm/arm/malidp_planes.c |
4559 |
++++ b/drivers/gpu/drm/arm/malidp_planes.c |
4560 |
+@@ -928,7 +928,7 @@ int malidp_de_planes_init(struct drm_device *drm) |
4561 |
+ const struct malidp_hw_regmap *map = &malidp->dev->hw->map; |
4562 |
+ struct malidp_plane *plane = NULL; |
4563 |
+ enum drm_plane_type plane_type; |
4564 |
+- unsigned long crtcs = 1 << drm->mode_config.num_crtc; |
4565 |
++ unsigned long crtcs = BIT(drm->mode_config.num_crtc); |
4566 |
+ unsigned long flags = DRM_MODE_ROTATE_0 | DRM_MODE_ROTATE_90 | DRM_MODE_ROTATE_180 | |
4567 |
+ DRM_MODE_ROTATE_270 | DRM_MODE_REFLECT_X | DRM_MODE_REFLECT_Y; |
4568 |
+ unsigned int blend_caps = BIT(DRM_MODE_BLEND_PIXEL_NONE) | |
4569 |
+diff --git a/drivers/gpu/drm/bridge/sil-sii8620.c b/drivers/gpu/drm/bridge/sil-sii8620.c |
4570 |
+index 92acd336aa89..ca98133411aa 100644 |
4571 |
+--- a/drivers/gpu/drm/bridge/sil-sii8620.c |
4572 |
++++ b/drivers/gpu/drm/bridge/sil-sii8620.c |
4573 |
+@@ -178,7 +178,7 @@ static void sii8620_read_buf(struct sii8620 *ctx, u16 addr, u8 *buf, int len) |
4574 |
+ |
4575 |
+ static u8 sii8620_readb(struct sii8620 *ctx, u16 addr) |
4576 |
+ { |
4577 |
+- u8 ret; |
4578 |
++ u8 ret = 0; |
4579 |
+ |
4580 |
+ sii8620_read_buf(ctx, addr, &ret, 1); |
4581 |
+ return ret; |
4582 |
+diff --git a/drivers/gpu/drm/bridge/ti-sn65dsi86.c b/drivers/gpu/drm/bridge/ti-sn65dsi86.c |
4583 |
+index 6ad688b320ae..8a0e34f2160a 100644 |
4584 |
+--- a/drivers/gpu/drm/bridge/ti-sn65dsi86.c |
4585 |
++++ b/drivers/gpu/drm/bridge/ti-sn65dsi86.c |
4586 |
+@@ -475,7 +475,7 @@ static int ti_sn_bridge_calc_min_dp_rate_idx(struct ti_sn_bridge *pdata) |
4587 |
+ 1000 * pdata->dp_lanes * DP_CLK_FUDGE_DEN); |
4588 |
+ |
4589 |
+ for (i = 1; i < ARRAY_SIZE(ti_sn_bridge_dp_rate_lut) - 1; i++) |
4590 |
+- if (ti_sn_bridge_dp_rate_lut[i] > dp_rate_mhz) |
4591 |
++ if (ti_sn_bridge_dp_rate_lut[i] >= dp_rate_mhz) |
4592 |
+ break; |
4593 |
+ |
4594 |
+ return i; |
4595 |
+@@ -827,6 +827,12 @@ static ssize_t ti_sn_aux_transfer(struct drm_dp_aux *aux, |
4596 |
+ buf[i]); |
4597 |
+ } |
4598 |
+ |
4599 |
++ /* Clear old status bits before start so we don't get confused */ |
4600 |
++ regmap_write(pdata->regmap, SN_AUX_CMD_STATUS_REG, |
4601 |
++ AUX_IRQ_STATUS_NAT_I2C_FAIL | |
4602 |
++ AUX_IRQ_STATUS_AUX_RPLY_TOUT | |
4603 |
++ AUX_IRQ_STATUS_AUX_SHORT); |
4604 |
++ |
4605 |
+ regmap_write(pdata->regmap, SN_AUX_CMD_REG, request_val | AUX_CMD_SEND); |
4606 |
+ |
4607 |
+ ret = regmap_read_poll_timeout(pdata->regmap, SN_AUX_CMD_REG, val, |
4608 |
+diff --git a/drivers/gpu/drm/drm_debugfs.c b/drivers/gpu/drm/drm_debugfs.c |
4609 |
+index 4e673d318503..fb251c00fdd3 100644 |
4610 |
+--- a/drivers/gpu/drm/drm_debugfs.c |
4611 |
++++ b/drivers/gpu/drm/drm_debugfs.c |
4612 |
+@@ -336,13 +336,13 @@ static ssize_t connector_write(struct file *file, const char __user *ubuf, |
4613 |
+ |
4614 |
+ buf[len] = '\0'; |
4615 |
+ |
4616 |
+- if (!strcmp(buf, "on")) |
4617 |
++ if (sysfs_streq(buf, "on")) |
4618 |
+ connector->force = DRM_FORCE_ON; |
4619 |
+- else if (!strcmp(buf, "digital")) |
4620 |
++ else if (sysfs_streq(buf, "digital")) |
4621 |
+ connector->force = DRM_FORCE_ON_DIGITAL; |
4622 |
+- else if (!strcmp(buf, "off")) |
4623 |
++ else if (sysfs_streq(buf, "off")) |
4624 |
+ connector->force = DRM_FORCE_OFF; |
4625 |
+- else if (!strcmp(buf, "unspecified")) |
4626 |
++ else if (sysfs_streq(buf, "unspecified")) |
4627 |
+ connector->force = DRM_FORCE_UNSPECIFIED; |
4628 |
+ else |
4629 |
+ return -EINVAL; |
4630 |
+diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c |
4631 |
+index 3087aa710e8d..d847540e4f8c 100644 |
4632 |
+--- a/drivers/gpu/drm/drm_gem.c |
4633 |
++++ b/drivers/gpu/drm/drm_gem.c |
4634 |
+@@ -710,6 +710,8 @@ int drm_gem_objects_lookup(struct drm_file *filp, void __user *bo_handles, |
4635 |
+ if (!objs) |
4636 |
+ return -ENOMEM; |
4637 |
+ |
4638 |
++ *objs_out = objs; |
4639 |
++ |
4640 |
+ handles = kvmalloc_array(count, sizeof(u32), GFP_KERNEL); |
4641 |
+ if (!handles) { |
4642 |
+ ret = -ENOMEM; |
4643 |
+@@ -723,8 +725,6 @@ int drm_gem_objects_lookup(struct drm_file *filp, void __user *bo_handles, |
4644 |
+ } |
4645 |
+ |
4646 |
+ ret = objects_lookup(filp, handles, count, objs); |
4647 |
+- *objs_out = objs; |
4648 |
+- |
4649 |
+ out: |
4650 |
+ kvfree(handles); |
4651 |
+ return ret; |
4652 |
+diff --git a/drivers/gpu/drm/drm_mipi_dsi.c b/drivers/gpu/drm/drm_mipi_dsi.c |
4653 |
+index 55531895dde6..37b03fefbdf6 100644 |
4654 |
+--- a/drivers/gpu/drm/drm_mipi_dsi.c |
4655 |
++++ b/drivers/gpu/drm/drm_mipi_dsi.c |
4656 |
+@@ -1082,11 +1082,11 @@ EXPORT_SYMBOL(mipi_dsi_dcs_set_pixel_format); |
4657 |
+ */ |
4658 |
+ int mipi_dsi_dcs_set_tear_scanline(struct mipi_dsi_device *dsi, u16 scanline) |
4659 |
+ { |
4660 |
+- u8 payload[3] = { MIPI_DCS_SET_TEAR_SCANLINE, scanline >> 8, |
4661 |
+- scanline & 0xff }; |
4662 |
++ u8 payload[2] = { scanline >> 8, scanline & 0xff }; |
4663 |
+ ssize_t err; |
4664 |
+ |
4665 |
+- err = mipi_dsi_generic_write(dsi, payload, sizeof(payload)); |
4666 |
++ err = mipi_dsi_dcs_write(dsi, MIPI_DCS_SET_TEAR_SCANLINE, payload, |
4667 |
++ sizeof(payload)); |
4668 |
+ if (err < 0) |
4669 |
+ return err; |
4670 |
+ |
4671 |
+diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c |
4672 |
+index a31eeff2b297..4a512b062df8 100644 |
4673 |
+--- a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c |
4674 |
++++ b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c |
4675 |
+@@ -722,7 +722,7 @@ int etnaviv_gpu_init(struct etnaviv_gpu *gpu) |
4676 |
+ ret = pm_runtime_get_sync(gpu->dev); |
4677 |
+ if (ret < 0) { |
4678 |
+ dev_err(gpu->dev, "Failed to enable GPU power domain\n"); |
4679 |
+- return ret; |
4680 |
++ goto pm_put; |
4681 |
+ } |
4682 |
+ |
4683 |
+ etnaviv_hw_identify(gpu); |
4684 |
+@@ -819,6 +819,7 @@ int etnaviv_gpu_init(struct etnaviv_gpu *gpu) |
4685 |
+ |
4686 |
+ fail: |
4687 |
+ pm_runtime_mark_last_busy(gpu->dev); |
4688 |
++pm_put: |
4689 |
+ pm_runtime_put_autosuspend(gpu->dev); |
4690 |
+ |
4691 |
+ return ret; |
4692 |
+@@ -859,7 +860,7 @@ int etnaviv_gpu_debugfs(struct etnaviv_gpu *gpu, struct seq_file *m) |
4693 |
+ |
4694 |
+ ret = pm_runtime_get_sync(gpu->dev); |
4695 |
+ if (ret < 0) |
4696 |
+- return ret; |
4697 |
++ goto pm_put; |
4698 |
+ |
4699 |
+ dma_lo = gpu_read(gpu, VIVS_FE_DMA_LOW); |
4700 |
+ dma_hi = gpu_read(gpu, VIVS_FE_DMA_HIGH); |
4701 |
+@@ -1003,6 +1004,7 @@ int etnaviv_gpu_debugfs(struct etnaviv_gpu *gpu, struct seq_file *m) |
4702 |
+ ret = 0; |
4703 |
+ |
4704 |
+ pm_runtime_mark_last_busy(gpu->dev); |
4705 |
++pm_put: |
4706 |
+ pm_runtime_put_autosuspend(gpu->dev); |
4707 |
+ |
4708 |
+ return ret; |
4709 |
+@@ -1016,7 +1018,7 @@ void etnaviv_gpu_recover_hang(struct etnaviv_gpu *gpu) |
4710 |
+ dev_err(gpu->dev, "recover hung GPU!\n"); |
4711 |
+ |
4712 |
+ if (pm_runtime_get_sync(gpu->dev) < 0) |
4713 |
+- return; |
4714 |
++ goto pm_put; |
4715 |
+ |
4716 |
+ mutex_lock(&gpu->lock); |
4717 |
+ |
4718 |
+@@ -1035,6 +1037,7 @@ void etnaviv_gpu_recover_hang(struct etnaviv_gpu *gpu) |
4719 |
+ |
4720 |
+ mutex_unlock(&gpu->lock); |
4721 |
+ pm_runtime_mark_last_busy(gpu->dev); |
4722 |
++pm_put: |
4723 |
+ pm_runtime_put_autosuspend(gpu->dev); |
4724 |
+ } |
4725 |
+ |
4726 |
+@@ -1308,8 +1311,10 @@ struct dma_fence *etnaviv_gpu_submit(struct etnaviv_gem_submit *submit) |
4727 |
+ |
4728 |
+ if (!submit->runtime_resumed) { |
4729 |
+ ret = pm_runtime_get_sync(gpu->dev); |
4730 |
+- if (ret < 0) |
4731 |
++ if (ret < 0) { |
4732 |
++ pm_runtime_put_noidle(gpu->dev); |
4733 |
+ return NULL; |
4734 |
++ } |
4735 |
+ submit->runtime_resumed = true; |
4736 |
+ } |
4737 |
+ |
4738 |
+@@ -1326,6 +1331,7 @@ struct dma_fence *etnaviv_gpu_submit(struct etnaviv_gem_submit *submit) |
4739 |
+ ret = event_alloc(gpu, nr_events, event); |
4740 |
+ if (ret) { |
4741 |
+ DRM_ERROR("no free events\n"); |
4742 |
++ pm_runtime_put_noidle(gpu->dev); |
4743 |
+ return NULL; |
4744 |
+ } |
4745 |
+ |
4746 |
+@@ -1496,7 +1502,7 @@ static int etnaviv_gpu_clk_enable(struct etnaviv_gpu *gpu) |
4747 |
+ if (gpu->clk_bus) { |
4748 |
+ ret = clk_prepare_enable(gpu->clk_bus); |
4749 |
+ if (ret) |
4750 |
+- return ret; |
4751 |
++ goto disable_clk_reg; |
4752 |
+ } |
4753 |
+ |
4754 |
+ if (gpu->clk_core) { |
4755 |
+@@ -1519,6 +1525,9 @@ disable_clk_core: |
4756 |
+ disable_clk_bus: |
4757 |
+ if (gpu->clk_bus) |
4758 |
+ clk_disable_unprepare(gpu->clk_bus); |
4759 |
++disable_clk_reg: |
4760 |
++ if (gpu->clk_reg) |
4761 |
++ clk_disable_unprepare(gpu->clk_reg); |
4762 |
+ |
4763 |
+ return ret; |
4764 |
+ } |
4765 |
+diff --git a/drivers/gpu/drm/imx/dw_hdmi-imx.c b/drivers/gpu/drm/imx/dw_hdmi-imx.c |
4766 |
+index f22cfbf9353e..2e12a4a3bfa1 100644 |
4767 |
+--- a/drivers/gpu/drm/imx/dw_hdmi-imx.c |
4768 |
++++ b/drivers/gpu/drm/imx/dw_hdmi-imx.c |
4769 |
+@@ -212,9 +212,8 @@ static int dw_hdmi_imx_bind(struct device *dev, struct device *master, |
4770 |
+ if (!pdev->dev.of_node) |
4771 |
+ return -ENODEV; |
4772 |
+ |
4773 |
+- hdmi = devm_kzalloc(&pdev->dev, sizeof(*hdmi), GFP_KERNEL); |
4774 |
+- if (!hdmi) |
4775 |
+- return -ENOMEM; |
4776 |
++ hdmi = dev_get_drvdata(dev); |
4777 |
++ memset(hdmi, 0, sizeof(*hdmi)); |
4778 |
+ |
4779 |
+ match = of_match_node(dw_hdmi_imx_dt_ids, pdev->dev.of_node); |
4780 |
+ plat_data = match->data; |
4781 |
+@@ -239,8 +238,6 @@ static int dw_hdmi_imx_bind(struct device *dev, struct device *master, |
4782 |
+ drm_encoder_init(drm, encoder, &dw_hdmi_imx_encoder_funcs, |
4783 |
+ DRM_MODE_ENCODER_TMDS, NULL); |
4784 |
+ |
4785 |
+- platform_set_drvdata(pdev, hdmi); |
4786 |
+- |
4787 |
+ hdmi->hdmi = dw_hdmi_bind(pdev, encoder, plat_data); |
4788 |
+ |
4789 |
+ /* |
4790 |
+@@ -270,6 +267,14 @@ static const struct component_ops dw_hdmi_imx_ops = { |
4791 |
+ |
4792 |
+ static int dw_hdmi_imx_probe(struct platform_device *pdev) |
4793 |
+ { |
4794 |
++ struct imx_hdmi *hdmi; |
4795 |
++ |
4796 |
++ hdmi = devm_kzalloc(&pdev->dev, sizeof(*hdmi), GFP_KERNEL); |
4797 |
++ if (!hdmi) |
4798 |
++ return -ENOMEM; |
4799 |
++ |
4800 |
++ platform_set_drvdata(pdev, hdmi); |
4801 |
++ |
4802 |
+ return component_add(&pdev->dev, &dw_hdmi_imx_ops); |
4803 |
+ } |
4804 |
+ |
4805 |
+diff --git a/drivers/gpu/drm/imx/imx-drm-core.c b/drivers/gpu/drm/imx/imx-drm-core.c |
4806 |
+index da87c70e413b..881c36d0f16b 100644 |
4807 |
+--- a/drivers/gpu/drm/imx/imx-drm-core.c |
4808 |
++++ b/drivers/gpu/drm/imx/imx-drm-core.c |
4809 |
+@@ -281,9 +281,10 @@ static void imx_drm_unbind(struct device *dev) |
4810 |
+ |
4811 |
+ drm_kms_helper_poll_fini(drm); |
4812 |
+ |
4813 |
++ component_unbind_all(drm->dev, drm); |
4814 |
++ |
4815 |
+ drm_mode_config_cleanup(drm); |
4816 |
+ |
4817 |
+- component_unbind_all(drm->dev, drm); |
4818 |
+ dev_set_drvdata(dev, NULL); |
4819 |
+ |
4820 |
+ drm_dev_put(drm); |
4821 |
+diff --git a/drivers/gpu/drm/imx/imx-ldb.c b/drivers/gpu/drm/imx/imx-ldb.c |
4822 |
+index 4da22a94790c..8e209117b049 100644 |
4823 |
+--- a/drivers/gpu/drm/imx/imx-ldb.c |
4824 |
++++ b/drivers/gpu/drm/imx/imx-ldb.c |
4825 |
+@@ -594,9 +594,8 @@ static int imx_ldb_bind(struct device *dev, struct device *master, void *data) |
4826 |
+ int ret; |
4827 |
+ int i; |
4828 |
+ |
4829 |
+- imx_ldb = devm_kzalloc(dev, sizeof(*imx_ldb), GFP_KERNEL); |
4830 |
+- if (!imx_ldb) |
4831 |
+- return -ENOMEM; |
4832 |
++ imx_ldb = dev_get_drvdata(dev); |
4833 |
++ memset(imx_ldb, 0, sizeof(*imx_ldb)); |
4834 |
+ |
4835 |
+ imx_ldb->regmap = syscon_regmap_lookup_by_phandle(np, "gpr"); |
4836 |
+ if (IS_ERR(imx_ldb->regmap)) { |
4837 |
+@@ -704,8 +703,6 @@ static int imx_ldb_bind(struct device *dev, struct device *master, void *data) |
4838 |
+ } |
4839 |
+ } |
4840 |
+ |
4841 |
+- dev_set_drvdata(dev, imx_ldb); |
4842 |
+- |
4843 |
+ return 0; |
4844 |
+ |
4845 |
+ free_child: |
4846 |
+@@ -737,6 +734,14 @@ static const struct component_ops imx_ldb_ops = { |
4847 |
+ |
4848 |
+ static int imx_ldb_probe(struct platform_device *pdev) |
4849 |
+ { |
4850 |
++ struct imx_ldb *imx_ldb; |
4851 |
++ |
4852 |
++ imx_ldb = devm_kzalloc(&pdev->dev, sizeof(*imx_ldb), GFP_KERNEL); |
4853 |
++ if (!imx_ldb) |
4854 |
++ return -ENOMEM; |
4855 |
++ |
4856 |
++ platform_set_drvdata(pdev, imx_ldb); |
4857 |
++ |
4858 |
+ return component_add(&pdev->dev, &imx_ldb_ops); |
4859 |
+ } |
4860 |
+ |
4861 |
+diff --git a/drivers/gpu/drm/imx/imx-tve.c b/drivers/gpu/drm/imx/imx-tve.c |
4862 |
+index 5bbfaa2cd0f4..f91c3eb7697b 100644 |
4863 |
+--- a/drivers/gpu/drm/imx/imx-tve.c |
4864 |
++++ b/drivers/gpu/drm/imx/imx-tve.c |
4865 |
+@@ -494,6 +494,13 @@ static int imx_tve_register(struct drm_device *drm, struct imx_tve *tve) |
4866 |
+ return 0; |
4867 |
+ } |
4868 |
+ |
4869 |
++static void imx_tve_disable_regulator(void *data) |
4870 |
++{ |
4871 |
++ struct imx_tve *tve = data; |
4872 |
++ |
4873 |
++ regulator_disable(tve->dac_reg); |
4874 |
++} |
4875 |
++ |
4876 |
+ static bool imx_tve_readable_reg(struct device *dev, unsigned int reg) |
4877 |
+ { |
4878 |
+ return (reg % 4 == 0) && (reg <= 0xdc); |
4879 |
+@@ -546,9 +553,8 @@ static int imx_tve_bind(struct device *dev, struct device *master, void *data) |
4880 |
+ int irq; |
4881 |
+ int ret; |
4882 |
+ |
4883 |
+- tve = devm_kzalloc(dev, sizeof(*tve), GFP_KERNEL); |
4884 |
+- if (!tve) |
4885 |
+- return -ENOMEM; |
4886 |
++ tve = dev_get_drvdata(dev); |
4887 |
++ memset(tve, 0, sizeof(*tve)); |
4888 |
+ |
4889 |
+ tve->dev = dev; |
4890 |
+ spin_lock_init(&tve->lock); |
4891 |
+@@ -618,6 +624,9 @@ static int imx_tve_bind(struct device *dev, struct device *master, void *data) |
4892 |
+ ret = regulator_enable(tve->dac_reg); |
4893 |
+ if (ret) |
4894 |
+ return ret; |
4895 |
++ ret = devm_add_action_or_reset(dev, imx_tve_disable_regulator, tve); |
4896 |
++ if (ret) |
4897 |
++ return ret; |
4898 |
+ } |
4899 |
+ |
4900 |
+ tve->clk = devm_clk_get(dev, "tve"); |
4901 |
+@@ -659,27 +668,23 @@ static int imx_tve_bind(struct device *dev, struct device *master, void *data) |
4902 |
+ if (ret) |
4903 |
+ return ret; |
4904 |
+ |
4905 |
+- dev_set_drvdata(dev, tve); |
4906 |
+- |
4907 |
+ return 0; |
4908 |
+ } |
4909 |
+ |
4910 |
+-static void imx_tve_unbind(struct device *dev, struct device *master, |
4911 |
+- void *data) |
4912 |
+-{ |
4913 |
+- struct imx_tve *tve = dev_get_drvdata(dev); |
4914 |
+- |
4915 |
+- if (!IS_ERR(tve->dac_reg)) |
4916 |
+- regulator_disable(tve->dac_reg); |
4917 |
+-} |
4918 |
+- |
4919 |
+ static const struct component_ops imx_tve_ops = { |
4920 |
+ .bind = imx_tve_bind, |
4921 |
+- .unbind = imx_tve_unbind, |
4922 |
+ }; |
4923 |
+ |
4924 |
+ static int imx_tve_probe(struct platform_device *pdev) |
4925 |
+ { |
4926 |
++ struct imx_tve *tve; |
4927 |
++ |
4928 |
++ tve = devm_kzalloc(&pdev->dev, sizeof(*tve), GFP_KERNEL); |
4929 |
++ if (!tve) |
4930 |
++ return -ENOMEM; |
4931 |
++ |
4932 |
++ platform_set_drvdata(pdev, tve); |
4933 |
++ |
4934 |
+ return component_add(&pdev->dev, &imx_tve_ops); |
4935 |
+ } |
4936 |
+ |
4937 |
+diff --git a/drivers/gpu/drm/imx/ipuv3-crtc.c b/drivers/gpu/drm/imx/ipuv3-crtc.c |
4938 |
+index 63c0284f8b3c..2256c9789fc2 100644 |
4939 |
+--- a/drivers/gpu/drm/imx/ipuv3-crtc.c |
4940 |
++++ b/drivers/gpu/drm/imx/ipuv3-crtc.c |
4941 |
+@@ -438,21 +438,13 @@ static int ipu_drm_bind(struct device *dev, struct device *master, void *data) |
4942 |
+ struct ipu_client_platformdata *pdata = dev->platform_data; |
4943 |
+ struct drm_device *drm = data; |
4944 |
+ struct ipu_crtc *ipu_crtc; |
4945 |
+- int ret; |
4946 |
+ |
4947 |
+- ipu_crtc = devm_kzalloc(dev, sizeof(*ipu_crtc), GFP_KERNEL); |
4948 |
+- if (!ipu_crtc) |
4949 |
+- return -ENOMEM; |
4950 |
++ ipu_crtc = dev_get_drvdata(dev); |
4951 |
++ memset(ipu_crtc, 0, sizeof(*ipu_crtc)); |
4952 |
+ |
4953 |
+ ipu_crtc->dev = dev; |
4954 |
+ |
4955 |
+- ret = ipu_crtc_init(ipu_crtc, pdata, drm); |
4956 |
+- if (ret) |
4957 |
+- return ret; |
4958 |
+- |
4959 |
+- dev_set_drvdata(dev, ipu_crtc); |
4960 |
+- |
4961 |
+- return 0; |
4962 |
++ return ipu_crtc_init(ipu_crtc, pdata, drm); |
4963 |
+ } |
4964 |
+ |
4965 |
+ static void ipu_drm_unbind(struct device *dev, struct device *master, |
4966 |
+@@ -474,6 +466,7 @@ static const struct component_ops ipu_crtc_ops = { |
4967 |
+ static int ipu_drm_probe(struct platform_device *pdev) |
4968 |
+ { |
4969 |
+ struct device *dev = &pdev->dev; |
4970 |
++ struct ipu_crtc *ipu_crtc; |
4971 |
+ int ret; |
4972 |
+ |
4973 |
+ if (!dev->platform_data) |
4974 |
+@@ -483,6 +476,12 @@ static int ipu_drm_probe(struct platform_device *pdev) |
4975 |
+ if (ret) |
4976 |
+ return ret; |
4977 |
+ |
4978 |
++ ipu_crtc = devm_kzalloc(dev, sizeof(*ipu_crtc), GFP_KERNEL); |
4979 |
++ if (!ipu_crtc) |
4980 |
++ return -ENOMEM; |
4981 |
++ |
4982 |
++ dev_set_drvdata(dev, ipu_crtc); |
4983 |
++ |
4984 |
+ return component_add(dev, &ipu_crtc_ops); |
4985 |
+ } |
4986 |
+ |
4987 |
+diff --git a/drivers/gpu/drm/imx/parallel-display.c b/drivers/gpu/drm/imx/parallel-display.c |
4988 |
+index 08fafa4bf8c2..43e109d67fe3 100644 |
4989 |
+--- a/drivers/gpu/drm/imx/parallel-display.c |
4990 |
++++ b/drivers/gpu/drm/imx/parallel-display.c |
4991 |
+@@ -330,9 +330,8 @@ static int imx_pd_bind(struct device *dev, struct device *master, void *data) |
4992 |
+ u32 bus_format = 0; |
4993 |
+ const char *fmt; |
4994 |
+ |
4995 |
+- imxpd = devm_kzalloc(dev, sizeof(*imxpd), GFP_KERNEL); |
4996 |
+- if (!imxpd) |
4997 |
+- return -ENOMEM; |
4998 |
++ imxpd = dev_get_drvdata(dev); |
4999 |
++ memset(imxpd, 0, sizeof(*imxpd)); |
5000 |
+ |
5001 |
+ edidp = of_get_property(np, "edid", &imxpd->edid_len); |
5002 |
+ if (edidp) |
5003 |
+@@ -363,8 +362,6 @@ static int imx_pd_bind(struct device *dev, struct device *master, void *data) |
5004 |
+ if (ret) |
5005 |
+ return ret; |
5006 |
+ |
5007 |
+- dev_set_drvdata(dev, imxpd); |
5008 |
+- |
5009 |
+ return 0; |
5010 |
+ } |
5011 |
+ |
5012 |
+@@ -386,6 +383,14 @@ static const struct component_ops imx_pd_ops = { |
5013 |
+ |
5014 |
+ static int imx_pd_probe(struct platform_device *pdev) |
5015 |
+ { |
5016 |
++ struct imx_parallel_display *imxpd; |
5017 |
++ |
5018 |
++ imxpd = devm_kzalloc(&pdev->dev, sizeof(*imxpd), GFP_KERNEL); |
5019 |
++ if (!imxpd) |
5020 |
++ return -ENOMEM; |
5021 |
++ |
5022 |
++ platform_set_drvdata(pdev, imxpd); |
5023 |
++ |
5024 |
+ return component_add(&pdev->dev, &imx_pd_ops); |
5025 |
+ } |
5026 |
+ |
5027 |
+diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c |
5028 |
+index 34607a98cc7c..9a7a18951dc2 100644 |
5029 |
+--- a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c |
5030 |
++++ b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c |
5031 |
+@@ -732,10 +732,19 @@ int a6xx_gmu_resume(struct a6xx_gpu *a6xx_gpu) |
5032 |
+ /* Turn on the resources */ |
5033 |
+ pm_runtime_get_sync(gmu->dev); |
5034 |
+ |
5035 |
++ /* |
5036 |
++ * "enable" the GX power domain which won't actually do anything but it |
5037 |
++ * will make sure that the refcounting is correct in case we need to |
5038 |
++ * bring down the GX after a GMU failure |
5039 |
++ */ |
5040 |
++ if (!IS_ERR_OR_NULL(gmu->gxpd)) |
5041 |
++ pm_runtime_get_sync(gmu->gxpd); |
5042 |
++ |
5043 |
+ /* Use a known rate to bring up the GMU */ |
5044 |
+ clk_set_rate(gmu->core_clk, 200000000); |
5045 |
+ ret = clk_bulk_prepare_enable(gmu->nr_clocks, gmu->clocks); |
5046 |
+ if (ret) { |
5047 |
++ pm_runtime_put(gmu->gxpd); |
5048 |
+ pm_runtime_put(gmu->dev); |
5049 |
+ return ret; |
5050 |
+ } |
5051 |
+@@ -771,19 +780,12 @@ int a6xx_gmu_resume(struct a6xx_gpu *a6xx_gpu) |
5052 |
+ /* Set the GPU to the current freq */ |
5053 |
+ __a6xx_gmu_set_freq(gmu, gmu->current_perf_index); |
5054 |
+ |
5055 |
+- /* |
5056 |
+- * "enable" the GX power domain which won't actually do anything but it |
5057 |
+- * will make sure that the refcounting is correct in case we need to |
5058 |
+- * bring down the GX after a GMU failure |
5059 |
+- */ |
5060 |
+- if (!IS_ERR_OR_NULL(gmu->gxpd)) |
5061 |
+- pm_runtime_get(gmu->gxpd); |
5062 |
+- |
5063 |
+ out: |
5064 |
+ /* On failure, shut down the GMU to leave it in a good state */ |
5065 |
+ if (ret) { |
5066 |
+ disable_irq(gmu->gmu_irq); |
5067 |
+ a6xx_rpmh_stop(gmu); |
5068 |
++ pm_runtime_put(gmu->gxpd); |
5069 |
+ pm_runtime_put(gmu->dev); |
5070 |
+ } |
5071 |
+ |
5072 |
+diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c |
5073 |
+index 17448505a9b5..d263d6e69bf1 100644 |
5074 |
+--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c |
5075 |
++++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c |
5076 |
+@@ -386,7 +386,7 @@ static void dpu_crtc_frame_event_cb(void *data, u32 event) |
5077 |
+ spin_unlock_irqrestore(&dpu_crtc->spin_lock, flags); |
5078 |
+ |
5079 |
+ if (!fevent) { |
5080 |
+- DRM_ERROR("crtc%d event %d overflow\n", crtc->base.id, event); |
5081 |
++ DRM_ERROR_RATELIMITED("crtc%d event %d overflow\n", crtc->base.id, event); |
5082 |
+ return; |
5083 |
+ } |
5084 |
+ |
5085 |
+diff --git a/drivers/gpu/drm/msm/msm_gem.c b/drivers/gpu/drm/msm/msm_gem.c |
5086 |
+index 5a6a79fbc9d6..d92a0ffe2a76 100644 |
5087 |
+--- a/drivers/gpu/drm/msm/msm_gem.c |
5088 |
++++ b/drivers/gpu/drm/msm/msm_gem.c |
5089 |
+@@ -977,10 +977,8 @@ int msm_gem_new_handle(struct drm_device *dev, struct drm_file *file, |
5090 |
+ |
5091 |
+ static int msm_gem_new_impl(struct drm_device *dev, |
5092 |
+ uint32_t size, uint32_t flags, |
5093 |
+- struct drm_gem_object **obj, |
5094 |
+- bool struct_mutex_locked) |
5095 |
++ struct drm_gem_object **obj) |
5096 |
+ { |
5097 |
+- struct msm_drm_private *priv = dev->dev_private; |
5098 |
+ struct msm_gem_object *msm_obj; |
5099 |
+ |
5100 |
+ switch (flags & MSM_BO_CACHE_MASK) { |
5101 |
+@@ -1006,15 +1004,6 @@ static int msm_gem_new_impl(struct drm_device *dev, |
5102 |
+ INIT_LIST_HEAD(&msm_obj->submit_entry); |
5103 |
+ INIT_LIST_HEAD(&msm_obj->vmas); |
5104 |
+ |
5105 |
+- if (struct_mutex_locked) { |
5106 |
+- WARN_ON(!mutex_is_locked(&dev->struct_mutex)); |
5107 |
+- list_add_tail(&msm_obj->mm_list, &priv->inactive_list); |
5108 |
+- } else { |
5109 |
+- mutex_lock(&dev->struct_mutex); |
5110 |
+- list_add_tail(&msm_obj->mm_list, &priv->inactive_list); |
5111 |
+- mutex_unlock(&dev->struct_mutex); |
5112 |
+- } |
5113 |
+- |
5114 |
+ *obj = &msm_obj->base; |
5115 |
+ |
5116 |
+ return 0; |
5117 |
+@@ -1024,6 +1013,7 @@ static struct drm_gem_object *_msm_gem_new(struct drm_device *dev, |
5118 |
+ uint32_t size, uint32_t flags, bool struct_mutex_locked) |
5119 |
+ { |
5120 |
+ struct msm_drm_private *priv = dev->dev_private; |
5121 |
++ struct msm_gem_object *msm_obj; |
5122 |
+ struct drm_gem_object *obj = NULL; |
5123 |
+ bool use_vram = false; |
5124 |
+ int ret; |
5125 |
+@@ -1044,14 +1034,15 @@ static struct drm_gem_object *_msm_gem_new(struct drm_device *dev, |
5126 |
+ if (size == 0) |
5127 |
+ return ERR_PTR(-EINVAL); |
5128 |
+ |
5129 |
+- ret = msm_gem_new_impl(dev, size, flags, &obj, struct_mutex_locked); |
5130 |
++ ret = msm_gem_new_impl(dev, size, flags, &obj); |
5131 |
+ if (ret) |
5132 |
+ goto fail; |
5133 |
+ |
5134 |
++ msm_obj = to_msm_bo(obj); |
5135 |
++ |
5136 |
+ if (use_vram) { |
5137 |
+ struct msm_gem_vma *vma; |
5138 |
+ struct page **pages; |
5139 |
+- struct msm_gem_object *msm_obj = to_msm_bo(obj); |
5140 |
+ |
5141 |
+ mutex_lock(&msm_obj->lock); |
5142 |
+ |
5143 |
+@@ -1086,6 +1077,15 @@ static struct drm_gem_object *_msm_gem_new(struct drm_device *dev, |
5144 |
+ mapping_set_gfp_mask(obj->filp->f_mapping, GFP_HIGHUSER); |
5145 |
+ } |
5146 |
+ |
5147 |
++ if (struct_mutex_locked) { |
5148 |
++ WARN_ON(!mutex_is_locked(&dev->struct_mutex)); |
5149 |
++ list_add_tail(&msm_obj->mm_list, &priv->inactive_list); |
5150 |
++ } else { |
5151 |
++ mutex_lock(&dev->struct_mutex); |
5152 |
++ list_add_tail(&msm_obj->mm_list, &priv->inactive_list); |
5153 |
++ mutex_unlock(&dev->struct_mutex); |
5154 |
++ } |
5155 |
++ |
5156 |
+ return obj; |
5157 |
+ |
5158 |
+ fail: |
5159 |
+@@ -1108,6 +1108,7 @@ struct drm_gem_object *msm_gem_new(struct drm_device *dev, |
5160 |
+ struct drm_gem_object *msm_gem_import(struct drm_device *dev, |
5161 |
+ struct dma_buf *dmabuf, struct sg_table *sgt) |
5162 |
+ { |
5163 |
++ struct msm_drm_private *priv = dev->dev_private; |
5164 |
+ struct msm_gem_object *msm_obj; |
5165 |
+ struct drm_gem_object *obj; |
5166 |
+ uint32_t size; |
5167 |
+@@ -1121,7 +1122,7 @@ struct drm_gem_object *msm_gem_import(struct drm_device *dev, |
5168 |
+ |
5169 |
+ size = PAGE_ALIGN(dmabuf->size); |
5170 |
+ |
5171 |
+- ret = msm_gem_new_impl(dev, size, MSM_BO_WC, &obj, false); |
5172 |
++ ret = msm_gem_new_impl(dev, size, MSM_BO_WC, &obj); |
5173 |
+ if (ret) |
5174 |
+ goto fail; |
5175 |
+ |
5176 |
+@@ -1146,6 +1147,11 @@ struct drm_gem_object *msm_gem_import(struct drm_device *dev, |
5177 |
+ } |
5178 |
+ |
5179 |
+ mutex_unlock(&msm_obj->lock); |
5180 |
++ |
5181 |
++ mutex_lock(&dev->struct_mutex); |
5182 |
++ list_add_tail(&msm_obj->mm_list, &priv->inactive_list); |
5183 |
++ mutex_unlock(&dev->struct_mutex); |
5184 |
++ |
5185 |
+ return obj; |
5186 |
+ |
5187 |
+ fail: |
5188 |
+diff --git a/drivers/gpu/drm/nouveau/dispnv50/head.c b/drivers/gpu/drm/nouveau/dispnv50/head.c |
5189 |
+index 8f6455697ba7..ed6819519f6d 100644 |
5190 |
+--- a/drivers/gpu/drm/nouveau/dispnv50/head.c |
5191 |
++++ b/drivers/gpu/drm/nouveau/dispnv50/head.c |
5192 |
+@@ -84,18 +84,20 @@ nv50_head_atomic_check_dither(struct nv50_head_atom *armh, |
5193 |
+ { |
5194 |
+ u32 mode = 0x00; |
5195 |
+ |
5196 |
+- if (asyc->dither.mode == DITHERING_MODE_AUTO) { |
5197 |
+- if (asyh->base.depth > asyh->or.bpc * 3) |
5198 |
+- mode = DITHERING_MODE_DYNAMIC2X2; |
5199 |
+- } else { |
5200 |
+- mode = asyc->dither.mode; |
5201 |
+- } |
5202 |
++ if (asyc->dither.mode) { |
5203 |
++ if (asyc->dither.mode == DITHERING_MODE_AUTO) { |
5204 |
++ if (asyh->base.depth > asyh->or.bpc * 3) |
5205 |
++ mode = DITHERING_MODE_DYNAMIC2X2; |
5206 |
++ } else { |
5207 |
++ mode = asyc->dither.mode; |
5208 |
++ } |
5209 |
+ |
5210 |
+- if (asyc->dither.depth == DITHERING_DEPTH_AUTO) { |
5211 |
+- if (asyh->or.bpc >= 8) |
5212 |
+- mode |= DITHERING_DEPTH_8BPC; |
5213 |
+- } else { |
5214 |
+- mode |= asyc->dither.depth; |
5215 |
++ if (asyc->dither.depth == DITHERING_DEPTH_AUTO) { |
5216 |
++ if (asyh->or.bpc >= 8) |
5217 |
++ mode |= DITHERING_DEPTH_8BPC; |
5218 |
++ } else { |
5219 |
++ mode |= asyc->dither.depth; |
5220 |
++ } |
5221 |
+ } |
5222 |
+ |
5223 |
+ asyh->dither.enable = mode; |
5224 |
+diff --git a/drivers/gpu/drm/nouveau/nouveau_debugfs.c b/drivers/gpu/drm/nouveau/nouveau_debugfs.c |
5225 |
+index 15a3d40edf02..3e15a9d5e8fa 100644 |
5226 |
+--- a/drivers/gpu/drm/nouveau/nouveau_debugfs.c |
5227 |
++++ b/drivers/gpu/drm/nouveau/nouveau_debugfs.c |
5228 |
+@@ -54,8 +54,10 @@ nouveau_debugfs_strap_peek(struct seq_file *m, void *data) |
5229 |
+ int ret; |
5230 |
+ |
5231 |
+ ret = pm_runtime_get_sync(drm->dev->dev); |
5232 |
+- if (ret < 0 && ret != -EACCES) |
5233 |
++ if (ret < 0 && ret != -EACCES) { |
5234 |
++ pm_runtime_put_autosuspend(drm->dev->dev); |
5235 |
+ return ret; |
5236 |
++ } |
5237 |
+ |
5238 |
+ seq_printf(m, "0x%08x\n", |
5239 |
+ nvif_rd32(&drm->client.device.object, 0x101000)); |
5240 |
+diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c |
5241 |
+index ca4087f5a15b..c484d21820c9 100644 |
5242 |
+--- a/drivers/gpu/drm/nouveau/nouveau_drm.c |
5243 |
++++ b/drivers/gpu/drm/nouveau/nouveau_drm.c |
5244 |
+@@ -1051,8 +1051,10 @@ nouveau_drm_open(struct drm_device *dev, struct drm_file *fpriv) |
5245 |
+ |
5246 |
+ /* need to bring up power immediately if opening device */ |
5247 |
+ ret = pm_runtime_get_sync(dev->dev); |
5248 |
+- if (ret < 0 && ret != -EACCES) |
5249 |
++ if (ret < 0 && ret != -EACCES) { |
5250 |
++ pm_runtime_put_autosuspend(dev->dev); |
5251 |
+ return ret; |
5252 |
++ } |
5253 |
+ |
5254 |
+ get_task_comm(tmpname, current); |
5255 |
+ snprintf(name, sizeof(name), "%s[%d]", tmpname, pid_nr(fpriv->pid)); |
5256 |
+@@ -1134,8 +1136,10 @@ nouveau_drm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) |
5257 |
+ long ret; |
5258 |
+ |
5259 |
+ ret = pm_runtime_get_sync(dev->dev); |
5260 |
+- if (ret < 0 && ret != -EACCES) |
5261 |
++ if (ret < 0 && ret != -EACCES) { |
5262 |
++ pm_runtime_put_autosuspend(dev->dev); |
5263 |
+ return ret; |
5264 |
++ } |
5265 |
+ |
5266 |
+ switch (_IOC_NR(cmd) - DRM_COMMAND_BASE) { |
5267 |
+ case DRM_NOUVEAU_NVIF: |
5268 |
+diff --git a/drivers/gpu/drm/nouveau/nouveau_gem.c b/drivers/gpu/drm/nouveau/nouveau_gem.c |
5269 |
+index f5ece1f94973..f941ce8f81e3 100644 |
5270 |
+--- a/drivers/gpu/drm/nouveau/nouveau_gem.c |
5271 |
++++ b/drivers/gpu/drm/nouveau/nouveau_gem.c |
5272 |
+@@ -45,8 +45,10 @@ nouveau_gem_object_del(struct drm_gem_object *gem) |
5273 |
+ int ret; |
5274 |
+ |
5275 |
+ ret = pm_runtime_get_sync(dev); |
5276 |
+- if (WARN_ON(ret < 0 && ret != -EACCES)) |
5277 |
++ if (WARN_ON(ret < 0 && ret != -EACCES)) { |
5278 |
++ pm_runtime_put_autosuspend(dev); |
5279 |
+ return; |
5280 |
++ } |
5281 |
+ |
5282 |
+ if (gem->import_attach) |
5283 |
+ drm_prime_gem_destroy(gem, nvbo->bo.sg); |
5284 |
+diff --git a/drivers/gpu/drm/nouveau/nouveau_sgdma.c b/drivers/gpu/drm/nouveau/nouveau_sgdma.c |
5285 |
+index feaac908efed..34403b810dba 100644 |
5286 |
+--- a/drivers/gpu/drm/nouveau/nouveau_sgdma.c |
5287 |
++++ b/drivers/gpu/drm/nouveau/nouveau_sgdma.c |
5288 |
+@@ -96,12 +96,9 @@ nouveau_sgdma_create_ttm(struct ttm_buffer_object *bo, uint32_t page_flags) |
5289 |
+ else |
5290 |
+ nvbe->ttm.ttm.func = &nv50_sgdma_backend; |
5291 |
+ |
5292 |
+- if (ttm_dma_tt_init(&nvbe->ttm, bo, page_flags)) |
5293 |
+- /* |
5294 |
+- * A failing ttm_dma_tt_init() will call ttm_tt_destroy() |
5295 |
+- * and thus our nouveau_sgdma_destroy() hook, so we don't need |
5296 |
+- * to free nvbe here. |
5297 |
+- */ |
5298 |
++ if (ttm_dma_tt_init(&nvbe->ttm, bo, page_flags)) { |
5299 |
++ kfree(nvbe); |
5300 |
+ return NULL; |
5301 |
++ } |
5302 |
+ return &nvbe->ttm.ttm; |
5303 |
+ } |
5304 |
+diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c |
5305 |
+index db91b3c031a1..346e3f9fd505 100644 |
5306 |
+--- a/drivers/gpu/drm/panel/panel-simple.c |
5307 |
++++ b/drivers/gpu/drm/panel/panel-simple.c |
5308 |
+@@ -2093,7 +2093,7 @@ static const struct drm_display_mode lg_lb070wv8_mode = { |
5309 |
+ static const struct panel_desc lg_lb070wv8 = { |
5310 |
+ .modes = &lg_lb070wv8_mode, |
5311 |
+ .num_modes = 1, |
5312 |
+- .bpc = 16, |
5313 |
++ .bpc = 8, |
5314 |
+ .size = { |
5315 |
+ .width = 151, |
5316 |
+ .height = 91, |
5317 |
+diff --git a/drivers/gpu/drm/panfrost/panfrost_job.c b/drivers/gpu/drm/panfrost/panfrost_job.c |
5318 |
+index 7914b1570841..f9519afca29d 100644 |
5319 |
+--- a/drivers/gpu/drm/panfrost/panfrost_job.c |
5320 |
++++ b/drivers/gpu/drm/panfrost/panfrost_job.c |
5321 |
+@@ -145,6 +145,8 @@ static void panfrost_job_hw_submit(struct panfrost_job *job, int js) |
5322 |
+ u64 jc_head = job->jc; |
5323 |
+ int ret; |
5324 |
+ |
5325 |
++ panfrost_devfreq_record_busy(pfdev); |
5326 |
++ |
5327 |
+ ret = pm_runtime_get_sync(pfdev->dev); |
5328 |
+ if (ret < 0) |
5329 |
+ return; |
5330 |
+@@ -155,7 +157,6 @@ static void panfrost_job_hw_submit(struct panfrost_job *job, int js) |
5331 |
+ } |
5332 |
+ |
5333 |
+ cfg = panfrost_mmu_as_get(pfdev, &job->file_priv->mmu); |
5334 |
+- panfrost_devfreq_record_busy(pfdev); |
5335 |
+ |
5336 |
+ job_write(pfdev, JS_HEAD_NEXT_LO(js), jc_head & 0xFFFFFFFF); |
5337 |
+ job_write(pfdev, JS_HEAD_NEXT_HI(js), jc_head >> 32); |
5338 |
+@@ -410,12 +411,12 @@ static void panfrost_job_timedout(struct drm_sched_job *sched_job) |
5339 |
+ for (i = 0; i < NUM_JOB_SLOTS; i++) { |
5340 |
+ if (pfdev->jobs[i]) { |
5341 |
+ pm_runtime_put_noidle(pfdev->dev); |
5342 |
++ panfrost_devfreq_record_idle(pfdev); |
5343 |
+ pfdev->jobs[i] = NULL; |
5344 |
+ } |
5345 |
+ } |
5346 |
+ spin_unlock_irqrestore(&pfdev->js->job_lock, flags); |
5347 |
+ |
5348 |
+- panfrost_devfreq_record_idle(pfdev); |
5349 |
+ panfrost_device_reset(pfdev); |
5350 |
+ |
5351 |
+ for (i = 0; i < NUM_JOB_SLOTS; i++) |
5352 |
+diff --git a/drivers/gpu/drm/radeon/ci_dpm.c b/drivers/gpu/drm/radeon/ci_dpm.c |
5353 |
+index 30b5a59353c5..ddc9c034ff9e 100644 |
5354 |
+--- a/drivers/gpu/drm/radeon/ci_dpm.c |
5355 |
++++ b/drivers/gpu/drm/radeon/ci_dpm.c |
5356 |
+@@ -4365,7 +4365,7 @@ static int ci_set_mc_special_registers(struct radeon_device *rdev, |
5357 |
+ table->mc_reg_table_entry[k].mc_data[j] |= 0x100; |
5358 |
+ } |
5359 |
+ j++; |
5360 |
+- if (j > SMU7_DISCRETE_MC_REGISTER_ARRAY_SIZE) |
5361 |
++ if (j >= SMU7_DISCRETE_MC_REGISTER_ARRAY_SIZE) |
5362 |
+ return -EINVAL; |
5363 |
+ |
5364 |
+ if (!pi->mem_gddr5) { |
5365 |
+diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c |
5366 |
+index 35db79a168bf..df1a7eb73651 100644 |
5367 |
+--- a/drivers/gpu/drm/radeon/radeon_display.c |
5368 |
++++ b/drivers/gpu/drm/radeon/radeon_display.c |
5369 |
+@@ -635,8 +635,10 @@ radeon_crtc_set_config(struct drm_mode_set *set, |
5370 |
+ dev = set->crtc->dev; |
5371 |
+ |
5372 |
+ ret = pm_runtime_get_sync(dev->dev); |
5373 |
+- if (ret < 0) |
5374 |
++ if (ret < 0) { |
5375 |
++ pm_runtime_put_autosuspend(dev->dev); |
5376 |
+ return ret; |
5377 |
++ } |
5378 |
+ |
5379 |
+ ret = drm_crtc_helper_set_config(set, ctx); |
5380 |
+ |
5381 |
+diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c |
5382 |
+index 59f8186a2415..6f0d1971099b 100644 |
5383 |
+--- a/drivers/gpu/drm/radeon/radeon_drv.c |
5384 |
++++ b/drivers/gpu/drm/radeon/radeon_drv.c |
5385 |
+@@ -171,12 +171,7 @@ int radeon_no_wb; |
5386 |
+ int radeon_modeset = -1; |
5387 |
+ int radeon_dynclks = -1; |
5388 |
+ int radeon_r4xx_atom = 0; |
5389 |
+-#ifdef __powerpc__ |
5390 |
+-/* Default to PCI on PowerPC (fdo #95017) */ |
5391 |
+ int radeon_agpmode = -1; |
5392 |
+-#else |
5393 |
+-int radeon_agpmode = 0; |
5394 |
+-#endif |
5395 |
+ int radeon_vram_limit = 0; |
5396 |
+ int radeon_gart_size = -1; /* auto */ |
5397 |
+ int radeon_benchmarking = 0; |
5398 |
+@@ -549,8 +544,10 @@ long radeon_drm_ioctl(struct file *filp, |
5399 |
+ long ret; |
5400 |
+ dev = file_priv->minor->dev; |
5401 |
+ ret = pm_runtime_get_sync(dev->dev); |
5402 |
+- if (ret < 0) |
5403 |
++ if (ret < 0) { |
5404 |
++ pm_runtime_put_autosuspend(dev->dev); |
5405 |
+ return ret; |
5406 |
++ } |
5407 |
+ |
5408 |
+ ret = drm_ioctl(filp, cmd, arg); |
5409 |
+ |
5410 |
+diff --git a/drivers/gpu/drm/radeon/radeon_kms.c b/drivers/gpu/drm/radeon/radeon_kms.c |
5411 |
+index 58176db85952..779e4cd86245 100644 |
5412 |
+--- a/drivers/gpu/drm/radeon/radeon_kms.c |
5413 |
++++ b/drivers/gpu/drm/radeon/radeon_kms.c |
5414 |
+@@ -638,8 +638,10 @@ int radeon_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv) |
5415 |
+ file_priv->driver_priv = NULL; |
5416 |
+ |
5417 |
+ r = pm_runtime_get_sync(dev->dev); |
5418 |
+- if (r < 0) |
5419 |
++ if (r < 0) { |
5420 |
++ pm_runtime_put_autosuspend(dev->dev); |
5421 |
+ return r; |
5422 |
++ } |
5423 |
+ |
5424 |
+ /* new gpu have virtual address space support */ |
5425 |
+ if (rdev->family >= CHIP_CAYMAN) { |
5426 |
+diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c |
5427 |
+index df585fe64f61..60ffe5bbc129 100644 |
5428 |
+--- a/drivers/gpu/drm/stm/ltdc.c |
5429 |
++++ b/drivers/gpu/drm/stm/ltdc.c |
5430 |
+@@ -425,9 +425,12 @@ static void ltdc_crtc_atomic_enable(struct drm_crtc *crtc, |
5431 |
+ struct drm_crtc_state *old_state) |
5432 |
+ { |
5433 |
+ struct ltdc_device *ldev = crtc_to_ltdc(crtc); |
5434 |
++ struct drm_device *ddev = crtc->dev; |
5435 |
+ |
5436 |
+ DRM_DEBUG_DRIVER("\n"); |
5437 |
+ |
5438 |
++ pm_runtime_get_sync(ddev->dev); |
5439 |
++ |
5440 |
+ /* Sets the background color value */ |
5441 |
+ reg_write(ldev->regs, LTDC_BCCR, BCCR_BCBLACK); |
5442 |
+ |
5443 |
+diff --git a/drivers/gpu/drm/tilcdc/tilcdc_panel.c b/drivers/gpu/drm/tilcdc/tilcdc_panel.c |
5444 |
+index 5584e656b857..8c4fd1aa4c2d 100644 |
5445 |
+--- a/drivers/gpu/drm/tilcdc/tilcdc_panel.c |
5446 |
++++ b/drivers/gpu/drm/tilcdc/tilcdc_panel.c |
5447 |
+@@ -143,12 +143,16 @@ static int panel_connector_get_modes(struct drm_connector *connector) |
5448 |
+ int i; |
5449 |
+ |
5450 |
+ for (i = 0; i < timings->num_timings; i++) { |
5451 |
+- struct drm_display_mode *mode = drm_mode_create(dev); |
5452 |
++ struct drm_display_mode *mode; |
5453 |
+ struct videomode vm; |
5454 |
+ |
5455 |
+ if (videomode_from_timings(timings, &vm, i)) |
5456 |
+ break; |
5457 |
+ |
5458 |
++ mode = drm_mode_create(dev); |
5459 |
++ if (!mode) |
5460 |
++ break; |
5461 |
++ |
5462 |
+ drm_display_mode_from_videomode(&vm, mode); |
5463 |
+ |
5464 |
+ mode->type = DRM_MODE_TYPE_DRIVER; |
5465 |
+diff --git a/drivers/gpu/drm/ttm/ttm_tt.c b/drivers/gpu/drm/ttm/ttm_tt.c |
5466 |
+index 2ec448e1d663..9f296b9da05b 100644 |
5467 |
+--- a/drivers/gpu/drm/ttm/ttm_tt.c |
5468 |
++++ b/drivers/gpu/drm/ttm/ttm_tt.c |
5469 |
+@@ -242,7 +242,6 @@ int ttm_tt_init(struct ttm_tt *ttm, struct ttm_buffer_object *bo, |
5470 |
+ ttm_tt_init_fields(ttm, bo, page_flags); |
5471 |
+ |
5472 |
+ if (ttm_tt_alloc_page_directory(ttm)) { |
5473 |
+- ttm_tt_destroy(ttm); |
5474 |
+ pr_err("Failed allocating page table\n"); |
5475 |
+ return -ENOMEM; |
5476 |
+ } |
5477 |
+@@ -266,7 +265,6 @@ int ttm_dma_tt_init(struct ttm_dma_tt *ttm_dma, struct ttm_buffer_object *bo, |
5478 |
+ |
5479 |
+ INIT_LIST_HEAD(&ttm_dma->pages_list); |
5480 |
+ if (ttm_dma_tt_alloc_page_directory(ttm_dma)) { |
5481 |
+- ttm_tt_destroy(ttm); |
5482 |
+ pr_err("Failed allocating page table\n"); |
5483 |
+ return -ENOMEM; |
5484 |
+ } |
5485 |
+@@ -288,7 +286,6 @@ int ttm_sg_tt_init(struct ttm_dma_tt *ttm_dma, struct ttm_buffer_object *bo, |
5486 |
+ else |
5487 |
+ ret = ttm_dma_tt_alloc_page_directory(ttm_dma); |
5488 |
+ if (ret) { |
5489 |
+- ttm_tt_destroy(ttm); |
5490 |
+ pr_err("Failed allocating page table\n"); |
5491 |
+ return -ENOMEM; |
5492 |
+ } |
5493 |
+diff --git a/drivers/gpu/drm/xen/xen_drm_front.c b/drivers/gpu/drm/xen/xen_drm_front.c |
5494 |
+index 374142018171..09894a1d343f 100644 |
5495 |
+--- a/drivers/gpu/drm/xen/xen_drm_front.c |
5496 |
++++ b/drivers/gpu/drm/xen/xen_drm_front.c |
5497 |
+@@ -400,8 +400,8 @@ static int xen_drm_drv_dumb_create(struct drm_file *filp, |
5498 |
+ args->size = args->pitch * args->height; |
5499 |
+ |
5500 |
+ obj = xen_drm_front_gem_create(dev, args->size); |
5501 |
+- if (IS_ERR_OR_NULL(obj)) { |
5502 |
+- ret = PTR_ERR_OR_ZERO(obj); |
5503 |
++ if (IS_ERR(obj)) { |
5504 |
++ ret = PTR_ERR(obj); |
5505 |
+ goto fail; |
5506 |
+ } |
5507 |
+ |
5508 |
+diff --git a/drivers/gpu/drm/xen/xen_drm_front_gem.c b/drivers/gpu/drm/xen/xen_drm_front_gem.c |
5509 |
+index f0b85e094111..4ec8a49241e1 100644 |
5510 |
+--- a/drivers/gpu/drm/xen/xen_drm_front_gem.c |
5511 |
++++ b/drivers/gpu/drm/xen/xen_drm_front_gem.c |
5512 |
+@@ -83,7 +83,7 @@ static struct xen_gem_object *gem_create(struct drm_device *dev, size_t size) |
5513 |
+ |
5514 |
+ size = round_up(size, PAGE_SIZE); |
5515 |
+ xen_obj = gem_create_obj(dev, size); |
5516 |
+- if (IS_ERR_OR_NULL(xen_obj)) |
5517 |
++ if (IS_ERR(xen_obj)) |
5518 |
+ return xen_obj; |
5519 |
+ |
5520 |
+ if (drm_info->front_info->cfg.be_alloc) { |
5521 |
+@@ -117,7 +117,7 @@ static struct xen_gem_object *gem_create(struct drm_device *dev, size_t size) |
5522 |
+ */ |
5523 |
+ xen_obj->num_pages = DIV_ROUND_UP(size, PAGE_SIZE); |
5524 |
+ xen_obj->pages = drm_gem_get_pages(&xen_obj->base); |
5525 |
+- if (IS_ERR_OR_NULL(xen_obj->pages)) { |
5526 |
++ if (IS_ERR(xen_obj->pages)) { |
5527 |
+ ret = PTR_ERR(xen_obj->pages); |
5528 |
+ xen_obj->pages = NULL; |
5529 |
+ goto fail; |
5530 |
+@@ -136,7 +136,7 @@ struct drm_gem_object *xen_drm_front_gem_create(struct drm_device *dev, |
5531 |
+ struct xen_gem_object *xen_obj; |
5532 |
+ |
5533 |
+ xen_obj = gem_create(dev, size); |
5534 |
+- if (IS_ERR_OR_NULL(xen_obj)) |
5535 |
++ if (IS_ERR(xen_obj)) |
5536 |
+ return ERR_CAST(xen_obj); |
5537 |
+ |
5538 |
+ return &xen_obj->base; |
5539 |
+@@ -194,7 +194,7 @@ xen_drm_front_gem_import_sg_table(struct drm_device *dev, |
5540 |
+ |
5541 |
+ size = attach->dmabuf->size; |
5542 |
+ xen_obj = gem_create_obj(dev, size); |
5543 |
+- if (IS_ERR_OR_NULL(xen_obj)) |
5544 |
++ if (IS_ERR(xen_obj)) |
5545 |
+ return ERR_CAST(xen_obj); |
5546 |
+ |
5547 |
+ ret = gem_alloc_pages_array(xen_obj, size); |
5548 |
+diff --git a/drivers/gpu/drm/xen/xen_drm_front_kms.c b/drivers/gpu/drm/xen/xen_drm_front_kms.c |
5549 |
+index 78096bbcd226..ef11b1e4de39 100644 |
5550 |
+--- a/drivers/gpu/drm/xen/xen_drm_front_kms.c |
5551 |
++++ b/drivers/gpu/drm/xen/xen_drm_front_kms.c |
5552 |
+@@ -60,7 +60,7 @@ fb_create(struct drm_device *dev, struct drm_file *filp, |
5553 |
+ int ret; |
5554 |
+ |
5555 |
+ fb = drm_gem_fb_create_with_funcs(dev, filp, mode_cmd, &fb_funcs); |
5556 |
+- if (IS_ERR_OR_NULL(fb)) |
5557 |
++ if (IS_ERR(fb)) |
5558 |
+ return fb; |
5559 |
+ |
5560 |
+ gem_obj = fb->obj[0]; |
5561 |
+diff --git a/drivers/gpu/host1x/debug.c b/drivers/gpu/host1x/debug.c |
5562 |
+index c0392672a842..1b4997bda1c7 100644 |
5563 |
+--- a/drivers/gpu/host1x/debug.c |
5564 |
++++ b/drivers/gpu/host1x/debug.c |
5565 |
+@@ -16,6 +16,8 @@ |
5566 |
+ #include "debug.h" |
5567 |
+ #include "channel.h" |
5568 |
+ |
5569 |
++static DEFINE_MUTEX(debug_lock); |
5570 |
++ |
5571 |
+ unsigned int host1x_debug_trace_cmdbuf; |
5572 |
+ |
5573 |
+ static pid_t host1x_debug_force_timeout_pid; |
5574 |
+@@ -52,12 +54,14 @@ static int show_channel(struct host1x_channel *ch, void *data, bool show_fifo) |
5575 |
+ struct output *o = data; |
5576 |
+ |
5577 |
+ mutex_lock(&ch->cdma.lock); |
5578 |
++ mutex_lock(&debug_lock); |
5579 |
+ |
5580 |
+ if (show_fifo) |
5581 |
+ host1x_hw_show_channel_fifo(m, ch, o); |
5582 |
+ |
5583 |
+ host1x_hw_show_channel_cdma(m, ch, o); |
5584 |
+ |
5585 |
++ mutex_unlock(&debug_lock); |
5586 |
+ mutex_unlock(&ch->cdma.lock); |
5587 |
+ |
5588 |
+ return 0; |
5589 |
+diff --git a/drivers/gpu/ipu-v3/ipu-common.c b/drivers/gpu/ipu-v3/ipu-common.c |
5590 |
+index ee2a025e54cf..b3dae9ec1a38 100644 |
5591 |
+--- a/drivers/gpu/ipu-v3/ipu-common.c |
5592 |
++++ b/drivers/gpu/ipu-v3/ipu-common.c |
5593 |
+@@ -124,6 +124,8 @@ enum ipu_color_space ipu_pixelformat_to_colorspace(u32 pixelformat) |
5594 |
+ case V4L2_PIX_FMT_RGBX32: |
5595 |
+ case V4L2_PIX_FMT_ARGB32: |
5596 |
+ case V4L2_PIX_FMT_XRGB32: |
5597 |
++ case V4L2_PIX_FMT_RGB32: |
5598 |
++ case V4L2_PIX_FMT_BGR32: |
5599 |
+ return IPUV3_COLORSPACE_RGB; |
5600 |
+ default: |
5601 |
+ return IPUV3_COLORSPACE_UNKNOWN; |
5602 |
+diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c |
5603 |
+index dea9cc65bf80..e8641ce677e4 100644 |
5604 |
+--- a/drivers/hid/hid-input.c |
5605 |
++++ b/drivers/hid/hid-input.c |
5606 |
+@@ -350,13 +350,13 @@ static int hidinput_query_battery_capacity(struct hid_device *dev) |
5607 |
+ u8 *buf; |
5608 |
+ int ret; |
5609 |
+ |
5610 |
+- buf = kmalloc(2, GFP_KERNEL); |
5611 |
++ buf = kmalloc(4, GFP_KERNEL); |
5612 |
+ if (!buf) |
5613 |
+ return -ENOMEM; |
5614 |
+ |
5615 |
+- ret = hid_hw_raw_request(dev, dev->battery_report_id, buf, 2, |
5616 |
++ ret = hid_hw_raw_request(dev, dev->battery_report_id, buf, 4, |
5617 |
+ dev->battery_report_type, HID_REQ_GET_REPORT); |
5618 |
+- if (ret != 2) { |
5619 |
++ if (ret < 2) { |
5620 |
+ kfree(buf); |
5621 |
+ return -ENODATA; |
5622 |
+ } |
5623 |
+diff --git a/drivers/hwtracing/coresight/coresight-etm4x.c b/drivers/hwtracing/coresight/coresight-etm4x.c |
5624 |
+index d59e4b1e5ce5..13c362cddd6a 100644 |
5625 |
+--- a/drivers/hwtracing/coresight/coresight-etm4x.c |
5626 |
++++ b/drivers/hwtracing/coresight/coresight-etm4x.c |
5627 |
+@@ -507,6 +507,12 @@ static void etm4_disable_hw(void *info) |
5628 |
+ readl_relaxed(drvdata->base + TRCSSCSRn(i)); |
5629 |
+ } |
5630 |
+ |
5631 |
++ /* read back the current counter values */ |
5632 |
++ for (i = 0; i < drvdata->nr_cntr; i++) { |
5633 |
++ config->cntr_val[i] = |
5634 |
++ readl_relaxed(drvdata->base + TRCCNTVRn(i)); |
5635 |
++ } |
5636 |
++ |
5637 |
+ coresight_disclaim_device_unlocked(drvdata->base); |
5638 |
+ |
5639 |
+ CS_LOCK(drvdata->base); |
5640 |
+@@ -1207,8 +1213,8 @@ static int etm4_cpu_save(struct etmv4_drvdata *drvdata) |
5641 |
+ } |
5642 |
+ |
5643 |
+ for (i = 0; i < drvdata->nr_addr_cmp * 2; i++) { |
5644 |
+- state->trcacvr[i] = readl(drvdata->base + TRCACVRn(i)); |
5645 |
+- state->trcacatr[i] = readl(drvdata->base + TRCACATRn(i)); |
5646 |
++ state->trcacvr[i] = readq(drvdata->base + TRCACVRn(i)); |
5647 |
++ state->trcacatr[i] = readq(drvdata->base + TRCACATRn(i)); |
5648 |
+ } |
5649 |
+ |
5650 |
+ /* |
5651 |
+@@ -1219,10 +1225,10 @@ static int etm4_cpu_save(struct etmv4_drvdata *drvdata) |
5652 |
+ */ |
5653 |
+ |
5654 |
+ for (i = 0; i < drvdata->numcidc; i++) |
5655 |
+- state->trccidcvr[i] = readl(drvdata->base + TRCCIDCVRn(i)); |
5656 |
++ state->trccidcvr[i] = readq(drvdata->base + TRCCIDCVRn(i)); |
5657 |
+ |
5658 |
+ for (i = 0; i < drvdata->numvmidc; i++) |
5659 |
+- state->trcvmidcvr[i] = readl(drvdata->base + TRCVMIDCVRn(i)); |
5660 |
++ state->trcvmidcvr[i] = readq(drvdata->base + TRCVMIDCVRn(i)); |
5661 |
+ |
5662 |
+ state->trccidcctlr0 = readl(drvdata->base + TRCCIDCCTLR0); |
5663 |
+ state->trccidcctlr1 = readl(drvdata->base + TRCCIDCCTLR1); |
5664 |
+@@ -1320,18 +1326,18 @@ static void etm4_cpu_restore(struct etmv4_drvdata *drvdata) |
5665 |
+ } |
5666 |
+ |
5667 |
+ for (i = 0; i < drvdata->nr_addr_cmp * 2; i++) { |
5668 |
+- writel_relaxed(state->trcacvr[i], |
5669 |
++ writeq_relaxed(state->trcacvr[i], |
5670 |
+ drvdata->base + TRCACVRn(i)); |
5671 |
+- writel_relaxed(state->trcacatr[i], |
5672 |
++ writeq_relaxed(state->trcacatr[i], |
5673 |
+ drvdata->base + TRCACATRn(i)); |
5674 |
+ } |
5675 |
+ |
5676 |
+ for (i = 0; i < drvdata->numcidc; i++) |
5677 |
+- writel_relaxed(state->trccidcvr[i], |
5678 |
++ writeq_relaxed(state->trccidcvr[i], |
5679 |
+ drvdata->base + TRCCIDCVRn(i)); |
5680 |
+ |
5681 |
+ for (i = 0; i < drvdata->numvmidc; i++) |
5682 |
+- writel_relaxed(state->trcvmidcvr[i], |
5683 |
++ writeq_relaxed(state->trcvmidcvr[i], |
5684 |
+ drvdata->base + TRCVMIDCVRn(i)); |
5685 |
+ |
5686 |
+ writel_relaxed(state->trccidcctlr0, drvdata->base + TRCCIDCCTLR0); |
5687 |
+diff --git a/drivers/hwtracing/coresight/coresight-etm4x.h b/drivers/hwtracing/coresight/coresight-etm4x.h |
5688 |
+index 4a695bf90582..47729e04aac7 100644 |
5689 |
+--- a/drivers/hwtracing/coresight/coresight-etm4x.h |
5690 |
++++ b/drivers/hwtracing/coresight/coresight-etm4x.h |
5691 |
+@@ -133,7 +133,7 @@ |
5692 |
+ #define ETMv4_MAX_CTXID_CMP 8 |
5693 |
+ #define ETM_MAX_VMID_CMP 8 |
5694 |
+ #define ETM_MAX_PE_CMP 8 |
5695 |
+-#define ETM_MAX_RES_SEL 16 |
5696 |
++#define ETM_MAX_RES_SEL 32 |
5697 |
+ #define ETM_MAX_SS_CMP 8 |
5698 |
+ |
5699 |
+ #define ETM_ARCH_V4 0x40 |
5700 |
+@@ -325,7 +325,7 @@ struct etmv4_save_state { |
5701 |
+ u32 trccntctlr[ETMv4_MAX_CNTR]; |
5702 |
+ u32 trccntvr[ETMv4_MAX_CNTR]; |
5703 |
+ |
5704 |
+- u32 trcrsctlr[ETM_MAX_RES_SEL * 2]; |
5705 |
++ u32 trcrsctlr[ETM_MAX_RES_SEL]; |
5706 |
+ |
5707 |
+ u32 trcssccr[ETM_MAX_SS_CMP]; |
5708 |
+ u32 trcsscsr[ETM_MAX_SS_CMP]; |
5709 |
+@@ -334,7 +334,7 @@ struct etmv4_save_state { |
5710 |
+ u64 trcacvr[ETM_MAX_SINGLE_ADDR_CMP]; |
5711 |
+ u64 trcacatr[ETM_MAX_SINGLE_ADDR_CMP]; |
5712 |
+ u64 trccidcvr[ETMv4_MAX_CTXID_CMP]; |
5713 |
+- u32 trcvmidcvr[ETM_MAX_VMID_CMP]; |
5714 |
++ u64 trcvmidcvr[ETM_MAX_VMID_CMP]; |
5715 |
+ u32 trccidcctlr0; |
5716 |
+ u32 trccidcctlr1; |
5717 |
+ u32 trcvmidcctlr0; |
5718 |
+diff --git a/drivers/hwtracing/coresight/coresight-tmc-etf.c b/drivers/hwtracing/coresight/coresight-tmc-etf.c |
5719 |
+index 36cce2bfb744..6375504ba8b0 100644 |
5720 |
+--- a/drivers/hwtracing/coresight/coresight-tmc-etf.c |
5721 |
++++ b/drivers/hwtracing/coresight/coresight-tmc-etf.c |
5722 |
+@@ -639,15 +639,14 @@ int tmc_read_unprepare_etb(struct tmc_drvdata *drvdata) |
5723 |
+ |
5724 |
+ spin_lock_irqsave(&drvdata->spinlock, flags); |
5725 |
+ |
5726 |
+- /* There is no point in reading a TMC in HW FIFO mode */ |
5727 |
+- mode = readl_relaxed(drvdata->base + TMC_MODE); |
5728 |
+- if (mode != TMC_MODE_CIRCULAR_BUFFER) { |
5729 |
+- spin_unlock_irqrestore(&drvdata->spinlock, flags); |
5730 |
+- return -EINVAL; |
5731 |
+- } |
5732 |
+- |
5733 |
+ /* Re-enable the TMC if need be */ |
5734 |
+ if (drvdata->mode == CS_MODE_SYSFS) { |
5735 |
++ /* There is no point in reading a TMC in HW FIFO mode */ |
5736 |
++ mode = readl_relaxed(drvdata->base + TMC_MODE); |
5737 |
++ if (mode != TMC_MODE_CIRCULAR_BUFFER) { |
5738 |
++ spin_unlock_irqrestore(&drvdata->spinlock, flags); |
5739 |
++ return -EINVAL; |
5740 |
++ } |
5741 |
+ /* |
5742 |
+ * The trace run will continue with the same allocated trace |
5743 |
+ * buffer. As such zero-out the buffer so that we don't end |
5744 |
+diff --git a/drivers/iio/amplifiers/ad8366.c b/drivers/iio/amplifiers/ad8366.c |
5745 |
+index 62167b87caea..8345ba65d41d 100644 |
5746 |
+--- a/drivers/iio/amplifiers/ad8366.c |
5747 |
++++ b/drivers/iio/amplifiers/ad8366.c |
5748 |
+@@ -262,8 +262,11 @@ static int ad8366_probe(struct spi_device *spi) |
5749 |
+ case ID_ADA4961: |
5750 |
+ case ID_ADL5240: |
5751 |
+ case ID_HMC1119: |
5752 |
+- st->reset_gpio = devm_gpiod_get(&spi->dev, "reset", |
5753 |
+- GPIOD_OUT_HIGH); |
5754 |
++ st->reset_gpio = devm_gpiod_get_optional(&spi->dev, "reset", GPIOD_OUT_HIGH); |
5755 |
++ if (IS_ERR(st->reset_gpio)) { |
5756 |
++ ret = PTR_ERR(st->reset_gpio); |
5757 |
++ goto error_disable_reg; |
5758 |
++ } |
5759 |
+ indio_dev->channels = ada4961_channels; |
5760 |
+ indio_dev->num_channels = ARRAY_SIZE(ada4961_channels); |
5761 |
+ break; |
5762 |
+diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c |
5763 |
+index d0b3d35ad3e4..0fe3c3eb3dfd 100644 |
5764 |
+--- a/drivers/infiniband/core/device.c |
5765 |
++++ b/drivers/infiniband/core/device.c |
5766 |
+@@ -1327,6 +1327,10 @@ out: |
5767 |
+ return ret; |
5768 |
+ } |
5769 |
+ |
5770 |
++static void prevent_dealloc_device(struct ib_device *ib_dev) |
5771 |
++{ |
5772 |
++} |
5773 |
++ |
5774 |
+ /** |
5775 |
+ * ib_register_device - Register an IB device with IB core |
5776 |
+ * @device: Device to register |
5777 |
+@@ -1396,11 +1400,11 @@ int ib_register_device(struct ib_device *device, const char *name) |
5778 |
+ * possibility for a parallel unregistration along with this |
5779 |
+ * error flow. Since we have a refcount here we know any |
5780 |
+ * parallel flow is stopped in disable_device and will see the |
5781 |
+- * NULL pointers, causing the responsibility to |
5782 |
++ * special dealloc_driver pointer, causing the responsibility to |
5783 |
+ * ib_dealloc_device() to revert back to this thread. |
5784 |
+ */ |
5785 |
+ dealloc_fn = device->ops.dealloc_driver; |
5786 |
+- device->ops.dealloc_driver = NULL; |
5787 |
++ device->ops.dealloc_driver = prevent_dealloc_device; |
5788 |
+ ib_device_put(device); |
5789 |
+ __ib_unregister_device(device); |
5790 |
+ device->ops.dealloc_driver = dealloc_fn; |
5791 |
+@@ -1448,7 +1452,8 @@ static void __ib_unregister_device(struct ib_device *ib_dev) |
5792 |
+ * Drivers using the new flow may not call ib_dealloc_device except |
5793 |
+ * in error unwind prior to registration success. |
5794 |
+ */ |
5795 |
+- if (ib_dev->ops.dealloc_driver) { |
5796 |
++ if (ib_dev->ops.dealloc_driver && |
5797 |
++ ib_dev->ops.dealloc_driver != prevent_dealloc_device) { |
5798 |
+ WARN_ON(kref_read(&ib_dev->dev.kobj.kref) <= 1); |
5799 |
+ ib_dealloc_device(ib_dev); |
5800 |
+ } |
5801 |
+diff --git a/drivers/infiniband/core/nldev.c b/drivers/infiniband/core/nldev.c |
5802 |
+index e16105be2eb2..98cd6403ca60 100644 |
5803 |
+--- a/drivers/infiniband/core/nldev.c |
5804 |
++++ b/drivers/infiniband/core/nldev.c |
5805 |
+@@ -738,9 +738,6 @@ static int fill_stat_counter_qps(struct sk_buff *msg, |
5806 |
+ xa_lock(&rt->xa); |
5807 |
+ xa_for_each(&rt->xa, id, res) { |
5808 |
+ qp = container_of(res, struct ib_qp, res); |
5809 |
+- if (qp->qp_type == IB_QPT_RAW_PACKET && !capable(CAP_NET_RAW)) |
5810 |
+- continue; |
5811 |
+- |
5812 |
+ if (!qp->counter || (qp->counter->id != counter->id)) |
5813 |
+ continue; |
5814 |
+ |
5815 |
+diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c |
5816 |
+index 56a71337112c..cf45fd704671 100644 |
5817 |
+--- a/drivers/infiniband/core/verbs.c |
5818 |
++++ b/drivers/infiniband/core/verbs.c |
5819 |
+@@ -1659,7 +1659,7 @@ static int _ib_modify_qp(struct ib_qp *qp, struct ib_qp_attr *attr, |
5820 |
+ if (!(rdma_protocol_ib(qp->device, |
5821 |
+ attr->alt_ah_attr.port_num) && |
5822 |
+ rdma_protocol_ib(qp->device, port))) { |
5823 |
+- ret = EINVAL; |
5824 |
++ ret = -EINVAL; |
5825 |
+ goto out; |
5826 |
+ } |
5827 |
+ } |
5828 |
+diff --git a/drivers/infiniband/hw/qedr/qedr.h b/drivers/infiniband/hw/qedr/qedr.h |
5829 |
+index 5488dbd59d3c..8cf462a3d0f6 100644 |
5830 |
+--- a/drivers/infiniband/hw/qedr/qedr.h |
5831 |
++++ b/drivers/infiniband/hw/qedr/qedr.h |
5832 |
+@@ -345,10 +345,10 @@ struct qedr_srq_hwq_info { |
5833 |
+ u32 wqe_prod; |
5834 |
+ u32 sge_prod; |
5835 |
+ u32 wr_prod_cnt; |
5836 |
+- u32 wr_cons_cnt; |
5837 |
++ atomic_t wr_cons_cnt; |
5838 |
+ u32 num_elems; |
5839 |
+ |
5840 |
+- u32 *virt_prod_pair_addr; |
5841 |
++ struct rdma_srq_producers *virt_prod_pair_addr; |
5842 |
+ dma_addr_t phy_prod_pair_addr; |
5843 |
+ }; |
5844 |
+ |
5845 |
+diff --git a/drivers/infiniband/hw/qedr/verbs.c b/drivers/infiniband/hw/qedr/verbs.c |
5846 |
+index a5bd3adaf90a..ac93447c9524 100644 |
5847 |
+--- a/drivers/infiniband/hw/qedr/verbs.c |
5848 |
++++ b/drivers/infiniband/hw/qedr/verbs.c |
5849 |
+@@ -3688,7 +3688,7 @@ static u32 qedr_srq_elem_left(struct qedr_srq_hwq_info *hw_srq) |
5850 |
+ * count and consumer count and subtract it from max |
5851 |
+ * work request supported so that we get elements left. |
5852 |
+ */ |
5853 |
+- used = hw_srq->wr_prod_cnt - hw_srq->wr_cons_cnt; |
5854 |
++ used = hw_srq->wr_prod_cnt - (u32)atomic_read(&hw_srq->wr_cons_cnt); |
5855 |
+ |
5856 |
+ return hw_srq->max_wr - used; |
5857 |
+ } |
5858 |
+@@ -3703,7 +3703,6 @@ int qedr_post_srq_recv(struct ib_srq *ibsrq, const struct ib_recv_wr *wr, |
5859 |
+ unsigned long flags; |
5860 |
+ int status = 0; |
5861 |
+ u32 num_sge; |
5862 |
+- u32 offset; |
5863 |
+ |
5864 |
+ spin_lock_irqsave(&srq->lock, flags); |
5865 |
+ |
5866 |
+@@ -3716,7 +3715,8 @@ int qedr_post_srq_recv(struct ib_srq *ibsrq, const struct ib_recv_wr *wr, |
5867 |
+ if (!qedr_srq_elem_left(hw_srq) || |
5868 |
+ wr->num_sge > srq->hw_srq.max_sges) { |
5869 |
+ DP_ERR(dev, "Can't post WR (%d,%d) || (%d > %d)\n", |
5870 |
+- hw_srq->wr_prod_cnt, hw_srq->wr_cons_cnt, |
5871 |
++ hw_srq->wr_prod_cnt, |
5872 |
++ atomic_read(&hw_srq->wr_cons_cnt), |
5873 |
+ wr->num_sge, srq->hw_srq.max_sges); |
5874 |
+ status = -ENOMEM; |
5875 |
+ *bad_wr = wr; |
5876 |
+@@ -3750,22 +3750,20 @@ int qedr_post_srq_recv(struct ib_srq *ibsrq, const struct ib_recv_wr *wr, |
5877 |
+ hw_srq->sge_prod++; |
5878 |
+ } |
5879 |
+ |
5880 |
+- /* Flush WQE and SGE information before |
5881 |
++ /* Update WQE and SGE information before |
5882 |
+ * updating producer. |
5883 |
+ */ |
5884 |
+- wmb(); |
5885 |
++ dma_wmb(); |
5886 |
+ |
5887 |
+ /* SRQ producer is 8 bytes. Need to update SGE producer index |
5888 |
+ * in first 4 bytes and need to update WQE producer in |
5889 |
+ * next 4 bytes. |
5890 |
+ */ |
5891 |
+- *srq->hw_srq.virt_prod_pair_addr = hw_srq->sge_prod; |
5892 |
+- offset = offsetof(struct rdma_srq_producers, wqe_prod); |
5893 |
+- *((u8 *)srq->hw_srq.virt_prod_pair_addr + offset) = |
5894 |
+- hw_srq->wqe_prod; |
5895 |
++ srq->hw_srq.virt_prod_pair_addr->sge_prod = hw_srq->sge_prod; |
5896 |
++ /* Make sure sge producer is updated first */ |
5897 |
++ dma_wmb(); |
5898 |
++ srq->hw_srq.virt_prod_pair_addr->wqe_prod = hw_srq->wqe_prod; |
5899 |
+ |
5900 |
+- /* Flush producer after updating it. */ |
5901 |
+- wmb(); |
5902 |
+ wr = wr->next; |
5903 |
+ } |
5904 |
+ |
5905 |
+@@ -4184,7 +4182,7 @@ static int process_resp_one_srq(struct qedr_dev *dev, struct qedr_qp *qp, |
5906 |
+ } else { |
5907 |
+ __process_resp_one(dev, qp, cq, wc, resp, wr_id); |
5908 |
+ } |
5909 |
+- srq->hw_srq.wr_cons_cnt++; |
5910 |
++ atomic_inc(&srq->hw_srq.wr_cons_cnt); |
5911 |
+ |
5912 |
+ return 1; |
5913 |
+ } |
5914 |
+diff --git a/drivers/infiniband/sw/rxe/rxe_recv.c b/drivers/infiniband/sw/rxe/rxe_recv.c |
5915 |
+index 831ad578a7b2..46e111c218fd 100644 |
5916 |
+--- a/drivers/infiniband/sw/rxe/rxe_recv.c |
5917 |
++++ b/drivers/infiniband/sw/rxe/rxe_recv.c |
5918 |
+@@ -330,10 +330,14 @@ err1: |
5919 |
+ |
5920 |
+ static int rxe_match_dgid(struct rxe_dev *rxe, struct sk_buff *skb) |
5921 |
+ { |
5922 |
++ struct rxe_pkt_info *pkt = SKB_TO_PKT(skb); |
5923 |
+ const struct ib_gid_attr *gid_attr; |
5924 |
+ union ib_gid dgid; |
5925 |
+ union ib_gid *pdgid; |
5926 |
+ |
5927 |
++ if (pkt->mask & RXE_LOOPBACK_MASK) |
5928 |
++ return 0; |
5929 |
++ |
5930 |
+ if (skb->protocol == htons(ETH_P_IP)) { |
5931 |
+ ipv6_addr_set_v4mapped(ip_hdr(skb)->daddr, |
5932 |
+ (struct in6_addr *)&dgid); |
5933 |
+@@ -366,7 +370,7 @@ void rxe_rcv(struct sk_buff *skb) |
5934 |
+ if (unlikely(skb->len < pkt->offset + RXE_BTH_BYTES)) |
5935 |
+ goto drop; |
5936 |
+ |
5937 |
+- if (unlikely(rxe_match_dgid(rxe, skb) < 0)) { |
5938 |
++ if (rxe_match_dgid(rxe, skb) < 0) { |
5939 |
+ pr_warn_ratelimited("failed matching dgid\n"); |
5940 |
+ goto drop; |
5941 |
+ } |
5942 |
+diff --git a/drivers/infiniband/sw/rxe/rxe_verbs.c b/drivers/infiniband/sw/rxe/rxe_verbs.c |
5943 |
+index 9dd4bd7aea92..2aaa0b592a2d 100644 |
5944 |
+--- a/drivers/infiniband/sw/rxe/rxe_verbs.c |
5945 |
++++ b/drivers/infiniband/sw/rxe/rxe_verbs.c |
5946 |
+@@ -683,6 +683,7 @@ static int rxe_post_send_kernel(struct rxe_qp *qp, const struct ib_send_wr *wr, |
5947 |
+ unsigned int mask; |
5948 |
+ unsigned int length = 0; |
5949 |
+ int i; |
5950 |
++ struct ib_send_wr *next; |
5951 |
+ |
5952 |
+ while (wr) { |
5953 |
+ mask = wr_opcode_mask(wr->opcode, qp); |
5954 |
+@@ -699,6 +700,8 @@ static int rxe_post_send_kernel(struct rxe_qp *qp, const struct ib_send_wr *wr, |
5955 |
+ break; |
5956 |
+ } |
5957 |
+ |
5958 |
++ next = wr->next; |
5959 |
++ |
5960 |
+ length = 0; |
5961 |
+ for (i = 0; i < wr->num_sge; i++) |
5962 |
+ length += wr->sg_list[i].length; |
5963 |
+@@ -709,7 +712,7 @@ static int rxe_post_send_kernel(struct rxe_qp *qp, const struct ib_send_wr *wr, |
5964 |
+ *bad_wr = wr; |
5965 |
+ break; |
5966 |
+ } |
5967 |
+- wr = wr->next; |
5968 |
++ wr = next; |
5969 |
+ } |
5970 |
+ |
5971 |
+ rxe_run_task(&qp->req.task, 1); |
5972 |
+diff --git a/drivers/iommu/intel_irq_remapping.c b/drivers/iommu/intel_irq_remapping.c |
5973 |
+index 982d796b686b..6bfb283e6f28 100644 |
5974 |
+--- a/drivers/iommu/intel_irq_remapping.c |
5975 |
++++ b/drivers/iommu/intel_irq_remapping.c |
5976 |
+@@ -628,13 +628,21 @@ out_free_table: |
5977 |
+ |
5978 |
+ static void intel_teardown_irq_remapping(struct intel_iommu *iommu) |
5979 |
+ { |
5980 |
++ struct fwnode_handle *fn; |
5981 |
++ |
5982 |
+ if (iommu && iommu->ir_table) { |
5983 |
+ if (iommu->ir_msi_domain) { |
5984 |
++ fn = iommu->ir_msi_domain->fwnode; |
5985 |
++ |
5986 |
+ irq_domain_remove(iommu->ir_msi_domain); |
5987 |
++ irq_domain_free_fwnode(fn); |
5988 |
+ iommu->ir_msi_domain = NULL; |
5989 |
+ } |
5990 |
+ if (iommu->ir_domain) { |
5991 |
++ fn = iommu->ir_domain->fwnode; |
5992 |
++ |
5993 |
+ irq_domain_remove(iommu->ir_domain); |
5994 |
++ irq_domain_free_fwnode(fn); |
5995 |
+ iommu->ir_domain = NULL; |
5996 |
+ } |
5997 |
+ free_pages((unsigned long)iommu->ir_table->base, |
5998 |
+diff --git a/drivers/irqchip/irq-bcm7038-l1.c b/drivers/irqchip/irq-bcm7038-l1.c |
5999 |
+index fd7c537fb42a..4127eeab10af 100644 |
6000 |
+--- a/drivers/irqchip/irq-bcm7038-l1.c |
6001 |
++++ b/drivers/irqchip/irq-bcm7038-l1.c |
6002 |
+@@ -327,7 +327,11 @@ static int bcm7038_l1_suspend(void) |
6003 |
+ u32 val; |
6004 |
+ |
6005 |
+ /* Wakeup interrupt should only come from the boot cpu */ |
6006 |
++#ifdef CONFIG_SMP |
6007 |
+ boot_cpu = cpu_logical_map(0); |
6008 |
++#else |
6009 |
++ boot_cpu = 0; |
6010 |
++#endif |
6011 |
+ |
6012 |
+ list_for_each_entry(intc, &bcm7038_l1_intcs_list, list) { |
6013 |
+ for (word = 0; word < intc->n_words; word++) { |
6014 |
+@@ -347,7 +351,11 @@ static void bcm7038_l1_resume(void) |
6015 |
+ struct bcm7038_l1_chip *intc; |
6016 |
+ int boot_cpu, word; |
6017 |
+ |
6018 |
++#ifdef CONFIG_SMP |
6019 |
+ boot_cpu = cpu_logical_map(0); |
6020 |
++#else |
6021 |
++ boot_cpu = 0; |
6022 |
++#endif |
6023 |
+ |
6024 |
+ list_for_each_entry(intc, &bcm7038_l1_intcs_list, list) { |
6025 |
+ for (word = 0; word < intc->n_words; word++) { |
6026 |
+diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c |
6027 |
+index b99e3105bf9f..237c832acdd7 100644 |
6028 |
+--- a/drivers/irqchip/irq-gic-v3-its.c |
6029 |
++++ b/drivers/irqchip/irq-gic-v3-its.c |
6030 |
+@@ -2690,7 +2690,7 @@ static int allocate_vpe_l1_table(void) |
6031 |
+ if (val & GICR_VPROPBASER_4_1_VALID) |
6032 |
+ goto out; |
6033 |
+ |
6034 |
+- gic_data_rdist()->vpe_table_mask = kzalloc(sizeof(cpumask_t), GFP_KERNEL); |
6035 |
++ gic_data_rdist()->vpe_table_mask = kzalloc(sizeof(cpumask_t), GFP_ATOMIC); |
6036 |
+ if (!gic_data_rdist()->vpe_table_mask) |
6037 |
+ return -ENOMEM; |
6038 |
+ |
6039 |
+@@ -2757,7 +2757,7 @@ static int allocate_vpe_l1_table(void) |
6040 |
+ |
6041 |
+ pr_debug("np = %d, npg = %lld, psz = %d, epp = %d, esz = %d\n", |
6042 |
+ np, npg, psz, epp, esz); |
6043 |
+- page = alloc_pages(GFP_KERNEL | __GFP_ZERO, get_order(np * PAGE_SIZE)); |
6044 |
++ page = alloc_pages(GFP_ATOMIC | __GFP_ZERO, get_order(np * PAGE_SIZE)); |
6045 |
+ if (!page) |
6046 |
+ return -ENOMEM; |
6047 |
+ |
6048 |
+diff --git a/drivers/irqchip/irq-loongson-liointc.c b/drivers/irqchip/irq-loongson-liointc.c |
6049 |
+index 63b61474a0cc..6ef86a334c62 100644 |
6050 |
+--- a/drivers/irqchip/irq-loongson-liointc.c |
6051 |
++++ b/drivers/irqchip/irq-loongson-liointc.c |
6052 |
+@@ -114,6 +114,7 @@ static int liointc_set_type(struct irq_data *data, unsigned int type) |
6053 |
+ liointc_set_bit(gc, LIOINTC_REG_INTC_POL, mask, false); |
6054 |
+ break; |
6055 |
+ default: |
6056 |
++ irq_gc_unlock_irqrestore(gc, flags); |
6057 |
+ return -EINVAL; |
6058 |
+ } |
6059 |
+ irq_gc_unlock_irqrestore(gc, flags); |
6060 |
+diff --git a/drivers/irqchip/irq-mtk-sysirq.c b/drivers/irqchip/irq-mtk-sysirq.c |
6061 |
+index 73eae5966a40..6ff98b87e5c0 100644 |
6062 |
+--- a/drivers/irqchip/irq-mtk-sysirq.c |
6063 |
++++ b/drivers/irqchip/irq-mtk-sysirq.c |
6064 |
+@@ -15,7 +15,7 @@ |
6065 |
+ #include <linux/spinlock.h> |
6066 |
+ |
6067 |
+ struct mtk_sysirq_chip_data { |
6068 |
+- spinlock_t lock; |
6069 |
++ raw_spinlock_t lock; |
6070 |
+ u32 nr_intpol_bases; |
6071 |
+ void __iomem **intpol_bases; |
6072 |
+ u32 *intpol_words; |
6073 |
+@@ -37,7 +37,7 @@ static int mtk_sysirq_set_type(struct irq_data *data, unsigned int type) |
6074 |
+ reg_index = chip_data->which_word[hwirq]; |
6075 |
+ offset = hwirq & 0x1f; |
6076 |
+ |
6077 |
+- spin_lock_irqsave(&chip_data->lock, flags); |
6078 |
++ raw_spin_lock_irqsave(&chip_data->lock, flags); |
6079 |
+ value = readl_relaxed(base + reg_index * 4); |
6080 |
+ if (type == IRQ_TYPE_LEVEL_LOW || type == IRQ_TYPE_EDGE_FALLING) { |
6081 |
+ if (type == IRQ_TYPE_LEVEL_LOW) |
6082 |
+@@ -53,7 +53,7 @@ static int mtk_sysirq_set_type(struct irq_data *data, unsigned int type) |
6083 |
+ |
6084 |
+ data = data->parent_data; |
6085 |
+ ret = data->chip->irq_set_type(data, type); |
6086 |
+- spin_unlock_irqrestore(&chip_data->lock, flags); |
6087 |
++ raw_spin_unlock_irqrestore(&chip_data->lock, flags); |
6088 |
+ return ret; |
6089 |
+ } |
6090 |
+ |
6091 |
+@@ -212,7 +212,7 @@ static int __init mtk_sysirq_of_init(struct device_node *node, |
6092 |
+ ret = -ENOMEM; |
6093 |
+ goto out_free_which_word; |
6094 |
+ } |
6095 |
+- spin_lock_init(&chip_data->lock); |
6096 |
++ raw_spin_lock_init(&chip_data->lock); |
6097 |
+ |
6098 |
+ return 0; |
6099 |
+ |
6100 |
+diff --git a/drivers/irqchip/irq-ti-sci-inta.c b/drivers/irqchip/irq-ti-sci-inta.c |
6101 |
+index 7e3ebf6ed2cd..be0a35d91796 100644 |
6102 |
+--- a/drivers/irqchip/irq-ti-sci-inta.c |
6103 |
++++ b/drivers/irqchip/irq-ti-sci-inta.c |
6104 |
+@@ -572,7 +572,7 @@ static int ti_sci_inta_irq_domain_probe(struct platform_device *pdev) |
6105 |
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
6106 |
+ inta->base = devm_ioremap_resource(dev, res); |
6107 |
+ if (IS_ERR(inta->base)) |
6108 |
+- return -ENODEV; |
6109 |
++ return PTR_ERR(inta->base); |
6110 |
+ |
6111 |
+ domain = irq_domain_add_linear(dev_of_node(dev), |
6112 |
+ ti_sci_get_num_resources(inta->vint), |
6113 |
+diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c |
6114 |
+index 3363a6551a70..cc3929f858b6 100644 |
6115 |
+--- a/drivers/leds/led-class.c |
6116 |
++++ b/drivers/leds/led-class.c |
6117 |
+@@ -173,6 +173,7 @@ void led_classdev_suspend(struct led_classdev *led_cdev) |
6118 |
+ { |
6119 |
+ led_cdev->flags |= LED_SUSPENDED; |
6120 |
+ led_set_brightness_nopm(led_cdev, 0); |
6121 |
++ flush_work(&led_cdev->set_brightness_work); |
6122 |
+ } |
6123 |
+ EXPORT_SYMBOL_GPL(led_classdev_suspend); |
6124 |
+ |
6125 |
+diff --git a/drivers/leds/leds-lm355x.c b/drivers/leds/leds-lm355x.c |
6126 |
+index a5abb499574b..129f475aebf2 100644 |
6127 |
+--- a/drivers/leds/leds-lm355x.c |
6128 |
++++ b/drivers/leds/leds-lm355x.c |
6129 |
+@@ -165,18 +165,19 @@ static int lm355x_chip_init(struct lm355x_chip_data *chip) |
6130 |
+ /* input and output pins configuration */ |
6131 |
+ switch (chip->type) { |
6132 |
+ case CHIP_LM3554: |
6133 |
+- reg_val = pdata->pin_tx2 | pdata->ntc_pin; |
6134 |
++ reg_val = (u32)pdata->pin_tx2 | (u32)pdata->ntc_pin; |
6135 |
+ ret = regmap_update_bits(chip->regmap, 0xE0, 0x28, reg_val); |
6136 |
+ if (ret < 0) |
6137 |
+ goto out; |
6138 |
+- reg_val = pdata->pass_mode; |
6139 |
++ reg_val = (u32)pdata->pass_mode; |
6140 |
+ ret = regmap_update_bits(chip->regmap, 0xA0, 0x04, reg_val); |
6141 |
+ if (ret < 0) |
6142 |
+ goto out; |
6143 |
+ break; |
6144 |
+ |
6145 |
+ case CHIP_LM3556: |
6146 |
+- reg_val = pdata->pin_tx2 | pdata->ntc_pin | pdata->pass_mode; |
6147 |
++ reg_val = (u32)pdata->pin_tx2 | (u32)pdata->ntc_pin | |
6148 |
++ (u32)pdata->pass_mode; |
6149 |
+ ret = regmap_update_bits(chip->regmap, 0x0A, 0xC4, reg_val); |
6150 |
+ if (ret < 0) |
6151 |
+ goto out; |
6152 |
+diff --git a/drivers/macintosh/via-macii.c b/drivers/macintosh/via-macii.c |
6153 |
+index ac824d7b2dcf..6aa903529570 100644 |
6154 |
+--- a/drivers/macintosh/via-macii.c |
6155 |
++++ b/drivers/macintosh/via-macii.c |
6156 |
+@@ -270,15 +270,12 @@ static int macii_autopoll(int devs) |
6157 |
+ unsigned long flags; |
6158 |
+ int err = 0; |
6159 |
+ |
6160 |
++ local_irq_save(flags); |
6161 |
++ |
6162 |
+ /* bit 1 == device 1, and so on. */ |
6163 |
+ autopoll_devs = devs & 0xFFFE; |
6164 |
+ |
6165 |
+- if (!autopoll_devs) |
6166 |
+- return 0; |
6167 |
+- |
6168 |
+- local_irq_save(flags); |
6169 |
+- |
6170 |
+- if (current_req == NULL) { |
6171 |
++ if (autopoll_devs && !current_req) { |
6172 |
+ /* Send a Talk Reg 0. The controller will repeatedly transmit |
6173 |
+ * this as long as it is idle. |
6174 |
+ */ |
6175 |
+diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c |
6176 |
+index a2e5a0fcd7d5..7048370331c3 100644 |
6177 |
+--- a/drivers/md/bcache/super.c |
6178 |
++++ b/drivers/md/bcache/super.c |
6179 |
+@@ -2099,7 +2099,14 @@ found: |
6180 |
+ sysfs_create_link(&c->kobj, &ca->kobj, buf)) |
6181 |
+ goto err; |
6182 |
+ |
6183 |
+- if (ca->sb.seq > c->sb.seq) { |
6184 |
++ /* |
6185 |
++ * A special case is both ca->sb.seq and c->sb.seq are 0, |
6186 |
++ * such condition happens on a new created cache device whose |
6187 |
++ * super block is never flushed yet. In this case c->sb.version |
6188 |
++ * and other members should be updated too, otherwise we will |
6189 |
++ * have a mistaken super block version in cache set. |
6190 |
++ */ |
6191 |
++ if (ca->sb.seq > c->sb.seq || c->sb.seq == 0) { |
6192 |
+ c->sb.version = ca->sb.version; |
6193 |
+ memcpy(c->sb.set_uuid, ca->sb.set_uuid, 16); |
6194 |
+ c->sb.flags = ca->sb.flags; |
6195 |
+diff --git a/drivers/md/md-cluster.c b/drivers/md/md-cluster.c |
6196 |
+index 813a99ffa86f..73fd50e77975 100644 |
6197 |
+--- a/drivers/md/md-cluster.c |
6198 |
++++ b/drivers/md/md-cluster.c |
6199 |
+@@ -1518,6 +1518,7 @@ static void unlock_all_bitmaps(struct mddev *mddev) |
6200 |
+ } |
6201 |
+ } |
6202 |
+ kfree(cinfo->other_bitmap_lockres); |
6203 |
++ cinfo->other_bitmap_lockres = NULL; |
6204 |
+ } |
6205 |
+ } |
6206 |
+ |
6207 |
+diff --git a/drivers/md/md.c b/drivers/md/md.c |
6208 |
+index 41eead9cbee9..d5a5c1881398 100644 |
6209 |
+--- a/drivers/md/md.c |
6210 |
++++ b/drivers/md/md.c |
6211 |
+@@ -469,17 +469,18 @@ static blk_qc_t md_make_request(struct request_queue *q, struct bio *bio) |
6212 |
+ struct mddev *mddev = q->queuedata; |
6213 |
+ unsigned int sectors; |
6214 |
+ |
6215 |
+- if (unlikely(test_bit(MD_BROKEN, &mddev->flags)) && (rw == WRITE)) { |
6216 |
++ if (mddev == NULL || mddev->pers == NULL) { |
6217 |
+ bio_io_error(bio); |
6218 |
+ return BLK_QC_T_NONE; |
6219 |
+ } |
6220 |
+ |
6221 |
+- blk_queue_split(q, &bio); |
6222 |
+- |
6223 |
+- if (mddev == NULL || mddev->pers == NULL) { |
6224 |
++ if (unlikely(test_bit(MD_BROKEN, &mddev->flags)) && (rw == WRITE)) { |
6225 |
+ bio_io_error(bio); |
6226 |
+ return BLK_QC_T_NONE; |
6227 |
+ } |
6228 |
++ |
6229 |
++ blk_queue_split(q, &bio); |
6230 |
++ |
6231 |
+ if (mddev->ro == 1 && unlikely(rw == WRITE)) { |
6232 |
+ if (bio_sectors(bio) != 0) |
6233 |
+ bio->bi_status = BLK_STS_IOERR; |
6234 |
+diff --git a/drivers/media/firewire/firedtv-fw.c b/drivers/media/firewire/firedtv-fw.c |
6235 |
+index 97144734eb05..3f1ca40b9b98 100644 |
6236 |
+--- a/drivers/media/firewire/firedtv-fw.c |
6237 |
++++ b/drivers/media/firewire/firedtv-fw.c |
6238 |
+@@ -272,6 +272,8 @@ static int node_probe(struct fw_unit *unit, const struct ieee1394_device_id *id) |
6239 |
+ |
6240 |
+ name_len = fw_csr_string(unit->directory, CSR_MODEL, |
6241 |
+ name, sizeof(name)); |
6242 |
++ if (name_len < 0) |
6243 |
++ return name_len; |
6244 |
+ for (i = ARRAY_SIZE(model_names); --i; ) |
6245 |
+ if (strlen(model_names[i]) <= name_len && |
6246 |
+ strncmp(name, model_names[i], name_len) == 0) |
6247 |
+diff --git a/drivers/media/i2c/tvp5150.c b/drivers/media/i2c/tvp5150.c |
6248 |
+index eb39cf5ea089..9df575238952 100644 |
6249 |
+--- a/drivers/media/i2c/tvp5150.c |
6250 |
++++ b/drivers/media/i2c/tvp5150.c |
6251 |
+@@ -1664,8 +1664,10 @@ static int tvp5150_registered(struct v4l2_subdev *sd) |
6252 |
+ return 0; |
6253 |
+ |
6254 |
+ err: |
6255 |
+- for (i = 0; i < decoder->connectors_num; i++) |
6256 |
++ for (i = 0; i < decoder->connectors_num; i++) { |
6257 |
+ media_device_unregister_entity(&decoder->connectors[i].ent); |
6258 |
++ media_entity_cleanup(&decoder->connectors[i].ent); |
6259 |
++ } |
6260 |
+ return ret; |
6261 |
+ #endif |
6262 |
+ |
6263 |
+@@ -2248,8 +2250,10 @@ static int tvp5150_remove(struct i2c_client *c) |
6264 |
+ |
6265 |
+ for (i = 0; i < decoder->connectors_num; i++) |
6266 |
+ v4l2_fwnode_connector_free(&decoder->connectors[i].base); |
6267 |
+- for (i = 0; i < decoder->connectors_num; i++) |
6268 |
++ for (i = 0; i < decoder->connectors_num; i++) { |
6269 |
+ media_device_unregister_entity(&decoder->connectors[i].ent); |
6270 |
++ media_entity_cleanup(&decoder->connectors[i].ent); |
6271 |
++ } |
6272 |
+ v4l2_async_unregister_subdev(sd); |
6273 |
+ v4l2_ctrl_handler_free(&decoder->hdl); |
6274 |
+ pm_runtime_disable(&c->dev); |
6275 |
+diff --git a/drivers/media/mc/mc-request.c b/drivers/media/mc/mc-request.c |
6276 |
+index e3fca436c75b..c0782fd96c59 100644 |
6277 |
+--- a/drivers/media/mc/mc-request.c |
6278 |
++++ b/drivers/media/mc/mc-request.c |
6279 |
+@@ -296,9 +296,18 @@ int media_request_alloc(struct media_device *mdev, int *alloc_fd) |
6280 |
+ if (WARN_ON(!mdev->ops->req_alloc ^ !mdev->ops->req_free)) |
6281 |
+ return -ENOMEM; |
6282 |
+ |
6283 |
++ if (mdev->ops->req_alloc) |
6284 |
++ req = mdev->ops->req_alloc(mdev); |
6285 |
++ else |
6286 |
++ req = kzalloc(sizeof(*req), GFP_KERNEL); |
6287 |
++ if (!req) |
6288 |
++ return -ENOMEM; |
6289 |
++ |
6290 |
+ fd = get_unused_fd_flags(O_CLOEXEC); |
6291 |
+- if (fd < 0) |
6292 |
+- return fd; |
6293 |
++ if (fd < 0) { |
6294 |
++ ret = fd; |
6295 |
++ goto err_free_req; |
6296 |
++ } |
6297 |
+ |
6298 |
+ filp = anon_inode_getfile("request", &request_fops, NULL, O_CLOEXEC); |
6299 |
+ if (IS_ERR(filp)) { |
6300 |
+@@ -306,15 +315,6 @@ int media_request_alloc(struct media_device *mdev, int *alloc_fd) |
6301 |
+ goto err_put_fd; |
6302 |
+ } |
6303 |
+ |
6304 |
+- if (mdev->ops->req_alloc) |
6305 |
+- req = mdev->ops->req_alloc(mdev); |
6306 |
+- else |
6307 |
+- req = kzalloc(sizeof(*req), GFP_KERNEL); |
6308 |
+- if (!req) { |
6309 |
+- ret = -ENOMEM; |
6310 |
+- goto err_fput; |
6311 |
+- } |
6312 |
+- |
6313 |
+ filp->private_data = req; |
6314 |
+ req->mdev = mdev; |
6315 |
+ req->state = MEDIA_REQUEST_STATE_IDLE; |
6316 |
+@@ -336,12 +336,15 @@ int media_request_alloc(struct media_device *mdev, int *alloc_fd) |
6317 |
+ |
6318 |
+ return 0; |
6319 |
+ |
6320 |
+-err_fput: |
6321 |
+- fput(filp); |
6322 |
+- |
6323 |
+ err_put_fd: |
6324 |
+ put_unused_fd(fd); |
6325 |
+ |
6326 |
++err_free_req: |
6327 |
++ if (mdev->ops->req_free) |
6328 |
++ mdev->ops->req_free(req); |
6329 |
++ else |
6330 |
++ kfree(req); |
6331 |
++ |
6332 |
+ return ret; |
6333 |
+ } |
6334 |
+ |
6335 |
+diff --git a/drivers/media/platform/cros-ec-cec/cros-ec-cec.c b/drivers/media/platform/cros-ec-cec/cros-ec-cec.c |
6336 |
+index 0e7e2772f08f..2d95e16cd248 100644 |
6337 |
+--- a/drivers/media/platform/cros-ec-cec/cros-ec-cec.c |
6338 |
++++ b/drivers/media/platform/cros-ec-cec/cros-ec-cec.c |
6339 |
+@@ -277,11 +277,7 @@ static int cros_ec_cec_probe(struct platform_device *pdev) |
6340 |
+ platform_set_drvdata(pdev, cros_ec_cec); |
6341 |
+ cros_ec_cec->cros_ec = cros_ec; |
6342 |
+ |
6343 |
+- ret = device_init_wakeup(&pdev->dev, 1); |
6344 |
+- if (ret) { |
6345 |
+- dev_err(&pdev->dev, "failed to initialize wakeup\n"); |
6346 |
+- return ret; |
6347 |
+- } |
6348 |
++ device_init_wakeup(&pdev->dev, 1); |
6349 |
+ |
6350 |
+ cros_ec_cec->adap = cec_allocate_adapter(&cros_ec_cec_ops, cros_ec_cec, |
6351 |
+ DRV_NAME, |
6352 |
+diff --git a/drivers/media/platform/exynos4-is/media-dev.c b/drivers/media/platform/exynos4-is/media-dev.c |
6353 |
+index 9aaf3b8060d5..9c31d950cddf 100644 |
6354 |
+--- a/drivers/media/platform/exynos4-is/media-dev.c |
6355 |
++++ b/drivers/media/platform/exynos4-is/media-dev.c |
6356 |
+@@ -1270,6 +1270,9 @@ static int fimc_md_get_pinctrl(struct fimc_md *fmd) |
6357 |
+ |
6358 |
+ pctl->state_idle = pinctrl_lookup_state(pctl->pinctrl, |
6359 |
+ PINCTRL_STATE_IDLE); |
6360 |
++ if (IS_ERR(pctl->state_idle)) |
6361 |
++ return PTR_ERR(pctl->state_idle); |
6362 |
++ |
6363 |
+ return 0; |
6364 |
+ } |
6365 |
+ |
6366 |
+diff --git a/drivers/media/platform/marvell-ccic/mcam-core.c b/drivers/media/platform/marvell-ccic/mcam-core.c |
6367 |
+index 09775b6624c6..326e79b8531c 100644 |
6368 |
+--- a/drivers/media/platform/marvell-ccic/mcam-core.c |
6369 |
++++ b/drivers/media/platform/marvell-ccic/mcam-core.c |
6370 |
+@@ -1940,6 +1940,7 @@ int mccic_register(struct mcam_camera *cam) |
6371 |
+ out: |
6372 |
+ v4l2_async_notifier_unregister(&cam->notifier); |
6373 |
+ v4l2_device_unregister(&cam->v4l2_dev); |
6374 |
++ v4l2_async_notifier_cleanup(&cam->notifier); |
6375 |
+ return ret; |
6376 |
+ } |
6377 |
+ EXPORT_SYMBOL_GPL(mccic_register); |
6378 |
+@@ -1961,6 +1962,7 @@ void mccic_shutdown(struct mcam_camera *cam) |
6379 |
+ v4l2_ctrl_handler_free(&cam->ctrl_handler); |
6380 |
+ v4l2_async_notifier_unregister(&cam->notifier); |
6381 |
+ v4l2_device_unregister(&cam->v4l2_dev); |
6382 |
++ v4l2_async_notifier_cleanup(&cam->notifier); |
6383 |
+ } |
6384 |
+ EXPORT_SYMBOL_GPL(mccic_shutdown); |
6385 |
+ |
6386 |
+diff --git a/drivers/media/platform/mtk-mdp/mtk_mdp_comp.c b/drivers/media/platform/mtk-mdp/mtk_mdp_comp.c |
6387 |
+index 14991685adb7..9b375d367753 100644 |
6388 |
+--- a/drivers/media/platform/mtk-mdp/mtk_mdp_comp.c |
6389 |
++++ b/drivers/media/platform/mtk-mdp/mtk_mdp_comp.c |
6390 |
+@@ -96,6 +96,7 @@ int mtk_mdp_comp_init(struct device *dev, struct device_node *node, |
6391 |
+ { |
6392 |
+ struct device_node *larb_node; |
6393 |
+ struct platform_device *larb_pdev; |
6394 |
++ int ret; |
6395 |
+ int i; |
6396 |
+ |
6397 |
+ if (comp_id < 0 || comp_id >= MTK_MDP_COMP_ID_MAX) { |
6398 |
+@@ -113,8 +114,8 @@ int mtk_mdp_comp_init(struct device *dev, struct device_node *node, |
6399 |
+ if (IS_ERR(comp->clk[i])) { |
6400 |
+ if (PTR_ERR(comp->clk[i]) != -EPROBE_DEFER) |
6401 |
+ dev_err(dev, "Failed to get clock\n"); |
6402 |
+- |
6403 |
+- return PTR_ERR(comp->clk[i]); |
6404 |
++ ret = PTR_ERR(comp->clk[i]); |
6405 |
++ goto put_dev; |
6406 |
+ } |
6407 |
+ |
6408 |
+ /* Only RDMA needs two clocks */ |
6409 |
+@@ -133,20 +134,27 @@ int mtk_mdp_comp_init(struct device *dev, struct device_node *node, |
6410 |
+ if (!larb_node) { |
6411 |
+ dev_err(dev, |
6412 |
+ "Missing mediadek,larb phandle in %pOF node\n", node); |
6413 |
+- return -EINVAL; |
6414 |
++ ret = -EINVAL; |
6415 |
++ goto put_dev; |
6416 |
+ } |
6417 |
+ |
6418 |
+ larb_pdev = of_find_device_by_node(larb_node); |
6419 |
+ if (!larb_pdev) { |
6420 |
+ dev_warn(dev, "Waiting for larb device %pOF\n", larb_node); |
6421 |
+ of_node_put(larb_node); |
6422 |
+- return -EPROBE_DEFER; |
6423 |
++ ret = -EPROBE_DEFER; |
6424 |
++ goto put_dev; |
6425 |
+ } |
6426 |
+ of_node_put(larb_node); |
6427 |
+ |
6428 |
+ comp->larb_dev = &larb_pdev->dev; |
6429 |
+ |
6430 |
+ return 0; |
6431 |
++ |
6432 |
++put_dev: |
6433 |
++ of_node_put(comp->dev_node); |
6434 |
++ |
6435 |
++ return ret; |
6436 |
+ } |
6437 |
+ |
6438 |
+ void mtk_mdp_comp_deinit(struct device *dev, struct mtk_mdp_comp *comp) |
6439 |
+diff --git a/drivers/media/platform/omap3isp/isppreview.c b/drivers/media/platform/omap3isp/isppreview.c |
6440 |
+index 4dbdf3180d10..607b7685c982 100644 |
6441 |
+--- a/drivers/media/platform/omap3isp/isppreview.c |
6442 |
++++ b/drivers/media/platform/omap3isp/isppreview.c |
6443 |
+@@ -2287,7 +2287,7 @@ static int preview_init_entities(struct isp_prev_device *prev) |
6444 |
+ me->ops = &preview_media_ops; |
6445 |
+ ret = media_entity_pads_init(me, PREV_PADS_NUM, pads); |
6446 |
+ if (ret < 0) |
6447 |
+- return ret; |
6448 |
++ goto error_handler_free; |
6449 |
+ |
6450 |
+ preview_init_formats(sd, NULL); |
6451 |
+ |
6452 |
+@@ -2320,6 +2320,8 @@ error_video_out: |
6453 |
+ omap3isp_video_cleanup(&prev->video_in); |
6454 |
+ error_video_in: |
6455 |
+ media_entity_cleanup(&prev->subdev.entity); |
6456 |
++error_handler_free: |
6457 |
++ v4l2_ctrl_handler_free(&prev->ctrls); |
6458 |
+ return ret; |
6459 |
+ } |
6460 |
+ |
6461 |
+diff --git a/drivers/media/platform/s5p-g2d/g2d.c b/drivers/media/platform/s5p-g2d/g2d.c |
6462 |
+index 6932fd47071b..15bcb7f6e113 100644 |
6463 |
+--- a/drivers/media/platform/s5p-g2d/g2d.c |
6464 |
++++ b/drivers/media/platform/s5p-g2d/g2d.c |
6465 |
+@@ -695,21 +695,13 @@ static int g2d_probe(struct platform_device *pdev) |
6466 |
+ vfd->lock = &dev->mutex; |
6467 |
+ vfd->v4l2_dev = &dev->v4l2_dev; |
6468 |
+ vfd->device_caps = V4L2_CAP_VIDEO_M2M | V4L2_CAP_STREAMING; |
6469 |
+- ret = video_register_device(vfd, VFL_TYPE_VIDEO, 0); |
6470 |
+- if (ret) { |
6471 |
+- v4l2_err(&dev->v4l2_dev, "Failed to register video device\n"); |
6472 |
+- goto rel_vdev; |
6473 |
+- } |
6474 |
+- video_set_drvdata(vfd, dev); |
6475 |
+- dev->vfd = vfd; |
6476 |
+- v4l2_info(&dev->v4l2_dev, "device registered as /dev/video%d\n", |
6477 |
+- vfd->num); |
6478 |
++ |
6479 |
+ platform_set_drvdata(pdev, dev); |
6480 |
+ dev->m2m_dev = v4l2_m2m_init(&g2d_m2m_ops); |
6481 |
+ if (IS_ERR(dev->m2m_dev)) { |
6482 |
+ v4l2_err(&dev->v4l2_dev, "Failed to init mem2mem device\n"); |
6483 |
+ ret = PTR_ERR(dev->m2m_dev); |
6484 |
+- goto unreg_video_dev; |
6485 |
++ goto rel_vdev; |
6486 |
+ } |
6487 |
+ |
6488 |
+ def_frame.stride = (def_frame.width * def_frame.fmt->depth) >> 3; |
6489 |
+@@ -717,14 +709,24 @@ static int g2d_probe(struct platform_device *pdev) |
6490 |
+ of_id = of_match_node(exynos_g2d_match, pdev->dev.of_node); |
6491 |
+ if (!of_id) { |
6492 |
+ ret = -ENODEV; |
6493 |
+- goto unreg_video_dev; |
6494 |
++ goto free_m2m; |
6495 |
+ } |
6496 |
+ dev->variant = (struct g2d_variant *)of_id->data; |
6497 |
+ |
6498 |
++ ret = video_register_device(vfd, VFL_TYPE_VIDEO, 0); |
6499 |
++ if (ret) { |
6500 |
++ v4l2_err(&dev->v4l2_dev, "Failed to register video device\n"); |
6501 |
++ goto free_m2m; |
6502 |
++ } |
6503 |
++ video_set_drvdata(vfd, dev); |
6504 |
++ dev->vfd = vfd; |
6505 |
++ v4l2_info(&dev->v4l2_dev, "device registered as /dev/video%d\n", |
6506 |
++ vfd->num); |
6507 |
++ |
6508 |
+ return 0; |
6509 |
+ |
6510 |
+-unreg_video_dev: |
6511 |
+- video_unregister_device(dev->vfd); |
6512 |
++free_m2m: |
6513 |
++ v4l2_m2m_release(dev->m2m_dev); |
6514 |
+ rel_vdev: |
6515 |
+ video_device_release(vfd); |
6516 |
+ unreg_v4l2_dev: |
6517 |
+diff --git a/drivers/media/usb/dvb-usb/Kconfig b/drivers/media/usb/dvb-usb/Kconfig |
6518 |
+index 1a3e5f965ae4..2d7a5c1c84af 100644 |
6519 |
+--- a/drivers/media/usb/dvb-usb/Kconfig |
6520 |
++++ b/drivers/media/usb/dvb-usb/Kconfig |
6521 |
+@@ -150,6 +150,7 @@ config DVB_USB_CXUSB |
6522 |
+ config DVB_USB_CXUSB_ANALOG |
6523 |
+ bool "Analog support for the Conexant USB2.0 hybrid reference design" |
6524 |
+ depends on DVB_USB_CXUSB && VIDEO_V4L2 |
6525 |
++ depends on VIDEO_V4L2=y || VIDEO_V4L2=DVB_USB_CXUSB |
6526 |
+ select VIDEO_CX25840 |
6527 |
+ select VIDEOBUF2_VMALLOC |
6528 |
+ help |
6529 |
+diff --git a/drivers/media/usb/go7007/go7007-usb.c b/drivers/media/usb/go7007/go7007-usb.c |
6530 |
+index f889c9d740cd..dbf0455d5d50 100644 |
6531 |
+--- a/drivers/media/usb/go7007/go7007-usb.c |
6532 |
++++ b/drivers/media/usb/go7007/go7007-usb.c |
6533 |
+@@ -1132,6 +1132,10 @@ static int go7007_usb_probe(struct usb_interface *intf, |
6534 |
+ go->hpi_ops = &go7007_usb_onboard_hpi_ops; |
6535 |
+ go->hpi_context = usb; |
6536 |
+ |
6537 |
++ ep = usb->usbdev->ep_in[4]; |
6538 |
++ if (!ep) |
6539 |
++ return -ENODEV; |
6540 |
++ |
6541 |
+ /* Allocate the URB and buffer for receiving incoming interrupts */ |
6542 |
+ usb->intr_urb = usb_alloc_urb(0, GFP_KERNEL); |
6543 |
+ if (usb->intr_urb == NULL) |
6544 |
+@@ -1141,7 +1145,6 @@ static int go7007_usb_probe(struct usb_interface *intf, |
6545 |
+ if (usb->intr_urb->transfer_buffer == NULL) |
6546 |
+ goto allocfail; |
6547 |
+ |
6548 |
+- ep = usb->usbdev->ep_in[4]; |
6549 |
+ if (usb_endpoint_type(&ep->desc) == USB_ENDPOINT_XFER_BULK) |
6550 |
+ usb_fill_bulk_urb(usb->intr_urb, usb->usbdev, |
6551 |
+ usb_rcvbulkpipe(usb->usbdev, 4), |
6552 |
+@@ -1263,9 +1266,13 @@ static int go7007_usb_probe(struct usb_interface *intf, |
6553 |
+ |
6554 |
+ /* Allocate the URBs and buffers for receiving the video stream */ |
6555 |
+ if (board->flags & GO7007_USB_EZUSB) { |
6556 |
++ if (!usb->usbdev->ep_in[6]) |
6557 |
++ goto allocfail; |
6558 |
+ v_urb_len = 1024; |
6559 |
+ video_pipe = usb_rcvbulkpipe(usb->usbdev, 6); |
6560 |
+ } else { |
6561 |
++ if (!usb->usbdev->ep_in[1]) |
6562 |
++ goto allocfail; |
6563 |
+ v_urb_len = 512; |
6564 |
+ video_pipe = usb_rcvbulkpipe(usb->usbdev, 1); |
6565 |
+ } |
6566 |
+@@ -1285,6 +1292,8 @@ static int go7007_usb_probe(struct usb_interface *intf, |
6567 |
+ /* Allocate the URBs and buffers for receiving the audio stream */ |
6568 |
+ if ((board->flags & GO7007_USB_EZUSB) && |
6569 |
+ (board->main_info.flags & GO7007_BOARD_HAS_AUDIO)) { |
6570 |
++ if (!usb->usbdev->ep_in[8]) |
6571 |
++ goto allocfail; |
6572 |
+ for (i = 0; i < 8; ++i) { |
6573 |
+ usb->audio_urbs[i] = usb_alloc_urb(0, GFP_KERNEL); |
6574 |
+ if (usb->audio_urbs[i] == NULL) |
6575 |
+diff --git a/drivers/memory/samsung/exynos5422-dmc.c b/drivers/memory/samsung/exynos5422-dmc.c |
6576 |
+index 22a43d662833..3460ba55fd59 100644 |
6577 |
+--- a/drivers/memory/samsung/exynos5422-dmc.c |
6578 |
++++ b/drivers/memory/samsung/exynos5422-dmc.c |
6579 |
+@@ -270,12 +270,14 @@ static int find_target_freq_idx(struct exynos5_dmc *dmc, |
6580 |
+ * This function switches between these banks according to the |
6581 |
+ * currently used clock source. |
6582 |
+ */ |
6583 |
+-static void exynos5_switch_timing_regs(struct exynos5_dmc *dmc, bool set) |
6584 |
++static int exynos5_switch_timing_regs(struct exynos5_dmc *dmc, bool set) |
6585 |
+ { |
6586 |
+ unsigned int reg; |
6587 |
+ int ret; |
6588 |
+ |
6589 |
+ ret = regmap_read(dmc->clk_regmap, CDREX_LPDDR3PHY_CON3, ®); |
6590 |
++ if (ret) |
6591 |
++ return ret; |
6592 |
+ |
6593 |
+ if (set) |
6594 |
+ reg |= EXYNOS5_TIMING_SET_SWI; |
6595 |
+@@ -283,6 +285,8 @@ static void exynos5_switch_timing_regs(struct exynos5_dmc *dmc, bool set) |
6596 |
+ reg &= ~EXYNOS5_TIMING_SET_SWI; |
6597 |
+ |
6598 |
+ regmap_write(dmc->clk_regmap, CDREX_LPDDR3PHY_CON3, reg); |
6599 |
++ |
6600 |
++ return 0; |
6601 |
+ } |
6602 |
+ |
6603 |
+ /** |
6604 |
+@@ -516,7 +520,7 @@ exynos5_dmc_switch_to_bypass_configuration(struct exynos5_dmc *dmc, |
6605 |
+ /* |
6606 |
+ * Delays are long enough, so use them for the new coming clock. |
6607 |
+ */ |
6608 |
+- exynos5_switch_timing_regs(dmc, USE_MX_MSPLL_TIMINGS); |
6609 |
++ ret = exynos5_switch_timing_regs(dmc, USE_MX_MSPLL_TIMINGS); |
6610 |
+ |
6611 |
+ return ret; |
6612 |
+ } |
6613 |
+@@ -577,7 +581,9 @@ exynos5_dmc_change_freq_and_volt(struct exynos5_dmc *dmc, |
6614 |
+ |
6615 |
+ clk_set_rate(dmc->fout_bpll, target_rate); |
6616 |
+ |
6617 |
+- exynos5_switch_timing_regs(dmc, USE_BPLL_TIMINGS); |
6618 |
++ ret = exynos5_switch_timing_regs(dmc, USE_BPLL_TIMINGS); |
6619 |
++ if (ret) |
6620 |
++ goto disable_clocks; |
6621 |
+ |
6622 |
+ ret = clk_set_parent(dmc->mout_mclk_cdrex, dmc->mout_bpll); |
6623 |
+ if (ret) |
6624 |
+diff --git a/drivers/memory/tegra/tegra186-emc.c b/drivers/memory/tegra/tegra186-emc.c |
6625 |
+index 97f26bc77ad4..c900948881d5 100644 |
6626 |
+--- a/drivers/memory/tegra/tegra186-emc.c |
6627 |
++++ b/drivers/memory/tegra/tegra186-emc.c |
6628 |
+@@ -185,7 +185,7 @@ static int tegra186_emc_probe(struct platform_device *pdev) |
6629 |
+ if (IS_ERR(emc->clk)) { |
6630 |
+ err = PTR_ERR(emc->clk); |
6631 |
+ dev_err(&pdev->dev, "failed to get EMC clock: %d\n", err); |
6632 |
+- return err; |
6633 |
++ goto put_bpmp; |
6634 |
+ } |
6635 |
+ |
6636 |
+ platform_set_drvdata(pdev, emc); |
6637 |
+@@ -201,7 +201,7 @@ static int tegra186_emc_probe(struct platform_device *pdev) |
6638 |
+ err = tegra_bpmp_transfer(emc->bpmp, &msg); |
6639 |
+ if (err < 0) { |
6640 |
+ dev_err(&pdev->dev, "failed to EMC DVFS pairs: %d\n", err); |
6641 |
+- return err; |
6642 |
++ goto put_bpmp; |
6643 |
+ } |
6644 |
+ |
6645 |
+ emc->debugfs.min_rate = ULONG_MAX; |
6646 |
+@@ -211,8 +211,10 @@ static int tegra186_emc_probe(struct platform_device *pdev) |
6647 |
+ |
6648 |
+ emc->dvfs = devm_kmalloc_array(&pdev->dev, emc->num_dvfs, |
6649 |
+ sizeof(*emc->dvfs), GFP_KERNEL); |
6650 |
+- if (!emc->dvfs) |
6651 |
+- return -ENOMEM; |
6652 |
++ if (!emc->dvfs) { |
6653 |
++ err = -ENOMEM; |
6654 |
++ goto put_bpmp; |
6655 |
++ } |
6656 |
+ |
6657 |
+ dev_dbg(&pdev->dev, "%u DVFS pairs:\n", emc->num_dvfs); |
6658 |
+ |
6659 |
+@@ -237,7 +239,7 @@ static int tegra186_emc_probe(struct platform_device *pdev) |
6660 |
+ "failed to set rate range [%lu-%lu] for %pC\n", |
6661 |
+ emc->debugfs.min_rate, emc->debugfs.max_rate, |
6662 |
+ emc->clk); |
6663 |
+- return err; |
6664 |
++ goto put_bpmp; |
6665 |
+ } |
6666 |
+ |
6667 |
+ emc->debugfs.root = debugfs_create_dir("emc", NULL); |
6668 |
+@@ -254,6 +256,10 @@ static int tegra186_emc_probe(struct platform_device *pdev) |
6669 |
+ emc, &tegra186_emc_debug_max_rate_fops); |
6670 |
+ |
6671 |
+ return 0; |
6672 |
++ |
6673 |
++put_bpmp: |
6674 |
++ tegra_bpmp_put(emc->bpmp); |
6675 |
++ return err; |
6676 |
+ } |
6677 |
+ |
6678 |
+ static int tegra186_emc_remove(struct platform_device *pdev) |
6679 |
+diff --git a/drivers/mfd/ioc3.c b/drivers/mfd/ioc3.c |
6680 |
+index 74cee7cb0afc..d939ccc46509 100644 |
6681 |
+--- a/drivers/mfd/ioc3.c |
6682 |
++++ b/drivers/mfd/ioc3.c |
6683 |
+@@ -616,7 +616,10 @@ static int ioc3_mfd_probe(struct pci_dev *pdev, |
6684 |
+ /* Remove all already added MFD devices */ |
6685 |
+ mfd_remove_devices(&ipd->pdev->dev); |
6686 |
+ if (ipd->domain) { |
6687 |
++ struct fwnode_handle *fn = ipd->domain->fwnode; |
6688 |
++ |
6689 |
+ irq_domain_remove(ipd->domain); |
6690 |
++ irq_domain_free_fwnode(fn); |
6691 |
+ free_irq(ipd->domain_irq, (void *)ipd); |
6692 |
+ } |
6693 |
+ pci_iounmap(pdev, regs); |
6694 |
+@@ -643,7 +646,10 @@ static void ioc3_mfd_remove(struct pci_dev *pdev) |
6695 |
+ /* Release resources */ |
6696 |
+ mfd_remove_devices(&ipd->pdev->dev); |
6697 |
+ if (ipd->domain) { |
6698 |
++ struct fwnode_handle *fn = ipd->domain->fwnode; |
6699 |
++ |
6700 |
+ irq_domain_remove(ipd->domain); |
6701 |
++ irq_domain_free_fwnode(fn); |
6702 |
+ free_irq(ipd->domain_irq, (void *)ipd); |
6703 |
+ } |
6704 |
+ pci_iounmap(pdev, ipd->regs); |
6705 |
+diff --git a/drivers/misc/cxl/sysfs.c b/drivers/misc/cxl/sysfs.c |
6706 |
+index f0263d1a1fdf..d97a243ad30c 100644 |
6707 |
+--- a/drivers/misc/cxl/sysfs.c |
6708 |
++++ b/drivers/misc/cxl/sysfs.c |
6709 |
+@@ -624,7 +624,7 @@ static struct afu_config_record *cxl_sysfs_afu_new_cr(struct cxl_afu *afu, int c |
6710 |
+ rc = kobject_init_and_add(&cr->kobj, &afu_config_record_type, |
6711 |
+ &afu->dev.kobj, "cr%i", cr->cr); |
6712 |
+ if (rc) |
6713 |
+- goto err; |
6714 |
++ goto err1; |
6715 |
+ |
6716 |
+ rc = sysfs_create_bin_file(&cr->kobj, &cr->config_attr); |
6717 |
+ if (rc) |
6718 |
+diff --git a/drivers/misc/lkdtm/bugs.c b/drivers/misc/lkdtm/bugs.c |
6719 |
+index 886459e0ddd9..7913c9ff216c 100644 |
6720 |
+--- a/drivers/misc/lkdtm/bugs.c |
6721 |
++++ b/drivers/misc/lkdtm/bugs.c |
6722 |
+@@ -13,7 +13,7 @@ |
6723 |
+ #include <linux/uaccess.h> |
6724 |
+ #include <linux/slab.h> |
6725 |
+ |
6726 |
+-#ifdef CONFIG_X86_32 |
6727 |
++#if IS_ENABLED(CONFIG_X86_32) && !IS_ENABLED(CONFIG_UML) |
6728 |
+ #include <asm/desc.h> |
6729 |
+ #endif |
6730 |
+ |
6731 |
+@@ -118,9 +118,8 @@ noinline void lkdtm_CORRUPT_STACK(void) |
6732 |
+ /* Use default char array length that triggers stack protection. */ |
6733 |
+ char data[8] __aligned(sizeof(void *)); |
6734 |
+ |
6735 |
+- __lkdtm_CORRUPT_STACK(&data); |
6736 |
+- |
6737 |
+- pr_info("Corrupted stack containing char array ...\n"); |
6738 |
++ pr_info("Corrupting stack containing char array ...\n"); |
6739 |
++ __lkdtm_CORRUPT_STACK((void *)&data); |
6740 |
+ } |
6741 |
+ |
6742 |
+ /* Same as above but will only get a canary with -fstack-protector-strong */ |
6743 |
+@@ -131,9 +130,8 @@ noinline void lkdtm_CORRUPT_STACK_STRONG(void) |
6744 |
+ unsigned long *ptr; |
6745 |
+ } data __aligned(sizeof(void *)); |
6746 |
+ |
6747 |
+- __lkdtm_CORRUPT_STACK(&data); |
6748 |
+- |
6749 |
+- pr_info("Corrupted stack containing union ...\n"); |
6750 |
++ pr_info("Corrupting stack containing union ...\n"); |
6751 |
++ __lkdtm_CORRUPT_STACK((void *)&data); |
6752 |
+ } |
6753 |
+ |
6754 |
+ void lkdtm_UNALIGNED_LOAD_STORE_WRITE(void) |
6755 |
+@@ -248,6 +246,7 @@ void lkdtm_ARRAY_BOUNDS(void) |
6756 |
+ |
6757 |
+ kfree(not_checked); |
6758 |
+ kfree(checked); |
6759 |
++ pr_err("FAIL: survived array bounds overflow!\n"); |
6760 |
+ } |
6761 |
+ |
6762 |
+ void lkdtm_CORRUPT_LIST_ADD(void) |
6763 |
+@@ -419,7 +418,7 @@ void lkdtm_UNSET_SMEP(void) |
6764 |
+ |
6765 |
+ void lkdtm_DOUBLE_FAULT(void) |
6766 |
+ { |
6767 |
+-#ifdef CONFIG_X86_32 |
6768 |
++#if IS_ENABLED(CONFIG_X86_32) && !IS_ENABLED(CONFIG_UML) |
6769 |
+ /* |
6770 |
+ * Trigger #DF by setting the stack limit to zero. This clobbers |
6771 |
+ * a GDT TLS slot, which is okay because the current task will die |
6772 |
+@@ -454,38 +453,42 @@ void lkdtm_DOUBLE_FAULT(void) |
6773 |
+ #endif |
6774 |
+ } |
6775 |
+ |
6776 |
+-#ifdef CONFIG_ARM64_PTR_AUTH |
6777 |
++#ifdef CONFIG_ARM64 |
6778 |
+ static noinline void change_pac_parameters(void) |
6779 |
+ { |
6780 |
+- /* Reset the keys of current task */ |
6781 |
+- ptrauth_thread_init_kernel(current); |
6782 |
+- ptrauth_thread_switch_kernel(current); |
6783 |
++ if (IS_ENABLED(CONFIG_ARM64_PTR_AUTH)) { |
6784 |
++ /* Reset the keys of current task */ |
6785 |
++ ptrauth_thread_init_kernel(current); |
6786 |
++ ptrauth_thread_switch_kernel(current); |
6787 |
++ } |
6788 |
+ } |
6789 |
++#endif |
6790 |
+ |
6791 |
+-#define CORRUPT_PAC_ITERATE 10 |
6792 |
+ noinline void lkdtm_CORRUPT_PAC(void) |
6793 |
+ { |
6794 |
++#ifdef CONFIG_ARM64 |
6795 |
++#define CORRUPT_PAC_ITERATE 10 |
6796 |
+ int i; |
6797 |
+ |
6798 |
++ if (!IS_ENABLED(CONFIG_ARM64_PTR_AUTH)) |
6799 |
++ pr_err("FAIL: kernel not built with CONFIG_ARM64_PTR_AUTH\n"); |
6800 |
++ |
6801 |
+ if (!system_supports_address_auth()) { |
6802 |
+- pr_err("FAIL: arm64 pointer authentication feature not present\n"); |
6803 |
++ pr_err("FAIL: CPU lacks pointer authentication feature\n"); |
6804 |
+ return; |
6805 |
+ } |
6806 |
+ |
6807 |
+- pr_info("Change the PAC parameters to force function return failure\n"); |
6808 |
++ pr_info("changing PAC parameters to force function return failure...\n"); |
6809 |
+ /* |
6810 |
+- * Pac is a hash value computed from input keys, return address and |
6811 |
++ * PAC is a hash value computed from input keys, return address and |
6812 |
+ * stack pointer. As pac has fewer bits so there is a chance of |
6813 |
+ * collision, so iterate few times to reduce the collision probability. |
6814 |
+ */ |
6815 |
+ for (i = 0; i < CORRUPT_PAC_ITERATE; i++) |
6816 |
+ change_pac_parameters(); |
6817 |
+ |
6818 |
+- pr_err("FAIL: %s test failed. Kernel may be unstable from here\n", __func__); |
6819 |
+-} |
6820 |
+-#else /* !CONFIG_ARM64_PTR_AUTH */ |
6821 |
+-noinline void lkdtm_CORRUPT_PAC(void) |
6822 |
+-{ |
6823 |
+- pr_err("FAIL: arm64 pointer authentication config disabled\n"); |
6824 |
+-} |
6825 |
++ pr_err("FAIL: survived PAC changes! Kernel may be unstable from here\n"); |
6826 |
++#else |
6827 |
++ pr_err("XFAIL: this test is arm64-only\n"); |
6828 |
+ #endif |
6829 |
++} |
6830 |
+diff --git a/drivers/misc/lkdtm/lkdtm.h b/drivers/misc/lkdtm/lkdtm.h |
6831 |
+index 601a2156a0d4..8878538b2c13 100644 |
6832 |
+--- a/drivers/misc/lkdtm/lkdtm.h |
6833 |
++++ b/drivers/misc/lkdtm/lkdtm.h |
6834 |
+@@ -31,9 +31,7 @@ void lkdtm_CORRUPT_USER_DS(void); |
6835 |
+ void lkdtm_STACK_GUARD_PAGE_LEADING(void); |
6836 |
+ void lkdtm_STACK_GUARD_PAGE_TRAILING(void); |
6837 |
+ void lkdtm_UNSET_SMEP(void); |
6838 |
+-#ifdef CONFIG_X86_32 |
6839 |
+ void lkdtm_DOUBLE_FAULT(void); |
6840 |
+-#endif |
6841 |
+ void lkdtm_CORRUPT_PAC(void); |
6842 |
+ |
6843 |
+ /* lkdtm_heap.c */ |
6844 |
+diff --git a/drivers/misc/lkdtm/perms.c b/drivers/misc/lkdtm/perms.c |
6845 |
+index 62f76d506f04..2dede2ef658f 100644 |
6846 |
+--- a/drivers/misc/lkdtm/perms.c |
6847 |
++++ b/drivers/misc/lkdtm/perms.c |
6848 |
+@@ -57,6 +57,7 @@ static noinline void execute_location(void *dst, bool write) |
6849 |
+ } |
6850 |
+ pr_info("attempting bad execution at %px\n", func); |
6851 |
+ func(); |
6852 |
++ pr_err("FAIL: func returned\n"); |
6853 |
+ } |
6854 |
+ |
6855 |
+ static void execute_user_location(void *dst) |
6856 |
+@@ -75,20 +76,22 @@ static void execute_user_location(void *dst) |
6857 |
+ return; |
6858 |
+ pr_info("attempting bad execution at %px\n", func); |
6859 |
+ func(); |
6860 |
++ pr_err("FAIL: func returned\n"); |
6861 |
+ } |
6862 |
+ |
6863 |
+ void lkdtm_WRITE_RO(void) |
6864 |
+ { |
6865 |
+- /* Explicitly cast away "const" for the test. */ |
6866 |
+- unsigned long *ptr = (unsigned long *)&rodata; |
6867 |
++ /* Explicitly cast away "const" for the test and make volatile. */ |
6868 |
++ volatile unsigned long *ptr = (unsigned long *)&rodata; |
6869 |
+ |
6870 |
+ pr_info("attempting bad rodata write at %px\n", ptr); |
6871 |
+ *ptr ^= 0xabcd1234; |
6872 |
++ pr_err("FAIL: survived bad write\n"); |
6873 |
+ } |
6874 |
+ |
6875 |
+ void lkdtm_WRITE_RO_AFTER_INIT(void) |
6876 |
+ { |
6877 |
+- unsigned long *ptr = &ro_after_init; |
6878 |
++ volatile unsigned long *ptr = &ro_after_init; |
6879 |
+ |
6880 |
+ /* |
6881 |
+ * Verify we were written to during init. Since an Oops |
6882 |
+@@ -102,19 +105,21 @@ void lkdtm_WRITE_RO_AFTER_INIT(void) |
6883 |
+ |
6884 |
+ pr_info("attempting bad ro_after_init write at %px\n", ptr); |
6885 |
+ *ptr ^= 0xabcd1234; |
6886 |
++ pr_err("FAIL: survived bad write\n"); |
6887 |
+ } |
6888 |
+ |
6889 |
+ void lkdtm_WRITE_KERN(void) |
6890 |
+ { |
6891 |
+ size_t size; |
6892 |
+- unsigned char *ptr; |
6893 |
++ volatile unsigned char *ptr; |
6894 |
+ |
6895 |
+ size = (unsigned long)do_overwritten - (unsigned long)do_nothing; |
6896 |
+ ptr = (unsigned char *)do_overwritten; |
6897 |
+ |
6898 |
+ pr_info("attempting bad %zu byte write at %px\n", size, ptr); |
6899 |
+- memcpy(ptr, (unsigned char *)do_nothing, size); |
6900 |
++ memcpy((void *)ptr, (unsigned char *)do_nothing, size); |
6901 |
+ flush_icache_range((unsigned long)ptr, (unsigned long)(ptr + size)); |
6902 |
++ pr_err("FAIL: survived bad write\n"); |
6903 |
+ |
6904 |
+ do_overwritten(); |
6905 |
+ } |
6906 |
+@@ -193,9 +198,11 @@ void lkdtm_ACCESS_USERSPACE(void) |
6907 |
+ pr_info("attempting bad read at %px\n", ptr); |
6908 |
+ tmp = *ptr; |
6909 |
+ tmp += 0xc0dec0de; |
6910 |
++ pr_err("FAIL: survived bad read\n"); |
6911 |
+ |
6912 |
+ pr_info("attempting bad write at %px\n", ptr); |
6913 |
+ *ptr = tmp; |
6914 |
++ pr_err("FAIL: survived bad write\n"); |
6915 |
+ |
6916 |
+ vm_munmap(user_addr, PAGE_SIZE); |
6917 |
+ } |
6918 |
+@@ -203,19 +210,20 @@ void lkdtm_ACCESS_USERSPACE(void) |
6919 |
+ void lkdtm_ACCESS_NULL(void) |
6920 |
+ { |
6921 |
+ unsigned long tmp; |
6922 |
+- unsigned long *ptr = (unsigned long *)NULL; |
6923 |
++ volatile unsigned long *ptr = (unsigned long *)NULL; |
6924 |
+ |
6925 |
+ pr_info("attempting bad read at %px\n", ptr); |
6926 |
+ tmp = *ptr; |
6927 |
+ tmp += 0xc0dec0de; |
6928 |
++ pr_err("FAIL: survived bad read\n"); |
6929 |
+ |
6930 |
+ pr_info("attempting bad write at %px\n", ptr); |
6931 |
+ *ptr = tmp; |
6932 |
++ pr_err("FAIL: survived bad write\n"); |
6933 |
+ } |
6934 |
+ |
6935 |
+ void __init lkdtm_perms_init(void) |
6936 |
+ { |
6937 |
+ /* Make sure we can write to __ro_after_init values during __init */ |
6938 |
+ ro_after_init |= 0xAA; |
6939 |
+- |
6940 |
+ } |
6941 |
+diff --git a/drivers/misc/lkdtm/usercopy.c b/drivers/misc/lkdtm/usercopy.c |
6942 |
+index e172719dd86d..b833367a45d0 100644 |
6943 |
+--- a/drivers/misc/lkdtm/usercopy.c |
6944 |
++++ b/drivers/misc/lkdtm/usercopy.c |
6945 |
+@@ -304,19 +304,22 @@ void lkdtm_USERCOPY_KERNEL(void) |
6946 |
+ return; |
6947 |
+ } |
6948 |
+ |
6949 |
+- pr_info("attempting good copy_to_user from kernel rodata\n"); |
6950 |
++ pr_info("attempting good copy_to_user from kernel rodata: %px\n", |
6951 |
++ test_text); |
6952 |
+ if (copy_to_user((void __user *)user_addr, test_text, |
6953 |
+ unconst + sizeof(test_text))) { |
6954 |
+ pr_warn("copy_to_user failed unexpectedly?!\n"); |
6955 |
+ goto free_user; |
6956 |
+ } |
6957 |
+ |
6958 |
+- pr_info("attempting bad copy_to_user from kernel text\n"); |
6959 |
++ pr_info("attempting bad copy_to_user from kernel text: %px\n", |
6960 |
++ vm_mmap); |
6961 |
+ if (copy_to_user((void __user *)user_addr, vm_mmap, |
6962 |
+ unconst + PAGE_SIZE)) { |
6963 |
+ pr_warn("copy_to_user failed, but lacked Oops\n"); |
6964 |
+ goto free_user; |
6965 |
+ } |
6966 |
++ pr_err("FAIL: survived bad copy_to_user()\n"); |
6967 |
+ |
6968 |
+ free_user: |
6969 |
+ vm_munmap(user_addr, PAGE_SIZE); |
6970 |
+diff --git a/drivers/mmc/host/sdhci-cadence.c b/drivers/mmc/host/sdhci-cadence.c |
6971 |
+index 6da6d4fb5edd..07a4cb989a68 100644 |
6972 |
+--- a/drivers/mmc/host/sdhci-cadence.c |
6973 |
++++ b/drivers/mmc/host/sdhci-cadence.c |
6974 |
+@@ -194,57 +194,6 @@ static u32 sdhci_cdns_get_emmc_mode(struct sdhci_cdns_priv *priv) |
6975 |
+ return FIELD_GET(SDHCI_CDNS_HRS06_MODE, tmp); |
6976 |
+ } |
6977 |
+ |
6978 |
+-static void sdhci_cdns_set_uhs_signaling(struct sdhci_host *host, |
6979 |
+- unsigned int timing) |
6980 |
+-{ |
6981 |
+- struct sdhci_cdns_priv *priv = sdhci_cdns_priv(host); |
6982 |
+- u32 mode; |
6983 |
+- |
6984 |
+- switch (timing) { |
6985 |
+- case MMC_TIMING_MMC_HS: |
6986 |
+- mode = SDHCI_CDNS_HRS06_MODE_MMC_SDR; |
6987 |
+- break; |
6988 |
+- case MMC_TIMING_MMC_DDR52: |
6989 |
+- mode = SDHCI_CDNS_HRS06_MODE_MMC_DDR; |
6990 |
+- break; |
6991 |
+- case MMC_TIMING_MMC_HS200: |
6992 |
+- mode = SDHCI_CDNS_HRS06_MODE_MMC_HS200; |
6993 |
+- break; |
6994 |
+- case MMC_TIMING_MMC_HS400: |
6995 |
+- if (priv->enhanced_strobe) |
6996 |
+- mode = SDHCI_CDNS_HRS06_MODE_MMC_HS400ES; |
6997 |
+- else |
6998 |
+- mode = SDHCI_CDNS_HRS06_MODE_MMC_HS400; |
6999 |
+- break; |
7000 |
+- default: |
7001 |
+- mode = SDHCI_CDNS_HRS06_MODE_SD; |
7002 |
+- break; |
7003 |
+- } |
7004 |
+- |
7005 |
+- sdhci_cdns_set_emmc_mode(priv, mode); |
7006 |
+- |
7007 |
+- /* For SD, fall back to the default handler */ |
7008 |
+- if (mode == SDHCI_CDNS_HRS06_MODE_SD) |
7009 |
+- sdhci_set_uhs_signaling(host, timing); |
7010 |
+-} |
7011 |
+- |
7012 |
+-static const struct sdhci_ops sdhci_cdns_ops = { |
7013 |
+- .set_clock = sdhci_set_clock, |
7014 |
+- .get_timeout_clock = sdhci_cdns_get_timeout_clock, |
7015 |
+- .set_bus_width = sdhci_set_bus_width, |
7016 |
+- .reset = sdhci_reset, |
7017 |
+- .set_uhs_signaling = sdhci_cdns_set_uhs_signaling, |
7018 |
+-}; |
7019 |
+- |
7020 |
+-static const struct sdhci_pltfm_data sdhci_cdns_uniphier_pltfm_data = { |
7021 |
+- .ops = &sdhci_cdns_ops, |
7022 |
+- .quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN, |
7023 |
+-}; |
7024 |
+- |
7025 |
+-static const struct sdhci_pltfm_data sdhci_cdns_pltfm_data = { |
7026 |
+- .ops = &sdhci_cdns_ops, |
7027 |
+-}; |
7028 |
+- |
7029 |
+ static int sdhci_cdns_set_tune_val(struct sdhci_host *host, unsigned int val) |
7030 |
+ { |
7031 |
+ struct sdhci_cdns_priv *priv = sdhci_cdns_priv(host); |
7032 |
+@@ -278,23 +227,24 @@ static int sdhci_cdns_set_tune_val(struct sdhci_host *host, unsigned int val) |
7033 |
+ return 0; |
7034 |
+ } |
7035 |
+ |
7036 |
+-static int sdhci_cdns_execute_tuning(struct mmc_host *mmc, u32 opcode) |
7037 |
++/* |
7038 |
++ * In SD mode, software must not use the hardware tuning and instead perform |
7039 |
++ * an almost identical procedure to eMMC. |
7040 |
++ */ |
7041 |
++static int sdhci_cdns_execute_tuning(struct sdhci_host *host, u32 opcode) |
7042 |
+ { |
7043 |
+- struct sdhci_host *host = mmc_priv(mmc); |
7044 |
+ int cur_streak = 0; |
7045 |
+ int max_streak = 0; |
7046 |
+ int end_of_streak = 0; |
7047 |
+ int i; |
7048 |
+ |
7049 |
+ /* |
7050 |
+- * This handler only implements the eMMC tuning that is specific to |
7051 |
+- * this controller. Fall back to the standard method for SD timing. |
7052 |
++ * Do not execute tuning for UHS_SDR50 or UHS_DDR50. |
7053 |
++ * The delay is set by probe, based on the DT properties. |
7054 |
+ */ |
7055 |
+- if (host->timing != MMC_TIMING_MMC_HS200) |
7056 |
+- return sdhci_execute_tuning(mmc, opcode); |
7057 |
+- |
7058 |
+- if (WARN_ON(opcode != MMC_SEND_TUNING_BLOCK_HS200)) |
7059 |
+- return -EINVAL; |
7060 |
++ if (host->timing != MMC_TIMING_MMC_HS200 && |
7061 |
++ host->timing != MMC_TIMING_UHS_SDR104) |
7062 |
++ return 0; |
7063 |
+ |
7064 |
+ for (i = 0; i < SDHCI_CDNS_MAX_TUNING_LOOP; i++) { |
7065 |
+ if (sdhci_cdns_set_tune_val(host, i) || |
7066 |
+@@ -317,6 +267,58 @@ static int sdhci_cdns_execute_tuning(struct mmc_host *mmc, u32 opcode) |
7067 |
+ return sdhci_cdns_set_tune_val(host, end_of_streak - max_streak / 2); |
7068 |
+ } |
7069 |
+ |
7070 |
++static void sdhci_cdns_set_uhs_signaling(struct sdhci_host *host, |
7071 |
++ unsigned int timing) |
7072 |
++{ |
7073 |
++ struct sdhci_cdns_priv *priv = sdhci_cdns_priv(host); |
7074 |
++ u32 mode; |
7075 |
++ |
7076 |
++ switch (timing) { |
7077 |
++ case MMC_TIMING_MMC_HS: |
7078 |
++ mode = SDHCI_CDNS_HRS06_MODE_MMC_SDR; |
7079 |
++ break; |
7080 |
++ case MMC_TIMING_MMC_DDR52: |
7081 |
++ mode = SDHCI_CDNS_HRS06_MODE_MMC_DDR; |
7082 |
++ break; |
7083 |
++ case MMC_TIMING_MMC_HS200: |
7084 |
++ mode = SDHCI_CDNS_HRS06_MODE_MMC_HS200; |
7085 |
++ break; |
7086 |
++ case MMC_TIMING_MMC_HS400: |
7087 |
++ if (priv->enhanced_strobe) |
7088 |
++ mode = SDHCI_CDNS_HRS06_MODE_MMC_HS400ES; |
7089 |
++ else |
7090 |
++ mode = SDHCI_CDNS_HRS06_MODE_MMC_HS400; |
7091 |
++ break; |
7092 |
++ default: |
7093 |
++ mode = SDHCI_CDNS_HRS06_MODE_SD; |
7094 |
++ break; |
7095 |
++ } |
7096 |
++ |
7097 |
++ sdhci_cdns_set_emmc_mode(priv, mode); |
7098 |
++ |
7099 |
++ /* For SD, fall back to the default handler */ |
7100 |
++ if (mode == SDHCI_CDNS_HRS06_MODE_SD) |
7101 |
++ sdhci_set_uhs_signaling(host, timing); |
7102 |
++} |
7103 |
++ |
7104 |
++static const struct sdhci_ops sdhci_cdns_ops = { |
7105 |
++ .set_clock = sdhci_set_clock, |
7106 |
++ .get_timeout_clock = sdhci_cdns_get_timeout_clock, |
7107 |
++ .set_bus_width = sdhci_set_bus_width, |
7108 |
++ .reset = sdhci_reset, |
7109 |
++ .platform_execute_tuning = sdhci_cdns_execute_tuning, |
7110 |
++ .set_uhs_signaling = sdhci_cdns_set_uhs_signaling, |
7111 |
++}; |
7112 |
++ |
7113 |
++static const struct sdhci_pltfm_data sdhci_cdns_uniphier_pltfm_data = { |
7114 |
++ .ops = &sdhci_cdns_ops, |
7115 |
++ .quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN, |
7116 |
++}; |
7117 |
++ |
7118 |
++static const struct sdhci_pltfm_data sdhci_cdns_pltfm_data = { |
7119 |
++ .ops = &sdhci_cdns_ops, |
7120 |
++}; |
7121 |
++ |
7122 |
+ static void sdhci_cdns_hs400_enhanced_strobe(struct mmc_host *mmc, |
7123 |
+ struct mmc_ios *ios) |
7124 |
+ { |
7125 |
+@@ -377,7 +379,6 @@ static int sdhci_cdns_probe(struct platform_device *pdev) |
7126 |
+ priv->hrs_addr = host->ioaddr; |
7127 |
+ priv->enhanced_strobe = false; |
7128 |
+ host->ioaddr += SDHCI_CDNS_SRS_BASE; |
7129 |
+- host->mmc_host_ops.execute_tuning = sdhci_cdns_execute_tuning; |
7130 |
+ host->mmc_host_ops.hs400_enhanced_strobe = |
7131 |
+ sdhci_cdns_hs400_enhanced_strobe; |
7132 |
+ sdhci_enable_v4_mode(host); |
7133 |
+diff --git a/drivers/mmc/host/sdhci-of-arasan.c b/drivers/mmc/host/sdhci-of-arasan.c |
7134 |
+index d4905c106c06..28091d3f704b 100644 |
7135 |
+--- a/drivers/mmc/host/sdhci-of-arasan.c |
7136 |
++++ b/drivers/mmc/host/sdhci-of-arasan.c |
7137 |
+@@ -1020,6 +1020,8 @@ sdhci_arasan_register_sdcardclk(struct sdhci_arasan_data *sdhci_arasan, |
7138 |
+ clk_data->sdcardclk_hw.init = &sdcardclk_init; |
7139 |
+ clk_data->sdcardclk = |
7140 |
+ devm_clk_register(dev, &clk_data->sdcardclk_hw); |
7141 |
++ if (IS_ERR(clk_data->sdcardclk)) |
7142 |
++ return PTR_ERR(clk_data->sdcardclk); |
7143 |
+ clk_data->sdcardclk_hw.init = NULL; |
7144 |
+ |
7145 |
+ ret = of_clk_add_provider(np, of_clk_src_simple_get, |
7146 |
+@@ -1072,6 +1074,8 @@ sdhci_arasan_register_sampleclk(struct sdhci_arasan_data *sdhci_arasan, |
7147 |
+ clk_data->sampleclk_hw.init = &sampleclk_init; |
7148 |
+ clk_data->sampleclk = |
7149 |
+ devm_clk_register(dev, &clk_data->sampleclk_hw); |
7150 |
++ if (IS_ERR(clk_data->sampleclk)) |
7151 |
++ return PTR_ERR(clk_data->sampleclk); |
7152 |
+ clk_data->sampleclk_hw.init = NULL; |
7153 |
+ |
7154 |
+ ret = of_clk_add_provider(np, of_clk_src_simple_get, |
7155 |
+diff --git a/drivers/mmc/host/sdhci-pci-o2micro.c b/drivers/mmc/host/sdhci-pci-o2micro.c |
7156 |
+index fa8105087d68..41a2394313dd 100644 |
7157 |
+--- a/drivers/mmc/host/sdhci-pci-o2micro.c |
7158 |
++++ b/drivers/mmc/host/sdhci-pci-o2micro.c |
7159 |
+@@ -561,6 +561,12 @@ int sdhci_pci_o2_probe_slot(struct sdhci_pci_slot *slot) |
7160 |
+ slot->host->mmc_host_ops.get_cd = sdhci_o2_get_cd; |
7161 |
+ } |
7162 |
+ |
7163 |
++ if (chip->pdev->device == PCI_DEVICE_ID_O2_SEABIRD1) { |
7164 |
++ slot->host->mmc_host_ops.get_cd = sdhci_o2_get_cd; |
7165 |
++ host->mmc->caps2 |= MMC_CAP2_NO_SDIO; |
7166 |
++ host->quirks2 |= SDHCI_QUIRK2_PRESET_VALUE_BROKEN; |
7167 |
++ } |
7168 |
++ |
7169 |
+ host->mmc_host_ops.execute_tuning = sdhci_o2_execute_tuning; |
7170 |
+ |
7171 |
+ if (chip->pdev->device != PCI_DEVICE_ID_O2_FUJIN2) |
7172 |
+diff --git a/drivers/most/core.c b/drivers/most/core.c |
7173 |
+index f781c46cd4af..353ab277cbc6 100644 |
7174 |
+--- a/drivers/most/core.c |
7175 |
++++ b/drivers/most/core.c |
7176 |
+@@ -1283,10 +1283,8 @@ int most_register_interface(struct most_interface *iface) |
7177 |
+ struct most_channel *c; |
7178 |
+ |
7179 |
+ if (!iface || !iface->enqueue || !iface->configure || |
7180 |
+- !iface->poison_channel || (iface->num_channels > MAX_CHANNELS)) { |
7181 |
+- dev_err(iface->dev, "Bad interface or channel overflow\n"); |
7182 |
++ !iface->poison_channel || (iface->num_channels > MAX_CHANNELS)) |
7183 |
+ return -EINVAL; |
7184 |
+- } |
7185 |
+ |
7186 |
+ id = ida_simple_get(&mdev_id, 0, 0, GFP_KERNEL); |
7187 |
+ if (id < 0) { |
7188 |
+diff --git a/drivers/mtd/nand/raw/brcmnand/brcmnand.c b/drivers/mtd/nand/raw/brcmnand/brcmnand.c |
7189 |
+index 968ff7703925..cdae2311a3b6 100644 |
7190 |
+--- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c |
7191 |
++++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c |
7192 |
+@@ -2960,8 +2960,9 @@ int brcmnand_probe(struct platform_device *pdev, struct brcmnand_soc *soc) |
7193 |
+ if (ret < 0) |
7194 |
+ goto err; |
7195 |
+ |
7196 |
+- /* set edu transfer function to call */ |
7197 |
+- ctrl->dma_trans = brcmnand_edu_trans; |
7198 |
++ if (has_edu(ctrl)) |
7199 |
++ /* set edu transfer function to call */ |
7200 |
++ ctrl->dma_trans = brcmnand_edu_trans; |
7201 |
+ } |
7202 |
+ |
7203 |
+ /* Disable automatic device ID config, direct addressing */ |
7204 |
+diff --git a/drivers/mtd/nand/raw/qcom_nandc.c b/drivers/mtd/nand/raw/qcom_nandc.c |
7205 |
+index 5b11c7061497..d1216aa9dc0c 100644 |
7206 |
+--- a/drivers/mtd/nand/raw/qcom_nandc.c |
7207 |
++++ b/drivers/mtd/nand/raw/qcom_nandc.c |
7208 |
+@@ -459,11 +459,13 @@ struct qcom_nand_host { |
7209 |
+ * among different NAND controllers. |
7210 |
+ * @ecc_modes - ecc mode for NAND |
7211 |
+ * @is_bam - whether NAND controller is using BAM |
7212 |
++ * @is_qpic - whether NAND CTRL is part of qpic IP |
7213 |
+ * @dev_cmd_reg_start - NAND_DEV_CMD_* registers starting offset |
7214 |
+ */ |
7215 |
+ struct qcom_nandc_props { |
7216 |
+ u32 ecc_modes; |
7217 |
+ bool is_bam; |
7218 |
++ bool is_qpic; |
7219 |
+ u32 dev_cmd_reg_start; |
7220 |
+ }; |
7221 |
+ |
7222 |
+@@ -2774,7 +2776,8 @@ static int qcom_nandc_setup(struct qcom_nand_controller *nandc) |
7223 |
+ u32 nand_ctrl; |
7224 |
+ |
7225 |
+ /* kill onenand */ |
7226 |
+- nandc_write(nandc, SFLASHC_BURST_CFG, 0); |
7227 |
++ if (!nandc->props->is_qpic) |
7228 |
++ nandc_write(nandc, SFLASHC_BURST_CFG, 0); |
7229 |
+ nandc_write(nandc, dev_cmd_reg_addr(nandc, NAND_DEV_CMD_VLD), |
7230 |
+ NAND_DEV_CMD_VLD_VAL); |
7231 |
+ |
7232 |
+@@ -3030,12 +3033,14 @@ static const struct qcom_nandc_props ipq806x_nandc_props = { |
7233 |
+ static const struct qcom_nandc_props ipq4019_nandc_props = { |
7234 |
+ .ecc_modes = (ECC_BCH_4BIT | ECC_BCH_8BIT), |
7235 |
+ .is_bam = true, |
7236 |
++ .is_qpic = true, |
7237 |
+ .dev_cmd_reg_start = 0x0, |
7238 |
+ }; |
7239 |
+ |
7240 |
+ static const struct qcom_nandc_props ipq8074_nandc_props = { |
7241 |
+ .ecc_modes = (ECC_BCH_4BIT | ECC_BCH_8BIT), |
7242 |
+ .is_bam = true, |
7243 |
++ .is_qpic = true, |
7244 |
+ .dev_cmd_reg_start = 0x7000, |
7245 |
+ }; |
7246 |
+ |
7247 |
+diff --git a/drivers/mtd/spi-nor/controllers/intel-spi.c b/drivers/mtd/spi-nor/controllers/intel-spi.c |
7248 |
+index 61d2a0ad2131..3259c9fc981f 100644 |
7249 |
+--- a/drivers/mtd/spi-nor/controllers/intel-spi.c |
7250 |
++++ b/drivers/mtd/spi-nor/controllers/intel-spi.c |
7251 |
+@@ -612,6 +612,15 @@ static int intel_spi_write_reg(struct spi_nor *nor, u8 opcode, const u8 *buf, |
7252 |
+ return 0; |
7253 |
+ } |
7254 |
+ |
7255 |
++ /* |
7256 |
++ * We hope that HW sequencer will do the right thing automatically and |
7257 |
++ * with the SW sequencer we cannot use preopcode anyway, so just ignore |
7258 |
++ * the Write Disable operation and pretend it was completed |
7259 |
++ * successfully. |
7260 |
++ */ |
7261 |
++ if (opcode == SPINOR_OP_WRDI) |
7262 |
++ return 0; |
7263 |
++ |
7264 |
+ writel(0, ispi->base + FADDR); |
7265 |
+ |
7266 |
+ /* Write the value beforehand */ |
7267 |
+diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c |
7268 |
+index e065be419a03..18c892df0a13 100644 |
7269 |
+--- a/drivers/net/dsa/mv88e6xxx/chip.c |
7270 |
++++ b/drivers/net/dsa/mv88e6xxx/chip.c |
7271 |
+@@ -3477,7 +3477,6 @@ static const struct mv88e6xxx_ops mv88e6097_ops = { |
7272 |
+ .port_set_frame_mode = mv88e6351_port_set_frame_mode, |
7273 |
+ .port_set_egress_floods = mv88e6352_port_set_egress_floods, |
7274 |
+ .port_set_ether_type = mv88e6351_port_set_ether_type, |
7275 |
+- .port_set_jumbo_size = mv88e6165_port_set_jumbo_size, |
7276 |
+ .port_egress_rate_limiting = mv88e6095_port_egress_rate_limiting, |
7277 |
+ .port_pause_limit = mv88e6097_port_pause_limit, |
7278 |
+ .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit, |
7279 |
+diff --git a/drivers/net/dsa/rtl8366.c b/drivers/net/dsa/rtl8366.c |
7280 |
+index ac88caca5ad4..1368816abaed 100644 |
7281 |
+--- a/drivers/net/dsa/rtl8366.c |
7282 |
++++ b/drivers/net/dsa/rtl8366.c |
7283 |
+@@ -43,18 +43,26 @@ int rtl8366_set_vlan(struct realtek_smi *smi, int vid, u32 member, |
7284 |
+ int ret; |
7285 |
+ int i; |
7286 |
+ |
7287 |
++ dev_dbg(smi->dev, |
7288 |
++ "setting VLAN%d 4k members: 0x%02x, untagged: 0x%02x\n", |
7289 |
++ vid, member, untag); |
7290 |
++ |
7291 |
+ /* Update the 4K table */ |
7292 |
+ ret = smi->ops->get_vlan_4k(smi, vid, &vlan4k); |
7293 |
+ if (ret) |
7294 |
+ return ret; |
7295 |
+ |
7296 |
+- vlan4k.member = member; |
7297 |
+- vlan4k.untag = untag; |
7298 |
++ vlan4k.member |= member; |
7299 |
++ vlan4k.untag |= untag; |
7300 |
+ vlan4k.fid = fid; |
7301 |
+ ret = smi->ops->set_vlan_4k(smi, &vlan4k); |
7302 |
+ if (ret) |
7303 |
+ return ret; |
7304 |
+ |
7305 |
++ dev_dbg(smi->dev, |
7306 |
++ "resulting VLAN%d 4k members: 0x%02x, untagged: 0x%02x\n", |
7307 |
++ vid, vlan4k.member, vlan4k.untag); |
7308 |
++ |
7309 |
+ /* Try to find an existing MC entry for this VID */ |
7310 |
+ for (i = 0; i < smi->num_vlan_mc; i++) { |
7311 |
+ struct rtl8366_vlan_mc vlanmc; |
7312 |
+@@ -65,11 +73,16 @@ int rtl8366_set_vlan(struct realtek_smi *smi, int vid, u32 member, |
7313 |
+ |
7314 |
+ if (vid == vlanmc.vid) { |
7315 |
+ /* update the MC entry */ |
7316 |
+- vlanmc.member = member; |
7317 |
+- vlanmc.untag = untag; |
7318 |
++ vlanmc.member |= member; |
7319 |
++ vlanmc.untag |= untag; |
7320 |
+ vlanmc.fid = fid; |
7321 |
+ |
7322 |
+ ret = smi->ops->set_vlan_mc(smi, i, &vlanmc); |
7323 |
++ |
7324 |
++ dev_dbg(smi->dev, |
7325 |
++ "resulting VLAN%d MC members: 0x%02x, untagged: 0x%02x\n", |
7326 |
++ vid, vlanmc.member, vlanmc.untag); |
7327 |
++ |
7328 |
+ break; |
7329 |
+ } |
7330 |
+ } |
7331 |
+@@ -384,7 +397,7 @@ void rtl8366_vlan_add(struct dsa_switch *ds, int port, |
7332 |
+ if (dsa_is_dsa_port(ds, port) || dsa_is_cpu_port(ds, port)) |
7333 |
+ dev_err(smi->dev, "port is DSA or CPU port\n"); |
7334 |
+ |
7335 |
+- for (vid = vlan->vid_begin; vid <= vlan->vid_end; ++vid) { |
7336 |
++ for (vid = vlan->vid_begin; vid <= vlan->vid_end; vid++) { |
7337 |
+ int pvid_val = 0; |
7338 |
+ |
7339 |
+ dev_info(smi->dev, "add VLAN %04x\n", vid); |
7340 |
+@@ -407,13 +420,13 @@ void rtl8366_vlan_add(struct dsa_switch *ds, int port, |
7341 |
+ if (ret < 0) |
7342 |
+ return; |
7343 |
+ } |
7344 |
+- } |
7345 |
+ |
7346 |
+- ret = rtl8366_set_vlan(smi, port, member, untag, 0); |
7347 |
+- if (ret) |
7348 |
+- dev_err(smi->dev, |
7349 |
+- "failed to set up VLAN %04x", |
7350 |
+- vid); |
7351 |
++ ret = rtl8366_set_vlan(smi, vid, member, untag, 0); |
7352 |
++ if (ret) |
7353 |
++ dev_err(smi->dev, |
7354 |
++ "failed to set up VLAN %04x", |
7355 |
++ vid); |
7356 |
++ } |
7357 |
+ } |
7358 |
+ EXPORT_SYMBOL_GPL(rtl8366_vlan_add); |
7359 |
+ |
7360 |
+diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_ethtool.c b/drivers/net/ethernet/aquantia/atlantic/aq_ethtool.c |
7361 |
+index 7241cf92b43a..446c59f2ab44 100644 |
7362 |
+--- a/drivers/net/ethernet/aquantia/atlantic/aq_ethtool.c |
7363 |
++++ b/drivers/net/ethernet/aquantia/atlantic/aq_ethtool.c |
7364 |
+@@ -123,21 +123,21 @@ static const char aq_macsec_stat_names[][ETH_GSTRING_LEN] = { |
7365 |
+ "MACSec OutUnctrlHitDropRedir", |
7366 |
+ }; |
7367 |
+ |
7368 |
+-static const char *aq_macsec_txsc_stat_names[] = { |
7369 |
++static const char * const aq_macsec_txsc_stat_names[] = { |
7370 |
+ "MACSecTXSC%d ProtectedPkts", |
7371 |
+ "MACSecTXSC%d EncryptedPkts", |
7372 |
+ "MACSecTXSC%d ProtectedOctets", |
7373 |
+ "MACSecTXSC%d EncryptedOctets", |
7374 |
+ }; |
7375 |
+ |
7376 |
+-static const char *aq_macsec_txsa_stat_names[] = { |
7377 |
++static const char * const aq_macsec_txsa_stat_names[] = { |
7378 |
+ "MACSecTXSC%dSA%d HitDropRedirect", |
7379 |
+ "MACSecTXSC%dSA%d Protected2Pkts", |
7380 |
+ "MACSecTXSC%dSA%d ProtectedPkts", |
7381 |
+ "MACSecTXSC%dSA%d EncryptedPkts", |
7382 |
+ }; |
7383 |
+ |
7384 |
+-static const char *aq_macsec_rxsa_stat_names[] = { |
7385 |
++static const char * const aq_macsec_rxsa_stat_names[] = { |
7386 |
+ "MACSecRXSC%dSA%d UntaggedHitPkts", |
7387 |
+ "MACSecRXSC%dSA%d CtrlHitDrpRedir", |
7388 |
+ "MACSecRXSC%dSA%d NotUsingSa", |
7389 |
+diff --git a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.c b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.c |
7390 |
+index 9b1062b8af64..1e8b778cb9fa 100644 |
7391 |
+--- a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.c |
7392 |
++++ b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.c |
7393 |
+@@ -782,7 +782,7 @@ static int hw_atl_a0_hw_multicast_list_set(struct aq_hw_s *self, |
7394 |
+ int err = 0; |
7395 |
+ |
7396 |
+ if (count > (HW_ATL_A0_MAC_MAX - HW_ATL_A0_MAC_MIN)) { |
7397 |
+- err = EBADRQC; |
7398 |
++ err = -EBADRQC; |
7399 |
+ goto err_exit; |
7400 |
+ } |
7401 |
+ for (self->aq_nic_cfg->mc_list_count = 0U; |
7402 |
+diff --git a/drivers/net/ethernet/cavium/liquidio/cn23xx_pf_device.c b/drivers/net/ethernet/cavium/liquidio/cn23xx_pf_device.c |
7403 |
+index 43d11c38b38a..4cddd628d41b 100644 |
7404 |
+--- a/drivers/net/ethernet/cavium/liquidio/cn23xx_pf_device.c |
7405 |
++++ b/drivers/net/ethernet/cavium/liquidio/cn23xx_pf_device.c |
7406 |
+@@ -1167,7 +1167,7 @@ static int cn23xx_get_pf_num(struct octeon_device *oct) |
7407 |
+ oct->pf_num = ((fdl_bit >> CN23XX_PCIE_SRIOV_FDL_BIT_POS) & |
7408 |
+ CN23XX_PCIE_SRIOV_FDL_MASK); |
7409 |
+ } else { |
7410 |
+- ret = EINVAL; |
7411 |
++ ret = -EINVAL; |
7412 |
+ |
7413 |
+ /* Under some virtual environments, extended PCI regs are |
7414 |
+ * inaccessible, in which case the above read will have failed. |
7415 |
+diff --git a/drivers/net/ethernet/cavium/thunder/nicvf_main.c b/drivers/net/ethernet/cavium/thunder/nicvf_main.c |
7416 |
+index ae48f2e9265f..79898530760a 100644 |
7417 |
+--- a/drivers/net/ethernet/cavium/thunder/nicvf_main.c |
7418 |
++++ b/drivers/net/ethernet/cavium/thunder/nicvf_main.c |
7419 |
+@@ -2179,6 +2179,9 @@ static int nicvf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) |
7420 |
+ nic->max_queues *= 2; |
7421 |
+ nic->ptp_clock = ptp_clock; |
7422 |
+ |
7423 |
++ /* Initialize mutex that serializes usage of VF's mailbox */ |
7424 |
++ mutex_init(&nic->rx_mode_mtx); |
7425 |
++ |
7426 |
+ /* MAP VF's configuration registers */ |
7427 |
+ nic->reg_base = pcim_iomap(pdev, PCI_CFG_REG_BAR_NUM, 0); |
7428 |
+ if (!nic->reg_base) { |
7429 |
+@@ -2255,7 +2258,6 @@ static int nicvf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) |
7430 |
+ |
7431 |
+ INIT_WORK(&nic->rx_mode_work.work, nicvf_set_rx_mode_task); |
7432 |
+ spin_lock_init(&nic->rx_mode_wq_lock); |
7433 |
+- mutex_init(&nic->rx_mode_mtx); |
7434 |
+ |
7435 |
+ err = register_netdev(netdev); |
7436 |
+ if (err) { |
7437 |
+diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c |
7438 |
+index b7031f8562e0..665ec7269c60 100644 |
7439 |
+--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c |
7440 |
++++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c |
7441 |
+@@ -1054,7 +1054,7 @@ static void drain_bufs(struct dpaa2_eth_priv *priv, int count) |
7442 |
+ buf_array, count); |
7443 |
+ if (ret < 0) { |
7444 |
+ if (ret == -EBUSY && |
7445 |
+- retries++ >= DPAA2_ETH_SWP_BUSY_RETRIES) |
7446 |
++ retries++ < DPAA2_ETH_SWP_BUSY_RETRIES) |
7447 |
+ continue; |
7448 |
+ netdev_err(priv->net_dev, "dpaa2_io_service_acquire() failed\n"); |
7449 |
+ return; |
7450 |
+diff --git a/drivers/net/ethernet/freescale/fman/fman.c b/drivers/net/ethernet/freescale/fman/fman.c |
7451 |
+index f151d6e111dd..ef67e8599b39 100644 |
7452 |
+--- a/drivers/net/ethernet/freescale/fman/fman.c |
7453 |
++++ b/drivers/net/ethernet/freescale/fman/fman.c |
7454 |
+@@ -1398,8 +1398,7 @@ static void enable_time_stamp(struct fman *fman) |
7455 |
+ { |
7456 |
+ struct fman_fpm_regs __iomem *fpm_rg = fman->fpm_regs; |
7457 |
+ u16 fm_clk_freq = fman->state->fm_clk_freq; |
7458 |
+- u32 tmp, intgr, ts_freq; |
7459 |
+- u64 frac; |
7460 |
++ u32 tmp, intgr, ts_freq, frac; |
7461 |
+ |
7462 |
+ ts_freq = (u32)(1 << fman->state->count1_micro_bit); |
7463 |
+ /* configure timestamp so that bit 8 will count 1 microsecond |
7464 |
+diff --git a/drivers/net/ethernet/freescale/fman/fman_dtsec.c b/drivers/net/ethernet/freescale/fman/fman_dtsec.c |
7465 |
+index 004c266802a8..bce3c9398887 100644 |
7466 |
+--- a/drivers/net/ethernet/freescale/fman/fman_dtsec.c |
7467 |
++++ b/drivers/net/ethernet/freescale/fman/fman_dtsec.c |
7468 |
+@@ -1200,7 +1200,7 @@ int dtsec_del_hash_mac_address(struct fman_mac *dtsec, enet_addr_t *eth_addr) |
7469 |
+ list_for_each(pos, |
7470 |
+ &dtsec->multicast_addr_hash->lsts[bucket]) { |
7471 |
+ hash_entry = ETH_HASH_ENTRY_OBJ(pos); |
7472 |
+- if (hash_entry->addr == addr) { |
7473 |
++ if (hash_entry && hash_entry->addr == addr) { |
7474 |
+ list_del_init(&hash_entry->node); |
7475 |
+ kfree(hash_entry); |
7476 |
+ break; |
7477 |
+@@ -1213,7 +1213,7 @@ int dtsec_del_hash_mac_address(struct fman_mac *dtsec, enet_addr_t *eth_addr) |
7478 |
+ list_for_each(pos, |
7479 |
+ &dtsec->unicast_addr_hash->lsts[bucket]) { |
7480 |
+ hash_entry = ETH_HASH_ENTRY_OBJ(pos); |
7481 |
+- if (hash_entry->addr == addr) { |
7482 |
++ if (hash_entry && hash_entry->addr == addr) { |
7483 |
+ list_del_init(&hash_entry->node); |
7484 |
+ kfree(hash_entry); |
7485 |
+ break; |
7486 |
+diff --git a/drivers/net/ethernet/freescale/fman/fman_mac.h b/drivers/net/ethernet/freescale/fman/fman_mac.h |
7487 |
+index dd6d0526f6c1..19f327efdaff 100644 |
7488 |
+--- a/drivers/net/ethernet/freescale/fman/fman_mac.h |
7489 |
++++ b/drivers/net/ethernet/freescale/fman/fman_mac.h |
7490 |
+@@ -252,7 +252,7 @@ static inline struct eth_hash_t *alloc_hash_table(u16 size) |
7491 |
+ struct eth_hash_t *hash; |
7492 |
+ |
7493 |
+ /* Allocate address hash table */ |
7494 |
+- hash = kmalloc_array(size, sizeof(struct eth_hash_t *), GFP_KERNEL); |
7495 |
++ hash = kmalloc(sizeof(*hash), GFP_KERNEL); |
7496 |
+ if (!hash) |
7497 |
+ return NULL; |
7498 |
+ |
7499 |
+diff --git a/drivers/net/ethernet/freescale/fman/fman_memac.c b/drivers/net/ethernet/freescale/fman/fman_memac.c |
7500 |
+index a5500ede4070..645764abdaae 100644 |
7501 |
+--- a/drivers/net/ethernet/freescale/fman/fman_memac.c |
7502 |
++++ b/drivers/net/ethernet/freescale/fman/fman_memac.c |
7503 |
+@@ -852,7 +852,6 @@ int memac_set_tx_pause_frames(struct fman_mac *memac, u8 priority, |
7504 |
+ |
7505 |
+ tmp = ioread32be(®s->command_config); |
7506 |
+ tmp &= ~CMD_CFG_PFC_MODE; |
7507 |
+- priority = 0; |
7508 |
+ |
7509 |
+ iowrite32be(tmp, ®s->command_config); |
7510 |
+ |
7511 |
+@@ -982,7 +981,7 @@ int memac_del_hash_mac_address(struct fman_mac *memac, enet_addr_t *eth_addr) |
7512 |
+ |
7513 |
+ list_for_each(pos, &memac->multicast_addr_hash->lsts[hash]) { |
7514 |
+ hash_entry = ETH_HASH_ENTRY_OBJ(pos); |
7515 |
+- if (hash_entry->addr == addr) { |
7516 |
++ if (hash_entry && hash_entry->addr == addr) { |
7517 |
+ list_del_init(&hash_entry->node); |
7518 |
+ kfree(hash_entry); |
7519 |
+ break; |
7520 |
+diff --git a/drivers/net/ethernet/freescale/fman/fman_port.c b/drivers/net/ethernet/freescale/fman/fman_port.c |
7521 |
+index 87b26f063cc8..c27df153f895 100644 |
7522 |
+--- a/drivers/net/ethernet/freescale/fman/fman_port.c |
7523 |
++++ b/drivers/net/ethernet/freescale/fman/fman_port.c |
7524 |
+@@ -1767,6 +1767,7 @@ static int fman_port_probe(struct platform_device *of_dev) |
7525 |
+ struct fman_port *port; |
7526 |
+ struct fman *fman; |
7527 |
+ struct device_node *fm_node, *port_node; |
7528 |
++ struct platform_device *fm_pdev; |
7529 |
+ struct resource res; |
7530 |
+ struct resource *dev_res; |
7531 |
+ u32 val; |
7532 |
+@@ -1791,8 +1792,14 @@ static int fman_port_probe(struct platform_device *of_dev) |
7533 |
+ goto return_err; |
7534 |
+ } |
7535 |
+ |
7536 |
+- fman = dev_get_drvdata(&of_find_device_by_node(fm_node)->dev); |
7537 |
++ fm_pdev = of_find_device_by_node(fm_node); |
7538 |
+ of_node_put(fm_node); |
7539 |
++ if (!fm_pdev) { |
7540 |
++ err = -EINVAL; |
7541 |
++ goto return_err; |
7542 |
++ } |
7543 |
++ |
7544 |
++ fman = dev_get_drvdata(&fm_pdev->dev); |
7545 |
+ if (!fman) { |
7546 |
+ err = -EINVAL; |
7547 |
+ goto return_err; |
7548 |
+diff --git a/drivers/net/ethernet/freescale/fman/fman_tgec.c b/drivers/net/ethernet/freescale/fman/fman_tgec.c |
7549 |
+index 8c7eb878d5b4..41946b16f6c7 100644 |
7550 |
+--- a/drivers/net/ethernet/freescale/fman/fman_tgec.c |
7551 |
++++ b/drivers/net/ethernet/freescale/fman/fman_tgec.c |
7552 |
+@@ -626,7 +626,7 @@ int tgec_del_hash_mac_address(struct fman_mac *tgec, enet_addr_t *eth_addr) |
7553 |
+ |
7554 |
+ list_for_each(pos, &tgec->multicast_addr_hash->lsts[hash]) { |
7555 |
+ hash_entry = ETH_HASH_ENTRY_OBJ(pos); |
7556 |
+- if (hash_entry->addr == addr) { |
7557 |
++ if (hash_entry && hash_entry->addr == addr) { |
7558 |
+ list_del_init(&hash_entry->node); |
7559 |
+ kfree(hash_entry); |
7560 |
+ break; |
7561 |
+diff --git a/drivers/net/ethernet/intel/iavf/iavf_main.c b/drivers/net/ethernet/intel/iavf/iavf_main.c |
7562 |
+index a21ae74bcd1b..a4b2ad29e132 100644 |
7563 |
+--- a/drivers/net/ethernet/intel/iavf/iavf_main.c |
7564 |
++++ b/drivers/net/ethernet/intel/iavf/iavf_main.c |
7565 |
+@@ -1863,8 +1863,10 @@ static int iavf_init_get_resources(struct iavf_adapter *adapter) |
7566 |
+ |
7567 |
+ adapter->rss_key = kzalloc(adapter->rss_key_size, GFP_KERNEL); |
7568 |
+ adapter->rss_lut = kzalloc(adapter->rss_lut_size, GFP_KERNEL); |
7569 |
+- if (!adapter->rss_key || !adapter->rss_lut) |
7570 |
++ if (!adapter->rss_key || !adapter->rss_lut) { |
7571 |
++ err = -ENOMEM; |
7572 |
+ goto err_mem; |
7573 |
++ } |
7574 |
+ if (RSS_AQ(adapter)) |
7575 |
+ adapter->aq_required |= IAVF_FLAG_AQ_CONFIGURE_RSS; |
7576 |
+ else |
7577 |
+@@ -1946,7 +1948,10 @@ static void iavf_watchdog_task(struct work_struct *work) |
7578 |
+ iavf_send_api_ver(adapter); |
7579 |
+ } |
7580 |
+ } else { |
7581 |
+- if (!iavf_process_aq_command(adapter) && |
7582 |
++ /* An error will be returned if no commands were |
7583 |
++ * processed; use this opportunity to update stats |
7584 |
++ */ |
7585 |
++ if (iavf_process_aq_command(adapter) && |
7586 |
+ adapter->state == __IAVF_RUNNING) |
7587 |
+ iavf_request_stats(adapter); |
7588 |
+ } |
7589 |
+diff --git a/drivers/net/ethernet/intel/ice/ice_flex_pipe.c b/drivers/net/ethernet/intel/ice/ice_flex_pipe.c |
7590 |
+index abfec38bb483..a9a89bdb6036 100644 |
7591 |
+--- a/drivers/net/ethernet/intel/ice/ice_flex_pipe.c |
7592 |
++++ b/drivers/net/ethernet/intel/ice/ice_flex_pipe.c |
7593 |
+@@ -2291,6 +2291,8 @@ static void ice_free_flow_profs(struct ice_hw *hw, u8 blk_idx) |
7594 |
+ mutex_lock(&hw->fl_profs_locks[blk_idx]); |
7595 |
+ list_for_each_entry_safe(p, tmp, &hw->fl_profs[blk_idx], l_entry) { |
7596 |
+ list_del(&p->l_entry); |
7597 |
++ |
7598 |
++ mutex_destroy(&p->entries_lock); |
7599 |
+ devm_kfree(ice_hw_to_dev(hw), p); |
7600 |
+ } |
7601 |
+ mutex_unlock(&hw->fl_profs_locks[blk_idx]); |
7602 |
+@@ -2408,7 +2410,7 @@ void ice_clear_hw_tbls(struct ice_hw *hw) |
7603 |
+ memset(prof_redir->t, 0, |
7604 |
+ prof_redir->count * sizeof(*prof_redir->t)); |
7605 |
+ |
7606 |
+- memset(es->t, 0, es->count * sizeof(*es->t)); |
7607 |
++ memset(es->t, 0, es->count * sizeof(*es->t) * es->fvw); |
7608 |
+ memset(es->ref_count, 0, es->count * sizeof(*es->ref_count)); |
7609 |
+ memset(es->written, 0, es->count * sizeof(*es->written)); |
7610 |
+ } |
7611 |
+@@ -2519,10 +2521,12 @@ enum ice_status ice_init_hw_tbls(struct ice_hw *hw) |
7612 |
+ es->ref_count = devm_kcalloc(ice_hw_to_dev(hw), es->count, |
7613 |
+ sizeof(*es->ref_count), |
7614 |
+ GFP_KERNEL); |
7615 |
++ if (!es->ref_count) |
7616 |
++ goto err; |
7617 |
+ |
7618 |
+ es->written = devm_kcalloc(ice_hw_to_dev(hw), es->count, |
7619 |
+ sizeof(*es->written), GFP_KERNEL); |
7620 |
+- if (!es->ref_count) |
7621 |
++ if (!es->written) |
7622 |
+ goto err; |
7623 |
+ } |
7624 |
+ return 0; |
7625 |
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c |
7626 |
+index 9620c8650e13..43cd379c46f3 100644 |
7627 |
+--- a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c |
7628 |
++++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c |
7629 |
+@@ -829,18 +829,15 @@ static int connect_fts_in_prio(struct mlx5_core_dev *dev, |
7630 |
+ { |
7631 |
+ struct mlx5_flow_root_namespace *root = find_root(&prio->node); |
7632 |
+ struct mlx5_flow_table *iter; |
7633 |
+- int i = 0; |
7634 |
+ int err; |
7635 |
+ |
7636 |
+ fs_for_each_ft(iter, prio) { |
7637 |
+- i++; |
7638 |
+ err = root->cmds->modify_flow_table(root, iter, ft); |
7639 |
+ if (err) { |
7640 |
+- mlx5_core_warn(dev, "Failed to modify flow table %d\n", |
7641 |
+- iter->id); |
7642 |
++ mlx5_core_err(dev, |
7643 |
++ "Failed to modify flow table id %d, type %d, err %d\n", |
7644 |
++ iter->id, iter->type, err); |
7645 |
+ /* The driver is out of sync with the FW */ |
7646 |
+- if (i > 1) |
7647 |
+- WARN_ON(true); |
7648 |
+ return err; |
7649 |
+ } |
7650 |
+ } |
7651 |
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/fs_dr.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/fs_dr.c |
7652 |
+index 3b3f5b9d4f95..2f3ee8519b22 100644 |
7653 |
+--- a/drivers/net/ethernet/mellanox/mlx5/core/steering/fs_dr.c |
7654 |
++++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/fs_dr.c |
7655 |
+@@ -279,29 +279,9 @@ static int mlx5_cmd_dr_create_fte(struct mlx5_flow_root_namespace *ns, |
7656 |
+ |
7657 |
+ /* The order of the actions are must to be keep, only the following |
7658 |
+ * order is supported by SW steering: |
7659 |
+- * TX: push vlan -> modify header -> encap |
7660 |
++ * TX: modify header -> push vlan -> encap |
7661 |
+ * RX: decap -> pop vlan -> modify header |
7662 |
+ */ |
7663 |
+- if (fte->action.action & MLX5_FLOW_CONTEXT_ACTION_VLAN_PUSH) { |
7664 |
+- tmp_action = create_action_push_vlan(domain, &fte->action.vlan[0]); |
7665 |
+- if (!tmp_action) { |
7666 |
+- err = -ENOMEM; |
7667 |
+- goto free_actions; |
7668 |
+- } |
7669 |
+- fs_dr_actions[fs_dr_num_actions++] = tmp_action; |
7670 |
+- actions[num_actions++] = tmp_action; |
7671 |
+- } |
7672 |
+- |
7673 |
+- if (fte->action.action & MLX5_FLOW_CONTEXT_ACTION_VLAN_PUSH_2) { |
7674 |
+- tmp_action = create_action_push_vlan(domain, &fte->action.vlan[1]); |
7675 |
+- if (!tmp_action) { |
7676 |
+- err = -ENOMEM; |
7677 |
+- goto free_actions; |
7678 |
+- } |
7679 |
+- fs_dr_actions[fs_dr_num_actions++] = tmp_action; |
7680 |
+- actions[num_actions++] = tmp_action; |
7681 |
+- } |
7682 |
+- |
7683 |
+ if (fte->action.action & MLX5_FLOW_CONTEXT_ACTION_DECAP) { |
7684 |
+ enum mlx5dr_action_reformat_type decap_type = |
7685 |
+ DR_ACTION_REFORMAT_TYP_TNL_L2_TO_L2; |
7686 |
+@@ -354,6 +334,26 @@ static int mlx5_cmd_dr_create_fte(struct mlx5_flow_root_namespace *ns, |
7687 |
+ actions[num_actions++] = |
7688 |
+ fte->action.modify_hdr->action.dr_action; |
7689 |
+ |
7690 |
++ if (fte->action.action & MLX5_FLOW_CONTEXT_ACTION_VLAN_PUSH) { |
7691 |
++ tmp_action = create_action_push_vlan(domain, &fte->action.vlan[0]); |
7692 |
++ if (!tmp_action) { |
7693 |
++ err = -ENOMEM; |
7694 |
++ goto free_actions; |
7695 |
++ } |
7696 |
++ fs_dr_actions[fs_dr_num_actions++] = tmp_action; |
7697 |
++ actions[num_actions++] = tmp_action; |
7698 |
++ } |
7699 |
++ |
7700 |
++ if (fte->action.action & MLX5_FLOW_CONTEXT_ACTION_VLAN_PUSH_2) { |
7701 |
++ tmp_action = create_action_push_vlan(domain, &fte->action.vlan[1]); |
7702 |
++ if (!tmp_action) { |
7703 |
++ err = -ENOMEM; |
7704 |
++ goto free_actions; |
7705 |
++ } |
7706 |
++ fs_dr_actions[fs_dr_num_actions++] = tmp_action; |
7707 |
++ actions[num_actions++] = tmp_action; |
7708 |
++ } |
7709 |
++ |
7710 |
+ if (delay_encap_set) |
7711 |
+ actions[num_actions++] = |
7712 |
+ fte->action.pkt_reformat->action.dr_action; |
7713 |
+diff --git a/drivers/net/ethernet/mscc/ocelot.c b/drivers/net/ethernet/mscc/ocelot.c |
7714 |
+index 76dbf9ac8ad5..1eaefc0ff87e 100644 |
7715 |
+--- a/drivers/net/ethernet/mscc/ocelot.c |
7716 |
++++ b/drivers/net/ethernet/mscc/ocelot.c |
7717 |
+@@ -1599,14 +1599,14 @@ static int ocelot_port_obj_add_mdb(struct net_device *dev, |
7718 |
+ addr[0] = 0; |
7719 |
+ |
7720 |
+ if (!new) { |
7721 |
+- addr[2] = mc->ports << 0; |
7722 |
+- addr[1] = mc->ports << 8; |
7723 |
++ addr[1] = mc->ports >> 8; |
7724 |
++ addr[2] = mc->ports & 0xff; |
7725 |
+ ocelot_mact_forget(ocelot, addr, vid); |
7726 |
+ } |
7727 |
+ |
7728 |
+ mc->ports |= BIT(port); |
7729 |
+- addr[2] = mc->ports << 0; |
7730 |
+- addr[1] = mc->ports << 8; |
7731 |
++ addr[1] = mc->ports >> 8; |
7732 |
++ addr[2] = mc->ports & 0xff; |
7733 |
+ |
7734 |
+ return ocelot_mact_learn(ocelot, 0, addr, vid, ENTRYTYPE_MACv4); |
7735 |
+ } |
7736 |
+@@ -1630,9 +1630,9 @@ static int ocelot_port_obj_del_mdb(struct net_device *dev, |
7737 |
+ return -ENOENT; |
7738 |
+ |
7739 |
+ memcpy(addr, mc->addr, ETH_ALEN); |
7740 |
+- addr[2] = mc->ports << 0; |
7741 |
+- addr[1] = mc->ports << 8; |
7742 |
+ addr[0] = 0; |
7743 |
++ addr[1] = mc->ports >> 8; |
7744 |
++ addr[2] = mc->ports & 0xff; |
7745 |
+ ocelot_mact_forget(ocelot, addr, vid); |
7746 |
+ |
7747 |
+ mc->ports &= ~BIT(port); |
7748 |
+@@ -1642,8 +1642,8 @@ static int ocelot_port_obj_del_mdb(struct net_device *dev, |
7749 |
+ return 0; |
7750 |
+ } |
7751 |
+ |
7752 |
+- addr[2] = mc->ports << 0; |
7753 |
+- addr[1] = mc->ports << 8; |
7754 |
++ addr[1] = mc->ports >> 8; |
7755 |
++ addr[2] = mc->ports & 0xff; |
7756 |
+ |
7757 |
+ return ocelot_mact_learn(ocelot, 0, addr, vid, ENTRYTYPE_MACv4); |
7758 |
+ } |
7759 |
+diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.c b/drivers/net/ethernet/pensando/ionic/ionic_lif.c |
7760 |
+index 337d971ffd92..29f77faa808b 100644 |
7761 |
+--- a/drivers/net/ethernet/pensando/ionic/ionic_lif.c |
7762 |
++++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.c |
7763 |
+@@ -709,7 +709,7 @@ static bool ionic_notifyq_service(struct ionic_cq *cq, |
7764 |
+ eid = le64_to_cpu(comp->event.eid); |
7765 |
+ |
7766 |
+ /* Have we run out of new completions to process? */ |
7767 |
+- if (eid <= lif->last_eid) |
7768 |
++ if ((s64)(eid - lif->last_eid) <= 0) |
7769 |
+ return false; |
7770 |
+ |
7771 |
+ lif->last_eid = eid; |
7772 |
+diff --git a/drivers/net/ethernet/sgi/ioc3-eth.c b/drivers/net/ethernet/sgi/ioc3-eth.c |
7773 |
+index 6646eba9f57f..6eef0f45b133 100644 |
7774 |
+--- a/drivers/net/ethernet/sgi/ioc3-eth.c |
7775 |
++++ b/drivers/net/ethernet/sgi/ioc3-eth.c |
7776 |
+@@ -951,7 +951,7 @@ out_stop: |
7777 |
+ dma_free_coherent(ip->dma_dev, RX_RING_SIZE, ip->rxr, |
7778 |
+ ip->rxr_dma); |
7779 |
+ if (ip->tx_ring) |
7780 |
+- dma_free_coherent(ip->dma_dev, TX_RING_SIZE, ip->tx_ring, |
7781 |
++ dma_free_coherent(ip->dma_dev, TX_RING_SIZE + SZ_16K - 1, ip->tx_ring, |
7782 |
+ ip->txr_dma); |
7783 |
+ out_free: |
7784 |
+ free_netdev(dev); |
7785 |
+@@ -964,7 +964,7 @@ static int ioc3eth_remove(struct platform_device *pdev) |
7786 |
+ struct ioc3_private *ip = netdev_priv(dev); |
7787 |
+ |
7788 |
+ dma_free_coherent(ip->dma_dev, RX_RING_SIZE, ip->rxr, ip->rxr_dma); |
7789 |
+- dma_free_coherent(ip->dma_dev, TX_RING_SIZE, ip->tx_ring, ip->txr_dma); |
7790 |
++ dma_free_coherent(ip->dma_dev, TX_RING_SIZE + SZ_16K - 1, ip->tx_ring, ip->txr_dma); |
7791 |
+ |
7792 |
+ unregister_netdev(dev); |
7793 |
+ del_timer_sync(&ip->ioc3_timer); |
7794 |
+diff --git a/drivers/net/ethernet/ti/am65-cpsw-nuss.c b/drivers/net/ethernet/ti/am65-cpsw-nuss.c |
7795 |
+index 3e4388e6b5fa..61b59a3b277e 100644 |
7796 |
+--- a/drivers/net/ethernet/ti/am65-cpsw-nuss.c |
7797 |
++++ b/drivers/net/ethernet/ti/am65-cpsw-nuss.c |
7798 |
+@@ -217,6 +217,9 @@ static int am65_cpsw_nuss_ndo_slave_add_vid(struct net_device *ndev, |
7799 |
+ u32 port_mask, unreg_mcast = 0; |
7800 |
+ int ret; |
7801 |
+ |
7802 |
++ if (!netif_running(ndev) || !vid) |
7803 |
++ return 0; |
7804 |
++ |
7805 |
+ ret = pm_runtime_get_sync(common->dev); |
7806 |
+ if (ret < 0) { |
7807 |
+ pm_runtime_put_noidle(common->dev); |
7808 |
+@@ -240,6 +243,9 @@ static int am65_cpsw_nuss_ndo_slave_kill_vid(struct net_device *ndev, |
7809 |
+ struct am65_cpsw_common *common = am65_ndev_to_common(ndev); |
7810 |
+ int ret; |
7811 |
+ |
7812 |
++ if (!netif_running(ndev) || !vid) |
7813 |
++ return 0; |
7814 |
++ |
7815 |
+ ret = pm_runtime_get_sync(common->dev); |
7816 |
+ if (ret < 0) { |
7817 |
+ pm_runtime_put_noidle(common->dev); |
7818 |
+@@ -565,6 +571,16 @@ static int am65_cpsw_nuss_ndo_slave_stop(struct net_device *ndev) |
7819 |
+ return 0; |
7820 |
+ } |
7821 |
+ |
7822 |
++static int cpsw_restore_vlans(struct net_device *vdev, int vid, void *arg) |
7823 |
++{ |
7824 |
++ struct am65_cpsw_port *port = arg; |
7825 |
++ |
7826 |
++ if (!vdev) |
7827 |
++ return 0; |
7828 |
++ |
7829 |
++ return am65_cpsw_nuss_ndo_slave_add_vid(port->ndev, 0, vid); |
7830 |
++} |
7831 |
++ |
7832 |
+ static int am65_cpsw_nuss_ndo_slave_open(struct net_device *ndev) |
7833 |
+ { |
7834 |
+ struct am65_cpsw_common *common = am65_ndev_to_common(ndev); |
7835 |
+@@ -638,6 +654,9 @@ static int am65_cpsw_nuss_ndo_slave_open(struct net_device *ndev) |
7836 |
+ } |
7837 |
+ } |
7838 |
+ |
7839 |
++ /* restore vlan configurations */ |
7840 |
++ vlan_for_each(ndev, cpsw_restore_vlans, port); |
7841 |
++ |
7842 |
+ phy_attached_info(port->slave.phy); |
7843 |
+ phy_start(port->slave.phy); |
7844 |
+ |
7845 |
+diff --git a/drivers/net/ethernet/toshiba/spider_net.c b/drivers/net/ethernet/toshiba/spider_net.c |
7846 |
+index 6576271642c1..ce8b123cdbcc 100644 |
7847 |
+--- a/drivers/net/ethernet/toshiba/spider_net.c |
7848 |
++++ b/drivers/net/ethernet/toshiba/spider_net.c |
7849 |
+@@ -283,8 +283,8 @@ spider_net_free_chain(struct spider_net_card *card, |
7850 |
+ descr = descr->next; |
7851 |
+ } while (descr != chain->ring); |
7852 |
+ |
7853 |
+- dma_free_coherent(&card->pdev->dev, chain->num_desc, |
7854 |
+- chain->hwring, chain->dma_addr); |
7855 |
++ dma_free_coherent(&card->pdev->dev, chain->num_desc * sizeof(struct spider_net_hw_descr), |
7856 |
++ chain->hwring, chain->dma_addr); |
7857 |
+ } |
7858 |
+ |
7859 |
+ /** |
7860 |
+diff --git a/drivers/net/phy/marvell10g.c b/drivers/net/phy/marvell10g.c |
7861 |
+index 1f1a01c98e44..06dfabe297af 100644 |
7862 |
+--- a/drivers/net/phy/marvell10g.c |
7863 |
++++ b/drivers/net/phy/marvell10g.c |
7864 |
+@@ -205,13 +205,6 @@ static int mv3310_hwmon_config(struct phy_device *phydev, bool enable) |
7865 |
+ MV_V2_TEMP_CTRL_MASK, val); |
7866 |
+ } |
7867 |
+ |
7868 |
+-static void mv3310_hwmon_disable(void *data) |
7869 |
+-{ |
7870 |
+- struct phy_device *phydev = data; |
7871 |
+- |
7872 |
+- mv3310_hwmon_config(phydev, false); |
7873 |
+-} |
7874 |
+- |
7875 |
+ static int mv3310_hwmon_probe(struct phy_device *phydev) |
7876 |
+ { |
7877 |
+ struct device *dev = &phydev->mdio.dev; |
7878 |
+@@ -235,10 +228,6 @@ static int mv3310_hwmon_probe(struct phy_device *phydev) |
7879 |
+ if (ret) |
7880 |
+ return ret; |
7881 |
+ |
7882 |
+- ret = devm_add_action_or_reset(dev, mv3310_hwmon_disable, phydev); |
7883 |
+- if (ret) |
7884 |
+- return ret; |
7885 |
+- |
7886 |
+ priv->hwmon_dev = devm_hwmon_device_register_with_info(dev, |
7887 |
+ priv->hwmon_name, phydev, |
7888 |
+ &mv3310_hwmon_chip_info, NULL); |
7889 |
+@@ -423,6 +412,11 @@ static int mv3310_probe(struct phy_device *phydev) |
7890 |
+ return phy_sfp_probe(phydev, &mv3310_sfp_ops); |
7891 |
+ } |
7892 |
+ |
7893 |
++static void mv3310_remove(struct phy_device *phydev) |
7894 |
++{ |
7895 |
++ mv3310_hwmon_config(phydev, false); |
7896 |
++} |
7897 |
++ |
7898 |
+ static int mv3310_suspend(struct phy_device *phydev) |
7899 |
+ { |
7900 |
+ return mv3310_power_down(phydev); |
7901 |
+@@ -763,6 +757,7 @@ static struct phy_driver mv3310_drivers[] = { |
7902 |
+ .read_status = mv3310_read_status, |
7903 |
+ .get_tunable = mv3310_get_tunable, |
7904 |
+ .set_tunable = mv3310_set_tunable, |
7905 |
++ .remove = mv3310_remove, |
7906 |
+ }, |
7907 |
+ { |
7908 |
+ .phy_id = MARVELL_PHY_ID_88E2110, |
7909 |
+@@ -778,6 +773,7 @@ static struct phy_driver mv3310_drivers[] = { |
7910 |
+ .read_status = mv3310_read_status, |
7911 |
+ .get_tunable = mv3310_get_tunable, |
7912 |
+ .set_tunable = mv3310_set_tunable, |
7913 |
++ .remove = mv3310_remove, |
7914 |
+ }, |
7915 |
+ }; |
7916 |
+ |
7917 |
+diff --git a/drivers/net/phy/mscc/mscc_main.c b/drivers/net/phy/mscc/mscc_main.c |
7918 |
+index 485a4f8a6a9a..95bd2d277ba4 100644 |
7919 |
+--- a/drivers/net/phy/mscc/mscc_main.c |
7920 |
++++ b/drivers/net/phy/mscc/mscc_main.c |
7921 |
+@@ -1413,6 +1413,11 @@ static int vsc8584_config_init(struct phy_device *phydev) |
7922 |
+ if (ret) |
7923 |
+ goto err; |
7924 |
+ |
7925 |
++ ret = phy_base_write(phydev, MSCC_EXT_PAGE_ACCESS, |
7926 |
++ MSCC_PHY_PAGE_STANDARD); |
7927 |
++ if (ret) |
7928 |
++ goto err; |
7929 |
++ |
7930 |
+ if (!phy_interface_is_rgmii(phydev)) { |
7931 |
+ val = PROC_CMD_MCB_ACCESS_MAC_CONF | PROC_CMD_RST_CONF_PORT | |
7932 |
+ PROC_CMD_READ_MOD_WRITE_PORT; |
7933 |
+@@ -1799,7 +1804,11 @@ static int vsc8514_config_init(struct phy_device *phydev) |
7934 |
+ val &= ~MAC_CFG_MASK; |
7935 |
+ val |= MAC_CFG_QSGMII; |
7936 |
+ ret = phy_base_write(phydev, MSCC_PHY_MAC_CFG_FASTLINK, val); |
7937 |
++ if (ret) |
7938 |
++ goto err; |
7939 |
+ |
7940 |
++ ret = phy_base_write(phydev, MSCC_EXT_PAGE_ACCESS, |
7941 |
++ MSCC_PHY_PAGE_STANDARD); |
7942 |
+ if (ret) |
7943 |
+ goto err; |
7944 |
+ |
7945 |
+diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c |
7946 |
+index 0881b4b92363..d9bdc19b01cc 100644 |
7947 |
+--- a/drivers/net/phy/phy_device.c |
7948 |
++++ b/drivers/net/phy/phy_device.c |
7949 |
+@@ -616,7 +616,9 @@ struct phy_device *phy_device_create(struct mii_bus *bus, int addr, u32 phy_id, |
7950 |
+ if (c45_ids) |
7951 |
+ dev->c45_ids = *c45_ids; |
7952 |
+ dev->irq = bus->irq[addr]; |
7953 |
++ |
7954 |
+ dev_set_name(&mdiodev->dev, PHY_ID_FMT, bus->id, addr); |
7955 |
++ device_initialize(&mdiodev->dev); |
7956 |
+ |
7957 |
+ dev->state = PHY_DOWN; |
7958 |
+ |
7959 |
+@@ -650,10 +652,8 @@ struct phy_device *phy_device_create(struct mii_bus *bus, int addr, u32 phy_id, |
7960 |
+ ret = phy_request_driver_module(dev, phy_id); |
7961 |
+ } |
7962 |
+ |
7963 |
+- if (!ret) { |
7964 |
+- device_initialize(&mdiodev->dev); |
7965 |
+- } else { |
7966 |
+- kfree(dev); |
7967 |
++ if (ret) { |
7968 |
++ put_device(&mdiodev->dev); |
7969 |
+ dev = ERR_PTR(ret); |
7970 |
+ } |
7971 |
+ |
7972 |
+diff --git a/drivers/net/vmxnet3/vmxnet3_drv.c b/drivers/net/vmxnet3/vmxnet3_drv.c |
7973 |
+index 722cb054a5cd..d42207dc25dd 100644 |
7974 |
+--- a/drivers/net/vmxnet3/vmxnet3_drv.c |
7975 |
++++ b/drivers/net/vmxnet3/vmxnet3_drv.c |
7976 |
+@@ -861,7 +861,8 @@ vmxnet3_parse_hdr(struct sk_buff *skb, struct vmxnet3_tx_queue *tq, |
7977 |
+ |
7978 |
+ switch (protocol) { |
7979 |
+ case IPPROTO_TCP: |
7980 |
+- ctx->l4_hdr_size = tcp_hdrlen(skb); |
7981 |
++ ctx->l4_hdr_size = skb->encapsulation ? inner_tcp_hdrlen(skb) : |
7982 |
++ tcp_hdrlen(skb); |
7983 |
+ break; |
7984 |
+ case IPPROTO_UDP: |
7985 |
+ ctx->l4_hdr_size = sizeof(struct udphdr); |
7986 |
+diff --git a/drivers/net/wan/lapbether.c b/drivers/net/wan/lapbether.c |
7987 |
+index b2868433718f..1ea15f2123ed 100644 |
7988 |
+--- a/drivers/net/wan/lapbether.c |
7989 |
++++ b/drivers/net/wan/lapbether.c |
7990 |
+@@ -157,6 +157,12 @@ static netdev_tx_t lapbeth_xmit(struct sk_buff *skb, |
7991 |
+ if (!netif_running(dev)) |
7992 |
+ goto drop; |
7993 |
+ |
7994 |
++ /* There should be a pseudo header of 1 byte added by upper layers. |
7995 |
++ * Check to make sure it is there before reading it. |
7996 |
++ */ |
7997 |
++ if (skb->len < 1) |
7998 |
++ goto drop; |
7999 |
++ |
8000 |
+ switch (skb->data[0]) { |
8001 |
+ case X25_IFACE_DATA: |
8002 |
+ break; |
8003 |
+@@ -305,6 +311,7 @@ static void lapbeth_setup(struct net_device *dev) |
8004 |
+ dev->netdev_ops = &lapbeth_netdev_ops; |
8005 |
+ dev->needs_free_netdev = true; |
8006 |
+ dev->type = ARPHRD_X25; |
8007 |
++ dev->hard_header_len = 0; |
8008 |
+ dev->mtu = 1000; |
8009 |
+ dev->addr_len = 0; |
8010 |
+ } |
8011 |
+@@ -331,7 +338,8 @@ static int lapbeth_new_device(struct net_device *dev) |
8012 |
+ * then this driver prepends a length field of 2 bytes, |
8013 |
+ * then the underlying Ethernet device prepends its own header. |
8014 |
+ */ |
8015 |
+- ndev->hard_header_len = -1 + 3 + 2 + dev->hard_header_len; |
8016 |
++ ndev->needed_headroom = -1 + 3 + 2 + dev->hard_header_len |
8017 |
++ + dev->needed_headroom; |
8018 |
+ |
8019 |
+ lapbeth = netdev_priv(ndev); |
8020 |
+ lapbeth->axdev = ndev; |
8021 |
+diff --git a/drivers/net/wireless/ath/ath10k/htt_tx.c b/drivers/net/wireless/ath/ath10k/htt_tx.c |
8022 |
+index 517ee2af2231..e76b71e9326f 100644 |
8023 |
+--- a/drivers/net/wireless/ath/ath10k/htt_tx.c |
8024 |
++++ b/drivers/net/wireless/ath/ath10k/htt_tx.c |
8025 |
+@@ -1550,7 +1550,9 @@ static int ath10k_htt_tx_32(struct ath10k_htt *htt, |
8026 |
+ err_unmap_msdu: |
8027 |
+ dma_unmap_single(dev, skb_cb->paddr, msdu->len, DMA_TO_DEVICE); |
8028 |
+ err_free_msdu_id: |
8029 |
++ spin_lock_bh(&htt->tx_lock); |
8030 |
+ ath10k_htt_tx_free_msdu_id(htt, msdu_id); |
8031 |
++ spin_unlock_bh(&htt->tx_lock); |
8032 |
+ err: |
8033 |
+ return res; |
8034 |
+ } |
8035 |
+@@ -1757,7 +1759,9 @@ static int ath10k_htt_tx_64(struct ath10k_htt *htt, |
8036 |
+ err_unmap_msdu: |
8037 |
+ dma_unmap_single(dev, skb_cb->paddr, msdu->len, DMA_TO_DEVICE); |
8038 |
+ err_free_msdu_id: |
8039 |
++ spin_lock_bh(&htt->tx_lock); |
8040 |
+ ath10k_htt_tx_free_msdu_id(htt, msdu_id); |
8041 |
++ spin_unlock_bh(&htt->tx_lock); |
8042 |
+ err: |
8043 |
+ return res; |
8044 |
+ } |
8045 |
+diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h |
8046 |
+index de0ef1b545c4..2e31cc10c195 100644 |
8047 |
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h |
8048 |
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h |
8049 |
+@@ -19,7 +19,7 @@ |
8050 |
+ #define BRCMF_ARP_OL_PEER_AUTO_REPLY 0x00000008 |
8051 |
+ |
8052 |
+ #define BRCMF_BSS_INFO_VERSION 109 /* curr ver of brcmf_bss_info_le struct */ |
8053 |
+-#define BRCMF_BSS_RSSI_ON_CHANNEL 0x0002 |
8054 |
++#define BRCMF_BSS_RSSI_ON_CHANNEL 0x0004 |
8055 |
+ |
8056 |
+ #define BRCMF_STA_BRCM 0x00000001 /* Running a Broadcom driver */ |
8057 |
+ #define BRCMF_STA_WME 0x00000002 /* WMM association */ |
8058 |
+diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c |
8059 |
+index 8cc52935fd41..948840b4e38e 100644 |
8060 |
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c |
8061 |
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c |
8062 |
+@@ -643,6 +643,7 @@ static inline int brcmf_fws_hanger_poppkt(struct brcmf_fws_hanger *h, |
8063 |
+ static void brcmf_fws_psq_flush(struct brcmf_fws_info *fws, struct pktq *q, |
8064 |
+ int ifidx) |
8065 |
+ { |
8066 |
++ struct brcmf_fws_hanger_item *hi; |
8067 |
+ bool (*matchfn)(struct sk_buff *, void *) = NULL; |
8068 |
+ struct sk_buff *skb; |
8069 |
+ int prec; |
8070 |
+@@ -654,6 +655,9 @@ static void brcmf_fws_psq_flush(struct brcmf_fws_info *fws, struct pktq *q, |
8071 |
+ skb = brcmu_pktq_pdeq_match(q, prec, matchfn, &ifidx); |
8072 |
+ while (skb) { |
8073 |
+ hslot = brcmf_skb_htod_tag_get_field(skb, HSLOT); |
8074 |
++ hi = &fws->hanger.items[hslot]; |
8075 |
++ WARN_ON(skb != hi->pkt); |
8076 |
++ hi->state = BRCMF_FWS_HANGER_ITEM_STATE_FREE; |
8077 |
+ brcmf_fws_hanger_poppkt(&fws->hanger, hslot, &skb, |
8078 |
+ true); |
8079 |
+ brcmu_pkt_buf_free_skb(skb); |
8080 |
+diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c |
8081 |
+index 3a08252f1a53..0dbbb467c229 100644 |
8082 |
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c |
8083 |
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c |
8084 |
+@@ -3689,7 +3689,11 @@ static void brcmf_sdio_bus_watchdog(struct brcmf_sdio *bus) |
8085 |
+ if (bus->idlecount > bus->idletime) { |
8086 |
+ brcmf_dbg(SDIO, "idle\n"); |
8087 |
+ sdio_claim_host(bus->sdiodev->func1); |
8088 |
+- brcmf_sdio_wd_timer(bus, false); |
8089 |
++#ifdef DEBUG |
8090 |
++ if (!BRCMF_FWCON_ON() || |
8091 |
++ bus->console_interval == 0) |
8092 |
++#endif |
8093 |
++ brcmf_sdio_wd_timer(bus, false); |
8094 |
+ bus->idlecount = 0; |
8095 |
+ brcmf_sdio_bus_sleep(bus, true, false); |
8096 |
+ sdio_release_host(bus->sdiodev->func1); |
8097 |
+diff --git a/drivers/net/wireless/intel/iwlegacy/common.c b/drivers/net/wireless/intel/iwlegacy/common.c |
8098 |
+index 348c17ce72f5..f78e062df572 100644 |
8099 |
+--- a/drivers/net/wireless/intel/iwlegacy/common.c |
8100 |
++++ b/drivers/net/wireless/intel/iwlegacy/common.c |
8101 |
+@@ -4286,8 +4286,8 @@ il_apm_init(struct il_priv *il) |
8102 |
+ * power savings, even without L1. |
8103 |
+ */ |
8104 |
+ if (il->cfg->set_l0s) { |
8105 |
+- pcie_capability_read_word(il->pci_dev, PCI_EXP_LNKCTL, &lctl); |
8106 |
+- if (lctl & PCI_EXP_LNKCTL_ASPM_L1) { |
8107 |
++ ret = pcie_capability_read_word(il->pci_dev, PCI_EXP_LNKCTL, &lctl); |
8108 |
++ if (!ret && (lctl & PCI_EXP_LNKCTL_ASPM_L1)) { |
8109 |
+ /* L1-ASPM enabled; disable(!) L0S */ |
8110 |
+ il_set_bit(il, CSR_GIO_REG, |
8111 |
+ CSR_GIO_REG_VAL_L0S_ENABLED); |
8112 |
+diff --git a/drivers/net/wireless/marvell/mwifiex/sdio.h b/drivers/net/wireless/marvell/mwifiex/sdio.h |
8113 |
+index 71cd8629b28e..8b476b007c5e 100644 |
8114 |
+--- a/drivers/net/wireless/marvell/mwifiex/sdio.h |
8115 |
++++ b/drivers/net/wireless/marvell/mwifiex/sdio.h |
8116 |
+@@ -36,9 +36,9 @@ |
8117 |
+ #define SD8897_DEFAULT_FW_NAME "mrvl/sd8897_uapsta.bin" |
8118 |
+ #define SD8887_DEFAULT_FW_NAME "mrvl/sd8887_uapsta.bin" |
8119 |
+ #define SD8801_DEFAULT_FW_NAME "mrvl/sd8801_uapsta.bin" |
8120 |
+-#define SD8977_DEFAULT_FW_NAME "mrvl/sd8977_uapsta.bin" |
8121 |
++#define SD8977_DEFAULT_FW_NAME "mrvl/sdsd8977_combo_v2.bin" |
8122 |
+ #define SD8987_DEFAULT_FW_NAME "mrvl/sd8987_uapsta.bin" |
8123 |
+-#define SD8997_DEFAULT_FW_NAME "mrvl/sd8997_uapsta.bin" |
8124 |
++#define SD8997_DEFAULT_FW_NAME "mrvl/sdsd8997_combo_v4.bin" |
8125 |
+ |
8126 |
+ #define BLOCK_MODE 1 |
8127 |
+ #define BYTE_MODE 0 |
8128 |
+diff --git a/drivers/net/wireless/marvell/mwifiex/sta_cmdresp.c b/drivers/net/wireless/marvell/mwifiex/sta_cmdresp.c |
8129 |
+index f21660149f58..962d8bfe6f10 100644 |
8130 |
+--- a/drivers/net/wireless/marvell/mwifiex/sta_cmdresp.c |
8131 |
++++ b/drivers/net/wireless/marvell/mwifiex/sta_cmdresp.c |
8132 |
+@@ -580,6 +580,11 @@ static int mwifiex_ret_802_11_key_material_v1(struct mwifiex_private *priv, |
8133 |
+ { |
8134 |
+ struct host_cmd_ds_802_11_key_material *key = |
8135 |
+ &resp->params.key_material; |
8136 |
++ int len; |
8137 |
++ |
8138 |
++ len = le16_to_cpu(key->key_param_set.key_len); |
8139 |
++ if (len > sizeof(key->key_param_set.key)) |
8140 |
++ return -EINVAL; |
8141 |
+ |
8142 |
+ if (le16_to_cpu(key->action) == HostCmd_ACT_GEN_SET) { |
8143 |
+ if ((le16_to_cpu(key->key_param_set.key_info) & KEY_MCAST)) { |
8144 |
+@@ -593,9 +598,8 @@ static int mwifiex_ret_802_11_key_material_v1(struct mwifiex_private *priv, |
8145 |
+ |
8146 |
+ memset(priv->aes_key.key_param_set.key, 0, |
8147 |
+ sizeof(key->key_param_set.key)); |
8148 |
+- priv->aes_key.key_param_set.key_len = key->key_param_set.key_len; |
8149 |
+- memcpy(priv->aes_key.key_param_set.key, key->key_param_set.key, |
8150 |
+- le16_to_cpu(priv->aes_key.key_param_set.key_len)); |
8151 |
++ priv->aes_key.key_param_set.key_len = cpu_to_le16(len); |
8152 |
++ memcpy(priv->aes_key.key_param_set.key, key->key_param_set.key, len); |
8153 |
+ |
8154 |
+ return 0; |
8155 |
+ } |
8156 |
+@@ -610,9 +614,14 @@ static int mwifiex_ret_802_11_key_material_v2(struct mwifiex_private *priv, |
8157 |
+ struct host_cmd_ds_command *resp) |
8158 |
+ { |
8159 |
+ struct host_cmd_ds_802_11_key_material_v2 *key_v2; |
8160 |
+- __le16 len; |
8161 |
++ int len; |
8162 |
+ |
8163 |
+ key_v2 = &resp->params.key_material_v2; |
8164 |
++ |
8165 |
++ len = le16_to_cpu(key_v2->key_param_set.key_params.aes.key_len); |
8166 |
++ if (len > WLAN_KEY_LEN_CCMP) |
8167 |
++ return -EINVAL; |
8168 |
++ |
8169 |
+ if (le16_to_cpu(key_v2->action) == HostCmd_ACT_GEN_SET) { |
8170 |
+ if ((le16_to_cpu(key_v2->key_param_set.key_info) & KEY_MCAST)) { |
8171 |
+ mwifiex_dbg(priv->adapter, INFO, "info: key: GTK is set\n"); |
8172 |
+@@ -628,10 +637,9 @@ static int mwifiex_ret_802_11_key_material_v2(struct mwifiex_private *priv, |
8173 |
+ memset(priv->aes_key_v2.key_param_set.key_params.aes.key, 0, |
8174 |
+ WLAN_KEY_LEN_CCMP); |
8175 |
+ priv->aes_key_v2.key_param_set.key_params.aes.key_len = |
8176 |
+- key_v2->key_param_set.key_params.aes.key_len; |
8177 |
+- len = priv->aes_key_v2.key_param_set.key_params.aes.key_len; |
8178 |
++ cpu_to_le16(len); |
8179 |
+ memcpy(priv->aes_key_v2.key_param_set.key_params.aes.key, |
8180 |
+- key_v2->key_param_set.key_params.aes.key, le16_to_cpu(len)); |
8181 |
++ key_v2->key_param_set.key_params.aes.key, len); |
8182 |
+ |
8183 |
+ return 0; |
8184 |
+ } |
8185 |
+diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c |
8186 |
+index 29a7aaabb6da..81d6127dc6fd 100644 |
8187 |
+--- a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c |
8188 |
++++ b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c |
8189 |
+@@ -167,8 +167,10 @@ mt7615_mcu_parse_response(struct mt7615_dev *dev, int cmd, |
8190 |
+ struct mt7615_mcu_rxd *rxd = (struct mt7615_mcu_rxd *)skb->data; |
8191 |
+ int ret = 0; |
8192 |
+ |
8193 |
+- if (seq != rxd->seq) |
8194 |
+- return -EAGAIN; |
8195 |
++ if (seq != rxd->seq) { |
8196 |
++ ret = -EAGAIN; |
8197 |
++ goto out; |
8198 |
++ } |
8199 |
+ |
8200 |
+ switch (cmd) { |
8201 |
+ case MCU_CMD_PATCH_SEM_CONTROL: |
8202 |
+@@ -182,6 +184,7 @@ mt7615_mcu_parse_response(struct mt7615_dev *dev, int cmd, |
8203 |
+ default: |
8204 |
+ break; |
8205 |
+ } |
8206 |
++out: |
8207 |
+ dev_kfree_skb(skb); |
8208 |
+ |
8209 |
+ return ret; |
8210 |
+@@ -1033,8 +1036,12 @@ mt7615_mcu_wtbl_sta_add(struct mt7615_dev *dev, struct ieee80211_vif *vif, |
8211 |
+ skb = enable ? wskb : sskb; |
8212 |
+ |
8213 |
+ err = __mt76_mcu_skb_send_msg(&dev->mt76, skb, cmd, true); |
8214 |
+- if (err < 0) |
8215 |
++ if (err < 0) { |
8216 |
++ skb = enable ? sskb : wskb; |
8217 |
++ dev_kfree_skb(skb); |
8218 |
++ |
8219 |
+ return err; |
8220 |
++ } |
8221 |
+ |
8222 |
+ cmd = enable ? MCU_EXT_CMD_STA_REC_UPDATE : MCU_EXT_CMD_WTBL_UPDATE; |
8223 |
+ skb = enable ? sskb : wskb; |
8224 |
+diff --git a/drivers/net/wireless/quantenna/qtnfmac/core.c b/drivers/net/wireless/quantenna/qtnfmac/core.c |
8225 |
+index eea777f8acea..6aafff9d4231 100644 |
8226 |
+--- a/drivers/net/wireless/quantenna/qtnfmac/core.c |
8227 |
++++ b/drivers/net/wireless/quantenna/qtnfmac/core.c |
8228 |
+@@ -446,8 +446,11 @@ static struct qtnf_wmac *qtnf_core_mac_alloc(struct qtnf_bus *bus, |
8229 |
+ } |
8230 |
+ |
8231 |
+ wiphy = qtnf_wiphy_allocate(bus, pdev); |
8232 |
+- if (!wiphy) |
8233 |
++ if (!wiphy) { |
8234 |
++ if (pdev) |
8235 |
++ platform_device_unregister(pdev); |
8236 |
+ return ERR_PTR(-ENOMEM); |
8237 |
++ } |
8238 |
+ |
8239 |
+ mac = wiphy_priv(wiphy); |
8240 |
+ |
8241 |
+diff --git a/drivers/net/wireless/realtek/rtw88/coex.c b/drivers/net/wireless/realtek/rtw88/coex.c |
8242 |
+index 567372fb4e12..c73101afbedd 100644 |
8243 |
+--- a/drivers/net/wireless/realtek/rtw88/coex.c |
8244 |
++++ b/drivers/net/wireless/realtek/rtw88/coex.c |
8245 |
+@@ -1920,7 +1920,8 @@ static void rtw_coex_run_coex(struct rtw_dev *rtwdev, u8 reason) |
8246 |
+ if (coex_stat->wl_under_ips) |
8247 |
+ return; |
8248 |
+ |
8249 |
+- if (coex->freeze && !coex_stat->bt_setup_link) |
8250 |
++ if (coex->freeze && coex_dm->reason == COEX_RSN_BTINFO && |
8251 |
++ !coex_stat->bt_setup_link) |
8252 |
+ return; |
8253 |
+ |
8254 |
+ coex_stat->cnt_wl[COEX_CNT_WL_COEXRUN]++; |
8255 |
+diff --git a/drivers/net/wireless/realtek/rtw88/fw.c b/drivers/net/wireless/realtek/rtw88/fw.c |
8256 |
+index 05c430b3489c..917decdbfb72 100644 |
8257 |
+--- a/drivers/net/wireless/realtek/rtw88/fw.c |
8258 |
++++ b/drivers/net/wireless/realtek/rtw88/fw.c |
8259 |
+@@ -444,7 +444,7 @@ void rtw_fw_send_ra_info(struct rtw_dev *rtwdev, struct rtw_sta_info *si) |
8260 |
+ SET_RA_INFO_INIT_RA_LVL(h2c_pkt, si->init_ra_lv); |
8261 |
+ SET_RA_INFO_SGI_EN(h2c_pkt, si->sgi_enable); |
8262 |
+ SET_RA_INFO_BW_MODE(h2c_pkt, si->bw_mode); |
8263 |
+- SET_RA_INFO_LDPC(h2c_pkt, si->ldpc_en); |
8264 |
++ SET_RA_INFO_LDPC(h2c_pkt, !!si->ldpc_en); |
8265 |
+ SET_RA_INFO_NO_UPDATE(h2c_pkt, no_update); |
8266 |
+ SET_RA_INFO_VHT_EN(h2c_pkt, si->vht_enable); |
8267 |
+ SET_RA_INFO_DIS_PT(h2c_pkt, disable_pt); |
8268 |
+diff --git a/drivers/net/wireless/realtek/rtw88/main.c b/drivers/net/wireless/realtek/rtw88/main.c |
8269 |
+index 7640e97706f5..72fe026e8a3c 100644 |
8270 |
+--- a/drivers/net/wireless/realtek/rtw88/main.c |
8271 |
++++ b/drivers/net/wireless/realtek/rtw88/main.c |
8272 |
+@@ -703,8 +703,6 @@ void rtw_update_sta_info(struct rtw_dev *rtwdev, struct rtw_sta_info *si) |
8273 |
+ stbc_en = VHT_STBC_EN; |
8274 |
+ if (sta->vht_cap.cap & IEEE80211_VHT_CAP_RXLDPC) |
8275 |
+ ldpc_en = VHT_LDPC_EN; |
8276 |
+- if (sta->vht_cap.cap & IEEE80211_VHT_CAP_SHORT_GI_80) |
8277 |
+- is_support_sgi = true; |
8278 |
+ } else if (sta->ht_cap.ht_supported) { |
8279 |
+ ra_mask |= (sta->ht_cap.mcs.rx_mask[1] << 20) | |
8280 |
+ (sta->ht_cap.mcs.rx_mask[0] << 12); |
8281 |
+@@ -712,9 +710,6 @@ void rtw_update_sta_info(struct rtw_dev *rtwdev, struct rtw_sta_info *si) |
8282 |
+ stbc_en = HT_STBC_EN; |
8283 |
+ if (sta->ht_cap.cap & IEEE80211_HT_CAP_LDPC_CODING) |
8284 |
+ ldpc_en = HT_LDPC_EN; |
8285 |
+- if (sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_20 || |
8286 |
+- sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_40) |
8287 |
+- is_support_sgi = true; |
8288 |
+ } |
8289 |
+ |
8290 |
+ if (efuse->hw_cap.nss == 1) |
8291 |
+@@ -756,12 +751,18 @@ void rtw_update_sta_info(struct rtw_dev *rtwdev, struct rtw_sta_info *si) |
8292 |
+ switch (sta->bandwidth) { |
8293 |
+ case IEEE80211_STA_RX_BW_80: |
8294 |
+ bw_mode = RTW_CHANNEL_WIDTH_80; |
8295 |
++ is_support_sgi = sta->vht_cap.vht_supported && |
8296 |
++ (sta->vht_cap.cap & IEEE80211_VHT_CAP_SHORT_GI_80); |
8297 |
+ break; |
8298 |
+ case IEEE80211_STA_RX_BW_40: |
8299 |
+ bw_mode = RTW_CHANNEL_WIDTH_40; |
8300 |
++ is_support_sgi = sta->ht_cap.ht_supported && |
8301 |
++ (sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_40); |
8302 |
+ break; |
8303 |
+ default: |
8304 |
+ bw_mode = RTW_CHANNEL_WIDTH_20; |
8305 |
++ is_support_sgi = sta->ht_cap.ht_supported && |
8306 |
++ (sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_20); |
8307 |
+ break; |
8308 |
+ } |
8309 |
+ |
8310 |
+diff --git a/drivers/net/wireless/ti/wl1251/event.c b/drivers/net/wireless/ti/wl1251/event.c |
8311 |
+index 850864dbafa1..e6d426edab56 100644 |
8312 |
+--- a/drivers/net/wireless/ti/wl1251/event.c |
8313 |
++++ b/drivers/net/wireless/ti/wl1251/event.c |
8314 |
+@@ -70,7 +70,7 @@ static int wl1251_event_ps_report(struct wl1251 *wl, |
8315 |
+ break; |
8316 |
+ } |
8317 |
+ |
8318 |
+- return 0; |
8319 |
++ return ret; |
8320 |
+ } |
8321 |
+ |
8322 |
+ static void wl1251_event_mbox_dump(struct event_mailbox *mbox) |
8323 |
+diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c |
8324 |
+index 36db7d2e6a89..d3914b7e8f52 100644 |
8325 |
+--- a/drivers/nvme/host/multipath.c |
8326 |
++++ b/drivers/nvme/host/multipath.c |
8327 |
+@@ -246,6 +246,12 @@ static struct nvme_ns *nvme_round_robin_path(struct nvme_ns_head *head, |
8328 |
+ fallback = ns; |
8329 |
+ } |
8330 |
+ |
8331 |
++ /* No optimized path found, re-check the current path */ |
8332 |
++ if (!nvme_path_is_disabled(old) && |
8333 |
++ old->ana_state == NVME_ANA_OPTIMIZED) { |
8334 |
++ found = old; |
8335 |
++ goto out; |
8336 |
++ } |
8337 |
+ if (!fallback) |
8338 |
+ return NULL; |
8339 |
+ found = fallback; |
8340 |
+@@ -266,10 +272,13 @@ inline struct nvme_ns *nvme_find_path(struct nvme_ns_head *head) |
8341 |
+ struct nvme_ns *ns; |
8342 |
+ |
8343 |
+ ns = srcu_dereference(head->current_path[node], &head->srcu); |
8344 |
+- if (READ_ONCE(head->subsys->iopolicy) == NVME_IOPOLICY_RR && ns) |
8345 |
+- ns = nvme_round_robin_path(head, node, ns); |
8346 |
+- if (unlikely(!ns || !nvme_path_is_optimized(ns))) |
8347 |
+- ns = __nvme_find_path(head, node); |
8348 |
++ if (unlikely(!ns)) |
8349 |
++ return __nvme_find_path(head, node); |
8350 |
++ |
8351 |
++ if (READ_ONCE(head->subsys->iopolicy) == NVME_IOPOLICY_RR) |
8352 |
++ return nvme_round_robin_path(head, node, ns); |
8353 |
++ if (unlikely(!nvme_path_is_optimized(ns))) |
8354 |
++ return __nvme_find_path(head, node); |
8355 |
+ return ns; |
8356 |
+ } |
8357 |
+ |
8358 |
+diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c |
8359 |
+index 1f9a45145d0d..19c94080512c 100644 |
8360 |
+--- a/drivers/nvme/host/rdma.c |
8361 |
++++ b/drivers/nvme/host/rdma.c |
8362 |
+@@ -882,15 +882,20 @@ static int nvme_rdma_configure_io_queues(struct nvme_rdma_ctrl *ctrl, bool new) |
8363 |
+ ret = PTR_ERR(ctrl->ctrl.connect_q); |
8364 |
+ goto out_free_tag_set; |
8365 |
+ } |
8366 |
+- } else { |
8367 |
+- blk_mq_update_nr_hw_queues(&ctrl->tag_set, |
8368 |
+- ctrl->ctrl.queue_count - 1); |
8369 |
+ } |
8370 |
+ |
8371 |
+ ret = nvme_rdma_start_io_queues(ctrl); |
8372 |
+ if (ret) |
8373 |
+ goto out_cleanup_connect_q; |
8374 |
+ |
8375 |
++ if (!new) { |
8376 |
++ nvme_start_queues(&ctrl->ctrl); |
8377 |
++ nvme_wait_freeze(&ctrl->ctrl); |
8378 |
++ blk_mq_update_nr_hw_queues(ctrl->ctrl.tagset, |
8379 |
++ ctrl->ctrl.queue_count - 1); |
8380 |
++ nvme_unfreeze(&ctrl->ctrl); |
8381 |
++ } |
8382 |
++ |
8383 |
+ return 0; |
8384 |
+ |
8385 |
+ out_cleanup_connect_q: |
8386 |
+@@ -923,6 +928,7 @@ static void nvme_rdma_teardown_io_queues(struct nvme_rdma_ctrl *ctrl, |
8387 |
+ bool remove) |
8388 |
+ { |
8389 |
+ if (ctrl->ctrl.queue_count > 1) { |
8390 |
++ nvme_start_freeze(&ctrl->ctrl); |
8391 |
+ nvme_stop_queues(&ctrl->ctrl); |
8392 |
+ nvme_rdma_stop_io_queues(ctrl); |
8393 |
+ if (ctrl->ctrl.tagset) { |
8394 |
+diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c |
8395 |
+index 26461bf3fdcc..99eaa0474e10 100644 |
8396 |
+--- a/drivers/nvme/host/tcp.c |
8397 |
++++ b/drivers/nvme/host/tcp.c |
8398 |
+@@ -1753,15 +1753,20 @@ static int nvme_tcp_configure_io_queues(struct nvme_ctrl *ctrl, bool new) |
8399 |
+ ret = PTR_ERR(ctrl->connect_q); |
8400 |
+ goto out_free_tag_set; |
8401 |
+ } |
8402 |
+- } else { |
8403 |
+- blk_mq_update_nr_hw_queues(ctrl->tagset, |
8404 |
+- ctrl->queue_count - 1); |
8405 |
+ } |
8406 |
+ |
8407 |
+ ret = nvme_tcp_start_io_queues(ctrl); |
8408 |
+ if (ret) |
8409 |
+ goto out_cleanup_connect_q; |
8410 |
+ |
8411 |
++ if (!new) { |
8412 |
++ nvme_start_queues(ctrl); |
8413 |
++ nvme_wait_freeze(ctrl); |
8414 |
++ blk_mq_update_nr_hw_queues(ctrl->tagset, |
8415 |
++ ctrl->queue_count - 1); |
8416 |
++ nvme_unfreeze(ctrl); |
8417 |
++ } |
8418 |
++ |
8419 |
+ return 0; |
8420 |
+ |
8421 |
+ out_cleanup_connect_q: |
8422 |
+@@ -1866,6 +1871,7 @@ static void nvme_tcp_teardown_io_queues(struct nvme_ctrl *ctrl, |
8423 |
+ { |
8424 |
+ if (ctrl->queue_count <= 1) |
8425 |
+ return; |
8426 |
++ nvme_start_freeze(ctrl); |
8427 |
+ nvme_stop_queues(ctrl); |
8428 |
+ nvme_tcp_stop_io_queues(ctrl); |
8429 |
+ if (ctrl->tagset) { |
8430 |
+diff --git a/drivers/nvmem/sprd-efuse.c b/drivers/nvmem/sprd-efuse.c |
8431 |
+index 925feb21d5ad..59523245db8a 100644 |
8432 |
+--- a/drivers/nvmem/sprd-efuse.c |
8433 |
++++ b/drivers/nvmem/sprd-efuse.c |
8434 |
+@@ -378,8 +378,8 @@ static int sprd_efuse_probe(struct platform_device *pdev) |
8435 |
+ return -ENOMEM; |
8436 |
+ |
8437 |
+ efuse->base = devm_platform_ioremap_resource(pdev, 0); |
8438 |
+- if (!efuse->base) |
8439 |
+- return -ENOMEM; |
8440 |
++ if (IS_ERR(efuse->base)) |
8441 |
++ return PTR_ERR(efuse->base); |
8442 |
+ |
8443 |
+ ret = of_hwspin_lock_get_id(np, 0); |
8444 |
+ if (ret < 0) { |
8445 |
+diff --git a/drivers/parisc/sba_iommu.c b/drivers/parisc/sba_iommu.c |
8446 |
+index 7e112829d250..00785fa81ff7 100644 |
8447 |
+--- a/drivers/parisc/sba_iommu.c |
8448 |
++++ b/drivers/parisc/sba_iommu.c |
8449 |
+@@ -1270,7 +1270,7 @@ sba_ioc_init_pluto(struct parisc_device *sba, struct ioc *ioc, int ioc_num) |
8450 |
+ ** (one that doesn't overlap memory or LMMIO space) in the |
8451 |
+ ** IBASE and IMASK registers. |
8452 |
+ */ |
8453 |
+- ioc->ibase = READ_REG(ioc->ioc_hpa + IOC_IBASE); |
8454 |
++ ioc->ibase = READ_REG(ioc->ioc_hpa + IOC_IBASE) & ~0x1fffffULL; |
8455 |
+ iova_space_size = ~(READ_REG(ioc->ioc_hpa + IOC_IMASK) & 0xFFFFFFFFUL) + 1; |
8456 |
+ |
8457 |
+ if ((ioc->ibase < 0xfed00000UL) && ((ioc->ibase + iova_space_size) > 0xfee00000UL)) { |
8458 |
+diff --git a/drivers/pci/access.c b/drivers/pci/access.c |
8459 |
+index 79c4a2ef269a..9793f17fa184 100644 |
8460 |
+--- a/drivers/pci/access.c |
8461 |
++++ b/drivers/pci/access.c |
8462 |
+@@ -204,17 +204,13 @@ EXPORT_SYMBOL(pci_bus_set_ops); |
8463 |
+ static DECLARE_WAIT_QUEUE_HEAD(pci_cfg_wait); |
8464 |
+ |
8465 |
+ static noinline void pci_wait_cfg(struct pci_dev *dev) |
8466 |
++ __must_hold(&pci_lock) |
8467 |
+ { |
8468 |
+- DECLARE_WAITQUEUE(wait, current); |
8469 |
+- |
8470 |
+- __add_wait_queue(&pci_cfg_wait, &wait); |
8471 |
+ do { |
8472 |
+- set_current_state(TASK_UNINTERRUPTIBLE); |
8473 |
+ raw_spin_unlock_irq(&pci_lock); |
8474 |
+- schedule(); |
8475 |
++ wait_event(pci_cfg_wait, !dev->block_cfg_access); |
8476 |
+ raw_spin_lock_irq(&pci_lock); |
8477 |
+ } while (dev->block_cfg_access); |
8478 |
+- __remove_wait_queue(&pci_cfg_wait, &wait); |
8479 |
+ } |
8480 |
+ |
8481 |
+ /* Returns 0 on success, negative values indicate error. */ |
8482 |
+diff --git a/drivers/pci/controller/cadence/pcie-cadence-ep.c b/drivers/pci/controller/cadence/pcie-cadence-ep.c |
8483 |
+index 1c173dad67d1..1fdae37843ef 100644 |
8484 |
+--- a/drivers/pci/controller/cadence/pcie-cadence-ep.c |
8485 |
++++ b/drivers/pci/controller/cadence/pcie-cadence-ep.c |
8486 |
+@@ -8,7 +8,6 @@ |
8487 |
+ #include <linux/of.h> |
8488 |
+ #include <linux/pci-epc.h> |
8489 |
+ #include <linux/platform_device.h> |
8490 |
+-#include <linux/pm_runtime.h> |
8491 |
+ #include <linux/sizes.h> |
8492 |
+ |
8493 |
+ #include "pcie-cadence.h" |
8494 |
+@@ -440,8 +439,7 @@ int cdns_pcie_ep_setup(struct cdns_pcie_ep *ep) |
8495 |
+ epc = devm_pci_epc_create(dev, &cdns_pcie_epc_ops); |
8496 |
+ if (IS_ERR(epc)) { |
8497 |
+ dev_err(dev, "failed to create epc device\n"); |
8498 |
+- ret = PTR_ERR(epc); |
8499 |
+- goto err_init; |
8500 |
++ return PTR_ERR(epc); |
8501 |
+ } |
8502 |
+ |
8503 |
+ epc_set_drvdata(epc, ep); |
8504 |
+@@ -453,7 +451,7 @@ int cdns_pcie_ep_setup(struct cdns_pcie_ep *ep) |
8505 |
+ resource_size(pcie->mem_res)); |
8506 |
+ if (ret < 0) { |
8507 |
+ dev_err(dev, "failed to initialize the memory space\n"); |
8508 |
+- goto err_init; |
8509 |
++ return ret; |
8510 |
+ } |
8511 |
+ |
8512 |
+ ep->irq_cpu_addr = pci_epc_mem_alloc_addr(epc, &ep->irq_phys_addr, |
8513 |
+@@ -472,8 +470,5 @@ int cdns_pcie_ep_setup(struct cdns_pcie_ep *ep) |
8514 |
+ free_epc_mem: |
8515 |
+ pci_epc_mem_exit(epc); |
8516 |
+ |
8517 |
+- err_init: |
8518 |
+- pm_runtime_put_sync(dev); |
8519 |
+- |
8520 |
+ return ret; |
8521 |
+ } |
8522 |
+diff --git a/drivers/pci/controller/cadence/pcie-cadence-host.c b/drivers/pci/controller/cadence/pcie-cadence-host.c |
8523 |
+index 9b1c3966414b..aa18fb724d2e 100644 |
8524 |
+--- a/drivers/pci/controller/cadence/pcie-cadence-host.c |
8525 |
++++ b/drivers/pci/controller/cadence/pcie-cadence-host.c |
8526 |
+@@ -7,7 +7,6 @@ |
8527 |
+ #include <linux/of_address.h> |
8528 |
+ #include <linux/of_pci.h> |
8529 |
+ #include <linux/platform_device.h> |
8530 |
+-#include <linux/pm_runtime.h> |
8531 |
+ |
8532 |
+ #include "pcie-cadence.h" |
8533 |
+ |
8534 |
+@@ -70,6 +69,7 @@ static int cdns_pcie_host_init_root_port(struct cdns_pcie_rc *rc) |
8535 |
+ { |
8536 |
+ struct cdns_pcie *pcie = &rc->pcie; |
8537 |
+ u32 value, ctrl; |
8538 |
++ u32 id; |
8539 |
+ |
8540 |
+ /* |
8541 |
+ * Set the root complex BAR configuration register: |
8542 |
+@@ -89,8 +89,12 @@ static int cdns_pcie_host_init_root_port(struct cdns_pcie_rc *rc) |
8543 |
+ cdns_pcie_writel(pcie, CDNS_PCIE_LM_RC_BAR_CFG, value); |
8544 |
+ |
8545 |
+ /* Set root port configuration space */ |
8546 |
+- if (rc->vendor_id != 0xffff) |
8547 |
+- cdns_pcie_rp_writew(pcie, PCI_VENDOR_ID, rc->vendor_id); |
8548 |
++ if (rc->vendor_id != 0xffff) { |
8549 |
++ id = CDNS_PCIE_LM_ID_VENDOR(rc->vendor_id) | |
8550 |
++ CDNS_PCIE_LM_ID_SUBSYS(rc->vendor_id); |
8551 |
++ cdns_pcie_writel(pcie, CDNS_PCIE_LM_ID, id); |
8552 |
++ } |
8553 |
++ |
8554 |
+ if (rc->device_id != 0xffff) |
8555 |
+ cdns_pcie_rp_writew(pcie, PCI_DEVICE_ID, rc->device_id); |
8556 |
+ |
8557 |
+@@ -256,7 +260,7 @@ int cdns_pcie_host_setup(struct cdns_pcie_rc *rc) |
8558 |
+ |
8559 |
+ ret = cdns_pcie_host_init(dev, &resources, rc); |
8560 |
+ if (ret) |
8561 |
+- goto err_init; |
8562 |
++ return ret; |
8563 |
+ |
8564 |
+ list_splice_init(&resources, &bridge->windows); |
8565 |
+ bridge->dev.parent = dev; |
8566 |
+@@ -274,8 +278,5 @@ int cdns_pcie_host_setup(struct cdns_pcie_rc *rc) |
8567 |
+ err_host_probe: |
8568 |
+ pci_free_resource_list(&resources); |
8569 |
+ |
8570 |
+- err_init: |
8571 |
+- pm_runtime_put_sync(dev); |
8572 |
+- |
8573 |
+ return ret; |
8574 |
+ } |
8575 |
+diff --git a/drivers/pci/controller/vmd.c b/drivers/pci/controller/vmd.c |
8576 |
+index 9a64cf90c291..ebec0a6e77ed 100644 |
8577 |
+--- a/drivers/pci/controller/vmd.c |
8578 |
++++ b/drivers/pci/controller/vmd.c |
8579 |
+@@ -560,6 +560,7 @@ static int vmd_enable_domain(struct vmd_dev *vmd, unsigned long features) |
8580 |
+ if (!vmd->bus) { |
8581 |
+ pci_free_resource_list(&resources); |
8582 |
+ irq_domain_remove(vmd->irq_domain); |
8583 |
++ irq_domain_free_fwnode(fn); |
8584 |
+ return -ENODEV; |
8585 |
+ } |
8586 |
+ |
8587 |
+@@ -673,6 +674,7 @@ static void vmd_cleanup_srcu(struct vmd_dev *vmd) |
8588 |
+ static void vmd_remove(struct pci_dev *dev) |
8589 |
+ { |
8590 |
+ struct vmd_dev *vmd = pci_get_drvdata(dev); |
8591 |
++ struct fwnode_handle *fn = vmd->irq_domain->fwnode; |
8592 |
+ |
8593 |
+ sysfs_remove_link(&vmd->dev->dev.kobj, "domain"); |
8594 |
+ pci_stop_root_bus(vmd->bus); |
8595 |
+@@ -680,6 +682,7 @@ static void vmd_remove(struct pci_dev *dev) |
8596 |
+ vmd_cleanup_srcu(vmd); |
8597 |
+ vmd_detach_resources(vmd); |
8598 |
+ irq_domain_remove(vmd->irq_domain); |
8599 |
++ irq_domain_free_fwnode(fn); |
8600 |
+ } |
8601 |
+ |
8602 |
+ #ifdef CONFIG_PM_SLEEP |
8603 |
+diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c |
8604 |
+index b17e5ffd31b1..253c30cc1967 100644 |
8605 |
+--- a/drivers/pci/pcie/aspm.c |
8606 |
++++ b/drivers/pci/pcie/aspm.c |
8607 |
+@@ -1182,6 +1182,7 @@ static int pcie_aspm_get_policy(char *buffer, const struct kernel_param *kp) |
8608 |
+ cnt += sprintf(buffer + cnt, "[%s] ", policy_str[i]); |
8609 |
+ else |
8610 |
+ cnt += sprintf(buffer + cnt, "%s ", policy_str[i]); |
8611 |
++ cnt += sprintf(buffer + cnt, "\n"); |
8612 |
+ return cnt; |
8613 |
+ } |
8614 |
+ |
8615 |
+diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c |
8616 |
+index cd522dd3dd58..5622603d96d4 100644 |
8617 |
+--- a/drivers/pci/quirks.c |
8618 |
++++ b/drivers/pci/quirks.c |
8619 |
+@@ -4422,6 +4422,8 @@ static int pci_quirk_amd_sb_acs(struct pci_dev *dev, u16 acs_flags) |
8620 |
+ if (ACPI_FAILURE(status)) |
8621 |
+ return -ENODEV; |
8622 |
+ |
8623 |
++ acpi_put_table(header); |
8624 |
++ |
8625 |
+ /* Filter out flags not applicable to multifunction */ |
8626 |
+ acs_flags &= (PCI_ACS_RR | PCI_ACS_CR | PCI_ACS_EC | PCI_ACS_DT); |
8627 |
+ |
8628 |
+diff --git a/drivers/phy/marvell/phy-armada38x-comphy.c b/drivers/phy/marvell/phy-armada38x-comphy.c |
8629 |
+index 6960dfd8ad8c..0fe408964334 100644 |
8630 |
+--- a/drivers/phy/marvell/phy-armada38x-comphy.c |
8631 |
++++ b/drivers/phy/marvell/phy-armada38x-comphy.c |
8632 |
+@@ -41,6 +41,7 @@ struct a38x_comphy_lane { |
8633 |
+ |
8634 |
+ struct a38x_comphy { |
8635 |
+ void __iomem *base; |
8636 |
++ void __iomem *conf; |
8637 |
+ struct device *dev; |
8638 |
+ struct a38x_comphy_lane lane[MAX_A38X_COMPHY]; |
8639 |
+ }; |
8640 |
+@@ -54,6 +55,21 @@ static const u8 gbe_mux[MAX_A38X_COMPHY][MAX_A38X_PORTS] = { |
8641 |
+ { 0, 0, 3 }, |
8642 |
+ }; |
8643 |
+ |
8644 |
++static void a38x_set_conf(struct a38x_comphy_lane *lane, bool enable) |
8645 |
++{ |
8646 |
++ struct a38x_comphy *priv = lane->priv; |
8647 |
++ u32 conf; |
8648 |
++ |
8649 |
++ if (priv->conf) { |
8650 |
++ conf = readl_relaxed(priv->conf); |
8651 |
++ if (enable) |
8652 |
++ conf |= BIT(lane->port); |
8653 |
++ else |
8654 |
++ conf &= ~BIT(lane->port); |
8655 |
++ writel(conf, priv->conf); |
8656 |
++ } |
8657 |
++} |
8658 |
++ |
8659 |
+ static void a38x_comphy_set_reg(struct a38x_comphy_lane *lane, |
8660 |
+ unsigned int offset, u32 mask, u32 value) |
8661 |
+ { |
8662 |
+@@ -97,6 +113,7 @@ static int a38x_comphy_set_mode(struct phy *phy, enum phy_mode mode, int sub) |
8663 |
+ { |
8664 |
+ struct a38x_comphy_lane *lane = phy_get_drvdata(phy); |
8665 |
+ unsigned int gen; |
8666 |
++ int ret; |
8667 |
+ |
8668 |
+ if (mode != PHY_MODE_ETHERNET) |
8669 |
+ return -EINVAL; |
8670 |
+@@ -115,13 +132,20 @@ static int a38x_comphy_set_mode(struct phy *phy, enum phy_mode mode, int sub) |
8671 |
+ return -EINVAL; |
8672 |
+ } |
8673 |
+ |
8674 |
++ a38x_set_conf(lane, false); |
8675 |
++ |
8676 |
+ a38x_comphy_set_speed(lane, gen, gen); |
8677 |
+ |
8678 |
+- return a38x_comphy_poll(lane, COMPHY_STAT1, |
8679 |
+- COMPHY_STAT1_PLL_RDY_TX | |
8680 |
+- COMPHY_STAT1_PLL_RDY_RX, |
8681 |
+- COMPHY_STAT1_PLL_RDY_TX | |
8682 |
+- COMPHY_STAT1_PLL_RDY_RX); |
8683 |
++ ret = a38x_comphy_poll(lane, COMPHY_STAT1, |
8684 |
++ COMPHY_STAT1_PLL_RDY_TX | |
8685 |
++ COMPHY_STAT1_PLL_RDY_RX, |
8686 |
++ COMPHY_STAT1_PLL_RDY_TX | |
8687 |
++ COMPHY_STAT1_PLL_RDY_RX); |
8688 |
++ |
8689 |
++ if (ret == 0) |
8690 |
++ a38x_set_conf(lane, true); |
8691 |
++ |
8692 |
++ return ret; |
8693 |
+ } |
8694 |
+ |
8695 |
+ static const struct phy_ops a38x_comphy_ops = { |
8696 |
+@@ -174,14 +198,21 @@ static int a38x_comphy_probe(struct platform_device *pdev) |
8697 |
+ if (!priv) |
8698 |
+ return -ENOMEM; |
8699 |
+ |
8700 |
+- res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
8701 |
+- base = devm_ioremap_resource(&pdev->dev, res); |
8702 |
++ base = devm_platform_ioremap_resource(pdev, 0); |
8703 |
+ if (IS_ERR(base)) |
8704 |
+ return PTR_ERR(base); |
8705 |
+ |
8706 |
+ priv->dev = &pdev->dev; |
8707 |
+ priv->base = base; |
8708 |
+ |
8709 |
++ /* Optional */ |
8710 |
++ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "conf"); |
8711 |
++ if (res) { |
8712 |
++ priv->conf = devm_ioremap_resource(&pdev->dev, res); |
8713 |
++ if (IS_ERR(priv->conf)) |
8714 |
++ return PTR_ERR(priv->conf); |
8715 |
++ } |
8716 |
++ |
8717 |
+ for_each_available_child_of_node(pdev->dev.of_node, child) { |
8718 |
+ struct phy *phy; |
8719 |
+ int ret; |
8720 |
+diff --git a/drivers/phy/renesas/phy-rcar-gen3-usb2.c b/drivers/phy/renesas/phy-rcar-gen3-usb2.c |
8721 |
+index bfb22f868857..5087b7c44d55 100644 |
8722 |
+--- a/drivers/phy/renesas/phy-rcar-gen3-usb2.c |
8723 |
++++ b/drivers/phy/renesas/phy-rcar-gen3-usb2.c |
8724 |
+@@ -111,6 +111,7 @@ struct rcar_gen3_chan { |
8725 |
+ struct work_struct work; |
8726 |
+ struct mutex lock; /* protects rphys[...].powered */ |
8727 |
+ enum usb_dr_mode dr_mode; |
8728 |
++ int irq; |
8729 |
+ bool extcon_host; |
8730 |
+ bool is_otg_channel; |
8731 |
+ bool uses_otg_pins; |
8732 |
+@@ -389,12 +390,38 @@ static void rcar_gen3_init_otg(struct rcar_gen3_chan *ch) |
8733 |
+ rcar_gen3_device_recognition(ch); |
8734 |
+ } |
8735 |
+ |
8736 |
++static irqreturn_t rcar_gen3_phy_usb2_irq(int irq, void *_ch) |
8737 |
++{ |
8738 |
++ struct rcar_gen3_chan *ch = _ch; |
8739 |
++ void __iomem *usb2_base = ch->base; |
8740 |
++ u32 status = readl(usb2_base + USB2_OBINTSTA); |
8741 |
++ irqreturn_t ret = IRQ_NONE; |
8742 |
++ |
8743 |
++ if (status & USB2_OBINT_BITS) { |
8744 |
++ dev_vdbg(ch->dev, "%s: %08x\n", __func__, status); |
8745 |
++ writel(USB2_OBINT_BITS, usb2_base + USB2_OBINTSTA); |
8746 |
++ rcar_gen3_device_recognition(ch); |
8747 |
++ ret = IRQ_HANDLED; |
8748 |
++ } |
8749 |
++ |
8750 |
++ return ret; |
8751 |
++} |
8752 |
++ |
8753 |
+ static int rcar_gen3_phy_usb2_init(struct phy *p) |
8754 |
+ { |
8755 |
+ struct rcar_gen3_phy *rphy = phy_get_drvdata(p); |
8756 |
+ struct rcar_gen3_chan *channel = rphy->ch; |
8757 |
+ void __iomem *usb2_base = channel->base; |
8758 |
+ u32 val; |
8759 |
++ int ret; |
8760 |
++ |
8761 |
++ if (!rcar_gen3_is_any_rphy_initialized(channel) && channel->irq >= 0) { |
8762 |
++ INIT_WORK(&channel->work, rcar_gen3_phy_usb2_work); |
8763 |
++ ret = request_irq(channel->irq, rcar_gen3_phy_usb2_irq, |
8764 |
++ IRQF_SHARED, dev_name(channel->dev), channel); |
8765 |
++ if (ret < 0) |
8766 |
++ dev_err(channel->dev, "No irq handler (%d)\n", channel->irq); |
8767 |
++ } |
8768 |
+ |
8769 |
+ /* Initialize USB2 part */ |
8770 |
+ val = readl(usb2_base + USB2_INT_ENABLE); |
8771 |
+@@ -433,6 +460,9 @@ static int rcar_gen3_phy_usb2_exit(struct phy *p) |
8772 |
+ val &= ~USB2_INT_ENABLE_UCOM_INTEN; |
8773 |
+ writel(val, usb2_base + USB2_INT_ENABLE); |
8774 |
+ |
8775 |
++ if (channel->irq >= 0 && !rcar_gen3_is_any_rphy_initialized(channel)) |
8776 |
++ free_irq(channel->irq, channel); |
8777 |
++ |
8778 |
+ return 0; |
8779 |
+ } |
8780 |
+ |
8781 |
+@@ -503,23 +533,6 @@ static const struct phy_ops rz_g1c_phy_usb2_ops = { |
8782 |
+ .owner = THIS_MODULE, |
8783 |
+ }; |
8784 |
+ |
8785 |
+-static irqreturn_t rcar_gen3_phy_usb2_irq(int irq, void *_ch) |
8786 |
+-{ |
8787 |
+- struct rcar_gen3_chan *ch = _ch; |
8788 |
+- void __iomem *usb2_base = ch->base; |
8789 |
+- u32 status = readl(usb2_base + USB2_OBINTSTA); |
8790 |
+- irqreturn_t ret = IRQ_NONE; |
8791 |
+- |
8792 |
+- if (status & USB2_OBINT_BITS) { |
8793 |
+- dev_vdbg(ch->dev, "%s: %08x\n", __func__, status); |
8794 |
+- writel(USB2_OBINT_BITS, usb2_base + USB2_OBINTSTA); |
8795 |
+- rcar_gen3_device_recognition(ch); |
8796 |
+- ret = IRQ_HANDLED; |
8797 |
+- } |
8798 |
+- |
8799 |
+- return ret; |
8800 |
+-} |
8801 |
+- |
8802 |
+ static const struct of_device_id rcar_gen3_phy_usb2_match_table[] = { |
8803 |
+ { |
8804 |
+ .compatible = "renesas,usb2-phy-r8a77470", |
8805 |
+@@ -598,7 +611,7 @@ static int rcar_gen3_phy_usb2_probe(struct platform_device *pdev) |
8806 |
+ struct phy_provider *provider; |
8807 |
+ struct resource *res; |
8808 |
+ const struct phy_ops *phy_usb2_ops; |
8809 |
+- int irq, ret = 0, i; |
8810 |
++ int ret = 0, i; |
8811 |
+ |
8812 |
+ if (!dev->of_node) { |
8813 |
+ dev_err(dev, "This driver needs device tree\n"); |
8814 |
+@@ -614,16 +627,8 @@ static int rcar_gen3_phy_usb2_probe(struct platform_device *pdev) |
8815 |
+ if (IS_ERR(channel->base)) |
8816 |
+ return PTR_ERR(channel->base); |
8817 |
+ |
8818 |
+- /* call request_irq for OTG */ |
8819 |
+- irq = platform_get_irq_optional(pdev, 0); |
8820 |
+- if (irq >= 0) { |
8821 |
+- INIT_WORK(&channel->work, rcar_gen3_phy_usb2_work); |
8822 |
+- irq = devm_request_irq(dev, irq, rcar_gen3_phy_usb2_irq, |
8823 |
+- IRQF_SHARED, dev_name(dev), channel); |
8824 |
+- if (irq < 0) |
8825 |
+- dev_err(dev, "No irq handler (%d)\n", irq); |
8826 |
+- } |
8827 |
+- |
8828 |
++ /* get irq number here and request_irq for OTG in phy_init */ |
8829 |
++ channel->irq = platform_get_irq_optional(pdev, 0); |
8830 |
+ channel->dr_mode = rcar_gen3_get_dr_mode(dev->of_node); |
8831 |
+ if (channel->dr_mode != USB_DR_MODE_UNKNOWN) { |
8832 |
+ int ret; |
8833 |
+diff --git a/drivers/phy/samsung/phy-exynos5-usbdrd.c b/drivers/phy/samsung/phy-exynos5-usbdrd.c |
8834 |
+index e510732afb8b..7f6279fb4f8f 100644 |
8835 |
+--- a/drivers/phy/samsung/phy-exynos5-usbdrd.c |
8836 |
++++ b/drivers/phy/samsung/phy-exynos5-usbdrd.c |
8837 |
+@@ -714,7 +714,9 @@ static int exynos5_usbdrd_phy_calibrate(struct phy *phy) |
8838 |
+ struct phy_usb_instance *inst = phy_get_drvdata(phy); |
8839 |
+ struct exynos5_usbdrd_phy *phy_drd = to_usbdrd_phy(inst); |
8840 |
+ |
8841 |
+- return exynos5420_usbdrd_phy_calibrate(phy_drd); |
8842 |
++ if (inst->phy_cfg->id == EXYNOS5_DRDPHY_UTMI) |
8843 |
++ return exynos5420_usbdrd_phy_calibrate(phy_drd); |
8844 |
++ return 0; |
8845 |
+ } |
8846 |
+ |
8847 |
+ static const struct phy_ops exynos5_usbdrd_phy_ops = { |
8848 |
+diff --git a/drivers/pinctrl/pinctrl-single.c b/drivers/pinctrl/pinctrl-single.c |
8849 |
+index 1e0614daee9b..a9d511982780 100644 |
8850 |
+--- a/drivers/pinctrl/pinctrl-single.c |
8851 |
++++ b/drivers/pinctrl/pinctrl-single.c |
8852 |
+@@ -916,7 +916,7 @@ static int pcs_parse_pinconf(struct pcs_device *pcs, struct device_node *np, |
8853 |
+ |
8854 |
+ /* If pinconf isn't supported, don't parse properties in below. */ |
8855 |
+ if (!PCS_HAS_PINCONF) |
8856 |
+- return 0; |
8857 |
++ return -ENOTSUPP; |
8858 |
+ |
8859 |
+ /* cacluate how much properties are supported in current node */ |
8860 |
+ for (i = 0; i < ARRAY_SIZE(prop2); i++) { |
8861 |
+@@ -928,7 +928,7 @@ static int pcs_parse_pinconf(struct pcs_device *pcs, struct device_node *np, |
8862 |
+ nconfs++; |
8863 |
+ } |
8864 |
+ if (!nconfs) |
8865 |
+- return 0; |
8866 |
++ return -ENOTSUPP; |
8867 |
+ |
8868 |
+ func->conf = devm_kcalloc(pcs->dev, |
8869 |
+ nconfs, sizeof(struct pcs_conf_vals), |
8870 |
+@@ -1056,9 +1056,12 @@ static int pcs_parse_one_pinctrl_entry(struct pcs_device *pcs, |
8871 |
+ |
8872 |
+ if (PCS_HAS_PINCONF && function) { |
8873 |
+ res = pcs_parse_pinconf(pcs, np, function, map); |
8874 |
+- if (res) |
8875 |
++ if (res == 0) |
8876 |
++ *num_maps = 2; |
8877 |
++ else if (res == -ENOTSUPP) |
8878 |
++ *num_maps = 1; |
8879 |
++ else |
8880 |
+ goto free_pingroups; |
8881 |
+- *num_maps = 2; |
8882 |
+ } else { |
8883 |
+ *num_maps = 1; |
8884 |
+ } |
8885 |
+diff --git a/drivers/platform/x86/asus-nb-wmi.c b/drivers/platform/x86/asus-nb-wmi.c |
8886 |
+index c4404d9c1de4..1bb082308c20 100644 |
8887 |
+--- a/drivers/platform/x86/asus-nb-wmi.c |
8888 |
++++ b/drivers/platform/x86/asus-nb-wmi.c |
8889 |
+@@ -110,6 +110,16 @@ static struct quirk_entry quirk_asus_forceals = { |
8890 |
+ .wmi_force_als_set = true, |
8891 |
+ }; |
8892 |
+ |
8893 |
++static struct quirk_entry quirk_asus_ga401i = { |
8894 |
++ .wmi_backlight_power = true, |
8895 |
++ .wmi_backlight_set_devstate = true, |
8896 |
++}; |
8897 |
++ |
8898 |
++static struct quirk_entry quirk_asus_ga502i = { |
8899 |
++ .wmi_backlight_power = true, |
8900 |
++ .wmi_backlight_set_devstate = true, |
8901 |
++}; |
8902 |
++ |
8903 |
+ static int dmi_matched(const struct dmi_system_id *dmi) |
8904 |
+ { |
8905 |
+ pr_info("Identified laptop model '%s'\n", dmi->ident); |
8906 |
+@@ -411,6 +421,78 @@ static const struct dmi_system_id asus_quirks[] = { |
8907 |
+ }, |
8908 |
+ .driver_data = &quirk_asus_forceals, |
8909 |
+ }, |
8910 |
++ { |
8911 |
++ .callback = dmi_matched, |
8912 |
++ .ident = "ASUSTeK COMPUTER INC. GA401IH", |
8913 |
++ .matches = { |
8914 |
++ DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), |
8915 |
++ DMI_MATCH(DMI_PRODUCT_NAME, "GA401IH"), |
8916 |
++ }, |
8917 |
++ .driver_data = &quirk_asus_ga401i, |
8918 |
++ }, |
8919 |
++ { |
8920 |
++ .callback = dmi_matched, |
8921 |
++ .ident = "ASUSTeK COMPUTER INC. GA401II", |
8922 |
++ .matches = { |
8923 |
++ DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), |
8924 |
++ DMI_MATCH(DMI_PRODUCT_NAME, "GA401II"), |
8925 |
++ }, |
8926 |
++ .driver_data = &quirk_asus_ga401i, |
8927 |
++ }, |
8928 |
++ { |
8929 |
++ .callback = dmi_matched, |
8930 |
++ .ident = "ASUSTeK COMPUTER INC. GA401IU", |
8931 |
++ .matches = { |
8932 |
++ DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), |
8933 |
++ DMI_MATCH(DMI_PRODUCT_NAME, "GA401IU"), |
8934 |
++ }, |
8935 |
++ .driver_data = &quirk_asus_ga401i, |
8936 |
++ }, |
8937 |
++ { |
8938 |
++ .callback = dmi_matched, |
8939 |
++ .ident = "ASUSTeK COMPUTER INC. GA401IV", |
8940 |
++ .matches = { |
8941 |
++ DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), |
8942 |
++ DMI_MATCH(DMI_PRODUCT_NAME, "GA401IV"), |
8943 |
++ }, |
8944 |
++ .driver_data = &quirk_asus_ga401i, |
8945 |
++ }, |
8946 |
++ { |
8947 |
++ .callback = dmi_matched, |
8948 |
++ .ident = "ASUSTeK COMPUTER INC. GA401IVC", |
8949 |
++ .matches = { |
8950 |
++ DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), |
8951 |
++ DMI_MATCH(DMI_PRODUCT_NAME, "GA401IVC"), |
8952 |
++ }, |
8953 |
++ .driver_data = &quirk_asus_ga401i, |
8954 |
++ }, |
8955 |
++ { |
8956 |
++ .callback = dmi_matched, |
8957 |
++ .ident = "ASUSTeK COMPUTER INC. GA502II", |
8958 |
++ .matches = { |
8959 |
++ DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), |
8960 |
++ DMI_MATCH(DMI_PRODUCT_NAME, "GA502II"), |
8961 |
++ }, |
8962 |
++ .driver_data = &quirk_asus_ga502i, |
8963 |
++ }, |
8964 |
++ { |
8965 |
++ .callback = dmi_matched, |
8966 |
++ .ident = "ASUSTeK COMPUTER INC. GA502IU", |
8967 |
++ .matches = { |
8968 |
++ DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), |
8969 |
++ DMI_MATCH(DMI_PRODUCT_NAME, "GA502IU"), |
8970 |
++ }, |
8971 |
++ .driver_data = &quirk_asus_ga502i, |
8972 |
++ }, |
8973 |
++ { |
8974 |
++ .callback = dmi_matched, |
8975 |
++ .ident = "ASUSTeK COMPUTER INC. GA502IV", |
8976 |
++ .matches = { |
8977 |
++ DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), |
8978 |
++ DMI_MATCH(DMI_PRODUCT_NAME, "GA502IV"), |
8979 |
++ }, |
8980 |
++ .driver_data = &quirk_asus_ga502i, |
8981 |
++ }, |
8982 |
+ {}, |
8983 |
+ }; |
8984 |
+ |
8985 |
+diff --git a/drivers/platform/x86/intel-hid.c b/drivers/platform/x86/intel-hid.c |
8986 |
+index 9ee79b74311c..86261970bd8f 100644 |
8987 |
+--- a/drivers/platform/x86/intel-hid.c |
8988 |
++++ b/drivers/platform/x86/intel-hid.c |
8989 |
+@@ -571,7 +571,7 @@ check_acpi_dev(acpi_handle handle, u32 lvl, void *context, void **rv) |
8990 |
+ return AE_OK; |
8991 |
+ |
8992 |
+ if (acpi_match_device_ids(dev, ids) == 0) |
8993 |
+- if (acpi_create_platform_device(dev, NULL)) |
8994 |
++ if (!IS_ERR_OR_NULL(acpi_create_platform_device(dev, NULL))) |
8995 |
+ dev_info(&dev->dev, |
8996 |
+ "intel-hid: created platform device\n"); |
8997 |
+ |
8998 |
+diff --git a/drivers/platform/x86/intel-vbtn.c b/drivers/platform/x86/intel-vbtn.c |
8999 |
+index a05b80955dcd..5db8b7ad1f5d 100644 |
9000 |
+--- a/drivers/platform/x86/intel-vbtn.c |
9001 |
++++ b/drivers/platform/x86/intel-vbtn.c |
9002 |
+@@ -286,7 +286,7 @@ check_acpi_dev(acpi_handle handle, u32 lvl, void *context, void **rv) |
9003 |
+ return AE_OK; |
9004 |
+ |
9005 |
+ if (acpi_match_device_ids(dev, ids) == 0) |
9006 |
+- if (acpi_create_platform_device(dev, NULL)) |
9007 |
++ if (!IS_ERR_OR_NULL(acpi_create_platform_device(dev, NULL))) |
9008 |
+ dev_info(&dev->dev, |
9009 |
+ "intel-vbtn: created platform device\n"); |
9010 |
+ |
9011 |
+diff --git a/drivers/power/supply/88pm860x_battery.c b/drivers/power/supply/88pm860x_battery.c |
9012 |
+index 5ca047b3f58f..23e7d6447ae9 100644 |
9013 |
+--- a/drivers/power/supply/88pm860x_battery.c |
9014 |
++++ b/drivers/power/supply/88pm860x_battery.c |
9015 |
+@@ -433,7 +433,7 @@ static void pm860x_init_battery(struct pm860x_battery_info *info) |
9016 |
+ int ret; |
9017 |
+ int data; |
9018 |
+ int bat_remove; |
9019 |
+- int soc; |
9020 |
++ int soc = 0; |
9021 |
+ |
9022 |
+ /* measure enable on GPADC1 */ |
9023 |
+ data = MEAS1_GP1; |
9024 |
+@@ -496,7 +496,9 @@ static void pm860x_init_battery(struct pm860x_battery_info *info) |
9025 |
+ } |
9026 |
+ mutex_unlock(&info->lock); |
9027 |
+ |
9028 |
+- calc_soc(info, OCV_MODE_ACTIVE, &soc); |
9029 |
++ ret = calc_soc(info, OCV_MODE_ACTIVE, &soc); |
9030 |
++ if (ret < 0) |
9031 |
++ goto out; |
9032 |
+ |
9033 |
+ data = pm860x_reg_read(info->i2c, PM8607_POWER_UP_LOG); |
9034 |
+ bat_remove = data & BAT_WU_LOG; |
9035 |
+diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c |
9036 |
+index 7486f6e4e613..0cb99bb090ef 100644 |
9037 |
+--- a/drivers/regulator/core.c |
9038 |
++++ b/drivers/regulator/core.c |
9039 |
+@@ -5005,7 +5005,6 @@ regulator_register(const struct regulator_desc *regulator_desc, |
9040 |
+ struct regulator_dev *rdev; |
9041 |
+ bool dangling_cfg_gpiod = false; |
9042 |
+ bool dangling_of_gpiod = false; |
9043 |
+- bool reg_device_fail = false; |
9044 |
+ struct device *dev; |
9045 |
+ int ret, i; |
9046 |
+ |
9047 |
+@@ -5134,10 +5133,12 @@ regulator_register(const struct regulator_desc *regulator_desc, |
9048 |
+ } |
9049 |
+ |
9050 |
+ /* register with sysfs */ |
9051 |
++ device_initialize(&rdev->dev); |
9052 |
+ rdev->dev.class = ®ulator_class; |
9053 |
+ rdev->dev.parent = dev; |
9054 |
+ dev_set_name(&rdev->dev, "regulator.%lu", |
9055 |
+ (unsigned long) atomic_inc_return(®ulator_no)); |
9056 |
++ dev_set_drvdata(&rdev->dev, rdev); |
9057 |
+ |
9058 |
+ /* set regulator constraints */ |
9059 |
+ if (init_data) |
9060 |
+@@ -5188,12 +5189,9 @@ regulator_register(const struct regulator_desc *regulator_desc, |
9061 |
+ !rdev->desc->fixed_uV) |
9062 |
+ rdev->is_switch = true; |
9063 |
+ |
9064 |
+- dev_set_drvdata(&rdev->dev, rdev); |
9065 |
+- ret = device_register(&rdev->dev); |
9066 |
+- if (ret != 0) { |
9067 |
+- reg_device_fail = true; |
9068 |
++ ret = device_add(&rdev->dev); |
9069 |
++ if (ret != 0) |
9070 |
+ goto unset_supplies; |
9071 |
+- } |
9072 |
+ |
9073 |
+ rdev_init_debugfs(rdev); |
9074 |
+ |
9075 |
+@@ -5215,17 +5213,15 @@ unset_supplies: |
9076 |
+ mutex_unlock(®ulator_list_mutex); |
9077 |
+ wash: |
9078 |
+ kfree(rdev->coupling_desc.coupled_rdevs); |
9079 |
+- kfree(rdev->constraints); |
9080 |
+ mutex_lock(®ulator_list_mutex); |
9081 |
+ regulator_ena_gpio_free(rdev); |
9082 |
+ mutex_unlock(®ulator_list_mutex); |
9083 |
++ put_device(&rdev->dev); |
9084 |
++ rdev = NULL; |
9085 |
+ clean: |
9086 |
+ if (dangling_of_gpiod) |
9087 |
+ gpiod_put(config->ena_gpiod); |
9088 |
+- if (reg_device_fail) |
9089 |
+- put_device(&rdev->dev); |
9090 |
+- else |
9091 |
+- kfree(rdev); |
9092 |
++ kfree(rdev); |
9093 |
+ kfree(config); |
9094 |
+ rinse: |
9095 |
+ if (dangling_cfg_gpiod) |
9096 |
+diff --git a/drivers/reset/reset-intel-gw.c b/drivers/reset/reset-intel-gw.c |
9097 |
+index 854238444616..effc177db80a 100644 |
9098 |
+--- a/drivers/reset/reset-intel-gw.c |
9099 |
++++ b/drivers/reset/reset-intel-gw.c |
9100 |
+@@ -15,9 +15,9 @@ |
9101 |
+ #define RCU_RST_STAT 0x0024 |
9102 |
+ #define RCU_RST_REQ 0x0048 |
9103 |
+ |
9104 |
+-#define REG_OFFSET GENMASK(31, 16) |
9105 |
+-#define BIT_OFFSET GENMASK(15, 8) |
9106 |
+-#define STAT_BIT_OFFSET GENMASK(7, 0) |
9107 |
++#define REG_OFFSET_MASK GENMASK(31, 16) |
9108 |
++#define BIT_OFFSET_MASK GENMASK(15, 8) |
9109 |
++#define STAT_BIT_OFFSET_MASK GENMASK(7, 0) |
9110 |
+ |
9111 |
+ #define to_reset_data(x) container_of(x, struct intel_reset_data, rcdev) |
9112 |
+ |
9113 |
+@@ -51,11 +51,11 @@ static u32 id_to_reg_and_bit_offsets(struct intel_reset_data *data, |
9114 |
+ unsigned long id, u32 *rst_req, |
9115 |
+ u32 *req_bit, u32 *stat_bit) |
9116 |
+ { |
9117 |
+- *rst_req = FIELD_GET(REG_OFFSET, id); |
9118 |
+- *req_bit = FIELD_GET(BIT_OFFSET, id); |
9119 |
++ *rst_req = FIELD_GET(REG_OFFSET_MASK, id); |
9120 |
++ *req_bit = FIELD_GET(BIT_OFFSET_MASK, id); |
9121 |
+ |
9122 |
+ if (data->soc_data->legacy) |
9123 |
+- *stat_bit = FIELD_GET(STAT_BIT_OFFSET, id); |
9124 |
++ *stat_bit = FIELD_GET(STAT_BIT_OFFSET_MASK, id); |
9125 |
+ else |
9126 |
+ *stat_bit = *req_bit; |
9127 |
+ |
9128 |
+@@ -141,14 +141,14 @@ static int intel_reset_xlate(struct reset_controller_dev *rcdev, |
9129 |
+ if (spec->args[1] > 31) |
9130 |
+ return -EINVAL; |
9131 |
+ |
9132 |
+- id = FIELD_PREP(REG_OFFSET, spec->args[0]); |
9133 |
+- id |= FIELD_PREP(BIT_OFFSET, spec->args[1]); |
9134 |
++ id = FIELD_PREP(REG_OFFSET_MASK, spec->args[0]); |
9135 |
++ id |= FIELD_PREP(BIT_OFFSET_MASK, spec->args[1]); |
9136 |
+ |
9137 |
+ if (data->soc_data->legacy) { |
9138 |
+ if (spec->args[2] > 31) |
9139 |
+ return -EINVAL; |
9140 |
+ |
9141 |
+- id |= FIELD_PREP(STAT_BIT_OFFSET, spec->args[2]); |
9142 |
++ id |= FIELD_PREP(STAT_BIT_OFFSET_MASK, spec->args[2]); |
9143 |
+ } |
9144 |
+ |
9145 |
+ return id; |
9146 |
+@@ -210,11 +210,11 @@ static int intel_reset_probe(struct platform_device *pdev) |
9147 |
+ if (ret) |
9148 |
+ return ret; |
9149 |
+ |
9150 |
+- data->reboot_id = FIELD_PREP(REG_OFFSET, rb_id[0]); |
9151 |
+- data->reboot_id |= FIELD_PREP(BIT_OFFSET, rb_id[1]); |
9152 |
++ data->reboot_id = FIELD_PREP(REG_OFFSET_MASK, rb_id[0]); |
9153 |
++ data->reboot_id |= FIELD_PREP(BIT_OFFSET_MASK, rb_id[1]); |
9154 |
+ |
9155 |
+ if (data->soc_data->legacy) |
9156 |
+- data->reboot_id |= FIELD_PREP(STAT_BIT_OFFSET, rb_id[2]); |
9157 |
++ data->reboot_id |= FIELD_PREP(STAT_BIT_OFFSET_MASK, rb_id[2]); |
9158 |
+ |
9159 |
+ data->restart_nb.notifier_call = intel_reset_restart_handler; |
9160 |
+ data->restart_nb.priority = 128; |
9161 |
+diff --git a/drivers/s390/block/dasd_diag.c b/drivers/s390/block/dasd_diag.c |
9162 |
+index facb588d09e4..069d6b39cacf 100644 |
9163 |
+--- a/drivers/s390/block/dasd_diag.c |
9164 |
++++ b/drivers/s390/block/dasd_diag.c |
9165 |
+@@ -319,7 +319,7 @@ dasd_diag_check_device(struct dasd_device *device) |
9166 |
+ struct dasd_diag_characteristics *rdc_data; |
9167 |
+ struct vtoc_cms_label *label; |
9168 |
+ struct dasd_block *block; |
9169 |
+- struct dasd_diag_bio bio; |
9170 |
++ struct dasd_diag_bio *bio; |
9171 |
+ unsigned int sb, bsize; |
9172 |
+ blocknum_t end_block; |
9173 |
+ int rc; |
9174 |
+@@ -395,29 +395,36 @@ dasd_diag_check_device(struct dasd_device *device) |
9175 |
+ rc = -ENOMEM; |
9176 |
+ goto out; |
9177 |
+ } |
9178 |
++ bio = kzalloc(sizeof(*bio), GFP_KERNEL); |
9179 |
++ if (bio == NULL) { |
9180 |
++ DBF_DEV_EVENT(DBF_WARNING, device, "%s", |
9181 |
++ "No memory to allocate initialization bio"); |
9182 |
++ rc = -ENOMEM; |
9183 |
++ goto out_label; |
9184 |
++ } |
9185 |
+ rc = 0; |
9186 |
+ end_block = 0; |
9187 |
+ /* try all sizes - needed for ECKD devices */ |
9188 |
+ for (bsize = 512; bsize <= PAGE_SIZE; bsize <<= 1) { |
9189 |
+ mdsk_init_io(device, bsize, 0, &end_block); |
9190 |
+- memset(&bio, 0, sizeof (struct dasd_diag_bio)); |
9191 |
+- bio.type = MDSK_READ_REQ; |
9192 |
+- bio.block_number = private->pt_block + 1; |
9193 |
+- bio.buffer = label; |
9194 |
++ memset(bio, 0, sizeof(*bio)); |
9195 |
++ bio->type = MDSK_READ_REQ; |
9196 |
++ bio->block_number = private->pt_block + 1; |
9197 |
++ bio->buffer = label; |
9198 |
+ memset(&private->iob, 0, sizeof (struct dasd_diag_rw_io)); |
9199 |
+ private->iob.dev_nr = rdc_data->dev_nr; |
9200 |
+ private->iob.key = 0; |
9201 |
+ private->iob.flags = 0; /* do synchronous io */ |
9202 |
+ private->iob.block_count = 1; |
9203 |
+ private->iob.interrupt_params = 0; |
9204 |
+- private->iob.bio_list = &bio; |
9205 |
++ private->iob.bio_list = bio; |
9206 |
+ private->iob.flaga = DASD_DIAG_FLAGA_DEFAULT; |
9207 |
+ rc = dia250(&private->iob, RW_BIO); |
9208 |
+ if (rc == 3) { |
9209 |
+ pr_warn("%s: A 64-bit DIAG call failed\n", |
9210 |
+ dev_name(&device->cdev->dev)); |
9211 |
+ rc = -EOPNOTSUPP; |
9212 |
+- goto out_label; |
9213 |
++ goto out_bio; |
9214 |
+ } |
9215 |
+ mdsk_term_io(device); |
9216 |
+ if (rc == 0) |
9217 |
+@@ -427,7 +434,7 @@ dasd_diag_check_device(struct dasd_device *device) |
9218 |
+ pr_warn("%s: Accessing the DASD failed because of an incorrect format (rc=%d)\n", |
9219 |
+ dev_name(&device->cdev->dev), rc); |
9220 |
+ rc = -EIO; |
9221 |
+- goto out_label; |
9222 |
++ goto out_bio; |
9223 |
+ } |
9224 |
+ /* check for label block */ |
9225 |
+ if (memcmp(label->label_id, DASD_DIAG_CMS1, |
9226 |
+@@ -457,6 +464,8 @@ dasd_diag_check_device(struct dasd_device *device) |
9227 |
+ (rc == 4) ? ", read-only device" : ""); |
9228 |
+ rc = 0; |
9229 |
+ } |
9230 |
++out_bio: |
9231 |
++ kfree(bio); |
9232 |
+ out_label: |
9233 |
+ free_page((long) label); |
9234 |
+ out: |
9235 |
+diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c |
9236 |
+index 60d675fefac7..40ddd1786430 100644 |
9237 |
+--- a/drivers/s390/net/qeth_core_main.c |
9238 |
++++ b/drivers/s390/net/qeth_core_main.c |
9239 |
+@@ -202,12 +202,17 @@ EXPORT_SYMBOL_GPL(qeth_threads_running); |
9240 |
+ void qeth_clear_working_pool_list(struct qeth_card *card) |
9241 |
+ { |
9242 |
+ struct qeth_buffer_pool_entry *pool_entry, *tmp; |
9243 |
++ struct qeth_qdio_q *queue = card->qdio.in_q; |
9244 |
++ unsigned int i; |
9245 |
+ |
9246 |
+ QETH_CARD_TEXT(card, 5, "clwrklst"); |
9247 |
+ list_for_each_entry_safe(pool_entry, tmp, |
9248 |
+ &card->qdio.in_buf_pool.entry_list, list){ |
9249 |
+ list_del(&pool_entry->list); |
9250 |
+ } |
9251 |
++ |
9252 |
++ for (i = 0; i < ARRAY_SIZE(queue->bufs); i++) |
9253 |
++ queue->bufs[i].pool_entry = NULL; |
9254 |
+ } |
9255 |
+ EXPORT_SYMBOL_GPL(qeth_clear_working_pool_list); |
9256 |
+ |
9257 |
+@@ -2671,7 +2676,7 @@ static struct qeth_buffer_pool_entry *qeth_find_free_buffer_pool_entry( |
9258 |
+ static int qeth_init_input_buffer(struct qeth_card *card, |
9259 |
+ struct qeth_qdio_buffer *buf) |
9260 |
+ { |
9261 |
+- struct qeth_buffer_pool_entry *pool_entry; |
9262 |
++ struct qeth_buffer_pool_entry *pool_entry = buf->pool_entry; |
9263 |
+ int i; |
9264 |
+ |
9265 |
+ if ((card->options.cq == QETH_CQ_ENABLED) && (!buf->rx_skb)) { |
9266 |
+@@ -2682,9 +2687,13 @@ static int qeth_init_input_buffer(struct qeth_card *card, |
9267 |
+ return -ENOMEM; |
9268 |
+ } |
9269 |
+ |
9270 |
+- pool_entry = qeth_find_free_buffer_pool_entry(card); |
9271 |
+- if (!pool_entry) |
9272 |
+- return -ENOBUFS; |
9273 |
++ if (!pool_entry) { |
9274 |
++ pool_entry = qeth_find_free_buffer_pool_entry(card); |
9275 |
++ if (!pool_entry) |
9276 |
++ return -ENOBUFS; |
9277 |
++ |
9278 |
++ buf->pool_entry = pool_entry; |
9279 |
++ } |
9280 |
+ |
9281 |
+ /* |
9282 |
+ * since the buffer is accessed only from the input_tasklet |
9283 |
+@@ -2692,8 +2701,6 @@ static int qeth_init_input_buffer(struct qeth_card *card, |
9284 |
+ * the QETH_IN_BUF_REQUEUE_THRESHOLD we should never run out off |
9285 |
+ * buffers |
9286 |
+ */ |
9287 |
+- |
9288 |
+- buf->pool_entry = pool_entry; |
9289 |
+ for (i = 0; i < QETH_MAX_BUFFER_ELEMENTS(card); ++i) { |
9290 |
+ buf->buffer->element[i].length = PAGE_SIZE; |
9291 |
+ buf->buffer->element[i].addr = |
9292 |
+@@ -5521,6 +5528,7 @@ static unsigned int qeth_rx_poll(struct qeth_card *card, int budget) |
9293 |
+ if (done) { |
9294 |
+ QETH_CARD_STAT_INC(card, rx_bufs); |
9295 |
+ qeth_put_buffer_pool_entry(card, buffer->pool_entry); |
9296 |
++ buffer->pool_entry = NULL; |
9297 |
+ qeth_queue_input_buffer(card, card->rx.b_index); |
9298 |
+ card->rx.b_count--; |
9299 |
+ |
9300 |
+diff --git a/drivers/s390/net/qeth_l2_main.c b/drivers/s390/net/qeth_l2_main.c |
9301 |
+index 0bd5b09e7a22..37740cc7a44a 100644 |
9302 |
+--- a/drivers/s390/net/qeth_l2_main.c |
9303 |
++++ b/drivers/s390/net/qeth_l2_main.c |
9304 |
+@@ -1071,6 +1071,10 @@ static void qeth_bridge_state_change(struct qeth_card *card, |
9305 |
+ int extrasize; |
9306 |
+ |
9307 |
+ QETH_CARD_TEXT(card, 2, "brstchng"); |
9308 |
++ if (qports->num_entries == 0) { |
9309 |
++ QETH_CARD_TEXT(card, 2, "BPempty"); |
9310 |
++ return; |
9311 |
++ } |
9312 |
+ if (qports->entry_length != sizeof(struct qeth_sbp_port_entry)) { |
9313 |
+ QETH_CARD_TEXT_(card, 2, "BPsz%04x", qports->entry_length); |
9314 |
+ return; |
9315 |
+diff --git a/drivers/scsi/arm/cumana_2.c b/drivers/scsi/arm/cumana_2.c |
9316 |
+index a1f3e9ee4e63..14e1d001253c 100644 |
9317 |
+--- a/drivers/scsi/arm/cumana_2.c |
9318 |
++++ b/drivers/scsi/arm/cumana_2.c |
9319 |
+@@ -450,7 +450,7 @@ static int cumanascsi2_probe(struct expansion_card *ec, |
9320 |
+ |
9321 |
+ if (info->info.scsi.dma != NO_DMA) |
9322 |
+ free_dma(info->info.scsi.dma); |
9323 |
+- free_irq(ec->irq, host); |
9324 |
++ free_irq(ec->irq, info); |
9325 |
+ |
9326 |
+ out_release: |
9327 |
+ fas216_release(host); |
9328 |
+diff --git a/drivers/scsi/arm/eesox.c b/drivers/scsi/arm/eesox.c |
9329 |
+index 134f040d58e2..f441ec8eb93d 100644 |
9330 |
+--- a/drivers/scsi/arm/eesox.c |
9331 |
++++ b/drivers/scsi/arm/eesox.c |
9332 |
+@@ -571,7 +571,7 @@ static int eesoxscsi_probe(struct expansion_card *ec, const struct ecard_id *id) |
9333 |
+ |
9334 |
+ if (info->info.scsi.dma != NO_DMA) |
9335 |
+ free_dma(info->info.scsi.dma); |
9336 |
+- free_irq(ec->irq, host); |
9337 |
++ free_irq(ec->irq, info); |
9338 |
+ |
9339 |
+ out_remove: |
9340 |
+ fas216_remove(host); |
9341 |
+diff --git a/drivers/scsi/arm/powertec.c b/drivers/scsi/arm/powertec.c |
9342 |
+index c795537a671c..2dc0df005cb3 100644 |
9343 |
+--- a/drivers/scsi/arm/powertec.c |
9344 |
++++ b/drivers/scsi/arm/powertec.c |
9345 |
+@@ -378,7 +378,7 @@ static int powertecscsi_probe(struct expansion_card *ec, |
9346 |
+ |
9347 |
+ if (info->info.scsi.dma != NO_DMA) |
9348 |
+ free_dma(info->info.scsi.dma); |
9349 |
+- free_irq(ec->irq, host); |
9350 |
++ free_irq(ec->irq, info); |
9351 |
+ |
9352 |
+ out_release: |
9353 |
+ fas216_release(host); |
9354 |
+diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c |
9355 |
+index babe85d7b537..5a95c56ff7c2 100644 |
9356 |
+--- a/drivers/scsi/megaraid/megaraid_sas_base.c |
9357 |
++++ b/drivers/scsi/megaraid/megaraid_sas_base.c |
9358 |
+@@ -5602,9 +5602,13 @@ megasas_setup_irqs_msix(struct megasas_instance *instance, u8 is_probe) |
9359 |
+ &instance->irq_context[i])) { |
9360 |
+ dev_err(&instance->pdev->dev, |
9361 |
+ "Failed to register IRQ for vector %d.\n", i); |
9362 |
+- for (j = 0; j < i; j++) |
9363 |
++ for (j = 0; j < i; j++) { |
9364 |
++ if (j < instance->low_latency_index_start) |
9365 |
++ irq_set_affinity_hint( |
9366 |
++ pci_irq_vector(pdev, j), NULL); |
9367 |
+ free_irq(pci_irq_vector(pdev, j), |
9368 |
+ &instance->irq_context[j]); |
9369 |
++ } |
9370 |
+ /* Retry irq register for IO_APIC*/ |
9371 |
+ instance->msix_vectors = 0; |
9372 |
+ instance->msix_load_balance = false; |
9373 |
+@@ -5642,6 +5646,9 @@ megasas_destroy_irqs(struct megasas_instance *instance) { |
9374 |
+ |
9375 |
+ if (instance->msix_vectors) |
9376 |
+ for (i = 0; i < instance->msix_vectors; i++) { |
9377 |
++ if (i < instance->low_latency_index_start) |
9378 |
++ irq_set_affinity_hint( |
9379 |
++ pci_irq_vector(instance->pdev, i), NULL); |
9380 |
+ free_irq(pci_irq_vector(instance->pdev, i), |
9381 |
+ &instance->irq_context[i]); |
9382 |
+ } |
9383 |
+diff --git a/drivers/scsi/mesh.c b/drivers/scsi/mesh.c |
9384 |
+index 74fb50644678..4dd50db90677 100644 |
9385 |
+--- a/drivers/scsi/mesh.c |
9386 |
++++ b/drivers/scsi/mesh.c |
9387 |
+@@ -1045,6 +1045,8 @@ static void handle_error(struct mesh_state *ms) |
9388 |
+ while ((in_8(&mr->bus_status1) & BS1_RST) != 0) |
9389 |
+ udelay(1); |
9390 |
+ printk("done\n"); |
9391 |
++ if (ms->dma_started) |
9392 |
++ halt_dma(ms); |
9393 |
+ handle_reset(ms); |
9394 |
+ /* request_q is empty, no point in mesh_start() */ |
9395 |
+ return; |
9396 |
+@@ -1357,7 +1359,8 @@ static void halt_dma(struct mesh_state *ms) |
9397 |
+ ms->conn_tgt, ms->data_ptr, scsi_bufflen(cmd), |
9398 |
+ ms->tgts[ms->conn_tgt].data_goes_out); |
9399 |
+ } |
9400 |
+- scsi_dma_unmap(cmd); |
9401 |
++ if (cmd) |
9402 |
++ scsi_dma_unmap(cmd); |
9403 |
+ ms->dma_started = 0; |
9404 |
+ } |
9405 |
+ |
9406 |
+@@ -1712,6 +1715,9 @@ static int mesh_host_reset(struct scsi_cmnd *cmd) |
9407 |
+ |
9408 |
+ spin_lock_irqsave(ms->host->host_lock, flags); |
9409 |
+ |
9410 |
++ if (ms->dma_started) |
9411 |
++ halt_dma(ms); |
9412 |
++ |
9413 |
+ /* Reset the controller & dbdma channel */ |
9414 |
+ out_le32(&md->control, (RUN|PAUSE|FLUSH|WAKE) << 16); /* stop dma */ |
9415 |
+ out_8(&mr->exception, 0xff); /* clear all exception bits */ |
9416 |
+diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c |
9417 |
+index 4c6c448dc2df..c17ff74164e8 100644 |
9418 |
+--- a/drivers/scsi/scsi_debug.c |
9419 |
++++ b/drivers/scsi/scsi_debug.c |
9420 |
+@@ -5297,6 +5297,12 @@ static int __init scsi_debug_init(void) |
9421 |
+ pr_err("submit_queues must be 1 or more\n"); |
9422 |
+ return -EINVAL; |
9423 |
+ } |
9424 |
++ |
9425 |
++ if ((sdebug_max_queue > SDEBUG_CANQUEUE) || (sdebug_max_queue < 1)) { |
9426 |
++ pr_err("max_queue must be in range [1, %d]\n", SDEBUG_CANQUEUE); |
9427 |
++ return -EINVAL; |
9428 |
++ } |
9429 |
++ |
9430 |
+ sdebug_q_arr = kcalloc(submit_queues, sizeof(struct sdebug_queue), |
9431 |
+ GFP_KERNEL); |
9432 |
+ if (sdebug_q_arr == NULL) |
9433 |
+diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c |
9434 |
+index 7ca32ede5e17..477b6cfff381 100644 |
9435 |
+--- a/drivers/scsi/ufs/ufshcd.c |
9436 |
++++ b/drivers/scsi/ufs/ufshcd.c |
9437 |
+@@ -1280,6 +1280,7 @@ static int ufshcd_devfreq_get_dev_status(struct device *dev, |
9438 |
+ unsigned long flags; |
9439 |
+ struct list_head *clk_list = &hba->clk_list_head; |
9440 |
+ struct ufs_clk_info *clki; |
9441 |
++ ktime_t curr_t; |
9442 |
+ |
9443 |
+ if (!ufshcd_is_clkscaling_supported(hba)) |
9444 |
+ return -EINVAL; |
9445 |
+@@ -1287,6 +1288,7 @@ static int ufshcd_devfreq_get_dev_status(struct device *dev, |
9446 |
+ memset(stat, 0, sizeof(*stat)); |
9447 |
+ |
9448 |
+ spin_lock_irqsave(hba->host->host_lock, flags); |
9449 |
++ curr_t = ktime_get(); |
9450 |
+ if (!scaling->window_start_t) |
9451 |
+ goto start_window; |
9452 |
+ |
9453 |
+@@ -1298,18 +1300,17 @@ static int ufshcd_devfreq_get_dev_status(struct device *dev, |
9454 |
+ */ |
9455 |
+ stat->current_frequency = clki->curr_freq; |
9456 |
+ if (scaling->is_busy_started) |
9457 |
+- scaling->tot_busy_t += ktime_to_us(ktime_sub(ktime_get(), |
9458 |
+- scaling->busy_start_t)); |
9459 |
++ scaling->tot_busy_t += ktime_us_delta(curr_t, |
9460 |
++ scaling->busy_start_t); |
9461 |
+ |
9462 |
+- stat->total_time = jiffies_to_usecs((long)jiffies - |
9463 |
+- (long)scaling->window_start_t); |
9464 |
++ stat->total_time = ktime_us_delta(curr_t, scaling->window_start_t); |
9465 |
+ stat->busy_time = scaling->tot_busy_t; |
9466 |
+ start_window: |
9467 |
+- scaling->window_start_t = jiffies; |
9468 |
++ scaling->window_start_t = curr_t; |
9469 |
+ scaling->tot_busy_t = 0; |
9470 |
+ |
9471 |
+ if (hba->outstanding_reqs) { |
9472 |
+- scaling->busy_start_t = ktime_get(); |
9473 |
++ scaling->busy_start_t = curr_t; |
9474 |
+ scaling->is_busy_started = true; |
9475 |
+ } else { |
9476 |
+ scaling->busy_start_t = 0; |
9477 |
+@@ -1860,6 +1861,7 @@ static void ufshcd_exit_clk_gating(struct ufs_hba *hba) |
9478 |
+ static void ufshcd_clk_scaling_start_busy(struct ufs_hba *hba) |
9479 |
+ { |
9480 |
+ bool queue_resume_work = false; |
9481 |
++ ktime_t curr_t = ktime_get(); |
9482 |
+ |
9483 |
+ if (!ufshcd_is_clkscaling_supported(hba)) |
9484 |
+ return; |
9485 |
+@@ -1875,13 +1877,13 @@ static void ufshcd_clk_scaling_start_busy(struct ufs_hba *hba) |
9486 |
+ &hba->clk_scaling.resume_work); |
9487 |
+ |
9488 |
+ if (!hba->clk_scaling.window_start_t) { |
9489 |
+- hba->clk_scaling.window_start_t = jiffies; |
9490 |
++ hba->clk_scaling.window_start_t = curr_t; |
9491 |
+ hba->clk_scaling.tot_busy_t = 0; |
9492 |
+ hba->clk_scaling.is_busy_started = false; |
9493 |
+ } |
9494 |
+ |
9495 |
+ if (!hba->clk_scaling.is_busy_started) { |
9496 |
+- hba->clk_scaling.busy_start_t = ktime_get(); |
9497 |
++ hba->clk_scaling.busy_start_t = curr_t; |
9498 |
+ hba->clk_scaling.is_busy_started = true; |
9499 |
+ } |
9500 |
+ } |
9501 |
+diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h |
9502 |
+index 6ffc08ad85f6..2315ecc20927 100644 |
9503 |
+--- a/drivers/scsi/ufs/ufshcd.h |
9504 |
++++ b/drivers/scsi/ufs/ufshcd.h |
9505 |
+@@ -409,7 +409,7 @@ struct ufs_saved_pwr_info { |
9506 |
+ struct ufs_clk_scaling { |
9507 |
+ int active_reqs; |
9508 |
+ unsigned long tot_busy_t; |
9509 |
+- unsigned long window_start_t; |
9510 |
++ ktime_t window_start_t; |
9511 |
+ ktime_t busy_start_t; |
9512 |
+ struct device_attribute enable_attr; |
9513 |
+ struct ufs_saved_pwr_info saved_pwr_info; |
9514 |
+diff --git a/drivers/soc/qcom/pdr_interface.c b/drivers/soc/qcom/pdr_interface.c |
9515 |
+index 17ad3b8698e1..cd8828c85723 100644 |
9516 |
+--- a/drivers/soc/qcom/pdr_interface.c |
9517 |
++++ b/drivers/soc/qcom/pdr_interface.c |
9518 |
+@@ -282,13 +282,15 @@ static void pdr_indack_work(struct work_struct *work) |
9519 |
+ |
9520 |
+ list_for_each_entry_safe(ind, tmp, &pdr->indack_list, node) { |
9521 |
+ pds = ind->pds; |
9522 |
+- pdr_send_indack_msg(pdr, pds, ind->transaction_id); |
9523 |
+ |
9524 |
+ mutex_lock(&pdr->status_lock); |
9525 |
+ pds->state = ind->curr_state; |
9526 |
+ pdr->status(pds->state, pds->service_path, pdr->priv); |
9527 |
+ mutex_unlock(&pdr->status_lock); |
9528 |
+ |
9529 |
++ /* Ack the indication after clients release the PD resources */ |
9530 |
++ pdr_send_indack_msg(pdr, pds, ind->transaction_id); |
9531 |
++ |
9532 |
+ mutex_lock(&pdr->list_lock); |
9533 |
+ list_del(&ind->node); |
9534 |
+ mutex_unlock(&pdr->list_lock); |
9535 |
+diff --git a/drivers/soc/qcom/rpmh-rsc.c b/drivers/soc/qcom/rpmh-rsc.c |
9536 |
+index 3d2104286ee9..a9ccdf2e43b7 100644 |
9537 |
+--- a/drivers/soc/qcom/rpmh-rsc.c |
9538 |
++++ b/drivers/soc/qcom/rpmh-rsc.c |
9539 |
+@@ -715,6 +715,7 @@ static struct platform_driver rpmh_driver = { |
9540 |
+ .driver = { |
9541 |
+ .name = "rpmh", |
9542 |
+ .of_match_table = rpmh_drv_match, |
9543 |
++ .suppress_bind_attrs = true, |
9544 |
+ }, |
9545 |
+ }; |
9546 |
+ |
9547 |
+diff --git a/drivers/spi/spi-lantiq-ssc.c b/drivers/spi/spi-lantiq-ssc.c |
9548 |
+index 1fd7ee53d451..049a64451c75 100644 |
9549 |
+--- a/drivers/spi/spi-lantiq-ssc.c |
9550 |
++++ b/drivers/spi/spi-lantiq-ssc.c |
9551 |
+@@ -184,6 +184,7 @@ struct lantiq_ssc_spi { |
9552 |
+ unsigned int tx_fifo_size; |
9553 |
+ unsigned int rx_fifo_size; |
9554 |
+ unsigned int base_cs; |
9555 |
++ unsigned int fdx_tx_level; |
9556 |
+ }; |
9557 |
+ |
9558 |
+ static u32 lantiq_ssc_readl(const struct lantiq_ssc_spi *spi, u32 reg) |
9559 |
+@@ -481,6 +482,7 @@ static void tx_fifo_write(struct lantiq_ssc_spi *spi) |
9560 |
+ u32 data; |
9561 |
+ unsigned int tx_free = tx_fifo_free(spi); |
9562 |
+ |
9563 |
++ spi->fdx_tx_level = 0; |
9564 |
+ while (spi->tx_todo && tx_free) { |
9565 |
+ switch (spi->bits_per_word) { |
9566 |
+ case 2 ... 8: |
9567 |
+@@ -509,6 +511,7 @@ static void tx_fifo_write(struct lantiq_ssc_spi *spi) |
9568 |
+ |
9569 |
+ lantiq_ssc_writel(spi, data, LTQ_SPI_TB); |
9570 |
+ tx_free--; |
9571 |
++ spi->fdx_tx_level++; |
9572 |
+ } |
9573 |
+ } |
9574 |
+ |
9575 |
+@@ -520,6 +523,13 @@ static void rx_fifo_read_full_duplex(struct lantiq_ssc_spi *spi) |
9576 |
+ u32 data; |
9577 |
+ unsigned int rx_fill = rx_fifo_level(spi); |
9578 |
+ |
9579 |
++ /* |
9580 |
++ * Wait until all expected data to be shifted in. |
9581 |
++ * Otherwise, rx overrun may occur. |
9582 |
++ */ |
9583 |
++ while (rx_fill != spi->fdx_tx_level) |
9584 |
++ rx_fill = rx_fifo_level(spi); |
9585 |
++ |
9586 |
+ while (rx_fill) { |
9587 |
+ data = lantiq_ssc_readl(spi, LTQ_SPI_RB); |
9588 |
+ |
9589 |
+@@ -899,7 +909,7 @@ static int lantiq_ssc_probe(struct platform_device *pdev) |
9590 |
+ master->bits_per_word_mask = SPI_BPW_RANGE_MASK(2, 8) | |
9591 |
+ SPI_BPW_MASK(16) | SPI_BPW_MASK(32); |
9592 |
+ |
9593 |
+- spi->wq = alloc_ordered_workqueue(dev_name(dev), 0); |
9594 |
++ spi->wq = alloc_ordered_workqueue(dev_name(dev), WQ_MEM_RECLAIM); |
9595 |
+ if (!spi->wq) { |
9596 |
+ err = -ENOMEM; |
9597 |
+ goto err_clk_put; |
9598 |
+diff --git a/drivers/spi/spi-rockchip.c b/drivers/spi/spi-rockchip.c |
9599 |
+index 70ef63e0b6b8..02e920535591 100644 |
9600 |
+--- a/drivers/spi/spi-rockchip.c |
9601 |
++++ b/drivers/spi/spi-rockchip.c |
9602 |
+@@ -286,7 +286,7 @@ static void rockchip_spi_pio_writer(struct rockchip_spi *rs) |
9603 |
+ static void rockchip_spi_pio_reader(struct rockchip_spi *rs) |
9604 |
+ { |
9605 |
+ u32 words = readl_relaxed(rs->regs + ROCKCHIP_SPI_RXFLR); |
9606 |
+- u32 rx_left = rs->rx_left - words; |
9607 |
++ u32 rx_left = (rs->rx_left > words) ? rs->rx_left - words : 0; |
9608 |
+ |
9609 |
+ /* the hardware doesn't allow us to change fifo threshold |
9610 |
+ * level while spi is enabled, so instead make sure to leave |
9611 |
+diff --git a/drivers/spi/spidev.c b/drivers/spi/spidev.c |
9612 |
+index 012a89123067..2400da082563 100644 |
9613 |
+--- a/drivers/spi/spidev.c |
9614 |
++++ b/drivers/spi/spidev.c |
9615 |
+@@ -223,6 +223,11 @@ static int spidev_message(struct spidev_data *spidev, |
9616 |
+ for (n = n_xfers, k_tmp = k_xfers, u_tmp = u_xfers; |
9617 |
+ n; |
9618 |
+ n--, k_tmp++, u_tmp++) { |
9619 |
++ /* Ensure that also following allocations from rx_buf/tx_buf will meet |
9620 |
++ * DMA alignment requirements. |
9621 |
++ */ |
9622 |
++ unsigned int len_aligned = ALIGN(u_tmp->len, ARCH_KMALLOC_MINALIGN); |
9623 |
++ |
9624 |
+ k_tmp->len = u_tmp->len; |
9625 |
+ |
9626 |
+ total += k_tmp->len; |
9627 |
+@@ -238,17 +243,17 @@ static int spidev_message(struct spidev_data *spidev, |
9628 |
+ |
9629 |
+ if (u_tmp->rx_buf) { |
9630 |
+ /* this transfer needs space in RX bounce buffer */ |
9631 |
+- rx_total += k_tmp->len; |
9632 |
++ rx_total += len_aligned; |
9633 |
+ if (rx_total > bufsiz) { |
9634 |
+ status = -EMSGSIZE; |
9635 |
+ goto done; |
9636 |
+ } |
9637 |
+ k_tmp->rx_buf = rx_buf; |
9638 |
+- rx_buf += k_tmp->len; |
9639 |
++ rx_buf += len_aligned; |
9640 |
+ } |
9641 |
+ if (u_tmp->tx_buf) { |
9642 |
+ /* this transfer needs space in TX bounce buffer */ |
9643 |
+- tx_total += k_tmp->len; |
9644 |
++ tx_total += len_aligned; |
9645 |
+ if (tx_total > bufsiz) { |
9646 |
+ status = -EMSGSIZE; |
9647 |
+ goto done; |
9648 |
+@@ -258,7 +263,7 @@ static int spidev_message(struct spidev_data *spidev, |
9649 |
+ (uintptr_t) u_tmp->tx_buf, |
9650 |
+ u_tmp->len)) |
9651 |
+ goto done; |
9652 |
+- tx_buf += k_tmp->len; |
9653 |
++ tx_buf += len_aligned; |
9654 |
+ } |
9655 |
+ |
9656 |
+ k_tmp->cs_change = !!u_tmp->cs_change; |
9657 |
+@@ -292,16 +297,16 @@ static int spidev_message(struct spidev_data *spidev, |
9658 |
+ goto done; |
9659 |
+ |
9660 |
+ /* copy any rx data out of bounce buffer */ |
9661 |
+- rx_buf = spidev->rx_buffer; |
9662 |
+- for (n = n_xfers, u_tmp = u_xfers; n; n--, u_tmp++) { |
9663 |
++ for (n = n_xfers, k_tmp = k_xfers, u_tmp = u_xfers; |
9664 |
++ n; |
9665 |
++ n--, k_tmp++, u_tmp++) { |
9666 |
+ if (u_tmp->rx_buf) { |
9667 |
+ if (copy_to_user((u8 __user *) |
9668 |
+- (uintptr_t) u_tmp->rx_buf, rx_buf, |
9669 |
++ (uintptr_t) u_tmp->rx_buf, k_tmp->rx_buf, |
9670 |
+ u_tmp->len)) { |
9671 |
+ status = -EFAULT; |
9672 |
+ goto done; |
9673 |
+ } |
9674 |
+- rx_buf += u_tmp->len; |
9675 |
+ } |
9676 |
+ } |
9677 |
+ status = total; |
9678 |
+diff --git a/drivers/staging/media/allegro-dvt/allegro-core.c b/drivers/staging/media/allegro-dvt/allegro-core.c |
9679 |
+index 70f133a842dd..3ed66aae741d 100644 |
9680 |
+--- a/drivers/staging/media/allegro-dvt/allegro-core.c |
9681 |
++++ b/drivers/staging/media/allegro-dvt/allegro-core.c |
9682 |
+@@ -3065,9 +3065,9 @@ static int allegro_probe(struct platform_device *pdev) |
9683 |
+ return -EINVAL; |
9684 |
+ } |
9685 |
+ regs = devm_ioremap(&pdev->dev, res->start, resource_size(res)); |
9686 |
+- if (IS_ERR(regs)) { |
9687 |
++ if (!regs) { |
9688 |
+ dev_err(&pdev->dev, "failed to map registers\n"); |
9689 |
+- return PTR_ERR(regs); |
9690 |
++ return -ENOMEM; |
9691 |
+ } |
9692 |
+ dev->regmap = devm_regmap_init_mmio(&pdev->dev, regs, |
9693 |
+ &allegro_regmap_config); |
9694 |
+@@ -3085,9 +3085,9 @@ static int allegro_probe(struct platform_device *pdev) |
9695 |
+ sram_regs = devm_ioremap(&pdev->dev, |
9696 |
+ sram_res->start, |
9697 |
+ resource_size(sram_res)); |
9698 |
+- if (IS_ERR(sram_regs)) { |
9699 |
++ if (!sram_regs) { |
9700 |
+ dev_err(&pdev->dev, "failed to map sram\n"); |
9701 |
+- return PTR_ERR(sram_regs); |
9702 |
++ return -ENOMEM; |
9703 |
+ } |
9704 |
+ dev->sram = devm_regmap_init_mmio(&pdev->dev, sram_regs, |
9705 |
+ &allegro_sram_config); |
9706 |
+diff --git a/drivers/staging/media/rkisp1/rkisp1-resizer.c b/drivers/staging/media/rkisp1/rkisp1-resizer.c |
9707 |
+index 87799fbf0363..26d785d98525 100644 |
9708 |
+--- a/drivers/staging/media/rkisp1/rkisp1-resizer.c |
9709 |
++++ b/drivers/staging/media/rkisp1/rkisp1-resizer.c |
9710 |
+@@ -427,8 +427,8 @@ static int rkisp1_rsz_enum_mbus_code(struct v4l2_subdev *sd, |
9711 |
+ u32 pad = code->pad; |
9712 |
+ int ret; |
9713 |
+ |
9714 |
+- /* supported mbus codes are the same in isp sink pad */ |
9715 |
+- code->pad = RKISP1_ISP_PAD_SINK_VIDEO; |
9716 |
++ /* supported mbus codes are the same in isp video src pad */ |
9717 |
++ code->pad = RKISP1_ISP_PAD_SOURCE_VIDEO; |
9718 |
+ ret = v4l2_subdev_call(&rsz->rkisp1->isp.sd, pad, enum_mbus_code, |
9719 |
+ &dummy_cfg, code); |
9720 |
+ |
9721 |
+@@ -543,11 +543,11 @@ static void rkisp1_rsz_set_sink_fmt(struct rkisp1_resizer *rsz, |
9722 |
+ src_fmt->code = sink_fmt->code; |
9723 |
+ |
9724 |
+ sink_fmt->width = clamp_t(u32, format->width, |
9725 |
+- rsz->config->min_rsz_width, |
9726 |
+- rsz->config->max_rsz_width); |
9727 |
++ RKISP1_ISP_MIN_WIDTH, |
9728 |
++ RKISP1_ISP_MAX_WIDTH); |
9729 |
+ sink_fmt->height = clamp_t(u32, format->height, |
9730 |
+- rsz->config->min_rsz_height, |
9731 |
+- rsz->config->max_rsz_height); |
9732 |
++ RKISP1_ISP_MIN_HEIGHT, |
9733 |
++ RKISP1_ISP_MAX_HEIGHT); |
9734 |
+ |
9735 |
+ *format = *sink_fmt; |
9736 |
+ |
9737 |
+diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c |
9738 |
+index fcfb9024a83f..6ec65187bef9 100644 |
9739 |
+--- a/drivers/staging/rtl8192u/r8192U_core.c |
9740 |
++++ b/drivers/staging/rtl8192u/r8192U_core.c |
9741 |
+@@ -2374,7 +2374,7 @@ static int rtl8192_read_eeprom_info(struct net_device *dev) |
9742 |
+ ret = eprom_read(dev, (EEPROM_TX_PW_INDEX_CCK >> 1)); |
9743 |
+ if (ret < 0) |
9744 |
+ return ret; |
9745 |
+- priv->EEPROMTxPowerLevelCCK = ((u16)ret & 0xff) >> 8; |
9746 |
++ priv->EEPROMTxPowerLevelCCK = ((u16)ret & 0xff00) >> 8; |
9747 |
+ } else |
9748 |
+ priv->EEPROMTxPowerLevelCCK = 0x10; |
9749 |
+ RT_TRACE(COMP_EPROM, "CCK Tx Power Levl: 0x%02x\n", priv->EEPROMTxPowerLevelCCK); |
9750 |
+diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c |
9751 |
+index a1ea9777a444..73b1099c4b45 100644 |
9752 |
+--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c |
9753 |
++++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c |
9754 |
+@@ -2803,6 +2803,7 @@ failed_platform_init: |
9755 |
+ |
9756 |
+ static int vchiq_remove(struct platform_device *pdev) |
9757 |
+ { |
9758 |
++ platform_device_unregister(bcm2835_audio); |
9759 |
+ platform_device_unregister(bcm2835_camera); |
9760 |
+ vchiq_debugfs_deinit(); |
9761 |
+ device_destroy(vchiq_class, vchiq_devid); |
9762 |
+diff --git a/drivers/thermal/intel/int340x_thermal/processor_thermal_device.c b/drivers/thermal/intel/int340x_thermal/processor_thermal_device.c |
9763 |
+index 297db1d2d960..81e8b15ef405 100644 |
9764 |
+--- a/drivers/thermal/intel/int340x_thermal/processor_thermal_device.c |
9765 |
++++ b/drivers/thermal/intel/int340x_thermal/processor_thermal_device.c |
9766 |
+@@ -43,7 +43,7 @@ |
9767 |
+ #define PCI_DEVICE_ID_PROC_ICL_THERMAL 0x8a03 |
9768 |
+ |
9769 |
+ /* JasperLake thermal reporting device */ |
9770 |
+-#define PCI_DEVICE_ID_PROC_JSL_THERMAL 0x4503 |
9771 |
++#define PCI_DEVICE_ID_PROC_JSL_THERMAL 0x4E03 |
9772 |
+ |
9773 |
+ /* TigerLake thermal reporting device */ |
9774 |
+ #define PCI_DEVICE_ID_PROC_TGL_THERMAL 0x9A03 |
9775 |
+diff --git a/drivers/thermal/ti-soc-thermal/ti-thermal-common.c b/drivers/thermal/ti-soc-thermal/ti-thermal-common.c |
9776 |
+index 85776db4bf34..2ce4b19f312a 100644 |
9777 |
+--- a/drivers/thermal/ti-soc-thermal/ti-thermal-common.c |
9778 |
++++ b/drivers/thermal/ti-soc-thermal/ti-thermal-common.c |
9779 |
+@@ -169,7 +169,7 @@ int ti_thermal_expose_sensor(struct ti_bandgap *bgp, int id, |
9780 |
+ |
9781 |
+ data = ti_bandgap_get_sensor_data(bgp, id); |
9782 |
+ |
9783 |
+- if (!IS_ERR_OR_NULL(data)) |
9784 |
++ if (IS_ERR_OR_NULL(data)) |
9785 |
+ data = ti_thermal_build_data(bgp, id); |
9786 |
+ |
9787 |
+ if (!data) |
9788 |
+diff --git a/drivers/usb/cdns3/gadget.c b/drivers/usb/cdns3/gadget.c |
9789 |
+index 4d43f3b28309..ecda80f8b308 100644 |
9790 |
+--- a/drivers/usb/cdns3/gadget.c |
9791 |
++++ b/drivers/usb/cdns3/gadget.c |
9792 |
+@@ -242,9 +242,10 @@ int cdns3_allocate_trb_pool(struct cdns3_endpoint *priv_ep) |
9793 |
+ return -ENOMEM; |
9794 |
+ |
9795 |
+ priv_ep->alloc_ring_size = ring_size; |
9796 |
+- memset(priv_ep->trb_pool, 0, ring_size); |
9797 |
+ } |
9798 |
+ |
9799 |
++ memset(priv_ep->trb_pool, 0, ring_size); |
9800 |
++ |
9801 |
+ priv_ep->num_trbs = num_trbs; |
9802 |
+ |
9803 |
+ if (!priv_ep->num) |
9804 |
+diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c |
9805 |
+index e0b77674869c..c96c50faccf7 100644 |
9806 |
+--- a/drivers/usb/core/quirks.c |
9807 |
++++ b/drivers/usb/core/quirks.c |
9808 |
+@@ -25,17 +25,23 @@ static unsigned int quirk_count; |
9809 |
+ |
9810 |
+ static char quirks_param[128]; |
9811 |
+ |
9812 |
+-static int quirks_param_set(const char *val, const struct kernel_param *kp) |
9813 |
++static int quirks_param_set(const char *value, const struct kernel_param *kp) |
9814 |
+ { |
9815 |
+- char *p, *field; |
9816 |
++ char *val, *p, *field; |
9817 |
+ u16 vid, pid; |
9818 |
+ u32 flags; |
9819 |
+ size_t i; |
9820 |
+ int err; |
9821 |
+ |
9822 |
++ val = kstrdup(value, GFP_KERNEL); |
9823 |
++ if (!val) |
9824 |
++ return -ENOMEM; |
9825 |
++ |
9826 |
+ err = param_set_copystring(val, kp); |
9827 |
+- if (err) |
9828 |
++ if (err) { |
9829 |
++ kfree(val); |
9830 |
+ return err; |
9831 |
++ } |
9832 |
+ |
9833 |
+ mutex_lock(&quirk_mutex); |
9834 |
+ |
9835 |
+@@ -60,10 +66,11 @@ static int quirks_param_set(const char *val, const struct kernel_param *kp) |
9836 |
+ if (!quirk_list) { |
9837 |
+ quirk_count = 0; |
9838 |
+ mutex_unlock(&quirk_mutex); |
9839 |
++ kfree(val); |
9840 |
+ return -ENOMEM; |
9841 |
+ } |
9842 |
+ |
9843 |
+- for (i = 0, p = (char *)val; p && *p;) { |
9844 |
++ for (i = 0, p = val; p && *p;) { |
9845 |
+ /* Each entry consists of VID:PID:flags */ |
9846 |
+ field = strsep(&p, ":"); |
9847 |
+ if (!field) |
9848 |
+@@ -144,6 +151,7 @@ static int quirks_param_set(const char *val, const struct kernel_param *kp) |
9849 |
+ |
9850 |
+ unlock: |
9851 |
+ mutex_unlock(&quirk_mutex); |
9852 |
++ kfree(val); |
9853 |
+ |
9854 |
+ return 0; |
9855 |
+ } |
9856 |
+diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c |
9857 |
+index 797afa99ef3b..4ad85fa2c932 100644 |
9858 |
+--- a/drivers/usb/dwc2/platform.c |
9859 |
++++ b/drivers/usb/dwc2/platform.c |
9860 |
+@@ -543,6 +543,7 @@ static int dwc2_driver_probe(struct platform_device *dev) |
9861 |
+ if (hsotg->gadget_enabled) { |
9862 |
+ retval = usb_add_gadget_udc(hsotg->dev, &hsotg->gadget); |
9863 |
+ if (retval) { |
9864 |
++ hsotg->gadget.udc = NULL; |
9865 |
+ dwc2_hsotg_remove(hsotg); |
9866 |
+ goto error_init; |
9867 |
+ } |
9868 |
+@@ -554,7 +555,8 @@ error_init: |
9869 |
+ if (hsotg->params.activate_stm_id_vb_detection) |
9870 |
+ regulator_disable(hsotg->usb33d); |
9871 |
+ error: |
9872 |
+- dwc2_lowlevel_hw_disable(hsotg); |
9873 |
++ if (hsotg->dr_mode != USB_DR_MODE_PERIPHERAL) |
9874 |
++ dwc2_lowlevel_hw_disable(hsotg); |
9875 |
+ return retval; |
9876 |
+ } |
9877 |
+ |
9878 |
+diff --git a/drivers/usb/gadget/function/f_uac2.c b/drivers/usb/gadget/function/f_uac2.c |
9879 |
+index db2d4980cb35..3633df6d7610 100644 |
9880 |
+--- a/drivers/usb/gadget/function/f_uac2.c |
9881 |
++++ b/drivers/usb/gadget/function/f_uac2.c |
9882 |
+@@ -215,10 +215,7 @@ static struct uac2_ac_header_descriptor ac_hdr_desc = { |
9883 |
+ .bDescriptorSubtype = UAC_MS_HEADER, |
9884 |
+ .bcdADC = cpu_to_le16(0x200), |
9885 |
+ .bCategory = UAC2_FUNCTION_IO_BOX, |
9886 |
+- .wTotalLength = cpu_to_le16(sizeof in_clk_src_desc |
9887 |
+- + sizeof out_clk_src_desc + sizeof usb_out_it_desc |
9888 |
+- + sizeof io_in_it_desc + sizeof usb_in_ot_desc |
9889 |
+- + sizeof io_out_ot_desc), |
9890 |
++ /* .wTotalLength = DYNAMIC */ |
9891 |
+ .bmControls = 0, |
9892 |
+ }; |
9893 |
+ |
9894 |
+@@ -501,7 +498,7 @@ static void setup_descriptor(struct f_uac2_opts *opts) |
9895 |
+ as_in_hdr_desc.bTerminalLink = usb_in_ot_desc.bTerminalID; |
9896 |
+ |
9897 |
+ iad_desc.bInterfaceCount = 1; |
9898 |
+- ac_hdr_desc.wTotalLength = 0; |
9899 |
++ ac_hdr_desc.wTotalLength = cpu_to_le16(sizeof(ac_hdr_desc)); |
9900 |
+ |
9901 |
+ if (EPIN_EN(opts)) { |
9902 |
+ u16 len = le16_to_cpu(ac_hdr_desc.wTotalLength); |
9903 |
+diff --git a/drivers/usb/gadget/udc/bdc/bdc_core.c b/drivers/usb/gadget/udc/bdc/bdc_core.c |
9904 |
+index 02a3a774670b..2dca11f0a744 100644 |
9905 |
+--- a/drivers/usb/gadget/udc/bdc/bdc_core.c |
9906 |
++++ b/drivers/usb/gadget/udc/bdc/bdc_core.c |
9907 |
+@@ -282,6 +282,7 @@ static void bdc_mem_init(struct bdc *bdc, bool reinit) |
9908 |
+ * in that case reinit is passed as 1 |
9909 |
+ */ |
9910 |
+ if (reinit) { |
9911 |
++ int i; |
9912 |
+ /* Enable interrupts */ |
9913 |
+ temp = bdc_readl(bdc->regs, BDC_BDCSC); |
9914 |
+ temp |= BDC_GIE; |
9915 |
+@@ -291,6 +292,9 @@ static void bdc_mem_init(struct bdc *bdc, bool reinit) |
9916 |
+ /* Initialize SRR to 0 */ |
9917 |
+ memset(bdc->srr.sr_bds, 0, |
9918 |
+ NUM_SR_ENTRIES * sizeof(struct bdc_bd)); |
9919 |
++ /* clear ep flags to avoid post disconnect stops/deconfigs */ |
9920 |
++ for (i = 1; i < bdc->num_eps; ++i) |
9921 |
++ bdc->bdc_ep_array[i]->flags = 0; |
9922 |
+ } else { |
9923 |
+ /* One time initiaization only */ |
9924 |
+ /* Enable status report function pointers */ |
9925 |
+@@ -599,9 +603,14 @@ static int bdc_remove(struct platform_device *pdev) |
9926 |
+ static int bdc_suspend(struct device *dev) |
9927 |
+ { |
9928 |
+ struct bdc *bdc = dev_get_drvdata(dev); |
9929 |
++ int ret; |
9930 |
+ |
9931 |
+- clk_disable_unprepare(bdc->clk); |
9932 |
+- return 0; |
9933 |
++ /* Halt the controller */ |
9934 |
++ ret = bdc_stop(bdc); |
9935 |
++ if (!ret) |
9936 |
++ clk_disable_unprepare(bdc->clk); |
9937 |
++ |
9938 |
++ return ret; |
9939 |
+ } |
9940 |
+ |
9941 |
+ static int bdc_resume(struct device *dev) |
9942 |
+diff --git a/drivers/usb/gadget/udc/bdc/bdc_ep.c b/drivers/usb/gadget/udc/bdc/bdc_ep.c |
9943 |
+index d49c6dc1082d..9ddc0b4e92c9 100644 |
9944 |
+--- a/drivers/usb/gadget/udc/bdc/bdc_ep.c |
9945 |
++++ b/drivers/usb/gadget/udc/bdc/bdc_ep.c |
9946 |
+@@ -615,7 +615,6 @@ int bdc_ep_enable(struct bdc_ep *ep) |
9947 |
+ } |
9948 |
+ bdc_dbg_bd_list(bdc, ep); |
9949 |
+ /* only for ep0: config ep is called for ep0 from connect event */ |
9950 |
+- ep->flags |= BDC_EP_ENABLED; |
9951 |
+ if (ep->ep_num == 1) |
9952 |
+ return ret; |
9953 |
+ |
9954 |
+@@ -759,10 +758,13 @@ static int ep_dequeue(struct bdc_ep *ep, struct bdc_req *req) |
9955 |
+ __func__, ep->name, start_bdi, end_bdi); |
9956 |
+ dev_dbg(bdc->dev, "ep_dequeue ep=%p ep->desc=%p\n", |
9957 |
+ ep, (void *)ep->usb_ep.desc); |
9958 |
+- /* Stop the ep to see where the HW is ? */ |
9959 |
+- ret = bdc_stop_ep(bdc, ep->ep_num); |
9960 |
+- /* if there is an issue with stopping ep, then no need to go further */ |
9961 |
+- if (ret) |
9962 |
++ /* if still connected, stop the ep to see where the HW is ? */ |
9963 |
++ if (!(bdc_readl(bdc->regs, BDC_USPC) & BDC_PST_MASK)) { |
9964 |
++ ret = bdc_stop_ep(bdc, ep->ep_num); |
9965 |
++ /* if there is an issue, then no need to go further */ |
9966 |
++ if (ret) |
9967 |
++ return 0; |
9968 |
++ } else |
9969 |
+ return 0; |
9970 |
+ |
9971 |
+ /* |
9972 |
+@@ -1911,7 +1913,9 @@ static int bdc_gadget_ep_disable(struct usb_ep *_ep) |
9973 |
+ __func__, ep->name, ep->flags); |
9974 |
+ |
9975 |
+ if (!(ep->flags & BDC_EP_ENABLED)) { |
9976 |
+- dev_warn(bdc->dev, "%s is already disabled\n", ep->name); |
9977 |
++ if (bdc->gadget.speed != USB_SPEED_UNKNOWN) |
9978 |
++ dev_warn(bdc->dev, "%s is already disabled\n", |
9979 |
++ ep->name); |
9980 |
+ return 0; |
9981 |
+ } |
9982 |
+ spin_lock_irqsave(&bdc->lock, flags); |
9983 |
+diff --git a/drivers/usb/gadget/udc/net2280.c b/drivers/usb/gadget/udc/net2280.c |
9984 |
+index 5eff85eeaa5a..7530bd9a08c4 100644 |
9985 |
+--- a/drivers/usb/gadget/udc/net2280.c |
9986 |
++++ b/drivers/usb/gadget/udc/net2280.c |
9987 |
+@@ -3781,8 +3781,10 @@ static int net2280_probe(struct pci_dev *pdev, const struct pci_device_id *id) |
9988 |
+ return 0; |
9989 |
+ |
9990 |
+ done: |
9991 |
+- if (dev) |
9992 |
++ if (dev) { |
9993 |
+ net2280_remove(pdev); |
9994 |
++ kfree(dev); |
9995 |
++ } |
9996 |
+ return retval; |
9997 |
+ } |
9998 |
+ |
9999 |
+diff --git a/drivers/usb/mtu3/mtu3_core.c b/drivers/usb/mtu3/mtu3_core.c |
10000 |
+index 9dd02160cca9..e3780d4d6514 100644 |
10001 |
+--- a/drivers/usb/mtu3/mtu3_core.c |
10002 |
++++ b/drivers/usb/mtu3/mtu3_core.c |
10003 |
+@@ -131,8 +131,12 @@ static void mtu3_device_disable(struct mtu3 *mtu) |
10004 |
+ mtu3_setbits(ibase, SSUSB_U2_CTRL(0), |
10005 |
+ SSUSB_U2_PORT_DIS | SSUSB_U2_PORT_PDN); |
10006 |
+ |
10007 |
+- if (mtu->ssusb->dr_mode == USB_DR_MODE_OTG) |
10008 |
++ if (mtu->ssusb->dr_mode == USB_DR_MODE_OTG) { |
10009 |
+ mtu3_clrbits(ibase, SSUSB_U2_CTRL(0), SSUSB_U2_PORT_OTG_SEL); |
10010 |
++ if (mtu->is_u3_ip) |
10011 |
++ mtu3_clrbits(ibase, SSUSB_U3_CTRL(0), |
10012 |
++ SSUSB_U3_PORT_DUAL_MODE); |
10013 |
++ } |
10014 |
+ |
10015 |
+ mtu3_setbits(ibase, U3D_SSUSB_IP_PW_CTRL2, SSUSB_IP_DEV_PDN); |
10016 |
+ } |
10017 |
+diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c |
10018 |
+index f5143eedbc48..a90801ef0055 100644 |
10019 |
+--- a/drivers/usb/serial/cp210x.c |
10020 |
++++ b/drivers/usb/serial/cp210x.c |
10021 |
+@@ -272,6 +272,8 @@ static struct usb_serial_driver cp210x_device = { |
10022 |
+ .break_ctl = cp210x_break_ctl, |
10023 |
+ .set_termios = cp210x_set_termios, |
10024 |
+ .tx_empty = cp210x_tx_empty, |
10025 |
++ .throttle = usb_serial_generic_throttle, |
10026 |
++ .unthrottle = usb_serial_generic_unthrottle, |
10027 |
+ .tiocmget = cp210x_tiocmget, |
10028 |
+ .tiocmset = cp210x_tiocmset, |
10029 |
+ .attach = cp210x_attach, |
10030 |
+@@ -915,6 +917,7 @@ static void cp210x_get_termios_port(struct usb_serial_port *port, |
10031 |
+ u32 baud; |
10032 |
+ u16 bits; |
10033 |
+ u32 ctl_hs; |
10034 |
++ u32 flow_repl; |
10035 |
+ |
10036 |
+ cp210x_read_u32_reg(port, CP210X_GET_BAUDRATE, &baud); |
10037 |
+ |
10038 |
+@@ -1015,6 +1018,22 @@ static void cp210x_get_termios_port(struct usb_serial_port *port, |
10039 |
+ ctl_hs = le32_to_cpu(flow_ctl.ulControlHandshake); |
10040 |
+ if (ctl_hs & CP210X_SERIAL_CTS_HANDSHAKE) { |
10041 |
+ dev_dbg(dev, "%s - flow control = CRTSCTS\n", __func__); |
10042 |
++ /* |
10043 |
++ * When the port is closed, the CP210x hardware disables |
10044 |
++ * auto-RTS and RTS is deasserted but it leaves auto-CTS when |
10045 |
++ * in hardware flow control mode. When re-opening the port, if |
10046 |
++ * auto-CTS is enabled on the cp210x, then auto-RTS must be |
10047 |
++ * re-enabled in the driver. |
10048 |
++ */ |
10049 |
++ flow_repl = le32_to_cpu(flow_ctl.ulFlowReplace); |
10050 |
++ flow_repl &= ~CP210X_SERIAL_RTS_MASK; |
10051 |
++ flow_repl |= CP210X_SERIAL_RTS_SHIFT(CP210X_SERIAL_RTS_FLOW_CTL); |
10052 |
++ flow_ctl.ulFlowReplace = cpu_to_le32(flow_repl); |
10053 |
++ cp210x_write_reg_block(port, |
10054 |
++ CP210X_SET_FLOW, |
10055 |
++ &flow_ctl, |
10056 |
++ sizeof(flow_ctl)); |
10057 |
++ |
10058 |
+ cflag |= CRTSCTS; |
10059 |
+ } else { |
10060 |
+ dev_dbg(dev, "%s - flow control = NONE\n", __func__); |
10061 |
+diff --git a/drivers/usb/serial/iuu_phoenix.c b/drivers/usb/serial/iuu_phoenix.c |
10062 |
+index b8dfeb4fb2ed..ffbb2a8901b2 100644 |
10063 |
+--- a/drivers/usb/serial/iuu_phoenix.c |
10064 |
++++ b/drivers/usb/serial/iuu_phoenix.c |
10065 |
+@@ -353,10 +353,11 @@ static void iuu_led_activity_on(struct urb *urb) |
10066 |
+ struct usb_serial_port *port = urb->context; |
10067 |
+ int result; |
10068 |
+ char *buf_ptr = port->write_urb->transfer_buffer; |
10069 |
+- *buf_ptr++ = IUU_SET_LED; |
10070 |
++ |
10071 |
+ if (xmas) { |
10072 |
+- get_random_bytes(buf_ptr, 6); |
10073 |
+- *(buf_ptr+7) = 1; |
10074 |
++ buf_ptr[0] = IUU_SET_LED; |
10075 |
++ get_random_bytes(buf_ptr + 1, 6); |
10076 |
++ buf_ptr[7] = 1; |
10077 |
+ } else { |
10078 |
+ iuu_rgbf_fill_buffer(buf_ptr, 255, 255, 0, 0, 0, 0, 255); |
10079 |
+ } |
10080 |
+@@ -374,13 +375,14 @@ static void iuu_led_activity_off(struct urb *urb) |
10081 |
+ struct usb_serial_port *port = urb->context; |
10082 |
+ int result; |
10083 |
+ char *buf_ptr = port->write_urb->transfer_buffer; |
10084 |
++ |
10085 |
+ if (xmas) { |
10086 |
+ iuu_rxcmd(urb); |
10087 |
+ return; |
10088 |
+- } else { |
10089 |
+- *buf_ptr++ = IUU_SET_LED; |
10090 |
+- iuu_rgbf_fill_buffer(buf_ptr, 0, 0, 255, 255, 0, 0, 255); |
10091 |
+ } |
10092 |
++ |
10093 |
++ iuu_rgbf_fill_buffer(buf_ptr, 0, 0, 255, 255, 0, 0, 255); |
10094 |
++ |
10095 |
+ usb_fill_bulk_urb(port->write_urb, port->serial->dev, |
10096 |
+ usb_sndbulkpipe(port->serial->dev, |
10097 |
+ port->bulk_out_endpointAddress), |
10098 |
+diff --git a/drivers/vdpa/vdpa_sim/vdpa_sim.c b/drivers/vdpa/vdpa_sim/vdpa_sim.c |
10099 |
+index 01c456f7c1f7..e2dc8edd680e 100644 |
10100 |
+--- a/drivers/vdpa/vdpa_sim/vdpa_sim.c |
10101 |
++++ b/drivers/vdpa/vdpa_sim/vdpa_sim.c |
10102 |
+@@ -70,6 +70,8 @@ struct vdpasim { |
10103 |
+ u32 status; |
10104 |
+ u32 generation; |
10105 |
+ u64 features; |
10106 |
++ /* spinlock to synchronize iommu table */ |
10107 |
++ spinlock_t iommu_lock; |
10108 |
+ }; |
10109 |
+ |
10110 |
+ static struct vdpasim *vdpasim_dev; |
10111 |
+@@ -118,7 +120,9 @@ static void vdpasim_reset(struct vdpasim *vdpasim) |
10112 |
+ for (i = 0; i < VDPASIM_VQ_NUM; i++) |
10113 |
+ vdpasim_vq_reset(&vdpasim->vqs[i]); |
10114 |
+ |
10115 |
++ spin_lock(&vdpasim->iommu_lock); |
10116 |
+ vhost_iotlb_reset(vdpasim->iommu); |
10117 |
++ spin_unlock(&vdpasim->iommu_lock); |
10118 |
+ |
10119 |
+ vdpasim->features = 0; |
10120 |
+ vdpasim->status = 0; |
10121 |
+@@ -235,8 +239,10 @@ static dma_addr_t vdpasim_map_page(struct device *dev, struct page *page, |
10122 |
+ /* For simplicity, use identical mapping to avoid e.g iova |
10123 |
+ * allocator. |
10124 |
+ */ |
10125 |
++ spin_lock(&vdpasim->iommu_lock); |
10126 |
+ ret = vhost_iotlb_add_range(iommu, pa, pa + size - 1, |
10127 |
+ pa, dir_to_perm(dir)); |
10128 |
++ spin_unlock(&vdpasim->iommu_lock); |
10129 |
+ if (ret) |
10130 |
+ return DMA_MAPPING_ERROR; |
10131 |
+ |
10132 |
+@@ -250,8 +256,10 @@ static void vdpasim_unmap_page(struct device *dev, dma_addr_t dma_addr, |
10133 |
+ struct vdpasim *vdpasim = dev_to_sim(dev); |
10134 |
+ struct vhost_iotlb *iommu = vdpasim->iommu; |
10135 |
+ |
10136 |
++ spin_lock(&vdpasim->iommu_lock); |
10137 |
+ vhost_iotlb_del_range(iommu, (u64)dma_addr, |
10138 |
+ (u64)dma_addr + size - 1); |
10139 |
++ spin_unlock(&vdpasim->iommu_lock); |
10140 |
+ } |
10141 |
+ |
10142 |
+ static void *vdpasim_alloc_coherent(struct device *dev, size_t size, |
10143 |
+@@ -263,9 +271,10 @@ static void *vdpasim_alloc_coherent(struct device *dev, size_t size, |
10144 |
+ void *addr = kmalloc(size, flag); |
10145 |
+ int ret; |
10146 |
+ |
10147 |
+- if (!addr) |
10148 |
++ spin_lock(&vdpasim->iommu_lock); |
10149 |
++ if (!addr) { |
10150 |
+ *dma_addr = DMA_MAPPING_ERROR; |
10151 |
+- else { |
10152 |
++ } else { |
10153 |
+ u64 pa = virt_to_phys(addr); |
10154 |
+ |
10155 |
+ ret = vhost_iotlb_add_range(iommu, (u64)pa, |
10156 |
+@@ -278,6 +287,7 @@ static void *vdpasim_alloc_coherent(struct device *dev, size_t size, |
10157 |
+ } else |
10158 |
+ *dma_addr = (dma_addr_t)pa; |
10159 |
+ } |
10160 |
++ spin_unlock(&vdpasim->iommu_lock); |
10161 |
+ |
10162 |
+ return addr; |
10163 |
+ } |
10164 |
+@@ -289,8 +299,11 @@ static void vdpasim_free_coherent(struct device *dev, size_t size, |
10165 |
+ struct vdpasim *vdpasim = dev_to_sim(dev); |
10166 |
+ struct vhost_iotlb *iommu = vdpasim->iommu; |
10167 |
+ |
10168 |
++ spin_lock(&vdpasim->iommu_lock); |
10169 |
+ vhost_iotlb_del_range(iommu, (u64)dma_addr, |
10170 |
+ (u64)dma_addr + size - 1); |
10171 |
++ spin_unlock(&vdpasim->iommu_lock); |
10172 |
++ |
10173 |
+ kfree(phys_to_virt((uintptr_t)dma_addr)); |
10174 |
+ } |
10175 |
+ |
10176 |
+@@ -531,6 +544,7 @@ static int vdpasim_set_map(struct vdpa_device *vdpa, |
10177 |
+ u64 start = 0ULL, last = 0ULL - 1; |
10178 |
+ int ret; |
10179 |
+ |
10180 |
++ spin_lock(&vdpasim->iommu_lock); |
10181 |
+ vhost_iotlb_reset(vdpasim->iommu); |
10182 |
+ |
10183 |
+ for (map = vhost_iotlb_itree_first(iotlb, start, last); map; |
10184 |
+@@ -540,10 +554,12 @@ static int vdpasim_set_map(struct vdpa_device *vdpa, |
10185 |
+ if (ret) |
10186 |
+ goto err; |
10187 |
+ } |
10188 |
++ spin_unlock(&vdpasim->iommu_lock); |
10189 |
+ return 0; |
10190 |
+ |
10191 |
+ err: |
10192 |
+ vhost_iotlb_reset(vdpasim->iommu); |
10193 |
++ spin_unlock(&vdpasim->iommu_lock); |
10194 |
+ return ret; |
10195 |
+ } |
10196 |
+ |
10197 |
+@@ -551,16 +567,23 @@ static int vdpasim_dma_map(struct vdpa_device *vdpa, u64 iova, u64 size, |
10198 |
+ u64 pa, u32 perm) |
10199 |
+ { |
10200 |
+ struct vdpasim *vdpasim = vdpa_to_sim(vdpa); |
10201 |
++ int ret; |
10202 |
+ |
10203 |
+- return vhost_iotlb_add_range(vdpasim->iommu, iova, |
10204 |
+- iova + size - 1, pa, perm); |
10205 |
++ spin_lock(&vdpasim->iommu_lock); |
10206 |
++ ret = vhost_iotlb_add_range(vdpasim->iommu, iova, iova + size - 1, pa, |
10207 |
++ perm); |
10208 |
++ spin_unlock(&vdpasim->iommu_lock); |
10209 |
++ |
10210 |
++ return ret; |
10211 |
+ } |
10212 |
+ |
10213 |
+ static int vdpasim_dma_unmap(struct vdpa_device *vdpa, u64 iova, u64 size) |
10214 |
+ { |
10215 |
+ struct vdpasim *vdpasim = vdpa_to_sim(vdpa); |
10216 |
+ |
10217 |
++ spin_lock(&vdpasim->iommu_lock); |
10218 |
+ vhost_iotlb_del_range(vdpasim->iommu, iova, iova + size - 1); |
10219 |
++ spin_unlock(&vdpasim->iommu_lock); |
10220 |
+ |
10221 |
+ return 0; |
10222 |
+ } |
10223 |
+diff --git a/drivers/video/console/newport_con.c b/drivers/video/console/newport_con.c |
10224 |
+index 00dddf6e08b0..2d2ee17052e8 100644 |
10225 |
+--- a/drivers/video/console/newport_con.c |
10226 |
++++ b/drivers/video/console/newport_con.c |
10227 |
+@@ -32,6 +32,8 @@ |
10228 |
+ #include <linux/linux_logo.h> |
10229 |
+ #include <linux/font.h> |
10230 |
+ |
10231 |
++#define NEWPORT_LEN 0x10000 |
10232 |
++ |
10233 |
+ #define FONT_DATA ((unsigned char *)font_vga_8x16.data) |
10234 |
+ |
10235 |
+ /* borrowed from fbcon.c */ |
10236 |
+@@ -43,6 +45,7 @@ |
10237 |
+ static unsigned char *font_data[MAX_NR_CONSOLES]; |
10238 |
+ |
10239 |
+ static struct newport_regs *npregs; |
10240 |
++static unsigned long newport_addr; |
10241 |
+ |
10242 |
+ static int logo_active; |
10243 |
+ static int topscan; |
10244 |
+@@ -702,7 +705,6 @@ const struct consw newport_con = { |
10245 |
+ static int newport_probe(struct gio_device *dev, |
10246 |
+ const struct gio_device_id *id) |
10247 |
+ { |
10248 |
+- unsigned long newport_addr; |
10249 |
+ int err; |
10250 |
+ |
10251 |
+ if (!dev->resource.start) |
10252 |
+@@ -712,7 +714,7 @@ static int newport_probe(struct gio_device *dev, |
10253 |
+ return -EBUSY; /* we only support one Newport as console */ |
10254 |
+ |
10255 |
+ newport_addr = dev->resource.start + 0xF0000; |
10256 |
+- if (!request_mem_region(newport_addr, 0x10000, "Newport")) |
10257 |
++ if (!request_mem_region(newport_addr, NEWPORT_LEN, "Newport")) |
10258 |
+ return -ENODEV; |
10259 |
+ |
10260 |
+ npregs = (struct newport_regs *)/* ioremap cannot fail */ |
10261 |
+@@ -720,6 +722,11 @@ static int newport_probe(struct gio_device *dev, |
10262 |
+ console_lock(); |
10263 |
+ err = do_take_over_console(&newport_con, 0, MAX_NR_CONSOLES - 1, 1); |
10264 |
+ console_unlock(); |
10265 |
++ |
10266 |
++ if (err) { |
10267 |
++ iounmap((void *)npregs); |
10268 |
++ release_mem_region(newport_addr, NEWPORT_LEN); |
10269 |
++ } |
10270 |
+ return err; |
10271 |
+ } |
10272 |
+ |
10273 |
+@@ -727,6 +734,7 @@ static void newport_remove(struct gio_device *dev) |
10274 |
+ { |
10275 |
+ give_up_console(&newport_con); |
10276 |
+ iounmap((void *)npregs); |
10277 |
++ release_mem_region(newport_addr, NEWPORT_LEN); |
10278 |
+ } |
10279 |
+ |
10280 |
+ static struct gio_device_id newport_ids[] = { |
10281 |
+diff --git a/drivers/video/fbdev/neofb.c b/drivers/video/fbdev/neofb.c |
10282 |
+index e6ea853c1723..5a363ce9b4cb 100644 |
10283 |
+--- a/drivers/video/fbdev/neofb.c |
10284 |
++++ b/drivers/video/fbdev/neofb.c |
10285 |
+@@ -1820,6 +1820,7 @@ static int neo_scan_monitor(struct fb_info *info) |
10286 |
+ #else |
10287 |
+ printk(KERN_ERR |
10288 |
+ "neofb: Only 640x480, 800x600/480 and 1024x768 panels are currently supported\n"); |
10289 |
++ kfree(info->monspecs.modedb); |
10290 |
+ return -1; |
10291 |
+ #endif |
10292 |
+ default: |
10293 |
+diff --git a/drivers/video/fbdev/pxafb.c b/drivers/video/fbdev/pxafb.c |
10294 |
+index 00b96a78676e..6f972bed410a 100644 |
10295 |
+--- a/drivers/video/fbdev/pxafb.c |
10296 |
++++ b/drivers/video/fbdev/pxafb.c |
10297 |
+@@ -2417,8 +2417,8 @@ static int pxafb_remove(struct platform_device *dev) |
10298 |
+ |
10299 |
+ free_pages_exact(fbi->video_mem, fbi->video_mem_size); |
10300 |
+ |
10301 |
+- dma_free_wc(&dev->dev, fbi->dma_buff_size, fbi->dma_buff, |
10302 |
+- fbi->dma_buff_phys); |
10303 |
++ dma_free_coherent(&dev->dev, fbi->dma_buff_size, fbi->dma_buff, |
10304 |
++ fbi->dma_buff_phys); |
10305 |
+ |
10306 |
+ return 0; |
10307 |
+ } |
10308 |
+diff --git a/drivers/video/fbdev/savage/savagefb_driver.c b/drivers/video/fbdev/savage/savagefb_driver.c |
10309 |
+index aab312a7d9da..a542c33f2082 100644 |
10310 |
+--- a/drivers/video/fbdev/savage/savagefb_driver.c |
10311 |
++++ b/drivers/video/fbdev/savage/savagefb_driver.c |
10312 |
+@@ -2158,6 +2158,8 @@ static int savage_init_fb_info(struct fb_info *info, struct pci_dev *dev, |
10313 |
+ info->flags |= FBINFO_HWACCEL_COPYAREA | |
10314 |
+ FBINFO_HWACCEL_FILLRECT | |
10315 |
+ FBINFO_HWACCEL_IMAGEBLIT; |
10316 |
++ else |
10317 |
++ kfree(info->pixmap.addr); |
10318 |
+ } |
10319 |
+ #endif |
10320 |
+ return err; |
10321 |
+diff --git a/drivers/video/fbdev/sm712fb.c b/drivers/video/fbdev/sm712fb.c |
10322 |
+index 6a1b4a853d9e..8cd655d6d628 100644 |
10323 |
+--- a/drivers/video/fbdev/sm712fb.c |
10324 |
++++ b/drivers/video/fbdev/sm712fb.c |
10325 |
+@@ -1429,6 +1429,8 @@ static int smtc_map_smem(struct smtcfb_info *sfb, |
10326 |
+ static void smtc_unmap_smem(struct smtcfb_info *sfb) |
10327 |
+ { |
10328 |
+ if (sfb && sfb->fb->screen_base) { |
10329 |
++ if (sfb->chip_id == 0x720) |
10330 |
++ sfb->fb->screen_base -= 0x00200000; |
10331 |
+ iounmap(sfb->fb->screen_base); |
10332 |
+ sfb->fb->screen_base = NULL; |
10333 |
+ } |
10334 |
+diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c |
10335 |
+index 0c142bcab79d..a932e75f44fc 100644 |
10336 |
+--- a/drivers/xen/balloon.c |
10337 |
++++ b/drivers/xen/balloon.c |
10338 |
+@@ -569,11 +569,13 @@ static int add_ballooned_pages(int nr_pages) |
10339 |
+ if (xen_hotplug_unpopulated) { |
10340 |
+ st = reserve_additional_memory(); |
10341 |
+ if (st != BP_ECANCELED) { |
10342 |
++ int rc; |
10343 |
++ |
10344 |
+ mutex_unlock(&balloon_mutex); |
10345 |
+- wait_event(balloon_wq, |
10346 |
++ rc = wait_event_interruptible(balloon_wq, |
10347 |
+ !list_empty(&ballooned_pages)); |
10348 |
+ mutex_lock(&balloon_mutex); |
10349 |
+- return 0; |
10350 |
++ return rc ? -ENOMEM : 0; |
10351 |
+ } |
10352 |
+ } |
10353 |
+ |
10354 |
+@@ -631,6 +633,12 @@ int alloc_xenballooned_pages(int nr_pages, struct page **pages) |
10355 |
+ out_undo: |
10356 |
+ mutex_unlock(&balloon_mutex); |
10357 |
+ free_xenballooned_pages(pgno, pages); |
10358 |
++ /* |
10359 |
++ * NB: free_xenballooned_pages will only subtract pgno pages, but since |
10360 |
++ * target_unpopulated is incremented with nr_pages at the start we need |
10361 |
++ * to remove the remaining ones also, or accounting will be screwed. |
10362 |
++ */ |
10363 |
++ balloon_stats.target_unpopulated -= nr_pages - pgno; |
10364 |
+ return ret; |
10365 |
+ } |
10366 |
+ EXPORT_SYMBOL(alloc_xenballooned_pages); |
10367 |
+diff --git a/drivers/xen/gntdev-dmabuf.c b/drivers/xen/gntdev-dmabuf.c |
10368 |
+index 75d3bb948bf3..b1b6eebafd5d 100644 |
10369 |
+--- a/drivers/xen/gntdev-dmabuf.c |
10370 |
++++ b/drivers/xen/gntdev-dmabuf.c |
10371 |
+@@ -613,6 +613,14 @@ dmabuf_imp_to_refs(struct gntdev_dmabuf_priv *priv, struct device *dev, |
10372 |
+ goto fail_detach; |
10373 |
+ } |
10374 |
+ |
10375 |
++ /* Check that we have zero offset. */ |
10376 |
++ if (sgt->sgl->offset) { |
10377 |
++ ret = ERR_PTR(-EINVAL); |
10378 |
++ pr_debug("DMA buffer has %d bytes offset, user-space expects 0\n", |
10379 |
++ sgt->sgl->offset); |
10380 |
++ goto fail_unmap; |
10381 |
++ } |
10382 |
++ |
10383 |
+ /* Check number of pages that imported buffer has. */ |
10384 |
+ if (attach->dmabuf->size != gntdev_dmabuf->nr_pages << PAGE_SHIFT) { |
10385 |
+ ret = ERR_PTR(-EINVAL); |
10386 |
+diff --git a/fs/9p/v9fs.c b/fs/9p/v9fs.c |
10387 |
+index 15a99f9c7253..39def020a074 100644 |
10388 |
+--- a/fs/9p/v9fs.c |
10389 |
++++ b/fs/9p/v9fs.c |
10390 |
+@@ -500,10 +500,9 @@ void v9fs_session_close(struct v9fs_session_info *v9ses) |
10391 |
+ } |
10392 |
+ |
10393 |
+ #ifdef CONFIG_9P_FSCACHE |
10394 |
+- if (v9ses->fscache) { |
10395 |
++ if (v9ses->fscache) |
10396 |
+ v9fs_cache_session_put_cookie(v9ses); |
10397 |
+- kfree(v9ses->cachetag); |
10398 |
+- } |
10399 |
++ kfree(v9ses->cachetag); |
10400 |
+ #endif |
10401 |
+ kfree(v9ses->uname); |
10402 |
+ kfree(v9ses->aname); |
10403 |
+diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h |
10404 |
+index 09e6dff8a8f8..68bd89e3d4f0 100644 |
10405 |
+--- a/fs/btrfs/ctree.h |
10406 |
++++ b/fs/btrfs/ctree.h |
10407 |
+@@ -2982,6 +2982,8 @@ int btrfs_dirty_pages(struct inode *inode, struct page **pages, |
10408 |
+ size_t num_pages, loff_t pos, size_t write_bytes, |
10409 |
+ struct extent_state **cached); |
10410 |
+ int btrfs_fdatawrite_range(struct inode *inode, loff_t start, loff_t end); |
10411 |
++int btrfs_check_can_nocow(struct btrfs_inode *inode, loff_t pos, |
10412 |
++ size_t *write_bytes, bool nowait); |
10413 |
+ |
10414 |
+ /* tree-defrag.c */ |
10415 |
+ int btrfs_defrag_leaves(struct btrfs_trans_handle *trans, |
10416 |
+diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c |
10417 |
+index 54a64d1e18c6..7c86188b33d4 100644 |
10418 |
+--- a/fs/btrfs/extent-tree.c |
10419 |
++++ b/fs/btrfs/extent-tree.c |
10420 |
+@@ -5481,6 +5481,14 @@ int btrfs_drop_snapshot(struct btrfs_root *root, int update_ref, int for_reloc) |
10421 |
+ } |
10422 |
+ } |
10423 |
+ |
10424 |
++ /* |
10425 |
++ * This subvolume is going to be completely dropped, and won't be |
10426 |
++ * recorded as dirty roots, thus pertrans meta rsv will not be freed at |
10427 |
++ * commit transaction time. So free it here manually. |
10428 |
++ */ |
10429 |
++ btrfs_qgroup_convert_reserved_meta(root, INT_MAX); |
10430 |
++ btrfs_qgroup_free_meta_all_pertrans(root); |
10431 |
++ |
10432 |
+ if (test_bit(BTRFS_ROOT_IN_RADIX, &root->state)) |
10433 |
+ btrfs_add_dropped_root(trans, root); |
10434 |
+ else |
10435 |
+diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c |
10436 |
+index 79196eb1a1b3..9d6d646e1eb0 100644 |
10437 |
+--- a/fs/btrfs/extent_io.c |
10438 |
++++ b/fs/btrfs/extent_io.c |
10439 |
+@@ -4518,6 +4518,8 @@ int try_release_extent_mapping(struct page *page, gfp_t mask) |
10440 |
+ |
10441 |
+ /* once for us */ |
10442 |
+ free_extent_map(em); |
10443 |
++ |
10444 |
++ cond_resched(); /* Allow large-extent preemption. */ |
10445 |
+ } |
10446 |
+ } |
10447 |
+ return try_release_extent_state(tree, page, mask); |
10448 |
+diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c |
10449 |
+index 93244934d4f9..1e1af0ce7077 100644 |
10450 |
+--- a/fs/btrfs/file.c |
10451 |
++++ b/fs/btrfs/file.c |
10452 |
+@@ -1540,8 +1540,8 @@ lock_and_cleanup_extent_if_need(struct btrfs_inode *inode, struct page **pages, |
10453 |
+ return ret; |
10454 |
+ } |
10455 |
+ |
10456 |
+-static noinline int check_can_nocow(struct btrfs_inode *inode, loff_t pos, |
10457 |
+- size_t *write_bytes, bool nowait) |
10458 |
++int btrfs_check_can_nocow(struct btrfs_inode *inode, loff_t pos, |
10459 |
++ size_t *write_bytes, bool nowait) |
10460 |
+ { |
10461 |
+ struct btrfs_fs_info *fs_info = inode->root->fs_info; |
10462 |
+ struct btrfs_root *root = inode->root; |
10463 |
+@@ -1656,8 +1656,8 @@ static noinline ssize_t btrfs_buffered_write(struct kiocb *iocb, |
10464 |
+ if (ret < 0) { |
10465 |
+ if ((BTRFS_I(inode)->flags & (BTRFS_INODE_NODATACOW | |
10466 |
+ BTRFS_INODE_PREALLOC)) && |
10467 |
+- check_can_nocow(BTRFS_I(inode), pos, |
10468 |
+- &write_bytes, false) > 0) { |
10469 |
++ btrfs_check_can_nocow(BTRFS_I(inode), pos, |
10470 |
++ &write_bytes, false) > 0) { |
10471 |
+ /* |
10472 |
+ * For nodata cow case, no need to reserve |
10473 |
+ * data space. |
10474 |
+@@ -1936,8 +1936,8 @@ static ssize_t btrfs_file_write_iter(struct kiocb *iocb, |
10475 |
+ */ |
10476 |
+ if (!(BTRFS_I(inode)->flags & (BTRFS_INODE_NODATACOW | |
10477 |
+ BTRFS_INODE_PREALLOC)) || |
10478 |
+- check_can_nocow(BTRFS_I(inode), pos, &nocow_bytes, |
10479 |
+- true) <= 0) { |
10480 |
++ btrfs_check_can_nocow(BTRFS_I(inode), pos, &nocow_bytes, |
10481 |
++ true) <= 0) { |
10482 |
+ inode_unlock(inode); |
10483 |
+ return -EAGAIN; |
10484 |
+ } |
10485 |
+diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c |
10486 |
+index e7bdda3ed069..6cb3dc274897 100644 |
10487 |
+--- a/fs/btrfs/inode.c |
10488 |
++++ b/fs/btrfs/inode.c |
10489 |
+@@ -4520,11 +4520,13 @@ int btrfs_truncate_block(struct inode *inode, loff_t from, loff_t len, |
10490 |
+ struct extent_state *cached_state = NULL; |
10491 |
+ struct extent_changeset *data_reserved = NULL; |
10492 |
+ char *kaddr; |
10493 |
++ bool only_release_metadata = false; |
10494 |
+ u32 blocksize = fs_info->sectorsize; |
10495 |
+ pgoff_t index = from >> PAGE_SHIFT; |
10496 |
+ unsigned offset = from & (blocksize - 1); |
10497 |
+ struct page *page; |
10498 |
+ gfp_t mask = btrfs_alloc_write_mask(mapping); |
10499 |
++ size_t write_bytes = blocksize; |
10500 |
+ int ret = 0; |
10501 |
+ u64 block_start; |
10502 |
+ u64 block_end; |
10503 |
+@@ -4536,11 +4538,27 @@ int btrfs_truncate_block(struct inode *inode, loff_t from, loff_t len, |
10504 |
+ block_start = round_down(from, blocksize); |
10505 |
+ block_end = block_start + blocksize - 1; |
10506 |
+ |
10507 |
+- ret = btrfs_delalloc_reserve_space(inode, &data_reserved, |
10508 |
+- block_start, blocksize); |
10509 |
+- if (ret) |
10510 |
+- goto out; |
10511 |
+ |
10512 |
++ ret = btrfs_check_data_free_space(inode, &data_reserved, block_start, |
10513 |
++ blocksize); |
10514 |
++ if (ret < 0) { |
10515 |
++ if ((BTRFS_I(inode)->flags & (BTRFS_INODE_NODATACOW | |
10516 |
++ BTRFS_INODE_PREALLOC)) && |
10517 |
++ btrfs_check_can_nocow(BTRFS_I(inode), block_start, |
10518 |
++ &write_bytes, false) > 0) { |
10519 |
++ /* For nocow case, no need to reserve data space */ |
10520 |
++ only_release_metadata = true; |
10521 |
++ } else { |
10522 |
++ goto out; |
10523 |
++ } |
10524 |
++ } |
10525 |
++ ret = btrfs_delalloc_reserve_metadata(BTRFS_I(inode), blocksize); |
10526 |
++ if (ret < 0) { |
10527 |
++ if (!only_release_metadata) |
10528 |
++ btrfs_free_reserved_data_space(inode, data_reserved, |
10529 |
++ block_start, blocksize); |
10530 |
++ goto out; |
10531 |
++ } |
10532 |
+ again: |
10533 |
+ page = find_or_create_page(mapping, index, mask); |
10534 |
+ if (!page) { |
10535 |
+@@ -4609,14 +4627,26 @@ again: |
10536 |
+ set_page_dirty(page); |
10537 |
+ unlock_extent_cached(io_tree, block_start, block_end, &cached_state); |
10538 |
+ |
10539 |
++ if (only_release_metadata) |
10540 |
++ set_extent_bit(&BTRFS_I(inode)->io_tree, block_start, |
10541 |
++ block_end, EXTENT_NORESERVE, NULL, NULL, |
10542 |
++ GFP_NOFS); |
10543 |
++ |
10544 |
+ out_unlock: |
10545 |
+- if (ret) |
10546 |
+- btrfs_delalloc_release_space(inode, data_reserved, block_start, |
10547 |
+- blocksize, true); |
10548 |
++ if (ret) { |
10549 |
++ if (only_release_metadata) |
10550 |
++ btrfs_delalloc_release_metadata(BTRFS_I(inode), |
10551 |
++ blocksize, true); |
10552 |
++ else |
10553 |
++ btrfs_delalloc_release_space(inode, data_reserved, |
10554 |
++ block_start, blocksize, true); |
10555 |
++ } |
10556 |
+ btrfs_delalloc_release_extents(BTRFS_I(inode), blocksize); |
10557 |
+ unlock_page(page); |
10558 |
+ put_page(page); |
10559 |
+ out: |
10560 |
++ if (only_release_metadata) |
10561 |
++ btrfs_drew_write_unlock(&BTRFS_I(inode)->root->snapshot_lock); |
10562 |
+ extent_changeset_free(data_reserved); |
10563 |
+ return ret; |
10564 |
+ } |
10565 |
+diff --git a/fs/btrfs/space-info.c b/fs/btrfs/space-info.c |
10566 |
+index 756950aba1a6..317d1d216009 100644 |
10567 |
+--- a/fs/btrfs/space-info.c |
10568 |
++++ b/fs/btrfs/space-info.c |
10569 |
+@@ -468,8 +468,8 @@ again: |
10570 |
+ "block group %llu has %llu bytes, %llu used %llu pinned %llu reserved %s", |
10571 |
+ cache->start, cache->length, cache->used, cache->pinned, |
10572 |
+ cache->reserved, cache->ro ? "[readonly]" : ""); |
10573 |
+- btrfs_dump_free_space(cache, bytes); |
10574 |
+ spin_unlock(&cache->lock); |
10575 |
++ btrfs_dump_free_space(cache, bytes); |
10576 |
+ } |
10577 |
+ if (++index < BTRFS_NR_RAID_TYPES) |
10578 |
+ goto again; |
10579 |
+diff --git a/fs/dlm/lockspace.c b/fs/dlm/lockspace.c |
10580 |
+index afb8340918b8..c689359ca532 100644 |
10581 |
+--- a/fs/dlm/lockspace.c |
10582 |
++++ b/fs/dlm/lockspace.c |
10583 |
+@@ -632,6 +632,9 @@ static int new_lockspace(const char *name, const char *cluster, |
10584 |
+ wait_event(ls->ls_recover_lock_wait, |
10585 |
+ test_bit(LSFL_RECOVER_LOCK, &ls->ls_flags)); |
10586 |
+ |
10587 |
++ /* let kobject handle freeing of ls if there's an error */ |
10588 |
++ do_unreg = 1; |
10589 |
++ |
10590 |
+ ls->ls_kobj.kset = dlm_kset; |
10591 |
+ error = kobject_init_and_add(&ls->ls_kobj, &dlm_ktype, NULL, |
10592 |
+ "%s", ls->ls_name); |
10593 |
+@@ -639,9 +642,6 @@ static int new_lockspace(const char *name, const char *cluster, |
10594 |
+ goto out_recoverd; |
10595 |
+ kobject_uevent(&ls->ls_kobj, KOBJ_ADD); |
10596 |
+ |
10597 |
+- /* let kobject handle freeing of ls if there's an error */ |
10598 |
+- do_unreg = 1; |
10599 |
+- |
10600 |
+ /* This uevent triggers dlm_controld in userspace to add us to the |
10601 |
+ group of nodes that are members of this lockspace (managed by the |
10602 |
+ cluster infrastructure.) Once it's done that, it tells us who the |
10603 |
+diff --git a/fs/erofs/inode.c b/fs/erofs/inode.c |
10604 |
+index 3350ab65d892..b36b414cd7a7 100644 |
10605 |
+--- a/fs/erofs/inode.c |
10606 |
++++ b/fs/erofs/inode.c |
10607 |
+@@ -8,31 +8,80 @@ |
10608 |
+ |
10609 |
+ #include <trace/events/erofs.h> |
10610 |
+ |
10611 |
+-/* no locking */ |
10612 |
+-static int erofs_read_inode(struct inode *inode, void *data) |
10613 |
++/* |
10614 |
++ * if inode is successfully read, return its inode page (or sometimes |
10615 |
++ * the inode payload page if it's an extended inode) in order to fill |
10616 |
++ * inline data if possible. |
10617 |
++ */ |
10618 |
++static struct page *erofs_read_inode(struct inode *inode, |
10619 |
++ unsigned int *ofs) |
10620 |
+ { |
10621 |
++ struct super_block *sb = inode->i_sb; |
10622 |
++ struct erofs_sb_info *sbi = EROFS_SB(sb); |
10623 |
+ struct erofs_inode *vi = EROFS_I(inode); |
10624 |
+- struct erofs_inode_compact *dic = data; |
10625 |
+- struct erofs_inode_extended *die; |
10626 |
++ const erofs_off_t inode_loc = iloc(sbi, vi->nid); |
10627 |
++ |
10628 |
++ erofs_blk_t blkaddr, nblks = 0; |
10629 |
++ struct page *page; |
10630 |
++ struct erofs_inode_compact *dic; |
10631 |
++ struct erofs_inode_extended *die, *copied = NULL; |
10632 |
++ unsigned int ifmt; |
10633 |
++ int err; |
10634 |
+ |
10635 |
+- const unsigned int ifmt = le16_to_cpu(dic->i_format); |
10636 |
+- struct erofs_sb_info *sbi = EROFS_SB(inode->i_sb); |
10637 |
+- erofs_blk_t nblks = 0; |
10638 |
++ blkaddr = erofs_blknr(inode_loc); |
10639 |
++ *ofs = erofs_blkoff(inode_loc); |
10640 |
+ |
10641 |
+- vi->datalayout = erofs_inode_datalayout(ifmt); |
10642 |
++ erofs_dbg("%s, reading inode nid %llu at %u of blkaddr %u", |
10643 |
++ __func__, vi->nid, *ofs, blkaddr); |
10644 |
++ |
10645 |
++ page = erofs_get_meta_page(sb, blkaddr); |
10646 |
++ if (IS_ERR(page)) { |
10647 |
++ erofs_err(sb, "failed to get inode (nid: %llu) page, err %ld", |
10648 |
++ vi->nid, PTR_ERR(page)); |
10649 |
++ return page; |
10650 |
++ } |
10651 |
+ |
10652 |
++ dic = page_address(page) + *ofs; |
10653 |
++ ifmt = le16_to_cpu(dic->i_format); |
10654 |
++ |
10655 |
++ vi->datalayout = erofs_inode_datalayout(ifmt); |
10656 |
+ if (vi->datalayout >= EROFS_INODE_DATALAYOUT_MAX) { |
10657 |
+ erofs_err(inode->i_sb, "unsupported datalayout %u of nid %llu", |
10658 |
+ vi->datalayout, vi->nid); |
10659 |
+- DBG_BUGON(1); |
10660 |
+- return -EOPNOTSUPP; |
10661 |
++ err = -EOPNOTSUPP; |
10662 |
++ goto err_out; |
10663 |
+ } |
10664 |
+ |
10665 |
+ switch (erofs_inode_version(ifmt)) { |
10666 |
+ case EROFS_INODE_LAYOUT_EXTENDED: |
10667 |
+- die = data; |
10668 |
+- |
10669 |
+ vi->inode_isize = sizeof(struct erofs_inode_extended); |
10670 |
++ /* check if the inode acrosses page boundary */ |
10671 |
++ if (*ofs + vi->inode_isize <= PAGE_SIZE) { |
10672 |
++ *ofs += vi->inode_isize; |
10673 |
++ die = (struct erofs_inode_extended *)dic; |
10674 |
++ } else { |
10675 |
++ const unsigned int gotten = PAGE_SIZE - *ofs; |
10676 |
++ |
10677 |
++ copied = kmalloc(vi->inode_isize, GFP_NOFS); |
10678 |
++ if (!copied) { |
10679 |
++ err = -ENOMEM; |
10680 |
++ goto err_out; |
10681 |
++ } |
10682 |
++ memcpy(copied, dic, gotten); |
10683 |
++ unlock_page(page); |
10684 |
++ put_page(page); |
10685 |
++ |
10686 |
++ page = erofs_get_meta_page(sb, blkaddr + 1); |
10687 |
++ if (IS_ERR(page)) { |
10688 |
++ erofs_err(sb, "failed to get inode payload page (nid: %llu), err %ld", |
10689 |
++ vi->nid, PTR_ERR(page)); |
10690 |
++ kfree(copied); |
10691 |
++ return page; |
10692 |
++ } |
10693 |
++ *ofs = vi->inode_isize - gotten; |
10694 |
++ memcpy((u8 *)copied + gotten, page_address(page), *ofs); |
10695 |
++ die = copied; |
10696 |
++ } |
10697 |
+ vi->xattr_isize = erofs_xattr_ibody_size(die->i_xattr_icount); |
10698 |
+ |
10699 |
+ inode->i_mode = le16_to_cpu(die->i_mode); |
10700 |
+@@ -69,9 +118,12 @@ static int erofs_read_inode(struct inode *inode, void *data) |
10701 |
+ /* total blocks for compressed files */ |
10702 |
+ if (erofs_inode_is_data_compressed(vi->datalayout)) |
10703 |
+ nblks = le32_to_cpu(die->i_u.compressed_blocks); |
10704 |
++ |
10705 |
++ kfree(copied); |
10706 |
+ break; |
10707 |
+ case EROFS_INODE_LAYOUT_COMPACT: |
10708 |
+ vi->inode_isize = sizeof(struct erofs_inode_compact); |
10709 |
++ *ofs += vi->inode_isize; |
10710 |
+ vi->xattr_isize = erofs_xattr_ibody_size(dic->i_xattr_icount); |
10711 |
+ |
10712 |
+ inode->i_mode = le16_to_cpu(dic->i_mode); |
10713 |
+@@ -111,8 +163,8 @@ static int erofs_read_inode(struct inode *inode, void *data) |
10714 |
+ erofs_err(inode->i_sb, |
10715 |
+ "unsupported on-disk inode version %u of nid %llu", |
10716 |
+ erofs_inode_version(ifmt), vi->nid); |
10717 |
+- DBG_BUGON(1); |
10718 |
+- return -EOPNOTSUPP; |
10719 |
++ err = -EOPNOTSUPP; |
10720 |
++ goto err_out; |
10721 |
+ } |
10722 |
+ |
10723 |
+ if (!nblks) |
10724 |
+@@ -120,13 +172,18 @@ static int erofs_read_inode(struct inode *inode, void *data) |
10725 |
+ inode->i_blocks = roundup(inode->i_size, EROFS_BLKSIZ) >> 9; |
10726 |
+ else |
10727 |
+ inode->i_blocks = nblks << LOG_SECTORS_PER_BLOCK; |
10728 |
+- return 0; |
10729 |
++ return page; |
10730 |
+ |
10731 |
+ bogusimode: |
10732 |
+ erofs_err(inode->i_sb, "bogus i_mode (%o) @ nid %llu", |
10733 |
+ inode->i_mode, vi->nid); |
10734 |
++ err = -EFSCORRUPTED; |
10735 |
++err_out: |
10736 |
+ DBG_BUGON(1); |
10737 |
+- return -EFSCORRUPTED; |
10738 |
++ kfree(copied); |
10739 |
++ unlock_page(page); |
10740 |
++ put_page(page); |
10741 |
++ return ERR_PTR(err); |
10742 |
+ } |
10743 |
+ |
10744 |
+ static int erofs_fill_symlink(struct inode *inode, void *data, |
10745 |
+@@ -146,7 +203,7 @@ static int erofs_fill_symlink(struct inode *inode, void *data, |
10746 |
+ if (!lnk) |
10747 |
+ return -ENOMEM; |
10748 |
+ |
10749 |
+- m_pofs += vi->inode_isize + vi->xattr_isize; |
10750 |
++ m_pofs += vi->xattr_isize; |
10751 |
+ /* inline symlink data shouldn't cross page boundary as well */ |
10752 |
+ if (m_pofs + inode->i_size > PAGE_SIZE) { |
10753 |
+ kfree(lnk); |
10754 |
+@@ -167,37 +224,17 @@ static int erofs_fill_symlink(struct inode *inode, void *data, |
10755 |
+ |
10756 |
+ static int erofs_fill_inode(struct inode *inode, int isdir) |
10757 |
+ { |
10758 |
+- struct super_block *sb = inode->i_sb; |
10759 |
+ struct erofs_inode *vi = EROFS_I(inode); |
10760 |
+ struct page *page; |
10761 |
+- void *data; |
10762 |
+- int err; |
10763 |
+- erofs_blk_t blkaddr; |
10764 |
+ unsigned int ofs; |
10765 |
+- erofs_off_t inode_loc; |
10766 |
++ int err = 0; |
10767 |
+ |
10768 |
+ trace_erofs_fill_inode(inode, isdir); |
10769 |
+- inode_loc = iloc(EROFS_SB(sb), vi->nid); |
10770 |
+- blkaddr = erofs_blknr(inode_loc); |
10771 |
+- ofs = erofs_blkoff(inode_loc); |
10772 |
+- |
10773 |
+- erofs_dbg("%s, reading inode nid %llu at %u of blkaddr %u", |
10774 |
+- __func__, vi->nid, ofs, blkaddr); |
10775 |
+ |
10776 |
+- page = erofs_get_meta_page(sb, blkaddr); |
10777 |
+- |
10778 |
+- if (IS_ERR(page)) { |
10779 |
+- erofs_err(sb, "failed to get inode (nid: %llu) page, err %ld", |
10780 |
+- vi->nid, PTR_ERR(page)); |
10781 |
++ /* read inode base data from disk */ |
10782 |
++ page = erofs_read_inode(inode, &ofs); |
10783 |
++ if (IS_ERR(page)) |
10784 |
+ return PTR_ERR(page); |
10785 |
+- } |
10786 |
+- |
10787 |
+- DBG_BUGON(!PageUptodate(page)); |
10788 |
+- data = page_address(page); |
10789 |
+- |
10790 |
+- err = erofs_read_inode(inode, data + ofs); |
10791 |
+- if (err) |
10792 |
+- goto out_unlock; |
10793 |
+ |
10794 |
+ /* setup the new inode */ |
10795 |
+ switch (inode->i_mode & S_IFMT) { |
10796 |
+@@ -210,7 +247,7 @@ static int erofs_fill_inode(struct inode *inode, int isdir) |
10797 |
+ inode->i_fop = &erofs_dir_fops; |
10798 |
+ break; |
10799 |
+ case S_IFLNK: |
10800 |
+- err = erofs_fill_symlink(inode, data, ofs); |
10801 |
++ err = erofs_fill_symlink(inode, page_address(page), ofs); |
10802 |
+ if (err) |
10803 |
+ goto out_unlock; |
10804 |
+ inode_nohighmem(inode); |
10805 |
+diff --git a/fs/io_uring.c b/fs/io_uring.c |
10806 |
+index fb9dc865c9ea..b33d4a97a877 100644 |
10807 |
+--- a/fs/io_uring.c |
10808 |
++++ b/fs/io_uring.c |
10809 |
+@@ -645,12 +645,12 @@ struct io_kiocb { |
10810 |
+ * restore the work, if needed. |
10811 |
+ */ |
10812 |
+ struct { |
10813 |
+- struct callback_head task_work; |
10814 |
+ struct hlist_node hash_node; |
10815 |
+ struct async_poll *apoll; |
10816 |
+ }; |
10817 |
+ struct io_wq_work work; |
10818 |
+ }; |
10819 |
++ struct callback_head task_work; |
10820 |
+ }; |
10821 |
+ |
10822 |
+ #define IO_PLUG_THRESHOLD 2 |
10823 |
+@@ -1484,12 +1484,9 @@ static void io_req_link_next(struct io_kiocb *req, struct io_kiocb **nxtptr) |
10824 |
+ /* |
10825 |
+ * Called if REQ_F_LINK_HEAD is set, and we fail the head request |
10826 |
+ */ |
10827 |
+-static void io_fail_links(struct io_kiocb *req) |
10828 |
++static void __io_fail_links(struct io_kiocb *req) |
10829 |
+ { |
10830 |
+ struct io_ring_ctx *ctx = req->ctx; |
10831 |
+- unsigned long flags; |
10832 |
+- |
10833 |
+- spin_lock_irqsave(&ctx->completion_lock, flags); |
10834 |
+ |
10835 |
+ while (!list_empty(&req->link_list)) { |
10836 |
+ struct io_kiocb *link = list_first_entry(&req->link_list, |
10837 |
+@@ -1503,13 +1500,29 @@ static void io_fail_links(struct io_kiocb *req) |
10838 |
+ io_link_cancel_timeout(link); |
10839 |
+ } else { |
10840 |
+ io_cqring_fill_event(link, -ECANCELED); |
10841 |
++ link->flags |= REQ_F_COMP_LOCKED; |
10842 |
+ __io_double_put_req(link); |
10843 |
+ } |
10844 |
+ req->flags &= ~REQ_F_LINK_TIMEOUT; |
10845 |
+ } |
10846 |
+ |
10847 |
+ io_commit_cqring(ctx); |
10848 |
+- spin_unlock_irqrestore(&ctx->completion_lock, flags); |
10849 |
++} |
10850 |
++ |
10851 |
++static void io_fail_links(struct io_kiocb *req) |
10852 |
++{ |
10853 |
++ struct io_ring_ctx *ctx = req->ctx; |
10854 |
++ |
10855 |
++ if (!(req->flags & REQ_F_COMP_LOCKED)) { |
10856 |
++ unsigned long flags; |
10857 |
++ |
10858 |
++ spin_lock_irqsave(&ctx->completion_lock, flags); |
10859 |
++ __io_fail_links(req); |
10860 |
++ spin_unlock_irqrestore(&ctx->completion_lock, flags); |
10861 |
++ } else { |
10862 |
++ __io_fail_links(req); |
10863 |
++ } |
10864 |
++ |
10865 |
+ io_cqring_ev_posted(ctx); |
10866 |
+ } |
10867 |
+ |
10868 |
+@@ -1692,6 +1705,17 @@ static int io_put_kbuf(struct io_kiocb *req) |
10869 |
+ return cflags; |
10870 |
+ } |
10871 |
+ |
10872 |
++static inline bool io_run_task_work(void) |
10873 |
++{ |
10874 |
++ if (current->task_works) { |
10875 |
++ __set_current_state(TASK_RUNNING); |
10876 |
++ task_work_run(); |
10877 |
++ return true; |
10878 |
++ } |
10879 |
++ |
10880 |
++ return false; |
10881 |
++} |
10882 |
++ |
10883 |
+ static void io_iopoll_queue(struct list_head *again) |
10884 |
+ { |
10885 |
+ struct io_kiocb *req; |
10886 |
+@@ -1881,6 +1905,7 @@ static int io_iopoll_check(struct io_ring_ctx *ctx, unsigned *nr_events, |
10887 |
+ */ |
10888 |
+ if (!(++iters & 7)) { |
10889 |
+ mutex_unlock(&ctx->uring_lock); |
10890 |
++ io_run_task_work(); |
10891 |
+ mutex_lock(&ctx->uring_lock); |
10892 |
+ } |
10893 |
+ |
10894 |
+@@ -2602,8 +2627,10 @@ static int io_read(struct io_kiocb *req, bool force_nonblock) |
10895 |
+ |
10896 |
+ if (req->file->f_op->read_iter) |
10897 |
+ ret2 = call_read_iter(req->file, kiocb, &iter); |
10898 |
+- else |
10899 |
++ else if (req->file->f_op->read) |
10900 |
+ ret2 = loop_rw_iter(READ, req->file, kiocb, &iter); |
10901 |
++ else |
10902 |
++ ret2 = -EINVAL; |
10903 |
+ |
10904 |
+ /* Catch -EAGAIN return for forced non-blocking submission */ |
10905 |
+ if (!force_nonblock || ret2 != -EAGAIN) { |
10906 |
+@@ -2717,8 +2744,10 @@ static int io_write(struct io_kiocb *req, bool force_nonblock) |
10907 |
+ |
10908 |
+ if (req->file->f_op->write_iter) |
10909 |
+ ret2 = call_write_iter(req->file, kiocb, &iter); |
10910 |
+- else |
10911 |
++ else if (req->file->f_op->write) |
10912 |
+ ret2 = loop_rw_iter(WRITE, req->file, kiocb, &iter); |
10913 |
++ else |
10914 |
++ ret2 = -EINVAL; |
10915 |
+ |
10916 |
+ if (!force_nonblock) |
10917 |
+ current->signal->rlim[RLIMIT_FSIZE].rlim_cur = RLIM_INFINITY; |
10918 |
+@@ -4149,22 +4178,22 @@ static int io_req_task_work_add(struct io_kiocb *req, struct callback_head *cb) |
10919 |
+ { |
10920 |
+ struct task_struct *tsk = req->task; |
10921 |
+ struct io_ring_ctx *ctx = req->ctx; |
10922 |
+- int ret, notify = TWA_RESUME; |
10923 |
++ int ret, notify; |
10924 |
+ |
10925 |
+ /* |
10926 |
+- * SQPOLL kernel thread doesn't need notification, just a wakeup. |
10927 |
+- * If we're not using an eventfd, then TWA_RESUME is always fine, |
10928 |
+- * as we won't have dependencies between request completions for |
10929 |
+- * other kernel wait conditions. |
10930 |
++ * SQPOLL kernel thread doesn't need notification, just a wakeup. For |
10931 |
++ * all other cases, use TWA_SIGNAL unconditionally to ensure we're |
10932 |
++ * processing task_work. There's no reliable way to tell if TWA_RESUME |
10933 |
++ * will do the job. |
10934 |
+ */ |
10935 |
+- if (ctx->flags & IORING_SETUP_SQPOLL) |
10936 |
+- notify = 0; |
10937 |
+- else if (ctx->cq_ev_fd) |
10938 |
++ notify = 0; |
10939 |
++ if (!(ctx->flags & IORING_SETUP_SQPOLL)) |
10940 |
+ notify = TWA_SIGNAL; |
10941 |
+ |
10942 |
+ ret = task_work_add(tsk, cb, notify); |
10943 |
+ if (!ret) |
10944 |
+ wake_up_process(tsk); |
10945 |
++ |
10946 |
+ return ret; |
10947 |
+ } |
10948 |
+ |
10949 |
+@@ -4185,6 +4214,8 @@ static int __io_async_wake(struct io_kiocb *req, struct io_poll_iocb *poll, |
10950 |
+ tsk = req->task; |
10951 |
+ req->result = mask; |
10952 |
+ init_task_work(&req->task_work, func); |
10953 |
++ percpu_ref_get(&req->ctx->refs); |
10954 |
++ |
10955 |
+ /* |
10956 |
+ * If this fails, then the task is exiting. When a task exits, the |
10957 |
+ * work gets canceled, so just cancel this request as well instead |
10958 |
+@@ -4221,9 +4252,24 @@ static bool io_poll_rewait(struct io_kiocb *req, struct io_poll_iocb *poll) |
10959 |
+ return false; |
10960 |
+ } |
10961 |
+ |
10962 |
+-static void io_poll_remove_double(struct io_kiocb *req, void *data) |
10963 |
++static struct io_poll_iocb *io_poll_get_double(struct io_kiocb *req) |
10964 |
++{ |
10965 |
++ /* pure poll stashes this in ->io, poll driven retry elsewhere */ |
10966 |
++ if (req->opcode == IORING_OP_POLL_ADD) |
10967 |
++ return (struct io_poll_iocb *) req->io; |
10968 |
++ return req->apoll->double_poll; |
10969 |
++} |
10970 |
++ |
10971 |
++static struct io_poll_iocb *io_poll_get_single(struct io_kiocb *req) |
10972 |
+ { |
10973 |
+- struct io_poll_iocb *poll = data; |
10974 |
++ if (req->opcode == IORING_OP_POLL_ADD) |
10975 |
++ return &req->poll; |
10976 |
++ return &req->apoll->poll; |
10977 |
++} |
10978 |
++ |
10979 |
++static void io_poll_remove_double(struct io_kiocb *req) |
10980 |
++{ |
10981 |
++ struct io_poll_iocb *poll = io_poll_get_double(req); |
10982 |
+ |
10983 |
+ lockdep_assert_held(&req->ctx->completion_lock); |
10984 |
+ |
10985 |
+@@ -4243,7 +4289,7 @@ static void io_poll_complete(struct io_kiocb *req, __poll_t mask, int error) |
10986 |
+ { |
10987 |
+ struct io_ring_ctx *ctx = req->ctx; |
10988 |
+ |
10989 |
+- io_poll_remove_double(req, req->io); |
10990 |
++ io_poll_remove_double(req); |
10991 |
+ req->poll.done = true; |
10992 |
+ io_cqring_fill_event(req, error ? error : mangle_poll(mask)); |
10993 |
+ io_commit_cqring(ctx); |
10994 |
+@@ -4269,6 +4315,7 @@ static void io_poll_task_handler(struct io_kiocb *req, struct io_kiocb **nxt) |
10995 |
+ static void io_poll_task_func(struct callback_head *cb) |
10996 |
+ { |
10997 |
+ struct io_kiocb *req = container_of(cb, struct io_kiocb, task_work); |
10998 |
++ struct io_ring_ctx *ctx = req->ctx; |
10999 |
+ struct io_kiocb *nxt = NULL; |
11000 |
+ |
11001 |
+ io_poll_task_handler(req, &nxt); |
11002 |
+@@ -4279,13 +4326,14 @@ static void io_poll_task_func(struct callback_head *cb) |
11003 |
+ __io_queue_sqe(nxt, NULL); |
11004 |
+ mutex_unlock(&ctx->uring_lock); |
11005 |
+ } |
11006 |
++ percpu_ref_put(&ctx->refs); |
11007 |
+ } |
11008 |
+ |
11009 |
+ static int io_poll_double_wake(struct wait_queue_entry *wait, unsigned mode, |
11010 |
+ int sync, void *key) |
11011 |
+ { |
11012 |
+ struct io_kiocb *req = wait->private; |
11013 |
+- struct io_poll_iocb *poll = req->apoll->double_poll; |
11014 |
++ struct io_poll_iocb *poll = io_poll_get_single(req); |
11015 |
+ __poll_t mask = key_to_poll(key); |
11016 |
+ |
11017 |
+ /* for instances that support it check for an event match first: */ |
11018 |
+@@ -4299,6 +4347,8 @@ static int io_poll_double_wake(struct wait_queue_entry *wait, unsigned mode, |
11019 |
+ done = list_empty(&poll->wait.entry); |
11020 |
+ if (!done) |
11021 |
+ list_del_init(&poll->wait.entry); |
11022 |
++ /* make sure double remove sees this as being gone */ |
11023 |
++ wait->private = NULL; |
11024 |
+ spin_unlock(&poll->head->lock); |
11025 |
+ if (!done) |
11026 |
+ __io_async_wake(req, poll, mask, io_poll_task_func); |
11027 |
+@@ -4393,6 +4443,7 @@ static void io_async_task_func(struct callback_head *cb) |
11028 |
+ |
11029 |
+ if (io_poll_rewait(req, &apoll->poll)) { |
11030 |
+ spin_unlock_irq(&ctx->completion_lock); |
11031 |
++ percpu_ref_put(&ctx->refs); |
11032 |
+ return; |
11033 |
+ } |
11034 |
+ |
11035 |
+@@ -4420,7 +4471,6 @@ end_req: |
11036 |
+ return; |
11037 |
+ } |
11038 |
+ |
11039 |
+- __set_current_state(TASK_RUNNING); |
11040 |
+ if (io_sq_thread_acquire_mm(ctx, req)) { |
11041 |
+ io_cqring_add_event(req, -EFAULT); |
11042 |
+ goto end_req; |
11043 |
+@@ -4431,6 +4481,7 @@ end_req: |
11044 |
+ |
11045 |
+ kfree(apoll->double_poll); |
11046 |
+ kfree(apoll); |
11047 |
++ percpu_ref_put(&ctx->refs); |
11048 |
+ } |
11049 |
+ |
11050 |
+ static int io_async_wake(struct wait_queue_entry *wait, unsigned mode, int sync, |
11051 |
+@@ -4533,8 +4584,8 @@ static bool io_arm_poll_handler(struct io_kiocb *req) |
11052 |
+ |
11053 |
+ ret = __io_arm_poll_handler(req, &apoll->poll, &ipt, mask, |
11054 |
+ io_async_wake); |
11055 |
+- if (ret) { |
11056 |
+- io_poll_remove_double(req, apoll->double_poll); |
11057 |
++ if (ret || ipt.error) { |
11058 |
++ io_poll_remove_double(req); |
11059 |
+ spin_unlock_irq(&ctx->completion_lock); |
11060 |
+ memcpy(&req->work, &apoll->work, sizeof(req->work)); |
11061 |
+ kfree(apoll->double_poll); |
11062 |
+@@ -4567,14 +4618,13 @@ static bool io_poll_remove_one(struct io_kiocb *req) |
11063 |
+ { |
11064 |
+ bool do_complete; |
11065 |
+ |
11066 |
++ io_poll_remove_double(req); |
11067 |
++ |
11068 |
+ if (req->opcode == IORING_OP_POLL_ADD) { |
11069 |
+- io_poll_remove_double(req, req->io); |
11070 |
+ do_complete = __io_poll_remove_one(req, &req->poll); |
11071 |
+ } else { |
11072 |
+ struct async_poll *apoll = req->apoll; |
11073 |
+ |
11074 |
+- io_poll_remove_double(req, apoll->double_poll); |
11075 |
+- |
11076 |
+ /* non-poll requests have submit ref still */ |
11077 |
+ do_complete = __io_poll_remove_one(req, &apoll->poll); |
11078 |
+ if (do_complete) { |
11079 |
+@@ -4594,6 +4644,7 @@ static bool io_poll_remove_one(struct io_kiocb *req) |
11080 |
+ io_cqring_fill_event(req, -ECANCELED); |
11081 |
+ io_commit_cqring(req->ctx); |
11082 |
+ req->flags |= REQ_F_COMP_LOCKED; |
11083 |
++ req_set_fail_links(req); |
11084 |
+ io_put_req(req); |
11085 |
+ } |
11086 |
+ |
11087 |
+@@ -4776,6 +4827,23 @@ static enum hrtimer_restart io_timeout_fn(struct hrtimer *timer) |
11088 |
+ return HRTIMER_NORESTART; |
11089 |
+ } |
11090 |
+ |
11091 |
++static int __io_timeout_cancel(struct io_kiocb *req) |
11092 |
++{ |
11093 |
++ int ret; |
11094 |
++ |
11095 |
++ list_del_init(&req->list); |
11096 |
++ |
11097 |
++ ret = hrtimer_try_to_cancel(&req->io->timeout.timer); |
11098 |
++ if (ret == -1) |
11099 |
++ return -EALREADY; |
11100 |
++ |
11101 |
++ req_set_fail_links(req); |
11102 |
++ req->flags |= REQ_F_COMP_LOCKED; |
11103 |
++ io_cqring_fill_event(req, -ECANCELED); |
11104 |
++ io_put_req(req); |
11105 |
++ return 0; |
11106 |
++} |
11107 |
++ |
11108 |
+ static int io_timeout_cancel(struct io_ring_ctx *ctx, __u64 user_data) |
11109 |
+ { |
11110 |
+ struct io_kiocb *req; |
11111 |
+@@ -4783,7 +4851,6 @@ static int io_timeout_cancel(struct io_ring_ctx *ctx, __u64 user_data) |
11112 |
+ |
11113 |
+ list_for_each_entry(req, &ctx->timeout_list, list) { |
11114 |
+ if (user_data == req->user_data) { |
11115 |
+- list_del_init(&req->list); |
11116 |
+ ret = 0; |
11117 |
+ break; |
11118 |
+ } |
11119 |
+@@ -4792,14 +4859,7 @@ static int io_timeout_cancel(struct io_ring_ctx *ctx, __u64 user_data) |
11120 |
+ if (ret == -ENOENT) |
11121 |
+ return ret; |
11122 |
+ |
11123 |
+- ret = hrtimer_try_to_cancel(&req->io->timeout.timer); |
11124 |
+- if (ret == -1) |
11125 |
+- return -EALREADY; |
11126 |
+- |
11127 |
+- req_set_fail_links(req); |
11128 |
+- io_cqring_fill_event(req, -ECANCELED); |
11129 |
+- io_put_req(req); |
11130 |
+- return 0; |
11131 |
++ return __io_timeout_cancel(req); |
11132 |
+ } |
11133 |
+ |
11134 |
+ static int io_timeout_remove_prep(struct io_kiocb *req, |
11135 |
+@@ -6152,8 +6212,7 @@ static int io_sq_thread(void *data) |
11136 |
+ if (!list_empty(&ctx->poll_list) || need_resched() || |
11137 |
+ (!time_after(jiffies, timeout) && ret != -EBUSY && |
11138 |
+ !percpu_ref_is_dying(&ctx->refs))) { |
11139 |
+- if (current->task_works) |
11140 |
+- task_work_run(); |
11141 |
++ io_run_task_work(); |
11142 |
+ cond_resched(); |
11143 |
+ continue; |
11144 |
+ } |
11145 |
+@@ -6185,8 +6244,7 @@ static int io_sq_thread(void *data) |
11146 |
+ finish_wait(&ctx->sqo_wait, &wait); |
11147 |
+ break; |
11148 |
+ } |
11149 |
+- if (current->task_works) { |
11150 |
+- task_work_run(); |
11151 |
++ if (io_run_task_work()) { |
11152 |
+ finish_wait(&ctx->sqo_wait, &wait); |
11153 |
+ continue; |
11154 |
+ } |
11155 |
+@@ -6210,8 +6268,7 @@ static int io_sq_thread(void *data) |
11156 |
+ timeout = jiffies + ctx->sq_thread_idle; |
11157 |
+ } |
11158 |
+ |
11159 |
+- if (current->task_works) |
11160 |
+- task_work_run(); |
11161 |
++ io_run_task_work(); |
11162 |
+ |
11163 |
+ set_fs(old_fs); |
11164 |
+ io_sq_thread_drop_mm(ctx); |
11165 |
+@@ -6277,9 +6334,8 @@ static int io_cqring_wait(struct io_ring_ctx *ctx, int min_events, |
11166 |
+ do { |
11167 |
+ if (io_cqring_events(ctx, false) >= min_events) |
11168 |
+ return 0; |
11169 |
+- if (!current->task_works) |
11170 |
++ if (!io_run_task_work()) |
11171 |
+ break; |
11172 |
+- task_work_run(); |
11173 |
+ } while (1); |
11174 |
+ |
11175 |
+ if (sig) { |
11176 |
+@@ -6301,8 +6357,8 @@ static int io_cqring_wait(struct io_ring_ctx *ctx, int min_events, |
11177 |
+ prepare_to_wait_exclusive(&ctx->wait, &iowq.wq, |
11178 |
+ TASK_INTERRUPTIBLE); |
11179 |
+ /* make sure we run task_work before checking for signals */ |
11180 |
+- if (current->task_works) |
11181 |
+- task_work_run(); |
11182 |
++ if (io_run_task_work()) |
11183 |
++ continue; |
11184 |
+ if (signal_pending(current)) { |
11185 |
+ if (current->jobctl & JOBCTL_TASK_WORK) { |
11186 |
+ spin_lock_irq(¤t->sighand->siglock); |
11187 |
+@@ -7132,6 +7188,9 @@ static unsigned long rings_size(unsigned sq_entries, unsigned cq_entries, |
11188 |
+ return SIZE_MAX; |
11189 |
+ #endif |
11190 |
+ |
11191 |
++ if (sq_offset) |
11192 |
++ *sq_offset = off; |
11193 |
++ |
11194 |
+ sq_array_size = array_size(sizeof(u32), sq_entries); |
11195 |
+ if (sq_array_size == SIZE_MAX) |
11196 |
+ return SIZE_MAX; |
11197 |
+@@ -7139,9 +7198,6 @@ static unsigned long rings_size(unsigned sq_entries, unsigned cq_entries, |
11198 |
+ if (check_add_overflow(off, sq_array_size, &off)) |
11199 |
+ return SIZE_MAX; |
11200 |
+ |
11201 |
+- if (sq_offset) |
11202 |
+- *sq_offset = off; |
11203 |
+- |
11204 |
+ return off; |
11205 |
+ } |
11206 |
+ |
11207 |
+@@ -7538,6 +7594,71 @@ static int io_uring_release(struct inode *inode, struct file *file) |
11208 |
+ return 0; |
11209 |
+ } |
11210 |
+ |
11211 |
++/* |
11212 |
++ * Returns true if 'preq' is the link parent of 'req' |
11213 |
++ */ |
11214 |
++static bool io_match_link(struct io_kiocb *preq, struct io_kiocb *req) |
11215 |
++{ |
11216 |
++ struct io_kiocb *link; |
11217 |
++ |
11218 |
++ if (!(preq->flags & REQ_F_LINK_HEAD)) |
11219 |
++ return false; |
11220 |
++ |
11221 |
++ list_for_each_entry(link, &preq->link_list, link_list) { |
11222 |
++ if (link == req) |
11223 |
++ return true; |
11224 |
++ } |
11225 |
++ |
11226 |
++ return false; |
11227 |
++} |
11228 |
++ |
11229 |
++/* |
11230 |
++ * We're looking to cancel 'req' because it's holding on to our files, but |
11231 |
++ * 'req' could be a link to another request. See if it is, and cancel that |
11232 |
++ * parent request if so. |
11233 |
++ */ |
11234 |
++static bool io_poll_remove_link(struct io_ring_ctx *ctx, struct io_kiocb *req) |
11235 |
++{ |
11236 |
++ struct hlist_node *tmp; |
11237 |
++ struct io_kiocb *preq; |
11238 |
++ bool found = false; |
11239 |
++ int i; |
11240 |
++ |
11241 |
++ spin_lock_irq(&ctx->completion_lock); |
11242 |
++ for (i = 0; i < (1U << ctx->cancel_hash_bits); i++) { |
11243 |
++ struct hlist_head *list; |
11244 |
++ |
11245 |
++ list = &ctx->cancel_hash[i]; |
11246 |
++ hlist_for_each_entry_safe(preq, tmp, list, hash_node) { |
11247 |
++ found = io_match_link(preq, req); |
11248 |
++ if (found) { |
11249 |
++ io_poll_remove_one(preq); |
11250 |
++ break; |
11251 |
++ } |
11252 |
++ } |
11253 |
++ } |
11254 |
++ spin_unlock_irq(&ctx->completion_lock); |
11255 |
++ return found; |
11256 |
++} |
11257 |
++ |
11258 |
++static bool io_timeout_remove_link(struct io_ring_ctx *ctx, |
11259 |
++ struct io_kiocb *req) |
11260 |
++{ |
11261 |
++ struct io_kiocb *preq; |
11262 |
++ bool found = false; |
11263 |
++ |
11264 |
++ spin_lock_irq(&ctx->completion_lock); |
11265 |
++ list_for_each_entry(preq, &ctx->timeout_list, list) { |
11266 |
++ found = io_match_link(preq, req); |
11267 |
++ if (found) { |
11268 |
++ __io_timeout_cancel(preq); |
11269 |
++ break; |
11270 |
++ } |
11271 |
++ } |
11272 |
++ spin_unlock_irq(&ctx->completion_lock); |
11273 |
++ return found; |
11274 |
++} |
11275 |
++ |
11276 |
+ static void io_uring_cancel_files(struct io_ring_ctx *ctx, |
11277 |
+ struct files_struct *files) |
11278 |
+ { |
11279 |
+@@ -7572,10 +7693,10 @@ static void io_uring_cancel_files(struct io_ring_ctx *ctx, |
11280 |
+ clear_bit(0, &ctx->sq_check_overflow); |
11281 |
+ clear_bit(0, &ctx->cq_check_overflow); |
11282 |
+ } |
11283 |
+- spin_unlock_irq(&ctx->completion_lock); |
11284 |
+- |
11285 |
+ WRITE_ONCE(ctx->rings->cq_overflow, |
11286 |
+ atomic_inc_return(&ctx->cached_cq_overflow)); |
11287 |
++ io_commit_cqring(ctx); |
11288 |
++ spin_unlock_irq(&ctx->completion_lock); |
11289 |
+ |
11290 |
+ /* |
11291 |
+ * Put inflight ref and overflow ref. If that's |
11292 |
+@@ -7588,6 +7709,9 @@ static void io_uring_cancel_files(struct io_ring_ctx *ctx, |
11293 |
+ } |
11294 |
+ } else { |
11295 |
+ io_wq_cancel_work(ctx->io_wq, &cancel_req->work); |
11296 |
++ /* could be a link, check and remove if it is */ |
11297 |
++ if (!io_poll_remove_link(ctx, cancel_req)) |
11298 |
++ io_timeout_remove_link(ctx, cancel_req); |
11299 |
+ io_put_req(cancel_req); |
11300 |
+ } |
11301 |
+ |
11302 |
+@@ -7690,8 +7814,7 @@ SYSCALL_DEFINE6(io_uring_enter, unsigned int, fd, u32, to_submit, |
11303 |
+ int submitted = 0; |
11304 |
+ struct fd f; |
11305 |
+ |
11306 |
+- if (current->task_works) |
11307 |
+- task_work_run(); |
11308 |
++ io_run_task_work(); |
11309 |
+ |
11310 |
+ if (flags & ~(IORING_ENTER_GETEVENTS | IORING_ENTER_SQ_WAKEUP)) |
11311 |
+ return -EINVAL; |
11312 |
+@@ -7863,6 +7986,10 @@ static int io_allocate_scq_urings(struct io_ring_ctx *ctx, |
11313 |
+ struct io_rings *rings; |
11314 |
+ size_t size, sq_array_offset; |
11315 |
+ |
11316 |
++ /* make sure these are sane, as we already accounted them */ |
11317 |
++ ctx->sq_entries = p->sq_entries; |
11318 |
++ ctx->cq_entries = p->cq_entries; |
11319 |
++ |
11320 |
+ size = rings_size(p->sq_entries, p->cq_entries, &sq_array_offset); |
11321 |
+ if (size == SIZE_MAX) |
11322 |
+ return -EOVERFLOW; |
11323 |
+@@ -7879,8 +8006,6 @@ static int io_allocate_scq_urings(struct io_ring_ctx *ctx, |
11324 |
+ rings->cq_ring_entries = p->cq_entries; |
11325 |
+ ctx->sq_mask = rings->sq_ring_mask; |
11326 |
+ ctx->cq_mask = rings->cq_ring_mask; |
11327 |
+- ctx->sq_entries = rings->sq_ring_entries; |
11328 |
+- ctx->cq_entries = rings->cq_ring_entries; |
11329 |
+ |
11330 |
+ size = array_size(sizeof(struct io_uring_sqe), p->sq_entries); |
11331 |
+ if (size == SIZE_MAX) { |
11332 |
+diff --git a/fs/kernfs/file.c b/fs/kernfs/file.c |
11333 |
+index 34366db3620d..2a1879a6e795 100644 |
11334 |
+--- a/fs/kernfs/file.c |
11335 |
++++ b/fs/kernfs/file.c |
11336 |
+@@ -912,7 +912,7 @@ repeat: |
11337 |
+ } |
11338 |
+ |
11339 |
+ fsnotify(inode, FS_MODIFY, inode, FSNOTIFY_EVENT_INODE, |
11340 |
+- &name, 0); |
11341 |
++ NULL, 0); |
11342 |
+ iput(inode); |
11343 |
+ } |
11344 |
+ |
11345 |
+diff --git a/fs/minix/inode.c b/fs/minix/inode.c |
11346 |
+index 7cb5fd38eb14..0dd929346f3f 100644 |
11347 |
+--- a/fs/minix/inode.c |
11348 |
++++ b/fs/minix/inode.c |
11349 |
+@@ -150,6 +150,23 @@ static int minix_remount (struct super_block * sb, int * flags, char * data) |
11350 |
+ return 0; |
11351 |
+ } |
11352 |
+ |
11353 |
++static bool minix_check_superblock(struct minix_sb_info *sbi) |
11354 |
++{ |
11355 |
++ if (sbi->s_imap_blocks == 0 || sbi->s_zmap_blocks == 0) |
11356 |
++ return false; |
11357 |
++ |
11358 |
++ /* |
11359 |
++ * s_max_size must not exceed the block mapping limitation. This check |
11360 |
++ * is only needed for V1 filesystems, since V2/V3 support an extra level |
11361 |
++ * of indirect blocks which places the limit well above U32_MAX. |
11362 |
++ */ |
11363 |
++ if (sbi->s_version == MINIX_V1 && |
11364 |
++ sbi->s_max_size > (7 + 512 + 512*512) * BLOCK_SIZE) |
11365 |
++ return false; |
11366 |
++ |
11367 |
++ return true; |
11368 |
++} |
11369 |
++ |
11370 |
+ static int minix_fill_super(struct super_block *s, void *data, int silent) |
11371 |
+ { |
11372 |
+ struct buffer_head *bh; |
11373 |
+@@ -228,11 +245,12 @@ static int minix_fill_super(struct super_block *s, void *data, int silent) |
11374 |
+ } else |
11375 |
+ goto out_no_fs; |
11376 |
+ |
11377 |
++ if (!minix_check_superblock(sbi)) |
11378 |
++ goto out_illegal_sb; |
11379 |
++ |
11380 |
+ /* |
11381 |
+ * Allocate the buffer map to keep the superblock small. |
11382 |
+ */ |
11383 |
+- if (sbi->s_imap_blocks == 0 || sbi->s_zmap_blocks == 0) |
11384 |
+- goto out_illegal_sb; |
11385 |
+ i = (sbi->s_imap_blocks + sbi->s_zmap_blocks) * sizeof(bh); |
11386 |
+ map = kzalloc(i, GFP_KERNEL); |
11387 |
+ if (!map) |
11388 |
+@@ -468,6 +486,13 @@ static struct inode *V1_minix_iget(struct inode *inode) |
11389 |
+ iget_failed(inode); |
11390 |
+ return ERR_PTR(-EIO); |
11391 |
+ } |
11392 |
++ if (raw_inode->i_nlinks == 0) { |
11393 |
++ printk("MINIX-fs: deleted inode referenced: %lu\n", |
11394 |
++ inode->i_ino); |
11395 |
++ brelse(bh); |
11396 |
++ iget_failed(inode); |
11397 |
++ return ERR_PTR(-ESTALE); |
11398 |
++ } |
11399 |
+ inode->i_mode = raw_inode->i_mode; |
11400 |
+ i_uid_write(inode, raw_inode->i_uid); |
11401 |
+ i_gid_write(inode, raw_inode->i_gid); |
11402 |
+@@ -501,6 +526,13 @@ static struct inode *V2_minix_iget(struct inode *inode) |
11403 |
+ iget_failed(inode); |
11404 |
+ return ERR_PTR(-EIO); |
11405 |
+ } |
11406 |
++ if (raw_inode->i_nlinks == 0) { |
11407 |
++ printk("MINIX-fs: deleted inode referenced: %lu\n", |
11408 |
++ inode->i_ino); |
11409 |
++ brelse(bh); |
11410 |
++ iget_failed(inode); |
11411 |
++ return ERR_PTR(-ESTALE); |
11412 |
++ } |
11413 |
+ inode->i_mode = raw_inode->i_mode; |
11414 |
+ i_uid_write(inode, raw_inode->i_uid); |
11415 |
+ i_gid_write(inode, raw_inode->i_gid); |
11416 |
+diff --git a/fs/minix/itree_common.c b/fs/minix/itree_common.c |
11417 |
+index 043c3fdbc8e7..446148792f41 100644 |
11418 |
+--- a/fs/minix/itree_common.c |
11419 |
++++ b/fs/minix/itree_common.c |
11420 |
+@@ -75,6 +75,7 @@ static int alloc_branch(struct inode *inode, |
11421 |
+ int n = 0; |
11422 |
+ int i; |
11423 |
+ int parent = minix_new_block(inode); |
11424 |
++ int err = -ENOSPC; |
11425 |
+ |
11426 |
+ branch[0].key = cpu_to_block(parent); |
11427 |
+ if (parent) for (n = 1; n < num; n++) { |
11428 |
+@@ -85,6 +86,11 @@ static int alloc_branch(struct inode *inode, |
11429 |
+ break; |
11430 |
+ branch[n].key = cpu_to_block(nr); |
11431 |
+ bh = sb_getblk(inode->i_sb, parent); |
11432 |
++ if (!bh) { |
11433 |
++ minix_free_block(inode, nr); |
11434 |
++ err = -ENOMEM; |
11435 |
++ break; |
11436 |
++ } |
11437 |
+ lock_buffer(bh); |
11438 |
+ memset(bh->b_data, 0, bh->b_size); |
11439 |
+ branch[n].bh = bh; |
11440 |
+@@ -103,7 +109,7 @@ static int alloc_branch(struct inode *inode, |
11441 |
+ bforget(branch[i].bh); |
11442 |
+ for (i = 0; i < n; i++) |
11443 |
+ minix_free_block(inode, block_to_cpu(branch[i].key)); |
11444 |
+- return -ENOSPC; |
11445 |
++ return err; |
11446 |
+ } |
11447 |
+ |
11448 |
+ static inline int splice_branch(struct inode *inode, |
11449 |
+diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c |
11450 |
+index dd2e14f5875d..d61dac48dff5 100644 |
11451 |
+--- a/fs/nfs/pnfs.c |
11452 |
++++ b/fs/nfs/pnfs.c |
11453 |
+@@ -1226,31 +1226,27 @@ out: |
11454 |
+ return status; |
11455 |
+ } |
11456 |
+ |
11457 |
++static bool |
11458 |
++pnfs_layout_segments_returnable(struct pnfs_layout_hdr *lo, |
11459 |
++ enum pnfs_iomode iomode, |
11460 |
++ u32 seq) |
11461 |
++{ |
11462 |
++ struct pnfs_layout_range recall_range = { |
11463 |
++ .length = NFS4_MAX_UINT64, |
11464 |
++ .iomode = iomode, |
11465 |
++ }; |
11466 |
++ return pnfs_mark_matching_lsegs_return(lo, &lo->plh_return_segs, |
11467 |
++ &recall_range, seq) != -EBUSY; |
11468 |
++} |
11469 |
++ |
11470 |
+ /* Return true if layoutreturn is needed */ |
11471 |
+ static bool |
11472 |
+ pnfs_layout_need_return(struct pnfs_layout_hdr *lo) |
11473 |
+ { |
11474 |
+- struct pnfs_layout_segment *s; |
11475 |
+- enum pnfs_iomode iomode; |
11476 |
+- u32 seq; |
11477 |
+- |
11478 |
+ if (!test_bit(NFS_LAYOUT_RETURN_REQUESTED, &lo->plh_flags)) |
11479 |
+ return false; |
11480 |
+- |
11481 |
+- seq = lo->plh_return_seq; |
11482 |
+- iomode = lo->plh_return_iomode; |
11483 |
+- |
11484 |
+- /* Defer layoutreturn until all recalled lsegs are done */ |
11485 |
+- list_for_each_entry(s, &lo->plh_segs, pls_list) { |
11486 |
+- if (seq && pnfs_seqid_is_newer(s->pls_seq, seq)) |
11487 |
+- continue; |
11488 |
+- if (iomode != IOMODE_ANY && s->pls_range.iomode != iomode) |
11489 |
+- continue; |
11490 |
+- if (test_bit(NFS_LSEG_LAYOUTRETURN, &s->pls_flags)) |
11491 |
+- return false; |
11492 |
+- } |
11493 |
+- |
11494 |
+- return true; |
11495 |
++ return pnfs_layout_segments_returnable(lo, lo->plh_return_iomode, |
11496 |
++ lo->plh_return_seq); |
11497 |
+ } |
11498 |
+ |
11499 |
+ static void pnfs_layoutreturn_before_put_layout_hdr(struct pnfs_layout_hdr *lo) |
11500 |
+@@ -2392,16 +2388,6 @@ out_forget: |
11501 |
+ return ERR_PTR(-EAGAIN); |
11502 |
+ } |
11503 |
+ |
11504 |
+-static int |
11505 |
+-mark_lseg_invalid_or_return(struct pnfs_layout_segment *lseg, |
11506 |
+- struct list_head *tmp_list) |
11507 |
+-{ |
11508 |
+- if (!mark_lseg_invalid(lseg, tmp_list)) |
11509 |
+- return 0; |
11510 |
+- pnfs_cache_lseg_for_layoutreturn(lseg->pls_layout, lseg); |
11511 |
+- return 1; |
11512 |
+-} |
11513 |
+- |
11514 |
+ /** |
11515 |
+ * pnfs_mark_matching_lsegs_return - Free or return matching layout segments |
11516 |
+ * @lo: pointer to layout header |
11517 |
+@@ -2438,7 +2424,7 @@ pnfs_mark_matching_lsegs_return(struct pnfs_layout_hdr *lo, |
11518 |
+ lseg, lseg->pls_range.iomode, |
11519 |
+ lseg->pls_range.offset, |
11520 |
+ lseg->pls_range.length); |
11521 |
+- if (mark_lseg_invalid_or_return(lseg, tmp_list)) |
11522 |
++ if (mark_lseg_invalid(lseg, tmp_list)) |
11523 |
+ continue; |
11524 |
+ remaining++; |
11525 |
+ set_bit(NFS_LSEG_LAYOUTRETURN, &lseg->pls_flags); |
11526 |
+diff --git a/fs/nfsd/nfs4recover.c b/fs/nfsd/nfs4recover.c |
11527 |
+index a8fb18609146..82679990dd9b 100644 |
11528 |
+--- a/fs/nfsd/nfs4recover.c |
11529 |
++++ b/fs/nfsd/nfs4recover.c |
11530 |
+@@ -755,13 +755,11 @@ struct cld_upcall { |
11531 |
+ }; |
11532 |
+ |
11533 |
+ static int |
11534 |
+-__cld_pipe_upcall(struct rpc_pipe *pipe, void *cmsg) |
11535 |
++__cld_pipe_upcall(struct rpc_pipe *pipe, void *cmsg, struct nfsd_net *nn) |
11536 |
+ { |
11537 |
+ int ret; |
11538 |
+ struct rpc_pipe_msg msg; |
11539 |
+ struct cld_upcall *cup = container_of(cmsg, struct cld_upcall, cu_u); |
11540 |
+- struct nfsd_net *nn = net_generic(pipe->dentry->d_sb->s_fs_info, |
11541 |
+- nfsd_net_id); |
11542 |
+ |
11543 |
+ memset(&msg, 0, sizeof(msg)); |
11544 |
+ msg.data = cmsg; |
11545 |
+@@ -781,7 +779,7 @@ out: |
11546 |
+ } |
11547 |
+ |
11548 |
+ static int |
11549 |
+-cld_pipe_upcall(struct rpc_pipe *pipe, void *cmsg) |
11550 |
++cld_pipe_upcall(struct rpc_pipe *pipe, void *cmsg, struct nfsd_net *nn) |
11551 |
+ { |
11552 |
+ int ret; |
11553 |
+ |
11554 |
+@@ -790,7 +788,7 @@ cld_pipe_upcall(struct rpc_pipe *pipe, void *cmsg) |
11555 |
+ * upcalls queued. |
11556 |
+ */ |
11557 |
+ do { |
11558 |
+- ret = __cld_pipe_upcall(pipe, cmsg); |
11559 |
++ ret = __cld_pipe_upcall(pipe, cmsg, nn); |
11560 |
+ } while (ret == -EAGAIN); |
11561 |
+ |
11562 |
+ return ret; |
11563 |
+@@ -1123,7 +1121,7 @@ nfsd4_cld_create(struct nfs4_client *clp) |
11564 |
+ memcpy(cup->cu_u.cu_msg.cm_u.cm_name.cn_id, clp->cl_name.data, |
11565 |
+ clp->cl_name.len); |
11566 |
+ |
11567 |
+- ret = cld_pipe_upcall(cn->cn_pipe, &cup->cu_u.cu_msg); |
11568 |
++ ret = cld_pipe_upcall(cn->cn_pipe, &cup->cu_u.cu_msg, nn); |
11569 |
+ if (!ret) { |
11570 |
+ ret = cup->cu_u.cu_msg.cm_status; |
11571 |
+ set_bit(NFSD4_CLIENT_STABLE, &clp->cl_flags); |
11572 |
+@@ -1191,7 +1189,7 @@ nfsd4_cld_create_v2(struct nfs4_client *clp) |
11573 |
+ } else |
11574 |
+ cmsg->cm_u.cm_clntinfo.cc_princhash.cp_len = 0; |
11575 |
+ |
11576 |
+- ret = cld_pipe_upcall(cn->cn_pipe, cmsg); |
11577 |
++ ret = cld_pipe_upcall(cn->cn_pipe, cmsg, nn); |
11578 |
+ if (!ret) { |
11579 |
+ ret = cmsg->cm_status; |
11580 |
+ set_bit(NFSD4_CLIENT_STABLE, &clp->cl_flags); |
11581 |
+@@ -1229,7 +1227,7 @@ nfsd4_cld_remove(struct nfs4_client *clp) |
11582 |
+ memcpy(cup->cu_u.cu_msg.cm_u.cm_name.cn_id, clp->cl_name.data, |
11583 |
+ clp->cl_name.len); |
11584 |
+ |
11585 |
+- ret = cld_pipe_upcall(cn->cn_pipe, &cup->cu_u.cu_msg); |
11586 |
++ ret = cld_pipe_upcall(cn->cn_pipe, &cup->cu_u.cu_msg, nn); |
11587 |
+ if (!ret) { |
11588 |
+ ret = cup->cu_u.cu_msg.cm_status; |
11589 |
+ clear_bit(NFSD4_CLIENT_STABLE, &clp->cl_flags); |
11590 |
+@@ -1272,7 +1270,7 @@ nfsd4_cld_check_v0(struct nfs4_client *clp) |
11591 |
+ memcpy(cup->cu_u.cu_msg.cm_u.cm_name.cn_id, clp->cl_name.data, |
11592 |
+ clp->cl_name.len); |
11593 |
+ |
11594 |
+- ret = cld_pipe_upcall(cn->cn_pipe, &cup->cu_u.cu_msg); |
11595 |
++ ret = cld_pipe_upcall(cn->cn_pipe, &cup->cu_u.cu_msg, nn); |
11596 |
+ if (!ret) { |
11597 |
+ ret = cup->cu_u.cu_msg.cm_status; |
11598 |
+ set_bit(NFSD4_CLIENT_STABLE, &clp->cl_flags); |
11599 |
+@@ -1418,7 +1416,7 @@ nfsd4_cld_grace_start(struct nfsd_net *nn) |
11600 |
+ } |
11601 |
+ |
11602 |
+ cup->cu_u.cu_msg.cm_cmd = Cld_GraceStart; |
11603 |
+- ret = cld_pipe_upcall(cn->cn_pipe, &cup->cu_u.cu_msg); |
11604 |
++ ret = cld_pipe_upcall(cn->cn_pipe, &cup->cu_u.cu_msg, nn); |
11605 |
+ if (!ret) |
11606 |
+ ret = cup->cu_u.cu_msg.cm_status; |
11607 |
+ |
11608 |
+@@ -1446,7 +1444,7 @@ nfsd4_cld_grace_done_v0(struct nfsd_net *nn) |
11609 |
+ |
11610 |
+ cup->cu_u.cu_msg.cm_cmd = Cld_GraceDone; |
11611 |
+ cup->cu_u.cu_msg.cm_u.cm_gracetime = nn->boot_time; |
11612 |
+- ret = cld_pipe_upcall(cn->cn_pipe, &cup->cu_u.cu_msg); |
11613 |
++ ret = cld_pipe_upcall(cn->cn_pipe, &cup->cu_u.cu_msg, nn); |
11614 |
+ if (!ret) |
11615 |
+ ret = cup->cu_u.cu_msg.cm_status; |
11616 |
+ |
11617 |
+@@ -1474,7 +1472,7 @@ nfsd4_cld_grace_done(struct nfsd_net *nn) |
11618 |
+ } |
11619 |
+ |
11620 |
+ cup->cu_u.cu_msg.cm_cmd = Cld_GraceDone; |
11621 |
+- ret = cld_pipe_upcall(cn->cn_pipe, &cup->cu_u.cu_msg); |
11622 |
++ ret = cld_pipe_upcall(cn->cn_pipe, &cup->cu_u.cu_msg, nn); |
11623 |
+ if (!ret) |
11624 |
+ ret = cup->cu_u.cu_msg.cm_status; |
11625 |
+ |
11626 |
+@@ -1538,7 +1536,7 @@ nfsd4_cld_get_version(struct nfsd_net *nn) |
11627 |
+ goto out_err; |
11628 |
+ } |
11629 |
+ cup->cu_u.cu_msg.cm_cmd = Cld_GetVersion; |
11630 |
+- ret = cld_pipe_upcall(cn->cn_pipe, &cup->cu_u.cu_msg); |
11631 |
++ ret = cld_pipe_upcall(cn->cn_pipe, &cup->cu_u.cu_msg, nn); |
11632 |
+ if (!ret) { |
11633 |
+ ret = cup->cu_u.cu_msg.cm_status; |
11634 |
+ if (ret) |
11635 |
+diff --git a/fs/ocfs2/dlmglue.c b/fs/ocfs2/dlmglue.c |
11636 |
+index 751bc4dc7466..8e3a369086db 100644 |
11637 |
+--- a/fs/ocfs2/dlmglue.c |
11638 |
++++ b/fs/ocfs2/dlmglue.c |
11639 |
+@@ -2871,9 +2871,15 @@ int ocfs2_nfs_sync_lock(struct ocfs2_super *osb, int ex) |
11640 |
+ |
11641 |
+ status = ocfs2_cluster_lock(osb, lockres, ex ? LKM_EXMODE : LKM_PRMODE, |
11642 |
+ 0, 0); |
11643 |
+- if (status < 0) |
11644 |
++ if (status < 0) { |
11645 |
+ mlog(ML_ERROR, "lock on nfs sync lock failed %d\n", status); |
11646 |
+ |
11647 |
++ if (ex) |
11648 |
++ up_write(&osb->nfs_sync_rwlock); |
11649 |
++ else |
11650 |
++ up_read(&osb->nfs_sync_rwlock); |
11651 |
++ } |
11652 |
++ |
11653 |
+ return status; |
11654 |
+ } |
11655 |
+ |
11656 |
+diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c |
11657 |
+index 408277ee3cdb..ef49703c9676 100644 |
11658 |
+--- a/fs/pstore/platform.c |
11659 |
++++ b/fs/pstore/platform.c |
11660 |
+@@ -275,6 +275,9 @@ static int pstore_compress(const void *in, void *out, |
11661 |
+ { |
11662 |
+ int ret; |
11663 |
+ |
11664 |
++ if (!IS_ENABLED(CONFIG_PSTORE_COMPRESSION)) |
11665 |
++ return -EINVAL; |
11666 |
++ |
11667 |
+ ret = crypto_comp_compress(tfm, in, inlen, out, &outlen); |
11668 |
+ if (ret) { |
11669 |
+ pr_err("crypto_comp_compress failed, ret = %d!\n", ret); |
11670 |
+@@ -661,7 +664,7 @@ static void decompress_record(struct pstore_record *record) |
11671 |
+ int unzipped_len; |
11672 |
+ char *unzipped, *workspace; |
11673 |
+ |
11674 |
+- if (!record->compressed) |
11675 |
++ if (!IS_ENABLED(CONFIG_PSTORE_COMPRESSION) || !record->compressed) |
11676 |
+ return; |
11677 |
+ |
11678 |
+ /* Only PSTORE_TYPE_DMESG support compression. */ |
11679 |
+diff --git a/fs/xfs/libxfs/xfs_trans_space.h b/fs/xfs/libxfs/xfs_trans_space.h |
11680 |
+index 88221c7a04cc..c6df01a2a158 100644 |
11681 |
+--- a/fs/xfs/libxfs/xfs_trans_space.h |
11682 |
++++ b/fs/xfs/libxfs/xfs_trans_space.h |
11683 |
+@@ -57,7 +57,7 @@ |
11684 |
+ XFS_DAREMOVE_SPACE_RES(mp, XFS_DATA_FORK) |
11685 |
+ #define XFS_IALLOC_SPACE_RES(mp) \ |
11686 |
+ (M_IGEO(mp)->ialloc_blks + \ |
11687 |
+- (xfs_sb_version_hasfinobt(&mp->m_sb) ? 2 : 1 * \ |
11688 |
++ ((xfs_sb_version_hasfinobt(&mp->m_sb) ? 2 : 1) * \ |
11689 |
+ (M_IGEO(mp)->inobt_maxlevels - 1))) |
11690 |
+ |
11691 |
+ /* |
11692 |
+diff --git a/fs/xfs/scrub/bmap.c b/fs/xfs/scrub/bmap.c |
11693 |
+index add8598eacd5..c4788d244de3 100644 |
11694 |
+--- a/fs/xfs/scrub/bmap.c |
11695 |
++++ b/fs/xfs/scrub/bmap.c |
11696 |
+@@ -45,9 +45,27 @@ xchk_setup_inode_bmap( |
11697 |
+ */ |
11698 |
+ if (S_ISREG(VFS_I(sc->ip)->i_mode) && |
11699 |
+ sc->sm->sm_type == XFS_SCRUB_TYPE_BMBTD) { |
11700 |
++ struct address_space *mapping = VFS_I(sc->ip)->i_mapping; |
11701 |
++ |
11702 |
+ inode_dio_wait(VFS_I(sc->ip)); |
11703 |
+- error = filemap_write_and_wait(VFS_I(sc->ip)->i_mapping); |
11704 |
+- if (error) |
11705 |
++ |
11706 |
++ /* |
11707 |
++ * Try to flush all incore state to disk before we examine the |
11708 |
++ * space mappings for the data fork. Leave accumulated errors |
11709 |
++ * in the mapping for the writer threads to consume. |
11710 |
++ * |
11711 |
++ * On ENOSPC or EIO writeback errors, we continue into the |
11712 |
++ * extent mapping checks because write failures do not |
11713 |
++ * necessarily imply anything about the correctness of the file |
11714 |
++ * metadata. The metadata and the file data could be on |
11715 |
++ * completely separate devices; a media failure might only |
11716 |
++ * affect a subset of the disk, etc. We can handle delalloc |
11717 |
++ * extents in the scrubber, so leaving them in memory is fine. |
11718 |
++ */ |
11719 |
++ error = filemap_fdatawrite(mapping); |
11720 |
++ if (!error) |
11721 |
++ error = filemap_fdatawait_keep_errors(mapping); |
11722 |
++ if (error && (error != -ENOSPC && error != -EIO)) |
11723 |
+ goto out; |
11724 |
+ } |
11725 |
+ |
11726 |
+diff --git a/fs/xfs/xfs_qm.c b/fs/xfs/xfs_qm.c |
11727 |
+index c225691fad15..2a0cdca80f86 100644 |
11728 |
+--- a/fs/xfs/xfs_qm.c |
11729 |
++++ b/fs/xfs/xfs_qm.c |
11730 |
+@@ -148,6 +148,7 @@ xfs_qm_dqpurge( |
11731 |
+ error = xfs_bwrite(bp); |
11732 |
+ xfs_buf_relse(bp); |
11733 |
+ } else if (error == -EAGAIN) { |
11734 |
++ dqp->dq_flags &= ~XFS_DQ_FREEING; |
11735 |
+ goto out_unlock; |
11736 |
+ } |
11737 |
+ xfs_dqflock(dqp); |
11738 |
+diff --git a/fs/xfs/xfs_reflink.c b/fs/xfs/xfs_reflink.c |
11739 |
+index 107bf2a2f344..d89201d40891 100644 |
11740 |
+--- a/fs/xfs/xfs_reflink.c |
11741 |
++++ b/fs/xfs/xfs_reflink.c |
11742 |
+@@ -1003,6 +1003,7 @@ xfs_reflink_remap_extent( |
11743 |
+ xfs_filblks_t rlen; |
11744 |
+ xfs_filblks_t unmap_len; |
11745 |
+ xfs_off_t newlen; |
11746 |
++ int64_t qres; |
11747 |
+ int error; |
11748 |
+ |
11749 |
+ unmap_len = irec->br_startoff + irec->br_blockcount - destoff; |
11750 |
+@@ -1025,13 +1026,19 @@ xfs_reflink_remap_extent( |
11751 |
+ xfs_ilock(ip, XFS_ILOCK_EXCL); |
11752 |
+ xfs_trans_ijoin(tp, ip, 0); |
11753 |
+ |
11754 |
+- /* If we're not just clearing space, then do we have enough quota? */ |
11755 |
+- if (real_extent) { |
11756 |
+- error = xfs_trans_reserve_quota_nblks(tp, ip, |
11757 |
+- irec->br_blockcount, 0, XFS_QMOPT_RES_REGBLKS); |
11758 |
+- if (error) |
11759 |
+- goto out_cancel; |
11760 |
+- } |
11761 |
++ /* |
11762 |
++ * Reserve quota for this operation. We don't know if the first unmap |
11763 |
++ * in the dest file will cause a bmap btree split, so we always reserve |
11764 |
++ * at least enough blocks for that split. If the extent being mapped |
11765 |
++ * in is written, we need to reserve quota for that too. |
11766 |
++ */ |
11767 |
++ qres = XFS_EXTENTADD_SPACE_RES(mp, XFS_DATA_FORK); |
11768 |
++ if (real_extent) |
11769 |
++ qres += irec->br_blockcount; |
11770 |
++ error = xfs_trans_reserve_quota_nblks(tp, ip, qres, 0, |
11771 |
++ XFS_QMOPT_RES_REGBLKS); |
11772 |
++ if (error) |
11773 |
++ goto out_cancel; |
11774 |
+ |
11775 |
+ trace_xfs_reflink_remap(ip, irec->br_startoff, |
11776 |
+ irec->br_blockcount, irec->br_startblock); |
11777 |
+diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h |
11778 |
+index dc29044d3ed9..271d56ff3316 100644 |
11779 |
+--- a/include/asm-generic/vmlinux.lds.h |
11780 |
++++ b/include/asm-generic/vmlinux.lds.h |
11781 |
+@@ -375,6 +375,7 @@ |
11782 |
+ */ |
11783 |
+ #ifndef RO_AFTER_INIT_DATA |
11784 |
+ #define RO_AFTER_INIT_DATA \ |
11785 |
++ . = ALIGN(8); \ |
11786 |
+ __start_ro_after_init = .; \ |
11787 |
+ *(.data..ro_after_init) \ |
11788 |
+ JUMP_TABLE_DATA \ |
11789 |
+diff --git a/include/linux/bitfield.h b/include/linux/bitfield.h |
11790 |
+index 48ea093ff04c..4e035aca6f7e 100644 |
11791 |
+--- a/include/linux/bitfield.h |
11792 |
++++ b/include/linux/bitfield.h |
11793 |
+@@ -77,7 +77,7 @@ |
11794 |
+ */ |
11795 |
+ #define FIELD_FIT(_mask, _val) \ |
11796 |
+ ({ \ |
11797 |
+- __BF_FIELD_CHECK(_mask, 0ULL, _val, "FIELD_FIT: "); \ |
11798 |
++ __BF_FIELD_CHECK(_mask, 0ULL, 0ULL, "FIELD_FIT: "); \ |
11799 |
+ !((((typeof(_mask))_val) << __bf_shf(_mask)) & ~(_mask)); \ |
11800 |
+ }) |
11801 |
+ |
11802 |
+diff --git a/include/linux/gpio/driver.h b/include/linux/gpio/driver.h |
11803 |
+index b8fc92c177eb..e4a00bb42427 100644 |
11804 |
+--- a/include/linux/gpio/driver.h |
11805 |
++++ b/include/linux/gpio/driver.h |
11806 |
+@@ -496,8 +496,16 @@ extern int gpiochip_add_data_with_key(struct gpio_chip *gc, void *data, |
11807 |
+ gpiochip_add_data_with_key(gc, data, &lock_key, \ |
11808 |
+ &request_key); \ |
11809 |
+ }) |
11810 |
++#define devm_gpiochip_add_data(dev, gc, data) ({ \ |
11811 |
++ static struct lock_class_key lock_key; \ |
11812 |
++ static struct lock_class_key request_key; \ |
11813 |
++ devm_gpiochip_add_data_with_key(dev, gc, data, &lock_key, \ |
11814 |
++ &request_key); \ |
11815 |
++ }) |
11816 |
+ #else |
11817 |
+ #define gpiochip_add_data(gc, data) gpiochip_add_data_with_key(gc, data, NULL, NULL) |
11818 |
++#define devm_gpiochip_add_data(dev, gc, data) \ |
11819 |
++ devm_gpiochip_add_data_with_key(dev, gc, data, NULL, NULL) |
11820 |
+ #endif /* CONFIG_LOCKDEP */ |
11821 |
+ |
11822 |
+ static inline int gpiochip_add(struct gpio_chip *gc) |
11823 |
+@@ -505,8 +513,9 @@ static inline int gpiochip_add(struct gpio_chip *gc) |
11824 |
+ return gpiochip_add_data(gc, NULL); |
11825 |
+ } |
11826 |
+ extern void gpiochip_remove(struct gpio_chip *gc); |
11827 |
+-extern int devm_gpiochip_add_data(struct device *dev, struct gpio_chip *gc, |
11828 |
+- void *data); |
11829 |
++extern int devm_gpiochip_add_data_with_key(struct device *dev, struct gpio_chip *gc, void *data, |
11830 |
++ struct lock_class_key *lock_key, |
11831 |
++ struct lock_class_key *request_key); |
11832 |
+ |
11833 |
+ extern struct gpio_chip *gpiochip_find(void *data, |
11834 |
+ int (*match)(struct gpio_chip *gc, void *data)); |
11835 |
+diff --git a/include/linux/tpm.h b/include/linux/tpm.h |
11836 |
+index 03e9b184411b..8f4ff39f51e7 100644 |
11837 |
+--- a/include/linux/tpm.h |
11838 |
++++ b/include/linux/tpm.h |
11839 |
+@@ -96,6 +96,7 @@ struct tpm_space { |
11840 |
+ u8 *context_buf; |
11841 |
+ u32 session_tbl[3]; |
11842 |
+ u8 *session_buf; |
11843 |
++ u32 buf_size; |
11844 |
+ }; |
11845 |
+ |
11846 |
+ struct tpm_bios_log { |
11847 |
+diff --git a/include/linux/tpm_eventlog.h b/include/linux/tpm_eventlog.h |
11848 |
+index 96d36b7a1344..6f1d1b7f8b42 100644 |
11849 |
+--- a/include/linux/tpm_eventlog.h |
11850 |
++++ b/include/linux/tpm_eventlog.h |
11851 |
+@@ -211,9 +211,16 @@ static inline int __calc_tpm2_event_size(struct tcg_pcr_event2_head *event, |
11852 |
+ |
11853 |
+ efispecid = (struct tcg_efi_specid_event_head *)event_header->event; |
11854 |
+ |
11855 |
+- /* Check if event is malformed. */ |
11856 |
++ /* |
11857 |
++ * Perform validation of the event in order to identify malformed |
11858 |
++ * events. This function may be asked to parse arbitrary byte sequences |
11859 |
++ * immediately following a valid event log. The caller expects this |
11860 |
++ * function to recognize that the byte sequence is not a valid event |
11861 |
++ * and to return an event size of 0. |
11862 |
++ */ |
11863 |
+ if (memcmp(efispecid->signature, TCG_SPECID_SIG, |
11864 |
+- sizeof(TCG_SPECID_SIG)) || count > efispecid->num_algs) { |
11865 |
++ sizeof(TCG_SPECID_SIG)) || |
11866 |
++ !efispecid->num_algs || count != efispecid->num_algs) { |
11867 |
+ size = 0; |
11868 |
+ goto out; |
11869 |
+ } |
11870 |
+diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h |
11871 |
+index a1fecf311621..3a5b717d92e8 100644 |
11872 |
+--- a/include/linux/tracepoint.h |
11873 |
++++ b/include/linux/tracepoint.h |
11874 |
+@@ -361,7 +361,7 @@ static inline struct tracepoint *tracepoint_ptr_deref(tracepoint_ptr_t *p) |
11875 |
+ static const char *___tp_str __tracepoint_string = str; \ |
11876 |
+ ___tp_str; \ |
11877 |
+ }) |
11878 |
+-#define __tracepoint_string __attribute__((section("__tracepoint_str"))) |
11879 |
++#define __tracepoint_string __attribute__((section("__tracepoint_str"), used)) |
11880 |
+ #else |
11881 |
+ /* |
11882 |
+ * tracepoint_string() is used to save the string address for userspace |
11883 |
+diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h |
11884 |
+index 1576353a2773..15c54deb2b8e 100644 |
11885 |
+--- a/include/net/bluetooth/bluetooth.h |
11886 |
++++ b/include/net/bluetooth/bluetooth.h |
11887 |
+@@ -41,6 +41,8 @@ |
11888 |
+ #define BLUETOOTH_VER_1_1 1 |
11889 |
+ #define BLUETOOTH_VER_1_2 2 |
11890 |
+ #define BLUETOOTH_VER_2_0 3 |
11891 |
++#define BLUETOOTH_VER_2_1 4 |
11892 |
++#define BLUETOOTH_VER_4_0 6 |
11893 |
+ |
11894 |
+ /* Reserv for core and drivers use */ |
11895 |
+ #define BT_SKB_RESERVE 8 |
11896 |
+diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h |
11897 |
+index 25c2e5ee81dc..b2c567fc3338 100644 |
11898 |
+--- a/include/net/bluetooth/hci.h |
11899 |
++++ b/include/net/bluetooth/hci.h |
11900 |
+@@ -223,6 +223,17 @@ enum { |
11901 |
+ * supported. |
11902 |
+ */ |
11903 |
+ HCI_QUIRK_VALID_LE_STATES, |
11904 |
++ |
11905 |
++ /* When this quirk is set, then erroneous data reporting |
11906 |
++ * is ignored. This is mainly due to the fact that the HCI |
11907 |
++ * Read Default Erroneous Data Reporting command is advertised, |
11908 |
++ * but not supported; these controllers often reply with unknown |
11909 |
++ * command and tend to lock up randomly. Needing a hard reset. |
11910 |
++ * |
11911 |
++ * This quirk can be set before hci_register_dev is called or |
11912 |
++ * during the hdev->setup vendor callback. |
11913 |
++ */ |
11914 |
++ HCI_QUIRK_BROKEN_ERR_DATA_REPORTING, |
11915 |
+ }; |
11916 |
+ |
11917 |
+ /* HCI device flags */ |
11918 |
+diff --git a/include/net/inet_connection_sock.h b/include/net/inet_connection_sock.h |
11919 |
+index a3f076befa4f..cceec467ed9e 100644 |
11920 |
+--- a/include/net/inet_connection_sock.h |
11921 |
++++ b/include/net/inet_connection_sock.h |
11922 |
+@@ -309,6 +309,10 @@ int inet_csk_compat_getsockopt(struct sock *sk, int level, int optname, |
11923 |
+ int inet_csk_compat_setsockopt(struct sock *sk, int level, int optname, |
11924 |
+ char __user *optval, unsigned int optlen); |
11925 |
+ |
11926 |
++/* update the fast reuse flag when adding a socket */ |
11927 |
++void inet_csk_update_fastreuse(struct inet_bind_bucket *tb, |
11928 |
++ struct sock *sk); |
11929 |
++ |
11930 |
+ struct dst_entry *inet_csk_update_pmtu(struct sock *sk, u32 mtu); |
11931 |
+ |
11932 |
+ #define TCP_PINGPONG_THRESH 3 |
11933 |
+diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h |
11934 |
+index 83be2d93b407..fe96aa462d05 100644 |
11935 |
+--- a/include/net/ip_vs.h |
11936 |
++++ b/include/net/ip_vs.h |
11937 |
+@@ -1624,18 +1624,16 @@ static inline void ip_vs_conn_drop_conntrack(struct ip_vs_conn *cp) |
11938 |
+ } |
11939 |
+ #endif /* CONFIG_IP_VS_NFCT */ |
11940 |
+ |
11941 |
+-/* Really using conntrack? */ |
11942 |
+-static inline bool ip_vs_conn_uses_conntrack(struct ip_vs_conn *cp, |
11943 |
+- struct sk_buff *skb) |
11944 |
++/* Using old conntrack that can not be redirected to another real server? */ |
11945 |
++static inline bool ip_vs_conn_uses_old_conntrack(struct ip_vs_conn *cp, |
11946 |
++ struct sk_buff *skb) |
11947 |
+ { |
11948 |
+ #ifdef CONFIG_IP_VS_NFCT |
11949 |
+ enum ip_conntrack_info ctinfo; |
11950 |
+ struct nf_conn *ct; |
11951 |
+ |
11952 |
+- if (!(cp->flags & IP_VS_CONN_F_NFCT)) |
11953 |
+- return false; |
11954 |
+ ct = nf_ct_get(skb, &ctinfo); |
11955 |
+- if (ct) |
11956 |
++ if (ct && nf_ct_is_confirmed(ct)) |
11957 |
+ return true; |
11958 |
+ #endif |
11959 |
+ return false; |
11960 |
+diff --git a/include/net/tcp.h b/include/net/tcp.h |
11961 |
+index 6f8e60c6fbc7..ecb66d01135e 100644 |
11962 |
+--- a/include/net/tcp.h |
11963 |
++++ b/include/net/tcp.h |
11964 |
+@@ -1669,6 +1669,8 @@ void tcp_fastopen_destroy_cipher(struct sock *sk); |
11965 |
+ void tcp_fastopen_ctx_destroy(struct net *net); |
11966 |
+ int tcp_fastopen_reset_cipher(struct net *net, struct sock *sk, |
11967 |
+ void *primary_key, void *backup_key); |
11968 |
++int tcp_fastopen_get_cipher(struct net *net, struct inet_connection_sock *icsk, |
11969 |
++ u64 *key); |
11970 |
+ void tcp_fastopen_add_skb(struct sock *sk, struct sk_buff *skb); |
11971 |
+ struct sock *tcp_try_fastopen(struct sock *sk, struct sk_buff *skb, |
11972 |
+ struct request_sock *req, |
11973 |
+diff --git a/include/uapi/linux/seccomp.h b/include/uapi/linux/seccomp.h |
11974 |
+index c1735455bc53..965290f7dcc2 100644 |
11975 |
+--- a/include/uapi/linux/seccomp.h |
11976 |
++++ b/include/uapi/linux/seccomp.h |
11977 |
+@@ -123,5 +123,6 @@ struct seccomp_notif_resp { |
11978 |
+ #define SECCOMP_IOCTL_NOTIF_RECV SECCOMP_IOWR(0, struct seccomp_notif) |
11979 |
+ #define SECCOMP_IOCTL_NOTIF_SEND SECCOMP_IOWR(1, \ |
11980 |
+ struct seccomp_notif_resp) |
11981 |
+-#define SECCOMP_IOCTL_NOTIF_ID_VALID SECCOMP_IOR(2, __u64) |
11982 |
++#define SECCOMP_IOCTL_NOTIF_ID_VALID SECCOMP_IOW(2, __u64) |
11983 |
++ |
11984 |
+ #endif /* _UAPI_LINUX_SECCOMP_H */ |
11985 |
+diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c |
11986 |
+index d9a49cd6065a..a3aa129cc8f5 100644 |
11987 |
+--- a/kernel/rcu/tree.c |
11988 |
++++ b/kernel/rcu/tree.c |
11989 |
+@@ -2895,7 +2895,7 @@ static void kfree_rcu_work(struct work_struct *work) |
11990 |
+ static inline bool queue_kfree_rcu_work(struct kfree_rcu_cpu *krcp) |
11991 |
+ { |
11992 |
+ struct kfree_rcu_cpu_work *krwp; |
11993 |
+- bool queued = false; |
11994 |
++ bool repeat = false; |
11995 |
+ int i; |
11996 |
+ |
11997 |
+ lockdep_assert_held(&krcp->lock); |
11998 |
+@@ -2931,11 +2931,14 @@ static inline bool queue_kfree_rcu_work(struct kfree_rcu_cpu *krcp) |
11999 |
+ * been detached following each other, one by one. |
12000 |
+ */ |
12001 |
+ queue_rcu_work(system_wq, &krwp->rcu_work); |
12002 |
+- queued = true; |
12003 |
+ } |
12004 |
++ |
12005 |
++ /* Repeat if any "free" corresponding channel is still busy. */ |
12006 |
++ if (krcp->bhead || krcp->head) |
12007 |
++ repeat = true; |
12008 |
+ } |
12009 |
+ |
12010 |
+- return queued; |
12011 |
++ return !repeat; |
12012 |
+ } |
12013 |
+ |
12014 |
+ static inline void kfree_rcu_drain_unlock(struct kfree_rcu_cpu *krcp, |
12015 |
+diff --git a/kernel/sched/core.c b/kernel/sched/core.c |
12016 |
+index a7ef76a62699..1bae86fc128b 100644 |
12017 |
+--- a/kernel/sched/core.c |
12018 |
++++ b/kernel/sched/core.c |
12019 |
+@@ -1237,6 +1237,20 @@ static void uclamp_fork(struct task_struct *p) |
12020 |
+ } |
12021 |
+ } |
12022 |
+ |
12023 |
++static void __init init_uclamp_rq(struct rq *rq) |
12024 |
++{ |
12025 |
++ enum uclamp_id clamp_id; |
12026 |
++ struct uclamp_rq *uc_rq = rq->uclamp; |
12027 |
++ |
12028 |
++ for_each_clamp_id(clamp_id) { |
12029 |
++ uc_rq[clamp_id] = (struct uclamp_rq) { |
12030 |
++ .value = uclamp_none(clamp_id) |
12031 |
++ }; |
12032 |
++ } |
12033 |
++ |
12034 |
++ rq->uclamp_flags = 0; |
12035 |
++} |
12036 |
++ |
12037 |
+ static void __init init_uclamp(void) |
12038 |
+ { |
12039 |
+ struct uclamp_se uc_max = {}; |
12040 |
+@@ -1245,11 +1259,8 @@ static void __init init_uclamp(void) |
12041 |
+ |
12042 |
+ mutex_init(&uclamp_mutex); |
12043 |
+ |
12044 |
+- for_each_possible_cpu(cpu) { |
12045 |
+- memset(&cpu_rq(cpu)->uclamp, 0, |
12046 |
+- sizeof(struct uclamp_rq)*UCLAMP_CNT); |
12047 |
+- cpu_rq(cpu)->uclamp_flags = 0; |
12048 |
+- } |
12049 |
++ for_each_possible_cpu(cpu) |
12050 |
++ init_uclamp_rq(cpu_rq(cpu)); |
12051 |
+ |
12052 |
+ for_each_clamp_id(clamp_id) { |
12053 |
+ uclamp_se_set(&init_task.uclamp_req[clamp_id], |
12054 |
+diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c |
12055 |
+index 5c31875a7d9d..e44332b829b4 100644 |
12056 |
+--- a/kernel/sched/fair.c |
12057 |
++++ b/kernel/sched/fair.c |
12058 |
+@@ -10033,7 +10033,12 @@ static void kick_ilb(unsigned int flags) |
12059 |
+ { |
12060 |
+ int ilb_cpu; |
12061 |
+ |
12062 |
+- nohz.next_balance++; |
12063 |
++ /* |
12064 |
++ * Increase nohz.next_balance only when if full ilb is triggered but |
12065 |
++ * not if we only update stats. |
12066 |
++ */ |
12067 |
++ if (flags & NOHZ_BALANCE_KICK) |
12068 |
++ nohz.next_balance = jiffies+1; |
12069 |
+ |
12070 |
+ ilb_cpu = find_new_ilb(); |
12071 |
+ |
12072 |
+@@ -10351,6 +10356,14 @@ static bool _nohz_idle_balance(struct rq *this_rq, unsigned int flags, |
12073 |
+ } |
12074 |
+ } |
12075 |
+ |
12076 |
++ /* |
12077 |
++ * next_balance will be updated only when there is a need. |
12078 |
++ * When the CPU is attached to null domain for ex, it will not be |
12079 |
++ * updated. |
12080 |
++ */ |
12081 |
++ if (likely(update_next_balance)) |
12082 |
++ nohz.next_balance = next_balance; |
12083 |
++ |
12084 |
+ /* Newly idle CPU doesn't need an update */ |
12085 |
+ if (idle != CPU_NEWLY_IDLE) { |
12086 |
+ update_blocked_averages(this_cpu); |
12087 |
+@@ -10371,14 +10384,6 @@ abort: |
12088 |
+ if (has_blocked_load) |
12089 |
+ WRITE_ONCE(nohz.has_blocked, 1); |
12090 |
+ |
12091 |
+- /* |
12092 |
+- * next_balance will be updated only when there is a need. |
12093 |
+- * When the CPU is attached to null domain for ex, it will not be |
12094 |
+- * updated. |
12095 |
+- */ |
12096 |
+- if (likely(update_next_balance)) |
12097 |
+- nohz.next_balance = next_balance; |
12098 |
+- |
12099 |
+ return ret; |
12100 |
+ } |
12101 |
+ |
12102 |
+diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c |
12103 |
+index 8344757bba6e..160178d6eb20 100644 |
12104 |
+--- a/kernel/sched/topology.c |
12105 |
++++ b/kernel/sched/topology.c |
12106 |
+@@ -1338,7 +1338,7 @@ sd_init(struct sched_domain_topology_level *tl, |
12107 |
+ sd_flags = (*tl->sd_flags)(); |
12108 |
+ if (WARN_ONCE(sd_flags & ~TOPOLOGY_SD_FLAGS, |
12109 |
+ "wrong sd_flags in topology description\n")) |
12110 |
+- sd_flags &= ~TOPOLOGY_SD_FLAGS; |
12111 |
++ sd_flags &= TOPOLOGY_SD_FLAGS; |
12112 |
+ |
12113 |
+ /* Apply detected topology flags */ |
12114 |
+ sd_flags |= dflags; |
12115 |
+diff --git a/kernel/seccomp.c b/kernel/seccomp.c |
12116 |
+index 55a6184f5990..63e283c4c58e 100644 |
12117 |
+--- a/kernel/seccomp.c |
12118 |
++++ b/kernel/seccomp.c |
12119 |
+@@ -42,6 +42,14 @@ |
12120 |
+ #include <linux/uaccess.h> |
12121 |
+ #include <linux/anon_inodes.h> |
12122 |
+ |
12123 |
++/* |
12124 |
++ * When SECCOMP_IOCTL_NOTIF_ID_VALID was first introduced, it had the |
12125 |
++ * wrong direction flag in the ioctl number. This is the broken one, |
12126 |
++ * which the kernel needs to keep supporting until all userspaces stop |
12127 |
++ * using the wrong command number. |
12128 |
++ */ |
12129 |
++#define SECCOMP_IOCTL_NOTIF_ID_VALID_WRONG_DIR SECCOMP_IOR(2, __u64) |
12130 |
++ |
12131 |
+ enum notify_state { |
12132 |
+ SECCOMP_NOTIFY_INIT, |
12133 |
+ SECCOMP_NOTIFY_SENT, |
12134 |
+@@ -1186,6 +1194,7 @@ static long seccomp_notify_ioctl(struct file *file, unsigned int cmd, |
12135 |
+ return seccomp_notify_recv(filter, buf); |
12136 |
+ case SECCOMP_IOCTL_NOTIF_SEND: |
12137 |
+ return seccomp_notify_send(filter, buf); |
12138 |
++ case SECCOMP_IOCTL_NOTIF_ID_VALID_WRONG_DIR: |
12139 |
+ case SECCOMP_IOCTL_NOTIF_ID_VALID: |
12140 |
+ return seccomp_notify_id_valid(filter, buf); |
12141 |
+ default: |
12142 |
+diff --git a/kernel/signal.c b/kernel/signal.c |
12143 |
+index d5feb34b5e15..6c793322e01b 100644 |
12144 |
+--- a/kernel/signal.c |
12145 |
++++ b/kernel/signal.c |
12146 |
+@@ -2541,7 +2541,21 @@ bool get_signal(struct ksignal *ksig) |
12147 |
+ |
12148 |
+ relock: |
12149 |
+ spin_lock_irq(&sighand->siglock); |
12150 |
+- current->jobctl &= ~JOBCTL_TASK_WORK; |
12151 |
++ /* |
12152 |
++ * Make sure we can safely read ->jobctl() in task_work add. As Oleg |
12153 |
++ * states: |
12154 |
++ * |
12155 |
++ * It pairs with mb (implied by cmpxchg) before READ_ONCE. So we |
12156 |
++ * roughly have |
12157 |
++ * |
12158 |
++ * task_work_add: get_signal: |
12159 |
++ * STORE(task->task_works, new_work); STORE(task->jobctl); |
12160 |
++ * mb(); mb(); |
12161 |
++ * LOAD(task->jobctl); LOAD(task->task_works); |
12162 |
++ * |
12163 |
++ * and we can rely on STORE-MB-LOAD [ in task_work_add]. |
12164 |
++ */ |
12165 |
++ smp_store_mb(current->jobctl, current->jobctl & ~JOBCTL_TASK_WORK); |
12166 |
+ if (unlikely(current->task_works)) { |
12167 |
+ spin_unlock_irq(&sighand->siglock); |
12168 |
+ task_work_run(); |
12169 |
+diff --git a/kernel/task_work.c b/kernel/task_work.c |
12170 |
+index 5c0848ca1287..613b2d634af8 100644 |
12171 |
+--- a/kernel/task_work.c |
12172 |
++++ b/kernel/task_work.c |
12173 |
+@@ -42,7 +42,13 @@ task_work_add(struct task_struct *task, struct callback_head *work, int notify) |
12174 |
+ set_notify_resume(task); |
12175 |
+ break; |
12176 |
+ case TWA_SIGNAL: |
12177 |
+- if (lock_task_sighand(task, &flags)) { |
12178 |
++ /* |
12179 |
++ * Only grab the sighand lock if we don't already have some |
12180 |
++ * task_work pending. This pairs with the smp_store_mb() |
12181 |
++ * in get_signal(), see comment there. |
12182 |
++ */ |
12183 |
++ if (!(READ_ONCE(task->jobctl) & JOBCTL_TASK_WORK) && |
12184 |
++ lock_task_sighand(task, &flags)) { |
12185 |
+ task->jobctl |= JOBCTL_TASK_WORK; |
12186 |
+ signal_wake_up(task, 0); |
12187 |
+ unlock_task_sighand(task, &flags); |
12188 |
+diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c |
12189 |
+index 3e2dc9b8858c..f0199a4ba1ad 100644 |
12190 |
+--- a/kernel/time/tick-sched.c |
12191 |
++++ b/kernel/time/tick-sched.c |
12192 |
+@@ -351,16 +351,24 @@ void tick_nohz_dep_clear_cpu(int cpu, enum tick_dep_bits bit) |
12193 |
+ EXPORT_SYMBOL_GPL(tick_nohz_dep_clear_cpu); |
12194 |
+ |
12195 |
+ /* |
12196 |
+- * Set a per-task tick dependency. Posix CPU timers need this in order to elapse |
12197 |
+- * per task timers. |
12198 |
++ * Set a per-task tick dependency. RCU need this. Also posix CPU timers |
12199 |
++ * in order to elapse per task timers. |
12200 |
+ */ |
12201 |
+ void tick_nohz_dep_set_task(struct task_struct *tsk, enum tick_dep_bits bit) |
12202 |
+ { |
12203 |
+- /* |
12204 |
+- * We could optimize this with just kicking the target running the task |
12205 |
+- * if that noise matters for nohz full users. |
12206 |
+- */ |
12207 |
+- tick_nohz_dep_set_all(&tsk->tick_dep_mask, bit); |
12208 |
++ if (!atomic_fetch_or(BIT(bit), &tsk->tick_dep_mask)) { |
12209 |
++ if (tsk == current) { |
12210 |
++ preempt_disable(); |
12211 |
++ tick_nohz_full_kick(); |
12212 |
++ preempt_enable(); |
12213 |
++ } else { |
12214 |
++ /* |
12215 |
++ * Some future tick_nohz_full_kick_task() |
12216 |
++ * should optimize this. |
12217 |
++ */ |
12218 |
++ tick_nohz_full_kick_all(); |
12219 |
++ } |
12220 |
++ } |
12221 |
+ } |
12222 |
+ EXPORT_SYMBOL_GPL(tick_nohz_dep_set_task); |
12223 |
+ |
12224 |
+diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c |
12225 |
+index 085fceca3377..ac59476c77ae 100644 |
12226 |
+--- a/kernel/trace/blktrace.c |
12227 |
++++ b/kernel/trace/blktrace.c |
12228 |
+@@ -520,10 +520,18 @@ static int do_blk_trace_setup(struct request_queue *q, char *name, dev_t dev, |
12229 |
+ if (!bt->msg_data) |
12230 |
+ goto err; |
12231 |
+ |
12232 |
+- ret = -ENOENT; |
12233 |
+- |
12234 |
+- dir = debugfs_lookup(buts->name, blk_debugfs_root); |
12235 |
+- if (!dir) |
12236 |
++#ifdef CONFIG_BLK_DEBUG_FS |
12237 |
++ /* |
12238 |
++ * When tracing whole make_request drivers (multiqueue) block devices, |
12239 |
++ * reuse the existing debugfs directory created by the block layer on |
12240 |
++ * init. For request-based block devices, all partitions block devices, |
12241 |
++ * and scsi-generic block devices we create a temporary new debugfs |
12242 |
++ * directory that will be removed once the trace ends. |
12243 |
++ */ |
12244 |
++ if (queue_is_mq(q) && bdev && bdev == bdev->bd_contains) |
12245 |
++ dir = q->debugfs_dir; |
12246 |
++ else |
12247 |
++#endif |
12248 |
+ bt->dir = dir = debugfs_create_dir(buts->name, blk_debugfs_root); |
12249 |
+ |
12250 |
+ bt->dev = dev; |
12251 |
+@@ -564,8 +572,6 @@ static int do_blk_trace_setup(struct request_queue *q, char *name, dev_t dev, |
12252 |
+ |
12253 |
+ ret = 0; |
12254 |
+ err: |
12255 |
+- if (dir && !bt->dir) |
12256 |
+- dput(dir); |
12257 |
+ if (ret) |
12258 |
+ blk_trace_free(bt); |
12259 |
+ return ret; |
12260 |
+diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c |
12261 |
+index bd030b1b9514..baa7c050dc7b 100644 |
12262 |
+--- a/kernel/trace/ftrace.c |
12263 |
++++ b/kernel/trace/ftrace.c |
12264 |
+@@ -139,9 +139,6 @@ static inline void ftrace_ops_init(struct ftrace_ops *ops) |
12265 |
+ #endif |
12266 |
+ } |
12267 |
+ |
12268 |
+-#define FTRACE_PID_IGNORE -1 |
12269 |
+-#define FTRACE_PID_TRACE -2 |
12270 |
+- |
12271 |
+ static void ftrace_pid_func(unsigned long ip, unsigned long parent_ip, |
12272 |
+ struct ftrace_ops *op, struct pt_regs *regs) |
12273 |
+ { |
12274 |
+diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c |
12275 |
+index 29615f15a820..5c56c1e2f273 100644 |
12276 |
+--- a/kernel/trace/trace.c |
12277 |
++++ b/kernel/trace/trace.c |
12278 |
+@@ -5885,7 +5885,7 @@ int tracing_set_tracer(struct trace_array *tr, const char *buf) |
12279 |
+ } |
12280 |
+ |
12281 |
+ /* If trace pipe files are being read, we can't change the tracer */ |
12282 |
+- if (tr->current_trace->ref) { |
12283 |
++ if (tr->trace_ref) { |
12284 |
+ ret = -EBUSY; |
12285 |
+ goto out; |
12286 |
+ } |
12287 |
+@@ -6101,7 +6101,7 @@ static int tracing_open_pipe(struct inode *inode, struct file *filp) |
12288 |
+ |
12289 |
+ nonseekable_open(inode, filp); |
12290 |
+ |
12291 |
+- tr->current_trace->ref++; |
12292 |
++ tr->trace_ref++; |
12293 |
+ out: |
12294 |
+ mutex_unlock(&trace_types_lock); |
12295 |
+ return ret; |
12296 |
+@@ -6120,7 +6120,7 @@ static int tracing_release_pipe(struct inode *inode, struct file *file) |
12297 |
+ |
12298 |
+ mutex_lock(&trace_types_lock); |
12299 |
+ |
12300 |
+- tr->current_trace->ref--; |
12301 |
++ tr->trace_ref--; |
12302 |
+ |
12303 |
+ if (iter->trace->pipe_close) |
12304 |
+ iter->trace->pipe_close(iter); |
12305 |
+@@ -7429,7 +7429,7 @@ static int tracing_buffers_open(struct inode *inode, struct file *filp) |
12306 |
+ |
12307 |
+ filp->private_data = info; |
12308 |
+ |
12309 |
+- tr->current_trace->ref++; |
12310 |
++ tr->trace_ref++; |
12311 |
+ |
12312 |
+ mutex_unlock(&trace_types_lock); |
12313 |
+ |
12314 |
+@@ -7530,7 +7530,7 @@ static int tracing_buffers_release(struct inode *inode, struct file *file) |
12315 |
+ |
12316 |
+ mutex_lock(&trace_types_lock); |
12317 |
+ |
12318 |
+- iter->tr->current_trace->ref--; |
12319 |
++ iter->tr->trace_ref--; |
12320 |
+ |
12321 |
+ __trace_array_put(iter->tr); |
12322 |
+ |
12323 |
+@@ -8752,7 +8752,7 @@ static int __remove_instance(struct trace_array *tr) |
12324 |
+ int i; |
12325 |
+ |
12326 |
+ /* Reference counter for a newly created trace array = 1. */ |
12327 |
+- if (tr->ref > 1 || (tr->current_trace && tr->current_trace->ref)) |
12328 |
++ if (tr->ref > 1 || (tr->current_trace && tr->trace_ref)) |
12329 |
+ return -EBUSY; |
12330 |
+ |
12331 |
+ list_del(&tr->list); |
12332 |
+diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h |
12333 |
+index 7fb2f4c1bc49..6b9acbf95cbc 100644 |
12334 |
+--- a/kernel/trace/trace.h |
12335 |
++++ b/kernel/trace/trace.h |
12336 |
+@@ -356,6 +356,7 @@ struct trace_array { |
12337 |
+ struct trace_event_file *trace_marker_file; |
12338 |
+ cpumask_var_t tracing_cpumask; /* only trace on set CPUs */ |
12339 |
+ int ref; |
12340 |
++ int trace_ref; |
12341 |
+ #ifdef CONFIG_FUNCTION_TRACER |
12342 |
+ struct ftrace_ops *ops; |
12343 |
+ struct trace_pid_list __rcu *function_pids; |
12344 |
+@@ -547,7 +548,6 @@ struct tracer { |
12345 |
+ struct tracer *next; |
12346 |
+ struct tracer_flags *flags; |
12347 |
+ int enabled; |
12348 |
+- int ref; |
12349 |
+ bool print_max; |
12350 |
+ bool allow_instances; |
12351 |
+ #ifdef CONFIG_TRACER_MAX_TRACE |
12352 |
+@@ -1103,6 +1103,10 @@ print_graph_function_flags(struct trace_iterator *iter, u32 flags) |
12353 |
+ extern struct list_head ftrace_pids; |
12354 |
+ |
12355 |
+ #ifdef CONFIG_FUNCTION_TRACER |
12356 |
++ |
12357 |
++#define FTRACE_PID_IGNORE -1 |
12358 |
++#define FTRACE_PID_TRACE -2 |
12359 |
++ |
12360 |
+ struct ftrace_func_command { |
12361 |
+ struct list_head list; |
12362 |
+ char *name; |
12363 |
+@@ -1114,7 +1118,8 @@ struct ftrace_func_command { |
12364 |
+ extern bool ftrace_filter_param __initdata; |
12365 |
+ static inline int ftrace_trace_task(struct trace_array *tr) |
12366 |
+ { |
12367 |
+- return !this_cpu_read(tr->array_buffer.data->ftrace_ignore_pid); |
12368 |
++ return this_cpu_read(tr->array_buffer.data->ftrace_ignore_pid) != |
12369 |
++ FTRACE_PID_IGNORE; |
12370 |
+ } |
12371 |
+ extern int ftrace_is_dead(void); |
12372 |
+ int ftrace_create_function_files(struct trace_array *tr, |
12373 |
+diff --git a/lib/crc-t10dif.c b/lib/crc-t10dif.c |
12374 |
+index 8cc01a603416..c9acf1c12cfc 100644 |
12375 |
+--- a/lib/crc-t10dif.c |
12376 |
++++ b/lib/crc-t10dif.c |
12377 |
+@@ -19,39 +19,46 @@ |
12378 |
+ static struct crypto_shash __rcu *crct10dif_tfm; |
12379 |
+ static struct static_key crct10dif_fallback __read_mostly; |
12380 |
+ static DEFINE_MUTEX(crc_t10dif_mutex); |
12381 |
++static struct work_struct crct10dif_rehash_work; |
12382 |
+ |
12383 |
+-static int crc_t10dif_rehash(struct notifier_block *self, unsigned long val, void *data) |
12384 |
++static int crc_t10dif_notify(struct notifier_block *self, unsigned long val, void *data) |
12385 |
+ { |
12386 |
+ struct crypto_alg *alg = data; |
12387 |
+- struct crypto_shash *new, *old; |
12388 |
+ |
12389 |
+ if (val != CRYPTO_MSG_ALG_LOADED || |
12390 |
+ static_key_false(&crct10dif_fallback) || |
12391 |
+ strncmp(alg->cra_name, CRC_T10DIF_STRING, strlen(CRC_T10DIF_STRING))) |
12392 |
+ return 0; |
12393 |
+ |
12394 |
++ schedule_work(&crct10dif_rehash_work); |
12395 |
++ return 0; |
12396 |
++} |
12397 |
++ |
12398 |
++static void crc_t10dif_rehash(struct work_struct *work) |
12399 |
++{ |
12400 |
++ struct crypto_shash *new, *old; |
12401 |
++ |
12402 |
+ mutex_lock(&crc_t10dif_mutex); |
12403 |
+ old = rcu_dereference_protected(crct10dif_tfm, |
12404 |
+ lockdep_is_held(&crc_t10dif_mutex)); |
12405 |
+ if (!old) { |
12406 |
+ mutex_unlock(&crc_t10dif_mutex); |
12407 |
+- return 0; |
12408 |
++ return; |
12409 |
+ } |
12410 |
+ new = crypto_alloc_shash("crct10dif", 0, 0); |
12411 |
+ if (IS_ERR(new)) { |
12412 |
+ mutex_unlock(&crc_t10dif_mutex); |
12413 |
+- return 0; |
12414 |
++ return; |
12415 |
+ } |
12416 |
+ rcu_assign_pointer(crct10dif_tfm, new); |
12417 |
+ mutex_unlock(&crc_t10dif_mutex); |
12418 |
+ |
12419 |
+ synchronize_rcu(); |
12420 |
+ crypto_free_shash(old); |
12421 |
+- return 0; |
12422 |
+ } |
12423 |
+ |
12424 |
+ static struct notifier_block crc_t10dif_nb = { |
12425 |
+- .notifier_call = crc_t10dif_rehash, |
12426 |
++ .notifier_call = crc_t10dif_notify, |
12427 |
+ }; |
12428 |
+ |
12429 |
+ __u16 crc_t10dif_update(__u16 crc, const unsigned char *buffer, size_t len) |
12430 |
+@@ -86,19 +93,26 @@ EXPORT_SYMBOL(crc_t10dif); |
12431 |
+ |
12432 |
+ static int __init crc_t10dif_mod_init(void) |
12433 |
+ { |
12434 |
++ struct crypto_shash *tfm; |
12435 |
++ |
12436 |
++ INIT_WORK(&crct10dif_rehash_work, crc_t10dif_rehash); |
12437 |
+ crypto_register_notifier(&crc_t10dif_nb); |
12438 |
+- crct10dif_tfm = crypto_alloc_shash("crct10dif", 0, 0); |
12439 |
+- if (IS_ERR(crct10dif_tfm)) { |
12440 |
++ mutex_lock(&crc_t10dif_mutex); |
12441 |
++ tfm = crypto_alloc_shash("crct10dif", 0, 0); |
12442 |
++ if (IS_ERR(tfm)) { |
12443 |
+ static_key_slow_inc(&crct10dif_fallback); |
12444 |
+- crct10dif_tfm = NULL; |
12445 |
++ tfm = NULL; |
12446 |
+ } |
12447 |
++ RCU_INIT_POINTER(crct10dif_tfm, tfm); |
12448 |
++ mutex_unlock(&crc_t10dif_mutex); |
12449 |
+ return 0; |
12450 |
+ } |
12451 |
+ |
12452 |
+ static void __exit crc_t10dif_mod_fini(void) |
12453 |
+ { |
12454 |
+ crypto_unregister_notifier(&crc_t10dif_nb); |
12455 |
+- crypto_free_shash(crct10dif_tfm); |
12456 |
++ cancel_work_sync(&crct10dif_rehash_work); |
12457 |
++ crypto_free_shash(rcu_dereference_protected(crct10dif_tfm, 1)); |
12458 |
+ } |
12459 |
+ |
12460 |
+ module_init(crc_t10dif_mod_init); |
12461 |
+@@ -106,11 +120,27 @@ module_exit(crc_t10dif_mod_fini); |
12462 |
+ |
12463 |
+ static int crc_t10dif_transform_show(char *buffer, const struct kernel_param *kp) |
12464 |
+ { |
12465 |
++ struct crypto_shash *tfm; |
12466 |
++ const char *name; |
12467 |
++ int len; |
12468 |
++ |
12469 |
+ if (static_key_false(&crct10dif_fallback)) |
12470 |
+ return sprintf(buffer, "fallback\n"); |
12471 |
+ |
12472 |
+- return sprintf(buffer, "%s\n", |
12473 |
+- crypto_tfm_alg_driver_name(crypto_shash_tfm(crct10dif_tfm))); |
12474 |
++ rcu_read_lock(); |
12475 |
++ tfm = rcu_dereference(crct10dif_tfm); |
12476 |
++ if (!tfm) { |
12477 |
++ len = sprintf(buffer, "init\n"); |
12478 |
++ goto unlock; |
12479 |
++ } |
12480 |
++ |
12481 |
++ name = crypto_tfm_alg_driver_name(crypto_shash_tfm(tfm)); |
12482 |
++ len = sprintf(buffer, "%s\n", name); |
12483 |
++ |
12484 |
++unlock: |
12485 |
++ rcu_read_unlock(); |
12486 |
++ |
12487 |
++ return len; |
12488 |
+ } |
12489 |
+ |
12490 |
+ module_param_call(transform, NULL, crc_t10dif_transform_show, NULL, 0644); |
12491 |
+diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c |
12492 |
+index 8f199f403ab5..e3755d1f74bd 100644 |
12493 |
+--- a/lib/dynamic_debug.c |
12494 |
++++ b/lib/dynamic_debug.c |
12495 |
+@@ -87,22 +87,22 @@ static struct { unsigned flag:8; char opt_char; } opt_array[] = { |
12496 |
+ { _DPRINTK_FLAGS_NONE, '_' }, |
12497 |
+ }; |
12498 |
+ |
12499 |
++struct flagsbuf { char buf[ARRAY_SIZE(opt_array)+1]; }; |
12500 |
++ |
12501 |
+ /* format a string into buf[] which describes the _ddebug's flags */ |
12502 |
+-static char *ddebug_describe_flags(struct _ddebug *dp, char *buf, |
12503 |
+- size_t maxlen) |
12504 |
++static char *ddebug_describe_flags(unsigned int flags, struct flagsbuf *fb) |
12505 |
+ { |
12506 |
+- char *p = buf; |
12507 |
++ char *p = fb->buf; |
12508 |
+ int i; |
12509 |
+ |
12510 |
+- BUG_ON(maxlen < 6); |
12511 |
+ for (i = 0; i < ARRAY_SIZE(opt_array); ++i) |
12512 |
+- if (dp->flags & opt_array[i].flag) |
12513 |
++ if (flags & opt_array[i].flag) |
12514 |
+ *p++ = opt_array[i].opt_char; |
12515 |
+- if (p == buf) |
12516 |
++ if (p == fb->buf) |
12517 |
+ *p++ = '_'; |
12518 |
+ *p = '\0'; |
12519 |
+ |
12520 |
+- return buf; |
12521 |
++ return fb->buf; |
12522 |
+ } |
12523 |
+ |
12524 |
+ #define vpr_info(fmt, ...) \ |
12525 |
+@@ -144,7 +144,7 @@ static int ddebug_change(const struct ddebug_query *query, |
12526 |
+ struct ddebug_table *dt; |
12527 |
+ unsigned int newflags; |
12528 |
+ unsigned int nfound = 0; |
12529 |
+- char flagbuf[10]; |
12530 |
++ struct flagsbuf fbuf; |
12531 |
+ |
12532 |
+ /* search for matching ddebugs */ |
12533 |
+ mutex_lock(&ddebug_lock); |
12534 |
+@@ -201,8 +201,7 @@ static int ddebug_change(const struct ddebug_query *query, |
12535 |
+ vpr_info("changed %s:%d [%s]%s =%s\n", |
12536 |
+ trim_prefix(dp->filename), dp->lineno, |
12537 |
+ dt->mod_name, dp->function, |
12538 |
+- ddebug_describe_flags(dp, flagbuf, |
12539 |
+- sizeof(flagbuf))); |
12540 |
++ ddebug_describe_flags(dp->flags, &fbuf)); |
12541 |
+ } |
12542 |
+ } |
12543 |
+ mutex_unlock(&ddebug_lock); |
12544 |
+@@ -816,7 +815,7 @@ static int ddebug_proc_show(struct seq_file *m, void *p) |
12545 |
+ { |
12546 |
+ struct ddebug_iter *iter = m->private; |
12547 |
+ struct _ddebug *dp = p; |
12548 |
+- char flagsbuf[10]; |
12549 |
++ struct flagsbuf flags; |
12550 |
+ |
12551 |
+ vpr_info("called m=%p p=%p\n", m, p); |
12552 |
+ |
12553 |
+@@ -829,7 +828,7 @@ static int ddebug_proc_show(struct seq_file *m, void *p) |
12554 |
+ seq_printf(m, "%s:%u [%s]%s =%s \"", |
12555 |
+ trim_prefix(dp->filename), dp->lineno, |
12556 |
+ iter->table->mod_name, dp->function, |
12557 |
+- ddebug_describe_flags(dp, flagsbuf, sizeof(flagsbuf))); |
12558 |
++ ddebug_describe_flags(dp->flags, &flags)); |
12559 |
+ seq_escape(m, dp->format, "\t\r\n\""); |
12560 |
+ seq_puts(m, "\"\n"); |
12561 |
+ |
12562 |
+diff --git a/lib/kobject.c b/lib/kobject.c |
12563 |
+index 83198cb37d8d..386873bdd51c 100644 |
12564 |
+--- a/lib/kobject.c |
12565 |
++++ b/lib/kobject.c |
12566 |
+@@ -599,14 +599,7 @@ out: |
12567 |
+ } |
12568 |
+ EXPORT_SYMBOL_GPL(kobject_move); |
12569 |
+ |
12570 |
+-/** |
12571 |
+- * kobject_del() - Unlink kobject from hierarchy. |
12572 |
+- * @kobj: object. |
12573 |
+- * |
12574 |
+- * This is the function that should be called to delete an object |
12575 |
+- * successfully added via kobject_add(). |
12576 |
+- */ |
12577 |
+-void kobject_del(struct kobject *kobj) |
12578 |
++static void __kobject_del(struct kobject *kobj) |
12579 |
+ { |
12580 |
+ struct kernfs_node *sd; |
12581 |
+ const struct kobj_type *ktype; |
12582 |
+@@ -625,9 +618,23 @@ void kobject_del(struct kobject *kobj) |
12583 |
+ |
12584 |
+ kobj->state_in_sysfs = 0; |
12585 |
+ kobj_kset_leave(kobj); |
12586 |
+- kobject_put(kobj->parent); |
12587 |
+ kobj->parent = NULL; |
12588 |
+ } |
12589 |
++ |
12590 |
++/** |
12591 |
++ * kobject_del() - Unlink kobject from hierarchy. |
12592 |
++ * @kobj: object. |
12593 |
++ * |
12594 |
++ * This is the function that should be called to delete an object |
12595 |
++ * successfully added via kobject_add(). |
12596 |
++ */ |
12597 |
++void kobject_del(struct kobject *kobj) |
12598 |
++{ |
12599 |
++ struct kobject *parent = kobj->parent; |
12600 |
++ |
12601 |
++ __kobject_del(kobj); |
12602 |
++ kobject_put(parent); |
12603 |
++} |
12604 |
+ EXPORT_SYMBOL(kobject_del); |
12605 |
+ |
12606 |
+ /** |
12607 |
+@@ -663,6 +670,7 @@ EXPORT_SYMBOL(kobject_get_unless_zero); |
12608 |
+ */ |
12609 |
+ static void kobject_cleanup(struct kobject *kobj) |
12610 |
+ { |
12611 |
++ struct kobject *parent = kobj->parent; |
12612 |
+ struct kobj_type *t = get_ktype(kobj); |
12613 |
+ const char *name = kobj->name; |
12614 |
+ |
12615 |
+@@ -684,7 +692,10 @@ static void kobject_cleanup(struct kobject *kobj) |
12616 |
+ if (kobj->state_in_sysfs) { |
12617 |
+ pr_debug("kobject: '%s' (%p): auto cleanup kobject_del\n", |
12618 |
+ kobject_name(kobj), kobj); |
12619 |
+- kobject_del(kobj); |
12620 |
++ __kobject_del(kobj); |
12621 |
++ } else { |
12622 |
++ /* avoid dropping the parent reference unnecessarily */ |
12623 |
++ parent = NULL; |
12624 |
+ } |
12625 |
+ |
12626 |
+ if (t && t->release) { |
12627 |
+@@ -698,6 +709,8 @@ static void kobject_cleanup(struct kobject *kobj) |
12628 |
+ pr_debug("kobject: '%s': free name\n", name); |
12629 |
+ kfree_const(name); |
12630 |
+ } |
12631 |
++ |
12632 |
++ kobject_put(parent); |
12633 |
+ } |
12634 |
+ |
12635 |
+ #ifdef CONFIG_DEBUG_KOBJECT_RELEASE |
12636 |
+diff --git a/mm/mmap.c b/mm/mmap.c |
12637 |
+index bb1822ac9909..55bb456fd0d0 100644 |
12638 |
+--- a/mm/mmap.c |
12639 |
++++ b/mm/mmap.c |
12640 |
+@@ -3171,6 +3171,7 @@ void exit_mmap(struct mm_struct *mm) |
12641 |
+ if (vma->vm_flags & VM_ACCOUNT) |
12642 |
+ nr_accounted += vma_pages(vma); |
12643 |
+ vma = remove_vma(vma); |
12644 |
++ cond_resched(); |
12645 |
+ } |
12646 |
+ vm_unacct_memory(nr_accounted); |
12647 |
+ } |
12648 |
+diff --git a/net/bluetooth/6lowpan.c b/net/bluetooth/6lowpan.c |
12649 |
+index 4febc82a7c76..52fb6d6d6d58 100644 |
12650 |
+--- a/net/bluetooth/6lowpan.c |
12651 |
++++ b/net/bluetooth/6lowpan.c |
12652 |
+@@ -50,6 +50,7 @@ static bool enable_6lowpan; |
12653 |
+ /* We are listening incoming connections via this channel |
12654 |
+ */ |
12655 |
+ static struct l2cap_chan *listen_chan; |
12656 |
++static DEFINE_MUTEX(set_lock); |
12657 |
+ |
12658 |
+ struct lowpan_peer { |
12659 |
+ struct list_head list; |
12660 |
+@@ -1070,12 +1071,14 @@ static void do_enable_set(struct work_struct *work) |
12661 |
+ |
12662 |
+ enable_6lowpan = set_enable->flag; |
12663 |
+ |
12664 |
++ mutex_lock(&set_lock); |
12665 |
+ if (listen_chan) { |
12666 |
+ l2cap_chan_close(listen_chan, 0); |
12667 |
+ l2cap_chan_put(listen_chan); |
12668 |
+ } |
12669 |
+ |
12670 |
+ listen_chan = bt_6lowpan_listen(); |
12671 |
++ mutex_unlock(&set_lock); |
12672 |
+ |
12673 |
+ kfree(set_enable); |
12674 |
+ } |
12675 |
+@@ -1127,11 +1130,13 @@ static ssize_t lowpan_control_write(struct file *fp, |
12676 |
+ if (ret == -EINVAL) |
12677 |
+ return ret; |
12678 |
+ |
12679 |
++ mutex_lock(&set_lock); |
12680 |
+ if (listen_chan) { |
12681 |
+ l2cap_chan_close(listen_chan, 0); |
12682 |
+ l2cap_chan_put(listen_chan); |
12683 |
+ listen_chan = NULL; |
12684 |
+ } |
12685 |
++ mutex_unlock(&set_lock); |
12686 |
+ |
12687 |
+ if (conn) { |
12688 |
+ struct lowpan_peer *peer; |
12689 |
+diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c |
12690 |
+index 2e7bc2da8371..c17e1a3e8218 100644 |
12691 |
+--- a/net/bluetooth/hci_core.c |
12692 |
++++ b/net/bluetooth/hci_core.c |
12693 |
+@@ -605,7 +605,8 @@ static int hci_init3_req(struct hci_request *req, unsigned long opt) |
12694 |
+ if (hdev->commands[8] & 0x01) |
12695 |
+ hci_req_add(req, HCI_OP_READ_PAGE_SCAN_ACTIVITY, 0, NULL); |
12696 |
+ |
12697 |
+- if (hdev->commands[18] & 0x04) |
12698 |
++ if (hdev->commands[18] & 0x04 && |
12699 |
++ !test_bit(HCI_QUIRK_BROKEN_ERR_DATA_REPORTING, &hdev->quirks)) |
12700 |
+ hci_req_add(req, HCI_OP_READ_DEF_ERR_DATA_REPORTING, 0, NULL); |
12701 |
+ |
12702 |
+ /* Some older Broadcom based Bluetooth 1.2 controllers do not |
12703 |
+@@ -846,7 +847,8 @@ static int hci_init4_req(struct hci_request *req, unsigned long opt) |
12704 |
+ /* Set erroneous data reporting if supported to the wideband speech |
12705 |
+ * setting value |
12706 |
+ */ |
12707 |
+- if (hdev->commands[18] & 0x08) { |
12708 |
++ if (hdev->commands[18] & 0x08 && |
12709 |
++ !test_bit(HCI_QUIRK_BROKEN_ERR_DATA_REPORTING, &hdev->quirks)) { |
12710 |
+ bool enabled = hci_dev_test_flag(hdev, |
12711 |
+ HCI_WIDEBAND_SPEECH_ENABLED); |
12712 |
+ |
12713 |
+@@ -3280,10 +3282,10 @@ static int hci_suspend_wait_event(struct hci_dev *hdev) |
12714 |
+ WAKE_COND, SUSPEND_NOTIFIER_TIMEOUT); |
12715 |
+ |
12716 |
+ if (ret == 0) { |
12717 |
+- bt_dev_dbg(hdev, "Timed out waiting for suspend"); |
12718 |
++ bt_dev_err(hdev, "Timed out waiting for suspend events"); |
12719 |
+ for (i = 0; i < __SUSPEND_NUM_TASKS; ++i) { |
12720 |
+ if (test_bit(i, hdev->suspend_tasks)) |
12721 |
+- bt_dev_dbg(hdev, "Bit %d is set", i); |
12722 |
++ bt_dev_err(hdev, "Suspend timeout bit: %d", i); |
12723 |
+ clear_bit(i, hdev->suspend_tasks); |
12724 |
+ } |
12725 |
+ |
12726 |
+@@ -3349,12 +3351,15 @@ static int hci_suspend_notifier(struct notifier_block *nb, unsigned long action, |
12727 |
+ ret = hci_change_suspend_state(hdev, BT_RUNNING); |
12728 |
+ } |
12729 |
+ |
12730 |
+- /* If suspend failed, restore it to running */ |
12731 |
+- if (ret && action == PM_SUSPEND_PREPARE) |
12732 |
+- hci_change_suspend_state(hdev, BT_RUNNING); |
12733 |
+- |
12734 |
+ done: |
12735 |
+- return ret ? notifier_from_errno(-EBUSY) : NOTIFY_STOP; |
12736 |
++ /* We always allow suspend even if suspend preparation failed and |
12737 |
++ * attempt to recover in resume. |
12738 |
++ */ |
12739 |
++ if (ret) |
12740 |
++ bt_dev_err(hdev, "Suspend notifier action (%lu) failed: %d", |
12741 |
++ action, ret); |
12742 |
++ |
12743 |
++ return NOTIFY_STOP; |
12744 |
+ } |
12745 |
+ |
12746 |
+ /* Alloc HCI device */ |
12747 |
+@@ -3592,9 +3597,10 @@ void hci_unregister_dev(struct hci_dev *hdev) |
12748 |
+ |
12749 |
+ cancel_work_sync(&hdev->power_on); |
12750 |
+ |
12751 |
+- hci_dev_do_close(hdev); |
12752 |
+- |
12753 |
+ unregister_pm_notifier(&hdev->suspend_notifier); |
12754 |
++ cancel_work_sync(&hdev->suspend_prepare); |
12755 |
++ |
12756 |
++ hci_dev_do_close(hdev); |
12757 |
+ |
12758 |
+ if (!test_bit(HCI_INIT, &hdev->flags) && |
12759 |
+ !hci_dev_test_flag(hdev, HCI_SETUP) && |
12760 |
+diff --git a/net/core/sock.c b/net/core/sock.c |
12761 |
+index bc6fe4114374..7b0feeea61b6 100644 |
12762 |
+--- a/net/core/sock.c |
12763 |
++++ b/net/core/sock.c |
12764 |
+@@ -3354,6 +3354,16 @@ static void sock_inuse_add(struct net *net, int val) |
12765 |
+ } |
12766 |
+ #endif |
12767 |
+ |
12768 |
++static void tw_prot_cleanup(struct timewait_sock_ops *twsk_prot) |
12769 |
++{ |
12770 |
++ if (!twsk_prot) |
12771 |
++ return; |
12772 |
++ kfree(twsk_prot->twsk_slab_name); |
12773 |
++ twsk_prot->twsk_slab_name = NULL; |
12774 |
++ kmem_cache_destroy(twsk_prot->twsk_slab); |
12775 |
++ twsk_prot->twsk_slab = NULL; |
12776 |
++} |
12777 |
++ |
12778 |
+ static void req_prot_cleanup(struct request_sock_ops *rsk_prot) |
12779 |
+ { |
12780 |
+ if (!rsk_prot) |
12781 |
+@@ -3424,7 +3434,7 @@ int proto_register(struct proto *prot, int alloc_slab) |
12782 |
+ prot->slab_flags, |
12783 |
+ NULL); |
12784 |
+ if (prot->twsk_prot->twsk_slab == NULL) |
12785 |
+- goto out_free_timewait_sock_slab_name; |
12786 |
++ goto out_free_timewait_sock_slab; |
12787 |
+ } |
12788 |
+ } |
12789 |
+ |
12790 |
+@@ -3432,15 +3442,15 @@ int proto_register(struct proto *prot, int alloc_slab) |
12791 |
+ ret = assign_proto_idx(prot); |
12792 |
+ if (ret) { |
12793 |
+ mutex_unlock(&proto_list_mutex); |
12794 |
+- goto out_free_timewait_sock_slab_name; |
12795 |
++ goto out_free_timewait_sock_slab; |
12796 |
+ } |
12797 |
+ list_add(&prot->node, &proto_list); |
12798 |
+ mutex_unlock(&proto_list_mutex); |
12799 |
+ return ret; |
12800 |
+ |
12801 |
+-out_free_timewait_sock_slab_name: |
12802 |
++out_free_timewait_sock_slab: |
12803 |
+ if (alloc_slab && prot->twsk_prot) |
12804 |
+- kfree(prot->twsk_prot->twsk_slab_name); |
12805 |
++ tw_prot_cleanup(prot->twsk_prot); |
12806 |
+ out_free_request_sock_slab: |
12807 |
+ if (alloc_slab) { |
12808 |
+ req_prot_cleanup(prot->rsk_prot); |
12809 |
+@@ -3464,12 +3474,7 @@ void proto_unregister(struct proto *prot) |
12810 |
+ prot->slab = NULL; |
12811 |
+ |
12812 |
+ req_prot_cleanup(prot->rsk_prot); |
12813 |
+- |
12814 |
+- if (prot->twsk_prot != NULL && prot->twsk_prot->twsk_slab != NULL) { |
12815 |
+- kmem_cache_destroy(prot->twsk_prot->twsk_slab); |
12816 |
+- kfree(prot->twsk_prot->twsk_slab_name); |
12817 |
+- prot->twsk_prot->twsk_slab = NULL; |
12818 |
+- } |
12819 |
++ tw_prot_cleanup(prot->twsk_prot); |
12820 |
+ } |
12821 |
+ EXPORT_SYMBOL(proto_unregister); |
12822 |
+ |
12823 |
+diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c |
12824 |
+index 65c29f2bd89f..98aa90a28691 100644 |
12825 |
+--- a/net/ipv4/inet_connection_sock.c |
12826 |
++++ b/net/ipv4/inet_connection_sock.c |
12827 |
+@@ -296,6 +296,57 @@ static inline int sk_reuseport_match(struct inet_bind_bucket *tb, |
12828 |
+ ipv6_only_sock(sk), true, false); |
12829 |
+ } |
12830 |
+ |
12831 |
++void inet_csk_update_fastreuse(struct inet_bind_bucket *tb, |
12832 |
++ struct sock *sk) |
12833 |
++{ |
12834 |
++ kuid_t uid = sock_i_uid(sk); |
12835 |
++ bool reuse = sk->sk_reuse && sk->sk_state != TCP_LISTEN; |
12836 |
++ |
12837 |
++ if (hlist_empty(&tb->owners)) { |
12838 |
++ tb->fastreuse = reuse; |
12839 |
++ if (sk->sk_reuseport) { |
12840 |
++ tb->fastreuseport = FASTREUSEPORT_ANY; |
12841 |
++ tb->fastuid = uid; |
12842 |
++ tb->fast_rcv_saddr = sk->sk_rcv_saddr; |
12843 |
++ tb->fast_ipv6_only = ipv6_only_sock(sk); |
12844 |
++ tb->fast_sk_family = sk->sk_family; |
12845 |
++#if IS_ENABLED(CONFIG_IPV6) |
12846 |
++ tb->fast_v6_rcv_saddr = sk->sk_v6_rcv_saddr; |
12847 |
++#endif |
12848 |
++ } else { |
12849 |
++ tb->fastreuseport = 0; |
12850 |
++ } |
12851 |
++ } else { |
12852 |
++ if (!reuse) |
12853 |
++ tb->fastreuse = 0; |
12854 |
++ if (sk->sk_reuseport) { |
12855 |
++ /* We didn't match or we don't have fastreuseport set on |
12856 |
++ * the tb, but we have sk_reuseport set on this socket |
12857 |
++ * and we know that there are no bind conflicts with |
12858 |
++ * this socket in this tb, so reset our tb's reuseport |
12859 |
++ * settings so that any subsequent sockets that match |
12860 |
++ * our current socket will be put on the fast path. |
12861 |
++ * |
12862 |
++ * If we reset we need to set FASTREUSEPORT_STRICT so we |
12863 |
++ * do extra checking for all subsequent sk_reuseport |
12864 |
++ * socks. |
12865 |
++ */ |
12866 |
++ if (!sk_reuseport_match(tb, sk)) { |
12867 |
++ tb->fastreuseport = FASTREUSEPORT_STRICT; |
12868 |
++ tb->fastuid = uid; |
12869 |
++ tb->fast_rcv_saddr = sk->sk_rcv_saddr; |
12870 |
++ tb->fast_ipv6_only = ipv6_only_sock(sk); |
12871 |
++ tb->fast_sk_family = sk->sk_family; |
12872 |
++#if IS_ENABLED(CONFIG_IPV6) |
12873 |
++ tb->fast_v6_rcv_saddr = sk->sk_v6_rcv_saddr; |
12874 |
++#endif |
12875 |
++ } |
12876 |
++ } else { |
12877 |
++ tb->fastreuseport = 0; |
12878 |
++ } |
12879 |
++ } |
12880 |
++} |
12881 |
++ |
12882 |
+ /* Obtain a reference to a local port for the given sock, |
12883 |
+ * if snum is zero it means select any available local port. |
12884 |
+ * We try to allocate an odd port (and leave even ports for connect()) |
12885 |
+@@ -308,7 +359,6 @@ int inet_csk_get_port(struct sock *sk, unsigned short snum) |
12886 |
+ struct inet_bind_hashbucket *head; |
12887 |
+ struct net *net = sock_net(sk); |
12888 |
+ struct inet_bind_bucket *tb = NULL; |
12889 |
+- kuid_t uid = sock_i_uid(sk); |
12890 |
+ int l3mdev; |
12891 |
+ |
12892 |
+ l3mdev = inet_sk_bound_l3mdev(sk); |
12893 |
+@@ -345,49 +395,8 @@ tb_found: |
12894 |
+ goto fail_unlock; |
12895 |
+ } |
12896 |
+ success: |
12897 |
+- if (hlist_empty(&tb->owners)) { |
12898 |
+- tb->fastreuse = reuse; |
12899 |
+- if (sk->sk_reuseport) { |
12900 |
+- tb->fastreuseport = FASTREUSEPORT_ANY; |
12901 |
+- tb->fastuid = uid; |
12902 |
+- tb->fast_rcv_saddr = sk->sk_rcv_saddr; |
12903 |
+- tb->fast_ipv6_only = ipv6_only_sock(sk); |
12904 |
+- tb->fast_sk_family = sk->sk_family; |
12905 |
+-#if IS_ENABLED(CONFIG_IPV6) |
12906 |
+- tb->fast_v6_rcv_saddr = sk->sk_v6_rcv_saddr; |
12907 |
+-#endif |
12908 |
+- } else { |
12909 |
+- tb->fastreuseport = 0; |
12910 |
+- } |
12911 |
+- } else { |
12912 |
+- if (!reuse) |
12913 |
+- tb->fastreuse = 0; |
12914 |
+- if (sk->sk_reuseport) { |
12915 |
+- /* We didn't match or we don't have fastreuseport set on |
12916 |
+- * the tb, but we have sk_reuseport set on this socket |
12917 |
+- * and we know that there are no bind conflicts with |
12918 |
+- * this socket in this tb, so reset our tb's reuseport |
12919 |
+- * settings so that any subsequent sockets that match |
12920 |
+- * our current socket will be put on the fast path. |
12921 |
+- * |
12922 |
+- * If we reset we need to set FASTREUSEPORT_STRICT so we |
12923 |
+- * do extra checking for all subsequent sk_reuseport |
12924 |
+- * socks. |
12925 |
+- */ |
12926 |
+- if (!sk_reuseport_match(tb, sk)) { |
12927 |
+- tb->fastreuseport = FASTREUSEPORT_STRICT; |
12928 |
+- tb->fastuid = uid; |
12929 |
+- tb->fast_rcv_saddr = sk->sk_rcv_saddr; |
12930 |
+- tb->fast_ipv6_only = ipv6_only_sock(sk); |
12931 |
+- tb->fast_sk_family = sk->sk_family; |
12932 |
+-#if IS_ENABLED(CONFIG_IPV6) |
12933 |
+- tb->fast_v6_rcv_saddr = sk->sk_v6_rcv_saddr; |
12934 |
+-#endif |
12935 |
+- } |
12936 |
+- } else { |
12937 |
+- tb->fastreuseport = 0; |
12938 |
+- } |
12939 |
+- } |
12940 |
++ inet_csk_update_fastreuse(tb, sk); |
12941 |
++ |
12942 |
+ if (!inet_csk(sk)->icsk_bind_hash) |
12943 |
+ inet_bind_hash(sk, tb, port); |
12944 |
+ WARN_ON(inet_csk(sk)->icsk_bind_hash != tb); |
12945 |
+diff --git a/net/ipv4/inet_hashtables.c b/net/ipv4/inet_hashtables.c |
12946 |
+index 2bbaaf0c7176..006a34b18537 100644 |
12947 |
+--- a/net/ipv4/inet_hashtables.c |
12948 |
++++ b/net/ipv4/inet_hashtables.c |
12949 |
+@@ -163,6 +163,7 @@ int __inet_inherit_port(const struct sock *sk, struct sock *child) |
12950 |
+ return -ENOMEM; |
12951 |
+ } |
12952 |
+ } |
12953 |
++ inet_csk_update_fastreuse(tb, child); |
12954 |
+ } |
12955 |
+ inet_bind_hash(child, tb, port); |
12956 |
+ spin_unlock(&head->lock); |
12957 |
+diff --git a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c |
12958 |
+index 81b267e990a1..e07c1b429b09 100644 |
12959 |
+--- a/net/ipv4/sysctl_net_ipv4.c |
12960 |
++++ b/net/ipv4/sysctl_net_ipv4.c |
12961 |
+@@ -307,24 +307,16 @@ static int proc_tcp_fastopen_key(struct ctl_table *table, int write, |
12962 |
+ struct ctl_table tbl = { .maxlen = ((TCP_FASTOPEN_KEY_LENGTH * |
12963 |
+ 2 * TCP_FASTOPEN_KEY_MAX) + |
12964 |
+ (TCP_FASTOPEN_KEY_MAX * 5)) }; |
12965 |
+- struct tcp_fastopen_context *ctx; |
12966 |
+- u32 user_key[TCP_FASTOPEN_KEY_MAX * 4]; |
12967 |
+- __le32 key[TCP_FASTOPEN_KEY_MAX * 4]; |
12968 |
++ u32 user_key[TCP_FASTOPEN_KEY_BUF_LENGTH / sizeof(u32)]; |
12969 |
++ __le32 key[TCP_FASTOPEN_KEY_BUF_LENGTH / sizeof(__le32)]; |
12970 |
+ char *backup_data; |
12971 |
+- int ret, i = 0, off = 0, n_keys = 0; |
12972 |
++ int ret, i = 0, off = 0, n_keys; |
12973 |
+ |
12974 |
+ tbl.data = kmalloc(tbl.maxlen, GFP_KERNEL); |
12975 |
+ if (!tbl.data) |
12976 |
+ return -ENOMEM; |
12977 |
+ |
12978 |
+- rcu_read_lock(); |
12979 |
+- ctx = rcu_dereference(net->ipv4.tcp_fastopen_ctx); |
12980 |
+- if (ctx) { |
12981 |
+- n_keys = tcp_fastopen_context_len(ctx); |
12982 |
+- memcpy(&key[0], &ctx->key[0], TCP_FASTOPEN_KEY_LENGTH * n_keys); |
12983 |
+- } |
12984 |
+- rcu_read_unlock(); |
12985 |
+- |
12986 |
++ n_keys = tcp_fastopen_get_cipher(net, NULL, (u64 *)key); |
12987 |
+ if (!n_keys) { |
12988 |
+ memset(&key[0], 0, TCP_FASTOPEN_KEY_LENGTH); |
12989 |
+ n_keys = 1; |
12990 |
+diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c |
12991 |
+index eee18259a24e..4f11e68a4efa 100644 |
12992 |
+--- a/net/ipv4/tcp.c |
12993 |
++++ b/net/ipv4/tcp.c |
12994 |
+@@ -3538,22 +3538,14 @@ static int do_tcp_getsockopt(struct sock *sk, int level, |
12995 |
+ return 0; |
12996 |
+ |
12997 |
+ case TCP_FASTOPEN_KEY: { |
12998 |
+- __u8 key[TCP_FASTOPEN_KEY_BUF_LENGTH]; |
12999 |
+- struct tcp_fastopen_context *ctx; |
13000 |
+- unsigned int key_len = 0; |
13001 |
++ u64 key[TCP_FASTOPEN_KEY_BUF_LENGTH / sizeof(u64)]; |
13002 |
++ unsigned int key_len; |
13003 |
+ |
13004 |
+ if (get_user(len, optlen)) |
13005 |
+ return -EFAULT; |
13006 |
+ |
13007 |
+- rcu_read_lock(); |
13008 |
+- ctx = rcu_dereference(icsk->icsk_accept_queue.fastopenq.ctx); |
13009 |
+- if (ctx) { |
13010 |
+- key_len = tcp_fastopen_context_len(ctx) * |
13011 |
+- TCP_FASTOPEN_KEY_LENGTH; |
13012 |
+- memcpy(&key[0], &ctx->key[0], key_len); |
13013 |
+- } |
13014 |
+- rcu_read_unlock(); |
13015 |
+- |
13016 |
++ key_len = tcp_fastopen_get_cipher(net, icsk, key) * |
13017 |
++ TCP_FASTOPEN_KEY_LENGTH; |
13018 |
+ len = min_t(unsigned int, len, key_len); |
13019 |
+ if (put_user(len, optlen)) |
13020 |
+ return -EFAULT; |
13021 |
+diff --git a/net/ipv4/tcp_fastopen.c b/net/ipv4/tcp_fastopen.c |
13022 |
+index 19ad9586c720..1bb85821f1e6 100644 |
13023 |
+--- a/net/ipv4/tcp_fastopen.c |
13024 |
++++ b/net/ipv4/tcp_fastopen.c |
13025 |
+@@ -108,6 +108,29 @@ out: |
13026 |
+ return err; |
13027 |
+ } |
13028 |
+ |
13029 |
++int tcp_fastopen_get_cipher(struct net *net, struct inet_connection_sock *icsk, |
13030 |
++ u64 *key) |
13031 |
++{ |
13032 |
++ struct tcp_fastopen_context *ctx; |
13033 |
++ int n_keys = 0, i; |
13034 |
++ |
13035 |
++ rcu_read_lock(); |
13036 |
++ if (icsk) |
13037 |
++ ctx = rcu_dereference(icsk->icsk_accept_queue.fastopenq.ctx); |
13038 |
++ else |
13039 |
++ ctx = rcu_dereference(net->ipv4.tcp_fastopen_ctx); |
13040 |
++ if (ctx) { |
13041 |
++ n_keys = tcp_fastopen_context_len(ctx); |
13042 |
++ for (i = 0; i < n_keys; i++) { |
13043 |
++ put_unaligned_le64(ctx->key[i].key[0], key + (i * 2)); |
13044 |
++ put_unaligned_le64(ctx->key[i].key[1], key + (i * 2) + 1); |
13045 |
++ } |
13046 |
++ } |
13047 |
++ rcu_read_unlock(); |
13048 |
++ |
13049 |
++ return n_keys; |
13050 |
++} |
13051 |
++ |
13052 |
+ static bool __tcp_fastopen_cookie_gen_cipher(struct request_sock *req, |
13053 |
+ struct sk_buff *syn, |
13054 |
+ const siphash_key_t *key, |
13055 |
+diff --git a/net/netfilter/ipvs/ip_vs_core.c b/net/netfilter/ipvs/ip_vs_core.c |
13056 |
+index aa6a603a2425..517f6a2ac15a 100644 |
13057 |
+--- a/net/netfilter/ipvs/ip_vs_core.c |
13058 |
++++ b/net/netfilter/ipvs/ip_vs_core.c |
13059 |
+@@ -2066,14 +2066,14 @@ ip_vs_in(struct netns_ipvs *ipvs, unsigned int hooknum, struct sk_buff *skb, int |
13060 |
+ |
13061 |
+ conn_reuse_mode = sysctl_conn_reuse_mode(ipvs); |
13062 |
+ if (conn_reuse_mode && !iph.fragoffs && is_new_conn(skb, &iph) && cp) { |
13063 |
+- bool uses_ct = false, resched = false; |
13064 |
++ bool old_ct = false, resched = false; |
13065 |
+ |
13066 |
+ if (unlikely(sysctl_expire_nodest_conn(ipvs)) && cp->dest && |
13067 |
+ unlikely(!atomic_read(&cp->dest->weight))) { |
13068 |
+ resched = true; |
13069 |
+- uses_ct = ip_vs_conn_uses_conntrack(cp, skb); |
13070 |
++ old_ct = ip_vs_conn_uses_old_conntrack(cp, skb); |
13071 |
+ } else if (is_new_conn_expected(cp, conn_reuse_mode)) { |
13072 |
+- uses_ct = ip_vs_conn_uses_conntrack(cp, skb); |
13073 |
++ old_ct = ip_vs_conn_uses_old_conntrack(cp, skb); |
13074 |
+ if (!atomic_read(&cp->n_control)) { |
13075 |
+ resched = true; |
13076 |
+ } else { |
13077 |
+@@ -2081,15 +2081,17 @@ ip_vs_in(struct netns_ipvs *ipvs, unsigned int hooknum, struct sk_buff *skb, int |
13078 |
+ * that uses conntrack while it is still |
13079 |
+ * referenced by controlled connection(s). |
13080 |
+ */ |
13081 |
+- resched = !uses_ct; |
13082 |
++ resched = !old_ct; |
13083 |
+ } |
13084 |
+ } |
13085 |
+ |
13086 |
+ if (resched) { |
13087 |
++ if (!old_ct) |
13088 |
++ cp->flags &= ~IP_VS_CONN_F_NFCT; |
13089 |
+ if (!atomic_read(&cp->n_control)) |
13090 |
+ ip_vs_conn_expire_now(cp); |
13091 |
+ __ip_vs_conn_put(cp); |
13092 |
+- if (uses_ct) |
13093 |
++ if (old_ct) |
13094 |
+ return NF_DROP; |
13095 |
+ cp = NULL; |
13096 |
+ } |
13097 |
+diff --git a/net/netfilter/nft_meta.c b/net/netfilter/nft_meta.c |
13098 |
+index 951b6e87ed5d..7bc6537f3ccb 100644 |
13099 |
+--- a/net/netfilter/nft_meta.c |
13100 |
++++ b/net/netfilter/nft_meta.c |
13101 |
+@@ -253,7 +253,7 @@ static bool nft_meta_get_eval_ifname(enum nft_meta_keys key, u32 *dest, |
13102 |
+ return false; |
13103 |
+ break; |
13104 |
+ case NFT_META_IIFGROUP: |
13105 |
+- if (!nft_meta_store_ifgroup(dest, nft_out(pkt))) |
13106 |
++ if (!nft_meta_store_ifgroup(dest, nft_in(pkt))) |
13107 |
+ return false; |
13108 |
+ break; |
13109 |
+ case NFT_META_OIFGROUP: |
13110 |
+diff --git a/net/nfc/rawsock.c b/net/nfc/rawsock.c |
13111 |
+index ba5ffd3badd3..b5c867fe3232 100644 |
13112 |
+--- a/net/nfc/rawsock.c |
13113 |
++++ b/net/nfc/rawsock.c |
13114 |
+@@ -332,10 +332,13 @@ static int rawsock_create(struct net *net, struct socket *sock, |
13115 |
+ if ((sock->type != SOCK_SEQPACKET) && (sock->type != SOCK_RAW)) |
13116 |
+ return -ESOCKTNOSUPPORT; |
13117 |
+ |
13118 |
+- if (sock->type == SOCK_RAW) |
13119 |
++ if (sock->type == SOCK_RAW) { |
13120 |
++ if (!capable(CAP_NET_RAW)) |
13121 |
++ return -EPERM; |
13122 |
+ sock->ops = &rawsock_raw_ops; |
13123 |
+- else |
13124 |
++ } else { |
13125 |
+ sock->ops = &rawsock_ops; |
13126 |
++ } |
13127 |
+ |
13128 |
+ sk = sk_alloc(net, PF_NFC, GFP_ATOMIC, nfc_proto->proto, kern); |
13129 |
+ if (!sk) |
13130 |
+diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c |
13131 |
+index 29bd405adbbd..301f41d4929b 100644 |
13132 |
+--- a/net/packet/af_packet.c |
13133 |
++++ b/net/packet/af_packet.c |
13134 |
+@@ -942,6 +942,7 @@ static int prb_queue_frozen(struct tpacket_kbdq_core *pkc) |
13135 |
+ } |
13136 |
+ |
13137 |
+ static void prb_clear_blk_fill_status(struct packet_ring_buffer *rb) |
13138 |
++ __releases(&pkc->blk_fill_in_prog_lock) |
13139 |
+ { |
13140 |
+ struct tpacket_kbdq_core *pkc = GET_PBDQC_FROM_RB(rb); |
13141 |
+ atomic_dec(&pkc->blk_fill_in_prog); |
13142 |
+@@ -989,6 +990,7 @@ static void prb_fill_curr_block(char *curr, |
13143 |
+ struct tpacket_kbdq_core *pkc, |
13144 |
+ struct tpacket_block_desc *pbd, |
13145 |
+ unsigned int len) |
13146 |
++ __acquires(&pkc->blk_fill_in_prog_lock) |
13147 |
+ { |
13148 |
+ struct tpacket3_hdr *ppd; |
13149 |
+ |
13150 |
+@@ -2286,8 +2288,11 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev, |
13151 |
+ if (do_vnet && |
13152 |
+ virtio_net_hdr_from_skb(skb, h.raw + macoff - |
13153 |
+ sizeof(struct virtio_net_hdr), |
13154 |
+- vio_le(), true, 0)) |
13155 |
++ vio_le(), true, 0)) { |
13156 |
++ if (po->tp_version == TPACKET_V3) |
13157 |
++ prb_clear_blk_fill_status(&po->rx_ring); |
13158 |
+ goto drop_n_account; |
13159 |
++ } |
13160 |
+ |
13161 |
+ if (po->tp_version <= TPACKET_V2) { |
13162 |
+ packet_increment_rx_head(po, &po->rx_ring); |
13163 |
+@@ -2393,7 +2398,7 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev, |
13164 |
+ __clear_bit(slot_id, po->rx_ring.rx_owner_map); |
13165 |
+ spin_unlock(&sk->sk_receive_queue.lock); |
13166 |
+ sk->sk_data_ready(sk); |
13167 |
+- } else { |
13168 |
++ } else if (po->tp_version == TPACKET_V3) { |
13169 |
+ prb_clear_blk_fill_status(&po->rx_ring); |
13170 |
+ } |
13171 |
+ |
13172 |
+diff --git a/net/socket.c b/net/socket.c |
13173 |
+index 2dd739fba866..90e212410d37 100644 |
13174 |
+--- a/net/socket.c |
13175 |
++++ b/net/socket.c |
13176 |
+@@ -500,7 +500,7 @@ static struct socket *sockfd_lookup_light(int fd, int *err, int *fput_needed) |
13177 |
+ if (f.file) { |
13178 |
+ sock = sock_from_file(f.file, err); |
13179 |
+ if (likely(sock)) { |
13180 |
+- *fput_needed = f.flags; |
13181 |
++ *fput_needed = f.flags & FDPUT_FPUT; |
13182 |
+ return sock; |
13183 |
+ } |
13184 |
+ fdput(f); |
13185 |
+diff --git a/net/sunrpc/auth_gss/gss_krb5_wrap.c b/net/sunrpc/auth_gss/gss_krb5_wrap.c |
13186 |
+index cf0fd170ac18..90b8329fef82 100644 |
13187 |
+--- a/net/sunrpc/auth_gss/gss_krb5_wrap.c |
13188 |
++++ b/net/sunrpc/auth_gss/gss_krb5_wrap.c |
13189 |
+@@ -584,7 +584,7 @@ gss_unwrap_kerberos_v2(struct krb5_ctx *kctx, int offset, int len, |
13190 |
+ buf->head[0].iov_len); |
13191 |
+ memmove(ptr, ptr + GSS_KRB5_TOK_HDR_LEN + headskip, movelen); |
13192 |
+ buf->head[0].iov_len -= GSS_KRB5_TOK_HDR_LEN + headskip; |
13193 |
+- buf->len = len - GSS_KRB5_TOK_HDR_LEN + headskip; |
13194 |
++ buf->len = len - (GSS_KRB5_TOK_HDR_LEN + headskip); |
13195 |
+ |
13196 |
+ /* Trim off the trailing "extra count" and checksum blob */ |
13197 |
+ xdr_buf_trim(buf, ec + GSS_KRB5_TOK_HDR_LEN + tailskip); |
13198 |
+diff --git a/net/sunrpc/auth_gss/svcauth_gss.c b/net/sunrpc/auth_gss/svcauth_gss.c |
13199 |
+index 46027d0c903f..c28051f7d217 100644 |
13200 |
+--- a/net/sunrpc/auth_gss/svcauth_gss.c |
13201 |
++++ b/net/sunrpc/auth_gss/svcauth_gss.c |
13202 |
+@@ -958,7 +958,6 @@ unwrap_priv_data(struct svc_rqst *rqstp, struct xdr_buf *buf, u32 seq, struct gs |
13203 |
+ |
13204 |
+ maj_stat = gss_unwrap(ctx, 0, priv_len, buf); |
13205 |
+ pad = priv_len - buf->len; |
13206 |
+- buf->len -= pad; |
13207 |
+ /* The upper layers assume the buffer is aligned on 4-byte boundaries. |
13208 |
+ * In the krb5p case, at least, the data ends up offset, so we need to |
13209 |
+ * move it around. */ |
13210 |
+diff --git a/net/sunrpc/xprtrdma/svc_rdma_rw.c b/net/sunrpc/xprtrdma/svc_rdma_rw.c |
13211 |
+index 23c2d3ce0dc9..e0a0ae39848c 100644 |
13212 |
+--- a/net/sunrpc/xprtrdma/svc_rdma_rw.c |
13213 |
++++ b/net/sunrpc/xprtrdma/svc_rdma_rw.c |
13214 |
+@@ -678,7 +678,6 @@ static int svc_rdma_build_read_chunk(struct svc_rqst *rqstp, |
13215 |
+ struct svc_rdma_read_info *info, |
13216 |
+ __be32 *p) |
13217 |
+ { |
13218 |
+- unsigned int i; |
13219 |
+ int ret; |
13220 |
+ |
13221 |
+ ret = -EINVAL; |
13222 |
+@@ -701,12 +700,6 @@ static int svc_rdma_build_read_chunk(struct svc_rqst *rqstp, |
13223 |
+ info->ri_chunklen += rs_length; |
13224 |
+ } |
13225 |
+ |
13226 |
+- /* Pages under I/O have been copied to head->rc_pages. |
13227 |
+- * Prevent their premature release by svc_xprt_release() . |
13228 |
+- */ |
13229 |
+- for (i = 0; i < info->ri_readctxt->rc_page_count; i++) |
13230 |
+- rqstp->rq_pages[i] = NULL; |
13231 |
+- |
13232 |
+ return ret; |
13233 |
+ } |
13234 |
+ |
13235 |
+@@ -801,6 +794,26 @@ out: |
13236 |
+ return ret; |
13237 |
+ } |
13238 |
+ |
13239 |
++/* Pages under I/O have been copied to head->rc_pages. Ensure they |
13240 |
++ * are not released by svc_xprt_release() until the I/O is complete. |
13241 |
++ * |
13242 |
++ * This has to be done after all Read WRs are constructed to properly |
13243 |
++ * handle a page that is part of I/O on behalf of two different RDMA |
13244 |
++ * segments. |
13245 |
++ * |
13246 |
++ * Do this only if I/O has been posted. Otherwise, we do indeed want |
13247 |
++ * svc_xprt_release() to clean things up properly. |
13248 |
++ */ |
13249 |
++static void svc_rdma_save_io_pages(struct svc_rqst *rqstp, |
13250 |
++ const unsigned int start, |
13251 |
++ const unsigned int num_pages) |
13252 |
++{ |
13253 |
++ unsigned int i; |
13254 |
++ |
13255 |
++ for (i = start; i < num_pages + start; i++) |
13256 |
++ rqstp->rq_pages[i] = NULL; |
13257 |
++} |
13258 |
++ |
13259 |
+ /** |
13260 |
+ * svc_rdma_recv_read_chunk - Pull a Read chunk from the client |
13261 |
+ * @rdma: controlling RDMA transport |
13262 |
+@@ -854,6 +867,7 @@ int svc_rdma_recv_read_chunk(struct svcxprt_rdma *rdma, struct svc_rqst *rqstp, |
13263 |
+ ret = svc_rdma_post_chunk_ctxt(&info->ri_cc); |
13264 |
+ if (ret < 0) |
13265 |
+ goto out_err; |
13266 |
++ svc_rdma_save_io_pages(rqstp, 0, head->rc_page_count); |
13267 |
+ return 0; |
13268 |
+ |
13269 |
+ out_err: |
13270 |
+diff --git a/net/tls/tls_device.c b/net/tls/tls_device.c |
13271 |
+index a562ebaaa33c..0ad8b53a8ca4 100644 |
13272 |
+--- a/net/tls/tls_device.c |
13273 |
++++ b/net/tls/tls_device.c |
13274 |
+@@ -561,7 +561,7 @@ int tls_device_sendpage(struct sock *sk, struct page *page, |
13275 |
+ { |
13276 |
+ struct tls_context *tls_ctx = tls_get_ctx(sk); |
13277 |
+ struct iov_iter msg_iter; |
13278 |
+- char *kaddr = kmap(page); |
13279 |
++ char *kaddr; |
13280 |
+ struct kvec iov; |
13281 |
+ int rc; |
13282 |
+ |
13283 |
+@@ -576,6 +576,7 @@ int tls_device_sendpage(struct sock *sk, struct page *page, |
13284 |
+ goto out; |
13285 |
+ } |
13286 |
+ |
13287 |
++ kaddr = kmap(page); |
13288 |
+ iov.iov_base = kaddr + offset; |
13289 |
+ iov.iov_len = size; |
13290 |
+ iov_iter_kvec(&msg_iter, WRITE, &iov, 1, size); |
13291 |
+diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c |
13292 |
+index 626bf9044418..6cd0df1c5caf 100644 |
13293 |
+--- a/net/vmw_vsock/af_vsock.c |
13294 |
++++ b/net/vmw_vsock/af_vsock.c |
13295 |
+@@ -1032,7 +1032,7 @@ static __poll_t vsock_poll(struct file *file, struct socket *sock, |
13296 |
+ } |
13297 |
+ |
13298 |
+ /* Connected sockets that can produce data can be written. */ |
13299 |
+- if (sk->sk_state == TCP_ESTABLISHED) { |
13300 |
++ if (transport && sk->sk_state == TCP_ESTABLISHED) { |
13301 |
+ if (!(sk->sk_shutdown & SEND_SHUTDOWN)) { |
13302 |
+ bool space_avail_now = false; |
13303 |
+ int ret = transport->notify_poll_out( |
13304 |
+diff --git a/samples/bpf/fds_example.c b/samples/bpf/fds_example.c |
13305 |
+index d5992f787232..59f45fef5110 100644 |
13306 |
+--- a/samples/bpf/fds_example.c |
13307 |
++++ b/samples/bpf/fds_example.c |
13308 |
+@@ -30,6 +30,8 @@ |
13309 |
+ #define BPF_M_MAP 1 |
13310 |
+ #define BPF_M_PROG 2 |
13311 |
+ |
13312 |
++char bpf_log_buf[BPF_LOG_BUF_SIZE]; |
13313 |
++ |
13314 |
+ static void usage(void) |
13315 |
+ { |
13316 |
+ printf("Usage: fds_example [...]\n"); |
13317 |
+@@ -57,7 +59,6 @@ static int bpf_prog_create(const char *object) |
13318 |
+ BPF_EXIT_INSN(), |
13319 |
+ }; |
13320 |
+ size_t insns_cnt = sizeof(insns) / sizeof(struct bpf_insn); |
13321 |
+- char bpf_log_buf[BPF_LOG_BUF_SIZE]; |
13322 |
+ struct bpf_object *obj; |
13323 |
+ int prog_fd; |
13324 |
+ |
13325 |
+diff --git a/samples/bpf/map_perf_test_kern.c b/samples/bpf/map_perf_test_kern.c |
13326 |
+index 12e91ae64d4d..c9b31193ca12 100644 |
13327 |
+--- a/samples/bpf/map_perf_test_kern.c |
13328 |
++++ b/samples/bpf/map_perf_test_kern.c |
13329 |
+@@ -11,6 +11,8 @@ |
13330 |
+ #include <bpf/bpf_helpers.h> |
13331 |
+ #include "bpf_legacy.h" |
13332 |
+ #include <bpf/bpf_tracing.h> |
13333 |
++#include <bpf/bpf_core_read.h> |
13334 |
++#include "trace_common.h" |
13335 |
+ |
13336 |
+ #define MAX_ENTRIES 1000 |
13337 |
+ #define MAX_NR_CPUS 1024 |
13338 |
+@@ -154,9 +156,10 @@ int stress_percpu_hmap_alloc(struct pt_regs *ctx) |
13339 |
+ return 0; |
13340 |
+ } |
13341 |
+ |
13342 |
+-SEC("kprobe/sys_connect") |
13343 |
++SEC("kprobe/" SYSCALL(sys_connect)) |
13344 |
+ int stress_lru_hmap_alloc(struct pt_regs *ctx) |
13345 |
+ { |
13346 |
++ struct pt_regs *real_regs = (struct pt_regs *)PT_REGS_PARM1_CORE(ctx); |
13347 |
+ char fmt[] = "Failed at stress_lru_hmap_alloc. ret:%dn"; |
13348 |
+ union { |
13349 |
+ u16 dst6[8]; |
13350 |
+@@ -175,8 +178,8 @@ int stress_lru_hmap_alloc(struct pt_regs *ctx) |
13351 |
+ long val = 1; |
13352 |
+ u32 key = 0; |
13353 |
+ |
13354 |
+- in6 = (struct sockaddr_in6 *)PT_REGS_PARM2(ctx); |
13355 |
+- addrlen = (int)PT_REGS_PARM3(ctx); |
13356 |
++ in6 = (struct sockaddr_in6 *)PT_REGS_PARM2_CORE(real_regs); |
13357 |
++ addrlen = (int)PT_REGS_PARM3_CORE(real_regs); |
13358 |
+ |
13359 |
+ if (addrlen != sizeof(*in6)) |
13360 |
+ return 0; |
13361 |
+diff --git a/samples/bpf/test_map_in_map_kern.c b/samples/bpf/test_map_in_map_kern.c |
13362 |
+index 6cee61e8ce9b..36a203e69064 100644 |
13363 |
+--- a/samples/bpf/test_map_in_map_kern.c |
13364 |
++++ b/samples/bpf/test_map_in_map_kern.c |
13365 |
+@@ -13,6 +13,8 @@ |
13366 |
+ #include <bpf/bpf_helpers.h> |
13367 |
+ #include "bpf_legacy.h" |
13368 |
+ #include <bpf/bpf_tracing.h> |
13369 |
++#include <bpf/bpf_core_read.h> |
13370 |
++#include "trace_common.h" |
13371 |
+ |
13372 |
+ #define MAX_NR_PORTS 65536 |
13373 |
+ |
13374 |
+@@ -102,9 +104,10 @@ static __always_inline int do_inline_hash_lookup(void *inner_map, u32 port) |
13375 |
+ return result ? *result : -ENOENT; |
13376 |
+ } |
13377 |
+ |
13378 |
+-SEC("kprobe/sys_connect") |
13379 |
++SEC("kprobe/" SYSCALL(sys_connect)) |
13380 |
+ int trace_sys_connect(struct pt_regs *ctx) |
13381 |
+ { |
13382 |
++ struct pt_regs *real_regs = (struct pt_regs *)PT_REGS_PARM1_CORE(ctx); |
13383 |
+ struct sockaddr_in6 *in6; |
13384 |
+ u16 test_case, port, dst6[8]; |
13385 |
+ int addrlen, ret, inline_ret, ret_key = 0; |
13386 |
+@@ -112,8 +115,8 @@ int trace_sys_connect(struct pt_regs *ctx) |
13387 |
+ void *outer_map, *inner_map; |
13388 |
+ bool inline_hash = false; |
13389 |
+ |
13390 |
+- in6 = (struct sockaddr_in6 *)PT_REGS_PARM2(ctx); |
13391 |
+- addrlen = (int)PT_REGS_PARM3(ctx); |
13392 |
++ in6 = (struct sockaddr_in6 *)PT_REGS_PARM2_CORE(real_regs); |
13393 |
++ addrlen = (int)PT_REGS_PARM3_CORE(real_regs); |
13394 |
+ |
13395 |
+ if (addrlen != sizeof(*in6)) |
13396 |
+ return 0; |
13397 |
+diff --git a/samples/bpf/test_probe_write_user_kern.c b/samples/bpf/test_probe_write_user_kern.c |
13398 |
+index f033f36a13a3..fd651a65281e 100644 |
13399 |
+--- a/samples/bpf/test_probe_write_user_kern.c |
13400 |
++++ b/samples/bpf/test_probe_write_user_kern.c |
13401 |
+@@ -10,6 +10,8 @@ |
13402 |
+ #include <linux/version.h> |
13403 |
+ #include <bpf/bpf_helpers.h> |
13404 |
+ #include <bpf/bpf_tracing.h> |
13405 |
++#include <bpf/bpf_core_read.h> |
13406 |
++#include "trace_common.h" |
13407 |
+ |
13408 |
+ struct bpf_map_def SEC("maps") dnat_map = { |
13409 |
+ .type = BPF_MAP_TYPE_HASH, |
13410 |
+@@ -26,13 +28,14 @@ struct bpf_map_def SEC("maps") dnat_map = { |
13411 |
+ * This example sits on a syscall, and the syscall ABI is relatively stable |
13412 |
+ * of course, across platforms, and over time, the ABI may change. |
13413 |
+ */ |
13414 |
+-SEC("kprobe/sys_connect") |
13415 |
++SEC("kprobe/" SYSCALL(sys_connect)) |
13416 |
+ int bpf_prog1(struct pt_regs *ctx) |
13417 |
+ { |
13418 |
++ struct pt_regs *real_regs = (struct pt_regs *)PT_REGS_PARM1_CORE(ctx); |
13419 |
++ void *sockaddr_arg = (void *)PT_REGS_PARM2_CORE(real_regs); |
13420 |
++ int sockaddr_len = (int)PT_REGS_PARM3_CORE(real_regs); |
13421 |
+ struct sockaddr_in new_addr, orig_addr = {}; |
13422 |
+ struct sockaddr_in *mapped_addr; |
13423 |
+- void *sockaddr_arg = (void *)PT_REGS_PARM2(ctx); |
13424 |
+- int sockaddr_len = (int)PT_REGS_PARM3(ctx); |
13425 |
+ |
13426 |
+ if (sockaddr_len > sizeof(orig_addr)) |
13427 |
+ return 0; |
13428 |
+diff --git a/scripts/recordmcount.c b/scripts/recordmcount.c |
13429 |
+index 7225107a9aaf..e59022b3f125 100644 |
13430 |
+--- a/scripts/recordmcount.c |
13431 |
++++ b/scripts/recordmcount.c |
13432 |
+@@ -434,6 +434,11 @@ static int arm_is_fake_mcount(Elf32_Rel const *rp) |
13433 |
+ return 1; |
13434 |
+ } |
13435 |
+ |
13436 |
++static int arm64_is_fake_mcount(Elf64_Rel const *rp) |
13437 |
++{ |
13438 |
++ return ELF64_R_TYPE(w(rp->r_info)) != R_AARCH64_CALL26; |
13439 |
++} |
13440 |
++ |
13441 |
+ /* 64-bit EM_MIPS has weird ELF64_Rela.r_info. |
13442 |
+ * http://techpubs.sgi.com/library/manuals/4000/007-4658-001/pdf/007-4658-001.pdf |
13443 |
+ * We interpret Table 29 Relocation Operation (Elf64_Rel, Elf64_Rela) [p.40] |
13444 |
+@@ -547,6 +552,7 @@ static int do_file(char const *const fname) |
13445 |
+ make_nop = make_nop_arm64; |
13446 |
+ rel_type_nop = R_AARCH64_NONE; |
13447 |
+ ideal_nop = ideal_nop4_arm64; |
13448 |
++ is_fake_mcount64 = arm64_is_fake_mcount; |
13449 |
+ break; |
13450 |
+ case EM_IA_64: reltype = R_IA64_IMM64; break; |
13451 |
+ case EM_MIPS: /* reltype: e_class */ break; |
13452 |
+diff --git a/scripts/selinux/mdp/mdp.c b/scripts/selinux/mdp/mdp.c |
13453 |
+index 576d11a60417..6ceb88eb9b59 100644 |
13454 |
+--- a/scripts/selinux/mdp/mdp.c |
13455 |
++++ b/scripts/selinux/mdp/mdp.c |
13456 |
+@@ -67,8 +67,14 @@ int main(int argc, char *argv[]) |
13457 |
+ |
13458 |
+ initial_sid_to_string_len = sizeof(initial_sid_to_string) / sizeof (char *); |
13459 |
+ /* print out the sids */ |
13460 |
+- for (i = 1; i < initial_sid_to_string_len; i++) |
13461 |
+- fprintf(fout, "sid %s\n", initial_sid_to_string[i]); |
13462 |
++ for (i = 1; i < initial_sid_to_string_len; i++) { |
13463 |
++ const char *name = initial_sid_to_string[i]; |
13464 |
++ |
13465 |
++ if (name) |
13466 |
++ fprintf(fout, "sid %s\n", name); |
13467 |
++ else |
13468 |
++ fprintf(fout, "sid unused%d\n", i); |
13469 |
++ } |
13470 |
+ fprintf(fout, "\n"); |
13471 |
+ |
13472 |
+ /* print out the class permissions */ |
13473 |
+@@ -126,9 +132,16 @@ int main(int argc, char *argv[]) |
13474 |
+ #define OBJUSERROLETYPE "user_u:object_r:base_t" |
13475 |
+ |
13476 |
+ /* default sids */ |
13477 |
+- for (i = 1; i < initial_sid_to_string_len; i++) |
13478 |
+- fprintf(fout, "sid %s " SUBJUSERROLETYPE "%s\n", |
13479 |
+- initial_sid_to_string[i], mls ? ":" SYSTEMLOW : ""); |
13480 |
++ for (i = 1; i < initial_sid_to_string_len; i++) { |
13481 |
++ const char *name = initial_sid_to_string[i]; |
13482 |
++ |
13483 |
++ if (name) |
13484 |
++ fprintf(fout, "sid %s ", name); |
13485 |
++ else |
13486 |
++ fprintf(fout, "sid unused%d\n", i); |
13487 |
++ fprintf(fout, SUBJUSERROLETYPE "%s\n", |
13488 |
++ mls ? ":" SYSTEMLOW : ""); |
13489 |
++ } |
13490 |
+ fprintf(fout, "\n"); |
13491 |
+ |
13492 |
+ #define FS_USE(behavior, fstype) \ |
13493 |
+diff --git a/security/integrity/ima/ima.h b/security/integrity/ima/ima.h |
13494 |
+index 495e28bd488e..04c246b2b767 100644 |
13495 |
+--- a/security/integrity/ima/ima.h |
13496 |
++++ b/security/integrity/ima/ima.h |
13497 |
+@@ -400,6 +400,7 @@ static inline void ima_free_modsig(struct modsig *modsig) |
13498 |
+ #ifdef CONFIG_IMA_LSM_RULES |
13499 |
+ |
13500 |
+ #define security_filter_rule_init security_audit_rule_init |
13501 |
++#define security_filter_rule_free security_audit_rule_free |
13502 |
+ #define security_filter_rule_match security_audit_rule_match |
13503 |
+ |
13504 |
+ #else |
13505 |
+@@ -410,6 +411,10 @@ static inline int security_filter_rule_init(u32 field, u32 op, char *rulestr, |
13506 |
+ return -EINVAL; |
13507 |
+ } |
13508 |
+ |
13509 |
++static inline void security_filter_rule_free(void *lsmrule) |
13510 |
++{ |
13511 |
++} |
13512 |
++ |
13513 |
+ static inline int security_filter_rule_match(u32 secid, u32 field, u32 op, |
13514 |
+ void *lsmrule) |
13515 |
+ { |
13516 |
+diff --git a/security/integrity/ima/ima_policy.c b/security/integrity/ima/ima_policy.c |
13517 |
+index e493063a3c34..3e3e568c8130 100644 |
13518 |
+--- a/security/integrity/ima/ima_policy.c |
13519 |
++++ b/security/integrity/ima/ima_policy.c |
13520 |
+@@ -258,9 +258,24 @@ static void ima_lsm_free_rule(struct ima_rule_entry *entry) |
13521 |
+ int i; |
13522 |
+ |
13523 |
+ for (i = 0; i < MAX_LSM_RULES; i++) { |
13524 |
+- kfree(entry->lsm[i].rule); |
13525 |
++ security_filter_rule_free(entry->lsm[i].rule); |
13526 |
+ kfree(entry->lsm[i].args_p); |
13527 |
+ } |
13528 |
++} |
13529 |
++ |
13530 |
++static void ima_free_rule(struct ima_rule_entry *entry) |
13531 |
++{ |
13532 |
++ if (!entry) |
13533 |
++ return; |
13534 |
++ |
13535 |
++ /* |
13536 |
++ * entry->template->fields may be allocated in ima_parse_rule() but that |
13537 |
++ * reference is owned by the corresponding ima_template_desc element in |
13538 |
++ * the defined_templates list and cannot be freed here |
13539 |
++ */ |
13540 |
++ kfree(entry->fsname); |
13541 |
++ kfree(entry->keyrings); |
13542 |
++ ima_lsm_free_rule(entry); |
13543 |
+ kfree(entry); |
13544 |
+ } |
13545 |
+ |
13546 |
+@@ -302,6 +317,7 @@ static struct ima_rule_entry *ima_lsm_copy_rule(struct ima_rule_entry *entry) |
13547 |
+ |
13548 |
+ out_err: |
13549 |
+ ima_lsm_free_rule(nentry); |
13550 |
++ kfree(nentry); |
13551 |
+ return NULL; |
13552 |
+ } |
13553 |
+ |
13554 |
+@@ -315,11 +331,29 @@ static int ima_lsm_update_rule(struct ima_rule_entry *entry) |
13555 |
+ |
13556 |
+ list_replace_rcu(&entry->list, &nentry->list); |
13557 |
+ synchronize_rcu(); |
13558 |
++ /* |
13559 |
++ * ima_lsm_copy_rule() shallow copied all references, except for the |
13560 |
++ * LSM references, from entry to nentry so we only want to free the LSM |
13561 |
++ * references and the entry itself. All other memory refrences will now |
13562 |
++ * be owned by nentry. |
13563 |
++ */ |
13564 |
+ ima_lsm_free_rule(entry); |
13565 |
++ kfree(entry); |
13566 |
+ |
13567 |
+ return 0; |
13568 |
+ } |
13569 |
+ |
13570 |
++static bool ima_rule_contains_lsm_cond(struct ima_rule_entry *entry) |
13571 |
++{ |
13572 |
++ int i; |
13573 |
++ |
13574 |
++ for (i = 0; i < MAX_LSM_RULES; i++) |
13575 |
++ if (entry->lsm[i].args_p) |
13576 |
++ return true; |
13577 |
++ |
13578 |
++ return false; |
13579 |
++} |
13580 |
++ |
13581 |
+ /* |
13582 |
+ * The LSM policy can be reloaded, leaving the IMA LSM based rules referring |
13583 |
+ * to the old, stale LSM policy. Update the IMA LSM based rules to reflect |
13584 |
+@@ -890,6 +924,7 @@ static int ima_lsm_rule_init(struct ima_rule_entry *entry, |
13585 |
+ |
13586 |
+ if (ima_rules == &ima_default_rules) { |
13587 |
+ kfree(entry->lsm[lsm_rule].args_p); |
13588 |
++ entry->lsm[lsm_rule].args_p = NULL; |
13589 |
+ result = -EINVAL; |
13590 |
+ } else |
13591 |
+ result = 0; |
13592 |
+@@ -949,6 +984,60 @@ static void check_template_modsig(const struct ima_template_desc *template) |
13593 |
+ #undef MSG |
13594 |
+ } |
13595 |
+ |
13596 |
++static bool ima_validate_rule(struct ima_rule_entry *entry) |
13597 |
++{ |
13598 |
++ /* Ensure that the action is set */ |
13599 |
++ if (entry->action == UNKNOWN) |
13600 |
++ return false; |
13601 |
++ |
13602 |
++ /* |
13603 |
++ * Ensure that the hook function is compatible with the other |
13604 |
++ * components of the rule |
13605 |
++ */ |
13606 |
++ switch (entry->func) { |
13607 |
++ case NONE: |
13608 |
++ case FILE_CHECK: |
13609 |
++ case MMAP_CHECK: |
13610 |
++ case BPRM_CHECK: |
13611 |
++ case CREDS_CHECK: |
13612 |
++ case POST_SETATTR: |
13613 |
++ case MODULE_CHECK: |
13614 |
++ case FIRMWARE_CHECK: |
13615 |
++ case KEXEC_KERNEL_CHECK: |
13616 |
++ case KEXEC_INITRAMFS_CHECK: |
13617 |
++ case POLICY_CHECK: |
13618 |
++ /* Validation of these hook functions is in ima_parse_rule() */ |
13619 |
++ break; |
13620 |
++ case KEXEC_CMDLINE: |
13621 |
++ if (entry->action & ~(MEASURE | DONT_MEASURE)) |
13622 |
++ return false; |
13623 |
++ |
13624 |
++ if (entry->flags & ~(IMA_FUNC | IMA_PCR)) |
13625 |
++ return false; |
13626 |
++ |
13627 |
++ if (ima_rule_contains_lsm_cond(entry)) |
13628 |
++ return false; |
13629 |
++ |
13630 |
++ break; |
13631 |
++ case KEY_CHECK: |
13632 |
++ if (entry->action & ~(MEASURE | DONT_MEASURE)) |
13633 |
++ return false; |
13634 |
++ |
13635 |
++ if (entry->flags & ~(IMA_FUNC | IMA_UID | IMA_PCR | |
13636 |
++ IMA_KEYRINGS)) |
13637 |
++ return false; |
13638 |
++ |
13639 |
++ if (ima_rule_contains_lsm_cond(entry)) |
13640 |
++ return false; |
13641 |
++ |
13642 |
++ break; |
13643 |
++ default: |
13644 |
++ return false; |
13645 |
++ } |
13646 |
++ |
13647 |
++ return true; |
13648 |
++} |
13649 |
++ |
13650 |
+ static int ima_parse_rule(char *rule, struct ima_rule_entry *entry) |
13651 |
+ { |
13652 |
+ struct audit_buffer *ab; |
13653 |
+@@ -1126,7 +1215,6 @@ static int ima_parse_rule(char *rule, struct ima_rule_entry *entry) |
13654 |
+ keyrings_len = strlen(args[0].from) + 1; |
13655 |
+ |
13656 |
+ if ((entry->keyrings) || |
13657 |
+- (entry->action != MEASURE) || |
13658 |
+ (entry->func != KEY_CHECK) || |
13659 |
+ (keyrings_len < 2)) { |
13660 |
+ result = -EINVAL; |
13661 |
+@@ -1332,7 +1420,7 @@ static int ima_parse_rule(char *rule, struct ima_rule_entry *entry) |
13662 |
+ break; |
13663 |
+ } |
13664 |
+ } |
13665 |
+- if (!result && (entry->action == UNKNOWN)) |
13666 |
++ if (!result && !ima_validate_rule(entry)) |
13667 |
+ result = -EINVAL; |
13668 |
+ else if (entry->action == APPRAISE) |
13669 |
+ temp_ima_appraise |= ima_appraise_flag(entry->func); |
13670 |
+@@ -1381,7 +1469,7 @@ ssize_t ima_parse_add_rule(char *rule) |
13671 |
+ |
13672 |
+ result = ima_parse_rule(p, entry); |
13673 |
+ if (result) { |
13674 |
+- kfree(entry); |
13675 |
++ ima_free_rule(entry); |
13676 |
+ integrity_audit_msg(AUDIT_INTEGRITY_STATUS, NULL, |
13677 |
+ NULL, op, "invalid-policy", result, |
13678 |
+ audit_info); |
13679 |
+@@ -1402,15 +1490,11 @@ ssize_t ima_parse_add_rule(char *rule) |
13680 |
+ void ima_delete_rules(void) |
13681 |
+ { |
13682 |
+ struct ima_rule_entry *entry, *tmp; |
13683 |
+- int i; |
13684 |
+ |
13685 |
+ temp_ima_appraise = 0; |
13686 |
+ list_for_each_entry_safe(entry, tmp, &ima_temp_rules, list) { |
13687 |
+- for (i = 0; i < MAX_LSM_RULES; i++) |
13688 |
+- kfree(entry->lsm[i].args_p); |
13689 |
+- |
13690 |
+ list_del(&entry->list); |
13691 |
+- kfree(entry); |
13692 |
++ ima_free_rule(entry); |
13693 |
+ } |
13694 |
+ } |
13695 |
+ |
13696 |
+diff --git a/security/smack/smackfs.c b/security/smack/smackfs.c |
13697 |
+index 840a192e9337..9c4308077574 100644 |
13698 |
+--- a/security/smack/smackfs.c |
13699 |
++++ b/security/smack/smackfs.c |
13700 |
+@@ -884,7 +884,7 @@ static ssize_t smk_set_cipso(struct file *file, const char __user *buf, |
13701 |
+ } |
13702 |
+ |
13703 |
+ ret = sscanf(rule, "%d", &maplevel); |
13704 |
+- if (ret != 1 || maplevel > SMACK_CIPSO_MAXLEVEL) |
13705 |
++ if (ret != 1 || maplevel < 0 || maplevel > SMACK_CIPSO_MAXLEVEL) |
13706 |
+ goto out; |
13707 |
+ |
13708 |
+ rule += SMK_DIGITLEN; |
13709 |
+@@ -905,6 +905,10 @@ static ssize_t smk_set_cipso(struct file *file, const char __user *buf, |
13710 |
+ |
13711 |
+ for (i = 0; i < catlen; i++) { |
13712 |
+ rule += SMK_DIGITLEN; |
13713 |
++ if (rule > data + count) { |
13714 |
++ rc = -EOVERFLOW; |
13715 |
++ goto out; |
13716 |
++ } |
13717 |
+ ret = sscanf(rule, "%u", &cat); |
13718 |
+ if (ret != 1 || cat > SMACK_CIPSO_MAXCATNUM) |
13719 |
+ goto out; |
13720 |
+diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c |
13721 |
+index b27d88c86067..313eecfb91b4 100644 |
13722 |
+--- a/sound/pci/hda/patch_realtek.c |
13723 |
++++ b/sound/pci/hda/patch_realtek.c |
13724 |
+@@ -4391,6 +4391,7 @@ static void alc233_fixup_lenovo_line2_mic_hotkey(struct hda_codec *codec, |
13725 |
+ { |
13726 |
+ struct alc_spec *spec = codec->spec; |
13727 |
+ |
13728 |
++ spec->micmute_led_polarity = 1; |
13729 |
+ alc_fixup_hp_gpio_led(codec, action, 0, 0x04); |
13730 |
+ if (action == HDA_FIXUP_ACT_PRE_PROBE) { |
13731 |
+ spec->init_amp = ALC_INIT_DEFAULT; |
13732 |
+diff --git a/sound/soc/codecs/hdac_hda.c b/sound/soc/codecs/hdac_hda.c |
13733 |
+index 473efe9ef998..b0370bb10c14 100644 |
13734 |
+--- a/sound/soc/codecs/hdac_hda.c |
13735 |
++++ b/sound/soc/codecs/hdac_hda.c |
13736 |
+@@ -289,7 +289,6 @@ static int hdac_hda_dai_open(struct snd_pcm_substream *substream, |
13737 |
+ struct hdac_hda_priv *hda_pvt; |
13738 |
+ struct hda_pcm_stream *hda_stream; |
13739 |
+ struct hda_pcm *pcm; |
13740 |
+- int ret; |
13741 |
+ |
13742 |
+ hda_pvt = snd_soc_component_get_drvdata(component); |
13743 |
+ pcm = snd_soc_find_pcm_from_dai(hda_pvt, dai); |
13744 |
+@@ -300,11 +299,7 @@ static int hdac_hda_dai_open(struct snd_pcm_substream *substream, |
13745 |
+ |
13746 |
+ hda_stream = &pcm->stream[substream->stream]; |
13747 |
+ |
13748 |
+- ret = hda_stream->ops.open(hda_stream, &hda_pvt->codec, substream); |
13749 |
+- if (ret < 0) |
13750 |
+- snd_hda_codec_pcm_put(pcm); |
13751 |
+- |
13752 |
+- return ret; |
13753 |
++ return hda_stream->ops.open(hda_stream, &hda_pvt->codec, substream); |
13754 |
+ } |
13755 |
+ |
13756 |
+ static void hdac_hda_dai_close(struct snd_pcm_substream *substream, |
13757 |
+diff --git a/sound/soc/codecs/tas2770.c b/sound/soc/codecs/tas2770.c |
13758 |
+index 54c8135fe43c..cf071121c839 100644 |
13759 |
+--- a/sound/soc/codecs/tas2770.c |
13760 |
++++ b/sound/soc/codecs/tas2770.c |
13761 |
+@@ -758,8 +758,7 @@ static int tas2770_i2c_probe(struct i2c_client *client, |
13762 |
+ } |
13763 |
+ } |
13764 |
+ |
13765 |
+- tas2770->reset_gpio = devm_gpiod_get_optional(tas2770->dev, |
13766 |
+- "reset-gpio", |
13767 |
++ tas2770->reset_gpio = devm_gpiod_get_optional(tas2770->dev, "reset", |
13768 |
+ GPIOD_OUT_HIGH); |
13769 |
+ if (IS_ERR(tas2770->reset_gpio)) { |
13770 |
+ if (PTR_ERR(tas2770->reset_gpio) == -EPROBE_DEFER) { |
13771 |
+diff --git a/sound/soc/fsl/fsl_sai.c b/sound/soc/fsl/fsl_sai.c |
13772 |
+index 9d436b0c5718..7031869a023a 100644 |
13773 |
+--- a/sound/soc/fsl/fsl_sai.c |
13774 |
++++ b/sound/soc/fsl/fsl_sai.c |
13775 |
+@@ -680,10 +680,11 @@ static int fsl_sai_dai_probe(struct snd_soc_dai *cpu_dai) |
13776 |
+ regmap_write(sai->regmap, FSL_SAI_RCSR(ofs), 0); |
13777 |
+ |
13778 |
+ regmap_update_bits(sai->regmap, FSL_SAI_TCR1(ofs), |
13779 |
+- FSL_SAI_CR1_RFW_MASK, |
13780 |
++ FSL_SAI_CR1_RFW_MASK(sai->soc_data->fifo_depth), |
13781 |
+ sai->soc_data->fifo_depth - FSL_SAI_MAXBURST_TX); |
13782 |
+ regmap_update_bits(sai->regmap, FSL_SAI_RCR1(ofs), |
13783 |
+- FSL_SAI_CR1_RFW_MASK, FSL_SAI_MAXBURST_RX - 1); |
13784 |
++ FSL_SAI_CR1_RFW_MASK(sai->soc_data->fifo_depth), |
13785 |
++ FSL_SAI_MAXBURST_RX - 1); |
13786 |
+ |
13787 |
+ snd_soc_dai_init_dma_data(cpu_dai, &sai->dma_params_tx, |
13788 |
+ &sai->dma_params_rx); |
13789 |
+diff --git a/sound/soc/fsl/fsl_sai.h b/sound/soc/fsl/fsl_sai.h |
13790 |
+index 76b15deea80c..6aba7d28f5f3 100644 |
13791 |
+--- a/sound/soc/fsl/fsl_sai.h |
13792 |
++++ b/sound/soc/fsl/fsl_sai.h |
13793 |
+@@ -94,7 +94,7 @@ |
13794 |
+ #define FSL_SAI_CSR_FRDE BIT(0) |
13795 |
+ |
13796 |
+ /* SAI Transmit and Receive Configuration 1 Register */ |
13797 |
+-#define FSL_SAI_CR1_RFW_MASK 0x1f |
13798 |
++#define FSL_SAI_CR1_RFW_MASK(x) ((x) - 1) |
13799 |
+ |
13800 |
+ /* SAI Transmit and Receive Configuration 2 Register */ |
13801 |
+ #define FSL_SAI_CR2_SYNC BIT(30) |
13802 |
+diff --git a/sound/soc/intel/boards/bxt_rt298.c b/sound/soc/intel/boards/bxt_rt298.c |
13803 |
+index 7a4decf34191..c84c60df17db 100644 |
13804 |
+--- a/sound/soc/intel/boards/bxt_rt298.c |
13805 |
++++ b/sound/soc/intel/boards/bxt_rt298.c |
13806 |
+@@ -565,6 +565,7 @@ static int bxt_card_late_probe(struct snd_soc_card *card) |
13807 |
+ /* broxton audio machine driver for SPT + RT298S */ |
13808 |
+ static struct snd_soc_card broxton_rt298 = { |
13809 |
+ .name = "broxton-rt298", |
13810 |
++ .owner = THIS_MODULE, |
13811 |
+ .dai_link = broxton_rt298_dais, |
13812 |
+ .num_links = ARRAY_SIZE(broxton_rt298_dais), |
13813 |
+ .controls = broxton_controls, |
13814 |
+@@ -580,6 +581,7 @@ static struct snd_soc_card broxton_rt298 = { |
13815 |
+ |
13816 |
+ static struct snd_soc_card geminilake_rt298 = { |
13817 |
+ .name = "geminilake-rt298", |
13818 |
++ .owner = THIS_MODULE, |
13819 |
+ .dai_link = broxton_rt298_dais, |
13820 |
+ .num_links = ARRAY_SIZE(broxton_rt298_dais), |
13821 |
+ .controls = broxton_controls, |
13822 |
+diff --git a/sound/soc/intel/boards/cml_rt1011_rt5682.c b/sound/soc/intel/boards/cml_rt1011_rt5682.c |
13823 |
+index 8167b2977e1d..7d811090e4fb 100644 |
13824 |
+--- a/sound/soc/intel/boards/cml_rt1011_rt5682.c |
13825 |
++++ b/sound/soc/intel/boards/cml_rt1011_rt5682.c |
13826 |
+@@ -425,6 +425,7 @@ static struct snd_soc_codec_conf rt1011_conf[] = { |
13827 |
+ /* Cometlake audio machine driver for RT1011 and RT5682 */ |
13828 |
+ static struct snd_soc_card snd_soc_card_cml = { |
13829 |
+ .name = "cml_rt1011_rt5682", |
13830 |
++ .owner = THIS_MODULE, |
13831 |
+ .dai_link = cml_rt1011_rt5682_dailink, |
13832 |
+ .num_links = ARRAY_SIZE(cml_rt1011_rt5682_dailink), |
13833 |
+ .codec_conf = rt1011_conf, |
13834 |
+diff --git a/sound/soc/intel/boards/sof_sdw.c b/sound/soc/intel/boards/sof_sdw.c |
13835 |
+index a64dc563b47e..61b5bced29b7 100644 |
13836 |
+--- a/sound/soc/intel/boards/sof_sdw.c |
13837 |
++++ b/sound/soc/intel/boards/sof_sdw.c |
13838 |
+@@ -888,6 +888,7 @@ static const char sdw_card_long_name[] = "Intel Soundwire SOF"; |
13839 |
+ |
13840 |
+ static struct snd_soc_card card_sof_sdw = { |
13841 |
+ .name = "soundwire", |
13842 |
++ .owner = THIS_MODULE, |
13843 |
+ .late_probe = sof_sdw_hdmi_card_late_probe, |
13844 |
+ .codec_conf = codec_conf, |
13845 |
+ .num_configs = ARRAY_SIZE(codec_conf), |
13846 |
+diff --git a/sound/soc/meson/axg-card.c b/sound/soc/meson/axg-card.c |
13847 |
+index 89f7f64747cd..47f2d93224fe 100644 |
13848 |
+--- a/sound/soc/meson/axg-card.c |
13849 |
++++ b/sound/soc/meson/axg-card.c |
13850 |
+@@ -116,7 +116,7 @@ static int axg_card_add_tdm_loopback(struct snd_soc_card *card, |
13851 |
+ |
13852 |
+ lb = &card->dai_link[*index + 1]; |
13853 |
+ |
13854 |
+- lb->name = kasprintf(GFP_KERNEL, "%s-lb", pad->name); |
13855 |
++ lb->name = devm_kasprintf(card->dev, GFP_KERNEL, "%s-lb", pad->name); |
13856 |
+ if (!lb->name) |
13857 |
+ return -ENOMEM; |
13858 |
+ |
13859 |
+diff --git a/sound/soc/meson/axg-tdm-formatter.c b/sound/soc/meson/axg-tdm-formatter.c |
13860 |
+index 358c8c0d861c..f7e8e9da68a0 100644 |
13861 |
+--- a/sound/soc/meson/axg-tdm-formatter.c |
13862 |
++++ b/sound/soc/meson/axg-tdm-formatter.c |
13863 |
+@@ -70,7 +70,7 @@ EXPORT_SYMBOL_GPL(axg_tdm_formatter_set_channel_masks); |
13864 |
+ static int axg_tdm_formatter_enable(struct axg_tdm_formatter *formatter) |
13865 |
+ { |
13866 |
+ struct axg_tdm_stream *ts = formatter->stream; |
13867 |
+- bool invert = formatter->drv->quirks->invert_sclk; |
13868 |
++ bool invert; |
13869 |
+ int ret; |
13870 |
+ |
13871 |
+ /* Do nothing if the formatter is already enabled */ |
13872 |
+@@ -96,11 +96,12 @@ static int axg_tdm_formatter_enable(struct axg_tdm_formatter *formatter) |
13873 |
+ return ret; |
13874 |
+ |
13875 |
+ /* |
13876 |
+- * If sclk is inverted, invert it back and provide the inversion |
13877 |
+- * required by the formatter |
13878 |
++ * If sclk is inverted, it means the bit should latched on the |
13879 |
++ * rising edge which is what our HW expects. If not, we need to |
13880 |
++ * invert it before the formatter. |
13881 |
+ */ |
13882 |
+- invert ^= axg_tdm_sclk_invert(ts->iface->fmt); |
13883 |
+- ret = clk_set_phase(formatter->sclk, invert ? 180 : 0); |
13884 |
++ invert = axg_tdm_sclk_invert(ts->iface->fmt); |
13885 |
++ ret = clk_set_phase(formatter->sclk, invert ? 0 : 180); |
13886 |
+ if (ret) |
13887 |
+ return ret; |
13888 |
+ |
13889 |
+diff --git a/sound/soc/meson/axg-tdm-formatter.h b/sound/soc/meson/axg-tdm-formatter.h |
13890 |
+index 9ef98e955cb2..a1f0dcc0ff13 100644 |
13891 |
+--- a/sound/soc/meson/axg-tdm-formatter.h |
13892 |
++++ b/sound/soc/meson/axg-tdm-formatter.h |
13893 |
+@@ -16,7 +16,6 @@ struct snd_kcontrol; |
13894 |
+ |
13895 |
+ struct axg_tdm_formatter_hw { |
13896 |
+ unsigned int skew_offset; |
13897 |
+- bool invert_sclk; |
13898 |
+ }; |
13899 |
+ |
13900 |
+ struct axg_tdm_formatter_ops { |
13901 |
+diff --git a/sound/soc/meson/axg-tdm-interface.c b/sound/soc/meson/axg-tdm-interface.c |
13902 |
+index d51f3344be7c..e25336f73912 100644 |
13903 |
+--- a/sound/soc/meson/axg-tdm-interface.c |
13904 |
++++ b/sound/soc/meson/axg-tdm-interface.c |
13905 |
+@@ -119,18 +119,25 @@ static int axg_tdm_iface_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) |
13906 |
+ { |
13907 |
+ struct axg_tdm_iface *iface = snd_soc_dai_get_drvdata(dai); |
13908 |
+ |
13909 |
+- /* These modes are not supported */ |
13910 |
+- if (fmt & (SND_SOC_DAIFMT_CBS_CFM | SND_SOC_DAIFMT_CBM_CFS)) { |
13911 |
++ switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { |
13912 |
++ case SND_SOC_DAIFMT_CBS_CFS: |
13913 |
++ if (!iface->mclk) { |
13914 |
++ dev_err(dai->dev, "cpu clock master: mclk missing\n"); |
13915 |
++ return -ENODEV; |
13916 |
++ } |
13917 |
++ break; |
13918 |
++ |
13919 |
++ case SND_SOC_DAIFMT_CBM_CFM: |
13920 |
++ break; |
13921 |
++ |
13922 |
++ case SND_SOC_DAIFMT_CBS_CFM: |
13923 |
++ case SND_SOC_DAIFMT_CBM_CFS: |
13924 |
+ dev_err(dai->dev, "only CBS_CFS and CBM_CFM are supported\n"); |
13925 |
++ /* Fall-through */ |
13926 |
++ default: |
13927 |
+ return -EINVAL; |
13928 |
+ } |
13929 |
+ |
13930 |
+- /* If the TDM interface is the clock master, it requires mclk */ |
13931 |
+- if (!iface->mclk && (fmt & SND_SOC_DAIFMT_CBS_CFS)) { |
13932 |
+- dev_err(dai->dev, "cpu clock master: mclk missing\n"); |
13933 |
+- return -ENODEV; |
13934 |
+- } |
13935 |
+- |
13936 |
+ iface->fmt = fmt; |
13937 |
+ return 0; |
13938 |
+ } |
13939 |
+@@ -319,7 +326,8 @@ static int axg_tdm_iface_hw_params(struct snd_pcm_substream *substream, |
13940 |
+ if (ret) |
13941 |
+ return ret; |
13942 |
+ |
13943 |
+- if (iface->fmt & SND_SOC_DAIFMT_CBS_CFS) { |
13944 |
++ if ((iface->fmt & SND_SOC_DAIFMT_MASTER_MASK) == |
13945 |
++ SND_SOC_DAIFMT_CBS_CFS) { |
13946 |
+ ret = axg_tdm_iface_set_sclk(dai, params); |
13947 |
+ if (ret) |
13948 |
+ return ret; |
13949 |
+diff --git a/sound/soc/meson/axg-tdmin.c b/sound/soc/meson/axg-tdmin.c |
13950 |
+index 973d4c02ef8d..88ed95ae886b 100644 |
13951 |
+--- a/sound/soc/meson/axg-tdmin.c |
13952 |
++++ b/sound/soc/meson/axg-tdmin.c |
13953 |
+@@ -228,15 +228,29 @@ static const struct axg_tdm_formatter_driver axg_tdmin_drv = { |
13954 |
+ .regmap_cfg = &axg_tdmin_regmap_cfg, |
13955 |
+ .ops = &axg_tdmin_ops, |
13956 |
+ .quirks = &(const struct axg_tdm_formatter_hw) { |
13957 |
+- .invert_sclk = false, |
13958 |
+ .skew_offset = 2, |
13959 |
+ }, |
13960 |
+ }; |
13961 |
+ |
13962 |
++static const struct axg_tdm_formatter_driver g12a_tdmin_drv = { |
13963 |
++ .component_drv = &axg_tdmin_component_drv, |
13964 |
++ .regmap_cfg = &axg_tdmin_regmap_cfg, |
13965 |
++ .ops = &axg_tdmin_ops, |
13966 |
++ .quirks = &(const struct axg_tdm_formatter_hw) { |
13967 |
++ .skew_offset = 3, |
13968 |
++ }, |
13969 |
++}; |
13970 |
++ |
13971 |
+ static const struct of_device_id axg_tdmin_of_match[] = { |
13972 |
+ { |
13973 |
+ .compatible = "amlogic,axg-tdmin", |
13974 |
+ .data = &axg_tdmin_drv, |
13975 |
++ }, { |
13976 |
++ .compatible = "amlogic,g12a-tdmin", |
13977 |
++ .data = &g12a_tdmin_drv, |
13978 |
++ }, { |
13979 |
++ .compatible = "amlogic,sm1-tdmin", |
13980 |
++ .data = &g12a_tdmin_drv, |
13981 |
+ }, {} |
13982 |
+ }; |
13983 |
+ MODULE_DEVICE_TABLE(of, axg_tdmin_of_match); |
13984 |
+diff --git a/sound/soc/meson/axg-tdmout.c b/sound/soc/meson/axg-tdmout.c |
13985 |
+index 418ec314b37d..3ceabddae629 100644 |
13986 |
+--- a/sound/soc/meson/axg-tdmout.c |
13987 |
++++ b/sound/soc/meson/axg-tdmout.c |
13988 |
+@@ -238,7 +238,6 @@ static const struct axg_tdm_formatter_driver axg_tdmout_drv = { |
13989 |
+ .regmap_cfg = &axg_tdmout_regmap_cfg, |
13990 |
+ .ops = &axg_tdmout_ops, |
13991 |
+ .quirks = &(const struct axg_tdm_formatter_hw) { |
13992 |
+- .invert_sclk = true, |
13993 |
+ .skew_offset = 1, |
13994 |
+ }, |
13995 |
+ }; |
13996 |
+@@ -248,7 +247,6 @@ static const struct axg_tdm_formatter_driver g12a_tdmout_drv = { |
13997 |
+ .regmap_cfg = &axg_tdmout_regmap_cfg, |
13998 |
+ .ops = &axg_tdmout_ops, |
13999 |
+ .quirks = &(const struct axg_tdm_formatter_hw) { |
14000 |
+- .invert_sclk = true, |
14001 |
+ .skew_offset = 2, |
14002 |
+ }, |
14003 |
+ }; |
14004 |
+@@ -309,7 +307,6 @@ static const struct axg_tdm_formatter_driver sm1_tdmout_drv = { |
14005 |
+ .regmap_cfg = &axg_tdmout_regmap_cfg, |
14006 |
+ .ops = &axg_tdmout_ops, |
14007 |
+ .quirks = &(const struct axg_tdm_formatter_hw) { |
14008 |
+- .invert_sclk = true, |
14009 |
+ .skew_offset = 2, |
14010 |
+ }, |
14011 |
+ }; |
14012 |
+diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c |
14013 |
+index e5433e8fcf19..b5c4473f1e49 100644 |
14014 |
+--- a/sound/soc/soc-core.c |
14015 |
++++ b/sound/soc/soc-core.c |
14016 |
+@@ -443,7 +443,6 @@ static struct snd_soc_pcm_runtime *soc_new_pcm_runtime( |
14017 |
+ |
14018 |
+ dev->parent = card->dev; |
14019 |
+ dev->release = soc_release_rtd_dev; |
14020 |
+- dev->groups = soc_dev_attr_groups; |
14021 |
+ |
14022 |
+ dev_set_name(dev, "%s", dai_link->name); |
14023 |
+ |
14024 |
+@@ -502,6 +501,10 @@ static struct snd_soc_pcm_runtime *soc_new_pcm_runtime( |
14025 |
+ rtd->num = card->num_rtd; |
14026 |
+ card->num_rtd++; |
14027 |
+ |
14028 |
++ ret = device_add_groups(dev, soc_dev_attr_groups); |
14029 |
++ if (ret < 0) |
14030 |
++ goto free_rtd; |
14031 |
++ |
14032 |
+ return rtd; |
14033 |
+ |
14034 |
+ free_rtd: |
14035 |
+diff --git a/sound/soc/sof/nocodec.c b/sound/soc/sof/nocodec.c |
14036 |
+index 71cf5f9db79d..849c3bcdca9e 100644 |
14037 |
+--- a/sound/soc/sof/nocodec.c |
14038 |
++++ b/sound/soc/sof/nocodec.c |
14039 |
+@@ -14,6 +14,7 @@ |
14040 |
+ |
14041 |
+ static struct snd_soc_card sof_nocodec_card = { |
14042 |
+ .name = "nocodec", /* the sof- prefix is added by the core */ |
14043 |
++ .owner = THIS_MODULE |
14044 |
+ }; |
14045 |
+ |
14046 |
+ static int sof_nocodec_bes_setup(struct device *dev, |
14047 |
+diff --git a/sound/usb/card.h b/sound/usb/card.h |
14048 |
+index f39f23e3525d..d8ec5caf464d 100644 |
14049 |
+--- a/sound/usb/card.h |
14050 |
++++ b/sound/usb/card.h |
14051 |
+@@ -133,6 +133,7 @@ struct snd_usb_substream { |
14052 |
+ unsigned int tx_length_quirk:1; /* add length specifier to transfers */ |
14053 |
+ unsigned int fmt_type; /* USB audio format type (1-3) */ |
14054 |
+ unsigned int pkt_offset_adj; /* Bytes to drop from beginning of packets (for non-compliant devices) */ |
14055 |
++ unsigned int stream_offset_adj; /* Bytes to drop from beginning of stream (for non-compliant devices) */ |
14056 |
+ |
14057 |
+ unsigned int running: 1; /* running status */ |
14058 |
+ |
14059 |
+diff --git a/sound/usb/mixer_quirks.c b/sound/usb/mixer_quirks.c |
14060 |
+index 260607144f56..fed610d4162d 100644 |
14061 |
+--- a/sound/usb/mixer_quirks.c |
14062 |
++++ b/sound/usb/mixer_quirks.c |
14063 |
+@@ -185,6 +185,7 @@ static const struct rc_config { |
14064 |
+ { USB_ID(0x041e, 0x3042), 0, 1, 1, 1, 1, 0x000d }, /* Usb X-Fi S51 */ |
14065 |
+ { USB_ID(0x041e, 0x30df), 0, 1, 1, 1, 1, 0x000d }, /* Usb X-Fi S51 Pro */ |
14066 |
+ { USB_ID(0x041e, 0x3237), 0, 1, 1, 1, 1, 0x000d }, /* Usb X-Fi S51 Pro */ |
14067 |
++ { USB_ID(0x041e, 0x3263), 0, 1, 1, 1, 1, 0x000d }, /* Usb X-Fi S51 Pro */ |
14068 |
+ { USB_ID(0x041e, 0x3048), 2, 2, 6, 6, 2, 0x6e91 }, /* Toshiba SB0500 */ |
14069 |
+ }; |
14070 |
+ |
14071 |
+diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c |
14072 |
+index 0247162a9fbf..9538684c9b4e 100644 |
14073 |
+--- a/sound/usb/pcm.c |
14074 |
++++ b/sound/usb/pcm.c |
14075 |
+@@ -1416,6 +1416,12 @@ static void retire_capture_urb(struct snd_usb_substream *subs, |
14076 |
+ // continue; |
14077 |
+ } |
14078 |
+ bytes = urb->iso_frame_desc[i].actual_length; |
14079 |
++ if (subs->stream_offset_adj > 0) { |
14080 |
++ unsigned int adj = min(subs->stream_offset_adj, bytes); |
14081 |
++ cp += adj; |
14082 |
++ bytes -= adj; |
14083 |
++ subs->stream_offset_adj -= adj; |
14084 |
++ } |
14085 |
+ frames = bytes / stride; |
14086 |
+ if (!subs->txfr_quirk) |
14087 |
+ bytes = frames * stride; |
14088 |
+diff --git a/sound/usb/quirks-table.h b/sound/usb/quirks-table.h |
14089 |
+index 562179492a33..1573229d8cf4 100644 |
14090 |
+--- a/sound/usb/quirks-table.h |
14091 |
++++ b/sound/usb/quirks-table.h |
14092 |
+@@ -3570,6 +3570,62 @@ AU0828_DEVICE(0x2040, 0x7270, "Hauppauge", "HVR-950Q"), |
14093 |
+ } |
14094 |
+ } |
14095 |
+ }, |
14096 |
++{ |
14097 |
++ /* |
14098 |
++ * PIONEER DJ DDJ-RB |
14099 |
++ * PCM is 4 channels out, 2 dummy channels in @ 44.1 fixed |
14100 |
++ * The feedback for the output is the dummy input. |
14101 |
++ */ |
14102 |
++ USB_DEVICE_VENDOR_SPEC(0x2b73, 0x000e), |
14103 |
++ .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) { |
14104 |
++ .ifnum = QUIRK_ANY_INTERFACE, |
14105 |
++ .type = QUIRK_COMPOSITE, |
14106 |
++ .data = (const struct snd_usb_audio_quirk[]) { |
14107 |
++ { |
14108 |
++ .ifnum = 0, |
14109 |
++ .type = QUIRK_AUDIO_FIXED_ENDPOINT, |
14110 |
++ .data = &(const struct audioformat) { |
14111 |
++ .formats = SNDRV_PCM_FMTBIT_S24_3LE, |
14112 |
++ .channels = 4, |
14113 |
++ .iface = 0, |
14114 |
++ .altsetting = 1, |
14115 |
++ .altset_idx = 1, |
14116 |
++ .endpoint = 0x01, |
14117 |
++ .ep_attr = USB_ENDPOINT_XFER_ISOC| |
14118 |
++ USB_ENDPOINT_SYNC_ASYNC, |
14119 |
++ .rates = SNDRV_PCM_RATE_44100, |
14120 |
++ .rate_min = 44100, |
14121 |
++ .rate_max = 44100, |
14122 |
++ .nr_rates = 1, |
14123 |
++ .rate_table = (unsigned int[]) { 44100 } |
14124 |
++ } |
14125 |
++ }, |
14126 |
++ { |
14127 |
++ .ifnum = 0, |
14128 |
++ .type = QUIRK_AUDIO_FIXED_ENDPOINT, |
14129 |
++ .data = &(const struct audioformat) { |
14130 |
++ .formats = SNDRV_PCM_FMTBIT_S24_3LE, |
14131 |
++ .channels = 2, |
14132 |
++ .iface = 0, |
14133 |
++ .altsetting = 1, |
14134 |
++ .altset_idx = 1, |
14135 |
++ .endpoint = 0x82, |
14136 |
++ .ep_attr = USB_ENDPOINT_XFER_ISOC| |
14137 |
++ USB_ENDPOINT_SYNC_ASYNC| |
14138 |
++ USB_ENDPOINT_USAGE_IMPLICIT_FB, |
14139 |
++ .rates = SNDRV_PCM_RATE_44100, |
14140 |
++ .rate_min = 44100, |
14141 |
++ .rate_max = 44100, |
14142 |
++ .nr_rates = 1, |
14143 |
++ .rate_table = (unsigned int[]) { 44100 } |
14144 |
++ } |
14145 |
++ }, |
14146 |
++ { |
14147 |
++ .ifnum = -1 |
14148 |
++ } |
14149 |
++ } |
14150 |
++ } |
14151 |
++}, |
14152 |
+ |
14153 |
+ #define ALC1220_VB_DESKTOP(vend, prod) { \ |
14154 |
+ USB_DEVICE(vend, prod), \ |
14155 |
+@@ -3623,7 +3679,13 @@ ALC1220_VB_DESKTOP(0x26ce, 0x0a01), /* Asrock TRX40 Creator */ |
14156 |
+ * with. |
14157 |
+ */ |
14158 |
+ { |
14159 |
+- USB_DEVICE(0x534d, 0x2109), |
14160 |
++ .match_flags = USB_DEVICE_ID_MATCH_DEVICE | |
14161 |
++ USB_DEVICE_ID_MATCH_INT_CLASS | |
14162 |
++ USB_DEVICE_ID_MATCH_INT_SUBCLASS, |
14163 |
++ .idVendor = 0x534d, |
14164 |
++ .idProduct = 0x2109, |
14165 |
++ .bInterfaceClass = USB_CLASS_AUDIO, |
14166 |
++ .bInterfaceSubClass = USB_SUBCLASS_AUDIOCONTROL, |
14167 |
+ .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) { |
14168 |
+ .vendor_name = "MacroSilicon", |
14169 |
+ .product_name = "MS2109", |
14170 |
+diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c |
14171 |
+index d7d900ebcf37..497a7249f258 100644 |
14172 |
+--- a/sound/usb/quirks.c |
14173 |
++++ b/sound/usb/quirks.c |
14174 |
+@@ -1468,6 +1468,9 @@ void snd_usb_set_format_quirk(struct snd_usb_substream *subs, |
14175 |
+ case USB_ID(0x041e, 0x3f19): /* E-Mu 0204 USB */ |
14176 |
+ set_format_emu_quirk(subs, fmt); |
14177 |
+ break; |
14178 |
++ case USB_ID(0x534d, 0x2109): /* MacroSilicon MS2109 */ |
14179 |
++ subs->stream_offset_adj = 2; |
14180 |
++ break; |
14181 |
+ } |
14182 |
+ } |
14183 |
+ |
14184 |
+diff --git a/sound/usb/stream.c b/sound/usb/stream.c |
14185 |
+index 15296f2c902c..e03ff2a7a73f 100644 |
14186 |
+--- a/sound/usb/stream.c |
14187 |
++++ b/sound/usb/stream.c |
14188 |
+@@ -94,6 +94,7 @@ static void snd_usb_init_substream(struct snd_usb_stream *as, |
14189 |
+ subs->tx_length_quirk = as->chip->tx_length_quirk; |
14190 |
+ subs->speed = snd_usb_get_speed(subs->dev); |
14191 |
+ subs->pkt_offset_adj = 0; |
14192 |
++ subs->stream_offset_adj = 0; |
14193 |
+ |
14194 |
+ snd_usb_set_pcm_ops(as->pcm, stream); |
14195 |
+ |
14196 |
+diff --git a/tools/bpf/bpftool/btf.c b/tools/bpf/bpftool/btf.c |
14197 |
+index bcaf55b59498..81a77475bea6 100644 |
14198 |
+--- a/tools/bpf/bpftool/btf.c |
14199 |
++++ b/tools/bpf/bpftool/btf.c |
14200 |
+@@ -597,7 +597,7 @@ static int do_dump(int argc, char **argv) |
14201 |
+ goto done; |
14202 |
+ } |
14203 |
+ if (!btf) { |
14204 |
+- err = ENOENT; |
14205 |
++ err = -ENOENT; |
14206 |
+ p_err("can't find btf with ID (%u)", btf_id); |
14207 |
+ goto done; |
14208 |
+ } |
14209 |
+diff --git a/tools/bpf/bpftool/gen.c b/tools/bpf/bpftool/gen.c |
14210 |
+index f5960b48c861..5ff951e08c74 100644 |
14211 |
+--- a/tools/bpf/bpftool/gen.c |
14212 |
++++ b/tools/bpf/bpftool/gen.c |
14213 |
+@@ -307,8 +307,11 @@ static int do_skeleton(int argc, char **argv) |
14214 |
+ opts.object_name = obj_name; |
14215 |
+ obj = bpf_object__open_mem(obj_data, file_sz, &opts); |
14216 |
+ if (IS_ERR(obj)) { |
14217 |
++ char err_buf[256]; |
14218 |
++ |
14219 |
++ libbpf_strerror(PTR_ERR(obj), err_buf, sizeof(err_buf)); |
14220 |
++ p_err("failed to open BPF object file: %s", err_buf); |
14221 |
+ obj = NULL; |
14222 |
+- p_err("failed to open BPF object file: %ld", PTR_ERR(obj)); |
14223 |
+ goto out; |
14224 |
+ } |
14225 |
+ |
14226 |
+diff --git a/tools/build/Build.include b/tools/build/Build.include |
14227 |
+index 9ec01f4454f9..585486e40995 100644 |
14228 |
+--- a/tools/build/Build.include |
14229 |
++++ b/tools/build/Build.include |
14230 |
+@@ -74,7 +74,8 @@ dep-cmd = $(if $(wildcard $(fixdep)), |
14231 |
+ # dependencies in the cmd file |
14232 |
+ if_changed_dep = $(if $(strip $(any-prereq) $(arg-check)), \ |
14233 |
+ @set -e; \ |
14234 |
+- $(echo-cmd) $(cmd_$(1)) && $(dep-cmd)) |
14235 |
++ $(echo-cmd) $(cmd_$(1)); \ |
14236 |
++ $(dep-cmd)) |
14237 |
+ |
14238 |
+ # if_changed - execute command if any prerequisite is newer than |
14239 |
+ # target, or command line has changed |
14240 |
+diff --git a/tools/lib/bpf/bpf_tracing.h b/tools/lib/bpf/bpf_tracing.h |
14241 |
+index 48a9c7c69ef1..e6ec7cb4aa4a 100644 |
14242 |
+--- a/tools/lib/bpf/bpf_tracing.h |
14243 |
++++ b/tools/lib/bpf/bpf_tracing.h |
14244 |
+@@ -215,7 +215,7 @@ struct pt_regs; |
14245 |
+ #define PT_REGS_PARM5(x) ((x)->regs[8]) |
14246 |
+ #define PT_REGS_RET(x) ((x)->regs[31]) |
14247 |
+ #define PT_REGS_FP(x) ((x)->regs[30]) /* Works only with CONFIG_FRAME_POINTER */ |
14248 |
+-#define PT_REGS_RC(x) ((x)->regs[1]) |
14249 |
++#define PT_REGS_RC(x) ((x)->regs[2]) |
14250 |
+ #define PT_REGS_SP(x) ((x)->regs[29]) |
14251 |
+ #define PT_REGS_IP(x) ((x)->cp0_epc) |
14252 |
+ |
14253 |
+@@ -226,7 +226,7 @@ struct pt_regs; |
14254 |
+ #define PT_REGS_PARM5_CORE(x) BPF_CORE_READ((x), regs[8]) |
14255 |
+ #define PT_REGS_RET_CORE(x) BPF_CORE_READ((x), regs[31]) |
14256 |
+ #define PT_REGS_FP_CORE(x) BPF_CORE_READ((x), regs[30]) |
14257 |
+-#define PT_REGS_RC_CORE(x) BPF_CORE_READ((x), regs[1]) |
14258 |
++#define PT_REGS_RC_CORE(x) BPF_CORE_READ((x), regs[2]) |
14259 |
+ #define PT_REGS_SP_CORE(x) BPF_CORE_READ((x), regs[29]) |
14260 |
+ #define PT_REGS_IP_CORE(x) BPF_CORE_READ((x), cp0_epc) |
14261 |
+ |
14262 |
+diff --git a/tools/testing/kunit/kunit_kernel.py b/tools/testing/kunit/kunit_kernel.py |
14263 |
+index 63dbda2d029f..e20e2056cb38 100644 |
14264 |
+--- a/tools/testing/kunit/kunit_kernel.py |
14265 |
++++ b/tools/testing/kunit/kunit_kernel.py |
14266 |
+@@ -34,7 +34,7 @@ class LinuxSourceTreeOperations(object): |
14267 |
+ |
14268 |
+ def make_mrproper(self): |
14269 |
+ try: |
14270 |
+- subprocess.check_output(['make', 'mrproper']) |
14271 |
++ subprocess.check_output(['make', 'mrproper'], stderr=subprocess.STDOUT) |
14272 |
+ except OSError as e: |
14273 |
+ raise ConfigError('Could not call make command: ' + e) |
14274 |
+ except subprocess.CalledProcessError as e: |
14275 |
+@@ -47,7 +47,7 @@ class LinuxSourceTreeOperations(object): |
14276 |
+ if build_dir: |
14277 |
+ command += ['O=' + build_dir] |
14278 |
+ try: |
14279 |
+- subprocess.check_output(command, stderr=subprocess.PIPE) |
14280 |
++ subprocess.check_output(command, stderr=subprocess.STDOUT) |
14281 |
+ except OSError as e: |
14282 |
+ raise ConfigError('Could not call make command: ' + e) |
14283 |
+ except subprocess.CalledProcessError as e: |
14284 |
+@@ -77,7 +77,7 @@ class LinuxSourceTreeOperations(object): |
14285 |
+ if build_dir: |
14286 |
+ command += ['O=' + build_dir] |
14287 |
+ try: |
14288 |
+- subprocess.check_output(command) |
14289 |
++ subprocess.check_output(command, stderr=subprocess.STDOUT) |
14290 |
+ except OSError as e: |
14291 |
+ raise BuildError('Could not call execute make: ' + e) |
14292 |
+ except subprocess.CalledProcessError as e: |
14293 |
+diff --git a/tools/testing/selftests/lkdtm/run.sh b/tools/testing/selftests/lkdtm/run.sh |
14294 |
+index ee64ff8df8f4..8383eb89d88a 100755 |
14295 |
+--- a/tools/testing/selftests/lkdtm/run.sh |
14296 |
++++ b/tools/testing/selftests/lkdtm/run.sh |
14297 |
+@@ -8,6 +8,7 @@ |
14298 |
+ # |
14299 |
+ set -e |
14300 |
+ TRIGGER=/sys/kernel/debug/provoke-crash/DIRECT |
14301 |
++CLEAR_ONCE=/sys/kernel/debug/clear_warn_once |
14302 |
+ KSELFTEST_SKIP_TEST=4 |
14303 |
+ |
14304 |
+ # Verify we have LKDTM available in the kernel. |
14305 |
+@@ -67,6 +68,11 @@ cleanup() { |
14306 |
+ } |
14307 |
+ trap cleanup EXIT |
14308 |
+ |
14309 |
++# Reset WARN_ONCE counters so we trip it each time this runs. |
14310 |
++if [ -w $CLEAR_ONCE ] ; then |
14311 |
++ echo 1 > $CLEAR_ONCE |
14312 |
++fi |
14313 |
++ |
14314 |
+ # Save existing dmesg so we can detect new content below |
14315 |
+ dmesg > "$DMESG" |
14316 |
+ |
14317 |
+diff --git a/tools/testing/selftests/lkdtm/tests.txt b/tools/testing/selftests/lkdtm/tests.txt |
14318 |
+index 92ca32143ae5..9d266e79c6a2 100644 |
14319 |
+--- a/tools/testing/selftests/lkdtm/tests.txt |
14320 |
++++ b/tools/testing/selftests/lkdtm/tests.txt |
14321 |
+@@ -14,6 +14,7 @@ STACK_GUARD_PAGE_LEADING |
14322 |
+ STACK_GUARD_PAGE_TRAILING |
14323 |
+ UNSET_SMEP CR4 bits went missing |
14324 |
+ DOUBLE_FAULT |
14325 |
++CORRUPT_PAC |
14326 |
+ UNALIGNED_LOAD_STORE_WRITE |
14327 |
+ #OVERWRITE_ALLOCATION Corrupts memory on failure |
14328 |
+ #WRITE_AFTER_FREE Corrupts memory on failure |
14329 |
+diff --git a/tools/testing/selftests/powerpc/benchmarks/context_switch.c b/tools/testing/selftests/powerpc/benchmarks/context_switch.c |
14330 |
+index a2e8c9da7fa5..d50cc05df495 100644 |
14331 |
+--- a/tools/testing/selftests/powerpc/benchmarks/context_switch.c |
14332 |
++++ b/tools/testing/selftests/powerpc/benchmarks/context_switch.c |
14333 |
+@@ -19,6 +19,7 @@ |
14334 |
+ #include <limits.h> |
14335 |
+ #include <sys/time.h> |
14336 |
+ #include <sys/syscall.h> |
14337 |
++#include <sys/sysinfo.h> |
14338 |
+ #include <sys/types.h> |
14339 |
+ #include <sys/shm.h> |
14340 |
+ #include <linux/futex.h> |
14341 |
+@@ -104,8 +105,9 @@ static void start_thread_on(void *(*fn)(void *), void *arg, unsigned long cpu) |
14342 |
+ |
14343 |
+ static void start_process_on(void *(*fn)(void *), void *arg, unsigned long cpu) |
14344 |
+ { |
14345 |
+- int pid; |
14346 |
+- cpu_set_t cpuset; |
14347 |
++ int pid, ncpus; |
14348 |
++ cpu_set_t *cpuset; |
14349 |
++ size_t size; |
14350 |
+ |
14351 |
+ pid = fork(); |
14352 |
+ if (pid == -1) { |
14353 |
+@@ -116,14 +118,23 @@ static void start_process_on(void *(*fn)(void *), void *arg, unsigned long cpu) |
14354 |
+ if (pid) |
14355 |
+ return; |
14356 |
+ |
14357 |
+- CPU_ZERO(&cpuset); |
14358 |
+- CPU_SET(cpu, &cpuset); |
14359 |
++ ncpus = get_nprocs(); |
14360 |
++ size = CPU_ALLOC_SIZE(ncpus); |
14361 |
++ cpuset = CPU_ALLOC(ncpus); |
14362 |
++ if (!cpuset) { |
14363 |
++ perror("malloc"); |
14364 |
++ exit(1); |
14365 |
++ } |
14366 |
++ CPU_ZERO_S(size, cpuset); |
14367 |
++ CPU_SET_S(cpu, size, cpuset); |
14368 |
+ |
14369 |
+- if (sched_setaffinity(0, sizeof(cpuset), &cpuset)) { |
14370 |
++ if (sched_setaffinity(0, size, cpuset)) { |
14371 |
+ perror("sched_setaffinity"); |
14372 |
++ CPU_FREE(cpuset); |
14373 |
+ exit(1); |
14374 |
+ } |
14375 |
+ |
14376 |
++ CPU_FREE(cpuset); |
14377 |
+ fn(arg); |
14378 |
+ |
14379 |
+ exit(0); |
14380 |
+diff --git a/tools/testing/selftests/powerpc/eeh/eeh-functions.sh b/tools/testing/selftests/powerpc/eeh/eeh-functions.sh |
14381 |
+index f52ed92b53e7..00dc32c0ed75 100755 |
14382 |
+--- a/tools/testing/selftests/powerpc/eeh/eeh-functions.sh |
14383 |
++++ b/tools/testing/selftests/powerpc/eeh/eeh-functions.sh |
14384 |
+@@ -5,12 +5,17 @@ pe_ok() { |
14385 |
+ local dev="$1" |
14386 |
+ local path="/sys/bus/pci/devices/$dev/eeh_pe_state" |
14387 |
+ |
14388 |
+- if ! [ -e "$path" ] ; then |
14389 |
++ # if a driver doesn't support the error handling callbacks then the |
14390 |
++ # device is recovered by removing and re-probing it. This causes the |
14391 |
++ # sysfs directory to disappear so read the PE state once and squash |
14392 |
++ # any potential error messages |
14393 |
++ local eeh_state="$(cat $path 2>/dev/null)" |
14394 |
++ if [ -z "$eeh_state" ]; then |
14395 |
+ return 1; |
14396 |
+ fi |
14397 |
+ |
14398 |
+- local fw_state="$(cut -d' ' -f1 < $path)" |
14399 |
+- local sw_state="$(cut -d' ' -f2 < $path)" |
14400 |
++ local fw_state="$(echo $eeh_state | cut -d' ' -f1)" |
14401 |
++ local sw_state="$(echo $eeh_state | cut -d' ' -f2)" |
14402 |
+ |
14403 |
+ # If EEH_PE_ISOLATED or EEH_PE_RECOVERING are set then the PE is in an |
14404 |
+ # error state or being recovered. Either way, not ok. |
14405 |
+diff --git a/tools/testing/selftests/powerpc/utils.c b/tools/testing/selftests/powerpc/utils.c |
14406 |
+index 5ee0e98c4896..eb530e73e02c 100644 |
14407 |
+--- a/tools/testing/selftests/powerpc/utils.c |
14408 |
++++ b/tools/testing/selftests/powerpc/utils.c |
14409 |
+@@ -16,6 +16,7 @@ |
14410 |
+ #include <string.h> |
14411 |
+ #include <sys/ioctl.h> |
14412 |
+ #include <sys/stat.h> |
14413 |
++#include <sys/sysinfo.h> |
14414 |
+ #include <sys/types.h> |
14415 |
+ #include <sys/utsname.h> |
14416 |
+ #include <unistd.h> |
14417 |
+@@ -88,28 +89,40 @@ void *get_auxv_entry(int type) |
14418 |
+ |
14419 |
+ int pick_online_cpu(void) |
14420 |
+ { |
14421 |
+- cpu_set_t mask; |
14422 |
+- int cpu; |
14423 |
++ int ncpus, cpu = -1; |
14424 |
++ cpu_set_t *mask; |
14425 |
++ size_t size; |
14426 |
++ |
14427 |
++ ncpus = get_nprocs_conf(); |
14428 |
++ size = CPU_ALLOC_SIZE(ncpus); |
14429 |
++ mask = CPU_ALLOC(ncpus); |
14430 |
++ if (!mask) { |
14431 |
++ perror("malloc"); |
14432 |
++ return -1; |
14433 |
++ } |
14434 |
+ |
14435 |
+- CPU_ZERO(&mask); |
14436 |
++ CPU_ZERO_S(size, mask); |
14437 |
+ |
14438 |
+- if (sched_getaffinity(0, sizeof(mask), &mask)) { |
14439 |
++ if (sched_getaffinity(0, size, mask)) { |
14440 |
+ perror("sched_getaffinity"); |
14441 |
+- return -1; |
14442 |
++ goto done; |
14443 |
+ } |
14444 |
+ |
14445 |
+ /* We prefer a primary thread, but skip 0 */ |
14446 |
+- for (cpu = 8; cpu < CPU_SETSIZE; cpu += 8) |
14447 |
+- if (CPU_ISSET(cpu, &mask)) |
14448 |
+- return cpu; |
14449 |
++ for (cpu = 8; cpu < ncpus; cpu += 8) |
14450 |
++ if (CPU_ISSET_S(cpu, size, mask)) |
14451 |
++ goto done; |
14452 |
+ |
14453 |
+ /* Search for anything, but in reverse */ |
14454 |
+- for (cpu = CPU_SETSIZE - 1; cpu >= 0; cpu--) |
14455 |
+- if (CPU_ISSET(cpu, &mask)) |
14456 |
+- return cpu; |
14457 |
++ for (cpu = ncpus - 1; cpu >= 0; cpu--) |
14458 |
++ if (CPU_ISSET_S(cpu, size, mask)) |
14459 |
++ goto done; |
14460 |
+ |
14461 |
+ printf("No cpus in affinity mask?!\n"); |
14462 |
+- return -1; |
14463 |
++ |
14464 |
++done: |
14465 |
++ CPU_FREE(mask); |
14466 |
++ return cpu; |
14467 |
+ } |
14468 |
+ |
14469 |
+ bool is_ppc64le(void) |
14470 |
+diff --git a/tools/testing/selftests/seccomp/seccomp_bpf.c b/tools/testing/selftests/seccomp/seccomp_bpf.c |
14471 |
+index c0aa46ce14f6..c84c7b50331c 100644 |
14472 |
+--- a/tools/testing/selftests/seccomp/seccomp_bpf.c |
14473 |
++++ b/tools/testing/selftests/seccomp/seccomp_bpf.c |
14474 |
+@@ -180,7 +180,7 @@ struct seccomp_metadata { |
14475 |
+ #define SECCOMP_IOCTL_NOTIF_RECV SECCOMP_IOWR(0, struct seccomp_notif) |
14476 |
+ #define SECCOMP_IOCTL_NOTIF_SEND SECCOMP_IOWR(1, \ |
14477 |
+ struct seccomp_notif_resp) |
14478 |
+-#define SECCOMP_IOCTL_NOTIF_ID_VALID SECCOMP_IOR(2, __u64) |
14479 |
++#define SECCOMP_IOCTL_NOTIF_ID_VALID SECCOMP_IOW(2, __u64) |
14480 |
+ |
14481 |
+ struct seccomp_notif { |
14482 |
+ __u64 id; |