1 |
commit: b18dd2e6aa98a9e8d8484a4cb5a7d6efc041be5d |
2 |
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed May 26 12:07:17 2021 +0000 |
4 |
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed May 26 12:07:17 2021 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=b18dd2e6 |
7 |
|
8 |
Linux patch 5.10.40 |
9 |
|
10 |
Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org> |
11 |
|
12 |
0000_README | 4 + |
13 |
1039_linux-5.10.40.patch | 3700 ++++++++++++++++++++++++++++++++++++++++++++++ |
14 |
2 files changed, 3704 insertions(+) |
15 |
|
16 |
diff --git a/0000_README b/0000_README |
17 |
index 824db67..27b8de0 100644 |
18 |
--- a/0000_README |
19 |
+++ b/0000_README |
20 |
@@ -199,6 +199,10 @@ Patch: 1038_linux-5.10.39.patch |
21 |
From: http://www.kernel.org |
22 |
Desc: Linux 5.10.39 |
23 |
|
24 |
+Patch: 1039_linux-5.10.40.patch |
25 |
+From: http://www.kernel.org |
26 |
+Desc: Linux 5.10.40 |
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/1039_linux-5.10.40.patch b/1039_linux-5.10.40.patch |
33 |
new file mode 100644 |
34 |
index 0000000..05aa3e0 |
35 |
--- /dev/null |
36 |
+++ b/1039_linux-5.10.40.patch |
37 |
@@ -0,0 +1,3700 @@ |
38 |
+diff --git a/Documentation/powerpc/syscall64-abi.rst b/Documentation/powerpc/syscall64-abi.rst |
39 |
+index cf9b2857c72aa..d8242049bdcb5 100644 |
40 |
+--- a/Documentation/powerpc/syscall64-abi.rst |
41 |
++++ b/Documentation/powerpc/syscall64-abi.rst |
42 |
+@@ -96,6 +96,16 @@ auxiliary vector. |
43 |
+ |
44 |
+ scv 0 syscalls will always behave as PPC_FEATURE2_HTM_NOSC. |
45 |
+ |
46 |
++ptrace |
47 |
++------ |
48 |
++When ptracing system calls (PTRACE_SYSCALL), the pt_regs.trap value contains |
49 |
++the system call type that can be used to distinguish between sc and scv 0 |
50 |
++system calls, and the different register conventions can be accounted for. |
51 |
++ |
52 |
++If the value of (pt_regs.trap & 0xfff0) is 0xc00 then the system call was |
53 |
++performed with the sc instruction, if it is 0x3000 then the system call was |
54 |
++performed with the scv 0 instruction. |
55 |
++ |
56 |
+ vsyscall |
57 |
+ ======== |
58 |
+ |
59 |
+diff --git a/Makefile b/Makefile |
60 |
+index 38b703568da45..42c915ccc5b80 100644 |
61 |
+--- a/Makefile |
62 |
++++ b/Makefile |
63 |
+@@ -1,7 +1,7 @@ |
64 |
+ # SPDX-License-Identifier: GPL-2.0 |
65 |
+ VERSION = 5 |
66 |
+ PATCHLEVEL = 10 |
67 |
+-SUBLEVEL = 39 |
68 |
++SUBLEVEL = 40 |
69 |
+ EXTRAVERSION = |
70 |
+ NAME = Dare mighty things |
71 |
+ |
72 |
+diff --git a/arch/openrisc/kernel/setup.c b/arch/openrisc/kernel/setup.c |
73 |
+index 2416a9f915330..c6f9e7b9f7cb2 100644 |
74 |
+--- a/arch/openrisc/kernel/setup.c |
75 |
++++ b/arch/openrisc/kernel/setup.c |
76 |
+@@ -278,6 +278,8 @@ void calibrate_delay(void) |
77 |
+ pr_cont("%lu.%02lu BogoMIPS (lpj=%lu)\n", |
78 |
+ loops_per_jiffy / (500000 / HZ), |
79 |
+ (loops_per_jiffy / (5000 / HZ)) % 100, loops_per_jiffy); |
80 |
++ |
81 |
++ of_node_put(cpu); |
82 |
+ } |
83 |
+ |
84 |
+ void __init setup_arch(char **cmdline_p) |
85 |
+diff --git a/arch/openrisc/mm/init.c b/arch/openrisc/mm/init.c |
86 |
+index 8348feaaf46e5..5e88c351e6a45 100644 |
87 |
+--- a/arch/openrisc/mm/init.c |
88 |
++++ b/arch/openrisc/mm/init.c |
89 |
+@@ -76,7 +76,6 @@ static void __init map_ram(void) |
90 |
+ /* These mark extents of read-only kernel pages... |
91 |
+ * ...from vmlinux.lds.S |
92 |
+ */ |
93 |
+- struct memblock_region *region; |
94 |
+ |
95 |
+ v = PAGE_OFFSET; |
96 |
+ |
97 |
+@@ -122,7 +121,7 @@ static void __init map_ram(void) |
98 |
+ } |
99 |
+ |
100 |
+ printk(KERN_INFO "%s: Memory: 0x%x-0x%x\n", __func__, |
101 |
+- region->base, region->base + region->size); |
102 |
++ start, end); |
103 |
+ } |
104 |
+ } |
105 |
+ |
106 |
+diff --git a/arch/powerpc/include/asm/hvcall.h b/arch/powerpc/include/asm/hvcall.h |
107 |
+index c1fbccb043903..3e8e19f5746c7 100644 |
108 |
+--- a/arch/powerpc/include/asm/hvcall.h |
109 |
++++ b/arch/powerpc/include/asm/hvcall.h |
110 |
+@@ -437,6 +437,9 @@ |
111 |
+ */ |
112 |
+ long plpar_hcall_norets(unsigned long opcode, ...); |
113 |
+ |
114 |
++/* Variant which does not do hcall tracing */ |
115 |
++long plpar_hcall_norets_notrace(unsigned long opcode, ...); |
116 |
++ |
117 |
+ /** |
118 |
+ * plpar_hcall: - Make a pseries hypervisor call |
119 |
+ * @opcode: The hypervisor call to make. |
120 |
+diff --git a/arch/powerpc/include/asm/paravirt.h b/arch/powerpc/include/asm/paravirt.h |
121 |
+index 9362c94fe3aa0..588bfb9a0579c 100644 |
122 |
+--- a/arch/powerpc/include/asm/paravirt.h |
123 |
++++ b/arch/powerpc/include/asm/paravirt.h |
124 |
+@@ -24,19 +24,35 @@ static inline u32 yield_count_of(int cpu) |
125 |
+ return be32_to_cpu(yield_count); |
126 |
+ } |
127 |
+ |
128 |
++/* |
129 |
++ * Spinlock code confers and prods, so don't trace the hcalls because the |
130 |
++ * tracing code takes spinlocks which can cause recursion deadlocks. |
131 |
++ * |
132 |
++ * These calls are made while the lock is not held: the lock slowpath yields if |
133 |
++ * it can not acquire the lock, and unlock slow path might prod if a waiter has |
134 |
++ * yielded). So this may not be a problem for simple spin locks because the |
135 |
++ * tracing does not technically recurse on the lock, but we avoid it anyway. |
136 |
++ * |
137 |
++ * However the queued spin lock contended path is more strictly ordered: the |
138 |
++ * H_CONFER hcall is made after the task has queued itself on the lock, so then |
139 |
++ * recursing on that lock will cause the task to then queue up again behind the |
140 |
++ * first instance (or worse: queued spinlocks use tricks that assume a context |
141 |
++ * never waits on more than one spinlock, so such recursion may cause random |
142 |
++ * corruption in the lock code). |
143 |
++ */ |
144 |
+ static inline void yield_to_preempted(int cpu, u32 yield_count) |
145 |
+ { |
146 |
+- plpar_hcall_norets(H_CONFER, get_hard_smp_processor_id(cpu), yield_count); |
147 |
++ plpar_hcall_norets_notrace(H_CONFER, get_hard_smp_processor_id(cpu), yield_count); |
148 |
+ } |
149 |
+ |
150 |
+ static inline void prod_cpu(int cpu) |
151 |
+ { |
152 |
+- plpar_hcall_norets(H_PROD, get_hard_smp_processor_id(cpu)); |
153 |
++ plpar_hcall_norets_notrace(H_PROD, get_hard_smp_processor_id(cpu)); |
154 |
+ } |
155 |
+ |
156 |
+ static inline void yield_to_any(void) |
157 |
+ { |
158 |
+- plpar_hcall_norets(H_CONFER, -1, 0); |
159 |
++ plpar_hcall_norets_notrace(H_CONFER, -1, 0); |
160 |
+ } |
161 |
+ #else |
162 |
+ static inline bool is_shared_processor(void) |
163 |
+diff --git a/arch/powerpc/include/asm/ptrace.h b/arch/powerpc/include/asm/ptrace.h |
164 |
+index d6f262df4f346..a7e7688f57eca 100644 |
165 |
+--- a/arch/powerpc/include/asm/ptrace.h |
166 |
++++ b/arch/powerpc/include/asm/ptrace.h |
167 |
+@@ -19,6 +19,7 @@ |
168 |
+ #ifndef _ASM_POWERPC_PTRACE_H |
169 |
+ #define _ASM_POWERPC_PTRACE_H |
170 |
+ |
171 |
++#include <linux/err.h> |
172 |
+ #include <uapi/asm/ptrace.h> |
173 |
+ #include <asm/asm-const.h> |
174 |
+ |
175 |
+@@ -144,25 +145,6 @@ extern unsigned long profile_pc(struct pt_regs *regs); |
176 |
+ long do_syscall_trace_enter(struct pt_regs *regs); |
177 |
+ void do_syscall_trace_leave(struct pt_regs *regs); |
178 |
+ |
179 |
+-#define kernel_stack_pointer(regs) ((regs)->gpr[1]) |
180 |
+-static inline int is_syscall_success(struct pt_regs *regs) |
181 |
+-{ |
182 |
+- return !(regs->ccr & 0x10000000); |
183 |
+-} |
184 |
+- |
185 |
+-static inline long regs_return_value(struct pt_regs *regs) |
186 |
+-{ |
187 |
+- if (is_syscall_success(regs)) |
188 |
+- return regs->gpr[3]; |
189 |
+- else |
190 |
+- return -regs->gpr[3]; |
191 |
+-} |
192 |
+- |
193 |
+-static inline void regs_set_return_value(struct pt_regs *regs, unsigned long rc) |
194 |
+-{ |
195 |
+- regs->gpr[3] = rc; |
196 |
+-} |
197 |
+- |
198 |
+ #ifdef __powerpc64__ |
199 |
+ #define user_mode(regs) ((((regs)->msr) >> MSR_PR_LG) & 0x1) |
200 |
+ #else |
201 |
+@@ -245,6 +227,31 @@ static inline void set_trap_norestart(struct pt_regs *regs) |
202 |
+ regs->trap |= 0x10; |
203 |
+ } |
204 |
+ |
205 |
++#define kernel_stack_pointer(regs) ((regs)->gpr[1]) |
206 |
++static inline int is_syscall_success(struct pt_regs *regs) |
207 |
++{ |
208 |
++ if (trap_is_scv(regs)) |
209 |
++ return !IS_ERR_VALUE((unsigned long)regs->gpr[3]); |
210 |
++ else |
211 |
++ return !(regs->ccr & 0x10000000); |
212 |
++} |
213 |
++ |
214 |
++static inline long regs_return_value(struct pt_regs *regs) |
215 |
++{ |
216 |
++ if (trap_is_scv(regs)) |
217 |
++ return regs->gpr[3]; |
218 |
++ |
219 |
++ if (is_syscall_success(regs)) |
220 |
++ return regs->gpr[3]; |
221 |
++ else |
222 |
++ return -regs->gpr[3]; |
223 |
++} |
224 |
++ |
225 |
++static inline void regs_set_return_value(struct pt_regs *regs, unsigned long rc) |
226 |
++{ |
227 |
++ regs->gpr[3] = rc; |
228 |
++} |
229 |
++ |
230 |
+ #define arch_has_single_step() (1) |
231 |
+ #define arch_has_block_step() (true) |
232 |
+ #define ARCH_HAS_USER_SINGLE_STEP_REPORT |
233 |
+diff --git a/arch/powerpc/include/asm/syscall.h b/arch/powerpc/include/asm/syscall.h |
234 |
+index fd1b518eed17c..ba0f88f3a30da 100644 |
235 |
+--- a/arch/powerpc/include/asm/syscall.h |
236 |
++++ b/arch/powerpc/include/asm/syscall.h |
237 |
+@@ -41,11 +41,17 @@ static inline void syscall_rollback(struct task_struct *task, |
238 |
+ static inline long syscall_get_error(struct task_struct *task, |
239 |
+ struct pt_regs *regs) |
240 |
+ { |
241 |
+- /* |
242 |
+- * If the system call failed, |
243 |
+- * regs->gpr[3] contains a positive ERRORCODE. |
244 |
+- */ |
245 |
+- return (regs->ccr & 0x10000000UL) ? -regs->gpr[3] : 0; |
246 |
++ if (trap_is_scv(regs)) { |
247 |
++ unsigned long error = regs->gpr[3]; |
248 |
++ |
249 |
++ return IS_ERR_VALUE(error) ? error : 0; |
250 |
++ } else { |
251 |
++ /* |
252 |
++ * If the system call failed, |
253 |
++ * regs->gpr[3] contains a positive ERRORCODE. |
254 |
++ */ |
255 |
++ return (regs->ccr & 0x10000000UL) ? -regs->gpr[3] : 0; |
256 |
++ } |
257 |
+ } |
258 |
+ |
259 |
+ static inline long syscall_get_return_value(struct task_struct *task, |
260 |
+@@ -58,18 +64,22 @@ static inline void syscall_set_return_value(struct task_struct *task, |
261 |
+ struct pt_regs *regs, |
262 |
+ int error, long val) |
263 |
+ { |
264 |
+- /* |
265 |
+- * In the general case it's not obvious that we must deal with CCR |
266 |
+- * here, as the syscall exit path will also do that for us. However |
267 |
+- * there are some places, eg. the signal code, which check ccr to |
268 |
+- * decide if the value in r3 is actually an error. |
269 |
+- */ |
270 |
+- if (error) { |
271 |
+- regs->ccr |= 0x10000000L; |
272 |
+- regs->gpr[3] = error; |
273 |
++ if (trap_is_scv(regs)) { |
274 |
++ regs->gpr[3] = (long) error ?: val; |
275 |
+ } else { |
276 |
+- regs->ccr &= ~0x10000000L; |
277 |
+- regs->gpr[3] = val; |
278 |
++ /* |
279 |
++ * In the general case it's not obvious that we must deal with |
280 |
++ * CCR here, as the syscall exit path will also do that for us. |
281 |
++ * However there are some places, eg. the signal code, which |
282 |
++ * check ccr to decide if the value in r3 is actually an error. |
283 |
++ */ |
284 |
++ if (error) { |
285 |
++ regs->ccr |= 0x10000000L; |
286 |
++ regs->gpr[3] = error; |
287 |
++ } else { |
288 |
++ regs->ccr &= ~0x10000000L; |
289 |
++ regs->gpr[3] = val; |
290 |
++ } |
291 |
+ } |
292 |
+ } |
293 |
+ |
294 |
+diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c |
295 |
+index 3b871ecb3a921..3f8426bccd168 100644 |
296 |
+--- a/arch/powerpc/kernel/setup_64.c |
297 |
++++ b/arch/powerpc/kernel/setup_64.c |
298 |
+@@ -368,11 +368,11 @@ void __init early_setup(unsigned long dt_ptr) |
299 |
+ apply_feature_fixups(); |
300 |
+ setup_feature_keys(); |
301 |
+ |
302 |
+- early_ioremap_setup(); |
303 |
+- |
304 |
+ /* Initialize the hash table or TLB handling */ |
305 |
+ early_init_mmu(); |
306 |
+ |
307 |
++ early_ioremap_setup(); |
308 |
++ |
309 |
+ /* |
310 |
+ * After firmware and early platform setup code has set things up, |
311 |
+ * we note the SPR values for configurable control/performance |
312 |
+diff --git a/arch/powerpc/platforms/pseries/hvCall.S b/arch/powerpc/platforms/pseries/hvCall.S |
313 |
+index 2136e42833af3..8a2b8d64265bc 100644 |
314 |
+--- a/arch/powerpc/platforms/pseries/hvCall.S |
315 |
++++ b/arch/powerpc/platforms/pseries/hvCall.S |
316 |
+@@ -102,6 +102,16 @@ END_FTR_SECTION(0, 1); \ |
317 |
+ #define HCALL_BRANCH(LABEL) |
318 |
+ #endif |
319 |
+ |
320 |
++_GLOBAL_TOC(plpar_hcall_norets_notrace) |
321 |
++ HMT_MEDIUM |
322 |
++ |
323 |
++ mfcr r0 |
324 |
++ stw r0,8(r1) |
325 |
++ HVSC /* invoke the hypervisor */ |
326 |
++ lwz r0,8(r1) |
327 |
++ mtcrf 0xff,r0 |
328 |
++ blr /* return r3 = status */ |
329 |
++ |
330 |
+ _GLOBAL_TOC(plpar_hcall_norets) |
331 |
+ HMT_MEDIUM |
332 |
+ |
333 |
+diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch/powerpc/platforms/pseries/lpar.c |
334 |
+index 764170fdb0f74..1c3ac0f663369 100644 |
335 |
+--- a/arch/powerpc/platforms/pseries/lpar.c |
336 |
++++ b/arch/powerpc/platforms/pseries/lpar.c |
337 |
+@@ -1827,8 +1827,7 @@ void hcall_tracepoint_unregfunc(void) |
338 |
+ |
339 |
+ /* |
340 |
+ * Since the tracing code might execute hcalls we need to guard against |
341 |
+- * recursion. One example of this are spinlocks calling H_YIELD on |
342 |
+- * shared processor partitions. |
343 |
++ * recursion. |
344 |
+ */ |
345 |
+ static DEFINE_PER_CPU(unsigned int, hcall_trace_depth); |
346 |
+ |
347 |
+diff --git a/arch/x86/boot/compressed/head_64.S b/arch/x86/boot/compressed/head_64.S |
348 |
+index 017de6cc87dc6..72f655c238cf1 100644 |
349 |
+--- a/arch/x86/boot/compressed/head_64.S |
350 |
++++ b/arch/x86/boot/compressed/head_64.S |
351 |
+@@ -172,11 +172,21 @@ SYM_FUNC_START(startup_32) |
352 |
+ */ |
353 |
+ call get_sev_encryption_bit |
354 |
+ xorl %edx, %edx |
355 |
++#ifdef CONFIG_AMD_MEM_ENCRYPT |
356 |
+ testl %eax, %eax |
357 |
+ jz 1f |
358 |
+ subl $32, %eax /* Encryption bit is always above bit 31 */ |
359 |
+ bts %eax, %edx /* Set encryption mask for page tables */ |
360 |
++ /* |
361 |
++ * Mark SEV as active in sev_status so that startup32_check_sev_cbit() |
362 |
++ * will do a check. The sev_status memory will be fully initialized |
363 |
++ * with the contents of MSR_AMD_SEV_STATUS later in |
364 |
++ * set_sev_encryption_mask(). For now it is sufficient to know that SEV |
365 |
++ * is active. |
366 |
++ */ |
367 |
++ movl $1, rva(sev_status)(%ebp) |
368 |
+ 1: |
369 |
++#endif |
370 |
+ |
371 |
+ /* Initialize Page tables to 0 */ |
372 |
+ leal rva(pgtable)(%ebx), %edi |
373 |
+@@ -261,6 +271,9 @@ SYM_FUNC_START(startup_32) |
374 |
+ movl %esi, %edx |
375 |
+ 1: |
376 |
+ #endif |
377 |
++ /* Check if the C-bit position is correct when SEV is active */ |
378 |
++ call startup32_check_sev_cbit |
379 |
++ |
380 |
+ pushl $__KERNEL_CS |
381 |
+ pushl %eax |
382 |
+ |
383 |
+@@ -786,6 +799,78 @@ SYM_DATA_START_LOCAL(loaded_image_proto) |
384 |
+ SYM_DATA_END(loaded_image_proto) |
385 |
+ #endif |
386 |
+ |
387 |
++/* |
388 |
++ * Check for the correct C-bit position when the startup_32 boot-path is used. |
389 |
++ * |
390 |
++ * The check makes use of the fact that all memory is encrypted when paging is |
391 |
++ * disabled. The function creates 64 bits of random data using the RDRAND |
392 |
++ * instruction. RDRAND is mandatory for SEV guests, so always available. If the |
393 |
++ * hypervisor violates that the kernel will crash right here. |
394 |
++ * |
395 |
++ * The 64 bits of random data are stored to a memory location and at the same |
396 |
++ * time kept in the %eax and %ebx registers. Since encryption is always active |
397 |
++ * when paging is off the random data will be stored encrypted in main memory. |
398 |
++ * |
399 |
++ * Then paging is enabled. When the C-bit position is correct all memory is |
400 |
++ * still mapped encrypted and comparing the register values with memory will |
401 |
++ * succeed. An incorrect C-bit position will map all memory unencrypted, so that |
402 |
++ * the compare will use the encrypted random data and fail. |
403 |
++ */ |
404 |
++ __HEAD |
405 |
++ .code32 |
406 |
++SYM_FUNC_START(startup32_check_sev_cbit) |
407 |
++#ifdef CONFIG_AMD_MEM_ENCRYPT |
408 |
++ pushl %eax |
409 |
++ pushl %ebx |
410 |
++ pushl %ecx |
411 |
++ pushl %edx |
412 |
++ |
413 |
++ /* Check for non-zero sev_status */ |
414 |
++ movl rva(sev_status)(%ebp), %eax |
415 |
++ testl %eax, %eax |
416 |
++ jz 4f |
417 |
++ |
418 |
++ /* |
419 |
++ * Get two 32-bit random values - Don't bail out if RDRAND fails |
420 |
++ * because it is better to prevent forward progress if no random value |
421 |
++ * can be gathered. |
422 |
++ */ |
423 |
++1: rdrand %eax |
424 |
++ jnc 1b |
425 |
++2: rdrand %ebx |
426 |
++ jnc 2b |
427 |
++ |
428 |
++ /* Store to memory and keep it in the registers */ |
429 |
++ movl %eax, rva(sev_check_data)(%ebp) |
430 |
++ movl %ebx, rva(sev_check_data+4)(%ebp) |
431 |
++ |
432 |
++ /* Enable paging to see if encryption is active */ |
433 |
++ movl %cr0, %edx /* Backup %cr0 in %edx */ |
434 |
++ movl $(X86_CR0_PG | X86_CR0_PE), %ecx /* Enable Paging and Protected mode */ |
435 |
++ movl %ecx, %cr0 |
436 |
++ |
437 |
++ cmpl %eax, rva(sev_check_data)(%ebp) |
438 |
++ jne 3f |
439 |
++ cmpl %ebx, rva(sev_check_data+4)(%ebp) |
440 |
++ jne 3f |
441 |
++ |
442 |
++ movl %edx, %cr0 /* Restore previous %cr0 */ |
443 |
++ |
444 |
++ jmp 4f |
445 |
++ |
446 |
++3: /* Check failed - hlt the machine */ |
447 |
++ hlt |
448 |
++ jmp 3b |
449 |
++ |
450 |
++4: |
451 |
++ popl %edx |
452 |
++ popl %ecx |
453 |
++ popl %ebx |
454 |
++ popl %eax |
455 |
++#endif |
456 |
++ ret |
457 |
++SYM_FUNC_END(startup32_check_sev_cbit) |
458 |
++ |
459 |
+ /* |
460 |
+ * Stack and heap for uncompression |
461 |
+ */ |
462 |
+diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c |
463 |
+index 0b9975200ae35..ee659b5faf714 100644 |
464 |
+--- a/arch/x86/events/intel/core.c |
465 |
++++ b/arch/x86/events/intel/core.c |
466 |
+@@ -5563,7 +5563,7 @@ __init int intel_pmu_init(void) |
467 |
+ * Check all LBT MSR here. |
468 |
+ * Disable LBR access if any LBR MSRs can not be accessed. |
469 |
+ */ |
470 |
+- if (x86_pmu.lbr_nr && !check_msr(x86_pmu.lbr_tos, 0x3UL)) |
471 |
++ if (x86_pmu.lbr_tos && !check_msr(x86_pmu.lbr_tos, 0x3UL)) |
472 |
+ x86_pmu.lbr_nr = 0; |
473 |
+ for (i = 0; i < x86_pmu.lbr_nr; i++) { |
474 |
+ if (!(check_msr(x86_pmu.lbr_from + i, 0xffffUL) && |
475 |
+diff --git a/arch/x86/kernel/sev-es-shared.c b/arch/x86/kernel/sev-es-shared.c |
476 |
+index 387b716698187..ecb20b17b7df6 100644 |
477 |
+--- a/arch/x86/kernel/sev-es-shared.c |
478 |
++++ b/arch/x86/kernel/sev-es-shared.c |
479 |
+@@ -63,6 +63,7 @@ static bool sev_es_negotiate_protocol(void) |
480 |
+ |
481 |
+ static __always_inline void vc_ghcb_invalidate(struct ghcb *ghcb) |
482 |
+ { |
483 |
++ ghcb->save.sw_exit_code = 0; |
484 |
+ memset(ghcb->save.valid_bitmap, 0, sizeof(ghcb->save.valid_bitmap)); |
485 |
+ } |
486 |
+ |
487 |
+diff --git a/arch/x86/kernel/sev-es.c b/arch/x86/kernel/sev-es.c |
488 |
+index 04a780abb512d..e0cdab7cb632b 100644 |
489 |
+--- a/arch/x86/kernel/sev-es.c |
490 |
++++ b/arch/x86/kernel/sev-es.c |
491 |
+@@ -191,8 +191,18 @@ static __always_inline struct ghcb *sev_es_get_ghcb(struct ghcb_state *state) |
492 |
+ if (unlikely(data->ghcb_active)) { |
493 |
+ /* GHCB is already in use - save its contents */ |
494 |
+ |
495 |
+- if (unlikely(data->backup_ghcb_active)) |
496 |
+- return NULL; |
497 |
++ if (unlikely(data->backup_ghcb_active)) { |
498 |
++ /* |
499 |
++ * Backup-GHCB is also already in use. There is no way |
500 |
++ * to continue here so just kill the machine. To make |
501 |
++ * panic() work, mark GHCBs inactive so that messages |
502 |
++ * can be printed out. |
503 |
++ */ |
504 |
++ data->ghcb_active = false; |
505 |
++ data->backup_ghcb_active = false; |
506 |
++ |
507 |
++ panic("Unable to handle #VC exception! GHCB and Backup GHCB are already in use"); |
508 |
++ } |
509 |
+ |
510 |
+ /* Mark backup_ghcb active before writing to it */ |
511 |
+ data->backup_ghcb_active = true; |
512 |
+@@ -209,24 +219,6 @@ static __always_inline struct ghcb *sev_es_get_ghcb(struct ghcb_state *state) |
513 |
+ return ghcb; |
514 |
+ } |
515 |
+ |
516 |
+-static __always_inline void sev_es_put_ghcb(struct ghcb_state *state) |
517 |
+-{ |
518 |
+- struct sev_es_runtime_data *data; |
519 |
+- struct ghcb *ghcb; |
520 |
+- |
521 |
+- data = this_cpu_read(runtime_data); |
522 |
+- ghcb = &data->ghcb_page; |
523 |
+- |
524 |
+- if (state->ghcb) { |
525 |
+- /* Restore GHCB from Backup */ |
526 |
+- *ghcb = *state->ghcb; |
527 |
+- data->backup_ghcb_active = false; |
528 |
+- state->ghcb = NULL; |
529 |
+- } else { |
530 |
+- data->ghcb_active = false; |
531 |
+- } |
532 |
+-} |
533 |
+- |
534 |
+ /* Needed in vc_early_forward_exception */ |
535 |
+ void do_early_exception(struct pt_regs *regs, int trapnr); |
536 |
+ |
537 |
+@@ -296,31 +288,44 @@ static enum es_result vc_write_mem(struct es_em_ctxt *ctxt, |
538 |
+ u16 d2; |
539 |
+ u8 d1; |
540 |
+ |
541 |
+- /* If instruction ran in kernel mode and the I/O buffer is in kernel space */ |
542 |
+- if (!user_mode(ctxt->regs) && !access_ok(target, size)) { |
543 |
+- memcpy(dst, buf, size); |
544 |
+- return ES_OK; |
545 |
+- } |
546 |
+- |
547 |
++ /* |
548 |
++ * This function uses __put_user() independent of whether kernel or user |
549 |
++ * memory is accessed. This works fine because __put_user() does no |
550 |
++ * sanity checks of the pointer being accessed. All that it does is |
551 |
++ * to report when the access failed. |
552 |
++ * |
553 |
++ * Also, this function runs in atomic context, so __put_user() is not |
554 |
++ * allowed to sleep. The page-fault handler detects that it is running |
555 |
++ * in atomic context and will not try to take mmap_sem and handle the |
556 |
++ * fault, so additional pagefault_enable()/disable() calls are not |
557 |
++ * needed. |
558 |
++ * |
559 |
++ * The access can't be done via copy_to_user() here because |
560 |
++ * vc_write_mem() must not use string instructions to access unsafe |
561 |
++ * memory. The reason is that MOVS is emulated by the #VC handler by |
562 |
++ * splitting the move up into a read and a write and taking a nested #VC |
563 |
++ * exception on whatever of them is the MMIO access. Using string |
564 |
++ * instructions here would cause infinite nesting. |
565 |
++ */ |
566 |
+ switch (size) { |
567 |
+ case 1: |
568 |
+ memcpy(&d1, buf, 1); |
569 |
+- if (put_user(d1, target)) |
570 |
++ if (__put_user(d1, target)) |
571 |
+ goto fault; |
572 |
+ break; |
573 |
+ case 2: |
574 |
+ memcpy(&d2, buf, 2); |
575 |
+- if (put_user(d2, target)) |
576 |
++ if (__put_user(d2, target)) |
577 |
+ goto fault; |
578 |
+ break; |
579 |
+ case 4: |
580 |
+ memcpy(&d4, buf, 4); |
581 |
+- if (put_user(d4, target)) |
582 |
++ if (__put_user(d4, target)) |
583 |
+ goto fault; |
584 |
+ break; |
585 |
+ case 8: |
586 |
+ memcpy(&d8, buf, 8); |
587 |
+- if (put_user(d8, target)) |
588 |
++ if (__put_user(d8, target)) |
589 |
+ goto fault; |
590 |
+ break; |
591 |
+ default: |
592 |
+@@ -351,30 +356,43 @@ static enum es_result vc_read_mem(struct es_em_ctxt *ctxt, |
593 |
+ u16 d2; |
594 |
+ u8 d1; |
595 |
+ |
596 |
+- /* If instruction ran in kernel mode and the I/O buffer is in kernel space */ |
597 |
+- if (!user_mode(ctxt->regs) && !access_ok(s, size)) { |
598 |
+- memcpy(buf, src, size); |
599 |
+- return ES_OK; |
600 |
+- } |
601 |
+- |
602 |
++ /* |
603 |
++ * This function uses __get_user() independent of whether kernel or user |
604 |
++ * memory is accessed. This works fine because __get_user() does no |
605 |
++ * sanity checks of the pointer being accessed. All that it does is |
606 |
++ * to report when the access failed. |
607 |
++ * |
608 |
++ * Also, this function runs in atomic context, so __get_user() is not |
609 |
++ * allowed to sleep. The page-fault handler detects that it is running |
610 |
++ * in atomic context and will not try to take mmap_sem and handle the |
611 |
++ * fault, so additional pagefault_enable()/disable() calls are not |
612 |
++ * needed. |
613 |
++ * |
614 |
++ * The access can't be done via copy_from_user() here because |
615 |
++ * vc_read_mem() must not use string instructions to access unsafe |
616 |
++ * memory. The reason is that MOVS is emulated by the #VC handler by |
617 |
++ * splitting the move up into a read and a write and taking a nested #VC |
618 |
++ * exception on whatever of them is the MMIO access. Using string |
619 |
++ * instructions here would cause infinite nesting. |
620 |
++ */ |
621 |
+ switch (size) { |
622 |
+ case 1: |
623 |
+- if (get_user(d1, s)) |
624 |
++ if (__get_user(d1, s)) |
625 |
+ goto fault; |
626 |
+ memcpy(buf, &d1, 1); |
627 |
+ break; |
628 |
+ case 2: |
629 |
+- if (get_user(d2, s)) |
630 |
++ if (__get_user(d2, s)) |
631 |
+ goto fault; |
632 |
+ memcpy(buf, &d2, 2); |
633 |
+ break; |
634 |
+ case 4: |
635 |
+- if (get_user(d4, s)) |
636 |
++ if (__get_user(d4, s)) |
637 |
+ goto fault; |
638 |
+ memcpy(buf, &d4, 4); |
639 |
+ break; |
640 |
+ case 8: |
641 |
+- if (get_user(d8, s)) |
642 |
++ if (__get_user(d8, s)) |
643 |
+ goto fault; |
644 |
+ memcpy(buf, &d8, 8); |
645 |
+ break; |
646 |
+@@ -434,6 +452,29 @@ static enum es_result vc_slow_virt_to_phys(struct ghcb *ghcb, struct es_em_ctxt |
647 |
+ /* Include code shared with pre-decompression boot stage */ |
648 |
+ #include "sev-es-shared.c" |
649 |
+ |
650 |
++static __always_inline void sev_es_put_ghcb(struct ghcb_state *state) |
651 |
++{ |
652 |
++ struct sev_es_runtime_data *data; |
653 |
++ struct ghcb *ghcb; |
654 |
++ |
655 |
++ data = this_cpu_read(runtime_data); |
656 |
++ ghcb = &data->ghcb_page; |
657 |
++ |
658 |
++ if (state->ghcb) { |
659 |
++ /* Restore GHCB from Backup */ |
660 |
++ *ghcb = *state->ghcb; |
661 |
++ data->backup_ghcb_active = false; |
662 |
++ state->ghcb = NULL; |
663 |
++ } else { |
664 |
++ /* |
665 |
++ * Invalidate the GHCB so a VMGEXIT instruction issued |
666 |
++ * from userspace won't appear to be valid. |
667 |
++ */ |
668 |
++ vc_ghcb_invalidate(ghcb); |
669 |
++ data->ghcb_active = false; |
670 |
++ } |
671 |
++} |
672 |
++ |
673 |
+ void noinstr __sev_es_nmi_complete(void) |
674 |
+ { |
675 |
+ struct ghcb_state state; |
676 |
+@@ -1228,6 +1269,10 @@ static __always_inline void vc_forward_exception(struct es_em_ctxt *ctxt) |
677 |
+ case X86_TRAP_UD: |
678 |
+ exc_invalid_op(ctxt->regs); |
679 |
+ break; |
680 |
++ case X86_TRAP_PF: |
681 |
++ write_cr2(ctxt->fi.cr2); |
682 |
++ exc_page_fault(ctxt->regs, error_code); |
683 |
++ break; |
684 |
+ case X86_TRAP_AC: |
685 |
+ exc_alignment_check(ctxt->regs, error_code); |
686 |
+ break; |
687 |
+@@ -1257,7 +1302,6 @@ static __always_inline bool on_vc_fallback_stack(struct pt_regs *regs) |
688 |
+ */ |
689 |
+ DEFINE_IDTENTRY_VC_SAFE_STACK(exc_vmm_communication) |
690 |
+ { |
691 |
+- struct sev_es_runtime_data *data = this_cpu_read(runtime_data); |
692 |
+ irqentry_state_t irq_state; |
693 |
+ struct ghcb_state state; |
694 |
+ struct es_em_ctxt ctxt; |
695 |
+@@ -1283,16 +1327,6 @@ DEFINE_IDTENTRY_VC_SAFE_STACK(exc_vmm_communication) |
696 |
+ */ |
697 |
+ |
698 |
+ ghcb = sev_es_get_ghcb(&state); |
699 |
+- if (!ghcb) { |
700 |
+- /* |
701 |
+- * Mark GHCBs inactive so that panic() is able to print the |
702 |
+- * message. |
703 |
+- */ |
704 |
+- data->ghcb_active = false; |
705 |
+- data->backup_ghcb_active = false; |
706 |
+- |
707 |
+- panic("Unable to handle #VC exception! GHCB and Backup GHCB are already in use"); |
708 |
+- } |
709 |
+ |
710 |
+ vc_ghcb_invalidate(ghcb); |
711 |
+ result = vc_init_em_ctxt(&ctxt, regs, error_code); |
712 |
+diff --git a/arch/x86/xen/enlighten_pv.c b/arch/x86/xen/enlighten_pv.c |
713 |
+index 9a5a50cdaab59..8064df6382227 100644 |
714 |
+--- a/arch/x86/xen/enlighten_pv.c |
715 |
++++ b/arch/x86/xen/enlighten_pv.c |
716 |
+@@ -1262,16 +1262,16 @@ asmlinkage __visible void __init xen_start_kernel(void) |
717 |
+ /* Get mfn list */ |
718 |
+ xen_build_dynamic_phys_to_machine(); |
719 |
+ |
720 |
++ /* Work out if we support NX */ |
721 |
++ get_cpu_cap(&boot_cpu_data); |
722 |
++ x86_configure_nx(); |
723 |
++ |
724 |
+ /* |
725 |
+ * Set up kernel GDT and segment registers, mainly so that |
726 |
+ * -fstack-protector code can be executed. |
727 |
+ */ |
728 |
+ xen_setup_gdt(0); |
729 |
+ |
730 |
+- /* Work out if we support NX */ |
731 |
+- get_cpu_cap(&boot_cpu_data); |
732 |
+- x86_configure_nx(); |
733 |
+- |
734 |
+ /* Determine virtual and physical address sizes */ |
735 |
+ get_cpu_address_sizes(&boot_cpu_data); |
736 |
+ |
737 |
+diff --git a/drivers/cdrom/gdrom.c b/drivers/cdrom/gdrom.c |
738 |
+index 9874fc1c815b5..1831099306aa9 100644 |
739 |
+--- a/drivers/cdrom/gdrom.c |
740 |
++++ b/drivers/cdrom/gdrom.c |
741 |
+@@ -743,6 +743,13 @@ static const struct blk_mq_ops gdrom_mq_ops = { |
742 |
+ static int probe_gdrom(struct platform_device *devptr) |
743 |
+ { |
744 |
+ int err; |
745 |
++ |
746 |
++ /* |
747 |
++ * Ensure our "one" device is initialized properly in case of previous |
748 |
++ * usages of it |
749 |
++ */ |
750 |
++ memset(&gd, 0, sizeof(gd)); |
751 |
++ |
752 |
+ /* Start the device */ |
753 |
+ if (gdrom_execute_diagnostic() != 1) { |
754 |
+ pr_warn("ATA Probe for GDROM failed\n"); |
755 |
+@@ -831,6 +838,8 @@ static int remove_gdrom(struct platform_device *devptr) |
756 |
+ if (gdrom_major) |
757 |
+ unregister_blkdev(gdrom_major, GDROM_DEV_NAME); |
758 |
+ unregister_cdrom(gd.cd_info); |
759 |
++ kfree(gd.cd_info); |
760 |
++ kfree(gd.toc); |
761 |
+ |
762 |
+ return 0; |
763 |
+ } |
764 |
+@@ -846,7 +855,7 @@ static struct platform_driver gdrom_driver = { |
765 |
+ static int __init init_gdrom(void) |
766 |
+ { |
767 |
+ int rc; |
768 |
+- gd.toc = NULL; |
769 |
++ |
770 |
+ rc = platform_driver_register(&gdrom_driver); |
771 |
+ if (rc) |
772 |
+ return rc; |
773 |
+@@ -862,8 +871,6 @@ static void __exit exit_gdrom(void) |
774 |
+ { |
775 |
+ platform_device_unregister(pd); |
776 |
+ platform_driver_unregister(&gdrom_driver); |
777 |
+- kfree(gd.toc); |
778 |
+- kfree(gd.cd_info); |
779 |
+ } |
780 |
+ |
781 |
+ module_init(init_gdrom); |
782 |
+diff --git a/drivers/firmware/arm_scpi.c b/drivers/firmware/arm_scpi.c |
783 |
+index d0dee37ad5228..4ceba5ef78958 100644 |
784 |
+--- a/drivers/firmware/arm_scpi.c |
785 |
++++ b/drivers/firmware/arm_scpi.c |
786 |
+@@ -552,8 +552,10 @@ static unsigned long scpi_clk_get_val(u16 clk_id) |
787 |
+ |
788 |
+ ret = scpi_send_message(CMD_GET_CLOCK_VALUE, &le_clk_id, |
789 |
+ sizeof(le_clk_id), &rate, sizeof(rate)); |
790 |
++ if (ret) |
791 |
++ return 0; |
792 |
+ |
793 |
+- return ret ? ret : le32_to_cpu(rate); |
794 |
++ return le32_to_cpu(rate); |
795 |
+ } |
796 |
+ |
797 |
+ static int scpi_clk_set_val(u16 clk_id, unsigned long rate) |
798 |
+diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c |
799 |
+index ab7755a3885a6..532250c2b19ee 100644 |
800 |
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c |
801 |
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c |
802 |
+@@ -267,7 +267,7 @@ static int amdgpu_ttm_map_buffer(struct ttm_buffer_object *bo, |
803 |
+ *addr += offset & ~PAGE_MASK; |
804 |
+ |
805 |
+ num_dw = ALIGN(adev->mman.buffer_funcs->copy_num_dw, 8); |
806 |
+- num_bytes = num_pages * 8; |
807 |
++ num_bytes = num_pages * 8 * AMDGPU_GPU_PAGES_IN_CPU_PAGE; |
808 |
+ |
809 |
+ r = amdgpu_job_alloc_with_ib(adev, num_dw * 4 + num_bytes, |
810 |
+ AMDGPU_IB_POOL_DELAYED, &job); |
811 |
+diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c |
812 |
+index 4ebb43e090999..fc8da5fed779b 100644 |
813 |
+--- a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c |
814 |
++++ b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c |
815 |
+@@ -1334,9 +1334,10 @@ static const struct soc15_reg_golden golden_settings_gc_10_1_2[] = |
816 |
+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmDB_DEBUG, 0xffffffff, 0x20000000), |
817 |
+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmDB_DEBUG2, 0xffffffff, 0x00000420), |
818 |
+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmDB_DEBUG3, 0xffffffff, 0x00000200), |
819 |
+- SOC15_REG_GOLDEN_VALUE(GC, 0, mmDB_DEBUG4, 0xffffffff, 0x04800000), |
820 |
++ SOC15_REG_GOLDEN_VALUE(GC, 0, mmDB_DEBUG4, 0xffffffff, 0x04900000), |
821 |
+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmDB_DFSM_TILES_IN_FLIGHT, 0x0000ffff, 0x0000003f), |
822 |
+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmDB_LAST_OF_BURST_CONFIG, 0xffffffff, 0x03860204), |
823 |
++ SOC15_REG_GOLDEN_VALUE(GC, 0, mmGB_ADDR_CONFIG, 0x0c1800ff, 0x00000044), |
824 |
+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmGCR_GENERAL_CNTL, 0x1ff0ffff, 0x00000500), |
825 |
+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmGE_PRIV_CONTROL, 0x00007fff, 0x000001fe), |
826 |
+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmGL1_PIPE_STEER, 0xffffffff, 0xe4e4e4e4), |
827 |
+@@ -1354,12 +1355,13 @@ static const struct soc15_reg_golden golden_settings_gc_10_1_2[] = |
828 |
+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmPA_SC_ENHANCE_2, 0x00000820, 0x00000820), |
829 |
+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmPA_SC_LINE_STIPPLE_STATE, 0x0000ff0f, 0x00000000), |
830 |
+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmRMI_SPARE, 0xffffffff, 0xffff3101), |
831 |
++ SOC15_REG_GOLDEN_VALUE(GC, 0, mmSPI_CONFIG_CNTL_1, 0x001f0000, 0x00070104), |
832 |
+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmSQ_ALU_CLK_CTRL, 0xffffffff, 0xffffffff), |
833 |
+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmSQ_ARB_CONFIG, 0x00000133, 0x00000130), |
834 |
+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmSQ_LDS_CLK_CTRL, 0xffffffff, 0xffffffff), |
835 |
+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmTA_CNTL_AUX, 0xfff7ffff, 0x01030000), |
836 |
+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmTCP_CNTL, 0xffdf80ff, 0x479c0010), |
837 |
+- SOC15_REG_GOLDEN_VALUE(GC, 0, mmUTCL1_CTRL, 0xffffffff, 0x00800000) |
838 |
++ SOC15_REG_GOLDEN_VALUE(GC, 0, mmUTCL1_CTRL, 0xffffffff, 0x00c00000) |
839 |
+ }; |
840 |
+ |
841 |
+ static void gfx_v10_rlcg_wreg(struct amdgpu_device *adev, u32 offset, u32 v) |
842 |
+diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c |
843 |
+index 957c12b727676..fb15e8b5af32f 100644 |
844 |
+--- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c |
845 |
++++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c |
846 |
+@@ -4859,7 +4859,7 @@ static void gfx_v9_0_update_3d_clock_gating(struct amdgpu_device *adev, |
847 |
+ amdgpu_gfx_rlc_enter_safe_mode(adev); |
848 |
+ |
849 |
+ /* Enable 3D CGCG/CGLS */ |
850 |
+- if (enable && (adev->cg_flags & AMD_CG_SUPPORT_GFX_3D_CGCG)) { |
851 |
++ if (enable) { |
852 |
+ /* write cmd to clear cgcg/cgls ov */ |
853 |
+ def = data = RREG32_SOC15(GC, 0, mmRLC_CGTT_MGCG_OVERRIDE); |
854 |
+ /* unset CGCG override */ |
855 |
+@@ -4871,8 +4871,12 @@ static void gfx_v9_0_update_3d_clock_gating(struct amdgpu_device *adev, |
856 |
+ /* enable 3Dcgcg FSM(0x0000363f) */ |
857 |
+ def = RREG32_SOC15(GC, 0, mmRLC_CGCG_CGLS_CTRL_3D); |
858 |
+ |
859 |
+- data = (0x36 << RLC_CGCG_CGLS_CTRL_3D__CGCG_GFX_IDLE_THRESHOLD__SHIFT) | |
860 |
+- RLC_CGCG_CGLS_CTRL_3D__CGCG_EN_MASK; |
861 |
++ if (adev->cg_flags & AMD_CG_SUPPORT_GFX_3D_CGCG) |
862 |
++ data = (0x36 << RLC_CGCG_CGLS_CTRL_3D__CGCG_GFX_IDLE_THRESHOLD__SHIFT) | |
863 |
++ RLC_CGCG_CGLS_CTRL_3D__CGCG_EN_MASK; |
864 |
++ else |
865 |
++ data = 0x0 << RLC_CGCG_CGLS_CTRL_3D__CGCG_GFX_IDLE_THRESHOLD__SHIFT; |
866 |
++ |
867 |
+ if (adev->cg_flags & AMD_CG_SUPPORT_GFX_3D_CGLS) |
868 |
+ data |= (0x000F << RLC_CGCG_CGLS_CTRL_3D__CGLS_REP_COMPANSAT_DELAY__SHIFT) | |
869 |
+ RLC_CGCG_CGLS_CTRL_3D__CGLS_EN_MASK; |
870 |
+diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c b/drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c |
871 |
+index 9c72b95b74639..be23d637c3d77 100644 |
872 |
+--- a/drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c |
873 |
++++ b/drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c |
874 |
+@@ -124,6 +124,10 @@ static const struct soc15_reg_golden golden_settings_sdma_nv14[] = { |
875 |
+ |
876 |
+ static const struct soc15_reg_golden golden_settings_sdma_nv12[] = { |
877 |
+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmSDMA0_RLC3_RB_WPTR_POLL_CNTL, 0xfffffff7, 0x00403000), |
878 |
++ SOC15_REG_GOLDEN_VALUE(GC, 0, mmSDMA0_GB_ADDR_CONFIG, 0x001877ff, 0x00000044), |
879 |
++ SOC15_REG_GOLDEN_VALUE(GC, 0, mmSDMA0_GB_ADDR_CONFIG_READ, 0x001877ff, 0x00000044), |
880 |
++ SOC15_REG_GOLDEN_VALUE(GC, 0, mmSDMA1_GB_ADDR_CONFIG, 0x001877ff, 0x00000044), |
881 |
++ SOC15_REG_GOLDEN_VALUE(GC, 0, mmSDMA1_GB_ADDR_CONFIG_READ, 0x001877ff, 0x00000044), |
882 |
+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmSDMA1_RLC3_RB_WPTR_POLL_CNTL, 0xfffffff7, 0x00403000), |
883 |
+ }; |
884 |
+ |
885 |
+diff --git a/drivers/gpu/drm/amd/amdgpu/soc15.c b/drivers/gpu/drm/amd/amdgpu/soc15.c |
886 |
+index 7efc618887e21..37226cbbbd11a 100644 |
887 |
+--- a/drivers/gpu/drm/amd/amdgpu/soc15.c |
888 |
++++ b/drivers/gpu/drm/amd/amdgpu/soc15.c |
889 |
+@@ -1183,7 +1183,6 @@ static int soc15_common_early_init(void *handle) |
890 |
+ adev->cg_flags = AMD_CG_SUPPORT_GFX_MGCG | |
891 |
+ AMD_CG_SUPPORT_GFX_MGLS | |
892 |
+ AMD_CG_SUPPORT_GFX_CP_LS | |
893 |
+- AMD_CG_SUPPORT_GFX_3D_CGCG | |
894 |
+ AMD_CG_SUPPORT_GFX_3D_CGLS | |
895 |
+ AMD_CG_SUPPORT_GFX_CGCG | |
896 |
+ AMD_CG_SUPPORT_GFX_CGLS | |
897 |
+@@ -1203,7 +1202,6 @@ static int soc15_common_early_init(void *handle) |
898 |
+ AMD_CG_SUPPORT_GFX_MGLS | |
899 |
+ AMD_CG_SUPPORT_GFX_RLC_LS | |
900 |
+ AMD_CG_SUPPORT_GFX_CP_LS | |
901 |
+- AMD_CG_SUPPORT_GFX_3D_CGCG | |
902 |
+ AMD_CG_SUPPORT_GFX_3D_CGLS | |
903 |
+ AMD_CG_SUPPORT_GFX_CGCG | |
904 |
+ AMD_CG_SUPPORT_GFX_CGLS | |
905 |
+diff --git a/drivers/gpu/drm/i915/gt/gen7_renderclear.c b/drivers/gpu/drm/i915/gt/gen7_renderclear.c |
906 |
+index 4adbc2bba97fb..c724fba8a87b9 100644 |
907 |
+--- a/drivers/gpu/drm/i915/gt/gen7_renderclear.c |
908 |
++++ b/drivers/gpu/drm/i915/gt/gen7_renderclear.c |
909 |
+@@ -397,7 +397,10 @@ static void emit_batch(struct i915_vma * const vma, |
910 |
+ gen7_emit_pipeline_invalidate(&cmds); |
911 |
+ batch_add(&cmds, MI_LOAD_REGISTER_IMM(2)); |
912 |
+ batch_add(&cmds, i915_mmio_reg_offset(CACHE_MODE_0_GEN7)); |
913 |
+- batch_add(&cmds, 0xffff0000); |
914 |
++ batch_add(&cmds, 0xffff0000 | |
915 |
++ ((IS_IVB_GT1(i915) || IS_VALLEYVIEW(i915)) ? |
916 |
++ HIZ_RAW_STALL_OPT_DISABLE : |
917 |
++ 0)); |
918 |
+ batch_add(&cmds, i915_mmio_reg_offset(CACHE_MODE_1)); |
919 |
+ batch_add(&cmds, 0xffff0000 | PIXEL_SUBSPAN_COLLECT_OPT_DISABLE); |
920 |
+ gen7_emit_pipeline_invalidate(&cmds); |
921 |
+diff --git a/drivers/hwmon/lm80.c b/drivers/hwmon/lm80.c |
922 |
+index ac4adb44b224d..97ab491d2922c 100644 |
923 |
+--- a/drivers/hwmon/lm80.c |
924 |
++++ b/drivers/hwmon/lm80.c |
925 |
+@@ -596,7 +596,6 @@ static int lm80_probe(struct i2c_client *client) |
926 |
+ struct device *dev = &client->dev; |
927 |
+ struct device *hwmon_dev; |
928 |
+ struct lm80_data *data; |
929 |
+- int rv; |
930 |
+ |
931 |
+ data = devm_kzalloc(dev, sizeof(struct lm80_data), GFP_KERNEL); |
932 |
+ if (!data) |
933 |
+@@ -609,14 +608,8 @@ static int lm80_probe(struct i2c_client *client) |
934 |
+ lm80_init_client(client); |
935 |
+ |
936 |
+ /* A few vars need to be filled upon startup */ |
937 |
+- rv = lm80_read_value(client, LM80_REG_FAN_MIN(1)); |
938 |
+- if (rv < 0) |
939 |
+- return rv; |
940 |
+- data->fan[f_min][0] = rv; |
941 |
+- rv = lm80_read_value(client, LM80_REG_FAN_MIN(2)); |
942 |
+- if (rv < 0) |
943 |
+- return rv; |
944 |
+- data->fan[f_min][1] = rv; |
945 |
++ data->fan[f_min][0] = lm80_read_value(client, LM80_REG_FAN_MIN(1)); |
946 |
++ data->fan[f_min][1] = lm80_read_value(client, LM80_REG_FAN_MIN(2)); |
947 |
+ |
948 |
+ hwmon_dev = devm_hwmon_device_register_with_groups(dev, client->name, |
949 |
+ data, lm80_groups); |
950 |
+diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c |
951 |
+index 6af066a2c8c06..d1e94147fb165 100644 |
952 |
+--- a/drivers/infiniband/core/cma.c |
953 |
++++ b/drivers/infiniband/core/cma.c |
954 |
+@@ -482,6 +482,7 @@ static void cma_release_dev(struct rdma_id_private *id_priv) |
955 |
+ list_del(&id_priv->list); |
956 |
+ cma_dev_put(id_priv->cma_dev); |
957 |
+ id_priv->cma_dev = NULL; |
958 |
++ id_priv->id.device = NULL; |
959 |
+ if (id_priv->id.route.addr.dev_addr.sgid_attr) { |
960 |
+ rdma_put_gid_attr(id_priv->id.route.addr.dev_addr.sgid_attr); |
961 |
+ id_priv->id.route.addr.dev_addr.sgid_attr = NULL; |
962 |
+@@ -1864,6 +1865,7 @@ static void _destroy_id(struct rdma_id_private *id_priv, |
963 |
+ iw_destroy_cm_id(id_priv->cm_id.iw); |
964 |
+ } |
965 |
+ cma_leave_mc_groups(id_priv); |
966 |
++ rdma_restrack_del(&id_priv->res); |
967 |
+ cma_release_dev(id_priv); |
968 |
+ } |
969 |
+ |
970 |
+@@ -1877,7 +1879,6 @@ static void _destroy_id(struct rdma_id_private *id_priv, |
971 |
+ kfree(id_priv->id.route.path_rec); |
972 |
+ |
973 |
+ put_net(id_priv->id.route.addr.dev_addr.net); |
974 |
+- rdma_restrack_del(&id_priv->res); |
975 |
+ kfree(id_priv); |
976 |
+ } |
977 |
+ |
978 |
+@@ -3740,7 +3741,7 @@ int rdma_listen(struct rdma_cm_id *id, int backlog) |
979 |
+ } |
980 |
+ |
981 |
+ id_priv->backlog = backlog; |
982 |
+- if (id->device) { |
983 |
++ if (id_priv->cma_dev) { |
984 |
+ if (rdma_cap_ib_cm(id->device, 1)) { |
985 |
+ ret = cma_ib_listen(id_priv); |
986 |
+ if (ret) |
987 |
+diff --git a/drivers/infiniband/core/uverbs_std_types_device.c b/drivers/infiniband/core/uverbs_std_types_device.c |
988 |
+index 9ec6971056fa8..049684880ae03 100644 |
989 |
+--- a/drivers/infiniband/core/uverbs_std_types_device.c |
990 |
++++ b/drivers/infiniband/core/uverbs_std_types_device.c |
991 |
+@@ -117,8 +117,8 @@ static int UVERBS_HANDLER(UVERBS_METHOD_INFO_HANDLES)( |
992 |
+ return ret; |
993 |
+ |
994 |
+ uapi_object = uapi_get_object(attrs->ufile->device->uapi, object_id); |
995 |
+- if (!uapi_object) |
996 |
+- return -EINVAL; |
997 |
++ if (IS_ERR(uapi_object)) |
998 |
++ return PTR_ERR(uapi_object); |
999 |
+ |
1000 |
+ handles = gather_objects_handle(attrs->ufile, uapi_object, attrs, |
1001 |
+ out_len, &total); |
1002 |
+@@ -331,6 +331,9 @@ static int UVERBS_HANDLER(UVERBS_METHOD_QUERY_GID_TABLE)( |
1003 |
+ if (ret) |
1004 |
+ return ret; |
1005 |
+ |
1006 |
++ if (!user_entry_size) |
1007 |
++ return -EINVAL; |
1008 |
++ |
1009 |
+ max_entries = uverbs_attr_ptr_get_array_size( |
1010 |
+ attrs, UVERBS_ATTR_QUERY_GID_TABLE_RESP_ENTRIES, |
1011 |
+ user_entry_size); |
1012 |
+diff --git a/drivers/infiniband/hw/mlx5/devx.c b/drivers/infiniband/hw/mlx5/devx.c |
1013 |
+index efb9ec99b68bd..06a8732576193 100644 |
1014 |
+--- a/drivers/infiniband/hw/mlx5/devx.c |
1015 |
++++ b/drivers/infiniband/hw/mlx5/devx.c |
1016 |
+@@ -559,9 +559,8 @@ static bool devx_is_valid_obj_id(struct uverbs_attr_bundle *attrs, |
1017 |
+ case UVERBS_OBJECT_QP: |
1018 |
+ { |
1019 |
+ struct mlx5_ib_qp *qp = to_mqp(uobj->object); |
1020 |
+- enum ib_qp_type qp_type = qp->ibqp.qp_type; |
1021 |
+ |
1022 |
+- if (qp_type == IB_QPT_RAW_PACKET || |
1023 |
++ if (qp->type == IB_QPT_RAW_PACKET || |
1024 |
+ (qp->flags & IB_QP_CREATE_SOURCE_QPN)) { |
1025 |
+ struct mlx5_ib_raw_packet_qp *raw_packet_qp = |
1026 |
+ &qp->raw_packet_qp; |
1027 |
+@@ -578,10 +577,9 @@ static bool devx_is_valid_obj_id(struct uverbs_attr_bundle *attrs, |
1028 |
+ sq->tisn) == obj_id); |
1029 |
+ } |
1030 |
+ |
1031 |
+- if (qp_type == MLX5_IB_QPT_DCT) |
1032 |
++ if (qp->type == MLX5_IB_QPT_DCT) |
1033 |
+ return get_enc_obj_id(MLX5_CMD_OP_CREATE_DCT, |
1034 |
+ qp->dct.mdct.mqp.qpn) == obj_id; |
1035 |
+- |
1036 |
+ return get_enc_obj_id(MLX5_CMD_OP_CREATE_QP, |
1037 |
+ qp->ibqp.qp_num) == obj_id; |
1038 |
+ } |
1039 |
+diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c |
1040 |
+index beec0d7c0d6e8..b19506707e45c 100644 |
1041 |
+--- a/drivers/infiniband/hw/mlx5/main.c |
1042 |
++++ b/drivers/infiniband/hw/mlx5/main.c |
1043 |
+@@ -4762,6 +4762,7 @@ static void *mlx5_ib_add_slave_port(struct mlx5_core_dev *mdev) |
1044 |
+ |
1045 |
+ if (bound) { |
1046 |
+ rdma_roce_rescan_device(&dev->ib_dev); |
1047 |
++ mpi->ibdev->ib_active = true; |
1048 |
+ break; |
1049 |
+ } |
1050 |
+ } |
1051 |
+diff --git a/drivers/infiniband/sw/rxe/rxe_qp.c b/drivers/infiniband/sw/rxe/rxe_qp.c |
1052 |
+index 656a5b4be847e..1e716fe7014cc 100644 |
1053 |
+--- a/drivers/infiniband/sw/rxe/rxe_qp.c |
1054 |
++++ b/drivers/infiniband/sw/rxe/rxe_qp.c |
1055 |
+@@ -231,6 +231,7 @@ static int rxe_qp_init_req(struct rxe_dev *rxe, struct rxe_qp *qp, |
1056 |
+ if (err) { |
1057 |
+ vfree(qp->sq.queue->buf); |
1058 |
+ kfree(qp->sq.queue); |
1059 |
++ qp->sq.queue = NULL; |
1060 |
+ return err; |
1061 |
+ } |
1062 |
+ |
1063 |
+@@ -284,6 +285,7 @@ static int rxe_qp_init_resp(struct rxe_dev *rxe, struct rxe_qp *qp, |
1064 |
+ if (err) { |
1065 |
+ vfree(qp->rq.queue->buf); |
1066 |
+ kfree(qp->rq.queue); |
1067 |
++ qp->rq.queue = NULL; |
1068 |
+ return err; |
1069 |
+ } |
1070 |
+ } |
1071 |
+@@ -344,6 +346,11 @@ int rxe_qp_from_init(struct rxe_dev *rxe, struct rxe_qp *qp, struct rxe_pd *pd, |
1072 |
+ err2: |
1073 |
+ rxe_queue_cleanup(qp->sq.queue); |
1074 |
+ err1: |
1075 |
++ qp->pd = NULL; |
1076 |
++ qp->rcq = NULL; |
1077 |
++ qp->scq = NULL; |
1078 |
++ qp->srq = NULL; |
1079 |
++ |
1080 |
+ if (srq) |
1081 |
+ rxe_drop_ref(srq); |
1082 |
+ rxe_drop_ref(scq); |
1083 |
+diff --git a/drivers/infiniband/sw/siw/siw_verbs.c b/drivers/infiniband/sw/siw/siw_verbs.c |
1084 |
+index fb25e8011f5a4..34e847a91eb80 100644 |
1085 |
+--- a/drivers/infiniband/sw/siw/siw_verbs.c |
1086 |
++++ b/drivers/infiniband/sw/siw/siw_verbs.c |
1087 |
+@@ -300,7 +300,6 @@ struct ib_qp *siw_create_qp(struct ib_pd *pd, |
1088 |
+ struct siw_ucontext *uctx = |
1089 |
+ rdma_udata_to_drv_context(udata, struct siw_ucontext, |
1090 |
+ base_ucontext); |
1091 |
+- struct siw_cq *scq = NULL, *rcq = NULL; |
1092 |
+ unsigned long flags; |
1093 |
+ int num_sqe, num_rqe, rv = 0; |
1094 |
+ size_t length; |
1095 |
+@@ -340,10 +339,8 @@ struct ib_qp *siw_create_qp(struct ib_pd *pd, |
1096 |
+ rv = -EINVAL; |
1097 |
+ goto err_out; |
1098 |
+ } |
1099 |
+- scq = to_siw_cq(attrs->send_cq); |
1100 |
+- rcq = to_siw_cq(attrs->recv_cq); |
1101 |
+ |
1102 |
+- if (!scq || (!rcq && !attrs->srq)) { |
1103 |
++ if (!attrs->send_cq || (!attrs->recv_cq && !attrs->srq)) { |
1104 |
+ siw_dbg(base_dev, "send CQ or receive CQ invalid\n"); |
1105 |
+ rv = -EINVAL; |
1106 |
+ goto err_out; |
1107 |
+@@ -375,7 +372,7 @@ struct ib_qp *siw_create_qp(struct ib_pd *pd, |
1108 |
+ else { |
1109 |
+ /* Zero sized SQ is not supported */ |
1110 |
+ rv = -EINVAL; |
1111 |
+- goto err_out; |
1112 |
++ goto err_out_xa; |
1113 |
+ } |
1114 |
+ if (num_rqe) |
1115 |
+ num_rqe = roundup_pow_of_two(num_rqe); |
1116 |
+@@ -398,8 +395,8 @@ struct ib_qp *siw_create_qp(struct ib_pd *pd, |
1117 |
+ } |
1118 |
+ } |
1119 |
+ qp->pd = pd; |
1120 |
+- qp->scq = scq; |
1121 |
+- qp->rcq = rcq; |
1122 |
++ qp->scq = to_siw_cq(attrs->send_cq); |
1123 |
++ qp->rcq = to_siw_cq(attrs->recv_cq); |
1124 |
+ |
1125 |
+ if (attrs->srq) { |
1126 |
+ /* |
1127 |
+diff --git a/drivers/leds/leds-lp5523.c b/drivers/leds/leds-lp5523.c |
1128 |
+index fc433e63b1dc0..b1590cb4a1887 100644 |
1129 |
+--- a/drivers/leds/leds-lp5523.c |
1130 |
++++ b/drivers/leds/leds-lp5523.c |
1131 |
+@@ -307,7 +307,7 @@ static int lp5523_init_program_engine(struct lp55xx_chip *chip) |
1132 |
+ usleep_range(3000, 6000); |
1133 |
+ ret = lp55xx_read(chip, LP5523_REG_STATUS, &status); |
1134 |
+ if (ret) |
1135 |
+- return ret; |
1136 |
++ goto out; |
1137 |
+ status &= LP5523_ENG_STATUS_MASK; |
1138 |
+ |
1139 |
+ if (status != LP5523_ENG_STATUS_MASK) { |
1140 |
+diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c |
1141 |
+index 11890db71f3fe..962f7df0691ef 100644 |
1142 |
+--- a/drivers/md/dm-snap.c |
1143 |
++++ b/drivers/md/dm-snap.c |
1144 |
+@@ -1408,6 +1408,7 @@ static int snapshot_ctr(struct dm_target *ti, unsigned int argc, char **argv) |
1145 |
+ |
1146 |
+ if (!s->store->chunk_size) { |
1147 |
+ ti->error = "Chunk size not set"; |
1148 |
++ r = -EINVAL; |
1149 |
+ goto bad_read_metadata; |
1150 |
+ } |
1151 |
+ |
1152 |
+diff --git a/drivers/media/platform/rcar_drif.c b/drivers/media/platform/rcar_drif.c |
1153 |
+index f318cd4b8086f..083dba95beaa0 100644 |
1154 |
+--- a/drivers/media/platform/rcar_drif.c |
1155 |
++++ b/drivers/media/platform/rcar_drif.c |
1156 |
+@@ -915,7 +915,6 @@ static int rcar_drif_g_fmt_sdr_cap(struct file *file, void *priv, |
1157 |
+ { |
1158 |
+ struct rcar_drif_sdr *sdr = video_drvdata(file); |
1159 |
+ |
1160 |
+- memset(f->fmt.sdr.reserved, 0, sizeof(f->fmt.sdr.reserved)); |
1161 |
+ f->fmt.sdr.pixelformat = sdr->fmt->pixelformat; |
1162 |
+ f->fmt.sdr.buffersize = sdr->fmt->buffersize; |
1163 |
+ |
1164 |
+diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c |
1165 |
+index 926408b41270c..7a6f01ace78ac 100644 |
1166 |
+--- a/drivers/misc/eeprom/at24.c |
1167 |
++++ b/drivers/misc/eeprom/at24.c |
1168 |
+@@ -763,7 +763,8 @@ static int at24_probe(struct i2c_client *client) |
1169 |
+ at24->nvmem = devm_nvmem_register(dev, &nvmem_config); |
1170 |
+ if (IS_ERR(at24->nvmem)) { |
1171 |
+ pm_runtime_disable(dev); |
1172 |
+- regulator_disable(at24->vcc_reg); |
1173 |
++ if (!pm_runtime_status_suspended(dev)) |
1174 |
++ regulator_disable(at24->vcc_reg); |
1175 |
+ return PTR_ERR(at24->nvmem); |
1176 |
+ } |
1177 |
+ |
1178 |
+@@ -774,7 +775,8 @@ static int at24_probe(struct i2c_client *client) |
1179 |
+ err = at24_read(at24, 0, &test_byte, 1); |
1180 |
+ if (err) { |
1181 |
+ pm_runtime_disable(dev); |
1182 |
+- regulator_disable(at24->vcc_reg); |
1183 |
++ if (!pm_runtime_status_suspended(dev)) |
1184 |
++ regulator_disable(at24->vcc_reg); |
1185 |
+ return -ENODEV; |
1186 |
+ } |
1187 |
+ |
1188 |
+diff --git a/drivers/misc/ics932s401.c b/drivers/misc/ics932s401.c |
1189 |
+index 2bdf560ee681b..0f9ea75b0b189 100644 |
1190 |
+--- a/drivers/misc/ics932s401.c |
1191 |
++++ b/drivers/misc/ics932s401.c |
1192 |
+@@ -134,7 +134,7 @@ static struct ics932s401_data *ics932s401_update_device(struct device *dev) |
1193 |
+ for (i = 0; i < NUM_MIRRORED_REGS; i++) { |
1194 |
+ temp = i2c_smbus_read_word_data(client, regs_to_copy[i]); |
1195 |
+ if (temp < 0) |
1196 |
+- data->regs[regs_to_copy[i]] = 0; |
1197 |
++ temp = 0; |
1198 |
+ data->regs[regs_to_copy[i]] = temp >> 8; |
1199 |
+ } |
1200 |
+ |
1201 |
+diff --git a/drivers/mmc/host/sdhci-pci-gli.c b/drivers/mmc/host/sdhci-pci-gli.c |
1202 |
+index 9887485a41348..23b89b4cad088 100644 |
1203 |
+--- a/drivers/mmc/host/sdhci-pci-gli.c |
1204 |
++++ b/drivers/mmc/host/sdhci-pci-gli.c |
1205 |
+@@ -555,8 +555,13 @@ static void sdhci_gli_voltage_switch(struct sdhci_host *host) |
1206 |
+ * |
1207 |
+ * Wait 5ms after set 1.8V signal enable in Host Control 2 register |
1208 |
+ * to ensure 1.8V signal enable bit is set by GL9750/GL9755. |
1209 |
++ * |
1210 |
++ * ...however, the controller in the NUC10i3FNK4 (a 9755) requires |
1211 |
++ * slightly longer than 5ms before the control register reports that |
1212 |
++ * 1.8V is ready, and far longer still before the card will actually |
1213 |
++ * work reliably. |
1214 |
+ */ |
1215 |
+- usleep_range(5000, 5500); |
1216 |
++ usleep_range(100000, 110000); |
1217 |
+ } |
1218 |
+ |
1219 |
+ static void sdhci_gl9750_reset(struct sdhci_host *host, u8 mask) |
1220 |
+diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c |
1221 |
+index d8a3ecaed3fc6..d8f0863b39342 100644 |
1222 |
+--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c |
1223 |
++++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c |
1224 |
+@@ -1048,7 +1048,7 @@ int qlcnic_do_lb_test(struct qlcnic_adapter *adapter, u8 mode) |
1225 |
+ for (i = 0; i < QLCNIC_NUM_ILB_PKT; i++) { |
1226 |
+ skb = netdev_alloc_skb(adapter->netdev, QLCNIC_ILB_PKT_SIZE); |
1227 |
+ if (!skb) |
1228 |
+- break; |
1229 |
++ goto error; |
1230 |
+ qlcnic_create_loopback_buff(skb->data, adapter->mac_addr); |
1231 |
+ skb_put(skb, QLCNIC_ILB_PKT_SIZE); |
1232 |
+ adapter->ahw->diag_cnt = 0; |
1233 |
+@@ -1072,6 +1072,7 @@ int qlcnic_do_lb_test(struct qlcnic_adapter *adapter, u8 mode) |
1234 |
+ cnt++; |
1235 |
+ } |
1236 |
+ if (cnt != i) { |
1237 |
++error: |
1238 |
+ dev_err(&adapter->pdev->dev, |
1239 |
+ "LB Test: failed, TX[%d], RX[%d]\n", i, cnt); |
1240 |
+ if (mode != QLCNIC_ILB_MODE) |
1241 |
+diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sunxi.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-sunxi.c |
1242 |
+index 0e1ca2cba3c7c..e18dee7fe6876 100644 |
1243 |
+--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sunxi.c |
1244 |
++++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sunxi.c |
1245 |
+@@ -30,7 +30,7 @@ struct sunxi_priv_data { |
1246 |
+ static int sun7i_gmac_init(struct platform_device *pdev, void *priv) |
1247 |
+ { |
1248 |
+ struct sunxi_priv_data *gmac = priv; |
1249 |
+- int ret; |
1250 |
++ int ret = 0; |
1251 |
+ |
1252 |
+ if (gmac->regulator) { |
1253 |
+ ret = regulator_enable(gmac->regulator); |
1254 |
+@@ -51,11 +51,11 @@ static int sun7i_gmac_init(struct platform_device *pdev, void *priv) |
1255 |
+ } else { |
1256 |
+ clk_set_rate(gmac->tx_clk, SUN7I_GMAC_MII_RATE); |
1257 |
+ ret = clk_prepare(gmac->tx_clk); |
1258 |
+- if (ret) |
1259 |
+- return ret; |
1260 |
++ if (ret && gmac->regulator) |
1261 |
++ regulator_disable(gmac->regulator); |
1262 |
+ } |
1263 |
+ |
1264 |
+- return 0; |
1265 |
++ return ret; |
1266 |
+ } |
1267 |
+ |
1268 |
+ static void sun7i_gmac_exit(struct platform_device *pdev, void *priv) |
1269 |
+diff --git a/drivers/net/ethernet/sun/niu.c b/drivers/net/ethernet/sun/niu.c |
1270 |
+index 707ccdd03b19e..74e748662ec01 100644 |
1271 |
+--- a/drivers/net/ethernet/sun/niu.c |
1272 |
++++ b/drivers/net/ethernet/sun/niu.c |
1273 |
+@@ -8144,10 +8144,10 @@ static int niu_pci_vpd_scan_props(struct niu *np, u32 start, u32 end) |
1274 |
+ "VPD_SCAN: Reading in property [%s] len[%d]\n", |
1275 |
+ namebuf, prop_len); |
1276 |
+ for (i = 0; i < prop_len; i++) { |
1277 |
+- err = niu_pci_eeprom_read(np, off + i); |
1278 |
+- if (err >= 0) |
1279 |
+- *prop_buf = err; |
1280 |
+- ++prop_buf; |
1281 |
++ err = niu_pci_eeprom_read(np, off + i); |
1282 |
++ if (err < 0) |
1283 |
++ return err; |
1284 |
++ *prop_buf++ = err; |
1285 |
+ } |
1286 |
+ } |
1287 |
+ |
1288 |
+@@ -8158,14 +8158,14 @@ static int niu_pci_vpd_scan_props(struct niu *np, u32 start, u32 end) |
1289 |
+ } |
1290 |
+ |
1291 |
+ /* ESPC_PIO_EN_ENABLE must be set */ |
1292 |
+-static void niu_pci_vpd_fetch(struct niu *np, u32 start) |
1293 |
++static int niu_pci_vpd_fetch(struct niu *np, u32 start) |
1294 |
+ { |
1295 |
+ u32 offset; |
1296 |
+ int err; |
1297 |
+ |
1298 |
+ err = niu_pci_eeprom_read16_swp(np, start + 1); |
1299 |
+ if (err < 0) |
1300 |
+- return; |
1301 |
++ return err; |
1302 |
+ |
1303 |
+ offset = err + 3; |
1304 |
+ |
1305 |
+@@ -8174,12 +8174,14 @@ static void niu_pci_vpd_fetch(struct niu *np, u32 start) |
1306 |
+ u32 end; |
1307 |
+ |
1308 |
+ err = niu_pci_eeprom_read(np, here); |
1309 |
++ if (err < 0) |
1310 |
++ return err; |
1311 |
+ if (err != 0x90) |
1312 |
+- return; |
1313 |
++ return -EINVAL; |
1314 |
+ |
1315 |
+ err = niu_pci_eeprom_read16_swp(np, here + 1); |
1316 |
+ if (err < 0) |
1317 |
+- return; |
1318 |
++ return err; |
1319 |
+ |
1320 |
+ here = start + offset + 3; |
1321 |
+ end = start + offset + err; |
1322 |
+@@ -8187,9 +8189,12 @@ static void niu_pci_vpd_fetch(struct niu *np, u32 start) |
1323 |
+ offset += err; |
1324 |
+ |
1325 |
+ err = niu_pci_vpd_scan_props(np, here, end); |
1326 |
+- if (err < 0 || err == 1) |
1327 |
+- return; |
1328 |
++ if (err < 0) |
1329 |
++ return err; |
1330 |
++ if (err == 1) |
1331 |
++ return -EINVAL; |
1332 |
+ } |
1333 |
++ return 0; |
1334 |
+ } |
1335 |
+ |
1336 |
+ /* ESPC_PIO_EN_ENABLE must be set */ |
1337 |
+@@ -9280,8 +9285,11 @@ static int niu_get_invariants(struct niu *np) |
1338 |
+ offset = niu_pci_vpd_offset(np); |
1339 |
+ netif_printk(np, probe, KERN_DEBUG, np->dev, |
1340 |
+ "%s() VPD offset [%08x]\n", __func__, offset); |
1341 |
+- if (offset) |
1342 |
+- niu_pci_vpd_fetch(np, offset); |
1343 |
++ if (offset) { |
1344 |
++ err = niu_pci_vpd_fetch(np, offset); |
1345 |
++ if (err < 0) |
1346 |
++ return err; |
1347 |
++ } |
1348 |
+ nw64(ESPC_PIO_EN, 0); |
1349 |
+ |
1350 |
+ if (np->flags & NIU_FLAGS_VPD_VALID) { |
1351 |
+diff --git a/drivers/net/wireless/realtek/rtlwifi/base.c b/drivers/net/wireless/realtek/rtlwifi/base.c |
1352 |
+index 6e8bd99e8911d..1866f6c2acab1 100644 |
1353 |
+--- a/drivers/net/wireless/realtek/rtlwifi/base.c |
1354 |
++++ b/drivers/net/wireless/realtek/rtlwifi/base.c |
1355 |
+@@ -440,9 +440,14 @@ static void rtl_watchdog_wq_callback(struct work_struct *work); |
1356 |
+ static void rtl_fwevt_wq_callback(struct work_struct *work); |
1357 |
+ static void rtl_c2hcmd_wq_callback(struct work_struct *work); |
1358 |
+ |
1359 |
+-static void _rtl_init_deferred_work(struct ieee80211_hw *hw) |
1360 |
++static int _rtl_init_deferred_work(struct ieee80211_hw *hw) |
1361 |
+ { |
1362 |
+ struct rtl_priv *rtlpriv = rtl_priv(hw); |
1363 |
++ struct workqueue_struct *wq; |
1364 |
++ |
1365 |
++ wq = alloc_workqueue("%s", 0, 0, rtlpriv->cfg->name); |
1366 |
++ if (!wq) |
1367 |
++ return -ENOMEM; |
1368 |
+ |
1369 |
+ /* <1> timer */ |
1370 |
+ timer_setup(&rtlpriv->works.watchdog_timer, |
1371 |
+@@ -451,11 +456,7 @@ static void _rtl_init_deferred_work(struct ieee80211_hw *hw) |
1372 |
+ rtl_easy_concurrent_retrytimer_callback, 0); |
1373 |
+ /* <2> work queue */ |
1374 |
+ rtlpriv->works.hw = hw; |
1375 |
+- rtlpriv->works.rtl_wq = alloc_workqueue("%s", 0, 0, rtlpriv->cfg->name); |
1376 |
+- if (unlikely(!rtlpriv->works.rtl_wq)) { |
1377 |
+- pr_err("Failed to allocate work queue\n"); |
1378 |
+- return; |
1379 |
+- } |
1380 |
++ rtlpriv->works.rtl_wq = wq; |
1381 |
+ |
1382 |
+ INIT_DELAYED_WORK(&rtlpriv->works.watchdog_wq, |
1383 |
+ rtl_watchdog_wq_callback); |
1384 |
+@@ -466,6 +467,7 @@ static void _rtl_init_deferred_work(struct ieee80211_hw *hw) |
1385 |
+ rtl_swlps_rfon_wq_callback); |
1386 |
+ INIT_DELAYED_WORK(&rtlpriv->works.fwevt_wq, rtl_fwevt_wq_callback); |
1387 |
+ INIT_DELAYED_WORK(&rtlpriv->works.c2hcmd_wq, rtl_c2hcmd_wq_callback); |
1388 |
++ return 0; |
1389 |
+ } |
1390 |
+ |
1391 |
+ void rtl_deinit_deferred_work(struct ieee80211_hw *hw, bool ips_wq) |
1392 |
+@@ -565,9 +567,7 @@ int rtl_init_core(struct ieee80211_hw *hw) |
1393 |
+ rtlmac->link_state = MAC80211_NOLINK; |
1394 |
+ |
1395 |
+ /* <6> init deferred work */ |
1396 |
+- _rtl_init_deferred_work(hw); |
1397 |
+- |
1398 |
+- return 0; |
1399 |
++ return _rtl_init_deferred_work(hw); |
1400 |
+ } |
1401 |
+ EXPORT_SYMBOL_GPL(rtl_init_core); |
1402 |
+ |
1403 |
+diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c |
1404 |
+index 740de61d12a0e..f520a71a361fc 100644 |
1405 |
+--- a/drivers/nvme/host/core.c |
1406 |
++++ b/drivers/nvme/host/core.c |
1407 |
+@@ -3131,7 +3131,7 @@ int nvme_init_identify(struct nvme_ctrl *ctrl) |
1408 |
+ ctrl->hmmaxd = le16_to_cpu(id->hmmaxd); |
1409 |
+ } |
1410 |
+ |
1411 |
+- ret = nvme_mpath_init(ctrl, id); |
1412 |
++ ret = nvme_mpath_init_identify(ctrl, id); |
1413 |
+ kfree(id); |
1414 |
+ |
1415 |
+ if (ret < 0) |
1416 |
+@@ -4517,6 +4517,7 @@ int nvme_init_ctrl(struct nvme_ctrl *ctrl, struct device *dev, |
1417 |
+ min(default_ps_max_latency_us, (unsigned long)S32_MAX)); |
1418 |
+ |
1419 |
+ nvme_fault_inject_init(&ctrl->fault_inject, dev_name(ctrl->device)); |
1420 |
++ nvme_mpath_init_ctrl(ctrl); |
1421 |
+ |
1422 |
+ return 0; |
1423 |
+ out_free_name: |
1424 |
+diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c |
1425 |
+index 41257daf7464d..a0bcec33b0208 100644 |
1426 |
+--- a/drivers/nvme/host/fc.c |
1427 |
++++ b/drivers/nvme/host/fc.c |
1428 |
+@@ -2460,6 +2460,18 @@ nvme_fc_terminate_exchange(struct request *req, void *data, bool reserved) |
1429 |
+ static void |
1430 |
+ __nvme_fc_abort_outstanding_ios(struct nvme_fc_ctrl *ctrl, bool start_queues) |
1431 |
+ { |
1432 |
++ int q; |
1433 |
++ |
1434 |
++ /* |
1435 |
++ * if aborting io, the queues are no longer good, mark them |
1436 |
++ * all as not live. |
1437 |
++ */ |
1438 |
++ if (ctrl->ctrl.queue_count > 1) { |
1439 |
++ for (q = 1; q < ctrl->ctrl.queue_count; q++) |
1440 |
++ clear_bit(NVME_FC_Q_LIVE, &ctrl->queues[q].flags); |
1441 |
++ } |
1442 |
++ clear_bit(NVME_FC_Q_LIVE, &ctrl->queues[0].flags); |
1443 |
++ |
1444 |
+ /* |
1445 |
+ * If io queues are present, stop them and terminate all outstanding |
1446 |
+ * ios on them. As FC allocates FC exchange for each io, the |
1447 |
+diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c |
1448 |
+index f750cf98ae264..2747efc03825c 100644 |
1449 |
+--- a/drivers/nvme/host/multipath.c |
1450 |
++++ b/drivers/nvme/host/multipath.c |
1451 |
+@@ -708,9 +708,18 @@ void nvme_mpath_remove_disk(struct nvme_ns_head *head) |
1452 |
+ put_disk(head->disk); |
1453 |
+ } |
1454 |
+ |
1455 |
+-int nvme_mpath_init(struct nvme_ctrl *ctrl, struct nvme_id_ctrl *id) |
1456 |
++void nvme_mpath_init_ctrl(struct nvme_ctrl *ctrl) |
1457 |
+ { |
1458 |
+- int error; |
1459 |
++ mutex_init(&ctrl->ana_lock); |
1460 |
++ timer_setup(&ctrl->anatt_timer, nvme_anatt_timeout, 0); |
1461 |
++ INIT_WORK(&ctrl->ana_work, nvme_ana_work); |
1462 |
++} |
1463 |
++ |
1464 |
++int nvme_mpath_init_identify(struct nvme_ctrl *ctrl, struct nvme_id_ctrl *id) |
1465 |
++{ |
1466 |
++ size_t max_transfer_size = ctrl->max_hw_sectors << SECTOR_SHIFT; |
1467 |
++ size_t ana_log_size; |
1468 |
++ int error = 0; |
1469 |
+ |
1470 |
+ /* check if multipath is enabled and we have the capability */ |
1471 |
+ if (!multipath || !ctrl->subsys || |
1472 |
+@@ -722,37 +731,31 @@ int nvme_mpath_init(struct nvme_ctrl *ctrl, struct nvme_id_ctrl *id) |
1473 |
+ ctrl->nanagrpid = le32_to_cpu(id->nanagrpid); |
1474 |
+ ctrl->anagrpmax = le32_to_cpu(id->anagrpmax); |
1475 |
+ |
1476 |
+- mutex_init(&ctrl->ana_lock); |
1477 |
+- timer_setup(&ctrl->anatt_timer, nvme_anatt_timeout, 0); |
1478 |
+- ctrl->ana_log_size = sizeof(struct nvme_ana_rsp_hdr) + |
1479 |
+- ctrl->nanagrpid * sizeof(struct nvme_ana_group_desc); |
1480 |
+- ctrl->ana_log_size += ctrl->max_namespaces * sizeof(__le32); |
1481 |
+- |
1482 |
+- if (ctrl->ana_log_size > ctrl->max_hw_sectors << SECTOR_SHIFT) { |
1483 |
++ ana_log_size = sizeof(struct nvme_ana_rsp_hdr) + |
1484 |
++ ctrl->nanagrpid * sizeof(struct nvme_ana_group_desc) + |
1485 |
++ ctrl->max_namespaces * sizeof(__le32); |
1486 |
++ if (ana_log_size > max_transfer_size) { |
1487 |
+ dev_err(ctrl->device, |
1488 |
+- "ANA log page size (%zd) larger than MDTS (%d).\n", |
1489 |
+- ctrl->ana_log_size, |
1490 |
+- ctrl->max_hw_sectors << SECTOR_SHIFT); |
1491 |
++ "ANA log page size (%zd) larger than MDTS (%zd).\n", |
1492 |
++ ana_log_size, max_transfer_size); |
1493 |
+ dev_err(ctrl->device, "disabling ANA support.\n"); |
1494 |
+- return 0; |
1495 |
++ goto out_uninit; |
1496 |
+ } |
1497 |
+- |
1498 |
+- INIT_WORK(&ctrl->ana_work, nvme_ana_work); |
1499 |
+- kfree(ctrl->ana_log_buf); |
1500 |
+- ctrl->ana_log_buf = kmalloc(ctrl->ana_log_size, GFP_KERNEL); |
1501 |
+- if (!ctrl->ana_log_buf) { |
1502 |
+- error = -ENOMEM; |
1503 |
+- goto out; |
1504 |
++ if (ana_log_size > ctrl->ana_log_size) { |
1505 |
++ nvme_mpath_stop(ctrl); |
1506 |
++ kfree(ctrl->ana_log_buf); |
1507 |
++ ctrl->ana_log_buf = kmalloc(ana_log_size, GFP_KERNEL); |
1508 |
++ if (!ctrl->ana_log_buf) |
1509 |
++ return -ENOMEM; |
1510 |
+ } |
1511 |
+- |
1512 |
++ ctrl->ana_log_size = ana_log_size; |
1513 |
+ error = nvme_read_ana_log(ctrl); |
1514 |
+ if (error) |
1515 |
+- goto out_free_ana_log_buf; |
1516 |
++ goto out_uninit; |
1517 |
+ return 0; |
1518 |
+-out_free_ana_log_buf: |
1519 |
+- kfree(ctrl->ana_log_buf); |
1520 |
+- ctrl->ana_log_buf = NULL; |
1521 |
+-out: |
1522 |
++ |
1523 |
++out_uninit: |
1524 |
++ nvme_mpath_uninit(ctrl); |
1525 |
+ return error; |
1526 |
+ } |
1527 |
+ |
1528 |
+diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h |
1529 |
+index f843540cc238e..3cb3c82061d7e 100644 |
1530 |
+--- a/drivers/nvme/host/nvme.h |
1531 |
++++ b/drivers/nvme/host/nvme.h |
1532 |
+@@ -654,7 +654,8 @@ void nvme_kick_requeue_lists(struct nvme_ctrl *ctrl); |
1533 |
+ int nvme_mpath_alloc_disk(struct nvme_ctrl *ctrl,struct nvme_ns_head *head); |
1534 |
+ void nvme_mpath_add_disk(struct nvme_ns *ns, struct nvme_id_ns *id); |
1535 |
+ void nvme_mpath_remove_disk(struct nvme_ns_head *head); |
1536 |
+-int nvme_mpath_init(struct nvme_ctrl *ctrl, struct nvme_id_ctrl *id); |
1537 |
++int nvme_mpath_init_identify(struct nvme_ctrl *ctrl, struct nvme_id_ctrl *id); |
1538 |
++void nvme_mpath_init_ctrl(struct nvme_ctrl *ctrl); |
1539 |
+ void nvme_mpath_uninit(struct nvme_ctrl *ctrl); |
1540 |
+ void nvme_mpath_stop(struct nvme_ctrl *ctrl); |
1541 |
+ bool nvme_mpath_clear_current_path(struct nvme_ns *ns); |
1542 |
+@@ -730,7 +731,10 @@ static inline void nvme_trace_bio_complete(struct request *req, |
1543 |
+ blk_status_t status) |
1544 |
+ { |
1545 |
+ } |
1546 |
+-static inline int nvme_mpath_init(struct nvme_ctrl *ctrl, |
1547 |
++static inline void nvme_mpath_init_ctrl(struct nvme_ctrl *ctrl) |
1548 |
++{ |
1549 |
++} |
1550 |
++static inline int nvme_mpath_init_identify(struct nvme_ctrl *ctrl, |
1551 |
+ struct nvme_id_ctrl *id) |
1552 |
+ { |
1553 |
+ if (ctrl->subsys->cmic & (1 << 3)) |
1554 |
+diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c |
1555 |
+index 4cf81f3841aee..82b2611d39a2f 100644 |
1556 |
+--- a/drivers/nvme/host/tcp.c |
1557 |
++++ b/drivers/nvme/host/tcp.c |
1558 |
+@@ -940,7 +940,6 @@ static int nvme_tcp_try_send_data(struct nvme_tcp_request *req) |
1559 |
+ if (ret <= 0) |
1560 |
+ return ret; |
1561 |
+ |
1562 |
+- nvme_tcp_advance_req(req, ret); |
1563 |
+ if (queue->data_digest) |
1564 |
+ nvme_tcp_ddgst_update(queue->snd_hash, page, |
1565 |
+ offset, ret); |
1566 |
+@@ -957,6 +956,7 @@ static int nvme_tcp_try_send_data(struct nvme_tcp_request *req) |
1567 |
+ } |
1568 |
+ return 1; |
1569 |
+ } |
1570 |
++ nvme_tcp_advance_req(req, ret); |
1571 |
+ } |
1572 |
+ return -EAGAIN; |
1573 |
+ } |
1574 |
+@@ -1140,7 +1140,8 @@ static void nvme_tcp_io_work(struct work_struct *w) |
1575 |
+ pending = true; |
1576 |
+ else if (unlikely(result < 0)) |
1577 |
+ break; |
1578 |
+- } |
1579 |
++ } else |
1580 |
++ pending = !llist_empty(&queue->req_list); |
1581 |
+ |
1582 |
+ result = nvme_tcp_try_recv(queue); |
1583 |
+ if (result > 0) |
1584 |
+diff --git a/drivers/nvme/target/core.c b/drivers/nvme/target/core.c |
1585 |
+index 1e79d33c1df7e..46e4f7ea34c8b 100644 |
1586 |
+--- a/drivers/nvme/target/core.c |
1587 |
++++ b/drivers/nvme/target/core.c |
1588 |
+@@ -757,8 +757,6 @@ void nvmet_cq_setup(struct nvmet_ctrl *ctrl, struct nvmet_cq *cq, |
1589 |
+ { |
1590 |
+ cq->qid = qid; |
1591 |
+ cq->size = size; |
1592 |
+- |
1593 |
+- ctrl->cqs[qid] = cq; |
1594 |
+ } |
1595 |
+ |
1596 |
+ void nvmet_sq_setup(struct nvmet_ctrl *ctrl, struct nvmet_sq *sq, |
1597 |
+@@ -1355,20 +1353,14 @@ u16 nvmet_alloc_ctrl(const char *subsysnqn, const char *hostnqn, |
1598 |
+ if (!ctrl->changed_ns_list) |
1599 |
+ goto out_free_ctrl; |
1600 |
+ |
1601 |
+- ctrl->cqs = kcalloc(subsys->max_qid + 1, |
1602 |
+- sizeof(struct nvmet_cq *), |
1603 |
+- GFP_KERNEL); |
1604 |
+- if (!ctrl->cqs) |
1605 |
+- goto out_free_changed_ns_list; |
1606 |
+- |
1607 |
+ ctrl->sqs = kcalloc(subsys->max_qid + 1, |
1608 |
+ sizeof(struct nvmet_sq *), |
1609 |
+ GFP_KERNEL); |
1610 |
+ if (!ctrl->sqs) |
1611 |
+- goto out_free_cqs; |
1612 |
++ goto out_free_changed_ns_list; |
1613 |
+ |
1614 |
+ if (subsys->cntlid_min > subsys->cntlid_max) |
1615 |
+- goto out_free_cqs; |
1616 |
++ goto out_free_sqs; |
1617 |
+ |
1618 |
+ ret = ida_simple_get(&cntlid_ida, |
1619 |
+ subsys->cntlid_min, subsys->cntlid_max, |
1620 |
+@@ -1406,8 +1398,6 @@ u16 nvmet_alloc_ctrl(const char *subsysnqn, const char *hostnqn, |
1621 |
+ |
1622 |
+ out_free_sqs: |
1623 |
+ kfree(ctrl->sqs); |
1624 |
+-out_free_cqs: |
1625 |
+- kfree(ctrl->cqs); |
1626 |
+ out_free_changed_ns_list: |
1627 |
+ kfree(ctrl->changed_ns_list); |
1628 |
+ out_free_ctrl: |
1629 |
+@@ -1437,7 +1427,6 @@ static void nvmet_ctrl_free(struct kref *ref) |
1630 |
+ |
1631 |
+ nvmet_async_events_free(ctrl); |
1632 |
+ kfree(ctrl->sqs); |
1633 |
+- kfree(ctrl->cqs); |
1634 |
+ kfree(ctrl->changed_ns_list); |
1635 |
+ kfree(ctrl); |
1636 |
+ |
1637 |
+diff --git a/drivers/nvme/target/io-cmd-file.c b/drivers/nvme/target/io-cmd-file.c |
1638 |
+index 0abbefd9925e3..b575997244482 100644 |
1639 |
+--- a/drivers/nvme/target/io-cmd-file.c |
1640 |
++++ b/drivers/nvme/target/io-cmd-file.c |
1641 |
+@@ -49,9 +49,11 @@ int nvmet_file_ns_enable(struct nvmet_ns *ns) |
1642 |
+ |
1643 |
+ ns->file = filp_open(ns->device_path, flags, 0); |
1644 |
+ if (IS_ERR(ns->file)) { |
1645 |
+- pr_err("failed to open file %s: (%ld)\n", |
1646 |
+- ns->device_path, PTR_ERR(ns->file)); |
1647 |
+- return PTR_ERR(ns->file); |
1648 |
++ ret = PTR_ERR(ns->file); |
1649 |
++ pr_err("failed to open file %s: (%d)\n", |
1650 |
++ ns->device_path, ret); |
1651 |
++ ns->file = NULL; |
1652 |
++ return ret; |
1653 |
+ } |
1654 |
+ |
1655 |
+ ret = nvmet_file_ns_revalidate(ns); |
1656 |
+diff --git a/drivers/nvme/target/loop.c b/drivers/nvme/target/loop.c |
1657 |
+index f6d81239be215..b869b686e9623 100644 |
1658 |
+--- a/drivers/nvme/target/loop.c |
1659 |
++++ b/drivers/nvme/target/loop.c |
1660 |
+@@ -578,8 +578,10 @@ static struct nvme_ctrl *nvme_loop_create_ctrl(struct device *dev, |
1661 |
+ |
1662 |
+ ret = nvme_init_ctrl(&ctrl->ctrl, dev, &nvme_loop_ctrl_ops, |
1663 |
+ 0 /* no quirks, we're perfect! */); |
1664 |
+- if (ret) |
1665 |
++ if (ret) { |
1666 |
++ kfree(ctrl); |
1667 |
+ goto out; |
1668 |
++ } |
1669 |
+ |
1670 |
+ if (!nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_CONNECTING)) |
1671 |
+ WARN_ON_ONCE(1); |
1672 |
+diff --git a/drivers/nvme/target/nvmet.h b/drivers/nvme/target/nvmet.h |
1673 |
+index bc91336080e01..ea96487b5424e 100644 |
1674 |
+--- a/drivers/nvme/target/nvmet.h |
1675 |
++++ b/drivers/nvme/target/nvmet.h |
1676 |
+@@ -164,7 +164,6 @@ static inline struct nvmet_port *ana_groups_to_port( |
1677 |
+ |
1678 |
+ struct nvmet_ctrl { |
1679 |
+ struct nvmet_subsys *subsys; |
1680 |
+- struct nvmet_cq **cqs; |
1681 |
+ struct nvmet_sq **sqs; |
1682 |
+ |
1683 |
+ bool cmd_seen; |
1684 |
+diff --git a/drivers/platform/mellanox/mlxbf-tmfifo.c b/drivers/platform/mellanox/mlxbf-tmfifo.c |
1685 |
+index bbc4e71a16ff8..38800e86ed8ad 100644 |
1686 |
+--- a/drivers/platform/mellanox/mlxbf-tmfifo.c |
1687 |
++++ b/drivers/platform/mellanox/mlxbf-tmfifo.c |
1688 |
+@@ -294,6 +294,9 @@ mlxbf_tmfifo_get_next_desc(struct mlxbf_tmfifo_vring *vring) |
1689 |
+ if (vring->next_avail == virtio16_to_cpu(vdev, vr->avail->idx)) |
1690 |
+ return NULL; |
1691 |
+ |
1692 |
++ /* Make sure 'avail->idx' is visible already. */ |
1693 |
++ virtio_rmb(false); |
1694 |
++ |
1695 |
+ idx = vring->next_avail % vr->num; |
1696 |
+ head = virtio16_to_cpu(vdev, vr->avail->ring[idx]); |
1697 |
+ if (WARN_ON(head >= vr->num)) |
1698 |
+@@ -322,7 +325,7 @@ static void mlxbf_tmfifo_release_desc(struct mlxbf_tmfifo_vring *vring, |
1699 |
+ * done or not. Add a memory barrier here to make sure the update above |
1700 |
+ * completes before updating the idx. |
1701 |
+ */ |
1702 |
+- mb(); |
1703 |
++ virtio_mb(false); |
1704 |
+ vr->used->idx = cpu_to_virtio16(vdev, vr_idx + 1); |
1705 |
+ } |
1706 |
+ |
1707 |
+@@ -733,6 +736,12 @@ static bool mlxbf_tmfifo_rxtx_one_desc(struct mlxbf_tmfifo_vring *vring, |
1708 |
+ desc = NULL; |
1709 |
+ fifo->vring[is_rx] = NULL; |
1710 |
+ |
1711 |
++ /* |
1712 |
++ * Make sure the load/store are in order before |
1713 |
++ * returning back to virtio. |
1714 |
++ */ |
1715 |
++ virtio_mb(false); |
1716 |
++ |
1717 |
+ /* Notify upper layer that packet is done. */ |
1718 |
+ spin_lock_irqsave(&fifo->spin_lock[is_rx], flags); |
1719 |
+ vring_interrupt(0, vring->vq); |
1720 |
+diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig |
1721 |
+index 0d91d136bc3b7..a1858689d6e10 100644 |
1722 |
+--- a/drivers/platform/x86/Kconfig |
1723 |
++++ b/drivers/platform/x86/Kconfig |
1724 |
+@@ -821,7 +821,7 @@ config INTEL_HID_EVENT |
1725 |
+ |
1726 |
+ config INTEL_INT0002_VGPIO |
1727 |
+ tristate "Intel ACPI INT0002 Virtual GPIO driver" |
1728 |
+- depends on GPIOLIB && ACPI |
1729 |
++ depends on GPIOLIB && ACPI && PM_SLEEP |
1730 |
+ select GPIOLIB_IRQCHIP |
1731 |
+ help |
1732 |
+ Some peripherals on Bay Trail and Cherry Trail platforms signal a |
1733 |
+diff --git a/drivers/platform/x86/dell-smbios-wmi.c b/drivers/platform/x86/dell-smbios-wmi.c |
1734 |
+index 27a298b7c541b..c97bd4a452422 100644 |
1735 |
+--- a/drivers/platform/x86/dell-smbios-wmi.c |
1736 |
++++ b/drivers/platform/x86/dell-smbios-wmi.c |
1737 |
+@@ -271,7 +271,8 @@ int init_dell_smbios_wmi(void) |
1738 |
+ |
1739 |
+ void exit_dell_smbios_wmi(void) |
1740 |
+ { |
1741 |
+- wmi_driver_unregister(&dell_smbios_wmi_driver); |
1742 |
++ if (wmi_supported) |
1743 |
++ wmi_driver_unregister(&dell_smbios_wmi_driver); |
1744 |
+ } |
1745 |
+ |
1746 |
+ MODULE_DEVICE_TABLE(wmi, dell_smbios_wmi_id_table); |
1747 |
+diff --git a/drivers/platform/x86/intel_int0002_vgpio.c b/drivers/platform/x86/intel_int0002_vgpio.c |
1748 |
+index 289c6655d425d..569342aa8926e 100644 |
1749 |
+--- a/drivers/platform/x86/intel_int0002_vgpio.c |
1750 |
++++ b/drivers/platform/x86/intel_int0002_vgpio.c |
1751 |
+@@ -51,6 +51,12 @@ |
1752 |
+ #define GPE0A_STS_PORT 0x420 |
1753 |
+ #define GPE0A_EN_PORT 0x428 |
1754 |
+ |
1755 |
++struct int0002_data { |
1756 |
++ struct gpio_chip chip; |
1757 |
++ int parent_irq; |
1758 |
++ int wake_enable_count; |
1759 |
++}; |
1760 |
++ |
1761 |
+ /* |
1762 |
+ * As this is not a real GPIO at all, but just a hack to model an event in |
1763 |
+ * ACPI the get / set functions are dummy functions. |
1764 |
+@@ -98,14 +104,16 @@ static void int0002_irq_mask(struct irq_data *data) |
1765 |
+ static int int0002_irq_set_wake(struct irq_data *data, unsigned int on) |
1766 |
+ { |
1767 |
+ struct gpio_chip *chip = irq_data_get_irq_chip_data(data); |
1768 |
+- struct platform_device *pdev = to_platform_device(chip->parent); |
1769 |
+- int irq = platform_get_irq(pdev, 0); |
1770 |
++ struct int0002_data *int0002 = container_of(chip, struct int0002_data, chip); |
1771 |
+ |
1772 |
+- /* Propagate to parent irq */ |
1773 |
++ /* |
1774 |
++ * Applying of the wakeup flag to our parent IRQ is delayed till system |
1775 |
++ * suspend, because we only want to do this when using s2idle. |
1776 |
++ */ |
1777 |
+ if (on) |
1778 |
+- enable_irq_wake(irq); |
1779 |
++ int0002->wake_enable_count++; |
1780 |
+ else |
1781 |
+- disable_irq_wake(irq); |
1782 |
++ int0002->wake_enable_count--; |
1783 |
+ |
1784 |
+ return 0; |
1785 |
+ } |
1786 |
+@@ -135,7 +143,7 @@ static bool int0002_check_wake(void *data) |
1787 |
+ return (gpe_sts_reg & GPE0A_PME_B0_STS_BIT); |
1788 |
+ } |
1789 |
+ |
1790 |
+-static struct irq_chip int0002_byt_irqchip = { |
1791 |
++static struct irq_chip int0002_irqchip = { |
1792 |
+ .name = DRV_NAME, |
1793 |
+ .irq_ack = int0002_irq_ack, |
1794 |
+ .irq_mask = int0002_irq_mask, |
1795 |
+@@ -143,21 +151,9 @@ static struct irq_chip int0002_byt_irqchip = { |
1796 |
+ .irq_set_wake = int0002_irq_set_wake, |
1797 |
+ }; |
1798 |
+ |
1799 |
+-static struct irq_chip int0002_cht_irqchip = { |
1800 |
+- .name = DRV_NAME, |
1801 |
+- .irq_ack = int0002_irq_ack, |
1802 |
+- .irq_mask = int0002_irq_mask, |
1803 |
+- .irq_unmask = int0002_irq_unmask, |
1804 |
+- /* |
1805 |
+- * No set_wake, on CHT the IRQ is typically shared with the ACPI SCI |
1806 |
+- * and we don't want to mess with the ACPI SCI irq settings. |
1807 |
+- */ |
1808 |
+- .flags = IRQCHIP_SKIP_SET_WAKE, |
1809 |
+-}; |
1810 |
+- |
1811 |
+ static const struct x86_cpu_id int0002_cpu_ids[] = { |
1812 |
+- X86_MATCH_INTEL_FAM6_MODEL(ATOM_SILVERMONT, &int0002_byt_irqchip), |
1813 |
+- X86_MATCH_INTEL_FAM6_MODEL(ATOM_AIRMONT, &int0002_cht_irqchip), |
1814 |
++ X86_MATCH_INTEL_FAM6_MODEL(ATOM_SILVERMONT, NULL), |
1815 |
++ X86_MATCH_INTEL_FAM6_MODEL(ATOM_AIRMONT, NULL), |
1816 |
+ {} |
1817 |
+ }; |
1818 |
+ |
1819 |
+@@ -172,8 +168,9 @@ static int int0002_probe(struct platform_device *pdev) |
1820 |
+ { |
1821 |
+ struct device *dev = &pdev->dev; |
1822 |
+ const struct x86_cpu_id *cpu_id; |
1823 |
+- struct gpio_chip *chip; |
1824 |
++ struct int0002_data *int0002; |
1825 |
+ struct gpio_irq_chip *girq; |
1826 |
++ struct gpio_chip *chip; |
1827 |
+ int irq, ret; |
1828 |
+ |
1829 |
+ /* Menlow has a different INT0002 device? <sigh> */ |
1830 |
+@@ -185,10 +182,13 @@ static int int0002_probe(struct platform_device *pdev) |
1831 |
+ if (irq < 0) |
1832 |
+ return irq; |
1833 |
+ |
1834 |
+- chip = devm_kzalloc(dev, sizeof(*chip), GFP_KERNEL); |
1835 |
+- if (!chip) |
1836 |
++ int0002 = devm_kzalloc(dev, sizeof(*int0002), GFP_KERNEL); |
1837 |
++ if (!int0002) |
1838 |
+ return -ENOMEM; |
1839 |
+ |
1840 |
++ int0002->parent_irq = irq; |
1841 |
++ |
1842 |
++ chip = &int0002->chip; |
1843 |
+ chip->label = DRV_NAME; |
1844 |
+ chip->parent = dev; |
1845 |
+ chip->owner = THIS_MODULE; |
1846 |
+@@ -214,7 +214,7 @@ static int int0002_probe(struct platform_device *pdev) |
1847 |
+ } |
1848 |
+ |
1849 |
+ girq = &chip->irq; |
1850 |
+- girq->chip = (struct irq_chip *)cpu_id->driver_data; |
1851 |
++ girq->chip = &int0002_irqchip; |
1852 |
+ /* This let us handle the parent IRQ in the driver */ |
1853 |
+ girq->parent_handler = NULL; |
1854 |
+ girq->num_parents = 0; |
1855 |
+@@ -230,6 +230,7 @@ static int int0002_probe(struct platform_device *pdev) |
1856 |
+ |
1857 |
+ acpi_register_wakeup_handler(irq, int0002_check_wake, NULL); |
1858 |
+ device_init_wakeup(dev, true); |
1859 |
++ dev_set_drvdata(dev, int0002); |
1860 |
+ return 0; |
1861 |
+ } |
1862 |
+ |
1863 |
+@@ -240,6 +241,36 @@ static int int0002_remove(struct platform_device *pdev) |
1864 |
+ return 0; |
1865 |
+ } |
1866 |
+ |
1867 |
++static int int0002_suspend(struct device *dev) |
1868 |
++{ |
1869 |
++ struct int0002_data *int0002 = dev_get_drvdata(dev); |
1870 |
++ |
1871 |
++ /* |
1872 |
++ * The INT0002 parent IRQ is often shared with the ACPI GPE IRQ, don't |
1873 |
++ * muck with it when firmware based suspend is used, otherwise we may |
1874 |
++ * cause spurious wakeups from firmware managed suspend. |
1875 |
++ */ |
1876 |
++ if (!pm_suspend_via_firmware() && int0002->wake_enable_count) |
1877 |
++ enable_irq_wake(int0002->parent_irq); |
1878 |
++ |
1879 |
++ return 0; |
1880 |
++} |
1881 |
++ |
1882 |
++static int int0002_resume(struct device *dev) |
1883 |
++{ |
1884 |
++ struct int0002_data *int0002 = dev_get_drvdata(dev); |
1885 |
++ |
1886 |
++ if (!pm_suspend_via_firmware() && int0002->wake_enable_count) |
1887 |
++ disable_irq_wake(int0002->parent_irq); |
1888 |
++ |
1889 |
++ return 0; |
1890 |
++} |
1891 |
++ |
1892 |
++static const struct dev_pm_ops int0002_pm_ops = { |
1893 |
++ .suspend = int0002_suspend, |
1894 |
++ .resume = int0002_resume, |
1895 |
++}; |
1896 |
++ |
1897 |
+ static const struct acpi_device_id int0002_acpi_ids[] = { |
1898 |
+ { "INT0002", 0 }, |
1899 |
+ { }, |
1900 |
+@@ -250,6 +281,7 @@ static struct platform_driver int0002_driver = { |
1901 |
+ .driver = { |
1902 |
+ .name = DRV_NAME, |
1903 |
+ .acpi_match_table = int0002_acpi_ids, |
1904 |
++ .pm = &int0002_pm_ops, |
1905 |
+ }, |
1906 |
+ .probe = int0002_probe, |
1907 |
+ .remove = int0002_remove, |
1908 |
+diff --git a/drivers/rapidio/rio_cm.c b/drivers/rapidio/rio_cm.c |
1909 |
+index 50ec53d67a4c0..db4c265287ae6 100644 |
1910 |
+--- a/drivers/rapidio/rio_cm.c |
1911 |
++++ b/drivers/rapidio/rio_cm.c |
1912 |
+@@ -2127,6 +2127,14 @@ static int riocm_add_mport(struct device *dev, |
1913 |
+ return -ENODEV; |
1914 |
+ } |
1915 |
+ |
1916 |
++ cm->rx_wq = create_workqueue(DRV_NAME "/rxq"); |
1917 |
++ if (!cm->rx_wq) { |
1918 |
++ rio_release_inb_mbox(mport, cmbox); |
1919 |
++ rio_release_outb_mbox(mport, cmbox); |
1920 |
++ kfree(cm); |
1921 |
++ return -ENOMEM; |
1922 |
++ } |
1923 |
++ |
1924 |
+ /* |
1925 |
+ * Allocate and register inbound messaging buffers to be ready |
1926 |
+ * to receive channel and system management requests |
1927 |
+@@ -2137,15 +2145,6 @@ static int riocm_add_mport(struct device *dev, |
1928 |
+ cm->rx_slots = RIOCM_RX_RING_SIZE; |
1929 |
+ mutex_init(&cm->rx_lock); |
1930 |
+ riocm_rx_fill(cm, RIOCM_RX_RING_SIZE); |
1931 |
+- cm->rx_wq = create_workqueue(DRV_NAME "/rxq"); |
1932 |
+- if (!cm->rx_wq) { |
1933 |
+- riocm_error("failed to allocate IBMBOX_%d on %s", |
1934 |
+- cmbox, mport->name); |
1935 |
+- rio_release_outb_mbox(mport, cmbox); |
1936 |
+- kfree(cm); |
1937 |
+- return -ENOMEM; |
1938 |
+- } |
1939 |
+- |
1940 |
+ INIT_WORK(&cm->rx_work, rio_ibmsg_handler); |
1941 |
+ |
1942 |
+ cm->tx_slot = 0; |
1943 |
+diff --git a/drivers/rtc/rtc-pcf85063.c b/drivers/rtc/rtc-pcf85063.c |
1944 |
+index f8b99cb729590..62684ca3a665e 100644 |
1945 |
+--- a/drivers/rtc/rtc-pcf85063.c |
1946 |
++++ b/drivers/rtc/rtc-pcf85063.c |
1947 |
+@@ -486,6 +486,7 @@ static struct clk *pcf85063_clkout_register_clk(struct pcf85063 *pcf85063) |
1948 |
+ { |
1949 |
+ struct clk *clk; |
1950 |
+ struct clk_init_data init; |
1951 |
++ struct device_node *node = pcf85063->rtc->dev.parent->of_node; |
1952 |
+ |
1953 |
+ init.name = "pcf85063-clkout"; |
1954 |
+ init.ops = &pcf85063_clkout_ops; |
1955 |
+@@ -495,15 +496,13 @@ static struct clk *pcf85063_clkout_register_clk(struct pcf85063 *pcf85063) |
1956 |
+ pcf85063->clkout_hw.init = &init; |
1957 |
+ |
1958 |
+ /* optional override of the clockname */ |
1959 |
+- of_property_read_string(pcf85063->rtc->dev.of_node, |
1960 |
+- "clock-output-names", &init.name); |
1961 |
++ of_property_read_string(node, "clock-output-names", &init.name); |
1962 |
+ |
1963 |
+ /* register the clock */ |
1964 |
+ clk = devm_clk_register(&pcf85063->rtc->dev, &pcf85063->clkout_hw); |
1965 |
+ |
1966 |
+ if (!IS_ERR(clk)) |
1967 |
+- of_clk_add_provider(pcf85063->rtc->dev.of_node, |
1968 |
+- of_clk_src_simple_get, clk); |
1969 |
++ of_clk_add_provider(node, of_clk_src_simple_get, clk); |
1970 |
+ |
1971 |
+ return clk; |
1972 |
+ } |
1973 |
+diff --git a/drivers/scsi/qedf/qedf_main.c b/drivers/scsi/qedf/qedf_main.c |
1974 |
+index 46d185cb9ea80..a464d0a4f4653 100644 |
1975 |
+--- a/drivers/scsi/qedf/qedf_main.c |
1976 |
++++ b/drivers/scsi/qedf/qedf_main.c |
1977 |
+@@ -536,7 +536,9 @@ static void qedf_update_link_speed(struct qedf_ctx *qedf, |
1978 |
+ if (linkmode_intersects(link->supported_caps, sup_caps)) |
1979 |
+ lport->link_supported_speeds |= FC_PORTSPEED_20GBIT; |
1980 |
+ |
1981 |
+- fc_host_supported_speeds(lport->host) = lport->link_supported_speeds; |
1982 |
++ if (lport->host && lport->host->shost_data) |
1983 |
++ fc_host_supported_speeds(lport->host) = |
1984 |
++ lport->link_supported_speeds; |
1985 |
+ } |
1986 |
+ |
1987 |
+ static void qedf_bw_update(void *dev) |
1988 |
+diff --git a/drivers/scsi/qla2xxx/qla_nx.c b/drivers/scsi/qla2xxx/qla_nx.c |
1989 |
+index b3ba0de5d4fb8..0563c9530dcad 100644 |
1990 |
+--- a/drivers/scsi/qla2xxx/qla_nx.c |
1991 |
++++ b/drivers/scsi/qla2xxx/qla_nx.c |
1992 |
+@@ -1066,7 +1066,8 @@ qla82xx_write_flash_dword(struct qla_hw_data *ha, uint32_t flashaddr, |
1993 |
+ return ret; |
1994 |
+ } |
1995 |
+ |
1996 |
+- if (qla82xx_flash_set_write_enable(ha)) |
1997 |
++ ret = qla82xx_flash_set_write_enable(ha); |
1998 |
++ if (ret < 0) |
1999 |
+ goto done_write; |
2000 |
+ |
2001 |
+ qla82xx_wr_32(ha, QLA82XX_ROMUSB_ROM_WDATA, data); |
2002 |
+diff --git a/drivers/scsi/ufs/ufs-hisi.c b/drivers/scsi/ufs/ufs-hisi.c |
2003 |
+index 074a6a055a4c0..55b7161d76977 100644 |
2004 |
+--- a/drivers/scsi/ufs/ufs-hisi.c |
2005 |
++++ b/drivers/scsi/ufs/ufs-hisi.c |
2006 |
+@@ -478,21 +478,24 @@ static int ufs_hisi_init_common(struct ufs_hba *hba) |
2007 |
+ host->hba = hba; |
2008 |
+ ufshcd_set_variant(hba, host); |
2009 |
+ |
2010 |
+- host->rst = devm_reset_control_get(dev, "rst"); |
2011 |
++ host->rst = devm_reset_control_get(dev, "rst"); |
2012 |
+ if (IS_ERR(host->rst)) { |
2013 |
+ dev_err(dev, "%s: failed to get reset control\n", __func__); |
2014 |
+- return PTR_ERR(host->rst); |
2015 |
++ err = PTR_ERR(host->rst); |
2016 |
++ goto error; |
2017 |
+ } |
2018 |
+ |
2019 |
+ ufs_hisi_set_pm_lvl(hba); |
2020 |
+ |
2021 |
+ err = ufs_hisi_get_resource(host); |
2022 |
+- if (err) { |
2023 |
+- ufshcd_set_variant(hba, NULL); |
2024 |
+- return err; |
2025 |
+- } |
2026 |
++ if (err) |
2027 |
++ goto error; |
2028 |
+ |
2029 |
+ return 0; |
2030 |
++ |
2031 |
++error: |
2032 |
++ ufshcd_set_variant(hba, NULL); |
2033 |
++ return err; |
2034 |
+ } |
2035 |
+ |
2036 |
+ static int ufs_hi3660_init(struct ufs_hba *hba) |
2037 |
+diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c |
2038 |
+index 08d4d40c510ea..854c96e630077 100644 |
2039 |
+--- a/drivers/scsi/ufs/ufshcd.c |
2040 |
++++ b/drivers/scsi/ufs/ufshcd.c |
2041 |
+@@ -2768,7 +2768,7 @@ static int ufshcd_wait_for_dev_cmd(struct ufs_hba *hba, |
2042 |
+ * ufshcd_exec_dev_cmd - API for sending device management requests |
2043 |
+ * @hba: UFS hba |
2044 |
+ * @cmd_type: specifies the type (NOP, Query...) |
2045 |
+- * @timeout: time in seconds |
2046 |
++ * @timeout: timeout in milliseconds |
2047 |
+ * |
2048 |
+ * NOTE: Since there is only one available tag for device management commands, |
2049 |
+ * it is expected you hold the hba->dev_cmd.lock mutex. |
2050 |
+@@ -2798,6 +2798,9 @@ static int ufshcd_exec_dev_cmd(struct ufs_hba *hba, |
2051 |
+ } |
2052 |
+ tag = req->tag; |
2053 |
+ WARN_ON_ONCE(!ufshcd_valid_tag(hba, tag)); |
2054 |
++ /* Set the timeout such that the SCSI error handler is not activated. */ |
2055 |
++ req->timeout = msecs_to_jiffies(2 * timeout); |
2056 |
++ blk_mq_start_request(req); |
2057 |
+ |
2058 |
+ init_completion(&wait); |
2059 |
+ lrbp = &hba->lrb[tag]; |
2060 |
+diff --git a/drivers/tee/amdtee/amdtee_private.h b/drivers/tee/amdtee/amdtee_private.h |
2061 |
+index 337c8d82f74eb..6d0f7062bb870 100644 |
2062 |
+--- a/drivers/tee/amdtee/amdtee_private.h |
2063 |
++++ b/drivers/tee/amdtee/amdtee_private.h |
2064 |
+@@ -21,6 +21,7 @@ |
2065 |
+ #define TEEC_SUCCESS 0x00000000 |
2066 |
+ #define TEEC_ERROR_GENERIC 0xFFFF0000 |
2067 |
+ #define TEEC_ERROR_BAD_PARAMETERS 0xFFFF0006 |
2068 |
++#define TEEC_ERROR_OUT_OF_MEMORY 0xFFFF000C |
2069 |
+ #define TEEC_ERROR_COMMUNICATION 0xFFFF000E |
2070 |
+ |
2071 |
+ #define TEEC_ORIGIN_COMMS 0x00000002 |
2072 |
+@@ -93,6 +94,18 @@ struct amdtee_shm_data { |
2073 |
+ u32 buf_id; |
2074 |
+ }; |
2075 |
+ |
2076 |
++/** |
2077 |
++ * struct amdtee_ta_data - Keeps track of all TAs loaded in AMD Secure |
2078 |
++ * Processor |
2079 |
++ * @ta_handle: Handle to TA loaded in TEE |
2080 |
++ * @refcount: Reference count for the loaded TA |
2081 |
++ */ |
2082 |
++struct amdtee_ta_data { |
2083 |
++ struct list_head list_node; |
2084 |
++ u32 ta_handle; |
2085 |
++ u32 refcount; |
2086 |
++}; |
2087 |
++ |
2088 |
+ #define LOWER_TWO_BYTE_MASK 0x0000FFFF |
2089 |
+ |
2090 |
+ /** |
2091 |
+diff --git a/drivers/tee/amdtee/call.c b/drivers/tee/amdtee/call.c |
2092 |
+index 096dd4d92d39c..07f36ac834c88 100644 |
2093 |
+--- a/drivers/tee/amdtee/call.c |
2094 |
++++ b/drivers/tee/amdtee/call.c |
2095 |
+@@ -121,15 +121,69 @@ static int amd_params_to_tee_params(struct tee_param *tee, u32 count, |
2096 |
+ return ret; |
2097 |
+ } |
2098 |
+ |
2099 |
++static DEFINE_MUTEX(ta_refcount_mutex); |
2100 |
++static struct list_head ta_list = LIST_HEAD_INIT(ta_list); |
2101 |
++ |
2102 |
++static u32 get_ta_refcount(u32 ta_handle) |
2103 |
++{ |
2104 |
++ struct amdtee_ta_data *ta_data; |
2105 |
++ u32 count = 0; |
2106 |
++ |
2107 |
++ /* Caller must hold a mutex */ |
2108 |
++ list_for_each_entry(ta_data, &ta_list, list_node) |
2109 |
++ if (ta_data->ta_handle == ta_handle) |
2110 |
++ return ++ta_data->refcount; |
2111 |
++ |
2112 |
++ ta_data = kzalloc(sizeof(*ta_data), GFP_KERNEL); |
2113 |
++ if (ta_data) { |
2114 |
++ ta_data->ta_handle = ta_handle; |
2115 |
++ ta_data->refcount = 1; |
2116 |
++ count = ta_data->refcount; |
2117 |
++ list_add(&ta_data->list_node, &ta_list); |
2118 |
++ } |
2119 |
++ |
2120 |
++ return count; |
2121 |
++} |
2122 |
++ |
2123 |
++static u32 put_ta_refcount(u32 ta_handle) |
2124 |
++{ |
2125 |
++ struct amdtee_ta_data *ta_data; |
2126 |
++ u32 count = 0; |
2127 |
++ |
2128 |
++ /* Caller must hold a mutex */ |
2129 |
++ list_for_each_entry(ta_data, &ta_list, list_node) |
2130 |
++ if (ta_data->ta_handle == ta_handle) { |
2131 |
++ count = --ta_data->refcount; |
2132 |
++ if (count == 0) { |
2133 |
++ list_del(&ta_data->list_node); |
2134 |
++ kfree(ta_data); |
2135 |
++ break; |
2136 |
++ } |
2137 |
++ } |
2138 |
++ |
2139 |
++ return count; |
2140 |
++} |
2141 |
++ |
2142 |
+ int handle_unload_ta(u32 ta_handle) |
2143 |
+ { |
2144 |
+ struct tee_cmd_unload_ta cmd = {0}; |
2145 |
+- u32 status; |
2146 |
++ u32 status, count; |
2147 |
+ int ret; |
2148 |
+ |
2149 |
+ if (!ta_handle) |
2150 |
+ return -EINVAL; |
2151 |
+ |
2152 |
++ mutex_lock(&ta_refcount_mutex); |
2153 |
++ |
2154 |
++ count = put_ta_refcount(ta_handle); |
2155 |
++ |
2156 |
++ if (count) { |
2157 |
++ pr_debug("unload ta: not unloading %u count %u\n", |
2158 |
++ ta_handle, count); |
2159 |
++ ret = -EBUSY; |
2160 |
++ goto unlock; |
2161 |
++ } |
2162 |
++ |
2163 |
+ cmd.ta_handle = ta_handle; |
2164 |
+ |
2165 |
+ ret = psp_tee_process_cmd(TEE_CMD_ID_UNLOAD_TA, (void *)&cmd, |
2166 |
+@@ -137,8 +191,12 @@ int handle_unload_ta(u32 ta_handle) |
2167 |
+ if (!ret && status != 0) { |
2168 |
+ pr_err("unload ta: status = 0x%x\n", status); |
2169 |
+ ret = -EBUSY; |
2170 |
++ } else { |
2171 |
++ pr_debug("unloaded ta handle %u\n", ta_handle); |
2172 |
+ } |
2173 |
+ |
2174 |
++unlock: |
2175 |
++ mutex_unlock(&ta_refcount_mutex); |
2176 |
+ return ret; |
2177 |
+ } |
2178 |
+ |
2179 |
+@@ -340,7 +398,8 @@ int handle_open_session(struct tee_ioctl_open_session_arg *arg, u32 *info, |
2180 |
+ |
2181 |
+ int handle_load_ta(void *data, u32 size, struct tee_ioctl_open_session_arg *arg) |
2182 |
+ { |
2183 |
+- struct tee_cmd_load_ta cmd = {0}; |
2184 |
++ struct tee_cmd_unload_ta unload_cmd = {}; |
2185 |
++ struct tee_cmd_load_ta load_cmd = {}; |
2186 |
+ phys_addr_t blob; |
2187 |
+ int ret; |
2188 |
+ |
2189 |
+@@ -353,21 +412,36 @@ int handle_load_ta(void *data, u32 size, struct tee_ioctl_open_session_arg *arg) |
2190 |
+ return -EINVAL; |
2191 |
+ } |
2192 |
+ |
2193 |
+- cmd.hi_addr = upper_32_bits(blob); |
2194 |
+- cmd.low_addr = lower_32_bits(blob); |
2195 |
+- cmd.size = size; |
2196 |
++ load_cmd.hi_addr = upper_32_bits(blob); |
2197 |
++ load_cmd.low_addr = lower_32_bits(blob); |
2198 |
++ load_cmd.size = size; |
2199 |
+ |
2200 |
+- ret = psp_tee_process_cmd(TEE_CMD_ID_LOAD_TA, (void *)&cmd, |
2201 |
+- sizeof(cmd), &arg->ret); |
2202 |
++ mutex_lock(&ta_refcount_mutex); |
2203 |
++ |
2204 |
++ ret = psp_tee_process_cmd(TEE_CMD_ID_LOAD_TA, (void *)&load_cmd, |
2205 |
++ sizeof(load_cmd), &arg->ret); |
2206 |
+ if (ret) { |
2207 |
+ arg->ret_origin = TEEC_ORIGIN_COMMS; |
2208 |
+ arg->ret = TEEC_ERROR_COMMUNICATION; |
2209 |
+- } else { |
2210 |
+- set_session_id(cmd.ta_handle, 0, &arg->session); |
2211 |
++ } else if (arg->ret == TEEC_SUCCESS) { |
2212 |
++ ret = get_ta_refcount(load_cmd.ta_handle); |
2213 |
++ if (!ret) { |
2214 |
++ arg->ret_origin = TEEC_ORIGIN_COMMS; |
2215 |
++ arg->ret = TEEC_ERROR_OUT_OF_MEMORY; |
2216 |
++ |
2217 |
++ /* Unload the TA on error */ |
2218 |
++ unload_cmd.ta_handle = load_cmd.ta_handle; |
2219 |
++ psp_tee_process_cmd(TEE_CMD_ID_UNLOAD_TA, |
2220 |
++ (void *)&unload_cmd, |
2221 |
++ sizeof(unload_cmd), &ret); |
2222 |
++ } else { |
2223 |
++ set_session_id(load_cmd.ta_handle, 0, &arg->session); |
2224 |
++ } |
2225 |
+ } |
2226 |
++ mutex_unlock(&ta_refcount_mutex); |
2227 |
+ |
2228 |
+ pr_debug("load TA: TA handle = 0x%x, RO = 0x%x, ret = 0x%x\n", |
2229 |
+- cmd.ta_handle, arg->ret_origin, arg->ret); |
2230 |
++ load_cmd.ta_handle, arg->ret_origin, arg->ret); |
2231 |
+ |
2232 |
+ return 0; |
2233 |
+ } |
2234 |
+diff --git a/drivers/tee/amdtee/core.c b/drivers/tee/amdtee/core.c |
2235 |
+index 8a6a8f30bb427..da6b88e80dc07 100644 |
2236 |
+--- a/drivers/tee/amdtee/core.c |
2237 |
++++ b/drivers/tee/amdtee/core.c |
2238 |
+@@ -59,10 +59,9 @@ static void release_session(struct amdtee_session *sess) |
2239 |
+ continue; |
2240 |
+ |
2241 |
+ handle_close_session(sess->ta_handle, sess->session_info[i]); |
2242 |
++ handle_unload_ta(sess->ta_handle); |
2243 |
+ } |
2244 |
+ |
2245 |
+- /* Unload Trusted Application once all sessions are closed */ |
2246 |
+- handle_unload_ta(sess->ta_handle); |
2247 |
+ kfree(sess); |
2248 |
+ } |
2249 |
+ |
2250 |
+@@ -224,8 +223,6 @@ static void destroy_session(struct kref *ref) |
2251 |
+ struct amdtee_session *sess = container_of(ref, struct amdtee_session, |
2252 |
+ refcount); |
2253 |
+ |
2254 |
+- /* Unload the TA from TEE */ |
2255 |
+- handle_unload_ta(sess->ta_handle); |
2256 |
+ mutex_lock(&session_list_mutex); |
2257 |
+ list_del(&sess->list_node); |
2258 |
+ mutex_unlock(&session_list_mutex); |
2259 |
+@@ -238,7 +235,7 @@ int amdtee_open_session(struct tee_context *ctx, |
2260 |
+ { |
2261 |
+ struct amdtee_context_data *ctxdata = ctx->data; |
2262 |
+ struct amdtee_session *sess = NULL; |
2263 |
+- u32 session_info; |
2264 |
++ u32 session_info, ta_handle; |
2265 |
+ size_t ta_size; |
2266 |
+ int rc, i; |
2267 |
+ void *ta; |
2268 |
+@@ -259,11 +256,14 @@ int amdtee_open_session(struct tee_context *ctx, |
2269 |
+ if (arg->ret != TEEC_SUCCESS) |
2270 |
+ goto out; |
2271 |
+ |
2272 |
++ ta_handle = get_ta_handle(arg->session); |
2273 |
++ |
2274 |
+ mutex_lock(&session_list_mutex); |
2275 |
+ sess = alloc_session(ctxdata, arg->session); |
2276 |
+ mutex_unlock(&session_list_mutex); |
2277 |
+ |
2278 |
+ if (!sess) { |
2279 |
++ handle_unload_ta(ta_handle); |
2280 |
+ rc = -ENOMEM; |
2281 |
+ goto out; |
2282 |
+ } |
2283 |
+@@ -277,6 +277,7 @@ int amdtee_open_session(struct tee_context *ctx, |
2284 |
+ |
2285 |
+ if (i >= TEE_NUM_SESSIONS) { |
2286 |
+ pr_err("reached maximum session count %d\n", TEE_NUM_SESSIONS); |
2287 |
++ handle_unload_ta(ta_handle); |
2288 |
+ kref_put(&sess->refcount, destroy_session); |
2289 |
+ rc = -ENOMEM; |
2290 |
+ goto out; |
2291 |
+@@ -289,12 +290,13 @@ int amdtee_open_session(struct tee_context *ctx, |
2292 |
+ spin_lock(&sess->lock); |
2293 |
+ clear_bit(i, sess->sess_mask); |
2294 |
+ spin_unlock(&sess->lock); |
2295 |
++ handle_unload_ta(ta_handle); |
2296 |
+ kref_put(&sess->refcount, destroy_session); |
2297 |
+ goto out; |
2298 |
+ } |
2299 |
+ |
2300 |
+ sess->session_info[i] = session_info; |
2301 |
+- set_session_id(sess->ta_handle, i, &arg->session); |
2302 |
++ set_session_id(ta_handle, i, &arg->session); |
2303 |
+ out: |
2304 |
+ free_pages((u64)ta, get_order(ta_size)); |
2305 |
+ return rc; |
2306 |
+@@ -329,6 +331,7 @@ int amdtee_close_session(struct tee_context *ctx, u32 session) |
2307 |
+ |
2308 |
+ /* Close the session */ |
2309 |
+ handle_close_session(ta_handle, session_info); |
2310 |
++ handle_unload_ta(ta_handle); |
2311 |
+ |
2312 |
+ kref_put(&sess->refcount, destroy_session); |
2313 |
+ |
2314 |
+diff --git a/drivers/tty/serial/mvebu-uart.c b/drivers/tty/serial/mvebu-uart.c |
2315 |
+index e0c00a1b07639..51b0ecabf2ec9 100644 |
2316 |
+--- a/drivers/tty/serial/mvebu-uart.c |
2317 |
++++ b/drivers/tty/serial/mvebu-uart.c |
2318 |
+@@ -818,9 +818,6 @@ static int mvebu_uart_probe(struct platform_device *pdev) |
2319 |
+ return -EINVAL; |
2320 |
+ } |
2321 |
+ |
2322 |
+- if (!match) |
2323 |
+- return -ENODEV; |
2324 |
+- |
2325 |
+ /* Assume that all UART ports have a DT alias or none has */ |
2326 |
+ id = of_alias_get_id(pdev->dev.of_node, "serial"); |
2327 |
+ if (!pdev->dev.of_node || id < 0) |
2328 |
+diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c |
2329 |
+index 8f88ee2a2c8d0..06757b1d4aecd 100644 |
2330 |
+--- a/drivers/tty/vt/vt.c |
2331 |
++++ b/drivers/tty/vt/vt.c |
2332 |
+@@ -1172,7 +1172,7 @@ static inline int resize_screen(struct vc_data *vc, int width, int height, |
2333 |
+ /* Resizes the resolution of the display adapater */ |
2334 |
+ int err = 0; |
2335 |
+ |
2336 |
+- if (vc->vc_mode != KD_GRAPHICS && vc->vc_sw->con_resize) |
2337 |
++ if (vc->vc_sw->con_resize) |
2338 |
+ err = vc->vc_sw->con_resize(vc, width, height, user); |
2339 |
+ |
2340 |
+ return err; |
2341 |
+diff --git a/drivers/tty/vt/vt_ioctl.c b/drivers/tty/vt/vt_ioctl.c |
2342 |
+index 5f61b25a9aaa8..09b8d02acd996 100644 |
2343 |
+--- a/drivers/tty/vt/vt_ioctl.c |
2344 |
++++ b/drivers/tty/vt/vt_ioctl.c |
2345 |
+@@ -771,21 +771,58 @@ static int vt_resizex(struct vc_data *vc, struct vt_consize __user *cs) |
2346 |
+ if (copy_from_user(&v, cs, sizeof(struct vt_consize))) |
2347 |
+ return -EFAULT; |
2348 |
+ |
2349 |
+- if (v.v_vlin) |
2350 |
+- pr_info_once("\"struct vt_consize\"->v_vlin is ignored. Please report if you need this.\n"); |
2351 |
+- if (v.v_clin) |
2352 |
+- pr_info_once("\"struct vt_consize\"->v_clin is ignored. Please report if you need this.\n"); |
2353 |
++ /* FIXME: Should check the copies properly */ |
2354 |
++ if (!v.v_vlin) |
2355 |
++ v.v_vlin = vc->vc_scan_lines; |
2356 |
++ |
2357 |
++ if (v.v_clin) { |
2358 |
++ int rows = v.v_vlin / v.v_clin; |
2359 |
++ if (v.v_rows != rows) { |
2360 |
++ if (v.v_rows) /* Parameters don't add up */ |
2361 |
++ return -EINVAL; |
2362 |
++ v.v_rows = rows; |
2363 |
++ } |
2364 |
++ } |
2365 |
++ |
2366 |
++ if (v.v_vcol && v.v_ccol) { |
2367 |
++ int cols = v.v_vcol / v.v_ccol; |
2368 |
++ if (v.v_cols != cols) { |
2369 |
++ if (v.v_cols) |
2370 |
++ return -EINVAL; |
2371 |
++ v.v_cols = cols; |
2372 |
++ } |
2373 |
++ } |
2374 |
++ |
2375 |
++ if (v.v_clin > 32) |
2376 |
++ return -EINVAL; |
2377 |
+ |
2378 |
+- console_lock(); |
2379 |
+ for (i = 0; i < MAX_NR_CONSOLES; i++) { |
2380 |
+- vc = vc_cons[i].d; |
2381 |
++ struct vc_data *vcp; |
2382 |
+ |
2383 |
+- if (vc) { |
2384 |
+- vc->vc_resize_user = 1; |
2385 |
+- vc_resize(vc, v.v_cols, v.v_rows); |
2386 |
++ if (!vc_cons[i].d) |
2387 |
++ continue; |
2388 |
++ console_lock(); |
2389 |
++ vcp = vc_cons[i].d; |
2390 |
++ if (vcp) { |
2391 |
++ int ret; |
2392 |
++ int save_scan_lines = vcp->vc_scan_lines; |
2393 |
++ int save_cell_height = vcp->vc_cell_height; |
2394 |
++ |
2395 |
++ if (v.v_vlin) |
2396 |
++ vcp->vc_scan_lines = v.v_vlin; |
2397 |
++ if (v.v_clin) |
2398 |
++ vcp->vc_cell_height = v.v_clin; |
2399 |
++ vcp->vc_resize_user = 1; |
2400 |
++ ret = vc_resize(vcp, v.v_cols, v.v_rows); |
2401 |
++ if (ret) { |
2402 |
++ vcp->vc_scan_lines = save_scan_lines; |
2403 |
++ vcp->vc_cell_height = save_cell_height; |
2404 |
++ console_unlock(); |
2405 |
++ return ret; |
2406 |
++ } |
2407 |
+ } |
2408 |
++ console_unlock(); |
2409 |
+ } |
2410 |
+- console_unlock(); |
2411 |
+ |
2412 |
+ return 0; |
2413 |
+ } |
2414 |
+diff --git a/drivers/uio/uio_hv_generic.c b/drivers/uio/uio_hv_generic.c |
2415 |
+index 4dae2320b103e..c31febe90d4ea 100644 |
2416 |
+--- a/drivers/uio/uio_hv_generic.c |
2417 |
++++ b/drivers/uio/uio_hv_generic.c |
2418 |
+@@ -296,8 +296,10 @@ hv_uio_probe(struct hv_device *dev, |
2419 |
+ |
2420 |
+ ret = vmbus_establish_gpadl(channel, pdata->recv_buf, |
2421 |
+ RECV_BUFFER_SIZE, &pdata->recv_gpadl); |
2422 |
+- if (ret) |
2423 |
++ if (ret) { |
2424 |
++ vfree(pdata->recv_buf); |
2425 |
+ goto fail_close; |
2426 |
++ } |
2427 |
+ |
2428 |
+ /* put Global Physical Address Label in name */ |
2429 |
+ snprintf(pdata->recv_name, sizeof(pdata->recv_name), |
2430 |
+@@ -316,8 +318,10 @@ hv_uio_probe(struct hv_device *dev, |
2431 |
+ |
2432 |
+ ret = vmbus_establish_gpadl(channel, pdata->send_buf, |
2433 |
+ SEND_BUFFER_SIZE, &pdata->send_gpadl); |
2434 |
+- if (ret) |
2435 |
++ if (ret) { |
2436 |
++ vfree(pdata->send_buf); |
2437 |
+ goto fail_close; |
2438 |
++ } |
2439 |
+ |
2440 |
+ snprintf(pdata->send_name, sizeof(pdata->send_name), |
2441 |
+ "send:%u", pdata->send_gpadl); |
2442 |
+diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c |
2443 |
+index 17876f0179b57..5dc88a914b349 100644 |
2444 |
+--- a/drivers/video/console/vgacon.c |
2445 |
++++ b/drivers/video/console/vgacon.c |
2446 |
+@@ -384,7 +384,7 @@ static void vgacon_init(struct vc_data *c, int init) |
2447 |
+ vc_resize(c, vga_video_num_columns, vga_video_num_lines); |
2448 |
+ |
2449 |
+ c->vc_scan_lines = vga_scan_lines; |
2450 |
+- c->vc_font.height = vga_video_font_height; |
2451 |
++ c->vc_font.height = c->vc_cell_height = vga_video_font_height; |
2452 |
+ c->vc_complement_mask = 0x7700; |
2453 |
+ if (vga_512_chars) |
2454 |
+ c->vc_hi_font_mask = 0x0800; |
2455 |
+@@ -519,32 +519,32 @@ static void vgacon_cursor(struct vc_data *c, int mode) |
2456 |
+ switch (CUR_SIZE(c->vc_cursor_type)) { |
2457 |
+ case CUR_UNDERLINE: |
2458 |
+ vgacon_set_cursor_size(c->state.x, |
2459 |
+- c->vc_font.height - |
2460 |
+- (c->vc_font.height < |
2461 |
++ c->vc_cell_height - |
2462 |
++ (c->vc_cell_height < |
2463 |
+ 10 ? 2 : 3), |
2464 |
+- c->vc_font.height - |
2465 |
+- (c->vc_font.height < |
2466 |
++ c->vc_cell_height - |
2467 |
++ (c->vc_cell_height < |
2468 |
+ 10 ? 1 : 2)); |
2469 |
+ break; |
2470 |
+ case CUR_TWO_THIRDS: |
2471 |
+ vgacon_set_cursor_size(c->state.x, |
2472 |
+- c->vc_font.height / 3, |
2473 |
+- c->vc_font.height - |
2474 |
+- (c->vc_font.height < |
2475 |
++ c->vc_cell_height / 3, |
2476 |
++ c->vc_cell_height - |
2477 |
++ (c->vc_cell_height < |
2478 |
+ 10 ? 1 : 2)); |
2479 |
+ break; |
2480 |
+ case CUR_LOWER_THIRD: |
2481 |
+ vgacon_set_cursor_size(c->state.x, |
2482 |
+- (c->vc_font.height * 2) / 3, |
2483 |
+- c->vc_font.height - |
2484 |
+- (c->vc_font.height < |
2485 |
++ (c->vc_cell_height * 2) / 3, |
2486 |
++ c->vc_cell_height - |
2487 |
++ (c->vc_cell_height < |
2488 |
+ 10 ? 1 : 2)); |
2489 |
+ break; |
2490 |
+ case CUR_LOWER_HALF: |
2491 |
+ vgacon_set_cursor_size(c->state.x, |
2492 |
+- c->vc_font.height / 2, |
2493 |
+- c->vc_font.height - |
2494 |
+- (c->vc_font.height < |
2495 |
++ c->vc_cell_height / 2, |
2496 |
++ c->vc_cell_height - |
2497 |
++ (c->vc_cell_height < |
2498 |
+ 10 ? 1 : 2)); |
2499 |
+ break; |
2500 |
+ case CUR_NONE: |
2501 |
+@@ -555,7 +555,7 @@ static void vgacon_cursor(struct vc_data *c, int mode) |
2502 |
+ break; |
2503 |
+ default: |
2504 |
+ vgacon_set_cursor_size(c->state.x, 1, |
2505 |
+- c->vc_font.height); |
2506 |
++ c->vc_cell_height); |
2507 |
+ break; |
2508 |
+ } |
2509 |
+ break; |
2510 |
+@@ -566,13 +566,13 @@ static int vgacon_doresize(struct vc_data *c, |
2511 |
+ unsigned int width, unsigned int height) |
2512 |
+ { |
2513 |
+ unsigned long flags; |
2514 |
+- unsigned int scanlines = height * c->vc_font.height; |
2515 |
++ unsigned int scanlines = height * c->vc_cell_height; |
2516 |
+ u8 scanlines_lo = 0, r7 = 0, vsync_end = 0, mode, max_scan; |
2517 |
+ |
2518 |
+ raw_spin_lock_irqsave(&vga_lock, flags); |
2519 |
+ |
2520 |
+ vgacon_xres = width * VGA_FONTWIDTH; |
2521 |
+- vgacon_yres = height * c->vc_font.height; |
2522 |
++ vgacon_yres = height * c->vc_cell_height; |
2523 |
+ if (vga_video_type >= VIDEO_TYPE_VGAC) { |
2524 |
+ outb_p(VGA_CRTC_MAX_SCAN, vga_video_port_reg); |
2525 |
+ max_scan = inb_p(vga_video_port_val); |
2526 |
+@@ -627,9 +627,9 @@ static int vgacon_doresize(struct vc_data *c, |
2527 |
+ static int vgacon_switch(struct vc_data *c) |
2528 |
+ { |
2529 |
+ int x = c->vc_cols * VGA_FONTWIDTH; |
2530 |
+- int y = c->vc_rows * c->vc_font.height; |
2531 |
++ int y = c->vc_rows * c->vc_cell_height; |
2532 |
+ int rows = screen_info.orig_video_lines * vga_default_font_height/ |
2533 |
+- c->vc_font.height; |
2534 |
++ c->vc_cell_height; |
2535 |
+ /* |
2536 |
+ * We need to save screen size here as it's the only way |
2537 |
+ * we can spot the screen has been resized and we need to |
2538 |
+@@ -1060,7 +1060,7 @@ static int vgacon_adjust_height(struct vc_data *vc, unsigned fontheight) |
2539 |
+ cursor_size_lastto = 0; |
2540 |
+ c->vc_sw->con_cursor(c, CM_DRAW); |
2541 |
+ } |
2542 |
+- c->vc_font.height = fontheight; |
2543 |
++ c->vc_font.height = c->vc_cell_height = fontheight; |
2544 |
+ vc_resize(c, 0, rows); /* Adjust console size */ |
2545 |
+ } |
2546 |
+ } |
2547 |
+@@ -1108,12 +1108,20 @@ static int vgacon_resize(struct vc_data *c, unsigned int width, |
2548 |
+ if ((width << 1) * height > vga_vram_size) |
2549 |
+ return -EINVAL; |
2550 |
+ |
2551 |
++ if (user) { |
2552 |
++ /* |
2553 |
++ * Ho ho! Someone (svgatextmode, eh?) may have reprogrammed |
2554 |
++ * the video mode! Set the new defaults then and go away. |
2555 |
++ */ |
2556 |
++ screen_info.orig_video_cols = width; |
2557 |
++ screen_info.orig_video_lines = height; |
2558 |
++ vga_default_font_height = c->vc_cell_height; |
2559 |
++ return 0; |
2560 |
++ } |
2561 |
+ if (width % 2 || width > screen_info.orig_video_cols || |
2562 |
+ height > (screen_info.orig_video_lines * vga_default_font_height)/ |
2563 |
+- c->vc_font.height) |
2564 |
+- /* let svgatextmode tinker with video timings and |
2565 |
+- return success */ |
2566 |
+- return (user) ? 0 : -EINVAL; |
2567 |
++ c->vc_cell_height) |
2568 |
++ return -EINVAL; |
2569 |
+ |
2570 |
+ if (con_is_visible(c) && !vga_is_gfx) /* who knows */ |
2571 |
+ vgacon_doresize(c, width, height); |
2572 |
+diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c |
2573 |
+index 26581194fdf81..42c72d051158f 100644 |
2574 |
+--- a/drivers/video/fbdev/core/fbcon.c |
2575 |
++++ b/drivers/video/fbdev/core/fbcon.c |
2576 |
+@@ -2031,7 +2031,7 @@ static int fbcon_resize(struct vc_data *vc, unsigned int width, |
2577 |
+ return -EINVAL; |
2578 |
+ |
2579 |
+ DPRINTK("resize now %ix%i\n", var.xres, var.yres); |
2580 |
+- if (con_is_visible(vc)) { |
2581 |
++ if (con_is_visible(vc) && vc->vc_mode == KD_TEXT) { |
2582 |
+ var.activate = FB_ACTIVATE_NOW | |
2583 |
+ FB_ACTIVATE_FORCE; |
2584 |
+ fb_set_var(info, &var); |
2585 |
+diff --git a/drivers/video/fbdev/hgafb.c b/drivers/video/fbdev/hgafb.c |
2586 |
+index a45fcff1461fb..0fe32737ba084 100644 |
2587 |
+--- a/drivers/video/fbdev/hgafb.c |
2588 |
++++ b/drivers/video/fbdev/hgafb.c |
2589 |
+@@ -286,7 +286,7 @@ static int hga_card_detect(void) |
2590 |
+ |
2591 |
+ hga_vram = ioremap(0xb0000, hga_vram_len); |
2592 |
+ if (!hga_vram) |
2593 |
+- goto error; |
2594 |
++ return -ENOMEM; |
2595 |
+ |
2596 |
+ if (request_region(0x3b0, 12, "hgafb")) |
2597 |
+ release_io_ports = 1; |
2598 |
+@@ -346,13 +346,18 @@ static int hga_card_detect(void) |
2599 |
+ hga_type_name = "Hercules"; |
2600 |
+ break; |
2601 |
+ } |
2602 |
+- return 1; |
2603 |
++ return 0; |
2604 |
+ error: |
2605 |
+ if (release_io_ports) |
2606 |
+ release_region(0x3b0, 12); |
2607 |
+ if (release_io_port) |
2608 |
+ release_region(0x3bf, 1); |
2609 |
+- return 0; |
2610 |
++ |
2611 |
++ iounmap(hga_vram); |
2612 |
++ |
2613 |
++ pr_err("hgafb: HGA card not detected.\n"); |
2614 |
++ |
2615 |
++ return -EINVAL; |
2616 |
+ } |
2617 |
+ |
2618 |
+ /** |
2619 |
+@@ -550,13 +555,11 @@ static const struct fb_ops hgafb_ops = { |
2620 |
+ static int hgafb_probe(struct platform_device *pdev) |
2621 |
+ { |
2622 |
+ struct fb_info *info; |
2623 |
++ int ret; |
2624 |
+ |
2625 |
+- if (! hga_card_detect()) { |
2626 |
+- printk(KERN_INFO "hgafb: HGA card not detected.\n"); |
2627 |
+- if (hga_vram) |
2628 |
+- iounmap(hga_vram); |
2629 |
+- return -EINVAL; |
2630 |
+- } |
2631 |
++ ret = hga_card_detect(); |
2632 |
++ if (ret) |
2633 |
++ return ret; |
2634 |
+ |
2635 |
+ printk(KERN_INFO "hgafb: %s with %ldK of memory detected.\n", |
2636 |
+ hga_type_name, hga_vram_len/1024); |
2637 |
+diff --git a/drivers/video/fbdev/imsttfb.c b/drivers/video/fbdev/imsttfb.c |
2638 |
+index 3ac053b884958..e04411701ec85 100644 |
2639 |
+--- a/drivers/video/fbdev/imsttfb.c |
2640 |
++++ b/drivers/video/fbdev/imsttfb.c |
2641 |
+@@ -1512,11 +1512,6 @@ static int imsttfb_probe(struct pci_dev *pdev, const struct pci_device_id *ent) |
2642 |
+ info->fix.smem_start = addr; |
2643 |
+ info->screen_base = (__u8 *)ioremap(addr, par->ramdac == IBM ? |
2644 |
+ 0x400000 : 0x800000); |
2645 |
+- if (!info->screen_base) { |
2646 |
+- release_mem_region(addr, size); |
2647 |
+- framebuffer_release(info); |
2648 |
+- return -ENOMEM; |
2649 |
+- } |
2650 |
+ info->fix.mmio_start = addr + 0x800000; |
2651 |
+ par->dc_regs = ioremap(addr + 0x800000, 0x1000); |
2652 |
+ par->cmap_regs_phys = addr + 0x840000; |
2653 |
+diff --git a/drivers/xen/xen-pciback/vpci.c b/drivers/xen/xen-pciback/vpci.c |
2654 |
+index 5447b5ab7c766..1221cfd914cb0 100644 |
2655 |
+--- a/drivers/xen/xen-pciback/vpci.c |
2656 |
++++ b/drivers/xen/xen-pciback/vpci.c |
2657 |
+@@ -70,7 +70,7 @@ static int __xen_pcibk_add_pci_dev(struct xen_pcibk_device *pdev, |
2658 |
+ struct pci_dev *dev, int devid, |
2659 |
+ publish_pci_dev_cb publish_cb) |
2660 |
+ { |
2661 |
+- int err = 0, slot, func = -1; |
2662 |
++ int err = 0, slot, func = PCI_FUNC(dev->devfn); |
2663 |
+ struct pci_dev_entry *t, *dev_entry; |
2664 |
+ struct vpci_dev_data *vpci_dev = pdev->pci_dev_data; |
2665 |
+ |
2666 |
+@@ -95,22 +95,25 @@ static int __xen_pcibk_add_pci_dev(struct xen_pcibk_device *pdev, |
2667 |
+ |
2668 |
+ /* |
2669 |
+ * Keep multi-function devices together on the virtual PCI bus, except |
2670 |
+- * virtual functions. |
2671 |
++ * that we want to keep virtual functions at func 0 on their own. They |
2672 |
++ * aren't multi-function devices and hence their presence at func 0 |
2673 |
++ * may cause guests to not scan the other functions. |
2674 |
+ */ |
2675 |
+- if (!dev->is_virtfn) { |
2676 |
++ if (!dev->is_virtfn || func) { |
2677 |
+ for (slot = 0; slot < PCI_SLOT_MAX; slot++) { |
2678 |
+ if (list_empty(&vpci_dev->dev_list[slot])) |
2679 |
+ continue; |
2680 |
+ |
2681 |
+ t = list_entry(list_first(&vpci_dev->dev_list[slot]), |
2682 |
+ struct pci_dev_entry, list); |
2683 |
++ if (t->dev->is_virtfn && !PCI_FUNC(t->dev->devfn)) |
2684 |
++ continue; |
2685 |
+ |
2686 |
+ if (match_slot(dev, t->dev)) { |
2687 |
+ dev_info(&dev->dev, "vpci: assign to virtual slot %d func %d\n", |
2688 |
+- slot, PCI_FUNC(dev->devfn)); |
2689 |
++ slot, func); |
2690 |
+ list_add_tail(&dev_entry->list, |
2691 |
+ &vpci_dev->dev_list[slot]); |
2692 |
+- func = PCI_FUNC(dev->devfn); |
2693 |
+ goto unlock; |
2694 |
+ } |
2695 |
+ } |
2696 |
+@@ -123,7 +126,6 @@ static int __xen_pcibk_add_pci_dev(struct xen_pcibk_device *pdev, |
2697 |
+ slot); |
2698 |
+ list_add_tail(&dev_entry->list, |
2699 |
+ &vpci_dev->dev_list[slot]); |
2700 |
+- func = dev->is_virtfn ? 0 : PCI_FUNC(dev->devfn); |
2701 |
+ goto unlock; |
2702 |
+ } |
2703 |
+ } |
2704 |
+diff --git a/drivers/xen/xen-pciback/xenbus.c b/drivers/xen/xen-pciback/xenbus.c |
2705 |
+index e7c692cfb2cf8..cad56ea61376d 100644 |
2706 |
+--- a/drivers/xen/xen-pciback/xenbus.c |
2707 |
++++ b/drivers/xen/xen-pciback/xenbus.c |
2708 |
+@@ -359,7 +359,8 @@ out: |
2709 |
+ return err; |
2710 |
+ } |
2711 |
+ |
2712 |
+-static int xen_pcibk_reconfigure(struct xen_pcibk_device *pdev) |
2713 |
++static int xen_pcibk_reconfigure(struct xen_pcibk_device *pdev, |
2714 |
++ enum xenbus_state state) |
2715 |
+ { |
2716 |
+ int err = 0; |
2717 |
+ int num_devs; |
2718 |
+@@ -373,9 +374,7 @@ static int xen_pcibk_reconfigure(struct xen_pcibk_device *pdev) |
2719 |
+ dev_dbg(&pdev->xdev->dev, "Reconfiguring device ...\n"); |
2720 |
+ |
2721 |
+ mutex_lock(&pdev->dev_lock); |
2722 |
+- /* Make sure we only reconfigure once */ |
2723 |
+- if (xenbus_read_driver_state(pdev->xdev->nodename) != |
2724 |
+- XenbusStateReconfiguring) |
2725 |
++ if (xenbus_read_driver_state(pdev->xdev->nodename) != state) |
2726 |
+ goto out; |
2727 |
+ |
2728 |
+ err = xenbus_scanf(XBT_NIL, pdev->xdev->nodename, "num_devs", "%d", |
2729 |
+@@ -500,6 +499,10 @@ static int xen_pcibk_reconfigure(struct xen_pcibk_device *pdev) |
2730 |
+ } |
2731 |
+ } |
2732 |
+ |
2733 |
++ if (state != XenbusStateReconfiguring) |
2734 |
++ /* Make sure we only reconfigure once. */ |
2735 |
++ goto out; |
2736 |
++ |
2737 |
+ err = xenbus_switch_state(pdev->xdev, XenbusStateReconfigured); |
2738 |
+ if (err) { |
2739 |
+ xenbus_dev_fatal(pdev->xdev, err, |
2740 |
+@@ -525,7 +528,7 @@ static void xen_pcibk_frontend_changed(struct xenbus_device *xdev, |
2741 |
+ break; |
2742 |
+ |
2743 |
+ case XenbusStateReconfiguring: |
2744 |
+- xen_pcibk_reconfigure(pdev); |
2745 |
++ xen_pcibk_reconfigure(pdev, XenbusStateReconfiguring); |
2746 |
+ break; |
2747 |
+ |
2748 |
+ case XenbusStateConnected: |
2749 |
+@@ -664,6 +667,15 @@ static void xen_pcibk_be_watch(struct xenbus_watch *watch, |
2750 |
+ xen_pcibk_setup_backend(pdev); |
2751 |
+ break; |
2752 |
+ |
2753 |
++ case XenbusStateInitialised: |
2754 |
++ /* |
2755 |
++ * We typically move to Initialised when the first device was |
2756 |
++ * added. Hence subsequent devices getting added may need |
2757 |
++ * reconfiguring. |
2758 |
++ */ |
2759 |
++ xen_pcibk_reconfigure(pdev, XenbusStateInitialised); |
2760 |
++ break; |
2761 |
++ |
2762 |
+ default: |
2763 |
+ break; |
2764 |
+ } |
2765 |
+diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c |
2766 |
+index 4162ef602a024..94c24b2a211bf 100644 |
2767 |
+--- a/fs/btrfs/inode.c |
2768 |
++++ b/fs/btrfs/inode.c |
2769 |
+@@ -2967,6 +2967,7 @@ void btrfs_run_delayed_iputs(struct btrfs_fs_info *fs_info) |
2770 |
+ inode = list_first_entry(&fs_info->delayed_iputs, |
2771 |
+ struct btrfs_inode, delayed_iput); |
2772 |
+ run_delayed_iput_locked(fs_info, inode); |
2773 |
++ cond_resched_lock(&fs_info->delayed_iput_lock); |
2774 |
+ } |
2775 |
+ spin_unlock(&fs_info->delayed_iput_lock); |
2776 |
+ } |
2777 |
+diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c |
2778 |
+index 6e45a25adeff8..a9d1555301446 100644 |
2779 |
+--- a/fs/cifs/smb2ops.c |
2780 |
++++ b/fs/cifs/smb2ops.c |
2781 |
+@@ -1764,6 +1764,8 @@ smb2_copychunk_range(const unsigned int xid, |
2782 |
+ cpu_to_le32(min_t(u32, len, tcon->max_bytes_chunk)); |
2783 |
+ |
2784 |
+ /* Request server copy to target from src identified by key */ |
2785 |
++ kfree(retbuf); |
2786 |
++ retbuf = NULL; |
2787 |
+ rc = SMB2_ioctl(xid, tcon, trgtfile->fid.persistent_fid, |
2788 |
+ trgtfile->fid.volatile_fid, FSCTL_SRV_COPYCHUNK_WRITE, |
2789 |
+ true /* is_fsctl */, (char *)pcchunk, |
2790 |
+diff --git a/fs/ecryptfs/crypto.c b/fs/ecryptfs/crypto.c |
2791 |
+index 0681540c48d98..adf0707263a1b 100644 |
2792 |
+--- a/fs/ecryptfs/crypto.c |
2793 |
++++ b/fs/ecryptfs/crypto.c |
2794 |
+@@ -296,10 +296,8 @@ static int crypt_scatterlist(struct ecryptfs_crypt_stat *crypt_stat, |
2795 |
+ struct extent_crypt_result ecr; |
2796 |
+ int rc = 0; |
2797 |
+ |
2798 |
+- if (!crypt_stat || !crypt_stat->tfm |
2799 |
+- || !(crypt_stat->flags & ECRYPTFS_STRUCT_INITIALIZED)) |
2800 |
+- return -EINVAL; |
2801 |
+- |
2802 |
++ BUG_ON(!crypt_stat || !crypt_stat->tfm |
2803 |
++ || !(crypt_stat->flags & ECRYPTFS_STRUCT_INITIALIZED)); |
2804 |
+ if (unlikely(ecryptfs_verbosity > 0)) { |
2805 |
+ ecryptfs_printk(KERN_DEBUG, "Key size [%zd]; key:\n", |
2806 |
+ crypt_stat->key_size); |
2807 |
+diff --git a/include/linux/console_struct.h b/include/linux/console_struct.h |
2808 |
+index 153734816b49c..d5b9c8d40c18e 100644 |
2809 |
+--- a/include/linux/console_struct.h |
2810 |
++++ b/include/linux/console_struct.h |
2811 |
+@@ -101,6 +101,7 @@ struct vc_data { |
2812 |
+ unsigned int vc_rows; |
2813 |
+ unsigned int vc_size_row; /* Bytes per row */ |
2814 |
+ unsigned int vc_scan_lines; /* # of scan lines */ |
2815 |
++ unsigned int vc_cell_height; /* CRTC character cell height */ |
2816 |
+ unsigned long vc_origin; /* [!] Start of real screen */ |
2817 |
+ unsigned long vc_scr_end; /* [!] End of real screen */ |
2818 |
+ unsigned long vc_visible_origin; /* [!] Top of visible window */ |
2819 |
+diff --git a/ipc/mqueue.c b/ipc/mqueue.c |
2820 |
+index beff0cfcd1e87..05d2176cc4712 100644 |
2821 |
+--- a/ipc/mqueue.c |
2822 |
++++ b/ipc/mqueue.c |
2823 |
+@@ -1003,12 +1003,14 @@ static inline void __pipelined_op(struct wake_q_head *wake_q, |
2824 |
+ struct mqueue_inode_info *info, |
2825 |
+ struct ext_wait_queue *this) |
2826 |
+ { |
2827 |
++ struct task_struct *task; |
2828 |
++ |
2829 |
+ list_del(&this->list); |
2830 |
+- get_task_struct(this->task); |
2831 |
++ task = get_task_struct(this->task); |
2832 |
+ |
2833 |
+ /* see MQ_BARRIER for purpose/pairing */ |
2834 |
+ smp_store_release(&this->state, STATE_READY); |
2835 |
+- wake_q_add_safe(wake_q, this->task); |
2836 |
++ wake_q_add_safe(wake_q, task); |
2837 |
+ } |
2838 |
+ |
2839 |
+ /* pipelined_send() - send a message directly to the task waiting in |
2840 |
+diff --git a/ipc/msg.c b/ipc/msg.c |
2841 |
+index acd1bc7af55a2..6e6c8e0c9380e 100644 |
2842 |
+--- a/ipc/msg.c |
2843 |
++++ b/ipc/msg.c |
2844 |
+@@ -251,11 +251,13 @@ static void expunge_all(struct msg_queue *msq, int res, |
2845 |
+ struct msg_receiver *msr, *t; |
2846 |
+ |
2847 |
+ list_for_each_entry_safe(msr, t, &msq->q_receivers, r_list) { |
2848 |
+- get_task_struct(msr->r_tsk); |
2849 |
++ struct task_struct *r_tsk; |
2850 |
++ |
2851 |
++ r_tsk = get_task_struct(msr->r_tsk); |
2852 |
+ |
2853 |
+ /* see MSG_BARRIER for purpose/pairing */ |
2854 |
+ smp_store_release(&msr->r_msg, ERR_PTR(res)); |
2855 |
+- wake_q_add_safe(wake_q, msr->r_tsk); |
2856 |
++ wake_q_add_safe(wake_q, r_tsk); |
2857 |
+ } |
2858 |
+ } |
2859 |
+ |
2860 |
+diff --git a/ipc/sem.c b/ipc/sem.c |
2861 |
+index f6c30a85dadf9..7d9c06b0ad6e2 100644 |
2862 |
+--- a/ipc/sem.c |
2863 |
++++ b/ipc/sem.c |
2864 |
+@@ -784,12 +784,14 @@ would_block: |
2865 |
+ static inline void wake_up_sem_queue_prepare(struct sem_queue *q, int error, |
2866 |
+ struct wake_q_head *wake_q) |
2867 |
+ { |
2868 |
+- get_task_struct(q->sleeper); |
2869 |
++ struct task_struct *sleeper; |
2870 |
++ |
2871 |
++ sleeper = get_task_struct(q->sleeper); |
2872 |
+ |
2873 |
+ /* see SEM_BARRIER_2 for purpuse/pairing */ |
2874 |
+ smp_store_release(&q->status, error); |
2875 |
+ |
2876 |
+- wake_q_add_safe(wake_q, q->sleeper); |
2877 |
++ wake_q_add_safe(wake_q, sleeper); |
2878 |
+ } |
2879 |
+ |
2880 |
+ static void unlink_queue(struct sem_array *sma, struct sem_queue *q) |
2881 |
+diff --git a/kernel/kcsan/debugfs.c b/kernel/kcsan/debugfs.c |
2882 |
+index 209ad8dcfcecf..62a52be8f6ba9 100644 |
2883 |
+--- a/kernel/kcsan/debugfs.c |
2884 |
++++ b/kernel/kcsan/debugfs.c |
2885 |
+@@ -261,9 +261,10 @@ static const struct file_operations debugfs_ops = |
2886 |
+ .release = single_release |
2887 |
+ }; |
2888 |
+ |
2889 |
+-static void __init kcsan_debugfs_init(void) |
2890 |
++static int __init kcsan_debugfs_init(void) |
2891 |
+ { |
2892 |
+ debugfs_create_file("kcsan", 0644, NULL, NULL, &debugfs_ops); |
2893 |
++ return 0; |
2894 |
+ } |
2895 |
+ |
2896 |
+ late_initcall(kcsan_debugfs_init); |
2897 |
+diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c |
2898 |
+index 38d7c03e694cd..858b96b438cee 100644 |
2899 |
+--- a/kernel/locking/lockdep.c |
2900 |
++++ b/kernel/locking/lockdep.c |
2901 |
+@@ -5664,7 +5664,7 @@ void lock_contended(struct lockdep_map *lock, unsigned long ip) |
2902 |
+ { |
2903 |
+ unsigned long flags; |
2904 |
+ |
2905 |
+- trace_lock_acquired(lock, ip); |
2906 |
++ trace_lock_contended(lock, ip); |
2907 |
+ |
2908 |
+ if (unlikely(!lock_stat || !lockdep_enabled())) |
2909 |
+ return; |
2910 |
+@@ -5682,7 +5682,7 @@ void lock_acquired(struct lockdep_map *lock, unsigned long ip) |
2911 |
+ { |
2912 |
+ unsigned long flags; |
2913 |
+ |
2914 |
+- trace_lock_contended(lock, ip); |
2915 |
++ trace_lock_acquired(lock, ip); |
2916 |
+ |
2917 |
+ if (unlikely(!lock_stat || !lockdep_enabled())) |
2918 |
+ return; |
2919 |
+diff --git a/kernel/locking/mutex-debug.c b/kernel/locking/mutex-debug.c |
2920 |
+index a7276aaf2abc0..db9301591e3fc 100644 |
2921 |
+--- a/kernel/locking/mutex-debug.c |
2922 |
++++ b/kernel/locking/mutex-debug.c |
2923 |
+@@ -57,7 +57,7 @@ void debug_mutex_add_waiter(struct mutex *lock, struct mutex_waiter *waiter, |
2924 |
+ task->blocked_on = waiter; |
2925 |
+ } |
2926 |
+ |
2927 |
+-void mutex_remove_waiter(struct mutex *lock, struct mutex_waiter *waiter, |
2928 |
++void debug_mutex_remove_waiter(struct mutex *lock, struct mutex_waiter *waiter, |
2929 |
+ struct task_struct *task) |
2930 |
+ { |
2931 |
+ DEBUG_LOCKS_WARN_ON(list_empty(&waiter->list)); |
2932 |
+@@ -65,7 +65,7 @@ void mutex_remove_waiter(struct mutex *lock, struct mutex_waiter *waiter, |
2933 |
+ DEBUG_LOCKS_WARN_ON(task->blocked_on != waiter); |
2934 |
+ task->blocked_on = NULL; |
2935 |
+ |
2936 |
+- list_del_init(&waiter->list); |
2937 |
++ INIT_LIST_HEAD(&waiter->list); |
2938 |
+ waiter->task = NULL; |
2939 |
+ } |
2940 |
+ |
2941 |
+diff --git a/kernel/locking/mutex-debug.h b/kernel/locking/mutex-debug.h |
2942 |
+index 1edd3f45a4ecb..53e631e1d76da 100644 |
2943 |
+--- a/kernel/locking/mutex-debug.h |
2944 |
++++ b/kernel/locking/mutex-debug.h |
2945 |
+@@ -22,7 +22,7 @@ extern void debug_mutex_free_waiter(struct mutex_waiter *waiter); |
2946 |
+ extern void debug_mutex_add_waiter(struct mutex *lock, |
2947 |
+ struct mutex_waiter *waiter, |
2948 |
+ struct task_struct *task); |
2949 |
+-extern void mutex_remove_waiter(struct mutex *lock, struct mutex_waiter *waiter, |
2950 |
++extern void debug_mutex_remove_waiter(struct mutex *lock, struct mutex_waiter *waiter, |
2951 |
+ struct task_struct *task); |
2952 |
+ extern void debug_mutex_unlock(struct mutex *lock); |
2953 |
+ extern void debug_mutex_init(struct mutex *lock, const char *name, |
2954 |
+diff --git a/kernel/locking/mutex.c b/kernel/locking/mutex.c |
2955 |
+index 2c25b830203cd..15ac7c4bb1117 100644 |
2956 |
+--- a/kernel/locking/mutex.c |
2957 |
++++ b/kernel/locking/mutex.c |
2958 |
+@@ -204,7 +204,7 @@ static inline bool __mutex_waiter_is_first(struct mutex *lock, struct mutex_wait |
2959 |
+ * Add @waiter to a given location in the lock wait_list and set the |
2960 |
+ * FLAG_WAITERS flag if it's the first waiter. |
2961 |
+ */ |
2962 |
+-static void __sched |
2963 |
++static void |
2964 |
+ __mutex_add_waiter(struct mutex *lock, struct mutex_waiter *waiter, |
2965 |
+ struct list_head *list) |
2966 |
+ { |
2967 |
+@@ -215,6 +215,16 @@ __mutex_add_waiter(struct mutex *lock, struct mutex_waiter *waiter, |
2968 |
+ __mutex_set_flag(lock, MUTEX_FLAG_WAITERS); |
2969 |
+ } |
2970 |
+ |
2971 |
++static void |
2972 |
++__mutex_remove_waiter(struct mutex *lock, struct mutex_waiter *waiter) |
2973 |
++{ |
2974 |
++ list_del(&waiter->list); |
2975 |
++ if (likely(list_empty(&lock->wait_list))) |
2976 |
++ __mutex_clear_flag(lock, MUTEX_FLAGS); |
2977 |
++ |
2978 |
++ debug_mutex_remove_waiter(lock, waiter, current); |
2979 |
++} |
2980 |
++ |
2981 |
+ /* |
2982 |
+ * Give up ownership to a specific task, when @task = NULL, this is equivalent |
2983 |
+ * to a regular unlock. Sets PICKUP on a handoff, clears HANDOF, preserves |
2984 |
+@@ -1071,9 +1081,7 @@ acquired: |
2985 |
+ __ww_mutex_check_waiters(lock, ww_ctx); |
2986 |
+ } |
2987 |
+ |
2988 |
+- mutex_remove_waiter(lock, &waiter, current); |
2989 |
+- if (likely(list_empty(&lock->wait_list))) |
2990 |
+- __mutex_clear_flag(lock, MUTEX_FLAGS); |
2991 |
++ __mutex_remove_waiter(lock, &waiter); |
2992 |
+ |
2993 |
+ debug_mutex_free_waiter(&waiter); |
2994 |
+ |
2995 |
+@@ -1090,7 +1098,7 @@ skip_wait: |
2996 |
+ |
2997 |
+ err: |
2998 |
+ __set_current_state(TASK_RUNNING); |
2999 |
+- mutex_remove_waiter(lock, &waiter, current); |
3000 |
++ __mutex_remove_waiter(lock, &waiter); |
3001 |
+ err_early_kill: |
3002 |
+ spin_unlock(&lock->wait_lock); |
3003 |
+ debug_mutex_free_waiter(&waiter); |
3004 |
+diff --git a/kernel/locking/mutex.h b/kernel/locking/mutex.h |
3005 |
+index 1c2287d3fa719..f0c710b1d1927 100644 |
3006 |
+--- a/kernel/locking/mutex.h |
3007 |
++++ b/kernel/locking/mutex.h |
3008 |
+@@ -10,12 +10,10 @@ |
3009 |
+ * !CONFIG_DEBUG_MUTEXES case. Most of them are NOPs: |
3010 |
+ */ |
3011 |
+ |
3012 |
+-#define mutex_remove_waiter(lock, waiter, task) \ |
3013 |
+- __list_del((waiter)->list.prev, (waiter)->list.next) |
3014 |
+- |
3015 |
+ #define debug_mutex_wake_waiter(lock, waiter) do { } while (0) |
3016 |
+ #define debug_mutex_free_waiter(waiter) do { } while (0) |
3017 |
+ #define debug_mutex_add_waiter(lock, waiter, ti) do { } while (0) |
3018 |
++#define debug_mutex_remove_waiter(lock, waiter, ti) do { } while (0) |
3019 |
+ #define debug_mutex_unlock(lock) do { } while (0) |
3020 |
+ #define debug_mutex_init(lock, name, key) do { } while (0) |
3021 |
+ |
3022 |
+diff --git a/kernel/ptrace.c b/kernel/ptrace.c |
3023 |
+index 79de1294f8ebd..eb4d04cb3aaf5 100644 |
3024 |
+--- a/kernel/ptrace.c |
3025 |
++++ b/kernel/ptrace.c |
3026 |
+@@ -169,6 +169,21 @@ void __ptrace_unlink(struct task_struct *child) |
3027 |
+ spin_unlock(&child->sighand->siglock); |
3028 |
+ } |
3029 |
+ |
3030 |
++static bool looks_like_a_spurious_pid(struct task_struct *task) |
3031 |
++{ |
3032 |
++ if (task->exit_code != ((PTRACE_EVENT_EXEC << 8) | SIGTRAP)) |
3033 |
++ return false; |
3034 |
++ |
3035 |
++ if (task_pid_vnr(task) == task->ptrace_message) |
3036 |
++ return false; |
3037 |
++ /* |
3038 |
++ * The tracee changed its pid but the PTRACE_EVENT_EXEC event |
3039 |
++ * was not wait()'ed, most probably debugger targets the old |
3040 |
++ * leader which was destroyed in de_thread(). |
3041 |
++ */ |
3042 |
++ return true; |
3043 |
++} |
3044 |
++ |
3045 |
+ /* Ensure that nothing can wake it up, even SIGKILL */ |
3046 |
+ static bool ptrace_freeze_traced(struct task_struct *task) |
3047 |
+ { |
3048 |
+@@ -179,7 +194,8 @@ static bool ptrace_freeze_traced(struct task_struct *task) |
3049 |
+ return ret; |
3050 |
+ |
3051 |
+ spin_lock_irq(&task->sighand->siglock); |
3052 |
+- if (task_is_traced(task) && !__fatal_signal_pending(task)) { |
3053 |
++ if (task_is_traced(task) && !looks_like_a_spurious_pid(task) && |
3054 |
++ !__fatal_signal_pending(task)) { |
3055 |
+ task->state = __TASK_TRACED; |
3056 |
+ ret = true; |
3057 |
+ } |
3058 |
+diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c |
3059 |
+index bf4bef13d9354..2b7879afc333b 100644 |
3060 |
+--- a/net/bluetooth/smp.c |
3061 |
++++ b/net/bluetooth/smp.c |
3062 |
+@@ -2733,6 +2733,15 @@ static int smp_cmd_public_key(struct l2cap_conn *conn, struct sk_buff *skb) |
3063 |
+ if (skb->len < sizeof(*key)) |
3064 |
+ return SMP_INVALID_PARAMS; |
3065 |
+ |
3066 |
++ /* Check if remote and local public keys are the same and debug key is |
3067 |
++ * not in use. |
3068 |
++ */ |
3069 |
++ if (!test_bit(SMP_FLAG_DEBUG_KEY, &smp->flags) && |
3070 |
++ !crypto_memneq(key, smp->local_pk, 64)) { |
3071 |
++ bt_dev_err(hdev, "Remote and local public keys are identical"); |
3072 |
++ return SMP_UNSPECIFIED; |
3073 |
++ } |
3074 |
++ |
3075 |
+ memcpy(smp->remote_pk, key, 64); |
3076 |
+ |
3077 |
+ if (test_bit(SMP_FLAG_REMOTE_OOB, &smp->flags)) { |
3078 |
+diff --git a/sound/firewire/Kconfig b/sound/firewire/Kconfig |
3079 |
+index 25778765cbfe9..9897bd26a4388 100644 |
3080 |
+--- a/sound/firewire/Kconfig |
3081 |
++++ b/sound/firewire/Kconfig |
3082 |
+@@ -38,7 +38,7 @@ config SND_OXFW |
3083 |
+ * Mackie(Loud) Onyx 1640i (former model) |
3084 |
+ * Mackie(Loud) Onyx Satellite |
3085 |
+ * Mackie(Loud) Tapco Link.Firewire |
3086 |
+- * Mackie(Loud) d.2 pro/d.4 pro |
3087 |
++ * Mackie(Loud) d.4 pro |
3088 |
+ * Mackie(Loud) U.420/U.420d |
3089 |
+ * TASCAM FireOne |
3090 |
+ * Stanton Controllers & Systems 1 Deck/Mixer |
3091 |
+@@ -84,7 +84,7 @@ config SND_BEBOB |
3092 |
+ * PreSonus FIREBOX/FIREPOD/FP10/Inspire1394 |
3093 |
+ * BridgeCo RDAudio1/Audio5 |
3094 |
+ * Mackie Onyx 1220/1620/1640 (FireWire I/O Card) |
3095 |
+- * Mackie d.2 (FireWire Option) |
3096 |
++ * Mackie d.2 (FireWire Option) and d.2 Pro |
3097 |
+ * Stanton FinalScratch 2 (ScratchAmp) |
3098 |
+ * Tascam IF-FW/DM |
3099 |
+ * Behringer XENIX UFX 1204/1604 |
3100 |
+diff --git a/sound/firewire/amdtp-stream-trace.h b/sound/firewire/amdtp-stream-trace.h |
3101 |
+index 26e7cb555d3c5..aa53c13b89d34 100644 |
3102 |
+--- a/sound/firewire/amdtp-stream-trace.h |
3103 |
++++ b/sound/firewire/amdtp-stream-trace.h |
3104 |
+@@ -14,8 +14,8 @@ |
3105 |
+ #include <linux/tracepoint.h> |
3106 |
+ |
3107 |
+ TRACE_EVENT(amdtp_packet, |
3108 |
+- TP_PROTO(const struct amdtp_stream *s, u32 cycles, const __be32 *cip_header, unsigned int payload_length, unsigned int data_blocks, unsigned int data_block_counter, unsigned int index), |
3109 |
+- TP_ARGS(s, cycles, cip_header, payload_length, data_blocks, data_block_counter, index), |
3110 |
++ TP_PROTO(const struct amdtp_stream *s, u32 cycles, const __be32 *cip_header, unsigned int payload_length, unsigned int data_blocks, unsigned int data_block_counter, unsigned int packet_index, unsigned int index), |
3111 |
++ TP_ARGS(s, cycles, cip_header, payload_length, data_blocks, data_block_counter, packet_index, index), |
3112 |
+ TP_STRUCT__entry( |
3113 |
+ __field(unsigned int, second) |
3114 |
+ __field(unsigned int, cycle) |
3115 |
+@@ -48,7 +48,7 @@ TRACE_EVENT(amdtp_packet, |
3116 |
+ __entry->payload_quadlets = payload_length / sizeof(__be32); |
3117 |
+ __entry->data_blocks = data_blocks; |
3118 |
+ __entry->data_block_counter = data_block_counter, |
3119 |
+- __entry->packet_index = s->packet_index; |
3120 |
++ __entry->packet_index = packet_index; |
3121 |
+ __entry->irq = !!in_interrupt(); |
3122 |
+ __entry->index = index; |
3123 |
+ ), |
3124 |
+diff --git a/sound/firewire/amdtp-stream.c b/sound/firewire/amdtp-stream.c |
3125 |
+index 4e2f2bb7879fb..e0faa6601966c 100644 |
3126 |
+--- a/sound/firewire/amdtp-stream.c |
3127 |
++++ b/sound/firewire/amdtp-stream.c |
3128 |
+@@ -526,7 +526,7 @@ static void build_it_pkt_header(struct amdtp_stream *s, unsigned int cycle, |
3129 |
+ } |
3130 |
+ |
3131 |
+ trace_amdtp_packet(s, cycle, cip_header, payload_length, data_blocks, |
3132 |
+- data_block_counter, index); |
3133 |
++ data_block_counter, s->packet_index, index); |
3134 |
+ } |
3135 |
+ |
3136 |
+ static int check_cip_header(struct amdtp_stream *s, const __be32 *buf, |
3137 |
+@@ -630,21 +630,27 @@ static int parse_ir_ctx_header(struct amdtp_stream *s, unsigned int cycle, |
3138 |
+ unsigned int *payload_length, |
3139 |
+ unsigned int *data_blocks, |
3140 |
+ unsigned int *data_block_counter, |
3141 |
+- unsigned int *syt, unsigned int index) |
3142 |
++ unsigned int *syt, unsigned int packet_index, unsigned int index) |
3143 |
+ { |
3144 |
+ const __be32 *cip_header; |
3145 |
++ unsigned int cip_header_size; |
3146 |
+ int err; |
3147 |
+ |
3148 |
+ *payload_length = be32_to_cpu(ctx_header[0]) >> ISO_DATA_LENGTH_SHIFT; |
3149 |
+- if (*payload_length > s->ctx_data.tx.ctx_header_size + |
3150 |
+- s->ctx_data.tx.max_ctx_payload_length) { |
3151 |
++ |
3152 |
++ if (!(s->flags & CIP_NO_HEADER)) |
3153 |
++ cip_header_size = 8; |
3154 |
++ else |
3155 |
++ cip_header_size = 0; |
3156 |
++ |
3157 |
++ if (*payload_length > cip_header_size + s->ctx_data.tx.max_ctx_payload_length) { |
3158 |
+ dev_err(&s->unit->device, |
3159 |
+ "Detect jumbo payload: %04x %04x\n", |
3160 |
+- *payload_length, s->ctx_data.tx.max_ctx_payload_length); |
3161 |
++ *payload_length, cip_header_size + s->ctx_data.tx.max_ctx_payload_length); |
3162 |
+ return -EIO; |
3163 |
+ } |
3164 |
+ |
3165 |
+- if (!(s->flags & CIP_NO_HEADER)) { |
3166 |
++ if (cip_header_size > 0) { |
3167 |
+ cip_header = ctx_header + 2; |
3168 |
+ err = check_cip_header(s, cip_header, *payload_length, |
3169 |
+ data_blocks, data_block_counter, syt); |
3170 |
+@@ -662,7 +668,7 @@ static int parse_ir_ctx_header(struct amdtp_stream *s, unsigned int cycle, |
3171 |
+ } |
3172 |
+ |
3173 |
+ trace_amdtp_packet(s, cycle, cip_header, *payload_length, *data_blocks, |
3174 |
+- *data_block_counter, index); |
3175 |
++ *data_block_counter, packet_index, index); |
3176 |
+ |
3177 |
+ return err; |
3178 |
+ } |
3179 |
+@@ -701,12 +707,13 @@ static int generate_device_pkt_descs(struct amdtp_stream *s, |
3180 |
+ unsigned int packets) |
3181 |
+ { |
3182 |
+ unsigned int dbc = s->data_block_counter; |
3183 |
++ unsigned int packet_index = s->packet_index; |
3184 |
++ unsigned int queue_size = s->queue_size; |
3185 |
+ int i; |
3186 |
+ int err; |
3187 |
+ |
3188 |
+ for (i = 0; i < packets; ++i) { |
3189 |
+ struct pkt_desc *desc = descs + i; |
3190 |
+- unsigned int index = (s->packet_index + i) % s->queue_size; |
3191 |
+ unsigned int cycle; |
3192 |
+ unsigned int payload_length; |
3193 |
+ unsigned int data_blocks; |
3194 |
+@@ -715,7 +722,7 @@ static int generate_device_pkt_descs(struct amdtp_stream *s, |
3195 |
+ cycle = compute_cycle_count(ctx_header[1]); |
3196 |
+ |
3197 |
+ err = parse_ir_ctx_header(s, cycle, ctx_header, &payload_length, |
3198 |
+- &data_blocks, &dbc, &syt, i); |
3199 |
++ &data_blocks, &dbc, &syt, packet_index, i); |
3200 |
+ if (err < 0) |
3201 |
+ return err; |
3202 |
+ |
3203 |
+@@ -723,13 +730,15 @@ static int generate_device_pkt_descs(struct amdtp_stream *s, |
3204 |
+ desc->syt = syt; |
3205 |
+ desc->data_blocks = data_blocks; |
3206 |
+ desc->data_block_counter = dbc; |
3207 |
+- desc->ctx_payload = s->buffer.packets[index].buffer; |
3208 |
++ desc->ctx_payload = s->buffer.packets[packet_index].buffer; |
3209 |
+ |
3210 |
+ if (!(s->flags & CIP_DBC_IS_END_EVENT)) |
3211 |
+ dbc = (dbc + desc->data_blocks) & 0xff; |
3212 |
+ |
3213 |
+ ctx_header += |
3214 |
+ s->ctx_data.tx.ctx_header_size / sizeof(*ctx_header); |
3215 |
++ |
3216 |
++ packet_index = (packet_index + 1) % queue_size; |
3217 |
+ } |
3218 |
+ |
3219 |
+ s->data_block_counter = dbc; |
3220 |
+@@ -1065,23 +1074,22 @@ static int amdtp_stream_start(struct amdtp_stream *s, int channel, int speed, |
3221 |
+ s->data_block_counter = 0; |
3222 |
+ } |
3223 |
+ |
3224 |
+- /* initialize packet buffer */ |
3225 |
++ // initialize packet buffer. |
3226 |
++ max_ctx_payload_size = amdtp_stream_get_max_payload(s); |
3227 |
+ if (s->direction == AMDTP_IN_STREAM) { |
3228 |
+ dir = DMA_FROM_DEVICE; |
3229 |
+ type = FW_ISO_CONTEXT_RECEIVE; |
3230 |
+- if (!(s->flags & CIP_NO_HEADER)) |
3231 |
++ if (!(s->flags & CIP_NO_HEADER)) { |
3232 |
++ max_ctx_payload_size -= 8; |
3233 |
+ ctx_header_size = IR_CTX_HEADER_SIZE_CIP; |
3234 |
+- else |
3235 |
++ } else { |
3236 |
+ ctx_header_size = IR_CTX_HEADER_SIZE_NO_CIP; |
3237 |
+- |
3238 |
+- max_ctx_payload_size = amdtp_stream_get_max_payload(s) - |
3239 |
+- ctx_header_size; |
3240 |
++ } |
3241 |
+ } else { |
3242 |
+ dir = DMA_TO_DEVICE; |
3243 |
+ type = FW_ISO_CONTEXT_TRANSMIT; |
3244 |
+ ctx_header_size = 0; // No effect for IT context. |
3245 |
+ |
3246 |
+- max_ctx_payload_size = amdtp_stream_get_max_payload(s); |
3247 |
+ if (!(s->flags & CIP_NO_HEADER)) |
3248 |
+ max_ctx_payload_size -= IT_PKT_HEADER_SIZE_CIP; |
3249 |
+ } |
3250 |
+diff --git a/sound/firewire/bebob/bebob.c b/sound/firewire/bebob/bebob.c |
3251 |
+index 2c8e3392a4903..daeecfa8b9aac 100644 |
3252 |
+--- a/sound/firewire/bebob/bebob.c |
3253 |
++++ b/sound/firewire/bebob/bebob.c |
3254 |
+@@ -387,7 +387,7 @@ static const struct ieee1394_device_id bebob_id_table[] = { |
3255 |
+ SND_BEBOB_DEV_ENTRY(VEN_BRIDGECO, 0x00010049, &spec_normal), |
3256 |
+ /* Mackie, Onyx 1220/1620/1640 (Firewire I/O Card) */ |
3257 |
+ SND_BEBOB_DEV_ENTRY(VEN_MACKIE2, 0x00010065, &spec_normal), |
3258 |
+- /* Mackie, d.2 (Firewire Option) */ |
3259 |
++ // Mackie, d.2 (Firewire option card) and d.2 Pro (the card is built-in). |
3260 |
+ SND_BEBOB_DEV_ENTRY(VEN_MACKIE1, 0x00010067, &spec_normal), |
3261 |
+ /* Stanton, ScratchAmp */ |
3262 |
+ SND_BEBOB_DEV_ENTRY(VEN_STANTON, 0x00000001, &spec_normal), |
3263 |
+diff --git a/sound/firewire/dice/dice-alesis.c b/sound/firewire/dice/dice-alesis.c |
3264 |
+index 0916864511d50..27c13b9cc9efd 100644 |
3265 |
+--- a/sound/firewire/dice/dice-alesis.c |
3266 |
++++ b/sound/firewire/dice/dice-alesis.c |
3267 |
+@@ -16,7 +16,7 @@ alesis_io14_tx_pcm_chs[MAX_STREAMS][SND_DICE_RATE_MODE_COUNT] = { |
3268 |
+ static const unsigned int |
3269 |
+ alesis_io26_tx_pcm_chs[MAX_STREAMS][SND_DICE_RATE_MODE_COUNT] = { |
3270 |
+ {10, 10, 4}, /* Tx0 = Analog + S/PDIF. */ |
3271 |
+- {16, 8, 0}, /* Tx1 = ADAT1 + ADAT2. */ |
3272 |
++ {16, 4, 0}, /* Tx1 = ADAT1 + ADAT2 (available at low rate). */ |
3273 |
+ }; |
3274 |
+ |
3275 |
+ int snd_dice_detect_alesis_formats(struct snd_dice *dice) |
3276 |
+diff --git a/sound/firewire/dice/dice-tcelectronic.c b/sound/firewire/dice/dice-tcelectronic.c |
3277 |
+index a8875d24ba2aa..43a3bcb15b3d1 100644 |
3278 |
+--- a/sound/firewire/dice/dice-tcelectronic.c |
3279 |
++++ b/sound/firewire/dice/dice-tcelectronic.c |
3280 |
+@@ -38,8 +38,8 @@ static const struct dice_tc_spec konnekt_24d = { |
3281 |
+ }; |
3282 |
+ |
3283 |
+ static const struct dice_tc_spec konnekt_live = { |
3284 |
+- .tx_pcm_chs = {{16, 16, 16}, {0, 0, 0} }, |
3285 |
+- .rx_pcm_chs = {{16, 16, 16}, {0, 0, 0} }, |
3286 |
++ .tx_pcm_chs = {{16, 16, 6}, {0, 0, 0} }, |
3287 |
++ .rx_pcm_chs = {{16, 16, 6}, {0, 0, 0} }, |
3288 |
+ .has_midi = true, |
3289 |
+ }; |
3290 |
+ |
3291 |
+diff --git a/sound/firewire/oxfw/oxfw.c b/sound/firewire/oxfw/oxfw.c |
3292 |
+index 1f1e3236efb8e..9eea25c46dc7e 100644 |
3293 |
+--- a/sound/firewire/oxfw/oxfw.c |
3294 |
++++ b/sound/firewire/oxfw/oxfw.c |
3295 |
+@@ -355,7 +355,6 @@ static const struct ieee1394_device_id oxfw_id_table[] = { |
3296 |
+ * Onyx-i series (former models): 0x081216 |
3297 |
+ * Mackie Onyx Satellite: 0x00200f |
3298 |
+ * Tapco LINK.firewire 4x6: 0x000460 |
3299 |
+- * d.2 pro: Unknown |
3300 |
+ * d.4 pro: Unknown |
3301 |
+ * U.420: Unknown |
3302 |
+ * U.420d: Unknown |
3303 |
+diff --git a/sound/isa/sb/sb8.c b/sound/isa/sb/sb8.c |
3304 |
+index 438109f167d61..ae93191ffdc9f 100644 |
3305 |
+--- a/sound/isa/sb/sb8.c |
3306 |
++++ b/sound/isa/sb/sb8.c |
3307 |
+@@ -96,10 +96,6 @@ static int snd_sb8_probe(struct device *pdev, unsigned int dev) |
3308 |
+ |
3309 |
+ /* block the 0x388 port to avoid PnP conflicts */ |
3310 |
+ acard->fm_res = request_region(0x388, 4, "SoundBlaster FM"); |
3311 |
+- if (!acard->fm_res) { |
3312 |
+- err = -EBUSY; |
3313 |
+- goto _err; |
3314 |
+- } |
3315 |
+ |
3316 |
+ if (port[dev] != SNDRV_AUTO_PORT) { |
3317 |
+ if ((err = snd_sbdsp_create(card, port[dev], irq[dev], |
3318 |
+diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c |
3319 |
+index 1fe70f2fe4fe8..43a63db4ab6ad 100644 |
3320 |
+--- a/sound/pci/hda/patch_realtek.c |
3321 |
++++ b/sound/pci/hda/patch_realtek.c |
3322 |
+@@ -395,7 +395,6 @@ static void alc_fill_eapd_coef(struct hda_codec *codec) |
3323 |
+ case 0x10ec0282: |
3324 |
+ case 0x10ec0283: |
3325 |
+ case 0x10ec0286: |
3326 |
+- case 0x10ec0287: |
3327 |
+ case 0x10ec0288: |
3328 |
+ case 0x10ec0285: |
3329 |
+ case 0x10ec0298: |
3330 |
+@@ -406,6 +405,10 @@ static void alc_fill_eapd_coef(struct hda_codec *codec) |
3331 |
+ case 0x10ec0275: |
3332 |
+ alc_update_coef_idx(codec, 0xe, 0, 1<<0); |
3333 |
+ break; |
3334 |
++ case 0x10ec0287: |
3335 |
++ alc_update_coef_idx(codec, 0x10, 1<<9, 0); |
3336 |
++ alc_write_coef_idx(codec, 0x8, 0x4ab7); |
3337 |
++ break; |
3338 |
+ case 0x10ec0293: |
3339 |
+ alc_update_coef_idx(codec, 0xa, 1<<13, 0); |
3340 |
+ break; |
3341 |
+@@ -5717,6 +5720,18 @@ static void alc_fixup_tpt470_dacs(struct hda_codec *codec, |
3342 |
+ spec->gen.preferred_dacs = preferred_pairs; |
3343 |
+ } |
3344 |
+ |
3345 |
++static void alc295_fixup_asus_dacs(struct hda_codec *codec, |
3346 |
++ const struct hda_fixup *fix, int action) |
3347 |
++{ |
3348 |
++ static const hda_nid_t preferred_pairs[] = { |
3349 |
++ 0x17, 0x02, 0x21, 0x03, 0 |
3350 |
++ }; |
3351 |
++ struct alc_spec *spec = codec->spec; |
3352 |
++ |
3353 |
++ if (action == HDA_FIXUP_ACT_PRE_PROBE) |
3354 |
++ spec->gen.preferred_dacs = preferred_pairs; |
3355 |
++} |
3356 |
++ |
3357 |
+ static void alc_shutup_dell_xps13(struct hda_codec *codec) |
3358 |
+ { |
3359 |
+ struct alc_spec *spec = codec->spec; |
3360 |
+@@ -6232,6 +6247,35 @@ static void alc294_fixup_gx502_hp(struct hda_codec *codec, |
3361 |
+ } |
3362 |
+ } |
3363 |
+ |
3364 |
++static void alc294_gu502_toggle_output(struct hda_codec *codec, |
3365 |
++ struct hda_jack_callback *cb) |
3366 |
++{ |
3367 |
++ /* Windows sets 0x10 to 0x8420 for Node 0x20 which is |
3368 |
++ * responsible from changes between speakers and headphones |
3369 |
++ */ |
3370 |
++ if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT) |
3371 |
++ alc_write_coef_idx(codec, 0x10, 0x8420); |
3372 |
++ else |
3373 |
++ alc_write_coef_idx(codec, 0x10, 0x0a20); |
3374 |
++} |
3375 |
++ |
3376 |
++static void alc294_fixup_gu502_hp(struct hda_codec *codec, |
3377 |
++ const struct hda_fixup *fix, int action) |
3378 |
++{ |
3379 |
++ if (!is_jack_detectable(codec, 0x21)) |
3380 |
++ return; |
3381 |
++ |
3382 |
++ switch (action) { |
3383 |
++ case HDA_FIXUP_ACT_PRE_PROBE: |
3384 |
++ snd_hda_jack_detect_enable_callback(codec, 0x21, |
3385 |
++ alc294_gu502_toggle_output); |
3386 |
++ break; |
3387 |
++ case HDA_FIXUP_ACT_INIT: |
3388 |
++ alc294_gu502_toggle_output(codec, NULL); |
3389 |
++ break; |
3390 |
++ } |
3391 |
++} |
3392 |
++ |
3393 |
+ static void alc285_fixup_hp_gpio_amp_init(struct hda_codec *codec, |
3394 |
+ const struct hda_fixup *fix, int action) |
3395 |
+ { |
3396 |
+@@ -6449,6 +6493,9 @@ enum { |
3397 |
+ ALC294_FIXUP_ASUS_GX502_HP, |
3398 |
+ ALC294_FIXUP_ASUS_GX502_PINS, |
3399 |
+ ALC294_FIXUP_ASUS_GX502_VERBS, |
3400 |
++ ALC294_FIXUP_ASUS_GU502_HP, |
3401 |
++ ALC294_FIXUP_ASUS_GU502_PINS, |
3402 |
++ ALC294_FIXUP_ASUS_GU502_VERBS, |
3403 |
+ ALC285_FIXUP_HP_GPIO_LED, |
3404 |
+ ALC285_FIXUP_HP_MUTE_LED, |
3405 |
+ ALC236_FIXUP_HP_GPIO_LED, |
3406 |
+@@ -6485,6 +6532,9 @@ enum { |
3407 |
+ ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST, |
3408 |
+ ALC256_FIXUP_ACER_HEADSET_MIC, |
3409 |
+ ALC285_FIXUP_IDEAPAD_S740_COEF, |
3410 |
++ ALC295_FIXUP_ASUS_DACS, |
3411 |
++ ALC295_FIXUP_HP_OMEN, |
3412 |
++ ALC285_FIXUP_HP_SPECTRE_X360, |
3413 |
+ }; |
3414 |
+ |
3415 |
+ static const struct hda_fixup alc269_fixups[] = { |
3416 |
+@@ -7687,6 +7737,35 @@ static const struct hda_fixup alc269_fixups[] = { |
3417 |
+ .type = HDA_FIXUP_FUNC, |
3418 |
+ .v.func = alc294_fixup_gx502_hp, |
3419 |
+ }, |
3420 |
++ [ALC294_FIXUP_ASUS_GU502_PINS] = { |
3421 |
++ .type = HDA_FIXUP_PINS, |
3422 |
++ .v.pins = (const struct hda_pintbl[]) { |
3423 |
++ { 0x19, 0x01a11050 }, /* rear HP mic */ |
3424 |
++ { 0x1a, 0x01a11830 }, /* rear external mic */ |
3425 |
++ { 0x21, 0x012110f0 }, /* rear HP out */ |
3426 |
++ { } |
3427 |
++ }, |
3428 |
++ .chained = true, |
3429 |
++ .chain_id = ALC294_FIXUP_ASUS_GU502_VERBS |
3430 |
++ }, |
3431 |
++ [ALC294_FIXUP_ASUS_GU502_VERBS] = { |
3432 |
++ .type = HDA_FIXUP_VERBS, |
3433 |
++ .v.verbs = (const struct hda_verb[]) { |
3434 |
++ /* set 0x15 to HP-OUT ctrl */ |
3435 |
++ { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
3436 |
++ /* unmute the 0x15 amp */ |
3437 |
++ { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000 }, |
3438 |
++ /* set 0x1b to HP-OUT */ |
3439 |
++ { 0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
3440 |
++ { } |
3441 |
++ }, |
3442 |
++ .chained = true, |
3443 |
++ .chain_id = ALC294_FIXUP_ASUS_GU502_HP |
3444 |
++ }, |
3445 |
++ [ALC294_FIXUP_ASUS_GU502_HP] = { |
3446 |
++ .type = HDA_FIXUP_FUNC, |
3447 |
++ .v.func = alc294_fixup_gu502_hp, |
3448 |
++ }, |
3449 |
+ [ALC294_FIXUP_ASUS_COEF_1B] = { |
3450 |
+ .type = HDA_FIXUP_VERBS, |
3451 |
+ .v.verbs = (const struct hda_verb[]) { |
3452 |
+@@ -7983,6 +8062,39 @@ static const struct hda_fixup alc269_fixups[] = { |
3453 |
+ .chained = true, |
3454 |
+ .chain_id = ALC269_FIXUP_THINKPAD_ACPI, |
3455 |
+ }, |
3456 |
++ [ALC295_FIXUP_ASUS_DACS] = { |
3457 |
++ .type = HDA_FIXUP_FUNC, |
3458 |
++ .v.func = alc295_fixup_asus_dacs, |
3459 |
++ }, |
3460 |
++ [ALC295_FIXUP_HP_OMEN] = { |
3461 |
++ .type = HDA_FIXUP_PINS, |
3462 |
++ .v.pins = (const struct hda_pintbl[]) { |
3463 |
++ { 0x12, 0xb7a60130 }, |
3464 |
++ { 0x13, 0x40000000 }, |
3465 |
++ { 0x14, 0x411111f0 }, |
3466 |
++ { 0x16, 0x411111f0 }, |
3467 |
++ { 0x17, 0x90170110 }, |
3468 |
++ { 0x18, 0x411111f0 }, |
3469 |
++ { 0x19, 0x02a11030 }, |
3470 |
++ { 0x1a, 0x411111f0 }, |
3471 |
++ { 0x1b, 0x04a19030 }, |
3472 |
++ { 0x1d, 0x40600001 }, |
3473 |
++ { 0x1e, 0x411111f0 }, |
3474 |
++ { 0x21, 0x03211020 }, |
3475 |
++ {} |
3476 |
++ }, |
3477 |
++ .chained = true, |
3478 |
++ .chain_id = ALC269_FIXUP_HP_LINE1_MIC1_LED, |
3479 |
++ }, |
3480 |
++ [ALC285_FIXUP_HP_SPECTRE_X360] = { |
3481 |
++ .type = HDA_FIXUP_PINS, |
3482 |
++ .v.pins = (const struct hda_pintbl[]) { |
3483 |
++ { 0x14, 0x90170110 }, /* enable top speaker */ |
3484 |
++ {} |
3485 |
++ }, |
3486 |
++ .chained = true, |
3487 |
++ .chain_id = ALC285_FIXUP_SPEAKER2_TO_DAC1, |
3488 |
++ }, |
3489 |
+ }; |
3490 |
+ |
3491 |
+ static const struct snd_pci_quirk alc269_fixup_tbl[] = { |
3492 |
+@@ -8141,7 +8253,9 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { |
3493 |
+ SND_PCI_QUIRK(0x103c, 0x82c0, "HP G3 mini premium", ALC221_FIXUP_HP_MIC_NO_PRESENCE), |
3494 |
+ SND_PCI_QUIRK(0x103c, 0x83b9, "HP Spectre x360", ALC269_FIXUP_HP_MUTE_LED_MIC3), |
3495 |
+ SND_PCI_QUIRK(0x103c, 0x8497, "HP Envy x360", ALC269_FIXUP_HP_MUTE_LED_MIC3), |
3496 |
++ SND_PCI_QUIRK(0x103c, 0x84da, "HP OMEN dc0019-ur", ALC295_FIXUP_HP_OMEN), |
3497 |
+ SND_PCI_QUIRK(0x103c, 0x84e7, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3), |
3498 |
++ SND_PCI_QUIRK(0x103c, 0x8519, "HP Spectre x360 15-df0xxx", ALC285_FIXUP_HP_SPECTRE_X360), |
3499 |
+ SND_PCI_QUIRK(0x103c, 0x869d, "HP", ALC236_FIXUP_HP_MUTE_LED), |
3500 |
+ SND_PCI_QUIRK(0x103c, 0x86c7, "HP Envy AiO 32", ALC274_FIXUP_HP_ENVY_GPIO), |
3501 |
+ SND_PCI_QUIRK(0x103c, 0x8724, "HP EliteBook 850 G7", ALC285_FIXUP_HP_GPIO_LED), |
3502 |
+@@ -8181,6 +8295,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { |
3503 |
+ SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_ASUS_ZENBOOK), |
3504 |
+ SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A), |
3505 |
+ SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC), |
3506 |
++ SND_PCI_QUIRK(0x1043, 0x1740, "ASUS UX430UA", ALC295_FIXUP_ASUS_DACS), |
3507 |
+ SND_PCI_QUIRK(0x1043, 0x17d1, "ASUS UX431FL", ALC294_FIXUP_ASUS_DUAL_SPK), |
3508 |
+ SND_PCI_QUIRK(0x1043, 0x1881, "ASUS Zephyrus S/M", ALC294_FIXUP_ASUS_GX502_PINS), |
3509 |
+ SND_PCI_QUIRK(0x1043, 0x18b1, "Asus MJ401TA", ALC256_FIXUP_ASUS_HEADSET_MIC), |
3510 |
+@@ -8198,6 +8313,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { |
3511 |
+ SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC), |
3512 |
+ SND_PCI_QUIRK(0x1043, 0x1d4e, "ASUS TM420", ALC256_FIXUP_ASUS_HPE), |
3513 |
+ SND_PCI_QUIRK(0x1043, 0x1e11, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA502), |
3514 |
++ SND_PCI_QUIRK(0x1043, 0x1e51, "ASUS Zephyrus M15", ALC294_FIXUP_ASUS_GU502_PINS), |
3515 |
+ SND_PCI_QUIRK(0x1043, 0x1e8e, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA401), |
3516 |
+ SND_PCI_QUIRK(0x1043, 0x1f11, "ASUS Zephyrus G14", ALC289_FIXUP_ASUS_GA401), |
3517 |
+ SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2), |
3518 |
+@@ -8254,12 +8370,19 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { |
3519 |
+ SND_PCI_QUIRK(0x1558, 0x50b8, "Clevo NK50SZ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), |
3520 |
+ SND_PCI_QUIRK(0x1558, 0x50d5, "Clevo NP50D5", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), |
3521 |
+ SND_PCI_QUIRK(0x1558, 0x50f0, "Clevo NH50A[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), |
3522 |
++ SND_PCI_QUIRK(0x1558, 0x50f2, "Clevo NH50E[PR]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), |
3523 |
+ SND_PCI_QUIRK(0x1558, 0x50f3, "Clevo NH58DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), |
3524 |
++ SND_PCI_QUIRK(0x1558, 0x50f5, "Clevo NH55EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), |
3525 |
++ SND_PCI_QUIRK(0x1558, 0x50f6, "Clevo NH55DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), |
3526 |
+ SND_PCI_QUIRK(0x1558, 0x5101, "Clevo S510WU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), |
3527 |
+ SND_PCI_QUIRK(0x1558, 0x5157, "Clevo W517GU1", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), |
3528 |
+ SND_PCI_QUIRK(0x1558, 0x51a1, "Clevo NS50MU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), |
3529 |
+ SND_PCI_QUIRK(0x1558, 0x70a1, "Clevo NB70T[HJK]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), |
3530 |
+ SND_PCI_QUIRK(0x1558, 0x70b3, "Clevo NK70SB", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), |
3531 |
++ SND_PCI_QUIRK(0x1558, 0x70f2, "Clevo NH79EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), |
3532 |
++ SND_PCI_QUIRK(0x1558, 0x70f3, "Clevo NH77DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), |
3533 |
++ SND_PCI_QUIRK(0x1558, 0x70f4, "Clevo NH77EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), |
3534 |
++ SND_PCI_QUIRK(0x1558, 0x70f6, "Clevo NH77DPQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), |
3535 |
+ SND_PCI_QUIRK(0x1558, 0x8228, "Clevo NR40BU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), |
3536 |
+ SND_PCI_QUIRK(0x1558, 0x8520, "Clevo NH50D[CD]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), |
3537 |
+ SND_PCI_QUIRK(0x1558, 0x8521, "Clevo NH77D[CD]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), |
3538 |
+@@ -8277,9 +8400,17 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { |
3539 |
+ SND_PCI_QUIRK(0x1558, 0x8a51, "Clevo NH70RCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), |
3540 |
+ SND_PCI_QUIRK(0x1558, 0x8d50, "Clevo NH55RCQ-M", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), |
3541 |
+ SND_PCI_QUIRK(0x1558, 0x951d, "Clevo N950T[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), |
3542 |
++ SND_PCI_QUIRK(0x1558, 0x9600, "Clevo N960K[PR]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), |
3543 |
+ SND_PCI_QUIRK(0x1558, 0x961d, "Clevo N960S[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), |
3544 |
+ SND_PCI_QUIRK(0x1558, 0x971d, "Clevo N970T[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), |
3545 |
+ SND_PCI_QUIRK(0x1558, 0xa500, "Clevo NL53RU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), |
3546 |
++ SND_PCI_QUIRK(0x1558, 0xa600, "Clevo NL5XNU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), |
3547 |
++ SND_PCI_QUIRK(0x1558, 0xb018, "Clevo NP50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), |
3548 |
++ SND_PCI_QUIRK(0x1558, 0xb019, "Clevo NH77D[BE]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), |
3549 |
++ SND_PCI_QUIRK(0x1558, 0xb022, "Clevo NH77D[DC][QW]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), |
3550 |
++ SND_PCI_QUIRK(0x1558, 0xc018, "Clevo NP50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), |
3551 |
++ SND_PCI_QUIRK(0x1558, 0xc019, "Clevo NH77D[BE]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), |
3552 |
++ SND_PCI_QUIRK(0x1558, 0xc022, "Clevo NH77[DC][QW]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), |
3553 |
+ SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC233_FIXUP_LENOVO_MULTI_CODECS), |
3554 |
+ SND_PCI_QUIRK(0x17aa, 0x1048, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC), |
3555 |
+ SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE), |
3556 |
+@@ -8544,6 +8675,8 @@ static const struct hda_model_fixup alc269_fixup_models[] = { |
3557 |
+ {.id = ALC255_FIXUP_XIAOMI_HEADSET_MIC, .name = "alc255-xiaomi-headset"}, |
3558 |
+ {.id = ALC274_FIXUP_HP_MIC, .name = "alc274-hp-mic-detect"}, |
3559 |
+ {.id = ALC245_FIXUP_HP_X360_AMP, .name = "alc245-hp-x360-amp"}, |
3560 |
++ {.id = ALC295_FIXUP_HP_OMEN, .name = "alc295-hp-omen"}, |
3561 |
++ {.id = ALC285_FIXUP_HP_SPECTRE_X360, .name = "alc285-hp-spectre-x360"}, |
3562 |
+ {} |
3563 |
+ }; |
3564 |
+ #define ALC225_STANDARD_PINS \ |
3565 |
+diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c |
3566 |
+index 3349e455a871a..6fb6f36d0d377 100644 |
3567 |
+--- a/sound/pci/intel8x0.c |
3568 |
++++ b/sound/pci/intel8x0.c |
3569 |
+@@ -354,6 +354,7 @@ struct ichdev { |
3570 |
+ unsigned int ali_slot; /* ALI DMA slot */ |
3571 |
+ struct ac97_pcm *pcm; |
3572 |
+ int pcm_open_flag; |
3573 |
++ unsigned int prepared:1; |
3574 |
+ unsigned int suspended: 1; |
3575 |
+ }; |
3576 |
+ |
3577 |
+@@ -714,6 +715,9 @@ static inline void snd_intel8x0_update(struct intel8x0 *chip, struct ichdev *ich |
3578 |
+ int status, civ, i, step; |
3579 |
+ int ack = 0; |
3580 |
+ |
3581 |
++ if (!ichdev->prepared || ichdev->suspended) |
3582 |
++ return; |
3583 |
++ |
3584 |
+ spin_lock_irqsave(&chip->reg_lock, flags); |
3585 |
+ status = igetbyte(chip, port + ichdev->roff_sr); |
3586 |
+ civ = igetbyte(chip, port + ICH_REG_OFF_CIV); |
3587 |
+@@ -904,6 +908,7 @@ static int snd_intel8x0_hw_params(struct snd_pcm_substream *substream, |
3588 |
+ if (ichdev->pcm_open_flag) { |
3589 |
+ snd_ac97_pcm_close(ichdev->pcm); |
3590 |
+ ichdev->pcm_open_flag = 0; |
3591 |
++ ichdev->prepared = 0; |
3592 |
+ } |
3593 |
+ err = snd_ac97_pcm_open(ichdev->pcm, params_rate(hw_params), |
3594 |
+ params_channels(hw_params), |
3595 |
+@@ -925,6 +930,7 @@ static int snd_intel8x0_hw_free(struct snd_pcm_substream *substream) |
3596 |
+ if (ichdev->pcm_open_flag) { |
3597 |
+ snd_ac97_pcm_close(ichdev->pcm); |
3598 |
+ ichdev->pcm_open_flag = 0; |
3599 |
++ ichdev->prepared = 0; |
3600 |
+ } |
3601 |
+ return 0; |
3602 |
+ } |
3603 |
+@@ -999,6 +1005,7 @@ static int snd_intel8x0_pcm_prepare(struct snd_pcm_substream *substream) |
3604 |
+ ichdev->pos_shift = (runtime->sample_bits > 16) ? 2 : 1; |
3605 |
+ } |
3606 |
+ snd_intel8x0_setup_periods(chip, ichdev); |
3607 |
++ ichdev->prepared = 1; |
3608 |
+ return 0; |
3609 |
+ } |
3610 |
+ |
3611 |
+diff --git a/sound/usb/line6/driver.c b/sound/usb/line6/driver.c |
3612 |
+index a030dd65eb280..9602929b7de90 100644 |
3613 |
+--- a/sound/usb/line6/driver.c |
3614 |
++++ b/sound/usb/line6/driver.c |
3615 |
+@@ -699,6 +699,10 @@ static int line6_init_cap_control(struct usb_line6 *line6) |
3616 |
+ line6->buffer_message = kmalloc(LINE6_MIDI_MESSAGE_MAXLEN, GFP_KERNEL); |
3617 |
+ if (!line6->buffer_message) |
3618 |
+ return -ENOMEM; |
3619 |
++ |
3620 |
++ ret = line6_init_midi(line6); |
3621 |
++ if (ret < 0) |
3622 |
++ return ret; |
3623 |
+ } else { |
3624 |
+ ret = line6_hwdep_init(line6); |
3625 |
+ if (ret < 0) |
3626 |
+diff --git a/sound/usb/line6/pod.c b/sound/usb/line6/pod.c |
3627 |
+index cd44cb5f1310c..16e644330c4d6 100644 |
3628 |
+--- a/sound/usb/line6/pod.c |
3629 |
++++ b/sound/usb/line6/pod.c |
3630 |
+@@ -376,11 +376,6 @@ static int pod_init(struct usb_line6 *line6, |
3631 |
+ if (err < 0) |
3632 |
+ return err; |
3633 |
+ |
3634 |
+- /* initialize MIDI subsystem: */ |
3635 |
+- err = line6_init_midi(line6); |
3636 |
+- if (err < 0) |
3637 |
+- return err; |
3638 |
+- |
3639 |
+ /* initialize PCM subsystem: */ |
3640 |
+ err = line6_init_pcm(line6, &pod_pcm_properties); |
3641 |
+ if (err < 0) |
3642 |
+diff --git a/sound/usb/line6/variax.c b/sound/usb/line6/variax.c |
3643 |
+index ed158f04de80f..c2245aa93b08f 100644 |
3644 |
+--- a/sound/usb/line6/variax.c |
3645 |
++++ b/sound/usb/line6/variax.c |
3646 |
+@@ -159,7 +159,6 @@ static int variax_init(struct usb_line6 *line6, |
3647 |
+ const struct usb_device_id *id) |
3648 |
+ { |
3649 |
+ struct usb_line6_variax *variax = line6_to_variax(line6); |
3650 |
+- int err; |
3651 |
+ |
3652 |
+ line6->process_message = line6_variax_process_message; |
3653 |
+ line6->disconnect = line6_variax_disconnect; |
3654 |
+@@ -172,11 +171,6 @@ static int variax_init(struct usb_line6 *line6, |
3655 |
+ if (variax->buffer_activate == NULL) |
3656 |
+ return -ENOMEM; |
3657 |
+ |
3658 |
+- /* initialize MIDI subsystem: */ |
3659 |
+- err = line6_init_midi(&variax->line6); |
3660 |
+- if (err < 0) |
3661 |
+- return err; |
3662 |
+- |
3663 |
+ /* initiate startup procedure: */ |
3664 |
+ schedule_delayed_work(&line6->startup_work, |
3665 |
+ msecs_to_jiffies(VARIAX_STARTUP_DELAY1)); |
3666 |
+diff --git a/sound/usb/midi.c b/sound/usb/midi.c |
3667 |
+index cd46ca7cd28de..fa91290ad89db 100644 |
3668 |
+--- a/sound/usb/midi.c |
3669 |
++++ b/sound/usb/midi.c |
3670 |
+@@ -1889,8 +1889,12 @@ static int snd_usbmidi_get_ms_info(struct snd_usb_midi *umidi, |
3671 |
+ ms_ep = find_usb_ms_endpoint_descriptor(hostep); |
3672 |
+ if (!ms_ep) |
3673 |
+ continue; |
3674 |
++ if (ms_ep->bLength <= sizeof(*ms_ep)) |
3675 |
++ continue; |
3676 |
+ if (ms_ep->bNumEmbMIDIJack > 0x10) |
3677 |
+ continue; |
3678 |
++ if (ms_ep->bLength < sizeof(*ms_ep) + ms_ep->bNumEmbMIDIJack) |
3679 |
++ continue; |
3680 |
+ if (usb_endpoint_dir_out(ep)) { |
3681 |
+ if (endpoints[epidx].out_ep) { |
3682 |
+ if (++epidx >= MIDI_MAX_ENDPOINTS) { |
3683 |
+diff --git a/tools/testing/selftests/exec/Makefile b/tools/testing/selftests/exec/Makefile |
3684 |
+index cf69b2fcce59e..dd61118df66ed 100644 |
3685 |
+--- a/tools/testing/selftests/exec/Makefile |
3686 |
++++ b/tools/testing/selftests/exec/Makefile |
3687 |
+@@ -28,8 +28,8 @@ $(OUTPUT)/execveat.denatured: $(OUTPUT)/execveat |
3688 |
+ cp $< $@ |
3689 |
+ chmod -x $@ |
3690 |
+ $(OUTPUT)/load_address_4096: load_address.c |
3691 |
+- $(CC) $(CFLAGS) $(LDFLAGS) -Wl,-z,max-page-size=0x1000 -pie $< -o $@ |
3692 |
++ $(CC) $(CFLAGS) $(LDFLAGS) -Wl,-z,max-page-size=0x1000 -pie -static $< -o $@ |
3693 |
+ $(OUTPUT)/load_address_2097152: load_address.c |
3694 |
+- $(CC) $(CFLAGS) $(LDFLAGS) -Wl,-z,max-page-size=0x200000 -pie $< -o $@ |
3695 |
++ $(CC) $(CFLAGS) $(LDFLAGS) -Wl,-z,max-page-size=0x200000 -pie -static $< -o $@ |
3696 |
+ $(OUTPUT)/load_address_16777216: load_address.c |
3697 |
+- $(CC) $(CFLAGS) $(LDFLAGS) -Wl,-z,max-page-size=0x1000000 -pie $< -o $@ |
3698 |
++ $(CC) $(CFLAGS) $(LDFLAGS) -Wl,-z,max-page-size=0x1000000 -pie -static $< -o $@ |
3699 |
+diff --git a/tools/testing/selftests/seccomp/seccomp_bpf.c b/tools/testing/selftests/seccomp/seccomp_bpf.c |
3700 |
+index 1b6c7d33c4ff2..dc21dc49b426f 100644 |
3701 |
+--- a/tools/testing/selftests/seccomp/seccomp_bpf.c |
3702 |
++++ b/tools/testing/selftests/seccomp/seccomp_bpf.c |
3703 |
+@@ -1753,16 +1753,25 @@ TEST_F(TRACE_poke, getpid_runs_normally) |
3704 |
+ # define SYSCALL_RET_SET(_regs, _val) \ |
3705 |
+ do { \ |
3706 |
+ typeof(_val) _result = (_val); \ |
3707 |
+- /* \ |
3708 |
+- * A syscall error is signaled by CR0 SO bit \ |
3709 |
+- * and the code is stored as a positive value. \ |
3710 |
+- */ \ |
3711 |
+- if (_result < 0) { \ |
3712 |
+- SYSCALL_RET(_regs) = -_result; \ |
3713 |
+- (_regs).ccr |= 0x10000000; \ |
3714 |
+- } else { \ |
3715 |
++ if ((_regs.trap & 0xfff0) == 0x3000) { \ |
3716 |
++ /* \ |
3717 |
++ * scv 0 system call uses -ve result \ |
3718 |
++ * for error, so no need to adjust. \ |
3719 |
++ */ \ |
3720 |
+ SYSCALL_RET(_regs) = _result; \ |
3721 |
+- (_regs).ccr &= ~0x10000000; \ |
3722 |
++ } else { \ |
3723 |
++ /* \ |
3724 |
++ * A syscall error is signaled by the \ |
3725 |
++ * CR0 SO bit and the code is stored as \ |
3726 |
++ * a positive value. \ |
3727 |
++ */ \ |
3728 |
++ if (_result < 0) { \ |
3729 |
++ SYSCALL_RET(_regs) = -_result; \ |
3730 |
++ (_regs).ccr |= 0x10000000; \ |
3731 |
++ } else { \ |
3732 |
++ SYSCALL_RET(_regs) = _result; \ |
3733 |
++ (_regs).ccr &= ~0x10000000; \ |
3734 |
++ } \ |
3735 |
+ } \ |
3736 |
+ } while (0) |
3737 |
+ # define SYSCALL_RET_SET_ON_PTRACE_EXIT |