1 |
commit: d5ab9b2ee45768e0bc02c0778fde07f72a10f2c3 |
2 |
Author: Alice Ferrazzi <alicef <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Feb 1 08:06:11 2023 +0000 |
4 |
Commit: Alice Ferrazzi <alicef <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Feb 1 08:06:11 2023 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=d5ab9b2e |
7 |
|
8 |
Linux patch 5.15.91 |
9 |
|
10 |
Signed-off-by: Alice Ferrazzi <alicef <AT> gentoo.org> |
11 |
|
12 |
0000_README | 4 + |
13 |
1090_linux-5.15.91.patch | 9951 ++++++++++++++++++++++++++++++++++++++++++++++ |
14 |
2 files changed, 9955 insertions(+) |
15 |
|
16 |
diff --git a/0000_README b/0000_README |
17 |
index e44305c8..e6042d05 100644 |
18 |
--- a/0000_README |
19 |
+++ b/0000_README |
20 |
@@ -403,6 +403,10 @@ Patch: 1089_linux-5.15.90.patch |
21 |
From: http://www.kernel.org |
22 |
Desc: Linux 5.15.90 |
23 |
|
24 |
+Patch: 1090_linux-5.15.91.patch |
25 |
+From: http://www.kernel.org |
26 |
+Desc: Linux 5.15.91 |
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/1090_linux-5.15.91.patch b/1090_linux-5.15.91.patch |
33 |
new file mode 100644 |
34 |
index 00000000..06fbb2a2 |
35 |
--- /dev/null |
36 |
+++ b/1090_linux-5.15.91.patch |
37 |
@@ -0,0 +1,9951 @@ |
38 |
+diff --git a/Documentation/ABI/testing/sysfs-kernel-oops_count b/Documentation/ABI/testing/sysfs-kernel-oops_count |
39 |
+new file mode 100644 |
40 |
+index 0000000000000..156cca9dbc960 |
41 |
+--- /dev/null |
42 |
++++ b/Documentation/ABI/testing/sysfs-kernel-oops_count |
43 |
+@@ -0,0 +1,6 @@ |
44 |
++What: /sys/kernel/oops_count |
45 |
++Date: November 2022 |
46 |
++KernelVersion: 6.2.0 |
47 |
++Contact: Linux Kernel Hardening List <linux-hardening@×××××××××××.org> |
48 |
++Description: |
49 |
++ Shows how many times the system has Oopsed since last boot. |
50 |
+diff --git a/Documentation/ABI/testing/sysfs-kernel-warn_count b/Documentation/ABI/testing/sysfs-kernel-warn_count |
51 |
+new file mode 100644 |
52 |
+index 0000000000000..90a029813717d |
53 |
+--- /dev/null |
54 |
++++ b/Documentation/ABI/testing/sysfs-kernel-warn_count |
55 |
+@@ -0,0 +1,6 @@ |
56 |
++What: /sys/kernel/warn_count |
57 |
++Date: November 2022 |
58 |
++KernelVersion: 6.2.0 |
59 |
++Contact: Linux Kernel Hardening List <linux-hardening@×××××××××××.org> |
60 |
++Description: |
61 |
++ Shows how many times the system has Warned since last boot. |
62 |
+diff --git a/Documentation/admin-guide/sysctl/kernel.rst b/Documentation/admin-guide/sysctl/kernel.rst |
63 |
+index 609b891754081..48b91c485c993 100644 |
64 |
+--- a/Documentation/admin-guide/sysctl/kernel.rst |
65 |
++++ b/Documentation/admin-guide/sysctl/kernel.rst |
66 |
+@@ -671,6 +671,15 @@ This is the default behavior. |
67 |
+ an oops event is detected. |
68 |
+ |
69 |
+ |
70 |
++oops_limit |
71 |
++========== |
72 |
++ |
73 |
++Number of kernel oopses after which the kernel should panic when |
74 |
++``panic_on_oops`` is not set. Setting this to 0 disables checking |
75 |
++the count. Setting this to 1 has the same effect as setting |
76 |
++``panic_on_oops=1``. The default value is 10000. |
77 |
++ |
78 |
++ |
79 |
+ osrelease, ostype & version |
80 |
+ =========================== |
81 |
+ |
82 |
+@@ -1485,6 +1494,16 @@ entry will default to 2 instead of 0. |
83 |
+ 2 Unprivileged calls to ``bpf()`` are disabled |
84 |
+ = ============================================================= |
85 |
+ |
86 |
++ |
87 |
++warn_limit |
88 |
++========== |
89 |
++ |
90 |
++Number of kernel warnings after which the kernel should panic when |
91 |
++``panic_on_warn`` is not set. Setting this to 0 disables checking |
92 |
++the warning count. Setting this to 1 has the same effect as setting |
93 |
++``panic_on_warn=1``. The default value is 0. |
94 |
++ |
95 |
++ |
96 |
+ watchdog |
97 |
+ ======== |
98 |
+ |
99 |
+diff --git a/Makefile b/Makefile |
100 |
+index 028d23841df8e..02b2ade89c514 100644 |
101 |
+--- a/Makefile |
102 |
++++ b/Makefile |
103 |
+@@ -1,7 +1,7 @@ |
104 |
+ # SPDX-License-Identifier: GPL-2.0 |
105 |
+ VERSION = 5 |
106 |
+ PATCHLEVEL = 15 |
107 |
+-SUBLEVEL = 90 |
108 |
++SUBLEVEL = 91 |
109 |
+ EXTRAVERSION = |
110 |
+ NAME = Trick or Treat |
111 |
+ |
112 |
+@@ -430,6 +430,7 @@ else |
113 |
+ HOSTCC = gcc |
114 |
+ HOSTCXX = g++ |
115 |
+ endif |
116 |
++HOSTPKG_CONFIG = pkg-config |
117 |
+ |
118 |
+ export KBUILD_USERCFLAGS := -Wall -Wmissing-prototypes -Wstrict-prototypes \ |
119 |
+ -O2 -fomit-frame-pointer -std=gnu89 |
120 |
+@@ -525,7 +526,7 @@ KBUILD_LDFLAGS_MODULE := |
121 |
+ KBUILD_LDFLAGS := |
122 |
+ CLANG_FLAGS := |
123 |
+ |
124 |
+-export ARCH SRCARCH CONFIG_SHELL BASH HOSTCC KBUILD_HOSTCFLAGS CROSS_COMPILE LD CC |
125 |
++export ARCH SRCARCH CONFIG_SHELL BASH HOSTCC KBUILD_HOSTCFLAGS CROSS_COMPILE LD CC HOSTPKG_CONFIG |
126 |
+ export CPP AR NM STRIP OBJCOPY OBJDUMP READELF PAHOLE RESOLVE_BTFIDS LEX YACC AWK INSTALLKERNEL |
127 |
+ export PERL PYTHON3 CHECK CHECKFLAGS MAKE UTS_MACHINE HOSTCXX |
128 |
+ export KGZIP KBZIP2 KLZOP LZMA LZ4 XZ ZSTD |
129 |
+diff --git a/arch/alpha/kernel/traps.c b/arch/alpha/kernel/traps.c |
130 |
+index e805106409f76..f5ba12adde67c 100644 |
131 |
+--- a/arch/alpha/kernel/traps.c |
132 |
++++ b/arch/alpha/kernel/traps.c |
133 |
+@@ -192,7 +192,7 @@ die_if_kernel(char * str, struct pt_regs *regs, long err, unsigned long *r9_15) |
134 |
+ local_irq_enable(); |
135 |
+ while (1); |
136 |
+ } |
137 |
+- do_exit(SIGSEGV); |
138 |
++ make_task_dead(SIGSEGV); |
139 |
+ } |
140 |
+ |
141 |
+ #ifndef CONFIG_MATHEMU |
142 |
+@@ -577,7 +577,7 @@ do_entUna(void * va, unsigned long opcode, unsigned long reg, |
143 |
+ |
144 |
+ printk("Bad unaligned kernel access at %016lx: %p %lx %lu\n", |
145 |
+ pc, va, opcode, reg); |
146 |
+- do_exit(SIGSEGV); |
147 |
++ make_task_dead(SIGSEGV); |
148 |
+ |
149 |
+ got_exception: |
150 |
+ /* Ok, we caught the exception, but we don't want it. Is there |
151 |
+@@ -632,7 +632,7 @@ got_exception: |
152 |
+ local_irq_enable(); |
153 |
+ while (1); |
154 |
+ } |
155 |
+- do_exit(SIGSEGV); |
156 |
++ make_task_dead(SIGSEGV); |
157 |
+ } |
158 |
+ |
159 |
+ /* |
160 |
+diff --git a/arch/alpha/mm/fault.c b/arch/alpha/mm/fault.c |
161 |
+index eee5102c3d889..e9193d52222ea 100644 |
162 |
+--- a/arch/alpha/mm/fault.c |
163 |
++++ b/arch/alpha/mm/fault.c |
164 |
+@@ -204,7 +204,7 @@ retry: |
165 |
+ printk(KERN_ALERT "Unable to handle kernel paging request at " |
166 |
+ "virtual address %016lx\n", address); |
167 |
+ die_if_kernel("Oops", regs, cause, (unsigned long*)regs - 16); |
168 |
+- do_exit(SIGKILL); |
169 |
++ make_task_dead(SIGKILL); |
170 |
+ |
171 |
+ /* We ran out of memory, or some other thing happened to us that |
172 |
+ made us unable to handle the page fault gracefully. */ |
173 |
+diff --git a/arch/arm/boot/dts/imx6qdl-gw560x.dtsi b/arch/arm/boot/dts/imx6qdl-gw560x.dtsi |
174 |
+index 4bc4371e6bae5..4b81a975c979d 100644 |
175 |
+--- a/arch/arm/boot/dts/imx6qdl-gw560x.dtsi |
176 |
++++ b/arch/arm/boot/dts/imx6qdl-gw560x.dtsi |
177 |
+@@ -632,7 +632,6 @@ |
178 |
+ &uart1 { |
179 |
+ pinctrl-names = "default"; |
180 |
+ pinctrl-0 = <&pinctrl_uart1>; |
181 |
+- uart-has-rtscts; |
182 |
+ rts-gpios = <&gpio7 1 GPIO_ACTIVE_HIGH>; |
183 |
+ status = "okay"; |
184 |
+ }; |
185 |
+diff --git a/arch/arm/boot/dts/imx6ul-pico-dwarf.dts b/arch/arm/boot/dts/imx6ul-pico-dwarf.dts |
186 |
+index 162dc259edc8c..5a74c7f68eb62 100644 |
187 |
+--- a/arch/arm/boot/dts/imx6ul-pico-dwarf.dts |
188 |
++++ b/arch/arm/boot/dts/imx6ul-pico-dwarf.dts |
189 |
+@@ -32,7 +32,7 @@ |
190 |
+ }; |
191 |
+ |
192 |
+ &i2c2 { |
193 |
+- clock_frequency = <100000>; |
194 |
++ clock-frequency = <100000>; |
195 |
+ pinctrl-names = "default"; |
196 |
+ pinctrl-0 = <&pinctrl_i2c2>; |
197 |
+ status = "okay"; |
198 |
+diff --git a/arch/arm/boot/dts/imx7d-pico-dwarf.dts b/arch/arm/boot/dts/imx7d-pico-dwarf.dts |
199 |
+index 5162fe227d1ea..fdc10563f1473 100644 |
200 |
+--- a/arch/arm/boot/dts/imx7d-pico-dwarf.dts |
201 |
++++ b/arch/arm/boot/dts/imx7d-pico-dwarf.dts |
202 |
+@@ -32,7 +32,7 @@ |
203 |
+ }; |
204 |
+ |
205 |
+ &i2c1 { |
206 |
+- clock_frequency = <100000>; |
207 |
++ clock-frequency = <100000>; |
208 |
+ pinctrl-names = "default"; |
209 |
+ pinctrl-0 = <&pinctrl_i2c1>; |
210 |
+ status = "okay"; |
211 |
+@@ -52,7 +52,7 @@ |
212 |
+ }; |
213 |
+ |
214 |
+ &i2c4 { |
215 |
+- clock_frequency = <100000>; |
216 |
++ clock-frequency = <100000>; |
217 |
+ pinctrl-names = "default"; |
218 |
+ pinctrl-0 = <&pinctrl_i2c1>; |
219 |
+ status = "okay"; |
220 |
+diff --git a/arch/arm/boot/dts/imx7d-pico-nymph.dts b/arch/arm/boot/dts/imx7d-pico-nymph.dts |
221 |
+index 104a85254adbb..5afb1674e0125 100644 |
222 |
+--- a/arch/arm/boot/dts/imx7d-pico-nymph.dts |
223 |
++++ b/arch/arm/boot/dts/imx7d-pico-nymph.dts |
224 |
+@@ -43,7 +43,7 @@ |
225 |
+ }; |
226 |
+ |
227 |
+ &i2c1 { |
228 |
+- clock_frequency = <100000>; |
229 |
++ clock-frequency = <100000>; |
230 |
+ pinctrl-names = "default"; |
231 |
+ pinctrl-0 = <&pinctrl_i2c1>; |
232 |
+ status = "okay"; |
233 |
+@@ -64,7 +64,7 @@ |
234 |
+ }; |
235 |
+ |
236 |
+ &i2c2 { |
237 |
+- clock_frequency = <100000>; |
238 |
++ clock-frequency = <100000>; |
239 |
+ pinctrl-names = "default"; |
240 |
+ pinctrl-0 = <&pinctrl_i2c2>; |
241 |
+ status = "okay"; |
242 |
+diff --git a/arch/arm/boot/dts/sam9x60.dtsi b/arch/arm/boot/dts/sam9x60.dtsi |
243 |
+index ec45ced3cde68..e1e0dec8cc1f2 100644 |
244 |
+--- a/arch/arm/boot/dts/sam9x60.dtsi |
245 |
++++ b/arch/arm/boot/dts/sam9x60.dtsi |
246 |
+@@ -567,7 +567,7 @@ |
247 |
+ mpddrc: mpddrc@ffffe800 { |
248 |
+ compatible = "microchip,sam9x60-ddramc", "atmel,sama5d3-ddramc"; |
249 |
+ reg = <0xffffe800 0x200>; |
250 |
+- clocks = <&pmc PMC_TYPE_SYSTEM 2>, <&pmc PMC_TYPE_CORE PMC_MCK>; |
251 |
++ clocks = <&pmc PMC_TYPE_SYSTEM 2>, <&pmc PMC_TYPE_PERIPHERAL 49>; |
252 |
+ clock-names = "ddrck", "mpddr"; |
253 |
+ }; |
254 |
+ |
255 |
+diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c |
256 |
+index 54abd8720ddef..91e757bb054e6 100644 |
257 |
+--- a/arch/arm/kernel/traps.c |
258 |
++++ b/arch/arm/kernel/traps.c |
259 |
+@@ -334,7 +334,7 @@ static void oops_end(unsigned long flags, struct pt_regs *regs, int signr) |
260 |
+ if (panic_on_oops) |
261 |
+ panic("Fatal exception"); |
262 |
+ if (signr) |
263 |
+- do_exit(signr); |
264 |
++ make_task_dead(signr); |
265 |
+ } |
266 |
+ |
267 |
+ /* |
268 |
+diff --git a/arch/arm/mach-imx/cpu-imx25.c b/arch/arm/mach-imx/cpu-imx25.c |
269 |
+index b2e1963f473de..2ee2d2813d577 100644 |
270 |
+--- a/arch/arm/mach-imx/cpu-imx25.c |
271 |
++++ b/arch/arm/mach-imx/cpu-imx25.c |
272 |
+@@ -23,6 +23,7 @@ static int mx25_read_cpu_rev(void) |
273 |
+ |
274 |
+ np = of_find_compatible_node(NULL, NULL, "fsl,imx25-iim"); |
275 |
+ iim_base = of_iomap(np, 0); |
276 |
++ of_node_put(np); |
277 |
+ BUG_ON(!iim_base); |
278 |
+ rev = readl(iim_base + MXC_IIMSREV); |
279 |
+ iounmap(iim_base); |
280 |
+diff --git a/arch/arm/mach-imx/cpu-imx27.c b/arch/arm/mach-imx/cpu-imx27.c |
281 |
+index bf70e13bbe9ee..1d28939083683 100644 |
282 |
+--- a/arch/arm/mach-imx/cpu-imx27.c |
283 |
++++ b/arch/arm/mach-imx/cpu-imx27.c |
284 |
+@@ -28,6 +28,7 @@ static int mx27_read_cpu_rev(void) |
285 |
+ |
286 |
+ np = of_find_compatible_node(NULL, NULL, "fsl,imx27-ccm"); |
287 |
+ ccm_base = of_iomap(np, 0); |
288 |
++ of_node_put(np); |
289 |
+ BUG_ON(!ccm_base); |
290 |
+ /* |
291 |
+ * now we have access to the IO registers. As we need |
292 |
+diff --git a/arch/arm/mach-imx/cpu-imx31.c b/arch/arm/mach-imx/cpu-imx31.c |
293 |
+index b9c24b851d1ab..35c544924e509 100644 |
294 |
+--- a/arch/arm/mach-imx/cpu-imx31.c |
295 |
++++ b/arch/arm/mach-imx/cpu-imx31.c |
296 |
+@@ -39,6 +39,7 @@ static int mx31_read_cpu_rev(void) |
297 |
+ |
298 |
+ np = of_find_compatible_node(NULL, NULL, "fsl,imx31-iim"); |
299 |
+ iim_base = of_iomap(np, 0); |
300 |
++ of_node_put(np); |
301 |
+ BUG_ON(!iim_base); |
302 |
+ |
303 |
+ /* read SREV register from IIM module */ |
304 |
+diff --git a/arch/arm/mach-imx/cpu-imx35.c b/arch/arm/mach-imx/cpu-imx35.c |
305 |
+index 80e7d8ab9f1bb..1fe75b39c2d99 100644 |
306 |
+--- a/arch/arm/mach-imx/cpu-imx35.c |
307 |
++++ b/arch/arm/mach-imx/cpu-imx35.c |
308 |
+@@ -21,6 +21,7 @@ static int mx35_read_cpu_rev(void) |
309 |
+ |
310 |
+ np = of_find_compatible_node(NULL, NULL, "fsl,imx35-iim"); |
311 |
+ iim_base = of_iomap(np, 0); |
312 |
++ of_node_put(np); |
313 |
+ BUG_ON(!iim_base); |
314 |
+ |
315 |
+ rev = imx_readl(iim_base + MXC_IIMSREV); |
316 |
+diff --git a/arch/arm/mach-imx/cpu-imx5.c b/arch/arm/mach-imx/cpu-imx5.c |
317 |
+index ad56263778f93..a67c89bf155dd 100644 |
318 |
+--- a/arch/arm/mach-imx/cpu-imx5.c |
319 |
++++ b/arch/arm/mach-imx/cpu-imx5.c |
320 |
+@@ -28,6 +28,7 @@ static u32 imx5_read_srev_reg(const char *compat) |
321 |
+ |
322 |
+ np = of_find_compatible_node(NULL, NULL, compat); |
323 |
+ iim_base = of_iomap(np, 0); |
324 |
++ of_node_put(np); |
325 |
+ WARN_ON(!iim_base); |
326 |
+ |
327 |
+ srev = readl(iim_base + IIM_SREV) & 0xff; |
328 |
+diff --git a/arch/arm/mm/fault.c b/arch/arm/mm/fault.c |
329 |
+index efa4020250315..af5177801fb10 100644 |
330 |
+--- a/arch/arm/mm/fault.c |
331 |
++++ b/arch/arm/mm/fault.c |
332 |
+@@ -125,7 +125,7 @@ __do_kernel_fault(struct mm_struct *mm, unsigned long addr, unsigned int fsr, |
333 |
+ show_pte(KERN_ALERT, mm, addr); |
334 |
+ die("Oops", regs, fsr); |
335 |
+ bust_spinlocks(0); |
336 |
+- do_exit(SIGKILL); |
337 |
++ make_task_dead(SIGKILL); |
338 |
+ } |
339 |
+ |
340 |
+ /* |
341 |
+diff --git a/arch/arm/mm/nommu.c b/arch/arm/mm/nommu.c |
342 |
+index 88feffebae219..80613674deb5b 100644 |
343 |
+--- a/arch/arm/mm/nommu.c |
344 |
++++ b/arch/arm/mm/nommu.c |
345 |
+@@ -161,7 +161,7 @@ void __init paging_init(const struct machine_desc *mdesc) |
346 |
+ mpu_setup(); |
347 |
+ |
348 |
+ /* allocate the zero page. */ |
349 |
+- zero_page = memblock_alloc(PAGE_SIZE, PAGE_SIZE); |
350 |
++ zero_page = (void *)memblock_alloc(PAGE_SIZE, PAGE_SIZE); |
351 |
+ if (!zero_page) |
352 |
+ panic("%s: Failed to allocate %lu bytes align=0x%lx\n", |
353 |
+ __func__, PAGE_SIZE, PAGE_SIZE); |
354 |
+diff --git a/arch/arm64/boot/dts/freescale/imx8mm-beacon-baseboard.dtsi b/arch/arm64/boot/dts/freescale/imx8mm-beacon-baseboard.dtsi |
355 |
+index 94e5fa8ca9572..bb18354c10f08 100644 |
356 |
+--- a/arch/arm64/boot/dts/freescale/imx8mm-beacon-baseboard.dtsi |
357 |
++++ b/arch/arm64/boot/dts/freescale/imx8mm-beacon-baseboard.dtsi |
358 |
+@@ -70,7 +70,7 @@ |
359 |
+ &ecspi2 { |
360 |
+ pinctrl-names = "default"; |
361 |
+ pinctrl-0 = <&pinctrl_espi2>; |
362 |
+- cs-gpios = <&gpio5 9 GPIO_ACTIVE_LOW>; |
363 |
++ cs-gpios = <&gpio5 13 GPIO_ACTIVE_LOW>; |
364 |
+ status = "okay"; |
365 |
+ |
366 |
+ eeprom@0 { |
367 |
+@@ -186,7 +186,7 @@ |
368 |
+ MX8MM_IOMUXC_ECSPI2_SCLK_ECSPI2_SCLK 0x82 |
369 |
+ MX8MM_IOMUXC_ECSPI2_MOSI_ECSPI2_MOSI 0x82 |
370 |
+ MX8MM_IOMUXC_ECSPI2_MISO_ECSPI2_MISO 0x82 |
371 |
+- MX8MM_IOMUXC_ECSPI1_SS0_GPIO5_IO9 0x41 |
372 |
++ MX8MM_IOMUXC_ECSPI2_SS0_GPIO5_IO13 0x41 |
373 |
+ >; |
374 |
+ }; |
375 |
+ |
376 |
+diff --git a/arch/arm64/boot/dts/freescale/imx8mm-venice-gw7901.dts b/arch/arm64/boot/dts/freescale/imx8mm-venice-gw7901.dts |
377 |
+index bafd5c8ea4e28..f7e41e5c2c7bc 100644 |
378 |
+--- a/arch/arm64/boot/dts/freescale/imx8mm-venice-gw7901.dts |
379 |
++++ b/arch/arm64/boot/dts/freescale/imx8mm-venice-gw7901.dts |
380 |
+@@ -675,6 +675,7 @@ |
381 |
+ &usbotg2 { |
382 |
+ dr_mode = "host"; |
383 |
+ vbus-supply = <®_usb2_vbus>; |
384 |
++ over-current-active-low; |
385 |
+ status = "okay"; |
386 |
+ }; |
387 |
+ |
388 |
+diff --git a/arch/arm64/boot/dts/freescale/imx8mp-phycore-som.dtsi b/arch/arm64/boot/dts/freescale/imx8mp-phycore-som.dtsi |
389 |
+index fc178eebf8aa4..8e189d8997941 100644 |
390 |
+--- a/arch/arm64/boot/dts/freescale/imx8mp-phycore-som.dtsi |
391 |
++++ b/arch/arm64/boot/dts/freescale/imx8mp-phycore-som.dtsi |
392 |
+@@ -98,7 +98,6 @@ |
393 |
+ |
394 |
+ regulators { |
395 |
+ buck1: BUCK1 { |
396 |
+- regulator-compatible = "BUCK1"; |
397 |
+ regulator-min-microvolt = <600000>; |
398 |
+ regulator-max-microvolt = <2187500>; |
399 |
+ regulator-boot-on; |
400 |
+@@ -107,7 +106,6 @@ |
401 |
+ }; |
402 |
+ |
403 |
+ buck2: BUCK2 { |
404 |
+- regulator-compatible = "BUCK2"; |
405 |
+ regulator-min-microvolt = <600000>; |
406 |
+ regulator-max-microvolt = <2187500>; |
407 |
+ regulator-boot-on; |
408 |
+@@ -116,7 +114,6 @@ |
409 |
+ }; |
410 |
+ |
411 |
+ buck4: BUCK4 { |
412 |
+- regulator-compatible = "BUCK4"; |
413 |
+ regulator-min-microvolt = <600000>; |
414 |
+ regulator-max-microvolt = <3400000>; |
415 |
+ regulator-boot-on; |
416 |
+@@ -124,7 +121,6 @@ |
417 |
+ }; |
418 |
+ |
419 |
+ buck5: BUCK5 { |
420 |
+- regulator-compatible = "BUCK5"; |
421 |
+ regulator-min-microvolt = <600000>; |
422 |
+ regulator-max-microvolt = <3400000>; |
423 |
+ regulator-boot-on; |
424 |
+@@ -132,7 +128,6 @@ |
425 |
+ }; |
426 |
+ |
427 |
+ buck6: BUCK6 { |
428 |
+- regulator-compatible = "BUCK6"; |
429 |
+ regulator-min-microvolt = <600000>; |
430 |
+ regulator-max-microvolt = <3400000>; |
431 |
+ regulator-boot-on; |
432 |
+@@ -140,7 +135,6 @@ |
433 |
+ }; |
434 |
+ |
435 |
+ ldo1: LDO1 { |
436 |
+- regulator-compatible = "LDO1"; |
437 |
+ regulator-min-microvolt = <1600000>; |
438 |
+ regulator-max-microvolt = <3300000>; |
439 |
+ regulator-boot-on; |
440 |
+@@ -148,7 +142,6 @@ |
441 |
+ }; |
442 |
+ |
443 |
+ ldo2: LDO2 { |
444 |
+- regulator-compatible = "LDO2"; |
445 |
+ regulator-min-microvolt = <800000>; |
446 |
+ regulator-max-microvolt = <1150000>; |
447 |
+ regulator-boot-on; |
448 |
+@@ -156,7 +149,6 @@ |
449 |
+ }; |
450 |
+ |
451 |
+ ldo3: LDO3 { |
452 |
+- regulator-compatible = "LDO3"; |
453 |
+ regulator-min-microvolt = <800000>; |
454 |
+ regulator-max-microvolt = <3300000>; |
455 |
+ regulator-boot-on; |
456 |
+@@ -164,7 +156,6 @@ |
457 |
+ }; |
458 |
+ |
459 |
+ ldo4: LDO4 { |
460 |
+- regulator-compatible = "LDO4"; |
461 |
+ regulator-min-microvolt = <800000>; |
462 |
+ regulator-max-microvolt = <3300000>; |
463 |
+ regulator-boot-on; |
464 |
+@@ -172,7 +163,6 @@ |
465 |
+ }; |
466 |
+ |
467 |
+ ldo5: LDO5 { |
468 |
+- regulator-compatible = "LDO5"; |
469 |
+ regulator-min-microvolt = <1800000>; |
470 |
+ regulator-max-microvolt = <3300000>; |
471 |
+ }; |
472 |
+diff --git a/arch/arm64/boot/dts/qcom/msm8992-xiaomi-libra.dts b/arch/arm64/boot/dts/qcom/msm8992-xiaomi-libra.dts |
473 |
+index a3d6340a0c55b..d08659c606b9a 100644 |
474 |
+--- a/arch/arm64/boot/dts/qcom/msm8992-xiaomi-libra.dts |
475 |
++++ b/arch/arm64/boot/dts/qcom/msm8992-xiaomi-libra.dts |
476 |
+@@ -11,6 +11,12 @@ |
477 |
+ #include <dt-bindings/gpio/gpio.h> |
478 |
+ #include <dt-bindings/input/gpio-keys.h> |
479 |
+ |
480 |
++/delete-node/ &adsp_mem; |
481 |
++/delete-node/ &audio_mem; |
482 |
++/delete-node/ &mpss_mem; |
483 |
++/delete-node/ &peripheral_region; |
484 |
++/delete-node/ &rmtfs_mem; |
485 |
++ |
486 |
+ / { |
487 |
+ model = "Xiaomi Mi 4C"; |
488 |
+ compatible = "xiaomi,libra", "qcom,msm8992"; |
489 |
+@@ -60,24 +66,66 @@ |
490 |
+ #size-cells = <2>; |
491 |
+ ranges; |
492 |
+ |
493 |
+- /* This is for getting crash logs using Android downstream kernels */ |
494 |
+- ramoops@dfc00000 { |
495 |
+- compatible = "ramoops"; |
496 |
+- reg = <0x0 0xdfc00000 0x0 0x40000>; |
497 |
+- console-size = <0x10000>; |
498 |
+- record-size = <0x10000>; |
499 |
+- ftrace-size = <0x10000>; |
500 |
+- pmsg-size = <0x20000>; |
501 |
++ memory_hole: hole@6400000 { |
502 |
++ reg = <0 0x06400000 0 0x600000>; |
503 |
++ no-map; |
504 |
++ }; |
505 |
++ |
506 |
++ memory_hole2: hole2@6c00000 { |
507 |
++ reg = <0 0x06c00000 0 0x2400000>; |
508 |
++ no-map; |
509 |
++ }; |
510 |
++ |
511 |
++ mpss_mem: mpss@9000000 { |
512 |
++ reg = <0 0x09000000 0 0x5a00000>; |
513 |
++ no-map; |
514 |
++ }; |
515 |
++ |
516 |
++ tzapp: tzapp@ea00000 { |
517 |
++ reg = <0 0x0ea00000 0 0x1900000>; |
518 |
++ no-map; |
519 |
+ }; |
520 |
+ |
521 |
+- modem_region: modem_region@9000000 { |
522 |
+- reg = <0x0 0x9000000 0x0 0x5a00000>; |
523 |
++ mdm_rfsa_mem: mdm-rfsa@ca0b0000 { |
524 |
++ reg = <0 0xca0b0000 0 0x10000>; |
525 |
+ no-map; |
526 |
+ }; |
527 |
+ |
528 |
+- tzapp: modem_region@ea00000 { |
529 |
+- reg = <0x0 0xea00000 0x0 0x1900000>; |
530 |
++ rmtfs_mem: rmtfs@ca100000 { |
531 |
++ compatible = "qcom,rmtfs-mem"; |
532 |
++ reg = <0 0xca100000 0 0x180000>; |
533 |
+ no-map; |
534 |
++ |
535 |
++ qcom,client-id = <1>; |
536 |
++ }; |
537 |
++ |
538 |
++ audio_mem: audio@cb400000 { |
539 |
++ reg = <0 0xcb000000 0 0x400000>; |
540 |
++ no-mem; |
541 |
++ }; |
542 |
++ |
543 |
++ qseecom_mem: qseecom@cb400000 { |
544 |
++ reg = <0 0xcb400000 0 0x1c00000>; |
545 |
++ no-mem; |
546 |
++ }; |
547 |
++ |
548 |
++ adsp_rfsa_mem: adsp-rfsa@cd000000 { |
549 |
++ reg = <0 0xcd000000 0 0x10000>; |
550 |
++ no-map; |
551 |
++ }; |
552 |
++ |
553 |
++ sensor_rfsa_mem: sensor-rfsa@cd010000 { |
554 |
++ reg = <0 0xcd010000 0 0x10000>; |
555 |
++ no-map; |
556 |
++ }; |
557 |
++ |
558 |
++ ramoops@dfc00000 { |
559 |
++ compatible = "ramoops"; |
560 |
++ reg = <0 0xdfc00000 0 0x40000>; |
561 |
++ console-size = <0x10000>; |
562 |
++ record-size = <0x10000>; |
563 |
++ ftrace-size = <0x10000>; |
564 |
++ pmsg-size = <0x20000>; |
565 |
+ }; |
566 |
+ }; |
567 |
+ }; |
568 |
+@@ -120,9 +168,21 @@ |
569 |
+ status = "okay"; |
570 |
+ }; |
571 |
+ |
572 |
+-&peripheral_region { |
573 |
+- reg = <0x0 0x7400000 0x0 0x1c00000>; |
574 |
+- no-map; |
575 |
++&pm8994_spmi_regulators { |
576 |
++ VDD_APC0: s8 { |
577 |
++ regulator-min-microvolt = <680000>; |
578 |
++ regulator-max-microvolt = <1180000>; |
579 |
++ regulator-always-on; |
580 |
++ regulator-boot-on; |
581 |
++ }; |
582 |
++ |
583 |
++ /* APC1 is 3-phase, but quoting downstream, s11 is "the gang leader" */ |
584 |
++ VDD_APC1: s11 { |
585 |
++ regulator-min-microvolt = <700000>; |
586 |
++ regulator-max-microvolt = <1225000>; |
587 |
++ regulator-always-on; |
588 |
++ regulator-boot-on; |
589 |
++ }; |
590 |
+ }; |
591 |
+ |
592 |
+ &rpm_requests { |
593 |
+diff --git a/arch/arm64/boot/dts/qcom/msm8992.dtsi b/arch/arm64/boot/dts/qcom/msm8992.dtsi |
594 |
+index 58fe58cc77036..765e1f1989b58 100644 |
595 |
+--- a/arch/arm64/boot/dts/qcom/msm8992.dtsi |
596 |
++++ b/arch/arm64/boot/dts/qcom/msm8992.dtsi |
597 |
+@@ -14,10 +14,6 @@ |
598 |
+ compatible = "qcom,rpmcc-msm8992"; |
599 |
+ }; |
600 |
+ |
601 |
+-&tcsr_mutex { |
602 |
+- compatible = "qcom,sfpb-mutex"; |
603 |
+-}; |
604 |
+- |
605 |
+ &timer { |
606 |
+ interrupts = <GIC_PPI 2 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>, |
607 |
+ <GIC_PPI 3 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>, |
608 |
+diff --git a/arch/arm64/kernel/traps.c b/arch/arm64/kernel/traps.c |
609 |
+index f859cc870d5b3..21e69a991bc83 100644 |
610 |
+--- a/arch/arm64/kernel/traps.c |
611 |
++++ b/arch/arm64/kernel/traps.c |
612 |
+@@ -235,7 +235,7 @@ void die(const char *str, struct pt_regs *regs, int err) |
613 |
+ raw_spin_unlock_irqrestore(&die_lock, flags); |
614 |
+ |
615 |
+ if (ret != NOTIFY_STOP) |
616 |
+- do_exit(SIGSEGV); |
617 |
++ make_task_dead(SIGSEGV); |
618 |
+ } |
619 |
+ |
620 |
+ static void arm64_show_signal(int signo, const char *str) |
621 |
+diff --git a/arch/arm64/kvm/vgic/vgic-v3.c b/arch/arm64/kvm/vgic/vgic-v3.c |
622 |
+index 21a6207fb2eed..8eb70451323b6 100644 |
623 |
+--- a/arch/arm64/kvm/vgic/vgic-v3.c |
624 |
++++ b/arch/arm64/kvm/vgic/vgic-v3.c |
625 |
+@@ -347,26 +347,23 @@ retry: |
626 |
+ * The deactivation of the doorbell interrupt will trigger the |
627 |
+ * unmapping of the associated vPE. |
628 |
+ */ |
629 |
+-static void unmap_all_vpes(struct vgic_dist *dist) |
630 |
++static void unmap_all_vpes(struct kvm *kvm) |
631 |
+ { |
632 |
+- struct irq_desc *desc; |
633 |
++ struct vgic_dist *dist = &kvm->arch.vgic; |
634 |
+ int i; |
635 |
+ |
636 |
+- for (i = 0; i < dist->its_vm.nr_vpes; i++) { |
637 |
+- desc = irq_to_desc(dist->its_vm.vpes[i]->irq); |
638 |
+- irq_domain_deactivate_irq(irq_desc_get_irq_data(desc)); |
639 |
+- } |
640 |
++ for (i = 0; i < dist->its_vm.nr_vpes; i++) |
641 |
++ free_irq(dist->its_vm.vpes[i]->irq, kvm_get_vcpu(kvm, i)); |
642 |
+ } |
643 |
+ |
644 |
+-static void map_all_vpes(struct vgic_dist *dist) |
645 |
++static void map_all_vpes(struct kvm *kvm) |
646 |
+ { |
647 |
+- struct irq_desc *desc; |
648 |
++ struct vgic_dist *dist = &kvm->arch.vgic; |
649 |
+ int i; |
650 |
+ |
651 |
+- for (i = 0; i < dist->its_vm.nr_vpes; i++) { |
652 |
+- desc = irq_to_desc(dist->its_vm.vpes[i]->irq); |
653 |
+- irq_domain_activate_irq(irq_desc_get_irq_data(desc), false); |
654 |
+- } |
655 |
++ for (i = 0; i < dist->its_vm.nr_vpes; i++) |
656 |
++ WARN_ON(vgic_v4_request_vpe_irq(kvm_get_vcpu(kvm, i), |
657 |
++ dist->its_vm.vpes[i]->irq)); |
658 |
+ } |
659 |
+ |
660 |
+ /** |
661 |
+@@ -391,7 +388,7 @@ int vgic_v3_save_pending_tables(struct kvm *kvm) |
662 |
+ * and enabling of the doorbells have already been done. |
663 |
+ */ |
664 |
+ if (kvm_vgic_global_state.has_gicv4_1) { |
665 |
+- unmap_all_vpes(dist); |
666 |
++ unmap_all_vpes(kvm); |
667 |
+ vlpi_avail = true; |
668 |
+ } |
669 |
+ |
670 |
+@@ -441,7 +438,7 @@ int vgic_v3_save_pending_tables(struct kvm *kvm) |
671 |
+ |
672 |
+ out: |
673 |
+ if (vlpi_avail) |
674 |
+- map_all_vpes(dist); |
675 |
++ map_all_vpes(kvm); |
676 |
+ |
677 |
+ return ret; |
678 |
+ } |
679 |
+diff --git a/arch/arm64/kvm/vgic/vgic-v4.c b/arch/arm64/kvm/vgic/vgic-v4.c |
680 |
+index c1845d8f5f7e7..f507e3fcffce3 100644 |
681 |
+--- a/arch/arm64/kvm/vgic/vgic-v4.c |
682 |
++++ b/arch/arm64/kvm/vgic/vgic-v4.c |
683 |
+@@ -222,6 +222,11 @@ void vgic_v4_get_vlpi_state(struct vgic_irq *irq, bool *val) |
684 |
+ *val = !!(*ptr & mask); |
685 |
+ } |
686 |
+ |
687 |
++int vgic_v4_request_vpe_irq(struct kvm_vcpu *vcpu, int irq) |
688 |
++{ |
689 |
++ return request_irq(irq, vgic_v4_doorbell_handler, 0, "vcpu", vcpu); |
690 |
++} |
691 |
++ |
692 |
+ /** |
693 |
+ * vgic_v4_init - Initialize the GICv4 data structures |
694 |
+ * @kvm: Pointer to the VM being initialized |
695 |
+@@ -282,8 +287,7 @@ int vgic_v4_init(struct kvm *kvm) |
696 |
+ irq_flags &= ~IRQ_NOAUTOEN; |
697 |
+ irq_set_status_flags(irq, irq_flags); |
698 |
+ |
699 |
+- ret = request_irq(irq, vgic_v4_doorbell_handler, |
700 |
+- 0, "vcpu", vcpu); |
701 |
++ ret = vgic_v4_request_vpe_irq(vcpu, irq); |
702 |
+ if (ret) { |
703 |
+ kvm_err("failed to allocate vcpu IRQ%d\n", irq); |
704 |
+ /* |
705 |
+diff --git a/arch/arm64/kvm/vgic/vgic.h b/arch/arm64/kvm/vgic/vgic.h |
706 |
+index 14a9218641f57..36021c31a706a 100644 |
707 |
+--- a/arch/arm64/kvm/vgic/vgic.h |
708 |
++++ b/arch/arm64/kvm/vgic/vgic.h |
709 |
+@@ -321,5 +321,6 @@ int vgic_v4_init(struct kvm *kvm); |
710 |
+ void vgic_v4_teardown(struct kvm *kvm); |
711 |
+ void vgic_v4_configure_vsgis(struct kvm *kvm); |
712 |
+ void vgic_v4_get_vlpi_state(struct vgic_irq *irq, bool *val); |
713 |
++int vgic_v4_request_vpe_irq(struct kvm_vcpu *vcpu, int irq); |
714 |
+ |
715 |
+ #endif |
716 |
+diff --git a/arch/arm64/mm/fault.c b/arch/arm64/mm/fault.c |
717 |
+index d09b21faa0b23..97a93ee756a2e 100644 |
718 |
+--- a/arch/arm64/mm/fault.c |
719 |
++++ b/arch/arm64/mm/fault.c |
720 |
+@@ -302,7 +302,7 @@ static void die_kernel_fault(const char *msg, unsigned long addr, |
721 |
+ show_pte(addr); |
722 |
+ die("Oops", regs, esr); |
723 |
+ bust_spinlocks(0); |
724 |
+- do_exit(SIGKILL); |
725 |
++ make_task_dead(SIGKILL); |
726 |
+ } |
727 |
+ |
728 |
+ #ifdef CONFIG_KASAN_HW_TAGS |
729 |
+diff --git a/arch/csky/abiv1/alignment.c b/arch/csky/abiv1/alignment.c |
730 |
+index cb2a0d94a144d..2df115d0e2105 100644 |
731 |
+--- a/arch/csky/abiv1/alignment.c |
732 |
++++ b/arch/csky/abiv1/alignment.c |
733 |
+@@ -294,7 +294,7 @@ bad_area: |
734 |
+ __func__, opcode, rz, rx, imm, addr); |
735 |
+ show_regs(regs); |
736 |
+ bust_spinlocks(0); |
737 |
+- do_exit(SIGKILL); |
738 |
++ make_task_dead(SIGKILL); |
739 |
+ } |
740 |
+ |
741 |
+ force_sig_fault(SIGBUS, BUS_ADRALN, (void __user *)addr); |
742 |
+diff --git a/arch/csky/kernel/traps.c b/arch/csky/kernel/traps.c |
743 |
+index 2020af88b6361..6e426fba01193 100644 |
744 |
+--- a/arch/csky/kernel/traps.c |
745 |
++++ b/arch/csky/kernel/traps.c |
746 |
+@@ -109,7 +109,7 @@ void die(struct pt_regs *regs, const char *str) |
747 |
+ if (panic_on_oops) |
748 |
+ panic("Fatal exception"); |
749 |
+ if (ret != NOTIFY_STOP) |
750 |
+- do_exit(SIGSEGV); |
751 |
++ make_task_dead(SIGSEGV); |
752 |
+ } |
753 |
+ |
754 |
+ void do_trap(struct pt_regs *regs, int signo, int code, unsigned long addr) |
755 |
+diff --git a/arch/csky/mm/fault.c b/arch/csky/mm/fault.c |
756 |
+index 466ad949818a6..7215a46b6b8eb 100644 |
757 |
+--- a/arch/csky/mm/fault.c |
758 |
++++ b/arch/csky/mm/fault.c |
759 |
+@@ -67,7 +67,7 @@ static inline void no_context(struct pt_regs *regs, unsigned long addr) |
760 |
+ pr_alert("Unable to handle kernel paging request at virtual " |
761 |
+ "addr 0x%08lx, pc: 0x%08lx\n", addr, regs->pc); |
762 |
+ die(regs, "Oops"); |
763 |
+- do_exit(SIGKILL); |
764 |
++ make_task_dead(SIGKILL); |
765 |
+ } |
766 |
+ |
767 |
+ static inline void mm_fault_error(struct pt_regs *regs, unsigned long addr, vm_fault_t fault) |
768 |
+diff --git a/arch/h8300/kernel/traps.c b/arch/h8300/kernel/traps.c |
769 |
+index bdbe988d8dbcf..a92c39e03802e 100644 |
770 |
+--- a/arch/h8300/kernel/traps.c |
771 |
++++ b/arch/h8300/kernel/traps.c |
772 |
+@@ -17,6 +17,7 @@ |
773 |
+ #include <linux/types.h> |
774 |
+ #include <linux/sched.h> |
775 |
+ #include <linux/sched/debug.h> |
776 |
++#include <linux/sched/task.h> |
777 |
+ #include <linux/mm_types.h> |
778 |
+ #include <linux/kernel.h> |
779 |
+ #include <linux/errno.h> |
780 |
+@@ -106,7 +107,7 @@ void die(const char *str, struct pt_regs *fp, unsigned long err) |
781 |
+ dump(fp); |
782 |
+ |
783 |
+ spin_unlock_irq(&die_lock); |
784 |
+- do_exit(SIGSEGV); |
785 |
++ make_task_dead(SIGSEGV); |
786 |
+ } |
787 |
+ |
788 |
+ static int kstack_depth_to_print = 24; |
789 |
+diff --git a/arch/h8300/mm/fault.c b/arch/h8300/mm/fault.c |
790 |
+index d4bc9c16f2df9..b465441f490df 100644 |
791 |
+--- a/arch/h8300/mm/fault.c |
792 |
++++ b/arch/h8300/mm/fault.c |
793 |
+@@ -51,7 +51,7 @@ asmlinkage int do_page_fault(struct pt_regs *regs, unsigned long address, |
794 |
+ printk(" at virtual address %08lx\n", address); |
795 |
+ if (!user_mode(regs)) |
796 |
+ die("Oops", regs, error_code); |
797 |
+- do_exit(SIGKILL); |
798 |
++ make_task_dead(SIGKILL); |
799 |
+ |
800 |
+ return 1; |
801 |
+ } |
802 |
+diff --git a/arch/hexagon/kernel/traps.c b/arch/hexagon/kernel/traps.c |
803 |
+index edfc35dafeb19..1240f038cce02 100644 |
804 |
+--- a/arch/hexagon/kernel/traps.c |
805 |
++++ b/arch/hexagon/kernel/traps.c |
806 |
+@@ -214,7 +214,7 @@ int die(const char *str, struct pt_regs *regs, long err) |
807 |
+ panic("Fatal exception"); |
808 |
+ |
809 |
+ oops_exit(); |
810 |
+- do_exit(err); |
811 |
++ make_task_dead(err); |
812 |
+ return 0; |
813 |
+ } |
814 |
+ |
815 |
+diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig |
816 |
+index 1e33666fa679b..b1f2b6ac9b1d5 100644 |
817 |
+--- a/arch/ia64/Kconfig |
818 |
++++ b/arch/ia64/Kconfig |
819 |
+@@ -323,7 +323,7 @@ config ARCH_PROC_KCORE_TEXT |
820 |
+ depends on PROC_KCORE |
821 |
+ |
822 |
+ config IA64_MCA_RECOVERY |
823 |
+- tristate "MCA recovery from errors other than TLB." |
824 |
++ bool "MCA recovery from errors other than TLB." |
825 |
+ |
826 |
+ config IA64_PALINFO |
827 |
+ tristate "/proc/pal support" |
828 |
+diff --git a/arch/ia64/kernel/mca_drv.c b/arch/ia64/kernel/mca_drv.c |
829 |
+index 5bfc79be4cefe..23c203639a968 100644 |
830 |
+--- a/arch/ia64/kernel/mca_drv.c |
831 |
++++ b/arch/ia64/kernel/mca_drv.c |
832 |
+@@ -176,7 +176,7 @@ mca_handler_bh(unsigned long paddr, void *iip, unsigned long ipsr) |
833 |
+ spin_unlock(&mca_bh_lock); |
834 |
+ |
835 |
+ /* This process is about to be killed itself */ |
836 |
+- do_exit(SIGKILL); |
837 |
++ make_task_dead(SIGKILL); |
838 |
+ } |
839 |
+ |
840 |
+ /** |
841 |
+diff --git a/arch/ia64/kernel/traps.c b/arch/ia64/kernel/traps.c |
842 |
+index e13cb905930fb..753642366e12e 100644 |
843 |
+--- a/arch/ia64/kernel/traps.c |
844 |
++++ b/arch/ia64/kernel/traps.c |
845 |
+@@ -85,7 +85,7 @@ die (const char *str, struct pt_regs *regs, long err) |
846 |
+ if (panic_on_oops) |
847 |
+ panic("Fatal exception"); |
848 |
+ |
849 |
+- do_exit(SIGSEGV); |
850 |
++ make_task_dead(SIGSEGV); |
851 |
+ return 0; |
852 |
+ } |
853 |
+ |
854 |
+diff --git a/arch/ia64/mm/fault.c b/arch/ia64/mm/fault.c |
855 |
+index 02de2e70c5874..4796cccbf74f3 100644 |
856 |
+--- a/arch/ia64/mm/fault.c |
857 |
++++ b/arch/ia64/mm/fault.c |
858 |
+@@ -259,7 +259,7 @@ retry: |
859 |
+ regs = NULL; |
860 |
+ bust_spinlocks(0); |
861 |
+ if (regs) |
862 |
+- do_exit(SIGKILL); |
863 |
++ make_task_dead(SIGKILL); |
864 |
+ return; |
865 |
+ |
866 |
+ out_of_memory: |
867 |
+diff --git a/arch/m68k/kernel/traps.c b/arch/m68k/kernel/traps.c |
868 |
+index 34d6458340b0f..59fc63feb0dcc 100644 |
869 |
+--- a/arch/m68k/kernel/traps.c |
870 |
++++ b/arch/m68k/kernel/traps.c |
871 |
+@@ -1131,7 +1131,7 @@ void die_if_kernel (char *str, struct pt_regs *fp, int nr) |
872 |
+ pr_crit("%s: %08x\n", str, nr); |
873 |
+ show_registers(fp); |
874 |
+ add_taint(TAINT_DIE, LOCKDEP_NOW_UNRELIABLE); |
875 |
+- do_exit(SIGSEGV); |
876 |
++ make_task_dead(SIGSEGV); |
877 |
+ } |
878 |
+ |
879 |
+ asmlinkage void set_esp0(unsigned long ssp) |
880 |
+diff --git a/arch/m68k/mm/fault.c b/arch/m68k/mm/fault.c |
881 |
+index ef46e77e97a5b..fcb3a0d8421c5 100644 |
882 |
+--- a/arch/m68k/mm/fault.c |
883 |
++++ b/arch/m68k/mm/fault.c |
884 |
+@@ -48,7 +48,7 @@ int send_fault_sig(struct pt_regs *regs) |
885 |
+ pr_alert("Unable to handle kernel access"); |
886 |
+ pr_cont(" at virtual address %p\n", addr); |
887 |
+ die_if_kernel("Oops", regs, 0 /*error_code*/); |
888 |
+- do_exit(SIGKILL); |
889 |
++ make_task_dead(SIGKILL); |
890 |
+ } |
891 |
+ |
892 |
+ return 1; |
893 |
+diff --git a/arch/microblaze/kernel/exceptions.c b/arch/microblaze/kernel/exceptions.c |
894 |
+index 908788497b287..fd153d5fab982 100644 |
895 |
+--- a/arch/microblaze/kernel/exceptions.c |
896 |
++++ b/arch/microblaze/kernel/exceptions.c |
897 |
+@@ -44,10 +44,10 @@ void die(const char *str, struct pt_regs *fp, long err) |
898 |
+ pr_warn("Oops: %s, sig: %ld\n", str, err); |
899 |
+ show_regs(fp); |
900 |
+ spin_unlock_irq(&die_lock); |
901 |
+- /* do_exit() should take care of panic'ing from an interrupt |
902 |
++ /* make_task_dead() should take care of panic'ing from an interrupt |
903 |
+ * context so we don't handle it here |
904 |
+ */ |
905 |
+- do_exit(err); |
906 |
++ make_task_dead(err); |
907 |
+ } |
908 |
+ |
909 |
+ /* for user application debugging */ |
910 |
+diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c |
911 |
+index edd93430b954a..afb2c955d99ef 100644 |
912 |
+--- a/arch/mips/kernel/traps.c |
913 |
++++ b/arch/mips/kernel/traps.c |
914 |
+@@ -416,7 +416,7 @@ void __noreturn die(const char *str, struct pt_regs *regs) |
915 |
+ if (regs && kexec_should_crash(current)) |
916 |
+ crash_kexec(regs); |
917 |
+ |
918 |
+- do_exit(sig); |
919 |
++ make_task_dead(sig); |
920 |
+ } |
921 |
+ |
922 |
+ extern struct exception_table_entry __start___dbe_table[]; |
923 |
+diff --git a/arch/nds32/kernel/fpu.c b/arch/nds32/kernel/fpu.c |
924 |
+index 9edd7ed7d7bf8..701c09a668de4 100644 |
925 |
+--- a/arch/nds32/kernel/fpu.c |
926 |
++++ b/arch/nds32/kernel/fpu.c |
927 |
+@@ -223,7 +223,7 @@ inline void handle_fpu_exception(struct pt_regs *regs) |
928 |
+ } |
929 |
+ } else if (fpcsr & FPCSR_mskRIT) { |
930 |
+ if (!user_mode(regs)) |
931 |
+- do_exit(SIGILL); |
932 |
++ make_task_dead(SIGILL); |
933 |
+ si_signo = SIGILL; |
934 |
+ } |
935 |
+ |
936 |
+diff --git a/arch/nds32/kernel/traps.c b/arch/nds32/kernel/traps.c |
937 |
+index f06421c645aff..b90030e8e546f 100644 |
938 |
+--- a/arch/nds32/kernel/traps.c |
939 |
++++ b/arch/nds32/kernel/traps.c |
940 |
+@@ -141,7 +141,7 @@ void die(const char *str, struct pt_regs *regs, int err) |
941 |
+ |
942 |
+ bust_spinlocks(0); |
943 |
+ spin_unlock_irq(&die_lock); |
944 |
+- do_exit(SIGSEGV); |
945 |
++ make_task_dead(SIGSEGV); |
946 |
+ } |
947 |
+ |
948 |
+ EXPORT_SYMBOL(die); |
949 |
+@@ -240,7 +240,7 @@ void unhandled_interruption(struct pt_regs *regs) |
950 |
+ pr_emerg("unhandled_interruption\n"); |
951 |
+ show_regs(regs); |
952 |
+ if (!user_mode(regs)) |
953 |
+- do_exit(SIGKILL); |
954 |
++ make_task_dead(SIGKILL); |
955 |
+ force_sig(SIGKILL); |
956 |
+ } |
957 |
+ |
958 |
+@@ -251,7 +251,7 @@ void unhandled_exceptions(unsigned long entry, unsigned long addr, |
959 |
+ addr, type); |
960 |
+ show_regs(regs); |
961 |
+ if (!user_mode(regs)) |
962 |
+- do_exit(SIGKILL); |
963 |
++ make_task_dead(SIGKILL); |
964 |
+ force_sig(SIGKILL); |
965 |
+ } |
966 |
+ |
967 |
+@@ -278,7 +278,7 @@ void do_revinsn(struct pt_regs *regs) |
968 |
+ pr_emerg("Reserved Instruction\n"); |
969 |
+ show_regs(regs); |
970 |
+ if (!user_mode(regs)) |
971 |
+- do_exit(SIGILL); |
972 |
++ make_task_dead(SIGILL); |
973 |
+ force_sig(SIGILL); |
974 |
+ } |
975 |
+ |
976 |
+diff --git a/arch/nios2/kernel/traps.c b/arch/nios2/kernel/traps.c |
977 |
+index 596986a74a26d..85ac49d64cf73 100644 |
978 |
+--- a/arch/nios2/kernel/traps.c |
979 |
++++ b/arch/nios2/kernel/traps.c |
980 |
+@@ -37,10 +37,10 @@ void die(const char *str, struct pt_regs *regs, long err) |
981 |
+ show_regs(regs); |
982 |
+ spin_unlock_irq(&die_lock); |
983 |
+ /* |
984 |
+- * do_exit() should take care of panic'ing from an interrupt |
985 |
++ * make_task_dead() should take care of panic'ing from an interrupt |
986 |
+ * context so we don't handle it here |
987 |
+ */ |
988 |
+- do_exit(err); |
989 |
++ make_task_dead(err); |
990 |
+ } |
991 |
+ |
992 |
+ void _exception(int signo, struct pt_regs *regs, int code, unsigned long addr) |
993 |
+diff --git a/arch/openrisc/kernel/traps.c b/arch/openrisc/kernel/traps.c |
994 |
+index aa1e709405acd..9df1d85bfe1d1 100644 |
995 |
+--- a/arch/openrisc/kernel/traps.c |
996 |
++++ b/arch/openrisc/kernel/traps.c |
997 |
+@@ -212,7 +212,7 @@ void die(const char *str, struct pt_regs *regs, long err) |
998 |
+ __asm__ __volatile__("l.nop 1"); |
999 |
+ do {} while (1); |
1000 |
+ #endif |
1001 |
+- do_exit(SIGSEGV); |
1002 |
++ make_task_dead(SIGSEGV); |
1003 |
+ } |
1004 |
+ |
1005 |
+ /* This is normally the 'Oops' routine */ |
1006 |
+diff --git a/arch/parisc/kernel/traps.c b/arch/parisc/kernel/traps.c |
1007 |
+index 6fe5a3e98edc2..70ace36879507 100644 |
1008 |
+--- a/arch/parisc/kernel/traps.c |
1009 |
++++ b/arch/parisc/kernel/traps.c |
1010 |
+@@ -268,7 +268,7 @@ void die_if_kernel(char *str, struct pt_regs *regs, long err) |
1011 |
+ panic("Fatal exception"); |
1012 |
+ |
1013 |
+ oops_exit(); |
1014 |
+- do_exit(SIGSEGV); |
1015 |
++ make_task_dead(SIGSEGV); |
1016 |
+ } |
1017 |
+ |
1018 |
+ /* gdb uses break 4,8 */ |
1019 |
+diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c |
1020 |
+index 11741703d26e0..a08bb7cefdc54 100644 |
1021 |
+--- a/arch/powerpc/kernel/traps.c |
1022 |
++++ b/arch/powerpc/kernel/traps.c |
1023 |
+@@ -245,7 +245,7 @@ static void oops_end(unsigned long flags, struct pt_regs *regs, |
1024 |
+ |
1025 |
+ if (panic_on_oops) |
1026 |
+ panic("Fatal exception"); |
1027 |
+- do_exit(signr); |
1028 |
++ make_task_dead(signr); |
1029 |
+ } |
1030 |
+ NOKPROBE_SYMBOL(oops_end); |
1031 |
+ |
1032 |
+@@ -792,9 +792,9 @@ int machine_check_generic(struct pt_regs *regs) |
1033 |
+ void die_mce(const char *str, struct pt_regs *regs, long err) |
1034 |
+ { |
1035 |
+ /* |
1036 |
+- * The machine check wants to kill the interrupted context, but |
1037 |
+- * do_exit() checks for in_interrupt() and panics in that case, so |
1038 |
+- * exit the irq/nmi before calling die. |
1039 |
++ * The machine check wants to kill the interrupted context, |
1040 |
++ * but make_task_dead() checks for in_interrupt() and panics |
1041 |
++ * in that case, so exit the irq/nmi before calling die. |
1042 |
+ */ |
1043 |
+ if (in_nmi()) |
1044 |
+ nmi_exit(); |
1045 |
+diff --git a/arch/riscv/kernel/probes/simulate-insn.c b/arch/riscv/kernel/probes/simulate-insn.c |
1046 |
+index d73e96f6ed7c5..a20568bd1f1a8 100644 |
1047 |
+--- a/arch/riscv/kernel/probes/simulate-insn.c |
1048 |
++++ b/arch/riscv/kernel/probes/simulate-insn.c |
1049 |
+@@ -71,11 +71,11 @@ bool __kprobes simulate_jalr(u32 opcode, unsigned long addr, struct pt_regs *reg |
1050 |
+ u32 rd_index = (opcode >> 7) & 0x1f; |
1051 |
+ u32 rs1_index = (opcode >> 15) & 0x1f; |
1052 |
+ |
1053 |
+- ret = rv_insn_reg_set_val(regs, rd_index, addr + 4); |
1054 |
++ ret = rv_insn_reg_get_val(regs, rs1_index, &base_addr); |
1055 |
+ if (!ret) |
1056 |
+ return ret; |
1057 |
+ |
1058 |
+- ret = rv_insn_reg_get_val(regs, rs1_index, &base_addr); |
1059 |
++ ret = rv_insn_reg_set_val(regs, rd_index, addr + 4); |
1060 |
+ if (!ret) |
1061 |
+ return ret; |
1062 |
+ |
1063 |
+diff --git a/arch/riscv/kernel/traps.c b/arch/riscv/kernel/traps.c |
1064 |
+index 4102c97309cc2..6084bd93d2f58 100644 |
1065 |
+--- a/arch/riscv/kernel/traps.c |
1066 |
++++ b/arch/riscv/kernel/traps.c |
1067 |
+@@ -59,7 +59,7 @@ void die(struct pt_regs *regs, const char *str) |
1068 |
+ if (panic_on_oops) |
1069 |
+ panic("Fatal exception"); |
1070 |
+ if (ret != NOTIFY_STOP) |
1071 |
+- do_exit(SIGSEGV); |
1072 |
++ make_task_dead(SIGSEGV); |
1073 |
+ } |
1074 |
+ |
1075 |
+ void do_trap(struct pt_regs *regs, int signo, int code, unsigned long addr) |
1076 |
+diff --git a/arch/riscv/mm/fault.c b/arch/riscv/mm/fault.c |
1077 |
+index 7cfaf366463fb..676a3f28811fa 100644 |
1078 |
+--- a/arch/riscv/mm/fault.c |
1079 |
++++ b/arch/riscv/mm/fault.c |
1080 |
+@@ -31,7 +31,7 @@ static void die_kernel_fault(const char *msg, unsigned long addr, |
1081 |
+ |
1082 |
+ bust_spinlocks(0); |
1083 |
+ die(regs, "Oops"); |
1084 |
+- do_exit(SIGKILL); |
1085 |
++ make_task_dead(SIGKILL); |
1086 |
+ } |
1087 |
+ |
1088 |
+ static inline void no_context(struct pt_regs *regs, unsigned long addr) |
1089 |
+diff --git a/arch/s390/include/asm/debug.h b/arch/s390/include/asm/debug.h |
1090 |
+index 19a55e1e3a0c5..5fc91a90657e7 100644 |
1091 |
+--- a/arch/s390/include/asm/debug.h |
1092 |
++++ b/arch/s390/include/asm/debug.h |
1093 |
+@@ -4,8 +4,8 @@ |
1094 |
+ * |
1095 |
+ * Copyright IBM Corp. 1999, 2020 |
1096 |
+ */ |
1097 |
+-#ifndef DEBUG_H |
1098 |
+-#define DEBUG_H |
1099 |
++#ifndef _ASM_S390_DEBUG_H |
1100 |
++#define _ASM_S390_DEBUG_H |
1101 |
+ |
1102 |
+ #include <linux/string.h> |
1103 |
+ #include <linux/spinlock.h> |
1104 |
+@@ -487,4 +487,4 @@ void debug_register_static(debug_info_t *id, int pages_per_area, int nr_areas); |
1105 |
+ |
1106 |
+ #endif /* MODULE */ |
1107 |
+ |
1108 |
+-#endif /* DEBUG_H */ |
1109 |
++#endif /* _ASM_S390_DEBUG_H */ |
1110 |
+diff --git a/arch/s390/kernel/dumpstack.c b/arch/s390/kernel/dumpstack.c |
1111 |
+index db1bc00229caf..272ef8597e208 100644 |
1112 |
+--- a/arch/s390/kernel/dumpstack.c |
1113 |
++++ b/arch/s390/kernel/dumpstack.c |
1114 |
+@@ -224,5 +224,5 @@ void die(struct pt_regs *regs, const char *str) |
1115 |
+ if (panic_on_oops) |
1116 |
+ panic("Fatal exception: panic_on_oops"); |
1117 |
+ oops_exit(); |
1118 |
+- do_exit(SIGSEGV); |
1119 |
++ make_task_dead(SIGSEGV); |
1120 |
+ } |
1121 |
+diff --git a/arch/s390/kernel/nmi.c b/arch/s390/kernel/nmi.c |
1122 |
+index 383b4799b6dd3..d4f071e73a0a6 100644 |
1123 |
+--- a/arch/s390/kernel/nmi.c |
1124 |
++++ b/arch/s390/kernel/nmi.c |
1125 |
+@@ -175,7 +175,7 @@ void __s390_handle_mcck(void) |
1126 |
+ "malfunction (code 0x%016lx).\n", mcck.mcck_code); |
1127 |
+ printk(KERN_EMERG "mcck: task: %s, pid: %d.\n", |
1128 |
+ current->comm, current->pid); |
1129 |
+- do_exit(SIGSEGV); |
1130 |
++ make_task_dead(SIGSEGV); |
1131 |
+ } |
1132 |
+ } |
1133 |
+ |
1134 |
+diff --git a/arch/s390/kernel/vmlinux.lds.S b/arch/s390/kernel/vmlinux.lds.S |
1135 |
+index b508ccad4856d..8ce1615c10467 100644 |
1136 |
+--- a/arch/s390/kernel/vmlinux.lds.S |
1137 |
++++ b/arch/s390/kernel/vmlinux.lds.S |
1138 |
+@@ -80,6 +80,7 @@ SECTIONS |
1139 |
+ _end_amode31_refs = .; |
1140 |
+ } |
1141 |
+ |
1142 |
++ . = ALIGN(PAGE_SIZE); |
1143 |
+ _edata = .; /* End of data section */ |
1144 |
+ |
1145 |
+ /* will be freed after init */ |
1146 |
+@@ -194,6 +195,7 @@ SECTIONS |
1147 |
+ |
1148 |
+ BSS_SECTION(PAGE_SIZE, 4 * PAGE_SIZE, PAGE_SIZE) |
1149 |
+ |
1150 |
++ . = ALIGN(PAGE_SIZE); |
1151 |
+ _end = . ; |
1152 |
+ |
1153 |
+ /* |
1154 |
+diff --git a/arch/s390/kvm/interrupt.c b/arch/s390/kvm/interrupt.c |
1155 |
+index 8ce03a5ca8634..ca7d09f098092 100644 |
1156 |
+--- a/arch/s390/kvm/interrupt.c |
1157 |
++++ b/arch/s390/kvm/interrupt.c |
1158 |
+@@ -81,8 +81,9 @@ static int sca_inject_ext_call(struct kvm_vcpu *vcpu, int src_id) |
1159 |
+ struct esca_block *sca = vcpu->kvm->arch.sca; |
1160 |
+ union esca_sigp_ctrl *sigp_ctrl = |
1161 |
+ &(sca->cpu[vcpu->vcpu_id].sigp_ctrl); |
1162 |
+- union esca_sigp_ctrl new_val = {0}, old_val = *sigp_ctrl; |
1163 |
++ union esca_sigp_ctrl new_val = {0}, old_val; |
1164 |
+ |
1165 |
++ old_val = READ_ONCE(*sigp_ctrl); |
1166 |
+ new_val.scn = src_id; |
1167 |
+ new_val.c = 1; |
1168 |
+ old_val.c = 0; |
1169 |
+@@ -93,8 +94,9 @@ static int sca_inject_ext_call(struct kvm_vcpu *vcpu, int src_id) |
1170 |
+ struct bsca_block *sca = vcpu->kvm->arch.sca; |
1171 |
+ union bsca_sigp_ctrl *sigp_ctrl = |
1172 |
+ &(sca->cpu[vcpu->vcpu_id].sigp_ctrl); |
1173 |
+- union bsca_sigp_ctrl new_val = {0}, old_val = *sigp_ctrl; |
1174 |
++ union bsca_sigp_ctrl new_val = {0}, old_val; |
1175 |
+ |
1176 |
++ old_val = READ_ONCE(*sigp_ctrl); |
1177 |
+ new_val.scn = src_id; |
1178 |
+ new_val.c = 1; |
1179 |
+ old_val.c = 0; |
1180 |
+@@ -124,16 +126,18 @@ static void sca_clear_ext_call(struct kvm_vcpu *vcpu) |
1181 |
+ struct esca_block *sca = vcpu->kvm->arch.sca; |
1182 |
+ union esca_sigp_ctrl *sigp_ctrl = |
1183 |
+ &(sca->cpu[vcpu->vcpu_id].sigp_ctrl); |
1184 |
+- union esca_sigp_ctrl old = *sigp_ctrl; |
1185 |
++ union esca_sigp_ctrl old; |
1186 |
+ |
1187 |
++ old = READ_ONCE(*sigp_ctrl); |
1188 |
+ expect = old.value; |
1189 |
+ rc = cmpxchg(&sigp_ctrl->value, old.value, 0); |
1190 |
+ } else { |
1191 |
+ struct bsca_block *sca = vcpu->kvm->arch.sca; |
1192 |
+ union bsca_sigp_ctrl *sigp_ctrl = |
1193 |
+ &(sca->cpu[vcpu->vcpu_id].sigp_ctrl); |
1194 |
+- union bsca_sigp_ctrl old = *sigp_ctrl; |
1195 |
++ union bsca_sigp_ctrl old; |
1196 |
+ |
1197 |
++ old = READ_ONCE(*sigp_ctrl); |
1198 |
+ expect = old.value; |
1199 |
+ rc = cmpxchg(&sigp_ctrl->value, old.value, 0); |
1200 |
+ } |
1201 |
+diff --git a/arch/sh/kernel/traps.c b/arch/sh/kernel/traps.c |
1202 |
+index e76b221570999..361b764700b74 100644 |
1203 |
+--- a/arch/sh/kernel/traps.c |
1204 |
++++ b/arch/sh/kernel/traps.c |
1205 |
+@@ -57,7 +57,7 @@ void die(const char *str, struct pt_regs *regs, long err) |
1206 |
+ if (panic_on_oops) |
1207 |
+ panic("Fatal exception"); |
1208 |
+ |
1209 |
+- do_exit(SIGSEGV); |
1210 |
++ make_task_dead(SIGSEGV); |
1211 |
+ } |
1212 |
+ |
1213 |
+ void die_if_kernel(const char *str, struct pt_regs *regs, long err) |
1214 |
+diff --git a/arch/sparc/kernel/traps_32.c b/arch/sparc/kernel/traps_32.c |
1215 |
+index 5630e5a395e0d..179aabfa712ea 100644 |
1216 |
+--- a/arch/sparc/kernel/traps_32.c |
1217 |
++++ b/arch/sparc/kernel/traps_32.c |
1218 |
+@@ -86,9 +86,7 @@ void __noreturn die_if_kernel(char *str, struct pt_regs *regs) |
1219 |
+ } |
1220 |
+ printk("Instruction DUMP:"); |
1221 |
+ instruction_dump ((unsigned long *) regs->pc); |
1222 |
+- if(regs->psr & PSR_PS) |
1223 |
+- do_exit(SIGKILL); |
1224 |
+- do_exit(SIGSEGV); |
1225 |
++ make_task_dead((regs->psr & PSR_PS) ? SIGKILL : SIGSEGV); |
1226 |
+ } |
1227 |
+ |
1228 |
+ void do_hw_interrupt(struct pt_regs *regs, unsigned long type) |
1229 |
+diff --git a/arch/sparc/kernel/traps_64.c b/arch/sparc/kernel/traps_64.c |
1230 |
+index 6863025ed56d2..21077821f4272 100644 |
1231 |
+--- a/arch/sparc/kernel/traps_64.c |
1232 |
++++ b/arch/sparc/kernel/traps_64.c |
1233 |
+@@ -2559,9 +2559,7 @@ void __noreturn die_if_kernel(char *str, struct pt_regs *regs) |
1234 |
+ } |
1235 |
+ if (panic_on_oops) |
1236 |
+ panic("Fatal exception"); |
1237 |
+- if (regs->tstate & TSTATE_PRIV) |
1238 |
+- do_exit(SIGKILL); |
1239 |
+- do_exit(SIGSEGV); |
1240 |
++ make_task_dead((regs->tstate & TSTATE_PRIV)? SIGKILL : SIGSEGV); |
1241 |
+ } |
1242 |
+ EXPORT_SYMBOL(die_if_kernel); |
1243 |
+ |
1244 |
+diff --git a/arch/x86/entry/entry_32.S b/arch/x86/entry/entry_32.S |
1245 |
+index 6b44263d7efbc..e309e71560389 100644 |
1246 |
+--- a/arch/x86/entry/entry_32.S |
1247 |
++++ b/arch/x86/entry/entry_32.S |
1248 |
+@@ -1239,14 +1239,14 @@ SYM_CODE_START(asm_exc_nmi) |
1249 |
+ SYM_CODE_END(asm_exc_nmi) |
1250 |
+ |
1251 |
+ .pushsection .text, "ax" |
1252 |
+-SYM_CODE_START(rewind_stack_do_exit) |
1253 |
++SYM_CODE_START(rewind_stack_and_make_dead) |
1254 |
+ /* Prevent any naive code from trying to unwind to our caller. */ |
1255 |
+ xorl %ebp, %ebp |
1256 |
+ |
1257 |
+ movl PER_CPU_VAR(cpu_current_top_of_stack), %esi |
1258 |
+ leal -TOP_OF_KERNEL_STACK_PADDING-PTREGS_SIZE(%esi), %esp |
1259 |
+ |
1260 |
+- call do_exit |
1261 |
++ call make_task_dead |
1262 |
+ 1: jmp 1b |
1263 |
+-SYM_CODE_END(rewind_stack_do_exit) |
1264 |
++SYM_CODE_END(rewind_stack_and_make_dead) |
1265 |
+ .popsection |
1266 |
+diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S |
1267 |
+index a3af2a9159b1b..9f1333a9ee41d 100644 |
1268 |
+--- a/arch/x86/entry/entry_64.S |
1269 |
++++ b/arch/x86/entry/entry_64.S |
1270 |
+@@ -1487,7 +1487,7 @@ SYM_CODE_END(ignore_sysret) |
1271 |
+ #endif |
1272 |
+ |
1273 |
+ .pushsection .text, "ax" |
1274 |
+-SYM_CODE_START(rewind_stack_do_exit) |
1275 |
++SYM_CODE_START(rewind_stack_and_make_dead) |
1276 |
+ UNWIND_HINT_FUNC |
1277 |
+ /* Prevent any naive code from trying to unwind to our caller. */ |
1278 |
+ xorl %ebp, %ebp |
1279 |
+@@ -1496,6 +1496,6 @@ SYM_CODE_START(rewind_stack_do_exit) |
1280 |
+ leaq -PTREGS_SIZE(%rax), %rsp |
1281 |
+ UNWIND_HINT_REGS |
1282 |
+ |
1283 |
+- call do_exit |
1284 |
+-SYM_CODE_END(rewind_stack_do_exit) |
1285 |
++ call make_task_dead |
1286 |
++SYM_CODE_END(rewind_stack_and_make_dead) |
1287 |
+ .popsection |
1288 |
+diff --git a/arch/x86/events/amd/core.c b/arch/x86/events/amd/core.c |
1289 |
+index 9687a8aef01c5..d93d098dea99d 100644 |
1290 |
+--- a/arch/x86/events/amd/core.c |
1291 |
++++ b/arch/x86/events/amd/core.c |
1292 |
+@@ -976,7 +976,7 @@ static int __init amd_core_pmu_init(void) |
1293 |
+ * numbered counter following it. |
1294 |
+ */ |
1295 |
+ for (i = 0; i < x86_pmu.num_counters - 1; i += 2) |
1296 |
+- even_ctr_mask |= 1 << i; |
1297 |
++ even_ctr_mask |= BIT_ULL(i); |
1298 |
+ |
1299 |
+ pair_constraint = (struct event_constraint) |
1300 |
+ __EVENT_CONSTRAINT(0, even_ctr_mask, 0, |
1301 |
+diff --git a/arch/x86/events/intel/uncore.c b/arch/x86/events/intel/uncore.c |
1302 |
+index c72e368dd1641..7e16c590f2593 100644 |
1303 |
+--- a/arch/x86/events/intel/uncore.c |
1304 |
++++ b/arch/x86/events/intel/uncore.c |
1305 |
+@@ -1829,6 +1829,7 @@ static const struct x86_cpu_id intel_uncore_match[] __initconst = { |
1306 |
+ X86_MATCH_INTEL_FAM6_MODEL(ALDERLAKE, &adl_uncore_init), |
1307 |
+ X86_MATCH_INTEL_FAM6_MODEL(ALDERLAKE_L, &adl_uncore_init), |
1308 |
+ X86_MATCH_INTEL_FAM6_MODEL(SAPPHIRERAPIDS_X, &spr_uncore_init), |
1309 |
++ X86_MATCH_INTEL_FAM6_MODEL(EMERALDRAPIDS_X, &spr_uncore_init), |
1310 |
+ X86_MATCH_INTEL_FAM6_MODEL(ATOM_TREMONT_D, &snr_uncore_init), |
1311 |
+ {}, |
1312 |
+ }; |
1313 |
+diff --git a/arch/x86/events/msr.c b/arch/x86/events/msr.c |
1314 |
+index 96c775abe31ff..d23b5523cdd3b 100644 |
1315 |
+--- a/arch/x86/events/msr.c |
1316 |
++++ b/arch/x86/events/msr.c |
1317 |
+@@ -69,6 +69,7 @@ static bool test_intel(int idx, void *data) |
1318 |
+ case INTEL_FAM6_BROADWELL_G: |
1319 |
+ case INTEL_FAM6_BROADWELL_X: |
1320 |
+ case INTEL_FAM6_SAPPHIRERAPIDS_X: |
1321 |
++ case INTEL_FAM6_EMERALDRAPIDS_X: |
1322 |
+ |
1323 |
+ case INTEL_FAM6_ATOM_SILVERMONT: |
1324 |
+ case INTEL_FAM6_ATOM_SILVERMONT_D: |
1325 |
+diff --git a/arch/x86/kernel/acpi/cstate.c b/arch/x86/kernel/acpi/cstate.c |
1326 |
+index 7de599eba7f04..7945eae5b315f 100644 |
1327 |
+--- a/arch/x86/kernel/acpi/cstate.c |
1328 |
++++ b/arch/x86/kernel/acpi/cstate.c |
1329 |
+@@ -79,6 +79,21 @@ void acpi_processor_power_init_bm_check(struct acpi_processor_flags *flags, |
1330 |
+ */ |
1331 |
+ flags->bm_control = 0; |
1332 |
+ } |
1333 |
++ if (c->x86_vendor == X86_VENDOR_AMD && c->x86 >= 0x17) { |
1334 |
++ /* |
1335 |
++ * For all AMD Zen or newer CPUs that support C3, caches |
1336 |
++ * should not be flushed by software while entering C3 |
1337 |
++ * type state. Set bm->check to 1 so that kernel doesn't |
1338 |
++ * need to execute cache flush operation. |
1339 |
++ */ |
1340 |
++ flags->bm_check = 1; |
1341 |
++ /* |
1342 |
++ * In current AMD C state implementation ARB_DIS is no longer |
1343 |
++ * used. So set bm_control to zero to indicate ARB_DIS is not |
1344 |
++ * required while entering C3 type state. |
1345 |
++ */ |
1346 |
++ flags->bm_control = 0; |
1347 |
++ } |
1348 |
+ } |
1349 |
+ EXPORT_SYMBOL(acpi_processor_power_init_bm_check); |
1350 |
+ |
1351 |
+diff --git a/arch/x86/kernel/dumpstack.c b/arch/x86/kernel/dumpstack.c |
1352 |
+index ea4fe192189d5..53de044e56540 100644 |
1353 |
+--- a/arch/x86/kernel/dumpstack.c |
1354 |
++++ b/arch/x86/kernel/dumpstack.c |
1355 |
+@@ -351,7 +351,7 @@ unsigned long oops_begin(void) |
1356 |
+ } |
1357 |
+ NOKPROBE_SYMBOL(oops_begin); |
1358 |
+ |
1359 |
+-void __noreturn rewind_stack_do_exit(int signr); |
1360 |
++void __noreturn rewind_stack_and_make_dead(int signr); |
1361 |
+ |
1362 |
+ void oops_end(unsigned long flags, struct pt_regs *regs, int signr) |
1363 |
+ { |
1364 |
+@@ -386,7 +386,7 @@ void oops_end(unsigned long flags, struct pt_regs *regs, int signr) |
1365 |
+ * reuse the task stack and that existing poisons are invalid. |
1366 |
+ */ |
1367 |
+ kasan_unpoison_task_stack(current); |
1368 |
+- rewind_stack_do_exit(signr); |
1369 |
++ rewind_stack_and_make_dead(signr); |
1370 |
+ } |
1371 |
+ NOKPROBE_SYMBOL(oops_end); |
1372 |
+ |
1373 |
+diff --git a/arch/x86/kernel/i8259.c b/arch/x86/kernel/i8259.c |
1374 |
+index 15aefa3f3e18e..f91e5e31aa4f0 100644 |
1375 |
+--- a/arch/x86/kernel/i8259.c |
1376 |
++++ b/arch/x86/kernel/i8259.c |
1377 |
+@@ -114,6 +114,7 @@ static void make_8259A_irq(unsigned int irq) |
1378 |
+ disable_irq_nosync(irq); |
1379 |
+ io_apic_irqs &= ~(1<<irq); |
1380 |
+ irq_set_chip_and_handler(irq, &i8259A_chip, handle_level_irq); |
1381 |
++ irq_set_status_flags(irq, IRQ_LEVEL); |
1382 |
+ enable_irq(irq); |
1383 |
+ lapic_assign_legacy_vector(irq, true); |
1384 |
+ } |
1385 |
+diff --git a/arch/x86/kernel/irqinit.c b/arch/x86/kernel/irqinit.c |
1386 |
+index beb1bada1b0ab..c683666876f1c 100644 |
1387 |
+--- a/arch/x86/kernel/irqinit.c |
1388 |
++++ b/arch/x86/kernel/irqinit.c |
1389 |
+@@ -65,8 +65,10 @@ void __init init_ISA_irqs(void) |
1390 |
+ |
1391 |
+ legacy_pic->init(0); |
1392 |
+ |
1393 |
+- for (i = 0; i < nr_legacy_irqs(); i++) |
1394 |
++ for (i = 0; i < nr_legacy_irqs(); i++) { |
1395 |
+ irq_set_chip_and_handler(i, chip, handle_level_irq); |
1396 |
++ irq_set_status_flags(i, IRQ_LEVEL); |
1397 |
++ } |
1398 |
+ } |
1399 |
+ |
1400 |
+ void __init init_IRQ(void) |
1401 |
+diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c |
1402 |
+index 773420203305d..c1a7580388924 100644 |
1403 |
+--- a/arch/x86/kvm/svm/svm.c |
1404 |
++++ b/arch/x86/kvm/svm/svm.c |
1405 |
+@@ -465,11 +465,24 @@ static int has_svm(void) |
1406 |
+ return 1; |
1407 |
+ } |
1408 |
+ |
1409 |
++void __svm_write_tsc_multiplier(u64 multiplier) |
1410 |
++{ |
1411 |
++ preempt_disable(); |
1412 |
++ |
1413 |
++ if (multiplier == __this_cpu_read(current_tsc_ratio)) |
1414 |
++ goto out; |
1415 |
++ |
1416 |
++ wrmsrl(MSR_AMD64_TSC_RATIO, multiplier); |
1417 |
++ __this_cpu_write(current_tsc_ratio, multiplier); |
1418 |
++out: |
1419 |
++ preempt_enable(); |
1420 |
++} |
1421 |
++ |
1422 |
+ static void svm_hardware_disable(void) |
1423 |
+ { |
1424 |
+ /* Make sure we clean up behind us */ |
1425 |
+ if (static_cpu_has(X86_FEATURE_TSCRATEMSR)) |
1426 |
+- wrmsrl(MSR_AMD64_TSC_RATIO, TSC_RATIO_DEFAULT); |
1427 |
++ __svm_write_tsc_multiplier(TSC_RATIO_DEFAULT); |
1428 |
+ |
1429 |
+ cpu_svm_disable(); |
1430 |
+ |
1431 |
+@@ -511,8 +524,11 @@ static int svm_hardware_enable(void) |
1432 |
+ wrmsrl(MSR_VM_HSAVE_PA, __sme_page_pa(sd->save_area)); |
1433 |
+ |
1434 |
+ if (static_cpu_has(X86_FEATURE_TSCRATEMSR)) { |
1435 |
+- wrmsrl(MSR_AMD64_TSC_RATIO, TSC_RATIO_DEFAULT); |
1436 |
+- __this_cpu_write(current_tsc_ratio, TSC_RATIO_DEFAULT); |
1437 |
++ /* |
1438 |
++ * Set the default value, even if we don't use TSC scaling |
1439 |
++ * to avoid having stale value in the msr |
1440 |
++ */ |
1441 |
++ __svm_write_tsc_multiplier(TSC_RATIO_DEFAULT); |
1442 |
+ } |
1443 |
+ |
1444 |
+ |
1445 |
+@@ -1125,9 +1141,10 @@ static void svm_write_tsc_offset(struct kvm_vcpu *vcpu, u64 offset) |
1446 |
+ |
1447 |
+ static void svm_write_tsc_multiplier(struct kvm_vcpu *vcpu, u64 multiplier) |
1448 |
+ { |
1449 |
+- wrmsrl(MSR_AMD64_TSC_RATIO, multiplier); |
1450 |
++ __svm_write_tsc_multiplier(multiplier); |
1451 |
+ } |
1452 |
+ |
1453 |
++ |
1454 |
+ /* Evaluate instruction intercepts that depend on guest CPUID features. */ |
1455 |
+ static void svm_recalc_instruction_intercepts(struct kvm_vcpu *vcpu, |
1456 |
+ struct vcpu_svm *svm) |
1457 |
+@@ -1451,13 +1468,8 @@ static void svm_prepare_guest_switch(struct kvm_vcpu *vcpu) |
1458 |
+ vmsave(__sme_page_pa(sd->save_area)); |
1459 |
+ } |
1460 |
+ |
1461 |
+- if (static_cpu_has(X86_FEATURE_TSCRATEMSR)) { |
1462 |
+- u64 tsc_ratio = vcpu->arch.tsc_scaling_ratio; |
1463 |
+- if (tsc_ratio != __this_cpu_read(current_tsc_ratio)) { |
1464 |
+- __this_cpu_write(current_tsc_ratio, tsc_ratio); |
1465 |
+- wrmsrl(MSR_AMD64_TSC_RATIO, tsc_ratio); |
1466 |
+- } |
1467 |
+- } |
1468 |
++ if (static_cpu_has(X86_FEATURE_TSCRATEMSR)) |
1469 |
++ __svm_write_tsc_multiplier(vcpu->arch.tsc_scaling_ratio); |
1470 |
+ |
1471 |
+ if (likely(tsc_aux_uret_slot >= 0)) |
1472 |
+ kvm_set_user_return_msr(tsc_aux_uret_slot, svm->tsc_aux, -1ull); |
1473 |
+diff --git a/arch/x86/kvm/svm/svm.h b/arch/x86/kvm/svm/svm.h |
1474 |
+index 7004f356edf94..1d9b1a9e4398f 100644 |
1475 |
+--- a/arch/x86/kvm/svm/svm.h |
1476 |
++++ b/arch/x86/kvm/svm/svm.h |
1477 |
+@@ -487,6 +487,7 @@ int nested_svm_check_exception(struct vcpu_svm *svm, unsigned nr, |
1478 |
+ int nested_svm_exit_special(struct vcpu_svm *svm); |
1479 |
+ void nested_load_control_from_vmcb12(struct vcpu_svm *svm, |
1480 |
+ struct vmcb_control_area *control); |
1481 |
++void __svm_write_tsc_multiplier(u64 multiplier); |
1482 |
+ void nested_sync_control_from_vmcb02(struct vcpu_svm *svm); |
1483 |
+ void nested_vmcb02_compute_g_pat(struct vcpu_svm *svm); |
1484 |
+ void svm_switch_vmcb(struct vcpu_svm *svm, struct kvm_vmcb_info *target_vmcb); |
1485 |
+diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c |
1486 |
+index 6918f597b8ab7..0718658268fef 100644 |
1487 |
+--- a/arch/x86/kvm/vmx/vmx.c |
1488 |
++++ b/arch/x86/kvm/vmx/vmx.c |
1489 |
+@@ -3361,18 +3361,15 @@ static u32 vmx_segment_access_rights(struct kvm_segment *var) |
1490 |
+ { |
1491 |
+ u32 ar; |
1492 |
+ |
1493 |
+- if (var->unusable || !var->present) |
1494 |
+- ar = 1 << 16; |
1495 |
+- else { |
1496 |
+- ar = var->type & 15; |
1497 |
+- ar |= (var->s & 1) << 4; |
1498 |
+- ar |= (var->dpl & 3) << 5; |
1499 |
+- ar |= (var->present & 1) << 7; |
1500 |
+- ar |= (var->avl & 1) << 12; |
1501 |
+- ar |= (var->l & 1) << 13; |
1502 |
+- ar |= (var->db & 1) << 14; |
1503 |
+- ar |= (var->g & 1) << 15; |
1504 |
+- } |
1505 |
++ ar = var->type & 15; |
1506 |
++ ar |= (var->s & 1) << 4; |
1507 |
++ ar |= (var->dpl & 3) << 5; |
1508 |
++ ar |= (var->present & 1) << 7; |
1509 |
++ ar |= (var->avl & 1) << 12; |
1510 |
++ ar |= (var->l & 1) << 13; |
1511 |
++ ar |= (var->db & 1) << 14; |
1512 |
++ ar |= (var->g & 1) << 15; |
1513 |
++ ar |= (var->unusable || !var->present) << 16; |
1514 |
+ |
1515 |
+ return ar; |
1516 |
+ } |
1517 |
+diff --git a/arch/xtensa/kernel/traps.c b/arch/xtensa/kernel/traps.c |
1518 |
+index 874b6efc6fb31..904086ad56827 100644 |
1519 |
+--- a/arch/xtensa/kernel/traps.c |
1520 |
++++ b/arch/xtensa/kernel/traps.c |
1521 |
+@@ -552,5 +552,5 @@ void die(const char * str, struct pt_regs * regs, long err) |
1522 |
+ if (panic_on_oops) |
1523 |
+ panic("Fatal exception"); |
1524 |
+ |
1525 |
+- do_exit(err); |
1526 |
++ make_task_dead(err); |
1527 |
+ } |
1528 |
+diff --git a/block/blk-core.c b/block/blk-core.c |
1529 |
+index 13e1fca1e923f..ed6271dcc1b16 100644 |
1530 |
+--- a/block/blk-core.c |
1531 |
++++ b/block/blk-core.c |
1532 |
+@@ -698,14 +698,10 @@ static inline bool should_fail_request(struct block_device *part, |
1533 |
+ static inline bool bio_check_ro(struct bio *bio) |
1534 |
+ { |
1535 |
+ if (op_is_write(bio_op(bio)) && bdev_read_only(bio->bi_bdev)) { |
1536 |
+- char b[BDEVNAME_SIZE]; |
1537 |
+- |
1538 |
+ if (op_is_flush(bio->bi_opf) && !bio_sectors(bio)) |
1539 |
+ return false; |
1540 |
+- |
1541 |
+- WARN_ONCE(1, |
1542 |
+- "Trying to write to read-only block-device %s (partno %d)\n", |
1543 |
+- bio_devname(bio, b), bio->bi_bdev->bd_partno); |
1544 |
++ pr_warn("Trying to write to read-only block-device %pg\n", |
1545 |
++ bio->bi_bdev); |
1546 |
+ /* Older lvm-tools actually trigger this */ |
1547 |
+ return false; |
1548 |
+ } |
1549 |
+diff --git a/drivers/base/property.c b/drivers/base/property.c |
1550 |
+index 735a23db1b5e9..17a648d643566 100644 |
1551 |
+--- a/drivers/base/property.c |
1552 |
++++ b/drivers/base/property.c |
1553 |
+@@ -1055,26 +1055,32 @@ struct fwnode_handle * |
1554 |
+ fwnode_graph_get_next_endpoint(const struct fwnode_handle *fwnode, |
1555 |
+ struct fwnode_handle *prev) |
1556 |
+ { |
1557 |
++ struct fwnode_handle *ep, *port_parent = NULL; |
1558 |
+ const struct fwnode_handle *parent; |
1559 |
+- struct fwnode_handle *ep; |
1560 |
+ |
1561 |
+ /* |
1562 |
+ * If this function is in a loop and the previous iteration returned |
1563 |
+ * an endpoint from fwnode->secondary, then we need to use the secondary |
1564 |
+ * as parent rather than @fwnode. |
1565 |
+ */ |
1566 |
+- if (prev) |
1567 |
+- parent = fwnode_graph_get_port_parent(prev); |
1568 |
+- else |
1569 |
++ if (prev) { |
1570 |
++ port_parent = fwnode_graph_get_port_parent(prev); |
1571 |
++ parent = port_parent; |
1572 |
++ } else { |
1573 |
+ parent = fwnode; |
1574 |
++ } |
1575 |
+ if (IS_ERR_OR_NULL(parent)) |
1576 |
+ return NULL; |
1577 |
+ |
1578 |
+ ep = fwnode_call_ptr_op(parent, graph_get_next_endpoint, prev); |
1579 |
+ if (ep) |
1580 |
+- return ep; |
1581 |
++ goto out_put_port_parent; |
1582 |
++ |
1583 |
++ ep = fwnode_graph_get_next_endpoint(parent->secondary, NULL); |
1584 |
+ |
1585 |
+- return fwnode_graph_get_next_endpoint(parent->secondary, NULL); |
1586 |
++out_put_port_parent: |
1587 |
++ fwnode_handle_put(port_parent); |
1588 |
++ return ep; |
1589 |
+ } |
1590 |
+ EXPORT_SYMBOL_GPL(fwnode_graph_get_next_endpoint); |
1591 |
+ |
1592 |
+diff --git a/drivers/base/test/test_async_driver_probe.c b/drivers/base/test/test_async_driver_probe.c |
1593 |
+index 3bb7beb127a96..c157a912d6739 100644 |
1594 |
+--- a/drivers/base/test/test_async_driver_probe.c |
1595 |
++++ b/drivers/base/test/test_async_driver_probe.c |
1596 |
+@@ -146,7 +146,7 @@ static int __init test_async_probe_init(void) |
1597 |
+ calltime = ktime_get(); |
1598 |
+ for_each_online_cpu(cpu) { |
1599 |
+ nid = cpu_to_node(cpu); |
1600 |
+- pdev = &sync_dev[sync_id]; |
1601 |
++ pdev = &async_dev[async_id]; |
1602 |
+ |
1603 |
+ *pdev = test_platform_device_register_node("test_async_driver", |
1604 |
+ async_id, |
1605 |
+diff --git a/drivers/cpufreq/armada-37xx-cpufreq.c b/drivers/cpufreq/armada-37xx-cpufreq.c |
1606 |
+index c10fc33b29b18..b74289a95a171 100644 |
1607 |
+--- a/drivers/cpufreq/armada-37xx-cpufreq.c |
1608 |
++++ b/drivers/cpufreq/armada-37xx-cpufreq.c |
1609 |
+@@ -445,7 +445,7 @@ static int __init armada37xx_cpufreq_driver_init(void) |
1610 |
+ return -ENODEV; |
1611 |
+ } |
1612 |
+ |
1613 |
+- clk = clk_get(cpu_dev, 0); |
1614 |
++ clk = clk_get(cpu_dev, NULL); |
1615 |
+ if (IS_ERR(clk)) { |
1616 |
+ dev_err(cpu_dev, "Cannot get clock for CPU0\n"); |
1617 |
+ return PTR_ERR(clk); |
1618 |
+diff --git a/drivers/cpufreq/cpufreq-dt-platdev.c b/drivers/cpufreq/cpufreq-dt-platdev.c |
1619 |
+index ca1d103ec4492..e1b5975c7daa1 100644 |
1620 |
+--- a/drivers/cpufreq/cpufreq-dt-platdev.c |
1621 |
++++ b/drivers/cpufreq/cpufreq-dt-platdev.c |
1622 |
+@@ -133,6 +133,7 @@ static const struct of_device_id blocklist[] __initconst = { |
1623 |
+ { .compatible = "nvidia,tegra30", }, |
1624 |
+ { .compatible = "nvidia,tegra124", }, |
1625 |
+ { .compatible = "nvidia,tegra210", }, |
1626 |
++ { .compatible = "nvidia,tegra234", }, |
1627 |
+ |
1628 |
+ { .compatible = "qcom,apq8096", }, |
1629 |
+ { .compatible = "qcom,msm8996", }, |
1630 |
+@@ -143,6 +144,7 @@ static const struct of_device_id blocklist[] __initconst = { |
1631 |
+ { .compatible = "qcom,sc8180x", }, |
1632 |
+ { .compatible = "qcom,sdm845", }, |
1633 |
+ { .compatible = "qcom,sm6350", }, |
1634 |
++ { .compatible = "qcom,sm6375", }, |
1635 |
+ { .compatible = "qcom,sm8150", }, |
1636 |
+ { .compatible = "qcom,sm8250", }, |
1637 |
+ { .compatible = "qcom,sm8350", }, |
1638 |
+diff --git a/drivers/cpufreq/cpufreq_governor.c b/drivers/cpufreq/cpufreq_governor.c |
1639 |
+index 63f7c219062b9..55c80319d2684 100644 |
1640 |
+--- a/drivers/cpufreq/cpufreq_governor.c |
1641 |
++++ b/drivers/cpufreq/cpufreq_governor.c |
1642 |
+@@ -388,6 +388,15 @@ static void free_policy_dbs_info(struct policy_dbs_info *policy_dbs, |
1643 |
+ gov->free(policy_dbs); |
1644 |
+ } |
1645 |
+ |
1646 |
++static void cpufreq_dbs_data_release(struct kobject *kobj) |
1647 |
++{ |
1648 |
++ struct dbs_data *dbs_data = to_dbs_data(to_gov_attr_set(kobj)); |
1649 |
++ struct dbs_governor *gov = dbs_data->gov; |
1650 |
++ |
1651 |
++ gov->exit(dbs_data); |
1652 |
++ kfree(dbs_data); |
1653 |
++} |
1654 |
++ |
1655 |
+ int cpufreq_dbs_governor_init(struct cpufreq_policy *policy) |
1656 |
+ { |
1657 |
+ struct dbs_governor *gov = dbs_governor_of(policy); |
1658 |
+@@ -425,6 +434,7 @@ int cpufreq_dbs_governor_init(struct cpufreq_policy *policy) |
1659 |
+ goto free_policy_dbs_info; |
1660 |
+ } |
1661 |
+ |
1662 |
++ dbs_data->gov = gov; |
1663 |
+ gov_attr_set_init(&dbs_data->attr_set, &policy_dbs->list); |
1664 |
+ |
1665 |
+ ret = gov->init(dbs_data); |
1666 |
+@@ -447,6 +457,7 @@ int cpufreq_dbs_governor_init(struct cpufreq_policy *policy) |
1667 |
+ policy->governor_data = policy_dbs; |
1668 |
+ |
1669 |
+ gov->kobj_type.sysfs_ops = &governor_sysfs_ops; |
1670 |
++ gov->kobj_type.release = cpufreq_dbs_data_release; |
1671 |
+ ret = kobject_init_and_add(&dbs_data->attr_set.kobj, &gov->kobj_type, |
1672 |
+ get_governor_parent_kobj(policy), |
1673 |
+ "%s", gov->gov.name); |
1674 |
+@@ -488,13 +499,8 @@ void cpufreq_dbs_governor_exit(struct cpufreq_policy *policy) |
1675 |
+ |
1676 |
+ policy->governor_data = NULL; |
1677 |
+ |
1678 |
+- if (!count) { |
1679 |
+- if (!have_governor_per_policy()) |
1680 |
+- gov->gdbs_data = NULL; |
1681 |
+- |
1682 |
+- gov->exit(dbs_data); |
1683 |
+- kfree(dbs_data); |
1684 |
+- } |
1685 |
++ if (!count && !have_governor_per_policy()) |
1686 |
++ gov->gdbs_data = NULL; |
1687 |
+ |
1688 |
+ free_policy_dbs_info(policy_dbs, gov); |
1689 |
+ |
1690 |
+diff --git a/drivers/cpufreq/cpufreq_governor.h b/drivers/cpufreq/cpufreq_governor.h |
1691 |
+index bab8e61403771..a6de26318abb8 100644 |
1692 |
+--- a/drivers/cpufreq/cpufreq_governor.h |
1693 |
++++ b/drivers/cpufreq/cpufreq_governor.h |
1694 |
+@@ -37,6 +37,7 @@ enum {OD_NORMAL_SAMPLE, OD_SUB_SAMPLE}; |
1695 |
+ /* Governor demand based switching data (per-policy or global). */ |
1696 |
+ struct dbs_data { |
1697 |
+ struct gov_attr_set attr_set; |
1698 |
++ struct dbs_governor *gov; |
1699 |
+ void *tuners; |
1700 |
+ unsigned int ignore_nice_load; |
1701 |
+ unsigned int sampling_rate; |
1702 |
+diff --git a/drivers/cpufreq/cpufreq_governor_attr_set.c b/drivers/cpufreq/cpufreq_governor_attr_set.c |
1703 |
+index a6f365b9cc1ad..771770ea0ed0b 100644 |
1704 |
+--- a/drivers/cpufreq/cpufreq_governor_attr_set.c |
1705 |
++++ b/drivers/cpufreq/cpufreq_governor_attr_set.c |
1706 |
+@@ -8,11 +8,6 @@ |
1707 |
+ |
1708 |
+ #include "cpufreq_governor.h" |
1709 |
+ |
1710 |
+-static inline struct gov_attr_set *to_gov_attr_set(struct kobject *kobj) |
1711 |
+-{ |
1712 |
+- return container_of(kobj, struct gov_attr_set, kobj); |
1713 |
+-} |
1714 |
+- |
1715 |
+ static inline struct governor_attr *to_gov_attr(struct attribute *attr) |
1716 |
+ { |
1717 |
+ return container_of(attr, struct governor_attr, attr); |
1718 |
+diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c |
1719 |
+index af3ee288bc117..4ec7bb58c195f 100644 |
1720 |
+--- a/drivers/dma/dmaengine.c |
1721 |
++++ b/drivers/dma/dmaengine.c |
1722 |
+@@ -451,7 +451,8 @@ static int dma_chan_get(struct dma_chan *chan) |
1723 |
+ /* The channel is already in use, update client count */ |
1724 |
+ if (chan->client_count) { |
1725 |
+ __module_get(owner); |
1726 |
+- goto out; |
1727 |
++ chan->client_count++; |
1728 |
++ return 0; |
1729 |
+ } |
1730 |
+ |
1731 |
+ if (!try_module_get(owner)) |
1732 |
+@@ -470,11 +471,11 @@ static int dma_chan_get(struct dma_chan *chan) |
1733 |
+ goto err_out; |
1734 |
+ } |
1735 |
+ |
1736 |
++ chan->client_count++; |
1737 |
++ |
1738 |
+ if (!dma_has_cap(DMA_PRIVATE, chan->device->cap_mask)) |
1739 |
+ balance_ref_count(chan); |
1740 |
+ |
1741 |
+-out: |
1742 |
+- chan->client_count++; |
1743 |
+ return 0; |
1744 |
+ |
1745 |
+ err_out: |
1746 |
+diff --git a/drivers/dma/ptdma/ptdma-dev.c b/drivers/dma/ptdma/ptdma-dev.c |
1747 |
+index daafea5bc35d9..bca4063b0dce4 100644 |
1748 |
+--- a/drivers/dma/ptdma/ptdma-dev.c |
1749 |
++++ b/drivers/dma/ptdma/ptdma-dev.c |
1750 |
+@@ -71,12 +71,13 @@ static int pt_core_execute_cmd(struct ptdma_desc *desc, struct pt_cmd_queue *cmd |
1751 |
+ bool soc = FIELD_GET(DWORD0_SOC, desc->dw0); |
1752 |
+ u8 *q_desc = (u8 *)&cmd_q->qbase[cmd_q->qidx]; |
1753 |
+ u32 tail; |
1754 |
++ unsigned long flags; |
1755 |
+ |
1756 |
+ if (soc) { |
1757 |
+ desc->dw0 |= FIELD_PREP(DWORD0_IOC, desc->dw0); |
1758 |
+ desc->dw0 &= ~DWORD0_SOC; |
1759 |
+ } |
1760 |
+- mutex_lock(&cmd_q->q_mutex); |
1761 |
++ spin_lock_irqsave(&cmd_q->q_lock, flags); |
1762 |
+ |
1763 |
+ /* Copy 32-byte command descriptor to hw queue. */ |
1764 |
+ memcpy(q_desc, desc, 32); |
1765 |
+@@ -91,7 +92,7 @@ static int pt_core_execute_cmd(struct ptdma_desc *desc, struct pt_cmd_queue *cmd |
1766 |
+ |
1767 |
+ /* Turn the queue back on using our cached control register */ |
1768 |
+ pt_start_queue(cmd_q); |
1769 |
+- mutex_unlock(&cmd_q->q_mutex); |
1770 |
++ spin_unlock_irqrestore(&cmd_q->q_lock, flags); |
1771 |
+ |
1772 |
+ return 0; |
1773 |
+ } |
1774 |
+@@ -197,7 +198,7 @@ int pt_core_init(struct pt_device *pt) |
1775 |
+ |
1776 |
+ cmd_q->pt = pt; |
1777 |
+ cmd_q->dma_pool = dma_pool; |
1778 |
+- mutex_init(&cmd_q->q_mutex); |
1779 |
++ spin_lock_init(&cmd_q->q_lock); |
1780 |
+ |
1781 |
+ /* Page alignment satisfies our needs for N <= 128 */ |
1782 |
+ cmd_q->qsize = Q_SIZE(Q_DESC_SIZE); |
1783 |
+diff --git a/drivers/dma/ptdma/ptdma.h b/drivers/dma/ptdma/ptdma.h |
1784 |
+index afbf192c92305..0f0b400a864e4 100644 |
1785 |
+--- a/drivers/dma/ptdma/ptdma.h |
1786 |
++++ b/drivers/dma/ptdma/ptdma.h |
1787 |
+@@ -196,7 +196,7 @@ struct pt_cmd_queue { |
1788 |
+ struct ptdma_desc *qbase; |
1789 |
+ |
1790 |
+ /* Aligned queue start address (per requirement) */ |
1791 |
+- struct mutex q_mutex ____cacheline_aligned; |
1792 |
++ spinlock_t q_lock ____cacheline_aligned; |
1793 |
+ unsigned int qidx; |
1794 |
+ |
1795 |
+ unsigned int qsize; |
1796 |
+diff --git a/drivers/dma/ti/k3-udma.c b/drivers/dma/ti/k3-udma.c |
1797 |
+index 75f2a0006c734..d796e50dfe992 100644 |
1798 |
+--- a/drivers/dma/ti/k3-udma.c |
1799 |
++++ b/drivers/dma/ti/k3-udma.c |
1800 |
+@@ -760,11 +760,12 @@ static void udma_decrement_byte_counters(struct udma_chan *uc, u32 val) |
1801 |
+ if (uc->desc->dir == DMA_DEV_TO_MEM) { |
1802 |
+ udma_rchanrt_write(uc, UDMA_CHAN_RT_BCNT_REG, val); |
1803 |
+ udma_rchanrt_write(uc, UDMA_CHAN_RT_SBCNT_REG, val); |
1804 |
+- udma_rchanrt_write(uc, UDMA_CHAN_RT_PEER_BCNT_REG, val); |
1805 |
++ if (uc->config.ep_type != PSIL_EP_NATIVE) |
1806 |
++ udma_rchanrt_write(uc, UDMA_CHAN_RT_PEER_BCNT_REG, val); |
1807 |
+ } else { |
1808 |
+ udma_tchanrt_write(uc, UDMA_CHAN_RT_BCNT_REG, val); |
1809 |
+ udma_tchanrt_write(uc, UDMA_CHAN_RT_SBCNT_REG, val); |
1810 |
+- if (!uc->bchan) |
1811 |
++ if (!uc->bchan && uc->config.ep_type != PSIL_EP_NATIVE) |
1812 |
+ udma_tchanrt_write(uc, UDMA_CHAN_RT_PEER_BCNT_REG, val); |
1813 |
+ } |
1814 |
+ } |
1815 |
+diff --git a/drivers/dma/xilinx/xilinx_dma.c b/drivers/dma/xilinx/xilinx_dma.c |
1816 |
+index 4273150b68dc4..edc2bb8f0523c 100644 |
1817 |
+--- a/drivers/dma/xilinx/xilinx_dma.c |
1818 |
++++ b/drivers/dma/xilinx/xilinx_dma.c |
1819 |
+@@ -3138,8 +3138,10 @@ static int xilinx_dma_probe(struct platform_device *pdev) |
1820 |
+ /* Initialize the channels */ |
1821 |
+ for_each_child_of_node(node, child) { |
1822 |
+ err = xilinx_dma_child_probe(xdev, child); |
1823 |
+- if (err < 0) |
1824 |
++ if (err < 0) { |
1825 |
++ of_node_put(child); |
1826 |
+ goto error; |
1827 |
++ } |
1828 |
+ } |
1829 |
+ |
1830 |
+ if (xdev->dma_config->dmatype == XDMA_TYPE_VDMA) { |
1831 |
+diff --git a/drivers/edac/edac_device.c b/drivers/edac/edac_device.c |
1832 |
+index 8220ce5b87ca0..85c229985f905 100644 |
1833 |
+--- a/drivers/edac/edac_device.c |
1834 |
++++ b/drivers/edac/edac_device.c |
1835 |
+@@ -34,6 +34,9 @@ |
1836 |
+ static DEFINE_MUTEX(device_ctls_mutex); |
1837 |
+ static LIST_HEAD(edac_device_list); |
1838 |
+ |
1839 |
++/* Default workqueue processing interval on this instance, in msecs */ |
1840 |
++#define DEFAULT_POLL_INTERVAL 1000 |
1841 |
++ |
1842 |
+ #ifdef CONFIG_EDAC_DEBUG |
1843 |
+ static void edac_device_dump_device(struct edac_device_ctl_info *edac_dev) |
1844 |
+ { |
1845 |
+@@ -366,7 +369,7 @@ static void edac_device_workq_function(struct work_struct *work_req) |
1846 |
+ * whole one second to save timers firing all over the period |
1847 |
+ * between integral seconds |
1848 |
+ */ |
1849 |
+- if (edac_dev->poll_msec == 1000) |
1850 |
++ if (edac_dev->poll_msec == DEFAULT_POLL_INTERVAL) |
1851 |
+ edac_queue_work(&edac_dev->work, round_jiffies_relative(edac_dev->delay)); |
1852 |
+ else |
1853 |
+ edac_queue_work(&edac_dev->work, edac_dev->delay); |
1854 |
+@@ -396,7 +399,7 @@ static void edac_device_workq_setup(struct edac_device_ctl_info *edac_dev, |
1855 |
+ * timers firing on sub-second basis, while they are happy |
1856 |
+ * to fire together on the 1 second exactly |
1857 |
+ */ |
1858 |
+- if (edac_dev->poll_msec == 1000) |
1859 |
++ if (edac_dev->poll_msec == DEFAULT_POLL_INTERVAL) |
1860 |
+ edac_queue_work(&edac_dev->work, round_jiffies_relative(edac_dev->delay)); |
1861 |
+ else |
1862 |
+ edac_queue_work(&edac_dev->work, edac_dev->delay); |
1863 |
+@@ -430,7 +433,7 @@ void edac_device_reset_delay_period(struct edac_device_ctl_info *edac_dev, |
1864 |
+ edac_dev->delay = msecs_to_jiffies(msec); |
1865 |
+ |
1866 |
+ /* See comment in edac_device_workq_setup() above */ |
1867 |
+- if (edac_dev->poll_msec == 1000) |
1868 |
++ if (edac_dev->poll_msec == DEFAULT_POLL_INTERVAL) |
1869 |
+ edac_mod_work(&edac_dev->work, round_jiffies_relative(edac_dev->delay)); |
1870 |
+ else |
1871 |
+ edac_mod_work(&edac_dev->work, edac_dev->delay); |
1872 |
+@@ -472,11 +475,7 @@ int edac_device_add_device(struct edac_device_ctl_info *edac_dev) |
1873 |
+ /* This instance is NOW RUNNING */ |
1874 |
+ edac_dev->op_state = OP_RUNNING_POLL; |
1875 |
+ |
1876 |
+- /* |
1877 |
+- * enable workq processing on this instance, |
1878 |
+- * default = 1000 msec |
1879 |
+- */ |
1880 |
+- edac_device_workq_setup(edac_dev, 1000); |
1881 |
++ edac_device_workq_setup(edac_dev, edac_dev->poll_msec ?: DEFAULT_POLL_INTERVAL); |
1882 |
+ } else { |
1883 |
+ edac_dev->op_state = OP_RUNNING_INTERRUPT; |
1884 |
+ } |
1885 |
+diff --git a/drivers/edac/highbank_mc_edac.c b/drivers/edac/highbank_mc_edac.c |
1886 |
+index 61b76ec226af1..19fba258ae108 100644 |
1887 |
+--- a/drivers/edac/highbank_mc_edac.c |
1888 |
++++ b/drivers/edac/highbank_mc_edac.c |
1889 |
+@@ -174,8 +174,10 @@ static int highbank_mc_probe(struct platform_device *pdev) |
1890 |
+ drvdata = mci->pvt_info; |
1891 |
+ platform_set_drvdata(pdev, mci); |
1892 |
+ |
1893 |
+- if (!devres_open_group(&pdev->dev, NULL, GFP_KERNEL)) |
1894 |
+- return -ENOMEM; |
1895 |
++ if (!devres_open_group(&pdev->dev, NULL, GFP_KERNEL)) { |
1896 |
++ res = -ENOMEM; |
1897 |
++ goto free; |
1898 |
++ } |
1899 |
+ |
1900 |
+ r = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
1901 |
+ if (!r) { |
1902 |
+@@ -243,6 +245,7 @@ err2: |
1903 |
+ edac_mc_del_mc(&pdev->dev); |
1904 |
+ err: |
1905 |
+ devres_release_group(&pdev->dev, NULL); |
1906 |
++free: |
1907 |
+ edac_mc_free(mci); |
1908 |
+ return res; |
1909 |
+ } |
1910 |
+diff --git a/drivers/edac/qcom_edac.c b/drivers/edac/qcom_edac.c |
1911 |
+index 97a27e42dd610..c45519f59dc11 100644 |
1912 |
+--- a/drivers/edac/qcom_edac.c |
1913 |
++++ b/drivers/edac/qcom_edac.c |
1914 |
+@@ -252,7 +252,7 @@ clear: |
1915 |
+ static int |
1916 |
+ dump_syn_reg(struct edac_device_ctl_info *edev_ctl, int err_type, u32 bank) |
1917 |
+ { |
1918 |
+- struct llcc_drv_data *drv = edev_ctl->pvt_info; |
1919 |
++ struct llcc_drv_data *drv = edev_ctl->dev->platform_data; |
1920 |
+ int ret; |
1921 |
+ |
1922 |
+ ret = dump_syn_reg_values(drv, bank, err_type); |
1923 |
+@@ -289,7 +289,7 @@ static irqreturn_t |
1924 |
+ llcc_ecc_irq_handler(int irq, void *edev_ctl) |
1925 |
+ { |
1926 |
+ struct edac_device_ctl_info *edac_dev_ctl = edev_ctl; |
1927 |
+- struct llcc_drv_data *drv = edac_dev_ctl->pvt_info; |
1928 |
++ struct llcc_drv_data *drv = edac_dev_ctl->dev->platform_data; |
1929 |
+ irqreturn_t irq_rc = IRQ_NONE; |
1930 |
+ u32 drp_error, trp_error, i; |
1931 |
+ int ret; |
1932 |
+@@ -358,7 +358,6 @@ static int qcom_llcc_edac_probe(struct platform_device *pdev) |
1933 |
+ edev_ctl->dev_name = dev_name(dev); |
1934 |
+ edev_ctl->ctl_name = "llcc"; |
1935 |
+ edev_ctl->panic_on_ue = LLCC_ERP_PANIC_ON_UE; |
1936 |
+- edev_ctl->pvt_info = llcc_driv_data; |
1937 |
+ |
1938 |
+ rc = edac_device_add_device(edev_ctl); |
1939 |
+ if (rc) |
1940 |
+diff --git a/drivers/firmware/arm_scmi/shmem.c b/drivers/firmware/arm_scmi/shmem.c |
1941 |
+index 0e3eaea5d8526..56a1f61aa3ff2 100644 |
1942 |
+--- a/drivers/firmware/arm_scmi/shmem.c |
1943 |
++++ b/drivers/firmware/arm_scmi/shmem.c |
1944 |
+@@ -58,10 +58,11 @@ u32 shmem_read_header(struct scmi_shared_mem __iomem *shmem) |
1945 |
+ void shmem_fetch_response(struct scmi_shared_mem __iomem *shmem, |
1946 |
+ struct scmi_xfer *xfer) |
1947 |
+ { |
1948 |
++ size_t len = ioread32(&shmem->length); |
1949 |
++ |
1950 |
+ xfer->hdr.status = ioread32(shmem->msg_payload); |
1951 |
+ /* Skip the length of header and status in shmem area i.e 8 bytes */ |
1952 |
+- xfer->rx.len = min_t(size_t, xfer->rx.len, |
1953 |
+- ioread32(&shmem->length) - 8); |
1954 |
++ xfer->rx.len = min_t(size_t, xfer->rx.len, len > 8 ? len - 8 : 0); |
1955 |
+ |
1956 |
+ /* Take a copy to the rx buffer.. */ |
1957 |
+ memcpy_fromio(xfer->rx.buf, shmem->msg_payload + 4, xfer->rx.len); |
1958 |
+@@ -70,8 +71,10 @@ void shmem_fetch_response(struct scmi_shared_mem __iomem *shmem, |
1959 |
+ void shmem_fetch_notification(struct scmi_shared_mem __iomem *shmem, |
1960 |
+ size_t max_len, struct scmi_xfer *xfer) |
1961 |
+ { |
1962 |
++ size_t len = ioread32(&shmem->length); |
1963 |
++ |
1964 |
+ /* Skip only the length of header in shmem area i.e 4 bytes */ |
1965 |
+- xfer->rx.len = min_t(size_t, max_len, ioread32(&shmem->length) - 4); |
1966 |
++ xfer->rx.len = min_t(size_t, max_len, len > 4 ? len - 4 : 0); |
1967 |
+ |
1968 |
+ /* Take a copy to the rx buffer.. */ |
1969 |
+ memcpy_fromio(xfer->rx.buf, shmem->msg_payload, xfer->rx.len); |
1970 |
+diff --git a/drivers/firmware/google/coreboot_table.c b/drivers/firmware/google/coreboot_table.c |
1971 |
+index 9ca21feb9d454..f3694d3478019 100644 |
1972 |
+--- a/drivers/firmware/google/coreboot_table.c |
1973 |
++++ b/drivers/firmware/google/coreboot_table.c |
1974 |
+@@ -93,7 +93,12 @@ static int coreboot_table_populate(struct device *dev, void *ptr) |
1975 |
+ for (i = 0; i < header->table_entries; i++) { |
1976 |
+ entry = ptr_entry; |
1977 |
+ |
1978 |
+- device = kzalloc(sizeof(struct device) + entry->size, GFP_KERNEL); |
1979 |
++ if (entry->size < sizeof(*entry)) { |
1980 |
++ dev_warn(dev, "coreboot table entry too small!\n"); |
1981 |
++ return -EINVAL; |
1982 |
++ } |
1983 |
++ |
1984 |
++ device = kzalloc(sizeof(device->dev) + entry->size, GFP_KERNEL); |
1985 |
+ if (!device) |
1986 |
+ return -ENOMEM; |
1987 |
+ |
1988 |
+@@ -101,7 +106,7 @@ static int coreboot_table_populate(struct device *dev, void *ptr) |
1989 |
+ device->dev.parent = dev; |
1990 |
+ device->dev.bus = &coreboot_bus_type; |
1991 |
+ device->dev.release = coreboot_device_release; |
1992 |
+- memcpy(&device->entry, ptr_entry, entry->size); |
1993 |
++ memcpy(device->raw, ptr_entry, entry->size); |
1994 |
+ |
1995 |
+ ret = device_register(&device->dev); |
1996 |
+ if (ret) { |
1997 |
+diff --git a/drivers/firmware/google/coreboot_table.h b/drivers/firmware/google/coreboot_table.h |
1998 |
+index beb778674acdc..4a89277b99a39 100644 |
1999 |
+--- a/drivers/firmware/google/coreboot_table.h |
2000 |
++++ b/drivers/firmware/google/coreboot_table.h |
2001 |
+@@ -66,6 +66,7 @@ struct coreboot_device { |
2002 |
+ struct coreboot_table_entry entry; |
2003 |
+ struct lb_cbmem_ref cbmem_ref; |
2004 |
+ struct lb_framebuffer framebuffer; |
2005 |
++ DECLARE_FLEX_ARRAY(u8, raw); |
2006 |
+ }; |
2007 |
+ }; |
2008 |
+ |
2009 |
+diff --git a/drivers/gpio/gpio-amdpt.c b/drivers/gpio/gpio-amdpt.c |
2010 |
+index 44398992ae15f..dba4836a18f80 100644 |
2011 |
+--- a/drivers/gpio/gpio-amdpt.c |
2012 |
++++ b/drivers/gpio/gpio-amdpt.c |
2013 |
+@@ -35,19 +35,19 @@ static int pt_gpio_request(struct gpio_chip *gc, unsigned offset) |
2014 |
+ |
2015 |
+ dev_dbg(gc->parent, "pt_gpio_request offset=%x\n", offset); |
2016 |
+ |
2017 |
+- spin_lock_irqsave(&gc->bgpio_lock, flags); |
2018 |
++ raw_spin_lock_irqsave(&gc->bgpio_lock, flags); |
2019 |
+ |
2020 |
+ using_pins = readl(pt_gpio->reg_base + PT_SYNC_REG); |
2021 |
+ if (using_pins & BIT(offset)) { |
2022 |
+ dev_warn(gc->parent, "PT GPIO pin %x reconfigured\n", |
2023 |
+ offset); |
2024 |
+- spin_unlock_irqrestore(&gc->bgpio_lock, flags); |
2025 |
++ raw_spin_unlock_irqrestore(&gc->bgpio_lock, flags); |
2026 |
+ return -EINVAL; |
2027 |
+ } |
2028 |
+ |
2029 |
+ writel(using_pins | BIT(offset), pt_gpio->reg_base + PT_SYNC_REG); |
2030 |
+ |
2031 |
+- spin_unlock_irqrestore(&gc->bgpio_lock, flags); |
2032 |
++ raw_spin_unlock_irqrestore(&gc->bgpio_lock, flags); |
2033 |
+ |
2034 |
+ return 0; |
2035 |
+ } |
2036 |
+@@ -58,13 +58,13 @@ static void pt_gpio_free(struct gpio_chip *gc, unsigned offset) |
2037 |
+ unsigned long flags; |
2038 |
+ u32 using_pins; |
2039 |
+ |
2040 |
+- spin_lock_irqsave(&gc->bgpio_lock, flags); |
2041 |
++ raw_spin_lock_irqsave(&gc->bgpio_lock, flags); |
2042 |
+ |
2043 |
+ using_pins = readl(pt_gpio->reg_base + PT_SYNC_REG); |
2044 |
+ using_pins &= ~BIT(offset); |
2045 |
+ writel(using_pins, pt_gpio->reg_base + PT_SYNC_REG); |
2046 |
+ |
2047 |
+- spin_unlock_irqrestore(&gc->bgpio_lock, flags); |
2048 |
++ raw_spin_unlock_irqrestore(&gc->bgpio_lock, flags); |
2049 |
+ |
2050 |
+ dev_dbg(gc->parent, "pt_gpio_free offset=%x\n", offset); |
2051 |
+ } |
2052 |
+diff --git a/drivers/gpio/gpio-brcmstb.c b/drivers/gpio/gpio-brcmstb.c |
2053 |
+index 895a79936248d..c5d85e931f2a9 100644 |
2054 |
+--- a/drivers/gpio/gpio-brcmstb.c |
2055 |
++++ b/drivers/gpio/gpio-brcmstb.c |
2056 |
+@@ -92,9 +92,9 @@ brcmstb_gpio_get_active_irqs(struct brcmstb_gpio_bank *bank) |
2057 |
+ unsigned long status; |
2058 |
+ unsigned long flags; |
2059 |
+ |
2060 |
+- spin_lock_irqsave(&bank->gc.bgpio_lock, flags); |
2061 |
++ raw_spin_lock_irqsave(&bank->gc.bgpio_lock, flags); |
2062 |
+ status = __brcmstb_gpio_get_active_irqs(bank); |
2063 |
+- spin_unlock_irqrestore(&bank->gc.bgpio_lock, flags); |
2064 |
++ raw_spin_unlock_irqrestore(&bank->gc.bgpio_lock, flags); |
2065 |
+ |
2066 |
+ return status; |
2067 |
+ } |
2068 |
+@@ -114,14 +114,14 @@ static void brcmstb_gpio_set_imask(struct brcmstb_gpio_bank *bank, |
2069 |
+ u32 imask; |
2070 |
+ unsigned long flags; |
2071 |
+ |
2072 |
+- spin_lock_irqsave(&gc->bgpio_lock, flags); |
2073 |
++ raw_spin_lock_irqsave(&gc->bgpio_lock, flags); |
2074 |
+ imask = gc->read_reg(priv->reg_base + GIO_MASK(bank->id)); |
2075 |
+ if (enable) |
2076 |
+ imask |= mask; |
2077 |
+ else |
2078 |
+ imask &= ~mask; |
2079 |
+ gc->write_reg(priv->reg_base + GIO_MASK(bank->id), imask); |
2080 |
+- spin_unlock_irqrestore(&gc->bgpio_lock, flags); |
2081 |
++ raw_spin_unlock_irqrestore(&gc->bgpio_lock, flags); |
2082 |
+ } |
2083 |
+ |
2084 |
+ static int brcmstb_gpio_to_irq(struct gpio_chip *gc, unsigned offset) |
2085 |
+@@ -204,7 +204,7 @@ static int brcmstb_gpio_irq_set_type(struct irq_data *d, unsigned int type) |
2086 |
+ return -EINVAL; |
2087 |
+ } |
2088 |
+ |
2089 |
+- spin_lock_irqsave(&bank->gc.bgpio_lock, flags); |
2090 |
++ raw_spin_lock_irqsave(&bank->gc.bgpio_lock, flags); |
2091 |
+ |
2092 |
+ iedge_config = bank->gc.read_reg(priv->reg_base + |
2093 |
+ GIO_EC(bank->id)) & ~mask; |
2094 |
+@@ -220,7 +220,7 @@ static int brcmstb_gpio_irq_set_type(struct irq_data *d, unsigned int type) |
2095 |
+ bank->gc.write_reg(priv->reg_base + GIO_LEVEL(bank->id), |
2096 |
+ ilevel | level); |
2097 |
+ |
2098 |
+- spin_unlock_irqrestore(&bank->gc.bgpio_lock, flags); |
2099 |
++ raw_spin_unlock_irqrestore(&bank->gc.bgpio_lock, flags); |
2100 |
+ return 0; |
2101 |
+ } |
2102 |
+ |
2103 |
+diff --git a/drivers/gpio/gpio-cadence.c b/drivers/gpio/gpio-cadence.c |
2104 |
+index 562f8f7e7d1fc..137aea49ba026 100644 |
2105 |
+--- a/drivers/gpio/gpio-cadence.c |
2106 |
++++ b/drivers/gpio/gpio-cadence.c |
2107 |
+@@ -41,12 +41,12 @@ static int cdns_gpio_request(struct gpio_chip *chip, unsigned int offset) |
2108 |
+ struct cdns_gpio_chip *cgpio = gpiochip_get_data(chip); |
2109 |
+ unsigned long flags; |
2110 |
+ |
2111 |
+- spin_lock_irqsave(&chip->bgpio_lock, flags); |
2112 |
++ raw_spin_lock_irqsave(&chip->bgpio_lock, flags); |
2113 |
+ |
2114 |
+ iowrite32(ioread32(cgpio->regs + CDNS_GPIO_BYPASS_MODE) & ~BIT(offset), |
2115 |
+ cgpio->regs + CDNS_GPIO_BYPASS_MODE); |
2116 |
+ |
2117 |
+- spin_unlock_irqrestore(&chip->bgpio_lock, flags); |
2118 |
++ raw_spin_unlock_irqrestore(&chip->bgpio_lock, flags); |
2119 |
+ return 0; |
2120 |
+ } |
2121 |
+ |
2122 |
+@@ -55,13 +55,13 @@ static void cdns_gpio_free(struct gpio_chip *chip, unsigned int offset) |
2123 |
+ struct cdns_gpio_chip *cgpio = gpiochip_get_data(chip); |
2124 |
+ unsigned long flags; |
2125 |
+ |
2126 |
+- spin_lock_irqsave(&chip->bgpio_lock, flags); |
2127 |
++ raw_spin_lock_irqsave(&chip->bgpio_lock, flags); |
2128 |
+ |
2129 |
+ iowrite32(ioread32(cgpio->regs + CDNS_GPIO_BYPASS_MODE) | |
2130 |
+ (BIT(offset) & cgpio->bypass_orig), |
2131 |
+ cgpio->regs + CDNS_GPIO_BYPASS_MODE); |
2132 |
+ |
2133 |
+- spin_unlock_irqrestore(&chip->bgpio_lock, flags); |
2134 |
++ raw_spin_unlock_irqrestore(&chip->bgpio_lock, flags); |
2135 |
+ } |
2136 |
+ |
2137 |
+ static void cdns_gpio_irq_mask(struct irq_data *d) |
2138 |
+@@ -90,7 +90,7 @@ static int cdns_gpio_irq_set_type(struct irq_data *d, unsigned int type) |
2139 |
+ u32 mask = BIT(d->hwirq); |
2140 |
+ int ret = 0; |
2141 |
+ |
2142 |
+- spin_lock_irqsave(&chip->bgpio_lock, flags); |
2143 |
++ raw_spin_lock_irqsave(&chip->bgpio_lock, flags); |
2144 |
+ |
2145 |
+ int_value = ioread32(cgpio->regs + CDNS_GPIO_IRQ_VALUE) & ~mask; |
2146 |
+ int_type = ioread32(cgpio->regs + CDNS_GPIO_IRQ_TYPE) & ~mask; |
2147 |
+@@ -115,7 +115,7 @@ static int cdns_gpio_irq_set_type(struct irq_data *d, unsigned int type) |
2148 |
+ iowrite32(int_type, cgpio->regs + CDNS_GPIO_IRQ_TYPE); |
2149 |
+ |
2150 |
+ err_irq_type: |
2151 |
+- spin_unlock_irqrestore(&chip->bgpio_lock, flags); |
2152 |
++ raw_spin_unlock_irqrestore(&chip->bgpio_lock, flags); |
2153 |
+ return ret; |
2154 |
+ } |
2155 |
+ |
2156 |
+diff --git a/drivers/gpio/gpio-dwapb.c b/drivers/gpio/gpio-dwapb.c |
2157 |
+index e981e7a46fc1c..a503f37001ebb 100644 |
2158 |
+--- a/drivers/gpio/gpio-dwapb.c |
2159 |
++++ b/drivers/gpio/gpio-dwapb.c |
2160 |
+@@ -242,9 +242,9 @@ static void dwapb_irq_ack(struct irq_data *d) |
2161 |
+ u32 val = BIT(irqd_to_hwirq(d)); |
2162 |
+ unsigned long flags; |
2163 |
+ |
2164 |
+- spin_lock_irqsave(&gc->bgpio_lock, flags); |
2165 |
++ raw_spin_lock_irqsave(&gc->bgpio_lock, flags); |
2166 |
+ dwapb_write(gpio, GPIO_PORTA_EOI, val); |
2167 |
+- spin_unlock_irqrestore(&gc->bgpio_lock, flags); |
2168 |
++ raw_spin_unlock_irqrestore(&gc->bgpio_lock, flags); |
2169 |
+ } |
2170 |
+ |
2171 |
+ static void dwapb_irq_mask(struct irq_data *d) |
2172 |
+@@ -254,10 +254,10 @@ static void dwapb_irq_mask(struct irq_data *d) |
2173 |
+ unsigned long flags; |
2174 |
+ u32 val; |
2175 |
+ |
2176 |
+- spin_lock_irqsave(&gc->bgpio_lock, flags); |
2177 |
++ raw_spin_lock_irqsave(&gc->bgpio_lock, flags); |
2178 |
+ val = dwapb_read(gpio, GPIO_INTMASK) | BIT(irqd_to_hwirq(d)); |
2179 |
+ dwapb_write(gpio, GPIO_INTMASK, val); |
2180 |
+- spin_unlock_irqrestore(&gc->bgpio_lock, flags); |
2181 |
++ raw_spin_unlock_irqrestore(&gc->bgpio_lock, flags); |
2182 |
+ } |
2183 |
+ |
2184 |
+ static void dwapb_irq_unmask(struct irq_data *d) |
2185 |
+@@ -267,10 +267,10 @@ static void dwapb_irq_unmask(struct irq_data *d) |
2186 |
+ unsigned long flags; |
2187 |
+ u32 val; |
2188 |
+ |
2189 |
+- spin_lock_irqsave(&gc->bgpio_lock, flags); |
2190 |
++ raw_spin_lock_irqsave(&gc->bgpio_lock, flags); |
2191 |
+ val = dwapb_read(gpio, GPIO_INTMASK) & ~BIT(irqd_to_hwirq(d)); |
2192 |
+ dwapb_write(gpio, GPIO_INTMASK, val); |
2193 |
+- spin_unlock_irqrestore(&gc->bgpio_lock, flags); |
2194 |
++ raw_spin_unlock_irqrestore(&gc->bgpio_lock, flags); |
2195 |
+ } |
2196 |
+ |
2197 |
+ static void dwapb_irq_enable(struct irq_data *d) |
2198 |
+@@ -280,11 +280,11 @@ static void dwapb_irq_enable(struct irq_data *d) |
2199 |
+ unsigned long flags; |
2200 |
+ u32 val; |
2201 |
+ |
2202 |
+- spin_lock_irqsave(&gc->bgpio_lock, flags); |
2203 |
++ raw_spin_lock_irqsave(&gc->bgpio_lock, flags); |
2204 |
+ val = dwapb_read(gpio, GPIO_INTEN); |
2205 |
+ val |= BIT(irqd_to_hwirq(d)); |
2206 |
+ dwapb_write(gpio, GPIO_INTEN, val); |
2207 |
+- spin_unlock_irqrestore(&gc->bgpio_lock, flags); |
2208 |
++ raw_spin_unlock_irqrestore(&gc->bgpio_lock, flags); |
2209 |
+ } |
2210 |
+ |
2211 |
+ static void dwapb_irq_disable(struct irq_data *d) |
2212 |
+@@ -294,11 +294,11 @@ static void dwapb_irq_disable(struct irq_data *d) |
2213 |
+ unsigned long flags; |
2214 |
+ u32 val; |
2215 |
+ |
2216 |
+- spin_lock_irqsave(&gc->bgpio_lock, flags); |
2217 |
++ raw_spin_lock_irqsave(&gc->bgpio_lock, flags); |
2218 |
+ val = dwapb_read(gpio, GPIO_INTEN); |
2219 |
+ val &= ~BIT(irqd_to_hwirq(d)); |
2220 |
+ dwapb_write(gpio, GPIO_INTEN, val); |
2221 |
+- spin_unlock_irqrestore(&gc->bgpio_lock, flags); |
2222 |
++ raw_spin_unlock_irqrestore(&gc->bgpio_lock, flags); |
2223 |
+ } |
2224 |
+ |
2225 |
+ static int dwapb_irq_set_type(struct irq_data *d, u32 type) |
2226 |
+@@ -308,7 +308,7 @@ static int dwapb_irq_set_type(struct irq_data *d, u32 type) |
2227 |
+ irq_hw_number_t bit = irqd_to_hwirq(d); |
2228 |
+ unsigned long level, polarity, flags; |
2229 |
+ |
2230 |
+- spin_lock_irqsave(&gc->bgpio_lock, flags); |
2231 |
++ raw_spin_lock_irqsave(&gc->bgpio_lock, flags); |
2232 |
+ level = dwapb_read(gpio, GPIO_INTTYPE_LEVEL); |
2233 |
+ polarity = dwapb_read(gpio, GPIO_INT_POLARITY); |
2234 |
+ |
2235 |
+@@ -343,7 +343,7 @@ static int dwapb_irq_set_type(struct irq_data *d, u32 type) |
2236 |
+ dwapb_write(gpio, GPIO_INTTYPE_LEVEL, level); |
2237 |
+ if (type != IRQ_TYPE_EDGE_BOTH) |
2238 |
+ dwapb_write(gpio, GPIO_INT_POLARITY, polarity); |
2239 |
+- spin_unlock_irqrestore(&gc->bgpio_lock, flags); |
2240 |
++ raw_spin_unlock_irqrestore(&gc->bgpio_lock, flags); |
2241 |
+ |
2242 |
+ return 0; |
2243 |
+ } |
2244 |
+@@ -373,7 +373,7 @@ static int dwapb_gpio_set_debounce(struct gpio_chip *gc, |
2245 |
+ unsigned long flags, val_deb; |
2246 |
+ unsigned long mask = BIT(offset); |
2247 |
+ |
2248 |
+- spin_lock_irqsave(&gc->bgpio_lock, flags); |
2249 |
++ raw_spin_lock_irqsave(&gc->bgpio_lock, flags); |
2250 |
+ |
2251 |
+ val_deb = dwapb_read(gpio, GPIO_PORTA_DEBOUNCE); |
2252 |
+ if (debounce) |
2253 |
+@@ -382,7 +382,7 @@ static int dwapb_gpio_set_debounce(struct gpio_chip *gc, |
2254 |
+ val_deb &= ~mask; |
2255 |
+ dwapb_write(gpio, GPIO_PORTA_DEBOUNCE, val_deb); |
2256 |
+ |
2257 |
+- spin_unlock_irqrestore(&gc->bgpio_lock, flags); |
2258 |
++ raw_spin_unlock_irqrestore(&gc->bgpio_lock, flags); |
2259 |
+ |
2260 |
+ return 0; |
2261 |
+ } |
2262 |
+@@ -738,7 +738,7 @@ static int dwapb_gpio_suspend(struct device *dev) |
2263 |
+ unsigned long flags; |
2264 |
+ int i; |
2265 |
+ |
2266 |
+- spin_lock_irqsave(&gc->bgpio_lock, flags); |
2267 |
++ raw_spin_lock_irqsave(&gc->bgpio_lock, flags); |
2268 |
+ for (i = 0; i < gpio->nr_ports; i++) { |
2269 |
+ unsigned int offset; |
2270 |
+ unsigned int idx = gpio->ports[i].idx; |
2271 |
+@@ -765,7 +765,7 @@ static int dwapb_gpio_suspend(struct device *dev) |
2272 |
+ dwapb_write(gpio, GPIO_INTMASK, ~ctx->wake_en); |
2273 |
+ } |
2274 |
+ } |
2275 |
+- spin_unlock_irqrestore(&gc->bgpio_lock, flags); |
2276 |
++ raw_spin_unlock_irqrestore(&gc->bgpio_lock, flags); |
2277 |
+ |
2278 |
+ clk_bulk_disable_unprepare(DWAPB_NR_CLOCKS, gpio->clks); |
2279 |
+ |
2280 |
+@@ -785,7 +785,7 @@ static int dwapb_gpio_resume(struct device *dev) |
2281 |
+ return err; |
2282 |
+ } |
2283 |
+ |
2284 |
+- spin_lock_irqsave(&gc->bgpio_lock, flags); |
2285 |
++ raw_spin_lock_irqsave(&gc->bgpio_lock, flags); |
2286 |
+ for (i = 0; i < gpio->nr_ports; i++) { |
2287 |
+ unsigned int offset; |
2288 |
+ unsigned int idx = gpio->ports[i].idx; |
2289 |
+@@ -812,7 +812,7 @@ static int dwapb_gpio_resume(struct device *dev) |
2290 |
+ dwapb_write(gpio, GPIO_PORTA_EOI, 0xffffffff); |
2291 |
+ } |
2292 |
+ } |
2293 |
+- spin_unlock_irqrestore(&gc->bgpio_lock, flags); |
2294 |
++ raw_spin_unlock_irqrestore(&gc->bgpio_lock, flags); |
2295 |
+ |
2296 |
+ return 0; |
2297 |
+ } |
2298 |
+diff --git a/drivers/gpio/gpio-grgpio.c b/drivers/gpio/gpio-grgpio.c |
2299 |
+index f954359c9544e..21204a5dca3d4 100644 |
2300 |
+--- a/drivers/gpio/gpio-grgpio.c |
2301 |
++++ b/drivers/gpio/gpio-grgpio.c |
2302 |
+@@ -145,7 +145,7 @@ static int grgpio_irq_set_type(struct irq_data *d, unsigned int type) |
2303 |
+ return -EINVAL; |
2304 |
+ } |
2305 |
+ |
2306 |
+- spin_lock_irqsave(&priv->gc.bgpio_lock, flags); |
2307 |
++ raw_spin_lock_irqsave(&priv->gc.bgpio_lock, flags); |
2308 |
+ |
2309 |
+ ipol = priv->gc.read_reg(priv->regs + GRGPIO_IPOL) & ~mask; |
2310 |
+ iedge = priv->gc.read_reg(priv->regs + GRGPIO_IEDGE) & ~mask; |
2311 |
+@@ -153,7 +153,7 @@ static int grgpio_irq_set_type(struct irq_data *d, unsigned int type) |
2312 |
+ priv->gc.write_reg(priv->regs + GRGPIO_IPOL, ipol | pol); |
2313 |
+ priv->gc.write_reg(priv->regs + GRGPIO_IEDGE, iedge | edge); |
2314 |
+ |
2315 |
+- spin_unlock_irqrestore(&priv->gc.bgpio_lock, flags); |
2316 |
++ raw_spin_unlock_irqrestore(&priv->gc.bgpio_lock, flags); |
2317 |
+ |
2318 |
+ return 0; |
2319 |
+ } |
2320 |
+@@ -164,11 +164,11 @@ static void grgpio_irq_mask(struct irq_data *d) |
2321 |
+ int offset = d->hwirq; |
2322 |
+ unsigned long flags; |
2323 |
+ |
2324 |
+- spin_lock_irqsave(&priv->gc.bgpio_lock, flags); |
2325 |
++ raw_spin_lock_irqsave(&priv->gc.bgpio_lock, flags); |
2326 |
+ |
2327 |
+ grgpio_set_imask(priv, offset, 0); |
2328 |
+ |
2329 |
+- spin_unlock_irqrestore(&priv->gc.bgpio_lock, flags); |
2330 |
++ raw_spin_unlock_irqrestore(&priv->gc.bgpio_lock, flags); |
2331 |
+ } |
2332 |
+ |
2333 |
+ static void grgpio_irq_unmask(struct irq_data *d) |
2334 |
+@@ -177,11 +177,11 @@ static void grgpio_irq_unmask(struct irq_data *d) |
2335 |
+ int offset = d->hwirq; |
2336 |
+ unsigned long flags; |
2337 |
+ |
2338 |
+- spin_lock_irqsave(&priv->gc.bgpio_lock, flags); |
2339 |
++ raw_spin_lock_irqsave(&priv->gc.bgpio_lock, flags); |
2340 |
+ |
2341 |
+ grgpio_set_imask(priv, offset, 1); |
2342 |
+ |
2343 |
+- spin_unlock_irqrestore(&priv->gc.bgpio_lock, flags); |
2344 |
++ raw_spin_unlock_irqrestore(&priv->gc.bgpio_lock, flags); |
2345 |
+ } |
2346 |
+ |
2347 |
+ static struct irq_chip grgpio_irq_chip = { |
2348 |
+@@ -199,7 +199,7 @@ static irqreturn_t grgpio_irq_handler(int irq, void *dev) |
2349 |
+ int i; |
2350 |
+ int match = 0; |
2351 |
+ |
2352 |
+- spin_lock_irqsave(&priv->gc.bgpio_lock, flags); |
2353 |
++ raw_spin_lock_irqsave(&priv->gc.bgpio_lock, flags); |
2354 |
+ |
2355 |
+ /* |
2356 |
+ * For each gpio line, call its interrupt handler if it its underlying |
2357 |
+@@ -215,7 +215,7 @@ static irqreturn_t grgpio_irq_handler(int irq, void *dev) |
2358 |
+ } |
2359 |
+ } |
2360 |
+ |
2361 |
+- spin_unlock_irqrestore(&priv->gc.bgpio_lock, flags); |
2362 |
++ raw_spin_unlock_irqrestore(&priv->gc.bgpio_lock, flags); |
2363 |
+ |
2364 |
+ if (!match) |
2365 |
+ dev_warn(priv->dev, "No gpio line matched irq %d\n", irq); |
2366 |
+@@ -247,13 +247,13 @@ static int grgpio_irq_map(struct irq_domain *d, unsigned int irq, |
2367 |
+ dev_dbg(priv->dev, "Mapping irq %d for gpio line %d\n", |
2368 |
+ irq, offset); |
2369 |
+ |
2370 |
+- spin_lock_irqsave(&priv->gc.bgpio_lock, flags); |
2371 |
++ raw_spin_lock_irqsave(&priv->gc.bgpio_lock, flags); |
2372 |
+ |
2373 |
+ /* Request underlying irq if not already requested */ |
2374 |
+ lirq->irq = irq; |
2375 |
+ uirq = &priv->uirqs[lirq->index]; |
2376 |
+ if (uirq->refcnt == 0) { |
2377 |
+- spin_unlock_irqrestore(&priv->gc.bgpio_lock, flags); |
2378 |
++ raw_spin_unlock_irqrestore(&priv->gc.bgpio_lock, flags); |
2379 |
+ ret = request_irq(uirq->uirq, grgpio_irq_handler, 0, |
2380 |
+ dev_name(priv->dev), priv); |
2381 |
+ if (ret) { |
2382 |
+@@ -262,11 +262,11 @@ static int grgpio_irq_map(struct irq_domain *d, unsigned int irq, |
2383 |
+ uirq->uirq); |
2384 |
+ return ret; |
2385 |
+ } |
2386 |
+- spin_lock_irqsave(&priv->gc.bgpio_lock, flags); |
2387 |
++ raw_spin_lock_irqsave(&priv->gc.bgpio_lock, flags); |
2388 |
+ } |
2389 |
+ uirq->refcnt++; |
2390 |
+ |
2391 |
+- spin_unlock_irqrestore(&priv->gc.bgpio_lock, flags); |
2392 |
++ raw_spin_unlock_irqrestore(&priv->gc.bgpio_lock, flags); |
2393 |
+ |
2394 |
+ /* Setup irq */ |
2395 |
+ irq_set_chip_data(irq, priv); |
2396 |
+@@ -290,7 +290,7 @@ static void grgpio_irq_unmap(struct irq_domain *d, unsigned int irq) |
2397 |
+ irq_set_chip_and_handler(irq, NULL, NULL); |
2398 |
+ irq_set_chip_data(irq, NULL); |
2399 |
+ |
2400 |
+- spin_lock_irqsave(&priv->gc.bgpio_lock, flags); |
2401 |
++ raw_spin_lock_irqsave(&priv->gc.bgpio_lock, flags); |
2402 |
+ |
2403 |
+ /* Free underlying irq if last user unmapped */ |
2404 |
+ index = -1; |
2405 |
+@@ -309,13 +309,13 @@ static void grgpio_irq_unmap(struct irq_domain *d, unsigned int irq) |
2406 |
+ uirq = &priv->uirqs[lirq->index]; |
2407 |
+ uirq->refcnt--; |
2408 |
+ if (uirq->refcnt == 0) { |
2409 |
+- spin_unlock_irqrestore(&priv->gc.bgpio_lock, flags); |
2410 |
++ raw_spin_unlock_irqrestore(&priv->gc.bgpio_lock, flags); |
2411 |
+ free_irq(uirq->uirq, priv); |
2412 |
+ return; |
2413 |
+ } |
2414 |
+ } |
2415 |
+ |
2416 |
+- spin_unlock_irqrestore(&priv->gc.bgpio_lock, flags); |
2417 |
++ raw_spin_unlock_irqrestore(&priv->gc.bgpio_lock, flags); |
2418 |
+ } |
2419 |
+ |
2420 |
+ static const struct irq_domain_ops grgpio_irq_domain_ops = { |
2421 |
+diff --git a/drivers/gpio/gpio-hlwd.c b/drivers/gpio/gpio-hlwd.c |
2422 |
+index 641719a96a1a9..4e13e937f8324 100644 |
2423 |
+--- a/drivers/gpio/gpio-hlwd.c |
2424 |
++++ b/drivers/gpio/gpio-hlwd.c |
2425 |
+@@ -65,7 +65,7 @@ static void hlwd_gpio_irqhandler(struct irq_desc *desc) |
2426 |
+ int hwirq; |
2427 |
+ u32 emulated_pending; |
2428 |
+ |
2429 |
+- spin_lock_irqsave(&hlwd->gpioc.bgpio_lock, flags); |
2430 |
++ raw_spin_lock_irqsave(&hlwd->gpioc.bgpio_lock, flags); |
2431 |
+ pending = ioread32be(hlwd->regs + HW_GPIOB_INTFLAG); |
2432 |
+ pending &= ioread32be(hlwd->regs + HW_GPIOB_INTMASK); |
2433 |
+ |
2434 |
+@@ -93,7 +93,7 @@ static void hlwd_gpio_irqhandler(struct irq_desc *desc) |
2435 |
+ /* Mark emulated interrupts as pending */ |
2436 |
+ pending |= rising | falling; |
2437 |
+ } |
2438 |
+- spin_unlock_irqrestore(&hlwd->gpioc.bgpio_lock, flags); |
2439 |
++ raw_spin_unlock_irqrestore(&hlwd->gpioc.bgpio_lock, flags); |
2440 |
+ |
2441 |
+ chained_irq_enter(chip, desc); |
2442 |
+ |
2443 |
+@@ -118,11 +118,11 @@ static void hlwd_gpio_irq_mask(struct irq_data *data) |
2444 |
+ unsigned long flags; |
2445 |
+ u32 mask; |
2446 |
+ |
2447 |
+- spin_lock_irqsave(&hlwd->gpioc.bgpio_lock, flags); |
2448 |
++ raw_spin_lock_irqsave(&hlwd->gpioc.bgpio_lock, flags); |
2449 |
+ mask = ioread32be(hlwd->regs + HW_GPIOB_INTMASK); |
2450 |
+ mask &= ~BIT(data->hwirq); |
2451 |
+ iowrite32be(mask, hlwd->regs + HW_GPIOB_INTMASK); |
2452 |
+- spin_unlock_irqrestore(&hlwd->gpioc.bgpio_lock, flags); |
2453 |
++ raw_spin_unlock_irqrestore(&hlwd->gpioc.bgpio_lock, flags); |
2454 |
+ } |
2455 |
+ |
2456 |
+ static void hlwd_gpio_irq_unmask(struct irq_data *data) |
2457 |
+@@ -132,11 +132,11 @@ static void hlwd_gpio_irq_unmask(struct irq_data *data) |
2458 |
+ unsigned long flags; |
2459 |
+ u32 mask; |
2460 |
+ |
2461 |
+- spin_lock_irqsave(&hlwd->gpioc.bgpio_lock, flags); |
2462 |
++ raw_spin_lock_irqsave(&hlwd->gpioc.bgpio_lock, flags); |
2463 |
+ mask = ioread32be(hlwd->regs + HW_GPIOB_INTMASK); |
2464 |
+ mask |= BIT(data->hwirq); |
2465 |
+ iowrite32be(mask, hlwd->regs + HW_GPIOB_INTMASK); |
2466 |
+- spin_unlock_irqrestore(&hlwd->gpioc.bgpio_lock, flags); |
2467 |
++ raw_spin_unlock_irqrestore(&hlwd->gpioc.bgpio_lock, flags); |
2468 |
+ } |
2469 |
+ |
2470 |
+ static void hlwd_gpio_irq_enable(struct irq_data *data) |
2471 |
+@@ -173,7 +173,7 @@ static int hlwd_gpio_irq_set_type(struct irq_data *data, unsigned int flow_type) |
2472 |
+ unsigned long flags; |
2473 |
+ u32 level; |
2474 |
+ |
2475 |
+- spin_lock_irqsave(&hlwd->gpioc.bgpio_lock, flags); |
2476 |
++ raw_spin_lock_irqsave(&hlwd->gpioc.bgpio_lock, flags); |
2477 |
+ |
2478 |
+ hlwd->edge_emulation &= ~BIT(data->hwirq); |
2479 |
+ |
2480 |
+@@ -194,11 +194,11 @@ static int hlwd_gpio_irq_set_type(struct irq_data *data, unsigned int flow_type) |
2481 |
+ hlwd_gpio_irq_setup_emulation(hlwd, data->hwirq, flow_type); |
2482 |
+ break; |
2483 |
+ default: |
2484 |
+- spin_unlock_irqrestore(&hlwd->gpioc.bgpio_lock, flags); |
2485 |
++ raw_spin_unlock_irqrestore(&hlwd->gpioc.bgpio_lock, flags); |
2486 |
+ return -EINVAL; |
2487 |
+ } |
2488 |
+ |
2489 |
+- spin_unlock_irqrestore(&hlwd->gpioc.bgpio_lock, flags); |
2490 |
++ raw_spin_unlock_irqrestore(&hlwd->gpioc.bgpio_lock, flags); |
2491 |
+ return 0; |
2492 |
+ } |
2493 |
+ |
2494 |
+diff --git a/drivers/gpio/gpio-idt3243x.c b/drivers/gpio/gpio-idt3243x.c |
2495 |
+index 52b8b72ded77f..1cafdf46f8756 100644 |
2496 |
+--- a/drivers/gpio/gpio-idt3243x.c |
2497 |
++++ b/drivers/gpio/gpio-idt3243x.c |
2498 |
+@@ -57,7 +57,7 @@ static int idt_gpio_irq_set_type(struct irq_data *d, unsigned int flow_type) |
2499 |
+ if (sense == IRQ_TYPE_NONE || (sense & IRQ_TYPE_EDGE_BOTH)) |
2500 |
+ return -EINVAL; |
2501 |
+ |
2502 |
+- spin_lock_irqsave(&gc->bgpio_lock, flags); |
2503 |
++ raw_spin_lock_irqsave(&gc->bgpio_lock, flags); |
2504 |
+ |
2505 |
+ ilevel = readl(ctrl->gpio + IDT_GPIO_ILEVEL); |
2506 |
+ if (sense & IRQ_TYPE_LEVEL_HIGH) |
2507 |
+@@ -68,7 +68,7 @@ static int idt_gpio_irq_set_type(struct irq_data *d, unsigned int flow_type) |
2508 |
+ writel(ilevel, ctrl->gpio + IDT_GPIO_ILEVEL); |
2509 |
+ irq_set_handler_locked(d, handle_level_irq); |
2510 |
+ |
2511 |
+- spin_unlock_irqrestore(&gc->bgpio_lock, flags); |
2512 |
++ raw_spin_unlock_irqrestore(&gc->bgpio_lock, flags); |
2513 |
+ return 0; |
2514 |
+ } |
2515 |
+ |
2516 |
+@@ -86,12 +86,12 @@ static void idt_gpio_mask(struct irq_data *d) |
2517 |
+ struct idt_gpio_ctrl *ctrl = gpiochip_get_data(gc); |
2518 |
+ unsigned long flags; |
2519 |
+ |
2520 |
+- spin_lock_irqsave(&gc->bgpio_lock, flags); |
2521 |
++ raw_spin_lock_irqsave(&gc->bgpio_lock, flags); |
2522 |
+ |
2523 |
+ ctrl->mask_cache |= BIT(d->hwirq); |
2524 |
+ writel(ctrl->mask_cache, ctrl->pic + IDT_PIC_IRQ_MASK); |
2525 |
+ |
2526 |
+- spin_unlock_irqrestore(&gc->bgpio_lock, flags); |
2527 |
++ raw_spin_unlock_irqrestore(&gc->bgpio_lock, flags); |
2528 |
+ } |
2529 |
+ |
2530 |
+ static void idt_gpio_unmask(struct irq_data *d) |
2531 |
+@@ -100,12 +100,12 @@ static void idt_gpio_unmask(struct irq_data *d) |
2532 |
+ struct idt_gpio_ctrl *ctrl = gpiochip_get_data(gc); |
2533 |
+ unsigned long flags; |
2534 |
+ |
2535 |
+- spin_lock_irqsave(&gc->bgpio_lock, flags); |
2536 |
++ raw_spin_lock_irqsave(&gc->bgpio_lock, flags); |
2537 |
+ |
2538 |
+ ctrl->mask_cache &= ~BIT(d->hwirq); |
2539 |
+ writel(ctrl->mask_cache, ctrl->pic + IDT_PIC_IRQ_MASK); |
2540 |
+ |
2541 |
+- spin_unlock_irqrestore(&gc->bgpio_lock, flags); |
2542 |
++ raw_spin_unlock_irqrestore(&gc->bgpio_lock, flags); |
2543 |
+ } |
2544 |
+ |
2545 |
+ static int idt_gpio_irq_init_hw(struct gpio_chip *gc) |
2546 |
+diff --git a/drivers/gpio/gpio-ixp4xx.c b/drivers/gpio/gpio-ixp4xx.c |
2547 |
+index b3b050604e0be..6b184502fa3f8 100644 |
2548 |
+--- a/drivers/gpio/gpio-ixp4xx.c |
2549 |
++++ b/drivers/gpio/gpio-ixp4xx.c |
2550 |
+@@ -128,7 +128,7 @@ static int ixp4xx_gpio_irq_set_type(struct irq_data *d, unsigned int type) |
2551 |
+ int_reg = IXP4XX_REG_GPIT1; |
2552 |
+ } |
2553 |
+ |
2554 |
+- spin_lock_irqsave(&g->gc.bgpio_lock, flags); |
2555 |
++ raw_spin_lock_irqsave(&g->gc.bgpio_lock, flags); |
2556 |
+ |
2557 |
+ /* Clear the style for the appropriate pin */ |
2558 |
+ val = __raw_readl(g->base + int_reg); |
2559 |
+@@ -147,7 +147,7 @@ static int ixp4xx_gpio_irq_set_type(struct irq_data *d, unsigned int type) |
2560 |
+ val |= BIT(d->hwirq); |
2561 |
+ __raw_writel(val, g->base + IXP4XX_REG_GPOE); |
2562 |
+ |
2563 |
+- spin_unlock_irqrestore(&g->gc.bgpio_lock, flags); |
2564 |
++ raw_spin_unlock_irqrestore(&g->gc.bgpio_lock, flags); |
2565 |
+ |
2566 |
+ /* This parent only accept level high (asserted) */ |
2567 |
+ return irq_chip_set_type_parent(d, IRQ_TYPE_LEVEL_HIGH); |
2568 |
+diff --git a/drivers/gpio/gpio-loongson1.c b/drivers/gpio/gpio-loongson1.c |
2569 |
+index 1b1ee94eeab47..5d90b3bc5a256 100644 |
2570 |
+--- a/drivers/gpio/gpio-loongson1.c |
2571 |
++++ b/drivers/gpio/gpio-loongson1.c |
2572 |
+@@ -25,10 +25,10 @@ static int ls1x_gpio_request(struct gpio_chip *gc, unsigned int offset) |
2573 |
+ { |
2574 |
+ unsigned long flags; |
2575 |
+ |
2576 |
+- spin_lock_irqsave(&gc->bgpio_lock, flags); |
2577 |
++ raw_spin_lock_irqsave(&gc->bgpio_lock, flags); |
2578 |
+ __raw_writel(__raw_readl(gpio_reg_base + GPIO_CFG) | BIT(offset), |
2579 |
+ gpio_reg_base + GPIO_CFG); |
2580 |
+- spin_unlock_irqrestore(&gc->bgpio_lock, flags); |
2581 |
++ raw_spin_unlock_irqrestore(&gc->bgpio_lock, flags); |
2582 |
+ |
2583 |
+ return 0; |
2584 |
+ } |
2585 |
+@@ -37,10 +37,10 @@ static void ls1x_gpio_free(struct gpio_chip *gc, unsigned int offset) |
2586 |
+ { |
2587 |
+ unsigned long flags; |
2588 |
+ |
2589 |
+- spin_lock_irqsave(&gc->bgpio_lock, flags); |
2590 |
++ raw_spin_lock_irqsave(&gc->bgpio_lock, flags); |
2591 |
+ __raw_writel(__raw_readl(gpio_reg_base + GPIO_CFG) & ~BIT(offset), |
2592 |
+ gpio_reg_base + GPIO_CFG); |
2593 |
+- spin_unlock_irqrestore(&gc->bgpio_lock, flags); |
2594 |
++ raw_spin_unlock_irqrestore(&gc->bgpio_lock, flags); |
2595 |
+ } |
2596 |
+ |
2597 |
+ static int ls1x_gpio_probe(struct platform_device *pdev) |
2598 |
+diff --git a/drivers/gpio/gpio-menz127.c b/drivers/gpio/gpio-menz127.c |
2599 |
+index 1e21c661d79d6..a035a9bcb57c6 100644 |
2600 |
+--- a/drivers/gpio/gpio-menz127.c |
2601 |
++++ b/drivers/gpio/gpio-menz127.c |
2602 |
+@@ -64,7 +64,7 @@ static int men_z127_debounce(struct gpio_chip *gc, unsigned gpio, |
2603 |
+ debounce /= 50; |
2604 |
+ } |
2605 |
+ |
2606 |
+- spin_lock(&gc->bgpio_lock); |
2607 |
++ raw_spin_lock(&gc->bgpio_lock); |
2608 |
+ |
2609 |
+ db_en = readl(priv->reg_base + MEN_Z127_DBER); |
2610 |
+ |
2611 |
+@@ -79,7 +79,7 @@ static int men_z127_debounce(struct gpio_chip *gc, unsigned gpio, |
2612 |
+ writel(db_en, priv->reg_base + MEN_Z127_DBER); |
2613 |
+ writel(db_cnt, priv->reg_base + GPIO_TO_DBCNT_REG(gpio)); |
2614 |
+ |
2615 |
+- spin_unlock(&gc->bgpio_lock); |
2616 |
++ raw_spin_unlock(&gc->bgpio_lock); |
2617 |
+ |
2618 |
+ return 0; |
2619 |
+ } |
2620 |
+@@ -91,7 +91,7 @@ static int men_z127_set_single_ended(struct gpio_chip *gc, |
2621 |
+ struct men_z127_gpio *priv = gpiochip_get_data(gc); |
2622 |
+ u32 od_en; |
2623 |
+ |
2624 |
+- spin_lock(&gc->bgpio_lock); |
2625 |
++ raw_spin_lock(&gc->bgpio_lock); |
2626 |
+ od_en = readl(priv->reg_base + MEN_Z127_ODER); |
2627 |
+ |
2628 |
+ if (param == PIN_CONFIG_DRIVE_OPEN_DRAIN) |
2629 |
+@@ -101,7 +101,7 @@ static int men_z127_set_single_ended(struct gpio_chip *gc, |
2630 |
+ od_en &= ~BIT(offset); |
2631 |
+ |
2632 |
+ writel(od_en, priv->reg_base + MEN_Z127_ODER); |
2633 |
+- spin_unlock(&gc->bgpio_lock); |
2634 |
++ raw_spin_unlock(&gc->bgpio_lock); |
2635 |
+ |
2636 |
+ return 0; |
2637 |
+ } |
2638 |
+diff --git a/drivers/gpio/gpio-mlxbf2.c b/drivers/gpio/gpio-mlxbf2.c |
2639 |
+index 40a052bc67849..5a09070e5f78c 100644 |
2640 |
+--- a/drivers/gpio/gpio-mlxbf2.c |
2641 |
++++ b/drivers/gpio/gpio-mlxbf2.c |
2642 |
+@@ -120,7 +120,7 @@ static int mlxbf2_gpio_lock_acquire(struct mlxbf2_gpio_context *gs) |
2643 |
+ u32 arm_gpio_lock_val; |
2644 |
+ |
2645 |
+ mutex_lock(yu_arm_gpio_lock_param.lock); |
2646 |
+- spin_lock(&gs->gc.bgpio_lock); |
2647 |
++ raw_spin_lock(&gs->gc.bgpio_lock); |
2648 |
+ |
2649 |
+ arm_gpio_lock_val = readl(yu_arm_gpio_lock_param.io); |
2650 |
+ |
2651 |
+@@ -128,7 +128,7 @@ static int mlxbf2_gpio_lock_acquire(struct mlxbf2_gpio_context *gs) |
2652 |
+ * When lock active bit[31] is set, ModeX is write enabled |
2653 |
+ */ |
2654 |
+ if (YU_LOCK_ACTIVE_BIT(arm_gpio_lock_val)) { |
2655 |
+- spin_unlock(&gs->gc.bgpio_lock); |
2656 |
++ raw_spin_unlock(&gs->gc.bgpio_lock); |
2657 |
+ mutex_unlock(yu_arm_gpio_lock_param.lock); |
2658 |
+ return -EINVAL; |
2659 |
+ } |
2660 |
+@@ -146,7 +146,7 @@ static void mlxbf2_gpio_lock_release(struct mlxbf2_gpio_context *gs) |
2661 |
+ __releases(yu_arm_gpio_lock_param.lock) |
2662 |
+ { |
2663 |
+ writel(YU_ARM_GPIO_LOCK_RELEASE, yu_arm_gpio_lock_param.io); |
2664 |
+- spin_unlock(&gs->gc.bgpio_lock); |
2665 |
++ raw_spin_unlock(&gs->gc.bgpio_lock); |
2666 |
+ mutex_unlock(yu_arm_gpio_lock_param.lock); |
2667 |
+ } |
2668 |
+ |
2669 |
+diff --git a/drivers/gpio/gpio-mmio.c b/drivers/gpio/gpio-mmio.c |
2670 |
+index c335a0309ba31..d9dff3dc92ae5 100644 |
2671 |
+--- a/drivers/gpio/gpio-mmio.c |
2672 |
++++ b/drivers/gpio/gpio-mmio.c |
2673 |
+@@ -220,7 +220,7 @@ static void bgpio_set(struct gpio_chip *gc, unsigned int gpio, int val) |
2674 |
+ unsigned long mask = bgpio_line2mask(gc, gpio); |
2675 |
+ unsigned long flags; |
2676 |
+ |
2677 |
+- spin_lock_irqsave(&gc->bgpio_lock, flags); |
2678 |
++ raw_spin_lock_irqsave(&gc->bgpio_lock, flags); |
2679 |
+ |
2680 |
+ if (val) |
2681 |
+ gc->bgpio_data |= mask; |
2682 |
+@@ -229,7 +229,7 @@ static void bgpio_set(struct gpio_chip *gc, unsigned int gpio, int val) |
2683 |
+ |
2684 |
+ gc->write_reg(gc->reg_dat, gc->bgpio_data); |
2685 |
+ |
2686 |
+- spin_unlock_irqrestore(&gc->bgpio_lock, flags); |
2687 |
++ raw_spin_unlock_irqrestore(&gc->bgpio_lock, flags); |
2688 |
+ } |
2689 |
+ |
2690 |
+ static void bgpio_set_with_clear(struct gpio_chip *gc, unsigned int gpio, |
2691 |
+@@ -248,7 +248,7 @@ static void bgpio_set_set(struct gpio_chip *gc, unsigned int gpio, int val) |
2692 |
+ unsigned long mask = bgpio_line2mask(gc, gpio); |
2693 |
+ unsigned long flags; |
2694 |
+ |
2695 |
+- spin_lock_irqsave(&gc->bgpio_lock, flags); |
2696 |
++ raw_spin_lock_irqsave(&gc->bgpio_lock, flags); |
2697 |
+ |
2698 |
+ if (val) |
2699 |
+ gc->bgpio_data |= mask; |
2700 |
+@@ -257,7 +257,7 @@ static void bgpio_set_set(struct gpio_chip *gc, unsigned int gpio, int val) |
2701 |
+ |
2702 |
+ gc->write_reg(gc->reg_set, gc->bgpio_data); |
2703 |
+ |
2704 |
+- spin_unlock_irqrestore(&gc->bgpio_lock, flags); |
2705 |
++ raw_spin_unlock_irqrestore(&gc->bgpio_lock, flags); |
2706 |
+ } |
2707 |
+ |
2708 |
+ static void bgpio_multiple_get_masks(struct gpio_chip *gc, |
2709 |
+@@ -286,7 +286,7 @@ static void bgpio_set_multiple_single_reg(struct gpio_chip *gc, |
2710 |
+ unsigned long flags; |
2711 |
+ unsigned long set_mask, clear_mask; |
2712 |
+ |
2713 |
+- spin_lock_irqsave(&gc->bgpio_lock, flags); |
2714 |
++ raw_spin_lock_irqsave(&gc->bgpio_lock, flags); |
2715 |
+ |
2716 |
+ bgpio_multiple_get_masks(gc, mask, bits, &set_mask, &clear_mask); |
2717 |
+ |
2718 |
+@@ -295,7 +295,7 @@ static void bgpio_set_multiple_single_reg(struct gpio_chip *gc, |
2719 |
+ |
2720 |
+ gc->write_reg(reg, gc->bgpio_data); |
2721 |
+ |
2722 |
+- spin_unlock_irqrestore(&gc->bgpio_lock, flags); |
2723 |
++ raw_spin_unlock_irqrestore(&gc->bgpio_lock, flags); |
2724 |
+ } |
2725 |
+ |
2726 |
+ static void bgpio_set_multiple(struct gpio_chip *gc, unsigned long *mask, |
2727 |
+@@ -347,7 +347,7 @@ static int bgpio_dir_in(struct gpio_chip *gc, unsigned int gpio) |
2728 |
+ { |
2729 |
+ unsigned long flags; |
2730 |
+ |
2731 |
+- spin_lock_irqsave(&gc->bgpio_lock, flags); |
2732 |
++ raw_spin_lock_irqsave(&gc->bgpio_lock, flags); |
2733 |
+ |
2734 |
+ gc->bgpio_dir &= ~bgpio_line2mask(gc, gpio); |
2735 |
+ |
2736 |
+@@ -356,7 +356,7 @@ static int bgpio_dir_in(struct gpio_chip *gc, unsigned int gpio) |
2737 |
+ if (gc->reg_dir_out) |
2738 |
+ gc->write_reg(gc->reg_dir_out, gc->bgpio_dir); |
2739 |
+ |
2740 |
+- spin_unlock_irqrestore(&gc->bgpio_lock, flags); |
2741 |
++ raw_spin_unlock_irqrestore(&gc->bgpio_lock, flags); |
2742 |
+ |
2743 |
+ return 0; |
2744 |
+ } |
2745 |
+@@ -387,7 +387,7 @@ static void bgpio_dir_out(struct gpio_chip *gc, unsigned int gpio, int val) |
2746 |
+ { |
2747 |
+ unsigned long flags; |
2748 |
+ |
2749 |
+- spin_lock_irqsave(&gc->bgpio_lock, flags); |
2750 |
++ raw_spin_lock_irqsave(&gc->bgpio_lock, flags); |
2751 |
+ |
2752 |
+ gc->bgpio_dir |= bgpio_line2mask(gc, gpio); |
2753 |
+ |
2754 |
+@@ -396,7 +396,7 @@ static void bgpio_dir_out(struct gpio_chip *gc, unsigned int gpio, int val) |
2755 |
+ if (gc->reg_dir_out) |
2756 |
+ gc->write_reg(gc->reg_dir_out, gc->bgpio_dir); |
2757 |
+ |
2758 |
+- spin_unlock_irqrestore(&gc->bgpio_lock, flags); |
2759 |
++ raw_spin_unlock_irqrestore(&gc->bgpio_lock, flags); |
2760 |
+ } |
2761 |
+ |
2762 |
+ static int bgpio_dir_out_dir_first(struct gpio_chip *gc, unsigned int gpio, |
2763 |
+@@ -610,7 +610,7 @@ int bgpio_init(struct gpio_chip *gc, struct device *dev, |
2764 |
+ if (gc->bgpio_bits > BITS_PER_LONG) |
2765 |
+ return -EINVAL; |
2766 |
+ |
2767 |
+- spin_lock_init(&gc->bgpio_lock); |
2768 |
++ raw_spin_lock_init(&gc->bgpio_lock); |
2769 |
+ gc->parent = dev; |
2770 |
+ gc->label = dev_name(dev); |
2771 |
+ gc->base = -1; |
2772 |
+diff --git a/drivers/gpio/gpio-mxc.c b/drivers/gpio/gpio-mxc.c |
2773 |
+index c871602fc5ba9..853d9aa6b3b1f 100644 |
2774 |
+--- a/drivers/gpio/gpio-mxc.c |
2775 |
++++ b/drivers/gpio/gpio-mxc.c |
2776 |
+@@ -18,6 +18,7 @@ |
2777 |
+ #include <linux/module.h> |
2778 |
+ #include <linux/platform_device.h> |
2779 |
+ #include <linux/slab.h> |
2780 |
++#include <linux/spinlock.h> |
2781 |
+ #include <linux/syscore_ops.h> |
2782 |
+ #include <linux/gpio/driver.h> |
2783 |
+ #include <linux/of.h> |
2784 |
+@@ -147,6 +148,7 @@ static int gpio_set_irq_type(struct irq_data *d, u32 type) |
2785 |
+ { |
2786 |
+ struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); |
2787 |
+ struct mxc_gpio_port *port = gc->private; |
2788 |
++ unsigned long flags; |
2789 |
+ u32 bit, val; |
2790 |
+ u32 gpio_idx = d->hwirq; |
2791 |
+ int edge; |
2792 |
+@@ -185,6 +187,8 @@ static int gpio_set_irq_type(struct irq_data *d, u32 type) |
2793 |
+ return -EINVAL; |
2794 |
+ } |
2795 |
+ |
2796 |
++ raw_spin_lock_irqsave(&port->gc.bgpio_lock, flags); |
2797 |
++ |
2798 |
+ if (GPIO_EDGE_SEL >= 0) { |
2799 |
+ val = readl(port->base + GPIO_EDGE_SEL); |
2800 |
+ if (edge == GPIO_INT_BOTH_EDGES) |
2801 |
+@@ -204,15 +208,20 @@ static int gpio_set_irq_type(struct irq_data *d, u32 type) |
2802 |
+ |
2803 |
+ writel(1 << gpio_idx, port->base + GPIO_ISR); |
2804 |
+ |
2805 |
+- return 0; |
2806 |
++ raw_spin_unlock_irqrestore(&port->gc.bgpio_lock, flags); |
2807 |
++ |
2808 |
++ return port->gc.direction_input(&port->gc, gpio_idx); |
2809 |
+ } |
2810 |
+ |
2811 |
+ static void mxc_flip_edge(struct mxc_gpio_port *port, u32 gpio) |
2812 |
+ { |
2813 |
+ void __iomem *reg = port->base; |
2814 |
++ unsigned long flags; |
2815 |
+ u32 bit, val; |
2816 |
+ int edge; |
2817 |
+ |
2818 |
++ raw_spin_lock_irqsave(&port->gc.bgpio_lock, flags); |
2819 |
++ |
2820 |
+ reg += GPIO_ICR1 + ((gpio & 0x10) >> 2); /* lower or upper register */ |
2821 |
+ bit = gpio & 0xf; |
2822 |
+ val = readl(reg); |
2823 |
+@@ -227,9 +236,12 @@ static void mxc_flip_edge(struct mxc_gpio_port *port, u32 gpio) |
2824 |
+ } else { |
2825 |
+ pr_err("mxc: invalid configuration for GPIO %d: %x\n", |
2826 |
+ gpio, edge); |
2827 |
+- return; |
2828 |
++ goto unlock; |
2829 |
+ } |
2830 |
+ writel(val | (edge << (bit << 1)), reg); |
2831 |
++ |
2832 |
++unlock: |
2833 |
++ raw_spin_unlock_irqrestore(&port->gc.bgpio_lock, flags); |
2834 |
+ } |
2835 |
+ |
2836 |
+ /* handle 32 interrupts in one status register */ |
2837 |
+diff --git a/drivers/gpio/gpio-sifive.c b/drivers/gpio/gpio-sifive.c |
2838 |
+index f50236e68e888..f41123de69c59 100644 |
2839 |
+--- a/drivers/gpio/gpio-sifive.c |
2840 |
++++ b/drivers/gpio/gpio-sifive.c |
2841 |
+@@ -44,7 +44,7 @@ static void sifive_gpio_set_ie(struct sifive_gpio *chip, unsigned int offset) |
2842 |
+ unsigned long flags; |
2843 |
+ unsigned int trigger; |
2844 |
+ |
2845 |
+- spin_lock_irqsave(&chip->gc.bgpio_lock, flags); |
2846 |
++ raw_spin_lock_irqsave(&chip->gc.bgpio_lock, flags); |
2847 |
+ trigger = (chip->irq_state & BIT(offset)) ? chip->trigger[offset] : 0; |
2848 |
+ regmap_update_bits(chip->regs, SIFIVE_GPIO_RISE_IE, BIT(offset), |
2849 |
+ (trigger & IRQ_TYPE_EDGE_RISING) ? BIT(offset) : 0); |
2850 |
+@@ -54,7 +54,7 @@ static void sifive_gpio_set_ie(struct sifive_gpio *chip, unsigned int offset) |
2851 |
+ (trigger & IRQ_TYPE_LEVEL_HIGH) ? BIT(offset) : 0); |
2852 |
+ regmap_update_bits(chip->regs, SIFIVE_GPIO_LOW_IE, BIT(offset), |
2853 |
+ (trigger & IRQ_TYPE_LEVEL_LOW) ? BIT(offset) : 0); |
2854 |
+- spin_unlock_irqrestore(&chip->gc.bgpio_lock, flags); |
2855 |
++ raw_spin_unlock_irqrestore(&chip->gc.bgpio_lock, flags); |
2856 |
+ } |
2857 |
+ |
2858 |
+ static int sifive_gpio_irq_set_type(struct irq_data *d, unsigned int trigger) |
2859 |
+@@ -84,13 +84,13 @@ static void sifive_gpio_irq_enable(struct irq_data *d) |
2860 |
+ /* Switch to input */ |
2861 |
+ gc->direction_input(gc, offset); |
2862 |
+ |
2863 |
+- spin_lock_irqsave(&gc->bgpio_lock, flags); |
2864 |
++ raw_spin_lock_irqsave(&gc->bgpio_lock, flags); |
2865 |
+ /* Clear any sticky pending interrupts */ |
2866 |
+ regmap_write(chip->regs, SIFIVE_GPIO_RISE_IP, bit); |
2867 |
+ regmap_write(chip->regs, SIFIVE_GPIO_FALL_IP, bit); |
2868 |
+ regmap_write(chip->regs, SIFIVE_GPIO_HIGH_IP, bit); |
2869 |
+ regmap_write(chip->regs, SIFIVE_GPIO_LOW_IP, bit); |
2870 |
+- spin_unlock_irqrestore(&gc->bgpio_lock, flags); |
2871 |
++ raw_spin_unlock_irqrestore(&gc->bgpio_lock, flags); |
2872 |
+ |
2873 |
+ /* Enable interrupts */ |
2874 |
+ assign_bit(offset, &chip->irq_state, 1); |
2875 |
+@@ -116,13 +116,13 @@ static void sifive_gpio_irq_eoi(struct irq_data *d) |
2876 |
+ u32 bit = BIT(offset); |
2877 |
+ unsigned long flags; |
2878 |
+ |
2879 |
+- spin_lock_irqsave(&gc->bgpio_lock, flags); |
2880 |
++ raw_spin_lock_irqsave(&gc->bgpio_lock, flags); |
2881 |
+ /* Clear all pending interrupts */ |
2882 |
+ regmap_write(chip->regs, SIFIVE_GPIO_RISE_IP, bit); |
2883 |
+ regmap_write(chip->regs, SIFIVE_GPIO_FALL_IP, bit); |
2884 |
+ regmap_write(chip->regs, SIFIVE_GPIO_HIGH_IP, bit); |
2885 |
+ regmap_write(chip->regs, SIFIVE_GPIO_LOW_IP, bit); |
2886 |
+- spin_unlock_irqrestore(&gc->bgpio_lock, flags); |
2887 |
++ raw_spin_unlock_irqrestore(&gc->bgpio_lock, flags); |
2888 |
+ |
2889 |
+ irq_chip_eoi_parent(d); |
2890 |
+ } |
2891 |
+diff --git a/drivers/gpio/gpio-tb10x.c b/drivers/gpio/gpio-tb10x.c |
2892 |
+index 718a508d3b2f8..de6afa3f97168 100644 |
2893 |
+--- a/drivers/gpio/gpio-tb10x.c |
2894 |
++++ b/drivers/gpio/gpio-tb10x.c |
2895 |
+@@ -62,14 +62,14 @@ static inline void tb10x_set_bits(struct tb10x_gpio *gpio, unsigned int offs, |
2896 |
+ u32 r; |
2897 |
+ unsigned long flags; |
2898 |
+ |
2899 |
+- spin_lock_irqsave(&gpio->gc.bgpio_lock, flags); |
2900 |
++ raw_spin_lock_irqsave(&gpio->gc.bgpio_lock, flags); |
2901 |
+ |
2902 |
+ r = tb10x_reg_read(gpio, offs); |
2903 |
+ r = (r & ~mask) | (val & mask); |
2904 |
+ |
2905 |
+ tb10x_reg_write(gpio, offs, r); |
2906 |
+ |
2907 |
+- spin_unlock_irqrestore(&gpio->gc.bgpio_lock, flags); |
2908 |
++ raw_spin_unlock_irqrestore(&gpio->gc.bgpio_lock, flags); |
2909 |
+ } |
2910 |
+ |
2911 |
+ static int tb10x_gpio_to_irq(struct gpio_chip *chip, unsigned offset) |
2912 |
+diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c |
2913 |
+index e7845df6cad22..5e32906f9819a 100644 |
2914 |
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c |
2915 |
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c |
2916 |
+@@ -580,10 +580,14 @@ void amdgpu_gfx_off_ctrl(struct amdgpu_device *adev, bool enable) |
2917 |
+ if (adev->gfx.gfx_off_req_count == 0 && |
2918 |
+ !adev->gfx.gfx_off_state) { |
2919 |
+ /* If going to s2idle, no need to wait */ |
2920 |
+- if (adev->in_s0ix) |
2921 |
+- delay = GFX_OFF_NO_DELAY; |
2922 |
+- schedule_delayed_work(&adev->gfx.gfx_off_delay_work, |
2923 |
++ if (adev->in_s0ix) { |
2924 |
++ if (!amdgpu_dpm_set_powergating_by_smu(adev, |
2925 |
++ AMD_IP_BLOCK_TYPE_GFX, true)) |
2926 |
++ adev->gfx.gfx_off_state = true; |
2927 |
++ } else { |
2928 |
++ schedule_delayed_work(&adev->gfx.gfx_off_delay_work, |
2929 |
+ delay); |
2930 |
++ } |
2931 |
+ } |
2932 |
+ } else { |
2933 |
+ if (adev->gfx.gfx_off_req_count == 0) { |
2934 |
+diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |
2935 |
+index 409739ee5ba0a..a2d9e0af06544 100644 |
2936 |
+--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |
2937 |
++++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |
2938 |
+@@ -1688,10 +1688,6 @@ static void amdgpu_dm_fini(struct amdgpu_device *adev) |
2939 |
+ } |
2940 |
+ #endif |
2941 |
+ |
2942 |
+- for (i = 0; i < adev->dm.display_indexes_num; i++) { |
2943 |
+- drm_encoder_cleanup(&adev->dm.mst_encoders[i].base); |
2944 |
+- } |
2945 |
+- |
2946 |
+ amdgpu_dm_destroy_drm_device(&adev->dm); |
2947 |
+ |
2948 |
+ #if defined(CONFIG_DRM_AMD_SECURE_DISPLAY) |
2949 |
+diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c |
2950 |
+index 652cf108b3c2a..bc02e3e0d17d0 100644 |
2951 |
+--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c |
2952 |
++++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c |
2953 |
+@@ -385,7 +385,6 @@ static const struct drm_connector_helper_funcs dm_dp_mst_connector_helper_funcs |
2954 |
+ static void amdgpu_dm_encoder_destroy(struct drm_encoder *encoder) |
2955 |
+ { |
2956 |
+ drm_encoder_cleanup(encoder); |
2957 |
+- kfree(encoder); |
2958 |
+ } |
2959 |
+ |
2960 |
+ static const struct drm_encoder_funcs amdgpu_dm_encoder_funcs = { |
2961 |
+diff --git a/drivers/gpu/drm/drm_panel_orientation_quirks.c b/drivers/gpu/drm/drm_panel_orientation_quirks.c |
2962 |
+index ca0fefeaab20b..ce739ba45c551 100644 |
2963 |
+--- a/drivers/gpu/drm/drm_panel_orientation_quirks.c |
2964 |
++++ b/drivers/gpu/drm/drm_panel_orientation_quirks.c |
2965 |
+@@ -272,6 +272,12 @@ static const struct dmi_system_id orientation_data[] = { |
2966 |
+ DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "Lenovo ideapad D330-10IGM"), |
2967 |
+ }, |
2968 |
+ .driver_data = (void *)&lcd1200x1920_rightside_up, |
2969 |
++ }, { /* Lenovo Ideapad D330-10IGL (HD) */ |
2970 |
++ .matches = { |
2971 |
++ DMI_EXACT_MATCH(DMI_SYS_VENDOR, "LENOVO"), |
2972 |
++ DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "Lenovo ideapad D330-10IGL"), |
2973 |
++ }, |
2974 |
++ .driver_data = (void *)&lcd800x1280_rightside_up, |
2975 |
+ }, { /* Lenovo Yoga Book X90F / X91F / X91L */ |
2976 |
+ .matches = { |
2977 |
+ /* Non exact match to match all versions */ |
2978 |
+diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c |
2979 |
+index 59fb4c710c8ca..41094d51fc6fd 100644 |
2980 |
+--- a/drivers/gpu/drm/i915/i915_drv.c |
2981 |
++++ b/drivers/gpu/drm/i915/i915_drv.c |
2982 |
+@@ -986,12 +986,9 @@ static int i915_driver_open(struct drm_device *dev, struct drm_file *file) |
2983 |
+ */ |
2984 |
+ static void i915_driver_lastclose(struct drm_device *dev) |
2985 |
+ { |
2986 |
+- struct drm_i915_private *i915 = to_i915(dev); |
2987 |
+- |
2988 |
+ intel_fbdev_restore_mode(dev); |
2989 |
+ |
2990 |
+- if (HAS_DISPLAY(i915)) |
2991 |
+- vga_switcheroo_process_delayed_switch(); |
2992 |
++ vga_switcheroo_process_delayed_switch(); |
2993 |
+ } |
2994 |
+ |
2995 |
+ static void i915_driver_postclose(struct drm_device *dev, struct drm_file *file) |
2996 |
+diff --git a/drivers/gpu/drm/i915/i915_switcheroo.c b/drivers/gpu/drm/i915/i915_switcheroo.c |
2997 |
+index de0e224b56ce3..f1ce9f591efaf 100644 |
2998 |
+--- a/drivers/gpu/drm/i915/i915_switcheroo.c |
2999 |
++++ b/drivers/gpu/drm/i915/i915_switcheroo.c |
3000 |
+@@ -18,6 +18,10 @@ static void i915_switcheroo_set_state(struct pci_dev *pdev, |
3001 |
+ dev_err(&pdev->dev, "DRM not initialized, aborting switch.\n"); |
3002 |
+ return; |
3003 |
+ } |
3004 |
++ if (!HAS_DISPLAY(i915)) { |
3005 |
++ dev_err(&pdev->dev, "Device state not initialized, aborting switch.\n"); |
3006 |
++ return; |
3007 |
++ } |
3008 |
+ |
3009 |
+ if (state == VGA_SWITCHEROO_ON) { |
3010 |
+ drm_info(&i915->drm, "switched on\n"); |
3011 |
+@@ -43,7 +47,7 @@ static bool i915_switcheroo_can_switch(struct pci_dev *pdev) |
3012 |
+ * locking inversion with the driver load path. And the access here is |
3013 |
+ * completely racy anyway. So don't bother with locking for now. |
3014 |
+ */ |
3015 |
+- return i915 && atomic_read(&i915->drm.open_count) == 0; |
3016 |
++ return i915 && HAS_DISPLAY(i915) && atomic_read(&i915->drm.open_count) == 0; |
3017 |
+ } |
3018 |
+ |
3019 |
+ static const struct vga_switcheroo_client_ops i915_switcheroo_ops = { |
3020 |
+diff --git a/drivers/gpu/drm/i915/selftests/intel_scheduler_helpers.c b/drivers/gpu/drm/i915/selftests/intel_scheduler_helpers.c |
3021 |
+index 4b328346b48a2..83ffd175ca894 100644 |
3022 |
+--- a/drivers/gpu/drm/i915/selftests/intel_scheduler_helpers.c |
3023 |
++++ b/drivers/gpu/drm/i915/selftests/intel_scheduler_helpers.c |
3024 |
+@@ -16,8 +16,7 @@ |
3025 |
+ |
3026 |
+ int intel_selftest_modify_policy(struct intel_engine_cs *engine, |
3027 |
+ struct intel_selftest_saved_policy *saved, |
3028 |
+- u32 modify_type) |
3029 |
+- |
3030 |
++ enum selftest_scheduler_modify modify_type) |
3031 |
+ { |
3032 |
+ int err; |
3033 |
+ |
3034 |
+diff --git a/drivers/gpu/drm/panfrost/Kconfig b/drivers/gpu/drm/panfrost/Kconfig |
3035 |
+index 86cdc0ce79e65..77f4d32e52045 100644 |
3036 |
+--- a/drivers/gpu/drm/panfrost/Kconfig |
3037 |
++++ b/drivers/gpu/drm/panfrost/Kconfig |
3038 |
+@@ -3,7 +3,8 @@ |
3039 |
+ config DRM_PANFROST |
3040 |
+ tristate "Panfrost (DRM support for ARM Mali Midgard/Bifrost GPUs)" |
3041 |
+ depends on DRM |
3042 |
+- depends on ARM || ARM64 || (COMPILE_TEST && !GENERIC_ATOMIC64) |
3043 |
++ depends on ARM || ARM64 || COMPILE_TEST |
3044 |
++ depends on !GENERIC_ATOMIC64 # for IOMMU_IO_PGTABLE_LPAE |
3045 |
+ depends on MMU |
3046 |
+ select DRM_SCHED |
3047 |
+ select IOMMU_SUPPORT |
3048 |
+diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_msg_arm64.h b/drivers/gpu/drm/vmwgfx/vmwgfx_msg_arm64.h |
3049 |
+old mode 100755 |
3050 |
+new mode 100644 |
3051 |
+diff --git a/drivers/hid/hid-betopff.c b/drivers/hid/hid-betopff.c |
3052 |
+index 467d789f9bc2d..25ed7b9a917e4 100644 |
3053 |
+--- a/drivers/hid/hid-betopff.c |
3054 |
++++ b/drivers/hid/hid-betopff.c |
3055 |
+@@ -60,7 +60,6 @@ static int betopff_init(struct hid_device *hid) |
3056 |
+ struct list_head *report_list = |
3057 |
+ &hid->report_enum[HID_OUTPUT_REPORT].report_list; |
3058 |
+ struct input_dev *dev; |
3059 |
+- int field_count = 0; |
3060 |
+ int error; |
3061 |
+ int i, j; |
3062 |
+ |
3063 |
+@@ -86,19 +85,21 @@ static int betopff_init(struct hid_device *hid) |
3064 |
+ * ----------------------------------------- |
3065 |
+ * Do init them with default value. |
3066 |
+ */ |
3067 |
++ if (report->maxfield < 4) { |
3068 |
++ hid_err(hid, "not enough fields in the report: %d\n", |
3069 |
++ report->maxfield); |
3070 |
++ return -ENODEV; |
3071 |
++ } |
3072 |
+ for (i = 0; i < report->maxfield; i++) { |
3073 |
++ if (report->field[i]->report_count < 1) { |
3074 |
++ hid_err(hid, "no values in the field\n"); |
3075 |
++ return -ENODEV; |
3076 |
++ } |
3077 |
+ for (j = 0; j < report->field[i]->report_count; j++) { |
3078 |
+ report->field[i]->value[j] = 0x00; |
3079 |
+- field_count++; |
3080 |
+ } |
3081 |
+ } |
3082 |
+ |
3083 |
+- if (field_count < 4) { |
3084 |
+- hid_err(hid, "not enough fields in the report: %d\n", |
3085 |
+- field_count); |
3086 |
+- return -ENODEV; |
3087 |
+- } |
3088 |
+- |
3089 |
+ betopff = kzalloc(sizeof(*betopff), GFP_KERNEL); |
3090 |
+ if (!betopff) |
3091 |
+ return -ENOMEM; |
3092 |
+diff --git a/drivers/hid/hid-bigbenff.c b/drivers/hid/hid-bigbenff.c |
3093 |
+index e8c5e3ac9fff1..e8b16665860d6 100644 |
3094 |
+--- a/drivers/hid/hid-bigbenff.c |
3095 |
++++ b/drivers/hid/hid-bigbenff.c |
3096 |
+@@ -344,6 +344,11 @@ static int bigben_probe(struct hid_device *hid, |
3097 |
+ } |
3098 |
+ |
3099 |
+ report_list = &hid->report_enum[HID_OUTPUT_REPORT].report_list; |
3100 |
++ if (list_empty(report_list)) { |
3101 |
++ hid_err(hid, "no output report found\n"); |
3102 |
++ error = -ENODEV; |
3103 |
++ goto error_hw_stop; |
3104 |
++ } |
3105 |
+ bigben->report = list_entry(report_list->next, |
3106 |
+ struct hid_report, list); |
3107 |
+ |
3108 |
+diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c |
3109 |
+index ef9c799fa3715..2e475bd426b84 100644 |
3110 |
+--- a/drivers/hid/hid-core.c |
3111 |
++++ b/drivers/hid/hid-core.c |
3112 |
+@@ -988,8 +988,8 @@ struct hid_report *hid_validate_values(struct hid_device *hid, |
3113 |
+ * Validating on id 0 means we should examine the first |
3114 |
+ * report in the list. |
3115 |
+ */ |
3116 |
+- report = list_entry( |
3117 |
+- hid->report_enum[type].report_list.next, |
3118 |
++ report = list_first_entry_or_null( |
3119 |
++ &hid->report_enum[type].report_list, |
3120 |
+ struct hid_report, list); |
3121 |
+ } else { |
3122 |
+ report = hid->report_enum[type].report_id_hash[id]; |
3123 |
+diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h |
3124 |
+index 8698d49edaa38..fa1aa22547ea7 100644 |
3125 |
+--- a/drivers/hid/hid-ids.h |
3126 |
++++ b/drivers/hid/hid-ids.h |
3127 |
+@@ -261,7 +261,6 @@ |
3128 |
+ #define USB_DEVICE_ID_CH_AXIS_295 0x001c |
3129 |
+ |
3130 |
+ #define USB_VENDOR_ID_CHERRY 0x046a |
3131 |
+-#define USB_DEVICE_ID_CHERRY_MOUSE_000C 0x000c |
3132 |
+ #define USB_DEVICE_ID_CHERRY_CYMOTION 0x0023 |
3133 |
+ #define USB_DEVICE_ID_CHERRY_CYMOTION_SOLAR 0x0027 |
3134 |
+ |
3135 |
+diff --git a/drivers/hid/hid-quirks.c b/drivers/hid/hid-quirks.c |
3136 |
+index fc1e061900bc0..184029cad014f 100644 |
3137 |
+--- a/drivers/hid/hid-quirks.c |
3138 |
++++ b/drivers/hid/hid-quirks.c |
3139 |
+@@ -54,7 +54,6 @@ static const struct hid_device_id hid_quirks[] = { |
3140 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_FLIGHT_SIM_YOKE), HID_QUIRK_NOGET }, |
3141 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_PRO_PEDALS), HID_QUIRK_NOGET }, |
3142 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_PRO_THROTTLE), HID_QUIRK_NOGET }, |
3143 |
+- { HID_USB_DEVICE(USB_VENDOR_ID_CHERRY, USB_DEVICE_ID_CHERRY_MOUSE_000C), HID_QUIRK_ALWAYS_POLL }, |
3144 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_CORSAIR, USB_DEVICE_ID_CORSAIR_K65RGB), HID_QUIRK_NO_INIT_REPORTS }, |
3145 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_CORSAIR, USB_DEVICE_ID_CORSAIR_K65RGB_RAPIDFIRE), HID_QUIRK_NO_INIT_REPORTS | HID_QUIRK_ALWAYS_POLL }, |
3146 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_CORSAIR, USB_DEVICE_ID_CORSAIR_K70RGB), HID_QUIRK_NO_INIT_REPORTS }, |
3147 |
+diff --git a/drivers/hid/intel-ish-hid/ishtp/dma-if.c b/drivers/hid/intel-ish-hid/ishtp/dma-if.c |
3148 |
+index 40554c8daca07..00046cbfd4ed0 100644 |
3149 |
+--- a/drivers/hid/intel-ish-hid/ishtp/dma-if.c |
3150 |
++++ b/drivers/hid/intel-ish-hid/ishtp/dma-if.c |
3151 |
+@@ -104,6 +104,11 @@ void *ishtp_cl_get_dma_send_buf(struct ishtp_device *dev, |
3152 |
+ int required_slots = (size / DMA_SLOT_SIZE) |
3153 |
+ + 1 * (size % DMA_SLOT_SIZE != 0); |
3154 |
+ |
3155 |
++ if (!dev->ishtp_dma_tx_map) { |
3156 |
++ dev_err(dev->devc, "Fail to allocate Tx map\n"); |
3157 |
++ return NULL; |
3158 |
++ } |
3159 |
++ |
3160 |
+ spin_lock_irqsave(&dev->ishtp_dma_tx_lock, flags); |
3161 |
+ for (i = 0; i <= (dev->ishtp_dma_num_slots - required_slots); i++) { |
3162 |
+ free = 1; |
3163 |
+@@ -150,6 +155,11 @@ void ishtp_cl_release_dma_acked_mem(struct ishtp_device *dev, |
3164 |
+ return; |
3165 |
+ } |
3166 |
+ |
3167 |
++ if (!dev->ishtp_dma_tx_map) { |
3168 |
++ dev_err(dev->devc, "Fail to allocate Tx map\n"); |
3169 |
++ return; |
3170 |
++ } |
3171 |
++ |
3172 |
+ i = (msg_addr - dev->ishtp_host_dma_tx_buf) / DMA_SLOT_SIZE; |
3173 |
+ spin_lock_irqsave(&dev->ishtp_dma_tx_lock, flags); |
3174 |
+ for (j = 0; j < acked_slots; j++) { |
3175 |
+diff --git a/drivers/i2c/busses/i2c-designware-common.c b/drivers/i2c/busses/i2c-designware-common.c |
3176 |
+index a1100e37626e2..4af65f101dac4 100644 |
3177 |
+--- a/drivers/i2c/busses/i2c-designware-common.c |
3178 |
++++ b/drivers/i2c/busses/i2c-designware-common.c |
3179 |
+@@ -351,7 +351,8 @@ u32 i2c_dw_scl_hcnt(u32 ic_clk, u32 tSYMBOL, u32 tf, int cond, int offset) |
3180 |
+ * |
3181 |
+ * If your hardware is free from tHD;STA issue, try this one. |
3182 |
+ */ |
3183 |
+- return DIV_ROUND_CLOSEST(ic_clk * tSYMBOL, MICRO) - 8 + offset; |
3184 |
++ return DIV_ROUND_CLOSEST_ULL((u64)ic_clk * tSYMBOL, MICRO) - |
3185 |
++ 8 + offset; |
3186 |
+ else |
3187 |
+ /* |
3188 |
+ * Conditional expression: |
3189 |
+@@ -367,7 +368,8 @@ u32 i2c_dw_scl_hcnt(u32 ic_clk, u32 tSYMBOL, u32 tf, int cond, int offset) |
3190 |
+ * The reason why we need to take into account "tf" here, |
3191 |
+ * is the same as described in i2c_dw_scl_lcnt(). |
3192 |
+ */ |
3193 |
+- return DIV_ROUND_CLOSEST(ic_clk * (tSYMBOL + tf), MICRO) - 3 + offset; |
3194 |
++ return DIV_ROUND_CLOSEST_ULL((u64)ic_clk * (tSYMBOL + tf), MICRO) - |
3195 |
++ 3 + offset; |
3196 |
+ } |
3197 |
+ |
3198 |
+ u32 i2c_dw_scl_lcnt(u32 ic_clk, u32 tLOW, u32 tf, int offset) |
3199 |
+@@ -383,7 +385,8 @@ u32 i2c_dw_scl_lcnt(u32 ic_clk, u32 tLOW, u32 tf, int offset) |
3200 |
+ * account the fall time of SCL signal (tf). Default tf value |
3201 |
+ * should be 0.3 us, for safety. |
3202 |
+ */ |
3203 |
+- return DIV_ROUND_CLOSEST(ic_clk * (tLOW + tf), MICRO) - 1 + offset; |
3204 |
++ return DIV_ROUND_CLOSEST_ULL((u64)ic_clk * (tLOW + tf), MICRO) - |
3205 |
++ 1 + offset; |
3206 |
+ } |
3207 |
+ |
3208 |
+ int i2c_dw_set_sda_hold(struct dw_i2c_dev *dev) |
3209 |
+diff --git a/drivers/i2c/busses/i2c-mv64xxx.c b/drivers/i2c/busses/i2c-mv64xxx.c |
3210 |
+index 5c8e94b6cdb5a..103a05ecc3d6b 100644 |
3211 |
+--- a/drivers/i2c/busses/i2c-mv64xxx.c |
3212 |
++++ b/drivers/i2c/busses/i2c-mv64xxx.c |
3213 |
+@@ -150,6 +150,7 @@ struct mv64xxx_i2c_data { |
3214 |
+ /* Clk div is 2 to the power n, not 2 to the power n + 1 */ |
3215 |
+ bool clk_n_base_0; |
3216 |
+ struct i2c_bus_recovery_info rinfo; |
3217 |
++ bool atomic; |
3218 |
+ }; |
3219 |
+ |
3220 |
+ static struct mv64xxx_i2c_regs mv64xxx_i2c_regs_mv64xxx = { |
3221 |
+@@ -179,7 +180,10 @@ mv64xxx_i2c_prepare_for_io(struct mv64xxx_i2c_data *drv_data, |
3222 |
+ u32 dir = 0; |
3223 |
+ |
3224 |
+ drv_data->cntl_bits = MV64XXX_I2C_REG_CONTROL_ACK | |
3225 |
+- MV64XXX_I2C_REG_CONTROL_INTEN | MV64XXX_I2C_REG_CONTROL_TWSIEN; |
3226 |
++ MV64XXX_I2C_REG_CONTROL_TWSIEN; |
3227 |
++ |
3228 |
++ if (!drv_data->atomic) |
3229 |
++ drv_data->cntl_bits |= MV64XXX_I2C_REG_CONTROL_INTEN; |
3230 |
+ |
3231 |
+ if (msg->flags & I2C_M_RD) |
3232 |
+ dir = 1; |
3233 |
+@@ -409,7 +413,8 @@ mv64xxx_i2c_do_action(struct mv64xxx_i2c_data *drv_data) |
3234 |
+ case MV64XXX_I2C_ACTION_RCV_DATA_STOP: |
3235 |
+ drv_data->msg->buf[drv_data->byte_posn++] = |
3236 |
+ readl(drv_data->reg_base + drv_data->reg_offsets.data); |
3237 |
+- drv_data->cntl_bits &= ~MV64XXX_I2C_REG_CONTROL_INTEN; |
3238 |
++ if (!drv_data->atomic) |
3239 |
++ drv_data->cntl_bits &= ~MV64XXX_I2C_REG_CONTROL_INTEN; |
3240 |
+ writel(drv_data->cntl_bits | MV64XXX_I2C_REG_CONTROL_STOP, |
3241 |
+ drv_data->reg_base + drv_data->reg_offsets.control); |
3242 |
+ drv_data->block = 0; |
3243 |
+@@ -427,7 +432,8 @@ mv64xxx_i2c_do_action(struct mv64xxx_i2c_data *drv_data) |
3244 |
+ drv_data->rc = -EIO; |
3245 |
+ fallthrough; |
3246 |
+ case MV64XXX_I2C_ACTION_SEND_STOP: |
3247 |
+- drv_data->cntl_bits &= ~MV64XXX_I2C_REG_CONTROL_INTEN; |
3248 |
++ if (!drv_data->atomic) |
3249 |
++ drv_data->cntl_bits &= ~MV64XXX_I2C_REG_CONTROL_INTEN; |
3250 |
+ writel(drv_data->cntl_bits | MV64XXX_I2C_REG_CONTROL_STOP, |
3251 |
+ drv_data->reg_base + drv_data->reg_offsets.control); |
3252 |
+ drv_data->block = 0; |
3253 |
+@@ -575,6 +581,17 @@ mv64xxx_i2c_wait_for_completion(struct mv64xxx_i2c_data *drv_data) |
3254 |
+ spin_unlock_irqrestore(&drv_data->lock, flags); |
3255 |
+ } |
3256 |
+ |
3257 |
++static void mv64xxx_i2c_wait_polling(struct mv64xxx_i2c_data *drv_data) |
3258 |
++{ |
3259 |
++ ktime_t timeout = ktime_add_ms(ktime_get(), drv_data->adapter.timeout); |
3260 |
++ |
3261 |
++ while (READ_ONCE(drv_data->block) && |
3262 |
++ ktime_compare(ktime_get(), timeout) < 0) { |
3263 |
++ udelay(5); |
3264 |
++ mv64xxx_i2c_intr(0, drv_data); |
3265 |
++ } |
3266 |
++} |
3267 |
++ |
3268 |
+ static int |
3269 |
+ mv64xxx_i2c_execute_msg(struct mv64xxx_i2c_data *drv_data, struct i2c_msg *msg, |
3270 |
+ int is_last) |
3271 |
+@@ -590,7 +607,11 @@ mv64xxx_i2c_execute_msg(struct mv64xxx_i2c_data *drv_data, struct i2c_msg *msg, |
3272 |
+ mv64xxx_i2c_send_start(drv_data); |
3273 |
+ spin_unlock_irqrestore(&drv_data->lock, flags); |
3274 |
+ |
3275 |
+- mv64xxx_i2c_wait_for_completion(drv_data); |
3276 |
++ if (!drv_data->atomic) |
3277 |
++ mv64xxx_i2c_wait_for_completion(drv_data); |
3278 |
++ else |
3279 |
++ mv64xxx_i2c_wait_polling(drv_data); |
3280 |
++ |
3281 |
+ return drv_data->rc; |
3282 |
+ } |
3283 |
+ |
3284 |
+@@ -717,7 +738,7 @@ mv64xxx_i2c_functionality(struct i2c_adapter *adap) |
3285 |
+ } |
3286 |
+ |
3287 |
+ static int |
3288 |
+-mv64xxx_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num) |
3289 |
++mv64xxx_i2c_xfer_core(struct i2c_adapter *adap, struct i2c_msg msgs[], int num) |
3290 |
+ { |
3291 |
+ struct mv64xxx_i2c_data *drv_data = i2c_get_adapdata(adap); |
3292 |
+ int rc, ret = num; |
3293 |
+@@ -730,7 +751,7 @@ mv64xxx_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num) |
3294 |
+ drv_data->msgs = msgs; |
3295 |
+ drv_data->num_msgs = num; |
3296 |
+ |
3297 |
+- if (mv64xxx_i2c_can_offload(drv_data)) |
3298 |
++ if (mv64xxx_i2c_can_offload(drv_data) && !drv_data->atomic) |
3299 |
+ rc = mv64xxx_i2c_offload_xfer(drv_data); |
3300 |
+ else |
3301 |
+ rc = mv64xxx_i2c_execute_msg(drv_data, &msgs[0], num == 1); |
3302 |
+@@ -747,8 +768,27 @@ mv64xxx_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num) |
3303 |
+ return ret; |
3304 |
+ } |
3305 |
+ |
3306 |
++static int |
3307 |
++mv64xxx_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num) |
3308 |
++{ |
3309 |
++ struct mv64xxx_i2c_data *drv_data = i2c_get_adapdata(adap); |
3310 |
++ |
3311 |
++ drv_data->atomic = 0; |
3312 |
++ return mv64xxx_i2c_xfer_core(adap, msgs, num); |
3313 |
++} |
3314 |
++ |
3315 |
++static int mv64xxx_i2c_xfer_atomic(struct i2c_adapter *adap, |
3316 |
++ struct i2c_msg msgs[], int num) |
3317 |
++{ |
3318 |
++ struct mv64xxx_i2c_data *drv_data = i2c_get_adapdata(adap); |
3319 |
++ |
3320 |
++ drv_data->atomic = 1; |
3321 |
++ return mv64xxx_i2c_xfer_core(adap, msgs, num); |
3322 |
++} |
3323 |
++ |
3324 |
+ static const struct i2c_algorithm mv64xxx_i2c_algo = { |
3325 |
+ .master_xfer = mv64xxx_i2c_xfer, |
3326 |
++ .master_xfer_atomic = mv64xxx_i2c_xfer_atomic, |
3327 |
+ .functionality = mv64xxx_i2c_functionality, |
3328 |
+ }; |
3329 |
+ |
3330 |
+@@ -1047,14 +1087,6 @@ mv64xxx_i2c_remove(struct platform_device *pd) |
3331 |
+ return 0; |
3332 |
+ } |
3333 |
+ |
3334 |
+-static void |
3335 |
+-mv64xxx_i2c_shutdown(struct platform_device *pd) |
3336 |
+-{ |
3337 |
+- pm_runtime_disable(&pd->dev); |
3338 |
+- if (!pm_runtime_status_suspended(&pd->dev)) |
3339 |
+- mv64xxx_i2c_runtime_suspend(&pd->dev); |
3340 |
+-} |
3341 |
+- |
3342 |
+ static const struct dev_pm_ops mv64xxx_i2c_pm_ops = { |
3343 |
+ SET_RUNTIME_PM_OPS(mv64xxx_i2c_runtime_suspend, |
3344 |
+ mv64xxx_i2c_runtime_resume, NULL) |
3345 |
+@@ -1065,7 +1097,6 @@ static const struct dev_pm_ops mv64xxx_i2c_pm_ops = { |
3346 |
+ static struct platform_driver mv64xxx_i2c_driver = { |
3347 |
+ .probe = mv64xxx_i2c_probe, |
3348 |
+ .remove = mv64xxx_i2c_remove, |
3349 |
+- .shutdown = mv64xxx_i2c_shutdown, |
3350 |
+ .driver = { |
3351 |
+ .name = MV64XXX_I2C_CTLR_NAME, |
3352 |
+ .pm = &mv64xxx_i2c_pm_ops, |
3353 |
+diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c |
3354 |
+index b721085bb5971..f0c07e4ba4388 100644 |
3355 |
+--- a/drivers/infiniband/core/verbs.c |
3356 |
++++ b/drivers/infiniband/core/verbs.c |
3357 |
+@@ -2965,15 +2965,18 @@ EXPORT_SYMBOL(__rdma_block_iter_start); |
3358 |
+ bool __rdma_block_iter_next(struct ib_block_iter *biter) |
3359 |
+ { |
3360 |
+ unsigned int block_offset; |
3361 |
++ unsigned int sg_delta; |
3362 |
+ |
3363 |
+ if (!biter->__sg_nents || !biter->__sg) |
3364 |
+ return false; |
3365 |
+ |
3366 |
+ biter->__dma_addr = sg_dma_address(biter->__sg) + biter->__sg_advance; |
3367 |
+ block_offset = biter->__dma_addr & (BIT_ULL(biter->__pg_bit) - 1); |
3368 |
+- biter->__sg_advance += BIT_ULL(biter->__pg_bit) - block_offset; |
3369 |
++ sg_delta = BIT_ULL(biter->__pg_bit) - block_offset; |
3370 |
+ |
3371 |
+- if (biter->__sg_advance >= sg_dma_len(biter->__sg)) { |
3372 |
++ if (sg_dma_len(biter->__sg) - biter->__sg_advance > sg_delta) { |
3373 |
++ biter->__sg_advance += sg_delta; |
3374 |
++ } else { |
3375 |
+ biter->__sg_advance = 0; |
3376 |
+ biter->__sg = sg_next(biter->__sg); |
3377 |
+ biter->__sg_nents--; |
3378 |
+diff --git a/drivers/infiniband/hw/hfi1/user_exp_rcv.c b/drivers/infiniband/hw/hfi1/user_exp_rcv.c |
3379 |
+index 0c86e9d354f8e..ba930112c1624 100644 |
3380 |
+--- a/drivers/infiniband/hw/hfi1/user_exp_rcv.c |
3381 |
++++ b/drivers/infiniband/hw/hfi1/user_exp_rcv.c |
3382 |
+@@ -23,18 +23,25 @@ static void cacheless_tid_rb_remove(struct hfi1_filedata *fdata, |
3383 |
+ static bool tid_rb_invalidate(struct mmu_interval_notifier *mni, |
3384 |
+ const struct mmu_notifier_range *range, |
3385 |
+ unsigned long cur_seq); |
3386 |
++static bool tid_cover_invalidate(struct mmu_interval_notifier *mni, |
3387 |
++ const struct mmu_notifier_range *range, |
3388 |
++ unsigned long cur_seq); |
3389 |
+ static int program_rcvarray(struct hfi1_filedata *fd, struct tid_user_buf *, |
3390 |
+ struct tid_group *grp, |
3391 |
+ unsigned int start, u16 count, |
3392 |
+ u32 *tidlist, unsigned int *tididx, |
3393 |
+ unsigned int *pmapped); |
3394 |
+-static int unprogram_rcvarray(struct hfi1_filedata *fd, u32 tidinfo, |
3395 |
+- struct tid_group **grp); |
3396 |
++static int unprogram_rcvarray(struct hfi1_filedata *fd, u32 tidinfo); |
3397 |
++static void __clear_tid_node(struct hfi1_filedata *fd, |
3398 |
++ struct tid_rb_node *node); |
3399 |
+ static void clear_tid_node(struct hfi1_filedata *fd, struct tid_rb_node *node); |
3400 |
+ |
3401 |
+ static const struct mmu_interval_notifier_ops tid_mn_ops = { |
3402 |
+ .invalidate = tid_rb_invalidate, |
3403 |
+ }; |
3404 |
++static const struct mmu_interval_notifier_ops tid_cover_ops = { |
3405 |
++ .invalidate = tid_cover_invalidate, |
3406 |
++}; |
3407 |
+ |
3408 |
+ /* |
3409 |
+ * Initialize context and file private data needed for Expected |
3410 |
+@@ -253,53 +260,65 @@ int hfi1_user_exp_rcv_setup(struct hfi1_filedata *fd, |
3411 |
+ tididx = 0, mapped, mapped_pages = 0; |
3412 |
+ u32 *tidlist = NULL; |
3413 |
+ struct tid_user_buf *tidbuf; |
3414 |
++ unsigned long mmu_seq = 0; |
3415 |
+ |
3416 |
+ if (!PAGE_ALIGNED(tinfo->vaddr)) |
3417 |
+ return -EINVAL; |
3418 |
++ if (tinfo->length == 0) |
3419 |
++ return -EINVAL; |
3420 |
+ |
3421 |
+ tidbuf = kzalloc(sizeof(*tidbuf), GFP_KERNEL); |
3422 |
+ if (!tidbuf) |
3423 |
+ return -ENOMEM; |
3424 |
+ |
3425 |
++ mutex_init(&tidbuf->cover_mutex); |
3426 |
+ tidbuf->vaddr = tinfo->vaddr; |
3427 |
+ tidbuf->length = tinfo->length; |
3428 |
+ tidbuf->psets = kcalloc(uctxt->expected_count, sizeof(*tidbuf->psets), |
3429 |
+ GFP_KERNEL); |
3430 |
+ if (!tidbuf->psets) { |
3431 |
+- kfree(tidbuf); |
3432 |
+- return -ENOMEM; |
3433 |
++ ret = -ENOMEM; |
3434 |
++ goto fail_release_mem; |
3435 |
++ } |
3436 |
++ |
3437 |
++ if (fd->use_mn) { |
3438 |
++ ret = mmu_interval_notifier_insert( |
3439 |
++ &tidbuf->notifier, current->mm, |
3440 |
++ tidbuf->vaddr, tidbuf->npages * PAGE_SIZE, |
3441 |
++ &tid_cover_ops); |
3442 |
++ if (ret) |
3443 |
++ goto fail_release_mem; |
3444 |
++ mmu_seq = mmu_interval_read_begin(&tidbuf->notifier); |
3445 |
+ } |
3446 |
+ |
3447 |
+ pinned = pin_rcv_pages(fd, tidbuf); |
3448 |
+ if (pinned <= 0) { |
3449 |
+- kfree(tidbuf->psets); |
3450 |
+- kfree(tidbuf); |
3451 |
+- return pinned; |
3452 |
++ ret = (pinned < 0) ? pinned : -ENOSPC; |
3453 |
++ goto fail_unpin; |
3454 |
+ } |
3455 |
+ |
3456 |
+ /* Find sets of physically contiguous pages */ |
3457 |
+ tidbuf->n_psets = find_phys_blocks(tidbuf, pinned); |
3458 |
+ |
3459 |
+- /* |
3460 |
+- * We don't need to access this under a lock since tid_used is per |
3461 |
+- * process and the same process cannot be in hfi1_user_exp_rcv_clear() |
3462 |
+- * and hfi1_user_exp_rcv_setup() at the same time. |
3463 |
+- */ |
3464 |
++ /* Reserve the number of expected tids to be used. */ |
3465 |
+ spin_lock(&fd->tid_lock); |
3466 |
+ if (fd->tid_used + tidbuf->n_psets > fd->tid_limit) |
3467 |
+ pageset_count = fd->tid_limit - fd->tid_used; |
3468 |
+ else |
3469 |
+ pageset_count = tidbuf->n_psets; |
3470 |
++ fd->tid_used += pageset_count; |
3471 |
+ spin_unlock(&fd->tid_lock); |
3472 |
+ |
3473 |
+- if (!pageset_count) |
3474 |
+- goto bail; |
3475 |
++ if (!pageset_count) { |
3476 |
++ ret = -ENOSPC; |
3477 |
++ goto fail_unreserve; |
3478 |
++ } |
3479 |
+ |
3480 |
+ ngroups = pageset_count / dd->rcv_entries.group_size; |
3481 |
+ tidlist = kcalloc(pageset_count, sizeof(*tidlist), GFP_KERNEL); |
3482 |
+ if (!tidlist) { |
3483 |
+ ret = -ENOMEM; |
3484 |
+- goto nomem; |
3485 |
++ goto fail_unreserve; |
3486 |
+ } |
3487 |
+ |
3488 |
+ tididx = 0; |
3489 |
+@@ -395,43 +414,78 @@ int hfi1_user_exp_rcv_setup(struct hfi1_filedata *fd, |
3490 |
+ } |
3491 |
+ unlock: |
3492 |
+ mutex_unlock(&uctxt->exp_mutex); |
3493 |
+-nomem: |
3494 |
+ hfi1_cdbg(TID, "total mapped: tidpairs:%u pages:%u (%d)", tididx, |
3495 |
+ mapped_pages, ret); |
3496 |
+- if (tididx) { |
3497 |
+- spin_lock(&fd->tid_lock); |
3498 |
+- fd->tid_used += tididx; |
3499 |
+- spin_unlock(&fd->tid_lock); |
3500 |
+- tinfo->tidcnt = tididx; |
3501 |
+- tinfo->length = mapped_pages * PAGE_SIZE; |
3502 |
+- |
3503 |
+- if (copy_to_user(u64_to_user_ptr(tinfo->tidlist), |
3504 |
+- tidlist, sizeof(tidlist[0]) * tididx)) { |
3505 |
+- /* |
3506 |
+- * On failure to copy to the user level, we need to undo |
3507 |
+- * everything done so far so we don't leak resources. |
3508 |
+- */ |
3509 |
+- tinfo->tidlist = (unsigned long)&tidlist; |
3510 |
+- hfi1_user_exp_rcv_clear(fd, tinfo); |
3511 |
+- tinfo->tidlist = 0; |
3512 |
+- ret = -EFAULT; |
3513 |
+- goto bail; |
3514 |
++ |
3515 |
++ /* fail if nothing was programmed, set error if none provided */ |
3516 |
++ if (tididx == 0) { |
3517 |
++ if (ret >= 0) |
3518 |
++ ret = -ENOSPC; |
3519 |
++ goto fail_unreserve; |
3520 |
++ } |
3521 |
++ |
3522 |
++ /* adjust reserved tid_used to actual count */ |
3523 |
++ spin_lock(&fd->tid_lock); |
3524 |
++ fd->tid_used -= pageset_count - tididx; |
3525 |
++ spin_unlock(&fd->tid_lock); |
3526 |
++ |
3527 |
++ /* unpin all pages not covered by a TID */ |
3528 |
++ unpin_rcv_pages(fd, tidbuf, NULL, mapped_pages, pinned - mapped_pages, |
3529 |
++ false); |
3530 |
++ |
3531 |
++ if (fd->use_mn) { |
3532 |
++ /* check for an invalidate during setup */ |
3533 |
++ bool fail = false; |
3534 |
++ |
3535 |
++ mutex_lock(&tidbuf->cover_mutex); |
3536 |
++ fail = mmu_interval_read_retry(&tidbuf->notifier, mmu_seq); |
3537 |
++ mutex_unlock(&tidbuf->cover_mutex); |
3538 |
++ |
3539 |
++ if (fail) { |
3540 |
++ ret = -EBUSY; |
3541 |
++ goto fail_unprogram; |
3542 |
+ } |
3543 |
+ } |
3544 |
+ |
3545 |
+- /* |
3546 |
+- * If not everything was mapped (due to insufficient RcvArray entries, |
3547 |
+- * for example), unpin all unmapped pages so we can pin them nex time. |
3548 |
+- */ |
3549 |
+- if (mapped_pages != pinned) |
3550 |
+- unpin_rcv_pages(fd, tidbuf, NULL, mapped_pages, |
3551 |
+- (pinned - mapped_pages), false); |
3552 |
+-bail: |
3553 |
++ tinfo->tidcnt = tididx; |
3554 |
++ tinfo->length = mapped_pages * PAGE_SIZE; |
3555 |
++ |
3556 |
++ if (copy_to_user(u64_to_user_ptr(tinfo->tidlist), |
3557 |
++ tidlist, sizeof(tidlist[0]) * tididx)) { |
3558 |
++ ret = -EFAULT; |
3559 |
++ goto fail_unprogram; |
3560 |
++ } |
3561 |
++ |
3562 |
++ if (fd->use_mn) |
3563 |
++ mmu_interval_notifier_remove(&tidbuf->notifier); |
3564 |
++ kfree(tidbuf->pages); |
3565 |
+ kfree(tidbuf->psets); |
3566 |
++ kfree(tidbuf); |
3567 |
+ kfree(tidlist); |
3568 |
++ return 0; |
3569 |
++ |
3570 |
++fail_unprogram: |
3571 |
++ /* unprogram, unmap, and unpin all allocated TIDs */ |
3572 |
++ tinfo->tidlist = (unsigned long)tidlist; |
3573 |
++ hfi1_user_exp_rcv_clear(fd, tinfo); |
3574 |
++ tinfo->tidlist = 0; |
3575 |
++ pinned = 0; /* nothing left to unpin */ |
3576 |
++ pageset_count = 0; /* nothing left reserved */ |
3577 |
++fail_unreserve: |
3578 |
++ spin_lock(&fd->tid_lock); |
3579 |
++ fd->tid_used -= pageset_count; |
3580 |
++ spin_unlock(&fd->tid_lock); |
3581 |
++fail_unpin: |
3582 |
++ if (fd->use_mn) |
3583 |
++ mmu_interval_notifier_remove(&tidbuf->notifier); |
3584 |
++ if (pinned > 0) |
3585 |
++ unpin_rcv_pages(fd, tidbuf, NULL, 0, pinned, false); |
3586 |
++fail_release_mem: |
3587 |
+ kfree(tidbuf->pages); |
3588 |
++ kfree(tidbuf->psets); |
3589 |
+ kfree(tidbuf); |
3590 |
+- return ret > 0 ? 0 : ret; |
3591 |
++ kfree(tidlist); |
3592 |
++ return ret; |
3593 |
+ } |
3594 |
+ |
3595 |
+ int hfi1_user_exp_rcv_clear(struct hfi1_filedata *fd, |
3596 |
+@@ -452,7 +506,7 @@ int hfi1_user_exp_rcv_clear(struct hfi1_filedata *fd, |
3597 |
+ |
3598 |
+ mutex_lock(&uctxt->exp_mutex); |
3599 |
+ for (tididx = 0; tididx < tinfo->tidcnt; tididx++) { |
3600 |
+- ret = unprogram_rcvarray(fd, tidinfo[tididx], NULL); |
3601 |
++ ret = unprogram_rcvarray(fd, tidinfo[tididx]); |
3602 |
+ if (ret) { |
3603 |
+ hfi1_cdbg(TID, "Failed to unprogram rcv array %d", |
3604 |
+ ret); |
3605 |
+@@ -707,6 +761,7 @@ static int set_rcvarray_entry(struct hfi1_filedata *fd, |
3606 |
+ } |
3607 |
+ |
3608 |
+ node->fdata = fd; |
3609 |
++ mutex_init(&node->invalidate_mutex); |
3610 |
+ node->phys = page_to_phys(pages[0]); |
3611 |
+ node->npages = npages; |
3612 |
+ node->rcventry = rcventry; |
3613 |
+@@ -722,11 +777,6 @@ static int set_rcvarray_entry(struct hfi1_filedata *fd, |
3614 |
+ &tid_mn_ops); |
3615 |
+ if (ret) |
3616 |
+ goto out_unmap; |
3617 |
+- /* |
3618 |
+- * FIXME: This is in the wrong order, the notifier should be |
3619 |
+- * established before the pages are pinned by pin_rcv_pages. |
3620 |
+- */ |
3621 |
+- mmu_interval_read_begin(&node->notifier); |
3622 |
+ } |
3623 |
+ fd->entry_to_rb[node->rcventry - uctxt->expected_base] = node; |
3624 |
+ |
3625 |
+@@ -746,8 +796,7 @@ out_unmap: |
3626 |
+ return -EFAULT; |
3627 |
+ } |
3628 |
+ |
3629 |
+-static int unprogram_rcvarray(struct hfi1_filedata *fd, u32 tidinfo, |
3630 |
+- struct tid_group **grp) |
3631 |
++static int unprogram_rcvarray(struct hfi1_filedata *fd, u32 tidinfo) |
3632 |
+ { |
3633 |
+ struct hfi1_ctxtdata *uctxt = fd->uctxt; |
3634 |
+ struct hfi1_devdata *dd = uctxt->dd; |
3635 |
+@@ -770,9 +819,6 @@ static int unprogram_rcvarray(struct hfi1_filedata *fd, u32 tidinfo, |
3636 |
+ if (!node || node->rcventry != (uctxt->expected_base + rcventry)) |
3637 |
+ return -EBADF; |
3638 |
+ |
3639 |
+- if (grp) |
3640 |
+- *grp = node->grp; |
3641 |
+- |
3642 |
+ if (fd->use_mn) |
3643 |
+ mmu_interval_notifier_remove(&node->notifier); |
3644 |
+ cacheless_tid_rb_remove(fd, node); |
3645 |
+@@ -780,23 +826,34 @@ static int unprogram_rcvarray(struct hfi1_filedata *fd, u32 tidinfo, |
3646 |
+ return 0; |
3647 |
+ } |
3648 |
+ |
3649 |
+-static void clear_tid_node(struct hfi1_filedata *fd, struct tid_rb_node *node) |
3650 |
++static void __clear_tid_node(struct hfi1_filedata *fd, struct tid_rb_node *node) |
3651 |
+ { |
3652 |
+ struct hfi1_ctxtdata *uctxt = fd->uctxt; |
3653 |
+ struct hfi1_devdata *dd = uctxt->dd; |
3654 |
+ |
3655 |
++ mutex_lock(&node->invalidate_mutex); |
3656 |
++ if (node->freed) |
3657 |
++ goto done; |
3658 |
++ node->freed = true; |
3659 |
++ |
3660 |
+ trace_hfi1_exp_tid_unreg(uctxt->ctxt, fd->subctxt, node->rcventry, |
3661 |
+ node->npages, |
3662 |
+ node->notifier.interval_tree.start, node->phys, |
3663 |
+ node->dma_addr); |
3664 |
+ |
3665 |
+- /* |
3666 |
+- * Make sure device has seen the write before we unpin the |
3667 |
+- * pages. |
3668 |
+- */ |
3669 |
++ /* Make sure device has seen the write before pages are unpinned */ |
3670 |
+ hfi1_put_tid(dd, node->rcventry, PT_INVALID_FLUSH, 0, 0); |
3671 |
+ |
3672 |
+ unpin_rcv_pages(fd, NULL, node, 0, node->npages, true); |
3673 |
++done: |
3674 |
++ mutex_unlock(&node->invalidate_mutex); |
3675 |
++} |
3676 |
++ |
3677 |
++static void clear_tid_node(struct hfi1_filedata *fd, struct tid_rb_node *node) |
3678 |
++{ |
3679 |
++ struct hfi1_ctxtdata *uctxt = fd->uctxt; |
3680 |
++ |
3681 |
++ __clear_tid_node(fd, node); |
3682 |
+ |
3683 |
+ node->grp->used--; |
3684 |
+ node->grp->map &= ~(1 << (node->rcventry - node->grp->base)); |
3685 |
+@@ -855,10 +912,16 @@ static bool tid_rb_invalidate(struct mmu_interval_notifier *mni, |
3686 |
+ if (node->freed) |
3687 |
+ return true; |
3688 |
+ |
3689 |
++ /* take action only if unmapping */ |
3690 |
++ if (range->event != MMU_NOTIFY_UNMAP) |
3691 |
++ return true; |
3692 |
++ |
3693 |
+ trace_hfi1_exp_tid_inval(uctxt->ctxt, fdata->subctxt, |
3694 |
+ node->notifier.interval_tree.start, |
3695 |
+ node->rcventry, node->npages, node->dma_addr); |
3696 |
+- node->freed = true; |
3697 |
++ |
3698 |
++ /* clear the hardware rcvarray entry */ |
3699 |
++ __clear_tid_node(fdata, node); |
3700 |
+ |
3701 |
+ spin_lock(&fdata->invalid_lock); |
3702 |
+ if (fdata->invalid_tid_idx < uctxt->expected_count) { |
3703 |
+@@ -888,6 +951,23 @@ static bool tid_rb_invalidate(struct mmu_interval_notifier *mni, |
3704 |
+ return true; |
3705 |
+ } |
3706 |
+ |
3707 |
++static bool tid_cover_invalidate(struct mmu_interval_notifier *mni, |
3708 |
++ const struct mmu_notifier_range *range, |
3709 |
++ unsigned long cur_seq) |
3710 |
++{ |
3711 |
++ struct tid_user_buf *tidbuf = |
3712 |
++ container_of(mni, struct tid_user_buf, notifier); |
3713 |
++ |
3714 |
++ /* take action only if unmapping */ |
3715 |
++ if (range->event == MMU_NOTIFY_UNMAP) { |
3716 |
++ mutex_lock(&tidbuf->cover_mutex); |
3717 |
++ mmu_interval_set_seq(mni, cur_seq); |
3718 |
++ mutex_unlock(&tidbuf->cover_mutex); |
3719 |
++ } |
3720 |
++ |
3721 |
++ return true; |
3722 |
++} |
3723 |
++ |
3724 |
+ static void cacheless_tid_rb_remove(struct hfi1_filedata *fdata, |
3725 |
+ struct tid_rb_node *tnode) |
3726 |
+ { |
3727 |
+diff --git a/drivers/infiniband/hw/hfi1/user_exp_rcv.h b/drivers/infiniband/hw/hfi1/user_exp_rcv.h |
3728 |
+index 8c53e416bf843..f8ee997d0050e 100644 |
3729 |
+--- a/drivers/infiniband/hw/hfi1/user_exp_rcv.h |
3730 |
++++ b/drivers/infiniband/hw/hfi1/user_exp_rcv.h |
3731 |
+@@ -16,6 +16,8 @@ struct tid_pageset { |
3732 |
+ }; |
3733 |
+ |
3734 |
+ struct tid_user_buf { |
3735 |
++ struct mmu_interval_notifier notifier; |
3736 |
++ struct mutex cover_mutex; |
3737 |
+ unsigned long vaddr; |
3738 |
+ unsigned long length; |
3739 |
+ unsigned int npages; |
3740 |
+@@ -27,6 +29,7 @@ struct tid_user_buf { |
3741 |
+ struct tid_rb_node { |
3742 |
+ struct mmu_interval_notifier notifier; |
3743 |
+ struct hfi1_filedata *fdata; |
3744 |
++ struct mutex invalidate_mutex; /* covers hw removal */ |
3745 |
+ unsigned long phys; |
3746 |
+ struct tid_group *grp; |
3747 |
+ u32 rcventry; |
3748 |
+diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c |
3749 |
+index 973a4c1d5d09f..ffad142801b39 100644 |
3750 |
+--- a/drivers/input/mouse/synaptics.c |
3751 |
++++ b/drivers/input/mouse/synaptics.c |
3752 |
+@@ -191,7 +191,6 @@ static const char * const smbus_pnp_ids[] = { |
3753 |
+ "SYN3221", /* HP 15-ay000 */ |
3754 |
+ "SYN323d", /* HP Spectre X360 13-w013dx */ |
3755 |
+ "SYN3257", /* HP Envy 13-ad105ng */ |
3756 |
+- "SYN3286", /* HP Laptop 15-da3001TU */ |
3757 |
+ NULL |
3758 |
+ }; |
3759 |
+ |
3760 |
+diff --git a/drivers/memory/atmel-sdramc.c b/drivers/memory/atmel-sdramc.c |
3761 |
+index 9c49d00c2a966..ea6e9e1eaf046 100644 |
3762 |
+--- a/drivers/memory/atmel-sdramc.c |
3763 |
++++ b/drivers/memory/atmel-sdramc.c |
3764 |
+@@ -47,19 +47,17 @@ static int atmel_ramc_probe(struct platform_device *pdev) |
3765 |
+ caps = of_device_get_match_data(&pdev->dev); |
3766 |
+ |
3767 |
+ if (caps->has_ddrck) { |
3768 |
+- clk = devm_clk_get(&pdev->dev, "ddrck"); |
3769 |
++ clk = devm_clk_get_enabled(&pdev->dev, "ddrck"); |
3770 |
+ if (IS_ERR(clk)) |
3771 |
+ return PTR_ERR(clk); |
3772 |
+- clk_prepare_enable(clk); |
3773 |
+ } |
3774 |
+ |
3775 |
+ if (caps->has_mpddr_clk) { |
3776 |
+- clk = devm_clk_get(&pdev->dev, "mpddr"); |
3777 |
++ clk = devm_clk_get_enabled(&pdev->dev, "mpddr"); |
3778 |
+ if (IS_ERR(clk)) { |
3779 |
+ pr_err("AT91 RAMC: couldn't get mpddr clock\n"); |
3780 |
+ return PTR_ERR(clk); |
3781 |
+ } |
3782 |
+- clk_prepare_enable(clk); |
3783 |
+ } |
3784 |
+ |
3785 |
+ return 0; |
3786 |
+diff --git a/drivers/memory/mvebu-devbus.c b/drivers/memory/mvebu-devbus.c |
3787 |
+index 8450638e86700..efc6c08db2b70 100644 |
3788 |
+--- a/drivers/memory/mvebu-devbus.c |
3789 |
++++ b/drivers/memory/mvebu-devbus.c |
3790 |
+@@ -280,10 +280,9 @@ static int mvebu_devbus_probe(struct platform_device *pdev) |
3791 |
+ if (IS_ERR(devbus->base)) |
3792 |
+ return PTR_ERR(devbus->base); |
3793 |
+ |
3794 |
+- clk = devm_clk_get(&pdev->dev, NULL); |
3795 |
++ clk = devm_clk_get_enabled(&pdev->dev, NULL); |
3796 |
+ if (IS_ERR(clk)) |
3797 |
+ return PTR_ERR(clk); |
3798 |
+- clk_prepare_enable(clk); |
3799 |
+ |
3800 |
+ /* |
3801 |
+ * Obtain clock period in picoseconds, |
3802 |
+diff --git a/drivers/memory/tegra/tegra186.c b/drivers/memory/tegra/tegra186.c |
3803 |
+index 3d153881abc16..4bed0e54fd456 100644 |
3804 |
+--- a/drivers/memory/tegra/tegra186.c |
3805 |
++++ b/drivers/memory/tegra/tegra186.c |
3806 |
+@@ -20,32 +20,6 @@ |
3807 |
+ #define MC_SID_STREAMID_SECURITY_WRITE_ACCESS_DISABLED BIT(16) |
3808 |
+ #define MC_SID_STREAMID_SECURITY_OVERRIDE BIT(8) |
3809 |
+ |
3810 |
+-static void tegra186_mc_program_sid(struct tegra_mc *mc) |
3811 |
+-{ |
3812 |
+- unsigned int i; |
3813 |
+- |
3814 |
+- for (i = 0; i < mc->soc->num_clients; i++) { |
3815 |
+- const struct tegra_mc_client *client = &mc->soc->clients[i]; |
3816 |
+- u32 override, security; |
3817 |
+- |
3818 |
+- override = readl(mc->regs + client->regs.sid.override); |
3819 |
+- security = readl(mc->regs + client->regs.sid.security); |
3820 |
+- |
3821 |
+- dev_dbg(mc->dev, "client %s: override: %x security: %x\n", |
3822 |
+- client->name, override, security); |
3823 |
+- |
3824 |
+- dev_dbg(mc->dev, "setting SID %u for %s\n", client->sid, |
3825 |
+- client->name); |
3826 |
+- writel(client->sid, mc->regs + client->regs.sid.override); |
3827 |
+- |
3828 |
+- override = readl(mc->regs + client->regs.sid.override); |
3829 |
+- security = readl(mc->regs + client->regs.sid.security); |
3830 |
+- |
3831 |
+- dev_dbg(mc->dev, "client %s: override: %x security: %x\n", |
3832 |
+- client->name, override, security); |
3833 |
+- } |
3834 |
+-} |
3835 |
+- |
3836 |
+ static int tegra186_mc_probe(struct tegra_mc *mc) |
3837 |
+ { |
3838 |
+ int err; |
3839 |
+@@ -54,8 +28,6 @@ static int tegra186_mc_probe(struct tegra_mc *mc) |
3840 |
+ if (err < 0) |
3841 |
+ return err; |
3842 |
+ |
3843 |
+- tegra186_mc_program_sid(mc); |
3844 |
+- |
3845 |
+ return 0; |
3846 |
+ } |
3847 |
+ |
3848 |
+@@ -64,13 +36,6 @@ static void tegra186_mc_remove(struct tegra_mc *mc) |
3849 |
+ of_platform_depopulate(mc->dev); |
3850 |
+ } |
3851 |
+ |
3852 |
+-static int tegra186_mc_resume(struct tegra_mc *mc) |
3853 |
+-{ |
3854 |
+- tegra186_mc_program_sid(mc); |
3855 |
+- |
3856 |
+- return 0; |
3857 |
+-} |
3858 |
+- |
3859 |
+ #if IS_ENABLED(CONFIG_IOMMU_API) |
3860 |
+ static void tegra186_mc_client_sid_override(struct tegra_mc *mc, |
3861 |
+ const struct tegra_mc_client *client, |
3862 |
+@@ -142,7 +107,6 @@ static int tegra186_mc_probe_device(struct tegra_mc *mc, struct device *dev) |
3863 |
+ const struct tegra_mc_ops tegra186_mc_ops = { |
3864 |
+ .probe = tegra186_mc_probe, |
3865 |
+ .remove = tegra186_mc_remove, |
3866 |
+- .resume = tegra186_mc_resume, |
3867 |
+ .probe_device = tegra186_mc_probe_device, |
3868 |
+ }; |
3869 |
+ |
3870 |
+diff --git a/drivers/net/dsa/microchip/ksz9477.c b/drivers/net/dsa/microchip/ksz9477.c |
3871 |
+index 379b38c5844f4..bf788e17f408f 100644 |
3872 |
+--- a/drivers/net/dsa/microchip/ksz9477.c |
3873 |
++++ b/drivers/net/dsa/microchip/ksz9477.c |
3874 |
+@@ -675,10 +675,10 @@ static int ksz9477_port_fdb_del(struct dsa_switch *ds, int port, |
3875 |
+ ksz_read32(dev, REG_SW_ALU_VAL_D, &alu_table[3]); |
3876 |
+ |
3877 |
+ /* clear forwarding port */ |
3878 |
+- alu_table[2] &= ~BIT(port); |
3879 |
++ alu_table[1] &= ~BIT(port); |
3880 |
+ |
3881 |
+ /* if there is no port to forward, clear table */ |
3882 |
+- if ((alu_table[2] & ALU_V_PORT_MAP) == 0) { |
3883 |
++ if ((alu_table[1] & ALU_V_PORT_MAP) == 0) { |
3884 |
+ alu_table[0] = 0; |
3885 |
+ alu_table[1] = 0; |
3886 |
+ alu_table[2] = 0; |
3887 |
+diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-dev.c b/drivers/net/ethernet/amd/xgbe/xgbe-dev.c |
3888 |
+index d5fd49dd25f33..decc1c09a031b 100644 |
3889 |
+--- a/drivers/net/ethernet/amd/xgbe/xgbe-dev.c |
3890 |
++++ b/drivers/net/ethernet/amd/xgbe/xgbe-dev.c |
3891 |
+@@ -524,19 +524,28 @@ static void xgbe_disable_vxlan(struct xgbe_prv_data *pdata) |
3892 |
+ netif_dbg(pdata, drv, pdata->netdev, "VXLAN acceleration disabled\n"); |
3893 |
+ } |
3894 |
+ |
3895 |
++static unsigned int xgbe_get_fc_queue_count(struct xgbe_prv_data *pdata) |
3896 |
++{ |
3897 |
++ unsigned int max_q_count = XGMAC_MAX_FLOW_CONTROL_QUEUES; |
3898 |
++ |
3899 |
++ /* From MAC ver 30H the TFCR is per priority, instead of per queue */ |
3900 |
++ if (XGMAC_GET_BITS(pdata->hw_feat.version, MAC_VR, SNPSVER) >= 0x30) |
3901 |
++ return max_q_count; |
3902 |
++ else |
3903 |
++ return min_t(unsigned int, pdata->tx_q_count, max_q_count); |
3904 |
++} |
3905 |
++ |
3906 |
+ static int xgbe_disable_tx_flow_control(struct xgbe_prv_data *pdata) |
3907 |
+ { |
3908 |
+- unsigned int max_q_count, q_count; |
3909 |
+ unsigned int reg, reg_val; |
3910 |
+- unsigned int i; |
3911 |
++ unsigned int i, q_count; |
3912 |
+ |
3913 |
+ /* Clear MTL flow control */ |
3914 |
+ for (i = 0; i < pdata->rx_q_count; i++) |
3915 |
+ XGMAC_MTL_IOWRITE_BITS(pdata, i, MTL_Q_RQOMR, EHFC, 0); |
3916 |
+ |
3917 |
+ /* Clear MAC flow control */ |
3918 |
+- max_q_count = XGMAC_MAX_FLOW_CONTROL_QUEUES; |
3919 |
+- q_count = min_t(unsigned int, pdata->tx_q_count, max_q_count); |
3920 |
++ q_count = xgbe_get_fc_queue_count(pdata); |
3921 |
+ reg = MAC_Q0TFCR; |
3922 |
+ for (i = 0; i < q_count; i++) { |
3923 |
+ reg_val = XGMAC_IOREAD(pdata, reg); |
3924 |
+@@ -553,9 +562,8 @@ static int xgbe_enable_tx_flow_control(struct xgbe_prv_data *pdata) |
3925 |
+ { |
3926 |
+ struct ieee_pfc *pfc = pdata->pfc; |
3927 |
+ struct ieee_ets *ets = pdata->ets; |
3928 |
+- unsigned int max_q_count, q_count; |
3929 |
+ unsigned int reg, reg_val; |
3930 |
+- unsigned int i; |
3931 |
++ unsigned int i, q_count; |
3932 |
+ |
3933 |
+ /* Set MTL flow control */ |
3934 |
+ for (i = 0; i < pdata->rx_q_count; i++) { |
3935 |
+@@ -579,8 +587,7 @@ static int xgbe_enable_tx_flow_control(struct xgbe_prv_data *pdata) |
3936 |
+ } |
3937 |
+ |
3938 |
+ /* Set MAC flow control */ |
3939 |
+- max_q_count = XGMAC_MAX_FLOW_CONTROL_QUEUES; |
3940 |
+- q_count = min_t(unsigned int, pdata->tx_q_count, max_q_count); |
3941 |
++ q_count = xgbe_get_fc_queue_count(pdata); |
3942 |
+ reg = MAC_Q0TFCR; |
3943 |
+ for (i = 0; i < q_count; i++) { |
3944 |
+ reg_val = XGMAC_IOREAD(pdata, reg); |
3945 |
+diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-mdio.c b/drivers/net/ethernet/amd/xgbe/xgbe-mdio.c |
3946 |
+index 0c5c1b1556830..43fdd111235a6 100644 |
3947 |
+--- a/drivers/net/ethernet/amd/xgbe/xgbe-mdio.c |
3948 |
++++ b/drivers/net/ethernet/amd/xgbe/xgbe-mdio.c |
3949 |
+@@ -496,6 +496,7 @@ static enum xgbe_an xgbe_an73_tx_training(struct xgbe_prv_data *pdata, |
3950 |
+ reg |= XGBE_KR_TRAINING_ENABLE; |
3951 |
+ reg |= XGBE_KR_TRAINING_START; |
3952 |
+ XMDIO_WRITE(pdata, MDIO_MMD_PMAPMD, MDIO_PMA_10GBR_PMD_CTRL, reg); |
3953 |
++ pdata->kr_start_time = jiffies; |
3954 |
+ |
3955 |
+ netif_dbg(pdata, link, pdata->netdev, |
3956 |
+ "KR training initiated\n"); |
3957 |
+@@ -632,6 +633,8 @@ static enum xgbe_an xgbe_an73_incompat_link(struct xgbe_prv_data *pdata) |
3958 |
+ |
3959 |
+ xgbe_switch_mode(pdata); |
3960 |
+ |
3961 |
++ pdata->an_result = XGBE_AN_READY; |
3962 |
++ |
3963 |
+ xgbe_an_restart(pdata); |
3964 |
+ |
3965 |
+ return XGBE_AN_INCOMPAT_LINK; |
3966 |
+@@ -1275,9 +1278,30 @@ static bool xgbe_phy_aneg_done(struct xgbe_prv_data *pdata) |
3967 |
+ static void xgbe_check_link_timeout(struct xgbe_prv_data *pdata) |
3968 |
+ { |
3969 |
+ unsigned long link_timeout; |
3970 |
++ unsigned long kr_time; |
3971 |
++ int wait; |
3972 |
+ |
3973 |
+ link_timeout = pdata->link_check + (XGBE_LINK_TIMEOUT * HZ); |
3974 |
+ if (time_after(jiffies, link_timeout)) { |
3975 |
++ if ((xgbe_cur_mode(pdata) == XGBE_MODE_KR) && |
3976 |
++ pdata->phy.autoneg == AUTONEG_ENABLE) { |
3977 |
++ /* AN restart should not happen while KR training is in progress. |
3978 |
++ * The while loop ensures no AN restart during KR training, |
3979 |
++ * waits up to 500ms and AN restart is triggered only if KR |
3980 |
++ * training is failed. |
3981 |
++ */ |
3982 |
++ wait = XGBE_KR_TRAINING_WAIT_ITER; |
3983 |
++ while (wait--) { |
3984 |
++ kr_time = pdata->kr_start_time + |
3985 |
++ msecs_to_jiffies(XGBE_AN_MS_TIMEOUT); |
3986 |
++ if (time_after(jiffies, kr_time)) |
3987 |
++ break; |
3988 |
++ /* AN restart is not required, if AN result is COMPLETE */ |
3989 |
++ if (pdata->an_result == XGBE_AN_COMPLETE) |
3990 |
++ return; |
3991 |
++ usleep_range(10000, 11000); |
3992 |
++ } |
3993 |
++ } |
3994 |
+ netif_dbg(pdata, link, pdata->netdev, "AN link timeout\n"); |
3995 |
+ xgbe_phy_config_aneg(pdata); |
3996 |
+ } |
3997 |
+diff --git a/drivers/net/ethernet/amd/xgbe/xgbe.h b/drivers/net/ethernet/amd/xgbe/xgbe.h |
3998 |
+index 3305979a9f7c1..e0b8f3c4cc0b2 100644 |
3999 |
+--- a/drivers/net/ethernet/amd/xgbe/xgbe.h |
4000 |
++++ b/drivers/net/ethernet/amd/xgbe/xgbe.h |
4001 |
+@@ -289,6 +289,7 @@ |
4002 |
+ /* Auto-negotiation */ |
4003 |
+ #define XGBE_AN_MS_TIMEOUT 500 |
4004 |
+ #define XGBE_LINK_TIMEOUT 5 |
4005 |
++#define XGBE_KR_TRAINING_WAIT_ITER 50 |
4006 |
+ |
4007 |
+ #define XGBE_SGMII_AN_LINK_STATUS BIT(1) |
4008 |
+ #define XGBE_SGMII_AN_LINK_SPEED (BIT(2) | BIT(3)) |
4009 |
+@@ -1253,6 +1254,7 @@ struct xgbe_prv_data { |
4010 |
+ unsigned int parallel_detect; |
4011 |
+ unsigned int fec_ability; |
4012 |
+ unsigned long an_start; |
4013 |
++ unsigned long kr_start_time; |
4014 |
+ enum xgbe_an_mode an_mode; |
4015 |
+ |
4016 |
+ /* I2C support */ |
4017 |
+diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c |
4018 |
+index 8aab07419263e..50f86bebbc19d 100644 |
4019 |
+--- a/drivers/net/ethernet/broadcom/tg3.c |
4020 |
++++ b/drivers/net/ethernet/broadcom/tg3.c |
4021 |
+@@ -11176,7 +11176,7 @@ static void tg3_reset_task(struct work_struct *work) |
4022 |
+ rtnl_lock(); |
4023 |
+ tg3_full_lock(tp, 0); |
4024 |
+ |
4025 |
+- if (!netif_running(tp->dev)) { |
4026 |
++ if (tp->pcierr_recovery || !netif_running(tp->dev)) { |
4027 |
+ tg3_flag_clear(tp, RESET_TASK_PENDING); |
4028 |
+ tg3_full_unlock(tp); |
4029 |
+ rtnl_unlock(); |
4030 |
+@@ -18111,6 +18111,9 @@ static pci_ers_result_t tg3_io_error_detected(struct pci_dev *pdev, |
4031 |
+ |
4032 |
+ netdev_info(netdev, "PCI I/O error detected\n"); |
4033 |
+ |
4034 |
++ /* Want to make sure that the reset task doesn't run */ |
4035 |
++ tg3_reset_task_cancel(tp); |
4036 |
++ |
4037 |
+ rtnl_lock(); |
4038 |
+ |
4039 |
+ /* Could be second call or maybe we don't have netdev yet */ |
4040 |
+@@ -18127,9 +18130,6 @@ static pci_ers_result_t tg3_io_error_detected(struct pci_dev *pdev, |
4041 |
+ |
4042 |
+ tg3_timer_stop(tp); |
4043 |
+ |
4044 |
+- /* Want to make sure that the reset task doesn't run */ |
4045 |
+- tg3_reset_task_cancel(tp); |
4046 |
+- |
4047 |
+ netif_device_detach(netdev); |
4048 |
+ |
4049 |
+ /* Clean up software state, even if MMIO is blocked */ |
4050 |
+diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c |
4051 |
+index 61efb23504129..906c5bbefaac9 100644 |
4052 |
+--- a/drivers/net/ethernet/cadence/macb_main.c |
4053 |
++++ b/drivers/net/ethernet/cadence/macb_main.c |
4054 |
+@@ -2154,7 +2154,6 @@ static int macb_pad_and_fcs(struct sk_buff **skb, struct net_device *ndev) |
4055 |
+ bool cloned = skb_cloned(*skb) || skb_header_cloned(*skb) || |
4056 |
+ skb_is_nonlinear(*skb); |
4057 |
+ int padlen = ETH_ZLEN - (*skb)->len; |
4058 |
+- int headroom = skb_headroom(*skb); |
4059 |
+ int tailroom = skb_tailroom(*skb); |
4060 |
+ struct sk_buff *nskb; |
4061 |
+ u32 fcs; |
4062 |
+@@ -2168,9 +2167,6 @@ static int macb_pad_and_fcs(struct sk_buff **skb, struct net_device *ndev) |
4063 |
+ /* FCS could be appeded to tailroom. */ |
4064 |
+ if (tailroom >= ETH_FCS_LEN) |
4065 |
+ goto add_fcs; |
4066 |
+- /* FCS could be appeded by moving data to headroom. */ |
4067 |
+- else if (!cloned && headroom + tailroom >= ETH_FCS_LEN) |
4068 |
+- padlen = 0; |
4069 |
+ /* No room for FCS, need to reallocate skb. */ |
4070 |
+ else |
4071 |
+ padlen = ETH_FCS_LEN; |
4072 |
+@@ -2179,10 +2175,7 @@ static int macb_pad_and_fcs(struct sk_buff **skb, struct net_device *ndev) |
4073 |
+ padlen += ETH_FCS_LEN; |
4074 |
+ } |
4075 |
+ |
4076 |
+- if (!cloned && headroom + tailroom >= padlen) { |
4077 |
+- (*skb)->data = memmove((*skb)->head, (*skb)->data, (*skb)->len); |
4078 |
+- skb_set_tail_pointer(*skb, (*skb)->len); |
4079 |
+- } else { |
4080 |
++ if (cloned || tailroom < padlen) { |
4081 |
+ nskb = skb_copy_expand(*skb, 0, padlen, GFP_ATOMIC); |
4082 |
+ if (!nskb) |
4083 |
+ return -ENOMEM; |
4084 |
+diff --git a/drivers/net/ethernet/freescale/enetc/enetc.c b/drivers/net/ethernet/freescale/enetc/enetc.c |
4085 |
+index adccb14c1644e..8b7c93447770c 100644 |
4086 |
+--- a/drivers/net/ethernet/freescale/enetc/enetc.c |
4087 |
++++ b/drivers/net/ethernet/freescale/enetc/enetc.c |
4088 |
+@@ -2000,14 +2000,14 @@ static void enetc_tx_onestep_tstamp(struct work_struct *work) |
4089 |
+ |
4090 |
+ priv = container_of(work, struct enetc_ndev_priv, tx_onestep_tstamp); |
4091 |
+ |
4092 |
+- netif_tx_lock(priv->ndev); |
4093 |
++ netif_tx_lock_bh(priv->ndev); |
4094 |
+ |
4095 |
+ clear_bit_unlock(ENETC_TX_ONESTEP_TSTAMP_IN_PROGRESS, &priv->flags); |
4096 |
+ skb = skb_dequeue(&priv->tx_skbs); |
4097 |
+ if (skb) |
4098 |
+ enetc_start_xmit(skb, priv->ndev); |
4099 |
+ |
4100 |
+- netif_tx_unlock(priv->ndev); |
4101 |
++ netif_tx_unlock_bh(priv->ndev); |
4102 |
+ } |
4103 |
+ |
4104 |
+ static void enetc_tx_onestep_tstamp_init(struct enetc_ndev_priv *priv) |
4105 |
+diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c |
4106 |
+index f6306eedd59b9..2e225309de9ca 100644 |
4107 |
+--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c |
4108 |
++++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c |
4109 |
+@@ -962,7 +962,6 @@ static void otx2_pool_refill_task(struct work_struct *work) |
4110 |
+ rbpool = cq->rbpool; |
4111 |
+ free_ptrs = cq->pool_ptrs; |
4112 |
+ |
4113 |
+- get_cpu(); |
4114 |
+ while (cq->pool_ptrs) { |
4115 |
+ if (otx2_alloc_rbuf(pfvf, rbpool, &bufptr)) { |
4116 |
+ /* Schedule a WQ if we fails to free atleast half of the |
4117 |
+@@ -982,7 +981,6 @@ static void otx2_pool_refill_task(struct work_struct *work) |
4118 |
+ pfvf->hw_ops->aura_freeptr(pfvf, qidx, bufptr + OTX2_HEAD_ROOM); |
4119 |
+ cq->pool_ptrs--; |
4120 |
+ } |
4121 |
+- put_cpu(); |
4122 |
+ cq->refill_task_sched = false; |
4123 |
+ } |
4124 |
+ |
4125 |
+@@ -1316,7 +1314,6 @@ int otx2_sq_aura_pool_init(struct otx2_nic *pfvf) |
4126 |
+ if (err) |
4127 |
+ goto fail; |
4128 |
+ |
4129 |
+- get_cpu(); |
4130 |
+ /* Allocate pointers and free them to aura/pool */ |
4131 |
+ for (qidx = 0; qidx < hw->tx_queues; qidx++) { |
4132 |
+ pool_id = otx2_get_pool_idx(pfvf, AURA_NIX_SQ, qidx); |
4133 |
+@@ -1340,7 +1337,6 @@ int otx2_sq_aura_pool_init(struct otx2_nic *pfvf) |
4134 |
+ } |
4135 |
+ |
4136 |
+ err_mem: |
4137 |
+- put_cpu(); |
4138 |
+ return err ? -ENOMEM : 0; |
4139 |
+ |
4140 |
+ fail: |
4141 |
+@@ -1381,21 +1377,18 @@ int otx2_rq_aura_pool_init(struct otx2_nic *pfvf) |
4142 |
+ if (err) |
4143 |
+ goto fail; |
4144 |
+ |
4145 |
+- get_cpu(); |
4146 |
+ /* Allocate pointers and free them to aura/pool */ |
4147 |
+ for (pool_id = 0; pool_id < hw->rqpool_cnt; pool_id++) { |
4148 |
+ pool = &pfvf->qset.pool[pool_id]; |
4149 |
+ for (ptr = 0; ptr < num_ptrs; ptr++) { |
4150 |
+ err = otx2_alloc_rbuf(pfvf, pool, &bufptr); |
4151 |
+ if (err) |
4152 |
+- goto err_mem; |
4153 |
++ return -ENOMEM; |
4154 |
+ pfvf->hw_ops->aura_freeptr(pfvf, pool_id, |
4155 |
+ bufptr + OTX2_HEAD_ROOM); |
4156 |
+ } |
4157 |
+ } |
4158 |
+-err_mem: |
4159 |
+- put_cpu(); |
4160 |
+- return err ? -ENOMEM : 0; |
4161 |
++ return 0; |
4162 |
+ fail: |
4163 |
+ otx2_mbox_reset(&pfvf->mbox.mbox, 0); |
4164 |
+ otx2_aura_pool_free(pfvf); |
4165 |
+diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h |
4166 |
+index 095e5de78c0b5..e685628b92942 100644 |
4167 |
+--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h |
4168 |
++++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h |
4169 |
+@@ -605,8 +605,10 @@ static inline void cn10k_aura_freeptr(void *dev, int aura, u64 buf) |
4170 |
+ u64 ptrs[2]; |
4171 |
+ |
4172 |
+ ptrs[1] = buf; |
4173 |
++ get_cpu(); |
4174 |
+ /* Free only one buffer at time during init and teardown */ |
4175 |
+ __cn10k_aura_freeptr(pfvf, aura, ptrs, 2); |
4176 |
++ put_cpu(); |
4177 |
+ } |
4178 |
+ |
4179 |
+ /* Alloc pointer from pool/aura */ |
4180 |
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c b/drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c |
4181 |
+index d377ddc70fc70..65c8f1f08472c 100644 |
4182 |
+--- a/drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c |
4183 |
++++ b/drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c |
4184 |
+@@ -22,15 +22,13 @@ struct mlx5_esw_rate_group { |
4185 |
+ }; |
4186 |
+ |
4187 |
+ static int esw_qos_tsar_config(struct mlx5_core_dev *dev, u32 *sched_ctx, |
4188 |
+- u32 parent_ix, u32 tsar_ix, |
4189 |
+- u32 max_rate, u32 bw_share) |
4190 |
++ u32 tsar_ix, u32 max_rate, u32 bw_share) |
4191 |
+ { |
4192 |
+ u32 bitmask = 0; |
4193 |
+ |
4194 |
+ if (!MLX5_CAP_GEN(dev, qos) || !MLX5_CAP_QOS(dev, esw_scheduling)) |
4195 |
+ return -EOPNOTSUPP; |
4196 |
+ |
4197 |
+- MLX5_SET(scheduling_context, sched_ctx, parent_element_id, parent_ix); |
4198 |
+ MLX5_SET(scheduling_context, sched_ctx, max_average_bw, max_rate); |
4199 |
+ MLX5_SET(scheduling_context, sched_ctx, bw_share, bw_share); |
4200 |
+ bitmask |= MODIFY_SCHEDULING_ELEMENT_IN_MODIFY_BITMASK_MAX_AVERAGE_BW; |
4201 |
+@@ -51,7 +49,7 @@ static int esw_qos_group_config(struct mlx5_eswitch *esw, struct mlx5_esw_rate_g |
4202 |
+ int err; |
4203 |
+ |
4204 |
+ err = esw_qos_tsar_config(dev, sched_ctx, |
4205 |
+- esw->qos.root_tsar_ix, group->tsar_ix, |
4206 |
++ group->tsar_ix, |
4207 |
+ max_rate, bw_share); |
4208 |
+ if (err) |
4209 |
+ NL_SET_ERR_MSG_MOD(extack, "E-Switch modify group TSAR element failed"); |
4210 |
+@@ -67,23 +65,13 @@ static int esw_qos_vport_config(struct mlx5_eswitch *esw, |
4211 |
+ struct netlink_ext_ack *extack) |
4212 |
+ { |
4213 |
+ u32 sched_ctx[MLX5_ST_SZ_DW(scheduling_context)] = {}; |
4214 |
+- struct mlx5_esw_rate_group *group = vport->qos.group; |
4215 |
+ struct mlx5_core_dev *dev = esw->dev; |
4216 |
+- u32 parent_tsar_ix; |
4217 |
+- void *vport_elem; |
4218 |
+ int err; |
4219 |
+ |
4220 |
+ if (!vport->qos.enabled) |
4221 |
+ return -EIO; |
4222 |
+ |
4223 |
+- parent_tsar_ix = group ? group->tsar_ix : esw->qos.root_tsar_ix; |
4224 |
+- MLX5_SET(scheduling_context, sched_ctx, element_type, |
4225 |
+- SCHEDULING_CONTEXT_ELEMENT_TYPE_VPORT); |
4226 |
+- vport_elem = MLX5_ADDR_OF(scheduling_context, sched_ctx, |
4227 |
+- element_attributes); |
4228 |
+- MLX5_SET(vport_element, vport_elem, vport_number, vport->vport); |
4229 |
+- |
4230 |
+- err = esw_qos_tsar_config(dev, sched_ctx, parent_tsar_ix, vport->qos.esw_tsar_ix, |
4231 |
++ err = esw_qos_tsar_config(dev, sched_ctx, vport->qos.esw_tsar_ix, |
4232 |
+ max_rate, bw_share); |
4233 |
+ if (err) { |
4234 |
+ esw_warn(esw->dev, |
4235 |
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/ethernet/mellanox/mlx5/core/main.c |
4236 |
+index 145e56f5eeee1..9e15eea9743fe 100644 |
4237 |
+--- a/drivers/net/ethernet/mellanox/mlx5/core/main.c |
4238 |
++++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c |
4239 |
+@@ -1849,7 +1849,7 @@ static void mlx5_core_verify_params(void) |
4240 |
+ } |
4241 |
+ } |
4242 |
+ |
4243 |
+-static int __init init(void) |
4244 |
++static int __init mlx5_init(void) |
4245 |
+ { |
4246 |
+ int err; |
4247 |
+ |
4248 |
+@@ -1885,7 +1885,7 @@ err_debug: |
4249 |
+ return err; |
4250 |
+ } |
4251 |
+ |
4252 |
+-static void __exit cleanup(void) |
4253 |
++static void __exit mlx5_cleanup(void) |
4254 |
+ { |
4255 |
+ mlx5e_cleanup(); |
4256 |
+ mlx5_sf_driver_unregister(); |
4257 |
+@@ -1893,5 +1893,5 @@ static void __exit cleanup(void) |
4258 |
+ mlx5_unregister_debugfs(); |
4259 |
+ } |
4260 |
+ |
4261 |
+-module_init(init); |
4262 |
+-module_exit(cleanup); |
4263 |
++module_init(mlx5_init); |
4264 |
++module_exit(mlx5_cleanup); |
4265 |
+diff --git a/drivers/net/ethernet/microsoft/mana/gdma.h b/drivers/net/ethernet/microsoft/mana/gdma.h |
4266 |
+index 1038bdf28ec08..f74f416a296f6 100644 |
4267 |
+--- a/drivers/net/ethernet/microsoft/mana/gdma.h |
4268 |
++++ b/drivers/net/ethernet/microsoft/mana/gdma.h |
4269 |
+@@ -324,9 +324,12 @@ struct gdma_queue_spec { |
4270 |
+ }; |
4271 |
+ }; |
4272 |
+ |
4273 |
++#define MANA_IRQ_NAME_SZ 32 |
4274 |
++ |
4275 |
+ struct gdma_irq_context { |
4276 |
+ void (*handler)(void *arg); |
4277 |
+ void *arg; |
4278 |
++ char name[MANA_IRQ_NAME_SZ]; |
4279 |
+ }; |
4280 |
+ |
4281 |
+ struct gdma_context { |
4282 |
+diff --git a/drivers/net/ethernet/microsoft/mana/gdma_main.c b/drivers/net/ethernet/microsoft/mana/gdma_main.c |
4283 |
+index f577507f522b7..0fb42193643dc 100644 |
4284 |
+--- a/drivers/net/ethernet/microsoft/mana/gdma_main.c |
4285 |
++++ b/drivers/net/ethernet/microsoft/mana/gdma_main.c |
4286 |
+@@ -1195,13 +1195,20 @@ static int mana_gd_setup_irqs(struct pci_dev *pdev) |
4287 |
+ gic->handler = NULL; |
4288 |
+ gic->arg = NULL; |
4289 |
+ |
4290 |
++ if (!i) |
4291 |
++ snprintf(gic->name, MANA_IRQ_NAME_SZ, "mana_hwc@pci:%s", |
4292 |
++ pci_name(pdev)); |
4293 |
++ else |
4294 |
++ snprintf(gic->name, MANA_IRQ_NAME_SZ, "mana_q%d@pci:%s", |
4295 |
++ i - 1, pci_name(pdev)); |
4296 |
++ |
4297 |
+ irq = pci_irq_vector(pdev, i); |
4298 |
+ if (irq < 0) { |
4299 |
+ err = irq; |
4300 |
+ goto free_irq; |
4301 |
+ } |
4302 |
+ |
4303 |
+- err = request_irq(irq, mana_gd_intr, 0, "mana_intr", gic); |
4304 |
++ err = request_irq(irq, mana_gd_intr, 0, gic->name, gic); |
4305 |
+ if (err) |
4306 |
+ goto free_irq; |
4307 |
+ } |
4308 |
+diff --git a/drivers/net/ethernet/renesas/ravb.h b/drivers/net/ethernet/renesas/ravb.h |
4309 |
+index 47c5377e4f424..a475f54a6b63c 100644 |
4310 |
+--- a/drivers/net/ethernet/renesas/ravb.h |
4311 |
++++ b/drivers/net/ethernet/renesas/ravb.h |
4312 |
+@@ -1000,8 +1000,8 @@ struct ravb_hw_info { |
4313 |
+ unsigned internal_delay:1; /* AVB-DMAC has internal delays */ |
4314 |
+ unsigned tx_counters:1; /* E-MAC has TX counters */ |
4315 |
+ unsigned multi_irqs:1; /* AVB-DMAC and E-MAC has multiple irqs */ |
4316 |
+- unsigned no_ptp_cfg_active:1; /* AVB-DMAC does not support gPTP active in config mode */ |
4317 |
+- unsigned ptp_cfg_active:1; /* AVB-DMAC has gPTP support active in config mode */ |
4318 |
++ unsigned gptp:1; /* AVB-DMAC has gPTP support */ |
4319 |
++ unsigned ccc_gac:1; /* AVB-DMAC has gPTP support active in config mode */ |
4320 |
+ }; |
4321 |
+ |
4322 |
+ struct ravb_private { |
4323 |
+diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c |
4324 |
+index c89bcdd15f164..c6fe1cda7b889 100644 |
4325 |
+--- a/drivers/net/ethernet/renesas/ravb_main.c |
4326 |
++++ b/drivers/net/ethernet/renesas/ravb_main.c |
4327 |
+@@ -792,14 +792,14 @@ static void ravb_error_interrupt(struct net_device *ndev) |
4328 |
+ ravb_write(ndev, ~(EIS_QFS | EIS_RESERVED), EIS); |
4329 |
+ if (eis & EIS_QFS) { |
4330 |
+ ris2 = ravb_read(ndev, RIS2); |
4331 |
+- ravb_write(ndev, ~(RIS2_QFF0 | RIS2_RFFF | RIS2_RESERVED), |
4332 |
++ ravb_write(ndev, ~(RIS2_QFF0 | RIS2_QFF1 | RIS2_RFFF | RIS2_RESERVED), |
4333 |
+ RIS2); |
4334 |
+ |
4335 |
+ /* Receive Descriptor Empty int */ |
4336 |
+ if (ris2 & RIS2_QFF0) |
4337 |
+ priv->stats[RAVB_BE].rx_over_errors++; |
4338 |
+ |
4339 |
+- /* Receive Descriptor Empty int */ |
4340 |
++ /* Receive Descriptor Empty int */ |
4341 |
+ if (ris2 & RIS2_QFF1) |
4342 |
+ priv->stats[RAVB_NC].rx_over_errors++; |
4343 |
+ |
4344 |
+@@ -1275,7 +1275,7 @@ static int ravb_set_ringparam(struct net_device *ndev, |
4345 |
+ if (netif_running(ndev)) { |
4346 |
+ netif_device_detach(ndev); |
4347 |
+ /* Stop PTP Clock driver */ |
4348 |
+- if (info->no_ptp_cfg_active) |
4349 |
++ if (info->gptp) |
4350 |
+ ravb_ptp_stop(ndev); |
4351 |
+ /* Wait for DMA stopping */ |
4352 |
+ error = ravb_stop_dma(ndev); |
4353 |
+@@ -1307,7 +1307,7 @@ static int ravb_set_ringparam(struct net_device *ndev, |
4354 |
+ ravb_emac_init(ndev); |
4355 |
+ |
4356 |
+ /* Initialise PTP Clock driver */ |
4357 |
+- if (info->no_ptp_cfg_active) |
4358 |
++ if (info->gptp) |
4359 |
+ ravb_ptp_init(ndev, priv->pdev); |
4360 |
+ |
4361 |
+ netif_device_attach(ndev); |
4362 |
+@@ -1447,7 +1447,7 @@ static int ravb_open(struct net_device *ndev) |
4363 |
+ ravb_emac_init(ndev); |
4364 |
+ |
4365 |
+ /* Initialise PTP Clock driver */ |
4366 |
+- if (info->no_ptp_cfg_active) |
4367 |
++ if (info->gptp) |
4368 |
+ ravb_ptp_init(ndev, priv->pdev); |
4369 |
+ |
4370 |
+ netif_tx_start_all_queues(ndev); |
4371 |
+@@ -1461,7 +1461,7 @@ static int ravb_open(struct net_device *ndev) |
4372 |
+ |
4373 |
+ out_ptp_stop: |
4374 |
+ /* Stop PTP Clock driver */ |
4375 |
+- if (info->no_ptp_cfg_active) |
4376 |
++ if (info->gptp) |
4377 |
+ ravb_ptp_stop(ndev); |
4378 |
+ out_free_irq_nc_tx: |
4379 |
+ if (!info->multi_irqs) |
4380 |
+@@ -1509,7 +1509,7 @@ static void ravb_tx_timeout_work(struct work_struct *work) |
4381 |
+ netif_tx_stop_all_queues(ndev); |
4382 |
+ |
4383 |
+ /* Stop PTP Clock driver */ |
4384 |
+- if (info->no_ptp_cfg_active) |
4385 |
++ if (info->gptp) |
4386 |
+ ravb_ptp_stop(ndev); |
4387 |
+ |
4388 |
+ /* Wait for DMA stopping */ |
4389 |
+@@ -1544,7 +1544,7 @@ static void ravb_tx_timeout_work(struct work_struct *work) |
4390 |
+ |
4391 |
+ out: |
4392 |
+ /* Initialise PTP Clock driver */ |
4393 |
+- if (info->no_ptp_cfg_active) |
4394 |
++ if (info->gptp) |
4395 |
+ ravb_ptp_init(ndev, priv->pdev); |
4396 |
+ |
4397 |
+ netif_tx_start_all_queues(ndev); |
4398 |
+@@ -1753,7 +1753,7 @@ static int ravb_close(struct net_device *ndev) |
4399 |
+ ravb_write(ndev, 0, TIC); |
4400 |
+ |
4401 |
+ /* Stop PTP Clock driver */ |
4402 |
+- if (info->no_ptp_cfg_active) |
4403 |
++ if (info->gptp) |
4404 |
+ ravb_ptp_stop(ndev); |
4405 |
+ |
4406 |
+ /* Set the config mode to stop the AVB-DMAC's processes */ |
4407 |
+@@ -2019,7 +2019,7 @@ static const struct ravb_hw_info ravb_gen3_hw_info = { |
4408 |
+ .internal_delay = 1, |
4409 |
+ .tx_counters = 1, |
4410 |
+ .multi_irqs = 1, |
4411 |
+- .ptp_cfg_active = 1, |
4412 |
++ .ccc_gac = 1, |
4413 |
+ }; |
4414 |
+ |
4415 |
+ static const struct ravb_hw_info ravb_gen2_hw_info = { |
4416 |
+@@ -2038,7 +2038,7 @@ static const struct ravb_hw_info ravb_gen2_hw_info = { |
4417 |
+ .stats_len = ARRAY_SIZE(ravb_gstrings_stats), |
4418 |
+ .max_rx_len = RX_BUF_SZ + RAVB_ALIGN - 1, |
4419 |
+ .aligned_tx = 1, |
4420 |
+- .no_ptp_cfg_active = 1, |
4421 |
++ .gptp = 1, |
4422 |
+ }; |
4423 |
+ |
4424 |
+ static const struct of_device_id ravb_match_table[] = { |
4425 |
+@@ -2080,7 +2080,7 @@ static void ravb_set_config_mode(struct net_device *ndev) |
4426 |
+ struct ravb_private *priv = netdev_priv(ndev); |
4427 |
+ const struct ravb_hw_info *info = priv->info; |
4428 |
+ |
4429 |
+- if (info->no_ptp_cfg_active) { |
4430 |
++ if (info->gptp) { |
4431 |
+ ravb_modify(ndev, CCC, CCC_OPC, CCC_OPC_CONFIG); |
4432 |
+ /* Set CSEL value */ |
4433 |
+ ravb_modify(ndev, CCC, CCC_CSEL, CCC_CSEL_HPB); |
4434 |
+@@ -2301,7 +2301,7 @@ static int ravb_probe(struct platform_device *pdev) |
4435 |
+ INIT_LIST_HEAD(&priv->ts_skb_list); |
4436 |
+ |
4437 |
+ /* Initialise PTP Clock driver */ |
4438 |
+- if (info->ptp_cfg_active) |
4439 |
++ if (info->ccc_gac) |
4440 |
+ ravb_ptp_init(ndev, pdev); |
4441 |
+ |
4442 |
+ /* Debug message level */ |
4443 |
+@@ -2349,7 +2349,7 @@ out_dma_free: |
4444 |
+ priv->desc_bat_dma); |
4445 |
+ |
4446 |
+ /* Stop PTP Clock driver */ |
4447 |
+- if (info->ptp_cfg_active) |
4448 |
++ if (info->ccc_gac) |
4449 |
+ ravb_ptp_stop(ndev); |
4450 |
+ out_disable_refclk: |
4451 |
+ clk_disable_unprepare(priv->refclk); |
4452 |
+@@ -2369,7 +2369,7 @@ static int ravb_remove(struct platform_device *pdev) |
4453 |
+ const struct ravb_hw_info *info = priv->info; |
4454 |
+ |
4455 |
+ /* Stop PTP Clock driver */ |
4456 |
+- if (info->ptp_cfg_active) |
4457 |
++ if (info->ccc_gac) |
4458 |
+ ravb_ptp_stop(ndev); |
4459 |
+ |
4460 |
+ clk_disable_unprepare(priv->refclk); |
4461 |
+@@ -2446,6 +2446,9 @@ static int __maybe_unused ravb_suspend(struct device *dev) |
4462 |
+ else |
4463 |
+ ret = ravb_close(ndev); |
4464 |
+ |
4465 |
++ if (priv->info->ccc_gac) |
4466 |
++ ravb_ptp_stop(ndev); |
4467 |
++ |
4468 |
+ return ret; |
4469 |
+ } |
4470 |
+ |
4471 |
+@@ -2482,6 +2485,9 @@ static int __maybe_unused ravb_resume(struct device *dev) |
4472 |
+ /* Restore descriptor base address table */ |
4473 |
+ ravb_write(ndev, priv->desc_bat_dma, DBAT); |
4474 |
+ |
4475 |
++ if (priv->info->ccc_gac) |
4476 |
++ ravb_ptp_init(ndev, priv->pdev); |
4477 |
++ |
4478 |
+ if (netif_running(ndev)) { |
4479 |
+ if (priv->wol_enabled) { |
4480 |
+ ret = ravb_wol_restore(ndev); |
4481 |
+diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac5.c b/drivers/net/ethernet/stmicro/stmmac/dwmac5.c |
4482 |
+index 9c2d40f853ed0..413f660172199 100644 |
4483 |
+--- a/drivers/net/ethernet/stmicro/stmmac/dwmac5.c |
4484 |
++++ b/drivers/net/ethernet/stmicro/stmmac/dwmac5.c |
4485 |
+@@ -186,11 +186,25 @@ static void dwmac5_handle_dma_err(struct net_device *ndev, |
4486 |
+ int dwmac5_safety_feat_config(void __iomem *ioaddr, unsigned int asp, |
4487 |
+ struct stmmac_safety_feature_cfg *safety_feat_cfg) |
4488 |
+ { |
4489 |
++ struct stmmac_safety_feature_cfg all_safety_feats = { |
4490 |
++ .tsoee = 1, |
4491 |
++ .mrxpee = 1, |
4492 |
++ .mestee = 1, |
4493 |
++ .mrxee = 1, |
4494 |
++ .mtxee = 1, |
4495 |
++ .epsi = 1, |
4496 |
++ .edpp = 1, |
4497 |
++ .prtyen = 1, |
4498 |
++ .tmouten = 1, |
4499 |
++ }; |
4500 |
+ u32 value; |
4501 |
+ |
4502 |
+ if (!asp) |
4503 |
+ return -EINVAL; |
4504 |
+ |
4505 |
++ if (!safety_feat_cfg) |
4506 |
++ safety_feat_cfg = &all_safety_feats; |
4507 |
++ |
4508 |
+ /* 1. Enable Safety Features */ |
4509 |
+ value = readl(ioaddr + MTL_ECC_CONTROL); |
4510 |
+ value |= MEEAO; /* MTL ECC Error Addr Status Override */ |
4511 |
+diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c |
4512 |
+index dc31501fec8ff..9e8ae4384e4fb 100644 |
4513 |
+--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c |
4514 |
++++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c |
4515 |
+@@ -548,16 +548,16 @@ static void stmmac_get_per_qstats(struct stmmac_priv *priv, u64 *data) |
4516 |
+ p = (char *)priv + offsetof(struct stmmac_priv, |
4517 |
+ xstats.txq_stats[q].tx_pkt_n); |
4518 |
+ for (stat = 0; stat < STMMAC_TXQ_STATS; stat++) { |
4519 |
+- *data++ = (*(u64 *)p); |
4520 |
+- p += sizeof(u64 *); |
4521 |
++ *data++ = (*(unsigned long *)p); |
4522 |
++ p += sizeof(unsigned long); |
4523 |
+ } |
4524 |
+ } |
4525 |
+ for (q = 0; q < rx_cnt; q++) { |
4526 |
+ p = (char *)priv + offsetof(struct stmmac_priv, |
4527 |
+ xstats.rxq_stats[q].rx_pkt_n); |
4528 |
+ for (stat = 0; stat < STMMAC_RXQ_STATS; stat++) { |
4529 |
+- *data++ = (*(u64 *)p); |
4530 |
+- p += sizeof(u64 *); |
4531 |
++ *data++ = (*(unsigned long *)p); |
4532 |
++ p += sizeof(unsigned long); |
4533 |
+ } |
4534 |
+ } |
4535 |
+ } |
4536 |
+diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c |
4537 |
+index 15b0daf416f37..4191502d6472f 100644 |
4538 |
+--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c |
4539 |
++++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c |
4540 |
+@@ -1242,6 +1242,11 @@ static int stmmac_init_phy(struct net_device *dev) |
4541 |
+ int addr = priv->plat->phy_addr; |
4542 |
+ struct phy_device *phydev; |
4543 |
+ |
4544 |
++ if (addr < 0) { |
4545 |
++ netdev_err(priv->dev, "no phy found\n"); |
4546 |
++ return -ENODEV; |
4547 |
++ } |
4548 |
++ |
4549 |
+ phydev = mdiobus_get_phy(priv->mii, addr); |
4550 |
+ if (!phydev) { |
4551 |
+ netdev_err(priv->dev, "no phy at addr %d\n", addr); |
4552 |
+diff --git a/drivers/net/ipa/ipa_interrupt.c b/drivers/net/ipa/ipa_interrupt.c |
4553 |
+index b35170a93b0fa..0c9ff8c055a05 100644 |
4554 |
+--- a/drivers/net/ipa/ipa_interrupt.c |
4555 |
++++ b/drivers/net/ipa/ipa_interrupt.c |
4556 |
+@@ -122,6 +122,16 @@ out_power_put: |
4557 |
+ return IRQ_HANDLED; |
4558 |
+ } |
4559 |
+ |
4560 |
++void ipa_interrupt_irq_disable(struct ipa *ipa) |
4561 |
++{ |
4562 |
++ disable_irq(ipa->interrupt->irq); |
4563 |
++} |
4564 |
++ |
4565 |
++void ipa_interrupt_irq_enable(struct ipa *ipa) |
4566 |
++{ |
4567 |
++ enable_irq(ipa->interrupt->irq); |
4568 |
++} |
4569 |
++ |
4570 |
+ /* Common function used to enable/disable TX_SUSPEND for an endpoint */ |
4571 |
+ static void ipa_interrupt_suspend_control(struct ipa_interrupt *interrupt, |
4572 |
+ u32 endpoint_id, bool enable) |
4573 |
+diff --git a/drivers/net/ipa/ipa_interrupt.h b/drivers/net/ipa/ipa_interrupt.h |
4574 |
+index 231390cea52a2..16aa84ee0094f 100644 |
4575 |
+--- a/drivers/net/ipa/ipa_interrupt.h |
4576 |
++++ b/drivers/net/ipa/ipa_interrupt.h |
4577 |
+@@ -85,6 +85,22 @@ void ipa_interrupt_suspend_clear_all(struct ipa_interrupt *interrupt); |
4578 |
+ */ |
4579 |
+ void ipa_interrupt_simulate_suspend(struct ipa_interrupt *interrupt); |
4580 |
+ |
4581 |
++/** |
4582 |
++ * ipa_interrupt_irq_enable() - Enable IPA interrupts |
4583 |
++ * @ipa: IPA pointer |
4584 |
++ * |
4585 |
++ * This enables the IPA interrupt line |
4586 |
++ */ |
4587 |
++void ipa_interrupt_irq_enable(struct ipa *ipa); |
4588 |
++ |
4589 |
++/** |
4590 |
++ * ipa_interrupt_irq_disable() - Disable IPA interrupts |
4591 |
++ * @ipa: IPA pointer |
4592 |
++ * |
4593 |
++ * This disables the IPA interrupt line |
4594 |
++ */ |
4595 |
++void ipa_interrupt_irq_disable(struct ipa *ipa); |
4596 |
++ |
4597 |
+ /** |
4598 |
+ * ipa_interrupt_config() - Configure the IPA interrupt framework |
4599 |
+ * @ipa: IPA pointer |
4600 |
+diff --git a/drivers/net/ipa/ipa_power.c b/drivers/net/ipa/ipa_power.c |
4601 |
+index f2989aac47a62..07fb367cfc99d 100644 |
4602 |
+--- a/drivers/net/ipa/ipa_power.c |
4603 |
++++ b/drivers/net/ipa/ipa_power.c |
4604 |
+@@ -277,6 +277,17 @@ static int ipa_suspend(struct device *dev) |
4605 |
+ |
4606 |
+ __set_bit(IPA_POWER_FLAG_SYSTEM, ipa->power->flags); |
4607 |
+ |
4608 |
++ /* Increment the disable depth to ensure that the IRQ won't |
4609 |
++ * be re-enabled until the matching _enable call in |
4610 |
++ * ipa_resume(). We do this to ensure that the interrupt |
4611 |
++ * handler won't run whilst PM runtime is disabled. |
4612 |
++ * |
4613 |
++ * Note that disabling the IRQ is NOT the same as disabling |
4614 |
++ * irq wake. If wakeup is enabled for the IPA then the IRQ |
4615 |
++ * will still cause the system to wake up, see irq_set_irq_wake(). |
4616 |
++ */ |
4617 |
++ ipa_interrupt_irq_disable(ipa); |
4618 |
++ |
4619 |
+ return pm_runtime_force_suspend(dev); |
4620 |
+ } |
4621 |
+ |
4622 |
+@@ -289,6 +300,12 @@ static int ipa_resume(struct device *dev) |
4623 |
+ |
4624 |
+ __clear_bit(IPA_POWER_FLAG_SYSTEM, ipa->power->flags); |
4625 |
+ |
4626 |
++ /* Now that PM runtime is enabled again it's safe |
4627 |
++ * to turn the IRQ back on and process any data |
4628 |
++ * that was received during suspend. |
4629 |
++ */ |
4630 |
++ ipa_interrupt_irq_enable(ipa); |
4631 |
++ |
4632 |
+ return ret; |
4633 |
+ } |
4634 |
+ |
4635 |
+diff --git a/drivers/net/mdio/mdio-mux-meson-g12a.c b/drivers/net/mdio/mdio-mux-meson-g12a.c |
4636 |
+index b8866bc3f2e8b..917c8a10eea02 100644 |
4637 |
+--- a/drivers/net/mdio/mdio-mux-meson-g12a.c |
4638 |
++++ b/drivers/net/mdio/mdio-mux-meson-g12a.c |
4639 |
+@@ -4,6 +4,7 @@ |
4640 |
+ */ |
4641 |
+ |
4642 |
+ #include <linux/bitfield.h> |
4643 |
++#include <linux/delay.h> |
4644 |
+ #include <linux/clk.h> |
4645 |
+ #include <linux/clk-provider.h> |
4646 |
+ #include <linux/device.h> |
4647 |
+@@ -150,6 +151,7 @@ static const struct clk_ops g12a_ephy_pll_ops = { |
4648 |
+ |
4649 |
+ static int g12a_enable_internal_mdio(struct g12a_mdio_mux *priv) |
4650 |
+ { |
4651 |
++ u32 value; |
4652 |
+ int ret; |
4653 |
+ |
4654 |
+ /* Enable the phy clock */ |
4655 |
+@@ -163,18 +165,25 @@ static int g12a_enable_internal_mdio(struct g12a_mdio_mux *priv) |
4656 |
+ |
4657 |
+ /* Initialize ephy control */ |
4658 |
+ writel(EPHY_G12A_ID, priv->regs + ETH_PHY_CNTL0); |
4659 |
+- writel(FIELD_PREP(PHY_CNTL1_ST_MODE, 3) | |
4660 |
+- FIELD_PREP(PHY_CNTL1_ST_PHYADD, EPHY_DFLT_ADD) | |
4661 |
+- FIELD_PREP(PHY_CNTL1_MII_MODE, EPHY_MODE_RMII) | |
4662 |
+- PHY_CNTL1_CLK_EN | |
4663 |
+- PHY_CNTL1_CLKFREQ | |
4664 |
+- PHY_CNTL1_PHY_ENB, |
4665 |
+- priv->regs + ETH_PHY_CNTL1); |
4666 |
++ |
4667 |
++ /* Make sure we get a 0 -> 1 transition on the enable bit */ |
4668 |
++ value = FIELD_PREP(PHY_CNTL1_ST_MODE, 3) | |
4669 |
++ FIELD_PREP(PHY_CNTL1_ST_PHYADD, EPHY_DFLT_ADD) | |
4670 |
++ FIELD_PREP(PHY_CNTL1_MII_MODE, EPHY_MODE_RMII) | |
4671 |
++ PHY_CNTL1_CLK_EN | |
4672 |
++ PHY_CNTL1_CLKFREQ; |
4673 |
++ writel(value, priv->regs + ETH_PHY_CNTL1); |
4674 |
+ writel(PHY_CNTL2_USE_INTERNAL | |
4675 |
+ PHY_CNTL2_SMI_SRC_MAC | |
4676 |
+ PHY_CNTL2_RX_CLK_EPHY, |
4677 |
+ priv->regs + ETH_PHY_CNTL2); |
4678 |
+ |
4679 |
++ value |= PHY_CNTL1_PHY_ENB; |
4680 |
++ writel(value, priv->regs + ETH_PHY_CNTL1); |
4681 |
++ |
4682 |
++ /* The phy needs a bit of time to power up */ |
4683 |
++ mdelay(10); |
4684 |
++ |
4685 |
+ return 0; |
4686 |
+ } |
4687 |
+ |
4688 |
+diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c |
4689 |
+index dd7739b5f7918..5f89828fd9f17 100644 |
4690 |
+--- a/drivers/net/phy/mdio_bus.c |
4691 |
++++ b/drivers/net/phy/mdio_bus.c |
4692 |
+@@ -108,7 +108,12 @@ EXPORT_SYMBOL(mdiobus_unregister_device); |
4693 |
+ |
4694 |
+ struct phy_device *mdiobus_get_phy(struct mii_bus *bus, int addr) |
4695 |
+ { |
4696 |
+- struct mdio_device *mdiodev = bus->mdio_map[addr]; |
4697 |
++ struct mdio_device *mdiodev; |
4698 |
++ |
4699 |
++ if (addr < 0 || addr >= ARRAY_SIZE(bus->mdio_map)) |
4700 |
++ return NULL; |
4701 |
++ |
4702 |
++ mdiodev = bus->mdio_map[addr]; |
4703 |
+ |
4704 |
+ if (!mdiodev) |
4705 |
+ return NULL; |
4706 |
+diff --git a/drivers/net/usb/cdc_ether.c b/drivers/net/usb/cdc_ether.c |
4707 |
+index c6b0de1b752f9..3497b5a286ea3 100644 |
4708 |
+--- a/drivers/net/usb/cdc_ether.c |
4709 |
++++ b/drivers/net/usb/cdc_ether.c |
4710 |
+@@ -1000,6 +1000,12 @@ static const struct usb_device_id products[] = { |
4711 |
+ USB_CDC_SUBCLASS_ETHERNET, |
4712 |
+ USB_CDC_PROTO_NONE), |
4713 |
+ .driver_info = (unsigned long)&wwan_info, |
4714 |
++}, { |
4715 |
++ /* Cinterion PLS62-W modem by GEMALTO/THALES */ |
4716 |
++ USB_DEVICE_AND_INTERFACE_INFO(0x1e2d, 0x005b, USB_CLASS_COMM, |
4717 |
++ USB_CDC_SUBCLASS_ETHERNET, |
4718 |
++ USB_CDC_PROTO_NONE), |
4719 |
++ .driver_info = (unsigned long)&wwan_info, |
4720 |
+ }, { |
4721 |
+ /* Cinterion PLS83/PLS63 modem by GEMALTO/THALES */ |
4722 |
+ USB_DEVICE_AND_INTERFACE_INFO(0x1e2d, 0x0069, USB_CLASS_COMM, |
4723 |
+diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c |
4724 |
+index 109c288d8b47a..cf6941b1d2800 100644 |
4725 |
+--- a/drivers/net/usb/r8152.c |
4726 |
++++ b/drivers/net/usb/r8152.c |
4727 |
+@@ -9809,6 +9809,7 @@ static const struct usb_device_id rtl8152_table[] = { |
4728 |
+ REALTEK_USB_DEVICE(VENDOR_ID_MICROSOFT, 0x07ab), |
4729 |
+ REALTEK_USB_DEVICE(VENDOR_ID_MICROSOFT, 0x07c6), |
4730 |
+ REALTEK_USB_DEVICE(VENDOR_ID_MICROSOFT, 0x0927), |
4731 |
++ REALTEK_USB_DEVICE(VENDOR_ID_MICROSOFT, 0x0c5e), |
4732 |
+ REALTEK_USB_DEVICE(VENDOR_ID_SAMSUNG, 0xa101), |
4733 |
+ REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0x304f), |
4734 |
+ REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0x3054), |
4735 |
+diff --git a/drivers/net/usb/sr9700.c b/drivers/net/usb/sr9700.c |
4736 |
+index 0c50f24671da3..1fac6ee273c4e 100644 |
4737 |
+--- a/drivers/net/usb/sr9700.c |
4738 |
++++ b/drivers/net/usb/sr9700.c |
4739 |
+@@ -410,7 +410,7 @@ static int sr9700_rx_fixup(struct usbnet *dev, struct sk_buff *skb) |
4740 |
+ /* ignore the CRC length */ |
4741 |
+ len = (skb->data[1] | (skb->data[2] << 8)) - 4; |
4742 |
+ |
4743 |
+- if (len > ETH_FRAME_LEN || len > skb->len) |
4744 |
++ if (len > ETH_FRAME_LEN || len > skb->len || len < 0) |
4745 |
+ return 0; |
4746 |
+ |
4747 |
+ /* the last packet of current skb */ |
4748 |
+diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c |
4749 |
+index 48fb7bdc0f0b1..9222be208abad 100644 |
4750 |
+--- a/drivers/net/virtio_net.c |
4751 |
++++ b/drivers/net/virtio_net.c |
4752 |
+@@ -1780,8 +1780,10 @@ static netdev_tx_t start_xmit(struct sk_buff *skb, struct net_device *dev) |
4753 |
+ */ |
4754 |
+ if (sq->vq->num_free < 2+MAX_SKB_FRAGS) { |
4755 |
+ netif_stop_subqueue(dev, qnum); |
4756 |
+- if (!use_napi && |
4757 |
+- unlikely(!virtqueue_enable_cb_delayed(sq->vq))) { |
4758 |
++ if (use_napi) { |
4759 |
++ if (unlikely(!virtqueue_enable_cb_delayed(sq->vq))) |
4760 |
++ virtqueue_napi_schedule(&sq->napi, sq->vq); |
4761 |
++ } else if (unlikely(!virtqueue_enable_cb_delayed(sq->vq))) { |
4762 |
+ /* More just got used, free them then recheck. */ |
4763 |
+ free_old_xmit_skbs(sq, false); |
4764 |
+ if (sq->vq->num_free >= 2+MAX_SKB_FRAGS) { |
4765 |
+diff --git a/drivers/net/wan/fsl_ucc_hdlc.c b/drivers/net/wan/fsl_ucc_hdlc.c |
4766 |
+index cda1b4ce6b210..8305df1a3008a 100644 |
4767 |
+--- a/drivers/net/wan/fsl_ucc_hdlc.c |
4768 |
++++ b/drivers/net/wan/fsl_ucc_hdlc.c |
4769 |
+@@ -1241,9 +1241,11 @@ static int ucc_hdlc_probe(struct platform_device *pdev) |
4770 |
+ free_dev: |
4771 |
+ free_netdev(dev); |
4772 |
+ undo_uhdlc_init: |
4773 |
+- iounmap(utdm->siram); |
4774 |
++ if (utdm) |
4775 |
++ iounmap(utdm->siram); |
4776 |
+ unmap_si_regs: |
4777 |
+- iounmap(utdm->si_regs); |
4778 |
++ if (utdm) |
4779 |
++ iounmap(utdm->si_regs); |
4780 |
+ free_utdm: |
4781 |
+ if (uhdlc_priv->tsa) |
4782 |
+ kfree(utdm); |
4783 |
+diff --git a/drivers/net/wireless/rndis_wlan.c b/drivers/net/wireless/rndis_wlan.c |
4784 |
+index 63ce2443f1364..70841d131d724 100644 |
4785 |
+--- a/drivers/net/wireless/rndis_wlan.c |
4786 |
++++ b/drivers/net/wireless/rndis_wlan.c |
4787 |
+@@ -694,8 +694,8 @@ static int rndis_query_oid(struct usbnet *dev, u32 oid, void *data, int *len) |
4788 |
+ struct rndis_query *get; |
4789 |
+ struct rndis_query_c *get_c; |
4790 |
+ } u; |
4791 |
+- int ret, buflen; |
4792 |
+- int resplen, respoffs, copylen; |
4793 |
++ int ret; |
4794 |
++ size_t buflen, resplen, respoffs, copylen; |
4795 |
+ |
4796 |
+ buflen = *len + sizeof(*u.get); |
4797 |
+ if (buflen < CONTROL_BUFFER_SIZE) |
4798 |
+@@ -730,22 +730,15 @@ static int rndis_query_oid(struct usbnet *dev, u32 oid, void *data, int *len) |
4799 |
+ |
4800 |
+ if (respoffs > buflen) { |
4801 |
+ /* Device returned data offset outside buffer, error. */ |
4802 |
+- netdev_dbg(dev->net, "%s(%s): received invalid " |
4803 |
+- "data offset: %d > %d\n", __func__, |
4804 |
+- oid_to_string(oid), respoffs, buflen); |
4805 |
++ netdev_dbg(dev->net, |
4806 |
++ "%s(%s): received invalid data offset: %zu > %zu\n", |
4807 |
++ __func__, oid_to_string(oid), respoffs, buflen); |
4808 |
+ |
4809 |
+ ret = -EINVAL; |
4810 |
+ goto exit_unlock; |
4811 |
+ } |
4812 |
+ |
4813 |
+- if ((resplen + respoffs) > buflen) { |
4814 |
+- /* Device would have returned more data if buffer would |
4815 |
+- * have been big enough. Copy just the bits that we got. |
4816 |
+- */ |
4817 |
+- copylen = buflen - respoffs; |
4818 |
+- } else { |
4819 |
+- copylen = resplen; |
4820 |
+- } |
4821 |
++ copylen = min(resplen, buflen - respoffs); |
4822 |
+ |
4823 |
+ if (copylen > *len) |
4824 |
+ copylen = *len; |
4825 |
+diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c |
4826 |
+index 672f53d5651ad..06750f3d52745 100644 |
4827 |
+--- a/drivers/nvme/host/core.c |
4828 |
++++ b/drivers/nvme/host/core.c |
4829 |
+@@ -1132,7 +1132,7 @@ u32 nvme_command_effects(struct nvme_ctrl *ctrl, struct nvme_ns *ns, u8 opcode) |
4830 |
+ if (ns) { |
4831 |
+ if (ns->head->effects) |
4832 |
+ effects = le32_to_cpu(ns->head->effects->iocs[opcode]); |
4833 |
+- if (ns->head->ids.csi == NVME_CAP_CSS_NVM) |
4834 |
++ if (ns->head->ids.csi == NVME_CSI_NVM) |
4835 |
+ effects |= nvme_known_nvm_effects(opcode); |
4836 |
+ if (effects & ~(NVME_CMD_EFFECTS_CSUPP | NVME_CMD_EFFECTS_LBCC)) |
4837 |
+ dev_warn_once(ctrl->device, |
4838 |
+diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c |
4839 |
+index 0165e65cf5480..00552cd02d732 100644 |
4840 |
+--- a/drivers/nvme/host/pci.c |
4841 |
++++ b/drivers/nvme/host/pci.c |
4842 |
+@@ -1280,7 +1280,7 @@ static enum blk_eh_timer_return nvme_timeout(struct request *req, bool reserved) |
4843 |
+ else |
4844 |
+ nvme_poll_irqdisable(nvmeq); |
4845 |
+ |
4846 |
+- if (blk_mq_request_completed(req)) { |
4847 |
++ if (blk_mq_rq_state(req) != MQ_RQ_IN_FLIGHT) { |
4848 |
+ dev_warn(dev->ctrl.device, |
4849 |
+ "I/O %d QID %d timeout, completion polled\n", |
4850 |
+ req->tag, nvmeq->qid); |
4851 |
+diff --git a/drivers/phy/phy-can-transceiver.c b/drivers/phy/phy-can-transceiver.c |
4852 |
+index c2cb93b4df71c..4525d3fd903a4 100644 |
4853 |
+--- a/drivers/phy/phy-can-transceiver.c |
4854 |
++++ b/drivers/phy/phy-can-transceiver.c |
4855 |
+@@ -87,6 +87,7 @@ static int can_transceiver_phy_probe(struct platform_device *pdev) |
4856 |
+ struct gpio_desc *standby_gpio; |
4857 |
+ struct gpio_desc *enable_gpio; |
4858 |
+ u32 max_bitrate = 0; |
4859 |
++ int err; |
4860 |
+ |
4861 |
+ can_transceiver_phy = devm_kzalloc(dev, sizeof(struct can_transceiver_phy), GFP_KERNEL); |
4862 |
+ if (!can_transceiver_phy) |
4863 |
+@@ -102,8 +103,8 @@ static int can_transceiver_phy_probe(struct platform_device *pdev) |
4864 |
+ return PTR_ERR(phy); |
4865 |
+ } |
4866 |
+ |
4867 |
+- device_property_read_u32(dev, "max-bitrate", &max_bitrate); |
4868 |
+- if (!max_bitrate) |
4869 |
++ err = device_property_read_u32(dev, "max-bitrate", &max_bitrate); |
4870 |
++ if ((err != -EINVAL) && !max_bitrate) |
4871 |
+ dev_warn(dev, "Invalid value for transceiver max bitrate. Ignoring bitrate limit\n"); |
4872 |
+ phy->attrs.max_link_rate = max_bitrate; |
4873 |
+ |
4874 |
+diff --git a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c |
4875 |
+index 4f569d9307b9e..c167b8c5cc860 100644 |
4876 |
+--- a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c |
4877 |
++++ b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c |
4878 |
+@@ -467,8 +467,10 @@ static int rockchip_usb2phy_power_on(struct phy *phy) |
4879 |
+ return ret; |
4880 |
+ |
4881 |
+ ret = property_enable(base, &rport->port_cfg->phy_sus, false); |
4882 |
+- if (ret) |
4883 |
++ if (ret) { |
4884 |
++ clk_disable_unprepare(rphy->clk480m); |
4885 |
+ return ret; |
4886 |
++ } |
4887 |
+ |
4888 |
+ /* waiting for the utmi_clk to become stable */ |
4889 |
+ usleep_range(1500, 2000); |
4890 |
+diff --git a/drivers/phy/ti/Kconfig b/drivers/phy/ti/Kconfig |
4891 |
+index 15a3bcf323086..b905902d57508 100644 |
4892 |
+--- a/drivers/phy/ti/Kconfig |
4893 |
++++ b/drivers/phy/ti/Kconfig |
4894 |
+@@ -23,7 +23,7 @@ config PHY_DM816X_USB |
4895 |
+ |
4896 |
+ config PHY_AM654_SERDES |
4897 |
+ tristate "TI AM654 SERDES support" |
4898 |
+- depends on OF && ARCH_K3 || COMPILE_TEST |
4899 |
++ depends on OF && (ARCH_K3 || COMPILE_TEST) |
4900 |
+ depends on COMMON_CLK |
4901 |
+ select GENERIC_PHY |
4902 |
+ select MULTIPLEXER |
4903 |
+@@ -35,7 +35,7 @@ config PHY_AM654_SERDES |
4904 |
+ |
4905 |
+ config PHY_J721E_WIZ |
4906 |
+ tristate "TI J721E WIZ (SERDES Wrapper) support" |
4907 |
+- depends on OF && ARCH_K3 || COMPILE_TEST |
4908 |
++ depends on OF && (ARCH_K3 || COMPILE_TEST) |
4909 |
+ depends on HAS_IOMEM && OF_ADDRESS |
4910 |
+ depends on COMMON_CLK |
4911 |
+ select GENERIC_PHY |
4912 |
+diff --git a/drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c b/drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c |
4913 |
+index 41136f63014a4..e4a0d16b58cc8 100644 |
4914 |
+--- a/drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c |
4915 |
++++ b/drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c |
4916 |
+@@ -104,12 +104,12 @@ static void npcm_gpio_set(struct gpio_chip *gc, void __iomem *reg, |
4917 |
+ unsigned long flags; |
4918 |
+ unsigned long val; |
4919 |
+ |
4920 |
+- spin_lock_irqsave(&gc->bgpio_lock, flags); |
4921 |
++ raw_spin_lock_irqsave(&gc->bgpio_lock, flags); |
4922 |
+ |
4923 |
+ val = ioread32(reg) | pinmask; |
4924 |
+ iowrite32(val, reg); |
4925 |
+ |
4926 |
+- spin_unlock_irqrestore(&gc->bgpio_lock, flags); |
4927 |
++ raw_spin_unlock_irqrestore(&gc->bgpio_lock, flags); |
4928 |
+ } |
4929 |
+ |
4930 |
+ static void npcm_gpio_clr(struct gpio_chip *gc, void __iomem *reg, |
4931 |
+@@ -118,12 +118,12 @@ static void npcm_gpio_clr(struct gpio_chip *gc, void __iomem *reg, |
4932 |
+ unsigned long flags; |
4933 |
+ unsigned long val; |
4934 |
+ |
4935 |
+- spin_lock_irqsave(&gc->bgpio_lock, flags); |
4936 |
++ raw_spin_lock_irqsave(&gc->bgpio_lock, flags); |
4937 |
+ |
4938 |
+ val = ioread32(reg) & ~pinmask; |
4939 |
+ iowrite32(val, reg); |
4940 |
+ |
4941 |
+- spin_unlock_irqrestore(&gc->bgpio_lock, flags); |
4942 |
++ raw_spin_unlock_irqrestore(&gc->bgpio_lock, flags); |
4943 |
+ } |
4944 |
+ |
4945 |
+ static void npcmgpio_dbg_show(struct seq_file *s, struct gpio_chip *chip) |
4946 |
+diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c |
4947 |
+index 25ec0d22f1842..c33cbf7568db5 100644 |
4948 |
+--- a/drivers/pinctrl/pinctrl-rockchip.c |
4949 |
++++ b/drivers/pinctrl/pinctrl-rockchip.c |
4950 |
+@@ -285,6 +285,7 @@ static int rockchip_dt_node_to_map(struct pinctrl_dev *pctldev, |
4951 |
+ { |
4952 |
+ struct rockchip_pinctrl *info = pinctrl_dev_get_drvdata(pctldev); |
4953 |
+ const struct rockchip_pin_group *grp; |
4954 |
++ struct device *dev = info->dev; |
4955 |
+ struct pinctrl_map *new_map; |
4956 |
+ struct device_node *parent; |
4957 |
+ int map_num = 1; |
4958 |
+@@ -296,8 +297,7 @@ static int rockchip_dt_node_to_map(struct pinctrl_dev *pctldev, |
4959 |
+ */ |
4960 |
+ grp = pinctrl_name_to_group(info, np->name); |
4961 |
+ if (!grp) { |
4962 |
+- dev_err(info->dev, "unable to find group for node %pOFn\n", |
4963 |
+- np); |
4964 |
++ dev_err(dev, "unable to find group for node %pOFn\n", np); |
4965 |
+ return -EINVAL; |
4966 |
+ } |
4967 |
+ |
4968 |
+@@ -331,7 +331,7 @@ static int rockchip_dt_node_to_map(struct pinctrl_dev *pctldev, |
4969 |
+ new_map[i].data.configs.num_configs = grp->data[i].nconfigs; |
4970 |
+ } |
4971 |
+ |
4972 |
+- dev_dbg(pctldev->dev, "maps: function %s group %s num %d\n", |
4973 |
++ dev_dbg(dev, "maps: function %s group %s num %d\n", |
4974 |
+ (*map)->data.mux.function, (*map)->data.mux.group, map_num); |
4975 |
+ |
4976 |
+ return 0; |
4977 |
+@@ -758,19 +758,19 @@ static struct rockchip_mux_route_data rk3568_mux_route_data[] = { |
4978 |
+ RK_MUXROUTE_PMU(0, RK_PB5, 4, 0x0110, WRITE_MASK_VAL(3, 2, 1)), /* PWM1 IO mux M1 */ |
4979 |
+ RK_MUXROUTE_PMU(0, RK_PC1, 1, 0x0110, WRITE_MASK_VAL(5, 4, 0)), /* PWM2 IO mux M0 */ |
4980 |
+ RK_MUXROUTE_PMU(0, RK_PB6, 4, 0x0110, WRITE_MASK_VAL(5, 4, 1)), /* PWM2 IO mux M1 */ |
4981 |
+- RK_MUXROUTE_PMU(0, RK_PB3, 2, 0x0300, WRITE_MASK_VAL(0, 0, 0)), /* CAN0 IO mux M0 */ |
4982 |
++ RK_MUXROUTE_GRF(0, RK_PB3, 2, 0x0300, WRITE_MASK_VAL(0, 0, 0)), /* CAN0 IO mux M0 */ |
4983 |
+ RK_MUXROUTE_GRF(2, RK_PA1, 4, 0x0300, WRITE_MASK_VAL(0, 0, 1)), /* CAN0 IO mux M1 */ |
4984 |
+ RK_MUXROUTE_GRF(1, RK_PA1, 3, 0x0300, WRITE_MASK_VAL(2, 2, 0)), /* CAN1 IO mux M0 */ |
4985 |
+ RK_MUXROUTE_GRF(4, RK_PC3, 3, 0x0300, WRITE_MASK_VAL(2, 2, 1)), /* CAN1 IO mux M1 */ |
4986 |
+ RK_MUXROUTE_GRF(4, RK_PB5, 3, 0x0300, WRITE_MASK_VAL(4, 4, 0)), /* CAN2 IO mux M0 */ |
4987 |
+ RK_MUXROUTE_GRF(2, RK_PB2, 4, 0x0300, WRITE_MASK_VAL(4, 4, 1)), /* CAN2 IO mux M1 */ |
4988 |
+ RK_MUXROUTE_GRF(4, RK_PC4, 1, 0x0300, WRITE_MASK_VAL(6, 6, 0)), /* HPDIN IO mux M0 */ |
4989 |
+- RK_MUXROUTE_PMU(0, RK_PC2, 2, 0x0300, WRITE_MASK_VAL(6, 6, 1)), /* HPDIN IO mux M1 */ |
4990 |
++ RK_MUXROUTE_GRF(0, RK_PC2, 2, 0x0300, WRITE_MASK_VAL(6, 6, 1)), /* HPDIN IO mux M1 */ |
4991 |
+ RK_MUXROUTE_GRF(3, RK_PB1, 3, 0x0300, WRITE_MASK_VAL(8, 8, 0)), /* GMAC1 IO mux M0 */ |
4992 |
+ RK_MUXROUTE_GRF(4, RK_PA7, 3, 0x0300, WRITE_MASK_VAL(8, 8, 1)), /* GMAC1 IO mux M1 */ |
4993 |
+ RK_MUXROUTE_GRF(4, RK_PD1, 1, 0x0300, WRITE_MASK_VAL(10, 10, 0)), /* HDMITX IO mux M0 */ |
4994 |
+- RK_MUXROUTE_PMU(0, RK_PC7, 1, 0x0300, WRITE_MASK_VAL(10, 10, 1)), /* HDMITX IO mux M1 */ |
4995 |
+- RK_MUXROUTE_PMU(0, RK_PB6, 1, 0x0300, WRITE_MASK_VAL(14, 14, 0)), /* I2C2 IO mux M0 */ |
4996 |
++ RK_MUXROUTE_GRF(0, RK_PC7, 1, 0x0300, WRITE_MASK_VAL(10, 10, 1)), /* HDMITX IO mux M1 */ |
4997 |
++ RK_MUXROUTE_GRF(0, RK_PB6, 1, 0x0300, WRITE_MASK_VAL(14, 14, 0)), /* I2C2 IO mux M0 */ |
4998 |
+ RK_MUXROUTE_GRF(4, RK_PB4, 1, 0x0300, WRITE_MASK_VAL(14, 14, 1)), /* I2C2 IO mux M1 */ |
4999 |
+ RK_MUXROUTE_GRF(1, RK_PA0, 1, 0x0304, WRITE_MASK_VAL(0, 0, 0)), /* I2C3 IO mux M0 */ |
5000 |
+ RK_MUXROUTE_GRF(3, RK_PB6, 4, 0x0304, WRITE_MASK_VAL(0, 0, 1)), /* I2C3 IO mux M1 */ |
5001 |
+@@ -796,7 +796,7 @@ static struct rockchip_mux_route_data rk3568_mux_route_data[] = { |
5002 |
+ RK_MUXROUTE_GRF(4, RK_PC3, 1, 0x0308, WRITE_MASK_VAL(12, 12, 1)), /* PWM15 IO mux M1 */ |
5003 |
+ RK_MUXROUTE_GRF(3, RK_PD2, 3, 0x0308, WRITE_MASK_VAL(14, 14, 0)), /* SDMMC2 IO mux M0 */ |
5004 |
+ RK_MUXROUTE_GRF(3, RK_PA5, 5, 0x0308, WRITE_MASK_VAL(14, 14, 1)), /* SDMMC2 IO mux M1 */ |
5005 |
+- RK_MUXROUTE_PMU(0, RK_PB5, 2, 0x030c, WRITE_MASK_VAL(0, 0, 0)), /* SPI0 IO mux M0 */ |
5006 |
++ RK_MUXROUTE_GRF(0, RK_PB5, 2, 0x030c, WRITE_MASK_VAL(0, 0, 0)), /* SPI0 IO mux M0 */ |
5007 |
+ RK_MUXROUTE_GRF(2, RK_PD3, 3, 0x030c, WRITE_MASK_VAL(0, 0, 1)), /* SPI0 IO mux M1 */ |
5008 |
+ RK_MUXROUTE_GRF(2, RK_PB5, 3, 0x030c, WRITE_MASK_VAL(2, 2, 0)), /* SPI1 IO mux M0 */ |
5009 |
+ RK_MUXROUTE_GRF(3, RK_PC3, 3, 0x030c, WRITE_MASK_VAL(2, 2, 1)), /* SPI1 IO mux M1 */ |
5010 |
+@@ -805,8 +805,8 @@ static struct rockchip_mux_route_data rk3568_mux_route_data[] = { |
5011 |
+ RK_MUXROUTE_GRF(4, RK_PB3, 4, 0x030c, WRITE_MASK_VAL(6, 6, 0)), /* SPI3 IO mux M0 */ |
5012 |
+ RK_MUXROUTE_GRF(4, RK_PC2, 2, 0x030c, WRITE_MASK_VAL(6, 6, 1)), /* SPI3 IO mux M1 */ |
5013 |
+ RK_MUXROUTE_GRF(2, RK_PB4, 2, 0x030c, WRITE_MASK_VAL(8, 8, 0)), /* UART1 IO mux M0 */ |
5014 |
+- RK_MUXROUTE_PMU(0, RK_PD1, 1, 0x030c, WRITE_MASK_VAL(8, 8, 1)), /* UART1 IO mux M1 */ |
5015 |
+- RK_MUXROUTE_PMU(0, RK_PD1, 1, 0x030c, WRITE_MASK_VAL(10, 10, 0)), /* UART2 IO mux M0 */ |
5016 |
++ RK_MUXROUTE_GRF(3, RK_PD6, 4, 0x030c, WRITE_MASK_VAL(8, 8, 1)), /* UART1 IO mux M1 */ |
5017 |
++ RK_MUXROUTE_GRF(0, RK_PD1, 1, 0x030c, WRITE_MASK_VAL(10, 10, 0)), /* UART2 IO mux M0 */ |
5018 |
+ RK_MUXROUTE_GRF(1, RK_PD5, 2, 0x030c, WRITE_MASK_VAL(10, 10, 1)), /* UART2 IO mux M1 */ |
5019 |
+ RK_MUXROUTE_GRF(1, RK_PA1, 2, 0x030c, WRITE_MASK_VAL(12, 12, 0)), /* UART3 IO mux M0 */ |
5020 |
+ RK_MUXROUTE_GRF(3, RK_PB7, 4, 0x030c, WRITE_MASK_VAL(12, 12, 1)), /* UART3 IO mux M1 */ |
5021 |
+@@ -836,13 +836,13 @@ static struct rockchip_mux_route_data rk3568_mux_route_data[] = { |
5022 |
+ RK_MUXROUTE_GRF(3, RK_PD6, 5, 0x0314, WRITE_MASK_VAL(1, 0, 1)), /* PDM IO mux M1 */ |
5023 |
+ RK_MUXROUTE_GRF(4, RK_PA0, 4, 0x0314, WRITE_MASK_VAL(1, 0, 1)), /* PDM IO mux M1 */ |
5024 |
+ RK_MUXROUTE_GRF(3, RK_PC4, 5, 0x0314, WRITE_MASK_VAL(1, 0, 2)), /* PDM IO mux M2 */ |
5025 |
+- RK_MUXROUTE_PMU(0, RK_PA5, 3, 0x0314, WRITE_MASK_VAL(3, 2, 0)), /* PCIE20 IO mux M0 */ |
5026 |
++ RK_MUXROUTE_GRF(0, RK_PA5, 3, 0x0314, WRITE_MASK_VAL(3, 2, 0)), /* PCIE20 IO mux M0 */ |
5027 |
+ RK_MUXROUTE_GRF(2, RK_PD0, 4, 0x0314, WRITE_MASK_VAL(3, 2, 1)), /* PCIE20 IO mux M1 */ |
5028 |
+ RK_MUXROUTE_GRF(1, RK_PB0, 4, 0x0314, WRITE_MASK_VAL(3, 2, 2)), /* PCIE20 IO mux M2 */ |
5029 |
+- RK_MUXROUTE_PMU(0, RK_PA4, 3, 0x0314, WRITE_MASK_VAL(5, 4, 0)), /* PCIE30X1 IO mux M0 */ |
5030 |
++ RK_MUXROUTE_GRF(0, RK_PA4, 3, 0x0314, WRITE_MASK_VAL(5, 4, 0)), /* PCIE30X1 IO mux M0 */ |
5031 |
+ RK_MUXROUTE_GRF(2, RK_PD2, 4, 0x0314, WRITE_MASK_VAL(5, 4, 1)), /* PCIE30X1 IO mux M1 */ |
5032 |
+ RK_MUXROUTE_GRF(1, RK_PA5, 4, 0x0314, WRITE_MASK_VAL(5, 4, 2)), /* PCIE30X1 IO mux M2 */ |
5033 |
+- RK_MUXROUTE_PMU(0, RK_PA6, 2, 0x0314, WRITE_MASK_VAL(7, 6, 0)), /* PCIE30X2 IO mux M0 */ |
5034 |
++ RK_MUXROUTE_GRF(0, RK_PA6, 2, 0x0314, WRITE_MASK_VAL(7, 6, 0)), /* PCIE30X2 IO mux M0 */ |
5035 |
+ RK_MUXROUTE_GRF(2, RK_PD4, 4, 0x0314, WRITE_MASK_VAL(7, 6, 1)), /* PCIE30X2 IO mux M1 */ |
5036 |
+ RK_MUXROUTE_GRF(4, RK_PC2, 4, 0x0314, WRITE_MASK_VAL(7, 6, 2)), /* PCIE30X2 IO mux M2 */ |
5037 |
+ }; |
5038 |
+@@ -927,20 +927,20 @@ static int rockchip_verify_mux(struct rockchip_pin_bank *bank, |
5039 |
+ int pin, int mux) |
5040 |
+ { |
5041 |
+ struct rockchip_pinctrl *info = bank->drvdata; |
5042 |
++ struct device *dev = info->dev; |
5043 |
+ int iomux_num = (pin / 8); |
5044 |
+ |
5045 |
+ if (iomux_num > 3) |
5046 |
+ return -EINVAL; |
5047 |
+ |
5048 |
+ if (bank->iomux[iomux_num].type & IOMUX_UNROUTED) { |
5049 |
+- dev_err(info->dev, "pin %d is unrouted\n", pin); |
5050 |
++ dev_err(dev, "pin %d is unrouted\n", pin); |
5051 |
+ return -EINVAL; |
5052 |
+ } |
5053 |
+ |
5054 |
+ if (bank->iomux[iomux_num].type & IOMUX_GPIO_ONLY) { |
5055 |
+ if (mux != RK_FUNC_GPIO) { |
5056 |
+- dev_err(info->dev, |
5057 |
+- "pin %d only supports a gpio mux\n", pin); |
5058 |
++ dev_err(dev, "pin %d only supports a gpio mux\n", pin); |
5059 |
+ return -ENOTSUPP; |
5060 |
+ } |
5061 |
+ } |
5062 |
+@@ -964,6 +964,7 @@ static int rockchip_verify_mux(struct rockchip_pin_bank *bank, |
5063 |
+ static int rockchip_set_mux(struct rockchip_pin_bank *bank, int pin, int mux) |
5064 |
+ { |
5065 |
+ struct rockchip_pinctrl *info = bank->drvdata; |
5066 |
++ struct device *dev = info->dev; |
5067 |
+ int iomux_num = (pin / 8); |
5068 |
+ struct regmap *regmap; |
5069 |
+ int reg, ret, mask, mux_type; |
5070 |
+@@ -977,8 +978,7 @@ static int rockchip_set_mux(struct rockchip_pin_bank *bank, int pin, int mux) |
5071 |
+ if (bank->iomux[iomux_num].type & IOMUX_GPIO_ONLY) |
5072 |
+ return 0; |
5073 |
+ |
5074 |
+- dev_dbg(info->dev, "setting mux of GPIO%d-%d to %d\n", |
5075 |
+- bank->bank_num, pin, mux); |
5076 |
++ dev_dbg(dev, "setting mux of GPIO%d-%d to %d\n", bank->bank_num, pin, mux); |
5077 |
+ |
5078 |
+ regmap = (bank->iomux[iomux_num].type & IOMUX_SOURCE_PMU) |
5079 |
+ ? info->regmap_pmu : info->regmap_base; |
5080 |
+@@ -1039,9 +1039,9 @@ static int rockchip_set_mux(struct rockchip_pin_bank *bank, int pin, int mux) |
5081 |
+ #define PX30_PULL_PINS_PER_REG 8 |
5082 |
+ #define PX30_PULL_BANK_STRIDE 16 |
5083 |
+ |
5084 |
+-static void px30_calc_pull_reg_and_bit(struct rockchip_pin_bank *bank, |
5085 |
+- int pin_num, struct regmap **regmap, |
5086 |
+- int *reg, u8 *bit) |
5087 |
++static int px30_calc_pull_reg_and_bit(struct rockchip_pin_bank *bank, |
5088 |
++ int pin_num, struct regmap **regmap, |
5089 |
++ int *reg, u8 *bit) |
5090 |
+ { |
5091 |
+ struct rockchip_pinctrl *info = bank->drvdata; |
5092 |
+ |
5093 |
+@@ -1061,6 +1061,8 @@ static void px30_calc_pull_reg_and_bit(struct rockchip_pin_bank *bank, |
5094 |
+ *reg += ((pin_num / PX30_PULL_PINS_PER_REG) * 4); |
5095 |
+ *bit = (pin_num % PX30_PULL_PINS_PER_REG); |
5096 |
+ *bit *= PX30_PULL_BITS_PER_PIN; |
5097 |
++ |
5098 |
++ return 0; |
5099 |
+ } |
5100 |
+ |
5101 |
+ #define PX30_DRV_PMU_OFFSET 0x20 |
5102 |
+@@ -1069,9 +1071,9 @@ static void px30_calc_pull_reg_and_bit(struct rockchip_pin_bank *bank, |
5103 |
+ #define PX30_DRV_PINS_PER_REG 8 |
5104 |
+ #define PX30_DRV_BANK_STRIDE 16 |
5105 |
+ |
5106 |
+-static void px30_calc_drv_reg_and_bit(struct rockchip_pin_bank *bank, |
5107 |
+- int pin_num, struct regmap **regmap, |
5108 |
+- int *reg, u8 *bit) |
5109 |
++static int px30_calc_drv_reg_and_bit(struct rockchip_pin_bank *bank, |
5110 |
++ int pin_num, struct regmap **regmap, |
5111 |
++ int *reg, u8 *bit) |
5112 |
+ { |
5113 |
+ struct rockchip_pinctrl *info = bank->drvdata; |
5114 |
+ |
5115 |
+@@ -1091,6 +1093,8 @@ static void px30_calc_drv_reg_and_bit(struct rockchip_pin_bank *bank, |
5116 |
+ *reg += ((pin_num / PX30_DRV_PINS_PER_REG) * 4); |
5117 |
+ *bit = (pin_num % PX30_DRV_PINS_PER_REG); |
5118 |
+ *bit *= PX30_DRV_BITS_PER_PIN; |
5119 |
++ |
5120 |
++ return 0; |
5121 |
+ } |
5122 |
+ |
5123 |
+ #define PX30_SCHMITT_PMU_OFFSET 0x38 |
5124 |
+@@ -1130,9 +1134,9 @@ static int px30_calc_schmitt_reg_and_bit(struct rockchip_pin_bank *bank, |
5125 |
+ #define RV1108_PULL_BITS_PER_PIN 2 |
5126 |
+ #define RV1108_PULL_BANK_STRIDE 16 |
5127 |
+ |
5128 |
+-static void rv1108_calc_pull_reg_and_bit(struct rockchip_pin_bank *bank, |
5129 |
+- int pin_num, struct regmap **regmap, |
5130 |
+- int *reg, u8 *bit) |
5131 |
++static int rv1108_calc_pull_reg_and_bit(struct rockchip_pin_bank *bank, |
5132 |
++ int pin_num, struct regmap **regmap, |
5133 |
++ int *reg, u8 *bit) |
5134 |
+ { |
5135 |
+ struct rockchip_pinctrl *info = bank->drvdata; |
5136 |
+ |
5137 |
+@@ -1151,6 +1155,8 @@ static void rv1108_calc_pull_reg_and_bit(struct rockchip_pin_bank *bank, |
5138 |
+ *reg += ((pin_num / RV1108_PULL_PINS_PER_REG) * 4); |
5139 |
+ *bit = (pin_num % RV1108_PULL_PINS_PER_REG); |
5140 |
+ *bit *= RV1108_PULL_BITS_PER_PIN; |
5141 |
++ |
5142 |
++ return 0; |
5143 |
+ } |
5144 |
+ |
5145 |
+ #define RV1108_DRV_PMU_OFFSET 0x20 |
5146 |
+@@ -1159,9 +1165,9 @@ static void rv1108_calc_pull_reg_and_bit(struct rockchip_pin_bank *bank, |
5147 |
+ #define RV1108_DRV_PINS_PER_REG 8 |
5148 |
+ #define RV1108_DRV_BANK_STRIDE 16 |
5149 |
+ |
5150 |
+-static void rv1108_calc_drv_reg_and_bit(struct rockchip_pin_bank *bank, |
5151 |
+- int pin_num, struct regmap **regmap, |
5152 |
+- int *reg, u8 *bit) |
5153 |
++static int rv1108_calc_drv_reg_and_bit(struct rockchip_pin_bank *bank, |
5154 |
++ int pin_num, struct regmap **regmap, |
5155 |
++ int *reg, u8 *bit) |
5156 |
+ { |
5157 |
+ struct rockchip_pinctrl *info = bank->drvdata; |
5158 |
+ |
5159 |
+@@ -1181,6 +1187,8 @@ static void rv1108_calc_drv_reg_and_bit(struct rockchip_pin_bank *bank, |
5160 |
+ *reg += ((pin_num / RV1108_DRV_PINS_PER_REG) * 4); |
5161 |
+ *bit = pin_num % RV1108_DRV_PINS_PER_REG; |
5162 |
+ *bit *= RV1108_DRV_BITS_PER_PIN; |
5163 |
++ |
5164 |
++ return 0; |
5165 |
+ } |
5166 |
+ |
5167 |
+ #define RV1108_SCHMITT_PMU_OFFSET 0x30 |
5168 |
+@@ -1237,9 +1245,9 @@ static int rk3308_calc_schmitt_reg_and_bit(struct rockchip_pin_bank *bank, |
5169 |
+ #define RK2928_PULL_PINS_PER_REG 16 |
5170 |
+ #define RK2928_PULL_BANK_STRIDE 8 |
5171 |
+ |
5172 |
+-static void rk2928_calc_pull_reg_and_bit(struct rockchip_pin_bank *bank, |
5173 |
+- int pin_num, struct regmap **regmap, |
5174 |
+- int *reg, u8 *bit) |
5175 |
++static int rk2928_calc_pull_reg_and_bit(struct rockchip_pin_bank *bank, |
5176 |
++ int pin_num, struct regmap **regmap, |
5177 |
++ int *reg, u8 *bit) |
5178 |
+ { |
5179 |
+ struct rockchip_pinctrl *info = bank->drvdata; |
5180 |
+ |
5181 |
+@@ -1249,13 +1257,15 @@ static void rk2928_calc_pull_reg_and_bit(struct rockchip_pin_bank *bank, |
5182 |
+ *reg += (pin_num / RK2928_PULL_PINS_PER_REG) * 4; |
5183 |
+ |
5184 |
+ *bit = pin_num % RK2928_PULL_PINS_PER_REG; |
5185 |
++ |
5186 |
++ return 0; |
5187 |
+ }; |
5188 |
+ |
5189 |
+ #define RK3128_PULL_OFFSET 0x118 |
5190 |
+ |
5191 |
+-static void rk3128_calc_pull_reg_and_bit(struct rockchip_pin_bank *bank, |
5192 |
+- int pin_num, struct regmap **regmap, |
5193 |
+- int *reg, u8 *bit) |
5194 |
++static int rk3128_calc_pull_reg_and_bit(struct rockchip_pin_bank *bank, |
5195 |
++ int pin_num, struct regmap **regmap, |
5196 |
++ int *reg, u8 *bit) |
5197 |
+ { |
5198 |
+ struct rockchip_pinctrl *info = bank->drvdata; |
5199 |
+ |
5200 |
+@@ -1265,6 +1275,8 @@ static void rk3128_calc_pull_reg_and_bit(struct rockchip_pin_bank *bank, |
5201 |
+ *reg += ((pin_num / RK2928_PULL_PINS_PER_REG) * 4); |
5202 |
+ |
5203 |
+ *bit = pin_num % RK2928_PULL_PINS_PER_REG; |
5204 |
++ |
5205 |
++ return 0; |
5206 |
+ } |
5207 |
+ |
5208 |
+ #define RK3188_PULL_OFFSET 0x164 |
5209 |
+@@ -1273,9 +1285,9 @@ static void rk3128_calc_pull_reg_and_bit(struct rockchip_pin_bank *bank, |
5210 |
+ #define RK3188_PULL_BANK_STRIDE 16 |
5211 |
+ #define RK3188_PULL_PMU_OFFSET 0x64 |
5212 |
+ |
5213 |
+-static void rk3188_calc_pull_reg_and_bit(struct rockchip_pin_bank *bank, |
5214 |
+- int pin_num, struct regmap **regmap, |
5215 |
+- int *reg, u8 *bit) |
5216 |
++static int rk3188_calc_pull_reg_and_bit(struct rockchip_pin_bank *bank, |
5217 |
++ int pin_num, struct regmap **regmap, |
5218 |
++ int *reg, u8 *bit) |
5219 |
+ { |
5220 |
+ struct rockchip_pinctrl *info = bank->drvdata; |
5221 |
+ |
5222 |
+@@ -1305,12 +1317,14 @@ static void rk3188_calc_pull_reg_and_bit(struct rockchip_pin_bank *bank, |
5223 |
+ *bit = 7 - (pin_num % RK3188_PULL_PINS_PER_REG); |
5224 |
+ *bit *= RK3188_PULL_BITS_PER_PIN; |
5225 |
+ } |
5226 |
++ |
5227 |
++ return 0; |
5228 |
+ } |
5229 |
+ |
5230 |
+ #define RK3288_PULL_OFFSET 0x140 |
5231 |
+-static void rk3288_calc_pull_reg_and_bit(struct rockchip_pin_bank *bank, |
5232 |
+- int pin_num, struct regmap **regmap, |
5233 |
+- int *reg, u8 *bit) |
5234 |
++static int rk3288_calc_pull_reg_and_bit(struct rockchip_pin_bank *bank, |
5235 |
++ int pin_num, struct regmap **regmap, |
5236 |
++ int *reg, u8 *bit) |
5237 |
+ { |
5238 |
+ struct rockchip_pinctrl *info = bank->drvdata; |
5239 |
+ |
5240 |
+@@ -1334,6 +1348,8 @@ static void rk3288_calc_pull_reg_and_bit(struct rockchip_pin_bank *bank, |
5241 |
+ *bit = (pin_num % RK3188_PULL_PINS_PER_REG); |
5242 |
+ *bit *= RK3188_PULL_BITS_PER_PIN; |
5243 |
+ } |
5244 |
++ |
5245 |
++ return 0; |
5246 |
+ } |
5247 |
+ |
5248 |
+ #define RK3288_DRV_PMU_OFFSET 0x70 |
5249 |
+@@ -1342,9 +1358,9 @@ static void rk3288_calc_pull_reg_and_bit(struct rockchip_pin_bank *bank, |
5250 |
+ #define RK3288_DRV_PINS_PER_REG 8 |
5251 |
+ #define RK3288_DRV_BANK_STRIDE 16 |
5252 |
+ |
5253 |
+-static void rk3288_calc_drv_reg_and_bit(struct rockchip_pin_bank *bank, |
5254 |
+- int pin_num, struct regmap **regmap, |
5255 |
+- int *reg, u8 *bit) |
5256 |
++static int rk3288_calc_drv_reg_and_bit(struct rockchip_pin_bank *bank, |
5257 |
++ int pin_num, struct regmap **regmap, |
5258 |
++ int *reg, u8 *bit) |
5259 |
+ { |
5260 |
+ struct rockchip_pinctrl *info = bank->drvdata; |
5261 |
+ |
5262 |
+@@ -1368,13 +1384,15 @@ static void rk3288_calc_drv_reg_and_bit(struct rockchip_pin_bank *bank, |
5263 |
+ *bit = (pin_num % RK3288_DRV_PINS_PER_REG); |
5264 |
+ *bit *= RK3288_DRV_BITS_PER_PIN; |
5265 |
+ } |
5266 |
++ |
5267 |
++ return 0; |
5268 |
+ } |
5269 |
+ |
5270 |
+ #define RK3228_PULL_OFFSET 0x100 |
5271 |
+ |
5272 |
+-static void rk3228_calc_pull_reg_and_bit(struct rockchip_pin_bank *bank, |
5273 |
+- int pin_num, struct regmap **regmap, |
5274 |
+- int *reg, u8 *bit) |
5275 |
++static int rk3228_calc_pull_reg_and_bit(struct rockchip_pin_bank *bank, |
5276 |
++ int pin_num, struct regmap **regmap, |
5277 |
++ int *reg, u8 *bit) |
5278 |
+ { |
5279 |
+ struct rockchip_pinctrl *info = bank->drvdata; |
5280 |
+ |
5281 |
+@@ -1385,13 +1403,15 @@ static void rk3228_calc_pull_reg_and_bit(struct rockchip_pin_bank *bank, |
5282 |
+ |
5283 |
+ *bit = (pin_num % RK3188_PULL_PINS_PER_REG); |
5284 |
+ *bit *= RK3188_PULL_BITS_PER_PIN; |
5285 |
++ |
5286 |
++ return 0; |
5287 |
+ } |
5288 |
+ |
5289 |
+ #define RK3228_DRV_GRF_OFFSET 0x200 |
5290 |
+ |
5291 |
+-static void rk3228_calc_drv_reg_and_bit(struct rockchip_pin_bank *bank, |
5292 |
+- int pin_num, struct regmap **regmap, |
5293 |
+- int *reg, u8 *bit) |
5294 |
++static int rk3228_calc_drv_reg_and_bit(struct rockchip_pin_bank *bank, |
5295 |
++ int pin_num, struct regmap **regmap, |
5296 |
++ int *reg, u8 *bit) |
5297 |
+ { |
5298 |
+ struct rockchip_pinctrl *info = bank->drvdata; |
5299 |
+ |
5300 |
+@@ -1402,13 +1422,15 @@ static void rk3228_calc_drv_reg_and_bit(struct rockchip_pin_bank *bank, |
5301 |
+ |
5302 |
+ *bit = (pin_num % RK3288_DRV_PINS_PER_REG); |
5303 |
+ *bit *= RK3288_DRV_BITS_PER_PIN; |
5304 |
++ |
5305 |
++ return 0; |
5306 |
+ } |
5307 |
+ |
5308 |
+ #define RK3308_PULL_OFFSET 0xa0 |
5309 |
+ |
5310 |
+-static void rk3308_calc_pull_reg_and_bit(struct rockchip_pin_bank *bank, |
5311 |
+- int pin_num, struct regmap **regmap, |
5312 |
+- int *reg, u8 *bit) |
5313 |
++static int rk3308_calc_pull_reg_and_bit(struct rockchip_pin_bank *bank, |
5314 |
++ int pin_num, struct regmap **regmap, |
5315 |
++ int *reg, u8 *bit) |
5316 |
+ { |
5317 |
+ struct rockchip_pinctrl *info = bank->drvdata; |
5318 |
+ |
5319 |
+@@ -1419,13 +1441,15 @@ static void rk3308_calc_pull_reg_and_bit(struct rockchip_pin_bank *bank, |
5320 |
+ |
5321 |
+ *bit = (pin_num % RK3188_PULL_PINS_PER_REG); |
5322 |
+ *bit *= RK3188_PULL_BITS_PER_PIN; |
5323 |
++ |
5324 |
++ return 0; |
5325 |
+ } |
5326 |
+ |
5327 |
+ #define RK3308_DRV_GRF_OFFSET 0x100 |
5328 |
+ |
5329 |
+-static void rk3308_calc_drv_reg_and_bit(struct rockchip_pin_bank *bank, |
5330 |
+- int pin_num, struct regmap **regmap, |
5331 |
+- int *reg, u8 *bit) |
5332 |
++static int rk3308_calc_drv_reg_and_bit(struct rockchip_pin_bank *bank, |
5333 |
++ int pin_num, struct regmap **regmap, |
5334 |
++ int *reg, u8 *bit) |
5335 |
+ { |
5336 |
+ struct rockchip_pinctrl *info = bank->drvdata; |
5337 |
+ |
5338 |
+@@ -1436,14 +1460,16 @@ static void rk3308_calc_drv_reg_and_bit(struct rockchip_pin_bank *bank, |
5339 |
+ |
5340 |
+ *bit = (pin_num % RK3288_DRV_PINS_PER_REG); |
5341 |
+ *bit *= RK3288_DRV_BITS_PER_PIN; |
5342 |
++ |
5343 |
++ return 0; |
5344 |
+ } |
5345 |
+ |
5346 |
+ #define RK3368_PULL_GRF_OFFSET 0x100 |
5347 |
+ #define RK3368_PULL_PMU_OFFSET 0x10 |
5348 |
+ |
5349 |
+-static void rk3368_calc_pull_reg_and_bit(struct rockchip_pin_bank *bank, |
5350 |
+- int pin_num, struct regmap **regmap, |
5351 |
+- int *reg, u8 *bit) |
5352 |
++static int rk3368_calc_pull_reg_and_bit(struct rockchip_pin_bank *bank, |
5353 |
++ int pin_num, struct regmap **regmap, |
5354 |
++ int *reg, u8 *bit) |
5355 |
+ { |
5356 |
+ struct rockchip_pinctrl *info = bank->drvdata; |
5357 |
+ |
5358 |
+@@ -1467,14 +1493,16 @@ static void rk3368_calc_pull_reg_and_bit(struct rockchip_pin_bank *bank, |
5359 |
+ *bit = (pin_num % RK3188_PULL_PINS_PER_REG); |
5360 |
+ *bit *= RK3188_PULL_BITS_PER_PIN; |
5361 |
+ } |
5362 |
++ |
5363 |
++ return 0; |
5364 |
+ } |
5365 |
+ |
5366 |
+ #define RK3368_DRV_PMU_OFFSET 0x20 |
5367 |
+ #define RK3368_DRV_GRF_OFFSET 0x200 |
5368 |
+ |
5369 |
+-static void rk3368_calc_drv_reg_and_bit(struct rockchip_pin_bank *bank, |
5370 |
+- int pin_num, struct regmap **regmap, |
5371 |
+- int *reg, u8 *bit) |
5372 |
++static int rk3368_calc_drv_reg_and_bit(struct rockchip_pin_bank *bank, |
5373 |
++ int pin_num, struct regmap **regmap, |
5374 |
++ int *reg, u8 *bit) |
5375 |
+ { |
5376 |
+ struct rockchip_pinctrl *info = bank->drvdata; |
5377 |
+ |
5378 |
+@@ -1498,15 +1526,17 @@ static void rk3368_calc_drv_reg_and_bit(struct rockchip_pin_bank *bank, |
5379 |
+ *bit = (pin_num % RK3288_DRV_PINS_PER_REG); |
5380 |
+ *bit *= RK3288_DRV_BITS_PER_PIN; |
5381 |
+ } |
5382 |
++ |
5383 |
++ return 0; |
5384 |
+ } |
5385 |
+ |
5386 |
+ #define RK3399_PULL_GRF_OFFSET 0xe040 |
5387 |
+ #define RK3399_PULL_PMU_OFFSET 0x40 |
5388 |
+ #define RK3399_DRV_3BITS_PER_PIN 3 |
5389 |
+ |
5390 |
+-static void rk3399_calc_pull_reg_and_bit(struct rockchip_pin_bank *bank, |
5391 |
+- int pin_num, struct regmap **regmap, |
5392 |
+- int *reg, u8 *bit) |
5393 |
++static int rk3399_calc_pull_reg_and_bit(struct rockchip_pin_bank *bank, |
5394 |
++ int pin_num, struct regmap **regmap, |
5395 |
++ int *reg, u8 *bit) |
5396 |
+ { |
5397 |
+ struct rockchip_pinctrl *info = bank->drvdata; |
5398 |
+ |
5399 |
+@@ -1532,11 +1562,13 @@ static void rk3399_calc_pull_reg_and_bit(struct rockchip_pin_bank *bank, |
5400 |
+ *bit = (pin_num % RK3188_PULL_PINS_PER_REG); |
5401 |
+ *bit *= RK3188_PULL_BITS_PER_PIN; |
5402 |
+ } |
5403 |
++ |
5404 |
++ return 0; |
5405 |
+ } |
5406 |
+ |
5407 |
+-static void rk3399_calc_drv_reg_and_bit(struct rockchip_pin_bank *bank, |
5408 |
+- int pin_num, struct regmap **regmap, |
5409 |
+- int *reg, u8 *bit) |
5410 |
++static int rk3399_calc_drv_reg_and_bit(struct rockchip_pin_bank *bank, |
5411 |
++ int pin_num, struct regmap **regmap, |
5412 |
++ int *reg, u8 *bit) |
5413 |
+ { |
5414 |
+ struct rockchip_pinctrl *info = bank->drvdata; |
5415 |
+ int drv_num = (pin_num / 8); |
5416 |
+@@ -1553,6 +1585,8 @@ static void rk3399_calc_drv_reg_and_bit(struct rockchip_pin_bank *bank, |
5417 |
+ *bit = (pin_num % 8) * 3; |
5418 |
+ else |
5419 |
+ *bit = (pin_num % 8) * 2; |
5420 |
++ |
5421 |
++ return 0; |
5422 |
+ } |
5423 |
+ |
5424 |
+ #define RK3568_PULL_PMU_OFFSET 0x20 |
5425 |
+@@ -1561,9 +1595,9 @@ static void rk3399_calc_drv_reg_and_bit(struct rockchip_pin_bank *bank, |
5426 |
+ #define RK3568_PULL_PINS_PER_REG 8 |
5427 |
+ #define RK3568_PULL_BANK_STRIDE 0x10 |
5428 |
+ |
5429 |
+-static void rk3568_calc_pull_reg_and_bit(struct rockchip_pin_bank *bank, |
5430 |
+- int pin_num, struct regmap **regmap, |
5431 |
+- int *reg, u8 *bit) |
5432 |
++static int rk3568_calc_pull_reg_and_bit(struct rockchip_pin_bank *bank, |
5433 |
++ int pin_num, struct regmap **regmap, |
5434 |
++ int *reg, u8 *bit) |
5435 |
+ { |
5436 |
+ struct rockchip_pinctrl *info = bank->drvdata; |
5437 |
+ |
5438 |
+@@ -1584,6 +1618,8 @@ static void rk3568_calc_pull_reg_and_bit(struct rockchip_pin_bank *bank, |
5439 |
+ *bit = (pin_num % RK3568_PULL_PINS_PER_REG); |
5440 |
+ *bit *= RK3568_PULL_BITS_PER_PIN; |
5441 |
+ } |
5442 |
++ |
5443 |
++ return 0; |
5444 |
+ } |
5445 |
+ |
5446 |
+ #define RK3568_DRV_PMU_OFFSET 0x70 |
5447 |
+@@ -1592,9 +1628,9 @@ static void rk3568_calc_pull_reg_and_bit(struct rockchip_pin_bank *bank, |
5448 |
+ #define RK3568_DRV_PINS_PER_REG 2 |
5449 |
+ #define RK3568_DRV_BANK_STRIDE 0x40 |
5450 |
+ |
5451 |
+-static void rk3568_calc_drv_reg_and_bit(struct rockchip_pin_bank *bank, |
5452 |
+- int pin_num, struct regmap **regmap, |
5453 |
+- int *reg, u8 *bit) |
5454 |
++static int rk3568_calc_drv_reg_and_bit(struct rockchip_pin_bank *bank, |
5455 |
++ int pin_num, struct regmap **regmap, |
5456 |
++ int *reg, u8 *bit) |
5457 |
+ { |
5458 |
+ struct rockchip_pinctrl *info = bank->drvdata; |
5459 |
+ |
5460 |
+@@ -1615,6 +1651,8 @@ static void rk3568_calc_drv_reg_and_bit(struct rockchip_pin_bank *bank, |
5461 |
+ *bit = (pin_num % RK3568_DRV_PINS_PER_REG); |
5462 |
+ *bit *= RK3568_DRV_BITS_PER_PIN; |
5463 |
+ } |
5464 |
++ |
5465 |
++ return 0; |
5466 |
+ } |
5467 |
+ |
5468 |
+ static int rockchip_perpin_drv_list[DRV_TYPE_MAX][8] = { |
5469 |
+@@ -1630,13 +1668,16 @@ static int rockchip_get_drive_perpin(struct rockchip_pin_bank *bank, |
5470 |
+ { |
5471 |
+ struct rockchip_pinctrl *info = bank->drvdata; |
5472 |
+ struct rockchip_pin_ctrl *ctrl = info->ctrl; |
5473 |
++ struct device *dev = info->dev; |
5474 |
+ struct regmap *regmap; |
5475 |
+ int reg, ret; |
5476 |
+ u32 data, temp, rmask_bits; |
5477 |
+ u8 bit; |
5478 |
+ int drv_type = bank->drv[pin_num / 8].drv_type; |
5479 |
+ |
5480 |
+- ctrl->drv_calc_reg(bank, pin_num, ®map, ®, &bit); |
5481 |
++ ret = ctrl->drv_calc_reg(bank, pin_num, ®map, ®, &bit); |
5482 |
++ if (ret) |
5483 |
++ return ret; |
5484 |
+ |
5485 |
+ switch (drv_type) { |
5486 |
+ case DRV_TYPE_IO_1V8_3V0_AUTO: |
5487 |
+@@ -1675,7 +1716,7 @@ static int rockchip_get_drive_perpin(struct rockchip_pin_bank *bank, |
5488 |
+ bit -= 16; |
5489 |
+ break; |
5490 |
+ default: |
5491 |
+- dev_err(info->dev, "unsupported bit: %d for pinctrl drive type: %d\n", |
5492 |
++ dev_err(dev, "unsupported bit: %d for pinctrl drive type: %d\n", |
5493 |
+ bit, drv_type); |
5494 |
+ return -EINVAL; |
5495 |
+ } |
5496 |
+@@ -1687,8 +1728,7 @@ static int rockchip_get_drive_perpin(struct rockchip_pin_bank *bank, |
5497 |
+ rmask_bits = RK3288_DRV_BITS_PER_PIN; |
5498 |
+ break; |
5499 |
+ default: |
5500 |
+- dev_err(info->dev, "unsupported pinctrl drive type: %d\n", |
5501 |
+- drv_type); |
5502 |
++ dev_err(dev, "unsupported pinctrl drive type: %d\n", drv_type); |
5503 |
+ return -EINVAL; |
5504 |
+ } |
5505 |
+ |
5506 |
+@@ -1707,16 +1747,19 @@ static int rockchip_set_drive_perpin(struct rockchip_pin_bank *bank, |
5507 |
+ { |
5508 |
+ struct rockchip_pinctrl *info = bank->drvdata; |
5509 |
+ struct rockchip_pin_ctrl *ctrl = info->ctrl; |
5510 |
++ struct device *dev = info->dev; |
5511 |
+ struct regmap *regmap; |
5512 |
+ int reg, ret, i; |
5513 |
+ u32 data, rmask, rmask_bits, temp; |
5514 |
+ u8 bit; |
5515 |
+ int drv_type = bank->drv[pin_num / 8].drv_type; |
5516 |
+ |
5517 |
+- dev_dbg(info->dev, "setting drive of GPIO%d-%d to %d\n", |
5518 |
++ dev_dbg(dev, "setting drive of GPIO%d-%d to %d\n", |
5519 |
+ bank->bank_num, pin_num, strength); |
5520 |
+ |
5521 |
+- ctrl->drv_calc_reg(bank, pin_num, ®map, ®, &bit); |
5522 |
++ ret = ctrl->drv_calc_reg(bank, pin_num, ®map, ®, &bit); |
5523 |
++ if (ret) |
5524 |
++ return ret; |
5525 |
+ if (ctrl->type == RK3568) { |
5526 |
+ rmask_bits = RK3568_DRV_BITS_PER_PIN; |
5527 |
+ ret = (1 << (strength + 1)) - 1; |
5528 |
+@@ -1735,8 +1778,7 @@ static int rockchip_set_drive_perpin(struct rockchip_pin_bank *bank, |
5529 |
+ } |
5530 |
+ |
5531 |
+ if (ret < 0) { |
5532 |
+- dev_err(info->dev, "unsupported driver strength %d\n", |
5533 |
+- strength); |
5534 |
++ dev_err(dev, "unsupported driver strength %d\n", strength); |
5535 |
+ return ret; |
5536 |
+ } |
5537 |
+ |
5538 |
+@@ -1775,7 +1817,7 @@ static int rockchip_set_drive_perpin(struct rockchip_pin_bank *bank, |
5539 |
+ bit -= 16; |
5540 |
+ break; |
5541 |
+ default: |
5542 |
+- dev_err(info->dev, "unsupported bit: %d for pinctrl drive type: %d\n", |
5543 |
++ dev_err(dev, "unsupported bit: %d for pinctrl drive type: %d\n", |
5544 |
+ bit, drv_type); |
5545 |
+ return -EINVAL; |
5546 |
+ } |
5547 |
+@@ -1786,8 +1828,7 @@ static int rockchip_set_drive_perpin(struct rockchip_pin_bank *bank, |
5548 |
+ rmask_bits = RK3288_DRV_BITS_PER_PIN; |
5549 |
+ break; |
5550 |
+ default: |
5551 |
+- dev_err(info->dev, "unsupported pinctrl drive type: %d\n", |
5552 |
+- drv_type); |
5553 |
++ dev_err(dev, "unsupported pinctrl drive type: %d\n", drv_type); |
5554 |
+ return -EINVAL; |
5555 |
+ } |
5556 |
+ |
5557 |
+@@ -1821,6 +1862,7 @@ static int rockchip_get_pull(struct rockchip_pin_bank *bank, int pin_num) |
5558 |
+ { |
5559 |
+ struct rockchip_pinctrl *info = bank->drvdata; |
5560 |
+ struct rockchip_pin_ctrl *ctrl = info->ctrl; |
5561 |
++ struct device *dev = info->dev; |
5562 |
+ struct regmap *regmap; |
5563 |
+ int reg, ret, pull_type; |
5564 |
+ u8 bit; |
5565 |
+@@ -1830,7 +1872,9 @@ static int rockchip_get_pull(struct rockchip_pin_bank *bank, int pin_num) |
5566 |
+ if (ctrl->type == RK3066B) |
5567 |
+ return PIN_CONFIG_BIAS_DISABLE; |
5568 |
+ |
5569 |
+- ctrl->pull_calc_reg(bank, pin_num, ®map, ®, &bit); |
5570 |
++ ret = ctrl->pull_calc_reg(bank, pin_num, ®map, ®, &bit); |
5571 |
++ if (ret) |
5572 |
++ return ret; |
5573 |
+ |
5574 |
+ ret = regmap_read(regmap, reg, &data); |
5575 |
+ if (ret) |
5576 |
+@@ -1849,13 +1893,22 @@ static int rockchip_get_pull(struct rockchip_pin_bank *bank, int pin_num) |
5577 |
+ case RK3308: |
5578 |
+ case RK3368: |
5579 |
+ case RK3399: |
5580 |
++ case RK3568: |
5581 |
+ pull_type = bank->pull_type[pin_num / 8]; |
5582 |
+ data >>= bit; |
5583 |
+ data &= (1 << RK3188_PULL_BITS_PER_PIN) - 1; |
5584 |
++ /* |
5585 |
++ * In the TRM, pull-up being 1 for everything except the GPIO0_D3-D6, |
5586 |
++ * where that pull up value becomes 3. |
5587 |
++ */ |
5588 |
++ if (ctrl->type == RK3568 && bank->bank_num == 0 && pin_num >= 27 && pin_num <= 30) { |
5589 |
++ if (data == 3) |
5590 |
++ data = 1; |
5591 |
++ } |
5592 |
+ |
5593 |
+ return rockchip_pull_list[pull_type][data]; |
5594 |
+ default: |
5595 |
+- dev_err(info->dev, "unsupported pinctrl type\n"); |
5596 |
++ dev_err(dev, "unsupported pinctrl type\n"); |
5597 |
+ return -EINVAL; |
5598 |
+ }; |
5599 |
+ } |
5600 |
+@@ -1865,19 +1918,21 @@ static int rockchip_set_pull(struct rockchip_pin_bank *bank, |
5601 |
+ { |
5602 |
+ struct rockchip_pinctrl *info = bank->drvdata; |
5603 |
+ struct rockchip_pin_ctrl *ctrl = info->ctrl; |
5604 |
++ struct device *dev = info->dev; |
5605 |
+ struct regmap *regmap; |
5606 |
+ int reg, ret, i, pull_type; |
5607 |
+ u8 bit; |
5608 |
+ u32 data, rmask; |
5609 |
+ |
5610 |
+- dev_dbg(info->dev, "setting pull of GPIO%d-%d to %d\n", |
5611 |
+- bank->bank_num, pin_num, pull); |
5612 |
++ dev_dbg(dev, "setting pull of GPIO%d-%d to %d\n", bank->bank_num, pin_num, pull); |
5613 |
+ |
5614 |
+ /* rk3066b does support any pulls */ |
5615 |
+ if (ctrl->type == RK3066B) |
5616 |
+ return pull ? -EINVAL : 0; |
5617 |
+ |
5618 |
+- ctrl->pull_calc_reg(bank, pin_num, ®map, ®, &bit); |
5619 |
++ ret = ctrl->pull_calc_reg(bank, pin_num, ®map, ®, &bit); |
5620 |
++ if (ret) |
5621 |
++ return ret; |
5622 |
+ |
5623 |
+ switch (ctrl->type) { |
5624 |
+ case RK2928: |
5625 |
+@@ -1905,7 +1960,7 @@ static int rockchip_set_pull(struct rockchip_pin_bank *bank, |
5626 |
+ } |
5627 |
+ } |
5628 |
+ /* |
5629 |
+- * In the TRM, pull-up being 1 for everything except the GPIO0_D0-D6, |
5630 |
++ * In the TRM, pull-up being 1 for everything except the GPIO0_D3-D6, |
5631 |
+ * where that pull up value becomes 3. |
5632 |
+ */ |
5633 |
+ if (ctrl->type == RK3568 && bank->bank_num == 0 && pin_num >= 27 && pin_num <= 30) { |
5634 |
+@@ -1914,8 +1969,7 @@ static int rockchip_set_pull(struct rockchip_pin_bank *bank, |
5635 |
+ } |
5636 |
+ |
5637 |
+ if (ret < 0) { |
5638 |
+- dev_err(info->dev, "unsupported pull setting %d\n", |
5639 |
+- pull); |
5640 |
++ dev_err(dev, "unsupported pull setting %d\n", pull); |
5641 |
+ return ret; |
5642 |
+ } |
5643 |
+ |
5644 |
+@@ -1927,7 +1981,7 @@ static int rockchip_set_pull(struct rockchip_pin_bank *bank, |
5645 |
+ ret = regmap_update_bits(regmap, reg, rmask, data); |
5646 |
+ break; |
5647 |
+ default: |
5648 |
+- dev_err(info->dev, "unsupported pinctrl type\n"); |
5649 |
++ dev_err(dev, "unsupported pinctrl type\n"); |
5650 |
+ return -EINVAL; |
5651 |
+ } |
5652 |
+ |
5653 |
+@@ -2018,12 +2072,13 @@ static int rockchip_set_schmitt(struct rockchip_pin_bank *bank, |
5654 |
+ { |
5655 |
+ struct rockchip_pinctrl *info = bank->drvdata; |
5656 |
+ struct rockchip_pin_ctrl *ctrl = info->ctrl; |
5657 |
++ struct device *dev = info->dev; |
5658 |
+ struct regmap *regmap; |
5659 |
+ int reg, ret; |
5660 |
+ u8 bit; |
5661 |
+ u32 data, rmask; |
5662 |
+ |
5663 |
+- dev_dbg(info->dev, "setting input schmitt of GPIO%d-%d to %d\n", |
5664 |
++ dev_dbg(dev, "setting input schmitt of GPIO%d-%d to %d\n", |
5665 |
+ bank->bank_num, pin_num, enable); |
5666 |
+ |
5667 |
+ ret = ctrl->schmitt_calc_reg(bank, pin_num, ®map, ®, &bit); |
5668 |
+@@ -2083,10 +2138,11 @@ static int rockchip_pmx_set(struct pinctrl_dev *pctldev, unsigned selector, |
5669 |
+ struct rockchip_pinctrl *info = pinctrl_dev_get_drvdata(pctldev); |
5670 |
+ const unsigned int *pins = info->groups[group].pins; |
5671 |
+ const struct rockchip_pin_config *data = info->groups[group].data; |
5672 |
++ struct device *dev = info->dev; |
5673 |
+ struct rockchip_pin_bank *bank; |
5674 |
+ int cnt, ret = 0; |
5675 |
+ |
5676 |
+- dev_dbg(info->dev, "enable function %s group %s\n", |
5677 |
++ dev_dbg(dev, "enable function %s group %s\n", |
5678 |
+ info->functions[selector].name, info->groups[group].name); |
5679 |
+ |
5680 |
+ /* |
5681 |
+@@ -2392,6 +2448,7 @@ static int rockchip_pinctrl_parse_groups(struct device_node *np, |
5682 |
+ struct rockchip_pinctrl *info, |
5683 |
+ u32 index) |
5684 |
+ { |
5685 |
++ struct device *dev = info->dev; |
5686 |
+ struct rockchip_pin_bank *bank; |
5687 |
+ int size; |
5688 |
+ const __be32 *list; |
5689 |
+@@ -2399,7 +2456,7 @@ static int rockchip_pinctrl_parse_groups(struct device_node *np, |
5690 |
+ int i, j; |
5691 |
+ int ret; |
5692 |
+ |
5693 |
+- dev_dbg(info->dev, "group(%d): %pOFn\n", index, np); |
5694 |
++ dev_dbg(dev, "group(%d): %pOFn\n", index, np); |
5695 |
+ |
5696 |
+ /* Initialise group */ |
5697 |
+ grp->name = np->name; |
5698 |
+@@ -2412,18 +2469,14 @@ static int rockchip_pinctrl_parse_groups(struct device_node *np, |
5699 |
+ /* we do not check return since it's safe node passed down */ |
5700 |
+ size /= sizeof(*list); |
5701 |
+ if (!size || size % 4) { |
5702 |
+- dev_err(info->dev, "wrong pins number or pins and configs should be by 4\n"); |
5703 |
++ dev_err(dev, "wrong pins number or pins and configs should be by 4\n"); |
5704 |
+ return -EINVAL; |
5705 |
+ } |
5706 |
+ |
5707 |
+ grp->npins = size / 4; |
5708 |
+ |
5709 |
+- grp->pins = devm_kcalloc(info->dev, grp->npins, sizeof(unsigned int), |
5710 |
+- GFP_KERNEL); |
5711 |
+- grp->data = devm_kcalloc(info->dev, |
5712 |
+- grp->npins, |
5713 |
+- sizeof(struct rockchip_pin_config), |
5714 |
+- GFP_KERNEL); |
5715 |
++ grp->pins = devm_kcalloc(dev, grp->npins, sizeof(*grp->pins), GFP_KERNEL); |
5716 |
++ grp->data = devm_kcalloc(dev, grp->npins, sizeof(*grp->data), GFP_KERNEL); |
5717 |
+ if (!grp->pins || !grp->data) |
5718 |
+ return -ENOMEM; |
5719 |
+ |
5720 |
+@@ -2457,6 +2510,7 @@ static int rockchip_pinctrl_parse_functions(struct device_node *np, |
5721 |
+ struct rockchip_pinctrl *info, |
5722 |
+ u32 index) |
5723 |
+ { |
5724 |
++ struct device *dev = info->dev; |
5725 |
+ struct device_node *child; |
5726 |
+ struct rockchip_pmx_func *func; |
5727 |
+ struct rockchip_pin_group *grp; |
5728 |
+@@ -2464,7 +2518,7 @@ static int rockchip_pinctrl_parse_functions(struct device_node *np, |
5729 |
+ static u32 grp_index; |
5730 |
+ u32 i = 0; |
5731 |
+ |
5732 |
+- dev_dbg(info->dev, "parse function(%d): %pOFn\n", index, np); |
5733 |
++ dev_dbg(dev, "parse function(%d): %pOFn\n", index, np); |
5734 |
+ |
5735 |
+ func = &info->functions[index]; |
5736 |
+ |
5737 |
+@@ -2474,8 +2528,7 @@ static int rockchip_pinctrl_parse_functions(struct device_node *np, |
5738 |
+ if (func->ngroups <= 0) |
5739 |
+ return 0; |
5740 |
+ |
5741 |
+- func->groups = devm_kcalloc(info->dev, |
5742 |
+- func->ngroups, sizeof(char *), GFP_KERNEL); |
5743 |
++ func->groups = devm_kcalloc(dev, func->ngroups, sizeof(*func->groups), GFP_KERNEL); |
5744 |
+ if (!func->groups) |
5745 |
+ return -ENOMEM; |
5746 |
+ |
5747 |
+@@ -2503,20 +2556,14 @@ static int rockchip_pinctrl_parse_dt(struct platform_device *pdev, |
5748 |
+ |
5749 |
+ rockchip_pinctrl_child_count(info, np); |
5750 |
+ |
5751 |
+- dev_dbg(&pdev->dev, "nfunctions = %d\n", info->nfunctions); |
5752 |
+- dev_dbg(&pdev->dev, "ngroups = %d\n", info->ngroups); |
5753 |
++ dev_dbg(dev, "nfunctions = %d\n", info->nfunctions); |
5754 |
++ dev_dbg(dev, "ngroups = %d\n", info->ngroups); |
5755 |
+ |
5756 |
+- info->functions = devm_kcalloc(dev, |
5757 |
+- info->nfunctions, |
5758 |
+- sizeof(struct rockchip_pmx_func), |
5759 |
+- GFP_KERNEL); |
5760 |
++ info->functions = devm_kcalloc(dev, info->nfunctions, sizeof(*info->functions), GFP_KERNEL); |
5761 |
+ if (!info->functions) |
5762 |
+ return -ENOMEM; |
5763 |
+ |
5764 |
+- info->groups = devm_kcalloc(dev, |
5765 |
+- info->ngroups, |
5766 |
+- sizeof(struct rockchip_pin_group), |
5767 |
+- GFP_KERNEL); |
5768 |
++ info->groups = devm_kcalloc(dev, info->ngroups, sizeof(*info->groups), GFP_KERNEL); |
5769 |
+ if (!info->groups) |
5770 |
+ return -ENOMEM; |
5771 |
+ |
5772 |
+@@ -2528,7 +2575,7 @@ static int rockchip_pinctrl_parse_dt(struct platform_device *pdev, |
5773 |
+ |
5774 |
+ ret = rockchip_pinctrl_parse_functions(child, info, i++); |
5775 |
+ if (ret) { |
5776 |
+- dev_err(&pdev->dev, "failed to parse function\n"); |
5777 |
++ dev_err(dev, "failed to parse function\n"); |
5778 |
+ of_node_put(child); |
5779 |
+ return ret; |
5780 |
+ } |
5781 |
+@@ -2543,6 +2590,7 @@ static int rockchip_pinctrl_register(struct platform_device *pdev, |
5782 |
+ struct pinctrl_desc *ctrldesc = &info->pctl; |
5783 |
+ struct pinctrl_pin_desc *pindesc, *pdesc; |
5784 |
+ struct rockchip_pin_bank *pin_bank; |
5785 |
++ struct device *dev = &pdev->dev; |
5786 |
+ int pin, bank, ret; |
5787 |
+ int k; |
5788 |
+ |
5789 |
+@@ -2552,9 +2600,7 @@ static int rockchip_pinctrl_register(struct platform_device *pdev, |
5790 |
+ ctrldesc->pmxops = &rockchip_pmx_ops; |
5791 |
+ ctrldesc->confops = &rockchip_pinconf_ops; |
5792 |
+ |
5793 |
+- pindesc = devm_kcalloc(&pdev->dev, |
5794 |
+- info->ctrl->nr_pins, sizeof(*pindesc), |
5795 |
+- GFP_KERNEL); |
5796 |
++ pindesc = devm_kcalloc(dev, info->ctrl->nr_pins, sizeof(*pindesc), GFP_KERNEL); |
5797 |
+ if (!pindesc) |
5798 |
+ return -ENOMEM; |
5799 |
+ |
5800 |
+@@ -2579,9 +2625,9 @@ static int rockchip_pinctrl_register(struct platform_device *pdev, |
5801 |
+ if (ret) |
5802 |
+ return ret; |
5803 |
+ |
5804 |
+- info->pctl_dev = devm_pinctrl_register(&pdev->dev, ctrldesc, info); |
5805 |
++ info->pctl_dev = devm_pinctrl_register(dev, ctrldesc, info); |
5806 |
+ if (IS_ERR(info->pctl_dev)) { |
5807 |
+- dev_err(&pdev->dev, "could not register pinctrl driver\n"); |
5808 |
++ dev_err(dev, "could not register pinctrl driver\n"); |
5809 |
+ return PTR_ERR(info->pctl_dev); |
5810 |
+ } |
5811 |
+ |
5812 |
+@@ -2595,8 +2641,9 @@ static struct rockchip_pin_ctrl *rockchip_pinctrl_get_soc_data( |
5813 |
+ struct rockchip_pinctrl *d, |
5814 |
+ struct platform_device *pdev) |
5815 |
+ { |
5816 |
++ struct device *dev = &pdev->dev; |
5817 |
++ struct device_node *node = dev->of_node; |
5818 |
+ const struct of_device_id *match; |
5819 |
+- struct device_node *node = pdev->dev.of_node; |
5820 |
+ struct rockchip_pin_ctrl *ctrl; |
5821 |
+ struct rockchip_pin_bank *bank; |
5822 |
+ int grf_offs, pmu_offs, drv_grf_offs, drv_pmu_offs, i, j; |
5823 |
+@@ -2648,7 +2695,7 @@ static struct rockchip_pin_ctrl *rockchip_pinctrl_get_soc_data( |
5824 |
+ drv_pmu_offs : drv_grf_offs; |
5825 |
+ } |
5826 |
+ |
5827 |
+- dev_dbg(d->dev, "bank %d, iomux %d has iom_offset 0x%x drv_offset 0x%x\n", |
5828 |
++ dev_dbg(dev, "bank %d, iomux %d has iom_offset 0x%x drv_offset 0x%x\n", |
5829 |
+ i, j, iom->offset, drv->offset); |
5830 |
+ |
5831 |
+ /* |
5832 |
+@@ -2757,8 +2804,8 @@ static int rockchip_pinctrl_probe(struct platform_device *pdev) |
5833 |
+ { |
5834 |
+ struct rockchip_pinctrl *info; |
5835 |
+ struct device *dev = &pdev->dev; |
5836 |
++ struct device_node *np = dev->of_node, *node; |
5837 |
+ struct rockchip_pin_ctrl *ctrl; |
5838 |
+- struct device_node *np = pdev->dev.of_node, *node; |
5839 |
+ struct resource *res; |
5840 |
+ void __iomem *base; |
5841 |
+ int ret; |
5842 |
+@@ -2795,8 +2842,8 @@ static int rockchip_pinctrl_probe(struct platform_device *pdev) |
5843 |
+ |
5844 |
+ rockchip_regmap_config.max_register = resource_size(res) - 4; |
5845 |
+ rockchip_regmap_config.name = "rockchip,pinctrl"; |
5846 |
+- info->regmap_base = devm_regmap_init_mmio(&pdev->dev, base, |
5847 |
+- &rockchip_regmap_config); |
5848 |
++ info->regmap_base = |
5849 |
++ devm_regmap_init_mmio(dev, base, &rockchip_regmap_config); |
5850 |
+ |
5851 |
+ /* to check for the old dt-bindings */ |
5852 |
+ info->reg_size = resource_size(res); |
5853 |
+@@ -2808,12 +2855,10 @@ static int rockchip_pinctrl_probe(struct platform_device *pdev) |
5854 |
+ if (IS_ERR(base)) |
5855 |
+ return PTR_ERR(base); |
5856 |
+ |
5857 |
+- rockchip_regmap_config.max_register = |
5858 |
+- resource_size(res) - 4; |
5859 |
++ rockchip_regmap_config.max_register = resource_size(res) - 4; |
5860 |
+ rockchip_regmap_config.name = "rockchip,pinctrl-pull"; |
5861 |
+- info->regmap_pull = devm_regmap_init_mmio(&pdev->dev, |
5862 |
+- base, |
5863 |
+- &rockchip_regmap_config); |
5864 |
++ info->regmap_pull = |
5865 |
++ devm_regmap_init_mmio(dev, base, &rockchip_regmap_config); |
5866 |
+ } |
5867 |
+ } |
5868 |
+ |
5869 |
+@@ -2834,7 +2879,7 @@ static int rockchip_pinctrl_probe(struct platform_device *pdev) |
5870 |
+ |
5871 |
+ ret = of_platform_populate(np, NULL, NULL, &pdev->dev); |
5872 |
+ if (ret) { |
5873 |
+- dev_err(&pdev->dev, "failed to register gpio device\n"); |
5874 |
++ dev_err(dev, "failed to register gpio device\n"); |
5875 |
+ return ret; |
5876 |
+ } |
5877 |
+ |
5878 |
+diff --git a/drivers/pinctrl/pinctrl-rockchip.h b/drivers/pinctrl/pinctrl-rockchip.h |
5879 |
+index 98a01a616da67..59116e13758d0 100644 |
5880 |
+--- a/drivers/pinctrl/pinctrl-rockchip.h |
5881 |
++++ b/drivers/pinctrl/pinctrl-rockchip.h |
5882 |
+@@ -230,10 +230,10 @@ struct rockchip_pin_ctrl { |
5883 |
+ struct rockchip_mux_route_data *iomux_routes; |
5884 |
+ u32 niomux_routes; |
5885 |
+ |
5886 |
+- void (*pull_calc_reg)(struct rockchip_pin_bank *bank, |
5887 |
++ int (*pull_calc_reg)(struct rockchip_pin_bank *bank, |
5888 |
+ int pin_num, struct regmap **regmap, |
5889 |
+ int *reg, u8 *bit); |
5890 |
+- void (*drv_calc_reg)(struct rockchip_pin_bank *bank, |
5891 |
++ int (*drv_calc_reg)(struct rockchip_pin_bank *bank, |
5892 |
+ int pin_num, struct regmap **regmap, |
5893 |
+ int *reg, u8 *bit); |
5894 |
+ int (*schmitt_calc_reg)(struct rockchip_pin_bank *bank, |
5895 |
+diff --git a/drivers/platform/x86/asus-nb-wmi.c b/drivers/platform/x86/asus-nb-wmi.c |
5896 |
+index a81dc4b191b77..4d7327b67a7db 100644 |
5897 |
+--- a/drivers/platform/x86/asus-nb-wmi.c |
5898 |
++++ b/drivers/platform/x86/asus-nb-wmi.c |
5899 |
+@@ -521,6 +521,7 @@ static const struct key_entry asus_nb_wmi_keymap[] = { |
5900 |
+ { KE_KEY, 0x30, { KEY_VOLUMEUP } }, |
5901 |
+ { KE_KEY, 0x31, { KEY_VOLUMEDOWN } }, |
5902 |
+ { KE_KEY, 0x32, { KEY_MUTE } }, |
5903 |
++ { KE_KEY, 0x33, { KEY_SCREENLOCK } }, |
5904 |
+ { KE_KEY, 0x35, { KEY_SCREENLOCK } }, |
5905 |
+ { KE_KEY, 0x40, { KEY_PREVIOUSSONG } }, |
5906 |
+ { KE_KEY, 0x41, { KEY_NEXTSONG } }, |
5907 |
+diff --git a/drivers/platform/x86/touchscreen_dmi.c b/drivers/platform/x86/touchscreen_dmi.c |
5908 |
+index 3d0790263fa7f..93671037fd598 100644 |
5909 |
+--- a/drivers/platform/x86/touchscreen_dmi.c |
5910 |
++++ b/drivers/platform/x86/touchscreen_dmi.c |
5911 |
+@@ -255,6 +255,23 @@ static const struct ts_dmi_data connect_tablet9_data = { |
5912 |
+ .properties = connect_tablet9_props, |
5913 |
+ }; |
5914 |
+ |
5915 |
++static const struct property_entry csl_panther_tab_hd_props[] = { |
5916 |
++ PROPERTY_ENTRY_U32("touchscreen-min-x", 1), |
5917 |
++ PROPERTY_ENTRY_U32("touchscreen-min-y", 20), |
5918 |
++ PROPERTY_ENTRY_U32("touchscreen-size-x", 1980), |
5919 |
++ PROPERTY_ENTRY_U32("touchscreen-size-y", 1526), |
5920 |
++ PROPERTY_ENTRY_BOOL("touchscreen-inverted-y"), |
5921 |
++ PROPERTY_ENTRY_BOOL("touchscreen-swapped-x-y"), |
5922 |
++ PROPERTY_ENTRY_STRING("firmware-name", "gsl1680-csl-panther-tab-hd.fw"), |
5923 |
++ PROPERTY_ENTRY_U32("silead,max-fingers", 10), |
5924 |
++ { } |
5925 |
++}; |
5926 |
++ |
5927 |
++static const struct ts_dmi_data csl_panther_tab_hd_data = { |
5928 |
++ .acpi_name = "MSSL1680:00", |
5929 |
++ .properties = csl_panther_tab_hd_props, |
5930 |
++}; |
5931 |
++ |
5932 |
+ static const struct property_entry cube_iwork8_air_props[] = { |
5933 |
+ PROPERTY_ENTRY_U32("touchscreen-min-x", 1), |
5934 |
+ PROPERTY_ENTRY_U32("touchscreen-min-y", 3), |
5935 |
+@@ -1100,6 +1117,14 @@ const struct dmi_system_id touchscreen_dmi_table[] = { |
5936 |
+ DMI_MATCH(DMI_PRODUCT_NAME, "Tablet 9"), |
5937 |
+ }, |
5938 |
+ }, |
5939 |
++ { |
5940 |
++ /* CSL Panther Tab HD */ |
5941 |
++ .driver_data = (void *)&csl_panther_tab_hd_data, |
5942 |
++ .matches = { |
5943 |
++ DMI_MATCH(DMI_SYS_VENDOR, "CSL Computer GmbH & Co. KG"), |
5944 |
++ DMI_MATCH(DMI_PRODUCT_NAME, "CSL Panther Tab HD"), |
5945 |
++ }, |
5946 |
++ }, |
5947 |
+ { |
5948 |
+ /* CUBE iwork8 Air */ |
5949 |
+ .driver_data = (void *)&cube_iwork8_air_data, |
5950 |
+diff --git a/drivers/reset/reset-uniphier-glue.c b/drivers/reset/reset-uniphier-glue.c |
5951 |
+index 027990b79f61b..7493e9618837e 100644 |
5952 |
+--- a/drivers/reset/reset-uniphier-glue.c |
5953 |
++++ b/drivers/reset/reset-uniphier-glue.c |
5954 |
+@@ -23,7 +23,7 @@ struct uniphier_glue_reset_soc_data { |
5955 |
+ |
5956 |
+ struct uniphier_glue_reset_priv { |
5957 |
+ struct clk_bulk_data clk[MAX_CLKS]; |
5958 |
+- struct reset_control *rst[MAX_RSTS]; |
5959 |
++ struct reset_control_bulk_data rst[MAX_RSTS]; |
5960 |
+ struct reset_simple_data rdata; |
5961 |
+ const struct uniphier_glue_reset_soc_data *data; |
5962 |
+ }; |
5963 |
+@@ -33,9 +33,7 @@ static int uniphier_glue_reset_probe(struct platform_device *pdev) |
5964 |
+ struct device *dev = &pdev->dev; |
5965 |
+ struct uniphier_glue_reset_priv *priv; |
5966 |
+ struct resource *res; |
5967 |
+- resource_size_t size; |
5968 |
+- const char *name; |
5969 |
+- int i, ret, nr; |
5970 |
++ int i, ret; |
5971 |
+ |
5972 |
+ priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); |
5973 |
+ if (!priv) |
5974 |
+@@ -47,7 +45,6 @@ static int uniphier_glue_reset_probe(struct platform_device *pdev) |
5975 |
+ return -EINVAL; |
5976 |
+ |
5977 |
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
5978 |
+- size = resource_size(res); |
5979 |
+ priv->rdata.membase = devm_ioremap_resource(dev, res); |
5980 |
+ if (IS_ERR(priv->rdata.membase)) |
5981 |
+ return PTR_ERR(priv->rdata.membase); |
5982 |
+@@ -58,26 +55,24 @@ static int uniphier_glue_reset_probe(struct platform_device *pdev) |
5983 |
+ if (ret) |
5984 |
+ return ret; |
5985 |
+ |
5986 |
+- for (i = 0; i < priv->data->nrsts; i++) { |
5987 |
+- name = priv->data->reset_names[i]; |
5988 |
+- priv->rst[i] = devm_reset_control_get_shared(dev, name); |
5989 |
+- if (IS_ERR(priv->rst[i])) |
5990 |
+- return PTR_ERR(priv->rst[i]); |
5991 |
+- } |
5992 |
++ for (i = 0; i < priv->data->nrsts; i++) |
5993 |
++ priv->rst[i].id = priv->data->reset_names[i]; |
5994 |
++ ret = devm_reset_control_bulk_get_shared(dev, priv->data->nrsts, |
5995 |
++ priv->rst); |
5996 |
++ if (ret) |
5997 |
++ return ret; |
5998 |
+ |
5999 |
+ ret = clk_bulk_prepare_enable(priv->data->nclks, priv->clk); |
6000 |
+ if (ret) |
6001 |
+ return ret; |
6002 |
+ |
6003 |
+- for (nr = 0; nr < priv->data->nrsts; nr++) { |
6004 |
+- ret = reset_control_deassert(priv->rst[nr]); |
6005 |
+- if (ret) |
6006 |
+- goto out_rst_assert; |
6007 |
+- } |
6008 |
++ ret = reset_control_bulk_deassert(priv->data->nrsts, priv->rst); |
6009 |
++ if (ret) |
6010 |
++ goto out_clk_disable; |
6011 |
+ |
6012 |
+ spin_lock_init(&priv->rdata.lock); |
6013 |
+ priv->rdata.rcdev.owner = THIS_MODULE; |
6014 |
+- priv->rdata.rcdev.nr_resets = size * BITS_PER_BYTE; |
6015 |
++ priv->rdata.rcdev.nr_resets = resource_size(res) * BITS_PER_BYTE; |
6016 |
+ priv->rdata.rcdev.ops = &reset_simple_ops; |
6017 |
+ priv->rdata.rcdev.of_node = dev->of_node; |
6018 |
+ priv->rdata.active_low = true; |
6019 |
+@@ -91,9 +86,9 @@ static int uniphier_glue_reset_probe(struct platform_device *pdev) |
6020 |
+ return 0; |
6021 |
+ |
6022 |
+ out_rst_assert: |
6023 |
+- while (nr--) |
6024 |
+- reset_control_assert(priv->rst[nr]); |
6025 |
++ reset_control_bulk_assert(priv->data->nrsts, priv->rst); |
6026 |
+ |
6027 |
++out_clk_disable: |
6028 |
+ clk_bulk_disable_unprepare(priv->data->nclks, priv->clk); |
6029 |
+ |
6030 |
+ return ret; |
6031 |
+@@ -102,10 +97,8 @@ out_rst_assert: |
6032 |
+ static int uniphier_glue_reset_remove(struct platform_device *pdev) |
6033 |
+ { |
6034 |
+ struct uniphier_glue_reset_priv *priv = platform_get_drvdata(pdev); |
6035 |
+- int i; |
6036 |
+ |
6037 |
+- for (i = 0; i < priv->data->nrsts; i++) |
6038 |
+- reset_control_assert(priv->rst[i]); |
6039 |
++ reset_control_bulk_assert(priv->data->nrsts, priv->rst); |
6040 |
+ |
6041 |
+ clk_bulk_disable_unprepare(priv->data->nclks, priv->clk); |
6042 |
+ |
6043 |
+diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c |
6044 |
+index 9515c45affa5e..7d93783c09a50 100644 |
6045 |
+--- a/drivers/scsi/hisi_sas/hisi_sas_main.c |
6046 |
++++ b/drivers/scsi/hisi_sas/hisi_sas_main.c |
6047 |
+@@ -1414,7 +1414,7 @@ static void hisi_sas_refresh_port_id(struct hisi_hba *hisi_hba) |
6048 |
+ device->linkrate = phy->sas_phy.linkrate; |
6049 |
+ |
6050 |
+ hisi_hba->hw->setup_itct(hisi_hba, sas_dev); |
6051 |
+- } else |
6052 |
++ } else if (!port->port_attached) |
6053 |
+ port->id = 0xff; |
6054 |
+ } |
6055 |
+ } |
6056 |
+diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c |
6057 |
+index cf7988de7b90b..8aa5c22ae3ff9 100644 |
6058 |
+--- a/drivers/scsi/hpsa.c |
6059 |
++++ b/drivers/scsi/hpsa.c |
6060 |
+@@ -5848,7 +5848,7 @@ static int hpsa_scsi_host_alloc(struct ctlr_info *h) |
6061 |
+ { |
6062 |
+ struct Scsi_Host *sh; |
6063 |
+ |
6064 |
+- sh = scsi_host_alloc(&hpsa_driver_template, sizeof(h)); |
6065 |
++ sh = scsi_host_alloc(&hpsa_driver_template, sizeof(struct ctlr_info)); |
6066 |
+ if (sh == NULL) { |
6067 |
+ dev_err(&h->pdev->dev, "scsi_host_alloc failed\n"); |
6068 |
+ return -ENOMEM; |
6069 |
+diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c |
6070 |
+index cc39cbef9d7fd..4d23e5af20d30 100644 |
6071 |
+--- a/drivers/scsi/scsi_transport_iscsi.c |
6072 |
++++ b/drivers/scsi/scsi_transport_iscsi.c |
6073 |
+@@ -1679,6 +1679,13 @@ static const char *iscsi_session_state_name(int state) |
6074 |
+ return name; |
6075 |
+ } |
6076 |
+ |
6077 |
++static char *iscsi_session_target_state_name[] = { |
6078 |
++ [ISCSI_SESSION_TARGET_UNBOUND] = "UNBOUND", |
6079 |
++ [ISCSI_SESSION_TARGET_ALLOCATED] = "ALLOCATED", |
6080 |
++ [ISCSI_SESSION_TARGET_SCANNED] = "SCANNED", |
6081 |
++ [ISCSI_SESSION_TARGET_UNBINDING] = "UNBINDING", |
6082 |
++}; |
6083 |
++ |
6084 |
+ int iscsi_session_chkready(struct iscsi_cls_session *session) |
6085 |
+ { |
6086 |
+ int err; |
6087 |
+@@ -1807,9 +1814,13 @@ static int iscsi_user_scan_session(struct device *dev, void *data) |
6088 |
+ if ((scan_data->channel == SCAN_WILD_CARD || |
6089 |
+ scan_data->channel == 0) && |
6090 |
+ (scan_data->id == SCAN_WILD_CARD || |
6091 |
+- scan_data->id == id)) |
6092 |
++ scan_data->id == id)) { |
6093 |
+ scsi_scan_target(&session->dev, 0, id, |
6094 |
+ scan_data->lun, scan_data->rescan); |
6095 |
++ spin_lock_irqsave(&session->lock, flags); |
6096 |
++ session->target_state = ISCSI_SESSION_TARGET_SCANNED; |
6097 |
++ spin_unlock_irqrestore(&session->lock, flags); |
6098 |
++ } |
6099 |
+ } |
6100 |
+ |
6101 |
+ user_scan_exit: |
6102 |
+@@ -1998,31 +2009,41 @@ static void __iscsi_unbind_session(struct work_struct *work) |
6103 |
+ struct iscsi_cls_host *ihost = shost->shost_data; |
6104 |
+ unsigned long flags; |
6105 |
+ unsigned int target_id; |
6106 |
++ bool remove_target = true; |
6107 |
+ |
6108 |
+ ISCSI_DBG_TRANS_SESSION(session, "Unbinding session\n"); |
6109 |
+ |
6110 |
+ /* Prevent new scans and make sure scanning is not in progress */ |
6111 |
+ mutex_lock(&ihost->mutex); |
6112 |
+ spin_lock_irqsave(&session->lock, flags); |
6113 |
+- if (session->target_id == ISCSI_MAX_TARGET) { |
6114 |
++ if (session->target_state == ISCSI_SESSION_TARGET_ALLOCATED) { |
6115 |
++ remove_target = false; |
6116 |
++ } else if (session->target_state != ISCSI_SESSION_TARGET_SCANNED) { |
6117 |
+ spin_unlock_irqrestore(&session->lock, flags); |
6118 |
+ mutex_unlock(&ihost->mutex); |
6119 |
+- goto unbind_session_exit; |
6120 |
++ ISCSI_DBG_TRANS_SESSION(session, |
6121 |
++ "Skipping target unbinding: Session is unbound/unbinding.\n"); |
6122 |
++ return; |
6123 |
+ } |
6124 |
+ |
6125 |
++ session->target_state = ISCSI_SESSION_TARGET_UNBINDING; |
6126 |
+ target_id = session->target_id; |
6127 |
+ session->target_id = ISCSI_MAX_TARGET; |
6128 |
+ spin_unlock_irqrestore(&session->lock, flags); |
6129 |
+ mutex_unlock(&ihost->mutex); |
6130 |
+ |
6131 |
+- scsi_remove_target(&session->dev); |
6132 |
++ if (remove_target) |
6133 |
++ scsi_remove_target(&session->dev); |
6134 |
+ |
6135 |
+ if (session->ida_used) |
6136 |
+ ida_simple_remove(&iscsi_sess_ida, target_id); |
6137 |
+ |
6138 |
+-unbind_session_exit: |
6139 |
+ iscsi_session_event(session, ISCSI_KEVENT_UNBIND_SESSION); |
6140 |
+ ISCSI_DBG_TRANS_SESSION(session, "Completed target removal\n"); |
6141 |
++ |
6142 |
++ spin_lock_irqsave(&session->lock, flags); |
6143 |
++ session->target_state = ISCSI_SESSION_TARGET_UNBOUND; |
6144 |
++ spin_unlock_irqrestore(&session->lock, flags); |
6145 |
+ } |
6146 |
+ |
6147 |
+ static void __iscsi_destroy_session(struct work_struct *work) |
6148 |
+@@ -2091,6 +2112,9 @@ int iscsi_add_session(struct iscsi_cls_session *session, unsigned int target_id) |
6149 |
+ session->ida_used = true; |
6150 |
+ } else |
6151 |
+ session->target_id = target_id; |
6152 |
++ spin_lock_irqsave(&session->lock, flags); |
6153 |
++ session->target_state = ISCSI_SESSION_TARGET_ALLOCATED; |
6154 |
++ spin_unlock_irqrestore(&session->lock, flags); |
6155 |
+ |
6156 |
+ dev_set_name(&session->dev, "session%u", session->sid); |
6157 |
+ err = device_add(&session->dev); |
6158 |
+@@ -4391,6 +4415,19 @@ iscsi_session_attr(def_taskmgmt_tmo, ISCSI_PARAM_DEF_TASKMGMT_TMO, 0); |
6159 |
+ iscsi_session_attr(discovery_parent_idx, ISCSI_PARAM_DISCOVERY_PARENT_IDX, 0); |
6160 |
+ iscsi_session_attr(discovery_parent_type, ISCSI_PARAM_DISCOVERY_PARENT_TYPE, 0); |
6161 |
+ |
6162 |
++static ssize_t |
6163 |
++show_priv_session_target_state(struct device *dev, struct device_attribute *attr, |
6164 |
++ char *buf) |
6165 |
++{ |
6166 |
++ struct iscsi_cls_session *session = iscsi_dev_to_session(dev->parent); |
6167 |
++ |
6168 |
++ return sysfs_emit(buf, "%s\n", |
6169 |
++ iscsi_session_target_state_name[session->target_state]); |
6170 |
++} |
6171 |
++ |
6172 |
++static ISCSI_CLASS_ATTR(priv_sess, target_state, S_IRUGO, |
6173 |
++ show_priv_session_target_state, NULL); |
6174 |
++ |
6175 |
+ static ssize_t |
6176 |
+ show_priv_session_state(struct device *dev, struct device_attribute *attr, |
6177 |
+ char *buf) |
6178 |
+@@ -4493,6 +4530,7 @@ static struct attribute *iscsi_session_attrs[] = { |
6179 |
+ &dev_attr_sess_boot_target.attr, |
6180 |
+ &dev_attr_priv_sess_recovery_tmo.attr, |
6181 |
+ &dev_attr_priv_sess_state.attr, |
6182 |
++ &dev_attr_priv_sess_target_state.attr, |
6183 |
+ &dev_attr_priv_sess_creator.attr, |
6184 |
+ &dev_attr_sess_chap_out_idx.attr, |
6185 |
+ &dev_attr_sess_chap_in_idx.attr, |
6186 |
+@@ -4606,6 +4644,8 @@ static umode_t iscsi_session_attr_is_visible(struct kobject *kobj, |
6187 |
+ return S_IRUGO | S_IWUSR; |
6188 |
+ else if (attr == &dev_attr_priv_sess_state.attr) |
6189 |
+ return S_IRUGO; |
6190 |
++ else if (attr == &dev_attr_priv_sess_target_state.attr) |
6191 |
++ return S_IRUGO; |
6192 |
+ else if (attr == &dev_attr_priv_sess_creator.attr) |
6193 |
+ return S_IRUGO; |
6194 |
+ else if (attr == &dev_attr_priv_sess_target_id.attr) |
6195 |
+diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c |
6196 |
+index 0b06223f5714a..120831428ec6f 100644 |
6197 |
+--- a/drivers/scsi/ufs/ufshcd.c |
6198 |
++++ b/drivers/scsi/ufs/ufshcd.c |
6199 |
+@@ -1185,12 +1185,14 @@ static int ufshcd_clock_scaling_prepare(struct ufs_hba *hba) |
6200 |
+ * clock scaling is in progress |
6201 |
+ */ |
6202 |
+ ufshcd_scsi_block_requests(hba); |
6203 |
++ mutex_lock(&hba->wb_mutex); |
6204 |
+ down_write(&hba->clk_scaling_lock); |
6205 |
+ |
6206 |
+ if (!hba->clk_scaling.is_allowed || |
6207 |
+ ufshcd_wait_for_doorbell_clr(hba, DOORBELL_CLR_TOUT_US)) { |
6208 |
+ ret = -EBUSY; |
6209 |
+ up_write(&hba->clk_scaling_lock); |
6210 |
++ mutex_unlock(&hba->wb_mutex); |
6211 |
+ ufshcd_scsi_unblock_requests(hba); |
6212 |
+ goto out; |
6213 |
+ } |
6214 |
+@@ -1202,12 +1204,15 @@ out: |
6215 |
+ return ret; |
6216 |
+ } |
6217 |
+ |
6218 |
+-static void ufshcd_clock_scaling_unprepare(struct ufs_hba *hba, bool writelock) |
6219 |
++static void ufshcd_clock_scaling_unprepare(struct ufs_hba *hba, int err, bool scale_up) |
6220 |
+ { |
6221 |
+- if (writelock) |
6222 |
+- up_write(&hba->clk_scaling_lock); |
6223 |
+- else |
6224 |
+- up_read(&hba->clk_scaling_lock); |
6225 |
++ up_write(&hba->clk_scaling_lock); |
6226 |
++ |
6227 |
++ /* Enable Write Booster if we have scaled up else disable it */ |
6228 |
++ ufshcd_wb_toggle(hba, scale_up); |
6229 |
++ |
6230 |
++ mutex_unlock(&hba->wb_mutex); |
6231 |
++ |
6232 |
+ ufshcd_scsi_unblock_requests(hba); |
6233 |
+ ufshcd_release(hba); |
6234 |
+ } |
6235 |
+@@ -1224,7 +1229,6 @@ static void ufshcd_clock_scaling_unprepare(struct ufs_hba *hba, bool writelock) |
6236 |
+ static int ufshcd_devfreq_scale(struct ufs_hba *hba, bool scale_up) |
6237 |
+ { |
6238 |
+ int ret = 0; |
6239 |
+- bool is_writelock = true; |
6240 |
+ |
6241 |
+ ret = ufshcd_clock_scaling_prepare(hba); |
6242 |
+ if (ret) |
6243 |
+@@ -1253,13 +1257,8 @@ static int ufshcd_devfreq_scale(struct ufs_hba *hba, bool scale_up) |
6244 |
+ } |
6245 |
+ } |
6246 |
+ |
6247 |
+- /* Enable Write Booster if we have scaled up else disable it */ |
6248 |
+- downgrade_write(&hba->clk_scaling_lock); |
6249 |
+- is_writelock = false; |
6250 |
+- ufshcd_wb_toggle(hba, scale_up); |
6251 |
+- |
6252 |
+ out_unprepare: |
6253 |
+- ufshcd_clock_scaling_unprepare(hba, is_writelock); |
6254 |
++ ufshcd_clock_scaling_unprepare(hba, ret, scale_up); |
6255 |
+ return ret; |
6256 |
+ } |
6257 |
+ |
6258 |
+@@ -5919,9 +5918,11 @@ static void ufshcd_force_error_recovery(struct ufs_hba *hba) |
6259 |
+ |
6260 |
+ static void ufshcd_clk_scaling_allow(struct ufs_hba *hba, bool allow) |
6261 |
+ { |
6262 |
++ mutex_lock(&hba->wb_mutex); |
6263 |
+ down_write(&hba->clk_scaling_lock); |
6264 |
+ hba->clk_scaling.is_allowed = allow; |
6265 |
+ up_write(&hba->clk_scaling_lock); |
6266 |
++ mutex_unlock(&hba->wb_mutex); |
6267 |
+ } |
6268 |
+ |
6269 |
+ static void ufshcd_clk_scaling_suspend(struct ufs_hba *hba, bool suspend) |
6270 |
+@@ -9480,6 +9481,7 @@ int ufshcd_init(struct ufs_hba *hba, void __iomem *mmio_base, unsigned int irq) |
6271 |
+ /* Initialize mutex for exception event control */ |
6272 |
+ mutex_init(&hba->ee_ctrl_mutex); |
6273 |
+ |
6274 |
++ mutex_init(&hba->wb_mutex); |
6275 |
+ init_rwsem(&hba->clk_scaling_lock); |
6276 |
+ |
6277 |
+ ufshcd_init_clk_gating(hba); |
6278 |
+diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h |
6279 |
+index d470a52ff24c3..c8513cc6c2bdd 100644 |
6280 |
+--- a/drivers/scsi/ufs/ufshcd.h |
6281 |
++++ b/drivers/scsi/ufs/ufshcd.h |
6282 |
+@@ -763,6 +763,7 @@ struct ufs_hba_monitor { |
6283 |
+ * @urgent_bkops_lvl: keeps track of urgent bkops level for device |
6284 |
+ * @is_urgent_bkops_lvl_checked: keeps track if the urgent bkops level for |
6285 |
+ * device is known or not. |
6286 |
++ * @wb_mutex: used to serialize devfreq and sysfs write booster toggling |
6287 |
+ * @scsi_block_reqs_cnt: reference counting for scsi block requests |
6288 |
+ * @crypto_capabilities: Content of crypto capabilities register (0x100) |
6289 |
+ * @crypto_cap_array: Array of crypto capabilities |
6290 |
+@@ -892,6 +893,7 @@ struct ufs_hba { |
6291 |
+ enum bkops_status urgent_bkops_lvl; |
6292 |
+ bool is_urgent_bkops_lvl_checked; |
6293 |
+ |
6294 |
++ struct mutex wb_mutex; |
6295 |
+ struct rw_semaphore clk_scaling_lock; |
6296 |
+ unsigned char desc_size[QUERY_DESC_IDN_MAX]; |
6297 |
+ atomic_t scsi_block_reqs_cnt; |
6298 |
+diff --git a/drivers/soc/imx/soc-imx8m.c b/drivers/soc/imx/soc-imx8m.c |
6299 |
+index 28144c699b0c3..32ed9dc88e455 100644 |
6300 |
+--- a/drivers/soc/imx/soc-imx8m.c |
6301 |
++++ b/drivers/soc/imx/soc-imx8m.c |
6302 |
+@@ -66,8 +66,8 @@ static u32 __init imx8mq_soc_revision(void) |
6303 |
+ ocotp_base = of_iomap(np, 0); |
6304 |
+ WARN_ON(!ocotp_base); |
6305 |
+ clk = of_clk_get_by_name(np, NULL); |
6306 |
+- if (!clk) { |
6307 |
+- WARN_ON(!clk); |
6308 |
++ if (IS_ERR(clk)) { |
6309 |
++ WARN_ON(IS_ERR(clk)); |
6310 |
+ return 0; |
6311 |
+ } |
6312 |
+ |
6313 |
+diff --git a/drivers/soc/qcom/cpr.c b/drivers/soc/qcom/cpr.c |
6314 |
+index 84dd93472a252..e61cff3d9c8a6 100644 |
6315 |
+--- a/drivers/soc/qcom/cpr.c |
6316 |
++++ b/drivers/soc/qcom/cpr.c |
6317 |
+@@ -1710,12 +1710,16 @@ static int cpr_probe(struct platform_device *pdev) |
6318 |
+ |
6319 |
+ ret = of_genpd_add_provider_simple(dev->of_node, &drv->pd); |
6320 |
+ if (ret) |
6321 |
+- return ret; |
6322 |
++ goto err_remove_genpd; |
6323 |
+ |
6324 |
+ platform_set_drvdata(pdev, drv); |
6325 |
+ cpr_debugfs_init(drv); |
6326 |
+ |
6327 |
+ return 0; |
6328 |
++ |
6329 |
++err_remove_genpd: |
6330 |
++ pm_genpd_remove(&drv->pd); |
6331 |
++ return ret; |
6332 |
+ } |
6333 |
+ |
6334 |
+ static int cpr_remove(struct platform_device *pdev) |
6335 |
+diff --git a/drivers/spi/spidev.c b/drivers/spi/spidev.c |
6336 |
+index d233e2424ad14..922d778df0641 100644 |
6337 |
+--- a/drivers/spi/spidev.c |
6338 |
++++ b/drivers/spi/spidev.c |
6339 |
+@@ -592,7 +592,6 @@ static int spidev_open(struct inode *inode, struct file *filp) |
6340 |
+ if (!spidev->tx_buffer) { |
6341 |
+ spidev->tx_buffer = kmalloc(bufsiz, GFP_KERNEL); |
6342 |
+ if (!spidev->tx_buffer) { |
6343 |
+- dev_dbg(&spidev->spi->dev, "open/ENOMEM\n"); |
6344 |
+ status = -ENOMEM; |
6345 |
+ goto err_find_dev; |
6346 |
+ } |
6347 |
+@@ -601,7 +600,6 @@ static int spidev_open(struct inode *inode, struct file *filp) |
6348 |
+ if (!spidev->rx_buffer) { |
6349 |
+ spidev->rx_buffer = kmalloc(bufsiz, GFP_KERNEL); |
6350 |
+ if (!spidev->rx_buffer) { |
6351 |
+- dev_dbg(&spidev->spi->dev, "open/ENOMEM\n"); |
6352 |
+ status = -ENOMEM; |
6353 |
+ goto err_alloc_rx_buf; |
6354 |
+ } |
6355 |
+diff --git a/drivers/thermal/gov_fair_share.c b/drivers/thermal/gov_fair_share.c |
6356 |
+index 1e5abf4822bed..a4c30797b5343 100644 |
6357 |
+--- a/drivers/thermal/gov_fair_share.c |
6358 |
++++ b/drivers/thermal/gov_fair_share.c |
6359 |
+@@ -25,10 +25,10 @@ static int get_trip_level(struct thermal_zone_device *tz) |
6360 |
+ int trip_temp; |
6361 |
+ enum thermal_trip_type trip_type; |
6362 |
+ |
6363 |
+- if (tz->trips == 0 || !tz->ops->get_trip_temp) |
6364 |
++ if (tz->num_trips == 0 || !tz->ops->get_trip_temp) |
6365 |
+ return 0; |
6366 |
+ |
6367 |
+- for (count = 0; count < tz->trips; count++) { |
6368 |
++ for (count = 0; count < tz->num_trips; count++) { |
6369 |
+ tz->ops->get_trip_temp(tz, count, &trip_temp); |
6370 |
+ if (tz->temperature < trip_temp) |
6371 |
+ break; |
6372 |
+@@ -49,11 +49,7 @@ static int get_trip_level(struct thermal_zone_device *tz) |
6373 |
+ static long get_target_state(struct thermal_zone_device *tz, |
6374 |
+ struct thermal_cooling_device *cdev, int percentage, int level) |
6375 |
+ { |
6376 |
+- unsigned long max_state; |
6377 |
+- |
6378 |
+- cdev->ops->get_max_state(cdev, &max_state); |
6379 |
+- |
6380 |
+- return (long)(percentage * level * max_state) / (100 * tz->trips); |
6381 |
++ return (long)(percentage * level * cdev->max_state) / (100 * tz->num_trips); |
6382 |
+ } |
6383 |
+ |
6384 |
+ /** |
6385 |
+diff --git a/drivers/thermal/gov_power_allocator.c b/drivers/thermal/gov_power_allocator.c |
6386 |
+index 13e375751d229..1d50524709672 100644 |
6387 |
+--- a/drivers/thermal/gov_power_allocator.c |
6388 |
++++ b/drivers/thermal/gov_power_allocator.c |
6389 |
+@@ -527,7 +527,7 @@ static void get_governor_trips(struct thermal_zone_device *tz, |
6390 |
+ last_active = INVALID_TRIP; |
6391 |
+ last_passive = INVALID_TRIP; |
6392 |
+ |
6393 |
+- for (i = 0; i < tz->trips; i++) { |
6394 |
++ for (i = 0; i < tz->num_trips; i++) { |
6395 |
+ enum thermal_trip_type type; |
6396 |
+ int ret; |
6397 |
+ |
6398 |
+@@ -668,7 +668,7 @@ static int power_allocator_bind(struct thermal_zone_device *tz) |
6399 |
+ |
6400 |
+ get_governor_trips(tz, params); |
6401 |
+ |
6402 |
+- if (tz->trips > 0) { |
6403 |
++ if (tz->num_trips > 0) { |
6404 |
+ ret = tz->ops->get_trip_temp(tz, |
6405 |
+ params->trip_max_desired_temperature, |
6406 |
+ &control_temp); |
6407 |
+diff --git a/drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c b/drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c |
6408 |
+index 62c0aa5d07837..0a4eaa307156d 100644 |
6409 |
+--- a/drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c |
6410 |
++++ b/drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c |
6411 |
+@@ -44,11 +44,13 @@ static int int340x_thermal_get_trip_temp(struct thermal_zone_device *zone, |
6412 |
+ int trip, int *temp) |
6413 |
+ { |
6414 |
+ struct int34x_thermal_zone *d = zone->devdata; |
6415 |
+- int i; |
6416 |
++ int i, ret = 0; |
6417 |
+ |
6418 |
+ if (d->override_ops && d->override_ops->get_trip_temp) |
6419 |
+ return d->override_ops->get_trip_temp(zone, trip, temp); |
6420 |
+ |
6421 |
++ mutex_lock(&d->trip_mutex); |
6422 |
++ |
6423 |
+ if (trip < d->aux_trip_nr) |
6424 |
+ *temp = d->aux_trips[trip]; |
6425 |
+ else if (trip == d->crt_trip_id) |
6426 |
+@@ -66,10 +68,12 @@ static int int340x_thermal_get_trip_temp(struct thermal_zone_device *zone, |
6427 |
+ } |
6428 |
+ } |
6429 |
+ if (i == INT340X_THERMAL_MAX_ACT_TRIP_COUNT) |
6430 |
+- return -EINVAL; |
6431 |
++ ret = -EINVAL; |
6432 |
+ } |
6433 |
+ |
6434 |
+- return 0; |
6435 |
++ mutex_unlock(&d->trip_mutex); |
6436 |
++ |
6437 |
++ return ret; |
6438 |
+ } |
6439 |
+ |
6440 |
+ static int int340x_thermal_get_trip_type(struct thermal_zone_device *zone, |
6441 |
+@@ -77,11 +81,13 @@ static int int340x_thermal_get_trip_type(struct thermal_zone_device *zone, |
6442 |
+ enum thermal_trip_type *type) |
6443 |
+ { |
6444 |
+ struct int34x_thermal_zone *d = zone->devdata; |
6445 |
+- int i; |
6446 |
++ int i, ret = 0; |
6447 |
+ |
6448 |
+ if (d->override_ops && d->override_ops->get_trip_type) |
6449 |
+ return d->override_ops->get_trip_type(zone, trip, type); |
6450 |
+ |
6451 |
++ mutex_lock(&d->trip_mutex); |
6452 |
++ |
6453 |
+ if (trip < d->aux_trip_nr) |
6454 |
+ *type = THERMAL_TRIP_PASSIVE; |
6455 |
+ else if (trip == d->crt_trip_id) |
6456 |
+@@ -99,10 +105,12 @@ static int int340x_thermal_get_trip_type(struct thermal_zone_device *zone, |
6457 |
+ } |
6458 |
+ } |
6459 |
+ if (i == INT340X_THERMAL_MAX_ACT_TRIP_COUNT) |
6460 |
+- return -EINVAL; |
6461 |
++ ret = -EINVAL; |
6462 |
+ } |
6463 |
+ |
6464 |
+- return 0; |
6465 |
++ mutex_unlock(&d->trip_mutex); |
6466 |
++ |
6467 |
++ return ret; |
6468 |
+ } |
6469 |
+ |
6470 |
+ static int int340x_thermal_set_trip_temp(struct thermal_zone_device *zone, |
6471 |
+@@ -180,6 +188,8 @@ int int340x_thermal_read_trips(struct int34x_thermal_zone *int34x_zone) |
6472 |
+ int trip_cnt = int34x_zone->aux_trip_nr; |
6473 |
+ int i; |
6474 |
+ |
6475 |
++ mutex_lock(&int34x_zone->trip_mutex); |
6476 |
++ |
6477 |
+ int34x_zone->crt_trip_id = -1; |
6478 |
+ if (!int340x_thermal_get_trip_config(int34x_zone->adev->handle, "_CRT", |
6479 |
+ &int34x_zone->crt_temp)) |
6480 |
+@@ -207,6 +217,8 @@ int int340x_thermal_read_trips(struct int34x_thermal_zone *int34x_zone) |
6481 |
+ int34x_zone->act_trips[i].valid = true; |
6482 |
+ } |
6483 |
+ |
6484 |
++ mutex_unlock(&int34x_zone->trip_mutex); |
6485 |
++ |
6486 |
+ return trip_cnt; |
6487 |
+ } |
6488 |
+ EXPORT_SYMBOL_GPL(int340x_thermal_read_trips); |
6489 |
+@@ -230,6 +242,8 @@ struct int34x_thermal_zone *int340x_thermal_zone_add(struct acpi_device *adev, |
6490 |
+ if (!int34x_thermal_zone) |
6491 |
+ return ERR_PTR(-ENOMEM); |
6492 |
+ |
6493 |
++ mutex_init(&int34x_thermal_zone->trip_mutex); |
6494 |
++ |
6495 |
+ int34x_thermal_zone->adev = adev; |
6496 |
+ int34x_thermal_zone->override_ops = override_ops; |
6497 |
+ |
6498 |
+@@ -281,6 +295,7 @@ err_thermal_zone: |
6499 |
+ acpi_lpat_free_conversion_table(int34x_thermal_zone->lpat_table); |
6500 |
+ kfree(int34x_thermal_zone->aux_trips); |
6501 |
+ err_trip_alloc: |
6502 |
++ mutex_destroy(&int34x_thermal_zone->trip_mutex); |
6503 |
+ kfree(int34x_thermal_zone); |
6504 |
+ return ERR_PTR(ret); |
6505 |
+ } |
6506 |
+@@ -292,6 +307,7 @@ void int340x_thermal_zone_remove(struct int34x_thermal_zone |
6507 |
+ thermal_zone_device_unregister(int34x_thermal_zone->zone); |
6508 |
+ acpi_lpat_free_conversion_table(int34x_thermal_zone->lpat_table); |
6509 |
+ kfree(int34x_thermal_zone->aux_trips); |
6510 |
++ mutex_destroy(&int34x_thermal_zone->trip_mutex); |
6511 |
+ kfree(int34x_thermal_zone); |
6512 |
+ } |
6513 |
+ EXPORT_SYMBOL_GPL(int340x_thermal_zone_remove); |
6514 |
+diff --git a/drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.h b/drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.h |
6515 |
+index 3b4971df1b33b..8f9872afd0d3c 100644 |
6516 |
+--- a/drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.h |
6517 |
++++ b/drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.h |
6518 |
+@@ -32,6 +32,7 @@ struct int34x_thermal_zone { |
6519 |
+ struct thermal_zone_device_ops *override_ops; |
6520 |
+ void *priv_data; |
6521 |
+ struct acpi_lpat_conversion_table *lpat_table; |
6522 |
++ struct mutex trip_mutex; |
6523 |
+ }; |
6524 |
+ |
6525 |
+ struct int34x_thermal_zone *int340x_thermal_zone_add(struct acpi_device *, |
6526 |
+diff --git a/drivers/thermal/tegra/tegra30-tsensor.c b/drivers/thermal/tegra/tegra30-tsensor.c |
6527 |
+index 9b6b693cbcf85..05886684f4295 100644 |
6528 |
+--- a/drivers/thermal/tegra/tegra30-tsensor.c |
6529 |
++++ b/drivers/thermal/tegra/tegra30-tsensor.c |
6530 |
+@@ -316,7 +316,7 @@ static void tegra_tsensor_get_hw_channel_trips(struct thermal_zone_device *tzd, |
6531 |
+ *hot_trip = 85000; |
6532 |
+ *crit_trip = 90000; |
6533 |
+ |
6534 |
+- for (i = 0; i < tzd->trips; i++) { |
6535 |
++ for (i = 0; i < tzd->num_trips; i++) { |
6536 |
+ enum thermal_trip_type type; |
6537 |
+ int trip_temp; |
6538 |
+ |
6539 |
+diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c |
6540 |
+index 38082fdc4fdef..052e8e8fbb21e 100644 |
6541 |
+--- a/drivers/thermal/thermal_core.c |
6542 |
++++ b/drivers/thermal/thermal_core.c |
6543 |
+@@ -503,7 +503,7 @@ void thermal_zone_device_update(struct thermal_zone_device *tz, |
6544 |
+ |
6545 |
+ tz->notify_event = event; |
6546 |
+ |
6547 |
+- for (count = 0; count < tz->trips; count++) |
6548 |
++ for (count = 0; count < tz->num_trips; count++) |
6549 |
+ handle_thermal_trip(tz, count); |
6550 |
+ } |
6551 |
+ EXPORT_SYMBOL_GPL(thermal_zone_device_update); |
6552 |
+@@ -625,10 +625,9 @@ int thermal_zone_bind_cooling_device(struct thermal_zone_device *tz, |
6553 |
+ struct thermal_instance *pos; |
6554 |
+ struct thermal_zone_device *pos1; |
6555 |
+ struct thermal_cooling_device *pos2; |
6556 |
+- unsigned long max_state; |
6557 |
+- int result, ret; |
6558 |
++ int result; |
6559 |
+ |
6560 |
+- if (trip >= tz->trips || trip < 0) |
6561 |
++ if (trip >= tz->num_trips || trip < 0) |
6562 |
+ return -EINVAL; |
6563 |
+ |
6564 |
+ list_for_each_entry(pos1, &thermal_tz_list, node) { |
6565 |
+@@ -643,15 +642,11 @@ int thermal_zone_bind_cooling_device(struct thermal_zone_device *tz, |
6566 |
+ if (tz != pos1 || cdev != pos2) |
6567 |
+ return -EINVAL; |
6568 |
+ |
6569 |
+- ret = cdev->ops->get_max_state(cdev, &max_state); |
6570 |
+- if (ret) |
6571 |
+- return ret; |
6572 |
+- |
6573 |
+ /* lower default 0, upper default max_state */ |
6574 |
+ lower = lower == THERMAL_NO_LIMIT ? 0 : lower; |
6575 |
+- upper = upper == THERMAL_NO_LIMIT ? max_state : upper; |
6576 |
++ upper = upper == THERMAL_NO_LIMIT ? cdev->max_state : upper; |
6577 |
+ |
6578 |
+- if (lower > upper || upper > max_state) |
6579 |
++ if (lower > upper || upper > cdev->max_state) |
6580 |
+ return -EINVAL; |
6581 |
+ |
6582 |
+ dev = kzalloc(sizeof(*dev), GFP_KERNEL); |
6583 |
+@@ -809,7 +804,7 @@ static void __bind(struct thermal_zone_device *tz, int mask, |
6584 |
+ { |
6585 |
+ int i, ret; |
6586 |
+ |
6587 |
+- for (i = 0; i < tz->trips; i++) { |
6588 |
++ for (i = 0; i < tz->num_trips; i++) { |
6589 |
+ if (mask & (1 << i)) { |
6590 |
+ unsigned long upper, lower; |
6591 |
+ |
6592 |
+@@ -918,12 +913,22 @@ __thermal_cooling_device_register(struct device_node *np, |
6593 |
+ cdev->updated = false; |
6594 |
+ cdev->device.class = &thermal_class; |
6595 |
+ cdev->devdata = devdata; |
6596 |
++ |
6597 |
++ ret = cdev->ops->get_max_state(cdev, &cdev->max_state); |
6598 |
++ if (ret) { |
6599 |
++ kfree(cdev->type); |
6600 |
++ goto out_ida_remove; |
6601 |
++ } |
6602 |
++ |
6603 |
+ thermal_cooling_device_setup_sysfs(cdev); |
6604 |
++ |
6605 |
+ ret = dev_set_name(&cdev->device, "cooling_device%d", cdev->id); |
6606 |
+ if (ret) { |
6607 |
++ kfree(cdev->type); |
6608 |
+ thermal_cooling_device_destroy_sysfs(cdev); |
6609 |
+- goto out_kfree_type; |
6610 |
++ goto out_ida_remove; |
6611 |
+ } |
6612 |
++ |
6613 |
+ ret = device_register(&cdev->device); |
6614 |
+ if (ret) |
6615 |
+ goto out_kfree_type; |
6616 |
+@@ -949,6 +954,8 @@ out_kfree_type: |
6617 |
+ thermal_cooling_device_destroy_sysfs(cdev); |
6618 |
+ kfree(cdev->type); |
6619 |
+ put_device(&cdev->device); |
6620 |
++ |
6621 |
++ /* thermal_release() takes care of the rest */ |
6622 |
+ cdev = NULL; |
6623 |
+ out_ida_remove: |
6624 |
+ ida_simple_remove(&thermal_cdev_ida, id); |
6625 |
+@@ -1056,7 +1063,7 @@ static void __unbind(struct thermal_zone_device *tz, int mask, |
6626 |
+ { |
6627 |
+ int i; |
6628 |
+ |
6629 |
+- for (i = 0; i < tz->trips; i++) |
6630 |
++ for (i = 0; i < tz->num_trips; i++) |
6631 |
+ if (mask & (1 << i)) |
6632 |
+ thermal_zone_unbind_cooling_device(tz, i, cdev); |
6633 |
+ } |
6634 |
+@@ -1161,7 +1168,7 @@ exit: |
6635 |
+ /** |
6636 |
+ * thermal_zone_device_register() - register a new thermal zone device |
6637 |
+ * @type: the thermal zone device type |
6638 |
+- * @trips: the number of trip points the thermal zone support |
6639 |
++ * @num_trips: the number of trip points the thermal zone support |
6640 |
+ * @mask: a bit string indicating the writeablility of trip points |
6641 |
+ * @devdata: private device data |
6642 |
+ * @ops: standard thermal zone device callbacks |
6643 |
+@@ -1183,7 +1190,7 @@ exit: |
6644 |
+ * IS_ERR*() helpers. |
6645 |
+ */ |
6646 |
+ struct thermal_zone_device * |
6647 |
+-thermal_zone_device_register(const char *type, int trips, int mask, |
6648 |
++thermal_zone_device_register(const char *type, int num_trips, int mask, |
6649 |
+ void *devdata, struct thermal_zone_device_ops *ops, |
6650 |
+ struct thermal_zone_params *tzp, int passive_delay, |
6651 |
+ int polling_delay) |
6652 |
+@@ -1197,27 +1204,27 @@ thermal_zone_device_register(const char *type, int trips, int mask, |
6653 |
+ struct thermal_governor *governor; |
6654 |
+ |
6655 |
+ if (!type || strlen(type) == 0) { |
6656 |
+- pr_err("Error: No thermal zone type defined\n"); |
6657 |
++ pr_err("No thermal zone type defined\n"); |
6658 |
+ return ERR_PTR(-EINVAL); |
6659 |
+ } |
6660 |
+ |
6661 |
+ if (type && strlen(type) >= THERMAL_NAME_LENGTH) { |
6662 |
+- pr_err("Error: Thermal zone name (%s) too long, should be under %d chars\n", |
6663 |
++ pr_err("Thermal zone name (%s) too long, should be under %d chars\n", |
6664 |
+ type, THERMAL_NAME_LENGTH); |
6665 |
+ return ERR_PTR(-EINVAL); |
6666 |
+ } |
6667 |
+ |
6668 |
+- if (trips > THERMAL_MAX_TRIPS || trips < 0 || mask >> trips) { |
6669 |
+- pr_err("Error: Incorrect number of thermal trips\n"); |
6670 |
++ if (num_trips > THERMAL_MAX_TRIPS || num_trips < 0 || mask >> num_trips) { |
6671 |
++ pr_err("Incorrect number of thermal trips\n"); |
6672 |
+ return ERR_PTR(-EINVAL); |
6673 |
+ } |
6674 |
+ |
6675 |
+ if (!ops) { |
6676 |
+- pr_err("Error: Thermal zone device ops not defined\n"); |
6677 |
++ pr_err("Thermal zone device ops not defined\n"); |
6678 |
+ return ERR_PTR(-EINVAL); |
6679 |
+ } |
6680 |
+ |
6681 |
+- if (trips > 0 && (!ops->get_trip_type || !ops->get_trip_temp)) |
6682 |
++ if (num_trips > 0 && (!ops->get_trip_type || !ops->get_trip_temp)) |
6683 |
+ return ERR_PTR(-EINVAL); |
6684 |
+ |
6685 |
+ tz = kzalloc(sizeof(*tz), GFP_KERNEL); |
6686 |
+@@ -1243,7 +1250,7 @@ thermal_zone_device_register(const char *type, int trips, int mask, |
6687 |
+ tz->tzp = tzp; |
6688 |
+ tz->device.class = &thermal_class; |
6689 |
+ tz->devdata = devdata; |
6690 |
+- tz->trips = trips; |
6691 |
++ tz->num_trips = num_trips; |
6692 |
+ |
6693 |
+ thermal_set_delay_jiffies(&tz->passive_delay_jiffies, passive_delay); |
6694 |
+ thermal_set_delay_jiffies(&tz->polling_delay_jiffies, polling_delay); |
6695 |
+@@ -1266,7 +1273,7 @@ thermal_zone_device_register(const char *type, int trips, int mask, |
6696 |
+ if (result) |
6697 |
+ goto release_device; |
6698 |
+ |
6699 |
+- for (count = 0; count < trips; count++) { |
6700 |
++ for (count = 0; count < num_trips; count++) { |
6701 |
+ if (tz->ops->get_trip_type(tz, count, &trip_type) || |
6702 |
+ tz->ops->get_trip_temp(tz, count, &trip_temp) || |
6703 |
+ !trip_temp) |
6704 |
+diff --git a/drivers/thermal/thermal_helpers.c b/drivers/thermal/thermal_helpers.c |
6705 |
+index 3edd047e144f0..ee7027bdcafa8 100644 |
6706 |
+--- a/drivers/thermal/thermal_helpers.c |
6707 |
++++ b/drivers/thermal/thermal_helpers.c |
6708 |
+@@ -90,7 +90,7 @@ int thermal_zone_get_temp(struct thermal_zone_device *tz, int *temp) |
6709 |
+ ret = tz->ops->get_temp(tz, temp); |
6710 |
+ |
6711 |
+ if (IS_ENABLED(CONFIG_THERMAL_EMULATION) && tz->emul_temperature) { |
6712 |
+- for (count = 0; count < tz->trips; count++) { |
6713 |
++ for (count = 0; count < tz->num_trips; count++) { |
6714 |
+ ret = tz->ops->get_trip_type(tz, count, &type); |
6715 |
+ if (!ret && type == THERMAL_TRIP_CRITICAL) { |
6716 |
+ ret = tz->ops->get_trip_temp(tz, count, |
6717 |
+@@ -138,7 +138,7 @@ void thermal_zone_set_trips(struct thermal_zone_device *tz) |
6718 |
+ if (!tz->ops->set_trips || !tz->ops->get_trip_hyst) |
6719 |
+ goto exit; |
6720 |
+ |
6721 |
+- for (i = 0; i < tz->trips; i++) { |
6722 |
++ for (i = 0; i < tz->num_trips; i++) { |
6723 |
+ int trip_low; |
6724 |
+ |
6725 |
+ tz->ops->get_trip_temp(tz, i, &trip_temp); |
6726 |
+diff --git a/drivers/thermal/thermal_netlink.c b/drivers/thermal/thermal_netlink.c |
6727 |
+index 41c8d47805c4e..c70d407c2c714 100644 |
6728 |
+--- a/drivers/thermal/thermal_netlink.c |
6729 |
++++ b/drivers/thermal/thermal_netlink.c |
6730 |
+@@ -415,7 +415,7 @@ static int thermal_genl_cmd_tz_get_trip(struct param *p) |
6731 |
+ |
6732 |
+ mutex_lock(&tz->lock); |
6733 |
+ |
6734 |
+- for (i = 0; i < tz->trips; i++) { |
6735 |
++ for (i = 0; i < tz->num_trips; i++) { |
6736 |
+ |
6737 |
+ enum thermal_trip_type type; |
6738 |
+ int temp, hyst = 0; |
6739 |
+diff --git a/drivers/thermal/thermal_sysfs.c b/drivers/thermal/thermal_sysfs.c |
6740 |
+index 1e5a78131aba9..de7cdec3db909 100644 |
6741 |
+--- a/drivers/thermal/thermal_sysfs.c |
6742 |
++++ b/drivers/thermal/thermal_sysfs.c |
6743 |
+@@ -416,15 +416,15 @@ static int create_trip_attrs(struct thermal_zone_device *tz, int mask) |
6744 |
+ int indx; |
6745 |
+ |
6746 |
+ /* This function works only for zones with at least one trip */ |
6747 |
+- if (tz->trips <= 0) |
6748 |
++ if (tz->num_trips <= 0) |
6749 |
+ return -EINVAL; |
6750 |
+ |
6751 |
+- tz->trip_type_attrs = kcalloc(tz->trips, sizeof(*tz->trip_type_attrs), |
6752 |
++ tz->trip_type_attrs = kcalloc(tz->num_trips, sizeof(*tz->trip_type_attrs), |
6753 |
+ GFP_KERNEL); |
6754 |
+ if (!tz->trip_type_attrs) |
6755 |
+ return -ENOMEM; |
6756 |
+ |
6757 |
+- tz->trip_temp_attrs = kcalloc(tz->trips, sizeof(*tz->trip_temp_attrs), |
6758 |
++ tz->trip_temp_attrs = kcalloc(tz->num_trips, sizeof(*tz->trip_temp_attrs), |
6759 |
+ GFP_KERNEL); |
6760 |
+ if (!tz->trip_temp_attrs) { |
6761 |
+ kfree(tz->trip_type_attrs); |
6762 |
+@@ -432,7 +432,7 @@ static int create_trip_attrs(struct thermal_zone_device *tz, int mask) |
6763 |
+ } |
6764 |
+ |
6765 |
+ if (tz->ops->get_trip_hyst) { |
6766 |
+- tz->trip_hyst_attrs = kcalloc(tz->trips, |
6767 |
++ tz->trip_hyst_attrs = kcalloc(tz->num_trips, |
6768 |
+ sizeof(*tz->trip_hyst_attrs), |
6769 |
+ GFP_KERNEL); |
6770 |
+ if (!tz->trip_hyst_attrs) { |
6771 |
+@@ -442,7 +442,7 @@ static int create_trip_attrs(struct thermal_zone_device *tz, int mask) |
6772 |
+ } |
6773 |
+ } |
6774 |
+ |
6775 |
+- attrs = kcalloc(tz->trips * 3 + 1, sizeof(*attrs), GFP_KERNEL); |
6776 |
++ attrs = kcalloc(tz->num_trips * 3 + 1, sizeof(*attrs), GFP_KERNEL); |
6777 |
+ if (!attrs) { |
6778 |
+ kfree(tz->trip_type_attrs); |
6779 |
+ kfree(tz->trip_temp_attrs); |
6780 |
+@@ -451,7 +451,7 @@ static int create_trip_attrs(struct thermal_zone_device *tz, int mask) |
6781 |
+ return -ENOMEM; |
6782 |
+ } |
6783 |
+ |
6784 |
+- for (indx = 0; indx < tz->trips; indx++) { |
6785 |
++ for (indx = 0; indx < tz->num_trips; indx++) { |
6786 |
+ /* create trip type attribute */ |
6787 |
+ snprintf(tz->trip_type_attrs[indx].name, THERMAL_NAME_LENGTH, |
6788 |
+ "trip_point_%d_type", indx); |
6789 |
+@@ -478,7 +478,7 @@ static int create_trip_attrs(struct thermal_zone_device *tz, int mask) |
6790 |
+ tz->trip_temp_attrs[indx].attr.store = |
6791 |
+ trip_point_temp_store; |
6792 |
+ } |
6793 |
+- attrs[indx + tz->trips] = &tz->trip_temp_attrs[indx].attr.attr; |
6794 |
++ attrs[indx + tz->num_trips] = &tz->trip_temp_attrs[indx].attr.attr; |
6795 |
+ |
6796 |
+ /* create Optional trip hyst attribute */ |
6797 |
+ if (!tz->ops->get_trip_hyst) |
6798 |
+@@ -496,10 +496,10 @@ static int create_trip_attrs(struct thermal_zone_device *tz, int mask) |
6799 |
+ tz->trip_hyst_attrs[indx].attr.store = |
6800 |
+ trip_point_hyst_store; |
6801 |
+ } |
6802 |
+- attrs[indx + tz->trips * 2] = |
6803 |
++ attrs[indx + tz->num_trips * 2] = |
6804 |
+ &tz->trip_hyst_attrs[indx].attr.attr; |
6805 |
+ } |
6806 |
+- attrs[tz->trips * 3] = NULL; |
6807 |
++ attrs[tz->num_trips * 3] = NULL; |
6808 |
+ |
6809 |
+ tz->trips_attribute_group.attrs = attrs; |
6810 |
+ |
6811 |
+@@ -540,7 +540,7 @@ int thermal_zone_create_device_groups(struct thermal_zone_device *tz, |
6812 |
+ for (i = 0; i < size - 2; i++) |
6813 |
+ groups[i] = thermal_zone_attribute_groups[i]; |
6814 |
+ |
6815 |
+- if (tz->trips) { |
6816 |
++ if (tz->num_trips) { |
6817 |
+ result = create_trip_attrs(tz, mask); |
6818 |
+ if (result) { |
6819 |
+ kfree(groups); |
6820 |
+@@ -561,7 +561,7 @@ void thermal_zone_destroy_device_groups(struct thermal_zone_device *tz) |
6821 |
+ if (!tz) |
6822 |
+ return; |
6823 |
+ |
6824 |
+- if (tz->trips) |
6825 |
++ if (tz->num_trips) |
6826 |
+ destroy_trip_attrs(tz); |
6827 |
+ |
6828 |
+ kfree(tz->device.groups); |
6829 |
+@@ -580,13 +580,8 @@ static ssize_t max_state_show(struct device *dev, struct device_attribute *attr, |
6830 |
+ char *buf) |
6831 |
+ { |
6832 |
+ struct thermal_cooling_device *cdev = to_cooling_device(dev); |
6833 |
+- unsigned long state; |
6834 |
+- int ret; |
6835 |
+ |
6836 |
+- ret = cdev->ops->get_max_state(cdev, &state); |
6837 |
+- if (ret) |
6838 |
+- return ret; |
6839 |
+- return sprintf(buf, "%ld\n", state); |
6840 |
++ return sprintf(buf, "%ld\n", cdev->max_state); |
6841 |
+ } |
6842 |
+ |
6843 |
+ static ssize_t cur_state_show(struct device *dev, struct device_attribute *attr, |
6844 |
+@@ -616,6 +611,10 @@ cur_state_store(struct device *dev, struct device_attribute *attr, |
6845 |
+ if ((long)state < 0) |
6846 |
+ return -EINVAL; |
6847 |
+ |
6848 |
++ /* Requested state should be less than max_state + 1 */ |
6849 |
++ if (state > cdev->max_state) |
6850 |
++ return -EINVAL; |
6851 |
++ |
6852 |
+ mutex_lock(&cdev->lock); |
6853 |
+ |
6854 |
+ result = cdev->ops->set_cur_state(cdev, state); |
6855 |
+diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c |
6856 |
+index adc44a2685b59..c9145ee959569 100644 |
6857 |
+--- a/drivers/usb/gadget/function/f_fs.c |
6858 |
++++ b/drivers/usb/gadget/function/f_fs.c |
6859 |
+@@ -279,6 +279,9 @@ static int __ffs_ep0_queue_wait(struct ffs_data *ffs, char *data, size_t len) |
6860 |
+ struct usb_request *req = ffs->ep0req; |
6861 |
+ int ret; |
6862 |
+ |
6863 |
++ if (!req) |
6864 |
++ return -EINVAL; |
6865 |
++ |
6866 |
+ req->zero = len < le16_to_cpu(ffs->ev.setup.wLength); |
6867 |
+ |
6868 |
+ spin_unlock_irq(&ffs->ev.waitq.lock); |
6869 |
+@@ -1892,10 +1895,14 @@ static void functionfs_unbind(struct ffs_data *ffs) |
6870 |
+ ENTER(); |
6871 |
+ |
6872 |
+ if (!WARN_ON(!ffs->gadget)) { |
6873 |
++ /* dequeue before freeing ep0req */ |
6874 |
++ usb_ep_dequeue(ffs->gadget->ep0, ffs->ep0req); |
6875 |
++ mutex_lock(&ffs->mutex); |
6876 |
+ usb_ep_free_request(ffs->gadget->ep0, ffs->ep0req); |
6877 |
+ ffs->ep0req = NULL; |
6878 |
+ ffs->gadget = NULL; |
6879 |
+ clear_bit(FFS_FL_BOUND, &ffs->flags); |
6880 |
++ mutex_unlock(&ffs->mutex); |
6881 |
+ ffs_data_put(ffs); |
6882 |
+ } |
6883 |
+ } |
6884 |
+diff --git a/drivers/w1/w1.c b/drivers/w1/w1.c |
6885 |
+index f2ae2e563dc54..4a2ddf730a3ac 100644 |
6886 |
+--- a/drivers/w1/w1.c |
6887 |
++++ b/drivers/w1/w1.c |
6888 |
+@@ -1166,6 +1166,8 @@ int w1_process(void *data) |
6889 |
+ /* remainder if it woke up early */ |
6890 |
+ unsigned long jremain = 0; |
6891 |
+ |
6892 |
++ atomic_inc(&dev->refcnt); |
6893 |
++ |
6894 |
+ for (;;) { |
6895 |
+ |
6896 |
+ if (!jremain && dev->search_count) { |
6897 |
+@@ -1193,8 +1195,10 @@ int w1_process(void *data) |
6898 |
+ */ |
6899 |
+ mutex_unlock(&dev->list_mutex); |
6900 |
+ |
6901 |
+- if (kthread_should_stop()) |
6902 |
++ if (kthread_should_stop()) { |
6903 |
++ __set_current_state(TASK_RUNNING); |
6904 |
+ break; |
6905 |
++ } |
6906 |
+ |
6907 |
+ /* Only sleep when the search is active. */ |
6908 |
+ if (dev->search_count) { |
6909 |
+diff --git a/drivers/w1/w1_int.c b/drivers/w1/w1_int.c |
6910 |
+index b3e1792d9c49f..3a71c5eb2f837 100644 |
6911 |
+--- a/drivers/w1/w1_int.c |
6912 |
++++ b/drivers/w1/w1_int.c |
6913 |
+@@ -51,10 +51,9 @@ static struct w1_master *w1_alloc_dev(u32 id, int slave_count, int slave_ttl, |
6914 |
+ dev->search_count = w1_search_count; |
6915 |
+ dev->enable_pullup = w1_enable_pullup; |
6916 |
+ |
6917 |
+- /* 1 for w1_process to decrement |
6918 |
+- * 1 for __w1_remove_master_device to decrement |
6919 |
++ /* For __w1_remove_master_device to decrement |
6920 |
+ */ |
6921 |
+- atomic_set(&dev->refcnt, 2); |
6922 |
++ atomic_set(&dev->refcnt, 1); |
6923 |
+ |
6924 |
+ INIT_LIST_HEAD(&dev->slist); |
6925 |
+ INIT_LIST_HEAD(&dev->async_list); |
6926 |
+diff --git a/fs/affs/file.c b/fs/affs/file.c |
6927 |
+index 75ebd2b576ca4..25d480ea797bd 100644 |
6928 |
+--- a/fs/affs/file.c |
6929 |
++++ b/fs/affs/file.c |
6930 |
+@@ -881,7 +881,7 @@ affs_truncate(struct inode *inode) |
6931 |
+ if (inode->i_size > AFFS_I(inode)->mmu_private) { |
6932 |
+ struct address_space *mapping = inode->i_mapping; |
6933 |
+ struct page *page; |
6934 |
+- void *fsdata; |
6935 |
++ void *fsdata = NULL; |
6936 |
+ loff_t isize = inode->i_size; |
6937 |
+ int res; |
6938 |
+ |
6939 |
+diff --git a/fs/cifs/dfs_cache.c b/fs/cifs/dfs_cache.c |
6940 |
+index 1f3efa7821a01..8c98fa5077689 100644 |
6941 |
+--- a/fs/cifs/dfs_cache.c |
6942 |
++++ b/fs/cifs/dfs_cache.c |
6943 |
+@@ -792,26 +792,27 @@ static int get_dfs_referral(const unsigned int xid, struct cifs_ses *ses, const |
6944 |
+ */ |
6945 |
+ static int cache_refresh_path(const unsigned int xid, struct cifs_ses *ses, const char *path) |
6946 |
+ { |
6947 |
+- int rc; |
6948 |
+- struct cache_entry *ce; |
6949 |
+ struct dfs_info3_param *refs = NULL; |
6950 |
++ struct cache_entry *ce; |
6951 |
+ int numrefs = 0; |
6952 |
+- bool newent = false; |
6953 |
++ int rc; |
6954 |
+ |
6955 |
+ cifs_dbg(FYI, "%s: search path: %s\n", __func__, path); |
6956 |
+ |
6957 |
+- down_write(&htable_rw_lock); |
6958 |
++ down_read(&htable_rw_lock); |
6959 |
+ |
6960 |
+ ce = lookup_cache_entry(path); |
6961 |
+- if (!IS_ERR(ce)) { |
6962 |
+- if (!cache_entry_expired(ce)) { |
6963 |
+- dump_ce(ce); |
6964 |
+- up_write(&htable_rw_lock); |
6965 |
+- return 0; |
6966 |
+- } |
6967 |
+- } else { |
6968 |
+- newent = true; |
6969 |
++ if (!IS_ERR(ce) && !cache_entry_expired(ce)) { |
6970 |
++ up_read(&htable_rw_lock); |
6971 |
++ return 0; |
6972 |
+ } |
6973 |
++ /* |
6974 |
++ * Unlock shared access as we don't want to hold any locks while getting |
6975 |
++ * a new referral. The @ses used for performing the I/O could be |
6976 |
++ * reconnecting and it acquires @htable_rw_lock to look up the dfs cache |
6977 |
++ * in order to failover -- if necessary. |
6978 |
++ */ |
6979 |
++ up_read(&htable_rw_lock); |
6980 |
+ |
6981 |
+ /* |
6982 |
+ * Either the entry was not found, or it is expired. |
6983 |
+@@ -819,19 +820,22 @@ static int cache_refresh_path(const unsigned int xid, struct cifs_ses *ses, cons |
6984 |
+ */ |
6985 |
+ rc = get_dfs_referral(xid, ses, path, &refs, &numrefs); |
6986 |
+ if (rc) |
6987 |
+- goto out_unlock; |
6988 |
++ goto out; |
6989 |
+ |
6990 |
+ dump_refs(refs, numrefs); |
6991 |
+ |
6992 |
+- if (!newent) { |
6993 |
+- rc = update_cache_entry_locked(ce, refs, numrefs); |
6994 |
+- goto out_unlock; |
6995 |
++ down_write(&htable_rw_lock); |
6996 |
++ /* Re-check as another task might have it added or refreshed already */ |
6997 |
++ ce = lookup_cache_entry(path); |
6998 |
++ if (!IS_ERR(ce)) { |
6999 |
++ if (cache_entry_expired(ce)) |
7000 |
++ rc = update_cache_entry_locked(ce, refs, numrefs); |
7001 |
++ } else { |
7002 |
++ rc = add_cache_entry_locked(refs, numrefs); |
7003 |
+ } |
7004 |
+ |
7005 |
+- rc = add_cache_entry_locked(refs, numrefs); |
7006 |
+- |
7007 |
+-out_unlock: |
7008 |
+ up_write(&htable_rw_lock); |
7009 |
++out: |
7010 |
+ free_dfs_info_array(refs, numrefs); |
7011 |
+ return rc; |
7012 |
+ } |
7013 |
+diff --git a/fs/cifs/smbdirect.c b/fs/cifs/smbdirect.c |
7014 |
+index 31ef64eb7fbb9..cb93cccbf0c41 100644 |
7015 |
+--- a/fs/cifs/smbdirect.c |
7016 |
++++ b/fs/cifs/smbdirect.c |
7017 |
+@@ -1405,6 +1405,7 @@ void smbd_destroy(struct TCP_Server_Info *server) |
7018 |
+ destroy_workqueue(info->workqueue); |
7019 |
+ log_rdma_event(INFO, "rdma session destroyed\n"); |
7020 |
+ kfree(info); |
7021 |
++ server->smbd_conn = NULL; |
7022 |
+ } |
7023 |
+ |
7024 |
+ /* |
7025 |
+diff --git a/fs/ksmbd/connection.c b/fs/ksmbd/connection.c |
7026 |
+index 6a1d1fbe5fb2d..ce0edf926c2af 100644 |
7027 |
+--- a/fs/ksmbd/connection.c |
7028 |
++++ b/fs/ksmbd/connection.c |
7029 |
+@@ -274,7 +274,7 @@ int ksmbd_conn_handler_loop(void *p) |
7030 |
+ { |
7031 |
+ struct ksmbd_conn *conn = (struct ksmbd_conn *)p; |
7032 |
+ struct ksmbd_transport *t = conn->transport; |
7033 |
+- unsigned int pdu_size; |
7034 |
++ unsigned int pdu_size, max_allowed_pdu_size; |
7035 |
+ char hdr_buf[4] = {0,}; |
7036 |
+ int size; |
7037 |
+ |
7038 |
+@@ -299,13 +299,26 @@ int ksmbd_conn_handler_loop(void *p) |
7039 |
+ pdu_size = get_rfc1002_len(hdr_buf); |
7040 |
+ ksmbd_debug(CONN, "RFC1002 header %u bytes\n", pdu_size); |
7041 |
+ |
7042 |
++ if (conn->status == KSMBD_SESS_GOOD) |
7043 |
++ max_allowed_pdu_size = |
7044 |
++ SMB3_MAX_MSGSIZE + conn->vals->max_write_size; |
7045 |
++ else |
7046 |
++ max_allowed_pdu_size = SMB3_MAX_MSGSIZE; |
7047 |
++ |
7048 |
++ if (pdu_size > max_allowed_pdu_size) { |
7049 |
++ pr_err_ratelimited("PDU length(%u) excceed maximum allowed pdu size(%u) on connection(%d)\n", |
7050 |
++ pdu_size, max_allowed_pdu_size, |
7051 |
++ conn->status); |
7052 |
++ break; |
7053 |
++ } |
7054 |
++ |
7055 |
+ /* |
7056 |
+ * Check if pdu size is valid (min : smb header size, |
7057 |
+ * max : 0x00FFFFFF). |
7058 |
+ */ |
7059 |
+ if (pdu_size < __SMB2_HEADER_STRUCTURE_SIZE || |
7060 |
+ pdu_size > MAX_STREAM_PROT_LEN) { |
7061 |
+- continue; |
7062 |
++ break; |
7063 |
+ } |
7064 |
+ |
7065 |
+ /* 4 for rfc1002 length field */ |
7066 |
+diff --git a/fs/ksmbd/ksmbd_netlink.h b/fs/ksmbd/ksmbd_netlink.h |
7067 |
+index 71bfb7de44725..fae859d59c792 100644 |
7068 |
+--- a/fs/ksmbd/ksmbd_netlink.h |
7069 |
++++ b/fs/ksmbd/ksmbd_netlink.h |
7070 |
+@@ -104,7 +104,9 @@ struct ksmbd_startup_request { |
7071 |
+ */ |
7072 |
+ __u32 sub_auth[3]; /* Subauth value for Security ID */ |
7073 |
+ __u32 smb2_max_credits; /* MAX credits */ |
7074 |
+- __u32 reserved[128]; /* Reserved room */ |
7075 |
++ __u32 smbd_max_io_size; /* smbd read write size */ |
7076 |
++ __u32 max_connections; /* Number of maximum simultaneous connections */ |
7077 |
++ __u32 reserved[126]; /* Reserved room */ |
7078 |
+ __u32 ifc_list_sz; /* interfaces list size */ |
7079 |
+ __s8 ____payload[]; |
7080 |
+ }; |
7081 |
+diff --git a/fs/ksmbd/ndr.c b/fs/ksmbd/ndr.c |
7082 |
+index 5052be9261d91..28f44f0c918c9 100644 |
7083 |
+--- a/fs/ksmbd/ndr.c |
7084 |
++++ b/fs/ksmbd/ndr.c |
7085 |
+@@ -242,7 +242,7 @@ int ndr_decode_dos_attr(struct ndr *n, struct xattr_dos_attrib *da) |
7086 |
+ return ret; |
7087 |
+ |
7088 |
+ if (da->version != 3 && da->version != 4) { |
7089 |
+- pr_err("v%d version is not supported\n", da->version); |
7090 |
++ ksmbd_debug(VFS, "v%d version is not supported\n", da->version); |
7091 |
+ return -EINVAL; |
7092 |
+ } |
7093 |
+ |
7094 |
+@@ -251,7 +251,7 @@ int ndr_decode_dos_attr(struct ndr *n, struct xattr_dos_attrib *da) |
7095 |
+ return ret; |
7096 |
+ |
7097 |
+ if (da->version != version2) { |
7098 |
+- pr_err("ndr version mismatched(version: %d, version2: %d)\n", |
7099 |
++ ksmbd_debug(VFS, "ndr version mismatched(version: %d, version2: %d)\n", |
7100 |
+ da->version, version2); |
7101 |
+ return -EINVAL; |
7102 |
+ } |
7103 |
+@@ -453,7 +453,7 @@ int ndr_decode_v4_ntacl(struct ndr *n, struct xattr_ntacl *acl) |
7104 |
+ if (ret) |
7105 |
+ return ret; |
7106 |
+ if (acl->version != 4) { |
7107 |
+- pr_err("v%d version is not supported\n", acl->version); |
7108 |
++ ksmbd_debug(VFS, "v%d version is not supported\n", acl->version); |
7109 |
+ return -EINVAL; |
7110 |
+ } |
7111 |
+ |
7112 |
+@@ -461,7 +461,7 @@ int ndr_decode_v4_ntacl(struct ndr *n, struct xattr_ntacl *acl) |
7113 |
+ if (ret) |
7114 |
+ return ret; |
7115 |
+ if (acl->version != version2) { |
7116 |
+- pr_err("ndr version mismatched(version: %d, version2: %d)\n", |
7117 |
++ ksmbd_debug(VFS, "ndr version mismatched(version: %d, version2: %d)\n", |
7118 |
+ acl->version, version2); |
7119 |
+ return -EINVAL; |
7120 |
+ } |
7121 |
+diff --git a/fs/ksmbd/server.h b/fs/ksmbd/server.h |
7122 |
+index ac9d932f8c8aa..db72781817603 100644 |
7123 |
+--- a/fs/ksmbd/server.h |
7124 |
++++ b/fs/ksmbd/server.h |
7125 |
+@@ -41,6 +41,7 @@ struct ksmbd_server_config { |
7126 |
+ unsigned int share_fake_fscaps; |
7127 |
+ struct smb_sid domain_sid; |
7128 |
+ unsigned int auth_mechs; |
7129 |
++ unsigned int max_connections; |
7130 |
+ |
7131 |
+ char *conf[SERVER_CONF_WORK_GROUP + 1]; |
7132 |
+ }; |
7133 |
+diff --git a/fs/ksmbd/smb2pdu.c b/fs/ksmbd/smb2pdu.c |
7134 |
+index 65c85ca71ebe0..ac029dfd23ab8 100644 |
7135 |
+--- a/fs/ksmbd/smb2pdu.c |
7136 |
++++ b/fs/ksmbd/smb2pdu.c |
7137 |
+@@ -8613,6 +8613,7 @@ int smb3_decrypt_req(struct ksmbd_work *work) |
7138 |
+ bool smb3_11_final_sess_setup_resp(struct ksmbd_work *work) |
7139 |
+ { |
7140 |
+ struct ksmbd_conn *conn = work->conn; |
7141 |
++ struct ksmbd_session *sess = work->sess; |
7142 |
+ struct smb2_hdr *rsp = work->response_buf; |
7143 |
+ |
7144 |
+ if (conn->dialect < SMB30_PROT_ID) |
7145 |
+@@ -8622,6 +8623,7 @@ bool smb3_11_final_sess_setup_resp(struct ksmbd_work *work) |
7146 |
+ rsp = ksmbd_resp_buf_next(work); |
7147 |
+ |
7148 |
+ if (le16_to_cpu(rsp->Command) == SMB2_SESSION_SETUP_HE && |
7149 |
++ sess->user && !user_guest(sess->user) && |
7150 |
+ rsp->Status == STATUS_SUCCESS) |
7151 |
+ return true; |
7152 |
+ return false; |
7153 |
+diff --git a/fs/ksmbd/smb2pdu.h b/fs/ksmbd/smb2pdu.h |
7154 |
+index 4f8574944ac19..ddc3cea9c9055 100644 |
7155 |
+--- a/fs/ksmbd/smb2pdu.h |
7156 |
++++ b/fs/ksmbd/smb2pdu.h |
7157 |
+@@ -113,8 +113,9 @@ |
7158 |
+ #define SMB21_DEFAULT_IOSIZE (1024 * 1024) |
7159 |
+ #define SMB3_DEFAULT_IOSIZE (4 * 1024 * 1024) |
7160 |
+ #define SMB3_DEFAULT_TRANS_SIZE (1024 * 1024) |
7161 |
+-#define SMB3_MIN_IOSIZE (64 * 1024) |
7162 |
+-#define SMB3_MAX_IOSIZE (8 * 1024 * 1024) |
7163 |
++#define SMB3_MIN_IOSIZE (64 * 1024) |
7164 |
++#define SMB3_MAX_IOSIZE (8 * 1024 * 1024) |
7165 |
++#define SMB3_MAX_MSGSIZE (4 * 4096) |
7166 |
+ |
7167 |
+ /* |
7168 |
+ * SMB2 Header Definition |
7169 |
+diff --git a/fs/ksmbd/transport_ipc.c b/fs/ksmbd/transport_ipc.c |
7170 |
+index 3ad6881e0f7ed..a8313eed4f10d 100644 |
7171 |
+--- a/fs/ksmbd/transport_ipc.c |
7172 |
++++ b/fs/ksmbd/transport_ipc.c |
7173 |
+@@ -26,6 +26,7 @@ |
7174 |
+ #include "mgmt/ksmbd_ida.h" |
7175 |
+ #include "connection.h" |
7176 |
+ #include "transport_tcp.h" |
7177 |
++#include "transport_rdma.h" |
7178 |
+ |
7179 |
+ #define IPC_WAIT_TIMEOUT (2 * HZ) |
7180 |
+ |
7181 |
+@@ -303,6 +304,11 @@ static int ipc_server_config_on_startup(struct ksmbd_startup_request *req) |
7182 |
+ init_smb2_max_trans_size(req->smb2_max_trans); |
7183 |
+ if (req->smb2_max_credits) |
7184 |
+ init_smb2_max_credits(req->smb2_max_credits); |
7185 |
++ if (req->smbd_max_io_size) |
7186 |
++ init_smbd_max_io_size(req->smbd_max_io_size); |
7187 |
++ |
7188 |
++ if (req->max_connections) |
7189 |
++ server_conf.max_connections = req->max_connections; |
7190 |
+ |
7191 |
+ ret = ksmbd_set_netbios_name(req->netbios_name); |
7192 |
+ ret |= ksmbd_set_server_string(req->server_string); |
7193 |
+diff --git a/fs/ksmbd/transport_rdma.c b/fs/ksmbd/transport_rdma.c |
7194 |
+index a2fd5a4d4cd5e..9d67419929d6c 100644 |
7195 |
+--- a/fs/ksmbd/transport_rdma.c |
7196 |
++++ b/fs/ksmbd/transport_rdma.c |
7197 |
+@@ -75,7 +75,7 @@ static int smb_direct_max_fragmented_recv_size = 1024 * 1024; |
7198 |
+ /* The maximum single-message size which can be received */ |
7199 |
+ static int smb_direct_max_receive_size = 8192; |
7200 |
+ |
7201 |
+-static int smb_direct_max_read_write_size = 1024 * 1024; |
7202 |
++static int smb_direct_max_read_write_size = SMBD_DEFAULT_IOSIZE; |
7203 |
+ |
7204 |
+ static int smb_direct_max_outstanding_rw_ops = 8; |
7205 |
+ |
7206 |
+@@ -201,6 +201,12 @@ struct smb_direct_rdma_rw_msg { |
7207 |
+ struct scatterlist sg_list[0]; |
7208 |
+ }; |
7209 |
+ |
7210 |
++void init_smbd_max_io_size(unsigned int sz) |
7211 |
++{ |
7212 |
++ sz = clamp_val(sz, SMBD_MIN_IOSIZE, SMBD_MAX_IOSIZE); |
7213 |
++ smb_direct_max_read_write_size = sz; |
7214 |
++} |
7215 |
++ |
7216 |
+ static inline int get_buf_page_count(void *buf, int size) |
7217 |
+ { |
7218 |
+ return DIV_ROUND_UP((uintptr_t)buf + size, PAGE_SIZE) - |
7219 |
+diff --git a/fs/ksmbd/transport_rdma.h b/fs/ksmbd/transport_rdma.h |
7220 |
+index 0fa8adc0776f2..04a7a37685c34 100644 |
7221 |
+--- a/fs/ksmbd/transport_rdma.h |
7222 |
++++ b/fs/ksmbd/transport_rdma.h |
7223 |
+@@ -9,6 +9,10 @@ |
7224 |
+ |
7225 |
+ #define SMB_DIRECT_PORT 5445 |
7226 |
+ |
7227 |
++#define SMBD_DEFAULT_IOSIZE (8 * 1024 * 1024) |
7228 |
++#define SMBD_MIN_IOSIZE (512 * 1024) |
7229 |
++#define SMBD_MAX_IOSIZE (16 * 1024 * 1024) |
7230 |
++ |
7231 |
+ /* SMB DIRECT negotiation request packet [MS-SMBD] 2.2.1 */ |
7232 |
+ struct smb_direct_negotiate_req { |
7233 |
+ __le16 min_version; |
7234 |
+@@ -54,10 +58,12 @@ struct smb_direct_data_transfer { |
7235 |
+ int ksmbd_rdma_init(void); |
7236 |
+ int ksmbd_rdma_destroy(void); |
7237 |
+ bool ksmbd_rdma_capable_netdev(struct net_device *netdev); |
7238 |
++void init_smbd_max_io_size(unsigned int sz); |
7239 |
+ #else |
7240 |
+ static inline int ksmbd_rdma_init(void) { return 0; } |
7241 |
+ static inline int ksmbd_rdma_destroy(void) { return 0; } |
7242 |
+ static inline bool ksmbd_rdma_capable_netdev(struct net_device *netdev) { return false; } |
7243 |
++static inline void init_smbd_max_io_size(unsigned int sz) { } |
7244 |
+ #endif |
7245 |
+ |
7246 |
+ #endif /* __KSMBD_TRANSPORT_RDMA_H__ */ |
7247 |
+diff --git a/fs/ksmbd/transport_tcp.c b/fs/ksmbd/transport_tcp.c |
7248 |
+index 293af921f2ad4..e0ca6cc04b91c 100644 |
7249 |
+--- a/fs/ksmbd/transport_tcp.c |
7250 |
++++ b/fs/ksmbd/transport_tcp.c |
7251 |
+@@ -15,6 +15,8 @@ |
7252 |
+ #define IFACE_STATE_DOWN BIT(0) |
7253 |
+ #define IFACE_STATE_CONFIGURED BIT(1) |
7254 |
+ |
7255 |
++static atomic_t active_num_conn; |
7256 |
++ |
7257 |
+ struct interface { |
7258 |
+ struct task_struct *ksmbd_kthread; |
7259 |
+ struct socket *ksmbd_socket; |
7260 |
+@@ -185,8 +187,10 @@ static int ksmbd_tcp_new_connection(struct socket *client_sk) |
7261 |
+ struct tcp_transport *t; |
7262 |
+ |
7263 |
+ t = alloc_transport(client_sk); |
7264 |
+- if (!t) |
7265 |
++ if (!t) { |
7266 |
++ sock_release(client_sk); |
7267 |
+ return -ENOMEM; |
7268 |
++ } |
7269 |
+ |
7270 |
+ csin = KSMBD_TCP_PEER_SOCKADDR(KSMBD_TRANS(t)->conn); |
7271 |
+ if (kernel_getpeername(client_sk, csin) < 0) { |
7272 |
+@@ -239,6 +243,15 @@ static int ksmbd_kthread_fn(void *p) |
7273 |
+ continue; |
7274 |
+ } |
7275 |
+ |
7276 |
++ if (server_conf.max_connections && |
7277 |
++ atomic_inc_return(&active_num_conn) >= server_conf.max_connections) { |
7278 |
++ pr_info_ratelimited("Limit the maximum number of connections(%u)\n", |
7279 |
++ atomic_read(&active_num_conn)); |
7280 |
++ atomic_dec(&active_num_conn); |
7281 |
++ sock_release(client_sk); |
7282 |
++ continue; |
7283 |
++ } |
7284 |
++ |
7285 |
+ ksmbd_debug(CONN, "connect success: accepted new connection\n"); |
7286 |
+ client_sk->sk->sk_rcvtimeo = KSMBD_TCP_RECV_TIMEOUT; |
7287 |
+ client_sk->sk->sk_sndtimeo = KSMBD_TCP_SEND_TIMEOUT; |
7288 |
+@@ -368,6 +381,8 @@ static int ksmbd_tcp_writev(struct ksmbd_transport *t, struct kvec *iov, |
7289 |
+ static void ksmbd_tcp_disconnect(struct ksmbd_transport *t) |
7290 |
+ { |
7291 |
+ free_transport(TCP_TRANS(t)); |
7292 |
++ if (server_conf.max_connections) |
7293 |
++ atomic_dec(&active_num_conn); |
7294 |
+ } |
7295 |
+ |
7296 |
+ static void tcp_destroy_socket(struct socket *ksmbd_socket) |
7297 |
+diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c |
7298 |
+index 09dd70f791581..0a900b9e39eac 100644 |
7299 |
+--- a/fs/nfsd/nfs4proc.c |
7300 |
++++ b/fs/nfsd/nfs4proc.c |
7301 |
+@@ -1205,6 +1205,7 @@ try_again: |
7302 |
+ /* allow 20secs for mount/unmount for now - revisit */ |
7303 |
+ if (signal_pending(current) || |
7304 |
+ (schedule_timeout(20*HZ) == 0)) { |
7305 |
++ finish_wait(&nn->nfsd_ssc_waitq, &wait); |
7306 |
+ kfree(work); |
7307 |
+ return nfserr_eagain; |
7308 |
+ } |
7309 |
+diff --git a/fs/overlayfs/copy_up.c b/fs/overlayfs/copy_up.c |
7310 |
+index e040970408d4f..ef0bf98b620d7 100644 |
7311 |
+--- a/fs/overlayfs/copy_up.c |
7312 |
++++ b/fs/overlayfs/copy_up.c |
7313 |
+@@ -960,6 +960,10 @@ static int ovl_copy_up_one(struct dentry *parent, struct dentry *dentry, |
7314 |
+ if (err) |
7315 |
+ return err; |
7316 |
+ |
7317 |
++ if (!kuid_has_mapping(current_user_ns(), ctx.stat.uid) || |
7318 |
++ !kgid_has_mapping(current_user_ns(), ctx.stat.gid)) |
7319 |
++ return -EOVERFLOW; |
7320 |
++ |
7321 |
+ ctx.metacopy = ovl_need_meta_copy_up(dentry, ctx.stat.mode, flags); |
7322 |
+ |
7323 |
+ if (parent) { |
7324 |
+diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c |
7325 |
+index 013fc5931bc37..0b7a00ed6c49b 100644 |
7326 |
+--- a/fs/proc/proc_sysctl.c |
7327 |
++++ b/fs/proc/proc_sysctl.c |
7328 |
+@@ -16,6 +16,7 @@ |
7329 |
+ #include <linux/module.h> |
7330 |
+ #include <linux/bpf-cgroup.h> |
7331 |
+ #include <linux/mount.h> |
7332 |
++#include <linux/kmemleak.h> |
7333 |
+ #include "internal.h" |
7334 |
+ |
7335 |
+ static const struct dentry_operations proc_sys_dentry_operations; |
7336 |
+@@ -1384,6 +1385,38 @@ struct ctl_table_header *register_sysctl(const char *path, struct ctl_table *tab |
7337 |
+ } |
7338 |
+ EXPORT_SYMBOL(register_sysctl); |
7339 |
+ |
7340 |
++/** |
7341 |
++ * __register_sysctl_init() - register sysctl table to path |
7342 |
++ * @path: path name for sysctl base |
7343 |
++ * @table: This is the sysctl table that needs to be registered to the path |
7344 |
++ * @table_name: The name of sysctl table, only used for log printing when |
7345 |
++ * registration fails |
7346 |
++ * |
7347 |
++ * The sysctl interface is used by userspace to query or modify at runtime |
7348 |
++ * a predefined value set on a variable. These variables however have default |
7349 |
++ * values pre-set. Code which depends on these variables will always work even |
7350 |
++ * if register_sysctl() fails. If register_sysctl() fails you'd just loose the |
7351 |
++ * ability to query or modify the sysctls dynamically at run time. Chances of |
7352 |
++ * register_sysctl() failing on init are extremely low, and so for both reasons |
7353 |
++ * this function does not return any error as it is used by initialization code. |
7354 |
++ * |
7355 |
++ * Context: Can only be called after your respective sysctl base path has been |
7356 |
++ * registered. So for instance, most base directories are registered early on |
7357 |
++ * init before init levels are processed through proc_sys_init() and |
7358 |
++ * sysctl_init(). |
7359 |
++ */ |
7360 |
++void __init __register_sysctl_init(const char *path, struct ctl_table *table, |
7361 |
++ const char *table_name) |
7362 |
++{ |
7363 |
++ struct ctl_table_header *hdr = register_sysctl(path, table); |
7364 |
++ |
7365 |
++ if (unlikely(!hdr)) { |
7366 |
++ pr_err("failed when register_sysctl %s to %s\n", table_name, path); |
7367 |
++ return; |
7368 |
++ } |
7369 |
++ kmemleak_not_leak(hdr); |
7370 |
++} |
7371 |
++ |
7372 |
+ static char *append_path(const char *path, char *pos, const char *name) |
7373 |
+ { |
7374 |
+ int namelen; |
7375 |
+diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c |
7376 |
+index 58481f8d63d5b..f7b05c6b3dcf4 100644 |
7377 |
+--- a/fs/reiserfs/super.c |
7378 |
++++ b/fs/reiserfs/super.c |
7379 |
+@@ -1437,7 +1437,6 @@ static int reiserfs_remount(struct super_block *s, int *mount_flags, char *arg) |
7380 |
+ unsigned long safe_mask = 0; |
7381 |
+ unsigned int commit_max_age = (unsigned int)-1; |
7382 |
+ struct reiserfs_journal *journal = SB_JOURNAL(s); |
7383 |
+- char *new_opts; |
7384 |
+ int err; |
7385 |
+ char *qf_names[REISERFS_MAXQUOTAS]; |
7386 |
+ unsigned int qfmt = 0; |
7387 |
+@@ -1445,10 +1444,6 @@ static int reiserfs_remount(struct super_block *s, int *mount_flags, char *arg) |
7388 |
+ int i; |
7389 |
+ #endif |
7390 |
+ |
7391 |
+- new_opts = kstrdup(arg, GFP_KERNEL); |
7392 |
+- if (arg && !new_opts) |
7393 |
+- return -ENOMEM; |
7394 |
+- |
7395 |
+ sync_filesystem(s); |
7396 |
+ reiserfs_write_lock(s); |
7397 |
+ |
7398 |
+@@ -1599,7 +1594,6 @@ out_ok_unlocked: |
7399 |
+ out_err_unlock: |
7400 |
+ reiserfs_write_unlock(s); |
7401 |
+ out_err: |
7402 |
+- kfree(new_opts); |
7403 |
+ return err; |
7404 |
+ } |
7405 |
+ |
7406 |
+diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h |
7407 |
+index 66a1f495f01a6..025391be1b199 100644 |
7408 |
+--- a/include/linux/cpufreq.h |
7409 |
++++ b/include/linux/cpufreq.h |
7410 |
+@@ -643,6 +643,11 @@ struct gov_attr_set { |
7411 |
+ /* sysfs ops for cpufreq governors */ |
7412 |
+ extern const struct sysfs_ops governor_sysfs_ops; |
7413 |
+ |
7414 |
++static inline struct gov_attr_set *to_gov_attr_set(struct kobject *kobj) |
7415 |
++{ |
7416 |
++ return container_of(kobj, struct gov_attr_set, kobj); |
7417 |
++} |
7418 |
++ |
7419 |
+ void gov_attr_set_init(struct gov_attr_set *attr_set, struct list_head *list_node); |
7420 |
+ void gov_attr_set_get(struct gov_attr_set *attr_set, struct list_head *list_node); |
7421 |
+ unsigned int gov_attr_set_put(struct gov_attr_set *attr_set, struct list_head *list_node); |
7422 |
+diff --git a/include/linux/gpio/driver.h b/include/linux/gpio/driver.h |
7423 |
+index ad479db8f0aac..11c26ae7b4fa4 100644 |
7424 |
+--- a/include/linux/gpio/driver.h |
7425 |
++++ b/include/linux/gpio/driver.h |
7426 |
+@@ -425,7 +425,7 @@ struct gpio_chip { |
7427 |
+ void __iomem *reg_dir_in; |
7428 |
+ bool bgpio_dir_unreadable; |
7429 |
+ int bgpio_bits; |
7430 |
+- spinlock_t bgpio_lock; |
7431 |
++ raw_spinlock_t bgpio_lock; |
7432 |
+ unsigned long bgpio_data; |
7433 |
+ unsigned long bgpio_dir; |
7434 |
+ #endif /* CONFIG_GPIO_GENERIC */ |
7435 |
+diff --git a/include/linux/panic.h b/include/linux/panic.h |
7436 |
+index f5844908a089e..8eb5897c164fc 100644 |
7437 |
+--- a/include/linux/panic.h |
7438 |
++++ b/include/linux/panic.h |
7439 |
+@@ -11,16 +11,11 @@ extern long (*panic_blink)(int state); |
7440 |
+ __printf(1, 2) |
7441 |
+ void panic(const char *fmt, ...) __noreturn __cold; |
7442 |
+ void nmi_panic(struct pt_regs *regs, const char *msg); |
7443 |
++void check_panic_on_warn(const char *origin); |
7444 |
+ extern void oops_enter(void); |
7445 |
+ extern void oops_exit(void); |
7446 |
+ extern bool oops_may_print(void); |
7447 |
+ |
7448 |
+-#ifdef CONFIG_SMP |
7449 |
+-extern unsigned int sysctl_oops_all_cpu_backtrace; |
7450 |
+-#else |
7451 |
+-#define sysctl_oops_all_cpu_backtrace 0 |
7452 |
+-#endif /* CONFIG_SMP */ |
7453 |
+- |
7454 |
+ extern int panic_timeout; |
7455 |
+ extern unsigned long panic_print; |
7456 |
+ extern int panic_on_oops; |
7457 |
+diff --git a/include/linux/sched/task.h b/include/linux/sched/task.h |
7458 |
+index caae8e045160d..d351f1b362ef9 100644 |
7459 |
+--- a/include/linux/sched/task.h |
7460 |
++++ b/include/linux/sched/task.h |
7461 |
+@@ -59,6 +59,7 @@ extern void sched_post_fork(struct task_struct *p); |
7462 |
+ extern void sched_dead(struct task_struct *p); |
7463 |
+ |
7464 |
+ void __noreturn do_task_dead(void); |
7465 |
++void __noreturn make_task_dead(int signr); |
7466 |
+ |
7467 |
+ extern void proc_caches_init(void); |
7468 |
+ |
7469 |
+diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h |
7470 |
+index fa372b4c23132..47cf70c8eb93c 100644 |
7471 |
+--- a/include/linux/sysctl.h |
7472 |
++++ b/include/linux/sysctl.h |
7473 |
+@@ -206,6 +206,9 @@ struct ctl_table_header *register_sysctl_paths(const struct ctl_path *path, |
7474 |
+ void unregister_sysctl_table(struct ctl_table_header * table); |
7475 |
+ |
7476 |
+ extern int sysctl_init(void); |
7477 |
++extern void __register_sysctl_init(const char *path, struct ctl_table *table, |
7478 |
++ const char *table_name); |
7479 |
++#define register_sysctl_init(path, table) __register_sysctl_init(path, table, #table) |
7480 |
+ void do_sysctl_args(void); |
7481 |
+ |
7482 |
+ extern int pwrsw_enabled; |
7483 |
+diff --git a/include/linux/thermal.h b/include/linux/thermal.h |
7484 |
+index c314893970b35..b94314ed0c965 100644 |
7485 |
+--- a/include/linux/thermal.h |
7486 |
++++ b/include/linux/thermal.h |
7487 |
+@@ -92,6 +92,7 @@ struct thermal_cooling_device_ops { |
7488 |
+ struct thermal_cooling_device { |
7489 |
+ int id; |
7490 |
+ char *type; |
7491 |
++ unsigned long max_state; |
7492 |
+ struct device device; |
7493 |
+ struct device_node *np; |
7494 |
+ void *devdata; |
7495 |
+@@ -113,7 +114,7 @@ struct thermal_cooling_device { |
7496 |
+ * @trip_hyst_attrs: attributes for trip points for sysfs: trip hysteresis |
7497 |
+ * @mode: current mode of this thermal zone |
7498 |
+ * @devdata: private pointer for device private data |
7499 |
+- * @trips: number of trip points the thermal zone supports |
7500 |
++ * @num_trips: number of trip points the thermal zone supports |
7501 |
+ * @trips_disabled; bitmap for disabled trips |
7502 |
+ * @passive_delay_jiffies: number of jiffies to wait between polls when |
7503 |
+ * performing passive cooling. |
7504 |
+@@ -153,7 +154,7 @@ struct thermal_zone_device { |
7505 |
+ struct thermal_attr *trip_hyst_attrs; |
7506 |
+ enum thermal_device_mode mode; |
7507 |
+ void *devdata; |
7508 |
+- int trips; |
7509 |
++ int num_trips; |
7510 |
+ unsigned long trips_disabled; /* bitmap for disabled trips */ |
7511 |
+ unsigned long passive_delay_jiffies; |
7512 |
+ unsigned long polling_delay_jiffies; |
7513 |
+diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h |
7514 |
+index 891b44d80c982..6906da5c733ea 100644 |
7515 |
+--- a/include/net/sch_generic.h |
7516 |
++++ b/include/net/sch_generic.h |
7517 |
+@@ -1335,4 +1335,11 @@ void mini_qdisc_pair_block_init(struct mini_Qdisc_pair *miniqp, |
7518 |
+ |
7519 |
+ int sch_frag_xmit_hook(struct sk_buff *skb, int (*xmit)(struct sk_buff *skb)); |
7520 |
+ |
7521 |
++/* Make sure qdisc is no longer in SCHED state. */ |
7522 |
++static inline void qdisc_synchronize(const struct Qdisc *q) |
7523 |
++{ |
7524 |
++ while (test_bit(__QDISC_STATE_SCHED, &q->state)) |
7525 |
++ msleep(1); |
7526 |
++} |
7527 |
++ |
7528 |
+ #endif |
7529 |
+diff --git a/include/net/sock.h b/include/net/sock.h |
7530 |
+index e1a303e4f0f7e..3e9db5146765f 100644 |
7531 |
+--- a/include/net/sock.h |
7532 |
++++ b/include/net/sock.h |
7533 |
+@@ -323,7 +323,7 @@ struct bpf_local_storage; |
7534 |
+ * @sk_tskey: counter to disambiguate concurrent tstamp requests |
7535 |
+ * @sk_zckey: counter to order MSG_ZEROCOPY notifications |
7536 |
+ * @sk_socket: Identd and reporting IO signals |
7537 |
+- * @sk_user_data: RPC layer private data |
7538 |
++ * @sk_user_data: RPC layer private data. Write-protected by @sk_callback_lock. |
7539 |
+ * @sk_frag: cached page frag |
7540 |
+ * @sk_peek_off: current peek_offset value |
7541 |
+ * @sk_send_head: front of stuff to transmit |
7542 |
+diff --git a/include/scsi/scsi_transport_iscsi.h b/include/scsi/scsi_transport_iscsi.h |
7543 |
+index 0f2f149ad916c..304ccf1539285 100644 |
7544 |
+--- a/include/scsi/scsi_transport_iscsi.h |
7545 |
++++ b/include/scsi/scsi_transport_iscsi.h |
7546 |
+@@ -236,6 +236,14 @@ enum { |
7547 |
+ ISCSI_SESSION_FREE, |
7548 |
+ }; |
7549 |
+ |
7550 |
++enum { |
7551 |
++ ISCSI_SESSION_TARGET_UNBOUND, |
7552 |
++ ISCSI_SESSION_TARGET_ALLOCATED, |
7553 |
++ ISCSI_SESSION_TARGET_SCANNED, |
7554 |
++ ISCSI_SESSION_TARGET_UNBINDING, |
7555 |
++ ISCSI_SESSION_TARGET_MAX, |
7556 |
++}; |
7557 |
++ |
7558 |
+ #define ISCSI_MAX_TARGET -1 |
7559 |
+ |
7560 |
+ struct iscsi_cls_session { |
7561 |
+@@ -262,6 +270,7 @@ struct iscsi_cls_session { |
7562 |
+ */ |
7563 |
+ pid_t creator; |
7564 |
+ int state; |
7565 |
++ int target_state; /* session target bind state */ |
7566 |
+ int sid; /* session id */ |
7567 |
+ void *dd_data; /* LLD private data */ |
7568 |
+ struct device dev; /* sysfs transport/container device */ |
7569 |
+diff --git a/include/uapi/linux/netfilter/nf_conntrack_sctp.h b/include/uapi/linux/netfilter/nf_conntrack_sctp.h |
7570 |
+index edc6ddab0de6a..2d6f80d75ae74 100644 |
7571 |
+--- a/include/uapi/linux/netfilter/nf_conntrack_sctp.h |
7572 |
++++ b/include/uapi/linux/netfilter/nf_conntrack_sctp.h |
7573 |
+@@ -15,7 +15,7 @@ enum sctp_conntrack { |
7574 |
+ SCTP_CONNTRACK_SHUTDOWN_RECD, |
7575 |
+ SCTP_CONNTRACK_SHUTDOWN_ACK_SENT, |
7576 |
+ SCTP_CONNTRACK_HEARTBEAT_SENT, |
7577 |
+- SCTP_CONNTRACK_HEARTBEAT_ACKED, |
7578 |
++ SCTP_CONNTRACK_HEARTBEAT_ACKED, /* no longer used */ |
7579 |
+ SCTP_CONNTRACK_MAX |
7580 |
+ }; |
7581 |
+ |
7582 |
+diff --git a/include/uapi/linux/netfilter/nfnetlink_cttimeout.h b/include/uapi/linux/netfilter/nfnetlink_cttimeout.h |
7583 |
+index 6b20fb22717b2..aa805e6d4e284 100644 |
7584 |
+--- a/include/uapi/linux/netfilter/nfnetlink_cttimeout.h |
7585 |
++++ b/include/uapi/linux/netfilter/nfnetlink_cttimeout.h |
7586 |
+@@ -94,7 +94,7 @@ enum ctattr_timeout_sctp { |
7587 |
+ CTA_TIMEOUT_SCTP_SHUTDOWN_RECD, |
7588 |
+ CTA_TIMEOUT_SCTP_SHUTDOWN_ACK_SENT, |
7589 |
+ CTA_TIMEOUT_SCTP_HEARTBEAT_SENT, |
7590 |
+- CTA_TIMEOUT_SCTP_HEARTBEAT_ACKED, |
7591 |
++ CTA_TIMEOUT_SCTP_HEARTBEAT_ACKED, /* no longer used */ |
7592 |
+ __CTA_TIMEOUT_SCTP_MAX |
7593 |
+ }; |
7594 |
+ #define CTA_TIMEOUT_SCTP_MAX (__CTA_TIMEOUT_SCTP_MAX - 1) |
7595 |
+diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c |
7596 |
+index 488225bb42f63..49e51fc0c2f40 100644 |
7597 |
+--- a/kernel/bpf/verifier.c |
7598 |
++++ b/kernel/bpf/verifier.c |
7599 |
+@@ -2653,7 +2653,9 @@ static int check_stack_write_fixed_off(struct bpf_verifier_env *env, |
7600 |
+ bool sanitize = reg && is_spillable_regtype(reg->type); |
7601 |
+ |
7602 |
+ for (i = 0; i < size; i++) { |
7603 |
+- if (state->stack[spi].slot_type[i] == STACK_INVALID) { |
7604 |
++ u8 type = state->stack[spi].slot_type[i]; |
7605 |
++ |
7606 |
++ if (type != STACK_MISC && type != STACK_ZERO) { |
7607 |
+ sanitize = true; |
7608 |
+ break; |
7609 |
+ } |
7610 |
+diff --git a/kernel/exit.c b/kernel/exit.c |
7611 |
+index aefe7445508db..80efdfda6662b 100644 |
7612 |
+--- a/kernel/exit.c |
7613 |
++++ b/kernel/exit.c |
7614 |
+@@ -64,11 +64,58 @@ |
7615 |
+ #include <linux/rcuwait.h> |
7616 |
+ #include <linux/compat.h> |
7617 |
+ #include <linux/io_uring.h> |
7618 |
++#include <linux/sysfs.h> |
7619 |
+ |
7620 |
+ #include <linux/uaccess.h> |
7621 |
+ #include <asm/unistd.h> |
7622 |
+ #include <asm/mmu_context.h> |
7623 |
+ |
7624 |
++/* |
7625 |
++ * The default value should be high enough to not crash a system that randomly |
7626 |
++ * crashes its kernel from time to time, but low enough to at least not permit |
7627 |
++ * overflowing 32-bit refcounts or the ldsem writer count. |
7628 |
++ */ |
7629 |
++static unsigned int oops_limit = 10000; |
7630 |
++ |
7631 |
++#ifdef CONFIG_SYSCTL |
7632 |
++static struct ctl_table kern_exit_table[] = { |
7633 |
++ { |
7634 |
++ .procname = "oops_limit", |
7635 |
++ .data = &oops_limit, |
7636 |
++ .maxlen = sizeof(oops_limit), |
7637 |
++ .mode = 0644, |
7638 |
++ .proc_handler = proc_douintvec, |
7639 |
++ }, |
7640 |
++ { } |
7641 |
++}; |
7642 |
++ |
7643 |
++static __init int kernel_exit_sysctls_init(void) |
7644 |
++{ |
7645 |
++ register_sysctl_init("kernel", kern_exit_table); |
7646 |
++ return 0; |
7647 |
++} |
7648 |
++late_initcall(kernel_exit_sysctls_init); |
7649 |
++#endif |
7650 |
++ |
7651 |
++static atomic_t oops_count = ATOMIC_INIT(0); |
7652 |
++ |
7653 |
++#ifdef CONFIG_SYSFS |
7654 |
++static ssize_t oops_count_show(struct kobject *kobj, struct kobj_attribute *attr, |
7655 |
++ char *page) |
7656 |
++{ |
7657 |
++ return sysfs_emit(page, "%d\n", atomic_read(&oops_count)); |
7658 |
++} |
7659 |
++ |
7660 |
++static struct kobj_attribute oops_count_attr = __ATTR_RO(oops_count); |
7661 |
++ |
7662 |
++static __init int kernel_exit_sysfs_init(void) |
7663 |
++{ |
7664 |
++ sysfs_add_file_to_group(kernel_kobj, &oops_count_attr.attr, NULL); |
7665 |
++ return 0; |
7666 |
++} |
7667 |
++late_initcall(kernel_exit_sysfs_init); |
7668 |
++#endif |
7669 |
++ |
7670 |
+ static void __unhash_process(struct task_struct *p, bool group_dead) |
7671 |
+ { |
7672 |
+ nr_threads--; |
7673 |
+@@ -877,6 +924,31 @@ void __noreturn do_exit(long code) |
7674 |
+ } |
7675 |
+ EXPORT_SYMBOL_GPL(do_exit); |
7676 |
+ |
7677 |
++void __noreturn make_task_dead(int signr) |
7678 |
++{ |
7679 |
++ /* |
7680 |
++ * Take the task off the cpu after something catastrophic has |
7681 |
++ * happened. |
7682 |
++ */ |
7683 |
++ unsigned int limit; |
7684 |
++ |
7685 |
++ /* |
7686 |
++ * Every time the system oopses, if the oops happens while a reference |
7687 |
++ * to an object was held, the reference leaks. |
7688 |
++ * If the oops doesn't also leak memory, repeated oopsing can cause |
7689 |
++ * reference counters to wrap around (if they're not using refcount_t). |
7690 |
++ * This means that repeated oopsing can make unexploitable-looking bugs |
7691 |
++ * exploitable through repeated oopsing. |
7692 |
++ * To make sure this can't happen, place an upper bound on how often the |
7693 |
++ * kernel may oops without panic(). |
7694 |
++ */ |
7695 |
++ limit = READ_ONCE(oops_limit); |
7696 |
++ if (atomic_inc_return(&oops_count) >= limit && limit) |
7697 |
++ panic("Oopsed too often (kernel.oops_limit is %d)", limit); |
7698 |
++ |
7699 |
++ do_exit(signr); |
7700 |
++} |
7701 |
++ |
7702 |
+ void complete_and_exit(struct completion *comp, long code) |
7703 |
+ { |
7704 |
+ if (comp) |
7705 |
+diff --git a/kernel/kcsan/kcsan_test.c b/kernel/kcsan/kcsan_test.c |
7706 |
+index dc55fd5a36fcc..8b176aeab91b6 100644 |
7707 |
+--- a/kernel/kcsan/kcsan_test.c |
7708 |
++++ b/kernel/kcsan/kcsan_test.c |
7709 |
+@@ -151,7 +151,7 @@ static bool report_matches(const struct expect_report *r) |
7710 |
+ const bool is_assert = (r->access[0].type | r->access[1].type) & KCSAN_ACCESS_ASSERT; |
7711 |
+ bool ret = false; |
7712 |
+ unsigned long flags; |
7713 |
+- typeof(observed.lines) expect; |
7714 |
++ typeof(*observed.lines) *expect; |
7715 |
+ const char *end; |
7716 |
+ char *cur; |
7717 |
+ int i; |
7718 |
+@@ -160,6 +160,10 @@ static bool report_matches(const struct expect_report *r) |
7719 |
+ if (!report_available()) |
7720 |
+ return false; |
7721 |
+ |
7722 |
++ expect = kmalloc(sizeof(observed.lines), GFP_KERNEL); |
7723 |
++ if (WARN_ON(!expect)) |
7724 |
++ return false; |
7725 |
++ |
7726 |
+ /* Generate expected report contents. */ |
7727 |
+ |
7728 |
+ /* Title */ |
7729 |
+@@ -243,6 +247,7 @@ static bool report_matches(const struct expect_report *r) |
7730 |
+ strstr(observed.lines[2], expect[1]))); |
7731 |
+ out: |
7732 |
+ spin_unlock_irqrestore(&observed.lock, flags); |
7733 |
++ kfree(expect); |
7734 |
+ return ret; |
7735 |
+ } |
7736 |
+ |
7737 |
+diff --git a/kernel/kcsan/report.c b/kernel/kcsan/report.c |
7738 |
+index 21137929d4283..b88d5d5f29e48 100644 |
7739 |
+--- a/kernel/kcsan/report.c |
7740 |
++++ b/kernel/kcsan/report.c |
7741 |
+@@ -432,8 +432,7 @@ static void print_report(enum kcsan_value_change value_change, |
7742 |
+ dump_stack_print_info(KERN_DEFAULT); |
7743 |
+ pr_err("==================================================================\n"); |
7744 |
+ |
7745 |
+- if (panic_on_warn) |
7746 |
+- panic("panic_on_warn set ...\n"); |
7747 |
++ check_panic_on_warn("KCSAN"); |
7748 |
+ } |
7749 |
+ |
7750 |
+ static void release_report(unsigned long *flags, struct other_info *other_info) |
7751 |
+diff --git a/kernel/module.c b/kernel/module.c |
7752 |
+index ef79f4dbda876..8a1766c69c6ec 100644 |
7753 |
+--- a/kernel/module.c |
7754 |
++++ b/kernel/module.c |
7755 |
+@@ -3665,7 +3665,8 @@ static bool finished_loading(const char *name) |
7756 |
+ sched_annotate_sleep(); |
7757 |
+ mutex_lock(&module_mutex); |
7758 |
+ mod = find_module_all(name, strlen(name), true); |
7759 |
+- ret = !mod || mod->state == MODULE_STATE_LIVE; |
7760 |
++ ret = !mod || mod->state == MODULE_STATE_LIVE |
7761 |
++ || mod->state == MODULE_STATE_GOING; |
7762 |
+ mutex_unlock(&module_mutex); |
7763 |
+ |
7764 |
+ return ret; |
7765 |
+@@ -3835,20 +3836,35 @@ static int add_unformed_module(struct module *mod) |
7766 |
+ |
7767 |
+ mod->state = MODULE_STATE_UNFORMED; |
7768 |
+ |
7769 |
+-again: |
7770 |
+ mutex_lock(&module_mutex); |
7771 |
+ old = find_module_all(mod->name, strlen(mod->name), true); |
7772 |
+ if (old != NULL) { |
7773 |
+- if (old->state != MODULE_STATE_LIVE) { |
7774 |
++ if (old->state == MODULE_STATE_COMING |
7775 |
++ || old->state == MODULE_STATE_UNFORMED) { |
7776 |
+ /* Wait in case it fails to load. */ |
7777 |
+ mutex_unlock(&module_mutex); |
7778 |
+ err = wait_event_interruptible(module_wq, |
7779 |
+ finished_loading(mod->name)); |
7780 |
+ if (err) |
7781 |
+ goto out_unlocked; |
7782 |
+- goto again; |
7783 |
++ |
7784 |
++ /* The module might have gone in the meantime. */ |
7785 |
++ mutex_lock(&module_mutex); |
7786 |
++ old = find_module_all(mod->name, strlen(mod->name), |
7787 |
++ true); |
7788 |
+ } |
7789 |
+- err = -EEXIST; |
7790 |
++ |
7791 |
++ /* |
7792 |
++ * We are here only when the same module was being loaded. Do |
7793 |
++ * not try to load it again right now. It prevents long delays |
7794 |
++ * caused by serialized module load failures. It might happen |
7795 |
++ * when more devices of the same type trigger load of |
7796 |
++ * a particular module. |
7797 |
++ */ |
7798 |
++ if (old && old->state == MODULE_STATE_LIVE) |
7799 |
++ err = -EEXIST; |
7800 |
++ else |
7801 |
++ err = -EBUSY; |
7802 |
+ goto out; |
7803 |
+ } |
7804 |
+ mod_update_bounds(mod); |
7805 |
+diff --git a/kernel/panic.c b/kernel/panic.c |
7806 |
+index cefd7d82366fb..47933d4c769b6 100644 |
7807 |
+--- a/kernel/panic.c |
7808 |
++++ b/kernel/panic.c |
7809 |
+@@ -32,6 +32,7 @@ |
7810 |
+ #include <linux/bug.h> |
7811 |
+ #include <linux/ratelimit.h> |
7812 |
+ #include <linux/debugfs.h> |
7813 |
++#include <linux/sysfs.h> |
7814 |
+ #include <asm/sections.h> |
7815 |
+ |
7816 |
+ #define PANIC_TIMER_STEP 100 |
7817 |
+@@ -42,7 +43,9 @@ |
7818 |
+ * Should we dump all CPUs backtraces in an oops event? |
7819 |
+ * Defaults to 0, can be changed via sysctl. |
7820 |
+ */ |
7821 |
+-unsigned int __read_mostly sysctl_oops_all_cpu_backtrace; |
7822 |
++static unsigned int __read_mostly sysctl_oops_all_cpu_backtrace; |
7823 |
++#else |
7824 |
++#define sysctl_oops_all_cpu_backtrace 0 |
7825 |
+ #endif /* CONFIG_SMP */ |
7826 |
+ |
7827 |
+ int panic_on_oops = CONFIG_PANIC_ON_OOPS_VALUE; |
7828 |
+@@ -55,6 +58,7 @@ bool crash_kexec_post_notifiers; |
7829 |
+ int panic_on_warn __read_mostly; |
7830 |
+ unsigned long panic_on_taint; |
7831 |
+ bool panic_on_taint_nousertaint = false; |
7832 |
++static unsigned int warn_limit __read_mostly; |
7833 |
+ |
7834 |
+ int panic_timeout = CONFIG_PANIC_TIMEOUT; |
7835 |
+ EXPORT_SYMBOL_GPL(panic_timeout); |
7836 |
+@@ -71,6 +75,56 @@ ATOMIC_NOTIFIER_HEAD(panic_notifier_list); |
7837 |
+ |
7838 |
+ EXPORT_SYMBOL(panic_notifier_list); |
7839 |
+ |
7840 |
++#ifdef CONFIG_SYSCTL |
7841 |
++static struct ctl_table kern_panic_table[] = { |
7842 |
++#ifdef CONFIG_SMP |
7843 |
++ { |
7844 |
++ .procname = "oops_all_cpu_backtrace", |
7845 |
++ .data = &sysctl_oops_all_cpu_backtrace, |
7846 |
++ .maxlen = sizeof(int), |
7847 |
++ .mode = 0644, |
7848 |
++ .proc_handler = proc_dointvec_minmax, |
7849 |
++ .extra1 = SYSCTL_ZERO, |
7850 |
++ .extra2 = SYSCTL_ONE, |
7851 |
++ }, |
7852 |
++#endif |
7853 |
++ { |
7854 |
++ .procname = "warn_limit", |
7855 |
++ .data = &warn_limit, |
7856 |
++ .maxlen = sizeof(warn_limit), |
7857 |
++ .mode = 0644, |
7858 |
++ .proc_handler = proc_douintvec, |
7859 |
++ }, |
7860 |
++ { } |
7861 |
++}; |
7862 |
++ |
7863 |
++static __init int kernel_panic_sysctls_init(void) |
7864 |
++{ |
7865 |
++ register_sysctl_init("kernel", kern_panic_table); |
7866 |
++ return 0; |
7867 |
++} |
7868 |
++late_initcall(kernel_panic_sysctls_init); |
7869 |
++#endif |
7870 |
++ |
7871 |
++static atomic_t warn_count = ATOMIC_INIT(0); |
7872 |
++ |
7873 |
++#ifdef CONFIG_SYSFS |
7874 |
++static ssize_t warn_count_show(struct kobject *kobj, struct kobj_attribute *attr, |
7875 |
++ char *page) |
7876 |
++{ |
7877 |
++ return sysfs_emit(page, "%d\n", atomic_read(&warn_count)); |
7878 |
++} |
7879 |
++ |
7880 |
++static struct kobj_attribute warn_count_attr = __ATTR_RO(warn_count); |
7881 |
++ |
7882 |
++static __init int kernel_panic_sysfs_init(void) |
7883 |
++{ |
7884 |
++ sysfs_add_file_to_group(kernel_kobj, &warn_count_attr.attr, NULL); |
7885 |
++ return 0; |
7886 |
++} |
7887 |
++late_initcall(kernel_panic_sysfs_init); |
7888 |
++#endif |
7889 |
++ |
7890 |
+ static long no_blink(int state) |
7891 |
+ { |
7892 |
+ return 0; |
7893 |
+@@ -167,6 +221,19 @@ static void panic_print_sys_info(void) |
7894 |
+ ftrace_dump(DUMP_ALL); |
7895 |
+ } |
7896 |
+ |
7897 |
++void check_panic_on_warn(const char *origin) |
7898 |
++{ |
7899 |
++ unsigned int limit; |
7900 |
++ |
7901 |
++ if (panic_on_warn) |
7902 |
++ panic("%s: panic_on_warn set ...\n", origin); |
7903 |
++ |
7904 |
++ limit = READ_ONCE(warn_limit); |
7905 |
++ if (atomic_inc_return(&warn_count) >= limit && limit) |
7906 |
++ panic("%s: system warned too often (kernel.warn_limit is %d)", |
7907 |
++ origin, limit); |
7908 |
++} |
7909 |
++ |
7910 |
+ /** |
7911 |
+ * panic - halt the system |
7912 |
+ * @fmt: The text string to print |
7913 |
+@@ -184,6 +251,16 @@ void panic(const char *fmt, ...) |
7914 |
+ int old_cpu, this_cpu; |
7915 |
+ bool _crash_kexec_post_notifiers = crash_kexec_post_notifiers; |
7916 |
+ |
7917 |
++ if (panic_on_warn) { |
7918 |
++ /* |
7919 |
++ * This thread may hit another WARN() in the panic path. |
7920 |
++ * Resetting this prevents additional WARN() from panicking the |
7921 |
++ * system on this thread. Other threads are blocked by the |
7922 |
++ * panic_mutex in panic(). |
7923 |
++ */ |
7924 |
++ panic_on_warn = 0; |
7925 |
++ } |
7926 |
++ |
7927 |
+ /* |
7928 |
+ * Disable local interrupts. This will prevent panic_smp_self_stop |
7929 |
+ * from deadlocking the first cpu that invokes the panic, since |
7930 |
+@@ -592,16 +669,7 @@ void __warn(const char *file, int line, void *caller, unsigned taint, |
7931 |
+ if (regs) |
7932 |
+ show_regs(regs); |
7933 |
+ |
7934 |
+- if (panic_on_warn) { |
7935 |
+- /* |
7936 |
+- * This thread may hit another WARN() in the panic path. |
7937 |
+- * Resetting this prevents additional WARN() from panicking the |
7938 |
+- * system on this thread. Other threads are blocked by the |
7939 |
+- * panic_mutex in panic(). |
7940 |
+- */ |
7941 |
+- panic_on_warn = 0; |
7942 |
+- panic("panic_on_warn set ...\n"); |
7943 |
+- } |
7944 |
++ check_panic_on_warn("kernel"); |
7945 |
+ |
7946 |
+ if (!regs) |
7947 |
+ dump_stack(); |
7948 |
+diff --git a/kernel/sched/core.c b/kernel/sched/core.c |
7949 |
+index 2bd5e235d0781..c1458fa8beb3e 100644 |
7950 |
+--- a/kernel/sched/core.c |
7951 |
++++ b/kernel/sched/core.c |
7952 |
+@@ -5560,8 +5560,7 @@ static noinline void __schedule_bug(struct task_struct *prev) |
7953 |
+ pr_err("Preemption disabled at:"); |
7954 |
+ print_ip_sym(KERN_ERR, preempt_disable_ip); |
7955 |
+ } |
7956 |
+- if (panic_on_warn) |
7957 |
+- panic("scheduling while atomic\n"); |
7958 |
++ check_panic_on_warn("scheduling while atomic"); |
7959 |
+ |
7960 |
+ dump_stack(); |
7961 |
+ add_taint(TAINT_WARN, LOCKDEP_STILL_OK); |
7962 |
+diff --git a/kernel/sysctl.c b/kernel/sysctl.c |
7963 |
+index 34ce5953dbb09..928798f89ca1d 100644 |
7964 |
+--- a/kernel/sysctl.c |
7965 |
++++ b/kernel/sysctl.c |
7966 |
+@@ -2220,17 +2220,6 @@ static struct ctl_table kern_table[] = { |
7967 |
+ .proc_handler = proc_dointvec, |
7968 |
+ }, |
7969 |
+ #endif |
7970 |
+-#ifdef CONFIG_SMP |
7971 |
+- { |
7972 |
+- .procname = "oops_all_cpu_backtrace", |
7973 |
+- .data = &sysctl_oops_all_cpu_backtrace, |
7974 |
+- .maxlen = sizeof(int), |
7975 |
+- .mode = 0644, |
7976 |
+- .proc_handler = proc_dointvec_minmax, |
7977 |
+- .extra1 = SYSCTL_ZERO, |
7978 |
+- .extra2 = SYSCTL_ONE, |
7979 |
+- }, |
7980 |
+-#endif /* CONFIG_SMP */ |
7981 |
+ { |
7982 |
+ .procname = "pid_max", |
7983 |
+ .data = &pid_max, |
7984 |
+diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c |
7985 |
+index 114d94d1e0a90..06ff4dea34d09 100644 |
7986 |
+--- a/kernel/trace/trace.c |
7987 |
++++ b/kernel/trace/trace.c |
7988 |
+@@ -10217,6 +10217,8 @@ void __init early_trace_init(void) |
7989 |
+ static_key_enable(&tracepoint_printk_key.key); |
7990 |
+ } |
7991 |
+ tracer_alloc_buffers(); |
7992 |
++ |
7993 |
++ init_events(); |
7994 |
+ } |
7995 |
+ |
7996 |
+ void __init trace_init(void) |
7997 |
+diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h |
7998 |
+index 9fc598165f3a2..66b6c8395fbc1 100644 |
7999 |
+--- a/kernel/trace/trace.h |
8000 |
++++ b/kernel/trace/trace.h |
8001 |
+@@ -1500,6 +1500,7 @@ extern void trace_event_enable_cmd_record(bool enable); |
8002 |
+ extern void trace_event_enable_tgid_record(bool enable); |
8003 |
+ |
8004 |
+ extern int event_trace_init(void); |
8005 |
++extern int init_events(void); |
8006 |
+ extern int event_trace_add_tracer(struct dentry *parent, struct trace_array *tr); |
8007 |
+ extern int event_trace_del_tracer(struct trace_array *tr); |
8008 |
+ extern void __trace_early_add_events(struct trace_array *tr); |
8009 |
+diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_hist.c |
8010 |
+index cc1a078f7a164..aaf779ee68a6a 100644 |
8011 |
+--- a/kernel/trace/trace_events_hist.c |
8012 |
++++ b/kernel/trace/trace_events_hist.c |
8013 |
+@@ -1699,6 +1699,8 @@ static struct hist_field *create_hist_field(struct hist_trigger_data *hist_data, |
8014 |
+ hist_field->fn = flags & HIST_FIELD_FL_LOG2 ? hist_field_log2 : |
8015 |
+ hist_field_bucket; |
8016 |
+ hist_field->operands[0] = create_hist_field(hist_data, field, fl, NULL); |
8017 |
++ if (!hist_field->operands[0]) |
8018 |
++ goto free; |
8019 |
+ hist_field->size = hist_field->operands[0]->size; |
8020 |
+ hist_field->type = kstrdup_const(hist_field->operands[0]->type, GFP_KERNEL); |
8021 |
+ if (!hist_field->type) |
8022 |
+diff --git a/kernel/trace/trace_output.c b/kernel/trace/trace_output.c |
8023 |
+index c2ca40e8595be..6b4d3f3abdae2 100644 |
8024 |
+--- a/kernel/trace/trace_output.c |
8025 |
++++ b/kernel/trace/trace_output.c |
8026 |
+@@ -1569,7 +1569,7 @@ static struct trace_event *events[] __initdata = { |
8027 |
+ NULL |
8028 |
+ }; |
8029 |
+ |
8030 |
+-__init static int init_events(void) |
8031 |
++__init int init_events(void) |
8032 |
+ { |
8033 |
+ struct trace_event *event; |
8034 |
+ int i, ret; |
8035 |
+@@ -1587,4 +1587,3 @@ __init static int init_events(void) |
8036 |
+ |
8037 |
+ return 0; |
8038 |
+ } |
8039 |
+-early_initcall(init_events); |
8040 |
+diff --git a/lib/lockref.c b/lib/lockref.c |
8041 |
+index 5b34bbd3eba81..81ac5f3552428 100644 |
8042 |
+--- a/lib/lockref.c |
8043 |
++++ b/lib/lockref.c |
8044 |
+@@ -24,7 +24,6 @@ |
8045 |
+ } \ |
8046 |
+ if (!--retry) \ |
8047 |
+ break; \ |
8048 |
+- cpu_relax(); \ |
8049 |
+ } \ |
8050 |
+ } while (0) |
8051 |
+ |
8052 |
+diff --git a/lib/nlattr.c b/lib/nlattr.c |
8053 |
+index 86029ad5ead4f..73635bdb00620 100644 |
8054 |
+--- a/lib/nlattr.c |
8055 |
++++ b/lib/nlattr.c |
8056 |
+@@ -10,6 +10,7 @@ |
8057 |
+ #include <linux/kernel.h> |
8058 |
+ #include <linux/errno.h> |
8059 |
+ #include <linux/jiffies.h> |
8060 |
++#include <linux/nospec.h> |
8061 |
+ #include <linux/skbuff.h> |
8062 |
+ #include <linux/string.h> |
8063 |
+ #include <linux/types.h> |
8064 |
+@@ -369,6 +370,7 @@ static int validate_nla(const struct nlattr *nla, int maxtype, |
8065 |
+ if (type <= 0 || type > maxtype) |
8066 |
+ return 0; |
8067 |
+ |
8068 |
++ type = array_index_nospec(type, maxtype + 1); |
8069 |
+ pt = &policy[type]; |
8070 |
+ |
8071 |
+ BUG_ON(pt->type > NLA_TYPE_MAX); |
8072 |
+@@ -584,6 +586,7 @@ static int __nla_validate_parse(const struct nlattr *head, int len, int maxtype, |
8073 |
+ } |
8074 |
+ continue; |
8075 |
+ } |
8076 |
++ type = array_index_nospec(type, maxtype + 1); |
8077 |
+ if (policy) { |
8078 |
+ int err = validate_nla(nla, maxtype, policy, |
8079 |
+ validate, extack, depth); |
8080 |
+diff --git a/lib/ubsan.c b/lib/ubsan.c |
8081 |
+index bdc380ff5d5c7..60c7099857a05 100644 |
8082 |
+--- a/lib/ubsan.c |
8083 |
++++ b/lib/ubsan.c |
8084 |
+@@ -154,16 +154,7 @@ static void ubsan_epilogue(void) |
8085 |
+ |
8086 |
+ current->in_ubsan--; |
8087 |
+ |
8088 |
+- if (panic_on_warn) { |
8089 |
+- /* |
8090 |
+- * This thread may hit another WARN() in the panic path. |
8091 |
+- * Resetting this prevents additional WARN() from panicking the |
8092 |
+- * system on this thread. Other threads are blocked by the |
8093 |
+- * panic_mutex in panic(). |
8094 |
+- */ |
8095 |
+- panic_on_warn = 0; |
8096 |
+- panic("panic_on_warn set ...\n"); |
8097 |
+- } |
8098 |
++ check_panic_on_warn("UBSAN"); |
8099 |
+ } |
8100 |
+ |
8101 |
+ void __ubsan_handle_divrem_overflow(void *_data, void *lhs, void *rhs) |
8102 |
+diff --git a/mm/kasan/report.c b/mm/kasan/report.c |
8103 |
+index 884a950c70265..887af873733bc 100644 |
8104 |
+--- a/mm/kasan/report.c |
8105 |
++++ b/mm/kasan/report.c |
8106 |
+@@ -117,16 +117,8 @@ static void end_report(unsigned long *flags, unsigned long addr) |
8107 |
+ pr_err("==================================================================\n"); |
8108 |
+ add_taint(TAINT_BAD_PAGE, LOCKDEP_NOW_UNRELIABLE); |
8109 |
+ spin_unlock_irqrestore(&report_lock, *flags); |
8110 |
+- if (panic_on_warn && !test_bit(KASAN_BIT_MULTI_SHOT, &kasan_flags)) { |
8111 |
+- /* |
8112 |
+- * This thread may hit another WARN() in the panic path. |
8113 |
+- * Resetting this prevents additional WARN() from panicking the |
8114 |
+- * system on this thread. Other threads are blocked by the |
8115 |
+- * panic_mutex in panic(). |
8116 |
+- */ |
8117 |
+- panic_on_warn = 0; |
8118 |
+- panic("panic_on_warn set ...\n"); |
8119 |
+- } |
8120 |
++ if (!test_bit(KASAN_BIT_MULTI_SHOT, &kasan_flags)) |
8121 |
++ check_panic_on_warn("KASAN"); |
8122 |
+ if (kasan_arg_fault == KASAN_ARG_FAULT_PANIC) |
8123 |
+ panic("kasan.fault=panic set ...\n"); |
8124 |
+ kasan_enable_current(); |
8125 |
+diff --git a/mm/kfence/report.c b/mm/kfence/report.c |
8126 |
+index 37e140e7f201e..cbd9456359b96 100644 |
8127 |
+--- a/mm/kfence/report.c |
8128 |
++++ b/mm/kfence/report.c |
8129 |
+@@ -267,8 +267,7 @@ void kfence_report_error(unsigned long address, bool is_write, struct pt_regs *r |
8130 |
+ |
8131 |
+ lockdep_on(); |
8132 |
+ |
8133 |
+- if (panic_on_warn) |
8134 |
+- panic("panic_on_warn set ...\n"); |
8135 |
++ check_panic_on_warn("KFENCE"); |
8136 |
+ |
8137 |
+ /* We encountered a memory safety error, taint the kernel! */ |
8138 |
+ add_taint(TAINT_BAD_PAGE, LOCKDEP_STILL_OK); |
8139 |
+diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c |
8140 |
+index a41b4dcf1a7a8..cabe8eb4c14f4 100644 |
8141 |
+--- a/net/bluetooth/hci_core.c |
8142 |
++++ b/net/bluetooth/hci_core.c |
8143 |
+@@ -1632,6 +1632,7 @@ setup_failed: |
8144 |
+ hdev->flush(hdev); |
8145 |
+ |
8146 |
+ if (hdev->sent_cmd) { |
8147 |
++ cancel_delayed_work_sync(&hdev->cmd_timer); |
8148 |
+ kfree_skb(hdev->sent_cmd); |
8149 |
+ hdev->sent_cmd = NULL; |
8150 |
+ } |
8151 |
+diff --git a/net/bluetooth/rfcomm/sock.c b/net/bluetooth/rfcomm/sock.c |
8152 |
+index 21e24da4847f0..4397e14ff560f 100644 |
8153 |
+--- a/net/bluetooth/rfcomm/sock.c |
8154 |
++++ b/net/bluetooth/rfcomm/sock.c |
8155 |
+@@ -391,6 +391,7 @@ static int rfcomm_sock_connect(struct socket *sock, struct sockaddr *addr, int a |
8156 |
+ addr->sa_family != AF_BLUETOOTH) |
8157 |
+ return -EINVAL; |
8158 |
+ |
8159 |
++ sock_hold(sk); |
8160 |
+ lock_sock(sk); |
8161 |
+ |
8162 |
+ if (sk->sk_state != BT_OPEN && sk->sk_state != BT_BOUND) { |
8163 |
+@@ -410,14 +411,18 @@ static int rfcomm_sock_connect(struct socket *sock, struct sockaddr *addr, int a |
8164 |
+ d->sec_level = rfcomm_pi(sk)->sec_level; |
8165 |
+ d->role_switch = rfcomm_pi(sk)->role_switch; |
8166 |
+ |
8167 |
++ /* Drop sock lock to avoid potential deadlock with the RFCOMM lock */ |
8168 |
++ release_sock(sk); |
8169 |
+ err = rfcomm_dlc_open(d, &rfcomm_pi(sk)->src, &sa->rc_bdaddr, |
8170 |
+ sa->rc_channel); |
8171 |
+- if (!err) |
8172 |
++ lock_sock(sk); |
8173 |
++ if (!err && !sock_flag(sk, SOCK_ZAPPED)) |
8174 |
+ err = bt_sock_wait_state(sk, BT_CONNECTED, |
8175 |
+ sock_sndtimeo(sk, flags & O_NONBLOCK)); |
8176 |
+ |
8177 |
+ done: |
8178 |
+ release_sock(sk); |
8179 |
++ sock_put(sk); |
8180 |
+ return err; |
8181 |
+ } |
8182 |
+ |
8183 |
+diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c |
8184 |
+index 982d063320071..dcddc54d08409 100644 |
8185 |
+--- a/net/core/net_namespace.c |
8186 |
++++ b/net/core/net_namespace.c |
8187 |
+@@ -137,12 +137,12 @@ static int ops_init(const struct pernet_operations *ops, struct net *net) |
8188 |
+ return 0; |
8189 |
+ |
8190 |
+ if (ops->id && ops->size) { |
8191 |
+-cleanup: |
8192 |
+ ng = rcu_dereference_protected(net->gen, |
8193 |
+ lockdep_is_held(&pernet_ops_rwsem)); |
8194 |
+ ng->ptr[*ops->id] = NULL; |
8195 |
+ } |
8196 |
+ |
8197 |
++cleanup: |
8198 |
+ kfree(data); |
8199 |
+ |
8200 |
+ out: |
8201 |
+diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c |
8202 |
+index 250af6e5a8922..607a4f8161555 100644 |
8203 |
+--- a/net/ipv4/fib_semantics.c |
8204 |
++++ b/net/ipv4/fib_semantics.c |
8205 |
+@@ -30,6 +30,7 @@ |
8206 |
+ #include <linux/slab.h> |
8207 |
+ #include <linux/netlink.h> |
8208 |
+ #include <linux/hash.h> |
8209 |
++#include <linux/nospec.h> |
8210 |
+ |
8211 |
+ #include <net/arp.h> |
8212 |
+ #include <net/ip.h> |
8213 |
+@@ -1020,6 +1021,7 @@ bool fib_metrics_match(struct fib_config *cfg, struct fib_info *fi) |
8214 |
+ if (type > RTAX_MAX) |
8215 |
+ return false; |
8216 |
+ |
8217 |
++ type = array_index_nospec(type, RTAX_MAX + 1); |
8218 |
+ if (type == RTAX_CC_ALGO) { |
8219 |
+ char tmp[TCP_CA_NAME_MAX]; |
8220 |
+ bool ecn_ca = false; |
8221 |
+diff --git a/net/ipv4/inet_hashtables.c b/net/ipv4/inet_hashtables.c |
8222 |
+index 0d378da4b1b1a..410b6b7998caf 100644 |
8223 |
+--- a/net/ipv4/inet_hashtables.c |
8224 |
++++ b/net/ipv4/inet_hashtables.c |
8225 |
+@@ -571,8 +571,20 @@ bool inet_ehash_insert(struct sock *sk, struct sock *osk, bool *found_dup_sk) |
8226 |
+ spin_lock(lock); |
8227 |
+ if (osk) { |
8228 |
+ WARN_ON_ONCE(sk->sk_hash != osk->sk_hash); |
8229 |
+- ret = sk_nulls_del_node_init_rcu(osk); |
8230 |
+- } else if (found_dup_sk) { |
8231 |
++ ret = sk_hashed(osk); |
8232 |
++ if (ret) { |
8233 |
++ /* Before deleting the node, we insert a new one to make |
8234 |
++ * sure that the look-up-sk process would not miss either |
8235 |
++ * of them and that at least one node would exist in ehash |
8236 |
++ * table all the time. Otherwise there's a tiny chance |
8237 |
++ * that lookup process could find nothing in ehash table. |
8238 |
++ */ |
8239 |
++ __sk_nulls_add_node_tail_rcu(sk, list); |
8240 |
++ sk_nulls_del_node_init_rcu(osk); |
8241 |
++ } |
8242 |
++ goto unlock; |
8243 |
++ } |
8244 |
++ if (found_dup_sk) { |
8245 |
+ *found_dup_sk = inet_ehash_lookup_by_sk(sk, list); |
8246 |
+ if (*found_dup_sk) |
8247 |
+ ret = false; |
8248 |
+@@ -581,6 +593,7 @@ bool inet_ehash_insert(struct sock *sk, struct sock *osk, bool *found_dup_sk) |
8249 |
+ if (ret) |
8250 |
+ __sk_nulls_add_node_rcu(sk, list); |
8251 |
+ |
8252 |
++unlock: |
8253 |
+ spin_unlock(lock); |
8254 |
+ |
8255 |
+ return ret; |
8256 |
+diff --git a/net/ipv4/inet_timewait_sock.c b/net/ipv4/inet_timewait_sock.c |
8257 |
+index 437afe392e667..fe6340c363b43 100644 |
8258 |
+--- a/net/ipv4/inet_timewait_sock.c |
8259 |
++++ b/net/ipv4/inet_timewait_sock.c |
8260 |
+@@ -81,10 +81,10 @@ void inet_twsk_put(struct inet_timewait_sock *tw) |
8261 |
+ } |
8262 |
+ EXPORT_SYMBOL_GPL(inet_twsk_put); |
8263 |
+ |
8264 |
+-static void inet_twsk_add_node_rcu(struct inet_timewait_sock *tw, |
8265 |
+- struct hlist_nulls_head *list) |
8266 |
++static void inet_twsk_add_node_tail_rcu(struct inet_timewait_sock *tw, |
8267 |
++ struct hlist_nulls_head *list) |
8268 |
+ { |
8269 |
+- hlist_nulls_add_head_rcu(&tw->tw_node, list); |
8270 |
++ hlist_nulls_add_tail_rcu(&tw->tw_node, list); |
8271 |
+ } |
8272 |
+ |
8273 |
+ static void inet_twsk_add_bind_node(struct inet_timewait_sock *tw, |
8274 |
+@@ -120,7 +120,7 @@ void inet_twsk_hashdance(struct inet_timewait_sock *tw, struct sock *sk, |
8275 |
+ |
8276 |
+ spin_lock(lock); |
8277 |
+ |
8278 |
+- inet_twsk_add_node_rcu(tw, &ehead->chain); |
8279 |
++ inet_twsk_add_node_tail_rcu(tw, &ehead->chain); |
8280 |
+ |
8281 |
+ /* Step 3: Remove SK from hash chain */ |
8282 |
+ if (__sk_nulls_del_node_init_rcu(sk)) |
8283 |
+diff --git a/net/ipv4/metrics.c b/net/ipv4/metrics.c |
8284 |
+index 25ea6ac44db95..6a1427916c7dc 100644 |
8285 |
+--- a/net/ipv4/metrics.c |
8286 |
++++ b/net/ipv4/metrics.c |
8287 |
+@@ -1,5 +1,6 @@ |
8288 |
+ // SPDX-License-Identifier: GPL-2.0-only |
8289 |
+ #include <linux/netlink.h> |
8290 |
++#include <linux/nospec.h> |
8291 |
+ #include <linux/rtnetlink.h> |
8292 |
+ #include <linux/types.h> |
8293 |
+ #include <net/ip.h> |
8294 |
+@@ -28,6 +29,7 @@ static int ip_metrics_convert(struct net *net, struct nlattr *fc_mx, |
8295 |
+ return -EINVAL; |
8296 |
+ } |
8297 |
+ |
8298 |
++ type = array_index_nospec(type, RTAX_MAX + 1); |
8299 |
+ if (type == RTAX_CC_ALGO) { |
8300 |
+ char tmp[TCP_CA_NAME_MAX]; |
8301 |
+ |
8302 |
+diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c |
8303 |
+index fe1972aad279a..51f34560a9d63 100644 |
8304 |
+--- a/net/ipv4/tcp.c |
8305 |
++++ b/net/ipv4/tcp.c |
8306 |
+@@ -439,6 +439,7 @@ void tcp_init_sock(struct sock *sk) |
8307 |
+ |
8308 |
+ /* There's a bubble in the pipe until at least the first ACK. */ |
8309 |
+ tp->app_limited = ~0U; |
8310 |
++ tp->rate_app_limited = 1; |
8311 |
+ |
8312 |
+ /* See draft-stevens-tcpca-spec-01 for discussion of the |
8313 |
+ * initialization of these values. |
8314 |
+@@ -3066,6 +3067,7 @@ int tcp_disconnect(struct sock *sk, int flags) |
8315 |
+ tp->last_oow_ack_time = 0; |
8316 |
+ /* There's a bubble in the pipe until at least the first ACK. */ |
8317 |
+ tp->app_limited = ~0U; |
8318 |
++ tp->rate_app_limited = 1; |
8319 |
+ tp->rack.mstamp = 0; |
8320 |
+ tp->rack.advanced = 0; |
8321 |
+ tp->rack.reo_wnd_steps = 1; |
8322 |
+diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c |
8323 |
+index 675a80dd78ba6..383442ded9542 100644 |
8324 |
+--- a/net/ipv6/ip6_output.c |
8325 |
++++ b/net/ipv6/ip6_output.c |
8326 |
+@@ -527,7 +527,20 @@ int ip6_forward(struct sk_buff *skb) |
8327 |
+ pneigh_lookup(&nd_tbl, net, &hdr->daddr, skb->dev, 0)) { |
8328 |
+ int proxied = ip6_forward_proxy_check(skb); |
8329 |
+ if (proxied > 0) { |
8330 |
+- hdr->hop_limit--; |
8331 |
++ /* It's tempting to decrease the hop limit |
8332 |
++ * here by 1, as we do at the end of the |
8333 |
++ * function too. |
8334 |
++ * |
8335 |
++ * But that would be incorrect, as proxying is |
8336 |
++ * not forwarding. The ip6_input function |
8337 |
++ * will handle this packet locally, and it |
8338 |
++ * depends on the hop limit being unchanged. |
8339 |
++ * |
8340 |
++ * One example is the NDP hop limit, that |
8341 |
++ * always has to stay 255, but other would be |
8342 |
++ * similar checks around RA packets, where the |
8343 |
++ * user can even change the desired limit. |
8344 |
++ */ |
8345 |
+ return ip6_input(skb); |
8346 |
+ } else if (proxied < 0) { |
8347 |
+ __IP6_INC_STATS(net, idev, IPSTATS_MIB_INDISCARDS); |
8348 |
+diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c |
8349 |
+index 93271a2632b8e..a2b13e213e06f 100644 |
8350 |
+--- a/net/l2tp/l2tp_core.c |
8351 |
++++ b/net/l2tp/l2tp_core.c |
8352 |
+@@ -104,9 +104,9 @@ static struct workqueue_struct *l2tp_wq; |
8353 |
+ /* per-net private data for this module */ |
8354 |
+ static unsigned int l2tp_net_id; |
8355 |
+ struct l2tp_net { |
8356 |
+- struct list_head l2tp_tunnel_list; |
8357 |
+- /* Lock for write access to l2tp_tunnel_list */ |
8358 |
+- spinlock_t l2tp_tunnel_list_lock; |
8359 |
++ /* Lock for write access to l2tp_tunnel_idr */ |
8360 |
++ spinlock_t l2tp_tunnel_idr_lock; |
8361 |
++ struct idr l2tp_tunnel_idr; |
8362 |
+ struct hlist_head l2tp_session_hlist[L2TP_HASH_SIZE_2]; |
8363 |
+ /* Lock for write access to l2tp_session_hlist */ |
8364 |
+ spinlock_t l2tp_session_hlist_lock; |
8365 |
+@@ -208,13 +208,10 @@ struct l2tp_tunnel *l2tp_tunnel_get(const struct net *net, u32 tunnel_id) |
8366 |
+ struct l2tp_tunnel *tunnel; |
8367 |
+ |
8368 |
+ rcu_read_lock_bh(); |
8369 |
+- list_for_each_entry_rcu(tunnel, &pn->l2tp_tunnel_list, list) { |
8370 |
+- if (tunnel->tunnel_id == tunnel_id && |
8371 |
+- refcount_inc_not_zero(&tunnel->ref_count)) { |
8372 |
+- rcu_read_unlock_bh(); |
8373 |
+- |
8374 |
+- return tunnel; |
8375 |
+- } |
8376 |
++ tunnel = idr_find(&pn->l2tp_tunnel_idr, tunnel_id); |
8377 |
++ if (tunnel && refcount_inc_not_zero(&tunnel->ref_count)) { |
8378 |
++ rcu_read_unlock_bh(); |
8379 |
++ return tunnel; |
8380 |
+ } |
8381 |
+ rcu_read_unlock_bh(); |
8382 |
+ |
8383 |
+@@ -224,13 +221,14 @@ EXPORT_SYMBOL_GPL(l2tp_tunnel_get); |
8384 |
+ |
8385 |
+ struct l2tp_tunnel *l2tp_tunnel_get_nth(const struct net *net, int nth) |
8386 |
+ { |
8387 |
+- const struct l2tp_net *pn = l2tp_pernet(net); |
8388 |
++ struct l2tp_net *pn = l2tp_pernet(net); |
8389 |
++ unsigned long tunnel_id, tmp; |
8390 |
+ struct l2tp_tunnel *tunnel; |
8391 |
+ int count = 0; |
8392 |
+ |
8393 |
+ rcu_read_lock_bh(); |
8394 |
+- list_for_each_entry_rcu(tunnel, &pn->l2tp_tunnel_list, list) { |
8395 |
+- if (++count > nth && |
8396 |
++ idr_for_each_entry_ul(&pn->l2tp_tunnel_idr, tunnel, tmp, tunnel_id) { |
8397 |
++ if (tunnel && ++count > nth && |
8398 |
+ refcount_inc_not_zero(&tunnel->ref_count)) { |
8399 |
+ rcu_read_unlock_bh(); |
8400 |
+ return tunnel; |
8401 |
+@@ -1043,7 +1041,7 @@ static int l2tp_xmit_core(struct l2tp_session *session, struct sk_buff *skb, uns |
8402 |
+ IPCB(skb)->flags &= ~(IPSKB_XFRM_TUNNEL_SIZE | IPSKB_XFRM_TRANSFORMED | IPSKB_REROUTED); |
8403 |
+ nf_reset_ct(skb); |
8404 |
+ |
8405 |
+- bh_lock_sock(sk); |
8406 |
++ bh_lock_sock_nested(sk); |
8407 |
+ if (sock_owned_by_user(sk)) { |
8408 |
+ kfree_skb(skb); |
8409 |
+ ret = NET_XMIT_DROP; |
8410 |
+@@ -1150,8 +1148,10 @@ static void l2tp_tunnel_destruct(struct sock *sk) |
8411 |
+ } |
8412 |
+ |
8413 |
+ /* Remove hooks into tunnel socket */ |
8414 |
++ write_lock_bh(&sk->sk_callback_lock); |
8415 |
+ sk->sk_destruct = tunnel->old_sk_destruct; |
8416 |
+ sk->sk_user_data = NULL; |
8417 |
++ write_unlock_bh(&sk->sk_callback_lock); |
8418 |
+ |
8419 |
+ /* Call the original destructor */ |
8420 |
+ if (sk->sk_destruct) |
8421 |
+@@ -1227,6 +1227,15 @@ static void l2tp_udp_encap_destroy(struct sock *sk) |
8422 |
+ l2tp_tunnel_delete(tunnel); |
8423 |
+ } |
8424 |
+ |
8425 |
++static void l2tp_tunnel_remove(struct net *net, struct l2tp_tunnel *tunnel) |
8426 |
++{ |
8427 |
++ struct l2tp_net *pn = l2tp_pernet(net); |
8428 |
++ |
8429 |
++ spin_lock_bh(&pn->l2tp_tunnel_idr_lock); |
8430 |
++ idr_remove(&pn->l2tp_tunnel_idr, tunnel->tunnel_id); |
8431 |
++ spin_unlock_bh(&pn->l2tp_tunnel_idr_lock); |
8432 |
++} |
8433 |
++ |
8434 |
+ /* Workqueue tunnel deletion function */ |
8435 |
+ static void l2tp_tunnel_del_work(struct work_struct *work) |
8436 |
+ { |
8437 |
+@@ -1234,7 +1243,6 @@ static void l2tp_tunnel_del_work(struct work_struct *work) |
8438 |
+ del_work); |
8439 |
+ struct sock *sk = tunnel->sock; |
8440 |
+ struct socket *sock = sk->sk_socket; |
8441 |
+- struct l2tp_net *pn; |
8442 |
+ |
8443 |
+ l2tp_tunnel_closeall(tunnel); |
8444 |
+ |
8445 |
+@@ -1248,12 +1256,7 @@ static void l2tp_tunnel_del_work(struct work_struct *work) |
8446 |
+ } |
8447 |
+ } |
8448 |
+ |
8449 |
+- /* Remove the tunnel struct from the tunnel list */ |
8450 |
+- pn = l2tp_pernet(tunnel->l2tp_net); |
8451 |
+- spin_lock_bh(&pn->l2tp_tunnel_list_lock); |
8452 |
+- list_del_rcu(&tunnel->list); |
8453 |
+- spin_unlock_bh(&pn->l2tp_tunnel_list_lock); |
8454 |
+- |
8455 |
++ l2tp_tunnel_remove(tunnel->l2tp_net, tunnel); |
8456 |
+ /* drop initial ref */ |
8457 |
+ l2tp_tunnel_dec_refcount(tunnel); |
8458 |
+ |
8459 |
+@@ -1384,8 +1387,6 @@ out: |
8460 |
+ return err; |
8461 |
+ } |
8462 |
+ |
8463 |
+-static struct lock_class_key l2tp_socket_class; |
8464 |
+- |
8465 |
+ int l2tp_tunnel_create(int fd, int version, u32 tunnel_id, u32 peer_tunnel_id, |
8466 |
+ struct l2tp_tunnel_cfg *cfg, struct l2tp_tunnel **tunnelp) |
8467 |
+ { |
8468 |
+@@ -1455,12 +1456,19 @@ static int l2tp_validate_socket(const struct sock *sk, const struct net *net, |
8469 |
+ int l2tp_tunnel_register(struct l2tp_tunnel *tunnel, struct net *net, |
8470 |
+ struct l2tp_tunnel_cfg *cfg) |
8471 |
+ { |
8472 |
+- struct l2tp_tunnel *tunnel_walk; |
8473 |
+- struct l2tp_net *pn; |
8474 |
++ struct l2tp_net *pn = l2tp_pernet(net); |
8475 |
++ u32 tunnel_id = tunnel->tunnel_id; |
8476 |
+ struct socket *sock; |
8477 |
+ struct sock *sk; |
8478 |
+ int ret; |
8479 |
+ |
8480 |
++ spin_lock_bh(&pn->l2tp_tunnel_idr_lock); |
8481 |
++ ret = idr_alloc_u32(&pn->l2tp_tunnel_idr, NULL, &tunnel_id, tunnel_id, |
8482 |
++ GFP_ATOMIC); |
8483 |
++ spin_unlock_bh(&pn->l2tp_tunnel_idr_lock); |
8484 |
++ if (ret) |
8485 |
++ return ret == -ENOSPC ? -EEXIST : ret; |
8486 |
++ |
8487 |
+ if (tunnel->fd < 0) { |
8488 |
+ ret = l2tp_tunnel_sock_create(net, tunnel->tunnel_id, |
8489 |
+ tunnel->peer_tunnel_id, cfg, |
8490 |
+@@ -1471,30 +1479,16 @@ int l2tp_tunnel_register(struct l2tp_tunnel *tunnel, struct net *net, |
8491 |
+ sock = sockfd_lookup(tunnel->fd, &ret); |
8492 |
+ if (!sock) |
8493 |
+ goto err; |
8494 |
+- |
8495 |
+- ret = l2tp_validate_socket(sock->sk, net, tunnel->encap); |
8496 |
+- if (ret < 0) |
8497 |
+- goto err_sock; |
8498 |
+ } |
8499 |
+ |
8500 |
+- tunnel->l2tp_net = net; |
8501 |
+- pn = l2tp_pernet(net); |
8502 |
+- |
8503 |
+ sk = sock->sk; |
8504 |
+- sock_hold(sk); |
8505 |
+- tunnel->sock = sk; |
8506 |
+- |
8507 |
+- spin_lock_bh(&pn->l2tp_tunnel_list_lock); |
8508 |
+- list_for_each_entry(tunnel_walk, &pn->l2tp_tunnel_list, list) { |
8509 |
+- if (tunnel_walk->tunnel_id == tunnel->tunnel_id) { |
8510 |
+- spin_unlock_bh(&pn->l2tp_tunnel_list_lock); |
8511 |
+- sock_put(sk); |
8512 |
+- ret = -EEXIST; |
8513 |
+- goto err_sock; |
8514 |
+- } |
8515 |
+- } |
8516 |
+- list_add_rcu(&tunnel->list, &pn->l2tp_tunnel_list); |
8517 |
+- spin_unlock_bh(&pn->l2tp_tunnel_list_lock); |
8518 |
++ lock_sock(sk); |
8519 |
++ write_lock_bh(&sk->sk_callback_lock); |
8520 |
++ ret = l2tp_validate_socket(sk, net, tunnel->encap); |
8521 |
++ if (ret < 0) |
8522 |
++ goto err_inval_sock; |
8523 |
++ rcu_assign_sk_user_data(sk, tunnel); |
8524 |
++ write_unlock_bh(&sk->sk_callback_lock); |
8525 |
+ |
8526 |
+ if (tunnel->encap == L2TP_ENCAPTYPE_UDP) { |
8527 |
+ struct udp_tunnel_sock_cfg udp_cfg = { |
8528 |
+@@ -1505,15 +1499,20 @@ int l2tp_tunnel_register(struct l2tp_tunnel *tunnel, struct net *net, |
8529 |
+ }; |
8530 |
+ |
8531 |
+ setup_udp_tunnel_sock(net, sock, &udp_cfg); |
8532 |
+- } else { |
8533 |
+- sk->sk_user_data = tunnel; |
8534 |
+ } |
8535 |
+ |
8536 |
+ tunnel->old_sk_destruct = sk->sk_destruct; |
8537 |
+ sk->sk_destruct = &l2tp_tunnel_destruct; |
8538 |
+- lockdep_set_class_and_name(&sk->sk_lock.slock, &l2tp_socket_class, |
8539 |
+- "l2tp_sock"); |
8540 |
+ sk->sk_allocation = GFP_ATOMIC; |
8541 |
++ release_sock(sk); |
8542 |
++ |
8543 |
++ sock_hold(sk); |
8544 |
++ tunnel->sock = sk; |
8545 |
++ tunnel->l2tp_net = net; |
8546 |
++ |
8547 |
++ spin_lock_bh(&pn->l2tp_tunnel_idr_lock); |
8548 |
++ idr_replace(&pn->l2tp_tunnel_idr, tunnel, tunnel->tunnel_id); |
8549 |
++ spin_unlock_bh(&pn->l2tp_tunnel_idr_lock); |
8550 |
+ |
8551 |
+ trace_register_tunnel(tunnel); |
8552 |
+ |
8553 |
+@@ -1522,12 +1521,16 @@ int l2tp_tunnel_register(struct l2tp_tunnel *tunnel, struct net *net, |
8554 |
+ |
8555 |
+ return 0; |
8556 |
+ |
8557 |
+-err_sock: |
8558 |
++err_inval_sock: |
8559 |
++ write_unlock_bh(&sk->sk_callback_lock); |
8560 |
++ release_sock(sk); |
8561 |
++ |
8562 |
+ if (tunnel->fd < 0) |
8563 |
+ sock_release(sock); |
8564 |
+ else |
8565 |
+ sockfd_put(sock); |
8566 |
+ err: |
8567 |
++ l2tp_tunnel_remove(net, tunnel); |
8568 |
+ return ret; |
8569 |
+ } |
8570 |
+ EXPORT_SYMBOL_GPL(l2tp_tunnel_register); |
8571 |
+@@ -1641,8 +1644,8 @@ static __net_init int l2tp_init_net(struct net *net) |
8572 |
+ struct l2tp_net *pn = net_generic(net, l2tp_net_id); |
8573 |
+ int hash; |
8574 |
+ |
8575 |
+- INIT_LIST_HEAD(&pn->l2tp_tunnel_list); |
8576 |
+- spin_lock_init(&pn->l2tp_tunnel_list_lock); |
8577 |
++ idr_init(&pn->l2tp_tunnel_idr); |
8578 |
++ spin_lock_init(&pn->l2tp_tunnel_idr_lock); |
8579 |
+ |
8580 |
+ for (hash = 0; hash < L2TP_HASH_SIZE_2; hash++) |
8581 |
+ INIT_HLIST_HEAD(&pn->l2tp_session_hlist[hash]); |
8582 |
+@@ -1656,11 +1659,13 @@ static __net_exit void l2tp_exit_net(struct net *net) |
8583 |
+ { |
8584 |
+ struct l2tp_net *pn = l2tp_pernet(net); |
8585 |
+ struct l2tp_tunnel *tunnel = NULL; |
8586 |
++ unsigned long tunnel_id, tmp; |
8587 |
+ int hash; |
8588 |
+ |
8589 |
+ rcu_read_lock_bh(); |
8590 |
+- list_for_each_entry_rcu(tunnel, &pn->l2tp_tunnel_list, list) { |
8591 |
+- l2tp_tunnel_delete(tunnel); |
8592 |
++ idr_for_each_entry_ul(&pn->l2tp_tunnel_idr, tunnel, tmp, tunnel_id) { |
8593 |
++ if (tunnel) |
8594 |
++ l2tp_tunnel_delete(tunnel); |
8595 |
+ } |
8596 |
+ rcu_read_unlock_bh(); |
8597 |
+ |
8598 |
+@@ -1670,6 +1675,7 @@ static __net_exit void l2tp_exit_net(struct net *net) |
8599 |
+ |
8600 |
+ for (hash = 0; hash < L2TP_HASH_SIZE_2; hash++) |
8601 |
+ WARN_ON_ONCE(!hlist_empty(&pn->l2tp_session_hlist[hash])); |
8602 |
++ idr_destroy(&pn->l2tp_tunnel_idr); |
8603 |
+ } |
8604 |
+ |
8605 |
+ static struct pernet_operations l2tp_net_ops = { |
8606 |
+diff --git a/net/mctp/af_mctp.c b/net/mctp/af_mctp.c |
8607 |
+index cbbde0f73a08c..a77fafbc31cf3 100644 |
8608 |
+--- a/net/mctp/af_mctp.c |
8609 |
++++ b/net/mctp/af_mctp.c |
8610 |
+@@ -288,6 +288,7 @@ static void mctp_sk_unhash(struct sock *sk) |
8611 |
+ |
8612 |
+ kfree_rcu(key, rcu); |
8613 |
+ } |
8614 |
++ sock_set_flag(sk, SOCK_DEAD); |
8615 |
+ spin_unlock_irqrestore(&net->mctp.keys_lock, flags); |
8616 |
+ |
8617 |
+ synchronize_rcu(); |
8618 |
+diff --git a/net/mctp/route.c b/net/mctp/route.c |
8619 |
+index 6aebb4a3eded0..89e67399249b4 100644 |
8620 |
+--- a/net/mctp/route.c |
8621 |
++++ b/net/mctp/route.c |
8622 |
+@@ -135,6 +135,11 @@ static int mctp_key_add(struct mctp_sk_key *key, struct mctp_sock *msk) |
8623 |
+ |
8624 |
+ spin_lock_irqsave(&net->mctp.keys_lock, flags); |
8625 |
+ |
8626 |
++ if (sock_flag(&msk->sk, SOCK_DEAD)) { |
8627 |
++ rc = -EINVAL; |
8628 |
++ goto out_unlock; |
8629 |
++ } |
8630 |
++ |
8631 |
+ hlist_for_each_entry(tmp, &net->mctp.keys, hlist) { |
8632 |
+ if (mctp_key_match(tmp, key->local_addr, key->peer_addr, |
8633 |
+ key->tag)) { |
8634 |
+@@ -148,6 +153,7 @@ static int mctp_key_add(struct mctp_sk_key *key, struct mctp_sock *msk) |
8635 |
+ hlist_add_head(&key->sklist, &msk->keys); |
8636 |
+ } |
8637 |
+ |
8638 |
++out_unlock: |
8639 |
+ spin_unlock_irqrestore(&net->mctp.keys_lock, flags); |
8640 |
+ |
8641 |
+ return rc; |
8642 |
+diff --git a/net/netfilter/nf_conntrack_proto_sctp.c b/net/netfilter/nf_conntrack_proto_sctp.c |
8643 |
+index 5a936334b517a..895e0ca542994 100644 |
8644 |
+--- a/net/netfilter/nf_conntrack_proto_sctp.c |
8645 |
++++ b/net/netfilter/nf_conntrack_proto_sctp.c |
8646 |
+@@ -27,22 +27,16 @@ |
8647 |
+ #include <net/netfilter/nf_conntrack_ecache.h> |
8648 |
+ #include <net/netfilter/nf_conntrack_timeout.h> |
8649 |
+ |
8650 |
+-/* FIXME: Examine ipfilter's timeouts and conntrack transitions more |
8651 |
+- closely. They're more complex. --RR |
8652 |
+- |
8653 |
+- And so for me for SCTP :D -Kiran */ |
8654 |
+- |
8655 |
+ static const char *const sctp_conntrack_names[] = { |
8656 |
+- "NONE", |
8657 |
+- "CLOSED", |
8658 |
+- "COOKIE_WAIT", |
8659 |
+- "COOKIE_ECHOED", |
8660 |
+- "ESTABLISHED", |
8661 |
+- "SHUTDOWN_SENT", |
8662 |
+- "SHUTDOWN_RECD", |
8663 |
+- "SHUTDOWN_ACK_SENT", |
8664 |
+- "HEARTBEAT_SENT", |
8665 |
+- "HEARTBEAT_ACKED", |
8666 |
++ [SCTP_CONNTRACK_NONE] = "NONE", |
8667 |
++ [SCTP_CONNTRACK_CLOSED] = "CLOSED", |
8668 |
++ [SCTP_CONNTRACK_COOKIE_WAIT] = "COOKIE_WAIT", |
8669 |
++ [SCTP_CONNTRACK_COOKIE_ECHOED] = "COOKIE_ECHOED", |
8670 |
++ [SCTP_CONNTRACK_ESTABLISHED] = "ESTABLISHED", |
8671 |
++ [SCTP_CONNTRACK_SHUTDOWN_SENT] = "SHUTDOWN_SENT", |
8672 |
++ [SCTP_CONNTRACK_SHUTDOWN_RECD] = "SHUTDOWN_RECD", |
8673 |
++ [SCTP_CONNTRACK_SHUTDOWN_ACK_SENT] = "SHUTDOWN_ACK_SENT", |
8674 |
++ [SCTP_CONNTRACK_HEARTBEAT_SENT] = "HEARTBEAT_SENT", |
8675 |
+ }; |
8676 |
+ |
8677 |
+ #define SECS * HZ |
8678 |
+@@ -54,12 +48,11 @@ static const unsigned int sctp_timeouts[SCTP_CONNTRACK_MAX] = { |
8679 |
+ [SCTP_CONNTRACK_CLOSED] = 10 SECS, |
8680 |
+ [SCTP_CONNTRACK_COOKIE_WAIT] = 3 SECS, |
8681 |
+ [SCTP_CONNTRACK_COOKIE_ECHOED] = 3 SECS, |
8682 |
+- [SCTP_CONNTRACK_ESTABLISHED] = 5 DAYS, |
8683 |
++ [SCTP_CONNTRACK_ESTABLISHED] = 210 SECS, |
8684 |
+ [SCTP_CONNTRACK_SHUTDOWN_SENT] = 300 SECS / 1000, |
8685 |
+ [SCTP_CONNTRACK_SHUTDOWN_RECD] = 300 SECS / 1000, |
8686 |
+ [SCTP_CONNTRACK_SHUTDOWN_ACK_SENT] = 3 SECS, |
8687 |
+ [SCTP_CONNTRACK_HEARTBEAT_SENT] = 30 SECS, |
8688 |
+- [SCTP_CONNTRACK_HEARTBEAT_ACKED] = 210 SECS, |
8689 |
+ }; |
8690 |
+ |
8691 |
+ #define SCTP_FLAG_HEARTBEAT_VTAG_FAILED 1 |
8692 |
+@@ -73,7 +66,6 @@ static const unsigned int sctp_timeouts[SCTP_CONNTRACK_MAX] = { |
8693 |
+ #define sSR SCTP_CONNTRACK_SHUTDOWN_RECD |
8694 |
+ #define sSA SCTP_CONNTRACK_SHUTDOWN_ACK_SENT |
8695 |
+ #define sHS SCTP_CONNTRACK_HEARTBEAT_SENT |
8696 |
+-#define sHA SCTP_CONNTRACK_HEARTBEAT_ACKED |
8697 |
+ #define sIV SCTP_CONNTRACK_MAX |
8698 |
+ |
8699 |
+ /* |
8700 |
+@@ -96,9 +88,6 @@ SHUTDOWN_ACK_SENT - We have seen a SHUTDOWN_ACK chunk in the direction opposite |
8701 |
+ CLOSED - We have seen a SHUTDOWN_COMPLETE chunk in the direction of |
8702 |
+ the SHUTDOWN chunk. Connection is closed. |
8703 |
+ HEARTBEAT_SENT - We have seen a HEARTBEAT in a new flow. |
8704 |
+-HEARTBEAT_ACKED - We have seen a HEARTBEAT-ACK in the direction opposite to |
8705 |
+- that of the HEARTBEAT chunk. Secondary connection is |
8706 |
+- established. |
8707 |
+ */ |
8708 |
+ |
8709 |
+ /* TODO |
8710 |
+@@ -115,33 +104,33 @@ cookie echoed to closed. |
8711 |
+ static const u8 sctp_conntracks[2][11][SCTP_CONNTRACK_MAX] = { |
8712 |
+ { |
8713 |
+ /* ORIGINAL */ |
8714 |
+-/* sNO, sCL, sCW, sCE, sES, sSS, sSR, sSA, sHS, sHA */ |
8715 |
+-/* init */ {sCL, sCL, sCW, sCE, sES, sSS, sSR, sSA, sCW, sHA}, |
8716 |
+-/* init_ack */ {sCL, sCL, sCW, sCE, sES, sSS, sSR, sSA, sCL, sHA}, |
8717 |
+-/* abort */ {sCL, sCL, sCL, sCL, sCL, sCL, sCL, sCL, sCL, sCL}, |
8718 |
+-/* shutdown */ {sCL, sCL, sCW, sCE, sSS, sSS, sSR, sSA, sCL, sSS}, |
8719 |
+-/* shutdown_ack */ {sSA, sCL, sCW, sCE, sES, sSA, sSA, sSA, sSA, sHA}, |
8720 |
+-/* error */ {sCL, sCL, sCW, sCE, sES, sSS, sSR, sSA, sCL, sHA},/* Can't have Stale cookie*/ |
8721 |
+-/* cookie_echo */ {sCL, sCL, sCE, sCE, sES, sSS, sSR, sSA, sCL, sHA},/* 5.2.4 - Big TODO */ |
8722 |
+-/* cookie_ack */ {sCL, sCL, sCW, sCE, sES, sSS, sSR, sSA, sCL, sHA},/* Can't come in orig dir */ |
8723 |
+-/* shutdown_comp*/ {sCL, sCL, sCW, sCE, sES, sSS, sSR, sCL, sCL, sHA}, |
8724 |
+-/* heartbeat */ {sHS, sCL, sCW, sCE, sES, sSS, sSR, sSA, sHS, sHA}, |
8725 |
+-/* heartbeat_ack*/ {sCL, sCL, sCW, sCE, sES, sSS, sSR, sSA, sHS, sHA} |
8726 |
++/* sNO, sCL, sCW, sCE, sES, sSS, sSR, sSA, sHS */ |
8727 |
++/* init */ {sCL, sCL, sCW, sCE, sES, sSS, sSR, sSA, sCW}, |
8728 |
++/* init_ack */ {sCL, sCL, sCW, sCE, sES, sSS, sSR, sSA, sCL}, |
8729 |
++/* abort */ {sCL, sCL, sCL, sCL, sCL, sCL, sCL, sCL, sCL}, |
8730 |
++/* shutdown */ {sCL, sCL, sCW, sCE, sSS, sSS, sSR, sSA, sCL}, |
8731 |
++/* shutdown_ack */ {sSA, sCL, sCW, sCE, sES, sSA, sSA, sSA, sSA}, |
8732 |
++/* error */ {sCL, sCL, sCW, sCE, sES, sSS, sSR, sSA, sCL},/* Can't have Stale cookie*/ |
8733 |
++/* cookie_echo */ {sCL, sCL, sCE, sCE, sES, sSS, sSR, sSA, sCL},/* 5.2.4 - Big TODO */ |
8734 |
++/* cookie_ack */ {sCL, sCL, sCW, sCE, sES, sSS, sSR, sSA, sCL},/* Can't come in orig dir */ |
8735 |
++/* shutdown_comp*/ {sCL, sCL, sCW, sCE, sES, sSS, sSR, sCL, sCL}, |
8736 |
++/* heartbeat */ {sHS, sCL, sCW, sCE, sES, sSS, sSR, sSA, sHS}, |
8737 |
++/* heartbeat_ack*/ {sCL, sCL, sCW, sCE, sES, sSS, sSR, sSA, sHS}, |
8738 |
+ }, |
8739 |
+ { |
8740 |
+ /* REPLY */ |
8741 |
+-/* sNO, sCL, sCW, sCE, sES, sSS, sSR, sSA, sHS, sHA */ |
8742 |
+-/* init */ {sIV, sCL, sCW, sCE, sES, sSS, sSR, sSA, sIV, sHA},/* INIT in sCL Big TODO */ |
8743 |
+-/* init_ack */ {sIV, sCW, sCW, sCE, sES, sSS, sSR, sSA, sIV, sHA}, |
8744 |
+-/* abort */ {sIV, sCL, sCL, sCL, sCL, sCL, sCL, sCL, sIV, sCL}, |
8745 |
+-/* shutdown */ {sIV, sCL, sCW, sCE, sSR, sSS, sSR, sSA, sIV, sSR}, |
8746 |
+-/* shutdown_ack */ {sIV, sCL, sCW, sCE, sES, sSA, sSA, sSA, sIV, sHA}, |
8747 |
+-/* error */ {sIV, sCL, sCW, sCL, sES, sSS, sSR, sSA, sIV, sHA}, |
8748 |
+-/* cookie_echo */ {sIV, sCL, sCW, sCE, sES, sSS, sSR, sSA, sIV, sHA},/* Can't come in reply dir */ |
8749 |
+-/* cookie_ack */ {sIV, sCL, sCW, sES, sES, sSS, sSR, sSA, sIV, sHA}, |
8750 |
+-/* shutdown_comp*/ {sIV, sCL, sCW, sCE, sES, sSS, sSR, sCL, sIV, sHA}, |
8751 |
+-/* heartbeat */ {sIV, sCL, sCW, sCE, sES, sSS, sSR, sSA, sHS, sHA}, |
8752 |
+-/* heartbeat_ack*/ {sIV, sCL, sCW, sCE, sES, sSS, sSR, sSA, sHA, sHA} |
8753 |
++/* sNO, sCL, sCW, sCE, sES, sSS, sSR, sSA, sHS */ |
8754 |
++/* init */ {sIV, sCL, sCW, sCE, sES, sSS, sSR, sSA, sIV},/* INIT in sCL Big TODO */ |
8755 |
++/* init_ack */ {sIV, sCW, sCW, sCE, sES, sSS, sSR, sSA, sIV}, |
8756 |
++/* abort */ {sIV, sCL, sCL, sCL, sCL, sCL, sCL, sCL, sIV}, |
8757 |
++/* shutdown */ {sIV, sCL, sCW, sCE, sSR, sSS, sSR, sSA, sIV}, |
8758 |
++/* shutdown_ack */ {sIV, sCL, sCW, sCE, sES, sSA, sSA, sSA, sIV}, |
8759 |
++/* error */ {sIV, sCL, sCW, sCL, sES, sSS, sSR, sSA, sIV}, |
8760 |
++/* cookie_echo */ {sIV, sCL, sCW, sCE, sES, sSS, sSR, sSA, sIV},/* Can't come in reply dir */ |
8761 |
++/* cookie_ack */ {sIV, sCL, sCW, sES, sES, sSS, sSR, sSA, sIV}, |
8762 |
++/* shutdown_comp*/ {sIV, sCL, sCW, sCE, sES, sSS, sSR, sCL, sIV}, |
8763 |
++/* heartbeat */ {sIV, sCL, sCW, sCE, sES, sSS, sSR, sSA, sHS}, |
8764 |
++/* heartbeat_ack*/ {sIV, sCL, sCW, sCE, sES, sSS, sSR, sSA, sES}, |
8765 |
+ } |
8766 |
+ }; |
8767 |
+ |
8768 |
+@@ -412,22 +401,29 @@ int nf_conntrack_sctp_packet(struct nf_conn *ct, |
8769 |
+ for_each_sctp_chunk (skb, sch, _sch, offset, dataoff, count) { |
8770 |
+ /* Special cases of Verification tag check (Sec 8.5.1) */ |
8771 |
+ if (sch->type == SCTP_CID_INIT) { |
8772 |
+- /* Sec 8.5.1 (A) */ |
8773 |
++ /* (A) vtag MUST be zero */ |
8774 |
+ if (sh->vtag != 0) |
8775 |
+ goto out_unlock; |
8776 |
+ } else if (sch->type == SCTP_CID_ABORT) { |
8777 |
+- /* Sec 8.5.1 (B) */ |
8778 |
+- if (sh->vtag != ct->proto.sctp.vtag[dir] && |
8779 |
+- sh->vtag != ct->proto.sctp.vtag[!dir]) |
8780 |
++ /* (B) vtag MUST match own vtag if T flag is unset OR |
8781 |
++ * MUST match peer's vtag if T flag is set |
8782 |
++ */ |
8783 |
++ if ((!(sch->flags & SCTP_CHUNK_FLAG_T) && |
8784 |
++ sh->vtag != ct->proto.sctp.vtag[dir]) || |
8785 |
++ ((sch->flags & SCTP_CHUNK_FLAG_T) && |
8786 |
++ sh->vtag != ct->proto.sctp.vtag[!dir])) |
8787 |
+ goto out_unlock; |
8788 |
+ } else if (sch->type == SCTP_CID_SHUTDOWN_COMPLETE) { |
8789 |
+- /* Sec 8.5.1 (C) */ |
8790 |
+- if (sh->vtag != ct->proto.sctp.vtag[dir] && |
8791 |
+- sh->vtag != ct->proto.sctp.vtag[!dir] && |
8792 |
+- sch->flags & SCTP_CHUNK_FLAG_T) |
8793 |
++ /* (C) vtag MUST match own vtag if T flag is unset OR |
8794 |
++ * MUST match peer's vtag if T flag is set |
8795 |
++ */ |
8796 |
++ if ((!(sch->flags & SCTP_CHUNK_FLAG_T) && |
8797 |
++ sh->vtag != ct->proto.sctp.vtag[dir]) || |
8798 |
++ ((sch->flags & SCTP_CHUNK_FLAG_T) && |
8799 |
++ sh->vtag != ct->proto.sctp.vtag[!dir])) |
8800 |
+ goto out_unlock; |
8801 |
+ } else if (sch->type == SCTP_CID_COOKIE_ECHO) { |
8802 |
+- /* Sec 8.5.1 (D) */ |
8803 |
++ /* (D) vtag must be same as init_vtag as found in INIT_ACK */ |
8804 |
+ if (sh->vtag != ct->proto.sctp.vtag[dir]) |
8805 |
+ goto out_unlock; |
8806 |
+ } else if (sch->type == SCTP_CID_HEARTBEAT) { |
8807 |
+@@ -501,8 +497,12 @@ int nf_conntrack_sctp_packet(struct nf_conn *ct, |
8808 |
+ } |
8809 |
+ |
8810 |
+ ct->proto.sctp.state = new_state; |
8811 |
+- if (old_state != new_state) |
8812 |
++ if (old_state != new_state) { |
8813 |
+ nf_conntrack_event_cache(IPCT_PROTOINFO, ct); |
8814 |
++ if (new_state == SCTP_CONNTRACK_ESTABLISHED && |
8815 |
++ !test_and_set_bit(IPS_ASSURED_BIT, &ct->status)) |
8816 |
++ nf_conntrack_event_cache(IPCT_ASSURED, ct); |
8817 |
++ } |
8818 |
+ } |
8819 |
+ spin_unlock_bh(&ct->lock); |
8820 |
+ |
8821 |
+@@ -516,14 +516,6 @@ int nf_conntrack_sctp_packet(struct nf_conn *ct, |
8822 |
+ |
8823 |
+ nf_ct_refresh_acct(ct, ctinfo, skb, timeouts[new_state]); |
8824 |
+ |
8825 |
+- if (old_state == SCTP_CONNTRACK_COOKIE_ECHOED && |
8826 |
+- dir == IP_CT_DIR_REPLY && |
8827 |
+- new_state == SCTP_CONNTRACK_ESTABLISHED) { |
8828 |
+- pr_debug("Setting assured bit\n"); |
8829 |
+- set_bit(IPS_ASSURED_BIT, &ct->status); |
8830 |
+- nf_conntrack_event_cache(IPCT_ASSURED, ct); |
8831 |
+- } |
8832 |
+- |
8833 |
+ return NF_ACCEPT; |
8834 |
+ |
8835 |
+ out_unlock: |
8836 |
+diff --git a/net/netfilter/nf_conntrack_standalone.c b/net/netfilter/nf_conntrack_standalone.c |
8837 |
+index 4d85368203e05..338f02a12076b 100644 |
8838 |
+--- a/net/netfilter/nf_conntrack_standalone.c |
8839 |
++++ b/net/netfilter/nf_conntrack_standalone.c |
8840 |
+@@ -599,7 +599,6 @@ enum nf_ct_sysctl_index { |
8841 |
+ NF_SYSCTL_CT_PROTO_TIMEOUT_SCTP_SHUTDOWN_RECD, |
8842 |
+ NF_SYSCTL_CT_PROTO_TIMEOUT_SCTP_SHUTDOWN_ACK_SENT, |
8843 |
+ NF_SYSCTL_CT_PROTO_TIMEOUT_SCTP_HEARTBEAT_SENT, |
8844 |
+- NF_SYSCTL_CT_PROTO_TIMEOUT_SCTP_HEARTBEAT_ACKED, |
8845 |
+ #endif |
8846 |
+ #ifdef CONFIG_NF_CT_PROTO_DCCP |
8847 |
+ NF_SYSCTL_CT_PROTO_TIMEOUT_DCCP_REQUEST, |
8848 |
+@@ -892,12 +891,6 @@ static struct ctl_table nf_ct_sysctl_table[] = { |
8849 |
+ .mode = 0644, |
8850 |
+ .proc_handler = proc_dointvec_jiffies, |
8851 |
+ }, |
8852 |
+- [NF_SYSCTL_CT_PROTO_TIMEOUT_SCTP_HEARTBEAT_ACKED] = { |
8853 |
+- .procname = "nf_conntrack_sctp_timeout_heartbeat_acked", |
8854 |
+- .maxlen = sizeof(unsigned int), |
8855 |
+- .mode = 0644, |
8856 |
+- .proc_handler = proc_dointvec_jiffies, |
8857 |
+- }, |
8858 |
+ #endif |
8859 |
+ #ifdef CONFIG_NF_CT_PROTO_DCCP |
8860 |
+ [NF_SYSCTL_CT_PROTO_TIMEOUT_DCCP_REQUEST] = { |
8861 |
+@@ -1041,7 +1034,6 @@ static void nf_conntrack_standalone_init_sctp_sysctl(struct net *net, |
8862 |
+ XASSIGN(SHUTDOWN_RECD, sn); |
8863 |
+ XASSIGN(SHUTDOWN_ACK_SENT, sn); |
8864 |
+ XASSIGN(HEARTBEAT_SENT, sn); |
8865 |
+- XASSIGN(HEARTBEAT_ACKED, sn); |
8866 |
+ #undef XASSIGN |
8867 |
+ #endif |
8868 |
+ } |
8869 |
+diff --git a/net/netfilter/nft_set_rbtree.c b/net/netfilter/nft_set_rbtree.c |
8870 |
+index 7325bee7d1442..19ea4d3c35535 100644 |
8871 |
+--- a/net/netfilter/nft_set_rbtree.c |
8872 |
++++ b/net/netfilter/nft_set_rbtree.c |
8873 |
+@@ -38,10 +38,12 @@ static bool nft_rbtree_interval_start(const struct nft_rbtree_elem *rbe) |
8874 |
+ return !nft_rbtree_interval_end(rbe); |
8875 |
+ } |
8876 |
+ |
8877 |
+-static bool nft_rbtree_equal(const struct nft_set *set, const void *this, |
8878 |
+- const struct nft_rbtree_elem *interval) |
8879 |
++static int nft_rbtree_cmp(const struct nft_set *set, |
8880 |
++ const struct nft_rbtree_elem *e1, |
8881 |
++ const struct nft_rbtree_elem *e2) |
8882 |
+ { |
8883 |
+- return memcmp(this, nft_set_ext_key(&interval->ext), set->klen) == 0; |
8884 |
++ return memcmp(nft_set_ext_key(&e1->ext), nft_set_ext_key(&e2->ext), |
8885 |
++ set->klen); |
8886 |
+ } |
8887 |
+ |
8888 |
+ static bool __nft_rbtree_lookup(const struct net *net, const struct nft_set *set, |
8889 |
+@@ -52,7 +54,6 @@ static bool __nft_rbtree_lookup(const struct net *net, const struct nft_set *set |
8890 |
+ const struct nft_rbtree_elem *rbe, *interval = NULL; |
8891 |
+ u8 genmask = nft_genmask_cur(net); |
8892 |
+ const struct rb_node *parent; |
8893 |
+- const void *this; |
8894 |
+ int d; |
8895 |
+ |
8896 |
+ parent = rcu_dereference_raw(priv->root.rb_node); |
8897 |
+@@ -62,12 +63,11 @@ static bool __nft_rbtree_lookup(const struct net *net, const struct nft_set *set |
8898 |
+ |
8899 |
+ rbe = rb_entry(parent, struct nft_rbtree_elem, node); |
8900 |
+ |
8901 |
+- this = nft_set_ext_key(&rbe->ext); |
8902 |
+- d = memcmp(this, key, set->klen); |
8903 |
++ d = memcmp(nft_set_ext_key(&rbe->ext), key, set->klen); |
8904 |
+ if (d < 0) { |
8905 |
+ parent = rcu_dereference_raw(parent->rb_left); |
8906 |
+ if (interval && |
8907 |
+- nft_rbtree_equal(set, this, interval) && |
8908 |
++ !nft_rbtree_cmp(set, rbe, interval) && |
8909 |
+ nft_rbtree_interval_end(rbe) && |
8910 |
+ nft_rbtree_interval_start(interval)) |
8911 |
+ continue; |
8912 |
+@@ -215,154 +215,216 @@ static void *nft_rbtree_get(const struct net *net, const struct nft_set *set, |
8913 |
+ return rbe; |
8914 |
+ } |
8915 |
+ |
8916 |
++static int nft_rbtree_gc_elem(const struct nft_set *__set, |
8917 |
++ struct nft_rbtree *priv, |
8918 |
++ struct nft_rbtree_elem *rbe) |
8919 |
++{ |
8920 |
++ struct nft_set *set = (struct nft_set *)__set; |
8921 |
++ struct rb_node *prev = rb_prev(&rbe->node); |
8922 |
++ struct nft_rbtree_elem *rbe_prev; |
8923 |
++ struct nft_set_gc_batch *gcb; |
8924 |
++ |
8925 |
++ gcb = nft_set_gc_batch_check(set, NULL, GFP_ATOMIC); |
8926 |
++ if (!gcb) |
8927 |
++ return -ENOMEM; |
8928 |
++ |
8929 |
++ /* search for expired end interval coming before this element. */ |
8930 |
++ do { |
8931 |
++ rbe_prev = rb_entry(prev, struct nft_rbtree_elem, node); |
8932 |
++ if (nft_rbtree_interval_end(rbe_prev)) |
8933 |
++ break; |
8934 |
++ |
8935 |
++ prev = rb_prev(prev); |
8936 |
++ } while (prev != NULL); |
8937 |
++ |
8938 |
++ rb_erase(&rbe_prev->node, &priv->root); |
8939 |
++ rb_erase(&rbe->node, &priv->root); |
8940 |
++ atomic_sub(2, &set->nelems); |
8941 |
++ |
8942 |
++ nft_set_gc_batch_add(gcb, rbe); |
8943 |
++ nft_set_gc_batch_complete(gcb); |
8944 |
++ |
8945 |
++ return 0; |
8946 |
++} |
8947 |
++ |
8948 |
++static bool nft_rbtree_update_first(const struct nft_set *set, |
8949 |
++ struct nft_rbtree_elem *rbe, |
8950 |
++ struct rb_node *first) |
8951 |
++{ |
8952 |
++ struct nft_rbtree_elem *first_elem; |
8953 |
++ |
8954 |
++ first_elem = rb_entry(first, struct nft_rbtree_elem, node); |
8955 |
++ /* this element is closest to where the new element is to be inserted: |
8956 |
++ * update the first element for the node list path. |
8957 |
++ */ |
8958 |
++ if (nft_rbtree_cmp(set, rbe, first_elem) < 0) |
8959 |
++ return true; |
8960 |
++ |
8961 |
++ return false; |
8962 |
++} |
8963 |
++ |
8964 |
+ static int __nft_rbtree_insert(const struct net *net, const struct nft_set *set, |
8965 |
+ struct nft_rbtree_elem *new, |
8966 |
+ struct nft_set_ext **ext) |
8967 |
+ { |
8968 |
+- bool overlap = false, dup_end_left = false, dup_end_right = false; |
8969 |
++ struct nft_rbtree_elem *rbe, *rbe_le = NULL, *rbe_ge = NULL; |
8970 |
++ struct rb_node *node, *parent, **p, *first = NULL; |
8971 |
+ struct nft_rbtree *priv = nft_set_priv(set); |
8972 |
+ u8 genmask = nft_genmask_next(net); |
8973 |
+- struct nft_rbtree_elem *rbe; |
8974 |
+- struct rb_node *parent, **p; |
8975 |
+- int d; |
8976 |
++ int d, err; |
8977 |
+ |
8978 |
+- /* Detect overlaps as we descend the tree. Set the flag in these cases: |
8979 |
+- * |
8980 |
+- * a1. _ _ __>| ?_ _ __| (insert end before existing end) |
8981 |
+- * a2. _ _ ___| ?_ _ _>| (insert end after existing end) |
8982 |
+- * a3. _ _ ___? >|_ _ __| (insert start before existing end) |
8983 |
+- * |
8984 |
+- * and clear it later on, as we eventually reach the points indicated by |
8985 |
+- * '?' above, in the cases described below. We'll always meet these |
8986 |
+- * later, locally, due to tree ordering, and overlaps for the intervals |
8987 |
+- * that are the closest together are always evaluated last. |
8988 |
+- * |
8989 |
+- * b1. _ _ __>| !_ _ __| (insert end before existing start) |
8990 |
+- * b2. _ _ ___| !_ _ _>| (insert end after existing start) |
8991 |
+- * b3. _ _ ___! >|_ _ __| (insert start after existing end, as a leaf) |
8992 |
+- * '--' no nodes falling in this range |
8993 |
+- * b4. >|_ _ ! (insert start before existing start) |
8994 |
+- * |
8995 |
+- * Case a3. resolves to b3.: |
8996 |
+- * - if the inserted start element is the leftmost, because the '0' |
8997 |
+- * element in the tree serves as end element |
8998 |
+- * - otherwise, if an existing end is found immediately to the left. If |
8999 |
+- * there are existing nodes in between, we need to further descend the |
9000 |
+- * tree before we can conclude the new start isn't causing an overlap |
9001 |
+- * |
9002 |
+- * or to b4., which, preceded by a3., means we already traversed one or |
9003 |
+- * more existing intervals entirely, from the right. |
9004 |
+- * |
9005 |
+- * For a new, rightmost pair of elements, we'll hit cases b3. and b2., |
9006 |
+- * in that order. |
9007 |
+- * |
9008 |
+- * The flag is also cleared in two special cases: |
9009 |
+- * |
9010 |
+- * b5. |__ _ _!|<_ _ _ (insert start right before existing end) |
9011 |
+- * b6. |__ _ >|!__ _ _ (insert end right after existing start) |
9012 |
+- * |
9013 |
+- * which always happen as last step and imply that no further |
9014 |
+- * overlapping is possible. |
9015 |
+- * |
9016 |
+- * Another special case comes from the fact that start elements matching |
9017 |
+- * an already existing start element are allowed: insertion is not |
9018 |
+- * performed but we return -EEXIST in that case, and the error will be |
9019 |
+- * cleared by the caller if NLM_F_EXCL is not present in the request. |
9020 |
+- * This way, request for insertion of an exact overlap isn't reported as |
9021 |
+- * error to userspace if not desired. |
9022 |
+- * |
9023 |
+- * However, if the existing start matches a pre-existing start, but the |
9024 |
+- * end element doesn't match the corresponding pre-existing end element, |
9025 |
+- * we need to report a partial overlap. This is a local condition that |
9026 |
+- * can be noticed without need for a tracking flag, by checking for a |
9027 |
+- * local duplicated end for a corresponding start, from left and right, |
9028 |
+- * separately. |
9029 |
++ /* Descend the tree to search for an existing element greater than the |
9030 |
++ * key value to insert that is greater than the new element. This is the |
9031 |
++ * first element to walk the ordered elements to find possible overlap. |
9032 |
+ */ |
9033 |
+- |
9034 |
+ parent = NULL; |
9035 |
+ p = &priv->root.rb_node; |
9036 |
+ while (*p != NULL) { |
9037 |
+ parent = *p; |
9038 |
+ rbe = rb_entry(parent, struct nft_rbtree_elem, node); |
9039 |
+- d = memcmp(nft_set_ext_key(&rbe->ext), |
9040 |
+- nft_set_ext_key(&new->ext), |
9041 |
+- set->klen); |
9042 |
++ d = nft_rbtree_cmp(set, rbe, new); |
9043 |
++ |
9044 |
+ if (d < 0) { |
9045 |
+ p = &parent->rb_left; |
9046 |
+- |
9047 |
+- if (nft_rbtree_interval_start(new)) { |
9048 |
+- if (nft_rbtree_interval_end(rbe) && |
9049 |
+- nft_set_elem_active(&rbe->ext, genmask) && |
9050 |
+- !nft_set_elem_expired(&rbe->ext) && !*p) |
9051 |
+- overlap = false; |
9052 |
+- } else { |
9053 |
+- if (dup_end_left && !*p) |
9054 |
+- return -ENOTEMPTY; |
9055 |
+- |
9056 |
+- overlap = nft_rbtree_interval_end(rbe) && |
9057 |
+- nft_set_elem_active(&rbe->ext, |
9058 |
+- genmask) && |
9059 |
+- !nft_set_elem_expired(&rbe->ext); |
9060 |
+- |
9061 |
+- if (overlap) { |
9062 |
+- dup_end_right = true; |
9063 |
+- continue; |
9064 |
+- } |
9065 |
+- } |
9066 |
+ } else if (d > 0) { |
9067 |
+- p = &parent->rb_right; |
9068 |
++ if (!first || |
9069 |
++ nft_rbtree_update_first(set, rbe, first)) |
9070 |
++ first = &rbe->node; |
9071 |
+ |
9072 |
+- if (nft_rbtree_interval_end(new)) { |
9073 |
+- if (dup_end_right && !*p) |
9074 |
+- return -ENOTEMPTY; |
9075 |
+- |
9076 |
+- overlap = nft_rbtree_interval_end(rbe) && |
9077 |
+- nft_set_elem_active(&rbe->ext, |
9078 |
+- genmask) && |
9079 |
+- !nft_set_elem_expired(&rbe->ext); |
9080 |
+- |
9081 |
+- if (overlap) { |
9082 |
+- dup_end_left = true; |
9083 |
+- continue; |
9084 |
+- } |
9085 |
+- } else if (nft_set_elem_active(&rbe->ext, genmask) && |
9086 |
+- !nft_set_elem_expired(&rbe->ext)) { |
9087 |
+- overlap = nft_rbtree_interval_end(rbe); |
9088 |
+- } |
9089 |
++ p = &parent->rb_right; |
9090 |
+ } else { |
9091 |
+- if (nft_rbtree_interval_end(rbe) && |
9092 |
+- nft_rbtree_interval_start(new)) { |
9093 |
++ if (nft_rbtree_interval_end(rbe)) |
9094 |
+ p = &parent->rb_left; |
9095 |
+- |
9096 |
+- if (nft_set_elem_active(&rbe->ext, genmask) && |
9097 |
+- !nft_set_elem_expired(&rbe->ext)) |
9098 |
+- overlap = false; |
9099 |
+- } else if (nft_rbtree_interval_start(rbe) && |
9100 |
+- nft_rbtree_interval_end(new)) { |
9101 |
++ else |
9102 |
+ p = &parent->rb_right; |
9103 |
++ } |
9104 |
++ } |
9105 |
++ |
9106 |
++ if (!first) |
9107 |
++ first = rb_first(&priv->root); |
9108 |
++ |
9109 |
++ /* Detect overlap by going through the list of valid tree nodes. |
9110 |
++ * Values stored in the tree are in reversed order, starting from |
9111 |
++ * highest to lowest value. |
9112 |
++ */ |
9113 |
++ for (node = first; node != NULL; node = rb_next(node)) { |
9114 |
++ rbe = rb_entry(node, struct nft_rbtree_elem, node); |
9115 |
+ |
9116 |
+- if (nft_set_elem_active(&rbe->ext, genmask) && |
9117 |
+- !nft_set_elem_expired(&rbe->ext)) |
9118 |
+- overlap = false; |
9119 |
+- } else if (nft_set_elem_active(&rbe->ext, genmask) && |
9120 |
+- !nft_set_elem_expired(&rbe->ext)) { |
9121 |
+- *ext = &rbe->ext; |
9122 |
+- return -EEXIST; |
9123 |
+- } else { |
9124 |
+- overlap = false; |
9125 |
+- if (nft_rbtree_interval_end(rbe)) |
9126 |
+- p = &parent->rb_left; |
9127 |
+- else |
9128 |
+- p = &parent->rb_right; |
9129 |
++ if (!nft_set_elem_active(&rbe->ext, genmask)) |
9130 |
++ continue; |
9131 |
++ |
9132 |
++ /* perform garbage collection to avoid bogus overlap reports. */ |
9133 |
++ if (nft_set_elem_expired(&rbe->ext)) { |
9134 |
++ err = nft_rbtree_gc_elem(set, priv, rbe); |
9135 |
++ if (err < 0) |
9136 |
++ return err; |
9137 |
++ |
9138 |
++ continue; |
9139 |
++ } |
9140 |
++ |
9141 |
++ d = nft_rbtree_cmp(set, rbe, new); |
9142 |
++ if (d == 0) { |
9143 |
++ /* Matching end element: no need to look for an |
9144 |
++ * overlapping greater or equal element. |
9145 |
++ */ |
9146 |
++ if (nft_rbtree_interval_end(rbe)) { |
9147 |
++ rbe_le = rbe; |
9148 |
++ break; |
9149 |
++ } |
9150 |
++ |
9151 |
++ /* first element that is greater or equal to key value. */ |
9152 |
++ if (!rbe_ge) { |
9153 |
++ rbe_ge = rbe; |
9154 |
++ continue; |
9155 |
++ } |
9156 |
++ |
9157 |
++ /* this is a closer more or equal element, update it. */ |
9158 |
++ if (nft_rbtree_cmp(set, rbe_ge, new) != 0) { |
9159 |
++ rbe_ge = rbe; |
9160 |
++ continue; |
9161 |
++ } |
9162 |
++ |
9163 |
++ /* element is equal to key value, make sure flags are |
9164 |
++ * the same, an existing more or equal start element |
9165 |
++ * must not be replaced by more or equal end element. |
9166 |
++ */ |
9167 |
++ if ((nft_rbtree_interval_start(new) && |
9168 |
++ nft_rbtree_interval_start(rbe_ge)) || |
9169 |
++ (nft_rbtree_interval_end(new) && |
9170 |
++ nft_rbtree_interval_end(rbe_ge))) { |
9171 |
++ rbe_ge = rbe; |
9172 |
++ continue; |
9173 |
+ } |
9174 |
++ } else if (d > 0) { |
9175 |
++ /* annotate element greater than the new element. */ |
9176 |
++ rbe_ge = rbe; |
9177 |
++ continue; |
9178 |
++ } else if (d < 0) { |
9179 |
++ /* annotate element less than the new element. */ |
9180 |
++ rbe_le = rbe; |
9181 |
++ break; |
9182 |
+ } |
9183 |
++ } |
9184 |
+ |
9185 |
+- dup_end_left = dup_end_right = false; |
9186 |
++ /* - new start element matching existing start element: full overlap |
9187 |
++ * reported as -EEXIST, cleared by caller if NLM_F_EXCL is not given. |
9188 |
++ */ |
9189 |
++ if (rbe_ge && !nft_rbtree_cmp(set, new, rbe_ge) && |
9190 |
++ nft_rbtree_interval_start(rbe_ge) == nft_rbtree_interval_start(new)) { |
9191 |
++ *ext = &rbe_ge->ext; |
9192 |
++ return -EEXIST; |
9193 |
+ } |
9194 |
+ |
9195 |
+- if (overlap) |
9196 |
++ /* - new end element matching existing end element: full overlap |
9197 |
++ * reported as -EEXIST, cleared by caller if NLM_F_EXCL is not given. |
9198 |
++ */ |
9199 |
++ if (rbe_le && !nft_rbtree_cmp(set, new, rbe_le) && |
9200 |
++ nft_rbtree_interval_end(rbe_le) == nft_rbtree_interval_end(new)) { |
9201 |
++ *ext = &rbe_le->ext; |
9202 |
++ return -EEXIST; |
9203 |
++ } |
9204 |
++ |
9205 |
++ /* - new start element with existing closest, less or equal key value |
9206 |
++ * being a start element: partial overlap, reported as -ENOTEMPTY. |
9207 |
++ * Anonymous sets allow for two consecutive start element since they |
9208 |
++ * are constant, skip them to avoid bogus overlap reports. |
9209 |
++ */ |
9210 |
++ if (!nft_set_is_anonymous(set) && rbe_le && |
9211 |
++ nft_rbtree_interval_start(rbe_le) && nft_rbtree_interval_start(new)) |
9212 |
++ return -ENOTEMPTY; |
9213 |
++ |
9214 |
++ /* - new end element with existing closest, less or equal key value |
9215 |
++ * being a end element: partial overlap, reported as -ENOTEMPTY. |
9216 |
++ */ |
9217 |
++ if (rbe_le && |
9218 |
++ nft_rbtree_interval_end(rbe_le) && nft_rbtree_interval_end(new)) |
9219 |
+ return -ENOTEMPTY; |
9220 |
+ |
9221 |
++ /* - new end element with existing closest, greater or equal key value |
9222 |
++ * being an end element: partial overlap, reported as -ENOTEMPTY |
9223 |
++ */ |
9224 |
++ if (rbe_ge && |
9225 |
++ nft_rbtree_interval_end(rbe_ge) && nft_rbtree_interval_end(new)) |
9226 |
++ return -ENOTEMPTY; |
9227 |
++ |
9228 |
++ /* Accepted element: pick insertion point depending on key value */ |
9229 |
++ parent = NULL; |
9230 |
++ p = &priv->root.rb_node; |
9231 |
++ while (*p != NULL) { |
9232 |
++ parent = *p; |
9233 |
++ rbe = rb_entry(parent, struct nft_rbtree_elem, node); |
9234 |
++ d = nft_rbtree_cmp(set, rbe, new); |
9235 |
++ |
9236 |
++ if (d < 0) |
9237 |
++ p = &parent->rb_left; |
9238 |
++ else if (d > 0) |
9239 |
++ p = &parent->rb_right; |
9240 |
++ else if (nft_rbtree_interval_end(rbe)) |
9241 |
++ p = &parent->rb_left; |
9242 |
++ else |
9243 |
++ p = &parent->rb_right; |
9244 |
++ } |
9245 |
++ |
9246 |
+ rb_link_node_rcu(&new->node, parent, p); |
9247 |
+ rb_insert_color(&new->node, &priv->root); |
9248 |
+ return 0; |
9249 |
+@@ -501,23 +563,37 @@ static void nft_rbtree_gc(struct work_struct *work) |
9250 |
+ struct nft_rbtree *priv; |
9251 |
+ struct rb_node *node; |
9252 |
+ struct nft_set *set; |
9253 |
++ struct net *net; |
9254 |
++ u8 genmask; |
9255 |
+ |
9256 |
+ priv = container_of(work, struct nft_rbtree, gc_work.work); |
9257 |
+ set = nft_set_container_of(priv); |
9258 |
++ net = read_pnet(&set->net); |
9259 |
++ genmask = nft_genmask_cur(net); |
9260 |
+ |
9261 |
+ write_lock_bh(&priv->lock); |
9262 |
+ write_seqcount_begin(&priv->count); |
9263 |
+ for (node = rb_first(&priv->root); node != NULL; node = rb_next(node)) { |
9264 |
+ rbe = rb_entry(node, struct nft_rbtree_elem, node); |
9265 |
+ |
9266 |
++ if (!nft_set_elem_active(&rbe->ext, genmask)) |
9267 |
++ continue; |
9268 |
++ |
9269 |
++ /* elements are reversed in the rbtree for historical reasons, |
9270 |
++ * from highest to lowest value, that is why end element is |
9271 |
++ * always visited before the start element. |
9272 |
++ */ |
9273 |
+ if (nft_rbtree_interval_end(rbe)) { |
9274 |
+ rbe_end = rbe; |
9275 |
+ continue; |
9276 |
+ } |
9277 |
+ if (!nft_set_elem_expired(&rbe->ext)) |
9278 |
+ continue; |
9279 |
+- if (nft_set_elem_mark_busy(&rbe->ext)) |
9280 |
++ |
9281 |
++ if (nft_set_elem_mark_busy(&rbe->ext)) { |
9282 |
++ rbe_end = NULL; |
9283 |
+ continue; |
9284 |
++ } |
9285 |
+ |
9286 |
+ if (rbe_prev) { |
9287 |
+ rb_erase(&rbe_prev->node, &priv->root); |
9288 |
+diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c |
9289 |
+index 974d32632ef41..011ec7d9a719e 100644 |
9290 |
+--- a/net/netlink/af_netlink.c |
9291 |
++++ b/net/netlink/af_netlink.c |
9292 |
+@@ -578,7 +578,9 @@ static int netlink_insert(struct sock *sk, u32 portid) |
9293 |
+ if (nlk_sk(sk)->bound) |
9294 |
+ goto err; |
9295 |
+ |
9296 |
+- nlk_sk(sk)->portid = portid; |
9297 |
++ /* portid can be read locklessly from netlink_getname(). */ |
9298 |
++ WRITE_ONCE(nlk_sk(sk)->portid, portid); |
9299 |
++ |
9300 |
+ sock_hold(sk); |
9301 |
+ |
9302 |
+ err = __netlink_insert(table, sk); |
9303 |
+@@ -1087,9 +1089,11 @@ static int netlink_connect(struct socket *sock, struct sockaddr *addr, |
9304 |
+ return -EINVAL; |
9305 |
+ |
9306 |
+ if (addr->sa_family == AF_UNSPEC) { |
9307 |
+- sk->sk_state = NETLINK_UNCONNECTED; |
9308 |
+- nlk->dst_portid = 0; |
9309 |
+- nlk->dst_group = 0; |
9310 |
++ /* paired with READ_ONCE() in netlink_getsockbyportid() */ |
9311 |
++ WRITE_ONCE(sk->sk_state, NETLINK_UNCONNECTED); |
9312 |
++ /* dst_portid and dst_group can be read locklessly */ |
9313 |
++ WRITE_ONCE(nlk->dst_portid, 0); |
9314 |
++ WRITE_ONCE(nlk->dst_group, 0); |
9315 |
+ return 0; |
9316 |
+ } |
9317 |
+ if (addr->sa_family != AF_NETLINK) |
9318 |
+@@ -1110,9 +1114,11 @@ static int netlink_connect(struct socket *sock, struct sockaddr *addr, |
9319 |
+ err = netlink_autobind(sock); |
9320 |
+ |
9321 |
+ if (err == 0) { |
9322 |
+- sk->sk_state = NETLINK_CONNECTED; |
9323 |
+- nlk->dst_portid = nladdr->nl_pid; |
9324 |
+- nlk->dst_group = ffs(nladdr->nl_groups); |
9325 |
++ /* paired with READ_ONCE() in netlink_getsockbyportid() */ |
9326 |
++ WRITE_ONCE(sk->sk_state, NETLINK_CONNECTED); |
9327 |
++ /* dst_portid and dst_group can be read locklessly */ |
9328 |
++ WRITE_ONCE(nlk->dst_portid, nladdr->nl_pid); |
9329 |
++ WRITE_ONCE(nlk->dst_group, ffs(nladdr->nl_groups)); |
9330 |
+ } |
9331 |
+ |
9332 |
+ return err; |
9333 |
+@@ -1129,10 +1135,12 @@ static int netlink_getname(struct socket *sock, struct sockaddr *addr, |
9334 |
+ nladdr->nl_pad = 0; |
9335 |
+ |
9336 |
+ if (peer) { |
9337 |
+- nladdr->nl_pid = nlk->dst_portid; |
9338 |
+- nladdr->nl_groups = netlink_group_mask(nlk->dst_group); |
9339 |
++ /* Paired with WRITE_ONCE() in netlink_connect() */ |
9340 |
++ nladdr->nl_pid = READ_ONCE(nlk->dst_portid); |
9341 |
++ nladdr->nl_groups = netlink_group_mask(READ_ONCE(nlk->dst_group)); |
9342 |
+ } else { |
9343 |
+- nladdr->nl_pid = nlk->portid; |
9344 |
++ /* Paired with WRITE_ONCE() in netlink_insert() */ |
9345 |
++ nladdr->nl_pid = READ_ONCE(nlk->portid); |
9346 |
+ netlink_lock_table(); |
9347 |
+ nladdr->nl_groups = nlk->groups ? nlk->groups[0] : 0; |
9348 |
+ netlink_unlock_table(); |
9349 |
+@@ -1159,8 +1167,9 @@ static struct sock *netlink_getsockbyportid(struct sock *ssk, u32 portid) |
9350 |
+ |
9351 |
+ /* Don't bother queuing skb if kernel socket has no input function */ |
9352 |
+ nlk = nlk_sk(sock); |
9353 |
+- if (sock->sk_state == NETLINK_CONNECTED && |
9354 |
+- nlk->dst_portid != nlk_sk(ssk)->portid) { |
9355 |
++ /* dst_portid and sk_state can be changed in netlink_connect() */ |
9356 |
++ if (READ_ONCE(sock->sk_state) == NETLINK_CONNECTED && |
9357 |
++ READ_ONCE(nlk->dst_portid) != nlk_sk(ssk)->portid) { |
9358 |
+ sock_put(sock); |
9359 |
+ return ERR_PTR(-ECONNREFUSED); |
9360 |
+ } |
9361 |
+@@ -1896,8 +1905,9 @@ static int netlink_sendmsg(struct socket *sock, struct msghdr *msg, size_t len) |
9362 |
+ goto out; |
9363 |
+ netlink_skb_flags |= NETLINK_SKB_DST; |
9364 |
+ } else { |
9365 |
+- dst_portid = nlk->dst_portid; |
9366 |
+- dst_group = nlk->dst_group; |
9367 |
++ /* Paired with WRITE_ONCE() in netlink_connect() */ |
9368 |
++ dst_portid = READ_ONCE(nlk->dst_portid); |
9369 |
++ dst_group = READ_ONCE(nlk->dst_group); |
9370 |
+ } |
9371 |
+ |
9372 |
+ /* Paired with WRITE_ONCE() in netlink_insert() */ |
9373 |
+diff --git a/net/netrom/nr_timer.c b/net/netrom/nr_timer.c |
9374 |
+index a8da88db7893f..4e7c968cde2dc 100644 |
9375 |
+--- a/net/netrom/nr_timer.c |
9376 |
++++ b/net/netrom/nr_timer.c |
9377 |
+@@ -121,6 +121,7 @@ static void nr_heartbeat_expiry(struct timer_list *t) |
9378 |
+ is accepted() it isn't 'dead' so doesn't get removed. */ |
9379 |
+ if (sock_flag(sk, SOCK_DESTROY) || |
9380 |
+ (sk->sk_state == TCP_LISTEN && sock_flag(sk, SOCK_DEAD))) { |
9381 |
++ sock_hold(sk); |
9382 |
+ bh_unlock_sock(sk); |
9383 |
+ nr_destroy_socket(sk); |
9384 |
+ goto out; |
9385 |
+diff --git a/net/nfc/llcp_core.c b/net/nfc/llcp_core.c |
9386 |
+index eaeb2b1cfa6ac..fd43e75abd948 100644 |
9387 |
+--- a/net/nfc/llcp_core.c |
9388 |
++++ b/net/nfc/llcp_core.c |
9389 |
+@@ -159,6 +159,7 @@ static void local_cleanup(struct nfc_llcp_local *local) |
9390 |
+ cancel_work_sync(&local->rx_work); |
9391 |
+ cancel_work_sync(&local->timeout_work); |
9392 |
+ kfree_skb(local->rx_pending); |
9393 |
++ local->rx_pending = NULL; |
9394 |
+ del_timer_sync(&local->sdreq_timer); |
9395 |
+ cancel_work_sync(&local->sdreq_timeout_work); |
9396 |
+ nfc_llcp_free_sdp_tlv_list(&local->pending_sdreqs); |
9397 |
+diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c |
9398 |
+index caabdaa2f30f6..45b92e40082ef 100644 |
9399 |
+--- a/net/sched/sch_htb.c |
9400 |
++++ b/net/sched/sch_htb.c |
9401 |
+@@ -1558,7 +1558,7 @@ static int htb_destroy_class_offload(struct Qdisc *sch, struct htb_class *cl, |
9402 |
+ struct tc_htb_qopt_offload offload_opt; |
9403 |
+ struct netdev_queue *dev_queue; |
9404 |
+ struct Qdisc *q = cl->leaf.q; |
9405 |
+- struct Qdisc *old = NULL; |
9406 |
++ struct Qdisc *old; |
9407 |
+ int err; |
9408 |
+ |
9409 |
+ if (cl->level) |
9410 |
+@@ -1566,14 +1566,17 @@ static int htb_destroy_class_offload(struct Qdisc *sch, struct htb_class *cl, |
9411 |
+ |
9412 |
+ WARN_ON(!q); |
9413 |
+ dev_queue = htb_offload_get_queue(cl); |
9414 |
+- old = htb_graft_helper(dev_queue, NULL); |
9415 |
+- if (destroying) |
9416 |
+- /* Before HTB is destroyed, the kernel grafts noop_qdisc to |
9417 |
+- * all queues. |
9418 |
++ /* When destroying, caller qdisc_graft grafts the new qdisc and invokes |
9419 |
++ * qdisc_put for the qdisc being destroyed. htb_destroy_class_offload |
9420 |
++ * does not need to graft or qdisc_put the qdisc being destroyed. |
9421 |
++ */ |
9422 |
++ if (!destroying) { |
9423 |
++ old = htb_graft_helper(dev_queue, NULL); |
9424 |
++ /* Last qdisc grafted should be the same as cl->leaf.q when |
9425 |
++ * calling htb_delete. |
9426 |
+ */ |
9427 |
+- WARN_ON(!(old->flags & TCQ_F_BUILTIN)); |
9428 |
+- else |
9429 |
+ WARN_ON(old != q); |
9430 |
++ } |
9431 |
+ |
9432 |
+ if (cl->parent) { |
9433 |
+ cl->parent->bstats_bias.bytes += q->bstats.bytes; |
9434 |
+@@ -1589,10 +1592,12 @@ static int htb_destroy_class_offload(struct Qdisc *sch, struct htb_class *cl, |
9435 |
+ }; |
9436 |
+ err = htb_offload(qdisc_dev(sch), &offload_opt); |
9437 |
+ |
9438 |
+- if (!err || destroying) |
9439 |
+- qdisc_put(old); |
9440 |
+- else |
9441 |
+- htb_graft_helper(dev_queue, old); |
9442 |
++ if (!destroying) { |
9443 |
++ if (!err) |
9444 |
++ qdisc_put(old); |
9445 |
++ else |
9446 |
++ htb_graft_helper(dev_queue, old); |
9447 |
++ } |
9448 |
+ |
9449 |
+ if (last_child) |
9450 |
+ return err; |
9451 |
+diff --git a/net/sched/sch_taprio.c b/net/sched/sch_taprio.c |
9452 |
+index bd10a8eeb82db..135ea8b3816f1 100644 |
9453 |
+--- a/net/sched/sch_taprio.c |
9454 |
++++ b/net/sched/sch_taprio.c |
9455 |
+@@ -1632,6 +1632,7 @@ static void taprio_reset(struct Qdisc *sch) |
9456 |
+ int i; |
9457 |
+ |
9458 |
+ hrtimer_cancel(&q->advance_timer); |
9459 |
++ |
9460 |
+ if (q->qdiscs) { |
9461 |
+ for (i = 0; i < dev->num_tx_queues; i++) |
9462 |
+ if (q->qdiscs[i]) |
9463 |
+@@ -1653,6 +1654,7 @@ static void taprio_destroy(struct Qdisc *sch) |
9464 |
+ * happens in qdisc_create(), after taprio_init() has been called. |
9465 |
+ */ |
9466 |
+ hrtimer_cancel(&q->advance_timer); |
9467 |
++ qdisc_synchronize(sch); |
9468 |
+ |
9469 |
+ taprio_disable_offload(dev, q, NULL); |
9470 |
+ |
9471 |
+diff --git a/net/sctp/bind_addr.c b/net/sctp/bind_addr.c |
9472 |
+index 59e653b528b1f..6b95d3ba8fe1c 100644 |
9473 |
+--- a/net/sctp/bind_addr.c |
9474 |
++++ b/net/sctp/bind_addr.c |
9475 |
+@@ -73,6 +73,12 @@ int sctp_bind_addr_copy(struct net *net, struct sctp_bind_addr *dest, |
9476 |
+ } |
9477 |
+ } |
9478 |
+ |
9479 |
++ /* If somehow no addresses were found that can be used with this |
9480 |
++ * scope, it's an error. |
9481 |
++ */ |
9482 |
++ if (list_empty(&dest->address_list)) |
9483 |
++ error = -ENETUNREACH; |
9484 |
++ |
9485 |
+ out: |
9486 |
+ if (error) |
9487 |
+ sctp_bind_addr_clean(dest); |
9488 |
+diff --git a/scripts/Makefile b/scripts/Makefile |
9489 |
+index 9adb6d247818f..e2a239829556c 100644 |
9490 |
+--- a/scripts/Makefile |
9491 |
++++ b/scripts/Makefile |
9492 |
+@@ -3,8 +3,8 @@ |
9493 |
+ # scripts contains sources for various helper programs used throughout |
9494 |
+ # the kernel for the build process. |
9495 |
+ |
9496 |
+-CRYPTO_LIBS = $(shell pkg-config --libs libcrypto 2> /dev/null || echo -lcrypto) |
9497 |
+-CRYPTO_CFLAGS = $(shell pkg-config --cflags libcrypto 2> /dev/null) |
9498 |
++CRYPTO_LIBS = $(shell $(HOSTPKG_CONFIG) --libs libcrypto 2> /dev/null || echo -lcrypto) |
9499 |
++CRYPTO_CFLAGS = $(shell $(HOSTPKG_CONFIG) --cflags libcrypto 2> /dev/null) |
9500 |
+ |
9501 |
+ hostprogs-always-$(CONFIG_BUILD_BIN2C) += bin2c |
9502 |
+ hostprogs-always-$(CONFIG_KALLSYMS) += kallsyms |
9503 |
+diff --git a/scripts/dtc/Makefile b/scripts/dtc/Makefile |
9504 |
+index 1cba78e1dce68..2d5f274d6efde 100644 |
9505 |
+--- a/scripts/dtc/Makefile |
9506 |
++++ b/scripts/dtc/Makefile |
9507 |
+@@ -18,7 +18,7 @@ fdtoverlay-objs := $(libfdt) fdtoverlay.o util.o |
9508 |
+ # Source files need to get at the userspace version of libfdt_env.h to compile |
9509 |
+ HOST_EXTRACFLAGS += -I $(srctree)/$(src)/libfdt |
9510 |
+ |
9511 |
+-ifeq ($(shell pkg-config --exists yaml-0.1 2>/dev/null && echo yes),) |
9512 |
++ifeq ($(shell $(HOSTPKG_CONFIG) --exists yaml-0.1 2>/dev/null && echo yes),) |
9513 |
+ ifneq ($(CHECK_DT_BINDING)$(CHECK_DTBS),) |
9514 |
+ $(error dtc needs libyaml for DT schema validation support. \ |
9515 |
+ Install the necessary libyaml development package.) |
9516 |
+@@ -27,9 +27,9 @@ HOST_EXTRACFLAGS += -DNO_YAML |
9517 |
+ else |
9518 |
+ dtc-objs += yamltree.o |
9519 |
+ # To include <yaml.h> installed in a non-default path |
9520 |
+-HOSTCFLAGS_yamltree.o := $(shell pkg-config --cflags yaml-0.1) |
9521 |
++HOSTCFLAGS_yamltree.o := $(shell $(HOSTPKG_CONFIG) --cflags yaml-0.1) |
9522 |
+ # To link libyaml installed in a non-default path |
9523 |
+-HOSTLDLIBS_dtc := $(shell pkg-config --libs yaml-0.1) |
9524 |
++HOSTLDLIBS_dtc := $(shell $(HOSTPKG_CONFIG) --libs yaml-0.1) |
9525 |
+ endif |
9526 |
+ |
9527 |
+ # Generated files need one more search path to include headers in source tree |
9528 |
+diff --git a/scripts/kconfig/gconf-cfg.sh b/scripts/kconfig/gconf-cfg.sh |
9529 |
+index 480ecd8b9f415..cbd90c28c05f2 100755 |
9530 |
+--- a/scripts/kconfig/gconf-cfg.sh |
9531 |
++++ b/scripts/kconfig/gconf-cfg.sh |
9532 |
+@@ -3,14 +3,14 @@ |
9533 |
+ |
9534 |
+ PKG="gtk+-2.0 gmodule-2.0 libglade-2.0" |
9535 |
+ |
9536 |
+-if [ -z "$(command -v pkg-config)" ]; then |
9537 |
++if [ -z "$(command -v ${HOSTPKG_CONFIG})" ]; then |
9538 |
+ echo >&2 "*" |
9539 |
+- echo >&2 "* 'make gconfig' requires 'pkg-config'. Please install it." |
9540 |
++ echo >&2 "* 'make gconfig' requires '${HOSTPKG_CONFIG}'. Please install it." |
9541 |
+ echo >&2 "*" |
9542 |
+ exit 1 |
9543 |
+ fi |
9544 |
+ |
9545 |
+-if ! pkg-config --exists $PKG; then |
9546 |
++if ! ${HOSTPKG_CONFIG} --exists $PKG; then |
9547 |
+ echo >&2 "*" |
9548 |
+ echo >&2 "* Unable to find the GTK+ installation. Please make sure that" |
9549 |
+ echo >&2 "* the GTK+ 2.0 development package is correctly installed." |
9550 |
+@@ -19,12 +19,12 @@ if ! pkg-config --exists $PKG; then |
9551 |
+ exit 1 |
9552 |
+ fi |
9553 |
+ |
9554 |
+-if ! pkg-config --atleast-version=2.0.0 gtk+-2.0; then |
9555 |
++if ! ${HOSTPKG_CONFIG} --atleast-version=2.0.0 gtk+-2.0; then |
9556 |
+ echo >&2 "*" |
9557 |
+ echo >&2 "* GTK+ is present but version >= 2.0.0 is required." |
9558 |
+ echo >&2 "*" |
9559 |
+ exit 1 |
9560 |
+ fi |
9561 |
+ |
9562 |
+-echo cflags=\"$(pkg-config --cflags $PKG)\" |
9563 |
+-echo libs=\"$(pkg-config --libs $PKG)\" |
9564 |
++echo cflags=\"$(${HOSTPKG_CONFIG} --cflags $PKG)\" |
9565 |
++echo libs=\"$(${HOSTPKG_CONFIG} --libs $PKG)\" |
9566 |
+diff --git a/scripts/kconfig/mconf-cfg.sh b/scripts/kconfig/mconf-cfg.sh |
9567 |
+index b520e407a8ebb..025b565e0b7cd 100755 |
9568 |
+--- a/scripts/kconfig/mconf-cfg.sh |
9569 |
++++ b/scripts/kconfig/mconf-cfg.sh |
9570 |
+@@ -4,16 +4,16 @@ |
9571 |
+ PKG="ncursesw" |
9572 |
+ PKG2="ncurses" |
9573 |
+ |
9574 |
+-if [ -n "$(command -v pkg-config)" ]; then |
9575 |
+- if pkg-config --exists $PKG; then |
9576 |
+- echo cflags=\"$(pkg-config --cflags $PKG)\" |
9577 |
+- echo libs=\"$(pkg-config --libs $PKG)\" |
9578 |
++if [ -n "$(command -v ${HOSTPKG_CONFIG})" ]; then |
9579 |
++ if ${HOSTPKG_CONFIG} --exists $PKG; then |
9580 |
++ echo cflags=\"$(${HOSTPKG_CONFIG} --cflags $PKG)\" |
9581 |
++ echo libs=\"$(${HOSTPKG_CONFIG} --libs $PKG)\" |
9582 |
+ exit 0 |
9583 |
+ fi |
9584 |
+ |
9585 |
+- if pkg-config --exists $PKG2; then |
9586 |
+- echo cflags=\"$(pkg-config --cflags $PKG2)\" |
9587 |
+- echo libs=\"$(pkg-config --libs $PKG2)\" |
9588 |
++ if ${HOSTPKG_CONFIG} --exists $PKG2; then |
9589 |
++ echo cflags=\"$(${HOSTPKG_CONFIG} --cflags $PKG2)\" |
9590 |
++ echo libs=\"$(${HOSTPKG_CONFIG} --libs $PKG2)\" |
9591 |
+ exit 0 |
9592 |
+ fi |
9593 |
+ fi |
9594 |
+@@ -46,7 +46,7 @@ echo >&2 "* Unable to find the ncurses package." |
9595 |
+ echo >&2 "* Install ncurses (ncurses-devel or libncurses-dev" |
9596 |
+ echo >&2 "* depending on your distribution)." |
9597 |
+ echo >&2 "*" |
9598 |
+-echo >&2 "* You may also need to install pkg-config to find the" |
9599 |
++echo >&2 "* You may also need to install ${HOSTPKG_CONFIG} to find the" |
9600 |
+ echo >&2 "* ncurses installed in a non-default location." |
9601 |
+ echo >&2 "*" |
9602 |
+ exit 1 |
9603 |
+diff --git a/scripts/kconfig/nconf-cfg.sh b/scripts/kconfig/nconf-cfg.sh |
9604 |
+index c212255070c0c..3a10bac2adb3a 100755 |
9605 |
+--- a/scripts/kconfig/nconf-cfg.sh |
9606 |
++++ b/scripts/kconfig/nconf-cfg.sh |
9607 |
+@@ -4,16 +4,16 @@ |
9608 |
+ PKG="ncursesw menuw panelw" |
9609 |
+ PKG2="ncurses menu panel" |
9610 |
+ |
9611 |
+-if [ -n "$(command -v pkg-config)" ]; then |
9612 |
+- if pkg-config --exists $PKG; then |
9613 |
+- echo cflags=\"$(pkg-config --cflags $PKG)\" |
9614 |
+- echo libs=\"$(pkg-config --libs $PKG)\" |
9615 |
++if [ -n "$(command -v ${HOSTPKG_CONFIG})" ]; then |
9616 |
++ if ${HOSTPKG_CONFIG} --exists $PKG; then |
9617 |
++ echo cflags=\"$(${HOSTPKG_CONFIG} --cflags $PKG)\" |
9618 |
++ echo libs=\"$(${HOSTPKG_CONFIG} --libs $PKG)\" |
9619 |
+ exit 0 |
9620 |
+ fi |
9621 |
+ |
9622 |
+- if pkg-config --exists $PKG2; then |
9623 |
+- echo cflags=\"$(pkg-config --cflags $PKG2)\" |
9624 |
+- echo libs=\"$(pkg-config --libs $PKG2)\" |
9625 |
++ if ${HOSTPKG_CONFIG} --exists $PKG2; then |
9626 |
++ echo cflags=\"$(${HOSTPKG_CONFIG} --cflags $PKG2)\" |
9627 |
++ echo libs=\"$(${HOSTPKG_CONFIG} --libs $PKG2)\" |
9628 |
+ exit 0 |
9629 |
+ fi |
9630 |
+ fi |
9631 |
+@@ -44,7 +44,7 @@ echo >&2 "* Unable to find the ncurses package." |
9632 |
+ echo >&2 "* Install ncurses (ncurses-devel or libncurses-dev" |
9633 |
+ echo >&2 "* depending on your distribution)." |
9634 |
+ echo >&2 "*" |
9635 |
+-echo >&2 "* You may also need to install pkg-config to find the" |
9636 |
++echo >&2 "* You may also need to install ${HOSTPKG_CONFIG} to find the" |
9637 |
+ echo >&2 "* ncurses installed in a non-default location." |
9638 |
+ echo >&2 "*" |
9639 |
+ exit 1 |
9640 |
+diff --git a/scripts/kconfig/qconf-cfg.sh b/scripts/kconfig/qconf-cfg.sh |
9641 |
+index fa564cd795b7c..9b695e5cd9b37 100755 |
9642 |
+--- a/scripts/kconfig/qconf-cfg.sh |
9643 |
++++ b/scripts/kconfig/qconf-cfg.sh |
9644 |
+@@ -3,22 +3,22 @@ |
9645 |
+ |
9646 |
+ PKG="Qt5Core Qt5Gui Qt5Widgets" |
9647 |
+ |
9648 |
+-if [ -z "$(command -v pkg-config)" ]; then |
9649 |
++if [ -z "$(command -v ${HOSTPKG_CONFIG})" ]; then |
9650 |
+ echo >&2 "*" |
9651 |
+- echo >&2 "* 'make xconfig' requires 'pkg-config'. Please install it." |
9652 |
++ echo >&2 "* 'make xconfig' requires '${HOSTPKG_CONFIG}'. Please install it." |
9653 |
+ echo >&2 "*" |
9654 |
+ exit 1 |
9655 |
+ fi |
9656 |
+ |
9657 |
+-if pkg-config --exists $PKG; then |
9658 |
+- echo cflags=\"-std=c++11 -fPIC $(pkg-config --cflags $PKG)\" |
9659 |
+- echo libs=\"$(pkg-config --libs $PKG)\" |
9660 |
+- echo moc=\"$(pkg-config --variable=host_bins Qt5Core)/moc\" |
9661 |
++if ${HOSTPKG_CONFIG} --exists $PKG; then |
9662 |
++ echo cflags=\"-std=c++11 -fPIC $(${HOSTPKG_CONFIG} --cflags $PKG)\" |
9663 |
++ echo libs=\"$(${HOSTPKG_CONFIG} --libs $PKG)\" |
9664 |
++ echo moc=\"$(${HOSTPKG_CONFIG} --variable=host_bins Qt5Core)/moc\" |
9665 |
+ exit 0 |
9666 |
+ fi |
9667 |
+ |
9668 |
+ echo >&2 "*" |
9669 |
+-echo >&2 "* Could not find Qt5 via pkg-config." |
9670 |
++echo >&2 "* Could not find Qt5 via ${HOSTPKG_CONFIG}." |
9671 |
+ echo >&2 "* Please install Qt5 and make sure it's in PKG_CONFIG_PATH" |
9672 |
+ echo >&2 "*" |
9673 |
+ exit 1 |
9674 |
+diff --git a/scripts/tracing/ftrace-bisect.sh b/scripts/tracing/ftrace-bisect.sh |
9675 |
+index 926701162bc83..bb4f59262bbe9 100755 |
9676 |
+--- a/scripts/tracing/ftrace-bisect.sh |
9677 |
++++ b/scripts/tracing/ftrace-bisect.sh |
9678 |
+@@ -12,7 +12,7 @@ |
9679 |
+ # (note, if this is a problem with function_graph tracing, then simply |
9680 |
+ # replace "function" with "function_graph" in the following steps). |
9681 |
+ # |
9682 |
+-# # cd /sys/kernel/debug/tracing |
9683 |
++# # cd /sys/kernel/tracing |
9684 |
+ # # echo schedule > set_ftrace_filter |
9685 |
+ # # echo function > current_tracer |
9686 |
+ # |
9687 |
+@@ -20,22 +20,40 @@ |
9688 |
+ # |
9689 |
+ # # echo nop > current_tracer |
9690 |
+ # |
9691 |
+-# # cat available_filter_functions > ~/full-file |
9692 |
++# Starting with v5.1 this can be done with numbers, making it much faster: |
9693 |
++# |
9694 |
++# The old (slow) way, for kernels before v5.1. |
9695 |
++# |
9696 |
++# [old-way] # cat available_filter_functions > ~/full-file |
9697 |
++# |
9698 |
++# [old-way] *** Note *** this process will take several minutes to update the |
9699 |
++# [old-way] filters. Setting multiple functions is an O(n^2) operation, and we |
9700 |
++# [old-way] are dealing with thousands of functions. So go have coffee, talk |
9701 |
++# [old-way] with your coworkers, read facebook. And eventually, this operation |
9702 |
++# [old-way] will end. |
9703 |
++# |
9704 |
++# The new way (using numbers) is an O(n) operation, and usually takes less than a second. |
9705 |
++# |
9706 |
++# seq `wc -l available_filter_functions | cut -d' ' -f1` > ~/full-file |
9707 |
++# |
9708 |
++# This will create a sequence of numbers that match the functions in |
9709 |
++# available_filter_functions, and when echoing in a number into the |
9710 |
++# set_ftrace_filter file, it will enable the corresponding function in |
9711 |
++# O(1) time. Making enabling all functions O(n) where n is the number of |
9712 |
++# functions to enable. |
9713 |
++# |
9714 |
++# For either the new or old way, the rest of the operations remain the same. |
9715 |
++# |
9716 |
+ # # ftrace-bisect ~/full-file ~/test-file ~/non-test-file |
9717 |
+ # # cat ~/test-file > set_ftrace_filter |
9718 |
+ # |
9719 |
+-# *** Note *** this will take several minutes. Setting multiple functions is |
9720 |
+-# an O(n^2) operation, and we are dealing with thousands of functions. So go |
9721 |
+-# have coffee, talk with your coworkers, read facebook. And eventually, this |
9722 |
+-# operation will end. |
9723 |
+-# |
9724 |
+ # # echo function > current_tracer |
9725 |
+ # |
9726 |
+ # If it crashes, we know that ~/test-file has a bad function. |
9727 |
+ # |
9728 |
+ # Reboot back to test kernel. |
9729 |
+ # |
9730 |
+-# # cd /sys/kernel/debug/tracing |
9731 |
++# # cd /sys/kernel/tracing |
9732 |
+ # # mv ~/test-file ~/full-file |
9733 |
+ # |
9734 |
+ # If it didn't crash. |
9735 |
+diff --git a/security/tomoyo/Makefile b/security/tomoyo/Makefile |
9736 |
+index cca5a3012fee2..221eaadffb09c 100644 |
9737 |
+--- a/security/tomoyo/Makefile |
9738 |
++++ b/security/tomoyo/Makefile |
9739 |
+@@ -10,7 +10,7 @@ endef |
9740 |
+ quiet_cmd_policy = POLICY $@ |
9741 |
+ cmd_policy = ($(call do_policy,profile); $(call do_policy,exception_policy); $(call do_policy,domain_policy); $(call do_policy,manager); $(call do_policy,stat)) >$@ |
9742 |
+ |
9743 |
+-$(obj)/builtin-policy.h: $(wildcard $(obj)/policy/*.conf $(src)/policy/*.conf.default) FORCE |
9744 |
++$(obj)/builtin-policy.h: $(wildcard $(obj)/policy/*.conf $(srctree)/$(src)/policy/*.conf.default) FORCE |
9745 |
+ $(call if_changed,policy) |
9746 |
+ |
9747 |
+ $(obj)/common.o: $(obj)/builtin-policy.h |
9748 |
+diff --git a/sound/soc/fsl/fsl-asoc-card.c b/sound/soc/fsl/fsl-asoc-card.c |
9749 |
+index c72a156737e61..5000d779aade2 100644 |
9750 |
+--- a/sound/soc/fsl/fsl-asoc-card.c |
9751 |
++++ b/sound/soc/fsl/fsl-asoc-card.c |
9752 |
+@@ -120,11 +120,11 @@ static const struct snd_soc_dapm_route audio_map[] = { |
9753 |
+ |
9754 |
+ static const struct snd_soc_dapm_route audio_map_ac97[] = { |
9755 |
+ /* 1st half -- Normal DAPM routes */ |
9756 |
+- {"Playback", NULL, "AC97 Playback"}, |
9757 |
+- {"AC97 Capture", NULL, "Capture"}, |
9758 |
++ {"AC97 Playback", NULL, "CPU AC97 Playback"}, |
9759 |
++ {"CPU AC97 Capture", NULL, "AC97 Capture"}, |
9760 |
+ /* 2nd half -- ASRC DAPM routes */ |
9761 |
+- {"AC97 Playback", NULL, "ASRC-Playback"}, |
9762 |
+- {"ASRC-Capture", NULL, "AC97 Capture"}, |
9763 |
++ {"CPU AC97 Playback", NULL, "ASRC-Playback"}, |
9764 |
++ {"ASRC-Capture", NULL, "CPU AC97 Capture"}, |
9765 |
+ }; |
9766 |
+ |
9767 |
+ static const struct snd_soc_dapm_route audio_map_tx[] = { |
9768 |
+diff --git a/sound/soc/fsl/fsl_micfil.c b/sound/soc/fsl/fsl_micfil.c |
9769 |
+index d1cd104f85847..38d4d1b7cfe39 100644 |
9770 |
+--- a/sound/soc/fsl/fsl_micfil.c |
9771 |
++++ b/sound/soc/fsl/fsl_micfil.c |
9772 |
+@@ -88,21 +88,21 @@ static DECLARE_TLV_DB_SCALE(gain_tlv, 0, 100, 0); |
9773 |
+ |
9774 |
+ static const struct snd_kcontrol_new fsl_micfil_snd_controls[] = { |
9775 |
+ SOC_SINGLE_SX_TLV("CH0 Volume", REG_MICFIL_OUT_CTRL, |
9776 |
+- MICFIL_OUTGAIN_CHX_SHIFT(0), 0xF, 0x7, gain_tlv), |
9777 |
++ MICFIL_OUTGAIN_CHX_SHIFT(0), 0x8, 0xF, gain_tlv), |
9778 |
+ SOC_SINGLE_SX_TLV("CH1 Volume", REG_MICFIL_OUT_CTRL, |
9779 |
+- MICFIL_OUTGAIN_CHX_SHIFT(1), 0xF, 0x7, gain_tlv), |
9780 |
++ MICFIL_OUTGAIN_CHX_SHIFT(1), 0x8, 0xF, gain_tlv), |
9781 |
+ SOC_SINGLE_SX_TLV("CH2 Volume", REG_MICFIL_OUT_CTRL, |
9782 |
+- MICFIL_OUTGAIN_CHX_SHIFT(2), 0xF, 0x7, gain_tlv), |
9783 |
++ MICFIL_OUTGAIN_CHX_SHIFT(2), 0x8, 0xF, gain_tlv), |
9784 |
+ SOC_SINGLE_SX_TLV("CH3 Volume", REG_MICFIL_OUT_CTRL, |
9785 |
+- MICFIL_OUTGAIN_CHX_SHIFT(3), 0xF, 0x7, gain_tlv), |
9786 |
++ MICFIL_OUTGAIN_CHX_SHIFT(3), 0x8, 0xF, gain_tlv), |
9787 |
+ SOC_SINGLE_SX_TLV("CH4 Volume", REG_MICFIL_OUT_CTRL, |
9788 |
+- MICFIL_OUTGAIN_CHX_SHIFT(4), 0xF, 0x7, gain_tlv), |
9789 |
++ MICFIL_OUTGAIN_CHX_SHIFT(4), 0x8, 0xF, gain_tlv), |
9790 |
+ SOC_SINGLE_SX_TLV("CH5 Volume", REG_MICFIL_OUT_CTRL, |
9791 |
+- MICFIL_OUTGAIN_CHX_SHIFT(5), 0xF, 0x7, gain_tlv), |
9792 |
++ MICFIL_OUTGAIN_CHX_SHIFT(5), 0x8, 0xF, gain_tlv), |
9793 |
+ SOC_SINGLE_SX_TLV("CH6 Volume", REG_MICFIL_OUT_CTRL, |
9794 |
+- MICFIL_OUTGAIN_CHX_SHIFT(6), 0xF, 0x7, gain_tlv), |
9795 |
++ MICFIL_OUTGAIN_CHX_SHIFT(6), 0x8, 0xF, gain_tlv), |
9796 |
+ SOC_SINGLE_SX_TLV("CH7 Volume", REG_MICFIL_OUT_CTRL, |
9797 |
+- MICFIL_OUTGAIN_CHX_SHIFT(7), 0xF, 0x7, gain_tlv), |
9798 |
++ MICFIL_OUTGAIN_CHX_SHIFT(7), 0x8, 0xF, gain_tlv), |
9799 |
+ SOC_ENUM_EXT("MICFIL Quality Select", |
9800 |
+ fsl_micfil_quality_enum, |
9801 |
+ snd_soc_get_enum_double, snd_soc_put_enum_double), |
9802 |
+diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c |
9803 |
+index ecbc1c365d5b1..0c73c2e9dce0c 100644 |
9804 |
+--- a/sound/soc/fsl/fsl_ssi.c |
9805 |
++++ b/sound/soc/fsl/fsl_ssi.c |
9806 |
+@@ -1160,14 +1160,14 @@ static struct snd_soc_dai_driver fsl_ssi_ac97_dai = { |
9807 |
+ .symmetric_channels = 1, |
9808 |
+ .probe = fsl_ssi_dai_probe, |
9809 |
+ .playback = { |
9810 |
+- .stream_name = "AC97 Playback", |
9811 |
++ .stream_name = "CPU AC97 Playback", |
9812 |
+ .channels_min = 2, |
9813 |
+ .channels_max = 2, |
9814 |
+ .rates = SNDRV_PCM_RATE_8000_48000, |
9815 |
+ .formats = SNDRV_PCM_FMTBIT_S16 | SNDRV_PCM_FMTBIT_S20, |
9816 |
+ }, |
9817 |
+ .capture = { |
9818 |
+- .stream_name = "AC97 Capture", |
9819 |
++ .stream_name = "CPU AC97 Capture", |
9820 |
+ .channels_min = 2, |
9821 |
+ .channels_max = 2, |
9822 |
+ .rates = SNDRV_PCM_RATE_48000, |
9823 |
+diff --git a/tools/gpio/gpio-event-mon.c b/tools/gpio/gpio-event-mon.c |
9824 |
+index a2b233fdb572e..6670199909822 100644 |
9825 |
+--- a/tools/gpio/gpio-event-mon.c |
9826 |
++++ b/tools/gpio/gpio-event-mon.c |
9827 |
+@@ -86,6 +86,7 @@ int monitor_device(const char *device_name, |
9828 |
+ gpiotools_test_bit(values.bits, i)); |
9829 |
+ } |
9830 |
+ |
9831 |
++ i = 0; |
9832 |
+ while (1) { |
9833 |
+ struct gpio_v2_line_event event; |
9834 |
+ |
9835 |
+diff --git a/tools/objtool/Makefile b/tools/objtool/Makefile |
9836 |
+index 92ce4fce7bc73..549acc5859e9e 100644 |
9837 |
+--- a/tools/objtool/Makefile |
9838 |
++++ b/tools/objtool/Makefile |
9839 |
+@@ -19,8 +19,8 @@ LIBSUBCMD = $(LIBSUBCMD_OUTPUT)libsubcmd.a |
9840 |
+ OBJTOOL := $(OUTPUT)objtool |
9841 |
+ OBJTOOL_IN := $(OBJTOOL)-in.o |
9842 |
+ |
9843 |
+-LIBELF_FLAGS := $(shell pkg-config libelf --cflags 2>/dev/null) |
9844 |
+-LIBELF_LIBS := $(shell pkg-config libelf --libs 2>/dev/null || echo -lelf) |
9845 |
++LIBELF_FLAGS := $(shell $(HOSTPKG_CONFIG) libelf --cflags 2>/dev/null) |
9846 |
++LIBELF_LIBS := $(shell $(HOSTPKG_CONFIG) libelf --libs 2>/dev/null || echo -lelf) |
9847 |
+ |
9848 |
+ all: $(OBJTOOL) |
9849 |
+ |
9850 |
+diff --git a/tools/objtool/check.c b/tools/objtool/check.c |
9851 |
+index 308c8806ad94e..758c0ba8de350 100644 |
9852 |
+--- a/tools/objtool/check.c |
9853 |
++++ b/tools/objtool/check.c |
9854 |
+@@ -169,6 +169,7 @@ static bool __dead_end_function(struct objtool_file *file, struct symbol *func, |
9855 |
+ "panic", |
9856 |
+ "do_exit", |
9857 |
+ "do_task_dead", |
9858 |
++ "make_task_dead", |
9859 |
+ "__module_put_and_exit", |
9860 |
+ "complete_and_exit", |
9861 |
+ "__reiserfs_panic", |
9862 |
+@@ -176,7 +177,7 @@ static bool __dead_end_function(struct objtool_file *file, struct symbol *func, |
9863 |
+ "fortify_panic", |
9864 |
+ "usercopy_abort", |
9865 |
+ "machine_real_restart", |
9866 |
+- "rewind_stack_do_exit", |
9867 |
++ "rewind_stack_and_make_dead", |
9868 |
+ "kunit_try_catch_throw", |
9869 |
+ "xen_start_kernel", |
9870 |
+ "cpu_bringup_and_idle", |
9871 |
+diff --git a/tools/testing/selftests/bpf/prog_tests/jeq_infer_not_null.c b/tools/testing/selftests/bpf/prog_tests/jeq_infer_not_null.c |
9872 |
+deleted file mode 100644 |
9873 |
+index 3add34df57678..0000000000000 |
9874 |
+--- a/tools/testing/selftests/bpf/prog_tests/jeq_infer_not_null.c |
9875 |
++++ /dev/null |
9876 |
+@@ -1,9 +0,0 @@ |
9877 |
+-// SPDX-License-Identifier: GPL-2.0 |
9878 |
+- |
9879 |
+-#include <test_progs.h> |
9880 |
+-#include "jeq_infer_not_null_fail.skel.h" |
9881 |
+- |
9882 |
+-void test_jeq_infer_not_null(void) |
9883 |
+-{ |
9884 |
+- RUN_TESTS(jeq_infer_not_null_fail); |
9885 |
+-} |
9886 |
+diff --git a/tools/testing/selftests/bpf/progs/jeq_infer_not_null_fail.c b/tools/testing/selftests/bpf/progs/jeq_infer_not_null_fail.c |
9887 |
+deleted file mode 100644 |
9888 |
+index f46965053acb2..0000000000000 |
9889 |
+--- a/tools/testing/selftests/bpf/progs/jeq_infer_not_null_fail.c |
9890 |
++++ /dev/null |
9891 |
+@@ -1,42 +0,0 @@ |
9892 |
+-// SPDX-License-Identifier: GPL-2.0 |
9893 |
+- |
9894 |
+-#include "vmlinux.h" |
9895 |
+-#include <bpf/bpf_helpers.h> |
9896 |
+-#include "bpf_misc.h" |
9897 |
+- |
9898 |
+-char _license[] SEC("license") = "GPL"; |
9899 |
+- |
9900 |
+-struct { |
9901 |
+- __uint(type, BPF_MAP_TYPE_HASH); |
9902 |
+- __uint(max_entries, 1); |
9903 |
+- __type(key, u64); |
9904 |
+- __type(value, u64); |
9905 |
+-} m_hash SEC(".maps"); |
9906 |
+- |
9907 |
+-SEC("?raw_tp") |
9908 |
+-__failure __msg("R8 invalid mem access 'map_value_or_null") |
9909 |
+-int jeq_infer_not_null_ptr_to_btfid(void *ctx) |
9910 |
+-{ |
9911 |
+- struct bpf_map *map = (struct bpf_map *)&m_hash; |
9912 |
+- struct bpf_map *inner_map = map->inner_map_meta; |
9913 |
+- u64 key = 0, ret = 0, *val; |
9914 |
+- |
9915 |
+- val = bpf_map_lookup_elem(map, &key); |
9916 |
+- /* Do not mark ptr as non-null if one of them is |
9917 |
+- * PTR_TO_BTF_ID (R9), reject because of invalid |
9918 |
+- * access to map value (R8). |
9919 |
+- * |
9920 |
+- * Here, we need to inline those insns to access |
9921 |
+- * R8 directly, since compiler may use other reg |
9922 |
+- * once it figures out val==inner_map. |
9923 |
+- */ |
9924 |
+- asm volatile("r8 = %[val];\n" |
9925 |
+- "r9 = %[inner_map];\n" |
9926 |
+- "if r8 != r9 goto +1;\n" |
9927 |
+- "%[ret] = *(u64 *)(r8 +0);\n" |
9928 |
+- : [ret] "+r"(ret) |
9929 |
+- : [inner_map] "r"(inner_map), [val] "r"(val) |
9930 |
+- : "r8", "r9"); |
9931 |
+- |
9932 |
+- return ret; |
9933 |
+-} |
9934 |
+diff --git a/tools/testing/selftests/net/toeplitz.c b/tools/testing/selftests/net/toeplitz.c |
9935 |
+index c5489341cfb80..8ce96028341d5 100644 |
9936 |
+--- a/tools/testing/selftests/net/toeplitz.c |
9937 |
++++ b/tools/testing/selftests/net/toeplitz.c |
9938 |
+@@ -213,7 +213,7 @@ static char *recv_frame(const struct ring_state *ring, char *frame) |
9939 |
+ } |
9940 |
+ |
9941 |
+ /* A single TPACKET_V3 block can hold multiple frames */ |
9942 |
+-static void recv_block(struct ring_state *ring) |
9943 |
++static bool recv_block(struct ring_state *ring) |
9944 |
+ { |
9945 |
+ struct tpacket_block_desc *block; |
9946 |
+ char *frame; |
9947 |
+@@ -221,7 +221,7 @@ static void recv_block(struct ring_state *ring) |
9948 |
+ |
9949 |
+ block = (void *)(ring->mmap + ring->idx * ring_block_sz); |
9950 |
+ if (!(block->hdr.bh1.block_status & TP_STATUS_USER)) |
9951 |
+- return; |
9952 |
++ return false; |
9953 |
+ |
9954 |
+ frame = (char *)block; |
9955 |
+ frame += block->hdr.bh1.offset_to_first_pkt; |
9956 |
+@@ -233,6 +233,8 @@ static void recv_block(struct ring_state *ring) |
9957 |
+ |
9958 |
+ block->hdr.bh1.block_status = TP_STATUS_KERNEL; |
9959 |
+ ring->idx = (ring->idx + 1) % ring_block_nr; |
9960 |
++ |
9961 |
++ return true; |
9962 |
+ } |
9963 |
+ |
9964 |
+ /* simple test: sleep once unconditionally and then process all rings */ |
9965 |
+@@ -243,7 +245,7 @@ static void process_rings(void) |
9966 |
+ usleep(1000 * cfg_timeout_msec); |
9967 |
+ |
9968 |
+ for (i = 0; i < num_cpus; i++) |
9969 |
+- recv_block(&rings[i]); |
9970 |
++ do {} while (recv_block(&rings[i])); |
9971 |
+ |
9972 |
+ fprintf(stderr, "count: pass=%u nohash=%u fail=%u\n", |
9973 |
+ frames_received - frames_nohash - frames_error, |
9974 |
+@@ -255,12 +257,12 @@ static char *setup_ring(int fd) |
9975 |
+ struct tpacket_req3 req3 = {0}; |
9976 |
+ void *ring; |
9977 |
+ |
9978 |
+- req3.tp_retire_blk_tov = cfg_timeout_msec; |
9979 |
++ req3.tp_retire_blk_tov = cfg_timeout_msec / 8; |
9980 |
+ req3.tp_feature_req_word = TP_FT_REQ_FILL_RXHASH; |
9981 |
+ |
9982 |
+ req3.tp_frame_size = 2048; |
9983 |
+ req3.tp_frame_nr = 1 << 10; |
9984 |
+- req3.tp_block_nr = 2; |
9985 |
++ req3.tp_block_nr = 16; |
9986 |
+ |
9987 |
+ req3.tp_block_size = req3.tp_frame_size * req3.tp_frame_nr; |
9988 |
+ req3.tp_block_size /= req3.tp_block_nr; |