1 |
commit: 1814c32b85ef3cfdb642fda08350c9f535645902 |
2 |
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sat May 2 13:25:38 2020 +0000 |
4 |
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat May 2 13:25:38 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=1814c32b |
7 |
|
8 |
Linux patch 5.4.37 |
9 |
|
10 |
Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org> |
11 |
|
12 |
0000_README | 4 + |
13 |
1036_linux-5.4.37.patch | 3708 +++++++++++++++++++++++++++++++++++++++++++++++ |
14 |
2 files changed, 3712 insertions(+) |
15 |
|
16 |
diff --git a/0000_README b/0000_README |
17 |
index 3a9fc8f..0cb47e8 100644 |
18 |
--- a/0000_README |
19 |
+++ b/0000_README |
20 |
@@ -187,6 +187,10 @@ Patch: 1035_linux-5.4.36.patch |
21 |
From: http://www.kernel.org |
22 |
Desc: Linux 5.4.36 |
23 |
|
24 |
+Patch: 1036_linux-5.4.37.patch |
25 |
+From: http://www.kernel.org |
26 |
+Desc: Linux 5.4.37 |
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/1036_linux-5.4.37.patch b/1036_linux-5.4.37.patch |
33 |
new file mode 100644 |
34 |
index 0000000..878dcb4 |
35 |
--- /dev/null |
36 |
+++ b/1036_linux-5.4.37.patch |
37 |
@@ -0,0 +1,3708 @@ |
38 |
+diff --git a/Makefile b/Makefile |
39 |
+index 947bf9e3a954..33690285d6aa 100644 |
40 |
+--- a/Makefile |
41 |
++++ b/Makefile |
42 |
+@@ -1,7 +1,7 @@ |
43 |
+ # SPDX-License-Identifier: GPL-2.0 |
44 |
+ VERSION = 5 |
45 |
+ PATCHLEVEL = 4 |
46 |
+-SUBLEVEL = 36 |
47 |
++SUBLEVEL = 37 |
48 |
+ EXTRAVERSION = |
49 |
+ NAME = Kleptomaniac Octopus |
50 |
+ |
51 |
+diff --git a/arch/arm/boot/dts/bcm283x.dtsi b/arch/arm/boot/dts/bcm283x.dtsi |
52 |
+index 90125ce19a1b..50c64146d492 100644 |
53 |
+--- a/arch/arm/boot/dts/bcm283x.dtsi |
54 |
++++ b/arch/arm/boot/dts/bcm283x.dtsi |
55 |
+@@ -488,6 +488,7 @@ |
56 |
+ "dsi0_ddr2", |
57 |
+ "dsi0_ddr"; |
58 |
+ |
59 |
++ status = "disabled"; |
60 |
+ }; |
61 |
+ |
62 |
+ thermal: thermal@7e212000 { |
63 |
+diff --git a/arch/arm64/include/asm/sysreg.h b/arch/arm64/include/asm/sysreg.h |
64 |
+index 6e919fafb43d..9b68f1b3915e 100644 |
65 |
+--- a/arch/arm64/include/asm/sysreg.h |
66 |
++++ b/arch/arm64/include/asm/sysreg.h |
67 |
+@@ -49,7 +49,9 @@ |
68 |
+ #ifndef CONFIG_BROKEN_GAS_INST |
69 |
+ |
70 |
+ #ifdef __ASSEMBLY__ |
71 |
+-#define __emit_inst(x) .inst (x) |
72 |
++// The space separator is omitted so that __emit_inst(x) can be parsed as |
73 |
++// either an assembler directive or an assembler macro argument. |
74 |
++#define __emit_inst(x) .inst(x) |
75 |
+ #else |
76 |
+ #define __emit_inst(x) ".inst " __stringify((x)) "\n\t" |
77 |
+ #endif |
78 |
+diff --git a/arch/s390/kernel/diag.c b/arch/s390/kernel/diag.c |
79 |
+index 61f2b0412345..ccba63aaeb47 100644 |
80 |
+--- a/arch/s390/kernel/diag.c |
81 |
++++ b/arch/s390/kernel/diag.c |
82 |
+@@ -133,7 +133,7 @@ void diag_stat_inc(enum diag_stat_enum nr) |
83 |
+ } |
84 |
+ EXPORT_SYMBOL(diag_stat_inc); |
85 |
+ |
86 |
+-void diag_stat_inc_norecursion(enum diag_stat_enum nr) |
87 |
++void notrace diag_stat_inc_norecursion(enum diag_stat_enum nr) |
88 |
+ { |
89 |
+ this_cpu_inc(diag_stat.counter[nr]); |
90 |
+ trace_s390_diagnose_norecursion(diag_map[nr].code); |
91 |
+diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c |
92 |
+index f468a10e5206..66bf050d785c 100644 |
93 |
+--- a/arch/s390/kernel/smp.c |
94 |
++++ b/arch/s390/kernel/smp.c |
95 |
+@@ -403,7 +403,7 @@ int smp_find_processor_id(u16 address) |
96 |
+ return -1; |
97 |
+ } |
98 |
+ |
99 |
+-bool arch_vcpu_is_preempted(int cpu) |
100 |
++bool notrace arch_vcpu_is_preempted(int cpu) |
101 |
+ { |
102 |
+ if (test_cpu_flag_of(CIF_ENABLED_WAIT, cpu)) |
103 |
+ return false; |
104 |
+@@ -413,7 +413,7 @@ bool arch_vcpu_is_preempted(int cpu) |
105 |
+ } |
106 |
+ EXPORT_SYMBOL(arch_vcpu_is_preempted); |
107 |
+ |
108 |
+-void smp_yield_cpu(int cpu) |
109 |
++void notrace smp_yield_cpu(int cpu) |
110 |
+ { |
111 |
+ if (MACHINE_HAS_DIAG9C) { |
112 |
+ diag_stat_inc_norecursion(DIAG_STAT_X09C); |
113 |
+diff --git a/arch/s390/kernel/trace.c b/arch/s390/kernel/trace.c |
114 |
+index 490b52e85014..11a669f3cc93 100644 |
115 |
+--- a/arch/s390/kernel/trace.c |
116 |
++++ b/arch/s390/kernel/trace.c |
117 |
+@@ -14,7 +14,7 @@ EXPORT_TRACEPOINT_SYMBOL(s390_diagnose); |
118 |
+ |
119 |
+ static DEFINE_PER_CPU(unsigned int, diagnose_trace_depth); |
120 |
+ |
121 |
+-void trace_s390_diagnose_norecursion(int diag_nr) |
122 |
++void notrace trace_s390_diagnose_norecursion(int diag_nr) |
123 |
+ { |
124 |
+ unsigned long flags; |
125 |
+ unsigned int *depth; |
126 |
+diff --git a/arch/s390/pci/pci_irq.c b/arch/s390/pci/pci_irq.c |
127 |
+index fbe97ab2e228..743f257cf2cb 100644 |
128 |
+--- a/arch/s390/pci/pci_irq.c |
129 |
++++ b/arch/s390/pci/pci_irq.c |
130 |
+@@ -115,7 +115,6 @@ static struct irq_chip zpci_irq_chip = { |
131 |
+ .name = "PCI-MSI", |
132 |
+ .irq_unmask = pci_msi_unmask_irq, |
133 |
+ .irq_mask = pci_msi_mask_irq, |
134 |
+- .irq_set_affinity = zpci_set_irq_affinity, |
135 |
+ }; |
136 |
+ |
137 |
+ static void zpci_handle_cpu_local_irq(bool rescan) |
138 |
+@@ -276,7 +275,9 @@ int arch_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type) |
139 |
+ rc = -EIO; |
140 |
+ if (hwirq - bit >= msi_vecs) |
141 |
+ break; |
142 |
+- irq = __irq_alloc_descs(-1, 0, 1, 0, THIS_MODULE, msi->affinity); |
143 |
++ irq = __irq_alloc_descs(-1, 0, 1, 0, THIS_MODULE, |
144 |
++ (irq_delivery == DIRECTED) ? |
145 |
++ msi->affinity : NULL); |
146 |
+ if (irq < 0) |
147 |
+ return -ENOMEM; |
148 |
+ rc = irq_set_msi_desc(irq, msi); |
149 |
+diff --git a/arch/um/Makefile b/arch/um/Makefile |
150 |
+index d2daa206872d..275f5ffdf6f0 100644 |
151 |
+--- a/arch/um/Makefile |
152 |
++++ b/arch/um/Makefile |
153 |
+@@ -140,6 +140,7 @@ export CFLAGS_vmlinux := $(LINK-y) $(LINK_WRAPS) $(LD_FLAGS_CMDLINE) |
154 |
+ # When cleaning we don't include .config, so we don't include |
155 |
+ # TT or skas makefiles and don't clean skas_ptregs.h. |
156 |
+ CLEAN_FILES += linux x.i gmon.out |
157 |
++MRPROPER_DIRS += arch/$(SUBARCH)/include/generated |
158 |
+ |
159 |
+ archclean: |
160 |
+ @find . \( -name '*.bb' -o -name '*.bbg' -o -name '*.da' \ |
161 |
+diff --git a/arch/x86/kernel/cpu/mshyperv.c b/arch/x86/kernel/cpu/mshyperv.c |
162 |
+index fc8814faae62..1c2f9baf8483 100644 |
163 |
+--- a/arch/x86/kernel/cpu/mshyperv.c |
164 |
++++ b/arch/x86/kernel/cpu/mshyperv.c |
165 |
+@@ -227,8 +227,8 @@ static void __init ms_hyperv_init_platform(void) |
166 |
+ ms_hyperv.misc_features = cpuid_edx(HYPERV_CPUID_FEATURES); |
167 |
+ ms_hyperv.hints = cpuid_eax(HYPERV_CPUID_ENLIGHTMENT_INFO); |
168 |
+ |
169 |
+- pr_info("Hyper-V: features 0x%x, hints 0x%x\n", |
170 |
+- ms_hyperv.features, ms_hyperv.hints); |
171 |
++ pr_info("Hyper-V: features 0x%x, hints 0x%x, misc 0x%x\n", |
172 |
++ ms_hyperv.features, ms_hyperv.hints, ms_hyperv.misc_features); |
173 |
+ |
174 |
+ ms_hyperv.max_vp_index = cpuid_eax(HYPERV_CPUID_IMPLEMENT_LIMITS); |
175 |
+ ms_hyperv.max_lp_index = cpuid_ebx(HYPERV_CPUID_IMPLEMENT_LIMITS); |
176 |
+diff --git a/arch/x86/net/bpf_jit_comp.c b/arch/x86/net/bpf_jit_comp.c |
177 |
+index 991549a1c5f3..18936533666e 100644 |
178 |
+--- a/arch/x86/net/bpf_jit_comp.c |
179 |
++++ b/arch/x86/net/bpf_jit_comp.c |
180 |
+@@ -138,6 +138,19 @@ static bool is_ereg(u32 reg) |
181 |
+ BIT(BPF_REG_AX)); |
182 |
+ } |
183 |
+ |
184 |
++/* |
185 |
++ * is_ereg_8l() == true if BPF register 'reg' is mapped to access x86-64 |
186 |
++ * lower 8-bit registers dil,sil,bpl,spl,r8b..r15b, which need extra byte |
187 |
++ * of encoding. al,cl,dl,bl have simpler encoding. |
188 |
++ */ |
189 |
++static bool is_ereg_8l(u32 reg) |
190 |
++{ |
191 |
++ return is_ereg(reg) || |
192 |
++ (1 << reg) & (BIT(BPF_REG_1) | |
193 |
++ BIT(BPF_REG_2) | |
194 |
++ BIT(BPF_REG_FP)); |
195 |
++} |
196 |
++ |
197 |
+ static bool is_axreg(u32 reg) |
198 |
+ { |
199 |
+ return reg == BPF_REG_0; |
200 |
+@@ -748,9 +761,8 @@ st: if (is_imm8(insn->off)) |
201 |
+ /* STX: *(u8*)(dst_reg + off) = src_reg */ |
202 |
+ case BPF_STX | BPF_MEM | BPF_B: |
203 |
+ /* Emit 'mov byte ptr [rax + off], al' */ |
204 |
+- if (is_ereg(dst_reg) || is_ereg(src_reg) || |
205 |
+- /* We have to add extra byte for x86 SIL, DIL regs */ |
206 |
+- src_reg == BPF_REG_1 || src_reg == BPF_REG_2) |
207 |
++ if (is_ereg(dst_reg) || is_ereg_8l(src_reg)) |
208 |
++ /* Add extra byte for eregs or SIL,DIL,BPL in src_reg */ |
209 |
+ EMIT2(add_2mod(0x40, dst_reg, src_reg), 0x88); |
210 |
+ else |
211 |
+ EMIT1(0x88); |
212 |
+diff --git a/arch/x86/net/bpf_jit_comp32.c b/arch/x86/net/bpf_jit_comp32.c |
213 |
+index 4d2a7a764602..66cd150b7e54 100644 |
214 |
+--- a/arch/x86/net/bpf_jit_comp32.c |
215 |
++++ b/arch/x86/net/bpf_jit_comp32.c |
216 |
+@@ -1847,14 +1847,16 @@ static int do_jit(struct bpf_prog *bpf_prog, int *addrs, u8 *image, |
217 |
+ case BPF_B: |
218 |
+ case BPF_H: |
219 |
+ case BPF_W: |
220 |
+- if (!bpf_prog->aux->verifier_zext) |
221 |
++ if (bpf_prog->aux->verifier_zext) |
222 |
+ break; |
223 |
+ if (dstk) { |
224 |
+ EMIT3(0xC7, add_1reg(0x40, IA32_EBP), |
225 |
+ STACK_VAR(dst_hi)); |
226 |
+ EMIT(0x0, 4); |
227 |
+ } else { |
228 |
+- EMIT3(0xC7, add_1reg(0xC0, dst_hi), 0); |
229 |
++ /* xor dst_hi,dst_hi */ |
230 |
++ EMIT2(0x33, |
231 |
++ add_2reg(0xC0, dst_hi, dst_hi)); |
232 |
+ } |
233 |
+ break; |
234 |
+ case BPF_DW: |
235 |
+@@ -2013,8 +2015,8 @@ static int do_jit(struct bpf_prog *bpf_prog, int *addrs, u8 *image, |
236 |
+ case BPF_JMP | BPF_JSET | BPF_X: |
237 |
+ case BPF_JMP32 | BPF_JSET | BPF_X: { |
238 |
+ bool is_jmp64 = BPF_CLASS(insn->code) == BPF_JMP; |
239 |
+- u8 dreg_lo = dstk ? IA32_EAX : dst_lo; |
240 |
+- u8 dreg_hi = dstk ? IA32_EDX : dst_hi; |
241 |
++ u8 dreg_lo = IA32_EAX; |
242 |
++ u8 dreg_hi = IA32_EDX; |
243 |
+ u8 sreg_lo = sstk ? IA32_ECX : src_lo; |
244 |
+ u8 sreg_hi = sstk ? IA32_EBX : src_hi; |
245 |
+ |
246 |
+@@ -2026,6 +2028,13 @@ static int do_jit(struct bpf_prog *bpf_prog, int *addrs, u8 *image, |
247 |
+ add_2reg(0x40, IA32_EBP, |
248 |
+ IA32_EDX), |
249 |
+ STACK_VAR(dst_hi)); |
250 |
++ } else { |
251 |
++ /* mov dreg_lo,dst_lo */ |
252 |
++ EMIT2(0x89, add_2reg(0xC0, dreg_lo, dst_lo)); |
253 |
++ if (is_jmp64) |
254 |
++ /* mov dreg_hi,dst_hi */ |
255 |
++ EMIT2(0x89, |
256 |
++ add_2reg(0xC0, dreg_hi, dst_hi)); |
257 |
+ } |
258 |
+ |
259 |
+ if (sstk) { |
260 |
+@@ -2050,8 +2059,8 @@ static int do_jit(struct bpf_prog *bpf_prog, int *addrs, u8 *image, |
261 |
+ case BPF_JMP | BPF_JSET | BPF_K: |
262 |
+ case BPF_JMP32 | BPF_JSET | BPF_K: { |
263 |
+ bool is_jmp64 = BPF_CLASS(insn->code) == BPF_JMP; |
264 |
+- u8 dreg_lo = dstk ? IA32_EAX : dst_lo; |
265 |
+- u8 dreg_hi = dstk ? IA32_EDX : dst_hi; |
266 |
++ u8 dreg_lo = IA32_EAX; |
267 |
++ u8 dreg_hi = IA32_EDX; |
268 |
+ u8 sreg_lo = IA32_ECX; |
269 |
+ u8 sreg_hi = IA32_EBX; |
270 |
+ u32 hi; |
271 |
+@@ -2064,6 +2073,13 @@ static int do_jit(struct bpf_prog *bpf_prog, int *addrs, u8 *image, |
272 |
+ add_2reg(0x40, IA32_EBP, |
273 |
+ IA32_EDX), |
274 |
+ STACK_VAR(dst_hi)); |
275 |
++ } else { |
276 |
++ /* mov dreg_lo,dst_lo */ |
277 |
++ EMIT2(0x89, add_2reg(0xC0, dreg_lo, dst_lo)); |
278 |
++ if (is_jmp64) |
279 |
++ /* mov dreg_hi,dst_hi */ |
280 |
++ EMIT2(0x89, |
281 |
++ add_2reg(0xC0, dreg_hi, dst_hi)); |
282 |
+ } |
283 |
+ |
284 |
+ /* mov ecx,imm32 */ |
285 |
+diff --git a/block/blk-iocost.c b/block/blk-iocost.c |
286 |
+index 9a599cc28c29..2dc5dc54e257 100644 |
287 |
+--- a/block/blk-iocost.c |
288 |
++++ b/block/blk-iocost.c |
289 |
+@@ -1594,7 +1594,7 @@ skip_surplus_transfers: |
290 |
+ vrate_min, vrate_max); |
291 |
+ } |
292 |
+ |
293 |
+- trace_iocost_ioc_vrate_adj(ioc, vrate, &missed_ppm, rq_wait_pct, |
294 |
++ trace_iocost_ioc_vrate_adj(ioc, vrate, missed_ppm, rq_wait_pct, |
295 |
+ nr_lagging, nr_shortages, |
296 |
+ nr_surpluses); |
297 |
+ |
298 |
+@@ -1603,7 +1603,7 @@ skip_surplus_transfers: |
299 |
+ ioc->period_us * vrate * INUSE_MARGIN_PCT, 100); |
300 |
+ } else if (ioc->busy_level != prev_busy_level || nr_lagging) { |
301 |
+ trace_iocost_ioc_vrate_adj(ioc, atomic64_read(&ioc->vtime_rate), |
302 |
+- &missed_ppm, rq_wait_pct, nr_lagging, |
303 |
++ missed_ppm, rq_wait_pct, nr_lagging, |
304 |
+ nr_shortages, nr_surpluses); |
305 |
+ } |
306 |
+ |
307 |
+diff --git a/block/blk-mq.c b/block/blk-mq.c |
308 |
+index a8c1a45cedde..757c0fd9f0cc 100644 |
309 |
+--- a/block/blk-mq.c |
310 |
++++ b/block/blk-mq.c |
311 |
+@@ -1232,8 +1232,10 @@ bool blk_mq_dispatch_rq_list(struct request_queue *q, struct list_head *list, |
312 |
+ rq = list_first_entry(list, struct request, queuelist); |
313 |
+ |
314 |
+ hctx = rq->mq_hctx; |
315 |
+- if (!got_budget && !blk_mq_get_dispatch_budget(hctx)) |
316 |
++ if (!got_budget && !blk_mq_get_dispatch_budget(hctx)) { |
317 |
++ blk_mq_put_driver_tag(rq); |
318 |
+ break; |
319 |
++ } |
320 |
+ |
321 |
+ if (!blk_mq_get_driver_tag(rq)) { |
322 |
+ /* |
323 |
+diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c |
324 |
+index 0e99a760aebd..8646147dc194 100644 |
325 |
+--- a/drivers/base/power/main.c |
326 |
++++ b/drivers/base/power/main.c |
327 |
+@@ -726,7 +726,7 @@ static bool dpm_async_fn(struct device *dev, async_func_t func) |
328 |
+ |
329 |
+ if (is_async(dev)) { |
330 |
+ get_device(dev); |
331 |
+- async_schedule(func, dev); |
332 |
++ async_schedule_dev(func, dev); |
333 |
+ return true; |
334 |
+ } |
335 |
+ |
336 |
+diff --git a/drivers/counter/104-quad-8.c b/drivers/counter/104-quad-8.c |
337 |
+index 00b113f4b958..5c23a9a56921 100644 |
338 |
+--- a/drivers/counter/104-quad-8.c |
339 |
++++ b/drivers/counter/104-quad-8.c |
340 |
+@@ -42,6 +42,7 @@ MODULE_PARM_DESC(base, "ACCES 104-QUAD-8 base addresses"); |
341 |
+ * @base: base port address of the IIO device |
342 |
+ */ |
343 |
+ struct quad8_iio { |
344 |
++ struct mutex lock; |
345 |
+ struct counter_device counter; |
346 |
+ unsigned int preset[QUAD8_NUM_COUNTERS]; |
347 |
+ unsigned int count_mode[QUAD8_NUM_COUNTERS]; |
348 |
+@@ -116,6 +117,8 @@ static int quad8_read_raw(struct iio_dev *indio_dev, |
349 |
+ /* Borrow XOR Carry effectively doubles count range */ |
350 |
+ *val = (borrow ^ carry) << 24; |
351 |
+ |
352 |
++ mutex_lock(&priv->lock); |
353 |
++ |
354 |
+ /* Reset Byte Pointer; transfer Counter to Output Latch */ |
355 |
+ outb(QUAD8_CTR_RLD | QUAD8_RLD_RESET_BP | QUAD8_RLD_CNTR_OUT, |
356 |
+ base_offset + 1); |
357 |
+@@ -123,6 +126,8 @@ static int quad8_read_raw(struct iio_dev *indio_dev, |
358 |
+ for (i = 0; i < 3; i++) |
359 |
+ *val |= (unsigned int)inb(base_offset) << (8 * i); |
360 |
+ |
361 |
++ mutex_unlock(&priv->lock); |
362 |
++ |
363 |
+ return IIO_VAL_INT; |
364 |
+ case IIO_CHAN_INFO_ENABLE: |
365 |
+ *val = priv->ab_enable[chan->channel]; |
366 |
+@@ -153,6 +158,8 @@ static int quad8_write_raw(struct iio_dev *indio_dev, |
367 |
+ if ((unsigned int)val > 0xFFFFFF) |
368 |
+ return -EINVAL; |
369 |
+ |
370 |
++ mutex_lock(&priv->lock); |
371 |
++ |
372 |
+ /* Reset Byte Pointer */ |
373 |
+ outb(QUAD8_CTR_RLD | QUAD8_RLD_RESET_BP, base_offset + 1); |
374 |
+ |
375 |
+@@ -176,12 +183,16 @@ static int quad8_write_raw(struct iio_dev *indio_dev, |
376 |
+ /* Reset Error flag */ |
377 |
+ outb(QUAD8_CTR_RLD | QUAD8_RLD_RESET_E, base_offset + 1); |
378 |
+ |
379 |
++ mutex_unlock(&priv->lock); |
380 |
++ |
381 |
+ return 0; |
382 |
+ case IIO_CHAN_INFO_ENABLE: |
383 |
+ /* only boolean values accepted */ |
384 |
+ if (val < 0 || val > 1) |
385 |
+ return -EINVAL; |
386 |
+ |
387 |
++ mutex_lock(&priv->lock); |
388 |
++ |
389 |
+ priv->ab_enable[chan->channel] = val; |
390 |
+ |
391 |
+ ior_cfg = val | priv->preset_enable[chan->channel] << 1; |
392 |
+@@ -189,11 +200,18 @@ static int quad8_write_raw(struct iio_dev *indio_dev, |
393 |
+ /* Load I/O control configuration */ |
394 |
+ outb(QUAD8_CTR_IOR | ior_cfg, base_offset + 1); |
395 |
+ |
396 |
++ mutex_unlock(&priv->lock); |
397 |
++ |
398 |
+ return 0; |
399 |
+ case IIO_CHAN_INFO_SCALE: |
400 |
++ mutex_lock(&priv->lock); |
401 |
++ |
402 |
+ /* Quadrature scaling only available in quadrature mode */ |
403 |
+- if (!priv->quadrature_mode[chan->channel] && (val2 || val != 1)) |
404 |
++ if (!priv->quadrature_mode[chan->channel] && |
405 |
++ (val2 || val != 1)) { |
406 |
++ mutex_unlock(&priv->lock); |
407 |
+ return -EINVAL; |
408 |
++ } |
409 |
+ |
410 |
+ /* Only three gain states (1, 0.5, 0.25) */ |
411 |
+ if (val == 1 && !val2) |
412 |
+@@ -207,11 +225,15 @@ static int quad8_write_raw(struct iio_dev *indio_dev, |
413 |
+ priv->quadrature_scale[chan->channel] = 2; |
414 |
+ break; |
415 |
+ default: |
416 |
++ mutex_unlock(&priv->lock); |
417 |
+ return -EINVAL; |
418 |
+ } |
419 |
+- else |
420 |
++ else { |
421 |
++ mutex_unlock(&priv->lock); |
422 |
+ return -EINVAL; |
423 |
++ } |
424 |
+ |
425 |
++ mutex_unlock(&priv->lock); |
426 |
+ return 0; |
427 |
+ } |
428 |
+ |
429 |
+@@ -248,6 +270,8 @@ static ssize_t quad8_write_preset(struct iio_dev *indio_dev, uintptr_t private, |
430 |
+ if (preset > 0xFFFFFF) |
431 |
+ return -EINVAL; |
432 |
+ |
433 |
++ mutex_lock(&priv->lock); |
434 |
++ |
435 |
+ priv->preset[chan->channel] = preset; |
436 |
+ |
437 |
+ /* Reset Byte Pointer */ |
438 |
+@@ -257,6 +281,8 @@ static ssize_t quad8_write_preset(struct iio_dev *indio_dev, uintptr_t private, |
439 |
+ for (i = 0; i < 3; i++) |
440 |
+ outb(preset >> (8 * i), base_offset); |
441 |
+ |
442 |
++ mutex_unlock(&priv->lock); |
443 |
++ |
444 |
+ return len; |
445 |
+ } |
446 |
+ |
447 |
+@@ -286,6 +312,8 @@ static ssize_t quad8_write_set_to_preset_on_index(struct iio_dev *indio_dev, |
448 |
+ /* Preset enable is active low in Input/Output Control register */ |
449 |
+ preset_enable = !preset_enable; |
450 |
+ |
451 |
++ mutex_lock(&priv->lock); |
452 |
++ |
453 |
+ priv->preset_enable[chan->channel] = preset_enable; |
454 |
+ |
455 |
+ ior_cfg = priv->ab_enable[chan->channel] | |
456 |
+@@ -294,6 +322,8 @@ static ssize_t quad8_write_set_to_preset_on_index(struct iio_dev *indio_dev, |
457 |
+ /* Load I/O control configuration to Input / Output Control Register */ |
458 |
+ outb(QUAD8_CTR_IOR | ior_cfg, base_offset); |
459 |
+ |
460 |
++ mutex_unlock(&priv->lock); |
461 |
++ |
462 |
+ return len; |
463 |
+ } |
464 |
+ |
465 |
+@@ -351,6 +381,8 @@ static int quad8_set_count_mode(struct iio_dev *indio_dev, |
466 |
+ unsigned int mode_cfg = cnt_mode << 1; |
467 |
+ const int base_offset = priv->base + 2 * chan->channel + 1; |
468 |
+ |
469 |
++ mutex_lock(&priv->lock); |
470 |
++ |
471 |
+ priv->count_mode[chan->channel] = cnt_mode; |
472 |
+ |
473 |
+ /* Add quadrature mode configuration */ |
474 |
+@@ -360,6 +392,8 @@ static int quad8_set_count_mode(struct iio_dev *indio_dev, |
475 |
+ /* Load mode configuration to Counter Mode Register */ |
476 |
+ outb(QUAD8_CTR_CMR | mode_cfg, base_offset); |
477 |
+ |
478 |
++ mutex_unlock(&priv->lock); |
479 |
++ |
480 |
+ return 0; |
481 |
+ } |
482 |
+ |
483 |
+@@ -387,19 +421,26 @@ static int quad8_set_synchronous_mode(struct iio_dev *indio_dev, |
484 |
+ const struct iio_chan_spec *chan, unsigned int synchronous_mode) |
485 |
+ { |
486 |
+ struct quad8_iio *const priv = iio_priv(indio_dev); |
487 |
+- const unsigned int idr_cfg = synchronous_mode | |
488 |
+- priv->index_polarity[chan->channel] << 1; |
489 |
+ const int base_offset = priv->base + 2 * chan->channel + 1; |
490 |
++ unsigned int idr_cfg = synchronous_mode; |
491 |
++ |
492 |
++ mutex_lock(&priv->lock); |
493 |
++ |
494 |
++ idr_cfg |= priv->index_polarity[chan->channel] << 1; |
495 |
+ |
496 |
+ /* Index function must be non-synchronous in non-quadrature mode */ |
497 |
+- if (synchronous_mode && !priv->quadrature_mode[chan->channel]) |
498 |
++ if (synchronous_mode && !priv->quadrature_mode[chan->channel]) { |
499 |
++ mutex_unlock(&priv->lock); |
500 |
+ return -EINVAL; |
501 |
++ } |
502 |
+ |
503 |
+ priv->synchronous_mode[chan->channel] = synchronous_mode; |
504 |
+ |
505 |
+ /* Load Index Control configuration to Index Control Register */ |
506 |
+ outb(QUAD8_CTR_IDR | idr_cfg, base_offset); |
507 |
+ |
508 |
++ mutex_unlock(&priv->lock); |
509 |
++ |
510 |
+ return 0; |
511 |
+ } |
512 |
+ |
513 |
+@@ -427,8 +468,12 @@ static int quad8_set_quadrature_mode(struct iio_dev *indio_dev, |
514 |
+ const struct iio_chan_spec *chan, unsigned int quadrature_mode) |
515 |
+ { |
516 |
+ struct quad8_iio *const priv = iio_priv(indio_dev); |
517 |
+- unsigned int mode_cfg = priv->count_mode[chan->channel] << 1; |
518 |
+ const int base_offset = priv->base + 2 * chan->channel + 1; |
519 |
++ unsigned int mode_cfg; |
520 |
++ |
521 |
++ mutex_lock(&priv->lock); |
522 |
++ |
523 |
++ mode_cfg = priv->count_mode[chan->channel] << 1; |
524 |
+ |
525 |
+ if (quadrature_mode) |
526 |
+ mode_cfg |= (priv->quadrature_scale[chan->channel] + 1) << 3; |
527 |
+@@ -446,6 +491,8 @@ static int quad8_set_quadrature_mode(struct iio_dev *indio_dev, |
528 |
+ /* Load mode configuration to Counter Mode Register */ |
529 |
+ outb(QUAD8_CTR_CMR | mode_cfg, base_offset); |
530 |
+ |
531 |
++ mutex_unlock(&priv->lock); |
532 |
++ |
533 |
+ return 0; |
534 |
+ } |
535 |
+ |
536 |
+@@ -473,15 +520,20 @@ static int quad8_set_index_polarity(struct iio_dev *indio_dev, |
537 |
+ const struct iio_chan_spec *chan, unsigned int index_polarity) |
538 |
+ { |
539 |
+ struct quad8_iio *const priv = iio_priv(indio_dev); |
540 |
+- const unsigned int idr_cfg = priv->synchronous_mode[chan->channel] | |
541 |
+- index_polarity << 1; |
542 |
+ const int base_offset = priv->base + 2 * chan->channel + 1; |
543 |
++ unsigned int idr_cfg = index_polarity << 1; |
544 |
++ |
545 |
++ mutex_lock(&priv->lock); |
546 |
++ |
547 |
++ idr_cfg |= priv->synchronous_mode[chan->channel]; |
548 |
+ |
549 |
+ priv->index_polarity[chan->channel] = index_polarity; |
550 |
+ |
551 |
+ /* Load Index Control configuration to Index Control Register */ |
552 |
+ outb(QUAD8_CTR_IDR | idr_cfg, base_offset); |
553 |
+ |
554 |
++ mutex_unlock(&priv->lock); |
555 |
++ |
556 |
+ return 0; |
557 |
+ } |
558 |
+ |
559 |
+@@ -585,7 +637,7 @@ static int quad8_signal_read(struct counter_device *counter, |
560 |
+ static int quad8_count_read(struct counter_device *counter, |
561 |
+ struct counter_count *count, struct counter_count_read_value *val) |
562 |
+ { |
563 |
+- const struct quad8_iio *const priv = counter->priv; |
564 |
++ struct quad8_iio *const priv = counter->priv; |
565 |
+ const int base_offset = priv->base + 2 * count->id; |
566 |
+ unsigned int flags; |
567 |
+ unsigned int borrow; |
568 |
+@@ -600,6 +652,8 @@ static int quad8_count_read(struct counter_device *counter, |
569 |
+ /* Borrow XOR Carry effectively doubles count range */ |
570 |
+ position = (unsigned long)(borrow ^ carry) << 24; |
571 |
+ |
572 |
++ mutex_lock(&priv->lock); |
573 |
++ |
574 |
+ /* Reset Byte Pointer; transfer Counter to Output Latch */ |
575 |
+ outb(QUAD8_CTR_RLD | QUAD8_RLD_RESET_BP | QUAD8_RLD_CNTR_OUT, |
576 |
+ base_offset + 1); |
577 |
+@@ -609,13 +663,15 @@ static int quad8_count_read(struct counter_device *counter, |
578 |
+ |
579 |
+ counter_count_read_value_set(val, COUNTER_COUNT_POSITION, &position); |
580 |
+ |
581 |
++ mutex_unlock(&priv->lock); |
582 |
++ |
583 |
+ return 0; |
584 |
+ } |
585 |
+ |
586 |
+ static int quad8_count_write(struct counter_device *counter, |
587 |
+ struct counter_count *count, struct counter_count_write_value *val) |
588 |
+ { |
589 |
+- const struct quad8_iio *const priv = counter->priv; |
590 |
++ struct quad8_iio *const priv = counter->priv; |
591 |
+ const int base_offset = priv->base + 2 * count->id; |
592 |
+ int err; |
593 |
+ unsigned long position; |
594 |
+@@ -630,6 +686,8 @@ static int quad8_count_write(struct counter_device *counter, |
595 |
+ if (position > 0xFFFFFF) |
596 |
+ return -EINVAL; |
597 |
+ |
598 |
++ mutex_lock(&priv->lock); |
599 |
++ |
600 |
+ /* Reset Byte Pointer */ |
601 |
+ outb(QUAD8_CTR_RLD | QUAD8_RLD_RESET_BP, base_offset + 1); |
602 |
+ |
603 |
+@@ -653,6 +711,8 @@ static int quad8_count_write(struct counter_device *counter, |
604 |
+ /* Reset Error flag */ |
605 |
+ outb(QUAD8_CTR_RLD | QUAD8_RLD_RESET_E, base_offset + 1); |
606 |
+ |
607 |
++ mutex_unlock(&priv->lock); |
608 |
++ |
609 |
+ return 0; |
610 |
+ } |
611 |
+ |
612 |
+@@ -673,13 +733,13 @@ static enum counter_count_function quad8_count_functions_list[] = { |
613 |
+ static int quad8_function_get(struct counter_device *counter, |
614 |
+ struct counter_count *count, size_t *function) |
615 |
+ { |
616 |
+- const struct quad8_iio *const priv = counter->priv; |
617 |
++ struct quad8_iio *const priv = counter->priv; |
618 |
+ const int id = count->id; |
619 |
+- const unsigned int quadrature_mode = priv->quadrature_mode[id]; |
620 |
+- const unsigned int scale = priv->quadrature_scale[id]; |
621 |
+ |
622 |
+- if (quadrature_mode) |
623 |
+- switch (scale) { |
624 |
++ mutex_lock(&priv->lock); |
625 |
++ |
626 |
++ if (priv->quadrature_mode[id]) |
627 |
++ switch (priv->quadrature_scale[id]) { |
628 |
+ case 0: |
629 |
+ *function = QUAD8_COUNT_FUNCTION_QUADRATURE_X1; |
630 |
+ break; |
631 |
+@@ -693,6 +753,8 @@ static int quad8_function_get(struct counter_device *counter, |
632 |
+ else |
633 |
+ *function = QUAD8_COUNT_FUNCTION_PULSE_DIRECTION; |
634 |
+ |
635 |
++ mutex_unlock(&priv->lock); |
636 |
++ |
637 |
+ return 0; |
638 |
+ } |
639 |
+ |
640 |
+@@ -703,10 +765,15 @@ static int quad8_function_set(struct counter_device *counter, |
641 |
+ const int id = count->id; |
642 |
+ unsigned int *const quadrature_mode = priv->quadrature_mode + id; |
643 |
+ unsigned int *const scale = priv->quadrature_scale + id; |
644 |
+- unsigned int mode_cfg = priv->count_mode[id] << 1; |
645 |
+ unsigned int *const synchronous_mode = priv->synchronous_mode + id; |
646 |
+- const unsigned int idr_cfg = priv->index_polarity[id] << 1; |
647 |
+ const int base_offset = priv->base + 2 * id + 1; |
648 |
++ unsigned int mode_cfg; |
649 |
++ unsigned int idr_cfg; |
650 |
++ |
651 |
++ mutex_lock(&priv->lock); |
652 |
++ |
653 |
++ mode_cfg = priv->count_mode[id] << 1; |
654 |
++ idr_cfg = priv->index_polarity[id] << 1; |
655 |
+ |
656 |
+ if (function == QUAD8_COUNT_FUNCTION_PULSE_DIRECTION) { |
657 |
+ *quadrature_mode = 0; |
658 |
+@@ -742,6 +809,8 @@ static int quad8_function_set(struct counter_device *counter, |
659 |
+ /* Load mode configuration to Counter Mode Register */ |
660 |
+ outb(QUAD8_CTR_CMR | mode_cfg, base_offset); |
661 |
+ |
662 |
++ mutex_unlock(&priv->lock); |
663 |
++ |
664 |
+ return 0; |
665 |
+ } |
666 |
+ |
667 |
+@@ -858,15 +927,20 @@ static int quad8_index_polarity_set(struct counter_device *counter, |
668 |
+ { |
669 |
+ struct quad8_iio *const priv = counter->priv; |
670 |
+ const size_t channel_id = signal->id - 16; |
671 |
+- const unsigned int idr_cfg = priv->synchronous_mode[channel_id] | |
672 |
+- index_polarity << 1; |
673 |
+ const int base_offset = priv->base + 2 * channel_id + 1; |
674 |
++ unsigned int idr_cfg = index_polarity << 1; |
675 |
++ |
676 |
++ mutex_lock(&priv->lock); |
677 |
++ |
678 |
++ idr_cfg |= priv->synchronous_mode[channel_id]; |
679 |
+ |
680 |
+ priv->index_polarity[channel_id] = index_polarity; |
681 |
+ |
682 |
+ /* Load Index Control configuration to Index Control Register */ |
683 |
+ outb(QUAD8_CTR_IDR | idr_cfg, base_offset); |
684 |
+ |
685 |
++ mutex_unlock(&priv->lock); |
686 |
++ |
687 |
+ return 0; |
688 |
+ } |
689 |
+ |
690 |
+@@ -893,19 +967,26 @@ static int quad8_synchronous_mode_set(struct counter_device *counter, |
691 |
+ { |
692 |
+ struct quad8_iio *const priv = counter->priv; |
693 |
+ const size_t channel_id = signal->id - 16; |
694 |
+- const unsigned int idr_cfg = synchronous_mode | |
695 |
+- priv->index_polarity[channel_id] << 1; |
696 |
+ const int base_offset = priv->base + 2 * channel_id + 1; |
697 |
++ unsigned int idr_cfg = synchronous_mode; |
698 |
++ |
699 |
++ mutex_lock(&priv->lock); |
700 |
++ |
701 |
++ idr_cfg |= priv->index_polarity[channel_id] << 1; |
702 |
+ |
703 |
+ /* Index function must be non-synchronous in non-quadrature mode */ |
704 |
+- if (synchronous_mode && !priv->quadrature_mode[channel_id]) |
705 |
++ if (synchronous_mode && !priv->quadrature_mode[channel_id]) { |
706 |
++ mutex_unlock(&priv->lock); |
707 |
+ return -EINVAL; |
708 |
++ } |
709 |
+ |
710 |
+ priv->synchronous_mode[channel_id] = synchronous_mode; |
711 |
+ |
712 |
+ /* Load Index Control configuration to Index Control Register */ |
713 |
+ outb(QUAD8_CTR_IDR | idr_cfg, base_offset); |
714 |
+ |
715 |
++ mutex_unlock(&priv->lock); |
716 |
++ |
717 |
+ return 0; |
718 |
+ } |
719 |
+ |
720 |
+@@ -970,6 +1051,8 @@ static int quad8_count_mode_set(struct counter_device *counter, |
721 |
+ break; |
722 |
+ } |
723 |
+ |
724 |
++ mutex_lock(&priv->lock); |
725 |
++ |
726 |
+ priv->count_mode[count->id] = cnt_mode; |
727 |
+ |
728 |
+ /* Set count mode configuration value */ |
729 |
+@@ -982,6 +1065,8 @@ static int quad8_count_mode_set(struct counter_device *counter, |
730 |
+ /* Load mode configuration to Counter Mode Register */ |
731 |
+ outb(QUAD8_CTR_CMR | mode_cfg, base_offset); |
732 |
+ |
733 |
++ mutex_unlock(&priv->lock); |
734 |
++ |
735 |
+ return 0; |
736 |
+ } |
737 |
+ |
738 |
+@@ -1023,6 +1108,8 @@ static ssize_t quad8_count_enable_write(struct counter_device *counter, |
739 |
+ if (err) |
740 |
+ return err; |
741 |
+ |
742 |
++ mutex_lock(&priv->lock); |
743 |
++ |
744 |
+ priv->ab_enable[count->id] = ab_enable; |
745 |
+ |
746 |
+ ior_cfg = ab_enable | priv->preset_enable[count->id] << 1; |
747 |
+@@ -1030,6 +1117,8 @@ static ssize_t quad8_count_enable_write(struct counter_device *counter, |
748 |
+ /* Load I/O control configuration */ |
749 |
+ outb(QUAD8_CTR_IOR | ior_cfg, base_offset + 1); |
750 |
+ |
751 |
++ mutex_unlock(&priv->lock); |
752 |
++ |
753 |
+ return len; |
754 |
+ } |
755 |
+ |
756 |
+@@ -1058,14 +1147,28 @@ static ssize_t quad8_count_preset_read(struct counter_device *counter, |
757 |
+ return sprintf(buf, "%u\n", priv->preset[count->id]); |
758 |
+ } |
759 |
+ |
760 |
++static void quad8_preset_register_set(struct quad8_iio *quad8iio, int id, |
761 |
++ unsigned int preset) |
762 |
++{ |
763 |
++ const unsigned int base_offset = quad8iio->base + 2 * id; |
764 |
++ int i; |
765 |
++ |
766 |
++ quad8iio->preset[id] = preset; |
767 |
++ |
768 |
++ /* Reset Byte Pointer */ |
769 |
++ outb(QUAD8_CTR_RLD | QUAD8_RLD_RESET_BP, base_offset + 1); |
770 |
++ |
771 |
++ /* Set Preset Register */ |
772 |
++ for (i = 0; i < 3; i++) |
773 |
++ outb(preset >> (8 * i), base_offset); |
774 |
++} |
775 |
++ |
776 |
+ static ssize_t quad8_count_preset_write(struct counter_device *counter, |
777 |
+ struct counter_count *count, void *private, const char *buf, size_t len) |
778 |
+ { |
779 |
+ struct quad8_iio *const priv = counter->priv; |
780 |
+- const int base_offset = priv->base + 2 * count->id; |
781 |
+ unsigned int preset; |
782 |
+ int ret; |
783 |
+- int i; |
784 |
+ |
785 |
+ ret = kstrtouint(buf, 0, &preset); |
786 |
+ if (ret) |
787 |
+@@ -1075,14 +1178,11 @@ static ssize_t quad8_count_preset_write(struct counter_device *counter, |
788 |
+ if (preset > 0xFFFFFF) |
789 |
+ return -EINVAL; |
790 |
+ |
791 |
+- priv->preset[count->id] = preset; |
792 |
++ mutex_lock(&priv->lock); |
793 |
+ |
794 |
+- /* Reset Byte Pointer */ |
795 |
+- outb(QUAD8_CTR_RLD | QUAD8_RLD_RESET_BP, base_offset + 1); |
796 |
++ quad8_preset_register_set(priv, count->id, preset); |
797 |
+ |
798 |
+- /* Set Preset Register */ |
799 |
+- for (i = 0; i < 3; i++) |
800 |
+- outb(preset >> (8 * i), base_offset); |
801 |
++ mutex_unlock(&priv->lock); |
802 |
+ |
803 |
+ return len; |
804 |
+ } |
805 |
+@@ -1090,15 +1190,20 @@ static ssize_t quad8_count_preset_write(struct counter_device *counter, |
806 |
+ static ssize_t quad8_count_ceiling_read(struct counter_device *counter, |
807 |
+ struct counter_count *count, void *private, char *buf) |
808 |
+ { |
809 |
+- const struct quad8_iio *const priv = counter->priv; |
810 |
++ struct quad8_iio *const priv = counter->priv; |
811 |
++ |
812 |
++ mutex_lock(&priv->lock); |
813 |
+ |
814 |
+ /* Range Limit and Modulo-N count modes use preset value as ceiling */ |
815 |
+ switch (priv->count_mode[count->id]) { |
816 |
+ case 1: |
817 |
+ case 3: |
818 |
+- return quad8_count_preset_read(counter, count, private, buf); |
819 |
++ mutex_unlock(&priv->lock); |
820 |
++ return sprintf(buf, "%u\n", priv->preset[count->id]); |
821 |
+ } |
822 |
+ |
823 |
++ mutex_unlock(&priv->lock); |
824 |
++ |
825 |
+ /* By default 0x1FFFFFF (25 bits unsigned) is maximum count */ |
826 |
+ return sprintf(buf, "33554431\n"); |
827 |
+ } |
828 |
+@@ -1107,15 +1212,29 @@ static ssize_t quad8_count_ceiling_write(struct counter_device *counter, |
829 |
+ struct counter_count *count, void *private, const char *buf, size_t len) |
830 |
+ { |
831 |
+ struct quad8_iio *const priv = counter->priv; |
832 |
++ unsigned int ceiling; |
833 |
++ int ret; |
834 |
++ |
835 |
++ ret = kstrtouint(buf, 0, &ceiling); |
836 |
++ if (ret) |
837 |
++ return ret; |
838 |
++ |
839 |
++ /* Only 24-bit values are supported */ |
840 |
++ if (ceiling > 0xFFFFFF) |
841 |
++ return -EINVAL; |
842 |
++ |
843 |
++ mutex_lock(&priv->lock); |
844 |
+ |
845 |
+ /* Range Limit and Modulo-N count modes use preset value as ceiling */ |
846 |
+ switch (priv->count_mode[count->id]) { |
847 |
+ case 1: |
848 |
+ case 3: |
849 |
+- return quad8_count_preset_write(counter, count, private, buf, |
850 |
+- len); |
851 |
++ quad8_preset_register_set(priv, count->id, ceiling); |
852 |
++ break; |
853 |
+ } |
854 |
+ |
855 |
++ mutex_unlock(&priv->lock); |
856 |
++ |
857 |
+ return len; |
858 |
+ } |
859 |
+ |
860 |
+@@ -1143,6 +1262,8 @@ static ssize_t quad8_count_preset_enable_write(struct counter_device *counter, |
861 |
+ /* Preset enable is active low in Input/Output Control register */ |
862 |
+ preset_enable = !preset_enable; |
863 |
+ |
864 |
++ mutex_lock(&priv->lock); |
865 |
++ |
866 |
+ priv->preset_enable[count->id] = preset_enable; |
867 |
+ |
868 |
+ ior_cfg = priv->ab_enable[count->id] | (unsigned int)preset_enable << 1; |
869 |
+@@ -1150,6 +1271,8 @@ static ssize_t quad8_count_preset_enable_write(struct counter_device *counter, |
870 |
+ /* Load I/O control configuration to Input / Output Control Register */ |
871 |
+ outb(QUAD8_CTR_IOR | ior_cfg, base_offset); |
872 |
+ |
873 |
++ mutex_unlock(&priv->lock); |
874 |
++ |
875 |
+ return len; |
876 |
+ } |
877 |
+ |
878 |
+@@ -1320,6 +1443,9 @@ static int quad8_probe(struct device *dev, unsigned int id) |
879 |
+ quad8iio->counter.priv = quad8iio; |
880 |
+ quad8iio->base = base[id]; |
881 |
+ |
882 |
++ /* Initialize mutex */ |
883 |
++ mutex_init(&quad8iio->lock); |
884 |
++ |
885 |
+ /* Reset all counters and disable interrupt function */ |
886 |
+ outb(QUAD8_CHAN_OP_RESET_COUNTERS, base[id] + QUAD8_REG_CHAN_OP); |
887 |
+ /* Set initial configuration for all counters */ |
888 |
+diff --git a/drivers/crypto/chelsio/chcr_core.c b/drivers/crypto/chelsio/chcr_core.c |
889 |
+index 029a7354f541..5c16f368879b 100644 |
890 |
+--- a/drivers/crypto/chelsio/chcr_core.c |
891 |
++++ b/drivers/crypto/chelsio/chcr_core.c |
892 |
+@@ -125,8 +125,6 @@ static void chcr_dev_init(struct uld_ctx *u_ctx) |
893 |
+ atomic_set(&dev->inflight, 0); |
894 |
+ mutex_lock(&drv_data.drv_mutex); |
895 |
+ list_add_tail(&u_ctx->entry, &drv_data.inact_dev); |
896 |
+- if (!drv_data.last_dev) |
897 |
+- drv_data.last_dev = u_ctx; |
898 |
+ mutex_unlock(&drv_data.drv_mutex); |
899 |
+ } |
900 |
+ |
901 |
+diff --git a/drivers/hwmon/jc42.c b/drivers/hwmon/jc42.c |
902 |
+index f2d81b0558e5..e3f1ebee7130 100644 |
903 |
+--- a/drivers/hwmon/jc42.c |
904 |
++++ b/drivers/hwmon/jc42.c |
905 |
+@@ -506,7 +506,7 @@ static int jc42_probe(struct i2c_client *client, const struct i2c_device_id *id) |
906 |
+ } |
907 |
+ data->config = config; |
908 |
+ |
909 |
+- hwmon_dev = devm_hwmon_device_register_with_info(dev, client->name, |
910 |
++ hwmon_dev = devm_hwmon_device_register_with_info(dev, "jc42", |
911 |
+ data, &jc42_chip_info, |
912 |
+ NULL); |
913 |
+ return PTR_ERR_OR_ZERO(hwmon_dev); |
914 |
+diff --git a/drivers/i2c/busses/i2c-altera.c b/drivers/i2c/busses/i2c-altera.c |
915 |
+index 1de23b4f3809..92d2c706c2a7 100644 |
916 |
+--- a/drivers/i2c/busses/i2c-altera.c |
917 |
++++ b/drivers/i2c/busses/i2c-altera.c |
918 |
+@@ -384,7 +384,6 @@ static int altr_i2c_probe(struct platform_device *pdev) |
919 |
+ struct altr_i2c_dev *idev = NULL; |
920 |
+ struct resource *res; |
921 |
+ int irq, ret; |
922 |
+- u32 val; |
923 |
+ |
924 |
+ idev = devm_kzalloc(&pdev->dev, sizeof(*idev), GFP_KERNEL); |
925 |
+ if (!idev) |
926 |
+@@ -411,17 +410,17 @@ static int altr_i2c_probe(struct platform_device *pdev) |
927 |
+ init_completion(&idev->msg_complete); |
928 |
+ spin_lock_init(&idev->lock); |
929 |
+ |
930 |
+- val = device_property_read_u32(idev->dev, "fifo-size", |
931 |
++ ret = device_property_read_u32(idev->dev, "fifo-size", |
932 |
+ &idev->fifo_size); |
933 |
+- if (val) { |
934 |
++ if (ret) { |
935 |
+ dev_err(&pdev->dev, "FIFO size set to default of %d\n", |
936 |
+ ALTR_I2C_DFLT_FIFO_SZ); |
937 |
+ idev->fifo_size = ALTR_I2C_DFLT_FIFO_SZ; |
938 |
+ } |
939 |
+ |
940 |
+- val = device_property_read_u32(idev->dev, "clock-frequency", |
941 |
++ ret = device_property_read_u32(idev->dev, "clock-frequency", |
942 |
+ &idev->bus_clk_rate); |
943 |
+- if (val) { |
944 |
++ if (ret) { |
945 |
+ dev_err(&pdev->dev, "Default to 100kHz\n"); |
946 |
+ idev->bus_clk_rate = 100000; /* default clock rate */ |
947 |
+ } |
948 |
+diff --git a/drivers/iio/adc/ad7793.c b/drivers/iio/adc/ad7793.c |
949 |
+index bbc41ecf0d2f..6ed6d1410201 100644 |
950 |
+--- a/drivers/iio/adc/ad7793.c |
951 |
++++ b/drivers/iio/adc/ad7793.c |
952 |
+@@ -541,7 +541,7 @@ static const struct iio_info ad7797_info = { |
953 |
+ .read_raw = &ad7793_read_raw, |
954 |
+ .write_raw = &ad7793_write_raw, |
955 |
+ .write_raw_get_fmt = &ad7793_write_raw_get_fmt, |
956 |
+- .attrs = &ad7793_attribute_group, |
957 |
++ .attrs = &ad7797_attribute_group, |
958 |
+ .validate_trigger = ad_sd_validate_trigger, |
959 |
+ }; |
960 |
+ |
961 |
+diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c |
962 |
+index 3f6813daf3c1..31fcfc58e337 100644 |
963 |
+--- a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c |
964 |
++++ b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c |
965 |
+@@ -3748,7 +3748,7 @@ int t4_phy_fw_ver(struct adapter *adap, int *phy_fw_ver) |
966 |
+ FW_PARAMS_PARAM_Z_V(FW_PARAMS_PARAM_DEV_PHYFW_VERSION)); |
967 |
+ ret = t4_query_params(adap, adap->mbox, adap->pf, 0, 1, |
968 |
+ ¶m, &val); |
969 |
+- if (ret < 0) |
970 |
++ if (ret) |
971 |
+ return ret; |
972 |
+ *phy_fw_ver = val; |
973 |
+ return 0; |
974 |
+diff --git a/drivers/net/ethernet/freescale/fec.h b/drivers/net/ethernet/freescale/fec.h |
975 |
+index f79e57f735b3..d89568f810bc 100644 |
976 |
+--- a/drivers/net/ethernet/freescale/fec.h |
977 |
++++ b/drivers/net/ethernet/freescale/fec.h |
978 |
+@@ -488,6 +488,12 @@ struct fec_enet_priv_rx_q { |
979 |
+ struct sk_buff *rx_skbuff[RX_RING_SIZE]; |
980 |
+ }; |
981 |
+ |
982 |
++struct fec_stop_mode_gpr { |
983 |
++ struct regmap *gpr; |
984 |
++ u8 reg; |
985 |
++ u8 bit; |
986 |
++}; |
987 |
++ |
988 |
+ /* The FEC buffer descriptors track the ring buffers. The rx_bd_base and |
989 |
+ * tx_bd_base always point to the base of the buffer descriptors. The |
990 |
+ * cur_rx and cur_tx point to the currently available buffer. |
991 |
+@@ -562,6 +568,7 @@ struct fec_enet_private { |
992 |
+ int hwts_tx_en; |
993 |
+ struct delayed_work time_keep; |
994 |
+ struct regulator *reg_phy; |
995 |
++ struct fec_stop_mode_gpr stop_gpr; |
996 |
+ |
997 |
+ unsigned int tx_align; |
998 |
+ unsigned int rx_align; |
999 |
+diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c |
1000 |
+index 3fc8a66e4f41..39c112f1543c 100644 |
1001 |
+--- a/drivers/net/ethernet/freescale/fec_main.c |
1002 |
++++ b/drivers/net/ethernet/freescale/fec_main.c |
1003 |
+@@ -62,6 +62,8 @@ |
1004 |
+ #include <linux/if_vlan.h> |
1005 |
+ #include <linux/pinctrl/consumer.h> |
1006 |
+ #include <linux/prefetch.h> |
1007 |
++#include <linux/mfd/syscon.h> |
1008 |
++#include <linux/regmap.h> |
1009 |
+ #include <soc/imx/cpuidle.h> |
1010 |
+ |
1011 |
+ #include <asm/cacheflush.h> |
1012 |
+@@ -84,6 +86,56 @@ static void fec_enet_itr_coal_init(struct net_device *ndev); |
1013 |
+ #define FEC_ENET_OPD_V 0xFFF0 |
1014 |
+ #define FEC_MDIO_PM_TIMEOUT 100 /* ms */ |
1015 |
+ |
1016 |
++struct fec_devinfo { |
1017 |
++ u32 quirks; |
1018 |
++ u8 stop_gpr_reg; |
1019 |
++ u8 stop_gpr_bit; |
1020 |
++}; |
1021 |
++ |
1022 |
++static const struct fec_devinfo fec_imx25_info = { |
1023 |
++ .quirks = FEC_QUIRK_USE_GASKET | FEC_QUIRK_MIB_CLEAR | |
1024 |
++ FEC_QUIRK_HAS_FRREG, |
1025 |
++}; |
1026 |
++ |
1027 |
++static const struct fec_devinfo fec_imx27_info = { |
1028 |
++ .quirks = FEC_QUIRK_MIB_CLEAR | FEC_QUIRK_HAS_FRREG, |
1029 |
++}; |
1030 |
++ |
1031 |
++static const struct fec_devinfo fec_imx28_info = { |
1032 |
++ .quirks = FEC_QUIRK_ENET_MAC | FEC_QUIRK_SWAP_FRAME | |
1033 |
++ FEC_QUIRK_SINGLE_MDIO | FEC_QUIRK_HAS_RACC | |
1034 |
++ FEC_QUIRK_HAS_FRREG, |
1035 |
++}; |
1036 |
++ |
1037 |
++static const struct fec_devinfo fec_imx6q_info = { |
1038 |
++ .quirks = FEC_QUIRK_ENET_MAC | FEC_QUIRK_HAS_GBIT | |
1039 |
++ FEC_QUIRK_HAS_BUFDESC_EX | FEC_QUIRK_HAS_CSUM | |
1040 |
++ FEC_QUIRK_HAS_VLAN | FEC_QUIRK_ERR006358 | |
1041 |
++ FEC_QUIRK_HAS_RACC, |
1042 |
++ .stop_gpr_reg = 0x34, |
1043 |
++ .stop_gpr_bit = 27, |
1044 |
++}; |
1045 |
++ |
1046 |
++static const struct fec_devinfo fec_mvf600_info = { |
1047 |
++ .quirks = FEC_QUIRK_ENET_MAC | FEC_QUIRK_HAS_RACC, |
1048 |
++}; |
1049 |
++ |
1050 |
++static const struct fec_devinfo fec_imx6x_info = { |
1051 |
++ .quirks = FEC_QUIRK_ENET_MAC | FEC_QUIRK_HAS_GBIT | |
1052 |
++ FEC_QUIRK_HAS_BUFDESC_EX | FEC_QUIRK_HAS_CSUM | |
1053 |
++ FEC_QUIRK_HAS_VLAN | FEC_QUIRK_HAS_AVB | |
1054 |
++ FEC_QUIRK_ERR007885 | FEC_QUIRK_BUG_CAPTURE | |
1055 |
++ FEC_QUIRK_HAS_RACC | FEC_QUIRK_HAS_COALESCE, |
1056 |
++}; |
1057 |
++ |
1058 |
++static const struct fec_devinfo fec_imx6ul_info = { |
1059 |
++ .quirks = FEC_QUIRK_ENET_MAC | FEC_QUIRK_HAS_GBIT | |
1060 |
++ FEC_QUIRK_HAS_BUFDESC_EX | FEC_QUIRK_HAS_CSUM | |
1061 |
++ FEC_QUIRK_HAS_VLAN | FEC_QUIRK_ERR007885 | |
1062 |
++ FEC_QUIRK_BUG_CAPTURE | FEC_QUIRK_HAS_RACC | |
1063 |
++ FEC_QUIRK_HAS_COALESCE, |
1064 |
++}; |
1065 |
++ |
1066 |
+ static struct platform_device_id fec_devtype[] = { |
1067 |
+ { |
1068 |
+ /* keep it for coldfire */ |
1069 |
+@@ -91,39 +143,25 @@ static struct platform_device_id fec_devtype[] = { |
1070 |
+ .driver_data = 0, |
1071 |
+ }, { |
1072 |
+ .name = "imx25-fec", |
1073 |
+- .driver_data = FEC_QUIRK_USE_GASKET | FEC_QUIRK_MIB_CLEAR | |
1074 |
+- FEC_QUIRK_HAS_FRREG, |
1075 |
++ .driver_data = (kernel_ulong_t)&fec_imx25_info, |
1076 |
+ }, { |
1077 |
+ .name = "imx27-fec", |
1078 |
+- .driver_data = FEC_QUIRK_MIB_CLEAR | FEC_QUIRK_HAS_FRREG, |
1079 |
++ .driver_data = (kernel_ulong_t)&fec_imx27_info, |
1080 |
+ }, { |
1081 |
+ .name = "imx28-fec", |
1082 |
+- .driver_data = FEC_QUIRK_ENET_MAC | FEC_QUIRK_SWAP_FRAME | |
1083 |
+- FEC_QUIRK_SINGLE_MDIO | FEC_QUIRK_HAS_RACC | |
1084 |
+- FEC_QUIRK_HAS_FRREG, |
1085 |
++ .driver_data = (kernel_ulong_t)&fec_imx28_info, |
1086 |
+ }, { |
1087 |
+ .name = "imx6q-fec", |
1088 |
+- .driver_data = FEC_QUIRK_ENET_MAC | FEC_QUIRK_HAS_GBIT | |
1089 |
+- FEC_QUIRK_HAS_BUFDESC_EX | FEC_QUIRK_HAS_CSUM | |
1090 |
+- FEC_QUIRK_HAS_VLAN | FEC_QUIRK_ERR006358 | |
1091 |
+- FEC_QUIRK_HAS_RACC, |
1092 |
++ .driver_data = (kernel_ulong_t)&fec_imx6q_info, |
1093 |
+ }, { |
1094 |
+ .name = "mvf600-fec", |
1095 |
+- .driver_data = FEC_QUIRK_ENET_MAC | FEC_QUIRK_HAS_RACC, |
1096 |
++ .driver_data = (kernel_ulong_t)&fec_mvf600_info, |
1097 |
+ }, { |
1098 |
+ .name = "imx6sx-fec", |
1099 |
+- .driver_data = FEC_QUIRK_ENET_MAC | FEC_QUIRK_HAS_GBIT | |
1100 |
+- FEC_QUIRK_HAS_BUFDESC_EX | FEC_QUIRK_HAS_CSUM | |
1101 |
+- FEC_QUIRK_HAS_VLAN | FEC_QUIRK_HAS_AVB | |
1102 |
+- FEC_QUIRK_ERR007885 | FEC_QUIRK_BUG_CAPTURE | |
1103 |
+- FEC_QUIRK_HAS_RACC | FEC_QUIRK_HAS_COALESCE, |
1104 |
++ .driver_data = (kernel_ulong_t)&fec_imx6x_info, |
1105 |
+ }, { |
1106 |
+ .name = "imx6ul-fec", |
1107 |
+- .driver_data = FEC_QUIRK_ENET_MAC | FEC_QUIRK_HAS_GBIT | |
1108 |
+- FEC_QUIRK_HAS_BUFDESC_EX | FEC_QUIRK_HAS_CSUM | |
1109 |
+- FEC_QUIRK_HAS_VLAN | FEC_QUIRK_ERR007885 | |
1110 |
+- FEC_QUIRK_BUG_CAPTURE | FEC_QUIRK_HAS_RACC | |
1111 |
+- FEC_QUIRK_HAS_COALESCE, |
1112 |
++ .driver_data = (kernel_ulong_t)&fec_imx6ul_info, |
1113 |
+ }, { |
1114 |
+ /* sentinel */ |
1115 |
+ } |
1116 |
+@@ -1092,11 +1130,28 @@ fec_restart(struct net_device *ndev) |
1117 |
+ |
1118 |
+ } |
1119 |
+ |
1120 |
++static void fec_enet_stop_mode(struct fec_enet_private *fep, bool enabled) |
1121 |
++{ |
1122 |
++ struct fec_platform_data *pdata = fep->pdev->dev.platform_data; |
1123 |
++ struct fec_stop_mode_gpr *stop_gpr = &fep->stop_gpr; |
1124 |
++ |
1125 |
++ if (stop_gpr->gpr) { |
1126 |
++ if (enabled) |
1127 |
++ regmap_update_bits(stop_gpr->gpr, stop_gpr->reg, |
1128 |
++ BIT(stop_gpr->bit), |
1129 |
++ BIT(stop_gpr->bit)); |
1130 |
++ else |
1131 |
++ regmap_update_bits(stop_gpr->gpr, stop_gpr->reg, |
1132 |
++ BIT(stop_gpr->bit), 0); |
1133 |
++ } else if (pdata && pdata->sleep_mode_enable) { |
1134 |
++ pdata->sleep_mode_enable(enabled); |
1135 |
++ } |
1136 |
++} |
1137 |
++ |
1138 |
+ static void |
1139 |
+ fec_stop(struct net_device *ndev) |
1140 |
+ { |
1141 |
+ struct fec_enet_private *fep = netdev_priv(ndev); |
1142 |
+- struct fec_platform_data *pdata = fep->pdev->dev.platform_data; |
1143 |
+ u32 rmii_mode = readl(fep->hwp + FEC_R_CNTRL) & (1 << 8); |
1144 |
+ u32 val; |
1145 |
+ |
1146 |
+@@ -1125,9 +1180,7 @@ fec_stop(struct net_device *ndev) |
1147 |
+ val = readl(fep->hwp + FEC_ECNTRL); |
1148 |
+ val |= (FEC_ECR_MAGICEN | FEC_ECR_SLEEP); |
1149 |
+ writel(val, fep->hwp + FEC_ECNTRL); |
1150 |
+- |
1151 |
+- if (pdata && pdata->sleep_mode_enable) |
1152 |
+- pdata->sleep_mode_enable(true); |
1153 |
++ fec_enet_stop_mode(fep, true); |
1154 |
+ } |
1155 |
+ writel(fep->phy_speed, fep->hwp + FEC_MII_SPEED); |
1156 |
+ |
1157 |
+@@ -3398,6 +3451,37 @@ static int fec_enet_get_irq_cnt(struct platform_device *pdev) |
1158 |
+ return irq_cnt; |
1159 |
+ } |
1160 |
+ |
1161 |
++static int fec_enet_init_stop_mode(struct fec_enet_private *fep, |
1162 |
++ struct fec_devinfo *dev_info, |
1163 |
++ struct device_node *np) |
1164 |
++{ |
1165 |
++ struct device_node *gpr_np; |
1166 |
++ int ret = 0; |
1167 |
++ |
1168 |
++ if (!dev_info) |
1169 |
++ return 0; |
1170 |
++ |
1171 |
++ gpr_np = of_parse_phandle(np, "gpr", 0); |
1172 |
++ if (!gpr_np) |
1173 |
++ return 0; |
1174 |
++ |
1175 |
++ fep->stop_gpr.gpr = syscon_node_to_regmap(gpr_np); |
1176 |
++ if (IS_ERR(fep->stop_gpr.gpr)) { |
1177 |
++ dev_err(&fep->pdev->dev, "could not find gpr regmap\n"); |
1178 |
++ ret = PTR_ERR(fep->stop_gpr.gpr); |
1179 |
++ fep->stop_gpr.gpr = NULL; |
1180 |
++ goto out; |
1181 |
++ } |
1182 |
++ |
1183 |
++ fep->stop_gpr.reg = dev_info->stop_gpr_reg; |
1184 |
++ fep->stop_gpr.bit = dev_info->stop_gpr_bit; |
1185 |
++ |
1186 |
++out: |
1187 |
++ of_node_put(gpr_np); |
1188 |
++ |
1189 |
++ return ret; |
1190 |
++} |
1191 |
++ |
1192 |
+ static int |
1193 |
+ fec_probe(struct platform_device *pdev) |
1194 |
+ { |
1195 |
+@@ -3412,6 +3496,7 @@ fec_probe(struct platform_device *pdev) |
1196 |
+ int num_rx_qs; |
1197 |
+ char irq_name[8]; |
1198 |
+ int irq_cnt; |
1199 |
++ struct fec_devinfo *dev_info; |
1200 |
+ |
1201 |
+ fec_enet_get_queue_num(pdev, &num_tx_qs, &num_rx_qs); |
1202 |
+ |
1203 |
+@@ -3429,7 +3514,9 @@ fec_probe(struct platform_device *pdev) |
1204 |
+ of_id = of_match_device(fec_dt_ids, &pdev->dev); |
1205 |
+ if (of_id) |
1206 |
+ pdev->id_entry = of_id->data; |
1207 |
+- fep->quirks = pdev->id_entry->driver_data; |
1208 |
++ dev_info = (struct fec_devinfo *)pdev->id_entry->driver_data; |
1209 |
++ if (dev_info) |
1210 |
++ fep->quirks = dev_info->quirks; |
1211 |
+ |
1212 |
+ fep->netdev = ndev; |
1213 |
+ fep->num_rx_queues = num_rx_qs; |
1214 |
+@@ -3463,6 +3550,10 @@ fec_probe(struct platform_device *pdev) |
1215 |
+ if (of_get_property(np, "fsl,magic-packet", NULL)) |
1216 |
+ fep->wol_flag |= FEC_WOL_HAS_MAGIC_PACKET; |
1217 |
+ |
1218 |
++ ret = fec_enet_init_stop_mode(fep, dev_info, np); |
1219 |
++ if (ret) |
1220 |
++ goto failed_stop_mode; |
1221 |
++ |
1222 |
+ phy_node = of_parse_phandle(np, "phy-handle", 0); |
1223 |
+ if (!phy_node && of_phy_is_fixed_link(np)) { |
1224 |
+ ret = of_phy_register_fixed_link(np); |
1225 |
+@@ -3631,6 +3722,7 @@ failed_clk: |
1226 |
+ if (of_phy_is_fixed_link(np)) |
1227 |
+ of_phy_deregister_fixed_link(np); |
1228 |
+ of_node_put(phy_node); |
1229 |
++failed_stop_mode: |
1230 |
+ failed_phy: |
1231 |
+ dev_id--; |
1232 |
+ failed_ioremap: |
1233 |
+@@ -3708,7 +3800,6 @@ static int __maybe_unused fec_resume(struct device *dev) |
1234 |
+ { |
1235 |
+ struct net_device *ndev = dev_get_drvdata(dev); |
1236 |
+ struct fec_enet_private *fep = netdev_priv(ndev); |
1237 |
+- struct fec_platform_data *pdata = fep->pdev->dev.platform_data; |
1238 |
+ int ret; |
1239 |
+ int val; |
1240 |
+ |
1241 |
+@@ -3726,8 +3817,8 @@ static int __maybe_unused fec_resume(struct device *dev) |
1242 |
+ goto failed_clk; |
1243 |
+ } |
1244 |
+ if (fep->wol_flag & FEC_WOL_FLAG_ENABLE) { |
1245 |
+- if (pdata && pdata->sleep_mode_enable) |
1246 |
+- pdata->sleep_mode_enable(false); |
1247 |
++ fec_enet_stop_mode(fep, false); |
1248 |
++ |
1249 |
+ val = readl(fep->hwp + FEC_ECNTRL); |
1250 |
+ val &= ~(FEC_ECR_MAGICEN | FEC_ECR_SLEEP); |
1251 |
+ writel(val, fep->hwp + FEC_ECNTRL); |
1252 |
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/diag/fw_tracer.c b/drivers/net/ethernet/mellanox/mlx5/core/diag/fw_tracer.c |
1253 |
+index 94d7b69a95c7..eb2e57ff08a6 100644 |
1254 |
+--- a/drivers/net/ethernet/mellanox/mlx5/core/diag/fw_tracer.c |
1255 |
++++ b/drivers/net/ethernet/mellanox/mlx5/core/diag/fw_tracer.c |
1256 |
+@@ -935,7 +935,7 @@ struct mlx5_fw_tracer *mlx5_fw_tracer_create(struct mlx5_core_dev *dev) |
1257 |
+ return NULL; |
1258 |
+ } |
1259 |
+ |
1260 |
+- tracer = kzalloc(sizeof(*tracer), GFP_KERNEL); |
1261 |
++ tracer = kvzalloc(sizeof(*tracer), GFP_KERNEL); |
1262 |
+ if (!tracer) |
1263 |
+ return ERR_PTR(-ENOMEM); |
1264 |
+ |
1265 |
+@@ -982,7 +982,7 @@ destroy_workqueue: |
1266 |
+ tracer->dev = NULL; |
1267 |
+ destroy_workqueue(tracer->work_queue); |
1268 |
+ free_tracer: |
1269 |
+- kfree(tracer); |
1270 |
++ kvfree(tracer); |
1271 |
+ return ERR_PTR(err); |
1272 |
+ } |
1273 |
+ |
1274 |
+@@ -1061,7 +1061,7 @@ void mlx5_fw_tracer_destroy(struct mlx5_fw_tracer *tracer) |
1275 |
+ mlx5_fw_tracer_destroy_log_buf(tracer); |
1276 |
+ flush_workqueue(tracer->work_queue); |
1277 |
+ destroy_workqueue(tracer->work_queue); |
1278 |
+- kfree(tracer); |
1279 |
++ kvfree(tracer); |
1280 |
+ } |
1281 |
+ |
1282 |
+ static int fw_tracer_event(struct notifier_block *nb, unsigned long action, void *data) |
1283 |
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en.h b/drivers/net/ethernet/mellanox/mlx5/core/en.h |
1284 |
+index 11426f94c90c..38aa55638bbe 100644 |
1285 |
+--- a/drivers/net/ethernet/mellanox/mlx5/core/en.h |
1286 |
++++ b/drivers/net/ethernet/mellanox/mlx5/core/en.h |
1287 |
+@@ -367,6 +367,7 @@ enum { |
1288 |
+ MLX5E_SQ_STATE_AM, |
1289 |
+ MLX5E_SQ_STATE_TLS, |
1290 |
+ MLX5E_SQ_STATE_VLAN_NEED_L2_INLINE, |
1291 |
++ MLX5E_SQ_STATE_PENDING_XSK_TX, |
1292 |
+ }; |
1293 |
+ |
1294 |
+ struct mlx5e_sq_wqe_info { |
1295 |
+@@ -948,7 +949,7 @@ void mlx5e_page_release_dynamic(struct mlx5e_rq *rq, |
1296 |
+ void mlx5e_handle_rx_cqe(struct mlx5e_rq *rq, struct mlx5_cqe64 *cqe); |
1297 |
+ void mlx5e_handle_rx_cqe_mpwrq(struct mlx5e_rq *rq, struct mlx5_cqe64 *cqe); |
1298 |
+ bool mlx5e_post_rx_wqes(struct mlx5e_rq *rq); |
1299 |
+-void mlx5e_poll_ico_cq(struct mlx5e_cq *cq); |
1300 |
++int mlx5e_poll_ico_cq(struct mlx5e_cq *cq); |
1301 |
+ bool mlx5e_post_rx_mpwqes(struct mlx5e_rq *rq); |
1302 |
+ void mlx5e_dealloc_rx_wqe(struct mlx5e_rq *rq, u16 ix); |
1303 |
+ void mlx5e_dealloc_rx_mpwqe(struct mlx5e_rq *rq, u16 ix); |
1304 |
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/xsk/tx.c b/drivers/net/ethernet/mellanox/mlx5/core/en/xsk/tx.c |
1305 |
+index fe2d596cb361..3bcdb5b2fc20 100644 |
1306 |
+--- a/drivers/net/ethernet/mellanox/mlx5/core/en/xsk/tx.c |
1307 |
++++ b/drivers/net/ethernet/mellanox/mlx5/core/en/xsk/tx.c |
1308 |
+@@ -33,6 +33,9 @@ int mlx5e_xsk_wakeup(struct net_device *dev, u32 qid, u32 flags) |
1309 |
+ if (unlikely(!test_bit(MLX5E_SQ_STATE_ENABLED, &c->xskicosq.state))) |
1310 |
+ return 0; |
1311 |
+ |
1312 |
++ if (test_and_set_bit(MLX5E_SQ_STATE_PENDING_XSK_TX, &c->xskicosq.state)) |
1313 |
++ return 0; |
1314 |
++ |
1315 |
+ spin_lock(&c->xskicosq_lock); |
1316 |
+ mlx5e_trigger_irq(&c->xskicosq); |
1317 |
+ spin_unlock(&c->xskicosq_lock); |
1318 |
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c |
1319 |
+index 88ea279c29bb..0e340893ca00 100644 |
1320 |
+--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c |
1321 |
++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c |
1322 |
+@@ -3579,7 +3579,12 @@ mlx5e_get_stats(struct net_device *dev, struct rtnl_link_stats64 *stats) |
1323 |
+ struct mlx5e_vport_stats *vstats = &priv->stats.vport; |
1324 |
+ struct mlx5e_pport_stats *pstats = &priv->stats.pport; |
1325 |
+ |
1326 |
+- if (!mlx5e_monitor_counter_supported(priv)) { |
1327 |
++ /* In switchdev mode, monitor counters doesn't monitor |
1328 |
++ * rx/tx stats of 802_3. The update stats mechanism |
1329 |
++ * should keep the 802_3 layout counters updated |
1330 |
++ */ |
1331 |
++ if (!mlx5e_monitor_counter_supported(priv) || |
1332 |
++ mlx5e_is_uplink_rep(priv)) { |
1333 |
+ /* update HW stats in background for next time */ |
1334 |
+ mlx5e_queue_update_stats(priv); |
1335 |
+ } |
1336 |
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c |
1337 |
+index 1d295a7afc8c..c4eed5bbcd45 100644 |
1338 |
+--- a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c |
1339 |
++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c |
1340 |
+@@ -587,7 +587,7 @@ bool mlx5e_post_rx_wqes(struct mlx5e_rq *rq) |
1341 |
+ return !!err; |
1342 |
+ } |
1343 |
+ |
1344 |
+-void mlx5e_poll_ico_cq(struct mlx5e_cq *cq) |
1345 |
++int mlx5e_poll_ico_cq(struct mlx5e_cq *cq) |
1346 |
+ { |
1347 |
+ struct mlx5e_icosq *sq = container_of(cq, struct mlx5e_icosq, cq); |
1348 |
+ struct mlx5_cqe64 *cqe; |
1349 |
+@@ -595,11 +595,11 @@ void mlx5e_poll_ico_cq(struct mlx5e_cq *cq) |
1350 |
+ int i; |
1351 |
+ |
1352 |
+ if (unlikely(!test_bit(MLX5E_SQ_STATE_ENABLED, &sq->state))) |
1353 |
+- return; |
1354 |
++ return 0; |
1355 |
+ |
1356 |
+ cqe = mlx5_cqwq_get_cqe(&cq->wq); |
1357 |
+ if (likely(!cqe)) |
1358 |
+- return; |
1359 |
++ return 0; |
1360 |
+ |
1361 |
+ /* sq->cc must be updated only after mlx5_cqwq_update_db_record(), |
1362 |
+ * otherwise a cq overrun may occur |
1363 |
+@@ -646,6 +646,8 @@ void mlx5e_poll_ico_cq(struct mlx5e_cq *cq) |
1364 |
+ sq->cc = sqcc; |
1365 |
+ |
1366 |
+ mlx5_cqwq_update_db_record(&cq->wq); |
1367 |
++ |
1368 |
++ return i; |
1369 |
+ } |
1370 |
+ |
1371 |
+ bool mlx5e_post_rx_mpwqes(struct mlx5e_rq *rq) |
1372 |
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c |
1373 |
+index 800d34ed8a96..76efa9579215 100644 |
1374 |
+--- a/drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c |
1375 |
++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c |
1376 |
+@@ -145,7 +145,11 @@ int mlx5e_napi_poll(struct napi_struct *napi, int budget) |
1377 |
+ |
1378 |
+ busy |= rq->post_wqes(rq); |
1379 |
+ if (xsk_open) { |
1380 |
+- mlx5e_poll_ico_cq(&c->xskicosq.cq); |
1381 |
++ if (mlx5e_poll_ico_cq(&c->xskicosq.cq)) |
1382 |
++ /* Don't clear the flag if nothing was polled to prevent |
1383 |
++ * queueing more WQEs and overflowing XSKICOSQ. |
1384 |
++ */ |
1385 |
++ clear_bit(MLX5E_SQ_STATE_PENDING_XSK_TX, &c->xskicosq.state); |
1386 |
+ busy |= mlx5e_poll_xdpsq_cq(&xsksq->cq); |
1387 |
+ busy_xsk |= mlx5e_napi_xsk_post(xsksq, xskrq); |
1388 |
+ } |
1389 |
+diff --git a/drivers/net/ethernet/qlogic/qed/qed_dev.c b/drivers/net/ethernet/qlogic/qed/qed_dev.c |
1390 |
+index a1ebc2b1ca0b..0bf91df80d47 100644 |
1391 |
+--- a/drivers/net/ethernet/qlogic/qed/qed_dev.c |
1392 |
++++ b/drivers/net/ethernet/qlogic/qed/qed_dev.c |
1393 |
+@@ -4648,26 +4648,20 @@ static void qed_chain_free_single(struct qed_dev *cdev, |
1394 |
+ |
1395 |
+ static void qed_chain_free_pbl(struct qed_dev *cdev, struct qed_chain *p_chain) |
1396 |
+ { |
1397 |
+- void **pp_virt_addr_tbl = p_chain->pbl.pp_virt_addr_tbl; |
1398 |
++ struct addr_tbl_entry *pp_addr_tbl = p_chain->pbl.pp_addr_tbl; |
1399 |
+ u32 page_cnt = p_chain->page_cnt, i, pbl_size; |
1400 |
+- u8 *p_pbl_virt = p_chain->pbl_sp.p_virt_table; |
1401 |
+ |
1402 |
+- if (!pp_virt_addr_tbl) |
1403 |
++ if (!pp_addr_tbl) |
1404 |
+ return; |
1405 |
+ |
1406 |
+- if (!p_pbl_virt) |
1407 |
+- goto out; |
1408 |
+- |
1409 |
+ for (i = 0; i < page_cnt; i++) { |
1410 |
+- if (!pp_virt_addr_tbl[i]) |
1411 |
++ if (!pp_addr_tbl[i].virt_addr || !pp_addr_tbl[i].dma_map) |
1412 |
+ break; |
1413 |
+ |
1414 |
+ dma_free_coherent(&cdev->pdev->dev, |
1415 |
+ QED_CHAIN_PAGE_SIZE, |
1416 |
+- pp_virt_addr_tbl[i], |
1417 |
+- *(dma_addr_t *)p_pbl_virt); |
1418 |
+- |
1419 |
+- p_pbl_virt += QED_CHAIN_PBL_ENTRY_SIZE; |
1420 |
++ pp_addr_tbl[i].virt_addr, |
1421 |
++ pp_addr_tbl[i].dma_map); |
1422 |
+ } |
1423 |
+ |
1424 |
+ pbl_size = page_cnt * QED_CHAIN_PBL_ENTRY_SIZE; |
1425 |
+@@ -4677,9 +4671,9 @@ static void qed_chain_free_pbl(struct qed_dev *cdev, struct qed_chain *p_chain) |
1426 |
+ pbl_size, |
1427 |
+ p_chain->pbl_sp.p_virt_table, |
1428 |
+ p_chain->pbl_sp.p_phys_table); |
1429 |
+-out: |
1430 |
+- vfree(p_chain->pbl.pp_virt_addr_tbl); |
1431 |
+- p_chain->pbl.pp_virt_addr_tbl = NULL; |
1432 |
++ |
1433 |
++ vfree(p_chain->pbl.pp_addr_tbl); |
1434 |
++ p_chain->pbl.pp_addr_tbl = NULL; |
1435 |
+ } |
1436 |
+ |
1437 |
+ void qed_chain_free(struct qed_dev *cdev, struct qed_chain *p_chain) |
1438 |
+@@ -4780,19 +4774,19 @@ qed_chain_alloc_pbl(struct qed_dev *cdev, |
1439 |
+ { |
1440 |
+ u32 page_cnt = p_chain->page_cnt, size, i; |
1441 |
+ dma_addr_t p_phys = 0, p_pbl_phys = 0; |
1442 |
+- void **pp_virt_addr_tbl = NULL; |
1443 |
++ struct addr_tbl_entry *pp_addr_tbl; |
1444 |
+ u8 *p_pbl_virt = NULL; |
1445 |
+ void *p_virt = NULL; |
1446 |
+ |
1447 |
+- size = page_cnt * sizeof(*pp_virt_addr_tbl); |
1448 |
+- pp_virt_addr_tbl = vzalloc(size); |
1449 |
+- if (!pp_virt_addr_tbl) |
1450 |
++ size = page_cnt * sizeof(*pp_addr_tbl); |
1451 |
++ pp_addr_tbl = vzalloc(size); |
1452 |
++ if (!pp_addr_tbl) |
1453 |
+ return -ENOMEM; |
1454 |
+ |
1455 |
+ /* The allocation of the PBL table is done with its full size, since it |
1456 |
+ * is expected to be successive. |
1457 |
+ * qed_chain_init_pbl_mem() is called even in a case of an allocation |
1458 |
+- * failure, since pp_virt_addr_tbl was previously allocated, and it |
1459 |
++ * failure, since tbl was previously allocated, and it |
1460 |
+ * should be saved to allow its freeing during the error flow. |
1461 |
+ */ |
1462 |
+ size = page_cnt * QED_CHAIN_PBL_ENTRY_SIZE; |
1463 |
+@@ -4806,8 +4800,7 @@ qed_chain_alloc_pbl(struct qed_dev *cdev, |
1464 |
+ p_chain->b_external_pbl = true; |
1465 |
+ } |
1466 |
+ |
1467 |
+- qed_chain_init_pbl_mem(p_chain, p_pbl_virt, p_pbl_phys, |
1468 |
+- pp_virt_addr_tbl); |
1469 |
++ qed_chain_init_pbl_mem(p_chain, p_pbl_virt, p_pbl_phys, pp_addr_tbl); |
1470 |
+ if (!p_pbl_virt) |
1471 |
+ return -ENOMEM; |
1472 |
+ |
1473 |
+@@ -4826,7 +4819,8 @@ qed_chain_alloc_pbl(struct qed_dev *cdev, |
1474 |
+ /* Fill the PBL table with the physical address of the page */ |
1475 |
+ *(dma_addr_t *)p_pbl_virt = p_phys; |
1476 |
+ /* Keep the virtual address of the page */ |
1477 |
+- p_chain->pbl.pp_virt_addr_tbl[i] = p_virt; |
1478 |
++ p_chain->pbl.pp_addr_tbl[i].virt_addr = p_virt; |
1479 |
++ p_chain->pbl.pp_addr_tbl[i].dma_map = p_phys; |
1480 |
+ |
1481 |
+ p_pbl_virt += QED_CHAIN_PBL_ENTRY_SIZE; |
1482 |
+ } |
1483 |
+diff --git a/drivers/net/ethernet/qlogic/qed/qed_main.c b/drivers/net/ethernet/qlogic/qed/qed_main.c |
1484 |
+index 38f7f40b3a4d..e72f9f1d2e94 100644 |
1485 |
+--- a/drivers/net/ethernet/qlogic/qed/qed_main.c |
1486 |
++++ b/drivers/net/ethernet/qlogic/qed/qed_main.c |
1487 |
+@@ -1087,9 +1087,6 @@ static void qed_update_pf_params(struct qed_dev *cdev, |
1488 |
+ #define QED_PERIODIC_DB_REC_INTERVAL_MS 100 |
1489 |
+ #define QED_PERIODIC_DB_REC_INTERVAL \ |
1490 |
+ msecs_to_jiffies(QED_PERIODIC_DB_REC_INTERVAL_MS) |
1491 |
+-#define QED_PERIODIC_DB_REC_WAIT_COUNT 10 |
1492 |
+-#define QED_PERIODIC_DB_REC_WAIT_INTERVAL \ |
1493 |
+- (QED_PERIODIC_DB_REC_INTERVAL_MS / QED_PERIODIC_DB_REC_WAIT_COUNT) |
1494 |
+ |
1495 |
+ static int qed_slowpath_delayed_work(struct qed_hwfn *hwfn, |
1496 |
+ enum qed_slowpath_wq_flag wq_flag, |
1497 |
+@@ -1123,7 +1120,7 @@ void qed_periodic_db_rec_start(struct qed_hwfn *p_hwfn) |
1498 |
+ |
1499 |
+ static void qed_slowpath_wq_stop(struct qed_dev *cdev) |
1500 |
+ { |
1501 |
+- int i, sleep_count = QED_PERIODIC_DB_REC_WAIT_COUNT; |
1502 |
++ int i; |
1503 |
+ |
1504 |
+ if (IS_VF(cdev)) |
1505 |
+ return; |
1506 |
+@@ -1135,13 +1132,7 @@ static void qed_slowpath_wq_stop(struct qed_dev *cdev) |
1507 |
+ /* Stop queuing new delayed works */ |
1508 |
+ cdev->hwfns[i].slowpath_wq_active = false; |
1509 |
+ |
1510 |
+- /* Wait until the last periodic doorbell recovery is executed */ |
1511 |
+- while (test_bit(QED_SLOWPATH_PERIODIC_DB_REC, |
1512 |
+- &cdev->hwfns[i].slowpath_task_flags) && |
1513 |
+- sleep_count--) |
1514 |
+- msleep(QED_PERIODIC_DB_REC_WAIT_INTERVAL); |
1515 |
+- |
1516 |
+- flush_workqueue(cdev->hwfns[i].slowpath_wq); |
1517 |
++ cancel_delayed_work(&cdev->hwfns[i].slowpath_task); |
1518 |
+ destroy_workqueue(cdev->hwfns[i].slowpath_wq); |
1519 |
+ } |
1520 |
+ } |
1521 |
+diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c |
1522 |
+index e0212d2fc2a1..fa32cd5b418e 100644 |
1523 |
+--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c |
1524 |
++++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c |
1525 |
+@@ -241,6 +241,8 @@ static int socfpga_set_phy_mode_common(int phymode, u32 *val) |
1526 |
+ switch (phymode) { |
1527 |
+ case PHY_INTERFACE_MODE_RGMII: |
1528 |
+ case PHY_INTERFACE_MODE_RGMII_ID: |
1529 |
++ case PHY_INTERFACE_MODE_RGMII_RXID: |
1530 |
++ case PHY_INTERFACE_MODE_RGMII_TXID: |
1531 |
+ *val = SYSMGR_EMACGRP_CTRL_PHYSEL_ENUM_RGMII; |
1532 |
+ break; |
1533 |
+ case PHY_INTERFACE_MODE_MII: |
1534 |
+diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c |
1535 |
+index a51b3e3f248b..798e52051ecc 100644 |
1536 |
+--- a/drivers/pci/quirks.c |
1537 |
++++ b/drivers/pci/quirks.c |
1538 |
+@@ -4352,6 +4352,47 @@ static void quirk_chelsio_T5_disable_root_port_attributes(struct pci_dev *pdev) |
1539 |
+ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_CHELSIO, PCI_ANY_ID, |
1540 |
+ quirk_chelsio_T5_disable_root_port_attributes); |
1541 |
+ |
1542 |
++/* |
1543 |
++ * pci_acs_ctrl_enabled - compare desired ACS controls with those provided |
1544 |
++ * by a device |
1545 |
++ * @acs_ctrl_req: Bitmask of desired ACS controls |
1546 |
++ * @acs_ctrl_ena: Bitmask of ACS controls enabled or provided implicitly by |
1547 |
++ * the hardware design |
1548 |
++ * |
1549 |
++ * Return 1 if all ACS controls in the @acs_ctrl_req bitmask are included |
1550 |
++ * in @acs_ctrl_ena, i.e., the device provides all the access controls the |
1551 |
++ * caller desires. Return 0 otherwise. |
1552 |
++ */ |
1553 |
++static int pci_acs_ctrl_enabled(u16 acs_ctrl_req, u16 acs_ctrl_ena) |
1554 |
++{ |
1555 |
++ if ((acs_ctrl_req & acs_ctrl_ena) == acs_ctrl_req) |
1556 |
++ return 1; |
1557 |
++ return 0; |
1558 |
++} |
1559 |
++ |
1560 |
++/* |
1561 |
++ * Many Zhaoxin Root Ports and Switch Downstream Ports have no ACS capability. |
1562 |
++ * But the implementation could block peer-to-peer transactions between them |
1563 |
++ * and provide ACS-like functionality. |
1564 |
++ */ |
1565 |
++static int pci_quirk_zhaoxin_pcie_ports_acs(struct pci_dev *dev, u16 acs_flags) |
1566 |
++{ |
1567 |
++ if (!pci_is_pcie(dev) || |
1568 |
++ ((pci_pcie_type(dev) != PCI_EXP_TYPE_ROOT_PORT) && |
1569 |
++ (pci_pcie_type(dev) != PCI_EXP_TYPE_DOWNSTREAM))) |
1570 |
++ return -ENOTTY; |
1571 |
++ |
1572 |
++ switch (dev->device) { |
1573 |
++ case 0x0710 ... 0x071e: |
1574 |
++ case 0x0721: |
1575 |
++ case 0x0723 ... 0x0732: |
1576 |
++ return pci_acs_ctrl_enabled(acs_flags, |
1577 |
++ PCI_ACS_SV | PCI_ACS_RR | PCI_ACS_CR | PCI_ACS_UF); |
1578 |
++ } |
1579 |
++ |
1580 |
++ return false; |
1581 |
++} |
1582 |
++ |
1583 |
+ /* |
1584 |
+ * AMD has indicated that the devices below do not support peer-to-peer |
1585 |
+ * in any system where they are found in the southbridge with an AMD |
1586 |
+@@ -4395,7 +4436,7 @@ static int pci_quirk_amd_sb_acs(struct pci_dev *dev, u16 acs_flags) |
1587 |
+ /* Filter out flags not applicable to multifunction */ |
1588 |
+ acs_flags &= (PCI_ACS_RR | PCI_ACS_CR | PCI_ACS_EC | PCI_ACS_DT); |
1589 |
+ |
1590 |
+- return acs_flags & ~(PCI_ACS_RR | PCI_ACS_CR) ? 0 : 1; |
1591 |
++ return pci_acs_ctrl_enabled(acs_flags, PCI_ACS_RR | PCI_ACS_CR); |
1592 |
+ #else |
1593 |
+ return -ENODEV; |
1594 |
+ #endif |
1595 |
+@@ -4422,20 +4463,19 @@ static bool pci_quirk_cavium_acs_match(struct pci_dev *dev) |
1596 |
+ |
1597 |
+ static int pci_quirk_cavium_acs(struct pci_dev *dev, u16 acs_flags) |
1598 |
+ { |
1599 |
++ if (!pci_quirk_cavium_acs_match(dev)) |
1600 |
++ return -ENOTTY; |
1601 |
++ |
1602 |
+ /* |
1603 |
+- * Cavium root ports don't advertise an ACS capability. However, |
1604 |
++ * Cavium Root Ports don't advertise an ACS capability. However, |
1605 |
+ * the RTL internally implements similar protection as if ACS had |
1606 |
+- * Request Redirection, Completion Redirection, Source Validation, |
1607 |
++ * Source Validation, Request Redirection, Completion Redirection, |
1608 |
+ * and Upstream Forwarding features enabled. Assert that the |
1609 |
+ * hardware implements and enables equivalent ACS functionality for |
1610 |
+ * these flags. |
1611 |
+ */ |
1612 |
+- acs_flags &= ~(PCI_ACS_RR | PCI_ACS_CR | PCI_ACS_SV | PCI_ACS_UF); |
1613 |
+- |
1614 |
+- if (!pci_quirk_cavium_acs_match(dev)) |
1615 |
+- return -ENOTTY; |
1616 |
+- |
1617 |
+- return acs_flags ? 0 : 1; |
1618 |
++ return pci_acs_ctrl_enabled(acs_flags, |
1619 |
++ PCI_ACS_SV | PCI_ACS_RR | PCI_ACS_CR | PCI_ACS_UF); |
1620 |
+ } |
1621 |
+ |
1622 |
+ static int pci_quirk_xgene_acs(struct pci_dev *dev, u16 acs_flags) |
1623 |
+@@ -4445,13 +4485,12 @@ static int pci_quirk_xgene_acs(struct pci_dev *dev, u16 acs_flags) |
1624 |
+ * transactions with others, allowing masking out these bits as if they |
1625 |
+ * were unimplemented in the ACS capability. |
1626 |
+ */ |
1627 |
+- acs_flags &= ~(PCI_ACS_SV | PCI_ACS_RR | PCI_ACS_CR | PCI_ACS_UF); |
1628 |
+- |
1629 |
+- return acs_flags ? 0 : 1; |
1630 |
++ return pci_acs_ctrl_enabled(acs_flags, |
1631 |
++ PCI_ACS_SV | PCI_ACS_RR | PCI_ACS_CR | PCI_ACS_UF); |
1632 |
+ } |
1633 |
+ |
1634 |
+ /* |
1635 |
+- * Many Intel PCH root ports do provide ACS-like features to disable peer |
1636 |
++ * Many Intel PCH Root Ports do provide ACS-like features to disable peer |
1637 |
+ * transactions and validate bus numbers in requests, but do not provide an |
1638 |
+ * actual PCIe ACS capability. This is the list of device IDs known to fall |
1639 |
+ * into that category as provided by Intel in Red Hat bugzilla 1037684. |
1640 |
+@@ -4499,37 +4538,32 @@ static bool pci_quirk_intel_pch_acs_match(struct pci_dev *dev) |
1641 |
+ return false; |
1642 |
+ } |
1643 |
+ |
1644 |
+-#define INTEL_PCH_ACS_FLAGS (PCI_ACS_RR | PCI_ACS_CR | PCI_ACS_UF | PCI_ACS_SV) |
1645 |
+- |
1646 |
+ static int pci_quirk_intel_pch_acs(struct pci_dev *dev, u16 acs_flags) |
1647 |
+ { |
1648 |
+- u16 flags = dev->dev_flags & PCI_DEV_FLAGS_ACS_ENABLED_QUIRK ? |
1649 |
+- INTEL_PCH_ACS_FLAGS : 0; |
1650 |
+- |
1651 |
+ if (!pci_quirk_intel_pch_acs_match(dev)) |
1652 |
+ return -ENOTTY; |
1653 |
+ |
1654 |
+- return acs_flags & ~flags ? 0 : 1; |
1655 |
++ if (dev->dev_flags & PCI_DEV_FLAGS_ACS_ENABLED_QUIRK) |
1656 |
++ return pci_acs_ctrl_enabled(acs_flags, |
1657 |
++ PCI_ACS_SV | PCI_ACS_RR | PCI_ACS_CR | PCI_ACS_UF); |
1658 |
++ |
1659 |
++ return pci_acs_ctrl_enabled(acs_flags, 0); |
1660 |
+ } |
1661 |
+ |
1662 |
+ /* |
1663 |
+- * These QCOM root ports do provide ACS-like features to disable peer |
1664 |
++ * These QCOM Root Ports do provide ACS-like features to disable peer |
1665 |
+ * transactions and validate bus numbers in requests, but do not provide an |
1666 |
+ * actual PCIe ACS capability. Hardware supports source validation but it |
1667 |
+ * will report the issue as Completer Abort instead of ACS Violation. |
1668 |
+- * Hardware doesn't support peer-to-peer and each root port is a root |
1669 |
+- * complex with unique segment numbers. It is not possible for one root |
1670 |
+- * port to pass traffic to another root port. All PCIe transactions are |
1671 |
+- * terminated inside the root port. |
1672 |
++ * Hardware doesn't support peer-to-peer and each Root Port is a Root |
1673 |
++ * Complex with unique segment numbers. It is not possible for one Root |
1674 |
++ * Port to pass traffic to another Root Port. All PCIe transactions are |
1675 |
++ * terminated inside the Root Port. |
1676 |
+ */ |
1677 |
+ static int pci_quirk_qcom_rp_acs(struct pci_dev *dev, u16 acs_flags) |
1678 |
+ { |
1679 |
+- u16 flags = (PCI_ACS_RR | PCI_ACS_CR | PCI_ACS_UF | PCI_ACS_SV); |
1680 |
+- int ret = acs_flags & ~flags ? 0 : 1; |
1681 |
+- |
1682 |
+- pci_info(dev, "Using QCOM ACS Quirk (%d)\n", ret); |
1683 |
+- |
1684 |
+- return ret; |
1685 |
++ return pci_acs_ctrl_enabled(acs_flags, |
1686 |
++ PCI_ACS_SV | PCI_ACS_RR | PCI_ACS_CR | PCI_ACS_UF); |
1687 |
+ } |
1688 |
+ |
1689 |
+ static int pci_quirk_al_acs(struct pci_dev *dev, u16 acs_flags) |
1690 |
+@@ -4630,7 +4664,7 @@ static int pci_quirk_intel_spt_pch_acs(struct pci_dev *dev, u16 acs_flags) |
1691 |
+ |
1692 |
+ pci_read_config_dword(dev, pos + INTEL_SPT_ACS_CTRL, &ctrl); |
1693 |
+ |
1694 |
+- return acs_flags & ~ctrl ? 0 : 1; |
1695 |
++ return pci_acs_ctrl_enabled(acs_flags, ctrl); |
1696 |
+ } |
1697 |
+ |
1698 |
+ static int pci_quirk_mf_endpoint_acs(struct pci_dev *dev, u16 acs_flags) |
1699 |
+@@ -4644,10 +4678,9 @@ static int pci_quirk_mf_endpoint_acs(struct pci_dev *dev, u16 acs_flags) |
1700 |
+ * perform peer-to-peer with other functions, allowing us to mask out |
1701 |
+ * these bits as if they were unimplemented in the ACS capability. |
1702 |
+ */ |
1703 |
+- acs_flags &= ~(PCI_ACS_SV | PCI_ACS_TB | PCI_ACS_RR | |
1704 |
+- PCI_ACS_CR | PCI_ACS_UF | PCI_ACS_DT); |
1705 |
+- |
1706 |
+- return acs_flags ? 0 : 1; |
1707 |
++ return pci_acs_ctrl_enabled(acs_flags, |
1708 |
++ PCI_ACS_SV | PCI_ACS_TB | PCI_ACS_RR | |
1709 |
++ PCI_ACS_CR | PCI_ACS_UF | PCI_ACS_DT); |
1710 |
+ } |
1711 |
+ |
1712 |
+ static int pci_quirk_brcm_acs(struct pci_dev *dev, u16 acs_flags) |
1713 |
+@@ -4658,9 +4691,8 @@ static int pci_quirk_brcm_acs(struct pci_dev *dev, u16 acs_flags) |
1714 |
+ * Allow each Root Port to be in a separate IOMMU group by masking |
1715 |
+ * SV/RR/CR/UF bits. |
1716 |
+ */ |
1717 |
+- acs_flags &= ~(PCI_ACS_SV | PCI_ACS_RR | PCI_ACS_CR | PCI_ACS_UF); |
1718 |
+- |
1719 |
+- return acs_flags ? 0 : 1; |
1720 |
++ return pci_acs_ctrl_enabled(acs_flags, |
1721 |
++ PCI_ACS_SV | PCI_ACS_RR | PCI_ACS_CR | PCI_ACS_UF); |
1722 |
+ } |
1723 |
+ |
1724 |
+ static const struct pci_dev_acs_enabled { |
1725 |
+@@ -4759,9 +4791,26 @@ static const struct pci_dev_acs_enabled { |
1726 |
+ { PCI_VENDOR_ID_BROADCOM, 0xD714, pci_quirk_brcm_acs }, |
1727 |
+ /* Amazon Annapurna Labs */ |
1728 |
+ { PCI_VENDOR_ID_AMAZON_ANNAPURNA_LABS, 0x0031, pci_quirk_al_acs }, |
1729 |
++ /* Zhaoxin multi-function devices */ |
1730 |
++ { PCI_VENDOR_ID_ZHAOXIN, 0x3038, pci_quirk_mf_endpoint_acs }, |
1731 |
++ { PCI_VENDOR_ID_ZHAOXIN, 0x3104, pci_quirk_mf_endpoint_acs }, |
1732 |
++ { PCI_VENDOR_ID_ZHAOXIN, 0x9083, pci_quirk_mf_endpoint_acs }, |
1733 |
++ /* Zhaoxin Root/Downstream Ports */ |
1734 |
++ { PCI_VENDOR_ID_ZHAOXIN, PCI_ANY_ID, pci_quirk_zhaoxin_pcie_ports_acs }, |
1735 |
+ { 0 } |
1736 |
+ }; |
1737 |
+ |
1738 |
++/* |
1739 |
++ * pci_dev_specific_acs_enabled - check whether device provides ACS controls |
1740 |
++ * @dev: PCI device |
1741 |
++ * @acs_flags: Bitmask of desired ACS controls |
1742 |
++ * |
1743 |
++ * Returns: |
1744 |
++ * -ENOTTY: No quirk applies to this device; we can't tell whether the |
1745 |
++ * device provides the desired controls |
1746 |
++ * 0: Device does not provide all the desired controls |
1747 |
++ * >0: Device provides all the controls in @acs_flags |
1748 |
++ */ |
1749 |
+ int pci_dev_specific_acs_enabled(struct pci_dev *dev, u16 acs_flags) |
1750 |
+ { |
1751 |
+ const struct pci_dev_acs_enabled *i; |
1752 |
+@@ -5490,3 +5539,21 @@ out_disable: |
1753 |
+ DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_VENDOR_ID_NVIDIA, 0x13b1, |
1754 |
+ PCI_CLASS_DISPLAY_VGA, 8, |
1755 |
+ quirk_reset_lenovo_thinkpad_p50_nvgpu); |
1756 |
++ |
1757 |
++/* |
1758 |
++ * Device [1b21:2142] |
1759 |
++ * When in D0, PME# doesn't get asserted when plugging USB 3.0 device. |
1760 |
++ */ |
1761 |
++static void pci_fixup_no_d0_pme(struct pci_dev *dev) |
1762 |
++{ |
1763 |
++ pci_info(dev, "PME# does not work under D0, disabling it\n"); |
1764 |
++ dev->pme_support &= ~(PCI_PM_CAP_PME_D0 >> PCI_PM_CAP_PME_SHIFT); |
1765 |
++} |
1766 |
++DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ASMEDIA, 0x2142, pci_fixup_no_d0_pme); |
1767 |
++ |
1768 |
++static void apex_pci_fixup_class(struct pci_dev *pdev) |
1769 |
++{ |
1770 |
++ pdev->class = (PCI_CLASS_SYSTEM_OTHER << 8) | pdev->class; |
1771 |
++} |
1772 |
++DECLARE_PCI_FIXUP_CLASS_HEADER(0x1ac1, 0x089a, |
1773 |
++ PCI_CLASS_NOT_DEFINED, 8, apex_pci_fixup_class); |
1774 |
+diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c |
1775 |
+index b542debbc6f0..010f541a5002 100644 |
1776 |
+--- a/drivers/remoteproc/remoteproc_core.c |
1777 |
++++ b/drivers/remoteproc/remoteproc_core.c |
1778 |
+@@ -400,7 +400,7 @@ rproc_parse_vring(struct rproc_vdev *rvdev, struct fw_rsc_vdev *rsc, int i) |
1779 |
+ void rproc_free_vring(struct rproc_vring *rvring) |
1780 |
+ { |
1781 |
+ struct rproc *rproc = rvring->rvdev->rproc; |
1782 |
+- int idx = rvring->rvdev->vring - rvring; |
1783 |
++ int idx = rvring - rvring->rvdev->vring; |
1784 |
+ struct fw_rsc_vdev *rsc; |
1785 |
+ |
1786 |
+ idr_remove(&rproc->notifyids, rvring->notifyid); |
1787 |
+diff --git a/drivers/soc/xilinx/Kconfig b/drivers/soc/xilinx/Kconfig |
1788 |
+index 01e76b58dd78..3fa162c1fde7 100644 |
1789 |
+--- a/drivers/soc/xilinx/Kconfig |
1790 |
++++ b/drivers/soc/xilinx/Kconfig |
1791 |
+@@ -19,7 +19,7 @@ config XILINX_VCU |
1792 |
+ |
1793 |
+ config ZYNQMP_POWER |
1794 |
+ bool "Enable Xilinx Zynq MPSoC Power Management driver" |
1795 |
+- depends on PM && ARCH_ZYNQMP |
1796 |
++ depends on PM && ZYNQMP_FIRMWARE |
1797 |
+ default y |
1798 |
+ help |
1799 |
+ Say yes to enable power management support for ZyqnMP SoC. |
1800 |
+@@ -31,7 +31,7 @@ config ZYNQMP_POWER |
1801 |
+ config ZYNQMP_PM_DOMAINS |
1802 |
+ bool "Enable Zynq MPSoC generic PM domains" |
1803 |
+ default y |
1804 |
+- depends on PM && ARCH_ZYNQMP && ZYNQMP_FIRMWARE |
1805 |
++ depends on PM && ZYNQMP_FIRMWARE |
1806 |
+ select PM_GENERIC_DOMAINS |
1807 |
+ help |
1808 |
+ Say yes to enable device power management through PM domains |
1809 |
+diff --git a/drivers/staging/gasket/apex_driver.c b/drivers/staging/gasket/apex_driver.c |
1810 |
+index 46199c8ca441..f12f81c8dd2f 100644 |
1811 |
+--- a/drivers/staging/gasket/apex_driver.c |
1812 |
++++ b/drivers/staging/gasket/apex_driver.c |
1813 |
+@@ -570,13 +570,6 @@ static const struct pci_device_id apex_pci_ids[] = { |
1814 |
+ { PCI_DEVICE(APEX_PCI_VENDOR_ID, APEX_PCI_DEVICE_ID) }, { 0 } |
1815 |
+ }; |
1816 |
+ |
1817 |
+-static void apex_pci_fixup_class(struct pci_dev *pdev) |
1818 |
+-{ |
1819 |
+- pdev->class = (PCI_CLASS_SYSTEM_OTHER << 8) | pdev->class; |
1820 |
+-} |
1821 |
+-DECLARE_PCI_FIXUP_CLASS_HEADER(APEX_PCI_VENDOR_ID, APEX_PCI_DEVICE_ID, |
1822 |
+- PCI_CLASS_NOT_DEFINED, 8, apex_pci_fixup_class); |
1823 |
+- |
1824 |
+ static int apex_pci_probe(struct pci_dev *pci_dev, |
1825 |
+ const struct pci_device_id *id) |
1826 |
+ { |
1827 |
+diff --git a/drivers/target/target_core_fabric_lib.c b/drivers/target/target_core_fabric_lib.c |
1828 |
+index 6b4b354c88aa..b5c970faf585 100644 |
1829 |
+--- a/drivers/target/target_core_fabric_lib.c |
1830 |
++++ b/drivers/target/target_core_fabric_lib.c |
1831 |
+@@ -63,7 +63,7 @@ static int fc_get_pr_transport_id( |
1832 |
+ * encoded TransportID. |
1833 |
+ */ |
1834 |
+ ptr = &se_nacl->initiatorname[0]; |
1835 |
+- for (i = 0; i < 24; ) { |
1836 |
++ for (i = 0; i < 23; ) { |
1837 |
+ if (!strncmp(&ptr[i], ":", 1)) { |
1838 |
+ i++; |
1839 |
+ continue; |
1840 |
+diff --git a/drivers/target/target_core_user.c b/drivers/target/target_core_user.c |
1841 |
+index 35be1be87d2a..9425354aef99 100644 |
1842 |
+--- a/drivers/target/target_core_user.c |
1843 |
++++ b/drivers/target/target_core_user.c |
1844 |
+@@ -2073,6 +2073,7 @@ static void tcmu_reset_ring(struct tcmu_dev *udev, u8 err_level) |
1845 |
+ mb->cmd_tail = 0; |
1846 |
+ mb->cmd_head = 0; |
1847 |
+ tcmu_flush_dcache_range(mb, sizeof(*mb)); |
1848 |
++ clear_bit(TCMU_DEV_BIT_BROKEN, &udev->flags); |
1849 |
+ |
1850 |
+ del_timer(&udev->cmd_timer); |
1851 |
+ |
1852 |
+diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c |
1853 |
+index 18251efd216d..379f978db13d 100644 |
1854 |
+--- a/drivers/usb/dwc3/gadget.c |
1855 |
++++ b/drivers/usb/dwc3/gadget.c |
1856 |
+@@ -1725,7 +1725,6 @@ static int __dwc3_gadget_wakeup(struct dwc3 *dwc) |
1857 |
+ u32 reg; |
1858 |
+ |
1859 |
+ u8 link_state; |
1860 |
+- u8 speed; |
1861 |
+ |
1862 |
+ /* |
1863 |
+ * According to the Databook Remote wakeup request should |
1864 |
+@@ -1735,16 +1734,13 @@ static int __dwc3_gadget_wakeup(struct dwc3 *dwc) |
1865 |
+ */ |
1866 |
+ reg = dwc3_readl(dwc->regs, DWC3_DSTS); |
1867 |
+ |
1868 |
+- speed = reg & DWC3_DSTS_CONNECTSPD; |
1869 |
+- if ((speed == DWC3_DSTS_SUPERSPEED) || |
1870 |
+- (speed == DWC3_DSTS_SUPERSPEED_PLUS)) |
1871 |
+- return 0; |
1872 |
+- |
1873 |
+ link_state = DWC3_DSTS_USBLNKST(reg); |
1874 |
+ |
1875 |
+ switch (link_state) { |
1876 |
++ case DWC3_LINK_STATE_RESET: |
1877 |
+ case DWC3_LINK_STATE_RX_DET: /* in HS, means Early Suspend */ |
1878 |
+ case DWC3_LINK_STATE_U3: /* in HS, means SUSPEND */ |
1879 |
++ case DWC3_LINK_STATE_RESUME: |
1880 |
+ break; |
1881 |
+ default: |
1882 |
+ return -EINVAL; |
1883 |
+diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c b/drivers/usb/gadget/udc/atmel_usba_udc.c |
1884 |
+index 1d0d8952a74b..58e5b015d40e 100644 |
1885 |
+--- a/drivers/usb/gadget/udc/atmel_usba_udc.c |
1886 |
++++ b/drivers/usb/gadget/udc/atmel_usba_udc.c |
1887 |
+@@ -1950,10 +1950,10 @@ static irqreturn_t usba_vbus_irq_thread(int irq, void *devid) |
1888 |
+ usba_start(udc); |
1889 |
+ } else { |
1890 |
+ udc->suspended = false; |
1891 |
+- usba_stop(udc); |
1892 |
+- |
1893 |
+ if (udc->driver->disconnect) |
1894 |
+ udc->driver->disconnect(&udc->gadget); |
1895 |
++ |
1896 |
++ usba_stop(udc); |
1897 |
+ } |
1898 |
+ udc->vbus_prev = vbus; |
1899 |
+ } |
1900 |
+diff --git a/drivers/usb/gadget/udc/bdc/bdc_ep.c b/drivers/usb/gadget/udc/bdc/bdc_ep.c |
1901 |
+index a4d9b5e1e50e..d49c6dc1082d 100644 |
1902 |
+--- a/drivers/usb/gadget/udc/bdc/bdc_ep.c |
1903 |
++++ b/drivers/usb/gadget/udc/bdc/bdc_ep.c |
1904 |
+@@ -540,7 +540,7 @@ static void bdc_req_complete(struct bdc_ep *ep, struct bdc_req *req, |
1905 |
+ { |
1906 |
+ struct bdc *bdc = ep->bdc; |
1907 |
+ |
1908 |
+- if (req == NULL || &req->queue == NULL || &req->usb_req == NULL) |
1909 |
++ if (req == NULL) |
1910 |
+ return; |
1911 |
+ |
1912 |
+ dev_dbg(bdc->dev, "%s ep:%s status:%d\n", __func__, ep->name, status); |
1913 |
+diff --git a/drivers/xen/xenbus/xenbus_client.c b/drivers/xen/xenbus/xenbus_client.c |
1914 |
+index e17ca8156171..a38292ef79f6 100644 |
1915 |
+--- a/drivers/xen/xenbus/xenbus_client.c |
1916 |
++++ b/drivers/xen/xenbus/xenbus_client.c |
1917 |
+@@ -448,7 +448,14 @@ EXPORT_SYMBOL_GPL(xenbus_free_evtchn); |
1918 |
+ int xenbus_map_ring_valloc(struct xenbus_device *dev, grant_ref_t *gnt_refs, |
1919 |
+ unsigned int nr_grefs, void **vaddr) |
1920 |
+ { |
1921 |
+- return ring_ops->map(dev, gnt_refs, nr_grefs, vaddr); |
1922 |
++ int err; |
1923 |
++ |
1924 |
++ err = ring_ops->map(dev, gnt_refs, nr_grefs, vaddr); |
1925 |
++ /* Some hypervisors are buggy and can return 1. */ |
1926 |
++ if (err > 0) |
1927 |
++ err = GNTST_general_error; |
1928 |
++ |
1929 |
++ return err; |
1930 |
+ } |
1931 |
+ EXPORT_SYMBOL_GPL(xenbus_map_ring_valloc); |
1932 |
+ |
1933 |
+diff --git a/fs/afs/cmservice.c b/fs/afs/cmservice.c |
1934 |
+index b378cd780ed5..fc5eb0f89304 100644 |
1935 |
+--- a/fs/afs/cmservice.c |
1936 |
++++ b/fs/afs/cmservice.c |
1937 |
+@@ -169,7 +169,7 @@ static int afs_record_cm_probe(struct afs_call *call, struct afs_server *server) |
1938 |
+ |
1939 |
+ spin_lock(&server->probe_lock); |
1940 |
+ |
1941 |
+- if (!test_bit(AFS_SERVER_FL_HAVE_EPOCH, &server->flags)) { |
1942 |
++ if (!test_and_set_bit(AFS_SERVER_FL_HAVE_EPOCH, &server->flags)) { |
1943 |
+ server->cm_epoch = call->epoch; |
1944 |
+ server->probe.cm_epoch = call->epoch; |
1945 |
+ goto out; |
1946 |
+diff --git a/fs/afs/internal.h b/fs/afs/internal.h |
1947 |
+index d5efb1debebf..485cc3b2aaa8 100644 |
1948 |
+--- a/fs/afs/internal.h |
1949 |
++++ b/fs/afs/internal.h |
1950 |
+@@ -1329,7 +1329,7 @@ extern struct afs_volume *afs_create_volume(struct afs_fs_context *); |
1951 |
+ extern void afs_activate_volume(struct afs_volume *); |
1952 |
+ extern void afs_deactivate_volume(struct afs_volume *); |
1953 |
+ extern void afs_put_volume(struct afs_cell *, struct afs_volume *); |
1954 |
+-extern int afs_check_volume_status(struct afs_volume *, struct key *); |
1955 |
++extern int afs_check_volume_status(struct afs_volume *, struct afs_fs_cursor *); |
1956 |
+ |
1957 |
+ /* |
1958 |
+ * write.c |
1959 |
+diff --git a/fs/afs/rotate.c b/fs/afs/rotate.c |
1960 |
+index 172ba569cd60..2a3305e42b14 100644 |
1961 |
+--- a/fs/afs/rotate.c |
1962 |
++++ b/fs/afs/rotate.c |
1963 |
+@@ -192,7 +192,7 @@ bool afs_select_fileserver(struct afs_fs_cursor *fc) |
1964 |
+ write_unlock(&vnode->volume->servers_lock); |
1965 |
+ |
1966 |
+ set_bit(AFS_VOLUME_NEEDS_UPDATE, &vnode->volume->flags); |
1967 |
+- error = afs_check_volume_status(vnode->volume, fc->key); |
1968 |
++ error = afs_check_volume_status(vnode->volume, fc); |
1969 |
+ if (error < 0) |
1970 |
+ goto failed_set_error; |
1971 |
+ |
1972 |
+@@ -281,7 +281,7 @@ bool afs_select_fileserver(struct afs_fs_cursor *fc) |
1973 |
+ |
1974 |
+ set_bit(AFS_VOLUME_WAIT, &vnode->volume->flags); |
1975 |
+ set_bit(AFS_VOLUME_NEEDS_UPDATE, &vnode->volume->flags); |
1976 |
+- error = afs_check_volume_status(vnode->volume, fc->key); |
1977 |
++ error = afs_check_volume_status(vnode->volume, fc); |
1978 |
+ if (error < 0) |
1979 |
+ goto failed_set_error; |
1980 |
+ |
1981 |
+@@ -341,7 +341,7 @@ start: |
1982 |
+ /* See if we need to do an update of the volume record. Note that the |
1983 |
+ * volume may have moved or even have been deleted. |
1984 |
+ */ |
1985 |
+- error = afs_check_volume_status(vnode->volume, fc->key); |
1986 |
++ error = afs_check_volume_status(vnode->volume, fc); |
1987 |
+ if (error < 0) |
1988 |
+ goto failed_set_error; |
1989 |
+ |
1990 |
+diff --git a/fs/afs/server.c b/fs/afs/server.c |
1991 |
+index ca8115ba1724..d3a9288f7556 100644 |
1992 |
+--- a/fs/afs/server.c |
1993 |
++++ b/fs/afs/server.c |
1994 |
+@@ -595,12 +595,9 @@ retry: |
1995 |
+ } |
1996 |
+ |
1997 |
+ ret = wait_on_bit(&server->flags, AFS_SERVER_FL_UPDATING, |
1998 |
+- TASK_INTERRUPTIBLE); |
1999 |
++ (fc->flags & AFS_FS_CURSOR_INTR) ? |
2000 |
++ TASK_INTERRUPTIBLE : TASK_UNINTERRUPTIBLE); |
2001 |
+ if (ret == -ERESTARTSYS) { |
2002 |
+- if (!(fc->flags & AFS_FS_CURSOR_INTR) && server->addresses) { |
2003 |
+- _leave(" = t [intr]"); |
2004 |
+- return true; |
2005 |
+- } |
2006 |
+ fc->error = ret; |
2007 |
+ _leave(" = f [intr]"); |
2008 |
+ return false; |
2009 |
+diff --git a/fs/afs/volume.c b/fs/afs/volume.c |
2010 |
+index 92ca5e27573b..4310336b9bb8 100644 |
2011 |
+--- a/fs/afs/volume.c |
2012 |
++++ b/fs/afs/volume.c |
2013 |
+@@ -281,7 +281,7 @@ error: |
2014 |
+ /* |
2015 |
+ * Make sure the volume record is up to date. |
2016 |
+ */ |
2017 |
+-int afs_check_volume_status(struct afs_volume *volume, struct key *key) |
2018 |
++int afs_check_volume_status(struct afs_volume *volume, struct afs_fs_cursor *fc) |
2019 |
+ { |
2020 |
+ time64_t now = ktime_get_real_seconds(); |
2021 |
+ int ret, retries = 0; |
2022 |
+@@ -299,7 +299,7 @@ retry: |
2023 |
+ } |
2024 |
+ |
2025 |
+ if (!test_and_set_bit_lock(AFS_VOLUME_UPDATING, &volume->flags)) { |
2026 |
+- ret = afs_update_volume_status(volume, key); |
2027 |
++ ret = afs_update_volume_status(volume, fc->key); |
2028 |
+ clear_bit_unlock(AFS_VOLUME_WAIT, &volume->flags); |
2029 |
+ clear_bit_unlock(AFS_VOLUME_UPDATING, &volume->flags); |
2030 |
+ wake_up_bit(&volume->flags, AFS_VOLUME_WAIT); |
2031 |
+@@ -312,7 +312,9 @@ retry: |
2032 |
+ return 0; |
2033 |
+ } |
2034 |
+ |
2035 |
+- ret = wait_on_bit(&volume->flags, AFS_VOLUME_WAIT, TASK_INTERRUPTIBLE); |
2036 |
++ ret = wait_on_bit(&volume->flags, AFS_VOLUME_WAIT, |
2037 |
++ (fc->flags & AFS_FS_CURSOR_INTR) ? |
2038 |
++ TASK_INTERRUPTIBLE : TASK_UNINTERRUPTIBLE); |
2039 |
+ if (ret == -ERESTARTSYS) { |
2040 |
+ _leave(" = %d", ret); |
2041 |
+ return ret; |
2042 |
+diff --git a/fs/afs/yfsclient.c b/fs/afs/yfsclient.c |
2043 |
+index 31b236c6b1f7..39230880f372 100644 |
2044 |
+--- a/fs/afs/yfsclient.c |
2045 |
++++ b/fs/afs/yfsclient.c |
2046 |
+@@ -165,15 +165,15 @@ static void xdr_dump_bad(const __be32 *bp) |
2047 |
+ int i; |
2048 |
+ |
2049 |
+ pr_notice("YFS XDR: Bad status record\n"); |
2050 |
+- for (i = 0; i < 5 * 4 * 4; i += 16) { |
2051 |
++ for (i = 0; i < 6 * 4 * 4; i += 16) { |
2052 |
+ memcpy(x, bp, 16); |
2053 |
+ bp += 4; |
2054 |
+ pr_notice("%03x: %08x %08x %08x %08x\n", |
2055 |
+ i, ntohl(x[0]), ntohl(x[1]), ntohl(x[2]), ntohl(x[3])); |
2056 |
+ } |
2057 |
+ |
2058 |
+- memcpy(x, bp, 4); |
2059 |
+- pr_notice("0x50: %08x\n", ntohl(x[0])); |
2060 |
++ memcpy(x, bp, 8); |
2061 |
++ pr_notice("0x60: %08x %08x\n", ntohl(x[0]), ntohl(x[1])); |
2062 |
+ } |
2063 |
+ |
2064 |
+ /* |
2065 |
+diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c |
2066 |
+index a6288730210e..64b6549dd901 100644 |
2067 |
+--- a/fs/ext4/ialloc.c |
2068 |
++++ b/fs/ext4/ialloc.c |
2069 |
+@@ -660,7 +660,7 @@ static int find_group_other(struct super_block *sb, struct inode *parent, |
2070 |
+ * block has been written back to disk. (Yes, these values are |
2071 |
+ * somewhat arbitrary...) |
2072 |
+ */ |
2073 |
+-#define RECENTCY_MIN 5 |
2074 |
++#define RECENTCY_MIN 60 |
2075 |
+ #define RECENTCY_DIRTY 300 |
2076 |
+ |
2077 |
+ static int recently_deleted(struct super_block *sb, ext4_group_t group, int ino) |
2078 |
+diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c |
2079 |
+index b9473fcc110f..7e0c77de551b 100644 |
2080 |
+--- a/fs/ext4/inode.c |
2081 |
++++ b/fs/ext4/inode.c |
2082 |
+@@ -2131,7 +2131,7 @@ static int ext4_writepage(struct page *page, |
2083 |
+ bool keep_towrite = false; |
2084 |
+ |
2085 |
+ if (unlikely(ext4_forced_shutdown(EXT4_SB(inode->i_sb)))) { |
2086 |
+- ext4_invalidatepage(page, 0, PAGE_SIZE); |
2087 |
++ inode->i_mapping->a_ops->invalidatepage(page, 0, PAGE_SIZE); |
2088 |
+ unlock_page(page); |
2089 |
+ return -EIO; |
2090 |
+ } |
2091 |
+diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c |
2092 |
+index c76ffc259d19..e1782b2e2e2d 100644 |
2093 |
+--- a/fs/ext4/mballoc.c |
2094 |
++++ b/fs/ext4/mballoc.c |
2095 |
+@@ -1936,7 +1936,8 @@ void ext4_mb_complex_scan_group(struct ext4_allocation_context *ac, |
2096 |
+ int free; |
2097 |
+ |
2098 |
+ free = e4b->bd_info->bb_free; |
2099 |
+- BUG_ON(free <= 0); |
2100 |
++ if (WARN_ON(free <= 0)) |
2101 |
++ return; |
2102 |
+ |
2103 |
+ i = e4b->bd_info->bb_first_free; |
2104 |
+ |
2105 |
+@@ -1959,7 +1960,8 @@ void ext4_mb_complex_scan_group(struct ext4_allocation_context *ac, |
2106 |
+ } |
2107 |
+ |
2108 |
+ mb_find_extent(e4b, i, ac->ac_g_ex.fe_len, &ex); |
2109 |
+- BUG_ON(ex.fe_len <= 0); |
2110 |
++ if (WARN_ON(ex.fe_len <= 0)) |
2111 |
++ break; |
2112 |
+ if (free < ex.fe_len) { |
2113 |
+ ext4_grp_locked_error(sb, e4b->bd_group, 0, 0, |
2114 |
+ "%d free clusters as per " |
2115 |
+diff --git a/fs/ext4/super.c b/fs/ext4/super.c |
2116 |
+index 53d4c67a20df..d3500eaf900e 100644 |
2117 |
+--- a/fs/ext4/super.c |
2118 |
++++ b/fs/ext4/super.c |
2119 |
+@@ -3562,7 +3562,8 @@ int ext4_calculate_overhead(struct super_block *sb) |
2120 |
+ */ |
2121 |
+ if (sbi->s_journal && !sbi->journal_bdev) |
2122 |
+ overhead += EXT4_NUM_B2C(sbi, sbi->s_journal->j_maxlen); |
2123 |
+- else if (ext4_has_feature_journal(sb) && !sbi->s_journal) { |
2124 |
++ else if (ext4_has_feature_journal(sb) && !sbi->s_journal && j_inum) { |
2125 |
++ /* j_inum for internal journal is non-zero */ |
2126 |
+ j_inode = ext4_get_journal_inode(sb, j_inum); |
2127 |
+ if (j_inode) { |
2128 |
+ j_blocks = j_inode->i_size >> sb->s_blocksize_bits; |
2129 |
+diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c |
2130 |
+index 1c82d7dd54df..8650a97e2ba9 100644 |
2131 |
+--- a/fs/nfsd/nfs4state.c |
2132 |
++++ b/fs/nfsd/nfs4state.c |
2133 |
+@@ -266,6 +266,8 @@ find_or_allocate_block(struct nfs4_lockowner *lo, struct knfsd_fh *fh, |
2134 |
+ if (!nbl) { |
2135 |
+ nbl= kmalloc(sizeof(*nbl), GFP_KERNEL); |
2136 |
+ if (nbl) { |
2137 |
++ INIT_LIST_HEAD(&nbl->nbl_list); |
2138 |
++ INIT_LIST_HEAD(&nbl->nbl_lru); |
2139 |
+ fh_copy_shallow(&nbl->nbl_fh, fh); |
2140 |
+ locks_init_lock(&nbl->nbl_lock); |
2141 |
+ nfsd4_init_cb(&nbl->nbl_cb, lo->lo_owner.so_client, |
2142 |
+diff --git a/fs/pnode.c b/fs/pnode.c |
2143 |
+index 49f6d7ff2139..1106137c747a 100644 |
2144 |
+--- a/fs/pnode.c |
2145 |
++++ b/fs/pnode.c |
2146 |
+@@ -261,14 +261,13 @@ static int propagate_one(struct mount *m) |
2147 |
+ child = copy_tree(last_source, last_source->mnt.mnt_root, type); |
2148 |
+ if (IS_ERR(child)) |
2149 |
+ return PTR_ERR(child); |
2150 |
++ read_seqlock_excl(&mount_lock); |
2151 |
+ mnt_set_mountpoint(m, mp, child); |
2152 |
++ if (m->mnt_master != dest_master) |
2153 |
++ SET_MNT_MARK(m->mnt_master); |
2154 |
++ read_sequnlock_excl(&mount_lock); |
2155 |
+ last_dest = m; |
2156 |
+ last_source = child; |
2157 |
+- if (m->mnt_master != dest_master) { |
2158 |
+- read_seqlock_excl(&mount_lock); |
2159 |
+- SET_MNT_MARK(m->mnt_master); |
2160 |
+- read_sequnlock_excl(&mount_lock); |
2161 |
+- } |
2162 |
+ hlist_add_head(&child->mnt_hash, list); |
2163 |
+ return count_mounts(m->mnt_ns, child); |
2164 |
+ } |
2165 |
+diff --git a/fs/ubifs/orphan.c b/fs/ubifs/orphan.c |
2166 |
+index edf43ddd7dce..7dd740e3692d 100644 |
2167 |
+--- a/fs/ubifs/orphan.c |
2168 |
++++ b/fs/ubifs/orphan.c |
2169 |
+@@ -688,14 +688,14 @@ static int do_kill_orphans(struct ubifs_info *c, struct ubifs_scan_leb *sleb, |
2170 |
+ |
2171 |
+ ino_key_init(c, &key1, inum); |
2172 |
+ err = ubifs_tnc_lookup(c, &key1, ino); |
2173 |
+- if (err) |
2174 |
++ if (err && err != -ENOENT) |
2175 |
+ goto out_free; |
2176 |
+ |
2177 |
+ /* |
2178 |
+ * Check whether an inode can really get deleted. |
2179 |
+ * linkat() with O_TMPFILE allows rebirth of an inode. |
2180 |
+ */ |
2181 |
+- if (ino->nlink == 0) { |
2182 |
++ if (err == 0 && ino->nlink == 0) { |
2183 |
+ dbg_rcvry("deleting orphaned inode %lu", |
2184 |
+ (unsigned long)inum); |
2185 |
+ |
2186 |
+diff --git a/fs/xfs/xfs_icache.c b/fs/xfs/xfs_icache.c |
2187 |
+index 944add5ff8e0..d95dc9b0f0bb 100644 |
2188 |
+--- a/fs/xfs/xfs_icache.c |
2189 |
++++ b/fs/xfs/xfs_icache.c |
2190 |
+@@ -907,7 +907,12 @@ xfs_eofblocks_worker( |
2191 |
+ { |
2192 |
+ struct xfs_mount *mp = container_of(to_delayed_work(work), |
2193 |
+ struct xfs_mount, m_eofblocks_work); |
2194 |
++ |
2195 |
++ if (!sb_start_write_trylock(mp->m_super)) |
2196 |
++ return; |
2197 |
+ xfs_icache_free_eofblocks(mp, NULL); |
2198 |
++ sb_end_write(mp->m_super); |
2199 |
++ |
2200 |
+ xfs_queue_eofblocks(mp); |
2201 |
+ } |
2202 |
+ |
2203 |
+@@ -934,7 +939,12 @@ xfs_cowblocks_worker( |
2204 |
+ { |
2205 |
+ struct xfs_mount *mp = container_of(to_delayed_work(work), |
2206 |
+ struct xfs_mount, m_cowblocks_work); |
2207 |
++ |
2208 |
++ if (!sb_start_write_trylock(mp->m_super)) |
2209 |
++ return; |
2210 |
+ xfs_icache_free_cowblocks(mp, NULL); |
2211 |
++ sb_end_write(mp->m_super); |
2212 |
++ |
2213 |
+ xfs_queue_cowblocks(mp); |
2214 |
+ } |
2215 |
+ |
2216 |
+diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c |
2217 |
+index 2a1909397cb4..c93c4b7328ef 100644 |
2218 |
+--- a/fs/xfs/xfs_ioctl.c |
2219 |
++++ b/fs/xfs/xfs_ioctl.c |
2220 |
+@@ -2401,7 +2401,10 @@ xfs_file_ioctl( |
2221 |
+ if (error) |
2222 |
+ return error; |
2223 |
+ |
2224 |
+- return xfs_icache_free_eofblocks(mp, &keofb); |
2225 |
++ sb_start_write(mp->m_super); |
2226 |
++ error = xfs_icache_free_eofblocks(mp, &keofb); |
2227 |
++ sb_end_write(mp->m_super); |
2228 |
++ return error; |
2229 |
+ } |
2230 |
+ |
2231 |
+ default: |
2232 |
+diff --git a/fs/xfs/xfs_reflink.c b/fs/xfs/xfs_reflink.c |
2233 |
+index 0f08153b4994..6a4fd1738b08 100644 |
2234 |
+--- a/fs/xfs/xfs_reflink.c |
2235 |
++++ b/fs/xfs/xfs_reflink.c |
2236 |
+@@ -1053,6 +1053,7 @@ xfs_reflink_remap_extent( |
2237 |
+ uirec.br_startblock = irec->br_startblock + rlen; |
2238 |
+ uirec.br_startoff = irec->br_startoff + rlen; |
2239 |
+ uirec.br_blockcount = unmap_len - rlen; |
2240 |
++ uirec.br_state = irec->br_state; |
2241 |
+ unmap_len = rlen; |
2242 |
+ |
2243 |
+ /* If this isn't a real mapping, we're done. */ |
2244 |
+diff --git a/fs/xfs/xfs_trans_ail.c b/fs/xfs/xfs_trans_ail.c |
2245 |
+index 6ccfd75d3c24..812108f6cc89 100644 |
2246 |
+--- a/fs/xfs/xfs_trans_ail.c |
2247 |
++++ b/fs/xfs/xfs_trans_ail.c |
2248 |
+@@ -529,8 +529,9 @@ xfsaild( |
2249 |
+ { |
2250 |
+ struct xfs_ail *ailp = data; |
2251 |
+ long tout = 0; /* milliseconds */ |
2252 |
++ unsigned int noreclaim_flag; |
2253 |
+ |
2254 |
+- current->flags |= PF_MEMALLOC; |
2255 |
++ noreclaim_flag = memalloc_noreclaim_save(); |
2256 |
+ set_freezable(); |
2257 |
+ |
2258 |
+ while (1) { |
2259 |
+@@ -601,6 +602,7 @@ xfsaild( |
2260 |
+ tout = xfsaild_push(ailp); |
2261 |
+ } |
2262 |
+ |
2263 |
++ memalloc_noreclaim_restore(noreclaim_flag); |
2264 |
+ return 0; |
2265 |
+ } |
2266 |
+ |
2267 |
+diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h |
2268 |
+index 21a572469a4e..228f66347620 100644 |
2269 |
+--- a/include/linux/pci_ids.h |
2270 |
++++ b/include/linux/pci_ids.h |
2271 |
+@@ -2582,6 +2582,8 @@ |
2272 |
+ |
2273 |
+ #define PCI_VENDOR_ID_AMAZON 0x1d0f |
2274 |
+ |
2275 |
++#define PCI_VENDOR_ID_ZHAOXIN 0x1d17 |
2276 |
++ |
2277 |
+ #define PCI_VENDOR_ID_HYGON 0x1d94 |
2278 |
+ |
2279 |
+ #define PCI_VENDOR_ID_HXT 0x1dbf |
2280 |
+diff --git a/include/linux/printk.h b/include/linux/printk.h |
2281 |
+index c09d67edda3a..3b5cb66d8bc1 100644 |
2282 |
+--- a/include/linux/printk.h |
2283 |
++++ b/include/linux/printk.h |
2284 |
+@@ -202,7 +202,6 @@ __printf(1, 2) void dump_stack_set_arch_desc(const char *fmt, ...); |
2285 |
+ void dump_stack_print_info(const char *log_lvl); |
2286 |
+ void show_regs_print_info(const char *log_lvl); |
2287 |
+ extern asmlinkage void dump_stack(void) __cold; |
2288 |
+-extern void printk_safe_init(void); |
2289 |
+ extern void printk_safe_flush(void); |
2290 |
+ extern void printk_safe_flush_on_panic(void); |
2291 |
+ #else |
2292 |
+@@ -269,10 +268,6 @@ static inline void dump_stack(void) |
2293 |
+ { |
2294 |
+ } |
2295 |
+ |
2296 |
+-static inline void printk_safe_init(void) |
2297 |
+-{ |
2298 |
+-} |
2299 |
+- |
2300 |
+ static inline void printk_safe_flush(void) |
2301 |
+ { |
2302 |
+ } |
2303 |
+diff --git a/include/linux/qed/qed_chain.h b/include/linux/qed/qed_chain.h |
2304 |
+index 2dd0a9ed5b36..733fad7dfbed 100644 |
2305 |
+--- a/include/linux/qed/qed_chain.h |
2306 |
++++ b/include/linux/qed/qed_chain.h |
2307 |
+@@ -97,6 +97,11 @@ struct qed_chain_u32 { |
2308 |
+ u32 cons_idx; |
2309 |
+ }; |
2310 |
+ |
2311 |
++struct addr_tbl_entry { |
2312 |
++ void *virt_addr; |
2313 |
++ dma_addr_t dma_map; |
2314 |
++}; |
2315 |
++ |
2316 |
+ struct qed_chain { |
2317 |
+ /* fastpath portion of the chain - required for commands such |
2318 |
+ * as produce / consume. |
2319 |
+@@ -107,10 +112,11 @@ struct qed_chain { |
2320 |
+ |
2321 |
+ /* Fastpath portions of the PBL [if exists] */ |
2322 |
+ struct { |
2323 |
+- /* Table for keeping the virtual addresses of the chain pages, |
2324 |
+- * respectively to the physical addresses in the pbl table. |
2325 |
++ /* Table for keeping the virtual and physical addresses of the |
2326 |
++ * chain pages, respectively to the physical addresses |
2327 |
++ * in the pbl table. |
2328 |
+ */ |
2329 |
+- void **pp_virt_addr_tbl; |
2330 |
++ struct addr_tbl_entry *pp_addr_tbl; |
2331 |
+ |
2332 |
+ union { |
2333 |
+ struct qed_chain_pbl_u16 u16; |
2334 |
+@@ -287,7 +293,7 @@ qed_chain_advance_page(struct qed_chain *p_chain, |
2335 |
+ *(u32 *)page_to_inc = 0; |
2336 |
+ page_index = *(u32 *)page_to_inc; |
2337 |
+ } |
2338 |
+- *p_next_elem = p_chain->pbl.pp_virt_addr_tbl[page_index]; |
2339 |
++ *p_next_elem = p_chain->pbl.pp_addr_tbl[page_index].virt_addr; |
2340 |
+ } |
2341 |
+ } |
2342 |
+ |
2343 |
+@@ -537,7 +543,7 @@ static inline void qed_chain_init_params(struct qed_chain *p_chain, |
2344 |
+ |
2345 |
+ p_chain->pbl_sp.p_phys_table = 0; |
2346 |
+ p_chain->pbl_sp.p_virt_table = NULL; |
2347 |
+- p_chain->pbl.pp_virt_addr_tbl = NULL; |
2348 |
++ p_chain->pbl.pp_addr_tbl = NULL; |
2349 |
+ } |
2350 |
+ |
2351 |
+ /** |
2352 |
+@@ -575,11 +581,11 @@ static inline void qed_chain_init_mem(struct qed_chain *p_chain, |
2353 |
+ static inline void qed_chain_init_pbl_mem(struct qed_chain *p_chain, |
2354 |
+ void *p_virt_pbl, |
2355 |
+ dma_addr_t p_phys_pbl, |
2356 |
+- void **pp_virt_addr_tbl) |
2357 |
++ struct addr_tbl_entry *pp_addr_tbl) |
2358 |
+ { |
2359 |
+ p_chain->pbl_sp.p_phys_table = p_phys_pbl; |
2360 |
+ p_chain->pbl_sp.p_virt_table = p_virt_pbl; |
2361 |
+- p_chain->pbl.pp_virt_addr_tbl = pp_virt_addr_tbl; |
2362 |
++ p_chain->pbl.pp_addr_tbl = pp_addr_tbl; |
2363 |
+ } |
2364 |
+ |
2365 |
+ /** |
2366 |
+@@ -644,7 +650,7 @@ static inline void *qed_chain_get_last_elem(struct qed_chain *p_chain) |
2367 |
+ break; |
2368 |
+ case QED_CHAIN_MODE_PBL: |
2369 |
+ last_page_idx = p_chain->page_cnt - 1; |
2370 |
+- p_virt_addr = p_chain->pbl.pp_virt_addr_tbl[last_page_idx]; |
2371 |
++ p_virt_addr = p_chain->pbl.pp_addr_tbl[last_page_idx].virt_addr; |
2372 |
+ break; |
2373 |
+ } |
2374 |
+ /* p_virt_addr points at this stage to the last page of the chain */ |
2375 |
+@@ -716,7 +722,7 @@ static inline void qed_chain_pbl_zero_mem(struct qed_chain *p_chain) |
2376 |
+ page_cnt = qed_chain_get_page_cnt(p_chain); |
2377 |
+ |
2378 |
+ for (i = 0; i < page_cnt; i++) |
2379 |
+- memset(p_chain->pbl.pp_virt_addr_tbl[i], 0, |
2380 |
++ memset(p_chain->pbl.pp_addr_tbl[i].virt_addr, 0, |
2381 |
+ QED_CHAIN_PAGE_SIZE); |
2382 |
+ } |
2383 |
+ |
2384 |
+diff --git a/include/linux/sunrpc/svc_rdma.h b/include/linux/sunrpc/svc_rdma.h |
2385 |
+index 40f65888dd38..fddad9f5b390 100644 |
2386 |
+--- a/include/linux/sunrpc/svc_rdma.h |
2387 |
++++ b/include/linux/sunrpc/svc_rdma.h |
2388 |
+@@ -162,6 +162,7 @@ extern bool svc_rdma_post_recvs(struct svcxprt_rdma *rdma); |
2389 |
+ extern void svc_rdma_recv_ctxt_put(struct svcxprt_rdma *rdma, |
2390 |
+ struct svc_rdma_recv_ctxt *ctxt); |
2391 |
+ extern void svc_rdma_flush_recv_queues(struct svcxprt_rdma *rdma); |
2392 |
++extern void svc_rdma_release_rqst(struct svc_rqst *rqstp); |
2393 |
+ extern int svc_rdma_recvfrom(struct svc_rqst *); |
2394 |
+ |
2395 |
+ /* svc_rdma_rw.c */ |
2396 |
+diff --git a/include/sound/soc.h b/include/sound/soc.h |
2397 |
+index f264c6509f00..6d2662c3126c 100644 |
2398 |
+--- a/include/sound/soc.h |
2399 |
++++ b/include/sound/soc.h |
2400 |
+@@ -1059,6 +1059,7 @@ struct snd_soc_card { |
2401 |
+ const struct snd_soc_dapm_route *of_dapm_routes; |
2402 |
+ int num_of_dapm_routes; |
2403 |
+ bool fully_routed; |
2404 |
++ bool disable_route_checks; |
2405 |
+ |
2406 |
+ /* lists of probed devices belonging to this card */ |
2407 |
+ struct list_head component_dev_list; |
2408 |
+diff --git a/include/trace/events/iocost.h b/include/trace/events/iocost.h |
2409 |
+index 7ecaa65b7106..c2f580fd371b 100644 |
2410 |
+--- a/include/trace/events/iocost.h |
2411 |
++++ b/include/trace/events/iocost.h |
2412 |
+@@ -130,7 +130,7 @@ DEFINE_EVENT(iocg_inuse_update, iocost_inuse_reset, |
2413 |
+ |
2414 |
+ TRACE_EVENT(iocost_ioc_vrate_adj, |
2415 |
+ |
2416 |
+- TP_PROTO(struct ioc *ioc, u64 new_vrate, u32 (*missed_ppm)[2], |
2417 |
++ TP_PROTO(struct ioc *ioc, u64 new_vrate, u32 *missed_ppm, |
2418 |
+ u32 rq_wait_pct, int nr_lagging, int nr_shortages, |
2419 |
+ int nr_surpluses), |
2420 |
+ |
2421 |
+@@ -155,8 +155,8 @@ TRACE_EVENT(iocost_ioc_vrate_adj, |
2422 |
+ __entry->old_vrate = atomic64_read(&ioc->vtime_rate);; |
2423 |
+ __entry->new_vrate = new_vrate; |
2424 |
+ __entry->busy_level = ioc->busy_level; |
2425 |
+- __entry->read_missed_ppm = (*missed_ppm)[READ]; |
2426 |
+- __entry->write_missed_ppm = (*missed_ppm)[WRITE]; |
2427 |
++ __entry->read_missed_ppm = missed_ppm[READ]; |
2428 |
++ __entry->write_missed_ppm = missed_ppm[WRITE]; |
2429 |
+ __entry->rq_wait_pct = rq_wait_pct; |
2430 |
+ __entry->nr_lagging = nr_lagging; |
2431 |
+ __entry->nr_shortages = nr_shortages; |
2432 |
+diff --git a/include/trace/events/rpcrdma.h b/include/trace/events/rpcrdma.h |
2433 |
+index 7fd11ec1c9a4..2464311b0389 100644 |
2434 |
+--- a/include/trace/events/rpcrdma.h |
2435 |
++++ b/include/trace/events/rpcrdma.h |
2436 |
+@@ -1638,17 +1638,15 @@ DECLARE_EVENT_CLASS(svcrdma_sendcomp_event, |
2437 |
+ |
2438 |
+ TRACE_EVENT(svcrdma_post_send, |
2439 |
+ TP_PROTO( |
2440 |
+- const struct ib_send_wr *wr, |
2441 |
+- int status |
2442 |
++ const struct ib_send_wr *wr |
2443 |
+ ), |
2444 |
+ |
2445 |
+- TP_ARGS(wr, status), |
2446 |
++ TP_ARGS(wr), |
2447 |
+ |
2448 |
+ TP_STRUCT__entry( |
2449 |
+ __field(const void *, cqe) |
2450 |
+ __field(unsigned int, num_sge) |
2451 |
+ __field(u32, inv_rkey) |
2452 |
+- __field(int, status) |
2453 |
+ ), |
2454 |
+ |
2455 |
+ TP_fast_assign( |
2456 |
+@@ -1656,12 +1654,11 @@ TRACE_EVENT(svcrdma_post_send, |
2457 |
+ __entry->num_sge = wr->num_sge; |
2458 |
+ __entry->inv_rkey = (wr->opcode == IB_WR_SEND_WITH_INV) ? |
2459 |
+ wr->ex.invalidate_rkey : 0; |
2460 |
+- __entry->status = status; |
2461 |
+ ), |
2462 |
+ |
2463 |
+- TP_printk("cqe=%p num_sge=%u inv_rkey=0x%08x status=%d", |
2464 |
++ TP_printk("cqe=%p num_sge=%u inv_rkey=0x%08x", |
2465 |
+ __entry->cqe, __entry->num_sge, |
2466 |
+- __entry->inv_rkey, __entry->status |
2467 |
++ __entry->inv_rkey |
2468 |
+ ) |
2469 |
+ ); |
2470 |
+ |
2471 |
+@@ -1726,26 +1723,23 @@ TRACE_EVENT(svcrdma_wc_receive, |
2472 |
+ TRACE_EVENT(svcrdma_post_rw, |
2473 |
+ TP_PROTO( |
2474 |
+ const void *cqe, |
2475 |
+- int sqecount, |
2476 |
+- int status |
2477 |
++ int sqecount |
2478 |
+ ), |
2479 |
+ |
2480 |
+- TP_ARGS(cqe, sqecount, status), |
2481 |
++ TP_ARGS(cqe, sqecount), |
2482 |
+ |
2483 |
+ TP_STRUCT__entry( |
2484 |
+ __field(const void *, cqe) |
2485 |
+ __field(int, sqecount) |
2486 |
+- __field(int, status) |
2487 |
+ ), |
2488 |
+ |
2489 |
+ TP_fast_assign( |
2490 |
+ __entry->cqe = cqe; |
2491 |
+ __entry->sqecount = sqecount; |
2492 |
+- __entry->status = status; |
2493 |
+ ), |
2494 |
+ |
2495 |
+- TP_printk("cqe=%p sqecount=%d status=%d", |
2496 |
+- __entry->cqe, __entry->sqecount, __entry->status |
2497 |
++ TP_printk("cqe=%p sqecount=%d", |
2498 |
++ __entry->cqe, __entry->sqecount |
2499 |
+ ) |
2500 |
+ ); |
2501 |
+ |
2502 |
+@@ -1841,6 +1835,34 @@ DECLARE_EVENT_CLASS(svcrdma_sendqueue_event, |
2503 |
+ DEFINE_SQ_EVENT(full); |
2504 |
+ DEFINE_SQ_EVENT(retry); |
2505 |
+ |
2506 |
++TRACE_EVENT(svcrdma_sq_post_err, |
2507 |
++ TP_PROTO( |
2508 |
++ const struct svcxprt_rdma *rdma, |
2509 |
++ int status |
2510 |
++ ), |
2511 |
++ |
2512 |
++ TP_ARGS(rdma, status), |
2513 |
++ |
2514 |
++ TP_STRUCT__entry( |
2515 |
++ __field(int, avail) |
2516 |
++ __field(int, depth) |
2517 |
++ __field(int, status) |
2518 |
++ __string(addr, rdma->sc_xprt.xpt_remotebuf) |
2519 |
++ ), |
2520 |
++ |
2521 |
++ TP_fast_assign( |
2522 |
++ __entry->avail = atomic_read(&rdma->sc_sq_avail); |
2523 |
++ __entry->depth = rdma->sc_sq_depth; |
2524 |
++ __entry->status = status; |
2525 |
++ __assign_str(addr, rdma->sc_xprt.xpt_remotebuf); |
2526 |
++ ), |
2527 |
++ |
2528 |
++ TP_printk("addr=%s sc_sq_avail=%d/%d status=%d", |
2529 |
++ __get_str(addr), __entry->avail, __entry->depth, |
2530 |
++ __entry->status |
2531 |
++ ) |
2532 |
++); |
2533 |
++ |
2534 |
+ #endif /* _TRACE_RPCRDMA_H */ |
2535 |
+ |
2536 |
+ #include <trace/define_trace.h> |
2537 |
+diff --git a/include/uapi/linux/pkt_sched.h b/include/uapi/linux/pkt_sched.h |
2538 |
+index 5011259b8f67..edbbf4bfdd9e 100644 |
2539 |
+--- a/include/uapi/linux/pkt_sched.h |
2540 |
++++ b/include/uapi/linux/pkt_sched.h |
2541 |
+@@ -1160,8 +1160,8 @@ enum { |
2542 |
+ * [TCA_TAPRIO_ATTR_SCHED_ENTRY_INTERVAL] |
2543 |
+ */ |
2544 |
+ |
2545 |
+-#define TCA_TAPRIO_ATTR_FLAG_TXTIME_ASSIST BIT(0) |
2546 |
+-#define TCA_TAPRIO_ATTR_FLAG_FULL_OFFLOAD BIT(1) |
2547 |
++#define TCA_TAPRIO_ATTR_FLAG_TXTIME_ASSIST _BITUL(0) |
2548 |
++#define TCA_TAPRIO_ATTR_FLAG_FULL_OFFLOAD _BITUL(1) |
2549 |
+ |
2550 |
+ enum { |
2551 |
+ TCA_TAPRIO_ATTR_UNSPEC, |
2552 |
+diff --git a/init/main.c b/init/main.c |
2553 |
+index c0206c507eba..5cbb9fe937e0 100644 |
2554 |
+--- a/init/main.c |
2555 |
++++ b/init/main.c |
2556 |
+@@ -694,7 +694,6 @@ asmlinkage __visible void __init start_kernel(void) |
2557 |
+ boot_init_stack_canary(); |
2558 |
+ |
2559 |
+ time_init(); |
2560 |
+- printk_safe_init(); |
2561 |
+ perf_event_init(); |
2562 |
+ profile_init(); |
2563 |
+ call_function_init(); |
2564 |
+diff --git a/kernel/bpf/cpumap.c b/kernel/bpf/cpumap.c |
2565 |
+index ef49e17ae47c..a367fc850393 100644 |
2566 |
+--- a/kernel/bpf/cpumap.c |
2567 |
++++ b/kernel/bpf/cpumap.c |
2568 |
+@@ -486,7 +486,7 @@ static int cpu_map_update_elem(struct bpf_map *map, void *key, void *value, |
2569 |
+ return -EOVERFLOW; |
2570 |
+ |
2571 |
+ /* Make sure CPU is a valid possible cpu */ |
2572 |
+- if (!cpu_possible(key_cpu)) |
2573 |
++ if (key_cpu >= nr_cpumask_bits || !cpu_possible(key_cpu)) |
2574 |
+ return -ENODEV; |
2575 |
+ |
2576 |
+ if (qsize == 0) { |
2577 |
+diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c |
2578 |
+index e1a65303cfd7..ae27dd77a73c 100644 |
2579 |
+--- a/kernel/bpf/verifier.c |
2580 |
++++ b/kernel/bpf/verifier.c |
2581 |
+@@ -1866,6 +1866,15 @@ static bool register_is_const(struct bpf_reg_state *reg) |
2582 |
+ return reg->type == SCALAR_VALUE && tnum_is_const(reg->var_off); |
2583 |
+ } |
2584 |
+ |
2585 |
++static bool __is_pointer_value(bool allow_ptr_leaks, |
2586 |
++ const struct bpf_reg_state *reg) |
2587 |
++{ |
2588 |
++ if (allow_ptr_leaks) |
2589 |
++ return false; |
2590 |
++ |
2591 |
++ return reg->type != SCALAR_VALUE; |
2592 |
++} |
2593 |
++ |
2594 |
+ static void save_register_state(struct bpf_func_state *state, |
2595 |
+ int spi, struct bpf_reg_state *reg) |
2596 |
+ { |
2597 |
+@@ -2056,6 +2065,16 @@ static int check_stack_read(struct bpf_verifier_env *env, |
2598 |
+ * which resets stack/reg liveness for state transitions |
2599 |
+ */ |
2600 |
+ state->regs[value_regno].live |= REG_LIVE_WRITTEN; |
2601 |
++ } else if (__is_pointer_value(env->allow_ptr_leaks, reg)) { |
2602 |
++ /* If value_regno==-1, the caller is asking us whether |
2603 |
++ * it is acceptable to use this value as a SCALAR_VALUE |
2604 |
++ * (e.g. for XADD). |
2605 |
++ * We must not allow unprivileged callers to do that |
2606 |
++ * with spilled pointers. |
2607 |
++ */ |
2608 |
++ verbose(env, "leaking pointer from stack off %d\n", |
2609 |
++ off); |
2610 |
++ return -EACCES; |
2611 |
+ } |
2612 |
+ mark_reg_read(env, reg, reg->parent, REG_LIVE_READ64); |
2613 |
+ } else { |
2614 |
+@@ -2416,15 +2435,6 @@ static int check_sock_access(struct bpf_verifier_env *env, int insn_idx, |
2615 |
+ return -EACCES; |
2616 |
+ } |
2617 |
+ |
2618 |
+-static bool __is_pointer_value(bool allow_ptr_leaks, |
2619 |
+- const struct bpf_reg_state *reg) |
2620 |
+-{ |
2621 |
+- if (allow_ptr_leaks) |
2622 |
+- return false; |
2623 |
+- |
2624 |
+- return reg->type != SCALAR_VALUE; |
2625 |
+-} |
2626 |
+- |
2627 |
+ static struct bpf_reg_state *reg_state(struct bpf_verifier_env *env, int regno) |
2628 |
+ { |
2629 |
+ return cur_regs(env) + regno; |
2630 |
+diff --git a/kernel/events/core.c b/kernel/events/core.c |
2631 |
+index 72d0cfd73cf1..7382fc95d41e 100644 |
2632 |
+--- a/kernel/events/core.c |
2633 |
++++ b/kernel/events/core.c |
2634 |
+@@ -7052,10 +7052,17 @@ static void perf_event_task_output(struct perf_event *event, |
2635 |
+ goto out; |
2636 |
+ |
2637 |
+ task_event->event_id.pid = perf_event_pid(event, task); |
2638 |
+- task_event->event_id.ppid = perf_event_pid(event, current); |
2639 |
+- |
2640 |
+ task_event->event_id.tid = perf_event_tid(event, task); |
2641 |
+- task_event->event_id.ptid = perf_event_tid(event, current); |
2642 |
++ |
2643 |
++ if (task_event->event_id.header.type == PERF_RECORD_EXIT) { |
2644 |
++ task_event->event_id.ppid = perf_event_pid(event, |
2645 |
++ task->real_parent); |
2646 |
++ task_event->event_id.ptid = perf_event_pid(event, |
2647 |
++ task->real_parent); |
2648 |
++ } else { /* PERF_RECORD_FORK */ |
2649 |
++ task_event->event_id.ppid = perf_event_pid(event, current); |
2650 |
++ task_event->event_id.ptid = perf_event_tid(event, current); |
2651 |
++ } |
2652 |
+ |
2653 |
+ task_event->event_id.time = perf_event_clock(event); |
2654 |
+ |
2655 |
+diff --git a/kernel/printk/internal.h b/kernel/printk/internal.h |
2656 |
+index c8e6ab689d42..b2b0f526f249 100644 |
2657 |
+--- a/kernel/printk/internal.h |
2658 |
++++ b/kernel/printk/internal.h |
2659 |
+@@ -23,6 +23,9 @@ __printf(1, 0) int vprintk_func(const char *fmt, va_list args); |
2660 |
+ void __printk_safe_enter(void); |
2661 |
+ void __printk_safe_exit(void); |
2662 |
+ |
2663 |
++void printk_safe_init(void); |
2664 |
++bool printk_percpu_data_ready(void); |
2665 |
++ |
2666 |
+ #define printk_safe_enter_irqsave(flags) \ |
2667 |
+ do { \ |
2668 |
+ local_irq_save(flags); \ |
2669 |
+@@ -64,4 +67,6 @@ __printf(1, 0) int vprintk_func(const char *fmt, va_list args) { return 0; } |
2670 |
+ #define printk_safe_enter_irq() local_irq_disable() |
2671 |
+ #define printk_safe_exit_irq() local_irq_enable() |
2672 |
+ |
2673 |
++static inline void printk_safe_init(void) { } |
2674 |
++static inline bool printk_percpu_data_ready(void) { return false; } |
2675 |
+ #endif /* CONFIG_PRINTK */ |
2676 |
+diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c |
2677 |
+index c0a5b56aea4e..971197f5d8ee 100644 |
2678 |
+--- a/kernel/printk/printk.c |
2679 |
++++ b/kernel/printk/printk.c |
2680 |
+@@ -460,6 +460,18 @@ static char __log_buf[__LOG_BUF_LEN] __aligned(LOG_ALIGN); |
2681 |
+ static char *log_buf = __log_buf; |
2682 |
+ static u32 log_buf_len = __LOG_BUF_LEN; |
2683 |
+ |
2684 |
++/* |
2685 |
++ * We cannot access per-CPU data (e.g. per-CPU flush irq_work) before |
2686 |
++ * per_cpu_areas are initialised. This variable is set to true when |
2687 |
++ * it's safe to access per-CPU data. |
2688 |
++ */ |
2689 |
++static bool __printk_percpu_data_ready __read_mostly; |
2690 |
++ |
2691 |
++bool printk_percpu_data_ready(void) |
2692 |
++{ |
2693 |
++ return __printk_percpu_data_ready; |
2694 |
++} |
2695 |
++ |
2696 |
+ /* Return log buffer address */ |
2697 |
+ char *log_buf_addr_get(void) |
2698 |
+ { |
2699 |
+@@ -1146,12 +1158,28 @@ static void __init log_buf_add_cpu(void) |
2700 |
+ static inline void log_buf_add_cpu(void) {} |
2701 |
+ #endif /* CONFIG_SMP */ |
2702 |
+ |
2703 |
++static void __init set_percpu_data_ready(void) |
2704 |
++{ |
2705 |
++ printk_safe_init(); |
2706 |
++ /* Make sure we set this flag only after printk_safe() init is done */ |
2707 |
++ barrier(); |
2708 |
++ __printk_percpu_data_ready = true; |
2709 |
++} |
2710 |
++ |
2711 |
+ void __init setup_log_buf(int early) |
2712 |
+ { |
2713 |
+ unsigned long flags; |
2714 |
+ char *new_log_buf; |
2715 |
+ unsigned int free; |
2716 |
+ |
2717 |
++ /* |
2718 |
++ * Some archs call setup_log_buf() multiple times - first is very |
2719 |
++ * early, e.g. from setup_arch(), and second - when percpu_areas |
2720 |
++ * are initialised. |
2721 |
++ */ |
2722 |
++ if (!early) |
2723 |
++ set_percpu_data_ready(); |
2724 |
++ |
2725 |
+ if (log_buf != __log_buf) |
2726 |
+ return; |
2727 |
+ |
2728 |
+@@ -2966,6 +2994,9 @@ static DEFINE_PER_CPU(struct irq_work, wake_up_klogd_work) = { |
2729 |
+ |
2730 |
+ void wake_up_klogd(void) |
2731 |
+ { |
2732 |
++ if (!printk_percpu_data_ready()) |
2733 |
++ return; |
2734 |
++ |
2735 |
+ preempt_disable(); |
2736 |
+ if (waitqueue_active(&log_wait)) { |
2737 |
+ this_cpu_or(printk_pending, PRINTK_PENDING_WAKEUP); |
2738 |
+@@ -2976,6 +3007,9 @@ void wake_up_klogd(void) |
2739 |
+ |
2740 |
+ void defer_console_output(void) |
2741 |
+ { |
2742 |
++ if (!printk_percpu_data_ready()) |
2743 |
++ return; |
2744 |
++ |
2745 |
+ preempt_disable(); |
2746 |
+ __this_cpu_or(printk_pending, PRINTK_PENDING_OUTPUT); |
2747 |
+ irq_work_queue(this_cpu_ptr(&wake_up_klogd_work)); |
2748 |
+diff --git a/kernel/printk/printk_safe.c b/kernel/printk/printk_safe.c |
2749 |
+index b4045e782743..d9a659a686f3 100644 |
2750 |
+--- a/kernel/printk/printk_safe.c |
2751 |
++++ b/kernel/printk/printk_safe.c |
2752 |
+@@ -27,7 +27,6 @@ |
2753 |
+ * There are situations when we want to make sure that all buffers |
2754 |
+ * were handled or when IRQs are blocked. |
2755 |
+ */ |
2756 |
+-static int printk_safe_irq_ready __read_mostly; |
2757 |
+ |
2758 |
+ #define SAFE_LOG_BUF_LEN ((1 << CONFIG_PRINTK_SAFE_LOG_BUF_SHIFT) - \ |
2759 |
+ sizeof(atomic_t) - \ |
2760 |
+@@ -51,7 +50,7 @@ static DEFINE_PER_CPU(struct printk_safe_seq_buf, nmi_print_seq); |
2761 |
+ /* Get flushed in a more safe context. */ |
2762 |
+ static void queue_flush_work(struct printk_safe_seq_buf *s) |
2763 |
+ { |
2764 |
+- if (printk_safe_irq_ready) |
2765 |
++ if (printk_percpu_data_ready()) |
2766 |
+ irq_work_queue(&s->work); |
2767 |
+ } |
2768 |
+ |
2769 |
+@@ -402,14 +401,6 @@ void __init printk_safe_init(void) |
2770 |
+ #endif |
2771 |
+ } |
2772 |
+ |
2773 |
+- /* |
2774 |
+- * In the highly unlikely event that a NMI were to trigger at |
2775 |
+- * this moment. Make sure IRQ work is set up before this |
2776 |
+- * variable is set. |
2777 |
+- */ |
2778 |
+- barrier(); |
2779 |
+- printk_safe_irq_ready = 1; |
2780 |
+- |
2781 |
+ /* Flush pending messages that did not have scheduled IRQ works. */ |
2782 |
+ printk_safe_flush(); |
2783 |
+ } |
2784 |
+diff --git a/kernel/sched/core.c b/kernel/sched/core.c |
2785 |
+index 195d0019e6bb..e99d326fa569 100644 |
2786 |
+--- a/kernel/sched/core.c |
2787 |
++++ b/kernel/sched/core.c |
2788 |
+@@ -1233,13 +1233,8 @@ static void uclamp_fork(struct task_struct *p) |
2789 |
+ return; |
2790 |
+ |
2791 |
+ for_each_clamp_id(clamp_id) { |
2792 |
+- unsigned int clamp_value = uclamp_none(clamp_id); |
2793 |
+- |
2794 |
+- /* By default, RT tasks always get 100% boost */ |
2795 |
+- if (unlikely(rt_task(p) && clamp_id == UCLAMP_MIN)) |
2796 |
+- clamp_value = uclamp_none(UCLAMP_MAX); |
2797 |
+- |
2798 |
+- uclamp_se_set(&p->uclamp_req[clamp_id], clamp_value, false); |
2799 |
++ uclamp_se_set(&p->uclamp_req[clamp_id], |
2800 |
++ uclamp_none(clamp_id), false); |
2801 |
+ } |
2802 |
+ } |
2803 |
+ |
2804 |
+diff --git a/kernel/signal.c b/kernel/signal.c |
2805 |
+index 2b9295f2d244..595a36ab87d0 100644 |
2806 |
+--- a/kernel/signal.c |
2807 |
++++ b/kernel/signal.c |
2808 |
+@@ -1510,15 +1510,15 @@ int kill_pid_usb_asyncio(int sig, int errno, sigval_t addr, |
2809 |
+ unsigned long flags; |
2810 |
+ int ret = -EINVAL; |
2811 |
+ |
2812 |
++ if (!valid_signal(sig)) |
2813 |
++ return ret; |
2814 |
++ |
2815 |
+ clear_siginfo(&info); |
2816 |
+ info.si_signo = sig; |
2817 |
+ info.si_errno = errno; |
2818 |
+ info.si_code = SI_ASYNCIO; |
2819 |
+ *((sigval_t *)&info.si_pid) = addr; |
2820 |
+ |
2821 |
+- if (!valid_signal(sig)) |
2822 |
+- return ret; |
2823 |
+- |
2824 |
+ rcu_read_lock(); |
2825 |
+ p = pid_task(pid, PIDTYPE_PID); |
2826 |
+ if (!p) { |
2827 |
+diff --git a/mm/shmem.c b/mm/shmem.c |
2828 |
+index 312e31196720..e71b15da1985 100644 |
2829 |
+--- a/mm/shmem.c |
2830 |
++++ b/mm/shmem.c |
2831 |
+@@ -2403,11 +2403,11 @@ static int shmem_mfill_atomic_pte(struct mm_struct *dst_mm, |
2832 |
+ |
2833 |
+ lru_cache_add_anon(page); |
2834 |
+ |
2835 |
+- spin_lock(&info->lock); |
2836 |
++ spin_lock_irq(&info->lock); |
2837 |
+ info->alloced++; |
2838 |
+ inode->i_blocks += BLOCKS_PER_PAGE; |
2839 |
+ shmem_recalc_inode(inode); |
2840 |
+- spin_unlock(&info->lock); |
2841 |
++ spin_unlock_irq(&info->lock); |
2842 |
+ |
2843 |
+ inc_mm_counter(dst_mm, mm_counter_file(page)); |
2844 |
+ page_add_file_rmap(page, false); |
2845 |
+diff --git a/net/core/datagram.c b/net/core/datagram.c |
2846 |
+index da3c24ed129c..189ad4c73a3f 100644 |
2847 |
+--- a/net/core/datagram.c |
2848 |
++++ b/net/core/datagram.c |
2849 |
+@@ -51,6 +51,7 @@ |
2850 |
+ #include <linux/slab.h> |
2851 |
+ #include <linux/pagemap.h> |
2852 |
+ #include <linux/uio.h> |
2853 |
++#include <linux/indirect_call_wrapper.h> |
2854 |
+ |
2855 |
+ #include <net/protocol.h> |
2856 |
+ #include <linux/skbuff.h> |
2857 |
+@@ -407,6 +408,11 @@ int skb_kill_datagram(struct sock *sk, struct sk_buff *skb, unsigned int flags) |
2858 |
+ } |
2859 |
+ EXPORT_SYMBOL(skb_kill_datagram); |
2860 |
+ |
2861 |
++INDIRECT_CALLABLE_DECLARE(static size_t simple_copy_to_iter(const void *addr, |
2862 |
++ size_t bytes, |
2863 |
++ void *data __always_unused, |
2864 |
++ struct iov_iter *i)); |
2865 |
++ |
2866 |
+ static int __skb_datagram_iter(const struct sk_buff *skb, int offset, |
2867 |
+ struct iov_iter *to, int len, bool fault_short, |
2868 |
+ size_t (*cb)(const void *, size_t, void *, |
2869 |
+@@ -420,7 +426,8 @@ static int __skb_datagram_iter(const struct sk_buff *skb, int offset, |
2870 |
+ if (copy > 0) { |
2871 |
+ if (copy > len) |
2872 |
+ copy = len; |
2873 |
+- n = cb(skb->data + offset, copy, data, to); |
2874 |
++ n = INDIRECT_CALL_1(cb, simple_copy_to_iter, |
2875 |
++ skb->data + offset, copy, data, to); |
2876 |
+ offset += n; |
2877 |
+ if (n != copy) |
2878 |
+ goto short_copy; |
2879 |
+@@ -442,8 +449,9 @@ static int __skb_datagram_iter(const struct sk_buff *skb, int offset, |
2880 |
+ |
2881 |
+ if (copy > len) |
2882 |
+ copy = len; |
2883 |
+- n = cb(vaddr + skb_frag_off(frag) + offset - start, |
2884 |
+- copy, data, to); |
2885 |
++ n = INDIRECT_CALL_1(cb, simple_copy_to_iter, |
2886 |
++ vaddr + skb_frag_off(frag) + offset - start, |
2887 |
++ copy, data, to); |
2888 |
+ kunmap(page); |
2889 |
+ offset += n; |
2890 |
+ if (n != copy) |
2891 |
+diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c |
2892 |
+index d09b3c789314..36978a0e5000 100644 |
2893 |
+--- a/net/mac80211/mesh.c |
2894 |
++++ b/net/mac80211/mesh.c |
2895 |
+@@ -1257,15 +1257,15 @@ static void ieee80211_mesh_rx_bcn_presp(struct ieee80211_sub_if_data *sdata, |
2896 |
+ sdata->u.mesh.mshcfg.rssi_threshold < rx_status->signal) |
2897 |
+ mesh_neighbour_update(sdata, mgmt->sa, &elems, |
2898 |
+ rx_status); |
2899 |
++ |
2900 |
++ if (ifmsh->csa_role != IEEE80211_MESH_CSA_ROLE_INIT && |
2901 |
++ !sdata->vif.csa_active) |
2902 |
++ ieee80211_mesh_process_chnswitch(sdata, &elems, true); |
2903 |
+ } |
2904 |
+ |
2905 |
+ if (ifmsh->sync_ops) |
2906 |
+ ifmsh->sync_ops->rx_bcn_presp(sdata, |
2907 |
+ stype, mgmt, &elems, rx_status); |
2908 |
+- |
2909 |
+- if (ifmsh->csa_role != IEEE80211_MESH_CSA_ROLE_INIT && |
2910 |
+- !sdata->vif.csa_active) |
2911 |
+- ieee80211_mesh_process_chnswitch(sdata, &elems, true); |
2912 |
+ } |
2913 |
+ |
2914 |
+ int ieee80211_mesh_finish_csa(struct ieee80211_sub_if_data *sdata) |
2915 |
+@@ -1373,6 +1373,9 @@ static void mesh_rx_csa_frame(struct ieee80211_sub_if_data *sdata, |
2916 |
+ ieee802_11_parse_elems(pos, len - baselen, true, &elems, |
2917 |
+ mgmt->bssid, NULL); |
2918 |
+ |
2919 |
++ if (!mesh_matches_local(sdata, &elems)) |
2920 |
++ return; |
2921 |
++ |
2922 |
+ ifmsh->chsw_ttl = elems.mesh_chansw_params_ie->mesh_ttl; |
2923 |
+ if (!--ifmsh->chsw_ttl) |
2924 |
+ fwd_csa = false; |
2925 |
+diff --git a/net/netfilter/nf_nat_proto.c b/net/netfilter/nf_nat_proto.c |
2926 |
+index 64eedc17037a..3d816a1e5442 100644 |
2927 |
+--- a/net/netfilter/nf_nat_proto.c |
2928 |
++++ b/net/netfilter/nf_nat_proto.c |
2929 |
+@@ -1035,8 +1035,8 @@ int nf_nat_inet_register_fn(struct net *net, const struct nf_hook_ops *ops) |
2930 |
+ ret = nf_nat_register_fn(net, NFPROTO_IPV4, ops, nf_nat_ipv4_ops, |
2931 |
+ ARRAY_SIZE(nf_nat_ipv4_ops)); |
2932 |
+ if (ret) |
2933 |
+- nf_nat_ipv6_unregister_fn(net, ops); |
2934 |
+- |
2935 |
++ nf_nat_unregister_fn(net, NFPROTO_IPV6, ops, |
2936 |
++ ARRAY_SIZE(nf_nat_ipv6_ops)); |
2937 |
+ return ret; |
2938 |
+ } |
2939 |
+ EXPORT_SYMBOL_GPL(nf_nat_inet_register_fn); |
2940 |
+diff --git a/net/rxrpc/local_object.c b/net/rxrpc/local_object.c |
2941 |
+index a6c1349e965d..01135e54d95d 100644 |
2942 |
+--- a/net/rxrpc/local_object.c |
2943 |
++++ b/net/rxrpc/local_object.c |
2944 |
+@@ -165,15 +165,6 @@ static int rxrpc_open_socket(struct rxrpc_local *local, struct net *net) |
2945 |
+ goto error; |
2946 |
+ } |
2947 |
+ |
2948 |
+- /* we want to set the don't fragment bit */ |
2949 |
+- opt = IPV6_PMTUDISC_DO; |
2950 |
+- ret = kernel_setsockopt(local->socket, SOL_IPV6, IPV6_MTU_DISCOVER, |
2951 |
+- (char *) &opt, sizeof(opt)); |
2952 |
+- if (ret < 0) { |
2953 |
+- _debug("setsockopt failed"); |
2954 |
+- goto error; |
2955 |
+- } |
2956 |
+- |
2957 |
+ /* Fall through and set IPv4 options too otherwise we don't get |
2958 |
+ * errors from IPv4 packets sent through the IPv6 socket. |
2959 |
+ */ |
2960 |
+diff --git a/net/rxrpc/output.c b/net/rxrpc/output.c |
2961 |
+index bad3d2420344..90e263c6aa69 100644 |
2962 |
+--- a/net/rxrpc/output.c |
2963 |
++++ b/net/rxrpc/output.c |
2964 |
+@@ -474,41 +474,21 @@ send_fragmentable: |
2965 |
+ skb->tstamp = ktime_get_real(); |
2966 |
+ |
2967 |
+ switch (conn->params.local->srx.transport.family) { |
2968 |
++ case AF_INET6: |
2969 |
+ case AF_INET: |
2970 |
+ opt = IP_PMTUDISC_DONT; |
2971 |
+- ret = kernel_setsockopt(conn->params.local->socket, |
2972 |
+- SOL_IP, IP_MTU_DISCOVER, |
2973 |
+- (char *)&opt, sizeof(opt)); |
2974 |
+- if (ret == 0) { |
2975 |
+- ret = kernel_sendmsg(conn->params.local->socket, &msg, |
2976 |
+- iov, 2, len); |
2977 |
+- conn->params.peer->last_tx_at = ktime_get_seconds(); |
2978 |
+- |
2979 |
+- opt = IP_PMTUDISC_DO; |
2980 |
+- kernel_setsockopt(conn->params.local->socket, SOL_IP, |
2981 |
+- IP_MTU_DISCOVER, |
2982 |
+- (char *)&opt, sizeof(opt)); |
2983 |
+- } |
2984 |
+- break; |
2985 |
+- |
2986 |
+-#ifdef CONFIG_AF_RXRPC_IPV6 |
2987 |
+- case AF_INET6: |
2988 |
+- opt = IPV6_PMTUDISC_DONT; |
2989 |
+- ret = kernel_setsockopt(conn->params.local->socket, |
2990 |
+- SOL_IPV6, IPV6_MTU_DISCOVER, |
2991 |
+- (char *)&opt, sizeof(opt)); |
2992 |
+- if (ret == 0) { |
2993 |
+- ret = kernel_sendmsg(conn->params.local->socket, &msg, |
2994 |
+- iov, 2, len); |
2995 |
+- conn->params.peer->last_tx_at = ktime_get_seconds(); |
2996 |
+- |
2997 |
+- opt = IPV6_PMTUDISC_DO; |
2998 |
+- kernel_setsockopt(conn->params.local->socket, |
2999 |
+- SOL_IPV6, IPV6_MTU_DISCOVER, |
3000 |
+- (char *)&opt, sizeof(opt)); |
3001 |
+- } |
3002 |
++ kernel_setsockopt(conn->params.local->socket, |
3003 |
++ SOL_IP, IP_MTU_DISCOVER, |
3004 |
++ (char *)&opt, sizeof(opt)); |
3005 |
++ ret = kernel_sendmsg(conn->params.local->socket, &msg, |
3006 |
++ iov, 2, len); |
3007 |
++ conn->params.peer->last_tx_at = ktime_get_seconds(); |
3008 |
++ |
3009 |
++ opt = IP_PMTUDISC_DO; |
3010 |
++ kernel_setsockopt(conn->params.local->socket, |
3011 |
++ SOL_IP, IP_MTU_DISCOVER, |
3012 |
++ (char *)&opt, sizeof(opt)); |
3013 |
+ break; |
3014 |
+-#endif |
3015 |
+ |
3016 |
+ default: |
3017 |
+ BUG(); |
3018 |
+diff --git a/net/sunrpc/svc_xprt.c b/net/sunrpc/svc_xprt.c |
3019 |
+index 298557744818..dc74519286be 100644 |
3020 |
+--- a/net/sunrpc/svc_xprt.c |
3021 |
++++ b/net/sunrpc/svc_xprt.c |
3022 |
+@@ -897,9 +897,6 @@ int svc_send(struct svc_rqst *rqstp) |
3023 |
+ if (!xprt) |
3024 |
+ goto out; |
3025 |
+ |
3026 |
+- /* release the receive skb before sending the reply */ |
3027 |
+- xprt->xpt_ops->xpo_release_rqst(rqstp); |
3028 |
+- |
3029 |
+ /* calculate over-all length */ |
3030 |
+ xb = &rqstp->rq_res; |
3031 |
+ xb->len = xb->head[0].iov_len + |
3032 |
+diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c |
3033 |
+index 2934dd711715..4260924ad9db 100644 |
3034 |
+--- a/net/sunrpc/svcsock.c |
3035 |
++++ b/net/sunrpc/svcsock.c |
3036 |
+@@ -605,6 +605,8 @@ svc_udp_sendto(struct svc_rqst *rqstp) |
3037 |
+ { |
3038 |
+ int error; |
3039 |
+ |
3040 |
++ svc_release_udp_skb(rqstp); |
3041 |
++ |
3042 |
+ error = svc_sendto(rqstp, &rqstp->rq_res); |
3043 |
+ if (error == -ECONNREFUSED) |
3044 |
+ /* ICMP error on earlier request. */ |
3045 |
+@@ -1137,6 +1139,8 @@ static int svc_tcp_sendto(struct svc_rqst *rqstp) |
3046 |
+ int sent; |
3047 |
+ __be32 reclen; |
3048 |
+ |
3049 |
++ svc_release_skb(rqstp); |
3050 |
++ |
3051 |
+ /* Set up the first element of the reply kvec. |
3052 |
+ * Any other kvecs that may be in use have been taken |
3053 |
+ * care of by the server implementation itself. |
3054 |
+diff --git a/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c b/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c |
3055 |
+index 96bccd398469..b8ee91ffedda 100644 |
3056 |
+--- a/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c |
3057 |
++++ b/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c |
3058 |
+@@ -222,6 +222,26 @@ void svc_rdma_recv_ctxt_put(struct svcxprt_rdma *rdma, |
3059 |
+ svc_rdma_recv_ctxt_destroy(rdma, ctxt); |
3060 |
+ } |
3061 |
+ |
3062 |
++/** |
3063 |
++ * svc_rdma_release_rqst - Release transport-specific per-rqst resources |
3064 |
++ * @rqstp: svc_rqst being released |
3065 |
++ * |
3066 |
++ * Ensure that the recv_ctxt is released whether or not a Reply |
3067 |
++ * was sent. For example, the client could close the connection, |
3068 |
++ * or svc_process could drop an RPC, before the Reply is sent. |
3069 |
++ */ |
3070 |
++void svc_rdma_release_rqst(struct svc_rqst *rqstp) |
3071 |
++{ |
3072 |
++ struct svc_rdma_recv_ctxt *ctxt = rqstp->rq_xprt_ctxt; |
3073 |
++ struct svc_xprt *xprt = rqstp->rq_xprt; |
3074 |
++ struct svcxprt_rdma *rdma = |
3075 |
++ container_of(xprt, struct svcxprt_rdma, sc_xprt); |
3076 |
++ |
3077 |
++ rqstp->rq_xprt_ctxt = NULL; |
3078 |
++ if (ctxt) |
3079 |
++ svc_rdma_recv_ctxt_put(rdma, ctxt); |
3080 |
++} |
3081 |
++ |
3082 |
+ static int __svc_rdma_post_recv(struct svcxprt_rdma *rdma, |
3083 |
+ struct svc_rdma_recv_ctxt *ctxt) |
3084 |
+ { |
3085 |
+@@ -756,6 +776,8 @@ int svc_rdma_recvfrom(struct svc_rqst *rqstp) |
3086 |
+ __be32 *p; |
3087 |
+ int ret; |
3088 |
+ |
3089 |
++ rqstp->rq_xprt_ctxt = NULL; |
3090 |
++ |
3091 |
+ spin_lock(&rdma_xprt->sc_rq_dto_lock); |
3092 |
+ ctxt = svc_rdma_next_recv_ctxt(&rdma_xprt->sc_read_complete_q); |
3093 |
+ if (ctxt) { |
3094 |
+diff --git a/net/sunrpc/xprtrdma/svc_rdma_rw.c b/net/sunrpc/xprtrdma/svc_rdma_rw.c |
3095 |
+index 48fe3b16b0d9..a59912e2666d 100644 |
3096 |
+--- a/net/sunrpc/xprtrdma/svc_rdma_rw.c |
3097 |
++++ b/net/sunrpc/xprtrdma/svc_rdma_rw.c |
3098 |
+@@ -323,8 +323,6 @@ static int svc_rdma_post_chunk_ctxt(struct svc_rdma_chunk_ctxt *cc) |
3099 |
+ if (atomic_sub_return(cc->cc_sqecount, |
3100 |
+ &rdma->sc_sq_avail) > 0) { |
3101 |
+ ret = ib_post_send(rdma->sc_qp, first_wr, &bad_wr); |
3102 |
+- trace_svcrdma_post_rw(&cc->cc_cqe, |
3103 |
+- cc->cc_sqecount, ret); |
3104 |
+ if (ret) |
3105 |
+ break; |
3106 |
+ return 0; |
3107 |
+@@ -337,6 +335,7 @@ static int svc_rdma_post_chunk_ctxt(struct svc_rdma_chunk_ctxt *cc) |
3108 |
+ trace_svcrdma_sq_retry(rdma); |
3109 |
+ } while (1); |
3110 |
+ |
3111 |
++ trace_svcrdma_sq_post_err(rdma, ret); |
3112 |
+ set_bit(XPT_CLOSE, &xprt->xpt_flags); |
3113 |
+ |
3114 |
+ /* If even one was posted, there will be a completion. */ |
3115 |
+diff --git a/net/sunrpc/xprtrdma/svc_rdma_sendto.c b/net/sunrpc/xprtrdma/svc_rdma_sendto.c |
3116 |
+index 6fdba72f89f4..93ff7967389a 100644 |
3117 |
+--- a/net/sunrpc/xprtrdma/svc_rdma_sendto.c |
3118 |
++++ b/net/sunrpc/xprtrdma/svc_rdma_sendto.c |
3119 |
+@@ -306,15 +306,17 @@ int svc_rdma_send(struct svcxprt_rdma *rdma, struct ib_send_wr *wr) |
3120 |
+ } |
3121 |
+ |
3122 |
+ svc_xprt_get(&rdma->sc_xprt); |
3123 |
++ trace_svcrdma_post_send(wr); |
3124 |
+ ret = ib_post_send(rdma->sc_qp, wr, NULL); |
3125 |
+- trace_svcrdma_post_send(wr, ret); |
3126 |
+- if (ret) { |
3127 |
+- set_bit(XPT_CLOSE, &rdma->sc_xprt.xpt_flags); |
3128 |
+- svc_xprt_put(&rdma->sc_xprt); |
3129 |
+- wake_up(&rdma->sc_send_wait); |
3130 |
+- } |
3131 |
+- break; |
3132 |
++ if (ret) |
3133 |
++ break; |
3134 |
++ return 0; |
3135 |
+ } |
3136 |
++ |
3137 |
++ trace_svcrdma_sq_post_err(rdma, ret); |
3138 |
++ set_bit(XPT_CLOSE, &rdma->sc_xprt.xpt_flags); |
3139 |
++ svc_xprt_put(&rdma->sc_xprt); |
3140 |
++ wake_up(&rdma->sc_send_wait); |
3141 |
+ return ret; |
3142 |
+ } |
3143 |
+ |
3144 |
+@@ -871,12 +873,7 @@ int svc_rdma_sendto(struct svc_rqst *rqstp) |
3145 |
+ wr_lst, rp_ch); |
3146 |
+ if (ret < 0) |
3147 |
+ goto err1; |
3148 |
+- ret = 0; |
3149 |
+- |
3150 |
+-out: |
3151 |
+- rqstp->rq_xprt_ctxt = NULL; |
3152 |
+- svc_rdma_recv_ctxt_put(rdma, rctxt); |
3153 |
+- return ret; |
3154 |
++ return 0; |
3155 |
+ |
3156 |
+ err2: |
3157 |
+ if (ret != -E2BIG && ret != -EINVAL) |
3158 |
+@@ -885,14 +882,12 @@ out: |
3159 |
+ ret = svc_rdma_send_error_msg(rdma, sctxt, rqstp); |
3160 |
+ if (ret < 0) |
3161 |
+ goto err1; |
3162 |
+- ret = 0; |
3163 |
+- goto out; |
3164 |
++ return 0; |
3165 |
+ |
3166 |
+ err1: |
3167 |
+ svc_rdma_send_ctxt_put(rdma, sctxt); |
3168 |
+ err0: |
3169 |
+ trace_svcrdma_send_failed(rqstp, ret); |
3170 |
+ set_bit(XPT_CLOSE, &xprt->xpt_flags); |
3171 |
+- ret = -ENOTCONN; |
3172 |
+- goto out; |
3173 |
++ return -ENOTCONN; |
3174 |
+ } |
3175 |
+diff --git a/net/sunrpc/xprtrdma/svc_rdma_transport.c b/net/sunrpc/xprtrdma/svc_rdma_transport.c |
3176 |
+index 145a3615c319..889220f11a70 100644 |
3177 |
+--- a/net/sunrpc/xprtrdma/svc_rdma_transport.c |
3178 |
++++ b/net/sunrpc/xprtrdma/svc_rdma_transport.c |
3179 |
+@@ -71,7 +71,6 @@ static struct svc_xprt *svc_rdma_create(struct svc_serv *serv, |
3180 |
+ struct sockaddr *sa, int salen, |
3181 |
+ int flags); |
3182 |
+ static struct svc_xprt *svc_rdma_accept(struct svc_xprt *xprt); |
3183 |
+-static void svc_rdma_release_rqst(struct svc_rqst *); |
3184 |
+ static void svc_rdma_detach(struct svc_xprt *xprt); |
3185 |
+ static void svc_rdma_free(struct svc_xprt *xprt); |
3186 |
+ static int svc_rdma_has_wspace(struct svc_xprt *xprt); |
3187 |
+@@ -558,10 +557,6 @@ static struct svc_xprt *svc_rdma_accept(struct svc_xprt *xprt) |
3188 |
+ return NULL; |
3189 |
+ } |
3190 |
+ |
3191 |
+-static void svc_rdma_release_rqst(struct svc_rqst *rqstp) |
3192 |
+-{ |
3193 |
+-} |
3194 |
+- |
3195 |
+ /* |
3196 |
+ * When connected, an svc_xprt has at least two references: |
3197 |
+ * |
3198 |
+diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib |
3199 |
+index a66fc0acad1e..342618a2bccb 100644 |
3200 |
+--- a/scripts/Makefile.lib |
3201 |
++++ b/scripts/Makefile.lib |
3202 |
+@@ -297,7 +297,7 @@ define rule_dtc |
3203 |
+ endef |
3204 |
+ |
3205 |
+ $(obj)/%.dt.yaml: $(src)/%.dts $(DTC) $(DT_TMP_SCHEMA) FORCE |
3206 |
+- $(call if_changed_rule,dtc) |
3207 |
++ $(call if_changed_rule,dtc,yaml) |
3208 |
+ |
3209 |
+ dtc-tmp = $(subst $(comma),_,$(dot-target).dts.tmp) |
3210 |
+ |
3211 |
+diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c |
3212 |
+index dd77b9ffe5fd..1673479b4eef 100644 |
3213 |
+--- a/sound/pci/hda/hda_intel.c |
3214 |
++++ b/sound/pci/hda/hda_intel.c |
3215 |
+@@ -1200,10 +1200,8 @@ static void azx_vs_set_state(struct pci_dev *pci, |
3216 |
+ if (!disabled) { |
3217 |
+ dev_info(chip->card->dev, |
3218 |
+ "Start delayed initialization\n"); |
3219 |
+- if (azx_probe_continue(chip) < 0) { |
3220 |
++ if (azx_probe_continue(chip) < 0) |
3221 |
+ dev_err(chip->card->dev, "initialization error\n"); |
3222 |
+- hda->init_failed = true; |
3223 |
+- } |
3224 |
+ } |
3225 |
+ } else { |
3226 |
+ dev_info(chip->card->dev, "%s via vga_switcheroo\n", |
3227 |
+@@ -1336,12 +1334,15 @@ static int register_vga_switcheroo(struct azx *chip) |
3228 |
+ /* |
3229 |
+ * destructor |
3230 |
+ */ |
3231 |
+-static int azx_free(struct azx *chip) |
3232 |
++static void azx_free(struct azx *chip) |
3233 |
+ { |
3234 |
+ struct pci_dev *pci = chip->pci; |
3235 |
+ struct hda_intel *hda = container_of(chip, struct hda_intel, chip); |
3236 |
+ struct hdac_bus *bus = azx_bus(chip); |
3237 |
+ |
3238 |
++ if (hda->freed) |
3239 |
++ return; |
3240 |
++ |
3241 |
+ if (azx_has_pm_runtime(chip) && chip->running) |
3242 |
+ pm_runtime_get_noresume(&pci->dev); |
3243 |
+ chip->running = 0; |
3244 |
+@@ -1385,9 +1386,8 @@ static int azx_free(struct azx *chip) |
3245 |
+ |
3246 |
+ if (chip->driver_caps & AZX_DCAPS_I915_COMPONENT) |
3247 |
+ snd_hdac_i915_exit(bus); |
3248 |
+- kfree(hda); |
3249 |
+ |
3250 |
+- return 0; |
3251 |
++ hda->freed = 1; |
3252 |
+ } |
3253 |
+ |
3254 |
+ static int azx_dev_disconnect(struct snd_device *device) |
3255 |
+@@ -1403,7 +1403,8 @@ static int azx_dev_disconnect(struct snd_device *device) |
3256 |
+ |
3257 |
+ static int azx_dev_free(struct snd_device *device) |
3258 |
+ { |
3259 |
+- return azx_free(device->device_data); |
3260 |
++ azx_free(device->device_data); |
3261 |
++ return 0; |
3262 |
+ } |
3263 |
+ |
3264 |
+ #ifdef SUPPORT_VGA_SWITCHEROO |
3265 |
+@@ -1717,7 +1718,7 @@ static int azx_create(struct snd_card *card, struct pci_dev *pci, |
3266 |
+ if (err < 0) |
3267 |
+ return err; |
3268 |
+ |
3269 |
+- hda = kzalloc(sizeof(*hda), GFP_KERNEL); |
3270 |
++ hda = devm_kzalloc(&pci->dev, sizeof(*hda), GFP_KERNEL); |
3271 |
+ if (!hda) { |
3272 |
+ pci_disable_device(pci); |
3273 |
+ return -ENOMEM; |
3274 |
+@@ -1758,7 +1759,6 @@ static int azx_create(struct snd_card *card, struct pci_dev *pci, |
3275 |
+ |
3276 |
+ err = azx_bus_init(chip, model[dev]); |
3277 |
+ if (err < 0) { |
3278 |
+- kfree(hda); |
3279 |
+ pci_disable_device(pci); |
3280 |
+ return err; |
3281 |
+ } |
3282 |
+@@ -1958,7 +1958,7 @@ static int azx_first_init(struct azx *chip) |
3283 |
+ /* codec detection */ |
3284 |
+ if (!azx_bus(chip)->codec_mask) { |
3285 |
+ dev_err(card->dev, "no codecs found!\n"); |
3286 |
+- return -ENODEV; |
3287 |
++ /* keep running the rest for the runtime PM */ |
3288 |
+ } |
3289 |
+ |
3290 |
+ if (azx_acquire_irq(chip, 0) < 0) |
3291 |
+@@ -2268,9 +2268,11 @@ static int azx_probe_continue(struct azx *chip) |
3292 |
+ #endif |
3293 |
+ |
3294 |
+ /* create codec instances */ |
3295 |
+- err = azx_probe_codecs(chip, azx_max_codecs[chip->driver_type]); |
3296 |
+- if (err < 0) |
3297 |
+- goto out_free; |
3298 |
++ if (bus->codec_mask) { |
3299 |
++ err = azx_probe_codecs(chip, azx_max_codecs[chip->driver_type]); |
3300 |
++ if (err < 0) |
3301 |
++ goto out_free; |
3302 |
++ } |
3303 |
+ |
3304 |
+ #ifdef CONFIG_SND_HDA_PATCH_LOADER |
3305 |
+ if (chip->fw) { |
3306 |
+@@ -2284,7 +2286,7 @@ static int azx_probe_continue(struct azx *chip) |
3307 |
+ #endif |
3308 |
+ } |
3309 |
+ #endif |
3310 |
+- if ((probe_only[dev] & 1) == 0) { |
3311 |
++ if (bus->codec_mask && !(probe_only[dev] & 1)) { |
3312 |
+ err = azx_codec_configure(chip); |
3313 |
+ if (err < 0) |
3314 |
+ goto out_free; |
3315 |
+@@ -2301,17 +2303,23 @@ static int azx_probe_continue(struct azx *chip) |
3316 |
+ |
3317 |
+ set_default_power_save(chip); |
3318 |
+ |
3319 |
+- if (azx_has_pm_runtime(chip)) |
3320 |
++ if (azx_has_pm_runtime(chip)) { |
3321 |
++ pm_runtime_use_autosuspend(&pci->dev); |
3322 |
++ pm_runtime_allow(&pci->dev); |
3323 |
+ pm_runtime_put_autosuspend(&pci->dev); |
3324 |
++ } |
3325 |
+ |
3326 |
+ out_free: |
3327 |
+- if (err < 0 || !hda->need_i915_power) |
3328 |
++ if (err < 0) { |
3329 |
++ azx_free(chip); |
3330 |
++ return err; |
3331 |
++ } |
3332 |
++ |
3333 |
++ if (!hda->need_i915_power) |
3334 |
+ display_power(chip, false); |
3335 |
+- if (err < 0) |
3336 |
+- hda->init_failed = 1; |
3337 |
+ complete_all(&hda->probe_wait); |
3338 |
+ to_hda_bus(bus)->bus_probing = 0; |
3339 |
+- return err; |
3340 |
++ return 0; |
3341 |
+ } |
3342 |
+ |
3343 |
+ static void azx_remove(struct pci_dev *pci) |
3344 |
+diff --git a/sound/pci/hda/hda_intel.h b/sound/pci/hda/hda_intel.h |
3345 |
+index 2acfff3da1a0..3fb119f09040 100644 |
3346 |
+--- a/sound/pci/hda/hda_intel.h |
3347 |
++++ b/sound/pci/hda/hda_intel.h |
3348 |
+@@ -27,6 +27,7 @@ struct hda_intel { |
3349 |
+ unsigned int use_vga_switcheroo:1; |
3350 |
+ unsigned int vga_switcheroo_registered:1; |
3351 |
+ unsigned int init_failed:1; /* delayed init failed */ |
3352 |
++ unsigned int freed:1; /* resources already released */ |
3353 |
+ |
3354 |
+ bool need_i915_power:1; /* the hda controller needs i915 power */ |
3355 |
+ }; |
3356 |
+diff --git a/sound/soc/codecs/tas571x.c b/sound/soc/codecs/tas571x.c |
3357 |
+index 1554631cb397..5b7f9fcf6cbf 100644 |
3358 |
+--- a/sound/soc/codecs/tas571x.c |
3359 |
++++ b/sound/soc/codecs/tas571x.c |
3360 |
+@@ -820,8 +820,10 @@ static int tas571x_i2c_probe(struct i2c_client *client, |
3361 |
+ |
3362 |
+ priv->regmap = devm_regmap_init(dev, NULL, client, |
3363 |
+ priv->chip->regmap_config); |
3364 |
+- if (IS_ERR(priv->regmap)) |
3365 |
+- return PTR_ERR(priv->regmap); |
3366 |
++ if (IS_ERR(priv->regmap)) { |
3367 |
++ ret = PTR_ERR(priv->regmap); |
3368 |
++ goto disable_regs; |
3369 |
++ } |
3370 |
+ |
3371 |
+ priv->pdn_gpio = devm_gpiod_get_optional(dev, "pdn", GPIOD_OUT_LOW); |
3372 |
+ if (IS_ERR(priv->pdn_gpio)) { |
3373 |
+@@ -845,7 +847,7 @@ static int tas571x_i2c_probe(struct i2c_client *client, |
3374 |
+ |
3375 |
+ ret = regmap_write(priv->regmap, TAS571X_OSC_TRIM_REG, 0); |
3376 |
+ if (ret) |
3377 |
+- return ret; |
3378 |
++ goto disable_regs; |
3379 |
+ |
3380 |
+ usleep_range(50000, 60000); |
3381 |
+ |
3382 |
+@@ -861,12 +863,20 @@ static int tas571x_i2c_probe(struct i2c_client *client, |
3383 |
+ */ |
3384 |
+ ret = regmap_update_bits(priv->regmap, TAS571X_MVOL_REG, 1, 0); |
3385 |
+ if (ret) |
3386 |
+- return ret; |
3387 |
++ goto disable_regs; |
3388 |
+ } |
3389 |
+ |
3390 |
+- return devm_snd_soc_register_component(&client->dev, |
3391 |
++ ret = devm_snd_soc_register_component(&client->dev, |
3392 |
+ &priv->component_driver, |
3393 |
+ &tas571x_dai, 1); |
3394 |
++ if (ret) |
3395 |
++ goto disable_regs; |
3396 |
++ |
3397 |
++ return ret; |
3398 |
++ |
3399 |
++disable_regs: |
3400 |
++ regulator_bulk_disable(priv->chip->num_supply_names, priv->supplies); |
3401 |
++ return ret; |
3402 |
+ } |
3403 |
+ |
3404 |
+ static int tas571x_i2c_remove(struct i2c_client *client) |
3405 |
+diff --git a/sound/soc/codecs/wm8960.c b/sound/soc/codecs/wm8960.c |
3406 |
+index 55112c1bba5e..6cf0f6612bda 100644 |
3407 |
+--- a/sound/soc/codecs/wm8960.c |
3408 |
++++ b/sound/soc/codecs/wm8960.c |
3409 |
+@@ -860,8 +860,7 @@ static int wm8960_hw_params(struct snd_pcm_substream *substream, |
3410 |
+ |
3411 |
+ wm8960->is_stream_in_use[tx] = true; |
3412 |
+ |
3413 |
+- if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_ON && |
3414 |
+- !wm8960->is_stream_in_use[!tx]) |
3415 |
++ if (!wm8960->is_stream_in_use[!tx]) |
3416 |
+ return wm8960_configure_clocking(component); |
3417 |
+ |
3418 |
+ return 0; |
3419 |
+diff --git a/sound/soc/meson/axg-card.c b/sound/soc/meson/axg-card.c |
3420 |
+index 1f698adde506..2b04ac3d8fd3 100644 |
3421 |
+--- a/sound/soc/meson/axg-card.c |
3422 |
++++ b/sound/soc/meson/axg-card.c |
3423 |
+@@ -586,8 +586,10 @@ static int axg_card_add_link(struct snd_soc_card *card, struct device_node *np, |
3424 |
+ |
3425 |
+ if (axg_card_cpu_is_tdm_iface(dai_link->cpus->of_node)) |
3426 |
+ ret = axg_card_parse_tdm(card, np, index); |
3427 |
+- else if (axg_card_cpu_is_codec(dai_link->cpus->of_node)) |
3428 |
++ else if (axg_card_cpu_is_codec(dai_link->cpus->of_node)) { |
3429 |
+ dai_link->params = &codec_params; |
3430 |
++ dai_link->no_pcm = 0; /* link is not a DPCM BE */ |
3431 |
++ } |
3432 |
+ |
3433 |
+ return ret; |
3434 |
+ } |
3435 |
+diff --git a/sound/soc/qcom/qdsp6/q6afe-dai.c b/sound/soc/qcom/qdsp6/q6afe-dai.c |
3436 |
+index c1a7624eaf17..2a5302f1db98 100644 |
3437 |
+--- a/sound/soc/qcom/qdsp6/q6afe-dai.c |
3438 |
++++ b/sound/soc/qcom/qdsp6/q6afe-dai.c |
3439 |
+@@ -902,6 +902,8 @@ static struct snd_soc_dai_driver q6afe_dais[] = { |
3440 |
+ SNDRV_PCM_RATE_16000, |
3441 |
+ .formats = SNDRV_PCM_FMTBIT_S16_LE | |
3442 |
+ SNDRV_PCM_FMTBIT_S24_LE, |
3443 |
++ .channels_min = 1, |
3444 |
++ .channels_max = 8, |
3445 |
+ .rate_min = 8000, |
3446 |
+ .rate_max = 48000, |
3447 |
+ }, |
3448 |
+@@ -917,6 +919,8 @@ static struct snd_soc_dai_driver q6afe_dais[] = { |
3449 |
+ SNDRV_PCM_RATE_16000, |
3450 |
+ .formats = SNDRV_PCM_FMTBIT_S16_LE | |
3451 |
+ SNDRV_PCM_FMTBIT_S24_LE, |
3452 |
++ .channels_min = 1, |
3453 |
++ .channels_max = 8, |
3454 |
+ .rate_min = 8000, |
3455 |
+ .rate_max = 48000, |
3456 |
+ }, |
3457 |
+@@ -931,6 +935,8 @@ static struct snd_soc_dai_driver q6afe_dais[] = { |
3458 |
+ .rates = SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_8000 | |
3459 |
+ SNDRV_PCM_RATE_16000, |
3460 |
+ .formats = SNDRV_PCM_FMTBIT_S16_LE, |
3461 |
++ .channels_min = 1, |
3462 |
++ .channels_max = 8, |
3463 |
+ .rate_min = 8000, |
3464 |
+ .rate_max = 48000, |
3465 |
+ }, |
3466 |
+@@ -946,6 +952,8 @@ static struct snd_soc_dai_driver q6afe_dais[] = { |
3467 |
+ SNDRV_PCM_RATE_16000, |
3468 |
+ .formats = SNDRV_PCM_FMTBIT_S16_LE | |
3469 |
+ SNDRV_PCM_FMTBIT_S24_LE, |
3470 |
++ .channels_min = 1, |
3471 |
++ .channels_max = 8, |
3472 |
+ .rate_min = 8000, |
3473 |
+ .rate_max = 48000, |
3474 |
+ }, |
3475 |
+@@ -960,6 +968,8 @@ static struct snd_soc_dai_driver q6afe_dais[] = { |
3476 |
+ .rates = SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_8000 | |
3477 |
+ SNDRV_PCM_RATE_16000, |
3478 |
+ .formats = SNDRV_PCM_FMTBIT_S16_LE, |
3479 |
++ .channels_min = 1, |
3480 |
++ .channels_max = 8, |
3481 |
+ .rate_min = 8000, |
3482 |
+ .rate_max = 48000, |
3483 |
+ }, |
3484 |
+@@ -975,6 +985,8 @@ static struct snd_soc_dai_driver q6afe_dais[] = { |
3485 |
+ SNDRV_PCM_RATE_16000, |
3486 |
+ .formats = SNDRV_PCM_FMTBIT_S16_LE | |
3487 |
+ SNDRV_PCM_FMTBIT_S24_LE, |
3488 |
++ .channels_min = 1, |
3489 |
++ .channels_max = 8, |
3490 |
+ .rate_min = 8000, |
3491 |
+ .rate_max = 48000, |
3492 |
+ }, |
3493 |
+@@ -989,6 +1001,8 @@ static struct snd_soc_dai_driver q6afe_dais[] = { |
3494 |
+ .rates = SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_8000 | |
3495 |
+ SNDRV_PCM_RATE_16000, |
3496 |
+ .formats = SNDRV_PCM_FMTBIT_S16_LE, |
3497 |
++ .channels_min = 1, |
3498 |
++ .channels_max = 8, |
3499 |
+ .rate_min = 8000, |
3500 |
+ .rate_max = 48000, |
3501 |
+ }, |
3502 |
+@@ -1004,6 +1018,8 @@ static struct snd_soc_dai_driver q6afe_dais[] = { |
3503 |
+ SNDRV_PCM_RATE_16000, |
3504 |
+ .formats = SNDRV_PCM_FMTBIT_S16_LE | |
3505 |
+ SNDRV_PCM_FMTBIT_S24_LE, |
3506 |
++ .channels_min = 1, |
3507 |
++ .channels_max = 8, |
3508 |
+ .rate_min = 8000, |
3509 |
+ .rate_max = 48000, |
3510 |
+ }, |
3511 |
+diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c |
3512 |
+index 9d3b546bae7b..0215e2c94bf0 100644 |
3513 |
+--- a/sound/soc/soc-core.c |
3514 |
++++ b/sound/soc/soc-core.c |
3515 |
+@@ -1076,8 +1076,18 @@ static int soc_probe_component(struct snd_soc_card *card, |
3516 |
+ ret = snd_soc_dapm_add_routes(dapm, |
3517 |
+ component->driver->dapm_routes, |
3518 |
+ component->driver->num_dapm_routes); |
3519 |
+- if (ret < 0) |
3520 |
+- goto err_probe; |
3521 |
++ if (ret < 0) { |
3522 |
++ if (card->disable_route_checks) { |
3523 |
++ dev_info(card->dev, |
3524 |
++ "%s: disable_route_checks set, ignoring errors on add_routes\n", |
3525 |
++ __func__); |
3526 |
++ } else { |
3527 |
++ dev_err(card->dev, |
3528 |
++ "%s: snd_soc_dapm_add_routes failed: %d\n", |
3529 |
++ __func__, ret); |
3530 |
++ goto err_probe; |
3531 |
++ } |
3532 |
++ } |
3533 |
+ |
3534 |
+ /* see for_each_card_components */ |
3535 |
+ list_add(&component->card_list, &card->component_dev_list); |
3536 |
+@@ -2067,8 +2077,18 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card) |
3537 |
+ |
3538 |
+ ret = snd_soc_dapm_add_routes(&card->dapm, card->dapm_routes, |
3539 |
+ card->num_dapm_routes); |
3540 |
+- if (ret < 0) |
3541 |
+- goto probe_end; |
3542 |
++ if (ret < 0) { |
3543 |
++ if (card->disable_route_checks) { |
3544 |
++ dev_info(card->dev, |
3545 |
++ "%s: disable_route_checks set, ignoring errors on add_routes\n", |
3546 |
++ __func__); |
3547 |
++ } else { |
3548 |
++ dev_err(card->dev, |
3549 |
++ "%s: snd_soc_dapm_add_routes failed: %d\n", |
3550 |
++ __func__, ret); |
3551 |
++ goto probe_end; |
3552 |
++ } |
3553 |
++ } |
3554 |
+ |
3555 |
+ ret = snd_soc_dapm_add_routes(&card->dapm, card->of_dapm_routes, |
3556 |
+ card->num_of_dapm_routes); |
3557 |
+diff --git a/sound/soc/stm/stm32_sai_sub.c b/sound/soc/stm/stm32_sai_sub.c |
3558 |
+index d3259de43712..7e965848796c 100644 |
3559 |
+--- a/sound/soc/stm/stm32_sai_sub.c |
3560 |
++++ b/sound/soc/stm/stm32_sai_sub.c |
3561 |
+@@ -1543,6 +1543,9 @@ static int stm32_sai_sub_probe(struct platform_device *pdev) |
3562 |
+ return ret; |
3563 |
+ } |
3564 |
+ |
3565 |
++ if (STM_SAI_PROTOCOL_IS_SPDIF(sai)) |
3566 |
++ conf = &stm32_sai_pcm_config_spdif; |
3567 |
++ |
3568 |
+ ret = snd_dmaengine_pcm_register(&pdev->dev, conf, 0); |
3569 |
+ if (ret) { |
3570 |
+ dev_err(&pdev->dev, "Could not register pcm dma\n"); |
3571 |
+@@ -1551,15 +1554,10 @@ static int stm32_sai_sub_probe(struct platform_device *pdev) |
3572 |
+ |
3573 |
+ ret = snd_soc_register_component(&pdev->dev, &stm32_component, |
3574 |
+ &sai->cpu_dai_drv, 1); |
3575 |
+- if (ret) { |
3576 |
++ if (ret) |
3577 |
+ snd_dmaengine_pcm_unregister(&pdev->dev); |
3578 |
+- return ret; |
3579 |
+- } |
3580 |
+- |
3581 |
+- if (STM_SAI_PROTOCOL_IS_SPDIF(sai)) |
3582 |
+- conf = &stm32_sai_pcm_config_spdif; |
3583 |
+ |
3584 |
+- return 0; |
3585 |
++ return ret; |
3586 |
+ } |
3587 |
+ |
3588 |
+ static int stm32_sai_sub_remove(struct platform_device *pdev) |
3589 |
+diff --git a/sound/soc/stm/stm32_spdifrx.c b/sound/soc/stm/stm32_spdifrx.c |
3590 |
+index e53fb4bd66b3..9fc2a1767eb1 100644 |
3591 |
+--- a/sound/soc/stm/stm32_spdifrx.c |
3592 |
++++ b/sound/soc/stm/stm32_spdifrx.c |
3593 |
+@@ -995,6 +995,8 @@ static int stm32_spdifrx_probe(struct platform_device *pdev) |
3594 |
+ |
3595 |
+ if (idr == SPDIFRX_IPIDR_NUMBER) { |
3596 |
+ ret = regmap_read(spdifrx->regmap, STM32_SPDIFRX_VERR, &ver); |
3597 |
++ if (ret) |
3598 |
++ goto error; |
3599 |
+ |
3600 |
+ dev_dbg(&pdev->dev, "SPDIFRX version: %lu.%lu registered\n", |
3601 |
+ FIELD_GET(SPDIFRX_VERR_MAJ_MASK, ver), |
3602 |
+diff --git a/tools/lib/bpf/netlink.c b/tools/lib/bpf/netlink.c |
3603 |
+index ce3ec81b71c0..88416be2bf99 100644 |
3604 |
+--- a/tools/lib/bpf/netlink.c |
3605 |
++++ b/tools/lib/bpf/netlink.c |
3606 |
+@@ -137,7 +137,7 @@ int bpf_set_link_xdp_fd(int ifindex, int fd, __u32 flags) |
3607 |
+ struct ifinfomsg ifinfo; |
3608 |
+ char attrbuf[64]; |
3609 |
+ } req; |
3610 |
+- __u32 nl_pid; |
3611 |
++ __u32 nl_pid = 0; |
3612 |
+ |
3613 |
+ sock = libbpf_netlink_open(&nl_pid); |
3614 |
+ if (sock < 0) |
3615 |
+@@ -254,7 +254,7 @@ int bpf_get_link_xdp_id(int ifindex, __u32 *prog_id, __u32 flags) |
3616 |
+ { |
3617 |
+ struct xdp_id_md xdp_id = {}; |
3618 |
+ int sock, ret; |
3619 |
+- __u32 nl_pid; |
3620 |
++ __u32 nl_pid = 0; |
3621 |
+ __u32 mask; |
3622 |
+ |
3623 |
+ if (flags & ~XDP_FLAGS_MASK) |
3624 |
+diff --git a/tools/objtool/check.c b/tools/objtool/check.c |
3625 |
+index 9fa4e1a46ca9..d6a971326f87 100644 |
3626 |
+--- a/tools/objtool/check.c |
3627 |
++++ b/tools/objtool/check.c |
3628 |
+@@ -2306,14 +2306,27 @@ static bool ignore_unreachable_insn(struct instruction *insn) |
3629 |
+ !strcmp(insn->sec->name, ".altinstr_aux")) |
3630 |
+ return true; |
3631 |
+ |
3632 |
++ if (!insn->func) |
3633 |
++ return false; |
3634 |
++ |
3635 |
++ /* |
3636 |
++ * CONFIG_UBSAN_TRAP inserts a UD2 when it sees |
3637 |
++ * __builtin_unreachable(). The BUG() macro has an unreachable() after |
3638 |
++ * the UD2, which causes GCC's undefined trap logic to emit another UD2 |
3639 |
++ * (or occasionally a JMP to UD2). |
3640 |
++ */ |
3641 |
++ if (list_prev_entry(insn, list)->dead_end && |
3642 |
++ (insn->type == INSN_BUG || |
3643 |
++ (insn->type == INSN_JUMP_UNCONDITIONAL && |
3644 |
++ insn->jump_dest && insn->jump_dest->type == INSN_BUG))) |
3645 |
++ return true; |
3646 |
++ |
3647 |
+ /* |
3648 |
+ * Check if this (or a subsequent) instruction is related to |
3649 |
+ * CONFIG_UBSAN or CONFIG_KASAN. |
3650 |
+ * |
3651 |
+ * End the search at 5 instructions to avoid going into the weeds. |
3652 |
+ */ |
3653 |
+- if (!insn->func) |
3654 |
+- return false; |
3655 |
+ for (i = 0; i < 5; i++) { |
3656 |
+ |
3657 |
+ if (is_kasan_insn(insn) || is_ubsan_insn(insn)) |
3658 |
+diff --git a/tools/objtool/orc_dump.c b/tools/objtool/orc_dump.c |
3659 |
+index 13ccf775a83a..ba4cbb1cdd63 100644 |
3660 |
+--- a/tools/objtool/orc_dump.c |
3661 |
++++ b/tools/objtool/orc_dump.c |
3662 |
+@@ -66,7 +66,7 @@ int orc_dump(const char *_objname) |
3663 |
+ char *name; |
3664 |
+ size_t nr_sections; |
3665 |
+ Elf64_Addr orc_ip_addr = 0; |
3666 |
+- size_t shstrtab_idx; |
3667 |
++ size_t shstrtab_idx, strtab_idx = 0; |
3668 |
+ Elf *elf; |
3669 |
+ Elf_Scn *scn; |
3670 |
+ GElf_Shdr sh; |
3671 |
+@@ -127,6 +127,8 @@ int orc_dump(const char *_objname) |
3672 |
+ |
3673 |
+ if (!strcmp(name, ".symtab")) { |
3674 |
+ symtab = data; |
3675 |
++ } else if (!strcmp(name, ".strtab")) { |
3676 |
++ strtab_idx = i; |
3677 |
+ } else if (!strcmp(name, ".orc_unwind")) { |
3678 |
+ orc = data->d_buf; |
3679 |
+ orc_size = sh.sh_size; |
3680 |
+@@ -138,7 +140,7 @@ int orc_dump(const char *_objname) |
3681 |
+ } |
3682 |
+ } |
3683 |
+ |
3684 |
+- if (!symtab || !orc || !orc_ip) |
3685 |
++ if (!symtab || !strtab_idx || !orc || !orc_ip) |
3686 |
+ return 0; |
3687 |
+ |
3688 |
+ if (orc_size % sizeof(*orc) != 0) { |
3689 |
+@@ -159,21 +161,29 @@ int orc_dump(const char *_objname) |
3690 |
+ return -1; |
3691 |
+ } |
3692 |
+ |
3693 |
+- scn = elf_getscn(elf, sym.st_shndx); |
3694 |
+- if (!scn) { |
3695 |
+- WARN_ELF("elf_getscn"); |
3696 |
+- return -1; |
3697 |
+- } |
3698 |
+- |
3699 |
+- if (!gelf_getshdr(scn, &sh)) { |
3700 |
+- WARN_ELF("gelf_getshdr"); |
3701 |
+- return -1; |
3702 |
+- } |
3703 |
+- |
3704 |
+- name = elf_strptr(elf, shstrtab_idx, sh.sh_name); |
3705 |
+- if (!name || !*name) { |
3706 |
+- WARN_ELF("elf_strptr"); |
3707 |
+- return -1; |
3708 |
++ if (GELF_ST_TYPE(sym.st_info) == STT_SECTION) { |
3709 |
++ scn = elf_getscn(elf, sym.st_shndx); |
3710 |
++ if (!scn) { |
3711 |
++ WARN_ELF("elf_getscn"); |
3712 |
++ return -1; |
3713 |
++ } |
3714 |
++ |
3715 |
++ if (!gelf_getshdr(scn, &sh)) { |
3716 |
++ WARN_ELF("gelf_getshdr"); |
3717 |
++ return -1; |
3718 |
++ } |
3719 |
++ |
3720 |
++ name = elf_strptr(elf, shstrtab_idx, sh.sh_name); |
3721 |
++ if (!name) { |
3722 |
++ WARN_ELF("elf_strptr"); |
3723 |
++ return -1; |
3724 |
++ } |
3725 |
++ } else { |
3726 |
++ name = elf_strptr(elf, strtab_idx, sym.st_name); |
3727 |
++ if (!name) { |
3728 |
++ WARN_ELF("elf_strptr"); |
3729 |
++ return -1; |
3730 |
++ } |
3731 |
+ } |
3732 |
+ |
3733 |
+ printf("%s+%llx:", name, (unsigned long long)rela.r_addend); |
3734 |
+diff --git a/tools/testing/selftests/bpf/verifier/value_illegal_alu.c b/tools/testing/selftests/bpf/verifier/value_illegal_alu.c |
3735 |
+index 7f6c232cd842..ed1c2cea1dea 100644 |
3736 |
+--- a/tools/testing/selftests/bpf/verifier/value_illegal_alu.c |
3737 |
++++ b/tools/testing/selftests/bpf/verifier/value_illegal_alu.c |
3738 |
+@@ -88,6 +88,7 @@ |
3739 |
+ BPF_EXIT_INSN(), |
3740 |
+ }, |
3741 |
+ .fixup_map_hash_48b = { 3 }, |
3742 |
++ .errstr_unpriv = "leaking pointer from stack off -8", |
3743 |
+ .errstr = "R0 invalid mem access 'inv'", |
3744 |
+ .result = REJECT, |
3745 |
+ .flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS, |