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