1 |
commit: 11fcf185af6a32a517ff7a82d5f19ac144ed85c5 |
2 |
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun May 26 17:09:43 2019 +0000 |
4 |
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun May 26 17:09:43 2019 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=11fcf185 |
7 |
|
8 |
Linux patch 4.19.46 |
9 |
|
10 |
Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org> |
11 |
|
12 |
0000_README | 4 + |
13 |
1045_linux-4.19.46.patch | 4313 ++++++++++++++++++++++++++++++++++++++++++++++ |
14 |
2 files changed, 4317 insertions(+) |
15 |
|
16 |
diff --git a/0000_README b/0000_README |
17 |
index f87fede..87c4eaf 100644 |
18 |
--- a/0000_README |
19 |
+++ b/0000_README |
20 |
@@ -223,6 +223,10 @@ Patch: 1044_linux-4.19.45.patch |
21 |
From: http://www.kernel.org |
22 |
Desc: Linux 4.19.45 |
23 |
|
24 |
+Patch: 1045_linux-4.19.46.patch |
25 |
+From: http://www.kernel.org |
26 |
+Desc: Linux 4.19.46 |
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/1045_linux-4.19.46.patch b/1045_linux-4.19.46.patch |
33 |
new file mode 100644 |
34 |
index 0000000..12e081e |
35 |
--- /dev/null |
36 |
+++ b/1045_linux-4.19.46.patch |
37 |
@@ -0,0 +1,4313 @@ |
38 |
+diff --git a/Documentation/filesystems/porting b/Documentation/filesystems/porting |
39 |
+index 7b7b845c490a..32b5186be412 100644 |
40 |
+--- a/Documentation/filesystems/porting |
41 |
++++ b/Documentation/filesystems/porting |
42 |
+@@ -622,3 +622,8 @@ in your dentry operations instead. |
43 |
+ alloc_file_clone(file, flags, ops) does not affect any caller's references. |
44 |
+ On success you get a new struct file sharing the mount/dentry with the |
45 |
+ original, on failure - ERR_PTR(). |
46 |
++-- |
47 |
++[mandatory] |
48 |
++ DCACHE_RCUACCESS is gone; having an RCU delay on dentry freeing is the |
49 |
++ default. DCACHE_NORCU opts out, and only d_alloc_pseudo() has any |
50 |
++ business doing so. |
51 |
+diff --git a/Makefile b/Makefile |
52 |
+index b21dd3866b63..5383dd317d59 100644 |
53 |
+--- a/Makefile |
54 |
++++ b/Makefile |
55 |
+@@ -1,7 +1,7 @@ |
56 |
+ # SPDX-License-Identifier: GPL-2.0 |
57 |
+ VERSION = 4 |
58 |
+ PATCHLEVEL = 19 |
59 |
+-SUBLEVEL = 45 |
60 |
++SUBLEVEL = 46 |
61 |
+ EXTRAVERSION = |
62 |
+ NAME = "People's Front" |
63 |
+ |
64 |
+diff --git a/arch/mips/kernel/perf_event_mipsxx.c b/arch/mips/kernel/perf_event_mipsxx.c |
65 |
+index 413863508f6f..d67fb64e908c 100644 |
66 |
+--- a/arch/mips/kernel/perf_event_mipsxx.c |
67 |
++++ b/arch/mips/kernel/perf_event_mipsxx.c |
68 |
+@@ -64,17 +64,11 @@ struct mips_perf_event { |
69 |
+ #define CNTR_EVEN 0x55555555 |
70 |
+ #define CNTR_ODD 0xaaaaaaaa |
71 |
+ #define CNTR_ALL 0xffffffff |
72 |
+-#ifdef CONFIG_MIPS_MT_SMP |
73 |
+ enum { |
74 |
+ T = 0, |
75 |
+ V = 1, |
76 |
+ P = 2, |
77 |
+ } range; |
78 |
+-#else |
79 |
+- #define T |
80 |
+- #define V |
81 |
+- #define P |
82 |
+-#endif |
83 |
+ }; |
84 |
+ |
85 |
+ static struct mips_perf_event raw_event; |
86 |
+@@ -325,9 +319,7 @@ static void mipsxx_pmu_enable_event(struct hw_perf_event *evt, int idx) |
87 |
+ { |
88 |
+ struct perf_event *event = container_of(evt, struct perf_event, hw); |
89 |
+ struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events); |
90 |
+-#ifdef CONFIG_MIPS_MT_SMP |
91 |
+ unsigned int range = evt->event_base >> 24; |
92 |
+-#endif /* CONFIG_MIPS_MT_SMP */ |
93 |
+ |
94 |
+ WARN_ON(idx < 0 || idx >= mipspmu.num_counters); |
95 |
+ |
96 |
+@@ -336,21 +328,15 @@ static void mipsxx_pmu_enable_event(struct hw_perf_event *evt, int idx) |
97 |
+ /* Make sure interrupt enabled. */ |
98 |
+ MIPS_PERFCTRL_IE; |
99 |
+ |
100 |
+-#ifdef CONFIG_CPU_BMIPS5000 |
101 |
+- { |
102 |
++ if (IS_ENABLED(CONFIG_CPU_BMIPS5000)) { |
103 |
+ /* enable the counter for the calling thread */ |
104 |
+ cpuc->saved_ctrl[idx] |= |
105 |
+ (1 << (12 + vpe_id())) | BRCM_PERFCTRL_TC; |
106 |
+- } |
107 |
+-#else |
108 |
+-#ifdef CONFIG_MIPS_MT_SMP |
109 |
+- if (range > V) { |
110 |
++ } else if (IS_ENABLED(CONFIG_MIPS_MT_SMP) && range > V) { |
111 |
+ /* The counter is processor wide. Set it up to count all TCs. */ |
112 |
+ pr_debug("Enabling perf counter for all TCs\n"); |
113 |
+ cpuc->saved_ctrl[idx] |= M_TC_EN_ALL; |
114 |
+- } else |
115 |
+-#endif /* CONFIG_MIPS_MT_SMP */ |
116 |
+- { |
117 |
++ } else { |
118 |
+ unsigned int cpu, ctrl; |
119 |
+ |
120 |
+ /* |
121 |
+@@ -365,7 +351,6 @@ static void mipsxx_pmu_enable_event(struct hw_perf_event *evt, int idx) |
122 |
+ cpuc->saved_ctrl[idx] |= ctrl; |
123 |
+ pr_debug("Enabling perf counter for CPU%d\n", cpu); |
124 |
+ } |
125 |
+-#endif /* CONFIG_CPU_BMIPS5000 */ |
126 |
+ /* |
127 |
+ * We do not actually let the counter run. Leave it until start(). |
128 |
+ */ |
129 |
+diff --git a/arch/parisc/boot/compressed/head.S b/arch/parisc/boot/compressed/head.S |
130 |
+index 5aba20fa48aa..e8b798fd0cf0 100644 |
131 |
+--- a/arch/parisc/boot/compressed/head.S |
132 |
++++ b/arch/parisc/boot/compressed/head.S |
133 |
+@@ -22,7 +22,7 @@ |
134 |
+ __HEAD |
135 |
+ |
136 |
+ ENTRY(startup) |
137 |
+- .level LEVEL |
138 |
++ .level PA_ASM_LEVEL |
139 |
+ |
140 |
+ #define PSW_W_SM 0x200 |
141 |
+ #define PSW_W_BIT 36 |
142 |
+@@ -63,7 +63,7 @@ $bss_loop: |
143 |
+ load32 BOOTADDR(decompress_kernel),%r3 |
144 |
+ |
145 |
+ #ifdef CONFIG_64BIT |
146 |
+- .level LEVEL |
147 |
++ .level PA_ASM_LEVEL |
148 |
+ ssm PSW_W_SM, %r0 /* set W-bit */ |
149 |
+ depdi 0, 31, 32, %r3 |
150 |
+ #endif |
151 |
+@@ -72,7 +72,7 @@ $bss_loop: |
152 |
+ |
153 |
+ startup_continue: |
154 |
+ #ifdef CONFIG_64BIT |
155 |
+- .level LEVEL |
156 |
++ .level PA_ASM_LEVEL |
157 |
+ rsm PSW_W_SM, %r0 /* clear W-bit */ |
158 |
+ #endif |
159 |
+ |
160 |
+diff --git a/arch/parisc/include/asm/assembly.h b/arch/parisc/include/asm/assembly.h |
161 |
+index e9c6385ef0d1..6f30fa5bdaed 100644 |
162 |
+--- a/arch/parisc/include/asm/assembly.h |
163 |
++++ b/arch/parisc/include/asm/assembly.h |
164 |
+@@ -61,14 +61,14 @@ |
165 |
+ #define LDCW ldcw,co |
166 |
+ #define BL b,l |
167 |
+ # ifdef CONFIG_64BIT |
168 |
+-# define LEVEL 2.0w |
169 |
++# define PA_ASM_LEVEL 2.0w |
170 |
+ # else |
171 |
+-# define LEVEL 2.0 |
172 |
++# define PA_ASM_LEVEL 2.0 |
173 |
+ # endif |
174 |
+ #else |
175 |
+ #define LDCW ldcw |
176 |
+ #define BL bl |
177 |
+-#define LEVEL 1.1 |
178 |
++#define PA_ASM_LEVEL 1.1 |
179 |
+ #endif |
180 |
+ |
181 |
+ #ifdef __ASSEMBLY__ |
182 |
+diff --git a/arch/parisc/kernel/head.S b/arch/parisc/kernel/head.S |
183 |
+index fbb4e43fda05..f56cbab64ac1 100644 |
184 |
+--- a/arch/parisc/kernel/head.S |
185 |
++++ b/arch/parisc/kernel/head.S |
186 |
+@@ -22,7 +22,7 @@ |
187 |
+ #include <linux/linkage.h> |
188 |
+ #include <linux/init.h> |
189 |
+ |
190 |
+- .level LEVEL |
191 |
++ .level PA_ASM_LEVEL |
192 |
+ |
193 |
+ __INITDATA |
194 |
+ ENTRY(boot_args) |
195 |
+@@ -258,7 +258,7 @@ stext_pdc_ret: |
196 |
+ ldo R%PA(fault_vector_11)(%r10),%r10 |
197 |
+ |
198 |
+ $is_pa20: |
199 |
+- .level LEVEL /* restore 1.1 || 2.0w */ |
200 |
++ .level PA_ASM_LEVEL /* restore 1.1 || 2.0w */ |
201 |
+ #endif /*!CONFIG_64BIT*/ |
202 |
+ load32 PA(fault_vector_20),%r10 |
203 |
+ |
204 |
+diff --git a/arch/parisc/kernel/process.c b/arch/parisc/kernel/process.c |
205 |
+index 841db71958cd..97c206734e24 100644 |
206 |
+--- a/arch/parisc/kernel/process.c |
207 |
++++ b/arch/parisc/kernel/process.c |
208 |
+@@ -193,6 +193,7 @@ int dump_task_fpu (struct task_struct *tsk, elf_fpregset_t *r) |
209 |
+ */ |
210 |
+ |
211 |
+ int running_on_qemu __read_mostly; |
212 |
++EXPORT_SYMBOL(running_on_qemu); |
213 |
+ |
214 |
+ void __cpuidle arch_cpu_idle_dead(void) |
215 |
+ { |
216 |
+diff --git a/arch/parisc/kernel/syscall.S b/arch/parisc/kernel/syscall.S |
217 |
+index f453997a7b8f..61a647a55c69 100644 |
218 |
+--- a/arch/parisc/kernel/syscall.S |
219 |
++++ b/arch/parisc/kernel/syscall.S |
220 |
+@@ -48,7 +48,7 @@ registers). |
221 |
+ */ |
222 |
+ #define KILL_INSN break 0,0 |
223 |
+ |
224 |
+- .level LEVEL |
225 |
++ .level PA_ASM_LEVEL |
226 |
+ |
227 |
+ .text |
228 |
+ |
229 |
+diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S |
230 |
+index 585bbc5b3216..c90e00db5c13 100644 |
231 |
+--- a/arch/x86/entry/entry_64.S |
232 |
++++ b/arch/x86/entry/entry_64.S |
233 |
+@@ -905,7 +905,7 @@ apicinterrupt IRQ_WORK_VECTOR irq_work_interrupt smp_irq_work_interrupt |
234 |
+ */ |
235 |
+ #define CPU_TSS_IST(x) PER_CPU_VAR(cpu_tss_rw) + (TSS_ist + ((x) - 1) * 8) |
236 |
+ |
237 |
+-.macro idtentry sym do_sym has_error_code:req paranoid=0 shift_ist=-1 |
238 |
++.macro idtentry sym do_sym has_error_code:req paranoid=0 shift_ist=-1 create_gap=0 |
239 |
+ ENTRY(\sym) |
240 |
+ UNWIND_HINT_IRET_REGS offset=\has_error_code*8 |
241 |
+ |
242 |
+@@ -925,6 +925,20 @@ ENTRY(\sym) |
243 |
+ jnz .Lfrom_usermode_switch_stack_\@ |
244 |
+ .endif |
245 |
+ |
246 |
++ .if \create_gap == 1 |
247 |
++ /* |
248 |
++ * If coming from kernel space, create a 6-word gap to allow the |
249 |
++ * int3 handler to emulate a call instruction. |
250 |
++ */ |
251 |
++ testb $3, CS-ORIG_RAX(%rsp) |
252 |
++ jnz .Lfrom_usermode_no_gap_\@ |
253 |
++ .rept 6 |
254 |
++ pushq 5*8(%rsp) |
255 |
++ .endr |
256 |
++ UNWIND_HINT_IRET_REGS offset=8 |
257 |
++.Lfrom_usermode_no_gap_\@: |
258 |
++ .endif |
259 |
++ |
260 |
+ .if \paranoid |
261 |
+ call paranoid_entry |
262 |
+ .else |
263 |
+@@ -1154,7 +1168,7 @@ apicinterrupt3 HYPERV_STIMER0_VECTOR \ |
264 |
+ #endif /* CONFIG_HYPERV */ |
265 |
+ |
266 |
+ idtentry debug do_debug has_error_code=0 paranoid=1 shift_ist=DEBUG_STACK |
267 |
+-idtentry int3 do_int3 has_error_code=0 |
268 |
++idtentry int3 do_int3 has_error_code=0 create_gap=1 |
269 |
+ idtentry stack_segment do_stack_segment has_error_code=1 |
270 |
+ |
271 |
+ #ifdef CONFIG_XEN |
272 |
+diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c |
273 |
+index a759e59990fb..09c53bcbd497 100644 |
274 |
+--- a/arch/x86/events/intel/core.c |
275 |
++++ b/arch/x86/events/intel/core.c |
276 |
+@@ -2074,15 +2074,19 @@ static void intel_pmu_disable_event(struct perf_event *event) |
277 |
+ cpuc->intel_ctrl_host_mask &= ~(1ull << hwc->idx); |
278 |
+ cpuc->intel_cp_status &= ~(1ull << hwc->idx); |
279 |
+ |
280 |
+- if (unlikely(event->attr.precise_ip)) |
281 |
+- intel_pmu_pebs_disable(event); |
282 |
+- |
283 |
+ if (unlikely(hwc->config_base == MSR_ARCH_PERFMON_FIXED_CTR_CTRL)) { |
284 |
+ intel_pmu_disable_fixed(hwc); |
285 |
+ return; |
286 |
+ } |
287 |
+ |
288 |
+ x86_pmu_disable_event(event); |
289 |
++ |
290 |
++ /* |
291 |
++ * Needs to be called after x86_pmu_disable_event, |
292 |
++ * so we don't trigger the event without PEBS bit set. |
293 |
++ */ |
294 |
++ if (unlikely(event->attr.precise_ip)) |
295 |
++ intel_pmu_pebs_disable(event); |
296 |
+ } |
297 |
+ |
298 |
+ static void intel_pmu_del_event(struct perf_event *event) |
299 |
+diff --git a/arch/x86/include/asm/text-patching.h b/arch/x86/include/asm/text-patching.h |
300 |
+index e85ff65c43c3..05861cc08787 100644 |
301 |
+--- a/arch/x86/include/asm/text-patching.h |
302 |
++++ b/arch/x86/include/asm/text-patching.h |
303 |
+@@ -39,4 +39,32 @@ extern int poke_int3_handler(struct pt_regs *regs); |
304 |
+ extern void *text_poke_bp(void *addr, const void *opcode, size_t len, void *handler); |
305 |
+ extern int after_bootmem; |
306 |
+ |
307 |
++static inline void int3_emulate_jmp(struct pt_regs *regs, unsigned long ip) |
308 |
++{ |
309 |
++ regs->ip = ip; |
310 |
++} |
311 |
++ |
312 |
++#define INT3_INSN_SIZE 1 |
313 |
++#define CALL_INSN_SIZE 5 |
314 |
++ |
315 |
++#ifdef CONFIG_X86_64 |
316 |
++static inline void int3_emulate_push(struct pt_regs *regs, unsigned long val) |
317 |
++{ |
318 |
++ /* |
319 |
++ * The int3 handler in entry_64.S adds a gap between the |
320 |
++ * stack where the break point happened, and the saving of |
321 |
++ * pt_regs. We can extend the original stack because of |
322 |
++ * this gap. See the idtentry macro's create_gap option. |
323 |
++ */ |
324 |
++ regs->sp -= sizeof(unsigned long); |
325 |
++ *(unsigned long *)regs->sp = val; |
326 |
++} |
327 |
++ |
328 |
++static inline void int3_emulate_call(struct pt_regs *regs, unsigned long func) |
329 |
++{ |
330 |
++ int3_emulate_push(regs, regs->ip - INT3_INSN_SIZE + CALL_INSN_SIZE); |
331 |
++ int3_emulate_jmp(regs, func); |
332 |
++} |
333 |
++#endif |
334 |
++ |
335 |
+ #endif /* _ASM_X86_TEXT_PATCHING_H */ |
336 |
+diff --git a/arch/x86/kernel/ftrace.c b/arch/x86/kernel/ftrace.c |
337 |
+index 7ee8067cbf45..4d2a401c178b 100644 |
338 |
+--- a/arch/x86/kernel/ftrace.c |
339 |
++++ b/arch/x86/kernel/ftrace.c |
340 |
+@@ -29,6 +29,7 @@ |
341 |
+ #include <asm/kprobes.h> |
342 |
+ #include <asm/ftrace.h> |
343 |
+ #include <asm/nops.h> |
344 |
++#include <asm/text-patching.h> |
345 |
+ |
346 |
+ #ifdef CONFIG_DYNAMIC_FTRACE |
347 |
+ |
348 |
+@@ -228,6 +229,7 @@ int ftrace_modify_call(struct dyn_ftrace *rec, unsigned long old_addr, |
349 |
+ } |
350 |
+ |
351 |
+ static unsigned long ftrace_update_func; |
352 |
++static unsigned long ftrace_update_func_call; |
353 |
+ |
354 |
+ static int update_ftrace_func(unsigned long ip, void *new) |
355 |
+ { |
356 |
+@@ -256,6 +258,8 @@ int ftrace_update_ftrace_func(ftrace_func_t func) |
357 |
+ unsigned char *new; |
358 |
+ int ret; |
359 |
+ |
360 |
++ ftrace_update_func_call = (unsigned long)func; |
361 |
++ |
362 |
+ new = ftrace_call_replace(ip, (unsigned long)func); |
363 |
+ ret = update_ftrace_func(ip, new); |
364 |
+ |
365 |
+@@ -291,13 +295,28 @@ int ftrace_int3_handler(struct pt_regs *regs) |
366 |
+ if (WARN_ON_ONCE(!regs)) |
367 |
+ return 0; |
368 |
+ |
369 |
+- ip = regs->ip - 1; |
370 |
+- if (!ftrace_location(ip) && !is_ftrace_caller(ip)) |
371 |
+- return 0; |
372 |
++ ip = regs->ip - INT3_INSN_SIZE; |
373 |
+ |
374 |
+- regs->ip += MCOUNT_INSN_SIZE - 1; |
375 |
++#ifdef CONFIG_X86_64 |
376 |
++ if (ftrace_location(ip)) { |
377 |
++ int3_emulate_call(regs, (unsigned long)ftrace_regs_caller); |
378 |
++ return 1; |
379 |
++ } else if (is_ftrace_caller(ip)) { |
380 |
++ if (!ftrace_update_func_call) { |
381 |
++ int3_emulate_jmp(regs, ip + CALL_INSN_SIZE); |
382 |
++ return 1; |
383 |
++ } |
384 |
++ int3_emulate_call(regs, ftrace_update_func_call); |
385 |
++ return 1; |
386 |
++ } |
387 |
++#else |
388 |
++ if (ftrace_location(ip) || is_ftrace_caller(ip)) { |
389 |
++ int3_emulate_jmp(regs, ip + CALL_INSN_SIZE); |
390 |
++ return 1; |
391 |
++ } |
392 |
++#endif |
393 |
+ |
394 |
+- return 1; |
395 |
++ return 0; |
396 |
+ } |
397 |
+ |
398 |
+ static int ftrace_write(unsigned long ip, const char *val, int size) |
399 |
+@@ -868,6 +887,8 @@ void arch_ftrace_update_trampoline(struct ftrace_ops *ops) |
400 |
+ |
401 |
+ func = ftrace_ops_get_func(ops); |
402 |
+ |
403 |
++ ftrace_update_func_call = (unsigned long)func; |
404 |
++ |
405 |
+ /* Do a safe modify in case the trampoline is executing */ |
406 |
+ new = ftrace_call_replace(ip, (unsigned long)func); |
407 |
+ ret = update_ftrace_func(ip, new); |
408 |
+@@ -964,6 +985,7 @@ static int ftrace_mod_jmp(unsigned long ip, void *func) |
409 |
+ { |
410 |
+ unsigned char *new; |
411 |
+ |
412 |
++ ftrace_update_func_call = 0UL; |
413 |
+ new = ftrace_jmp_replace(ip, (unsigned long)func); |
414 |
+ |
415 |
+ return update_ftrace_func(ip, new); |
416 |
+diff --git a/arch/x86/kvm/hyperv.c b/arch/x86/kvm/hyperv.c |
417 |
+index 01d209ab5481..229d99605165 100644 |
418 |
+--- a/arch/x86/kvm/hyperv.c |
419 |
++++ b/arch/x86/kvm/hyperv.c |
420 |
+@@ -1291,7 +1291,16 @@ static u64 kvm_hv_flush_tlb(struct kvm_vcpu *current_vcpu, u64 ingpa, |
421 |
+ flush.address_space, flush.flags); |
422 |
+ |
423 |
+ sparse_banks[0] = flush.processor_mask; |
424 |
+- all_cpus = flush.flags & HV_FLUSH_ALL_PROCESSORS; |
425 |
++ |
426 |
++ /* |
427 |
++ * Work around possible WS2012 bug: it sends hypercalls |
428 |
++ * with processor_mask = 0x0 and HV_FLUSH_ALL_PROCESSORS clear, |
429 |
++ * while also expecting us to flush something and crashing if |
430 |
++ * we don't. Let's treat processor_mask == 0 same as |
431 |
++ * HV_FLUSH_ALL_PROCESSORS. |
432 |
++ */ |
433 |
++ all_cpus = (flush.flags & HV_FLUSH_ALL_PROCESSORS) || |
434 |
++ flush.processor_mask == 0; |
435 |
+ } else { |
436 |
+ if (unlikely(kvm_read_guest(kvm, ingpa, &flush_ex, |
437 |
+ sizeof(flush_ex)))) |
438 |
+diff --git a/arch/x86/lib/Makefile b/arch/x86/lib/Makefile |
439 |
+index 25a972c61b0a..3c19d60316a8 100644 |
440 |
+--- a/arch/x86/lib/Makefile |
441 |
++++ b/arch/x86/lib/Makefile |
442 |
+@@ -6,6 +6,18 @@ |
443 |
+ # Produces uninteresting flaky coverage. |
444 |
+ KCOV_INSTRUMENT_delay.o := n |
445 |
+ |
446 |
++# Early boot use of cmdline; don't instrument it |
447 |
++ifdef CONFIG_AMD_MEM_ENCRYPT |
448 |
++KCOV_INSTRUMENT_cmdline.o := n |
449 |
++KASAN_SANITIZE_cmdline.o := n |
450 |
++ |
451 |
++ifdef CONFIG_FUNCTION_TRACER |
452 |
++CFLAGS_REMOVE_cmdline.o = -pg |
453 |
++endif |
454 |
++ |
455 |
++CFLAGS_cmdline.o := $(call cc-option, -fno-stack-protector) |
456 |
++endif |
457 |
++ |
458 |
+ inat_tables_script = $(srctree)/arch/x86/tools/gen-insn-attr-x86.awk |
459 |
+ inat_tables_maps = $(srctree)/arch/x86/lib/x86-opcode-map.txt |
460 |
+ quiet_cmd_inat_tables = GEN $@ |
461 |
+diff --git a/drivers/base/dd.c b/drivers/base/dd.c |
462 |
+index f5b74856784a..d48b310c4760 100644 |
463 |
+--- a/drivers/base/dd.c |
464 |
++++ b/drivers/base/dd.c |
465 |
+@@ -482,7 +482,7 @@ re_probe: |
466 |
+ |
467 |
+ ret = dma_configure(dev); |
468 |
+ if (ret) |
469 |
+- goto dma_failed; |
470 |
++ goto probe_failed; |
471 |
+ |
472 |
+ if (driver_sysfs_add(dev)) { |
473 |
+ printk(KERN_ERR "%s: driver_sysfs_add(%s) failed\n", |
474 |
+@@ -537,14 +537,13 @@ re_probe: |
475 |
+ goto done; |
476 |
+ |
477 |
+ probe_failed: |
478 |
+- dma_deconfigure(dev); |
479 |
+-dma_failed: |
480 |
+ if (dev->bus) |
481 |
+ blocking_notifier_call_chain(&dev->bus->p->bus_notifier, |
482 |
+ BUS_NOTIFY_DRIVER_NOT_BOUND, dev); |
483 |
+ pinctrl_bind_failed: |
484 |
+ device_links_no_driver(dev); |
485 |
+ devres_release_all(dev); |
486 |
++ dma_deconfigure(dev); |
487 |
+ driver_sysfs_remove(dev); |
488 |
+ dev->driver = NULL; |
489 |
+ dev_set_drvdata(dev, NULL); |
490 |
+diff --git a/drivers/block/brd.c b/drivers/block/brd.c |
491 |
+index c18586fccb6f..17defbf4f332 100644 |
492 |
+--- a/drivers/block/brd.c |
493 |
++++ b/drivers/block/brd.c |
494 |
+@@ -96,13 +96,8 @@ static struct page *brd_insert_page(struct brd_device *brd, sector_t sector) |
495 |
+ /* |
496 |
+ * Must use NOIO because we don't want to recurse back into the |
497 |
+ * block or filesystem layers from page reclaim. |
498 |
+- * |
499 |
+- * Cannot support DAX and highmem, because our ->direct_access |
500 |
+- * routine for DAX must return memory that is always addressable. |
501 |
+- * If DAX was reworked to use pfns and kmap throughout, this |
502 |
+- * restriction might be able to be lifted. |
503 |
+ */ |
504 |
+- gfp_flags = GFP_NOIO | __GFP_ZERO; |
505 |
++ gfp_flags = GFP_NOIO | __GFP_ZERO | __GFP_HIGHMEM; |
506 |
+ page = alloc_page(gfp_flags); |
507 |
+ if (!page) |
508 |
+ return NULL; |
509 |
+diff --git a/drivers/clk/hisilicon/clk-hi3660.c b/drivers/clk/hisilicon/clk-hi3660.c |
510 |
+index f40419959656..794eeff0d5d2 100644 |
511 |
+--- a/drivers/clk/hisilicon/clk-hi3660.c |
512 |
++++ b/drivers/clk/hisilicon/clk-hi3660.c |
513 |
+@@ -163,8 +163,12 @@ static const struct hisi_gate_clock hi3660_crgctrl_gate_sep_clks[] = { |
514 |
+ "clk_isp_snclk_mux", CLK_SET_RATE_PARENT, 0x50, 17, 0, }, |
515 |
+ { HI3660_CLK_GATE_ISP_SNCLK2, "clk_gate_isp_snclk2", |
516 |
+ "clk_isp_snclk_mux", CLK_SET_RATE_PARENT, 0x50, 18, 0, }, |
517 |
++ /* |
518 |
++ * clk_gate_ufs_subsys is a system bus clock, mark it as critical |
519 |
++ * clock and keep it on for system suspend and resume. |
520 |
++ */ |
521 |
+ { HI3660_CLK_GATE_UFS_SUBSYS, "clk_gate_ufs_subsys", "clk_div_sysbus", |
522 |
+- CLK_SET_RATE_PARENT, 0x50, 21, 0, }, |
523 |
++ CLK_SET_RATE_PARENT | CLK_IS_CRITICAL, 0x50, 21, 0, }, |
524 |
+ { HI3660_PCLK_GATE_DSI0, "pclk_gate_dsi0", "clk_div_cfgbus", |
525 |
+ CLK_SET_RATE_PARENT, 0x50, 28, 0, }, |
526 |
+ { HI3660_PCLK_GATE_DSI1, "pclk_gate_dsi1", "clk_div_cfgbus", |
527 |
+diff --git a/drivers/clk/mediatek/clk-pll.c b/drivers/clk/mediatek/clk-pll.c |
528 |
+index f54e4015b0b1..18842d660317 100644 |
529 |
+--- a/drivers/clk/mediatek/clk-pll.c |
530 |
++++ b/drivers/clk/mediatek/clk-pll.c |
531 |
+@@ -88,6 +88,32 @@ static unsigned long __mtk_pll_recalc_rate(struct mtk_clk_pll *pll, u32 fin, |
532 |
+ return ((unsigned long)vco + postdiv - 1) / postdiv; |
533 |
+ } |
534 |
+ |
535 |
++static void __mtk_pll_tuner_enable(struct mtk_clk_pll *pll) |
536 |
++{ |
537 |
++ u32 r; |
538 |
++ |
539 |
++ if (pll->tuner_en_addr) { |
540 |
++ r = readl(pll->tuner_en_addr) | BIT(pll->data->tuner_en_bit); |
541 |
++ writel(r, pll->tuner_en_addr); |
542 |
++ } else if (pll->tuner_addr) { |
543 |
++ r = readl(pll->tuner_addr) | AUDPLL_TUNER_EN; |
544 |
++ writel(r, pll->tuner_addr); |
545 |
++ } |
546 |
++} |
547 |
++ |
548 |
++static void __mtk_pll_tuner_disable(struct mtk_clk_pll *pll) |
549 |
++{ |
550 |
++ u32 r; |
551 |
++ |
552 |
++ if (pll->tuner_en_addr) { |
553 |
++ r = readl(pll->tuner_en_addr) & ~BIT(pll->data->tuner_en_bit); |
554 |
++ writel(r, pll->tuner_en_addr); |
555 |
++ } else if (pll->tuner_addr) { |
556 |
++ r = readl(pll->tuner_addr) & ~AUDPLL_TUNER_EN; |
557 |
++ writel(r, pll->tuner_addr); |
558 |
++ } |
559 |
++} |
560 |
++ |
561 |
+ static void mtk_pll_set_rate_regs(struct mtk_clk_pll *pll, u32 pcw, |
562 |
+ int postdiv) |
563 |
+ { |
564 |
+@@ -96,6 +122,9 @@ static void mtk_pll_set_rate_regs(struct mtk_clk_pll *pll, u32 pcw, |
565 |
+ |
566 |
+ pll_en = readl(pll->base_addr + REG_CON0) & CON0_BASE_EN; |
567 |
+ |
568 |
++ /* disable tuner */ |
569 |
++ __mtk_pll_tuner_disable(pll); |
570 |
++ |
571 |
+ /* set postdiv */ |
572 |
+ val = readl(pll->pd_addr); |
573 |
+ val &= ~(POSTDIV_MASK << pll->data->pd_shift); |
574 |
+@@ -122,6 +151,9 @@ static void mtk_pll_set_rate_regs(struct mtk_clk_pll *pll, u32 pcw, |
575 |
+ if (pll->tuner_addr) |
576 |
+ writel(con1 + 1, pll->tuner_addr); |
577 |
+ |
578 |
++ /* restore tuner_en */ |
579 |
++ __mtk_pll_tuner_enable(pll); |
580 |
++ |
581 |
+ if (pll_en) |
582 |
+ udelay(20); |
583 |
+ } |
584 |
+@@ -228,13 +260,7 @@ static int mtk_pll_prepare(struct clk_hw *hw) |
585 |
+ r |= pll->data->en_mask; |
586 |
+ writel(r, pll->base_addr + REG_CON0); |
587 |
+ |
588 |
+- if (pll->tuner_en_addr) { |
589 |
+- r = readl(pll->tuner_en_addr) | BIT(pll->data->tuner_en_bit); |
590 |
+- writel(r, pll->tuner_en_addr); |
591 |
+- } else if (pll->tuner_addr) { |
592 |
+- r = readl(pll->tuner_addr) | AUDPLL_TUNER_EN; |
593 |
+- writel(r, pll->tuner_addr); |
594 |
+- } |
595 |
++ __mtk_pll_tuner_enable(pll); |
596 |
+ |
597 |
+ udelay(20); |
598 |
+ |
599 |
+@@ -258,13 +284,7 @@ static void mtk_pll_unprepare(struct clk_hw *hw) |
600 |
+ writel(r, pll->base_addr + REG_CON0); |
601 |
+ } |
602 |
+ |
603 |
+- if (pll->tuner_en_addr) { |
604 |
+- r = readl(pll->tuner_en_addr) & ~BIT(pll->data->tuner_en_bit); |
605 |
+- writel(r, pll->tuner_en_addr); |
606 |
+- } else if (pll->tuner_addr) { |
607 |
+- r = readl(pll->tuner_addr) & ~AUDPLL_TUNER_EN; |
608 |
+- writel(r, pll->tuner_addr); |
609 |
+- } |
610 |
++ __mtk_pll_tuner_disable(pll); |
611 |
+ |
612 |
+ r = readl(pll->base_addr + REG_CON0); |
613 |
+ r &= ~CON0_BASE_EN; |
614 |
+diff --git a/drivers/clk/rockchip/clk-rk3328.c b/drivers/clk/rockchip/clk-rk3328.c |
615 |
+index e431661fe874..ecbae8acd05b 100644 |
616 |
+--- a/drivers/clk/rockchip/clk-rk3328.c |
617 |
++++ b/drivers/clk/rockchip/clk-rk3328.c |
618 |
+@@ -458,7 +458,7 @@ static struct rockchip_clk_branch rk3328_clk_branches[] __initdata = { |
619 |
+ RK3328_CLKSEL_CON(35), 15, 1, MFLAGS, 8, 7, DFLAGS, |
620 |
+ RK3328_CLKGATE_CON(2), 12, GFLAGS), |
621 |
+ COMPOSITE(SCLK_CRYPTO, "clk_crypto", mux_2plls_p, 0, |
622 |
+- RK3328_CLKSEL_CON(20), 7, 1, MFLAGS, 0, 7, DFLAGS, |
623 |
++ RK3328_CLKSEL_CON(20), 7, 1, MFLAGS, 0, 5, DFLAGS, |
624 |
+ RK3328_CLKGATE_CON(2), 4, GFLAGS), |
625 |
+ COMPOSITE_NOMUX(SCLK_TSADC, "clk_tsadc", "clk_24m", 0, |
626 |
+ RK3328_CLKSEL_CON(22), 0, 10, DFLAGS, |
627 |
+@@ -550,15 +550,15 @@ static struct rockchip_clk_branch rk3328_clk_branches[] __initdata = { |
628 |
+ GATE(0, "hclk_rkvenc_niu", "hclk_rkvenc", 0, |
629 |
+ RK3328_CLKGATE_CON(25), 1, GFLAGS), |
630 |
+ GATE(ACLK_H265, "aclk_h265", "aclk_rkvenc", 0, |
631 |
+- RK3328_CLKGATE_CON(25), 0, GFLAGS), |
632 |
++ RK3328_CLKGATE_CON(25), 2, GFLAGS), |
633 |
+ GATE(PCLK_H265, "pclk_h265", "hclk_rkvenc", 0, |
634 |
+- RK3328_CLKGATE_CON(25), 1, GFLAGS), |
635 |
++ RK3328_CLKGATE_CON(25), 3, GFLAGS), |
636 |
+ GATE(ACLK_H264, "aclk_h264", "aclk_rkvenc", 0, |
637 |
+- RK3328_CLKGATE_CON(25), 0, GFLAGS), |
638 |
++ RK3328_CLKGATE_CON(25), 4, GFLAGS), |
639 |
+ GATE(HCLK_H264, "hclk_h264", "hclk_rkvenc", 0, |
640 |
+- RK3328_CLKGATE_CON(25), 1, GFLAGS), |
641 |
++ RK3328_CLKGATE_CON(25), 5, GFLAGS), |
642 |
+ GATE(ACLK_AXISRAM, "aclk_axisram", "aclk_rkvenc", CLK_IGNORE_UNUSED, |
643 |
+- RK3328_CLKGATE_CON(25), 0, GFLAGS), |
644 |
++ RK3328_CLKGATE_CON(25), 6, GFLAGS), |
645 |
+ |
646 |
+ COMPOSITE(SCLK_VENC_CORE, "sclk_venc_core", mux_4plls_p, 0, |
647 |
+ RK3328_CLKSEL_CON(51), 14, 2, MFLAGS, 8, 5, DFLAGS, |
648 |
+@@ -663,7 +663,7 @@ static struct rockchip_clk_branch rk3328_clk_branches[] __initdata = { |
649 |
+ |
650 |
+ /* PD_GMAC */ |
651 |
+ COMPOSITE(ACLK_GMAC, "aclk_gmac", mux_2plls_hdmiphy_p, 0, |
652 |
+- RK3328_CLKSEL_CON(35), 6, 2, MFLAGS, 0, 5, DFLAGS, |
653 |
++ RK3328_CLKSEL_CON(25), 6, 2, MFLAGS, 0, 5, DFLAGS, |
654 |
+ RK3328_CLKGATE_CON(3), 2, GFLAGS), |
655 |
+ COMPOSITE_NOMUX(PCLK_GMAC, "pclk_gmac", "aclk_gmac", 0, |
656 |
+ RK3328_CLKSEL_CON(25), 8, 3, DFLAGS, |
657 |
+@@ -733,7 +733,7 @@ static struct rockchip_clk_branch rk3328_clk_branches[] __initdata = { |
658 |
+ |
659 |
+ /* PD_PERI */ |
660 |
+ GATE(0, "aclk_peri_noc", "aclk_peri", CLK_IGNORE_UNUSED, RK3328_CLKGATE_CON(19), 11, GFLAGS), |
661 |
+- GATE(ACLK_USB3OTG, "aclk_usb3otg", "aclk_peri", 0, RK3328_CLKGATE_CON(19), 4, GFLAGS), |
662 |
++ GATE(ACLK_USB3OTG, "aclk_usb3otg", "aclk_peri", 0, RK3328_CLKGATE_CON(19), 14, GFLAGS), |
663 |
+ |
664 |
+ GATE(HCLK_SDMMC, "hclk_sdmmc", "hclk_peri", 0, RK3328_CLKGATE_CON(19), 0, GFLAGS), |
665 |
+ GATE(HCLK_SDIO, "hclk_sdio", "hclk_peri", 0, RK3328_CLKGATE_CON(19), 1, GFLAGS), |
666 |
+@@ -913,7 +913,7 @@ static void __init rk3328_clk_init(struct device_node *np) |
667 |
+ &rk3328_cpuclk_data, rk3328_cpuclk_rates, |
668 |
+ ARRAY_SIZE(rk3328_cpuclk_rates)); |
669 |
+ |
670 |
+- rockchip_register_softrst(np, 11, reg_base + RK3328_SOFTRST_CON(0), |
671 |
++ rockchip_register_softrst(np, 12, reg_base + RK3328_SOFTRST_CON(0), |
672 |
+ ROCKCHIP_SOFTRST_HIWORD_MASK); |
673 |
+ |
674 |
+ rockchip_register_restart_notifier(ctx, RK3328_GLB_SRST_FST, NULL); |
675 |
+diff --git a/drivers/clk/sunxi-ng/ccu_nkmp.c b/drivers/clk/sunxi-ng/ccu_nkmp.c |
676 |
+index ebd9436d2c7c..1ad53d1016a3 100644 |
677 |
+--- a/drivers/clk/sunxi-ng/ccu_nkmp.c |
678 |
++++ b/drivers/clk/sunxi-ng/ccu_nkmp.c |
679 |
+@@ -160,7 +160,7 @@ static int ccu_nkmp_set_rate(struct clk_hw *hw, unsigned long rate, |
680 |
+ unsigned long parent_rate) |
681 |
+ { |
682 |
+ struct ccu_nkmp *nkmp = hw_to_ccu_nkmp(hw); |
683 |
+- u32 n_mask, k_mask, m_mask, p_mask; |
684 |
++ u32 n_mask = 0, k_mask = 0, m_mask = 0, p_mask = 0; |
685 |
+ struct _ccu_nkmp _nkmp; |
686 |
+ unsigned long flags; |
687 |
+ u32 reg; |
688 |
+@@ -179,10 +179,18 @@ static int ccu_nkmp_set_rate(struct clk_hw *hw, unsigned long rate, |
689 |
+ |
690 |
+ ccu_nkmp_find_best(parent_rate, rate, &_nkmp); |
691 |
+ |
692 |
+- n_mask = GENMASK(nkmp->n.width + nkmp->n.shift - 1, nkmp->n.shift); |
693 |
+- k_mask = GENMASK(nkmp->k.width + nkmp->k.shift - 1, nkmp->k.shift); |
694 |
+- m_mask = GENMASK(nkmp->m.width + nkmp->m.shift - 1, nkmp->m.shift); |
695 |
+- p_mask = GENMASK(nkmp->p.width + nkmp->p.shift - 1, nkmp->p.shift); |
696 |
++ if (nkmp->n.width) |
697 |
++ n_mask = GENMASK(nkmp->n.width + nkmp->n.shift - 1, |
698 |
++ nkmp->n.shift); |
699 |
++ if (nkmp->k.width) |
700 |
++ k_mask = GENMASK(nkmp->k.width + nkmp->k.shift - 1, |
701 |
++ nkmp->k.shift); |
702 |
++ if (nkmp->m.width) |
703 |
++ m_mask = GENMASK(nkmp->m.width + nkmp->m.shift - 1, |
704 |
++ nkmp->m.shift); |
705 |
++ if (nkmp->p.width) |
706 |
++ p_mask = GENMASK(nkmp->p.width + nkmp->p.shift - 1, |
707 |
++ nkmp->p.shift); |
708 |
+ |
709 |
+ spin_lock_irqsave(nkmp->common.lock, flags); |
710 |
+ |
711 |
+diff --git a/drivers/clk/tegra/clk-pll.c b/drivers/clk/tegra/clk-pll.c |
712 |
+index 830d1c87fa7c..dc87866233b9 100644 |
713 |
+--- a/drivers/clk/tegra/clk-pll.c |
714 |
++++ b/drivers/clk/tegra/clk-pll.c |
715 |
+@@ -662,8 +662,8 @@ static void _update_pll_mnp(struct tegra_clk_pll *pll, |
716 |
+ pll_override_writel(val, params->pmc_divp_reg, pll); |
717 |
+ |
718 |
+ val = pll_override_readl(params->pmc_divnm_reg, pll); |
719 |
+- val &= ~(divm_mask(pll) << div_nmp->override_divm_shift) | |
720 |
+- ~(divn_mask(pll) << div_nmp->override_divn_shift); |
721 |
++ val &= ~((divm_mask(pll) << div_nmp->override_divm_shift) | |
722 |
++ (divn_mask(pll) << div_nmp->override_divn_shift)); |
723 |
+ val |= (cfg->m << div_nmp->override_divm_shift) | |
724 |
+ (cfg->n << div_nmp->override_divn_shift); |
725 |
+ pll_override_writel(val, params->pmc_divnm_reg, pll); |
726 |
+diff --git a/drivers/hwtracing/intel_th/msu.c b/drivers/hwtracing/intel_th/msu.c |
727 |
+index ba7aaf421f36..8ff326c0c406 100644 |
728 |
+--- a/drivers/hwtracing/intel_th/msu.c |
729 |
++++ b/drivers/hwtracing/intel_th/msu.c |
730 |
+@@ -84,6 +84,7 @@ struct msc_iter { |
731 |
+ * @reg_base: register window base address |
732 |
+ * @thdev: intel_th_device pointer |
733 |
+ * @win_list: list of windows in multiblock mode |
734 |
++ * @single_sgt: single mode buffer |
735 |
+ * @nr_pages: total number of pages allocated for this buffer |
736 |
+ * @single_sz: amount of data in single mode |
737 |
+ * @single_wrap: single mode wrap occurred |
738 |
+@@ -104,6 +105,7 @@ struct msc { |
739 |
+ struct intel_th_device *thdev; |
740 |
+ |
741 |
+ struct list_head win_list; |
742 |
++ struct sg_table single_sgt; |
743 |
+ unsigned long nr_pages; |
744 |
+ unsigned long single_sz; |
745 |
+ unsigned int single_wrap : 1; |
746 |
+@@ -617,22 +619,45 @@ static void intel_th_msc_deactivate(struct intel_th_device *thdev) |
747 |
+ */ |
748 |
+ static int msc_buffer_contig_alloc(struct msc *msc, unsigned long size) |
749 |
+ { |
750 |
++ unsigned long nr_pages = size >> PAGE_SHIFT; |
751 |
+ unsigned int order = get_order(size); |
752 |
+ struct page *page; |
753 |
++ int ret; |
754 |
+ |
755 |
+ if (!size) |
756 |
+ return 0; |
757 |
+ |
758 |
++ ret = sg_alloc_table(&msc->single_sgt, 1, GFP_KERNEL); |
759 |
++ if (ret) |
760 |
++ goto err_out; |
761 |
++ |
762 |
++ ret = -ENOMEM; |
763 |
+ page = alloc_pages(GFP_KERNEL | __GFP_ZERO, order); |
764 |
+ if (!page) |
765 |
+- return -ENOMEM; |
766 |
++ goto err_free_sgt; |
767 |
+ |
768 |
+ split_page(page, order); |
769 |
+- msc->nr_pages = size >> PAGE_SHIFT; |
770 |
++ sg_set_buf(msc->single_sgt.sgl, page_address(page), size); |
771 |
++ |
772 |
++ ret = dma_map_sg(msc_dev(msc)->parent->parent, msc->single_sgt.sgl, 1, |
773 |
++ DMA_FROM_DEVICE); |
774 |
++ if (ret < 0) |
775 |
++ goto err_free_pages; |
776 |
++ |
777 |
++ msc->nr_pages = nr_pages; |
778 |
+ msc->base = page_address(page); |
779 |
+- msc->base_addr = page_to_phys(page); |
780 |
++ msc->base_addr = sg_dma_address(msc->single_sgt.sgl); |
781 |
+ |
782 |
+ return 0; |
783 |
++ |
784 |
++err_free_pages: |
785 |
++ __free_pages(page, order); |
786 |
++ |
787 |
++err_free_sgt: |
788 |
++ sg_free_table(&msc->single_sgt); |
789 |
++ |
790 |
++err_out: |
791 |
++ return ret; |
792 |
+ } |
793 |
+ |
794 |
+ /** |
795 |
+@@ -643,6 +668,10 @@ static void msc_buffer_contig_free(struct msc *msc) |
796 |
+ { |
797 |
+ unsigned long off; |
798 |
+ |
799 |
++ dma_unmap_sg(msc_dev(msc)->parent->parent, msc->single_sgt.sgl, |
800 |
++ 1, DMA_FROM_DEVICE); |
801 |
++ sg_free_table(&msc->single_sgt); |
802 |
++ |
803 |
+ for (off = 0; off < msc->nr_pages << PAGE_SHIFT; off += PAGE_SIZE) { |
804 |
+ struct page *page = virt_to_page(msc->base + off); |
805 |
+ |
806 |
+diff --git a/drivers/hwtracing/stm/core.c b/drivers/hwtracing/stm/core.c |
807 |
+index 9d55e104400c..9ec9197edffa 100644 |
808 |
+--- a/drivers/hwtracing/stm/core.c |
809 |
++++ b/drivers/hwtracing/stm/core.c |
810 |
+@@ -166,11 +166,10 @@ stm_master(struct stm_device *stm, unsigned int idx) |
811 |
+ static int stp_master_alloc(struct stm_device *stm, unsigned int idx) |
812 |
+ { |
813 |
+ struct stp_master *master; |
814 |
+- size_t size; |
815 |
+ |
816 |
+- size = ALIGN(stm->data->sw_nchannels, 8) / 8; |
817 |
+- size += sizeof(struct stp_master); |
818 |
+- master = kzalloc(size, GFP_ATOMIC); |
819 |
++ master = kzalloc(struct_size(master, chan_map, |
820 |
++ BITS_TO_LONGS(stm->data->sw_nchannels)), |
821 |
++ GFP_ATOMIC); |
822 |
+ if (!master) |
823 |
+ return -ENOMEM; |
824 |
+ |
825 |
+@@ -218,8 +217,8 @@ stm_output_disclaim(struct stm_device *stm, struct stm_output *output) |
826 |
+ bitmap_release_region(&master->chan_map[0], output->channel, |
827 |
+ ilog2(output->nr_chans)); |
828 |
+ |
829 |
+- output->nr_chans = 0; |
830 |
+ master->nr_free += output->nr_chans; |
831 |
++ output->nr_chans = 0; |
832 |
+ } |
833 |
+ |
834 |
+ /* |
835 |
+diff --git a/drivers/iommu/tegra-smmu.c b/drivers/iommu/tegra-smmu.c |
836 |
+index 0d03341317c4..121d3cb7ddd1 100644 |
837 |
+--- a/drivers/iommu/tegra-smmu.c |
838 |
++++ b/drivers/iommu/tegra-smmu.c |
839 |
+@@ -102,7 +102,6 @@ static inline u32 smmu_readl(struct tegra_smmu *smmu, unsigned long offset) |
840 |
+ #define SMMU_TLB_FLUSH_VA_MATCH_ALL (0 << 0) |
841 |
+ #define SMMU_TLB_FLUSH_VA_MATCH_SECTION (2 << 0) |
842 |
+ #define SMMU_TLB_FLUSH_VA_MATCH_GROUP (3 << 0) |
843 |
+-#define SMMU_TLB_FLUSH_ASID(x) (((x) & 0x7f) << 24) |
844 |
+ #define SMMU_TLB_FLUSH_VA_SECTION(addr) ((((addr) & 0xffc00000) >> 12) | \ |
845 |
+ SMMU_TLB_FLUSH_VA_MATCH_SECTION) |
846 |
+ #define SMMU_TLB_FLUSH_VA_GROUP(addr) ((((addr) & 0xffffc000) >> 12) | \ |
847 |
+@@ -205,8 +204,12 @@ static inline void smmu_flush_tlb_asid(struct tegra_smmu *smmu, |
848 |
+ { |
849 |
+ u32 value; |
850 |
+ |
851 |
+- value = SMMU_TLB_FLUSH_ASID_MATCH | SMMU_TLB_FLUSH_ASID(asid) | |
852 |
+- SMMU_TLB_FLUSH_VA_MATCH_ALL; |
853 |
++ if (smmu->soc->num_asids == 4) |
854 |
++ value = (asid & 0x3) << 29; |
855 |
++ else |
856 |
++ value = (asid & 0x7f) << 24; |
857 |
++ |
858 |
++ value |= SMMU_TLB_FLUSH_ASID_MATCH | SMMU_TLB_FLUSH_VA_MATCH_ALL; |
859 |
+ smmu_writel(smmu, value, SMMU_TLB_FLUSH); |
860 |
+ } |
861 |
+ |
862 |
+@@ -216,8 +219,12 @@ static inline void smmu_flush_tlb_section(struct tegra_smmu *smmu, |
863 |
+ { |
864 |
+ u32 value; |
865 |
+ |
866 |
+- value = SMMU_TLB_FLUSH_ASID_MATCH | SMMU_TLB_FLUSH_ASID(asid) | |
867 |
+- SMMU_TLB_FLUSH_VA_SECTION(iova); |
868 |
++ if (smmu->soc->num_asids == 4) |
869 |
++ value = (asid & 0x3) << 29; |
870 |
++ else |
871 |
++ value = (asid & 0x7f) << 24; |
872 |
++ |
873 |
++ value |= SMMU_TLB_FLUSH_ASID_MATCH | SMMU_TLB_FLUSH_VA_SECTION(iova); |
874 |
+ smmu_writel(smmu, value, SMMU_TLB_FLUSH); |
875 |
+ } |
876 |
+ |
877 |
+@@ -227,8 +234,12 @@ static inline void smmu_flush_tlb_group(struct tegra_smmu *smmu, |
878 |
+ { |
879 |
+ u32 value; |
880 |
+ |
881 |
+- value = SMMU_TLB_FLUSH_ASID_MATCH | SMMU_TLB_FLUSH_ASID(asid) | |
882 |
+- SMMU_TLB_FLUSH_VA_GROUP(iova); |
883 |
++ if (smmu->soc->num_asids == 4) |
884 |
++ value = (asid & 0x3) << 29; |
885 |
++ else |
886 |
++ value = (asid & 0x7f) << 24; |
887 |
++ |
888 |
++ value |= SMMU_TLB_FLUSH_ASID_MATCH | SMMU_TLB_FLUSH_VA_GROUP(iova); |
889 |
+ smmu_writel(smmu, value, SMMU_TLB_FLUSH); |
890 |
+ } |
891 |
+ |
892 |
+diff --git a/drivers/md/dm-cache-metadata.c b/drivers/md/dm-cache-metadata.c |
893 |
+index 6fc93834da44..151aa95775be 100644 |
894 |
+--- a/drivers/md/dm-cache-metadata.c |
895 |
++++ b/drivers/md/dm-cache-metadata.c |
896 |
+@@ -1167,11 +1167,18 @@ static int __load_discards(struct dm_cache_metadata *cmd, |
897 |
+ if (r) |
898 |
+ return r; |
899 |
+ |
900 |
+- for (b = 0; b < from_dblock(cmd->discard_nr_blocks); b++) { |
901 |
++ for (b = 0; ; b++) { |
902 |
+ r = fn(context, cmd->discard_block_size, to_dblock(b), |
903 |
+ dm_bitset_cursor_get_value(&c)); |
904 |
+ if (r) |
905 |
+ break; |
906 |
++ |
907 |
++ if (b >= (from_dblock(cmd->discard_nr_blocks) - 1)) |
908 |
++ break; |
909 |
++ |
910 |
++ r = dm_bitset_cursor_next(&c); |
911 |
++ if (r) |
912 |
++ break; |
913 |
+ } |
914 |
+ |
915 |
+ dm_bitset_cursor_end(&c); |
916 |
+diff --git a/drivers/md/dm-delay.c b/drivers/md/dm-delay.c |
917 |
+index fddffe251bf6..f496213f8b67 100644 |
918 |
+--- a/drivers/md/dm-delay.c |
919 |
++++ b/drivers/md/dm-delay.c |
920 |
+@@ -121,7 +121,8 @@ static void delay_dtr(struct dm_target *ti) |
921 |
+ { |
922 |
+ struct delay_c *dc = ti->private; |
923 |
+ |
924 |
+- destroy_workqueue(dc->kdelayd_wq); |
925 |
++ if (dc->kdelayd_wq) |
926 |
++ destroy_workqueue(dc->kdelayd_wq); |
927 |
+ |
928 |
+ if (dc->read.dev) |
929 |
+ dm_put_device(ti, dc->read.dev); |
930 |
+diff --git a/drivers/md/dm-integrity.c b/drivers/md/dm-integrity.c |
931 |
+index bc6ef2303f0b..dbdcc543832d 100644 |
932 |
+--- a/drivers/md/dm-integrity.c |
933 |
++++ b/drivers/md/dm-integrity.c |
934 |
+@@ -2557,7 +2557,7 @@ static int calculate_device_limits(struct dm_integrity_c *ic) |
935 |
+ if (last_sector < ic->start || last_sector >= ic->meta_device_sectors) |
936 |
+ return -EINVAL; |
937 |
+ } else { |
938 |
+- __u64 meta_size = ic->provided_data_sectors * ic->tag_size; |
939 |
++ __u64 meta_size = (ic->provided_data_sectors >> ic->sb->log2_sectors_per_block) * ic->tag_size; |
940 |
+ meta_size = (meta_size + ((1U << (ic->log2_buffer_sectors + SECTOR_SHIFT)) - 1)) |
941 |
+ >> (ic->log2_buffer_sectors + SECTOR_SHIFT); |
942 |
+ meta_size <<= ic->log2_buffer_sectors; |
943 |
+@@ -3428,7 +3428,7 @@ try_smaller_buffer: |
944 |
+ DEBUG_print(" journal_sections %u\n", (unsigned)le32_to_cpu(ic->sb->journal_sections)); |
945 |
+ DEBUG_print(" journal_entries %u\n", ic->journal_entries); |
946 |
+ DEBUG_print(" log2_interleave_sectors %d\n", ic->sb->log2_interleave_sectors); |
947 |
+- DEBUG_print(" device_sectors 0x%llx\n", (unsigned long long)ic->device_sectors); |
948 |
++ DEBUG_print(" data_device_sectors 0x%llx\n", (unsigned long long)ic->data_device_sectors); |
949 |
+ DEBUG_print(" initial_sectors 0x%x\n", ic->initial_sectors); |
950 |
+ DEBUG_print(" metadata_run 0x%x\n", ic->metadata_run); |
951 |
+ DEBUG_print(" log2_metadata_run %d\n", ic->log2_metadata_run); |
952 |
+diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c |
953 |
+index 419362c2d8ac..baa966e2778c 100644 |
954 |
+--- a/drivers/md/dm-mpath.c |
955 |
++++ b/drivers/md/dm-mpath.c |
956 |
+@@ -892,6 +892,7 @@ static struct pgpath *parse_path(struct dm_arg_set *as, struct path_selector *ps |
957 |
+ if (attached_handler_name || m->hw_handler_name) { |
958 |
+ INIT_DELAYED_WORK(&p->activate_path, activate_path_work); |
959 |
+ r = setup_scsi_dh(p->path.dev->bdev, m, &attached_handler_name, &ti->error); |
960 |
++ kfree(attached_handler_name); |
961 |
+ if (r) { |
962 |
+ dm_put_device(ti, p->path.dev); |
963 |
+ goto bad; |
964 |
+@@ -906,7 +907,6 @@ static struct pgpath *parse_path(struct dm_arg_set *as, struct path_selector *ps |
965 |
+ |
966 |
+ return p; |
967 |
+ bad: |
968 |
+- kfree(attached_handler_name); |
969 |
+ free_pgpath(p); |
970 |
+ return ERR_PTR(r); |
971 |
+ } |
972 |
+diff --git a/drivers/md/dm-zoned-metadata.c b/drivers/md/dm-zoned-metadata.c |
973 |
+index fa68336560c3..d8334cd45d7c 100644 |
974 |
+--- a/drivers/md/dm-zoned-metadata.c |
975 |
++++ b/drivers/md/dm-zoned-metadata.c |
976 |
+@@ -1169,6 +1169,9 @@ static int dmz_init_zones(struct dmz_metadata *zmd) |
977 |
+ goto out; |
978 |
+ } |
979 |
+ |
980 |
++ if (!nr_blkz) |
981 |
++ break; |
982 |
++ |
983 |
+ /* Process report */ |
984 |
+ for (i = 0; i < nr_blkz; i++) { |
985 |
+ ret = dmz_init_zone(zmd, zone, &blkz[i]); |
986 |
+@@ -1204,6 +1207,8 @@ static int dmz_update_zone(struct dmz_metadata *zmd, struct dm_zone *zone) |
987 |
+ /* Get zone information from disk */ |
988 |
+ ret = blkdev_report_zones(zmd->dev->bdev, dmz_start_sect(zmd, zone), |
989 |
+ &blkz, &nr_blkz, GFP_NOIO); |
990 |
++ if (!nr_blkz) |
991 |
++ ret = -EIO; |
992 |
+ if (ret) { |
993 |
+ dmz_dev_err(zmd->dev, "Get zone %u report failed", |
994 |
+ dmz_id(zmd, zone)); |
995 |
+diff --git a/drivers/md/md.c b/drivers/md/md.c |
996 |
+index 8668793262d0..b924f62e2cd5 100644 |
997 |
+--- a/drivers/md/md.c |
998 |
++++ b/drivers/md/md.c |
999 |
+@@ -132,24 +132,6 @@ static inline int speed_max(struct mddev *mddev) |
1000 |
+ mddev->sync_speed_max : sysctl_speed_limit_max; |
1001 |
+ } |
1002 |
+ |
1003 |
+-static void * flush_info_alloc(gfp_t gfp_flags, void *data) |
1004 |
+-{ |
1005 |
+- return kzalloc(sizeof(struct flush_info), gfp_flags); |
1006 |
+-} |
1007 |
+-static void flush_info_free(void *flush_info, void *data) |
1008 |
+-{ |
1009 |
+- kfree(flush_info); |
1010 |
+-} |
1011 |
+- |
1012 |
+-static void * flush_bio_alloc(gfp_t gfp_flags, void *data) |
1013 |
+-{ |
1014 |
+- return kzalloc(sizeof(struct flush_bio), gfp_flags); |
1015 |
+-} |
1016 |
+-static void flush_bio_free(void *flush_bio, void *data) |
1017 |
+-{ |
1018 |
+- kfree(flush_bio); |
1019 |
+-} |
1020 |
+- |
1021 |
+ static struct ctl_table_header *raid_table_header; |
1022 |
+ |
1023 |
+ static struct ctl_table raid_table[] = { |
1024 |
+@@ -429,54 +411,31 @@ static int md_congested(void *data, int bits) |
1025 |
+ /* |
1026 |
+ * Generic flush handling for md |
1027 |
+ */ |
1028 |
+-static void submit_flushes(struct work_struct *ws) |
1029 |
+-{ |
1030 |
+- struct flush_info *fi = container_of(ws, struct flush_info, flush_work); |
1031 |
+- struct mddev *mddev = fi->mddev; |
1032 |
+- struct bio *bio = fi->bio; |
1033 |
+- |
1034 |
+- bio->bi_opf &= ~REQ_PREFLUSH; |
1035 |
+- md_handle_request(mddev, bio); |
1036 |
+- |
1037 |
+- mempool_free(fi, mddev->flush_pool); |
1038 |
+-} |
1039 |
+ |
1040 |
+-static void md_end_flush(struct bio *fbio) |
1041 |
++static void md_end_flush(struct bio *bio) |
1042 |
+ { |
1043 |
+- struct flush_bio *fb = fbio->bi_private; |
1044 |
+- struct md_rdev *rdev = fb->rdev; |
1045 |
+- struct flush_info *fi = fb->fi; |
1046 |
+- struct bio *bio = fi->bio; |
1047 |
+- struct mddev *mddev = fi->mddev; |
1048 |
++ struct md_rdev *rdev = bio->bi_private; |
1049 |
++ struct mddev *mddev = rdev->mddev; |
1050 |
+ |
1051 |
+ rdev_dec_pending(rdev, mddev); |
1052 |
+ |
1053 |
+- if (atomic_dec_and_test(&fi->flush_pending)) { |
1054 |
+- if (bio->bi_iter.bi_size == 0) { |
1055 |
+- /* an empty barrier - all done */ |
1056 |
+- bio_endio(bio); |
1057 |
+- mempool_free(fi, mddev->flush_pool); |
1058 |
+- } else { |
1059 |
+- INIT_WORK(&fi->flush_work, submit_flushes); |
1060 |
+- queue_work(md_wq, &fi->flush_work); |
1061 |
+- } |
1062 |
++ if (atomic_dec_and_test(&mddev->flush_pending)) { |
1063 |
++ /* The pre-request flush has finished */ |
1064 |
++ queue_work(md_wq, &mddev->flush_work); |
1065 |
+ } |
1066 |
+- |
1067 |
+- mempool_free(fb, mddev->flush_bio_pool); |
1068 |
+- bio_put(fbio); |
1069 |
++ bio_put(bio); |
1070 |
+ } |
1071 |
+ |
1072 |
+-void md_flush_request(struct mddev *mddev, struct bio *bio) |
1073 |
++static void md_submit_flush_data(struct work_struct *ws); |
1074 |
++ |
1075 |
++static void submit_flushes(struct work_struct *ws) |
1076 |
+ { |
1077 |
++ struct mddev *mddev = container_of(ws, struct mddev, flush_work); |
1078 |
+ struct md_rdev *rdev; |
1079 |
+- struct flush_info *fi; |
1080 |
+- |
1081 |
+- fi = mempool_alloc(mddev->flush_pool, GFP_NOIO); |
1082 |
+- |
1083 |
+- fi->bio = bio; |
1084 |
+- fi->mddev = mddev; |
1085 |
+- atomic_set(&fi->flush_pending, 1); |
1086 |
+ |
1087 |
++ mddev->start_flush = ktime_get_boottime(); |
1088 |
++ INIT_WORK(&mddev->flush_work, md_submit_flush_data); |
1089 |
++ atomic_set(&mddev->flush_pending, 1); |
1090 |
+ rcu_read_lock(); |
1091 |
+ rdev_for_each_rcu(rdev, mddev) |
1092 |
+ if (rdev->raid_disk >= 0 && |
1093 |
+@@ -486,37 +445,74 @@ void md_flush_request(struct mddev *mddev, struct bio *bio) |
1094 |
+ * we reclaim rcu_read_lock |
1095 |
+ */ |
1096 |
+ struct bio *bi; |
1097 |
+- struct flush_bio *fb; |
1098 |
+ atomic_inc(&rdev->nr_pending); |
1099 |
+ atomic_inc(&rdev->nr_pending); |
1100 |
+ rcu_read_unlock(); |
1101 |
+- |
1102 |
+- fb = mempool_alloc(mddev->flush_bio_pool, GFP_NOIO); |
1103 |
+- fb->fi = fi; |
1104 |
+- fb->rdev = rdev; |
1105 |
+- |
1106 |
+ bi = bio_alloc_mddev(GFP_NOIO, 0, mddev); |
1107 |
+- bio_set_dev(bi, rdev->bdev); |
1108 |
+ bi->bi_end_io = md_end_flush; |
1109 |
+- bi->bi_private = fb; |
1110 |
++ bi->bi_private = rdev; |
1111 |
++ bio_set_dev(bi, rdev->bdev); |
1112 |
+ bi->bi_opf = REQ_OP_WRITE | REQ_PREFLUSH; |
1113 |
+- |
1114 |
+- atomic_inc(&fi->flush_pending); |
1115 |
++ atomic_inc(&mddev->flush_pending); |
1116 |
+ submit_bio(bi); |
1117 |
+- |
1118 |
+ rcu_read_lock(); |
1119 |
+ rdev_dec_pending(rdev, mddev); |
1120 |
+ } |
1121 |
+ rcu_read_unlock(); |
1122 |
++ if (atomic_dec_and_test(&mddev->flush_pending)) |
1123 |
++ queue_work(md_wq, &mddev->flush_work); |
1124 |
++} |
1125 |
++ |
1126 |
++static void md_submit_flush_data(struct work_struct *ws) |
1127 |
++{ |
1128 |
++ struct mddev *mddev = container_of(ws, struct mddev, flush_work); |
1129 |
++ struct bio *bio = mddev->flush_bio; |
1130 |
++ |
1131 |
++ /* |
1132 |
++ * must reset flush_bio before calling into md_handle_request to avoid a |
1133 |
++ * deadlock, because other bios passed md_handle_request suspend check |
1134 |
++ * could wait for this and below md_handle_request could wait for those |
1135 |
++ * bios because of suspend check |
1136 |
++ */ |
1137 |
++ mddev->last_flush = mddev->start_flush; |
1138 |
++ mddev->flush_bio = NULL; |
1139 |
++ wake_up(&mddev->sb_wait); |
1140 |
+ |
1141 |
+- if (atomic_dec_and_test(&fi->flush_pending)) { |
1142 |
+- if (bio->bi_iter.bi_size == 0) { |
1143 |
++ if (bio->bi_iter.bi_size == 0) { |
1144 |
++ /* an empty barrier - all done */ |
1145 |
++ bio_endio(bio); |
1146 |
++ } else { |
1147 |
++ bio->bi_opf &= ~REQ_PREFLUSH; |
1148 |
++ md_handle_request(mddev, bio); |
1149 |
++ } |
1150 |
++} |
1151 |
++ |
1152 |
++void md_flush_request(struct mddev *mddev, struct bio *bio) |
1153 |
++{ |
1154 |
++ ktime_t start = ktime_get_boottime(); |
1155 |
++ spin_lock_irq(&mddev->lock); |
1156 |
++ wait_event_lock_irq(mddev->sb_wait, |
1157 |
++ !mddev->flush_bio || |
1158 |
++ ktime_after(mddev->last_flush, start), |
1159 |
++ mddev->lock); |
1160 |
++ if (!ktime_after(mddev->last_flush, start)) { |
1161 |
++ WARN_ON(mddev->flush_bio); |
1162 |
++ mddev->flush_bio = bio; |
1163 |
++ bio = NULL; |
1164 |
++ } |
1165 |
++ spin_unlock_irq(&mddev->lock); |
1166 |
++ |
1167 |
++ if (!bio) { |
1168 |
++ INIT_WORK(&mddev->flush_work, submit_flushes); |
1169 |
++ queue_work(md_wq, &mddev->flush_work); |
1170 |
++ } else { |
1171 |
++ /* flush was performed for some other bio while we waited. */ |
1172 |
++ if (bio->bi_iter.bi_size == 0) |
1173 |
+ /* an empty barrier - all done */ |
1174 |
+ bio_endio(bio); |
1175 |
+- mempool_free(fi, mddev->flush_pool); |
1176 |
+- } else { |
1177 |
+- INIT_WORK(&fi->flush_work, submit_flushes); |
1178 |
+- queue_work(md_wq, &fi->flush_work); |
1179 |
++ else { |
1180 |
++ bio->bi_opf &= ~REQ_PREFLUSH; |
1181 |
++ mddev->pers->make_request(mddev, bio); |
1182 |
+ } |
1183 |
+ } |
1184 |
+ } |
1185 |
+@@ -566,6 +562,7 @@ void mddev_init(struct mddev *mddev) |
1186 |
+ atomic_set(&mddev->openers, 0); |
1187 |
+ atomic_set(&mddev->active_io, 0); |
1188 |
+ spin_lock_init(&mddev->lock); |
1189 |
++ atomic_set(&mddev->flush_pending, 0); |
1190 |
+ init_waitqueue_head(&mddev->sb_wait); |
1191 |
+ init_waitqueue_head(&mddev->recovery_wait); |
1192 |
+ mddev->reshape_position = MaxSector; |
1193 |
+@@ -2863,8 +2860,10 @@ state_store(struct md_rdev *rdev, const char *buf, size_t len) |
1194 |
+ err = 0; |
1195 |
+ } |
1196 |
+ } else if (cmd_match(buf, "re-add")) { |
1197 |
+- if (test_bit(Faulty, &rdev->flags) && (rdev->raid_disk == -1) && |
1198 |
+- rdev->saved_raid_disk >= 0) { |
1199 |
++ if (!rdev->mddev->pers) |
1200 |
++ err = -EINVAL; |
1201 |
++ else if (test_bit(Faulty, &rdev->flags) && (rdev->raid_disk == -1) && |
1202 |
++ rdev->saved_raid_disk >= 0) { |
1203 |
+ /* clear_bit is performed _after_ all the devices |
1204 |
+ * have their local Faulty bit cleared. If any writes |
1205 |
+ * happen in the meantime in the local node, they |
1206 |
+@@ -5519,22 +5518,6 @@ int md_run(struct mddev *mddev) |
1207 |
+ if (err) |
1208 |
+ return err; |
1209 |
+ } |
1210 |
+- if (mddev->flush_pool == NULL) { |
1211 |
+- mddev->flush_pool = mempool_create(NR_FLUSH_INFOS, flush_info_alloc, |
1212 |
+- flush_info_free, mddev); |
1213 |
+- if (!mddev->flush_pool) { |
1214 |
+- err = -ENOMEM; |
1215 |
+- goto abort; |
1216 |
+- } |
1217 |
+- } |
1218 |
+- if (mddev->flush_bio_pool == NULL) { |
1219 |
+- mddev->flush_bio_pool = mempool_create(NR_FLUSH_BIOS, flush_bio_alloc, |
1220 |
+- flush_bio_free, mddev); |
1221 |
+- if (!mddev->flush_bio_pool) { |
1222 |
+- err = -ENOMEM; |
1223 |
+- goto abort; |
1224 |
+- } |
1225 |
+- } |
1226 |
+ |
1227 |
+ spin_lock(&pers_lock); |
1228 |
+ pers = find_pers(mddev->level, mddev->clevel); |
1229 |
+@@ -5694,15 +5677,8 @@ int md_run(struct mddev *mddev) |
1230 |
+ return 0; |
1231 |
+ |
1232 |
+ abort: |
1233 |
+- if (mddev->flush_bio_pool) { |
1234 |
+- mempool_destroy(mddev->flush_bio_pool); |
1235 |
+- mddev->flush_bio_pool = NULL; |
1236 |
+- } |
1237 |
+- if (mddev->flush_pool){ |
1238 |
+- mempool_destroy(mddev->flush_pool); |
1239 |
+- mddev->flush_pool = NULL; |
1240 |
+- } |
1241 |
+- |
1242 |
++ bioset_exit(&mddev->bio_set); |
1243 |
++ bioset_exit(&mddev->sync_set); |
1244 |
+ return err; |
1245 |
+ } |
1246 |
+ EXPORT_SYMBOL_GPL(md_run); |
1247 |
+@@ -5906,14 +5882,6 @@ static void __md_stop(struct mddev *mddev) |
1248 |
+ mddev->to_remove = &md_redundancy_group; |
1249 |
+ module_put(pers->owner); |
1250 |
+ clear_bit(MD_RECOVERY_FROZEN, &mddev->recovery); |
1251 |
+- if (mddev->flush_bio_pool) { |
1252 |
+- mempool_destroy(mddev->flush_bio_pool); |
1253 |
+- mddev->flush_bio_pool = NULL; |
1254 |
+- } |
1255 |
+- if (mddev->flush_pool) { |
1256 |
+- mempool_destroy(mddev->flush_pool); |
1257 |
+- mddev->flush_pool = NULL; |
1258 |
+- } |
1259 |
+ } |
1260 |
+ |
1261 |
+ void md_stop(struct mddev *mddev) |
1262 |
+diff --git a/drivers/md/md.h b/drivers/md/md.h |
1263 |
+index 8afd6bfdbfb9..325cb2136a49 100644 |
1264 |
+--- a/drivers/md/md.h |
1265 |
++++ b/drivers/md/md.h |
1266 |
+@@ -252,19 +252,6 @@ enum mddev_sb_flags { |
1267 |
+ MD_SB_NEED_REWRITE, /* metadata write needs to be repeated */ |
1268 |
+ }; |
1269 |
+ |
1270 |
+-#define NR_FLUSH_INFOS 8 |
1271 |
+-#define NR_FLUSH_BIOS 64 |
1272 |
+-struct flush_info { |
1273 |
+- struct bio *bio; |
1274 |
+- struct mddev *mddev; |
1275 |
+- struct work_struct flush_work; |
1276 |
+- atomic_t flush_pending; |
1277 |
+-}; |
1278 |
+-struct flush_bio { |
1279 |
+- struct flush_info *fi; |
1280 |
+- struct md_rdev *rdev; |
1281 |
+-}; |
1282 |
+- |
1283 |
+ struct mddev { |
1284 |
+ void *private; |
1285 |
+ struct md_personality *pers; |
1286 |
+@@ -470,8 +457,16 @@ struct mddev { |
1287 |
+ * metadata and bitmap writes |
1288 |
+ */ |
1289 |
+ |
1290 |
+- mempool_t *flush_pool; |
1291 |
+- mempool_t *flush_bio_pool; |
1292 |
++ /* Generic flush handling. |
1293 |
++ * The last to finish preflush schedules a worker to submit |
1294 |
++ * the rest of the request (without the REQ_PREFLUSH flag). |
1295 |
++ */ |
1296 |
++ struct bio *flush_bio; |
1297 |
++ atomic_t flush_pending; |
1298 |
++ ktime_t start_flush, last_flush; /* last_flush is when the last completed |
1299 |
++ * flush was started. |
1300 |
++ */ |
1301 |
++ struct work_struct flush_work; |
1302 |
+ struct work_struct event_work; /* used by dm to report failure event */ |
1303 |
+ void (*sync_super)(struct mddev *mddev, struct md_rdev *rdev); |
1304 |
+ struct md_cluster_info *cluster_info; |
1305 |
+diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c |
1306 |
+index 828d86605fb6..f237d6f30752 100644 |
1307 |
+--- a/drivers/md/raid5.c |
1308 |
++++ b/drivers/md/raid5.c |
1309 |
+@@ -4185,7 +4185,7 @@ static void handle_parity_checks6(struct r5conf *conf, struct stripe_head *sh, |
1310 |
+ /* now write out any block on a failed drive, |
1311 |
+ * or P or Q if they were recomputed |
1312 |
+ */ |
1313 |
+- BUG_ON(s->uptodate < disks - 1); /* We don't need Q to recover */ |
1314 |
++ dev = NULL; |
1315 |
+ if (s->failed == 2) { |
1316 |
+ dev = &sh->dev[s->failed_num[1]]; |
1317 |
+ s->locked++; |
1318 |
+@@ -4210,6 +4210,14 @@ static void handle_parity_checks6(struct r5conf *conf, struct stripe_head *sh, |
1319 |
+ set_bit(R5_LOCKED, &dev->flags); |
1320 |
+ set_bit(R5_Wantwrite, &dev->flags); |
1321 |
+ } |
1322 |
++ if (WARN_ONCE(dev && !test_bit(R5_UPTODATE, &dev->flags), |
1323 |
++ "%s: disk%td not up to date\n", |
1324 |
++ mdname(conf->mddev), |
1325 |
++ dev - (struct r5dev *) &sh->dev)) { |
1326 |
++ clear_bit(R5_LOCKED, &dev->flags); |
1327 |
++ clear_bit(R5_Wantwrite, &dev->flags); |
1328 |
++ s->locked--; |
1329 |
++ } |
1330 |
+ clear_bit(STRIPE_DEGRADED, &sh->state); |
1331 |
+ |
1332 |
+ set_bit(STRIPE_INSYNC, &sh->state); |
1333 |
+@@ -4221,15 +4229,26 @@ static void handle_parity_checks6(struct r5conf *conf, struct stripe_head *sh, |
1334 |
+ case check_state_check_result: |
1335 |
+ sh->check_state = check_state_idle; |
1336 |
+ |
1337 |
+- if (s->failed > 1) |
1338 |
+- break; |
1339 |
+ /* handle a successful check operation, if parity is correct |
1340 |
+ * we are done. Otherwise update the mismatch count and repair |
1341 |
+ * parity if !MD_RECOVERY_CHECK |
1342 |
+ */ |
1343 |
+ if (sh->ops.zero_sum_result == 0) { |
1344 |
+- /* Any parity checked was correct */ |
1345 |
+- set_bit(STRIPE_INSYNC, &sh->state); |
1346 |
++ /* both parities are correct */ |
1347 |
++ if (!s->failed) |
1348 |
++ set_bit(STRIPE_INSYNC, &sh->state); |
1349 |
++ else { |
1350 |
++ /* in contrast to the raid5 case we can validate |
1351 |
++ * parity, but still have a failure to write |
1352 |
++ * back |
1353 |
++ */ |
1354 |
++ sh->check_state = check_state_compute_result; |
1355 |
++ /* Returning at this point means that we may go |
1356 |
++ * off and bring p and/or q uptodate again so |
1357 |
++ * we make sure to check zero_sum_result again |
1358 |
++ * to verify if p or q need writeback |
1359 |
++ */ |
1360 |
++ } |
1361 |
+ } else { |
1362 |
+ atomic64_add(STRIPE_SECTORS, &conf->mddev->resync_mismatches); |
1363 |
+ if (test_bit(MD_RECOVERY_CHECK, &conf->mddev->recovery)) { |
1364 |
+diff --git a/drivers/media/i2c/ov6650.c b/drivers/media/i2c/ov6650.c |
1365 |
+index 17a34b4a819d..a9264d515e54 100644 |
1366 |
+--- a/drivers/media/i2c/ov6650.c |
1367 |
++++ b/drivers/media/i2c/ov6650.c |
1368 |
+@@ -815,6 +815,8 @@ static int ov6650_video_probe(struct i2c_client *client) |
1369 |
+ if (ret < 0) |
1370 |
+ return ret; |
1371 |
+ |
1372 |
++ msleep(20); |
1373 |
++ |
1374 |
+ /* |
1375 |
+ * check and show product ID and manufacturer ID |
1376 |
+ */ |
1377 |
+diff --git a/drivers/memory/tegra/mc.c b/drivers/memory/tegra/mc.c |
1378 |
+index bd25faf6d13d..c8f16666256c 100644 |
1379 |
+--- a/drivers/memory/tegra/mc.c |
1380 |
++++ b/drivers/memory/tegra/mc.c |
1381 |
+@@ -280,7 +280,7 @@ static int tegra_mc_setup_latency_allowance(struct tegra_mc *mc) |
1382 |
+ u32 value; |
1383 |
+ |
1384 |
+ /* compute the number of MC clock cycles per tick */ |
1385 |
+- tick = mc->tick * clk_get_rate(mc->clk); |
1386 |
++ tick = (unsigned long long)mc->tick * clk_get_rate(mc->clk); |
1387 |
+ do_div(tick, NSEC_PER_SEC); |
1388 |
+ |
1389 |
+ value = readl(mc->regs + MC_EMEM_ARB_CFG); |
1390 |
+diff --git a/drivers/net/Makefile b/drivers/net/Makefile |
1391 |
+index 21cde7e78621..0d3ba056cda3 100644 |
1392 |
+--- a/drivers/net/Makefile |
1393 |
++++ b/drivers/net/Makefile |
1394 |
+@@ -40,7 +40,7 @@ obj-$(CONFIG_ARCNET) += arcnet/ |
1395 |
+ obj-$(CONFIG_DEV_APPLETALK) += appletalk/ |
1396 |
+ obj-$(CONFIG_CAIF) += caif/ |
1397 |
+ obj-$(CONFIG_CAN) += can/ |
1398 |
+-obj-$(CONFIG_NET_DSA) += dsa/ |
1399 |
++obj-y += dsa/ |
1400 |
+ obj-$(CONFIG_ETHERNET) += ethernet/ |
1401 |
+ obj-$(CONFIG_FDDI) += fddi/ |
1402 |
+ obj-$(CONFIG_HIPPI) += hippi/ |
1403 |
+diff --git a/drivers/net/ethernet/mellanox/mlx4/mcg.c b/drivers/net/ethernet/mellanox/mlx4/mcg.c |
1404 |
+index ffed2d4c9403..9c481823b3e8 100644 |
1405 |
+--- a/drivers/net/ethernet/mellanox/mlx4/mcg.c |
1406 |
++++ b/drivers/net/ethernet/mellanox/mlx4/mcg.c |
1407 |
+@@ -1492,7 +1492,7 @@ int mlx4_flow_steer_promisc_add(struct mlx4_dev *dev, u8 port, |
1408 |
+ rule.port = port; |
1409 |
+ rule.qpn = qpn; |
1410 |
+ INIT_LIST_HEAD(&rule.list); |
1411 |
+- mlx4_err(dev, "going promisc on %x\n", port); |
1412 |
++ mlx4_info(dev, "going promisc on %x\n", port); |
1413 |
+ |
1414 |
+ return mlx4_flow_attach(dev, &rule, regid_p); |
1415 |
+ } |
1416 |
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/Kconfig b/drivers/net/ethernet/mellanox/mlx5/core/Kconfig |
1417 |
+index 37a551436e4a..b7e3b8902e7e 100644 |
1418 |
+--- a/drivers/net/ethernet/mellanox/mlx5/core/Kconfig |
1419 |
++++ b/drivers/net/ethernet/mellanox/mlx5/core/Kconfig |
1420 |
+@@ -8,6 +8,7 @@ config MLX5_CORE |
1421 |
+ depends on PCI |
1422 |
+ imply PTP_1588_CLOCK |
1423 |
+ imply VXLAN |
1424 |
++ imply MLXFW |
1425 |
+ default n |
1426 |
+ ---help--- |
1427 |
+ Core driver for low level functionality of the ConnectX-4 and |
1428 |
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c |
1429 |
+index 9ca4f88d7cf6..792bb8bc0cd3 100644 |
1430 |
+--- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c |
1431 |
++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c |
1432 |
+@@ -1609,6 +1609,22 @@ static int mlx5e_flash_device(struct net_device *dev, |
1433 |
+ return mlx5e_ethtool_flash_device(priv, flash); |
1434 |
+ } |
1435 |
+ |
1436 |
++#ifndef CONFIG_MLX5_EN_RXNFC |
1437 |
++/* When CONFIG_MLX5_EN_RXNFC=n we only support ETHTOOL_GRXRINGS |
1438 |
++ * otherwise this function will be defined from en_fs_ethtool.c |
1439 |
++ */ |
1440 |
++static int mlx5e_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *info, u32 *rule_locs) |
1441 |
++{ |
1442 |
++ struct mlx5e_priv *priv = netdev_priv(dev); |
1443 |
++ |
1444 |
++ if (info->cmd != ETHTOOL_GRXRINGS) |
1445 |
++ return -EOPNOTSUPP; |
1446 |
++ /* ring_count is needed by ethtool -x */ |
1447 |
++ info->data = priv->channels.params.num_channels; |
1448 |
++ return 0; |
1449 |
++} |
1450 |
++#endif |
1451 |
++ |
1452 |
+ const struct ethtool_ops mlx5e_ethtool_ops = { |
1453 |
+ .get_drvinfo = mlx5e_get_drvinfo, |
1454 |
+ .get_link = ethtool_op_get_link, |
1455 |
+@@ -1627,8 +1643,8 @@ const struct ethtool_ops mlx5e_ethtool_ops = { |
1456 |
+ .get_rxfh_indir_size = mlx5e_get_rxfh_indir_size, |
1457 |
+ .get_rxfh = mlx5e_get_rxfh, |
1458 |
+ .set_rxfh = mlx5e_set_rxfh, |
1459 |
+-#ifdef CONFIG_MLX5_EN_RXNFC |
1460 |
+ .get_rxnfc = mlx5e_get_rxnfc, |
1461 |
++#ifdef CONFIG_MLX5_EN_RXNFC |
1462 |
+ .set_rxnfc = mlx5e_set_rxnfc, |
1463 |
+ #endif |
1464 |
+ .flash_device = mlx5e_flash_device, |
1465 |
+diff --git a/drivers/net/ethernet/netronome/nfp/flower/tunnel_conf.c b/drivers/net/ethernet/netronome/nfp/flower/tunnel_conf.c |
1466 |
+index 382bb93cb090..ff5c74120c12 100644 |
1467 |
+--- a/drivers/net/ethernet/netronome/nfp/flower/tunnel_conf.c |
1468 |
++++ b/drivers/net/ethernet/netronome/nfp/flower/tunnel_conf.c |
1469 |
+@@ -194,6 +194,7 @@ void nfp_tunnel_keep_alive(struct nfp_app *app, struct sk_buff *skb) |
1470 |
+ return; |
1471 |
+ } |
1472 |
+ |
1473 |
++ rcu_read_lock(); |
1474 |
+ for (i = 0; i < count; i++) { |
1475 |
+ ipv4_addr = payload->tun_info[i].ipv4; |
1476 |
+ port = be32_to_cpu(payload->tun_info[i].egress_port); |
1477 |
+@@ -209,6 +210,7 @@ void nfp_tunnel_keep_alive(struct nfp_app *app, struct sk_buff *skb) |
1478 |
+ neigh_event_send(n, NULL); |
1479 |
+ neigh_release(n); |
1480 |
+ } |
1481 |
++ rcu_read_unlock(); |
1482 |
+ } |
1483 |
+ |
1484 |
+ static bool nfp_tun_is_netdev_to_offload(struct net_device *netdev) |
1485 |
+@@ -404,9 +406,10 @@ void nfp_tunnel_request_route(struct nfp_app *app, struct sk_buff *skb) |
1486 |
+ |
1487 |
+ payload = nfp_flower_cmsg_get_data(skb); |
1488 |
+ |
1489 |
++ rcu_read_lock(); |
1490 |
+ netdev = nfp_app_repr_get(app, be32_to_cpu(payload->ingress_port)); |
1491 |
+ if (!netdev) |
1492 |
+- goto route_fail_warning; |
1493 |
++ goto fail_rcu_unlock; |
1494 |
+ |
1495 |
+ flow.daddr = payload->ipv4_addr; |
1496 |
+ flow.flowi4_proto = IPPROTO_UDP; |
1497 |
+@@ -416,21 +419,23 @@ void nfp_tunnel_request_route(struct nfp_app *app, struct sk_buff *skb) |
1498 |
+ rt = ip_route_output_key(dev_net(netdev), &flow); |
1499 |
+ err = PTR_ERR_OR_ZERO(rt); |
1500 |
+ if (err) |
1501 |
+- goto route_fail_warning; |
1502 |
++ goto fail_rcu_unlock; |
1503 |
+ #else |
1504 |
+- goto route_fail_warning; |
1505 |
++ goto fail_rcu_unlock; |
1506 |
+ #endif |
1507 |
+ |
1508 |
+ /* Get the neighbour entry for the lookup */ |
1509 |
+ n = dst_neigh_lookup(&rt->dst, &flow.daddr); |
1510 |
+ ip_rt_put(rt); |
1511 |
+ if (!n) |
1512 |
+- goto route_fail_warning; |
1513 |
+- nfp_tun_write_neigh(n->dev, app, &flow, n, GFP_KERNEL); |
1514 |
++ goto fail_rcu_unlock; |
1515 |
++ nfp_tun_write_neigh(n->dev, app, &flow, n, GFP_ATOMIC); |
1516 |
+ neigh_release(n); |
1517 |
++ rcu_read_unlock(); |
1518 |
+ return; |
1519 |
+ |
1520 |
+-route_fail_warning: |
1521 |
++fail_rcu_unlock: |
1522 |
++ rcu_read_unlock(); |
1523 |
+ nfp_flower_cmsg_warn(app, "Requested route not found.\n"); |
1524 |
+ } |
1525 |
+ |
1526 |
+diff --git a/drivers/net/ieee802154/mcr20a.c b/drivers/net/ieee802154/mcr20a.c |
1527 |
+index 04891429a554..fe4057fca83d 100644 |
1528 |
+--- a/drivers/net/ieee802154/mcr20a.c |
1529 |
++++ b/drivers/net/ieee802154/mcr20a.c |
1530 |
+@@ -539,6 +539,8 @@ mcr20a_start(struct ieee802154_hw *hw) |
1531 |
+ dev_dbg(printdev(lp), "no slotted operation\n"); |
1532 |
+ ret = regmap_update_bits(lp->regmap_dar, DAR_PHY_CTRL1, |
1533 |
+ DAR_PHY_CTRL1_SLOTTED, 0x0); |
1534 |
++ if (ret < 0) |
1535 |
++ return ret; |
1536 |
+ |
1537 |
+ /* enable irq */ |
1538 |
+ enable_irq(lp->spi->irq); |
1539 |
+@@ -546,11 +548,15 @@ mcr20a_start(struct ieee802154_hw *hw) |
1540 |
+ /* Unmask SEQ interrupt */ |
1541 |
+ ret = regmap_update_bits(lp->regmap_dar, DAR_PHY_CTRL2, |
1542 |
+ DAR_PHY_CTRL2_SEQMSK, 0x0); |
1543 |
++ if (ret < 0) |
1544 |
++ return ret; |
1545 |
+ |
1546 |
+ /* Start the RX sequence */ |
1547 |
+ dev_dbg(printdev(lp), "start the RX sequence\n"); |
1548 |
+ ret = regmap_update_bits(lp->regmap_dar, DAR_PHY_CTRL1, |
1549 |
+ DAR_PHY_CTRL1_XCVSEQ_MASK, MCR20A_XCVSEQ_RX); |
1550 |
++ if (ret < 0) |
1551 |
++ return ret; |
1552 |
+ |
1553 |
+ return 0; |
1554 |
+ } |
1555 |
+diff --git a/drivers/net/ppp/ppp_deflate.c b/drivers/net/ppp/ppp_deflate.c |
1556 |
+index b5edc7f96a39..685e875f5164 100644 |
1557 |
+--- a/drivers/net/ppp/ppp_deflate.c |
1558 |
++++ b/drivers/net/ppp/ppp_deflate.c |
1559 |
+@@ -610,12 +610,20 @@ static struct compressor ppp_deflate_draft = { |
1560 |
+ |
1561 |
+ static int __init deflate_init(void) |
1562 |
+ { |
1563 |
+- int answer = ppp_register_compressor(&ppp_deflate); |
1564 |
+- if (answer == 0) |
1565 |
+- printk(KERN_INFO |
1566 |
+- "PPP Deflate Compression module registered\n"); |
1567 |
+- ppp_register_compressor(&ppp_deflate_draft); |
1568 |
+- return answer; |
1569 |
++ int rc; |
1570 |
++ |
1571 |
++ rc = ppp_register_compressor(&ppp_deflate); |
1572 |
++ if (rc) |
1573 |
++ return rc; |
1574 |
++ |
1575 |
++ rc = ppp_register_compressor(&ppp_deflate_draft); |
1576 |
++ if (rc) { |
1577 |
++ ppp_unregister_compressor(&ppp_deflate); |
1578 |
++ return rc; |
1579 |
++ } |
1580 |
++ |
1581 |
++ pr_info("PPP Deflate Compression module registered\n"); |
1582 |
++ return 0; |
1583 |
+ } |
1584 |
+ |
1585 |
+ static void __exit deflate_cleanup(void) |
1586 |
+diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c |
1587 |
+index 9195f3476b1d..366217263d70 100644 |
1588 |
+--- a/drivers/net/usb/qmi_wwan.c |
1589 |
++++ b/drivers/net/usb/qmi_wwan.c |
1590 |
+@@ -1122,9 +1122,16 @@ static const struct usb_device_id products[] = { |
1591 |
+ {QMI_FIXED_INTF(0x0846, 0x68d3, 8)}, /* Netgear Aircard 779S */ |
1592 |
+ {QMI_FIXED_INTF(0x12d1, 0x140c, 1)}, /* Huawei E173 */ |
1593 |
+ {QMI_FIXED_INTF(0x12d1, 0x14ac, 1)}, /* Huawei E1820 */ |
1594 |
++ {QMI_FIXED_INTF(0x1435, 0x0918, 3)}, /* Wistron NeWeb D16Q1 */ |
1595 |
++ {QMI_FIXED_INTF(0x1435, 0x0918, 4)}, /* Wistron NeWeb D16Q1 */ |
1596 |
++ {QMI_FIXED_INTF(0x1435, 0x0918, 5)}, /* Wistron NeWeb D16Q1 */ |
1597 |
++ {QMI_FIXED_INTF(0x1435, 0x3185, 4)}, /* Wistron NeWeb M18Q5 */ |
1598 |
++ {QMI_FIXED_INTF(0x1435, 0xd111, 4)}, /* M9615A DM11-1 D51QC */ |
1599 |
+ {QMI_FIXED_INTF(0x1435, 0xd181, 3)}, /* Wistron NeWeb D18Q1 */ |
1600 |
+ {QMI_FIXED_INTF(0x1435, 0xd181, 4)}, /* Wistron NeWeb D18Q1 */ |
1601 |
+ {QMI_FIXED_INTF(0x1435, 0xd181, 5)}, /* Wistron NeWeb D18Q1 */ |
1602 |
++ {QMI_FIXED_INTF(0x1435, 0xd182, 4)}, /* Wistron NeWeb D18 */ |
1603 |
++ {QMI_FIXED_INTF(0x1435, 0xd182, 5)}, /* Wistron NeWeb D18 */ |
1604 |
+ {QMI_FIXED_INTF(0x1435, 0xd191, 4)}, /* Wistron NeWeb D19Q1 */ |
1605 |
+ {QMI_QUIRK_SET_DTR(0x1508, 0x1001, 4)}, /* Fibocom NL668 series */ |
1606 |
+ {QMI_FIXED_INTF(0x16d8, 0x6003, 0)}, /* CMOTech 6003 */ |
1607 |
+@@ -1180,6 +1187,7 @@ static const struct usb_device_id products[] = { |
1608 |
+ {QMI_FIXED_INTF(0x19d2, 0x0265, 4)}, /* ONDA MT8205 4G LTE */ |
1609 |
+ {QMI_FIXED_INTF(0x19d2, 0x0284, 4)}, /* ZTE MF880 */ |
1610 |
+ {QMI_FIXED_INTF(0x19d2, 0x0326, 4)}, /* ZTE MF821D */ |
1611 |
++ {QMI_FIXED_INTF(0x19d2, 0x0396, 3)}, /* ZTE ZM8620 */ |
1612 |
+ {QMI_FIXED_INTF(0x19d2, 0x0412, 4)}, /* Telewell TW-LTE 4G */ |
1613 |
+ {QMI_FIXED_INTF(0x19d2, 0x1008, 4)}, /* ZTE (Vodafone) K3570-Z */ |
1614 |
+ {QMI_FIXED_INTF(0x19d2, 0x1010, 4)}, /* ZTE (Vodafone) K3571-Z */ |
1615 |
+@@ -1200,7 +1208,9 @@ static const struct usb_device_id products[] = { |
1616 |
+ {QMI_FIXED_INTF(0x19d2, 0x1425, 2)}, |
1617 |
+ {QMI_FIXED_INTF(0x19d2, 0x1426, 2)}, /* ZTE MF91 */ |
1618 |
+ {QMI_FIXED_INTF(0x19d2, 0x1428, 2)}, /* Telewell TW-LTE 4G v2 */ |
1619 |
++ {QMI_FIXED_INTF(0x19d2, 0x1432, 3)}, /* ZTE ME3620 */ |
1620 |
+ {QMI_FIXED_INTF(0x19d2, 0x2002, 4)}, /* ZTE (Vodafone) K3765-Z */ |
1621 |
++ {QMI_FIXED_INTF(0x2001, 0x7e16, 3)}, /* D-Link DWM-221 */ |
1622 |
+ {QMI_FIXED_INTF(0x2001, 0x7e19, 4)}, /* D-Link DWM-221 B1 */ |
1623 |
+ {QMI_FIXED_INTF(0x2001, 0x7e35, 4)}, /* D-Link DWM-222 */ |
1624 |
+ {QMI_FIXED_INTF(0x2020, 0x2031, 4)}, /* Olicard 600 */ |
1625 |
+@@ -1240,6 +1250,8 @@ static const struct usb_device_id products[] = { |
1626 |
+ {QMI_FIXED_INTF(0x1bc7, 0x1101, 3)}, /* Telit ME910 dual modem */ |
1627 |
+ {QMI_FIXED_INTF(0x1bc7, 0x1200, 5)}, /* Telit LE920 */ |
1628 |
+ {QMI_QUIRK_SET_DTR(0x1bc7, 0x1201, 2)}, /* Telit LE920, LE920A4 */ |
1629 |
++ {QMI_QUIRK_SET_DTR(0x1bc7, 0x1260, 2)}, /* Telit LE910Cx */ |
1630 |
++ {QMI_QUIRK_SET_DTR(0x1bc7, 0x1261, 2)}, /* Telit LE910Cx */ |
1631 |
+ {QMI_QUIRK_SET_DTR(0x1bc7, 0x1900, 1)}, /* Telit LN940 series */ |
1632 |
+ {QMI_FIXED_INTF(0x1c9e, 0x9801, 3)}, /* Telewell TW-3G HSPA+ */ |
1633 |
+ {QMI_FIXED_INTF(0x1c9e, 0x9803, 4)}, /* Telewell TW-3G HSPA+ */ |
1634 |
+diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c b/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c |
1635 |
+index b53148f972a4..036d1d82d93e 100644 |
1636 |
+--- a/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c |
1637 |
++++ b/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c |
1638 |
+@@ -143,9 +143,9 @@ static inline int iwl_mvm_check_pn(struct iwl_mvm *mvm, struct sk_buff *skb, |
1639 |
+ } |
1640 |
+ |
1641 |
+ /* iwl_mvm_create_skb Adds the rxb to a new skb */ |
1642 |
+-static void iwl_mvm_create_skb(struct sk_buff *skb, struct ieee80211_hdr *hdr, |
1643 |
+- u16 len, u8 crypt_len, |
1644 |
+- struct iwl_rx_cmd_buffer *rxb) |
1645 |
++static int iwl_mvm_create_skb(struct iwl_mvm *mvm, struct sk_buff *skb, |
1646 |
++ struct ieee80211_hdr *hdr, u16 len, u8 crypt_len, |
1647 |
++ struct iwl_rx_cmd_buffer *rxb) |
1648 |
+ { |
1649 |
+ struct iwl_rx_packet *pkt = rxb_addr(rxb); |
1650 |
+ struct iwl_rx_mpdu_desc *desc = (void *)pkt->data; |
1651 |
+@@ -178,6 +178,20 @@ static void iwl_mvm_create_skb(struct sk_buff *skb, struct ieee80211_hdr *hdr, |
1652 |
+ * present before copying packet data. |
1653 |
+ */ |
1654 |
+ hdrlen += crypt_len; |
1655 |
++ |
1656 |
++ if (WARN_ONCE(headlen < hdrlen, |
1657 |
++ "invalid packet lengths (hdrlen=%d, len=%d, crypt_len=%d)\n", |
1658 |
++ hdrlen, len, crypt_len)) { |
1659 |
++ /* |
1660 |
++ * We warn and trace because we want to be able to see |
1661 |
++ * it in trace-cmd as well. |
1662 |
++ */ |
1663 |
++ IWL_DEBUG_RX(mvm, |
1664 |
++ "invalid packet lengths (hdrlen=%d, len=%d, crypt_len=%d)\n", |
1665 |
++ hdrlen, len, crypt_len); |
1666 |
++ return -EINVAL; |
1667 |
++ } |
1668 |
++ |
1669 |
+ skb_put_data(skb, hdr, hdrlen); |
1670 |
+ skb_put_data(skb, (u8 *)hdr + hdrlen + pad_len, headlen - hdrlen); |
1671 |
+ |
1672 |
+@@ -190,6 +204,8 @@ static void iwl_mvm_create_skb(struct sk_buff *skb, struct ieee80211_hdr *hdr, |
1673 |
+ skb_add_rx_frag(skb, 0, rxb_steal_page(rxb), offset, |
1674 |
+ fraglen, rxb->truesize); |
1675 |
+ } |
1676 |
++ |
1677 |
++ return 0; |
1678 |
+ } |
1679 |
+ |
1680 |
+ /* iwl_mvm_pass_packet_to_mac80211 - passes the packet for mac80211 */ |
1681 |
+@@ -1425,7 +1441,11 @@ void iwl_mvm_rx_mpdu_mq(struct iwl_mvm *mvm, struct napi_struct *napi, |
1682 |
+ rx_status->boottime_ns = ktime_get_boot_ns(); |
1683 |
+ } |
1684 |
+ |
1685 |
+- iwl_mvm_create_skb(skb, hdr, len, crypt_len, rxb); |
1686 |
++ if (iwl_mvm_create_skb(mvm, skb, hdr, len, crypt_len, rxb)) { |
1687 |
++ kfree_skb(skb); |
1688 |
++ goto out; |
1689 |
++ } |
1690 |
++ |
1691 |
+ if (!iwl_mvm_reorder(mvm, napi, queue, sta, skb, desc)) |
1692 |
+ iwl_mvm_pass_packet_to_mac80211(mvm, napi, skb, queue, sta); |
1693 |
+ out: |
1694 |
+diff --git a/drivers/net/wireless/intersil/p54/p54pci.c b/drivers/net/wireless/intersil/p54/p54pci.c |
1695 |
+index 27a49068d32d..57ad56435dda 100644 |
1696 |
+--- a/drivers/net/wireless/intersil/p54/p54pci.c |
1697 |
++++ b/drivers/net/wireless/intersil/p54/p54pci.c |
1698 |
+@@ -554,7 +554,7 @@ static int p54p_probe(struct pci_dev *pdev, |
1699 |
+ err = pci_enable_device(pdev); |
1700 |
+ if (err) { |
1701 |
+ dev_err(&pdev->dev, "Cannot enable new PCI device\n"); |
1702 |
+- return err; |
1703 |
++ goto err_put; |
1704 |
+ } |
1705 |
+ |
1706 |
+ mem_addr = pci_resource_start(pdev, 0); |
1707 |
+@@ -639,6 +639,7 @@ static int p54p_probe(struct pci_dev *pdev, |
1708 |
+ pci_release_regions(pdev); |
1709 |
+ err_disable_dev: |
1710 |
+ pci_disable_device(pdev); |
1711 |
++err_put: |
1712 |
+ pci_dev_put(pdev); |
1713 |
+ return err; |
1714 |
+ } |
1715 |
+diff --git a/drivers/parisc/led.c b/drivers/parisc/led.c |
1716 |
+index 0c6e8b44b4ed..c60b465f6fe4 100644 |
1717 |
+--- a/drivers/parisc/led.c |
1718 |
++++ b/drivers/parisc/led.c |
1719 |
+@@ -568,6 +568,9 @@ int __init register_led_driver(int model, unsigned long cmd_reg, unsigned long d |
1720 |
+ break; |
1721 |
+ |
1722 |
+ case DISPLAY_MODEL_LASI: |
1723 |
++ /* Skip to register LED in QEMU */ |
1724 |
++ if (running_on_qemu) |
1725 |
++ return 1; |
1726 |
+ LED_DATA_REG = data_reg; |
1727 |
+ led_func_ptr = led_LASI_driver; |
1728 |
+ printk(KERN_INFO "LED display at %lx registered\n", LED_DATA_REG); |
1729 |
+diff --git a/drivers/pci/controller/pcie-rcar.c b/drivers/pci/controller/pcie-rcar.c |
1730 |
+index c8febb009454..6a4e435bd35f 100644 |
1731 |
+--- a/drivers/pci/controller/pcie-rcar.c |
1732 |
++++ b/drivers/pci/controller/pcie-rcar.c |
1733 |
+@@ -46,6 +46,7 @@ |
1734 |
+ |
1735 |
+ /* Transfer control */ |
1736 |
+ #define PCIETCTLR 0x02000 |
1737 |
++#define DL_DOWN BIT(3) |
1738 |
+ #define CFINIT 1 |
1739 |
+ #define PCIETSTR 0x02004 |
1740 |
+ #define DATA_LINK_ACTIVE 1 |
1741 |
+@@ -94,6 +95,7 @@ |
1742 |
+ #define MACCTLR 0x011058 |
1743 |
+ #define SPEED_CHANGE BIT(24) |
1744 |
+ #define SCRAMBLE_DISABLE BIT(27) |
1745 |
++#define PMSR 0x01105c |
1746 |
+ #define MACS2R 0x011078 |
1747 |
+ #define MACCGSPSETR 0x011084 |
1748 |
+ #define SPCNGRSN BIT(31) |
1749 |
+@@ -1130,6 +1132,7 @@ static int rcar_pcie_probe(struct platform_device *pdev) |
1750 |
+ pcie = pci_host_bridge_priv(bridge); |
1751 |
+ |
1752 |
+ pcie->dev = dev; |
1753 |
++ platform_set_drvdata(pdev, pcie); |
1754 |
+ |
1755 |
+ err = pci_parse_request_of_pci_ranges(dev, &pcie->resources, NULL); |
1756 |
+ if (err) |
1757 |
+@@ -1221,10 +1224,28 @@ err_free_bridge: |
1758 |
+ return err; |
1759 |
+ } |
1760 |
+ |
1761 |
++static int rcar_pcie_resume_noirq(struct device *dev) |
1762 |
++{ |
1763 |
++ struct rcar_pcie *pcie = dev_get_drvdata(dev); |
1764 |
++ |
1765 |
++ if (rcar_pci_read_reg(pcie, PMSR) && |
1766 |
++ !(rcar_pci_read_reg(pcie, PCIETCTLR) & DL_DOWN)) |
1767 |
++ return 0; |
1768 |
++ |
1769 |
++ /* Re-establish the PCIe link */ |
1770 |
++ rcar_pci_write_reg(pcie, CFINIT, PCIETCTLR); |
1771 |
++ return rcar_pcie_wait_for_dl(pcie); |
1772 |
++} |
1773 |
++ |
1774 |
++static const struct dev_pm_ops rcar_pcie_pm_ops = { |
1775 |
++ .resume_noirq = rcar_pcie_resume_noirq, |
1776 |
++}; |
1777 |
++ |
1778 |
+ static struct platform_driver rcar_pcie_driver = { |
1779 |
+ .driver = { |
1780 |
+ .name = "rcar-pcie", |
1781 |
+ .of_match_table = rcar_pcie_of_match, |
1782 |
++ .pm = &rcar_pcie_pm_ops, |
1783 |
+ .suppress_bind_attrs = true, |
1784 |
+ }, |
1785 |
+ .probe = rcar_pcie_probe, |
1786 |
+diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c |
1787 |
+index 30649addc625..61f2ef28ea1c 100644 |
1788 |
+--- a/drivers/pci/pci.c |
1789 |
++++ b/drivers/pci/pci.c |
1790 |
+@@ -6135,8 +6135,7 @@ static int __init pci_setup(char *str) |
1791 |
+ } else if (!strncmp(str, "pcie_scan_all", 13)) { |
1792 |
+ pci_add_flags(PCI_SCAN_ALL_PCIE_DEVS); |
1793 |
+ } else if (!strncmp(str, "disable_acs_redir=", 18)) { |
1794 |
+- disable_acs_redir_param = |
1795 |
+- kstrdup(str + 18, GFP_KERNEL); |
1796 |
++ disable_acs_redir_param = str + 18; |
1797 |
+ } else { |
1798 |
+ printk(KERN_ERR "PCI: Unknown option `%s'\n", |
1799 |
+ str); |
1800 |
+@@ -6147,3 +6146,19 @@ static int __init pci_setup(char *str) |
1801 |
+ return 0; |
1802 |
+ } |
1803 |
+ early_param("pci", pci_setup); |
1804 |
++ |
1805 |
++/* |
1806 |
++ * 'disable_acs_redir_param' is initialized in pci_setup(), above, to point |
1807 |
++ * to data in the __initdata section which will be freed after the init |
1808 |
++ * sequence is complete. We can't allocate memory in pci_setup() because some |
1809 |
++ * architectures do not have any memory allocation service available during |
1810 |
++ * an early_param() call. So we allocate memory and copy the variable here |
1811 |
++ * before the init section is freed. |
1812 |
++ */ |
1813 |
++static int __init pci_realloc_setup_params(void) |
1814 |
++{ |
1815 |
++ disable_acs_redir_param = kstrdup(disable_acs_redir_param, GFP_KERNEL); |
1816 |
++ |
1817 |
++ return 0; |
1818 |
++} |
1819 |
++pure_initcall(pci_realloc_setup_params); |
1820 |
+diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h |
1821 |
+index 6e0d1528d471..ab25752f00d9 100644 |
1822 |
+--- a/drivers/pci/pci.h |
1823 |
++++ b/drivers/pci/pci.h |
1824 |
+@@ -530,7 +530,7 @@ void pci_aer_clear_fatal_status(struct pci_dev *dev); |
1825 |
+ void pci_aer_clear_device_status(struct pci_dev *dev); |
1826 |
+ #else |
1827 |
+ static inline void pci_no_aer(void) { } |
1828 |
+-static inline int pci_aer_init(struct pci_dev *d) { return -ENODEV; } |
1829 |
++static inline void pci_aer_init(struct pci_dev *d) { } |
1830 |
+ static inline void pci_aer_exit(struct pci_dev *d) { } |
1831 |
+ static inline void pci_aer_clear_fatal_status(struct pci_dev *dev) { } |
1832 |
+ static inline void pci_aer_clear_device_status(struct pci_dev *dev) { } |
1833 |
+diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c |
1834 |
+index f78860ce884b..1117b25fbe0b 100644 |
1835 |
+--- a/drivers/pci/pcie/aspm.c |
1836 |
++++ b/drivers/pci/pcie/aspm.c |
1837 |
+@@ -198,6 +198,38 @@ static void pcie_clkpm_cap_init(struct pcie_link_state *link, int blacklist) |
1838 |
+ link->clkpm_capable = (blacklist) ? 0 : capable; |
1839 |
+ } |
1840 |
+ |
1841 |
++static bool pcie_retrain_link(struct pcie_link_state *link) |
1842 |
++{ |
1843 |
++ struct pci_dev *parent = link->pdev; |
1844 |
++ unsigned long start_jiffies; |
1845 |
++ u16 reg16; |
1846 |
++ |
1847 |
++ pcie_capability_read_word(parent, PCI_EXP_LNKCTL, ®16); |
1848 |
++ reg16 |= PCI_EXP_LNKCTL_RL; |
1849 |
++ pcie_capability_write_word(parent, PCI_EXP_LNKCTL, reg16); |
1850 |
++ if (parent->clear_retrain_link) { |
1851 |
++ /* |
1852 |
++ * Due to an erratum in some devices the Retrain Link bit |
1853 |
++ * needs to be cleared again manually to allow the link |
1854 |
++ * training to succeed. |
1855 |
++ */ |
1856 |
++ reg16 &= ~PCI_EXP_LNKCTL_RL; |
1857 |
++ pcie_capability_write_word(parent, PCI_EXP_LNKCTL, reg16); |
1858 |
++ } |
1859 |
++ |
1860 |
++ /* Wait for link training end. Break out after waiting for timeout */ |
1861 |
++ start_jiffies = jiffies; |
1862 |
++ for (;;) { |
1863 |
++ pcie_capability_read_word(parent, PCI_EXP_LNKSTA, ®16); |
1864 |
++ if (!(reg16 & PCI_EXP_LNKSTA_LT)) |
1865 |
++ break; |
1866 |
++ if (time_after(jiffies, start_jiffies + LINK_RETRAIN_TIMEOUT)) |
1867 |
++ break; |
1868 |
++ msleep(1); |
1869 |
++ } |
1870 |
++ return !(reg16 & PCI_EXP_LNKSTA_LT); |
1871 |
++} |
1872 |
++ |
1873 |
+ /* |
1874 |
+ * pcie_aspm_configure_common_clock: check if the 2 ends of a link |
1875 |
+ * could use common clock. If they are, configure them to use the |
1876 |
+@@ -207,7 +239,6 @@ static void pcie_aspm_configure_common_clock(struct pcie_link_state *link) |
1877 |
+ { |
1878 |
+ int same_clock = 1; |
1879 |
+ u16 reg16, parent_reg, child_reg[8]; |
1880 |
+- unsigned long start_jiffies; |
1881 |
+ struct pci_dev *child, *parent = link->pdev; |
1882 |
+ struct pci_bus *linkbus = parent->subordinate; |
1883 |
+ /* |
1884 |
+@@ -265,21 +296,7 @@ static void pcie_aspm_configure_common_clock(struct pcie_link_state *link) |
1885 |
+ reg16 &= ~PCI_EXP_LNKCTL_CCC; |
1886 |
+ pcie_capability_write_word(parent, PCI_EXP_LNKCTL, reg16); |
1887 |
+ |
1888 |
+- /* Retrain link */ |
1889 |
+- reg16 |= PCI_EXP_LNKCTL_RL; |
1890 |
+- pcie_capability_write_word(parent, PCI_EXP_LNKCTL, reg16); |
1891 |
+- |
1892 |
+- /* Wait for link training end. Break out after waiting for timeout */ |
1893 |
+- start_jiffies = jiffies; |
1894 |
+- for (;;) { |
1895 |
+- pcie_capability_read_word(parent, PCI_EXP_LNKSTA, ®16); |
1896 |
+- if (!(reg16 & PCI_EXP_LNKSTA_LT)) |
1897 |
+- break; |
1898 |
+- if (time_after(jiffies, start_jiffies + LINK_RETRAIN_TIMEOUT)) |
1899 |
+- break; |
1900 |
+- msleep(1); |
1901 |
+- } |
1902 |
+- if (!(reg16 & PCI_EXP_LNKSTA_LT)) |
1903 |
++ if (pcie_retrain_link(link)) |
1904 |
+ return; |
1905 |
+ |
1906 |
+ /* Training failed. Restore common clock configurations */ |
1907 |
+diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c |
1908 |
+index 4a4c16bfc0d3..fa4c386c8cd8 100644 |
1909 |
+--- a/drivers/pci/probe.c |
1910 |
++++ b/drivers/pci/probe.c |
1911 |
+@@ -535,16 +535,9 @@ static void pci_release_host_bridge_dev(struct device *dev) |
1912 |
+ kfree(to_pci_host_bridge(dev)); |
1913 |
+ } |
1914 |
+ |
1915 |
+-struct pci_host_bridge *pci_alloc_host_bridge(size_t priv) |
1916 |
++static void pci_init_host_bridge(struct pci_host_bridge *bridge) |
1917 |
+ { |
1918 |
+- struct pci_host_bridge *bridge; |
1919 |
+- |
1920 |
+- bridge = kzalloc(sizeof(*bridge) + priv, GFP_KERNEL); |
1921 |
+- if (!bridge) |
1922 |
+- return NULL; |
1923 |
+- |
1924 |
+ INIT_LIST_HEAD(&bridge->windows); |
1925 |
+- bridge->dev.release = pci_release_host_bridge_dev; |
1926 |
+ |
1927 |
+ /* |
1928 |
+ * We assume we can manage these PCIe features. Some systems may |
1929 |
+@@ -557,6 +550,18 @@ struct pci_host_bridge *pci_alloc_host_bridge(size_t priv) |
1930 |
+ bridge->native_shpc_hotplug = 1; |
1931 |
+ bridge->native_pme = 1; |
1932 |
+ bridge->native_ltr = 1; |
1933 |
++} |
1934 |
++ |
1935 |
++struct pci_host_bridge *pci_alloc_host_bridge(size_t priv) |
1936 |
++{ |
1937 |
++ struct pci_host_bridge *bridge; |
1938 |
++ |
1939 |
++ bridge = kzalloc(sizeof(*bridge) + priv, GFP_KERNEL); |
1940 |
++ if (!bridge) |
1941 |
++ return NULL; |
1942 |
++ |
1943 |
++ pci_init_host_bridge(bridge); |
1944 |
++ bridge->dev.release = pci_release_host_bridge_dev; |
1945 |
+ |
1946 |
+ return bridge; |
1947 |
+ } |
1948 |
+@@ -571,7 +576,7 @@ struct pci_host_bridge *devm_pci_alloc_host_bridge(struct device *dev, |
1949 |
+ if (!bridge) |
1950 |
+ return NULL; |
1951 |
+ |
1952 |
+- INIT_LIST_HEAD(&bridge->windows); |
1953 |
++ pci_init_host_bridge(bridge); |
1954 |
+ bridge->dev.release = devm_pci_release_host_bridge_dev; |
1955 |
+ |
1956 |
+ return bridge; |
1957 |
+diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c |
1958 |
+index 37d897bc4cf1..28c64f84bfe7 100644 |
1959 |
+--- a/drivers/pci/quirks.c |
1960 |
++++ b/drivers/pci/quirks.c |
1961 |
+@@ -2220,6 +2220,23 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x10f1, quirk_disable_aspm_l0s); |
1962 |
+ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x10f4, quirk_disable_aspm_l0s); |
1963 |
+ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x1508, quirk_disable_aspm_l0s); |
1964 |
+ |
1965 |
++/* |
1966 |
++ * Some Pericom PCIe-to-PCI bridges in reverse mode need the PCIe Retrain |
1967 |
++ * Link bit cleared after starting the link retrain process to allow this |
1968 |
++ * process to finish. |
1969 |
++ * |
1970 |
++ * Affected devices: PI7C9X110, PI7C9X111SL, PI7C9X130. See also the |
1971 |
++ * Pericom Errata Sheet PI7C9X111SLB_errata_rev1.2_102711.pdf. |
1972 |
++ */ |
1973 |
++static void quirk_enable_clear_retrain_link(struct pci_dev *dev) |
1974 |
++{ |
1975 |
++ dev->clear_retrain_link = 1; |
1976 |
++ pci_info(dev, "Enable PCIe Retrain Link quirk\n"); |
1977 |
++} |
1978 |
++DECLARE_PCI_FIXUP_HEADER(0x12d8, 0xe110, quirk_enable_clear_retrain_link); |
1979 |
++DECLARE_PCI_FIXUP_HEADER(0x12d8, 0xe111, quirk_enable_clear_retrain_link); |
1980 |
++DECLARE_PCI_FIXUP_HEADER(0x12d8, 0xe130, quirk_enable_clear_retrain_link); |
1981 |
++ |
1982 |
+ static void fixup_rev1_53c810(struct pci_dev *dev) |
1983 |
+ { |
1984 |
+ u32 class = dev->class; |
1985 |
+@@ -3383,6 +3400,7 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATHEROS, 0x0030, quirk_no_bus_reset); |
1986 |
+ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATHEROS, 0x0032, quirk_no_bus_reset); |
1987 |
+ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATHEROS, 0x003c, quirk_no_bus_reset); |
1988 |
+ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATHEROS, 0x0033, quirk_no_bus_reset); |
1989 |
++DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATHEROS, 0x0034, quirk_no_bus_reset); |
1990 |
+ |
1991 |
+ /* |
1992 |
+ * Root port on some Cavium CN8xxx chips do not successfully complete a bus |
1993 |
+@@ -4878,6 +4896,7 @@ static void quirk_no_ats(struct pci_dev *pdev) |
1994 |
+ |
1995 |
+ /* AMD Stoney platform GPU */ |
1996 |
+ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x98e4, quirk_no_ats); |
1997 |
++DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x6900, quirk_no_ats); |
1998 |
+ #endif /* CONFIG_PCI_ATS */ |
1999 |
+ |
2000 |
+ /* Freescale PCIe doesn't support MSI in RC mode */ |
2001 |
+diff --git a/drivers/phy/ti/phy-ti-pipe3.c b/drivers/phy/ti/phy-ti-pipe3.c |
2002 |
+index 68ce4a082b9b..693acc167351 100644 |
2003 |
+--- a/drivers/phy/ti/phy-ti-pipe3.c |
2004 |
++++ b/drivers/phy/ti/phy-ti-pipe3.c |
2005 |
+@@ -303,7 +303,7 @@ static void ti_pipe3_calibrate(struct ti_pipe3 *phy) |
2006 |
+ |
2007 |
+ val = ti_pipe3_readl(phy->phy_rx, PCIEPHYRX_ANA_PROGRAMMABILITY); |
2008 |
+ val &= ~(INTERFACE_MASK | LOSD_MASK | MEM_PLLDIV); |
2009 |
+- val = (0x1 << INTERFACE_SHIFT | 0xA << LOSD_SHIFT); |
2010 |
++ val |= (0x1 << INTERFACE_SHIFT | 0xA << LOSD_SHIFT); |
2011 |
+ ti_pipe3_writel(phy->phy_rx, PCIEPHYRX_ANA_PROGRAMMABILITY, val); |
2012 |
+ |
2013 |
+ val = ti_pipe3_readl(phy->phy_rx, PCIEPHYRX_DIGITAL_MODES); |
2014 |
+diff --git a/drivers/power/supply/cpcap-battery.c b/drivers/power/supply/cpcap-battery.c |
2015 |
+index 98ba07869c3b..3bae02380bb2 100644 |
2016 |
+--- a/drivers/power/supply/cpcap-battery.c |
2017 |
++++ b/drivers/power/supply/cpcap-battery.c |
2018 |
+@@ -221,6 +221,9 @@ static int cpcap_battery_cc_raw_div(struct cpcap_battery_ddata *ddata, |
2019 |
+ int avg_current; |
2020 |
+ u32 cc_lsb; |
2021 |
+ |
2022 |
++ if (!divider) |
2023 |
++ return 0; |
2024 |
++ |
2025 |
+ sample &= 0xffffff; /* 24-bits, unsigned */ |
2026 |
+ offset &= 0x7ff; /* 10-bits, signed */ |
2027 |
+ |
2028 |
+diff --git a/drivers/power/supply/power_supply_sysfs.c b/drivers/power/supply/power_supply_sysfs.c |
2029 |
+index 6170ed8b6854..5a2757a7f408 100644 |
2030 |
+--- a/drivers/power/supply/power_supply_sysfs.c |
2031 |
++++ b/drivers/power/supply/power_supply_sysfs.c |
2032 |
+@@ -382,15 +382,11 @@ int power_supply_uevent(struct device *dev, struct kobj_uevent_env *env) |
2033 |
+ char *prop_buf; |
2034 |
+ char *attrname; |
2035 |
+ |
2036 |
+- dev_dbg(dev, "uevent\n"); |
2037 |
+- |
2038 |
+ if (!psy || !psy->desc) { |
2039 |
+ dev_dbg(dev, "No power supply yet\n"); |
2040 |
+ return ret; |
2041 |
+ } |
2042 |
+ |
2043 |
+- dev_dbg(dev, "POWER_SUPPLY_NAME=%s\n", psy->desc->name); |
2044 |
+- |
2045 |
+ ret = add_uevent_var(env, "POWER_SUPPLY_NAME=%s", psy->desc->name); |
2046 |
+ if (ret) |
2047 |
+ return ret; |
2048 |
+@@ -426,8 +422,6 @@ int power_supply_uevent(struct device *dev, struct kobj_uevent_env *env) |
2049 |
+ goto out; |
2050 |
+ } |
2051 |
+ |
2052 |
+- dev_dbg(dev, "prop %s=%s\n", attrname, prop_buf); |
2053 |
+- |
2054 |
+ ret = add_uevent_var(env, "POWER_SUPPLY_%s=%s", attrname, prop_buf); |
2055 |
+ kfree(attrname); |
2056 |
+ if (ret) |
2057 |
+diff --git a/drivers/staging/media/imx/imx-media-csi.c b/drivers/staging/media/imx/imx-media-csi.c |
2058 |
+index e22f1239a318..d17ce1fb4ef5 100644 |
2059 |
+--- a/drivers/staging/media/imx/imx-media-csi.c |
2060 |
++++ b/drivers/staging/media/imx/imx-media-csi.c |
2061 |
+@@ -153,9 +153,10 @@ static inline bool requires_passthrough(struct v4l2_fwnode_endpoint *ep, |
2062 |
+ /* |
2063 |
+ * Parses the fwnode endpoint from the source pad of the entity |
2064 |
+ * connected to this CSI. This will either be the entity directly |
2065 |
+- * upstream from the CSI-2 receiver, or directly upstream from the |
2066 |
+- * video mux. The endpoint is needed to determine the bus type and |
2067 |
+- * bus config coming into the CSI. |
2068 |
++ * upstream from the CSI-2 receiver, directly upstream from the |
2069 |
++ * video mux, or directly upstream from the CSI itself. The endpoint |
2070 |
++ * is needed to determine the bus type and bus config coming into |
2071 |
++ * the CSI. |
2072 |
+ */ |
2073 |
+ static int csi_get_upstream_endpoint(struct csi_priv *priv, |
2074 |
+ struct v4l2_fwnode_endpoint *ep) |
2075 |
+@@ -168,7 +169,8 @@ static int csi_get_upstream_endpoint(struct csi_priv *priv, |
2076 |
+ if (!priv->src_sd) |
2077 |
+ return -EPIPE; |
2078 |
+ |
2079 |
+- src = &priv->src_sd->entity; |
2080 |
++ sd = priv->src_sd; |
2081 |
++ src = &sd->entity; |
2082 |
+ |
2083 |
+ if (src->function == MEDIA_ENT_F_VID_MUX) { |
2084 |
+ /* |
2085 |
+@@ -182,6 +184,14 @@ static int csi_get_upstream_endpoint(struct csi_priv *priv, |
2086 |
+ src = &sd->entity; |
2087 |
+ } |
2088 |
+ |
2089 |
++ /* |
2090 |
++ * If the source is neither the video mux nor the CSI-2 receiver, |
2091 |
++ * get the source pad directly upstream from CSI itself. |
2092 |
++ */ |
2093 |
++ if (src->function != MEDIA_ENT_F_VID_MUX && |
2094 |
++ sd->grp_id != IMX_MEDIA_GRP_ID_CSI2) |
2095 |
++ src = &priv->sd.entity; |
2096 |
++ |
2097 |
+ /* get source pad of entity directly upstream from src */ |
2098 |
+ pad = imx_media_find_upstream_pad(priv->md, src, 0); |
2099 |
+ if (IS_ERR(pad)) |
2100 |
+diff --git a/drivers/staging/media/imx/imx-media-of.c b/drivers/staging/media/imx/imx-media-of.c |
2101 |
+index acde372c6795..1647da216bf9 100644 |
2102 |
+--- a/drivers/staging/media/imx/imx-media-of.c |
2103 |
++++ b/drivers/staging/media/imx/imx-media-of.c |
2104 |
+@@ -233,15 +233,18 @@ int imx_media_create_csi_of_links(struct imx_media_dev *imxmd, |
2105 |
+ struct v4l2_subdev *csi) |
2106 |
+ { |
2107 |
+ struct device_node *csi_np = csi->dev->of_node; |
2108 |
+- struct fwnode_handle *fwnode, *csi_ep; |
2109 |
+- struct v4l2_fwnode_link link; |
2110 |
+ struct device_node *ep; |
2111 |
+- int ret; |
2112 |
+- |
2113 |
+- link.local_node = of_fwnode_handle(csi_np); |
2114 |
+- link.local_port = CSI_SINK_PAD; |
2115 |
+ |
2116 |
+ for_each_child_of_node(csi_np, ep) { |
2117 |
++ struct fwnode_handle *fwnode, *csi_ep; |
2118 |
++ struct v4l2_fwnode_link link; |
2119 |
++ int ret; |
2120 |
++ |
2121 |
++ memset(&link, 0, sizeof(link)); |
2122 |
++ |
2123 |
++ link.local_node = of_fwnode_handle(csi_np); |
2124 |
++ link.local_port = CSI_SINK_PAD; |
2125 |
++ |
2126 |
+ csi_ep = of_fwnode_handle(ep); |
2127 |
+ |
2128 |
+ fwnode = fwnode_graph_get_remote_endpoint(csi_ep); |
2129 |
+diff --git a/drivers/video/fbdev/efifb.c b/drivers/video/fbdev/efifb.c |
2130 |
+index ba906876cc45..fd02e8a4841d 100644 |
2131 |
+--- a/drivers/video/fbdev/efifb.c |
2132 |
++++ b/drivers/video/fbdev/efifb.c |
2133 |
+@@ -476,8 +476,12 @@ static int efifb_probe(struct platform_device *dev) |
2134 |
+ * If the UEFI memory map covers the efifb region, we may only |
2135 |
+ * remap it using the attributes the memory map prescribes. |
2136 |
+ */ |
2137 |
+- mem_flags |= EFI_MEMORY_WT | EFI_MEMORY_WB; |
2138 |
+- mem_flags &= md.attribute; |
2139 |
++ md.attribute &= EFI_MEMORY_UC | EFI_MEMORY_WC | |
2140 |
++ EFI_MEMORY_WT | EFI_MEMORY_WB; |
2141 |
++ if (md.attribute) { |
2142 |
++ mem_flags |= EFI_MEMORY_WT | EFI_MEMORY_WB; |
2143 |
++ mem_flags &= md.attribute; |
2144 |
++ } |
2145 |
+ } |
2146 |
+ if (mem_flags & EFI_MEMORY_WC) |
2147 |
+ info->screen_base = ioremap_wc(efifb_fix.smem_start, |
2148 |
+diff --git a/drivers/video/fbdev/sm712.h b/drivers/video/fbdev/sm712.h |
2149 |
+index aad1cc4be34a..c7ebf03b8d53 100644 |
2150 |
+--- a/drivers/video/fbdev/sm712.h |
2151 |
++++ b/drivers/video/fbdev/sm712.h |
2152 |
+@@ -15,14 +15,10 @@ |
2153 |
+ |
2154 |
+ #define FB_ACCEL_SMI_LYNX 88 |
2155 |
+ |
2156 |
+-#define SCREEN_X_RES 1024 |
2157 |
+-#define SCREEN_Y_RES 600 |
2158 |
+-#define SCREEN_BPP 16 |
2159 |
+- |
2160 |
+-/*Assume SM712 graphics chip has 4MB VRAM */ |
2161 |
+-#define SM712_VIDEOMEMORYSIZE 0x00400000 |
2162 |
+-/*Assume SM722 graphics chip has 8MB VRAM */ |
2163 |
+-#define SM722_VIDEOMEMORYSIZE 0x00800000 |
2164 |
++#define SCREEN_X_RES 1024 |
2165 |
++#define SCREEN_Y_RES_PC 768 |
2166 |
++#define SCREEN_Y_RES_NETBOOK 600 |
2167 |
++#define SCREEN_BPP 16 |
2168 |
+ |
2169 |
+ #define dac_reg (0x3c8) |
2170 |
+ #define dac_val (0x3c9) |
2171 |
+diff --git a/drivers/video/fbdev/sm712fb.c b/drivers/video/fbdev/sm712fb.c |
2172 |
+index 502d0de2feec..f1dcc6766d1e 100644 |
2173 |
+--- a/drivers/video/fbdev/sm712fb.c |
2174 |
++++ b/drivers/video/fbdev/sm712fb.c |
2175 |
+@@ -530,6 +530,65 @@ static const struct modeinit vgamode[] = { |
2176 |
+ 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x15, 0x03, |
2177 |
+ }, |
2178 |
+ }, |
2179 |
++ { /* 1024 x 768 16Bpp 60Hz */ |
2180 |
++ 1024, 768, 16, 60, |
2181 |
++ /* Init_MISC */ |
2182 |
++ 0xEB, |
2183 |
++ { /* Init_SR0_SR4 */ |
2184 |
++ 0x03, 0x01, 0x0F, 0x03, 0x0E, |
2185 |
++ }, |
2186 |
++ { /* Init_SR10_SR24 */ |
2187 |
++ 0xF3, 0xB6, 0xC0, 0xDD, 0x00, 0x0E, 0x17, 0x2C, |
2188 |
++ 0x99, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, |
2189 |
++ 0xC4, 0x30, 0x02, 0x01, 0x01, |
2190 |
++ }, |
2191 |
++ { /* Init_SR30_SR75 */ |
2192 |
++ 0x38, 0x03, 0x20, 0x09, 0xC0, 0x3A, 0x3A, 0x3A, |
2193 |
++ 0x3A, 0x3A, 0x3A, 0x3A, 0x00, 0x00, 0x03, 0xFF, |
2194 |
++ 0x00, 0xFC, 0x00, 0x00, 0x20, 0x18, 0x00, 0xFC, |
2195 |
++ 0x20, 0x0C, 0x44, 0x20, 0x00, 0x00, 0x00, 0x3A, |
2196 |
++ 0x06, 0x68, 0xA7, 0x7F, 0x83, 0x24, 0xFF, 0x03, |
2197 |
++ 0x0F, 0x60, 0x59, 0x3A, 0x3A, 0x00, 0x00, 0x3A, |
2198 |
++ 0x01, 0x80, 0x7E, 0x1A, 0x1A, 0x00, 0x00, 0x00, |
2199 |
++ 0x50, 0x03, 0x74, 0x14, 0x3B, 0x0D, 0x09, 0x02, |
2200 |
++ 0x04, 0x45, 0x30, 0x30, 0x40, 0x20, |
2201 |
++ }, |
2202 |
++ { /* Init_SR80_SR93 */ |
2203 |
++ 0xFF, 0x07, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x3A, |
2204 |
++ 0xF7, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x3A, 0x3A, |
2205 |
++ 0x00, 0x00, 0x00, 0x00, |
2206 |
++ }, |
2207 |
++ { /* Init_SRA0_SRAF */ |
2208 |
++ 0x00, 0xFB, 0x9F, 0x01, 0x00, 0xED, 0xED, 0xED, |
2209 |
++ 0x7B, 0xFB, 0xFF, 0xFF, 0x97, 0xEF, 0xBF, 0xDF, |
2210 |
++ }, |
2211 |
++ { /* Init_GR00_GR08 */ |
2212 |
++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x05, 0x0F, |
2213 |
++ 0xFF, |
2214 |
++ }, |
2215 |
++ { /* Init_AR00_AR14 */ |
2216 |
++ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, |
2217 |
++ 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, |
2218 |
++ 0x41, 0x00, 0x0F, 0x00, 0x00, |
2219 |
++ }, |
2220 |
++ { /* Init_CR00_CR18 */ |
2221 |
++ 0xA3, 0x7F, 0x7F, 0x00, 0x85, 0x16, 0x24, 0xF5, |
2222 |
++ 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
2223 |
++ 0x03, 0x09, 0xFF, 0x80, 0x40, 0xFF, 0x00, 0xE3, |
2224 |
++ 0xFF, |
2225 |
++ }, |
2226 |
++ { /* Init_CR30_CR4D */ |
2227 |
++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x02, 0x20, |
2228 |
++ 0x00, 0x00, 0x00, 0x40, 0x00, 0xFF, 0xBF, 0xFF, |
2229 |
++ 0xA3, 0x7F, 0x00, 0x86, 0x15, 0x24, 0xFF, 0x00, |
2230 |
++ 0x01, 0x07, 0xE5, 0x20, 0x7F, 0xFF, |
2231 |
++ }, |
2232 |
++ { /* Init_CR90_CRA7 */ |
2233 |
++ 0x55, 0xD9, 0x5D, 0xE1, 0x86, 0x1B, 0x8E, 0x26, |
2234 |
++ 0xDA, 0x8D, 0xDE, 0x94, 0x00, 0x00, 0x18, 0x00, |
2235 |
++ 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x15, 0x03, |
2236 |
++ }, |
2237 |
++ }, |
2238 |
+ { /* mode#5: 1024 x 768 24Bpp 60Hz */ |
2239 |
+ 1024, 768, 24, 60, |
2240 |
+ /* Init_MISC */ |
2241 |
+@@ -827,67 +886,80 @@ static inline unsigned int chan_to_field(unsigned int chan, |
2242 |
+ |
2243 |
+ static int smtc_blank(int blank_mode, struct fb_info *info) |
2244 |
+ { |
2245 |
++ struct smtcfb_info *sfb = info->par; |
2246 |
++ |
2247 |
+ /* clear DPMS setting */ |
2248 |
+ switch (blank_mode) { |
2249 |
+ case FB_BLANK_UNBLANK: |
2250 |
+ /* Screen On: HSync: On, VSync : On */ |
2251 |
++ |
2252 |
++ switch (sfb->chip_id) { |
2253 |
++ case 0x710: |
2254 |
++ case 0x712: |
2255 |
++ smtc_seqw(0x6a, 0x16); |
2256 |
++ smtc_seqw(0x6b, 0x02); |
2257 |
++ break; |
2258 |
++ case 0x720: |
2259 |
++ smtc_seqw(0x6a, 0x0d); |
2260 |
++ smtc_seqw(0x6b, 0x02); |
2261 |
++ break; |
2262 |
++ } |
2263 |
++ |
2264 |
++ smtc_seqw(0x23, (smtc_seqr(0x23) & (~0xc0))); |
2265 |
+ smtc_seqw(0x01, (smtc_seqr(0x01) & (~0x20))); |
2266 |
+- smtc_seqw(0x6a, 0x16); |
2267 |
+- smtc_seqw(0x6b, 0x02); |
2268 |
+ smtc_seqw(0x21, (smtc_seqr(0x21) & 0x77)); |
2269 |
+ smtc_seqw(0x22, (smtc_seqr(0x22) & (~0x30))); |
2270 |
+- smtc_seqw(0x23, (smtc_seqr(0x23) & (~0xc0))); |
2271 |
+- smtc_seqw(0x24, (smtc_seqr(0x24) | 0x01)); |
2272 |
+ smtc_seqw(0x31, (smtc_seqr(0x31) | 0x03)); |
2273 |
++ smtc_seqw(0x24, (smtc_seqr(0x24) | 0x01)); |
2274 |
+ break; |
2275 |
+ case FB_BLANK_NORMAL: |
2276 |
+ /* Screen Off: HSync: On, VSync : On Soft blank */ |
2277 |
++ smtc_seqw(0x24, (smtc_seqr(0x24) | 0x01)); |
2278 |
++ smtc_seqw(0x31, ((smtc_seqr(0x31) & (~0x07)) | 0x00)); |
2279 |
++ smtc_seqw(0x23, (smtc_seqr(0x23) & (~0xc0))); |
2280 |
+ smtc_seqw(0x01, (smtc_seqr(0x01) & (~0x20))); |
2281 |
++ smtc_seqw(0x22, (smtc_seqr(0x22) & (~0x30))); |
2282 |
+ smtc_seqw(0x6a, 0x16); |
2283 |
+ smtc_seqw(0x6b, 0x02); |
2284 |
+- smtc_seqw(0x22, (smtc_seqr(0x22) & (~0x30))); |
2285 |
+- smtc_seqw(0x23, (smtc_seqr(0x23) & (~0xc0))); |
2286 |
+- smtc_seqw(0x24, (smtc_seqr(0x24) | 0x01)); |
2287 |
+- smtc_seqw(0x31, ((smtc_seqr(0x31) & (~0x07)) | 0x00)); |
2288 |
+ break; |
2289 |
+ case FB_BLANK_VSYNC_SUSPEND: |
2290 |
+ /* Screen On: HSync: On, VSync : Off */ |
2291 |
++ smtc_seqw(0x24, (smtc_seqr(0x24) & (~0x01))); |
2292 |
++ smtc_seqw(0x31, ((smtc_seqr(0x31) & (~0x07)) | 0x00)); |
2293 |
++ smtc_seqw(0x23, ((smtc_seqr(0x23) & (~0xc0)) | 0x20)); |
2294 |
+ smtc_seqw(0x01, (smtc_seqr(0x01) | 0x20)); |
2295 |
+- smtc_seqw(0x20, (smtc_seqr(0x20) & (~0xB0))); |
2296 |
+- smtc_seqw(0x6a, 0x0c); |
2297 |
+- smtc_seqw(0x6b, 0x02); |
2298 |
+ smtc_seqw(0x21, (smtc_seqr(0x21) | 0x88)); |
2299 |
++ smtc_seqw(0x20, (smtc_seqr(0x20) & (~0xB0))); |
2300 |
+ smtc_seqw(0x22, ((smtc_seqr(0x22) & (~0x30)) | 0x20)); |
2301 |
+- smtc_seqw(0x23, ((smtc_seqr(0x23) & (~0xc0)) | 0x20)); |
2302 |
+- smtc_seqw(0x24, (smtc_seqr(0x24) & (~0x01))); |
2303 |
+- smtc_seqw(0x31, ((smtc_seqr(0x31) & (~0x07)) | 0x00)); |
2304 |
+ smtc_seqw(0x34, (smtc_seqr(0x34) | 0x80)); |
2305 |
++ smtc_seqw(0x6a, 0x0c); |
2306 |
++ smtc_seqw(0x6b, 0x02); |
2307 |
+ break; |
2308 |
+ case FB_BLANK_HSYNC_SUSPEND: |
2309 |
+ /* Screen On: HSync: Off, VSync : On */ |
2310 |
++ smtc_seqw(0x24, (smtc_seqr(0x24) & (~0x01))); |
2311 |
++ smtc_seqw(0x31, ((smtc_seqr(0x31) & (~0x07)) | 0x00)); |
2312 |
++ smtc_seqw(0x23, ((smtc_seqr(0x23) & (~0xc0)) | 0xD8)); |
2313 |
+ smtc_seqw(0x01, (smtc_seqr(0x01) | 0x20)); |
2314 |
+- smtc_seqw(0x20, (smtc_seqr(0x20) & (~0xB0))); |
2315 |
+- smtc_seqw(0x6a, 0x0c); |
2316 |
+- smtc_seqw(0x6b, 0x02); |
2317 |
+ smtc_seqw(0x21, (smtc_seqr(0x21) | 0x88)); |
2318 |
++ smtc_seqw(0x20, (smtc_seqr(0x20) & (~0xB0))); |
2319 |
+ smtc_seqw(0x22, ((smtc_seqr(0x22) & (~0x30)) | 0x10)); |
2320 |
+- smtc_seqw(0x23, ((smtc_seqr(0x23) & (~0xc0)) | 0xD8)); |
2321 |
+- smtc_seqw(0x24, (smtc_seqr(0x24) & (~0x01))); |
2322 |
+- smtc_seqw(0x31, ((smtc_seqr(0x31) & (~0x07)) | 0x00)); |
2323 |
+ smtc_seqw(0x34, (smtc_seqr(0x34) | 0x80)); |
2324 |
++ smtc_seqw(0x6a, 0x0c); |
2325 |
++ smtc_seqw(0x6b, 0x02); |
2326 |
+ break; |
2327 |
+ case FB_BLANK_POWERDOWN: |
2328 |
+ /* Screen On: HSync: Off, VSync : Off */ |
2329 |
++ smtc_seqw(0x24, (smtc_seqr(0x24) & (~0x01))); |
2330 |
++ smtc_seqw(0x31, ((smtc_seqr(0x31) & (~0x07)) | 0x00)); |
2331 |
++ smtc_seqw(0x23, ((smtc_seqr(0x23) & (~0xc0)) | 0xD8)); |
2332 |
+ smtc_seqw(0x01, (smtc_seqr(0x01) | 0x20)); |
2333 |
+- smtc_seqw(0x20, (smtc_seqr(0x20) & (~0xB0))); |
2334 |
+- smtc_seqw(0x6a, 0x0c); |
2335 |
+- smtc_seqw(0x6b, 0x02); |
2336 |
+ smtc_seqw(0x21, (smtc_seqr(0x21) | 0x88)); |
2337 |
++ smtc_seqw(0x20, (smtc_seqr(0x20) & (~0xB0))); |
2338 |
+ smtc_seqw(0x22, ((smtc_seqr(0x22) & (~0x30)) | 0x30)); |
2339 |
+- smtc_seqw(0x23, ((smtc_seqr(0x23) & (~0xc0)) | 0xD8)); |
2340 |
+- smtc_seqw(0x24, (smtc_seqr(0x24) & (~0x01))); |
2341 |
+- smtc_seqw(0x31, ((smtc_seqr(0x31) & (~0x07)) | 0x00)); |
2342 |
+ smtc_seqw(0x34, (smtc_seqr(0x34) | 0x80)); |
2343 |
++ smtc_seqw(0x6a, 0x0c); |
2344 |
++ smtc_seqw(0x6b, 0x02); |
2345 |
+ break; |
2346 |
+ default: |
2347 |
+ return -EINVAL; |
2348 |
+@@ -1145,8 +1217,10 @@ static void sm7xx_set_timing(struct smtcfb_info *sfb) |
2349 |
+ |
2350 |
+ /* init SEQ register SR30 - SR75 */ |
2351 |
+ for (i = 0; i < SIZE_SR30_SR75; i++) |
2352 |
+- if ((i + 0x30) != 0x62 && (i + 0x30) != 0x6a && |
2353 |
+- (i + 0x30) != 0x6b) |
2354 |
++ if ((i + 0x30) != 0x30 && (i + 0x30) != 0x62 && |
2355 |
++ (i + 0x30) != 0x6a && (i + 0x30) != 0x6b && |
2356 |
++ (i + 0x30) != 0x70 && (i + 0x30) != 0x71 && |
2357 |
++ (i + 0x30) != 0x74 && (i + 0x30) != 0x75) |
2358 |
+ smtc_seqw(i + 0x30, |
2359 |
+ vgamode[j].init_sr30_sr75[i]); |
2360 |
+ |
2361 |
+@@ -1171,8 +1245,12 @@ static void sm7xx_set_timing(struct smtcfb_info *sfb) |
2362 |
+ smtc_crtcw(i, vgamode[j].init_cr00_cr18[i]); |
2363 |
+ |
2364 |
+ /* init CRTC register CR30 - CR4D */ |
2365 |
+- for (i = 0; i < SIZE_CR30_CR4D; i++) |
2366 |
++ for (i = 0; i < SIZE_CR30_CR4D; i++) { |
2367 |
++ if ((i + 0x30) >= 0x3B && (i + 0x30) <= 0x3F) |
2368 |
++ /* side-effect, don't write to CR3B-CR3F */ |
2369 |
++ continue; |
2370 |
+ smtc_crtcw(i + 0x30, vgamode[j].init_cr30_cr4d[i]); |
2371 |
++ } |
2372 |
+ |
2373 |
+ /* init CRTC register CR90 - CRA7 */ |
2374 |
+ for (i = 0; i < SIZE_CR90_CRA7; i++) |
2375 |
+@@ -1323,6 +1401,11 @@ static int smtc_map_smem(struct smtcfb_info *sfb, |
2376 |
+ { |
2377 |
+ sfb->fb->fix.smem_start = pci_resource_start(pdev, 0); |
2378 |
+ |
2379 |
++ if (sfb->chip_id == 0x720) |
2380 |
++ /* on SM720, the framebuffer starts at the 1 MB offset */ |
2381 |
++ sfb->fb->fix.smem_start += 0x00200000; |
2382 |
++ |
2383 |
++ /* XXX: is it safe for SM720 on Big-Endian? */ |
2384 |
+ if (sfb->fb->var.bits_per_pixel == 32) |
2385 |
+ sfb->fb->fix.smem_start += big_addr; |
2386 |
+ |
2387 |
+@@ -1360,12 +1443,82 @@ static inline void sm7xx_init_hw(void) |
2388 |
+ outb_p(0x11, 0x3c5); |
2389 |
+ } |
2390 |
+ |
2391 |
++static u_long sm7xx_vram_probe(struct smtcfb_info *sfb) |
2392 |
++{ |
2393 |
++ u8 vram; |
2394 |
++ |
2395 |
++ switch (sfb->chip_id) { |
2396 |
++ case 0x710: |
2397 |
++ case 0x712: |
2398 |
++ /* |
2399 |
++ * Assume SM712 graphics chip has 4MB VRAM. |
2400 |
++ * |
2401 |
++ * FIXME: SM712 can have 2MB VRAM, which is used on earlier |
2402 |
++ * laptops, such as IBM Thinkpad 240X. This driver would |
2403 |
++ * probably crash on those machines. If anyone gets one of |
2404 |
++ * those and is willing to help, run "git blame" and send me |
2405 |
++ * an E-mail. |
2406 |
++ */ |
2407 |
++ return 0x00400000; |
2408 |
++ case 0x720: |
2409 |
++ outb_p(0x76, 0x3c4); |
2410 |
++ vram = inb_p(0x3c5) >> 6; |
2411 |
++ |
2412 |
++ if (vram == 0x00) |
2413 |
++ return 0x00800000; /* 8 MB */ |
2414 |
++ else if (vram == 0x01) |
2415 |
++ return 0x01000000; /* 16 MB */ |
2416 |
++ else if (vram == 0x02) |
2417 |
++ return 0x00400000; /* illegal, fallback to 4 MB */ |
2418 |
++ else if (vram == 0x03) |
2419 |
++ return 0x00400000; /* 4 MB */ |
2420 |
++ } |
2421 |
++ return 0; /* unknown hardware */ |
2422 |
++} |
2423 |
++ |
2424 |
++static void sm7xx_resolution_probe(struct smtcfb_info *sfb) |
2425 |
++{ |
2426 |
++ /* get mode parameter from smtc_scr_info */ |
2427 |
++ if (smtc_scr_info.lfb_width != 0) { |
2428 |
++ sfb->fb->var.xres = smtc_scr_info.lfb_width; |
2429 |
++ sfb->fb->var.yres = smtc_scr_info.lfb_height; |
2430 |
++ sfb->fb->var.bits_per_pixel = smtc_scr_info.lfb_depth; |
2431 |
++ goto final; |
2432 |
++ } |
2433 |
++ |
2434 |
++ /* |
2435 |
++ * No parameter, default resolution is 1024x768-16. |
2436 |
++ * |
2437 |
++ * FIXME: earlier laptops, such as IBM Thinkpad 240X, has a 800x600 |
2438 |
++ * panel, also see the comments about Thinkpad 240X above. |
2439 |
++ */ |
2440 |
++ sfb->fb->var.xres = SCREEN_X_RES; |
2441 |
++ sfb->fb->var.yres = SCREEN_Y_RES_PC; |
2442 |
++ sfb->fb->var.bits_per_pixel = SCREEN_BPP; |
2443 |
++ |
2444 |
++#ifdef CONFIG_MIPS |
2445 |
++ /* |
2446 |
++ * Loongson MIPS netbooks use 1024x600 LCD panels, which is the original |
2447 |
++ * target platform of this driver, but nearly all old x86 laptops have |
2448 |
++ * 1024x768. Lighting 768 panels using 600's timings would partially |
2449 |
++ * garble the display, so we don't want that. But it's not possible to |
2450 |
++ * distinguish them reliably. |
2451 |
++ * |
2452 |
++ * So we change the default to 768, but keep 600 as-is on MIPS. |
2453 |
++ */ |
2454 |
++ sfb->fb->var.yres = SCREEN_Y_RES_NETBOOK; |
2455 |
++#endif |
2456 |
++ |
2457 |
++final: |
2458 |
++ big_pixel_depth(sfb->fb->var.bits_per_pixel, smtc_scr_info.lfb_depth); |
2459 |
++} |
2460 |
++ |
2461 |
+ static int smtcfb_pci_probe(struct pci_dev *pdev, |
2462 |
+ const struct pci_device_id *ent) |
2463 |
+ { |
2464 |
+ struct smtcfb_info *sfb; |
2465 |
+ struct fb_info *info; |
2466 |
+- u_long smem_size = 0x00800000; /* default 8MB */ |
2467 |
++ u_long smem_size; |
2468 |
+ int err; |
2469 |
+ unsigned long mmio_base; |
2470 |
+ |
2471 |
+@@ -1405,29 +1558,19 @@ static int smtcfb_pci_probe(struct pci_dev *pdev, |
2472 |
+ |
2473 |
+ sm7xx_init_hw(); |
2474 |
+ |
2475 |
+- /* get mode parameter from smtc_scr_info */ |
2476 |
+- if (smtc_scr_info.lfb_width != 0) { |
2477 |
+- sfb->fb->var.xres = smtc_scr_info.lfb_width; |
2478 |
+- sfb->fb->var.yres = smtc_scr_info.lfb_height; |
2479 |
+- sfb->fb->var.bits_per_pixel = smtc_scr_info.lfb_depth; |
2480 |
+- } else { |
2481 |
+- /* default resolution 1024x600 16bit mode */ |
2482 |
+- sfb->fb->var.xres = SCREEN_X_RES; |
2483 |
+- sfb->fb->var.yres = SCREEN_Y_RES; |
2484 |
+- sfb->fb->var.bits_per_pixel = SCREEN_BPP; |
2485 |
+- } |
2486 |
+- |
2487 |
+- big_pixel_depth(sfb->fb->var.bits_per_pixel, smtc_scr_info.lfb_depth); |
2488 |
+ /* Map address and memory detection */ |
2489 |
+ mmio_base = pci_resource_start(pdev, 0); |
2490 |
+ pci_read_config_byte(pdev, PCI_REVISION_ID, &sfb->chip_rev_id); |
2491 |
+ |
2492 |
++ smem_size = sm7xx_vram_probe(sfb); |
2493 |
++ dev_info(&pdev->dev, "%lu MiB of VRAM detected.\n", |
2494 |
++ smem_size / 1048576); |
2495 |
++ |
2496 |
+ switch (sfb->chip_id) { |
2497 |
+ case 0x710: |
2498 |
+ case 0x712: |
2499 |
+ sfb->fb->fix.mmio_start = mmio_base + 0x00400000; |
2500 |
+ sfb->fb->fix.mmio_len = 0x00400000; |
2501 |
+- smem_size = SM712_VIDEOMEMORYSIZE; |
2502 |
+ sfb->lfb = ioremap(mmio_base, mmio_addr); |
2503 |
+ if (!sfb->lfb) { |
2504 |
+ dev_err(&pdev->dev, |
2505 |
+@@ -1459,8 +1602,7 @@ static int smtcfb_pci_probe(struct pci_dev *pdev, |
2506 |
+ case 0x720: |
2507 |
+ sfb->fb->fix.mmio_start = mmio_base; |
2508 |
+ sfb->fb->fix.mmio_len = 0x00200000; |
2509 |
+- smem_size = SM722_VIDEOMEMORYSIZE; |
2510 |
+- sfb->dp_regs = ioremap(mmio_base, 0x00a00000); |
2511 |
++ sfb->dp_regs = ioremap(mmio_base, 0x00200000 + smem_size); |
2512 |
+ sfb->lfb = sfb->dp_regs + 0x00200000; |
2513 |
+ sfb->mmio = (smtc_regbaseaddress = |
2514 |
+ sfb->dp_regs + 0x000c0000); |
2515 |
+@@ -1477,6 +1619,9 @@ static int smtcfb_pci_probe(struct pci_dev *pdev, |
2516 |
+ goto failed_fb; |
2517 |
+ } |
2518 |
+ |
2519 |
++ /* probe and decide resolution */ |
2520 |
++ sm7xx_resolution_probe(sfb); |
2521 |
++ |
2522 |
+ /* can support 32 bpp */ |
2523 |
+ if (sfb->fb->var.bits_per_pixel == 15) |
2524 |
+ sfb->fb->var.bits_per_pixel = 16; |
2525 |
+@@ -1487,7 +1632,11 @@ static int smtcfb_pci_probe(struct pci_dev *pdev, |
2526 |
+ if (err) |
2527 |
+ goto failed; |
2528 |
+ |
2529 |
+- smtcfb_setmode(sfb); |
2530 |
++ /* |
2531 |
++ * The screen would be temporarily garbled when sm712fb takes over |
2532 |
++ * vesafb or VGA text mode. Zero the framebuffer. |
2533 |
++ */ |
2534 |
++ memset_io(sfb->lfb, 0, sfb->fb->fix.smem_len); |
2535 |
+ |
2536 |
+ err = register_framebuffer(info); |
2537 |
+ if (err < 0) |
2538 |
+diff --git a/drivers/video/fbdev/udlfb.c b/drivers/video/fbdev/udlfb.c |
2539 |
+index 070026a7e55a..2001910fd241 100644 |
2540 |
+--- a/drivers/video/fbdev/udlfb.c |
2541 |
++++ b/drivers/video/fbdev/udlfb.c |
2542 |
+@@ -594,8 +594,7 @@ static int dlfb_render_hline(struct dlfb_data *dlfb, struct urb **urb_ptr, |
2543 |
+ return 0; |
2544 |
+ } |
2545 |
+ |
2546 |
+-static int dlfb_handle_damage(struct dlfb_data *dlfb, int x, int y, |
2547 |
+- int width, int height, char *data) |
2548 |
++static int dlfb_handle_damage(struct dlfb_data *dlfb, int x, int y, int width, int height) |
2549 |
+ { |
2550 |
+ int i, ret; |
2551 |
+ char *cmd; |
2552 |
+@@ -607,21 +606,29 @@ static int dlfb_handle_damage(struct dlfb_data *dlfb, int x, int y, |
2553 |
+ |
2554 |
+ start_cycles = get_cycles(); |
2555 |
+ |
2556 |
++ mutex_lock(&dlfb->render_mutex); |
2557 |
++ |
2558 |
+ aligned_x = DL_ALIGN_DOWN(x, sizeof(unsigned long)); |
2559 |
+ width = DL_ALIGN_UP(width + (x-aligned_x), sizeof(unsigned long)); |
2560 |
+ x = aligned_x; |
2561 |
+ |
2562 |
+ if ((width <= 0) || |
2563 |
+ (x + width > dlfb->info->var.xres) || |
2564 |
+- (y + height > dlfb->info->var.yres)) |
2565 |
+- return -EINVAL; |
2566 |
++ (y + height > dlfb->info->var.yres)) { |
2567 |
++ ret = -EINVAL; |
2568 |
++ goto unlock_ret; |
2569 |
++ } |
2570 |
+ |
2571 |
+- if (!atomic_read(&dlfb->usb_active)) |
2572 |
+- return 0; |
2573 |
++ if (!atomic_read(&dlfb->usb_active)) { |
2574 |
++ ret = 0; |
2575 |
++ goto unlock_ret; |
2576 |
++ } |
2577 |
+ |
2578 |
+ urb = dlfb_get_urb(dlfb); |
2579 |
+- if (!urb) |
2580 |
+- return 0; |
2581 |
++ if (!urb) { |
2582 |
++ ret = 0; |
2583 |
++ goto unlock_ret; |
2584 |
++ } |
2585 |
+ cmd = urb->transfer_buffer; |
2586 |
+ |
2587 |
+ for (i = y; i < y + height ; i++) { |
2588 |
+@@ -641,7 +648,7 @@ static int dlfb_handle_damage(struct dlfb_data *dlfb, int x, int y, |
2589 |
+ *cmd++ = 0xAF; |
2590 |
+ /* Send partial buffer remaining before exiting */ |
2591 |
+ len = cmd - (char *) urb->transfer_buffer; |
2592 |
+- ret = dlfb_submit_urb(dlfb, urb, len); |
2593 |
++ dlfb_submit_urb(dlfb, urb, len); |
2594 |
+ bytes_sent += len; |
2595 |
+ } else |
2596 |
+ dlfb_urb_completion(urb); |
2597 |
+@@ -655,7 +662,55 @@ error: |
2598 |
+ >> 10)), /* Kcycles */ |
2599 |
+ &dlfb->cpu_kcycles_used); |
2600 |
+ |
2601 |
+- return 0; |
2602 |
++ ret = 0; |
2603 |
++ |
2604 |
++unlock_ret: |
2605 |
++ mutex_unlock(&dlfb->render_mutex); |
2606 |
++ return ret; |
2607 |
++} |
2608 |
++ |
2609 |
++static void dlfb_init_damage(struct dlfb_data *dlfb) |
2610 |
++{ |
2611 |
++ dlfb->damage_x = INT_MAX; |
2612 |
++ dlfb->damage_x2 = 0; |
2613 |
++ dlfb->damage_y = INT_MAX; |
2614 |
++ dlfb->damage_y2 = 0; |
2615 |
++} |
2616 |
++ |
2617 |
++static void dlfb_damage_work(struct work_struct *w) |
2618 |
++{ |
2619 |
++ struct dlfb_data *dlfb = container_of(w, struct dlfb_data, damage_work); |
2620 |
++ int x, x2, y, y2; |
2621 |
++ |
2622 |
++ spin_lock_irq(&dlfb->damage_lock); |
2623 |
++ x = dlfb->damage_x; |
2624 |
++ x2 = dlfb->damage_x2; |
2625 |
++ y = dlfb->damage_y; |
2626 |
++ y2 = dlfb->damage_y2; |
2627 |
++ dlfb_init_damage(dlfb); |
2628 |
++ spin_unlock_irq(&dlfb->damage_lock); |
2629 |
++ |
2630 |
++ if (x < x2 && y < y2) |
2631 |
++ dlfb_handle_damage(dlfb, x, y, x2 - x, y2 - y); |
2632 |
++} |
2633 |
++ |
2634 |
++static void dlfb_offload_damage(struct dlfb_data *dlfb, int x, int y, int width, int height) |
2635 |
++{ |
2636 |
++ unsigned long flags; |
2637 |
++ int x2 = x + width; |
2638 |
++ int y2 = y + height; |
2639 |
++ |
2640 |
++ if (x >= x2 || y >= y2) |
2641 |
++ return; |
2642 |
++ |
2643 |
++ spin_lock_irqsave(&dlfb->damage_lock, flags); |
2644 |
++ dlfb->damage_x = min(x, dlfb->damage_x); |
2645 |
++ dlfb->damage_x2 = max(x2, dlfb->damage_x2); |
2646 |
++ dlfb->damage_y = min(y, dlfb->damage_y); |
2647 |
++ dlfb->damage_y2 = max(y2, dlfb->damage_y2); |
2648 |
++ spin_unlock_irqrestore(&dlfb->damage_lock, flags); |
2649 |
++ |
2650 |
++ schedule_work(&dlfb->damage_work); |
2651 |
+ } |
2652 |
+ |
2653 |
+ /* |
2654 |
+@@ -679,7 +734,7 @@ static ssize_t dlfb_ops_write(struct fb_info *info, const char __user *buf, |
2655 |
+ (u32)info->var.yres); |
2656 |
+ |
2657 |
+ dlfb_handle_damage(dlfb, 0, start, info->var.xres, |
2658 |
+- lines, info->screen_base); |
2659 |
++ lines); |
2660 |
+ } |
2661 |
+ |
2662 |
+ return result; |
2663 |
+@@ -694,8 +749,8 @@ static void dlfb_ops_copyarea(struct fb_info *info, |
2664 |
+ |
2665 |
+ sys_copyarea(info, area); |
2666 |
+ |
2667 |
+- dlfb_handle_damage(dlfb, area->dx, area->dy, |
2668 |
+- area->width, area->height, info->screen_base); |
2669 |
++ dlfb_offload_damage(dlfb, area->dx, area->dy, |
2670 |
++ area->width, area->height); |
2671 |
+ } |
2672 |
+ |
2673 |
+ static void dlfb_ops_imageblit(struct fb_info *info, |
2674 |
+@@ -705,8 +760,8 @@ static void dlfb_ops_imageblit(struct fb_info *info, |
2675 |
+ |
2676 |
+ sys_imageblit(info, image); |
2677 |
+ |
2678 |
+- dlfb_handle_damage(dlfb, image->dx, image->dy, |
2679 |
+- image->width, image->height, info->screen_base); |
2680 |
++ dlfb_offload_damage(dlfb, image->dx, image->dy, |
2681 |
++ image->width, image->height); |
2682 |
+ } |
2683 |
+ |
2684 |
+ static void dlfb_ops_fillrect(struct fb_info *info, |
2685 |
+@@ -716,8 +771,8 @@ static void dlfb_ops_fillrect(struct fb_info *info, |
2686 |
+ |
2687 |
+ sys_fillrect(info, rect); |
2688 |
+ |
2689 |
+- dlfb_handle_damage(dlfb, rect->dx, rect->dy, rect->width, |
2690 |
+- rect->height, info->screen_base); |
2691 |
++ dlfb_offload_damage(dlfb, rect->dx, rect->dy, rect->width, |
2692 |
++ rect->height); |
2693 |
+ } |
2694 |
+ |
2695 |
+ /* |
2696 |
+@@ -739,17 +794,19 @@ static void dlfb_dpy_deferred_io(struct fb_info *info, |
2697 |
+ int bytes_identical = 0; |
2698 |
+ int bytes_rendered = 0; |
2699 |
+ |
2700 |
++ mutex_lock(&dlfb->render_mutex); |
2701 |
++ |
2702 |
+ if (!fb_defio) |
2703 |
+- return; |
2704 |
++ goto unlock_ret; |
2705 |
+ |
2706 |
+ if (!atomic_read(&dlfb->usb_active)) |
2707 |
+- return; |
2708 |
++ goto unlock_ret; |
2709 |
+ |
2710 |
+ start_cycles = get_cycles(); |
2711 |
+ |
2712 |
+ urb = dlfb_get_urb(dlfb); |
2713 |
+ if (!urb) |
2714 |
+- return; |
2715 |
++ goto unlock_ret; |
2716 |
+ |
2717 |
+ cmd = urb->transfer_buffer; |
2718 |
+ |
2719 |
+@@ -782,6 +839,8 @@ error: |
2720 |
+ atomic_add(((unsigned int) ((end_cycles - start_cycles) |
2721 |
+ >> 10)), /* Kcycles */ |
2722 |
+ &dlfb->cpu_kcycles_used); |
2723 |
++unlock_ret: |
2724 |
++ mutex_unlock(&dlfb->render_mutex); |
2725 |
+ } |
2726 |
+ |
2727 |
+ static int dlfb_get_edid(struct dlfb_data *dlfb, char *edid, int len) |
2728 |
+@@ -859,8 +918,7 @@ static int dlfb_ops_ioctl(struct fb_info *info, unsigned int cmd, |
2729 |
+ if (area.y > info->var.yres) |
2730 |
+ area.y = info->var.yres; |
2731 |
+ |
2732 |
+- dlfb_handle_damage(dlfb, area.x, area.y, area.w, area.h, |
2733 |
+- info->screen_base); |
2734 |
++ dlfb_handle_damage(dlfb, area.x, area.y, area.w, area.h); |
2735 |
+ } |
2736 |
+ |
2737 |
+ return 0; |
2738 |
+@@ -942,6 +1000,10 @@ static void dlfb_ops_destroy(struct fb_info *info) |
2739 |
+ { |
2740 |
+ struct dlfb_data *dlfb = info->par; |
2741 |
+ |
2742 |
++ cancel_work_sync(&dlfb->damage_work); |
2743 |
++ |
2744 |
++ mutex_destroy(&dlfb->render_mutex); |
2745 |
++ |
2746 |
+ if (info->cmap.len != 0) |
2747 |
+ fb_dealloc_cmap(&info->cmap); |
2748 |
+ if (info->monspecs.modedb) |
2749 |
+@@ -1065,8 +1127,7 @@ static int dlfb_ops_set_par(struct fb_info *info) |
2750 |
+ pix_framebuffer[i] = 0x37e6; |
2751 |
+ } |
2752 |
+ |
2753 |
+- dlfb_handle_damage(dlfb, 0, 0, info->var.xres, info->var.yres, |
2754 |
+- info->screen_base); |
2755 |
++ dlfb_handle_damage(dlfb, 0, 0, info->var.xres, info->var.yres); |
2756 |
+ |
2757 |
+ return 0; |
2758 |
+ } |
2759 |
+@@ -1639,6 +1700,11 @@ static int dlfb_usb_probe(struct usb_interface *intf, |
2760 |
+ dlfb->ops = dlfb_ops; |
2761 |
+ info->fbops = &dlfb->ops; |
2762 |
+ |
2763 |
++ mutex_init(&dlfb->render_mutex); |
2764 |
++ dlfb_init_damage(dlfb); |
2765 |
++ spin_lock_init(&dlfb->damage_lock); |
2766 |
++ INIT_WORK(&dlfb->damage_work, dlfb_damage_work); |
2767 |
++ |
2768 |
+ INIT_LIST_HEAD(&info->modelist); |
2769 |
+ |
2770 |
+ if (!dlfb_alloc_urb_list(dlfb, WRITES_IN_FLIGHT, MAX_TRANSFER)) { |
2771 |
+diff --git a/fs/ceph/super.c b/fs/ceph/super.c |
2772 |
+index eab1359d0553..c5cf46e43f2e 100644 |
2773 |
+--- a/fs/ceph/super.c |
2774 |
++++ b/fs/ceph/super.c |
2775 |
+@@ -819,6 +819,12 @@ static void ceph_umount_begin(struct super_block *sb) |
2776 |
+ return; |
2777 |
+ } |
2778 |
+ |
2779 |
++static int ceph_remount(struct super_block *sb, int *flags, char *data) |
2780 |
++{ |
2781 |
++ sync_filesystem(sb); |
2782 |
++ return 0; |
2783 |
++} |
2784 |
++ |
2785 |
+ static const struct super_operations ceph_super_ops = { |
2786 |
+ .alloc_inode = ceph_alloc_inode, |
2787 |
+ .destroy_inode = ceph_destroy_inode, |
2788 |
+@@ -826,6 +832,7 @@ static const struct super_operations ceph_super_ops = { |
2789 |
+ .drop_inode = ceph_drop_inode, |
2790 |
+ .sync_fs = ceph_sync_fs, |
2791 |
+ .put_super = ceph_put_super, |
2792 |
++ .remount_fs = ceph_remount, |
2793 |
+ .show_options = ceph_show_options, |
2794 |
+ .statfs = ceph_statfs, |
2795 |
+ .umount_begin = ceph_umount_begin, |
2796 |
+diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c |
2797 |
+index 2001184afe70..0ccf8f9b63a2 100644 |
2798 |
+--- a/fs/cifs/smb2ops.c |
2799 |
++++ b/fs/cifs/smb2ops.c |
2800 |
+@@ -2348,26 +2348,28 @@ smb21_set_oplock_level(struct cifsInodeInfo *cinode, __u32 oplock, |
2801 |
+ unsigned int epoch, bool *purge_cache) |
2802 |
+ { |
2803 |
+ char message[5] = {0}; |
2804 |
++ unsigned int new_oplock = 0; |
2805 |
+ |
2806 |
+ oplock &= 0xFF; |
2807 |
+ if (oplock == SMB2_OPLOCK_LEVEL_NOCHANGE) |
2808 |
+ return; |
2809 |
+ |
2810 |
+- cinode->oplock = 0; |
2811 |
+ if (oplock & SMB2_LEASE_READ_CACHING_HE) { |
2812 |
+- cinode->oplock |= CIFS_CACHE_READ_FLG; |
2813 |
++ new_oplock |= CIFS_CACHE_READ_FLG; |
2814 |
+ strcat(message, "R"); |
2815 |
+ } |
2816 |
+ if (oplock & SMB2_LEASE_HANDLE_CACHING_HE) { |
2817 |
+- cinode->oplock |= CIFS_CACHE_HANDLE_FLG; |
2818 |
++ new_oplock |= CIFS_CACHE_HANDLE_FLG; |
2819 |
+ strcat(message, "H"); |
2820 |
+ } |
2821 |
+ if (oplock & SMB2_LEASE_WRITE_CACHING_HE) { |
2822 |
+- cinode->oplock |= CIFS_CACHE_WRITE_FLG; |
2823 |
++ new_oplock |= CIFS_CACHE_WRITE_FLG; |
2824 |
+ strcat(message, "W"); |
2825 |
+ } |
2826 |
+- if (!cinode->oplock) |
2827 |
+- strcat(message, "None"); |
2828 |
++ if (!new_oplock) |
2829 |
++ strncpy(message, "None", sizeof(message)); |
2830 |
++ |
2831 |
++ cinode->oplock = new_oplock; |
2832 |
+ cifs_dbg(FYI, "%s Lease granted on inode %p\n", message, |
2833 |
+ &cinode->vfs_inode); |
2834 |
+ } |
2835 |
+diff --git a/fs/dcache.c b/fs/dcache.c |
2836 |
+index cb515f183482..6e0022326afe 100644 |
2837 |
+--- a/fs/dcache.c |
2838 |
++++ b/fs/dcache.c |
2839 |
+@@ -344,7 +344,7 @@ static void dentry_free(struct dentry *dentry) |
2840 |
+ } |
2841 |
+ } |
2842 |
+ /* if dentry was never visible to RCU, immediate free is OK */ |
2843 |
+- if (!(dentry->d_flags & DCACHE_RCUACCESS)) |
2844 |
++ if (dentry->d_flags & DCACHE_NORCU) |
2845 |
+ __d_free(&dentry->d_u.d_rcu); |
2846 |
+ else |
2847 |
+ call_rcu(&dentry->d_u.d_rcu, __d_free); |
2848 |
+@@ -1694,7 +1694,6 @@ struct dentry *d_alloc(struct dentry * parent, const struct qstr *name) |
2849 |
+ struct dentry *dentry = __d_alloc(parent->d_sb, name); |
2850 |
+ if (!dentry) |
2851 |
+ return NULL; |
2852 |
+- dentry->d_flags |= DCACHE_RCUACCESS; |
2853 |
+ spin_lock(&parent->d_lock); |
2854 |
+ /* |
2855 |
+ * don't need child lock because it is not subject |
2856 |
+@@ -1719,7 +1718,7 @@ struct dentry *d_alloc_cursor(struct dentry * parent) |
2857 |
+ { |
2858 |
+ struct dentry *dentry = d_alloc_anon(parent->d_sb); |
2859 |
+ if (dentry) { |
2860 |
+- dentry->d_flags |= DCACHE_RCUACCESS | DCACHE_DENTRY_CURSOR; |
2861 |
++ dentry->d_flags |= DCACHE_DENTRY_CURSOR; |
2862 |
+ dentry->d_parent = dget(parent); |
2863 |
+ } |
2864 |
+ return dentry; |
2865 |
+@@ -1732,10 +1731,17 @@ struct dentry *d_alloc_cursor(struct dentry * parent) |
2866 |
+ * |
2867 |
+ * For a filesystem that just pins its dentries in memory and never |
2868 |
+ * performs lookups at all, return an unhashed IS_ROOT dentry. |
2869 |
++ * This is used for pipes, sockets et.al. - the stuff that should |
2870 |
++ * never be anyone's children or parents. Unlike all other |
2871 |
++ * dentries, these will not have RCU delay between dropping the |
2872 |
++ * last reference and freeing them. |
2873 |
+ */ |
2874 |
+ struct dentry *d_alloc_pseudo(struct super_block *sb, const struct qstr *name) |
2875 |
+ { |
2876 |
+- return __d_alloc(sb, name); |
2877 |
++ struct dentry *dentry = __d_alloc(sb, name); |
2878 |
++ if (likely(dentry)) |
2879 |
++ dentry->d_flags |= DCACHE_NORCU; |
2880 |
++ return dentry; |
2881 |
+ } |
2882 |
+ EXPORT_SYMBOL(d_alloc_pseudo); |
2883 |
+ |
2884 |
+@@ -1899,12 +1905,10 @@ struct dentry *d_make_root(struct inode *root_inode) |
2885 |
+ |
2886 |
+ if (root_inode) { |
2887 |
+ res = d_alloc_anon(root_inode->i_sb); |
2888 |
+- if (res) { |
2889 |
+- res->d_flags |= DCACHE_RCUACCESS; |
2890 |
++ if (res) |
2891 |
+ d_instantiate(res, root_inode); |
2892 |
+- } else { |
2893 |
++ else |
2894 |
+ iput(root_inode); |
2895 |
+- } |
2896 |
+ } |
2897 |
+ return res; |
2898 |
+ } |
2899 |
+@@ -2769,9 +2773,7 @@ static void __d_move(struct dentry *dentry, struct dentry *target, |
2900 |
+ copy_name(dentry, target); |
2901 |
+ target->d_hash.pprev = NULL; |
2902 |
+ dentry->d_parent->d_lockref.count++; |
2903 |
+- if (dentry == old_parent) |
2904 |
+- dentry->d_flags |= DCACHE_RCUACCESS; |
2905 |
+- else |
2906 |
++ if (dentry != old_parent) /* wasn't IS_ROOT */ |
2907 |
+ WARN_ON(!--old_parent->d_lockref.count); |
2908 |
+ } else { |
2909 |
+ target->d_parent = old_parent; |
2910 |
+diff --git a/fs/fuse/file.c b/fs/fuse/file.c |
2911 |
+index bd500c3b7858..59e8bb72dc14 100644 |
2912 |
+--- a/fs/fuse/file.c |
2913 |
++++ b/fs/fuse/file.c |
2914 |
+@@ -179,7 +179,9 @@ void fuse_finish_open(struct inode *inode, struct file *file) |
2915 |
+ file->f_op = &fuse_direct_io_file_operations; |
2916 |
+ if (!(ff->open_flags & FOPEN_KEEP_CACHE)) |
2917 |
+ invalidate_inode_pages2(inode->i_mapping); |
2918 |
+- if (ff->open_flags & FOPEN_NONSEEKABLE) |
2919 |
++ if (ff->open_flags & FOPEN_STREAM) |
2920 |
++ stream_open(inode, file); |
2921 |
++ else if (ff->open_flags & FOPEN_NONSEEKABLE) |
2922 |
+ nonseekable_open(inode, file); |
2923 |
+ if (fc->atomic_o_trunc && (file->f_flags & O_TRUNC)) { |
2924 |
+ struct fuse_inode *fi = get_fuse_inode(inode); |
2925 |
+@@ -1526,7 +1528,7 @@ __acquires(fc->lock) |
2926 |
+ { |
2927 |
+ struct fuse_conn *fc = get_fuse_conn(inode); |
2928 |
+ struct fuse_inode *fi = get_fuse_inode(inode); |
2929 |
+- size_t crop = i_size_read(inode); |
2930 |
++ loff_t crop = i_size_read(inode); |
2931 |
+ struct fuse_req *req; |
2932 |
+ |
2933 |
+ while (fi->writectr >= 0 && !list_empty(&fi->queued_writes)) { |
2934 |
+@@ -2975,6 +2977,13 @@ static long fuse_file_fallocate(struct file *file, int mode, loff_t offset, |
2935 |
+ } |
2936 |
+ } |
2937 |
+ |
2938 |
++ if (!(mode & FALLOC_FL_KEEP_SIZE) && |
2939 |
++ offset + length > i_size_read(inode)) { |
2940 |
++ err = inode_newsize_ok(inode, offset + length); |
2941 |
++ if (err) |
2942 |
++ return err; |
2943 |
++ } |
2944 |
++ |
2945 |
+ if (!(mode & FALLOC_FL_KEEP_SIZE)) |
2946 |
+ set_bit(FUSE_I_SIZE_UNSTABLE, &fi->state); |
2947 |
+ |
2948 |
+diff --git a/fs/nfs/filelayout/filelayout.c b/fs/nfs/filelayout/filelayout.c |
2949 |
+index d175724ff566..2478a69da0f0 100644 |
2950 |
+--- a/fs/nfs/filelayout/filelayout.c |
2951 |
++++ b/fs/nfs/filelayout/filelayout.c |
2952 |
+@@ -904,7 +904,7 @@ fl_pnfs_update_layout(struct inode *ino, |
2953 |
+ status = filelayout_check_deviceid(lo, fl, gfp_flags); |
2954 |
+ if (status) { |
2955 |
+ pnfs_put_lseg(lseg); |
2956 |
+- lseg = ERR_PTR(status); |
2957 |
++ lseg = NULL; |
2958 |
+ } |
2959 |
+ out: |
2960 |
+ return lseg; |
2961 |
+diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c |
2962 |
+index d2f645d34eb1..3ba2087469ac 100644 |
2963 |
+--- a/fs/nfs/nfs4state.c |
2964 |
++++ b/fs/nfs/nfs4state.c |
2965 |
+@@ -159,6 +159,10 @@ int nfs40_discover_server_trunking(struct nfs_client *clp, |
2966 |
+ /* Sustain the lease, even if it's empty. If the clientid4 |
2967 |
+ * goes stale it's of no use for trunking discovery. */ |
2968 |
+ nfs4_schedule_state_renewal(*result); |
2969 |
++ |
2970 |
++ /* If the client state need to recover, do it. */ |
2971 |
++ if (clp->cl_state) |
2972 |
++ nfs4_schedule_state_manager(clp); |
2973 |
+ } |
2974 |
+ out: |
2975 |
+ return status; |
2976 |
+diff --git a/fs/nsfs.c b/fs/nsfs.c |
2977 |
+index 60702d677bd4..30d150a4f0c6 100644 |
2978 |
+--- a/fs/nsfs.c |
2979 |
++++ b/fs/nsfs.c |
2980 |
+@@ -85,13 +85,12 @@ slow: |
2981 |
+ inode->i_fop = &ns_file_operations; |
2982 |
+ inode->i_private = ns; |
2983 |
+ |
2984 |
+- dentry = d_alloc_pseudo(mnt->mnt_sb, &empty_name); |
2985 |
++ dentry = d_alloc_anon(mnt->mnt_sb); |
2986 |
+ if (!dentry) { |
2987 |
+ iput(inode); |
2988 |
+ return ERR_PTR(-ENOMEM); |
2989 |
+ } |
2990 |
+ d_instantiate(dentry, inode); |
2991 |
+- dentry->d_flags |= DCACHE_RCUACCESS; |
2992 |
+ dentry->d_fsdata = (void *)ns->ops; |
2993 |
+ d = atomic_long_cmpxchg(&ns->stashed, 0, (unsigned long)dentry); |
2994 |
+ if (d) { |
2995 |
+diff --git a/fs/overlayfs/copy_up.c b/fs/overlayfs/copy_up.c |
2996 |
+index 75eeee08d848..ffc73600216b 100644 |
2997 |
+--- a/fs/overlayfs/copy_up.c |
2998 |
++++ b/fs/overlayfs/copy_up.c |
2999 |
+@@ -878,14 +878,14 @@ static bool ovl_open_need_copy_up(struct dentry *dentry, int flags) |
3000 |
+ return true; |
3001 |
+ } |
3002 |
+ |
3003 |
+-int ovl_open_maybe_copy_up(struct dentry *dentry, unsigned int file_flags) |
3004 |
++int ovl_maybe_copy_up(struct dentry *dentry, int flags) |
3005 |
+ { |
3006 |
+ int err = 0; |
3007 |
+ |
3008 |
+- if (ovl_open_need_copy_up(dentry, file_flags)) { |
3009 |
++ if (ovl_open_need_copy_up(dentry, flags)) { |
3010 |
+ err = ovl_want_write(dentry); |
3011 |
+ if (!err) { |
3012 |
+- err = ovl_copy_up_flags(dentry, file_flags); |
3013 |
++ err = ovl_copy_up_flags(dentry, flags); |
3014 |
+ ovl_drop_write(dentry); |
3015 |
+ } |
3016 |
+ } |
3017 |
+diff --git a/fs/overlayfs/file.c b/fs/overlayfs/file.c |
3018 |
+index 986313da0c88..0c810f20f778 100644 |
3019 |
+--- a/fs/overlayfs/file.c |
3020 |
++++ b/fs/overlayfs/file.c |
3021 |
+@@ -116,11 +116,10 @@ static int ovl_real_fdget(const struct file *file, struct fd *real) |
3022 |
+ |
3023 |
+ static int ovl_open(struct inode *inode, struct file *file) |
3024 |
+ { |
3025 |
+- struct dentry *dentry = file_dentry(file); |
3026 |
+ struct file *realfile; |
3027 |
+ int err; |
3028 |
+ |
3029 |
+- err = ovl_open_maybe_copy_up(dentry, file->f_flags); |
3030 |
++ err = ovl_maybe_copy_up(file_dentry(file), file->f_flags); |
3031 |
+ if (err) |
3032 |
+ return err; |
3033 |
+ |
3034 |
+@@ -390,7 +389,7 @@ static long ovl_ioctl(struct file *file, unsigned int cmd, unsigned long arg) |
3035 |
+ if (ret) |
3036 |
+ return ret; |
3037 |
+ |
3038 |
+- ret = ovl_copy_up_with_data(file_dentry(file)); |
3039 |
++ ret = ovl_maybe_copy_up(file_dentry(file), O_WRONLY); |
3040 |
+ if (!ret) { |
3041 |
+ ret = ovl_real_ioctl(file, cmd, arg); |
3042 |
+ |
3043 |
+diff --git a/fs/overlayfs/overlayfs.h b/fs/overlayfs/overlayfs.h |
3044 |
+index d9c16ceebfe7..80fb66426760 100644 |
3045 |
+--- a/fs/overlayfs/overlayfs.h |
3046 |
++++ b/fs/overlayfs/overlayfs.h |
3047 |
+@@ -411,7 +411,7 @@ extern const struct file_operations ovl_file_operations; |
3048 |
+ int ovl_copy_up(struct dentry *dentry); |
3049 |
+ int ovl_copy_up_with_data(struct dentry *dentry); |
3050 |
+ int ovl_copy_up_flags(struct dentry *dentry, int flags); |
3051 |
+-int ovl_open_maybe_copy_up(struct dentry *dentry, unsigned int file_flags); |
3052 |
++int ovl_maybe_copy_up(struct dentry *dentry, int flags); |
3053 |
+ int ovl_copy_xattr(struct dentry *old, struct dentry *new); |
3054 |
+ int ovl_set_attr(struct dentry *upper, struct kstat *stat); |
3055 |
+ struct ovl_fh *ovl_encode_real_fh(struct dentry *real, bool is_upper); |
3056 |
+diff --git a/fs/proc/base.c b/fs/proc/base.c |
3057 |
+index 81d77b15b347..f999e8bd3771 100644 |
3058 |
+--- a/fs/proc/base.c |
3059 |
++++ b/fs/proc/base.c |
3060 |
+@@ -2542,6 +2542,11 @@ static ssize_t proc_pid_attr_write(struct file * file, const char __user * buf, |
3061 |
+ rcu_read_unlock(); |
3062 |
+ return -EACCES; |
3063 |
+ } |
3064 |
++ /* Prevent changes to overridden credentials. */ |
3065 |
++ if (current_cred() != current_real_cred()) { |
3066 |
++ rcu_read_unlock(); |
3067 |
++ return -EBUSY; |
3068 |
++ } |
3069 |
+ rcu_read_unlock(); |
3070 |
+ |
3071 |
+ if (count > PAGE_SIZE) |
3072 |
+diff --git a/fs/ufs/util.h b/fs/ufs/util.h |
3073 |
+index 1fd3011ea623..7fd4802222b8 100644 |
3074 |
+--- a/fs/ufs/util.h |
3075 |
++++ b/fs/ufs/util.h |
3076 |
+@@ -229,7 +229,7 @@ ufs_get_inode_gid(struct super_block *sb, struct ufs_inode *inode) |
3077 |
+ case UFS_UID_44BSD: |
3078 |
+ return fs32_to_cpu(sb, inode->ui_u3.ui_44.ui_gid); |
3079 |
+ case UFS_UID_EFT: |
3080 |
+- if (inode->ui_u1.oldids.ui_suid == 0xFFFF) |
3081 |
++ if (inode->ui_u1.oldids.ui_sgid == 0xFFFF) |
3082 |
+ return fs32_to_cpu(sb, inode->ui_u3.ui_sun.ui_gid); |
3083 |
+ /* Fall through */ |
3084 |
+ default: |
3085 |
+diff --git a/include/linux/bpf.h b/include/linux/bpf.h |
3086 |
+index 523481a3471b..16f6beef5cad 100644 |
3087 |
+--- a/include/linux/bpf.h |
3088 |
++++ b/include/linux/bpf.h |
3089 |
+@@ -34,6 +34,7 @@ struct bpf_map_ops { |
3090 |
+ void (*map_free)(struct bpf_map *map); |
3091 |
+ int (*map_get_next_key)(struct bpf_map *map, void *key, void *next_key); |
3092 |
+ void (*map_release_uref)(struct bpf_map *map); |
3093 |
++ void *(*map_lookup_elem_sys_only)(struct bpf_map *map, void *key); |
3094 |
+ |
3095 |
+ /* funcs callable from userspace and from eBPF programs */ |
3096 |
+ void *(*map_lookup_elem)(struct bpf_map *map, void *key); |
3097 |
+@@ -400,7 +401,7 @@ int bpf_prog_array_copy(struct bpf_prog_array __rcu *old_array, |
3098 |
+ } \ |
3099 |
+ _out: \ |
3100 |
+ rcu_read_unlock(); \ |
3101 |
+- preempt_enable_no_resched(); \ |
3102 |
++ preempt_enable(); \ |
3103 |
+ _ret; \ |
3104 |
+ }) |
3105 |
+ |
3106 |
+diff --git a/include/linux/dcache.h b/include/linux/dcache.h |
3107 |
+index ef4b70f64f33..0880baefd85f 100644 |
3108 |
+--- a/include/linux/dcache.h |
3109 |
++++ b/include/linux/dcache.h |
3110 |
+@@ -175,7 +175,6 @@ struct dentry_operations { |
3111 |
+ * typically using d_splice_alias. */ |
3112 |
+ |
3113 |
+ #define DCACHE_REFERENCED 0x00000040 /* Recently used, don't discard. */ |
3114 |
+-#define DCACHE_RCUACCESS 0x00000080 /* Entry has ever been RCU-visible */ |
3115 |
+ |
3116 |
+ #define DCACHE_CANT_MOUNT 0x00000100 |
3117 |
+ #define DCACHE_GENOCIDE 0x00000200 |
3118 |
+@@ -216,6 +215,7 @@ struct dentry_operations { |
3119 |
+ |
3120 |
+ #define DCACHE_PAR_LOOKUP 0x10000000 /* being looked up (with parent locked shared) */ |
3121 |
+ #define DCACHE_DENTRY_CURSOR 0x20000000 |
3122 |
++#define DCACHE_NORCU 0x40000000 /* No RCU delay for freeing */ |
3123 |
+ |
3124 |
+ extern seqlock_t rename_lock; |
3125 |
+ |
3126 |
+diff --git a/include/linux/of.h b/include/linux/of.h |
3127 |
+index 40e58b0e9cf4..f2c80cc4641d 100644 |
3128 |
+--- a/include/linux/of.h |
3129 |
++++ b/include/linux/of.h |
3130 |
+@@ -236,8 +236,8 @@ extern struct device_node *of_find_all_nodes(struct device_node *prev); |
3131 |
+ static inline u64 of_read_number(const __be32 *cell, int size) |
3132 |
+ { |
3133 |
+ u64 r = 0; |
3134 |
+- while (size--) |
3135 |
+- r = (r << 32) | be32_to_cpu(*(cell++)); |
3136 |
++ for (; size--; cell++) |
3137 |
++ r = (r << 32) | be32_to_cpu(*cell); |
3138 |
+ return r; |
3139 |
+ } |
3140 |
+ |
3141 |
+diff --git a/include/linux/pci.h b/include/linux/pci.h |
3142 |
+index 6925828f9f25..b1f297f4b7b0 100644 |
3143 |
+--- a/include/linux/pci.h |
3144 |
++++ b/include/linux/pci.h |
3145 |
+@@ -346,6 +346,8 @@ struct pci_dev { |
3146 |
+ unsigned int hotplug_user_indicators:1; /* SlotCtl indicators |
3147 |
+ controlled exclusively by |
3148 |
+ user sysfs */ |
3149 |
++ unsigned int clear_retrain_link:1; /* Need to clear Retrain Link |
3150 |
++ bit manually */ |
3151 |
+ unsigned int d3_delay; /* D3->D0 transition time in ms */ |
3152 |
+ unsigned int d3cold_delay; /* D3cold->D0 transition time in ms */ |
3153 |
+ |
3154 |
+diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h |
3155 |
+index 820903ceac4f..28baccb1efd5 100644 |
3156 |
+--- a/include/linux/skbuff.h |
3157 |
++++ b/include/linux/skbuff.h |
3158 |
+@@ -1333,10 +1333,12 @@ static inline void skb_zcopy_clear(struct sk_buff *skb, bool zerocopy) |
3159 |
+ struct ubuf_info *uarg = skb_zcopy(skb); |
3160 |
+ |
3161 |
+ if (uarg) { |
3162 |
+- if (uarg->callback == sock_zerocopy_callback) { |
3163 |
++ if (skb_zcopy_is_nouarg(skb)) { |
3164 |
++ /* no notification callback */ |
3165 |
++ } else if (uarg->callback == sock_zerocopy_callback) { |
3166 |
+ uarg->zerocopy = uarg->zerocopy && zerocopy; |
3167 |
+ sock_zerocopy_put(uarg); |
3168 |
+- } else if (!skb_zcopy_is_nouarg(skb)) { |
3169 |
++ } else { |
3170 |
+ uarg->callback(uarg, zerocopy); |
3171 |
+ } |
3172 |
+ |
3173 |
+@@ -2587,7 +2589,8 @@ static inline int skb_orphan_frags(struct sk_buff *skb, gfp_t gfp_mask) |
3174 |
+ { |
3175 |
+ if (likely(!skb_zcopy(skb))) |
3176 |
+ return 0; |
3177 |
+- if (skb_uarg(skb)->callback == sock_zerocopy_callback) |
3178 |
++ if (!skb_zcopy_is_nouarg(skb) && |
3179 |
++ skb_uarg(skb)->callback == sock_zerocopy_callback) |
3180 |
+ return 0; |
3181 |
+ return skb_copy_ubufs(skb, gfp_mask); |
3182 |
+ } |
3183 |
+diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h |
3184 |
+index 2d31e22babd8..983f7a1a3f1d 100644 |
3185 |
+--- a/include/net/ip6_fib.h |
3186 |
++++ b/include/net/ip6_fib.h |
3187 |
+@@ -171,7 +171,8 @@ struct fib6_info { |
3188 |
+ dst_nocount:1, |
3189 |
+ dst_nopolicy:1, |
3190 |
+ dst_host:1, |
3191 |
+- unused:3; |
3192 |
++ fib6_destroying:1, |
3193 |
++ unused:2; |
3194 |
+ |
3195 |
+ struct fib6_nh fib6_nh; |
3196 |
+ struct rcu_head rcu; |
3197 |
+diff --git a/include/net/xfrm.h b/include/net/xfrm.h |
3198 |
+index 5e3daf53b3d1..4ddd2b13ac8d 100644 |
3199 |
+--- a/include/net/xfrm.h |
3200 |
++++ b/include/net/xfrm.h |
3201 |
+@@ -295,7 +295,8 @@ struct xfrm_replay { |
3202 |
+ }; |
3203 |
+ |
3204 |
+ struct xfrm_if_cb { |
3205 |
+- struct xfrm_if *(*decode_session)(struct sk_buff *skb); |
3206 |
++ struct xfrm_if *(*decode_session)(struct sk_buff *skb, |
3207 |
++ unsigned short family); |
3208 |
+ }; |
3209 |
+ |
3210 |
+ void xfrm_if_register_cb(const struct xfrm_if_cb *ifcb); |
3211 |
+@@ -1430,6 +1431,23 @@ static inline int xfrm_state_kern(const struct xfrm_state *x) |
3212 |
+ return atomic_read(&x->tunnel_users); |
3213 |
+ } |
3214 |
+ |
3215 |
++static inline bool xfrm_id_proto_valid(u8 proto) |
3216 |
++{ |
3217 |
++ switch (proto) { |
3218 |
++ case IPPROTO_AH: |
3219 |
++ case IPPROTO_ESP: |
3220 |
++ case IPPROTO_COMP: |
3221 |
++#if IS_ENABLED(CONFIG_IPV6) |
3222 |
++ case IPPROTO_ROUTING: |
3223 |
++ case IPPROTO_DSTOPTS: |
3224 |
++#endif |
3225 |
++ return true; |
3226 |
++ default: |
3227 |
++ return false; |
3228 |
++ } |
3229 |
++} |
3230 |
++ |
3231 |
++/* IPSEC_PROTO_ANY only matches 3 IPsec protocols, 0 could match all. */ |
3232 |
+ static inline int xfrm_id_proto_match(u8 proto, u8 userproto) |
3233 |
+ { |
3234 |
+ return (!userproto || proto == userproto || |
3235 |
+diff --git a/include/uapi/linux/fuse.h b/include/uapi/linux/fuse.h |
3236 |
+index 92fa24c24c92..2170e58a2a97 100644 |
3237 |
+--- a/include/uapi/linux/fuse.h |
3238 |
++++ b/include/uapi/linux/fuse.h |
3239 |
+@@ -219,10 +219,12 @@ struct fuse_file_lock { |
3240 |
+ * FOPEN_DIRECT_IO: bypass page cache for this open file |
3241 |
+ * FOPEN_KEEP_CACHE: don't invalidate the data cache on open |
3242 |
+ * FOPEN_NONSEEKABLE: the file is not seekable |
3243 |
++ * FOPEN_STREAM: the file is stream-like (no file position at all) |
3244 |
+ */ |
3245 |
+ #define FOPEN_DIRECT_IO (1 << 0) |
3246 |
+ #define FOPEN_KEEP_CACHE (1 << 1) |
3247 |
+ #define FOPEN_NONSEEKABLE (1 << 2) |
3248 |
++#define FOPEN_STREAM (1 << 4) |
3249 |
+ |
3250 |
+ /** |
3251 |
+ * INIT request/reply flags |
3252 |
+diff --git a/include/video/udlfb.h b/include/video/udlfb.h |
3253 |
+index 7d09e54ae54e..58fb5732831a 100644 |
3254 |
+--- a/include/video/udlfb.h |
3255 |
++++ b/include/video/udlfb.h |
3256 |
+@@ -48,6 +48,13 @@ struct dlfb_data { |
3257 |
+ int base8; |
3258 |
+ u32 pseudo_palette[256]; |
3259 |
+ int blank_mode; /*one of FB_BLANK_ */ |
3260 |
++ struct mutex render_mutex; |
3261 |
++ int damage_x; |
3262 |
++ int damage_y; |
3263 |
++ int damage_x2; |
3264 |
++ int damage_y2; |
3265 |
++ spinlock_t damage_lock; |
3266 |
++ struct work_struct damage_work; |
3267 |
+ struct fb_ops ops; |
3268 |
+ /* blit-only rendering path metrics, exposed through sysfs */ |
3269 |
+ atomic_t bytes_rendered; /* raw pixel-bytes driver asked to render */ |
3270 |
+diff --git a/kernel/bpf/hashtab.c b/kernel/bpf/hashtab.c |
3271 |
+index cebadd6af4d9..6fe72792312d 100644 |
3272 |
+--- a/kernel/bpf/hashtab.c |
3273 |
++++ b/kernel/bpf/hashtab.c |
3274 |
+@@ -518,18 +518,30 @@ static u32 htab_map_gen_lookup(struct bpf_map *map, struct bpf_insn *insn_buf) |
3275 |
+ return insn - insn_buf; |
3276 |
+ } |
3277 |
+ |
3278 |
+-static void *htab_lru_map_lookup_elem(struct bpf_map *map, void *key) |
3279 |
++static __always_inline void *__htab_lru_map_lookup_elem(struct bpf_map *map, |
3280 |
++ void *key, const bool mark) |
3281 |
+ { |
3282 |
+ struct htab_elem *l = __htab_map_lookup_elem(map, key); |
3283 |
+ |
3284 |
+ if (l) { |
3285 |
+- bpf_lru_node_set_ref(&l->lru_node); |
3286 |
++ if (mark) |
3287 |
++ bpf_lru_node_set_ref(&l->lru_node); |
3288 |
+ return l->key + round_up(map->key_size, 8); |
3289 |
+ } |
3290 |
+ |
3291 |
+ return NULL; |
3292 |
+ } |
3293 |
+ |
3294 |
++static void *htab_lru_map_lookup_elem(struct bpf_map *map, void *key) |
3295 |
++{ |
3296 |
++ return __htab_lru_map_lookup_elem(map, key, true); |
3297 |
++} |
3298 |
++ |
3299 |
++static void *htab_lru_map_lookup_elem_sys(struct bpf_map *map, void *key) |
3300 |
++{ |
3301 |
++ return __htab_lru_map_lookup_elem(map, key, false); |
3302 |
++} |
3303 |
++ |
3304 |
+ static u32 htab_lru_map_gen_lookup(struct bpf_map *map, |
3305 |
+ struct bpf_insn *insn_buf) |
3306 |
+ { |
3307 |
+@@ -1206,6 +1218,7 @@ const struct bpf_map_ops htab_lru_map_ops = { |
3308 |
+ .map_free = htab_map_free, |
3309 |
+ .map_get_next_key = htab_map_get_next_key, |
3310 |
+ .map_lookup_elem = htab_lru_map_lookup_elem, |
3311 |
++ .map_lookup_elem_sys_only = htab_lru_map_lookup_elem_sys, |
3312 |
+ .map_update_elem = htab_lru_map_update_elem, |
3313 |
+ .map_delete_elem = htab_lru_map_delete_elem, |
3314 |
+ .map_gen_lookup = htab_lru_map_gen_lookup, |
3315 |
+@@ -1237,7 +1250,6 @@ static void *htab_lru_percpu_map_lookup_elem(struct bpf_map *map, void *key) |
3316 |
+ |
3317 |
+ int bpf_percpu_hash_copy(struct bpf_map *map, void *key, void *value) |
3318 |
+ { |
3319 |
+- struct bpf_htab *htab = container_of(map, struct bpf_htab, map); |
3320 |
+ struct htab_elem *l; |
3321 |
+ void __percpu *pptr; |
3322 |
+ int ret = -ENOENT; |
3323 |
+@@ -1253,8 +1265,9 @@ int bpf_percpu_hash_copy(struct bpf_map *map, void *key, void *value) |
3324 |
+ l = __htab_map_lookup_elem(map, key); |
3325 |
+ if (!l) |
3326 |
+ goto out; |
3327 |
+- if (htab_is_lru(htab)) |
3328 |
+- bpf_lru_node_set_ref(&l->lru_node); |
3329 |
++ /* We do not mark LRU map element here in order to not mess up |
3330 |
++ * eviction heuristics when user space does a map walk. |
3331 |
++ */ |
3332 |
+ pptr = htab_elem_get_ptr(l, map->key_size); |
3333 |
+ for_each_possible_cpu(cpu) { |
3334 |
+ bpf_long_memcpy(value + off, |
3335 |
+diff --git a/kernel/bpf/inode.c b/kernel/bpf/inode.c |
3336 |
+index 4a8f390a2b82..dc9d7ac8228d 100644 |
3337 |
+--- a/kernel/bpf/inode.c |
3338 |
++++ b/kernel/bpf/inode.c |
3339 |
+@@ -518,7 +518,7 @@ out: |
3340 |
+ static struct bpf_prog *__get_prog_inode(struct inode *inode, enum bpf_prog_type type) |
3341 |
+ { |
3342 |
+ struct bpf_prog *prog; |
3343 |
+- int ret = inode_permission(inode, MAY_READ | MAY_WRITE); |
3344 |
++ int ret = inode_permission(inode, MAY_READ); |
3345 |
+ if (ret) |
3346 |
+ return ERR_PTR(ret); |
3347 |
+ |
3348 |
+diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c |
3349 |
+index cc40b8be1171..ede82382dd32 100644 |
3350 |
+--- a/kernel/bpf/syscall.c |
3351 |
++++ b/kernel/bpf/syscall.c |
3352 |
+@@ -721,7 +721,10 @@ static int map_lookup_elem(union bpf_attr *attr) |
3353 |
+ err = bpf_fd_reuseport_array_lookup_elem(map, key, value); |
3354 |
+ } else { |
3355 |
+ rcu_read_lock(); |
3356 |
+- ptr = map->ops->map_lookup_elem(map, key); |
3357 |
++ if (map->ops->map_lookup_elem_sys_only) |
3358 |
++ ptr = map->ops->map_lookup_elem_sys_only(map, key); |
3359 |
++ else |
3360 |
++ ptr = map->ops->map_lookup_elem(map, key); |
3361 |
+ if (ptr) |
3362 |
+ memcpy(value, ptr, value_size); |
3363 |
+ rcu_read_unlock(); |
3364 |
+diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c |
3365 |
+index 217f81ecae17..4e3625109b28 100644 |
3366 |
+--- a/kernel/sched/cpufreq_schedutil.c |
3367 |
++++ b/kernel/sched/cpufreq_schedutil.c |
3368 |
+@@ -751,6 +751,7 @@ out: |
3369 |
+ return 0; |
3370 |
+ |
3371 |
+ fail: |
3372 |
++ kobject_put(&tunables->attr_set.kobj); |
3373 |
+ policy->governor_data = NULL; |
3374 |
+ sugov_tunables_free(tunables); |
3375 |
+ |
3376 |
+diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c |
3377 |
+index f94be0c2827b..7345f5f8f3fe 100644 |
3378 |
+--- a/kernel/trace/trace_events.c |
3379 |
++++ b/kernel/trace/trace_events.c |
3380 |
+@@ -1318,9 +1318,6 @@ event_id_read(struct file *filp, char __user *ubuf, size_t cnt, loff_t *ppos) |
3381 |
+ char buf[32]; |
3382 |
+ int len; |
3383 |
+ |
3384 |
+- if (*ppos) |
3385 |
+- return 0; |
3386 |
+- |
3387 |
+ if (unlikely(!id)) |
3388 |
+ return -ENODEV; |
3389 |
+ |
3390 |
+diff --git a/lib/Makefile b/lib/Makefile |
3391 |
+index 423876446810..0ab808318202 100644 |
3392 |
+--- a/lib/Makefile |
3393 |
++++ b/lib/Makefile |
3394 |
+@@ -17,6 +17,17 @@ KCOV_INSTRUMENT_list_debug.o := n |
3395 |
+ KCOV_INSTRUMENT_debugobjects.o := n |
3396 |
+ KCOV_INSTRUMENT_dynamic_debug.o := n |
3397 |
+ |
3398 |
++# Early boot use of cmdline, don't instrument it |
3399 |
++ifdef CONFIG_AMD_MEM_ENCRYPT |
3400 |
++KASAN_SANITIZE_string.o := n |
3401 |
++ |
3402 |
++ifdef CONFIG_FUNCTION_TRACER |
3403 |
++CFLAGS_REMOVE_string.o = -pg |
3404 |
++endif |
3405 |
++ |
3406 |
++CFLAGS_string.o := $(call cc-option, -fno-stack-protector) |
3407 |
++endif |
3408 |
++ |
3409 |
+ lib-y := ctype.o string.o vsprintf.o cmdline.o \ |
3410 |
+ rbtree.o radix-tree.o timerqueue.o\ |
3411 |
+ idr.o int_sqrt.o extable.o \ |
3412 |
+diff --git a/net/core/dev.c b/net/core/dev.c |
3413 |
+index 3bcec116a5f2..13a82744a00a 100644 |
3414 |
+--- a/net/core/dev.c |
3415 |
++++ b/net/core/dev.c |
3416 |
+@@ -8716,7 +8716,7 @@ static void netdev_wait_allrefs(struct net_device *dev) |
3417 |
+ |
3418 |
+ refcnt = netdev_refcnt_read(dev); |
3419 |
+ |
3420 |
+- if (time_after(jiffies, warning_time + 10 * HZ)) { |
3421 |
++ if (refcnt && time_after(jiffies, warning_time + 10 * HZ)) { |
3422 |
+ pr_emerg("unregister_netdevice: waiting for %s to become free. Usage count = %d\n", |
3423 |
+ dev->name, refcnt); |
3424 |
+ warning_time = jiffies; |
3425 |
+diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c |
3426 |
+index ebde98b565e9..3932eed379a4 100644 |
3427 |
+--- a/net/core/rtnetlink.c |
3428 |
++++ b/net/core/rtnetlink.c |
3429 |
+@@ -1496,14 +1496,15 @@ static int put_master_ifindex(struct sk_buff *skb, struct net_device *dev) |
3430 |
+ return ret; |
3431 |
+ } |
3432 |
+ |
3433 |
+-static int nla_put_iflink(struct sk_buff *skb, const struct net_device *dev) |
3434 |
++static int nla_put_iflink(struct sk_buff *skb, const struct net_device *dev, |
3435 |
++ bool force) |
3436 |
+ { |
3437 |
+ int ifindex = dev_get_iflink(dev); |
3438 |
+ |
3439 |
+- if (dev->ifindex == ifindex) |
3440 |
+- return 0; |
3441 |
++ if (force || dev->ifindex != ifindex) |
3442 |
++ return nla_put_u32(skb, IFLA_LINK, ifindex); |
3443 |
+ |
3444 |
+- return nla_put_u32(skb, IFLA_LINK, ifindex); |
3445 |
++ return 0; |
3446 |
+ } |
3447 |
+ |
3448 |
+ static noinline_for_stack int nla_put_ifalias(struct sk_buff *skb, |
3449 |
+@@ -1520,6 +1521,8 @@ static int rtnl_fill_link_netnsid(struct sk_buff *skb, |
3450 |
+ const struct net_device *dev, |
3451 |
+ struct net *src_net) |
3452 |
+ { |
3453 |
++ bool put_iflink = false; |
3454 |
++ |
3455 |
+ if (dev->rtnl_link_ops && dev->rtnl_link_ops->get_link_net) { |
3456 |
+ struct net *link_net = dev->rtnl_link_ops->get_link_net(dev); |
3457 |
+ |
3458 |
+@@ -1528,10 +1531,12 @@ static int rtnl_fill_link_netnsid(struct sk_buff *skb, |
3459 |
+ |
3460 |
+ if (nla_put_s32(skb, IFLA_LINK_NETNSID, id)) |
3461 |
+ return -EMSGSIZE; |
3462 |
++ |
3463 |
++ put_iflink = true; |
3464 |
+ } |
3465 |
+ } |
3466 |
+ |
3467 |
+- return 0; |
3468 |
++ return nla_put_iflink(skb, dev, put_iflink); |
3469 |
+ } |
3470 |
+ |
3471 |
+ static int rtnl_fill_link_af(struct sk_buff *skb, |
3472 |
+@@ -1617,7 +1622,6 @@ static int rtnl_fill_ifinfo(struct sk_buff *skb, |
3473 |
+ #ifdef CONFIG_RPS |
3474 |
+ nla_put_u32(skb, IFLA_NUM_RX_QUEUES, dev->num_rx_queues) || |
3475 |
+ #endif |
3476 |
+- nla_put_iflink(skb, dev) || |
3477 |
+ put_master_ifindex(skb, dev) || |
3478 |
+ nla_put_u8(skb, IFLA_CARRIER, netif_carrier_ok(dev)) || |
3479 |
+ (dev->qdisc && |
3480 |
+diff --git a/net/ipv4/esp4.c b/net/ipv4/esp4.c |
3481 |
+index 12a43a5369a5..114f9def1ec5 100644 |
3482 |
+--- a/net/ipv4/esp4.c |
3483 |
++++ b/net/ipv4/esp4.c |
3484 |
+@@ -223,7 +223,7 @@ static void esp_output_fill_trailer(u8 *tail, int tfclen, int plen, __u8 proto) |
3485 |
+ tail[plen - 1] = proto; |
3486 |
+ } |
3487 |
+ |
3488 |
+-static void esp_output_udp_encap(struct xfrm_state *x, struct sk_buff *skb, struct esp_info *esp) |
3489 |
++static int esp_output_udp_encap(struct xfrm_state *x, struct sk_buff *skb, struct esp_info *esp) |
3490 |
+ { |
3491 |
+ int encap_type; |
3492 |
+ struct udphdr *uh; |
3493 |
+@@ -231,6 +231,7 @@ static void esp_output_udp_encap(struct xfrm_state *x, struct sk_buff *skb, stru |
3494 |
+ __be16 sport, dport; |
3495 |
+ struct xfrm_encap_tmpl *encap = x->encap; |
3496 |
+ struct ip_esp_hdr *esph = esp->esph; |
3497 |
++ unsigned int len; |
3498 |
+ |
3499 |
+ spin_lock_bh(&x->lock); |
3500 |
+ sport = encap->encap_sport; |
3501 |
+@@ -238,11 +239,14 @@ static void esp_output_udp_encap(struct xfrm_state *x, struct sk_buff *skb, stru |
3502 |
+ encap_type = encap->encap_type; |
3503 |
+ spin_unlock_bh(&x->lock); |
3504 |
+ |
3505 |
++ len = skb->len + esp->tailen - skb_transport_offset(skb); |
3506 |
++ if (len + sizeof(struct iphdr) >= IP_MAX_MTU) |
3507 |
++ return -EMSGSIZE; |
3508 |
++ |
3509 |
+ uh = (struct udphdr *)esph; |
3510 |
+ uh->source = sport; |
3511 |
+ uh->dest = dport; |
3512 |
+- uh->len = htons(skb->len + esp->tailen |
3513 |
+- - skb_transport_offset(skb)); |
3514 |
++ uh->len = htons(len); |
3515 |
+ uh->check = 0; |
3516 |
+ |
3517 |
+ switch (encap_type) { |
3518 |
+@@ -259,6 +263,8 @@ static void esp_output_udp_encap(struct xfrm_state *x, struct sk_buff *skb, stru |
3519 |
+ |
3520 |
+ *skb_mac_header(skb) = IPPROTO_UDP; |
3521 |
+ esp->esph = esph; |
3522 |
++ |
3523 |
++ return 0; |
3524 |
+ } |
3525 |
+ |
3526 |
+ int esp_output_head(struct xfrm_state *x, struct sk_buff *skb, struct esp_info *esp) |
3527 |
+@@ -272,8 +278,12 @@ int esp_output_head(struct xfrm_state *x, struct sk_buff *skb, struct esp_info * |
3528 |
+ int tailen = esp->tailen; |
3529 |
+ |
3530 |
+ /* this is non-NULL only with UDP Encapsulation */ |
3531 |
+- if (x->encap) |
3532 |
+- esp_output_udp_encap(x, skb, esp); |
3533 |
++ if (x->encap) { |
3534 |
++ int err = esp_output_udp_encap(x, skb, esp); |
3535 |
++ |
3536 |
++ if (err < 0) |
3537 |
++ return err; |
3538 |
++ } |
3539 |
+ |
3540 |
+ if (!skb_cloned(skb)) { |
3541 |
+ if (tailen <= skb_tailroom(skb)) { |
3542 |
+diff --git a/net/ipv4/ip_vti.c b/net/ipv4/ip_vti.c |
3543 |
+index 40a7cd56e008..808f8d15c519 100644 |
3544 |
+--- a/net/ipv4/ip_vti.c |
3545 |
++++ b/net/ipv4/ip_vti.c |
3546 |
+@@ -659,9 +659,9 @@ static int __init vti_init(void) |
3547 |
+ return err; |
3548 |
+ |
3549 |
+ rtnl_link_failed: |
3550 |
+- xfrm4_protocol_deregister(&vti_ipcomp4_protocol, IPPROTO_COMP); |
3551 |
+-xfrm_tunnel_failed: |
3552 |
+ xfrm4_tunnel_deregister(&ipip_handler, AF_INET); |
3553 |
++xfrm_tunnel_failed: |
3554 |
++ xfrm4_protocol_deregister(&vti_ipcomp4_protocol, IPPROTO_COMP); |
3555 |
+ xfrm_proto_comp_failed: |
3556 |
+ xfrm4_protocol_deregister(&vti_ah4_protocol, IPPROTO_AH); |
3557 |
+ xfrm_proto_ah_failed: |
3558 |
+@@ -676,6 +676,7 @@ pernet_dev_failed: |
3559 |
+ static void __exit vti_fini(void) |
3560 |
+ { |
3561 |
+ rtnl_link_unregister(&vti_link_ops); |
3562 |
++ xfrm4_tunnel_deregister(&ipip_handler, AF_INET); |
3563 |
+ xfrm4_protocol_deregister(&vti_ipcomp4_protocol, IPPROTO_COMP); |
3564 |
+ xfrm4_protocol_deregister(&vti_ah4_protocol, IPPROTO_AH); |
3565 |
+ xfrm4_protocol_deregister(&vti_esp4_protocol, IPPROTO_ESP); |
3566 |
+diff --git a/net/ipv4/xfrm4_policy.c b/net/ipv4/xfrm4_policy.c |
3567 |
+index d73a6d6652f6..2b144b92ae46 100644 |
3568 |
+--- a/net/ipv4/xfrm4_policy.c |
3569 |
++++ b/net/ipv4/xfrm4_policy.c |
3570 |
+@@ -111,7 +111,8 @@ static void |
3571 |
+ _decode_session4(struct sk_buff *skb, struct flowi *fl, int reverse) |
3572 |
+ { |
3573 |
+ const struct iphdr *iph = ip_hdr(skb); |
3574 |
+- u8 *xprth = skb_network_header(skb) + iph->ihl * 4; |
3575 |
++ int ihl = iph->ihl; |
3576 |
++ u8 *xprth = skb_network_header(skb) + ihl * 4; |
3577 |
+ struct flowi4 *fl4 = &fl->u.ip4; |
3578 |
+ int oif = 0; |
3579 |
+ |
3580 |
+@@ -122,6 +123,11 @@ _decode_session4(struct sk_buff *skb, struct flowi *fl, int reverse) |
3581 |
+ fl4->flowi4_mark = skb->mark; |
3582 |
+ fl4->flowi4_oif = reverse ? skb->skb_iif : oif; |
3583 |
+ |
3584 |
++ fl4->flowi4_proto = iph->protocol; |
3585 |
++ fl4->daddr = reverse ? iph->saddr : iph->daddr; |
3586 |
++ fl4->saddr = reverse ? iph->daddr : iph->saddr; |
3587 |
++ fl4->flowi4_tos = iph->tos; |
3588 |
++ |
3589 |
+ if (!ip_is_fragment(iph)) { |
3590 |
+ switch (iph->protocol) { |
3591 |
+ case IPPROTO_UDP: |
3592 |
+@@ -133,7 +139,7 @@ _decode_session4(struct sk_buff *skb, struct flowi *fl, int reverse) |
3593 |
+ pskb_may_pull(skb, xprth + 4 - skb->data)) { |
3594 |
+ __be16 *ports; |
3595 |
+ |
3596 |
+- xprth = skb_network_header(skb) + iph->ihl * 4; |
3597 |
++ xprth = skb_network_header(skb) + ihl * 4; |
3598 |
+ ports = (__be16 *)xprth; |
3599 |
+ |
3600 |
+ fl4->fl4_sport = ports[!!reverse]; |
3601 |
+@@ -146,7 +152,7 @@ _decode_session4(struct sk_buff *skb, struct flowi *fl, int reverse) |
3602 |
+ pskb_may_pull(skb, xprth + 2 - skb->data)) { |
3603 |
+ u8 *icmp; |
3604 |
+ |
3605 |
+- xprth = skb_network_header(skb) + iph->ihl * 4; |
3606 |
++ xprth = skb_network_header(skb) + ihl * 4; |
3607 |
+ icmp = xprth; |
3608 |
+ |
3609 |
+ fl4->fl4_icmp_type = icmp[0]; |
3610 |
+@@ -159,7 +165,7 @@ _decode_session4(struct sk_buff *skb, struct flowi *fl, int reverse) |
3611 |
+ pskb_may_pull(skb, xprth + 4 - skb->data)) { |
3612 |
+ __be32 *ehdr; |
3613 |
+ |
3614 |
+- xprth = skb_network_header(skb) + iph->ihl * 4; |
3615 |
++ xprth = skb_network_header(skb) + ihl * 4; |
3616 |
+ ehdr = (__be32 *)xprth; |
3617 |
+ |
3618 |
+ fl4->fl4_ipsec_spi = ehdr[0]; |
3619 |
+@@ -171,7 +177,7 @@ _decode_session4(struct sk_buff *skb, struct flowi *fl, int reverse) |
3620 |
+ pskb_may_pull(skb, xprth + 8 - skb->data)) { |
3621 |
+ __be32 *ah_hdr; |
3622 |
+ |
3623 |
+- xprth = skb_network_header(skb) + iph->ihl * 4; |
3624 |
++ xprth = skb_network_header(skb) + ihl * 4; |
3625 |
+ ah_hdr = (__be32 *)xprth; |
3626 |
+ |
3627 |
+ fl4->fl4_ipsec_spi = ah_hdr[1]; |
3628 |
+@@ -183,7 +189,7 @@ _decode_session4(struct sk_buff *skb, struct flowi *fl, int reverse) |
3629 |
+ pskb_may_pull(skb, xprth + 4 - skb->data)) { |
3630 |
+ __be16 *ipcomp_hdr; |
3631 |
+ |
3632 |
+- xprth = skb_network_header(skb) + iph->ihl * 4; |
3633 |
++ xprth = skb_network_header(skb) + ihl * 4; |
3634 |
+ ipcomp_hdr = (__be16 *)xprth; |
3635 |
+ |
3636 |
+ fl4->fl4_ipsec_spi = htonl(ntohs(ipcomp_hdr[1])); |
3637 |
+@@ -196,7 +202,7 @@ _decode_session4(struct sk_buff *skb, struct flowi *fl, int reverse) |
3638 |
+ __be16 *greflags; |
3639 |
+ __be32 *gre_hdr; |
3640 |
+ |
3641 |
+- xprth = skb_network_header(skb) + iph->ihl * 4; |
3642 |
++ xprth = skb_network_header(skb) + ihl * 4; |
3643 |
+ greflags = (__be16 *)xprth; |
3644 |
+ gre_hdr = (__be32 *)xprth; |
3645 |
+ |
3646 |
+@@ -213,10 +219,6 @@ _decode_session4(struct sk_buff *skb, struct flowi *fl, int reverse) |
3647 |
+ break; |
3648 |
+ } |
3649 |
+ } |
3650 |
+- fl4->flowi4_proto = iph->protocol; |
3651 |
+- fl4->daddr = reverse ? iph->saddr : iph->daddr; |
3652 |
+- fl4->saddr = reverse ? iph->daddr : iph->saddr; |
3653 |
+- fl4->flowi4_tos = iph->tos; |
3654 |
+ } |
3655 |
+ |
3656 |
+ static void xfrm4_update_pmtu(struct dst_entry *dst, struct sock *sk, |
3657 |
+diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c |
3658 |
+index 3e2a9bd3459c..a6c0479c1d55 100644 |
3659 |
+--- a/net/ipv6/ip6_fib.c |
3660 |
++++ b/net/ipv6/ip6_fib.c |
3661 |
+@@ -877,6 +877,12 @@ static void fib6_drop_pcpu_from(struct fib6_info *f6i, |
3662 |
+ { |
3663 |
+ int cpu; |
3664 |
+ |
3665 |
++ /* Make sure rt6_make_pcpu_route() wont add other percpu routes |
3666 |
++ * while we are cleaning them here. |
3667 |
++ */ |
3668 |
++ f6i->fib6_destroying = 1; |
3669 |
++ mb(); /* paired with the cmpxchg() in rt6_make_pcpu_route() */ |
3670 |
++ |
3671 |
+ /* release the reference to this fib entry from |
3672 |
+ * all of its cached pcpu routes |
3673 |
+ */ |
3674 |
+@@ -900,6 +906,9 @@ static void fib6_purge_rt(struct fib6_info *rt, struct fib6_node *fn, |
3675 |
+ { |
3676 |
+ struct fib6_table *table = rt->fib6_table; |
3677 |
+ |
3678 |
++ if (rt->rt6i_pcpu) |
3679 |
++ fib6_drop_pcpu_from(rt, table); |
3680 |
++ |
3681 |
+ if (atomic_read(&rt->fib6_ref) != 1) { |
3682 |
+ /* This route is used as dummy address holder in some split |
3683 |
+ * nodes. It is not leaked, but it still holds other resources, |
3684 |
+@@ -921,9 +930,6 @@ static void fib6_purge_rt(struct fib6_info *rt, struct fib6_node *fn, |
3685 |
+ fn = rcu_dereference_protected(fn->parent, |
3686 |
+ lockdep_is_held(&table->tb6_lock)); |
3687 |
+ } |
3688 |
+- |
3689 |
+- if (rt->rt6i_pcpu) |
3690 |
+- fib6_drop_pcpu_from(rt, table); |
3691 |
+ } |
3692 |
+ } |
3693 |
+ |
3694 |
+diff --git a/net/ipv6/route.c b/net/ipv6/route.c |
3695 |
+index 2e519f7b983c..bf0940c42810 100644 |
3696 |
+--- a/net/ipv6/route.c |
3697 |
++++ b/net/ipv6/route.c |
3698 |
+@@ -110,8 +110,8 @@ static int rt6_fill_node(struct net *net, struct sk_buff *skb, |
3699 |
+ int iif, int type, u32 portid, u32 seq, |
3700 |
+ unsigned int flags); |
3701 |
+ static struct rt6_info *rt6_find_cached_rt(struct fib6_info *rt, |
3702 |
+- struct in6_addr *daddr, |
3703 |
+- struct in6_addr *saddr); |
3704 |
++ const struct in6_addr *daddr, |
3705 |
++ const struct in6_addr *saddr); |
3706 |
+ |
3707 |
+ #ifdef CONFIG_IPV6_ROUTE_INFO |
3708 |
+ static struct fib6_info *rt6_add_route_info(struct net *net, |
3709 |
+@@ -1268,6 +1268,13 @@ static struct rt6_info *rt6_make_pcpu_route(struct net *net, |
3710 |
+ prev = cmpxchg(p, NULL, pcpu_rt); |
3711 |
+ BUG_ON(prev); |
3712 |
+ |
3713 |
++ if (rt->fib6_destroying) { |
3714 |
++ struct fib6_info *from; |
3715 |
++ |
3716 |
++ from = xchg((__force struct fib6_info **)&pcpu_rt->from, NULL); |
3717 |
++ fib6_info_release(from); |
3718 |
++ } |
3719 |
++ |
3720 |
+ return pcpu_rt; |
3721 |
+ } |
3722 |
+ |
3723 |
+@@ -1542,31 +1549,44 @@ out: |
3724 |
+ * Caller has to hold rcu_read_lock() |
3725 |
+ */ |
3726 |
+ static struct rt6_info *rt6_find_cached_rt(struct fib6_info *rt, |
3727 |
+- struct in6_addr *daddr, |
3728 |
+- struct in6_addr *saddr) |
3729 |
++ const struct in6_addr *daddr, |
3730 |
++ const struct in6_addr *saddr) |
3731 |
+ { |
3732 |
++ const struct in6_addr *src_key = NULL; |
3733 |
+ struct rt6_exception_bucket *bucket; |
3734 |
+- struct in6_addr *src_key = NULL; |
3735 |
+ struct rt6_exception *rt6_ex; |
3736 |
+ struct rt6_info *res = NULL; |
3737 |
+ |
3738 |
+- bucket = rcu_dereference(rt->rt6i_exception_bucket); |
3739 |
+- |
3740 |
+ #ifdef CONFIG_IPV6_SUBTREES |
3741 |
+ /* rt6i_src.plen != 0 indicates rt is in subtree |
3742 |
+ * and exception table is indexed by a hash of |
3743 |
+ * both rt6i_dst and rt6i_src. |
3744 |
+- * Otherwise, the exception table is indexed by |
3745 |
+- * a hash of only rt6i_dst. |
3746 |
++ * However, the src addr used to create the hash |
3747 |
++ * might not be exactly the passed in saddr which |
3748 |
++ * is a /128 addr from the flow. |
3749 |
++ * So we need to use f6i->fib6_src to redo lookup |
3750 |
++ * if the passed in saddr does not find anything. |
3751 |
++ * (See the logic in ip6_rt_cache_alloc() on how |
3752 |
++ * rt->rt6i_src is updated.) |
3753 |
+ */ |
3754 |
+ if (rt->fib6_src.plen) |
3755 |
+ src_key = saddr; |
3756 |
++find_ex: |
3757 |
+ #endif |
3758 |
++ bucket = rcu_dereference(rt->rt6i_exception_bucket); |
3759 |
+ rt6_ex = __rt6_find_exception_rcu(&bucket, daddr, src_key); |
3760 |
+ |
3761 |
+ if (rt6_ex && !rt6_check_expired(rt6_ex->rt6i)) |
3762 |
+ res = rt6_ex->rt6i; |
3763 |
+ |
3764 |
++#ifdef CONFIG_IPV6_SUBTREES |
3765 |
++ /* Use fib6_src as src_key and redo lookup */ |
3766 |
++ if (!res && src_key && src_key != &rt->fib6_src.addr) { |
3767 |
++ src_key = &rt->fib6_src.addr; |
3768 |
++ goto find_ex; |
3769 |
++ } |
3770 |
++#endif |
3771 |
++ |
3772 |
+ return res; |
3773 |
+ } |
3774 |
+ |
3775 |
+@@ -2650,10 +2670,8 @@ out: |
3776 |
+ u32 ip6_mtu_from_fib6(struct fib6_info *f6i, struct in6_addr *daddr, |
3777 |
+ struct in6_addr *saddr) |
3778 |
+ { |
3779 |
+- struct rt6_exception_bucket *bucket; |
3780 |
+- struct rt6_exception *rt6_ex; |
3781 |
+- struct in6_addr *src_key; |
3782 |
+ struct inet6_dev *idev; |
3783 |
++ struct rt6_info *rt; |
3784 |
+ u32 mtu = 0; |
3785 |
+ |
3786 |
+ if (unlikely(fib6_metric_locked(f6i, RTAX_MTU))) { |
3787 |
+@@ -2662,18 +2680,10 @@ u32 ip6_mtu_from_fib6(struct fib6_info *f6i, struct in6_addr *daddr, |
3788 |
+ goto out; |
3789 |
+ } |
3790 |
+ |
3791 |
+- src_key = NULL; |
3792 |
+-#ifdef CONFIG_IPV6_SUBTREES |
3793 |
+- if (f6i->fib6_src.plen) |
3794 |
+- src_key = saddr; |
3795 |
+-#endif |
3796 |
+- |
3797 |
+- bucket = rcu_dereference(f6i->rt6i_exception_bucket); |
3798 |
+- rt6_ex = __rt6_find_exception_rcu(&bucket, daddr, src_key); |
3799 |
+- if (rt6_ex && !rt6_check_expired(rt6_ex->rt6i)) |
3800 |
+- mtu = dst_metric_raw(&rt6_ex->rt6i->dst, RTAX_MTU); |
3801 |
+- |
3802 |
+- if (likely(!mtu)) { |
3803 |
++ rt = rt6_find_cached_rt(f6i, daddr, saddr); |
3804 |
++ if (unlikely(rt)) { |
3805 |
++ mtu = dst_metric_raw(&rt->dst, RTAX_MTU); |
3806 |
++ } else { |
3807 |
+ struct net_device *dev = fib6_info_nh_dev(f6i); |
3808 |
+ |
3809 |
+ mtu = IPV6_MIN_MTU; |
3810 |
+diff --git a/net/ipv6/xfrm6_tunnel.c b/net/ipv6/xfrm6_tunnel.c |
3811 |
+index bc65db782bfb..d9e5f6808811 100644 |
3812 |
+--- a/net/ipv6/xfrm6_tunnel.c |
3813 |
++++ b/net/ipv6/xfrm6_tunnel.c |
3814 |
+@@ -345,7 +345,7 @@ static void __net_exit xfrm6_tunnel_net_exit(struct net *net) |
3815 |
+ unsigned int i; |
3816 |
+ |
3817 |
+ xfrm_flush_gc(); |
3818 |
+- xfrm_state_flush(net, IPSEC_PROTO_ANY, false, true); |
3819 |
++ xfrm_state_flush(net, 0, false, true); |
3820 |
+ |
3821 |
+ for (i = 0; i < XFRM6_TUNNEL_SPI_BYADDR_HSIZE; i++) |
3822 |
+ WARN_ON_ONCE(!hlist_empty(&xfrm6_tn->spi_byaddr[i])); |
3823 |
+@@ -402,6 +402,10 @@ static void __exit xfrm6_tunnel_fini(void) |
3824 |
+ xfrm6_tunnel_deregister(&xfrm6_tunnel_handler, AF_INET6); |
3825 |
+ xfrm_unregister_type(&xfrm6_tunnel_type, AF_INET6); |
3826 |
+ unregister_pernet_subsys(&xfrm6_tunnel_net_ops); |
3827 |
++ /* Someone maybe has gotten the xfrm6_tunnel_spi. |
3828 |
++ * So need to wait it. |
3829 |
++ */ |
3830 |
++ rcu_barrier(); |
3831 |
+ kmem_cache_destroy(xfrm6_tunnel_spi_kmem); |
3832 |
+ } |
3833 |
+ |
3834 |
+diff --git a/net/key/af_key.c b/net/key/af_key.c |
3835 |
+index 7d4bed955060..0b79c9aa8eb1 100644 |
3836 |
+--- a/net/key/af_key.c |
3837 |
++++ b/net/key/af_key.c |
3838 |
+@@ -1951,8 +1951,10 @@ parse_ipsecrequest(struct xfrm_policy *xp, struct sadb_x_ipsecrequest *rq) |
3839 |
+ |
3840 |
+ if (rq->sadb_x_ipsecrequest_mode == 0) |
3841 |
+ return -EINVAL; |
3842 |
++ if (!xfrm_id_proto_valid(rq->sadb_x_ipsecrequest_proto)) |
3843 |
++ return -EINVAL; |
3844 |
+ |
3845 |
+- t->id.proto = rq->sadb_x_ipsecrequest_proto; /* XXX check proto */ |
3846 |
++ t->id.proto = rq->sadb_x_ipsecrequest_proto; |
3847 |
+ if ((mode = pfkey_mode_to_xfrm(rq->sadb_x_ipsecrequest_mode)) < 0) |
3848 |
+ return -EINVAL; |
3849 |
+ t->mode = mode; |
3850 |
+diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c |
3851 |
+index 3a0171a65db3..152d4365f961 100644 |
3852 |
+--- a/net/mac80211/iface.c |
3853 |
++++ b/net/mac80211/iface.c |
3854 |
+@@ -1910,6 +1910,9 @@ void ieee80211_if_remove(struct ieee80211_sub_if_data *sdata) |
3855 |
+ list_del_rcu(&sdata->list); |
3856 |
+ mutex_unlock(&sdata->local->iflist_mtx); |
3857 |
+ |
3858 |
++ if (sdata->vif.txq) |
3859 |
++ ieee80211_txq_purge(sdata->local, to_txq_info(sdata->vif.txq)); |
3860 |
++ |
3861 |
+ synchronize_rcu(); |
3862 |
+ |
3863 |
+ if (sdata->dev) { |
3864 |
+diff --git a/net/tipc/core.c b/net/tipc/core.c |
3865 |
+index 5b38f5164281..d7b0688c98dd 100644 |
3866 |
+--- a/net/tipc/core.c |
3867 |
++++ b/net/tipc/core.c |
3868 |
+@@ -66,6 +66,10 @@ static int __net_init tipc_init_net(struct net *net) |
3869 |
+ INIT_LIST_HEAD(&tn->node_list); |
3870 |
+ spin_lock_init(&tn->node_list_lock); |
3871 |
+ |
3872 |
++ err = tipc_socket_init(); |
3873 |
++ if (err) |
3874 |
++ goto out_socket; |
3875 |
++ |
3876 |
+ err = tipc_sk_rht_init(net); |
3877 |
+ if (err) |
3878 |
+ goto out_sk_rht; |
3879 |
+@@ -92,6 +96,8 @@ out_subscr: |
3880 |
+ out_nametbl: |
3881 |
+ tipc_sk_rht_destroy(net); |
3882 |
+ out_sk_rht: |
3883 |
++ tipc_socket_stop(); |
3884 |
++out_socket: |
3885 |
+ return err; |
3886 |
+ } |
3887 |
+ |
3888 |
+@@ -102,6 +108,7 @@ static void __net_exit tipc_exit_net(struct net *net) |
3889 |
+ tipc_bcast_stop(net); |
3890 |
+ tipc_nametbl_stop(net); |
3891 |
+ tipc_sk_rht_destroy(net); |
3892 |
++ tipc_socket_stop(); |
3893 |
+ } |
3894 |
+ |
3895 |
+ static struct pernet_operations tipc_net_ops = { |
3896 |
+@@ -129,10 +136,6 @@ static int __init tipc_init(void) |
3897 |
+ if (err) |
3898 |
+ goto out_netlink_compat; |
3899 |
+ |
3900 |
+- err = tipc_socket_init(); |
3901 |
+- if (err) |
3902 |
+- goto out_socket; |
3903 |
+- |
3904 |
+ err = tipc_register_sysctl(); |
3905 |
+ if (err) |
3906 |
+ goto out_sysctl; |
3907 |
+@@ -152,8 +155,6 @@ out_bearer: |
3908 |
+ out_pernet: |
3909 |
+ tipc_unregister_sysctl(); |
3910 |
+ out_sysctl: |
3911 |
+- tipc_socket_stop(); |
3912 |
+-out_socket: |
3913 |
+ tipc_netlink_compat_stop(); |
3914 |
+ out_netlink_compat: |
3915 |
+ tipc_netlink_stop(); |
3916 |
+@@ -168,7 +169,6 @@ static void __exit tipc_exit(void) |
3917 |
+ unregister_pernet_subsys(&tipc_net_ops); |
3918 |
+ tipc_netlink_stop(); |
3919 |
+ tipc_netlink_compat_stop(); |
3920 |
+- tipc_socket_stop(); |
3921 |
+ tipc_unregister_sysctl(); |
3922 |
+ |
3923 |
+ pr_info("Deactivated\n"); |
3924 |
+diff --git a/net/vmw_vsock/virtio_transport.c b/net/vmw_vsock/virtio_transport.c |
3925 |
+index 15eb5d3d4750..96ab344f17bb 100644 |
3926 |
+--- a/net/vmw_vsock/virtio_transport.c |
3927 |
++++ b/net/vmw_vsock/virtio_transport.c |
3928 |
+@@ -702,28 +702,27 @@ static int __init virtio_vsock_init(void) |
3929 |
+ if (!virtio_vsock_workqueue) |
3930 |
+ return -ENOMEM; |
3931 |
+ |
3932 |
+- ret = register_virtio_driver(&virtio_vsock_driver); |
3933 |
++ ret = vsock_core_init(&virtio_transport.transport); |
3934 |
+ if (ret) |
3935 |
+ goto out_wq; |
3936 |
+ |
3937 |
+- ret = vsock_core_init(&virtio_transport.transport); |
3938 |
++ ret = register_virtio_driver(&virtio_vsock_driver); |
3939 |
+ if (ret) |
3940 |
+- goto out_vdr; |
3941 |
++ goto out_vci; |
3942 |
+ |
3943 |
+ return 0; |
3944 |
+ |
3945 |
+-out_vdr: |
3946 |
+- unregister_virtio_driver(&virtio_vsock_driver); |
3947 |
++out_vci: |
3948 |
++ vsock_core_exit(); |
3949 |
+ out_wq: |
3950 |
+ destroy_workqueue(virtio_vsock_workqueue); |
3951 |
+ return ret; |
3952 |
+- |
3953 |
+ } |
3954 |
+ |
3955 |
+ static void __exit virtio_vsock_exit(void) |
3956 |
+ { |
3957 |
+- vsock_core_exit(); |
3958 |
+ unregister_virtio_driver(&virtio_vsock_driver); |
3959 |
++ vsock_core_exit(); |
3960 |
+ destroy_workqueue(virtio_vsock_workqueue); |
3961 |
+ } |
3962 |
+ |
3963 |
+diff --git a/net/vmw_vsock/virtio_transport_common.c b/net/vmw_vsock/virtio_transport_common.c |
3964 |
+index 602715fc9a75..f3f3d06cb6d8 100644 |
3965 |
+--- a/net/vmw_vsock/virtio_transport_common.c |
3966 |
++++ b/net/vmw_vsock/virtio_transport_common.c |
3967 |
+@@ -786,12 +786,19 @@ static bool virtio_transport_close(struct vsock_sock *vsk) |
3968 |
+ |
3969 |
+ void virtio_transport_release(struct vsock_sock *vsk) |
3970 |
+ { |
3971 |
++ struct virtio_vsock_sock *vvs = vsk->trans; |
3972 |
++ struct virtio_vsock_pkt *pkt, *tmp; |
3973 |
+ struct sock *sk = &vsk->sk; |
3974 |
+ bool remove_sock = true; |
3975 |
+ |
3976 |
+ lock_sock(sk); |
3977 |
+ if (sk->sk_type == SOCK_STREAM) |
3978 |
+ remove_sock = virtio_transport_close(vsk); |
3979 |
++ |
3980 |
++ list_for_each_entry_safe(pkt, tmp, &vvs->rx_queue, list) { |
3981 |
++ list_del(&pkt->list); |
3982 |
++ virtio_transport_free_pkt(pkt); |
3983 |
++ } |
3984 |
+ release_sock(sk); |
3985 |
+ |
3986 |
+ if (remove_sock) |
3987 |
+diff --git a/net/xfrm/xfrm_interface.c b/net/xfrm/xfrm_interface.c |
3988 |
+index 82723ef44db3..555ee2aca6c0 100644 |
3989 |
+--- a/net/xfrm/xfrm_interface.c |
3990 |
++++ b/net/xfrm/xfrm_interface.c |
3991 |
+@@ -70,17 +70,28 @@ static struct xfrm_if *xfrmi_lookup(struct net *net, struct xfrm_state *x) |
3992 |
+ return NULL; |
3993 |
+ } |
3994 |
+ |
3995 |
+-static struct xfrm_if *xfrmi_decode_session(struct sk_buff *skb) |
3996 |
++static struct xfrm_if *xfrmi_decode_session(struct sk_buff *skb, |
3997 |
++ unsigned short family) |
3998 |
+ { |
3999 |
+ struct xfrmi_net *xfrmn; |
4000 |
+- int ifindex; |
4001 |
+ struct xfrm_if *xi; |
4002 |
++ int ifindex = 0; |
4003 |
+ |
4004 |
+ if (!secpath_exists(skb) || !skb->dev) |
4005 |
+ return NULL; |
4006 |
+ |
4007 |
++ switch (family) { |
4008 |
++ case AF_INET6: |
4009 |
++ ifindex = inet6_sdif(skb); |
4010 |
++ break; |
4011 |
++ case AF_INET: |
4012 |
++ ifindex = inet_sdif(skb); |
4013 |
++ break; |
4014 |
++ } |
4015 |
++ if (!ifindex) |
4016 |
++ ifindex = skb->dev->ifindex; |
4017 |
++ |
4018 |
+ xfrmn = net_generic(xs_net(xfrm_input_state(skb)), xfrmi_net_id); |
4019 |
+- ifindex = skb->dev->ifindex; |
4020 |
+ |
4021 |
+ for_each_xfrmi_rcu(xfrmn->xfrmi[0], xi) { |
4022 |
+ if (ifindex == xi->dev->ifindex && |
4023 |
+diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c |
4024 |
+index bf5d59270f79..ce1b262ce964 100644 |
4025 |
+--- a/net/xfrm/xfrm_policy.c |
4026 |
++++ b/net/xfrm/xfrm_policy.c |
4027 |
+@@ -2339,7 +2339,7 @@ int __xfrm_policy_check(struct sock *sk, int dir, struct sk_buff *skb, |
4028 |
+ ifcb = xfrm_if_get_cb(); |
4029 |
+ |
4030 |
+ if (ifcb) { |
4031 |
+- xi = ifcb->decode_session(skb); |
4032 |
++ xi = ifcb->decode_session(skb, family); |
4033 |
+ if (xi) { |
4034 |
+ if_id = xi->p.if_id; |
4035 |
+ net = xi->net; |
4036 |
+diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c |
4037 |
+index 3f729cd512af..11e09eb138d6 100644 |
4038 |
+--- a/net/xfrm/xfrm_state.c |
4039 |
++++ b/net/xfrm/xfrm_state.c |
4040 |
+@@ -2386,7 +2386,7 @@ void xfrm_state_fini(struct net *net) |
4041 |
+ |
4042 |
+ flush_work(&net->xfrm.state_hash_work); |
4043 |
+ flush_work(&xfrm_state_gc_work); |
4044 |
+- xfrm_state_flush(net, IPSEC_PROTO_ANY, false, true); |
4045 |
++ xfrm_state_flush(net, 0, false, true); |
4046 |
+ |
4047 |
+ WARN_ON(!list_empty(&net->xfrm.state_all)); |
4048 |
+ |
4049 |
+diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c |
4050 |
+index 7e4904b93004..2122f89f6155 100644 |
4051 |
+--- a/net/xfrm/xfrm_user.c |
4052 |
++++ b/net/xfrm/xfrm_user.c |
4053 |
+@@ -1424,7 +1424,7 @@ static int verify_newpolicy_info(struct xfrm_userpolicy_info *p) |
4054 |
+ ret = verify_policy_dir(p->dir); |
4055 |
+ if (ret) |
4056 |
+ return ret; |
4057 |
+- if (p->index && ((p->index & XFRM_POLICY_MAX) != p->dir)) |
4058 |
++ if (p->index && (xfrm_policy_id2dir(p->index) != p->dir)) |
4059 |
+ return -EINVAL; |
4060 |
+ |
4061 |
+ return 0; |
4062 |
+@@ -1513,20 +1513,8 @@ static int validate_tmpl(int nr, struct xfrm_user_tmpl *ut, u16 family) |
4063 |
+ return -EINVAL; |
4064 |
+ } |
4065 |
+ |
4066 |
+- switch (ut[i].id.proto) { |
4067 |
+- case IPPROTO_AH: |
4068 |
+- case IPPROTO_ESP: |
4069 |
+- case IPPROTO_COMP: |
4070 |
+-#if IS_ENABLED(CONFIG_IPV6) |
4071 |
+- case IPPROTO_ROUTING: |
4072 |
+- case IPPROTO_DSTOPTS: |
4073 |
+-#endif |
4074 |
+- case IPSEC_PROTO_ANY: |
4075 |
+- break; |
4076 |
+- default: |
4077 |
++ if (!xfrm_id_proto_valid(ut[i].id.proto)) |
4078 |
+ return -EINVAL; |
4079 |
+- } |
4080 |
+- |
4081 |
+ } |
4082 |
+ |
4083 |
+ return 0; |
4084 |
+diff --git a/security/apparmor/apparmorfs.c b/security/apparmor/apparmorfs.c |
4085 |
+index e09fe4d7307c..40e3a098f6fb 100644 |
4086 |
+--- a/security/apparmor/apparmorfs.c |
4087 |
++++ b/security/apparmor/apparmorfs.c |
4088 |
+@@ -123,17 +123,22 @@ static int aafs_show_path(struct seq_file *seq, struct dentry *dentry) |
4089 |
+ return 0; |
4090 |
+ } |
4091 |
+ |
4092 |
+-static void aafs_evict_inode(struct inode *inode) |
4093 |
++static void aafs_i_callback(struct rcu_head *head) |
4094 |
+ { |
4095 |
+- truncate_inode_pages_final(&inode->i_data); |
4096 |
+- clear_inode(inode); |
4097 |
++ struct inode *inode = container_of(head, struct inode, i_rcu); |
4098 |
+ if (S_ISLNK(inode->i_mode)) |
4099 |
+ kfree(inode->i_link); |
4100 |
++ free_inode_nonrcu(inode); |
4101 |
++} |
4102 |
++ |
4103 |
++static void aafs_destroy_inode(struct inode *inode) |
4104 |
++{ |
4105 |
++ call_rcu(&inode->i_rcu, aafs_i_callback); |
4106 |
+ } |
4107 |
+ |
4108 |
+ static const struct super_operations aafs_super_ops = { |
4109 |
+ .statfs = simple_statfs, |
4110 |
+- .evict_inode = aafs_evict_inode, |
4111 |
++ .destroy_inode = aafs_destroy_inode, |
4112 |
+ .show_path = aafs_show_path, |
4113 |
+ }; |
4114 |
+ |
4115 |
+diff --git a/security/inode.c b/security/inode.c |
4116 |
+index 8dd9ca8848e4..829f15672e01 100644 |
4117 |
+--- a/security/inode.c |
4118 |
++++ b/security/inode.c |
4119 |
+@@ -26,17 +26,22 @@ |
4120 |
+ static struct vfsmount *mount; |
4121 |
+ static int mount_count; |
4122 |
+ |
4123 |
+-static void securityfs_evict_inode(struct inode *inode) |
4124 |
++static void securityfs_i_callback(struct rcu_head *head) |
4125 |
+ { |
4126 |
+- truncate_inode_pages_final(&inode->i_data); |
4127 |
+- clear_inode(inode); |
4128 |
++ struct inode *inode = container_of(head, struct inode, i_rcu); |
4129 |
+ if (S_ISLNK(inode->i_mode)) |
4130 |
+ kfree(inode->i_link); |
4131 |
++ free_inode_nonrcu(inode); |
4132 |
++} |
4133 |
++ |
4134 |
++static void securityfs_destroy_inode(struct inode *inode) |
4135 |
++{ |
4136 |
++ call_rcu(&inode->i_rcu, securityfs_i_callback); |
4137 |
+ } |
4138 |
+ |
4139 |
+ static const struct super_operations securityfs_super_operations = { |
4140 |
+ .statfs = simple_statfs, |
4141 |
+- .evict_inode = securityfs_evict_inode, |
4142 |
++ .destroy_inode = securityfs_destroy_inode, |
4143 |
+ }; |
4144 |
+ |
4145 |
+ static int fill_super(struct super_block *sb, void *data, int silent) |
4146 |
+diff --git a/tools/objtool/Makefile b/tools/objtool/Makefile |
4147 |
+index 53f8be0f4a1f..88158239622b 100644 |
4148 |
+--- a/tools/objtool/Makefile |
4149 |
++++ b/tools/objtool/Makefile |
4150 |
+@@ -7,11 +7,12 @@ ARCH := x86 |
4151 |
+ endif |
4152 |
+ |
4153 |
+ # always use the host compiler |
4154 |
++HOSTAR ?= ar |
4155 |
+ HOSTCC ?= gcc |
4156 |
+ HOSTLD ?= ld |
4157 |
++AR = $(HOSTAR) |
4158 |
+ CC = $(HOSTCC) |
4159 |
+ LD = $(HOSTLD) |
4160 |
+-AR = ar |
4161 |
+ |
4162 |
+ ifeq ($(srctree),) |
4163 |
+ srctree := $(patsubst %/,%,$(dir $(CURDIR))) |
4164 |
+diff --git a/tools/perf/bench/numa.c b/tools/perf/bench/numa.c |
4165 |
+index 44195514b19e..fa56fde6e8d8 100644 |
4166 |
+--- a/tools/perf/bench/numa.c |
4167 |
++++ b/tools/perf/bench/numa.c |
4168 |
+@@ -38,6 +38,10 @@ |
4169 |
+ #include <numa.h> |
4170 |
+ #include <numaif.h> |
4171 |
+ |
4172 |
++#ifndef RUSAGE_THREAD |
4173 |
++# define RUSAGE_THREAD 1 |
4174 |
++#endif |
4175 |
++ |
4176 |
+ /* |
4177 |
+ * Regular printout to the terminal, supressed if -q is specified: |
4178 |
+ */ |
4179 |
+diff --git a/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c b/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c |
4180 |
+index 0bc3e6e93c31..4357141c7c92 100644 |
4181 |
+--- a/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c |
4182 |
++++ b/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c |
4183 |
+@@ -58,6 +58,7 @@ enum intel_pt_pkt_state { |
4184 |
+ INTEL_PT_STATE_NO_IP, |
4185 |
+ INTEL_PT_STATE_ERR_RESYNC, |
4186 |
+ INTEL_PT_STATE_IN_SYNC, |
4187 |
++ INTEL_PT_STATE_TNT_CONT, |
4188 |
+ INTEL_PT_STATE_TNT, |
4189 |
+ INTEL_PT_STATE_TIP, |
4190 |
+ INTEL_PT_STATE_TIP_PGD, |
4191 |
+@@ -72,8 +73,9 @@ static inline bool intel_pt_sample_time(enum intel_pt_pkt_state pkt_state) |
4192 |
+ case INTEL_PT_STATE_NO_IP: |
4193 |
+ case INTEL_PT_STATE_ERR_RESYNC: |
4194 |
+ case INTEL_PT_STATE_IN_SYNC: |
4195 |
+- case INTEL_PT_STATE_TNT: |
4196 |
++ case INTEL_PT_STATE_TNT_CONT: |
4197 |
+ return true; |
4198 |
++ case INTEL_PT_STATE_TNT: |
4199 |
+ case INTEL_PT_STATE_TIP: |
4200 |
+ case INTEL_PT_STATE_TIP_PGD: |
4201 |
+ case INTEL_PT_STATE_FUP: |
4202 |
+@@ -888,16 +890,20 @@ static uint64_t intel_pt_next_period(struct intel_pt_decoder *decoder) |
4203 |
+ timestamp = decoder->timestamp + decoder->timestamp_insn_cnt; |
4204 |
+ masked_timestamp = timestamp & decoder->period_mask; |
4205 |
+ if (decoder->continuous_period) { |
4206 |
+- if (masked_timestamp != decoder->last_masked_timestamp) |
4207 |
++ if (masked_timestamp > decoder->last_masked_timestamp) |
4208 |
+ return 1; |
4209 |
+ } else { |
4210 |
+ timestamp += 1; |
4211 |
+ masked_timestamp = timestamp & decoder->period_mask; |
4212 |
+- if (masked_timestamp != decoder->last_masked_timestamp) { |
4213 |
++ if (masked_timestamp > decoder->last_masked_timestamp) { |
4214 |
+ decoder->last_masked_timestamp = masked_timestamp; |
4215 |
+ decoder->continuous_period = true; |
4216 |
+ } |
4217 |
+ } |
4218 |
++ |
4219 |
++ if (masked_timestamp < decoder->last_masked_timestamp) |
4220 |
++ return decoder->period_ticks; |
4221 |
++ |
4222 |
+ return decoder->period_ticks - (timestamp - masked_timestamp); |
4223 |
+ } |
4224 |
+ |
4225 |
+@@ -926,7 +932,10 @@ static void intel_pt_sample_insn(struct intel_pt_decoder *decoder) |
4226 |
+ case INTEL_PT_PERIOD_TICKS: |
4227 |
+ timestamp = decoder->timestamp + decoder->timestamp_insn_cnt; |
4228 |
+ masked_timestamp = timestamp & decoder->period_mask; |
4229 |
+- decoder->last_masked_timestamp = masked_timestamp; |
4230 |
++ if (masked_timestamp > decoder->last_masked_timestamp) |
4231 |
++ decoder->last_masked_timestamp = masked_timestamp; |
4232 |
++ else |
4233 |
++ decoder->last_masked_timestamp += decoder->period_ticks; |
4234 |
+ break; |
4235 |
+ case INTEL_PT_PERIOD_NONE: |
4236 |
+ case INTEL_PT_PERIOD_MTC: |
4237 |
+@@ -1249,7 +1258,9 @@ static int intel_pt_walk_tnt(struct intel_pt_decoder *decoder) |
4238 |
+ return -ENOENT; |
4239 |
+ } |
4240 |
+ decoder->tnt.count -= 1; |
4241 |
+- if (!decoder->tnt.count) |
4242 |
++ if (decoder->tnt.count) |
4243 |
++ decoder->pkt_state = INTEL_PT_STATE_TNT_CONT; |
4244 |
++ else |
4245 |
+ decoder->pkt_state = INTEL_PT_STATE_IN_SYNC; |
4246 |
+ decoder->tnt.payload <<= 1; |
4247 |
+ decoder->state.from_ip = decoder->ip; |
4248 |
+@@ -1280,7 +1291,9 @@ static int intel_pt_walk_tnt(struct intel_pt_decoder *decoder) |
4249 |
+ |
4250 |
+ if (intel_pt_insn.branch == INTEL_PT_BR_CONDITIONAL) { |
4251 |
+ decoder->tnt.count -= 1; |
4252 |
+- if (!decoder->tnt.count) |
4253 |
++ if (decoder->tnt.count) |
4254 |
++ decoder->pkt_state = INTEL_PT_STATE_TNT_CONT; |
4255 |
++ else |
4256 |
+ decoder->pkt_state = INTEL_PT_STATE_IN_SYNC; |
4257 |
+ if (decoder->tnt.payload & BIT63) { |
4258 |
+ decoder->tnt.payload <<= 1; |
4259 |
+@@ -1300,8 +1313,11 @@ static int intel_pt_walk_tnt(struct intel_pt_decoder *decoder) |
4260 |
+ return 0; |
4261 |
+ } |
4262 |
+ decoder->ip += intel_pt_insn.length; |
4263 |
+- if (!decoder->tnt.count) |
4264 |
++ if (!decoder->tnt.count) { |
4265 |
++ decoder->sample_timestamp = decoder->timestamp; |
4266 |
++ decoder->sample_insn_cnt = decoder->timestamp_insn_cnt; |
4267 |
+ return -EAGAIN; |
4268 |
++ } |
4269 |
+ decoder->tnt.payload <<= 1; |
4270 |
+ continue; |
4271 |
+ } |
4272 |
+@@ -2349,6 +2365,7 @@ const struct intel_pt_state *intel_pt_decode(struct intel_pt_decoder *decoder) |
4273 |
+ err = intel_pt_walk_trace(decoder); |
4274 |
+ break; |
4275 |
+ case INTEL_PT_STATE_TNT: |
4276 |
++ case INTEL_PT_STATE_TNT_CONT: |
4277 |
+ err = intel_pt_walk_tnt(decoder); |
4278 |
+ if (err == -EAGAIN) |
4279 |
+ err = intel_pt_walk_trace(decoder); |
4280 |
+diff --git a/tools/testing/selftests/bpf/test_verifier.c b/tools/testing/selftests/bpf/test_verifier.c |
4281 |
+index 294fc18aba2a..9db5a7378f40 100644 |
4282 |
+--- a/tools/testing/selftests/bpf/test_verifier.c |
4283 |
++++ b/tools/testing/selftests/bpf/test_verifier.c |
4284 |
+@@ -32,7 +32,6 @@ |
4285 |
+ #include <linux/if_ether.h> |
4286 |
+ |
4287 |
+ #include <bpf/bpf.h> |
4288 |
+-#include <bpf/libbpf.h> |
4289 |
+ |
4290 |
+ #ifdef HAVE_GENHDR |
4291 |
+ # include "autoconf.h" |
4292 |
+@@ -57,7 +56,6 @@ |
4293 |
+ |
4294 |
+ #define UNPRIV_SYSCTL "kernel/unprivileged_bpf_disabled" |
4295 |
+ static bool unpriv_disabled = false; |
4296 |
+-static int skips; |
4297 |
+ |
4298 |
+ struct bpf_test { |
4299 |
+ const char *descr; |
4300 |
+@@ -12772,11 +12770,6 @@ static void do_test_single(struct bpf_test *test, bool unpriv, |
4301 |
+ fd_prog = bpf_verify_program(prog_type ? : BPF_PROG_TYPE_SOCKET_FILTER, |
4302 |
+ prog, prog_len, test->flags & F_LOAD_WITH_STRICT_ALIGNMENT, |
4303 |
+ "GPL", 0, bpf_vlog, sizeof(bpf_vlog), 1); |
4304 |
+- if (fd_prog < 0 && !bpf_probe_prog_type(prog_type, 0)) { |
4305 |
+- printf("SKIP (unsupported program type %d)\n", prog_type); |
4306 |
+- skips++; |
4307 |
+- goto close_fds; |
4308 |
+- } |
4309 |
+ |
4310 |
+ expected_ret = unpriv && test->result_unpriv != UNDEF ? |
4311 |
+ test->result_unpriv : test->result; |
4312 |
+@@ -12912,7 +12905,7 @@ static void get_unpriv_disabled() |
4313 |
+ |
4314 |
+ static int do_test(bool unpriv, unsigned int from, unsigned int to) |
4315 |
+ { |
4316 |
+- int i, passes = 0, errors = 0; |
4317 |
++ int i, passes = 0, errors = 0, skips = 0; |
4318 |
+ |
4319 |
+ for (i = from; i < to; i++) { |
4320 |
+ struct bpf_test *test = &tests[i]; |
4321 |
+diff --git a/virt/kvm/arm/arm.c b/virt/kvm/arm/arm.c |
4322 |
+index 1415e36fed3d..fef3527af3bd 100644 |
4323 |
+--- a/virt/kvm/arm/arm.c |
4324 |
++++ b/virt/kvm/arm/arm.c |
4325 |
+@@ -949,7 +949,7 @@ int kvm_vm_ioctl_irq_line(struct kvm *kvm, struct kvm_irq_level *irq_level, |
4326 |
+ static int kvm_vcpu_set_target(struct kvm_vcpu *vcpu, |
4327 |
+ const struct kvm_vcpu_init *init) |
4328 |
+ { |
4329 |
+- unsigned int i; |
4330 |
++ unsigned int i, ret; |
4331 |
+ int phys_target = kvm_target_cpu(); |
4332 |
+ |
4333 |
+ if (init->target != phys_target) |
4334 |
+@@ -984,9 +984,14 @@ static int kvm_vcpu_set_target(struct kvm_vcpu *vcpu, |
4335 |
+ vcpu->arch.target = phys_target; |
4336 |
+ |
4337 |
+ /* Now we know what it is, we can reset it. */ |
4338 |
+- return kvm_reset_vcpu(vcpu); |
4339 |
+-} |
4340 |
++ ret = kvm_reset_vcpu(vcpu); |
4341 |
++ if (ret) { |
4342 |
++ vcpu->arch.target = -1; |
4343 |
++ bitmap_zero(vcpu->arch.features, KVM_VCPU_MAX_FEATURES); |
4344 |
++ } |
4345 |
+ |
4346 |
++ return ret; |
4347 |
++} |
4348 |
+ |
4349 |
+ static int kvm_arch_vcpu_ioctl_vcpu_init(struct kvm_vcpu *vcpu, |
4350 |
+ struct kvm_vcpu_init *init) |