1 |
commit: 3084192fca32fa67d11685f187a7cd55ad3b21d4 |
2 |
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
3 |
AuthorDate: Thu Oct 18 10:27:08 2018 +0000 |
4 |
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Oct 18 10:27:32 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=3084192f |
7 |
|
8 |
Linux patch 4.18.15 |
9 |
|
10 |
Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org> |
11 |
|
12 |
0000_README | 4 + |
13 |
1014_linux-4.18.15.patch | 5433 ++++++++++++++++++++++++++++++++++++++++++++++ |
14 |
2 files changed, 5437 insertions(+) |
15 |
|
16 |
diff --git a/0000_README b/0000_README |
17 |
index 6d1cb28..5676b13 100644 |
18 |
--- a/0000_README |
19 |
+++ b/0000_README |
20 |
@@ -99,6 +99,10 @@ Patch: 1013_linux-4.18.14.patch |
21 |
From: http://www.kernel.org |
22 |
Desc: Linux 4.18.14 |
23 |
|
24 |
+Patch: 1014_linux-4.18.15.patch |
25 |
+From: http://www.kernel.org |
26 |
+Desc: Linux 4.18.15 |
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/1014_linux-4.18.15.patch b/1014_linux-4.18.15.patch |
33 |
new file mode 100644 |
34 |
index 0000000..5477884 |
35 |
--- /dev/null |
36 |
+++ b/1014_linux-4.18.15.patch |
37 |
@@ -0,0 +1,5433 @@ |
38 |
+diff --git a/Documentation/devicetree/bindings/net/macb.txt b/Documentation/devicetree/bindings/net/macb.txt |
39 |
+index 457d5ae16f23..3e17ac1d5d58 100644 |
40 |
+--- a/Documentation/devicetree/bindings/net/macb.txt |
41 |
++++ b/Documentation/devicetree/bindings/net/macb.txt |
42 |
+@@ -10,6 +10,7 @@ Required properties: |
43 |
+ Use "cdns,pc302-gem" for Picochip picoXcell pc302 and later devices based on |
44 |
+ the Cadence GEM, or the generic form: "cdns,gem". |
45 |
+ Use "atmel,sama5d2-gem" for the GEM IP (10/100) available on Atmel sama5d2 SoCs. |
46 |
++ Use "atmel,sama5d3-macb" for the 10/100Mbit IP available on Atmel sama5d3 SoCs. |
47 |
+ Use "atmel,sama5d3-gem" for the Gigabit IP available on Atmel sama5d3 SoCs. |
48 |
+ Use "atmel,sama5d4-gem" for the GEM IP (10/100) available on Atmel sama5d4 SoCs. |
49 |
+ Use "cdns,zynq-gem" Xilinx Zynq-7xxx SoC. |
50 |
+diff --git a/Makefile b/Makefile |
51 |
+index 5274f8ae6b44..968eb96a0553 100644 |
52 |
+--- a/Makefile |
53 |
++++ b/Makefile |
54 |
+@@ -1,7 +1,7 @@ |
55 |
+ # SPDX-License-Identifier: GPL-2.0 |
56 |
+ VERSION = 4 |
57 |
+ PATCHLEVEL = 18 |
58 |
+-SUBLEVEL = 14 |
59 |
++SUBLEVEL = 15 |
60 |
+ EXTRAVERSION = |
61 |
+ NAME = Merciless Moray |
62 |
+ |
63 |
+@@ -298,19 +298,7 @@ KERNELRELEASE = $(shell cat include/config/kernel.release 2> /dev/null) |
64 |
+ KERNELVERSION = $(VERSION)$(if $(PATCHLEVEL),.$(PATCHLEVEL)$(if $(SUBLEVEL),.$(SUBLEVEL)))$(EXTRAVERSION) |
65 |
+ export VERSION PATCHLEVEL SUBLEVEL KERNELRELEASE KERNELVERSION |
66 |
+ |
67 |
+-# SUBARCH tells the usermode build what the underlying arch is. That is set |
68 |
+-# first, and if a usermode build is happening, the "ARCH=um" on the command |
69 |
+-# line overrides the setting of ARCH below. If a native build is happening, |
70 |
+-# then ARCH is assigned, getting whatever value it gets normally, and |
71 |
+-# SUBARCH is subsequently ignored. |
72 |
+- |
73 |
+-SUBARCH := $(shell uname -m | sed -e s/i.86/x86/ -e s/x86_64/x86/ \ |
74 |
+- -e s/sun4u/sparc64/ \ |
75 |
+- -e s/arm.*/arm/ -e s/sa110/arm/ \ |
76 |
+- -e s/s390x/s390/ -e s/parisc64/parisc/ \ |
77 |
+- -e s/ppc.*/powerpc/ -e s/mips.*/mips/ \ |
78 |
+- -e s/sh[234].*/sh/ -e s/aarch64.*/arm64/ \ |
79 |
+- -e s/riscv.*/riscv/) |
80 |
++include scripts/subarch.include |
81 |
+ |
82 |
+ # Cross compiling and selecting different set of gcc/bin-utils |
83 |
+ # --------------------------------------------------------------------------- |
84 |
+diff --git a/arch/arm/boot/dts/sama5d3_emac.dtsi b/arch/arm/boot/dts/sama5d3_emac.dtsi |
85 |
+index 7cb235ef0fb6..6e9e1c2f9def 100644 |
86 |
+--- a/arch/arm/boot/dts/sama5d3_emac.dtsi |
87 |
++++ b/arch/arm/boot/dts/sama5d3_emac.dtsi |
88 |
+@@ -41,7 +41,7 @@ |
89 |
+ }; |
90 |
+ |
91 |
+ macb1: ethernet@f802c000 { |
92 |
+- compatible = "cdns,at91sam9260-macb", "cdns,macb"; |
93 |
++ compatible = "atmel,sama5d3-macb", "cdns,at91sam9260-macb", "cdns,macb"; |
94 |
+ reg = <0xf802c000 0x100>; |
95 |
+ interrupts = <35 IRQ_TYPE_LEVEL_HIGH 3>; |
96 |
+ pinctrl-names = "default"; |
97 |
+diff --git a/arch/arm64/kernel/perf_event.c b/arch/arm64/kernel/perf_event.c |
98 |
+index dd5b4fab114f..b7c8a718544c 100644 |
99 |
+--- a/arch/arm64/kernel/perf_event.c |
100 |
++++ b/arch/arm64/kernel/perf_event.c |
101 |
+@@ -823,6 +823,12 @@ static int armv8pmu_set_event_filter(struct hw_perf_event *event, |
102 |
+ return 0; |
103 |
+ } |
104 |
+ |
105 |
++static int armv8pmu_filter_match(struct perf_event *event) |
106 |
++{ |
107 |
++ unsigned long evtype = event->hw.config_base & ARMV8_PMU_EVTYPE_EVENT; |
108 |
++ return evtype != ARMV8_PMUV3_PERFCTR_CHAIN; |
109 |
++} |
110 |
++ |
111 |
+ static void armv8pmu_reset(void *info) |
112 |
+ { |
113 |
+ struct arm_pmu *cpu_pmu = (struct arm_pmu *)info; |
114 |
+@@ -968,6 +974,7 @@ static int armv8_pmu_init(struct arm_pmu *cpu_pmu) |
115 |
+ cpu_pmu->reset = armv8pmu_reset, |
116 |
+ cpu_pmu->max_period = (1LLU << 32) - 1, |
117 |
+ cpu_pmu->set_event_filter = armv8pmu_set_event_filter; |
118 |
++ cpu_pmu->filter_match = armv8pmu_filter_match; |
119 |
+ |
120 |
+ return 0; |
121 |
+ } |
122 |
+diff --git a/arch/mips/include/asm/processor.h b/arch/mips/include/asm/processor.h |
123 |
+index b2fa62922d88..49d6046ca1d0 100644 |
124 |
+--- a/arch/mips/include/asm/processor.h |
125 |
++++ b/arch/mips/include/asm/processor.h |
126 |
+@@ -13,6 +13,7 @@ |
127 |
+ |
128 |
+ #include <linux/atomic.h> |
129 |
+ #include <linux/cpumask.h> |
130 |
++#include <linux/sizes.h> |
131 |
+ #include <linux/threads.h> |
132 |
+ |
133 |
+ #include <asm/cachectl.h> |
134 |
+@@ -80,11 +81,10 @@ extern unsigned int vced_count, vcei_count; |
135 |
+ |
136 |
+ #endif |
137 |
+ |
138 |
+-/* |
139 |
+- * One page above the stack is used for branch delay slot "emulation". |
140 |
+- * See dsemul.c for details. |
141 |
+- */ |
142 |
+-#define STACK_TOP ((TASK_SIZE & PAGE_MASK) - PAGE_SIZE) |
143 |
++#define VDSO_RANDOMIZE_SIZE (TASK_IS_32BIT_ADDR ? SZ_1M : SZ_256M) |
144 |
++ |
145 |
++extern unsigned long mips_stack_top(void); |
146 |
++#define STACK_TOP mips_stack_top() |
147 |
+ |
148 |
+ /* |
149 |
+ * This decides where the kernel will search for a free chunk of vm |
150 |
+diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c |
151 |
+index 9670e70139fd..1efd1798532b 100644 |
152 |
+--- a/arch/mips/kernel/process.c |
153 |
++++ b/arch/mips/kernel/process.c |
154 |
+@@ -31,6 +31,7 @@ |
155 |
+ #include <linux/prctl.h> |
156 |
+ #include <linux/nmi.h> |
157 |
+ |
158 |
++#include <asm/abi.h> |
159 |
+ #include <asm/asm.h> |
160 |
+ #include <asm/bootinfo.h> |
161 |
+ #include <asm/cpu.h> |
162 |
+@@ -38,6 +39,7 @@ |
163 |
+ #include <asm/dsp.h> |
164 |
+ #include <asm/fpu.h> |
165 |
+ #include <asm/irq.h> |
166 |
++#include <asm/mips-cps.h> |
167 |
+ #include <asm/msa.h> |
168 |
+ #include <asm/pgtable.h> |
169 |
+ #include <asm/mipsregs.h> |
170 |
+@@ -644,6 +646,29 @@ out: |
171 |
+ return pc; |
172 |
+ } |
173 |
+ |
174 |
++unsigned long mips_stack_top(void) |
175 |
++{ |
176 |
++ unsigned long top = TASK_SIZE & PAGE_MASK; |
177 |
++ |
178 |
++ /* One page for branch delay slot "emulation" */ |
179 |
++ top -= PAGE_SIZE; |
180 |
++ |
181 |
++ /* Space for the VDSO, data page & GIC user page */ |
182 |
++ top -= PAGE_ALIGN(current->thread.abi->vdso->size); |
183 |
++ top -= PAGE_SIZE; |
184 |
++ top -= mips_gic_present() ? PAGE_SIZE : 0; |
185 |
++ |
186 |
++ /* Space for cache colour alignment */ |
187 |
++ if (cpu_has_dc_aliases) |
188 |
++ top -= shm_align_mask + 1; |
189 |
++ |
190 |
++ /* Space to randomize the VDSO base */ |
191 |
++ if (current->flags & PF_RANDOMIZE) |
192 |
++ top -= VDSO_RANDOMIZE_SIZE; |
193 |
++ |
194 |
++ return top; |
195 |
++} |
196 |
++ |
197 |
+ /* |
198 |
+ * Don't forget that the stack pointer must be aligned on a 8 bytes |
199 |
+ * boundary for 32-bits ABI and 16 bytes for 64-bits ABI. |
200 |
+diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c |
201 |
+index 2c96c0c68116..6138224a96b1 100644 |
202 |
+--- a/arch/mips/kernel/setup.c |
203 |
++++ b/arch/mips/kernel/setup.c |
204 |
+@@ -835,6 +835,34 @@ static void __init arch_mem_init(char **cmdline_p) |
205 |
+ struct memblock_region *reg; |
206 |
+ extern void plat_mem_setup(void); |
207 |
+ |
208 |
++ /* |
209 |
++ * Initialize boot_command_line to an innocuous but non-empty string in |
210 |
++ * order to prevent early_init_dt_scan_chosen() from copying |
211 |
++ * CONFIG_CMDLINE into it without our knowledge. We handle |
212 |
++ * CONFIG_CMDLINE ourselves below & don't want to duplicate its |
213 |
++ * content because repeating arguments can be problematic. |
214 |
++ */ |
215 |
++ strlcpy(boot_command_line, " ", COMMAND_LINE_SIZE); |
216 |
++ |
217 |
++ /* call board setup routine */ |
218 |
++ plat_mem_setup(); |
219 |
++ |
220 |
++ /* |
221 |
++ * Make sure all kernel memory is in the maps. The "UP" and |
222 |
++ * "DOWN" are opposite for initdata since if it crosses over |
223 |
++ * into another memory section you don't want that to be |
224 |
++ * freed when the initdata is freed. |
225 |
++ */ |
226 |
++ arch_mem_addpart(PFN_DOWN(__pa_symbol(&_text)) << PAGE_SHIFT, |
227 |
++ PFN_UP(__pa_symbol(&_edata)) << PAGE_SHIFT, |
228 |
++ BOOT_MEM_RAM); |
229 |
++ arch_mem_addpart(PFN_UP(__pa_symbol(&__init_begin)) << PAGE_SHIFT, |
230 |
++ PFN_DOWN(__pa_symbol(&__init_end)) << PAGE_SHIFT, |
231 |
++ BOOT_MEM_INIT_RAM); |
232 |
++ |
233 |
++ pr_info("Determined physical RAM map:\n"); |
234 |
++ print_memory_map(); |
235 |
++ |
236 |
+ #if defined(CONFIG_CMDLINE_BOOL) && defined(CONFIG_CMDLINE_OVERRIDE) |
237 |
+ strlcpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE); |
238 |
+ #else |
239 |
+@@ -862,26 +890,6 @@ static void __init arch_mem_init(char **cmdline_p) |
240 |
+ } |
241 |
+ #endif |
242 |
+ #endif |
243 |
+- |
244 |
+- /* call board setup routine */ |
245 |
+- plat_mem_setup(); |
246 |
+- |
247 |
+- /* |
248 |
+- * Make sure all kernel memory is in the maps. The "UP" and |
249 |
+- * "DOWN" are opposite for initdata since if it crosses over |
250 |
+- * into another memory section you don't want that to be |
251 |
+- * freed when the initdata is freed. |
252 |
+- */ |
253 |
+- arch_mem_addpart(PFN_DOWN(__pa_symbol(&_text)) << PAGE_SHIFT, |
254 |
+- PFN_UP(__pa_symbol(&_edata)) << PAGE_SHIFT, |
255 |
+- BOOT_MEM_RAM); |
256 |
+- arch_mem_addpart(PFN_UP(__pa_symbol(&__init_begin)) << PAGE_SHIFT, |
257 |
+- PFN_DOWN(__pa_symbol(&__init_end)) << PAGE_SHIFT, |
258 |
+- BOOT_MEM_INIT_RAM); |
259 |
+- |
260 |
+- pr_info("Determined physical RAM map:\n"); |
261 |
+- print_memory_map(); |
262 |
+- |
263 |
+ strlcpy(command_line, boot_command_line, COMMAND_LINE_SIZE); |
264 |
+ |
265 |
+ *cmdline_p = command_line; |
266 |
+diff --git a/arch/mips/kernel/vdso.c b/arch/mips/kernel/vdso.c |
267 |
+index 8f845f6e5f42..48a9c6b90e07 100644 |
268 |
+--- a/arch/mips/kernel/vdso.c |
269 |
++++ b/arch/mips/kernel/vdso.c |
270 |
+@@ -15,6 +15,7 @@ |
271 |
+ #include <linux/ioport.h> |
272 |
+ #include <linux/kernel.h> |
273 |
+ #include <linux/mm.h> |
274 |
++#include <linux/random.h> |
275 |
+ #include <linux/sched.h> |
276 |
+ #include <linux/slab.h> |
277 |
+ #include <linux/timekeeper_internal.h> |
278 |
+@@ -97,6 +98,21 @@ void update_vsyscall_tz(void) |
279 |
+ } |
280 |
+ } |
281 |
+ |
282 |
++static unsigned long vdso_base(void) |
283 |
++{ |
284 |
++ unsigned long base; |
285 |
++ |
286 |
++ /* Skip the delay slot emulation page */ |
287 |
++ base = STACK_TOP + PAGE_SIZE; |
288 |
++ |
289 |
++ if (current->flags & PF_RANDOMIZE) { |
290 |
++ base += get_random_int() & (VDSO_RANDOMIZE_SIZE - 1); |
291 |
++ base = PAGE_ALIGN(base); |
292 |
++ } |
293 |
++ |
294 |
++ return base; |
295 |
++} |
296 |
++ |
297 |
+ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp) |
298 |
+ { |
299 |
+ struct mips_vdso_image *image = current->thread.abi->vdso; |
300 |
+@@ -137,7 +153,7 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp) |
301 |
+ if (cpu_has_dc_aliases) |
302 |
+ size += shm_align_mask + 1; |
303 |
+ |
304 |
+- base = get_unmapped_area(NULL, 0, size, 0, 0); |
305 |
++ base = get_unmapped_area(NULL, vdso_base(), size, 0, 0); |
306 |
+ if (IS_ERR_VALUE(base)) { |
307 |
+ ret = base; |
308 |
+ goto out; |
309 |
+diff --git a/arch/powerpc/include/asm/book3s/64/pgtable.h b/arch/powerpc/include/asm/book3s/64/pgtable.h |
310 |
+index 42aafba7a308..9532dff28091 100644 |
311 |
+--- a/arch/powerpc/include/asm/book3s/64/pgtable.h |
312 |
++++ b/arch/powerpc/include/asm/book3s/64/pgtable.h |
313 |
+@@ -104,7 +104,7 @@ |
314 |
+ */ |
315 |
+ #define _HPAGE_CHG_MASK (PTE_RPN_MASK | _PAGE_HPTEFLAGS | _PAGE_DIRTY | \ |
316 |
+ _PAGE_ACCESSED | H_PAGE_THP_HUGE | _PAGE_PTE | \ |
317 |
+- _PAGE_SOFT_DIRTY) |
318 |
++ _PAGE_SOFT_DIRTY | _PAGE_DEVMAP) |
319 |
+ /* |
320 |
+ * user access blocked by key |
321 |
+ */ |
322 |
+@@ -122,7 +122,7 @@ |
323 |
+ */ |
324 |
+ #define _PAGE_CHG_MASK (PTE_RPN_MASK | _PAGE_HPTEFLAGS | _PAGE_DIRTY | \ |
325 |
+ _PAGE_ACCESSED | _PAGE_SPECIAL | _PAGE_PTE | \ |
326 |
+- _PAGE_SOFT_DIRTY) |
327 |
++ _PAGE_SOFT_DIRTY | _PAGE_DEVMAP) |
328 |
+ |
329 |
+ #define H_PTE_PKEY (H_PTE_PKEY_BIT0 | H_PTE_PKEY_BIT1 | H_PTE_PKEY_BIT2 | \ |
330 |
+ H_PTE_PKEY_BIT3 | H_PTE_PKEY_BIT4) |
331 |
+diff --git a/arch/powerpc/kvm/book3s_64_mmu_radix.c b/arch/powerpc/kvm/book3s_64_mmu_radix.c |
332 |
+index 7efc42538ccf..26d927bf2fdb 100644 |
333 |
+--- a/arch/powerpc/kvm/book3s_64_mmu_radix.c |
334 |
++++ b/arch/powerpc/kvm/book3s_64_mmu_radix.c |
335 |
+@@ -538,8 +538,8 @@ int kvmppc_book3s_radix_page_fault(struct kvm_run *run, struct kvm_vcpu *vcpu, |
336 |
+ unsigned long ea, unsigned long dsisr) |
337 |
+ { |
338 |
+ struct kvm *kvm = vcpu->kvm; |
339 |
+- unsigned long mmu_seq, pte_size; |
340 |
+- unsigned long gpa, gfn, hva, pfn; |
341 |
++ unsigned long mmu_seq; |
342 |
++ unsigned long gpa, gfn, hva; |
343 |
+ struct kvm_memory_slot *memslot; |
344 |
+ struct page *page = NULL; |
345 |
+ long ret; |
346 |
+@@ -636,9 +636,10 @@ int kvmppc_book3s_radix_page_fault(struct kvm_run *run, struct kvm_vcpu *vcpu, |
347 |
+ */ |
348 |
+ hva = gfn_to_hva_memslot(memslot, gfn); |
349 |
+ if (upgrade_p && __get_user_pages_fast(hva, 1, 1, &page) == 1) { |
350 |
+- pfn = page_to_pfn(page); |
351 |
+ upgrade_write = true; |
352 |
+ } else { |
353 |
++ unsigned long pfn; |
354 |
++ |
355 |
+ /* Call KVM generic code to do the slow-path check */ |
356 |
+ pfn = __gfn_to_pfn_memslot(memslot, gfn, false, NULL, |
357 |
+ writing, upgrade_p); |
358 |
+@@ -652,63 +653,55 @@ int kvmppc_book3s_radix_page_fault(struct kvm_run *run, struct kvm_vcpu *vcpu, |
359 |
+ } |
360 |
+ } |
361 |
+ |
362 |
+- /* See if we can insert a 1GB or 2MB large PTE here */ |
363 |
+- level = 0; |
364 |
+- if (page && PageCompound(page)) { |
365 |
+- pte_size = PAGE_SIZE << compound_order(compound_head(page)); |
366 |
+- if (pte_size >= PUD_SIZE && |
367 |
+- (gpa & (PUD_SIZE - PAGE_SIZE)) == |
368 |
+- (hva & (PUD_SIZE - PAGE_SIZE))) { |
369 |
+- level = 2; |
370 |
+- pfn &= ~((PUD_SIZE >> PAGE_SHIFT) - 1); |
371 |
+- } else if (pte_size >= PMD_SIZE && |
372 |
+- (gpa & (PMD_SIZE - PAGE_SIZE)) == |
373 |
+- (hva & (PMD_SIZE - PAGE_SIZE))) { |
374 |
+- level = 1; |
375 |
+- pfn &= ~((PMD_SIZE >> PAGE_SHIFT) - 1); |
376 |
+- } |
377 |
+- } |
378 |
+- |
379 |
+ /* |
380 |
+- * Compute the PTE value that we need to insert. |
381 |
++ * Read the PTE from the process' radix tree and use that |
382 |
++ * so we get the shift and attribute bits. |
383 |
+ */ |
384 |
+- if (page) { |
385 |
+- pgflags = _PAGE_READ | _PAGE_EXEC | _PAGE_PRESENT | _PAGE_PTE | |
386 |
+- _PAGE_ACCESSED; |
387 |
+- if (writing || upgrade_write) |
388 |
+- pgflags |= _PAGE_WRITE | _PAGE_DIRTY; |
389 |
+- pte = pfn_pte(pfn, __pgprot(pgflags)); |
390 |
+- } else { |
391 |
+- /* |
392 |
+- * Read the PTE from the process' radix tree and use that |
393 |
+- * so we get the attribute bits. |
394 |
+- */ |
395 |
+- local_irq_disable(); |
396 |
+- ptep = __find_linux_pte(vcpu->arch.pgdir, hva, NULL, &shift); |
397 |
+- pte = *ptep; |
398 |
++ local_irq_disable(); |
399 |
++ ptep = __find_linux_pte(vcpu->arch.pgdir, hva, NULL, &shift); |
400 |
++ /* |
401 |
++ * If the PTE disappeared temporarily due to a THP |
402 |
++ * collapse, just return and let the guest try again. |
403 |
++ */ |
404 |
++ if (!ptep) { |
405 |
+ local_irq_enable(); |
406 |
+- if (shift == PUD_SHIFT && |
407 |
+- (gpa & (PUD_SIZE - PAGE_SIZE)) == |
408 |
+- (hva & (PUD_SIZE - PAGE_SIZE))) { |
409 |
+- level = 2; |
410 |
+- } else if (shift == PMD_SHIFT && |
411 |
+- (gpa & (PMD_SIZE - PAGE_SIZE)) == |
412 |
+- (hva & (PMD_SIZE - PAGE_SIZE))) { |
413 |
+- level = 1; |
414 |
+- } else if (shift && shift != PAGE_SHIFT) { |
415 |
+- /* Adjust PFN */ |
416 |
+- unsigned long mask = (1ul << shift) - PAGE_SIZE; |
417 |
+- pte = __pte(pte_val(pte) | (hva & mask)); |
418 |
+- } |
419 |
+- pte = __pte(pte_val(pte) | _PAGE_EXEC | _PAGE_ACCESSED); |
420 |
+- if (writing || upgrade_write) { |
421 |
+- if (pte_val(pte) & _PAGE_WRITE) |
422 |
+- pte = __pte(pte_val(pte) | _PAGE_DIRTY); |
423 |
+- } else { |
424 |
+- pte = __pte(pte_val(pte) & ~(_PAGE_WRITE | _PAGE_DIRTY)); |
425 |
++ if (page) |
426 |
++ put_page(page); |
427 |
++ return RESUME_GUEST; |
428 |
++ } |
429 |
++ pte = *ptep; |
430 |
++ local_irq_enable(); |
431 |
++ |
432 |
++ /* Get pte level from shift/size */ |
433 |
++ if (shift == PUD_SHIFT && |
434 |
++ (gpa & (PUD_SIZE - PAGE_SIZE)) == |
435 |
++ (hva & (PUD_SIZE - PAGE_SIZE))) { |
436 |
++ level = 2; |
437 |
++ } else if (shift == PMD_SHIFT && |
438 |
++ (gpa & (PMD_SIZE - PAGE_SIZE)) == |
439 |
++ (hva & (PMD_SIZE - PAGE_SIZE))) { |
440 |
++ level = 1; |
441 |
++ } else { |
442 |
++ level = 0; |
443 |
++ if (shift > PAGE_SHIFT) { |
444 |
++ /* |
445 |
++ * If the pte maps more than one page, bring over |
446 |
++ * bits from the virtual address to get the real |
447 |
++ * address of the specific single page we want. |
448 |
++ */ |
449 |
++ unsigned long rpnmask = (1ul << shift) - PAGE_SIZE; |
450 |
++ pte = __pte(pte_val(pte) | (hva & rpnmask)); |
451 |
+ } |
452 |
+ } |
453 |
+ |
454 |
++ pte = __pte(pte_val(pte) | _PAGE_EXEC | _PAGE_ACCESSED); |
455 |
++ if (writing || upgrade_write) { |
456 |
++ if (pte_val(pte) & _PAGE_WRITE) |
457 |
++ pte = __pte(pte_val(pte) | _PAGE_DIRTY); |
458 |
++ } else { |
459 |
++ pte = __pte(pte_val(pte) & ~(_PAGE_WRITE | _PAGE_DIRTY)); |
460 |
++ } |
461 |
++ |
462 |
+ /* Allocate space in the tree and write the PTE */ |
463 |
+ ret = kvmppc_create_pte(kvm, pte, gpa, level, mmu_seq); |
464 |
+ |
465 |
+diff --git a/arch/x86/include/asm/pgtable_types.h b/arch/x86/include/asm/pgtable_types.h |
466 |
+index 99fff853c944..a558381b016b 100644 |
467 |
+--- a/arch/x86/include/asm/pgtable_types.h |
468 |
++++ b/arch/x86/include/asm/pgtable_types.h |
469 |
+@@ -123,7 +123,7 @@ |
470 |
+ */ |
471 |
+ #define _PAGE_CHG_MASK (PTE_PFN_MASK | _PAGE_PCD | _PAGE_PWT | \ |
472 |
+ _PAGE_SPECIAL | _PAGE_ACCESSED | _PAGE_DIRTY | \ |
473 |
+- _PAGE_SOFT_DIRTY) |
474 |
++ _PAGE_SOFT_DIRTY | _PAGE_DEVMAP) |
475 |
+ #define _HPAGE_CHG_MASK (_PAGE_CHG_MASK | _PAGE_PSE) |
476 |
+ |
477 |
+ /* |
478 |
+diff --git a/arch/x86/include/uapi/asm/kvm.h b/arch/x86/include/uapi/asm/kvm.h |
479 |
+index c535c2fdea13..9bba9737ee0b 100644 |
480 |
+--- a/arch/x86/include/uapi/asm/kvm.h |
481 |
++++ b/arch/x86/include/uapi/asm/kvm.h |
482 |
+@@ -377,5 +377,6 @@ struct kvm_sync_regs { |
483 |
+ |
484 |
+ #define KVM_X86_QUIRK_LINT0_REENABLED (1 << 0) |
485 |
+ #define KVM_X86_QUIRK_CD_NW_CLEARED (1 << 1) |
486 |
++#define KVM_X86_QUIRK_LAPIC_MMIO_HOLE (1 << 2) |
487 |
+ |
488 |
+ #endif /* _ASM_X86_KVM_H */ |
489 |
+diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c |
490 |
+index b5cd8465d44f..83c4e8cc7eb9 100644 |
491 |
+--- a/arch/x86/kvm/lapic.c |
492 |
++++ b/arch/x86/kvm/lapic.c |
493 |
+@@ -1291,9 +1291,8 @@ EXPORT_SYMBOL_GPL(kvm_lapic_reg_read); |
494 |
+ |
495 |
+ static int apic_mmio_in_range(struct kvm_lapic *apic, gpa_t addr) |
496 |
+ { |
497 |
+- return kvm_apic_hw_enabled(apic) && |
498 |
+- addr >= apic->base_address && |
499 |
+- addr < apic->base_address + LAPIC_MMIO_LENGTH; |
500 |
++ return addr >= apic->base_address && |
501 |
++ addr < apic->base_address + LAPIC_MMIO_LENGTH; |
502 |
+ } |
503 |
+ |
504 |
+ static int apic_mmio_read(struct kvm_vcpu *vcpu, struct kvm_io_device *this, |
505 |
+@@ -1305,6 +1304,15 @@ static int apic_mmio_read(struct kvm_vcpu *vcpu, struct kvm_io_device *this, |
506 |
+ if (!apic_mmio_in_range(apic, address)) |
507 |
+ return -EOPNOTSUPP; |
508 |
+ |
509 |
++ if (!kvm_apic_hw_enabled(apic) || apic_x2apic_mode(apic)) { |
510 |
++ if (!kvm_check_has_quirk(vcpu->kvm, |
511 |
++ KVM_X86_QUIRK_LAPIC_MMIO_HOLE)) |
512 |
++ return -EOPNOTSUPP; |
513 |
++ |
514 |
++ memset(data, 0xff, len); |
515 |
++ return 0; |
516 |
++ } |
517 |
++ |
518 |
+ kvm_lapic_reg_read(apic, offset, len, data); |
519 |
+ |
520 |
+ return 0; |
521 |
+@@ -1864,6 +1872,14 @@ static int apic_mmio_write(struct kvm_vcpu *vcpu, struct kvm_io_device *this, |
522 |
+ if (!apic_mmio_in_range(apic, address)) |
523 |
+ return -EOPNOTSUPP; |
524 |
+ |
525 |
++ if (!kvm_apic_hw_enabled(apic) || apic_x2apic_mode(apic)) { |
526 |
++ if (!kvm_check_has_quirk(vcpu->kvm, |
527 |
++ KVM_X86_QUIRK_LAPIC_MMIO_HOLE)) |
528 |
++ return -EOPNOTSUPP; |
529 |
++ |
530 |
++ return 0; |
531 |
++ } |
532 |
++ |
533 |
+ /* |
534 |
+ * APIC register must be aligned on 128-bits boundary. |
535 |
+ * 32/64/128 bits registers must be accessed thru 32 bits. |
536 |
+diff --git a/drivers/bluetooth/hci_ldisc.c b/drivers/bluetooth/hci_ldisc.c |
537 |
+index 963bb0309e25..ea6238ed5c0e 100644 |
538 |
+--- a/drivers/bluetooth/hci_ldisc.c |
539 |
++++ b/drivers/bluetooth/hci_ldisc.c |
540 |
+@@ -543,6 +543,8 @@ static void hci_uart_tty_close(struct tty_struct *tty) |
541 |
+ } |
542 |
+ clear_bit(HCI_UART_PROTO_SET, &hu->flags); |
543 |
+ |
544 |
++ percpu_free_rwsem(&hu->proto_lock); |
545 |
++ |
546 |
+ kfree(hu); |
547 |
+ } |
548 |
+ |
549 |
+diff --git a/drivers/clk/x86/clk-pmc-atom.c b/drivers/clk/x86/clk-pmc-atom.c |
550 |
+index 08ef69945ffb..d977193842df 100644 |
551 |
+--- a/drivers/clk/x86/clk-pmc-atom.c |
552 |
++++ b/drivers/clk/x86/clk-pmc-atom.c |
553 |
+@@ -55,6 +55,7 @@ struct clk_plt_data { |
554 |
+ u8 nparents; |
555 |
+ struct clk_plt *clks[PMC_CLK_NUM]; |
556 |
+ struct clk_lookup *mclk_lookup; |
557 |
++ struct clk_lookup *ether_clk_lookup; |
558 |
+ }; |
559 |
+ |
560 |
+ /* Return an index in parent table */ |
561 |
+@@ -186,13 +187,6 @@ static struct clk_plt *plt_clk_register(struct platform_device *pdev, int id, |
562 |
+ pclk->reg = base + PMC_CLK_CTL_OFFSET + id * PMC_CLK_CTL_SIZE; |
563 |
+ spin_lock_init(&pclk->lock); |
564 |
+ |
565 |
+- /* |
566 |
+- * If the clock was already enabled by the firmware mark it as critical |
567 |
+- * to avoid it being gated by the clock framework if no driver owns it. |
568 |
+- */ |
569 |
+- if (plt_clk_is_enabled(&pclk->hw)) |
570 |
+- init.flags |= CLK_IS_CRITICAL; |
571 |
+- |
572 |
+ ret = devm_clk_hw_register(&pdev->dev, &pclk->hw); |
573 |
+ if (ret) { |
574 |
+ pclk = ERR_PTR(ret); |
575 |
+@@ -351,11 +345,20 @@ static int plt_clk_probe(struct platform_device *pdev) |
576 |
+ goto err_unreg_clk_plt; |
577 |
+ } |
578 |
+ |
579 |
++ data->ether_clk_lookup = clkdev_hw_create(&data->clks[4]->hw, |
580 |
++ "ether_clk", NULL); |
581 |
++ if (!data->ether_clk_lookup) { |
582 |
++ err = -ENOMEM; |
583 |
++ goto err_drop_mclk; |
584 |
++ } |
585 |
++ |
586 |
+ plt_clk_free_parent_names_loop(parent_names, data->nparents); |
587 |
+ |
588 |
+ platform_set_drvdata(pdev, data); |
589 |
+ return 0; |
590 |
+ |
591 |
++err_drop_mclk: |
592 |
++ clkdev_drop(data->mclk_lookup); |
593 |
+ err_unreg_clk_plt: |
594 |
+ plt_clk_unregister_loop(data, i); |
595 |
+ plt_clk_unregister_parents(data); |
596 |
+@@ -369,6 +372,7 @@ static int plt_clk_remove(struct platform_device *pdev) |
597 |
+ |
598 |
+ data = platform_get_drvdata(pdev); |
599 |
+ |
600 |
++ clkdev_drop(data->ether_clk_lookup); |
601 |
+ clkdev_drop(data->mclk_lookup); |
602 |
+ plt_clk_unregister_loop(data, PMC_CLK_NUM); |
603 |
+ plt_clk_unregister_parents(data); |
604 |
+diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c |
605 |
+index 305143fcc1ce..1ac7933cccc5 100644 |
606 |
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c |
607 |
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c |
608 |
+@@ -245,7 +245,7 @@ int amdgpu_amdkfd_resume(struct amdgpu_device *adev) |
609 |
+ |
610 |
+ int alloc_gtt_mem(struct kgd_dev *kgd, size_t size, |
611 |
+ void **mem_obj, uint64_t *gpu_addr, |
612 |
+- void **cpu_ptr) |
613 |
++ void **cpu_ptr, bool mqd_gfx9) |
614 |
+ { |
615 |
+ struct amdgpu_device *adev = (struct amdgpu_device *)kgd; |
616 |
+ struct amdgpu_bo *bo = NULL; |
617 |
+@@ -261,6 +261,10 @@ int alloc_gtt_mem(struct kgd_dev *kgd, size_t size, |
618 |
+ bp.flags = AMDGPU_GEM_CREATE_CPU_GTT_USWC; |
619 |
+ bp.type = ttm_bo_type_kernel; |
620 |
+ bp.resv = NULL; |
621 |
++ |
622 |
++ if (mqd_gfx9) |
623 |
++ bp.flags |= AMDGPU_GEM_CREATE_MQD_GFX9; |
624 |
++ |
625 |
+ r = amdgpu_bo_create(adev, &bp, &bo); |
626 |
+ if (r) { |
627 |
+ dev_err(adev->dev, |
628 |
+diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h |
629 |
+index a8418a3f4e9d..e3cf1c9fb3db 100644 |
630 |
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h |
631 |
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h |
632 |
+@@ -129,7 +129,7 @@ bool amdgpu_amdkfd_is_kfd_vmid(struct amdgpu_device *adev, u32 vmid); |
633 |
+ /* Shared API */ |
634 |
+ int alloc_gtt_mem(struct kgd_dev *kgd, size_t size, |
635 |
+ void **mem_obj, uint64_t *gpu_addr, |
636 |
+- void **cpu_ptr); |
637 |
++ void **cpu_ptr, bool mqd_gfx9); |
638 |
+ void free_gtt_mem(struct kgd_dev *kgd, void *mem_obj); |
639 |
+ void get_local_mem_info(struct kgd_dev *kgd, |
640 |
+ struct kfd_local_mem_info *mem_info); |
641 |
+diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v7.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v7.c |
642 |
+index ea79908dac4c..29a260e4aefe 100644 |
643 |
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v7.c |
644 |
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v7.c |
645 |
+@@ -677,7 +677,7 @@ static int kgd_hqd_sdma_destroy(struct kgd_dev *kgd, void *mqd, |
646 |
+ |
647 |
+ while (true) { |
648 |
+ temp = RREG32(sdma_base_addr + mmSDMA0_RLC0_CONTEXT_STATUS); |
649 |
+- if (temp & SDMA0_STATUS_REG__RB_CMD_IDLE__SHIFT) |
650 |
++ if (temp & SDMA0_RLC0_CONTEXT_STATUS__IDLE_MASK) |
651 |
+ break; |
652 |
+ if (time_after(jiffies, end_jiffies)) |
653 |
+ return -ETIME; |
654 |
+diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device.c b/drivers/gpu/drm/amd/amdkfd/kfd_device.c |
655 |
+index 7ee6cec2c060..6881b5a9275f 100644 |
656 |
+--- a/drivers/gpu/drm/amd/amdkfd/kfd_device.c |
657 |
++++ b/drivers/gpu/drm/amd/amdkfd/kfd_device.c |
658 |
+@@ -423,7 +423,8 @@ bool kgd2kfd_device_init(struct kfd_dev *kfd, |
659 |
+ |
660 |
+ if (kfd->kfd2kgd->init_gtt_mem_allocation( |
661 |
+ kfd->kgd, size, &kfd->gtt_mem, |
662 |
+- &kfd->gtt_start_gpu_addr, &kfd->gtt_start_cpu_ptr)){ |
663 |
++ &kfd->gtt_start_gpu_addr, &kfd->gtt_start_cpu_ptr, |
664 |
++ false)) { |
665 |
+ dev_err(kfd_device, "Could not allocate %d bytes\n", size); |
666 |
+ goto out; |
667 |
+ } |
668 |
+diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_iommu.c b/drivers/gpu/drm/amd/amdkfd/kfd_iommu.c |
669 |
+index c71817963eea..66c2f856d922 100644 |
670 |
+--- a/drivers/gpu/drm/amd/amdkfd/kfd_iommu.c |
671 |
++++ b/drivers/gpu/drm/amd/amdkfd/kfd_iommu.c |
672 |
+@@ -62,9 +62,20 @@ int kfd_iommu_device_init(struct kfd_dev *kfd) |
673 |
+ struct amd_iommu_device_info iommu_info; |
674 |
+ unsigned int pasid_limit; |
675 |
+ int err; |
676 |
++ struct kfd_topology_device *top_dev; |
677 |
+ |
678 |
+- if (!kfd->device_info->needs_iommu_device) |
679 |
++ top_dev = kfd_topology_device_by_id(kfd->id); |
680 |
++ |
681 |
++ /* |
682 |
++ * Overwrite ATS capability according to needs_iommu_device to fix |
683 |
++ * potential missing corresponding bit in CRAT of BIOS. |
684 |
++ */ |
685 |
++ if (!kfd->device_info->needs_iommu_device) { |
686 |
++ top_dev->node_props.capability &= ~HSA_CAP_ATS_PRESENT; |
687 |
+ return 0; |
688 |
++ } |
689 |
++ |
690 |
++ top_dev->node_props.capability |= HSA_CAP_ATS_PRESENT; |
691 |
+ |
692 |
+ iommu_info.flags = 0; |
693 |
+ err = amd_iommu_device_info(kfd->pdev, &iommu_info); |
694 |
+diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c b/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c |
695 |
+index 684054ff02cd..8da079cc6fb9 100644 |
696 |
+--- a/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c |
697 |
++++ b/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c |
698 |
+@@ -63,7 +63,7 @@ static int init_mqd(struct mqd_manager *mm, void **mqd, |
699 |
+ ALIGN(sizeof(struct v9_mqd), PAGE_SIZE), |
700 |
+ &((*mqd_mem_obj)->gtt_mem), |
701 |
+ &((*mqd_mem_obj)->gpu_addr), |
702 |
+- (void *)&((*mqd_mem_obj)->cpu_ptr)); |
703 |
++ (void *)&((*mqd_mem_obj)->cpu_ptr), true); |
704 |
+ } else |
705 |
+ retval = kfd_gtt_sa_allocate(mm->dev, sizeof(struct v9_mqd), |
706 |
+ mqd_mem_obj); |
707 |
+diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h |
708 |
+index 5e3990bb4c4b..c4de9b2baf1c 100644 |
709 |
+--- a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h |
710 |
++++ b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h |
711 |
+@@ -796,6 +796,7 @@ int kfd_topology_add_device(struct kfd_dev *gpu); |
712 |
+ int kfd_topology_remove_device(struct kfd_dev *gpu); |
713 |
+ struct kfd_topology_device *kfd_topology_device_by_proximity_domain( |
714 |
+ uint32_t proximity_domain); |
715 |
++struct kfd_topology_device *kfd_topology_device_by_id(uint32_t gpu_id); |
716 |
+ struct kfd_dev *kfd_device_by_id(uint32_t gpu_id); |
717 |
+ struct kfd_dev *kfd_device_by_pci_dev(const struct pci_dev *pdev); |
718 |
+ int kfd_topology_enum_kfd_devices(uint8_t idx, struct kfd_dev **kdev); |
719 |
+diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_topology.c b/drivers/gpu/drm/amd/amdkfd/kfd_topology.c |
720 |
+index bc95d4dfee2e..80f5db4ef75f 100644 |
721 |
+--- a/drivers/gpu/drm/amd/amdkfd/kfd_topology.c |
722 |
++++ b/drivers/gpu/drm/amd/amdkfd/kfd_topology.c |
723 |
+@@ -63,22 +63,33 @@ struct kfd_topology_device *kfd_topology_device_by_proximity_domain( |
724 |
+ return device; |
725 |
+ } |
726 |
+ |
727 |
+-struct kfd_dev *kfd_device_by_id(uint32_t gpu_id) |
728 |
++struct kfd_topology_device *kfd_topology_device_by_id(uint32_t gpu_id) |
729 |
+ { |
730 |
+- struct kfd_topology_device *top_dev; |
731 |
+- struct kfd_dev *device = NULL; |
732 |
++ struct kfd_topology_device *top_dev = NULL; |
733 |
++ struct kfd_topology_device *ret = NULL; |
734 |
+ |
735 |
+ down_read(&topology_lock); |
736 |
+ |
737 |
+ list_for_each_entry(top_dev, &topology_device_list, list) |
738 |
+ if (top_dev->gpu_id == gpu_id) { |
739 |
+- device = top_dev->gpu; |
740 |
++ ret = top_dev; |
741 |
+ break; |
742 |
+ } |
743 |
+ |
744 |
+ up_read(&topology_lock); |
745 |
+ |
746 |
+- return device; |
747 |
++ return ret; |
748 |
++} |
749 |
++ |
750 |
++struct kfd_dev *kfd_device_by_id(uint32_t gpu_id) |
751 |
++{ |
752 |
++ struct kfd_topology_device *top_dev; |
753 |
++ |
754 |
++ top_dev = kfd_topology_device_by_id(gpu_id); |
755 |
++ if (!top_dev) |
756 |
++ return NULL; |
757 |
++ |
758 |
++ return top_dev->gpu; |
759 |
+ } |
760 |
+ |
761 |
+ struct kfd_dev *kfd_device_by_pci_dev(const struct pci_dev *pdev) |
762 |
+diff --git a/drivers/gpu/drm/amd/include/kgd_kfd_interface.h b/drivers/gpu/drm/amd/include/kgd_kfd_interface.h |
763 |
+index 5733fbee07f7..f56b7553e5ed 100644 |
764 |
+--- a/drivers/gpu/drm/amd/include/kgd_kfd_interface.h |
765 |
++++ b/drivers/gpu/drm/amd/include/kgd_kfd_interface.h |
766 |
+@@ -266,7 +266,7 @@ struct tile_config { |
767 |
+ struct kfd2kgd_calls { |
768 |
+ int (*init_gtt_mem_allocation)(struct kgd_dev *kgd, size_t size, |
769 |
+ void **mem_obj, uint64_t *gpu_addr, |
770 |
+- void **cpu_ptr); |
771 |
++ void **cpu_ptr, bool mqd_gfx9); |
772 |
+ |
773 |
+ void (*free_gtt_mem)(struct kgd_dev *kgd, void *mem_obj); |
774 |
+ |
775 |
+diff --git a/drivers/gpu/drm/nouveau/dispnv50/disp.c b/drivers/gpu/drm/nouveau/dispnv50/disp.c |
776 |
+index 7a12d75e5157..c3c8c84da113 100644 |
777 |
+--- a/drivers/gpu/drm/nouveau/dispnv50/disp.c |
778 |
++++ b/drivers/gpu/drm/nouveau/dispnv50/disp.c |
779 |
+@@ -875,9 +875,22 @@ static enum drm_connector_status |
780 |
+ nv50_mstc_detect(struct drm_connector *connector, bool force) |
781 |
+ { |
782 |
+ struct nv50_mstc *mstc = nv50_mstc(connector); |
783 |
++ enum drm_connector_status conn_status; |
784 |
++ int ret; |
785 |
++ |
786 |
+ if (!mstc->port) |
787 |
+ return connector_status_disconnected; |
788 |
+- return drm_dp_mst_detect_port(connector, mstc->port->mgr, mstc->port); |
789 |
++ |
790 |
++ ret = pm_runtime_get_sync(connector->dev->dev); |
791 |
++ if (ret < 0 && ret != -EACCES) |
792 |
++ return connector_status_disconnected; |
793 |
++ |
794 |
++ conn_status = drm_dp_mst_detect_port(connector, mstc->port->mgr, |
795 |
++ mstc->port); |
796 |
++ |
797 |
++ pm_runtime_mark_last_busy(connector->dev->dev); |
798 |
++ pm_runtime_put_autosuspend(connector->dev->dev); |
799 |
++ return conn_status; |
800 |
+ } |
801 |
+ |
802 |
+ static void |
803 |
+diff --git a/drivers/gpu/drm/pl111/pl111_vexpress.c b/drivers/gpu/drm/pl111/pl111_vexpress.c |
804 |
+index a534b225e31b..5fa0441bb6df 100644 |
805 |
+--- a/drivers/gpu/drm/pl111/pl111_vexpress.c |
806 |
++++ b/drivers/gpu/drm/pl111/pl111_vexpress.c |
807 |
+@@ -111,7 +111,8 @@ static int vexpress_muxfpga_probe(struct platform_device *pdev) |
808 |
+ } |
809 |
+ |
810 |
+ static const struct of_device_id vexpress_muxfpga_match[] = { |
811 |
+- { .compatible = "arm,vexpress-muxfpga", } |
812 |
++ { .compatible = "arm,vexpress-muxfpga", }, |
813 |
++ {} |
814 |
+ }; |
815 |
+ |
816 |
+ static struct platform_driver vexpress_muxfpga_driver = { |
817 |
+diff --git a/drivers/hwmon/nct6775.c b/drivers/hwmon/nct6775.c |
818 |
+index b89e8379d898..8859f5572885 100644 |
819 |
+--- a/drivers/hwmon/nct6775.c |
820 |
++++ b/drivers/hwmon/nct6775.c |
821 |
+@@ -207,8 +207,6 @@ superio_exit(int ioreg) |
822 |
+ |
823 |
+ #define NUM_FAN 7 |
824 |
+ |
825 |
+-#define TEMP_SOURCE_VIRTUAL 0x1f |
826 |
+- |
827 |
+ /* Common and NCT6775 specific data */ |
828 |
+ |
829 |
+ /* Voltage min/max registers for nr=7..14 are in bank 5 */ |
830 |
+@@ -299,8 +297,9 @@ static const u16 NCT6775_REG_PWM_READ[] = { |
831 |
+ |
832 |
+ static const u16 NCT6775_REG_FAN[] = { 0x630, 0x632, 0x634, 0x636, 0x638 }; |
833 |
+ static const u16 NCT6775_REG_FAN_MIN[] = { 0x3b, 0x3c, 0x3d }; |
834 |
+-static const u16 NCT6775_REG_FAN_PULSES[] = { 0x641, 0x642, 0x643, 0x644, 0 }; |
835 |
+-static const u16 NCT6775_FAN_PULSE_SHIFT[] = { 0, 0, 0, 0, 0, 0 }; |
836 |
++static const u16 NCT6775_REG_FAN_PULSES[NUM_FAN] = { |
837 |
++ 0x641, 0x642, 0x643, 0x644 }; |
838 |
++static const u16 NCT6775_FAN_PULSE_SHIFT[NUM_FAN] = { }; |
839 |
+ |
840 |
+ static const u16 NCT6775_REG_TEMP[] = { |
841 |
+ 0x27, 0x150, 0x250, 0x62b, 0x62c, 0x62d }; |
842 |
+@@ -373,6 +372,7 @@ static const char *const nct6775_temp_label[] = { |
843 |
+ }; |
844 |
+ |
845 |
+ #define NCT6775_TEMP_MASK 0x001ffffe |
846 |
++#define NCT6775_VIRT_TEMP_MASK 0x00000000 |
847 |
+ |
848 |
+ static const u16 NCT6775_REG_TEMP_ALTERNATE[32] = { |
849 |
+ [13] = 0x661, |
850 |
+@@ -425,8 +425,8 @@ static const u8 NCT6776_PWM_MODE_MASK[] = { 0x01, 0, 0, 0, 0, 0 }; |
851 |
+ |
852 |
+ static const u16 NCT6776_REG_FAN_MIN[] = { |
853 |
+ 0x63a, 0x63c, 0x63e, 0x640, 0x642, 0x64a, 0x64c }; |
854 |
+-static const u16 NCT6776_REG_FAN_PULSES[] = { |
855 |
+- 0x644, 0x645, 0x646, 0x647, 0x648, 0x649, 0 }; |
856 |
++static const u16 NCT6776_REG_FAN_PULSES[NUM_FAN] = { |
857 |
++ 0x644, 0x645, 0x646, 0x647, 0x648, 0x649 }; |
858 |
+ |
859 |
+ static const u16 NCT6776_REG_WEIGHT_DUTY_BASE[] = { |
860 |
+ 0x13e, 0x23e, 0x33e, 0x83e, 0x93e, 0xa3e }; |
861 |
+@@ -461,6 +461,7 @@ static const char *const nct6776_temp_label[] = { |
862 |
+ }; |
863 |
+ |
864 |
+ #define NCT6776_TEMP_MASK 0x007ffffe |
865 |
++#define NCT6776_VIRT_TEMP_MASK 0x00000000 |
866 |
+ |
867 |
+ static const u16 NCT6776_REG_TEMP_ALTERNATE[32] = { |
868 |
+ [14] = 0x401, |
869 |
+@@ -501,9 +502,9 @@ static const s8 NCT6779_BEEP_BITS[] = { |
870 |
+ 30, 31 }; /* intrusion0, intrusion1 */ |
871 |
+ |
872 |
+ static const u16 NCT6779_REG_FAN[] = { |
873 |
+- 0x4b0, 0x4b2, 0x4b4, 0x4b6, 0x4b8, 0x4ba, 0x660 }; |
874 |
+-static const u16 NCT6779_REG_FAN_PULSES[] = { |
875 |
+- 0x644, 0x645, 0x646, 0x647, 0x648, 0x649, 0 }; |
876 |
++ 0x4c0, 0x4c2, 0x4c4, 0x4c6, 0x4c8, 0x4ca, 0x4ce }; |
877 |
++static const u16 NCT6779_REG_FAN_PULSES[NUM_FAN] = { |
878 |
++ 0x644, 0x645, 0x646, 0x647, 0x648, 0x649 }; |
879 |
+ |
880 |
+ static const u16 NCT6779_REG_CRITICAL_PWM_ENABLE[] = { |
881 |
+ 0x136, 0x236, 0x336, 0x836, 0x936, 0xa36, 0xb36 }; |
882 |
+@@ -559,7 +560,9 @@ static const char *const nct6779_temp_label[] = { |
883 |
+ }; |
884 |
+ |
885 |
+ #define NCT6779_TEMP_MASK 0x07ffff7e |
886 |
++#define NCT6779_VIRT_TEMP_MASK 0x00000000 |
887 |
+ #define NCT6791_TEMP_MASK 0x87ffff7e |
888 |
++#define NCT6791_VIRT_TEMP_MASK 0x80000000 |
889 |
+ |
890 |
+ static const u16 NCT6779_REG_TEMP_ALTERNATE[32] |
891 |
+ = { 0x490, 0x491, 0x492, 0x493, 0x494, 0x495, 0, 0, |
892 |
+@@ -638,6 +641,7 @@ static const char *const nct6792_temp_label[] = { |
893 |
+ }; |
894 |
+ |
895 |
+ #define NCT6792_TEMP_MASK 0x9fffff7e |
896 |
++#define NCT6792_VIRT_TEMP_MASK 0x80000000 |
897 |
+ |
898 |
+ static const char *const nct6793_temp_label[] = { |
899 |
+ "", |
900 |
+@@ -675,6 +679,7 @@ static const char *const nct6793_temp_label[] = { |
901 |
+ }; |
902 |
+ |
903 |
+ #define NCT6793_TEMP_MASK 0xbfff037e |
904 |
++#define NCT6793_VIRT_TEMP_MASK 0x80000000 |
905 |
+ |
906 |
+ static const char *const nct6795_temp_label[] = { |
907 |
+ "", |
908 |
+@@ -712,6 +717,7 @@ static const char *const nct6795_temp_label[] = { |
909 |
+ }; |
910 |
+ |
911 |
+ #define NCT6795_TEMP_MASK 0xbfffff7e |
912 |
++#define NCT6795_VIRT_TEMP_MASK 0x80000000 |
913 |
+ |
914 |
+ static const char *const nct6796_temp_label[] = { |
915 |
+ "", |
916 |
+@@ -724,8 +730,8 @@ static const char *const nct6796_temp_label[] = { |
917 |
+ "AUXTIN4", |
918 |
+ "SMBUSMASTER 0", |
919 |
+ "SMBUSMASTER 1", |
920 |
+- "", |
921 |
+- "", |
922 |
++ "Virtual_TEMP", |
923 |
++ "Virtual_TEMP", |
924 |
+ "", |
925 |
+ "", |
926 |
+ "", |
927 |
+@@ -748,7 +754,8 @@ static const char *const nct6796_temp_label[] = { |
928 |
+ "Virtual_TEMP" |
929 |
+ }; |
930 |
+ |
931 |
+-#define NCT6796_TEMP_MASK 0xbfff03fe |
932 |
++#define NCT6796_TEMP_MASK 0xbfff0ffe |
933 |
++#define NCT6796_VIRT_TEMP_MASK 0x80000c00 |
934 |
+ |
935 |
+ /* NCT6102D/NCT6106D specific data */ |
936 |
+ |
937 |
+@@ -779,8 +786,8 @@ static const u16 NCT6106_REG_TEMP_CONFIG[] = { |
938 |
+ |
939 |
+ static const u16 NCT6106_REG_FAN[] = { 0x20, 0x22, 0x24 }; |
940 |
+ static const u16 NCT6106_REG_FAN_MIN[] = { 0xe0, 0xe2, 0xe4 }; |
941 |
+-static const u16 NCT6106_REG_FAN_PULSES[] = { 0xf6, 0xf6, 0xf6, 0, 0 }; |
942 |
+-static const u16 NCT6106_FAN_PULSE_SHIFT[] = { 0, 2, 4, 0, 0 }; |
943 |
++static const u16 NCT6106_REG_FAN_PULSES[] = { 0xf6, 0xf6, 0xf6 }; |
944 |
++static const u16 NCT6106_FAN_PULSE_SHIFT[] = { 0, 2, 4 }; |
945 |
+ |
946 |
+ static const u8 NCT6106_REG_PWM_MODE[] = { 0xf3, 0xf3, 0xf3 }; |
947 |
+ static const u8 NCT6106_PWM_MODE_MASK[] = { 0x01, 0x02, 0x04 }; |
948 |
+@@ -917,6 +924,11 @@ static unsigned int fan_from_reg16(u16 reg, unsigned int divreg) |
949 |
+ return 1350000U / (reg << divreg); |
950 |
+ } |
951 |
+ |
952 |
++static unsigned int fan_from_reg_rpm(u16 reg, unsigned int divreg) |
953 |
++{ |
954 |
++ return reg; |
955 |
++} |
956 |
++ |
957 |
+ static u16 fan_to_reg(u32 fan, unsigned int divreg) |
958 |
+ { |
959 |
+ if (!fan) |
960 |
+@@ -969,6 +981,7 @@ struct nct6775_data { |
961 |
+ u16 reg_temp_config[NUM_TEMP]; |
962 |
+ const char * const *temp_label; |
963 |
+ u32 temp_mask; |
964 |
++ u32 virt_temp_mask; |
965 |
+ |
966 |
+ u16 REG_CONFIG; |
967 |
+ u16 REG_VBAT; |
968 |
+@@ -1276,11 +1289,11 @@ static bool is_word_sized(struct nct6775_data *data, u16 reg) |
969 |
+ case nct6795: |
970 |
+ case nct6796: |
971 |
+ return reg == 0x150 || reg == 0x153 || reg == 0x155 || |
972 |
+- ((reg & 0xfff0) == 0x4b0 && (reg & 0x000f) < 0x0b) || |
973 |
++ (reg & 0xfff0) == 0x4c0 || |
974 |
+ reg == 0x402 || |
975 |
+ reg == 0x63a || reg == 0x63c || reg == 0x63e || |
976 |
+ reg == 0x640 || reg == 0x642 || reg == 0x64a || |
977 |
+- reg == 0x64c || reg == 0x660 || |
978 |
++ reg == 0x64c || |
979 |
+ reg == 0x73 || reg == 0x75 || reg == 0x77 || reg == 0x79 || |
980 |
+ reg == 0x7b || reg == 0x7d; |
981 |
+ } |
982 |
+@@ -1682,9 +1695,13 @@ static struct nct6775_data *nct6775_update_device(struct device *dev) |
983 |
+ if (data->has_fan_min & BIT(i)) |
984 |
+ data->fan_min[i] = nct6775_read_value(data, |
985 |
+ data->REG_FAN_MIN[i]); |
986 |
+- data->fan_pulses[i] = |
987 |
+- (nct6775_read_value(data, data->REG_FAN_PULSES[i]) |
988 |
+- >> data->FAN_PULSE_SHIFT[i]) & 0x03; |
989 |
++ |
990 |
++ if (data->REG_FAN_PULSES[i]) { |
991 |
++ data->fan_pulses[i] = |
992 |
++ (nct6775_read_value(data, |
993 |
++ data->REG_FAN_PULSES[i]) |
994 |
++ >> data->FAN_PULSE_SHIFT[i]) & 0x03; |
995 |
++ } |
996 |
+ |
997 |
+ nct6775_select_fan_div(dev, data, i, reg); |
998 |
+ } |
999 |
+@@ -3639,6 +3656,7 @@ static int nct6775_probe(struct platform_device *pdev) |
1000 |
+ |
1001 |
+ data->temp_label = nct6776_temp_label; |
1002 |
+ data->temp_mask = NCT6776_TEMP_MASK; |
1003 |
++ data->virt_temp_mask = NCT6776_VIRT_TEMP_MASK; |
1004 |
+ |
1005 |
+ data->REG_VBAT = NCT6106_REG_VBAT; |
1006 |
+ data->REG_DIODE = NCT6106_REG_DIODE; |
1007 |
+@@ -3717,6 +3735,7 @@ static int nct6775_probe(struct platform_device *pdev) |
1008 |
+ |
1009 |
+ data->temp_label = nct6775_temp_label; |
1010 |
+ data->temp_mask = NCT6775_TEMP_MASK; |
1011 |
++ data->virt_temp_mask = NCT6775_VIRT_TEMP_MASK; |
1012 |
+ |
1013 |
+ data->REG_CONFIG = NCT6775_REG_CONFIG; |
1014 |
+ data->REG_VBAT = NCT6775_REG_VBAT; |
1015 |
+@@ -3789,6 +3808,7 @@ static int nct6775_probe(struct platform_device *pdev) |
1016 |
+ |
1017 |
+ data->temp_label = nct6776_temp_label; |
1018 |
+ data->temp_mask = NCT6776_TEMP_MASK; |
1019 |
++ data->virt_temp_mask = NCT6776_VIRT_TEMP_MASK; |
1020 |
+ |
1021 |
+ data->REG_CONFIG = NCT6775_REG_CONFIG; |
1022 |
+ data->REG_VBAT = NCT6775_REG_VBAT; |
1023 |
+@@ -3853,7 +3873,7 @@ static int nct6775_probe(struct platform_device *pdev) |
1024 |
+ data->ALARM_BITS = NCT6779_ALARM_BITS; |
1025 |
+ data->BEEP_BITS = NCT6779_BEEP_BITS; |
1026 |
+ |
1027 |
+- data->fan_from_reg = fan_from_reg13; |
1028 |
++ data->fan_from_reg = fan_from_reg_rpm; |
1029 |
+ data->fan_from_reg_min = fan_from_reg13; |
1030 |
+ data->target_temp_mask = 0xff; |
1031 |
+ data->tolerance_mask = 0x07; |
1032 |
+@@ -3861,6 +3881,7 @@ static int nct6775_probe(struct platform_device *pdev) |
1033 |
+ |
1034 |
+ data->temp_label = nct6779_temp_label; |
1035 |
+ data->temp_mask = NCT6779_TEMP_MASK; |
1036 |
++ data->virt_temp_mask = NCT6779_VIRT_TEMP_MASK; |
1037 |
+ |
1038 |
+ data->REG_CONFIG = NCT6775_REG_CONFIG; |
1039 |
+ data->REG_VBAT = NCT6775_REG_VBAT; |
1040 |
+@@ -3933,7 +3954,7 @@ static int nct6775_probe(struct platform_device *pdev) |
1041 |
+ data->ALARM_BITS = NCT6791_ALARM_BITS; |
1042 |
+ data->BEEP_BITS = NCT6779_BEEP_BITS; |
1043 |
+ |
1044 |
+- data->fan_from_reg = fan_from_reg13; |
1045 |
++ data->fan_from_reg = fan_from_reg_rpm; |
1046 |
+ data->fan_from_reg_min = fan_from_reg13; |
1047 |
+ data->target_temp_mask = 0xff; |
1048 |
+ data->tolerance_mask = 0x07; |
1049 |
+@@ -3944,22 +3965,27 @@ static int nct6775_probe(struct platform_device *pdev) |
1050 |
+ case nct6791: |
1051 |
+ data->temp_label = nct6779_temp_label; |
1052 |
+ data->temp_mask = NCT6791_TEMP_MASK; |
1053 |
++ data->virt_temp_mask = NCT6791_VIRT_TEMP_MASK; |
1054 |
+ break; |
1055 |
+ case nct6792: |
1056 |
+ data->temp_label = nct6792_temp_label; |
1057 |
+ data->temp_mask = NCT6792_TEMP_MASK; |
1058 |
++ data->virt_temp_mask = NCT6792_VIRT_TEMP_MASK; |
1059 |
+ break; |
1060 |
+ case nct6793: |
1061 |
+ data->temp_label = nct6793_temp_label; |
1062 |
+ data->temp_mask = NCT6793_TEMP_MASK; |
1063 |
++ data->virt_temp_mask = NCT6793_VIRT_TEMP_MASK; |
1064 |
+ break; |
1065 |
+ case nct6795: |
1066 |
+ data->temp_label = nct6795_temp_label; |
1067 |
+ data->temp_mask = NCT6795_TEMP_MASK; |
1068 |
++ data->virt_temp_mask = NCT6795_VIRT_TEMP_MASK; |
1069 |
+ break; |
1070 |
+ case nct6796: |
1071 |
+ data->temp_label = nct6796_temp_label; |
1072 |
+ data->temp_mask = NCT6796_TEMP_MASK; |
1073 |
++ data->virt_temp_mask = NCT6796_VIRT_TEMP_MASK; |
1074 |
+ break; |
1075 |
+ } |
1076 |
+ |
1077 |
+@@ -4143,7 +4169,7 @@ static int nct6775_probe(struct platform_device *pdev) |
1078 |
+ * for each fan reflects a different temperature, and there |
1079 |
+ * are no duplicates. |
1080 |
+ */ |
1081 |
+- if (src != TEMP_SOURCE_VIRTUAL) { |
1082 |
++ if (!(data->virt_temp_mask & BIT(src))) { |
1083 |
+ if (mask & BIT(src)) |
1084 |
+ continue; |
1085 |
+ mask |= BIT(src); |
1086 |
+diff --git a/drivers/i2c/busses/i2c-scmi.c b/drivers/i2c/busses/i2c-scmi.c |
1087 |
+index a01389b85f13..7e9a2bbf5ddc 100644 |
1088 |
+--- a/drivers/i2c/busses/i2c-scmi.c |
1089 |
++++ b/drivers/i2c/busses/i2c-scmi.c |
1090 |
+@@ -152,6 +152,7 @@ acpi_smbus_cmi_access(struct i2c_adapter *adap, u16 addr, unsigned short flags, |
1091 |
+ mt_params[3].type = ACPI_TYPE_INTEGER; |
1092 |
+ mt_params[3].integer.value = len; |
1093 |
+ mt_params[4].type = ACPI_TYPE_BUFFER; |
1094 |
++ mt_params[4].buffer.length = len; |
1095 |
+ mt_params[4].buffer.pointer = data->block + 1; |
1096 |
+ } |
1097 |
+ break; |
1098 |
+diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c |
1099 |
+index cd620e009bad..d4b9db487b16 100644 |
1100 |
+--- a/drivers/input/joystick/xpad.c |
1101 |
++++ b/drivers/input/joystick/xpad.c |
1102 |
+@@ -231,6 +231,7 @@ static const struct xpad_device { |
1103 |
+ { 0x0e6f, 0x0246, "Rock Candy Gamepad for Xbox One 2015", 0, XTYPE_XBOXONE }, |
1104 |
+ { 0x0e6f, 0x02ab, "PDP Controller for Xbox One", 0, XTYPE_XBOXONE }, |
1105 |
+ { 0x0e6f, 0x02a4, "PDP Wired Controller for Xbox One - Stealth Series", 0, XTYPE_XBOXONE }, |
1106 |
++ { 0x0e6f, 0x02a6, "PDP Wired Controller for Xbox One - Camo Series", 0, XTYPE_XBOXONE }, |
1107 |
+ { 0x0e6f, 0x0301, "Logic3 Controller", 0, XTYPE_XBOX360 }, |
1108 |
+ { 0x0e6f, 0x0346, "Rock Candy Gamepad for Xbox One 2016", 0, XTYPE_XBOXONE }, |
1109 |
+ { 0x0e6f, 0x0401, "Logic3 Controller", 0, XTYPE_XBOX360 }, |
1110 |
+@@ -530,6 +531,8 @@ static const struct xboxone_init_packet xboxone_init_packets[] = { |
1111 |
+ XBOXONE_INIT_PKT(0x0e6f, 0x02ab, xboxone_pdp_init2), |
1112 |
+ XBOXONE_INIT_PKT(0x0e6f, 0x02a4, xboxone_pdp_init1), |
1113 |
+ XBOXONE_INIT_PKT(0x0e6f, 0x02a4, xboxone_pdp_init2), |
1114 |
++ XBOXONE_INIT_PKT(0x0e6f, 0x02a6, xboxone_pdp_init1), |
1115 |
++ XBOXONE_INIT_PKT(0x0e6f, 0x02a6, xboxone_pdp_init2), |
1116 |
+ XBOXONE_INIT_PKT(0x24c6, 0x541a, xboxone_rumblebegin_init), |
1117 |
+ XBOXONE_INIT_PKT(0x24c6, 0x542a, xboxone_rumblebegin_init), |
1118 |
+ XBOXONE_INIT_PKT(0x24c6, 0x543a, xboxone_rumblebegin_init), |
1119 |
+diff --git a/drivers/md/dm-cache-target.c b/drivers/md/dm-cache-target.c |
1120 |
+index a39ae8f45e32..32379e0ac536 100644 |
1121 |
+--- a/drivers/md/dm-cache-target.c |
1122 |
++++ b/drivers/md/dm-cache-target.c |
1123 |
+@@ -3492,14 +3492,13 @@ static int __init dm_cache_init(void) |
1124 |
+ int r; |
1125 |
+ |
1126 |
+ migration_cache = KMEM_CACHE(dm_cache_migration, 0); |
1127 |
+- if (!migration_cache) { |
1128 |
+- dm_unregister_target(&cache_target); |
1129 |
++ if (!migration_cache) |
1130 |
+ return -ENOMEM; |
1131 |
+- } |
1132 |
+ |
1133 |
+ r = dm_register_target(&cache_target); |
1134 |
+ if (r) { |
1135 |
+ DMERR("cache target registration failed: %d", r); |
1136 |
++ kmem_cache_destroy(migration_cache); |
1137 |
+ return r; |
1138 |
+ } |
1139 |
+ |
1140 |
+diff --git a/drivers/md/dm-flakey.c b/drivers/md/dm-flakey.c |
1141 |
+index 21d126a5078c..32aabe27b37c 100644 |
1142 |
+--- a/drivers/md/dm-flakey.c |
1143 |
++++ b/drivers/md/dm-flakey.c |
1144 |
+@@ -467,7 +467,9 @@ static int flakey_iterate_devices(struct dm_target *ti, iterate_devices_callout_ |
1145 |
+ static struct target_type flakey_target = { |
1146 |
+ .name = "flakey", |
1147 |
+ .version = {1, 5, 0}, |
1148 |
++#ifdef CONFIG_BLK_DEV_ZONED |
1149 |
+ .features = DM_TARGET_ZONED_HM, |
1150 |
++#endif |
1151 |
+ .module = THIS_MODULE, |
1152 |
+ .ctr = flakey_ctr, |
1153 |
+ .dtr = flakey_dtr, |
1154 |
+diff --git a/drivers/md/dm-linear.c b/drivers/md/dm-linear.c |
1155 |
+index d10964d41fd7..2f7c44a006c4 100644 |
1156 |
+--- a/drivers/md/dm-linear.c |
1157 |
++++ b/drivers/md/dm-linear.c |
1158 |
+@@ -102,6 +102,7 @@ static int linear_map(struct dm_target *ti, struct bio *bio) |
1159 |
+ return DM_MAPIO_REMAPPED; |
1160 |
+ } |
1161 |
+ |
1162 |
++#ifdef CONFIG_BLK_DEV_ZONED |
1163 |
+ static int linear_end_io(struct dm_target *ti, struct bio *bio, |
1164 |
+ blk_status_t *error) |
1165 |
+ { |
1166 |
+@@ -112,6 +113,7 @@ static int linear_end_io(struct dm_target *ti, struct bio *bio, |
1167 |
+ |
1168 |
+ return DM_ENDIO_DONE; |
1169 |
+ } |
1170 |
++#endif |
1171 |
+ |
1172 |
+ static void linear_status(struct dm_target *ti, status_type_t type, |
1173 |
+ unsigned status_flags, char *result, unsigned maxlen) |
1174 |
+@@ -208,12 +210,16 @@ static size_t linear_dax_copy_to_iter(struct dm_target *ti, pgoff_t pgoff, |
1175 |
+ static struct target_type linear_target = { |
1176 |
+ .name = "linear", |
1177 |
+ .version = {1, 4, 0}, |
1178 |
++#ifdef CONFIG_BLK_DEV_ZONED |
1179 |
++ .end_io = linear_end_io, |
1180 |
+ .features = DM_TARGET_PASSES_INTEGRITY | DM_TARGET_ZONED_HM, |
1181 |
++#else |
1182 |
++ .features = DM_TARGET_PASSES_INTEGRITY, |
1183 |
++#endif |
1184 |
+ .module = THIS_MODULE, |
1185 |
+ .ctr = linear_ctr, |
1186 |
+ .dtr = linear_dtr, |
1187 |
+ .map = linear_map, |
1188 |
+- .end_io = linear_end_io, |
1189 |
+ .status = linear_status, |
1190 |
+ .prepare_ioctl = linear_prepare_ioctl, |
1191 |
+ .iterate_devices = linear_iterate_devices, |
1192 |
+diff --git a/drivers/md/dm.c b/drivers/md/dm.c |
1193 |
+index b0dd7027848b..4ad8312d5b8d 100644 |
1194 |
+--- a/drivers/md/dm.c |
1195 |
++++ b/drivers/md/dm.c |
1196 |
+@@ -1153,12 +1153,14 @@ void dm_accept_partial_bio(struct bio *bio, unsigned n_sectors) |
1197 |
+ EXPORT_SYMBOL_GPL(dm_accept_partial_bio); |
1198 |
+ |
1199 |
+ /* |
1200 |
+- * The zone descriptors obtained with a zone report indicate |
1201 |
+- * zone positions within the target device. The zone descriptors |
1202 |
+- * must be remapped to match their position within the dm device. |
1203 |
+- * A target may call dm_remap_zone_report after completion of a |
1204 |
+- * REQ_OP_ZONE_REPORT bio to remap the zone descriptors obtained |
1205 |
+- * from the target device mapping to the dm device. |
1206 |
++ * The zone descriptors obtained with a zone report indicate zone positions |
1207 |
++ * within the target backing device, regardless of that device is a partition |
1208 |
++ * and regardless of the target mapping start sector on the device or partition. |
1209 |
++ * The zone descriptors start sector and write pointer position must be adjusted |
1210 |
++ * to match their relative position within the dm device. |
1211 |
++ * A target may call dm_remap_zone_report() after completion of a |
1212 |
++ * REQ_OP_ZONE_REPORT bio to remap the zone descriptors obtained from the |
1213 |
++ * backing device. |
1214 |
+ */ |
1215 |
+ void dm_remap_zone_report(struct dm_target *ti, struct bio *bio, sector_t start) |
1216 |
+ { |
1217 |
+@@ -1169,6 +1171,7 @@ void dm_remap_zone_report(struct dm_target *ti, struct bio *bio, sector_t start) |
1218 |
+ struct blk_zone *zone; |
1219 |
+ unsigned int nr_rep = 0; |
1220 |
+ unsigned int ofst; |
1221 |
++ sector_t part_offset; |
1222 |
+ struct bio_vec bvec; |
1223 |
+ struct bvec_iter iter; |
1224 |
+ void *addr; |
1225 |
+@@ -1176,6 +1179,15 @@ void dm_remap_zone_report(struct dm_target *ti, struct bio *bio, sector_t start) |
1226 |
+ if (bio->bi_status) |
1227 |
+ return; |
1228 |
+ |
1229 |
++ /* |
1230 |
++ * bio sector was incremented by the request size on completion. Taking |
1231 |
++ * into account the original request sector, the target start offset on |
1232 |
++ * the backing device and the target mapping offset (ti->begin), the |
1233 |
++ * start sector of the backing device. The partition offset is always 0 |
1234 |
++ * if the target uses a whole device. |
1235 |
++ */ |
1236 |
++ part_offset = bio->bi_iter.bi_sector + ti->begin - (start + bio_end_sector(report_bio)); |
1237 |
++ |
1238 |
+ /* |
1239 |
+ * Remap the start sector of the reported zones. For sequential zones, |
1240 |
+ * also remap the write pointer position. |
1241 |
+@@ -1193,6 +1205,7 @@ void dm_remap_zone_report(struct dm_target *ti, struct bio *bio, sector_t start) |
1242 |
+ /* Set zones start sector */ |
1243 |
+ while (hdr->nr_zones && ofst < bvec.bv_len) { |
1244 |
+ zone = addr + ofst; |
1245 |
++ zone->start -= part_offset; |
1246 |
+ if (zone->start >= start + ti->len) { |
1247 |
+ hdr->nr_zones = 0; |
1248 |
+ break; |
1249 |
+@@ -1204,7 +1217,7 @@ void dm_remap_zone_report(struct dm_target *ti, struct bio *bio, sector_t start) |
1250 |
+ else if (zone->cond == BLK_ZONE_COND_EMPTY) |
1251 |
+ zone->wp = zone->start; |
1252 |
+ else |
1253 |
+- zone->wp = zone->wp + ti->begin - start; |
1254 |
++ zone->wp = zone->wp + ti->begin - start - part_offset; |
1255 |
+ } |
1256 |
+ ofst += sizeof(struct blk_zone); |
1257 |
+ hdr->nr_zones--; |
1258 |
+diff --git a/drivers/mfd/omap-usb-host.c b/drivers/mfd/omap-usb-host.c |
1259 |
+index e11ab12fbdf2..800986a79704 100644 |
1260 |
+--- a/drivers/mfd/omap-usb-host.c |
1261 |
++++ b/drivers/mfd/omap-usb-host.c |
1262 |
+@@ -528,8 +528,8 @@ static int usbhs_omap_get_dt_pdata(struct device *dev, |
1263 |
+ } |
1264 |
+ |
1265 |
+ static const struct of_device_id usbhs_child_match_table[] = { |
1266 |
+- { .compatible = "ti,omap-ehci", }, |
1267 |
+- { .compatible = "ti,omap-ohci", }, |
1268 |
++ { .compatible = "ti,ehci-omap", }, |
1269 |
++ { .compatible = "ti,ohci-omap3", }, |
1270 |
+ { } |
1271 |
+ }; |
1272 |
+ |
1273 |
+@@ -855,6 +855,7 @@ static struct platform_driver usbhs_omap_driver = { |
1274 |
+ .pm = &usbhsomap_dev_pm_ops, |
1275 |
+ .of_match_table = usbhs_omap_dt_ids, |
1276 |
+ }, |
1277 |
++ .probe = usbhs_omap_probe, |
1278 |
+ .remove = usbhs_omap_remove, |
1279 |
+ }; |
1280 |
+ |
1281 |
+@@ -864,9 +865,9 @@ MODULE_ALIAS("platform:" USBHS_DRIVER_NAME); |
1282 |
+ MODULE_LICENSE("GPL v2"); |
1283 |
+ MODULE_DESCRIPTION("usb host common core driver for omap EHCI and OHCI"); |
1284 |
+ |
1285 |
+-static int __init omap_usbhs_drvinit(void) |
1286 |
++static int omap_usbhs_drvinit(void) |
1287 |
+ { |
1288 |
+- return platform_driver_probe(&usbhs_omap_driver, usbhs_omap_probe); |
1289 |
++ return platform_driver_register(&usbhs_omap_driver); |
1290 |
+ } |
1291 |
+ |
1292 |
+ /* |
1293 |
+@@ -878,7 +879,7 @@ static int __init omap_usbhs_drvinit(void) |
1294 |
+ */ |
1295 |
+ fs_initcall_sync(omap_usbhs_drvinit); |
1296 |
+ |
1297 |
+-static void __exit omap_usbhs_drvexit(void) |
1298 |
++static void omap_usbhs_drvexit(void) |
1299 |
+ { |
1300 |
+ platform_driver_unregister(&usbhs_omap_driver); |
1301 |
+ } |
1302 |
+diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c |
1303 |
+index a0b9102c4c6e..e201ccb3fda4 100644 |
1304 |
+--- a/drivers/mmc/core/block.c |
1305 |
++++ b/drivers/mmc/core/block.c |
1306 |
+@@ -1370,6 +1370,16 @@ static void mmc_blk_data_prep(struct mmc_queue *mq, struct mmc_queue_req *mqrq, |
1307 |
+ brq->data.blocks = card->host->max_blk_count; |
1308 |
+ |
1309 |
+ if (brq->data.blocks > 1) { |
1310 |
++ /* |
1311 |
++ * Some SD cards in SPI mode return a CRC error or even lock up |
1312 |
++ * completely when trying to read the last block using a |
1313 |
++ * multiblock read command. |
1314 |
++ */ |
1315 |
++ if (mmc_host_is_spi(card->host) && (rq_data_dir(req) == READ) && |
1316 |
++ (blk_rq_pos(req) + blk_rq_sectors(req) == |
1317 |
++ get_capacity(md->disk))) |
1318 |
++ brq->data.blocks--; |
1319 |
++ |
1320 |
+ /* |
1321 |
+ * After a read error, we redo the request one sector |
1322 |
+ * at a time in order to accurately determine which |
1323 |
+diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c |
1324 |
+index 217b790d22ed..2b01180be834 100644 |
1325 |
+--- a/drivers/net/bonding/bond_main.c |
1326 |
++++ b/drivers/net/bonding/bond_main.c |
1327 |
+@@ -210,6 +210,7 @@ static void bond_get_stats(struct net_device *bond_dev, |
1328 |
+ static void bond_slave_arr_handler(struct work_struct *work); |
1329 |
+ static bool bond_time_in_interval(struct bonding *bond, unsigned long last_act, |
1330 |
+ int mod); |
1331 |
++static void bond_netdev_notify_work(struct work_struct *work); |
1332 |
+ |
1333 |
+ /*---------------------------- General routines -----------------------------*/ |
1334 |
+ |
1335 |
+@@ -1177,9 +1178,27 @@ static rx_handler_result_t bond_handle_frame(struct sk_buff **pskb) |
1336 |
+ } |
1337 |
+ } |
1338 |
+ |
1339 |
+- /* don't change skb->dev for link-local packets */ |
1340 |
+- if (is_link_local_ether_addr(eth_hdr(skb)->h_dest)) |
1341 |
++ /* Link-local multicast packets should be passed to the |
1342 |
++ * stack on the link they arrive as well as pass them to the |
1343 |
++ * bond-master device. These packets are mostly usable when |
1344 |
++ * stack receives it with the link on which they arrive |
1345 |
++ * (e.g. LLDP) they also must be available on master. Some of |
1346 |
++ * the use cases include (but are not limited to): LLDP agents |
1347 |
++ * that must be able to operate both on enslaved interfaces as |
1348 |
++ * well as on bonds themselves; linux bridges that must be able |
1349 |
++ * to process/pass BPDUs from attached bonds when any kind of |
1350 |
++ * STP version is enabled on the network. |
1351 |
++ */ |
1352 |
++ if (is_link_local_ether_addr(eth_hdr(skb)->h_dest)) { |
1353 |
++ struct sk_buff *nskb = skb_clone(skb, GFP_ATOMIC); |
1354 |
++ |
1355 |
++ if (nskb) { |
1356 |
++ nskb->dev = bond->dev; |
1357 |
++ nskb->queue_mapping = 0; |
1358 |
++ netif_rx(nskb); |
1359 |
++ } |
1360 |
+ return RX_HANDLER_PASS; |
1361 |
++ } |
1362 |
+ if (bond_should_deliver_exact_match(skb, slave, bond)) |
1363 |
+ return RX_HANDLER_EXACT; |
1364 |
+ |
1365 |
+@@ -1276,6 +1295,8 @@ static struct slave *bond_alloc_slave(struct bonding *bond) |
1366 |
+ return NULL; |
1367 |
+ } |
1368 |
+ } |
1369 |
++ INIT_DELAYED_WORK(&slave->notify_work, bond_netdev_notify_work); |
1370 |
++ |
1371 |
+ return slave; |
1372 |
+ } |
1373 |
+ |
1374 |
+@@ -1283,6 +1304,7 @@ static void bond_free_slave(struct slave *slave) |
1375 |
+ { |
1376 |
+ struct bonding *bond = bond_get_bond_by_slave(slave); |
1377 |
+ |
1378 |
++ cancel_delayed_work_sync(&slave->notify_work); |
1379 |
+ if (BOND_MODE(bond) == BOND_MODE_8023AD) |
1380 |
+ kfree(SLAVE_AD_INFO(slave)); |
1381 |
+ |
1382 |
+@@ -1304,39 +1326,26 @@ static void bond_fill_ifslave(struct slave *slave, struct ifslave *info) |
1383 |
+ info->link_failure_count = slave->link_failure_count; |
1384 |
+ } |
1385 |
+ |
1386 |
+-static void bond_netdev_notify(struct net_device *dev, |
1387 |
+- struct netdev_bonding_info *info) |
1388 |
+-{ |
1389 |
+- rtnl_lock(); |
1390 |
+- netdev_bonding_info_change(dev, info); |
1391 |
+- rtnl_unlock(); |
1392 |
+-} |
1393 |
+- |
1394 |
+ static void bond_netdev_notify_work(struct work_struct *_work) |
1395 |
+ { |
1396 |
+- struct netdev_notify_work *w = |
1397 |
+- container_of(_work, struct netdev_notify_work, work.work); |
1398 |
++ struct slave *slave = container_of(_work, struct slave, |
1399 |
++ notify_work.work); |
1400 |
++ |
1401 |
++ if (rtnl_trylock()) { |
1402 |
++ struct netdev_bonding_info binfo; |
1403 |
+ |
1404 |
+- bond_netdev_notify(w->dev, &w->bonding_info); |
1405 |
+- dev_put(w->dev); |
1406 |
+- kfree(w); |
1407 |
++ bond_fill_ifslave(slave, &binfo.slave); |
1408 |
++ bond_fill_ifbond(slave->bond, &binfo.master); |
1409 |
++ netdev_bonding_info_change(slave->dev, &binfo); |
1410 |
++ rtnl_unlock(); |
1411 |
++ } else { |
1412 |
++ queue_delayed_work(slave->bond->wq, &slave->notify_work, 1); |
1413 |
++ } |
1414 |
+ } |
1415 |
+ |
1416 |
+ void bond_queue_slave_event(struct slave *slave) |
1417 |
+ { |
1418 |
+- struct bonding *bond = slave->bond; |
1419 |
+- struct netdev_notify_work *nnw = kzalloc(sizeof(*nnw), GFP_ATOMIC); |
1420 |
+- |
1421 |
+- if (!nnw) |
1422 |
+- return; |
1423 |
+- |
1424 |
+- dev_hold(slave->dev); |
1425 |
+- nnw->dev = slave->dev; |
1426 |
+- bond_fill_ifslave(slave, &nnw->bonding_info.slave); |
1427 |
+- bond_fill_ifbond(bond, &nnw->bonding_info.master); |
1428 |
+- INIT_DELAYED_WORK(&nnw->work, bond_netdev_notify_work); |
1429 |
+- |
1430 |
+- queue_delayed_work(slave->bond->wq, &nnw->work, 0); |
1431 |
++ queue_delayed_work(slave->bond->wq, &slave->notify_work, 0); |
1432 |
+ } |
1433 |
+ |
1434 |
+ void bond_lower_state_changed(struct slave *slave) |
1435 |
+diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c |
1436 |
+index d93c790bfbe8..ad534b90ef21 100644 |
1437 |
+--- a/drivers/net/dsa/b53/b53_common.c |
1438 |
++++ b/drivers/net/dsa/b53/b53_common.c |
1439 |
+@@ -1107,7 +1107,7 @@ void b53_vlan_add(struct dsa_switch *ds, int port, |
1440 |
+ b53_get_vlan_entry(dev, vid, vl); |
1441 |
+ |
1442 |
+ vl->members |= BIT(port); |
1443 |
+- if (untagged) |
1444 |
++ if (untagged && !dsa_is_cpu_port(ds, port)) |
1445 |
+ vl->untag |= BIT(port); |
1446 |
+ else |
1447 |
+ vl->untag &= ~BIT(port); |
1448 |
+@@ -1149,7 +1149,7 @@ int b53_vlan_del(struct dsa_switch *ds, int port, |
1449 |
+ pvid = 0; |
1450 |
+ } |
1451 |
+ |
1452 |
+- if (untagged) |
1453 |
++ if (untagged && !dsa_is_cpu_port(ds, port)) |
1454 |
+ vl->untag &= ~(BIT(port)); |
1455 |
+ |
1456 |
+ b53_set_vlan_entry(dev, vid, vl); |
1457 |
+diff --git a/drivers/net/dsa/bcm_sf2.c b/drivers/net/dsa/bcm_sf2.c |
1458 |
+index 02e8982519ce..d73204767cbe 100644 |
1459 |
+--- a/drivers/net/dsa/bcm_sf2.c |
1460 |
++++ b/drivers/net/dsa/bcm_sf2.c |
1461 |
+@@ -698,7 +698,6 @@ static int bcm_sf2_sw_suspend(struct dsa_switch *ds) |
1462 |
+ static int bcm_sf2_sw_resume(struct dsa_switch *ds) |
1463 |
+ { |
1464 |
+ struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); |
1465 |
+- unsigned int port; |
1466 |
+ int ret; |
1467 |
+ |
1468 |
+ ret = bcm_sf2_sw_rst(priv); |
1469 |
+@@ -710,14 +709,7 @@ static int bcm_sf2_sw_resume(struct dsa_switch *ds) |
1470 |
+ if (priv->hw_params.num_gphy == 1) |
1471 |
+ bcm_sf2_gphy_enable_set(ds, true); |
1472 |
+ |
1473 |
+- for (port = 0; port < DSA_MAX_PORTS; port++) { |
1474 |
+- if (dsa_is_user_port(ds, port)) |
1475 |
+- bcm_sf2_port_setup(ds, port, NULL); |
1476 |
+- else if (dsa_is_cpu_port(ds, port)) |
1477 |
+- bcm_sf2_imp_setup(ds, port); |
1478 |
+- } |
1479 |
+- |
1480 |
+- bcm_sf2_enable_acb(ds); |
1481 |
++ ds->ops->setup(ds); |
1482 |
+ |
1483 |
+ return 0; |
1484 |
+ } |
1485 |
+@@ -1168,10 +1160,10 @@ static int bcm_sf2_sw_remove(struct platform_device *pdev) |
1486 |
+ { |
1487 |
+ struct bcm_sf2_priv *priv = platform_get_drvdata(pdev); |
1488 |
+ |
1489 |
+- /* Disable all ports and interrupts */ |
1490 |
+ priv->wol_ports_mask = 0; |
1491 |
+- bcm_sf2_sw_suspend(priv->dev->ds); |
1492 |
+ dsa_unregister_switch(priv->dev->ds); |
1493 |
++ /* Disable all ports and interrupts */ |
1494 |
++ bcm_sf2_sw_suspend(priv->dev->ds); |
1495 |
+ bcm_sf2_mdio_unregister(priv); |
1496 |
+ |
1497 |
+ return 0; |
1498 |
+diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_ring.c b/drivers/net/ethernet/aquantia/atlantic/aq_ring.c |
1499 |
+index b5f1f62e8e25..d1e1a0ba8615 100644 |
1500 |
+--- a/drivers/net/ethernet/aquantia/atlantic/aq_ring.c |
1501 |
++++ b/drivers/net/ethernet/aquantia/atlantic/aq_ring.c |
1502 |
+@@ -225,9 +225,10 @@ int aq_ring_rx_clean(struct aq_ring_s *self, |
1503 |
+ } |
1504 |
+ |
1505 |
+ /* for single fragment packets use build_skb() */ |
1506 |
+- if (buff->is_eop) { |
1507 |
++ if (buff->is_eop && |
1508 |
++ buff->len <= AQ_CFG_RX_FRAME_MAX - AQ_SKB_ALIGN) { |
1509 |
+ skb = build_skb(page_address(buff->page), |
1510 |
+- buff->len + AQ_SKB_ALIGN); |
1511 |
++ AQ_CFG_RX_FRAME_MAX); |
1512 |
+ if (unlikely(!skb)) { |
1513 |
+ err = -ENOMEM; |
1514 |
+ goto err_exit; |
1515 |
+@@ -247,18 +248,21 @@ int aq_ring_rx_clean(struct aq_ring_s *self, |
1516 |
+ buff->len - ETH_HLEN, |
1517 |
+ SKB_TRUESIZE(buff->len - ETH_HLEN)); |
1518 |
+ |
1519 |
+- for (i = 1U, next_ = buff->next, |
1520 |
+- buff_ = &self->buff_ring[next_]; true; |
1521 |
+- next_ = buff_->next, |
1522 |
+- buff_ = &self->buff_ring[next_], ++i) { |
1523 |
+- skb_add_rx_frag(skb, i, buff_->page, 0, |
1524 |
+- buff_->len, |
1525 |
+- SKB_TRUESIZE(buff->len - |
1526 |
+- ETH_HLEN)); |
1527 |
+- buff_->is_cleaned = 1; |
1528 |
+- |
1529 |
+- if (buff_->is_eop) |
1530 |
+- break; |
1531 |
++ if (!buff->is_eop) { |
1532 |
++ for (i = 1U, next_ = buff->next, |
1533 |
++ buff_ = &self->buff_ring[next_]; |
1534 |
++ true; next_ = buff_->next, |
1535 |
++ buff_ = &self->buff_ring[next_], ++i) { |
1536 |
++ skb_add_rx_frag(skb, i, |
1537 |
++ buff_->page, 0, |
1538 |
++ buff_->len, |
1539 |
++ SKB_TRUESIZE(buff->len - |
1540 |
++ ETH_HLEN)); |
1541 |
++ buff_->is_cleaned = 1; |
1542 |
++ |
1543 |
++ if (buff_->is_eop) |
1544 |
++ break; |
1545 |
++ } |
1546 |
+ } |
1547 |
+ } |
1548 |
+ |
1549 |
+diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c |
1550 |
+index a1f60f89e059..7a03ee45840e 100644 |
1551 |
+--- a/drivers/net/ethernet/broadcom/bcmsysport.c |
1552 |
++++ b/drivers/net/ethernet/broadcom/bcmsysport.c |
1553 |
+@@ -1045,14 +1045,22 @@ static void bcm_sysport_resume_from_wol(struct bcm_sysport_priv *priv) |
1554 |
+ { |
1555 |
+ u32 reg; |
1556 |
+ |
1557 |
+- /* Stop monitoring MPD interrupt */ |
1558 |
+- intrl2_0_mask_set(priv, INTRL2_0_MPD); |
1559 |
+- |
1560 |
+ /* Clear the MagicPacket detection logic */ |
1561 |
+ reg = umac_readl(priv, UMAC_MPD_CTRL); |
1562 |
+ reg &= ~MPD_EN; |
1563 |
+ umac_writel(priv, reg, UMAC_MPD_CTRL); |
1564 |
+ |
1565 |
++ reg = intrl2_0_readl(priv, INTRL2_CPU_STATUS); |
1566 |
++ if (reg & INTRL2_0_MPD) |
1567 |
++ netdev_info(priv->netdev, "Wake-on-LAN (MPD) interrupt!\n"); |
1568 |
++ |
1569 |
++ if (reg & INTRL2_0_BRCM_MATCH_TAG) { |
1570 |
++ reg = rxchk_readl(priv, RXCHK_BRCM_TAG_MATCH_STATUS) & |
1571 |
++ RXCHK_BRCM_TAG_MATCH_MASK; |
1572 |
++ netdev_info(priv->netdev, |
1573 |
++ "Wake-on-LAN (filters 0x%02x) interrupt!\n", reg); |
1574 |
++ } |
1575 |
++ |
1576 |
+ netif_dbg(priv, wol, priv->netdev, "resumed from WOL\n"); |
1577 |
+ } |
1578 |
+ |
1579 |
+@@ -1102,11 +1110,6 @@ static irqreturn_t bcm_sysport_rx_isr(int irq, void *dev_id) |
1580 |
+ if (priv->irq0_stat & INTRL2_0_TX_RING_FULL) |
1581 |
+ bcm_sysport_tx_reclaim_all(priv); |
1582 |
+ |
1583 |
+- if (priv->irq0_stat & INTRL2_0_MPD) { |
1584 |
+- netdev_info(priv->netdev, "Wake-on-LAN interrupt!\n"); |
1585 |
+- bcm_sysport_resume_from_wol(priv); |
1586 |
+- } |
1587 |
+- |
1588 |
+ if (!priv->is_lite) |
1589 |
+ goto out; |
1590 |
+ |
1591 |
+@@ -2459,9 +2462,6 @@ static int bcm_sysport_suspend_to_wol(struct bcm_sysport_priv *priv) |
1592 |
+ /* UniMAC receive needs to be turned on */ |
1593 |
+ umac_enable_set(priv, CMD_RX_EN, 1); |
1594 |
+ |
1595 |
+- /* Enable the interrupt wake-up source */ |
1596 |
+- intrl2_0_mask_clear(priv, INTRL2_0_MPD); |
1597 |
+- |
1598 |
+ netif_dbg(priv, wol, ndev, "entered WOL mode\n"); |
1599 |
+ |
1600 |
+ return 0; |
1601 |
+diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c |
1602 |
+index 80b05597c5fe..33f0861057fd 100644 |
1603 |
+--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c |
1604 |
++++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c |
1605 |
+@@ -1882,8 +1882,11 @@ static int bnxt_poll_work(struct bnxt *bp, struct bnxt_napi *bnapi, int budget) |
1606 |
+ if (TX_CMP_TYPE(txcmp) == CMP_TYPE_TX_L2_CMP) { |
1607 |
+ tx_pkts++; |
1608 |
+ /* return full budget so NAPI will complete. */ |
1609 |
+- if (unlikely(tx_pkts > bp->tx_wake_thresh)) |
1610 |
++ if (unlikely(tx_pkts > bp->tx_wake_thresh)) { |
1611 |
+ rx_pkts = budget; |
1612 |
++ raw_cons = NEXT_RAW_CMP(raw_cons); |
1613 |
++ break; |
1614 |
++ } |
1615 |
+ } else if ((TX_CMP_TYPE(txcmp) & 0x30) == 0x10) { |
1616 |
+ if (likely(budget)) |
1617 |
+ rc = bnxt_rx_pkt(bp, bnapi, &raw_cons, &event); |
1618 |
+@@ -1911,7 +1914,7 @@ static int bnxt_poll_work(struct bnxt *bp, struct bnxt_napi *bnapi, int budget) |
1619 |
+ } |
1620 |
+ raw_cons = NEXT_RAW_CMP(raw_cons); |
1621 |
+ |
1622 |
+- if (rx_pkts == budget) |
1623 |
++ if (rx_pkts && rx_pkts == budget) |
1624 |
+ break; |
1625 |
+ } |
1626 |
+ |
1627 |
+@@ -2025,8 +2028,12 @@ static int bnxt_poll(struct napi_struct *napi, int budget) |
1628 |
+ while (1) { |
1629 |
+ work_done += bnxt_poll_work(bp, bnapi, budget - work_done); |
1630 |
+ |
1631 |
+- if (work_done >= budget) |
1632 |
++ if (work_done >= budget) { |
1633 |
++ if (!budget) |
1634 |
++ BNXT_CP_DB_REARM(cpr->cp_doorbell, |
1635 |
++ cpr->cp_raw_cons); |
1636 |
+ break; |
1637 |
++ } |
1638 |
+ |
1639 |
+ if (!bnxt_has_work(bp, cpr)) { |
1640 |
+ if (napi_complete_done(napi, work_done)) |
1641 |
+@@ -3008,10 +3015,11 @@ static void bnxt_free_hwrm_resources(struct bnxt *bp) |
1642 |
+ { |
1643 |
+ struct pci_dev *pdev = bp->pdev; |
1644 |
+ |
1645 |
+- dma_free_coherent(&pdev->dev, PAGE_SIZE, bp->hwrm_cmd_resp_addr, |
1646 |
+- bp->hwrm_cmd_resp_dma_addr); |
1647 |
+- |
1648 |
+- bp->hwrm_cmd_resp_addr = NULL; |
1649 |
++ if (bp->hwrm_cmd_resp_addr) { |
1650 |
++ dma_free_coherent(&pdev->dev, PAGE_SIZE, bp->hwrm_cmd_resp_addr, |
1651 |
++ bp->hwrm_cmd_resp_dma_addr); |
1652 |
++ bp->hwrm_cmd_resp_addr = NULL; |
1653 |
++ } |
1654 |
+ if (bp->hwrm_dbg_resp_addr) { |
1655 |
+ dma_free_coherent(&pdev->dev, HWRM_DBG_REG_BUF_SIZE, |
1656 |
+ bp->hwrm_dbg_resp_addr, |
1657 |
+@@ -4643,7 +4651,7 @@ __bnxt_hwrm_reserve_pf_rings(struct bnxt *bp, struct hwrm_func_cfg_input *req, |
1658 |
+ FUNC_CFG_REQ_ENABLES_NUM_STAT_CTXS : 0; |
1659 |
+ enables |= ring_grps ? |
1660 |
+ FUNC_CFG_REQ_ENABLES_NUM_HW_RING_GRPS : 0; |
1661 |
+- enables |= vnics ? FUNC_VF_CFG_REQ_ENABLES_NUM_VNICS : 0; |
1662 |
++ enables |= vnics ? FUNC_CFG_REQ_ENABLES_NUM_VNICS : 0; |
1663 |
+ |
1664 |
+ req->num_rx_rings = cpu_to_le16(rx_rings); |
1665 |
+ req->num_hw_ring_grps = cpu_to_le16(ring_grps); |
1666 |
+@@ -8493,7 +8501,7 @@ static void _bnxt_get_max_rings(struct bnxt *bp, int *max_rx, int *max_tx, |
1667 |
+ *max_tx = hw_resc->max_tx_rings; |
1668 |
+ *max_rx = hw_resc->max_rx_rings; |
1669 |
+ *max_cp = min_t(int, bnxt_get_max_func_cp_rings_for_en(bp), |
1670 |
+- hw_resc->max_irqs); |
1671 |
++ hw_resc->max_irqs - bnxt_get_ulp_msix_num(bp)); |
1672 |
+ *max_cp = min_t(int, *max_cp, hw_resc->max_stat_ctxs); |
1673 |
+ max_ring_grps = hw_resc->max_hw_ring_grps; |
1674 |
+ if (BNXT_CHIP_TYPE_NITRO_A0(bp) && BNXT_PF(bp)) { |
1675 |
+@@ -8924,6 +8932,7 @@ init_err_cleanup_tc: |
1676 |
+ bnxt_clear_int_mode(bp); |
1677 |
+ |
1678 |
+ init_err_pci_clean: |
1679 |
++ bnxt_free_hwrm_resources(bp); |
1680 |
+ bnxt_cleanup_pci(bp); |
1681 |
+ |
1682 |
+ init_err_free: |
1683 |
+diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_dcb.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_dcb.c |
1684 |
+index d5bc72cecde3..3f896acc4ca8 100644 |
1685 |
+--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_dcb.c |
1686 |
++++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_dcb.c |
1687 |
+@@ -98,13 +98,13 @@ static int bnxt_hwrm_queue_cos2bw_cfg(struct bnxt *bp, struct ieee_ets *ets, |
1688 |
+ |
1689 |
+ bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_QUEUE_COS2BW_CFG, -1, -1); |
1690 |
+ for (i = 0; i < max_tc; i++) { |
1691 |
+- u8 qidx; |
1692 |
++ u8 qidx = bp->tc_to_qidx[i]; |
1693 |
+ |
1694 |
+ req.enables |= cpu_to_le32( |
1695 |
+- QUEUE_COS2BW_CFG_REQ_ENABLES_COS_QUEUE_ID0_VALID << i); |
1696 |
++ QUEUE_COS2BW_CFG_REQ_ENABLES_COS_QUEUE_ID0_VALID << |
1697 |
++ qidx); |
1698 |
+ |
1699 |
+ memset(&cos2bw, 0, sizeof(cos2bw)); |
1700 |
+- qidx = bp->tc_to_qidx[i]; |
1701 |
+ cos2bw.queue_id = bp->q_info[qidx].queue_id; |
1702 |
+ if (ets->tc_tsa[i] == IEEE_8021QAZ_TSA_STRICT) { |
1703 |
+ cos2bw.tsa = |
1704 |
+diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c |
1705 |
+index 491bd40a254d..c4c9df029466 100644 |
1706 |
+--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c |
1707 |
++++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c |
1708 |
+@@ -75,17 +75,23 @@ static int bnxt_tc_parse_redir(struct bnxt *bp, |
1709 |
+ return 0; |
1710 |
+ } |
1711 |
+ |
1712 |
+-static void bnxt_tc_parse_vlan(struct bnxt *bp, |
1713 |
+- struct bnxt_tc_actions *actions, |
1714 |
+- const struct tc_action *tc_act) |
1715 |
++static int bnxt_tc_parse_vlan(struct bnxt *bp, |
1716 |
++ struct bnxt_tc_actions *actions, |
1717 |
++ const struct tc_action *tc_act) |
1718 |
+ { |
1719 |
+- if (tcf_vlan_action(tc_act) == TCA_VLAN_ACT_POP) { |
1720 |
++ switch (tcf_vlan_action(tc_act)) { |
1721 |
++ case TCA_VLAN_ACT_POP: |
1722 |
+ actions->flags |= BNXT_TC_ACTION_FLAG_POP_VLAN; |
1723 |
+- } else if (tcf_vlan_action(tc_act) == TCA_VLAN_ACT_PUSH) { |
1724 |
++ break; |
1725 |
++ case TCA_VLAN_ACT_PUSH: |
1726 |
+ actions->flags |= BNXT_TC_ACTION_FLAG_PUSH_VLAN; |
1727 |
+ actions->push_vlan_tci = htons(tcf_vlan_push_vid(tc_act)); |
1728 |
+ actions->push_vlan_tpid = tcf_vlan_push_proto(tc_act); |
1729 |
++ break; |
1730 |
++ default: |
1731 |
++ return -EOPNOTSUPP; |
1732 |
+ } |
1733 |
++ return 0; |
1734 |
+ } |
1735 |
+ |
1736 |
+ static int bnxt_tc_parse_tunnel_set(struct bnxt *bp, |
1737 |
+@@ -136,7 +142,9 @@ static int bnxt_tc_parse_actions(struct bnxt *bp, |
1738 |
+ |
1739 |
+ /* Push/pop VLAN */ |
1740 |
+ if (is_tcf_vlan(tc_act)) { |
1741 |
+- bnxt_tc_parse_vlan(bp, actions, tc_act); |
1742 |
++ rc = bnxt_tc_parse_vlan(bp, actions, tc_act); |
1743 |
++ if (rc) |
1744 |
++ return rc; |
1745 |
+ continue; |
1746 |
+ } |
1747 |
+ |
1748 |
+diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c |
1749 |
+index c4d7479938e2..dfa045f22ef1 100644 |
1750 |
+--- a/drivers/net/ethernet/cadence/macb_main.c |
1751 |
++++ b/drivers/net/ethernet/cadence/macb_main.c |
1752 |
+@@ -3765,6 +3765,13 @@ static const struct macb_config at91sam9260_config = { |
1753 |
+ .init = macb_init, |
1754 |
+ }; |
1755 |
+ |
1756 |
++static const struct macb_config sama5d3macb_config = { |
1757 |
++ .caps = MACB_CAPS_SG_DISABLED |
1758 |
++ | MACB_CAPS_USRIO_HAS_CLKEN | MACB_CAPS_USRIO_DEFAULT_IS_MII_GMII, |
1759 |
++ .clk_init = macb_clk_init, |
1760 |
++ .init = macb_init, |
1761 |
++}; |
1762 |
++ |
1763 |
+ static const struct macb_config pc302gem_config = { |
1764 |
+ .caps = MACB_CAPS_SG_DISABLED | MACB_CAPS_GIGABIT_MODE_AVAILABLE, |
1765 |
+ .dma_burst_length = 16, |
1766 |
+@@ -3832,6 +3839,7 @@ static const struct of_device_id macb_dt_ids[] = { |
1767 |
+ { .compatible = "cdns,gem", .data = &pc302gem_config }, |
1768 |
+ { .compatible = "atmel,sama5d2-gem", .data = &sama5d2_config }, |
1769 |
+ { .compatible = "atmel,sama5d3-gem", .data = &sama5d3_config }, |
1770 |
++ { .compatible = "atmel,sama5d3-macb", .data = &sama5d3macb_config }, |
1771 |
+ { .compatible = "atmel,sama5d4-gem", .data = &sama5d4_config }, |
1772 |
+ { .compatible = "cdns,at91rm9200-emac", .data = &emac_config }, |
1773 |
+ { .compatible = "cdns,emac", .data = &emac_config }, |
1774 |
+diff --git a/drivers/net/ethernet/hisilicon/hns/hnae.c b/drivers/net/ethernet/hisilicon/hns/hnae.c |
1775 |
+index a051e582d541..79d03f8ee7b1 100644 |
1776 |
+--- a/drivers/net/ethernet/hisilicon/hns/hnae.c |
1777 |
++++ b/drivers/net/ethernet/hisilicon/hns/hnae.c |
1778 |
+@@ -84,7 +84,7 @@ static void hnae_unmap_buffer(struct hnae_ring *ring, struct hnae_desc_cb *cb) |
1779 |
+ if (cb->type == DESC_TYPE_SKB) |
1780 |
+ dma_unmap_single(ring_to_dev(ring), cb->dma, cb->length, |
1781 |
+ ring_to_dma_dir(ring)); |
1782 |
+- else |
1783 |
++ else if (cb->length) |
1784 |
+ dma_unmap_page(ring_to_dev(ring), cb->dma, cb->length, |
1785 |
+ ring_to_dma_dir(ring)); |
1786 |
+ } |
1787 |
+diff --git a/drivers/net/ethernet/hisilicon/hns/hns_enet.c b/drivers/net/ethernet/hisilicon/hns/hns_enet.c |
1788 |
+index b4518f45f048..1336ec73230d 100644 |
1789 |
+--- a/drivers/net/ethernet/hisilicon/hns/hns_enet.c |
1790 |
++++ b/drivers/net/ethernet/hisilicon/hns/hns_enet.c |
1791 |
+@@ -40,9 +40,9 @@ |
1792 |
+ #define SKB_TMP_LEN(SKB) \ |
1793 |
+ (((SKB)->transport_header - (SKB)->mac_header) + tcp_hdrlen(SKB)) |
1794 |
+ |
1795 |
+-static void fill_v2_desc(struct hnae_ring *ring, void *priv, |
1796 |
+- int size, dma_addr_t dma, int frag_end, |
1797 |
+- int buf_num, enum hns_desc_type type, int mtu) |
1798 |
++static void fill_v2_desc_hw(struct hnae_ring *ring, void *priv, int size, |
1799 |
++ int send_sz, dma_addr_t dma, int frag_end, |
1800 |
++ int buf_num, enum hns_desc_type type, int mtu) |
1801 |
+ { |
1802 |
+ struct hnae_desc *desc = &ring->desc[ring->next_to_use]; |
1803 |
+ struct hnae_desc_cb *desc_cb = &ring->desc_cb[ring->next_to_use]; |
1804 |
+@@ -64,7 +64,7 @@ static void fill_v2_desc(struct hnae_ring *ring, void *priv, |
1805 |
+ desc_cb->type = type; |
1806 |
+ |
1807 |
+ desc->addr = cpu_to_le64(dma); |
1808 |
+- desc->tx.send_size = cpu_to_le16((u16)size); |
1809 |
++ desc->tx.send_size = cpu_to_le16((u16)send_sz); |
1810 |
+ |
1811 |
+ /* config bd buffer end */ |
1812 |
+ hnae_set_bit(rrcfv, HNSV2_TXD_VLD_B, 1); |
1813 |
+@@ -133,6 +133,14 @@ static void fill_v2_desc(struct hnae_ring *ring, void *priv, |
1814 |
+ ring_ptr_move_fw(ring, next_to_use); |
1815 |
+ } |
1816 |
+ |
1817 |
++static void fill_v2_desc(struct hnae_ring *ring, void *priv, |
1818 |
++ int size, dma_addr_t dma, int frag_end, |
1819 |
++ int buf_num, enum hns_desc_type type, int mtu) |
1820 |
++{ |
1821 |
++ fill_v2_desc_hw(ring, priv, size, size, dma, frag_end, |
1822 |
++ buf_num, type, mtu); |
1823 |
++} |
1824 |
++ |
1825 |
+ static const struct acpi_device_id hns_enet_acpi_match[] = { |
1826 |
+ { "HISI00C1", 0 }, |
1827 |
+ { "HISI00C2", 0 }, |
1828 |
+@@ -289,15 +297,15 @@ static void fill_tso_desc(struct hnae_ring *ring, void *priv, |
1829 |
+ |
1830 |
+ /* when the frag size is bigger than hardware, split this frag */ |
1831 |
+ for (k = 0; k < frag_buf_num; k++) |
1832 |
+- fill_v2_desc(ring, priv, |
1833 |
+- (k == frag_buf_num - 1) ? |
1834 |
++ fill_v2_desc_hw(ring, priv, k == 0 ? size : 0, |
1835 |
++ (k == frag_buf_num - 1) ? |
1836 |
+ sizeoflast : BD_MAX_SEND_SIZE, |
1837 |
+- dma + BD_MAX_SEND_SIZE * k, |
1838 |
+- frag_end && (k == frag_buf_num - 1) ? 1 : 0, |
1839 |
+- buf_num, |
1840 |
+- (type == DESC_TYPE_SKB && !k) ? |
1841 |
++ dma + BD_MAX_SEND_SIZE * k, |
1842 |
++ frag_end && (k == frag_buf_num - 1) ? 1 : 0, |
1843 |
++ buf_num, |
1844 |
++ (type == DESC_TYPE_SKB && !k) ? |
1845 |
+ DESC_TYPE_SKB : DESC_TYPE_PAGE, |
1846 |
+- mtu); |
1847 |
++ mtu); |
1848 |
+ } |
1849 |
+ |
1850 |
+ netdev_tx_t hns_nic_net_xmit_hw(struct net_device *ndev, |
1851 |
+diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c |
1852 |
+index b8bba64673e5..3986ef83111b 100644 |
1853 |
+--- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c |
1854 |
++++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c |
1855 |
+@@ -1725,7 +1725,7 @@ static void mvpp2_txq_desc_put(struct mvpp2_tx_queue *txq) |
1856 |
+ } |
1857 |
+ |
1858 |
+ /* Set Tx descriptors fields relevant for CSUM calculation */ |
1859 |
+-static u32 mvpp2_txq_desc_csum(int l3_offs, int l3_proto, |
1860 |
++static u32 mvpp2_txq_desc_csum(int l3_offs, __be16 l3_proto, |
1861 |
+ int ip_hdr_len, int l4_proto) |
1862 |
+ { |
1863 |
+ u32 command; |
1864 |
+@@ -2600,14 +2600,15 @@ static u32 mvpp2_skb_tx_csum(struct mvpp2_port *port, struct sk_buff *skb) |
1865 |
+ if (skb->ip_summed == CHECKSUM_PARTIAL) { |
1866 |
+ int ip_hdr_len = 0; |
1867 |
+ u8 l4_proto; |
1868 |
++ __be16 l3_proto = vlan_get_protocol(skb); |
1869 |
+ |
1870 |
+- if (skb->protocol == htons(ETH_P_IP)) { |
1871 |
++ if (l3_proto == htons(ETH_P_IP)) { |
1872 |
+ struct iphdr *ip4h = ip_hdr(skb); |
1873 |
+ |
1874 |
+ /* Calculate IPv4 checksum and L4 checksum */ |
1875 |
+ ip_hdr_len = ip4h->ihl; |
1876 |
+ l4_proto = ip4h->protocol; |
1877 |
+- } else if (skb->protocol == htons(ETH_P_IPV6)) { |
1878 |
++ } else if (l3_proto == htons(ETH_P_IPV6)) { |
1879 |
+ struct ipv6hdr *ip6h = ipv6_hdr(skb); |
1880 |
+ |
1881 |
+ /* Read l4_protocol from one of IPv6 extra headers */ |
1882 |
+@@ -2619,7 +2620,7 @@ static u32 mvpp2_skb_tx_csum(struct mvpp2_port *port, struct sk_buff *skb) |
1883 |
+ } |
1884 |
+ |
1885 |
+ return mvpp2_txq_desc_csum(skb_network_offset(skb), |
1886 |
+- skb->protocol, ip_hdr_len, l4_proto); |
1887 |
++ l3_proto, ip_hdr_len, l4_proto); |
1888 |
+ } |
1889 |
+ |
1890 |
+ return MVPP2_TXD_L4_CSUM_NOT | MVPP2_TXD_IP_CSUM_DISABLE; |
1891 |
+@@ -3055,10 +3056,12 @@ static int mvpp2_poll(struct napi_struct *napi, int budget) |
1892 |
+ cause_rx_tx & ~MVPP2_CAUSE_MISC_SUM_MASK); |
1893 |
+ } |
1894 |
+ |
1895 |
+- cause_tx = cause_rx_tx & MVPP2_CAUSE_TXQ_OCCUP_DESC_ALL_MASK; |
1896 |
+- if (cause_tx) { |
1897 |
+- cause_tx >>= MVPP2_CAUSE_TXQ_OCCUP_DESC_ALL_OFFSET; |
1898 |
+- mvpp2_tx_done(port, cause_tx, qv->sw_thread_id); |
1899 |
++ if (port->has_tx_irqs) { |
1900 |
++ cause_tx = cause_rx_tx & MVPP2_CAUSE_TXQ_OCCUP_DESC_ALL_MASK; |
1901 |
++ if (cause_tx) { |
1902 |
++ cause_tx >>= MVPP2_CAUSE_TXQ_OCCUP_DESC_ALL_OFFSET; |
1903 |
++ mvpp2_tx_done(port, cause_tx, qv->sw_thread_id); |
1904 |
++ } |
1905 |
+ } |
1906 |
+ |
1907 |
+ /* Process RX packets */ |
1908 |
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c |
1909 |
+index dfbcda0d0e08..701af5ffcbc9 100644 |
1910 |
+--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c |
1911 |
++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c |
1912 |
+@@ -1339,6 +1339,9 @@ static int __parse_cls_flower(struct mlx5e_priv *priv, |
1913 |
+ |
1914 |
+ *match_level = MLX5_MATCH_L2; |
1915 |
+ } |
1916 |
++ } else { |
1917 |
++ MLX5_SET(fte_match_set_lyr_2_4, headers_c, svlan_tag, 1); |
1918 |
++ MLX5_SET(fte_match_set_lyr_2_4, headers_c, cvlan_tag, 1); |
1919 |
+ } |
1920 |
+ |
1921 |
+ if (dissector_uses_key(f->dissector, FLOW_DISSECTOR_KEY_BASIC)) { |
1922 |
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c |
1923 |
+index 40dba9e8af92..69f356f5f8f5 100644 |
1924 |
+--- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c |
1925 |
++++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c |
1926 |
+@@ -2000,7 +2000,7 @@ static u32 calculate_vports_min_rate_divider(struct mlx5_eswitch *esw) |
1927 |
+ u32 max_guarantee = 0; |
1928 |
+ int i; |
1929 |
+ |
1930 |
+- for (i = 0; i <= esw->total_vports; i++) { |
1931 |
++ for (i = 0; i < esw->total_vports; i++) { |
1932 |
+ evport = &esw->vports[i]; |
1933 |
+ if (!evport->enabled || evport->info.min_rate < max_guarantee) |
1934 |
+ continue; |
1935 |
+@@ -2020,7 +2020,7 @@ static int normalize_vports_min_rate(struct mlx5_eswitch *esw, u32 divider) |
1936 |
+ int err; |
1937 |
+ int i; |
1938 |
+ |
1939 |
+- for (i = 0; i <= esw->total_vports; i++) { |
1940 |
++ for (i = 0; i < esw->total_vports; i++) { |
1941 |
+ evport = &esw->vports[i]; |
1942 |
+ if (!evport->enabled) |
1943 |
+ continue; |
1944 |
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/transobj.c b/drivers/net/ethernet/mellanox/mlx5/core/transobj.c |
1945 |
+index dae1c5c5d27c..d2f76070ea7c 100644 |
1946 |
+--- a/drivers/net/ethernet/mellanox/mlx5/core/transobj.c |
1947 |
++++ b/drivers/net/ethernet/mellanox/mlx5/core/transobj.c |
1948 |
+@@ -509,7 +509,7 @@ static int mlx5_hairpin_modify_sq(struct mlx5_core_dev *peer_mdev, u32 sqn, |
1949 |
+ |
1950 |
+ sqc = MLX5_ADDR_OF(modify_sq_in, in, ctx); |
1951 |
+ |
1952 |
+- if (next_state == MLX5_RQC_STATE_RDY) { |
1953 |
++ if (next_state == MLX5_SQC_STATE_RDY) { |
1954 |
+ MLX5_SET(sqc, sqc, hairpin_peer_rq, peer_rq); |
1955 |
+ MLX5_SET(sqc, sqc, hairpin_peer_vhca, peer_vhca); |
1956 |
+ } |
1957 |
+diff --git a/drivers/net/ethernet/mscc/ocelot_board.c b/drivers/net/ethernet/mscc/ocelot_board.c |
1958 |
+index 18df7d934e81..ccfcf3048cd0 100644 |
1959 |
+--- a/drivers/net/ethernet/mscc/ocelot_board.c |
1960 |
++++ b/drivers/net/ethernet/mscc/ocelot_board.c |
1961 |
+@@ -91,7 +91,7 @@ static irqreturn_t ocelot_xtr_irq_handler(int irq, void *arg) |
1962 |
+ struct sk_buff *skb; |
1963 |
+ struct net_device *dev; |
1964 |
+ u32 *buf; |
1965 |
+- int sz, len; |
1966 |
++ int sz, len, buf_len; |
1967 |
+ u32 ifh[4]; |
1968 |
+ u32 val; |
1969 |
+ struct frame_info info; |
1970 |
+@@ -116,14 +116,20 @@ static irqreturn_t ocelot_xtr_irq_handler(int irq, void *arg) |
1971 |
+ err = -ENOMEM; |
1972 |
+ break; |
1973 |
+ } |
1974 |
+- buf = (u32 *)skb_put(skb, info.len); |
1975 |
++ buf_len = info.len - ETH_FCS_LEN; |
1976 |
++ buf = (u32 *)skb_put(skb, buf_len); |
1977 |
+ |
1978 |
+ len = 0; |
1979 |
+ do { |
1980 |
+ sz = ocelot_rx_frame_word(ocelot, grp, false, &val); |
1981 |
+ *buf++ = val; |
1982 |
+ len += sz; |
1983 |
+- } while ((sz == 4) && (len < info.len)); |
1984 |
++ } while (len < buf_len); |
1985 |
++ |
1986 |
++ /* Read the FCS and discard it */ |
1987 |
++ sz = ocelot_rx_frame_word(ocelot, grp, false, &val); |
1988 |
++ /* Update the statistics if part of the FCS was read before */ |
1989 |
++ len -= ETH_FCS_LEN - sz; |
1990 |
+ |
1991 |
+ if (sz < 0) { |
1992 |
+ err = sz; |
1993 |
+diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_common.c b/drivers/net/ethernet/netronome/nfp/nfp_net_common.c |
1994 |
+index bfccc1955907..80306e4f247c 100644 |
1995 |
+--- a/drivers/net/ethernet/netronome/nfp/nfp_net_common.c |
1996 |
++++ b/drivers/net/ethernet/netronome/nfp/nfp_net_common.c |
1997 |
+@@ -2068,14 +2068,17 @@ nfp_ctrl_rx_one(struct nfp_net *nn, struct nfp_net_dp *dp, |
1998 |
+ return true; |
1999 |
+ } |
2000 |
+ |
2001 |
+-static void nfp_ctrl_rx(struct nfp_net_r_vector *r_vec) |
2002 |
++static bool nfp_ctrl_rx(struct nfp_net_r_vector *r_vec) |
2003 |
+ { |
2004 |
+ struct nfp_net_rx_ring *rx_ring = r_vec->rx_ring; |
2005 |
+ struct nfp_net *nn = r_vec->nfp_net; |
2006 |
+ struct nfp_net_dp *dp = &nn->dp; |
2007 |
++ unsigned int budget = 512; |
2008 |
+ |
2009 |
+- while (nfp_ctrl_rx_one(nn, dp, r_vec, rx_ring)) |
2010 |
++ while (nfp_ctrl_rx_one(nn, dp, r_vec, rx_ring) && budget--) |
2011 |
+ continue; |
2012 |
++ |
2013 |
++ return budget; |
2014 |
+ } |
2015 |
+ |
2016 |
+ static void nfp_ctrl_poll(unsigned long arg) |
2017 |
+@@ -2087,9 +2090,13 @@ static void nfp_ctrl_poll(unsigned long arg) |
2018 |
+ __nfp_ctrl_tx_queued(r_vec); |
2019 |
+ spin_unlock_bh(&r_vec->lock); |
2020 |
+ |
2021 |
+- nfp_ctrl_rx(r_vec); |
2022 |
+- |
2023 |
+- nfp_net_irq_unmask(r_vec->nfp_net, r_vec->irq_entry); |
2024 |
++ if (nfp_ctrl_rx(r_vec)) { |
2025 |
++ nfp_net_irq_unmask(r_vec->nfp_net, r_vec->irq_entry); |
2026 |
++ } else { |
2027 |
++ tasklet_schedule(&r_vec->tasklet); |
2028 |
++ nn_dp_warn(&r_vec->nfp_net->dp, |
2029 |
++ "control message budget exceeded!\n"); |
2030 |
++ } |
2031 |
+ } |
2032 |
+ |
2033 |
+ /* Setup and Configuration |
2034 |
+diff --git a/drivers/net/ethernet/qlogic/qed/qed_hsi.h b/drivers/net/ethernet/qlogic/qed/qed_hsi.h |
2035 |
+index bee10c1781fb..463ffa83685f 100644 |
2036 |
+--- a/drivers/net/ethernet/qlogic/qed/qed_hsi.h |
2037 |
++++ b/drivers/net/ethernet/qlogic/qed/qed_hsi.h |
2038 |
+@@ -11987,6 +11987,7 @@ struct public_global { |
2039 |
+ u32 running_bundle_id; |
2040 |
+ s32 external_temperature; |
2041 |
+ u32 mdump_reason; |
2042 |
++ u64 reserved; |
2043 |
+ u32 data_ptr; |
2044 |
+ u32 data_size; |
2045 |
+ }; |
2046 |
+diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h b/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h |
2047 |
+index 81312924df14..0c443ea98479 100644 |
2048 |
+--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h |
2049 |
++++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h |
2050 |
+@@ -1800,7 +1800,8 @@ struct qlcnic_hardware_ops { |
2051 |
+ int (*config_loopback) (struct qlcnic_adapter *, u8); |
2052 |
+ int (*clear_loopback) (struct qlcnic_adapter *, u8); |
2053 |
+ int (*config_promisc_mode) (struct qlcnic_adapter *, u32); |
2054 |
+- void (*change_l2_filter) (struct qlcnic_adapter *, u64 *, u16); |
2055 |
++ void (*change_l2_filter)(struct qlcnic_adapter *adapter, u64 *addr, |
2056 |
++ u16 vlan, struct qlcnic_host_tx_ring *tx_ring); |
2057 |
+ int (*get_board_info) (struct qlcnic_adapter *); |
2058 |
+ void (*set_mac_filter_count) (struct qlcnic_adapter *); |
2059 |
+ void (*free_mac_list) (struct qlcnic_adapter *); |
2060 |
+@@ -2064,9 +2065,10 @@ static inline int qlcnic_nic_set_promisc(struct qlcnic_adapter *adapter, |
2061 |
+ } |
2062 |
+ |
2063 |
+ static inline void qlcnic_change_filter(struct qlcnic_adapter *adapter, |
2064 |
+- u64 *addr, u16 id) |
2065 |
++ u64 *addr, u16 vlan, |
2066 |
++ struct qlcnic_host_tx_ring *tx_ring) |
2067 |
+ { |
2068 |
+- adapter->ahw->hw_ops->change_l2_filter(adapter, addr, id); |
2069 |
++ adapter->ahw->hw_ops->change_l2_filter(adapter, addr, vlan, tx_ring); |
2070 |
+ } |
2071 |
+ |
2072 |
+ static inline int qlcnic_get_board_info(struct qlcnic_adapter *adapter) |
2073 |
+diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c |
2074 |
+index 569d54ededec..a79d84f99102 100644 |
2075 |
+--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c |
2076 |
++++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c |
2077 |
+@@ -2135,7 +2135,8 @@ out: |
2078 |
+ } |
2079 |
+ |
2080 |
+ void qlcnic_83xx_change_l2_filter(struct qlcnic_adapter *adapter, u64 *addr, |
2081 |
+- u16 vlan_id) |
2082 |
++ u16 vlan_id, |
2083 |
++ struct qlcnic_host_tx_ring *tx_ring) |
2084 |
+ { |
2085 |
+ u8 mac[ETH_ALEN]; |
2086 |
+ memcpy(&mac, addr, ETH_ALEN); |
2087 |
+diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.h b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.h |
2088 |
+index b75a81246856..73fe2f64491d 100644 |
2089 |
+--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.h |
2090 |
++++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.h |
2091 |
+@@ -550,7 +550,8 @@ int qlcnic_83xx_wrt_reg_indirect(struct qlcnic_adapter *, ulong, u32); |
2092 |
+ int qlcnic_83xx_nic_set_promisc(struct qlcnic_adapter *, u32); |
2093 |
+ int qlcnic_83xx_config_hw_lro(struct qlcnic_adapter *, int); |
2094 |
+ int qlcnic_83xx_config_rss(struct qlcnic_adapter *, int); |
2095 |
+-void qlcnic_83xx_change_l2_filter(struct qlcnic_adapter *, u64 *, u16); |
2096 |
++void qlcnic_83xx_change_l2_filter(struct qlcnic_adapter *adapter, u64 *addr, |
2097 |
++ u16 vlan, struct qlcnic_host_tx_ring *ring); |
2098 |
+ int qlcnic_83xx_get_pci_info(struct qlcnic_adapter *, struct qlcnic_pci_info *); |
2099 |
+ int qlcnic_83xx_set_nic_info(struct qlcnic_adapter *, struct qlcnic_info *); |
2100 |
+ void qlcnic_83xx_initialize_nic(struct qlcnic_adapter *, int); |
2101 |
+diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.h b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.h |
2102 |
+index 4bb33af8e2b3..56a3bd9e37dc 100644 |
2103 |
+--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.h |
2104 |
++++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.h |
2105 |
+@@ -173,7 +173,8 @@ int qlcnic_82xx_napi_add(struct qlcnic_adapter *adapter, |
2106 |
+ struct net_device *netdev); |
2107 |
+ void qlcnic_82xx_get_beacon_state(struct qlcnic_adapter *); |
2108 |
+ void qlcnic_82xx_change_filter(struct qlcnic_adapter *adapter, |
2109 |
+- u64 *uaddr, u16 vlan_id); |
2110 |
++ u64 *uaddr, u16 vlan_id, |
2111 |
++ struct qlcnic_host_tx_ring *tx_ring); |
2112 |
+ int qlcnic_82xx_config_intr_coalesce(struct qlcnic_adapter *, |
2113 |
+ struct ethtool_coalesce *); |
2114 |
+ int qlcnic_82xx_set_rx_coalesce(struct qlcnic_adapter *); |
2115 |
+diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c |
2116 |
+index 84dd83031a1b..9647578cbe6a 100644 |
2117 |
+--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c |
2118 |
++++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c |
2119 |
+@@ -268,13 +268,12 @@ static void qlcnic_add_lb_filter(struct qlcnic_adapter *adapter, |
2120 |
+ } |
2121 |
+ |
2122 |
+ void qlcnic_82xx_change_filter(struct qlcnic_adapter *adapter, u64 *uaddr, |
2123 |
+- u16 vlan_id) |
2124 |
++ u16 vlan_id, struct qlcnic_host_tx_ring *tx_ring) |
2125 |
+ { |
2126 |
+ struct cmd_desc_type0 *hwdesc; |
2127 |
+ struct qlcnic_nic_req *req; |
2128 |
+ struct qlcnic_mac_req *mac_req; |
2129 |
+ struct qlcnic_vlan_req *vlan_req; |
2130 |
+- struct qlcnic_host_tx_ring *tx_ring = adapter->tx_ring; |
2131 |
+ u32 producer; |
2132 |
+ u64 word; |
2133 |
+ |
2134 |
+@@ -301,7 +300,8 @@ void qlcnic_82xx_change_filter(struct qlcnic_adapter *adapter, u64 *uaddr, |
2135 |
+ |
2136 |
+ static void qlcnic_send_filter(struct qlcnic_adapter *adapter, |
2137 |
+ struct cmd_desc_type0 *first_desc, |
2138 |
+- struct sk_buff *skb) |
2139 |
++ struct sk_buff *skb, |
2140 |
++ struct qlcnic_host_tx_ring *tx_ring) |
2141 |
+ { |
2142 |
+ struct vlan_ethhdr *vh = (struct vlan_ethhdr *)(skb->data); |
2143 |
+ struct ethhdr *phdr = (struct ethhdr *)(skb->data); |
2144 |
+@@ -335,7 +335,7 @@ static void qlcnic_send_filter(struct qlcnic_adapter *adapter, |
2145 |
+ tmp_fil->vlan_id == vlan_id) { |
2146 |
+ if (jiffies > (QLCNIC_READD_AGE * HZ + tmp_fil->ftime)) |
2147 |
+ qlcnic_change_filter(adapter, &src_addr, |
2148 |
+- vlan_id); |
2149 |
++ vlan_id, tx_ring); |
2150 |
+ tmp_fil->ftime = jiffies; |
2151 |
+ return; |
2152 |
+ } |
2153 |
+@@ -350,7 +350,7 @@ static void qlcnic_send_filter(struct qlcnic_adapter *adapter, |
2154 |
+ if (!fil) |
2155 |
+ return; |
2156 |
+ |
2157 |
+- qlcnic_change_filter(adapter, &src_addr, vlan_id); |
2158 |
++ qlcnic_change_filter(adapter, &src_addr, vlan_id, tx_ring); |
2159 |
+ fil->ftime = jiffies; |
2160 |
+ fil->vlan_id = vlan_id; |
2161 |
+ memcpy(fil->faddr, &src_addr, ETH_ALEN); |
2162 |
+@@ -766,7 +766,7 @@ netdev_tx_t qlcnic_xmit_frame(struct sk_buff *skb, struct net_device *netdev) |
2163 |
+ } |
2164 |
+ |
2165 |
+ if (adapter->drv_mac_learn) |
2166 |
+- qlcnic_send_filter(adapter, first_desc, skb); |
2167 |
++ qlcnic_send_filter(adapter, first_desc, skb, tx_ring); |
2168 |
+ |
2169 |
+ tx_ring->tx_stats.tx_bytes += skb->len; |
2170 |
+ tx_ring->tx_stats.xmit_called++; |
2171 |
+diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c b/drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c |
2172 |
+index 7fd86d40a337..11167abe5934 100644 |
2173 |
+--- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c |
2174 |
++++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c |
2175 |
+@@ -113,7 +113,7 @@ rmnet_map_ingress_handler(struct sk_buff *skb, |
2176 |
+ struct sk_buff *skbn; |
2177 |
+ |
2178 |
+ if (skb->dev->type == ARPHRD_ETHER) { |
2179 |
+- if (pskb_expand_head(skb, ETH_HLEN, 0, GFP_KERNEL)) { |
2180 |
++ if (pskb_expand_head(skb, ETH_HLEN, 0, GFP_ATOMIC)) { |
2181 |
+ kfree_skb(skb); |
2182 |
+ return; |
2183 |
+ } |
2184 |
+@@ -147,7 +147,7 @@ static int rmnet_map_egress_handler(struct sk_buff *skb, |
2185 |
+ } |
2186 |
+ |
2187 |
+ if (skb_headroom(skb) < required_headroom) { |
2188 |
+- if (pskb_expand_head(skb, required_headroom, 0, GFP_KERNEL)) |
2189 |
++ if (pskb_expand_head(skb, required_headroom, 0, GFP_ATOMIC)) |
2190 |
+ return -ENOMEM; |
2191 |
+ } |
2192 |
+ |
2193 |
+@@ -189,6 +189,9 @@ rx_handler_result_t rmnet_rx_handler(struct sk_buff **pskb) |
2194 |
+ if (!skb) |
2195 |
+ goto done; |
2196 |
+ |
2197 |
++ if (skb->pkt_type == PACKET_LOOPBACK) |
2198 |
++ return RX_HANDLER_PASS; |
2199 |
++ |
2200 |
+ dev = skb->dev; |
2201 |
+ port = rmnet_get_port(dev); |
2202 |
+ |
2203 |
+diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c |
2204 |
+index 1d1e66002232..627c5cd8f786 100644 |
2205 |
+--- a/drivers/net/ethernet/realtek/r8169.c |
2206 |
++++ b/drivers/net/ethernet/realtek/r8169.c |
2207 |
+@@ -4788,8 +4788,8 @@ static void rtl_init_rxcfg(struct rtl8169_private *tp) |
2208 |
+ RTL_W32(tp, RxConfig, RX_FIFO_THRESH | RX_DMA_BURST); |
2209 |
+ break; |
2210 |
+ case RTL_GIGA_MAC_VER_18 ... RTL_GIGA_MAC_VER_24: |
2211 |
+- case RTL_GIGA_MAC_VER_34: |
2212 |
+- case RTL_GIGA_MAC_VER_35: |
2213 |
++ case RTL_GIGA_MAC_VER_34 ... RTL_GIGA_MAC_VER_36: |
2214 |
++ case RTL_GIGA_MAC_VER_38: |
2215 |
+ RTL_W32(tp, RxConfig, RX128_INT_EN | RX_MULTI_EN | RX_DMA_BURST); |
2216 |
+ break; |
2217 |
+ case RTL_GIGA_MAC_VER_40 ... RTL_GIGA_MAC_VER_51: |
2218 |
+@@ -5041,9 +5041,14 @@ static void rtl8169_hw_reset(struct rtl8169_private *tp) |
2219 |
+ |
2220 |
+ static void rtl_set_tx_config_registers(struct rtl8169_private *tp) |
2221 |
+ { |
2222 |
+- /* Set DMA burst size and Interframe Gap Time */ |
2223 |
+- RTL_W32(tp, TxConfig, (TX_DMA_BURST << TxDMAShift) | |
2224 |
+- (InterFrameGap << TxInterFrameGapShift)); |
2225 |
++ u32 val = TX_DMA_BURST << TxDMAShift | |
2226 |
++ InterFrameGap << TxInterFrameGapShift; |
2227 |
++ |
2228 |
++ if (tp->mac_version >= RTL_GIGA_MAC_VER_34 && |
2229 |
++ tp->mac_version != RTL_GIGA_MAC_VER_39) |
2230 |
++ val |= TXCFG_AUTO_FIFO; |
2231 |
++ |
2232 |
++ RTL_W32(tp, TxConfig, val); |
2233 |
+ } |
2234 |
+ |
2235 |
+ static void rtl_set_rx_max_size(struct rtl8169_private *tp) |
2236 |
+@@ -5530,7 +5535,6 @@ static void rtl_hw_start_8168e_2(struct rtl8169_private *tp) |
2237 |
+ |
2238 |
+ rtl_disable_clock_request(tp); |
2239 |
+ |
2240 |
+- RTL_W32(tp, TxConfig, RTL_R32(tp, TxConfig) | TXCFG_AUTO_FIFO); |
2241 |
+ RTL_W8(tp, MCU, RTL_R8(tp, MCU) & ~NOW_IS_OOB); |
2242 |
+ |
2243 |
+ /* Adjust EEE LED frequency */ |
2244 |
+@@ -5562,7 +5566,6 @@ static void rtl_hw_start_8168f(struct rtl8169_private *tp) |
2245 |
+ |
2246 |
+ rtl_disable_clock_request(tp); |
2247 |
+ |
2248 |
+- RTL_W32(tp, TxConfig, RTL_R32(tp, TxConfig) | TXCFG_AUTO_FIFO); |
2249 |
+ RTL_W8(tp, MCU, RTL_R8(tp, MCU) & ~NOW_IS_OOB); |
2250 |
+ RTL_W8(tp, DLLPR, RTL_R8(tp, DLLPR) | PFM_EN); |
2251 |
+ RTL_W32(tp, MISC, RTL_R32(tp, MISC) | PWM_EN); |
2252 |
+@@ -5607,8 +5610,6 @@ static void rtl_hw_start_8411(struct rtl8169_private *tp) |
2253 |
+ |
2254 |
+ static void rtl_hw_start_8168g(struct rtl8169_private *tp) |
2255 |
+ { |
2256 |
+- RTL_W32(tp, TxConfig, RTL_R32(tp, TxConfig) | TXCFG_AUTO_FIFO); |
2257 |
+- |
2258 |
+ rtl_eri_write(tp, 0xc8, ERIAR_MASK_0101, 0x080002, ERIAR_EXGMAC); |
2259 |
+ rtl_eri_write(tp, 0xcc, ERIAR_MASK_0001, 0x38, ERIAR_EXGMAC); |
2260 |
+ rtl_eri_write(tp, 0xd0, ERIAR_MASK_0001, 0x48, ERIAR_EXGMAC); |
2261 |
+@@ -5707,8 +5708,6 @@ static void rtl_hw_start_8168h_1(struct rtl8169_private *tp) |
2262 |
+ RTL_W8(tp, Config5, RTL_R8(tp, Config5) & ~ASPM_en); |
2263 |
+ rtl_ephy_init(tp, e_info_8168h_1, ARRAY_SIZE(e_info_8168h_1)); |
2264 |
+ |
2265 |
+- RTL_W32(tp, TxConfig, RTL_R32(tp, TxConfig) | TXCFG_AUTO_FIFO); |
2266 |
+- |
2267 |
+ rtl_eri_write(tp, 0xc8, ERIAR_MASK_0101, 0x00080002, ERIAR_EXGMAC); |
2268 |
+ rtl_eri_write(tp, 0xcc, ERIAR_MASK_0001, 0x38, ERIAR_EXGMAC); |
2269 |
+ rtl_eri_write(tp, 0xd0, ERIAR_MASK_0001, 0x48, ERIAR_EXGMAC); |
2270 |
+@@ -5789,8 +5788,6 @@ static void rtl_hw_start_8168ep(struct rtl8169_private *tp) |
2271 |
+ { |
2272 |
+ rtl8168ep_stop_cmac(tp); |
2273 |
+ |
2274 |
+- RTL_W32(tp, TxConfig, RTL_R32(tp, TxConfig) | TXCFG_AUTO_FIFO); |
2275 |
+- |
2276 |
+ rtl_eri_write(tp, 0xc8, ERIAR_MASK_0101, 0x00080002, ERIAR_EXGMAC); |
2277 |
+ rtl_eri_write(tp, 0xcc, ERIAR_MASK_0001, 0x2f, ERIAR_EXGMAC); |
2278 |
+ rtl_eri_write(tp, 0xd0, ERIAR_MASK_0001, 0x5f, ERIAR_EXGMAC); |
2279 |
+@@ -6108,7 +6105,6 @@ static void rtl_hw_start_8402(struct rtl8169_private *tp) |
2280 |
+ /* Force LAN exit from ASPM if Rx/Tx are not idle */ |
2281 |
+ RTL_W32(tp, FuncEvent, RTL_R32(tp, FuncEvent) | 0x002800); |
2282 |
+ |
2283 |
+- RTL_W32(tp, TxConfig, RTL_R32(tp, TxConfig) | TXCFG_AUTO_FIFO); |
2284 |
+ RTL_W8(tp, MCU, RTL_R8(tp, MCU) & ~NOW_IS_OOB); |
2285 |
+ |
2286 |
+ rtl_ephy_init(tp, e_info_8402, ARRAY_SIZE(e_info_8402)); |
2287 |
+diff --git a/drivers/net/ethernet/stmicro/stmmac/common.h b/drivers/net/ethernet/stmicro/stmmac/common.h |
2288 |
+index 78fd0f8b8e81..a15006e2fb29 100644 |
2289 |
+--- a/drivers/net/ethernet/stmicro/stmmac/common.h |
2290 |
++++ b/drivers/net/ethernet/stmicro/stmmac/common.h |
2291 |
+@@ -256,10 +256,10 @@ struct stmmac_safety_stats { |
2292 |
+ #define MAX_DMA_RIWT 0xff |
2293 |
+ #define MIN_DMA_RIWT 0x20 |
2294 |
+ /* Tx coalesce parameters */ |
2295 |
+-#define STMMAC_COAL_TX_TIMER 40000 |
2296 |
++#define STMMAC_COAL_TX_TIMER 1000 |
2297 |
+ #define STMMAC_MAX_COAL_TX_TICK 100000 |
2298 |
+ #define STMMAC_TX_MAX_FRAMES 256 |
2299 |
+-#define STMMAC_TX_FRAMES 64 |
2300 |
++#define STMMAC_TX_FRAMES 25 |
2301 |
+ |
2302 |
+ /* Packets types */ |
2303 |
+ enum packets_types { |
2304 |
+diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h |
2305 |
+index c0a855b7ab3b..63e1064b27a2 100644 |
2306 |
+--- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h |
2307 |
++++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h |
2308 |
+@@ -48,6 +48,8 @@ struct stmmac_tx_info { |
2309 |
+ |
2310 |
+ /* Frequently used values are kept adjacent for cache effect */ |
2311 |
+ struct stmmac_tx_queue { |
2312 |
++ u32 tx_count_frames; |
2313 |
++ struct timer_list txtimer; |
2314 |
+ u32 queue_index; |
2315 |
+ struct stmmac_priv *priv_data; |
2316 |
+ struct dma_extended_desc *dma_etx ____cacheline_aligned_in_smp; |
2317 |
+@@ -73,7 +75,14 @@ struct stmmac_rx_queue { |
2318 |
+ u32 rx_zeroc_thresh; |
2319 |
+ dma_addr_t dma_rx_phy; |
2320 |
+ u32 rx_tail_addr; |
2321 |
++}; |
2322 |
++ |
2323 |
++struct stmmac_channel { |
2324 |
+ struct napi_struct napi ____cacheline_aligned_in_smp; |
2325 |
++ struct stmmac_priv *priv_data; |
2326 |
++ u32 index; |
2327 |
++ int has_rx; |
2328 |
++ int has_tx; |
2329 |
+ }; |
2330 |
+ |
2331 |
+ struct stmmac_tc_entry { |
2332 |
+@@ -109,14 +118,12 @@ struct stmmac_pps_cfg { |
2333 |
+ |
2334 |
+ struct stmmac_priv { |
2335 |
+ /* Frequently used values are kept adjacent for cache effect */ |
2336 |
+- u32 tx_count_frames; |
2337 |
+ u32 tx_coal_frames; |
2338 |
+ u32 tx_coal_timer; |
2339 |
+ |
2340 |
+ int tx_coalesce; |
2341 |
+ int hwts_tx_en; |
2342 |
+ bool tx_path_in_lpi_mode; |
2343 |
+- struct timer_list txtimer; |
2344 |
+ bool tso; |
2345 |
+ |
2346 |
+ unsigned int dma_buf_sz; |
2347 |
+@@ -137,6 +144,9 @@ struct stmmac_priv { |
2348 |
+ /* TX Queue */ |
2349 |
+ struct stmmac_tx_queue tx_queue[MTL_MAX_TX_QUEUES]; |
2350 |
+ |
2351 |
++ /* Generic channel for NAPI */ |
2352 |
++ struct stmmac_channel channel[STMMAC_CH_MAX]; |
2353 |
++ |
2354 |
+ bool oldlink; |
2355 |
+ int speed; |
2356 |
+ int oldduplex; |
2357 |
+diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c |
2358 |
+index c579d98b9666..1c6ba74e294b 100644 |
2359 |
+--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c |
2360 |
++++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c |
2361 |
+@@ -147,12 +147,14 @@ static void stmmac_verify_args(void) |
2362 |
+ static void stmmac_disable_all_queues(struct stmmac_priv *priv) |
2363 |
+ { |
2364 |
+ u32 rx_queues_cnt = priv->plat->rx_queues_to_use; |
2365 |
++ u32 tx_queues_cnt = priv->plat->tx_queues_to_use; |
2366 |
++ u32 maxq = max(rx_queues_cnt, tx_queues_cnt); |
2367 |
+ u32 queue; |
2368 |
+ |
2369 |
+- for (queue = 0; queue < rx_queues_cnt; queue++) { |
2370 |
+- struct stmmac_rx_queue *rx_q = &priv->rx_queue[queue]; |
2371 |
++ for (queue = 0; queue < maxq; queue++) { |
2372 |
++ struct stmmac_channel *ch = &priv->channel[queue]; |
2373 |
+ |
2374 |
+- napi_disable(&rx_q->napi); |
2375 |
++ napi_disable(&ch->napi); |
2376 |
+ } |
2377 |
+ } |
2378 |
+ |
2379 |
+@@ -163,12 +165,14 @@ static void stmmac_disable_all_queues(struct stmmac_priv *priv) |
2380 |
+ static void stmmac_enable_all_queues(struct stmmac_priv *priv) |
2381 |
+ { |
2382 |
+ u32 rx_queues_cnt = priv->plat->rx_queues_to_use; |
2383 |
++ u32 tx_queues_cnt = priv->plat->tx_queues_to_use; |
2384 |
++ u32 maxq = max(rx_queues_cnt, tx_queues_cnt); |
2385 |
+ u32 queue; |
2386 |
+ |
2387 |
+- for (queue = 0; queue < rx_queues_cnt; queue++) { |
2388 |
+- struct stmmac_rx_queue *rx_q = &priv->rx_queue[queue]; |
2389 |
++ for (queue = 0; queue < maxq; queue++) { |
2390 |
++ struct stmmac_channel *ch = &priv->channel[queue]; |
2391 |
+ |
2392 |
+- napi_enable(&rx_q->napi); |
2393 |
++ napi_enable(&ch->napi); |
2394 |
+ } |
2395 |
+ } |
2396 |
+ |
2397 |
+@@ -1822,18 +1826,18 @@ static void stmmac_dma_operation_mode(struct stmmac_priv *priv) |
2398 |
+ * @queue: TX queue index |
2399 |
+ * Description: it reclaims the transmit resources after transmission completes. |
2400 |
+ */ |
2401 |
+-static void stmmac_tx_clean(struct stmmac_priv *priv, u32 queue) |
2402 |
++static int stmmac_tx_clean(struct stmmac_priv *priv, int budget, u32 queue) |
2403 |
+ { |
2404 |
+ struct stmmac_tx_queue *tx_q = &priv->tx_queue[queue]; |
2405 |
+ unsigned int bytes_compl = 0, pkts_compl = 0; |
2406 |
+- unsigned int entry; |
2407 |
++ unsigned int entry, count = 0; |
2408 |
+ |
2409 |
+- netif_tx_lock(priv->dev); |
2410 |
++ __netif_tx_lock_bh(netdev_get_tx_queue(priv->dev, queue)); |
2411 |
+ |
2412 |
+ priv->xstats.tx_clean++; |
2413 |
+ |
2414 |
+ entry = tx_q->dirty_tx; |
2415 |
+- while (entry != tx_q->cur_tx) { |
2416 |
++ while ((entry != tx_q->cur_tx) && (count < budget)) { |
2417 |
+ struct sk_buff *skb = tx_q->tx_skbuff[entry]; |
2418 |
+ struct dma_desc *p; |
2419 |
+ int status; |
2420 |
+@@ -1849,6 +1853,8 @@ static void stmmac_tx_clean(struct stmmac_priv *priv, u32 queue) |
2421 |
+ if (unlikely(status & tx_dma_own)) |
2422 |
+ break; |
2423 |
+ |
2424 |
++ count++; |
2425 |
++ |
2426 |
+ /* Make sure descriptor fields are read after reading |
2427 |
+ * the own bit. |
2428 |
+ */ |
2429 |
+@@ -1916,7 +1922,10 @@ static void stmmac_tx_clean(struct stmmac_priv *priv, u32 queue) |
2430 |
+ stmmac_enable_eee_mode(priv); |
2431 |
+ mod_timer(&priv->eee_ctrl_timer, STMMAC_LPI_T(eee_timer)); |
2432 |
+ } |
2433 |
+- netif_tx_unlock(priv->dev); |
2434 |
++ |
2435 |
++ __netif_tx_unlock_bh(netdev_get_tx_queue(priv->dev, queue)); |
2436 |
++ |
2437 |
++ return count; |
2438 |
+ } |
2439 |
+ |
2440 |
+ /** |
2441 |
+@@ -1999,6 +2008,33 @@ static bool stmmac_safety_feat_interrupt(struct stmmac_priv *priv) |
2442 |
+ return false; |
2443 |
+ } |
2444 |
+ |
2445 |
++static int stmmac_napi_check(struct stmmac_priv *priv, u32 chan) |
2446 |
++{ |
2447 |
++ int status = stmmac_dma_interrupt_status(priv, priv->ioaddr, |
2448 |
++ &priv->xstats, chan); |
2449 |
++ struct stmmac_channel *ch = &priv->channel[chan]; |
2450 |
++ bool needs_work = false; |
2451 |
++ |
2452 |
++ if ((status & handle_rx) && ch->has_rx) { |
2453 |
++ needs_work = true; |
2454 |
++ } else { |
2455 |
++ status &= ~handle_rx; |
2456 |
++ } |
2457 |
++ |
2458 |
++ if ((status & handle_tx) && ch->has_tx) { |
2459 |
++ needs_work = true; |
2460 |
++ } else { |
2461 |
++ status &= ~handle_tx; |
2462 |
++ } |
2463 |
++ |
2464 |
++ if (needs_work && napi_schedule_prep(&ch->napi)) { |
2465 |
++ stmmac_disable_dma_irq(priv, priv->ioaddr, chan); |
2466 |
++ __napi_schedule(&ch->napi); |
2467 |
++ } |
2468 |
++ |
2469 |
++ return status; |
2470 |
++} |
2471 |
++ |
2472 |
+ /** |
2473 |
+ * stmmac_dma_interrupt - DMA ISR |
2474 |
+ * @priv: driver private structure |
2475 |
+@@ -2013,57 +2049,14 @@ static void stmmac_dma_interrupt(struct stmmac_priv *priv) |
2476 |
+ u32 channels_to_check = tx_channel_count > rx_channel_count ? |
2477 |
+ tx_channel_count : rx_channel_count; |
2478 |
+ u32 chan; |
2479 |
+- bool poll_scheduled = false; |
2480 |
+ int status[max_t(u32, MTL_MAX_TX_QUEUES, MTL_MAX_RX_QUEUES)]; |
2481 |
+ |
2482 |
+ /* Make sure we never check beyond our status buffer. */ |
2483 |
+ if (WARN_ON_ONCE(channels_to_check > ARRAY_SIZE(status))) |
2484 |
+ channels_to_check = ARRAY_SIZE(status); |
2485 |
+ |
2486 |
+- /* Each DMA channel can be used for rx and tx simultaneously, yet |
2487 |
+- * napi_struct is embedded in struct stmmac_rx_queue rather than in a |
2488 |
+- * stmmac_channel struct. |
2489 |
+- * Because of this, stmmac_poll currently checks (and possibly wakes) |
2490 |
+- * all tx queues rather than just a single tx queue. |
2491 |
+- */ |
2492 |
+ for (chan = 0; chan < channels_to_check; chan++) |
2493 |
+- status[chan] = stmmac_dma_interrupt_status(priv, priv->ioaddr, |
2494 |
+- &priv->xstats, chan); |
2495 |
+- |
2496 |
+- for (chan = 0; chan < rx_channel_count; chan++) { |
2497 |
+- if (likely(status[chan] & handle_rx)) { |
2498 |
+- struct stmmac_rx_queue *rx_q = &priv->rx_queue[chan]; |
2499 |
+- |
2500 |
+- if (likely(napi_schedule_prep(&rx_q->napi))) { |
2501 |
+- stmmac_disable_dma_irq(priv, priv->ioaddr, chan); |
2502 |
+- __napi_schedule(&rx_q->napi); |
2503 |
+- poll_scheduled = true; |
2504 |
+- } |
2505 |
+- } |
2506 |
+- } |
2507 |
+- |
2508 |
+- /* If we scheduled poll, we already know that tx queues will be checked. |
2509 |
+- * If we didn't schedule poll, see if any DMA channel (used by tx) has a |
2510 |
+- * completed transmission, if so, call stmmac_poll (once). |
2511 |
+- */ |
2512 |
+- if (!poll_scheduled) { |
2513 |
+- for (chan = 0; chan < tx_channel_count; chan++) { |
2514 |
+- if (status[chan] & handle_tx) { |
2515 |
+- /* It doesn't matter what rx queue we choose |
2516 |
+- * here. We use 0 since it always exists. |
2517 |
+- */ |
2518 |
+- struct stmmac_rx_queue *rx_q = |
2519 |
+- &priv->rx_queue[0]; |
2520 |
+- |
2521 |
+- if (likely(napi_schedule_prep(&rx_q->napi))) { |
2522 |
+- stmmac_disable_dma_irq(priv, |
2523 |
+- priv->ioaddr, chan); |
2524 |
+- __napi_schedule(&rx_q->napi); |
2525 |
+- } |
2526 |
+- break; |
2527 |
+- } |
2528 |
+- } |
2529 |
+- } |
2530 |
++ status[chan] = stmmac_napi_check(priv, chan); |
2531 |
+ |
2532 |
+ for (chan = 0; chan < tx_channel_count; chan++) { |
2533 |
+ if (unlikely(status[chan] & tx_hard_error_bump_tc)) { |
2534 |
+@@ -2193,8 +2186,7 @@ static int stmmac_init_dma_engine(struct stmmac_priv *priv) |
2535 |
+ stmmac_init_tx_chan(priv, priv->ioaddr, priv->plat->dma_cfg, |
2536 |
+ tx_q->dma_tx_phy, chan); |
2537 |
+ |
2538 |
+- tx_q->tx_tail_addr = tx_q->dma_tx_phy + |
2539 |
+- (DMA_TX_SIZE * sizeof(struct dma_desc)); |
2540 |
++ tx_q->tx_tail_addr = tx_q->dma_tx_phy; |
2541 |
+ stmmac_set_tx_tail_ptr(priv, priv->ioaddr, |
2542 |
+ tx_q->tx_tail_addr, chan); |
2543 |
+ } |
2544 |
+@@ -2212,6 +2204,13 @@ static int stmmac_init_dma_engine(struct stmmac_priv *priv) |
2545 |
+ return ret; |
2546 |
+ } |
2547 |
+ |
2548 |
++static void stmmac_tx_timer_arm(struct stmmac_priv *priv, u32 queue) |
2549 |
++{ |
2550 |
++ struct stmmac_tx_queue *tx_q = &priv->tx_queue[queue]; |
2551 |
++ |
2552 |
++ mod_timer(&tx_q->txtimer, STMMAC_COAL_TIMER(priv->tx_coal_timer)); |
2553 |
++} |
2554 |
++ |
2555 |
+ /** |
2556 |
+ * stmmac_tx_timer - mitigation sw timer for tx. |
2557 |
+ * @data: data pointer |
2558 |
+@@ -2220,13 +2219,14 @@ static int stmmac_init_dma_engine(struct stmmac_priv *priv) |
2559 |
+ */ |
2560 |
+ static void stmmac_tx_timer(struct timer_list *t) |
2561 |
+ { |
2562 |
+- struct stmmac_priv *priv = from_timer(priv, t, txtimer); |
2563 |
+- u32 tx_queues_count = priv->plat->tx_queues_to_use; |
2564 |
+- u32 queue; |
2565 |
++ struct stmmac_tx_queue *tx_q = from_timer(tx_q, t, txtimer); |
2566 |
++ struct stmmac_priv *priv = tx_q->priv_data; |
2567 |
++ struct stmmac_channel *ch; |
2568 |
++ |
2569 |
++ ch = &priv->channel[tx_q->queue_index]; |
2570 |
+ |
2571 |
+- /* let's scan all the tx queues */ |
2572 |
+- for (queue = 0; queue < tx_queues_count; queue++) |
2573 |
+- stmmac_tx_clean(priv, queue); |
2574 |
++ if (likely(napi_schedule_prep(&ch->napi))) |
2575 |
++ __napi_schedule(&ch->napi); |
2576 |
+ } |
2577 |
+ |
2578 |
+ /** |
2579 |
+@@ -2239,11 +2239,17 @@ static void stmmac_tx_timer(struct timer_list *t) |
2580 |
+ */ |
2581 |
+ static void stmmac_init_tx_coalesce(struct stmmac_priv *priv) |
2582 |
+ { |
2583 |
++ u32 tx_channel_count = priv->plat->tx_queues_to_use; |
2584 |
++ u32 chan; |
2585 |
++ |
2586 |
+ priv->tx_coal_frames = STMMAC_TX_FRAMES; |
2587 |
+ priv->tx_coal_timer = STMMAC_COAL_TX_TIMER; |
2588 |
+- timer_setup(&priv->txtimer, stmmac_tx_timer, 0); |
2589 |
+- priv->txtimer.expires = STMMAC_COAL_TIMER(priv->tx_coal_timer); |
2590 |
+- add_timer(&priv->txtimer); |
2591 |
++ |
2592 |
++ for (chan = 0; chan < tx_channel_count; chan++) { |
2593 |
++ struct stmmac_tx_queue *tx_q = &priv->tx_queue[chan]; |
2594 |
++ |
2595 |
++ timer_setup(&tx_q->txtimer, stmmac_tx_timer, 0); |
2596 |
++ } |
2597 |
+ } |
2598 |
+ |
2599 |
+ static void stmmac_set_rings_length(struct stmmac_priv *priv) |
2600 |
+@@ -2571,6 +2577,7 @@ static void stmmac_hw_teardown(struct net_device *dev) |
2601 |
+ static int stmmac_open(struct net_device *dev) |
2602 |
+ { |
2603 |
+ struct stmmac_priv *priv = netdev_priv(dev); |
2604 |
++ u32 chan; |
2605 |
+ int ret; |
2606 |
+ |
2607 |
+ stmmac_check_ether_addr(priv); |
2608 |
+@@ -2667,7 +2674,9 @@ irq_error: |
2609 |
+ if (dev->phydev) |
2610 |
+ phy_stop(dev->phydev); |
2611 |
+ |
2612 |
+- del_timer_sync(&priv->txtimer); |
2613 |
++ for (chan = 0; chan < priv->plat->tx_queues_to_use; chan++) |
2614 |
++ del_timer_sync(&priv->tx_queue[chan].txtimer); |
2615 |
++ |
2616 |
+ stmmac_hw_teardown(dev); |
2617 |
+ init_error: |
2618 |
+ free_dma_desc_resources(priv); |
2619 |
+@@ -2687,6 +2696,7 @@ dma_desc_error: |
2620 |
+ static int stmmac_release(struct net_device *dev) |
2621 |
+ { |
2622 |
+ struct stmmac_priv *priv = netdev_priv(dev); |
2623 |
++ u32 chan; |
2624 |
+ |
2625 |
+ if (priv->eee_enabled) |
2626 |
+ del_timer_sync(&priv->eee_ctrl_timer); |
2627 |
+@@ -2701,7 +2711,8 @@ static int stmmac_release(struct net_device *dev) |
2628 |
+ |
2629 |
+ stmmac_disable_all_queues(priv); |
2630 |
+ |
2631 |
+- del_timer_sync(&priv->txtimer); |
2632 |
++ for (chan = 0; chan < priv->plat->tx_queues_to_use; chan++) |
2633 |
++ del_timer_sync(&priv->tx_queue[chan].txtimer); |
2634 |
+ |
2635 |
+ /* Free the IRQ lines */ |
2636 |
+ free_irq(dev->irq, dev); |
2637 |
+@@ -2915,14 +2926,13 @@ static netdev_tx_t stmmac_tso_xmit(struct sk_buff *skb, struct net_device *dev) |
2638 |
+ priv->xstats.tx_tso_nfrags += nfrags; |
2639 |
+ |
2640 |
+ /* Manage tx mitigation */ |
2641 |
+- priv->tx_count_frames += nfrags + 1; |
2642 |
+- if (likely(priv->tx_coal_frames > priv->tx_count_frames)) { |
2643 |
+- mod_timer(&priv->txtimer, |
2644 |
+- STMMAC_COAL_TIMER(priv->tx_coal_timer)); |
2645 |
+- } else { |
2646 |
+- priv->tx_count_frames = 0; |
2647 |
++ tx_q->tx_count_frames += nfrags + 1; |
2648 |
++ if (priv->tx_coal_frames <= tx_q->tx_count_frames) { |
2649 |
+ stmmac_set_tx_ic(priv, desc); |
2650 |
+ priv->xstats.tx_set_ic_bit++; |
2651 |
++ tx_q->tx_count_frames = 0; |
2652 |
++ } else { |
2653 |
++ stmmac_tx_timer_arm(priv, queue); |
2654 |
+ } |
2655 |
+ |
2656 |
+ skb_tx_timestamp(skb); |
2657 |
+@@ -2971,6 +2981,7 @@ static netdev_tx_t stmmac_tso_xmit(struct sk_buff *skb, struct net_device *dev) |
2658 |
+ |
2659 |
+ netdev_tx_sent_queue(netdev_get_tx_queue(dev, queue), skb->len); |
2660 |
+ |
2661 |
++ tx_q->tx_tail_addr = tx_q->dma_tx_phy + (tx_q->cur_tx * sizeof(*desc)); |
2662 |
+ stmmac_set_tx_tail_ptr(priv, priv->ioaddr, tx_q->tx_tail_addr, queue); |
2663 |
+ |
2664 |
+ return NETDEV_TX_OK; |
2665 |
+@@ -3125,14 +3136,13 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev) |
2666 |
+ * This approach takes care about the fragments: desc is the first |
2667 |
+ * element in case of no SG. |
2668 |
+ */ |
2669 |
+- priv->tx_count_frames += nfrags + 1; |
2670 |
+- if (likely(priv->tx_coal_frames > priv->tx_count_frames)) { |
2671 |
+- mod_timer(&priv->txtimer, |
2672 |
+- STMMAC_COAL_TIMER(priv->tx_coal_timer)); |
2673 |
+- } else { |
2674 |
+- priv->tx_count_frames = 0; |
2675 |
++ tx_q->tx_count_frames += nfrags + 1; |
2676 |
++ if (priv->tx_coal_frames <= tx_q->tx_count_frames) { |
2677 |
+ stmmac_set_tx_ic(priv, desc); |
2678 |
+ priv->xstats.tx_set_ic_bit++; |
2679 |
++ tx_q->tx_count_frames = 0; |
2680 |
++ } else { |
2681 |
++ stmmac_tx_timer_arm(priv, queue); |
2682 |
+ } |
2683 |
+ |
2684 |
+ skb_tx_timestamp(skb); |
2685 |
+@@ -3178,6 +3188,8 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev) |
2686 |
+ netdev_tx_sent_queue(netdev_get_tx_queue(dev, queue), skb->len); |
2687 |
+ |
2688 |
+ stmmac_enable_dma_transmission(priv, priv->ioaddr); |
2689 |
++ |
2690 |
++ tx_q->tx_tail_addr = tx_q->dma_tx_phy + (tx_q->cur_tx * sizeof(*desc)); |
2691 |
+ stmmac_set_tx_tail_ptr(priv, priv->ioaddr, tx_q->tx_tail_addr, queue); |
2692 |
+ |
2693 |
+ return NETDEV_TX_OK; |
2694 |
+@@ -3298,6 +3310,7 @@ static inline void stmmac_rx_refill(struct stmmac_priv *priv, u32 queue) |
2695 |
+ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue) |
2696 |
+ { |
2697 |
+ struct stmmac_rx_queue *rx_q = &priv->rx_queue[queue]; |
2698 |
++ struct stmmac_channel *ch = &priv->channel[queue]; |
2699 |
+ unsigned int entry = rx_q->cur_rx; |
2700 |
+ int coe = priv->hw->rx_csum; |
2701 |
+ unsigned int next_entry; |
2702 |
+@@ -3467,7 +3480,7 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue) |
2703 |
+ else |
2704 |
+ skb->ip_summed = CHECKSUM_UNNECESSARY; |
2705 |
+ |
2706 |
+- napi_gro_receive(&rx_q->napi, skb); |
2707 |
++ napi_gro_receive(&ch->napi, skb); |
2708 |
+ |
2709 |
+ priv->dev->stats.rx_packets++; |
2710 |
+ priv->dev->stats.rx_bytes += frame_len; |
2711 |
+@@ -3490,27 +3503,33 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue) |
2712 |
+ * Description : |
2713 |
+ * To look at the incoming frames and clear the tx resources. |
2714 |
+ */ |
2715 |
+-static int stmmac_poll(struct napi_struct *napi, int budget) |
2716 |
++static int stmmac_napi_poll(struct napi_struct *napi, int budget) |
2717 |
+ { |
2718 |
+- struct stmmac_rx_queue *rx_q = |
2719 |
+- container_of(napi, struct stmmac_rx_queue, napi); |
2720 |
+- struct stmmac_priv *priv = rx_q->priv_data; |
2721 |
+- u32 tx_count = priv->plat->tx_queues_to_use; |
2722 |
+- u32 chan = rx_q->queue_index; |
2723 |
+- int work_done = 0; |
2724 |
+- u32 queue; |
2725 |
++ struct stmmac_channel *ch = |
2726 |
++ container_of(napi, struct stmmac_channel, napi); |
2727 |
++ struct stmmac_priv *priv = ch->priv_data; |
2728 |
++ int work_done = 0, work_rem = budget; |
2729 |
++ u32 chan = ch->index; |
2730 |
+ |
2731 |
+ priv->xstats.napi_poll++; |
2732 |
+ |
2733 |
+- /* check all the queues */ |
2734 |
+- for (queue = 0; queue < tx_count; queue++) |
2735 |
+- stmmac_tx_clean(priv, queue); |
2736 |
++ if (ch->has_tx) { |
2737 |
++ int done = stmmac_tx_clean(priv, work_rem, chan); |
2738 |
+ |
2739 |
+- work_done = stmmac_rx(priv, budget, rx_q->queue_index); |
2740 |
+- if (work_done < budget) { |
2741 |
+- napi_complete_done(napi, work_done); |
2742 |
+- stmmac_enable_dma_irq(priv, priv->ioaddr, chan); |
2743 |
++ work_done += done; |
2744 |
++ work_rem -= done; |
2745 |
++ } |
2746 |
++ |
2747 |
++ if (ch->has_rx) { |
2748 |
++ int done = stmmac_rx(priv, work_rem, chan); |
2749 |
++ |
2750 |
++ work_done += done; |
2751 |
++ work_rem -= done; |
2752 |
+ } |
2753 |
++ |
2754 |
++ if (work_done < budget && napi_complete_done(napi, work_done)) |
2755 |
++ stmmac_enable_dma_irq(priv, priv->ioaddr, chan); |
2756 |
++ |
2757 |
+ return work_done; |
2758 |
+ } |
2759 |
+ |
2760 |
+@@ -4170,8 +4189,8 @@ int stmmac_dvr_probe(struct device *device, |
2761 |
+ { |
2762 |
+ struct net_device *ndev = NULL; |
2763 |
+ struct stmmac_priv *priv; |
2764 |
++ u32 queue, maxq; |
2765 |
+ int ret = 0; |
2766 |
+- u32 queue; |
2767 |
+ |
2768 |
+ ndev = alloc_etherdev_mqs(sizeof(struct stmmac_priv), |
2769 |
+ MTL_MAX_TX_QUEUES, |
2770 |
+@@ -4291,11 +4310,22 @@ int stmmac_dvr_probe(struct device *device, |
2771 |
+ "Enable RX Mitigation via HW Watchdog Timer\n"); |
2772 |
+ } |
2773 |
+ |
2774 |
+- for (queue = 0; queue < priv->plat->rx_queues_to_use; queue++) { |
2775 |
+- struct stmmac_rx_queue *rx_q = &priv->rx_queue[queue]; |
2776 |
++ /* Setup channels NAPI */ |
2777 |
++ maxq = max(priv->plat->rx_queues_to_use, priv->plat->tx_queues_to_use); |
2778 |
+ |
2779 |
+- netif_napi_add(ndev, &rx_q->napi, stmmac_poll, |
2780 |
+- (8 * priv->plat->rx_queues_to_use)); |
2781 |
++ for (queue = 0; queue < maxq; queue++) { |
2782 |
++ struct stmmac_channel *ch = &priv->channel[queue]; |
2783 |
++ |
2784 |
++ ch->priv_data = priv; |
2785 |
++ ch->index = queue; |
2786 |
++ |
2787 |
++ if (queue < priv->plat->rx_queues_to_use) |
2788 |
++ ch->has_rx = true; |
2789 |
++ if (queue < priv->plat->tx_queues_to_use) |
2790 |
++ ch->has_tx = true; |
2791 |
++ |
2792 |
++ netif_napi_add(ndev, &ch->napi, stmmac_napi_poll, |
2793 |
++ NAPI_POLL_WEIGHT); |
2794 |
+ } |
2795 |
+ |
2796 |
+ mutex_init(&priv->lock); |
2797 |
+@@ -4341,10 +4371,10 @@ error_netdev_register: |
2798 |
+ priv->hw->pcs != STMMAC_PCS_RTBI) |
2799 |
+ stmmac_mdio_unregister(ndev); |
2800 |
+ error_mdio_register: |
2801 |
+- for (queue = 0; queue < priv->plat->rx_queues_to_use; queue++) { |
2802 |
+- struct stmmac_rx_queue *rx_q = &priv->rx_queue[queue]; |
2803 |
++ for (queue = 0; queue < maxq; queue++) { |
2804 |
++ struct stmmac_channel *ch = &priv->channel[queue]; |
2805 |
+ |
2806 |
+- netif_napi_del(&rx_q->napi); |
2807 |
++ netif_napi_del(&ch->napi); |
2808 |
+ } |
2809 |
+ error_hw_init: |
2810 |
+ destroy_workqueue(priv->wq); |
2811 |
+diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c |
2812 |
+index 72da77b94ecd..8a3867cec67a 100644 |
2813 |
+--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c |
2814 |
++++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c |
2815 |
+@@ -67,7 +67,7 @@ static int dwmac1000_validate_mcast_bins(int mcast_bins) |
2816 |
+ * Description: |
2817 |
+ * This function validates the number of Unicast address entries supported |
2818 |
+ * by a particular Synopsys 10/100/1000 controller. The Synopsys controller |
2819 |
+- * supports 1, 32, 64, or 128 Unicast filter entries for it's Unicast filter |
2820 |
++ * supports 1..32, 64, or 128 Unicast filter entries for it's Unicast filter |
2821 |
+ * logic. This function validates a valid, supported configuration is |
2822 |
+ * selected, and defaults to 1 Unicast address if an unsupported |
2823 |
+ * configuration is selected. |
2824 |
+@@ -77,8 +77,7 @@ static int dwmac1000_validate_ucast_entries(int ucast_entries) |
2825 |
+ int x = ucast_entries; |
2826 |
+ |
2827 |
+ switch (x) { |
2828 |
+- case 1: |
2829 |
+- case 32: |
2830 |
++ case 1 ... 32: |
2831 |
+ case 64: |
2832 |
+ case 128: |
2833 |
+ break; |
2834 |
+diff --git a/drivers/net/ethernet/ti/Kconfig b/drivers/net/ethernet/ti/Kconfig |
2835 |
+index 9263d638bd6d..f932923f7d56 100644 |
2836 |
+--- a/drivers/net/ethernet/ti/Kconfig |
2837 |
++++ b/drivers/net/ethernet/ti/Kconfig |
2838 |
+@@ -41,6 +41,7 @@ config TI_DAVINCI_MDIO |
2839 |
+ config TI_DAVINCI_CPDMA |
2840 |
+ tristate "TI DaVinci CPDMA Support" |
2841 |
+ depends on ARCH_DAVINCI || ARCH_OMAP2PLUS || COMPILE_TEST |
2842 |
++ select GENERIC_ALLOCATOR |
2843 |
+ ---help--- |
2844 |
+ This driver supports TI's DaVinci CPDMA dma engine. |
2845 |
+ |
2846 |
+diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c |
2847 |
+index af4dc4425be2..5827fccd4f29 100644 |
2848 |
+--- a/drivers/net/phy/phylink.c |
2849 |
++++ b/drivers/net/phy/phylink.c |
2850 |
+@@ -717,6 +717,30 @@ static int phylink_bringup_phy(struct phylink *pl, struct phy_device *phy) |
2851 |
+ return 0; |
2852 |
+ } |
2853 |
+ |
2854 |
++static int __phylink_connect_phy(struct phylink *pl, struct phy_device *phy, |
2855 |
++ phy_interface_t interface) |
2856 |
++{ |
2857 |
++ int ret; |
2858 |
++ |
2859 |
++ if (WARN_ON(pl->link_an_mode == MLO_AN_FIXED || |
2860 |
++ (pl->link_an_mode == MLO_AN_INBAND && |
2861 |
++ phy_interface_mode_is_8023z(interface)))) |
2862 |
++ return -EINVAL; |
2863 |
++ |
2864 |
++ if (pl->phydev) |
2865 |
++ return -EBUSY; |
2866 |
++ |
2867 |
++ ret = phy_attach_direct(pl->netdev, phy, 0, interface); |
2868 |
++ if (ret) |
2869 |
++ return ret; |
2870 |
++ |
2871 |
++ ret = phylink_bringup_phy(pl, phy); |
2872 |
++ if (ret) |
2873 |
++ phy_detach(phy); |
2874 |
++ |
2875 |
++ return ret; |
2876 |
++} |
2877 |
++ |
2878 |
+ /** |
2879 |
+ * phylink_connect_phy() - connect a PHY to the phylink instance |
2880 |
+ * @pl: a pointer to a &struct phylink returned from phylink_create() |
2881 |
+@@ -734,31 +758,13 @@ static int phylink_bringup_phy(struct phylink *pl, struct phy_device *phy) |
2882 |
+ */ |
2883 |
+ int phylink_connect_phy(struct phylink *pl, struct phy_device *phy) |
2884 |
+ { |
2885 |
+- int ret; |
2886 |
+- |
2887 |
+- if (WARN_ON(pl->link_an_mode == MLO_AN_FIXED || |
2888 |
+- (pl->link_an_mode == MLO_AN_INBAND && |
2889 |
+- phy_interface_mode_is_8023z(pl->link_interface)))) |
2890 |
+- return -EINVAL; |
2891 |
+- |
2892 |
+- if (pl->phydev) |
2893 |
+- return -EBUSY; |
2894 |
+- |
2895 |
+ /* Use PHY device/driver interface */ |
2896 |
+ if (pl->link_interface == PHY_INTERFACE_MODE_NA) { |
2897 |
+ pl->link_interface = phy->interface; |
2898 |
+ pl->link_config.interface = pl->link_interface; |
2899 |
+ } |
2900 |
+ |
2901 |
+- ret = phy_attach_direct(pl->netdev, phy, 0, pl->link_interface); |
2902 |
+- if (ret) |
2903 |
+- return ret; |
2904 |
+- |
2905 |
+- ret = phylink_bringup_phy(pl, phy); |
2906 |
+- if (ret) |
2907 |
+- phy_detach(phy); |
2908 |
+- |
2909 |
+- return ret; |
2910 |
++ return __phylink_connect_phy(pl, phy, pl->link_interface); |
2911 |
+ } |
2912 |
+ EXPORT_SYMBOL_GPL(phylink_connect_phy); |
2913 |
+ |
2914 |
+@@ -1672,7 +1678,9 @@ static void phylink_sfp_link_up(void *upstream) |
2915 |
+ |
2916 |
+ static int phylink_sfp_connect_phy(void *upstream, struct phy_device *phy) |
2917 |
+ { |
2918 |
+- return phylink_connect_phy(upstream, phy); |
2919 |
++ struct phylink *pl = upstream; |
2920 |
++ |
2921 |
++ return __phylink_connect_phy(upstream, phy, pl->link_config.interface); |
2922 |
+ } |
2923 |
+ |
2924 |
+ static void phylink_sfp_disconnect_phy(void *upstream) |
2925 |
+diff --git a/drivers/net/phy/sfp-bus.c b/drivers/net/phy/sfp-bus.c |
2926 |
+index 740655261e5b..83060fb349f4 100644 |
2927 |
+--- a/drivers/net/phy/sfp-bus.c |
2928 |
++++ b/drivers/net/phy/sfp-bus.c |
2929 |
+@@ -349,6 +349,7 @@ static int sfp_register_bus(struct sfp_bus *bus) |
2930 |
+ } |
2931 |
+ if (bus->started) |
2932 |
+ bus->socket_ops->start(bus->sfp); |
2933 |
++ bus->netdev->sfp_bus = bus; |
2934 |
+ bus->registered = true; |
2935 |
+ return 0; |
2936 |
+ } |
2937 |
+@@ -357,6 +358,7 @@ static void sfp_unregister_bus(struct sfp_bus *bus) |
2938 |
+ { |
2939 |
+ const struct sfp_upstream_ops *ops = bus->upstream_ops; |
2940 |
+ |
2941 |
++ bus->netdev->sfp_bus = NULL; |
2942 |
+ if (bus->registered) { |
2943 |
+ if (bus->started) |
2944 |
+ bus->socket_ops->stop(bus->sfp); |
2945 |
+@@ -438,7 +440,6 @@ static void sfp_upstream_clear(struct sfp_bus *bus) |
2946 |
+ { |
2947 |
+ bus->upstream_ops = NULL; |
2948 |
+ bus->upstream = NULL; |
2949 |
+- bus->netdev->sfp_bus = NULL; |
2950 |
+ bus->netdev = NULL; |
2951 |
+ } |
2952 |
+ |
2953 |
+@@ -467,7 +468,6 @@ struct sfp_bus *sfp_register_upstream(struct fwnode_handle *fwnode, |
2954 |
+ bus->upstream_ops = ops; |
2955 |
+ bus->upstream = upstream; |
2956 |
+ bus->netdev = ndev; |
2957 |
+- ndev->sfp_bus = bus; |
2958 |
+ |
2959 |
+ if (bus->sfp) { |
2960 |
+ ret = sfp_register_bus(bus); |
2961 |
+diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c |
2962 |
+index b070959737ff..286c947cb48d 100644 |
2963 |
+--- a/drivers/net/team/team.c |
2964 |
++++ b/drivers/net/team/team.c |
2965 |
+@@ -1172,6 +1172,12 @@ static int team_port_add(struct team *team, struct net_device *port_dev, |
2966 |
+ return -EBUSY; |
2967 |
+ } |
2968 |
+ |
2969 |
++ if (dev == port_dev) { |
2970 |
++ NL_SET_ERR_MSG(extack, "Cannot enslave team device to itself"); |
2971 |
++ netdev_err(dev, "Cannot enslave team device to itself\n"); |
2972 |
++ return -EINVAL; |
2973 |
++ } |
2974 |
++ |
2975 |
+ if (port_dev->features & NETIF_F_VLAN_CHALLENGED && |
2976 |
+ vlan_uses_dev(dev)) { |
2977 |
+ NL_SET_ERR_MSG(extack, "Device is VLAN challenged and team device has VLAN set up"); |
2978 |
+diff --git a/drivers/net/tun.c b/drivers/net/tun.c |
2979 |
+index f5727baac84a..725dd63f8413 100644 |
2980 |
+--- a/drivers/net/tun.c |
2981 |
++++ b/drivers/net/tun.c |
2982 |
+@@ -181,6 +181,7 @@ struct tun_file { |
2983 |
+ }; |
2984 |
+ struct napi_struct napi; |
2985 |
+ bool napi_enabled; |
2986 |
++ bool napi_frags_enabled; |
2987 |
+ struct mutex napi_mutex; /* Protects access to the above napi */ |
2988 |
+ struct list_head next; |
2989 |
+ struct tun_struct *detached; |
2990 |
+@@ -312,32 +313,32 @@ static int tun_napi_poll(struct napi_struct *napi, int budget) |
2991 |
+ } |
2992 |
+ |
2993 |
+ static void tun_napi_init(struct tun_struct *tun, struct tun_file *tfile, |
2994 |
+- bool napi_en) |
2995 |
++ bool napi_en, bool napi_frags) |
2996 |
+ { |
2997 |
+ tfile->napi_enabled = napi_en; |
2998 |
++ tfile->napi_frags_enabled = napi_en && napi_frags; |
2999 |
+ if (napi_en) { |
3000 |
+ netif_napi_add(tun->dev, &tfile->napi, tun_napi_poll, |
3001 |
+ NAPI_POLL_WEIGHT); |
3002 |
+ napi_enable(&tfile->napi); |
3003 |
+- mutex_init(&tfile->napi_mutex); |
3004 |
+ } |
3005 |
+ } |
3006 |
+ |
3007 |
+-static void tun_napi_disable(struct tun_struct *tun, struct tun_file *tfile) |
3008 |
++static void tun_napi_disable(struct tun_file *tfile) |
3009 |
+ { |
3010 |
+ if (tfile->napi_enabled) |
3011 |
+ napi_disable(&tfile->napi); |
3012 |
+ } |
3013 |
+ |
3014 |
+-static void tun_napi_del(struct tun_struct *tun, struct tun_file *tfile) |
3015 |
++static void tun_napi_del(struct tun_file *tfile) |
3016 |
+ { |
3017 |
+ if (tfile->napi_enabled) |
3018 |
+ netif_napi_del(&tfile->napi); |
3019 |
+ } |
3020 |
+ |
3021 |
+-static bool tun_napi_frags_enabled(const struct tun_struct *tun) |
3022 |
++static bool tun_napi_frags_enabled(const struct tun_file *tfile) |
3023 |
+ { |
3024 |
+- return READ_ONCE(tun->flags) & IFF_NAPI_FRAGS; |
3025 |
++ return tfile->napi_frags_enabled; |
3026 |
+ } |
3027 |
+ |
3028 |
+ #ifdef CONFIG_TUN_VNET_CROSS_LE |
3029 |
+@@ -688,8 +689,8 @@ static void __tun_detach(struct tun_file *tfile, bool clean) |
3030 |
+ tun = rtnl_dereference(tfile->tun); |
3031 |
+ |
3032 |
+ if (tun && clean) { |
3033 |
+- tun_napi_disable(tun, tfile); |
3034 |
+- tun_napi_del(tun, tfile); |
3035 |
++ tun_napi_disable(tfile); |
3036 |
++ tun_napi_del(tfile); |
3037 |
+ } |
3038 |
+ |
3039 |
+ if (tun && !tfile->detached) { |
3040 |
+@@ -756,7 +757,7 @@ static void tun_detach_all(struct net_device *dev) |
3041 |
+ for (i = 0; i < n; i++) { |
3042 |
+ tfile = rtnl_dereference(tun->tfiles[i]); |
3043 |
+ BUG_ON(!tfile); |
3044 |
+- tun_napi_disable(tun, tfile); |
3045 |
++ tun_napi_disable(tfile); |
3046 |
+ tfile->socket.sk->sk_shutdown = RCV_SHUTDOWN; |
3047 |
+ tfile->socket.sk->sk_data_ready(tfile->socket.sk); |
3048 |
+ RCU_INIT_POINTER(tfile->tun, NULL); |
3049 |
+@@ -772,7 +773,7 @@ static void tun_detach_all(struct net_device *dev) |
3050 |
+ synchronize_net(); |
3051 |
+ for (i = 0; i < n; i++) { |
3052 |
+ tfile = rtnl_dereference(tun->tfiles[i]); |
3053 |
+- tun_napi_del(tun, tfile); |
3054 |
++ tun_napi_del(tfile); |
3055 |
+ /* Drop read queue */ |
3056 |
+ tun_queue_purge(tfile); |
3057 |
+ xdp_rxq_info_unreg(&tfile->xdp_rxq); |
3058 |
+@@ -791,7 +792,7 @@ static void tun_detach_all(struct net_device *dev) |
3059 |
+ } |
3060 |
+ |
3061 |
+ static int tun_attach(struct tun_struct *tun, struct file *file, |
3062 |
+- bool skip_filter, bool napi) |
3063 |
++ bool skip_filter, bool napi, bool napi_frags) |
3064 |
+ { |
3065 |
+ struct tun_file *tfile = file->private_data; |
3066 |
+ struct net_device *dev = tun->dev; |
3067 |
+@@ -864,7 +865,7 @@ static int tun_attach(struct tun_struct *tun, struct file *file, |
3068 |
+ tun_enable_queue(tfile); |
3069 |
+ } else { |
3070 |
+ sock_hold(&tfile->sk); |
3071 |
+- tun_napi_init(tun, tfile, napi); |
3072 |
++ tun_napi_init(tun, tfile, napi, napi_frags); |
3073 |
+ } |
3074 |
+ |
3075 |
+ tun_set_real_num_queues(tun); |
3076 |
+@@ -1174,13 +1175,11 @@ static void tun_poll_controller(struct net_device *dev) |
3077 |
+ struct tun_file *tfile; |
3078 |
+ int i; |
3079 |
+ |
3080 |
+- if (tun_napi_frags_enabled(tun)) |
3081 |
+- return; |
3082 |
+- |
3083 |
+ rcu_read_lock(); |
3084 |
+ for (i = 0; i < tun->numqueues; i++) { |
3085 |
+ tfile = rcu_dereference(tun->tfiles[i]); |
3086 |
+- if (tfile->napi_enabled) |
3087 |
++ if (!tun_napi_frags_enabled(tfile) && |
3088 |
++ tfile->napi_enabled) |
3089 |
+ napi_schedule(&tfile->napi); |
3090 |
+ } |
3091 |
+ rcu_read_unlock(); |
3092 |
+@@ -1751,7 +1750,7 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile, |
3093 |
+ int err; |
3094 |
+ u32 rxhash = 0; |
3095 |
+ int skb_xdp = 1; |
3096 |
+- bool frags = tun_napi_frags_enabled(tun); |
3097 |
++ bool frags = tun_napi_frags_enabled(tfile); |
3098 |
+ |
3099 |
+ if (!(tun->dev->flags & IFF_UP)) |
3100 |
+ return -EIO; |
3101 |
+@@ -2576,7 +2575,8 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr) |
3102 |
+ return err; |
3103 |
+ |
3104 |
+ err = tun_attach(tun, file, ifr->ifr_flags & IFF_NOFILTER, |
3105 |
+- ifr->ifr_flags & IFF_NAPI); |
3106 |
++ ifr->ifr_flags & IFF_NAPI, |
3107 |
++ ifr->ifr_flags & IFF_NAPI_FRAGS); |
3108 |
+ if (err < 0) |
3109 |
+ return err; |
3110 |
+ |
3111 |
+@@ -2674,7 +2674,8 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr) |
3112 |
+ (ifr->ifr_flags & TUN_FEATURES); |
3113 |
+ |
3114 |
+ INIT_LIST_HEAD(&tun->disabled); |
3115 |
+- err = tun_attach(tun, file, false, ifr->ifr_flags & IFF_NAPI); |
3116 |
++ err = tun_attach(tun, file, false, ifr->ifr_flags & IFF_NAPI, |
3117 |
++ ifr->ifr_flags & IFF_NAPI_FRAGS); |
3118 |
+ if (err < 0) |
3119 |
+ goto err_free_flow; |
3120 |
+ |
3121 |
+@@ -2823,7 +2824,8 @@ static int tun_set_queue(struct file *file, struct ifreq *ifr) |
3122 |
+ ret = security_tun_dev_attach_queue(tun->security); |
3123 |
+ if (ret < 0) |
3124 |
+ goto unlock; |
3125 |
+- ret = tun_attach(tun, file, false, tun->flags & IFF_NAPI); |
3126 |
++ ret = tun_attach(tun, file, false, tun->flags & IFF_NAPI, |
3127 |
++ tun->flags & IFF_NAPI_FRAGS); |
3128 |
+ } else if (ifr->ifr_flags & IFF_DETACH_QUEUE) { |
3129 |
+ tun = rtnl_dereference(tfile->tun); |
3130 |
+ if (!tun || !(tun->flags & IFF_MULTI_QUEUE) || tfile->detached) |
3131 |
+@@ -3241,6 +3243,7 @@ static int tun_chr_open(struct inode *inode, struct file * file) |
3132 |
+ return -ENOMEM; |
3133 |
+ } |
3134 |
+ |
3135 |
++ mutex_init(&tfile->napi_mutex); |
3136 |
+ RCU_INIT_POINTER(tfile->tun, NULL); |
3137 |
+ tfile->flags = 0; |
3138 |
+ tfile->ifindex = 0; |
3139 |
+diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c |
3140 |
+index 1e95d37c6e27..1bb01a9e5f92 100644 |
3141 |
+--- a/drivers/net/usb/qmi_wwan.c |
3142 |
++++ b/drivers/net/usb/qmi_wwan.c |
3143 |
+@@ -1234,6 +1234,7 @@ static const struct usb_device_id products[] = { |
3144 |
+ {QMI_FIXED_INTF(0x0b3c, 0xc00b, 4)}, /* Olivetti Olicard 500 */ |
3145 |
+ {QMI_FIXED_INTF(0x1e2d, 0x0060, 4)}, /* Cinterion PLxx */ |
3146 |
+ {QMI_FIXED_INTF(0x1e2d, 0x0053, 4)}, /* Cinterion PHxx,PXxx */ |
3147 |
++ {QMI_FIXED_INTF(0x1e2d, 0x0063, 10)}, /* Cinterion ALASxx (1 RmNet) */ |
3148 |
+ {QMI_FIXED_INTF(0x1e2d, 0x0082, 4)}, /* Cinterion PHxx,PXxx (2 RmNet) */ |
3149 |
+ {QMI_FIXED_INTF(0x1e2d, 0x0082, 5)}, /* Cinterion PHxx,PXxx (2 RmNet) */ |
3150 |
+ {QMI_FIXED_INTF(0x1e2d, 0x0083, 4)}, /* Cinterion PHxx,PXxx (1 RmNet + USB Audio)*/ |
3151 |
+diff --git a/drivers/net/usb/smsc75xx.c b/drivers/net/usb/smsc75xx.c |
3152 |
+index 05553d252446..b64b1ee56d2d 100644 |
3153 |
+--- a/drivers/net/usb/smsc75xx.c |
3154 |
++++ b/drivers/net/usb/smsc75xx.c |
3155 |
+@@ -1517,6 +1517,7 @@ static void smsc75xx_unbind(struct usbnet *dev, struct usb_interface *intf) |
3156 |
+ { |
3157 |
+ struct smsc75xx_priv *pdata = (struct smsc75xx_priv *)(dev->data[0]); |
3158 |
+ if (pdata) { |
3159 |
++ cancel_work_sync(&pdata->set_multicast); |
3160 |
+ netif_dbg(dev, ifdown, dev->net, "free pdata\n"); |
3161 |
+ kfree(pdata); |
3162 |
+ pdata = NULL; |
3163 |
+diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c |
3164 |
+index e857cb3335f6..93a6c43a2354 100644 |
3165 |
+--- a/drivers/net/vxlan.c |
3166 |
++++ b/drivers/net/vxlan.c |
3167 |
+@@ -3537,6 +3537,7 @@ static size_t vxlan_get_size(const struct net_device *dev) |
3168 |
+ nla_total_size(sizeof(__u32)) + /* IFLA_VXLAN_LINK */ |
3169 |
+ nla_total_size(sizeof(struct in6_addr)) + /* IFLA_VXLAN_LOCAL{6} */ |
3170 |
+ nla_total_size(sizeof(__u8)) + /* IFLA_VXLAN_TTL */ |
3171 |
++ nla_total_size(sizeof(__u8)) + /* IFLA_VXLAN_TTL_INHERIT */ |
3172 |
+ nla_total_size(sizeof(__u8)) + /* IFLA_VXLAN_TOS */ |
3173 |
+ nla_total_size(sizeof(__be32)) + /* IFLA_VXLAN_LABEL */ |
3174 |
+ nla_total_size(sizeof(__u8)) + /* IFLA_VXLAN_LEARNING */ |
3175 |
+@@ -3601,6 +3602,8 @@ static int vxlan_fill_info(struct sk_buff *skb, const struct net_device *dev) |
3176 |
+ } |
3177 |
+ |
3178 |
+ if (nla_put_u8(skb, IFLA_VXLAN_TTL, vxlan->cfg.ttl) || |
3179 |
++ nla_put_u8(skb, IFLA_VXLAN_TTL_INHERIT, |
3180 |
++ !!(vxlan->cfg.flags & VXLAN_F_TTL_INHERIT)) || |
3181 |
+ nla_put_u8(skb, IFLA_VXLAN_TOS, vxlan->cfg.tos) || |
3182 |
+ nla_put_be32(skb, IFLA_VXLAN_LABEL, vxlan->cfg.label) || |
3183 |
+ nla_put_u8(skb, IFLA_VXLAN_LEARNING, |
3184 |
+diff --git a/drivers/pci/controller/pci-hyperv.c b/drivers/pci/controller/pci-hyperv.c |
3185 |
+index d4d4a55f09f8..c6f375e9cce7 100644 |
3186 |
+--- a/drivers/pci/controller/pci-hyperv.c |
3187 |
++++ b/drivers/pci/controller/pci-hyperv.c |
3188 |
+@@ -89,6 +89,9 @@ static enum pci_protocol_version_t pci_protocol_version; |
3189 |
+ |
3190 |
+ #define STATUS_REVISION_MISMATCH 0xC0000059 |
3191 |
+ |
3192 |
++/* space for 32bit serial number as string */ |
3193 |
++#define SLOT_NAME_SIZE 11 |
3194 |
++ |
3195 |
+ /* |
3196 |
+ * Message Types |
3197 |
+ */ |
3198 |
+@@ -494,6 +497,7 @@ struct hv_pci_dev { |
3199 |
+ struct list_head list_entry; |
3200 |
+ refcount_t refs; |
3201 |
+ enum hv_pcichild_state state; |
3202 |
++ struct pci_slot *pci_slot; |
3203 |
+ struct pci_function_description desc; |
3204 |
+ bool reported_missing; |
3205 |
+ struct hv_pcibus_device *hbus; |
3206 |
+@@ -1457,6 +1461,34 @@ static void prepopulate_bars(struct hv_pcibus_device *hbus) |
3207 |
+ spin_unlock_irqrestore(&hbus->device_list_lock, flags); |
3208 |
+ } |
3209 |
+ |
3210 |
++/* |
3211 |
++ * Assign entries in sysfs pci slot directory. |
3212 |
++ * |
3213 |
++ * Note that this function does not need to lock the children list |
3214 |
++ * because it is called from pci_devices_present_work which |
3215 |
++ * is serialized with hv_eject_device_work because they are on the |
3216 |
++ * same ordered workqueue. Therefore hbus->children list will not change |
3217 |
++ * even when pci_create_slot sleeps. |
3218 |
++ */ |
3219 |
++static void hv_pci_assign_slots(struct hv_pcibus_device *hbus) |
3220 |
++{ |
3221 |
++ struct hv_pci_dev *hpdev; |
3222 |
++ char name[SLOT_NAME_SIZE]; |
3223 |
++ int slot_nr; |
3224 |
++ |
3225 |
++ list_for_each_entry(hpdev, &hbus->children, list_entry) { |
3226 |
++ if (hpdev->pci_slot) |
3227 |
++ continue; |
3228 |
++ |
3229 |
++ slot_nr = PCI_SLOT(wslot_to_devfn(hpdev->desc.win_slot.slot)); |
3230 |
++ snprintf(name, SLOT_NAME_SIZE, "%u", hpdev->desc.ser); |
3231 |
++ hpdev->pci_slot = pci_create_slot(hbus->pci_bus, slot_nr, |
3232 |
++ name, NULL); |
3233 |
++ if (!hpdev->pci_slot) |
3234 |
++ pr_warn("pci_create slot %s failed\n", name); |
3235 |
++ } |
3236 |
++} |
3237 |
++ |
3238 |
+ /** |
3239 |
+ * create_root_hv_pci_bus() - Expose a new root PCI bus |
3240 |
+ * @hbus: Root PCI bus, as understood by this driver |
3241 |
+@@ -1480,6 +1512,7 @@ static int create_root_hv_pci_bus(struct hv_pcibus_device *hbus) |
3242 |
+ pci_lock_rescan_remove(); |
3243 |
+ pci_scan_child_bus(hbus->pci_bus); |
3244 |
+ pci_bus_assign_resources(hbus->pci_bus); |
3245 |
++ hv_pci_assign_slots(hbus); |
3246 |
+ pci_bus_add_devices(hbus->pci_bus); |
3247 |
+ pci_unlock_rescan_remove(); |
3248 |
+ hbus->state = hv_pcibus_installed; |
3249 |
+@@ -1742,6 +1775,7 @@ static void pci_devices_present_work(struct work_struct *work) |
3250 |
+ */ |
3251 |
+ pci_lock_rescan_remove(); |
3252 |
+ pci_scan_child_bus(hbus->pci_bus); |
3253 |
++ hv_pci_assign_slots(hbus); |
3254 |
+ pci_unlock_rescan_remove(); |
3255 |
+ break; |
3256 |
+ |
3257 |
+@@ -1858,6 +1892,9 @@ static void hv_eject_device_work(struct work_struct *work) |
3258 |
+ list_del(&hpdev->list_entry); |
3259 |
+ spin_unlock_irqrestore(&hpdev->hbus->device_list_lock, flags); |
3260 |
+ |
3261 |
++ if (hpdev->pci_slot) |
3262 |
++ pci_destroy_slot(hpdev->pci_slot); |
3263 |
++ |
3264 |
+ memset(&ctxt, 0, sizeof(ctxt)); |
3265 |
+ ejct_pkt = (struct pci_eject_response *)&ctxt.pkt.message; |
3266 |
+ ejct_pkt->message_type.type = PCI_EJECTION_COMPLETE; |
3267 |
+diff --git a/drivers/perf/arm_pmu.c b/drivers/perf/arm_pmu.c |
3268 |
+index a6347d487635..1321104b9b9f 100644 |
3269 |
+--- a/drivers/perf/arm_pmu.c |
3270 |
++++ b/drivers/perf/arm_pmu.c |
3271 |
+@@ -474,7 +474,13 @@ static int armpmu_filter_match(struct perf_event *event) |
3272 |
+ { |
3273 |
+ struct arm_pmu *armpmu = to_arm_pmu(event->pmu); |
3274 |
+ unsigned int cpu = smp_processor_id(); |
3275 |
+- return cpumask_test_cpu(cpu, &armpmu->supported_cpus); |
3276 |
++ int ret; |
3277 |
++ |
3278 |
++ ret = cpumask_test_cpu(cpu, &armpmu->supported_cpus); |
3279 |
++ if (ret && armpmu->filter_match) |
3280 |
++ return armpmu->filter_match(event); |
3281 |
++ |
3282 |
++ return ret; |
3283 |
+ } |
3284 |
+ |
3285 |
+ static ssize_t armpmu_cpumask_show(struct device *dev, |
3286 |
+diff --git a/drivers/pinctrl/intel/pinctrl-cannonlake.c b/drivers/pinctrl/intel/pinctrl-cannonlake.c |
3287 |
+index 6243e7d95e7e..d36afb17f5e4 100644 |
3288 |
+--- a/drivers/pinctrl/intel/pinctrl-cannonlake.c |
3289 |
++++ b/drivers/pinctrl/intel/pinctrl-cannonlake.c |
3290 |
+@@ -382,7 +382,7 @@ static const struct intel_padgroup cnlh_community1_gpps[] = { |
3291 |
+ static const struct intel_padgroup cnlh_community3_gpps[] = { |
3292 |
+ CNL_GPP(0, 155, 178, 192), /* GPP_K */ |
3293 |
+ CNL_GPP(1, 179, 202, 224), /* GPP_H */ |
3294 |
+- CNL_GPP(2, 203, 215, 258), /* GPP_E */ |
3295 |
++ CNL_GPP(2, 203, 215, 256), /* GPP_E */ |
3296 |
+ CNL_GPP(3, 216, 239, 288), /* GPP_F */ |
3297 |
+ CNL_GPP(4, 240, 248, CNL_NO_GPIO), /* SPI */ |
3298 |
+ }; |
3299 |
+diff --git a/drivers/pinctrl/pinctrl-mcp23s08.c b/drivers/pinctrl/pinctrl-mcp23s08.c |
3300 |
+index 022307dd4b54..bef6ff2e8f4f 100644 |
3301 |
+--- a/drivers/pinctrl/pinctrl-mcp23s08.c |
3302 |
++++ b/drivers/pinctrl/pinctrl-mcp23s08.c |
3303 |
+@@ -636,6 +636,14 @@ static int mcp23s08_irq_setup(struct mcp23s08 *mcp) |
3304 |
+ return err; |
3305 |
+ } |
3306 |
+ |
3307 |
++ return 0; |
3308 |
++} |
3309 |
++ |
3310 |
++static int mcp23s08_irqchip_setup(struct mcp23s08 *mcp) |
3311 |
++{ |
3312 |
++ struct gpio_chip *chip = &mcp->chip; |
3313 |
++ int err; |
3314 |
++ |
3315 |
+ err = gpiochip_irqchip_add_nested(chip, |
3316 |
+ &mcp23s08_irq_chip, |
3317 |
+ 0, |
3318 |
+@@ -912,7 +920,7 @@ static int mcp23s08_probe_one(struct mcp23s08 *mcp, struct device *dev, |
3319 |
+ } |
3320 |
+ |
3321 |
+ if (mcp->irq && mcp->irq_controller) { |
3322 |
+- ret = mcp23s08_irq_setup(mcp); |
3323 |
++ ret = mcp23s08_irqchip_setup(mcp); |
3324 |
+ if (ret) |
3325 |
+ goto fail; |
3326 |
+ } |
3327 |
+@@ -944,6 +952,9 @@ static int mcp23s08_probe_one(struct mcp23s08 *mcp, struct device *dev, |
3328 |
+ goto fail; |
3329 |
+ } |
3330 |
+ |
3331 |
++ if (mcp->irq) |
3332 |
++ ret = mcp23s08_irq_setup(mcp); |
3333 |
++ |
3334 |
+ fail: |
3335 |
+ if (ret < 0) |
3336 |
+ dev_dbg(dev, "can't setup chip %d, --> %d\n", addr, ret); |
3337 |
+diff --git a/drivers/s390/cio/vfio_ccw_cp.c b/drivers/s390/cio/vfio_ccw_cp.c |
3338 |
+index dbe7c7ac9ac8..fd77e46eb3b2 100644 |
3339 |
+--- a/drivers/s390/cio/vfio_ccw_cp.c |
3340 |
++++ b/drivers/s390/cio/vfio_ccw_cp.c |
3341 |
+@@ -163,7 +163,7 @@ static bool pfn_array_table_iova_pinned(struct pfn_array_table *pat, |
3342 |
+ |
3343 |
+ for (i = 0; i < pat->pat_nr; i++, pa++) |
3344 |
+ for (j = 0; j < pa->pa_nr; j++) |
3345 |
+- if (pa->pa_iova_pfn[i] == iova_pfn) |
3346 |
++ if (pa->pa_iova_pfn[j] == iova_pfn) |
3347 |
+ return true; |
3348 |
+ |
3349 |
+ return false; |
3350 |
+diff --git a/drivers/scsi/qla2xxx/qla_target.h b/drivers/scsi/qla2xxx/qla_target.h |
3351 |
+index fecf96f0225c..199d3ba1916d 100644 |
3352 |
+--- a/drivers/scsi/qla2xxx/qla_target.h |
3353 |
++++ b/drivers/scsi/qla2xxx/qla_target.h |
3354 |
+@@ -374,8 +374,8 @@ struct atio_from_isp { |
3355 |
+ static inline int fcpcmd_is_corrupted(struct atio *atio) |
3356 |
+ { |
3357 |
+ if (atio->entry_type == ATIO_TYPE7 && |
3358 |
+- (le16_to_cpu(atio->attr_n_length & FCP_CMD_LENGTH_MASK) < |
3359 |
+- FCP_CMD_LENGTH_MIN)) |
3360 |
++ ((le16_to_cpu(atio->attr_n_length) & FCP_CMD_LENGTH_MASK) < |
3361 |
++ FCP_CMD_LENGTH_MIN)) |
3362 |
+ return 1; |
3363 |
+ else |
3364 |
+ return 0; |
3365 |
+diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c |
3366 |
+index a4ecc9d77624..8e1c3cff567a 100644 |
3367 |
+--- a/drivers/target/iscsi/iscsi_target.c |
3368 |
++++ b/drivers/target/iscsi/iscsi_target.c |
3369 |
+@@ -1419,7 +1419,8 @@ static void iscsit_do_crypto_hash_buf(struct ahash_request *hash, |
3370 |
+ |
3371 |
+ sg_init_table(sg, ARRAY_SIZE(sg)); |
3372 |
+ sg_set_buf(sg, buf, payload_length); |
3373 |
+- sg_set_buf(sg + 1, pad_bytes, padding); |
3374 |
++ if (padding) |
3375 |
++ sg_set_buf(sg + 1, pad_bytes, padding); |
3376 |
+ |
3377 |
+ ahash_request_set_crypt(hash, sg, data_crc, payload_length + padding); |
3378 |
+ |
3379 |
+@@ -3913,10 +3914,14 @@ static bool iscsi_target_check_conn_state(struct iscsi_conn *conn) |
3380 |
+ static void iscsit_get_rx_pdu(struct iscsi_conn *conn) |
3381 |
+ { |
3382 |
+ int ret; |
3383 |
+- u8 buffer[ISCSI_HDR_LEN], opcode; |
3384 |
++ u8 *buffer, opcode; |
3385 |
+ u32 checksum = 0, digest = 0; |
3386 |
+ struct kvec iov; |
3387 |
+ |
3388 |
++ buffer = kcalloc(ISCSI_HDR_LEN, sizeof(*buffer), GFP_KERNEL); |
3389 |
++ if (!buffer) |
3390 |
++ return; |
3391 |
++ |
3392 |
+ while (!kthread_should_stop()) { |
3393 |
+ /* |
3394 |
+ * Ensure that both TX and RX per connection kthreads |
3395 |
+@@ -3924,7 +3929,6 @@ static void iscsit_get_rx_pdu(struct iscsi_conn *conn) |
3396 |
+ */ |
3397 |
+ iscsit_thread_check_cpumask(conn, current, 0); |
3398 |
+ |
3399 |
+- memset(buffer, 0, ISCSI_HDR_LEN); |
3400 |
+ memset(&iov, 0, sizeof(struct kvec)); |
3401 |
+ |
3402 |
+ iov.iov_base = buffer; |
3403 |
+@@ -3933,7 +3937,7 @@ static void iscsit_get_rx_pdu(struct iscsi_conn *conn) |
3404 |
+ ret = rx_data(conn, &iov, 1, ISCSI_HDR_LEN); |
3405 |
+ if (ret != ISCSI_HDR_LEN) { |
3406 |
+ iscsit_rx_thread_wait_for_tcp(conn); |
3407 |
+- return; |
3408 |
++ break; |
3409 |
+ } |
3410 |
+ |
3411 |
+ if (conn->conn_ops->HeaderDigest) { |
3412 |
+@@ -3943,7 +3947,7 @@ static void iscsit_get_rx_pdu(struct iscsi_conn *conn) |
3413 |
+ ret = rx_data(conn, &iov, 1, ISCSI_CRC_LEN); |
3414 |
+ if (ret != ISCSI_CRC_LEN) { |
3415 |
+ iscsit_rx_thread_wait_for_tcp(conn); |
3416 |
+- return; |
3417 |
++ break; |
3418 |
+ } |
3419 |
+ |
3420 |
+ iscsit_do_crypto_hash_buf(conn->conn_rx_hash, buffer, |
3421 |
+@@ -3967,7 +3971,7 @@ static void iscsit_get_rx_pdu(struct iscsi_conn *conn) |
3422 |
+ } |
3423 |
+ |
3424 |
+ if (conn->conn_state == TARG_CONN_STATE_IN_LOGOUT) |
3425 |
+- return; |
3426 |
++ break; |
3427 |
+ |
3428 |
+ opcode = buffer[0] & ISCSI_OPCODE_MASK; |
3429 |
+ |
3430 |
+@@ -3978,13 +3982,15 @@ static void iscsit_get_rx_pdu(struct iscsi_conn *conn) |
3431 |
+ " while in Discovery Session, rejecting.\n", opcode); |
3432 |
+ iscsit_add_reject(conn, ISCSI_REASON_PROTOCOL_ERROR, |
3433 |
+ buffer); |
3434 |
+- return; |
3435 |
++ break; |
3436 |
+ } |
3437 |
+ |
3438 |
+ ret = iscsi_target_rx_opcode(conn, buffer); |
3439 |
+ if (ret < 0) |
3440 |
+- return; |
3441 |
++ break; |
3442 |
+ } |
3443 |
++ |
3444 |
++ kfree(buffer); |
3445 |
+ } |
3446 |
+ |
3447 |
+ int iscsi_target_rx_thread(void *arg) |
3448 |
+diff --git a/drivers/video/fbdev/aty/atyfb.h b/drivers/video/fbdev/aty/atyfb.h |
3449 |
+index 8235b285dbb2..d09bab3bf224 100644 |
3450 |
+--- a/drivers/video/fbdev/aty/atyfb.h |
3451 |
++++ b/drivers/video/fbdev/aty/atyfb.h |
3452 |
+@@ -333,6 +333,8 @@ extern const struct aty_pll_ops aty_pll_ct; /* Integrated */ |
3453 |
+ extern void aty_set_pll_ct(const struct fb_info *info, const union aty_pll *pll); |
3454 |
+ extern u8 aty_ld_pll_ct(int offset, const struct atyfb_par *par); |
3455 |
+ |
3456 |
++extern const u8 aty_postdividers[8]; |
3457 |
++ |
3458 |
+ |
3459 |
+ /* |
3460 |
+ * Hardware cursor support |
3461 |
+@@ -359,7 +361,6 @@ static inline void wait_for_idle(struct atyfb_par *par) |
3462 |
+ |
3463 |
+ extern void aty_reset_engine(const struct atyfb_par *par); |
3464 |
+ extern void aty_init_engine(struct atyfb_par *par, struct fb_info *info); |
3465 |
+-extern u8 aty_ld_pll_ct(int offset, const struct atyfb_par *par); |
3466 |
+ |
3467 |
+ void atyfb_copyarea(struct fb_info *info, const struct fb_copyarea *area); |
3468 |
+ void atyfb_fillrect(struct fb_info *info, const struct fb_fillrect *rect); |
3469 |
+diff --git a/drivers/video/fbdev/aty/atyfb_base.c b/drivers/video/fbdev/aty/atyfb_base.c |
3470 |
+index a9a8272f7a6e..05111e90f168 100644 |
3471 |
+--- a/drivers/video/fbdev/aty/atyfb_base.c |
3472 |
++++ b/drivers/video/fbdev/aty/atyfb_base.c |
3473 |
+@@ -3087,17 +3087,18 @@ static int atyfb_setup_sparc(struct pci_dev *pdev, struct fb_info *info, |
3474 |
+ /* |
3475 |
+ * PLL Reference Divider M: |
3476 |
+ */ |
3477 |
+- M = pll_regs[2]; |
3478 |
++ M = pll_regs[PLL_REF_DIV]; |
3479 |
+ |
3480 |
+ /* |
3481 |
+ * PLL Feedback Divider N (Dependent on CLOCK_CNTL): |
3482 |
+ */ |
3483 |
+- N = pll_regs[7 + (clock_cntl & 3)]; |
3484 |
++ N = pll_regs[VCLK0_FB_DIV + (clock_cntl & 3)]; |
3485 |
+ |
3486 |
+ /* |
3487 |
+ * PLL Post Divider P (Dependent on CLOCK_CNTL): |
3488 |
+ */ |
3489 |
+- P = 1 << (pll_regs[6] >> ((clock_cntl & 3) << 1)); |
3490 |
++ P = aty_postdividers[((pll_regs[VCLK_POST_DIV] >> ((clock_cntl & 3) << 1)) & 3) | |
3491 |
++ ((pll_regs[PLL_EXT_CNTL] >> (2 + (clock_cntl & 3))) & 4)]; |
3492 |
+ |
3493 |
+ /* |
3494 |
+ * PLL Divider Q: |
3495 |
+diff --git a/drivers/video/fbdev/aty/mach64_ct.c b/drivers/video/fbdev/aty/mach64_ct.c |
3496 |
+index 74a62aa193c0..f87cc81f4fa2 100644 |
3497 |
+--- a/drivers/video/fbdev/aty/mach64_ct.c |
3498 |
++++ b/drivers/video/fbdev/aty/mach64_ct.c |
3499 |
+@@ -115,7 +115,7 @@ static void aty_st_pll_ct(int offset, u8 val, const struct atyfb_par *par) |
3500 |
+ */ |
3501 |
+ |
3502 |
+ #define Maximum_DSP_PRECISION 7 |
3503 |
+-static u8 postdividers[] = {1,2,4,8,3}; |
3504 |
++const u8 aty_postdividers[8] = {1,2,4,8,3,5,6,12}; |
3505 |
+ |
3506 |
+ static int aty_dsp_gt(const struct fb_info *info, u32 bpp, struct pll_ct *pll) |
3507 |
+ { |
3508 |
+@@ -222,7 +222,7 @@ static int aty_valid_pll_ct(const struct fb_info *info, u32 vclk_per, struct pll |
3509 |
+ pll->vclk_post_div += (q < 64*8); |
3510 |
+ pll->vclk_post_div += (q < 32*8); |
3511 |
+ } |
3512 |
+- pll->vclk_post_div_real = postdividers[pll->vclk_post_div]; |
3513 |
++ pll->vclk_post_div_real = aty_postdividers[pll->vclk_post_div]; |
3514 |
+ // pll->vclk_post_div <<= 6; |
3515 |
+ pll->vclk_fb_div = q * pll->vclk_post_div_real / 8; |
3516 |
+ pllvclk = (1000000 * 2 * pll->vclk_fb_div) / |
3517 |
+@@ -513,7 +513,7 @@ static int aty_init_pll_ct(const struct fb_info *info, union aty_pll *pll) |
3518 |
+ u8 mclk_fb_div, pll_ext_cntl; |
3519 |
+ pll->ct.pll_ref_div = aty_ld_pll_ct(PLL_REF_DIV, par); |
3520 |
+ pll_ext_cntl = aty_ld_pll_ct(PLL_EXT_CNTL, par); |
3521 |
+- pll->ct.xclk_post_div_real = postdividers[pll_ext_cntl & 0x07]; |
3522 |
++ pll->ct.xclk_post_div_real = aty_postdividers[pll_ext_cntl & 0x07]; |
3523 |
+ mclk_fb_div = aty_ld_pll_ct(MCLK_FB_DIV, par); |
3524 |
+ if (pll_ext_cntl & PLL_MFB_TIMES_4_2B) |
3525 |
+ mclk_fb_div <<= 1; |
3526 |
+@@ -535,7 +535,7 @@ static int aty_init_pll_ct(const struct fb_info *info, union aty_pll *pll) |
3527 |
+ xpost_div += (q < 64*8); |
3528 |
+ xpost_div += (q < 32*8); |
3529 |
+ } |
3530 |
+- pll->ct.xclk_post_div_real = postdividers[xpost_div]; |
3531 |
++ pll->ct.xclk_post_div_real = aty_postdividers[xpost_div]; |
3532 |
+ pll->ct.mclk_fb_div = q * pll->ct.xclk_post_div_real / 8; |
3533 |
+ |
3534 |
+ #ifdef CONFIG_PPC |
3535 |
+@@ -584,7 +584,7 @@ static int aty_init_pll_ct(const struct fb_info *info, union aty_pll *pll) |
3536 |
+ mpost_div += (q < 64*8); |
3537 |
+ mpost_div += (q < 32*8); |
3538 |
+ } |
3539 |
+- sclk_post_div_real = postdividers[mpost_div]; |
3540 |
++ sclk_post_div_real = aty_postdividers[mpost_div]; |
3541 |
+ pll->ct.sclk_fb_div = q * sclk_post_div_real / 8; |
3542 |
+ pll->ct.spll_cntl2 = mpost_div << 4; |
3543 |
+ #ifdef DEBUG |
3544 |
+diff --git a/fs/afs/rxrpc.c b/fs/afs/rxrpc.c |
3545 |
+index a1b18082991b..b6735ae3334e 100644 |
3546 |
+--- a/fs/afs/rxrpc.c |
3547 |
++++ b/fs/afs/rxrpc.c |
3548 |
+@@ -690,8 +690,6 @@ static void afs_process_async_call(struct work_struct *work) |
3549 |
+ } |
3550 |
+ |
3551 |
+ if (call->state == AFS_CALL_COMPLETE) { |
3552 |
+- call->reply[0] = NULL; |
3553 |
+- |
3554 |
+ /* We have two refs to release - one from the alloc and one |
3555 |
+ * queued with the work item - and we can't just deallocate the |
3556 |
+ * call because the work item may be queued again. |
3557 |
+diff --git a/fs/dax.c b/fs/dax.c |
3558 |
+index 94f9fe002b12..0d3f640653c0 100644 |
3559 |
+--- a/fs/dax.c |
3560 |
++++ b/fs/dax.c |
3561 |
+@@ -558,6 +558,8 @@ struct page *dax_layout_busy_page(struct address_space *mapping) |
3562 |
+ while (index < end && pagevec_lookup_entries(&pvec, mapping, index, |
3563 |
+ min(end - index, (pgoff_t)PAGEVEC_SIZE), |
3564 |
+ indices)) { |
3565 |
++ pgoff_t nr_pages = 1; |
3566 |
++ |
3567 |
+ for (i = 0; i < pagevec_count(&pvec); i++) { |
3568 |
+ struct page *pvec_ent = pvec.pages[i]; |
3569 |
+ void *entry; |
3570 |
+@@ -571,8 +573,15 @@ struct page *dax_layout_busy_page(struct address_space *mapping) |
3571 |
+ |
3572 |
+ xa_lock_irq(&mapping->i_pages); |
3573 |
+ entry = get_unlocked_mapping_entry(mapping, index, NULL); |
3574 |
+- if (entry) |
3575 |
++ if (entry) { |
3576 |
+ page = dax_busy_page(entry); |
3577 |
++ /* |
3578 |
++ * Account for multi-order entries at |
3579 |
++ * the end of the pagevec. |
3580 |
++ */ |
3581 |
++ if (i + 1 >= pagevec_count(&pvec)) |
3582 |
++ nr_pages = 1UL << dax_radix_order(entry); |
3583 |
++ } |
3584 |
+ put_unlocked_mapping_entry(mapping, index, entry); |
3585 |
+ xa_unlock_irq(&mapping->i_pages); |
3586 |
+ if (page) |
3587 |
+@@ -580,7 +589,7 @@ struct page *dax_layout_busy_page(struct address_space *mapping) |
3588 |
+ } |
3589 |
+ pagevec_remove_exceptionals(&pvec); |
3590 |
+ pagevec_release(&pvec); |
3591 |
+- index++; |
3592 |
++ index += nr_pages; |
3593 |
+ |
3594 |
+ if (page) |
3595 |
+ break; |
3596 |
+diff --git a/include/linux/cgroup-defs.h b/include/linux/cgroup-defs.h |
3597 |
+index c0e68f903011..04da6a7c9d2d 100644 |
3598 |
+--- a/include/linux/cgroup-defs.h |
3599 |
++++ b/include/linux/cgroup-defs.h |
3600 |
+@@ -412,6 +412,7 @@ struct cgroup { |
3601 |
+ * specific task are charged to the dom_cgrp. |
3602 |
+ */ |
3603 |
+ struct cgroup *dom_cgrp; |
3604 |
++ struct cgroup *old_dom_cgrp; /* used while enabling threaded */ |
3605 |
+ |
3606 |
+ /* per-cpu recursive resource statistics */ |
3607 |
+ struct cgroup_rstat_cpu __percpu *rstat_cpu; |
3608 |
+diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h |
3609 |
+index 3d0cc0b5cec2..3045a5cee0d8 100644 |
3610 |
+--- a/include/linux/netdevice.h |
3611 |
++++ b/include/linux/netdevice.h |
3612 |
+@@ -2420,6 +2420,13 @@ struct netdev_notifier_info { |
3613 |
+ struct netlink_ext_ack *extack; |
3614 |
+ }; |
3615 |
+ |
3616 |
++struct netdev_notifier_info_ext { |
3617 |
++ struct netdev_notifier_info info; /* must be first */ |
3618 |
++ union { |
3619 |
++ u32 mtu; |
3620 |
++ } ext; |
3621 |
++}; |
3622 |
++ |
3623 |
+ struct netdev_notifier_change_info { |
3624 |
+ struct netdev_notifier_info info; /* must be first */ |
3625 |
+ unsigned int flags_changed; |
3626 |
+diff --git a/include/linux/perf/arm_pmu.h b/include/linux/perf/arm_pmu.h |
3627 |
+index ad5444491975..a2f6e178a2d7 100644 |
3628 |
+--- a/include/linux/perf/arm_pmu.h |
3629 |
++++ b/include/linux/perf/arm_pmu.h |
3630 |
+@@ -93,6 +93,7 @@ struct arm_pmu { |
3631 |
+ void (*stop)(struct arm_pmu *); |
3632 |
+ void (*reset)(void *); |
3633 |
+ int (*map_event)(struct perf_event *event); |
3634 |
++ int (*filter_match)(struct perf_event *event); |
3635 |
+ int num_events; |
3636 |
+ u64 max_period; |
3637 |
+ bool secure_access; /* 32-bit ARM only */ |
3638 |
+diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h |
3639 |
+index 32feac5bbd75..f62e7721cd71 100644 |
3640 |
+--- a/include/linux/stmmac.h |
3641 |
++++ b/include/linux/stmmac.h |
3642 |
+@@ -30,6 +30,7 @@ |
3643 |
+ |
3644 |
+ #define MTL_MAX_RX_QUEUES 8 |
3645 |
+ #define MTL_MAX_TX_QUEUES 8 |
3646 |
++#define STMMAC_CH_MAX 8 |
3647 |
+ |
3648 |
+ #define STMMAC_RX_COE_NONE 0 |
3649 |
+ #define STMMAC_RX_COE_TYPE1 1 |
3650 |
+diff --git a/include/linux/virtio_net.h b/include/linux/virtio_net.h |
3651 |
+index 9397628a1967..cb462f9ab7dd 100644 |
3652 |
+--- a/include/linux/virtio_net.h |
3653 |
++++ b/include/linux/virtio_net.h |
3654 |
+@@ -5,6 +5,24 @@ |
3655 |
+ #include <linux/if_vlan.h> |
3656 |
+ #include <uapi/linux/virtio_net.h> |
3657 |
+ |
3658 |
++static inline int virtio_net_hdr_set_proto(struct sk_buff *skb, |
3659 |
++ const struct virtio_net_hdr *hdr) |
3660 |
++{ |
3661 |
++ switch (hdr->gso_type & ~VIRTIO_NET_HDR_GSO_ECN) { |
3662 |
++ case VIRTIO_NET_HDR_GSO_TCPV4: |
3663 |
++ case VIRTIO_NET_HDR_GSO_UDP: |
3664 |
++ skb->protocol = cpu_to_be16(ETH_P_IP); |
3665 |
++ break; |
3666 |
++ case VIRTIO_NET_HDR_GSO_TCPV6: |
3667 |
++ skb->protocol = cpu_to_be16(ETH_P_IPV6); |
3668 |
++ break; |
3669 |
++ default: |
3670 |
++ return -EINVAL; |
3671 |
++ } |
3672 |
++ |
3673 |
++ return 0; |
3674 |
++} |
3675 |
++ |
3676 |
+ static inline int virtio_net_hdr_to_skb(struct sk_buff *skb, |
3677 |
+ const struct virtio_net_hdr *hdr, |
3678 |
+ bool little_endian) |
3679 |
+diff --git a/include/net/bonding.h b/include/net/bonding.h |
3680 |
+index 808f1d167349..a4f116f06c50 100644 |
3681 |
+--- a/include/net/bonding.h |
3682 |
++++ b/include/net/bonding.h |
3683 |
+@@ -139,12 +139,6 @@ struct bond_parm_tbl { |
3684 |
+ int mode; |
3685 |
+ }; |
3686 |
+ |
3687 |
+-struct netdev_notify_work { |
3688 |
+- struct delayed_work work; |
3689 |
+- struct net_device *dev; |
3690 |
+- struct netdev_bonding_info bonding_info; |
3691 |
+-}; |
3692 |
+- |
3693 |
+ struct slave { |
3694 |
+ struct net_device *dev; /* first - useful for panic debug */ |
3695 |
+ struct bonding *bond; /* our master */ |
3696 |
+@@ -172,6 +166,7 @@ struct slave { |
3697 |
+ #ifdef CONFIG_NET_POLL_CONTROLLER |
3698 |
+ struct netpoll *np; |
3699 |
+ #endif |
3700 |
++ struct delayed_work notify_work; |
3701 |
+ struct kobject kobj; |
3702 |
+ struct rtnl_link_stats64 slave_stats; |
3703 |
+ }; |
3704 |
+diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h |
3705 |
+index 83d5b3c2ac42..7dba2d116e8c 100644 |
3706 |
+--- a/include/net/inet_sock.h |
3707 |
++++ b/include/net/inet_sock.h |
3708 |
+@@ -130,12 +130,6 @@ static inline int inet_request_bound_dev_if(const struct sock *sk, |
3709 |
+ return sk->sk_bound_dev_if; |
3710 |
+ } |
3711 |
+ |
3712 |
+-static inline struct ip_options_rcu *ireq_opt_deref(const struct inet_request_sock *ireq) |
3713 |
+-{ |
3714 |
+- return rcu_dereference_check(ireq->ireq_opt, |
3715 |
+- refcount_read(&ireq->req.rsk_refcnt) > 0); |
3716 |
+-} |
3717 |
+- |
3718 |
+ struct inet_cork { |
3719 |
+ unsigned int flags; |
3720 |
+ __be32 addr; |
3721 |
+diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h |
3722 |
+index 69c91d1934c1..c9b7b136939d 100644 |
3723 |
+--- a/include/net/ip_fib.h |
3724 |
++++ b/include/net/ip_fib.h |
3725 |
+@@ -394,6 +394,7 @@ int ip_fib_check_default(__be32 gw, struct net_device *dev); |
3726 |
+ int fib_sync_down_dev(struct net_device *dev, unsigned long event, bool force); |
3727 |
+ int fib_sync_down_addr(struct net_device *dev, __be32 local); |
3728 |
+ int fib_sync_up(struct net_device *dev, unsigned int nh_flags); |
3729 |
++void fib_sync_mtu(struct net_device *dev, u32 orig_mtu); |
3730 |
+ |
3731 |
+ #ifdef CONFIG_IP_ROUTE_MULTIPATH |
3732 |
+ int fib_multipath_hash(const struct net *net, const struct flowi4 *fl4, |
3733 |
+diff --git a/include/sound/hdaudio.h b/include/sound/hdaudio.h |
3734 |
+index c052afc27547..138e976a2ba2 100644 |
3735 |
+--- a/include/sound/hdaudio.h |
3736 |
++++ b/include/sound/hdaudio.h |
3737 |
+@@ -355,6 +355,7 @@ void snd_hdac_bus_init_cmd_io(struct hdac_bus *bus); |
3738 |
+ void snd_hdac_bus_stop_cmd_io(struct hdac_bus *bus); |
3739 |
+ void snd_hdac_bus_enter_link_reset(struct hdac_bus *bus); |
3740 |
+ void snd_hdac_bus_exit_link_reset(struct hdac_bus *bus); |
3741 |
++int snd_hdac_bus_reset_link(struct hdac_bus *bus, bool full_reset); |
3742 |
+ |
3743 |
+ void snd_hdac_bus_update_rirb(struct hdac_bus *bus); |
3744 |
+ int snd_hdac_bus_handle_stream_irq(struct hdac_bus *bus, unsigned int status, |
3745 |
+diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h |
3746 |
+index a6ce2de4e20a..be3bee1cf91f 100644 |
3747 |
+--- a/include/sound/soc-dapm.h |
3748 |
++++ b/include/sound/soc-dapm.h |
3749 |
+@@ -410,6 +410,7 @@ int snd_soc_dapm_new_dai_widgets(struct snd_soc_dapm_context *dapm, |
3750 |
+ int snd_soc_dapm_link_dai_widgets(struct snd_soc_card *card); |
3751 |
+ void snd_soc_dapm_connect_dai_link_widgets(struct snd_soc_card *card); |
3752 |
+ int snd_soc_dapm_new_pcm(struct snd_soc_card *card, |
3753 |
++ struct snd_soc_pcm_runtime *rtd, |
3754 |
+ const struct snd_soc_pcm_stream *params, |
3755 |
+ unsigned int num_params, |
3756 |
+ struct snd_soc_dapm_widget *source, |
3757 |
+diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c |
3758 |
+index 2590700237c1..138f0302692e 100644 |
3759 |
+--- a/kernel/bpf/btf.c |
3760 |
++++ b/kernel/bpf/btf.c |
3761 |
+@@ -1844,7 +1844,7 @@ static int btf_check_all_metas(struct btf_verifier_env *env) |
3762 |
+ |
3763 |
+ hdr = &btf->hdr; |
3764 |
+ cur = btf->nohdr_data + hdr->type_off; |
3765 |
+- end = btf->nohdr_data + hdr->type_len; |
3766 |
++ end = cur + hdr->type_len; |
3767 |
+ |
3768 |
+ env->log_type_id = 1; |
3769 |
+ while (cur < end) { |
3770 |
+diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c |
3771 |
+index 077370bf8964..6e052c899cab 100644 |
3772 |
+--- a/kernel/cgroup/cgroup.c |
3773 |
++++ b/kernel/cgroup/cgroup.c |
3774 |
+@@ -2833,11 +2833,12 @@ restart: |
3775 |
+ } |
3776 |
+ |
3777 |
+ /** |
3778 |
+- * cgroup_save_control - save control masks of a subtree |
3779 |
++ * cgroup_save_control - save control masks and dom_cgrp of a subtree |
3780 |
+ * @cgrp: root of the target subtree |
3781 |
+ * |
3782 |
+- * Save ->subtree_control and ->subtree_ss_mask to the respective old_ |
3783 |
+- * prefixed fields for @cgrp's subtree including @cgrp itself. |
3784 |
++ * Save ->subtree_control, ->subtree_ss_mask and ->dom_cgrp to the |
3785 |
++ * respective old_ prefixed fields for @cgrp's subtree including @cgrp |
3786 |
++ * itself. |
3787 |
+ */ |
3788 |
+ static void cgroup_save_control(struct cgroup *cgrp) |
3789 |
+ { |
3790 |
+@@ -2847,6 +2848,7 @@ static void cgroup_save_control(struct cgroup *cgrp) |
3791 |
+ cgroup_for_each_live_descendant_pre(dsct, d_css, cgrp) { |
3792 |
+ dsct->old_subtree_control = dsct->subtree_control; |
3793 |
+ dsct->old_subtree_ss_mask = dsct->subtree_ss_mask; |
3794 |
++ dsct->old_dom_cgrp = dsct->dom_cgrp; |
3795 |
+ } |
3796 |
+ } |
3797 |
+ |
3798 |
+@@ -2872,11 +2874,12 @@ static void cgroup_propagate_control(struct cgroup *cgrp) |
3799 |
+ } |
3800 |
+ |
3801 |
+ /** |
3802 |
+- * cgroup_restore_control - restore control masks of a subtree |
3803 |
++ * cgroup_restore_control - restore control masks and dom_cgrp of a subtree |
3804 |
+ * @cgrp: root of the target subtree |
3805 |
+ * |
3806 |
+- * Restore ->subtree_control and ->subtree_ss_mask from the respective old_ |
3807 |
+- * prefixed fields for @cgrp's subtree including @cgrp itself. |
3808 |
++ * Restore ->subtree_control, ->subtree_ss_mask and ->dom_cgrp from the |
3809 |
++ * respective old_ prefixed fields for @cgrp's subtree including @cgrp |
3810 |
++ * itself. |
3811 |
+ */ |
3812 |
+ static void cgroup_restore_control(struct cgroup *cgrp) |
3813 |
+ { |
3814 |
+@@ -2886,6 +2889,7 @@ static void cgroup_restore_control(struct cgroup *cgrp) |
3815 |
+ cgroup_for_each_live_descendant_post(dsct, d_css, cgrp) { |
3816 |
+ dsct->subtree_control = dsct->old_subtree_control; |
3817 |
+ dsct->subtree_ss_mask = dsct->old_subtree_ss_mask; |
3818 |
++ dsct->dom_cgrp = dsct->old_dom_cgrp; |
3819 |
+ } |
3820 |
+ } |
3821 |
+ |
3822 |
+@@ -3193,6 +3197,8 @@ static int cgroup_enable_threaded(struct cgroup *cgrp) |
3823 |
+ { |
3824 |
+ struct cgroup *parent = cgroup_parent(cgrp); |
3825 |
+ struct cgroup *dom_cgrp = parent->dom_cgrp; |
3826 |
++ struct cgroup *dsct; |
3827 |
++ struct cgroup_subsys_state *d_css; |
3828 |
+ int ret; |
3829 |
+ |
3830 |
+ lockdep_assert_held(&cgroup_mutex); |
3831 |
+@@ -3222,12 +3228,13 @@ static int cgroup_enable_threaded(struct cgroup *cgrp) |
3832 |
+ */ |
3833 |
+ cgroup_save_control(cgrp); |
3834 |
+ |
3835 |
+- cgrp->dom_cgrp = dom_cgrp; |
3836 |
++ cgroup_for_each_live_descendant_pre(dsct, d_css, cgrp) |
3837 |
++ if (dsct == cgrp || cgroup_is_threaded(dsct)) |
3838 |
++ dsct->dom_cgrp = dom_cgrp; |
3839 |
++ |
3840 |
+ ret = cgroup_apply_control(cgrp); |
3841 |
+ if (!ret) |
3842 |
+ parent->nr_threaded_children++; |
3843 |
+- else |
3844 |
+- cgrp->dom_cgrp = cgrp; |
3845 |
+ |
3846 |
+ cgroup_finalize_control(cgrp, ret); |
3847 |
+ return ret; |
3848 |
+diff --git a/lib/vsprintf.c b/lib/vsprintf.c |
3849 |
+index cda186230287..8e58928e8227 100644 |
3850 |
+--- a/lib/vsprintf.c |
3851 |
++++ b/lib/vsprintf.c |
3852 |
+@@ -2769,7 +2769,7 @@ int bstr_printf(char *buf, size_t size, const char *fmt, const u32 *bin_buf) |
3853 |
+ copy = end - str; |
3854 |
+ memcpy(str, args, copy); |
3855 |
+ str += len; |
3856 |
+- args += len; |
3857 |
++ args += len + 1; |
3858 |
+ } |
3859 |
+ } |
3860 |
+ if (process) |
3861 |
+diff --git a/mm/huge_memory.c b/mm/huge_memory.c |
3862 |
+index 571875b37453..f7274e0c8bdc 100644 |
3863 |
+--- a/mm/huge_memory.c |
3864 |
++++ b/mm/huge_memory.c |
3865 |
+@@ -2883,9 +2883,6 @@ void set_pmd_migration_entry(struct page_vma_mapped_walk *pvmw, |
3866 |
+ if (!(pvmw->pmd && !pvmw->pte)) |
3867 |
+ return; |
3868 |
+ |
3869 |
+- mmu_notifier_invalidate_range_start(mm, address, |
3870 |
+- address + HPAGE_PMD_SIZE); |
3871 |
+- |
3872 |
+ flush_cache_range(vma, address, address + HPAGE_PMD_SIZE); |
3873 |
+ pmdval = *pvmw->pmd; |
3874 |
+ pmdp_invalidate(vma, address, pvmw->pmd); |
3875 |
+@@ -2898,9 +2895,6 @@ void set_pmd_migration_entry(struct page_vma_mapped_walk *pvmw, |
3876 |
+ set_pmd_at(mm, address, pvmw->pmd, pmdswp); |
3877 |
+ page_remove_rmap(page, true); |
3878 |
+ put_page(page); |
3879 |
+- |
3880 |
+- mmu_notifier_invalidate_range_end(mm, address, |
3881 |
+- address + HPAGE_PMD_SIZE); |
3882 |
+ } |
3883 |
+ |
3884 |
+ void remove_migration_pmd(struct page_vma_mapped_walk *pvmw, struct page *new) |
3885 |
+diff --git a/mm/mmap.c b/mm/mmap.c |
3886 |
+index 17bbf4d3e24f..080c6b9b1d65 100644 |
3887 |
+--- a/mm/mmap.c |
3888 |
++++ b/mm/mmap.c |
3889 |
+@@ -1410,7 +1410,7 @@ unsigned long do_mmap(struct file *file, unsigned long addr, |
3890 |
+ if (flags & MAP_FIXED_NOREPLACE) { |
3891 |
+ struct vm_area_struct *vma = find_vma(mm, addr); |
3892 |
+ |
3893 |
+- if (vma && vma->vm_start <= addr) |
3894 |
++ if (vma && vma->vm_start < addr + len) |
3895 |
+ return -EEXIST; |
3896 |
+ } |
3897 |
+ |
3898 |
+diff --git a/mm/percpu.c b/mm/percpu.c |
3899 |
+index 0b6480979ac7..074732f3c209 100644 |
3900 |
+--- a/mm/percpu.c |
3901 |
++++ b/mm/percpu.c |
3902 |
+@@ -1204,6 +1204,7 @@ static void pcpu_free_chunk(struct pcpu_chunk *chunk) |
3903 |
+ { |
3904 |
+ if (!chunk) |
3905 |
+ return; |
3906 |
++ pcpu_mem_free(chunk->md_blocks); |
3907 |
+ pcpu_mem_free(chunk->bound_map); |
3908 |
+ pcpu_mem_free(chunk->alloc_map); |
3909 |
+ pcpu_mem_free(chunk); |
3910 |
+diff --git a/mm/vmscan.c b/mm/vmscan.c |
3911 |
+index 03822f86f288..fc0436407471 100644 |
3912 |
+--- a/mm/vmscan.c |
3913 |
++++ b/mm/vmscan.c |
3914 |
+@@ -386,6 +386,17 @@ static unsigned long do_shrink_slab(struct shrink_control *shrinkctl, |
3915 |
+ delta = freeable >> priority; |
3916 |
+ delta *= 4; |
3917 |
+ do_div(delta, shrinker->seeks); |
3918 |
++ |
3919 |
++ /* |
3920 |
++ * Make sure we apply some minimal pressure on default priority |
3921 |
++ * even on small cgroups. Stale objects are not only consuming memory |
3922 |
++ * by themselves, but can also hold a reference to a dying cgroup, |
3923 |
++ * preventing it from being reclaimed. A dying cgroup with all |
3924 |
++ * corresponding structures like per-cpu stats and kmem caches |
3925 |
++ * can be really big, so it may lead to a significant waste of memory. |
3926 |
++ */ |
3927 |
++ delta = max_t(unsigned long long, delta, min(freeable, batch_size)); |
3928 |
++ |
3929 |
+ total_scan += delta; |
3930 |
+ if (total_scan < 0) { |
3931 |
+ pr_err("shrink_slab: %pF negative objects to delete nr=%ld\n", |
3932 |
+diff --git a/mm/vmstat.c b/mm/vmstat.c |
3933 |
+index 55a5bb1d773d..7878da76abf2 100644 |
3934 |
+--- a/mm/vmstat.c |
3935 |
++++ b/mm/vmstat.c |
3936 |
+@@ -1286,7 +1286,6 @@ const char * const vmstat_text[] = { |
3937 |
+ #ifdef CONFIG_DEBUG_VM_VMACACHE |
3938 |
+ "vmacache_find_calls", |
3939 |
+ "vmacache_find_hits", |
3940 |
+- "vmacache_full_flushes", |
3941 |
+ #endif |
3942 |
+ #ifdef CONFIG_SWAP |
3943 |
+ "swap_ra", |
3944 |
+diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c |
3945 |
+index ae91e2d40056..3a7b0773536b 100644 |
3946 |
+--- a/net/bluetooth/smp.c |
3947 |
++++ b/net/bluetooth/smp.c |
3948 |
+@@ -83,6 +83,7 @@ enum { |
3949 |
+ |
3950 |
+ struct smp_dev { |
3951 |
+ /* Secure Connections OOB data */ |
3952 |
++ bool local_oob; |
3953 |
+ u8 local_pk[64]; |
3954 |
+ u8 local_rand[16]; |
3955 |
+ bool debug_key; |
3956 |
+@@ -599,6 +600,8 @@ int smp_generate_oob(struct hci_dev *hdev, u8 hash[16], u8 rand[16]) |
3957 |
+ |
3958 |
+ memcpy(rand, smp->local_rand, 16); |
3959 |
+ |
3960 |
++ smp->local_oob = true; |
3961 |
++ |
3962 |
+ return 0; |
3963 |
+ } |
3964 |
+ |
3965 |
+@@ -1785,7 +1788,7 @@ static u8 smp_cmd_pairing_req(struct l2cap_conn *conn, struct sk_buff *skb) |
3966 |
+ * successfully received our local OOB data - therefore set the |
3967 |
+ * flag to indicate that local OOB is in use. |
3968 |
+ */ |
3969 |
+- if (req->oob_flag == SMP_OOB_PRESENT) |
3970 |
++ if (req->oob_flag == SMP_OOB_PRESENT && SMP_DEV(hdev)->local_oob) |
3971 |
+ set_bit(SMP_FLAG_LOCAL_OOB, &smp->flags); |
3972 |
+ |
3973 |
+ /* SMP over BR/EDR requires special treatment */ |
3974 |
+@@ -1967,7 +1970,7 @@ static u8 smp_cmd_pairing_rsp(struct l2cap_conn *conn, struct sk_buff *skb) |
3975 |
+ * successfully received our local OOB data - therefore set the |
3976 |
+ * flag to indicate that local OOB is in use. |
3977 |
+ */ |
3978 |
+- if (rsp->oob_flag == SMP_OOB_PRESENT) |
3979 |
++ if (rsp->oob_flag == SMP_OOB_PRESENT && SMP_DEV(hdev)->local_oob) |
3980 |
+ set_bit(SMP_FLAG_LOCAL_OOB, &smp->flags); |
3981 |
+ |
3982 |
+ smp->prsp[0] = SMP_CMD_PAIRING_RSP; |
3983 |
+@@ -2697,7 +2700,13 @@ static int smp_cmd_public_key(struct l2cap_conn *conn, struct sk_buff *skb) |
3984 |
+ * key was set/generated. |
3985 |
+ */ |
3986 |
+ if (test_bit(SMP_FLAG_LOCAL_OOB, &smp->flags)) { |
3987 |
+- struct smp_dev *smp_dev = chan->data; |
3988 |
++ struct l2cap_chan *hchan = hdev->smp_data; |
3989 |
++ struct smp_dev *smp_dev; |
3990 |
++ |
3991 |
++ if (!hchan || !hchan->data) |
3992 |
++ return SMP_UNSPECIFIED; |
3993 |
++ |
3994 |
++ smp_dev = hchan->data; |
3995 |
+ |
3996 |
+ tfm_ecdh = smp_dev->tfm_ecdh; |
3997 |
+ } else { |
3998 |
+@@ -3230,6 +3239,7 @@ static struct l2cap_chan *smp_add_cid(struct hci_dev *hdev, u16 cid) |
3999 |
+ return ERR_CAST(tfm_ecdh); |
4000 |
+ } |
4001 |
+ |
4002 |
++ smp->local_oob = false; |
4003 |
+ smp->tfm_aes = tfm_aes; |
4004 |
+ smp->tfm_cmac = tfm_cmac; |
4005 |
+ smp->tfm_ecdh = tfm_ecdh; |
4006 |
+diff --git a/net/core/dev.c b/net/core/dev.c |
4007 |
+index 559a91271f82..bf669e77f9f3 100644 |
4008 |
+--- a/net/core/dev.c |
4009 |
++++ b/net/core/dev.c |
4010 |
+@@ -1754,6 +1754,28 @@ int call_netdevice_notifiers(unsigned long val, struct net_device *dev) |
4011 |
+ } |
4012 |
+ EXPORT_SYMBOL(call_netdevice_notifiers); |
4013 |
+ |
4014 |
++/** |
4015 |
++ * call_netdevice_notifiers_mtu - call all network notifier blocks |
4016 |
++ * @val: value passed unmodified to notifier function |
4017 |
++ * @dev: net_device pointer passed unmodified to notifier function |
4018 |
++ * @arg: additional u32 argument passed to the notifier function |
4019 |
++ * |
4020 |
++ * Call all network notifier blocks. Parameters and return value |
4021 |
++ * are as for raw_notifier_call_chain(). |
4022 |
++ */ |
4023 |
++static int call_netdevice_notifiers_mtu(unsigned long val, |
4024 |
++ struct net_device *dev, u32 arg) |
4025 |
++{ |
4026 |
++ struct netdev_notifier_info_ext info = { |
4027 |
++ .info.dev = dev, |
4028 |
++ .ext.mtu = arg, |
4029 |
++ }; |
4030 |
++ |
4031 |
++ BUILD_BUG_ON(offsetof(struct netdev_notifier_info_ext, info) != 0); |
4032 |
++ |
4033 |
++ return call_netdevice_notifiers_info(val, &info.info); |
4034 |
++} |
4035 |
++ |
4036 |
+ #ifdef CONFIG_NET_INGRESS |
4037 |
+ static DEFINE_STATIC_KEY_FALSE(ingress_needed_key); |
4038 |
+ |
4039 |
+@@ -7118,14 +7140,16 @@ int dev_set_mtu(struct net_device *dev, int new_mtu) |
4040 |
+ err = __dev_set_mtu(dev, new_mtu); |
4041 |
+ |
4042 |
+ if (!err) { |
4043 |
+- err = call_netdevice_notifiers(NETDEV_CHANGEMTU, dev); |
4044 |
++ err = call_netdevice_notifiers_mtu(NETDEV_CHANGEMTU, dev, |
4045 |
++ orig_mtu); |
4046 |
+ err = notifier_to_errno(err); |
4047 |
+ if (err) { |
4048 |
+ /* setting mtu back and notifying everyone again, |
4049 |
+ * so that they have a chance to revert changes. |
4050 |
+ */ |
4051 |
+ __dev_set_mtu(dev, orig_mtu); |
4052 |
+- call_netdevice_notifiers(NETDEV_CHANGEMTU, dev); |
4053 |
++ call_netdevice_notifiers_mtu(NETDEV_CHANGEMTU, dev, |
4054 |
++ new_mtu); |
4055 |
+ } |
4056 |
+ } |
4057 |
+ return err; |
4058 |
+diff --git a/net/core/ethtool.c b/net/core/ethtool.c |
4059 |
+index e677a20180cf..6c04f1bf377d 100644 |
4060 |
+--- a/net/core/ethtool.c |
4061 |
++++ b/net/core/ethtool.c |
4062 |
+@@ -2623,6 +2623,7 @@ int dev_ethtool(struct net *net, struct ifreq *ifr) |
4063 |
+ case ETHTOOL_GPHYSTATS: |
4064 |
+ case ETHTOOL_GTSO: |
4065 |
+ case ETHTOOL_GPERMADDR: |
4066 |
++ case ETHTOOL_GUFO: |
4067 |
+ case ETHTOOL_GGSO: |
4068 |
+ case ETHTOOL_GGRO: |
4069 |
+ case ETHTOOL_GFLAGS: |
4070 |
+diff --git a/net/core/filter.c b/net/core/filter.c |
4071 |
+index 963ee2e88861..0b2bd7d3220f 100644 |
4072 |
+--- a/net/core/filter.c |
4073 |
++++ b/net/core/filter.c |
4074 |
+@@ -2334,7 +2334,8 @@ BPF_CALL_4(bpf_msg_pull_data, |
4075 |
+ if (unlikely(bytes_sg_total > copy)) |
4076 |
+ return -EINVAL; |
4077 |
+ |
4078 |
+- page = alloc_pages(__GFP_NOWARN | GFP_ATOMIC, get_order(copy)); |
4079 |
++ page = alloc_pages(__GFP_NOWARN | GFP_ATOMIC | __GFP_COMP, |
4080 |
++ get_order(copy)); |
4081 |
+ if (unlikely(!page)) |
4082 |
+ return -ENOMEM; |
4083 |
+ p = page_address(page); |
4084 |
+diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c |
4085 |
+index bafaa033826f..18de39dbdc30 100644 |
4086 |
+--- a/net/core/rtnetlink.c |
4087 |
++++ b/net/core/rtnetlink.c |
4088 |
+@@ -1848,10 +1848,8 @@ static int rtnl_dump_ifinfo(struct sk_buff *skb, struct netlink_callback *cb) |
4089 |
+ if (tb[IFLA_IF_NETNSID]) { |
4090 |
+ netnsid = nla_get_s32(tb[IFLA_IF_NETNSID]); |
4091 |
+ tgt_net = get_target_net(skb->sk, netnsid); |
4092 |
+- if (IS_ERR(tgt_net)) { |
4093 |
+- tgt_net = net; |
4094 |
+- netnsid = -1; |
4095 |
+- } |
4096 |
++ if (IS_ERR(tgt_net)) |
4097 |
++ return PTR_ERR(tgt_net); |
4098 |
+ } |
4099 |
+ |
4100 |
+ if (tb[IFLA_EXT_MASK]) |
4101 |
+@@ -2787,6 +2785,12 @@ struct net_device *rtnl_create_link(struct net *net, |
4102 |
+ else if (ops->get_num_rx_queues) |
4103 |
+ num_rx_queues = ops->get_num_rx_queues(); |
4104 |
+ |
4105 |
++ if (num_tx_queues < 1 || num_tx_queues > 4096) |
4106 |
++ return ERR_PTR(-EINVAL); |
4107 |
++ |
4108 |
++ if (num_rx_queues < 1 || num_rx_queues > 4096) |
4109 |
++ return ERR_PTR(-EINVAL); |
4110 |
++ |
4111 |
+ dev = alloc_netdev_mqs(ops->priv_size, ifname, name_assign_type, |
4112 |
+ ops->setup, num_tx_queues, num_rx_queues); |
4113 |
+ if (!dev) |
4114 |
+@@ -3694,16 +3698,27 @@ static int rtnl_fdb_dump(struct sk_buff *skb, struct netlink_callback *cb) |
4115 |
+ int err = 0; |
4116 |
+ int fidx = 0; |
4117 |
+ |
4118 |
+- err = nlmsg_parse(cb->nlh, sizeof(struct ifinfomsg), tb, |
4119 |
+- IFLA_MAX, ifla_policy, NULL); |
4120 |
+- if (err < 0) { |
4121 |
+- return -EINVAL; |
4122 |
+- } else if (err == 0) { |
4123 |
+- if (tb[IFLA_MASTER]) |
4124 |
+- br_idx = nla_get_u32(tb[IFLA_MASTER]); |
4125 |
+- } |
4126 |
++ /* A hack to preserve kernel<->userspace interface. |
4127 |
++ * Before Linux v4.12 this code accepted ndmsg since iproute2 v3.3.0. |
4128 |
++ * However, ndmsg is shorter than ifinfomsg thus nlmsg_parse() bails. |
4129 |
++ * So, check for ndmsg with an optional u32 attribute (not used here). |
4130 |
++ * Fortunately these sizes don't conflict with the size of ifinfomsg |
4131 |
++ * with an optional attribute. |
4132 |
++ */ |
4133 |
++ if (nlmsg_len(cb->nlh) != sizeof(struct ndmsg) && |
4134 |
++ (nlmsg_len(cb->nlh) != sizeof(struct ndmsg) + |
4135 |
++ nla_attr_size(sizeof(u32)))) { |
4136 |
++ err = nlmsg_parse(cb->nlh, sizeof(struct ifinfomsg), tb, |
4137 |
++ IFLA_MAX, ifla_policy, NULL); |
4138 |
++ if (err < 0) { |
4139 |
++ return -EINVAL; |
4140 |
++ } else if (err == 0) { |
4141 |
++ if (tb[IFLA_MASTER]) |
4142 |
++ br_idx = nla_get_u32(tb[IFLA_MASTER]); |
4143 |
++ } |
4144 |
+ |
4145 |
+- brport_idx = ifm->ifi_index; |
4146 |
++ brport_idx = ifm->ifi_index; |
4147 |
++ } |
4148 |
+ |
4149 |
+ if (br_idx) { |
4150 |
+ br_dev = __dev_get_by_index(net, br_idx); |
4151 |
+diff --git a/net/dccp/input.c b/net/dccp/input.c |
4152 |
+index d28d46bff6ab..85d6c879383d 100644 |
4153 |
+--- a/net/dccp/input.c |
4154 |
++++ b/net/dccp/input.c |
4155 |
+@@ -606,11 +606,13 @@ int dccp_rcv_state_process(struct sock *sk, struct sk_buff *skb, |
4156 |
+ if (sk->sk_state == DCCP_LISTEN) { |
4157 |
+ if (dh->dccph_type == DCCP_PKT_REQUEST) { |
4158 |
+ /* It is possible that we process SYN packets from backlog, |
4159 |
+- * so we need to make sure to disable BH right there. |
4160 |
++ * so we need to make sure to disable BH and RCU right there. |
4161 |
+ */ |
4162 |
++ rcu_read_lock(); |
4163 |
+ local_bh_disable(); |
4164 |
+ acceptable = inet_csk(sk)->icsk_af_ops->conn_request(sk, skb) >= 0; |
4165 |
+ local_bh_enable(); |
4166 |
++ rcu_read_unlock(); |
4167 |
+ if (!acceptable) |
4168 |
+ return 1; |
4169 |
+ consume_skb(skb); |
4170 |
+diff --git a/net/dccp/ipv4.c b/net/dccp/ipv4.c |
4171 |
+index b08feb219b44..8e08cea6f178 100644 |
4172 |
+--- a/net/dccp/ipv4.c |
4173 |
++++ b/net/dccp/ipv4.c |
4174 |
+@@ -493,9 +493,11 @@ static int dccp_v4_send_response(const struct sock *sk, struct request_sock *req |
4175 |
+ |
4176 |
+ dh->dccph_checksum = dccp_v4_csum_finish(skb, ireq->ir_loc_addr, |
4177 |
+ ireq->ir_rmt_addr); |
4178 |
++ rcu_read_lock(); |
4179 |
+ err = ip_build_and_send_pkt(skb, sk, ireq->ir_loc_addr, |
4180 |
+ ireq->ir_rmt_addr, |
4181 |
+- ireq_opt_deref(ireq)); |
4182 |
++ rcu_dereference(ireq->ireq_opt)); |
4183 |
++ rcu_read_unlock(); |
4184 |
+ err = net_xmit_eval(err); |
4185 |
+ } |
4186 |
+ |
4187 |
+diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c |
4188 |
+index 2998b0e47d4b..0113993e9b2c 100644 |
4189 |
+--- a/net/ipv4/fib_frontend.c |
4190 |
++++ b/net/ipv4/fib_frontend.c |
4191 |
+@@ -1243,7 +1243,8 @@ static int fib_inetaddr_event(struct notifier_block *this, unsigned long event, |
4192 |
+ static int fib_netdev_event(struct notifier_block *this, unsigned long event, void *ptr) |
4193 |
+ { |
4194 |
+ struct net_device *dev = netdev_notifier_info_to_dev(ptr); |
4195 |
+- struct netdev_notifier_changeupper_info *info; |
4196 |
++ struct netdev_notifier_changeupper_info *upper_info = ptr; |
4197 |
++ struct netdev_notifier_info_ext *info_ext = ptr; |
4198 |
+ struct in_device *in_dev; |
4199 |
+ struct net *net = dev_net(dev); |
4200 |
+ unsigned int flags; |
4201 |
+@@ -1278,16 +1279,19 @@ static int fib_netdev_event(struct notifier_block *this, unsigned long event, vo |
4202 |
+ fib_sync_up(dev, RTNH_F_LINKDOWN); |
4203 |
+ else |
4204 |
+ fib_sync_down_dev(dev, event, false); |
4205 |
+- /* fall through */ |
4206 |
++ rt_cache_flush(net); |
4207 |
++ break; |
4208 |
+ case NETDEV_CHANGEMTU: |
4209 |
++ fib_sync_mtu(dev, info_ext->ext.mtu); |
4210 |
+ rt_cache_flush(net); |
4211 |
+ break; |
4212 |
+ case NETDEV_CHANGEUPPER: |
4213 |
+- info = ptr; |
4214 |
++ upper_info = ptr; |
4215 |
+ /* flush all routes if dev is linked to or unlinked from |
4216 |
+ * an L3 master device (e.g., VRF) |
4217 |
+ */ |
4218 |
+- if (info->upper_dev && netif_is_l3_master(info->upper_dev)) |
4219 |
++ if (upper_info->upper_dev && |
4220 |
++ netif_is_l3_master(upper_info->upper_dev)) |
4221 |
+ fib_disable_ip(dev, NETDEV_DOWN, true); |
4222 |
+ break; |
4223 |
+ } |
4224 |
+diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c |
4225 |
+index f3c89ccf14c5..446204ca7406 100644 |
4226 |
+--- a/net/ipv4/fib_semantics.c |
4227 |
++++ b/net/ipv4/fib_semantics.c |
4228 |
+@@ -1470,6 +1470,56 @@ static int call_fib_nh_notifiers(struct fib_nh *fib_nh, |
4229 |
+ return NOTIFY_DONE; |
4230 |
+ } |
4231 |
+ |
4232 |
++/* Update the PMTU of exceptions when: |
4233 |
++ * - the new MTU of the first hop becomes smaller than the PMTU |
4234 |
++ * - the old MTU was the same as the PMTU, and it limited discovery of |
4235 |
++ * larger MTUs on the path. With that limit raised, we can now |
4236 |
++ * discover larger MTUs |
4237 |
++ * A special case is locked exceptions, for which the PMTU is smaller |
4238 |
++ * than the minimal accepted PMTU: |
4239 |
++ * - if the new MTU is greater than the PMTU, don't make any change |
4240 |
++ * - otherwise, unlock and set PMTU |
4241 |
++ */ |
4242 |
++static void nh_update_mtu(struct fib_nh *nh, u32 new, u32 orig) |
4243 |
++{ |
4244 |
++ struct fnhe_hash_bucket *bucket; |
4245 |
++ int i; |
4246 |
++ |
4247 |
++ bucket = rcu_dereference_protected(nh->nh_exceptions, 1); |
4248 |
++ if (!bucket) |
4249 |
++ return; |
4250 |
++ |
4251 |
++ for (i = 0; i < FNHE_HASH_SIZE; i++) { |
4252 |
++ struct fib_nh_exception *fnhe; |
4253 |
++ |
4254 |
++ for (fnhe = rcu_dereference_protected(bucket[i].chain, 1); |
4255 |
++ fnhe; |
4256 |
++ fnhe = rcu_dereference_protected(fnhe->fnhe_next, 1)) { |
4257 |
++ if (fnhe->fnhe_mtu_locked) { |
4258 |
++ if (new <= fnhe->fnhe_pmtu) { |
4259 |
++ fnhe->fnhe_pmtu = new; |
4260 |
++ fnhe->fnhe_mtu_locked = false; |
4261 |
++ } |
4262 |
++ } else if (new < fnhe->fnhe_pmtu || |
4263 |
++ orig == fnhe->fnhe_pmtu) { |
4264 |
++ fnhe->fnhe_pmtu = new; |
4265 |
++ } |
4266 |
++ } |
4267 |
++ } |
4268 |
++} |
4269 |
++ |
4270 |
++void fib_sync_mtu(struct net_device *dev, u32 orig_mtu) |
4271 |
++{ |
4272 |
++ unsigned int hash = fib_devindex_hashfn(dev->ifindex); |
4273 |
++ struct hlist_head *head = &fib_info_devhash[hash]; |
4274 |
++ struct fib_nh *nh; |
4275 |
++ |
4276 |
++ hlist_for_each_entry(nh, head, nh_hash) { |
4277 |
++ if (nh->nh_dev == dev) |
4278 |
++ nh_update_mtu(nh, dev->mtu, orig_mtu); |
4279 |
++ } |
4280 |
++} |
4281 |
++ |
4282 |
+ /* Event force Flags Description |
4283 |
+ * NETDEV_CHANGE 0 LINKDOWN Carrier OFF, not for scope host |
4284 |
+ * NETDEV_DOWN 0 LINKDOWN|DEAD Link down, not for scope host |
4285 |
+diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c |
4286 |
+index 33a88e045efd..39cfa3a191d8 100644 |
4287 |
+--- a/net/ipv4/inet_connection_sock.c |
4288 |
++++ b/net/ipv4/inet_connection_sock.c |
4289 |
+@@ -535,7 +535,8 @@ struct dst_entry *inet_csk_route_req(const struct sock *sk, |
4290 |
+ struct ip_options_rcu *opt; |
4291 |
+ struct rtable *rt; |
4292 |
+ |
4293 |
+- opt = ireq_opt_deref(ireq); |
4294 |
++ rcu_read_lock(); |
4295 |
++ opt = rcu_dereference(ireq->ireq_opt); |
4296 |
+ |
4297 |
+ flowi4_init_output(fl4, ireq->ir_iif, ireq->ir_mark, |
4298 |
+ RT_CONN_FLAGS(sk), RT_SCOPE_UNIVERSE, |
4299 |
+@@ -549,11 +550,13 @@ struct dst_entry *inet_csk_route_req(const struct sock *sk, |
4300 |
+ goto no_route; |
4301 |
+ if (opt && opt->opt.is_strictroute && rt->rt_uses_gateway) |
4302 |
+ goto route_err; |
4303 |
++ rcu_read_unlock(); |
4304 |
+ return &rt->dst; |
4305 |
+ |
4306 |
+ route_err: |
4307 |
+ ip_rt_put(rt); |
4308 |
+ no_route: |
4309 |
++ rcu_read_unlock(); |
4310 |
+ __IP_INC_STATS(net, IPSTATS_MIB_OUTNOROUTES); |
4311 |
+ return NULL; |
4312 |
+ } |
4313 |
+diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c |
4314 |
+index c0fe5ad996f2..26c36cccabdc 100644 |
4315 |
+--- a/net/ipv4/ip_sockglue.c |
4316 |
++++ b/net/ipv4/ip_sockglue.c |
4317 |
+@@ -149,7 +149,6 @@ static void ip_cmsg_recv_security(struct msghdr *msg, struct sk_buff *skb) |
4318 |
+ static void ip_cmsg_recv_dstaddr(struct msghdr *msg, struct sk_buff *skb) |
4319 |
+ { |
4320 |
+ struct sockaddr_in sin; |
4321 |
+- const struct iphdr *iph = ip_hdr(skb); |
4322 |
+ __be16 *ports; |
4323 |
+ int end; |
4324 |
+ |
4325 |
+@@ -164,7 +163,7 @@ static void ip_cmsg_recv_dstaddr(struct msghdr *msg, struct sk_buff *skb) |
4326 |
+ ports = (__be16 *)skb_transport_header(skb); |
4327 |
+ |
4328 |
+ sin.sin_family = AF_INET; |
4329 |
+- sin.sin_addr.s_addr = iph->daddr; |
4330 |
++ sin.sin_addr.s_addr = ip_hdr(skb)->daddr; |
4331 |
+ sin.sin_port = ports[1]; |
4332 |
+ memset(sin.sin_zero, 0, sizeof(sin.sin_zero)); |
4333 |
+ |
4334 |
+diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c |
4335 |
+index c4f5602308ed..284a22154b4e 100644 |
4336 |
+--- a/net/ipv4/ip_tunnel.c |
4337 |
++++ b/net/ipv4/ip_tunnel.c |
4338 |
+@@ -627,6 +627,7 @@ void ip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev, |
4339 |
+ const struct iphdr *tnl_params, u8 protocol) |
4340 |
+ { |
4341 |
+ struct ip_tunnel *tunnel = netdev_priv(dev); |
4342 |
++ unsigned int inner_nhdr_len = 0; |
4343 |
+ const struct iphdr *inner_iph; |
4344 |
+ struct flowi4 fl4; |
4345 |
+ u8 tos, ttl; |
4346 |
+@@ -636,6 +637,14 @@ void ip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev, |
4347 |
+ __be32 dst; |
4348 |
+ bool connected; |
4349 |
+ |
4350 |
++ /* ensure we can access the inner net header, for several users below */ |
4351 |
++ if (skb->protocol == htons(ETH_P_IP)) |
4352 |
++ inner_nhdr_len = sizeof(struct iphdr); |
4353 |
++ else if (skb->protocol == htons(ETH_P_IPV6)) |
4354 |
++ inner_nhdr_len = sizeof(struct ipv6hdr); |
4355 |
++ if (unlikely(!pskb_may_pull(skb, inner_nhdr_len))) |
4356 |
++ goto tx_error; |
4357 |
++ |
4358 |
+ inner_iph = (const struct iphdr *)skb_inner_network_header(skb); |
4359 |
+ connected = (tunnel->parms.iph.daddr != 0); |
4360 |
+ |
4361 |
+diff --git a/net/ipv4/route.c b/net/ipv4/route.c |
4362 |
+index 1df6e97106d7..f80acb5f1896 100644 |
4363 |
+--- a/net/ipv4/route.c |
4364 |
++++ b/net/ipv4/route.c |
4365 |
+@@ -1001,21 +1001,22 @@ out: kfree_skb(skb); |
4366 |
+ static void __ip_rt_update_pmtu(struct rtable *rt, struct flowi4 *fl4, u32 mtu) |
4367 |
+ { |
4368 |
+ struct dst_entry *dst = &rt->dst; |
4369 |
++ u32 old_mtu = ipv4_mtu(dst); |
4370 |
+ struct fib_result res; |
4371 |
+ bool lock = false; |
4372 |
+ |
4373 |
+ if (ip_mtu_locked(dst)) |
4374 |
+ return; |
4375 |
+ |
4376 |
+- if (ipv4_mtu(dst) < mtu) |
4377 |
++ if (old_mtu < mtu) |
4378 |
+ return; |
4379 |
+ |
4380 |
+ if (mtu < ip_rt_min_pmtu) { |
4381 |
+ lock = true; |
4382 |
+- mtu = ip_rt_min_pmtu; |
4383 |
++ mtu = min(old_mtu, ip_rt_min_pmtu); |
4384 |
+ } |
4385 |
+ |
4386 |
+- if (rt->rt_pmtu == mtu && |
4387 |
++ if (rt->rt_pmtu == mtu && !lock && |
4388 |
+ time_before(jiffies, dst->expires - ip_rt_mtu_expires / 2)) |
4389 |
+ return; |
4390 |
+ |
4391 |
+diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c |
4392 |
+index f9dcb29be12d..8b7294688633 100644 |
4393 |
+--- a/net/ipv4/tcp_input.c |
4394 |
++++ b/net/ipv4/tcp_input.c |
4395 |
+@@ -5976,11 +5976,13 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb) |
4396 |
+ if (th->fin) |
4397 |
+ goto discard; |
4398 |
+ /* It is possible that we process SYN packets from backlog, |
4399 |
+- * so we need to make sure to disable BH right there. |
4400 |
++ * so we need to make sure to disable BH and RCU right there. |
4401 |
+ */ |
4402 |
++ rcu_read_lock(); |
4403 |
+ local_bh_disable(); |
4404 |
+ acceptable = icsk->icsk_af_ops->conn_request(sk, skb) >= 0; |
4405 |
+ local_bh_enable(); |
4406 |
++ rcu_read_unlock(); |
4407 |
+ |
4408 |
+ if (!acceptable) |
4409 |
+ return 1; |
4410 |
+diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c |
4411 |
+index 488b201851d7..d380856ba488 100644 |
4412 |
+--- a/net/ipv4/tcp_ipv4.c |
4413 |
++++ b/net/ipv4/tcp_ipv4.c |
4414 |
+@@ -942,9 +942,11 @@ static int tcp_v4_send_synack(const struct sock *sk, struct dst_entry *dst, |
4415 |
+ if (skb) { |
4416 |
+ __tcp_v4_send_check(skb, ireq->ir_loc_addr, ireq->ir_rmt_addr); |
4417 |
+ |
4418 |
++ rcu_read_lock(); |
4419 |
+ err = ip_build_and_send_pkt(skb, sk, ireq->ir_loc_addr, |
4420 |
+ ireq->ir_rmt_addr, |
4421 |
+- ireq_opt_deref(ireq)); |
4422 |
++ rcu_dereference(ireq->ireq_opt)); |
4423 |
++ rcu_read_unlock(); |
4424 |
+ err = net_xmit_eval(err); |
4425 |
+ } |
4426 |
+ |
4427 |
+diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c |
4428 |
+index fed65bc9df86..a12df801de94 100644 |
4429 |
+--- a/net/ipv4/udp.c |
4430 |
++++ b/net/ipv4/udp.c |
4431 |
+@@ -1631,7 +1631,7 @@ busy_check: |
4432 |
+ *err = error; |
4433 |
+ return NULL; |
4434 |
+ } |
4435 |
+-EXPORT_SYMBOL_GPL(__skb_recv_udp); |
4436 |
++EXPORT_SYMBOL(__skb_recv_udp); |
4437 |
+ |
4438 |
+ /* |
4439 |
+ * This should be easy, if there is something there we |
4440 |
+diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c |
4441 |
+index f66a1cae3366..3484c7020fd9 100644 |
4442 |
+--- a/net/ipv6/addrconf.c |
4443 |
++++ b/net/ipv6/addrconf.c |
4444 |
+@@ -4203,7 +4203,6 @@ static struct inet6_ifaddr *if6_get_first(struct seq_file *seq, loff_t pos) |
4445 |
+ p++; |
4446 |
+ continue; |
4447 |
+ } |
4448 |
+- state->offset++; |
4449 |
+ return ifa; |
4450 |
+ } |
4451 |
+ |
4452 |
+@@ -4227,13 +4226,12 @@ static struct inet6_ifaddr *if6_get_next(struct seq_file *seq, |
4453 |
+ return ifa; |
4454 |
+ } |
4455 |
+ |
4456 |
++ state->offset = 0; |
4457 |
+ while (++state->bucket < IN6_ADDR_HSIZE) { |
4458 |
+- state->offset = 0; |
4459 |
+ hlist_for_each_entry_rcu(ifa, |
4460 |
+ &inet6_addr_lst[state->bucket], addr_lst) { |
4461 |
+ if (!net_eq(dev_net(ifa->idev->dev), net)) |
4462 |
+ continue; |
4463 |
+- state->offset++; |
4464 |
+ return ifa; |
4465 |
+ } |
4466 |
+ } |
4467 |
+diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c |
4468 |
+index 5516f55e214b..cbe46175bb59 100644 |
4469 |
+--- a/net/ipv6/ip6_fib.c |
4470 |
++++ b/net/ipv6/ip6_fib.c |
4471 |
+@@ -196,6 +196,8 @@ void fib6_info_destroy_rcu(struct rcu_head *head) |
4472 |
+ *ppcpu_rt = NULL; |
4473 |
+ } |
4474 |
+ } |
4475 |
++ |
4476 |
++ free_percpu(f6i->rt6i_pcpu); |
4477 |
+ } |
4478 |
+ |
4479 |
+ lwtstate_put(f6i->fib6_nh.nh_lwtstate); |
4480 |
+diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c |
4481 |
+index 1cc9650af9fb..f5b5b0574a2d 100644 |
4482 |
+--- a/net/ipv6/ip6_tunnel.c |
4483 |
++++ b/net/ipv6/ip6_tunnel.c |
4484 |
+@@ -1226,7 +1226,7 @@ static inline int |
4485 |
+ ip4ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev) |
4486 |
+ { |
4487 |
+ struct ip6_tnl *t = netdev_priv(dev); |
4488 |
+- const struct iphdr *iph = ip_hdr(skb); |
4489 |
++ const struct iphdr *iph; |
4490 |
+ int encap_limit = -1; |
4491 |
+ struct flowi6 fl6; |
4492 |
+ __u8 dsfield; |
4493 |
+@@ -1234,6 +1234,11 @@ ip4ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev) |
4494 |
+ u8 tproto; |
4495 |
+ int err; |
4496 |
+ |
4497 |
++ /* ensure we can access the full inner ip header */ |
4498 |
++ if (!pskb_may_pull(skb, sizeof(struct iphdr))) |
4499 |
++ return -1; |
4500 |
++ |
4501 |
++ iph = ip_hdr(skb); |
4502 |
+ memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt)); |
4503 |
+ |
4504 |
+ tproto = READ_ONCE(t->parms.proto); |
4505 |
+@@ -1297,7 +1302,7 @@ static inline int |
4506 |
+ ip6ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev) |
4507 |
+ { |
4508 |
+ struct ip6_tnl *t = netdev_priv(dev); |
4509 |
+- struct ipv6hdr *ipv6h = ipv6_hdr(skb); |
4510 |
++ struct ipv6hdr *ipv6h; |
4511 |
+ int encap_limit = -1; |
4512 |
+ __u16 offset; |
4513 |
+ struct flowi6 fl6; |
4514 |
+@@ -1306,6 +1311,10 @@ ip6ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev) |
4515 |
+ u8 tproto; |
4516 |
+ int err; |
4517 |
+ |
4518 |
++ if (unlikely(!pskb_may_pull(skb, sizeof(*ipv6h)))) |
4519 |
++ return -1; |
4520 |
++ |
4521 |
++ ipv6h = ipv6_hdr(skb); |
4522 |
+ tproto = READ_ONCE(t->parms.proto); |
4523 |
+ if ((tproto != IPPROTO_IPV6 && tproto != 0) || |
4524 |
+ ip6_tnl_addr_conflict(t, ipv6h)) |
4525 |
+diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c |
4526 |
+index afc307c89d1a..7ef3e0a5bf86 100644 |
4527 |
+--- a/net/ipv6/raw.c |
4528 |
++++ b/net/ipv6/raw.c |
4529 |
+@@ -650,8 +650,6 @@ static int rawv6_send_hdrinc(struct sock *sk, struct msghdr *msg, int length, |
4530 |
+ skb->protocol = htons(ETH_P_IPV6); |
4531 |
+ skb->priority = sk->sk_priority; |
4532 |
+ skb->mark = sk->sk_mark; |
4533 |
+- skb_dst_set(skb, &rt->dst); |
4534 |
+- *dstp = NULL; |
4535 |
+ |
4536 |
+ skb_put(skb, length); |
4537 |
+ skb_reset_network_header(skb); |
4538 |
+@@ -664,8 +662,14 @@ static int rawv6_send_hdrinc(struct sock *sk, struct msghdr *msg, int length, |
4539 |
+ |
4540 |
+ skb->transport_header = skb->network_header; |
4541 |
+ err = memcpy_from_msg(iph, msg, length); |
4542 |
+- if (err) |
4543 |
+- goto error_fault; |
4544 |
++ if (err) { |
4545 |
++ err = -EFAULT; |
4546 |
++ kfree_skb(skb); |
4547 |
++ goto error; |
4548 |
++ } |
4549 |
++ |
4550 |
++ skb_dst_set(skb, &rt->dst); |
4551 |
++ *dstp = NULL; |
4552 |
+ |
4553 |
+ /* if egress device is enslaved to an L3 master device pass the |
4554 |
+ * skb to its handler for processing |
4555 |
+@@ -674,21 +678,28 @@ static int rawv6_send_hdrinc(struct sock *sk, struct msghdr *msg, int length, |
4556 |
+ if (unlikely(!skb)) |
4557 |
+ return 0; |
4558 |
+ |
4559 |
++ /* Acquire rcu_read_lock() in case we need to use rt->rt6i_idev |
4560 |
++ * in the error path. Since skb has been freed, the dst could |
4561 |
++ * have been queued for deletion. |
4562 |
++ */ |
4563 |
++ rcu_read_lock(); |
4564 |
+ IP6_UPD_PO_STATS(net, rt->rt6i_idev, IPSTATS_MIB_OUT, skb->len); |
4565 |
+ err = NF_HOOK(NFPROTO_IPV6, NF_INET_LOCAL_OUT, net, sk, skb, |
4566 |
+ NULL, rt->dst.dev, dst_output); |
4567 |
+ if (err > 0) |
4568 |
+ err = net_xmit_errno(err); |
4569 |
+- if (err) |
4570 |
+- goto error; |
4571 |
++ if (err) { |
4572 |
++ IP6_INC_STATS(net, rt->rt6i_idev, IPSTATS_MIB_OUTDISCARDS); |
4573 |
++ rcu_read_unlock(); |
4574 |
++ goto error_check; |
4575 |
++ } |
4576 |
++ rcu_read_unlock(); |
4577 |
+ out: |
4578 |
+ return 0; |
4579 |
+ |
4580 |
+-error_fault: |
4581 |
+- err = -EFAULT; |
4582 |
+- kfree_skb(skb); |
4583 |
+ error: |
4584 |
+ IP6_INC_STATS(net, rt->rt6i_idev, IPSTATS_MIB_OUTDISCARDS); |
4585 |
++error_check: |
4586 |
+ if (err == -ENOBUFS && !np->recverr) |
4587 |
+ err = 0; |
4588 |
+ return err; |
4589 |
+diff --git a/net/ipv6/route.c b/net/ipv6/route.c |
4590 |
+index 480a79f47c52..ed526e257da6 100644 |
4591 |
+--- a/net/ipv6/route.c |
4592 |
++++ b/net/ipv6/route.c |
4593 |
+@@ -4314,11 +4314,6 @@ static int ip6_route_info_append(struct net *net, |
4594 |
+ if (!nh) |
4595 |
+ return -ENOMEM; |
4596 |
+ nh->fib6_info = rt; |
4597 |
+- err = ip6_convert_metrics(net, rt, r_cfg); |
4598 |
+- if (err) { |
4599 |
+- kfree(nh); |
4600 |
+- return err; |
4601 |
+- } |
4602 |
+ memcpy(&nh->r_cfg, r_cfg, sizeof(*r_cfg)); |
4603 |
+ list_add_tail(&nh->next, rt6_nh_list); |
4604 |
+ |
4605 |
+diff --git a/net/netlabel/netlabel_unlabeled.c b/net/netlabel/netlabel_unlabeled.c |
4606 |
+index c070dfc0190a..c92894c3e40a 100644 |
4607 |
+--- a/net/netlabel/netlabel_unlabeled.c |
4608 |
++++ b/net/netlabel/netlabel_unlabeled.c |
4609 |
+@@ -781,7 +781,8 @@ static int netlbl_unlabel_addrinfo_get(struct genl_info *info, |
4610 |
+ { |
4611 |
+ u32 addr_len; |
4612 |
+ |
4613 |
+- if (info->attrs[NLBL_UNLABEL_A_IPV4ADDR]) { |
4614 |
++ if (info->attrs[NLBL_UNLABEL_A_IPV4ADDR] && |
4615 |
++ info->attrs[NLBL_UNLABEL_A_IPV4MASK]) { |
4616 |
+ addr_len = nla_len(info->attrs[NLBL_UNLABEL_A_IPV4ADDR]); |
4617 |
+ if (addr_len != sizeof(struct in_addr) && |
4618 |
+ addr_len != nla_len(info->attrs[NLBL_UNLABEL_A_IPV4MASK])) |
4619 |
+diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c |
4620 |
+index e6445d8f3f57..3237e9978c1a 100644 |
4621 |
+--- a/net/packet/af_packet.c |
4622 |
++++ b/net/packet/af_packet.c |
4623 |
+@@ -2712,10 +2712,12 @@ tpacket_error: |
4624 |
+ } |
4625 |
+ } |
4626 |
+ |
4627 |
+- if (po->has_vnet_hdr && virtio_net_hdr_to_skb(skb, vnet_hdr, |
4628 |
+- vio_le())) { |
4629 |
+- tp_len = -EINVAL; |
4630 |
+- goto tpacket_error; |
4631 |
++ if (po->has_vnet_hdr) { |
4632 |
++ if (virtio_net_hdr_to_skb(skb, vnet_hdr, vio_le())) { |
4633 |
++ tp_len = -EINVAL; |
4634 |
++ goto tpacket_error; |
4635 |
++ } |
4636 |
++ virtio_net_hdr_set_proto(skb, vnet_hdr); |
4637 |
+ } |
4638 |
+ |
4639 |
+ skb->destructor = tpacket_destruct_skb; |
4640 |
+@@ -2911,6 +2913,7 @@ static int packet_snd(struct socket *sock, struct msghdr *msg, size_t len) |
4641 |
+ if (err) |
4642 |
+ goto out_free; |
4643 |
+ len += sizeof(vnet_hdr); |
4644 |
++ virtio_net_hdr_set_proto(skb, &vnet_hdr); |
4645 |
+ } |
4646 |
+ |
4647 |
+ skb_probe_transport_header(skb, reserve); |
4648 |
+diff --git a/net/sched/cls_u32.c b/net/sched/cls_u32.c |
4649 |
+index 260749956ef3..24df95a7b9c7 100644 |
4650 |
+--- a/net/sched/cls_u32.c |
4651 |
++++ b/net/sched/cls_u32.c |
4652 |
+@@ -397,6 +397,7 @@ static int u32_init(struct tcf_proto *tp) |
4653 |
+ rcu_assign_pointer(tp_c->hlist, root_ht); |
4654 |
+ root_ht->tp_c = tp_c; |
4655 |
+ |
4656 |
++ root_ht->refcnt++; |
4657 |
+ rcu_assign_pointer(tp->root, root_ht); |
4658 |
+ tp->data = tp_c; |
4659 |
+ return 0; |
4660 |
+@@ -608,7 +609,7 @@ static int u32_destroy_hnode(struct tcf_proto *tp, struct tc_u_hnode *ht, |
4661 |
+ struct tc_u_hnode __rcu **hn; |
4662 |
+ struct tc_u_hnode *phn; |
4663 |
+ |
4664 |
+- WARN_ON(ht->refcnt); |
4665 |
++ WARN_ON(--ht->refcnt); |
4666 |
+ |
4667 |
+ u32_clear_hnode(tp, ht, extack); |
4668 |
+ |
4669 |
+@@ -647,7 +648,7 @@ static void u32_destroy(struct tcf_proto *tp, struct netlink_ext_ack *extack) |
4670 |
+ |
4671 |
+ WARN_ON(root_ht == NULL); |
4672 |
+ |
4673 |
+- if (root_ht && --root_ht->refcnt == 0) |
4674 |
++ if (root_ht && --root_ht->refcnt == 1) |
4675 |
+ u32_destroy_hnode(tp, root_ht, extack); |
4676 |
+ |
4677 |
+ if (--tp_c->refcnt == 0) { |
4678 |
+@@ -696,7 +697,6 @@ static int u32_delete(struct tcf_proto *tp, void *arg, bool *last, |
4679 |
+ } |
4680 |
+ |
4681 |
+ if (ht->refcnt == 1) { |
4682 |
+- ht->refcnt--; |
4683 |
+ u32_destroy_hnode(tp, ht, extack); |
4684 |
+ } else { |
4685 |
+ NL_SET_ERR_MSG_MOD(extack, "Can not delete in-use filter"); |
4686 |
+@@ -706,11 +706,11 @@ static int u32_delete(struct tcf_proto *tp, void *arg, bool *last, |
4687 |
+ out: |
4688 |
+ *last = true; |
4689 |
+ if (root_ht) { |
4690 |
+- if (root_ht->refcnt > 1) { |
4691 |
++ if (root_ht->refcnt > 2) { |
4692 |
+ *last = false; |
4693 |
+ goto ret; |
4694 |
+ } |
4695 |
+- if (root_ht->refcnt == 1) { |
4696 |
++ if (root_ht->refcnt == 2) { |
4697 |
+ if (!ht_empty(root_ht)) { |
4698 |
+ *last = false; |
4699 |
+ goto ret; |
4700 |
+diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c |
4701 |
+index 54eca685420f..99cc25aae503 100644 |
4702 |
+--- a/net/sched/sch_api.c |
4703 |
++++ b/net/sched/sch_api.c |
4704 |
+@@ -1304,6 +1304,18 @@ check_loop_fn(struct Qdisc *q, unsigned long cl, struct qdisc_walker *w) |
4705 |
+ * Delete/get qdisc. |
4706 |
+ */ |
4707 |
+ |
4708 |
++const struct nla_policy rtm_tca_policy[TCA_MAX + 1] = { |
4709 |
++ [TCA_KIND] = { .type = NLA_STRING }, |
4710 |
++ [TCA_OPTIONS] = { .type = NLA_NESTED }, |
4711 |
++ [TCA_RATE] = { .type = NLA_BINARY, |
4712 |
++ .len = sizeof(struct tc_estimator) }, |
4713 |
++ [TCA_STAB] = { .type = NLA_NESTED }, |
4714 |
++ [TCA_DUMP_INVISIBLE] = { .type = NLA_FLAG }, |
4715 |
++ [TCA_CHAIN] = { .type = NLA_U32 }, |
4716 |
++ [TCA_INGRESS_BLOCK] = { .type = NLA_U32 }, |
4717 |
++ [TCA_EGRESS_BLOCK] = { .type = NLA_U32 }, |
4718 |
++}; |
4719 |
++ |
4720 |
+ static int tc_get_qdisc(struct sk_buff *skb, struct nlmsghdr *n, |
4721 |
+ struct netlink_ext_ack *extack) |
4722 |
+ { |
4723 |
+@@ -1320,7 +1332,8 @@ static int tc_get_qdisc(struct sk_buff *skb, struct nlmsghdr *n, |
4724 |
+ !netlink_ns_capable(skb, net->user_ns, CAP_NET_ADMIN)) |
4725 |
+ return -EPERM; |
4726 |
+ |
4727 |
+- err = nlmsg_parse(n, sizeof(*tcm), tca, TCA_MAX, NULL, extack); |
4728 |
++ err = nlmsg_parse(n, sizeof(*tcm), tca, TCA_MAX, rtm_tca_policy, |
4729 |
++ extack); |
4730 |
+ if (err < 0) |
4731 |
+ return err; |
4732 |
+ |
4733 |
+@@ -1404,7 +1417,8 @@ static int tc_modify_qdisc(struct sk_buff *skb, struct nlmsghdr *n, |
4734 |
+ |
4735 |
+ replay: |
4736 |
+ /* Reinit, just in case something touches this. */ |
4737 |
+- err = nlmsg_parse(n, sizeof(*tcm), tca, TCA_MAX, NULL, extack); |
4738 |
++ err = nlmsg_parse(n, sizeof(*tcm), tca, TCA_MAX, rtm_tca_policy, |
4739 |
++ extack); |
4740 |
+ if (err < 0) |
4741 |
+ return err; |
4742 |
+ |
4743 |
+@@ -1638,7 +1652,8 @@ static int tc_dump_qdisc(struct sk_buff *skb, struct netlink_callback *cb) |
4744 |
+ idx = 0; |
4745 |
+ ASSERT_RTNL(); |
4746 |
+ |
4747 |
+- err = nlmsg_parse(nlh, sizeof(struct tcmsg), tca, TCA_MAX, NULL, NULL); |
4748 |
++ err = nlmsg_parse(nlh, sizeof(struct tcmsg), tca, TCA_MAX, |
4749 |
++ rtm_tca_policy, NULL); |
4750 |
+ if (err < 0) |
4751 |
+ return err; |
4752 |
+ |
4753 |
+@@ -1857,7 +1872,8 @@ static int tc_ctl_tclass(struct sk_buff *skb, struct nlmsghdr *n, |
4754 |
+ !netlink_ns_capable(skb, net->user_ns, CAP_NET_ADMIN)) |
4755 |
+ return -EPERM; |
4756 |
+ |
4757 |
+- err = nlmsg_parse(n, sizeof(*tcm), tca, TCA_MAX, NULL, extack); |
4758 |
++ err = nlmsg_parse(n, sizeof(*tcm), tca, TCA_MAX, rtm_tca_policy, |
4759 |
++ extack); |
4760 |
+ if (err < 0) |
4761 |
+ return err; |
4762 |
+ |
4763 |
+diff --git a/net/sctp/transport.c b/net/sctp/transport.c |
4764 |
+index 12cac85da994..033696e6f74f 100644 |
4765 |
+--- a/net/sctp/transport.c |
4766 |
++++ b/net/sctp/transport.c |
4767 |
+@@ -260,6 +260,7 @@ void sctp_transport_pmtu(struct sctp_transport *transport, struct sock *sk) |
4768 |
+ bool sctp_transport_update_pmtu(struct sctp_transport *t, u32 pmtu) |
4769 |
+ { |
4770 |
+ struct dst_entry *dst = sctp_transport_dst_check(t); |
4771 |
++ struct sock *sk = t->asoc->base.sk; |
4772 |
+ bool change = true; |
4773 |
+ |
4774 |
+ if (unlikely(pmtu < SCTP_DEFAULT_MINSEGMENT)) { |
4775 |
+@@ -271,12 +272,19 @@ bool sctp_transport_update_pmtu(struct sctp_transport *t, u32 pmtu) |
4776 |
+ pmtu = SCTP_TRUNC4(pmtu); |
4777 |
+ |
4778 |
+ if (dst) { |
4779 |
+- dst->ops->update_pmtu(dst, t->asoc->base.sk, NULL, pmtu); |
4780 |
++ struct sctp_pf *pf = sctp_get_pf_specific(dst->ops->family); |
4781 |
++ union sctp_addr addr; |
4782 |
++ |
4783 |
++ pf->af->from_sk(&addr, sk); |
4784 |
++ pf->to_sk_daddr(&t->ipaddr, sk); |
4785 |
++ dst->ops->update_pmtu(dst, sk, NULL, pmtu); |
4786 |
++ pf->to_sk_daddr(&addr, sk); |
4787 |
++ |
4788 |
+ dst = sctp_transport_dst_check(t); |
4789 |
+ } |
4790 |
+ |
4791 |
+ if (!dst) { |
4792 |
+- t->af_specific->get_dst(t, &t->saddr, &t->fl, t->asoc->base.sk); |
4793 |
++ t->af_specific->get_dst(t, &t->saddr, &t->fl, sk); |
4794 |
+ dst = t->dst; |
4795 |
+ } |
4796 |
+ |
4797 |
+diff --git a/net/tipc/socket.c b/net/tipc/socket.c |
4798 |
+index 093e16d1b770..cdaf3534e373 100644 |
4799 |
+--- a/net/tipc/socket.c |
4800 |
++++ b/net/tipc/socket.c |
4801 |
+@@ -1422,8 +1422,10 @@ static int __tipc_sendstream(struct socket *sock, struct msghdr *m, size_t dlen) |
4802 |
+ /* Handle implicit connection setup */ |
4803 |
+ if (unlikely(dest)) { |
4804 |
+ rc = __tipc_sendmsg(sock, m, dlen); |
4805 |
+- if (dlen && (dlen == rc)) |
4806 |
++ if (dlen && dlen == rc) { |
4807 |
++ tsk->peer_caps = tipc_node_get_capabilities(net, dnode); |
4808 |
+ tsk->snt_unacked = tsk_inc(tsk, dlen + msg_hdr_sz(hdr)); |
4809 |
++ } |
4810 |
+ return rc; |
4811 |
+ } |
4812 |
+ |
4813 |
+diff --git a/scripts/subarch.include b/scripts/subarch.include |
4814 |
+new file mode 100644 |
4815 |
+index 000000000000..650682821126 |
4816 |
+--- /dev/null |
4817 |
++++ b/scripts/subarch.include |
4818 |
+@@ -0,0 +1,13 @@ |
4819 |
++# SUBARCH tells the usermode build what the underlying arch is. That is set |
4820 |
++# first, and if a usermode build is happening, the "ARCH=um" on the command |
4821 |
++# line overrides the setting of ARCH below. If a native build is happening, |
4822 |
++# then ARCH is assigned, getting whatever value it gets normally, and |
4823 |
++# SUBARCH is subsequently ignored. |
4824 |
++ |
4825 |
++SUBARCH := $(shell uname -m | sed -e s/i.86/x86/ -e s/x86_64/x86/ \ |
4826 |
++ -e s/sun4u/sparc64/ \ |
4827 |
++ -e s/arm.*/arm/ -e s/sa110/arm/ \ |
4828 |
++ -e s/s390x/s390/ -e s/parisc64/parisc/ \ |
4829 |
++ -e s/ppc.*/powerpc/ -e s/mips.*/mips/ \ |
4830 |
++ -e s/sh[234].*/sh/ -e s/aarch64.*/arm64/ \ |
4831 |
++ -e s/riscv.*/riscv/) |
4832 |
+diff --git a/sound/hda/hdac_controller.c b/sound/hda/hdac_controller.c |
4833 |
+index 560ec0986e1a..74244d8e2909 100644 |
4834 |
+--- a/sound/hda/hdac_controller.c |
4835 |
++++ b/sound/hda/hdac_controller.c |
4836 |
+@@ -40,6 +40,8 @@ static void azx_clear_corbrp(struct hdac_bus *bus) |
4837 |
+ */ |
4838 |
+ void snd_hdac_bus_init_cmd_io(struct hdac_bus *bus) |
4839 |
+ { |
4840 |
++ WARN_ON_ONCE(!bus->rb.area); |
4841 |
++ |
4842 |
+ spin_lock_irq(&bus->reg_lock); |
4843 |
+ /* CORB set up */ |
4844 |
+ bus->corb.addr = bus->rb.addr; |
4845 |
+@@ -383,7 +385,7 @@ void snd_hdac_bus_exit_link_reset(struct hdac_bus *bus) |
4846 |
+ EXPORT_SYMBOL_GPL(snd_hdac_bus_exit_link_reset); |
4847 |
+ |
4848 |
+ /* reset codec link */ |
4849 |
+-static int azx_reset(struct hdac_bus *bus, bool full_reset) |
4850 |
++int snd_hdac_bus_reset_link(struct hdac_bus *bus, bool full_reset) |
4851 |
+ { |
4852 |
+ if (!full_reset) |
4853 |
+ goto skip_reset; |
4854 |
+@@ -408,7 +410,7 @@ static int azx_reset(struct hdac_bus *bus, bool full_reset) |
4855 |
+ skip_reset: |
4856 |
+ /* check to see if controller is ready */ |
4857 |
+ if (!snd_hdac_chip_readb(bus, GCTL)) { |
4858 |
+- dev_dbg(bus->dev, "azx_reset: controller not ready!\n"); |
4859 |
++ dev_dbg(bus->dev, "controller not ready!\n"); |
4860 |
+ return -EBUSY; |
4861 |
+ } |
4862 |
+ |
4863 |
+@@ -423,6 +425,7 @@ static int azx_reset(struct hdac_bus *bus, bool full_reset) |
4864 |
+ |
4865 |
+ return 0; |
4866 |
+ } |
4867 |
++EXPORT_SYMBOL_GPL(snd_hdac_bus_reset_link); |
4868 |
+ |
4869 |
+ /* enable interrupts */ |
4870 |
+ static void azx_int_enable(struct hdac_bus *bus) |
4871 |
+@@ -477,15 +480,17 @@ bool snd_hdac_bus_init_chip(struct hdac_bus *bus, bool full_reset) |
4872 |
+ return false; |
4873 |
+ |
4874 |
+ /* reset controller */ |
4875 |
+- azx_reset(bus, full_reset); |
4876 |
++ snd_hdac_bus_reset_link(bus, full_reset); |
4877 |
+ |
4878 |
+- /* initialize interrupts */ |
4879 |
++ /* clear interrupts */ |
4880 |
+ azx_int_clear(bus); |
4881 |
+- azx_int_enable(bus); |
4882 |
+ |
4883 |
+ /* initialize the codec command I/O */ |
4884 |
+ snd_hdac_bus_init_cmd_io(bus); |
4885 |
+ |
4886 |
++ /* enable interrupts after CORB/RIRB buffers are initialized above */ |
4887 |
++ azx_int_enable(bus); |
4888 |
++ |
4889 |
+ /* program the position buffer */ |
4890 |
+ if (bus->use_posbuf && bus->posbuf.addr) { |
4891 |
+ snd_hdac_chip_writel(bus, DPLBASE, (u32)bus->posbuf.addr); |
4892 |
+diff --git a/sound/soc/amd/acp-pcm-dma.c b/sound/soc/amd/acp-pcm-dma.c |
4893 |
+index 77203841c535..90df61d263b8 100644 |
4894 |
+--- a/sound/soc/amd/acp-pcm-dma.c |
4895 |
++++ b/sound/soc/amd/acp-pcm-dma.c |
4896 |
+@@ -16,6 +16,7 @@ |
4897 |
+ #include <linux/module.h> |
4898 |
+ #include <linux/delay.h> |
4899 |
+ #include <linux/io.h> |
4900 |
++#include <linux/iopoll.h> |
4901 |
+ #include <linux/sizes.h> |
4902 |
+ #include <linux/pm_runtime.h> |
4903 |
+ |
4904 |
+@@ -184,6 +185,24 @@ static void config_dma_descriptor_in_sram(void __iomem *acp_mmio, |
4905 |
+ acp_reg_write(descr_info->xfer_val, acp_mmio, mmACP_SRBM_Targ_Idx_Data); |
4906 |
+ } |
4907 |
+ |
4908 |
++static void pre_config_reset(void __iomem *acp_mmio, u16 ch_num) |
4909 |
++{ |
4910 |
++ u32 dma_ctrl; |
4911 |
++ int ret; |
4912 |
++ |
4913 |
++ /* clear the reset bit */ |
4914 |
++ dma_ctrl = acp_reg_read(acp_mmio, mmACP_DMA_CNTL_0 + ch_num); |
4915 |
++ dma_ctrl &= ~ACP_DMA_CNTL_0__DMAChRst_MASK; |
4916 |
++ acp_reg_write(dma_ctrl, acp_mmio, mmACP_DMA_CNTL_0 + ch_num); |
4917 |
++ /* check the reset bit before programming configuration registers */ |
4918 |
++ ret = readl_poll_timeout(acp_mmio + ((mmACP_DMA_CNTL_0 + ch_num) * 4), |
4919 |
++ dma_ctrl, |
4920 |
++ !(dma_ctrl & ACP_DMA_CNTL_0__DMAChRst_MASK), |
4921 |
++ 100, ACP_DMA_RESET_TIME); |
4922 |
++ if (ret < 0) |
4923 |
++ pr_err("Failed to clear reset of channel : %d\n", ch_num); |
4924 |
++} |
4925 |
++ |
4926 |
+ /* |
4927 |
+ * Initialize the DMA descriptor information for transfer between |
4928 |
+ * system memory <-> ACP SRAM |
4929 |
+@@ -238,6 +257,7 @@ static void set_acp_sysmem_dma_descriptors(void __iomem *acp_mmio, |
4930 |
+ config_dma_descriptor_in_sram(acp_mmio, dma_dscr_idx, |
4931 |
+ &dmadscr[i]); |
4932 |
+ } |
4933 |
++ pre_config_reset(acp_mmio, ch); |
4934 |
+ config_acp_dma_channel(acp_mmio, ch, |
4935 |
+ dma_dscr_idx - 1, |
4936 |
+ NUM_DSCRS_PER_CHANNEL, |
4937 |
+@@ -277,6 +297,7 @@ static void set_acp_to_i2s_dma_descriptors(void __iomem *acp_mmio, u32 size, |
4938 |
+ config_dma_descriptor_in_sram(acp_mmio, dma_dscr_idx, |
4939 |
+ &dmadscr[i]); |
4940 |
+ } |
4941 |
++ pre_config_reset(acp_mmio, ch); |
4942 |
+ /* Configure the DMA channel with the above descriptore */ |
4943 |
+ config_acp_dma_channel(acp_mmio, ch, dma_dscr_idx - 1, |
4944 |
+ NUM_DSCRS_PER_CHANNEL, |
4945 |
+diff --git a/sound/soc/codecs/max98373.c b/sound/soc/codecs/max98373.c |
4946 |
+index a92586106932..f0948e84f6ae 100644 |
4947 |
+--- a/sound/soc/codecs/max98373.c |
4948 |
++++ b/sound/soc/codecs/max98373.c |
4949 |
+@@ -519,6 +519,7 @@ static bool max98373_volatile_reg(struct device *dev, unsigned int reg) |
4950 |
+ { |
4951 |
+ switch (reg) { |
4952 |
+ case MAX98373_R2000_SW_RESET ... MAX98373_R2009_INT_FLAG3: |
4953 |
++ case MAX98373_R203E_AMP_PATH_GAIN: |
4954 |
+ case MAX98373_R2054_MEAS_ADC_PVDD_CH_READBACK: |
4955 |
+ case MAX98373_R2055_MEAS_ADC_THERM_CH_READBACK: |
4956 |
+ case MAX98373_R20B6_BDE_CUR_STATE_READBACK: |
4957 |
+@@ -728,6 +729,7 @@ static int max98373_probe(struct snd_soc_component *component) |
4958 |
+ /* Software Reset */ |
4959 |
+ regmap_write(max98373->regmap, |
4960 |
+ MAX98373_R2000_SW_RESET, MAX98373_SOFT_RESET); |
4961 |
++ usleep_range(10000, 11000); |
4962 |
+ |
4963 |
+ /* IV default slot configuration */ |
4964 |
+ regmap_write(max98373->regmap, |
4965 |
+@@ -816,6 +818,7 @@ static int max98373_resume(struct device *dev) |
4966 |
+ |
4967 |
+ regmap_write(max98373->regmap, |
4968 |
+ MAX98373_R2000_SW_RESET, MAX98373_SOFT_RESET); |
4969 |
++ usleep_range(10000, 11000); |
4970 |
+ regcache_cache_only(max98373->regmap, false); |
4971 |
+ regcache_sync(max98373->regmap); |
4972 |
+ return 0; |
4973 |
+diff --git a/sound/soc/codecs/rt5514.c b/sound/soc/codecs/rt5514.c |
4974 |
+index dca82dd6e3bf..32fe76c3134a 100644 |
4975 |
+--- a/sound/soc/codecs/rt5514.c |
4976 |
++++ b/sound/soc/codecs/rt5514.c |
4977 |
+@@ -64,8 +64,8 @@ static const struct reg_sequence rt5514_patch[] = { |
4978 |
+ {RT5514_ANA_CTRL_LDO10, 0x00028604}, |
4979 |
+ {RT5514_ANA_CTRL_ADCFED, 0x00000800}, |
4980 |
+ {RT5514_ASRC_IN_CTRL1, 0x00000003}, |
4981 |
+- {RT5514_DOWNFILTER0_CTRL3, 0x10000352}, |
4982 |
+- {RT5514_DOWNFILTER1_CTRL3, 0x10000352}, |
4983 |
++ {RT5514_DOWNFILTER0_CTRL3, 0x10000342}, |
4984 |
++ {RT5514_DOWNFILTER1_CTRL3, 0x10000342}, |
4985 |
+ }; |
4986 |
+ |
4987 |
+ static const struct reg_default rt5514_reg[] = { |
4988 |
+@@ -92,10 +92,10 @@ static const struct reg_default rt5514_reg[] = { |
4989 |
+ {RT5514_ASRC_IN_CTRL1, 0x00000003}, |
4990 |
+ {RT5514_DOWNFILTER0_CTRL1, 0x00020c2f}, |
4991 |
+ {RT5514_DOWNFILTER0_CTRL2, 0x00020c2f}, |
4992 |
+- {RT5514_DOWNFILTER0_CTRL3, 0x10000352}, |
4993 |
++ {RT5514_DOWNFILTER0_CTRL3, 0x10000342}, |
4994 |
+ {RT5514_DOWNFILTER1_CTRL1, 0x00020c2f}, |
4995 |
+ {RT5514_DOWNFILTER1_CTRL2, 0x00020c2f}, |
4996 |
+- {RT5514_DOWNFILTER1_CTRL3, 0x10000352}, |
4997 |
++ {RT5514_DOWNFILTER1_CTRL3, 0x10000342}, |
4998 |
+ {RT5514_ANA_CTRL_LDO10, 0x00028604}, |
4999 |
+ {RT5514_ANA_CTRL_LDO18_16, 0x02000345}, |
5000 |
+ {RT5514_ANA_CTRL_ADC12, 0x0000a2a8}, |
5001 |
+diff --git a/sound/soc/codecs/sigmadsp.c b/sound/soc/codecs/sigmadsp.c |
5002 |
+index d53680ac78e4..6df158669420 100644 |
5003 |
+--- a/sound/soc/codecs/sigmadsp.c |
5004 |
++++ b/sound/soc/codecs/sigmadsp.c |
5005 |
+@@ -117,8 +117,7 @@ static int sigmadsp_ctrl_write(struct sigmadsp *sigmadsp, |
5006 |
+ struct sigmadsp_control *ctrl, void *data) |
5007 |
+ { |
5008 |
+ /* safeload loads up to 20 bytes in a atomic operation */ |
5009 |
+- if (ctrl->num_bytes > 4 && ctrl->num_bytes <= 20 && sigmadsp->ops && |
5010 |
+- sigmadsp->ops->safeload) |
5011 |
++ if (ctrl->num_bytes <= 20 && sigmadsp->ops && sigmadsp->ops->safeload) |
5012 |
+ return sigmadsp->ops->safeload(sigmadsp, ctrl->addr, data, |
5013 |
+ ctrl->num_bytes); |
5014 |
+ else |
5015 |
+diff --git a/sound/soc/codecs/wm8804-i2c.c b/sound/soc/codecs/wm8804-i2c.c |
5016 |
+index f27464c2c5ba..79541960f45d 100644 |
5017 |
+--- a/sound/soc/codecs/wm8804-i2c.c |
5018 |
++++ b/sound/soc/codecs/wm8804-i2c.c |
5019 |
+@@ -13,6 +13,7 @@ |
5020 |
+ #include <linux/init.h> |
5021 |
+ #include <linux/module.h> |
5022 |
+ #include <linux/i2c.h> |
5023 |
++#include <linux/acpi.h> |
5024 |
+ |
5025 |
+ #include "wm8804.h" |
5026 |
+ |
5027 |
+@@ -40,17 +41,29 @@ static const struct i2c_device_id wm8804_i2c_id[] = { |
5028 |
+ }; |
5029 |
+ MODULE_DEVICE_TABLE(i2c, wm8804_i2c_id); |
5030 |
+ |
5031 |
++#if defined(CONFIG_OF) |
5032 |
+ static const struct of_device_id wm8804_of_match[] = { |
5033 |
+ { .compatible = "wlf,wm8804", }, |
5034 |
+ { } |
5035 |
+ }; |
5036 |
+ MODULE_DEVICE_TABLE(of, wm8804_of_match); |
5037 |
++#endif |
5038 |
++ |
5039 |
++#ifdef CONFIG_ACPI |
5040 |
++static const struct acpi_device_id wm8804_acpi_match[] = { |
5041 |
++ { "1AEC8804", 0 }, /* Wolfson PCI ID + part ID */ |
5042 |
++ { "10138804", 0 }, /* Cirrus Logic PCI ID + part ID */ |
5043 |
++ { }, |
5044 |
++}; |
5045 |
++MODULE_DEVICE_TABLE(acpi, wm8804_acpi_match); |
5046 |
++#endif |
5047 |
+ |
5048 |
+ static struct i2c_driver wm8804_i2c_driver = { |
5049 |
+ .driver = { |
5050 |
+ .name = "wm8804", |
5051 |
+ .pm = &wm8804_pm, |
5052 |
+- .of_match_table = wm8804_of_match, |
5053 |
++ .of_match_table = of_match_ptr(wm8804_of_match), |
5054 |
++ .acpi_match_table = ACPI_PTR(wm8804_acpi_match), |
5055 |
+ }, |
5056 |
+ .probe = wm8804_i2c_probe, |
5057 |
+ .remove = wm8804_i2c_remove, |
5058 |
+diff --git a/sound/soc/intel/skylake/skl.c b/sound/soc/intel/skylake/skl.c |
5059 |
+index f0d9793f872a..c7cdfa4a7076 100644 |
5060 |
+--- a/sound/soc/intel/skylake/skl.c |
5061 |
++++ b/sound/soc/intel/skylake/skl.c |
5062 |
+@@ -844,7 +844,7 @@ static int skl_first_init(struct hdac_ext_bus *ebus) |
5063 |
+ return -ENXIO; |
5064 |
+ } |
5065 |
+ |
5066 |
+- skl_init_chip(bus, true); |
5067 |
++ snd_hdac_bus_reset_link(bus, true); |
5068 |
+ |
5069 |
+ snd_hdac_bus_parse_capabilities(bus); |
5070 |
+ |
5071 |
+diff --git a/sound/soc/qcom/qdsp6/q6routing.c b/sound/soc/qcom/qdsp6/q6routing.c |
5072 |
+index 593f66b8622f..33bb97c0b6b6 100644 |
5073 |
+--- a/sound/soc/qcom/qdsp6/q6routing.c |
5074 |
++++ b/sound/soc/qcom/qdsp6/q6routing.c |
5075 |
+@@ -933,8 +933,10 @@ static int msm_routing_probe(struct snd_soc_component *c) |
5076 |
+ { |
5077 |
+ int i; |
5078 |
+ |
5079 |
+- for (i = 0; i < MAX_SESSIONS; i++) |
5080 |
++ for (i = 0; i < MAX_SESSIONS; i++) { |
5081 |
+ routing_data->sessions[i].port_id = -1; |
5082 |
++ routing_data->sessions[i].fedai_id = -1; |
5083 |
++ } |
5084 |
+ |
5085 |
+ return 0; |
5086 |
+ } |
5087 |
+diff --git a/sound/soc/sh/rcar/adg.c b/sound/soc/sh/rcar/adg.c |
5088 |
+index 4672688cac32..b7c1f34ec280 100644 |
5089 |
+--- a/sound/soc/sh/rcar/adg.c |
5090 |
++++ b/sound/soc/sh/rcar/adg.c |
5091 |
+@@ -465,6 +465,11 @@ static void rsnd_adg_get_clkout(struct rsnd_priv *priv, |
5092 |
+ goto rsnd_adg_get_clkout_end; |
5093 |
+ |
5094 |
+ req_size = prop->length / sizeof(u32); |
5095 |
++ if (req_size > REQ_SIZE) { |
5096 |
++ dev_err(dev, |
5097 |
++ "too many clock-frequency, use top %d\n", REQ_SIZE); |
5098 |
++ req_size = REQ_SIZE; |
5099 |
++ } |
5100 |
+ |
5101 |
+ of_property_read_u32_array(np, "clock-frequency", req_rate, req_size); |
5102 |
+ req_48kHz_rate = 0; |
5103 |
+diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c |
5104 |
+index ff13189a7ee4..982a72e73ea9 100644 |
5105 |
+--- a/sound/soc/sh/rcar/core.c |
5106 |
++++ b/sound/soc/sh/rcar/core.c |
5107 |
+@@ -482,7 +482,7 @@ static int rsnd_status_update(u32 *status, |
5108 |
+ (func_call && (mod)->ops->fn) ? #fn : ""); \ |
5109 |
+ if (func_call && (mod)->ops->fn) \ |
5110 |
+ tmp = (mod)->ops->fn(mod, io, param); \ |
5111 |
+- if (tmp) \ |
5112 |
++ if (tmp && (tmp != -EPROBE_DEFER)) \ |
5113 |
+ dev_err(dev, "%s[%d] : %s error %d\n", \ |
5114 |
+ rsnd_mod_name(mod), rsnd_mod_id(mod), \ |
5115 |
+ #fn, tmp); \ |
5116 |
+@@ -1550,6 +1550,14 @@ exit_snd_probe: |
5117 |
+ rsnd_dai_call(remove, &rdai->capture, priv); |
5118 |
+ } |
5119 |
+ |
5120 |
++ /* |
5121 |
++ * adg is very special mod which can't use rsnd_dai_call(remove), |
5122 |
++ * and it registers ADG clock on probe. |
5123 |
++ * It should be unregister if probe failed. |
5124 |
++ * Mainly it is assuming -EPROBE_DEFER case |
5125 |
++ */ |
5126 |
++ rsnd_adg_remove(priv); |
5127 |
++ |
5128 |
+ return ret; |
5129 |
+ } |
5130 |
+ |
5131 |
+diff --git a/sound/soc/sh/rcar/dma.c b/sound/soc/sh/rcar/dma.c |
5132 |
+index ef82b94d038b..2f3f4108fda5 100644 |
5133 |
+--- a/sound/soc/sh/rcar/dma.c |
5134 |
++++ b/sound/soc/sh/rcar/dma.c |
5135 |
+@@ -244,6 +244,10 @@ static int rsnd_dmaen_attach(struct rsnd_dai_stream *io, |
5136 |
+ /* try to get DMAEngine channel */ |
5137 |
+ chan = rsnd_dmaen_request_channel(io, mod_from, mod_to); |
5138 |
+ if (IS_ERR_OR_NULL(chan)) { |
5139 |
++ /* Let's follow when -EPROBE_DEFER case */ |
5140 |
++ if (PTR_ERR(chan) == -EPROBE_DEFER) |
5141 |
++ return PTR_ERR(chan); |
5142 |
++ |
5143 |
+ /* |
5144 |
+ * DMA failed. try to PIO mode |
5145 |
+ * see |
5146 |
+diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c |
5147 |
+index 4663de3cf495..0b4896d411f9 100644 |
5148 |
+--- a/sound/soc/soc-core.c |
5149 |
++++ b/sound/soc/soc-core.c |
5150 |
+@@ -1430,7 +1430,7 @@ static int soc_link_dai_widgets(struct snd_soc_card *card, |
5151 |
+ sink = codec_dai->playback_widget; |
5152 |
+ source = cpu_dai->capture_widget; |
5153 |
+ if (sink && source) { |
5154 |
+- ret = snd_soc_dapm_new_pcm(card, dai_link->params, |
5155 |
++ ret = snd_soc_dapm_new_pcm(card, rtd, dai_link->params, |
5156 |
+ dai_link->num_params, |
5157 |
+ source, sink); |
5158 |
+ if (ret != 0) { |
5159 |
+@@ -1443,7 +1443,7 @@ static int soc_link_dai_widgets(struct snd_soc_card *card, |
5160 |
+ sink = cpu_dai->playback_widget; |
5161 |
+ source = codec_dai->capture_widget; |
5162 |
+ if (sink && source) { |
5163 |
+- ret = snd_soc_dapm_new_pcm(card, dai_link->params, |
5164 |
++ ret = snd_soc_dapm_new_pcm(card, rtd, dai_link->params, |
5165 |
+ dai_link->num_params, |
5166 |
+ source, sink); |
5167 |
+ if (ret != 0) { |
5168 |
+diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c |
5169 |
+index a099c3e45504..577f6178af57 100644 |
5170 |
+--- a/sound/soc/soc-dapm.c |
5171 |
++++ b/sound/soc/soc-dapm.c |
5172 |
+@@ -3658,6 +3658,7 @@ static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w, |
5173 |
+ { |
5174 |
+ struct snd_soc_dapm_path *source_p, *sink_p; |
5175 |
+ struct snd_soc_dai *source, *sink; |
5176 |
++ struct snd_soc_pcm_runtime *rtd = w->priv; |
5177 |
+ const struct snd_soc_pcm_stream *config = w->params + w->params_select; |
5178 |
+ struct snd_pcm_substream substream; |
5179 |
+ struct snd_pcm_hw_params *params = NULL; |
5180 |
+@@ -3717,6 +3718,7 @@ static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w, |
5181 |
+ goto out; |
5182 |
+ } |
5183 |
+ substream.runtime = runtime; |
5184 |
++ substream.private_data = rtd; |
5185 |
+ |
5186 |
+ switch (event) { |
5187 |
+ case SND_SOC_DAPM_PRE_PMU: |
5188 |
+@@ -3901,6 +3903,7 @@ outfree_w_param: |
5189 |
+ } |
5190 |
+ |
5191 |
+ int snd_soc_dapm_new_pcm(struct snd_soc_card *card, |
5192 |
++ struct snd_soc_pcm_runtime *rtd, |
5193 |
+ const struct snd_soc_pcm_stream *params, |
5194 |
+ unsigned int num_params, |
5195 |
+ struct snd_soc_dapm_widget *source, |
5196 |
+@@ -3969,6 +3972,7 @@ int snd_soc_dapm_new_pcm(struct snd_soc_card *card, |
5197 |
+ |
5198 |
+ w->params = params; |
5199 |
+ w->num_params = num_params; |
5200 |
++ w->priv = rtd; |
5201 |
+ |
5202 |
+ ret = snd_soc_dapm_add_path(&card->dapm, source, w, NULL, NULL); |
5203 |
+ if (ret) |
5204 |
+diff --git a/tools/perf/scripts/python/export-to-postgresql.py b/tools/perf/scripts/python/export-to-postgresql.py |
5205 |
+index efcaf6cac2eb..e46f51b17513 100644 |
5206 |
+--- a/tools/perf/scripts/python/export-to-postgresql.py |
5207 |
++++ b/tools/perf/scripts/python/export-to-postgresql.py |
5208 |
+@@ -204,14 +204,23 @@ from ctypes import * |
5209 |
+ libpq = CDLL("libpq.so.5") |
5210 |
+ PQconnectdb = libpq.PQconnectdb |
5211 |
+ PQconnectdb.restype = c_void_p |
5212 |
++PQconnectdb.argtypes = [ c_char_p ] |
5213 |
+ PQfinish = libpq.PQfinish |
5214 |
++PQfinish.argtypes = [ c_void_p ] |
5215 |
+ PQstatus = libpq.PQstatus |
5216 |
++PQstatus.restype = c_int |
5217 |
++PQstatus.argtypes = [ c_void_p ] |
5218 |
+ PQexec = libpq.PQexec |
5219 |
+ PQexec.restype = c_void_p |
5220 |
++PQexec.argtypes = [ c_void_p, c_char_p ] |
5221 |
+ PQresultStatus = libpq.PQresultStatus |
5222 |
++PQresultStatus.restype = c_int |
5223 |
++PQresultStatus.argtypes = [ c_void_p ] |
5224 |
+ PQputCopyData = libpq.PQputCopyData |
5225 |
++PQputCopyData.restype = c_int |
5226 |
+ PQputCopyData.argtypes = [ c_void_p, c_void_p, c_int ] |
5227 |
+ PQputCopyEnd = libpq.PQputCopyEnd |
5228 |
++PQputCopyEnd.restype = c_int |
5229 |
+ PQputCopyEnd.argtypes = [ c_void_p, c_void_p ] |
5230 |
+ |
5231 |
+ sys.path.append(os.environ['PERF_EXEC_PATH'] + \ |
5232 |
+diff --git a/tools/perf/scripts/python/export-to-sqlite.py b/tools/perf/scripts/python/export-to-sqlite.py |
5233 |
+index f827bf77e9d2..e4bb82c8aba9 100644 |
5234 |
+--- a/tools/perf/scripts/python/export-to-sqlite.py |
5235 |
++++ b/tools/perf/scripts/python/export-to-sqlite.py |
5236 |
+@@ -440,7 +440,11 @@ def branch_type_table(*x): |
5237 |
+ |
5238 |
+ def sample_table(*x): |
5239 |
+ if branches: |
5240 |
+- bind_exec(sample_query, 18, x) |
5241 |
++ for xx in x[0:15]: |
5242 |
++ sample_query.addBindValue(str(xx)) |
5243 |
++ for xx in x[19:22]: |
5244 |
++ sample_query.addBindValue(str(xx)) |
5245 |
++ do_query_(sample_query) |
5246 |
+ else: |
5247 |
+ bind_exec(sample_query, 22, x) |
5248 |
+ |
5249 |
+diff --git a/tools/testing/selftests/android/Makefile b/tools/testing/selftests/android/Makefile |
5250 |
+index 72c25a3cb658..d9a725478375 100644 |
5251 |
+--- a/tools/testing/selftests/android/Makefile |
5252 |
++++ b/tools/testing/selftests/android/Makefile |
5253 |
+@@ -6,7 +6,7 @@ TEST_PROGS := run.sh |
5254 |
+ |
5255 |
+ include ../lib.mk |
5256 |
+ |
5257 |
+-all: |
5258 |
++all: khdr |
5259 |
+ @for DIR in $(SUBDIRS); do \ |
5260 |
+ BUILD_TARGET=$(OUTPUT)/$$DIR; \ |
5261 |
+ mkdir $$BUILD_TARGET -p; \ |
5262 |
+diff --git a/tools/testing/selftests/android/config b/tools/testing/selftests/android/config |
5263 |
+new file mode 100644 |
5264 |
+index 000000000000..b4ad748a9dd9 |
5265 |
+--- /dev/null |
5266 |
++++ b/tools/testing/selftests/android/config |
5267 |
+@@ -0,0 +1,5 @@ |
5268 |
++CONFIG_ANDROID=y |
5269 |
++CONFIG_STAGING=y |
5270 |
++CONFIG_ION=y |
5271 |
++CONFIG_ION_SYSTEM_HEAP=y |
5272 |
++CONFIG_DRM_VGEM=y |
5273 |
+diff --git a/tools/testing/selftests/android/ion/Makefile b/tools/testing/selftests/android/ion/Makefile |
5274 |
+index e03695287f76..88cfe88e466f 100644 |
5275 |
+--- a/tools/testing/selftests/android/ion/Makefile |
5276 |
++++ b/tools/testing/selftests/android/ion/Makefile |
5277 |
+@@ -10,6 +10,8 @@ $(TEST_GEN_FILES): ipcsocket.c ionutils.c |
5278 |
+ |
5279 |
+ TEST_PROGS := ion_test.sh |
5280 |
+ |
5281 |
++KSFT_KHDR_INSTALL := 1 |
5282 |
++top_srcdir = ../../../../.. |
5283 |
+ include ../../lib.mk |
5284 |
+ |
5285 |
+ $(OUTPUT)/ionapp_export: ionapp_export.c ipcsocket.c ionutils.c |
5286 |
+diff --git a/tools/testing/selftests/android/ion/config b/tools/testing/selftests/android/ion/config |
5287 |
+deleted file mode 100644 |
5288 |
+index b4ad748a9dd9..000000000000 |
5289 |
+--- a/tools/testing/selftests/android/ion/config |
5290 |
++++ /dev/null |
5291 |
+@@ -1,5 +0,0 @@ |
5292 |
+-CONFIG_ANDROID=y |
5293 |
+-CONFIG_STAGING=y |
5294 |
+-CONFIG_ION=y |
5295 |
+-CONFIG_ION_SYSTEM_HEAP=y |
5296 |
+-CONFIG_DRM_VGEM=y |
5297 |
+diff --git a/tools/testing/selftests/cgroup/cgroup_util.c b/tools/testing/selftests/cgroup/cgroup_util.c |
5298 |
+index 1e9e3c470561..8b644ea39725 100644 |
5299 |
+--- a/tools/testing/selftests/cgroup/cgroup_util.c |
5300 |
++++ b/tools/testing/selftests/cgroup/cgroup_util.c |
5301 |
+@@ -89,17 +89,28 @@ int cg_read(const char *cgroup, const char *control, char *buf, size_t len) |
5302 |
+ int cg_read_strcmp(const char *cgroup, const char *control, |
5303 |
+ const char *expected) |
5304 |
+ { |
5305 |
+- size_t size = strlen(expected) + 1; |
5306 |
++ size_t size; |
5307 |
+ char *buf; |
5308 |
++ int ret; |
5309 |
++ |
5310 |
++ /* Handle the case of comparing against empty string */ |
5311 |
++ if (!expected) |
5312 |
++ size = 32; |
5313 |
++ else |
5314 |
++ size = strlen(expected) + 1; |
5315 |
+ |
5316 |
+ buf = malloc(size); |
5317 |
+ if (!buf) |
5318 |
+ return -1; |
5319 |
+ |
5320 |
+- if (cg_read(cgroup, control, buf, size)) |
5321 |
++ if (cg_read(cgroup, control, buf, size)) { |
5322 |
++ free(buf); |
5323 |
+ return -1; |
5324 |
++ } |
5325 |
+ |
5326 |
+- return strcmp(expected, buf); |
5327 |
++ ret = strcmp(expected, buf); |
5328 |
++ free(buf); |
5329 |
++ return ret; |
5330 |
+ } |
5331 |
+ |
5332 |
+ int cg_read_strstr(const char *cgroup, const char *control, const char *needle) |
5333 |
+diff --git a/tools/testing/selftests/efivarfs/config b/tools/testing/selftests/efivarfs/config |
5334 |
+new file mode 100644 |
5335 |
+index 000000000000..4e151f1005b2 |
5336 |
+--- /dev/null |
5337 |
++++ b/tools/testing/selftests/efivarfs/config |
5338 |
+@@ -0,0 +1 @@ |
5339 |
++CONFIG_EFIVAR_FS=y |
5340 |
+diff --git a/tools/testing/selftests/futex/functional/Makefile b/tools/testing/selftests/futex/functional/Makefile |
5341 |
+index ff8feca49746..ad1eeb14fda7 100644 |
5342 |
+--- a/tools/testing/selftests/futex/functional/Makefile |
5343 |
++++ b/tools/testing/selftests/futex/functional/Makefile |
5344 |
+@@ -18,6 +18,7 @@ TEST_GEN_FILES := \ |
5345 |
+ |
5346 |
+ TEST_PROGS := run.sh |
5347 |
+ |
5348 |
++top_srcdir = ../../../../.. |
5349 |
+ include ../../lib.mk |
5350 |
+ |
5351 |
+ $(TEST_GEN_FILES): $(HEADERS) |
5352 |
+diff --git a/tools/testing/selftests/gpio/Makefile b/tools/testing/selftests/gpio/Makefile |
5353 |
+index 1bbb47565c55..4665cdbf1a8d 100644 |
5354 |
+--- a/tools/testing/selftests/gpio/Makefile |
5355 |
++++ b/tools/testing/selftests/gpio/Makefile |
5356 |
+@@ -21,11 +21,8 @@ endef |
5357 |
+ CFLAGS += -O2 -g -std=gnu99 -Wall -I../../../../usr/include/ |
5358 |
+ LDLIBS += -lmount -I/usr/include/libmount |
5359 |
+ |
5360 |
+-$(BINARIES): ../../../gpio/gpio-utils.o ../../../../usr/include/linux/gpio.h |
5361 |
++$(BINARIES):| khdr |
5362 |
++$(BINARIES): ../../../gpio/gpio-utils.o |
5363 |
+ |
5364 |
+ ../../../gpio/gpio-utils.o: |
5365 |
+ make ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) -C ../../../gpio |
5366 |
+- |
5367 |
+-../../../../usr/include/linux/gpio.h: |
5368 |
+- make -C ../../../.. headers_install INSTALL_HDR_PATH=$(shell pwd)/../../../../usr/ |
5369 |
+- |
5370 |
+diff --git a/tools/testing/selftests/kselftest.h b/tools/testing/selftests/kselftest.h |
5371 |
+index 15e6b75fc3a5..a3edb2c8e43d 100644 |
5372 |
+--- a/tools/testing/selftests/kselftest.h |
5373 |
++++ b/tools/testing/selftests/kselftest.h |
5374 |
+@@ -19,7 +19,6 @@ |
5375 |
+ #define KSFT_FAIL 1 |
5376 |
+ #define KSFT_XFAIL 2 |
5377 |
+ #define KSFT_XPASS 3 |
5378 |
+-/* Treat skip as pass */ |
5379 |
+ #define KSFT_SKIP 4 |
5380 |
+ |
5381 |
+ /* counters */ |
5382 |
+diff --git a/tools/testing/selftests/kvm/Makefile b/tools/testing/selftests/kvm/Makefile |
5383 |
+index d9d00319b07c..bcb69380bbab 100644 |
5384 |
+--- a/tools/testing/selftests/kvm/Makefile |
5385 |
++++ b/tools/testing/selftests/kvm/Makefile |
5386 |
+@@ -32,9 +32,6 @@ $(LIBKVM_OBJ): $(OUTPUT)/%.o: %.c |
5387 |
+ $(OUTPUT)/libkvm.a: $(LIBKVM_OBJ) |
5388 |
+ $(AR) crs $@ $^ |
5389 |
+ |
5390 |
+-$(LINUX_HDR_PATH): |
5391 |
+- make -C $(top_srcdir) headers_install |
5392 |
+- |
5393 |
+-all: $(STATIC_LIBS) $(LINUX_HDR_PATH) |
5394 |
++all: $(STATIC_LIBS) |
5395 |
+ $(TEST_GEN_PROGS): $(STATIC_LIBS) |
5396 |
+-$(TEST_GEN_PROGS) $(LIBKVM_OBJ): | $(LINUX_HDR_PATH) |
5397 |
++$(STATIC_LIBS):| khdr |
5398 |
+diff --git a/tools/testing/selftests/lib.mk b/tools/testing/selftests/lib.mk |
5399 |
+index 17ab36605a8e..0a8e75886224 100644 |
5400 |
+--- a/tools/testing/selftests/lib.mk |
5401 |
++++ b/tools/testing/selftests/lib.mk |
5402 |
+@@ -16,8 +16,20 @@ TEST_GEN_PROGS := $(patsubst %,$(OUTPUT)/%,$(TEST_GEN_PROGS)) |
5403 |
+ TEST_GEN_PROGS_EXTENDED := $(patsubst %,$(OUTPUT)/%,$(TEST_GEN_PROGS_EXTENDED)) |
5404 |
+ TEST_GEN_FILES := $(patsubst %,$(OUTPUT)/%,$(TEST_GEN_FILES)) |
5405 |
+ |
5406 |
++top_srcdir ?= ../../../.. |
5407 |
++include $(top_srcdir)/scripts/subarch.include |
5408 |
++ARCH ?= $(SUBARCH) |
5409 |
++ |
5410 |
+ all: $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES) |
5411 |
+ |
5412 |
++.PHONY: khdr |
5413 |
++khdr: |
5414 |
++ make ARCH=$(ARCH) -C $(top_srcdir) headers_install |
5415 |
++ |
5416 |
++ifdef KSFT_KHDR_INSTALL |
5417 |
++$(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES):| khdr |
5418 |
++endif |
5419 |
++ |
5420 |
+ .ONESHELL: |
5421 |
+ define RUN_TEST_PRINT_RESULT |
5422 |
+ TEST_HDR_MSG="selftests: "`basename $$PWD`:" $$BASENAME_TEST"; \ |
5423 |
+diff --git a/tools/testing/selftests/memory-hotplug/config b/tools/testing/selftests/memory-hotplug/config |
5424 |
+index 2fde30191a47..a7e8cd5bb265 100644 |
5425 |
+--- a/tools/testing/selftests/memory-hotplug/config |
5426 |
++++ b/tools/testing/selftests/memory-hotplug/config |
5427 |
+@@ -2,3 +2,4 @@ CONFIG_MEMORY_HOTPLUG=y |
5428 |
+ CONFIG_MEMORY_HOTPLUG_SPARSE=y |
5429 |
+ CONFIG_NOTIFIER_ERROR_INJECTION=y |
5430 |
+ CONFIG_MEMORY_NOTIFIER_ERROR_INJECT=m |
5431 |
++CONFIG_MEMORY_HOTREMOVE=y |
5432 |
+diff --git a/tools/testing/selftests/net/Makefile b/tools/testing/selftests/net/Makefile |
5433 |
+index 663e11e85727..d515dabc6b0d 100644 |
5434 |
+--- a/tools/testing/selftests/net/Makefile |
5435 |
++++ b/tools/testing/selftests/net/Makefile |
5436 |
+@@ -15,6 +15,7 @@ TEST_GEN_FILES += udpgso udpgso_bench_tx udpgso_bench_rx |
5437 |
+ TEST_GEN_PROGS = reuseport_bpf reuseport_bpf_cpu reuseport_bpf_numa |
5438 |
+ TEST_GEN_PROGS += reuseport_dualstack reuseaddr_conflict |
5439 |
+ |
5440 |
++KSFT_KHDR_INSTALL := 1 |
5441 |
+ include ../lib.mk |
5442 |
+ |
5443 |
+ $(OUTPUT)/reuseport_bpf_numa: LDFLAGS += -lnuma |
5444 |
+diff --git a/tools/testing/selftests/networking/timestamping/Makefile b/tools/testing/selftests/networking/timestamping/Makefile |
5445 |
+index a728040edbe1..14cfcf006936 100644 |
5446 |
+--- a/tools/testing/selftests/networking/timestamping/Makefile |
5447 |
++++ b/tools/testing/selftests/networking/timestamping/Makefile |
5448 |
+@@ -5,6 +5,7 @@ TEST_PROGS := hwtstamp_config rxtimestamp timestamping txtimestamp |
5449 |
+ |
5450 |
+ all: $(TEST_PROGS) |
5451 |
+ |
5452 |
++top_srcdir = ../../../../.. |
5453 |
+ include ../../lib.mk |
5454 |
+ |
5455 |
+ clean: |
5456 |
+diff --git a/tools/testing/selftests/vm/Makefile b/tools/testing/selftests/vm/Makefile |
5457 |
+index fdefa2295ddc..58759454b1d0 100644 |
5458 |
+--- a/tools/testing/selftests/vm/Makefile |
5459 |
++++ b/tools/testing/selftests/vm/Makefile |
5460 |
+@@ -25,10 +25,6 @@ TEST_PROGS := run_vmtests |
5461 |
+ |
5462 |
+ include ../lib.mk |
5463 |
+ |
5464 |
+-$(OUTPUT)/userfaultfd: ../../../../usr/include/linux/kernel.h |
5465 |
+ $(OUTPUT)/userfaultfd: LDLIBS += -lpthread |
5466 |
+ |
5467 |
+ $(OUTPUT)/mlock-random-test: LDLIBS += -lcap |
5468 |
+- |
5469 |
+-../../../../usr/include/linux/kernel.h: |
5470 |
+- make -C ../../../.. headers_install |