1 |
commit: 2bba9a042c4233e26fc320d143f3426d62454bd0 |
2 |
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Apr 29 17:56:26 2020 +0000 |
4 |
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Apr 29 17:56:26 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=2bba9a04 |
7 |
|
8 |
Linux patch 5.4.36 |
9 |
|
10 |
Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org> |
11 |
|
12 |
0000_README | 4 + |
13 |
1035_linux-5.4.36.patch | 6603 +++++++++++++++++++++++++++++++++++++++++++++++ |
14 |
2 files changed, 6607 insertions(+) |
15 |
|
16 |
diff --git a/0000_README b/0000_README |
17 |
index 20358ff..3a9fc8f 100644 |
18 |
--- a/0000_README |
19 |
+++ b/0000_README |
20 |
@@ -183,6 +183,10 @@ Patch: 1034_linux-5.4.35.patch |
21 |
From: http://www.kernel.org |
22 |
Desc: Linux 5.4.35 |
23 |
|
24 |
+Patch: 1035_linux-5.4.36.patch |
25 |
+From: http://www.kernel.org |
26 |
+Desc: Linux 5.4.36 |
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/1035_linux-5.4.36.patch b/1035_linux-5.4.36.patch |
33 |
new file mode 100644 |
34 |
index 0000000..8126d6d |
35 |
--- /dev/null |
36 |
+++ b/1035_linux-5.4.36.patch |
37 |
@@ -0,0 +1,6603 @@ |
38 |
+diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt |
39 |
+index 94fa4a8de2ca..1f77c99e2cba 100644 |
40 |
+--- a/Documentation/admin-guide/kernel-parameters.txt |
41 |
++++ b/Documentation/admin-guide/kernel-parameters.txt |
42 |
+@@ -5005,8 +5005,7 @@ |
43 |
+ |
44 |
+ usbcore.old_scheme_first= |
45 |
+ [USB] Start with the old device initialization |
46 |
+- scheme, applies only to low and full-speed devices |
47 |
+- (default 0 = off). |
48 |
++ scheme (default 0 = off). |
49 |
+ |
50 |
+ usbcore.usbfs_memory_mb= |
51 |
+ [USB] Memory limit (in MB) for buffers allocated by |
52 |
+diff --git a/Documentation/arm64/silicon-errata.rst b/Documentation/arm64/silicon-errata.rst |
53 |
+index 5a09661330fc..59daa4c21816 100644 |
54 |
+--- a/Documentation/arm64/silicon-errata.rst |
55 |
++++ b/Documentation/arm64/silicon-errata.rst |
56 |
+@@ -88,6 +88,8 @@ stable kernels. |
57 |
+ +----------------+-----------------+-----------------+-----------------------------+ |
58 |
+ | ARM | Neoverse-N1 | #1349291 | N/A | |
59 |
+ +----------------+-----------------+-----------------+-----------------------------+ |
60 |
++| ARM | Neoverse-N1 | #1542419 | ARM64_ERRATUM_1542419 | |
61 |
+++----------------+-----------------+-----------------+-----------------------------+ |
62 |
+ | ARM | MMU-500 | #841119,826419 | N/A | |
63 |
+ +----------------+-----------------+-----------------+-----------------------------+ |
64 |
+ +----------------+-----------------+-----------------+-----------------------------+ |
65 |
+diff --git a/Makefile b/Makefile |
66 |
+index 6055a94aa4ce..947bf9e3a954 100644 |
67 |
+--- a/Makefile |
68 |
++++ b/Makefile |
69 |
+@@ -1,7 +1,7 @@ |
70 |
+ # SPDX-License-Identifier: GPL-2.0 |
71 |
+ VERSION = 5 |
72 |
+ PATCHLEVEL = 4 |
73 |
+-SUBLEVEL = 35 |
74 |
++SUBLEVEL = 36 |
75 |
+ EXTRAVERSION = |
76 |
+ NAME = Kleptomaniac Octopus |
77 |
+ |
78 |
+diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile |
79 |
+index 03506ce46149..e7364e6c8c6b 100644 |
80 |
+--- a/arch/arm/mach-imx/Makefile |
81 |
++++ b/arch/arm/mach-imx/Makefile |
82 |
+@@ -91,8 +91,10 @@ AFLAGS_suspend-imx6.o :=-Wa,-march=armv7-a |
83 |
+ obj-$(CONFIG_SOC_IMX6) += suspend-imx6.o |
84 |
+ obj-$(CONFIG_SOC_IMX53) += suspend-imx53.o |
85 |
+ endif |
86 |
++ifeq ($(CONFIG_ARM_CPU_SUSPEND),y) |
87 |
+ AFLAGS_resume-imx6.o :=-Wa,-march=armv7-a |
88 |
+ obj-$(CONFIG_SOC_IMX6) += resume-imx6.o |
89 |
++endif |
90 |
+ obj-$(CONFIG_SOC_IMX6) += pm-imx6.o |
91 |
+ |
92 |
+ obj-$(CONFIG_SOC_IMX1) += mach-imx1.o |
93 |
+diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig |
94 |
+index 6ccd2ed30963..a0bc9bbb92f3 100644 |
95 |
+--- a/arch/arm64/Kconfig |
96 |
++++ b/arch/arm64/Kconfig |
97 |
+@@ -559,6 +559,22 @@ config ARM64_ERRATUM_1463225 |
98 |
+ |
99 |
+ If unsure, say Y. |
100 |
+ |
101 |
++config ARM64_ERRATUM_1542419 |
102 |
++ bool "Neoverse-N1: workaround mis-ordering of instruction fetches" |
103 |
++ default y |
104 |
++ help |
105 |
++ This option adds a workaround for ARM Neoverse-N1 erratum |
106 |
++ 1542419. |
107 |
++ |
108 |
++ Affected Neoverse-N1 cores could execute a stale instruction when |
109 |
++ modified by another CPU. The workaround depends on a firmware |
110 |
++ counterpart. |
111 |
++ |
112 |
++ Workaround the issue by hiding the DIC feature from EL0. This |
113 |
++ forces user-space to perform cache maintenance. |
114 |
++ |
115 |
++ If unsure, say Y. |
116 |
++ |
117 |
+ config CAVIUM_ERRATUM_22375 |
118 |
+ bool "Cavium erratum 22375, 24313" |
119 |
+ default y |
120 |
+diff --git a/arch/arm64/include/asm/cache.h b/arch/arm64/include/asm/cache.h |
121 |
+index 43da6dd29592..806e9dc2a852 100644 |
122 |
+--- a/arch/arm64/include/asm/cache.h |
123 |
++++ b/arch/arm64/include/asm/cache.h |
124 |
+@@ -11,6 +11,7 @@ |
125 |
+ #define CTR_L1IP_MASK 3 |
126 |
+ #define CTR_DMINLINE_SHIFT 16 |
127 |
+ #define CTR_IMINLINE_SHIFT 0 |
128 |
++#define CTR_IMINLINE_MASK 0xf |
129 |
+ #define CTR_ERG_SHIFT 20 |
130 |
+ #define CTR_CWG_SHIFT 24 |
131 |
+ #define CTR_CWG_MASK 15 |
132 |
+@@ -18,7 +19,7 @@ |
133 |
+ #define CTR_DIC_SHIFT 29 |
134 |
+ |
135 |
+ #define CTR_CACHE_MINLINE_MASK \ |
136 |
+- (0xf << CTR_DMINLINE_SHIFT | 0xf << CTR_IMINLINE_SHIFT) |
137 |
++ (0xf << CTR_DMINLINE_SHIFT | CTR_IMINLINE_MASK << CTR_IMINLINE_SHIFT) |
138 |
+ |
139 |
+ #define CTR_L1IP(ctr) (((ctr) >> CTR_L1IP_SHIFT) & CTR_L1IP_MASK) |
140 |
+ |
141 |
+diff --git a/arch/arm64/include/asm/compat.h b/arch/arm64/include/asm/compat.h |
142 |
+index b0d53a265f1d..7b4172ce497c 100644 |
143 |
+--- a/arch/arm64/include/asm/compat.h |
144 |
++++ b/arch/arm64/include/asm/compat.h |
145 |
+@@ -4,6 +4,9 @@ |
146 |
+ */ |
147 |
+ #ifndef __ASM_COMPAT_H |
148 |
+ #define __ASM_COMPAT_H |
149 |
++ |
150 |
++#include <asm-generic/compat.h> |
151 |
++ |
152 |
+ #ifdef CONFIG_COMPAT |
153 |
+ |
154 |
+ /* |
155 |
+@@ -13,8 +16,6 @@ |
156 |
+ #include <linux/sched.h> |
157 |
+ #include <linux/sched/task_stack.h> |
158 |
+ |
159 |
+-#include <asm-generic/compat.h> |
160 |
+- |
161 |
+ #define COMPAT_USER_HZ 100 |
162 |
+ #ifdef __AARCH64EB__ |
163 |
+ #define COMPAT_UTS_MACHINE "armv8b\0\0" |
164 |
+diff --git a/arch/arm64/include/asm/cpucaps.h b/arch/arm64/include/asm/cpucaps.h |
165 |
+index ac1dbca3d0cd..1dc3c762fdcb 100644 |
166 |
+--- a/arch/arm64/include/asm/cpucaps.h |
167 |
++++ b/arch/arm64/include/asm/cpucaps.h |
168 |
+@@ -54,7 +54,8 @@ |
169 |
+ #define ARM64_WORKAROUND_1463225 44 |
170 |
+ #define ARM64_WORKAROUND_CAVIUM_TX2_219_TVM 45 |
171 |
+ #define ARM64_WORKAROUND_CAVIUM_TX2_219_PRFM 46 |
172 |
++#define ARM64_WORKAROUND_1542419 47 |
173 |
+ |
174 |
+-#define ARM64_NCAPS 47 |
175 |
++#define ARM64_NCAPS 48 |
176 |
+ |
177 |
+ #endif /* __ASM_CPUCAPS_H */ |
178 |
+diff --git a/arch/arm64/kernel/cpu_errata.c b/arch/arm64/kernel/cpu_errata.c |
179 |
+index 96f576e9ea46..0b2830379fe0 100644 |
180 |
+--- a/arch/arm64/kernel/cpu_errata.c |
181 |
++++ b/arch/arm64/kernel/cpu_errata.c |
182 |
+@@ -88,13 +88,21 @@ has_mismatched_cache_type(const struct arm64_cpu_capabilities *entry, |
183 |
+ } |
184 |
+ |
185 |
+ static void |
186 |
+-cpu_enable_trap_ctr_access(const struct arm64_cpu_capabilities *__unused) |
187 |
++cpu_enable_trap_ctr_access(const struct arm64_cpu_capabilities *cap) |
188 |
+ { |
189 |
+ u64 mask = arm64_ftr_reg_ctrel0.strict_mask; |
190 |
++ bool enable_uct_trap = false; |
191 |
+ |
192 |
+ /* Trap CTR_EL0 access on this CPU, only if it has a mismatch */ |
193 |
+ if ((read_cpuid_cachetype() & mask) != |
194 |
+ (arm64_ftr_reg_ctrel0.sys_val & mask)) |
195 |
++ enable_uct_trap = true; |
196 |
++ |
197 |
++ /* ... or if the system is affected by an erratum */ |
198 |
++ if (cap->capability == ARM64_WORKAROUND_1542419) |
199 |
++ enable_uct_trap = true; |
200 |
++ |
201 |
++ if (enable_uct_trap) |
202 |
+ sysreg_clear_set(sctlr_el1, SCTLR_EL1_UCT, 0); |
203 |
+ } |
204 |
+ |
205 |
+@@ -651,6 +659,18 @@ needs_tx2_tvm_workaround(const struct arm64_cpu_capabilities *entry, |
206 |
+ return false; |
207 |
+ } |
208 |
+ |
209 |
++static bool __maybe_unused |
210 |
++has_neoverse_n1_erratum_1542419(const struct arm64_cpu_capabilities *entry, |
211 |
++ int scope) |
212 |
++{ |
213 |
++ u32 midr = read_cpuid_id(); |
214 |
++ bool has_dic = read_cpuid_cachetype() & BIT(CTR_DIC_SHIFT); |
215 |
++ const struct midr_range range = MIDR_ALL_VERSIONS(MIDR_NEOVERSE_N1); |
216 |
++ |
217 |
++ WARN_ON(scope != SCOPE_LOCAL_CPU || preemptible()); |
218 |
++ return is_midr_in_range(midr, &range) && has_dic; |
219 |
++} |
220 |
++ |
221 |
+ #ifdef CONFIG_HARDEN_EL2_VECTORS |
222 |
+ |
223 |
+ static const struct midr_range arm64_harden_el2_vectors[] = { |
224 |
+@@ -927,6 +947,16 @@ const struct arm64_cpu_capabilities arm64_errata[] = { |
225 |
+ .capability = ARM64_WORKAROUND_CAVIUM_TX2_219_PRFM, |
226 |
+ ERRATA_MIDR_RANGE_LIST(tx2_family_cpus), |
227 |
+ }, |
228 |
++#endif |
229 |
++#ifdef CONFIG_ARM64_ERRATUM_1542419 |
230 |
++ { |
231 |
++ /* we depend on the firmware portion for correctness */ |
232 |
++ .desc = "ARM erratum 1542419 (kernel portion)", |
233 |
++ .capability = ARM64_WORKAROUND_1542419, |
234 |
++ .type = ARM64_CPUCAP_LOCAL_CPU_ERRATUM, |
235 |
++ .matches = has_neoverse_n1_erratum_1542419, |
236 |
++ .cpu_enable = cpu_enable_trap_ctr_access, |
237 |
++ }, |
238 |
+ #endif |
239 |
+ { |
240 |
+ } |
241 |
+diff --git a/arch/arm64/kernel/sys_compat.c b/arch/arm64/kernel/sys_compat.c |
242 |
+index f1cb64959427..3c18c2454089 100644 |
243 |
+--- a/arch/arm64/kernel/sys_compat.c |
244 |
++++ b/arch/arm64/kernel/sys_compat.c |
245 |
+@@ -8,6 +8,7 @@ |
246 |
+ */ |
247 |
+ |
248 |
+ #include <linux/compat.h> |
249 |
++#include <linux/cpufeature.h> |
250 |
+ #include <linux/personality.h> |
251 |
+ #include <linux/sched.h> |
252 |
+ #include <linux/sched/signal.h> |
253 |
+@@ -17,6 +18,7 @@ |
254 |
+ |
255 |
+ #include <asm/cacheflush.h> |
256 |
+ #include <asm/system_misc.h> |
257 |
++#include <asm/tlbflush.h> |
258 |
+ #include <asm/unistd.h> |
259 |
+ |
260 |
+ static long |
261 |
+@@ -30,6 +32,15 @@ __do_compat_cache_op(unsigned long start, unsigned long end) |
262 |
+ if (fatal_signal_pending(current)) |
263 |
+ return 0; |
264 |
+ |
265 |
++ if (cpus_have_const_cap(ARM64_WORKAROUND_1542419)) { |
266 |
++ /* |
267 |
++ * The workaround requires an inner-shareable tlbi. |
268 |
++ * We pick the reserved-ASID to minimise the impact. |
269 |
++ */ |
270 |
++ __tlbi(aside1is, __TLBI_VADDR(0, 0)); |
271 |
++ dsb(ish); |
272 |
++ } |
273 |
++ |
274 |
+ ret = __flush_cache_user_range(start, start + chunk); |
275 |
+ if (ret) |
276 |
+ return ret; |
277 |
+diff --git a/arch/arm64/kernel/traps.c b/arch/arm64/kernel/traps.c |
278 |
+index 34739e80211b..4e3e9d9c8151 100644 |
279 |
+--- a/arch/arm64/kernel/traps.c |
280 |
++++ b/arch/arm64/kernel/traps.c |
281 |
+@@ -470,6 +470,15 @@ static void ctr_read_handler(unsigned int esr, struct pt_regs *regs) |
282 |
+ int rt = ESR_ELx_SYS64_ISS_RT(esr); |
283 |
+ unsigned long val = arm64_ftr_reg_user_value(&arm64_ftr_reg_ctrel0); |
284 |
+ |
285 |
++ if (cpus_have_const_cap(ARM64_WORKAROUND_1542419)) { |
286 |
++ /* Hide DIC so that we can trap the unnecessary maintenance...*/ |
287 |
++ val &= ~BIT(CTR_DIC_SHIFT); |
288 |
++ |
289 |
++ /* ... and fake IminLine to reduce the number of traps. */ |
290 |
++ val &= ~CTR_IMINLINE_MASK; |
291 |
++ val |= (PAGE_SHIFT - 2) & CTR_IMINLINE_MASK; |
292 |
++ } |
293 |
++ |
294 |
+ pt_regs_write_reg(regs, rt, val); |
295 |
+ |
296 |
+ arm64_skip_faulting_instruction(regs, AARCH64_INSN_SIZE); |
297 |
+diff --git a/arch/powerpc/kernel/entry_32.S b/arch/powerpc/kernel/entry_32.S |
298 |
+index 13f699256258..f29bb176381f 100644 |
299 |
+--- a/arch/powerpc/kernel/entry_32.S |
300 |
++++ b/arch/powerpc/kernel/entry_32.S |
301 |
+@@ -705,7 +705,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_SPE) |
302 |
+ stw r10,_CCR(r1) |
303 |
+ stw r1,KSP(r3) /* Set old stack pointer */ |
304 |
+ |
305 |
+- kuap_check r2, r4 |
306 |
++ kuap_check r2, r0 |
307 |
+ #ifdef CONFIG_SMP |
308 |
+ /* We need a sync somewhere here to make sure that if the |
309 |
+ * previous task gets rescheduled on another CPU, it sees all |
310 |
+diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c |
311 |
+index d7ff21316cfa..e50fbed36651 100644 |
312 |
+--- a/arch/powerpc/kernel/setup_64.c |
313 |
++++ b/arch/powerpc/kernel/setup_64.c |
314 |
+@@ -541,6 +541,8 @@ static bool __init parse_cache_info(struct device_node *np, |
315 |
+ lsizep = of_get_property(np, propnames[3], NULL); |
316 |
+ if (bsizep == NULL) |
317 |
+ bsizep = lsizep; |
318 |
++ if (lsizep == NULL) |
319 |
++ lsizep = bsizep; |
320 |
+ if (lsizep != NULL) |
321 |
+ lsize = be32_to_cpu(*lsizep); |
322 |
+ if (bsizep != NULL) |
323 |
+diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c |
324 |
+index 11301a1187f3..0e0a2227af7d 100644 |
325 |
+--- a/arch/powerpc/kernel/time.c |
326 |
++++ b/arch/powerpc/kernel/time.c |
327 |
+@@ -522,35 +522,6 @@ static inline void clear_irq_work_pending(void) |
328 |
+ "i" (offsetof(struct paca_struct, irq_work_pending))); |
329 |
+ } |
330 |
+ |
331 |
+-void arch_irq_work_raise(void) |
332 |
+-{ |
333 |
+- preempt_disable(); |
334 |
+- set_irq_work_pending_flag(); |
335 |
+- /* |
336 |
+- * Non-nmi code running with interrupts disabled will replay |
337 |
+- * irq_happened before it re-enables interrupts, so setthe |
338 |
+- * decrementer there instead of causing a hardware exception |
339 |
+- * which would immediately hit the masked interrupt handler |
340 |
+- * and have the net effect of setting the decrementer in |
341 |
+- * irq_happened. |
342 |
+- * |
343 |
+- * NMI interrupts can not check this when they return, so the |
344 |
+- * decrementer hardware exception is raised, which will fire |
345 |
+- * when interrupts are next enabled. |
346 |
+- * |
347 |
+- * BookE does not support this yet, it must audit all NMI |
348 |
+- * interrupt handlers to ensure they call nmi_enter() so this |
349 |
+- * check would be correct. |
350 |
+- */ |
351 |
+- if (IS_ENABLED(CONFIG_BOOKE) || !irqs_disabled() || in_nmi()) { |
352 |
+- set_dec(1); |
353 |
+- } else { |
354 |
+- hard_irq_disable(); |
355 |
+- local_paca->irq_happened |= PACA_IRQ_DEC; |
356 |
+- } |
357 |
+- preempt_enable(); |
358 |
+-} |
359 |
+- |
360 |
+ #else /* 32-bit */ |
361 |
+ |
362 |
+ DEFINE_PER_CPU(u8, irq_work_pending); |
363 |
+@@ -559,16 +530,27 @@ DEFINE_PER_CPU(u8, irq_work_pending); |
364 |
+ #define test_irq_work_pending() __this_cpu_read(irq_work_pending) |
365 |
+ #define clear_irq_work_pending() __this_cpu_write(irq_work_pending, 0) |
366 |
+ |
367 |
++#endif /* 32 vs 64 bit */ |
368 |
++ |
369 |
+ void arch_irq_work_raise(void) |
370 |
+ { |
371 |
++ /* |
372 |
++ * 64-bit code that uses irq soft-mask can just cause an immediate |
373 |
++ * interrupt here that gets soft masked, if this is called under |
374 |
++ * local_irq_disable(). It might be possible to prevent that happening |
375 |
++ * by noticing interrupts are disabled and setting decrementer pending |
376 |
++ * to be replayed when irqs are enabled. The problem there is that |
377 |
++ * tracing can call irq_work_raise, including in code that does low |
378 |
++ * level manipulations of irq soft-mask state (e.g., trace_hardirqs_on) |
379 |
++ * which could get tangled up if we're messing with the same state |
380 |
++ * here. |
381 |
++ */ |
382 |
+ preempt_disable(); |
383 |
+ set_irq_work_pending_flag(); |
384 |
+ set_dec(1); |
385 |
+ preempt_enable(); |
386 |
+ } |
387 |
+ |
388 |
+-#endif /* 32 vs 64 bit */ |
389 |
+- |
390 |
+ #else /* CONFIG_IRQ_WORK */ |
391 |
+ |
392 |
+ #define test_irq_work_pending() 0 |
393 |
+diff --git a/arch/powerpc/platforms/Kconfig.cputype b/arch/powerpc/platforms/Kconfig.cputype |
394 |
+index 12543e53fa96..f0330ce498d1 100644 |
395 |
+--- a/arch/powerpc/platforms/Kconfig.cputype |
396 |
++++ b/arch/powerpc/platforms/Kconfig.cputype |
397 |
+@@ -389,7 +389,7 @@ config PPC_KUAP |
398 |
+ |
399 |
+ config PPC_KUAP_DEBUG |
400 |
+ bool "Extra debugging for Kernel Userspace Access Protection" |
401 |
+- depends on PPC_HAVE_KUAP && (PPC_RADIX_MMU || PPC_32) |
402 |
++ depends on PPC_KUAP && (PPC_RADIX_MMU || PPC32) |
403 |
+ help |
404 |
+ Add extra debugging for Kernel Userspace Access Protection (KUAP) |
405 |
+ If you're unsure, say N. |
406 |
+diff --git a/arch/powerpc/platforms/pseries/ras.c b/arch/powerpc/platforms/pseries/ras.c |
407 |
+index 3acdcc3bb908..753adeb624f2 100644 |
408 |
+--- a/arch/powerpc/platforms/pseries/ras.c |
409 |
++++ b/arch/powerpc/platforms/pseries/ras.c |
410 |
+@@ -683,6 +683,17 @@ static int mce_handle_error(struct pt_regs *regs, struct rtas_error_log *errp) |
411 |
+ #endif |
412 |
+ |
413 |
+ out: |
414 |
++ /* |
415 |
++ * Enable translation as we will be accessing per-cpu variables |
416 |
++ * in save_mce_event() which may fall outside RMO region, also |
417 |
++ * leave it enabled because subsequently we will be queuing work |
418 |
++ * to workqueues where again per-cpu variables accessed, besides |
419 |
++ * fwnmi_release_errinfo() crashes when called in realmode on |
420 |
++ * pseries. |
421 |
++ * Note: All the realmode handling like flushing SLB entries for |
422 |
++ * SLB multihit is done by now. |
423 |
++ */ |
424 |
++ mtmsr(mfmsr() | MSR_IR | MSR_DR); |
425 |
+ save_mce_event(regs, disposition == RTAS_DISP_FULLY_RECOVERED, |
426 |
+ &mce_err, regs->nip, eaddr, paddr); |
427 |
+ |
428 |
+diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c |
429 |
+index 756c627f7e54..6fb17b550a80 100644 |
430 |
+--- a/arch/s390/kvm/kvm-s390.c |
431 |
++++ b/arch/s390/kvm/kvm-s390.c |
432 |
+@@ -1932,6 +1932,9 @@ static int gfn_to_memslot_approx(struct kvm_memslots *slots, gfn_t gfn) |
433 |
+ start = slot + 1; |
434 |
+ } |
435 |
+ |
436 |
++ if (start >= slots->used_slots) |
437 |
++ return slots->used_slots - 1; |
438 |
++ |
439 |
+ if (gfn >= memslots[start].base_gfn && |
440 |
+ gfn < memslots[start].base_gfn + memslots[start].npages) { |
441 |
+ atomic_set(&slots->lru_slot, start); |
442 |
+diff --git a/arch/s390/lib/uaccess.c b/arch/s390/lib/uaccess.c |
443 |
+index c4f8039a35e8..0267405ab7c6 100644 |
444 |
+--- a/arch/s390/lib/uaccess.c |
445 |
++++ b/arch/s390/lib/uaccess.c |
446 |
+@@ -64,10 +64,13 @@ mm_segment_t enable_sacf_uaccess(void) |
447 |
+ { |
448 |
+ mm_segment_t old_fs; |
449 |
+ unsigned long asce, cr; |
450 |
++ unsigned long flags; |
451 |
+ |
452 |
+ old_fs = current->thread.mm_segment; |
453 |
+ if (old_fs & 1) |
454 |
+ return old_fs; |
455 |
++ /* protect against a concurrent page table upgrade */ |
456 |
++ local_irq_save(flags); |
457 |
+ current->thread.mm_segment |= 1; |
458 |
+ asce = S390_lowcore.kernel_asce; |
459 |
+ if (likely(old_fs == USER_DS)) { |
460 |
+@@ -83,6 +86,7 @@ mm_segment_t enable_sacf_uaccess(void) |
461 |
+ __ctl_load(asce, 7, 7); |
462 |
+ set_cpu_flag(CIF_ASCE_SECONDARY); |
463 |
+ } |
464 |
++ local_irq_restore(flags); |
465 |
+ return old_fs; |
466 |
+ } |
467 |
+ EXPORT_SYMBOL(enable_sacf_uaccess); |
468 |
+diff --git a/arch/s390/mm/pgalloc.c b/arch/s390/mm/pgalloc.c |
469 |
+index 3dd253f81a77..46071be897ab 100644 |
470 |
+--- a/arch/s390/mm/pgalloc.c |
471 |
++++ b/arch/s390/mm/pgalloc.c |
472 |
+@@ -70,8 +70,20 @@ static void __crst_table_upgrade(void *arg) |
473 |
+ { |
474 |
+ struct mm_struct *mm = arg; |
475 |
+ |
476 |
+- if (current->active_mm == mm) |
477 |
+- set_user_asce(mm); |
478 |
++ /* we must change all active ASCEs to avoid the creation of new TLBs */ |
479 |
++ if (current->active_mm == mm) { |
480 |
++ S390_lowcore.user_asce = mm->context.asce; |
481 |
++ if (current->thread.mm_segment == USER_DS) { |
482 |
++ __ctl_load(S390_lowcore.user_asce, 1, 1); |
483 |
++ /* Mark user-ASCE present in CR1 */ |
484 |
++ clear_cpu_flag(CIF_ASCE_PRIMARY); |
485 |
++ } |
486 |
++ if (current->thread.mm_segment == USER_DS_SACF) { |
487 |
++ __ctl_load(S390_lowcore.user_asce, 7, 7); |
488 |
++ /* enable_sacf_uaccess does all or nothing */ |
489 |
++ WARN_ON(!test_cpu_flag(CIF_ASCE_SECONDARY)); |
490 |
++ } |
491 |
++ } |
492 |
+ __tlb_flush_local(); |
493 |
+ } |
494 |
+ |
495 |
+diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c |
496 |
+index 39a116d43993..72f51275247e 100644 |
497 |
+--- a/arch/x86/kvm/vmx/vmx.c |
498 |
++++ b/arch/x86/kvm/vmx/vmx.c |
499 |
+@@ -4566,7 +4566,7 @@ static int handle_rmode_exception(struct kvm_vcpu *vcpu, |
500 |
+ */ |
501 |
+ static void kvm_machine_check(void) |
502 |
+ { |
503 |
+-#if defined(CONFIG_X86_MCE) && defined(CONFIG_X86_64) |
504 |
++#if defined(CONFIG_X86_MCE) |
505 |
+ struct pt_regs regs = { |
506 |
+ .cs = 3, /* Fake ring 3 no matter what the guest ran on */ |
507 |
+ .flags = X86_EFLAGS_IF, |
508 |
+diff --git a/drivers/block/loop.c b/drivers/block/loop.c |
509 |
+index ef6e251857c8..57ed6b70d295 100644 |
510 |
+--- a/drivers/block/loop.c |
511 |
++++ b/drivers/block/loop.c |
512 |
+@@ -427,11 +427,12 @@ static int lo_fallocate(struct loop_device *lo, struct request *rq, loff_t pos, |
513 |
+ * information. |
514 |
+ */ |
515 |
+ struct file *file = lo->lo_backing_file; |
516 |
++ struct request_queue *q = lo->lo_queue; |
517 |
+ int ret; |
518 |
+ |
519 |
+ mode |= FALLOC_FL_KEEP_SIZE; |
520 |
+ |
521 |
+- if ((!file->f_op->fallocate) || lo->lo_encrypt_key_size) { |
522 |
++ if (!blk_queue_discard(q)) { |
523 |
+ ret = -EOPNOTSUPP; |
524 |
+ goto out; |
525 |
+ } |
526 |
+@@ -863,28 +864,47 @@ static void loop_config_discard(struct loop_device *lo) |
527 |
+ struct inode *inode = file->f_mapping->host; |
528 |
+ struct request_queue *q = lo->lo_queue; |
529 |
+ |
530 |
++ /* |
531 |
++ * If the backing device is a block device, mirror its zeroing |
532 |
++ * capability. Set the discard sectors to the block device's zeroing |
533 |
++ * capabilities because loop discards result in blkdev_issue_zeroout(), |
534 |
++ * not blkdev_issue_discard(). This maintains consistent behavior with |
535 |
++ * file-backed loop devices: discarded regions read back as zero. |
536 |
++ */ |
537 |
++ if (S_ISBLK(inode->i_mode) && !lo->lo_encrypt_key_size) { |
538 |
++ struct request_queue *backingq; |
539 |
++ |
540 |
++ backingq = bdev_get_queue(inode->i_bdev); |
541 |
++ blk_queue_max_discard_sectors(q, |
542 |
++ backingq->limits.max_write_zeroes_sectors); |
543 |
++ |
544 |
++ blk_queue_max_write_zeroes_sectors(q, |
545 |
++ backingq->limits.max_write_zeroes_sectors); |
546 |
++ |
547 |
+ /* |
548 |
+ * We use punch hole to reclaim the free space used by the |
549 |
+ * image a.k.a. discard. However we do not support discard if |
550 |
+ * encryption is enabled, because it may give an attacker |
551 |
+ * useful information. |
552 |
+ */ |
553 |
+- if ((!file->f_op->fallocate) || |
554 |
+- lo->lo_encrypt_key_size) { |
555 |
++ } else if (!file->f_op->fallocate || lo->lo_encrypt_key_size) { |
556 |
+ q->limits.discard_granularity = 0; |
557 |
+ q->limits.discard_alignment = 0; |
558 |
+ blk_queue_max_discard_sectors(q, 0); |
559 |
+ blk_queue_max_write_zeroes_sectors(q, 0); |
560 |
+- blk_queue_flag_clear(QUEUE_FLAG_DISCARD, q); |
561 |
+- return; |
562 |
+- } |
563 |
+ |
564 |
+- q->limits.discard_granularity = inode->i_sb->s_blocksize; |
565 |
+- q->limits.discard_alignment = 0; |
566 |
++ } else { |
567 |
++ q->limits.discard_granularity = inode->i_sb->s_blocksize; |
568 |
++ q->limits.discard_alignment = 0; |
569 |
+ |
570 |
+- blk_queue_max_discard_sectors(q, UINT_MAX >> 9); |
571 |
+- blk_queue_max_write_zeroes_sectors(q, UINT_MAX >> 9); |
572 |
+- blk_queue_flag_set(QUEUE_FLAG_DISCARD, q); |
573 |
++ blk_queue_max_discard_sectors(q, UINT_MAX >> 9); |
574 |
++ blk_queue_max_write_zeroes_sectors(q, UINT_MAX >> 9); |
575 |
++ } |
576 |
++ |
577 |
++ if (q->limits.max_write_zeroes_sectors) |
578 |
++ blk_queue_flag_set(QUEUE_FLAG_DISCARD, q); |
579 |
++ else |
580 |
++ blk_queue_flag_clear(QUEUE_FLAG_DISCARD, q); |
581 |
+ } |
582 |
+ |
583 |
+ static void loop_unprepare_queue(struct loop_device *lo) |
584 |
+diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c |
585 |
+index c2ed3e9128e3..a55383b139df 100644 |
586 |
+--- a/drivers/block/virtio_blk.c |
587 |
++++ b/drivers/block/virtio_blk.c |
588 |
+@@ -345,9 +345,14 @@ static blk_status_t virtio_queue_rq(struct blk_mq_hw_ctx *hctx, |
589 |
+ if (err == -ENOSPC) |
590 |
+ blk_mq_stop_hw_queue(hctx); |
591 |
+ spin_unlock_irqrestore(&vblk->vqs[qid].lock, flags); |
592 |
+- if (err == -ENOMEM || err == -ENOSPC) |
593 |
++ switch (err) { |
594 |
++ case -ENOSPC: |
595 |
+ return BLK_STS_DEV_RESOURCE; |
596 |
+- return BLK_STS_IOERR; |
597 |
++ case -ENOMEM: |
598 |
++ return BLK_STS_RESOURCE; |
599 |
++ default: |
600 |
++ return BLK_STS_IOERR; |
601 |
++ } |
602 |
+ } |
603 |
+ |
604 |
+ if (bd->last && virtqueue_kick_prepare(vblk->vqs[qid].vq)) |
605 |
+diff --git a/drivers/char/tpm/tpm-interface.c b/drivers/char/tpm/tpm-interface.c |
606 |
+index d7a3888ad80f..b86ee5b18855 100644 |
607 |
+--- a/drivers/char/tpm/tpm-interface.c |
608 |
++++ b/drivers/char/tpm/tpm-interface.c |
609 |
+@@ -322,7 +322,7 @@ int tpm_pcr_extend(struct tpm_chip *chip, u32 pcr_idx, |
610 |
+ |
611 |
+ for (i = 0; i < chip->nr_allocated_banks; i++) { |
612 |
+ if (digests[i].alg_id != chip->allocated_banks[i].alg_id) { |
613 |
+- rc = EINVAL; |
614 |
++ rc = -EINVAL; |
615 |
+ goto out; |
616 |
+ } |
617 |
+ } |
618 |
+diff --git a/drivers/char/tpm/tpm_ibmvtpm.c b/drivers/char/tpm/tpm_ibmvtpm.c |
619 |
+index 78cc52690177..e82013d587b4 100644 |
620 |
+--- a/drivers/char/tpm/tpm_ibmvtpm.c |
621 |
++++ b/drivers/char/tpm/tpm_ibmvtpm.c |
622 |
+@@ -1,6 +1,6 @@ |
623 |
+ // SPDX-License-Identifier: GPL-2.0-only |
624 |
+ /* |
625 |
+- * Copyright (C) 2012 IBM Corporation |
626 |
++ * Copyright (C) 2012-2020 IBM Corporation |
627 |
+ * |
628 |
+ * Author: Ashley Lai <ashleydlai@×××××.com> |
629 |
+ * |
630 |
+@@ -133,6 +133,64 @@ static int tpm_ibmvtpm_recv(struct tpm_chip *chip, u8 *buf, size_t count) |
631 |
+ return len; |
632 |
+ } |
633 |
+ |
634 |
++/** |
635 |
++ * ibmvtpm_crq_send_init - Send a CRQ initialize message |
636 |
++ * @ibmvtpm: vtpm device struct |
637 |
++ * |
638 |
++ * Return: |
639 |
++ * 0 on success. |
640 |
++ * Non-zero on failure. |
641 |
++ */ |
642 |
++static int ibmvtpm_crq_send_init(struct ibmvtpm_dev *ibmvtpm) |
643 |
++{ |
644 |
++ int rc; |
645 |
++ |
646 |
++ rc = ibmvtpm_send_crq_word(ibmvtpm->vdev, INIT_CRQ_CMD); |
647 |
++ if (rc != H_SUCCESS) |
648 |
++ dev_err(ibmvtpm->dev, |
649 |
++ "%s failed rc=%d\n", __func__, rc); |
650 |
++ |
651 |
++ return rc; |
652 |
++} |
653 |
++ |
654 |
++/** |
655 |
++ * tpm_ibmvtpm_resume - Resume from suspend |
656 |
++ * |
657 |
++ * @dev: device struct |
658 |
++ * |
659 |
++ * Return: Always 0. |
660 |
++ */ |
661 |
++static int tpm_ibmvtpm_resume(struct device *dev) |
662 |
++{ |
663 |
++ struct tpm_chip *chip = dev_get_drvdata(dev); |
664 |
++ struct ibmvtpm_dev *ibmvtpm = dev_get_drvdata(&chip->dev); |
665 |
++ int rc = 0; |
666 |
++ |
667 |
++ do { |
668 |
++ if (rc) |
669 |
++ msleep(100); |
670 |
++ rc = plpar_hcall_norets(H_ENABLE_CRQ, |
671 |
++ ibmvtpm->vdev->unit_address); |
672 |
++ } while (rc == H_IN_PROGRESS || rc == H_BUSY || H_IS_LONG_BUSY(rc)); |
673 |
++ |
674 |
++ if (rc) { |
675 |
++ dev_err(dev, "Error enabling ibmvtpm rc=%d\n", rc); |
676 |
++ return rc; |
677 |
++ } |
678 |
++ |
679 |
++ rc = vio_enable_interrupts(ibmvtpm->vdev); |
680 |
++ if (rc) { |
681 |
++ dev_err(dev, "Error vio_enable_interrupts rc=%d\n", rc); |
682 |
++ return rc; |
683 |
++ } |
684 |
++ |
685 |
++ rc = ibmvtpm_crq_send_init(ibmvtpm); |
686 |
++ if (rc) |
687 |
++ dev_err(dev, "Error send_init rc=%d\n", rc); |
688 |
++ |
689 |
++ return rc; |
690 |
++} |
691 |
++ |
692 |
+ /** |
693 |
+ * tpm_ibmvtpm_send() - Send a TPM command |
694 |
+ * @chip: tpm chip struct |
695 |
+@@ -146,6 +204,7 @@ static int tpm_ibmvtpm_recv(struct tpm_chip *chip, u8 *buf, size_t count) |
696 |
+ static int tpm_ibmvtpm_send(struct tpm_chip *chip, u8 *buf, size_t count) |
697 |
+ { |
698 |
+ struct ibmvtpm_dev *ibmvtpm = dev_get_drvdata(&chip->dev); |
699 |
++ bool retry = true; |
700 |
+ int rc, sig; |
701 |
+ |
702 |
+ if (!ibmvtpm->rtce_buf) { |
703 |
+@@ -179,18 +238,27 @@ static int tpm_ibmvtpm_send(struct tpm_chip *chip, u8 *buf, size_t count) |
704 |
+ */ |
705 |
+ ibmvtpm->tpm_processing_cmd = true; |
706 |
+ |
707 |
++again: |
708 |
+ rc = ibmvtpm_send_crq(ibmvtpm->vdev, |
709 |
+ IBMVTPM_VALID_CMD, VTPM_TPM_COMMAND, |
710 |
+ count, ibmvtpm->rtce_dma_handle); |
711 |
+ if (rc != H_SUCCESS) { |
712 |
++ /* |
713 |
++ * H_CLOSED can be returned after LPM resume. Call |
714 |
++ * tpm_ibmvtpm_resume() to re-enable the CRQ then retry |
715 |
++ * ibmvtpm_send_crq() once before failing. |
716 |
++ */ |
717 |
++ if (rc == H_CLOSED && retry) { |
718 |
++ tpm_ibmvtpm_resume(ibmvtpm->dev); |
719 |
++ retry = false; |
720 |
++ goto again; |
721 |
++ } |
722 |
+ dev_err(ibmvtpm->dev, "tpm_ibmvtpm_send failed rc=%d\n", rc); |
723 |
+- rc = 0; |
724 |
+ ibmvtpm->tpm_processing_cmd = false; |
725 |
+- } else |
726 |
+- rc = 0; |
727 |
++ } |
728 |
+ |
729 |
+ spin_unlock(&ibmvtpm->rtce_lock); |
730 |
+- return rc; |
731 |
++ return 0; |
732 |
+ } |
733 |
+ |
734 |
+ static void tpm_ibmvtpm_cancel(struct tpm_chip *chip) |
735 |
+@@ -268,26 +336,6 @@ static int ibmvtpm_crq_send_init_complete(struct ibmvtpm_dev *ibmvtpm) |
736 |
+ return rc; |
737 |
+ } |
738 |
+ |
739 |
+-/** |
740 |
+- * ibmvtpm_crq_send_init - Send a CRQ initialize message |
741 |
+- * @ibmvtpm: vtpm device struct |
742 |
+- * |
743 |
+- * Return: |
744 |
+- * 0 on success. |
745 |
+- * Non-zero on failure. |
746 |
+- */ |
747 |
+-static int ibmvtpm_crq_send_init(struct ibmvtpm_dev *ibmvtpm) |
748 |
+-{ |
749 |
+- int rc; |
750 |
+- |
751 |
+- rc = ibmvtpm_send_crq_word(ibmvtpm->vdev, INIT_CRQ_CMD); |
752 |
+- if (rc != H_SUCCESS) |
753 |
+- dev_err(ibmvtpm->dev, |
754 |
+- "ibmvtpm_crq_send_init failed rc=%d\n", rc); |
755 |
+- |
756 |
+- return rc; |
757 |
+-} |
758 |
+- |
759 |
+ /** |
760 |
+ * tpm_ibmvtpm_remove - ibm vtpm remove entry point |
761 |
+ * @vdev: vio device struct |
762 |
+@@ -400,44 +448,6 @@ static int ibmvtpm_reset_crq(struct ibmvtpm_dev *ibmvtpm) |
763 |
+ ibmvtpm->crq_dma_handle, CRQ_RES_BUF_SIZE); |
764 |
+ } |
765 |
+ |
766 |
+-/** |
767 |
+- * tpm_ibmvtpm_resume - Resume from suspend |
768 |
+- * |
769 |
+- * @dev: device struct |
770 |
+- * |
771 |
+- * Return: Always 0. |
772 |
+- */ |
773 |
+-static int tpm_ibmvtpm_resume(struct device *dev) |
774 |
+-{ |
775 |
+- struct tpm_chip *chip = dev_get_drvdata(dev); |
776 |
+- struct ibmvtpm_dev *ibmvtpm = dev_get_drvdata(&chip->dev); |
777 |
+- int rc = 0; |
778 |
+- |
779 |
+- do { |
780 |
+- if (rc) |
781 |
+- msleep(100); |
782 |
+- rc = plpar_hcall_norets(H_ENABLE_CRQ, |
783 |
+- ibmvtpm->vdev->unit_address); |
784 |
+- } while (rc == H_IN_PROGRESS || rc == H_BUSY || H_IS_LONG_BUSY(rc)); |
785 |
+- |
786 |
+- if (rc) { |
787 |
+- dev_err(dev, "Error enabling ibmvtpm rc=%d\n", rc); |
788 |
+- return rc; |
789 |
+- } |
790 |
+- |
791 |
+- rc = vio_enable_interrupts(ibmvtpm->vdev); |
792 |
+- if (rc) { |
793 |
+- dev_err(dev, "Error vio_enable_interrupts rc=%d\n", rc); |
794 |
+- return rc; |
795 |
+- } |
796 |
+- |
797 |
+- rc = ibmvtpm_crq_send_init(ibmvtpm); |
798 |
+- if (rc) |
799 |
+- dev_err(dev, "Error send_init rc=%d\n", rc); |
800 |
+- |
801 |
+- return rc; |
802 |
+-} |
803 |
+- |
804 |
+ static bool tpm_ibmvtpm_req_canceled(struct tpm_chip *chip, u8 status) |
805 |
+ { |
806 |
+ return (status == 0); |
807 |
+diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_core.c |
808 |
+index c3181ea9f271..bdcf8f25cd0d 100644 |
809 |
+--- a/drivers/char/tpm/tpm_tis_core.c |
810 |
++++ b/drivers/char/tpm/tpm_tis_core.c |
811 |
+@@ -433,6 +433,9 @@ static void disable_interrupts(struct tpm_chip *chip) |
812 |
+ u32 intmask; |
813 |
+ int rc; |
814 |
+ |
815 |
++ if (priv->irq == 0) |
816 |
++ return; |
817 |
++ |
818 |
+ rc = tpm_tis_read32(priv, TPM_INT_ENABLE(priv->locality), &intmask); |
819 |
+ if (rc < 0) |
820 |
+ intmask = 0; |
821 |
+@@ -983,9 +986,12 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq, |
822 |
+ if (irq) { |
823 |
+ tpm_tis_probe_irq_single(chip, intmask, IRQF_SHARED, |
824 |
+ irq); |
825 |
+- if (!(chip->flags & TPM_CHIP_FLAG_IRQ)) |
826 |
++ if (!(chip->flags & TPM_CHIP_FLAG_IRQ)) { |
827 |
+ dev_err(&chip->dev, FW_BUG |
828 |
+ "TPM interrupt not working, polling instead\n"); |
829 |
++ |
830 |
++ disable_interrupts(chip); |
831 |
++ } |
832 |
+ } else { |
833 |
+ tpm_tis_probe_irq(chip, intmask); |
834 |
+ } |
835 |
+diff --git a/drivers/fpga/dfl-pci.c b/drivers/fpga/dfl-pci.c |
836 |
+index 89ca292236ad..538755062ab7 100644 |
837 |
+--- a/drivers/fpga/dfl-pci.c |
838 |
++++ b/drivers/fpga/dfl-pci.c |
839 |
+@@ -248,11 +248,13 @@ static int cci_pci_sriov_configure(struct pci_dev *pcidev, int num_vfs) |
840 |
+ return ret; |
841 |
+ |
842 |
+ ret = pci_enable_sriov(pcidev, num_vfs); |
843 |
+- if (ret) |
844 |
++ if (ret) { |
845 |
+ dfl_fpga_cdev_config_ports_pf(cdev); |
846 |
++ return ret; |
847 |
++ } |
848 |
+ } |
849 |
+ |
850 |
+- return ret; |
851 |
++ return num_vfs; |
852 |
+ } |
853 |
+ |
854 |
+ static void cci_pci_remove(struct pci_dev *pcidev) |
855 |
+diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c b/drivers/gpu/drm/amd/display/dc/core/dc.c |
856 |
+index 4704aac336c2..2028dc017f7a 100644 |
857 |
+--- a/drivers/gpu/drm/amd/display/dc/core/dc.c |
858 |
++++ b/drivers/gpu/drm/amd/display/dc/core/dc.c |
859 |
+@@ -283,6 +283,8 @@ bool dc_stream_adjust_vmin_vmax(struct dc *dc, |
860 |
+ int i = 0; |
861 |
+ bool ret = false; |
862 |
+ |
863 |
++ stream->adjust = *adjust; |
864 |
++ |
865 |
+ for (i = 0; i < MAX_PIPES; i++) { |
866 |
+ struct pipe_ctx *pipe = &dc->current_state->res_ctx.pipe_ctx[i]; |
867 |
+ |
868 |
+@@ -1180,6 +1182,26 @@ bool dc_commit_state(struct dc *dc, struct dc_state *context) |
869 |
+ return (result == DC_OK); |
870 |
+ } |
871 |
+ |
872 |
++static bool is_flip_pending_in_pipes(struct dc *dc, struct dc_state *context) |
873 |
++{ |
874 |
++ int i; |
875 |
++ struct pipe_ctx *pipe; |
876 |
++ |
877 |
++ for (i = 0; i < MAX_PIPES; i++) { |
878 |
++ pipe = &context->res_ctx.pipe_ctx[i]; |
879 |
++ |
880 |
++ if (!pipe->plane_state) |
881 |
++ continue; |
882 |
++ |
883 |
++ /* Must set to false to start with, due to OR in update function */ |
884 |
++ pipe->plane_state->status.is_flip_pending = false; |
885 |
++ dc->hwss.update_pending_status(pipe); |
886 |
++ if (pipe->plane_state->status.is_flip_pending) |
887 |
++ return true; |
888 |
++ } |
889 |
++ return false; |
890 |
++} |
891 |
++ |
892 |
+ bool dc_post_update_surfaces_to_stream(struct dc *dc) |
893 |
+ { |
894 |
+ int i; |
895 |
+@@ -1190,6 +1212,9 @@ bool dc_post_update_surfaces_to_stream(struct dc *dc) |
896 |
+ |
897 |
+ post_surface_trace(dc); |
898 |
+ |
899 |
++ if (is_flip_pending_in_pipes(dc, context)) |
900 |
++ return true; |
901 |
++ |
902 |
+ for (i = 0; i < dc->res_pool->pipe_count; i++) |
903 |
+ if (context->res_ctx.pipe_ctx[i].stream == NULL || |
904 |
+ context->res_ctx.pipe_ctx[i].plane_state == NULL) { |
905 |
+@@ -2152,7 +2177,7 @@ void dc_commit_updates_for_stream(struct dc *dc, |
906 |
+ enum surface_update_type update_type; |
907 |
+ struct dc_state *context; |
908 |
+ struct dc_context *dc_ctx = dc->ctx; |
909 |
+- int i; |
910 |
++ int i, j; |
911 |
+ |
912 |
+ stream_status = dc_stream_get_status(stream); |
913 |
+ context = dc->current_state; |
914 |
+@@ -2190,6 +2215,17 @@ void dc_commit_updates_for_stream(struct dc *dc, |
915 |
+ |
916 |
+ copy_surface_update_to_plane(surface, &srf_updates[i]); |
917 |
+ |
918 |
++ if (update_type >= UPDATE_TYPE_MED) { |
919 |
++ for (j = 0; j < dc->res_pool->pipe_count; j++) { |
920 |
++ struct pipe_ctx *pipe_ctx = |
921 |
++ &context->res_ctx.pipe_ctx[j]; |
922 |
++ |
923 |
++ if (pipe_ctx->plane_state != surface) |
924 |
++ continue; |
925 |
++ |
926 |
++ resource_build_scaling_params(pipe_ctx); |
927 |
++ } |
928 |
++ } |
929 |
+ } |
930 |
+ |
931 |
+ copy_stream_update_to_stream(dc, context, stream, stream_update); |
932 |
+diff --git a/drivers/iio/adc/stm32-adc.c b/drivers/iio/adc/stm32-adc.c |
933 |
+index 73aee5949b6b..9f63ceb15865 100644 |
934 |
+--- a/drivers/iio/adc/stm32-adc.c |
935 |
++++ b/drivers/iio/adc/stm32-adc.c |
936 |
+@@ -1367,8 +1367,30 @@ static unsigned int stm32_adc_dma_residue(struct stm32_adc *adc) |
937 |
+ static void stm32_adc_dma_buffer_done(void *data) |
938 |
+ { |
939 |
+ struct iio_dev *indio_dev = data; |
940 |
++ struct stm32_adc *adc = iio_priv(indio_dev); |
941 |
++ int residue = stm32_adc_dma_residue(adc); |
942 |
++ |
943 |
++ /* |
944 |
++ * In DMA mode the trigger services of IIO are not used |
945 |
++ * (e.g. no call to iio_trigger_poll). |
946 |
++ * Calling irq handler associated to the hardware trigger is not |
947 |
++ * relevant as the conversions have already been done. Data |
948 |
++ * transfers are performed directly in DMA callback instead. |
949 |
++ * This implementation avoids to call trigger irq handler that |
950 |
++ * may sleep, in an atomic context (DMA irq handler context). |
951 |
++ */ |
952 |
++ dev_dbg(&indio_dev->dev, "%s bufi=%d\n", __func__, adc->bufi); |
953 |
+ |
954 |
+- iio_trigger_poll_chained(indio_dev->trig); |
955 |
++ while (residue >= indio_dev->scan_bytes) { |
956 |
++ u16 *buffer = (u16 *)&adc->rx_buf[adc->bufi]; |
957 |
++ |
958 |
++ iio_push_to_buffers(indio_dev, buffer); |
959 |
++ |
960 |
++ residue -= indio_dev->scan_bytes; |
961 |
++ adc->bufi += indio_dev->scan_bytes; |
962 |
++ if (adc->bufi >= adc->rx_buf_sz) |
963 |
++ adc->bufi = 0; |
964 |
++ } |
965 |
+ } |
966 |
+ |
967 |
+ static int stm32_adc_dma_start(struct iio_dev *indio_dev) |
968 |
+@@ -1778,6 +1800,7 @@ static int stm32_adc_probe(struct platform_device *pdev) |
969 |
+ { |
970 |
+ struct iio_dev *indio_dev; |
971 |
+ struct device *dev = &pdev->dev; |
972 |
++ irqreturn_t (*handler)(int irq, void *p) = NULL; |
973 |
+ struct stm32_adc *adc; |
974 |
+ int ret; |
975 |
+ |
976 |
+@@ -1843,9 +1866,11 @@ static int stm32_adc_probe(struct platform_device *pdev) |
977 |
+ if (ret < 0) |
978 |
+ return ret; |
979 |
+ |
980 |
++ if (!adc->dma_chan) |
981 |
++ handler = &stm32_adc_trigger_handler; |
982 |
++ |
983 |
+ ret = iio_triggered_buffer_setup(indio_dev, |
984 |
+- &iio_pollfunc_store_time, |
985 |
+- &stm32_adc_trigger_handler, |
986 |
++ &iio_pollfunc_store_time, handler, |
987 |
+ &stm32_adc_buffer_setup_ops); |
988 |
+ if (ret) { |
989 |
+ dev_err(&pdev->dev, "buffer setup failed\n"); |
990 |
+diff --git a/drivers/iio/adc/ti-ads8344.c b/drivers/iio/adc/ti-ads8344.c |
991 |
+index 9a460807d46d..abe4b56c847c 100644 |
992 |
+--- a/drivers/iio/adc/ti-ads8344.c |
993 |
++++ b/drivers/iio/adc/ti-ads8344.c |
994 |
+@@ -29,7 +29,7 @@ struct ads8344 { |
995 |
+ struct mutex lock; |
996 |
+ |
997 |
+ u8 tx_buf ____cacheline_aligned; |
998 |
+- u16 rx_buf; |
999 |
++ u8 rx_buf[3]; |
1000 |
+ }; |
1001 |
+ |
1002 |
+ #define ADS8344_VOLTAGE_CHANNEL(chan, si) \ |
1003 |
+@@ -89,11 +89,11 @@ static int ads8344_adc_conversion(struct ads8344 *adc, int channel, |
1004 |
+ |
1005 |
+ udelay(9); |
1006 |
+ |
1007 |
+- ret = spi_read(spi, &adc->rx_buf, 2); |
1008 |
++ ret = spi_read(spi, adc->rx_buf, sizeof(adc->rx_buf)); |
1009 |
+ if (ret) |
1010 |
+ return ret; |
1011 |
+ |
1012 |
+- return adc->rx_buf; |
1013 |
++ return adc->rx_buf[0] << 9 | adc->rx_buf[1] << 1 | adc->rx_buf[2] >> 7; |
1014 |
+ } |
1015 |
+ |
1016 |
+ static int ads8344_read_raw(struct iio_dev *iio, |
1017 |
+diff --git a/drivers/iio/adc/xilinx-xadc-core.c b/drivers/iio/adc/xilinx-xadc-core.c |
1018 |
+index 4fd389678dba..3f0b88b13dd3 100644 |
1019 |
+--- a/drivers/iio/adc/xilinx-xadc-core.c |
1020 |
++++ b/drivers/iio/adc/xilinx-xadc-core.c |
1021 |
+@@ -102,6 +102,16 @@ static const unsigned int XADC_ZYNQ_UNMASK_TIMEOUT = 500; |
1022 |
+ |
1023 |
+ #define XADC_FLAGS_BUFFERED BIT(0) |
1024 |
+ |
1025 |
++/* |
1026 |
++ * The XADC hardware supports a samplerate of up to 1MSPS. Unfortunately it does |
1027 |
++ * not have a hardware FIFO. Which means an interrupt is generated for each |
1028 |
++ * conversion sequence. At 1MSPS sample rate the CPU in ZYNQ7000 is completely |
1029 |
++ * overloaded by the interrupts that it soft-lockups. For this reason the driver |
1030 |
++ * limits the maximum samplerate 150kSPS. At this rate the CPU is fairly busy, |
1031 |
++ * but still responsive. |
1032 |
++ */ |
1033 |
++#define XADC_MAX_SAMPLERATE 150000 |
1034 |
++ |
1035 |
+ static void xadc_write_reg(struct xadc *xadc, unsigned int reg, |
1036 |
+ uint32_t val) |
1037 |
+ { |
1038 |
+@@ -674,7 +684,7 @@ static int xadc_trigger_set_state(struct iio_trigger *trigger, bool state) |
1039 |
+ |
1040 |
+ spin_lock_irqsave(&xadc->lock, flags); |
1041 |
+ xadc_read_reg(xadc, XADC_AXI_REG_IPIER, &val); |
1042 |
+- xadc_write_reg(xadc, XADC_AXI_REG_IPISR, val & XADC_AXI_INT_EOS); |
1043 |
++ xadc_write_reg(xadc, XADC_AXI_REG_IPISR, XADC_AXI_INT_EOS); |
1044 |
+ if (state) |
1045 |
+ val |= XADC_AXI_INT_EOS; |
1046 |
+ else |
1047 |
+@@ -722,13 +732,14 @@ static int xadc_power_adc_b(struct xadc *xadc, unsigned int seq_mode) |
1048 |
+ { |
1049 |
+ uint16_t val; |
1050 |
+ |
1051 |
++ /* Powerdown the ADC-B when it is not needed. */ |
1052 |
+ switch (seq_mode) { |
1053 |
+ case XADC_CONF1_SEQ_SIMULTANEOUS: |
1054 |
+ case XADC_CONF1_SEQ_INDEPENDENT: |
1055 |
+- val = XADC_CONF2_PD_ADC_B; |
1056 |
++ val = 0; |
1057 |
+ break; |
1058 |
+ default: |
1059 |
+- val = 0; |
1060 |
++ val = XADC_CONF2_PD_ADC_B; |
1061 |
+ break; |
1062 |
+ } |
1063 |
+ |
1064 |
+@@ -797,6 +808,16 @@ static int xadc_preenable(struct iio_dev *indio_dev) |
1065 |
+ if (ret) |
1066 |
+ goto err; |
1067 |
+ |
1068 |
++ /* |
1069 |
++ * In simultaneous mode the upper and lower aux channels are samples at |
1070 |
++ * the same time. In this mode the upper 8 bits in the sequencer |
1071 |
++ * register are don't care and the lower 8 bits control two channels |
1072 |
++ * each. As such we must set the bit if either the channel in the lower |
1073 |
++ * group or the upper group is enabled. |
1074 |
++ */ |
1075 |
++ if (seq_mode == XADC_CONF1_SEQ_SIMULTANEOUS) |
1076 |
++ scan_mask = ((scan_mask >> 8) | scan_mask) & 0xff0000; |
1077 |
++ |
1078 |
+ ret = xadc_write_adc_reg(xadc, XADC_REG_SEQ(1), scan_mask >> 16); |
1079 |
+ if (ret) |
1080 |
+ goto err; |
1081 |
+@@ -823,11 +844,27 @@ static const struct iio_buffer_setup_ops xadc_buffer_ops = { |
1082 |
+ .postdisable = &xadc_postdisable, |
1083 |
+ }; |
1084 |
+ |
1085 |
++static int xadc_read_samplerate(struct xadc *xadc) |
1086 |
++{ |
1087 |
++ unsigned int div; |
1088 |
++ uint16_t val16; |
1089 |
++ int ret; |
1090 |
++ |
1091 |
++ ret = xadc_read_adc_reg(xadc, XADC_REG_CONF2, &val16); |
1092 |
++ if (ret) |
1093 |
++ return ret; |
1094 |
++ |
1095 |
++ div = (val16 & XADC_CONF2_DIV_MASK) >> XADC_CONF2_DIV_OFFSET; |
1096 |
++ if (div < 2) |
1097 |
++ div = 2; |
1098 |
++ |
1099 |
++ return xadc_get_dclk_rate(xadc) / div / 26; |
1100 |
++} |
1101 |
++ |
1102 |
+ static int xadc_read_raw(struct iio_dev *indio_dev, |
1103 |
+ struct iio_chan_spec const *chan, int *val, int *val2, long info) |
1104 |
+ { |
1105 |
+ struct xadc *xadc = iio_priv(indio_dev); |
1106 |
+- unsigned int div; |
1107 |
+ uint16_t val16; |
1108 |
+ int ret; |
1109 |
+ |
1110 |
+@@ -880,41 +917,31 @@ static int xadc_read_raw(struct iio_dev *indio_dev, |
1111 |
+ *val = -((273150 << 12) / 503975); |
1112 |
+ return IIO_VAL_INT; |
1113 |
+ case IIO_CHAN_INFO_SAMP_FREQ: |
1114 |
+- ret = xadc_read_adc_reg(xadc, XADC_REG_CONF2, &val16); |
1115 |
+- if (ret) |
1116 |
++ ret = xadc_read_samplerate(xadc); |
1117 |
++ if (ret < 0) |
1118 |
+ return ret; |
1119 |
+ |
1120 |
+- div = (val16 & XADC_CONF2_DIV_MASK) >> XADC_CONF2_DIV_OFFSET; |
1121 |
+- if (div < 2) |
1122 |
+- div = 2; |
1123 |
+- |
1124 |
+- *val = xadc_get_dclk_rate(xadc) / div / 26; |
1125 |
+- |
1126 |
++ *val = ret; |
1127 |
+ return IIO_VAL_INT; |
1128 |
+ default: |
1129 |
+ return -EINVAL; |
1130 |
+ } |
1131 |
+ } |
1132 |
+ |
1133 |
+-static int xadc_write_raw(struct iio_dev *indio_dev, |
1134 |
+- struct iio_chan_spec const *chan, int val, int val2, long info) |
1135 |
++static int xadc_write_samplerate(struct xadc *xadc, int val) |
1136 |
+ { |
1137 |
+- struct xadc *xadc = iio_priv(indio_dev); |
1138 |
+ unsigned long clk_rate = xadc_get_dclk_rate(xadc); |
1139 |
+ unsigned int div; |
1140 |
+ |
1141 |
+ if (!clk_rate) |
1142 |
+ return -EINVAL; |
1143 |
+ |
1144 |
+- if (info != IIO_CHAN_INFO_SAMP_FREQ) |
1145 |
+- return -EINVAL; |
1146 |
+- |
1147 |
+ if (val <= 0) |
1148 |
+ return -EINVAL; |
1149 |
+ |
1150 |
+ /* Max. 150 kSPS */ |
1151 |
+- if (val > 150000) |
1152 |
+- val = 150000; |
1153 |
++ if (val > XADC_MAX_SAMPLERATE) |
1154 |
++ val = XADC_MAX_SAMPLERATE; |
1155 |
+ |
1156 |
+ val *= 26; |
1157 |
+ |
1158 |
+@@ -927,7 +954,7 @@ static int xadc_write_raw(struct iio_dev *indio_dev, |
1159 |
+ * limit. |
1160 |
+ */ |
1161 |
+ div = clk_rate / val; |
1162 |
+- if (clk_rate / div / 26 > 150000) |
1163 |
++ if (clk_rate / div / 26 > XADC_MAX_SAMPLERATE) |
1164 |
+ div++; |
1165 |
+ if (div < 2) |
1166 |
+ div = 2; |
1167 |
+@@ -938,6 +965,17 @@ static int xadc_write_raw(struct iio_dev *indio_dev, |
1168 |
+ div << XADC_CONF2_DIV_OFFSET); |
1169 |
+ } |
1170 |
+ |
1171 |
++static int xadc_write_raw(struct iio_dev *indio_dev, |
1172 |
++ struct iio_chan_spec const *chan, int val, int val2, long info) |
1173 |
++{ |
1174 |
++ struct xadc *xadc = iio_priv(indio_dev); |
1175 |
++ |
1176 |
++ if (info != IIO_CHAN_INFO_SAMP_FREQ) |
1177 |
++ return -EINVAL; |
1178 |
++ |
1179 |
++ return xadc_write_samplerate(xadc, val); |
1180 |
++} |
1181 |
++ |
1182 |
+ static const struct iio_event_spec xadc_temp_events[] = { |
1183 |
+ { |
1184 |
+ .type = IIO_EV_TYPE_THRESH, |
1185 |
+@@ -1225,6 +1263,21 @@ static int xadc_probe(struct platform_device *pdev) |
1186 |
+ if (ret) |
1187 |
+ goto err_free_samplerate_trigger; |
1188 |
+ |
1189 |
++ /* |
1190 |
++ * Make sure not to exceed the maximum samplerate since otherwise the |
1191 |
++ * resulting interrupt storm will soft-lock the system. |
1192 |
++ */ |
1193 |
++ if (xadc->ops->flags & XADC_FLAGS_BUFFERED) { |
1194 |
++ ret = xadc_read_samplerate(xadc); |
1195 |
++ if (ret < 0) |
1196 |
++ goto err_free_samplerate_trigger; |
1197 |
++ if (ret > XADC_MAX_SAMPLERATE) { |
1198 |
++ ret = xadc_write_samplerate(xadc, XADC_MAX_SAMPLERATE); |
1199 |
++ if (ret < 0) |
1200 |
++ goto err_free_samplerate_trigger; |
1201 |
++ } |
1202 |
++ } |
1203 |
++ |
1204 |
+ ret = request_irq(xadc->irq, xadc->ops->interrupt_handler, 0, |
1205 |
+ dev_name(&pdev->dev), indio_dev); |
1206 |
+ if (ret) |
1207 |
+diff --git a/drivers/iio/common/st_sensors/st_sensors_core.c b/drivers/iio/common/st_sensors/st_sensors_core.c |
1208 |
+index 4a3064fb6cd9..364683783ae5 100644 |
1209 |
+--- a/drivers/iio/common/st_sensors/st_sensors_core.c |
1210 |
++++ b/drivers/iio/common/st_sensors/st_sensors_core.c |
1211 |
+@@ -80,7 +80,7 @@ int st_sensors_set_odr(struct iio_dev *indio_dev, unsigned int odr) |
1212 |
+ struct st_sensor_odr_avl odr_out = {0, 0}; |
1213 |
+ struct st_sensor_data *sdata = iio_priv(indio_dev); |
1214 |
+ |
1215 |
+- if (!sdata->sensor_settings->odr.addr) |
1216 |
++ if (!sdata->sensor_settings->odr.mask) |
1217 |
+ return 0; |
1218 |
+ |
1219 |
+ err = st_sensors_match_odr(sdata->sensor_settings, odr, &odr_out); |
1220 |
+diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c |
1221 |
+index d618650533b6..14850b7fe6d7 100644 |
1222 |
+--- a/drivers/net/dsa/b53/b53_common.c |
1223 |
++++ b/drivers/net/dsa/b53/b53_common.c |
1224 |
+@@ -1441,6 +1441,10 @@ static int b53_arl_rw_op(struct b53_device *dev, unsigned int op) |
1225 |
+ reg |= ARLTBL_RW; |
1226 |
+ else |
1227 |
+ reg &= ~ARLTBL_RW; |
1228 |
++ if (dev->vlan_enabled) |
1229 |
++ reg &= ~ARLTBL_IVL_SVL_SELECT; |
1230 |
++ else |
1231 |
++ reg |= ARLTBL_IVL_SVL_SELECT; |
1232 |
+ b53_write8(dev, B53_ARLIO_PAGE, B53_ARLTBL_RW_CTRL, reg); |
1233 |
+ |
1234 |
+ return b53_arl_op_wait(dev); |
1235 |
+@@ -1450,6 +1454,7 @@ static int b53_arl_read(struct b53_device *dev, u64 mac, |
1236 |
+ u16 vid, struct b53_arl_entry *ent, u8 *idx, |
1237 |
+ bool is_valid) |
1238 |
+ { |
1239 |
++ DECLARE_BITMAP(free_bins, B53_ARLTBL_MAX_BIN_ENTRIES); |
1240 |
+ unsigned int i; |
1241 |
+ int ret; |
1242 |
+ |
1243 |
+@@ -1457,6 +1462,8 @@ static int b53_arl_read(struct b53_device *dev, u64 mac, |
1244 |
+ if (ret) |
1245 |
+ return ret; |
1246 |
+ |
1247 |
++ bitmap_zero(free_bins, dev->num_arl_entries); |
1248 |
++ |
1249 |
+ /* Read the bins */ |
1250 |
+ for (i = 0; i < dev->num_arl_entries; i++) { |
1251 |
+ u64 mac_vid; |
1252 |
+@@ -1468,13 +1475,24 @@ static int b53_arl_read(struct b53_device *dev, u64 mac, |
1253 |
+ B53_ARLTBL_DATA_ENTRY(i), &fwd_entry); |
1254 |
+ b53_arl_to_entry(ent, mac_vid, fwd_entry); |
1255 |
+ |
1256 |
+- if (!(fwd_entry & ARLTBL_VALID)) |
1257 |
++ if (!(fwd_entry & ARLTBL_VALID)) { |
1258 |
++ set_bit(i, free_bins); |
1259 |
+ continue; |
1260 |
++ } |
1261 |
+ if ((mac_vid & ARLTBL_MAC_MASK) != mac) |
1262 |
+ continue; |
1263 |
++ if (dev->vlan_enabled && |
1264 |
++ ((mac_vid >> ARLTBL_VID_S) & ARLTBL_VID_MASK) != vid) |
1265 |
++ continue; |
1266 |
+ *idx = i; |
1267 |
++ return 0; |
1268 |
+ } |
1269 |
+ |
1270 |
++ if (bitmap_weight(free_bins, dev->num_arl_entries) == 0) |
1271 |
++ return -ENOSPC; |
1272 |
++ |
1273 |
++ *idx = find_first_bit(free_bins, dev->num_arl_entries); |
1274 |
++ |
1275 |
+ return -ENOENT; |
1276 |
+ } |
1277 |
+ |
1278 |
+@@ -1504,15 +1522,25 @@ static int b53_arl_op(struct b53_device *dev, int op, int port, |
1279 |
+ if (op) |
1280 |
+ return ret; |
1281 |
+ |
1282 |
+- /* We could not find a matching MAC, so reset to a new entry */ |
1283 |
+- if (ret) { |
1284 |
++ switch (ret) { |
1285 |
++ case -ENOSPC: |
1286 |
++ dev_dbg(dev->dev, "{%pM,%.4d} no space left in ARL\n", |
1287 |
++ addr, vid); |
1288 |
++ return is_valid ? ret : 0; |
1289 |
++ case -ENOENT: |
1290 |
++ /* We could not find a matching MAC, so reset to a new entry */ |
1291 |
++ dev_dbg(dev->dev, "{%pM,%.4d} not found, using idx: %d\n", |
1292 |
++ addr, vid, idx); |
1293 |
+ fwd_entry = 0; |
1294 |
+- idx = 1; |
1295 |
++ break; |
1296 |
++ default: |
1297 |
++ dev_dbg(dev->dev, "{%pM,%.4d} found, using idx: %d\n", |
1298 |
++ addr, vid, idx); |
1299 |
++ break; |
1300 |
+ } |
1301 |
+ |
1302 |
+ memset(&ent, 0, sizeof(ent)); |
1303 |
+ ent.port = port; |
1304 |
+- ent.is_valid = is_valid; |
1305 |
+ ent.vid = vid; |
1306 |
+ ent.is_static = true; |
1307 |
+ memcpy(ent.mac, addr, ETH_ALEN); |
1308 |
+diff --git a/drivers/net/dsa/b53/b53_regs.h b/drivers/net/dsa/b53/b53_regs.h |
1309 |
+index 2a9f421680aa..c90985c294a2 100644 |
1310 |
+--- a/drivers/net/dsa/b53/b53_regs.h |
1311 |
++++ b/drivers/net/dsa/b53/b53_regs.h |
1312 |
+@@ -292,6 +292,7 @@ |
1313 |
+ /* ARL Table Read/Write Register (8 bit) */ |
1314 |
+ #define B53_ARLTBL_RW_CTRL 0x00 |
1315 |
+ #define ARLTBL_RW BIT(0) |
1316 |
++#define ARLTBL_IVL_SVL_SELECT BIT(6) |
1317 |
+ #define ARLTBL_START_DONE BIT(7) |
1318 |
+ |
1319 |
+ /* MAC Address Index Register (48 bit) */ |
1320 |
+@@ -304,7 +305,7 @@ |
1321 |
+ * |
1322 |
+ * BCM5325 and BCM5365 share most definitions below |
1323 |
+ */ |
1324 |
+-#define B53_ARLTBL_MAC_VID_ENTRY(n) (0x10 * (n)) |
1325 |
++#define B53_ARLTBL_MAC_VID_ENTRY(n) ((0x10 * (n)) + 0x10) |
1326 |
+ #define ARLTBL_MAC_MASK 0xffffffffffffULL |
1327 |
+ #define ARLTBL_VID_S 48 |
1328 |
+ #define ARLTBL_VID_MASK_25 0xff |
1329 |
+@@ -316,13 +317,16 @@ |
1330 |
+ #define ARLTBL_VALID_25 BIT(63) |
1331 |
+ |
1332 |
+ /* ARL Table Data Entry N Registers (32 bit) */ |
1333 |
+-#define B53_ARLTBL_DATA_ENTRY(n) ((0x10 * (n)) + 0x08) |
1334 |
++#define B53_ARLTBL_DATA_ENTRY(n) ((0x10 * (n)) + 0x18) |
1335 |
+ #define ARLTBL_DATA_PORT_ID_MASK 0x1ff |
1336 |
+ #define ARLTBL_TC(tc) ((3 & tc) << 11) |
1337 |
+ #define ARLTBL_AGE BIT(14) |
1338 |
+ #define ARLTBL_STATIC BIT(15) |
1339 |
+ #define ARLTBL_VALID BIT(16) |
1340 |
+ |
1341 |
++/* Maximum number of bin entries in the ARL for all switches */ |
1342 |
++#define B53_ARLTBL_MAX_BIN_ENTRIES 4 |
1343 |
++ |
1344 |
+ /* ARL Search Control Register (8 bit) */ |
1345 |
+ #define B53_ARL_SRCH_CTL 0x50 |
1346 |
+ #define B53_ARL_SRCH_CTL_25 0x20 |
1347 |
+diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c |
1348 |
+index 8f909d57501f..ff09ee777b2b 100644 |
1349 |
+--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c |
1350 |
++++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c |
1351 |
+@@ -995,6 +995,8 @@ static void bcmgenet_get_ethtool_stats(struct net_device *dev, |
1352 |
+ if (netif_running(dev)) |
1353 |
+ bcmgenet_update_mib_counters(priv); |
1354 |
+ |
1355 |
++ dev->netdev_ops->ndo_get_stats(dev); |
1356 |
++ |
1357 |
+ for (i = 0; i < BCMGENET_STATS_LEN; i++) { |
1358 |
+ const struct bcmgenet_stats *s; |
1359 |
+ char *p; |
1360 |
+@@ -3204,6 +3206,7 @@ static struct net_device_stats *bcmgenet_get_stats(struct net_device *dev) |
1361 |
+ dev->stats.rx_packets = rx_packets; |
1362 |
+ dev->stats.rx_errors = rx_errors; |
1363 |
+ dev->stats.rx_missed_errors = rx_errors; |
1364 |
++ dev->stats.rx_dropped = rx_dropped; |
1365 |
+ return &dev->stats; |
1366 |
+ } |
1367 |
+ |
1368 |
+diff --git a/drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.c b/drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.c |
1369 |
+index c2e92786608b..7bcdce182ee5 100644 |
1370 |
+--- a/drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.c |
1371 |
++++ b/drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.c |
1372 |
+@@ -1054,9 +1054,9 @@ static void cudbg_t4_fwcache(struct cudbg_init *pdbg_init, |
1373 |
+ } |
1374 |
+ } |
1375 |
+ |
1376 |
+-static unsigned long cudbg_mem_region_size(struct cudbg_init *pdbg_init, |
1377 |
+- struct cudbg_error *cudbg_err, |
1378 |
+- u8 mem_type) |
1379 |
++static int cudbg_mem_region_size(struct cudbg_init *pdbg_init, |
1380 |
++ struct cudbg_error *cudbg_err, |
1381 |
++ u8 mem_type, unsigned long *region_size) |
1382 |
+ { |
1383 |
+ struct adapter *padap = pdbg_init->adap; |
1384 |
+ struct cudbg_meminfo mem_info; |
1385 |
+@@ -1065,15 +1065,23 @@ static unsigned long cudbg_mem_region_size(struct cudbg_init *pdbg_init, |
1386 |
+ |
1387 |
+ memset(&mem_info, 0, sizeof(struct cudbg_meminfo)); |
1388 |
+ rc = cudbg_fill_meminfo(padap, &mem_info); |
1389 |
+- if (rc) |
1390 |
++ if (rc) { |
1391 |
++ cudbg_err->sys_err = rc; |
1392 |
+ return rc; |
1393 |
++ } |
1394 |
+ |
1395 |
+ cudbg_t4_fwcache(pdbg_init, cudbg_err); |
1396 |
+ rc = cudbg_meminfo_get_mem_index(padap, &mem_info, mem_type, &mc_idx); |
1397 |
+- if (rc) |
1398 |
++ if (rc) { |
1399 |
++ cudbg_err->sys_err = rc; |
1400 |
+ return rc; |
1401 |
++ } |
1402 |
++ |
1403 |
++ if (region_size) |
1404 |
++ *region_size = mem_info.avail[mc_idx].limit - |
1405 |
++ mem_info.avail[mc_idx].base; |
1406 |
+ |
1407 |
+- return mem_info.avail[mc_idx].limit - mem_info.avail[mc_idx].base; |
1408 |
++ return 0; |
1409 |
+ } |
1410 |
+ |
1411 |
+ static int cudbg_collect_mem_region(struct cudbg_init *pdbg_init, |
1412 |
+@@ -1081,7 +1089,12 @@ static int cudbg_collect_mem_region(struct cudbg_init *pdbg_init, |
1413 |
+ struct cudbg_error *cudbg_err, |
1414 |
+ u8 mem_type) |
1415 |
+ { |
1416 |
+- unsigned long size = cudbg_mem_region_size(pdbg_init, cudbg_err, mem_type); |
1417 |
++ unsigned long size = 0; |
1418 |
++ int rc; |
1419 |
++ |
1420 |
++ rc = cudbg_mem_region_size(pdbg_init, cudbg_err, mem_type, &size); |
1421 |
++ if (rc) |
1422 |
++ return rc; |
1423 |
+ |
1424 |
+ return cudbg_read_fw_mem(pdbg_init, dbg_buff, mem_type, size, |
1425 |
+ cudbg_err); |
1426 |
+diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_ptp.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_ptp.c |
1427 |
+index af1f40cbccc8..f5bc996ac77d 100644 |
1428 |
+--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_ptp.c |
1429 |
++++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_ptp.c |
1430 |
+@@ -311,32 +311,17 @@ static int cxgb4_ptp_adjtime(struct ptp_clock_info *ptp, s64 delta) |
1431 |
+ */ |
1432 |
+ static int cxgb4_ptp_gettime(struct ptp_clock_info *ptp, struct timespec64 *ts) |
1433 |
+ { |
1434 |
+- struct adapter *adapter = (struct adapter *)container_of(ptp, |
1435 |
+- struct adapter, ptp_clock_info); |
1436 |
+- struct fw_ptp_cmd c; |
1437 |
++ struct adapter *adapter = container_of(ptp, struct adapter, |
1438 |
++ ptp_clock_info); |
1439 |
+ u64 ns; |
1440 |
+- int err; |
1441 |
+- |
1442 |
+- memset(&c, 0, sizeof(c)); |
1443 |
+- c.op_to_portid = cpu_to_be32(FW_CMD_OP_V(FW_PTP_CMD) | |
1444 |
+- FW_CMD_REQUEST_F | |
1445 |
+- FW_CMD_READ_F | |
1446 |
+- FW_PTP_CMD_PORTID_V(0)); |
1447 |
+- c.retval_len16 = cpu_to_be32(FW_CMD_LEN16_V(sizeof(c) / 16)); |
1448 |
+- c.u.ts.sc = FW_PTP_SC_GET_TIME; |
1449 |
+ |
1450 |
+- err = t4_wr_mbox(adapter, adapter->mbox, &c, sizeof(c), &c); |
1451 |
+- if (err < 0) { |
1452 |
+- dev_err(adapter->pdev_dev, |
1453 |
+- "PTP: %s error %d\n", __func__, -err); |
1454 |
+- return err; |
1455 |
+- } |
1456 |
++ ns = t4_read_reg(adapter, T5_PORT_REG(0, MAC_PORT_PTP_SUM_LO_A)); |
1457 |
++ ns |= (u64)t4_read_reg(adapter, |
1458 |
++ T5_PORT_REG(0, MAC_PORT_PTP_SUM_HI_A)) << 32; |
1459 |
+ |
1460 |
+ /* convert to timespec*/ |
1461 |
+- ns = be64_to_cpu(c.u.ts.tm); |
1462 |
+ *ts = ns_to_timespec64(ns); |
1463 |
+- |
1464 |
+- return err; |
1465 |
++ return 0; |
1466 |
+ } |
1467 |
+ |
1468 |
+ /** |
1469 |
+diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_regs.h b/drivers/net/ethernet/chelsio/cxgb4/t4_regs.h |
1470 |
+index a957a6e4d4c4..b0519c326692 100644 |
1471 |
+--- a/drivers/net/ethernet/chelsio/cxgb4/t4_regs.h |
1472 |
++++ b/drivers/net/ethernet/chelsio/cxgb4/t4_regs.h |
1473 |
+@@ -1900,6 +1900,9 @@ |
1474 |
+ |
1475 |
+ #define MAC_PORT_CFG2_A 0x818 |
1476 |
+ |
1477 |
++#define MAC_PORT_PTP_SUM_LO_A 0x990 |
1478 |
++#define MAC_PORT_PTP_SUM_HI_A 0x994 |
1479 |
++ |
1480 |
+ #define MPS_CMN_CTL_A 0x9000 |
1481 |
+ |
1482 |
+ #define COUNTPAUSEMCRX_S 5 |
1483 |
+diff --git a/drivers/net/ethernet/mellanox/mlx4/en_tx.c b/drivers/net/ethernet/mellanox/mlx4/en_tx.c |
1484 |
+index 4d5ca302c067..a30edb436f4a 100644 |
1485 |
+--- a/drivers/net/ethernet/mellanox/mlx4/en_tx.c |
1486 |
++++ b/drivers/net/ethernet/mellanox/mlx4/en_tx.c |
1487 |
+@@ -43,6 +43,7 @@ |
1488 |
+ #include <linux/ip.h> |
1489 |
+ #include <linux/ipv6.h> |
1490 |
+ #include <linux/moduleparam.h> |
1491 |
++#include <linux/indirect_call_wrapper.h> |
1492 |
+ |
1493 |
+ #include "mlx4_en.h" |
1494 |
+ |
1495 |
+@@ -261,6 +262,10 @@ static void mlx4_en_stamp_wqe(struct mlx4_en_priv *priv, |
1496 |
+ } |
1497 |
+ } |
1498 |
+ |
1499 |
++INDIRECT_CALLABLE_DECLARE(u32 mlx4_en_free_tx_desc(struct mlx4_en_priv *priv, |
1500 |
++ struct mlx4_en_tx_ring *ring, |
1501 |
++ int index, u64 timestamp, |
1502 |
++ int napi_mode)); |
1503 |
+ |
1504 |
+ u32 mlx4_en_free_tx_desc(struct mlx4_en_priv *priv, |
1505 |
+ struct mlx4_en_tx_ring *ring, |
1506 |
+@@ -329,6 +334,11 @@ u32 mlx4_en_free_tx_desc(struct mlx4_en_priv *priv, |
1507 |
+ return tx_info->nr_txbb; |
1508 |
+ } |
1509 |
+ |
1510 |
++INDIRECT_CALLABLE_DECLARE(u32 mlx4_en_recycle_tx_desc(struct mlx4_en_priv *priv, |
1511 |
++ struct mlx4_en_tx_ring *ring, |
1512 |
++ int index, u64 timestamp, |
1513 |
++ int napi_mode)); |
1514 |
++ |
1515 |
+ u32 mlx4_en_recycle_tx_desc(struct mlx4_en_priv *priv, |
1516 |
+ struct mlx4_en_tx_ring *ring, |
1517 |
+ int index, u64 timestamp, |
1518 |
+@@ -449,7 +459,9 @@ bool mlx4_en_process_tx_cq(struct net_device *dev, |
1519 |
+ timestamp = mlx4_en_get_cqe_ts(cqe); |
1520 |
+ |
1521 |
+ /* free next descriptor */ |
1522 |
+- last_nr_txbb = ring->free_tx_desc( |
1523 |
++ last_nr_txbb = INDIRECT_CALL_2(ring->free_tx_desc, |
1524 |
++ mlx4_en_free_tx_desc, |
1525 |
++ mlx4_en_recycle_tx_desc, |
1526 |
+ priv, ring, ring_index, |
1527 |
+ timestamp, napi_budget); |
1528 |
+ |
1529 |
+diff --git a/drivers/net/ethernet/mellanox/mlxsw/core_acl_flex_actions.c b/drivers/net/ethernet/mellanox/mlxsw/core_acl_flex_actions.c |
1530 |
+index c51b2adfc1e1..2cbfa5cfefab 100644 |
1531 |
+--- a/drivers/net/ethernet/mellanox/mlxsw/core_acl_flex_actions.c |
1532 |
++++ b/drivers/net/ethernet/mellanox/mlxsw/core_acl_flex_actions.c |
1533 |
+@@ -316,7 +316,7 @@ struct mlxsw_afa_block *mlxsw_afa_block_create(struct mlxsw_afa *mlxsw_afa) |
1534 |
+ |
1535 |
+ block = kzalloc(sizeof(*block), GFP_KERNEL); |
1536 |
+ if (!block) |
1537 |
+- return NULL; |
1538 |
++ return ERR_PTR(-ENOMEM); |
1539 |
+ INIT_LIST_HEAD(&block->resource_list); |
1540 |
+ block->afa = mlxsw_afa; |
1541 |
+ |
1542 |
+@@ -344,7 +344,7 @@ err_second_set_create: |
1543 |
+ mlxsw_afa_set_destroy(block->first_set); |
1544 |
+ err_first_set_create: |
1545 |
+ kfree(block); |
1546 |
+- return NULL; |
1547 |
++ return ERR_PTR(-ENOMEM); |
1548 |
+ } |
1549 |
+ EXPORT_SYMBOL(mlxsw_afa_block_create); |
1550 |
+ |
1551 |
+diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum2_acl_tcam.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum2_acl_tcam.c |
1552 |
+index 6c66a0f1b79e..ad69913f19c1 100644 |
1553 |
+--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum2_acl_tcam.c |
1554 |
++++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum2_acl_tcam.c |
1555 |
+@@ -88,8 +88,8 @@ static int mlxsw_sp2_acl_tcam_init(struct mlxsw_sp *mlxsw_sp, void *priv, |
1556 |
+ * to be written using PEFA register to all indexes for all regions. |
1557 |
+ */ |
1558 |
+ afa_block = mlxsw_afa_block_create(mlxsw_sp->afa); |
1559 |
+- if (!afa_block) { |
1560 |
+- err = -ENOMEM; |
1561 |
++ if (IS_ERR(afa_block)) { |
1562 |
++ err = PTR_ERR(afa_block); |
1563 |
+ goto err_afa_block; |
1564 |
+ } |
1565 |
+ err = mlxsw_afa_block_continue(afa_block); |
1566 |
+diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl.c |
1567 |
+index 3d3cca596116..d77cdcb5c642 100644 |
1568 |
+--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl.c |
1569 |
++++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl.c |
1570 |
+@@ -444,7 +444,7 @@ mlxsw_sp_acl_rulei_create(struct mlxsw_sp_acl *acl, |
1571 |
+ |
1572 |
+ rulei = kzalloc(sizeof(*rulei), GFP_KERNEL); |
1573 |
+ if (!rulei) |
1574 |
+- return NULL; |
1575 |
++ return ERR_PTR(-ENOMEM); |
1576 |
+ |
1577 |
+ if (afa_block) { |
1578 |
+ rulei->act_block = afa_block; |
1579 |
+diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_mr_tcam.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_mr_tcam.c |
1580 |
+index 346f4a5fe053..221aa6a474eb 100644 |
1581 |
+--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_mr_tcam.c |
1582 |
++++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_mr_tcam.c |
1583 |
+@@ -199,8 +199,8 @@ mlxsw_sp_mr_tcam_afa_block_create(struct mlxsw_sp *mlxsw_sp, |
1584 |
+ int err; |
1585 |
+ |
1586 |
+ afa_block = mlxsw_afa_block_create(mlxsw_sp->afa); |
1587 |
+- if (!afa_block) |
1588 |
+- return ERR_PTR(-ENOMEM); |
1589 |
++ if (IS_ERR(afa_block)) |
1590 |
++ return afa_block; |
1591 |
+ |
1592 |
+ err = mlxsw_afa_block_append_allocated_counter(afa_block, |
1593 |
+ counter_index); |
1594 |
+diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c |
1595 |
+index 33ce139f090f..d1d6ba9cdccd 100644 |
1596 |
+--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c |
1597 |
++++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c |
1598 |
+@@ -119,6 +119,7 @@ static int meson8b_init_rgmii_tx_clk(struct meson8b_dwmac *dwmac) |
1599 |
+ { .div = 5, .val = 5, }, |
1600 |
+ { .div = 6, .val = 6, }, |
1601 |
+ { .div = 7, .val = 7, }, |
1602 |
++ { /* end of array */ } |
1603 |
+ }; |
1604 |
+ |
1605 |
+ clk_configs = devm_kzalloc(dev, sizeof(*clk_configs), GFP_KERNEL); |
1606 |
+diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c |
1607 |
+index 730ab57201bd..aa101f72d405 100644 |
1608 |
+--- a/drivers/net/geneve.c |
1609 |
++++ b/drivers/net/geneve.c |
1610 |
+@@ -1207,7 +1207,7 @@ static int geneve_validate(struct nlattr *tb[], struct nlattr *data[], |
1611 |
+ enum ifla_geneve_df df = nla_get_u8(data[IFLA_GENEVE_DF]); |
1612 |
+ |
1613 |
+ if (df < 0 || df > GENEVE_DF_MAX) { |
1614 |
+- NL_SET_ERR_MSG_ATTR(extack, tb[IFLA_GENEVE_DF], |
1615 |
++ NL_SET_ERR_MSG_ATTR(extack, data[IFLA_GENEVE_DF], |
1616 |
+ "Invalid DF attribute"); |
1617 |
+ return -EINVAL; |
1618 |
+ } |
1619 |
+diff --git a/drivers/net/macsec.c b/drivers/net/macsec.c |
1620 |
+index 32c627702ac5..a0abc729f0ca 100644 |
1621 |
+--- a/drivers/net/macsec.c |
1622 |
++++ b/drivers/net/macsec.c |
1623 |
+@@ -3226,11 +3226,11 @@ static int macsec_newlink(struct net *net, struct net_device *dev, |
1624 |
+ struct netlink_ext_ack *extack) |
1625 |
+ { |
1626 |
+ struct macsec_dev *macsec = macsec_priv(dev); |
1627 |
++ rx_handler_func_t *rx_handler; |
1628 |
++ u8 icv_len = DEFAULT_ICV_LEN; |
1629 |
+ struct net_device *real_dev; |
1630 |
+- int err; |
1631 |
++ int err, mtu; |
1632 |
+ sci_t sci; |
1633 |
+- u8 icv_len = DEFAULT_ICV_LEN; |
1634 |
+- rx_handler_func_t *rx_handler; |
1635 |
+ |
1636 |
+ if (!tb[IFLA_LINK]) |
1637 |
+ return -EINVAL; |
1638 |
+@@ -3246,7 +3246,11 @@ static int macsec_newlink(struct net *net, struct net_device *dev, |
1639 |
+ |
1640 |
+ if (data && data[IFLA_MACSEC_ICV_LEN]) |
1641 |
+ icv_len = nla_get_u8(data[IFLA_MACSEC_ICV_LEN]); |
1642 |
+- dev->mtu = real_dev->mtu - icv_len - macsec_extra_len(true); |
1643 |
++ mtu = real_dev->mtu - icv_len - macsec_extra_len(true); |
1644 |
++ if (mtu < 0) |
1645 |
++ dev->mtu = 0; |
1646 |
++ else |
1647 |
++ dev->mtu = mtu; |
1648 |
+ |
1649 |
+ rx_handler = rtnl_dereference(real_dev->rx_handler); |
1650 |
+ if (rx_handler && rx_handler != macsec_handle_frame) |
1651 |
+diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c |
1652 |
+index 26f6be4796c7..0ce1004a8d0d 100644 |
1653 |
+--- a/drivers/net/macvlan.c |
1654 |
++++ b/drivers/net/macvlan.c |
1655 |
+@@ -1704,7 +1704,7 @@ static int macvlan_device_event(struct notifier_block *unused, |
1656 |
+ struct macvlan_dev, |
1657 |
+ list); |
1658 |
+ |
1659 |
+- if (macvlan_sync_address(vlan->dev, dev->dev_addr)) |
1660 |
++ if (vlan && macvlan_sync_address(vlan->dev, dev->dev_addr)) |
1661 |
+ return NOTIFY_BAD; |
1662 |
+ |
1663 |
+ break; |
1664 |
+diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c |
1665 |
+index 4004f98e50d9..04845a4017f9 100644 |
1666 |
+--- a/drivers/net/team/team.c |
1667 |
++++ b/drivers/net/team/team.c |
1668 |
+@@ -468,6 +468,9 @@ static const struct team_mode *team_mode_get(const char *kind) |
1669 |
+ struct team_mode_item *mitem; |
1670 |
+ const struct team_mode *mode = NULL; |
1671 |
+ |
1672 |
++ if (!try_module_get(THIS_MODULE)) |
1673 |
++ return NULL; |
1674 |
++ |
1675 |
+ spin_lock(&mode_list_lock); |
1676 |
+ mitem = __find_mode(kind); |
1677 |
+ if (!mitem) { |
1678 |
+@@ -483,6 +486,7 @@ static const struct team_mode *team_mode_get(const char *kind) |
1679 |
+ } |
1680 |
+ |
1681 |
+ spin_unlock(&mode_list_lock); |
1682 |
++ module_put(THIS_MODULE); |
1683 |
+ return mode; |
1684 |
+ } |
1685 |
+ |
1686 |
+diff --git a/drivers/net/vrf.c b/drivers/net/vrf.c |
1687 |
+index b8228f50bc94..6716deeb35e3 100644 |
1688 |
+--- a/drivers/net/vrf.c |
1689 |
++++ b/drivers/net/vrf.c |
1690 |
+@@ -188,8 +188,8 @@ static netdev_tx_t vrf_process_v6_outbound(struct sk_buff *skb, |
1691 |
+ fl6.flowi6_proto = iph->nexthdr; |
1692 |
+ fl6.flowi6_flags = FLOWI_FLAG_SKIP_NH_OIF; |
1693 |
+ |
1694 |
+- dst = ip6_route_output(net, NULL, &fl6); |
1695 |
+- if (dst == dst_null) |
1696 |
++ dst = ip6_dst_lookup_flow(net, NULL, &fl6, NULL); |
1697 |
++ if (IS_ERR(dst) || dst == dst_null) |
1698 |
+ goto err; |
1699 |
+ |
1700 |
+ skb_dst_drop(skb); |
1701 |
+@@ -474,7 +474,8 @@ static struct sk_buff *vrf_ip6_out(struct net_device *vrf_dev, |
1702 |
+ if (rt6_need_strict(&ipv6_hdr(skb)->daddr)) |
1703 |
+ return skb; |
1704 |
+ |
1705 |
+- if (qdisc_tx_is_default(vrf_dev)) |
1706 |
++ if (qdisc_tx_is_default(vrf_dev) || |
1707 |
++ IP6CB(skb)->flags & IP6SKB_XFRM_TRANSFORMED) |
1708 |
+ return vrf_ip6_out_direct(vrf_dev, sk, skb); |
1709 |
+ |
1710 |
+ return vrf_ip6_out_redirect(vrf_dev, skb); |
1711 |
+@@ -686,7 +687,8 @@ static struct sk_buff *vrf_ip_out(struct net_device *vrf_dev, |
1712 |
+ ipv4_is_lbcast(ip_hdr(skb)->daddr)) |
1713 |
+ return skb; |
1714 |
+ |
1715 |
+- if (qdisc_tx_is_default(vrf_dev)) |
1716 |
++ if (qdisc_tx_is_default(vrf_dev) || |
1717 |
++ IPCB(skb)->flags & IPSKB_XFRM_TRANSFORMED) |
1718 |
+ return vrf_ip_out_direct(vrf_dev, sk, skb); |
1719 |
+ |
1720 |
+ return vrf_ip_out_redirect(vrf_dev, skb); |
1721 |
+diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c |
1722 |
+index 93690f77ec9c..ae59fca96032 100644 |
1723 |
+--- a/drivers/net/vxlan.c |
1724 |
++++ b/drivers/net/vxlan.c |
1725 |
+@@ -3144,7 +3144,7 @@ static int vxlan_validate(struct nlattr *tb[], struct nlattr *data[], |
1726 |
+ u32 id = nla_get_u32(data[IFLA_VXLAN_ID]); |
1727 |
+ |
1728 |
+ if (id >= VXLAN_N_VID) { |
1729 |
+- NL_SET_ERR_MSG_ATTR(extack, tb[IFLA_VXLAN_ID], |
1730 |
++ NL_SET_ERR_MSG_ATTR(extack, data[IFLA_VXLAN_ID], |
1731 |
+ "VXLAN ID must be lower than 16777216"); |
1732 |
+ return -ERANGE; |
1733 |
+ } |
1734 |
+@@ -3155,7 +3155,7 @@ static int vxlan_validate(struct nlattr *tb[], struct nlattr *data[], |
1735 |
+ = nla_data(data[IFLA_VXLAN_PORT_RANGE]); |
1736 |
+ |
1737 |
+ if (ntohs(p->high) < ntohs(p->low)) { |
1738 |
+- NL_SET_ERR_MSG_ATTR(extack, tb[IFLA_VXLAN_PORT_RANGE], |
1739 |
++ NL_SET_ERR_MSG_ATTR(extack, data[IFLA_VXLAN_PORT_RANGE], |
1740 |
+ "Invalid source port range"); |
1741 |
+ return -EINVAL; |
1742 |
+ } |
1743 |
+@@ -3165,7 +3165,7 @@ static int vxlan_validate(struct nlattr *tb[], struct nlattr *data[], |
1744 |
+ enum ifla_vxlan_df df = nla_get_u8(data[IFLA_VXLAN_DF]); |
1745 |
+ |
1746 |
+ if (df < 0 || df > VXLAN_DF_MAX) { |
1747 |
+- NL_SET_ERR_MSG_ATTR(extack, tb[IFLA_VXLAN_DF], |
1748 |
++ NL_SET_ERR_MSG_ATTR(extack, data[IFLA_VXLAN_DF], |
1749 |
+ "Invalid DF attribute"); |
1750 |
+ return -EINVAL; |
1751 |
+ } |
1752 |
+diff --git a/drivers/net/wireless/intel/iwlegacy/3945-rs.c b/drivers/net/wireless/intel/iwlegacy/3945-rs.c |
1753 |
+index 6209f85a71dd..0af9e997c9f6 100644 |
1754 |
+--- a/drivers/net/wireless/intel/iwlegacy/3945-rs.c |
1755 |
++++ b/drivers/net/wireless/intel/iwlegacy/3945-rs.c |
1756 |
+@@ -374,7 +374,7 @@ out: |
1757 |
+ } |
1758 |
+ |
1759 |
+ static void * |
1760 |
+-il3945_rs_alloc(struct ieee80211_hw *hw, struct dentry *debugfsdir) |
1761 |
++il3945_rs_alloc(struct ieee80211_hw *hw) |
1762 |
+ { |
1763 |
+ return hw->priv; |
1764 |
+ } |
1765 |
+diff --git a/drivers/net/wireless/intel/iwlegacy/4965-rs.c b/drivers/net/wireless/intel/iwlegacy/4965-rs.c |
1766 |
+index 7c6e2c863497..0a02d8aca320 100644 |
1767 |
+--- a/drivers/net/wireless/intel/iwlegacy/4965-rs.c |
1768 |
++++ b/drivers/net/wireless/intel/iwlegacy/4965-rs.c |
1769 |
+@@ -2474,7 +2474,7 @@ il4965_rs_fill_link_cmd(struct il_priv *il, struct il_lq_sta *lq_sta, |
1770 |
+ } |
1771 |
+ |
1772 |
+ static void * |
1773 |
+-il4965_rs_alloc(struct ieee80211_hw *hw, struct dentry *debugfsdir) |
1774 |
++il4965_rs_alloc(struct ieee80211_hw *hw) |
1775 |
+ { |
1776 |
+ return hw->priv; |
1777 |
+ } |
1778 |
+diff --git a/drivers/net/wireless/intel/iwlwifi/dvm/rs.c b/drivers/net/wireless/intel/iwlwifi/dvm/rs.c |
1779 |
+index 74229fcb63a9..e68a13c33c45 100644 |
1780 |
+--- a/drivers/net/wireless/intel/iwlwifi/dvm/rs.c |
1781 |
++++ b/drivers/net/wireless/intel/iwlwifi/dvm/rs.c |
1782 |
+@@ -3019,7 +3019,7 @@ static void rs_fill_link_cmd(struct iwl_priv *priv, |
1783 |
+ cpu_to_le16(priv->lib->bt_params->agg_time_limit); |
1784 |
+ } |
1785 |
+ |
1786 |
+-static void *rs_alloc(struct ieee80211_hw *hw, struct dentry *debugfsdir) |
1787 |
++static void *rs_alloc(struct ieee80211_hw *hw) |
1788 |
+ { |
1789 |
+ return hw->priv; |
1790 |
+ } |
1791 |
+diff --git a/drivers/net/wireless/intel/iwlwifi/fw/api/txq.h b/drivers/net/wireless/intel/iwlwifi/fw/api/txq.h |
1792 |
+index 73196cbc7fbe..75d958bab0e3 100644 |
1793 |
+--- a/drivers/net/wireless/intel/iwlwifi/fw/api/txq.h |
1794 |
++++ b/drivers/net/wireless/intel/iwlwifi/fw/api/txq.h |
1795 |
+@@ -8,7 +8,7 @@ |
1796 |
+ * Copyright(c) 2007 - 2014 Intel Corporation. All rights reserved. |
1797 |
+ * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH |
1798 |
+ * Copyright(c) 2016 - 2017 Intel Deutschland GmbH |
1799 |
+- * Copyright(c) 2019 Intel Corporation |
1800 |
++ * Copyright(c) 2019 - 2020 Intel Corporation |
1801 |
+ * |
1802 |
+ * This program is free software; you can redistribute it and/or modify |
1803 |
+ * it under the terms of version 2 of the GNU General Public License as |
1804 |
+@@ -31,7 +31,7 @@ |
1805 |
+ * Copyright(c) 2005 - 2014 Intel Corporation. All rights reserved. |
1806 |
+ * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH |
1807 |
+ * Copyright(c) 2016 - 2017 Intel Deutschland GmbH |
1808 |
+- * Copyright(c) 2019 Intel Corporation |
1809 |
++ * Copyright(c) 2019 - 2020 Intel Corporation |
1810 |
+ * All rights reserved. |
1811 |
+ * |
1812 |
+ * Redistribution and use in source and binary forms, with or without |
1813 |
+@@ -99,7 +99,7 @@ enum iwl_mvm_dqa_txq { |
1814 |
+ IWL_MVM_DQA_MAX_MGMT_QUEUE = 8, |
1815 |
+ IWL_MVM_DQA_AP_PROBE_RESP_QUEUE = 9, |
1816 |
+ IWL_MVM_DQA_MIN_DATA_QUEUE = 10, |
1817 |
+- IWL_MVM_DQA_MAX_DATA_QUEUE = 31, |
1818 |
++ IWL_MVM_DQA_MAX_DATA_QUEUE = 30, |
1819 |
+ }; |
1820 |
+ |
1821 |
+ enum iwl_mvm_tx_fifo { |
1822 |
+diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c b/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c |
1823 |
+index 5d546dac7814..022f2faccab4 100644 |
1824 |
+--- a/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c |
1825 |
++++ b/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c |
1826 |
+@@ -525,8 +525,7 @@ static struct ieee80211_sband_iftype_data iwl_he_capa[] = { |
1827 |
+ IEEE80211_HE_MAC_CAP1_TF_MAC_PAD_DUR_16US | |
1828 |
+ IEEE80211_HE_MAC_CAP1_MULTI_TID_AGG_RX_QOS_8, |
1829 |
+ .mac_cap_info[2] = |
1830 |
+- IEEE80211_HE_MAC_CAP2_32BIT_BA_BITMAP | |
1831 |
+- IEEE80211_HE_MAC_CAP2_ACK_EN, |
1832 |
++ IEEE80211_HE_MAC_CAP2_32BIT_BA_BITMAP, |
1833 |
+ .mac_cap_info[3] = |
1834 |
+ IEEE80211_HE_MAC_CAP3_OMI_CONTROL | |
1835 |
+ IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_VHT_2, |
1836 |
+@@ -610,8 +609,7 @@ static struct ieee80211_sband_iftype_data iwl_he_capa[] = { |
1837 |
+ IEEE80211_HE_MAC_CAP1_TF_MAC_PAD_DUR_16US | |
1838 |
+ IEEE80211_HE_MAC_CAP1_MULTI_TID_AGG_RX_QOS_8, |
1839 |
+ .mac_cap_info[2] = |
1840 |
+- IEEE80211_HE_MAC_CAP2_BSR | |
1841 |
+- IEEE80211_HE_MAC_CAP2_ACK_EN, |
1842 |
++ IEEE80211_HE_MAC_CAP2_BSR, |
1843 |
+ .mac_cap_info[3] = |
1844 |
+ IEEE80211_HE_MAC_CAP3_OMI_CONTROL | |
1845 |
+ IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_VHT_2, |
1846 |
+diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rs.c b/drivers/net/wireless/intel/iwlwifi/mvm/rs.c |
1847 |
+index 42d525e46e80..9af657820b38 100644 |
1848 |
+--- a/drivers/net/wireless/intel/iwlwifi/mvm/rs.c |
1849 |
++++ b/drivers/net/wireless/intel/iwlwifi/mvm/rs.c |
1850 |
+@@ -3663,7 +3663,7 @@ static void rs_fill_lq_cmd(struct iwl_mvm *mvm, |
1851 |
+ cpu_to_le16(iwl_mvm_coex_agg_time_limit(mvm, sta)); |
1852 |
+ } |
1853 |
+ |
1854 |
+-static void *rs_alloc(struct ieee80211_hw *hw, struct dentry *debugfsdir) |
1855 |
++static void *rs_alloc(struct ieee80211_hw *hw) |
1856 |
+ { |
1857 |
+ return hw->priv; |
1858 |
+ } |
1859 |
+diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rx.c b/drivers/net/wireless/intel/iwlwifi/mvm/rx.c |
1860 |
+index 5ee33c8ae9d2..77b8def26edb 100644 |
1861 |
+--- a/drivers/net/wireless/intel/iwlwifi/mvm/rx.c |
1862 |
++++ b/drivers/net/wireless/intel/iwlwifi/mvm/rx.c |
1863 |
+@@ -8,7 +8,7 @@ |
1864 |
+ * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. |
1865 |
+ * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH |
1866 |
+ * Copyright(c) 2016 - 2017 Intel Deutschland GmbH |
1867 |
+- * Copyright(c) 2018 - 2019 Intel Corporation |
1868 |
++ * Copyright(c) 2018 - 2020 Intel Corporation |
1869 |
+ * |
1870 |
+ * This program is free software; you can redistribute it and/or modify |
1871 |
+ * it under the terms of version 2 of the GNU General Public License as |
1872 |
+@@ -31,7 +31,7 @@ |
1873 |
+ * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. |
1874 |
+ * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH |
1875 |
+ * Copyright(c) 2016 - 2017 Intel Deutschland GmbH |
1876 |
+- * Copyright(c) 2018 - 2019 Intel Corporation |
1877 |
++ * Copyright(c) 2018 - 2020 Intel Corporation |
1878 |
+ * All rights reserved. |
1879 |
+ * |
1880 |
+ * Redistribution and use in source and binary forms, with or without |
1881 |
+@@ -566,6 +566,7 @@ void iwl_mvm_rx_rx_mpdu(struct iwl_mvm *mvm, struct napi_struct *napi, |
1882 |
+ |
1883 |
+ struct iwl_mvm_stat_data { |
1884 |
+ struct iwl_mvm *mvm; |
1885 |
++ __le32 flags; |
1886 |
+ __le32 mac_id; |
1887 |
+ u8 beacon_filter_average_energy; |
1888 |
+ void *general; |
1889 |
+@@ -606,6 +607,13 @@ static void iwl_mvm_stat_iterator(void *_data, u8 *mac, |
1890 |
+ -general->beacon_average_energy[vif_id]; |
1891 |
+ } |
1892 |
+ |
1893 |
++ /* make sure that beacon statistics don't go backwards with TCM |
1894 |
++ * request to clear statistics |
1895 |
++ */ |
1896 |
++ if (le32_to_cpu(data->flags) & IWL_STATISTICS_REPLY_FLG_CLEAR) |
1897 |
++ mvmvif->beacon_stats.accu_num_beacons += |
1898 |
++ mvmvif->beacon_stats.num_beacons; |
1899 |
++ |
1900 |
+ if (mvmvif->id != id) |
1901 |
+ return; |
1902 |
+ |
1903 |
+@@ -763,6 +771,7 @@ void iwl_mvm_handle_rx_statistics(struct iwl_mvm *mvm, |
1904 |
+ |
1905 |
+ flags = stats->flag; |
1906 |
+ } |
1907 |
++ data.flags = flags; |
1908 |
+ |
1909 |
+ iwl_mvm_rx_stats_check_trigger(mvm, pkt); |
1910 |
+ |
1911 |
+diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c |
1912 |
+index 8ad2d889179c..71d339e90a9e 100644 |
1913 |
+--- a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c |
1914 |
++++ b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c |
1915 |
+@@ -722,6 +722,11 @@ static int iwl_mvm_find_free_queue(struct iwl_mvm *mvm, u8 sta_id, |
1916 |
+ |
1917 |
+ lockdep_assert_held(&mvm->mutex); |
1918 |
+ |
1919 |
++ if (WARN(maxq >= mvm->trans->trans_cfg->base_params->num_of_queues, |
1920 |
++ "max queue %d >= num_of_queues (%d)", maxq, |
1921 |
++ mvm->trans->trans_cfg->base_params->num_of_queues)) |
1922 |
++ maxq = mvm->trans->trans_cfg->base_params->num_of_queues - 1; |
1923 |
++ |
1924 |
+ /* This should not be hit with new TX path */ |
1925 |
+ if (WARN_ON(iwl_mvm_has_new_tx_api(mvm))) |
1926 |
+ return -ENOSPC; |
1927 |
+@@ -1164,9 +1169,9 @@ static int iwl_mvm_inactivity_check(struct iwl_mvm *mvm, u8 alloc_for_sta) |
1928 |
+ inactive_tid_bitmap, |
1929 |
+ &unshare_queues, |
1930 |
+ &changetid_queues); |
1931 |
+- if (ret >= 0 && free_queue < 0) { |
1932 |
++ if (ret && free_queue < 0) { |
1933 |
+ queue_owner = sta; |
1934 |
+- free_queue = ret; |
1935 |
++ free_queue = i; |
1936 |
+ } |
1937 |
+ /* only unlock sta lock - we still need the queue info lock */ |
1938 |
+ spin_unlock_bh(&mvmsta->lock); |
1939 |
+diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/tx-gen2.c b/drivers/net/wireless/intel/iwlwifi/pcie/tx-gen2.c |
1940 |
+index ff4c34d7b74f..248d42bf00c1 100644 |
1941 |
+--- a/drivers/net/wireless/intel/iwlwifi/pcie/tx-gen2.c |
1942 |
++++ b/drivers/net/wireless/intel/iwlwifi/pcie/tx-gen2.c |
1943 |
+@@ -1283,6 +1283,9 @@ void iwl_trans_pcie_dyn_txq_free(struct iwl_trans *trans, int queue) |
1944 |
+ |
1945 |
+ iwl_pcie_gen2_txq_unmap(trans, queue); |
1946 |
+ |
1947 |
++ iwl_pcie_gen2_txq_free_memory(trans, trans_pcie->txq[queue]); |
1948 |
++ trans_pcie->txq[queue] = NULL; |
1949 |
++ |
1950 |
+ IWL_DEBUG_TX_QUEUES(trans, "Deactivate queue %d\n", queue); |
1951 |
+ } |
1952 |
+ |
1953 |
+diff --git a/drivers/net/wireless/realtek/rtlwifi/rc.c b/drivers/net/wireless/realtek/rtlwifi/rc.c |
1954 |
+index 0c7d74902d33..4b5ea0ec9109 100644 |
1955 |
+--- a/drivers/net/wireless/realtek/rtlwifi/rc.c |
1956 |
++++ b/drivers/net/wireless/realtek/rtlwifi/rc.c |
1957 |
+@@ -261,7 +261,7 @@ static void rtl_rate_update(void *ppriv, |
1958 |
+ { |
1959 |
+ } |
1960 |
+ |
1961 |
+-static void *rtl_rate_alloc(struct ieee80211_hw *hw, struct dentry *debugfsdir) |
1962 |
++static void *rtl_rate_alloc(struct ieee80211_hw *hw) |
1963 |
+ { |
1964 |
+ struct rtl_priv *rtlpriv = rtl_priv(hw); |
1965 |
+ return rtlpriv; |
1966 |
+diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c |
1967 |
+index b8fe42f4b3c5..f97c48fd3eda 100644 |
1968 |
+--- a/drivers/nvme/host/core.c |
1969 |
++++ b/drivers/nvme/host/core.c |
1970 |
+@@ -6,6 +6,7 @@ |
1971 |
+ |
1972 |
+ #include <linux/blkdev.h> |
1973 |
+ #include <linux/blk-mq.h> |
1974 |
++#include <linux/compat.h> |
1975 |
+ #include <linux/delay.h> |
1976 |
+ #include <linux/errno.h> |
1977 |
+ #include <linux/hdreg.h> |
1978 |
+@@ -1244,6 +1245,18 @@ static void nvme_enable_aen(struct nvme_ctrl *ctrl) |
1979 |
+ queue_work(nvme_wq, &ctrl->async_event_work); |
1980 |
+ } |
1981 |
+ |
1982 |
++/* |
1983 |
++ * Convert integer values from ioctl structures to user pointers, silently |
1984 |
++ * ignoring the upper bits in the compat case to match behaviour of 32-bit |
1985 |
++ * kernels. |
1986 |
++ */ |
1987 |
++static void __user *nvme_to_user_ptr(uintptr_t ptrval) |
1988 |
++{ |
1989 |
++ if (in_compat_syscall()) |
1990 |
++ ptrval = (compat_uptr_t)ptrval; |
1991 |
++ return (void __user *)ptrval; |
1992 |
++} |
1993 |
++ |
1994 |
+ static int nvme_submit_io(struct nvme_ns *ns, struct nvme_user_io __user *uio) |
1995 |
+ { |
1996 |
+ struct nvme_user_io io; |
1997 |
+@@ -1267,7 +1280,7 @@ static int nvme_submit_io(struct nvme_ns *ns, struct nvme_user_io __user *uio) |
1998 |
+ |
1999 |
+ length = (io.nblocks + 1) << ns->lba_shift; |
2000 |
+ meta_len = (io.nblocks + 1) * ns->ms; |
2001 |
+- metadata = (void __user *)(uintptr_t)io.metadata; |
2002 |
++ metadata = nvme_to_user_ptr(io.metadata); |
2003 |
+ |
2004 |
+ if (ns->ext) { |
2005 |
+ length += meta_len; |
2006 |
+@@ -1290,7 +1303,7 @@ static int nvme_submit_io(struct nvme_ns *ns, struct nvme_user_io __user *uio) |
2007 |
+ c.rw.appmask = cpu_to_le16(io.appmask); |
2008 |
+ |
2009 |
+ return nvme_submit_user_cmd(ns->queue, &c, |
2010 |
+- (void __user *)(uintptr_t)io.addr, length, |
2011 |
++ nvme_to_user_ptr(io.addr), length, |
2012 |
+ metadata, meta_len, lower_32_bits(io.slba), NULL, 0); |
2013 |
+ } |
2014 |
+ |
2015 |
+@@ -1410,9 +1423,9 @@ static int nvme_user_cmd(struct nvme_ctrl *ctrl, struct nvme_ns *ns, |
2016 |
+ |
2017 |
+ effects = nvme_passthru_start(ctrl, ns, cmd.opcode); |
2018 |
+ status = nvme_submit_user_cmd(ns ? ns->queue : ctrl->admin_q, &c, |
2019 |
+- (void __user *)(uintptr_t)cmd.addr, cmd.data_len, |
2020 |
+- (void __user *)(uintptr_t)cmd.metadata, |
2021 |
+- cmd.metadata_len, 0, &result, timeout); |
2022 |
++ nvme_to_user_ptr(cmd.addr), cmd.data_len, |
2023 |
++ nvme_to_user_ptr(cmd.metadata), cmd.metadata_len, |
2024 |
++ 0, &result, timeout); |
2025 |
+ nvme_passthru_end(ctrl, effects); |
2026 |
+ |
2027 |
+ if (status >= 0) { |
2028 |
+@@ -1457,8 +1470,8 @@ static int nvme_user_cmd64(struct nvme_ctrl *ctrl, struct nvme_ns *ns, |
2029 |
+ |
2030 |
+ effects = nvme_passthru_start(ctrl, ns, cmd.opcode); |
2031 |
+ status = nvme_submit_user_cmd(ns ? ns->queue : ctrl->admin_q, &c, |
2032 |
+- (void __user *)(uintptr_t)cmd.addr, cmd.data_len, |
2033 |
+- (void __user *)(uintptr_t)cmd.metadata, cmd.metadata_len, |
2034 |
++ nvme_to_user_ptr(cmd.addr), cmd.data_len, |
2035 |
++ nvme_to_user_ptr(cmd.metadata), cmd.metadata_len, |
2036 |
+ 0, &cmd.result, timeout); |
2037 |
+ nvme_passthru_end(ctrl, effects); |
2038 |
+ |
2039 |
+diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c |
2040 |
+index aed6354cb271..56caddeabb5e 100644 |
2041 |
+--- a/drivers/nvme/host/multipath.c |
2042 |
++++ b/drivers/nvme/host/multipath.c |
2043 |
+@@ -510,7 +510,7 @@ static int nvme_update_ana_state(struct nvme_ctrl *ctrl, |
2044 |
+ if (!nr_nsids) |
2045 |
+ return 0; |
2046 |
+ |
2047 |
+- down_write(&ctrl->namespaces_rwsem); |
2048 |
++ down_read(&ctrl->namespaces_rwsem); |
2049 |
+ list_for_each_entry(ns, &ctrl->namespaces, list) { |
2050 |
+ unsigned nsid = le32_to_cpu(desc->nsids[n]); |
2051 |
+ |
2052 |
+@@ -521,7 +521,7 @@ static int nvme_update_ana_state(struct nvme_ctrl *ctrl, |
2053 |
+ if (++n == nr_nsids) |
2054 |
+ break; |
2055 |
+ } |
2056 |
+- up_write(&ctrl->namespaces_rwsem); |
2057 |
++ up_read(&ctrl->namespaces_rwsem); |
2058 |
+ return 0; |
2059 |
+ } |
2060 |
+ |
2061 |
+diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c |
2062 |
+index 244984420b41..11e84ed4de36 100644 |
2063 |
+--- a/drivers/nvme/host/tcp.c |
2064 |
++++ b/drivers/nvme/host/tcp.c |
2065 |
+@@ -164,16 +164,14 @@ static inline bool nvme_tcp_async_req(struct nvme_tcp_request *req) |
2066 |
+ static inline bool nvme_tcp_has_inline_data(struct nvme_tcp_request *req) |
2067 |
+ { |
2068 |
+ struct request *rq; |
2069 |
+- unsigned int bytes; |
2070 |
+ |
2071 |
+ if (unlikely(nvme_tcp_async_req(req))) |
2072 |
+ return false; /* async events don't have a request */ |
2073 |
+ |
2074 |
+ rq = blk_mq_rq_from_pdu(req); |
2075 |
+- bytes = blk_rq_payload_bytes(rq); |
2076 |
+ |
2077 |
+- return rq_data_dir(rq) == WRITE && bytes && |
2078 |
+- bytes <= nvme_tcp_inline_data_size(req->queue); |
2079 |
++ return rq_data_dir(rq) == WRITE && req->data_len && |
2080 |
++ req->data_len <= nvme_tcp_inline_data_size(req->queue); |
2081 |
+ } |
2082 |
+ |
2083 |
+ static inline struct page *nvme_tcp_req_cur_page(struct nvme_tcp_request *req) |
2084 |
+@@ -2090,7 +2088,9 @@ static blk_status_t nvme_tcp_map_data(struct nvme_tcp_queue *queue, |
2085 |
+ |
2086 |
+ c->common.flags |= NVME_CMD_SGL_METABUF; |
2087 |
+ |
2088 |
+- if (rq_data_dir(rq) == WRITE && req->data_len && |
2089 |
++ if (!blk_rq_nr_phys_segments(rq)) |
2090 |
++ nvme_tcp_set_sg_null(c); |
2091 |
++ else if (rq_data_dir(rq) == WRITE && |
2092 |
+ req->data_len <= nvme_tcp_inline_data_size(queue)) |
2093 |
+ nvme_tcp_set_sg_inline(queue, c, req->data_len); |
2094 |
+ else |
2095 |
+@@ -2117,7 +2117,8 @@ static blk_status_t nvme_tcp_setup_cmd_pdu(struct nvme_ns *ns, |
2096 |
+ req->data_sent = 0; |
2097 |
+ req->pdu_len = 0; |
2098 |
+ req->pdu_sent = 0; |
2099 |
+- req->data_len = blk_rq_payload_bytes(rq); |
2100 |
++ req->data_len = blk_rq_nr_phys_segments(rq) ? |
2101 |
++ blk_rq_payload_bytes(rq) : 0; |
2102 |
+ req->curr_bio = rq->bio; |
2103 |
+ |
2104 |
+ if (rq_data_dir(rq) == WRITE && |
2105 |
+diff --git a/drivers/pci/hotplug/pciehp.h b/drivers/pci/hotplug/pciehp.h |
2106 |
+index 882ce82c4699..aa61d4c219d7 100644 |
2107 |
+--- a/drivers/pci/hotplug/pciehp.h |
2108 |
++++ b/drivers/pci/hotplug/pciehp.h |
2109 |
+@@ -174,10 +174,10 @@ void pciehp_set_indicators(struct controller *ctrl, int pwr, int attn); |
2110 |
+ |
2111 |
+ void pciehp_get_latch_status(struct controller *ctrl, u8 *status); |
2112 |
+ int pciehp_query_power_fault(struct controller *ctrl); |
2113 |
+-bool pciehp_card_present(struct controller *ctrl); |
2114 |
+-bool pciehp_card_present_or_link_active(struct controller *ctrl); |
2115 |
++int pciehp_card_present(struct controller *ctrl); |
2116 |
++int pciehp_card_present_or_link_active(struct controller *ctrl); |
2117 |
+ int pciehp_check_link_status(struct controller *ctrl); |
2118 |
+-bool pciehp_check_link_active(struct controller *ctrl); |
2119 |
++int pciehp_check_link_active(struct controller *ctrl); |
2120 |
+ void pciehp_release_ctrl(struct controller *ctrl); |
2121 |
+ |
2122 |
+ int pciehp_sysfs_enable_slot(struct hotplug_slot *hotplug_slot); |
2123 |
+diff --git a/drivers/pci/hotplug/pciehp_core.c b/drivers/pci/hotplug/pciehp_core.c |
2124 |
+index 56daad828c9e..312cc45c44c7 100644 |
2125 |
+--- a/drivers/pci/hotplug/pciehp_core.c |
2126 |
++++ b/drivers/pci/hotplug/pciehp_core.c |
2127 |
+@@ -139,10 +139,15 @@ static int get_adapter_status(struct hotplug_slot *hotplug_slot, u8 *value) |
2128 |
+ { |
2129 |
+ struct controller *ctrl = to_ctrl(hotplug_slot); |
2130 |
+ struct pci_dev *pdev = ctrl->pcie->port; |
2131 |
++ int ret; |
2132 |
+ |
2133 |
+ pci_config_pm_runtime_get(pdev); |
2134 |
+- *value = pciehp_card_present_or_link_active(ctrl); |
2135 |
++ ret = pciehp_card_present_or_link_active(ctrl); |
2136 |
+ pci_config_pm_runtime_put(pdev); |
2137 |
++ if (ret < 0) |
2138 |
++ return ret; |
2139 |
++ |
2140 |
++ *value = ret; |
2141 |
+ return 0; |
2142 |
+ } |
2143 |
+ |
2144 |
+@@ -158,13 +163,13 @@ static int get_adapter_status(struct hotplug_slot *hotplug_slot, u8 *value) |
2145 |
+ */ |
2146 |
+ static void pciehp_check_presence(struct controller *ctrl) |
2147 |
+ { |
2148 |
+- bool occupied; |
2149 |
++ int occupied; |
2150 |
+ |
2151 |
+ down_read(&ctrl->reset_lock); |
2152 |
+ mutex_lock(&ctrl->state_lock); |
2153 |
+ |
2154 |
+ occupied = pciehp_card_present_or_link_active(ctrl); |
2155 |
+- if ((occupied && (ctrl->state == OFF_STATE || |
2156 |
++ if ((occupied > 0 && (ctrl->state == OFF_STATE || |
2157 |
+ ctrl->state == BLINKINGON_STATE)) || |
2158 |
+ (!occupied && (ctrl->state == ON_STATE || |
2159 |
+ ctrl->state == BLINKINGOFF_STATE))) |
2160 |
+diff --git a/drivers/pci/hotplug/pciehp_ctrl.c b/drivers/pci/hotplug/pciehp_ctrl.c |
2161 |
+index dd8e4a5fb282..6503d15effbb 100644 |
2162 |
+--- a/drivers/pci/hotplug/pciehp_ctrl.c |
2163 |
++++ b/drivers/pci/hotplug/pciehp_ctrl.c |
2164 |
+@@ -226,7 +226,7 @@ void pciehp_handle_disable_request(struct controller *ctrl) |
2165 |
+ |
2166 |
+ void pciehp_handle_presence_or_link_change(struct controller *ctrl, u32 events) |
2167 |
+ { |
2168 |
+- bool present, link_active; |
2169 |
++ int present, link_active; |
2170 |
+ |
2171 |
+ /* |
2172 |
+ * If the slot is on and presence or link has changed, turn it off. |
2173 |
+@@ -257,7 +257,7 @@ void pciehp_handle_presence_or_link_change(struct controller *ctrl, u32 events) |
2174 |
+ mutex_lock(&ctrl->state_lock); |
2175 |
+ present = pciehp_card_present(ctrl); |
2176 |
+ link_active = pciehp_check_link_active(ctrl); |
2177 |
+- if (!present && !link_active) { |
2178 |
++ if (present <= 0 && link_active <= 0) { |
2179 |
+ mutex_unlock(&ctrl->state_lock); |
2180 |
+ return; |
2181 |
+ } |
2182 |
+diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c |
2183 |
+index d74a71712cde..356786a3b7f4 100644 |
2184 |
+--- a/drivers/pci/hotplug/pciehp_hpc.c |
2185 |
++++ b/drivers/pci/hotplug/pciehp_hpc.c |
2186 |
+@@ -201,17 +201,29 @@ static void pcie_write_cmd_nowait(struct controller *ctrl, u16 cmd, u16 mask) |
2187 |
+ pcie_do_write_cmd(ctrl, cmd, mask, false); |
2188 |
+ } |
2189 |
+ |
2190 |
+-bool pciehp_check_link_active(struct controller *ctrl) |
2191 |
++/** |
2192 |
++ * pciehp_check_link_active() - Is the link active |
2193 |
++ * @ctrl: PCIe hotplug controller |
2194 |
++ * |
2195 |
++ * Check whether the downstream link is currently active. Note it is |
2196 |
++ * possible that the card is removed immediately after this so the |
2197 |
++ * caller may need to take it into account. |
2198 |
++ * |
2199 |
++ * If the hotplug controller itself is not available anymore returns |
2200 |
++ * %-ENODEV. |
2201 |
++ */ |
2202 |
++int pciehp_check_link_active(struct controller *ctrl) |
2203 |
+ { |
2204 |
+ struct pci_dev *pdev = ctrl_dev(ctrl); |
2205 |
+ u16 lnk_status; |
2206 |
+- bool ret; |
2207 |
++ int ret; |
2208 |
+ |
2209 |
+- pcie_capability_read_word(pdev, PCI_EXP_LNKSTA, &lnk_status); |
2210 |
+- ret = !!(lnk_status & PCI_EXP_LNKSTA_DLLLA); |
2211 |
++ ret = pcie_capability_read_word(pdev, PCI_EXP_LNKSTA, &lnk_status); |
2212 |
++ if (ret == PCIBIOS_DEVICE_NOT_FOUND || lnk_status == (u16)~0) |
2213 |
++ return -ENODEV; |
2214 |
+ |
2215 |
+- if (ret) |
2216 |
+- ctrl_dbg(ctrl, "%s: lnk_status = %x\n", __func__, lnk_status); |
2217 |
++ ret = !!(lnk_status & PCI_EXP_LNKSTA_DLLLA); |
2218 |
++ ctrl_dbg(ctrl, "%s: lnk_status = %x\n", __func__, lnk_status); |
2219 |
+ |
2220 |
+ return ret; |
2221 |
+ } |
2222 |
+@@ -373,13 +385,29 @@ void pciehp_get_latch_status(struct controller *ctrl, u8 *status) |
2223 |
+ *status = !!(slot_status & PCI_EXP_SLTSTA_MRLSS); |
2224 |
+ } |
2225 |
+ |
2226 |
+-bool pciehp_card_present(struct controller *ctrl) |
2227 |
++/** |
2228 |
++ * pciehp_card_present() - Is the card present |
2229 |
++ * @ctrl: PCIe hotplug controller |
2230 |
++ * |
2231 |
++ * Function checks whether the card is currently present in the slot and |
2232 |
++ * in that case returns true. Note it is possible that the card is |
2233 |
++ * removed immediately after the check so the caller may need to take |
2234 |
++ * this into account. |
2235 |
++ * |
2236 |
++ * It the hotplug controller itself is not available anymore returns |
2237 |
++ * %-ENODEV. |
2238 |
++ */ |
2239 |
++int pciehp_card_present(struct controller *ctrl) |
2240 |
+ { |
2241 |
+ struct pci_dev *pdev = ctrl_dev(ctrl); |
2242 |
+ u16 slot_status; |
2243 |
++ int ret; |
2244 |
+ |
2245 |
+- pcie_capability_read_word(pdev, PCI_EXP_SLTSTA, &slot_status); |
2246 |
+- return slot_status & PCI_EXP_SLTSTA_PDS; |
2247 |
++ ret = pcie_capability_read_word(pdev, PCI_EXP_SLTSTA, &slot_status); |
2248 |
++ if (ret == PCIBIOS_DEVICE_NOT_FOUND || slot_status == (u16)~0) |
2249 |
++ return -ENODEV; |
2250 |
++ |
2251 |
++ return !!(slot_status & PCI_EXP_SLTSTA_PDS); |
2252 |
+ } |
2253 |
+ |
2254 |
+ /** |
2255 |
+@@ -390,10 +418,19 @@ bool pciehp_card_present(struct controller *ctrl) |
2256 |
+ * Presence Detect State bit, this helper also returns true if the Link Active |
2257 |
+ * bit is set. This is a concession to broken hotplug ports which hardwire |
2258 |
+ * Presence Detect State to zero, such as Wilocity's [1ae9:0200]. |
2259 |
++ * |
2260 |
++ * Returns: %1 if the slot is occupied and %0 if it is not. If the hotplug |
2261 |
++ * port is not present anymore returns %-ENODEV. |
2262 |
+ */ |
2263 |
+-bool pciehp_card_present_or_link_active(struct controller *ctrl) |
2264 |
++int pciehp_card_present_or_link_active(struct controller *ctrl) |
2265 |
+ { |
2266 |
+- return pciehp_card_present(ctrl) || pciehp_check_link_active(ctrl); |
2267 |
++ int ret; |
2268 |
++ |
2269 |
++ ret = pciehp_card_present(ctrl); |
2270 |
++ if (ret) |
2271 |
++ return ret; |
2272 |
++ |
2273 |
++ return pciehp_check_link_active(ctrl); |
2274 |
+ } |
2275 |
+ |
2276 |
+ int pciehp_query_power_fault(struct controller *ctrl) |
2277 |
+diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c |
2278 |
+index 0c3086793e4e..5ea612a15550 100644 |
2279 |
+--- a/drivers/pci/pci-driver.c |
2280 |
++++ b/drivers/pci/pci-driver.c |
2281 |
+@@ -919,6 +919,8 @@ static int pci_pm_resume_noirq(struct device *dev) |
2282 |
+ struct pci_dev *pci_dev = to_pci_dev(dev); |
2283 |
+ struct device_driver *drv = dev->driver; |
2284 |
+ int error = 0; |
2285 |
++ pci_power_t prev_state = pci_dev->current_state; |
2286 |
++ bool skip_bus_pm = pci_dev->skip_bus_pm; |
2287 |
+ |
2288 |
+ if (dev_pm_may_skip_resume(dev)) |
2289 |
+ return 0; |
2290 |
+@@ -937,12 +939,15 @@ static int pci_pm_resume_noirq(struct device *dev) |
2291 |
+ * configuration here and attempting to put them into D0 again is |
2292 |
+ * pointless, so avoid doing that. |
2293 |
+ */ |
2294 |
+- if (!(pci_dev->skip_bus_pm && pm_suspend_no_platform())) |
2295 |
++ if (!(skip_bus_pm && pm_suspend_no_platform())) |
2296 |
+ pci_pm_default_resume_early(pci_dev); |
2297 |
+ |
2298 |
+ pci_fixup_device(pci_fixup_resume_early, pci_dev); |
2299 |
+ pcie_pme_root_status_cleanup(pci_dev); |
2300 |
+ |
2301 |
++ if (!skip_bus_pm && prev_state == PCI_D3cold) |
2302 |
++ pci_bridge_wait_for_secondary_bus(pci_dev); |
2303 |
++ |
2304 |
+ if (pci_has_legacy_pm_support(pci_dev)) |
2305 |
+ return pci_legacy_resume_early(dev); |
2306 |
+ |
2307 |
+@@ -1333,6 +1338,7 @@ static int pci_pm_runtime_resume(struct device *dev) |
2308 |
+ int rc = 0; |
2309 |
+ struct pci_dev *pci_dev = to_pci_dev(dev); |
2310 |
+ const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL; |
2311 |
++ pci_power_t prev_state = pci_dev->current_state; |
2312 |
+ |
2313 |
+ /* |
2314 |
+ * Restoring config space is necessary even if the device is not bound |
2315 |
+@@ -1348,6 +1354,9 @@ static int pci_pm_runtime_resume(struct device *dev) |
2316 |
+ pci_enable_wake(pci_dev, PCI_D0, false); |
2317 |
+ pci_fixup_device(pci_fixup_resume, pci_dev); |
2318 |
+ |
2319 |
++ if (prev_state == PCI_D3cold) |
2320 |
++ pci_bridge_wait_for_secondary_bus(pci_dev); |
2321 |
++ |
2322 |
+ if (pm && pm->runtime_resume) |
2323 |
+ rc = pm->runtime_resume(dev); |
2324 |
+ |
2325 |
+diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c |
2326 |
+index 981ae16f935b..779132aef0fb 100644 |
2327 |
+--- a/drivers/pci/pci.c |
2328 |
++++ b/drivers/pci/pci.c |
2329 |
+@@ -1019,8 +1019,6 @@ static void __pci_start_power_transition(struct pci_dev *dev, pci_power_t state) |
2330 |
+ * because have already delayed for the bridge. |
2331 |
+ */ |
2332 |
+ if (dev->runtime_d3cold) { |
2333 |
+- if (dev->d3cold_delay && !dev->imm_ready) |
2334 |
+- msleep(dev->d3cold_delay); |
2335 |
+ /* |
2336 |
+ * When powering on a bridge from D3cold, the |
2337 |
+ * whole hierarchy may be powered on into |
2338 |
+@@ -4605,14 +4603,17 @@ static int pci_pm_reset(struct pci_dev *dev, int probe) |
2339 |
+ |
2340 |
+ return pci_dev_wait(dev, "PM D3->D0", PCIE_RESET_READY_POLL_MS); |
2341 |
+ } |
2342 |
++ |
2343 |
+ /** |
2344 |
+- * pcie_wait_for_link - Wait until link is active or inactive |
2345 |
++ * pcie_wait_for_link_delay - Wait until link is active or inactive |
2346 |
+ * @pdev: Bridge device |
2347 |
+ * @active: waiting for active or inactive? |
2348 |
++ * @delay: Delay to wait after link has become active (in ms) |
2349 |
+ * |
2350 |
+ * Use this to wait till link becomes active or inactive. |
2351 |
+ */ |
2352 |
+-bool pcie_wait_for_link(struct pci_dev *pdev, bool active) |
2353 |
++static bool pcie_wait_for_link_delay(struct pci_dev *pdev, bool active, |
2354 |
++ int delay) |
2355 |
+ { |
2356 |
+ int timeout = 1000; |
2357 |
+ bool ret; |
2358 |
+@@ -4649,13 +4650,144 @@ bool pcie_wait_for_link(struct pci_dev *pdev, bool active) |
2359 |
+ timeout -= 10; |
2360 |
+ } |
2361 |
+ if (active && ret) |
2362 |
+- msleep(100); |
2363 |
++ msleep(delay); |
2364 |
+ else if (ret != active) |
2365 |
+ pci_info(pdev, "Data Link Layer Link Active not %s in 1000 msec\n", |
2366 |
+ active ? "set" : "cleared"); |
2367 |
+ return ret == active; |
2368 |
+ } |
2369 |
+ |
2370 |
++/** |
2371 |
++ * pcie_wait_for_link - Wait until link is active or inactive |
2372 |
++ * @pdev: Bridge device |
2373 |
++ * @active: waiting for active or inactive? |
2374 |
++ * |
2375 |
++ * Use this to wait till link becomes active or inactive. |
2376 |
++ */ |
2377 |
++bool pcie_wait_for_link(struct pci_dev *pdev, bool active) |
2378 |
++{ |
2379 |
++ return pcie_wait_for_link_delay(pdev, active, 100); |
2380 |
++} |
2381 |
++ |
2382 |
++/* |
2383 |
++ * Find maximum D3cold delay required by all the devices on the bus. The |
2384 |
++ * spec says 100 ms, but firmware can lower it and we allow drivers to |
2385 |
++ * increase it as well. |
2386 |
++ * |
2387 |
++ * Called with @pci_bus_sem locked for reading. |
2388 |
++ */ |
2389 |
++static int pci_bus_max_d3cold_delay(const struct pci_bus *bus) |
2390 |
++{ |
2391 |
++ const struct pci_dev *pdev; |
2392 |
++ int min_delay = 100; |
2393 |
++ int max_delay = 0; |
2394 |
++ |
2395 |
++ list_for_each_entry(pdev, &bus->devices, bus_list) { |
2396 |
++ if (pdev->d3cold_delay < min_delay) |
2397 |
++ min_delay = pdev->d3cold_delay; |
2398 |
++ if (pdev->d3cold_delay > max_delay) |
2399 |
++ max_delay = pdev->d3cold_delay; |
2400 |
++ } |
2401 |
++ |
2402 |
++ return max(min_delay, max_delay); |
2403 |
++} |
2404 |
++ |
2405 |
++/** |
2406 |
++ * pci_bridge_wait_for_secondary_bus - Wait for secondary bus to be accessible |
2407 |
++ * @dev: PCI bridge |
2408 |
++ * |
2409 |
++ * Handle necessary delays before access to the devices on the secondary |
2410 |
++ * side of the bridge are permitted after D3cold to D0 transition. |
2411 |
++ * |
2412 |
++ * For PCIe this means the delays in PCIe 5.0 section 6.6.1. For |
2413 |
++ * conventional PCI it means Tpvrh + Trhfa specified in PCI 3.0 section |
2414 |
++ * 4.3.2. |
2415 |
++ */ |
2416 |
++void pci_bridge_wait_for_secondary_bus(struct pci_dev *dev) |
2417 |
++{ |
2418 |
++ struct pci_dev *child; |
2419 |
++ int delay; |
2420 |
++ |
2421 |
++ if (pci_dev_is_disconnected(dev)) |
2422 |
++ return; |
2423 |
++ |
2424 |
++ if (!pci_is_bridge(dev) || !dev->bridge_d3) |
2425 |
++ return; |
2426 |
++ |
2427 |
++ down_read(&pci_bus_sem); |
2428 |
++ |
2429 |
++ /* |
2430 |
++ * We only deal with devices that are present currently on the bus. |
2431 |
++ * For any hot-added devices the access delay is handled in pciehp |
2432 |
++ * board_added(). In case of ACPI hotplug the firmware is expected |
2433 |
++ * to configure the devices before OS is notified. |
2434 |
++ */ |
2435 |
++ if (!dev->subordinate || list_empty(&dev->subordinate->devices)) { |
2436 |
++ up_read(&pci_bus_sem); |
2437 |
++ return; |
2438 |
++ } |
2439 |
++ |
2440 |
++ /* Take d3cold_delay requirements into account */ |
2441 |
++ delay = pci_bus_max_d3cold_delay(dev->subordinate); |
2442 |
++ if (!delay) { |
2443 |
++ up_read(&pci_bus_sem); |
2444 |
++ return; |
2445 |
++ } |
2446 |
++ |
2447 |
++ child = list_first_entry(&dev->subordinate->devices, struct pci_dev, |
2448 |
++ bus_list); |
2449 |
++ up_read(&pci_bus_sem); |
2450 |
++ |
2451 |
++ /* |
2452 |
++ * Conventional PCI and PCI-X we need to wait Tpvrh + Trhfa before |
2453 |
++ * accessing the device after reset (that is 1000 ms + 100 ms). In |
2454 |
++ * practice this should not be needed because we don't do power |
2455 |
++ * management for them (see pci_bridge_d3_possible()). |
2456 |
++ */ |
2457 |
++ if (!pci_is_pcie(dev)) { |
2458 |
++ pci_dbg(dev, "waiting %d ms for secondary bus\n", 1000 + delay); |
2459 |
++ msleep(1000 + delay); |
2460 |
++ return; |
2461 |
++ } |
2462 |
++ |
2463 |
++ /* |
2464 |
++ * For PCIe downstream and root ports that do not support speeds |
2465 |
++ * greater than 5 GT/s need to wait minimum 100 ms. For higher |
2466 |
++ * speeds (gen3) we need to wait first for the data link layer to |
2467 |
++ * become active. |
2468 |
++ * |
2469 |
++ * However, 100 ms is the minimum and the PCIe spec says the |
2470 |
++ * software must allow at least 1s before it can determine that the |
2471 |
++ * device that did not respond is a broken device. There is |
2472 |
++ * evidence that 100 ms is not always enough, for example certain |
2473 |
++ * Titan Ridge xHCI controller does not always respond to |
2474 |
++ * configuration requests if we only wait for 100 ms (see |
2475 |
++ * https://bugzilla.kernel.org/show_bug.cgi?id=203885). |
2476 |
++ * |
2477 |
++ * Therefore we wait for 100 ms and check for the device presence. |
2478 |
++ * If it is still not present give it an additional 100 ms. |
2479 |
++ */ |
2480 |
++ if (!pcie_downstream_port(dev)) |
2481 |
++ return; |
2482 |
++ |
2483 |
++ if (pcie_get_speed_cap(dev) <= PCIE_SPEED_5_0GT) { |
2484 |
++ pci_dbg(dev, "waiting %d ms for downstream link\n", delay); |
2485 |
++ msleep(delay); |
2486 |
++ } else { |
2487 |
++ pci_dbg(dev, "waiting %d ms for downstream link, after activation\n", |
2488 |
++ delay); |
2489 |
++ if (!pcie_wait_for_link_delay(dev, true, delay)) { |
2490 |
++ /* Did not train, no need to wait any further */ |
2491 |
++ return; |
2492 |
++ } |
2493 |
++ } |
2494 |
++ |
2495 |
++ if (!pci_device_is_present(child)) { |
2496 |
++ pci_dbg(child, "waiting additional %d ms to become accessible\n", delay); |
2497 |
++ msleep(delay); |
2498 |
++ } |
2499 |
++} |
2500 |
++ |
2501 |
+ void pci_reset_secondary_bus(struct pci_dev *dev) |
2502 |
+ { |
2503 |
+ u16 ctrl; |
2504 |
+diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h |
2505 |
+index 273d60cb0762..a5adc2e2c351 100644 |
2506 |
+--- a/drivers/pci/pci.h |
2507 |
++++ b/drivers/pci/pci.h |
2508 |
+@@ -107,6 +107,7 @@ void pci_allocate_cap_save_buffers(struct pci_dev *dev); |
2509 |
+ void pci_free_cap_save_buffers(struct pci_dev *dev); |
2510 |
+ bool pci_bridge_d3_possible(struct pci_dev *dev); |
2511 |
+ void pci_bridge_d3_update(struct pci_dev *dev); |
2512 |
++void pci_bridge_wait_for_secondary_bus(struct pci_dev *dev); |
2513 |
+ |
2514 |
+ static inline void pci_wakeup_event(struct pci_dev *dev) |
2515 |
+ { |
2516 |
+diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c |
2517 |
+index 32c34330e5a6..5a1bbf2cb7e9 100644 |
2518 |
+--- a/drivers/pci/pcie/aspm.c |
2519 |
++++ b/drivers/pci/pcie/aspm.c |
2520 |
+@@ -64,6 +64,7 @@ struct pcie_link_state { |
2521 |
+ u32 clkpm_capable:1; /* Clock PM capable? */ |
2522 |
+ u32 clkpm_enabled:1; /* Current Clock PM state */ |
2523 |
+ u32 clkpm_default:1; /* Default Clock PM state by BIOS */ |
2524 |
++ u32 clkpm_disable:1; /* Clock PM disabled */ |
2525 |
+ |
2526 |
+ /* Exit latencies */ |
2527 |
+ struct aspm_latency latency_up; /* Upstream direction exit latency */ |
2528 |
+@@ -161,8 +162,11 @@ static void pcie_set_clkpm_nocheck(struct pcie_link_state *link, int enable) |
2529 |
+ |
2530 |
+ static void pcie_set_clkpm(struct pcie_link_state *link, int enable) |
2531 |
+ { |
2532 |
+- /* Don't enable Clock PM if the link is not Clock PM capable */ |
2533 |
+- if (!link->clkpm_capable) |
2534 |
++ /* |
2535 |
++ * Don't enable Clock PM if the link is not Clock PM capable |
2536 |
++ * or Clock PM is disabled |
2537 |
++ */ |
2538 |
++ if (!link->clkpm_capable || link->clkpm_disable) |
2539 |
+ enable = 0; |
2540 |
+ /* Need nothing if the specified equals to current state */ |
2541 |
+ if (link->clkpm_enabled == enable) |
2542 |
+@@ -192,7 +196,8 @@ static void pcie_clkpm_cap_init(struct pcie_link_state *link, int blacklist) |
2543 |
+ } |
2544 |
+ link->clkpm_enabled = enabled; |
2545 |
+ link->clkpm_default = enabled; |
2546 |
+- link->clkpm_capable = (blacklist) ? 0 : capable; |
2547 |
++ link->clkpm_capable = capable; |
2548 |
++ link->clkpm_disable = blacklist ? 1 : 0; |
2549 |
+ } |
2550 |
+ |
2551 |
+ static bool pcie_retrain_link(struct pcie_link_state *link) |
2552 |
+@@ -1097,10 +1102,9 @@ static int __pci_disable_link_state(struct pci_dev *pdev, int state, bool sem) |
2553 |
+ link->aspm_disable |= ASPM_STATE_L1; |
2554 |
+ pcie_config_aspm_link(link, policy_to_aspm_state(link)); |
2555 |
+ |
2556 |
+- if (state & PCIE_LINK_STATE_CLKPM) { |
2557 |
+- link->clkpm_capable = 0; |
2558 |
+- pcie_set_clkpm(link, 0); |
2559 |
+- } |
2560 |
++ if (state & PCIE_LINK_STATE_CLKPM) |
2561 |
++ link->clkpm_disable = 1; |
2562 |
++ pcie_set_clkpm(link, policy_to_clkpm_state(link)); |
2563 |
+ mutex_unlock(&aspm_lock); |
2564 |
+ if (sem) |
2565 |
+ up_read(&pci_bus_sem); |
2566 |
+diff --git a/drivers/pwm/pwm-bcm2835.c b/drivers/pwm/pwm-bcm2835.c |
2567 |
+index 91e24f01b54e..d78f86f8e462 100644 |
2568 |
+--- a/drivers/pwm/pwm-bcm2835.c |
2569 |
++++ b/drivers/pwm/pwm-bcm2835.c |
2570 |
+@@ -166,6 +166,7 @@ static int bcm2835_pwm_probe(struct platform_device *pdev) |
2571 |
+ |
2572 |
+ pc->chip.dev = &pdev->dev; |
2573 |
+ pc->chip.ops = &bcm2835_pwm_ops; |
2574 |
++ pc->chip.base = -1; |
2575 |
+ pc->chip.npwm = 2; |
2576 |
+ pc->chip.of_xlate = of_pwm_xlate_with_flags; |
2577 |
+ pc->chip.of_pwm_n_cells = 3; |
2578 |
+diff --git a/drivers/pwm/pwm-rcar.c b/drivers/pwm/pwm-rcar.c |
2579 |
+index 852eb2347954..b98ec8847b48 100644 |
2580 |
+--- a/drivers/pwm/pwm-rcar.c |
2581 |
++++ b/drivers/pwm/pwm-rcar.c |
2582 |
+@@ -228,24 +228,28 @@ static int rcar_pwm_probe(struct platform_device *pdev) |
2583 |
+ rcar_pwm->chip.base = -1; |
2584 |
+ rcar_pwm->chip.npwm = 1; |
2585 |
+ |
2586 |
++ pm_runtime_enable(&pdev->dev); |
2587 |
++ |
2588 |
+ ret = pwmchip_add(&rcar_pwm->chip); |
2589 |
+ if (ret < 0) { |
2590 |
+ dev_err(&pdev->dev, "failed to register PWM chip: %d\n", ret); |
2591 |
++ pm_runtime_disable(&pdev->dev); |
2592 |
+ return ret; |
2593 |
+ } |
2594 |
+ |
2595 |
+- pm_runtime_enable(&pdev->dev); |
2596 |
+- |
2597 |
+ return 0; |
2598 |
+ } |
2599 |
+ |
2600 |
+ static int rcar_pwm_remove(struct platform_device *pdev) |
2601 |
+ { |
2602 |
+ struct rcar_pwm_chip *rcar_pwm = platform_get_drvdata(pdev); |
2603 |
++ int ret; |
2604 |
++ |
2605 |
++ ret = pwmchip_remove(&rcar_pwm->chip); |
2606 |
+ |
2607 |
+ pm_runtime_disable(&pdev->dev); |
2608 |
+ |
2609 |
+- return pwmchip_remove(&rcar_pwm->chip); |
2610 |
++ return ret; |
2611 |
+ } |
2612 |
+ |
2613 |
+ static const struct of_device_id rcar_pwm_of_table[] = { |
2614 |
+diff --git a/drivers/pwm/pwm-renesas-tpu.c b/drivers/pwm/pwm-renesas-tpu.c |
2615 |
+index 4a855a21b782..8032acc84161 100644 |
2616 |
+--- a/drivers/pwm/pwm-renesas-tpu.c |
2617 |
++++ b/drivers/pwm/pwm-renesas-tpu.c |
2618 |
+@@ -415,16 +415,17 @@ static int tpu_probe(struct platform_device *pdev) |
2619 |
+ tpu->chip.base = -1; |
2620 |
+ tpu->chip.npwm = TPU_CHANNEL_MAX; |
2621 |
+ |
2622 |
++ pm_runtime_enable(&pdev->dev); |
2623 |
++ |
2624 |
+ ret = pwmchip_add(&tpu->chip); |
2625 |
+ if (ret < 0) { |
2626 |
+ dev_err(&pdev->dev, "failed to register PWM chip\n"); |
2627 |
++ pm_runtime_disable(&pdev->dev); |
2628 |
+ return ret; |
2629 |
+ } |
2630 |
+ |
2631 |
+ dev_info(&pdev->dev, "TPU PWM %d registered\n", tpu->pdev->id); |
2632 |
+ |
2633 |
+- pm_runtime_enable(&pdev->dev); |
2634 |
+- |
2635 |
+ return 0; |
2636 |
+ } |
2637 |
+ |
2638 |
+@@ -434,12 +435,10 @@ static int tpu_remove(struct platform_device *pdev) |
2639 |
+ int ret; |
2640 |
+ |
2641 |
+ ret = pwmchip_remove(&tpu->chip); |
2642 |
+- if (ret) |
2643 |
+- return ret; |
2644 |
+ |
2645 |
+ pm_runtime_disable(&pdev->dev); |
2646 |
+ |
2647 |
+- return 0; |
2648 |
++ return ret; |
2649 |
+ } |
2650 |
+ |
2651 |
+ #ifdef CONFIG_OF |
2652 |
+diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c |
2653 |
+index 0c6245fc7706..983f9c9e08de 100644 |
2654 |
+--- a/drivers/s390/cio/device.c |
2655 |
++++ b/drivers/s390/cio/device.c |
2656 |
+@@ -849,8 +849,10 @@ static void io_subchannel_register(struct ccw_device *cdev) |
2657 |
+ * Now we know this subchannel will stay, we can throw |
2658 |
+ * our delayed uevent. |
2659 |
+ */ |
2660 |
+- dev_set_uevent_suppress(&sch->dev, 0); |
2661 |
+- kobject_uevent(&sch->dev.kobj, KOBJ_ADD); |
2662 |
++ if (dev_get_uevent_suppress(&sch->dev)) { |
2663 |
++ dev_set_uevent_suppress(&sch->dev, 0); |
2664 |
++ kobject_uevent(&sch->dev.kobj, KOBJ_ADD); |
2665 |
++ } |
2666 |
+ /* make it known to the system */ |
2667 |
+ ret = ccw_device_add(cdev); |
2668 |
+ if (ret) { |
2669 |
+@@ -1058,8 +1060,11 @@ static int io_subchannel_probe(struct subchannel *sch) |
2670 |
+ * Throw the delayed uevent for the subchannel, register |
2671 |
+ * the ccw_device and exit. |
2672 |
+ */ |
2673 |
+- dev_set_uevent_suppress(&sch->dev, 0); |
2674 |
+- kobject_uevent(&sch->dev.kobj, KOBJ_ADD); |
2675 |
++ if (dev_get_uevent_suppress(&sch->dev)) { |
2676 |
++ /* should always be the case for the console */ |
2677 |
++ dev_set_uevent_suppress(&sch->dev, 0); |
2678 |
++ kobject_uevent(&sch->dev.kobj, KOBJ_ADD); |
2679 |
++ } |
2680 |
+ cdev = sch_get_cdev(sch); |
2681 |
+ rc = ccw_device_add(cdev); |
2682 |
+ if (rc) { |
2683 |
+diff --git a/drivers/s390/cio/vfio_ccw_drv.c b/drivers/s390/cio/vfio_ccw_drv.c |
2684 |
+index e401a3d0aa57..339a6bc0339b 100644 |
2685 |
+--- a/drivers/s390/cio/vfio_ccw_drv.c |
2686 |
++++ b/drivers/s390/cio/vfio_ccw_drv.c |
2687 |
+@@ -167,6 +167,11 @@ static int vfio_ccw_sch_probe(struct subchannel *sch) |
2688 |
+ if (ret) |
2689 |
+ goto out_disable; |
2690 |
+ |
2691 |
++ if (dev_get_uevent_suppress(&sch->dev)) { |
2692 |
++ dev_set_uevent_suppress(&sch->dev, 0); |
2693 |
++ kobject_uevent(&sch->dev.kobj, KOBJ_ADD); |
2694 |
++ } |
2695 |
++ |
2696 |
+ VFIO_CCW_MSG_EVENT(4, "bound to subchannel %x.%x.%04x\n", |
2697 |
+ sch->schid.cssid, sch->schid.ssid, |
2698 |
+ sch->schid.sch_no); |
2699 |
+diff --git a/drivers/scsi/libfc/fc_rport.c b/drivers/scsi/libfc/fc_rport.c |
2700 |
+index da6e97d8dc3b..6bb8917b99a1 100644 |
2701 |
+--- a/drivers/scsi/libfc/fc_rport.c |
2702 |
++++ b/drivers/scsi/libfc/fc_rport.c |
2703 |
+@@ -1208,9 +1208,15 @@ static void fc_rport_prli_resp(struct fc_seq *sp, struct fc_frame *fp, |
2704 |
+ rjt = fc_frame_payload_get(fp, sizeof(*rjt)); |
2705 |
+ if (!rjt) |
2706 |
+ FC_RPORT_DBG(rdata, "PRLI bad response\n"); |
2707 |
+- else |
2708 |
++ else { |
2709 |
+ FC_RPORT_DBG(rdata, "PRLI ELS rejected, reason %x expl %x\n", |
2710 |
+ rjt->er_reason, rjt->er_explan); |
2711 |
++ if (rjt->er_reason == ELS_RJT_UNAB && |
2712 |
++ rjt->er_explan == ELS_EXPL_PLOGI_REQD) { |
2713 |
++ fc_rport_enter_plogi(rdata); |
2714 |
++ goto out; |
2715 |
++ } |
2716 |
++ } |
2717 |
+ fc_rport_error_retry(rdata, FC_EX_ELS_RJT); |
2718 |
+ } |
2719 |
+ |
2720 |
+diff --git a/drivers/scsi/lpfc/lpfc_nvme.c b/drivers/scsi/lpfc/lpfc_nvme.c |
2721 |
+index a227e36cbdc2..5a86a1ee0de3 100644 |
2722 |
+--- a/drivers/scsi/lpfc/lpfc_nvme.c |
2723 |
++++ b/drivers/scsi/lpfc/lpfc_nvme.c |
2724 |
+@@ -342,13 +342,15 @@ lpfc_nvme_remoteport_delete(struct nvme_fc_remote_port *remoteport) |
2725 |
+ if (ndlp->upcall_flags & NLP_WAIT_FOR_UNREG) { |
2726 |
+ ndlp->nrport = NULL; |
2727 |
+ ndlp->upcall_flags &= ~NLP_WAIT_FOR_UNREG; |
2728 |
+- } |
2729 |
+- spin_unlock_irq(&vport->phba->hbalock); |
2730 |
++ spin_unlock_irq(&vport->phba->hbalock); |
2731 |
+ |
2732 |
+- /* Remove original register reference. The host transport |
2733 |
+- * won't reference this rport/remoteport any further. |
2734 |
+- */ |
2735 |
+- lpfc_nlp_put(ndlp); |
2736 |
++ /* Remove original register reference. The host transport |
2737 |
++ * won't reference this rport/remoteport any further. |
2738 |
++ */ |
2739 |
++ lpfc_nlp_put(ndlp); |
2740 |
++ } else { |
2741 |
++ spin_unlock_irq(&vport->phba->hbalock); |
2742 |
++ } |
2743 |
+ |
2744 |
+ rport_err: |
2745 |
+ return; |
2746 |
+diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c |
2747 |
+index 0717e850bcbf..a951e1c8165e 100644 |
2748 |
+--- a/drivers/scsi/lpfc/lpfc_sli.c |
2749 |
++++ b/drivers/scsi/lpfc/lpfc_sli.c |
2750 |
+@@ -2481,6 +2481,8 @@ lpfc_sli_def_mbox_cmpl(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) |
2751 |
+ !pmb->u.mb.mbxStatus) { |
2752 |
+ rpi = pmb->u.mb.un.varWords[0]; |
2753 |
+ vpi = pmb->u.mb.un.varRegLogin.vpi; |
2754 |
++ if (phba->sli_rev == LPFC_SLI_REV4) |
2755 |
++ vpi -= phba->sli4_hba.max_cfg_param.vpi_base; |
2756 |
+ lpfc_unreg_login(phba, vpi, rpi, pmb); |
2757 |
+ pmb->vport = vport; |
2758 |
+ pmb->mbox_cmpl = lpfc_sli_def_mbox_cmpl; |
2759 |
+@@ -4011,6 +4013,11 @@ lpfc_sli_flush_io_rings(struct lpfc_hba *phba) |
2760 |
+ struct lpfc_iocbq *piocb, *next_iocb; |
2761 |
+ |
2762 |
+ spin_lock_irq(&phba->hbalock); |
2763 |
++ if (phba->hba_flag & HBA_IOQ_FLUSH || |
2764 |
++ !phba->sli4_hba.hdwq) { |
2765 |
++ spin_unlock_irq(&phba->hbalock); |
2766 |
++ return; |
2767 |
++ } |
2768 |
+ /* Indicate the I/O queues are flushed */ |
2769 |
+ phba->hba_flag |= HBA_IOQ_FLUSH; |
2770 |
+ spin_unlock_irq(&phba->hbalock); |
2771 |
+diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c |
2772 |
+index 271afea654e2..a5c78b38d302 100644 |
2773 |
+--- a/drivers/scsi/scsi_transport_iscsi.c |
2774 |
++++ b/drivers/scsi/scsi_transport_iscsi.c |
2775 |
+@@ -2012,7 +2012,7 @@ static void __iscsi_unbind_session(struct work_struct *work) |
2776 |
+ if (session->target_id == ISCSI_MAX_TARGET) { |
2777 |
+ spin_unlock_irqrestore(&session->lock, flags); |
2778 |
+ mutex_unlock(&ihost->mutex); |
2779 |
+- return; |
2780 |
++ goto unbind_session_exit; |
2781 |
+ } |
2782 |
+ |
2783 |
+ target_id = session->target_id; |
2784 |
+@@ -2024,6 +2024,8 @@ static void __iscsi_unbind_session(struct work_struct *work) |
2785 |
+ ida_simple_remove(&iscsi_sess_ida, target_id); |
2786 |
+ |
2787 |
+ scsi_remove_target(&session->dev); |
2788 |
++ |
2789 |
++unbind_session_exit: |
2790 |
+ iscsi_session_event(session, ISCSI_KEVENT_UNBIND_SESSION); |
2791 |
+ ISCSI_DBG_TRANS_SESSION(session, "Completed target removal\n"); |
2792 |
+ } |
2793 |
+diff --git a/drivers/scsi/smartpqi/smartpqi.h b/drivers/scsi/smartpqi/smartpqi.h |
2794 |
+index 79d2af36f655..7a3a942b40df 100644 |
2795 |
+--- a/drivers/scsi/smartpqi/smartpqi.h |
2796 |
++++ b/drivers/scsi/smartpqi/smartpqi.h |
2797 |
+@@ -907,7 +907,6 @@ struct pqi_scsi_dev { |
2798 |
+ u8 scsi3addr[8]; |
2799 |
+ __be64 wwid; |
2800 |
+ u8 volume_id[16]; |
2801 |
+- u8 unique_id[16]; |
2802 |
+ u8 is_physical_device : 1; |
2803 |
+ u8 is_external_raid_device : 1; |
2804 |
+ u8 is_expander_smp_device : 1; |
2805 |
+@@ -1130,8 +1129,9 @@ struct pqi_ctrl_info { |
2806 |
+ struct mutex ofa_mutex; /* serialize ofa */ |
2807 |
+ bool controller_online; |
2808 |
+ bool block_requests; |
2809 |
+- bool in_shutdown; |
2810 |
++ bool block_device_reset; |
2811 |
+ bool in_ofa; |
2812 |
++ bool in_shutdown; |
2813 |
+ u8 inbound_spanning_supported : 1; |
2814 |
+ u8 outbound_spanning_supported : 1; |
2815 |
+ u8 pqi_mode_enabled : 1; |
2816 |
+@@ -1173,6 +1173,7 @@ struct pqi_ctrl_info { |
2817 |
+ struct pqi_ofa_memory *pqi_ofa_mem_virt_addr; |
2818 |
+ dma_addr_t pqi_ofa_mem_dma_handle; |
2819 |
+ void **pqi_ofa_chunk_virt_addr; |
2820 |
++ atomic_t sync_cmds_outstanding; |
2821 |
+ }; |
2822 |
+ |
2823 |
+ enum pqi_ctrl_mode { |
2824 |
+@@ -1423,6 +1424,11 @@ static inline bool pqi_ctrl_blocked(struct pqi_ctrl_info *ctrl_info) |
2825 |
+ return ctrl_info->block_requests; |
2826 |
+ } |
2827 |
+ |
2828 |
++static inline bool pqi_device_reset_blocked(struct pqi_ctrl_info *ctrl_info) |
2829 |
++{ |
2830 |
++ return ctrl_info->block_device_reset; |
2831 |
++} |
2832 |
++ |
2833 |
+ void pqi_sas_smp_handler(struct bsg_job *job, struct Scsi_Host *shost, |
2834 |
+ struct sas_rphy *rphy); |
2835 |
+ |
2836 |
+diff --git a/drivers/scsi/smartpqi/smartpqi_init.c b/drivers/scsi/smartpqi/smartpqi_init.c |
2837 |
+index ea5409bebf57..5ae074505386 100644 |
2838 |
+--- a/drivers/scsi/smartpqi/smartpqi_init.c |
2839 |
++++ b/drivers/scsi/smartpqi/smartpqi_init.c |
2840 |
+@@ -249,6 +249,11 @@ static inline void pqi_ctrl_unblock_requests(struct pqi_ctrl_info *ctrl_info) |
2841 |
+ scsi_unblock_requests(ctrl_info->scsi_host); |
2842 |
+ } |
2843 |
+ |
2844 |
++static inline void pqi_ctrl_block_device_reset(struct pqi_ctrl_info *ctrl_info) |
2845 |
++{ |
2846 |
++ ctrl_info->block_device_reset = true; |
2847 |
++} |
2848 |
++ |
2849 |
+ static unsigned long pqi_wait_if_ctrl_blocked(struct pqi_ctrl_info *ctrl_info, |
2850 |
+ unsigned long timeout_msecs) |
2851 |
+ { |
2852 |
+@@ -331,6 +336,16 @@ static inline bool pqi_device_in_remove(struct pqi_ctrl_info *ctrl_info, |
2853 |
+ return device->in_remove && !ctrl_info->in_shutdown; |
2854 |
+ } |
2855 |
+ |
2856 |
++static inline void pqi_ctrl_shutdown_start(struct pqi_ctrl_info *ctrl_info) |
2857 |
++{ |
2858 |
++ ctrl_info->in_shutdown = true; |
2859 |
++} |
2860 |
++ |
2861 |
++static inline bool pqi_ctrl_in_shutdown(struct pqi_ctrl_info *ctrl_info) |
2862 |
++{ |
2863 |
++ return ctrl_info->in_shutdown; |
2864 |
++} |
2865 |
++ |
2866 |
+ static inline void pqi_schedule_rescan_worker_with_delay( |
2867 |
+ struct pqi_ctrl_info *ctrl_info, unsigned long delay) |
2868 |
+ { |
2869 |
+@@ -360,6 +375,11 @@ static inline void pqi_cancel_rescan_worker(struct pqi_ctrl_info *ctrl_info) |
2870 |
+ cancel_delayed_work_sync(&ctrl_info->rescan_work); |
2871 |
+ } |
2872 |
+ |
2873 |
++static inline void pqi_cancel_event_worker(struct pqi_ctrl_info *ctrl_info) |
2874 |
++{ |
2875 |
++ cancel_work_sync(&ctrl_info->event_work); |
2876 |
++} |
2877 |
++ |
2878 |
+ static inline u32 pqi_read_heartbeat_counter(struct pqi_ctrl_info *ctrl_info) |
2879 |
+ { |
2880 |
+ if (!ctrl_info->heartbeat_counter) |
2881 |
+@@ -628,79 +648,6 @@ static inline int pqi_scsi_inquiry(struct pqi_ctrl_info *ctrl_info, |
2882 |
+ buffer, buffer_length, vpd_page, NULL, NO_TIMEOUT); |
2883 |
+ } |
2884 |
+ |
2885 |
+-static bool pqi_vpd_page_supported(struct pqi_ctrl_info *ctrl_info, |
2886 |
+- u8 *scsi3addr, u16 vpd_page) |
2887 |
+-{ |
2888 |
+- int rc; |
2889 |
+- int i; |
2890 |
+- int pages; |
2891 |
+- unsigned char *buf, bufsize; |
2892 |
+- |
2893 |
+- buf = kzalloc(256, GFP_KERNEL); |
2894 |
+- if (!buf) |
2895 |
+- return false; |
2896 |
+- |
2897 |
+- /* Get the size of the page list first */ |
2898 |
+- rc = pqi_scsi_inquiry(ctrl_info, scsi3addr, |
2899 |
+- VPD_PAGE | SCSI_VPD_SUPPORTED_PAGES, |
2900 |
+- buf, SCSI_VPD_HEADER_SZ); |
2901 |
+- if (rc != 0) |
2902 |
+- goto exit_unsupported; |
2903 |
+- |
2904 |
+- pages = buf[3]; |
2905 |
+- if ((pages + SCSI_VPD_HEADER_SZ) <= 255) |
2906 |
+- bufsize = pages + SCSI_VPD_HEADER_SZ; |
2907 |
+- else |
2908 |
+- bufsize = 255; |
2909 |
+- |
2910 |
+- /* Get the whole VPD page list */ |
2911 |
+- rc = pqi_scsi_inquiry(ctrl_info, scsi3addr, |
2912 |
+- VPD_PAGE | SCSI_VPD_SUPPORTED_PAGES, |
2913 |
+- buf, bufsize); |
2914 |
+- if (rc != 0) |
2915 |
+- goto exit_unsupported; |
2916 |
+- |
2917 |
+- pages = buf[3]; |
2918 |
+- for (i = 1; i <= pages; i++) |
2919 |
+- if (buf[3 + i] == vpd_page) |
2920 |
+- goto exit_supported; |
2921 |
+- |
2922 |
+-exit_unsupported: |
2923 |
+- kfree(buf); |
2924 |
+- return false; |
2925 |
+- |
2926 |
+-exit_supported: |
2927 |
+- kfree(buf); |
2928 |
+- return true; |
2929 |
+-} |
2930 |
+- |
2931 |
+-static int pqi_get_device_id(struct pqi_ctrl_info *ctrl_info, |
2932 |
+- u8 *scsi3addr, u8 *device_id, int buflen) |
2933 |
+-{ |
2934 |
+- int rc; |
2935 |
+- unsigned char *buf; |
2936 |
+- |
2937 |
+- if (!pqi_vpd_page_supported(ctrl_info, scsi3addr, SCSI_VPD_DEVICE_ID)) |
2938 |
+- return 1; /* function not supported */ |
2939 |
+- |
2940 |
+- buf = kzalloc(64, GFP_KERNEL); |
2941 |
+- if (!buf) |
2942 |
+- return -ENOMEM; |
2943 |
+- |
2944 |
+- rc = pqi_scsi_inquiry(ctrl_info, scsi3addr, |
2945 |
+- VPD_PAGE | SCSI_VPD_DEVICE_ID, |
2946 |
+- buf, 64); |
2947 |
+- if (rc == 0) { |
2948 |
+- if (buflen > 16) |
2949 |
+- buflen = 16; |
2950 |
+- memcpy(device_id, &buf[SCSI_VPD_DEVICE_ID_IDX], buflen); |
2951 |
+- } |
2952 |
+- |
2953 |
+- kfree(buf); |
2954 |
+- |
2955 |
+- return rc; |
2956 |
+-} |
2957 |
+- |
2958 |
+ static int pqi_identify_physical_device(struct pqi_ctrl_info *ctrl_info, |
2959 |
+ struct pqi_scsi_dev *device, |
2960 |
+ struct bmic_identify_physical_device *buffer, |
2961 |
+@@ -1385,14 +1332,6 @@ static int pqi_get_device_info(struct pqi_ctrl_info *ctrl_info, |
2962 |
+ } |
2963 |
+ } |
2964 |
+ |
2965 |
+- if (pqi_get_device_id(ctrl_info, device->scsi3addr, |
2966 |
+- device->unique_id, sizeof(device->unique_id)) < 0) |
2967 |
+- dev_warn(&ctrl_info->pci_dev->dev, |
2968 |
+- "Can't get device id for scsi %d:%d:%d:%d\n", |
2969 |
+- ctrl_info->scsi_host->host_no, |
2970 |
+- device->bus, device->target, |
2971 |
+- device->lun); |
2972 |
+- |
2973 |
+ out: |
2974 |
+ kfree(buffer); |
2975 |
+ |
2976 |
+@@ -4122,6 +4061,8 @@ static int pqi_submit_raid_request_synchronous(struct pqi_ctrl_info *ctrl_info, |
2977 |
+ goto out; |
2978 |
+ } |
2979 |
+ |
2980 |
++ atomic_inc(&ctrl_info->sync_cmds_outstanding); |
2981 |
++ |
2982 |
+ io_request = pqi_alloc_io_request(ctrl_info); |
2983 |
+ |
2984 |
+ put_unaligned_le16(io_request->index, |
2985 |
+@@ -4168,6 +4109,7 @@ static int pqi_submit_raid_request_synchronous(struct pqi_ctrl_info *ctrl_info, |
2986 |
+ |
2987 |
+ pqi_free_io_request(io_request); |
2988 |
+ |
2989 |
++ atomic_dec(&ctrl_info->sync_cmds_outstanding); |
2990 |
+ out: |
2991 |
+ up(&ctrl_info->sync_request_sem); |
2992 |
+ |
2993 |
+@@ -5402,7 +5344,7 @@ static int pqi_scsi_queue_command(struct Scsi_Host *shost, |
2994 |
+ |
2995 |
+ pqi_ctrl_busy(ctrl_info); |
2996 |
+ if (pqi_ctrl_blocked(ctrl_info) || pqi_device_in_reset(device) || |
2997 |
+- pqi_ctrl_in_ofa(ctrl_info)) { |
2998 |
++ pqi_ctrl_in_ofa(ctrl_info) || pqi_ctrl_in_shutdown(ctrl_info)) { |
2999 |
+ rc = SCSI_MLQUEUE_HOST_BUSY; |
3000 |
+ goto out; |
3001 |
+ } |
3002 |
+@@ -5650,6 +5592,18 @@ static int pqi_ctrl_wait_for_pending_io(struct pqi_ctrl_info *ctrl_info, |
3003 |
+ return 0; |
3004 |
+ } |
3005 |
+ |
3006 |
++static int pqi_ctrl_wait_for_pending_sync_cmds(struct pqi_ctrl_info *ctrl_info) |
3007 |
++{ |
3008 |
++ while (atomic_read(&ctrl_info->sync_cmds_outstanding)) { |
3009 |
++ pqi_check_ctrl_health(ctrl_info); |
3010 |
++ if (pqi_ctrl_offline(ctrl_info)) |
3011 |
++ return -ENXIO; |
3012 |
++ usleep_range(1000, 2000); |
3013 |
++ } |
3014 |
++ |
3015 |
++ return 0; |
3016 |
++} |
3017 |
++ |
3018 |
+ static void pqi_lun_reset_complete(struct pqi_io_request *io_request, |
3019 |
+ void *context) |
3020 |
+ { |
3021 |
+@@ -5787,17 +5741,17 @@ static int pqi_eh_device_reset_handler(struct scsi_cmnd *scmd) |
3022 |
+ shost->host_no, device->bus, device->target, device->lun); |
3023 |
+ |
3024 |
+ pqi_check_ctrl_health(ctrl_info); |
3025 |
+- if (pqi_ctrl_offline(ctrl_info)) { |
3026 |
+- dev_err(&ctrl_info->pci_dev->dev, |
3027 |
+- "controller %u offlined - cannot send device reset\n", |
3028 |
+- ctrl_info->ctrl_id); |
3029 |
++ if (pqi_ctrl_offline(ctrl_info) || |
3030 |
++ pqi_device_reset_blocked(ctrl_info)) { |
3031 |
+ rc = FAILED; |
3032 |
+ goto out; |
3033 |
+ } |
3034 |
+ |
3035 |
+ pqi_wait_until_ofa_finished(ctrl_info); |
3036 |
+ |
3037 |
++ atomic_inc(&ctrl_info->sync_cmds_outstanding); |
3038 |
+ rc = pqi_device_reset(ctrl_info, device); |
3039 |
++ atomic_dec(&ctrl_info->sync_cmds_outstanding); |
3040 |
+ |
3041 |
+ out: |
3042 |
+ dev_err(&ctrl_info->pci_dev->dev, |
3043 |
+@@ -6119,7 +6073,8 @@ static int pqi_ioctl(struct scsi_device *sdev, unsigned int cmd, |
3044 |
+ |
3045 |
+ ctrl_info = shost_to_hba(sdev->host); |
3046 |
+ |
3047 |
+- if (pqi_ctrl_in_ofa(ctrl_info)) |
3048 |
++ if (pqi_ctrl_in_ofa(ctrl_info) || |
3049 |
++ pqi_ctrl_in_shutdown(ctrl_info)) |
3050 |
+ return -EBUSY; |
3051 |
+ |
3052 |
+ switch (cmd) { |
3053 |
+@@ -6283,7 +6238,7 @@ static ssize_t pqi_unique_id_show(struct device *dev, |
3054 |
+ struct scsi_device *sdev; |
3055 |
+ struct pqi_scsi_dev *device; |
3056 |
+ unsigned long flags; |
3057 |
+- unsigned char uid[16]; |
3058 |
++ u8 unique_id[16]; |
3059 |
+ |
3060 |
+ sdev = to_scsi_device(dev); |
3061 |
+ ctrl_info = shost_to_hba(sdev->host); |
3062 |
+@@ -6296,16 +6251,22 @@ static ssize_t pqi_unique_id_show(struct device *dev, |
3063 |
+ flags); |
3064 |
+ return -ENODEV; |
3065 |
+ } |
3066 |
+- memcpy(uid, device->unique_id, sizeof(uid)); |
3067 |
++ |
3068 |
++ if (device->is_physical_device) { |
3069 |
++ memset(unique_id, 0, 8); |
3070 |
++ memcpy(unique_id + 8, &device->wwid, sizeof(device->wwid)); |
3071 |
++ } else { |
3072 |
++ memcpy(unique_id, device->volume_id, sizeof(device->volume_id)); |
3073 |
++ } |
3074 |
+ |
3075 |
+ spin_unlock_irqrestore(&ctrl_info->scsi_device_list_lock, flags); |
3076 |
+ |
3077 |
+ return snprintf(buffer, PAGE_SIZE, |
3078 |
+ "%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X\n", |
3079 |
+- uid[0], uid[1], uid[2], uid[3], |
3080 |
+- uid[4], uid[5], uid[6], uid[7], |
3081 |
+- uid[8], uid[9], uid[10], uid[11], |
3082 |
+- uid[12], uid[13], uid[14], uid[15]); |
3083 |
++ unique_id[0], unique_id[1], unique_id[2], unique_id[3], |
3084 |
++ unique_id[4], unique_id[5], unique_id[6], unique_id[7], |
3085 |
++ unique_id[8], unique_id[9], unique_id[10], unique_id[11], |
3086 |
++ unique_id[12], unique_id[13], unique_id[14], unique_id[15]); |
3087 |
+ } |
3088 |
+ |
3089 |
+ static ssize_t pqi_lunid_show(struct device *dev, |
3090 |
+@@ -7074,13 +7035,20 @@ static int pqi_force_sis_mode(struct pqi_ctrl_info *ctrl_info) |
3091 |
+ return pqi_revert_to_sis_mode(ctrl_info); |
3092 |
+ } |
3093 |
+ |
3094 |
++#define PQI_POST_RESET_DELAY_B4_MSGU_READY 5000 |
3095 |
++ |
3096 |
+ static int pqi_ctrl_init(struct pqi_ctrl_info *ctrl_info) |
3097 |
+ { |
3098 |
+ int rc; |
3099 |
+ |
3100 |
+- rc = pqi_force_sis_mode(ctrl_info); |
3101 |
+- if (rc) |
3102 |
+- return rc; |
3103 |
++ if (reset_devices) { |
3104 |
++ sis_soft_reset(ctrl_info); |
3105 |
++ msleep(PQI_POST_RESET_DELAY_B4_MSGU_READY); |
3106 |
++ } else { |
3107 |
++ rc = pqi_force_sis_mode(ctrl_info); |
3108 |
++ if (rc) |
3109 |
++ return rc; |
3110 |
++ } |
3111 |
+ |
3112 |
+ /* |
3113 |
+ * Wait until the controller is ready to start accepting SIS |
3114 |
+@@ -7514,6 +7482,7 @@ static struct pqi_ctrl_info *pqi_alloc_ctrl_info(int numa_node) |
3115 |
+ |
3116 |
+ INIT_WORK(&ctrl_info->event_work, pqi_event_worker); |
3117 |
+ atomic_set(&ctrl_info->num_interrupts, 0); |
3118 |
++ atomic_set(&ctrl_info->sync_cmds_outstanding, 0); |
3119 |
+ |
3120 |
+ INIT_DELAYED_WORK(&ctrl_info->rescan_work, pqi_rescan_worker); |
3121 |
+ INIT_DELAYED_WORK(&ctrl_info->update_time_work, pqi_update_time_worker); |
3122 |
+@@ -7787,8 +7756,6 @@ static int pqi_ofa_host_memory_update(struct pqi_ctrl_info *ctrl_info) |
3123 |
+ 0, NULL, NO_TIMEOUT); |
3124 |
+ } |
3125 |
+ |
3126 |
+-#define PQI_POST_RESET_DELAY_B4_MSGU_READY 5000 |
3127 |
+- |
3128 |
+ static int pqi_ofa_ctrl_restart(struct pqi_ctrl_info *ctrl_info) |
3129 |
+ { |
3130 |
+ msleep(PQI_POST_RESET_DELAY_B4_MSGU_READY); |
3131 |
+@@ -7956,28 +7923,74 @@ static void pqi_pci_remove(struct pci_dev *pci_dev) |
3132 |
+ pqi_remove_ctrl(ctrl_info); |
3133 |
+ } |
3134 |
+ |
3135 |
++static void pqi_crash_if_pending_command(struct pqi_ctrl_info *ctrl_info) |
3136 |
++{ |
3137 |
++ unsigned int i; |
3138 |
++ struct pqi_io_request *io_request; |
3139 |
++ struct scsi_cmnd *scmd; |
3140 |
++ |
3141 |
++ for (i = 0; i < ctrl_info->max_io_slots; i++) { |
3142 |
++ io_request = &ctrl_info->io_request_pool[i]; |
3143 |
++ if (atomic_read(&io_request->refcount) == 0) |
3144 |
++ continue; |
3145 |
++ scmd = io_request->scmd; |
3146 |
++ WARN_ON(scmd != NULL); /* IO command from SML */ |
3147 |
++ WARN_ON(scmd == NULL); /* Non-IO cmd or driver initiated*/ |
3148 |
++ } |
3149 |
++} |
3150 |
++ |
3151 |
+ static void pqi_shutdown(struct pci_dev *pci_dev) |
3152 |
+ { |
3153 |
+ int rc; |
3154 |
+ struct pqi_ctrl_info *ctrl_info; |
3155 |
+ |
3156 |
+ ctrl_info = pci_get_drvdata(pci_dev); |
3157 |
+- if (!ctrl_info) |
3158 |
+- goto error; |
3159 |
++ if (!ctrl_info) { |
3160 |
++ dev_err(&pci_dev->dev, |
3161 |
++ "cache could not be flushed\n"); |
3162 |
++ return; |
3163 |
++ } |
3164 |
++ |
3165 |
++ pqi_disable_events(ctrl_info); |
3166 |
++ pqi_wait_until_ofa_finished(ctrl_info); |
3167 |
++ pqi_cancel_update_time_worker(ctrl_info); |
3168 |
++ pqi_cancel_rescan_worker(ctrl_info); |
3169 |
++ pqi_cancel_event_worker(ctrl_info); |
3170 |
++ |
3171 |
++ pqi_ctrl_shutdown_start(ctrl_info); |
3172 |
++ pqi_ctrl_wait_until_quiesced(ctrl_info); |
3173 |
++ |
3174 |
++ rc = pqi_ctrl_wait_for_pending_io(ctrl_info, NO_TIMEOUT); |
3175 |
++ if (rc) { |
3176 |
++ dev_err(&pci_dev->dev, |
3177 |
++ "wait for pending I/O failed\n"); |
3178 |
++ return; |
3179 |
++ } |
3180 |
++ |
3181 |
++ pqi_ctrl_block_device_reset(ctrl_info); |
3182 |
++ pqi_wait_until_lun_reset_finished(ctrl_info); |
3183 |
+ |
3184 |
+ /* |
3185 |
+ * Write all data in the controller's battery-backed cache to |
3186 |
+ * storage. |
3187 |
+ */ |
3188 |
+ rc = pqi_flush_cache(ctrl_info, SHUTDOWN); |
3189 |
+- pqi_free_interrupts(ctrl_info); |
3190 |
+- pqi_reset(ctrl_info); |
3191 |
+- if (rc == 0) |
3192 |
++ if (rc) |
3193 |
++ dev_err(&pci_dev->dev, |
3194 |
++ "unable to flush controller cache\n"); |
3195 |
++ |
3196 |
++ pqi_ctrl_block_requests(ctrl_info); |
3197 |
++ |
3198 |
++ rc = pqi_ctrl_wait_for_pending_sync_cmds(ctrl_info); |
3199 |
++ if (rc) { |
3200 |
++ dev_err(&pci_dev->dev, |
3201 |
++ "wait for pending sync cmds failed\n"); |
3202 |
+ return; |
3203 |
++ } |
3204 |
++ |
3205 |
++ pqi_crash_if_pending_command(ctrl_info); |
3206 |
++ pqi_reset(ctrl_info); |
3207 |
+ |
3208 |
+-error: |
3209 |
+- dev_warn(&pci_dev->dev, |
3210 |
+- "unable to flush controller cache\n"); |
3211 |
+ } |
3212 |
+ |
3213 |
+ static void pqi_process_lockup_action_param(void) |
3214 |
+diff --git a/drivers/scsi/smartpqi/smartpqi_sas_transport.c b/drivers/scsi/smartpqi/smartpqi_sas_transport.c |
3215 |
+index 6776dfc1d317..b7e28b9f8589 100644 |
3216 |
+--- a/drivers/scsi/smartpqi/smartpqi_sas_transport.c |
3217 |
++++ b/drivers/scsi/smartpqi/smartpqi_sas_transport.c |
3218 |
+@@ -45,9 +45,9 @@ static void pqi_free_sas_phy(struct pqi_sas_phy *pqi_sas_phy) |
3219 |
+ struct sas_phy *phy = pqi_sas_phy->phy; |
3220 |
+ |
3221 |
+ sas_port_delete_phy(pqi_sas_phy->parent_port->port, phy); |
3222 |
+- sas_phy_free(phy); |
3223 |
+ if (pqi_sas_phy->added_to_port) |
3224 |
+ list_del(&pqi_sas_phy->phy_list_entry); |
3225 |
++ sas_phy_delete(phy); |
3226 |
+ kfree(pqi_sas_phy); |
3227 |
+ } |
3228 |
+ |
3229 |
+diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c |
3230 |
+index 08d1bbbebf2d..e84b4fb493d6 100644 |
3231 |
+--- a/drivers/staging/comedi/comedi_fops.c |
3232 |
++++ b/drivers/staging/comedi/comedi_fops.c |
3233 |
+@@ -2725,8 +2725,10 @@ static int comedi_open(struct inode *inode, struct file *file) |
3234 |
+ } |
3235 |
+ |
3236 |
+ cfp = kzalloc(sizeof(*cfp), GFP_KERNEL); |
3237 |
+- if (!cfp) |
3238 |
++ if (!cfp) { |
3239 |
++ comedi_dev_put(dev); |
3240 |
+ return -ENOMEM; |
3241 |
++ } |
3242 |
+ |
3243 |
+ cfp->dev = dev; |
3244 |
+ |
3245 |
+diff --git a/drivers/staging/comedi/drivers/dt2815.c b/drivers/staging/comedi/drivers/dt2815.c |
3246 |
+index 83026ba63d1c..78a7c1b3448a 100644 |
3247 |
+--- a/drivers/staging/comedi/drivers/dt2815.c |
3248 |
++++ b/drivers/staging/comedi/drivers/dt2815.c |
3249 |
+@@ -92,6 +92,7 @@ static int dt2815_ao_insn(struct comedi_device *dev, struct comedi_subdevice *s, |
3250 |
+ int ret; |
3251 |
+ |
3252 |
+ for (i = 0; i < insn->n; i++) { |
3253 |
++ /* FIXME: lo bit 0 chooses voltage output or current output */ |
3254 |
+ lo = ((data[i] & 0x0f) << 4) | (chan << 1) | 0x01; |
3255 |
+ hi = (data[i] & 0xff0) >> 4; |
3256 |
+ |
3257 |
+@@ -105,6 +106,8 @@ static int dt2815_ao_insn(struct comedi_device *dev, struct comedi_subdevice *s, |
3258 |
+ if (ret) |
3259 |
+ return ret; |
3260 |
+ |
3261 |
++ outb(hi, dev->iobase + DT2815_DATA); |
3262 |
++ |
3263 |
+ devpriv->ao_readback[chan] = data[i]; |
3264 |
+ } |
3265 |
+ return i; |
3266 |
+diff --git a/drivers/staging/gasket/gasket_sysfs.c b/drivers/staging/gasket/gasket_sysfs.c |
3267 |
+index a2d67c28f530..5f0e089573a2 100644 |
3268 |
+--- a/drivers/staging/gasket/gasket_sysfs.c |
3269 |
++++ b/drivers/staging/gasket/gasket_sysfs.c |
3270 |
+@@ -228,8 +228,7 @@ int gasket_sysfs_create_entries(struct device *device, |
3271 |
+ } |
3272 |
+ |
3273 |
+ mutex_lock(&mapping->mutex); |
3274 |
+- for (i = 0; strcmp(attrs[i].attr.attr.name, GASKET_ARRAY_END_MARKER); |
3275 |
+- i++) { |
3276 |
++ for (i = 0; attrs[i].attr.attr.name != NULL; i++) { |
3277 |
+ if (mapping->attribute_count == GASKET_SYSFS_MAX_NODES) { |
3278 |
+ dev_err(device, |
3279 |
+ "Maximum number of sysfs nodes reached for device\n"); |
3280 |
+diff --git a/drivers/staging/gasket/gasket_sysfs.h b/drivers/staging/gasket/gasket_sysfs.h |
3281 |
+index 1d0eed66a7f4..ab5aa351d555 100644 |
3282 |
+--- a/drivers/staging/gasket/gasket_sysfs.h |
3283 |
++++ b/drivers/staging/gasket/gasket_sysfs.h |
3284 |
+@@ -30,10 +30,6 @@ |
3285 |
+ */ |
3286 |
+ #define GASKET_SYSFS_MAX_NODES 196 |
3287 |
+ |
3288 |
+-/* End markers for sysfs struct arrays. */ |
3289 |
+-#define GASKET_ARRAY_END_TOKEN GASKET_RESERVED_ARRAY_END |
3290 |
+-#define GASKET_ARRAY_END_MARKER __stringify(GASKET_ARRAY_END_TOKEN) |
3291 |
+- |
3292 |
+ /* |
3293 |
+ * Terminator struct for a gasket_sysfs_attr array. Must be at the end of |
3294 |
+ * all gasket_sysfs_attribute arrays. |
3295 |
+diff --git a/drivers/staging/vt6656/int.c b/drivers/staging/vt6656/int.c |
3296 |
+index af215860be4c..ac563e23868e 100644 |
3297 |
+--- a/drivers/staging/vt6656/int.c |
3298 |
++++ b/drivers/staging/vt6656/int.c |
3299 |
+@@ -145,7 +145,8 @@ void vnt_int_process_data(struct vnt_private *priv) |
3300 |
+ priv->wake_up_count = |
3301 |
+ priv->hw->conf.listen_interval; |
3302 |
+ |
3303 |
+- --priv->wake_up_count; |
3304 |
++ if (priv->wake_up_count) |
3305 |
++ --priv->wake_up_count; |
3306 |
+ |
3307 |
+ /* Turn on wake up to listen next beacon */ |
3308 |
+ if (priv->wake_up_count == 1) |
3309 |
+diff --git a/drivers/staging/vt6656/key.c b/drivers/staging/vt6656/key.c |
3310 |
+index dcd933a6b66e..40c58ac4e209 100644 |
3311 |
+--- a/drivers/staging/vt6656/key.c |
3312 |
++++ b/drivers/staging/vt6656/key.c |
3313 |
+@@ -83,9 +83,6 @@ static int vnt_set_keymode(struct ieee80211_hw *hw, u8 *mac_addr, |
3314 |
+ case VNT_KEY_PAIRWISE: |
3315 |
+ key_mode |= mode; |
3316 |
+ key_inx = 4; |
3317 |
+- /* Don't save entry for pairwise key for station mode */ |
3318 |
+- if (priv->op_mode == NL80211_IFTYPE_STATION) |
3319 |
+- clear_bit(entry, &priv->key_entry_inuse); |
3320 |
+ break; |
3321 |
+ default: |
3322 |
+ return -EINVAL; |
3323 |
+@@ -109,7 +106,6 @@ static int vnt_set_keymode(struct ieee80211_hw *hw, u8 *mac_addr, |
3324 |
+ int vnt_set_keys(struct ieee80211_hw *hw, struct ieee80211_sta *sta, |
3325 |
+ struct ieee80211_vif *vif, struct ieee80211_key_conf *key) |
3326 |
+ { |
3327 |
+- struct ieee80211_bss_conf *conf = &vif->bss_conf; |
3328 |
+ struct vnt_private *priv = hw->priv; |
3329 |
+ u8 *mac_addr = NULL; |
3330 |
+ u8 key_dec_mode = 0; |
3331 |
+@@ -151,16 +147,12 @@ int vnt_set_keys(struct ieee80211_hw *hw, struct ieee80211_sta *sta, |
3332 |
+ key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV; |
3333 |
+ } |
3334 |
+ |
3335 |
+- if (key->flags & IEEE80211_KEY_FLAG_PAIRWISE) { |
3336 |
++ if (key->flags & IEEE80211_KEY_FLAG_PAIRWISE) |
3337 |
+ vnt_set_keymode(hw, mac_addr, key, VNT_KEY_PAIRWISE, |
3338 |
+ key_dec_mode, true); |
3339 |
+- } else { |
3340 |
+- vnt_set_keymode(hw, mac_addr, key, VNT_KEY_DEFAULTKEY, |
3341 |
++ else |
3342 |
++ vnt_set_keymode(hw, mac_addr, key, VNT_KEY_GROUP_ADDRESS, |
3343 |
+ key_dec_mode, true); |
3344 |
+ |
3345 |
+- vnt_set_keymode(hw, (u8 *)conf->bssid, key, |
3346 |
+- VNT_KEY_GROUP_ADDRESS, key_dec_mode, true); |
3347 |
+- } |
3348 |
+- |
3349 |
+ return 0; |
3350 |
+ } |
3351 |
+diff --git a/drivers/staging/vt6656/main_usb.c b/drivers/staging/vt6656/main_usb.c |
3352 |
+index 69a48383611f..48db31238d56 100644 |
3353 |
+--- a/drivers/staging/vt6656/main_usb.c |
3354 |
++++ b/drivers/staging/vt6656/main_usb.c |
3355 |
+@@ -633,8 +633,6 @@ static int vnt_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) |
3356 |
+ |
3357 |
+ priv->op_mode = vif->type; |
3358 |
+ |
3359 |
+- vnt_set_bss_mode(priv); |
3360 |
+- |
3361 |
+ /* LED blink on TX */ |
3362 |
+ vnt_mac_set_led(priv, LEDSTS_STS, LEDSTS_INTER); |
3363 |
+ |
3364 |
+@@ -721,7 +719,6 @@ static void vnt_bss_info_changed(struct ieee80211_hw *hw, |
3365 |
+ priv->basic_rates = conf->basic_rates; |
3366 |
+ |
3367 |
+ vnt_update_top_rates(priv); |
3368 |
+- vnt_set_bss_mode(priv); |
3369 |
+ |
3370 |
+ dev_dbg(&priv->usb->dev, "basic rates %x\n", conf->basic_rates); |
3371 |
+ } |
3372 |
+@@ -750,11 +747,14 @@ static void vnt_bss_info_changed(struct ieee80211_hw *hw, |
3373 |
+ priv->short_slot_time = false; |
3374 |
+ |
3375 |
+ vnt_set_short_slot_time(priv); |
3376 |
+- vnt_update_ifs(priv); |
3377 |
+ vnt_set_vga_gain_offset(priv, priv->bb_vga[0]); |
3378 |
+ vnt_update_pre_ed_threshold(priv, false); |
3379 |
+ } |
3380 |
+ |
3381 |
++ if (changed & (BSS_CHANGED_BASIC_RATES | BSS_CHANGED_ERP_PREAMBLE | |
3382 |
++ BSS_CHANGED_ERP_SLOT)) |
3383 |
++ vnt_set_bss_mode(priv); |
3384 |
++ |
3385 |
+ if (changed & BSS_CHANGED_TXPOWER) |
3386 |
+ vnt_rf_setpower(priv, priv->current_rate, |
3387 |
+ conf->chandef.chan->hw_value); |
3388 |
+@@ -778,12 +778,15 @@ static void vnt_bss_info_changed(struct ieee80211_hw *hw, |
3389 |
+ vnt_mac_reg_bits_on(priv, MAC_REG_TFTCTL, |
3390 |
+ TFTCTL_TSFCNTREN); |
3391 |
+ |
3392 |
+- vnt_adjust_tsf(priv, conf->beacon_rate->hw_value, |
3393 |
+- conf->sync_tsf, priv->current_tsf); |
3394 |
+- |
3395 |
+ vnt_mac_set_beacon_interval(priv, conf->beacon_int); |
3396 |
+ |
3397 |
+ vnt_reset_next_tbtt(priv, conf->beacon_int); |
3398 |
++ |
3399 |
++ vnt_adjust_tsf(priv, conf->beacon_rate->hw_value, |
3400 |
++ conf->sync_tsf, priv->current_tsf); |
3401 |
++ |
3402 |
++ vnt_update_next_tbtt(priv, |
3403 |
++ conf->sync_tsf, conf->beacon_int); |
3404 |
+ } else { |
3405 |
+ vnt_clear_current_tsf(priv); |
3406 |
+ |
3407 |
+@@ -818,15 +821,11 @@ static void vnt_configure(struct ieee80211_hw *hw, |
3408 |
+ { |
3409 |
+ struct vnt_private *priv = hw->priv; |
3410 |
+ u8 rx_mode = 0; |
3411 |
+- int rc; |
3412 |
+ |
3413 |
+ *total_flags &= FIF_ALLMULTI | FIF_OTHER_BSS | FIF_BCN_PRBRESP_PROMISC; |
3414 |
+ |
3415 |
+- rc = vnt_control_in(priv, MESSAGE_TYPE_READ, MAC_REG_RCR, |
3416 |
+- MESSAGE_REQUEST_MACREG, sizeof(u8), &rx_mode); |
3417 |
+- |
3418 |
+- if (!rc) |
3419 |
+- rx_mode = RCR_MULTICAST | RCR_BROADCAST; |
3420 |
++ vnt_control_in(priv, MESSAGE_TYPE_READ, MAC_REG_RCR, |
3421 |
++ MESSAGE_REQUEST_MACREG, sizeof(u8), &rx_mode); |
3422 |
+ |
3423 |
+ dev_dbg(&priv->usb->dev, "rx mode in = %x\n", rx_mode); |
3424 |
+ |
3425 |
+@@ -867,8 +866,12 @@ static int vnt_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, |
3426 |
+ return -EOPNOTSUPP; |
3427 |
+ break; |
3428 |
+ case DISABLE_KEY: |
3429 |
+- if (test_bit(key->hw_key_idx, &priv->key_entry_inuse)) |
3430 |
++ if (test_bit(key->hw_key_idx, &priv->key_entry_inuse)) { |
3431 |
+ clear_bit(key->hw_key_idx, &priv->key_entry_inuse); |
3432 |
++ |
3433 |
++ vnt_mac_disable_keyentry(priv, key->hw_key_idx); |
3434 |
++ } |
3435 |
++ |
3436 |
+ default: |
3437 |
+ break; |
3438 |
+ } |
3439 |
+diff --git a/drivers/tty/hvc/hvc_console.c b/drivers/tty/hvc/hvc_console.c |
3440 |
+index 27284a2dcd2b..436cc51c92c3 100644 |
3441 |
+--- a/drivers/tty/hvc/hvc_console.c |
3442 |
++++ b/drivers/tty/hvc/hvc_console.c |
3443 |
+@@ -302,10 +302,6 @@ int hvc_instantiate(uint32_t vtermno, int index, const struct hv_ops *ops) |
3444 |
+ vtermnos[index] = vtermno; |
3445 |
+ cons_ops[index] = ops; |
3446 |
+ |
3447 |
+- /* reserve all indices up to and including this index */ |
3448 |
+- if (last_hvc < index) |
3449 |
+- last_hvc = index; |
3450 |
+- |
3451 |
+ /* check if we need to re-register the kernel console */ |
3452 |
+ hvc_check_console(index); |
3453 |
+ |
3454 |
+@@ -960,13 +956,22 @@ struct hvc_struct *hvc_alloc(uint32_t vtermno, int data, |
3455 |
+ cons_ops[i] == hp->ops) |
3456 |
+ break; |
3457 |
+ |
3458 |
+- /* no matching slot, just use a counter */ |
3459 |
+- if (i >= MAX_NR_HVC_CONSOLES) |
3460 |
+- i = ++last_hvc; |
3461 |
++ if (i >= MAX_NR_HVC_CONSOLES) { |
3462 |
++ |
3463 |
++ /* find 'empty' slot for console */ |
3464 |
++ for (i = 0; i < MAX_NR_HVC_CONSOLES && vtermnos[i] != -1; i++) { |
3465 |
++ } |
3466 |
++ |
3467 |
++ /* no matching slot, just use a counter */ |
3468 |
++ if (i == MAX_NR_HVC_CONSOLES) |
3469 |
++ i = ++last_hvc + MAX_NR_HVC_CONSOLES; |
3470 |
++ } |
3471 |
+ |
3472 |
+ hp->index = i; |
3473 |
+- cons_ops[i] = ops; |
3474 |
+- vtermnos[i] = vtermno; |
3475 |
++ if (i < MAX_NR_HVC_CONSOLES) { |
3476 |
++ cons_ops[i] = ops; |
3477 |
++ vtermnos[i] = vtermno; |
3478 |
++ } |
3479 |
+ |
3480 |
+ list_add_tail(&(hp->next), &hvc_structs); |
3481 |
+ mutex_unlock(&hvc_structs_mutex); |
3482 |
+diff --git a/drivers/tty/rocket.c b/drivers/tty/rocket.c |
3483 |
+index 5ba6816ebf81..bbaad2887ce7 100644 |
3484 |
+--- a/drivers/tty/rocket.c |
3485 |
++++ b/drivers/tty/rocket.c |
3486 |
+@@ -632,18 +632,21 @@ init_r_port(int board, int aiop, int chan, struct pci_dev *pci_dev) |
3487 |
+ tty_port_init(&info->port); |
3488 |
+ info->port.ops = &rocket_port_ops; |
3489 |
+ info->flags &= ~ROCKET_MODE_MASK; |
3490 |
+- switch (pc104[board][line]) { |
3491 |
+- case 422: |
3492 |
+- info->flags |= ROCKET_MODE_RS422; |
3493 |
+- break; |
3494 |
+- case 485: |
3495 |
+- info->flags |= ROCKET_MODE_RS485; |
3496 |
+- break; |
3497 |
+- case 232: |
3498 |
+- default: |
3499 |
++ if (board < ARRAY_SIZE(pc104) && line < ARRAY_SIZE(pc104_1)) |
3500 |
++ switch (pc104[board][line]) { |
3501 |
++ case 422: |
3502 |
++ info->flags |= ROCKET_MODE_RS422; |
3503 |
++ break; |
3504 |
++ case 485: |
3505 |
++ info->flags |= ROCKET_MODE_RS485; |
3506 |
++ break; |
3507 |
++ case 232: |
3508 |
++ default: |
3509 |
++ info->flags |= ROCKET_MODE_RS232; |
3510 |
++ break; |
3511 |
++ } |
3512 |
++ else |
3513 |
+ info->flags |= ROCKET_MODE_RS232; |
3514 |
+- break; |
3515 |
+- } |
3516 |
+ |
3517 |
+ info->intmask = RXF_TRIG | TXFIFO_MT | SRC_INT | DELTA_CD | DELTA_CTS | DELTA_DSR; |
3518 |
+ if (sInitChan(ctlp, &info->channel, aiop, chan) == 0) { |
3519 |
+diff --git a/drivers/tty/serial/owl-uart.c b/drivers/tty/serial/owl-uart.c |
3520 |
+index d2d8b3494685..c55c8507713c 100644 |
3521 |
+--- a/drivers/tty/serial/owl-uart.c |
3522 |
++++ b/drivers/tty/serial/owl-uart.c |
3523 |
+@@ -680,6 +680,12 @@ static int owl_uart_probe(struct platform_device *pdev) |
3524 |
+ return PTR_ERR(owl_port->clk); |
3525 |
+ } |
3526 |
+ |
3527 |
++ ret = clk_prepare_enable(owl_port->clk); |
3528 |
++ if (ret) { |
3529 |
++ dev_err(&pdev->dev, "could not enable clk\n"); |
3530 |
++ return ret; |
3531 |
++ } |
3532 |
++ |
3533 |
+ owl_port->port.dev = &pdev->dev; |
3534 |
+ owl_port->port.line = pdev->id; |
3535 |
+ owl_port->port.type = PORT_OWL; |
3536 |
+@@ -712,6 +718,7 @@ static int owl_uart_remove(struct platform_device *pdev) |
3537 |
+ |
3538 |
+ uart_remove_one_port(&owl_uart_driver, &owl_port->port); |
3539 |
+ owl_uart_ports[pdev->id] = NULL; |
3540 |
++ clk_disable_unprepare(owl_port->clk); |
3541 |
+ |
3542 |
+ return 0; |
3543 |
+ } |
3544 |
+diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c |
3545 |
+index 22e5d4e13714..7d1529b11ae9 100644 |
3546 |
+--- a/drivers/tty/serial/sh-sci.c |
3547 |
++++ b/drivers/tty/serial/sh-sci.c |
3548 |
+@@ -873,9 +873,16 @@ static void sci_receive_chars(struct uart_port *port) |
3549 |
+ tty_insert_flip_char(tport, c, TTY_NORMAL); |
3550 |
+ } else { |
3551 |
+ for (i = 0; i < count; i++) { |
3552 |
+- char c = serial_port_in(port, SCxRDR); |
3553 |
+- |
3554 |
+- status = serial_port_in(port, SCxSR); |
3555 |
++ char c; |
3556 |
++ |
3557 |
++ if (port->type == PORT_SCIF || |
3558 |
++ port->type == PORT_HSCIF) { |
3559 |
++ status = serial_port_in(port, SCxSR); |
3560 |
++ c = serial_port_in(port, SCxRDR); |
3561 |
++ } else { |
3562 |
++ c = serial_port_in(port, SCxRDR); |
3563 |
++ status = serial_port_in(port, SCxSR); |
3564 |
++ } |
3565 |
+ if (uart_handle_sysrq_char(port, c)) { |
3566 |
+ count--; i--; |
3567 |
+ continue; |
3568 |
+diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c |
3569 |
+index 4e55bc327a54..fe098cf14e6a 100644 |
3570 |
+--- a/drivers/tty/serial/xilinx_uartps.c |
3571 |
++++ b/drivers/tty/serial/xilinx_uartps.c |
3572 |
+@@ -30,13 +30,15 @@ |
3573 |
+ |
3574 |
+ #define CDNS_UART_TTY_NAME "ttyPS" |
3575 |
+ #define CDNS_UART_NAME "xuartps" |
3576 |
++#define CDNS_UART_MAJOR 0 /* use dynamic node allocation */ |
3577 |
++#define CDNS_UART_MINOR 0 /* works best with devtmpfs */ |
3578 |
++#define CDNS_UART_NR_PORTS 16 |
3579 |
+ #define CDNS_UART_FIFO_SIZE 64 /* FIFO size */ |
3580 |
+ #define CDNS_UART_REGISTER_SPACE 0x1000 |
3581 |
+ #define TX_TIMEOUT 500000 |
3582 |
+ |
3583 |
+ /* Rx Trigger level */ |
3584 |
+ static int rx_trigger_level = 56; |
3585 |
+-static int uartps_major; |
3586 |
+ module_param(rx_trigger_level, uint, 0444); |
3587 |
+ MODULE_PARM_DESC(rx_trigger_level, "Rx trigger level, 1-63 bytes"); |
3588 |
+ |
3589 |
+@@ -182,7 +184,6 @@ MODULE_PARM_DESC(rx_timeout, "Rx timeout, 1-255"); |
3590 |
+ * @pclk: APB clock |
3591 |
+ * @cdns_uart_driver: Pointer to UART driver |
3592 |
+ * @baud: Current baud rate |
3593 |
+- * @id: Port ID |
3594 |
+ * @clk_rate_change_nb: Notifier block for clock changes |
3595 |
+ * @quirks: Flags for RXBS support. |
3596 |
+ */ |
3597 |
+@@ -192,7 +193,6 @@ struct cdns_uart { |
3598 |
+ struct clk *pclk; |
3599 |
+ struct uart_driver *cdns_uart_driver; |
3600 |
+ unsigned int baud; |
3601 |
+- int id; |
3602 |
+ struct notifier_block clk_rate_change_nb; |
3603 |
+ u32 quirks; |
3604 |
+ bool cts_override; |
3605 |
+@@ -1119,6 +1119,8 @@ static const struct uart_ops cdns_uart_ops = { |
3606 |
+ #endif |
3607 |
+ }; |
3608 |
+ |
3609 |
++static struct uart_driver cdns_uart_uart_driver; |
3610 |
++ |
3611 |
+ #ifdef CONFIG_SERIAL_XILINX_PS_UART_CONSOLE |
3612 |
+ /** |
3613 |
+ * cdns_uart_console_putchar - write the character to the FIFO buffer |
3614 |
+@@ -1258,6 +1260,16 @@ static int cdns_uart_console_setup(struct console *co, char *options) |
3615 |
+ |
3616 |
+ return uart_set_options(port, co, baud, parity, bits, flow); |
3617 |
+ } |
3618 |
++ |
3619 |
++static struct console cdns_uart_console = { |
3620 |
++ .name = CDNS_UART_TTY_NAME, |
3621 |
++ .write = cdns_uart_console_write, |
3622 |
++ .device = uart_console_device, |
3623 |
++ .setup = cdns_uart_console_setup, |
3624 |
++ .flags = CON_PRINTBUFFER, |
3625 |
++ .index = -1, /* Specified on the cmdline (e.g. console=ttyPS ) */ |
3626 |
++ .data = &cdns_uart_uart_driver, |
3627 |
++}; |
3628 |
+ #endif /* CONFIG_SERIAL_XILINX_PS_UART_CONSOLE */ |
3629 |
+ |
3630 |
+ #ifdef CONFIG_PM_SLEEP |
3631 |
+@@ -1389,89 +1401,8 @@ static const struct of_device_id cdns_uart_of_match[] = { |
3632 |
+ }; |
3633 |
+ MODULE_DEVICE_TABLE(of, cdns_uart_of_match); |
3634 |
+ |
3635 |
+-/* |
3636 |
+- * Maximum number of instances without alias IDs but if there is alias |
3637 |
+- * which target "< MAX_UART_INSTANCES" range this ID can't be used. |
3638 |
+- */ |
3639 |
+-#define MAX_UART_INSTANCES 32 |
3640 |
+- |
3641 |
+-/* Stores static aliases list */ |
3642 |
+-static DECLARE_BITMAP(alias_bitmap, MAX_UART_INSTANCES); |
3643 |
+-static int alias_bitmap_initialized; |
3644 |
+- |
3645 |
+-/* Stores actual bitmap of allocated IDs with alias IDs together */ |
3646 |
+-static DECLARE_BITMAP(bitmap, MAX_UART_INSTANCES); |
3647 |
+-/* Protect bitmap operations to have unique IDs */ |
3648 |
+-static DEFINE_MUTEX(bitmap_lock); |
3649 |
+- |
3650 |
+-static int cdns_get_id(struct platform_device *pdev) |
3651 |
+-{ |
3652 |
+- int id, ret; |
3653 |
+- |
3654 |
+- mutex_lock(&bitmap_lock); |
3655 |
+- |
3656 |
+- /* Alias list is stable that's why get alias bitmap only once */ |
3657 |
+- if (!alias_bitmap_initialized) { |
3658 |
+- ret = of_alias_get_alias_list(cdns_uart_of_match, "serial", |
3659 |
+- alias_bitmap, MAX_UART_INSTANCES); |
3660 |
+- if (ret && ret != -EOVERFLOW) { |
3661 |
+- mutex_unlock(&bitmap_lock); |
3662 |
+- return ret; |
3663 |
+- } |
3664 |
+- |
3665 |
+- alias_bitmap_initialized++; |
3666 |
+- } |
3667 |
+- |
3668 |
+- /* Make sure that alias ID is not taken by instance without alias */ |
3669 |
+- bitmap_or(bitmap, bitmap, alias_bitmap, MAX_UART_INSTANCES); |
3670 |
+- |
3671 |
+- dev_dbg(&pdev->dev, "Alias bitmap: %*pb\n", |
3672 |
+- MAX_UART_INSTANCES, bitmap); |
3673 |
+- |
3674 |
+- /* Look for a serialN alias */ |
3675 |
+- id = of_alias_get_id(pdev->dev.of_node, "serial"); |
3676 |
+- if (id < 0) { |
3677 |
+- dev_warn(&pdev->dev, |
3678 |
+- "No serial alias passed. Using the first free id\n"); |
3679 |
+- |
3680 |
+- /* |
3681 |
+- * Start with id 0 and check if there is no serial0 alias |
3682 |
+- * which points to device which is compatible with this driver. |
3683 |
+- * If alias exists then try next free position. |
3684 |
+- */ |
3685 |
+- id = 0; |
3686 |
+- |
3687 |
+- for (;;) { |
3688 |
+- dev_info(&pdev->dev, "Checking id %d\n", id); |
3689 |
+- id = find_next_zero_bit(bitmap, MAX_UART_INSTANCES, id); |
3690 |
+- |
3691 |
+- /* No free empty instance */ |
3692 |
+- if (id == MAX_UART_INSTANCES) { |
3693 |
+- dev_err(&pdev->dev, "No free ID\n"); |
3694 |
+- mutex_unlock(&bitmap_lock); |
3695 |
+- return -EINVAL; |
3696 |
+- } |
3697 |
+- |
3698 |
+- dev_dbg(&pdev->dev, "The empty id is %d\n", id); |
3699 |
+- /* Check if ID is empty */ |
3700 |
+- if (!test_and_set_bit(id, bitmap)) { |
3701 |
+- /* Break the loop if bit is taken */ |
3702 |
+- dev_dbg(&pdev->dev, |
3703 |
+- "Selected ID %d allocation passed\n", |
3704 |
+- id); |
3705 |
+- break; |
3706 |
+- } |
3707 |
+- dev_dbg(&pdev->dev, |
3708 |
+- "Selected ID %d allocation failed\n", id); |
3709 |
+- /* if taking bit fails then try next one */ |
3710 |
+- id++; |
3711 |
+- } |
3712 |
+- } |
3713 |
+- |
3714 |
+- mutex_unlock(&bitmap_lock); |
3715 |
+- |
3716 |
+- return id; |
3717 |
+-} |
3718 |
++/* Temporary variable for storing number of instances */ |
3719 |
++static int instances; |
3720 |
+ |
3721 |
+ /** |
3722 |
+ * cdns_uart_probe - Platform driver probe |
3723 |
+@@ -1481,16 +1412,11 @@ static int cdns_get_id(struct platform_device *pdev) |
3724 |
+ */ |
3725 |
+ static int cdns_uart_probe(struct platform_device *pdev) |
3726 |
+ { |
3727 |
+- int rc, irq; |
3728 |
++ int rc, id, irq; |
3729 |
+ struct uart_port *port; |
3730 |
+ struct resource *res; |
3731 |
+ struct cdns_uart *cdns_uart_data; |
3732 |
+ const struct of_device_id *match; |
3733 |
+- struct uart_driver *cdns_uart_uart_driver; |
3734 |
+- char *driver_name; |
3735 |
+-#ifdef CONFIG_SERIAL_XILINX_PS_UART_CONSOLE |
3736 |
+- struct console *cdns_uart_console; |
3737 |
+-#endif |
3738 |
+ |
3739 |
+ cdns_uart_data = devm_kzalloc(&pdev->dev, sizeof(*cdns_uart_data), |
3740 |
+ GFP_KERNEL); |
3741 |
+@@ -1500,64 +1426,35 @@ static int cdns_uart_probe(struct platform_device *pdev) |
3742 |
+ if (!port) |
3743 |
+ return -ENOMEM; |
3744 |
+ |
3745 |
+- cdns_uart_uart_driver = devm_kzalloc(&pdev->dev, |
3746 |
+- sizeof(*cdns_uart_uart_driver), |
3747 |
+- GFP_KERNEL); |
3748 |
+- if (!cdns_uart_uart_driver) |
3749 |
+- return -ENOMEM; |
3750 |
+- |
3751 |
+- cdns_uart_data->id = cdns_get_id(pdev); |
3752 |
+- if (cdns_uart_data->id < 0) |
3753 |
+- return cdns_uart_data->id; |
3754 |
++ /* Look for a serialN alias */ |
3755 |
++ id = of_alias_get_id(pdev->dev.of_node, "serial"); |
3756 |
++ if (id < 0) |
3757 |
++ id = 0; |
3758 |
+ |
3759 |
+- /* There is a need to use unique driver name */ |
3760 |
+- driver_name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "%s%d", |
3761 |
+- CDNS_UART_NAME, cdns_uart_data->id); |
3762 |
+- if (!driver_name) { |
3763 |
+- rc = -ENOMEM; |
3764 |
+- goto err_out_id; |
3765 |
++ if (id >= CDNS_UART_NR_PORTS) { |
3766 |
++ dev_err(&pdev->dev, "Cannot get uart_port structure\n"); |
3767 |
++ return -ENODEV; |
3768 |
+ } |
3769 |
+ |
3770 |
+- cdns_uart_uart_driver->owner = THIS_MODULE; |
3771 |
+- cdns_uart_uart_driver->driver_name = driver_name; |
3772 |
+- cdns_uart_uart_driver->dev_name = CDNS_UART_TTY_NAME; |
3773 |
+- cdns_uart_uart_driver->major = uartps_major; |
3774 |
+- cdns_uart_uart_driver->minor = cdns_uart_data->id; |
3775 |
+- cdns_uart_uart_driver->nr = 1; |
3776 |
+- |
3777 |
++ if (!cdns_uart_uart_driver.state) { |
3778 |
++ cdns_uart_uart_driver.owner = THIS_MODULE; |
3779 |
++ cdns_uart_uart_driver.driver_name = CDNS_UART_NAME; |
3780 |
++ cdns_uart_uart_driver.dev_name = CDNS_UART_TTY_NAME; |
3781 |
++ cdns_uart_uart_driver.major = CDNS_UART_MAJOR; |
3782 |
++ cdns_uart_uart_driver.minor = CDNS_UART_MINOR; |
3783 |
++ cdns_uart_uart_driver.nr = CDNS_UART_NR_PORTS; |
3784 |
+ #ifdef CONFIG_SERIAL_XILINX_PS_UART_CONSOLE |
3785 |
+- cdns_uart_console = devm_kzalloc(&pdev->dev, sizeof(*cdns_uart_console), |
3786 |
+- GFP_KERNEL); |
3787 |
+- if (!cdns_uart_console) { |
3788 |
+- rc = -ENOMEM; |
3789 |
+- goto err_out_id; |
3790 |
+- } |
3791 |
+- |
3792 |
+- strncpy(cdns_uart_console->name, CDNS_UART_TTY_NAME, |
3793 |
+- sizeof(cdns_uart_console->name)); |
3794 |
+- cdns_uart_console->index = cdns_uart_data->id; |
3795 |
+- cdns_uart_console->write = cdns_uart_console_write; |
3796 |
+- cdns_uart_console->device = uart_console_device; |
3797 |
+- cdns_uart_console->setup = cdns_uart_console_setup; |
3798 |
+- cdns_uart_console->flags = CON_PRINTBUFFER; |
3799 |
+- cdns_uart_console->data = cdns_uart_uart_driver; |
3800 |
+- cdns_uart_uart_driver->cons = cdns_uart_console; |
3801 |
++ cdns_uart_uart_driver.cons = &cdns_uart_console; |
3802 |
+ #endif |
3803 |
+ |
3804 |
+- rc = uart_register_driver(cdns_uart_uart_driver); |
3805 |
+- if (rc < 0) { |
3806 |
+- dev_err(&pdev->dev, "Failed to register driver\n"); |
3807 |
+- goto err_out_id; |
3808 |
++ rc = uart_register_driver(&cdns_uart_uart_driver); |
3809 |
++ if (rc < 0) { |
3810 |
++ dev_err(&pdev->dev, "Failed to register driver\n"); |
3811 |
++ return rc; |
3812 |
++ } |
3813 |
+ } |
3814 |
+ |
3815 |
+- cdns_uart_data->cdns_uart_driver = cdns_uart_uart_driver; |
3816 |
+- |
3817 |
+- /* |
3818 |
+- * Setting up proper name_base needs to be done after uart |
3819 |
+- * registration because tty_driver structure is not filled. |
3820 |
+- * name_base is 0 by default. |
3821 |
+- */ |
3822 |
+- cdns_uart_uart_driver->tty_driver->name_base = cdns_uart_data->id; |
3823 |
++ cdns_uart_data->cdns_uart_driver = &cdns_uart_uart_driver; |
3824 |
+ |
3825 |
+ match = of_match_node(cdns_uart_of_match, pdev->dev.of_node); |
3826 |
+ if (match && match->data) { |
3827 |
+@@ -1634,6 +1531,7 @@ static int cdns_uart_probe(struct platform_device *pdev) |
3828 |
+ port->flags = UPF_BOOT_AUTOCONF; |
3829 |
+ port->ops = &cdns_uart_ops; |
3830 |
+ port->fifosize = CDNS_UART_FIFO_SIZE; |
3831 |
++ port->line = id; |
3832 |
+ |
3833 |
+ /* |
3834 |
+ * Register the port. |
3835 |
+@@ -1665,7 +1563,7 @@ static int cdns_uart_probe(struct platform_device *pdev) |
3836 |
+ console_port = port; |
3837 |
+ #endif |
3838 |
+ |
3839 |
+- rc = uart_add_one_port(cdns_uart_uart_driver, port); |
3840 |
++ rc = uart_add_one_port(&cdns_uart_uart_driver, port); |
3841 |
+ if (rc) { |
3842 |
+ dev_err(&pdev->dev, |
3843 |
+ "uart_add_one_port() failed; err=%i\n", rc); |
3844 |
+@@ -1675,13 +1573,15 @@ static int cdns_uart_probe(struct platform_device *pdev) |
3845 |
+ #ifdef CONFIG_SERIAL_XILINX_PS_UART_CONSOLE |
3846 |
+ /* This is not port which is used for console that's why clean it up */ |
3847 |
+ if (console_port == port && |
3848 |
+- !(cdns_uart_uart_driver->cons->flags & CON_ENABLED)) |
3849 |
++ !(cdns_uart_uart_driver.cons->flags & CON_ENABLED)) |
3850 |
+ console_port = NULL; |
3851 |
+ #endif |
3852 |
+ |
3853 |
+- uartps_major = cdns_uart_uart_driver->tty_driver->major; |
3854 |
+ cdns_uart_data->cts_override = of_property_read_bool(pdev->dev.of_node, |
3855 |
+ "cts-override"); |
3856 |
++ |
3857 |
++ instances++; |
3858 |
++ |
3859 |
+ return 0; |
3860 |
+ |
3861 |
+ err_out_pm_disable: |
3862 |
+@@ -1697,12 +1597,8 @@ err_out_clk_disable: |
3863 |
+ err_out_clk_dis_pclk: |
3864 |
+ clk_disable_unprepare(cdns_uart_data->pclk); |
3865 |
+ err_out_unregister_driver: |
3866 |
+- uart_unregister_driver(cdns_uart_data->cdns_uart_driver); |
3867 |
+-err_out_id: |
3868 |
+- mutex_lock(&bitmap_lock); |
3869 |
+- if (cdns_uart_data->id < MAX_UART_INSTANCES) |
3870 |
+- clear_bit(cdns_uart_data->id, bitmap); |
3871 |
+- mutex_unlock(&bitmap_lock); |
3872 |
++ if (!instances) |
3873 |
++ uart_unregister_driver(cdns_uart_data->cdns_uart_driver); |
3874 |
+ return rc; |
3875 |
+ } |
3876 |
+ |
3877 |
+@@ -1725,10 +1621,6 @@ static int cdns_uart_remove(struct platform_device *pdev) |
3878 |
+ #endif |
3879 |
+ rc = uart_remove_one_port(cdns_uart_data->cdns_uart_driver, port); |
3880 |
+ port->mapbase = 0; |
3881 |
+- mutex_lock(&bitmap_lock); |
3882 |
+- if (cdns_uart_data->id < MAX_UART_INSTANCES) |
3883 |
+- clear_bit(cdns_uart_data->id, bitmap); |
3884 |
+- mutex_unlock(&bitmap_lock); |
3885 |
+ clk_disable_unprepare(cdns_uart_data->uartclk); |
3886 |
+ clk_disable_unprepare(cdns_uart_data->pclk); |
3887 |
+ pm_runtime_disable(&pdev->dev); |
3888 |
+@@ -1741,13 +1633,8 @@ static int cdns_uart_remove(struct platform_device *pdev) |
3889 |
+ console_port = NULL; |
3890 |
+ #endif |
3891 |
+ |
3892 |
+- /* If this is last instance major number should be initialized */ |
3893 |
+- mutex_lock(&bitmap_lock); |
3894 |
+- if (bitmap_empty(bitmap, MAX_UART_INSTANCES)) |
3895 |
+- uartps_major = 0; |
3896 |
+- mutex_unlock(&bitmap_lock); |
3897 |
+- |
3898 |
+- uart_unregister_driver(cdns_uart_data->cdns_uart_driver); |
3899 |
++ if (!--instances) |
3900 |
++ uart_unregister_driver(cdns_uart_data->cdns_uart_driver); |
3901 |
+ return rc; |
3902 |
+ } |
3903 |
+ |
3904 |
+diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c |
3905 |
+index fa9433e6cdc7..8b3ecef50394 100644 |
3906 |
+--- a/drivers/tty/vt/vt.c |
3907 |
++++ b/drivers/tty/vt/vt.c |
3908 |
+@@ -81,6 +81,7 @@ |
3909 |
+ #include <linux/errno.h> |
3910 |
+ #include <linux/kd.h> |
3911 |
+ #include <linux/slab.h> |
3912 |
++#include <linux/vmalloc.h> |
3913 |
+ #include <linux/major.h> |
3914 |
+ #include <linux/mm.h> |
3915 |
+ #include <linux/console.h> |
3916 |
+@@ -350,7 +351,7 @@ static struct uni_screen *vc_uniscr_alloc(unsigned int cols, unsigned int rows) |
3917 |
+ /* allocate everything in one go */ |
3918 |
+ memsize = cols * rows * sizeof(char32_t); |
3919 |
+ memsize += rows * sizeof(char32_t *); |
3920 |
+- p = kmalloc(memsize, GFP_KERNEL); |
3921 |
++ p = vmalloc(memsize); |
3922 |
+ if (!p) |
3923 |
+ return NULL; |
3924 |
+ |
3925 |
+@@ -366,7 +367,7 @@ static struct uni_screen *vc_uniscr_alloc(unsigned int cols, unsigned int rows) |
3926 |
+ |
3927 |
+ static void vc_uniscr_set(struct vc_data *vc, struct uni_screen *new_uniscr) |
3928 |
+ { |
3929 |
+- kfree(vc->vc_uni_screen); |
3930 |
++ vfree(vc->vc_uni_screen); |
3931 |
+ vc->vc_uni_screen = new_uniscr; |
3932 |
+ } |
3933 |
+ |
3934 |
+@@ -1206,7 +1207,7 @@ static int vc_do_resize(struct tty_struct *tty, struct vc_data *vc, |
3935 |
+ if (new_cols == vc->vc_cols && new_rows == vc->vc_rows) |
3936 |
+ return 0; |
3937 |
+ |
3938 |
+- if (new_screen_size > (4 << 20)) |
3939 |
++ if (new_screen_size > KMALLOC_MAX_SIZE) |
3940 |
+ return -EINVAL; |
3941 |
+ newscreen = kzalloc(new_screen_size, GFP_USER); |
3942 |
+ if (!newscreen) |
3943 |
+diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c |
3944 |
+index 84d6f7df09a4..8ca72d80501d 100644 |
3945 |
+--- a/drivers/usb/class/cdc-acm.c |
3946 |
++++ b/drivers/usb/class/cdc-acm.c |
3947 |
+@@ -412,9 +412,12 @@ static void acm_ctrl_irq(struct urb *urb) |
3948 |
+ |
3949 |
+ exit: |
3950 |
+ retval = usb_submit_urb(urb, GFP_ATOMIC); |
3951 |
+- if (retval && retval != -EPERM) |
3952 |
++ if (retval && retval != -EPERM && retval != -ENODEV) |
3953 |
+ dev_err(&acm->control->dev, |
3954 |
+ "%s - usb_submit_urb failed: %d\n", __func__, retval); |
3955 |
++ else |
3956 |
++ dev_vdbg(&acm->control->dev, |
3957 |
++ "control resubmission terminated %d\n", retval); |
3958 |
+ } |
3959 |
+ |
3960 |
+ static int acm_submit_read_urb(struct acm *acm, int index, gfp_t mem_flags) |
3961 |
+@@ -430,6 +433,8 @@ static int acm_submit_read_urb(struct acm *acm, int index, gfp_t mem_flags) |
3962 |
+ dev_err(&acm->data->dev, |
3963 |
+ "urb %d failed submission with %d\n", |
3964 |
+ index, res); |
3965 |
++ } else { |
3966 |
++ dev_vdbg(&acm->data->dev, "intended failure %d\n", res); |
3967 |
+ } |
3968 |
+ set_bit(index, &acm->read_urbs_free); |
3969 |
+ return res; |
3970 |
+@@ -471,6 +476,7 @@ static void acm_read_bulk_callback(struct urb *urb) |
3971 |
+ int status = urb->status; |
3972 |
+ bool stopped = false; |
3973 |
+ bool stalled = false; |
3974 |
++ bool cooldown = false; |
3975 |
+ |
3976 |
+ dev_vdbg(&acm->data->dev, "got urb %d, len %d, status %d\n", |
3977 |
+ rb->index, urb->actual_length, status); |
3978 |
+@@ -497,6 +503,14 @@ static void acm_read_bulk_callback(struct urb *urb) |
3979 |
+ __func__, status); |
3980 |
+ stopped = true; |
3981 |
+ break; |
3982 |
++ case -EOVERFLOW: |
3983 |
++ case -EPROTO: |
3984 |
++ dev_dbg(&acm->data->dev, |
3985 |
++ "%s - cooling babbling device\n", __func__); |
3986 |
++ usb_mark_last_busy(acm->dev); |
3987 |
++ set_bit(rb->index, &acm->urbs_in_error_delay); |
3988 |
++ cooldown = true; |
3989 |
++ break; |
3990 |
+ default: |
3991 |
+ dev_dbg(&acm->data->dev, |
3992 |
+ "%s - nonzero urb status received: %d\n", |
3993 |
+@@ -518,9 +532,11 @@ static void acm_read_bulk_callback(struct urb *urb) |
3994 |
+ */ |
3995 |
+ smp_mb__after_atomic(); |
3996 |
+ |
3997 |
+- if (stopped || stalled) { |
3998 |
++ if (stopped || stalled || cooldown) { |
3999 |
+ if (stalled) |
4000 |
+ schedule_work(&acm->work); |
4001 |
++ else if (cooldown) |
4002 |
++ schedule_delayed_work(&acm->dwork, HZ / 2); |
4003 |
+ return; |
4004 |
+ } |
4005 |
+ |
4006 |
+@@ -557,14 +573,20 @@ static void acm_softint(struct work_struct *work) |
4007 |
+ struct acm *acm = container_of(work, struct acm, work); |
4008 |
+ |
4009 |
+ if (test_bit(EVENT_RX_STALL, &acm->flags)) { |
4010 |
+- if (!(usb_autopm_get_interface(acm->data))) { |
4011 |
++ smp_mb(); /* against acm_suspend() */ |
4012 |
++ if (!acm->susp_count) { |
4013 |
+ for (i = 0; i < acm->rx_buflimit; i++) |
4014 |
+ usb_kill_urb(acm->read_urbs[i]); |
4015 |
+ usb_clear_halt(acm->dev, acm->in); |
4016 |
+ acm_submit_read_urbs(acm, GFP_KERNEL); |
4017 |
+- usb_autopm_put_interface(acm->data); |
4018 |
++ clear_bit(EVENT_RX_STALL, &acm->flags); |
4019 |
+ } |
4020 |
+- clear_bit(EVENT_RX_STALL, &acm->flags); |
4021 |
++ } |
4022 |
++ |
4023 |
++ if (test_and_clear_bit(ACM_ERROR_DELAY, &acm->flags)) { |
4024 |
++ for (i = 0; i < ACM_NR; i++) |
4025 |
++ if (test_and_clear_bit(i, &acm->urbs_in_error_delay)) |
4026 |
++ acm_submit_read_urb(acm, i, GFP_NOIO); |
4027 |
+ } |
4028 |
+ |
4029 |
+ if (test_and_clear_bit(EVENT_TTY_WAKEUP, &acm->flags)) |
4030 |
+@@ -1333,6 +1355,7 @@ made_compressed_probe: |
4031 |
+ acm->readsize = readsize; |
4032 |
+ acm->rx_buflimit = num_rx_buf; |
4033 |
+ INIT_WORK(&acm->work, acm_softint); |
4034 |
++ INIT_DELAYED_WORK(&acm->dwork, acm_softint); |
4035 |
+ init_waitqueue_head(&acm->wioctl); |
4036 |
+ spin_lock_init(&acm->write_lock); |
4037 |
+ spin_lock_init(&acm->read_lock); |
4038 |
+@@ -1542,6 +1565,7 @@ static void acm_disconnect(struct usb_interface *intf) |
4039 |
+ |
4040 |
+ acm_kill_urbs(acm); |
4041 |
+ cancel_work_sync(&acm->work); |
4042 |
++ cancel_delayed_work_sync(&acm->dwork); |
4043 |
+ |
4044 |
+ tty_unregister_device(acm_tty_driver, acm->minor); |
4045 |
+ |
4046 |
+@@ -1584,6 +1608,8 @@ static int acm_suspend(struct usb_interface *intf, pm_message_t message) |
4047 |
+ |
4048 |
+ acm_kill_urbs(acm); |
4049 |
+ cancel_work_sync(&acm->work); |
4050 |
++ cancel_delayed_work_sync(&acm->dwork); |
4051 |
++ acm->urbs_in_error_delay = 0; |
4052 |
+ |
4053 |
+ return 0; |
4054 |
+ } |
4055 |
+diff --git a/drivers/usb/class/cdc-acm.h b/drivers/usb/class/cdc-acm.h |
4056 |
+index ca1c026382c2..cd5e9d8ab237 100644 |
4057 |
+--- a/drivers/usb/class/cdc-acm.h |
4058 |
++++ b/drivers/usb/class/cdc-acm.h |
4059 |
+@@ -109,8 +109,11 @@ struct acm { |
4060 |
+ # define EVENT_TTY_WAKEUP 0 |
4061 |
+ # define EVENT_RX_STALL 1 |
4062 |
+ # define ACM_THROTTLED 2 |
4063 |
++# define ACM_ERROR_DELAY 3 |
4064 |
++ unsigned long urbs_in_error_delay; /* these need to be restarted after a delay */ |
4065 |
+ struct usb_cdc_line_coding line; /* bits, stop, parity */ |
4066 |
+- struct work_struct work; /* work queue entry for line discipline waking up */ |
4067 |
++ struct work_struct work; /* work queue entry for various purposes*/ |
4068 |
++ struct delayed_work dwork; /* for cool downs needed in error recovery */ |
4069 |
+ unsigned int ctrlin; /* input control lines (DCD, DSR, RI, break, overruns) */ |
4070 |
+ unsigned int ctrlout; /* output control lines (DTR, RTS) */ |
4071 |
+ struct async_icount iocount; /* counters for control line changes */ |
4072 |
+diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c |
4073 |
+index 243577656177..847c85430b05 100644 |
4074 |
+--- a/drivers/usb/core/hub.c |
4075 |
++++ b/drivers/usb/core/hub.c |
4076 |
+@@ -1222,6 +1222,11 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type) |
4077 |
+ #ifdef CONFIG_PM |
4078 |
+ udev->reset_resume = 1; |
4079 |
+ #endif |
4080 |
++ /* Don't set the change_bits when the device |
4081 |
++ * was powered off. |
4082 |
++ */ |
4083 |
++ if (test_bit(port1, hub->power_bits)) |
4084 |
++ set_bit(port1, hub->change_bits); |
4085 |
+ |
4086 |
+ } else { |
4087 |
+ /* The power session is gone; tell hub_wq */ |
4088 |
+@@ -2722,13 +2727,11 @@ static bool use_new_scheme(struct usb_device *udev, int retry, |
4089 |
+ { |
4090 |
+ int old_scheme_first_port = |
4091 |
+ port_dev->quirks & USB_PORT_QUIRK_OLD_SCHEME; |
4092 |
+- int quick_enumeration = (udev->speed == USB_SPEED_HIGH); |
4093 |
+ |
4094 |
+ if (udev->speed >= USB_SPEED_SUPER) |
4095 |
+ return false; |
4096 |
+ |
4097 |
+- return USE_NEW_SCHEME(retry, old_scheme_first_port || old_scheme_first |
4098 |
+- || quick_enumeration); |
4099 |
++ return USE_NEW_SCHEME(retry, old_scheme_first_port || old_scheme_first); |
4100 |
+ } |
4101 |
+ |
4102 |
+ /* Is a USB 3.0 port in the Inactive or Compliance Mode state? |
4103 |
+@@ -3087,6 +3090,15 @@ static int check_port_resume_type(struct usb_device *udev, |
4104 |
+ if (portchange & USB_PORT_STAT_C_ENABLE) |
4105 |
+ usb_clear_port_feature(hub->hdev, port1, |
4106 |
+ USB_PORT_FEAT_C_ENABLE); |
4107 |
++ |
4108 |
++ /* |
4109 |
++ * Whatever made this reset-resume necessary may have |
4110 |
++ * turned on the port1 bit in hub->change_bits. But after |
4111 |
++ * a successful reset-resume we want the bit to be clear; |
4112 |
++ * if it was on it would indicate that something happened |
4113 |
++ * following the reset-resume. |
4114 |
++ */ |
4115 |
++ clear_bit(port1, hub->change_bits); |
4116 |
+ } |
4117 |
+ |
4118 |
+ return status; |
4119 |
+diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c |
4120 |
+index 5adf489428aa..02eaac7e1e34 100644 |
4121 |
+--- a/drivers/usb/core/message.c |
4122 |
++++ b/drivers/usb/core/message.c |
4123 |
+@@ -588,12 +588,13 @@ void usb_sg_cancel(struct usb_sg_request *io) |
4124 |
+ int i, retval; |
4125 |
+ |
4126 |
+ spin_lock_irqsave(&io->lock, flags); |
4127 |
+- if (io->status) { |
4128 |
++ if (io->status || io->count == 0) { |
4129 |
+ spin_unlock_irqrestore(&io->lock, flags); |
4130 |
+ return; |
4131 |
+ } |
4132 |
+ /* shut everything down */ |
4133 |
+ io->status = -ECONNRESET; |
4134 |
++ io->count++; /* Keep the request alive until we're done */ |
4135 |
+ spin_unlock_irqrestore(&io->lock, flags); |
4136 |
+ |
4137 |
+ for (i = io->entries - 1; i >= 0; --i) { |
4138 |
+@@ -607,6 +608,12 @@ void usb_sg_cancel(struct usb_sg_request *io) |
4139 |
+ dev_warn(&io->dev->dev, "%s, unlink --> %d\n", |
4140 |
+ __func__, retval); |
4141 |
+ } |
4142 |
++ |
4143 |
++ spin_lock_irqsave(&io->lock, flags); |
4144 |
++ io->count--; |
4145 |
++ if (!io->count) |
4146 |
++ complete(&io->complete); |
4147 |
++ spin_unlock_irqrestore(&io->lock, flags); |
4148 |
+ } |
4149 |
+ EXPORT_SYMBOL_GPL(usb_sg_cancel); |
4150 |
+ |
4151 |
+diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c |
4152 |
+index da30b5664ff3..3e8efe759c3e 100644 |
4153 |
+--- a/drivers/usb/core/quirks.c |
4154 |
++++ b/drivers/usb/core/quirks.c |
4155 |
+@@ -430,6 +430,10 @@ static const struct usb_device_id usb_quirk_list[] = { |
4156 |
+ /* Corsair K70 LUX */ |
4157 |
+ { USB_DEVICE(0x1b1c, 0x1b36), .driver_info = USB_QUIRK_DELAY_INIT }, |
4158 |
+ |
4159 |
++ /* Corsair K70 RGB RAPDIFIRE */ |
4160 |
++ { USB_DEVICE(0x1b1c, 0x1b38), .driver_info = USB_QUIRK_DELAY_INIT | |
4161 |
++ USB_QUIRK_DELAY_CTRL_MSG }, |
4162 |
++ |
4163 |
+ /* MIDI keyboard WORLDE MINI */ |
4164 |
+ { USB_DEVICE(0x1c75, 0x0204), .driver_info = |
4165 |
+ USB_QUIRK_CONFIG_INTF_STRINGS }, |
4166 |
+diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c |
4167 |
+index 384f26322609..18251efd216d 100644 |
4168 |
+--- a/drivers/usb/dwc3/gadget.c |
4169 |
++++ b/drivers/usb/dwc3/gadget.c |
4170 |
+@@ -2481,14 +2481,7 @@ static int dwc3_gadget_ep_reclaim_trb_linear(struct dwc3_ep *dep, |
4171 |
+ |
4172 |
+ static bool dwc3_gadget_ep_request_completed(struct dwc3_request *req) |
4173 |
+ { |
4174 |
+- /* |
4175 |
+- * For OUT direction, host may send less than the setup |
4176 |
+- * length. Return true for all OUT requests. |
4177 |
+- */ |
4178 |
+- if (!req->direction) |
4179 |
+- return true; |
4180 |
+- |
4181 |
+- return req->request.actual == req->request.length; |
4182 |
++ return req->num_pending_sgs == 0; |
4183 |
+ } |
4184 |
+ |
4185 |
+ static int dwc3_gadget_ep_cleanup_completed_request(struct dwc3_ep *dep, |
4186 |
+@@ -2512,8 +2505,7 @@ static int dwc3_gadget_ep_cleanup_completed_request(struct dwc3_ep *dep, |
4187 |
+ |
4188 |
+ req->request.actual = req->request.length - req->remaining; |
4189 |
+ |
4190 |
+- if (!dwc3_gadget_ep_request_completed(req) || |
4191 |
+- req->num_pending_sgs) { |
4192 |
++ if (!dwc3_gadget_ep_request_completed(req)) { |
4193 |
+ __dwc3_gadget_kick_transfer(dep); |
4194 |
+ goto out; |
4195 |
+ } |
4196 |
+diff --git a/drivers/usb/early/xhci-dbc.c b/drivers/usb/early/xhci-dbc.c |
4197 |
+index cac991173ac0..5a462a1d1896 100644 |
4198 |
+--- a/drivers/usb/early/xhci-dbc.c |
4199 |
++++ b/drivers/usb/early/xhci-dbc.c |
4200 |
+@@ -728,19 +728,19 @@ static void xdbc_handle_tx_event(struct xdbc_trb *evt_trb) |
4201 |
+ case COMP_USB_TRANSACTION_ERROR: |
4202 |
+ case COMP_STALL_ERROR: |
4203 |
+ default: |
4204 |
+- if (ep_id == XDBC_EPID_OUT) |
4205 |
++ if (ep_id == XDBC_EPID_OUT || ep_id == XDBC_EPID_OUT_INTEL) |
4206 |
+ xdbc.flags |= XDBC_FLAGS_OUT_STALL; |
4207 |
+- if (ep_id == XDBC_EPID_IN) |
4208 |
++ if (ep_id == XDBC_EPID_IN || ep_id == XDBC_EPID_IN_INTEL) |
4209 |
+ xdbc.flags |= XDBC_FLAGS_IN_STALL; |
4210 |
+ |
4211 |
+ xdbc_trace("endpoint %d stalled\n", ep_id); |
4212 |
+ break; |
4213 |
+ } |
4214 |
+ |
4215 |
+- if (ep_id == XDBC_EPID_IN) { |
4216 |
++ if (ep_id == XDBC_EPID_IN || ep_id == XDBC_EPID_IN_INTEL) { |
4217 |
+ xdbc.flags &= ~XDBC_FLAGS_IN_PROCESS; |
4218 |
+ xdbc_bulk_transfer(NULL, XDBC_MAX_PACKET, true); |
4219 |
+- } else if (ep_id == XDBC_EPID_OUT) { |
4220 |
++ } else if (ep_id == XDBC_EPID_OUT || ep_id == XDBC_EPID_OUT_INTEL) { |
4221 |
+ xdbc.flags &= ~XDBC_FLAGS_OUT_PROCESS; |
4222 |
+ } else { |
4223 |
+ xdbc_trace("invalid endpoint id %d\n", ep_id); |
4224 |
+diff --git a/drivers/usb/early/xhci-dbc.h b/drivers/usb/early/xhci-dbc.h |
4225 |
+index 673686eeddd7..6e2b7266a695 100644 |
4226 |
+--- a/drivers/usb/early/xhci-dbc.h |
4227 |
++++ b/drivers/usb/early/xhci-dbc.h |
4228 |
+@@ -120,8 +120,22 @@ struct xdbc_ring { |
4229 |
+ u32 cycle_state; |
4230 |
+ }; |
4231 |
+ |
4232 |
+-#define XDBC_EPID_OUT 2 |
4233 |
+-#define XDBC_EPID_IN 3 |
4234 |
++/* |
4235 |
++ * These are the "Endpoint ID" (also known as "Context Index") values for the |
4236 |
++ * OUT Transfer Ring and the IN Transfer Ring of a Debug Capability Context data |
4237 |
++ * structure. |
4238 |
++ * According to the "eXtensible Host Controller Interface for Universal Serial |
4239 |
++ * Bus (xHCI)" specification, section "7.6.3.2 Endpoint Contexts and Transfer |
4240 |
++ * Rings", these should be 0 and 1, and those are the values AMD machines give |
4241 |
++ * you; but Intel machines seem to use the formula from section "4.5.1 Device |
4242 |
++ * Context Index", which is supposed to be used for the Device Context only. |
4243 |
++ * Luckily the values from Intel don't overlap with those from AMD, so we can |
4244 |
++ * just test for both. |
4245 |
++ */ |
4246 |
++#define XDBC_EPID_OUT 0 |
4247 |
++#define XDBC_EPID_IN 1 |
4248 |
++#define XDBC_EPID_OUT_INTEL 2 |
4249 |
++#define XDBC_EPID_IN_INTEL 3 |
4250 |
+ |
4251 |
+ struct xdbc_state { |
4252 |
+ u16 vendor; |
4253 |
+diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c |
4254 |
+index 87fdeb042c67..f8bcfc506f4a 100644 |
4255 |
+--- a/drivers/usb/gadget/function/f_fs.c |
4256 |
++++ b/drivers/usb/gadget/function/f_fs.c |
4257 |
+@@ -1828,6 +1828,10 @@ static void ffs_data_reset(struct ffs_data *ffs) |
4258 |
+ ffs->state = FFS_READ_DESCRIPTORS; |
4259 |
+ ffs->setup_state = FFS_NO_SETUP; |
4260 |
+ ffs->flags = 0; |
4261 |
++ |
4262 |
++ ffs->ms_os_descs_ext_prop_count = 0; |
4263 |
++ ffs->ms_os_descs_ext_prop_name_len = 0; |
4264 |
++ ffs->ms_os_descs_ext_prop_data_len = 0; |
4265 |
+ } |
4266 |
+ |
4267 |
+ |
4268 |
+diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c |
4269 |
+index af92b2576fe9..3196de2931b1 100644 |
4270 |
+--- a/drivers/usb/host/xhci-hub.c |
4271 |
++++ b/drivers/usb/host/xhci-hub.c |
4272 |
+@@ -1306,7 +1306,47 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, |
4273 |
+ wIndex, link_state); |
4274 |
+ goto error; |
4275 |
+ } |
4276 |
++ |
4277 |
++ /* |
4278 |
++ * set link to U0, steps depend on current link state. |
4279 |
++ * U3: set link to U0 and wait for u3exit completion. |
4280 |
++ * U1/U2: no PLC complete event, only set link to U0. |
4281 |
++ * Resume/Recovery: device initiated U0, only wait for |
4282 |
++ * completion |
4283 |
++ */ |
4284 |
++ if (link_state == USB_SS_PORT_LS_U0) { |
4285 |
++ u32 pls = temp & PORT_PLS_MASK; |
4286 |
++ bool wait_u0 = false; |
4287 |
++ |
4288 |
++ /* already in U0 */ |
4289 |
++ if (pls == XDEV_U0) |
4290 |
++ break; |
4291 |
++ if (pls == XDEV_U3 || |
4292 |
++ pls == XDEV_RESUME || |
4293 |
++ pls == XDEV_RECOVERY) { |
4294 |
++ wait_u0 = true; |
4295 |
++ reinit_completion(&bus_state->u3exit_done[wIndex]); |
4296 |
++ } |
4297 |
++ if (pls <= XDEV_U3) /* U1, U2, U3 */ |
4298 |
++ xhci_set_link_state(xhci, ports[wIndex], |
4299 |
++ USB_SS_PORT_LS_U0); |
4300 |
++ if (!wait_u0) { |
4301 |
++ if (pls > XDEV_U3) |
4302 |
++ goto error; |
4303 |
++ break; |
4304 |
++ } |
4305 |
++ spin_unlock_irqrestore(&xhci->lock, flags); |
4306 |
++ if (!wait_for_completion_timeout(&bus_state->u3exit_done[wIndex], |
4307 |
++ msecs_to_jiffies(100))) |
4308 |
++ xhci_dbg(xhci, "missing U0 port change event for port %d\n", |
4309 |
++ wIndex); |
4310 |
++ spin_lock_irqsave(&xhci->lock, flags); |
4311 |
++ temp = readl(ports[wIndex]->addr); |
4312 |
++ break; |
4313 |
++ } |
4314 |
++ |
4315 |
+ if (link_state == USB_SS_PORT_LS_U3) { |
4316 |
++ int retries = 16; |
4317 |
+ slot_id = xhci_find_slot_id_by_port(hcd, xhci, |
4318 |
+ wIndex + 1); |
4319 |
+ if (slot_id) { |
4320 |
+@@ -1317,17 +1357,18 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, |
4321 |
+ xhci_stop_device(xhci, slot_id, 1); |
4322 |
+ spin_lock_irqsave(&xhci->lock, flags); |
4323 |
+ } |
4324 |
+- } |
4325 |
+- |
4326 |
+- xhci_set_link_state(xhci, ports[wIndex], link_state); |
4327 |
+- |
4328 |
+- spin_unlock_irqrestore(&xhci->lock, flags); |
4329 |
+- msleep(20); /* wait device to enter */ |
4330 |
+- spin_lock_irqsave(&xhci->lock, flags); |
4331 |
+- |
4332 |
+- temp = readl(ports[wIndex]->addr); |
4333 |
+- if (link_state == USB_SS_PORT_LS_U3) |
4334 |
++ xhci_set_link_state(xhci, ports[wIndex], USB_SS_PORT_LS_U3); |
4335 |
++ spin_unlock_irqrestore(&xhci->lock, flags); |
4336 |
++ while (retries--) { |
4337 |
++ usleep_range(4000, 8000); |
4338 |
++ temp = readl(ports[wIndex]->addr); |
4339 |
++ if ((temp & PORT_PLS_MASK) == XDEV_U3) |
4340 |
++ break; |
4341 |
++ } |
4342 |
++ spin_lock_irqsave(&xhci->lock, flags); |
4343 |
++ temp = readl(ports[wIndex]->addr); |
4344 |
+ bus_state->suspended_ports |= 1 << wIndex; |
4345 |
++ } |
4346 |
+ break; |
4347 |
+ case USB_PORT_FEAT_POWER: |
4348 |
+ /* |
4349 |
+@@ -1528,6 +1569,8 @@ int xhci_hub_status_data(struct usb_hcd *hcd, char *buf) |
4350 |
+ } |
4351 |
+ if ((temp & PORT_RC)) |
4352 |
+ reset_change = true; |
4353 |
++ if (temp & PORT_OC) |
4354 |
++ status = 1; |
4355 |
+ } |
4356 |
+ if (!status && !reset_change) { |
4357 |
+ xhci_dbg(xhci, "%s: stopping port polling.\n", __func__); |
4358 |
+@@ -1593,6 +1636,13 @@ retry: |
4359 |
+ port_index); |
4360 |
+ goto retry; |
4361 |
+ } |
4362 |
++ /* bail out if port detected a over-current condition */ |
4363 |
++ if (t1 & PORT_OC) { |
4364 |
++ bus_state->bus_suspended = 0; |
4365 |
++ spin_unlock_irqrestore(&xhci->lock, flags); |
4366 |
++ xhci_dbg(xhci, "Bus suspend bailout, port over-current detected\n"); |
4367 |
++ return -EBUSY; |
4368 |
++ } |
4369 |
+ /* suspend ports in U0, or bail out for new connect changes */ |
4370 |
+ if ((t1 & PORT_PE) && (t1 & PORT_PLS_MASK) == XDEV_U0) { |
4371 |
+ if ((t1 & PORT_CSC) && wake_enabled) { |
4372 |
+diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c |
4373 |
+index 884c601bfa15..9764122c9cdf 100644 |
4374 |
+--- a/drivers/usb/host/xhci-mem.c |
4375 |
++++ b/drivers/usb/host/xhci-mem.c |
4376 |
+@@ -2552,6 +2552,7 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags) |
4377 |
+ xhci->usb3_rhub.bus_state.resume_done[i] = 0; |
4378 |
+ /* Only the USB 2.0 completions will ever be used. */ |
4379 |
+ init_completion(&xhci->usb2_rhub.bus_state.rexit_done[i]); |
4380 |
++ init_completion(&xhci->usb3_rhub.bus_state.u3exit_done[i]); |
4381 |
+ } |
4382 |
+ |
4383 |
+ if (scratchpad_alloc(xhci, flags)) |
4384 |
+diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c |
4385 |
+index f7a190fb2353..a54f8f3234f9 100644 |
4386 |
+--- a/drivers/usb/host/xhci-ring.c |
4387 |
++++ b/drivers/usb/host/xhci-ring.c |
4388 |
+@@ -541,6 +541,23 @@ void xhci_find_new_dequeue_state(struct xhci_hcd *xhci, |
4389 |
+ stream_id); |
4390 |
+ return; |
4391 |
+ } |
4392 |
++ /* |
4393 |
++ * A cancelled TD can complete with a stall if HW cached the trb. |
4394 |
++ * In this case driver can't find cur_td, but if the ring is empty we |
4395 |
++ * can move the dequeue pointer to the current enqueue position. |
4396 |
++ */ |
4397 |
++ if (!cur_td) { |
4398 |
++ if (list_empty(&ep_ring->td_list)) { |
4399 |
++ state->new_deq_seg = ep_ring->enq_seg; |
4400 |
++ state->new_deq_ptr = ep_ring->enqueue; |
4401 |
++ state->new_cycle_state = ep_ring->cycle_state; |
4402 |
++ goto done; |
4403 |
++ } else { |
4404 |
++ xhci_warn(xhci, "Can't find new dequeue state, missing cur_td\n"); |
4405 |
++ return; |
4406 |
++ } |
4407 |
++ } |
4408 |
++ |
4409 |
+ /* Dig out the cycle state saved by the xHC during the stop ep cmd */ |
4410 |
+ xhci_dbg_trace(xhci, trace_xhci_dbg_cancel_urb, |
4411 |
+ "Finding endpoint context"); |
4412 |
+@@ -586,6 +603,7 @@ void xhci_find_new_dequeue_state(struct xhci_hcd *xhci, |
4413 |
+ state->new_deq_seg = new_seg; |
4414 |
+ state->new_deq_ptr = new_deq; |
4415 |
+ |
4416 |
++done: |
4417 |
+ /* Don't update the ring cycle state for the producer (us). */ |
4418 |
+ xhci_dbg_trace(xhci, trace_xhci_dbg_cancel_urb, |
4419 |
+ "Cycle state = 0x%x", state->new_cycle_state); |
4420 |
+@@ -1673,6 +1691,7 @@ static void handle_port_status(struct xhci_hcd *xhci, |
4421 |
+ (portsc & PORT_PLS_MASK) == XDEV_U1 || |
4422 |
+ (portsc & PORT_PLS_MASK) == XDEV_U2)) { |
4423 |
+ xhci_dbg(xhci, "resume SS port %d finished\n", port_id); |
4424 |
++ complete(&bus_state->u3exit_done[hcd_portnum]); |
4425 |
+ /* We've just brought the device into U0/1/2 through either the |
4426 |
+ * Resume state after a device remote wakeup, or through the |
4427 |
+ * U3Exit state after a host-initiated resume. If it's a device |
4428 |
+@@ -1847,8 +1866,8 @@ static void xhci_cleanup_halted_endpoint(struct xhci_hcd *xhci, |
4429 |
+ |
4430 |
+ if (reset_type == EP_HARD_RESET) { |
4431 |
+ ep->ep_state |= EP_HARD_CLEAR_TOGGLE; |
4432 |
+- xhci_cleanup_stalled_ring(xhci, ep_index, stream_id, td); |
4433 |
+- xhci_clear_hub_tt_buffer(xhci, td, ep); |
4434 |
++ xhci_cleanup_stalled_ring(xhci, slot_id, ep_index, stream_id, |
4435 |
++ td); |
4436 |
+ } |
4437 |
+ xhci_ring_cmd_db(xhci); |
4438 |
+ } |
4439 |
+@@ -1969,11 +1988,18 @@ static int finish_td(struct xhci_hcd *xhci, struct xhci_td *td, |
4440 |
+ if (trb_comp_code == COMP_STALL_ERROR || |
4441 |
+ xhci_requires_manual_halt_cleanup(xhci, ep_ctx, |
4442 |
+ trb_comp_code)) { |
4443 |
+- /* Issue a reset endpoint command to clear the host side |
4444 |
+- * halt, followed by a set dequeue command to move the |
4445 |
+- * dequeue pointer past the TD. |
4446 |
+- * The class driver clears the device side halt later. |
4447 |
++ /* |
4448 |
++ * xhci internal endpoint state will go to a "halt" state for |
4449 |
++ * any stall, including default control pipe protocol stall. |
4450 |
++ * To clear the host side halt we need to issue a reset endpoint |
4451 |
++ * command, followed by a set dequeue command to move past the |
4452 |
++ * TD. |
4453 |
++ * Class drivers clear the device side halt from a functional |
4454 |
++ * stall later. Hub TT buffer should only be cleared for FS/LS |
4455 |
++ * devices behind HS hubs for functional stalls. |
4456 |
+ */ |
4457 |
++ if ((ep_index != 0) || (trb_comp_code != COMP_STALL_ERROR)) |
4458 |
++ xhci_clear_hub_tt_buffer(xhci, td, ep); |
4459 |
+ xhci_cleanup_halted_endpoint(xhci, slot_id, ep_index, |
4460 |
+ ep_ring->stream_id, td, EP_HARD_RESET); |
4461 |
+ } else { |
4462 |
+@@ -2526,6 +2552,15 @@ static int handle_tx_event(struct xhci_hcd *xhci, |
4463 |
+ xhci_dbg(xhci, "td_list is empty while skip flag set. Clear skip flag for slot %u ep %u.\n", |
4464 |
+ slot_id, ep_index); |
4465 |
+ } |
4466 |
++ if (trb_comp_code == COMP_STALL_ERROR || |
4467 |
++ xhci_requires_manual_halt_cleanup(xhci, ep_ctx, |
4468 |
++ trb_comp_code)) { |
4469 |
++ xhci_cleanup_halted_endpoint(xhci, slot_id, |
4470 |
++ ep_index, |
4471 |
++ ep_ring->stream_id, |
4472 |
++ NULL, |
4473 |
++ EP_HARD_RESET); |
4474 |
++ } |
4475 |
+ goto cleanup; |
4476 |
+ } |
4477 |
+ |
4478 |
+diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c |
4479 |
+index 2f49a7b3ce85..81b54a3d2910 100644 |
4480 |
+--- a/drivers/usb/host/xhci.c |
4481 |
++++ b/drivers/usb/host/xhci.c |
4482 |
+@@ -3031,19 +3031,19 @@ static void xhci_setup_input_ctx_for_quirk(struct xhci_hcd *xhci, |
4483 |
+ added_ctxs, added_ctxs); |
4484 |
+ } |
4485 |
+ |
4486 |
+-void xhci_cleanup_stalled_ring(struct xhci_hcd *xhci, unsigned int ep_index, |
4487 |
+- unsigned int stream_id, struct xhci_td *td) |
4488 |
++void xhci_cleanup_stalled_ring(struct xhci_hcd *xhci, unsigned int slot_id, |
4489 |
++ unsigned int ep_index, unsigned int stream_id, |
4490 |
++ struct xhci_td *td) |
4491 |
+ { |
4492 |
+ struct xhci_dequeue_state deq_state; |
4493 |
+- struct usb_device *udev = td->urb->dev; |
4494 |
+ |
4495 |
+ xhci_dbg_trace(xhci, trace_xhci_dbg_reset_ep, |
4496 |
+ "Cleaning up stalled endpoint ring"); |
4497 |
+ /* We need to move the HW's dequeue pointer past this TD, |
4498 |
+ * or it will attempt to resend it on the next doorbell ring. |
4499 |
+ */ |
4500 |
+- xhci_find_new_dequeue_state(xhci, udev->slot_id, |
4501 |
+- ep_index, stream_id, td, &deq_state); |
4502 |
++ xhci_find_new_dequeue_state(xhci, slot_id, ep_index, stream_id, td, |
4503 |
++ &deq_state); |
4504 |
+ |
4505 |
+ if (!deq_state.new_deq_ptr || !deq_state.new_deq_seg) |
4506 |
+ return; |
4507 |
+@@ -3054,7 +3054,7 @@ void xhci_cleanup_stalled_ring(struct xhci_hcd *xhci, unsigned int ep_index, |
4508 |
+ if (!(xhci->quirks & XHCI_RESET_EP_QUIRK)) { |
4509 |
+ xhci_dbg_trace(xhci, trace_xhci_dbg_reset_ep, |
4510 |
+ "Queueing new dequeue state"); |
4511 |
+- xhci_queue_new_dequeue_state(xhci, udev->slot_id, |
4512 |
++ xhci_queue_new_dequeue_state(xhci, slot_id, |
4513 |
+ ep_index, &deq_state); |
4514 |
+ } else { |
4515 |
+ /* Better hope no one uses the input context between now and the |
4516 |
+@@ -3065,7 +3065,7 @@ void xhci_cleanup_stalled_ring(struct xhci_hcd *xhci, unsigned int ep_index, |
4517 |
+ xhci_dbg_trace(xhci, trace_xhci_dbg_quirks, |
4518 |
+ "Setting up input context for " |
4519 |
+ "configure endpoint command"); |
4520 |
+- xhci_setup_input_ctx_for_quirk(xhci, udev->slot_id, |
4521 |
++ xhci_setup_input_ctx_for_quirk(xhci, slot_id, |
4522 |
+ ep_index, &deq_state); |
4523 |
+ } |
4524 |
+ } |
4525 |
+diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h |
4526 |
+index 98b98a0cd2a8..23a1abdc2b43 100644 |
4527 |
+--- a/drivers/usb/host/xhci.h |
4528 |
++++ b/drivers/usb/host/xhci.h |
4529 |
+@@ -1694,6 +1694,7 @@ struct xhci_bus_state { |
4530 |
+ /* Which ports are waiting on RExit to U0 transition. */ |
4531 |
+ unsigned long rexit_ports; |
4532 |
+ struct completion rexit_done[USB_MAXCHILDREN]; |
4533 |
++ struct completion u3exit_done[USB_MAXCHILDREN]; |
4534 |
+ }; |
4535 |
+ |
4536 |
+ |
4537 |
+@@ -2115,8 +2116,9 @@ void xhci_find_new_dequeue_state(struct xhci_hcd *xhci, |
4538 |
+ void xhci_queue_new_dequeue_state(struct xhci_hcd *xhci, |
4539 |
+ unsigned int slot_id, unsigned int ep_index, |
4540 |
+ struct xhci_dequeue_state *deq_state); |
4541 |
+-void xhci_cleanup_stalled_ring(struct xhci_hcd *xhci, unsigned int ep_index, |
4542 |
+- unsigned int stream_id, struct xhci_td *td); |
4543 |
++void xhci_cleanup_stalled_ring(struct xhci_hcd *xhci, unsigned int slot_id, |
4544 |
++ unsigned int ep_index, unsigned int stream_id, |
4545 |
++ struct xhci_td *td); |
4546 |
+ void xhci_stop_endpoint_command_watchdog(struct timer_list *t); |
4547 |
+ void xhci_handle_command_timeout(struct work_struct *work); |
4548 |
+ |
4549 |
+diff --git a/drivers/usb/misc/sisusbvga/sisusb.c b/drivers/usb/misc/sisusbvga/sisusb.c |
4550 |
+index 2ab9600d0898..fc8a5da4a07c 100644 |
4551 |
+--- a/drivers/usb/misc/sisusbvga/sisusb.c |
4552 |
++++ b/drivers/usb/misc/sisusbvga/sisusb.c |
4553 |
+@@ -1199,18 +1199,18 @@ static int sisusb_read_mem_bulk(struct sisusb_usb_data *sisusb, u32 addr, |
4554 |
+ /* High level: Gfx (indexed) register access */ |
4555 |
+ |
4556 |
+ #ifdef CONFIG_USB_SISUSBVGA_CON |
4557 |
+-int sisusb_setreg(struct sisusb_usb_data *sisusb, int port, u8 data) |
4558 |
++int sisusb_setreg(struct sisusb_usb_data *sisusb, u32 port, u8 data) |
4559 |
+ { |
4560 |
+ return sisusb_write_memio_byte(sisusb, SISUSB_TYPE_IO, port, data); |
4561 |
+ } |
4562 |
+ |
4563 |
+-int sisusb_getreg(struct sisusb_usb_data *sisusb, int port, u8 *data) |
4564 |
++int sisusb_getreg(struct sisusb_usb_data *sisusb, u32 port, u8 *data) |
4565 |
+ { |
4566 |
+ return sisusb_read_memio_byte(sisusb, SISUSB_TYPE_IO, port, data); |
4567 |
+ } |
4568 |
+ #endif |
4569 |
+ |
4570 |
+-int sisusb_setidxreg(struct sisusb_usb_data *sisusb, int port, |
4571 |
++int sisusb_setidxreg(struct sisusb_usb_data *sisusb, u32 port, |
4572 |
+ u8 index, u8 data) |
4573 |
+ { |
4574 |
+ int ret; |
4575 |
+@@ -1220,7 +1220,7 @@ int sisusb_setidxreg(struct sisusb_usb_data *sisusb, int port, |
4576 |
+ return ret; |
4577 |
+ } |
4578 |
+ |
4579 |
+-int sisusb_getidxreg(struct sisusb_usb_data *sisusb, int port, |
4580 |
++int sisusb_getidxreg(struct sisusb_usb_data *sisusb, u32 port, |
4581 |
+ u8 index, u8 *data) |
4582 |
+ { |
4583 |
+ int ret; |
4584 |
+@@ -1230,7 +1230,7 @@ int sisusb_getidxreg(struct sisusb_usb_data *sisusb, int port, |
4585 |
+ return ret; |
4586 |
+ } |
4587 |
+ |
4588 |
+-int sisusb_setidxregandor(struct sisusb_usb_data *sisusb, int port, u8 idx, |
4589 |
++int sisusb_setidxregandor(struct sisusb_usb_data *sisusb, u32 port, u8 idx, |
4590 |
+ u8 myand, u8 myor) |
4591 |
+ { |
4592 |
+ int ret; |
4593 |
+@@ -1245,7 +1245,7 @@ int sisusb_setidxregandor(struct sisusb_usb_data *sisusb, int port, u8 idx, |
4594 |
+ } |
4595 |
+ |
4596 |
+ static int sisusb_setidxregmask(struct sisusb_usb_data *sisusb, |
4597 |
+- int port, u8 idx, u8 data, u8 mask) |
4598 |
++ u32 port, u8 idx, u8 data, u8 mask) |
4599 |
+ { |
4600 |
+ int ret; |
4601 |
+ u8 tmp; |
4602 |
+@@ -1258,13 +1258,13 @@ static int sisusb_setidxregmask(struct sisusb_usb_data *sisusb, |
4603 |
+ return ret; |
4604 |
+ } |
4605 |
+ |
4606 |
+-int sisusb_setidxregor(struct sisusb_usb_data *sisusb, int port, |
4607 |
++int sisusb_setidxregor(struct sisusb_usb_data *sisusb, u32 port, |
4608 |
+ u8 index, u8 myor) |
4609 |
+ { |
4610 |
+ return sisusb_setidxregandor(sisusb, port, index, 0xff, myor); |
4611 |
+ } |
4612 |
+ |
4613 |
+-int sisusb_setidxregand(struct sisusb_usb_data *sisusb, int port, |
4614 |
++int sisusb_setidxregand(struct sisusb_usb_data *sisusb, u32 port, |
4615 |
+ u8 idx, u8 myand) |
4616 |
+ { |
4617 |
+ return sisusb_setidxregandor(sisusb, port, idx, myand, 0x00); |
4618 |
+@@ -2785,8 +2785,8 @@ static loff_t sisusb_lseek(struct file *file, loff_t offset, int orig) |
4619 |
+ static int sisusb_handle_command(struct sisusb_usb_data *sisusb, |
4620 |
+ struct sisusb_command *y, unsigned long arg) |
4621 |
+ { |
4622 |
+- int retval, port, length; |
4623 |
+- u32 address; |
4624 |
++ int retval, length; |
4625 |
++ u32 port, address; |
4626 |
+ |
4627 |
+ /* All our commands require the device |
4628 |
+ * to be initialized. |
4629 |
+diff --git a/drivers/usb/misc/sisusbvga/sisusb_init.h b/drivers/usb/misc/sisusbvga/sisusb_init.h |
4630 |
+index 1782c759c4ad..ace09985dae4 100644 |
4631 |
+--- a/drivers/usb/misc/sisusbvga/sisusb_init.h |
4632 |
++++ b/drivers/usb/misc/sisusbvga/sisusb_init.h |
4633 |
+@@ -812,17 +812,17 @@ static const struct SiS_VCLKData SiSUSB_VCLKData[] = { |
4634 |
+ int SiSUSBSetMode(struct SiS_Private *SiS_Pr, unsigned short ModeNo); |
4635 |
+ int SiSUSBSetVESAMode(struct SiS_Private *SiS_Pr, unsigned short VModeNo); |
4636 |
+ |
4637 |
+-extern int sisusb_setreg(struct sisusb_usb_data *sisusb, int port, u8 data); |
4638 |
+-extern int sisusb_getreg(struct sisusb_usb_data *sisusb, int port, u8 * data); |
4639 |
+-extern int sisusb_setidxreg(struct sisusb_usb_data *sisusb, int port, |
4640 |
++extern int sisusb_setreg(struct sisusb_usb_data *sisusb, u32 port, u8 data); |
4641 |
++extern int sisusb_getreg(struct sisusb_usb_data *sisusb, u32 port, u8 * data); |
4642 |
++extern int sisusb_setidxreg(struct sisusb_usb_data *sisusb, u32 port, |
4643 |
+ u8 index, u8 data); |
4644 |
+-extern int sisusb_getidxreg(struct sisusb_usb_data *sisusb, int port, |
4645 |
++extern int sisusb_getidxreg(struct sisusb_usb_data *sisusb, u32 port, |
4646 |
+ u8 index, u8 * data); |
4647 |
+-extern int sisusb_setidxregandor(struct sisusb_usb_data *sisusb, int port, |
4648 |
++extern int sisusb_setidxregandor(struct sisusb_usb_data *sisusb, u32 port, |
4649 |
+ u8 idx, u8 myand, u8 myor); |
4650 |
+-extern int sisusb_setidxregor(struct sisusb_usb_data *sisusb, int port, |
4651 |
++extern int sisusb_setidxregor(struct sisusb_usb_data *sisusb, u32 port, |
4652 |
+ u8 index, u8 myor); |
4653 |
+-extern int sisusb_setidxregand(struct sisusb_usb_data *sisusb, int port, |
4654 |
++extern int sisusb_setidxregand(struct sisusb_usb_data *sisusb, u32 port, |
4655 |
+ u8 idx, u8 myand); |
4656 |
+ |
4657 |
+ void sisusb_delete(struct kref *kref); |
4658 |
+diff --git a/drivers/usb/storage/uas.c b/drivers/usb/storage/uas.c |
4659 |
+index bb2198496f42..5fcad96e0656 100644 |
4660 |
+--- a/drivers/usb/storage/uas.c |
4661 |
++++ b/drivers/usb/storage/uas.c |
4662 |
+@@ -81,6 +81,19 @@ static void uas_free_streams(struct uas_dev_info *devinfo); |
4663 |
+ static void uas_log_cmd_state(struct scsi_cmnd *cmnd, const char *prefix, |
4664 |
+ int status); |
4665 |
+ |
4666 |
++/* |
4667 |
++ * This driver needs its own workqueue, as we need to control memory allocation. |
4668 |
++ * |
4669 |
++ * In the course of error handling and power management uas_wait_for_pending_cmnds() |
4670 |
++ * needs to flush pending work items. In these contexts we cannot allocate memory |
4671 |
++ * by doing block IO as we would deadlock. For the same reason we cannot wait |
4672 |
++ * for anything allocating memory not heeding these constraints. |
4673 |
++ * |
4674 |
++ * So we have to control all work items that can be on the workqueue we flush. |
4675 |
++ * Hence we cannot share a queue and need our own. |
4676 |
++ */ |
4677 |
++static struct workqueue_struct *workqueue; |
4678 |
++ |
4679 |
+ static void uas_do_work(struct work_struct *work) |
4680 |
+ { |
4681 |
+ struct uas_dev_info *devinfo = |
4682 |
+@@ -109,7 +122,7 @@ static void uas_do_work(struct work_struct *work) |
4683 |
+ if (!err) |
4684 |
+ cmdinfo->state &= ~IS_IN_WORK_LIST; |
4685 |
+ else |
4686 |
+- schedule_work(&devinfo->work); |
4687 |
++ queue_work(workqueue, &devinfo->work); |
4688 |
+ } |
4689 |
+ out: |
4690 |
+ spin_unlock_irqrestore(&devinfo->lock, flags); |
4691 |
+@@ -134,7 +147,7 @@ static void uas_add_work(struct uas_cmd_info *cmdinfo) |
4692 |
+ |
4693 |
+ lockdep_assert_held(&devinfo->lock); |
4694 |
+ cmdinfo->state |= IS_IN_WORK_LIST; |
4695 |
+- schedule_work(&devinfo->work); |
4696 |
++ queue_work(workqueue, &devinfo->work); |
4697 |
+ } |
4698 |
+ |
4699 |
+ static void uas_zap_pending(struct uas_dev_info *devinfo, int result) |
4700 |
+@@ -190,6 +203,9 @@ static void uas_log_cmd_state(struct scsi_cmnd *cmnd, const char *prefix, |
4701 |
+ struct uas_cmd_info *ci = (void *)&cmnd->SCp; |
4702 |
+ struct uas_cmd_info *cmdinfo = (void *)&cmnd->SCp; |
4703 |
+ |
4704 |
++ if (status == -ENODEV) /* too late */ |
4705 |
++ return; |
4706 |
++ |
4707 |
+ scmd_printk(KERN_INFO, cmnd, |
4708 |
+ "%s %d uas-tag %d inflight:%s%s%s%s%s%s%s%s%s%s%s%s ", |
4709 |
+ prefix, status, cmdinfo->uas_tag, |
4710 |
+@@ -1227,7 +1243,31 @@ static struct usb_driver uas_driver = { |
4711 |
+ .id_table = uas_usb_ids, |
4712 |
+ }; |
4713 |
+ |
4714 |
+-module_usb_driver(uas_driver); |
4715 |
++static int __init uas_init(void) |
4716 |
++{ |
4717 |
++ int rv; |
4718 |
++ |
4719 |
++ workqueue = alloc_workqueue("uas", WQ_MEM_RECLAIM, 0); |
4720 |
++ if (!workqueue) |
4721 |
++ return -ENOMEM; |
4722 |
++ |
4723 |
++ rv = usb_register(&uas_driver); |
4724 |
++ if (rv) { |
4725 |
++ destroy_workqueue(workqueue); |
4726 |
++ return -ENOMEM; |
4727 |
++ } |
4728 |
++ |
4729 |
++ return 0; |
4730 |
++} |
4731 |
++ |
4732 |
++static void __exit uas_exit(void) |
4733 |
++{ |
4734 |
++ usb_deregister(&uas_driver); |
4735 |
++ destroy_workqueue(workqueue); |
4736 |
++} |
4737 |
++ |
4738 |
++module_init(uas_init); |
4739 |
++module_exit(uas_exit); |
4740 |
+ |
4741 |
+ MODULE_LICENSE("GPL"); |
4742 |
+ MODULE_IMPORT_NS(USB_STORAGE); |
4743 |
+diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h |
4744 |
+index 1880f3e13f57..f6c3681fa2e9 100644 |
4745 |
+--- a/drivers/usb/storage/unusual_devs.h |
4746 |
++++ b/drivers/usb/storage/unusual_devs.h |
4747 |
+@@ -2323,6 +2323,13 @@ UNUSUAL_DEV( 0x3340, 0xffff, 0x0000, 0x0000, |
4748 |
+ USB_SC_DEVICE,USB_PR_DEVICE,NULL, |
4749 |
+ US_FL_MAX_SECTORS_64 ), |
4750 |
+ |
4751 |
++/* Reported by Cyril Roelandt <tipecaml@×××××.com> */ |
4752 |
++UNUSUAL_DEV( 0x357d, 0x7788, 0x0114, 0x0114, |
4753 |
++ "JMicron", |
4754 |
++ "USB to ATA/ATAPI Bridge", |
4755 |
++ USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
4756 |
++ US_FL_BROKEN_FUA ), |
4757 |
++ |
4758 |
+ /* Reported by Andrey Rahmatullin <wrar@××××××××.org> */ |
4759 |
+ UNUSUAL_DEV( 0x4102, 0x1020, 0x0100, 0x0100, |
4760 |
+ "iRiver", |
4761 |
+diff --git a/drivers/usb/typec/bus.c b/drivers/usb/typec/bus.c |
4762 |
+index 74cb3c2ecb34..c950171556d8 100644 |
4763 |
+--- a/drivers/usb/typec/bus.c |
4764 |
++++ b/drivers/usb/typec/bus.c |
4765 |
+@@ -192,7 +192,10 @@ EXPORT_SYMBOL_GPL(typec_altmode_vdm); |
4766 |
+ const struct typec_altmode * |
4767 |
+ typec_altmode_get_partner(struct typec_altmode *adev) |
4768 |
+ { |
4769 |
+- return adev ? &to_altmode(adev)->partner->adev : NULL; |
4770 |
++ if (!adev || !to_altmode(adev)->partner) |
4771 |
++ return NULL; |
4772 |
++ |
4773 |
++ return &to_altmode(adev)->partner->adev; |
4774 |
+ } |
4775 |
+ EXPORT_SYMBOL_GPL(typec_altmode_get_partner); |
4776 |
+ |
4777 |
+diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c |
4778 |
+index 5f61d9977a15..355a2c7fac0b 100644 |
4779 |
+--- a/drivers/usb/typec/tcpm/tcpm.c |
4780 |
++++ b/drivers/usb/typec/tcpm/tcpm.c |
4781 |
+@@ -3768,6 +3768,14 @@ static void _tcpm_cc_change(struct tcpm_port *port, enum typec_cc_status cc1, |
4782 |
+ */ |
4783 |
+ break; |
4784 |
+ |
4785 |
++ case PORT_RESET: |
4786 |
++ case PORT_RESET_WAIT_OFF: |
4787 |
++ /* |
4788 |
++ * State set back to default mode once the timer completes. |
4789 |
++ * Ignore CC changes here. |
4790 |
++ */ |
4791 |
++ break; |
4792 |
++ |
4793 |
+ default: |
4794 |
+ if (tcpm_port_is_disconnected(port)) |
4795 |
+ tcpm_set_state(port, unattached_state(port), 0); |
4796 |
+@@ -3829,6 +3837,15 @@ static void _tcpm_pd_vbus_on(struct tcpm_port *port) |
4797 |
+ case SRC_TRY_DEBOUNCE: |
4798 |
+ /* Do nothing, waiting for sink detection */ |
4799 |
+ break; |
4800 |
++ |
4801 |
++ case PORT_RESET: |
4802 |
++ case PORT_RESET_WAIT_OFF: |
4803 |
++ /* |
4804 |
++ * State set back to default mode once the timer completes. |
4805 |
++ * Ignore vbus changes here. |
4806 |
++ */ |
4807 |
++ break; |
4808 |
++ |
4809 |
+ default: |
4810 |
+ break; |
4811 |
+ } |
4812 |
+@@ -3882,10 +3899,19 @@ static void _tcpm_pd_vbus_off(struct tcpm_port *port) |
4813 |
+ case PORT_RESET_WAIT_OFF: |
4814 |
+ tcpm_set_state(port, tcpm_default_state(port), 0); |
4815 |
+ break; |
4816 |
++ |
4817 |
+ case SRC_TRY_WAIT: |
4818 |
+ case SRC_TRY_DEBOUNCE: |
4819 |
+ /* Do nothing, waiting for sink detection */ |
4820 |
+ break; |
4821 |
++ |
4822 |
++ case PORT_RESET: |
4823 |
++ /* |
4824 |
++ * State set back to default mode once the timer completes. |
4825 |
++ * Ignore vbus changes here. |
4826 |
++ */ |
4827 |
++ break; |
4828 |
++ |
4829 |
+ default: |
4830 |
+ if (port->pwr_role == TYPEC_SINK && |
4831 |
+ port->attached) |
4832 |
+diff --git a/drivers/watchdog/watchdog_dev.c b/drivers/watchdog/watchdog_dev.c |
4833 |
+index ce04edc69e5f..c4147e93aa7d 100644 |
4834 |
+--- a/drivers/watchdog/watchdog_dev.c |
4835 |
++++ b/drivers/watchdog/watchdog_dev.c |
4836 |
+@@ -282,6 +282,7 @@ static int watchdog_start(struct watchdog_device *wdd) |
4837 |
+ if (err == 0) { |
4838 |
+ set_bit(WDOG_ACTIVE, &wdd->status); |
4839 |
+ wd_data->last_keepalive = started_at; |
4840 |
++ wd_data->last_hw_keepalive = started_at; |
4841 |
+ watchdog_update_worker(wdd); |
4842 |
+ } |
4843 |
+ |
4844 |
+diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c |
4845 |
+index f5a38910a82b..703945cce0e5 100644 |
4846 |
+--- a/fs/ceph/caps.c |
4847 |
++++ b/fs/ceph/caps.c |
4848 |
+@@ -1976,8 +1976,12 @@ retry_locked: |
4849 |
+ } |
4850 |
+ |
4851 |
+ /* want more caps from mds? */ |
4852 |
+- if (want & ~(cap->mds_wanted | cap->issued)) |
4853 |
+- goto ack; |
4854 |
++ if (want & ~cap->mds_wanted) { |
4855 |
++ if (want & ~(cap->mds_wanted | cap->issued)) |
4856 |
++ goto ack; |
4857 |
++ if (!__cap_is_valid(cap)) |
4858 |
++ goto ack; |
4859 |
++ } |
4860 |
+ |
4861 |
+ /* things we might delay */ |
4862 |
+ if ((cap->issued & ~retain) == 0) |
4863 |
+diff --git a/fs/ceph/export.c b/fs/ceph/export.c |
4864 |
+index b6bfa94332c3..79dc06881e78 100644 |
4865 |
+--- a/fs/ceph/export.c |
4866 |
++++ b/fs/ceph/export.c |
4867 |
+@@ -315,6 +315,11 @@ static struct dentry *__get_parent(struct super_block *sb, |
4868 |
+ |
4869 |
+ req->r_num_caps = 1; |
4870 |
+ err = ceph_mdsc_do_request(mdsc, NULL, req); |
4871 |
++ if (err) { |
4872 |
++ ceph_mdsc_put_request(req); |
4873 |
++ return ERR_PTR(err); |
4874 |
++ } |
4875 |
++ |
4876 |
+ inode = req->r_target_inode; |
4877 |
+ if (inode) |
4878 |
+ ihold(inode); |
4879 |
+diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c |
4880 |
+index 76eacffb24d8..58915d882285 100644 |
4881 |
+--- a/fs/cifs/smb2ops.c |
4882 |
++++ b/fs/cifs/smb2ops.c |
4883 |
+@@ -664,6 +664,11 @@ int open_shroot(unsigned int xid, struct cifs_tcon *tcon, struct cifs_fid *pfid) |
4884 |
+ if (smb3_encryption_required(tcon)) |
4885 |
+ flags |= CIFS_TRANSFORM_REQ; |
4886 |
+ |
4887 |
++ if (!server->ops->new_lease_key) |
4888 |
++ return -EIO; |
4889 |
++ |
4890 |
++ server->ops->new_lease_key(pfid); |
4891 |
++ |
4892 |
+ memset(rqst, 0, sizeof(rqst)); |
4893 |
+ resp_buftype[0] = resp_buftype[1] = CIFS_NO_BUFFER; |
4894 |
+ memset(rsp_iov, 0, sizeof(rsp_iov)); |
4895 |
+diff --git a/fs/coredump.c b/fs/coredump.c |
4896 |
+index b1ea7dfbd149..d25bad2ed061 100644 |
4897 |
+--- a/fs/coredump.c |
4898 |
++++ b/fs/coredump.c |
4899 |
+@@ -211,6 +211,8 @@ static int format_corename(struct core_name *cn, struct coredump_params *cprm, |
4900 |
+ return -ENOMEM; |
4901 |
+ (*argv)[(*argc)++] = 0; |
4902 |
+ ++pat_ptr; |
4903 |
++ if (!(*pat_ptr)) |
4904 |
++ return -ENOMEM; |
4905 |
+ } |
4906 |
+ |
4907 |
+ /* Repeat as long as we have more pattern to process and more output |
4908 |
+diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c |
4909 |
+index 164dbfd40c52..9bd44588eb77 100644 |
4910 |
+--- a/fs/ext4/extents.c |
4911 |
++++ b/fs/ext4/extents.c |
4912 |
+@@ -498,6 +498,30 @@ int ext4_ext_check_inode(struct inode *inode) |
4913 |
+ return ext4_ext_check(inode, ext_inode_hdr(inode), ext_depth(inode), 0); |
4914 |
+ } |
4915 |
+ |
4916 |
++static void ext4_cache_extents(struct inode *inode, |
4917 |
++ struct ext4_extent_header *eh) |
4918 |
++{ |
4919 |
++ struct ext4_extent *ex = EXT_FIRST_EXTENT(eh); |
4920 |
++ ext4_lblk_t prev = 0; |
4921 |
++ int i; |
4922 |
++ |
4923 |
++ for (i = le16_to_cpu(eh->eh_entries); i > 0; i--, ex++) { |
4924 |
++ unsigned int status = EXTENT_STATUS_WRITTEN; |
4925 |
++ ext4_lblk_t lblk = le32_to_cpu(ex->ee_block); |
4926 |
++ int len = ext4_ext_get_actual_len(ex); |
4927 |
++ |
4928 |
++ if (prev && (prev != lblk)) |
4929 |
++ ext4_es_cache_extent(inode, prev, lblk - prev, ~0, |
4930 |
++ EXTENT_STATUS_HOLE); |
4931 |
++ |
4932 |
++ if (ext4_ext_is_unwritten(ex)) |
4933 |
++ status = EXTENT_STATUS_UNWRITTEN; |
4934 |
++ ext4_es_cache_extent(inode, lblk, len, |
4935 |
++ ext4_ext_pblock(ex), status); |
4936 |
++ prev = lblk + len; |
4937 |
++ } |
4938 |
++} |
4939 |
++ |
4940 |
+ static struct buffer_head * |
4941 |
+ __read_extent_tree_block(const char *function, unsigned int line, |
4942 |
+ struct inode *inode, ext4_fsblk_t pblk, int depth, |
4943 |
+@@ -532,26 +556,7 @@ __read_extent_tree_block(const char *function, unsigned int line, |
4944 |
+ */ |
4945 |
+ if (!(flags & EXT4_EX_NOCACHE) && depth == 0) { |
4946 |
+ struct ext4_extent_header *eh = ext_block_hdr(bh); |
4947 |
+- struct ext4_extent *ex = EXT_FIRST_EXTENT(eh); |
4948 |
+- ext4_lblk_t prev = 0; |
4949 |
+- int i; |
4950 |
+- |
4951 |
+- for (i = le16_to_cpu(eh->eh_entries); i > 0; i--, ex++) { |
4952 |
+- unsigned int status = EXTENT_STATUS_WRITTEN; |
4953 |
+- ext4_lblk_t lblk = le32_to_cpu(ex->ee_block); |
4954 |
+- int len = ext4_ext_get_actual_len(ex); |
4955 |
+- |
4956 |
+- if (prev && (prev != lblk)) |
4957 |
+- ext4_es_cache_extent(inode, prev, |
4958 |
+- lblk - prev, ~0, |
4959 |
+- EXTENT_STATUS_HOLE); |
4960 |
+- |
4961 |
+- if (ext4_ext_is_unwritten(ex)) |
4962 |
+- status = EXTENT_STATUS_UNWRITTEN; |
4963 |
+- ext4_es_cache_extent(inode, lblk, len, |
4964 |
+- ext4_ext_pblock(ex), status); |
4965 |
+- prev = lblk + len; |
4966 |
+- } |
4967 |
++ ext4_cache_extents(inode, eh); |
4968 |
+ } |
4969 |
+ return bh; |
4970 |
+ errout: |
4971 |
+@@ -899,6 +904,8 @@ ext4_find_extent(struct inode *inode, ext4_lblk_t block, |
4972 |
+ path[0].p_bh = NULL; |
4973 |
+ |
4974 |
+ i = depth; |
4975 |
++ if (!(flags & EXT4_EX_NOCACHE) && depth == 0) |
4976 |
++ ext4_cache_extents(inode, eh); |
4977 |
+ /* walk through the tree */ |
4978 |
+ while (i) { |
4979 |
+ ext_debug("depth %d: num %d, max %d\n", |
4980 |
+diff --git a/fs/f2fs/xattr.c b/fs/f2fs/xattr.c |
4981 |
+index 181900af2576..296b3189448a 100644 |
4982 |
+--- a/fs/f2fs/xattr.c |
4983 |
++++ b/fs/f2fs/xattr.c |
4984 |
+@@ -539,8 +539,9 @@ out: |
4985 |
+ ssize_t f2fs_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size) |
4986 |
+ { |
4987 |
+ struct inode *inode = d_inode(dentry); |
4988 |
++ nid_t xnid = F2FS_I(inode)->i_xattr_nid; |
4989 |
+ struct f2fs_xattr_entry *entry; |
4990 |
+- void *base_addr; |
4991 |
++ void *base_addr, *last_base_addr; |
4992 |
+ int error = 0; |
4993 |
+ size_t rest = buffer_size; |
4994 |
+ |
4995 |
+@@ -550,6 +551,8 @@ ssize_t f2fs_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size) |
4996 |
+ if (error) |
4997 |
+ return error; |
4998 |
+ |
4999 |
++ last_base_addr = (void *)base_addr + XATTR_SIZE(xnid, inode); |
5000 |
++ |
5001 |
+ list_for_each_xattr(entry, base_addr) { |
5002 |
+ const struct xattr_handler *handler = |
5003 |
+ f2fs_xattr_handler(entry->e_name_index); |
5004 |
+@@ -557,6 +560,15 @@ ssize_t f2fs_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size) |
5005 |
+ size_t prefix_len; |
5006 |
+ size_t size; |
5007 |
+ |
5008 |
++ if ((void *)(entry) + sizeof(__u32) > last_base_addr || |
5009 |
++ (void *)XATTR_NEXT_ENTRY(entry) > last_base_addr) { |
5010 |
++ f2fs_err(F2FS_I_SB(inode), "inode (%lu) has corrupted xattr", |
5011 |
++ inode->i_ino); |
5012 |
++ set_sbi_flag(F2FS_I_SB(inode), SBI_NEED_FSCK); |
5013 |
++ error = -EFSCORRUPTED; |
5014 |
++ goto cleanup; |
5015 |
++ } |
5016 |
++ |
5017 |
+ if (!handler || (handler->list && !handler->list(dentry))) |
5018 |
+ continue; |
5019 |
+ |
5020 |
+diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c |
5021 |
+index 524111420b48..afca3287184b 100644 |
5022 |
+--- a/fs/nfsd/nfs4callback.c |
5023 |
++++ b/fs/nfsd/nfs4callback.c |
5024 |
+@@ -1241,6 +1241,7 @@ nfsd4_run_cb_work(struct work_struct *work) |
5025 |
+ container_of(work, struct nfsd4_callback, cb_work); |
5026 |
+ struct nfs4_client *clp = cb->cb_clp; |
5027 |
+ struct rpc_clnt *clnt; |
5028 |
++ int flags; |
5029 |
+ |
5030 |
+ if (cb->cb_need_restart) { |
5031 |
+ cb->cb_need_restart = false; |
5032 |
+@@ -1269,7 +1270,8 @@ nfsd4_run_cb_work(struct work_struct *work) |
5033 |
+ } |
5034 |
+ |
5035 |
+ cb->cb_msg.rpc_cred = clp->cl_cb_cred; |
5036 |
+- rpc_call_async(clnt, &cb->cb_msg, RPC_TASK_SOFT | RPC_TASK_SOFTCONN, |
5037 |
++ flags = clp->cl_minorversion ? RPC_TASK_NOCONNECT : RPC_TASK_SOFTCONN; |
5038 |
++ rpc_call_async(clnt, &cb->cb_msg, RPC_TASK_SOFT | flags, |
5039 |
+ cb->cb_ops ? &nfsd4_cb_ops : &nfsd4_cb_probe_ops, cb); |
5040 |
+ } |
5041 |
+ |
5042 |
+diff --git a/fs/proc/vmcore.c b/fs/proc/vmcore.c |
5043 |
+index 7b13988796e1..080ca9d5eccb 100644 |
5044 |
+--- a/fs/proc/vmcore.c |
5045 |
++++ b/fs/proc/vmcore.c |
5046 |
+@@ -266,7 +266,8 @@ static int vmcoredd_mmap_dumps(struct vm_area_struct *vma, unsigned long dst, |
5047 |
+ if (start < offset + dump->size) { |
5048 |
+ tsz = min(offset + (u64)dump->size - start, (u64)size); |
5049 |
+ buf = dump->buf + start - offset; |
5050 |
+- if (remap_vmalloc_range_partial(vma, dst, buf, tsz)) { |
5051 |
++ if (remap_vmalloc_range_partial(vma, dst, buf, 0, |
5052 |
++ tsz)) { |
5053 |
+ ret = -EFAULT; |
5054 |
+ goto out_unlock; |
5055 |
+ } |
5056 |
+@@ -624,7 +625,7 @@ static int mmap_vmcore(struct file *file, struct vm_area_struct *vma) |
5057 |
+ tsz = min(elfcorebuf_sz + elfnotes_sz - (size_t)start, size); |
5058 |
+ kaddr = elfnotes_buf + start - elfcorebuf_sz - vmcoredd_orig_sz; |
5059 |
+ if (remap_vmalloc_range_partial(vma, vma->vm_start + len, |
5060 |
+- kaddr, tsz)) |
5061 |
++ kaddr, 0, tsz)) |
5062 |
+ goto fail; |
5063 |
+ |
5064 |
+ size -= tsz; |
5065 |
+diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h |
5066 |
+index 8e132cf819e4..e5341847e3a0 100644 |
5067 |
+--- a/include/linux/iio/iio.h |
5068 |
++++ b/include/linux/iio/iio.h |
5069 |
+@@ -596,7 +596,7 @@ void iio_device_unregister(struct iio_dev *indio_dev); |
5070 |
+ * 0 on success, negative error number on failure. |
5071 |
+ */ |
5072 |
+ #define devm_iio_device_register(dev, indio_dev) \ |
5073 |
+- __devm_iio_device_register((dev), (indio_dev), THIS_MODULE); |
5074 |
++ __devm_iio_device_register((dev), (indio_dev), THIS_MODULE) |
5075 |
+ int __devm_iio_device_register(struct device *dev, struct iio_dev *indio_dev, |
5076 |
+ struct module *this_mod); |
5077 |
+ void devm_iio_device_unregister(struct device *dev, struct iio_dev *indio_dev); |
5078 |
+diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h |
5079 |
+index b81f0f1ded5f..678b0a5797a0 100644 |
5080 |
+--- a/include/linux/kvm_host.h |
5081 |
++++ b/include/linux/kvm_host.h |
5082 |
+@@ -1027,7 +1027,7 @@ search_memslots(struct kvm_memslots *slots, gfn_t gfn) |
5083 |
+ start = slot + 1; |
5084 |
+ } |
5085 |
+ |
5086 |
+- if (gfn >= memslots[start].base_gfn && |
5087 |
++ if (start < slots->used_slots && gfn >= memslots[start].base_gfn && |
5088 |
+ gfn < memslots[start].base_gfn + memslots[start].npages) { |
5089 |
+ atomic_set(&slots->lru_slot, start); |
5090 |
+ return &memslots[start]; |
5091 |
+diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h |
5092 |
+index decac0790fc1..01a1334c5fc5 100644 |
5093 |
+--- a/include/linux/vmalloc.h |
5094 |
++++ b/include/linux/vmalloc.h |
5095 |
+@@ -122,7 +122,7 @@ extern void vunmap(const void *addr); |
5096 |
+ |
5097 |
+ extern int remap_vmalloc_range_partial(struct vm_area_struct *vma, |
5098 |
+ unsigned long uaddr, void *kaddr, |
5099 |
+- unsigned long size); |
5100 |
++ unsigned long pgoff, unsigned long size); |
5101 |
+ |
5102 |
+ extern int remap_vmalloc_range(struct vm_area_struct *vma, void *addr, |
5103 |
+ unsigned long pgoff); |
5104 |
+diff --git a/include/net/mac80211.h b/include/net/mac80211.h |
5105 |
+index 523c6a09e1c8..d9ba9a77bcf2 100644 |
5106 |
+--- a/include/net/mac80211.h |
5107 |
++++ b/include/net/mac80211.h |
5108 |
+@@ -5933,7 +5933,9 @@ enum rate_control_capabilities { |
5109 |
+ struct rate_control_ops { |
5110 |
+ unsigned long capa; |
5111 |
+ const char *name; |
5112 |
+- void *(*alloc)(struct ieee80211_hw *hw, struct dentry *debugfsdir); |
5113 |
++ void *(*alloc)(struct ieee80211_hw *hw); |
5114 |
++ void (*add_debugfs)(struct ieee80211_hw *hw, void *priv, |
5115 |
++ struct dentry *debugfsdir); |
5116 |
+ void (*free)(void *priv); |
5117 |
+ |
5118 |
+ void *(*alloc_sta)(void *priv, struct ieee80211_sta *sta, gfp_t gfp); |
5119 |
+diff --git a/include/net/tcp.h b/include/net/tcp.h |
5120 |
+index 830c89db1245..cce285f70c8e 100644 |
5121 |
+--- a/include/net/tcp.h |
5122 |
++++ b/include/net/tcp.h |
5123 |
+@@ -50,7 +50,7 @@ extern struct inet_hashinfo tcp_hashinfo; |
5124 |
+ extern struct percpu_counter tcp_orphan_count; |
5125 |
+ void tcp_time_wait(struct sock *sk, int state, int timeo); |
5126 |
+ |
5127 |
+-#define MAX_TCP_HEADER (128 + MAX_HEADER) |
5128 |
++#define MAX_TCP_HEADER L1_CACHE_ALIGN(128 + MAX_HEADER) |
5129 |
+ #define MAX_TCP_OPTION_SPACE 40 |
5130 |
+ #define TCP_MIN_SND_MSS 48 |
5131 |
+ #define TCP_MIN_GSO_SIZE (TCP_MIN_SND_MSS - MAX_TCP_OPTION_SPACE) |
5132 |
+diff --git a/ipc/util.c b/ipc/util.c |
5133 |
+index d126d156efc6..594871610d45 100644 |
5134 |
+--- a/ipc/util.c |
5135 |
++++ b/ipc/util.c |
5136 |
+@@ -764,13 +764,13 @@ static struct kern_ipc_perm *sysvipc_find_ipc(struct ipc_ids *ids, loff_t pos, |
5137 |
+ total++; |
5138 |
+ } |
5139 |
+ |
5140 |
++ *new_pos = pos + 1; |
5141 |
+ if (total >= ids->in_use) |
5142 |
+ return NULL; |
5143 |
+ |
5144 |
+ for (; pos < ipc_mni; pos++) { |
5145 |
+ ipc = idr_find(&ids->ipcs_idr, pos); |
5146 |
+ if (ipc != NULL) { |
5147 |
+- *new_pos = pos + 1; |
5148 |
+ rcu_read_lock(); |
5149 |
+ ipc_lock_object(ipc); |
5150 |
+ return ipc; |
5151 |
+diff --git a/kernel/audit.c b/kernel/audit.c |
5152 |
+index dfc45063cb56..fcfbb3476ccd 100644 |
5153 |
+--- a/kernel/audit.c |
5154 |
++++ b/kernel/audit.c |
5155 |
+@@ -1325,6 +1325,9 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh) |
5156 |
+ case AUDIT_FIRST_USER_MSG2 ... AUDIT_LAST_USER_MSG2: |
5157 |
+ if (!audit_enabled && msg_type != AUDIT_USER_AVC) |
5158 |
+ return 0; |
5159 |
++ /* exit early if there isn't at least one character to print */ |
5160 |
++ if (data_len < 2) |
5161 |
++ return -EINVAL; |
5162 |
+ |
5163 |
+ err = audit_filter(msg_type, AUDIT_FILTER_USER); |
5164 |
+ if (err == 1) { /* match or error */ |
5165 |
+diff --git a/kernel/dma/direct.c b/kernel/dma/direct.c |
5166 |
+index 867fd72cb260..0a093a675b63 100644 |
5167 |
+--- a/kernel/dma/direct.c |
5168 |
++++ b/kernel/dma/direct.c |
5169 |
+@@ -45,7 +45,8 @@ static inline dma_addr_t phys_to_dma_direct(struct device *dev, |
5170 |
+ |
5171 |
+ u64 dma_direct_get_required_mask(struct device *dev) |
5172 |
+ { |
5173 |
+- u64 max_dma = phys_to_dma_direct(dev, (max_pfn - 1) << PAGE_SHIFT); |
5174 |
++ phys_addr_t phys = (phys_addr_t)(max_pfn - 1) << PAGE_SHIFT; |
5175 |
++ u64 max_dma = phys_to_dma_direct(dev, phys); |
5176 |
+ |
5177 |
+ return (1ULL << (fls64(max_dma) - 1)) * 2 - 1; |
5178 |
+ } |
5179 |
+diff --git a/kernel/events/core.c b/kernel/events/core.c |
5180 |
+index 15b123bdcaf5..72d0cfd73cf1 100644 |
5181 |
+--- a/kernel/events/core.c |
5182 |
++++ b/kernel/events/core.c |
5183 |
+@@ -6537,9 +6537,12 @@ static u64 perf_virt_to_phys(u64 virt) |
5184 |
+ * Try IRQ-safe __get_user_pages_fast first. |
5185 |
+ * If failed, leave phys_addr as 0. |
5186 |
+ */ |
5187 |
+- if ((current->mm != NULL) && |
5188 |
+- (__get_user_pages_fast(virt, 1, 0, &p) == 1)) |
5189 |
+- phys_addr = page_to_phys(p) + virt % PAGE_SIZE; |
5190 |
++ if (current->mm != NULL) { |
5191 |
++ pagefault_disable(); |
5192 |
++ if (__get_user_pages_fast(virt, 1, 0, &p) == 1) |
5193 |
++ phys_addr = page_to_phys(p) + virt % PAGE_SIZE; |
5194 |
++ pagefault_enable(); |
5195 |
++ } |
5196 |
+ |
5197 |
+ if (p) |
5198 |
+ put_page(p); |
5199 |
+diff --git a/kernel/gcov/fs.c b/kernel/gcov/fs.c |
5200 |
+index e5eb5ea7ea59..cc4ee482d3fb 100644 |
5201 |
+--- a/kernel/gcov/fs.c |
5202 |
++++ b/kernel/gcov/fs.c |
5203 |
+@@ -108,9 +108,9 @@ static void *gcov_seq_next(struct seq_file *seq, void *data, loff_t *pos) |
5204 |
+ { |
5205 |
+ struct gcov_iterator *iter = data; |
5206 |
+ |
5207 |
++ (*pos)++; |
5208 |
+ if (gcov_iter_next(iter)) |
5209 |
+ return NULL; |
5210 |
+- (*pos)++; |
5211 |
+ |
5212 |
+ return iter; |
5213 |
+ } |
5214 |
+diff --git a/kernel/signal.c b/kernel/signal.c |
5215 |
+index 7d3d35eb7a0b..2b9295f2d244 100644 |
5216 |
+--- a/kernel/signal.c |
5217 |
++++ b/kernel/signal.c |
5218 |
+@@ -1993,8 +1993,12 @@ bool do_notify_parent(struct task_struct *tsk, int sig) |
5219 |
+ if (psig->action[SIGCHLD-1].sa.sa_handler == SIG_IGN) |
5220 |
+ sig = 0; |
5221 |
+ } |
5222 |
++ /* |
5223 |
++ * Send with __send_signal as si_pid and si_uid are in the |
5224 |
++ * parent's namespaces. |
5225 |
++ */ |
5226 |
+ if (valid_signal(sig) && sig) |
5227 |
+- __group_send_sig_info(sig, &info, tsk->parent); |
5228 |
++ __send_signal(sig, &info, tsk->parent, PIDTYPE_TGID, false); |
5229 |
+ __wake_up_parent(tsk, tsk->parent); |
5230 |
+ spin_unlock_irqrestore(&psig->siglock, flags); |
5231 |
+ |
5232 |
+diff --git a/lib/raid6/test/Makefile b/lib/raid6/test/Makefile |
5233 |
+index 3ab8720aa2f8..b9e6c3648be1 100644 |
5234 |
+--- a/lib/raid6/test/Makefile |
5235 |
++++ b/lib/raid6/test/Makefile |
5236 |
+@@ -35,13 +35,13 @@ endif |
5237 |
+ ifeq ($(IS_X86),yes) |
5238 |
+ OBJS += mmx.o sse1.o sse2.o avx2.o recov_ssse3.o recov_avx2.o avx512.o recov_avx512.o |
5239 |
+ CFLAGS += $(shell echo "pshufb %xmm0, %xmm0" | \ |
5240 |
+- gcc -c -x assembler - >&/dev/null && \ |
5241 |
++ gcc -c -x assembler - >/dev/null 2>&1 && \ |
5242 |
+ rm ./-.o && echo -DCONFIG_AS_SSSE3=1) |
5243 |
+ CFLAGS += $(shell echo "vpbroadcastb %xmm0, %ymm1" | \ |
5244 |
+- gcc -c -x assembler - >&/dev/null && \ |
5245 |
++ gcc -c -x assembler - >/dev/null 2>&1 && \ |
5246 |
+ rm ./-.o && echo -DCONFIG_AS_AVX2=1) |
5247 |
+ CFLAGS += $(shell echo "vpmovm2b %k1, %zmm5" | \ |
5248 |
+- gcc -c -x assembler - >&/dev/null && \ |
5249 |
++ gcc -c -x assembler - >/dev/null 2>&1 && \ |
5250 |
+ rm ./-.o && echo -DCONFIG_AS_AVX512=1) |
5251 |
+ else ifeq ($(HAS_NEON),yes) |
5252 |
+ OBJS += neon.o neon1.o neon2.o neon4.o neon8.o recov_neon.o recov_neon_inner.o |
5253 |
+diff --git a/mm/hugetlb.c b/mm/hugetlb.c |
5254 |
+index e0afd582ca01..2af1831596f2 100644 |
5255 |
+--- a/mm/hugetlb.c |
5256 |
++++ b/mm/hugetlb.c |
5257 |
+@@ -5016,8 +5016,8 @@ pte_t *huge_pte_offset(struct mm_struct *mm, |
5258 |
+ { |
5259 |
+ pgd_t *pgd; |
5260 |
+ p4d_t *p4d; |
5261 |
+- pud_t *pud; |
5262 |
+- pmd_t *pmd; |
5263 |
++ pud_t *pud, pud_entry; |
5264 |
++ pmd_t *pmd, pmd_entry; |
5265 |
+ |
5266 |
+ pgd = pgd_offset(mm, addr); |
5267 |
+ if (!pgd_present(*pgd)) |
5268 |
+@@ -5027,17 +5027,19 @@ pte_t *huge_pte_offset(struct mm_struct *mm, |
5269 |
+ return NULL; |
5270 |
+ |
5271 |
+ pud = pud_offset(p4d, addr); |
5272 |
+- if (sz != PUD_SIZE && pud_none(*pud)) |
5273 |
++ pud_entry = READ_ONCE(*pud); |
5274 |
++ if (sz != PUD_SIZE && pud_none(pud_entry)) |
5275 |
+ return NULL; |
5276 |
+ /* hugepage or swap? */ |
5277 |
+- if (pud_huge(*pud) || !pud_present(*pud)) |
5278 |
++ if (pud_huge(pud_entry) || !pud_present(pud_entry)) |
5279 |
+ return (pte_t *)pud; |
5280 |
+ |
5281 |
+ pmd = pmd_offset(pud, addr); |
5282 |
+- if (sz != PMD_SIZE && pmd_none(*pmd)) |
5283 |
++ pmd_entry = READ_ONCE(*pmd); |
5284 |
++ if (sz != PMD_SIZE && pmd_none(pmd_entry)) |
5285 |
+ return NULL; |
5286 |
+ /* hugepage or swap? */ |
5287 |
+- if (pmd_huge(*pmd) || !pmd_present(*pmd)) |
5288 |
++ if (pmd_huge(pmd_entry) || !pmd_present(pmd_entry)) |
5289 |
+ return (pte_t *)pmd; |
5290 |
+ |
5291 |
+ return NULL; |
5292 |
+diff --git a/mm/ksm.c b/mm/ksm.c |
5293 |
+index 7905934cd3ad..e486c54d921b 100644 |
5294 |
+--- a/mm/ksm.c |
5295 |
++++ b/mm/ksm.c |
5296 |
+@@ -2112,8 +2112,16 @@ static void cmp_and_merge_page(struct page *page, struct rmap_item *rmap_item) |
5297 |
+ |
5298 |
+ down_read(&mm->mmap_sem); |
5299 |
+ vma = find_mergeable_vma(mm, rmap_item->address); |
5300 |
+- err = try_to_merge_one_page(vma, page, |
5301 |
+- ZERO_PAGE(rmap_item->address)); |
5302 |
++ if (vma) { |
5303 |
++ err = try_to_merge_one_page(vma, page, |
5304 |
++ ZERO_PAGE(rmap_item->address)); |
5305 |
++ } else { |
5306 |
++ /* |
5307 |
++ * If the vma is out of date, we do not need to |
5308 |
++ * continue. |
5309 |
++ */ |
5310 |
++ err = 0; |
5311 |
++ } |
5312 |
+ up_read(&mm->mmap_sem); |
5313 |
+ /* |
5314 |
+ * In case of failure, the page was not really empty, so we |
5315 |
+diff --git a/mm/vmalloc.c b/mm/vmalloc.c |
5316 |
+index 7d05834e594c..ad4d00bd7914 100644 |
5317 |
+--- a/mm/vmalloc.c |
5318 |
++++ b/mm/vmalloc.c |
5319 |
+@@ -34,6 +34,7 @@ |
5320 |
+ #include <linux/llist.h> |
5321 |
+ #include <linux/bitops.h> |
5322 |
+ #include <linux/rbtree_augmented.h> |
5323 |
++#include <linux/overflow.h> |
5324 |
+ |
5325 |
+ #include <linux/uaccess.h> |
5326 |
+ #include <asm/tlbflush.h> |
5327 |
+@@ -2976,6 +2977,7 @@ finished: |
5328 |
+ * @vma: vma to cover |
5329 |
+ * @uaddr: target user address to start at |
5330 |
+ * @kaddr: virtual address of vmalloc kernel memory |
5331 |
++ * @pgoff: offset from @kaddr to start at |
5332 |
+ * @size: size of map area |
5333 |
+ * |
5334 |
+ * Returns: 0 for success, -Exxx on failure |
5335 |
+@@ -2988,9 +2990,15 @@ finished: |
5336 |
+ * Similar to remap_pfn_range() (see mm/memory.c) |
5337 |
+ */ |
5338 |
+ int remap_vmalloc_range_partial(struct vm_area_struct *vma, unsigned long uaddr, |
5339 |
+- void *kaddr, unsigned long size) |
5340 |
++ void *kaddr, unsigned long pgoff, |
5341 |
++ unsigned long size) |
5342 |
+ { |
5343 |
+ struct vm_struct *area; |
5344 |
++ unsigned long off; |
5345 |
++ unsigned long end_index; |
5346 |
++ |
5347 |
++ if (check_shl_overflow(pgoff, PAGE_SHIFT, &off)) |
5348 |
++ return -EINVAL; |
5349 |
+ |
5350 |
+ size = PAGE_ALIGN(size); |
5351 |
+ |
5352 |
+@@ -3004,8 +3012,10 @@ int remap_vmalloc_range_partial(struct vm_area_struct *vma, unsigned long uaddr, |
5353 |
+ if (!(area->flags & (VM_USERMAP | VM_DMA_COHERENT))) |
5354 |
+ return -EINVAL; |
5355 |
+ |
5356 |
+- if (kaddr + size > area->addr + get_vm_area_size(area)) |
5357 |
++ if (check_add_overflow(size, off, &end_index) || |
5358 |
++ end_index > get_vm_area_size(area)) |
5359 |
+ return -EINVAL; |
5360 |
++ kaddr += off; |
5361 |
+ |
5362 |
+ do { |
5363 |
+ struct page *page = vmalloc_to_page(kaddr); |
5364 |
+@@ -3044,7 +3054,7 @@ int remap_vmalloc_range(struct vm_area_struct *vma, void *addr, |
5365 |
+ unsigned long pgoff) |
5366 |
+ { |
5367 |
+ return remap_vmalloc_range_partial(vma, vma->vm_start, |
5368 |
+- addr + (pgoff << PAGE_SHIFT), |
5369 |
++ addr, pgoff, |
5370 |
+ vma->vm_end - vma->vm_start); |
5371 |
+ } |
5372 |
+ EXPORT_SYMBOL(remap_vmalloc_range); |
5373 |
+diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c |
5374 |
+index f1888c683426..01588eef0cee 100644 |
5375 |
+--- a/net/ipv4/fib_semantics.c |
5376 |
++++ b/net/ipv4/fib_semantics.c |
5377 |
+@@ -1999,7 +1999,7 @@ static void fib_select_default(const struct flowi4 *flp, struct fib_result *res) |
5378 |
+ |
5379 |
+ hlist_for_each_entry_rcu(fa, fa_head, fa_list) { |
5380 |
+ struct fib_info *next_fi = fa->fa_info; |
5381 |
+- struct fib_nh *nh; |
5382 |
++ struct fib_nh_common *nhc; |
5383 |
+ |
5384 |
+ if (fa->fa_slen != slen) |
5385 |
+ continue; |
5386 |
+@@ -2022,8 +2022,8 @@ static void fib_select_default(const struct flowi4 *flp, struct fib_result *res) |
5387 |
+ fa->fa_type != RTN_UNICAST) |
5388 |
+ continue; |
5389 |
+ |
5390 |
+- nh = fib_info_nh(next_fi, 0); |
5391 |
+- if (!nh->fib_nh_gw4 || nh->fib_nh_scope != RT_SCOPE_LINK) |
5392 |
++ nhc = fib_info_nhc(next_fi, 0); |
5393 |
++ if (!nhc->nhc_gw_family || nhc->nhc_scope != RT_SCOPE_LINK) |
5394 |
+ continue; |
5395 |
+ |
5396 |
+ fib_alias_accessed(fa); |
5397 |
+diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c |
5398 |
+index 74e1d964a615..cd4b84310d92 100644 |
5399 |
+--- a/net/ipv4/ip_tunnel.c |
5400 |
++++ b/net/ipv4/ip_tunnel.c |
5401 |
+@@ -142,11 +142,8 @@ struct ip_tunnel *ip_tunnel_lookup(struct ip_tunnel_net *itn, |
5402 |
+ cand = t; |
5403 |
+ } |
5404 |
+ |
5405 |
+- if (flags & TUNNEL_NO_KEY) |
5406 |
+- goto skip_key_lookup; |
5407 |
+- |
5408 |
+ hlist_for_each_entry_rcu(t, head, hash_node) { |
5409 |
+- if (t->parms.i_key != key || |
5410 |
++ if ((!(flags & TUNNEL_NO_KEY) && t->parms.i_key != key) || |
5411 |
+ t->parms.iph.saddr != 0 || |
5412 |
+ t->parms.iph.daddr != 0 || |
5413 |
+ !(t->dev->flags & IFF_UP)) |
5414 |
+@@ -158,7 +155,6 @@ struct ip_tunnel *ip_tunnel_lookup(struct ip_tunnel_net *itn, |
5415 |
+ cand = t; |
5416 |
+ } |
5417 |
+ |
5418 |
+-skip_key_lookup: |
5419 |
+ if (cand) |
5420 |
+ return cand; |
5421 |
+ |
5422 |
+diff --git a/net/ipv4/xfrm4_output.c b/net/ipv4/xfrm4_output.c |
5423 |
+index ecff3fce9807..ab343ae686d4 100644 |
5424 |
+--- a/net/ipv4/xfrm4_output.c |
5425 |
++++ b/net/ipv4/xfrm4_output.c |
5426 |
+@@ -58,9 +58,7 @@ int xfrm4_output_finish(struct sock *sk, struct sk_buff *skb) |
5427 |
+ { |
5428 |
+ memset(IPCB(skb), 0, sizeof(*IPCB(skb))); |
5429 |
+ |
5430 |
+-#ifdef CONFIG_NETFILTER |
5431 |
+ IPCB(skb)->flags |= IPSKB_XFRM_TRANSFORMED; |
5432 |
+-#endif |
5433 |
+ |
5434 |
+ return xfrm_output(sk, skb); |
5435 |
+ } |
5436 |
+diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c |
5437 |
+index debdaeba5d8c..18d05403d3b5 100644 |
5438 |
+--- a/net/ipv6/ipv6_sockglue.c |
5439 |
++++ b/net/ipv6/ipv6_sockglue.c |
5440 |
+@@ -183,15 +183,14 @@ static int do_ipv6_setsockopt(struct sock *sk, int level, int optname, |
5441 |
+ retv = -EBUSY; |
5442 |
+ break; |
5443 |
+ } |
5444 |
+- } else if (sk->sk_protocol == IPPROTO_TCP) { |
5445 |
+- if (sk->sk_prot != &tcpv6_prot) { |
5446 |
+- retv = -EBUSY; |
5447 |
+- break; |
5448 |
+- } |
5449 |
+- break; |
5450 |
+- } else { |
5451 |
++ } |
5452 |
++ if (sk->sk_protocol == IPPROTO_TCP && |
5453 |
++ sk->sk_prot != &tcpv6_prot) { |
5454 |
++ retv = -EBUSY; |
5455 |
+ break; |
5456 |
+ } |
5457 |
++ if (sk->sk_protocol != IPPROTO_TCP) |
5458 |
++ break; |
5459 |
+ if (sk->sk_state != TCP_ESTABLISHED) { |
5460 |
+ retv = -ENOTCONN; |
5461 |
+ break; |
5462 |
+diff --git a/net/ipv6/xfrm6_output.c b/net/ipv6/xfrm6_output.c |
5463 |
+index eecac1b7148e..cf2a0ce15c1c 100644 |
5464 |
+--- a/net/ipv6/xfrm6_output.c |
5465 |
++++ b/net/ipv6/xfrm6_output.c |
5466 |
+@@ -111,9 +111,7 @@ int xfrm6_output_finish(struct sock *sk, struct sk_buff *skb) |
5467 |
+ { |
5468 |
+ memset(IP6CB(skb), 0, sizeof(*IP6CB(skb))); |
5469 |
+ |
5470 |
+-#ifdef CONFIG_NETFILTER |
5471 |
+ IP6CB(skb)->flags |= IP6SKB_XFRM_TRANSFORMED; |
5472 |
+-#endif |
5473 |
+ |
5474 |
+ return xfrm_output(sk, skb); |
5475 |
+ } |
5476 |
+diff --git a/net/mac80211/main.c b/net/mac80211/main.c |
5477 |
+index bc4bed021066..3e8561c3b0e7 100644 |
5478 |
+--- a/net/mac80211/main.c |
5479 |
++++ b/net/mac80211/main.c |
5480 |
+@@ -1155,8 +1155,6 @@ int ieee80211_register_hw(struct ieee80211_hw *hw) |
5481 |
+ local->tx_headroom = max_t(unsigned int , local->hw.extra_tx_headroom, |
5482 |
+ IEEE80211_TX_STATUS_HEADROOM); |
5483 |
+ |
5484 |
+- debugfs_hw_add(local); |
5485 |
+- |
5486 |
+ /* |
5487 |
+ * if the driver doesn't specify a max listen interval we |
5488 |
+ * use 5 which should be a safe default |
5489 |
+@@ -1248,6 +1246,9 @@ int ieee80211_register_hw(struct ieee80211_hw *hw) |
5490 |
+ if (result < 0) |
5491 |
+ goto fail_wiphy_register; |
5492 |
+ |
5493 |
++ debugfs_hw_add(local); |
5494 |
++ rate_control_add_debugfs(local); |
5495 |
++ |
5496 |
+ rtnl_lock(); |
5497 |
+ |
5498 |
+ /* add one default STA interface if supported */ |
5499 |
+diff --git a/net/mac80211/rate.c b/net/mac80211/rate.c |
5500 |
+index a1e9fc7878aa..b051f125d3af 100644 |
5501 |
+--- a/net/mac80211/rate.c |
5502 |
++++ b/net/mac80211/rate.c |
5503 |
+@@ -214,17 +214,16 @@ static ssize_t rcname_read(struct file *file, char __user *userbuf, |
5504 |
+ ref->ops->name, len); |
5505 |
+ } |
5506 |
+ |
5507 |
+-static const struct file_operations rcname_ops = { |
5508 |
++const struct file_operations rcname_ops = { |
5509 |
+ .read = rcname_read, |
5510 |
+ .open = simple_open, |
5511 |
+ .llseek = default_llseek, |
5512 |
+ }; |
5513 |
+ #endif |
5514 |
+ |
5515 |
+-static struct rate_control_ref *rate_control_alloc(const char *name, |
5516 |
+- struct ieee80211_local *local) |
5517 |
++static struct rate_control_ref * |
5518 |
++rate_control_alloc(const char *name, struct ieee80211_local *local) |
5519 |
+ { |
5520 |
+- struct dentry *debugfsdir = NULL; |
5521 |
+ struct rate_control_ref *ref; |
5522 |
+ |
5523 |
+ ref = kmalloc(sizeof(struct rate_control_ref), GFP_KERNEL); |
5524 |
+@@ -234,13 +233,7 @@ static struct rate_control_ref *rate_control_alloc(const char *name, |
5525 |
+ if (!ref->ops) |
5526 |
+ goto free; |
5527 |
+ |
5528 |
+-#ifdef CONFIG_MAC80211_DEBUGFS |
5529 |
+- debugfsdir = debugfs_create_dir("rc", local->hw.wiphy->debugfsdir); |
5530 |
+- local->debugfs.rcdir = debugfsdir; |
5531 |
+- debugfs_create_file("name", 0400, debugfsdir, ref, &rcname_ops); |
5532 |
+-#endif |
5533 |
+- |
5534 |
+- ref->priv = ref->ops->alloc(&local->hw, debugfsdir); |
5535 |
++ ref->priv = ref->ops->alloc(&local->hw); |
5536 |
+ if (!ref->priv) |
5537 |
+ goto free; |
5538 |
+ return ref; |
5539 |
+diff --git a/net/mac80211/rate.h b/net/mac80211/rate.h |
5540 |
+index 5397c6dad056..79b44d3db171 100644 |
5541 |
+--- a/net/mac80211/rate.h |
5542 |
++++ b/net/mac80211/rate.h |
5543 |
+@@ -60,6 +60,29 @@ static inline void rate_control_add_sta_debugfs(struct sta_info *sta) |
5544 |
+ #endif |
5545 |
+ } |
5546 |
+ |
5547 |
++extern const struct file_operations rcname_ops; |
5548 |
++ |
5549 |
++static inline void rate_control_add_debugfs(struct ieee80211_local *local) |
5550 |
++{ |
5551 |
++#ifdef CONFIG_MAC80211_DEBUGFS |
5552 |
++ struct dentry *debugfsdir; |
5553 |
++ |
5554 |
++ if (!local->rate_ctrl) |
5555 |
++ return; |
5556 |
++ |
5557 |
++ if (!local->rate_ctrl->ops->add_debugfs) |
5558 |
++ return; |
5559 |
++ |
5560 |
++ debugfsdir = debugfs_create_dir("rc", local->hw.wiphy->debugfsdir); |
5561 |
++ local->debugfs.rcdir = debugfsdir; |
5562 |
++ debugfs_create_file("name", 0400, debugfsdir, |
5563 |
++ local->rate_ctrl, &rcname_ops); |
5564 |
++ |
5565 |
++ local->rate_ctrl->ops->add_debugfs(&local->hw, local->rate_ctrl->priv, |
5566 |
++ debugfsdir); |
5567 |
++#endif |
5568 |
++} |
5569 |
++ |
5570 |
+ void ieee80211_check_rate_mask(struct ieee80211_sub_if_data *sdata); |
5571 |
+ |
5572 |
+ /* Get a reference to the rate control algorithm. If `name' is NULL, get the |
5573 |
+diff --git a/net/mac80211/rc80211_minstrel_ht.c b/net/mac80211/rc80211_minstrel_ht.c |
5574 |
+index 0ef2633349b5..f2abe1f77dfc 100644 |
5575 |
+--- a/net/mac80211/rc80211_minstrel_ht.c |
5576 |
++++ b/net/mac80211/rc80211_minstrel_ht.c |
5577 |
+@@ -1631,7 +1631,7 @@ minstrel_ht_init_cck_rates(struct minstrel_priv *mp) |
5578 |
+ } |
5579 |
+ |
5580 |
+ static void * |
5581 |
+-minstrel_ht_alloc(struct ieee80211_hw *hw, struct dentry *debugfsdir) |
5582 |
++minstrel_ht_alloc(struct ieee80211_hw *hw) |
5583 |
+ { |
5584 |
+ struct minstrel_priv *mp; |
5585 |
+ |
5586 |
+@@ -1668,18 +1668,24 @@ minstrel_ht_alloc(struct ieee80211_hw *hw, struct dentry *debugfsdir) |
5587 |
+ mp->hw = hw; |
5588 |
+ mp->update_interval = 100; |
5589 |
+ |
5590 |
++ minstrel_ht_init_cck_rates(mp); |
5591 |
++ |
5592 |
++ return mp; |
5593 |
++} |
5594 |
++ |
5595 |
+ #ifdef CONFIG_MAC80211_DEBUGFS |
5596 |
++static void minstrel_ht_add_debugfs(struct ieee80211_hw *hw, void *priv, |
5597 |
++ struct dentry *debugfsdir) |
5598 |
++{ |
5599 |
++ struct minstrel_priv *mp = priv; |
5600 |
++ |
5601 |
+ mp->fixed_rate_idx = (u32) -1; |
5602 |
+ debugfs_create_u32("fixed_rate_idx", S_IRUGO | S_IWUGO, debugfsdir, |
5603 |
+ &mp->fixed_rate_idx); |
5604 |
+ debugfs_create_u32("sample_switch", S_IRUGO | S_IWUSR, debugfsdir, |
5605 |
+ &mp->sample_switch); |
5606 |
+-#endif |
5607 |
+- |
5608 |
+- minstrel_ht_init_cck_rates(mp); |
5609 |
+- |
5610 |
+- return mp; |
5611 |
+ } |
5612 |
++#endif |
5613 |
+ |
5614 |
+ static void |
5615 |
+ minstrel_ht_free(void *priv) |
5616 |
+@@ -1718,6 +1724,7 @@ static const struct rate_control_ops mac80211_minstrel_ht = { |
5617 |
+ .alloc = minstrel_ht_alloc, |
5618 |
+ .free = minstrel_ht_free, |
5619 |
+ #ifdef CONFIG_MAC80211_DEBUGFS |
5620 |
++ .add_debugfs = minstrel_ht_add_debugfs, |
5621 |
+ .add_sta_debugfs = minstrel_ht_add_sta_debugfs, |
5622 |
+ #endif |
5623 |
+ .get_expected_throughput = minstrel_ht_get_expected_throughput, |
5624 |
+diff --git a/net/netrom/nr_route.c b/net/netrom/nr_route.c |
5625 |
+index d41335bad1f8..89cd9de21594 100644 |
5626 |
+--- a/net/netrom/nr_route.c |
5627 |
++++ b/net/netrom/nr_route.c |
5628 |
+@@ -208,6 +208,7 @@ static int __must_check nr_add_node(ax25_address *nr, const char *mnemonic, |
5629 |
+ /* refcount initialized at 1 */ |
5630 |
+ spin_unlock_bh(&nr_node_list_lock); |
5631 |
+ |
5632 |
++ nr_neigh_put(nr_neigh); |
5633 |
+ return 0; |
5634 |
+ } |
5635 |
+ nr_node_lock(nr_node); |
5636 |
+diff --git a/net/openvswitch/conntrack.c b/net/openvswitch/conntrack.c |
5637 |
+index 283e8f9a5fd2..8b70298857e3 100644 |
5638 |
+--- a/net/openvswitch/conntrack.c |
5639 |
++++ b/net/openvswitch/conntrack.c |
5640 |
+@@ -1890,7 +1890,8 @@ static void ovs_ct_limit_exit(struct net *net, struct ovs_net *ovs_net) |
5641 |
+ struct hlist_head *head = &info->limits[i]; |
5642 |
+ struct ovs_ct_limit *ct_limit; |
5643 |
+ |
5644 |
+- hlist_for_each_entry_rcu(ct_limit, head, hlist_node) |
5645 |
++ hlist_for_each_entry_rcu(ct_limit, head, hlist_node, |
5646 |
++ lockdep_ovsl_is_held()) |
5647 |
+ kfree_rcu(ct_limit, rcu); |
5648 |
+ } |
5649 |
+ kfree(ovs_net->ct_limit_info->limits); |
5650 |
+diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c |
5651 |
+index 3eed90bfa2bf..4f097bd3339e 100644 |
5652 |
+--- a/net/openvswitch/datapath.c |
5653 |
++++ b/net/openvswitch/datapath.c |
5654 |
+@@ -2430,8 +2430,10 @@ static void __net_exit ovs_exit_net(struct net *dnet) |
5655 |
+ struct net *net; |
5656 |
+ LIST_HEAD(head); |
5657 |
+ |
5658 |
+- ovs_ct_exit(dnet); |
5659 |
+ ovs_lock(); |
5660 |
++ |
5661 |
++ ovs_ct_exit(dnet); |
5662 |
++ |
5663 |
+ list_for_each_entry_safe(dp, dp_next, &ovs_net->dps, list_node) |
5664 |
+ __dp_destroy(dp); |
5665 |
+ |
5666 |
+diff --git a/net/sched/sch_etf.c b/net/sched/sch_etf.c |
5667 |
+index b1da5589a0c6..c48f91075b5c 100644 |
5668 |
+--- a/net/sched/sch_etf.c |
5669 |
++++ b/net/sched/sch_etf.c |
5670 |
+@@ -82,7 +82,7 @@ static bool is_packet_valid(struct Qdisc *sch, struct sk_buff *nskb) |
5671 |
+ if (q->skip_sock_check) |
5672 |
+ goto skip; |
5673 |
+ |
5674 |
+- if (!sk) |
5675 |
++ if (!sk || !sk_fullsock(sk)) |
5676 |
+ return false; |
5677 |
+ |
5678 |
+ if (!sock_flag(sk, SOCK_TXTIME)) |
5679 |
+@@ -137,8 +137,9 @@ static void report_sock_error(struct sk_buff *skb, u32 err, u8 code) |
5680 |
+ struct sock_exterr_skb *serr; |
5681 |
+ struct sk_buff *clone; |
5682 |
+ ktime_t txtime = skb->tstamp; |
5683 |
++ struct sock *sk = skb->sk; |
5684 |
+ |
5685 |
+- if (!skb->sk || !(skb->sk->sk_txtime_report_errors)) |
5686 |
++ if (!sk || !sk_fullsock(sk) || !(sk->sk_txtime_report_errors)) |
5687 |
+ return; |
5688 |
+ |
5689 |
+ clone = skb_clone(skb, GFP_ATOMIC); |
5690 |
+@@ -154,7 +155,7 @@ static void report_sock_error(struct sk_buff *skb, u32 err, u8 code) |
5691 |
+ serr->ee.ee_data = (txtime >> 32); /* high part of tstamp */ |
5692 |
+ serr->ee.ee_info = txtime; /* low part of tstamp */ |
5693 |
+ |
5694 |
+- if (sock_queue_err_skb(skb->sk, clone)) |
5695 |
++ if (sock_queue_err_skb(sk, clone)) |
5696 |
+ kfree_skb(clone); |
5697 |
+ } |
5698 |
+ |
5699 |
+diff --git a/net/sunrpc/svc_xprt.c b/net/sunrpc/svc_xprt.c |
5700 |
+index de3c077733a7..298557744818 100644 |
5701 |
+--- a/net/sunrpc/svc_xprt.c |
5702 |
++++ b/net/sunrpc/svc_xprt.c |
5703 |
+@@ -1028,6 +1028,8 @@ static void svc_delete_xprt(struct svc_xprt *xprt) |
5704 |
+ |
5705 |
+ dprintk("svc: svc_delete_xprt(%p)\n", xprt); |
5706 |
+ xprt->xpt_ops->xpo_detach(xprt); |
5707 |
++ if (xprt->xpt_bc_xprt) |
5708 |
++ xprt->xpt_bc_xprt->ops->close(xprt->xpt_bc_xprt); |
5709 |
+ |
5710 |
+ spin_lock_bh(&serv->sv_lock); |
5711 |
+ list_del_init(&xprt->xpt_list); |
5712 |
+diff --git a/net/sunrpc/xprtrdma/svc_rdma_backchannel.c b/net/sunrpc/xprtrdma/svc_rdma_backchannel.c |
5713 |
+index 908e78bb87c6..cf80394b2db3 100644 |
5714 |
+--- a/net/sunrpc/xprtrdma/svc_rdma_backchannel.c |
5715 |
++++ b/net/sunrpc/xprtrdma/svc_rdma_backchannel.c |
5716 |
+@@ -242,6 +242,8 @@ static void |
5717 |
+ xprt_rdma_bc_close(struct rpc_xprt *xprt) |
5718 |
+ { |
5719 |
+ dprintk("svcrdma: %s: xprt %p\n", __func__, xprt); |
5720 |
++ |
5721 |
++ xprt_disconnect_done(xprt); |
5722 |
+ xprt->cwnd = RPC_CWNDSHIFT; |
5723 |
+ } |
5724 |
+ |
5725 |
+diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c |
5726 |
+index 5361b98f31ae..934e30e67537 100644 |
5727 |
+--- a/net/sunrpc/xprtsock.c |
5728 |
++++ b/net/sunrpc/xprtsock.c |
5729 |
+@@ -2714,6 +2714,7 @@ static int bc_send_request(struct rpc_rqst *req) |
5730 |
+ |
5731 |
+ static void bc_close(struct rpc_xprt *xprt) |
5732 |
+ { |
5733 |
++ xprt_disconnect_done(xprt); |
5734 |
+ } |
5735 |
+ |
5736 |
+ /* |
5737 |
+diff --git a/net/x25/x25_dev.c b/net/x25/x25_dev.c |
5738 |
+index 00e782335cb0..25bf72ee6cad 100644 |
5739 |
+--- a/net/x25/x25_dev.c |
5740 |
++++ b/net/x25/x25_dev.c |
5741 |
+@@ -115,8 +115,10 @@ int x25_lapb_receive_frame(struct sk_buff *skb, struct net_device *dev, |
5742 |
+ goto drop; |
5743 |
+ } |
5744 |
+ |
5745 |
+- if (!pskb_may_pull(skb, 1)) |
5746 |
++ if (!pskb_may_pull(skb, 1)) { |
5747 |
++ x25_neigh_put(nb); |
5748 |
+ return 0; |
5749 |
++ } |
5750 |
+ |
5751 |
+ switch (skb->data[0]) { |
5752 |
+ |
5753 |
+diff --git a/samples/vfio-mdev/mdpy.c b/samples/vfio-mdev/mdpy.c |
5754 |
+index cc86bf6566e4..9894693f3be1 100644 |
5755 |
+--- a/samples/vfio-mdev/mdpy.c |
5756 |
++++ b/samples/vfio-mdev/mdpy.c |
5757 |
+@@ -418,7 +418,7 @@ static int mdpy_mmap(struct mdev_device *mdev, struct vm_area_struct *vma) |
5758 |
+ return -EINVAL; |
5759 |
+ |
5760 |
+ return remap_vmalloc_range_partial(vma, vma->vm_start, |
5761 |
+- mdev_state->memblk, |
5762 |
++ mdev_state->memblk, 0, |
5763 |
+ vma->vm_end - vma->vm_start); |
5764 |
+ } |
5765 |
+ |
5766 |
+diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc |
5767 |
+index 82773cc35d35..0f8c77f84711 100644 |
5768 |
+--- a/scripts/kconfig/qconf.cc |
5769 |
++++ b/scripts/kconfig/qconf.cc |
5770 |
+@@ -627,7 +627,7 @@ void ConfigList::updateMenuList(ConfigItem *parent, struct menu* menu) |
5771 |
+ last = item; |
5772 |
+ continue; |
5773 |
+ } |
5774 |
+- hide: |
5775 |
++hide: |
5776 |
+ if (item && item->menu == child) { |
5777 |
+ last = parent->firstChild(); |
5778 |
+ if (last == item) |
5779 |
+@@ -692,7 +692,7 @@ void ConfigList::updateMenuList(ConfigList *parent, struct menu* menu) |
5780 |
+ last = item; |
5781 |
+ continue; |
5782 |
+ } |
5783 |
+- hide: |
5784 |
++hide: |
5785 |
+ if (item && item->menu == child) { |
5786 |
+ last = (ConfigItem*)parent->topLevelItem(0); |
5787 |
+ if (last == item) |
5788 |
+@@ -1225,10 +1225,11 @@ QMenu* ConfigInfoView::createStandardContextMenu(const QPoint & pos) |
5789 |
+ { |
5790 |
+ QMenu* popup = Parent::createStandardContextMenu(pos); |
5791 |
+ QAction* action = new QAction("Show Debug Info", popup); |
5792 |
+- action->setCheckable(true); |
5793 |
+- connect(action, SIGNAL(toggled(bool)), SLOT(setShowDebug(bool))); |
5794 |
+- connect(this, SIGNAL(showDebugChanged(bool)), action, SLOT(setOn(bool))); |
5795 |
+- action->setChecked(showDebug()); |
5796 |
++ |
5797 |
++ action->setCheckable(true); |
5798 |
++ connect(action, SIGNAL(toggled(bool)), SLOT(setShowDebug(bool))); |
5799 |
++ connect(this, SIGNAL(showDebugChanged(bool)), action, SLOT(setOn(bool))); |
5800 |
++ action->setChecked(showDebug()); |
5801 |
+ popup->addSeparator(); |
5802 |
+ popup->addAction(action); |
5803 |
+ return popup; |
5804 |
+diff --git a/security/keys/internal.h b/security/keys/internal.h |
5805 |
+index c039373488bd..7e9914943616 100644 |
5806 |
+--- a/security/keys/internal.h |
5807 |
++++ b/security/keys/internal.h |
5808 |
+@@ -16,6 +16,8 @@ |
5809 |
+ #include <linux/keyctl.h> |
5810 |
+ #include <linux/refcount.h> |
5811 |
+ #include <linux/compat.h> |
5812 |
++#include <linux/mm.h> |
5813 |
++#include <linux/vmalloc.h> |
5814 |
+ |
5815 |
+ struct iovec; |
5816 |
+ |
5817 |
+@@ -349,4 +351,14 @@ static inline void key_check(const struct key *key) |
5818 |
+ |
5819 |
+ #endif |
5820 |
+ |
5821 |
++/* |
5822 |
++ * Helper function to clear and free a kvmalloc'ed memory object. |
5823 |
++ */ |
5824 |
++static inline void __kvzfree(const void *addr, size_t len) |
5825 |
++{ |
5826 |
++ if (addr) { |
5827 |
++ memset((void *)addr, 0, len); |
5828 |
++ kvfree(addr); |
5829 |
++ } |
5830 |
++} |
5831 |
+ #endif /* _INTERNAL_H */ |
5832 |
+diff --git a/security/keys/keyctl.c b/security/keys/keyctl.c |
5833 |
+index 106e16f9006b..5e01192e222a 100644 |
5834 |
+--- a/security/keys/keyctl.c |
5835 |
++++ b/security/keys/keyctl.c |
5836 |
+@@ -339,7 +339,7 @@ long keyctl_update_key(key_serial_t id, |
5837 |
+ payload = NULL; |
5838 |
+ if (plen) { |
5839 |
+ ret = -ENOMEM; |
5840 |
+- payload = kmalloc(plen, GFP_KERNEL); |
5841 |
++ payload = kvmalloc(plen, GFP_KERNEL); |
5842 |
+ if (!payload) |
5843 |
+ goto error; |
5844 |
+ |
5845 |
+@@ -360,7 +360,7 @@ long keyctl_update_key(key_serial_t id, |
5846 |
+ |
5847 |
+ key_ref_put(key_ref); |
5848 |
+ error2: |
5849 |
+- kzfree(payload); |
5850 |
++ __kvzfree(payload, plen); |
5851 |
+ error: |
5852 |
+ return ret; |
5853 |
+ } |
5854 |
+@@ -827,7 +827,8 @@ long keyctl_read_key(key_serial_t keyid, char __user *buffer, size_t buflen) |
5855 |
+ struct key *key; |
5856 |
+ key_ref_t key_ref; |
5857 |
+ long ret; |
5858 |
+- char *key_data; |
5859 |
++ char *key_data = NULL; |
5860 |
++ size_t key_data_len; |
5861 |
+ |
5862 |
+ /* find the key first */ |
5863 |
+ key_ref = lookup_user_key(keyid, 0, 0); |
5864 |
+@@ -878,24 +879,51 @@ can_read_key: |
5865 |
+ * Allocating a temporary buffer to hold the keys before |
5866 |
+ * transferring them to user buffer to avoid potential |
5867 |
+ * deadlock involving page fault and mmap_sem. |
5868 |
++ * |
5869 |
++ * key_data_len = (buflen <= PAGE_SIZE) |
5870 |
++ * ? buflen : actual length of key data |
5871 |
++ * |
5872 |
++ * This prevents allocating arbitrary large buffer which can |
5873 |
++ * be much larger than the actual key length. In the latter case, |
5874 |
++ * at least 2 passes of this loop is required. |
5875 |
+ */ |
5876 |
+- key_data = kmalloc(buflen, GFP_KERNEL); |
5877 |
++ key_data_len = (buflen <= PAGE_SIZE) ? buflen : 0; |
5878 |
++ for (;;) { |
5879 |
++ if (key_data_len) { |
5880 |
++ key_data = kvmalloc(key_data_len, GFP_KERNEL); |
5881 |
++ if (!key_data) { |
5882 |
++ ret = -ENOMEM; |
5883 |
++ goto key_put_out; |
5884 |
++ } |
5885 |
++ } |
5886 |
+ |
5887 |
+- if (!key_data) { |
5888 |
+- ret = -ENOMEM; |
5889 |
+- goto key_put_out; |
5890 |
+- } |
5891 |
+- ret = __keyctl_read_key(key, key_data, buflen); |
5892 |
++ ret = __keyctl_read_key(key, key_data, key_data_len); |
5893 |
++ |
5894 |
++ /* |
5895 |
++ * Read methods will just return the required length without |
5896 |
++ * any copying if the provided length isn't large enough. |
5897 |
++ */ |
5898 |
++ if (ret <= 0 || ret > buflen) |
5899 |
++ break; |
5900 |
++ |
5901 |
++ /* |
5902 |
++ * The key may change (unlikely) in between 2 consecutive |
5903 |
++ * __keyctl_read_key() calls. In this case, we reallocate |
5904 |
++ * a larger buffer and redo the key read when |
5905 |
++ * key_data_len < ret <= buflen. |
5906 |
++ */ |
5907 |
++ if (ret > key_data_len) { |
5908 |
++ if (unlikely(key_data)) |
5909 |
++ __kvzfree(key_data, key_data_len); |
5910 |
++ key_data_len = ret; |
5911 |
++ continue; /* Allocate buffer */ |
5912 |
++ } |
5913 |
+ |
5914 |
+- /* |
5915 |
+- * Read methods will just return the required length without |
5916 |
+- * any copying if the provided length isn't large enough. |
5917 |
+- */ |
5918 |
+- if (ret > 0 && ret <= buflen) { |
5919 |
+ if (copy_to_user(buffer, key_data, ret)) |
5920 |
+ ret = -EFAULT; |
5921 |
++ break; |
5922 |
+ } |
5923 |
+- kzfree(key_data); |
5924 |
++ __kvzfree(key_data, key_data_len); |
5925 |
+ |
5926 |
+ key_put_out: |
5927 |
+ key_put(key); |
5928 |
+diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c |
5929 |
+index 72bbfeddea24..dd77b9ffe5fd 100644 |
5930 |
+--- a/sound/pci/hda/hda_intel.c |
5931 |
++++ b/sound/pci/hda/hda_intel.c |
5932 |
+@@ -2024,7 +2024,6 @@ static void pcm_mmap_prepare(struct snd_pcm_substream *substream, |
5933 |
+ * should be ignored from the beginning. |
5934 |
+ */ |
5935 |
+ static const struct snd_pci_quirk driver_blacklist[] = { |
5936 |
+- SND_PCI_QUIRK(0x1043, 0x874f, "ASUS ROG Zenith II / Strix", 0), |
5937 |
+ SND_PCI_QUIRK(0x1462, 0xcb59, "MSI TRX40 Creator", 0), |
5938 |
+ SND_PCI_QUIRK(0x1462, 0xcb60, "MSI TRX40", 0), |
5939 |
+ {} |
5940 |
+diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c |
5941 |
+index 307ca1f03676..f1febfc47ba6 100644 |
5942 |
+--- a/sound/pci/hda/patch_hdmi.c |
5943 |
++++ b/sound/pci/hda/patch_hdmi.c |
5944 |
+@@ -57,6 +57,10 @@ MODULE_PARM_DESC(static_hdmi_pcm, "Don't restrict PCM parameters per ELD info"); |
5945 |
+ #define is_cherryview(codec) ((codec)->core.vendor_id == 0x80862883) |
5946 |
+ #define is_valleyview_plus(codec) (is_valleyview(codec) || is_cherryview(codec)) |
5947 |
+ |
5948 |
++static bool enable_acomp = true; |
5949 |
++module_param(enable_acomp, bool, 0444); |
5950 |
++MODULE_PARM_DESC(enable_acomp, "Enable audio component binding (default=yes)"); |
5951 |
++ |
5952 |
+ struct hdmi_spec_per_cvt { |
5953 |
+ hda_nid_t cvt_nid; |
5954 |
+ int assigned; |
5955 |
+@@ -2550,6 +2554,11 @@ static void generic_acomp_init(struct hda_codec *codec, |
5956 |
+ { |
5957 |
+ struct hdmi_spec *spec = codec->spec; |
5958 |
+ |
5959 |
++ if (!enable_acomp) { |
5960 |
++ codec_info(codec, "audio component disabled by module option\n"); |
5961 |
++ return; |
5962 |
++ } |
5963 |
++ |
5964 |
+ spec->port2pin = port2pin; |
5965 |
+ setup_drm_audio_ops(codec, ops); |
5966 |
+ if (!snd_hdac_acomp_init(&codec->bus->core, &spec->drm_audio_ops, |
5967 |
+diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c |
5968 |
+index 10c8b31f8507..ee1b89f2bcd5 100644 |
5969 |
+--- a/sound/pci/hda/patch_realtek.c |
5970 |
++++ b/sound/pci/hda/patch_realtek.c |
5971 |
+@@ -369,6 +369,7 @@ static void alc_fill_eapd_coef(struct hda_codec *codec) |
5972 |
+ case 0x10ec0233: |
5973 |
+ case 0x10ec0235: |
5974 |
+ case 0x10ec0236: |
5975 |
++ case 0x10ec0245: |
5976 |
+ case 0x10ec0255: |
5977 |
+ case 0x10ec0256: |
5978 |
+ case 0x10ec0257: |
5979 |
+@@ -789,9 +790,11 @@ static void alc_ssid_check(struct hda_codec *codec, const hda_nid_t *ports) |
5980 |
+ { |
5981 |
+ if (!alc_subsystem_id(codec, ports)) { |
5982 |
+ struct alc_spec *spec = codec->spec; |
5983 |
+- codec_dbg(codec, |
5984 |
+- "realtek: Enable default setup for auto mode as fallback\n"); |
5985 |
+- spec->init_amp = ALC_INIT_DEFAULT; |
5986 |
++ if (spec->init_amp == ALC_INIT_UNDEFINED) { |
5987 |
++ codec_dbg(codec, |
5988 |
++ "realtek: Enable default setup for auto mode as fallback\n"); |
5989 |
++ spec->init_amp = ALC_INIT_DEFAULT; |
5990 |
++ } |
5991 |
+ } |
5992 |
+ } |
5993 |
+ |
5994 |
+@@ -8100,6 +8103,7 @@ static int patch_alc269(struct hda_codec *codec) |
5995 |
+ spec->gen.mixer_nid = 0; |
5996 |
+ break; |
5997 |
+ case 0x10ec0215: |
5998 |
++ case 0x10ec0245: |
5999 |
+ case 0x10ec0285: |
6000 |
+ case 0x10ec0289: |
6001 |
+ spec->codec_variant = ALC269_TYPE_ALC215; |
6002 |
+@@ -9361,6 +9365,7 @@ static const struct hda_device_id snd_hda_id_realtek[] = { |
6003 |
+ HDA_CODEC_ENTRY(0x10ec0234, "ALC234", patch_alc269), |
6004 |
+ HDA_CODEC_ENTRY(0x10ec0235, "ALC233", patch_alc269), |
6005 |
+ HDA_CODEC_ENTRY(0x10ec0236, "ALC236", patch_alc269), |
6006 |
++ HDA_CODEC_ENTRY(0x10ec0245, "ALC245", patch_alc269), |
6007 |
+ HDA_CODEC_ENTRY(0x10ec0255, "ALC255", patch_alc269), |
6008 |
+ HDA_CODEC_ENTRY(0x10ec0256, "ALC256", patch_alc269), |
6009 |
+ HDA_CODEC_ENTRY(0x10ec0257, "ALC257", patch_alc269), |
6010 |
+diff --git a/sound/soc/intel/atom/sst-atom-controls.c b/sound/soc/intel/atom/sst-atom-controls.c |
6011 |
+index f883c9340eee..df8f7994d3b7 100644 |
6012 |
+--- a/sound/soc/intel/atom/sst-atom-controls.c |
6013 |
++++ b/sound/soc/intel/atom/sst-atom-controls.c |
6014 |
+@@ -966,7 +966,9 @@ static int sst_set_be_modules(struct snd_soc_dapm_widget *w, |
6015 |
+ dev_dbg(c->dev, "Enter: widget=%s\n", w->name); |
6016 |
+ |
6017 |
+ if (SND_SOC_DAPM_EVENT_ON(event)) { |
6018 |
++ mutex_lock(&drv->lock); |
6019 |
+ ret = sst_send_slot_map(drv); |
6020 |
++ mutex_unlock(&drv->lock); |
6021 |
+ if (ret) |
6022 |
+ return ret; |
6023 |
+ ret = sst_send_pipe_module_params(w, k); |
6024 |
+diff --git a/sound/soc/intel/boards/bytcr_rt5640.c b/sound/soc/intel/boards/bytcr_rt5640.c |
6025 |
+index 243f683bc02a..e62e1d7815aa 100644 |
6026 |
+--- a/sound/soc/intel/boards/bytcr_rt5640.c |
6027 |
++++ b/sound/soc/intel/boards/bytcr_rt5640.c |
6028 |
+@@ -591,6 +591,17 @@ static const struct dmi_system_id byt_rt5640_quirk_table[] = { |
6029 |
+ BYT_RT5640_SSP0_AIF1 | |
6030 |
+ BYT_RT5640_MCLK_EN), |
6031 |
+ }, |
6032 |
++ { |
6033 |
++ /* MPMAN MPWIN895CL */ |
6034 |
++ .matches = { |
6035 |
++ DMI_EXACT_MATCH(DMI_SYS_VENDOR, "MPMAN"), |
6036 |
++ DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "MPWIN8900CL"), |
6037 |
++ }, |
6038 |
++ .driver_data = (void *)(BYTCR_INPUT_DEFAULTS | |
6039 |
++ BYT_RT5640_MONO_SPEAKER | |
6040 |
++ BYT_RT5640_SSP0_AIF1 | |
6041 |
++ BYT_RT5640_MCLK_EN), |
6042 |
++ }, |
6043 |
+ { /* MSI S100 tablet */ |
6044 |
+ .matches = { |
6045 |
+ DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Micro-Star International Co., Ltd."), |
6046 |
+diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c |
6047 |
+index e0ff40b10d85..06aa39379749 100644 |
6048 |
+--- a/sound/soc/soc-dapm.c |
6049 |
++++ b/sound/soc/soc-dapm.c |
6050 |
+@@ -423,7 +423,7 @@ static int dapm_kcontrol_data_alloc(struct snd_soc_dapm_widget *widget, |
6051 |
+ |
6052 |
+ memset(&template, 0, sizeof(template)); |
6053 |
+ template.reg = e->reg; |
6054 |
+- template.mask = e->mask << e->shift_l; |
6055 |
++ template.mask = e->mask; |
6056 |
+ template.shift = e->shift_l; |
6057 |
+ template.off_val = snd_soc_enum_item_to_val(e, 0); |
6058 |
+ template.on_val = template.off_val; |
6059 |
+@@ -546,8 +546,22 @@ static bool dapm_kcontrol_set_value(const struct snd_kcontrol *kcontrol, |
6060 |
+ if (data->value == value) |
6061 |
+ return false; |
6062 |
+ |
6063 |
+- if (data->widget) |
6064 |
+- data->widget->on_val = value; |
6065 |
++ if (data->widget) { |
6066 |
++ switch (dapm_kcontrol_get_wlist(kcontrol)->widgets[0]->id) { |
6067 |
++ case snd_soc_dapm_switch: |
6068 |
++ case snd_soc_dapm_mixer: |
6069 |
++ case snd_soc_dapm_mixer_named_ctl: |
6070 |
++ data->widget->on_val = value & data->widget->mask; |
6071 |
++ break; |
6072 |
++ case snd_soc_dapm_demux: |
6073 |
++ case snd_soc_dapm_mux: |
6074 |
++ data->widget->on_val = value >> data->widget->shift; |
6075 |
++ break; |
6076 |
++ default: |
6077 |
++ data->widget->on_val = value; |
6078 |
++ break; |
6079 |
++ } |
6080 |
++ } |
6081 |
+ |
6082 |
+ data->value = value; |
6083 |
+ |
6084 |
+diff --git a/sound/soc/sof/trace.c b/sound/soc/sof/trace.c |
6085 |
+index 4c3cff031fd6..fd6f5913782b 100644 |
6086 |
+--- a/sound/soc/sof/trace.c |
6087 |
++++ b/sound/soc/sof/trace.c |
6088 |
+@@ -328,7 +328,10 @@ void snd_sof_free_trace(struct snd_sof_dev *sdev) |
6089 |
+ { |
6090 |
+ snd_sof_release_trace(sdev); |
6091 |
+ |
6092 |
+- snd_dma_free_pages(&sdev->dmatb); |
6093 |
+- snd_dma_free_pages(&sdev->dmatp); |
6094 |
++ if (sdev->dma_trace_pages) { |
6095 |
++ snd_dma_free_pages(&sdev->dmatb); |
6096 |
++ snd_dma_free_pages(&sdev->dmatp); |
6097 |
++ sdev->dma_trace_pages = 0; |
6098 |
++ } |
6099 |
+ } |
6100 |
+ EXPORT_SYMBOL(snd_sof_free_trace); |
6101 |
+diff --git a/sound/usb/format.c b/sound/usb/format.c |
6102 |
+index f4f0cf3deaf0..1f9ea513230a 100644 |
6103 |
+--- a/sound/usb/format.c |
6104 |
++++ b/sound/usb/format.c |
6105 |
+@@ -226,6 +226,52 @@ static int parse_audio_format_rates_v1(struct snd_usb_audio *chip, struct audiof |
6106 |
+ return 0; |
6107 |
+ } |
6108 |
+ |
6109 |
++/* |
6110 |
++ * Many Focusrite devices supports a limited set of sampling rates per |
6111 |
++ * altsetting. Maximum rate is exposed in the last 4 bytes of Format Type |
6112 |
++ * descriptor which has a non-standard bLength = 10. |
6113 |
++ */ |
6114 |
++static bool focusrite_valid_sample_rate(struct snd_usb_audio *chip, |
6115 |
++ struct audioformat *fp, |
6116 |
++ unsigned int rate) |
6117 |
++{ |
6118 |
++ struct usb_interface *iface; |
6119 |
++ struct usb_host_interface *alts; |
6120 |
++ unsigned char *fmt; |
6121 |
++ unsigned int max_rate; |
6122 |
++ |
6123 |
++ iface = usb_ifnum_to_if(chip->dev, fp->iface); |
6124 |
++ if (!iface) |
6125 |
++ return true; |
6126 |
++ |
6127 |
++ alts = &iface->altsetting[fp->altset_idx]; |
6128 |
++ fmt = snd_usb_find_csint_desc(alts->extra, alts->extralen, |
6129 |
++ NULL, UAC_FORMAT_TYPE); |
6130 |
++ if (!fmt) |
6131 |
++ return true; |
6132 |
++ |
6133 |
++ if (fmt[0] == 10) { /* bLength */ |
6134 |
++ max_rate = combine_quad(&fmt[6]); |
6135 |
++ |
6136 |
++ /* Validate max rate */ |
6137 |
++ if (max_rate != 48000 && |
6138 |
++ max_rate != 96000 && |
6139 |
++ max_rate != 192000 && |
6140 |
++ max_rate != 384000) { |
6141 |
++ |
6142 |
++ usb_audio_info(chip, |
6143 |
++ "%u:%d : unexpected max rate: %u\n", |
6144 |
++ fp->iface, fp->altsetting, max_rate); |
6145 |
++ |
6146 |
++ return true; |
6147 |
++ } |
6148 |
++ |
6149 |
++ return rate <= max_rate; |
6150 |
++ } |
6151 |
++ |
6152 |
++ return true; |
6153 |
++} |
6154 |
++ |
6155 |
+ /* |
6156 |
+ * Helper function to walk the array of sample rate triplets reported by |
6157 |
+ * the device. The problem is that we need to parse whole array first to |
6158 |
+@@ -262,6 +308,11 @@ static int parse_uac2_sample_rate_range(struct snd_usb_audio *chip, |
6159 |
+ } |
6160 |
+ |
6161 |
+ for (rate = min; rate <= max; rate += res) { |
6162 |
++ /* Filter out invalid rates on Focusrite devices */ |
6163 |
++ if (USB_ID_VENDOR(chip->usb_id) == 0x1235 && |
6164 |
++ !focusrite_valid_sample_rate(chip, fp, rate)) |
6165 |
++ goto skip_rate; |
6166 |
++ |
6167 |
+ if (fp->rate_table) |
6168 |
+ fp->rate_table[nr_rates] = rate; |
6169 |
+ if (!fp->rate_min || rate < fp->rate_min) |
6170 |
+@@ -276,6 +327,7 @@ static int parse_uac2_sample_rate_range(struct snd_usb_audio *chip, |
6171 |
+ break; |
6172 |
+ } |
6173 |
+ |
6174 |
++skip_rate: |
6175 |
+ /* avoid endless loop */ |
6176 |
+ if (res == 0) |
6177 |
+ break; |
6178 |
+diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c |
6179 |
+index 5661994e13e7..583edacc9fe8 100644 |
6180 |
+--- a/sound/usb/mixer.c |
6181 |
++++ b/sound/usb/mixer.c |
6182 |
+@@ -1755,8 +1755,10 @@ static void build_connector_control(struct usb_mixer_interface *mixer, |
6183 |
+ { |
6184 |
+ struct snd_kcontrol *kctl; |
6185 |
+ struct usb_mixer_elem_info *cval; |
6186 |
++ const struct usbmix_name_map *map; |
6187 |
+ |
6188 |
+- if (check_ignored_ctl(find_map(imap, term->id, 0))) |
6189 |
++ map = find_map(imap, term->id, 0); |
6190 |
++ if (check_ignored_ctl(map)) |
6191 |
+ return; |
6192 |
+ |
6193 |
+ cval = kzalloc(sizeof(*cval), GFP_KERNEL); |
6194 |
+@@ -1788,8 +1790,12 @@ static void build_connector_control(struct usb_mixer_interface *mixer, |
6195 |
+ usb_mixer_elem_info_free(cval); |
6196 |
+ return; |
6197 |
+ } |
6198 |
+- get_connector_control_name(mixer, term, is_input, kctl->id.name, |
6199 |
+- sizeof(kctl->id.name)); |
6200 |
++ |
6201 |
++ if (check_mapped_name(map, kctl->id.name, sizeof(kctl->id.name))) |
6202 |
++ strlcat(kctl->id.name, " Jack", sizeof(kctl->id.name)); |
6203 |
++ else |
6204 |
++ get_connector_control_name(mixer, term, is_input, kctl->id.name, |
6205 |
++ sizeof(kctl->id.name)); |
6206 |
+ kctl->private_free = snd_usb_mixer_elem_free; |
6207 |
+ snd_usb_mixer_add_control(&cval->head, kctl); |
6208 |
+ } |
6209 |
+@@ -3090,6 +3096,7 @@ static int snd_usb_mixer_controls(struct usb_mixer_interface *mixer) |
6210 |
+ if (map->id == state.chip->usb_id) { |
6211 |
+ state.map = map->map; |
6212 |
+ state.selector_map = map->selector_map; |
6213 |
++ mixer->connector_map = map->connector_map; |
6214 |
+ mixer->ignore_ctl_error |= map->ignore_ctl_error; |
6215 |
+ break; |
6216 |
+ } |
6217 |
+@@ -3171,10 +3178,32 @@ static int snd_usb_mixer_controls(struct usb_mixer_interface *mixer) |
6218 |
+ return 0; |
6219 |
+ } |
6220 |
+ |
6221 |
++static int delegate_notify(struct usb_mixer_interface *mixer, int unitid, |
6222 |
++ u8 *control, u8 *channel) |
6223 |
++{ |
6224 |
++ const struct usbmix_connector_map *map = mixer->connector_map; |
6225 |
++ |
6226 |
++ if (!map) |
6227 |
++ return unitid; |
6228 |
++ |
6229 |
++ for (; map->id; map++) { |
6230 |
++ if (map->id == unitid) { |
6231 |
++ if (control && map->control) |
6232 |
++ *control = map->control; |
6233 |
++ if (channel && map->channel) |
6234 |
++ *channel = map->channel; |
6235 |
++ return map->delegated_id; |
6236 |
++ } |
6237 |
++ } |
6238 |
++ return unitid; |
6239 |
++} |
6240 |
++ |
6241 |
+ void snd_usb_mixer_notify_id(struct usb_mixer_interface *mixer, int unitid) |
6242 |
+ { |
6243 |
+ struct usb_mixer_elem_list *list; |
6244 |
+ |
6245 |
++ unitid = delegate_notify(mixer, unitid, NULL, NULL); |
6246 |
++ |
6247 |
+ for_each_mixer_elem(list, mixer, unitid) { |
6248 |
+ struct usb_mixer_elem_info *info = |
6249 |
+ mixer_elem_list_to_info(list); |
6250 |
+@@ -3244,6 +3273,8 @@ static void snd_usb_mixer_interrupt_v2(struct usb_mixer_interface *mixer, |
6251 |
+ return; |
6252 |
+ } |
6253 |
+ |
6254 |
++ unitid = delegate_notify(mixer, unitid, &control, &channel); |
6255 |
++ |
6256 |
+ for_each_mixer_elem(list, mixer, unitid) |
6257 |
+ count++; |
6258 |
+ |
6259 |
+diff --git a/sound/usb/mixer.h b/sound/usb/mixer.h |
6260 |
+index 37e1b234c802..8e0fb7fdf1a0 100644 |
6261 |
+--- a/sound/usb/mixer.h |
6262 |
++++ b/sound/usb/mixer.h |
6263 |
+@@ -6,6 +6,13 @@ |
6264 |
+ |
6265 |
+ struct media_mixer_ctl; |
6266 |
+ |
6267 |
++struct usbmix_connector_map { |
6268 |
++ u8 id; |
6269 |
++ u8 delegated_id; |
6270 |
++ u8 control; |
6271 |
++ u8 channel; |
6272 |
++}; |
6273 |
++ |
6274 |
+ struct usb_mixer_interface { |
6275 |
+ struct snd_usb_audio *chip; |
6276 |
+ struct usb_host_interface *hostif; |
6277 |
+@@ -18,6 +25,9 @@ struct usb_mixer_interface { |
6278 |
+ /* the usb audio specification version this interface complies to */ |
6279 |
+ int protocol; |
6280 |
+ |
6281 |
++ /* optional connector delegation map */ |
6282 |
++ const struct usbmix_connector_map *connector_map; |
6283 |
++ |
6284 |
+ /* Sound Blaster remote control stuff */ |
6285 |
+ const struct rc_config *rc_cfg; |
6286 |
+ u32 rc_code; |
6287 |
+diff --git a/sound/usb/mixer_maps.c b/sound/usb/mixer_maps.c |
6288 |
+index 3a54ca04ec4c..39d6c6fa5e33 100644 |
6289 |
+--- a/sound/usb/mixer_maps.c |
6290 |
++++ b/sound/usb/mixer_maps.c |
6291 |
+@@ -27,6 +27,7 @@ struct usbmix_ctl_map { |
6292 |
+ u32 id; |
6293 |
+ const struct usbmix_name_map *map; |
6294 |
+ const struct usbmix_selector_map *selector_map; |
6295 |
++ const struct usbmix_connector_map *connector_map; |
6296 |
+ int ignore_ctl_error; |
6297 |
+ }; |
6298 |
+ |
6299 |
+@@ -359,6 +360,33 @@ static const struct usbmix_name_map asus_rog_map[] = { |
6300 |
+ {} |
6301 |
+ }; |
6302 |
+ |
6303 |
++/* TRX40 mobos with Realtek ALC1220-VB */ |
6304 |
++static const struct usbmix_name_map trx40_mobo_map[] = { |
6305 |
++ { 18, NULL }, /* OT, IEC958 - broken response, disabled */ |
6306 |
++ { 19, NULL, 12 }, /* FU, Input Gain Pad - broken response, disabled */ |
6307 |
++ { 16, "Speaker" }, /* OT */ |
6308 |
++ { 22, "Speaker Playback" }, /* FU */ |
6309 |
++ { 7, "Line" }, /* IT */ |
6310 |
++ { 19, "Line Capture" }, /* FU */ |
6311 |
++ { 17, "Front Headphone" }, /* OT */ |
6312 |
++ { 23, "Front Headphone Playback" }, /* FU */ |
6313 |
++ { 8, "Mic" }, /* IT */ |
6314 |
++ { 20, "Mic Capture" }, /* FU */ |
6315 |
++ { 9, "Front Mic" }, /* IT */ |
6316 |
++ { 21, "Front Mic Capture" }, /* FU */ |
6317 |
++ { 24, "IEC958 Playback" }, /* FU */ |
6318 |
++ {} |
6319 |
++}; |
6320 |
++ |
6321 |
++static const struct usbmix_connector_map trx40_mobo_connector_map[] = { |
6322 |
++ { 10, 16 }, /* (Back) Speaker */ |
6323 |
++ { 11, 17 }, /* Front Headphone */ |
6324 |
++ { 13, 7 }, /* Line */ |
6325 |
++ { 14, 8 }, /* Mic */ |
6326 |
++ { 15, 9 }, /* Front Mic */ |
6327 |
++ {} |
6328 |
++}; |
6329 |
++ |
6330 |
+ /* |
6331 |
+ * Control map entries |
6332 |
+ */ |
6333 |
+@@ -480,7 +508,8 @@ static struct usbmix_ctl_map usbmix_ctl_maps[] = { |
6334 |
+ }, |
6335 |
+ { /* Gigabyte TRX40 Aorus Pro WiFi */ |
6336 |
+ .id = USB_ID(0x0414, 0xa002), |
6337 |
+- .map = asus_rog_map, |
6338 |
++ .map = trx40_mobo_map, |
6339 |
++ .connector_map = trx40_mobo_connector_map, |
6340 |
+ }, |
6341 |
+ { /* ASUS ROG Zenith II */ |
6342 |
+ .id = USB_ID(0x0b05, 0x1916), |
6343 |
+@@ -492,11 +521,13 @@ static struct usbmix_ctl_map usbmix_ctl_maps[] = { |
6344 |
+ }, |
6345 |
+ { /* MSI TRX40 Creator */ |
6346 |
+ .id = USB_ID(0x0db0, 0x0d64), |
6347 |
+- .map = asus_rog_map, |
6348 |
++ .map = trx40_mobo_map, |
6349 |
++ .connector_map = trx40_mobo_connector_map, |
6350 |
+ }, |
6351 |
+ { /* MSI TRX40 */ |
6352 |
+ .id = USB_ID(0x0db0, 0x543d), |
6353 |
+- .map = asus_rog_map, |
6354 |
++ .map = trx40_mobo_map, |
6355 |
++ .connector_map = trx40_mobo_connector_map, |
6356 |
+ }, |
6357 |
+ { 0 } /* terminator */ |
6358 |
+ }; |
6359 |
+diff --git a/sound/usb/mixer_quirks.c b/sound/usb/mixer_quirks.c |
6360 |
+index 39e27ae6c597..dc181066c799 100644 |
6361 |
+--- a/sound/usb/mixer_quirks.c |
6362 |
++++ b/sound/usb/mixer_quirks.c |
6363 |
+@@ -1508,11 +1508,15 @@ static int snd_microii_spdif_default_get(struct snd_kcontrol *kcontrol, |
6364 |
+ |
6365 |
+ /* use known values for that card: interface#1 altsetting#1 */ |
6366 |
+ iface = usb_ifnum_to_if(chip->dev, 1); |
6367 |
+- if (!iface || iface->num_altsetting < 2) |
6368 |
+- return -EINVAL; |
6369 |
++ if (!iface || iface->num_altsetting < 2) { |
6370 |
++ err = -EINVAL; |
6371 |
++ goto end; |
6372 |
++ } |
6373 |
+ alts = &iface->altsetting[1]; |
6374 |
+- if (get_iface_desc(alts)->bNumEndpoints < 1) |
6375 |
+- return -EINVAL; |
6376 |
++ if (get_iface_desc(alts)->bNumEndpoints < 1) { |
6377 |
++ err = -EINVAL; |
6378 |
++ goto end; |
6379 |
++ } |
6380 |
+ ep = get_endpoint(alts, 0)->bEndpointAddress; |
6381 |
+ |
6382 |
+ err = snd_usb_ctl_msg(chip->dev, |
6383 |
+diff --git a/sound/usb/quirks-table.h b/sound/usb/quirks-table.h |
6384 |
+index d187aa6d50db..8c2f5c23e1b4 100644 |
6385 |
+--- a/sound/usb/quirks-table.h |
6386 |
++++ b/sound/usb/quirks-table.h |
6387 |
+@@ -3592,5 +3592,61 @@ AU0828_DEVICE(0x2040, 0x7270, "Hauppauge", "HVR-950Q"), |
6388 |
+ } |
6389 |
+ } |
6390 |
+ }, |
6391 |
++{ |
6392 |
++ /* |
6393 |
++ * Pioneer DJ DJM-250MK2 |
6394 |
++ * PCM is 8 channels out @ 48 fixed (endpoints 0x01). |
6395 |
++ * The output from computer to the mixer is usable. |
6396 |
++ * |
6397 |
++ * The input (phono or line to computer) is not working. |
6398 |
++ * It should be at endpoint 0x82 and probably also 8 channels, |
6399 |
++ * but it seems that it works only with Pioneer proprietary software. |
6400 |
++ * Even on officially supported OS, the Audacity was unable to record |
6401 |
++ * and Mixxx to recognize the control vinyls. |
6402 |
++ */ |
6403 |
++ USB_DEVICE_VENDOR_SPEC(0x2b73, 0x0017), |
6404 |
++ .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) { |
6405 |
++ .ifnum = QUIRK_ANY_INTERFACE, |
6406 |
++ .type = QUIRK_COMPOSITE, |
6407 |
++ .data = (const struct snd_usb_audio_quirk[]) { |
6408 |
++ { |
6409 |
++ .ifnum = 0, |
6410 |
++ .type = QUIRK_AUDIO_FIXED_ENDPOINT, |
6411 |
++ .data = &(const struct audioformat) { |
6412 |
++ .formats = SNDRV_PCM_FMTBIT_S24_3LE, |
6413 |
++ .channels = 8, // outputs |
6414 |
++ .iface = 0, |
6415 |
++ .altsetting = 1, |
6416 |
++ .altset_idx = 1, |
6417 |
++ .endpoint = 0x01, |
6418 |
++ .ep_attr = USB_ENDPOINT_XFER_ISOC| |
6419 |
++ USB_ENDPOINT_SYNC_ASYNC, |
6420 |
++ .rates = SNDRV_PCM_RATE_48000, |
6421 |
++ .rate_min = 48000, |
6422 |
++ .rate_max = 48000, |
6423 |
++ .nr_rates = 1, |
6424 |
++ .rate_table = (unsigned int[]) { 48000 } |
6425 |
++ } |
6426 |
++ }, |
6427 |
++ { |
6428 |
++ .ifnum = -1 |
6429 |
++ } |
6430 |
++ } |
6431 |
++ } |
6432 |
++}, |
6433 |
++ |
6434 |
++#define ALC1220_VB_DESKTOP(vend, prod) { \ |
6435 |
++ USB_DEVICE(vend, prod), \ |
6436 |
++ .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { \ |
6437 |
++ .vendor_name = "Realtek", \ |
6438 |
++ .product_name = "ALC1220-VB-DT", \ |
6439 |
++ .profile_name = "Realtek-ALC1220-VB-Desktop", \ |
6440 |
++ .ifnum = QUIRK_NO_INTERFACE \ |
6441 |
++ } \ |
6442 |
++} |
6443 |
++ALC1220_VB_DESKTOP(0x0414, 0xa002), /* Gigabyte TRX40 Aorus Pro WiFi */ |
6444 |
++ALC1220_VB_DESKTOP(0x0db0, 0x0d64), /* MSI TRX40 Creator */ |
6445 |
++ALC1220_VB_DESKTOP(0x0db0, 0x543d), /* MSI TRX40 */ |
6446 |
++#undef ALC1220_VB_DESKTOP |
6447 |
+ |
6448 |
+ #undef USB_DEVICE_VENDOR_SPEC |
6449 |
+diff --git a/sound/usb/usx2y/usbusx2yaudio.c b/sound/usb/usx2y/usbusx2yaudio.c |
6450 |
+index 89fa287678fc..e0bace4d1c40 100644 |
6451 |
+--- a/sound/usb/usx2y/usbusx2yaudio.c |
6452 |
++++ b/sound/usb/usx2y/usbusx2yaudio.c |
6453 |
+@@ -681,6 +681,8 @@ static int usX2Y_rate_set(struct usX2Ydev *usX2Y, int rate) |
6454 |
+ us->submitted = 2*NOOF_SETRATE_URBS; |
6455 |
+ for (i = 0; i < NOOF_SETRATE_URBS; ++i) { |
6456 |
+ struct urb *urb = us->urb[i]; |
6457 |
++ if (!urb) |
6458 |
++ continue; |
6459 |
+ if (urb->status) { |
6460 |
+ if (!err) |
6461 |
+ err = -ENODEV; |
6462 |
+diff --git a/tools/lib/bpf/Makefile b/tools/lib/bpf/Makefile |
6463 |
+index 33e2638ef7f0..122321d54922 100644 |
6464 |
+--- a/tools/lib/bpf/Makefile |
6465 |
++++ b/tools/lib/bpf/Makefile |
6466 |
+@@ -145,7 +145,7 @@ PC_FILE := $(addprefix $(OUTPUT),$(PC_FILE)) |
6467 |
+ |
6468 |
+ GLOBAL_SYM_COUNT = $(shell readelf -s --wide $(BPF_IN_SHARED) | \ |
6469 |
+ cut -d "@" -f1 | sed 's/_v[0-9]_[0-9]_[0-9].*//' | \ |
6470 |
+- awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$8}' | \ |
6471 |
++ awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$NF}' | \ |
6472 |
+ sort -u | wc -l) |
6473 |
+ VERSIONED_SYM_COUNT = $(shell readelf -s --wide $(OUTPUT)libbpf.so | \ |
6474 |
+ grep -Eo '[^ ]+@LIBBPF_' | cut -d@ -f1 | sort -u | wc -l) |
6475 |
+@@ -217,7 +217,7 @@ check_abi: $(OUTPUT)libbpf.so |
6476 |
+ "versioned in $(VERSION_SCRIPT)." >&2; \ |
6477 |
+ readelf -s --wide $(BPF_IN_SHARED) | \ |
6478 |
+ cut -d "@" -f1 | sed 's/_v[0-9]_[0-9]_[0-9].*//' | \ |
6479 |
+- awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$8}'| \ |
6480 |
++ awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$NF}'| \ |
6481 |
+ sort -u > $(OUTPUT)libbpf_global_syms.tmp; \ |
6482 |
+ readelf -s --wide $(OUTPUT)libbpf.so | \ |
6483 |
+ grep -Eo '[^ ]+@LIBBPF_' | cut -d@ -f1 | \ |
6484 |
+diff --git a/tools/testing/nvdimm/Kbuild b/tools/testing/nvdimm/Kbuild |
6485 |
+index c4a9196d794c..cb80d3b81179 100644 |
6486 |
+--- a/tools/testing/nvdimm/Kbuild |
6487 |
++++ b/tools/testing/nvdimm/Kbuild |
6488 |
+@@ -21,8 +21,8 @@ DRIVERS := ../../../drivers |
6489 |
+ NVDIMM_SRC := $(DRIVERS)/nvdimm |
6490 |
+ ACPI_SRC := $(DRIVERS)/acpi/nfit |
6491 |
+ DAX_SRC := $(DRIVERS)/dax |
6492 |
+-ccflags-y := -I$(src)/$(NVDIMM_SRC)/ |
6493 |
+-ccflags-y += -I$(src)/$(ACPI_SRC)/ |
6494 |
++ccflags-y := -I$(srctree)/drivers/nvdimm/ |
6495 |
++ccflags-y += -I$(srctree)/drivers/acpi/nfit/ |
6496 |
+ |
6497 |
+ obj-$(CONFIG_LIBNVDIMM) += libnvdimm.o |
6498 |
+ obj-$(CONFIG_BLK_DEV_PMEM) += nd_pmem.o |
6499 |
+diff --git a/tools/testing/nvdimm/test/Kbuild b/tools/testing/nvdimm/test/Kbuild |
6500 |
+index fb3c3d7cdb9b..75baebf8f4ba 100644 |
6501 |
+--- a/tools/testing/nvdimm/test/Kbuild |
6502 |
++++ b/tools/testing/nvdimm/test/Kbuild |
6503 |
+@@ -1,6 +1,6 @@ |
6504 |
+ # SPDX-License-Identifier: GPL-2.0 |
6505 |
+-ccflags-y := -I$(src)/../../../../drivers/nvdimm/ |
6506 |
+-ccflags-y += -I$(src)/../../../../drivers/acpi/nfit/ |
6507 |
++ccflags-y := -I$(srctree)/drivers/nvdimm/ |
6508 |
++ccflags-y += -I$(srctree)/drivers/acpi/nfit/ |
6509 |
+ |
6510 |
+ obj-m += nfit_test.o |
6511 |
+ obj-m += nfit_test_iomap.o |
6512 |
+diff --git a/tools/testing/nvdimm/test/nfit.c b/tools/testing/nvdimm/test/nfit.c |
6513 |
+index bf6422a6af7f..a8ee5c4d41eb 100644 |
6514 |
+--- a/tools/testing/nvdimm/test/nfit.c |
6515 |
++++ b/tools/testing/nvdimm/test/nfit.c |
6516 |
+@@ -3164,7 +3164,9 @@ static __init int nfit_test_init(void) |
6517 |
+ mcsafe_test(); |
6518 |
+ dax_pmem_test(); |
6519 |
+ dax_pmem_core_test(); |
6520 |
++#ifdef CONFIG_DEV_DAX_PMEM_COMPAT |
6521 |
+ dax_pmem_compat_test(); |
6522 |
++#endif |
6523 |
+ |
6524 |
+ nfit_test_setup(nfit_test_lookup, nfit_test_evaluate_dsm); |
6525 |
+ |
6526 |
+diff --git a/tools/testing/selftests/ftrace/settings b/tools/testing/selftests/ftrace/settings |
6527 |
+new file mode 100644 |
6528 |
+index 000000000000..e7b9417537fb |
6529 |
+--- /dev/null |
6530 |
++++ b/tools/testing/selftests/ftrace/settings |
6531 |
+@@ -0,0 +1 @@ |
6532 |
++timeout=0 |
6533 |
+diff --git a/tools/testing/selftests/kmod/kmod.sh b/tools/testing/selftests/kmod/kmod.sh |
6534 |
+index 8b944cf042f6..315a43111e04 100755 |
6535 |
+--- a/tools/testing/selftests/kmod/kmod.sh |
6536 |
++++ b/tools/testing/selftests/kmod/kmod.sh |
6537 |
+@@ -505,18 +505,23 @@ function test_num() |
6538 |
+ fi |
6539 |
+ } |
6540 |
+ |
6541 |
+-function get_test_count() |
6542 |
++function get_test_data() |
6543 |
+ { |
6544 |
+ test_num $1 |
6545 |
+- TEST_DATA=$(echo $ALL_TESTS | awk '{print $'$1'}') |
6546 |
++ local field_num=$(echo $1 | sed 's/^0*//') |
6547 |
++ echo $ALL_TESTS | awk '{print $'$field_num'}' |
6548 |
++} |
6549 |
++ |
6550 |
++function get_test_count() |
6551 |
++{ |
6552 |
++ TEST_DATA=$(get_test_data $1) |
6553 |
+ LAST_TWO=${TEST_DATA#*:*} |
6554 |
+ echo ${LAST_TWO%:*} |
6555 |
+ } |
6556 |
+ |
6557 |
+ function get_test_enabled() |
6558 |
+ { |
6559 |
+- test_num $1 |
6560 |
+- TEST_DATA=$(echo $ALL_TESTS | awk '{print $'$1'}') |
6561 |
++ TEST_DATA=$(get_test_data $1) |
6562 |
+ echo ${TEST_DATA#*:*:} |
6563 |
+ } |
6564 |
+ |
6565 |
+diff --git a/tools/testing/selftests/net/fib_nexthops.sh b/tools/testing/selftests/net/fib_nexthops.sh |
6566 |
+index 796670ebc65b..6560ed796ac4 100755 |
6567 |
+--- a/tools/testing/selftests/net/fib_nexthops.sh |
6568 |
++++ b/tools/testing/selftests/net/fib_nexthops.sh |
6569 |
+@@ -749,6 +749,29 @@ ipv4_fcnal_runtime() |
6570 |
+ run_cmd "ip netns exec me ping -c1 -w1 172.16.101.1" |
6571 |
+ log_test $? 0 "Ping - multipath" |
6572 |
+ |
6573 |
++ run_cmd "$IP ro delete 172.16.101.1/32 nhid 122" |
6574 |
++ |
6575 |
++ # |
6576 |
++ # multiple default routes |
6577 |
++ # - tests fib_select_default |
6578 |
++ run_cmd "$IP nexthop add id 501 via 172.16.1.2 dev veth1" |
6579 |
++ run_cmd "$IP ro add default nhid 501" |
6580 |
++ run_cmd "$IP ro add default via 172.16.1.3 dev veth1 metric 20" |
6581 |
++ run_cmd "ip netns exec me ping -c1 -w1 172.16.101.1" |
6582 |
++ log_test $? 0 "Ping - multiple default routes, nh first" |
6583 |
++ |
6584 |
++ # flip the order |
6585 |
++ run_cmd "$IP ro del default nhid 501" |
6586 |
++ run_cmd "$IP ro del default via 172.16.1.3 dev veth1 metric 20" |
6587 |
++ run_cmd "$IP ro add default via 172.16.1.2 dev veth1 metric 20" |
6588 |
++ run_cmd "$IP nexthop replace id 501 via 172.16.1.3 dev veth1" |
6589 |
++ run_cmd "$IP ro add default nhid 501 metric 20" |
6590 |
++ run_cmd "ip netns exec me ping -c1 -w1 172.16.101.1" |
6591 |
++ log_test $? 0 "Ping - multiple default routes, nh second" |
6592 |
++ |
6593 |
++ run_cmd "$IP nexthop delete nhid 501" |
6594 |
++ run_cmd "$IP ro del default" |
6595 |
++ |
6596 |
+ # |
6597 |
+ # IPv4 with blackhole nexthops |
6598 |
+ # |
6599 |
+diff --git a/tools/testing/selftests/net/fib_tests.sh b/tools/testing/selftests/net/fib_tests.sh |
6600 |
+index 09854f8a0b57..4811067d9b05 100755 |
6601 |
+--- a/tools/testing/selftests/net/fib_tests.sh |
6602 |
++++ b/tools/testing/selftests/net/fib_tests.sh |
6603 |
+@@ -618,16 +618,22 @@ fib_nexthop_test() |
6604 |
+ |
6605 |
+ fib_suppress_test() |
6606 |
+ { |
6607 |
++ echo |
6608 |
++ echo "FIB rule with suppress_prefixlength" |
6609 |
++ setup |
6610 |
++ |
6611 |
+ $IP link add dummy1 type dummy |
6612 |
+ $IP link set dummy1 up |
6613 |
+ $IP -6 route add default dev dummy1 |
6614 |
+ $IP -6 rule add table main suppress_prefixlength 0 |
6615 |
+- ping -f -c 1000 -W 1 1234::1 || true |
6616 |
++ ping -f -c 1000 -W 1 1234::1 >/dev/null 2>&1 |
6617 |
+ $IP -6 rule del table main suppress_prefixlength 0 |
6618 |
+ $IP link del dummy1 |
6619 |
+ |
6620 |
+ # If we got here without crashing, we're good. |
6621 |
+- return 0 |
6622 |
++ log_test 0 0 "FIB rule suppress test" |
6623 |
++ |
6624 |
++ cleanup |
6625 |
+ } |
6626 |
+ |
6627 |
+ ################################################################################ |
6628 |
+diff --git a/tools/vm/Makefile b/tools/vm/Makefile |
6629 |
+index 20f6cf04377f..9860622cbb15 100644 |
6630 |
+--- a/tools/vm/Makefile |
6631 |
++++ b/tools/vm/Makefile |
6632 |
+@@ -1,6 +1,8 @@ |
6633 |
+ # SPDX-License-Identifier: GPL-2.0 |
6634 |
+ # Makefile for vm tools |
6635 |
+ # |
6636 |
++include ../scripts/Makefile.include |
6637 |
++ |
6638 |
+ TARGETS=page-types slabinfo page_owner_sort |
6639 |
+ |
6640 |
+ LIB_DIR = ../lib/api |