1 |
commit: a8972d12a3023216e8add6169fe295c303c10b3a |
2 |
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
3 |
AuthorDate: Thu Oct 18 10:26:19 2018 +0000 |
4 |
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Oct 18 10:26:19 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=a8972d12 |
7 |
|
8 |
Linux patch 4.14.77 |
9 |
|
10 |
Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org> |
11 |
|
12 |
0000_README | 4 + |
13 |
1076_linux-4.14.77.patch | 4677 ++++++++++++++++++++++++++++++++++++++++++++++ |
14 |
2 files changed, 4681 insertions(+) |
15 |
|
16 |
diff --git a/0000_README b/0000_README |
17 |
index 7d1d7b6..832ddd2 100644 |
18 |
--- a/0000_README |
19 |
+++ b/0000_README |
20 |
@@ -347,6 +347,10 @@ Patch: 1075_linux-4.14.76.patch |
21 |
From: http://www.kernel.org |
22 |
Desc: Linux 4.14.76 |
23 |
|
24 |
+Patch: 1076_linux-4.14.77.patch |
25 |
+From: http://www.kernel.org |
26 |
+Desc: Linux 4.14.77 |
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/1076_linux-4.14.77.patch b/1076_linux-4.14.77.patch |
33 |
new file mode 100644 |
34 |
index 0000000..da92940 |
35 |
--- /dev/null |
36 |
+++ b/1076_linux-4.14.77.patch |
37 |
@@ -0,0 +1,4677 @@ |
38 |
+diff --git a/Documentation/devicetree/bindings/net/macb.txt b/Documentation/devicetree/bindings/net/macb.txt |
39 |
+index 27966ae741e0..141d8c1f714f 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 332dd011b3b9..16d1a18496fb 100644 |
52 |
+--- a/Makefile |
53 |
++++ b/Makefile |
54 |
+@@ -1,7 +1,7 @@ |
55 |
+ # SPDX-License-Identifier: GPL-2.0 |
56 |
+ VERSION = 4 |
57 |
+ PATCHLEVEL = 14 |
58 |
+-SUBLEVEL = 76 |
59 |
++SUBLEVEL = 77 |
60 |
+ EXTRAVERSION = |
61 |
+ NAME = Petit Gorille |
62 |
+ |
63 |
+diff --git a/arch/arm/boot/dts/sama5d3_emac.dtsi b/arch/arm/boot/dts/sama5d3_emac.dtsi |
64 |
+index 7cb235ef0fb6..6e9e1c2f9def 100644 |
65 |
+--- a/arch/arm/boot/dts/sama5d3_emac.dtsi |
66 |
++++ b/arch/arm/boot/dts/sama5d3_emac.dtsi |
67 |
+@@ -41,7 +41,7 @@ |
68 |
+ }; |
69 |
+ |
70 |
+ macb1: ethernet@f802c000 { |
71 |
+- compatible = "cdns,at91sam9260-macb", "cdns,macb"; |
72 |
++ compatible = "atmel,sama5d3-macb", "cdns,at91sam9260-macb", "cdns,macb"; |
73 |
+ reg = <0xf802c000 0x100>; |
74 |
+ interrupts = <35 IRQ_TYPE_LEVEL_HIGH 3>; |
75 |
+ pinctrl-names = "default"; |
76 |
+diff --git a/arch/arm/include/asm/assembler.h b/arch/arm/include/asm/assembler.h |
77 |
+index 9342904cccca..b17ee03d280b 100644 |
78 |
+--- a/arch/arm/include/asm/assembler.h |
79 |
++++ b/arch/arm/include/asm/assembler.h |
80 |
+@@ -447,11 +447,23 @@ THUMB( orr \reg , \reg , #PSR_T_BIT ) |
81 |
+ .size \name , . - \name |
82 |
+ .endm |
83 |
+ |
84 |
++ .macro csdb |
85 |
++#ifdef CONFIG_THUMB2_KERNEL |
86 |
++ .inst.w 0xf3af8014 |
87 |
++#else |
88 |
++ .inst 0xe320f014 |
89 |
++#endif |
90 |
++ .endm |
91 |
++ |
92 |
+ .macro check_uaccess, addr:req, size:req, limit:req, tmp:req, bad:req |
93 |
+ #ifndef CONFIG_CPU_USE_DOMAINS |
94 |
+ adds \tmp, \addr, #\size - 1 |
95 |
+ sbcccs \tmp, \tmp, \limit |
96 |
+ bcs \bad |
97 |
++#ifdef CONFIG_CPU_SPECTRE |
98 |
++ movcs \addr, #0 |
99 |
++ csdb |
100 |
++#endif |
101 |
+ #endif |
102 |
+ .endm |
103 |
+ |
104 |
+diff --git a/arch/arm/include/asm/barrier.h b/arch/arm/include/asm/barrier.h |
105 |
+index 40f5c410fd8c..69772e742a0a 100644 |
106 |
+--- a/arch/arm/include/asm/barrier.h |
107 |
++++ b/arch/arm/include/asm/barrier.h |
108 |
+@@ -17,6 +17,12 @@ |
109 |
+ #define isb(option) __asm__ __volatile__ ("isb " #option : : : "memory") |
110 |
+ #define dsb(option) __asm__ __volatile__ ("dsb " #option : : : "memory") |
111 |
+ #define dmb(option) __asm__ __volatile__ ("dmb " #option : : : "memory") |
112 |
++#ifdef CONFIG_THUMB2_KERNEL |
113 |
++#define CSDB ".inst.w 0xf3af8014" |
114 |
++#else |
115 |
++#define CSDB ".inst 0xe320f014" |
116 |
++#endif |
117 |
++#define csdb() __asm__ __volatile__(CSDB : : : "memory") |
118 |
+ #elif defined(CONFIG_CPU_XSC3) || __LINUX_ARM_ARCH__ == 6 |
119 |
+ #define isb(x) __asm__ __volatile__ ("mcr p15, 0, %0, c7, c5, 4" \ |
120 |
+ : : "r" (0) : "memory") |
121 |
+@@ -37,6 +43,13 @@ |
122 |
+ #define dmb(x) __asm__ __volatile__ ("" : : : "memory") |
123 |
+ #endif |
124 |
+ |
125 |
++#ifndef CSDB |
126 |
++#define CSDB |
127 |
++#endif |
128 |
++#ifndef csdb |
129 |
++#define csdb() |
130 |
++#endif |
131 |
++ |
132 |
+ #ifdef CONFIG_ARM_HEAVY_MB |
133 |
+ extern void (*soc_mb)(void); |
134 |
+ extern void arm_heavy_mb(void); |
135 |
+@@ -63,6 +76,25 @@ extern void arm_heavy_mb(void); |
136 |
+ #define __smp_rmb() __smp_mb() |
137 |
+ #define __smp_wmb() dmb(ishst) |
138 |
+ |
139 |
++#ifdef CONFIG_CPU_SPECTRE |
140 |
++static inline unsigned long array_index_mask_nospec(unsigned long idx, |
141 |
++ unsigned long sz) |
142 |
++{ |
143 |
++ unsigned long mask; |
144 |
++ |
145 |
++ asm volatile( |
146 |
++ "cmp %1, %2\n" |
147 |
++ " sbc %0, %1, %1\n" |
148 |
++ CSDB |
149 |
++ : "=r" (mask) |
150 |
++ : "r" (idx), "Ir" (sz) |
151 |
++ : "cc"); |
152 |
++ |
153 |
++ return mask; |
154 |
++} |
155 |
++#define array_index_mask_nospec array_index_mask_nospec |
156 |
++#endif |
157 |
++ |
158 |
+ #include <asm-generic/barrier.h> |
159 |
+ |
160 |
+ #endif /* !__ASSEMBLY__ */ |
161 |
+diff --git a/arch/arm/include/asm/bugs.h b/arch/arm/include/asm/bugs.h |
162 |
+index a97f1ea708d1..73a99c72a930 100644 |
163 |
+--- a/arch/arm/include/asm/bugs.h |
164 |
++++ b/arch/arm/include/asm/bugs.h |
165 |
+@@ -10,12 +10,14 @@ |
166 |
+ #ifndef __ASM_BUGS_H |
167 |
+ #define __ASM_BUGS_H |
168 |
+ |
169 |
+-#ifdef CONFIG_MMU |
170 |
+ extern void check_writebuffer_bugs(void); |
171 |
+ |
172 |
+-#define check_bugs() check_writebuffer_bugs() |
173 |
++#ifdef CONFIG_MMU |
174 |
++extern void check_bugs(void); |
175 |
++extern void check_other_bugs(void); |
176 |
+ #else |
177 |
+ #define check_bugs() do { } while (0) |
178 |
++#define check_other_bugs() do { } while (0) |
179 |
+ #endif |
180 |
+ |
181 |
+ #endif |
182 |
+diff --git a/arch/arm/include/asm/cp15.h b/arch/arm/include/asm/cp15.h |
183 |
+index 4c9fa72b59f5..07e27f212dc7 100644 |
184 |
+--- a/arch/arm/include/asm/cp15.h |
185 |
++++ b/arch/arm/include/asm/cp15.h |
186 |
+@@ -65,6 +65,9 @@ |
187 |
+ #define __write_sysreg(v, r, w, c, t) asm volatile(w " " c : : "r" ((t)(v))) |
188 |
+ #define write_sysreg(v, ...) __write_sysreg(v, __VA_ARGS__) |
189 |
+ |
190 |
++#define BPIALL __ACCESS_CP15(c7, 0, c5, 6) |
191 |
++#define ICIALLU __ACCESS_CP15(c7, 0, c5, 0) |
192 |
++ |
193 |
+ extern unsigned long cr_alignment; /* defined in entry-armv.S */ |
194 |
+ |
195 |
+ static inline unsigned long get_cr(void) |
196 |
+diff --git a/arch/arm/include/asm/cputype.h b/arch/arm/include/asm/cputype.h |
197 |
+index 441933311bbf..3379c2c684c2 100644 |
198 |
+--- a/arch/arm/include/asm/cputype.h |
199 |
++++ b/arch/arm/include/asm/cputype.h |
200 |
+@@ -77,8 +77,16 @@ |
201 |
+ #define ARM_CPU_PART_CORTEX_A12 0x4100c0d0 |
202 |
+ #define ARM_CPU_PART_CORTEX_A17 0x4100c0e0 |
203 |
+ #define ARM_CPU_PART_CORTEX_A15 0x4100c0f0 |
204 |
++#define ARM_CPU_PART_CORTEX_A53 0x4100d030 |
205 |
++#define ARM_CPU_PART_CORTEX_A57 0x4100d070 |
206 |
++#define ARM_CPU_PART_CORTEX_A72 0x4100d080 |
207 |
++#define ARM_CPU_PART_CORTEX_A73 0x4100d090 |
208 |
++#define ARM_CPU_PART_CORTEX_A75 0x4100d0a0 |
209 |
+ #define ARM_CPU_PART_MASK 0xff00fff0 |
210 |
+ |
211 |
++/* Broadcom cores */ |
212 |
++#define ARM_CPU_PART_BRAHMA_B15 0x420000f0 |
213 |
++ |
214 |
+ /* DEC implemented cores */ |
215 |
+ #define ARM_CPU_PART_SA1100 0x4400a110 |
216 |
+ |
217 |
+diff --git a/arch/arm/include/asm/kvm_asm.h b/arch/arm/include/asm/kvm_asm.h |
218 |
+index 14d68a4d826f..b598e666da4c 100644 |
219 |
+--- a/arch/arm/include/asm/kvm_asm.h |
220 |
++++ b/arch/arm/include/asm/kvm_asm.h |
221 |
+@@ -61,8 +61,6 @@ struct kvm_vcpu; |
222 |
+ extern char __kvm_hyp_init[]; |
223 |
+ extern char __kvm_hyp_init_end[]; |
224 |
+ |
225 |
+-extern char __kvm_hyp_vector[]; |
226 |
+- |
227 |
+ extern void __kvm_flush_vm_context(void); |
228 |
+ extern void __kvm_tlb_flush_vmid_ipa(struct kvm *kvm, phys_addr_t ipa); |
229 |
+ extern void __kvm_tlb_flush_vmid(struct kvm *kvm); |
230 |
+diff --git a/arch/arm/include/asm/kvm_host.h b/arch/arm/include/asm/kvm_host.h |
231 |
+index 65572e14306c..b60232639984 100644 |
232 |
+--- a/arch/arm/include/asm/kvm_host.h |
233 |
++++ b/arch/arm/include/asm/kvm_host.h |
234 |
+@@ -21,6 +21,7 @@ |
235 |
+ |
236 |
+ #include <linux/types.h> |
237 |
+ #include <linux/kvm_types.h> |
238 |
++#include <asm/cputype.h> |
239 |
+ #include <asm/kvm.h> |
240 |
+ #include <asm/kvm_asm.h> |
241 |
+ #include <asm/kvm_mmio.h> |
242 |
+@@ -298,8 +299,17 @@ int kvm_arm_vcpu_arch_has_attr(struct kvm_vcpu *vcpu, |
243 |
+ |
244 |
+ static inline bool kvm_arm_harden_branch_predictor(void) |
245 |
+ { |
246 |
+- /* No way to detect it yet, pretend it is not there. */ |
247 |
+- return false; |
248 |
++ switch(read_cpuid_part()) { |
249 |
++#ifdef CONFIG_HARDEN_BRANCH_PREDICTOR |
250 |
++ case ARM_CPU_PART_BRAHMA_B15: |
251 |
++ case ARM_CPU_PART_CORTEX_A12: |
252 |
++ case ARM_CPU_PART_CORTEX_A15: |
253 |
++ case ARM_CPU_PART_CORTEX_A17: |
254 |
++ return true; |
255 |
++#endif |
256 |
++ default: |
257 |
++ return false; |
258 |
++ } |
259 |
+ } |
260 |
+ |
261 |
+ #define KVM_SSBD_UNKNOWN -1 |
262 |
+diff --git a/arch/arm/include/asm/kvm_mmu.h b/arch/arm/include/asm/kvm_mmu.h |
263 |
+index 8a098e65f5f8..ca62f95f3b4c 100644 |
264 |
+--- a/arch/arm/include/asm/kvm_mmu.h |
265 |
++++ b/arch/arm/include/asm/kvm_mmu.h |
266 |
+@@ -246,7 +246,28 @@ static inline int kvm_read_guest_lock(struct kvm *kvm, |
267 |
+ |
268 |
+ static inline void *kvm_get_hyp_vector(void) |
269 |
+ { |
270 |
+- return kvm_ksym_ref(__kvm_hyp_vector); |
271 |
++ switch(read_cpuid_part()) { |
272 |
++#ifdef CONFIG_HARDEN_BRANCH_PREDICTOR |
273 |
++ case ARM_CPU_PART_CORTEX_A12: |
274 |
++ case ARM_CPU_PART_CORTEX_A17: |
275 |
++ { |
276 |
++ extern char __kvm_hyp_vector_bp_inv[]; |
277 |
++ return kvm_ksym_ref(__kvm_hyp_vector_bp_inv); |
278 |
++ } |
279 |
++ |
280 |
++ case ARM_CPU_PART_BRAHMA_B15: |
281 |
++ case ARM_CPU_PART_CORTEX_A15: |
282 |
++ { |
283 |
++ extern char __kvm_hyp_vector_ic_inv[]; |
284 |
++ return kvm_ksym_ref(__kvm_hyp_vector_ic_inv); |
285 |
++ } |
286 |
++#endif |
287 |
++ default: |
288 |
++ { |
289 |
++ extern char __kvm_hyp_vector[]; |
290 |
++ return kvm_ksym_ref(__kvm_hyp_vector); |
291 |
++ } |
292 |
++ } |
293 |
+ } |
294 |
+ |
295 |
+ static inline int kvm_map_vectors(void) |
296 |
+diff --git a/arch/arm/include/asm/proc-fns.h b/arch/arm/include/asm/proc-fns.h |
297 |
+index f2e1af45bd6f..e25f4392e1b2 100644 |
298 |
+--- a/arch/arm/include/asm/proc-fns.h |
299 |
++++ b/arch/arm/include/asm/proc-fns.h |
300 |
+@@ -36,6 +36,10 @@ extern struct processor { |
301 |
+ * Set up any processor specifics |
302 |
+ */ |
303 |
+ void (*_proc_init)(void); |
304 |
++ /* |
305 |
++ * Check for processor bugs |
306 |
++ */ |
307 |
++ void (*check_bugs)(void); |
308 |
+ /* |
309 |
+ * Disable any processor specifics |
310 |
+ */ |
311 |
+diff --git a/arch/arm/include/asm/system_misc.h b/arch/arm/include/asm/system_misc.h |
312 |
+index 78f6db114faf..8e76db83c498 100644 |
313 |
+--- a/arch/arm/include/asm/system_misc.h |
314 |
++++ b/arch/arm/include/asm/system_misc.h |
315 |
+@@ -8,6 +8,7 @@ |
316 |
+ #include <linux/linkage.h> |
317 |
+ #include <linux/irqflags.h> |
318 |
+ #include <linux/reboot.h> |
319 |
++#include <linux/percpu.h> |
320 |
+ |
321 |
+ extern void cpu_init(void); |
322 |
+ |
323 |
+@@ -15,6 +16,20 @@ void soft_restart(unsigned long); |
324 |
+ extern void (*arm_pm_restart)(enum reboot_mode reboot_mode, const char *cmd); |
325 |
+ extern void (*arm_pm_idle)(void); |
326 |
+ |
327 |
++#ifdef CONFIG_HARDEN_BRANCH_PREDICTOR |
328 |
++typedef void (*harden_branch_predictor_fn_t)(void); |
329 |
++DECLARE_PER_CPU(harden_branch_predictor_fn_t, harden_branch_predictor_fn); |
330 |
++static inline void harden_branch_predictor(void) |
331 |
++{ |
332 |
++ harden_branch_predictor_fn_t fn = per_cpu(harden_branch_predictor_fn, |
333 |
++ smp_processor_id()); |
334 |
++ if (fn) |
335 |
++ fn(); |
336 |
++} |
337 |
++#else |
338 |
++#define harden_branch_predictor() do { } while (0) |
339 |
++#endif |
340 |
++ |
341 |
+ #define UDBG_UNDEFINED (1 << 0) |
342 |
+ #define UDBG_SYSCALL (1 << 1) |
343 |
+ #define UDBG_BADABORT (1 << 2) |
344 |
+diff --git a/arch/arm/include/asm/thread_info.h b/arch/arm/include/asm/thread_info.h |
345 |
+index 776757d1604a..57d2ad9c75ca 100644 |
346 |
+--- a/arch/arm/include/asm/thread_info.h |
347 |
++++ b/arch/arm/include/asm/thread_info.h |
348 |
+@@ -126,8 +126,8 @@ struct user_vfp_exc; |
349 |
+ |
350 |
+ extern int vfp_preserve_user_clear_hwstate(struct user_vfp __user *, |
351 |
+ struct user_vfp_exc __user *); |
352 |
+-extern int vfp_restore_user_hwstate(struct user_vfp __user *, |
353 |
+- struct user_vfp_exc __user *); |
354 |
++extern int vfp_restore_user_hwstate(struct user_vfp *, |
355 |
++ struct user_vfp_exc *); |
356 |
+ #endif |
357 |
+ |
358 |
+ /* |
359 |
+diff --git a/arch/arm/include/asm/uaccess.h b/arch/arm/include/asm/uaccess.h |
360 |
+index 0bf2347495f1..4140be431087 100644 |
361 |
+--- a/arch/arm/include/asm/uaccess.h |
362 |
++++ b/arch/arm/include/asm/uaccess.h |
363 |
+@@ -84,6 +84,13 @@ static inline void set_fs(mm_segment_t fs) |
364 |
+ : "cc"); \ |
365 |
+ flag; }) |
366 |
+ |
367 |
++/* |
368 |
++ * This is a type: either unsigned long, if the argument fits into |
369 |
++ * that type, or otherwise unsigned long long. |
370 |
++ */ |
371 |
++#define __inttype(x) \ |
372 |
++ __typeof__(__builtin_choose_expr(sizeof(x) > sizeof(0UL), 0ULL, 0UL)) |
373 |
++ |
374 |
+ /* |
375 |
+ * Single-value transfer routines. They automatically use the right |
376 |
+ * size if we just have the right pointer type. Note that the functions |
377 |
+@@ -153,7 +160,7 @@ extern int __get_user_64t_4(void *); |
378 |
+ ({ \ |
379 |
+ unsigned long __limit = current_thread_info()->addr_limit - 1; \ |
380 |
+ register const typeof(*(p)) __user *__p asm("r0") = (p);\ |
381 |
+- register typeof(x) __r2 asm("r2"); \ |
382 |
++ register __inttype(x) __r2 asm("r2"); \ |
383 |
+ register unsigned long __l asm("r1") = __limit; \ |
384 |
+ register int __e asm("r0"); \ |
385 |
+ unsigned int __ua_flags = uaccess_save_and_enable(); \ |
386 |
+@@ -243,6 +250,16 @@ static inline void set_fs(mm_segment_t fs) |
387 |
+ #define user_addr_max() \ |
388 |
+ (uaccess_kernel() ? ~0UL : get_fs()) |
389 |
+ |
390 |
++#ifdef CONFIG_CPU_SPECTRE |
391 |
++/* |
392 |
++ * When mitigating Spectre variant 1, it is not worth fixing the non- |
393 |
++ * verifying accessors, because we need to add verification of the |
394 |
++ * address space there. Force these to use the standard get_user() |
395 |
++ * version instead. |
396 |
++ */ |
397 |
++#define __get_user(x, ptr) get_user(x, ptr) |
398 |
++#else |
399 |
++ |
400 |
+ /* |
401 |
+ * The "__xxx" versions of the user access functions do not verify the |
402 |
+ * address space - it must have been done previously with a separate |
403 |
+@@ -259,12 +276,6 @@ static inline void set_fs(mm_segment_t fs) |
404 |
+ __gu_err; \ |
405 |
+ }) |
406 |
+ |
407 |
+-#define __get_user_error(x, ptr, err) \ |
408 |
+-({ \ |
409 |
+- __get_user_err((x), (ptr), err); \ |
410 |
+- (void) 0; \ |
411 |
+-}) |
412 |
+- |
413 |
+ #define __get_user_err(x, ptr, err) \ |
414 |
+ do { \ |
415 |
+ unsigned long __gu_addr = (unsigned long)(ptr); \ |
416 |
+@@ -324,6 +335,7 @@ do { \ |
417 |
+ |
418 |
+ #define __get_user_asm_word(x, addr, err) \ |
419 |
+ __get_user_asm(x, addr, err, ldr) |
420 |
++#endif |
421 |
+ |
422 |
+ |
423 |
+ #define __put_user_switch(x, ptr, __err, __fn) \ |
424 |
+diff --git a/arch/arm/kernel/Makefile b/arch/arm/kernel/Makefile |
425 |
+index 499f978fb1fd..50de918252b7 100644 |
426 |
+--- a/arch/arm/kernel/Makefile |
427 |
++++ b/arch/arm/kernel/Makefile |
428 |
+@@ -31,6 +31,7 @@ else |
429 |
+ obj-y += entry-armv.o |
430 |
+ endif |
431 |
+ |
432 |
++obj-$(CONFIG_MMU) += bugs.o |
433 |
+ obj-$(CONFIG_CPU_IDLE) += cpuidle.o |
434 |
+ obj-$(CONFIG_ISA_DMA_API) += dma.o |
435 |
+ obj-$(CONFIG_FIQ) += fiq.o fiqasm.o |
436 |
+diff --git a/arch/arm/kernel/bugs.c b/arch/arm/kernel/bugs.c |
437 |
+new file mode 100644 |
438 |
+index 000000000000..7be511310191 |
439 |
+--- /dev/null |
440 |
++++ b/arch/arm/kernel/bugs.c |
441 |
+@@ -0,0 +1,18 @@ |
442 |
++// SPDX-Identifier: GPL-2.0 |
443 |
++#include <linux/init.h> |
444 |
++#include <asm/bugs.h> |
445 |
++#include <asm/proc-fns.h> |
446 |
++ |
447 |
++void check_other_bugs(void) |
448 |
++{ |
449 |
++#ifdef MULTI_CPU |
450 |
++ if (processor.check_bugs) |
451 |
++ processor.check_bugs(); |
452 |
++#endif |
453 |
++} |
454 |
++ |
455 |
++void __init check_bugs(void) |
456 |
++{ |
457 |
++ check_writebuffer_bugs(); |
458 |
++ check_other_bugs(); |
459 |
++} |
460 |
+diff --git a/arch/arm/kernel/entry-common.S b/arch/arm/kernel/entry-common.S |
461 |
+index 99c908226065..54c10503d71f 100644 |
462 |
+--- a/arch/arm/kernel/entry-common.S |
463 |
++++ b/arch/arm/kernel/entry-common.S |
464 |
+@@ -241,9 +241,7 @@ local_restart: |
465 |
+ tst r10, #_TIF_SYSCALL_WORK @ are we tracing syscalls? |
466 |
+ bne __sys_trace |
467 |
+ |
468 |
+- cmp scno, #NR_syscalls @ check upper syscall limit |
469 |
+- badr lr, ret_fast_syscall @ return address |
470 |
+- ldrcc pc, [tbl, scno, lsl #2] @ call sys_* routine |
471 |
++ invoke_syscall tbl, scno, r10, ret_fast_syscall |
472 |
+ |
473 |
+ add r1, sp, #S_OFF |
474 |
+ 2: cmp scno, #(__ARM_NR_BASE - __NR_SYSCALL_BASE) |
475 |
+@@ -277,14 +275,8 @@ __sys_trace: |
476 |
+ mov r1, scno |
477 |
+ add r0, sp, #S_OFF |
478 |
+ bl syscall_trace_enter |
479 |
+- |
480 |
+- badr lr, __sys_trace_return @ return address |
481 |
+- mov scno, r0 @ syscall number (possibly new) |
482 |
+- add r1, sp, #S_R0 + S_OFF @ pointer to regs |
483 |
+- cmp scno, #NR_syscalls @ check upper syscall limit |
484 |
+- ldmccia r1, {r0 - r6} @ have to reload r0 - r6 |
485 |
+- stmccia sp, {r4, r5} @ and update the stack args |
486 |
+- ldrcc pc, [tbl, scno, lsl #2] @ call sys_* routine |
487 |
++ mov scno, r0 |
488 |
++ invoke_syscall tbl, scno, r10, __sys_trace_return, reload=1 |
489 |
+ cmp scno, #-1 @ skip the syscall? |
490 |
+ bne 2b |
491 |
+ add sp, sp, #S_OFF @ restore stack |
492 |
+@@ -362,6 +354,10 @@ sys_syscall: |
493 |
+ bic scno, r0, #__NR_OABI_SYSCALL_BASE |
494 |
+ cmp scno, #__NR_syscall - __NR_SYSCALL_BASE |
495 |
+ cmpne scno, #NR_syscalls @ check range |
496 |
++#ifdef CONFIG_CPU_SPECTRE |
497 |
++ movhs scno, #0 |
498 |
++ csdb |
499 |
++#endif |
500 |
+ stmloia sp, {r5, r6} @ shuffle args |
501 |
+ movlo r0, r1 |
502 |
+ movlo r1, r2 |
503 |
+diff --git a/arch/arm/kernel/entry-header.S b/arch/arm/kernel/entry-header.S |
504 |
+index 0f07579af472..773424843d6e 100644 |
505 |
+--- a/arch/arm/kernel/entry-header.S |
506 |
++++ b/arch/arm/kernel/entry-header.S |
507 |
+@@ -378,6 +378,31 @@ |
508 |
+ #endif |
509 |
+ .endm |
510 |
+ |
511 |
++ .macro invoke_syscall, table, nr, tmp, ret, reload=0 |
512 |
++#ifdef CONFIG_CPU_SPECTRE |
513 |
++ mov \tmp, \nr |
514 |
++ cmp \tmp, #NR_syscalls @ check upper syscall limit |
515 |
++ movcs \tmp, #0 |
516 |
++ csdb |
517 |
++ badr lr, \ret @ return address |
518 |
++ .if \reload |
519 |
++ add r1, sp, #S_R0 + S_OFF @ pointer to regs |
520 |
++ ldmccia r1, {r0 - r6} @ reload r0-r6 |
521 |
++ stmccia sp, {r4, r5} @ update stack arguments |
522 |
++ .endif |
523 |
++ ldrcc pc, [\table, \tmp, lsl #2] @ call sys_* routine |
524 |
++#else |
525 |
++ cmp \nr, #NR_syscalls @ check upper syscall limit |
526 |
++ badr lr, \ret @ return address |
527 |
++ .if \reload |
528 |
++ add r1, sp, #S_R0 + S_OFF @ pointer to regs |
529 |
++ ldmccia r1, {r0 - r6} @ reload r0-r6 |
530 |
++ stmccia sp, {r4, r5} @ update stack arguments |
531 |
++ .endif |
532 |
++ ldrcc pc, [\table, \nr, lsl #2] @ call sys_* routine |
533 |
++#endif |
534 |
++ .endm |
535 |
++ |
536 |
+ /* |
537 |
+ * These are the registers used in the syscall handler, and allow us to |
538 |
+ * have in theory up to 7 arguments to a function - r0 to r6. |
539 |
+diff --git a/arch/arm/kernel/signal.c b/arch/arm/kernel/signal.c |
540 |
+index b67ae12503f3..cdfe52b15a0a 100644 |
541 |
+--- a/arch/arm/kernel/signal.c |
542 |
++++ b/arch/arm/kernel/signal.c |
543 |
+@@ -149,22 +149,18 @@ static int preserve_vfp_context(struct vfp_sigframe __user *frame) |
544 |
+ |
545 |
+ static int restore_vfp_context(char __user **auxp) |
546 |
+ { |
547 |
+- struct vfp_sigframe __user *frame = |
548 |
+- (struct vfp_sigframe __user *)*auxp; |
549 |
+- unsigned long magic; |
550 |
+- unsigned long size; |
551 |
+- int err = 0; |
552 |
+- |
553 |
+- __get_user_error(magic, &frame->magic, err); |
554 |
+- __get_user_error(size, &frame->size, err); |
555 |
++ struct vfp_sigframe frame; |
556 |
++ int err; |
557 |
+ |
558 |
++ err = __copy_from_user(&frame, *auxp, sizeof(frame)); |
559 |
+ if (err) |
560 |
+- return -EFAULT; |
561 |
+- if (magic != VFP_MAGIC || size != VFP_STORAGE_SIZE) |
562 |
++ return err; |
563 |
++ |
564 |
++ if (frame.magic != VFP_MAGIC || frame.size != VFP_STORAGE_SIZE) |
565 |
+ return -EINVAL; |
566 |
+ |
567 |
+- *auxp += size; |
568 |
+- return vfp_restore_user_hwstate(&frame->ufp, &frame->ufp_exc); |
569 |
++ *auxp += sizeof(frame); |
570 |
++ return vfp_restore_user_hwstate(&frame.ufp, &frame.ufp_exc); |
571 |
+ } |
572 |
+ |
573 |
+ #endif |
574 |
+@@ -184,6 +180,7 @@ struct rt_sigframe { |
575 |
+ |
576 |
+ static int restore_sigframe(struct pt_regs *regs, struct sigframe __user *sf) |
577 |
+ { |
578 |
++ struct sigcontext context; |
579 |
+ char __user *aux; |
580 |
+ sigset_t set; |
581 |
+ int err; |
582 |
+@@ -192,23 +189,26 @@ static int restore_sigframe(struct pt_regs *regs, struct sigframe __user *sf) |
583 |
+ if (err == 0) |
584 |
+ set_current_blocked(&set); |
585 |
+ |
586 |
+- __get_user_error(regs->ARM_r0, &sf->uc.uc_mcontext.arm_r0, err); |
587 |
+- __get_user_error(regs->ARM_r1, &sf->uc.uc_mcontext.arm_r1, err); |
588 |
+- __get_user_error(regs->ARM_r2, &sf->uc.uc_mcontext.arm_r2, err); |
589 |
+- __get_user_error(regs->ARM_r3, &sf->uc.uc_mcontext.arm_r3, err); |
590 |
+- __get_user_error(regs->ARM_r4, &sf->uc.uc_mcontext.arm_r4, err); |
591 |
+- __get_user_error(regs->ARM_r5, &sf->uc.uc_mcontext.arm_r5, err); |
592 |
+- __get_user_error(regs->ARM_r6, &sf->uc.uc_mcontext.arm_r6, err); |
593 |
+- __get_user_error(regs->ARM_r7, &sf->uc.uc_mcontext.arm_r7, err); |
594 |
+- __get_user_error(regs->ARM_r8, &sf->uc.uc_mcontext.arm_r8, err); |
595 |
+- __get_user_error(regs->ARM_r9, &sf->uc.uc_mcontext.arm_r9, err); |
596 |
+- __get_user_error(regs->ARM_r10, &sf->uc.uc_mcontext.arm_r10, err); |
597 |
+- __get_user_error(regs->ARM_fp, &sf->uc.uc_mcontext.arm_fp, err); |
598 |
+- __get_user_error(regs->ARM_ip, &sf->uc.uc_mcontext.arm_ip, err); |
599 |
+- __get_user_error(regs->ARM_sp, &sf->uc.uc_mcontext.arm_sp, err); |
600 |
+- __get_user_error(regs->ARM_lr, &sf->uc.uc_mcontext.arm_lr, err); |
601 |
+- __get_user_error(regs->ARM_pc, &sf->uc.uc_mcontext.arm_pc, err); |
602 |
+- __get_user_error(regs->ARM_cpsr, &sf->uc.uc_mcontext.arm_cpsr, err); |
603 |
++ err |= __copy_from_user(&context, &sf->uc.uc_mcontext, sizeof(context)); |
604 |
++ if (err == 0) { |
605 |
++ regs->ARM_r0 = context.arm_r0; |
606 |
++ regs->ARM_r1 = context.arm_r1; |
607 |
++ regs->ARM_r2 = context.arm_r2; |
608 |
++ regs->ARM_r3 = context.arm_r3; |
609 |
++ regs->ARM_r4 = context.arm_r4; |
610 |
++ regs->ARM_r5 = context.arm_r5; |
611 |
++ regs->ARM_r6 = context.arm_r6; |
612 |
++ regs->ARM_r7 = context.arm_r7; |
613 |
++ regs->ARM_r8 = context.arm_r8; |
614 |
++ regs->ARM_r9 = context.arm_r9; |
615 |
++ regs->ARM_r10 = context.arm_r10; |
616 |
++ regs->ARM_fp = context.arm_fp; |
617 |
++ regs->ARM_ip = context.arm_ip; |
618 |
++ regs->ARM_sp = context.arm_sp; |
619 |
++ regs->ARM_lr = context.arm_lr; |
620 |
++ regs->ARM_pc = context.arm_pc; |
621 |
++ regs->ARM_cpsr = context.arm_cpsr; |
622 |
++ } |
623 |
+ |
624 |
+ err |= !valid_user_regs(regs); |
625 |
+ |
626 |
+diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c |
627 |
+index c9a0a5299827..e61af0600133 100644 |
628 |
+--- a/arch/arm/kernel/smp.c |
629 |
++++ b/arch/arm/kernel/smp.c |
630 |
+@@ -31,6 +31,7 @@ |
631 |
+ #include <linux/irq_work.h> |
632 |
+ |
633 |
+ #include <linux/atomic.h> |
634 |
++#include <asm/bugs.h> |
635 |
+ #include <asm/smp.h> |
636 |
+ #include <asm/cacheflush.h> |
637 |
+ #include <asm/cpu.h> |
638 |
+@@ -402,6 +403,9 @@ asmlinkage void secondary_start_kernel(void) |
639 |
+ * before we continue - which happens after __cpu_up returns. |
640 |
+ */ |
641 |
+ set_cpu_online(cpu, true); |
642 |
++ |
643 |
++ check_other_bugs(); |
644 |
++ |
645 |
+ complete(&cpu_running); |
646 |
+ |
647 |
+ local_irq_enable(); |
648 |
+diff --git a/arch/arm/kernel/suspend.c b/arch/arm/kernel/suspend.c |
649 |
+index a40ebb7c0896..d08099269e35 100644 |
650 |
+--- a/arch/arm/kernel/suspend.c |
651 |
++++ b/arch/arm/kernel/suspend.c |
652 |
+@@ -3,6 +3,7 @@ |
653 |
+ #include <linux/slab.h> |
654 |
+ #include <linux/mm_types.h> |
655 |
+ |
656 |
++#include <asm/bugs.h> |
657 |
+ #include <asm/cacheflush.h> |
658 |
+ #include <asm/idmap.h> |
659 |
+ #include <asm/pgalloc.h> |
660 |
+@@ -36,6 +37,7 @@ int cpu_suspend(unsigned long arg, int (*fn)(unsigned long)) |
661 |
+ cpu_switch_mm(mm->pgd, mm); |
662 |
+ local_flush_bp_all(); |
663 |
+ local_flush_tlb_all(); |
664 |
++ check_other_bugs(); |
665 |
+ } |
666 |
+ |
667 |
+ return ret; |
668 |
+diff --git a/arch/arm/kernel/sys_oabi-compat.c b/arch/arm/kernel/sys_oabi-compat.c |
669 |
+index b9786f491873..4abe4909417f 100644 |
670 |
+--- a/arch/arm/kernel/sys_oabi-compat.c |
671 |
++++ b/arch/arm/kernel/sys_oabi-compat.c |
672 |
+@@ -329,9 +329,11 @@ asmlinkage long sys_oabi_semtimedop(int semid, |
673 |
+ return -ENOMEM; |
674 |
+ err = 0; |
675 |
+ for (i = 0; i < nsops; i++) { |
676 |
+- __get_user_error(sops[i].sem_num, &tsops->sem_num, err); |
677 |
+- __get_user_error(sops[i].sem_op, &tsops->sem_op, err); |
678 |
+- __get_user_error(sops[i].sem_flg, &tsops->sem_flg, err); |
679 |
++ struct oabi_sembuf osb; |
680 |
++ err |= __copy_from_user(&osb, tsops, sizeof(osb)); |
681 |
++ sops[i].sem_num = osb.sem_num; |
682 |
++ sops[i].sem_op = osb.sem_op; |
683 |
++ sops[i].sem_flg = osb.sem_flg; |
684 |
+ tsops++; |
685 |
+ } |
686 |
+ if (timeout) { |
687 |
+diff --git a/arch/arm/kvm/hyp/hyp-entry.S b/arch/arm/kvm/hyp/hyp-entry.S |
688 |
+index 95a2faefc070..aa3f9a9837ac 100644 |
689 |
+--- a/arch/arm/kvm/hyp/hyp-entry.S |
690 |
++++ b/arch/arm/kvm/hyp/hyp-entry.S |
691 |
+@@ -16,6 +16,7 @@ |
692 |
+ * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
693 |
+ */ |
694 |
+ |
695 |
++#include <linux/arm-smccc.h> |
696 |
+ #include <linux/linkage.h> |
697 |
+ #include <asm/kvm_arm.h> |
698 |
+ #include <asm/kvm_asm.h> |
699 |
+@@ -71,6 +72,90 @@ __kvm_hyp_vector: |
700 |
+ W(b) hyp_irq |
701 |
+ W(b) hyp_fiq |
702 |
+ |
703 |
++#ifdef CONFIG_HARDEN_BRANCH_PREDICTOR |
704 |
++ .align 5 |
705 |
++__kvm_hyp_vector_ic_inv: |
706 |
++ .global __kvm_hyp_vector_ic_inv |
707 |
++ |
708 |
++ /* |
709 |
++ * We encode the exception entry in the bottom 3 bits of |
710 |
++ * SP, and we have to guarantee to be 8 bytes aligned. |
711 |
++ */ |
712 |
++ W(add) sp, sp, #1 /* Reset 7 */ |
713 |
++ W(add) sp, sp, #1 /* Undef 6 */ |
714 |
++ W(add) sp, sp, #1 /* Syscall 5 */ |
715 |
++ W(add) sp, sp, #1 /* Prefetch abort 4 */ |
716 |
++ W(add) sp, sp, #1 /* Data abort 3 */ |
717 |
++ W(add) sp, sp, #1 /* HVC 2 */ |
718 |
++ W(add) sp, sp, #1 /* IRQ 1 */ |
719 |
++ W(nop) /* FIQ 0 */ |
720 |
++ |
721 |
++ mcr p15, 0, r0, c7, c5, 0 /* ICIALLU */ |
722 |
++ isb |
723 |
++ |
724 |
++ b decode_vectors |
725 |
++ |
726 |
++ .align 5 |
727 |
++__kvm_hyp_vector_bp_inv: |
728 |
++ .global __kvm_hyp_vector_bp_inv |
729 |
++ |
730 |
++ /* |
731 |
++ * We encode the exception entry in the bottom 3 bits of |
732 |
++ * SP, and we have to guarantee to be 8 bytes aligned. |
733 |
++ */ |
734 |
++ W(add) sp, sp, #1 /* Reset 7 */ |
735 |
++ W(add) sp, sp, #1 /* Undef 6 */ |
736 |
++ W(add) sp, sp, #1 /* Syscall 5 */ |
737 |
++ W(add) sp, sp, #1 /* Prefetch abort 4 */ |
738 |
++ W(add) sp, sp, #1 /* Data abort 3 */ |
739 |
++ W(add) sp, sp, #1 /* HVC 2 */ |
740 |
++ W(add) sp, sp, #1 /* IRQ 1 */ |
741 |
++ W(nop) /* FIQ 0 */ |
742 |
++ |
743 |
++ mcr p15, 0, r0, c7, c5, 6 /* BPIALL */ |
744 |
++ isb |
745 |
++ |
746 |
++decode_vectors: |
747 |
++ |
748 |
++#ifdef CONFIG_THUMB2_KERNEL |
749 |
++ /* |
750 |
++ * Yet another silly hack: Use VPIDR as a temp register. |
751 |
++ * Thumb2 is really a pain, as SP cannot be used with most |
752 |
++ * of the bitwise instructions. The vect_br macro ensures |
753 |
++ * things gets cleaned-up. |
754 |
++ */ |
755 |
++ mcr p15, 4, r0, c0, c0, 0 /* VPIDR */ |
756 |
++ mov r0, sp |
757 |
++ and r0, r0, #7 |
758 |
++ sub sp, sp, r0 |
759 |
++ push {r1, r2} |
760 |
++ mov r1, r0 |
761 |
++ mrc p15, 4, r0, c0, c0, 0 /* VPIDR */ |
762 |
++ mrc p15, 0, r2, c0, c0, 0 /* MIDR */ |
763 |
++ mcr p15, 4, r2, c0, c0, 0 /* VPIDR */ |
764 |
++#endif |
765 |
++ |
766 |
++.macro vect_br val, targ |
767 |
++ARM( eor sp, sp, #\val ) |
768 |
++ARM( tst sp, #7 ) |
769 |
++ARM( eorne sp, sp, #\val ) |
770 |
++ |
771 |
++THUMB( cmp r1, #\val ) |
772 |
++THUMB( popeq {r1, r2} ) |
773 |
++ |
774 |
++ beq \targ |
775 |
++.endm |
776 |
++ |
777 |
++ vect_br 0, hyp_fiq |
778 |
++ vect_br 1, hyp_irq |
779 |
++ vect_br 2, hyp_hvc |
780 |
++ vect_br 3, hyp_dabt |
781 |
++ vect_br 4, hyp_pabt |
782 |
++ vect_br 5, hyp_svc |
783 |
++ vect_br 6, hyp_undef |
784 |
++ vect_br 7, hyp_reset |
785 |
++#endif |
786 |
++ |
787 |
+ .macro invalid_vector label, cause |
788 |
+ .align |
789 |
+ \label: mov r0, #\cause |
790 |
+@@ -118,7 +203,7 @@ hyp_hvc: |
791 |
+ lsr r2, r2, #16 |
792 |
+ and r2, r2, #0xff |
793 |
+ cmp r2, #0 |
794 |
+- bne guest_trap @ Guest called HVC |
795 |
++ bne guest_hvc_trap @ Guest called HVC |
796 |
+ |
797 |
+ /* |
798 |
+ * Getting here means host called HVC, we shift parameters and branch |
799 |
+@@ -149,7 +234,14 @@ hyp_hvc: |
800 |
+ bx ip |
801 |
+ |
802 |
+ 1: |
803 |
+- push {lr} |
804 |
++ /* |
805 |
++ * Pushing r2 here is just a way of keeping the stack aligned to |
806 |
++ * 8 bytes on any path that can trigger a HYP exception. Here, |
807 |
++ * we may well be about to jump into the guest, and the guest |
808 |
++ * exit would otherwise be badly decoded by our fancy |
809 |
++ * "decode-exception-without-a-branch" code... |
810 |
++ */ |
811 |
++ push {r2, lr} |
812 |
+ |
813 |
+ mov lr, r0 |
814 |
+ mov r0, r1 |
815 |
+@@ -159,7 +251,21 @@ hyp_hvc: |
816 |
+ THUMB( orr lr, #1) |
817 |
+ blx lr @ Call the HYP function |
818 |
+ |
819 |
+- pop {lr} |
820 |
++ pop {r2, lr} |
821 |
++ eret |
822 |
++ |
823 |
++guest_hvc_trap: |
824 |
++ movw r2, #:lower16:ARM_SMCCC_ARCH_WORKAROUND_1 |
825 |
++ movt r2, #:upper16:ARM_SMCCC_ARCH_WORKAROUND_1 |
826 |
++ ldr r0, [sp] @ Guest's r0 |
827 |
++ teq r0, r2 |
828 |
++ bne guest_trap |
829 |
++ add sp, sp, #12 |
830 |
++ @ Returns: |
831 |
++ @ r0 = 0 |
832 |
++ @ r1 = HSR value (perfectly predictable) |
833 |
++ @ r2 = ARM_SMCCC_ARCH_WORKAROUND_1 |
834 |
++ mov r0, #0 |
835 |
+ eret |
836 |
+ |
837 |
+ guest_trap: |
838 |
+diff --git a/arch/arm/lib/copy_from_user.S b/arch/arm/lib/copy_from_user.S |
839 |
+index 7a4b06049001..a826df3d3814 100644 |
840 |
+--- a/arch/arm/lib/copy_from_user.S |
841 |
++++ b/arch/arm/lib/copy_from_user.S |
842 |
+@@ -90,6 +90,15 @@ |
843 |
+ .text |
844 |
+ |
845 |
+ ENTRY(arm_copy_from_user) |
846 |
++#ifdef CONFIG_CPU_SPECTRE |
847 |
++ get_thread_info r3 |
848 |
++ ldr r3, [r3, #TI_ADDR_LIMIT] |
849 |
++ adds ip, r1, r2 @ ip=addr+size |
850 |
++ sub r3, r3, #1 @ addr_limit - 1 |
851 |
++ cmpcc ip, r3 @ if (addr+size > addr_limit - 1) |
852 |
++ movcs r1, #0 @ addr = NULL |
853 |
++ csdb |
854 |
++#endif |
855 |
+ |
856 |
+ #include "copy_template.S" |
857 |
+ |
858 |
+diff --git a/arch/arm/mm/Kconfig b/arch/arm/mm/Kconfig |
859 |
+index fd9077a74fce..50e0b45a22db 100644 |
860 |
+--- a/arch/arm/mm/Kconfig |
861 |
++++ b/arch/arm/mm/Kconfig |
862 |
+@@ -415,6 +415,7 @@ config CPU_V7 |
863 |
+ select CPU_CP15_MPU if !MMU |
864 |
+ select CPU_HAS_ASID if MMU |
865 |
+ select CPU_PABRT_V7 |
866 |
++ select CPU_SPECTRE if MMU |
867 |
+ select CPU_THUMB_CAPABLE |
868 |
+ select CPU_TLB_V7 if MMU |
869 |
+ |
870 |
+@@ -826,6 +827,28 @@ config CPU_BPREDICT_DISABLE |
871 |
+ help |
872 |
+ Say Y here to disable branch prediction. If unsure, say N. |
873 |
+ |
874 |
++config CPU_SPECTRE |
875 |
++ bool |
876 |
++ |
877 |
++config HARDEN_BRANCH_PREDICTOR |
878 |
++ bool "Harden the branch predictor against aliasing attacks" if EXPERT |
879 |
++ depends on CPU_SPECTRE |
880 |
++ default y |
881 |
++ help |
882 |
++ Speculation attacks against some high-performance processors rely |
883 |
++ on being able to manipulate the branch predictor for a victim |
884 |
++ context by executing aliasing branches in the attacker context. |
885 |
++ Such attacks can be partially mitigated against by clearing |
886 |
++ internal branch predictor state and limiting the prediction |
887 |
++ logic in some situations. |
888 |
++ |
889 |
++ This config option will take CPU-specific actions to harden |
890 |
++ the branch predictor against aliasing attacks and may rely on |
891 |
++ specific instruction sequences or control bits being set by |
892 |
++ the system firmware. |
893 |
++ |
894 |
++ If unsure, say Y. |
895 |
++ |
896 |
+ config TLS_REG_EMUL |
897 |
+ bool |
898 |
+ select NEED_KUSER_HELPERS |
899 |
+diff --git a/arch/arm/mm/Makefile b/arch/arm/mm/Makefile |
900 |
+index f353ee569f6b..93a622a18cba 100644 |
901 |
+--- a/arch/arm/mm/Makefile |
902 |
++++ b/arch/arm/mm/Makefile |
903 |
+@@ -95,7 +95,7 @@ obj-$(CONFIG_CPU_MOHAWK) += proc-mohawk.o |
904 |
+ obj-$(CONFIG_CPU_FEROCEON) += proc-feroceon.o |
905 |
+ obj-$(CONFIG_CPU_V6) += proc-v6.o |
906 |
+ obj-$(CONFIG_CPU_V6K) += proc-v6.o |
907 |
+-obj-$(CONFIG_CPU_V7) += proc-v7.o |
908 |
++obj-$(CONFIG_CPU_V7) += proc-v7.o proc-v7-bugs.o |
909 |
+ obj-$(CONFIG_CPU_V7M) += proc-v7m.o |
910 |
+ |
911 |
+ AFLAGS_proc-v6.o :=-Wa,-march=armv6 |
912 |
+diff --git a/arch/arm/mm/fault.c b/arch/arm/mm/fault.c |
913 |
+index 42f585379e19..49b1b8048635 100644 |
914 |
+--- a/arch/arm/mm/fault.c |
915 |
++++ b/arch/arm/mm/fault.c |
916 |
+@@ -164,6 +164,9 @@ __do_user_fault(struct task_struct *tsk, unsigned long addr, |
917 |
+ { |
918 |
+ struct siginfo si; |
919 |
+ |
920 |
++ if (addr > TASK_SIZE) |
921 |
++ harden_branch_predictor(); |
922 |
++ |
923 |
+ #ifdef CONFIG_DEBUG_USER |
924 |
+ if (((user_debug & UDBG_SEGV) && (sig == SIGSEGV)) || |
925 |
+ ((user_debug & UDBG_BUS) && (sig == SIGBUS))) { |
926 |
+diff --git a/arch/arm/mm/proc-macros.S b/arch/arm/mm/proc-macros.S |
927 |
+index f10e31d0730a..81d0efb055c6 100644 |
928 |
+--- a/arch/arm/mm/proc-macros.S |
929 |
++++ b/arch/arm/mm/proc-macros.S |
930 |
+@@ -273,13 +273,14 @@ |
931 |
+ mcr p15, 0, ip, c7, c10, 4 @ data write barrier |
932 |
+ .endm |
933 |
+ |
934 |
+-.macro define_processor_functions name:req, dabort:req, pabort:req, nommu=0, suspend=0 |
935 |
++.macro define_processor_functions name:req, dabort:req, pabort:req, nommu=0, suspend=0, bugs=0 |
936 |
+ .type \name\()_processor_functions, #object |
937 |
+ .align 2 |
938 |
+ ENTRY(\name\()_processor_functions) |
939 |
+ .word \dabort |
940 |
+ .word \pabort |
941 |
+ .word cpu_\name\()_proc_init |
942 |
++ .word \bugs |
943 |
+ .word cpu_\name\()_proc_fin |
944 |
+ .word cpu_\name\()_reset |
945 |
+ .word cpu_\name\()_do_idle |
946 |
+diff --git a/arch/arm/mm/proc-v7-2level.S b/arch/arm/mm/proc-v7-2level.S |
947 |
+index c6141a5435c3..f8d45ad2a515 100644 |
948 |
+--- a/arch/arm/mm/proc-v7-2level.S |
949 |
++++ b/arch/arm/mm/proc-v7-2level.S |
950 |
+@@ -41,11 +41,6 @@ |
951 |
+ * even on Cortex-A8 revisions not affected by 430973. |
952 |
+ * If IBE is not set, the flush BTAC/BTB won't do anything. |
953 |
+ */ |
954 |
+-ENTRY(cpu_ca8_switch_mm) |
955 |
+-#ifdef CONFIG_MMU |
956 |
+- mov r2, #0 |
957 |
+- mcr p15, 0, r2, c7, c5, 6 @ flush BTAC/BTB |
958 |
+-#endif |
959 |
+ ENTRY(cpu_v7_switch_mm) |
960 |
+ #ifdef CONFIG_MMU |
961 |
+ mmid r1, r1 @ get mm->context.id |
962 |
+@@ -66,7 +61,6 @@ ENTRY(cpu_v7_switch_mm) |
963 |
+ #endif |
964 |
+ bx lr |
965 |
+ ENDPROC(cpu_v7_switch_mm) |
966 |
+-ENDPROC(cpu_ca8_switch_mm) |
967 |
+ |
968 |
+ /* |
969 |
+ * cpu_v7_set_pte_ext(ptep, pte) |
970 |
+diff --git a/arch/arm/mm/proc-v7-bugs.c b/arch/arm/mm/proc-v7-bugs.c |
971 |
+new file mode 100644 |
972 |
+index 000000000000..5544b82a2e7a |
973 |
+--- /dev/null |
974 |
++++ b/arch/arm/mm/proc-v7-bugs.c |
975 |
+@@ -0,0 +1,174 @@ |
976 |
++// SPDX-License-Identifier: GPL-2.0 |
977 |
++#include <linux/arm-smccc.h> |
978 |
++#include <linux/kernel.h> |
979 |
++#include <linux/psci.h> |
980 |
++#include <linux/smp.h> |
981 |
++ |
982 |
++#include <asm/cp15.h> |
983 |
++#include <asm/cputype.h> |
984 |
++#include <asm/proc-fns.h> |
985 |
++#include <asm/system_misc.h> |
986 |
++ |
987 |
++#ifdef CONFIG_HARDEN_BRANCH_PREDICTOR |
988 |
++DEFINE_PER_CPU(harden_branch_predictor_fn_t, harden_branch_predictor_fn); |
989 |
++ |
990 |
++extern void cpu_v7_iciallu_switch_mm(phys_addr_t pgd_phys, struct mm_struct *mm); |
991 |
++extern void cpu_v7_bpiall_switch_mm(phys_addr_t pgd_phys, struct mm_struct *mm); |
992 |
++extern void cpu_v7_smc_switch_mm(phys_addr_t pgd_phys, struct mm_struct *mm); |
993 |
++extern void cpu_v7_hvc_switch_mm(phys_addr_t pgd_phys, struct mm_struct *mm); |
994 |
++ |
995 |
++static void harden_branch_predictor_bpiall(void) |
996 |
++{ |
997 |
++ write_sysreg(0, BPIALL); |
998 |
++} |
999 |
++ |
1000 |
++static void harden_branch_predictor_iciallu(void) |
1001 |
++{ |
1002 |
++ write_sysreg(0, ICIALLU); |
1003 |
++} |
1004 |
++ |
1005 |
++static void __maybe_unused call_smc_arch_workaround_1(void) |
1006 |
++{ |
1007 |
++ arm_smccc_1_1_smc(ARM_SMCCC_ARCH_WORKAROUND_1, NULL); |
1008 |
++} |
1009 |
++ |
1010 |
++static void __maybe_unused call_hvc_arch_workaround_1(void) |
1011 |
++{ |
1012 |
++ arm_smccc_1_1_hvc(ARM_SMCCC_ARCH_WORKAROUND_1, NULL); |
1013 |
++} |
1014 |
++ |
1015 |
++static void cpu_v7_spectre_init(void) |
1016 |
++{ |
1017 |
++ const char *spectre_v2_method = NULL; |
1018 |
++ int cpu = smp_processor_id(); |
1019 |
++ |
1020 |
++ if (per_cpu(harden_branch_predictor_fn, cpu)) |
1021 |
++ return; |
1022 |
++ |
1023 |
++ switch (read_cpuid_part()) { |
1024 |
++ case ARM_CPU_PART_CORTEX_A8: |
1025 |
++ case ARM_CPU_PART_CORTEX_A9: |
1026 |
++ case ARM_CPU_PART_CORTEX_A12: |
1027 |
++ case ARM_CPU_PART_CORTEX_A17: |
1028 |
++ case ARM_CPU_PART_CORTEX_A73: |
1029 |
++ case ARM_CPU_PART_CORTEX_A75: |
1030 |
++ if (processor.switch_mm != cpu_v7_bpiall_switch_mm) |
1031 |
++ goto bl_error; |
1032 |
++ per_cpu(harden_branch_predictor_fn, cpu) = |
1033 |
++ harden_branch_predictor_bpiall; |
1034 |
++ spectre_v2_method = "BPIALL"; |
1035 |
++ break; |
1036 |
++ |
1037 |
++ case ARM_CPU_PART_CORTEX_A15: |
1038 |
++ case ARM_CPU_PART_BRAHMA_B15: |
1039 |
++ if (processor.switch_mm != cpu_v7_iciallu_switch_mm) |
1040 |
++ goto bl_error; |
1041 |
++ per_cpu(harden_branch_predictor_fn, cpu) = |
1042 |
++ harden_branch_predictor_iciallu; |
1043 |
++ spectre_v2_method = "ICIALLU"; |
1044 |
++ break; |
1045 |
++ |
1046 |
++#ifdef CONFIG_ARM_PSCI |
1047 |
++ default: |
1048 |
++ /* Other ARM CPUs require no workaround */ |
1049 |
++ if (read_cpuid_implementor() == ARM_CPU_IMP_ARM) |
1050 |
++ break; |
1051 |
++ /* fallthrough */ |
1052 |
++ /* Cortex A57/A72 require firmware workaround */ |
1053 |
++ case ARM_CPU_PART_CORTEX_A57: |
1054 |
++ case ARM_CPU_PART_CORTEX_A72: { |
1055 |
++ struct arm_smccc_res res; |
1056 |
++ |
1057 |
++ if (psci_ops.smccc_version == SMCCC_VERSION_1_0) |
1058 |
++ break; |
1059 |
++ |
1060 |
++ switch (psci_ops.conduit) { |
1061 |
++ case PSCI_CONDUIT_HVC: |
1062 |
++ arm_smccc_1_1_hvc(ARM_SMCCC_ARCH_FEATURES_FUNC_ID, |
1063 |
++ ARM_SMCCC_ARCH_WORKAROUND_1, &res); |
1064 |
++ if ((int)res.a0 != 0) |
1065 |
++ break; |
1066 |
++ if (processor.switch_mm != cpu_v7_hvc_switch_mm && cpu) |
1067 |
++ goto bl_error; |
1068 |
++ per_cpu(harden_branch_predictor_fn, cpu) = |
1069 |
++ call_hvc_arch_workaround_1; |
1070 |
++ processor.switch_mm = cpu_v7_hvc_switch_mm; |
1071 |
++ spectre_v2_method = "hypervisor"; |
1072 |
++ break; |
1073 |
++ |
1074 |
++ case PSCI_CONDUIT_SMC: |
1075 |
++ arm_smccc_1_1_smc(ARM_SMCCC_ARCH_FEATURES_FUNC_ID, |
1076 |
++ ARM_SMCCC_ARCH_WORKAROUND_1, &res); |
1077 |
++ if ((int)res.a0 != 0) |
1078 |
++ break; |
1079 |
++ if (processor.switch_mm != cpu_v7_smc_switch_mm && cpu) |
1080 |
++ goto bl_error; |
1081 |
++ per_cpu(harden_branch_predictor_fn, cpu) = |
1082 |
++ call_smc_arch_workaround_1; |
1083 |
++ processor.switch_mm = cpu_v7_smc_switch_mm; |
1084 |
++ spectre_v2_method = "firmware"; |
1085 |
++ break; |
1086 |
++ |
1087 |
++ default: |
1088 |
++ break; |
1089 |
++ } |
1090 |
++ } |
1091 |
++#endif |
1092 |
++ } |
1093 |
++ |
1094 |
++ if (spectre_v2_method) |
1095 |
++ pr_info("CPU%u: Spectre v2: using %s workaround\n", |
1096 |
++ smp_processor_id(), spectre_v2_method); |
1097 |
++ return; |
1098 |
++ |
1099 |
++bl_error: |
1100 |
++ pr_err("CPU%u: Spectre v2: incorrect context switching function, system vulnerable\n", |
1101 |
++ cpu); |
1102 |
++} |
1103 |
++#else |
1104 |
++static void cpu_v7_spectre_init(void) |
1105 |
++{ |
1106 |
++} |
1107 |
++#endif |
1108 |
++ |
1109 |
++static __maybe_unused bool cpu_v7_check_auxcr_set(bool *warned, |
1110 |
++ u32 mask, const char *msg) |
1111 |
++{ |
1112 |
++ u32 aux_cr; |
1113 |
++ |
1114 |
++ asm("mrc p15, 0, %0, c1, c0, 1" : "=r" (aux_cr)); |
1115 |
++ |
1116 |
++ if ((aux_cr & mask) != mask) { |
1117 |
++ if (!*warned) |
1118 |
++ pr_err("CPU%u: %s", smp_processor_id(), msg); |
1119 |
++ *warned = true; |
1120 |
++ return false; |
1121 |
++ } |
1122 |
++ return true; |
1123 |
++} |
1124 |
++ |
1125 |
++static DEFINE_PER_CPU(bool, spectre_warned); |
1126 |
++ |
1127 |
++static bool check_spectre_auxcr(bool *warned, u32 bit) |
1128 |
++{ |
1129 |
++ return IS_ENABLED(CONFIG_HARDEN_BRANCH_PREDICTOR) && |
1130 |
++ cpu_v7_check_auxcr_set(warned, bit, |
1131 |
++ "Spectre v2: firmware did not set auxiliary control register IBE bit, system vulnerable\n"); |
1132 |
++} |
1133 |
++ |
1134 |
++void cpu_v7_ca8_ibe(void) |
1135 |
++{ |
1136 |
++ if (check_spectre_auxcr(this_cpu_ptr(&spectre_warned), BIT(6))) |
1137 |
++ cpu_v7_spectre_init(); |
1138 |
++} |
1139 |
++ |
1140 |
++void cpu_v7_ca15_ibe(void) |
1141 |
++{ |
1142 |
++ if (check_spectre_auxcr(this_cpu_ptr(&spectre_warned), BIT(0))) |
1143 |
++ cpu_v7_spectre_init(); |
1144 |
++} |
1145 |
++ |
1146 |
++void cpu_v7_bugs_init(void) |
1147 |
++{ |
1148 |
++ cpu_v7_spectre_init(); |
1149 |
++} |
1150 |
+diff --git a/arch/arm/mm/proc-v7.S b/arch/arm/mm/proc-v7.S |
1151 |
+index 01d64c0b2563..12468d9378d8 100644 |
1152 |
+--- a/arch/arm/mm/proc-v7.S |
1153 |
++++ b/arch/arm/mm/proc-v7.S |
1154 |
+@@ -9,6 +9,7 @@ |
1155 |
+ * |
1156 |
+ * This is the "shell" of the ARMv7 processor support. |
1157 |
+ */ |
1158 |
++#include <linux/arm-smccc.h> |
1159 |
+ #include <linux/init.h> |
1160 |
+ #include <linux/linkage.h> |
1161 |
+ #include <asm/assembler.h> |
1162 |
+@@ -93,6 +94,37 @@ ENTRY(cpu_v7_dcache_clean_area) |
1163 |
+ ret lr |
1164 |
+ ENDPROC(cpu_v7_dcache_clean_area) |
1165 |
+ |
1166 |
++#ifdef CONFIG_ARM_PSCI |
1167 |
++ .arch_extension sec |
1168 |
++ENTRY(cpu_v7_smc_switch_mm) |
1169 |
++ stmfd sp!, {r0 - r3} |
1170 |
++ movw r0, #:lower16:ARM_SMCCC_ARCH_WORKAROUND_1 |
1171 |
++ movt r0, #:upper16:ARM_SMCCC_ARCH_WORKAROUND_1 |
1172 |
++ smc #0 |
1173 |
++ ldmfd sp!, {r0 - r3} |
1174 |
++ b cpu_v7_switch_mm |
1175 |
++ENDPROC(cpu_v7_smc_switch_mm) |
1176 |
++ .arch_extension virt |
1177 |
++ENTRY(cpu_v7_hvc_switch_mm) |
1178 |
++ stmfd sp!, {r0 - r3} |
1179 |
++ movw r0, #:lower16:ARM_SMCCC_ARCH_WORKAROUND_1 |
1180 |
++ movt r0, #:upper16:ARM_SMCCC_ARCH_WORKAROUND_1 |
1181 |
++ hvc #0 |
1182 |
++ ldmfd sp!, {r0 - r3} |
1183 |
++ b cpu_v7_switch_mm |
1184 |
++ENDPROC(cpu_v7_smc_switch_mm) |
1185 |
++#endif |
1186 |
++ENTRY(cpu_v7_iciallu_switch_mm) |
1187 |
++ mov r3, #0 |
1188 |
++ mcr p15, 0, r3, c7, c5, 0 @ ICIALLU |
1189 |
++ b cpu_v7_switch_mm |
1190 |
++ENDPROC(cpu_v7_iciallu_switch_mm) |
1191 |
++ENTRY(cpu_v7_bpiall_switch_mm) |
1192 |
++ mov r3, #0 |
1193 |
++ mcr p15, 0, r3, c7, c5, 6 @ flush BTAC/BTB |
1194 |
++ b cpu_v7_switch_mm |
1195 |
++ENDPROC(cpu_v7_bpiall_switch_mm) |
1196 |
++ |
1197 |
+ string cpu_v7_name, "ARMv7 Processor" |
1198 |
+ .align |
1199 |
+ |
1200 |
+@@ -158,31 +190,6 @@ ENTRY(cpu_v7_do_resume) |
1201 |
+ ENDPROC(cpu_v7_do_resume) |
1202 |
+ #endif |
1203 |
+ |
1204 |
+-/* |
1205 |
+- * Cortex-A8 |
1206 |
+- */ |
1207 |
+- globl_equ cpu_ca8_proc_init, cpu_v7_proc_init |
1208 |
+- globl_equ cpu_ca8_proc_fin, cpu_v7_proc_fin |
1209 |
+- globl_equ cpu_ca8_reset, cpu_v7_reset |
1210 |
+- globl_equ cpu_ca8_do_idle, cpu_v7_do_idle |
1211 |
+- globl_equ cpu_ca8_dcache_clean_area, cpu_v7_dcache_clean_area |
1212 |
+- globl_equ cpu_ca8_set_pte_ext, cpu_v7_set_pte_ext |
1213 |
+- globl_equ cpu_ca8_suspend_size, cpu_v7_suspend_size |
1214 |
+-#ifdef CONFIG_ARM_CPU_SUSPEND |
1215 |
+- globl_equ cpu_ca8_do_suspend, cpu_v7_do_suspend |
1216 |
+- globl_equ cpu_ca8_do_resume, cpu_v7_do_resume |
1217 |
+-#endif |
1218 |
+- |
1219 |
+-/* |
1220 |
+- * Cortex-A9 processor functions |
1221 |
+- */ |
1222 |
+- globl_equ cpu_ca9mp_proc_init, cpu_v7_proc_init |
1223 |
+- globl_equ cpu_ca9mp_proc_fin, cpu_v7_proc_fin |
1224 |
+- globl_equ cpu_ca9mp_reset, cpu_v7_reset |
1225 |
+- globl_equ cpu_ca9mp_do_idle, cpu_v7_do_idle |
1226 |
+- globl_equ cpu_ca9mp_dcache_clean_area, cpu_v7_dcache_clean_area |
1227 |
+- globl_equ cpu_ca9mp_switch_mm, cpu_v7_switch_mm |
1228 |
+- globl_equ cpu_ca9mp_set_pte_ext, cpu_v7_set_pte_ext |
1229 |
+ .globl cpu_ca9mp_suspend_size |
1230 |
+ .equ cpu_ca9mp_suspend_size, cpu_v7_suspend_size + 4 * 2 |
1231 |
+ #ifdef CONFIG_ARM_CPU_SUSPEND |
1232 |
+@@ -546,12 +553,79 @@ __v7_setup_stack: |
1233 |
+ |
1234 |
+ __INITDATA |
1235 |
+ |
1236 |
++ .weak cpu_v7_bugs_init |
1237 |
++ |
1238 |
+ @ define struct processor (see <asm/proc-fns.h> and proc-macros.S) |
1239 |
+- define_processor_functions v7, dabort=v7_early_abort, pabort=v7_pabort, suspend=1 |
1240 |
++ define_processor_functions v7, dabort=v7_early_abort, pabort=v7_pabort, suspend=1, bugs=cpu_v7_bugs_init |
1241 |
++ |
1242 |
++#ifdef CONFIG_HARDEN_BRANCH_PREDICTOR |
1243 |
++ @ generic v7 bpiall on context switch |
1244 |
++ globl_equ cpu_v7_bpiall_proc_init, cpu_v7_proc_init |
1245 |
++ globl_equ cpu_v7_bpiall_proc_fin, cpu_v7_proc_fin |
1246 |
++ globl_equ cpu_v7_bpiall_reset, cpu_v7_reset |
1247 |
++ globl_equ cpu_v7_bpiall_do_idle, cpu_v7_do_idle |
1248 |
++ globl_equ cpu_v7_bpiall_dcache_clean_area, cpu_v7_dcache_clean_area |
1249 |
++ globl_equ cpu_v7_bpiall_set_pte_ext, cpu_v7_set_pte_ext |
1250 |
++ globl_equ cpu_v7_bpiall_suspend_size, cpu_v7_suspend_size |
1251 |
++#ifdef CONFIG_ARM_CPU_SUSPEND |
1252 |
++ globl_equ cpu_v7_bpiall_do_suspend, cpu_v7_do_suspend |
1253 |
++ globl_equ cpu_v7_bpiall_do_resume, cpu_v7_do_resume |
1254 |
++#endif |
1255 |
++ define_processor_functions v7_bpiall, dabort=v7_early_abort, pabort=v7_pabort, suspend=1, bugs=cpu_v7_bugs_init |
1256 |
++ |
1257 |
++#define HARDENED_BPIALL_PROCESSOR_FUNCTIONS v7_bpiall_processor_functions |
1258 |
++#else |
1259 |
++#define HARDENED_BPIALL_PROCESSOR_FUNCTIONS v7_processor_functions |
1260 |
++#endif |
1261 |
++ |
1262 |
+ #ifndef CONFIG_ARM_LPAE |
1263 |
+- define_processor_functions ca8, dabort=v7_early_abort, pabort=v7_pabort, suspend=1 |
1264 |
+- define_processor_functions ca9mp, dabort=v7_early_abort, pabort=v7_pabort, suspend=1 |
1265 |
++ @ Cortex-A8 - always needs bpiall switch_mm implementation |
1266 |
++ globl_equ cpu_ca8_proc_init, cpu_v7_proc_init |
1267 |
++ globl_equ cpu_ca8_proc_fin, cpu_v7_proc_fin |
1268 |
++ globl_equ cpu_ca8_reset, cpu_v7_reset |
1269 |
++ globl_equ cpu_ca8_do_idle, cpu_v7_do_idle |
1270 |
++ globl_equ cpu_ca8_dcache_clean_area, cpu_v7_dcache_clean_area |
1271 |
++ globl_equ cpu_ca8_set_pte_ext, cpu_v7_set_pte_ext |
1272 |
++ globl_equ cpu_ca8_switch_mm, cpu_v7_bpiall_switch_mm |
1273 |
++ globl_equ cpu_ca8_suspend_size, cpu_v7_suspend_size |
1274 |
++#ifdef CONFIG_ARM_CPU_SUSPEND |
1275 |
++ globl_equ cpu_ca8_do_suspend, cpu_v7_do_suspend |
1276 |
++ globl_equ cpu_ca8_do_resume, cpu_v7_do_resume |
1277 |
++#endif |
1278 |
++ define_processor_functions ca8, dabort=v7_early_abort, pabort=v7_pabort, suspend=1, bugs=cpu_v7_ca8_ibe |
1279 |
++ |
1280 |
++ @ Cortex-A9 - needs more registers preserved across suspend/resume |
1281 |
++ @ and bpiall switch_mm for hardening |
1282 |
++ globl_equ cpu_ca9mp_proc_init, cpu_v7_proc_init |
1283 |
++ globl_equ cpu_ca9mp_proc_fin, cpu_v7_proc_fin |
1284 |
++ globl_equ cpu_ca9mp_reset, cpu_v7_reset |
1285 |
++ globl_equ cpu_ca9mp_do_idle, cpu_v7_do_idle |
1286 |
++ globl_equ cpu_ca9mp_dcache_clean_area, cpu_v7_dcache_clean_area |
1287 |
++#ifdef CONFIG_HARDEN_BRANCH_PREDICTOR |
1288 |
++ globl_equ cpu_ca9mp_switch_mm, cpu_v7_bpiall_switch_mm |
1289 |
++#else |
1290 |
++ globl_equ cpu_ca9mp_switch_mm, cpu_v7_switch_mm |
1291 |
++#endif |
1292 |
++ globl_equ cpu_ca9mp_set_pte_ext, cpu_v7_set_pte_ext |
1293 |
++ define_processor_functions ca9mp, dabort=v7_early_abort, pabort=v7_pabort, suspend=1, bugs=cpu_v7_bugs_init |
1294 |
+ #endif |
1295 |
++ |
1296 |
++ @ Cortex-A15 - needs iciallu switch_mm for hardening |
1297 |
++ globl_equ cpu_ca15_proc_init, cpu_v7_proc_init |
1298 |
++ globl_equ cpu_ca15_proc_fin, cpu_v7_proc_fin |
1299 |
++ globl_equ cpu_ca15_reset, cpu_v7_reset |
1300 |
++ globl_equ cpu_ca15_do_idle, cpu_v7_do_idle |
1301 |
++ globl_equ cpu_ca15_dcache_clean_area, cpu_v7_dcache_clean_area |
1302 |
++#ifdef CONFIG_HARDEN_BRANCH_PREDICTOR |
1303 |
++ globl_equ cpu_ca15_switch_mm, cpu_v7_iciallu_switch_mm |
1304 |
++#else |
1305 |
++ globl_equ cpu_ca15_switch_mm, cpu_v7_switch_mm |
1306 |
++#endif |
1307 |
++ globl_equ cpu_ca15_set_pte_ext, cpu_v7_set_pte_ext |
1308 |
++ globl_equ cpu_ca15_suspend_size, cpu_v7_suspend_size |
1309 |
++ globl_equ cpu_ca15_do_suspend, cpu_v7_do_suspend |
1310 |
++ globl_equ cpu_ca15_do_resume, cpu_v7_do_resume |
1311 |
++ define_processor_functions ca15, dabort=v7_early_abort, pabort=v7_pabort, suspend=1, bugs=cpu_v7_ca15_ibe |
1312 |
+ #ifdef CONFIG_CPU_PJ4B |
1313 |
+ define_processor_functions pj4b, dabort=v7_early_abort, pabort=v7_pabort, suspend=1 |
1314 |
+ #endif |
1315 |
+@@ -658,7 +732,7 @@ __v7_ca7mp_proc_info: |
1316 |
+ __v7_ca12mp_proc_info: |
1317 |
+ .long 0x410fc0d0 |
1318 |
+ .long 0xff0ffff0 |
1319 |
+- __v7_proc __v7_ca12mp_proc_info, __v7_ca12mp_setup |
1320 |
++ __v7_proc __v7_ca12mp_proc_info, __v7_ca12mp_setup, proc_fns = HARDENED_BPIALL_PROCESSOR_FUNCTIONS |
1321 |
+ .size __v7_ca12mp_proc_info, . - __v7_ca12mp_proc_info |
1322 |
+ |
1323 |
+ /* |
1324 |
+@@ -668,7 +742,7 @@ __v7_ca12mp_proc_info: |
1325 |
+ __v7_ca15mp_proc_info: |
1326 |
+ .long 0x410fc0f0 |
1327 |
+ .long 0xff0ffff0 |
1328 |
+- __v7_proc __v7_ca15mp_proc_info, __v7_ca15mp_setup |
1329 |
++ __v7_proc __v7_ca15mp_proc_info, __v7_ca15mp_setup, proc_fns = ca15_processor_functions |
1330 |
+ .size __v7_ca15mp_proc_info, . - __v7_ca15mp_proc_info |
1331 |
+ |
1332 |
+ /* |
1333 |
+@@ -678,7 +752,7 @@ __v7_ca15mp_proc_info: |
1334 |
+ __v7_b15mp_proc_info: |
1335 |
+ .long 0x420f00f0 |
1336 |
+ .long 0xff0ffff0 |
1337 |
+- __v7_proc __v7_b15mp_proc_info, __v7_b15mp_setup |
1338 |
++ __v7_proc __v7_b15mp_proc_info, __v7_b15mp_setup, proc_fns = ca15_processor_functions |
1339 |
+ .size __v7_b15mp_proc_info, . - __v7_b15mp_proc_info |
1340 |
+ |
1341 |
+ /* |
1342 |
+@@ -688,9 +762,25 @@ __v7_b15mp_proc_info: |
1343 |
+ __v7_ca17mp_proc_info: |
1344 |
+ .long 0x410fc0e0 |
1345 |
+ .long 0xff0ffff0 |
1346 |
+- __v7_proc __v7_ca17mp_proc_info, __v7_ca17mp_setup |
1347 |
++ __v7_proc __v7_ca17mp_proc_info, __v7_ca17mp_setup, proc_fns = HARDENED_BPIALL_PROCESSOR_FUNCTIONS |
1348 |
+ .size __v7_ca17mp_proc_info, . - __v7_ca17mp_proc_info |
1349 |
+ |
1350 |
++ /* ARM Ltd. Cortex A73 processor */ |
1351 |
++ .type __v7_ca73_proc_info, #object |
1352 |
++__v7_ca73_proc_info: |
1353 |
++ .long 0x410fd090 |
1354 |
++ .long 0xff0ffff0 |
1355 |
++ __v7_proc __v7_ca73_proc_info, __v7_setup, proc_fns = HARDENED_BPIALL_PROCESSOR_FUNCTIONS |
1356 |
++ .size __v7_ca73_proc_info, . - __v7_ca73_proc_info |
1357 |
++ |
1358 |
++ /* ARM Ltd. Cortex A75 processor */ |
1359 |
++ .type __v7_ca75_proc_info, #object |
1360 |
++__v7_ca75_proc_info: |
1361 |
++ .long 0x410fd0a0 |
1362 |
++ .long 0xff0ffff0 |
1363 |
++ __v7_proc __v7_ca75_proc_info, __v7_setup, proc_fns = HARDENED_BPIALL_PROCESSOR_FUNCTIONS |
1364 |
++ .size __v7_ca75_proc_info, . - __v7_ca75_proc_info |
1365 |
++ |
1366 |
+ /* |
1367 |
+ * Qualcomm Inc. Krait processors. |
1368 |
+ */ |
1369 |
+diff --git a/arch/arm/vfp/vfpmodule.c b/arch/arm/vfp/vfpmodule.c |
1370 |
+index aa7496be311d..6abcd4af8274 100644 |
1371 |
+--- a/arch/arm/vfp/vfpmodule.c |
1372 |
++++ b/arch/arm/vfp/vfpmodule.c |
1373 |
+@@ -597,13 +597,11 @@ int vfp_preserve_user_clear_hwstate(struct user_vfp __user *ufp, |
1374 |
+ } |
1375 |
+ |
1376 |
+ /* Sanitise and restore the current VFP state from the provided structures. */ |
1377 |
+-int vfp_restore_user_hwstate(struct user_vfp __user *ufp, |
1378 |
+- struct user_vfp_exc __user *ufp_exc) |
1379 |
++int vfp_restore_user_hwstate(struct user_vfp *ufp, struct user_vfp_exc *ufp_exc) |
1380 |
+ { |
1381 |
+ struct thread_info *thread = current_thread_info(); |
1382 |
+ struct vfp_hard_struct *hwstate = &thread->vfpstate.hard; |
1383 |
+ unsigned long fpexc; |
1384 |
+- int err = 0; |
1385 |
+ |
1386 |
+ /* Disable VFP to avoid corrupting the new thread state. */ |
1387 |
+ vfp_flush_hwstate(thread); |
1388 |
+@@ -612,17 +610,16 @@ int vfp_restore_user_hwstate(struct user_vfp __user *ufp, |
1389 |
+ * Copy the floating point registers. There can be unused |
1390 |
+ * registers see asm/hwcap.h for details. |
1391 |
+ */ |
1392 |
+- err |= __copy_from_user(&hwstate->fpregs, &ufp->fpregs, |
1393 |
+- sizeof(hwstate->fpregs)); |
1394 |
++ memcpy(&hwstate->fpregs, &ufp->fpregs, sizeof(hwstate->fpregs)); |
1395 |
+ /* |
1396 |
+ * Copy the status and control register. |
1397 |
+ */ |
1398 |
+- __get_user_error(hwstate->fpscr, &ufp->fpscr, err); |
1399 |
++ hwstate->fpscr = ufp->fpscr; |
1400 |
+ |
1401 |
+ /* |
1402 |
+ * Sanitise and restore the exception registers. |
1403 |
+ */ |
1404 |
+- __get_user_error(fpexc, &ufp_exc->fpexc, err); |
1405 |
++ fpexc = ufp_exc->fpexc; |
1406 |
+ |
1407 |
+ /* Ensure the VFP is enabled. */ |
1408 |
+ fpexc |= FPEXC_EN; |
1409 |
+@@ -631,10 +628,10 @@ int vfp_restore_user_hwstate(struct user_vfp __user *ufp, |
1410 |
+ fpexc &= ~(FPEXC_EX | FPEXC_FP2V); |
1411 |
+ hwstate->fpexc = fpexc; |
1412 |
+ |
1413 |
+- __get_user_error(hwstate->fpinst, &ufp_exc->fpinst, err); |
1414 |
+- __get_user_error(hwstate->fpinst2, &ufp_exc->fpinst2, err); |
1415 |
++ hwstate->fpinst = ufp_exc->fpinst; |
1416 |
++ hwstate->fpinst2 = ufp_exc->fpinst2; |
1417 |
+ |
1418 |
+- return err ? -EFAULT : 0; |
1419 |
++ return 0; |
1420 |
+ } |
1421 |
+ |
1422 |
+ /* |
1423 |
+diff --git a/arch/arm64/kernel/perf_event.c b/arch/arm64/kernel/perf_event.c |
1424 |
+index 1984e739f155..86249a24592d 100644 |
1425 |
+--- a/arch/arm64/kernel/perf_event.c |
1426 |
++++ b/arch/arm64/kernel/perf_event.c |
1427 |
+@@ -824,6 +824,12 @@ static int armv8pmu_set_event_filter(struct hw_perf_event *event, |
1428 |
+ return 0; |
1429 |
+ } |
1430 |
+ |
1431 |
++static int armv8pmu_filter_match(struct perf_event *event) |
1432 |
++{ |
1433 |
++ unsigned long evtype = event->hw.config_base & ARMV8_PMU_EVTYPE_EVENT; |
1434 |
++ return evtype != ARMV8_PMUV3_PERFCTR_CHAIN; |
1435 |
++} |
1436 |
++ |
1437 |
+ static void armv8pmu_reset(void *info) |
1438 |
+ { |
1439 |
+ struct arm_pmu *cpu_pmu = (struct arm_pmu *)info; |
1440 |
+@@ -970,6 +976,7 @@ static int armv8_pmu_init(struct arm_pmu *cpu_pmu) |
1441 |
+ cpu_pmu->reset = armv8pmu_reset, |
1442 |
+ cpu_pmu->max_period = (1LLU << 32) - 1, |
1443 |
+ cpu_pmu->set_event_filter = armv8pmu_set_event_filter; |
1444 |
++ cpu_pmu->filter_match = armv8pmu_filter_match; |
1445 |
+ |
1446 |
+ return 0; |
1447 |
+ } |
1448 |
+diff --git a/arch/mips/include/asm/processor.h b/arch/mips/include/asm/processor.h |
1449 |
+index eb1f6030ab85..8bbbab611a3f 100644 |
1450 |
+--- a/arch/mips/include/asm/processor.h |
1451 |
++++ b/arch/mips/include/asm/processor.h |
1452 |
+@@ -13,6 +13,7 @@ |
1453 |
+ |
1454 |
+ #include <linux/atomic.h> |
1455 |
+ #include <linux/cpumask.h> |
1456 |
++#include <linux/sizes.h> |
1457 |
+ #include <linux/threads.h> |
1458 |
+ |
1459 |
+ #include <asm/cachectl.h> |
1460 |
+@@ -80,11 +81,10 @@ extern unsigned int vced_count, vcei_count; |
1461 |
+ |
1462 |
+ #endif |
1463 |
+ |
1464 |
+-/* |
1465 |
+- * One page above the stack is used for branch delay slot "emulation". |
1466 |
+- * See dsemul.c for details. |
1467 |
+- */ |
1468 |
+-#define STACK_TOP ((TASK_SIZE & PAGE_MASK) - PAGE_SIZE) |
1469 |
++#define VDSO_RANDOMIZE_SIZE (TASK_IS_32BIT_ADDR ? SZ_1M : SZ_256M) |
1470 |
++ |
1471 |
++extern unsigned long mips_stack_top(void); |
1472 |
++#define STACK_TOP mips_stack_top() |
1473 |
+ |
1474 |
+ /* |
1475 |
+ * This decides where the kernel will search for a free chunk of vm |
1476 |
+diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c |
1477 |
+index e8d772a2597d..e8b166e9146a 100644 |
1478 |
+--- a/arch/mips/kernel/process.c |
1479 |
++++ b/arch/mips/kernel/process.c |
1480 |
+@@ -31,6 +31,7 @@ |
1481 |
+ #include <linux/prctl.h> |
1482 |
+ #include <linux/nmi.h> |
1483 |
+ |
1484 |
++#include <asm/abi.h> |
1485 |
+ #include <asm/asm.h> |
1486 |
+ #include <asm/bootinfo.h> |
1487 |
+ #include <asm/cpu.h> |
1488 |
+@@ -38,6 +39,7 @@ |
1489 |
+ #include <asm/dsp.h> |
1490 |
+ #include <asm/fpu.h> |
1491 |
+ #include <asm/irq.h> |
1492 |
++#include <asm/mips-cps.h> |
1493 |
+ #include <asm/msa.h> |
1494 |
+ #include <asm/pgtable.h> |
1495 |
+ #include <asm/mipsregs.h> |
1496 |
+@@ -644,6 +646,29 @@ out: |
1497 |
+ return pc; |
1498 |
+ } |
1499 |
+ |
1500 |
++unsigned long mips_stack_top(void) |
1501 |
++{ |
1502 |
++ unsigned long top = TASK_SIZE & PAGE_MASK; |
1503 |
++ |
1504 |
++ /* One page for branch delay slot "emulation" */ |
1505 |
++ top -= PAGE_SIZE; |
1506 |
++ |
1507 |
++ /* Space for the VDSO, data page & GIC user page */ |
1508 |
++ top -= PAGE_ALIGN(current->thread.abi->vdso->size); |
1509 |
++ top -= PAGE_SIZE; |
1510 |
++ top -= mips_gic_present() ? PAGE_SIZE : 0; |
1511 |
++ |
1512 |
++ /* Space for cache colour alignment */ |
1513 |
++ if (cpu_has_dc_aliases) |
1514 |
++ top -= shm_align_mask + 1; |
1515 |
++ |
1516 |
++ /* Space to randomize the VDSO base */ |
1517 |
++ if (current->flags & PF_RANDOMIZE) |
1518 |
++ top -= VDSO_RANDOMIZE_SIZE; |
1519 |
++ |
1520 |
++ return top; |
1521 |
++} |
1522 |
++ |
1523 |
+ /* |
1524 |
+ * Don't forget that the stack pointer must be aligned on a 8 bytes |
1525 |
+ * boundary for 32-bits ABI and 16 bytes for 64-bits ABI. |
1526 |
+diff --git a/arch/mips/kernel/vdso.c b/arch/mips/kernel/vdso.c |
1527 |
+index 8f845f6e5f42..48a9c6b90e07 100644 |
1528 |
+--- a/arch/mips/kernel/vdso.c |
1529 |
++++ b/arch/mips/kernel/vdso.c |
1530 |
+@@ -15,6 +15,7 @@ |
1531 |
+ #include <linux/ioport.h> |
1532 |
+ #include <linux/kernel.h> |
1533 |
+ #include <linux/mm.h> |
1534 |
++#include <linux/random.h> |
1535 |
+ #include <linux/sched.h> |
1536 |
+ #include <linux/slab.h> |
1537 |
+ #include <linux/timekeeper_internal.h> |
1538 |
+@@ -97,6 +98,21 @@ void update_vsyscall_tz(void) |
1539 |
+ } |
1540 |
+ } |
1541 |
+ |
1542 |
++static unsigned long vdso_base(void) |
1543 |
++{ |
1544 |
++ unsigned long base; |
1545 |
++ |
1546 |
++ /* Skip the delay slot emulation page */ |
1547 |
++ base = STACK_TOP + PAGE_SIZE; |
1548 |
++ |
1549 |
++ if (current->flags & PF_RANDOMIZE) { |
1550 |
++ base += get_random_int() & (VDSO_RANDOMIZE_SIZE - 1); |
1551 |
++ base = PAGE_ALIGN(base); |
1552 |
++ } |
1553 |
++ |
1554 |
++ return base; |
1555 |
++} |
1556 |
++ |
1557 |
+ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp) |
1558 |
+ { |
1559 |
+ struct mips_vdso_image *image = current->thread.abi->vdso; |
1560 |
+@@ -137,7 +153,7 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp) |
1561 |
+ if (cpu_has_dc_aliases) |
1562 |
+ size += shm_align_mask + 1; |
1563 |
+ |
1564 |
+- base = get_unmapped_area(NULL, 0, size, 0, 0); |
1565 |
++ base = get_unmapped_area(NULL, vdso_base(), size, 0, 0); |
1566 |
+ if (IS_ERR_VALUE(base)) { |
1567 |
+ ret = base; |
1568 |
+ goto out; |
1569 |
+diff --git a/arch/powerpc/include/asm/book3s/64/pgtable.h b/arch/powerpc/include/asm/book3s/64/pgtable.h |
1570 |
+index 9a677cd5997f..4dd13b503dbb 100644 |
1571 |
+--- a/arch/powerpc/include/asm/book3s/64/pgtable.h |
1572 |
++++ b/arch/powerpc/include/asm/book3s/64/pgtable.h |
1573 |
+@@ -102,7 +102,7 @@ |
1574 |
+ */ |
1575 |
+ #define _HPAGE_CHG_MASK (PTE_RPN_MASK | _PAGE_HPTEFLAGS | _PAGE_DIRTY | \ |
1576 |
+ _PAGE_ACCESSED | H_PAGE_THP_HUGE | _PAGE_PTE | \ |
1577 |
+- _PAGE_SOFT_DIRTY) |
1578 |
++ _PAGE_SOFT_DIRTY | _PAGE_DEVMAP) |
1579 |
+ /* |
1580 |
+ * user access blocked by key |
1581 |
+ */ |
1582 |
+@@ -120,7 +120,7 @@ |
1583 |
+ */ |
1584 |
+ #define _PAGE_CHG_MASK (PTE_RPN_MASK | _PAGE_HPTEFLAGS | _PAGE_DIRTY | \ |
1585 |
+ _PAGE_ACCESSED | _PAGE_SPECIAL | _PAGE_PTE | \ |
1586 |
+- _PAGE_SOFT_DIRTY) |
1587 |
++ _PAGE_SOFT_DIRTY | _PAGE_DEVMAP) |
1588 |
+ /* |
1589 |
+ * Mask of bits returned by pte_pgprot() |
1590 |
+ */ |
1591 |
+diff --git a/arch/x86/include/asm/pgtable_types.h b/arch/x86/include/asm/pgtable_types.h |
1592 |
+index 246f15b4e64c..85f8279c885a 100644 |
1593 |
+--- a/arch/x86/include/asm/pgtable_types.h |
1594 |
++++ b/arch/x86/include/asm/pgtable_types.h |
1595 |
+@@ -124,7 +124,7 @@ |
1596 |
+ */ |
1597 |
+ #define _PAGE_CHG_MASK (PTE_PFN_MASK | _PAGE_PCD | _PAGE_PWT | \ |
1598 |
+ _PAGE_SPECIAL | _PAGE_ACCESSED | _PAGE_DIRTY | \ |
1599 |
+- _PAGE_SOFT_DIRTY) |
1600 |
++ _PAGE_SOFT_DIRTY | _PAGE_DEVMAP) |
1601 |
+ #define _HPAGE_CHG_MASK (_PAGE_CHG_MASK | _PAGE_PSE) |
1602 |
+ |
1603 |
+ /* |
1604 |
+diff --git a/arch/x86/include/uapi/asm/kvm.h b/arch/x86/include/uapi/asm/kvm.h |
1605 |
+index f3a960488eae..dcf4dc9bf327 100644 |
1606 |
+--- a/arch/x86/include/uapi/asm/kvm.h |
1607 |
++++ b/arch/x86/include/uapi/asm/kvm.h |
1608 |
+@@ -360,5 +360,6 @@ struct kvm_sync_regs { |
1609 |
+ |
1610 |
+ #define KVM_X86_QUIRK_LINT0_REENABLED (1 << 0) |
1611 |
+ #define KVM_X86_QUIRK_CD_NW_CLEARED (1 << 1) |
1612 |
++#define KVM_X86_QUIRK_LAPIC_MMIO_HOLE (1 << 2) |
1613 |
+ |
1614 |
+ #endif /* _ASM_X86_KVM_H */ |
1615 |
+diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c |
1616 |
+index 6d0fbff71d7a..13dfb55b84db 100644 |
1617 |
+--- a/arch/x86/kvm/lapic.c |
1618 |
++++ b/arch/x86/kvm/lapic.c |
1619 |
+@@ -1282,9 +1282,8 @@ EXPORT_SYMBOL_GPL(kvm_lapic_reg_read); |
1620 |
+ |
1621 |
+ static int apic_mmio_in_range(struct kvm_lapic *apic, gpa_t addr) |
1622 |
+ { |
1623 |
+- return kvm_apic_hw_enabled(apic) && |
1624 |
+- addr >= apic->base_address && |
1625 |
+- addr < apic->base_address + LAPIC_MMIO_LENGTH; |
1626 |
++ return addr >= apic->base_address && |
1627 |
++ addr < apic->base_address + LAPIC_MMIO_LENGTH; |
1628 |
+ } |
1629 |
+ |
1630 |
+ static int apic_mmio_read(struct kvm_vcpu *vcpu, struct kvm_io_device *this, |
1631 |
+@@ -1296,6 +1295,15 @@ static int apic_mmio_read(struct kvm_vcpu *vcpu, struct kvm_io_device *this, |
1632 |
+ if (!apic_mmio_in_range(apic, address)) |
1633 |
+ return -EOPNOTSUPP; |
1634 |
+ |
1635 |
++ if (!kvm_apic_hw_enabled(apic) || apic_x2apic_mode(apic)) { |
1636 |
++ if (!kvm_check_has_quirk(vcpu->kvm, |
1637 |
++ KVM_X86_QUIRK_LAPIC_MMIO_HOLE)) |
1638 |
++ return -EOPNOTSUPP; |
1639 |
++ |
1640 |
++ memset(data, 0xff, len); |
1641 |
++ return 0; |
1642 |
++ } |
1643 |
++ |
1644 |
+ kvm_lapic_reg_read(apic, offset, len, data); |
1645 |
+ |
1646 |
+ return 0; |
1647 |
+@@ -1806,6 +1814,14 @@ static int apic_mmio_write(struct kvm_vcpu *vcpu, struct kvm_io_device *this, |
1648 |
+ if (!apic_mmio_in_range(apic, address)) |
1649 |
+ return -EOPNOTSUPP; |
1650 |
+ |
1651 |
++ if (!kvm_apic_hw_enabled(apic) || apic_x2apic_mode(apic)) { |
1652 |
++ if (!kvm_check_has_quirk(vcpu->kvm, |
1653 |
++ KVM_X86_QUIRK_LAPIC_MMIO_HOLE)) |
1654 |
++ return -EOPNOTSUPP; |
1655 |
++ |
1656 |
++ return 0; |
1657 |
++ } |
1658 |
++ |
1659 |
+ /* |
1660 |
+ * APIC register must be aligned on 128-bits boundary. |
1661 |
+ * 32/64/128 bits registers must be accessed thru 32 bits. |
1662 |
+diff --git a/drivers/bluetooth/hci_ldisc.c b/drivers/bluetooth/hci_ldisc.c |
1663 |
+index c823914b3a80..30bbe19b4b85 100644 |
1664 |
+--- a/drivers/bluetooth/hci_ldisc.c |
1665 |
++++ b/drivers/bluetooth/hci_ldisc.c |
1666 |
+@@ -539,6 +539,8 @@ static void hci_uart_tty_close(struct tty_struct *tty) |
1667 |
+ } |
1668 |
+ clear_bit(HCI_UART_PROTO_SET, &hu->flags); |
1669 |
+ |
1670 |
++ percpu_free_rwsem(&hu->proto_lock); |
1671 |
++ |
1672 |
+ kfree(hu); |
1673 |
+ } |
1674 |
+ |
1675 |
+diff --git a/drivers/clk/x86/clk-pmc-atom.c b/drivers/clk/x86/clk-pmc-atom.c |
1676 |
+index 08ef69945ffb..d977193842df 100644 |
1677 |
+--- a/drivers/clk/x86/clk-pmc-atom.c |
1678 |
++++ b/drivers/clk/x86/clk-pmc-atom.c |
1679 |
+@@ -55,6 +55,7 @@ struct clk_plt_data { |
1680 |
+ u8 nparents; |
1681 |
+ struct clk_plt *clks[PMC_CLK_NUM]; |
1682 |
+ struct clk_lookup *mclk_lookup; |
1683 |
++ struct clk_lookup *ether_clk_lookup; |
1684 |
+ }; |
1685 |
+ |
1686 |
+ /* Return an index in parent table */ |
1687 |
+@@ -186,13 +187,6 @@ static struct clk_plt *plt_clk_register(struct platform_device *pdev, int id, |
1688 |
+ pclk->reg = base + PMC_CLK_CTL_OFFSET + id * PMC_CLK_CTL_SIZE; |
1689 |
+ spin_lock_init(&pclk->lock); |
1690 |
+ |
1691 |
+- /* |
1692 |
+- * If the clock was already enabled by the firmware mark it as critical |
1693 |
+- * to avoid it being gated by the clock framework if no driver owns it. |
1694 |
+- */ |
1695 |
+- if (plt_clk_is_enabled(&pclk->hw)) |
1696 |
+- init.flags |= CLK_IS_CRITICAL; |
1697 |
+- |
1698 |
+ ret = devm_clk_hw_register(&pdev->dev, &pclk->hw); |
1699 |
+ if (ret) { |
1700 |
+ pclk = ERR_PTR(ret); |
1701 |
+@@ -351,11 +345,20 @@ static int plt_clk_probe(struct platform_device *pdev) |
1702 |
+ goto err_unreg_clk_plt; |
1703 |
+ } |
1704 |
+ |
1705 |
++ data->ether_clk_lookup = clkdev_hw_create(&data->clks[4]->hw, |
1706 |
++ "ether_clk", NULL); |
1707 |
++ if (!data->ether_clk_lookup) { |
1708 |
++ err = -ENOMEM; |
1709 |
++ goto err_drop_mclk; |
1710 |
++ } |
1711 |
++ |
1712 |
+ plt_clk_free_parent_names_loop(parent_names, data->nparents); |
1713 |
+ |
1714 |
+ platform_set_drvdata(pdev, data); |
1715 |
+ return 0; |
1716 |
+ |
1717 |
++err_drop_mclk: |
1718 |
++ clkdev_drop(data->mclk_lookup); |
1719 |
+ err_unreg_clk_plt: |
1720 |
+ plt_clk_unregister_loop(data, i); |
1721 |
+ plt_clk_unregister_parents(data); |
1722 |
+@@ -369,6 +372,7 @@ static int plt_clk_remove(struct platform_device *pdev) |
1723 |
+ |
1724 |
+ data = platform_get_drvdata(pdev); |
1725 |
+ |
1726 |
++ clkdev_drop(data->ether_clk_lookup); |
1727 |
+ clkdev_drop(data->mclk_lookup); |
1728 |
+ plt_clk_unregister_loop(data, PMC_CLK_NUM); |
1729 |
+ plt_clk_unregister_parents(data); |
1730 |
+diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v7.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v7.c |
1731 |
+index bdabaa3399db..e2c0ff03f386 100644 |
1732 |
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v7.c |
1733 |
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v7.c |
1734 |
+@@ -576,7 +576,7 @@ static int kgd_hqd_sdma_destroy(struct kgd_dev *kgd, void *mqd, |
1735 |
+ |
1736 |
+ while (true) { |
1737 |
+ temp = RREG32(sdma_base_addr + mmSDMA0_RLC0_CONTEXT_STATUS); |
1738 |
+- if (temp & SDMA0_STATUS_REG__RB_CMD_IDLE__SHIFT) |
1739 |
++ if (temp & SDMA0_RLC0_CONTEXT_STATUS__IDLE_MASK) |
1740 |
+ break; |
1741 |
+ if (timeout <= 0) |
1742 |
+ return -ETIME; |
1743 |
+diff --git a/drivers/i2c/busses/i2c-scmi.c b/drivers/i2c/busses/i2c-scmi.c |
1744 |
+index 7aa7b9cb6203..efefcfa24a4c 100644 |
1745 |
+--- a/drivers/i2c/busses/i2c-scmi.c |
1746 |
++++ b/drivers/i2c/busses/i2c-scmi.c |
1747 |
+@@ -152,6 +152,7 @@ acpi_smbus_cmi_access(struct i2c_adapter *adap, u16 addr, unsigned short flags, |
1748 |
+ mt_params[3].type = ACPI_TYPE_INTEGER; |
1749 |
+ mt_params[3].integer.value = len; |
1750 |
+ mt_params[4].type = ACPI_TYPE_BUFFER; |
1751 |
++ mt_params[4].buffer.length = len; |
1752 |
+ mt_params[4].buffer.pointer = data->block + 1; |
1753 |
+ } |
1754 |
+ break; |
1755 |
+diff --git a/drivers/md/dm-cache-target.c b/drivers/md/dm-cache-target.c |
1756 |
+index e2ea57d5376e..b5f541112fca 100644 |
1757 |
+--- a/drivers/md/dm-cache-target.c |
1758 |
++++ b/drivers/md/dm-cache-target.c |
1759 |
+@@ -3571,14 +3571,13 @@ static int __init dm_cache_init(void) |
1760 |
+ int r; |
1761 |
+ |
1762 |
+ migration_cache = KMEM_CACHE(dm_cache_migration, 0); |
1763 |
+- if (!migration_cache) { |
1764 |
+- dm_unregister_target(&cache_target); |
1765 |
++ if (!migration_cache) |
1766 |
+ return -ENOMEM; |
1767 |
+- } |
1768 |
+ |
1769 |
+ r = dm_register_target(&cache_target); |
1770 |
+ if (r) { |
1771 |
+ DMERR("cache target registration failed: %d", r); |
1772 |
++ kmem_cache_destroy(migration_cache); |
1773 |
+ return r; |
1774 |
+ } |
1775 |
+ |
1776 |
+diff --git a/drivers/md/dm-flakey.c b/drivers/md/dm-flakey.c |
1777 |
+index b82cb1ab1eaa..0c1ef63c3461 100644 |
1778 |
+--- a/drivers/md/dm-flakey.c |
1779 |
++++ b/drivers/md/dm-flakey.c |
1780 |
+@@ -463,7 +463,9 @@ static int flakey_iterate_devices(struct dm_target *ti, iterate_devices_callout_ |
1781 |
+ static struct target_type flakey_target = { |
1782 |
+ .name = "flakey", |
1783 |
+ .version = {1, 5, 0}, |
1784 |
++#ifdef CONFIG_BLK_DEV_ZONED |
1785 |
+ .features = DM_TARGET_ZONED_HM, |
1786 |
++#endif |
1787 |
+ .module = THIS_MODULE, |
1788 |
+ .ctr = flakey_ctr, |
1789 |
+ .dtr = flakey_dtr, |
1790 |
+diff --git a/drivers/md/dm-linear.c b/drivers/md/dm-linear.c |
1791 |
+index d5f8eff7c11d..a53de71bc30c 100644 |
1792 |
+--- a/drivers/md/dm-linear.c |
1793 |
++++ b/drivers/md/dm-linear.c |
1794 |
+@@ -101,6 +101,7 @@ static int linear_map(struct dm_target *ti, struct bio *bio) |
1795 |
+ return DM_MAPIO_REMAPPED; |
1796 |
+ } |
1797 |
+ |
1798 |
++#ifdef CONFIG_BLK_DEV_ZONED |
1799 |
+ static int linear_end_io(struct dm_target *ti, struct bio *bio, |
1800 |
+ blk_status_t *error) |
1801 |
+ { |
1802 |
+@@ -111,6 +112,7 @@ static int linear_end_io(struct dm_target *ti, struct bio *bio, |
1803 |
+ |
1804 |
+ return DM_ENDIO_DONE; |
1805 |
+ } |
1806 |
++#endif |
1807 |
+ |
1808 |
+ static void linear_status(struct dm_target *ti, status_type_t type, |
1809 |
+ unsigned status_flags, char *result, unsigned maxlen) |
1810 |
+@@ -187,12 +189,16 @@ static size_t linear_dax_copy_from_iter(struct dm_target *ti, pgoff_t pgoff, |
1811 |
+ static struct target_type linear_target = { |
1812 |
+ .name = "linear", |
1813 |
+ .version = {1, 4, 0}, |
1814 |
++#ifdef CONFIG_BLK_DEV_ZONED |
1815 |
++ .end_io = linear_end_io, |
1816 |
+ .features = DM_TARGET_PASSES_INTEGRITY | DM_TARGET_ZONED_HM, |
1817 |
++#else |
1818 |
++ .features = DM_TARGET_PASSES_INTEGRITY, |
1819 |
++#endif |
1820 |
+ .module = THIS_MODULE, |
1821 |
+ .ctr = linear_ctr, |
1822 |
+ .dtr = linear_dtr, |
1823 |
+ .map = linear_map, |
1824 |
+- .end_io = linear_end_io, |
1825 |
+ .status = linear_status, |
1826 |
+ .prepare_ioctl = linear_prepare_ioctl, |
1827 |
+ .iterate_devices = linear_iterate_devices, |
1828 |
+diff --git a/drivers/md/dm.c b/drivers/md/dm.c |
1829 |
+index 24ec6e039448..a56008b2e7c2 100644 |
1830 |
+--- a/drivers/md/dm.c |
1831 |
++++ b/drivers/md/dm.c |
1832 |
+@@ -1034,12 +1034,14 @@ void dm_accept_partial_bio(struct bio *bio, unsigned n_sectors) |
1833 |
+ EXPORT_SYMBOL_GPL(dm_accept_partial_bio); |
1834 |
+ |
1835 |
+ /* |
1836 |
+- * The zone descriptors obtained with a zone report indicate |
1837 |
+- * zone positions within the target device. The zone descriptors |
1838 |
+- * must be remapped to match their position within the dm device. |
1839 |
+- * A target may call dm_remap_zone_report after completion of a |
1840 |
+- * REQ_OP_ZONE_REPORT bio to remap the zone descriptors obtained |
1841 |
+- * from the target device mapping to the dm device. |
1842 |
++ * The zone descriptors obtained with a zone report indicate zone positions |
1843 |
++ * within the target backing device, regardless of that device is a partition |
1844 |
++ * and regardless of the target mapping start sector on the device or partition. |
1845 |
++ * The zone descriptors start sector and write pointer position must be adjusted |
1846 |
++ * to match their relative position within the dm device. |
1847 |
++ * A target may call dm_remap_zone_report() after completion of a |
1848 |
++ * REQ_OP_ZONE_REPORT bio to remap the zone descriptors obtained from the |
1849 |
++ * backing device. |
1850 |
+ */ |
1851 |
+ void dm_remap_zone_report(struct dm_target *ti, struct bio *bio, sector_t start) |
1852 |
+ { |
1853 |
+@@ -1050,6 +1052,7 @@ void dm_remap_zone_report(struct dm_target *ti, struct bio *bio, sector_t start) |
1854 |
+ struct blk_zone *zone; |
1855 |
+ unsigned int nr_rep = 0; |
1856 |
+ unsigned int ofst; |
1857 |
++ sector_t part_offset; |
1858 |
+ struct bio_vec bvec; |
1859 |
+ struct bvec_iter iter; |
1860 |
+ void *addr; |
1861 |
+@@ -1057,6 +1060,15 @@ void dm_remap_zone_report(struct dm_target *ti, struct bio *bio, sector_t start) |
1862 |
+ if (bio->bi_status) |
1863 |
+ return; |
1864 |
+ |
1865 |
++ /* |
1866 |
++ * bio sector was incremented by the request size on completion. Taking |
1867 |
++ * into account the original request sector, the target start offset on |
1868 |
++ * the backing device and the target mapping offset (ti->begin), the |
1869 |
++ * start sector of the backing device. The partition offset is always 0 |
1870 |
++ * if the target uses a whole device. |
1871 |
++ */ |
1872 |
++ part_offset = bio->bi_iter.bi_sector + ti->begin - (start + bio_end_sector(report_bio)); |
1873 |
++ |
1874 |
+ /* |
1875 |
+ * Remap the start sector of the reported zones. For sequential zones, |
1876 |
+ * also remap the write pointer position. |
1877 |
+@@ -1074,6 +1086,7 @@ void dm_remap_zone_report(struct dm_target *ti, struct bio *bio, sector_t start) |
1878 |
+ /* Set zones start sector */ |
1879 |
+ while (hdr->nr_zones && ofst < bvec.bv_len) { |
1880 |
+ zone = addr + ofst; |
1881 |
++ zone->start -= part_offset; |
1882 |
+ if (zone->start >= start + ti->len) { |
1883 |
+ hdr->nr_zones = 0; |
1884 |
+ break; |
1885 |
+@@ -1085,7 +1098,7 @@ void dm_remap_zone_report(struct dm_target *ti, struct bio *bio, sector_t start) |
1886 |
+ else if (zone->cond == BLK_ZONE_COND_EMPTY) |
1887 |
+ zone->wp = zone->start; |
1888 |
+ else |
1889 |
+- zone->wp = zone->wp + ti->begin - start; |
1890 |
++ zone->wp = zone->wp + ti->begin - start - part_offset; |
1891 |
+ } |
1892 |
+ ofst += sizeof(struct blk_zone); |
1893 |
+ hdr->nr_zones--; |
1894 |
+diff --git a/drivers/mfd/omap-usb-host.c b/drivers/mfd/omap-usb-host.c |
1895 |
+index 7aab376ecb84..3785c638d530 100644 |
1896 |
+--- a/drivers/mfd/omap-usb-host.c |
1897 |
++++ b/drivers/mfd/omap-usb-host.c |
1898 |
+@@ -548,8 +548,8 @@ static int usbhs_omap_get_dt_pdata(struct device *dev, |
1899 |
+ } |
1900 |
+ |
1901 |
+ static const struct of_device_id usbhs_child_match_table[] = { |
1902 |
+- { .compatible = "ti,omap-ehci", }, |
1903 |
+- { .compatible = "ti,omap-ohci", }, |
1904 |
++ { .compatible = "ti,ehci-omap", }, |
1905 |
++ { .compatible = "ti,ohci-omap3", }, |
1906 |
+ { } |
1907 |
+ }; |
1908 |
+ |
1909 |
+@@ -875,6 +875,7 @@ static struct platform_driver usbhs_omap_driver = { |
1910 |
+ .pm = &usbhsomap_dev_pm_ops, |
1911 |
+ .of_match_table = usbhs_omap_dt_ids, |
1912 |
+ }, |
1913 |
++ .probe = usbhs_omap_probe, |
1914 |
+ .remove = usbhs_omap_remove, |
1915 |
+ }; |
1916 |
+ |
1917 |
+@@ -884,9 +885,9 @@ MODULE_ALIAS("platform:" USBHS_DRIVER_NAME); |
1918 |
+ MODULE_LICENSE("GPL v2"); |
1919 |
+ MODULE_DESCRIPTION("usb host common core driver for omap EHCI and OHCI"); |
1920 |
+ |
1921 |
+-static int __init omap_usbhs_drvinit(void) |
1922 |
++static int omap_usbhs_drvinit(void) |
1923 |
+ { |
1924 |
+- return platform_driver_probe(&usbhs_omap_driver, usbhs_omap_probe); |
1925 |
++ return platform_driver_register(&usbhs_omap_driver); |
1926 |
+ } |
1927 |
+ |
1928 |
+ /* |
1929 |
+@@ -898,7 +899,7 @@ static int __init omap_usbhs_drvinit(void) |
1930 |
+ */ |
1931 |
+ fs_initcall_sync(omap_usbhs_drvinit); |
1932 |
+ |
1933 |
+-static void __exit omap_usbhs_drvexit(void) |
1934 |
++static void omap_usbhs_drvexit(void) |
1935 |
+ { |
1936 |
+ platform_driver_unregister(&usbhs_omap_driver); |
1937 |
+ } |
1938 |
+diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c |
1939 |
+index 4281fdc0a13c..ce6dd49fbb98 100644 |
1940 |
+--- a/drivers/mmc/core/block.c |
1941 |
++++ b/drivers/mmc/core/block.c |
1942 |
+@@ -1613,6 +1613,16 @@ static void mmc_blk_data_prep(struct mmc_queue *mq, struct mmc_queue_req *mqrq, |
1943 |
+ brq->data.blocks = card->host->max_blk_count; |
1944 |
+ |
1945 |
+ if (brq->data.blocks > 1) { |
1946 |
++ /* |
1947 |
++ * Some SD cards in SPI mode return a CRC error or even lock up |
1948 |
++ * completely when trying to read the last block using a |
1949 |
++ * multiblock read command. |
1950 |
++ */ |
1951 |
++ if (mmc_host_is_spi(card->host) && (rq_data_dir(req) == READ) && |
1952 |
++ (blk_rq_pos(req) + blk_rq_sectors(req) == |
1953 |
++ get_capacity(md->disk))) |
1954 |
++ brq->data.blocks--; |
1955 |
++ |
1956 |
+ /* |
1957 |
+ * After a read error, we redo the request one sector |
1958 |
+ * at a time in order to accurately determine which |
1959 |
+diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c |
1960 |
+index 15aedb64a02b..cf64a365362b 100644 |
1961 |
+--- a/drivers/net/bonding/bond_main.c |
1962 |
++++ b/drivers/net/bonding/bond_main.c |
1963 |
+@@ -210,6 +210,7 @@ static void bond_get_stats(struct net_device *bond_dev, |
1964 |
+ static void bond_slave_arr_handler(struct work_struct *work); |
1965 |
+ static bool bond_time_in_interval(struct bonding *bond, unsigned long last_act, |
1966 |
+ int mod); |
1967 |
++static void bond_netdev_notify_work(struct work_struct *work); |
1968 |
+ |
1969 |
+ /*---------------------------- General routines -----------------------------*/ |
1970 |
+ |
1971 |
+@@ -1176,9 +1177,27 @@ static rx_handler_result_t bond_handle_frame(struct sk_buff **pskb) |
1972 |
+ } |
1973 |
+ } |
1974 |
+ |
1975 |
+- /* don't change skb->dev for link-local packets */ |
1976 |
+- if (is_link_local_ether_addr(eth_hdr(skb)->h_dest)) |
1977 |
++ /* Link-local multicast packets should be passed to the |
1978 |
++ * stack on the link they arrive as well as pass them to the |
1979 |
++ * bond-master device. These packets are mostly usable when |
1980 |
++ * stack receives it with the link on which they arrive |
1981 |
++ * (e.g. LLDP) they also must be available on master. Some of |
1982 |
++ * the use cases include (but are not limited to): LLDP agents |
1983 |
++ * that must be able to operate both on enslaved interfaces as |
1984 |
++ * well as on bonds themselves; linux bridges that must be able |
1985 |
++ * to process/pass BPDUs from attached bonds when any kind of |
1986 |
++ * STP version is enabled on the network. |
1987 |
++ */ |
1988 |
++ if (is_link_local_ether_addr(eth_hdr(skb)->h_dest)) { |
1989 |
++ struct sk_buff *nskb = skb_clone(skb, GFP_ATOMIC); |
1990 |
++ |
1991 |
++ if (nskb) { |
1992 |
++ nskb->dev = bond->dev; |
1993 |
++ nskb->queue_mapping = 0; |
1994 |
++ netif_rx(nskb); |
1995 |
++ } |
1996 |
+ return RX_HANDLER_PASS; |
1997 |
++ } |
1998 |
+ if (bond_should_deliver_exact_match(skb, slave, bond)) |
1999 |
+ return RX_HANDLER_EXACT; |
2000 |
+ |
2001 |
+@@ -1254,6 +1273,8 @@ static struct slave *bond_alloc_slave(struct bonding *bond) |
2002 |
+ return NULL; |
2003 |
+ } |
2004 |
+ } |
2005 |
++ INIT_DELAYED_WORK(&slave->notify_work, bond_netdev_notify_work); |
2006 |
++ |
2007 |
+ return slave; |
2008 |
+ } |
2009 |
+ |
2010 |
+@@ -1261,6 +1282,7 @@ static void bond_free_slave(struct slave *slave) |
2011 |
+ { |
2012 |
+ struct bonding *bond = bond_get_bond_by_slave(slave); |
2013 |
+ |
2014 |
++ cancel_delayed_work_sync(&slave->notify_work); |
2015 |
+ if (BOND_MODE(bond) == BOND_MODE_8023AD) |
2016 |
+ kfree(SLAVE_AD_INFO(slave)); |
2017 |
+ |
2018 |
+@@ -1282,39 +1304,26 @@ static void bond_fill_ifslave(struct slave *slave, struct ifslave *info) |
2019 |
+ info->link_failure_count = slave->link_failure_count; |
2020 |
+ } |
2021 |
+ |
2022 |
+-static void bond_netdev_notify(struct net_device *dev, |
2023 |
+- struct netdev_bonding_info *info) |
2024 |
+-{ |
2025 |
+- rtnl_lock(); |
2026 |
+- netdev_bonding_info_change(dev, info); |
2027 |
+- rtnl_unlock(); |
2028 |
+-} |
2029 |
+- |
2030 |
+ static void bond_netdev_notify_work(struct work_struct *_work) |
2031 |
+ { |
2032 |
+- struct netdev_notify_work *w = |
2033 |
+- container_of(_work, struct netdev_notify_work, work.work); |
2034 |
++ struct slave *slave = container_of(_work, struct slave, |
2035 |
++ notify_work.work); |
2036 |
++ |
2037 |
++ if (rtnl_trylock()) { |
2038 |
++ struct netdev_bonding_info binfo; |
2039 |
+ |
2040 |
+- bond_netdev_notify(w->dev, &w->bonding_info); |
2041 |
+- dev_put(w->dev); |
2042 |
+- kfree(w); |
2043 |
++ bond_fill_ifslave(slave, &binfo.slave); |
2044 |
++ bond_fill_ifbond(slave->bond, &binfo.master); |
2045 |
++ netdev_bonding_info_change(slave->dev, &binfo); |
2046 |
++ rtnl_unlock(); |
2047 |
++ } else { |
2048 |
++ queue_delayed_work(slave->bond->wq, &slave->notify_work, 1); |
2049 |
++ } |
2050 |
+ } |
2051 |
+ |
2052 |
+ void bond_queue_slave_event(struct slave *slave) |
2053 |
+ { |
2054 |
+- struct bonding *bond = slave->bond; |
2055 |
+- struct netdev_notify_work *nnw = kzalloc(sizeof(*nnw), GFP_ATOMIC); |
2056 |
+- |
2057 |
+- if (!nnw) |
2058 |
+- return; |
2059 |
+- |
2060 |
+- dev_hold(slave->dev); |
2061 |
+- nnw->dev = slave->dev; |
2062 |
+- bond_fill_ifslave(slave, &nnw->bonding_info.slave); |
2063 |
+- bond_fill_ifbond(bond, &nnw->bonding_info.master); |
2064 |
+- INIT_DELAYED_WORK(&nnw->work, bond_netdev_notify_work); |
2065 |
+- |
2066 |
+- queue_delayed_work(slave->bond->wq, &nnw->work, 0); |
2067 |
++ queue_delayed_work(slave->bond->wq, &slave->notify_work, 0); |
2068 |
+ } |
2069 |
+ |
2070 |
+ void bond_lower_state_changed(struct slave *slave) |
2071 |
+diff --git a/drivers/net/dsa/bcm_sf2.c b/drivers/net/dsa/bcm_sf2.c |
2072 |
+index 72d6ffbfd638..0132921f408a 100644 |
2073 |
+--- a/drivers/net/dsa/bcm_sf2.c |
2074 |
++++ b/drivers/net/dsa/bcm_sf2.c |
2075 |
+@@ -772,7 +772,6 @@ static int bcm_sf2_sw_suspend(struct dsa_switch *ds) |
2076 |
+ static int bcm_sf2_sw_resume(struct dsa_switch *ds) |
2077 |
+ { |
2078 |
+ struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); |
2079 |
+- unsigned int port; |
2080 |
+ int ret; |
2081 |
+ |
2082 |
+ ret = bcm_sf2_sw_rst(priv); |
2083 |
+@@ -784,12 +783,7 @@ static int bcm_sf2_sw_resume(struct dsa_switch *ds) |
2084 |
+ if (priv->hw_params.num_gphy == 1) |
2085 |
+ bcm_sf2_gphy_enable_set(ds, true); |
2086 |
+ |
2087 |
+- for (port = 0; port < DSA_MAX_PORTS; port++) { |
2088 |
+- if ((1 << port) & ds->enabled_port_mask) |
2089 |
+- bcm_sf2_port_setup(ds, port, NULL); |
2090 |
+- else if (dsa_is_cpu_port(ds, port)) |
2091 |
+- bcm_sf2_imp_setup(ds, port); |
2092 |
+- } |
2093 |
++ ds->ops->setup(ds); |
2094 |
+ |
2095 |
+ return 0; |
2096 |
+ } |
2097 |
+@@ -1270,10 +1264,10 @@ static int bcm_sf2_sw_remove(struct platform_device *pdev) |
2098 |
+ { |
2099 |
+ struct bcm_sf2_priv *priv = platform_get_drvdata(pdev); |
2100 |
+ |
2101 |
+- /* Disable all ports and interrupts */ |
2102 |
+ priv->wol_ports_mask = 0; |
2103 |
+- bcm_sf2_sw_suspend(priv->dev->ds); |
2104 |
+ dsa_unregister_switch(priv->dev->ds); |
2105 |
++ /* Disable all ports and interrupts */ |
2106 |
++ bcm_sf2_sw_suspend(priv->dev->ds); |
2107 |
+ bcm_sf2_mdio_unregister(priv); |
2108 |
+ |
2109 |
+ return 0; |
2110 |
+diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_ring.c b/drivers/net/ethernet/aquantia/atlantic/aq_ring.c |
2111 |
+index 0654e0c76bc2..640babf752ea 100644 |
2112 |
+--- a/drivers/net/ethernet/aquantia/atlantic/aq_ring.c |
2113 |
++++ b/drivers/net/ethernet/aquantia/atlantic/aq_ring.c |
2114 |
+@@ -222,9 +222,10 @@ int aq_ring_rx_clean(struct aq_ring_s *self, |
2115 |
+ } |
2116 |
+ |
2117 |
+ /* for single fragment packets use build_skb() */ |
2118 |
+- if (buff->is_eop) { |
2119 |
++ if (buff->is_eop && |
2120 |
++ buff->len <= AQ_CFG_RX_FRAME_MAX - AQ_SKB_ALIGN) { |
2121 |
+ skb = build_skb(page_address(buff->page), |
2122 |
+- buff->len + AQ_SKB_ALIGN); |
2123 |
++ AQ_CFG_RX_FRAME_MAX); |
2124 |
+ if (unlikely(!skb)) { |
2125 |
+ err = -ENOMEM; |
2126 |
+ goto err_exit; |
2127 |
+@@ -244,18 +245,21 @@ int aq_ring_rx_clean(struct aq_ring_s *self, |
2128 |
+ buff->len - ETH_HLEN, |
2129 |
+ SKB_TRUESIZE(buff->len - ETH_HLEN)); |
2130 |
+ |
2131 |
+- for (i = 1U, next_ = buff->next, |
2132 |
+- buff_ = &self->buff_ring[next_]; true; |
2133 |
+- next_ = buff_->next, |
2134 |
+- buff_ = &self->buff_ring[next_], ++i) { |
2135 |
+- skb_add_rx_frag(skb, i, buff_->page, 0, |
2136 |
+- buff_->len, |
2137 |
+- SKB_TRUESIZE(buff->len - |
2138 |
+- ETH_HLEN)); |
2139 |
+- buff_->is_cleaned = 1; |
2140 |
+- |
2141 |
+- if (buff_->is_eop) |
2142 |
+- break; |
2143 |
++ if (!buff->is_eop) { |
2144 |
++ for (i = 1U, next_ = buff->next, |
2145 |
++ buff_ = &self->buff_ring[next_]; |
2146 |
++ true; next_ = buff_->next, |
2147 |
++ buff_ = &self->buff_ring[next_], ++i) { |
2148 |
++ skb_add_rx_frag(skb, i, |
2149 |
++ buff_->page, 0, |
2150 |
++ buff_->len, |
2151 |
++ SKB_TRUESIZE(buff->len - |
2152 |
++ ETH_HLEN)); |
2153 |
++ buff_->is_cleaned = 1; |
2154 |
++ |
2155 |
++ if (buff_->is_eop) |
2156 |
++ break; |
2157 |
++ } |
2158 |
+ } |
2159 |
+ } |
2160 |
+ |
2161 |
+diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c |
2162 |
+index 0fff2432ab4c..6e7f9a470ea1 100644 |
2163 |
+--- a/drivers/net/ethernet/broadcom/bcmsysport.c |
2164 |
++++ b/drivers/net/ethernet/broadcom/bcmsysport.c |
2165 |
+@@ -1001,14 +1001,22 @@ static void bcm_sysport_resume_from_wol(struct bcm_sysport_priv *priv) |
2166 |
+ { |
2167 |
+ u32 reg; |
2168 |
+ |
2169 |
+- /* Stop monitoring MPD interrupt */ |
2170 |
+- intrl2_0_mask_set(priv, INTRL2_0_MPD); |
2171 |
+- |
2172 |
+ /* Clear the MagicPacket detection logic */ |
2173 |
+ reg = umac_readl(priv, UMAC_MPD_CTRL); |
2174 |
+ reg &= ~MPD_EN; |
2175 |
+ umac_writel(priv, reg, UMAC_MPD_CTRL); |
2176 |
+ |
2177 |
++ reg = intrl2_0_readl(priv, INTRL2_CPU_STATUS); |
2178 |
++ if (reg & INTRL2_0_MPD) |
2179 |
++ netdev_info(priv->netdev, "Wake-on-LAN (MPD) interrupt!\n"); |
2180 |
++ |
2181 |
++ if (reg & INTRL2_0_BRCM_MATCH_TAG) { |
2182 |
++ reg = rxchk_readl(priv, RXCHK_BRCM_TAG_MATCH_STATUS) & |
2183 |
++ RXCHK_BRCM_TAG_MATCH_MASK; |
2184 |
++ netdev_info(priv->netdev, |
2185 |
++ "Wake-on-LAN (filters 0x%02x) interrupt!\n", reg); |
2186 |
++ } |
2187 |
++ |
2188 |
+ netif_dbg(priv, wol, priv->netdev, "resumed from WOL\n"); |
2189 |
+ } |
2190 |
+ |
2191 |
+@@ -1043,11 +1051,6 @@ static irqreturn_t bcm_sysport_rx_isr(int irq, void *dev_id) |
2192 |
+ if (priv->irq0_stat & INTRL2_0_TX_RING_FULL) |
2193 |
+ bcm_sysport_tx_reclaim_all(priv); |
2194 |
+ |
2195 |
+- if (priv->irq0_stat & INTRL2_0_MPD) { |
2196 |
+- netdev_info(priv->netdev, "Wake-on-LAN interrupt!\n"); |
2197 |
+- bcm_sysport_resume_from_wol(priv); |
2198 |
+- } |
2199 |
+- |
2200 |
+ if (!priv->is_lite) |
2201 |
+ goto out; |
2202 |
+ |
2203 |
+@@ -2248,9 +2251,6 @@ static int bcm_sysport_suspend_to_wol(struct bcm_sysport_priv *priv) |
2204 |
+ /* UniMAC receive needs to be turned on */ |
2205 |
+ umac_enable_set(priv, CMD_RX_EN, 1); |
2206 |
+ |
2207 |
+- /* Enable the interrupt wake-up source */ |
2208 |
+- intrl2_0_mask_clear(priv, INTRL2_0_MPD); |
2209 |
+- |
2210 |
+ netif_dbg(priv, wol, ndev, "entered WOL mode\n"); |
2211 |
+ |
2212 |
+ return 0; |
2213 |
+diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c |
2214 |
+index 937db8019289..da6c73868fa0 100644 |
2215 |
+--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c |
2216 |
++++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c |
2217 |
+@@ -1864,8 +1864,11 @@ static int bnxt_poll_work(struct bnxt *bp, struct bnxt_napi *bnapi, int budget) |
2218 |
+ if (TX_CMP_TYPE(txcmp) == CMP_TYPE_TX_L2_CMP) { |
2219 |
+ tx_pkts++; |
2220 |
+ /* return full budget so NAPI will complete. */ |
2221 |
+- if (unlikely(tx_pkts > bp->tx_wake_thresh)) |
2222 |
++ if (unlikely(tx_pkts > bp->tx_wake_thresh)) { |
2223 |
+ rx_pkts = budget; |
2224 |
++ raw_cons = NEXT_RAW_CMP(raw_cons); |
2225 |
++ break; |
2226 |
++ } |
2227 |
+ } else if ((TX_CMP_TYPE(txcmp) & 0x30) == 0x10) { |
2228 |
+ if (likely(budget)) |
2229 |
+ rc = bnxt_rx_pkt(bp, bnapi, &raw_cons, &event); |
2230 |
+@@ -1893,7 +1896,7 @@ static int bnxt_poll_work(struct bnxt *bp, struct bnxt_napi *bnapi, int budget) |
2231 |
+ } |
2232 |
+ raw_cons = NEXT_RAW_CMP(raw_cons); |
2233 |
+ |
2234 |
+- if (rx_pkts == budget) |
2235 |
++ if (rx_pkts && rx_pkts == budget) |
2236 |
+ break; |
2237 |
+ } |
2238 |
+ |
2239 |
+@@ -2007,8 +2010,12 @@ static int bnxt_poll(struct napi_struct *napi, int budget) |
2240 |
+ while (1) { |
2241 |
+ work_done += bnxt_poll_work(bp, bnapi, budget - work_done); |
2242 |
+ |
2243 |
+- if (work_done >= budget) |
2244 |
++ if (work_done >= budget) { |
2245 |
++ if (!budget) |
2246 |
++ BNXT_CP_DB_REARM(cpr->cp_doorbell, |
2247 |
++ cpr->cp_raw_cons); |
2248 |
+ break; |
2249 |
++ } |
2250 |
+ |
2251 |
+ if (!bnxt_has_work(bp, cpr)) { |
2252 |
+ if (napi_complete_done(napi, work_done)) |
2253 |
+@@ -2957,10 +2964,11 @@ static void bnxt_free_hwrm_resources(struct bnxt *bp) |
2254 |
+ { |
2255 |
+ struct pci_dev *pdev = bp->pdev; |
2256 |
+ |
2257 |
+- dma_free_coherent(&pdev->dev, PAGE_SIZE, bp->hwrm_cmd_resp_addr, |
2258 |
+- bp->hwrm_cmd_resp_dma_addr); |
2259 |
+- |
2260 |
+- bp->hwrm_cmd_resp_addr = NULL; |
2261 |
++ if (bp->hwrm_cmd_resp_addr) { |
2262 |
++ dma_free_coherent(&pdev->dev, PAGE_SIZE, bp->hwrm_cmd_resp_addr, |
2263 |
++ bp->hwrm_cmd_resp_dma_addr); |
2264 |
++ bp->hwrm_cmd_resp_addr = NULL; |
2265 |
++ } |
2266 |
+ if (bp->hwrm_dbg_resp_addr) { |
2267 |
+ dma_free_coherent(&pdev->dev, HWRM_DBG_REG_BUF_SIZE, |
2268 |
+ bp->hwrm_dbg_resp_addr, |
2269 |
+@@ -8210,6 +8218,7 @@ init_err_cleanup_tc: |
2270 |
+ bnxt_clear_int_mode(bp); |
2271 |
+ |
2272 |
+ init_err_pci_clean: |
2273 |
++ bnxt_free_hwrm_resources(bp); |
2274 |
+ bnxt_cleanup_pci(bp); |
2275 |
+ |
2276 |
+ init_err_free: |
2277 |
+diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c |
2278 |
+index 6a185344b378..149d30f60459 100644 |
2279 |
+--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c |
2280 |
++++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c |
2281 |
+@@ -78,17 +78,23 @@ static int bnxt_tc_parse_redir(struct bnxt *bp, |
2282 |
+ return 0; |
2283 |
+ } |
2284 |
+ |
2285 |
+-static void bnxt_tc_parse_vlan(struct bnxt *bp, |
2286 |
+- struct bnxt_tc_actions *actions, |
2287 |
+- const struct tc_action *tc_act) |
2288 |
++static int bnxt_tc_parse_vlan(struct bnxt *bp, |
2289 |
++ struct bnxt_tc_actions *actions, |
2290 |
++ const struct tc_action *tc_act) |
2291 |
+ { |
2292 |
+- if (tcf_vlan_action(tc_act) == TCA_VLAN_ACT_POP) { |
2293 |
++ switch (tcf_vlan_action(tc_act)) { |
2294 |
++ case TCA_VLAN_ACT_POP: |
2295 |
+ actions->flags |= BNXT_TC_ACTION_FLAG_POP_VLAN; |
2296 |
+- } else if (tcf_vlan_action(tc_act) == TCA_VLAN_ACT_PUSH) { |
2297 |
++ break; |
2298 |
++ case TCA_VLAN_ACT_PUSH: |
2299 |
+ actions->flags |= BNXT_TC_ACTION_FLAG_PUSH_VLAN; |
2300 |
+ actions->push_vlan_tci = htons(tcf_vlan_push_vid(tc_act)); |
2301 |
+ actions->push_vlan_tpid = tcf_vlan_push_proto(tc_act); |
2302 |
++ break; |
2303 |
++ default: |
2304 |
++ return -EOPNOTSUPP; |
2305 |
+ } |
2306 |
++ return 0; |
2307 |
+ } |
2308 |
+ |
2309 |
+ static int bnxt_tc_parse_actions(struct bnxt *bp, |
2310 |
+@@ -122,7 +128,9 @@ static int bnxt_tc_parse_actions(struct bnxt *bp, |
2311 |
+ |
2312 |
+ /* Push/pop VLAN */ |
2313 |
+ if (is_tcf_vlan(tc_act)) { |
2314 |
+- bnxt_tc_parse_vlan(bp, actions, tc_act); |
2315 |
++ rc = bnxt_tc_parse_vlan(bp, actions, tc_act); |
2316 |
++ if (rc) |
2317 |
++ return rc; |
2318 |
+ continue; |
2319 |
+ } |
2320 |
+ } |
2321 |
+diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c |
2322 |
+index c1787be6a258..b4f92de1efbd 100644 |
2323 |
+--- a/drivers/net/ethernet/cadence/macb_main.c |
2324 |
++++ b/drivers/net/ethernet/cadence/macb_main.c |
2325 |
+@@ -3301,6 +3301,13 @@ static const struct macb_config at91sam9260_config = { |
2326 |
+ .init = macb_init, |
2327 |
+ }; |
2328 |
+ |
2329 |
++static const struct macb_config sama5d3macb_config = { |
2330 |
++ .caps = MACB_CAPS_SG_DISABLED |
2331 |
++ | MACB_CAPS_USRIO_HAS_CLKEN | MACB_CAPS_USRIO_DEFAULT_IS_MII_GMII, |
2332 |
++ .clk_init = macb_clk_init, |
2333 |
++ .init = macb_init, |
2334 |
++}; |
2335 |
++ |
2336 |
+ static const struct macb_config pc302gem_config = { |
2337 |
+ .caps = MACB_CAPS_SG_DISABLED | MACB_CAPS_GIGABIT_MODE_AVAILABLE, |
2338 |
+ .dma_burst_length = 16, |
2339 |
+@@ -3368,6 +3375,7 @@ static const struct of_device_id macb_dt_ids[] = { |
2340 |
+ { .compatible = "cdns,gem", .data = &pc302gem_config }, |
2341 |
+ { .compatible = "atmel,sama5d2-gem", .data = &sama5d2_config }, |
2342 |
+ { .compatible = "atmel,sama5d3-gem", .data = &sama5d3_config }, |
2343 |
++ { .compatible = "atmel,sama5d3-macb", .data = &sama5d3macb_config }, |
2344 |
+ { .compatible = "atmel,sama5d4-gem", .data = &sama5d4_config }, |
2345 |
+ { .compatible = "cdns,at91rm9200-emac", .data = &emac_config }, |
2346 |
+ { .compatible = "cdns,emac", .data = &emac_config }, |
2347 |
+diff --git a/drivers/net/ethernet/hisilicon/hns/hnae.c b/drivers/net/ethernet/hisilicon/hns/hnae.c |
2348 |
+index a051e582d541..79d03f8ee7b1 100644 |
2349 |
+--- a/drivers/net/ethernet/hisilicon/hns/hnae.c |
2350 |
++++ b/drivers/net/ethernet/hisilicon/hns/hnae.c |
2351 |
+@@ -84,7 +84,7 @@ static void hnae_unmap_buffer(struct hnae_ring *ring, struct hnae_desc_cb *cb) |
2352 |
+ if (cb->type == DESC_TYPE_SKB) |
2353 |
+ dma_unmap_single(ring_to_dev(ring), cb->dma, cb->length, |
2354 |
+ ring_to_dma_dir(ring)); |
2355 |
+- else |
2356 |
++ else if (cb->length) |
2357 |
+ dma_unmap_page(ring_to_dev(ring), cb->dma, cb->length, |
2358 |
+ ring_to_dma_dir(ring)); |
2359 |
+ } |
2360 |
+diff --git a/drivers/net/ethernet/hisilicon/hns/hns_enet.c b/drivers/net/ethernet/hisilicon/hns/hns_enet.c |
2361 |
+index 07d6a9cf2c55..4faadc3ffe8c 100644 |
2362 |
+--- a/drivers/net/ethernet/hisilicon/hns/hns_enet.c |
2363 |
++++ b/drivers/net/ethernet/hisilicon/hns/hns_enet.c |
2364 |
+@@ -40,9 +40,9 @@ |
2365 |
+ #define SKB_TMP_LEN(SKB) \ |
2366 |
+ (((SKB)->transport_header - (SKB)->mac_header) + tcp_hdrlen(SKB)) |
2367 |
+ |
2368 |
+-static void fill_v2_desc(struct hnae_ring *ring, void *priv, |
2369 |
+- int size, dma_addr_t dma, int frag_end, |
2370 |
+- int buf_num, enum hns_desc_type type, int mtu) |
2371 |
++static void fill_v2_desc_hw(struct hnae_ring *ring, void *priv, int size, |
2372 |
++ int send_sz, dma_addr_t dma, int frag_end, |
2373 |
++ int buf_num, enum hns_desc_type type, int mtu) |
2374 |
+ { |
2375 |
+ struct hnae_desc *desc = &ring->desc[ring->next_to_use]; |
2376 |
+ struct hnae_desc_cb *desc_cb = &ring->desc_cb[ring->next_to_use]; |
2377 |
+@@ -64,7 +64,7 @@ static void fill_v2_desc(struct hnae_ring *ring, void *priv, |
2378 |
+ desc_cb->type = type; |
2379 |
+ |
2380 |
+ desc->addr = cpu_to_le64(dma); |
2381 |
+- desc->tx.send_size = cpu_to_le16((u16)size); |
2382 |
++ desc->tx.send_size = cpu_to_le16((u16)send_sz); |
2383 |
+ |
2384 |
+ /* config bd buffer end */ |
2385 |
+ hnae_set_bit(rrcfv, HNSV2_TXD_VLD_B, 1); |
2386 |
+@@ -133,6 +133,14 @@ static void fill_v2_desc(struct hnae_ring *ring, void *priv, |
2387 |
+ ring_ptr_move_fw(ring, next_to_use); |
2388 |
+ } |
2389 |
+ |
2390 |
++static void fill_v2_desc(struct hnae_ring *ring, void *priv, |
2391 |
++ int size, dma_addr_t dma, int frag_end, |
2392 |
++ int buf_num, enum hns_desc_type type, int mtu) |
2393 |
++{ |
2394 |
++ fill_v2_desc_hw(ring, priv, size, size, dma, frag_end, |
2395 |
++ buf_num, type, mtu); |
2396 |
++} |
2397 |
++ |
2398 |
+ static const struct acpi_device_id hns_enet_acpi_match[] = { |
2399 |
+ { "HISI00C1", 0 }, |
2400 |
+ { "HISI00C2", 0 }, |
2401 |
+@@ -289,15 +297,15 @@ static void fill_tso_desc(struct hnae_ring *ring, void *priv, |
2402 |
+ |
2403 |
+ /* when the frag size is bigger than hardware, split this frag */ |
2404 |
+ for (k = 0; k < frag_buf_num; k++) |
2405 |
+- fill_v2_desc(ring, priv, |
2406 |
+- (k == frag_buf_num - 1) ? |
2407 |
++ fill_v2_desc_hw(ring, priv, k == 0 ? size : 0, |
2408 |
++ (k == frag_buf_num - 1) ? |
2409 |
+ sizeoflast : BD_MAX_SEND_SIZE, |
2410 |
+- dma + BD_MAX_SEND_SIZE * k, |
2411 |
+- frag_end && (k == frag_buf_num - 1) ? 1 : 0, |
2412 |
+- buf_num, |
2413 |
+- (type == DESC_TYPE_SKB && !k) ? |
2414 |
++ dma + BD_MAX_SEND_SIZE * k, |
2415 |
++ frag_end && (k == frag_buf_num - 1) ? 1 : 0, |
2416 |
++ buf_num, |
2417 |
++ (type == DESC_TYPE_SKB && !k) ? |
2418 |
+ DESC_TYPE_SKB : DESC_TYPE_PAGE, |
2419 |
+- mtu); |
2420 |
++ mtu); |
2421 |
+ } |
2422 |
+ |
2423 |
+ netdev_tx_t hns_nic_net_xmit_hw(struct net_device *ndev, |
2424 |
+diff --git a/drivers/net/ethernet/marvell/mvpp2.c b/drivers/net/ethernet/marvell/mvpp2.c |
2425 |
+index 529be74f609d..00e6f1d155a6 100644 |
2426 |
+--- a/drivers/net/ethernet/marvell/mvpp2.c |
2427 |
++++ b/drivers/net/ethernet/marvell/mvpp2.c |
2428 |
+@@ -33,6 +33,7 @@ |
2429 |
+ #include <linux/hrtimer.h> |
2430 |
+ #include <linux/ktime.h> |
2431 |
+ #include <linux/regmap.h> |
2432 |
++#include <linux/if_vlan.h> |
2433 |
+ #include <uapi/linux/ppp_defs.h> |
2434 |
+ #include <net/ip.h> |
2435 |
+ #include <net/ipv6.h> |
2436 |
+@@ -5101,7 +5102,7 @@ static void mvpp2_txq_desc_put(struct mvpp2_tx_queue *txq) |
2437 |
+ } |
2438 |
+ |
2439 |
+ /* Set Tx descriptors fields relevant for CSUM calculation */ |
2440 |
+-static u32 mvpp2_txq_desc_csum(int l3_offs, int l3_proto, |
2441 |
++static u32 mvpp2_txq_desc_csum(int l3_offs, __be16 l3_proto, |
2442 |
+ int ip_hdr_len, int l4_proto) |
2443 |
+ { |
2444 |
+ u32 command; |
2445 |
+@@ -6065,14 +6066,15 @@ static u32 mvpp2_skb_tx_csum(struct mvpp2_port *port, struct sk_buff *skb) |
2446 |
+ if (skb->ip_summed == CHECKSUM_PARTIAL) { |
2447 |
+ int ip_hdr_len = 0; |
2448 |
+ u8 l4_proto; |
2449 |
++ __be16 l3_proto = vlan_get_protocol(skb); |
2450 |
+ |
2451 |
+- if (skb->protocol == htons(ETH_P_IP)) { |
2452 |
++ if (l3_proto == htons(ETH_P_IP)) { |
2453 |
+ struct iphdr *ip4h = ip_hdr(skb); |
2454 |
+ |
2455 |
+ /* Calculate IPv4 checksum and L4 checksum */ |
2456 |
+ ip_hdr_len = ip4h->ihl; |
2457 |
+ l4_proto = ip4h->protocol; |
2458 |
+- } else if (skb->protocol == htons(ETH_P_IPV6)) { |
2459 |
++ } else if (l3_proto == htons(ETH_P_IPV6)) { |
2460 |
+ struct ipv6hdr *ip6h = ipv6_hdr(skb); |
2461 |
+ |
2462 |
+ /* Read l4_protocol from one of IPv6 extra headers */ |
2463 |
+@@ -6084,7 +6086,7 @@ static u32 mvpp2_skb_tx_csum(struct mvpp2_port *port, struct sk_buff *skb) |
2464 |
+ } |
2465 |
+ |
2466 |
+ return mvpp2_txq_desc_csum(skb_network_offset(skb), |
2467 |
+- skb->protocol, ip_hdr_len, l4_proto); |
2468 |
++ l3_proto, ip_hdr_len, l4_proto); |
2469 |
+ } |
2470 |
+ |
2471 |
+ return MVPP2_TXD_L4_CSUM_NOT | MVPP2_TXD_IP_CSUM_DISABLE; |
2472 |
+@@ -6532,10 +6534,12 @@ static int mvpp2_poll(struct napi_struct *napi, int budget) |
2473 |
+ cause_rx_tx & ~MVPP2_CAUSE_MISC_SUM_MASK); |
2474 |
+ } |
2475 |
+ |
2476 |
+- cause_tx = cause_rx_tx & MVPP2_CAUSE_TXQ_OCCUP_DESC_ALL_MASK; |
2477 |
+- if (cause_tx) { |
2478 |
+- cause_tx >>= MVPP2_CAUSE_TXQ_OCCUP_DESC_ALL_OFFSET; |
2479 |
+- mvpp2_tx_done(port, cause_tx, qv->sw_thread_id); |
2480 |
++ if (port->has_tx_irqs) { |
2481 |
++ cause_tx = cause_rx_tx & MVPP2_CAUSE_TXQ_OCCUP_DESC_ALL_MASK; |
2482 |
++ if (cause_tx) { |
2483 |
++ cause_tx >>= MVPP2_CAUSE_TXQ_OCCUP_DESC_ALL_OFFSET; |
2484 |
++ mvpp2_tx_done(port, cause_tx, qv->sw_thread_id); |
2485 |
++ } |
2486 |
+ } |
2487 |
+ |
2488 |
+ /* Process RX packets */ |
2489 |
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c |
2490 |
+index e28f9dab9ceb..9e0be077df9c 100644 |
2491 |
+--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c |
2492 |
++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c |
2493 |
+@@ -864,6 +864,9 @@ static int __parse_cls_flower(struct mlx5e_priv *priv, |
2494 |
+ MLX5_SET(fte_match_set_lyr_2_4, headers_c, first_prio, mask->vlan_priority); |
2495 |
+ MLX5_SET(fte_match_set_lyr_2_4, headers_v, first_prio, key->vlan_priority); |
2496 |
+ } |
2497 |
++ } else { |
2498 |
++ MLX5_SET(fte_match_set_lyr_2_4, headers_c, svlan_tag, 1); |
2499 |
++ MLX5_SET(fte_match_set_lyr_2_4, headers_c, cvlan_tag, 1); |
2500 |
+ } |
2501 |
+ |
2502 |
+ if (addr_type == FLOW_DISSECTOR_KEY_IPV4_ADDRS) { |
2503 |
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c |
2504 |
+index de72b66df3e5..1af9894abd95 100644 |
2505 |
+--- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c |
2506 |
++++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c |
2507 |
+@@ -1922,7 +1922,7 @@ static u32 calculate_vports_min_rate_divider(struct mlx5_eswitch *esw) |
2508 |
+ u32 max_guarantee = 0; |
2509 |
+ int i; |
2510 |
+ |
2511 |
+- for (i = 0; i <= esw->total_vports; i++) { |
2512 |
++ for (i = 0; i < esw->total_vports; i++) { |
2513 |
+ evport = &esw->vports[i]; |
2514 |
+ if (!evport->enabled || evport->info.min_rate < max_guarantee) |
2515 |
+ continue; |
2516 |
+@@ -1942,7 +1942,7 @@ static int normalize_vports_min_rate(struct mlx5_eswitch *esw, u32 divider) |
2517 |
+ int err; |
2518 |
+ int i; |
2519 |
+ |
2520 |
+- for (i = 0; i <= esw->total_vports; i++) { |
2521 |
++ for (i = 0; i < esw->total_vports; i++) { |
2522 |
+ evport = &esw->vports[i]; |
2523 |
+ if (!evport->enabled) |
2524 |
+ continue; |
2525 |
+diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_common.c b/drivers/net/ethernet/netronome/nfp/nfp_net_common.c |
2526 |
+index 56751990bcee..6df2c8b2ce6f 100644 |
2527 |
+--- a/drivers/net/ethernet/netronome/nfp/nfp_net_common.c |
2528 |
++++ b/drivers/net/ethernet/netronome/nfp/nfp_net_common.c |
2529 |
+@@ -2058,14 +2058,17 @@ nfp_ctrl_rx_one(struct nfp_net *nn, struct nfp_net_dp *dp, |
2530 |
+ return true; |
2531 |
+ } |
2532 |
+ |
2533 |
+-static void nfp_ctrl_rx(struct nfp_net_r_vector *r_vec) |
2534 |
++static bool nfp_ctrl_rx(struct nfp_net_r_vector *r_vec) |
2535 |
+ { |
2536 |
+ struct nfp_net_rx_ring *rx_ring = r_vec->rx_ring; |
2537 |
+ struct nfp_net *nn = r_vec->nfp_net; |
2538 |
+ struct nfp_net_dp *dp = &nn->dp; |
2539 |
++ unsigned int budget = 512; |
2540 |
+ |
2541 |
+- while (nfp_ctrl_rx_one(nn, dp, r_vec, rx_ring)) |
2542 |
++ while (nfp_ctrl_rx_one(nn, dp, r_vec, rx_ring) && budget--) |
2543 |
+ continue; |
2544 |
++ |
2545 |
++ return budget; |
2546 |
+ } |
2547 |
+ |
2548 |
+ static void nfp_ctrl_poll(unsigned long arg) |
2549 |
+@@ -2077,9 +2080,13 @@ static void nfp_ctrl_poll(unsigned long arg) |
2550 |
+ __nfp_ctrl_tx_queued(r_vec); |
2551 |
+ spin_unlock_bh(&r_vec->lock); |
2552 |
+ |
2553 |
+- nfp_ctrl_rx(r_vec); |
2554 |
+- |
2555 |
+- nfp_net_irq_unmask(r_vec->nfp_net, r_vec->irq_entry); |
2556 |
++ if (nfp_ctrl_rx(r_vec)) { |
2557 |
++ nfp_net_irq_unmask(r_vec->nfp_net, r_vec->irq_entry); |
2558 |
++ } else { |
2559 |
++ tasklet_schedule(&r_vec->tasklet); |
2560 |
++ nn_dp_warn(&r_vec->nfp_net->dp, |
2561 |
++ "control message budget exceeded!\n"); |
2562 |
++ } |
2563 |
+ } |
2564 |
+ |
2565 |
+ /* Setup and Configuration |
2566 |
+diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h b/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h |
2567 |
+index 81312924df14..0c443ea98479 100644 |
2568 |
+--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h |
2569 |
++++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h |
2570 |
+@@ -1800,7 +1800,8 @@ struct qlcnic_hardware_ops { |
2571 |
+ int (*config_loopback) (struct qlcnic_adapter *, u8); |
2572 |
+ int (*clear_loopback) (struct qlcnic_adapter *, u8); |
2573 |
+ int (*config_promisc_mode) (struct qlcnic_adapter *, u32); |
2574 |
+- void (*change_l2_filter) (struct qlcnic_adapter *, u64 *, u16); |
2575 |
++ void (*change_l2_filter)(struct qlcnic_adapter *adapter, u64 *addr, |
2576 |
++ u16 vlan, struct qlcnic_host_tx_ring *tx_ring); |
2577 |
+ int (*get_board_info) (struct qlcnic_adapter *); |
2578 |
+ void (*set_mac_filter_count) (struct qlcnic_adapter *); |
2579 |
+ void (*free_mac_list) (struct qlcnic_adapter *); |
2580 |
+@@ -2064,9 +2065,10 @@ static inline int qlcnic_nic_set_promisc(struct qlcnic_adapter *adapter, |
2581 |
+ } |
2582 |
+ |
2583 |
+ static inline void qlcnic_change_filter(struct qlcnic_adapter *adapter, |
2584 |
+- u64 *addr, u16 id) |
2585 |
++ u64 *addr, u16 vlan, |
2586 |
++ struct qlcnic_host_tx_ring *tx_ring) |
2587 |
+ { |
2588 |
+- adapter->ahw->hw_ops->change_l2_filter(adapter, addr, id); |
2589 |
++ adapter->ahw->hw_ops->change_l2_filter(adapter, addr, vlan, tx_ring); |
2590 |
+ } |
2591 |
+ |
2592 |
+ static inline int qlcnic_get_board_info(struct qlcnic_adapter *adapter) |
2593 |
+diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c |
2594 |
+index 46b0372dd032..1fc84d8f891b 100644 |
2595 |
+--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c |
2596 |
++++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c |
2597 |
+@@ -2134,7 +2134,8 @@ out: |
2598 |
+ } |
2599 |
+ |
2600 |
+ void qlcnic_83xx_change_l2_filter(struct qlcnic_adapter *adapter, u64 *addr, |
2601 |
+- u16 vlan_id) |
2602 |
++ u16 vlan_id, |
2603 |
++ struct qlcnic_host_tx_ring *tx_ring) |
2604 |
+ { |
2605 |
+ u8 mac[ETH_ALEN]; |
2606 |
+ memcpy(&mac, addr, ETH_ALEN); |
2607 |
+diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.h b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.h |
2608 |
+index b75a81246856..73fe2f64491d 100644 |
2609 |
+--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.h |
2610 |
++++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.h |
2611 |
+@@ -550,7 +550,8 @@ int qlcnic_83xx_wrt_reg_indirect(struct qlcnic_adapter *, ulong, u32); |
2612 |
+ int qlcnic_83xx_nic_set_promisc(struct qlcnic_adapter *, u32); |
2613 |
+ int qlcnic_83xx_config_hw_lro(struct qlcnic_adapter *, int); |
2614 |
+ int qlcnic_83xx_config_rss(struct qlcnic_adapter *, int); |
2615 |
+-void qlcnic_83xx_change_l2_filter(struct qlcnic_adapter *, u64 *, u16); |
2616 |
++void qlcnic_83xx_change_l2_filter(struct qlcnic_adapter *adapter, u64 *addr, |
2617 |
++ u16 vlan, struct qlcnic_host_tx_ring *ring); |
2618 |
+ int qlcnic_83xx_get_pci_info(struct qlcnic_adapter *, struct qlcnic_pci_info *); |
2619 |
+ int qlcnic_83xx_set_nic_info(struct qlcnic_adapter *, struct qlcnic_info *); |
2620 |
+ void qlcnic_83xx_initialize_nic(struct qlcnic_adapter *, int); |
2621 |
+diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.h b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.h |
2622 |
+index 4bb33af8e2b3..56a3bd9e37dc 100644 |
2623 |
+--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.h |
2624 |
++++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.h |
2625 |
+@@ -173,7 +173,8 @@ int qlcnic_82xx_napi_add(struct qlcnic_adapter *adapter, |
2626 |
+ struct net_device *netdev); |
2627 |
+ void qlcnic_82xx_get_beacon_state(struct qlcnic_adapter *); |
2628 |
+ void qlcnic_82xx_change_filter(struct qlcnic_adapter *adapter, |
2629 |
+- u64 *uaddr, u16 vlan_id); |
2630 |
++ u64 *uaddr, u16 vlan_id, |
2631 |
++ struct qlcnic_host_tx_ring *tx_ring); |
2632 |
+ int qlcnic_82xx_config_intr_coalesce(struct qlcnic_adapter *, |
2633 |
+ struct ethtool_coalesce *); |
2634 |
+ int qlcnic_82xx_set_rx_coalesce(struct qlcnic_adapter *); |
2635 |
+diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c |
2636 |
+index 84dd83031a1b..9647578cbe6a 100644 |
2637 |
+--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c |
2638 |
++++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c |
2639 |
+@@ -268,13 +268,12 @@ static void qlcnic_add_lb_filter(struct qlcnic_adapter *adapter, |
2640 |
+ } |
2641 |
+ |
2642 |
+ void qlcnic_82xx_change_filter(struct qlcnic_adapter *adapter, u64 *uaddr, |
2643 |
+- u16 vlan_id) |
2644 |
++ u16 vlan_id, struct qlcnic_host_tx_ring *tx_ring) |
2645 |
+ { |
2646 |
+ struct cmd_desc_type0 *hwdesc; |
2647 |
+ struct qlcnic_nic_req *req; |
2648 |
+ struct qlcnic_mac_req *mac_req; |
2649 |
+ struct qlcnic_vlan_req *vlan_req; |
2650 |
+- struct qlcnic_host_tx_ring *tx_ring = adapter->tx_ring; |
2651 |
+ u32 producer; |
2652 |
+ u64 word; |
2653 |
+ |
2654 |
+@@ -301,7 +300,8 @@ void qlcnic_82xx_change_filter(struct qlcnic_adapter *adapter, u64 *uaddr, |
2655 |
+ |
2656 |
+ static void qlcnic_send_filter(struct qlcnic_adapter *adapter, |
2657 |
+ struct cmd_desc_type0 *first_desc, |
2658 |
+- struct sk_buff *skb) |
2659 |
++ struct sk_buff *skb, |
2660 |
++ struct qlcnic_host_tx_ring *tx_ring) |
2661 |
+ { |
2662 |
+ struct vlan_ethhdr *vh = (struct vlan_ethhdr *)(skb->data); |
2663 |
+ struct ethhdr *phdr = (struct ethhdr *)(skb->data); |
2664 |
+@@ -335,7 +335,7 @@ static void qlcnic_send_filter(struct qlcnic_adapter *adapter, |
2665 |
+ tmp_fil->vlan_id == vlan_id) { |
2666 |
+ if (jiffies > (QLCNIC_READD_AGE * HZ + tmp_fil->ftime)) |
2667 |
+ qlcnic_change_filter(adapter, &src_addr, |
2668 |
+- vlan_id); |
2669 |
++ vlan_id, tx_ring); |
2670 |
+ tmp_fil->ftime = jiffies; |
2671 |
+ return; |
2672 |
+ } |
2673 |
+@@ -350,7 +350,7 @@ static void qlcnic_send_filter(struct qlcnic_adapter *adapter, |
2674 |
+ if (!fil) |
2675 |
+ return; |
2676 |
+ |
2677 |
+- qlcnic_change_filter(adapter, &src_addr, vlan_id); |
2678 |
++ qlcnic_change_filter(adapter, &src_addr, vlan_id, tx_ring); |
2679 |
+ fil->ftime = jiffies; |
2680 |
+ fil->vlan_id = vlan_id; |
2681 |
+ memcpy(fil->faddr, &src_addr, ETH_ALEN); |
2682 |
+@@ -766,7 +766,7 @@ netdev_tx_t qlcnic_xmit_frame(struct sk_buff *skb, struct net_device *netdev) |
2683 |
+ } |
2684 |
+ |
2685 |
+ if (adapter->drv_mac_learn) |
2686 |
+- qlcnic_send_filter(adapter, first_desc, skb); |
2687 |
++ qlcnic_send_filter(adapter, first_desc, skb, tx_ring); |
2688 |
+ |
2689 |
+ tx_ring->tx_stats.tx_bytes += skb->len; |
2690 |
+ tx_ring->tx_stats.xmit_called++; |
2691 |
+diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c |
2692 |
+index 1a9a382bf1c4..bafbebeb0e00 100644 |
2693 |
+--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c |
2694 |
++++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c |
2695 |
+@@ -2190,8 +2190,7 @@ static int stmmac_init_dma_engine(struct stmmac_priv *priv) |
2696 |
+ priv->plat->dma_cfg, |
2697 |
+ tx_q->dma_tx_phy, chan); |
2698 |
+ |
2699 |
+- tx_q->tx_tail_addr = tx_q->dma_tx_phy + |
2700 |
+- (DMA_TX_SIZE * sizeof(struct dma_desc)); |
2701 |
++ tx_q->tx_tail_addr = tx_q->dma_tx_phy; |
2702 |
+ priv->hw->dma->set_tx_tail_ptr(priv->ioaddr, |
2703 |
+ tx_q->tx_tail_addr, |
2704 |
+ chan); |
2705 |
+@@ -2963,6 +2962,7 @@ static netdev_tx_t stmmac_tso_xmit(struct sk_buff *skb, struct net_device *dev) |
2706 |
+ |
2707 |
+ netdev_tx_sent_queue(netdev_get_tx_queue(dev, queue), skb->len); |
2708 |
+ |
2709 |
++ tx_q->tx_tail_addr = tx_q->dma_tx_phy + (tx_q->cur_tx * sizeof(*desc)); |
2710 |
+ priv->hw->dma->set_tx_tail_ptr(priv->ioaddr, tx_q->tx_tail_addr, |
2711 |
+ queue); |
2712 |
+ |
2713 |
+@@ -3178,9 +3178,11 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev) |
2714 |
+ |
2715 |
+ if (priv->synopsys_id < DWMAC_CORE_4_00) |
2716 |
+ priv->hw->dma->enable_dma_transmission(priv->ioaddr); |
2717 |
+- else |
2718 |
++ else { |
2719 |
++ tx_q->tx_tail_addr = tx_q->dma_tx_phy + (tx_q->cur_tx * sizeof(*desc)); |
2720 |
+ priv->hw->dma->set_tx_tail_ptr(priv->ioaddr, tx_q->tx_tail_addr, |
2721 |
+ queue); |
2722 |
++ } |
2723 |
+ |
2724 |
+ return NETDEV_TX_OK; |
2725 |
+ |
2726 |
+diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c |
2727 |
+index 195eb7e71473..d48cc32dc507 100644 |
2728 |
+--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c |
2729 |
++++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c |
2730 |
+@@ -67,7 +67,7 @@ static int dwmac1000_validate_mcast_bins(int mcast_bins) |
2731 |
+ * Description: |
2732 |
+ * This function validates the number of Unicast address entries supported |
2733 |
+ * by a particular Synopsys 10/100/1000 controller. The Synopsys controller |
2734 |
+- * supports 1, 32, 64, or 128 Unicast filter entries for it's Unicast filter |
2735 |
++ * supports 1..32, 64, or 128 Unicast filter entries for it's Unicast filter |
2736 |
+ * logic. This function validates a valid, supported configuration is |
2737 |
+ * selected, and defaults to 1 Unicast address if an unsupported |
2738 |
+ * configuration is selected. |
2739 |
+@@ -77,8 +77,7 @@ static int dwmac1000_validate_ucast_entries(int ucast_entries) |
2740 |
+ int x = ucast_entries; |
2741 |
+ |
2742 |
+ switch (x) { |
2743 |
+- case 1: |
2744 |
+- case 32: |
2745 |
++ case 1 ... 32: |
2746 |
+ case 64: |
2747 |
+ case 128: |
2748 |
+ break; |
2749 |
+diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c |
2750 |
+index aba16d81e9bb..2d90cffae9ff 100644 |
2751 |
+--- a/drivers/net/hyperv/netvsc_drv.c |
2752 |
++++ b/drivers/net/hyperv/netvsc_drv.c |
2753 |
+@@ -2110,17 +2110,15 @@ static int netvsc_remove(struct hv_device *dev) |
2754 |
+ |
2755 |
+ cancel_delayed_work_sync(&ndev_ctx->dwork); |
2756 |
+ |
2757 |
+- rcu_read_lock(); |
2758 |
+- nvdev = rcu_dereference(ndev_ctx->nvdev); |
2759 |
+- |
2760 |
+- if (nvdev) |
2761 |
++ rtnl_lock(); |
2762 |
++ nvdev = rtnl_dereference(ndev_ctx->nvdev); |
2763 |
++ if (nvdev) |
2764 |
+ cancel_work_sync(&nvdev->subchan_work); |
2765 |
+ |
2766 |
+ /* |
2767 |
+ * Call to the vsc driver to let it know that the device is being |
2768 |
+ * removed. Also blocks mtu and channel changes. |
2769 |
+ */ |
2770 |
+- rtnl_lock(); |
2771 |
+ vf_netdev = rtnl_dereference(ndev_ctx->vf_netdev); |
2772 |
+ if (vf_netdev) |
2773 |
+ netvsc_unregister_vf(vf_netdev); |
2774 |
+@@ -2132,7 +2130,6 @@ static int netvsc_remove(struct hv_device *dev) |
2775 |
+ list_del(&ndev_ctx->list); |
2776 |
+ |
2777 |
+ rtnl_unlock(); |
2778 |
+- rcu_read_unlock(); |
2779 |
+ |
2780 |
+ hv_set_drvdata(dev, NULL); |
2781 |
+ |
2782 |
+diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c |
2783 |
+index 83c591713837..817451a1efd6 100644 |
2784 |
+--- a/drivers/net/team/team.c |
2785 |
++++ b/drivers/net/team/team.c |
2786 |
+@@ -1165,6 +1165,11 @@ static int team_port_add(struct team *team, struct net_device *port_dev) |
2787 |
+ return -EBUSY; |
2788 |
+ } |
2789 |
+ |
2790 |
++ if (dev == port_dev) { |
2791 |
++ netdev_err(dev, "Cannot enslave team device to itself\n"); |
2792 |
++ return -EINVAL; |
2793 |
++ } |
2794 |
++ |
2795 |
+ if (port_dev->features & NETIF_F_VLAN_CHALLENGED && |
2796 |
+ vlan_uses_dev(dev)) { |
2797 |
+ netdev_err(dev, "Device %s is VLAN challenged and team device has VLAN set up\n", |
2798 |
+diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c |
2799 |
+index c5d4b35bb72a..11a25cef113f 100644 |
2800 |
+--- a/drivers/net/usb/qmi_wwan.c |
2801 |
++++ b/drivers/net/usb/qmi_wwan.c |
2802 |
+@@ -1233,6 +1233,7 @@ static const struct usb_device_id products[] = { |
2803 |
+ {QMI_FIXED_INTF(0x0b3c, 0xc00b, 4)}, /* Olivetti Olicard 500 */ |
2804 |
+ {QMI_FIXED_INTF(0x1e2d, 0x0060, 4)}, /* Cinterion PLxx */ |
2805 |
+ {QMI_FIXED_INTF(0x1e2d, 0x0053, 4)}, /* Cinterion PHxx,PXxx */ |
2806 |
++ {QMI_FIXED_INTF(0x1e2d, 0x0063, 10)}, /* Cinterion ALASxx (1 RmNet) */ |
2807 |
+ {QMI_FIXED_INTF(0x1e2d, 0x0082, 4)}, /* Cinterion PHxx,PXxx (2 RmNet) */ |
2808 |
+ {QMI_FIXED_INTF(0x1e2d, 0x0082, 5)}, /* Cinterion PHxx,PXxx (2 RmNet) */ |
2809 |
+ {QMI_FIXED_INTF(0x1e2d, 0x0083, 4)}, /* Cinterion PHxx,PXxx (1 RmNet + USB Audio)*/ |
2810 |
+diff --git a/drivers/net/usb/smsc75xx.c b/drivers/net/usb/smsc75xx.c |
2811 |
+index 05553d252446..b64b1ee56d2d 100644 |
2812 |
+--- a/drivers/net/usb/smsc75xx.c |
2813 |
++++ b/drivers/net/usb/smsc75xx.c |
2814 |
+@@ -1517,6 +1517,7 @@ static void smsc75xx_unbind(struct usbnet *dev, struct usb_interface *intf) |
2815 |
+ { |
2816 |
+ struct smsc75xx_priv *pdata = (struct smsc75xx_priv *)(dev->data[0]); |
2817 |
+ if (pdata) { |
2818 |
++ cancel_work_sync(&pdata->set_multicast); |
2819 |
+ netif_dbg(dev, ifdown, dev->net, "free pdata\n"); |
2820 |
+ kfree(pdata); |
2821 |
+ pdata = NULL; |
2822 |
+diff --git a/drivers/pci/host/pci-hyperv.c b/drivers/pci/host/pci-hyperv.c |
2823 |
+index ffc87a956d97..53d1c08cef4d 100644 |
2824 |
+--- a/drivers/pci/host/pci-hyperv.c |
2825 |
++++ b/drivers/pci/host/pci-hyperv.c |
2826 |
+@@ -100,6 +100,9 @@ static enum pci_protocol_version_t pci_protocol_version; |
2827 |
+ |
2828 |
+ #define STATUS_REVISION_MISMATCH 0xC0000059 |
2829 |
+ |
2830 |
++/* space for 32bit serial number as string */ |
2831 |
++#define SLOT_NAME_SIZE 11 |
2832 |
++ |
2833 |
+ /* |
2834 |
+ * Message Types |
2835 |
+ */ |
2836 |
+@@ -516,6 +519,7 @@ struct hv_pci_dev { |
2837 |
+ struct list_head list_entry; |
2838 |
+ refcount_t refs; |
2839 |
+ enum hv_pcichild_state state; |
2840 |
++ struct pci_slot *pci_slot; |
2841 |
+ struct pci_function_description desc; |
2842 |
+ bool reported_missing; |
2843 |
+ struct hv_pcibus_device *hbus; |
2844 |
+@@ -1481,6 +1485,34 @@ static void prepopulate_bars(struct hv_pcibus_device *hbus) |
2845 |
+ spin_unlock_irqrestore(&hbus->device_list_lock, flags); |
2846 |
+ } |
2847 |
+ |
2848 |
++/* |
2849 |
++ * Assign entries in sysfs pci slot directory. |
2850 |
++ * |
2851 |
++ * Note that this function does not need to lock the children list |
2852 |
++ * because it is called from pci_devices_present_work which |
2853 |
++ * is serialized with hv_eject_device_work because they are on the |
2854 |
++ * same ordered workqueue. Therefore hbus->children list will not change |
2855 |
++ * even when pci_create_slot sleeps. |
2856 |
++ */ |
2857 |
++static void hv_pci_assign_slots(struct hv_pcibus_device *hbus) |
2858 |
++{ |
2859 |
++ struct hv_pci_dev *hpdev; |
2860 |
++ char name[SLOT_NAME_SIZE]; |
2861 |
++ int slot_nr; |
2862 |
++ |
2863 |
++ list_for_each_entry(hpdev, &hbus->children, list_entry) { |
2864 |
++ if (hpdev->pci_slot) |
2865 |
++ continue; |
2866 |
++ |
2867 |
++ slot_nr = PCI_SLOT(wslot_to_devfn(hpdev->desc.win_slot.slot)); |
2868 |
++ snprintf(name, SLOT_NAME_SIZE, "%u", hpdev->desc.ser); |
2869 |
++ hpdev->pci_slot = pci_create_slot(hbus->pci_bus, slot_nr, |
2870 |
++ name, NULL); |
2871 |
++ if (!hpdev->pci_slot) |
2872 |
++ pr_warn("pci_create slot %s failed\n", name); |
2873 |
++ } |
2874 |
++} |
2875 |
++ |
2876 |
+ /** |
2877 |
+ * create_root_hv_pci_bus() - Expose a new root PCI bus |
2878 |
+ * @hbus: Root PCI bus, as understood by this driver |
2879 |
+@@ -1504,6 +1536,7 @@ static int create_root_hv_pci_bus(struct hv_pcibus_device *hbus) |
2880 |
+ pci_lock_rescan_remove(); |
2881 |
+ pci_scan_child_bus(hbus->pci_bus); |
2882 |
+ pci_bus_assign_resources(hbus->pci_bus); |
2883 |
++ hv_pci_assign_slots(hbus); |
2884 |
+ pci_bus_add_devices(hbus->pci_bus); |
2885 |
+ pci_unlock_rescan_remove(); |
2886 |
+ hbus->state = hv_pcibus_installed; |
2887 |
+@@ -1787,6 +1820,7 @@ static void pci_devices_present_work(struct work_struct *work) |
2888 |
+ */ |
2889 |
+ pci_lock_rescan_remove(); |
2890 |
+ pci_scan_child_bus(hbus->pci_bus); |
2891 |
++ hv_pci_assign_slots(hbus); |
2892 |
+ pci_unlock_rescan_remove(); |
2893 |
+ break; |
2894 |
+ |
2895 |
+@@ -1895,6 +1929,9 @@ static void hv_eject_device_work(struct work_struct *work) |
2896 |
+ list_del(&hpdev->list_entry); |
2897 |
+ spin_unlock_irqrestore(&hpdev->hbus->device_list_lock, flags); |
2898 |
+ |
2899 |
++ if (hpdev->pci_slot) |
2900 |
++ pci_destroy_slot(hpdev->pci_slot); |
2901 |
++ |
2902 |
+ memset(&ctxt, 0, sizeof(ctxt)); |
2903 |
+ ejct_pkt = (struct pci_eject_response *)&ctxt.pkt.message; |
2904 |
+ ejct_pkt->message_type.type = PCI_EJECTION_COMPLETE; |
2905 |
+diff --git a/drivers/perf/arm_pmu.c b/drivers/perf/arm_pmu.c |
2906 |
+index d14fc2e67f93..5e06917b4cef 100644 |
2907 |
+--- a/drivers/perf/arm_pmu.c |
2908 |
++++ b/drivers/perf/arm_pmu.c |
2909 |
+@@ -483,7 +483,13 @@ static int armpmu_filter_match(struct perf_event *event) |
2910 |
+ { |
2911 |
+ struct arm_pmu *armpmu = to_arm_pmu(event->pmu); |
2912 |
+ unsigned int cpu = smp_processor_id(); |
2913 |
+- return cpumask_test_cpu(cpu, &armpmu->supported_cpus); |
2914 |
++ int ret; |
2915 |
++ |
2916 |
++ ret = cpumask_test_cpu(cpu, &armpmu->supported_cpus); |
2917 |
++ if (ret && armpmu->filter_match) |
2918 |
++ return armpmu->filter_match(event); |
2919 |
++ |
2920 |
++ return ret; |
2921 |
+ } |
2922 |
+ |
2923 |
+ static ssize_t armpmu_cpumask_show(struct device *dev, |
2924 |
+diff --git a/drivers/pinctrl/pinctrl-mcp23s08.c b/drivers/pinctrl/pinctrl-mcp23s08.c |
2925 |
+index db9cca4a83ff..22558bf29424 100644 |
2926 |
+--- a/drivers/pinctrl/pinctrl-mcp23s08.c |
2927 |
++++ b/drivers/pinctrl/pinctrl-mcp23s08.c |
2928 |
+@@ -643,6 +643,14 @@ static int mcp23s08_irq_setup(struct mcp23s08 *mcp) |
2929 |
+ return err; |
2930 |
+ } |
2931 |
+ |
2932 |
++ return 0; |
2933 |
++} |
2934 |
++ |
2935 |
++static int mcp23s08_irqchip_setup(struct mcp23s08 *mcp) |
2936 |
++{ |
2937 |
++ struct gpio_chip *chip = &mcp->chip; |
2938 |
++ int err; |
2939 |
++ |
2940 |
+ err = gpiochip_irqchip_add_nested(chip, |
2941 |
+ &mcp23s08_irq_chip, |
2942 |
+ 0, |
2943 |
+@@ -907,7 +915,7 @@ static int mcp23s08_probe_one(struct mcp23s08 *mcp, struct device *dev, |
2944 |
+ } |
2945 |
+ |
2946 |
+ if (mcp->irq && mcp->irq_controller) { |
2947 |
+- ret = mcp23s08_irq_setup(mcp); |
2948 |
++ ret = mcp23s08_irqchip_setup(mcp); |
2949 |
+ if (ret) |
2950 |
+ goto fail; |
2951 |
+ } |
2952 |
+@@ -932,6 +940,9 @@ static int mcp23s08_probe_one(struct mcp23s08 *mcp, struct device *dev, |
2953 |
+ goto fail; |
2954 |
+ } |
2955 |
+ |
2956 |
++ if (mcp->irq) |
2957 |
++ ret = mcp23s08_irq_setup(mcp); |
2958 |
++ |
2959 |
+ fail: |
2960 |
+ if (ret < 0) |
2961 |
+ dev_dbg(dev, "can't setup chip %d, --> %d\n", addr, ret); |
2962 |
+diff --git a/drivers/s390/cio/vfio_ccw_cp.c b/drivers/s390/cio/vfio_ccw_cp.c |
2963 |
+index 72ce6ad95767..1419eaea03d8 100644 |
2964 |
+--- a/drivers/s390/cio/vfio_ccw_cp.c |
2965 |
++++ b/drivers/s390/cio/vfio_ccw_cp.c |
2966 |
+@@ -172,7 +172,7 @@ static bool pfn_array_table_iova_pinned(struct pfn_array_table *pat, |
2967 |
+ |
2968 |
+ for (i = 0; i < pat->pat_nr; i++, pa++) |
2969 |
+ for (j = 0; j < pa->pa_nr; j++) |
2970 |
+- if (pa->pa_iova_pfn[i] == iova_pfn) |
2971 |
++ if (pa->pa_iova_pfn[j] == iova_pfn) |
2972 |
+ return true; |
2973 |
+ |
2974 |
+ return false; |
2975 |
+diff --git a/drivers/scsi/qla2xxx/qla_target.h b/drivers/scsi/qla2xxx/qla_target.h |
2976 |
+index aba58d3848a6..511a31b359c7 100644 |
2977 |
+--- a/drivers/scsi/qla2xxx/qla_target.h |
2978 |
++++ b/drivers/scsi/qla2xxx/qla_target.h |
2979 |
+@@ -374,8 +374,8 @@ struct atio_from_isp { |
2980 |
+ static inline int fcpcmd_is_corrupted(struct atio *atio) |
2981 |
+ { |
2982 |
+ if (atio->entry_type == ATIO_TYPE7 && |
2983 |
+- (le16_to_cpu(atio->attr_n_length & FCP_CMD_LENGTH_MASK) < |
2984 |
+- FCP_CMD_LENGTH_MIN)) |
2985 |
++ ((le16_to_cpu(atio->attr_n_length) & FCP_CMD_LENGTH_MASK) < |
2986 |
++ FCP_CMD_LENGTH_MIN)) |
2987 |
+ return 1; |
2988 |
+ else |
2989 |
+ return 0; |
2990 |
+diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c |
2991 |
+index 52fa52c20be0..d2cafdae8317 100644 |
2992 |
+--- a/drivers/target/iscsi/iscsi_target.c |
2993 |
++++ b/drivers/target/iscsi/iscsi_target.c |
2994 |
+@@ -1421,7 +1421,8 @@ static void iscsit_do_crypto_hash_buf( |
2995 |
+ |
2996 |
+ sg_init_table(sg, ARRAY_SIZE(sg)); |
2997 |
+ sg_set_buf(sg, buf, payload_length); |
2998 |
+- sg_set_buf(sg + 1, pad_bytes, padding); |
2999 |
++ if (padding) |
3000 |
++ sg_set_buf(sg + 1, pad_bytes, padding); |
3001 |
+ |
3002 |
+ ahash_request_set_crypt(hash, sg, data_crc, payload_length + padding); |
3003 |
+ |
3004 |
+@@ -3942,10 +3943,14 @@ static bool iscsi_target_check_conn_state(struct iscsi_conn *conn) |
3005 |
+ static void iscsit_get_rx_pdu(struct iscsi_conn *conn) |
3006 |
+ { |
3007 |
+ int ret; |
3008 |
+- u8 buffer[ISCSI_HDR_LEN], opcode; |
3009 |
++ u8 *buffer, opcode; |
3010 |
+ u32 checksum = 0, digest = 0; |
3011 |
+ struct kvec iov; |
3012 |
+ |
3013 |
++ buffer = kcalloc(ISCSI_HDR_LEN, sizeof(*buffer), GFP_KERNEL); |
3014 |
++ if (!buffer) |
3015 |
++ return; |
3016 |
++ |
3017 |
+ while (!kthread_should_stop()) { |
3018 |
+ /* |
3019 |
+ * Ensure that both TX and RX per connection kthreads |
3020 |
+@@ -3953,7 +3958,6 @@ static void iscsit_get_rx_pdu(struct iscsi_conn *conn) |
3021 |
+ */ |
3022 |
+ iscsit_thread_check_cpumask(conn, current, 0); |
3023 |
+ |
3024 |
+- memset(buffer, 0, ISCSI_HDR_LEN); |
3025 |
+ memset(&iov, 0, sizeof(struct kvec)); |
3026 |
+ |
3027 |
+ iov.iov_base = buffer; |
3028 |
+@@ -3962,7 +3966,7 @@ static void iscsit_get_rx_pdu(struct iscsi_conn *conn) |
3029 |
+ ret = rx_data(conn, &iov, 1, ISCSI_HDR_LEN); |
3030 |
+ if (ret != ISCSI_HDR_LEN) { |
3031 |
+ iscsit_rx_thread_wait_for_tcp(conn); |
3032 |
+- return; |
3033 |
++ break; |
3034 |
+ } |
3035 |
+ |
3036 |
+ if (conn->conn_ops->HeaderDigest) { |
3037 |
+@@ -3972,7 +3976,7 @@ static void iscsit_get_rx_pdu(struct iscsi_conn *conn) |
3038 |
+ ret = rx_data(conn, &iov, 1, ISCSI_CRC_LEN); |
3039 |
+ if (ret != ISCSI_CRC_LEN) { |
3040 |
+ iscsit_rx_thread_wait_for_tcp(conn); |
3041 |
+- return; |
3042 |
++ break; |
3043 |
+ } |
3044 |
+ |
3045 |
+ iscsit_do_crypto_hash_buf(conn->conn_rx_hash, |
3046 |
+@@ -3996,7 +4000,7 @@ static void iscsit_get_rx_pdu(struct iscsi_conn *conn) |
3047 |
+ } |
3048 |
+ |
3049 |
+ if (conn->conn_state == TARG_CONN_STATE_IN_LOGOUT) |
3050 |
+- return; |
3051 |
++ break; |
3052 |
+ |
3053 |
+ opcode = buffer[0] & ISCSI_OPCODE_MASK; |
3054 |
+ |
3055 |
+@@ -4007,13 +4011,15 @@ static void iscsit_get_rx_pdu(struct iscsi_conn *conn) |
3056 |
+ " while in Discovery Session, rejecting.\n", opcode); |
3057 |
+ iscsit_add_reject(conn, ISCSI_REASON_PROTOCOL_ERROR, |
3058 |
+ buffer); |
3059 |
+- return; |
3060 |
++ break; |
3061 |
+ } |
3062 |
+ |
3063 |
+ ret = iscsi_target_rx_opcode(conn, buffer); |
3064 |
+ if (ret < 0) |
3065 |
+- return; |
3066 |
++ break; |
3067 |
+ } |
3068 |
++ |
3069 |
++ kfree(buffer); |
3070 |
+ } |
3071 |
+ |
3072 |
+ int iscsi_target_rx_thread(void *arg) |
3073 |
+diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c |
3074 |
+index c01d1f3a1c7d..d2a9767a8e9c 100644 |
3075 |
+--- a/drivers/usb/host/xhci-hub.c |
3076 |
++++ b/drivers/usb/host/xhci-hub.c |
3077 |
+@@ -1236,17 +1236,17 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, |
3078 |
+ temp = readl(port_array[wIndex]); |
3079 |
+ break; |
3080 |
+ } |
3081 |
+- |
3082 |
+- /* Software should not attempt to set |
3083 |
+- * port link state above '3' (U3) and the port |
3084 |
+- * must be enabled. |
3085 |
+- */ |
3086 |
+- if ((temp & PORT_PE) == 0 || |
3087 |
+- (link_state > USB_SS_PORT_LS_U3)) { |
3088 |
+- xhci_warn(xhci, "Cannot set link state.\n"); |
3089 |
++ /* Port must be enabled */ |
3090 |
++ if (!(temp & PORT_PE)) { |
3091 |
++ retval = -ENODEV; |
3092 |
++ break; |
3093 |
++ } |
3094 |
++ /* Can't set port link state above '3' (U3) */ |
3095 |
++ if (link_state > USB_SS_PORT_LS_U3) { |
3096 |
++ xhci_warn(xhci, "Cannot set port %d link state %d\n", |
3097 |
++ wIndex, link_state); |
3098 |
+ goto error; |
3099 |
+ } |
3100 |
+- |
3101 |
+ if (link_state == USB_SS_PORT_LS_U3) { |
3102 |
+ slot_id = xhci_find_slot_id_by_port(hcd, xhci, |
3103 |
+ wIndex + 1); |
3104 |
+diff --git a/drivers/video/fbdev/aty/atyfb.h b/drivers/video/fbdev/aty/atyfb.h |
3105 |
+index 8235b285dbb2..d09bab3bf224 100644 |
3106 |
+--- a/drivers/video/fbdev/aty/atyfb.h |
3107 |
++++ b/drivers/video/fbdev/aty/atyfb.h |
3108 |
+@@ -333,6 +333,8 @@ extern const struct aty_pll_ops aty_pll_ct; /* Integrated */ |
3109 |
+ extern void aty_set_pll_ct(const struct fb_info *info, const union aty_pll *pll); |
3110 |
+ extern u8 aty_ld_pll_ct(int offset, const struct atyfb_par *par); |
3111 |
+ |
3112 |
++extern const u8 aty_postdividers[8]; |
3113 |
++ |
3114 |
+ |
3115 |
+ /* |
3116 |
+ * Hardware cursor support |
3117 |
+@@ -359,7 +361,6 @@ static inline void wait_for_idle(struct atyfb_par *par) |
3118 |
+ |
3119 |
+ extern void aty_reset_engine(const struct atyfb_par *par); |
3120 |
+ extern void aty_init_engine(struct atyfb_par *par, struct fb_info *info); |
3121 |
+-extern u8 aty_ld_pll_ct(int offset, const struct atyfb_par *par); |
3122 |
+ |
3123 |
+ void atyfb_copyarea(struct fb_info *info, const struct fb_copyarea *area); |
3124 |
+ void atyfb_fillrect(struct fb_info *info, const struct fb_fillrect *rect); |
3125 |
+diff --git a/drivers/video/fbdev/aty/atyfb_base.c b/drivers/video/fbdev/aty/atyfb_base.c |
3126 |
+index 3ec72f19114b..d4b938276d23 100644 |
3127 |
+--- a/drivers/video/fbdev/aty/atyfb_base.c |
3128 |
++++ b/drivers/video/fbdev/aty/atyfb_base.c |
3129 |
+@@ -3087,17 +3087,18 @@ static int atyfb_setup_sparc(struct pci_dev *pdev, struct fb_info *info, |
3130 |
+ /* |
3131 |
+ * PLL Reference Divider M: |
3132 |
+ */ |
3133 |
+- M = pll_regs[2]; |
3134 |
++ M = pll_regs[PLL_REF_DIV]; |
3135 |
+ |
3136 |
+ /* |
3137 |
+ * PLL Feedback Divider N (Dependent on CLOCK_CNTL): |
3138 |
+ */ |
3139 |
+- N = pll_regs[7 + (clock_cntl & 3)]; |
3140 |
++ N = pll_regs[VCLK0_FB_DIV + (clock_cntl & 3)]; |
3141 |
+ |
3142 |
+ /* |
3143 |
+ * PLL Post Divider P (Dependent on CLOCK_CNTL): |
3144 |
+ */ |
3145 |
+- P = 1 << (pll_regs[6] >> ((clock_cntl & 3) << 1)); |
3146 |
++ P = aty_postdividers[((pll_regs[VCLK_POST_DIV] >> ((clock_cntl & 3) << 1)) & 3) | |
3147 |
++ ((pll_regs[PLL_EXT_CNTL] >> (2 + (clock_cntl & 3))) & 4)]; |
3148 |
+ |
3149 |
+ /* |
3150 |
+ * PLL Divider Q: |
3151 |
+diff --git a/drivers/video/fbdev/aty/mach64_ct.c b/drivers/video/fbdev/aty/mach64_ct.c |
3152 |
+index 7d3bd723d3d5..d55f4bacb41c 100644 |
3153 |
+--- a/drivers/video/fbdev/aty/mach64_ct.c |
3154 |
++++ b/drivers/video/fbdev/aty/mach64_ct.c |
3155 |
+@@ -115,7 +115,7 @@ static void aty_st_pll_ct(int offset, u8 val, const struct atyfb_par *par) |
3156 |
+ */ |
3157 |
+ |
3158 |
+ #define Maximum_DSP_PRECISION 7 |
3159 |
+-static u8 postdividers[] = {1,2,4,8,3}; |
3160 |
++const u8 aty_postdividers[8] = {1,2,4,8,3,5,6,12}; |
3161 |
+ |
3162 |
+ static int aty_dsp_gt(const struct fb_info *info, u32 bpp, struct pll_ct *pll) |
3163 |
+ { |
3164 |
+@@ -222,7 +222,7 @@ static int aty_valid_pll_ct(const struct fb_info *info, u32 vclk_per, struct pll |
3165 |
+ pll->vclk_post_div += (q < 64*8); |
3166 |
+ pll->vclk_post_div += (q < 32*8); |
3167 |
+ } |
3168 |
+- pll->vclk_post_div_real = postdividers[pll->vclk_post_div]; |
3169 |
++ pll->vclk_post_div_real = aty_postdividers[pll->vclk_post_div]; |
3170 |
+ // pll->vclk_post_div <<= 6; |
3171 |
+ pll->vclk_fb_div = q * pll->vclk_post_div_real / 8; |
3172 |
+ pllvclk = (1000000 * 2 * pll->vclk_fb_div) / |
3173 |
+@@ -513,7 +513,7 @@ static int aty_init_pll_ct(const struct fb_info *info, union aty_pll *pll) |
3174 |
+ u8 mclk_fb_div, pll_ext_cntl; |
3175 |
+ pll->ct.pll_ref_div = aty_ld_pll_ct(PLL_REF_DIV, par); |
3176 |
+ pll_ext_cntl = aty_ld_pll_ct(PLL_EXT_CNTL, par); |
3177 |
+- pll->ct.xclk_post_div_real = postdividers[pll_ext_cntl & 0x07]; |
3178 |
++ pll->ct.xclk_post_div_real = aty_postdividers[pll_ext_cntl & 0x07]; |
3179 |
+ mclk_fb_div = aty_ld_pll_ct(MCLK_FB_DIV, par); |
3180 |
+ if (pll_ext_cntl & PLL_MFB_TIMES_4_2B) |
3181 |
+ mclk_fb_div <<= 1; |
3182 |
+@@ -535,7 +535,7 @@ static int aty_init_pll_ct(const struct fb_info *info, union aty_pll *pll) |
3183 |
+ xpost_div += (q < 64*8); |
3184 |
+ xpost_div += (q < 32*8); |
3185 |
+ } |
3186 |
+- pll->ct.xclk_post_div_real = postdividers[xpost_div]; |
3187 |
++ pll->ct.xclk_post_div_real = aty_postdividers[xpost_div]; |
3188 |
+ pll->ct.mclk_fb_div = q * pll->ct.xclk_post_div_real / 8; |
3189 |
+ |
3190 |
+ #ifdef CONFIG_PPC |
3191 |
+@@ -584,7 +584,7 @@ static int aty_init_pll_ct(const struct fb_info *info, union aty_pll *pll) |
3192 |
+ mpost_div += (q < 64*8); |
3193 |
+ mpost_div += (q < 32*8); |
3194 |
+ } |
3195 |
+- sclk_post_div_real = postdividers[mpost_div]; |
3196 |
++ sclk_post_div_real = aty_postdividers[mpost_div]; |
3197 |
+ pll->ct.sclk_fb_div = q * sclk_post_div_real / 8; |
3198 |
+ pll->ct.spll_cntl2 = mpost_div << 4; |
3199 |
+ #ifdef DEBUG |
3200 |
+diff --git a/fs/dcache.c b/fs/dcache.c |
3201 |
+index c1a7c174a905..28b2e770bb69 100644 |
3202 |
+--- a/fs/dcache.c |
3203 |
++++ b/fs/dcache.c |
3204 |
+@@ -270,11 +270,25 @@ static void __d_free(struct rcu_head *head) |
3205 |
+ kmem_cache_free(dentry_cache, dentry); |
3206 |
+ } |
3207 |
+ |
3208 |
++static void __d_free_external_name(struct rcu_head *head) |
3209 |
++{ |
3210 |
++ struct external_name *name = container_of(head, struct external_name, |
3211 |
++ u.head); |
3212 |
++ |
3213 |
++ mod_node_page_state(page_pgdat(virt_to_page(name)), |
3214 |
++ NR_INDIRECTLY_RECLAIMABLE_BYTES, |
3215 |
++ -ksize(name)); |
3216 |
++ |
3217 |
++ kfree(name); |
3218 |
++} |
3219 |
++ |
3220 |
+ static void __d_free_external(struct rcu_head *head) |
3221 |
+ { |
3222 |
+ struct dentry *dentry = container_of(head, struct dentry, d_u.d_rcu); |
3223 |
+- kfree(external_name(dentry)); |
3224 |
+- kmem_cache_free(dentry_cache, dentry); |
3225 |
++ |
3226 |
++ __d_free_external_name(&external_name(dentry)->u.head); |
3227 |
++ |
3228 |
++ kmem_cache_free(dentry_cache, dentry); |
3229 |
+ } |
3230 |
+ |
3231 |
+ static inline int dname_external(const struct dentry *dentry) |
3232 |
+@@ -305,7 +319,7 @@ void release_dentry_name_snapshot(struct name_snapshot *name) |
3233 |
+ struct external_name *p; |
3234 |
+ p = container_of(name->name, struct external_name, name[0]); |
3235 |
+ if (unlikely(atomic_dec_and_test(&p->u.count))) |
3236 |
+- kfree_rcu(p, u.head); |
3237 |
++ call_rcu(&p->u.head, __d_free_external_name); |
3238 |
+ } |
3239 |
+ } |
3240 |
+ EXPORT_SYMBOL(release_dentry_name_snapshot); |
3241 |
+@@ -1605,6 +1619,7 @@ EXPORT_SYMBOL(d_invalidate); |
3242 |
+ |
3243 |
+ struct dentry *__d_alloc(struct super_block *sb, const struct qstr *name) |
3244 |
+ { |
3245 |
++ struct external_name *ext = NULL; |
3246 |
+ struct dentry *dentry; |
3247 |
+ char *dname; |
3248 |
+ int err; |
3249 |
+@@ -1625,14 +1640,13 @@ struct dentry *__d_alloc(struct super_block *sb, const struct qstr *name) |
3250 |
+ dname = dentry->d_iname; |
3251 |
+ } else if (name->len > DNAME_INLINE_LEN-1) { |
3252 |
+ size_t size = offsetof(struct external_name, name[1]); |
3253 |
+- struct external_name *p = kmalloc(size + name->len, |
3254 |
+- GFP_KERNEL_ACCOUNT); |
3255 |
+- if (!p) { |
3256 |
++ ext = kmalloc(size + name->len, GFP_KERNEL_ACCOUNT); |
3257 |
++ if (!ext) { |
3258 |
+ kmem_cache_free(dentry_cache, dentry); |
3259 |
+ return NULL; |
3260 |
+ } |
3261 |
+- atomic_set(&p->u.count, 1); |
3262 |
+- dname = p->name; |
3263 |
++ atomic_set(&ext->u.count, 1); |
3264 |
++ dname = ext->name; |
3265 |
+ if (IS_ENABLED(CONFIG_DCACHE_WORD_ACCESS)) |
3266 |
+ kasan_unpoison_shadow(dname, |
3267 |
+ round_up(name->len + 1, sizeof(unsigned long))); |
3268 |
+@@ -1675,6 +1689,12 @@ struct dentry *__d_alloc(struct super_block *sb, const struct qstr *name) |
3269 |
+ } |
3270 |
+ } |
3271 |
+ |
3272 |
++ if (unlikely(ext)) { |
3273 |
++ pg_data_t *pgdat = page_pgdat(virt_to_page(ext)); |
3274 |
++ mod_node_page_state(pgdat, NR_INDIRECTLY_RECLAIMABLE_BYTES, |
3275 |
++ ksize(ext)); |
3276 |
++ } |
3277 |
++ |
3278 |
+ this_cpu_inc(nr_dentry); |
3279 |
+ |
3280 |
+ return dentry; |
3281 |
+@@ -2769,7 +2789,7 @@ static void copy_name(struct dentry *dentry, struct dentry *target) |
3282 |
+ dentry->d_name.hash_len = target->d_name.hash_len; |
3283 |
+ } |
3284 |
+ if (old_name && likely(atomic_dec_and_test(&old_name->u.count))) |
3285 |
+- kfree_rcu(old_name, u.head); |
3286 |
++ call_rcu(&old_name->u.head, __d_free_external_name); |
3287 |
+ } |
3288 |
+ |
3289 |
+ static void dentry_lock_for_move(struct dentry *dentry, struct dentry *target) |
3290 |
+diff --git a/include/linux/cgroup-defs.h b/include/linux/cgroup-defs.h |
3291 |
+index 4e8f77504a57..e7905d9353e8 100644 |
3292 |
+--- a/include/linux/cgroup-defs.h |
3293 |
++++ b/include/linux/cgroup-defs.h |
3294 |
+@@ -353,6 +353,7 @@ struct cgroup { |
3295 |
+ * specific task are charged to the dom_cgrp. |
3296 |
+ */ |
3297 |
+ struct cgroup *dom_cgrp; |
3298 |
++ struct cgroup *old_dom_cgrp; /* used while enabling threaded */ |
3299 |
+ |
3300 |
+ /* |
3301 |
+ * list of pidlists, up to two for each namespace (one for procs, one |
3302 |
+diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h |
3303 |
+index f0938257ee6d..f679f5268467 100644 |
3304 |
+--- a/include/linux/mmzone.h |
3305 |
++++ b/include/linux/mmzone.h |
3306 |
+@@ -180,6 +180,7 @@ enum node_stat_item { |
3307 |
+ NR_VMSCAN_IMMEDIATE, /* Prioritise for reclaim when writeback ends */ |
3308 |
+ NR_DIRTIED, /* page dirtyings since bootup */ |
3309 |
+ NR_WRITTEN, /* page writings since bootup */ |
3310 |
++ NR_INDIRECTLY_RECLAIMABLE_BYTES, /* measured in bytes */ |
3311 |
+ NR_VM_NODE_STAT_ITEMS |
3312 |
+ }; |
3313 |
+ |
3314 |
+diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h |
3315 |
+index 2ea7ee1fb495..a516dbe5869f 100644 |
3316 |
+--- a/include/linux/netdevice.h |
3317 |
++++ b/include/linux/netdevice.h |
3318 |
+@@ -2307,6 +2307,13 @@ struct netdev_notifier_info { |
3319 |
+ struct net_device *dev; |
3320 |
+ }; |
3321 |
+ |
3322 |
++struct netdev_notifier_info_ext { |
3323 |
++ struct netdev_notifier_info info; /* must be first */ |
3324 |
++ union { |
3325 |
++ u32 mtu; |
3326 |
++ } ext; |
3327 |
++}; |
3328 |
++ |
3329 |
+ struct netdev_notifier_change_info { |
3330 |
+ struct netdev_notifier_info info; /* must be first */ |
3331 |
+ unsigned int flags_changed; |
3332 |
+diff --git a/include/linux/perf/arm_pmu.h b/include/linux/perf/arm_pmu.h |
3333 |
+index af0f44effd44..251bc43fdcfc 100644 |
3334 |
+--- a/include/linux/perf/arm_pmu.h |
3335 |
++++ b/include/linux/perf/arm_pmu.h |
3336 |
+@@ -110,6 +110,7 @@ struct arm_pmu { |
3337 |
+ void (*stop)(struct arm_pmu *); |
3338 |
+ void (*reset)(void *); |
3339 |
+ int (*map_event)(struct perf_event *event); |
3340 |
++ int (*filter_match)(struct perf_event *event); |
3341 |
+ int num_events; |
3342 |
+ u64 max_period; |
3343 |
+ bool secure_access; /* 32-bit ARM only */ |
3344 |
+diff --git a/include/linux/virtio_net.h b/include/linux/virtio_net.h |
3345 |
+index 9397628a1967..cb462f9ab7dd 100644 |
3346 |
+--- a/include/linux/virtio_net.h |
3347 |
++++ b/include/linux/virtio_net.h |
3348 |
+@@ -5,6 +5,24 @@ |
3349 |
+ #include <linux/if_vlan.h> |
3350 |
+ #include <uapi/linux/virtio_net.h> |
3351 |
+ |
3352 |
++static inline int virtio_net_hdr_set_proto(struct sk_buff *skb, |
3353 |
++ const struct virtio_net_hdr *hdr) |
3354 |
++{ |
3355 |
++ switch (hdr->gso_type & ~VIRTIO_NET_HDR_GSO_ECN) { |
3356 |
++ case VIRTIO_NET_HDR_GSO_TCPV4: |
3357 |
++ case VIRTIO_NET_HDR_GSO_UDP: |
3358 |
++ skb->protocol = cpu_to_be16(ETH_P_IP); |
3359 |
++ break; |
3360 |
++ case VIRTIO_NET_HDR_GSO_TCPV6: |
3361 |
++ skb->protocol = cpu_to_be16(ETH_P_IPV6); |
3362 |
++ break; |
3363 |
++ default: |
3364 |
++ return -EINVAL; |
3365 |
++ } |
3366 |
++ |
3367 |
++ return 0; |
3368 |
++} |
3369 |
++ |
3370 |
+ static inline int virtio_net_hdr_to_skb(struct sk_buff *skb, |
3371 |
+ const struct virtio_net_hdr *hdr, |
3372 |
+ bool little_endian) |
3373 |
+diff --git a/include/net/bonding.h b/include/net/bonding.h |
3374 |
+index 73799da57400..04008209506a 100644 |
3375 |
+--- a/include/net/bonding.h |
3376 |
++++ b/include/net/bonding.h |
3377 |
+@@ -139,12 +139,6 @@ struct bond_parm_tbl { |
3378 |
+ int mode; |
3379 |
+ }; |
3380 |
+ |
3381 |
+-struct netdev_notify_work { |
3382 |
+- struct delayed_work work; |
3383 |
+- struct net_device *dev; |
3384 |
+- struct netdev_bonding_info bonding_info; |
3385 |
+-}; |
3386 |
+- |
3387 |
+ struct slave { |
3388 |
+ struct net_device *dev; /* first - useful for panic debug */ |
3389 |
+ struct bonding *bond; /* our master */ |
3390 |
+@@ -172,6 +166,7 @@ struct slave { |
3391 |
+ #ifdef CONFIG_NET_POLL_CONTROLLER |
3392 |
+ struct netpoll *np; |
3393 |
+ #endif |
3394 |
++ struct delayed_work notify_work; |
3395 |
+ struct kobject kobj; |
3396 |
+ struct rtnl_link_stats64 slave_stats; |
3397 |
+ }; |
3398 |
+diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h |
3399 |
+index 8e51b4a69088..16a1492a5bd3 100644 |
3400 |
+--- a/include/net/inet_sock.h |
3401 |
++++ b/include/net/inet_sock.h |
3402 |
+@@ -129,12 +129,6 @@ static inline int inet_request_bound_dev_if(const struct sock *sk, |
3403 |
+ return sk->sk_bound_dev_if; |
3404 |
+ } |
3405 |
+ |
3406 |
+-static inline struct ip_options_rcu *ireq_opt_deref(const struct inet_request_sock *ireq) |
3407 |
+-{ |
3408 |
+- return rcu_dereference_check(ireq->ireq_opt, |
3409 |
+- refcount_read(&ireq->req.rsk_refcnt) > 0); |
3410 |
+-} |
3411 |
+- |
3412 |
+ struct inet_cork { |
3413 |
+ unsigned int flags; |
3414 |
+ __be32 addr; |
3415 |
+diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h |
3416 |
+index 5c5d344c0629..32df52869a14 100644 |
3417 |
+--- a/include/net/ip_fib.h |
3418 |
++++ b/include/net/ip_fib.h |
3419 |
+@@ -372,6 +372,7 @@ int ip_fib_check_default(__be32 gw, struct net_device *dev); |
3420 |
+ int fib_sync_down_dev(struct net_device *dev, unsigned long event, bool force); |
3421 |
+ int fib_sync_down_addr(struct net_device *dev, __be32 local); |
3422 |
+ int fib_sync_up(struct net_device *dev, unsigned int nh_flags); |
3423 |
++void fib_sync_mtu(struct net_device *dev, u32 orig_mtu); |
3424 |
+ |
3425 |
+ #ifdef CONFIG_IP_ROUTE_MULTIPATH |
3426 |
+ int fib_multipath_hash(const struct fib_info *fi, const struct flowi4 *fl4, |
3427 |
+diff --git a/include/sound/hdaudio.h b/include/sound/hdaudio.h |
3428 |
+index d8afd8a5bd76..926ea701cdc4 100644 |
3429 |
+--- a/include/sound/hdaudio.h |
3430 |
++++ b/include/sound/hdaudio.h |
3431 |
+@@ -357,6 +357,7 @@ void snd_hdac_bus_init_cmd_io(struct hdac_bus *bus); |
3432 |
+ void snd_hdac_bus_stop_cmd_io(struct hdac_bus *bus); |
3433 |
+ void snd_hdac_bus_enter_link_reset(struct hdac_bus *bus); |
3434 |
+ void snd_hdac_bus_exit_link_reset(struct hdac_bus *bus); |
3435 |
++int snd_hdac_bus_reset_link(struct hdac_bus *bus, bool full_reset); |
3436 |
+ |
3437 |
+ void snd_hdac_bus_update_rirb(struct hdac_bus *bus); |
3438 |
+ int snd_hdac_bus_handle_stream_irq(struct hdac_bus *bus, unsigned int status, |
3439 |
+diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c |
3440 |
+index 76c0ef2cb509..3fc11b8851ac 100644 |
3441 |
+--- a/kernel/cgroup/cgroup.c |
3442 |
++++ b/kernel/cgroup/cgroup.c |
3443 |
+@@ -2780,11 +2780,12 @@ restart: |
3444 |
+ } |
3445 |
+ |
3446 |
+ /** |
3447 |
+- * cgroup_save_control - save control masks of a subtree |
3448 |
++ * cgroup_save_control - save control masks and dom_cgrp of a subtree |
3449 |
+ * @cgrp: root of the target subtree |
3450 |
+ * |
3451 |
+- * Save ->subtree_control and ->subtree_ss_mask to the respective old_ |
3452 |
+- * prefixed fields for @cgrp's subtree including @cgrp itself. |
3453 |
++ * Save ->subtree_control, ->subtree_ss_mask and ->dom_cgrp to the |
3454 |
++ * respective old_ prefixed fields for @cgrp's subtree including @cgrp |
3455 |
++ * itself. |
3456 |
+ */ |
3457 |
+ static void cgroup_save_control(struct cgroup *cgrp) |
3458 |
+ { |
3459 |
+@@ -2794,6 +2795,7 @@ static void cgroup_save_control(struct cgroup *cgrp) |
3460 |
+ cgroup_for_each_live_descendant_pre(dsct, d_css, cgrp) { |
3461 |
+ dsct->old_subtree_control = dsct->subtree_control; |
3462 |
+ dsct->old_subtree_ss_mask = dsct->subtree_ss_mask; |
3463 |
++ dsct->old_dom_cgrp = dsct->dom_cgrp; |
3464 |
+ } |
3465 |
+ } |
3466 |
+ |
3467 |
+@@ -2819,11 +2821,12 @@ static void cgroup_propagate_control(struct cgroup *cgrp) |
3468 |
+ } |
3469 |
+ |
3470 |
+ /** |
3471 |
+- * cgroup_restore_control - restore control masks of a subtree |
3472 |
++ * cgroup_restore_control - restore control masks and dom_cgrp of a subtree |
3473 |
+ * @cgrp: root of the target subtree |
3474 |
+ * |
3475 |
+- * Restore ->subtree_control and ->subtree_ss_mask from the respective old_ |
3476 |
+- * prefixed fields for @cgrp's subtree including @cgrp itself. |
3477 |
++ * Restore ->subtree_control, ->subtree_ss_mask and ->dom_cgrp from the |
3478 |
++ * respective old_ prefixed fields for @cgrp's subtree including @cgrp |
3479 |
++ * itself. |
3480 |
+ */ |
3481 |
+ static void cgroup_restore_control(struct cgroup *cgrp) |
3482 |
+ { |
3483 |
+@@ -2833,6 +2836,7 @@ static void cgroup_restore_control(struct cgroup *cgrp) |
3484 |
+ cgroup_for_each_live_descendant_post(dsct, d_css, cgrp) { |
3485 |
+ dsct->subtree_control = dsct->old_subtree_control; |
3486 |
+ dsct->subtree_ss_mask = dsct->old_subtree_ss_mask; |
3487 |
++ dsct->dom_cgrp = dsct->old_dom_cgrp; |
3488 |
+ } |
3489 |
+ } |
3490 |
+ |
3491 |
+@@ -3140,6 +3144,8 @@ static int cgroup_enable_threaded(struct cgroup *cgrp) |
3492 |
+ { |
3493 |
+ struct cgroup *parent = cgroup_parent(cgrp); |
3494 |
+ struct cgroup *dom_cgrp = parent->dom_cgrp; |
3495 |
++ struct cgroup *dsct; |
3496 |
++ struct cgroup_subsys_state *d_css; |
3497 |
+ int ret; |
3498 |
+ |
3499 |
+ lockdep_assert_held(&cgroup_mutex); |
3500 |
+@@ -3169,12 +3175,13 @@ static int cgroup_enable_threaded(struct cgroup *cgrp) |
3501 |
+ */ |
3502 |
+ cgroup_save_control(cgrp); |
3503 |
+ |
3504 |
+- cgrp->dom_cgrp = dom_cgrp; |
3505 |
++ cgroup_for_each_live_descendant_pre(dsct, d_css, cgrp) |
3506 |
++ if (dsct == cgrp || cgroup_is_threaded(dsct)) |
3507 |
++ dsct->dom_cgrp = dom_cgrp; |
3508 |
++ |
3509 |
+ ret = cgroup_apply_control(cgrp); |
3510 |
+ if (!ret) |
3511 |
+ parent->nr_threaded_children++; |
3512 |
+- else |
3513 |
+- cgrp->dom_cgrp = cgrp; |
3514 |
+ |
3515 |
+ cgroup_finalize_control(cgrp, ret); |
3516 |
+ return ret; |
3517 |
+diff --git a/mm/huge_memory.c b/mm/huge_memory.c |
3518 |
+index 174612f8339c..39c1fedcfdb4 100644 |
3519 |
+--- a/mm/huge_memory.c |
3520 |
++++ b/mm/huge_memory.c |
3521 |
+@@ -2843,9 +2843,6 @@ void set_pmd_migration_entry(struct page_vma_mapped_walk *pvmw, |
3522 |
+ if (!(pvmw->pmd && !pvmw->pte)) |
3523 |
+ return; |
3524 |
+ |
3525 |
+- mmu_notifier_invalidate_range_start(mm, address, |
3526 |
+- address + HPAGE_PMD_SIZE); |
3527 |
+- |
3528 |
+ flush_cache_range(vma, address, address + HPAGE_PMD_SIZE); |
3529 |
+ pmdval = *pvmw->pmd; |
3530 |
+ pmdp_invalidate(vma, address, pvmw->pmd); |
3531 |
+@@ -2858,9 +2855,6 @@ void set_pmd_migration_entry(struct page_vma_mapped_walk *pvmw, |
3532 |
+ set_pmd_at(mm, address, pvmw->pmd, pmdswp); |
3533 |
+ page_remove_rmap(page, true); |
3534 |
+ put_page(page); |
3535 |
+- |
3536 |
+- mmu_notifier_invalidate_range_end(mm, address, |
3537 |
+- address + HPAGE_PMD_SIZE); |
3538 |
+ } |
3539 |
+ |
3540 |
+ void remove_migration_pmd(struct page_vma_mapped_walk *pvmw, struct page *new) |
3541 |
+diff --git a/mm/page_alloc.c b/mm/page_alloc.c |
3542 |
+index 59ccf455fcbd..a604b5da6755 100644 |
3543 |
+--- a/mm/page_alloc.c |
3544 |
++++ b/mm/page_alloc.c |
3545 |
+@@ -4557,6 +4557,13 @@ long si_mem_available(void) |
3546 |
+ min(global_node_page_state(NR_SLAB_RECLAIMABLE) / 2, |
3547 |
+ wmark_low); |
3548 |
+ |
3549 |
++ /* |
3550 |
++ * Part of the kernel memory, which can be released under memory |
3551 |
++ * pressure. |
3552 |
++ */ |
3553 |
++ available += global_node_page_state(NR_INDIRECTLY_RECLAIMABLE_BYTES) >> |
3554 |
++ PAGE_SHIFT; |
3555 |
++ |
3556 |
+ if (available < 0) |
3557 |
+ available = 0; |
3558 |
+ return available; |
3559 |
+diff --git a/mm/percpu.c b/mm/percpu.c |
3560 |
+index 5fa5e79b69f0..3074148b7e0d 100644 |
3561 |
+--- a/mm/percpu.c |
3562 |
++++ b/mm/percpu.c |
3563 |
+@@ -1208,6 +1208,7 @@ static void pcpu_free_chunk(struct pcpu_chunk *chunk) |
3564 |
+ { |
3565 |
+ if (!chunk) |
3566 |
+ return; |
3567 |
++ pcpu_mem_free(chunk->md_blocks); |
3568 |
+ pcpu_mem_free(chunk->bound_map); |
3569 |
+ pcpu_mem_free(chunk->alloc_map); |
3570 |
+ pcpu_mem_free(chunk); |
3571 |
+diff --git a/mm/util.c b/mm/util.c |
3572 |
+index 34e57fae959d..547e04b5cfff 100644 |
3573 |
+--- a/mm/util.c |
3574 |
++++ b/mm/util.c |
3575 |
+@@ -635,6 +635,13 @@ int __vm_enough_memory(struct mm_struct *mm, long pages, int cap_sys_admin) |
3576 |
+ */ |
3577 |
+ free += global_node_page_state(NR_SLAB_RECLAIMABLE); |
3578 |
+ |
3579 |
++ /* |
3580 |
++ * Part of the kernel memory, which can be released |
3581 |
++ * under memory pressure. |
3582 |
++ */ |
3583 |
++ free += global_node_page_state( |
3584 |
++ NR_INDIRECTLY_RECLAIMABLE_BYTES) >> PAGE_SHIFT; |
3585 |
++ |
3586 |
+ /* |
3587 |
+ * Leave reserved pages. The pages are not for anonymous pages. |
3588 |
+ */ |
3589 |
+diff --git a/mm/vmstat.c b/mm/vmstat.c |
3590 |
+index 2bdc962b2dfe..527ae727d547 100644 |
3591 |
+--- a/mm/vmstat.c |
3592 |
++++ b/mm/vmstat.c |
3593 |
+@@ -1090,6 +1090,7 @@ const char * const vmstat_text[] = { |
3594 |
+ "nr_vmscan_immediate_reclaim", |
3595 |
+ "nr_dirtied", |
3596 |
+ "nr_written", |
3597 |
++ "", /* nr_indirectly_reclaimable */ |
3598 |
+ |
3599 |
+ /* enum writeback_stat_item counters */ |
3600 |
+ "nr_dirty_threshold", |
3601 |
+@@ -1214,7 +1215,6 @@ const char * const vmstat_text[] = { |
3602 |
+ #ifdef CONFIG_DEBUG_VM_VMACACHE |
3603 |
+ "vmacache_find_calls", |
3604 |
+ "vmacache_find_hits", |
3605 |
+- "vmacache_full_flushes", |
3606 |
+ #endif |
3607 |
+ #ifdef CONFIG_SWAP |
3608 |
+ "swap_ra", |
3609 |
+@@ -1673,6 +1673,10 @@ static int vmstat_show(struct seq_file *m, void *arg) |
3610 |
+ unsigned long *l = arg; |
3611 |
+ unsigned long off = l - (unsigned long *)m->private; |
3612 |
+ |
3613 |
++ /* Skip hidden vmstat items. */ |
3614 |
++ if (*vmstat_text[off] == '\0') |
3615 |
++ return 0; |
3616 |
++ |
3617 |
+ seq_puts(m, vmstat_text[off]); |
3618 |
+ seq_put_decimal_ull(m, " ", *l); |
3619 |
+ seq_putc(m, '\n'); |
3620 |
+diff --git a/net/core/dev.c b/net/core/dev.c |
3621 |
+index 85f4a1047707..e8a66ad6d07c 100644 |
3622 |
+--- a/net/core/dev.c |
3623 |
++++ b/net/core/dev.c |
3624 |
+@@ -1688,6 +1688,28 @@ int call_netdevice_notifiers(unsigned long val, struct net_device *dev) |
3625 |
+ } |
3626 |
+ EXPORT_SYMBOL(call_netdevice_notifiers); |
3627 |
+ |
3628 |
++/** |
3629 |
++ * call_netdevice_notifiers_mtu - call all network notifier blocks |
3630 |
++ * @val: value passed unmodified to notifier function |
3631 |
++ * @dev: net_device pointer passed unmodified to notifier function |
3632 |
++ * @arg: additional u32 argument passed to the notifier function |
3633 |
++ * |
3634 |
++ * Call all network notifier blocks. Parameters and return value |
3635 |
++ * are as for raw_notifier_call_chain(). |
3636 |
++ */ |
3637 |
++static int call_netdevice_notifiers_mtu(unsigned long val, |
3638 |
++ struct net_device *dev, u32 arg) |
3639 |
++{ |
3640 |
++ struct netdev_notifier_info_ext info = { |
3641 |
++ .info.dev = dev, |
3642 |
++ .ext.mtu = arg, |
3643 |
++ }; |
3644 |
++ |
3645 |
++ BUILD_BUG_ON(offsetof(struct netdev_notifier_info_ext, info) != 0); |
3646 |
++ |
3647 |
++ return call_netdevice_notifiers_info(val, dev, &info.info); |
3648 |
++} |
3649 |
++ |
3650 |
+ #ifdef CONFIG_NET_INGRESS |
3651 |
+ static struct static_key ingress_needed __read_mostly; |
3652 |
+ |
3653 |
+@@ -6891,14 +6913,16 @@ int dev_set_mtu(struct net_device *dev, int new_mtu) |
3654 |
+ err = __dev_set_mtu(dev, new_mtu); |
3655 |
+ |
3656 |
+ if (!err) { |
3657 |
+- err = call_netdevice_notifiers(NETDEV_CHANGEMTU, dev); |
3658 |
++ err = call_netdevice_notifiers_mtu(NETDEV_CHANGEMTU, dev, |
3659 |
++ orig_mtu); |
3660 |
+ err = notifier_to_errno(err); |
3661 |
+ if (err) { |
3662 |
+ /* setting mtu back and notifying everyone again, |
3663 |
+ * so that they have a chance to revert changes. |
3664 |
+ */ |
3665 |
+ __dev_set_mtu(dev, orig_mtu); |
3666 |
+- call_netdevice_notifiers(NETDEV_CHANGEMTU, dev); |
3667 |
++ call_netdevice_notifiers_mtu(NETDEV_CHANGEMTU, dev, |
3668 |
++ new_mtu); |
3669 |
+ } |
3670 |
+ } |
3671 |
+ return err; |
3672 |
+diff --git a/net/core/ethtool.c b/net/core/ethtool.c |
3673 |
+index 490eab16b04b..0ae5ac5e090f 100644 |
3674 |
+--- a/net/core/ethtool.c |
3675 |
++++ b/net/core/ethtool.c |
3676 |
+@@ -2572,6 +2572,7 @@ int dev_ethtool(struct net *net, struct ifreq *ifr) |
3677 |
+ case ETHTOOL_GPHYSTATS: |
3678 |
+ case ETHTOOL_GTSO: |
3679 |
+ case ETHTOOL_GPERMADDR: |
3680 |
++ case ETHTOOL_GUFO: |
3681 |
+ case ETHTOOL_GGSO: |
3682 |
+ case ETHTOOL_GGRO: |
3683 |
+ case ETHTOOL_GFLAGS: |
3684 |
+diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c |
3685 |
+index efe396cc77b5..760364526dc1 100644 |
3686 |
+--- a/net/core/rtnetlink.c |
3687 |
++++ b/net/core/rtnetlink.c |
3688 |
+@@ -2430,6 +2430,12 @@ struct net_device *rtnl_create_link(struct net *net, |
3689 |
+ else if (ops->get_num_rx_queues) |
3690 |
+ num_rx_queues = ops->get_num_rx_queues(); |
3691 |
+ |
3692 |
++ if (num_tx_queues < 1 || num_tx_queues > 4096) |
3693 |
++ return ERR_PTR(-EINVAL); |
3694 |
++ |
3695 |
++ if (num_rx_queues < 1 || num_rx_queues > 4096) |
3696 |
++ return ERR_PTR(-EINVAL); |
3697 |
++ |
3698 |
+ dev = alloc_netdev_mqs(ops->priv_size, ifname, name_assign_type, |
3699 |
+ ops->setup, num_tx_queues, num_rx_queues); |
3700 |
+ if (!dev) |
3701 |
+@@ -3292,16 +3298,27 @@ static int rtnl_fdb_dump(struct sk_buff *skb, struct netlink_callback *cb) |
3702 |
+ int err = 0; |
3703 |
+ int fidx = 0; |
3704 |
+ |
3705 |
+- err = nlmsg_parse(cb->nlh, sizeof(struct ifinfomsg), tb, |
3706 |
+- IFLA_MAX, ifla_policy, NULL); |
3707 |
+- if (err < 0) { |
3708 |
+- return -EINVAL; |
3709 |
+- } else if (err == 0) { |
3710 |
+- if (tb[IFLA_MASTER]) |
3711 |
+- br_idx = nla_get_u32(tb[IFLA_MASTER]); |
3712 |
+- } |
3713 |
++ /* A hack to preserve kernel<->userspace interface. |
3714 |
++ * Before Linux v4.12 this code accepted ndmsg since iproute2 v3.3.0. |
3715 |
++ * However, ndmsg is shorter than ifinfomsg thus nlmsg_parse() bails. |
3716 |
++ * So, check for ndmsg with an optional u32 attribute (not used here). |
3717 |
++ * Fortunately these sizes don't conflict with the size of ifinfomsg |
3718 |
++ * with an optional attribute. |
3719 |
++ */ |
3720 |
++ if (nlmsg_len(cb->nlh) != sizeof(struct ndmsg) && |
3721 |
++ (nlmsg_len(cb->nlh) != sizeof(struct ndmsg) + |
3722 |
++ nla_attr_size(sizeof(u32)))) { |
3723 |
++ err = nlmsg_parse(cb->nlh, sizeof(struct ifinfomsg), tb, |
3724 |
++ IFLA_MAX, ifla_policy, NULL); |
3725 |
++ if (err < 0) { |
3726 |
++ return -EINVAL; |
3727 |
++ } else if (err == 0) { |
3728 |
++ if (tb[IFLA_MASTER]) |
3729 |
++ br_idx = nla_get_u32(tb[IFLA_MASTER]); |
3730 |
++ } |
3731 |
+ |
3732 |
+- brport_idx = ifm->ifi_index; |
3733 |
++ brport_idx = ifm->ifi_index; |
3734 |
++ } |
3735 |
+ |
3736 |
+ if (br_idx) { |
3737 |
+ br_dev = __dev_get_by_index(net, br_idx); |
3738 |
+diff --git a/net/dccp/input.c b/net/dccp/input.c |
3739 |
+index fa6be9750bb4..849f399aec21 100644 |
3740 |
+--- a/net/dccp/input.c |
3741 |
++++ b/net/dccp/input.c |
3742 |
+@@ -605,11 +605,13 @@ int dccp_rcv_state_process(struct sock *sk, struct sk_buff *skb, |
3743 |
+ if (sk->sk_state == DCCP_LISTEN) { |
3744 |
+ if (dh->dccph_type == DCCP_PKT_REQUEST) { |
3745 |
+ /* It is possible that we process SYN packets from backlog, |
3746 |
+- * so we need to make sure to disable BH right there. |
3747 |
++ * so we need to make sure to disable BH and RCU right there. |
3748 |
+ */ |
3749 |
++ rcu_read_lock(); |
3750 |
+ local_bh_disable(); |
3751 |
+ acceptable = inet_csk(sk)->icsk_af_ops->conn_request(sk, skb) >= 0; |
3752 |
+ local_bh_enable(); |
3753 |
++ rcu_read_unlock(); |
3754 |
+ if (!acceptable) |
3755 |
+ return 1; |
3756 |
+ consume_skb(skb); |
3757 |
+diff --git a/net/dccp/ipv4.c b/net/dccp/ipv4.c |
3758 |
+index b08feb219b44..8e08cea6f178 100644 |
3759 |
+--- a/net/dccp/ipv4.c |
3760 |
++++ b/net/dccp/ipv4.c |
3761 |
+@@ -493,9 +493,11 @@ static int dccp_v4_send_response(const struct sock *sk, struct request_sock *req |
3762 |
+ |
3763 |
+ dh->dccph_checksum = dccp_v4_csum_finish(skb, ireq->ir_loc_addr, |
3764 |
+ ireq->ir_rmt_addr); |
3765 |
++ rcu_read_lock(); |
3766 |
+ err = ip_build_and_send_pkt(skb, sk, ireq->ir_loc_addr, |
3767 |
+ ireq->ir_rmt_addr, |
3768 |
+- ireq_opt_deref(ireq)); |
3769 |
++ rcu_dereference(ireq->ireq_opt)); |
3770 |
++ rcu_read_unlock(); |
3771 |
+ err = net_xmit_eval(err); |
3772 |
+ } |
3773 |
+ |
3774 |
+diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c |
3775 |
+index 5bbdd05d0cd3..1b3f860f7dcd 100644 |
3776 |
+--- a/net/ipv4/fib_frontend.c |
3777 |
++++ b/net/ipv4/fib_frontend.c |
3778 |
+@@ -1185,7 +1185,8 @@ static int fib_inetaddr_event(struct notifier_block *this, unsigned long event, |
3779 |
+ static int fib_netdev_event(struct notifier_block *this, unsigned long event, void *ptr) |
3780 |
+ { |
3781 |
+ struct net_device *dev = netdev_notifier_info_to_dev(ptr); |
3782 |
+- struct netdev_notifier_changeupper_info *info; |
3783 |
++ struct netdev_notifier_changeupper_info *upper_info = ptr; |
3784 |
++ struct netdev_notifier_info_ext *info_ext = ptr; |
3785 |
+ struct in_device *in_dev; |
3786 |
+ struct net *net = dev_net(dev); |
3787 |
+ unsigned int flags; |
3788 |
+@@ -1220,16 +1221,19 @@ static int fib_netdev_event(struct notifier_block *this, unsigned long event, vo |
3789 |
+ fib_sync_up(dev, RTNH_F_LINKDOWN); |
3790 |
+ else |
3791 |
+ fib_sync_down_dev(dev, event, false); |
3792 |
+- /* fall through */ |
3793 |
++ rt_cache_flush(net); |
3794 |
++ break; |
3795 |
+ case NETDEV_CHANGEMTU: |
3796 |
++ fib_sync_mtu(dev, info_ext->ext.mtu); |
3797 |
+ rt_cache_flush(net); |
3798 |
+ break; |
3799 |
+ case NETDEV_CHANGEUPPER: |
3800 |
+- info = ptr; |
3801 |
++ upper_info = ptr; |
3802 |
+ /* flush all routes if dev is linked to or unlinked from |
3803 |
+ * an L3 master device (e.g., VRF) |
3804 |
+ */ |
3805 |
+- if (info->upper_dev && netif_is_l3_master(info->upper_dev)) |
3806 |
++ if (upper_info->upper_dev && |
3807 |
++ netif_is_l3_master(upper_info->upper_dev)) |
3808 |
+ fib_disable_ip(dev, NETDEV_DOWN, true); |
3809 |
+ break; |
3810 |
+ } |
3811 |
+diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c |
3812 |
+index b557af72cde9..e76b8a7bb891 100644 |
3813 |
+--- a/net/ipv4/fib_semantics.c |
3814 |
++++ b/net/ipv4/fib_semantics.c |
3815 |
+@@ -1520,6 +1520,56 @@ static int call_fib_nh_notifiers(struct fib_nh *fib_nh, |
3816 |
+ return NOTIFY_DONE; |
3817 |
+ } |
3818 |
+ |
3819 |
++/* Update the PMTU of exceptions when: |
3820 |
++ * - the new MTU of the first hop becomes smaller than the PMTU |
3821 |
++ * - the old MTU was the same as the PMTU, and it limited discovery of |
3822 |
++ * larger MTUs on the path. With that limit raised, we can now |
3823 |
++ * discover larger MTUs |
3824 |
++ * A special case is locked exceptions, for which the PMTU is smaller |
3825 |
++ * than the minimal accepted PMTU: |
3826 |
++ * - if the new MTU is greater than the PMTU, don't make any change |
3827 |
++ * - otherwise, unlock and set PMTU |
3828 |
++ */ |
3829 |
++static void nh_update_mtu(struct fib_nh *nh, u32 new, u32 orig) |
3830 |
++{ |
3831 |
++ struct fnhe_hash_bucket *bucket; |
3832 |
++ int i; |
3833 |
++ |
3834 |
++ bucket = rcu_dereference_protected(nh->nh_exceptions, 1); |
3835 |
++ if (!bucket) |
3836 |
++ return; |
3837 |
++ |
3838 |
++ for (i = 0; i < FNHE_HASH_SIZE; i++) { |
3839 |
++ struct fib_nh_exception *fnhe; |
3840 |
++ |
3841 |
++ for (fnhe = rcu_dereference_protected(bucket[i].chain, 1); |
3842 |
++ fnhe; |
3843 |
++ fnhe = rcu_dereference_protected(fnhe->fnhe_next, 1)) { |
3844 |
++ if (fnhe->fnhe_mtu_locked) { |
3845 |
++ if (new <= fnhe->fnhe_pmtu) { |
3846 |
++ fnhe->fnhe_pmtu = new; |
3847 |
++ fnhe->fnhe_mtu_locked = false; |
3848 |
++ } |
3849 |
++ } else if (new < fnhe->fnhe_pmtu || |
3850 |
++ orig == fnhe->fnhe_pmtu) { |
3851 |
++ fnhe->fnhe_pmtu = new; |
3852 |
++ } |
3853 |
++ } |
3854 |
++ } |
3855 |
++} |
3856 |
++ |
3857 |
++void fib_sync_mtu(struct net_device *dev, u32 orig_mtu) |
3858 |
++{ |
3859 |
++ unsigned int hash = fib_devindex_hashfn(dev->ifindex); |
3860 |
++ struct hlist_head *head = &fib_info_devhash[hash]; |
3861 |
++ struct fib_nh *nh; |
3862 |
++ |
3863 |
++ hlist_for_each_entry(nh, head, nh_hash) { |
3864 |
++ if (nh->nh_dev == dev) |
3865 |
++ nh_update_mtu(nh, dev->mtu, orig_mtu); |
3866 |
++ } |
3867 |
++} |
3868 |
++ |
3869 |
+ /* Event force Flags Description |
3870 |
+ * NETDEV_CHANGE 0 LINKDOWN Carrier OFF, not for scope host |
3871 |
+ * NETDEV_DOWN 0 LINKDOWN|DEAD Link down, not for scope host |
3872 |
+diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c |
3873 |
+index 0cc08c512202..9d6b172caf6c 100644 |
3874 |
+--- a/net/ipv4/inet_connection_sock.c |
3875 |
++++ b/net/ipv4/inet_connection_sock.c |
3876 |
+@@ -542,7 +542,8 @@ struct dst_entry *inet_csk_route_req(const struct sock *sk, |
3877 |
+ struct ip_options_rcu *opt; |
3878 |
+ struct rtable *rt; |
3879 |
+ |
3880 |
+- opt = ireq_opt_deref(ireq); |
3881 |
++ rcu_read_lock(); |
3882 |
++ opt = rcu_dereference(ireq->ireq_opt); |
3883 |
+ |
3884 |
+ flowi4_init_output(fl4, ireq->ir_iif, ireq->ir_mark, |
3885 |
+ RT_CONN_FLAGS(sk), RT_SCOPE_UNIVERSE, |
3886 |
+@@ -556,11 +557,13 @@ struct dst_entry *inet_csk_route_req(const struct sock *sk, |
3887 |
+ goto no_route; |
3888 |
+ if (opt && opt->opt.is_strictroute && rt->rt_uses_gateway) |
3889 |
+ goto route_err; |
3890 |
++ rcu_read_unlock(); |
3891 |
+ return &rt->dst; |
3892 |
+ |
3893 |
+ route_err: |
3894 |
+ ip_rt_put(rt); |
3895 |
+ no_route: |
3896 |
++ rcu_read_unlock(); |
3897 |
+ __IP_INC_STATS(net, IPSTATS_MIB_OUTNOROUTES); |
3898 |
+ return NULL; |
3899 |
+ } |
3900 |
+diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c |
3901 |
+index 048d5f6dd320..4ef92ebc4f6d 100644 |
3902 |
+--- a/net/ipv4/ip_sockglue.c |
3903 |
++++ b/net/ipv4/ip_sockglue.c |
3904 |
+@@ -147,7 +147,6 @@ static void ip_cmsg_recv_security(struct msghdr *msg, struct sk_buff *skb) |
3905 |
+ static void ip_cmsg_recv_dstaddr(struct msghdr *msg, struct sk_buff *skb) |
3906 |
+ { |
3907 |
+ struct sockaddr_in sin; |
3908 |
+- const struct iphdr *iph = ip_hdr(skb); |
3909 |
+ __be16 *ports; |
3910 |
+ int end; |
3911 |
+ |
3912 |
+@@ -162,7 +161,7 @@ static void ip_cmsg_recv_dstaddr(struct msghdr *msg, struct sk_buff *skb) |
3913 |
+ ports = (__be16 *)skb_transport_header(skb); |
3914 |
+ |
3915 |
+ sin.sin_family = AF_INET; |
3916 |
+- sin.sin_addr.s_addr = iph->daddr; |
3917 |
++ sin.sin_addr.s_addr = ip_hdr(skb)->daddr; |
3918 |
+ sin.sin_port = ports[1]; |
3919 |
+ memset(sin.sin_zero, 0, sizeof(sin.sin_zero)); |
3920 |
+ |
3921 |
+diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c |
3922 |
+index 4784f3f36b7e..72eee34092ae 100644 |
3923 |
+--- a/net/ipv4/ip_tunnel.c |
3924 |
++++ b/net/ipv4/ip_tunnel.c |
3925 |
+@@ -635,6 +635,7 @@ void ip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev, |
3926 |
+ const struct iphdr *tnl_params, u8 protocol) |
3927 |
+ { |
3928 |
+ struct ip_tunnel *tunnel = netdev_priv(dev); |
3929 |
++ unsigned int inner_nhdr_len = 0; |
3930 |
+ const struct iphdr *inner_iph; |
3931 |
+ struct flowi4 fl4; |
3932 |
+ u8 tos, ttl; |
3933 |
+@@ -644,6 +645,14 @@ void ip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev, |
3934 |
+ __be32 dst; |
3935 |
+ bool connected; |
3936 |
+ |
3937 |
++ /* ensure we can access the inner net header, for several users below */ |
3938 |
++ if (skb->protocol == htons(ETH_P_IP)) |
3939 |
++ inner_nhdr_len = sizeof(struct iphdr); |
3940 |
++ else if (skb->protocol == htons(ETH_P_IPV6)) |
3941 |
++ inner_nhdr_len = sizeof(struct ipv6hdr); |
3942 |
++ if (unlikely(!pskb_may_pull(skb, inner_nhdr_len))) |
3943 |
++ goto tx_error; |
3944 |
++ |
3945 |
+ inner_iph = (const struct iphdr *)skb_inner_network_header(skb); |
3946 |
+ connected = (tunnel->parms.iph.daddr != 0); |
3947 |
+ |
3948 |
+diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c |
3949 |
+index 991f382afc1b..e24c0d7adf65 100644 |
3950 |
+--- a/net/ipv4/tcp_input.c |
3951 |
++++ b/net/ipv4/tcp_input.c |
3952 |
+@@ -5913,11 +5913,13 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb) |
3953 |
+ if (th->fin) |
3954 |
+ goto discard; |
3955 |
+ /* It is possible that we process SYN packets from backlog, |
3956 |
+- * so we need to make sure to disable BH right there. |
3957 |
++ * so we need to make sure to disable BH and RCU right there. |
3958 |
+ */ |
3959 |
++ rcu_read_lock(); |
3960 |
+ local_bh_disable(); |
3961 |
+ acceptable = icsk->icsk_af_ops->conn_request(sk, skb) >= 0; |
3962 |
+ local_bh_enable(); |
3963 |
++ rcu_read_unlock(); |
3964 |
+ |
3965 |
+ if (!acceptable) |
3966 |
+ return 1; |
3967 |
+diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c |
3968 |
+index 0e1a670dabd9..31b34c0c2d5f 100644 |
3969 |
+--- a/net/ipv4/tcp_ipv4.c |
3970 |
++++ b/net/ipv4/tcp_ipv4.c |
3971 |
+@@ -875,9 +875,11 @@ static int tcp_v4_send_synack(const struct sock *sk, struct dst_entry *dst, |
3972 |
+ if (skb) { |
3973 |
+ __tcp_v4_send_check(skb, ireq->ir_loc_addr, ireq->ir_rmt_addr); |
3974 |
+ |
3975 |
++ rcu_read_lock(); |
3976 |
+ err = ip_build_and_send_pkt(skb, sk, ireq->ir_loc_addr, |
3977 |
+ ireq->ir_rmt_addr, |
3978 |
+- ireq_opt_deref(ireq)); |
3979 |
++ rcu_dereference(ireq->ireq_opt)); |
3980 |
++ rcu_read_unlock(); |
3981 |
+ err = net_xmit_eval(err); |
3982 |
+ } |
3983 |
+ |
3984 |
+diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c |
3985 |
+index 3de413867991..dc0ec227b9d2 100644 |
3986 |
+--- a/net/ipv4/udp.c |
3987 |
++++ b/net/ipv4/udp.c |
3988 |
+@@ -1565,7 +1565,7 @@ busy_check: |
3989 |
+ *err = error; |
3990 |
+ return NULL; |
3991 |
+ } |
3992 |
+-EXPORT_SYMBOL_GPL(__skb_recv_udp); |
3993 |
++EXPORT_SYMBOL(__skb_recv_udp); |
3994 |
+ |
3995 |
+ /* |
3996 |
+ * This should be easy, if there is something there we |
3997 |
+diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c |
3998 |
+index 6a76e41e6d51..569f7c3f6b95 100644 |
3999 |
+--- a/net/ipv6/addrconf.c |
4000 |
++++ b/net/ipv6/addrconf.c |
4001 |
+@@ -4136,7 +4136,6 @@ static struct inet6_ifaddr *if6_get_first(struct seq_file *seq, loff_t pos) |
4002 |
+ p++; |
4003 |
+ continue; |
4004 |
+ } |
4005 |
+- state->offset++; |
4006 |
+ return ifa; |
4007 |
+ } |
4008 |
+ |
4009 |
+@@ -4160,13 +4159,12 @@ static struct inet6_ifaddr *if6_get_next(struct seq_file *seq, |
4010 |
+ return ifa; |
4011 |
+ } |
4012 |
+ |
4013 |
++ state->offset = 0; |
4014 |
+ while (++state->bucket < IN6_ADDR_HSIZE) { |
4015 |
+- state->offset = 0; |
4016 |
+ hlist_for_each_entry_rcu_bh(ifa, |
4017 |
+ &inet6_addr_lst[state->bucket], addr_lst) { |
4018 |
+ if (!net_eq(dev_net(ifa->idev->dev), net)) |
4019 |
+ continue; |
4020 |
+- state->offset++; |
4021 |
+ return ifa; |
4022 |
+ } |
4023 |
+ } |
4024 |
+diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c |
4025 |
+index ee8dbd228fe2..0e9296f44ee4 100644 |
4026 |
+--- a/net/ipv6/ip6_tunnel.c |
4027 |
++++ b/net/ipv6/ip6_tunnel.c |
4028 |
+@@ -1227,7 +1227,7 @@ static inline int |
4029 |
+ ip4ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev) |
4030 |
+ { |
4031 |
+ struct ip6_tnl *t = netdev_priv(dev); |
4032 |
+- const struct iphdr *iph = ip_hdr(skb); |
4033 |
++ const struct iphdr *iph; |
4034 |
+ int encap_limit = -1; |
4035 |
+ struct flowi6 fl6; |
4036 |
+ __u8 dsfield; |
4037 |
+@@ -1235,6 +1235,11 @@ ip4ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev) |
4038 |
+ u8 tproto; |
4039 |
+ int err; |
4040 |
+ |
4041 |
++ /* ensure we can access the full inner ip header */ |
4042 |
++ if (!pskb_may_pull(skb, sizeof(struct iphdr))) |
4043 |
++ return -1; |
4044 |
++ |
4045 |
++ iph = ip_hdr(skb); |
4046 |
+ memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt)); |
4047 |
+ |
4048 |
+ tproto = ACCESS_ONCE(t->parms.proto); |
4049 |
+@@ -1298,7 +1303,7 @@ static inline int |
4050 |
+ ip6ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev) |
4051 |
+ { |
4052 |
+ struct ip6_tnl *t = netdev_priv(dev); |
4053 |
+- struct ipv6hdr *ipv6h = ipv6_hdr(skb); |
4054 |
++ struct ipv6hdr *ipv6h; |
4055 |
+ int encap_limit = -1; |
4056 |
+ __u16 offset; |
4057 |
+ struct flowi6 fl6; |
4058 |
+@@ -1307,6 +1312,10 @@ ip6ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev) |
4059 |
+ u8 tproto; |
4060 |
+ int err; |
4061 |
+ |
4062 |
++ if (unlikely(!pskb_may_pull(skb, sizeof(*ipv6h)))) |
4063 |
++ return -1; |
4064 |
++ |
4065 |
++ ipv6h = ipv6_hdr(skb); |
4066 |
+ tproto = ACCESS_ONCE(t->parms.proto); |
4067 |
+ if ((tproto != IPPROTO_IPV6 && tproto != 0) || |
4068 |
+ ip6_tnl_addr_conflict(t, ipv6h)) |
4069 |
+diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c |
4070 |
+index e4462b0ff801..f08cc6527339 100644 |
4071 |
+--- a/net/ipv6/raw.c |
4072 |
++++ b/net/ipv6/raw.c |
4073 |
+@@ -650,8 +650,6 @@ static int rawv6_send_hdrinc(struct sock *sk, struct msghdr *msg, int length, |
4074 |
+ skb->protocol = htons(ETH_P_IPV6); |
4075 |
+ skb->priority = sk->sk_priority; |
4076 |
+ skb->mark = sk->sk_mark; |
4077 |
+- skb_dst_set(skb, &rt->dst); |
4078 |
+- *dstp = NULL; |
4079 |
+ |
4080 |
+ skb_put(skb, length); |
4081 |
+ skb_reset_network_header(skb); |
4082 |
+@@ -664,8 +662,14 @@ static int rawv6_send_hdrinc(struct sock *sk, struct msghdr *msg, int length, |
4083 |
+ |
4084 |
+ skb->transport_header = skb->network_header; |
4085 |
+ err = memcpy_from_msg(iph, msg, length); |
4086 |
+- if (err) |
4087 |
+- goto error_fault; |
4088 |
++ if (err) { |
4089 |
++ err = -EFAULT; |
4090 |
++ kfree_skb(skb); |
4091 |
++ goto error; |
4092 |
++ } |
4093 |
++ |
4094 |
++ skb_dst_set(skb, &rt->dst); |
4095 |
++ *dstp = NULL; |
4096 |
+ |
4097 |
+ /* if egress device is enslaved to an L3 master device pass the |
4098 |
+ * skb to its handler for processing |
4099 |
+@@ -674,21 +678,28 @@ static int rawv6_send_hdrinc(struct sock *sk, struct msghdr *msg, int length, |
4100 |
+ if (unlikely(!skb)) |
4101 |
+ return 0; |
4102 |
+ |
4103 |
++ /* Acquire rcu_read_lock() in case we need to use rt->rt6i_idev |
4104 |
++ * in the error path. Since skb has been freed, the dst could |
4105 |
++ * have been queued for deletion. |
4106 |
++ */ |
4107 |
++ rcu_read_lock(); |
4108 |
+ IP6_UPD_PO_STATS(net, rt->rt6i_idev, IPSTATS_MIB_OUT, skb->len); |
4109 |
+ err = NF_HOOK(NFPROTO_IPV6, NF_INET_LOCAL_OUT, net, sk, skb, |
4110 |
+ NULL, rt->dst.dev, dst_output); |
4111 |
+ if (err > 0) |
4112 |
+ err = net_xmit_errno(err); |
4113 |
+- if (err) |
4114 |
+- goto error; |
4115 |
++ if (err) { |
4116 |
++ IP6_INC_STATS(net, rt->rt6i_idev, IPSTATS_MIB_OUTDISCARDS); |
4117 |
++ rcu_read_unlock(); |
4118 |
++ goto error_check; |
4119 |
++ } |
4120 |
++ rcu_read_unlock(); |
4121 |
+ out: |
4122 |
+ return 0; |
4123 |
+ |
4124 |
+-error_fault: |
4125 |
+- err = -EFAULT; |
4126 |
+- kfree_skb(skb); |
4127 |
+ error: |
4128 |
+ IP6_INC_STATS(net, rt->rt6i_idev, IPSTATS_MIB_OUTDISCARDS); |
4129 |
++error_check: |
4130 |
+ if (err == -ENOBUFS && !np->recverr) |
4131 |
+ err = 0; |
4132 |
+ return err; |
4133 |
+diff --git a/net/netlabel/netlabel_unlabeled.c b/net/netlabel/netlabel_unlabeled.c |
4134 |
+index c070dfc0190a..c92894c3e40a 100644 |
4135 |
+--- a/net/netlabel/netlabel_unlabeled.c |
4136 |
++++ b/net/netlabel/netlabel_unlabeled.c |
4137 |
+@@ -781,7 +781,8 @@ static int netlbl_unlabel_addrinfo_get(struct genl_info *info, |
4138 |
+ { |
4139 |
+ u32 addr_len; |
4140 |
+ |
4141 |
+- if (info->attrs[NLBL_UNLABEL_A_IPV4ADDR]) { |
4142 |
++ if (info->attrs[NLBL_UNLABEL_A_IPV4ADDR] && |
4143 |
++ info->attrs[NLBL_UNLABEL_A_IPV4MASK]) { |
4144 |
+ addr_len = nla_len(info->attrs[NLBL_UNLABEL_A_IPV4ADDR]); |
4145 |
+ if (addr_len != sizeof(struct in_addr) && |
4146 |
+ addr_len != nla_len(info->attrs[NLBL_UNLABEL_A_IPV4MASK])) |
4147 |
+diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c |
4148 |
+index 8833a58ca3ee..8d1a7c900393 100644 |
4149 |
+--- a/net/packet/af_packet.c |
4150 |
++++ b/net/packet/af_packet.c |
4151 |
+@@ -2753,10 +2753,12 @@ tpacket_error: |
4152 |
+ } |
4153 |
+ } |
4154 |
+ |
4155 |
+- if (po->has_vnet_hdr && virtio_net_hdr_to_skb(skb, vnet_hdr, |
4156 |
+- vio_le())) { |
4157 |
+- tp_len = -EINVAL; |
4158 |
+- goto tpacket_error; |
4159 |
++ if (po->has_vnet_hdr) { |
4160 |
++ if (virtio_net_hdr_to_skb(skb, vnet_hdr, vio_le())) { |
4161 |
++ tp_len = -EINVAL; |
4162 |
++ goto tpacket_error; |
4163 |
++ } |
4164 |
++ virtio_net_hdr_set_proto(skb, vnet_hdr); |
4165 |
+ } |
4166 |
+ |
4167 |
+ skb->destructor = tpacket_destruct_skb; |
4168 |
+@@ -2952,6 +2954,7 @@ static int packet_snd(struct socket *sock, struct msghdr *msg, size_t len) |
4169 |
+ if (err) |
4170 |
+ goto out_free; |
4171 |
+ len += sizeof(vnet_hdr); |
4172 |
++ virtio_net_hdr_set_proto(skb, &vnet_hdr); |
4173 |
+ } |
4174 |
+ |
4175 |
+ skb_probe_transport_header(skb, reserve); |
4176 |
+diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c |
4177 |
+index 22bc6fc48311..cd69aa067543 100644 |
4178 |
+--- a/net/sched/sch_api.c |
4179 |
++++ b/net/sched/sch_api.c |
4180 |
+@@ -1216,6 +1216,16 @@ check_loop_fn(struct Qdisc *q, unsigned long cl, struct qdisc_walker *w) |
4181 |
+ * Delete/get qdisc. |
4182 |
+ */ |
4183 |
+ |
4184 |
++const struct nla_policy rtm_tca_policy[TCA_MAX + 1] = { |
4185 |
++ [TCA_KIND] = { .type = NLA_STRING }, |
4186 |
++ [TCA_OPTIONS] = { .type = NLA_NESTED }, |
4187 |
++ [TCA_RATE] = { .type = NLA_BINARY, |
4188 |
++ .len = sizeof(struct tc_estimator) }, |
4189 |
++ [TCA_STAB] = { .type = NLA_NESTED }, |
4190 |
++ [TCA_DUMP_INVISIBLE] = { .type = NLA_FLAG }, |
4191 |
++ [TCA_CHAIN] = { .type = NLA_U32 }, |
4192 |
++}; |
4193 |
++ |
4194 |
+ static int tc_get_qdisc(struct sk_buff *skb, struct nlmsghdr *n, |
4195 |
+ struct netlink_ext_ack *extack) |
4196 |
+ { |
4197 |
+@@ -1232,7 +1242,8 @@ static int tc_get_qdisc(struct sk_buff *skb, struct nlmsghdr *n, |
4198 |
+ !netlink_ns_capable(skb, net->user_ns, CAP_NET_ADMIN)) |
4199 |
+ return -EPERM; |
4200 |
+ |
4201 |
+- err = nlmsg_parse(n, sizeof(*tcm), tca, TCA_MAX, NULL, extack); |
4202 |
++ err = nlmsg_parse(n, sizeof(*tcm), tca, TCA_MAX, rtm_tca_policy, |
4203 |
++ extack); |
4204 |
+ if (err < 0) |
4205 |
+ return err; |
4206 |
+ |
4207 |
+@@ -1302,7 +1313,8 @@ static int tc_modify_qdisc(struct sk_buff *skb, struct nlmsghdr *n, |
4208 |
+ |
4209 |
+ replay: |
4210 |
+ /* Reinit, just in case something touches this. */ |
4211 |
+- err = nlmsg_parse(n, sizeof(*tcm), tca, TCA_MAX, NULL, extack); |
4212 |
++ err = nlmsg_parse(n, sizeof(*tcm), tca, TCA_MAX, rtm_tca_policy, |
4213 |
++ extack); |
4214 |
+ if (err < 0) |
4215 |
+ return err; |
4216 |
+ |
4217 |
+@@ -1512,7 +1524,8 @@ static int tc_dump_qdisc(struct sk_buff *skb, struct netlink_callback *cb) |
4218 |
+ idx = 0; |
4219 |
+ ASSERT_RTNL(); |
4220 |
+ |
4221 |
+- err = nlmsg_parse(nlh, sizeof(*tcm), tca, TCA_MAX, NULL, NULL); |
4222 |
++ err = nlmsg_parse(nlh, sizeof(*tcm), tca, TCA_MAX, |
4223 |
++ rtm_tca_policy, NULL); |
4224 |
+ if (err < 0) |
4225 |
+ return err; |
4226 |
+ |
4227 |
+@@ -1729,7 +1742,8 @@ static int tc_ctl_tclass(struct sk_buff *skb, struct nlmsghdr *n, |
4228 |
+ !netlink_ns_capable(skb, net->user_ns, CAP_NET_ADMIN)) |
4229 |
+ return -EPERM; |
4230 |
+ |
4231 |
+- err = nlmsg_parse(n, sizeof(*tcm), tca, TCA_MAX, NULL, extack); |
4232 |
++ err = nlmsg_parse(n, sizeof(*tcm), tca, TCA_MAX, rtm_tca_policy, |
4233 |
++ extack); |
4234 |
+ if (err < 0) |
4235 |
+ return err; |
4236 |
+ |
4237 |
+diff --git a/net/sctp/transport.c b/net/sctp/transport.c |
4238 |
+index e0c2a4e23039..43105cf04bc4 100644 |
4239 |
+--- a/net/sctp/transport.c |
4240 |
++++ b/net/sctp/transport.c |
4241 |
+@@ -254,6 +254,7 @@ void sctp_transport_pmtu(struct sctp_transport *transport, struct sock *sk) |
4242 |
+ bool sctp_transport_update_pmtu(struct sctp_transport *t, u32 pmtu) |
4243 |
+ { |
4244 |
+ struct dst_entry *dst = sctp_transport_dst_check(t); |
4245 |
++ struct sock *sk = t->asoc->base.sk; |
4246 |
+ bool change = true; |
4247 |
+ |
4248 |
+ if (unlikely(pmtu < SCTP_DEFAULT_MINSEGMENT)) { |
4249 |
+@@ -265,12 +266,19 @@ bool sctp_transport_update_pmtu(struct sctp_transport *t, u32 pmtu) |
4250 |
+ pmtu = SCTP_TRUNC4(pmtu); |
4251 |
+ |
4252 |
+ if (dst) { |
4253 |
+- dst->ops->update_pmtu(dst, t->asoc->base.sk, NULL, pmtu); |
4254 |
++ struct sctp_pf *pf = sctp_get_pf_specific(dst->ops->family); |
4255 |
++ union sctp_addr addr; |
4256 |
++ |
4257 |
++ pf->af->from_sk(&addr, sk); |
4258 |
++ pf->to_sk_daddr(&t->ipaddr, sk); |
4259 |
++ dst->ops->update_pmtu(dst, sk, NULL, pmtu); |
4260 |
++ pf->to_sk_daddr(&addr, sk); |
4261 |
++ |
4262 |
+ dst = sctp_transport_dst_check(t); |
4263 |
+ } |
4264 |
+ |
4265 |
+ if (!dst) { |
4266 |
+- t->af_specific->get_dst(t, &t->saddr, &t->fl, t->asoc->base.sk); |
4267 |
++ t->af_specific->get_dst(t, &t->saddr, &t->fl, sk); |
4268 |
+ dst = t->dst; |
4269 |
+ } |
4270 |
+ |
4271 |
+diff --git a/net/tipc/socket.c b/net/tipc/socket.c |
4272 |
+index 0aebf0695ae0..4d2125d258fe 100644 |
4273 |
+--- a/net/tipc/socket.c |
4274 |
++++ b/net/tipc/socket.c |
4275 |
+@@ -1063,8 +1063,10 @@ static int __tipc_sendstream(struct socket *sock, struct msghdr *m, size_t dlen) |
4276 |
+ /* Handle implicit connection setup */ |
4277 |
+ if (unlikely(dest)) { |
4278 |
+ rc = __tipc_sendmsg(sock, m, dlen); |
4279 |
+- if (dlen && (dlen == rc)) |
4280 |
++ if (dlen && dlen == rc) { |
4281 |
++ tsk->peer_caps = tipc_node_get_capabilities(net, dnode); |
4282 |
+ tsk->snt_unacked = tsk_inc(tsk, dlen + msg_hdr_sz(hdr)); |
4283 |
++ } |
4284 |
+ return rc; |
4285 |
+ } |
4286 |
+ |
4287 |
+diff --git a/sound/hda/hdac_controller.c b/sound/hda/hdac_controller.c |
4288 |
+index f6d2985b2520..778b42ba90b8 100644 |
4289 |
+--- a/sound/hda/hdac_controller.c |
4290 |
++++ b/sound/hda/hdac_controller.c |
4291 |
+@@ -40,6 +40,8 @@ static void azx_clear_corbrp(struct hdac_bus *bus) |
4292 |
+ */ |
4293 |
+ void snd_hdac_bus_init_cmd_io(struct hdac_bus *bus) |
4294 |
+ { |
4295 |
++ WARN_ON_ONCE(!bus->rb.area); |
4296 |
++ |
4297 |
+ spin_lock_irq(&bus->reg_lock); |
4298 |
+ /* CORB set up */ |
4299 |
+ bus->corb.addr = bus->rb.addr; |
4300 |
+@@ -382,7 +384,7 @@ void snd_hdac_bus_exit_link_reset(struct hdac_bus *bus) |
4301 |
+ EXPORT_SYMBOL_GPL(snd_hdac_bus_exit_link_reset); |
4302 |
+ |
4303 |
+ /* reset codec link */ |
4304 |
+-static int azx_reset(struct hdac_bus *bus, bool full_reset) |
4305 |
++int snd_hdac_bus_reset_link(struct hdac_bus *bus, bool full_reset) |
4306 |
+ { |
4307 |
+ if (!full_reset) |
4308 |
+ goto skip_reset; |
4309 |
+@@ -407,7 +409,7 @@ static int azx_reset(struct hdac_bus *bus, bool full_reset) |
4310 |
+ skip_reset: |
4311 |
+ /* check to see if controller is ready */ |
4312 |
+ if (!snd_hdac_chip_readb(bus, GCTL)) { |
4313 |
+- dev_dbg(bus->dev, "azx_reset: controller not ready!\n"); |
4314 |
++ dev_dbg(bus->dev, "controller not ready!\n"); |
4315 |
+ return -EBUSY; |
4316 |
+ } |
4317 |
+ |
4318 |
+@@ -422,6 +424,7 @@ static int azx_reset(struct hdac_bus *bus, bool full_reset) |
4319 |
+ |
4320 |
+ return 0; |
4321 |
+ } |
4322 |
++EXPORT_SYMBOL_GPL(snd_hdac_bus_reset_link); |
4323 |
+ |
4324 |
+ /* enable interrupts */ |
4325 |
+ static void azx_int_enable(struct hdac_bus *bus) |
4326 |
+@@ -476,15 +479,17 @@ bool snd_hdac_bus_init_chip(struct hdac_bus *bus, bool full_reset) |
4327 |
+ return false; |
4328 |
+ |
4329 |
+ /* reset controller */ |
4330 |
+- azx_reset(bus, full_reset); |
4331 |
++ snd_hdac_bus_reset_link(bus, full_reset); |
4332 |
+ |
4333 |
+- /* initialize interrupts */ |
4334 |
++ /* clear interrupts */ |
4335 |
+ azx_int_clear(bus); |
4336 |
+- azx_int_enable(bus); |
4337 |
+ |
4338 |
+ /* initialize the codec command I/O */ |
4339 |
+ snd_hdac_bus_init_cmd_io(bus); |
4340 |
+ |
4341 |
++ /* enable interrupts after CORB/RIRB buffers are initialized above */ |
4342 |
++ azx_int_enable(bus); |
4343 |
++ |
4344 |
+ /* program the position buffer */ |
4345 |
+ if (bus->use_posbuf && bus->posbuf.addr) { |
4346 |
+ snd_hdac_chip_writel(bus, DPLBASE, (u32)bus->posbuf.addr); |
4347 |
+diff --git a/sound/soc/codecs/rt5514.c b/sound/soc/codecs/rt5514.c |
4348 |
+index 1bfc8db1826a..56ddab43da7e 100644 |
4349 |
+--- a/sound/soc/codecs/rt5514.c |
4350 |
++++ b/sound/soc/codecs/rt5514.c |
4351 |
+@@ -64,8 +64,8 @@ static const struct reg_sequence rt5514_patch[] = { |
4352 |
+ {RT5514_ANA_CTRL_LDO10, 0x00028604}, |
4353 |
+ {RT5514_ANA_CTRL_ADCFED, 0x00000800}, |
4354 |
+ {RT5514_ASRC_IN_CTRL1, 0x00000003}, |
4355 |
+- {RT5514_DOWNFILTER0_CTRL3, 0x10000352}, |
4356 |
+- {RT5514_DOWNFILTER1_CTRL3, 0x10000352}, |
4357 |
++ {RT5514_DOWNFILTER0_CTRL3, 0x10000342}, |
4358 |
++ {RT5514_DOWNFILTER1_CTRL3, 0x10000342}, |
4359 |
+ }; |
4360 |
+ |
4361 |
+ static const struct reg_default rt5514_reg[] = { |
4362 |
+@@ -92,10 +92,10 @@ static const struct reg_default rt5514_reg[] = { |
4363 |
+ {RT5514_ASRC_IN_CTRL1, 0x00000003}, |
4364 |
+ {RT5514_DOWNFILTER0_CTRL1, 0x00020c2f}, |
4365 |
+ {RT5514_DOWNFILTER0_CTRL2, 0x00020c2f}, |
4366 |
+- {RT5514_DOWNFILTER0_CTRL3, 0x10000352}, |
4367 |
++ {RT5514_DOWNFILTER0_CTRL3, 0x10000342}, |
4368 |
+ {RT5514_DOWNFILTER1_CTRL1, 0x00020c2f}, |
4369 |
+ {RT5514_DOWNFILTER1_CTRL2, 0x00020c2f}, |
4370 |
+- {RT5514_DOWNFILTER1_CTRL3, 0x10000352}, |
4371 |
++ {RT5514_DOWNFILTER1_CTRL3, 0x10000342}, |
4372 |
+ {RT5514_ANA_CTRL_LDO10, 0x00028604}, |
4373 |
+ {RT5514_ANA_CTRL_LDO18_16, 0x02000345}, |
4374 |
+ {RT5514_ANA_CTRL_ADC12, 0x0000a2a8}, |
4375 |
+diff --git a/sound/soc/codecs/sigmadsp.c b/sound/soc/codecs/sigmadsp.c |
4376 |
+index d53680ac78e4..6df158669420 100644 |
4377 |
+--- a/sound/soc/codecs/sigmadsp.c |
4378 |
++++ b/sound/soc/codecs/sigmadsp.c |
4379 |
+@@ -117,8 +117,7 @@ static int sigmadsp_ctrl_write(struct sigmadsp *sigmadsp, |
4380 |
+ struct sigmadsp_control *ctrl, void *data) |
4381 |
+ { |
4382 |
+ /* safeload loads up to 20 bytes in a atomic operation */ |
4383 |
+- if (ctrl->num_bytes > 4 && ctrl->num_bytes <= 20 && sigmadsp->ops && |
4384 |
+- sigmadsp->ops->safeload) |
4385 |
++ if (ctrl->num_bytes <= 20 && sigmadsp->ops && sigmadsp->ops->safeload) |
4386 |
+ return sigmadsp->ops->safeload(sigmadsp, ctrl->addr, data, |
4387 |
+ ctrl->num_bytes); |
4388 |
+ else |
4389 |
+diff --git a/sound/soc/codecs/wm8804-i2c.c b/sound/soc/codecs/wm8804-i2c.c |
4390 |
+index f27464c2c5ba..79541960f45d 100644 |
4391 |
+--- a/sound/soc/codecs/wm8804-i2c.c |
4392 |
++++ b/sound/soc/codecs/wm8804-i2c.c |
4393 |
+@@ -13,6 +13,7 @@ |
4394 |
+ #include <linux/init.h> |
4395 |
+ #include <linux/module.h> |
4396 |
+ #include <linux/i2c.h> |
4397 |
++#include <linux/acpi.h> |
4398 |
+ |
4399 |
+ #include "wm8804.h" |
4400 |
+ |
4401 |
+@@ -40,17 +41,29 @@ static const struct i2c_device_id wm8804_i2c_id[] = { |
4402 |
+ }; |
4403 |
+ MODULE_DEVICE_TABLE(i2c, wm8804_i2c_id); |
4404 |
+ |
4405 |
++#if defined(CONFIG_OF) |
4406 |
+ static const struct of_device_id wm8804_of_match[] = { |
4407 |
+ { .compatible = "wlf,wm8804", }, |
4408 |
+ { } |
4409 |
+ }; |
4410 |
+ MODULE_DEVICE_TABLE(of, wm8804_of_match); |
4411 |
++#endif |
4412 |
++ |
4413 |
++#ifdef CONFIG_ACPI |
4414 |
++static const struct acpi_device_id wm8804_acpi_match[] = { |
4415 |
++ { "1AEC8804", 0 }, /* Wolfson PCI ID + part ID */ |
4416 |
++ { "10138804", 0 }, /* Cirrus Logic PCI ID + part ID */ |
4417 |
++ { }, |
4418 |
++}; |
4419 |
++MODULE_DEVICE_TABLE(acpi, wm8804_acpi_match); |
4420 |
++#endif |
4421 |
+ |
4422 |
+ static struct i2c_driver wm8804_i2c_driver = { |
4423 |
+ .driver = { |
4424 |
+ .name = "wm8804", |
4425 |
+ .pm = &wm8804_pm, |
4426 |
+- .of_match_table = wm8804_of_match, |
4427 |
++ .of_match_table = of_match_ptr(wm8804_of_match), |
4428 |
++ .acpi_match_table = ACPI_PTR(wm8804_acpi_match), |
4429 |
+ }, |
4430 |
+ .probe = wm8804_i2c_probe, |
4431 |
+ .remove = wm8804_i2c_remove, |
4432 |
+diff --git a/sound/soc/intel/skylake/skl.c b/sound/soc/intel/skylake/skl.c |
4433 |
+index f94b484abb99..a0bef63b8fb1 100644 |
4434 |
+--- a/sound/soc/intel/skylake/skl.c |
4435 |
++++ b/sound/soc/intel/skylake/skl.c |
4436 |
+@@ -698,7 +698,7 @@ static int skl_first_init(struct hdac_ext_bus *ebus) |
4437 |
+ return -ENXIO; |
4438 |
+ } |
4439 |
+ |
4440 |
+- skl_init_chip(bus, true); |
4441 |
++ snd_hdac_bus_reset_link(bus, true); |
4442 |
+ |
4443 |
+ snd_hdac_bus_parse_capabilities(bus); |
4444 |
+ |
4445 |
+diff --git a/sound/soc/sh/rcar/adg.c b/sound/soc/sh/rcar/adg.c |
4446 |
+index e28edb1f7263..eb7879bcc6a7 100644 |
4447 |
+--- a/sound/soc/sh/rcar/adg.c |
4448 |
++++ b/sound/soc/sh/rcar/adg.c |
4449 |
+@@ -467,6 +467,11 @@ static void rsnd_adg_get_clkout(struct rsnd_priv *priv, |
4450 |
+ goto rsnd_adg_get_clkout_end; |
4451 |
+ |
4452 |
+ req_size = prop->length / sizeof(u32); |
4453 |
++ if (req_size > REQ_SIZE) { |
4454 |
++ dev_err(dev, |
4455 |
++ "too many clock-frequency, use top %d\n", REQ_SIZE); |
4456 |
++ req_size = REQ_SIZE; |
4457 |
++ } |
4458 |
+ |
4459 |
+ of_property_read_u32_array(np, "clock-frequency", req_rate, req_size); |
4460 |
+ req_48kHz_rate = 0; |
4461 |
+diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c |
4462 |
+index 9896e736fa5c..710c01cd2ad2 100644 |
4463 |
+--- a/sound/soc/sh/rcar/core.c |
4464 |
++++ b/sound/soc/sh/rcar/core.c |
4465 |
+@@ -486,7 +486,7 @@ static int rsnd_status_update(u32 *status, |
4466 |
+ (func_call && (mod)->ops->fn) ? #fn : ""); \ |
4467 |
+ if (func_call && (mod)->ops->fn) \ |
4468 |
+ tmp = (mod)->ops->fn(mod, io, param); \ |
4469 |
+- if (tmp) \ |
4470 |
++ if (tmp && (tmp != -EPROBE_DEFER)) \ |
4471 |
+ dev_err(dev, "%s[%d] : %s error %d\n", \ |
4472 |
+ rsnd_mod_name(mod), rsnd_mod_id(mod), \ |
4473 |
+ #fn, tmp); \ |
4474 |
+@@ -1469,6 +1469,14 @@ exit_snd_probe: |
4475 |
+ rsnd_dai_call(remove, &rdai->capture, priv); |
4476 |
+ } |
4477 |
+ |
4478 |
++ /* |
4479 |
++ * adg is very special mod which can't use rsnd_dai_call(remove), |
4480 |
++ * and it registers ADG clock on probe. |
4481 |
++ * It should be unregister if probe failed. |
4482 |
++ * Mainly it is assuming -EPROBE_DEFER case |
4483 |
++ */ |
4484 |
++ rsnd_adg_remove(priv); |
4485 |
++ |
4486 |
+ return ret; |
4487 |
+ } |
4488 |
+ |
4489 |
+diff --git a/sound/soc/sh/rcar/dma.c b/sound/soc/sh/rcar/dma.c |
4490 |
+index 041ec1080d52..39a46e302bab 100644 |
4491 |
+--- a/sound/soc/sh/rcar/dma.c |
4492 |
++++ b/sound/soc/sh/rcar/dma.c |
4493 |
+@@ -330,6 +330,10 @@ static int rsnd_dmaen_attach(struct rsnd_dai_stream *io, |
4494 |
+ /* try to get DMAEngine channel */ |
4495 |
+ chan = rsnd_dmaen_request_channel(io, mod_from, mod_to); |
4496 |
+ if (IS_ERR_OR_NULL(chan)) { |
4497 |
++ /* Let's follow when -EPROBE_DEFER case */ |
4498 |
++ if (PTR_ERR(chan) == -EPROBE_DEFER) |
4499 |
++ return PTR_ERR(chan); |
4500 |
++ |
4501 |
+ /* |
4502 |
+ * DMA failed. try to PIO mode |
4503 |
+ * see |
4504 |
+diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c |
4505 |
+index e37653b0f2d0..76789523429a 100644 |
4506 |
+--- a/tools/perf/builtin-script.c |
4507 |
++++ b/tools/perf/builtin-script.c |
4508 |
+@@ -2304,8 +2304,8 @@ static int list_available_scripts(const struct option *opt __maybe_unused, |
4509 |
+ } |
4510 |
+ |
4511 |
+ for_each_lang(scripts_path, scripts_dir, lang_dirent) { |
4512 |
+- snprintf(lang_path, MAXPATHLEN, "%s/%s/bin", scripts_path, |
4513 |
+- lang_dirent->d_name); |
4514 |
++ scnprintf(lang_path, MAXPATHLEN, "%s/%s/bin", scripts_path, |
4515 |
++ lang_dirent->d_name); |
4516 |
+ lang_dir = opendir(lang_path); |
4517 |
+ if (!lang_dir) |
4518 |
+ continue; |
4519 |
+@@ -2314,8 +2314,8 @@ static int list_available_scripts(const struct option *opt __maybe_unused, |
4520 |
+ script_root = get_script_root(script_dirent, REPORT_SUFFIX); |
4521 |
+ if (script_root) { |
4522 |
+ desc = script_desc__findnew(script_root); |
4523 |
+- snprintf(script_path, MAXPATHLEN, "%s/%s", |
4524 |
+- lang_path, script_dirent->d_name); |
4525 |
++ scnprintf(script_path, MAXPATHLEN, "%s/%s", |
4526 |
++ lang_path, script_dirent->d_name); |
4527 |
+ read_script_info(desc, script_path); |
4528 |
+ free(script_root); |
4529 |
+ } |
4530 |
+@@ -2351,7 +2351,7 @@ static int check_ev_match(char *dir_name, char *scriptname, |
4531 |
+ int match, len; |
4532 |
+ FILE *fp; |
4533 |
+ |
4534 |
+- sprintf(filename, "%s/bin/%s-record", dir_name, scriptname); |
4535 |
++ scnprintf(filename, MAXPATHLEN, "%s/bin/%s-record", dir_name, scriptname); |
4536 |
+ |
4537 |
+ fp = fopen(filename, "r"); |
4538 |
+ if (!fp) |
4539 |
+@@ -2427,8 +2427,8 @@ int find_scripts(char **scripts_array, char **scripts_path_array) |
4540 |
+ } |
4541 |
+ |
4542 |
+ for_each_lang(scripts_path, scripts_dir, lang_dirent) { |
4543 |
+- snprintf(lang_path, MAXPATHLEN, "%s/%s", scripts_path, |
4544 |
+- lang_dirent->d_name); |
4545 |
++ scnprintf(lang_path, MAXPATHLEN, "%s/%s", scripts_path, |
4546 |
++ lang_dirent->d_name); |
4547 |
+ #ifdef NO_LIBPERL |
4548 |
+ if (strstr(lang_path, "perl")) |
4549 |
+ continue; |
4550 |
+@@ -2483,8 +2483,8 @@ static char *get_script_path(const char *script_root, const char *suffix) |
4551 |
+ return NULL; |
4552 |
+ |
4553 |
+ for_each_lang(scripts_path, scripts_dir, lang_dirent) { |
4554 |
+- snprintf(lang_path, MAXPATHLEN, "%s/%s/bin", scripts_path, |
4555 |
+- lang_dirent->d_name); |
4556 |
++ scnprintf(lang_path, MAXPATHLEN, "%s/%s/bin", scripts_path, |
4557 |
++ lang_dirent->d_name); |
4558 |
+ lang_dir = opendir(lang_path); |
4559 |
+ if (!lang_dir) |
4560 |
+ continue; |
4561 |
+@@ -2495,8 +2495,8 @@ static char *get_script_path(const char *script_root, const char *suffix) |
4562 |
+ free(__script_root); |
4563 |
+ closedir(lang_dir); |
4564 |
+ closedir(scripts_dir); |
4565 |
+- snprintf(script_path, MAXPATHLEN, "%s/%s", |
4566 |
+- lang_path, script_dirent->d_name); |
4567 |
++ scnprintf(script_path, MAXPATHLEN, "%s/%s", |
4568 |
++ lang_path, script_dirent->d_name); |
4569 |
+ return strdup(script_path); |
4570 |
+ } |
4571 |
+ free(__script_root); |
4572 |
+diff --git a/tools/perf/scripts/python/export-to-postgresql.py b/tools/perf/scripts/python/export-to-postgresql.py |
4573 |
+index efcaf6cac2eb..e46f51b17513 100644 |
4574 |
+--- a/tools/perf/scripts/python/export-to-postgresql.py |
4575 |
++++ b/tools/perf/scripts/python/export-to-postgresql.py |
4576 |
+@@ -204,14 +204,23 @@ from ctypes import * |
4577 |
+ libpq = CDLL("libpq.so.5") |
4578 |
+ PQconnectdb = libpq.PQconnectdb |
4579 |
+ PQconnectdb.restype = c_void_p |
4580 |
++PQconnectdb.argtypes = [ c_char_p ] |
4581 |
+ PQfinish = libpq.PQfinish |
4582 |
++PQfinish.argtypes = [ c_void_p ] |
4583 |
+ PQstatus = libpq.PQstatus |
4584 |
++PQstatus.restype = c_int |
4585 |
++PQstatus.argtypes = [ c_void_p ] |
4586 |
+ PQexec = libpq.PQexec |
4587 |
+ PQexec.restype = c_void_p |
4588 |
++PQexec.argtypes = [ c_void_p, c_char_p ] |
4589 |
+ PQresultStatus = libpq.PQresultStatus |
4590 |
++PQresultStatus.restype = c_int |
4591 |
++PQresultStatus.argtypes = [ c_void_p ] |
4592 |
+ PQputCopyData = libpq.PQputCopyData |
4593 |
++PQputCopyData.restype = c_int |
4594 |
+ PQputCopyData.argtypes = [ c_void_p, c_void_p, c_int ] |
4595 |
+ PQputCopyEnd = libpq.PQputCopyEnd |
4596 |
++PQputCopyEnd.restype = c_int |
4597 |
+ PQputCopyEnd.argtypes = [ c_void_p, c_void_p ] |
4598 |
+ |
4599 |
+ sys.path.append(os.environ['PERF_EXEC_PATH'] + \ |
4600 |
+diff --git a/tools/perf/scripts/python/export-to-sqlite.py b/tools/perf/scripts/python/export-to-sqlite.py |
4601 |
+index f827bf77e9d2..e4bb82c8aba9 100644 |
4602 |
+--- a/tools/perf/scripts/python/export-to-sqlite.py |
4603 |
++++ b/tools/perf/scripts/python/export-to-sqlite.py |
4604 |
+@@ -440,7 +440,11 @@ def branch_type_table(*x): |
4605 |
+ |
4606 |
+ def sample_table(*x): |
4607 |
+ if branches: |
4608 |
+- bind_exec(sample_query, 18, x) |
4609 |
++ for xx in x[0:15]: |
4610 |
++ sample_query.addBindValue(str(xx)) |
4611 |
++ for xx in x[19:22]: |
4612 |
++ sample_query.addBindValue(str(xx)) |
4613 |
++ do_query_(sample_query) |
4614 |
+ else: |
4615 |
+ bind_exec(sample_query, 22, x) |
4616 |
+ |
4617 |
+diff --git a/tools/perf/tests/attr.c b/tools/perf/tests/attr.c |
4618 |
+index 0e1367f90af5..60fea0a376fc 100644 |
4619 |
+--- a/tools/perf/tests/attr.c |
4620 |
++++ b/tools/perf/tests/attr.c |
4621 |
+@@ -164,8 +164,8 @@ static int run_dir(const char *d, const char *perf) |
4622 |
+ if (verbose > 0) |
4623 |
+ vcnt++; |
4624 |
+ |
4625 |
+- snprintf(cmd, 3*PATH_MAX, PYTHON " %s/attr.py -d %s/attr/ -p %s %.*s", |
4626 |
+- d, d, perf, vcnt, v); |
4627 |
++ scnprintf(cmd, 3*PATH_MAX, PYTHON " %s/attr.py -d %s/attr/ -p %s %.*s", |
4628 |
++ d, d, perf, vcnt, v); |
4629 |
+ |
4630 |
+ return system(cmd) ? TEST_FAIL : TEST_OK; |
4631 |
+ } |
4632 |
+diff --git a/tools/perf/tests/mem.c b/tools/perf/tests/mem.c |
4633 |
+index 21952e1e6e6d..0f82ee9fd3f7 100644 |
4634 |
+--- a/tools/perf/tests/mem.c |
4635 |
++++ b/tools/perf/tests/mem.c |
4636 |
+@@ -16,7 +16,7 @@ static int check(union perf_mem_data_src data_src, |
4637 |
+ |
4638 |
+ n = perf_mem__snp_scnprintf(out, sizeof out, &mi); |
4639 |
+ n += perf_mem__lvl_scnprintf(out + n, sizeof out - n, &mi); |
4640 |
+- snprintf(failure, sizeof failure, "unexpected %s", out); |
4641 |
++ scnprintf(failure, sizeof failure, "unexpected %s", out); |
4642 |
+ TEST_ASSERT_VAL(failure, !strcmp(string, out)); |
4643 |
+ return 0; |
4644 |
+ } |
4645 |
+diff --git a/tools/perf/tests/pmu.c b/tools/perf/tests/pmu.c |
4646 |
+index 9abca267afa9..7bedf8608fdd 100644 |
4647 |
+--- a/tools/perf/tests/pmu.c |
4648 |
++++ b/tools/perf/tests/pmu.c |
4649 |
+@@ -98,7 +98,7 @@ static char *test_format_dir_get(void) |
4650 |
+ struct test_format *format = &test_formats[i]; |
4651 |
+ FILE *file; |
4652 |
+ |
4653 |
+- snprintf(name, PATH_MAX, "%s/%s", dir, format->name); |
4654 |
++ scnprintf(name, PATH_MAX, "%s/%s", dir, format->name); |
4655 |
+ |
4656 |
+ file = fopen(name, "w"); |
4657 |
+ if (!file) |
4658 |
+diff --git a/tools/perf/util/cgroup.c b/tools/perf/util/cgroup.c |
4659 |
+index d9ffc1e6eb39..ce6bcb0a5368 100644 |
4660 |
+--- a/tools/perf/util/cgroup.c |
4661 |
++++ b/tools/perf/util/cgroup.c |
4662 |
+@@ -78,7 +78,7 @@ static int open_cgroup(char *name) |
4663 |
+ if (cgroupfs_find_mountpoint(mnt, PATH_MAX + 1)) |
4664 |
+ return -1; |
4665 |
+ |
4666 |
+- snprintf(path, PATH_MAX, "%s/%s", mnt, name); |
4667 |
++ scnprintf(path, PATH_MAX, "%s/%s", mnt, name); |
4668 |
+ |
4669 |
+ fd = open(path, O_RDONLY); |
4670 |
+ if (fd == -1) |
4671 |
+diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c |
4672 |
+index b25635e945f3..53f620472151 100644 |
4673 |
+--- a/tools/perf/util/parse-events.c |
4674 |
++++ b/tools/perf/util/parse-events.c |
4675 |
+@@ -202,8 +202,8 @@ struct tracepoint_path *tracepoint_id_to_path(u64 config) |
4676 |
+ |
4677 |
+ for_each_event(sys_dirent, evt_dir, evt_dirent) { |
4678 |
+ |
4679 |
+- snprintf(evt_path, MAXPATHLEN, "%s/%s/id", dir_path, |
4680 |
+- evt_dirent->d_name); |
4681 |
++ scnprintf(evt_path, MAXPATHLEN, "%s/%s/id", dir_path, |
4682 |
++ evt_dirent->d_name); |
4683 |
+ fd = open(evt_path, O_RDONLY); |
4684 |
+ if (fd < 0) |
4685 |
+ continue; |
4686 |
+diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c |
4687 |
+index 9dff41bcc776..d87d458996b7 100644 |
4688 |
+--- a/tools/perf/util/pmu.c |
4689 |
++++ b/tools/perf/util/pmu.c |
4690 |
+@@ -349,7 +349,7 @@ static int pmu_aliases_parse(char *dir, struct list_head *head) |
4691 |
+ if (pmu_alias_info_file(name)) |
4692 |
+ continue; |
4693 |
+ |
4694 |
+- snprintf(path, PATH_MAX, "%s/%s", dir, name); |
4695 |
++ scnprintf(path, PATH_MAX, "%s/%s", dir, name); |
4696 |
+ |
4697 |
+ file = fopen(path, "r"); |
4698 |
+ if (!file) { |
4699 |
+diff --git a/tools/testing/selftests/efivarfs/config b/tools/testing/selftests/efivarfs/config |
4700 |
+new file mode 100644 |
4701 |
+index 000000000000..4e151f1005b2 |
4702 |
+--- /dev/null |
4703 |
++++ b/tools/testing/selftests/efivarfs/config |
4704 |
+@@ -0,0 +1 @@ |
4705 |
++CONFIG_EFIVAR_FS=y |
4706 |
+diff --git a/tools/testing/selftests/memory-hotplug/config b/tools/testing/selftests/memory-hotplug/config |
4707 |
+index 2fde30191a47..a7e8cd5bb265 100644 |
4708 |
+--- a/tools/testing/selftests/memory-hotplug/config |
4709 |
++++ b/tools/testing/selftests/memory-hotplug/config |
4710 |
+@@ -2,3 +2,4 @@ CONFIG_MEMORY_HOTPLUG=y |
4711 |
+ CONFIG_MEMORY_HOTPLUG_SPARSE=y |
4712 |
+ CONFIG_NOTIFIER_ERROR_INJECTION=y |
4713 |
+ CONFIG_MEMORY_NOTIFIER_ERROR_INJECT=m |
4714 |
++CONFIG_MEMORY_HOTREMOVE=y |