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