1 |
commit: 1afed3922ac69562f80953411229a056c6950431 |
2 |
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Jul 28 12:36:11 2021 +0000 |
4 |
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Jul 28 12:36:11 2021 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=1afed392 |
7 |
|
8 |
Linux patch 5.4.136 |
9 |
|
10 |
Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org> |
11 |
|
12 |
0000_README | 4 + |
13 |
1135_linux-5.4.136.patch | 3619 ++++++++++++++++++++++++++++++++++++++++++++++ |
14 |
2 files changed, 3623 insertions(+) |
15 |
|
16 |
diff --git a/0000_README b/0000_README |
17 |
index 912b46e..a760b64 100644 |
18 |
--- a/0000_README |
19 |
+++ b/0000_README |
20 |
@@ -583,6 +583,10 @@ Patch: 1134_linux-5.4.135.patch |
21 |
From: http://www.kernel.org |
22 |
Desc: Linux 5.4.135 |
23 |
|
24 |
+Patch: 1135_linux-5.4.136.patch |
25 |
+From: http://www.kernel.org |
26 |
+Desc: Linux 5.4.136 |
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/1135_linux-5.4.136.patch b/1135_linux-5.4.136.patch |
33 |
new file mode 100644 |
34 |
index 0000000..eaadbf1 |
35 |
--- /dev/null |
36 |
+++ b/1135_linux-5.4.136.patch |
37 |
@@ -0,0 +1,3619 @@ |
38 |
+diff --git a/Documentation/arm64/tagged-address-abi.rst b/Documentation/arm64/tagged-address-abi.rst |
39 |
+index 4a9d9c794ee5d..7d255249094d0 100644 |
40 |
+--- a/Documentation/arm64/tagged-address-abi.rst |
41 |
++++ b/Documentation/arm64/tagged-address-abi.rst |
42 |
+@@ -45,14 +45,24 @@ how the user addresses are used by the kernel: |
43 |
+ |
44 |
+ 1. User addresses not accessed by the kernel but used for address space |
45 |
+ management (e.g. ``mprotect()``, ``madvise()``). The use of valid |
46 |
+- tagged pointers in this context is allowed with the exception of |
47 |
+- ``brk()``, ``mmap()`` and the ``new_address`` argument to |
48 |
+- ``mremap()`` as these have the potential to alias with existing |
49 |
+- user addresses. |
50 |
+- |
51 |
+- NOTE: This behaviour changed in v5.6 and so some earlier kernels may |
52 |
+- incorrectly accept valid tagged pointers for the ``brk()``, |
53 |
+- ``mmap()`` and ``mremap()`` system calls. |
54 |
++ tagged pointers in this context is allowed with these exceptions: |
55 |
++ |
56 |
++ - ``brk()``, ``mmap()`` and the ``new_address`` argument to |
57 |
++ ``mremap()`` as these have the potential to alias with existing |
58 |
++ user addresses. |
59 |
++ |
60 |
++ NOTE: This behaviour changed in v5.6 and so some earlier kernels may |
61 |
++ incorrectly accept valid tagged pointers for the ``brk()``, |
62 |
++ ``mmap()`` and ``mremap()`` system calls. |
63 |
++ |
64 |
++ - The ``range.start``, ``start`` and ``dst`` arguments to the |
65 |
++ ``UFFDIO_*`` ``ioctl()``s used on a file descriptor obtained from |
66 |
++ ``userfaultfd()``, as fault addresses subsequently obtained by reading |
67 |
++ the file descriptor will be untagged, which may otherwise confuse |
68 |
++ tag-unaware programs. |
69 |
++ |
70 |
++ NOTE: This behaviour changed in v5.14 and so some earlier kernels may |
71 |
++ incorrectly accept valid tagged pointers for this system call. |
72 |
+ |
73 |
+ 2. User addresses accessed by the kernel (e.g. ``write()``). This ABI |
74 |
+ relaxation is disabled by default and the application thread needs to |
75 |
+diff --git a/Documentation/trace/histogram.rst b/Documentation/trace/histogram.rst |
76 |
+index 8408670d03282..3f3d1b960fe79 100644 |
77 |
+--- a/Documentation/trace/histogram.rst |
78 |
++++ b/Documentation/trace/histogram.rst |
79 |
+@@ -191,7 +191,7 @@ Documentation written by Tom Zanussi |
80 |
+ with the event, in nanoseconds. May be |
81 |
+ modified by .usecs to have timestamps |
82 |
+ interpreted as microseconds. |
83 |
+- cpu int the cpu on which the event occurred. |
84 |
++ common_cpu int the cpu on which the event occurred. |
85 |
+ ====================== ==== ======================================= |
86 |
+ |
87 |
+ Extended error information |
88 |
+diff --git a/Makefile b/Makefile |
89 |
+index 428ebbd039967..1c565572bfb24 100644 |
90 |
+--- a/Makefile |
91 |
++++ b/Makefile |
92 |
+@@ -1,7 +1,7 @@ |
93 |
+ # SPDX-License-Identifier: GPL-2.0 |
94 |
+ VERSION = 5 |
95 |
+ PATCHLEVEL = 4 |
96 |
+-SUBLEVEL = 135 |
97 |
++SUBLEVEL = 136 |
98 |
+ EXTRAVERSION = |
99 |
+ NAME = Kleptomaniac Octopus |
100 |
+ |
101 |
+diff --git a/arch/mips/include/asm/pgalloc.h b/arch/mips/include/asm/pgalloc.h |
102 |
+index dd10854321cac..166842337eb2c 100644 |
103 |
+--- a/arch/mips/include/asm/pgalloc.h |
104 |
++++ b/arch/mips/include/asm/pgalloc.h |
105 |
+@@ -62,15 +62,11 @@ do { \ |
106 |
+ |
107 |
+ static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address) |
108 |
+ { |
109 |
+- pmd_t *pmd = NULL; |
110 |
+- struct page *pg; |
111 |
++ pmd_t *pmd; |
112 |
+ |
113 |
+- pg = alloc_pages(GFP_KERNEL | __GFP_ACCOUNT, PMD_ORDER); |
114 |
+- if (pg) { |
115 |
+- pgtable_pmd_page_ctor(pg); |
116 |
+- pmd = (pmd_t *)page_address(pg); |
117 |
++ pmd = (pmd_t *) __get_free_pages(GFP_KERNEL, PMD_ORDER); |
118 |
++ if (pmd) |
119 |
+ pmd_init((unsigned long)pmd, (unsigned long)invalid_pte_table); |
120 |
+- } |
121 |
+ return pmd; |
122 |
+ } |
123 |
+ |
124 |
+diff --git a/arch/nds32/mm/mmap.c b/arch/nds32/mm/mmap.c |
125 |
+index c206b31ce07ac..1bdf5e7d1b438 100644 |
126 |
+--- a/arch/nds32/mm/mmap.c |
127 |
++++ b/arch/nds32/mm/mmap.c |
128 |
+@@ -59,7 +59,7 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr, |
129 |
+ |
130 |
+ vma = find_vma(mm, addr); |
131 |
+ if (TASK_SIZE - len >= addr && |
132 |
+- (!vma || addr + len <= vma->vm_start)) |
133 |
++ (!vma || addr + len <= vm_start_gap(vma))) |
134 |
+ return addr; |
135 |
+ } |
136 |
+ |
137 |
+diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c |
138 |
+index 9011857c0434d..bba358f134718 100644 |
139 |
+--- a/arch/powerpc/kvm/book3s_hv.c |
140 |
++++ b/arch/powerpc/kvm/book3s_hv.c |
141 |
+@@ -2306,8 +2306,10 @@ static struct kvm_vcpu *kvmppc_core_vcpu_create_hv(struct kvm *kvm, |
142 |
+ HFSCR_DSCR | HFSCR_VECVSX | HFSCR_FP; |
143 |
+ if (cpu_has_feature(CPU_FTR_HVMODE)) { |
144 |
+ vcpu->arch.hfscr &= mfspr(SPRN_HFSCR); |
145 |
++#ifdef CONFIG_PPC_TRANSACTIONAL_MEM |
146 |
+ if (cpu_has_feature(CPU_FTR_P9_TM_HV_ASSIST)) |
147 |
+ vcpu->arch.hfscr |= HFSCR_TM; |
148 |
++#endif |
149 |
+ } |
150 |
+ if (cpu_has_feature(CPU_FTR_TM_COMP)) |
151 |
+ vcpu->arch.hfscr |= HFSCR_TM; |
152 |
+diff --git a/arch/powerpc/kvm/book3s_hv_nested.c b/arch/powerpc/kvm/book3s_hv_nested.c |
153 |
+index 66fa2c7590aa0..9906d203d9d39 100644 |
154 |
+--- a/arch/powerpc/kvm/book3s_hv_nested.c |
155 |
++++ b/arch/powerpc/kvm/book3s_hv_nested.c |
156 |
+@@ -232,6 +232,9 @@ long kvmhv_enter_nested_guest(struct kvm_vcpu *vcpu) |
157 |
+ if (vcpu->kvm->arch.l1_ptcr == 0) |
158 |
+ return H_NOT_AVAILABLE; |
159 |
+ |
160 |
++ if (MSR_TM_TRANSACTIONAL(vcpu->arch.shregs.msr)) |
161 |
++ return H_BAD_MODE; |
162 |
++ |
163 |
+ /* copy parameters in */ |
164 |
+ hv_ptr = kvmppc_get_gpr(vcpu, 4); |
165 |
+ err = kvm_vcpu_read_guest(vcpu, hv_ptr, &l2_hv, |
166 |
+@@ -253,6 +256,23 @@ long kvmhv_enter_nested_guest(struct kvm_vcpu *vcpu) |
167 |
+ if (l2_hv.vcpu_token >= NR_CPUS) |
168 |
+ return H_PARAMETER; |
169 |
+ |
170 |
++ /* |
171 |
++ * L1 must have set up a suspended state to enter the L2 in a |
172 |
++ * transactional state, and only in that case. These have to be |
173 |
++ * filtered out here to prevent causing a TM Bad Thing in the |
174 |
++ * host HRFID. We could synthesize a TM Bad Thing back to the L1 |
175 |
++ * here but there doesn't seem like much point. |
176 |
++ */ |
177 |
++ if (MSR_TM_SUSPENDED(vcpu->arch.shregs.msr)) { |
178 |
++ if (!MSR_TM_ACTIVE(l2_regs.msr)) |
179 |
++ return H_BAD_MODE; |
180 |
++ } else { |
181 |
++ if (l2_regs.msr & MSR_TS_MASK) |
182 |
++ return H_BAD_MODE; |
183 |
++ if (WARN_ON_ONCE(vcpu->arch.shregs.msr & MSR_TS_MASK)) |
184 |
++ return H_BAD_MODE; |
185 |
++ } |
186 |
++ |
187 |
+ /* translate lpid */ |
188 |
+ l2 = kvmhv_get_nested(vcpu->kvm, l2_hv.lpid, true); |
189 |
+ if (!l2) |
190 |
+diff --git a/arch/powerpc/kvm/book3s_rtas.c b/arch/powerpc/kvm/book3s_rtas.c |
191 |
+index 26b25994c9697..41137ec727622 100644 |
192 |
+--- a/arch/powerpc/kvm/book3s_rtas.c |
193 |
++++ b/arch/powerpc/kvm/book3s_rtas.c |
194 |
+@@ -240,6 +240,17 @@ int kvmppc_rtas_hcall(struct kvm_vcpu *vcpu) |
195 |
+ * value so we can restore it on the way out. |
196 |
+ */ |
197 |
+ orig_rets = args.rets; |
198 |
++ if (be32_to_cpu(args.nargs) >= ARRAY_SIZE(args.args)) { |
199 |
++ /* |
200 |
++ * Don't overflow our args array: ensure there is room for |
201 |
++ * at least rets[0] (even if the call specifies 0 nret). |
202 |
++ * |
203 |
++ * Each handler must then check for the correct nargs and nret |
204 |
++ * values, but they may always return failure in rets[0]. |
205 |
++ */ |
206 |
++ rc = -EINVAL; |
207 |
++ goto fail; |
208 |
++ } |
209 |
+ args.rets = &args.args[be32_to_cpu(args.nargs)]; |
210 |
+ |
211 |
+ mutex_lock(&vcpu->kvm->arch.rtas_token_lock); |
212 |
+@@ -267,9 +278,17 @@ int kvmppc_rtas_hcall(struct kvm_vcpu *vcpu) |
213 |
+ fail: |
214 |
+ /* |
215 |
+ * We only get here if the guest has called RTAS with a bogus |
216 |
+- * args pointer. That means we can't get to the args, and so we |
217 |
+- * can't fail the RTAS call. So fail right out to userspace, |
218 |
+- * which should kill the guest. |
219 |
++ * args pointer or nargs/nret values that would overflow the |
220 |
++ * array. That means we can't get to the args, and so we can't |
221 |
++ * fail the RTAS call. So fail right out to userspace, which |
222 |
++ * should kill the guest. |
223 |
++ * |
224 |
++ * SLOF should actually pass the hcall return value from the |
225 |
++ * rtas handler call in r3, so enter_rtas could be modified to |
226 |
++ * return a failure indication in r3 and we could return such |
227 |
++ * errors to the guest rather than failing to host userspace. |
228 |
++ * However old guests that don't test for failure could then |
229 |
++ * continue silently after errors, so for now we won't do this. |
230 |
+ */ |
231 |
+ return rc; |
232 |
+ } |
233 |
+diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c |
234 |
+index e03c064716789..8dd4d2b83677b 100644 |
235 |
+--- a/arch/powerpc/kvm/powerpc.c |
236 |
++++ b/arch/powerpc/kvm/powerpc.c |
237 |
+@@ -2035,9 +2035,9 @@ long kvm_arch_vcpu_ioctl(struct file *filp, |
238 |
+ { |
239 |
+ struct kvm_enable_cap cap; |
240 |
+ r = -EFAULT; |
241 |
+- vcpu_load(vcpu); |
242 |
+ if (copy_from_user(&cap, argp, sizeof(cap))) |
243 |
+ goto out; |
244 |
++ vcpu_load(vcpu); |
245 |
+ r = kvm_vcpu_ioctl_enable_cap(vcpu, &cap); |
246 |
+ vcpu_put(vcpu); |
247 |
+ break; |
248 |
+@@ -2061,9 +2061,9 @@ long kvm_arch_vcpu_ioctl(struct file *filp, |
249 |
+ case KVM_DIRTY_TLB: { |
250 |
+ struct kvm_dirty_tlb dirty; |
251 |
+ r = -EFAULT; |
252 |
+- vcpu_load(vcpu); |
253 |
+ if (copy_from_user(&dirty, argp, sizeof(dirty))) |
254 |
+ goto out; |
255 |
++ vcpu_load(vcpu); |
256 |
+ r = kvm_vcpu_ioctl_dirty_tlb(vcpu, &dirty); |
257 |
+ vcpu_put(vcpu); |
258 |
+ break; |
259 |
+diff --git a/arch/s390/boot/text_dma.S b/arch/s390/boot/text_dma.S |
260 |
+index 9715715c4c28d..ea93314f44976 100644 |
261 |
+--- a/arch/s390/boot/text_dma.S |
262 |
++++ b/arch/s390/boot/text_dma.S |
263 |
+@@ -9,16 +9,6 @@ |
264 |
+ #include <asm/errno.h> |
265 |
+ #include <asm/sigp.h> |
266 |
+ |
267 |
+-#ifdef CC_USING_EXPOLINE |
268 |
+- .pushsection .dma.text.__s390_indirect_jump_r14,"axG" |
269 |
+-__dma__s390_indirect_jump_r14: |
270 |
+- larl %r1,0f |
271 |
+- ex 0,0(%r1) |
272 |
+- j . |
273 |
+-0: br %r14 |
274 |
+- .popsection |
275 |
+-#endif |
276 |
+- |
277 |
+ .section .dma.text,"ax" |
278 |
+ /* |
279 |
+ * Simplified version of expoline thunk. The normal thunks can not be used here, |
280 |
+@@ -27,11 +17,10 @@ __dma__s390_indirect_jump_r14: |
281 |
+ * affects a few functions that are not performance-relevant. |
282 |
+ */ |
283 |
+ .macro BR_EX_DMA_r14 |
284 |
+-#ifdef CC_USING_EXPOLINE |
285 |
+- jg __dma__s390_indirect_jump_r14 |
286 |
+-#else |
287 |
+- br %r14 |
288 |
+-#endif |
289 |
++ larl %r1,0f |
290 |
++ ex 0,0(%r1) |
291 |
++ j . |
292 |
++0: br %r14 |
293 |
+ .endm |
294 |
+ |
295 |
+ /* |
296 |
+diff --git a/arch/s390/include/asm/ftrace.h b/arch/s390/include/asm/ftrace.h |
297 |
+index 68d362f8d6c17..c72c179a5aae9 100644 |
298 |
+--- a/arch/s390/include/asm/ftrace.h |
299 |
++++ b/arch/s390/include/asm/ftrace.h |
300 |
+@@ -27,6 +27,7 @@ void ftrace_caller(void); |
301 |
+ |
302 |
+ extern char ftrace_graph_caller_end; |
303 |
+ extern unsigned long ftrace_plt; |
304 |
++extern void *ftrace_func; |
305 |
+ |
306 |
+ struct dyn_arch_ftrace { }; |
307 |
+ |
308 |
+diff --git a/arch/s390/kernel/ftrace.c b/arch/s390/kernel/ftrace.c |
309 |
+index 1bb85f60c0dd5..7df6b2642ddb0 100644 |
310 |
+--- a/arch/s390/kernel/ftrace.c |
311 |
++++ b/arch/s390/kernel/ftrace.c |
312 |
+@@ -57,6 +57,7 @@ |
313 |
+ * > brasl %r0,ftrace_caller # offset 0 |
314 |
+ */ |
315 |
+ |
316 |
++void *ftrace_func __read_mostly = ftrace_stub; |
317 |
+ unsigned long ftrace_plt; |
318 |
+ |
319 |
+ static inline void ftrace_generate_orig_insn(struct ftrace_insn *insn) |
320 |
+@@ -166,6 +167,7 @@ int ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr) |
321 |
+ |
322 |
+ int ftrace_update_ftrace_func(ftrace_func_t func) |
323 |
+ { |
324 |
++ ftrace_func = func; |
325 |
+ return 0; |
326 |
+ } |
327 |
+ |
328 |
+diff --git a/arch/s390/kernel/mcount.S b/arch/s390/kernel/mcount.S |
329 |
+index f942341429b1c..14bad577f5351 100644 |
330 |
+--- a/arch/s390/kernel/mcount.S |
331 |
++++ b/arch/s390/kernel/mcount.S |
332 |
+@@ -61,13 +61,13 @@ ENTRY(ftrace_caller) |
333 |
+ #ifdef CONFIG_HAVE_MARCH_Z196_FEATURES |
334 |
+ aghik %r2,%r0,-MCOUNT_INSN_SIZE |
335 |
+ lgrl %r4,function_trace_op |
336 |
+- lgrl %r1,ftrace_trace_function |
337 |
++ lgrl %r1,ftrace_func |
338 |
+ #else |
339 |
+ lgr %r2,%r0 |
340 |
+ aghi %r2,-MCOUNT_INSN_SIZE |
341 |
+ larl %r4,function_trace_op |
342 |
+ lg %r4,0(%r4) |
343 |
+- larl %r1,ftrace_trace_function |
344 |
++ larl %r1,ftrace_func |
345 |
+ lg %r1,0(%r1) |
346 |
+ #endif |
347 |
+ lgr %r3,%r14 |
348 |
+diff --git a/arch/s390/net/bpf_jit_comp.c b/arch/s390/net/bpf_jit_comp.c |
349 |
+index c8c16b5eed6be..e160f4650f8e4 100644 |
350 |
+--- a/arch/s390/net/bpf_jit_comp.c |
351 |
++++ b/arch/s390/net/bpf_jit_comp.c |
352 |
+@@ -114,7 +114,7 @@ static inline void reg_set_seen(struct bpf_jit *jit, u32 b1) |
353 |
+ { |
354 |
+ u32 r1 = reg2hex[b1]; |
355 |
+ |
356 |
+- if (!jit->seen_reg[r1] && r1 >= 6 && r1 <= 15) |
357 |
++ if (r1 >= 6 && r1 <= 15 && !jit->seen_reg[r1]) |
358 |
+ jit->seen_reg[r1] = 1; |
359 |
+ } |
360 |
+ |
361 |
+diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c |
362 |
+index bf2f0373a3b2f..55745d6953f02 100644 |
363 |
+--- a/drivers/block/rbd.c |
364 |
++++ b/drivers/block/rbd.c |
365 |
+@@ -4239,8 +4239,6 @@ again: |
366 |
+ |
367 |
+ static bool rbd_quiesce_lock(struct rbd_device *rbd_dev) |
368 |
+ { |
369 |
+- bool need_wait; |
370 |
+- |
371 |
+ dout("%s rbd_dev %p\n", __func__, rbd_dev); |
372 |
+ lockdep_assert_held_write(&rbd_dev->lock_rwsem); |
373 |
+ |
374 |
+@@ -4252,11 +4250,11 @@ static bool rbd_quiesce_lock(struct rbd_device *rbd_dev) |
375 |
+ */ |
376 |
+ rbd_dev->lock_state = RBD_LOCK_STATE_RELEASING; |
377 |
+ rbd_assert(!completion_done(&rbd_dev->releasing_wait)); |
378 |
+- need_wait = !list_empty(&rbd_dev->running_list); |
379 |
+- downgrade_write(&rbd_dev->lock_rwsem); |
380 |
+- if (need_wait) |
381 |
+- wait_for_completion(&rbd_dev->releasing_wait); |
382 |
+- up_read(&rbd_dev->lock_rwsem); |
383 |
++ if (list_empty(&rbd_dev->running_list)) |
384 |
++ return true; |
385 |
++ |
386 |
++ up_write(&rbd_dev->lock_rwsem); |
387 |
++ wait_for_completion(&rbd_dev->releasing_wait); |
388 |
+ |
389 |
+ down_write(&rbd_dev->lock_rwsem); |
390 |
+ if (rbd_dev->lock_state != RBD_LOCK_STATE_RELEASING) |
391 |
+@@ -4342,15 +4340,11 @@ static void rbd_handle_acquired_lock(struct rbd_device *rbd_dev, u8 struct_v, |
392 |
+ if (!rbd_cid_equal(&cid, &rbd_empty_cid)) { |
393 |
+ down_write(&rbd_dev->lock_rwsem); |
394 |
+ if (rbd_cid_equal(&cid, &rbd_dev->owner_cid)) { |
395 |
+- /* |
396 |
+- * we already know that the remote client is |
397 |
+- * the owner |
398 |
+- */ |
399 |
+- up_write(&rbd_dev->lock_rwsem); |
400 |
+- return; |
401 |
++ dout("%s rbd_dev %p cid %llu-%llu == owner_cid\n", |
402 |
++ __func__, rbd_dev, cid.gid, cid.handle); |
403 |
++ } else { |
404 |
++ rbd_set_owner_cid(rbd_dev, &cid); |
405 |
+ } |
406 |
+- |
407 |
+- rbd_set_owner_cid(rbd_dev, &cid); |
408 |
+ downgrade_write(&rbd_dev->lock_rwsem); |
409 |
+ } else { |
410 |
+ down_read(&rbd_dev->lock_rwsem); |
411 |
+@@ -4375,14 +4369,12 @@ static void rbd_handle_released_lock(struct rbd_device *rbd_dev, u8 struct_v, |
412 |
+ if (!rbd_cid_equal(&cid, &rbd_empty_cid)) { |
413 |
+ down_write(&rbd_dev->lock_rwsem); |
414 |
+ if (!rbd_cid_equal(&cid, &rbd_dev->owner_cid)) { |
415 |
+- dout("%s rbd_dev %p unexpected owner, cid %llu-%llu != owner_cid %llu-%llu\n", |
416 |
++ dout("%s rbd_dev %p cid %llu-%llu != owner_cid %llu-%llu\n", |
417 |
+ __func__, rbd_dev, cid.gid, cid.handle, |
418 |
+ rbd_dev->owner_cid.gid, rbd_dev->owner_cid.handle); |
419 |
+- up_write(&rbd_dev->lock_rwsem); |
420 |
+- return; |
421 |
++ } else { |
422 |
++ rbd_set_owner_cid(rbd_dev, &rbd_empty_cid); |
423 |
+ } |
424 |
+- |
425 |
+- rbd_set_owner_cid(rbd_dev, &rbd_empty_cid); |
426 |
+ downgrade_write(&rbd_dev->lock_rwsem); |
427 |
+ } else { |
428 |
+ down_read(&rbd_dev->lock_rwsem); |
429 |
+diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c |
430 |
+index 3a2b607369151..415d7b3a59f82 100644 |
431 |
+--- a/drivers/firmware/efi/efi.c |
432 |
++++ b/drivers/firmware/efi/efi.c |
433 |
+@@ -975,6 +975,7 @@ static int __init efi_memreserve_map_root(void) |
434 |
+ static int efi_mem_reserve_iomem(phys_addr_t addr, u64 size) |
435 |
+ { |
436 |
+ struct resource *res, *parent; |
437 |
++ int ret; |
438 |
+ |
439 |
+ res = kzalloc(sizeof(struct resource), GFP_ATOMIC); |
440 |
+ if (!res) |
441 |
+@@ -987,7 +988,17 @@ static int efi_mem_reserve_iomem(phys_addr_t addr, u64 size) |
442 |
+ |
443 |
+ /* we expect a conflict with a 'System RAM' region */ |
444 |
+ parent = request_resource_conflict(&iomem_resource, res); |
445 |
+- return parent ? request_resource(parent, res) : 0; |
446 |
++ ret = parent ? request_resource(parent, res) : 0; |
447 |
++ |
448 |
++ /* |
449 |
++ * Given that efi_mem_reserve_iomem() can be called at any |
450 |
++ * time, only call memblock_reserve() if the architecture |
451 |
++ * keeps the infrastructure around. |
452 |
++ */ |
453 |
++ if (IS_ENABLED(CONFIG_ARCH_KEEP_MEMBLOCK) && !ret) |
454 |
++ memblock_reserve(addr, size); |
455 |
++ |
456 |
++ return ret; |
457 |
+ } |
458 |
+ |
459 |
+ int __ref efi_mem_reserve_persistent(phys_addr_t addr, u64 size) |
460 |
+diff --git a/drivers/firmware/efi/tpm.c b/drivers/firmware/efi/tpm.c |
461 |
+index c1955d320fecd..8f665678e9e39 100644 |
462 |
+--- a/drivers/firmware/efi/tpm.c |
463 |
++++ b/drivers/firmware/efi/tpm.c |
464 |
+@@ -62,9 +62,11 @@ int __init efi_tpm_eventlog_init(void) |
465 |
+ tbl_size = sizeof(*log_tbl) + log_tbl->size; |
466 |
+ memblock_reserve(efi.tpm_log, tbl_size); |
467 |
+ |
468 |
+- if (efi.tpm_final_log == EFI_INVALID_TABLE_ADDR || |
469 |
+- log_tbl->version != EFI_TCG2_EVENT_LOG_FORMAT_TCG_2) { |
470 |
+- pr_warn(FW_BUG "TPM Final Events table missing or invalid\n"); |
471 |
++ if (efi.tpm_final_log == EFI_INVALID_TABLE_ADDR) { |
472 |
++ pr_info("TPM Final Events table not present\n"); |
473 |
++ goto out; |
474 |
++ } else if (log_tbl->version != EFI_TCG2_EVENT_LOG_FORMAT_TCG_2) { |
475 |
++ pr_warn(FW_BUG "TPM Final Events table invalid\n"); |
476 |
+ goto out; |
477 |
+ } |
478 |
+ |
479 |
+diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c |
480 |
+index 127f8a5352019..76b6676b0106f 100644 |
481 |
+--- a/drivers/gpu/drm/drm_ioctl.c |
482 |
++++ b/drivers/gpu/drm/drm_ioctl.c |
483 |
+@@ -826,6 +826,9 @@ long drm_ioctl(struct file *filp, |
484 |
+ if (drm_dev_is_unplugged(dev)) |
485 |
+ return -ENODEV; |
486 |
+ |
487 |
++ if (DRM_IOCTL_TYPE(cmd) != DRM_IOCTL_BASE) |
488 |
++ return -ENOTTY; |
489 |
++ |
490 |
+ is_driver_ioctl = nr >= DRM_COMMAND_BASE && nr < DRM_COMMAND_END; |
491 |
+ |
492 |
+ if (is_driver_ioctl) { |
493 |
+diff --git a/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c b/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c |
494 |
+index 2aa89eaecf6ff..bdb4d59c81277 100644 |
495 |
+--- a/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c |
496 |
++++ b/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c |
497 |
+@@ -453,7 +453,6 @@ static int rpi_touchscreen_remove(struct i2c_client *i2c) |
498 |
+ drm_panel_remove(&ts->base); |
499 |
+ |
500 |
+ mipi_dsi_device_unregister(ts->dsi); |
501 |
+- kfree(ts->dsi); |
502 |
+ |
503 |
+ return 0; |
504 |
+ } |
505 |
+diff --git a/drivers/iio/accel/bma180.c b/drivers/iio/accel/bma180.c |
506 |
+index aa301c6063467..acf1cc2bee07b 100644 |
507 |
+--- a/drivers/iio/accel/bma180.c |
508 |
++++ b/drivers/iio/accel/bma180.c |
509 |
+@@ -47,7 +47,7 @@ struct bma180_part_info { |
510 |
+ |
511 |
+ u8 int_reset_reg, int_reset_mask; |
512 |
+ u8 sleep_reg, sleep_mask; |
513 |
+- u8 bw_reg, bw_mask; |
514 |
++ u8 bw_reg, bw_mask, bw_offset; |
515 |
+ u8 scale_reg, scale_mask; |
516 |
+ u8 power_reg, power_mask, lowpower_val; |
517 |
+ u8 int_enable_reg, int_enable_mask; |
518 |
+@@ -103,6 +103,7 @@ struct bma180_part_info { |
519 |
+ |
520 |
+ #define BMA250_RANGE_MASK GENMASK(3, 0) /* Range of accel values */ |
521 |
+ #define BMA250_BW_MASK GENMASK(4, 0) /* Accel bandwidth */ |
522 |
++#define BMA250_BW_OFFSET 8 |
523 |
+ #define BMA250_SUSPEND_MASK BIT(7) /* chip will sleep */ |
524 |
+ #define BMA250_LOWPOWER_MASK BIT(6) |
525 |
+ #define BMA250_DATA_INTEN_MASK BIT(4) |
526 |
+@@ -241,7 +242,8 @@ static int bma180_set_bw(struct bma180_data *data, int val) |
527 |
+ for (i = 0; i < data->part_info->num_bw; ++i) { |
528 |
+ if (data->part_info->bw_table[i] == val) { |
529 |
+ ret = bma180_set_bits(data, data->part_info->bw_reg, |
530 |
+- data->part_info->bw_mask, i); |
531 |
++ data->part_info->bw_mask, |
532 |
++ i + data->part_info->bw_offset); |
533 |
+ if (ret) { |
534 |
+ dev_err(&data->client->dev, |
535 |
+ "failed to set bandwidth\n"); |
536 |
+@@ -633,32 +635,53 @@ static const struct iio_chan_spec bma250_channels[] = { |
537 |
+ |
538 |
+ static const struct bma180_part_info bma180_part_info[] = { |
539 |
+ [BMA180] = { |
540 |
+- bma180_channels, ARRAY_SIZE(bma180_channels), |
541 |
+- bma180_scale_table, ARRAY_SIZE(bma180_scale_table), |
542 |
+- bma180_bw_table, ARRAY_SIZE(bma180_bw_table), |
543 |
+- BMA180_CTRL_REG0, BMA180_RESET_INT, |
544 |
+- BMA180_CTRL_REG0, BMA180_SLEEP, |
545 |
+- BMA180_BW_TCS, BMA180_BW, |
546 |
+- BMA180_OFFSET_LSB1, BMA180_RANGE, |
547 |
+- BMA180_TCO_Z, BMA180_MODE_CONFIG, BMA180_LOW_POWER, |
548 |
+- BMA180_CTRL_REG3, BMA180_NEW_DATA_INT, |
549 |
+- BMA180_RESET, |
550 |
+- bma180_chip_config, |
551 |
+- bma180_chip_disable, |
552 |
++ .channels = bma180_channels, |
553 |
++ .num_channels = ARRAY_SIZE(bma180_channels), |
554 |
++ .scale_table = bma180_scale_table, |
555 |
++ .num_scales = ARRAY_SIZE(bma180_scale_table), |
556 |
++ .bw_table = bma180_bw_table, |
557 |
++ .num_bw = ARRAY_SIZE(bma180_bw_table), |
558 |
++ .int_reset_reg = BMA180_CTRL_REG0, |
559 |
++ .int_reset_mask = BMA180_RESET_INT, |
560 |
++ .sleep_reg = BMA180_CTRL_REG0, |
561 |
++ .sleep_mask = BMA180_SLEEP, |
562 |
++ .bw_reg = BMA180_BW_TCS, |
563 |
++ .bw_mask = BMA180_BW, |
564 |
++ .scale_reg = BMA180_OFFSET_LSB1, |
565 |
++ .scale_mask = BMA180_RANGE, |
566 |
++ .power_reg = BMA180_TCO_Z, |
567 |
++ .power_mask = BMA180_MODE_CONFIG, |
568 |
++ .lowpower_val = BMA180_LOW_POWER, |
569 |
++ .int_enable_reg = BMA180_CTRL_REG3, |
570 |
++ .int_enable_mask = BMA180_NEW_DATA_INT, |
571 |
++ .softreset_reg = BMA180_RESET, |
572 |
++ .chip_config = bma180_chip_config, |
573 |
++ .chip_disable = bma180_chip_disable, |
574 |
+ }, |
575 |
+ [BMA250] = { |
576 |
+- bma250_channels, ARRAY_SIZE(bma250_channels), |
577 |
+- bma250_scale_table, ARRAY_SIZE(bma250_scale_table), |
578 |
+- bma250_bw_table, ARRAY_SIZE(bma250_bw_table), |
579 |
+- BMA250_INT_RESET_REG, BMA250_INT_RESET_MASK, |
580 |
+- BMA250_POWER_REG, BMA250_SUSPEND_MASK, |
581 |
+- BMA250_BW_REG, BMA250_BW_MASK, |
582 |
+- BMA250_RANGE_REG, BMA250_RANGE_MASK, |
583 |
+- BMA250_POWER_REG, BMA250_LOWPOWER_MASK, 1, |
584 |
+- BMA250_INT_ENABLE_REG, BMA250_DATA_INTEN_MASK, |
585 |
+- BMA250_RESET_REG, |
586 |
+- bma250_chip_config, |
587 |
+- bma250_chip_disable, |
588 |
++ .channels = bma250_channels, |
589 |
++ .num_channels = ARRAY_SIZE(bma250_channels), |
590 |
++ .scale_table = bma250_scale_table, |
591 |
++ .num_scales = ARRAY_SIZE(bma250_scale_table), |
592 |
++ .bw_table = bma250_bw_table, |
593 |
++ .num_bw = ARRAY_SIZE(bma250_bw_table), |
594 |
++ .int_reset_reg = BMA250_INT_RESET_REG, |
595 |
++ .int_reset_mask = BMA250_INT_RESET_MASK, |
596 |
++ .sleep_reg = BMA250_POWER_REG, |
597 |
++ .sleep_mask = BMA250_SUSPEND_MASK, |
598 |
++ .bw_reg = BMA250_BW_REG, |
599 |
++ .bw_mask = BMA250_BW_MASK, |
600 |
++ .bw_offset = BMA250_BW_OFFSET, |
601 |
++ .scale_reg = BMA250_RANGE_REG, |
602 |
++ .scale_mask = BMA250_RANGE_MASK, |
603 |
++ .power_reg = BMA250_POWER_REG, |
604 |
++ .power_mask = BMA250_LOWPOWER_MASK, |
605 |
++ .lowpower_val = 1, |
606 |
++ .int_enable_reg = BMA250_INT_ENABLE_REG, |
607 |
++ .int_enable_mask = BMA250_DATA_INTEN_MASK, |
608 |
++ .softreset_reg = BMA250_RESET_REG, |
609 |
++ .chip_config = bma250_chip_config, |
610 |
++ .chip_disable = bma250_chip_disable, |
611 |
+ }, |
612 |
+ }; |
613 |
+ |
614 |
+diff --git a/drivers/media/pci/ngene/ngene-core.c b/drivers/media/pci/ngene/ngene-core.c |
615 |
+index af15ca1c501bf..919b297e645c5 100644 |
616 |
+--- a/drivers/media/pci/ngene/ngene-core.c |
617 |
++++ b/drivers/media/pci/ngene/ngene-core.c |
618 |
+@@ -385,7 +385,7 @@ static int ngene_command_config_free_buf(struct ngene *dev, u8 *config) |
619 |
+ |
620 |
+ com.cmd.hdr.Opcode = CMD_CONFIGURE_FREE_BUFFER; |
621 |
+ com.cmd.hdr.Length = 6; |
622 |
+- memcpy(&com.cmd.ConfigureBuffers.config, config, 6); |
623 |
++ memcpy(&com.cmd.ConfigureFreeBuffers.config, config, 6); |
624 |
+ com.in_len = 6; |
625 |
+ com.out_len = 0; |
626 |
+ |
627 |
+diff --git a/drivers/media/pci/ngene/ngene.h b/drivers/media/pci/ngene/ngene.h |
628 |
+index 84f04e0e0cb9a..3d296f1998a1a 100644 |
629 |
+--- a/drivers/media/pci/ngene/ngene.h |
630 |
++++ b/drivers/media/pci/ngene/ngene.h |
631 |
+@@ -407,12 +407,14 @@ enum _BUFFER_CONFIGS { |
632 |
+ |
633 |
+ struct FW_CONFIGURE_FREE_BUFFERS { |
634 |
+ struct FW_HEADER hdr; |
635 |
+- u8 UVI1_BufferLength; |
636 |
+- u8 UVI2_BufferLength; |
637 |
+- u8 TVO_BufferLength; |
638 |
+- u8 AUD1_BufferLength; |
639 |
+- u8 AUD2_BufferLength; |
640 |
+- u8 TVA_BufferLength; |
641 |
++ struct { |
642 |
++ u8 UVI1_BufferLength; |
643 |
++ u8 UVI2_BufferLength; |
644 |
++ u8 TVO_BufferLength; |
645 |
++ u8 AUD1_BufferLength; |
646 |
++ u8 AUD2_BufferLength; |
647 |
++ u8 TVA_BufferLength; |
648 |
++ } __packed config; |
649 |
+ } __attribute__ ((__packed__)); |
650 |
+ |
651 |
+ struct FW_CONFIGURE_UART { |
652 |
+diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c |
653 |
+index 8aa8825557a81..40b105daaf9e7 100644 |
654 |
+--- a/drivers/net/dsa/mv88e6xxx/chip.c |
655 |
++++ b/drivers/net/dsa/mv88e6xxx/chip.c |
656 |
+@@ -3192,7 +3192,7 @@ static const struct mv88e6xxx_ops mv88e6141_ops = { |
657 |
+ .port_set_cmode = mv88e6341_port_set_cmode, |
658 |
+ .port_setup_message_port = mv88e6xxx_setup_message_port, |
659 |
+ .stats_snapshot = mv88e6390_g1_stats_snapshot, |
660 |
+- .stats_set_histogram = mv88e6095_g1_stats_set_histogram, |
661 |
++ .stats_set_histogram = mv88e6390_g1_stats_set_histogram, |
662 |
+ .stats_get_sset_count = mv88e6320_stats_get_sset_count, |
663 |
+ .stats_get_strings = mv88e6320_stats_get_strings, |
664 |
+ .stats_get_stats = mv88e6390_stats_get_stats, |
665 |
+@@ -3907,7 +3907,7 @@ static const struct mv88e6xxx_ops mv88e6341_ops = { |
666 |
+ .port_set_cmode = mv88e6341_port_set_cmode, |
667 |
+ .port_setup_message_port = mv88e6xxx_setup_message_port, |
668 |
+ .stats_snapshot = mv88e6390_g1_stats_snapshot, |
669 |
+- .stats_set_histogram = mv88e6095_g1_stats_set_histogram, |
670 |
++ .stats_set_histogram = mv88e6390_g1_stats_set_histogram, |
671 |
+ .stats_get_sset_count = mv88e6320_stats_get_sset_count, |
672 |
+ .stats_get_strings = mv88e6320_stats_get_strings, |
673 |
+ .stats_get_stats = mv88e6390_stats_get_stats, |
674 |
+diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c |
675 |
+index d1c3939b0307f..287ea792922a9 100644 |
676 |
+--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c |
677 |
++++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c |
678 |
+@@ -9239,6 +9239,12 @@ int bnxt_half_open_nic(struct bnxt *bp) |
679 |
+ { |
680 |
+ int rc = 0; |
681 |
+ |
682 |
++ if (test_bit(BNXT_STATE_ABORT_ERR, &bp->state)) { |
683 |
++ netdev_err(bp->dev, "A previous firmware reset has not completed, aborting half open\n"); |
684 |
++ rc = -ENODEV; |
685 |
++ goto half_open_err; |
686 |
++ } |
687 |
++ |
688 |
+ rc = bnxt_alloc_mem(bp, false); |
689 |
+ if (rc) { |
690 |
+ netdev_err(bp->dev, "bnxt_alloc_mem err: %x\n", rc); |
691 |
+@@ -9987,12 +9993,15 @@ static void bnxt_reset_task(struct bnxt *bp, bool silent) |
692 |
+ if (netif_running(bp->dev)) { |
693 |
+ int rc; |
694 |
+ |
695 |
+- if (!silent) |
696 |
++ if (silent) { |
697 |
++ bnxt_close_nic(bp, false, false); |
698 |
++ bnxt_open_nic(bp, false, false); |
699 |
++ } else { |
700 |
+ bnxt_ulp_stop(bp); |
701 |
+- bnxt_close_nic(bp, false, false); |
702 |
+- rc = bnxt_open_nic(bp, false, false); |
703 |
+- if (!silent && !rc) |
704 |
+- bnxt_ulp_start(bp); |
705 |
++ bnxt_close_nic(bp, true, false); |
706 |
++ rc = bnxt_open_nic(bp, true, false); |
707 |
++ bnxt_ulp_start(bp, rc); |
708 |
++ } |
709 |
+ } |
710 |
+ } |
711 |
+ |
712 |
+@@ -10732,6 +10741,10 @@ static void bnxt_fw_reset_task(struct work_struct *work) |
713 |
+ } |
714 |
+ bp->fw_reset_timestamp = jiffies; |
715 |
+ rtnl_lock(); |
716 |
++ if (test_bit(BNXT_STATE_ABORT_ERR, &bp->state)) { |
717 |
++ rtnl_unlock(); |
718 |
++ goto fw_reset_abort; |
719 |
++ } |
720 |
+ bnxt_fw_reset_close(bp); |
721 |
+ if (bp->fw_cap & BNXT_FW_CAP_ERR_RECOVER_RELOAD) { |
722 |
+ bp->fw_reset_state = BNXT_FW_RESET_STATE_POLL_FW_DOWN; |
723 |
+@@ -12144,10 +12157,9 @@ static pci_ers_result_t bnxt_io_slot_reset(struct pci_dev *pdev) |
724 |
+ if (!err && netif_running(netdev)) |
725 |
+ err = bnxt_open(netdev); |
726 |
+ |
727 |
+- if (!err) { |
728 |
++ if (!err) |
729 |
+ result = PCI_ERS_RESULT_RECOVERED; |
730 |
+- bnxt_ulp_start(bp); |
731 |
+- } |
732 |
++ bnxt_ulp_start(bp, err); |
733 |
+ } |
734 |
+ |
735 |
+ if (result != PCI_ERS_RESULT_RECOVERED) { |
736 |
+diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c |
737 |
+index 13ef6a9afaa09..b0ae180df4e6f 100644 |
738 |
+--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c |
739 |
++++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c |
740 |
+@@ -186,7 +186,7 @@ static int bnxt_free_msix_vecs(struct bnxt_en_dev *edev, int ulp_id) |
741 |
+ |
742 |
+ edev->ulp_tbl[ulp_id].msix_requested = 0; |
743 |
+ edev->flags &= ~BNXT_EN_FLAG_MSIX_REQUESTED; |
744 |
+- if (netif_running(dev)) { |
745 |
++ if (netif_running(dev) && !(edev->flags & BNXT_EN_FLAG_ULP_STOPPED)) { |
746 |
+ bnxt_close_nic(bp, true, false); |
747 |
+ bnxt_open_nic(bp, true, false); |
748 |
+ } |
749 |
+@@ -274,6 +274,7 @@ void bnxt_ulp_stop(struct bnxt *bp) |
750 |
+ if (!edev) |
751 |
+ return; |
752 |
+ |
753 |
++ edev->flags |= BNXT_EN_FLAG_ULP_STOPPED; |
754 |
+ for (i = 0; i < BNXT_MAX_ULP; i++) { |
755 |
+ struct bnxt_ulp *ulp = &edev->ulp_tbl[i]; |
756 |
+ |
757 |
+@@ -284,7 +285,7 @@ void bnxt_ulp_stop(struct bnxt *bp) |
758 |
+ } |
759 |
+ } |
760 |
+ |
761 |
+-void bnxt_ulp_start(struct bnxt *bp) |
762 |
++void bnxt_ulp_start(struct bnxt *bp, int err) |
763 |
+ { |
764 |
+ struct bnxt_en_dev *edev = bp->edev; |
765 |
+ struct bnxt_ulp_ops *ops; |
766 |
+@@ -293,6 +294,11 @@ void bnxt_ulp_start(struct bnxt *bp) |
767 |
+ if (!edev) |
768 |
+ return; |
769 |
+ |
770 |
++ edev->flags &= ~BNXT_EN_FLAG_ULP_STOPPED; |
771 |
++ |
772 |
++ if (err) |
773 |
++ return; |
774 |
++ |
775 |
+ for (i = 0; i < BNXT_MAX_ULP; i++) { |
776 |
+ struct bnxt_ulp *ulp = &edev->ulp_tbl[i]; |
777 |
+ |
778 |
+@@ -467,13 +473,14 @@ struct bnxt_en_dev *bnxt_ulp_probe(struct net_device *dev) |
779 |
+ if (!edev) |
780 |
+ return ERR_PTR(-ENOMEM); |
781 |
+ edev->en_ops = &bnxt_en_ops_tbl; |
782 |
+- if (bp->flags & BNXT_FLAG_ROCEV1_CAP) |
783 |
+- edev->flags |= BNXT_EN_FLAG_ROCEV1_CAP; |
784 |
+- if (bp->flags & BNXT_FLAG_ROCEV2_CAP) |
785 |
+- edev->flags |= BNXT_EN_FLAG_ROCEV2_CAP; |
786 |
+ edev->net = dev; |
787 |
+ edev->pdev = bp->pdev; |
788 |
+ bp->edev = edev; |
789 |
+ } |
790 |
++ edev->flags &= ~BNXT_EN_FLAG_ROCE_CAP; |
791 |
++ if (bp->flags & BNXT_FLAG_ROCEV1_CAP) |
792 |
++ edev->flags |= BNXT_EN_FLAG_ROCEV1_CAP; |
793 |
++ if (bp->flags & BNXT_FLAG_ROCEV2_CAP) |
794 |
++ edev->flags |= BNXT_EN_FLAG_ROCEV2_CAP; |
795 |
+ return bp->edev; |
796 |
+ } |
797 |
+diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.h b/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.h |
798 |
+index cd78453d0bf0f..9895406b98308 100644 |
799 |
+--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.h |
800 |
++++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.h |
801 |
+@@ -64,6 +64,7 @@ struct bnxt_en_dev { |
802 |
+ #define BNXT_EN_FLAG_ROCE_CAP (BNXT_EN_FLAG_ROCEV1_CAP | \ |
803 |
+ BNXT_EN_FLAG_ROCEV2_CAP) |
804 |
+ #define BNXT_EN_FLAG_MSIX_REQUESTED 0x4 |
805 |
++ #define BNXT_EN_FLAG_ULP_STOPPED 0x8 |
806 |
+ const struct bnxt_en_ops *en_ops; |
807 |
+ struct bnxt_ulp ulp_tbl[BNXT_MAX_ULP]; |
808 |
+ }; |
809 |
+@@ -92,7 +93,7 @@ int bnxt_get_ulp_msix_num(struct bnxt *bp); |
810 |
+ int bnxt_get_ulp_msix_base(struct bnxt *bp); |
811 |
+ int bnxt_get_ulp_stat_ctxs(struct bnxt *bp); |
812 |
+ void bnxt_ulp_stop(struct bnxt *bp); |
813 |
+-void bnxt_ulp_start(struct bnxt *bp); |
814 |
++void bnxt_ulp_start(struct bnxt *bp, int err); |
815 |
+ void bnxt_ulp_sriov_cfg(struct bnxt *bp, int num_vfs); |
816 |
+ void bnxt_ulp_shutdown(struct bnxt *bp); |
817 |
+ void bnxt_ulp_irq_stop(struct bnxt *bp); |
818 |
+diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c |
819 |
+index 7bd6d2bf84408..c2a1fa75b2147 100644 |
820 |
+--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c |
821 |
++++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c |
822 |
+@@ -1187,7 +1187,8 @@ static void bcmgenet_power_up(struct bcmgenet_priv *priv, |
823 |
+ |
824 |
+ switch (mode) { |
825 |
+ case GENET_POWER_PASSIVE: |
826 |
+- reg &= ~(EXT_PWR_DOWN_DLL | EXT_PWR_DOWN_BIAS); |
827 |
++ reg &= ~(EXT_PWR_DOWN_DLL | EXT_PWR_DOWN_BIAS | |
828 |
++ EXT_ENERGY_DET_MASK); |
829 |
+ if (GENET_IS_V5(priv)) { |
830 |
+ reg &= ~(EXT_PWR_DOWN_PHY_EN | |
831 |
+ EXT_PWR_DOWN_PHY_RD | |
832 |
+@@ -2901,12 +2902,6 @@ static int bcmgenet_open(struct net_device *dev) |
833 |
+ |
834 |
+ bcmgenet_set_hw_addr(priv, dev->dev_addr); |
835 |
+ |
836 |
+- if (priv->internal_phy) { |
837 |
+- reg = bcmgenet_ext_readl(priv, EXT_EXT_PWR_MGMT); |
838 |
+- reg |= EXT_ENERGY_DET_MASK; |
839 |
+- bcmgenet_ext_writel(priv, reg, EXT_EXT_PWR_MGMT); |
840 |
+- } |
841 |
+- |
842 |
+ /* Disable RX/TX DMA and flush TX queues */ |
843 |
+ dma_ctrl = bcmgenet_dma_disable(priv); |
844 |
+ |
845 |
+@@ -3623,7 +3618,6 @@ static int bcmgenet_resume(struct device *d) |
846 |
+ struct bcmgenet_priv *priv = netdev_priv(dev); |
847 |
+ unsigned long dma_ctrl; |
848 |
+ int ret; |
849 |
+- u32 reg; |
850 |
+ |
851 |
+ if (!netif_running(dev)) |
852 |
+ return 0; |
853 |
+@@ -3655,12 +3649,6 @@ static int bcmgenet_resume(struct device *d) |
854 |
+ |
855 |
+ bcmgenet_set_hw_addr(priv, dev->dev_addr); |
856 |
+ |
857 |
+- if (priv->internal_phy) { |
858 |
+- reg = bcmgenet_ext_readl(priv, EXT_EXT_PWR_MGMT); |
859 |
+- reg |= EXT_ENERGY_DET_MASK; |
860 |
+- bcmgenet_ext_writel(priv, reg, EXT_EXT_PWR_MGMT); |
861 |
+- } |
862 |
+- |
863 |
+ if (priv->wolopts) |
864 |
+ bcmgenet_power_up(priv, GENET_POWER_WOL_MAGIC); |
865 |
+ |
866 |
+diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet_wol.c b/drivers/net/ethernet/broadcom/genet/bcmgenet_wol.c |
867 |
+index a41f82379369a..164988f3b4fab 100644 |
868 |
+--- a/drivers/net/ethernet/broadcom/genet/bcmgenet_wol.c |
869 |
++++ b/drivers/net/ethernet/broadcom/genet/bcmgenet_wol.c |
870 |
+@@ -160,12 +160,6 @@ int bcmgenet_wol_power_down_cfg(struct bcmgenet_priv *priv, |
871 |
+ reg |= CMD_RX_EN; |
872 |
+ bcmgenet_umac_writel(priv, reg, UMAC_CMD); |
873 |
+ |
874 |
+- if (priv->hw_params->flags & GENET_HAS_EXT) { |
875 |
+- reg = bcmgenet_ext_readl(priv, EXT_EXT_PWR_MGMT); |
876 |
+- reg &= ~EXT_ENERGY_DET_MASK; |
877 |
+- bcmgenet_ext_writel(priv, reg, EXT_EXT_PWR_MGMT); |
878 |
+- } |
879 |
+- |
880 |
+ return 0; |
881 |
+ } |
882 |
+ |
883 |
+diff --git a/drivers/net/ethernet/cavium/liquidio/cn23xx_pf_device.c b/drivers/net/ethernet/cavium/liquidio/cn23xx_pf_device.c |
884 |
+index 4cddd628d41b2..9ed3d1ab2ca58 100644 |
885 |
+--- a/drivers/net/ethernet/cavium/liquidio/cn23xx_pf_device.c |
886 |
++++ b/drivers/net/ethernet/cavium/liquidio/cn23xx_pf_device.c |
887 |
+@@ -420,7 +420,7 @@ static int cn23xx_pf_setup_global_input_regs(struct octeon_device *oct) |
888 |
+ * bits 32:47 indicate the PVF num. |
889 |
+ */ |
890 |
+ for (q_no = 0; q_no < ern; q_no++) { |
891 |
+- reg_val = oct->pcie_port << CN23XX_PKT_INPUT_CTL_MAC_NUM_POS; |
892 |
++ reg_val = (u64)oct->pcie_port << CN23XX_PKT_INPUT_CTL_MAC_NUM_POS; |
893 |
+ |
894 |
+ /* for VF assigned queues. */ |
895 |
+ if (q_no < oct->sriov_info.pf_srn) { |
896 |
+diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c |
897 |
+index deb1c1f301078..21414a34a5b5a 100644 |
898 |
+--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c |
899 |
++++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c |
900 |
+@@ -2245,6 +2245,9 @@ static void detach_ulds(struct adapter *adap) |
901 |
+ { |
902 |
+ unsigned int i; |
903 |
+ |
904 |
++ if (!is_uld(adap)) |
905 |
++ return; |
906 |
++ |
907 |
+ mutex_lock(&uld_mutex); |
908 |
+ list_del(&adap->list_node); |
909 |
+ |
910 |
+@@ -6152,10 +6155,13 @@ static void remove_one(struct pci_dev *pdev) |
911 |
+ */ |
912 |
+ destroy_workqueue(adapter->workq); |
913 |
+ |
914 |
+- if (is_uld(adapter)) { |
915 |
+- detach_ulds(adapter); |
916 |
+- t4_uld_clean_up(adapter); |
917 |
+- } |
918 |
++ detach_ulds(adapter); |
919 |
++ |
920 |
++ for_each_port(adapter, i) |
921 |
++ if (adapter->port[i]->reg_state == NETREG_REGISTERED) |
922 |
++ unregister_netdev(adapter->port[i]); |
923 |
++ |
924 |
++ t4_uld_clean_up(adapter); |
925 |
+ |
926 |
+ adap_free_hma_mem(adapter); |
927 |
+ |
928 |
+@@ -6163,10 +6169,6 @@ static void remove_one(struct pci_dev *pdev) |
929 |
+ |
930 |
+ cxgb4_free_mps_ref_entries(adapter); |
931 |
+ |
932 |
+- for_each_port(adapter, i) |
933 |
+- if (adapter->port[i]->reg_state == NETREG_REGISTERED) |
934 |
+- unregister_netdev(adapter->port[i]); |
935 |
+- |
936 |
+ debugfs_remove_recursive(adapter->debugfs_root); |
937 |
+ |
938 |
+ if (!is_t4(adapter->params.chip)) |
939 |
+diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.c |
940 |
+index 86b528d8364c0..971bdd70b6d66 100644 |
941 |
+--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.c |
942 |
++++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.c |
943 |
+@@ -638,6 +638,9 @@ void t4_uld_clean_up(struct adapter *adap) |
944 |
+ { |
945 |
+ unsigned int i; |
946 |
+ |
947 |
++ if (!is_uld(adap)) |
948 |
++ return; |
949 |
++ |
950 |
+ mutex_lock(&uld_mutex); |
951 |
+ for (i = 0; i < CXGB4_ULD_MAX; i++) { |
952 |
+ if (!adap->uld[i].handle) |
953 |
+diff --git a/drivers/net/ethernet/google/gve/gve_main.c b/drivers/net/ethernet/google/gve/gve_main.c |
954 |
+index 1c4b35b1b3590..f8dfa7501f65a 100644 |
955 |
+--- a/drivers/net/ethernet/google/gve/gve_main.c |
956 |
++++ b/drivers/net/ethernet/google/gve/gve_main.c |
957 |
+@@ -1170,13 +1170,16 @@ static int gve_probe(struct pci_dev *pdev, const struct pci_device_id *ent) |
958 |
+ |
959 |
+ err = register_netdev(dev); |
960 |
+ if (err) |
961 |
+- goto abort_with_wq; |
962 |
++ goto abort_with_gve_init; |
963 |
+ |
964 |
+ dev_info(&pdev->dev, "GVE version %s\n", gve_version_str); |
965 |
+ gve_clear_probe_in_progress(priv); |
966 |
+ queue_work(priv->gve_wq, &priv->service_task); |
967 |
+ return 0; |
968 |
+ |
969 |
++abort_with_gve_init: |
970 |
++ gve_teardown_priv_resources(priv); |
971 |
++ |
972 |
+ abort_with_wq: |
973 |
+ destroy_workqueue(priv->gve_wq); |
974 |
+ |
975 |
+diff --git a/drivers/net/ethernet/hisilicon/hip04_eth.c b/drivers/net/ethernet/hisilicon/hip04_eth.c |
976 |
+index 2ffe035e96d6e..b5eae06dd8705 100644 |
977 |
+--- a/drivers/net/ethernet/hisilicon/hip04_eth.c |
978 |
++++ b/drivers/net/ethernet/hisilicon/hip04_eth.c |
979 |
+@@ -131,7 +131,7 @@ |
980 |
+ /* buf unit size is cache_line_size, which is 64, so the shift is 6 */ |
981 |
+ #define PPE_BUF_SIZE_SHIFT 6 |
982 |
+ #define PPE_TX_BUF_HOLD BIT(31) |
983 |
+-#define CACHE_LINE_MASK 0x3F |
984 |
++#define SOC_CACHE_LINE_MASK 0x3F |
985 |
+ #else |
986 |
+ #define PPE_CFG_QOS_VMID_GRP_SHIFT 8 |
987 |
+ #define PPE_CFG_RX_CTRL_ALIGN_SHIFT 11 |
988 |
+@@ -531,8 +531,8 @@ hip04_mac_start_xmit(struct sk_buff *skb, struct net_device *ndev) |
989 |
+ #if defined(CONFIG_HI13X1_GMAC) |
990 |
+ desc->cfg = (__force u32)cpu_to_be32(TX_CLEAR_WB | TX_FINISH_CACHE_INV |
991 |
+ | TX_RELEASE_TO_PPE | priv->port << TX_POOL_SHIFT); |
992 |
+- desc->data_offset = (__force u32)cpu_to_be32(phys & CACHE_LINE_MASK); |
993 |
+- desc->send_addr = (__force u32)cpu_to_be32(phys & ~CACHE_LINE_MASK); |
994 |
++ desc->data_offset = (__force u32)cpu_to_be32(phys & SOC_CACHE_LINE_MASK); |
995 |
++ desc->send_addr = (__force u32)cpu_to_be32(phys & ~SOC_CACHE_LINE_MASK); |
996 |
+ #else |
997 |
+ desc->cfg = (__force u32)cpu_to_be32(TX_CLEAR_WB | TX_FINISH_CACHE_INV); |
998 |
+ desc->send_addr = (__force u32)cpu_to_be32(phys); |
999 |
+diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c |
1000 |
+index fc275d4f484c5..ea348ebbbf2e9 100644 |
1001 |
+--- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c |
1002 |
++++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c |
1003 |
+@@ -2119,6 +2119,16 @@ static int hclgevf_rss_init_hw(struct hclgevf_dev *hdev) |
1004 |
+ |
1005 |
+ static int hclgevf_init_vlan_config(struct hclgevf_dev *hdev) |
1006 |
+ { |
1007 |
++ struct hnae3_handle *nic = &hdev->nic; |
1008 |
++ int ret; |
1009 |
++ |
1010 |
++ ret = hclgevf_en_hw_strip_rxvtag(nic, true); |
1011 |
++ if (ret) { |
1012 |
++ dev_err(&hdev->pdev->dev, |
1013 |
++ "failed to enable rx vlan offload, ret = %d\n", ret); |
1014 |
++ return ret; |
1015 |
++ } |
1016 |
++ |
1017 |
+ return hclgevf_set_vlan_filter(&hdev->nic, htons(ETH_P_8021Q), 0, |
1018 |
+ false); |
1019 |
+ } |
1020 |
+diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c |
1021 |
+index a06d514215ede..cbd83bb5c1ac0 100644 |
1022 |
+--- a/drivers/net/ethernet/intel/e1000e/netdev.c |
1023 |
++++ b/drivers/net/ethernet/intel/e1000e/netdev.c |
1024 |
+@@ -7401,6 +7401,7 @@ err_flashmap: |
1025 |
+ err_ioremap: |
1026 |
+ free_netdev(netdev); |
1027 |
+ err_alloc_etherdev: |
1028 |
++ pci_disable_pcie_error_reporting(pdev); |
1029 |
+ pci_release_mem_regions(pdev); |
1030 |
+ err_pci_reg: |
1031 |
+ err_dma: |
1032 |
+diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_pci.c b/drivers/net/ethernet/intel/fm10k/fm10k_pci.c |
1033 |
+index bb236fa440487..36b016308c62f 100644 |
1034 |
+--- a/drivers/net/ethernet/intel/fm10k/fm10k_pci.c |
1035 |
++++ b/drivers/net/ethernet/intel/fm10k/fm10k_pci.c |
1036 |
+@@ -2230,6 +2230,7 @@ err_sw_init: |
1037 |
+ err_ioremap: |
1038 |
+ free_netdev(netdev); |
1039 |
+ err_alloc_netdev: |
1040 |
++ pci_disable_pcie_error_reporting(pdev); |
1041 |
+ pci_release_mem_regions(pdev); |
1042 |
+ err_pci_reg: |
1043 |
+ err_dma: |
1044 |
+diff --git a/drivers/net/ethernet/intel/iavf/iavf_main.c b/drivers/net/ethernet/intel/iavf/iavf_main.c |
1045 |
+index a97e1f9ca1ede..cda9b9a8392a2 100644 |
1046 |
+--- a/drivers/net/ethernet/intel/iavf/iavf_main.c |
1047 |
++++ b/drivers/net/ethernet/intel/iavf/iavf_main.c |
1048 |
+@@ -3765,6 +3765,7 @@ static int iavf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) |
1049 |
+ err_ioremap: |
1050 |
+ free_netdev(netdev); |
1051 |
+ err_alloc_etherdev: |
1052 |
++ pci_disable_pcie_error_reporting(pdev); |
1053 |
+ pci_release_regions(pdev); |
1054 |
+ err_pci_reg: |
1055 |
+ err_dma: |
1056 |
+diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c |
1057 |
+index c37f0590b3a4d..158feb0ab2739 100644 |
1058 |
+--- a/drivers/net/ethernet/intel/igb/igb_main.c |
1059 |
++++ b/drivers/net/ethernet/intel/igb/igb_main.c |
1060 |
+@@ -940,6 +940,7 @@ static void igb_configure_msix(struct igb_adapter *adapter) |
1061 |
+ **/ |
1062 |
+ static int igb_request_msix(struct igb_adapter *adapter) |
1063 |
+ { |
1064 |
++ unsigned int num_q_vectors = adapter->num_q_vectors; |
1065 |
+ struct net_device *netdev = adapter->netdev; |
1066 |
+ int i, err = 0, vector = 0, free_vector = 0; |
1067 |
+ |
1068 |
+@@ -948,7 +949,13 @@ static int igb_request_msix(struct igb_adapter *adapter) |
1069 |
+ if (err) |
1070 |
+ goto err_out; |
1071 |
+ |
1072 |
+- for (i = 0; i < adapter->num_q_vectors; i++) { |
1073 |
++ if (num_q_vectors > MAX_Q_VECTORS) { |
1074 |
++ num_q_vectors = MAX_Q_VECTORS; |
1075 |
++ dev_warn(&adapter->pdev->dev, |
1076 |
++ "The number of queue vectors (%d) is higher than max allowed (%d)\n", |
1077 |
++ adapter->num_q_vectors, MAX_Q_VECTORS); |
1078 |
++ } |
1079 |
++ for (i = 0; i < num_q_vectors; i++) { |
1080 |
+ struct igb_q_vector *q_vector = adapter->q_vector[i]; |
1081 |
+ |
1082 |
+ vector++; |
1083 |
+@@ -1687,14 +1694,15 @@ static bool is_any_txtime_enabled(struct igb_adapter *adapter) |
1084 |
+ **/ |
1085 |
+ static void igb_config_tx_modes(struct igb_adapter *adapter, int queue) |
1086 |
+ { |
1087 |
+- struct igb_ring *ring = adapter->tx_ring[queue]; |
1088 |
+ struct net_device *netdev = adapter->netdev; |
1089 |
+ struct e1000_hw *hw = &adapter->hw; |
1090 |
++ struct igb_ring *ring; |
1091 |
+ u32 tqavcc, tqavctrl; |
1092 |
+ u16 value; |
1093 |
+ |
1094 |
+ WARN_ON(hw->mac.type != e1000_i210); |
1095 |
+ WARN_ON(queue < 0 || queue > 1); |
1096 |
++ ring = adapter->tx_ring[queue]; |
1097 |
+ |
1098 |
+ /* If any of the Qav features is enabled, configure queues as SR and |
1099 |
+ * with HIGH PRIO. If none is, then configure them with LOW PRIO and |
1100 |
+@@ -3469,6 +3477,7 @@ err_sw_init: |
1101 |
+ err_ioremap: |
1102 |
+ free_netdev(netdev); |
1103 |
+ err_alloc_etherdev: |
1104 |
++ pci_disable_pcie_error_reporting(pdev); |
1105 |
+ pci_release_mem_regions(pdev); |
1106 |
+ err_pci_reg: |
1107 |
+ err_dma: |
1108 |
+@@ -4657,6 +4666,8 @@ static void igb_clean_tx_ring(struct igb_ring *tx_ring) |
1109 |
+ DMA_TO_DEVICE); |
1110 |
+ } |
1111 |
+ |
1112 |
++ tx_buffer->next_to_watch = NULL; |
1113 |
++ |
1114 |
+ /* move us one more past the eop_desc for start of next pkt */ |
1115 |
+ tx_buffer++; |
1116 |
+ i++; |
1117 |
+diff --git a/drivers/net/ethernet/intel/igc/igc.h b/drivers/net/ethernet/intel/igc/igc.h |
1118 |
+index 7e16345d836e1..aec998c82b694 100644 |
1119 |
+--- a/drivers/net/ethernet/intel/igc/igc.h |
1120 |
++++ b/drivers/net/ethernet/intel/igc/igc.h |
1121 |
+@@ -504,7 +504,7 @@ static inline s32 igc_read_phy_reg(struct igc_hw *hw, u32 offset, u16 *data) |
1122 |
+ if (hw->phy.ops.read_reg) |
1123 |
+ return hw->phy.ops.read_reg(hw, offset, data); |
1124 |
+ |
1125 |
+- return 0; |
1126 |
++ return -EOPNOTSUPP; |
1127 |
+ } |
1128 |
+ |
1129 |
+ /* forward declaration */ |
1130 |
+diff --git a/drivers/net/ethernet/intel/igc/igc_main.c b/drivers/net/ethernet/intel/igc/igc_main.c |
1131 |
+index 6b43e1c5b1c3e..084cf4a4114ad 100644 |
1132 |
+--- a/drivers/net/ethernet/intel/igc/igc_main.c |
1133 |
++++ b/drivers/net/ethernet/intel/igc/igc_main.c |
1134 |
+@@ -256,6 +256,8 @@ static void igc_clean_tx_ring(struct igc_ring *tx_ring) |
1135 |
+ DMA_TO_DEVICE); |
1136 |
+ } |
1137 |
+ |
1138 |
++ tx_buffer->next_to_watch = NULL; |
1139 |
++ |
1140 |
+ /* move us one more past the eop_desc for start of next pkt */ |
1141 |
+ tx_buffer++; |
1142 |
+ i++; |
1143 |
+@@ -4310,8 +4312,8 @@ err_sw_init: |
1144 |
+ err_ioremap: |
1145 |
+ free_netdev(netdev); |
1146 |
+ err_alloc_etherdev: |
1147 |
+- pci_release_selected_regions(pdev, |
1148 |
+- pci_select_bars(pdev, IORESOURCE_MEM)); |
1149 |
++ pci_disable_pcie_error_reporting(pdev); |
1150 |
++ pci_release_mem_regions(pdev); |
1151 |
+ err_pci_reg: |
1152 |
+ err_dma: |
1153 |
+ pci_disable_device(pdev); |
1154 |
+diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c |
1155 |
+index 1b8e70585c44a..8a894e5d923f0 100644 |
1156 |
+--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c |
1157 |
++++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c |
1158 |
+@@ -1827,7 +1827,8 @@ static void ixgbe_dma_sync_frag(struct ixgbe_ring *rx_ring, |
1159 |
+ struct sk_buff *skb) |
1160 |
+ { |
1161 |
+ if (ring_uses_build_skb(rx_ring)) { |
1162 |
+- unsigned long offset = (unsigned long)(skb->data) & ~PAGE_MASK; |
1163 |
++ unsigned long mask = (unsigned long)ixgbe_rx_pg_size(rx_ring) - 1; |
1164 |
++ unsigned long offset = (unsigned long)(skb->data) & mask; |
1165 |
+ |
1166 |
+ dma_sync_single_range_for_cpu(rx_ring->dev, |
1167 |
+ IXGBE_CB(skb)->dma, |
1168 |
+@@ -11207,6 +11208,7 @@ err_ioremap: |
1169 |
+ disable_dev = !test_and_set_bit(__IXGBE_DISABLED, &adapter->state); |
1170 |
+ free_netdev(netdev); |
1171 |
+ err_alloc_etherdev: |
1172 |
++ pci_disable_pcie_error_reporting(pdev); |
1173 |
+ pci_release_mem_regions(pdev); |
1174 |
+ err_pci_reg: |
1175 |
+ err_dma: |
1176 |
+diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c |
1177 |
+index 5969f64169e53..fb51548c57e94 100644 |
1178 |
+--- a/drivers/net/ethernet/realtek/r8169_main.c |
1179 |
++++ b/drivers/net/ethernet/realtek/r8169_main.c |
1180 |
+@@ -6850,7 +6850,8 @@ static int r8169_mdio_register(struct rtl8169_private *tp) |
1181 |
+ new_bus->priv = tp; |
1182 |
+ new_bus->parent = &pdev->dev; |
1183 |
+ new_bus->irq[0] = PHY_IGNORE_INTERRUPT; |
1184 |
+- snprintf(new_bus->id, MII_BUS_ID_SIZE, "r8169-%x", pci_dev_id(pdev)); |
1185 |
++ snprintf(new_bus->id, MII_BUS_ID_SIZE, "r8169-%x-%x", |
1186 |
++ pci_domain_nr(pdev->bus), pci_dev_id(pdev)); |
1187 |
+ |
1188 |
+ new_bus->read = r8169_mdio_read_reg; |
1189 |
+ new_bus->write = r8169_mdio_write_reg; |
1190 |
+diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c |
1191 |
+index 710ab45eb679d..a5b5a2305791d 100644 |
1192 |
+--- a/drivers/nvme/host/core.c |
1193 |
++++ b/drivers/nvme/host/core.c |
1194 |
+@@ -694,7 +694,10 @@ static inline blk_status_t nvme_setup_write_zeroes(struct nvme_ns *ns, |
1195 |
+ cpu_to_le64(nvme_sect_to_lba(ns, blk_rq_pos(req))); |
1196 |
+ cmnd->write_zeroes.length = |
1197 |
+ cpu_to_le16((blk_rq_bytes(req) >> ns->lba_shift) - 1); |
1198 |
+- cmnd->write_zeroes.control = 0; |
1199 |
++ if (nvme_ns_has_pi(ns)) |
1200 |
++ cmnd->write_zeroes.control = cpu_to_le16(NVME_RW_PRINFO_PRACT); |
1201 |
++ else |
1202 |
++ cmnd->write_zeroes.control = 0; |
1203 |
+ return BLK_STS_OK; |
1204 |
+ } |
1205 |
+ |
1206 |
+diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c |
1207 |
+index 2cb2ead7615b2..af516c35afe6f 100644 |
1208 |
+--- a/drivers/nvme/host/pci.c |
1209 |
++++ b/drivers/nvme/host/pci.c |
1210 |
+@@ -2590,7 +2590,9 @@ static void nvme_reset_work(struct work_struct *work) |
1211 |
+ bool was_suspend = !!(dev->ctrl.ctrl_config & NVME_CC_SHN_NORMAL); |
1212 |
+ int result; |
1213 |
+ |
1214 |
+- if (WARN_ON(dev->ctrl.state != NVME_CTRL_RESETTING)) { |
1215 |
++ if (dev->ctrl.state != NVME_CTRL_RESETTING) { |
1216 |
++ dev_warn(dev->ctrl.device, "ctrl state %d is not RESETTING\n", |
1217 |
++ dev->ctrl.state); |
1218 |
+ result = -ENODEV; |
1219 |
+ goto out; |
1220 |
+ } |
1221 |
+@@ -2954,7 +2956,6 @@ static void nvme_remove(struct pci_dev *pdev) |
1222 |
+ if (!pci_device_is_present(pdev)) { |
1223 |
+ nvme_change_ctrl_state(&dev->ctrl, NVME_CTRL_DEAD); |
1224 |
+ nvme_dev_disable(dev, true); |
1225 |
+- nvme_dev_remove_admin(dev); |
1226 |
+ } |
1227 |
+ |
1228 |
+ flush_work(&dev->ctrl.reset_work); |
1229 |
+diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c |
1230 |
+index 3fe9a6f61f85c..6c1b936a94fac 100644 |
1231 |
+--- a/drivers/pci/quirks.c |
1232 |
++++ b/drivers/pci/quirks.c |
1233 |
+@@ -5312,7 +5312,8 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_SERVERWORKS, 0x0422, quirk_no_ext_tags); |
1234 |
+ static void quirk_amd_harvest_no_ats(struct pci_dev *pdev) |
1235 |
+ { |
1236 |
+ if ((pdev->device == 0x7312 && pdev->revision != 0x00) || |
1237 |
+- (pdev->device == 0x7340 && pdev->revision != 0xc5)) |
1238 |
++ (pdev->device == 0x7340 && pdev->revision != 0xc5) || |
1239 |
++ (pdev->device == 0x7341 && pdev->revision != 0x00)) |
1240 |
+ return; |
1241 |
+ |
1242 |
+ pci_info(pdev, "disabling ATS\n"); |
1243 |
+@@ -5327,6 +5328,7 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x6900, quirk_amd_harvest_no_ats); |
1244 |
+ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x7312, quirk_amd_harvest_no_ats); |
1245 |
+ /* AMD Navi14 dGPU */ |
1246 |
+ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x7340, quirk_amd_harvest_no_ats); |
1247 |
++DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x7341, quirk_amd_harvest_no_ats); |
1248 |
+ #endif /* CONFIG_PCI_ATS */ |
1249 |
+ |
1250 |
+ /* Freescale PCIe doesn't support MSI in RC mode */ |
1251 |
+diff --git a/drivers/pwm/pwm-sprd.c b/drivers/pwm/pwm-sprd.c |
1252 |
+index be23942274231..892d853d48a1a 100644 |
1253 |
+--- a/drivers/pwm/pwm-sprd.c |
1254 |
++++ b/drivers/pwm/pwm-sprd.c |
1255 |
+@@ -180,13 +180,10 @@ static int sprd_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, |
1256 |
+ } |
1257 |
+ } |
1258 |
+ |
1259 |
+- if (state->period != cstate->period || |
1260 |
+- state->duty_cycle != cstate->duty_cycle) { |
1261 |
+- ret = sprd_pwm_config(spc, pwm, state->duty_cycle, |
1262 |
+- state->period); |
1263 |
+- if (ret) |
1264 |
+- return ret; |
1265 |
+- } |
1266 |
++ ret = sprd_pwm_config(spc, pwm, state->duty_cycle, |
1267 |
++ state->period); |
1268 |
++ if (ret) |
1269 |
++ return ret; |
1270 |
+ |
1271 |
+ sprd_pwm_write(spc, pwm->hwpwm, SPRD_PWM_ENABLE, 1); |
1272 |
+ } else if (cstate->enabled) { |
1273 |
+diff --git a/drivers/regulator/hi6421-regulator.c b/drivers/regulator/hi6421-regulator.c |
1274 |
+index 5ac3d7c29725a..efc91b03a9bbc 100644 |
1275 |
+--- a/drivers/regulator/hi6421-regulator.c |
1276 |
++++ b/drivers/regulator/hi6421-regulator.c |
1277 |
+@@ -366,9 +366,8 @@ static struct hi6421_regulator_info |
1278 |
+ |
1279 |
+ static int hi6421_regulator_enable(struct regulator_dev *rdev) |
1280 |
+ { |
1281 |
+- struct hi6421_regulator_pdata *pdata; |
1282 |
++ struct hi6421_regulator_pdata *pdata = rdev_get_drvdata(rdev); |
1283 |
+ |
1284 |
+- pdata = dev_get_drvdata(rdev->dev.parent); |
1285 |
+ /* hi6421 spec requires regulator enablement must be serialized: |
1286 |
+ * - Because when BUCK, LDO switching from off to on, it will have |
1287 |
+ * a huge instantaneous current; so you can not turn on two or |
1288 |
+@@ -385,9 +384,10 @@ static int hi6421_regulator_enable(struct regulator_dev *rdev) |
1289 |
+ |
1290 |
+ static unsigned int hi6421_regulator_ldo_get_mode(struct regulator_dev *rdev) |
1291 |
+ { |
1292 |
+- struct hi6421_regulator_info *info = rdev_get_drvdata(rdev); |
1293 |
+- u32 reg_val; |
1294 |
++ struct hi6421_regulator_info *info; |
1295 |
++ unsigned int reg_val; |
1296 |
+ |
1297 |
++ info = container_of(rdev->desc, struct hi6421_regulator_info, desc); |
1298 |
+ regmap_read(rdev->regmap, rdev->desc->enable_reg, ®_val); |
1299 |
+ if (reg_val & info->mode_mask) |
1300 |
+ return REGULATOR_MODE_IDLE; |
1301 |
+@@ -397,9 +397,10 @@ static unsigned int hi6421_regulator_ldo_get_mode(struct regulator_dev *rdev) |
1302 |
+ |
1303 |
+ static unsigned int hi6421_regulator_buck_get_mode(struct regulator_dev *rdev) |
1304 |
+ { |
1305 |
+- struct hi6421_regulator_info *info = rdev_get_drvdata(rdev); |
1306 |
+- u32 reg_val; |
1307 |
++ struct hi6421_regulator_info *info; |
1308 |
++ unsigned int reg_val; |
1309 |
+ |
1310 |
++ info = container_of(rdev->desc, struct hi6421_regulator_info, desc); |
1311 |
+ regmap_read(rdev->regmap, rdev->desc->enable_reg, ®_val); |
1312 |
+ if (reg_val & info->mode_mask) |
1313 |
+ return REGULATOR_MODE_STANDBY; |
1314 |
+@@ -410,9 +411,10 @@ static unsigned int hi6421_regulator_buck_get_mode(struct regulator_dev *rdev) |
1315 |
+ static int hi6421_regulator_ldo_set_mode(struct regulator_dev *rdev, |
1316 |
+ unsigned int mode) |
1317 |
+ { |
1318 |
+- struct hi6421_regulator_info *info = rdev_get_drvdata(rdev); |
1319 |
+- u32 new_mode; |
1320 |
++ struct hi6421_regulator_info *info; |
1321 |
++ unsigned int new_mode; |
1322 |
+ |
1323 |
++ info = container_of(rdev->desc, struct hi6421_regulator_info, desc); |
1324 |
+ switch (mode) { |
1325 |
+ case REGULATOR_MODE_NORMAL: |
1326 |
+ new_mode = 0; |
1327 |
+@@ -434,9 +436,10 @@ static int hi6421_regulator_ldo_set_mode(struct regulator_dev *rdev, |
1328 |
+ static int hi6421_regulator_buck_set_mode(struct regulator_dev *rdev, |
1329 |
+ unsigned int mode) |
1330 |
+ { |
1331 |
+- struct hi6421_regulator_info *info = rdev_get_drvdata(rdev); |
1332 |
+- u32 new_mode; |
1333 |
++ struct hi6421_regulator_info *info; |
1334 |
++ unsigned int new_mode; |
1335 |
+ |
1336 |
++ info = container_of(rdev->desc, struct hi6421_regulator_info, desc); |
1337 |
+ switch (mode) { |
1338 |
+ case REGULATOR_MODE_NORMAL: |
1339 |
+ new_mode = 0; |
1340 |
+@@ -459,7 +462,9 @@ static unsigned int |
1341 |
+ hi6421_regulator_ldo_get_optimum_mode(struct regulator_dev *rdev, |
1342 |
+ int input_uV, int output_uV, int load_uA) |
1343 |
+ { |
1344 |
+- struct hi6421_regulator_info *info = rdev_get_drvdata(rdev); |
1345 |
++ struct hi6421_regulator_info *info; |
1346 |
++ |
1347 |
++ info = container_of(rdev->desc, struct hi6421_regulator_info, desc); |
1348 |
+ |
1349 |
+ if (load_uA > info->eco_microamp) |
1350 |
+ return REGULATOR_MODE_NORMAL; |
1351 |
+@@ -543,14 +548,13 @@ static int hi6421_regulator_probe(struct platform_device *pdev) |
1352 |
+ if (!pdata) |
1353 |
+ return -ENOMEM; |
1354 |
+ mutex_init(&pdata->lock); |
1355 |
+- platform_set_drvdata(pdev, pdata); |
1356 |
+ |
1357 |
+ for (i = 0; i < ARRAY_SIZE(hi6421_regulator_info); i++) { |
1358 |
+ /* assign per-regulator data */ |
1359 |
+ info = &hi6421_regulator_info[i]; |
1360 |
+ |
1361 |
+ config.dev = pdev->dev.parent; |
1362 |
+- config.driver_data = info; |
1363 |
++ config.driver_data = pdata; |
1364 |
+ config.regmap = pmic->regmap; |
1365 |
+ |
1366 |
+ rdev = devm_regulator_register(&pdev->dev, &info->desc, |
1367 |
+diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c |
1368 |
+index 2f1553d0a10ed..77bba91b57147 100644 |
1369 |
+--- a/drivers/scsi/scsi_transport_iscsi.c |
1370 |
++++ b/drivers/scsi/scsi_transport_iscsi.c |
1371 |
+@@ -432,39 +432,10 @@ static umode_t iscsi_iface_attr_is_visible(struct kobject *kobj, |
1372 |
+ struct device *dev = container_of(kobj, struct device, kobj); |
1373 |
+ struct iscsi_iface *iface = iscsi_dev_to_iface(dev); |
1374 |
+ struct iscsi_transport *t = iface->transport; |
1375 |
+- int param; |
1376 |
+- int param_type; |
1377 |
++ int param = -1; |
1378 |
+ |
1379 |
+ if (attr == &dev_attr_iface_enabled.attr) |
1380 |
+ param = ISCSI_NET_PARAM_IFACE_ENABLE; |
1381 |
+- else if (attr == &dev_attr_iface_vlan_id.attr) |
1382 |
+- param = ISCSI_NET_PARAM_VLAN_ID; |
1383 |
+- else if (attr == &dev_attr_iface_vlan_priority.attr) |
1384 |
+- param = ISCSI_NET_PARAM_VLAN_PRIORITY; |
1385 |
+- else if (attr == &dev_attr_iface_vlan_enabled.attr) |
1386 |
+- param = ISCSI_NET_PARAM_VLAN_ENABLED; |
1387 |
+- else if (attr == &dev_attr_iface_mtu.attr) |
1388 |
+- param = ISCSI_NET_PARAM_MTU; |
1389 |
+- else if (attr == &dev_attr_iface_port.attr) |
1390 |
+- param = ISCSI_NET_PARAM_PORT; |
1391 |
+- else if (attr == &dev_attr_iface_ipaddress_state.attr) |
1392 |
+- param = ISCSI_NET_PARAM_IPADDR_STATE; |
1393 |
+- else if (attr == &dev_attr_iface_delayed_ack_en.attr) |
1394 |
+- param = ISCSI_NET_PARAM_DELAYED_ACK_EN; |
1395 |
+- else if (attr == &dev_attr_iface_tcp_nagle_disable.attr) |
1396 |
+- param = ISCSI_NET_PARAM_TCP_NAGLE_DISABLE; |
1397 |
+- else if (attr == &dev_attr_iface_tcp_wsf_disable.attr) |
1398 |
+- param = ISCSI_NET_PARAM_TCP_WSF_DISABLE; |
1399 |
+- else if (attr == &dev_attr_iface_tcp_wsf.attr) |
1400 |
+- param = ISCSI_NET_PARAM_TCP_WSF; |
1401 |
+- else if (attr == &dev_attr_iface_tcp_timer_scale.attr) |
1402 |
+- param = ISCSI_NET_PARAM_TCP_TIMER_SCALE; |
1403 |
+- else if (attr == &dev_attr_iface_tcp_timestamp_en.attr) |
1404 |
+- param = ISCSI_NET_PARAM_TCP_TIMESTAMP_EN; |
1405 |
+- else if (attr == &dev_attr_iface_cache_id.attr) |
1406 |
+- param = ISCSI_NET_PARAM_CACHE_ID; |
1407 |
+- else if (attr == &dev_attr_iface_redirect_en.attr) |
1408 |
+- param = ISCSI_NET_PARAM_REDIRECT_EN; |
1409 |
+ else if (attr == &dev_attr_iface_def_taskmgmt_tmo.attr) |
1410 |
+ param = ISCSI_IFACE_PARAM_DEF_TASKMGMT_TMO; |
1411 |
+ else if (attr == &dev_attr_iface_header_digest.attr) |
1412 |
+@@ -501,6 +472,38 @@ static umode_t iscsi_iface_attr_is_visible(struct kobject *kobj, |
1413 |
+ param = ISCSI_IFACE_PARAM_STRICT_LOGIN_COMP_EN; |
1414 |
+ else if (attr == &dev_attr_iface_initiator_name.attr) |
1415 |
+ param = ISCSI_IFACE_PARAM_INITIATOR_NAME; |
1416 |
++ |
1417 |
++ if (param != -1) |
1418 |
++ return t->attr_is_visible(ISCSI_IFACE_PARAM, param); |
1419 |
++ |
1420 |
++ if (attr == &dev_attr_iface_vlan_id.attr) |
1421 |
++ param = ISCSI_NET_PARAM_VLAN_ID; |
1422 |
++ else if (attr == &dev_attr_iface_vlan_priority.attr) |
1423 |
++ param = ISCSI_NET_PARAM_VLAN_PRIORITY; |
1424 |
++ else if (attr == &dev_attr_iface_vlan_enabled.attr) |
1425 |
++ param = ISCSI_NET_PARAM_VLAN_ENABLED; |
1426 |
++ else if (attr == &dev_attr_iface_mtu.attr) |
1427 |
++ param = ISCSI_NET_PARAM_MTU; |
1428 |
++ else if (attr == &dev_attr_iface_port.attr) |
1429 |
++ param = ISCSI_NET_PARAM_PORT; |
1430 |
++ else if (attr == &dev_attr_iface_ipaddress_state.attr) |
1431 |
++ param = ISCSI_NET_PARAM_IPADDR_STATE; |
1432 |
++ else if (attr == &dev_attr_iface_delayed_ack_en.attr) |
1433 |
++ param = ISCSI_NET_PARAM_DELAYED_ACK_EN; |
1434 |
++ else if (attr == &dev_attr_iface_tcp_nagle_disable.attr) |
1435 |
++ param = ISCSI_NET_PARAM_TCP_NAGLE_DISABLE; |
1436 |
++ else if (attr == &dev_attr_iface_tcp_wsf_disable.attr) |
1437 |
++ param = ISCSI_NET_PARAM_TCP_WSF_DISABLE; |
1438 |
++ else if (attr == &dev_attr_iface_tcp_wsf.attr) |
1439 |
++ param = ISCSI_NET_PARAM_TCP_WSF; |
1440 |
++ else if (attr == &dev_attr_iface_tcp_timer_scale.attr) |
1441 |
++ param = ISCSI_NET_PARAM_TCP_TIMER_SCALE; |
1442 |
++ else if (attr == &dev_attr_iface_tcp_timestamp_en.attr) |
1443 |
++ param = ISCSI_NET_PARAM_TCP_TIMESTAMP_EN; |
1444 |
++ else if (attr == &dev_attr_iface_cache_id.attr) |
1445 |
++ param = ISCSI_NET_PARAM_CACHE_ID; |
1446 |
++ else if (attr == &dev_attr_iface_redirect_en.attr) |
1447 |
++ param = ISCSI_NET_PARAM_REDIRECT_EN; |
1448 |
+ else if (iface->iface_type == ISCSI_IFACE_TYPE_IPV4) { |
1449 |
+ if (attr == &dev_attr_ipv4_iface_ipaddress.attr) |
1450 |
+ param = ISCSI_NET_PARAM_IPV4_ADDR; |
1451 |
+@@ -591,32 +594,7 @@ static umode_t iscsi_iface_attr_is_visible(struct kobject *kobj, |
1452 |
+ return 0; |
1453 |
+ } |
1454 |
+ |
1455 |
+- switch (param) { |
1456 |
+- case ISCSI_IFACE_PARAM_DEF_TASKMGMT_TMO: |
1457 |
+- case ISCSI_IFACE_PARAM_HDRDGST_EN: |
1458 |
+- case ISCSI_IFACE_PARAM_DATADGST_EN: |
1459 |
+- case ISCSI_IFACE_PARAM_IMM_DATA_EN: |
1460 |
+- case ISCSI_IFACE_PARAM_INITIAL_R2T_EN: |
1461 |
+- case ISCSI_IFACE_PARAM_DATASEQ_INORDER_EN: |
1462 |
+- case ISCSI_IFACE_PARAM_PDU_INORDER_EN: |
1463 |
+- case ISCSI_IFACE_PARAM_ERL: |
1464 |
+- case ISCSI_IFACE_PARAM_MAX_RECV_DLENGTH: |
1465 |
+- case ISCSI_IFACE_PARAM_FIRST_BURST: |
1466 |
+- case ISCSI_IFACE_PARAM_MAX_R2T: |
1467 |
+- case ISCSI_IFACE_PARAM_MAX_BURST: |
1468 |
+- case ISCSI_IFACE_PARAM_CHAP_AUTH_EN: |
1469 |
+- case ISCSI_IFACE_PARAM_BIDI_CHAP_EN: |
1470 |
+- case ISCSI_IFACE_PARAM_DISCOVERY_AUTH_OPTIONAL: |
1471 |
+- case ISCSI_IFACE_PARAM_DISCOVERY_LOGOUT_EN: |
1472 |
+- case ISCSI_IFACE_PARAM_STRICT_LOGIN_COMP_EN: |
1473 |
+- case ISCSI_IFACE_PARAM_INITIATOR_NAME: |
1474 |
+- param_type = ISCSI_IFACE_PARAM; |
1475 |
+- break; |
1476 |
+- default: |
1477 |
+- param_type = ISCSI_NET_PARAM; |
1478 |
+- } |
1479 |
+- |
1480 |
+- return t->attr_is_visible(param_type, param); |
1481 |
++ return t->attr_is_visible(ISCSI_NET_PARAM, param); |
1482 |
+ } |
1483 |
+ |
1484 |
+ static struct attribute *iscsi_iface_attrs[] = { |
1485 |
+diff --git a/drivers/spi/spi-cadence.c b/drivers/spi/spi-cadence.c |
1486 |
+index 1d0c335b0bf88..5ac60d06c674d 100644 |
1487 |
+--- a/drivers/spi/spi-cadence.c |
1488 |
++++ b/drivers/spi/spi-cadence.c |
1489 |
+@@ -517,6 +517,12 @@ static int cdns_spi_probe(struct platform_device *pdev) |
1490 |
+ goto clk_dis_apb; |
1491 |
+ } |
1492 |
+ |
1493 |
++ pm_runtime_use_autosuspend(&pdev->dev); |
1494 |
++ pm_runtime_set_autosuspend_delay(&pdev->dev, SPI_AUTOSUSPEND_TIMEOUT); |
1495 |
++ pm_runtime_get_noresume(&pdev->dev); |
1496 |
++ pm_runtime_set_active(&pdev->dev); |
1497 |
++ pm_runtime_enable(&pdev->dev); |
1498 |
++ |
1499 |
+ ret = of_property_read_u32(pdev->dev.of_node, "num-cs", &num_cs); |
1500 |
+ if (ret < 0) |
1501 |
+ master->num_chipselect = CDNS_SPI_DEFAULT_NUM_CS; |
1502 |
+@@ -531,11 +537,6 @@ static int cdns_spi_probe(struct platform_device *pdev) |
1503 |
+ /* SPI controller initializations */ |
1504 |
+ cdns_spi_init_hw(xspi); |
1505 |
+ |
1506 |
+- pm_runtime_set_active(&pdev->dev); |
1507 |
+- pm_runtime_enable(&pdev->dev); |
1508 |
+- pm_runtime_use_autosuspend(&pdev->dev); |
1509 |
+- pm_runtime_set_autosuspend_delay(&pdev->dev, SPI_AUTOSUSPEND_TIMEOUT); |
1510 |
+- |
1511 |
+ irq = platform_get_irq(pdev, 0); |
1512 |
+ if (irq <= 0) { |
1513 |
+ ret = -ENXIO; |
1514 |
+@@ -566,6 +567,9 @@ static int cdns_spi_probe(struct platform_device *pdev) |
1515 |
+ |
1516 |
+ master->bits_per_word_mask = SPI_BPW_MASK(8); |
1517 |
+ |
1518 |
++ pm_runtime_mark_last_busy(&pdev->dev); |
1519 |
++ pm_runtime_put_autosuspend(&pdev->dev); |
1520 |
++ |
1521 |
+ ret = spi_register_master(master); |
1522 |
+ if (ret) { |
1523 |
+ dev_err(&pdev->dev, "spi_register_master failed\n"); |
1524 |
+diff --git a/drivers/spi/spi-imx.c b/drivers/spi/spi-imx.c |
1525 |
+index 09c9a1edb2c6d..e237481dbbbbf 100644 |
1526 |
+--- a/drivers/spi/spi-imx.c |
1527 |
++++ b/drivers/spi/spi-imx.c |
1528 |
+@@ -64,8 +64,7 @@ struct spi_imx_data; |
1529 |
+ struct spi_imx_devtype_data { |
1530 |
+ void (*intctrl)(struct spi_imx_data *, int); |
1531 |
+ int (*prepare_message)(struct spi_imx_data *, struct spi_message *); |
1532 |
+- int (*prepare_transfer)(struct spi_imx_data *, struct spi_device *, |
1533 |
+- struct spi_transfer *); |
1534 |
++ int (*prepare_transfer)(struct spi_imx_data *, struct spi_device *); |
1535 |
+ void (*trigger)(struct spi_imx_data *); |
1536 |
+ int (*rx_available)(struct spi_imx_data *); |
1537 |
+ void (*reset)(struct spi_imx_data *); |
1538 |
+@@ -564,11 +563,10 @@ static int mx51_ecspi_prepare_message(struct spi_imx_data *spi_imx, |
1539 |
+ } |
1540 |
+ |
1541 |
+ static int mx51_ecspi_prepare_transfer(struct spi_imx_data *spi_imx, |
1542 |
+- struct spi_device *spi, |
1543 |
+- struct spi_transfer *t) |
1544 |
++ struct spi_device *spi) |
1545 |
+ { |
1546 |
+ u32 ctrl = readl(spi_imx->base + MX51_ECSPI_CTRL); |
1547 |
+- u32 clk = t->speed_hz, delay; |
1548 |
++ u32 clk, delay; |
1549 |
+ |
1550 |
+ /* Clear BL field and set the right value */ |
1551 |
+ ctrl &= ~MX51_ECSPI_CTRL_BL_MASK; |
1552 |
+@@ -582,7 +580,7 @@ static int mx51_ecspi_prepare_transfer(struct spi_imx_data *spi_imx, |
1553 |
+ /* set clock speed */ |
1554 |
+ ctrl &= ~(0xf << MX51_ECSPI_CTRL_POSTDIV_OFFSET | |
1555 |
+ 0xf << MX51_ECSPI_CTRL_PREDIV_OFFSET); |
1556 |
+- ctrl |= mx51_ecspi_clkdiv(spi_imx, t->speed_hz, &clk); |
1557 |
++ ctrl |= mx51_ecspi_clkdiv(spi_imx, spi_imx->spi_bus_clk, &clk); |
1558 |
+ spi_imx->spi_bus_clk = clk; |
1559 |
+ |
1560 |
+ if (spi_imx->usedma) |
1561 |
+@@ -694,13 +692,12 @@ static int mx31_prepare_message(struct spi_imx_data *spi_imx, |
1562 |
+ } |
1563 |
+ |
1564 |
+ static int mx31_prepare_transfer(struct spi_imx_data *spi_imx, |
1565 |
+- struct spi_device *spi, |
1566 |
+- struct spi_transfer *t) |
1567 |
++ struct spi_device *spi) |
1568 |
+ { |
1569 |
+ unsigned int reg = MX31_CSPICTRL_ENABLE | MX31_CSPICTRL_MASTER; |
1570 |
+ unsigned int clk; |
1571 |
+ |
1572 |
+- reg |= spi_imx_clkdiv_2(spi_imx->spi_clk, t->speed_hz, &clk) << |
1573 |
++ reg |= spi_imx_clkdiv_2(spi_imx->spi_clk, spi_imx->spi_bus_clk, &clk) << |
1574 |
+ MX31_CSPICTRL_DR_SHIFT; |
1575 |
+ spi_imx->spi_bus_clk = clk; |
1576 |
+ |
1577 |
+@@ -799,14 +796,13 @@ static int mx21_prepare_message(struct spi_imx_data *spi_imx, |
1578 |
+ } |
1579 |
+ |
1580 |
+ static int mx21_prepare_transfer(struct spi_imx_data *spi_imx, |
1581 |
+- struct spi_device *spi, |
1582 |
+- struct spi_transfer *t) |
1583 |
++ struct spi_device *spi) |
1584 |
+ { |
1585 |
+ unsigned int reg = MX21_CSPICTRL_ENABLE | MX21_CSPICTRL_MASTER; |
1586 |
+ unsigned int max = is_imx27_cspi(spi_imx) ? 16 : 18; |
1587 |
+ unsigned int clk; |
1588 |
+ |
1589 |
+- reg |= spi_imx_clkdiv_1(spi_imx->spi_clk, t->speed_hz, max, &clk) |
1590 |
++ reg |= spi_imx_clkdiv_1(spi_imx->spi_clk, spi_imx->spi_bus_clk, max, &clk) |
1591 |
+ << MX21_CSPICTRL_DR_SHIFT; |
1592 |
+ spi_imx->spi_bus_clk = clk; |
1593 |
+ |
1594 |
+@@ -875,13 +871,12 @@ static int mx1_prepare_message(struct spi_imx_data *spi_imx, |
1595 |
+ } |
1596 |
+ |
1597 |
+ static int mx1_prepare_transfer(struct spi_imx_data *spi_imx, |
1598 |
+- struct spi_device *spi, |
1599 |
+- struct spi_transfer *t) |
1600 |
++ struct spi_device *spi) |
1601 |
+ { |
1602 |
+ unsigned int reg = MX1_CSPICTRL_ENABLE | MX1_CSPICTRL_MASTER; |
1603 |
+ unsigned int clk; |
1604 |
+ |
1605 |
+- reg |= spi_imx_clkdiv_2(spi_imx->spi_clk, t->speed_hz, &clk) << |
1606 |
++ reg |= spi_imx_clkdiv_2(spi_imx->spi_clk, spi_imx->spi_bus_clk, &clk) << |
1607 |
+ MX1_CSPICTRL_DR_SHIFT; |
1608 |
+ spi_imx->spi_bus_clk = clk; |
1609 |
+ |
1610 |
+@@ -1199,6 +1194,16 @@ static int spi_imx_setupxfer(struct spi_device *spi, |
1611 |
+ if (!t) |
1612 |
+ return 0; |
1613 |
+ |
1614 |
++ if (!t->speed_hz) { |
1615 |
++ if (!spi->max_speed_hz) { |
1616 |
++ dev_err(&spi->dev, "no speed_hz provided!\n"); |
1617 |
++ return -EINVAL; |
1618 |
++ } |
1619 |
++ dev_dbg(&spi->dev, "using spi->max_speed_hz!\n"); |
1620 |
++ spi_imx->spi_bus_clk = spi->max_speed_hz; |
1621 |
++ } else |
1622 |
++ spi_imx->spi_bus_clk = t->speed_hz; |
1623 |
++ |
1624 |
+ spi_imx->bits_per_word = t->bits_per_word; |
1625 |
+ |
1626 |
+ /* |
1627 |
+@@ -1240,7 +1245,7 @@ static int spi_imx_setupxfer(struct spi_device *spi, |
1628 |
+ spi_imx->slave_burst = t->len; |
1629 |
+ } |
1630 |
+ |
1631 |
+- spi_imx->devtype_data->prepare_transfer(spi_imx, spi, t); |
1632 |
++ spi_imx->devtype_data->prepare_transfer(spi_imx, spi); |
1633 |
+ |
1634 |
+ return 0; |
1635 |
+ } |
1636 |
+diff --git a/drivers/spi/spi-mt65xx.c b/drivers/spi/spi-mt65xx.c |
1637 |
+index 8acf24f7c5d40..81eac9fbd08cb 100644 |
1638 |
+--- a/drivers/spi/spi-mt65xx.c |
1639 |
++++ b/drivers/spi/spi-mt65xx.c |
1640 |
+@@ -427,13 +427,23 @@ static int mtk_spi_fifo_transfer(struct spi_master *master, |
1641 |
+ mtk_spi_setup_packet(master); |
1642 |
+ |
1643 |
+ cnt = xfer->len / 4; |
1644 |
+- iowrite32_rep(mdata->base + SPI_TX_DATA_REG, xfer->tx_buf, cnt); |
1645 |
++ if (xfer->tx_buf) |
1646 |
++ iowrite32_rep(mdata->base + SPI_TX_DATA_REG, xfer->tx_buf, cnt); |
1647 |
++ |
1648 |
++ if (xfer->rx_buf) |
1649 |
++ ioread32_rep(mdata->base + SPI_RX_DATA_REG, xfer->rx_buf, cnt); |
1650 |
+ |
1651 |
+ remainder = xfer->len % 4; |
1652 |
+ if (remainder > 0) { |
1653 |
+ reg_val = 0; |
1654 |
+- memcpy(®_val, xfer->tx_buf + (cnt * 4), remainder); |
1655 |
+- writel(reg_val, mdata->base + SPI_TX_DATA_REG); |
1656 |
++ if (xfer->tx_buf) { |
1657 |
++ memcpy(®_val, xfer->tx_buf + (cnt * 4), remainder); |
1658 |
++ writel(reg_val, mdata->base + SPI_TX_DATA_REG); |
1659 |
++ } |
1660 |
++ if (xfer->rx_buf) { |
1661 |
++ reg_val = readl(mdata->base + SPI_RX_DATA_REG); |
1662 |
++ memcpy(xfer->rx_buf + (cnt * 4), ®_val, remainder); |
1663 |
++ } |
1664 |
+ } |
1665 |
+ |
1666 |
+ mtk_spi_enable_transfer(master); |
1667 |
+diff --git a/drivers/spi/spi-stm32.c b/drivers/spi/spi-stm32.c |
1668 |
+index 3af6a5a3a4b29..e9d48e94f5edb 100644 |
1669 |
+--- a/drivers/spi/spi-stm32.c |
1670 |
++++ b/drivers/spi/spi-stm32.c |
1671 |
+@@ -1908,35 +1908,48 @@ static int stm32_spi_probe(struct platform_device *pdev) |
1672 |
+ master->transfer_one = stm32_spi_transfer_one; |
1673 |
+ master->unprepare_message = stm32_spi_unprepare_msg; |
1674 |
+ |
1675 |
+- spi->dma_tx = dma_request_slave_channel(spi->dev, "tx"); |
1676 |
+- if (!spi->dma_tx) |
1677 |
++ spi->dma_tx = dma_request_chan(spi->dev, "tx"); |
1678 |
++ if (IS_ERR(spi->dma_tx)) { |
1679 |
++ ret = PTR_ERR(spi->dma_tx); |
1680 |
++ spi->dma_tx = NULL; |
1681 |
++ if (ret == -EPROBE_DEFER) |
1682 |
++ goto err_clk_disable; |
1683 |
++ |
1684 |
+ dev_warn(&pdev->dev, "failed to request tx dma channel\n"); |
1685 |
+- else |
1686 |
++ } else { |
1687 |
+ master->dma_tx = spi->dma_tx; |
1688 |
++ } |
1689 |
++ |
1690 |
++ spi->dma_rx = dma_request_chan(spi->dev, "rx"); |
1691 |
++ if (IS_ERR(spi->dma_rx)) { |
1692 |
++ ret = PTR_ERR(spi->dma_rx); |
1693 |
++ spi->dma_rx = NULL; |
1694 |
++ if (ret == -EPROBE_DEFER) |
1695 |
++ goto err_dma_release; |
1696 |
+ |
1697 |
+- spi->dma_rx = dma_request_slave_channel(spi->dev, "rx"); |
1698 |
+- if (!spi->dma_rx) |
1699 |
+ dev_warn(&pdev->dev, "failed to request rx dma channel\n"); |
1700 |
+- else |
1701 |
++ } else { |
1702 |
+ master->dma_rx = spi->dma_rx; |
1703 |
++ } |
1704 |
+ |
1705 |
+ if (spi->dma_tx || spi->dma_rx) |
1706 |
+ master->can_dma = stm32_spi_can_dma; |
1707 |
+ |
1708 |
+ pm_runtime_set_active(&pdev->dev); |
1709 |
++ pm_runtime_get_noresume(&pdev->dev); |
1710 |
+ pm_runtime_enable(&pdev->dev); |
1711 |
+ |
1712 |
+ ret = spi_register_master(master); |
1713 |
+ if (ret) { |
1714 |
+ dev_err(&pdev->dev, "spi master registration failed: %d\n", |
1715 |
+ ret); |
1716 |
+- goto err_dma_release; |
1717 |
++ goto err_pm_disable; |
1718 |
+ } |
1719 |
+ |
1720 |
+ if (!master->cs_gpios) { |
1721 |
+ dev_err(&pdev->dev, "no CS gpios available\n"); |
1722 |
+ ret = -EINVAL; |
1723 |
+- goto err_dma_release; |
1724 |
++ goto err_pm_disable; |
1725 |
+ } |
1726 |
+ |
1727 |
+ for (i = 0; i < master->num_chipselect; i++) { |
1728 |
+@@ -1960,13 +1973,15 @@ static int stm32_spi_probe(struct platform_device *pdev) |
1729 |
+ |
1730 |
+ return 0; |
1731 |
+ |
1732 |
++err_pm_disable: |
1733 |
++ pm_runtime_disable(&pdev->dev); |
1734 |
++ pm_runtime_put_noidle(&pdev->dev); |
1735 |
++ pm_runtime_set_suspended(&pdev->dev); |
1736 |
+ err_dma_release: |
1737 |
+ if (spi->dma_tx) |
1738 |
+ dma_release_channel(spi->dma_tx); |
1739 |
+ if (spi->dma_rx) |
1740 |
+ dma_release_channel(spi->dma_rx); |
1741 |
+- |
1742 |
+- pm_runtime_disable(&pdev->dev); |
1743 |
+ err_clk_disable: |
1744 |
+ clk_disable_unprepare(spi->clk); |
1745 |
+ err_master_put: |
1746 |
+@@ -1980,9 +1995,14 @@ static int stm32_spi_remove(struct platform_device *pdev) |
1747 |
+ struct spi_master *master = platform_get_drvdata(pdev); |
1748 |
+ struct stm32_spi *spi = spi_master_get_devdata(master); |
1749 |
+ |
1750 |
++ pm_runtime_get_sync(&pdev->dev); |
1751 |
++ |
1752 |
+ spi_unregister_master(master); |
1753 |
+ spi->cfg->disable(spi); |
1754 |
+ |
1755 |
++ pm_runtime_disable(&pdev->dev); |
1756 |
++ pm_runtime_put_noidle(&pdev->dev); |
1757 |
++ pm_runtime_set_suspended(&pdev->dev); |
1758 |
+ if (master->dma_tx) |
1759 |
+ dma_release_channel(master->dma_tx); |
1760 |
+ if (master->dma_rx) |
1761 |
+@@ -1990,7 +2010,6 @@ static int stm32_spi_remove(struct platform_device *pdev) |
1762 |
+ |
1763 |
+ clk_disable_unprepare(spi->clk); |
1764 |
+ |
1765 |
+- pm_runtime_disable(&pdev->dev); |
1766 |
+ |
1767 |
+ pinctrl_pm_select_sleep_state(&pdev->dev); |
1768 |
+ |
1769 |
+diff --git a/drivers/target/target_core_sbc.c b/drivers/target/target_core_sbc.c |
1770 |
+index f1e81886122d0..e63c163dba788 100644 |
1771 |
+--- a/drivers/target/target_core_sbc.c |
1772 |
++++ b/drivers/target/target_core_sbc.c |
1773 |
+@@ -25,7 +25,7 @@ |
1774 |
+ #include "target_core_alua.h" |
1775 |
+ |
1776 |
+ static sense_reason_t |
1777 |
+-sbc_check_prot(struct se_device *, struct se_cmd *, unsigned char *, u32, bool); |
1778 |
++sbc_check_prot(struct se_device *, struct se_cmd *, unsigned char, u32, bool); |
1779 |
+ static sense_reason_t sbc_execute_unmap(struct se_cmd *cmd); |
1780 |
+ |
1781 |
+ static sense_reason_t |
1782 |
+@@ -279,14 +279,14 @@ static inline unsigned long long transport_lba_64_ext(unsigned char *cdb) |
1783 |
+ } |
1784 |
+ |
1785 |
+ static sense_reason_t |
1786 |
+-sbc_setup_write_same(struct se_cmd *cmd, unsigned char *flags, struct sbc_ops *ops) |
1787 |
++sbc_setup_write_same(struct se_cmd *cmd, unsigned char flags, struct sbc_ops *ops) |
1788 |
+ { |
1789 |
+ struct se_device *dev = cmd->se_dev; |
1790 |
+ sector_t end_lba = dev->transport->get_blocks(dev) + 1; |
1791 |
+ unsigned int sectors = sbc_get_write_same_sectors(cmd); |
1792 |
+ sense_reason_t ret; |
1793 |
+ |
1794 |
+- if ((flags[0] & 0x04) || (flags[0] & 0x02)) { |
1795 |
++ if ((flags & 0x04) || (flags & 0x02)) { |
1796 |
+ pr_err("WRITE_SAME PBDATA and LBDATA" |
1797 |
+ " bits not supported for Block Discard" |
1798 |
+ " Emulation\n"); |
1799 |
+@@ -308,7 +308,7 @@ sbc_setup_write_same(struct se_cmd *cmd, unsigned char *flags, struct sbc_ops *o |
1800 |
+ } |
1801 |
+ |
1802 |
+ /* We always have ANC_SUP == 0 so setting ANCHOR is always an error */ |
1803 |
+- if (flags[0] & 0x10) { |
1804 |
++ if (flags & 0x10) { |
1805 |
+ pr_warn("WRITE SAME with ANCHOR not supported\n"); |
1806 |
+ return TCM_INVALID_CDB_FIELD; |
1807 |
+ } |
1808 |
+@@ -316,7 +316,7 @@ sbc_setup_write_same(struct se_cmd *cmd, unsigned char *flags, struct sbc_ops *o |
1809 |
+ * Special case for WRITE_SAME w/ UNMAP=1 that ends up getting |
1810 |
+ * translated into block discard requests within backend code. |
1811 |
+ */ |
1812 |
+- if (flags[0] & 0x08) { |
1813 |
++ if (flags & 0x08) { |
1814 |
+ if (!ops->execute_unmap) |
1815 |
+ return TCM_UNSUPPORTED_SCSI_OPCODE; |
1816 |
+ |
1817 |
+@@ -331,7 +331,7 @@ sbc_setup_write_same(struct se_cmd *cmd, unsigned char *flags, struct sbc_ops *o |
1818 |
+ if (!ops->execute_write_same) |
1819 |
+ return TCM_UNSUPPORTED_SCSI_OPCODE; |
1820 |
+ |
1821 |
+- ret = sbc_check_prot(dev, cmd, &cmd->t_task_cdb[0], sectors, true); |
1822 |
++ ret = sbc_check_prot(dev, cmd, flags >> 5, sectors, true); |
1823 |
+ if (ret) |
1824 |
+ return ret; |
1825 |
+ |
1826 |
+@@ -686,10 +686,9 @@ sbc_set_prot_op_checks(u8 protect, bool fabric_prot, enum target_prot_type prot_ |
1827 |
+ } |
1828 |
+ |
1829 |
+ static sense_reason_t |
1830 |
+-sbc_check_prot(struct se_device *dev, struct se_cmd *cmd, unsigned char *cdb, |
1831 |
++sbc_check_prot(struct se_device *dev, struct se_cmd *cmd, unsigned char protect, |
1832 |
+ u32 sectors, bool is_write) |
1833 |
+ { |
1834 |
+- u8 protect = cdb[1] >> 5; |
1835 |
+ int sp_ops = cmd->se_sess->sup_prot_ops; |
1836 |
+ int pi_prot_type = dev->dev_attrib.pi_prot_type; |
1837 |
+ bool fabric_prot = false; |
1838 |
+@@ -737,7 +736,7 @@ sbc_check_prot(struct se_device *dev, struct se_cmd *cmd, unsigned char *cdb, |
1839 |
+ /* Fallthrough */ |
1840 |
+ default: |
1841 |
+ pr_err("Unable to determine pi_prot_type for CDB: 0x%02x " |
1842 |
+- "PROTECT: 0x%02x\n", cdb[0], protect); |
1843 |
++ "PROTECT: 0x%02x\n", cmd->t_task_cdb[0], protect); |
1844 |
+ return TCM_INVALID_CDB_FIELD; |
1845 |
+ } |
1846 |
+ |
1847 |
+@@ -812,7 +811,7 @@ sbc_parse_cdb(struct se_cmd *cmd, struct sbc_ops *ops) |
1848 |
+ if (sbc_check_dpofua(dev, cmd, cdb)) |
1849 |
+ return TCM_INVALID_CDB_FIELD; |
1850 |
+ |
1851 |
+- ret = sbc_check_prot(dev, cmd, cdb, sectors, false); |
1852 |
++ ret = sbc_check_prot(dev, cmd, cdb[1] >> 5, sectors, false); |
1853 |
+ if (ret) |
1854 |
+ return ret; |
1855 |
+ |
1856 |
+@@ -826,7 +825,7 @@ sbc_parse_cdb(struct se_cmd *cmd, struct sbc_ops *ops) |
1857 |
+ if (sbc_check_dpofua(dev, cmd, cdb)) |
1858 |
+ return TCM_INVALID_CDB_FIELD; |
1859 |
+ |
1860 |
+- ret = sbc_check_prot(dev, cmd, cdb, sectors, false); |
1861 |
++ ret = sbc_check_prot(dev, cmd, cdb[1] >> 5, sectors, false); |
1862 |
+ if (ret) |
1863 |
+ return ret; |
1864 |
+ |
1865 |
+@@ -840,7 +839,7 @@ sbc_parse_cdb(struct se_cmd *cmd, struct sbc_ops *ops) |
1866 |
+ if (sbc_check_dpofua(dev, cmd, cdb)) |
1867 |
+ return TCM_INVALID_CDB_FIELD; |
1868 |
+ |
1869 |
+- ret = sbc_check_prot(dev, cmd, cdb, sectors, false); |
1870 |
++ ret = sbc_check_prot(dev, cmd, cdb[1] >> 5, sectors, false); |
1871 |
+ if (ret) |
1872 |
+ return ret; |
1873 |
+ |
1874 |
+@@ -861,7 +860,7 @@ sbc_parse_cdb(struct se_cmd *cmd, struct sbc_ops *ops) |
1875 |
+ if (sbc_check_dpofua(dev, cmd, cdb)) |
1876 |
+ return TCM_INVALID_CDB_FIELD; |
1877 |
+ |
1878 |
+- ret = sbc_check_prot(dev, cmd, cdb, sectors, true); |
1879 |
++ ret = sbc_check_prot(dev, cmd, cdb[1] >> 5, sectors, true); |
1880 |
+ if (ret) |
1881 |
+ return ret; |
1882 |
+ |
1883 |
+@@ -875,7 +874,7 @@ sbc_parse_cdb(struct se_cmd *cmd, struct sbc_ops *ops) |
1884 |
+ if (sbc_check_dpofua(dev, cmd, cdb)) |
1885 |
+ return TCM_INVALID_CDB_FIELD; |
1886 |
+ |
1887 |
+- ret = sbc_check_prot(dev, cmd, cdb, sectors, true); |
1888 |
++ ret = sbc_check_prot(dev, cmd, cdb[1] >> 5, sectors, true); |
1889 |
+ if (ret) |
1890 |
+ return ret; |
1891 |
+ |
1892 |
+@@ -890,7 +889,7 @@ sbc_parse_cdb(struct se_cmd *cmd, struct sbc_ops *ops) |
1893 |
+ if (sbc_check_dpofua(dev, cmd, cdb)) |
1894 |
+ return TCM_INVALID_CDB_FIELD; |
1895 |
+ |
1896 |
+- ret = sbc_check_prot(dev, cmd, cdb, sectors, true); |
1897 |
++ ret = sbc_check_prot(dev, cmd, cdb[1] >> 5, sectors, true); |
1898 |
+ if (ret) |
1899 |
+ return ret; |
1900 |
+ |
1901 |
+@@ -949,7 +948,7 @@ sbc_parse_cdb(struct se_cmd *cmd, struct sbc_ops *ops) |
1902 |
+ size = sbc_get_size(cmd, 1); |
1903 |
+ cmd->t_task_lba = get_unaligned_be64(&cdb[12]); |
1904 |
+ |
1905 |
+- ret = sbc_setup_write_same(cmd, &cdb[10], ops); |
1906 |
++ ret = sbc_setup_write_same(cmd, cdb[10], ops); |
1907 |
+ if (ret) |
1908 |
+ return ret; |
1909 |
+ break; |
1910 |
+@@ -1048,7 +1047,7 @@ sbc_parse_cdb(struct se_cmd *cmd, struct sbc_ops *ops) |
1911 |
+ size = sbc_get_size(cmd, 1); |
1912 |
+ cmd->t_task_lba = get_unaligned_be64(&cdb[2]); |
1913 |
+ |
1914 |
+- ret = sbc_setup_write_same(cmd, &cdb[1], ops); |
1915 |
++ ret = sbc_setup_write_same(cmd, cdb[1], ops); |
1916 |
+ if (ret) |
1917 |
+ return ret; |
1918 |
+ break; |
1919 |
+@@ -1066,7 +1065,7 @@ sbc_parse_cdb(struct se_cmd *cmd, struct sbc_ops *ops) |
1920 |
+ * Follow sbcr26 with WRITE_SAME (10) and check for the existence |
1921 |
+ * of byte 1 bit 3 UNMAP instead of original reserved field |
1922 |
+ */ |
1923 |
+- ret = sbc_setup_write_same(cmd, &cdb[1], ops); |
1924 |
++ ret = sbc_setup_write_same(cmd, cdb[1], ops); |
1925 |
+ if (ret) |
1926 |
+ return ret; |
1927 |
+ break; |
1928 |
+diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c |
1929 |
+index 3a2d9318604bb..303e8b3c1bdae 100644 |
1930 |
+--- a/drivers/usb/core/hub.c |
1931 |
++++ b/drivers/usb/core/hub.c |
1932 |
+@@ -46,6 +46,7 @@ |
1933 |
+ |
1934 |
+ #define USB_TP_TRANSMISSION_DELAY 40 /* ns */ |
1935 |
+ #define USB_TP_TRANSMISSION_DELAY_MAX 65535 /* ns */ |
1936 |
++#define USB_PING_RESPONSE_TIME 400 /* ns */ |
1937 |
+ |
1938 |
+ /* Protect struct usb_device->state and ->children members |
1939 |
+ * Note: Both are also protected by ->dev.sem, except that ->state can |
1940 |
+@@ -180,8 +181,9 @@ int usb_device_supports_lpm(struct usb_device *udev) |
1941 |
+ } |
1942 |
+ |
1943 |
+ /* |
1944 |
+- * Set the Maximum Exit Latency (MEL) for the host to initiate a transition from |
1945 |
+- * either U1 or U2. |
1946 |
++ * Set the Maximum Exit Latency (MEL) for the host to wakup up the path from |
1947 |
++ * U1/U2, send a PING to the device and receive a PING_RESPONSE. |
1948 |
++ * See USB 3.1 section C.1.5.2 |
1949 |
+ */ |
1950 |
+ static void usb_set_lpm_mel(struct usb_device *udev, |
1951 |
+ struct usb3_lpm_parameters *udev_lpm_params, |
1952 |
+@@ -191,35 +193,37 @@ static void usb_set_lpm_mel(struct usb_device *udev, |
1953 |
+ unsigned int hub_exit_latency) |
1954 |
+ { |
1955 |
+ unsigned int total_mel; |
1956 |
+- unsigned int device_mel; |
1957 |
+- unsigned int hub_mel; |
1958 |
+ |
1959 |
+ /* |
1960 |
+- * Calculate the time it takes to transition all links from the roothub |
1961 |
+- * to the parent hub into U0. The parent hub must then decode the |
1962 |
+- * packet (hub header decode latency) to figure out which port it was |
1963 |
+- * bound for. |
1964 |
+- * |
1965 |
+- * The Hub Header decode latency is expressed in 0.1us intervals (0x1 |
1966 |
+- * means 0.1us). Multiply that by 100 to get nanoseconds. |
1967 |
++ * tMEL1. time to transition path from host to device into U0. |
1968 |
++ * MEL for parent already contains the delay up to parent, so only add |
1969 |
++ * the exit latency for the last link (pick the slower exit latency), |
1970 |
++ * and the hub header decode latency. See USB 3.1 section C 2.2.1 |
1971 |
++ * Store MEL in nanoseconds |
1972 |
+ */ |
1973 |
+ total_mel = hub_lpm_params->mel + |
1974 |
+- (hub->descriptor->u.ss.bHubHdrDecLat * 100); |
1975 |
++ max(udev_exit_latency, hub_exit_latency) * 1000 + |
1976 |
++ hub->descriptor->u.ss.bHubHdrDecLat * 100; |
1977 |
+ |
1978 |
+ /* |
1979 |
+- * How long will it take to transition the downstream hub's port into |
1980 |
+- * U0? The greater of either the hub exit latency or the device exit |
1981 |
+- * latency. |
1982 |
+- * |
1983 |
+- * The BOS U1/U2 exit latencies are expressed in 1us intervals. |
1984 |
+- * Multiply that by 1000 to get nanoseconds. |
1985 |
++ * tMEL2. Time to submit PING packet. Sum of tTPTransmissionDelay for |
1986 |
++ * each link + wHubDelay for each hub. Add only for last link. |
1987 |
++ * tMEL4, the time for PING_RESPONSE to traverse upstream is similar. |
1988 |
++ * Multiply by 2 to include it as well. |
1989 |
+ */ |
1990 |
+- device_mel = udev_exit_latency * 1000; |
1991 |
+- hub_mel = hub_exit_latency * 1000; |
1992 |
+- if (device_mel > hub_mel) |
1993 |
+- total_mel += device_mel; |
1994 |
+- else |
1995 |
+- total_mel += hub_mel; |
1996 |
++ total_mel += (__le16_to_cpu(hub->descriptor->u.ss.wHubDelay) + |
1997 |
++ USB_TP_TRANSMISSION_DELAY) * 2; |
1998 |
++ |
1999 |
++ /* |
2000 |
++ * tMEL3, tPingResponse. Time taken by device to generate PING_RESPONSE |
2001 |
++ * after receiving PING. Also add 2100ns as stated in USB 3.1 C 1.5.2.4 |
2002 |
++ * to cover the delay if the PING_RESPONSE is queued behind a Max Packet |
2003 |
++ * Size DP. |
2004 |
++ * Note these delays should be added only once for the entire path, so |
2005 |
++ * add them to the MEL of the device connected to the roothub. |
2006 |
++ */ |
2007 |
++ if (!hub->hdev->parent) |
2008 |
++ total_mel += USB_PING_RESPONSE_TIME + 2100; |
2009 |
+ |
2010 |
+ udev_lpm_params->mel = total_mel; |
2011 |
+ } |
2012 |
+@@ -4022,6 +4026,47 @@ static int usb_set_lpm_timeout(struct usb_device *udev, |
2013 |
+ return 0; |
2014 |
+ } |
2015 |
+ |
2016 |
++/* |
2017 |
++ * Don't allow device intiated U1/U2 if the system exit latency + one bus |
2018 |
++ * interval is greater than the minimum service interval of any active |
2019 |
++ * periodic endpoint. See USB 3.2 section 9.4.9 |
2020 |
++ */ |
2021 |
++static bool usb_device_may_initiate_lpm(struct usb_device *udev, |
2022 |
++ enum usb3_link_state state) |
2023 |
++{ |
2024 |
++ unsigned int sel; /* us */ |
2025 |
++ int i, j; |
2026 |
++ |
2027 |
++ if (state == USB3_LPM_U1) |
2028 |
++ sel = DIV_ROUND_UP(udev->u1_params.sel, 1000); |
2029 |
++ else if (state == USB3_LPM_U2) |
2030 |
++ sel = DIV_ROUND_UP(udev->u2_params.sel, 1000); |
2031 |
++ else |
2032 |
++ return false; |
2033 |
++ |
2034 |
++ for (i = 0; i < udev->actconfig->desc.bNumInterfaces; i++) { |
2035 |
++ struct usb_interface *intf; |
2036 |
++ struct usb_endpoint_descriptor *desc; |
2037 |
++ unsigned int interval; |
2038 |
++ |
2039 |
++ intf = udev->actconfig->interface[i]; |
2040 |
++ if (!intf) |
2041 |
++ continue; |
2042 |
++ |
2043 |
++ for (j = 0; j < intf->cur_altsetting->desc.bNumEndpoints; j++) { |
2044 |
++ desc = &intf->cur_altsetting->endpoint[j].desc; |
2045 |
++ |
2046 |
++ if (usb_endpoint_xfer_int(desc) || |
2047 |
++ usb_endpoint_xfer_isoc(desc)) { |
2048 |
++ interval = (1 << (desc->bInterval - 1)) * 125; |
2049 |
++ if (sel + 125 > interval) |
2050 |
++ return false; |
2051 |
++ } |
2052 |
++ } |
2053 |
++ } |
2054 |
++ return true; |
2055 |
++} |
2056 |
++ |
2057 |
+ /* |
2058 |
+ * Enable the hub-initiated U1/U2 idle timeouts, and enable device-initiated |
2059 |
+ * U1/U2 entry. |
2060 |
+@@ -4094,20 +4139,23 @@ static void usb_enable_link_state(struct usb_hcd *hcd, struct usb_device *udev, |
2061 |
+ * U1/U2_ENABLE |
2062 |
+ */ |
2063 |
+ if (udev->actconfig && |
2064 |
+- usb_set_device_initiated_lpm(udev, state, true) == 0) { |
2065 |
+- if (state == USB3_LPM_U1) |
2066 |
+- udev->usb3_lpm_u1_enabled = 1; |
2067 |
+- else if (state == USB3_LPM_U2) |
2068 |
+- udev->usb3_lpm_u2_enabled = 1; |
2069 |
+- } else { |
2070 |
+- /* Don't request U1/U2 entry if the device |
2071 |
+- * cannot transition to U1/U2. |
2072 |
+- */ |
2073 |
+- usb_set_lpm_timeout(udev, state, 0); |
2074 |
+- hcd->driver->disable_usb3_lpm_timeout(hcd, udev, state); |
2075 |
++ usb_device_may_initiate_lpm(udev, state)) { |
2076 |
++ if (usb_set_device_initiated_lpm(udev, state, true)) { |
2077 |
++ /* |
2078 |
++ * Request to enable device initiated U1/U2 failed, |
2079 |
++ * better to turn off lpm in this case. |
2080 |
++ */ |
2081 |
++ usb_set_lpm_timeout(udev, state, 0); |
2082 |
++ hcd->driver->disable_usb3_lpm_timeout(hcd, udev, state); |
2083 |
++ return; |
2084 |
++ } |
2085 |
+ } |
2086 |
+-} |
2087 |
+ |
2088 |
++ if (state == USB3_LPM_U1) |
2089 |
++ udev->usb3_lpm_u1_enabled = 1; |
2090 |
++ else if (state == USB3_LPM_U2) |
2091 |
++ udev->usb3_lpm_u2_enabled = 1; |
2092 |
++} |
2093 |
+ /* |
2094 |
+ * Disable the hub-initiated U1/U2 idle timeouts, and disable device-initiated |
2095 |
+ * U1/U2 entry. |
2096 |
+diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c |
2097 |
+index f6a6c54cba35f..d97544fd339b1 100644 |
2098 |
+--- a/drivers/usb/core/quirks.c |
2099 |
++++ b/drivers/usb/core/quirks.c |
2100 |
+@@ -502,10 +502,6 @@ static const struct usb_device_id usb_quirk_list[] = { |
2101 |
+ /* DJI CineSSD */ |
2102 |
+ { USB_DEVICE(0x2ca3, 0x0031), .driver_info = USB_QUIRK_NO_LPM }, |
2103 |
+ |
2104 |
+- /* Fibocom L850-GL LTE Modem */ |
2105 |
+- { USB_DEVICE(0x2cb7, 0x0007), .driver_info = |
2106 |
+- USB_QUIRK_IGNORE_REMOTE_WAKEUP }, |
2107 |
+- |
2108 |
+ /* INTEL VALUE SSD */ |
2109 |
+ { USB_DEVICE(0x8086, 0xf1a5), .driver_info = USB_QUIRK_RESET_RESUME }, |
2110 |
+ |
2111 |
+diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c |
2112 |
+index 566bc1e604af4..66dfcdbd1e03a 100644 |
2113 |
+--- a/drivers/usb/dwc2/gadget.c |
2114 |
++++ b/drivers/usb/dwc2/gadget.c |
2115 |
+@@ -2748,12 +2748,14 @@ static void dwc2_hsotg_complete_in(struct dwc2_hsotg *hsotg, |
2116 |
+ return; |
2117 |
+ } |
2118 |
+ |
2119 |
+- /* Zlp for all endpoints, for ep0 only in DATA IN stage */ |
2120 |
++ /* Zlp for all endpoints in non DDMA, for ep0 only in DATA IN stage */ |
2121 |
+ if (hs_ep->send_zlp) { |
2122 |
+- dwc2_hsotg_program_zlp(hsotg, hs_ep); |
2123 |
+ hs_ep->send_zlp = 0; |
2124 |
+- /* transfer will be completed on next complete interrupt */ |
2125 |
+- return; |
2126 |
++ if (!using_desc_dma(hsotg)) { |
2127 |
++ dwc2_hsotg_program_zlp(hsotg, hs_ep); |
2128 |
++ /* transfer will be completed on next complete interrupt */ |
2129 |
++ return; |
2130 |
++ } |
2131 |
+ } |
2132 |
+ |
2133 |
+ if (hs_ep->index == 0 && hsotg->ep0_state == DWC2_EP0_DATA_IN) { |
2134 |
+diff --git a/drivers/usb/host/max3421-hcd.c b/drivers/usb/host/max3421-hcd.c |
2135 |
+index 903abdf30b5a0..5ef0747225f6b 100644 |
2136 |
+--- a/drivers/usb/host/max3421-hcd.c |
2137 |
++++ b/drivers/usb/host/max3421-hcd.c |
2138 |
+@@ -153,8 +153,6 @@ struct max3421_hcd { |
2139 |
+ */ |
2140 |
+ struct urb *curr_urb; |
2141 |
+ enum scheduling_pass sched_pass; |
2142 |
+- struct usb_device *loaded_dev; /* dev that's loaded into the chip */ |
2143 |
+- int loaded_epnum; /* epnum whose toggles are loaded */ |
2144 |
+ int urb_done; /* > 0 -> no errors, < 0: errno */ |
2145 |
+ size_t curr_len; |
2146 |
+ u8 hien; |
2147 |
+@@ -492,39 +490,17 @@ max3421_set_speed(struct usb_hcd *hcd, struct usb_device *dev) |
2148 |
+ * Caller must NOT hold HCD spinlock. |
2149 |
+ */ |
2150 |
+ static void |
2151 |
+-max3421_set_address(struct usb_hcd *hcd, struct usb_device *dev, int epnum, |
2152 |
+- int force_toggles) |
2153 |
++max3421_set_address(struct usb_hcd *hcd, struct usb_device *dev, int epnum) |
2154 |
+ { |
2155 |
+- struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd); |
2156 |
+- int old_epnum, same_ep, rcvtog, sndtog; |
2157 |
+- struct usb_device *old_dev; |
2158 |
++ int rcvtog, sndtog; |
2159 |
+ u8 hctl; |
2160 |
+ |
2161 |
+- old_dev = max3421_hcd->loaded_dev; |
2162 |
+- old_epnum = max3421_hcd->loaded_epnum; |
2163 |
+- |
2164 |
+- same_ep = (dev == old_dev && epnum == old_epnum); |
2165 |
+- if (same_ep && !force_toggles) |
2166 |
+- return; |
2167 |
+- |
2168 |
+- if (old_dev && !same_ep) { |
2169 |
+- /* save the old end-points toggles: */ |
2170 |
+- u8 hrsl = spi_rd8(hcd, MAX3421_REG_HRSL); |
2171 |
+- |
2172 |
+- rcvtog = (hrsl >> MAX3421_HRSL_RCVTOGRD_BIT) & 1; |
2173 |
+- sndtog = (hrsl >> MAX3421_HRSL_SNDTOGRD_BIT) & 1; |
2174 |
+- |
2175 |
+- /* no locking: HCD (i.e., we) own toggles, don't we? */ |
2176 |
+- usb_settoggle(old_dev, old_epnum, 0, rcvtog); |
2177 |
+- usb_settoggle(old_dev, old_epnum, 1, sndtog); |
2178 |
+- } |
2179 |
+ /* setup new endpoint's toggle bits: */ |
2180 |
+ rcvtog = usb_gettoggle(dev, epnum, 0); |
2181 |
+ sndtog = usb_gettoggle(dev, epnum, 1); |
2182 |
+ hctl = (BIT(rcvtog + MAX3421_HCTL_RCVTOG0_BIT) | |
2183 |
+ BIT(sndtog + MAX3421_HCTL_SNDTOG0_BIT)); |
2184 |
+ |
2185 |
+- max3421_hcd->loaded_epnum = epnum; |
2186 |
+ spi_wr8(hcd, MAX3421_REG_HCTL, hctl); |
2187 |
+ |
2188 |
+ /* |
2189 |
+@@ -532,7 +508,6 @@ max3421_set_address(struct usb_hcd *hcd, struct usb_device *dev, int epnum, |
2190 |
+ * address-assignment so it's best to just always load the |
2191 |
+ * address whenever the end-point changed/was forced. |
2192 |
+ */ |
2193 |
+- max3421_hcd->loaded_dev = dev; |
2194 |
+ spi_wr8(hcd, MAX3421_REG_PERADDR, dev->devnum); |
2195 |
+ } |
2196 |
+ |
2197 |
+@@ -667,7 +642,7 @@ max3421_select_and_start_urb(struct usb_hcd *hcd) |
2198 |
+ struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd); |
2199 |
+ struct urb *urb, *curr_urb = NULL; |
2200 |
+ struct max3421_ep *max3421_ep; |
2201 |
+- int epnum, force_toggles = 0; |
2202 |
++ int epnum; |
2203 |
+ struct usb_host_endpoint *ep; |
2204 |
+ struct list_head *pos; |
2205 |
+ unsigned long flags; |
2206 |
+@@ -777,7 +752,6 @@ done: |
2207 |
+ usb_settoggle(urb->dev, epnum, 0, 1); |
2208 |
+ usb_settoggle(urb->dev, epnum, 1, 1); |
2209 |
+ max3421_ep->pkt_state = PKT_STATE_SETUP; |
2210 |
+- force_toggles = 1; |
2211 |
+ } else |
2212 |
+ max3421_ep->pkt_state = PKT_STATE_TRANSFER; |
2213 |
+ } |
2214 |
+@@ -785,7 +759,7 @@ done: |
2215 |
+ spin_unlock_irqrestore(&max3421_hcd->lock, flags); |
2216 |
+ |
2217 |
+ max3421_ep->last_active = max3421_hcd->frame_number; |
2218 |
+- max3421_set_address(hcd, urb->dev, epnum, force_toggles); |
2219 |
++ max3421_set_address(hcd, urb->dev, epnum); |
2220 |
+ max3421_set_speed(hcd, urb->dev); |
2221 |
+ max3421_next_transfer(hcd, 0); |
2222 |
+ return 1; |
2223 |
+@@ -1380,6 +1354,16 @@ max3421_urb_done(struct usb_hcd *hcd) |
2224 |
+ status = 0; |
2225 |
+ urb = max3421_hcd->curr_urb; |
2226 |
+ if (urb) { |
2227 |
++ /* save the old end-points toggles: */ |
2228 |
++ u8 hrsl = spi_rd8(hcd, MAX3421_REG_HRSL); |
2229 |
++ int rcvtog = (hrsl >> MAX3421_HRSL_RCVTOGRD_BIT) & 1; |
2230 |
++ int sndtog = (hrsl >> MAX3421_HRSL_SNDTOGRD_BIT) & 1; |
2231 |
++ int epnum = usb_endpoint_num(&urb->ep->desc); |
2232 |
++ |
2233 |
++ /* no locking: HCD (i.e., we) own toggles, don't we? */ |
2234 |
++ usb_settoggle(urb->dev, epnum, 0, rcvtog); |
2235 |
++ usb_settoggle(urb->dev, epnum, 1, sndtog); |
2236 |
++ |
2237 |
+ max3421_hcd->curr_urb = NULL; |
2238 |
+ spin_lock_irqsave(&max3421_hcd->lock, flags); |
2239 |
+ usb_hcd_unlink_urb_from_ep(hcd, urb); |
2240 |
+diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c |
2241 |
+index 1a274f8a5bf11..6358d4e0653ed 100644 |
2242 |
+--- a/drivers/usb/host/xhci-hub.c |
2243 |
++++ b/drivers/usb/host/xhci-hub.c |
2244 |
+@@ -1546,11 +1546,12 @@ int xhci_hub_status_data(struct usb_hcd *hcd, char *buf) |
2245 |
+ * Inform the usbcore about resume-in-progress by returning |
2246 |
+ * a non-zero value even if there are no status changes. |
2247 |
+ */ |
2248 |
++ spin_lock_irqsave(&xhci->lock, flags); |
2249 |
++ |
2250 |
+ status = bus_state->resuming_ports; |
2251 |
+ |
2252 |
+ mask = PORT_CSC | PORT_PEC | PORT_OCC | PORT_PLC | PORT_WRC | PORT_CEC; |
2253 |
+ |
2254 |
+- spin_lock_irqsave(&xhci->lock, flags); |
2255 |
+ /* For each port, did anything change? If so, set that bit in buf. */ |
2256 |
+ for (i = 0; i < max_ports; i++) { |
2257 |
+ temp = readl(ports[i]->addr); |
2258 |
+diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c |
2259 |
+index f6b5010deb735..1228b3d92db06 100644 |
2260 |
+--- a/drivers/usb/host/xhci-ring.c |
2261 |
++++ b/drivers/usb/host/xhci-ring.c |
2262 |
+@@ -440,6 +440,26 @@ void xhci_ring_doorbell_for_active_rings(struct xhci_hcd *xhci, |
2263 |
+ ring_doorbell_for_active_rings(xhci, slot_id, ep_index); |
2264 |
+ } |
2265 |
+ |
2266 |
++static struct xhci_virt_ep *xhci_get_virt_ep(struct xhci_hcd *xhci, |
2267 |
++ unsigned int slot_id, |
2268 |
++ unsigned int ep_index) |
2269 |
++{ |
2270 |
++ if (slot_id == 0 || slot_id >= MAX_HC_SLOTS) { |
2271 |
++ xhci_warn(xhci, "Invalid slot_id %u\n", slot_id); |
2272 |
++ return NULL; |
2273 |
++ } |
2274 |
++ if (ep_index >= EP_CTX_PER_DEV) { |
2275 |
++ xhci_warn(xhci, "Invalid endpoint index %u\n", ep_index); |
2276 |
++ return NULL; |
2277 |
++ } |
2278 |
++ if (!xhci->devs[slot_id]) { |
2279 |
++ xhci_warn(xhci, "No xhci virt device for slot_id %u\n", slot_id); |
2280 |
++ return NULL; |
2281 |
++ } |
2282 |
++ |
2283 |
++ return &xhci->devs[slot_id]->eps[ep_index]; |
2284 |
++} |
2285 |
++ |
2286 |
+ /* Get the right ring for the given slot_id, ep_index and stream_id. |
2287 |
+ * If the endpoint supports streams, boundary check the URB's stream ID. |
2288 |
+ * If the endpoint doesn't support streams, return the singular endpoint ring. |
2289 |
+@@ -450,7 +470,10 @@ struct xhci_ring *xhci_triad_to_transfer_ring(struct xhci_hcd *xhci, |
2290 |
+ { |
2291 |
+ struct xhci_virt_ep *ep; |
2292 |
+ |
2293 |
+- ep = &xhci->devs[slot_id]->eps[ep_index]; |
2294 |
++ ep = xhci_get_virt_ep(xhci, slot_id, ep_index); |
2295 |
++ if (!ep) |
2296 |
++ return NULL; |
2297 |
++ |
2298 |
+ /* Common case: no streams */ |
2299 |
+ if (!(ep->ep_state & EP_HAS_STREAMS)) |
2300 |
+ return ep->ring; |
2301 |
+@@ -743,11 +766,14 @@ static void xhci_handle_cmd_stop_ep(struct xhci_hcd *xhci, int slot_id, |
2302 |
+ memset(&deq_state, 0, sizeof(deq_state)); |
2303 |
+ ep_index = TRB_TO_EP_INDEX(le32_to_cpu(trb->generic.field[3])); |
2304 |
+ |
2305 |
++ ep = xhci_get_virt_ep(xhci, slot_id, ep_index); |
2306 |
++ if (!ep) |
2307 |
++ return; |
2308 |
++ |
2309 |
+ vdev = xhci->devs[slot_id]; |
2310 |
+ ep_ctx = xhci_get_ep_ctx(xhci, vdev->out_ctx, ep_index); |
2311 |
+ trace_xhci_handle_cmd_stop_ep(ep_ctx); |
2312 |
+ |
2313 |
+- ep = &xhci->devs[slot_id]->eps[ep_index]; |
2314 |
+ last_unlinked_td = list_last_entry(&ep->cancelled_td_list, |
2315 |
+ struct xhci_td, cancelled_td_list); |
2316 |
+ |
2317 |
+@@ -1068,9 +1094,11 @@ static void xhci_handle_cmd_set_deq(struct xhci_hcd *xhci, int slot_id, |
2318 |
+ |
2319 |
+ ep_index = TRB_TO_EP_INDEX(le32_to_cpu(trb->generic.field[3])); |
2320 |
+ stream_id = TRB_TO_STREAM_ID(le32_to_cpu(trb->generic.field[2])); |
2321 |
+- dev = xhci->devs[slot_id]; |
2322 |
+- ep = &dev->eps[ep_index]; |
2323 |
++ ep = xhci_get_virt_ep(xhci, slot_id, ep_index); |
2324 |
++ if (!ep) |
2325 |
++ return; |
2326 |
+ |
2327 |
++ dev = xhci->devs[slot_id]; |
2328 |
+ ep_ring = xhci_stream_id_to_ring(dev, ep_index, stream_id); |
2329 |
+ if (!ep_ring) { |
2330 |
+ xhci_warn(xhci, "WARN Set TR deq ptr command for freed stream ID %u\n", |
2331 |
+@@ -1143,9 +1171,9 @@ static void xhci_handle_cmd_set_deq(struct xhci_hcd *xhci, int slot_id, |
2332 |
+ } |
2333 |
+ |
2334 |
+ cleanup: |
2335 |
+- dev->eps[ep_index].ep_state &= ~SET_DEQ_PENDING; |
2336 |
+- dev->eps[ep_index].queued_deq_seg = NULL; |
2337 |
+- dev->eps[ep_index].queued_deq_ptr = NULL; |
2338 |
++ ep->ep_state &= ~SET_DEQ_PENDING; |
2339 |
++ ep->queued_deq_seg = NULL; |
2340 |
++ ep->queued_deq_ptr = NULL; |
2341 |
+ /* Restart any rings with pending URBs */ |
2342 |
+ ring_doorbell_for_active_rings(xhci, slot_id, ep_index); |
2343 |
+ } |
2344 |
+@@ -1154,10 +1182,15 @@ static void xhci_handle_cmd_reset_ep(struct xhci_hcd *xhci, int slot_id, |
2345 |
+ union xhci_trb *trb, u32 cmd_comp_code) |
2346 |
+ { |
2347 |
+ struct xhci_virt_device *vdev; |
2348 |
++ struct xhci_virt_ep *ep; |
2349 |
+ struct xhci_ep_ctx *ep_ctx; |
2350 |
+ unsigned int ep_index; |
2351 |
+ |
2352 |
+ ep_index = TRB_TO_EP_INDEX(le32_to_cpu(trb->generic.field[3])); |
2353 |
++ ep = xhci_get_virt_ep(xhci, slot_id, ep_index); |
2354 |
++ if (!ep) |
2355 |
++ return; |
2356 |
++ |
2357 |
+ vdev = xhci->devs[slot_id]; |
2358 |
+ ep_ctx = xhci_get_ep_ctx(xhci, vdev->out_ctx, ep_index); |
2359 |
+ trace_xhci_handle_cmd_reset_ep(ep_ctx); |
2360 |
+@@ -1187,7 +1220,7 @@ static void xhci_handle_cmd_reset_ep(struct xhci_hcd *xhci, int slot_id, |
2361 |
+ xhci_ring_cmd_db(xhci); |
2362 |
+ } else { |
2363 |
+ /* Clear our internal halted state */ |
2364 |
+- xhci->devs[slot_id]->eps[ep_index].ep_state &= ~EP_HALTED; |
2365 |
++ ep->ep_state &= ~EP_HALTED; |
2366 |
+ } |
2367 |
+ |
2368 |
+ /* if this was a soft reset, then restart */ |
2369 |
+@@ -2356,14 +2389,13 @@ static int handle_tx_event(struct xhci_hcd *xhci, |
2370 |
+ trb_comp_code = GET_COMP_CODE(le32_to_cpu(event->transfer_len)); |
2371 |
+ ep_trb_dma = le64_to_cpu(event->buffer); |
2372 |
+ |
2373 |
+- xdev = xhci->devs[slot_id]; |
2374 |
+- if (!xdev) { |
2375 |
+- xhci_err(xhci, "ERROR Transfer event pointed to bad slot %u\n", |
2376 |
+- slot_id); |
2377 |
++ ep = xhci_get_virt_ep(xhci, slot_id, ep_index); |
2378 |
++ if (!ep) { |
2379 |
++ xhci_err(xhci, "ERROR Invalid Transfer event\n"); |
2380 |
+ goto err_out; |
2381 |
+ } |
2382 |
+ |
2383 |
+- ep = &xdev->eps[ep_index]; |
2384 |
++ xdev = xhci->devs[slot_id]; |
2385 |
+ ep_ring = xhci_dma_to_transfer_ring(ep, ep_trb_dma); |
2386 |
+ ep_ctx = xhci_get_ep_ctx(xhci, xdev->out_ctx, ep_index); |
2387 |
+ |
2388 |
+diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h |
2389 |
+index 8798ed0317864..834f32fe99308 100644 |
2390 |
+--- a/drivers/usb/host/xhci.h |
2391 |
++++ b/drivers/usb/host/xhci.h |
2392 |
+@@ -993,6 +993,7 @@ struct xhci_interval_bw_table { |
2393 |
+ unsigned int ss_bw_out; |
2394 |
+ }; |
2395 |
+ |
2396 |
++#define EP_CTX_PER_DEV 31 |
2397 |
+ |
2398 |
+ struct xhci_virt_device { |
2399 |
+ struct usb_device *udev; |
2400 |
+@@ -1007,7 +1008,7 @@ struct xhci_virt_device { |
2401 |
+ struct xhci_container_ctx *out_ctx; |
2402 |
+ /* Used for addressing devices and configuration changes */ |
2403 |
+ struct xhci_container_ctx *in_ctx; |
2404 |
+- struct xhci_virt_ep eps[31]; |
2405 |
++ struct xhci_virt_ep eps[EP_CTX_PER_DEV]; |
2406 |
+ u8 fake_port; |
2407 |
+ u8 real_port; |
2408 |
+ struct xhci_interval_bw_table *bw_table; |
2409 |
+diff --git a/drivers/usb/renesas_usbhs/fifo.c b/drivers/usb/renesas_usbhs/fifo.c |
2410 |
+index cfc16943979d5..2010444376314 100644 |
2411 |
+--- a/drivers/usb/renesas_usbhs/fifo.c |
2412 |
++++ b/drivers/usb/renesas_usbhs/fifo.c |
2413 |
+@@ -101,6 +101,8 @@ static struct dma_chan *usbhsf_dma_chan_get(struct usbhs_fifo *fifo, |
2414 |
+ #define usbhsf_dma_map(p) __usbhsf_dma_map_ctrl(p, 1) |
2415 |
+ #define usbhsf_dma_unmap(p) __usbhsf_dma_map_ctrl(p, 0) |
2416 |
+ static int __usbhsf_dma_map_ctrl(struct usbhs_pkt *pkt, int map); |
2417 |
++static void usbhsf_tx_irq_ctrl(struct usbhs_pipe *pipe, int enable); |
2418 |
++static void usbhsf_rx_irq_ctrl(struct usbhs_pipe *pipe, int enable); |
2419 |
+ struct usbhs_pkt *usbhs_pkt_pop(struct usbhs_pipe *pipe, struct usbhs_pkt *pkt) |
2420 |
+ { |
2421 |
+ struct usbhs_priv *priv = usbhs_pipe_to_priv(pipe); |
2422 |
+@@ -123,6 +125,11 @@ struct usbhs_pkt *usbhs_pkt_pop(struct usbhs_pipe *pipe, struct usbhs_pkt *pkt) |
2423 |
+ if (chan) { |
2424 |
+ dmaengine_terminate_all(chan); |
2425 |
+ usbhsf_dma_unmap(pkt); |
2426 |
++ } else { |
2427 |
++ if (usbhs_pipe_is_dir_in(pipe)) |
2428 |
++ usbhsf_rx_irq_ctrl(pipe, 0); |
2429 |
++ else |
2430 |
++ usbhsf_tx_irq_ctrl(pipe, 0); |
2431 |
+ } |
2432 |
+ |
2433 |
+ usbhs_pipe_clear_without_sequence(pipe, 0, 0); |
2434 |
+diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c |
2435 |
+index db03212d620ad..8e5878ec656d0 100644 |
2436 |
+--- a/drivers/usb/serial/cp210x.c |
2437 |
++++ b/drivers/usb/serial/cp210x.c |
2438 |
+@@ -156,6 +156,7 @@ static const struct usb_device_id id_table[] = { |
2439 |
+ { USB_DEVICE(0x10C4, 0x89A4) }, /* CESINEL FTBC Flexible Thyristor Bridge Controller */ |
2440 |
+ { USB_DEVICE(0x10C4, 0x89FB) }, /* Qivicon ZigBee USB Radio Stick */ |
2441 |
+ { USB_DEVICE(0x10C4, 0x8A2A) }, /* HubZ dual ZigBee and Z-Wave dongle */ |
2442 |
++ { USB_DEVICE(0x10C4, 0x8A5B) }, /* CEL EM3588 ZigBee USB Stick */ |
2443 |
+ { USB_DEVICE(0x10C4, 0x8A5E) }, /* CEL EM3588 ZigBee USB Stick Long Range */ |
2444 |
+ { USB_DEVICE(0x10C4, 0x8B34) }, /* Qivicon ZigBee USB Radio Stick */ |
2445 |
+ { USB_DEVICE(0x10C4, 0xEA60) }, /* Silicon Labs factory default */ |
2446 |
+@@ -203,8 +204,8 @@ static const struct usb_device_id id_table[] = { |
2447 |
+ { USB_DEVICE(0x1901, 0x0194) }, /* GE Healthcare Remote Alarm Box */ |
2448 |
+ { USB_DEVICE(0x1901, 0x0195) }, /* GE B850/B650/B450 CP2104 DP UART interface */ |
2449 |
+ { USB_DEVICE(0x1901, 0x0196) }, /* GE B850 CP2105 DP UART interface */ |
2450 |
+- { USB_DEVICE(0x1901, 0x0197) }, /* GE CS1000 Display serial interface */ |
2451 |
+- { USB_DEVICE(0x1901, 0x0198) }, /* GE CS1000 M.2 Key E serial interface */ |
2452 |
++ { USB_DEVICE(0x1901, 0x0197) }, /* GE CS1000 M.2 Key E serial interface */ |
2453 |
++ { USB_DEVICE(0x1901, 0x0198) }, /* GE CS1000 Display serial interface */ |
2454 |
+ { USB_DEVICE(0x199B, 0xBA30) }, /* LORD WSDA-200-USB */ |
2455 |
+ { USB_DEVICE(0x19CF, 0x3000) }, /* Parrot NMEA GPS Flight Recorder */ |
2456 |
+ { USB_DEVICE(0x1ADB, 0x0001) }, /* Schweitzer Engineering C662 Cable */ |
2457 |
+diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c |
2458 |
+index 25d8fb3a7395f..d6d10ba1e1e80 100644 |
2459 |
+--- a/drivers/usb/serial/option.c |
2460 |
++++ b/drivers/usb/serial/option.c |
2461 |
+@@ -238,6 +238,7 @@ static void option_instat_callback(struct urb *urb); |
2462 |
+ #define QUECTEL_PRODUCT_UC15 0x9090 |
2463 |
+ /* These u-blox products use Qualcomm's vendor ID */ |
2464 |
+ #define UBLOX_PRODUCT_R410M 0x90b2 |
2465 |
++#define UBLOX_PRODUCT_R6XX 0x90fa |
2466 |
+ /* These Yuga products use Qualcomm's vendor ID */ |
2467 |
+ #define YUGA_PRODUCT_CLM920_NC5 0x9625 |
2468 |
+ |
2469 |
+@@ -1101,6 +1102,8 @@ static const struct usb_device_id option_ids[] = { |
2470 |
+ /* u-blox products using Qualcomm vendor ID */ |
2471 |
+ { USB_DEVICE(QUALCOMM_VENDOR_ID, UBLOX_PRODUCT_R410M), |
2472 |
+ .driver_info = RSVD(1) | RSVD(3) }, |
2473 |
++ { USB_DEVICE(QUALCOMM_VENDOR_ID, UBLOX_PRODUCT_R6XX), |
2474 |
++ .driver_info = RSVD(3) }, |
2475 |
+ /* Quectel products using Quectel vendor ID */ |
2476 |
+ { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC21, 0xff, 0xff, 0xff), |
2477 |
+ .driver_info = NUMEP2 }, |
2478 |
+diff --git a/drivers/usb/storage/unusual_uas.h b/drivers/usb/storage/unusual_uas.h |
2479 |
+index cb7b15ecb7aba..c7db6c943ba51 100644 |
2480 |
+--- a/drivers/usb/storage/unusual_uas.h |
2481 |
++++ b/drivers/usb/storage/unusual_uas.h |
2482 |
+@@ -45,6 +45,13 @@ UNUSUAL_DEV(0x059f, 0x105f, 0x0000, 0x9999, |
2483 |
+ USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
2484 |
+ US_FL_NO_REPORT_OPCODES | US_FL_NO_SAME), |
2485 |
+ |
2486 |
++/* Reported-by: Julian Sikorski <belegdol@×××××.com> */ |
2487 |
++UNUSUAL_DEV(0x059f, 0x1061, 0x0000, 0x9999, |
2488 |
++ "LaCie", |
2489 |
++ "Rugged USB3-FW", |
2490 |
++ USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
2491 |
++ US_FL_IGNORE_UAS), |
2492 |
++ |
2493 |
+ /* |
2494 |
+ * Apricorn USB3 dongle sometimes returns "USBSUSBSUSBS" in response to SCSI |
2495 |
+ * commands in UAS mode. Observed with the 1.28 firmware; are there others? |
2496 |
+diff --git a/fs/afs/cmservice.c b/fs/afs/cmservice.c |
2497 |
+index fc5eb0f893049..c2e82b84c5546 100644 |
2498 |
+--- a/fs/afs/cmservice.c |
2499 |
++++ b/fs/afs/cmservice.c |
2500 |
+@@ -29,16 +29,11 @@ static void SRXAFSCB_TellMeAboutYourself(struct work_struct *); |
2501 |
+ |
2502 |
+ static int afs_deliver_yfs_cb_callback(struct afs_call *); |
2503 |
+ |
2504 |
+-#define CM_NAME(name) \ |
2505 |
+- char afs_SRXCB##name##_name[] __tracepoint_string = \ |
2506 |
+- "CB." #name |
2507 |
+- |
2508 |
+ /* |
2509 |
+ * CB.CallBack operation type |
2510 |
+ */ |
2511 |
+-static CM_NAME(CallBack); |
2512 |
+ static const struct afs_call_type afs_SRXCBCallBack = { |
2513 |
+- .name = afs_SRXCBCallBack_name, |
2514 |
++ .name = "CB.CallBack", |
2515 |
+ .deliver = afs_deliver_cb_callback, |
2516 |
+ .destructor = afs_cm_destructor, |
2517 |
+ .work = SRXAFSCB_CallBack, |
2518 |
+@@ -47,9 +42,8 @@ static const struct afs_call_type afs_SRXCBCallBack = { |
2519 |
+ /* |
2520 |
+ * CB.InitCallBackState operation type |
2521 |
+ */ |
2522 |
+-static CM_NAME(InitCallBackState); |
2523 |
+ static const struct afs_call_type afs_SRXCBInitCallBackState = { |
2524 |
+- .name = afs_SRXCBInitCallBackState_name, |
2525 |
++ .name = "CB.InitCallBackState", |
2526 |
+ .deliver = afs_deliver_cb_init_call_back_state, |
2527 |
+ .destructor = afs_cm_destructor, |
2528 |
+ .work = SRXAFSCB_InitCallBackState, |
2529 |
+@@ -58,9 +52,8 @@ static const struct afs_call_type afs_SRXCBInitCallBackState = { |
2530 |
+ /* |
2531 |
+ * CB.InitCallBackState3 operation type |
2532 |
+ */ |
2533 |
+-static CM_NAME(InitCallBackState3); |
2534 |
+ static const struct afs_call_type afs_SRXCBInitCallBackState3 = { |
2535 |
+- .name = afs_SRXCBInitCallBackState3_name, |
2536 |
++ .name = "CB.InitCallBackState3", |
2537 |
+ .deliver = afs_deliver_cb_init_call_back_state3, |
2538 |
+ .destructor = afs_cm_destructor, |
2539 |
+ .work = SRXAFSCB_InitCallBackState, |
2540 |
+@@ -69,9 +62,8 @@ static const struct afs_call_type afs_SRXCBInitCallBackState3 = { |
2541 |
+ /* |
2542 |
+ * CB.Probe operation type |
2543 |
+ */ |
2544 |
+-static CM_NAME(Probe); |
2545 |
+ static const struct afs_call_type afs_SRXCBProbe = { |
2546 |
+- .name = afs_SRXCBProbe_name, |
2547 |
++ .name = "CB.Probe", |
2548 |
+ .deliver = afs_deliver_cb_probe, |
2549 |
+ .destructor = afs_cm_destructor, |
2550 |
+ .work = SRXAFSCB_Probe, |
2551 |
+@@ -80,9 +72,8 @@ static const struct afs_call_type afs_SRXCBProbe = { |
2552 |
+ /* |
2553 |
+ * CB.ProbeUuid operation type |
2554 |
+ */ |
2555 |
+-static CM_NAME(ProbeUuid); |
2556 |
+ static const struct afs_call_type afs_SRXCBProbeUuid = { |
2557 |
+- .name = afs_SRXCBProbeUuid_name, |
2558 |
++ .name = "CB.ProbeUuid", |
2559 |
+ .deliver = afs_deliver_cb_probe_uuid, |
2560 |
+ .destructor = afs_cm_destructor, |
2561 |
+ .work = SRXAFSCB_ProbeUuid, |
2562 |
+@@ -91,9 +82,8 @@ static const struct afs_call_type afs_SRXCBProbeUuid = { |
2563 |
+ /* |
2564 |
+ * CB.TellMeAboutYourself operation type |
2565 |
+ */ |
2566 |
+-static CM_NAME(TellMeAboutYourself); |
2567 |
+ static const struct afs_call_type afs_SRXCBTellMeAboutYourself = { |
2568 |
+- .name = afs_SRXCBTellMeAboutYourself_name, |
2569 |
++ .name = "CB.TellMeAboutYourself", |
2570 |
+ .deliver = afs_deliver_cb_tell_me_about_yourself, |
2571 |
+ .destructor = afs_cm_destructor, |
2572 |
+ .work = SRXAFSCB_TellMeAboutYourself, |
2573 |
+@@ -102,9 +92,8 @@ static const struct afs_call_type afs_SRXCBTellMeAboutYourself = { |
2574 |
+ /* |
2575 |
+ * YFS CB.CallBack operation type |
2576 |
+ */ |
2577 |
+-static CM_NAME(YFS_CallBack); |
2578 |
+ static const struct afs_call_type afs_SRXYFSCB_CallBack = { |
2579 |
+- .name = afs_SRXCBYFS_CallBack_name, |
2580 |
++ .name = "YFSCB.CallBack", |
2581 |
+ .deliver = afs_deliver_yfs_cb_callback, |
2582 |
+ .destructor = afs_cm_destructor, |
2583 |
+ .work = SRXAFSCB_CallBack, |
2584 |
+diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c |
2585 |
+index 832b40293907f..5273965226534 100644 |
2586 |
+--- a/fs/btrfs/extent-tree.c |
2587 |
++++ b/fs/btrfs/extent-tree.c |
2588 |
+@@ -5768,6 +5768,9 @@ int btrfs_trim_fs(struct btrfs_fs_info *fs_info, struct fstrim_range *range) |
2589 |
+ mutex_lock(&fs_info->fs_devices->device_list_mutex); |
2590 |
+ devices = &fs_info->fs_devices->devices; |
2591 |
+ list_for_each_entry(device, devices, dev_list) { |
2592 |
++ if (test_bit(BTRFS_DEV_STATE_MISSING, &device->dev_state)) |
2593 |
++ continue; |
2594 |
++ |
2595 |
+ ret = btrfs_trim_free_extents(device, &group_trimmed); |
2596 |
+ if (ret) { |
2597 |
+ dev_failed++; |
2598 |
+diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c |
2599 |
+index 64dd702a5448c..025b02e9799ff 100644 |
2600 |
+--- a/fs/btrfs/inode.c |
2601 |
++++ b/fs/btrfs/inode.c |
2602 |
+@@ -543,7 +543,7 @@ again: |
2603 |
+ * inode has not been flagged as nocompress. This flag can |
2604 |
+ * change at any time if we discover bad compression ratios. |
2605 |
+ */ |
2606 |
+- if (inode_need_compress(inode, start, end)) { |
2607 |
++ if (nr_pages > 1 && inode_need_compress(inode, start, end)) { |
2608 |
+ WARN_ON(pages); |
2609 |
+ pages = kcalloc(nr_pages, sizeof(struct page *), GFP_NOFS); |
2610 |
+ if (!pages) { |
2611 |
+diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c |
2612 |
+index 50ad3522ce365..358398b1fe0c9 100644 |
2613 |
+--- a/fs/hugetlbfs/inode.c |
2614 |
++++ b/fs/hugetlbfs/inode.c |
2615 |
+@@ -76,7 +76,7 @@ enum hugetlb_param { |
2616 |
+ static const struct fs_parameter_spec hugetlb_param_specs[] = { |
2617 |
+ fsparam_u32 ("gid", Opt_gid), |
2618 |
+ fsparam_string("min_size", Opt_min_size), |
2619 |
+- fsparam_u32 ("mode", Opt_mode), |
2620 |
++ fsparam_u32oct("mode", Opt_mode), |
2621 |
+ fsparam_string("nr_inodes", Opt_nr_inodes), |
2622 |
+ fsparam_string("pagesize", Opt_pagesize), |
2623 |
+ fsparam_string("size", Opt_size), |
2624 |
+diff --git a/fs/proc/base.c b/fs/proc/base.c |
2625 |
+index 75e786684a4e3..90d2f62a96723 100644 |
2626 |
+--- a/fs/proc/base.c |
2627 |
++++ b/fs/proc/base.c |
2628 |
+@@ -836,7 +836,7 @@ static ssize_t mem_rw(struct file *file, char __user *buf, |
2629 |
+ flags = FOLL_FORCE | (write ? FOLL_WRITE : 0); |
2630 |
+ |
2631 |
+ while (count > 0) { |
2632 |
+- int this_len = min_t(int, count, PAGE_SIZE); |
2633 |
++ size_t this_len = min_t(size_t, count, PAGE_SIZE); |
2634 |
+ |
2635 |
+ if (write && copy_from_user(page, buf, this_len)) { |
2636 |
+ copied = -EFAULT; |
2637 |
+diff --git a/fs/userfaultfd.c b/fs/userfaultfd.c |
2638 |
+index d99d166fd8926..2c807283115d7 100644 |
2639 |
+--- a/fs/userfaultfd.c |
2640 |
++++ b/fs/userfaultfd.c |
2641 |
+@@ -1272,23 +1272,21 @@ static __always_inline void wake_userfault(struct userfaultfd_ctx *ctx, |
2642 |
+ } |
2643 |
+ |
2644 |
+ static __always_inline int validate_range(struct mm_struct *mm, |
2645 |
+- __u64 *start, __u64 len) |
2646 |
++ __u64 start, __u64 len) |
2647 |
+ { |
2648 |
+ __u64 task_size = mm->task_size; |
2649 |
+ |
2650 |
+- *start = untagged_addr(*start); |
2651 |
+- |
2652 |
+- if (*start & ~PAGE_MASK) |
2653 |
++ if (start & ~PAGE_MASK) |
2654 |
+ return -EINVAL; |
2655 |
+ if (len & ~PAGE_MASK) |
2656 |
+ return -EINVAL; |
2657 |
+ if (!len) |
2658 |
+ return -EINVAL; |
2659 |
+- if (*start < mmap_min_addr) |
2660 |
++ if (start < mmap_min_addr) |
2661 |
+ return -EINVAL; |
2662 |
+- if (*start >= task_size) |
2663 |
++ if (start >= task_size) |
2664 |
+ return -EINVAL; |
2665 |
+- if (len > task_size - *start) |
2666 |
++ if (len > task_size - start) |
2667 |
+ return -EINVAL; |
2668 |
+ return 0; |
2669 |
+ } |
2670 |
+@@ -1338,7 +1336,7 @@ static int userfaultfd_register(struct userfaultfd_ctx *ctx, |
2671 |
+ goto out; |
2672 |
+ } |
2673 |
+ |
2674 |
+- ret = validate_range(mm, &uffdio_register.range.start, |
2675 |
++ ret = validate_range(mm, uffdio_register.range.start, |
2676 |
+ uffdio_register.range.len); |
2677 |
+ if (ret) |
2678 |
+ goto out; |
2679 |
+@@ -1527,7 +1525,7 @@ static int userfaultfd_unregister(struct userfaultfd_ctx *ctx, |
2680 |
+ if (copy_from_user(&uffdio_unregister, buf, sizeof(uffdio_unregister))) |
2681 |
+ goto out; |
2682 |
+ |
2683 |
+- ret = validate_range(mm, &uffdio_unregister.start, |
2684 |
++ ret = validate_range(mm, uffdio_unregister.start, |
2685 |
+ uffdio_unregister.len); |
2686 |
+ if (ret) |
2687 |
+ goto out; |
2688 |
+@@ -1678,7 +1676,7 @@ static int userfaultfd_wake(struct userfaultfd_ctx *ctx, |
2689 |
+ if (copy_from_user(&uffdio_wake, buf, sizeof(uffdio_wake))) |
2690 |
+ goto out; |
2691 |
+ |
2692 |
+- ret = validate_range(ctx->mm, &uffdio_wake.start, uffdio_wake.len); |
2693 |
++ ret = validate_range(ctx->mm, uffdio_wake.start, uffdio_wake.len); |
2694 |
+ if (ret) |
2695 |
+ goto out; |
2696 |
+ |
2697 |
+@@ -1718,7 +1716,7 @@ static int userfaultfd_copy(struct userfaultfd_ctx *ctx, |
2698 |
+ sizeof(uffdio_copy)-sizeof(__s64))) |
2699 |
+ goto out; |
2700 |
+ |
2701 |
+- ret = validate_range(ctx->mm, &uffdio_copy.dst, uffdio_copy.len); |
2702 |
++ ret = validate_range(ctx->mm, uffdio_copy.dst, uffdio_copy.len); |
2703 |
+ if (ret) |
2704 |
+ goto out; |
2705 |
+ /* |
2706 |
+@@ -1774,7 +1772,7 @@ static int userfaultfd_zeropage(struct userfaultfd_ctx *ctx, |
2707 |
+ sizeof(uffdio_zeropage)-sizeof(__s64))) |
2708 |
+ goto out; |
2709 |
+ |
2710 |
+- ret = validate_range(ctx->mm, &uffdio_zeropage.range.start, |
2711 |
++ ret = validate_range(ctx->mm, uffdio_zeropage.range.start, |
2712 |
+ uffdio_zeropage.range.len); |
2713 |
+ if (ret) |
2714 |
+ goto out; |
2715 |
+diff --git a/include/drm/drm_ioctl.h b/include/drm/drm_ioctl.h |
2716 |
+index 10100a4bbe2ad..afb27cb6a7bd8 100644 |
2717 |
+--- a/include/drm/drm_ioctl.h |
2718 |
++++ b/include/drm/drm_ioctl.h |
2719 |
+@@ -68,6 +68,7 @@ typedef int drm_ioctl_compat_t(struct file *filp, unsigned int cmd, |
2720 |
+ unsigned long arg); |
2721 |
+ |
2722 |
+ #define DRM_IOCTL_NR(n) _IOC_NR(n) |
2723 |
++#define DRM_IOCTL_TYPE(n) _IOC_TYPE(n) |
2724 |
+ #define DRM_MAJOR 226 |
2725 |
+ |
2726 |
+ /** |
2727 |
+diff --git a/include/trace/events/afs.h b/include/trace/events/afs.h |
2728 |
+index c612cabbc378f..61af4af871190 100644 |
2729 |
+--- a/include/trace/events/afs.h |
2730 |
++++ b/include/trace/events/afs.h |
2731 |
+@@ -111,6 +111,34 @@ enum afs_vl_operation { |
2732 |
+ afs_VL_GetCapabilities = 65537, /* AFS Get VL server capabilities */ |
2733 |
+ }; |
2734 |
+ |
2735 |
++enum afs_cm_operation { |
2736 |
++ afs_CB_CallBack = 204, /* AFS break callback promises */ |
2737 |
++ afs_CB_InitCallBackState = 205, /* AFS initialise callback state */ |
2738 |
++ afs_CB_Probe = 206, /* AFS probe client */ |
2739 |
++ afs_CB_GetLock = 207, /* AFS get contents of CM lock table */ |
2740 |
++ afs_CB_GetCE = 208, /* AFS get cache file description */ |
2741 |
++ afs_CB_GetXStatsVersion = 209, /* AFS get version of extended statistics */ |
2742 |
++ afs_CB_GetXStats = 210, /* AFS get contents of extended statistics data */ |
2743 |
++ afs_CB_InitCallBackState3 = 213, /* AFS initialise callback state, version 3 */ |
2744 |
++ afs_CB_ProbeUuid = 214, /* AFS check the client hasn't rebooted */ |
2745 |
++}; |
2746 |
++ |
2747 |
++enum yfs_cm_operation { |
2748 |
++ yfs_CB_Probe = 206, /* YFS probe client */ |
2749 |
++ yfs_CB_GetLock = 207, /* YFS get contents of CM lock table */ |
2750 |
++ yfs_CB_XStatsVersion = 209, /* YFS get version of extended statistics */ |
2751 |
++ yfs_CB_GetXStats = 210, /* YFS get contents of extended statistics data */ |
2752 |
++ yfs_CB_InitCallBackState3 = 213, /* YFS initialise callback state, version 3 */ |
2753 |
++ yfs_CB_ProbeUuid = 214, /* YFS check the client hasn't rebooted */ |
2754 |
++ yfs_CB_GetServerPrefs = 215, |
2755 |
++ yfs_CB_GetCellServDV = 216, |
2756 |
++ yfs_CB_GetLocalCell = 217, |
2757 |
++ yfs_CB_GetCacheConfig = 218, |
2758 |
++ yfs_CB_GetCellByNum = 65537, |
2759 |
++ yfs_CB_TellMeAboutYourself = 65538, /* get client capabilities */ |
2760 |
++ yfs_CB_CallBack = 64204, |
2761 |
++}; |
2762 |
++ |
2763 |
+ enum afs_edit_dir_op { |
2764 |
+ afs_edit_dir_create, |
2765 |
+ afs_edit_dir_create_error, |
2766 |
+@@ -312,6 +340,32 @@ enum afs_cb_break_reason { |
2767 |
+ EM(afs_YFSVL_GetEndpoints, "YFSVL.GetEndpoints") \ |
2768 |
+ E_(afs_VL_GetCapabilities, "VL.GetCapabilities") |
2769 |
+ |
2770 |
++#define afs_cm_operations \ |
2771 |
++ EM(afs_CB_CallBack, "CB.CallBack") \ |
2772 |
++ EM(afs_CB_InitCallBackState, "CB.InitCallBackState") \ |
2773 |
++ EM(afs_CB_Probe, "CB.Probe") \ |
2774 |
++ EM(afs_CB_GetLock, "CB.GetLock") \ |
2775 |
++ EM(afs_CB_GetCE, "CB.GetCE") \ |
2776 |
++ EM(afs_CB_GetXStatsVersion, "CB.GetXStatsVersion") \ |
2777 |
++ EM(afs_CB_GetXStats, "CB.GetXStats") \ |
2778 |
++ EM(afs_CB_InitCallBackState3, "CB.InitCallBackState3") \ |
2779 |
++ E_(afs_CB_ProbeUuid, "CB.ProbeUuid") |
2780 |
++ |
2781 |
++#define yfs_cm_operations \ |
2782 |
++ EM(yfs_CB_Probe, "YFSCB.Probe") \ |
2783 |
++ EM(yfs_CB_GetLock, "YFSCB.GetLock") \ |
2784 |
++ EM(yfs_CB_XStatsVersion, "YFSCB.XStatsVersion") \ |
2785 |
++ EM(yfs_CB_GetXStats, "YFSCB.GetXStats") \ |
2786 |
++ EM(yfs_CB_InitCallBackState3, "YFSCB.InitCallBackState3") \ |
2787 |
++ EM(yfs_CB_ProbeUuid, "YFSCB.ProbeUuid") \ |
2788 |
++ EM(yfs_CB_GetServerPrefs, "YFSCB.GetServerPrefs") \ |
2789 |
++ EM(yfs_CB_GetCellServDV, "YFSCB.GetCellServDV") \ |
2790 |
++ EM(yfs_CB_GetLocalCell, "YFSCB.GetLocalCell") \ |
2791 |
++ EM(yfs_CB_GetCacheConfig, "YFSCB.GetCacheConfig") \ |
2792 |
++ EM(yfs_CB_GetCellByNum, "YFSCB.GetCellByNum") \ |
2793 |
++ EM(yfs_CB_TellMeAboutYourself, "YFSCB.TellMeAboutYourself") \ |
2794 |
++ E_(yfs_CB_CallBack, "YFSCB.CallBack") |
2795 |
++ |
2796 |
+ #define afs_edit_dir_ops \ |
2797 |
+ EM(afs_edit_dir_create, "create") \ |
2798 |
+ EM(afs_edit_dir_create_error, "c_fail") \ |
2799 |
+@@ -442,6 +496,8 @@ afs_call_traces; |
2800 |
+ afs_server_traces; |
2801 |
+ afs_fs_operations; |
2802 |
+ afs_vl_operations; |
2803 |
++afs_cm_operations; |
2804 |
++yfs_cm_operations; |
2805 |
+ afs_edit_dir_ops; |
2806 |
+ afs_edit_dir_reasons; |
2807 |
+ afs_eproto_causes; |
2808 |
+@@ -522,20 +578,21 @@ TRACE_EVENT(afs_cb_call, |
2809 |
+ |
2810 |
+ TP_STRUCT__entry( |
2811 |
+ __field(unsigned int, call ) |
2812 |
+- __field(const char *, name ) |
2813 |
+ __field(u32, op ) |
2814 |
++ __field(u16, service_id ) |
2815 |
+ ), |
2816 |
+ |
2817 |
+ TP_fast_assign( |
2818 |
+ __entry->call = call->debug_id; |
2819 |
+- __entry->name = call->type->name; |
2820 |
+ __entry->op = call->operation_ID; |
2821 |
++ __entry->service_id = call->service_id; |
2822 |
+ ), |
2823 |
+ |
2824 |
+- TP_printk("c=%08x %s o=%u", |
2825 |
++ TP_printk("c=%08x %s", |
2826 |
+ __entry->call, |
2827 |
+- __entry->name, |
2828 |
+- __entry->op) |
2829 |
++ __entry->service_id == 2501 ? |
2830 |
++ __print_symbolic(__entry->op, yfs_cm_operations) : |
2831 |
++ __print_symbolic(__entry->op, afs_cm_operations)) |
2832 |
+ ); |
2833 |
+ |
2834 |
+ TRACE_EVENT(afs_call, |
2835 |
+diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c |
2836 |
+index 7283741666538..5e1b9f6e77f31 100644 |
2837 |
+--- a/kernel/trace/ring_buffer.c |
2838 |
++++ b/kernel/trace/ring_buffer.c |
2839 |
+@@ -3221,10 +3221,30 @@ static bool rb_per_cpu_empty(struct ring_buffer_per_cpu *cpu_buffer) |
2840 |
+ if (unlikely(!head)) |
2841 |
+ return true; |
2842 |
+ |
2843 |
+- return reader->read == rb_page_commit(reader) && |
2844 |
+- (commit == reader || |
2845 |
+- (commit == head && |
2846 |
+- head->read == rb_page_commit(commit))); |
2847 |
++ /* Reader should exhaust content in reader page */ |
2848 |
++ if (reader->read != rb_page_commit(reader)) |
2849 |
++ return false; |
2850 |
++ |
2851 |
++ /* |
2852 |
++ * If writers are committing on the reader page, knowing all |
2853 |
++ * committed content has been read, the ring buffer is empty. |
2854 |
++ */ |
2855 |
++ if (commit == reader) |
2856 |
++ return true; |
2857 |
++ |
2858 |
++ /* |
2859 |
++ * If writers are committing on a page other than reader page |
2860 |
++ * and head page, there should always be content to read. |
2861 |
++ */ |
2862 |
++ if (commit != head) |
2863 |
++ return false; |
2864 |
++ |
2865 |
++ /* |
2866 |
++ * Writers are committing on the head page, we just need |
2867 |
++ * to care about there're committed data, and the reader will |
2868 |
++ * swap reader page with head page when it is to read data. |
2869 |
++ */ |
2870 |
++ return rb_page_commit(commit) == 0; |
2871 |
+ } |
2872 |
+ |
2873 |
+ /** |
2874 |
+diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c |
2875 |
+index 002412a1abf91..5240ba9a82db8 100644 |
2876 |
+--- a/kernel/trace/trace.c |
2877 |
++++ b/kernel/trace/trace.c |
2878 |
+@@ -4975,6 +4975,10 @@ static const char readme_msg[] = |
2879 |
+ "\t [:name=histname1]\n" |
2880 |
+ "\t [:<handler>.<action>]\n" |
2881 |
+ "\t [if <filter>]\n\n" |
2882 |
++ "\t Note, special fields can be used as well:\n" |
2883 |
++ "\t common_timestamp - to record current timestamp\n" |
2884 |
++ "\t common_cpu - to record the CPU the event happened on\n" |
2885 |
++ "\n" |
2886 |
+ "\t When a matching event is hit, an entry is added to a hash\n" |
2887 |
+ "\t table using the key(s) and value(s) named, and the value of a\n" |
2888 |
+ "\t sum called 'hitcount' is incremented. Keys and values\n" |
2889 |
+diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_hist.c |
2890 |
+index f136449821bfe..553add1eb457f 100644 |
2891 |
+--- a/kernel/trace/trace_events_hist.c |
2892 |
++++ b/kernel/trace/trace_events_hist.c |
2893 |
+@@ -2001,7 +2001,7 @@ static const char *hist_field_name(struct hist_field *field, |
2894 |
+ field->flags & HIST_FIELD_FL_ALIAS) |
2895 |
+ field_name = hist_field_name(field->operands[0], ++level); |
2896 |
+ else if (field->flags & HIST_FIELD_FL_CPU) |
2897 |
+- field_name = "cpu"; |
2898 |
++ field_name = "common_cpu"; |
2899 |
+ else if (field->flags & HIST_FIELD_FL_EXPR || |
2900 |
+ field->flags & HIST_FIELD_FL_VAR_REF) { |
2901 |
+ if (field->system) { |
2902 |
+@@ -2873,14 +2873,24 @@ parse_field(struct hist_trigger_data *hist_data, struct trace_event_file *file, |
2903 |
+ hist_data->enable_timestamps = true; |
2904 |
+ if (*flags & HIST_FIELD_FL_TIMESTAMP_USECS) |
2905 |
+ hist_data->attrs->ts_in_usecs = true; |
2906 |
+- } else if (strcmp(field_name, "cpu") == 0) |
2907 |
++ } else if (strcmp(field_name, "common_cpu") == 0) |
2908 |
+ *flags |= HIST_FIELD_FL_CPU; |
2909 |
+ else { |
2910 |
+ field = trace_find_event_field(file->event_call, field_name); |
2911 |
+ if (!field || !field->size) { |
2912 |
+- hist_err(tr, HIST_ERR_FIELD_NOT_FOUND, errpos(field_name)); |
2913 |
+- field = ERR_PTR(-EINVAL); |
2914 |
+- goto out; |
2915 |
++ /* |
2916 |
++ * For backward compatibility, if field_name |
2917 |
++ * was "cpu", then we treat this the same as |
2918 |
++ * common_cpu. |
2919 |
++ */ |
2920 |
++ if (strcmp(field_name, "cpu") == 0) { |
2921 |
++ *flags |= HIST_FIELD_FL_CPU; |
2922 |
++ } else { |
2923 |
++ hist_err(tr, HIST_ERR_FIELD_NOT_FOUND, |
2924 |
++ errpos(field_name)); |
2925 |
++ field = ERR_PTR(-EINVAL); |
2926 |
++ goto out; |
2927 |
++ } |
2928 |
+ } |
2929 |
+ } |
2930 |
+ out: |
2931 |
+@@ -5641,7 +5651,7 @@ static void hist_field_print(struct seq_file *m, struct hist_field *hist_field) |
2932 |
+ seq_printf(m, "%s=", hist_field->var.name); |
2933 |
+ |
2934 |
+ if (hist_field->flags & HIST_FIELD_FL_CPU) |
2935 |
+- seq_puts(m, "cpu"); |
2936 |
++ seq_puts(m, "common_cpu"); |
2937 |
+ else if (field_name) { |
2938 |
+ if (hist_field->flags & HIST_FIELD_FL_VAR_REF || |
2939 |
+ hist_field->flags & HIST_FIELD_FL_ALIAS) |
2940 |
+diff --git a/net/caif/caif_socket.c b/net/caif/caif_socket.c |
2941 |
+index ef14da50a9819..8fa98c62c4fcf 100644 |
2942 |
+--- a/net/caif/caif_socket.c |
2943 |
++++ b/net/caif/caif_socket.c |
2944 |
+@@ -539,7 +539,8 @@ static int caif_seqpkt_sendmsg(struct socket *sock, struct msghdr *msg, |
2945 |
+ goto err; |
2946 |
+ |
2947 |
+ ret = -EINVAL; |
2948 |
+- if (unlikely(msg->msg_iter.iov->iov_base == NULL)) |
2949 |
++ if (unlikely(msg->msg_iter.nr_segs == 0) || |
2950 |
++ unlikely(msg->msg_iter.iov->iov_base == NULL)) |
2951 |
+ goto err; |
2952 |
+ noblock = msg->msg_flags & MSG_DONTWAIT; |
2953 |
+ |
2954 |
+diff --git a/net/decnet/af_decnet.c b/net/decnet/af_decnet.c |
2955 |
+index 3349ea81f9016..b9b847dc097cc 100644 |
2956 |
+--- a/net/decnet/af_decnet.c |
2957 |
++++ b/net/decnet/af_decnet.c |
2958 |
+@@ -815,7 +815,7 @@ static int dn_auto_bind(struct socket *sock) |
2959 |
+ static int dn_confirm_accept(struct sock *sk, long *timeo, gfp_t allocation) |
2960 |
+ { |
2961 |
+ struct dn_scp *scp = DN_SK(sk); |
2962 |
+- DEFINE_WAIT(wait); |
2963 |
++ DEFINE_WAIT_FUNC(wait, woken_wake_function); |
2964 |
+ int err; |
2965 |
+ |
2966 |
+ if (scp->state != DN_CR) |
2967 |
+@@ -825,11 +825,11 @@ static int dn_confirm_accept(struct sock *sk, long *timeo, gfp_t allocation) |
2968 |
+ scp->segsize_loc = dst_metric_advmss(__sk_dst_get(sk)); |
2969 |
+ dn_send_conn_conf(sk, allocation); |
2970 |
+ |
2971 |
+- prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE); |
2972 |
++ add_wait_queue(sk_sleep(sk), &wait); |
2973 |
+ for(;;) { |
2974 |
+ release_sock(sk); |
2975 |
+ if (scp->state == DN_CC) |
2976 |
+- *timeo = schedule_timeout(*timeo); |
2977 |
++ *timeo = wait_woken(&wait, TASK_INTERRUPTIBLE, *timeo); |
2978 |
+ lock_sock(sk); |
2979 |
+ err = 0; |
2980 |
+ if (scp->state == DN_RUN) |
2981 |
+@@ -843,9 +843,8 @@ static int dn_confirm_accept(struct sock *sk, long *timeo, gfp_t allocation) |
2982 |
+ err = -EAGAIN; |
2983 |
+ if (!*timeo) |
2984 |
+ break; |
2985 |
+- prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE); |
2986 |
+ } |
2987 |
+- finish_wait(sk_sleep(sk), &wait); |
2988 |
++ remove_wait_queue(sk_sleep(sk), &wait); |
2989 |
+ if (err == 0) { |
2990 |
+ sk->sk_socket->state = SS_CONNECTED; |
2991 |
+ } else if (scp->state != DN_CC) { |
2992 |
+@@ -857,7 +856,7 @@ static int dn_confirm_accept(struct sock *sk, long *timeo, gfp_t allocation) |
2993 |
+ static int dn_wait_run(struct sock *sk, long *timeo) |
2994 |
+ { |
2995 |
+ struct dn_scp *scp = DN_SK(sk); |
2996 |
+- DEFINE_WAIT(wait); |
2997 |
++ DEFINE_WAIT_FUNC(wait, woken_wake_function); |
2998 |
+ int err = 0; |
2999 |
+ |
3000 |
+ if (scp->state == DN_RUN) |
3001 |
+@@ -866,11 +865,11 @@ static int dn_wait_run(struct sock *sk, long *timeo) |
3002 |
+ if (!*timeo) |
3003 |
+ return -EALREADY; |
3004 |
+ |
3005 |
+- prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE); |
3006 |
++ add_wait_queue(sk_sleep(sk), &wait); |
3007 |
+ for(;;) { |
3008 |
+ release_sock(sk); |
3009 |
+ if (scp->state == DN_CI || scp->state == DN_CC) |
3010 |
+- *timeo = schedule_timeout(*timeo); |
3011 |
++ *timeo = wait_woken(&wait, TASK_INTERRUPTIBLE, *timeo); |
3012 |
+ lock_sock(sk); |
3013 |
+ err = 0; |
3014 |
+ if (scp->state == DN_RUN) |
3015 |
+@@ -884,9 +883,8 @@ static int dn_wait_run(struct sock *sk, long *timeo) |
3016 |
+ err = -ETIMEDOUT; |
3017 |
+ if (!*timeo) |
3018 |
+ break; |
3019 |
+- prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE); |
3020 |
+ } |
3021 |
+- finish_wait(sk_sleep(sk), &wait); |
3022 |
++ remove_wait_queue(sk_sleep(sk), &wait); |
3023 |
+ out: |
3024 |
+ if (err == 0) { |
3025 |
+ sk->sk_socket->state = SS_CONNECTED; |
3026 |
+@@ -1031,16 +1029,16 @@ static void dn_user_copy(struct sk_buff *skb, struct optdata_dn *opt) |
3027 |
+ |
3028 |
+ static struct sk_buff *dn_wait_for_connect(struct sock *sk, long *timeo) |
3029 |
+ { |
3030 |
+- DEFINE_WAIT(wait); |
3031 |
++ DEFINE_WAIT_FUNC(wait, woken_wake_function); |
3032 |
+ struct sk_buff *skb = NULL; |
3033 |
+ int err = 0; |
3034 |
+ |
3035 |
+- prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE); |
3036 |
++ add_wait_queue(sk_sleep(sk), &wait); |
3037 |
+ for(;;) { |
3038 |
+ release_sock(sk); |
3039 |
+ skb = skb_dequeue(&sk->sk_receive_queue); |
3040 |
+ if (skb == NULL) { |
3041 |
+- *timeo = schedule_timeout(*timeo); |
3042 |
++ *timeo = wait_woken(&wait, TASK_INTERRUPTIBLE, *timeo); |
3043 |
+ skb = skb_dequeue(&sk->sk_receive_queue); |
3044 |
+ } |
3045 |
+ lock_sock(sk); |
3046 |
+@@ -1055,9 +1053,8 @@ static struct sk_buff *dn_wait_for_connect(struct sock *sk, long *timeo) |
3047 |
+ err = -EAGAIN; |
3048 |
+ if (!*timeo) |
3049 |
+ break; |
3050 |
+- prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE); |
3051 |
+ } |
3052 |
+- finish_wait(sk_sleep(sk), &wait); |
3053 |
++ remove_wait_queue(sk_sleep(sk), &wait); |
3054 |
+ |
3055 |
+ return skb == NULL ? ERR_PTR(err) : skb; |
3056 |
+ } |
3057 |
+diff --git a/net/ipv4/tcp_bpf.c b/net/ipv4/tcp_bpf.c |
3058 |
+index 819255ee4e42d..6a0c4326d9cf2 100644 |
3059 |
+--- a/net/ipv4/tcp_bpf.c |
3060 |
++++ b/net/ipv4/tcp_bpf.c |
3061 |
+@@ -636,7 +636,7 @@ static int __init tcp_bpf_v4_build_proto(void) |
3062 |
+ tcp_bpf_rebuild_protos(tcp_bpf_prots[TCP_BPF_IPV4], &tcp_prot); |
3063 |
+ return 0; |
3064 |
+ } |
3065 |
+-core_initcall(tcp_bpf_v4_build_proto); |
3066 |
++late_initcall(tcp_bpf_v4_build_proto); |
3067 |
+ |
3068 |
+ static void tcp_bpf_update_sk_prot(struct sock *sk, struct sk_psock *psock) |
3069 |
+ { |
3070 |
+diff --git a/net/ipv4/tcp_fastopen.c b/net/ipv4/tcp_fastopen.c |
3071 |
+index a9971e41f31bb..8af4fefe371f2 100644 |
3072 |
+--- a/net/ipv4/tcp_fastopen.c |
3073 |
++++ b/net/ipv4/tcp_fastopen.c |
3074 |
+@@ -504,8 +504,15 @@ void tcp_fastopen_active_disable(struct sock *sk) |
3075 |
+ { |
3076 |
+ struct net *net = sock_net(sk); |
3077 |
+ |
3078 |
++ /* Paired with READ_ONCE() in tcp_fastopen_active_should_disable() */ |
3079 |
++ WRITE_ONCE(net->ipv4.tfo_active_disable_stamp, jiffies); |
3080 |
++ |
3081 |
++ /* Paired with smp_rmb() in tcp_fastopen_active_should_disable(). |
3082 |
++ * We want net->ipv4.tfo_active_disable_stamp to be updated first. |
3083 |
++ */ |
3084 |
++ smp_mb__before_atomic(); |
3085 |
+ atomic_inc(&net->ipv4.tfo_active_disable_times); |
3086 |
+- net->ipv4.tfo_active_disable_stamp = jiffies; |
3087 |
++ |
3088 |
+ NET_INC_STATS(net, LINUX_MIB_TCPFASTOPENBLACKHOLE); |
3089 |
+ } |
3090 |
+ |
3091 |
+@@ -523,10 +530,16 @@ bool tcp_fastopen_active_should_disable(struct sock *sk) |
3092 |
+ if (!tfo_da_times) |
3093 |
+ return false; |
3094 |
+ |
3095 |
++ /* Paired with smp_mb__before_atomic() in tcp_fastopen_active_disable() */ |
3096 |
++ smp_rmb(); |
3097 |
++ |
3098 |
+ /* Limit timout to max: 2^6 * initial timeout */ |
3099 |
+ multiplier = 1 << min(tfo_da_times - 1, 6); |
3100 |
+- timeout = multiplier * tfo_bh_timeout * HZ; |
3101 |
+- if (time_before(jiffies, sock_net(sk)->ipv4.tfo_active_disable_stamp + timeout)) |
3102 |
++ |
3103 |
++ /* Paired with the WRITE_ONCE() in tcp_fastopen_active_disable(). */ |
3104 |
++ timeout = READ_ONCE(sock_net(sk)->ipv4.tfo_active_disable_stamp) + |
3105 |
++ multiplier * tfo_bh_timeout * HZ; |
3106 |
++ if (time_before(jiffies, timeout)) |
3107 |
+ return true; |
3108 |
+ |
3109 |
+ /* Mark check bit so we can check for successful active TFO |
3110 |
+diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c |
3111 |
+index 4dcbb1ccab25f..33444d9856819 100644 |
3112 |
+--- a/net/ipv6/ip6_output.c |
3113 |
++++ b/net/ipv6/ip6_output.c |
3114 |
+@@ -477,7 +477,9 @@ int ip6_forward(struct sk_buff *skb) |
3115 |
+ if (skb_warn_if_lro(skb)) |
3116 |
+ goto drop; |
3117 |
+ |
3118 |
+- if (!xfrm6_policy_check(NULL, XFRM_POLICY_FWD, skb)) { |
3119 |
++ if (!net->ipv6.devconf_all->disable_policy && |
3120 |
++ !idev->cnf.disable_policy && |
3121 |
++ !xfrm6_policy_check(NULL, XFRM_POLICY_FWD, skb)) { |
3122 |
+ __IP6_INC_STATS(net, idev, IPSTATS_MIB_INDISCARDS); |
3123 |
+ goto drop; |
3124 |
+ } |
3125 |
+diff --git a/net/ipv6/route.c b/net/ipv6/route.c |
3126 |
+index b903fe28ce507..d6fc22f7d7a67 100644 |
3127 |
+--- a/net/ipv6/route.c |
3128 |
++++ b/net/ipv6/route.c |
3129 |
+@@ -3655,7 +3655,7 @@ static struct fib6_info *ip6_route_info_create(struct fib6_config *cfg, |
3130 |
+ err = PTR_ERR(rt->fib6_metrics); |
3131 |
+ /* Do not leave garbage there. */ |
3132 |
+ rt->fib6_metrics = (struct dst_metrics *)&dst_default_metrics; |
3133 |
+- goto out; |
3134 |
++ goto out_free; |
3135 |
+ } |
3136 |
+ |
3137 |
+ if (cfg->fc_flags & RTF_ADDRCONF) |
3138 |
+diff --git a/net/netrom/nr_timer.c b/net/netrom/nr_timer.c |
3139 |
+index 9115f8a7dd45b..a8da88db7893f 100644 |
3140 |
+--- a/net/netrom/nr_timer.c |
3141 |
++++ b/net/netrom/nr_timer.c |
3142 |
+@@ -121,11 +121,9 @@ static void nr_heartbeat_expiry(struct timer_list *t) |
3143 |
+ is accepted() it isn't 'dead' so doesn't get removed. */ |
3144 |
+ if (sock_flag(sk, SOCK_DESTROY) || |
3145 |
+ (sk->sk_state == TCP_LISTEN && sock_flag(sk, SOCK_DEAD))) { |
3146 |
+- sock_hold(sk); |
3147 |
+ bh_unlock_sock(sk); |
3148 |
+ nr_destroy_socket(sk); |
3149 |
+- sock_put(sk); |
3150 |
+- return; |
3151 |
++ goto out; |
3152 |
+ } |
3153 |
+ break; |
3154 |
+ |
3155 |
+@@ -146,6 +144,8 @@ static void nr_heartbeat_expiry(struct timer_list *t) |
3156 |
+ |
3157 |
+ nr_start_heartbeat(sk); |
3158 |
+ bh_unlock_sock(sk); |
3159 |
++out: |
3160 |
++ sock_put(sk); |
3161 |
+ } |
3162 |
+ |
3163 |
+ static void nr_t2timer_expiry(struct timer_list *t) |
3164 |
+@@ -159,6 +159,7 @@ static void nr_t2timer_expiry(struct timer_list *t) |
3165 |
+ nr_enquiry_response(sk); |
3166 |
+ } |
3167 |
+ bh_unlock_sock(sk); |
3168 |
++ sock_put(sk); |
3169 |
+ } |
3170 |
+ |
3171 |
+ static void nr_t4timer_expiry(struct timer_list *t) |
3172 |
+@@ -169,6 +170,7 @@ static void nr_t4timer_expiry(struct timer_list *t) |
3173 |
+ bh_lock_sock(sk); |
3174 |
+ nr_sk(sk)->condition &= ~NR_COND_PEER_RX_BUSY; |
3175 |
+ bh_unlock_sock(sk); |
3176 |
++ sock_put(sk); |
3177 |
+ } |
3178 |
+ |
3179 |
+ static void nr_idletimer_expiry(struct timer_list *t) |
3180 |
+@@ -197,6 +199,7 @@ static void nr_idletimer_expiry(struct timer_list *t) |
3181 |
+ sock_set_flag(sk, SOCK_DEAD); |
3182 |
+ } |
3183 |
+ bh_unlock_sock(sk); |
3184 |
++ sock_put(sk); |
3185 |
+ } |
3186 |
+ |
3187 |
+ static void nr_t1timer_expiry(struct timer_list *t) |
3188 |
+@@ -209,8 +212,7 @@ static void nr_t1timer_expiry(struct timer_list *t) |
3189 |
+ case NR_STATE_1: |
3190 |
+ if (nr->n2count == nr->n2) { |
3191 |
+ nr_disconnect(sk, ETIMEDOUT); |
3192 |
+- bh_unlock_sock(sk); |
3193 |
+- return; |
3194 |
++ goto out; |
3195 |
+ } else { |
3196 |
+ nr->n2count++; |
3197 |
+ nr_write_internal(sk, NR_CONNREQ); |
3198 |
+@@ -220,8 +222,7 @@ static void nr_t1timer_expiry(struct timer_list *t) |
3199 |
+ case NR_STATE_2: |
3200 |
+ if (nr->n2count == nr->n2) { |
3201 |
+ nr_disconnect(sk, ETIMEDOUT); |
3202 |
+- bh_unlock_sock(sk); |
3203 |
+- return; |
3204 |
++ goto out; |
3205 |
+ } else { |
3206 |
+ nr->n2count++; |
3207 |
+ nr_write_internal(sk, NR_DISCREQ); |
3208 |
+@@ -231,8 +232,7 @@ static void nr_t1timer_expiry(struct timer_list *t) |
3209 |
+ case NR_STATE_3: |
3210 |
+ if (nr->n2count == nr->n2) { |
3211 |
+ nr_disconnect(sk, ETIMEDOUT); |
3212 |
+- bh_unlock_sock(sk); |
3213 |
+- return; |
3214 |
++ goto out; |
3215 |
+ } else { |
3216 |
+ nr->n2count++; |
3217 |
+ nr_requeue_frames(sk); |
3218 |
+@@ -241,5 +241,7 @@ static void nr_t1timer_expiry(struct timer_list *t) |
3219 |
+ } |
3220 |
+ |
3221 |
+ nr_start_t1timer(sk); |
3222 |
++out: |
3223 |
+ bh_unlock_sock(sk); |
3224 |
++ sock_put(sk); |
3225 |
+ } |
3226 |
+diff --git a/net/sched/act_skbmod.c b/net/sched/act_skbmod.c |
3227 |
+index e858a0a9c0457..f60d349542b10 100644 |
3228 |
+--- a/net/sched/act_skbmod.c |
3229 |
++++ b/net/sched/act_skbmod.c |
3230 |
+@@ -6,6 +6,7 @@ |
3231 |
+ */ |
3232 |
+ |
3233 |
+ #include <linux/module.h> |
3234 |
++#include <linux/if_arp.h> |
3235 |
+ #include <linux/init.h> |
3236 |
+ #include <linux/kernel.h> |
3237 |
+ #include <linux/skbuff.h> |
3238 |
+@@ -33,6 +34,13 @@ static int tcf_skbmod_act(struct sk_buff *skb, const struct tc_action *a, |
3239 |
+ tcf_lastuse_update(&d->tcf_tm); |
3240 |
+ bstats_cpu_update(this_cpu_ptr(d->common.cpu_bstats), skb); |
3241 |
+ |
3242 |
++ action = READ_ONCE(d->tcf_action); |
3243 |
++ if (unlikely(action == TC_ACT_SHOT)) |
3244 |
++ goto drop; |
3245 |
++ |
3246 |
++ if (!skb->dev || skb->dev->type != ARPHRD_ETHER) |
3247 |
++ return action; |
3248 |
++ |
3249 |
+ /* XXX: if you are going to edit more fields beyond ethernet header |
3250 |
+ * (example when you add IP header replacement or vlan swap) |
3251 |
+ * then MAX_EDIT_LEN needs to change appropriately |
3252 |
+@@ -41,10 +49,6 @@ static int tcf_skbmod_act(struct sk_buff *skb, const struct tc_action *a, |
3253 |
+ if (unlikely(err)) /* best policy is to drop on the floor */ |
3254 |
+ goto drop; |
3255 |
+ |
3256 |
+- action = READ_ONCE(d->tcf_action); |
3257 |
+- if (unlikely(action == TC_ACT_SHOT)) |
3258 |
+- goto drop; |
3259 |
+- |
3260 |
+ p = rcu_dereference_bh(d->skbmod_p); |
3261 |
+ flags = p->flags; |
3262 |
+ if (flags & SKBMOD_F_DMAC) |
3263 |
+diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c |
3264 |
+index 83e5a8aa2fb11..7f20fd37e01e0 100644 |
3265 |
+--- a/net/sched/cls_api.c |
3266 |
++++ b/net/sched/cls_api.c |
3267 |
+@@ -2866,7 +2866,7 @@ replay: |
3268 |
+ break; |
3269 |
+ case RTM_GETCHAIN: |
3270 |
+ err = tc_chain_notify(chain, skb, n->nlmsg_seq, |
3271 |
+- n->nlmsg_seq, n->nlmsg_type, true); |
3272 |
++ n->nlmsg_flags, n->nlmsg_type, true); |
3273 |
+ if (err < 0) |
3274 |
+ NL_SET_ERR_MSG(extack, "Failed to send chain notify message"); |
3275 |
+ break; |
3276 |
+diff --git a/net/sched/cls_tcindex.c b/net/sched/cls_tcindex.c |
3277 |
+index 3e81f87d0c89f..684187a1fdb91 100644 |
3278 |
+--- a/net/sched/cls_tcindex.c |
3279 |
++++ b/net/sched/cls_tcindex.c |
3280 |
+@@ -278,6 +278,8 @@ static int tcindex_filter_result_init(struct tcindex_filter_result *r, |
3281 |
+ TCA_TCINDEX_POLICE); |
3282 |
+ } |
3283 |
+ |
3284 |
++static void tcindex_free_perfect_hash(struct tcindex_data *cp); |
3285 |
++ |
3286 |
+ static void tcindex_partial_destroy_work(struct work_struct *work) |
3287 |
+ { |
3288 |
+ struct tcindex_data *p = container_of(to_rcu_work(work), |
3289 |
+@@ -285,7 +287,8 @@ static void tcindex_partial_destroy_work(struct work_struct *work) |
3290 |
+ rwork); |
3291 |
+ |
3292 |
+ rtnl_lock(); |
3293 |
+- kfree(p->perfect); |
3294 |
++ if (p->perfect) |
3295 |
++ tcindex_free_perfect_hash(p); |
3296 |
+ kfree(p); |
3297 |
+ rtnl_unlock(); |
3298 |
+ } |
3299 |
+diff --git a/net/sctp/auth.c b/net/sctp/auth.c |
3300 |
+index 1d898ee4018c9..7eced1e523a5e 100644 |
3301 |
+--- a/net/sctp/auth.c |
3302 |
++++ b/net/sctp/auth.c |
3303 |
+@@ -866,6 +866,8 @@ int sctp_auth_set_key(struct sctp_endpoint *ep, |
3304 |
+ if (replace) { |
3305 |
+ list_del_init(&shkey->key_list); |
3306 |
+ sctp_auth_shkey_release(shkey); |
3307 |
++ if (asoc && asoc->active_key_id == auth_key->sca_keynumber) |
3308 |
++ sctp_auth_asoc_init_active_key(asoc, GFP_KERNEL); |
3309 |
+ } |
3310 |
+ list_add(&cur_key->key_list, sh_keys); |
3311 |
+ |
3312 |
+diff --git a/sound/isa/sb/sb16_csp.c b/sound/isa/sb/sb16_csp.c |
3313 |
+index ef1289cc78a48..30021ab5e0e99 100644 |
3314 |
+--- a/sound/isa/sb/sb16_csp.c |
3315 |
++++ b/sound/isa/sb/sb16_csp.c |
3316 |
+@@ -814,6 +814,7 @@ static int snd_sb_csp_start(struct snd_sb_csp * p, int sample_width, int channel |
3317 |
+ mixR = snd_sbmixer_read(p->chip, SB_DSP4_PCM_DEV + 1); |
3318 |
+ snd_sbmixer_write(p->chip, SB_DSP4_PCM_DEV, mixL & 0x7); |
3319 |
+ snd_sbmixer_write(p->chip, SB_DSP4_PCM_DEV + 1, mixR & 0x7); |
3320 |
++ spin_unlock_irqrestore(&p->chip->mixer_lock, flags); |
3321 |
+ |
3322 |
+ spin_lock(&p->chip->reg_lock); |
3323 |
+ set_mode_register(p->chip, 0xc0); /* c0 = STOP */ |
3324 |
+@@ -853,6 +854,7 @@ static int snd_sb_csp_start(struct snd_sb_csp * p, int sample_width, int channel |
3325 |
+ spin_unlock(&p->chip->reg_lock); |
3326 |
+ |
3327 |
+ /* restore PCM volume */ |
3328 |
++ spin_lock_irqsave(&p->chip->mixer_lock, flags); |
3329 |
+ snd_sbmixer_write(p->chip, SB_DSP4_PCM_DEV, mixL); |
3330 |
+ snd_sbmixer_write(p->chip, SB_DSP4_PCM_DEV + 1, mixR); |
3331 |
+ spin_unlock_irqrestore(&p->chip->mixer_lock, flags); |
3332 |
+@@ -878,6 +880,7 @@ static int snd_sb_csp_stop(struct snd_sb_csp * p) |
3333 |
+ mixR = snd_sbmixer_read(p->chip, SB_DSP4_PCM_DEV + 1); |
3334 |
+ snd_sbmixer_write(p->chip, SB_DSP4_PCM_DEV, mixL & 0x7); |
3335 |
+ snd_sbmixer_write(p->chip, SB_DSP4_PCM_DEV + 1, mixR & 0x7); |
3336 |
++ spin_unlock_irqrestore(&p->chip->mixer_lock, flags); |
3337 |
+ |
3338 |
+ spin_lock(&p->chip->reg_lock); |
3339 |
+ if (p->running & SNDRV_SB_CSP_ST_QSOUND) { |
3340 |
+@@ -892,6 +895,7 @@ static int snd_sb_csp_stop(struct snd_sb_csp * p) |
3341 |
+ spin_unlock(&p->chip->reg_lock); |
3342 |
+ |
3343 |
+ /* restore PCM volume */ |
3344 |
++ spin_lock_irqsave(&p->chip->mixer_lock, flags); |
3345 |
+ snd_sbmixer_write(p->chip, SB_DSP4_PCM_DEV, mixL); |
3346 |
+ snd_sbmixer_write(p->chip, SB_DSP4_PCM_DEV + 1, mixR); |
3347 |
+ spin_unlock_irqrestore(&p->chip->mixer_lock, flags); |
3348 |
+diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c |
3349 |
+index f620b402b309f..5128a5df16fd3 100644 |
3350 |
+--- a/sound/pci/hda/patch_hdmi.c |
3351 |
++++ b/sound/pci/hda/patch_hdmi.c |
3352 |
+@@ -1820,6 +1820,7 @@ static int hdmi_add_cvt(struct hda_codec *codec, hda_nid_t cvt_nid) |
3353 |
+ static const struct snd_pci_quirk force_connect_list[] = { |
3354 |
+ SND_PCI_QUIRK(0x103c, 0x870f, "HP", 1), |
3355 |
+ SND_PCI_QUIRK(0x103c, 0x871a, "HP", 1), |
3356 |
++ SND_PCI_QUIRK(0x1462, 0xec94, "MS-7C94", 1), |
3357 |
+ {} |
3358 |
+ }; |
3359 |
+ |
3360 |
+diff --git a/sound/soc/codecs/rt5631.c b/sound/soc/codecs/rt5631.c |
3361 |
+index f70b9f7e68bba..281957a8fa867 100644 |
3362 |
+--- a/sound/soc/codecs/rt5631.c |
3363 |
++++ b/sound/soc/codecs/rt5631.c |
3364 |
+@@ -1691,6 +1691,8 @@ static const struct regmap_config rt5631_regmap_config = { |
3365 |
+ .reg_defaults = rt5631_reg, |
3366 |
+ .num_reg_defaults = ARRAY_SIZE(rt5631_reg), |
3367 |
+ .cache_type = REGCACHE_RBTREE, |
3368 |
++ .use_single_read = true, |
3369 |
++ .use_single_write = true, |
3370 |
+ }; |
3371 |
+ |
3372 |
+ static int rt5631_i2c_probe(struct i2c_client *i2c, |
3373 |
+diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c |
3374 |
+index 22841ed2411e2..67eb1293fa155 100644 |
3375 |
+--- a/sound/usb/mixer.c |
3376 |
++++ b/sound/usb/mixer.c |
3377 |
+@@ -3242,7 +3242,15 @@ static void snd_usb_mixer_dump_cval(struct snd_info_buffer *buffer, |
3378 |
+ { |
3379 |
+ struct usb_mixer_elem_info *cval = mixer_elem_list_to_info(list); |
3380 |
+ static const char * const val_types[] = { |
3381 |
+- "BOOLEAN", "INV_BOOLEAN", "S8", "U8", "S16", "U16", "S32", "U32", |
3382 |
++ [USB_MIXER_BOOLEAN] = "BOOLEAN", |
3383 |
++ [USB_MIXER_INV_BOOLEAN] = "INV_BOOLEAN", |
3384 |
++ [USB_MIXER_S8] = "S8", |
3385 |
++ [USB_MIXER_U8] = "U8", |
3386 |
++ [USB_MIXER_S16] = "S16", |
3387 |
++ [USB_MIXER_U16] = "U16", |
3388 |
++ [USB_MIXER_S32] = "S32", |
3389 |
++ [USB_MIXER_U32] = "U32", |
3390 |
++ [USB_MIXER_BESPOKEN] = "BESPOKEN", |
3391 |
+ }; |
3392 |
+ snd_iprintf(buffer, " Info: id=%i, control=%i, cmask=0x%x, " |
3393 |
+ "channels=%i, type=\"%s\"\n", cval->head.id, |
3394 |
+diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c |
3395 |
+index 186e90e3636c7..5b17a5c5785c0 100644 |
3396 |
+--- a/sound/usb/quirks.c |
3397 |
++++ b/sound/usb/quirks.c |
3398 |
+@@ -1840,6 +1840,9 @@ static const struct registration_quirk registration_quirks[] = { |
3399 |
+ REG_QUIRK_ENTRY(0x0951, 0x16d8, 2), /* Kingston HyperX AMP */ |
3400 |
+ REG_QUIRK_ENTRY(0x0951, 0x16ed, 2), /* Kingston HyperX Cloud Alpha S */ |
3401 |
+ REG_QUIRK_ENTRY(0x0951, 0x16ea, 2), /* Kingston HyperX Cloud Flight S */ |
3402 |
++ REG_QUIRK_ENTRY(0x0ecb, 0x1f46, 2), /* JBL Quantum 600 */ |
3403 |
++ REG_QUIRK_ENTRY(0x0ecb, 0x2039, 2), /* JBL Quantum 400 */ |
3404 |
++ REG_QUIRK_ENTRY(0x0ecb, 0x203e, 2), /* JBL Quantum 800 */ |
3405 |
+ { 0 } /* terminator */ |
3406 |
+ }; |
3407 |
+ |
3408 |
+diff --git a/tools/bpf/bpftool/common.c b/tools/bpf/bpftool/common.c |
3409 |
+index 88264abaa738a..a209f53901b8c 100644 |
3410 |
+--- a/tools/bpf/bpftool/common.c |
3411 |
++++ b/tools/bpf/bpftool/common.c |
3412 |
+@@ -171,6 +171,11 @@ int mount_bpffs_for_pin(const char *name) |
3413 |
+ int err = 0; |
3414 |
+ |
3415 |
+ file = malloc(strlen(name) + 1); |
3416 |
++ if (!file) { |
3417 |
++ p_err("mem alloc failed"); |
3418 |
++ return -1; |
3419 |
++ } |
3420 |
++ |
3421 |
+ strcpy(file, name); |
3422 |
+ dir = dirname(file); |
3423 |
+ |
3424 |
+diff --git a/tools/perf/builtin-inject.c b/tools/perf/builtin-inject.c |
3425 |
+index 0d524ef3606d7..6b6bb86d62d35 100644 |
3426 |
+--- a/tools/perf/builtin-inject.c |
3427 |
++++ b/tools/perf/builtin-inject.c |
3428 |
+@@ -836,8 +836,10 @@ int cmd_inject(int argc, const char **argv) |
3429 |
+ |
3430 |
+ data.path = inject.input_name; |
3431 |
+ inject.session = perf_session__new(&data, inject.output.is_pipe, &inject.tool); |
3432 |
+- if (IS_ERR(inject.session)) |
3433 |
+- return PTR_ERR(inject.session); |
3434 |
++ if (IS_ERR(inject.session)) { |
3435 |
++ ret = PTR_ERR(inject.session); |
3436 |
++ goto out_close_output; |
3437 |
++ } |
3438 |
+ |
3439 |
+ if (zstd_init(&(inject.session->zstd_data), 0) < 0) |
3440 |
+ pr_warning("Decompression initialization failed.\n"); |
3441 |
+@@ -874,5 +876,7 @@ int cmd_inject(int argc, const char **argv) |
3442 |
+ out_delete: |
3443 |
+ zstd_fini(&(inject.session->zstd_data)); |
3444 |
+ perf_session__delete(inject.session); |
3445 |
++out_close_output: |
3446 |
++ perf_data__close(&inject.output); |
3447 |
+ return ret; |
3448 |
+ } |
3449 |
+diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c |
3450 |
+index da016f398aa80..f3ff825d9dd33 100644 |
3451 |
+--- a/tools/perf/builtin-script.c |
3452 |
++++ b/tools/perf/builtin-script.c |
3453 |
+@@ -2474,6 +2474,12 @@ static void perf_script__exit_per_event_dump_stats(struct perf_script *script) |
3454 |
+ } |
3455 |
+ } |
3456 |
+ |
3457 |
++static void perf_script__exit(struct perf_script *script) |
3458 |
++{ |
3459 |
++ perf_thread_map__put(script->threads); |
3460 |
++ perf_cpu_map__put(script->cpus); |
3461 |
++} |
3462 |
++ |
3463 |
+ static int __cmd_script(struct perf_script *script) |
3464 |
+ { |
3465 |
+ int ret; |
3466 |
+@@ -3893,6 +3899,7 @@ out_delete: |
3467 |
+ |
3468 |
+ perf_evlist__free_stats(session->evlist); |
3469 |
+ perf_session__delete(session); |
3470 |
++ perf_script__exit(&script); |
3471 |
+ |
3472 |
+ if (script_started) |
3473 |
+ cleanup_scripting(); |
3474 |
+diff --git a/tools/perf/tests/event_update.c b/tools/perf/tests/event_update.c |
3475 |
+index c727379cf20e1..195b29797acc4 100644 |
3476 |
+--- a/tools/perf/tests/event_update.c |
3477 |
++++ b/tools/perf/tests/event_update.c |
3478 |
+@@ -119,6 +119,6 @@ int test__event_update(struct test *test __maybe_unused, int subtest __maybe_unu |
3479 |
+ TEST_ASSERT_VAL("failed to synthesize attr update cpus", |
3480 |
+ !perf_event__synthesize_event_update_cpus(&tmp.tool, evsel, process_event_cpus)); |
3481 |
+ |
3482 |
+- perf_cpu_map__put(evsel->core.own_cpus); |
3483 |
++ evlist__delete(evlist); |
3484 |
+ return 0; |
3485 |
+ } |
3486 |
+diff --git a/tools/perf/tests/topology.c b/tools/perf/tests/topology.c |
3487 |
+index 22daf2bdf5faf..f4a2c0df09549 100644 |
3488 |
+--- a/tools/perf/tests/topology.c |
3489 |
++++ b/tools/perf/tests/topology.c |
3490 |
+@@ -52,6 +52,7 @@ static int session_write_header(char *path) |
3491 |
+ TEST_ASSERT_VAL("failed to write header", |
3492 |
+ !perf_session__write_header(session, session->evlist, data.file.fd, true)); |
3493 |
+ |
3494 |
++ evlist__delete(session->evlist); |
3495 |
+ perf_session__delete(session); |
3496 |
+ |
3497 |
+ return 0; |
3498 |
+diff --git a/tools/perf/util/data.c b/tools/perf/util/data.c |
3499 |
+index 7534455ffc6a6..a3f912615690f 100644 |
3500 |
+--- a/tools/perf/util/data.c |
3501 |
++++ b/tools/perf/util/data.c |
3502 |
+@@ -20,7 +20,7 @@ |
3503 |
+ |
3504 |
+ static void close_dir(struct perf_data_file *files, int nr) |
3505 |
+ { |
3506 |
+- while (--nr >= 1) { |
3507 |
++ while (--nr >= 0) { |
3508 |
+ close(files[nr].fd); |
3509 |
+ zfree(&files[nr].path); |
3510 |
+ } |
3511 |
+diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c |
3512 |
+index ab2e130dc07a6..7f07a5dc555f8 100644 |
3513 |
+--- a/tools/perf/util/dso.c |
3514 |
++++ b/tools/perf/util/dso.c |
3515 |
+@@ -1086,8 +1086,10 @@ struct map *dso__new_map(const char *name) |
3516 |
+ struct map *map = NULL; |
3517 |
+ struct dso *dso = dso__new(name); |
3518 |
+ |
3519 |
+- if (dso) |
3520 |
++ if (dso) { |
3521 |
+ map = map__new2(0, dso); |
3522 |
++ dso__put(dso); |
3523 |
++ } |
3524 |
+ |
3525 |
+ return map; |
3526 |
+ } |
3527 |
+diff --git a/tools/perf/util/env.c b/tools/perf/util/env.c |
3528 |
+index 018ecf7b6da9b..0fafcf264d235 100644 |
3529 |
+--- a/tools/perf/util/env.c |
3530 |
++++ b/tools/perf/util/env.c |
3531 |
+@@ -175,6 +175,7 @@ void perf_env__exit(struct perf_env *env) |
3532 |
+ zfree(&env->cpuid); |
3533 |
+ zfree(&env->cmdline); |
3534 |
+ zfree(&env->cmdline_argv); |
3535 |
++ zfree(&env->sibling_dies); |
3536 |
+ zfree(&env->sibling_cores); |
3537 |
+ zfree(&env->sibling_threads); |
3538 |
+ zfree(&env->pmu_mappings); |
3539 |
+diff --git a/tools/perf/util/lzma.c b/tools/perf/util/lzma.c |
3540 |
+index 39062df026291..51424cdc3b682 100644 |
3541 |
+--- a/tools/perf/util/lzma.c |
3542 |
++++ b/tools/perf/util/lzma.c |
3543 |
+@@ -69,7 +69,7 @@ int lzma_decompress_to_file(const char *input, int output_fd) |
3544 |
+ |
3545 |
+ if (ferror(infile)) { |
3546 |
+ pr_err("lzma: read error: %s\n", strerror(errno)); |
3547 |
+- goto err_fclose; |
3548 |
++ goto err_lzma_end; |
3549 |
+ } |
3550 |
+ |
3551 |
+ if (feof(infile)) |
3552 |
+@@ -83,7 +83,7 @@ int lzma_decompress_to_file(const char *input, int output_fd) |
3553 |
+ |
3554 |
+ if (writen(output_fd, buf_out, write_size) != write_size) { |
3555 |
+ pr_err("lzma: write error: %s\n", strerror(errno)); |
3556 |
+- goto err_fclose; |
3557 |
++ goto err_lzma_end; |
3558 |
+ } |
3559 |
+ |
3560 |
+ strm.next_out = buf_out; |
3561 |
+@@ -95,11 +95,13 @@ int lzma_decompress_to_file(const char *input, int output_fd) |
3562 |
+ break; |
3563 |
+ |
3564 |
+ pr_err("lzma: failed %s\n", lzma_strerror(ret)); |
3565 |
+- goto err_fclose; |
3566 |
++ goto err_lzma_end; |
3567 |
+ } |
3568 |
+ } |
3569 |
+ |
3570 |
+ err = 0; |
3571 |
++err_lzma_end: |
3572 |
++ lzma_end(&strm); |
3573 |
+ err_fclose: |
3574 |
+ fclose(infile); |
3575 |
+ return err; |
3576 |
+diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c |
3577 |
+index 571e99c908a0e..1ae5c51a70359 100644 |
3578 |
+--- a/tools/perf/util/map.c |
3579 |
++++ b/tools/perf/util/map.c |
3580 |
+@@ -214,6 +214,8 @@ struct map *map__new(struct machine *machine, u64 start, u64 len, |
3581 |
+ if (!(prot & PROT_EXEC)) |
3582 |
+ dso__set_loaded(dso); |
3583 |
+ } |
3584 |
++ |
3585 |
++ nsinfo__put(dso->nsinfo); |
3586 |
+ dso->nsinfo = nsi; |
3587 |
+ dso__put(dso); |
3588 |
+ } |
3589 |
+diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c |
3590 |
+index a5cb1a3a10644..6357ac508ad1e 100644 |
3591 |
+--- a/tools/perf/util/probe-event.c |
3592 |
++++ b/tools/perf/util/probe-event.c |
3593 |
+@@ -175,8 +175,10 @@ struct map *get_target_map(const char *target, struct nsinfo *nsi, bool user) |
3594 |
+ struct map *map; |
3595 |
+ |
3596 |
+ map = dso__new_map(target); |
3597 |
+- if (map && map->dso) |
3598 |
++ if (map && map->dso) { |
3599 |
++ nsinfo__put(map->dso->nsinfo); |
3600 |
+ map->dso->nsinfo = nsinfo__get(nsi); |
3601 |
++ } |
3602 |
+ return map; |
3603 |
+ } else { |
3604 |
+ return kernel_get_module_map(target); |
3605 |
+diff --git a/tools/perf/util/probe-file.c b/tools/perf/util/probe-file.c |
3606 |
+index f778f8e7e65a3..5558e2adebe4e 100644 |
3607 |
+--- a/tools/perf/util/probe-file.c |
3608 |
++++ b/tools/perf/util/probe-file.c |
3609 |
+@@ -337,11 +337,11 @@ int probe_file__del_events(int fd, struct strfilter *filter) |
3610 |
+ |
3611 |
+ ret = probe_file__get_events(fd, filter, namelist); |
3612 |
+ if (ret < 0) |
3613 |
+- return ret; |
3614 |
++ goto out; |
3615 |
+ |
3616 |
+ ret = probe_file__del_strlist(fd, namelist); |
3617 |
++out: |
3618 |
+ strlist__delete(namelist); |
3619 |
+- |
3620 |
+ return ret; |
3621 |
+ } |
3622 |
+ |
3623 |
+diff --git a/tools/testing/selftests/net/icmp_redirect.sh b/tools/testing/selftests/net/icmp_redirect.sh |
3624 |
+index bf361f30d6ef9..104a7a5f13b1e 100755 |
3625 |
+--- a/tools/testing/selftests/net/icmp_redirect.sh |
3626 |
++++ b/tools/testing/selftests/net/icmp_redirect.sh |
3627 |
+@@ -309,9 +309,10 @@ check_exception() |
3628 |
+ fi |
3629 |
+ log_test $? 0 "IPv4: ${desc}" |
3630 |
+ |
3631 |
+- if [ "$with_redirect" = "yes" ]; then |
3632 |
++ # No PMTU info for test "redirect" and "mtu exception plus redirect" |
3633 |
++ if [ "$with_redirect" = "yes" ] && [ "$desc" != "redirect exception plus mtu" ]; then |
3634 |
+ ip -netns h1 -6 ro get ${H1_VRF_ARG} ${H2_N2_IP6} | \ |
3635 |
+- grep -q "${H2_N2_IP6} from :: via ${R2_LLADDR} dev br0.*${mtu}" |
3636 |
++ grep -v "mtu" | grep -q "${H2_N2_IP6} .*via ${R2_LLADDR} dev br0" |
3637 |
+ elif [ -n "${mtu}" ]; then |
3638 |
+ ip -netns h1 -6 ro get ${H1_VRF_ARG} ${H2_N2_IP6} | \ |
3639 |
+ grep -q "${mtu}" |
3640 |
+diff --git a/tools/testing/selftests/vm/userfaultfd.c b/tools/testing/selftests/vm/userfaultfd.c |
3641 |
+index d3362777a4258..17ac167823a6d 100644 |
3642 |
+--- a/tools/testing/selftests/vm/userfaultfd.c |
3643 |
++++ b/tools/testing/selftests/vm/userfaultfd.c |
3644 |
+@@ -139,8 +139,10 @@ static int anon_release_pages(char *rel_area) |
3645 |
+ |
3646 |
+ static void anon_allocate_area(void **alloc_area) |
3647 |
+ { |
3648 |
+- if (posix_memalign(alloc_area, page_size, nr_pages * page_size)) { |
3649 |
+- fprintf(stderr, "out of memory\n"); |
3650 |
++ *alloc_area = mmap(NULL, nr_pages * page_size, PROT_READ | PROT_WRITE, |
3651 |
++ MAP_ANONYMOUS | MAP_PRIVATE, -1, 0); |
3652 |
++ if (*alloc_area == MAP_FAILED) |
3653 |
++ fprintf(stderr, "mmap of anonymous memory failed"); |
3654 |
+ *alloc_area = NULL; |
3655 |
+ } |
3656 |
+ } |