1 |
commit: 418b300cac3a4b2286197e6433c3e8a08c638305 |
2 |
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
3 |
AuthorDate: Tue Sep 29 17:51:49 2015 +0000 |
4 |
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Sep 29 17:51:49 2015 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=418b300c |
7 |
|
8 |
Linux patch 4.2.2 |
9 |
|
10 |
0000_README | 4 + |
11 |
1001_linux-4.2.2.patch | 5014 ++++++++++++++++++++++++++++++++++++++++++++++++ |
12 |
2 files changed, 5018 insertions(+) |
13 |
|
14 |
diff --git a/0000_README b/0000_README |
15 |
index 551dcf3..9428abc 100644 |
16 |
--- a/0000_README |
17 |
+++ b/0000_README |
18 |
@@ -47,6 +47,10 @@ Patch: 1000_linux-4.2.1.patch |
19 |
From: http://www.kernel.org |
20 |
Desc: Linux 4.2.1 |
21 |
|
22 |
+Patch: 1001_linux-4.2.2.patch |
23 |
+From: http://www.kernel.org |
24 |
+Desc: Linux 4.2.2 |
25 |
+ |
26 |
Patch: 1500_XATTR_USER_PREFIX.patch |
27 |
From: https://bugs.gentoo.org/show_bug.cgi?id=470644 |
28 |
Desc: Support for namespace user.pax.* on tmpfs. |
29 |
|
30 |
diff --git a/1001_linux-4.2.2.patch b/1001_linux-4.2.2.patch |
31 |
new file mode 100644 |
32 |
index 0000000..6e64028 |
33 |
--- /dev/null |
34 |
+++ b/1001_linux-4.2.2.patch |
35 |
@@ -0,0 +1,5014 @@ |
36 |
+diff --git a/Makefile b/Makefile |
37 |
+index a03efc18aa48..3578b4426ecf 100644 |
38 |
+--- a/Makefile |
39 |
++++ b/Makefile |
40 |
+@@ -1,6 +1,6 @@ |
41 |
+ VERSION = 4 |
42 |
+ PATCHLEVEL = 2 |
43 |
+-SUBLEVEL = 1 |
44 |
++SUBLEVEL = 2 |
45 |
+ EXTRAVERSION = |
46 |
+ NAME = Hurr durr I'ma sheep |
47 |
+ |
48 |
+diff --git a/arch/arm/boot/compressed/decompress.c b/arch/arm/boot/compressed/decompress.c |
49 |
+index bd245d34952d..a0765e7ed6c7 100644 |
50 |
+--- a/arch/arm/boot/compressed/decompress.c |
51 |
++++ b/arch/arm/boot/compressed/decompress.c |
52 |
+@@ -57,5 +57,5 @@ extern char * strstr(const char * s1, const char *s2); |
53 |
+ |
54 |
+ int do_decompress(u8 *input, int len, u8 *output, void (*error)(char *x)) |
55 |
+ { |
56 |
+- return decompress(input, len, NULL, NULL, output, NULL, error); |
57 |
++ return __decompress(input, len, NULL, NULL, output, 0, NULL, error); |
58 |
+ } |
59 |
+diff --git a/arch/arm/kvm/arm.c b/arch/arm/kvm/arm.c |
60 |
+index bc738d2b8392..f9c341c5ae78 100644 |
61 |
+--- a/arch/arm/kvm/arm.c |
62 |
++++ b/arch/arm/kvm/arm.c |
63 |
+@@ -449,7 +449,7 @@ static int kvm_vcpu_first_run_init(struct kvm_vcpu *vcpu) |
64 |
+ * Map the VGIC hardware resources before running a vcpu the first |
65 |
+ * time on this VM. |
66 |
+ */ |
67 |
+- if (unlikely(!vgic_ready(kvm))) { |
68 |
++ if (unlikely(irqchip_in_kernel(kvm) && !vgic_ready(kvm))) { |
69 |
+ ret = kvm_vgic_map_resources(kvm); |
70 |
+ if (ret) |
71 |
+ return ret; |
72 |
+diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig |
73 |
+index 318175f62c24..735456feb08e 100644 |
74 |
+--- a/arch/arm64/Kconfig |
75 |
++++ b/arch/arm64/Kconfig |
76 |
+@@ -104,6 +104,10 @@ config NO_IOPORT_MAP |
77 |
+ config STACKTRACE_SUPPORT |
78 |
+ def_bool y |
79 |
+ |
80 |
++config ILLEGAL_POINTER_VALUE |
81 |
++ hex |
82 |
++ default 0xdead000000000000 |
83 |
++ |
84 |
+ config LOCKDEP_SUPPORT |
85 |
+ def_bool y |
86 |
+ |
87 |
+@@ -417,6 +421,22 @@ config ARM64_ERRATUM_845719 |
88 |
+ |
89 |
+ If unsure, say Y. |
90 |
+ |
91 |
++config ARM64_ERRATUM_843419 |
92 |
++ bool "Cortex-A53: 843419: A load or store might access an incorrect address" |
93 |
++ depends on MODULES |
94 |
++ default y |
95 |
++ help |
96 |
++ This option builds kernel modules using the large memory model in |
97 |
++ order to avoid the use of the ADRP instruction, which can cause |
98 |
++ a subsequent memory access to use an incorrect address on Cortex-A53 |
99 |
++ parts up to r0p4. |
100 |
++ |
101 |
++ Note that the kernel itself must be linked with a version of ld |
102 |
++ which fixes potentially affected ADRP instructions through the |
103 |
++ use of veneers. |
104 |
++ |
105 |
++ If unsure, say Y. |
106 |
++ |
107 |
+ endmenu |
108 |
+ |
109 |
+ |
110 |
+diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile |
111 |
+index 4d2a925998f9..81151663ef38 100644 |
112 |
+--- a/arch/arm64/Makefile |
113 |
++++ b/arch/arm64/Makefile |
114 |
+@@ -30,6 +30,10 @@ endif |
115 |
+ |
116 |
+ CHECKFLAGS += -D__aarch64__ |
117 |
+ |
118 |
++ifeq ($(CONFIG_ARM64_ERRATUM_843419), y) |
119 |
++CFLAGS_MODULE += -mcmodel=large |
120 |
++endif |
121 |
++ |
122 |
+ # Default value |
123 |
+ head-y := arch/arm64/kernel/head.o |
124 |
+ |
125 |
+diff --git a/arch/arm64/include/asm/memory.h b/arch/arm64/include/asm/memory.h |
126 |
+index f800d45ea226..44a59c20e773 100644 |
127 |
+--- a/arch/arm64/include/asm/memory.h |
128 |
++++ b/arch/arm64/include/asm/memory.h |
129 |
+@@ -114,6 +114,14 @@ extern phys_addr_t memstart_addr; |
130 |
+ #define PHYS_OFFSET ({ memstart_addr; }) |
131 |
+ |
132 |
+ /* |
133 |
++ * The maximum physical address that the linear direct mapping |
134 |
++ * of system RAM can cover. (PAGE_OFFSET can be interpreted as |
135 |
++ * a 2's complement signed quantity and negated to derive the |
136 |
++ * maximum size of the linear mapping.) |
137 |
++ */ |
138 |
++#define MAX_MEMBLOCK_ADDR ({ memstart_addr - PAGE_OFFSET - 1; }) |
139 |
++ |
140 |
++/* |
141 |
+ * PFNs are used to describe any physical page; this means |
142 |
+ * PFN 0 == physical address 0. |
143 |
+ * |
144 |
+diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S |
145 |
+index e16351819fed..8213ca15abd2 100644 |
146 |
+--- a/arch/arm64/kernel/entry.S |
147 |
++++ b/arch/arm64/kernel/entry.S |
148 |
+@@ -116,7 +116,7 @@ |
149 |
+ */ |
150 |
+ .endm |
151 |
+ |
152 |
+- .macro kernel_exit, el, ret = 0 |
153 |
++ .macro kernel_exit, el |
154 |
+ ldp x21, x22, [sp, #S_PC] // load ELR, SPSR |
155 |
+ .if \el == 0 |
156 |
+ ct_user_enter |
157 |
+@@ -146,11 +146,7 @@ |
158 |
+ .endif |
159 |
+ msr elr_el1, x21 // set up the return data |
160 |
+ msr spsr_el1, x22 |
161 |
+- .if \ret |
162 |
+- ldr x1, [sp, #S_X1] // preserve x0 (syscall return) |
163 |
+- .else |
164 |
+ ldp x0, x1, [sp, #16 * 0] |
165 |
+- .endif |
166 |
+ ldp x2, x3, [sp, #16 * 1] |
167 |
+ ldp x4, x5, [sp, #16 * 2] |
168 |
+ ldp x6, x7, [sp, #16 * 3] |
169 |
+@@ -613,22 +609,21 @@ ENDPROC(cpu_switch_to) |
170 |
+ */ |
171 |
+ ret_fast_syscall: |
172 |
+ disable_irq // disable interrupts |
173 |
++ str x0, [sp, #S_X0] // returned x0 |
174 |
+ ldr x1, [tsk, #TI_FLAGS] // re-check for syscall tracing |
175 |
+ and x2, x1, #_TIF_SYSCALL_WORK |
176 |
+ cbnz x2, ret_fast_syscall_trace |
177 |
+ and x2, x1, #_TIF_WORK_MASK |
178 |
+- cbnz x2, fast_work_pending |
179 |
++ cbnz x2, work_pending |
180 |
+ enable_step_tsk x1, x2 |
181 |
+- kernel_exit 0, ret = 1 |
182 |
++ kernel_exit 0 |
183 |
+ ret_fast_syscall_trace: |
184 |
+ enable_irq // enable interrupts |
185 |
+- b __sys_trace_return |
186 |
++ b __sys_trace_return_skipped // we already saved x0 |
187 |
+ |
188 |
+ /* |
189 |
+ * Ok, we need to do extra processing, enter the slow path. |
190 |
+ */ |
191 |
+-fast_work_pending: |
192 |
+- str x0, [sp, #S_X0] // returned x0 |
193 |
+ work_pending: |
194 |
+ tbnz x1, #TIF_NEED_RESCHED, work_resched |
195 |
+ /* TIF_SIGPENDING, TIF_NOTIFY_RESUME or TIF_FOREIGN_FPSTATE case */ |
196 |
+@@ -652,7 +647,7 @@ ret_to_user: |
197 |
+ cbnz x2, work_pending |
198 |
+ enable_step_tsk x1, x2 |
199 |
+ no_work_pending: |
200 |
+- kernel_exit 0, ret = 0 |
201 |
++ kernel_exit 0 |
202 |
+ ENDPROC(ret_to_user) |
203 |
+ |
204 |
+ /* |
205 |
+diff --git a/arch/arm64/kernel/fpsimd.c b/arch/arm64/kernel/fpsimd.c |
206 |
+index 44d6f7545505..c56956a16d3f 100644 |
207 |
+--- a/arch/arm64/kernel/fpsimd.c |
208 |
++++ b/arch/arm64/kernel/fpsimd.c |
209 |
+@@ -158,6 +158,7 @@ void fpsimd_thread_switch(struct task_struct *next) |
210 |
+ void fpsimd_flush_thread(void) |
211 |
+ { |
212 |
+ memset(¤t->thread.fpsimd_state, 0, sizeof(struct fpsimd_state)); |
213 |
++ fpsimd_flush_task_state(current); |
214 |
+ set_thread_flag(TIF_FOREIGN_FPSTATE); |
215 |
+ } |
216 |
+ |
217 |
+diff --git a/arch/arm64/kernel/head.S b/arch/arm64/kernel/head.S |
218 |
+index c0ff3ce4299e..370541162658 100644 |
219 |
+--- a/arch/arm64/kernel/head.S |
220 |
++++ b/arch/arm64/kernel/head.S |
221 |
+@@ -528,6 +528,11 @@ CPU_LE( movk x0, #0x30d0, lsl #16 ) // Clear EE and E0E on LE systems |
222 |
+ msr hstr_el2, xzr // Disable CP15 traps to EL2 |
223 |
+ #endif |
224 |
+ |
225 |
++ /* EL2 debug */ |
226 |
++ mrs x0, pmcr_el0 // Disable debug access traps |
227 |
++ ubfx x0, x0, #11, #5 // to EL2 and allow access to |
228 |
++ msr mdcr_el2, x0 // all PMU counters from EL1 |
229 |
++ |
230 |
+ /* Stage-2 translation */ |
231 |
+ msr vttbr_el2, xzr |
232 |
+ |
233 |
+diff --git a/arch/arm64/kernel/module.c b/arch/arm64/kernel/module.c |
234 |
+index 67bf4107f6ef..876eb8df50bf 100644 |
235 |
+--- a/arch/arm64/kernel/module.c |
236 |
++++ b/arch/arm64/kernel/module.c |
237 |
+@@ -332,12 +332,14 @@ int apply_relocate_add(Elf64_Shdr *sechdrs, |
238 |
+ ovf = reloc_insn_imm(RELOC_OP_PREL, loc, val, 0, 21, |
239 |
+ AARCH64_INSN_IMM_ADR); |
240 |
+ break; |
241 |
++#ifndef CONFIG_ARM64_ERRATUM_843419 |
242 |
+ case R_AARCH64_ADR_PREL_PG_HI21_NC: |
243 |
+ overflow_check = false; |
244 |
+ case R_AARCH64_ADR_PREL_PG_HI21: |
245 |
+ ovf = reloc_insn_imm(RELOC_OP_PAGE, loc, val, 12, 21, |
246 |
+ AARCH64_INSN_IMM_ADR); |
247 |
+ break; |
248 |
++#endif |
249 |
+ case R_AARCH64_ADD_ABS_LO12_NC: |
250 |
+ case R_AARCH64_LDST8_ABS_LO12_NC: |
251 |
+ overflow_check = false; |
252 |
+diff --git a/arch/arm64/kernel/signal32.c b/arch/arm64/kernel/signal32.c |
253 |
+index 948f0ad2de23..71ef6dc89ae5 100644 |
254 |
+--- a/arch/arm64/kernel/signal32.c |
255 |
++++ b/arch/arm64/kernel/signal32.c |
256 |
+@@ -212,14 +212,32 @@ int copy_siginfo_from_user32(siginfo_t *to, compat_siginfo_t __user *from) |
257 |
+ |
258 |
+ /* |
259 |
+ * VFP save/restore code. |
260 |
++ * |
261 |
++ * We have to be careful with endianness, since the fpsimd context-switch |
262 |
++ * code operates on 128-bit (Q) register values whereas the compat ABI |
263 |
++ * uses an array of 64-bit (D) registers. Consequently, we need to swap |
264 |
++ * the two halves of each Q register when running on a big-endian CPU. |
265 |
+ */ |
266 |
++union __fpsimd_vreg { |
267 |
++ __uint128_t raw; |
268 |
++ struct { |
269 |
++#ifdef __AARCH64EB__ |
270 |
++ u64 hi; |
271 |
++ u64 lo; |
272 |
++#else |
273 |
++ u64 lo; |
274 |
++ u64 hi; |
275 |
++#endif |
276 |
++ }; |
277 |
++}; |
278 |
++ |
279 |
+ static int compat_preserve_vfp_context(struct compat_vfp_sigframe __user *frame) |
280 |
+ { |
281 |
+ struct fpsimd_state *fpsimd = ¤t->thread.fpsimd_state; |
282 |
+ compat_ulong_t magic = VFP_MAGIC; |
283 |
+ compat_ulong_t size = VFP_STORAGE_SIZE; |
284 |
+ compat_ulong_t fpscr, fpexc; |
285 |
+- int err = 0; |
286 |
++ int i, err = 0; |
287 |
+ |
288 |
+ /* |
289 |
+ * Save the hardware registers to the fpsimd_state structure. |
290 |
+@@ -235,10 +253,15 @@ static int compat_preserve_vfp_context(struct compat_vfp_sigframe __user *frame) |
291 |
+ /* |
292 |
+ * Now copy the FP registers. Since the registers are packed, |
293 |
+ * we can copy the prefix we want (V0-V15) as it is. |
294 |
+- * FIXME: Won't work if big endian. |
295 |
+ */ |
296 |
+- err |= __copy_to_user(&frame->ufp.fpregs, fpsimd->vregs, |
297 |
+- sizeof(frame->ufp.fpregs)); |
298 |
++ for (i = 0; i < ARRAY_SIZE(frame->ufp.fpregs); i += 2) { |
299 |
++ union __fpsimd_vreg vreg = { |
300 |
++ .raw = fpsimd->vregs[i >> 1], |
301 |
++ }; |
302 |
++ |
303 |
++ __put_user_error(vreg.lo, &frame->ufp.fpregs[i], err); |
304 |
++ __put_user_error(vreg.hi, &frame->ufp.fpregs[i + 1], err); |
305 |
++ } |
306 |
+ |
307 |
+ /* Create an AArch32 fpscr from the fpsr and the fpcr. */ |
308 |
+ fpscr = (fpsimd->fpsr & VFP_FPSCR_STAT_MASK) | |
309 |
+@@ -263,7 +286,7 @@ static int compat_restore_vfp_context(struct compat_vfp_sigframe __user *frame) |
310 |
+ compat_ulong_t magic = VFP_MAGIC; |
311 |
+ compat_ulong_t size = VFP_STORAGE_SIZE; |
312 |
+ compat_ulong_t fpscr; |
313 |
+- int err = 0; |
314 |
++ int i, err = 0; |
315 |
+ |
316 |
+ __get_user_error(magic, &frame->magic, err); |
317 |
+ __get_user_error(size, &frame->size, err); |
318 |
+@@ -273,12 +296,14 @@ static int compat_restore_vfp_context(struct compat_vfp_sigframe __user *frame) |
319 |
+ if (magic != VFP_MAGIC || size != VFP_STORAGE_SIZE) |
320 |
+ return -EINVAL; |
321 |
+ |
322 |
+- /* |
323 |
+- * Copy the FP registers into the start of the fpsimd_state. |
324 |
+- * FIXME: Won't work if big endian. |
325 |
+- */ |
326 |
+- err |= __copy_from_user(fpsimd.vregs, frame->ufp.fpregs, |
327 |
+- sizeof(frame->ufp.fpregs)); |
328 |
++ /* Copy the FP registers into the start of the fpsimd_state. */ |
329 |
++ for (i = 0; i < ARRAY_SIZE(frame->ufp.fpregs); i += 2) { |
330 |
++ union __fpsimd_vreg vreg; |
331 |
++ |
332 |
++ __get_user_error(vreg.lo, &frame->ufp.fpregs[i], err); |
333 |
++ __get_user_error(vreg.hi, &frame->ufp.fpregs[i + 1], err); |
334 |
++ fpsimd.vregs[i >> 1] = vreg.raw; |
335 |
++ } |
336 |
+ |
337 |
+ /* Extract the fpsr and the fpcr from the fpscr */ |
338 |
+ __get_user_error(fpscr, &frame->ufp.fpscr, err); |
339 |
+diff --git a/arch/arm64/kvm/hyp.S b/arch/arm64/kvm/hyp.S |
340 |
+index 17a8fb14f428..3c6051cbf442 100644 |
341 |
+--- a/arch/arm64/kvm/hyp.S |
342 |
++++ b/arch/arm64/kvm/hyp.S |
343 |
+@@ -840,8 +840,6 @@ |
344 |
+ mrs x3, cntv_ctl_el0 |
345 |
+ and x3, x3, #3 |
346 |
+ str w3, [x0, #VCPU_TIMER_CNTV_CTL] |
347 |
+- bic x3, x3, #1 // Clear Enable |
348 |
+- msr cntv_ctl_el0, x3 |
349 |
+ |
350 |
+ isb |
351 |
+ |
352 |
+@@ -849,6 +847,9 @@ |
353 |
+ str x3, [x0, #VCPU_TIMER_CNTV_CVAL] |
354 |
+ |
355 |
+ 1: |
356 |
++ // Disable the virtual timer |
357 |
++ msr cntv_ctl_el0, xzr |
358 |
++ |
359 |
+ // Allow physical timer/counter access for the host |
360 |
+ mrs x2, cnthctl_el2 |
361 |
+ orr x2, x2, #3 |
362 |
+@@ -943,13 +944,15 @@ ENTRY(__kvm_vcpu_run) |
363 |
+ // Guest context |
364 |
+ add x2, x0, #VCPU_CONTEXT |
365 |
+ |
366 |
++ // We must restore the 32-bit state before the sysregs, thanks |
367 |
++ // to Cortex-A57 erratum #852523. |
368 |
++ restore_guest_32bit_state |
369 |
+ bl __restore_sysregs |
370 |
+ bl __restore_fpsimd |
371 |
+ |
372 |
+ skip_debug_state x3, 1f |
373 |
+ bl __restore_debug |
374 |
+ 1: |
375 |
+- restore_guest_32bit_state |
376 |
+ restore_guest_regs |
377 |
+ |
378 |
+ // That's it, no more messing around. |
379 |
+diff --git a/arch/h8300/boot/compressed/misc.c b/arch/h8300/boot/compressed/misc.c |
380 |
+index 704274127c07..c4f2cfcb117b 100644 |
381 |
+--- a/arch/h8300/boot/compressed/misc.c |
382 |
++++ b/arch/h8300/boot/compressed/misc.c |
383 |
+@@ -70,5 +70,5 @@ void decompress_kernel(void) |
384 |
+ free_mem_ptr = (unsigned long)&_end; |
385 |
+ free_mem_end_ptr = free_mem_ptr + HEAP_SIZE; |
386 |
+ |
387 |
+- decompress(input_data, input_len, NULL, NULL, output, NULL, error); |
388 |
++ __decompress(input_data, input_len, NULL, NULL, output, 0, NULL, error); |
389 |
+ } |
390 |
+diff --git a/arch/m32r/boot/compressed/misc.c b/arch/m32r/boot/compressed/misc.c |
391 |
+index 28a09529f206..3a7692745868 100644 |
392 |
+--- a/arch/m32r/boot/compressed/misc.c |
393 |
++++ b/arch/m32r/boot/compressed/misc.c |
394 |
+@@ -86,6 +86,7 @@ decompress_kernel(int mmu_on, unsigned char *zimage_data, |
395 |
+ free_mem_end_ptr = free_mem_ptr + BOOT_HEAP_SIZE; |
396 |
+ |
397 |
+ puts("\nDecompressing Linux... "); |
398 |
+- decompress(input_data, input_len, NULL, NULL, output_data, NULL, error); |
399 |
++ __decompress(input_data, input_len, NULL, NULL, output_data, 0, |
400 |
++ NULL, error); |
401 |
+ puts("done.\nBooting the kernel.\n"); |
402 |
+ } |
403 |
+diff --git a/arch/mips/boot/compressed/decompress.c b/arch/mips/boot/compressed/decompress.c |
404 |
+index 54831069a206..080cd53bac36 100644 |
405 |
+--- a/arch/mips/boot/compressed/decompress.c |
406 |
++++ b/arch/mips/boot/compressed/decompress.c |
407 |
+@@ -111,8 +111,8 @@ void decompress_kernel(unsigned long boot_heap_start) |
408 |
+ puts("\n"); |
409 |
+ |
410 |
+ /* Decompress the kernel with according algorithm */ |
411 |
+- decompress((char *)zimage_start, zimage_size, 0, 0, |
412 |
+- (void *)VMLINUX_LOAD_ADDRESS_ULL, 0, error); |
413 |
++ __decompress((char *)zimage_start, zimage_size, 0, 0, |
414 |
++ (void *)VMLINUX_LOAD_ADDRESS_ULL, 0, 0, error); |
415 |
+ |
416 |
+ /* FIXME: should we flush cache here? */ |
417 |
+ puts("Now, booting the kernel...\n"); |
418 |
+diff --git a/arch/mips/kernel/cps-vec.S b/arch/mips/kernel/cps-vec.S |
419 |
+index 1b6ca634e646..9f71c06aebf6 100644 |
420 |
+--- a/arch/mips/kernel/cps-vec.S |
421 |
++++ b/arch/mips/kernel/cps-vec.S |
422 |
+@@ -152,7 +152,7 @@ dcache_done: |
423 |
+ |
424 |
+ /* Enter the coherent domain */ |
425 |
+ li t0, 0xff |
426 |
+- PTR_S t0, GCR_CL_COHERENCE_OFS(v1) |
427 |
++ sw t0, GCR_CL_COHERENCE_OFS(v1) |
428 |
+ ehb |
429 |
+ |
430 |
+ /* Jump to kseg0 */ |
431 |
+@@ -302,7 +302,7 @@ LEAF(mips_cps_boot_vpes) |
432 |
+ PTR_L t0, 0(t0) |
433 |
+ |
434 |
+ /* Calculate a pointer to this cores struct core_boot_config */ |
435 |
+- PTR_L t0, GCR_CL_ID_OFS(t0) |
436 |
++ lw t0, GCR_CL_ID_OFS(t0) |
437 |
+ li t1, COREBOOTCFG_SIZE |
438 |
+ mul t0, t0, t1 |
439 |
+ PTR_LA t1, mips_cps_core_bootcfg |
440 |
+diff --git a/arch/mips/math-emu/cp1emu.c b/arch/mips/math-emu/cp1emu.c |
441 |
+index 712f17a2ecf2..f0f1b98a5fde 100644 |
442 |
+--- a/arch/mips/math-emu/cp1emu.c |
443 |
++++ b/arch/mips/math-emu/cp1emu.c |
444 |
+@@ -1137,7 +1137,7 @@ emul: |
445 |
+ break; |
446 |
+ |
447 |
+ case mfhc_op: |
448 |
+- if (!cpu_has_mips_r2) |
449 |
++ if (!cpu_has_mips_r2_r6) |
450 |
+ goto sigill; |
451 |
+ |
452 |
+ /* copregister rd -> gpr[rt] */ |
453 |
+@@ -1148,7 +1148,7 @@ emul: |
454 |
+ break; |
455 |
+ |
456 |
+ case mthc_op: |
457 |
+- if (!cpu_has_mips_r2) |
458 |
++ if (!cpu_has_mips_r2_r6) |
459 |
+ goto sigill; |
460 |
+ |
461 |
+ /* copregister rd <- gpr[rt] */ |
462 |
+@@ -1181,6 +1181,24 @@ emul: |
463 |
+ } |
464 |
+ break; |
465 |
+ |
466 |
++ case bc1eqz_op: |
467 |
++ case bc1nez_op: |
468 |
++ if (!cpu_has_mips_r6 || delay_slot(xcp)) |
469 |
++ return SIGILL; |
470 |
++ |
471 |
++ cond = likely = 0; |
472 |
++ switch (MIPSInst_RS(ir)) { |
473 |
++ case bc1eqz_op: |
474 |
++ if (get_fpr32(¤t->thread.fpu.fpr[MIPSInst_RT(ir)], 0) & 0x1) |
475 |
++ cond = 1; |
476 |
++ break; |
477 |
++ case bc1nez_op: |
478 |
++ if (!(get_fpr32(¤t->thread.fpu.fpr[MIPSInst_RT(ir)], 0) & 0x1)) |
479 |
++ cond = 1; |
480 |
++ break; |
481 |
++ } |
482 |
++ goto branch_common; |
483 |
++ |
484 |
+ case bc_op: |
485 |
+ if (delay_slot(xcp)) |
486 |
+ return SIGILL; |
487 |
+@@ -1207,7 +1225,7 @@ emul: |
488 |
+ case bct_op: |
489 |
+ break; |
490 |
+ } |
491 |
+- |
492 |
++branch_common: |
493 |
+ set_delay_slot(xcp); |
494 |
+ if (cond) { |
495 |
+ /* |
496 |
+diff --git a/arch/parisc/kernel/irq.c b/arch/parisc/kernel/irq.c |
497 |
+index f3191db6e2e9..c0eab24f6a9e 100644 |
498 |
+--- a/arch/parisc/kernel/irq.c |
499 |
++++ b/arch/parisc/kernel/irq.c |
500 |
+@@ -507,8 +507,8 @@ void do_cpu_irq_mask(struct pt_regs *regs) |
501 |
+ struct pt_regs *old_regs; |
502 |
+ unsigned long eirr_val; |
503 |
+ int irq, cpu = smp_processor_id(); |
504 |
+-#ifdef CONFIG_SMP |
505 |
+ struct irq_desc *desc; |
506 |
++#ifdef CONFIG_SMP |
507 |
+ cpumask_t dest; |
508 |
+ #endif |
509 |
+ |
510 |
+@@ -521,8 +521,12 @@ void do_cpu_irq_mask(struct pt_regs *regs) |
511 |
+ goto set_out; |
512 |
+ irq = eirr_to_irq(eirr_val); |
513 |
+ |
514 |
+-#ifdef CONFIG_SMP |
515 |
++ /* Filter out spurious interrupts, mostly from serial port at bootup */ |
516 |
+ desc = irq_to_desc(irq); |
517 |
++ if (unlikely(!desc->action)) |
518 |
++ goto set_out; |
519 |
++ |
520 |
++#ifdef CONFIG_SMP |
521 |
+ cpumask_copy(&dest, desc->irq_data.affinity); |
522 |
+ if (irqd_is_per_cpu(&desc->irq_data) && |
523 |
+ !cpumask_test_cpu(smp_processor_id(), &dest)) { |
524 |
+diff --git a/arch/parisc/kernel/syscall.S b/arch/parisc/kernel/syscall.S |
525 |
+index 7ef22e3387e0..0b8d26d3ba43 100644 |
526 |
+--- a/arch/parisc/kernel/syscall.S |
527 |
++++ b/arch/parisc/kernel/syscall.S |
528 |
+@@ -821,7 +821,7 @@ cas2_action: |
529 |
+ /* 64bit CAS */ |
530 |
+ #ifdef CONFIG_64BIT |
531 |
+ 19: ldd,ma 0(%sr3,%r26), %r29 |
532 |
+- sub,= %r29, %r25, %r0 |
533 |
++ sub,*= %r29, %r25, %r0 |
534 |
+ b,n cas2_end |
535 |
+ 20: std,ma %r24, 0(%sr3,%r26) |
536 |
+ copy %r0, %r28 |
537 |
+diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile |
538 |
+index 73eddda53b8e..4eec430d8fa8 100644 |
539 |
+--- a/arch/powerpc/boot/Makefile |
540 |
++++ b/arch/powerpc/boot/Makefile |
541 |
+@@ -28,6 +28,9 @@ BOOTCFLAGS += -m64 |
542 |
+ endif |
543 |
+ ifdef CONFIG_CPU_BIG_ENDIAN |
544 |
+ BOOTCFLAGS += -mbig-endian |
545 |
++else |
546 |
++BOOTCFLAGS += -mlittle-endian |
547 |
++BOOTCFLAGS += $(call cc-option,-mabi=elfv2) |
548 |
+ endif |
549 |
+ |
550 |
+ BOOTAFLAGS := -D__ASSEMBLY__ $(BOOTCFLAGS) -traditional -nostdinc |
551 |
+diff --git a/arch/powerpc/include/asm/pgtable-ppc64.h b/arch/powerpc/include/asm/pgtable-ppc64.h |
552 |
+index 3bb7488bd24b..7ee2300ee392 100644 |
553 |
+--- a/arch/powerpc/include/asm/pgtable-ppc64.h |
554 |
++++ b/arch/powerpc/include/asm/pgtable-ppc64.h |
555 |
+@@ -135,7 +135,19 @@ |
556 |
+ #define pte_iterate_hashed_end() } while(0) |
557 |
+ |
558 |
+ #ifdef CONFIG_PPC_HAS_HASH_64K |
559 |
+-#define pte_pagesize_index(mm, addr, pte) get_slice_psize(mm, addr) |
560 |
++/* |
561 |
++ * We expect this to be called only for user addresses or kernel virtual |
562 |
++ * addresses other than the linear mapping. |
563 |
++ */ |
564 |
++#define pte_pagesize_index(mm, addr, pte) \ |
565 |
++ ({ \ |
566 |
++ unsigned int psize; \ |
567 |
++ if (is_kernel_addr(addr)) \ |
568 |
++ psize = MMU_PAGE_4K; \ |
569 |
++ else \ |
570 |
++ psize = get_slice_psize(mm, addr); \ |
571 |
++ psize; \ |
572 |
++ }) |
573 |
+ #else |
574 |
+ #define pte_pagesize_index(mm, addr, pte) MMU_PAGE_4K |
575 |
+ #endif |
576 |
+diff --git a/arch/powerpc/include/asm/rtas.h b/arch/powerpc/include/asm/rtas.h |
577 |
+index 7a4ede16b283..b77ef369c0f0 100644 |
578 |
+--- a/arch/powerpc/include/asm/rtas.h |
579 |
++++ b/arch/powerpc/include/asm/rtas.h |
580 |
+@@ -343,6 +343,7 @@ extern void rtas_power_off(void); |
581 |
+ extern void rtas_halt(void); |
582 |
+ extern void rtas_os_term(char *str); |
583 |
+ extern int rtas_get_sensor(int sensor, int index, int *state); |
584 |
++extern int rtas_get_sensor_fast(int sensor, int index, int *state); |
585 |
+ extern int rtas_get_power_level(int powerdomain, int *level); |
586 |
+ extern int rtas_set_power_level(int powerdomain, int level, int *setlevel); |
587 |
+ extern bool rtas_indicator_present(int token, int *maxindex); |
588 |
+diff --git a/arch/powerpc/include/asm/switch_to.h b/arch/powerpc/include/asm/switch_to.h |
589 |
+index 58abeda64cb7..15cca17cba4b 100644 |
590 |
+--- a/arch/powerpc/include/asm/switch_to.h |
591 |
++++ b/arch/powerpc/include/asm/switch_to.h |
592 |
+@@ -29,6 +29,7 @@ static inline void save_early_sprs(struct thread_struct *prev) {} |
593 |
+ |
594 |
+ extern void enable_kernel_fp(void); |
595 |
+ extern void enable_kernel_altivec(void); |
596 |
++extern void enable_kernel_vsx(void); |
597 |
+ extern int emulate_altivec(struct pt_regs *); |
598 |
+ extern void __giveup_vsx(struct task_struct *); |
599 |
+ extern void giveup_vsx(struct task_struct *); |
600 |
+diff --git a/arch/powerpc/kernel/eeh.c b/arch/powerpc/kernel/eeh.c |
601 |
+index af9b597b10af..01c961d5d2de 100644 |
602 |
+--- a/arch/powerpc/kernel/eeh.c |
603 |
++++ b/arch/powerpc/kernel/eeh.c |
604 |
+@@ -308,11 +308,26 @@ void eeh_slot_error_detail(struct eeh_pe *pe, int severity) |
605 |
+ if (!(pe->type & EEH_PE_PHB)) { |
606 |
+ if (eeh_has_flag(EEH_ENABLE_IO_FOR_LOG)) |
607 |
+ eeh_pci_enable(pe, EEH_OPT_THAW_MMIO); |
608 |
++ |
609 |
++ /* |
610 |
++ * The config space of some PCI devices can't be accessed |
611 |
++ * when their PEs are in frozen state. Otherwise, fenced |
612 |
++ * PHB might be seen. Those PEs are identified with flag |
613 |
++ * EEH_PE_CFG_RESTRICTED, indicating EEH_PE_CFG_BLOCKED |
614 |
++ * is set automatically when the PE is put to EEH_PE_ISOLATED. |
615 |
++ * |
616 |
++ * Restoring BARs possibly triggers PCI config access in |
617 |
++ * (OPAL) firmware and then causes fenced PHB. If the |
618 |
++ * PCI config is blocked with flag EEH_PE_CFG_BLOCKED, it's |
619 |
++ * pointless to restore BARs and dump config space. |
620 |
++ */ |
621 |
+ eeh_ops->configure_bridge(pe); |
622 |
+- eeh_pe_restore_bars(pe); |
623 |
++ if (!(pe->state & EEH_PE_CFG_BLOCKED)) { |
624 |
++ eeh_pe_restore_bars(pe); |
625 |
+ |
626 |
+- pci_regs_buf[0] = 0; |
627 |
+- eeh_pe_traverse(pe, eeh_dump_pe_log, &loglen); |
628 |
++ pci_regs_buf[0] = 0; |
629 |
++ eeh_pe_traverse(pe, eeh_dump_pe_log, &loglen); |
630 |
++ } |
631 |
+ } |
632 |
+ |
633 |
+ eeh_ops->get_log(pe, severity, pci_regs_buf, loglen); |
634 |
+@@ -1116,9 +1131,6 @@ void eeh_add_device_late(struct pci_dev *dev) |
635 |
+ return; |
636 |
+ } |
637 |
+ |
638 |
+- if (eeh_has_flag(EEH_PROBE_MODE_DEV)) |
639 |
+- eeh_ops->probe(pdn, NULL); |
640 |
+- |
641 |
+ /* |
642 |
+ * The EEH cache might not be removed correctly because of |
643 |
+ * unbalanced kref to the device during unplug time, which |
644 |
+@@ -1142,6 +1154,9 @@ void eeh_add_device_late(struct pci_dev *dev) |
645 |
+ dev->dev.archdata.edev = NULL; |
646 |
+ } |
647 |
+ |
648 |
++ if (eeh_has_flag(EEH_PROBE_MODE_DEV)) |
649 |
++ eeh_ops->probe(pdn, NULL); |
650 |
++ |
651 |
+ edev->pdev = dev; |
652 |
+ dev->dev.archdata.edev = edev; |
653 |
+ |
654 |
+diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c |
655 |
+index 8005e18d1b40..64e6e9d9e656 100644 |
656 |
+--- a/arch/powerpc/kernel/process.c |
657 |
++++ b/arch/powerpc/kernel/process.c |
658 |
+@@ -204,8 +204,6 @@ EXPORT_SYMBOL_GPL(flush_altivec_to_thread); |
659 |
+ #endif /* CONFIG_ALTIVEC */ |
660 |
+ |
661 |
+ #ifdef CONFIG_VSX |
662 |
+-#if 0 |
663 |
+-/* not currently used, but some crazy RAID module might want to later */ |
664 |
+ void enable_kernel_vsx(void) |
665 |
+ { |
666 |
+ WARN_ON(preemptible()); |
667 |
+@@ -220,7 +218,6 @@ void enable_kernel_vsx(void) |
668 |
+ #endif /* CONFIG_SMP */ |
669 |
+ } |
670 |
+ EXPORT_SYMBOL(enable_kernel_vsx); |
671 |
+-#endif |
672 |
+ |
673 |
+ void giveup_vsx(struct task_struct *tsk) |
674 |
+ { |
675 |
+diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c |
676 |
+index 7a488c108410..caffb10e7aa3 100644 |
677 |
+--- a/arch/powerpc/kernel/rtas.c |
678 |
++++ b/arch/powerpc/kernel/rtas.c |
679 |
+@@ -584,6 +584,23 @@ int rtas_get_sensor(int sensor, int index, int *state) |
680 |
+ } |
681 |
+ EXPORT_SYMBOL(rtas_get_sensor); |
682 |
+ |
683 |
++int rtas_get_sensor_fast(int sensor, int index, int *state) |
684 |
++{ |
685 |
++ int token = rtas_token("get-sensor-state"); |
686 |
++ int rc; |
687 |
++ |
688 |
++ if (token == RTAS_UNKNOWN_SERVICE) |
689 |
++ return -ENOENT; |
690 |
++ |
691 |
++ rc = rtas_call(token, 2, 2, state, sensor, index); |
692 |
++ WARN_ON(rc == RTAS_BUSY || (rc >= RTAS_EXTENDED_DELAY_MIN && |
693 |
++ rc <= RTAS_EXTENDED_DELAY_MAX)); |
694 |
++ |
695 |
++ if (rc < 0) |
696 |
++ return rtas_error_rc(rc); |
697 |
++ return rc; |
698 |
++} |
699 |
++ |
700 |
+ bool rtas_indicator_present(int token, int *maxindex) |
701 |
+ { |
702 |
+ int proplen, count, i; |
703 |
+diff --git a/arch/powerpc/mm/hugepage-hash64.c b/arch/powerpc/mm/hugepage-hash64.c |
704 |
+index 43dafb9d6a46..4d87122cf6a7 100644 |
705 |
+--- a/arch/powerpc/mm/hugepage-hash64.c |
706 |
++++ b/arch/powerpc/mm/hugepage-hash64.c |
707 |
+@@ -85,7 +85,6 @@ int __hash_page_thp(unsigned long ea, unsigned long access, unsigned long vsid, |
708 |
+ BUG_ON(index >= 4096); |
709 |
+ |
710 |
+ vpn = hpt_vpn(ea, vsid, ssize); |
711 |
+- hash = hpt_hash(vpn, shift, ssize); |
712 |
+ hpte_slot_array = get_hpte_slot_array(pmdp); |
713 |
+ if (psize == MMU_PAGE_4K) { |
714 |
+ /* |
715 |
+@@ -101,6 +100,7 @@ int __hash_page_thp(unsigned long ea, unsigned long access, unsigned long vsid, |
716 |
+ valid = hpte_valid(hpte_slot_array, index); |
717 |
+ if (valid) { |
718 |
+ /* update the hpte bits */ |
719 |
++ hash = hpt_hash(vpn, shift, ssize); |
720 |
+ hidx = hpte_hash_index(hpte_slot_array, index); |
721 |
+ if (hidx & _PTEIDX_SECONDARY) |
722 |
+ hash = ~hash; |
723 |
+@@ -126,6 +126,7 @@ int __hash_page_thp(unsigned long ea, unsigned long access, unsigned long vsid, |
724 |
+ if (!valid) { |
725 |
+ unsigned long hpte_group; |
726 |
+ |
727 |
++ hash = hpt_hash(vpn, shift, ssize); |
728 |
+ /* insert new entry */ |
729 |
+ pa = pmd_pfn(__pmd(old_pmd)) << PAGE_SHIFT; |
730 |
+ new_pmd |= _PAGE_HASHPTE; |
731 |
+diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c |
732 |
+index 85cbc96eff6c..8b64f89e68c9 100644 |
733 |
+--- a/arch/powerpc/platforms/powernv/pci-ioda.c |
734 |
++++ b/arch/powerpc/platforms/powernv/pci-ioda.c |
735 |
+@@ -2078,9 +2078,23 @@ static long pnv_pci_ioda2_setup_default_config(struct pnv_ioda_pe *pe) |
736 |
+ struct iommu_table *tbl = NULL; |
737 |
+ long rc; |
738 |
+ |
739 |
++ /* |
740 |
++ * crashkernel= specifies the kdump kernel's maximum memory at |
741 |
++ * some offset and there is no guaranteed the result is a power |
742 |
++ * of 2, which will cause errors later. |
743 |
++ */ |
744 |
++ const u64 max_memory = __rounddown_pow_of_two(memory_hotplug_max()); |
745 |
++ |
746 |
++ /* |
747 |
++ * In memory constrained environments, e.g. kdump kernel, the |
748 |
++ * DMA window can be larger than available memory, which will |
749 |
++ * cause errors later. |
750 |
++ */ |
751 |
++ const u64 window_size = min((u64)pe->table_group.tce32_size, max_memory); |
752 |
++ |
753 |
+ rc = pnv_pci_ioda2_create_table(&pe->table_group, 0, |
754 |
+ IOMMU_PAGE_SHIFT_4K, |
755 |
+- pe->table_group.tce32_size, |
756 |
++ window_size, |
757 |
+ POWERNV_IOMMU_DEFAULT_LEVELS, &tbl); |
758 |
+ if (rc) { |
759 |
+ pe_err(pe, "Failed to create 32-bit TCE table, err %ld", |
760 |
+diff --git a/arch/powerpc/platforms/pseries/dlpar.c b/arch/powerpc/platforms/pseries/dlpar.c |
761 |
+index 47d9cebe7159..db17827eb746 100644 |
762 |
+--- a/arch/powerpc/platforms/pseries/dlpar.c |
763 |
++++ b/arch/powerpc/platforms/pseries/dlpar.c |
764 |
+@@ -422,8 +422,10 @@ static ssize_t dlpar_cpu_probe(const char *buf, size_t count) |
765 |
+ |
766 |
+ dn = dlpar_configure_connector(cpu_to_be32(drc_index), parent); |
767 |
+ of_node_put(parent); |
768 |
+- if (!dn) |
769 |
++ if (!dn) { |
770 |
++ dlpar_release_drc(drc_index); |
771 |
+ return -EINVAL; |
772 |
++ } |
773 |
+ |
774 |
+ rc = dlpar_attach_node(dn); |
775 |
+ if (rc) { |
776 |
+diff --git a/arch/powerpc/platforms/pseries/ras.c b/arch/powerpc/platforms/pseries/ras.c |
777 |
+index 02e4a1745516..3b6647e574b6 100644 |
778 |
+--- a/arch/powerpc/platforms/pseries/ras.c |
779 |
++++ b/arch/powerpc/platforms/pseries/ras.c |
780 |
+@@ -189,7 +189,8 @@ static irqreturn_t ras_epow_interrupt(int irq, void *dev_id) |
781 |
+ int state; |
782 |
+ int critical; |
783 |
+ |
784 |
+- status = rtas_get_sensor(EPOW_SENSOR_TOKEN, EPOW_SENSOR_INDEX, &state); |
785 |
++ status = rtas_get_sensor_fast(EPOW_SENSOR_TOKEN, EPOW_SENSOR_INDEX, |
786 |
++ &state); |
787 |
+ |
788 |
+ if (state > 3) |
789 |
+ critical = 1; /* Time Critical */ |
790 |
+diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c |
791 |
+index df6a7041922b..e6e8b241d717 100644 |
792 |
+--- a/arch/powerpc/platforms/pseries/setup.c |
793 |
++++ b/arch/powerpc/platforms/pseries/setup.c |
794 |
+@@ -268,6 +268,11 @@ static int pci_dn_reconfig_notifier(struct notifier_block *nb, unsigned long act |
795 |
+ eeh_dev_init(PCI_DN(np), pci->phb); |
796 |
+ } |
797 |
+ break; |
798 |
++ case OF_RECONFIG_DETACH_NODE: |
799 |
++ pci = PCI_DN(np); |
800 |
++ if (pci) |
801 |
++ list_del(&pci->list); |
802 |
++ break; |
803 |
+ default: |
804 |
+ err = NOTIFY_DONE; |
805 |
+ break; |
806 |
+diff --git a/arch/s390/boot/compressed/misc.c b/arch/s390/boot/compressed/misc.c |
807 |
+index 42506b371b74..4da604ebf6fd 100644 |
808 |
+--- a/arch/s390/boot/compressed/misc.c |
809 |
++++ b/arch/s390/boot/compressed/misc.c |
810 |
+@@ -167,7 +167,7 @@ unsigned long decompress_kernel(void) |
811 |
+ #endif |
812 |
+ |
813 |
+ puts("Uncompressing Linux... "); |
814 |
+- decompress(input_data, input_len, NULL, NULL, output, NULL, error); |
815 |
++ __decompress(input_data, input_len, NULL, NULL, output, 0, NULL, error); |
816 |
+ puts("Ok, booting the kernel.\n"); |
817 |
+ return (unsigned long) output; |
818 |
+ } |
819 |
+diff --git a/arch/sh/boot/compressed/misc.c b/arch/sh/boot/compressed/misc.c |
820 |
+index 95470a472d2c..208a9753ab38 100644 |
821 |
+--- a/arch/sh/boot/compressed/misc.c |
822 |
++++ b/arch/sh/boot/compressed/misc.c |
823 |
+@@ -132,7 +132,7 @@ void decompress_kernel(void) |
824 |
+ |
825 |
+ puts("Uncompressing Linux... "); |
826 |
+ cache_control(CACHE_ENABLE); |
827 |
+- decompress(input_data, input_len, NULL, NULL, output, NULL, error); |
828 |
++ __decompress(input_data, input_len, NULL, NULL, output, 0, NULL, error); |
829 |
+ cache_control(CACHE_DISABLE); |
830 |
+ puts("Ok, booting the kernel.\n"); |
831 |
+ } |
832 |
+diff --git a/arch/unicore32/boot/compressed/misc.c b/arch/unicore32/boot/compressed/misc.c |
833 |
+index 176d5bda3559..5c65dfee278c 100644 |
834 |
+--- a/arch/unicore32/boot/compressed/misc.c |
835 |
++++ b/arch/unicore32/boot/compressed/misc.c |
836 |
+@@ -119,8 +119,8 @@ unsigned long decompress_kernel(unsigned long output_start, |
837 |
+ output_ptr = get_unaligned_le32(tmp); |
838 |
+ |
839 |
+ arch_decomp_puts("Uncompressing Linux..."); |
840 |
+- decompress(input_data, input_data_end - input_data, NULL, NULL, |
841 |
+- output_data, NULL, error); |
842 |
++ __decompress(input_data, input_data_end - input_data, NULL, NULL, |
843 |
++ output_data, 0, NULL, error); |
844 |
+ arch_decomp_puts(" done, booting the kernel.\n"); |
845 |
+ return output_ptr; |
846 |
+ } |
847 |
+diff --git a/arch/x86/boot/compressed/misc.c b/arch/x86/boot/compressed/misc.c |
848 |
+index a107b935e22f..e28437e0f708 100644 |
849 |
+--- a/arch/x86/boot/compressed/misc.c |
850 |
++++ b/arch/x86/boot/compressed/misc.c |
851 |
+@@ -424,7 +424,8 @@ asmlinkage __visible void *decompress_kernel(void *rmode, memptr heap, |
852 |
+ #endif |
853 |
+ |
854 |
+ debug_putstr("\nDecompressing Linux... "); |
855 |
+- decompress(input_data, input_len, NULL, NULL, output, NULL, error); |
856 |
++ __decompress(input_data, input_len, NULL, NULL, output, output_len, |
857 |
++ NULL, error); |
858 |
+ parse_elf(output); |
859 |
+ /* |
860 |
+ * 32-bit always performs relocations. 64-bit relocations are only |
861 |
+diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c |
862 |
+index 8340e45c891a..68aec42545c2 100644 |
863 |
+--- a/arch/x86/mm/init_32.c |
864 |
++++ b/arch/x86/mm/init_32.c |
865 |
+@@ -137,6 +137,7 @@ page_table_range_init_count(unsigned long start, unsigned long end) |
866 |
+ |
867 |
+ vaddr = start; |
868 |
+ pgd_idx = pgd_index(vaddr); |
869 |
++ pmd_idx = pmd_index(vaddr); |
870 |
+ |
871 |
+ for ( ; (pgd_idx < PTRS_PER_PGD) && (vaddr != end); pgd_idx++) { |
872 |
+ for (; (pmd_idx < PTRS_PER_PMD) && (vaddr != end); |
873 |
+diff --git a/block/blk-flush.c b/block/blk-flush.c |
874 |
+index 20badd7b9d1b..9c423e53324a 100644 |
875 |
+--- a/block/blk-flush.c |
876 |
++++ b/block/blk-flush.c |
877 |
+@@ -73,6 +73,7 @@ |
878 |
+ |
879 |
+ #include "blk.h" |
880 |
+ #include "blk-mq.h" |
881 |
++#include "blk-mq-tag.h" |
882 |
+ |
883 |
+ /* FLUSH/FUA sequences */ |
884 |
+ enum { |
885 |
+@@ -226,7 +227,12 @@ static void flush_end_io(struct request *flush_rq, int error) |
886 |
+ struct blk_flush_queue *fq = blk_get_flush_queue(q, flush_rq->mq_ctx); |
887 |
+ |
888 |
+ if (q->mq_ops) { |
889 |
++ struct blk_mq_hw_ctx *hctx; |
890 |
++ |
891 |
++ /* release the tag's ownership to the req cloned from */ |
892 |
+ spin_lock_irqsave(&fq->mq_flush_lock, flags); |
893 |
++ hctx = q->mq_ops->map_queue(q, flush_rq->mq_ctx->cpu); |
894 |
++ blk_mq_tag_set_rq(hctx, flush_rq->tag, fq->orig_rq); |
895 |
+ flush_rq->tag = -1; |
896 |
+ } |
897 |
+ |
898 |
+@@ -308,11 +314,18 @@ static bool blk_kick_flush(struct request_queue *q, struct blk_flush_queue *fq) |
899 |
+ |
900 |
+ /* |
901 |
+ * Borrow tag from the first request since they can't |
902 |
+- * be in flight at the same time. |
903 |
++ * be in flight at the same time. And acquire the tag's |
904 |
++ * ownership for flush req. |
905 |
+ */ |
906 |
+ if (q->mq_ops) { |
907 |
++ struct blk_mq_hw_ctx *hctx; |
908 |
++ |
909 |
+ flush_rq->mq_ctx = first_rq->mq_ctx; |
910 |
+ flush_rq->tag = first_rq->tag; |
911 |
++ fq->orig_rq = first_rq; |
912 |
++ |
913 |
++ hctx = q->mq_ops->map_queue(q, first_rq->mq_ctx->cpu); |
914 |
++ blk_mq_tag_set_rq(hctx, first_rq->tag, flush_rq); |
915 |
+ } |
916 |
+ |
917 |
+ flush_rq->cmd_type = REQ_TYPE_FS; |
918 |
+diff --git a/block/blk-mq-sysfs.c b/block/blk-mq-sysfs.c |
919 |
+index b79685e06b70..279c5d674edf 100644 |
920 |
+--- a/block/blk-mq-sysfs.c |
921 |
++++ b/block/blk-mq-sysfs.c |
922 |
+@@ -141,15 +141,26 @@ static ssize_t blk_mq_sysfs_completed_show(struct blk_mq_ctx *ctx, char *page) |
923 |
+ |
924 |
+ static ssize_t sysfs_list_show(char *page, struct list_head *list, char *msg) |
925 |
+ { |
926 |
+- char *start_page = page; |
927 |
+ struct request *rq; |
928 |
++ int len = snprintf(page, PAGE_SIZE - 1, "%s:\n", msg); |
929 |
++ |
930 |
++ list_for_each_entry(rq, list, queuelist) { |
931 |
++ const int rq_len = 2 * sizeof(rq) + 2; |
932 |
++ |
933 |
++ /* if the output will be truncated */ |
934 |
++ if (PAGE_SIZE - 1 < len + rq_len) { |
935 |
++ /* backspacing if it can't hold '\t...\n' */ |
936 |
++ if (PAGE_SIZE - 1 < len + 5) |
937 |
++ len -= rq_len; |
938 |
++ len += snprintf(page + len, PAGE_SIZE - 1 - len, |
939 |
++ "\t...\n"); |
940 |
++ break; |
941 |
++ } |
942 |
++ len += snprintf(page + len, PAGE_SIZE - 1 - len, |
943 |
++ "\t%p\n", rq); |
944 |
++ } |
945 |
+ |
946 |
+- page += sprintf(page, "%s:\n", msg); |
947 |
+- |
948 |
+- list_for_each_entry(rq, list, queuelist) |
949 |
+- page += sprintf(page, "\t%p\n", rq); |
950 |
+- |
951 |
+- return page - start_page; |
952 |
++ return len; |
953 |
+ } |
954 |
+ |
955 |
+ static ssize_t blk_mq_sysfs_rq_list_show(struct blk_mq_ctx *ctx, char *page) |
956 |
+diff --git a/block/blk-mq-tag.c b/block/blk-mq-tag.c |
957 |
+index 9b6e28830b82..9115c6d59948 100644 |
958 |
+--- a/block/blk-mq-tag.c |
959 |
++++ b/block/blk-mq-tag.c |
960 |
+@@ -429,7 +429,7 @@ static void bt_for_each(struct blk_mq_hw_ctx *hctx, |
961 |
+ for (bit = find_first_bit(&bm->word, bm->depth); |
962 |
+ bit < bm->depth; |
963 |
+ bit = find_next_bit(&bm->word, bm->depth, bit + 1)) { |
964 |
+- rq = blk_mq_tag_to_rq(hctx->tags, off + bit); |
965 |
++ rq = hctx->tags->rqs[off + bit]; |
966 |
+ if (rq->q == hctx->queue) |
967 |
+ fn(hctx, rq, data, reserved); |
968 |
+ } |
969 |
+@@ -453,7 +453,7 @@ static void bt_tags_for_each(struct blk_mq_tags *tags, |
970 |
+ for (bit = find_first_bit(&bm->word, bm->depth); |
971 |
+ bit < bm->depth; |
972 |
+ bit = find_next_bit(&bm->word, bm->depth, bit + 1)) { |
973 |
+- rq = blk_mq_tag_to_rq(tags, off + bit); |
974 |
++ rq = tags->rqs[off + bit]; |
975 |
+ fn(rq, data, reserved); |
976 |
+ } |
977 |
+ |
978 |
+diff --git a/block/blk-mq-tag.h b/block/blk-mq-tag.h |
979 |
+index 75893a34237d..9eb2cf4f01cb 100644 |
980 |
+--- a/block/blk-mq-tag.h |
981 |
++++ b/block/blk-mq-tag.h |
982 |
+@@ -89,4 +89,16 @@ static inline void blk_mq_tag_idle(struct blk_mq_hw_ctx *hctx) |
983 |
+ __blk_mq_tag_idle(hctx); |
984 |
+ } |
985 |
+ |
986 |
++/* |
987 |
++ * This helper should only be used for flush request to share tag |
988 |
++ * with the request cloned from, and both the two requests can't be |
989 |
++ * in flight at the same time. The caller has to make sure the tag |
990 |
++ * can't be freed. |
991 |
++ */ |
992 |
++static inline void blk_mq_tag_set_rq(struct blk_mq_hw_ctx *hctx, |
993 |
++ unsigned int tag, struct request *rq) |
994 |
++{ |
995 |
++ hctx->tags->rqs[tag] = rq; |
996 |
++} |
997 |
++ |
998 |
+ #endif |
999 |
+diff --git a/block/blk-mq.c b/block/blk-mq.c |
1000 |
+index 7d842db59699..176262ec3731 100644 |
1001 |
+--- a/block/blk-mq.c |
1002 |
++++ b/block/blk-mq.c |
1003 |
+@@ -559,23 +559,9 @@ void blk_mq_abort_requeue_list(struct request_queue *q) |
1004 |
+ } |
1005 |
+ EXPORT_SYMBOL(blk_mq_abort_requeue_list); |
1006 |
+ |
1007 |
+-static inline bool is_flush_request(struct request *rq, |
1008 |
+- struct blk_flush_queue *fq, unsigned int tag) |
1009 |
+-{ |
1010 |
+- return ((rq->cmd_flags & REQ_FLUSH_SEQ) && |
1011 |
+- fq->flush_rq->tag == tag); |
1012 |
+-} |
1013 |
+- |
1014 |
+ struct request *blk_mq_tag_to_rq(struct blk_mq_tags *tags, unsigned int tag) |
1015 |
+ { |
1016 |
+- struct request *rq = tags->rqs[tag]; |
1017 |
+- /* mq_ctx of flush rq is always cloned from the corresponding req */ |
1018 |
+- struct blk_flush_queue *fq = blk_get_flush_queue(rq->q, rq->mq_ctx); |
1019 |
+- |
1020 |
+- if (!is_flush_request(rq, fq, tag)) |
1021 |
+- return rq; |
1022 |
+- |
1023 |
+- return fq->flush_rq; |
1024 |
++ return tags->rqs[tag]; |
1025 |
+ } |
1026 |
+ EXPORT_SYMBOL(blk_mq_tag_to_rq); |
1027 |
+ |
1028 |
+diff --git a/block/blk.h b/block/blk.h |
1029 |
+index 026d9594142b..838188b35a83 100644 |
1030 |
+--- a/block/blk.h |
1031 |
++++ b/block/blk.h |
1032 |
+@@ -22,6 +22,12 @@ struct blk_flush_queue { |
1033 |
+ struct list_head flush_queue[2]; |
1034 |
+ struct list_head flush_data_in_flight; |
1035 |
+ struct request *flush_rq; |
1036 |
++ |
1037 |
++ /* |
1038 |
++ * flush_rq shares tag with this rq, both can't be active |
1039 |
++ * at the same time |
1040 |
++ */ |
1041 |
++ struct request *orig_rq; |
1042 |
+ spinlock_t mq_flush_lock; |
1043 |
+ }; |
1044 |
+ |
1045 |
+diff --git a/drivers/base/node.c b/drivers/base/node.c |
1046 |
+index 31df474d72f4..560751bad294 100644 |
1047 |
+--- a/drivers/base/node.c |
1048 |
++++ b/drivers/base/node.c |
1049 |
+@@ -392,6 +392,16 @@ int register_mem_sect_under_node(struct memory_block *mem_blk, int nid) |
1050 |
+ for (pfn = sect_start_pfn; pfn <= sect_end_pfn; pfn++) { |
1051 |
+ int page_nid; |
1052 |
+ |
1053 |
++ /* |
1054 |
++ * memory block could have several absent sections from start. |
1055 |
++ * skip pfn range from absent section |
1056 |
++ */ |
1057 |
++ if (!pfn_present(pfn)) { |
1058 |
++ pfn = round_down(pfn + PAGES_PER_SECTION, |
1059 |
++ PAGES_PER_SECTION) - 1; |
1060 |
++ continue; |
1061 |
++ } |
1062 |
++ |
1063 |
+ page_nid = get_nid_for_pfn(pfn); |
1064 |
+ if (page_nid < 0) |
1065 |
+ continue; |
1066 |
+diff --git a/drivers/crypto/vmx/aes.c b/drivers/crypto/vmx/aes.c |
1067 |
+index e79e567e43aa..263af709e536 100644 |
1068 |
+--- a/drivers/crypto/vmx/aes.c |
1069 |
++++ b/drivers/crypto/vmx/aes.c |
1070 |
+@@ -84,6 +84,7 @@ static int p8_aes_setkey(struct crypto_tfm *tfm, const u8 *key, |
1071 |
+ preempt_disable(); |
1072 |
+ pagefault_disable(); |
1073 |
+ enable_kernel_altivec(); |
1074 |
++ enable_kernel_vsx(); |
1075 |
+ ret = aes_p8_set_encrypt_key(key, keylen * 8, &ctx->enc_key); |
1076 |
+ ret += aes_p8_set_decrypt_key(key, keylen * 8, &ctx->dec_key); |
1077 |
+ pagefault_enable(); |
1078 |
+@@ -103,6 +104,7 @@ static void p8_aes_encrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src) |
1079 |
+ preempt_disable(); |
1080 |
+ pagefault_disable(); |
1081 |
+ enable_kernel_altivec(); |
1082 |
++ enable_kernel_vsx(); |
1083 |
+ aes_p8_encrypt(src, dst, &ctx->enc_key); |
1084 |
+ pagefault_enable(); |
1085 |
+ preempt_enable(); |
1086 |
+@@ -119,6 +121,7 @@ static void p8_aes_decrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src) |
1087 |
+ preempt_disable(); |
1088 |
+ pagefault_disable(); |
1089 |
+ enable_kernel_altivec(); |
1090 |
++ enable_kernel_vsx(); |
1091 |
+ aes_p8_decrypt(src, dst, &ctx->dec_key); |
1092 |
+ pagefault_enable(); |
1093 |
+ preempt_enable(); |
1094 |
+diff --git a/drivers/crypto/vmx/aes_cbc.c b/drivers/crypto/vmx/aes_cbc.c |
1095 |
+index 7299995c78ec..0b8fe2ec5315 100644 |
1096 |
+--- a/drivers/crypto/vmx/aes_cbc.c |
1097 |
++++ b/drivers/crypto/vmx/aes_cbc.c |
1098 |
+@@ -85,6 +85,7 @@ static int p8_aes_cbc_setkey(struct crypto_tfm *tfm, const u8 *key, |
1099 |
+ preempt_disable(); |
1100 |
+ pagefault_disable(); |
1101 |
+ enable_kernel_altivec(); |
1102 |
++ enable_kernel_vsx(); |
1103 |
+ ret = aes_p8_set_encrypt_key(key, keylen * 8, &ctx->enc_key); |
1104 |
+ ret += aes_p8_set_decrypt_key(key, keylen * 8, &ctx->dec_key); |
1105 |
+ pagefault_enable(); |
1106 |
+@@ -115,6 +116,7 @@ static int p8_aes_cbc_encrypt(struct blkcipher_desc *desc, |
1107 |
+ preempt_disable(); |
1108 |
+ pagefault_disable(); |
1109 |
+ enable_kernel_altivec(); |
1110 |
++ enable_kernel_vsx(); |
1111 |
+ |
1112 |
+ blkcipher_walk_init(&walk, dst, src, nbytes); |
1113 |
+ ret = blkcipher_walk_virt(desc, &walk); |
1114 |
+@@ -155,6 +157,7 @@ static int p8_aes_cbc_decrypt(struct blkcipher_desc *desc, |
1115 |
+ preempt_disable(); |
1116 |
+ pagefault_disable(); |
1117 |
+ enable_kernel_altivec(); |
1118 |
++ enable_kernel_vsx(); |
1119 |
+ |
1120 |
+ blkcipher_walk_init(&walk, dst, src, nbytes); |
1121 |
+ ret = blkcipher_walk_virt(desc, &walk); |
1122 |
+diff --git a/drivers/crypto/vmx/aes_ctr.c b/drivers/crypto/vmx/aes_ctr.c |
1123 |
+index ed3838781b4c..ee1306cd8f59 100644 |
1124 |
+--- a/drivers/crypto/vmx/aes_ctr.c |
1125 |
++++ b/drivers/crypto/vmx/aes_ctr.c |
1126 |
+@@ -82,6 +82,7 @@ static int p8_aes_ctr_setkey(struct crypto_tfm *tfm, const u8 *key, |
1127 |
+ |
1128 |
+ pagefault_disable(); |
1129 |
+ enable_kernel_altivec(); |
1130 |
++ enable_kernel_vsx(); |
1131 |
+ ret = aes_p8_set_encrypt_key(key, keylen * 8, &ctx->enc_key); |
1132 |
+ pagefault_enable(); |
1133 |
+ |
1134 |
+@@ -100,6 +101,7 @@ static void p8_aes_ctr_final(struct p8_aes_ctr_ctx *ctx, |
1135 |
+ |
1136 |
+ pagefault_disable(); |
1137 |
+ enable_kernel_altivec(); |
1138 |
++ enable_kernel_vsx(); |
1139 |
+ aes_p8_encrypt(ctrblk, keystream, &ctx->enc_key); |
1140 |
+ pagefault_enable(); |
1141 |
+ |
1142 |
+@@ -132,6 +134,7 @@ static int p8_aes_ctr_crypt(struct blkcipher_desc *desc, |
1143 |
+ while ((nbytes = walk.nbytes) >= AES_BLOCK_SIZE) { |
1144 |
+ pagefault_disable(); |
1145 |
+ enable_kernel_altivec(); |
1146 |
++ enable_kernel_vsx(); |
1147 |
+ aes_p8_ctr32_encrypt_blocks(walk.src.virt.addr, |
1148 |
+ walk.dst.virt.addr, |
1149 |
+ (nbytes & |
1150 |
+diff --git a/drivers/crypto/vmx/ghash.c b/drivers/crypto/vmx/ghash.c |
1151 |
+index b5e29002b666..2183a2e77641 100644 |
1152 |
+--- a/drivers/crypto/vmx/ghash.c |
1153 |
++++ b/drivers/crypto/vmx/ghash.c |
1154 |
+@@ -119,6 +119,7 @@ static int p8_ghash_setkey(struct crypto_shash *tfm, const u8 *key, |
1155 |
+ preempt_disable(); |
1156 |
+ pagefault_disable(); |
1157 |
+ enable_kernel_altivec(); |
1158 |
++ enable_kernel_vsx(); |
1159 |
+ enable_kernel_fp(); |
1160 |
+ gcm_init_p8(ctx->htable, (const u64 *) key); |
1161 |
+ pagefault_enable(); |
1162 |
+@@ -149,6 +150,7 @@ static int p8_ghash_update(struct shash_desc *desc, |
1163 |
+ preempt_disable(); |
1164 |
+ pagefault_disable(); |
1165 |
+ enable_kernel_altivec(); |
1166 |
++ enable_kernel_vsx(); |
1167 |
+ enable_kernel_fp(); |
1168 |
+ gcm_ghash_p8(dctx->shash, ctx->htable, |
1169 |
+ dctx->buffer, GHASH_DIGEST_SIZE); |
1170 |
+@@ -163,6 +165,7 @@ static int p8_ghash_update(struct shash_desc *desc, |
1171 |
+ preempt_disable(); |
1172 |
+ pagefault_disable(); |
1173 |
+ enable_kernel_altivec(); |
1174 |
++ enable_kernel_vsx(); |
1175 |
+ enable_kernel_fp(); |
1176 |
+ gcm_ghash_p8(dctx->shash, ctx->htable, src, len); |
1177 |
+ pagefault_enable(); |
1178 |
+@@ -193,6 +196,7 @@ static int p8_ghash_final(struct shash_desc *desc, u8 *out) |
1179 |
+ preempt_disable(); |
1180 |
+ pagefault_disable(); |
1181 |
+ enable_kernel_altivec(); |
1182 |
++ enable_kernel_vsx(); |
1183 |
+ enable_kernel_fp(); |
1184 |
+ gcm_ghash_p8(dctx->shash, ctx->htable, |
1185 |
+ dctx->buffer, GHASH_DIGEST_SIZE); |
1186 |
+diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c |
1187 |
+index cacb07b7a8f1..32e7b4a686ef 100644 |
1188 |
+--- a/drivers/gpu/drm/i915/intel_ddi.c |
1189 |
++++ b/drivers/gpu/drm/i915/intel_ddi.c |
1190 |
+@@ -1293,17 +1293,14 @@ skl_ddi_pll_select(struct intel_crtc *intel_crtc, |
1191 |
+ DPLL_CFGCR2_PDIV(wrpll_params.pdiv) | |
1192 |
+ wrpll_params.central_freq; |
1193 |
+ } else if (intel_encoder->type == INTEL_OUTPUT_DISPLAYPORT) { |
1194 |
+- struct drm_encoder *encoder = &intel_encoder->base; |
1195 |
+- struct intel_dp *intel_dp = enc_to_intel_dp(encoder); |
1196 |
+- |
1197 |
+- switch (intel_dp->link_bw) { |
1198 |
+- case DP_LINK_BW_1_62: |
1199 |
++ switch (crtc_state->port_clock / 2) { |
1200 |
++ case 81000: |
1201 |
+ ctrl1 |= DPLL_CTRL1_LINK_RATE(DPLL_CTRL1_LINK_RATE_810, 0); |
1202 |
+ break; |
1203 |
+- case DP_LINK_BW_2_7: |
1204 |
++ case 135000: |
1205 |
+ ctrl1 |= DPLL_CTRL1_LINK_RATE(DPLL_CTRL1_LINK_RATE_1350, 0); |
1206 |
+ break; |
1207 |
+- case DP_LINK_BW_5_4: |
1208 |
++ case 270000: |
1209 |
+ ctrl1 |= DPLL_CTRL1_LINK_RATE(DPLL_CTRL1_LINK_RATE_2700, 0); |
1210 |
+ break; |
1211 |
+ } |
1212 |
+diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c |
1213 |
+index bd8f8863eb0e..ca2d923101fc 100644 |
1214 |
+--- a/drivers/gpu/drm/i915/intel_dp.c |
1215 |
++++ b/drivers/gpu/drm/i915/intel_dp.c |
1216 |
+@@ -48,28 +48,28 @@ |
1217 |
+ #define INTEL_DP_RESOLUTION_FAILSAFE (3 << INTEL_DP_RESOLUTION_SHIFT_MASK) |
1218 |
+ |
1219 |
+ struct dp_link_dpll { |
1220 |
+- int link_bw; |
1221 |
++ int clock; |
1222 |
+ struct dpll dpll; |
1223 |
+ }; |
1224 |
+ |
1225 |
+ static const struct dp_link_dpll gen4_dpll[] = { |
1226 |
+- { DP_LINK_BW_1_62, |
1227 |
++ { 162000, |
1228 |
+ { .p1 = 2, .p2 = 10, .n = 2, .m1 = 23, .m2 = 8 } }, |
1229 |
+- { DP_LINK_BW_2_7, |
1230 |
++ { 270000, |
1231 |
+ { .p1 = 1, .p2 = 10, .n = 1, .m1 = 14, .m2 = 2 } } |
1232 |
+ }; |
1233 |
+ |
1234 |
+ static const struct dp_link_dpll pch_dpll[] = { |
1235 |
+- { DP_LINK_BW_1_62, |
1236 |
++ { 162000, |
1237 |
+ { .p1 = 2, .p2 = 10, .n = 1, .m1 = 12, .m2 = 9 } }, |
1238 |
+- { DP_LINK_BW_2_7, |
1239 |
++ { 270000, |
1240 |
+ { .p1 = 1, .p2 = 10, .n = 2, .m1 = 14, .m2 = 8 } } |
1241 |
+ }; |
1242 |
+ |
1243 |
+ static const struct dp_link_dpll vlv_dpll[] = { |
1244 |
+- { DP_LINK_BW_1_62, |
1245 |
++ { 162000, |
1246 |
+ { .p1 = 3, .p2 = 2, .n = 5, .m1 = 3, .m2 = 81 } }, |
1247 |
+- { DP_LINK_BW_2_7, |
1248 |
++ { 270000, |
1249 |
+ { .p1 = 2, .p2 = 2, .n = 1, .m1 = 2, .m2 = 27 } } |
1250 |
+ }; |
1251 |
+ |
1252 |
+@@ -83,11 +83,11 @@ static const struct dp_link_dpll chv_dpll[] = { |
1253 |
+ * m2 is stored in fixed point format using formula below |
1254 |
+ * (m2_int << 22) | m2_fraction |
1255 |
+ */ |
1256 |
+- { DP_LINK_BW_1_62, /* m2_int = 32, m2_fraction = 1677722 */ |
1257 |
++ { 162000, /* m2_int = 32, m2_fraction = 1677722 */ |
1258 |
+ { .p1 = 4, .p2 = 2, .n = 1, .m1 = 2, .m2 = 0x819999a } }, |
1259 |
+- { DP_LINK_BW_2_7, /* m2_int = 27, m2_fraction = 0 */ |
1260 |
++ { 270000, /* m2_int = 27, m2_fraction = 0 */ |
1261 |
+ { .p1 = 4, .p2 = 1, .n = 1, .m1 = 2, .m2 = 0x6c00000 } }, |
1262 |
+- { DP_LINK_BW_5_4, /* m2_int = 27, m2_fraction = 0 */ |
1263 |
++ { 540000, /* m2_int = 27, m2_fraction = 0 */ |
1264 |
+ { .p1 = 2, .p2 = 1, .n = 1, .m1 = 2, .m2 = 0x6c00000 } } |
1265 |
+ }; |
1266 |
+ |
1267 |
+@@ -1089,7 +1089,7 @@ intel_dp_connector_unregister(struct intel_connector *intel_connector) |
1268 |
+ } |
1269 |
+ |
1270 |
+ static void |
1271 |
+-skl_edp_set_pll_config(struct intel_crtc_state *pipe_config, int link_clock) |
1272 |
++skl_edp_set_pll_config(struct intel_crtc_state *pipe_config) |
1273 |
+ { |
1274 |
+ u32 ctrl1; |
1275 |
+ |
1276 |
+@@ -1101,7 +1101,7 @@ skl_edp_set_pll_config(struct intel_crtc_state *pipe_config, int link_clock) |
1277 |
+ pipe_config->dpll_hw_state.cfgcr2 = 0; |
1278 |
+ |
1279 |
+ ctrl1 = DPLL_CTRL1_OVERRIDE(SKL_DPLL0); |
1280 |
+- switch (link_clock / 2) { |
1281 |
++ switch (pipe_config->port_clock / 2) { |
1282 |
+ case 81000: |
1283 |
+ ctrl1 |= DPLL_CTRL1_LINK_RATE(DPLL_CTRL1_LINK_RATE_810, |
1284 |
+ SKL_DPLL0); |
1285 |
+@@ -1134,20 +1134,20 @@ skl_edp_set_pll_config(struct intel_crtc_state *pipe_config, int link_clock) |
1286 |
+ pipe_config->dpll_hw_state.ctrl1 = ctrl1; |
1287 |
+ } |
1288 |
+ |
1289 |
+-static void |
1290 |
+-hsw_dp_set_ddi_pll_sel(struct intel_crtc_state *pipe_config, int link_bw) |
1291 |
++void |
1292 |
++hsw_dp_set_ddi_pll_sel(struct intel_crtc_state *pipe_config) |
1293 |
+ { |
1294 |
+ memset(&pipe_config->dpll_hw_state, 0, |
1295 |
+ sizeof(pipe_config->dpll_hw_state)); |
1296 |
+ |
1297 |
+- switch (link_bw) { |
1298 |
+- case DP_LINK_BW_1_62: |
1299 |
++ switch (pipe_config->port_clock / 2) { |
1300 |
++ case 81000: |
1301 |
+ pipe_config->ddi_pll_sel = PORT_CLK_SEL_LCPLL_810; |
1302 |
+ break; |
1303 |
+- case DP_LINK_BW_2_7: |
1304 |
++ case 135000: |
1305 |
+ pipe_config->ddi_pll_sel = PORT_CLK_SEL_LCPLL_1350; |
1306 |
+ break; |
1307 |
+- case DP_LINK_BW_5_4: |
1308 |
++ case 270000: |
1309 |
+ pipe_config->ddi_pll_sel = PORT_CLK_SEL_LCPLL_2700; |
1310 |
+ break; |
1311 |
+ } |
1312 |
+@@ -1198,7 +1198,7 @@ intel_dp_source_rates(struct drm_device *dev, const int **source_rates) |
1313 |
+ |
1314 |
+ static void |
1315 |
+ intel_dp_set_clock(struct intel_encoder *encoder, |
1316 |
+- struct intel_crtc_state *pipe_config, int link_bw) |
1317 |
++ struct intel_crtc_state *pipe_config) |
1318 |
+ { |
1319 |
+ struct drm_device *dev = encoder->base.dev; |
1320 |
+ const struct dp_link_dpll *divisor = NULL; |
1321 |
+@@ -1220,7 +1220,7 @@ intel_dp_set_clock(struct intel_encoder *encoder, |
1322 |
+ |
1323 |
+ if (divisor && count) { |
1324 |
+ for (i = 0; i < count; i++) { |
1325 |
+- if (link_bw == divisor[i].link_bw) { |
1326 |
++ if (pipe_config->port_clock == divisor[i].clock) { |
1327 |
+ pipe_config->dpll = divisor[i].dpll; |
1328 |
+ pipe_config->clock_set = true; |
1329 |
+ break; |
1330 |
+@@ -1494,13 +1494,13 @@ found: |
1331 |
+ } |
1332 |
+ |
1333 |
+ if (IS_SKYLAKE(dev) && is_edp(intel_dp)) |
1334 |
+- skl_edp_set_pll_config(pipe_config, common_rates[clock]); |
1335 |
++ skl_edp_set_pll_config(pipe_config); |
1336 |
+ else if (IS_BROXTON(dev)) |
1337 |
+ /* handled in ddi */; |
1338 |
+ else if (IS_HASWELL(dev) || IS_BROADWELL(dev)) |
1339 |
+- hsw_dp_set_ddi_pll_sel(pipe_config, intel_dp->link_bw); |
1340 |
++ hsw_dp_set_ddi_pll_sel(pipe_config); |
1341 |
+ else |
1342 |
+- intel_dp_set_clock(encoder, pipe_config, intel_dp->link_bw); |
1343 |
++ intel_dp_set_clock(encoder, pipe_config); |
1344 |
+ |
1345 |
+ return true; |
1346 |
+ } |
1347 |
+diff --git a/drivers/gpu/drm/i915/intel_dp_mst.c b/drivers/gpu/drm/i915/intel_dp_mst.c |
1348 |
+index 600afdbef8c9..8c127201ab3c 100644 |
1349 |
+--- a/drivers/gpu/drm/i915/intel_dp_mst.c |
1350 |
++++ b/drivers/gpu/drm/i915/intel_dp_mst.c |
1351 |
+@@ -33,6 +33,7 @@ |
1352 |
+ static bool intel_dp_mst_compute_config(struct intel_encoder *encoder, |
1353 |
+ struct intel_crtc_state *pipe_config) |
1354 |
+ { |
1355 |
++ struct drm_device *dev = encoder->base.dev; |
1356 |
+ struct intel_dp_mst_encoder *intel_mst = enc_to_mst(&encoder->base); |
1357 |
+ struct intel_digital_port *intel_dig_port = intel_mst->primary; |
1358 |
+ struct intel_dp *intel_dp = &intel_dig_port->dp; |
1359 |
+@@ -97,6 +98,10 @@ static bool intel_dp_mst_compute_config(struct intel_encoder *encoder, |
1360 |
+ &pipe_config->dp_m_n); |
1361 |
+ |
1362 |
+ pipe_config->dp_m_n.tu = slots; |
1363 |
++ |
1364 |
++ if (IS_HASWELL(dev) || IS_BROADWELL(dev)) |
1365 |
++ hsw_dp_set_ddi_pll_sel(pipe_config); |
1366 |
++ |
1367 |
+ return true; |
1368 |
+ |
1369 |
+ } |
1370 |
+diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h |
1371 |
+index 105928382e21..04d426156bdb 100644 |
1372 |
+--- a/drivers/gpu/drm/i915/intel_drv.h |
1373 |
++++ b/drivers/gpu/drm/i915/intel_drv.h |
1374 |
+@@ -1194,6 +1194,7 @@ void intel_edp_drrs_disable(struct intel_dp *intel_dp); |
1375 |
+ void intel_edp_drrs_invalidate(struct drm_device *dev, |
1376 |
+ unsigned frontbuffer_bits); |
1377 |
+ void intel_edp_drrs_flush(struct drm_device *dev, unsigned frontbuffer_bits); |
1378 |
++void hsw_dp_set_ddi_pll_sel(struct intel_crtc_state *pipe_config); |
1379 |
+ |
1380 |
+ /* intel_dp_mst.c */ |
1381 |
+ int intel_dp_mst_encoder_init(struct intel_digital_port *intel_dig_port, int conn_id); |
1382 |
+diff --git a/drivers/gpu/drm/radeon/radeon_combios.c b/drivers/gpu/drm/radeon/radeon_combios.c |
1383 |
+index c097d3a82bda..a9b01bcf7d0a 100644 |
1384 |
+--- a/drivers/gpu/drm/radeon/radeon_combios.c |
1385 |
++++ b/drivers/gpu/drm/radeon/radeon_combios.c |
1386 |
+@@ -3387,6 +3387,14 @@ void radeon_combios_asic_init(struct drm_device *dev) |
1387 |
+ rdev->pdev->subsystem_device == 0x30ae) |
1388 |
+ return; |
1389 |
+ |
1390 |
++ /* quirk for rs4xx HP Compaq dc5750 Small Form Factor to make it resume |
1391 |
++ * - it hangs on resume inside the dynclk 1 table. |
1392 |
++ */ |
1393 |
++ if (rdev->family == CHIP_RS480 && |
1394 |
++ rdev->pdev->subsystem_vendor == 0x103c && |
1395 |
++ rdev->pdev->subsystem_device == 0x280a) |
1396 |
++ return; |
1397 |
++ |
1398 |
+ /* DYN CLK 1 */ |
1399 |
+ table = combios_get_table_offset(dev, COMBIOS_DYN_CLK_1_TABLE); |
1400 |
+ if (table) |
1401 |
+diff --git a/drivers/i2c/busses/i2c-xgene-slimpro.c b/drivers/i2c/busses/i2c-xgene-slimpro.c |
1402 |
+index 1c9cb65ac4cf..4233f5695352 100644 |
1403 |
+--- a/drivers/i2c/busses/i2c-xgene-slimpro.c |
1404 |
++++ b/drivers/i2c/busses/i2c-xgene-slimpro.c |
1405 |
+@@ -198,10 +198,10 @@ static int slimpro_i2c_blkrd(struct slimpro_i2c_dev *ctx, u32 chip, u32 addr, |
1406 |
+ int rc; |
1407 |
+ |
1408 |
+ paddr = dma_map_single(ctx->dev, ctx->dma_buffer, readlen, DMA_FROM_DEVICE); |
1409 |
+- rc = dma_mapping_error(ctx->dev, paddr); |
1410 |
+- if (rc) { |
1411 |
++ if (dma_mapping_error(ctx->dev, paddr)) { |
1412 |
+ dev_err(&ctx->adapter.dev, "Error in mapping dma buffer %p\n", |
1413 |
+ ctx->dma_buffer); |
1414 |
++ rc = -ENOMEM; |
1415 |
+ goto err; |
1416 |
+ } |
1417 |
+ |
1418 |
+@@ -241,10 +241,10 @@ static int slimpro_i2c_blkwr(struct slimpro_i2c_dev *ctx, u32 chip, |
1419 |
+ memcpy(ctx->dma_buffer, data, writelen); |
1420 |
+ paddr = dma_map_single(ctx->dev, ctx->dma_buffer, writelen, |
1421 |
+ DMA_TO_DEVICE); |
1422 |
+- rc = dma_mapping_error(ctx->dev, paddr); |
1423 |
+- if (rc) { |
1424 |
++ if (dma_mapping_error(ctx->dev, paddr)) { |
1425 |
+ dev_err(&ctx->adapter.dev, "Error in mapping dma buffer %p\n", |
1426 |
+ ctx->dma_buffer); |
1427 |
++ rc = -ENOMEM; |
1428 |
+ goto err; |
1429 |
+ } |
1430 |
+ |
1431 |
+diff --git a/drivers/infiniband/core/uverbs.h b/drivers/infiniband/core/uverbs.h |
1432 |
+index ba365b6d1e8d..65cbfcc92f11 100644 |
1433 |
+--- a/drivers/infiniband/core/uverbs.h |
1434 |
++++ b/drivers/infiniband/core/uverbs.h |
1435 |
+@@ -85,7 +85,7 @@ |
1436 |
+ */ |
1437 |
+ |
1438 |
+ struct ib_uverbs_device { |
1439 |
+- struct kref ref; |
1440 |
++ atomic_t refcount; |
1441 |
+ int num_comp_vectors; |
1442 |
+ struct completion comp; |
1443 |
+ struct device *dev; |
1444 |
+@@ -94,6 +94,7 @@ struct ib_uverbs_device { |
1445 |
+ struct cdev cdev; |
1446 |
+ struct rb_root xrcd_tree; |
1447 |
+ struct mutex xrcd_tree_mutex; |
1448 |
++ struct kobject kobj; |
1449 |
+ }; |
1450 |
+ |
1451 |
+ struct ib_uverbs_event_file { |
1452 |
+diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c |
1453 |
+index bbb02ffe87df..a6ca83b3153f 100644 |
1454 |
+--- a/drivers/infiniband/core/uverbs_cmd.c |
1455 |
++++ b/drivers/infiniband/core/uverbs_cmd.c |
1456 |
+@@ -2346,6 +2346,12 @@ ssize_t ib_uverbs_post_send(struct ib_uverbs_file *file, |
1457 |
+ next->send_flags = user_wr->send_flags; |
1458 |
+ |
1459 |
+ if (is_ud) { |
1460 |
++ if (next->opcode != IB_WR_SEND && |
1461 |
++ next->opcode != IB_WR_SEND_WITH_IMM) { |
1462 |
++ ret = -EINVAL; |
1463 |
++ goto out_put; |
1464 |
++ } |
1465 |
++ |
1466 |
+ next->wr.ud.ah = idr_read_ah(user_wr->wr.ud.ah, |
1467 |
+ file->ucontext); |
1468 |
+ if (!next->wr.ud.ah) { |
1469 |
+@@ -2385,9 +2391,11 @@ ssize_t ib_uverbs_post_send(struct ib_uverbs_file *file, |
1470 |
+ user_wr->wr.atomic.compare_add; |
1471 |
+ next->wr.atomic.swap = user_wr->wr.atomic.swap; |
1472 |
+ next->wr.atomic.rkey = user_wr->wr.atomic.rkey; |
1473 |
++ case IB_WR_SEND: |
1474 |
+ break; |
1475 |
+ default: |
1476 |
+- break; |
1477 |
++ ret = -EINVAL; |
1478 |
++ goto out_put; |
1479 |
+ } |
1480 |
+ } |
1481 |
+ |
1482 |
+diff --git a/drivers/infiniband/core/uverbs_main.c b/drivers/infiniband/core/uverbs_main.c |
1483 |
+index f6eef2da7097..15f4126a577d 100644 |
1484 |
+--- a/drivers/infiniband/core/uverbs_main.c |
1485 |
++++ b/drivers/infiniband/core/uverbs_main.c |
1486 |
+@@ -130,14 +130,18 @@ static int (*uverbs_ex_cmd_table[])(struct ib_uverbs_file *file, |
1487 |
+ static void ib_uverbs_add_one(struct ib_device *device); |
1488 |
+ static void ib_uverbs_remove_one(struct ib_device *device); |
1489 |
+ |
1490 |
+-static void ib_uverbs_release_dev(struct kref *ref) |
1491 |
++static void ib_uverbs_release_dev(struct kobject *kobj) |
1492 |
+ { |
1493 |
+ struct ib_uverbs_device *dev = |
1494 |
+- container_of(ref, struct ib_uverbs_device, ref); |
1495 |
++ container_of(kobj, struct ib_uverbs_device, kobj); |
1496 |
+ |
1497 |
+- complete(&dev->comp); |
1498 |
++ kfree(dev); |
1499 |
+ } |
1500 |
+ |
1501 |
++static struct kobj_type ib_uverbs_dev_ktype = { |
1502 |
++ .release = ib_uverbs_release_dev, |
1503 |
++}; |
1504 |
++ |
1505 |
+ static void ib_uverbs_release_event_file(struct kref *ref) |
1506 |
+ { |
1507 |
+ struct ib_uverbs_event_file *file = |
1508 |
+@@ -303,13 +307,19 @@ static int ib_uverbs_cleanup_ucontext(struct ib_uverbs_file *file, |
1509 |
+ return context->device->dealloc_ucontext(context); |
1510 |
+ } |
1511 |
+ |
1512 |
++static void ib_uverbs_comp_dev(struct ib_uverbs_device *dev) |
1513 |
++{ |
1514 |
++ complete(&dev->comp); |
1515 |
++} |
1516 |
++ |
1517 |
+ static void ib_uverbs_release_file(struct kref *ref) |
1518 |
+ { |
1519 |
+ struct ib_uverbs_file *file = |
1520 |
+ container_of(ref, struct ib_uverbs_file, ref); |
1521 |
+ |
1522 |
+ module_put(file->device->ib_dev->owner); |
1523 |
+- kref_put(&file->device->ref, ib_uverbs_release_dev); |
1524 |
++ if (atomic_dec_and_test(&file->device->refcount)) |
1525 |
++ ib_uverbs_comp_dev(file->device); |
1526 |
+ |
1527 |
+ kfree(file); |
1528 |
+ } |
1529 |
+@@ -743,9 +753,7 @@ static int ib_uverbs_open(struct inode *inode, struct file *filp) |
1530 |
+ int ret; |
1531 |
+ |
1532 |
+ dev = container_of(inode->i_cdev, struct ib_uverbs_device, cdev); |
1533 |
+- if (dev) |
1534 |
+- kref_get(&dev->ref); |
1535 |
+- else |
1536 |
++ if (!atomic_inc_not_zero(&dev->refcount)) |
1537 |
+ return -ENXIO; |
1538 |
+ |
1539 |
+ if (!try_module_get(dev->ib_dev->owner)) { |
1540 |
+@@ -766,6 +774,7 @@ static int ib_uverbs_open(struct inode *inode, struct file *filp) |
1541 |
+ mutex_init(&file->mutex); |
1542 |
+ |
1543 |
+ filp->private_data = file; |
1544 |
++ kobject_get(&dev->kobj); |
1545 |
+ |
1546 |
+ return nonseekable_open(inode, filp); |
1547 |
+ |
1548 |
+@@ -773,13 +782,16 @@ err_module: |
1549 |
+ module_put(dev->ib_dev->owner); |
1550 |
+ |
1551 |
+ err: |
1552 |
+- kref_put(&dev->ref, ib_uverbs_release_dev); |
1553 |
++ if (atomic_dec_and_test(&dev->refcount)) |
1554 |
++ ib_uverbs_comp_dev(dev); |
1555 |
++ |
1556 |
+ return ret; |
1557 |
+ } |
1558 |
+ |
1559 |
+ static int ib_uverbs_close(struct inode *inode, struct file *filp) |
1560 |
+ { |
1561 |
+ struct ib_uverbs_file *file = filp->private_data; |
1562 |
++ struct ib_uverbs_device *dev = file->device; |
1563 |
+ |
1564 |
+ ib_uverbs_cleanup_ucontext(file, file->ucontext); |
1565 |
+ |
1566 |
+@@ -787,6 +799,7 @@ static int ib_uverbs_close(struct inode *inode, struct file *filp) |
1567 |
+ kref_put(&file->async_file->ref, ib_uverbs_release_event_file); |
1568 |
+ |
1569 |
+ kref_put(&file->ref, ib_uverbs_release_file); |
1570 |
++ kobject_put(&dev->kobj); |
1571 |
+ |
1572 |
+ return 0; |
1573 |
+ } |
1574 |
+@@ -882,10 +895,11 @@ static void ib_uverbs_add_one(struct ib_device *device) |
1575 |
+ if (!uverbs_dev) |
1576 |
+ return; |
1577 |
+ |
1578 |
+- kref_init(&uverbs_dev->ref); |
1579 |
++ atomic_set(&uverbs_dev->refcount, 1); |
1580 |
+ init_completion(&uverbs_dev->comp); |
1581 |
+ uverbs_dev->xrcd_tree = RB_ROOT; |
1582 |
+ mutex_init(&uverbs_dev->xrcd_tree_mutex); |
1583 |
++ kobject_init(&uverbs_dev->kobj, &ib_uverbs_dev_ktype); |
1584 |
+ |
1585 |
+ spin_lock(&map_lock); |
1586 |
+ devnum = find_first_zero_bit(dev_map, IB_UVERBS_MAX_DEVICES); |
1587 |
+@@ -912,6 +926,7 @@ static void ib_uverbs_add_one(struct ib_device *device) |
1588 |
+ cdev_init(&uverbs_dev->cdev, NULL); |
1589 |
+ uverbs_dev->cdev.owner = THIS_MODULE; |
1590 |
+ uverbs_dev->cdev.ops = device->mmap ? &uverbs_mmap_fops : &uverbs_fops; |
1591 |
++ uverbs_dev->cdev.kobj.parent = &uverbs_dev->kobj; |
1592 |
+ kobject_set_name(&uverbs_dev->cdev.kobj, "uverbs%d", uverbs_dev->devnum); |
1593 |
+ if (cdev_add(&uverbs_dev->cdev, base, 1)) |
1594 |
+ goto err_cdev; |
1595 |
+@@ -942,9 +957,10 @@ err_cdev: |
1596 |
+ clear_bit(devnum, overflow_map); |
1597 |
+ |
1598 |
+ err: |
1599 |
+- kref_put(&uverbs_dev->ref, ib_uverbs_release_dev); |
1600 |
++ if (atomic_dec_and_test(&uverbs_dev->refcount)) |
1601 |
++ ib_uverbs_comp_dev(uverbs_dev); |
1602 |
+ wait_for_completion(&uverbs_dev->comp); |
1603 |
+- kfree(uverbs_dev); |
1604 |
++ kobject_put(&uverbs_dev->kobj); |
1605 |
+ return; |
1606 |
+ } |
1607 |
+ |
1608 |
+@@ -964,9 +980,10 @@ static void ib_uverbs_remove_one(struct ib_device *device) |
1609 |
+ else |
1610 |
+ clear_bit(uverbs_dev->devnum - IB_UVERBS_MAX_DEVICES, overflow_map); |
1611 |
+ |
1612 |
+- kref_put(&uverbs_dev->ref, ib_uverbs_release_dev); |
1613 |
++ if (atomic_dec_and_test(&uverbs_dev->refcount)) |
1614 |
++ ib_uverbs_comp_dev(uverbs_dev); |
1615 |
+ wait_for_completion(&uverbs_dev->comp); |
1616 |
+- kfree(uverbs_dev); |
1617 |
++ kobject_put(&uverbs_dev->kobj); |
1618 |
+ } |
1619 |
+ |
1620 |
+ static char *uverbs_devnode(struct device *dev, umode_t *mode) |
1621 |
+diff --git a/drivers/infiniband/hw/mlx4/ah.c b/drivers/infiniband/hw/mlx4/ah.c |
1622 |
+index f50a546224ad..33fdd50123f7 100644 |
1623 |
+--- a/drivers/infiniband/hw/mlx4/ah.c |
1624 |
++++ b/drivers/infiniband/hw/mlx4/ah.c |
1625 |
+@@ -148,9 +148,13 @@ int mlx4_ib_query_ah(struct ib_ah *ibah, struct ib_ah_attr *ah_attr) |
1626 |
+ enum rdma_link_layer ll; |
1627 |
+ |
1628 |
+ memset(ah_attr, 0, sizeof *ah_attr); |
1629 |
+- ah_attr->sl = be32_to_cpu(ah->av.ib.sl_tclass_flowlabel) >> 28; |
1630 |
+ ah_attr->port_num = be32_to_cpu(ah->av.ib.port_pd) >> 24; |
1631 |
+ ll = rdma_port_get_link_layer(ibah->device, ah_attr->port_num); |
1632 |
++ if (ll == IB_LINK_LAYER_ETHERNET) |
1633 |
++ ah_attr->sl = be32_to_cpu(ah->av.eth.sl_tclass_flowlabel) >> 29; |
1634 |
++ else |
1635 |
++ ah_attr->sl = be32_to_cpu(ah->av.ib.sl_tclass_flowlabel) >> 28; |
1636 |
++ |
1637 |
+ ah_attr->dlid = ll == IB_LINK_LAYER_INFINIBAND ? be16_to_cpu(ah->av.ib.dlid) : 0; |
1638 |
+ if (ah->av.ib.stat_rate) |
1639 |
+ ah_attr->static_rate = ah->av.ib.stat_rate - MLX4_STAT_RATE_OFFSET; |
1640 |
+diff --git a/drivers/infiniband/hw/mlx4/cq.c b/drivers/infiniband/hw/mlx4/cq.c |
1641 |
+index 36eb3d012b6d..2f4259525bb1 100644 |
1642 |
+--- a/drivers/infiniband/hw/mlx4/cq.c |
1643 |
++++ b/drivers/infiniband/hw/mlx4/cq.c |
1644 |
+@@ -638,7 +638,7 @@ static void mlx4_ib_poll_sw_comp(struct mlx4_ib_cq *cq, int num_entries, |
1645 |
+ * simulated FLUSH_ERR completions |
1646 |
+ */ |
1647 |
+ list_for_each_entry(qp, &cq->send_qp_list, cq_send_list) { |
1648 |
+- mlx4_ib_qp_sw_comp(qp, num_entries, wc, npolled, 1); |
1649 |
++ mlx4_ib_qp_sw_comp(qp, num_entries, wc + *npolled, npolled, 1); |
1650 |
+ if (*npolled >= num_entries) |
1651 |
+ goto out; |
1652 |
+ } |
1653 |
+diff --git a/drivers/infiniband/hw/mlx4/mcg.c b/drivers/infiniband/hw/mlx4/mcg.c |
1654 |
+index ed327e6c8fdc..a0559a8af4f4 100644 |
1655 |
+--- a/drivers/infiniband/hw/mlx4/mcg.c |
1656 |
++++ b/drivers/infiniband/hw/mlx4/mcg.c |
1657 |
+@@ -206,15 +206,16 @@ static int send_mad_to_wire(struct mlx4_ib_demux_ctx *ctx, struct ib_mad *mad) |
1658 |
+ { |
1659 |
+ struct mlx4_ib_dev *dev = ctx->dev; |
1660 |
+ struct ib_ah_attr ah_attr; |
1661 |
++ unsigned long flags; |
1662 |
+ |
1663 |
+- spin_lock(&dev->sm_lock); |
1664 |
++ spin_lock_irqsave(&dev->sm_lock, flags); |
1665 |
+ if (!dev->sm_ah[ctx->port - 1]) { |
1666 |
+ /* port is not yet Active, sm_ah not ready */ |
1667 |
+- spin_unlock(&dev->sm_lock); |
1668 |
++ spin_unlock_irqrestore(&dev->sm_lock, flags); |
1669 |
+ return -EAGAIN; |
1670 |
+ } |
1671 |
+ mlx4_ib_query_ah(dev->sm_ah[ctx->port - 1], &ah_attr); |
1672 |
+- spin_unlock(&dev->sm_lock); |
1673 |
++ spin_unlock_irqrestore(&dev->sm_lock, flags); |
1674 |
+ return mlx4_ib_send_to_wire(dev, mlx4_master_func_num(dev->dev), |
1675 |
+ ctx->port, IB_QPT_GSI, 0, 1, IB_QP1_QKEY, |
1676 |
+ &ah_attr, NULL, mad); |
1677 |
+diff --git a/drivers/infiniband/hw/mlx4/sysfs.c b/drivers/infiniband/hw/mlx4/sysfs.c |
1678 |
+index 6797108ce873..69fb5ba94d0f 100644 |
1679 |
+--- a/drivers/infiniband/hw/mlx4/sysfs.c |
1680 |
++++ b/drivers/infiniband/hw/mlx4/sysfs.c |
1681 |
+@@ -640,6 +640,8 @@ static int add_port(struct mlx4_ib_dev *dev, int port_num, int slave) |
1682 |
+ struct mlx4_port *p; |
1683 |
+ int i; |
1684 |
+ int ret; |
1685 |
++ int is_eth = rdma_port_get_link_layer(&dev->ib_dev, port_num) == |
1686 |
++ IB_LINK_LAYER_ETHERNET; |
1687 |
+ |
1688 |
+ p = kzalloc(sizeof *p, GFP_KERNEL); |
1689 |
+ if (!p) |
1690 |
+@@ -657,7 +659,8 @@ static int add_port(struct mlx4_ib_dev *dev, int port_num, int slave) |
1691 |
+ |
1692 |
+ p->pkey_group.name = "pkey_idx"; |
1693 |
+ p->pkey_group.attrs = |
1694 |
+- alloc_group_attrs(show_port_pkey, store_port_pkey, |
1695 |
++ alloc_group_attrs(show_port_pkey, |
1696 |
++ is_eth ? NULL : store_port_pkey, |
1697 |
+ dev->dev->caps.pkey_table_len[port_num]); |
1698 |
+ if (!p->pkey_group.attrs) { |
1699 |
+ ret = -ENOMEM; |
1700 |
+diff --git a/drivers/infiniband/hw/mlx5/mr.c b/drivers/infiniband/hw/mlx5/mr.c |
1701 |
+index bc9a0de897cb..dbb75c0de848 100644 |
1702 |
+--- a/drivers/infiniband/hw/mlx5/mr.c |
1703 |
++++ b/drivers/infiniband/hw/mlx5/mr.c |
1704 |
+@@ -1118,19 +1118,7 @@ struct ib_mr *mlx5_ib_reg_user_mr(struct ib_pd *pd, u64 start, u64 length, |
1705 |
+ return &mr->ibmr; |
1706 |
+ |
1707 |
+ error: |
1708 |
+- /* |
1709 |
+- * Destroy the umem *before* destroying the MR, to ensure we |
1710 |
+- * will not have any in-flight notifiers when destroying the |
1711 |
+- * MR. |
1712 |
+- * |
1713 |
+- * As the MR is completely invalid to begin with, and this |
1714 |
+- * error path is only taken if we can't push the mr entry into |
1715 |
+- * the pagefault tree, this is safe. |
1716 |
+- */ |
1717 |
+- |
1718 |
+ ib_umem_release(umem); |
1719 |
+- /* Kill the MR, and return an error code. */ |
1720 |
+- clean_mr(mr); |
1721 |
+ return ERR_PTR(err); |
1722 |
+ } |
1723 |
+ |
1724 |
+diff --git a/drivers/infiniband/hw/qib/qib_keys.c b/drivers/infiniband/hw/qib/qib_keys.c |
1725 |
+index ad843c786e72..5afaa218508d 100644 |
1726 |
+--- a/drivers/infiniband/hw/qib/qib_keys.c |
1727 |
++++ b/drivers/infiniband/hw/qib/qib_keys.c |
1728 |
+@@ -86,6 +86,10 @@ int qib_alloc_lkey(struct qib_mregion *mr, int dma_region) |
1729 |
+ * unrestricted LKEY. |
1730 |
+ */ |
1731 |
+ rkt->gen++; |
1732 |
++ /* |
1733 |
++ * bits are capped in qib_verbs.c to insure enough bits |
1734 |
++ * for generation number |
1735 |
++ */ |
1736 |
+ mr->lkey = (r << (32 - ib_qib_lkey_table_size)) | |
1737 |
+ ((((1 << (24 - ib_qib_lkey_table_size)) - 1) & rkt->gen) |
1738 |
+ << 8); |
1739 |
+diff --git a/drivers/infiniband/hw/qib/qib_verbs.c b/drivers/infiniband/hw/qib/qib_verbs.c |
1740 |
+index a05d1a372208..77e981abfce4 100644 |
1741 |
+--- a/drivers/infiniband/hw/qib/qib_verbs.c |
1742 |
++++ b/drivers/infiniband/hw/qib/qib_verbs.c |
1743 |
+@@ -40,6 +40,7 @@ |
1744 |
+ #include <linux/rculist.h> |
1745 |
+ #include <linux/mm.h> |
1746 |
+ #include <linux/random.h> |
1747 |
++#include <linux/vmalloc.h> |
1748 |
+ |
1749 |
+ #include "qib.h" |
1750 |
+ #include "qib_common.h" |
1751 |
+@@ -2109,10 +2110,16 @@ int qib_register_ib_device(struct qib_devdata *dd) |
1752 |
+ * the LKEY). The remaining bits act as a generation number or tag. |
1753 |
+ */ |
1754 |
+ spin_lock_init(&dev->lk_table.lock); |
1755 |
++ /* insure generation is at least 4 bits see keys.c */ |
1756 |
++ if (ib_qib_lkey_table_size > MAX_LKEY_TABLE_BITS) { |
1757 |
++ qib_dev_warn(dd, "lkey bits %u too large, reduced to %u\n", |
1758 |
++ ib_qib_lkey_table_size, MAX_LKEY_TABLE_BITS); |
1759 |
++ ib_qib_lkey_table_size = MAX_LKEY_TABLE_BITS; |
1760 |
++ } |
1761 |
+ dev->lk_table.max = 1 << ib_qib_lkey_table_size; |
1762 |
+ lk_tab_size = dev->lk_table.max * sizeof(*dev->lk_table.table); |
1763 |
+ dev->lk_table.table = (struct qib_mregion __rcu **) |
1764 |
+- __get_free_pages(GFP_KERNEL, get_order(lk_tab_size)); |
1765 |
++ vmalloc(lk_tab_size); |
1766 |
+ if (dev->lk_table.table == NULL) { |
1767 |
+ ret = -ENOMEM; |
1768 |
+ goto err_lk; |
1769 |
+@@ -2286,7 +2293,7 @@ err_tx: |
1770 |
+ sizeof(struct qib_pio_header), |
1771 |
+ dev->pio_hdrs, dev->pio_hdrs_phys); |
1772 |
+ err_hdrs: |
1773 |
+- free_pages((unsigned long) dev->lk_table.table, get_order(lk_tab_size)); |
1774 |
++ vfree(dev->lk_table.table); |
1775 |
+ err_lk: |
1776 |
+ kfree(dev->qp_table); |
1777 |
+ err_qpt: |
1778 |
+@@ -2340,8 +2347,7 @@ void qib_unregister_ib_device(struct qib_devdata *dd) |
1779 |
+ sizeof(struct qib_pio_header), |
1780 |
+ dev->pio_hdrs, dev->pio_hdrs_phys); |
1781 |
+ lk_tab_size = dev->lk_table.max * sizeof(*dev->lk_table.table); |
1782 |
+- free_pages((unsigned long) dev->lk_table.table, |
1783 |
+- get_order(lk_tab_size)); |
1784 |
++ vfree(dev->lk_table.table); |
1785 |
+ kfree(dev->qp_table); |
1786 |
+ } |
1787 |
+ |
1788 |
+diff --git a/drivers/infiniband/hw/qib/qib_verbs.h b/drivers/infiniband/hw/qib/qib_verbs.h |
1789 |
+index 1635572752ce..bce0fa596b4d 100644 |
1790 |
+--- a/drivers/infiniband/hw/qib/qib_verbs.h |
1791 |
++++ b/drivers/infiniband/hw/qib/qib_verbs.h |
1792 |
+@@ -647,6 +647,8 @@ struct qib_qpn_table { |
1793 |
+ struct qpn_map map[QPNMAP_ENTRIES]; |
1794 |
+ }; |
1795 |
+ |
1796 |
++#define MAX_LKEY_TABLE_BITS 23 |
1797 |
++ |
1798 |
+ struct qib_lkey_table { |
1799 |
+ spinlock_t lock; /* protect changes in this struct */ |
1800 |
+ u32 next; /* next unused index (speeds search) */ |
1801 |
+diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.c b/drivers/infiniband/ulp/iser/iscsi_iser.c |
1802 |
+index 6a594aac2290..c933d882c35c 100644 |
1803 |
+--- a/drivers/infiniband/ulp/iser/iscsi_iser.c |
1804 |
++++ b/drivers/infiniband/ulp/iser/iscsi_iser.c |
1805 |
+@@ -201,6 +201,7 @@ iser_initialize_task_headers(struct iscsi_task *task, |
1806 |
+ goto out; |
1807 |
+ } |
1808 |
+ |
1809 |
++ tx_desc->mapped = true; |
1810 |
+ tx_desc->dma_addr = dma_addr; |
1811 |
+ tx_desc->tx_sg[0].addr = tx_desc->dma_addr; |
1812 |
+ tx_desc->tx_sg[0].length = ISER_HEADERS_LEN; |
1813 |
+@@ -360,16 +361,19 @@ iscsi_iser_task_xmit(struct iscsi_task *task) |
1814 |
+ static void iscsi_iser_cleanup_task(struct iscsi_task *task) |
1815 |
+ { |
1816 |
+ struct iscsi_iser_task *iser_task = task->dd_data; |
1817 |
+- struct iser_tx_desc *tx_desc = &iser_task->desc; |
1818 |
+- struct iser_conn *iser_conn = task->conn->dd_data; |
1819 |
++ struct iser_tx_desc *tx_desc = &iser_task->desc; |
1820 |
++ struct iser_conn *iser_conn = task->conn->dd_data; |
1821 |
+ struct iser_device *device = iser_conn->ib_conn.device; |
1822 |
+ |
1823 |
+ /* DEVICE_REMOVAL event might have already released the device */ |
1824 |
+ if (!device) |
1825 |
+ return; |
1826 |
+ |
1827 |
+- ib_dma_unmap_single(device->ib_device, |
1828 |
+- tx_desc->dma_addr, ISER_HEADERS_LEN, DMA_TO_DEVICE); |
1829 |
++ if (likely(tx_desc->mapped)) { |
1830 |
++ ib_dma_unmap_single(device->ib_device, tx_desc->dma_addr, |
1831 |
++ ISER_HEADERS_LEN, DMA_TO_DEVICE); |
1832 |
++ tx_desc->mapped = false; |
1833 |
++ } |
1834 |
+ |
1835 |
+ /* mgmt tasks do not need special cleanup */ |
1836 |
+ if (!task->sc) |
1837 |
+diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.h b/drivers/infiniband/ulp/iser/iscsi_iser.h |
1838 |
+index 262ba1f8ee50..d2b6caf7694d 100644 |
1839 |
+--- a/drivers/infiniband/ulp/iser/iscsi_iser.h |
1840 |
++++ b/drivers/infiniband/ulp/iser/iscsi_iser.h |
1841 |
+@@ -270,6 +270,7 @@ enum iser_desc_type { |
1842 |
+ * sg[1] optionally points to either of immediate data |
1843 |
+ * unsolicited data-out or control |
1844 |
+ * @num_sge: number sges used on this TX task |
1845 |
++ * @mapped: Is the task header mapped |
1846 |
+ */ |
1847 |
+ struct iser_tx_desc { |
1848 |
+ struct iser_hdr iser_header; |
1849 |
+@@ -278,6 +279,7 @@ struct iser_tx_desc { |
1850 |
+ u64 dma_addr; |
1851 |
+ struct ib_sge tx_sg[2]; |
1852 |
+ int num_sge; |
1853 |
++ bool mapped; |
1854 |
+ }; |
1855 |
+ |
1856 |
+ #define ISER_RX_PAD_SIZE (256 - (ISER_RX_PAYLOAD_SIZE + \ |
1857 |
+diff --git a/drivers/infiniband/ulp/iser/iser_initiator.c b/drivers/infiniband/ulp/iser/iser_initiator.c |
1858 |
+index 3e2118e8ed87..0a47f42fec24 100644 |
1859 |
+--- a/drivers/infiniband/ulp/iser/iser_initiator.c |
1860 |
++++ b/drivers/infiniband/ulp/iser/iser_initiator.c |
1861 |
+@@ -454,7 +454,7 @@ int iser_send_data_out(struct iscsi_conn *conn, |
1862 |
+ unsigned long buf_offset; |
1863 |
+ unsigned long data_seg_len; |
1864 |
+ uint32_t itt; |
1865 |
+- int err = 0; |
1866 |
++ int err; |
1867 |
+ struct ib_sge *tx_dsg; |
1868 |
+ |
1869 |
+ itt = (__force uint32_t)hdr->itt; |
1870 |
+@@ -475,7 +475,9 @@ int iser_send_data_out(struct iscsi_conn *conn, |
1871 |
+ memcpy(&tx_desc->iscsi_header, hdr, sizeof(struct iscsi_hdr)); |
1872 |
+ |
1873 |
+ /* build the tx desc */ |
1874 |
+- iser_initialize_task_headers(task, tx_desc); |
1875 |
++ err = iser_initialize_task_headers(task, tx_desc); |
1876 |
++ if (err) |
1877 |
++ goto send_data_out_error; |
1878 |
+ |
1879 |
+ mem_reg = &iser_task->rdma_reg[ISER_DIR_OUT]; |
1880 |
+ tx_dsg = &tx_desc->tx_sg[1]; |
1881 |
+@@ -502,7 +504,7 @@ int iser_send_data_out(struct iscsi_conn *conn, |
1882 |
+ |
1883 |
+ send_data_out_error: |
1884 |
+ kmem_cache_free(ig.desc_cache, tx_desc); |
1885 |
+- iser_err("conn %p failed err %d\n",conn, err); |
1886 |
++ iser_err("conn %p failed err %d\n", conn, err); |
1887 |
+ return err; |
1888 |
+ } |
1889 |
+ |
1890 |
+diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c |
1891 |
+index 31a20b462266..ffda44ff9375 100644 |
1892 |
+--- a/drivers/infiniband/ulp/srp/ib_srp.c |
1893 |
++++ b/drivers/infiniband/ulp/srp/ib_srp.c |
1894 |
+@@ -2757,6 +2757,13 @@ static int srp_sdev_count(struct Scsi_Host *host) |
1895 |
+ return c; |
1896 |
+ } |
1897 |
+ |
1898 |
++/* |
1899 |
++ * Return values: |
1900 |
++ * < 0 upon failure. Caller is responsible for SRP target port cleanup. |
1901 |
++ * 0 and target->state == SRP_TARGET_REMOVED if asynchronous target port |
1902 |
++ * removal has been scheduled. |
1903 |
++ * 0 and target->state != SRP_TARGET_REMOVED upon success. |
1904 |
++ */ |
1905 |
+ static int srp_add_target(struct srp_host *host, struct srp_target_port *target) |
1906 |
+ { |
1907 |
+ struct srp_rport_identifiers ids; |
1908 |
+@@ -3262,7 +3269,7 @@ static ssize_t srp_create_target(struct device *dev, |
1909 |
+ srp_free_ch_ib(target, ch); |
1910 |
+ srp_free_req_data(target, ch); |
1911 |
+ target->ch_count = ch - target->ch; |
1912 |
+- break; |
1913 |
++ goto connected; |
1914 |
+ } |
1915 |
+ } |
1916 |
+ |
1917 |
+@@ -3272,6 +3279,7 @@ static ssize_t srp_create_target(struct device *dev, |
1918 |
+ node_idx++; |
1919 |
+ } |
1920 |
+ |
1921 |
++connected: |
1922 |
+ target->scsi_host->nr_hw_queues = target->ch_count; |
1923 |
+ |
1924 |
+ ret = srp_add_target(host, target); |
1925 |
+@@ -3294,6 +3302,8 @@ out: |
1926 |
+ mutex_unlock(&host->add_target_mutex); |
1927 |
+ |
1928 |
+ scsi_host_put(target->scsi_host); |
1929 |
++ if (ret < 0) |
1930 |
++ scsi_host_put(target->scsi_host); |
1931 |
+ |
1932 |
+ return ret; |
1933 |
+ |
1934 |
+diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c |
1935 |
+index 9d35499faca4..08d496411f75 100644 |
1936 |
+--- a/drivers/input/evdev.c |
1937 |
++++ b/drivers/input/evdev.c |
1938 |
+@@ -290,19 +290,14 @@ static int evdev_flush(struct file *file, fl_owner_t id) |
1939 |
+ { |
1940 |
+ struct evdev_client *client = file->private_data; |
1941 |
+ struct evdev *evdev = client->evdev; |
1942 |
+- int retval; |
1943 |
+ |
1944 |
+- retval = mutex_lock_interruptible(&evdev->mutex); |
1945 |
+- if (retval) |
1946 |
+- return retval; |
1947 |
++ mutex_lock(&evdev->mutex); |
1948 |
+ |
1949 |
+- if (!evdev->exist || client->revoked) |
1950 |
+- retval = -ENODEV; |
1951 |
+- else |
1952 |
+- retval = input_flush_device(&evdev->handle, file); |
1953 |
++ if (evdev->exist && !client->revoked) |
1954 |
++ input_flush_device(&evdev->handle, file); |
1955 |
+ |
1956 |
+ mutex_unlock(&evdev->mutex); |
1957 |
+- return retval; |
1958 |
++ return 0; |
1959 |
+ } |
1960 |
+ |
1961 |
+ static void evdev_free(struct device *dev) |
1962 |
+diff --git a/drivers/iommu/fsl_pamu.c b/drivers/iommu/fsl_pamu.c |
1963 |
+index abeedc9a78c2..2570f2a25dc4 100644 |
1964 |
+--- a/drivers/iommu/fsl_pamu.c |
1965 |
++++ b/drivers/iommu/fsl_pamu.c |
1966 |
+@@ -41,7 +41,6 @@ struct pamu_isr_data { |
1967 |
+ |
1968 |
+ static struct paace *ppaact; |
1969 |
+ static struct paace *spaact; |
1970 |
+-static struct ome *omt __initdata; |
1971 |
+ |
1972 |
+ /* |
1973 |
+ * Table for matching compatible strings, for device tree |
1974 |
+@@ -50,7 +49,7 @@ static struct ome *omt __initdata; |
1975 |
+ * SOCs. For the older SOCs "fsl,qoriq-device-config-1.0" |
1976 |
+ * string would be used. |
1977 |
+ */ |
1978 |
+-static const struct of_device_id guts_device_ids[] __initconst = { |
1979 |
++static const struct of_device_id guts_device_ids[] = { |
1980 |
+ { .compatible = "fsl,qoriq-device-config-1.0", }, |
1981 |
+ { .compatible = "fsl,qoriq-device-config-2.0", }, |
1982 |
+ {} |
1983 |
+@@ -599,7 +598,7 @@ found_cpu_node: |
1984 |
+ * Memory accesses to QMAN and BMAN private memory need not be coherent, so |
1985 |
+ * clear the PAACE entry coherency attribute for them. |
1986 |
+ */ |
1987 |
+-static void __init setup_qbman_paace(struct paace *ppaace, int paace_type) |
1988 |
++static void setup_qbman_paace(struct paace *ppaace, int paace_type) |
1989 |
+ { |
1990 |
+ switch (paace_type) { |
1991 |
+ case QMAN_PAACE: |
1992 |
+@@ -629,7 +628,7 @@ static void __init setup_qbman_paace(struct paace *ppaace, int paace_type) |
1993 |
+ * this table to translate device transaction to appropriate corenet |
1994 |
+ * transaction. |
1995 |
+ */ |
1996 |
+-static void __init setup_omt(struct ome *omt) |
1997 |
++static void setup_omt(struct ome *omt) |
1998 |
+ { |
1999 |
+ struct ome *ome; |
2000 |
+ |
2001 |
+@@ -666,7 +665,7 @@ static void __init setup_omt(struct ome *omt) |
2002 |
+ * Get the maximum number of PAACT table entries |
2003 |
+ * and subwindows supported by PAMU |
2004 |
+ */ |
2005 |
+-static void __init get_pamu_cap_values(unsigned long pamu_reg_base) |
2006 |
++static void get_pamu_cap_values(unsigned long pamu_reg_base) |
2007 |
+ { |
2008 |
+ u32 pc_val; |
2009 |
+ |
2010 |
+@@ -676,9 +675,9 @@ static void __init get_pamu_cap_values(unsigned long pamu_reg_base) |
2011 |
+ } |
2012 |
+ |
2013 |
+ /* Setup PAMU registers pointing to PAACT, SPAACT and OMT */ |
2014 |
+-static int __init setup_one_pamu(unsigned long pamu_reg_base, unsigned long pamu_reg_size, |
2015 |
+- phys_addr_t ppaact_phys, phys_addr_t spaact_phys, |
2016 |
+- phys_addr_t omt_phys) |
2017 |
++static int setup_one_pamu(unsigned long pamu_reg_base, unsigned long pamu_reg_size, |
2018 |
++ phys_addr_t ppaact_phys, phys_addr_t spaact_phys, |
2019 |
++ phys_addr_t omt_phys) |
2020 |
+ { |
2021 |
+ u32 *pc; |
2022 |
+ struct pamu_mmap_regs *pamu_regs; |
2023 |
+@@ -720,7 +719,7 @@ static int __init setup_one_pamu(unsigned long pamu_reg_base, unsigned long pamu |
2024 |
+ } |
2025 |
+ |
2026 |
+ /* Enable all device LIODNS */ |
2027 |
+-static void __init setup_liodns(void) |
2028 |
++static void setup_liodns(void) |
2029 |
+ { |
2030 |
+ int i, len; |
2031 |
+ struct paace *ppaace; |
2032 |
+@@ -846,7 +845,7 @@ struct ccsr_law { |
2033 |
+ /* |
2034 |
+ * Create a coherence subdomain for a given memory block. |
2035 |
+ */ |
2036 |
+-static int __init create_csd(phys_addr_t phys, size_t size, u32 csd_port_id) |
2037 |
++static int create_csd(phys_addr_t phys, size_t size, u32 csd_port_id) |
2038 |
+ { |
2039 |
+ struct device_node *np; |
2040 |
+ const __be32 *iprop; |
2041 |
+@@ -988,7 +987,7 @@ error: |
2042 |
+ static const struct { |
2043 |
+ u32 svr; |
2044 |
+ u32 port_id; |
2045 |
+-} port_id_map[] __initconst = { |
2046 |
++} port_id_map[] = { |
2047 |
+ {(SVR_P2040 << 8) | 0x10, 0xFF000000}, /* P2040 1.0 */ |
2048 |
+ {(SVR_P2040 << 8) | 0x11, 0xFF000000}, /* P2040 1.1 */ |
2049 |
+ {(SVR_P2041 << 8) | 0x10, 0xFF000000}, /* P2041 1.0 */ |
2050 |
+@@ -1006,7 +1005,7 @@ static const struct { |
2051 |
+ |
2052 |
+ #define SVR_SECURITY 0x80000 /* The Security (E) bit */ |
2053 |
+ |
2054 |
+-static int __init fsl_pamu_probe(struct platform_device *pdev) |
2055 |
++static int fsl_pamu_probe(struct platform_device *pdev) |
2056 |
+ { |
2057 |
+ struct device *dev = &pdev->dev; |
2058 |
+ void __iomem *pamu_regs = NULL; |
2059 |
+@@ -1022,6 +1021,7 @@ static int __init fsl_pamu_probe(struct platform_device *pdev) |
2060 |
+ int irq; |
2061 |
+ phys_addr_t ppaact_phys; |
2062 |
+ phys_addr_t spaact_phys; |
2063 |
++ struct ome *omt; |
2064 |
+ phys_addr_t omt_phys; |
2065 |
+ size_t mem_size = 0; |
2066 |
+ unsigned int order = 0; |
2067 |
+@@ -1200,7 +1200,7 @@ error: |
2068 |
+ return ret; |
2069 |
+ } |
2070 |
+ |
2071 |
+-static struct platform_driver fsl_of_pamu_driver __initdata = { |
2072 |
++static struct platform_driver fsl_of_pamu_driver = { |
2073 |
+ .driver = { |
2074 |
+ .name = "fsl-of-pamu", |
2075 |
+ }, |
2076 |
+diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c |
2077 |
+index 0649b94f5958..7553cb90627f 100644 |
2078 |
+--- a/drivers/iommu/intel-iommu.c |
2079 |
++++ b/drivers/iommu/intel-iommu.c |
2080 |
+@@ -755,6 +755,7 @@ static inline struct context_entry *iommu_context_addr(struct intel_iommu *iommu |
2081 |
+ struct context_entry *context; |
2082 |
+ u64 *entry; |
2083 |
+ |
2084 |
++ entry = &root->lo; |
2085 |
+ if (ecs_enabled(iommu)) { |
2086 |
+ if (devfn >= 0x80) { |
2087 |
+ devfn -= 0x80; |
2088 |
+@@ -762,7 +763,6 @@ static inline struct context_entry *iommu_context_addr(struct intel_iommu *iommu |
2089 |
+ } |
2090 |
+ devfn *= 2; |
2091 |
+ } |
2092 |
+- entry = &root->lo; |
2093 |
+ if (*entry & 1) |
2094 |
+ context = phys_to_virt(*entry & VTD_PAGE_MASK); |
2095 |
+ else { |
2096 |
+diff --git a/drivers/iommu/io-pgtable-arm.c b/drivers/iommu/io-pgtable-arm.c |
2097 |
+index 4e460216bd16..e29d5d7fe220 100644 |
2098 |
+--- a/drivers/iommu/io-pgtable-arm.c |
2099 |
++++ b/drivers/iommu/io-pgtable-arm.c |
2100 |
+@@ -200,6 +200,10 @@ typedef u64 arm_lpae_iopte; |
2101 |
+ |
2102 |
+ static bool selftest_running = false; |
2103 |
+ |
2104 |
++static int __arm_lpae_unmap(struct arm_lpae_io_pgtable *data, |
2105 |
++ unsigned long iova, size_t size, int lvl, |
2106 |
++ arm_lpae_iopte *ptep); |
2107 |
++ |
2108 |
+ static int arm_lpae_init_pte(struct arm_lpae_io_pgtable *data, |
2109 |
+ unsigned long iova, phys_addr_t paddr, |
2110 |
+ arm_lpae_iopte prot, int lvl, |
2111 |
+@@ -207,10 +211,21 @@ static int arm_lpae_init_pte(struct arm_lpae_io_pgtable *data, |
2112 |
+ { |
2113 |
+ arm_lpae_iopte pte = prot; |
2114 |
+ |
2115 |
+- /* We require an unmap first */ |
2116 |
+ if (iopte_leaf(*ptep, lvl)) { |
2117 |
++ /* We require an unmap first */ |
2118 |
+ WARN_ON(!selftest_running); |
2119 |
+ return -EEXIST; |
2120 |
++ } else if (iopte_type(*ptep, lvl) == ARM_LPAE_PTE_TYPE_TABLE) { |
2121 |
++ /* |
2122 |
++ * We need to unmap and free the old table before |
2123 |
++ * overwriting it with a block entry. |
2124 |
++ */ |
2125 |
++ arm_lpae_iopte *tblp; |
2126 |
++ size_t sz = ARM_LPAE_BLOCK_SIZE(lvl, data); |
2127 |
++ |
2128 |
++ tblp = ptep - ARM_LPAE_LVL_IDX(iova, lvl, data); |
2129 |
++ if (WARN_ON(__arm_lpae_unmap(data, iova, sz, lvl, tblp) != sz)) |
2130 |
++ return -EINVAL; |
2131 |
+ } |
2132 |
+ |
2133 |
+ if (data->iop.cfg.quirks & IO_PGTABLE_QUIRK_ARM_NS) |
2134 |
+diff --git a/drivers/iommu/tegra-smmu.c b/drivers/iommu/tegra-smmu.c |
2135 |
+index c1f2e521dc52..2cd439203d0f 100644 |
2136 |
+--- a/drivers/iommu/tegra-smmu.c |
2137 |
++++ b/drivers/iommu/tegra-smmu.c |
2138 |
+@@ -27,6 +27,7 @@ struct tegra_smmu { |
2139 |
+ const struct tegra_smmu_soc *soc; |
2140 |
+ |
2141 |
+ unsigned long pfn_mask; |
2142 |
++ unsigned long tlb_mask; |
2143 |
+ |
2144 |
+ unsigned long *asids; |
2145 |
+ struct mutex lock; |
2146 |
+@@ -68,7 +69,8 @@ static inline u32 smmu_readl(struct tegra_smmu *smmu, unsigned long offset) |
2147 |
+ #define SMMU_TLB_CONFIG 0x14 |
2148 |
+ #define SMMU_TLB_CONFIG_HIT_UNDER_MISS (1 << 29) |
2149 |
+ #define SMMU_TLB_CONFIG_ROUND_ROBIN_ARBITRATION (1 << 28) |
2150 |
+-#define SMMU_TLB_CONFIG_ACTIVE_LINES(x) ((x) & 0x3f) |
2151 |
++#define SMMU_TLB_CONFIG_ACTIVE_LINES(smmu) \ |
2152 |
++ ((smmu)->soc->num_tlb_lines & (smmu)->tlb_mask) |
2153 |
+ |
2154 |
+ #define SMMU_PTC_CONFIG 0x18 |
2155 |
+ #define SMMU_PTC_CONFIG_ENABLE (1 << 29) |
2156 |
+@@ -816,6 +818,9 @@ struct tegra_smmu *tegra_smmu_probe(struct device *dev, |
2157 |
+ smmu->pfn_mask = BIT_MASK(mc->soc->num_address_bits - PAGE_SHIFT) - 1; |
2158 |
+ dev_dbg(dev, "address bits: %u, PFN mask: %#lx\n", |
2159 |
+ mc->soc->num_address_bits, smmu->pfn_mask); |
2160 |
++ smmu->tlb_mask = (smmu->soc->num_tlb_lines << 1) - 1; |
2161 |
++ dev_dbg(dev, "TLB lines: %u, mask: %#lx\n", smmu->soc->num_tlb_lines, |
2162 |
++ smmu->tlb_mask); |
2163 |
+ |
2164 |
+ value = SMMU_PTC_CONFIG_ENABLE | SMMU_PTC_CONFIG_INDEX_MAP(0x3f); |
2165 |
+ |
2166 |
+@@ -825,7 +830,7 @@ struct tegra_smmu *tegra_smmu_probe(struct device *dev, |
2167 |
+ smmu_writel(smmu, value, SMMU_PTC_CONFIG); |
2168 |
+ |
2169 |
+ value = SMMU_TLB_CONFIG_HIT_UNDER_MISS | |
2170 |
+- SMMU_TLB_CONFIG_ACTIVE_LINES(0x20); |
2171 |
++ SMMU_TLB_CONFIG_ACTIVE_LINES(smmu); |
2172 |
+ |
2173 |
+ if (soc->supports_round_robin_arbitration) |
2174 |
+ value |= SMMU_TLB_CONFIG_ROUND_ROBIN_ARBITRATION; |
2175 |
+diff --git a/drivers/media/platform/am437x/am437x-vpfe.c b/drivers/media/platform/am437x/am437x-vpfe.c |
2176 |
+index 1fba339cddc1..c8447fa3fd91 100644 |
2177 |
+--- a/drivers/media/platform/am437x/am437x-vpfe.c |
2178 |
++++ b/drivers/media/platform/am437x/am437x-vpfe.c |
2179 |
+@@ -1186,14 +1186,24 @@ static int vpfe_initialize_device(struct vpfe_device *vpfe) |
2180 |
+ static int vpfe_release(struct file *file) |
2181 |
+ { |
2182 |
+ struct vpfe_device *vpfe = video_drvdata(file); |
2183 |
++ bool fh_singular; |
2184 |
+ int ret; |
2185 |
+ |
2186 |
+ mutex_lock(&vpfe->lock); |
2187 |
+ |
2188 |
+- if (v4l2_fh_is_singular_file(file)) |
2189 |
+- vpfe_ccdc_close(&vpfe->ccdc, vpfe->pdev); |
2190 |
++ /* Save the singular status before we call the clean-up helper */ |
2191 |
++ fh_singular = v4l2_fh_is_singular_file(file); |
2192 |
++ |
2193 |
++ /* the release helper will cleanup any on-going streaming */ |
2194 |
+ ret = _vb2_fop_release(file, NULL); |
2195 |
+ |
2196 |
++ /* |
2197 |
++ * If this was the last open file. |
2198 |
++ * Then de-initialize hw module. |
2199 |
++ */ |
2200 |
++ if (fh_singular) |
2201 |
++ vpfe_ccdc_close(&vpfe->ccdc, vpfe->pdev); |
2202 |
++ |
2203 |
+ mutex_unlock(&vpfe->lock); |
2204 |
+ |
2205 |
+ return ret; |
2206 |
+@@ -1565,7 +1575,7 @@ static int vpfe_s_fmt(struct file *file, void *priv, |
2207 |
+ return -EBUSY; |
2208 |
+ } |
2209 |
+ |
2210 |
+- ret = vpfe_try_fmt(file, priv, fmt); |
2211 |
++ ret = vpfe_try_fmt(file, priv, &format); |
2212 |
+ if (ret) |
2213 |
+ return ret; |
2214 |
+ |
2215 |
+diff --git a/drivers/media/platform/omap3isp/isp.c b/drivers/media/platform/omap3isp/isp.c |
2216 |
+index 18d0a871747f..12be830d704f 100644 |
2217 |
+--- a/drivers/media/platform/omap3isp/isp.c |
2218 |
++++ b/drivers/media/platform/omap3isp/isp.c |
2219 |
+@@ -829,14 +829,14 @@ static int isp_pipeline_link_notify(struct media_link *link, u32 flags, |
2220 |
+ int ret; |
2221 |
+ |
2222 |
+ if (notification == MEDIA_DEV_NOTIFY_POST_LINK_CH && |
2223 |
+- !(link->flags & MEDIA_LNK_FL_ENABLED)) { |
2224 |
++ !(flags & MEDIA_LNK_FL_ENABLED)) { |
2225 |
+ /* Powering off entities is assumed to never fail. */ |
2226 |
+ isp_pipeline_pm_power(source, -sink_use); |
2227 |
+ isp_pipeline_pm_power(sink, -source_use); |
2228 |
+ return 0; |
2229 |
+ } |
2230 |
+ |
2231 |
+- if (notification == MEDIA_DEV_NOTIFY_POST_LINK_CH && |
2232 |
++ if (notification == MEDIA_DEV_NOTIFY_PRE_LINK_CH && |
2233 |
+ (flags & MEDIA_LNK_FL_ENABLED)) { |
2234 |
+ |
2235 |
+ ret = isp_pipeline_pm_power(source, sink_use); |
2236 |
+@@ -2000,10 +2000,8 @@ static int isp_register_entities(struct isp_device *isp) |
2237 |
+ ret = v4l2_device_register_subdev_nodes(&isp->v4l2_dev); |
2238 |
+ |
2239 |
+ done: |
2240 |
+- if (ret < 0) { |
2241 |
++ if (ret < 0) |
2242 |
+ isp_unregister_entities(isp); |
2243 |
+- v4l2_async_notifier_unregister(&isp->notifier); |
2244 |
+- } |
2245 |
+ |
2246 |
+ return ret; |
2247 |
+ } |
2248 |
+@@ -2423,10 +2421,6 @@ static int isp_probe(struct platform_device *pdev) |
2249 |
+ ret = isp_of_parse_nodes(&pdev->dev, &isp->notifier); |
2250 |
+ if (ret < 0) |
2251 |
+ return ret; |
2252 |
+- ret = v4l2_async_notifier_register(&isp->v4l2_dev, |
2253 |
+- &isp->notifier); |
2254 |
+- if (ret) |
2255 |
+- return ret; |
2256 |
+ } else { |
2257 |
+ isp->pdata = pdev->dev.platform_data; |
2258 |
+ isp->syscon = syscon_regmap_lookup_by_pdevname("syscon.0"); |
2259 |
+@@ -2557,18 +2551,27 @@ static int isp_probe(struct platform_device *pdev) |
2260 |
+ if (ret < 0) |
2261 |
+ goto error_iommu; |
2262 |
+ |
2263 |
+- isp->notifier.bound = isp_subdev_notifier_bound; |
2264 |
+- isp->notifier.complete = isp_subdev_notifier_complete; |
2265 |
+- |
2266 |
+ ret = isp_register_entities(isp); |
2267 |
+ if (ret < 0) |
2268 |
+ goto error_modules; |
2269 |
+ |
2270 |
++ if (IS_ENABLED(CONFIG_OF) && pdev->dev.of_node) { |
2271 |
++ isp->notifier.bound = isp_subdev_notifier_bound; |
2272 |
++ isp->notifier.complete = isp_subdev_notifier_complete; |
2273 |
++ |
2274 |
++ ret = v4l2_async_notifier_register(&isp->v4l2_dev, |
2275 |
++ &isp->notifier); |
2276 |
++ if (ret) |
2277 |
++ goto error_register_entities; |
2278 |
++ } |
2279 |
++ |
2280 |
+ isp_core_init(isp, 1); |
2281 |
+ omap3isp_put(isp); |
2282 |
+ |
2283 |
+ return 0; |
2284 |
+ |
2285 |
++error_register_entities: |
2286 |
++ isp_unregister_entities(isp); |
2287 |
+ error_modules: |
2288 |
+ isp_cleanup_modules(isp); |
2289 |
+ error_iommu: |
2290 |
+diff --git a/drivers/media/platform/xilinx/xilinx-dma.c b/drivers/media/platform/xilinx/xilinx-dma.c |
2291 |
+index 98e50e446d57..e779c93cb015 100644 |
2292 |
+--- a/drivers/media/platform/xilinx/xilinx-dma.c |
2293 |
++++ b/drivers/media/platform/xilinx/xilinx-dma.c |
2294 |
+@@ -699,8 +699,10 @@ int xvip_dma_init(struct xvip_composite_device *xdev, struct xvip_dma *dma, |
2295 |
+ |
2296 |
+ /* ... and the buffers queue... */ |
2297 |
+ dma->alloc_ctx = vb2_dma_contig_init_ctx(dma->xdev->dev); |
2298 |
+- if (IS_ERR(dma->alloc_ctx)) |
2299 |
++ if (IS_ERR(dma->alloc_ctx)) { |
2300 |
++ ret = PTR_ERR(dma->alloc_ctx); |
2301 |
+ goto error; |
2302 |
++ } |
2303 |
+ |
2304 |
+ /* Don't enable VB2_READ and VB2_WRITE, as using the read() and write() |
2305 |
+ * V4L2 APIs would be inefficient. Testing on the command line with a |
2306 |
+diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c |
2307 |
+index 0ff388a16168..f3b6b2caabf6 100644 |
2308 |
+--- a/drivers/media/rc/rc-main.c |
2309 |
++++ b/drivers/media/rc/rc-main.c |
2310 |
+@@ -1191,9 +1191,6 @@ static int rc_dev_uevent(struct device *device, struct kobj_uevent_env *env) |
2311 |
+ { |
2312 |
+ struct rc_dev *dev = to_rc_dev(device); |
2313 |
+ |
2314 |
+- if (!dev || !dev->input_dev) |
2315 |
+- return -ENODEV; |
2316 |
+- |
2317 |
+ if (dev->rc_map.name) |
2318 |
+ ADD_HOTPLUG_VAR("NAME=%s", dev->rc_map.name); |
2319 |
+ if (dev->driver_name) |
2320 |
+diff --git a/drivers/memory/tegra/tegra114.c b/drivers/memory/tegra/tegra114.c |
2321 |
+index 9f579589e800..9bf11ea90549 100644 |
2322 |
+--- a/drivers/memory/tegra/tegra114.c |
2323 |
++++ b/drivers/memory/tegra/tegra114.c |
2324 |
+@@ -935,6 +935,7 @@ static const struct tegra_smmu_soc tegra114_smmu_soc = { |
2325 |
+ .num_swgroups = ARRAY_SIZE(tegra114_swgroups), |
2326 |
+ .supports_round_robin_arbitration = false, |
2327 |
+ .supports_request_limit = false, |
2328 |
++ .num_tlb_lines = 32, |
2329 |
+ .num_asids = 4, |
2330 |
+ .ops = &tegra114_smmu_ops, |
2331 |
+ }; |
2332 |
+diff --git a/drivers/memory/tegra/tegra124.c b/drivers/memory/tegra/tegra124.c |
2333 |
+index 966e1557e6f4..70ed80d23431 100644 |
2334 |
+--- a/drivers/memory/tegra/tegra124.c |
2335 |
++++ b/drivers/memory/tegra/tegra124.c |
2336 |
+@@ -1023,6 +1023,7 @@ static const struct tegra_smmu_soc tegra124_smmu_soc = { |
2337 |
+ .num_swgroups = ARRAY_SIZE(tegra124_swgroups), |
2338 |
+ .supports_round_robin_arbitration = true, |
2339 |
+ .supports_request_limit = true, |
2340 |
++ .num_tlb_lines = 32, |
2341 |
+ .num_asids = 128, |
2342 |
+ .ops = &tegra124_smmu_ops, |
2343 |
+ }; |
2344 |
+diff --git a/drivers/memory/tegra/tegra30.c b/drivers/memory/tegra/tegra30.c |
2345 |
+index 1abcd8f6f3ba..b2a34fefabef 100644 |
2346 |
+--- a/drivers/memory/tegra/tegra30.c |
2347 |
++++ b/drivers/memory/tegra/tegra30.c |
2348 |
+@@ -957,6 +957,7 @@ static const struct tegra_smmu_soc tegra30_smmu_soc = { |
2349 |
+ .num_swgroups = ARRAY_SIZE(tegra30_swgroups), |
2350 |
+ .supports_round_robin_arbitration = false, |
2351 |
+ .supports_request_limit = false, |
2352 |
++ .num_tlb_lines = 16, |
2353 |
+ .num_asids = 4, |
2354 |
+ .ops = &tegra30_smmu_ops, |
2355 |
+ }; |
2356 |
+diff --git a/drivers/misc/cxl/api.c b/drivers/misc/cxl/api.c |
2357 |
+index 729e0851167d..4224a6acf4c4 100644 |
2358 |
+--- a/drivers/misc/cxl/api.c |
2359 |
++++ b/drivers/misc/cxl/api.c |
2360 |
+@@ -59,7 +59,7 @@ EXPORT_SYMBOL_GPL(cxl_get_phys_dev); |
2361 |
+ |
2362 |
+ int cxl_release_context(struct cxl_context *ctx) |
2363 |
+ { |
2364 |
+- if (ctx->status != CLOSED) |
2365 |
++ if (ctx->status >= STARTED) |
2366 |
+ return -EBUSY; |
2367 |
+ |
2368 |
+ put_device(&ctx->afu->dev); |
2369 |
+diff --git a/drivers/misc/cxl/pci.c b/drivers/misc/cxl/pci.c |
2370 |
+index 32ad09705949..dc836071c633 100644 |
2371 |
+--- a/drivers/misc/cxl/pci.c |
2372 |
++++ b/drivers/misc/cxl/pci.c |
2373 |
+@@ -851,16 +851,9 @@ int cxl_reset(struct cxl *adapter) |
2374 |
+ { |
2375 |
+ struct pci_dev *dev = to_pci_dev(adapter->dev.parent); |
2376 |
+ int rc; |
2377 |
+- int i; |
2378 |
+- u32 val; |
2379 |
+ |
2380 |
+ dev_info(&dev->dev, "CXL reset\n"); |
2381 |
+ |
2382 |
+- for (i = 0; i < adapter->slices; i++) { |
2383 |
+- cxl_pci_vphb_remove(adapter->afu[i]); |
2384 |
+- cxl_remove_afu(adapter->afu[i]); |
2385 |
+- } |
2386 |
+- |
2387 |
+ /* pcie_warm_reset requests a fundamental pci reset which includes a |
2388 |
+ * PERST assert/deassert. PERST triggers a loading of the image |
2389 |
+ * if "user" or "factory" is selected in sysfs */ |
2390 |
+@@ -869,20 +862,6 @@ int cxl_reset(struct cxl *adapter) |
2391 |
+ return rc; |
2392 |
+ } |
2393 |
+ |
2394 |
+- /* the PERST done above fences the PHB. So, reset depends on EEH |
2395 |
+- * to unbind the driver, tell Sapphire to reinit the PHB, and rebind |
2396 |
+- * the driver. Do an mmio read explictly to ensure EEH notices the |
2397 |
+- * fenced PHB. Retry for a few seconds before giving up. */ |
2398 |
+- i = 0; |
2399 |
+- while (((val = mmio_read32be(adapter->p1_mmio)) != 0xffffffff) && |
2400 |
+- (i < 5)) { |
2401 |
+- msleep(500); |
2402 |
+- i++; |
2403 |
+- } |
2404 |
+- |
2405 |
+- if (val != 0xffffffff) |
2406 |
+- dev_err(&dev->dev, "cxl: PERST failed to trigger EEH\n"); |
2407 |
+- |
2408 |
+ return rc; |
2409 |
+ } |
2410 |
+ |
2411 |
+@@ -1140,8 +1119,6 @@ static int cxl_probe(struct pci_dev *dev, const struct pci_device_id *id) |
2412 |
+ int slice; |
2413 |
+ int rc; |
2414 |
+ |
2415 |
+- pci_dev_get(dev); |
2416 |
+- |
2417 |
+ if (cxl_verbose) |
2418 |
+ dump_cxl_config_space(dev); |
2419 |
+ |
2420 |
+diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c |
2421 |
+index 9ad73f30f744..9e3fdbdc4037 100644 |
2422 |
+--- a/drivers/mmc/core/core.c |
2423 |
++++ b/drivers/mmc/core/core.c |
2424 |
+@@ -358,8 +358,10 @@ EXPORT_SYMBOL(mmc_start_bkops); |
2425 |
+ */ |
2426 |
+ static void mmc_wait_data_done(struct mmc_request *mrq) |
2427 |
+ { |
2428 |
+- mrq->host->context_info.is_done_rcv = true; |
2429 |
+- wake_up_interruptible(&mrq->host->context_info.wait); |
2430 |
++ struct mmc_context_info *context_info = &mrq->host->context_info; |
2431 |
++ |
2432 |
++ context_info->is_done_rcv = true; |
2433 |
++ wake_up_interruptible(&context_info->wait); |
2434 |
+ } |
2435 |
+ |
2436 |
+ static void mmc_wait_done(struct mmc_request *mrq) |
2437 |
+diff --git a/drivers/mmc/host/sdhci-of-esdhc.c b/drivers/mmc/host/sdhci-of-esdhc.c |
2438 |
+index 797be7549a15..653f335bef15 100644 |
2439 |
+--- a/drivers/mmc/host/sdhci-of-esdhc.c |
2440 |
++++ b/drivers/mmc/host/sdhci-of-esdhc.c |
2441 |
+@@ -208,6 +208,12 @@ static void esdhc_of_set_clock(struct sdhci_host *host, unsigned int clock) |
2442 |
+ if (clock == 0) |
2443 |
+ return; |
2444 |
+ |
2445 |
++ /* Workaround to start pre_div at 2 for VNN < VENDOR_V_23 */ |
2446 |
++ temp = esdhc_readw(host, SDHCI_HOST_VERSION); |
2447 |
++ temp = (temp & SDHCI_VENDOR_VER_MASK) >> SDHCI_VENDOR_VER_SHIFT; |
2448 |
++ if (temp < VENDOR_V_23) |
2449 |
++ pre_div = 2; |
2450 |
++ |
2451 |
+ /* Workaround to reduce the clock frequency for p1010 esdhc */ |
2452 |
+ if (of_find_compatible_node(NULL, NULL, "fsl,p1010-esdhc")) { |
2453 |
+ if (clock > 20000000) |
2454 |
+diff --git a/drivers/mmc/host/sdhci-pci.c b/drivers/mmc/host/sdhci-pci.c |
2455 |
+index 94f54d2772e8..b3b0a3e4fca1 100644 |
2456 |
+--- a/drivers/mmc/host/sdhci-pci.c |
2457 |
++++ b/drivers/mmc/host/sdhci-pci.c |
2458 |
+@@ -618,6 +618,7 @@ static int jmicron_resume(struct sdhci_pci_chip *chip) |
2459 |
+ static const struct sdhci_pci_fixes sdhci_o2 = { |
2460 |
+ .probe = sdhci_pci_o2_probe, |
2461 |
+ .quirks = SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC, |
2462 |
++ .quirks2 = SDHCI_QUIRK2_CLEAR_TRANSFERMODE_REG_BEFORE_CMD, |
2463 |
+ .probe_slot = sdhci_pci_o2_probe_slot, |
2464 |
+ .resume = sdhci_pci_o2_resume, |
2465 |
+ }; |
2466 |
+diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c |
2467 |
+index 1dbe93232030..b0c915a35a9e 100644 |
2468 |
+--- a/drivers/mmc/host/sdhci.c |
2469 |
++++ b/drivers/mmc/host/sdhci.c |
2470 |
+@@ -54,8 +54,7 @@ static void sdhci_finish_command(struct sdhci_host *); |
2471 |
+ static int sdhci_execute_tuning(struct mmc_host *mmc, u32 opcode); |
2472 |
+ static void sdhci_enable_preset_value(struct sdhci_host *host, bool enable); |
2473 |
+ static int sdhci_pre_dma_transfer(struct sdhci_host *host, |
2474 |
+- struct mmc_data *data, |
2475 |
+- struct sdhci_host_next *next); |
2476 |
++ struct mmc_data *data); |
2477 |
+ static int sdhci_do_get_cd(struct sdhci_host *host); |
2478 |
+ |
2479 |
+ #ifdef CONFIG_PM |
2480 |
+@@ -496,7 +495,7 @@ static int sdhci_adma_table_pre(struct sdhci_host *host, |
2481 |
+ goto fail; |
2482 |
+ BUG_ON(host->align_addr & host->align_mask); |
2483 |
+ |
2484 |
+- host->sg_count = sdhci_pre_dma_transfer(host, data, NULL); |
2485 |
++ host->sg_count = sdhci_pre_dma_transfer(host, data); |
2486 |
+ if (host->sg_count < 0) |
2487 |
+ goto unmap_align; |
2488 |
+ |
2489 |
+@@ -635,9 +634,11 @@ static void sdhci_adma_table_post(struct sdhci_host *host, |
2490 |
+ } |
2491 |
+ } |
2492 |
+ |
2493 |
+- if (!data->host_cookie) |
2494 |
++ if (data->host_cookie == COOKIE_MAPPED) { |
2495 |
+ dma_unmap_sg(mmc_dev(host->mmc), data->sg, |
2496 |
+ data->sg_len, direction); |
2497 |
++ data->host_cookie = COOKIE_UNMAPPED; |
2498 |
++ } |
2499 |
+ } |
2500 |
+ |
2501 |
+ static u8 sdhci_calc_timeout(struct sdhci_host *host, struct mmc_command *cmd) |
2502 |
+@@ -833,7 +834,7 @@ static void sdhci_prepare_data(struct sdhci_host *host, struct mmc_command *cmd) |
2503 |
+ } else { |
2504 |
+ int sg_cnt; |
2505 |
+ |
2506 |
+- sg_cnt = sdhci_pre_dma_transfer(host, data, NULL); |
2507 |
++ sg_cnt = sdhci_pre_dma_transfer(host, data); |
2508 |
+ if (sg_cnt <= 0) { |
2509 |
+ /* |
2510 |
+ * This only happens when someone fed |
2511 |
+@@ -949,11 +950,13 @@ static void sdhci_finish_data(struct sdhci_host *host) |
2512 |
+ if (host->flags & SDHCI_USE_ADMA) |
2513 |
+ sdhci_adma_table_post(host, data); |
2514 |
+ else { |
2515 |
+- if (!data->host_cookie) |
2516 |
++ if (data->host_cookie == COOKIE_MAPPED) { |
2517 |
+ dma_unmap_sg(mmc_dev(host->mmc), |
2518 |
+ data->sg, data->sg_len, |
2519 |
+ (data->flags & MMC_DATA_READ) ? |
2520 |
+ DMA_FROM_DEVICE : DMA_TO_DEVICE); |
2521 |
++ data->host_cookie = COOKIE_UNMAPPED; |
2522 |
++ } |
2523 |
+ } |
2524 |
+ } |
2525 |
+ |
2526 |
+@@ -1132,6 +1135,7 @@ static u16 sdhci_get_preset_value(struct sdhci_host *host) |
2527 |
+ preset = sdhci_readw(host, SDHCI_PRESET_FOR_SDR104); |
2528 |
+ break; |
2529 |
+ case MMC_TIMING_UHS_DDR50: |
2530 |
++ case MMC_TIMING_MMC_DDR52: |
2531 |
+ preset = sdhci_readw(host, SDHCI_PRESET_FOR_DDR50); |
2532 |
+ break; |
2533 |
+ case MMC_TIMING_MMC_HS400: |
2534 |
+@@ -1559,7 +1563,8 @@ static void sdhci_do_set_ios(struct sdhci_host *host, struct mmc_ios *ios) |
2535 |
+ (ios->timing == MMC_TIMING_UHS_SDR25) || |
2536 |
+ (ios->timing == MMC_TIMING_UHS_SDR50) || |
2537 |
+ (ios->timing == MMC_TIMING_UHS_SDR104) || |
2538 |
+- (ios->timing == MMC_TIMING_UHS_DDR50))) { |
2539 |
++ (ios->timing == MMC_TIMING_UHS_DDR50) || |
2540 |
++ (ios->timing == MMC_TIMING_MMC_DDR52))) { |
2541 |
+ u16 preset; |
2542 |
+ |
2543 |
+ sdhci_enable_preset_value(host, true); |
2544 |
+@@ -2097,49 +2102,36 @@ static void sdhci_post_req(struct mmc_host *mmc, struct mmc_request *mrq, |
2545 |
+ struct mmc_data *data = mrq->data; |
2546 |
+ |
2547 |
+ if (host->flags & SDHCI_REQ_USE_DMA) { |
2548 |
+- if (data->host_cookie) |
2549 |
++ if (data->host_cookie == COOKIE_GIVEN || |
2550 |
++ data->host_cookie == COOKIE_MAPPED) |
2551 |
+ dma_unmap_sg(mmc_dev(host->mmc), data->sg, data->sg_len, |
2552 |
+ data->flags & MMC_DATA_WRITE ? |
2553 |
+ DMA_TO_DEVICE : DMA_FROM_DEVICE); |
2554 |
+- mrq->data->host_cookie = 0; |
2555 |
++ data->host_cookie = COOKIE_UNMAPPED; |
2556 |
+ } |
2557 |
+ } |
2558 |
+ |
2559 |
+ static int sdhci_pre_dma_transfer(struct sdhci_host *host, |
2560 |
+- struct mmc_data *data, |
2561 |
+- struct sdhci_host_next *next) |
2562 |
++ struct mmc_data *data) |
2563 |
+ { |
2564 |
+ int sg_count; |
2565 |
+ |
2566 |
+- if (!next && data->host_cookie && |
2567 |
+- data->host_cookie != host->next_data.cookie) { |
2568 |
+- pr_debug(DRIVER_NAME "[%s] invalid cookie: %d, next-cookie %d\n", |
2569 |
+- __func__, data->host_cookie, host->next_data.cookie); |
2570 |
+- data->host_cookie = 0; |
2571 |
++ if (data->host_cookie == COOKIE_MAPPED) { |
2572 |
++ data->host_cookie = COOKIE_GIVEN; |
2573 |
++ return data->sg_count; |
2574 |
+ } |
2575 |
+ |
2576 |
+- /* Check if next job is already prepared */ |
2577 |
+- if (next || |
2578 |
+- (!next && data->host_cookie != host->next_data.cookie)) { |
2579 |
+- sg_count = dma_map_sg(mmc_dev(host->mmc), data->sg, |
2580 |
+- data->sg_len, |
2581 |
+- data->flags & MMC_DATA_WRITE ? |
2582 |
+- DMA_TO_DEVICE : DMA_FROM_DEVICE); |
2583 |
+- |
2584 |
+- } else { |
2585 |
+- sg_count = host->next_data.sg_count; |
2586 |
+- host->next_data.sg_count = 0; |
2587 |
+- } |
2588 |
++ WARN_ON(data->host_cookie == COOKIE_GIVEN); |
2589 |
+ |
2590 |
++ sg_count = dma_map_sg(mmc_dev(host->mmc), data->sg, data->sg_len, |
2591 |
++ data->flags & MMC_DATA_WRITE ? |
2592 |
++ DMA_TO_DEVICE : DMA_FROM_DEVICE); |
2593 |
+ |
2594 |
+ if (sg_count == 0) |
2595 |
+- return -EINVAL; |
2596 |
++ return -ENOSPC; |
2597 |
+ |
2598 |
+- if (next) { |
2599 |
+- next->sg_count = sg_count; |
2600 |
+- data->host_cookie = ++next->cookie < 0 ? 1 : next->cookie; |
2601 |
+- } else |
2602 |
+- host->sg_count = sg_count; |
2603 |
++ data->sg_count = sg_count; |
2604 |
++ data->host_cookie = COOKIE_MAPPED; |
2605 |
+ |
2606 |
+ return sg_count; |
2607 |
+ } |
2608 |
+@@ -2149,16 +2141,10 @@ static void sdhci_pre_req(struct mmc_host *mmc, struct mmc_request *mrq, |
2609 |
+ { |
2610 |
+ struct sdhci_host *host = mmc_priv(mmc); |
2611 |
+ |
2612 |
+- if (mrq->data->host_cookie) { |
2613 |
+- mrq->data->host_cookie = 0; |
2614 |
+- return; |
2615 |
+- } |
2616 |
++ mrq->data->host_cookie = COOKIE_UNMAPPED; |
2617 |
+ |
2618 |
+ if (host->flags & SDHCI_REQ_USE_DMA) |
2619 |
+- if (sdhci_pre_dma_transfer(host, |
2620 |
+- mrq->data, |
2621 |
+- &host->next_data) < 0) |
2622 |
+- mrq->data->host_cookie = 0; |
2623 |
++ sdhci_pre_dma_transfer(host, mrq->data); |
2624 |
+ } |
2625 |
+ |
2626 |
+ static void sdhci_card_event(struct mmc_host *mmc) |
2627 |
+@@ -3030,7 +3016,6 @@ int sdhci_add_host(struct sdhci_host *host) |
2628 |
+ host->max_clk = host->ops->get_max_clock(host); |
2629 |
+ } |
2630 |
+ |
2631 |
+- host->next_data.cookie = 1; |
2632 |
+ /* |
2633 |
+ * In case of Host Controller v3.00, find out whether clock |
2634 |
+ * multiplier is supported. |
2635 |
+diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h |
2636 |
+index 5521d29368e4..a9512a421f52 100644 |
2637 |
+--- a/drivers/mmc/host/sdhci.h |
2638 |
++++ b/drivers/mmc/host/sdhci.h |
2639 |
+@@ -309,9 +309,10 @@ struct sdhci_adma2_64_desc { |
2640 |
+ */ |
2641 |
+ #define SDHCI_MAX_SEGS 128 |
2642 |
+ |
2643 |
+-struct sdhci_host_next { |
2644 |
+- unsigned int sg_count; |
2645 |
+- s32 cookie; |
2646 |
++enum sdhci_cookie { |
2647 |
++ COOKIE_UNMAPPED, |
2648 |
++ COOKIE_MAPPED, |
2649 |
++ COOKIE_GIVEN, |
2650 |
+ }; |
2651 |
+ |
2652 |
+ struct sdhci_host { |
2653 |
+@@ -503,7 +504,6 @@ struct sdhci_host { |
2654 |
+ unsigned int tuning_mode; /* Re-tuning mode supported by host */ |
2655 |
+ #define SDHCI_TUNING_MODE_1 0 |
2656 |
+ |
2657 |
+- struct sdhci_host_next next_data; |
2658 |
+ unsigned long private[0] ____cacheline_aligned; |
2659 |
+ }; |
2660 |
+ |
2661 |
+diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c |
2662 |
+index 73c934cf6c61..79789d8e52da 100644 |
2663 |
+--- a/drivers/net/ethernet/broadcom/tg3.c |
2664 |
++++ b/drivers/net/ethernet/broadcom/tg3.c |
2665 |
+@@ -10757,7 +10757,7 @@ static ssize_t tg3_show_temp(struct device *dev, |
2666 |
+ tg3_ape_scratchpad_read(tp, &temperature, attr->index, |
2667 |
+ sizeof(temperature)); |
2668 |
+ spin_unlock_bh(&tp->lock); |
2669 |
+- return sprintf(buf, "%u\n", temperature); |
2670 |
++ return sprintf(buf, "%u\n", temperature * 1000); |
2671 |
+ } |
2672 |
+ |
2673 |
+ |
2674 |
+diff --git a/drivers/net/ethernet/intel/igb/igb.h b/drivers/net/ethernet/intel/igb/igb.h |
2675 |
+index c2bd4f98a837..212d668dabb3 100644 |
2676 |
+--- a/drivers/net/ethernet/intel/igb/igb.h |
2677 |
++++ b/drivers/net/ethernet/intel/igb/igb.h |
2678 |
+@@ -540,6 +540,7 @@ void igb_ptp_rx_pktstamp(struct igb_q_vector *q_vector, unsigned char *va, |
2679 |
+ struct sk_buff *skb); |
2680 |
+ int igb_ptp_set_ts_config(struct net_device *netdev, struct ifreq *ifr); |
2681 |
+ int igb_ptp_get_ts_config(struct net_device *netdev, struct ifreq *ifr); |
2682 |
++void igb_set_flag_queue_pairs(struct igb_adapter *, const u32); |
2683 |
+ #ifdef CONFIG_IGB_HWMON |
2684 |
+ void igb_sysfs_exit(struct igb_adapter *adapter); |
2685 |
+ int igb_sysfs_init(struct igb_adapter *adapter); |
2686 |
+diff --git a/drivers/net/ethernet/intel/igb/igb_ethtool.c b/drivers/net/ethernet/intel/igb/igb_ethtool.c |
2687 |
+index d5673eb90c54..0afc0913e5b9 100644 |
2688 |
+--- a/drivers/net/ethernet/intel/igb/igb_ethtool.c |
2689 |
++++ b/drivers/net/ethernet/intel/igb/igb_ethtool.c |
2690 |
+@@ -2991,6 +2991,7 @@ static int igb_set_channels(struct net_device *netdev, |
2691 |
+ { |
2692 |
+ struct igb_adapter *adapter = netdev_priv(netdev); |
2693 |
+ unsigned int count = ch->combined_count; |
2694 |
++ unsigned int max_combined = 0; |
2695 |
+ |
2696 |
+ /* Verify they are not requesting separate vectors */ |
2697 |
+ if (!count || ch->rx_count || ch->tx_count) |
2698 |
+@@ -3001,11 +3002,13 @@ static int igb_set_channels(struct net_device *netdev, |
2699 |
+ return -EINVAL; |
2700 |
+ |
2701 |
+ /* Verify the number of channels doesn't exceed hw limits */ |
2702 |
+- if (count > igb_max_channels(adapter)) |
2703 |
++ max_combined = igb_max_channels(adapter); |
2704 |
++ if (count > max_combined) |
2705 |
+ return -EINVAL; |
2706 |
+ |
2707 |
+ if (count != adapter->rss_queues) { |
2708 |
+ adapter->rss_queues = count; |
2709 |
++ igb_set_flag_queue_pairs(adapter, max_combined); |
2710 |
+ |
2711 |
+ /* Hardware has to reinitialize queues and interrupts to |
2712 |
+ * match the new configuration. |
2713 |
+diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c |
2714 |
+index 830466c49987..8d7b59689722 100644 |
2715 |
+--- a/drivers/net/ethernet/intel/igb/igb_main.c |
2716 |
++++ b/drivers/net/ethernet/intel/igb/igb_main.c |
2717 |
+@@ -1205,10 +1205,14 @@ static int igb_alloc_q_vector(struct igb_adapter *adapter, |
2718 |
+ |
2719 |
+ /* allocate q_vector and rings */ |
2720 |
+ q_vector = adapter->q_vector[v_idx]; |
2721 |
+- if (!q_vector) |
2722 |
++ if (!q_vector) { |
2723 |
+ q_vector = kzalloc(size, GFP_KERNEL); |
2724 |
+- else |
2725 |
++ } else if (size > ksize(q_vector)) { |
2726 |
++ kfree_rcu(q_vector, rcu); |
2727 |
++ q_vector = kzalloc(size, GFP_KERNEL); |
2728 |
++ } else { |
2729 |
+ memset(q_vector, 0, size); |
2730 |
++ } |
2731 |
+ if (!q_vector) |
2732 |
+ return -ENOMEM; |
2733 |
+ |
2734 |
+@@ -2888,6 +2892,14 @@ static void igb_init_queue_configuration(struct igb_adapter *adapter) |
2735 |
+ |
2736 |
+ adapter->rss_queues = min_t(u32, max_rss_queues, num_online_cpus()); |
2737 |
+ |
2738 |
++ igb_set_flag_queue_pairs(adapter, max_rss_queues); |
2739 |
++} |
2740 |
++ |
2741 |
++void igb_set_flag_queue_pairs(struct igb_adapter *adapter, |
2742 |
++ const u32 max_rss_queues) |
2743 |
++{ |
2744 |
++ struct e1000_hw *hw = &adapter->hw; |
2745 |
++ |
2746 |
+ /* Determine if we need to pair queues. */ |
2747 |
+ switch (hw->mac.type) { |
2748 |
+ case e1000_82575: |
2749 |
+diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c |
2750 |
+index 864b476f7fd5..925f2f8659b8 100644 |
2751 |
+--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c |
2752 |
++++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c |
2753 |
+@@ -837,8 +837,11 @@ static int stmmac_init_phy(struct net_device *dev) |
2754 |
+ interface); |
2755 |
+ } |
2756 |
+ |
2757 |
+- if (IS_ERR(phydev)) { |
2758 |
++ if (IS_ERR_OR_NULL(phydev)) { |
2759 |
+ pr_err("%s: Could not attach to PHY\n", dev->name); |
2760 |
++ if (!phydev) |
2761 |
++ return -ENODEV; |
2762 |
++ |
2763 |
+ return PTR_ERR(phydev); |
2764 |
+ } |
2765 |
+ |
2766 |
+diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c |
2767 |
+index 23806c243a53..fd4a5353d216 100644 |
2768 |
+--- a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c |
2769 |
++++ b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c |
2770 |
+@@ -321,6 +321,7 @@ static struct usb_device_id rtl8192c_usb_ids[] = { |
2771 |
+ {RTL_USB_DEVICE(0x07b8, 0x8188, rtl92cu_hal_cfg)}, /*Abocom - Abocom*/ |
2772 |
+ {RTL_USB_DEVICE(0x07b8, 0x8189, rtl92cu_hal_cfg)}, /*Funai - Abocom*/ |
2773 |
+ {RTL_USB_DEVICE(0x0846, 0x9041, rtl92cu_hal_cfg)}, /*NetGear WNA1000M*/ |
2774 |
++ {RTL_USB_DEVICE(0x0846, 0x9043, rtl92cu_hal_cfg)}, /*NG WNA1000Mv2*/ |
2775 |
+ {RTL_USB_DEVICE(0x0b05, 0x17ba, rtl92cu_hal_cfg)}, /*ASUS-Edimax*/ |
2776 |
+ {RTL_USB_DEVICE(0x0bda, 0x5088, rtl92cu_hal_cfg)}, /*Thinkware-CC&C*/ |
2777 |
+ {RTL_USB_DEVICE(0x0df6, 0x0052, rtl92cu_hal_cfg)}, /*Sitecom - Edimax*/ |
2778 |
+diff --git a/drivers/net/wireless/rtlwifi/rtl8821ae/hw.c b/drivers/net/wireless/rtlwifi/rtl8821ae/hw.c |
2779 |
+index 3236d44b459d..b7f18e2155eb 100644 |
2780 |
+--- a/drivers/net/wireless/rtlwifi/rtl8821ae/hw.c |
2781 |
++++ b/drivers/net/wireless/rtlwifi/rtl8821ae/hw.c |
2782 |
+@@ -2180,7 +2180,7 @@ static int _rtl8821ae_set_media_status(struct ieee80211_hw *hw, |
2783 |
+ |
2784 |
+ rtl_write_byte(rtlpriv, MSR, bt_msr); |
2785 |
+ rtlpriv->cfg->ops->led_control(hw, ledaction); |
2786 |
+- if ((bt_msr & 0xfc) == MSR_AP) |
2787 |
++ if ((bt_msr & MSR_MASK) == MSR_AP) |
2788 |
+ rtl_write_byte(rtlpriv, REG_BCNTCFG + 1, 0x00); |
2789 |
+ else |
2790 |
+ rtl_write_byte(rtlpriv, REG_BCNTCFG + 1, 0x66); |
2791 |
+diff --git a/drivers/net/wireless/rtlwifi/rtl8821ae/reg.h b/drivers/net/wireless/rtlwifi/rtl8821ae/reg.h |
2792 |
+index 53668fc8f23e..1d6110f9c1fb 100644 |
2793 |
+--- a/drivers/net/wireless/rtlwifi/rtl8821ae/reg.h |
2794 |
++++ b/drivers/net/wireless/rtlwifi/rtl8821ae/reg.h |
2795 |
+@@ -429,6 +429,7 @@ |
2796 |
+ #define MSR_ADHOC 0x01 |
2797 |
+ #define MSR_INFRA 0x02 |
2798 |
+ #define MSR_AP 0x03 |
2799 |
++#define MSR_MASK 0x03 |
2800 |
+ |
2801 |
+ #define RRSR_RSC_OFFSET 21 |
2802 |
+ #define RRSR_SHORT_OFFSET 23 |
2803 |
+diff --git a/drivers/nfc/st-nci/i2c.c b/drivers/nfc/st-nci/i2c.c |
2804 |
+index 06175ce769bb..707ed2eb5936 100644 |
2805 |
+--- a/drivers/nfc/st-nci/i2c.c |
2806 |
++++ b/drivers/nfc/st-nci/i2c.c |
2807 |
+@@ -25,15 +25,15 @@ |
2808 |
+ #include <linux/interrupt.h> |
2809 |
+ #include <linux/delay.h> |
2810 |
+ #include <linux/nfc.h> |
2811 |
+-#include <linux/platform_data/st_nci.h> |
2812 |
++#include <linux/platform_data/st-nci.h> |
2813 |
+ |
2814 |
+ #include "ndlc.h" |
2815 |
+ |
2816 |
+-#define DRIVER_DESC "NCI NFC driver for ST21NFCB" |
2817 |
++#define DRIVER_DESC "NCI NFC driver for ST_NCI" |
2818 |
+ |
2819 |
+ /* ndlc header */ |
2820 |
+-#define ST21NFCB_FRAME_HEADROOM 1 |
2821 |
+-#define ST21NFCB_FRAME_TAILROOM 0 |
2822 |
++#define ST_NCI_FRAME_HEADROOM 1 |
2823 |
++#define ST_NCI_FRAME_TAILROOM 0 |
2824 |
+ |
2825 |
+ #define ST_NCI_I2C_MIN_SIZE 4 /* PCB(1) + NCI Packet header(3) */ |
2826 |
+ #define ST_NCI_I2C_MAX_SIZE 250 /* req 4.2.1 */ |
2827 |
+@@ -118,15 +118,10 @@ static int st_nci_i2c_write(void *phy_id, struct sk_buff *skb) |
2828 |
+ /* |
2829 |
+ * Reads an ndlc frame and returns it in a newly allocated sk_buff. |
2830 |
+ * returns: |
2831 |
+- * frame size : if received frame is complete (find ST21NFCB_SOF_EOF at |
2832 |
+- * end of read) |
2833 |
+- * -EAGAIN : if received frame is incomplete (not find ST21NFCB_SOF_EOF |
2834 |
+- * at end of read) |
2835 |
++ * 0 : if received frame is complete |
2836 |
+ * -EREMOTEIO : i2c read error (fatal) |
2837 |
+ * -EBADMSG : frame was incorrect and discarded |
2838 |
+- * (value returned from st_nci_i2c_repack) |
2839 |
+- * -EIO : if no ST21NFCB_SOF_EOF is found after reaching |
2840 |
+- * the read length end sequence |
2841 |
++ * -ENOMEM : cannot allocate skb, frame dropped |
2842 |
+ */ |
2843 |
+ static int st_nci_i2c_read(struct st_nci_i2c_phy *phy, |
2844 |
+ struct sk_buff **skb) |
2845 |
+@@ -179,7 +174,7 @@ static int st_nci_i2c_read(struct st_nci_i2c_phy *phy, |
2846 |
+ /* |
2847 |
+ * Reads an ndlc frame from the chip. |
2848 |
+ * |
2849 |
+- * On ST21NFCB, IRQ goes in idle state when read starts. |
2850 |
++ * On ST_NCI, IRQ goes in idle state when read starts. |
2851 |
+ */ |
2852 |
+ static irqreturn_t st_nci_irq_thread_fn(int irq, void *phy_id) |
2853 |
+ { |
2854 |
+@@ -325,12 +320,12 @@ static int st_nci_i2c_probe(struct i2c_client *client, |
2855 |
+ } |
2856 |
+ } else { |
2857 |
+ nfc_err(&client->dev, |
2858 |
+- "st21nfcb platform resources not available\n"); |
2859 |
++ "st_nci platform resources not available\n"); |
2860 |
+ return -ENODEV; |
2861 |
+ } |
2862 |
+ |
2863 |
+ r = ndlc_probe(phy, &i2c_phy_ops, &client->dev, |
2864 |
+- ST21NFCB_FRAME_HEADROOM, ST21NFCB_FRAME_TAILROOM, |
2865 |
++ ST_NCI_FRAME_HEADROOM, ST_NCI_FRAME_TAILROOM, |
2866 |
+ &phy->ndlc); |
2867 |
+ if (r < 0) { |
2868 |
+ nfc_err(&client->dev, "Unable to register ndlc layer\n"); |
2869 |
+diff --git a/drivers/nfc/st-nci/ndlc.c b/drivers/nfc/st-nci/ndlc.c |
2870 |
+index 56c6a4cb4c96..4f51649d0e75 100644 |
2871 |
+--- a/drivers/nfc/st-nci/ndlc.c |
2872 |
++++ b/drivers/nfc/st-nci/ndlc.c |
2873 |
+@@ -171,6 +171,8 @@ static void llt_ndlc_rcv_queue(struct llt_ndlc *ndlc) |
2874 |
+ if ((pcb & PCB_TYPE_MASK) == PCB_TYPE_SUPERVISOR) { |
2875 |
+ switch (pcb & PCB_SYNC_MASK) { |
2876 |
+ case PCB_SYNC_ACK: |
2877 |
++ skb = skb_dequeue(&ndlc->ack_pending_q); |
2878 |
++ kfree_skb(skb); |
2879 |
+ del_timer_sync(&ndlc->t1_timer); |
2880 |
+ del_timer_sync(&ndlc->t2_timer); |
2881 |
+ ndlc->t2_active = false; |
2882 |
+@@ -196,8 +198,10 @@ static void llt_ndlc_rcv_queue(struct llt_ndlc *ndlc) |
2883 |
+ kfree_skb(skb); |
2884 |
+ break; |
2885 |
+ } |
2886 |
+- } else { |
2887 |
++ } else if ((pcb & PCB_TYPE_MASK) == PCB_TYPE_DATAFRAME) { |
2888 |
+ nci_recv_frame(ndlc->ndev, skb); |
2889 |
++ } else { |
2890 |
++ kfree_skb(skb); |
2891 |
+ } |
2892 |
+ } |
2893 |
+ } |
2894 |
+diff --git a/drivers/nfc/st-nci/st-nci_se.c b/drivers/nfc/st-nci/st-nci_se.c |
2895 |
+index 97addfa96c6f..c742ef65a05a 100644 |
2896 |
+--- a/drivers/nfc/st-nci/st-nci_se.c |
2897 |
++++ b/drivers/nfc/st-nci/st-nci_se.c |
2898 |
+@@ -189,14 +189,14 @@ int st_nci_hci_load_session(struct nci_dev *ndev) |
2899 |
+ ST_NCI_DEVICE_MGNT_GATE, |
2900 |
+ ST_NCI_DEVICE_MGNT_PIPE); |
2901 |
+ if (r < 0) |
2902 |
+- goto free_info; |
2903 |
++ return r; |
2904 |
+ |
2905 |
+ /* Get pipe list */ |
2906 |
+ r = nci_hci_send_cmd(ndev, ST_NCI_DEVICE_MGNT_GATE, |
2907 |
+ ST_NCI_DM_GETINFO, pipe_list, sizeof(pipe_list), |
2908 |
+ &skb_pipe_list); |
2909 |
+ if (r < 0) |
2910 |
+- goto free_info; |
2911 |
++ return r; |
2912 |
+ |
2913 |
+ /* Complete the existing gate_pipe table */ |
2914 |
+ for (i = 0; i < skb_pipe_list->len; i++) { |
2915 |
+@@ -222,6 +222,7 @@ int st_nci_hci_load_session(struct nci_dev *ndev) |
2916 |
+ dm_pipe_info->src_host_id != ST_NCI_ESE_HOST_ID) { |
2917 |
+ pr_err("Unexpected apdu_reader pipe on host %x\n", |
2918 |
+ dm_pipe_info->src_host_id); |
2919 |
++ kfree_skb(skb_pipe_info); |
2920 |
+ continue; |
2921 |
+ } |
2922 |
+ |
2923 |
+@@ -241,13 +242,12 @@ int st_nci_hci_load_session(struct nci_dev *ndev) |
2924 |
+ ndev->hci_dev->pipes[st_nci_gates[j].pipe].host = |
2925 |
+ dm_pipe_info->src_host_id; |
2926 |
+ } |
2927 |
++ kfree_skb(skb_pipe_info); |
2928 |
+ } |
2929 |
+ |
2930 |
+ memcpy(ndev->hci_dev->init_data.gates, st_nci_gates, |
2931 |
+ sizeof(st_nci_gates)); |
2932 |
+ |
2933 |
+-free_info: |
2934 |
+- kfree_skb(skb_pipe_info); |
2935 |
+ kfree_skb(skb_pipe_list); |
2936 |
+ return r; |
2937 |
+ } |
2938 |
+diff --git a/drivers/nfc/st21nfca/st21nfca.c b/drivers/nfc/st21nfca/st21nfca.c |
2939 |
+index d251f7229c4e..051286562fab 100644 |
2940 |
+--- a/drivers/nfc/st21nfca/st21nfca.c |
2941 |
++++ b/drivers/nfc/st21nfca/st21nfca.c |
2942 |
+@@ -148,14 +148,14 @@ static int st21nfca_hci_load_session(struct nfc_hci_dev *hdev) |
2943 |
+ ST21NFCA_DEVICE_MGNT_GATE, |
2944 |
+ ST21NFCA_DEVICE_MGNT_PIPE); |
2945 |
+ if (r < 0) |
2946 |
+- goto free_info; |
2947 |
++ return r; |
2948 |
+ |
2949 |
+ /* Get pipe list */ |
2950 |
+ r = nfc_hci_send_cmd(hdev, ST21NFCA_DEVICE_MGNT_GATE, |
2951 |
+ ST21NFCA_DM_GETINFO, pipe_list, sizeof(pipe_list), |
2952 |
+ &skb_pipe_list); |
2953 |
+ if (r < 0) |
2954 |
+- goto free_info; |
2955 |
++ return r; |
2956 |
+ |
2957 |
+ /* Complete the existing gate_pipe table */ |
2958 |
+ for (i = 0; i < skb_pipe_list->len; i++) { |
2959 |
+@@ -181,6 +181,7 @@ static int st21nfca_hci_load_session(struct nfc_hci_dev *hdev) |
2960 |
+ info->src_host_id != ST21NFCA_ESE_HOST_ID) { |
2961 |
+ pr_err("Unexpected apdu_reader pipe on host %x\n", |
2962 |
+ info->src_host_id); |
2963 |
++ kfree_skb(skb_pipe_info); |
2964 |
+ continue; |
2965 |
+ } |
2966 |
+ |
2967 |
+@@ -200,6 +201,7 @@ static int st21nfca_hci_load_session(struct nfc_hci_dev *hdev) |
2968 |
+ hdev->pipes[st21nfca_gates[j].pipe].dest_host = |
2969 |
+ info->src_host_id; |
2970 |
+ } |
2971 |
++ kfree_skb(skb_pipe_info); |
2972 |
+ } |
2973 |
+ |
2974 |
+ /* |
2975 |
+@@ -214,13 +216,12 @@ static int st21nfca_hci_load_session(struct nfc_hci_dev *hdev) |
2976 |
+ st21nfca_gates[i].gate, |
2977 |
+ st21nfca_gates[i].pipe); |
2978 |
+ if (r < 0) |
2979 |
+- goto free_info; |
2980 |
++ goto free_list; |
2981 |
+ } |
2982 |
+ } |
2983 |
+ |
2984 |
+ memcpy(hdev->init_data.gates, st21nfca_gates, sizeof(st21nfca_gates)); |
2985 |
+-free_info: |
2986 |
+- kfree_skb(skb_pipe_info); |
2987 |
++free_list: |
2988 |
+ kfree_skb(skb_pipe_list); |
2989 |
+ return r; |
2990 |
+ } |
2991 |
+diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c |
2992 |
+index 07496560e5b9..6e82bc42373b 100644 |
2993 |
+--- a/drivers/of/fdt.c |
2994 |
++++ b/drivers/of/fdt.c |
2995 |
+@@ -967,7 +967,9 @@ int __init early_init_dt_scan_chosen(unsigned long node, const char *uname, |
2996 |
+ } |
2997 |
+ |
2998 |
+ #ifdef CONFIG_HAVE_MEMBLOCK |
2999 |
+-#define MAX_PHYS_ADDR ((phys_addr_t)~0) |
3000 |
++#ifndef MAX_MEMBLOCK_ADDR |
3001 |
++#define MAX_MEMBLOCK_ADDR ((phys_addr_t)~0) |
3002 |
++#endif |
3003 |
+ |
3004 |
+ void __init __weak early_init_dt_add_memory_arch(u64 base, u64 size) |
3005 |
+ { |
3006 |
+@@ -984,16 +986,16 @@ void __init __weak early_init_dt_add_memory_arch(u64 base, u64 size) |
3007 |
+ } |
3008 |
+ size &= PAGE_MASK; |
3009 |
+ |
3010 |
+- if (base > MAX_PHYS_ADDR) { |
3011 |
++ if (base > MAX_MEMBLOCK_ADDR) { |
3012 |
+ pr_warning("Ignoring memory block 0x%llx - 0x%llx\n", |
3013 |
+ base, base + size); |
3014 |
+ return; |
3015 |
+ } |
3016 |
+ |
3017 |
+- if (base + size - 1 > MAX_PHYS_ADDR) { |
3018 |
++ if (base + size - 1 > MAX_MEMBLOCK_ADDR) { |
3019 |
+ pr_warning("Ignoring memory range 0x%llx - 0x%llx\n", |
3020 |
+- ((u64)MAX_PHYS_ADDR) + 1, base + size); |
3021 |
+- size = MAX_PHYS_ADDR - base + 1; |
3022 |
++ ((u64)MAX_MEMBLOCK_ADDR) + 1, base + size); |
3023 |
++ size = MAX_MEMBLOCK_ADDR - base + 1; |
3024 |
+ } |
3025 |
+ |
3026 |
+ if (base + size < phys_offset) { |
3027 |
+diff --git a/drivers/parisc/lba_pci.c b/drivers/parisc/lba_pci.c |
3028 |
+index dceb9ddfd99a..a32c1f6c252c 100644 |
3029 |
+--- a/drivers/parisc/lba_pci.c |
3030 |
++++ b/drivers/parisc/lba_pci.c |
3031 |
+@@ -1556,8 +1556,11 @@ lba_driver_probe(struct parisc_device *dev) |
3032 |
+ if (lba_dev->hba.lmmio_space.flags) |
3033 |
+ pci_add_resource_offset(&resources, &lba_dev->hba.lmmio_space, |
3034 |
+ lba_dev->hba.lmmio_space_offset); |
3035 |
+- if (lba_dev->hba.gmmio_space.flags) |
3036 |
+- pci_add_resource(&resources, &lba_dev->hba.gmmio_space); |
3037 |
++ if (lba_dev->hba.gmmio_space.flags) { |
3038 |
++ /* pci_add_resource(&resources, &lba_dev->hba.gmmio_space); */ |
3039 |
++ pr_warn("LBA: Not registering GMMIO space %pR\n", |
3040 |
++ &lba_dev->hba.gmmio_space); |
3041 |
++ } |
3042 |
+ |
3043 |
+ pci_add_resource(&resources, &lba_dev->hba.bus_num); |
3044 |
+ |
3045 |
+diff --git a/drivers/pci/Kconfig b/drivers/pci/Kconfig |
3046 |
+index 944f50015ed0..73de4efcbe6e 100644 |
3047 |
+--- a/drivers/pci/Kconfig |
3048 |
++++ b/drivers/pci/Kconfig |
3049 |
+@@ -2,7 +2,7 @@ |
3050 |
+ # PCI configuration |
3051 |
+ # |
3052 |
+ config PCI_BUS_ADDR_T_64BIT |
3053 |
+- def_bool y if (ARCH_DMA_ADDR_T_64BIT || (64BIT && !PARISC)) |
3054 |
++ def_bool y if (ARCH_DMA_ADDR_T_64BIT || 64BIT) |
3055 |
+ depends on PCI |
3056 |
+ |
3057 |
+ config PCI_MSI |
3058 |
+diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c |
3059 |
+index ad1ea1695b4a..4a52072d1d3f 100644 |
3060 |
+--- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c |
3061 |
++++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c |
3062 |
+@@ -1202,12 +1202,6 @@ static int mtk_pctrl_build_state(struct platform_device *pdev) |
3063 |
+ return 0; |
3064 |
+ } |
3065 |
+ |
3066 |
+-static struct pinctrl_desc mtk_pctrl_desc = { |
3067 |
+- .confops = &mtk_pconf_ops, |
3068 |
+- .pctlops = &mtk_pctrl_ops, |
3069 |
+- .pmxops = &mtk_pmx_ops, |
3070 |
+-}; |
3071 |
+- |
3072 |
+ int mtk_pctrl_init(struct platform_device *pdev, |
3073 |
+ const struct mtk_pinctrl_devdata *data, |
3074 |
+ struct regmap *regmap) |
3075 |
+@@ -1265,12 +1259,17 @@ int mtk_pctrl_init(struct platform_device *pdev, |
3076 |
+ |
3077 |
+ for (i = 0; i < pctl->devdata->npins; i++) |
3078 |
+ pins[i] = pctl->devdata->pins[i].pin; |
3079 |
+- mtk_pctrl_desc.name = dev_name(&pdev->dev); |
3080 |
+- mtk_pctrl_desc.owner = THIS_MODULE; |
3081 |
+- mtk_pctrl_desc.pins = pins; |
3082 |
+- mtk_pctrl_desc.npins = pctl->devdata->npins; |
3083 |
++ |
3084 |
++ pctl->pctl_desc.name = dev_name(&pdev->dev); |
3085 |
++ pctl->pctl_desc.owner = THIS_MODULE; |
3086 |
++ pctl->pctl_desc.pins = pins; |
3087 |
++ pctl->pctl_desc.npins = pctl->devdata->npins; |
3088 |
++ pctl->pctl_desc.confops = &mtk_pconf_ops; |
3089 |
++ pctl->pctl_desc.pctlops = &mtk_pctrl_ops; |
3090 |
++ pctl->pctl_desc.pmxops = &mtk_pmx_ops; |
3091 |
+ pctl->dev = &pdev->dev; |
3092 |
+- pctl->pctl_dev = pinctrl_register(&mtk_pctrl_desc, &pdev->dev, pctl); |
3093 |
++ |
3094 |
++ pctl->pctl_dev = pinctrl_register(&pctl->pctl_desc, &pdev->dev, pctl); |
3095 |
+ if (IS_ERR(pctl->pctl_dev)) { |
3096 |
+ dev_err(&pdev->dev, "couldn't register pinctrl driver\n"); |
3097 |
+ return PTR_ERR(pctl->pctl_dev); |
3098 |
+diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.h b/drivers/pinctrl/mediatek/pinctrl-mtk-common.h |
3099 |
+index 30213e514c2f..c532c23c70b4 100644 |
3100 |
+--- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.h |
3101 |
++++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.h |
3102 |
+@@ -256,6 +256,7 @@ struct mtk_pinctrl_devdata { |
3103 |
+ struct mtk_pinctrl { |
3104 |
+ struct regmap *regmap1; |
3105 |
+ struct regmap *regmap2; |
3106 |
++ struct pinctrl_desc pctl_desc; |
3107 |
+ struct device *dev; |
3108 |
+ struct gpio_chip *chip; |
3109 |
+ struct mtk_pinctrl_group *groups; |
3110 |
+diff --git a/drivers/pinctrl/pinctrl-at91.c b/drivers/pinctrl/pinctrl-at91.c |
3111 |
+index a0824477072b..2deb1309fcac 100644 |
3112 |
+--- a/drivers/pinctrl/pinctrl-at91.c |
3113 |
++++ b/drivers/pinctrl/pinctrl-at91.c |
3114 |
+@@ -320,6 +320,9 @@ static const struct pinctrl_ops at91_pctrl_ops = { |
3115 |
+ static void __iomem *pin_to_controller(struct at91_pinctrl *info, |
3116 |
+ unsigned int bank) |
3117 |
+ { |
3118 |
++ if (!gpio_chips[bank]) |
3119 |
++ return NULL; |
3120 |
++ |
3121 |
+ return gpio_chips[bank]->regbase; |
3122 |
+ } |
3123 |
+ |
3124 |
+@@ -729,6 +732,10 @@ static int at91_pmx_set(struct pinctrl_dev *pctldev, unsigned selector, |
3125 |
+ pin = &pins_conf[i]; |
3126 |
+ at91_pin_dbg(info->dev, pin); |
3127 |
+ pio = pin_to_controller(info, pin->bank); |
3128 |
++ |
3129 |
++ if (!pio) |
3130 |
++ continue; |
3131 |
++ |
3132 |
+ mask = pin_to_mask(pin->pin); |
3133 |
+ at91_mux_disable_interrupt(pio, mask); |
3134 |
+ switch (pin->mux) { |
3135 |
+@@ -848,6 +855,10 @@ static int at91_pinconf_get(struct pinctrl_dev *pctldev, |
3136 |
+ *config = 0; |
3137 |
+ dev_dbg(info->dev, "%s:%d, pin_id=%d", __func__, __LINE__, pin_id); |
3138 |
+ pio = pin_to_controller(info, pin_to_bank(pin_id)); |
3139 |
++ |
3140 |
++ if (!pio) |
3141 |
++ return -EINVAL; |
3142 |
++ |
3143 |
+ pin = pin_id % MAX_NB_GPIO_PER_BANK; |
3144 |
+ |
3145 |
+ if (at91_mux_get_multidrive(pio, pin)) |
3146 |
+@@ -889,6 +900,10 @@ static int at91_pinconf_set(struct pinctrl_dev *pctldev, |
3147 |
+ "%s:%d, pin_id=%d, config=0x%lx", |
3148 |
+ __func__, __LINE__, pin_id, config); |
3149 |
+ pio = pin_to_controller(info, pin_to_bank(pin_id)); |
3150 |
++ |
3151 |
++ if (!pio) |
3152 |
++ return -EINVAL; |
3153 |
++ |
3154 |
+ pin = pin_id % MAX_NB_GPIO_PER_BANK; |
3155 |
+ mask = pin_to_mask(pin); |
3156 |
+ |
3157 |
+diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c |
3158 |
+index 76b57388d01b..81c3e582309a 100644 |
3159 |
+--- a/drivers/platform/x86/ideapad-laptop.c |
3160 |
++++ b/drivers/platform/x86/ideapad-laptop.c |
3161 |
+@@ -853,6 +853,13 @@ static const struct dmi_system_id no_hw_rfkill_list[] = { |
3162 |
+ }, |
3163 |
+ }, |
3164 |
+ { |
3165 |
++ .ident = "Lenovo Yoga 3 14", |
3166 |
++ .matches = { |
3167 |
++ DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), |
3168 |
++ DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo Yoga 3 14"), |
3169 |
++ }, |
3170 |
++ }, |
3171 |
++ { |
3172 |
+ .ident = "Lenovo Yoga 3 Pro 1370", |
3173 |
+ .matches = { |
3174 |
+ DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), |
3175 |
+diff --git a/drivers/rtc/rtc-abx80x.c b/drivers/rtc/rtc-abx80x.c |
3176 |
+index 4337c3bc6ace..afea84c7a155 100644 |
3177 |
+--- a/drivers/rtc/rtc-abx80x.c |
3178 |
++++ b/drivers/rtc/rtc-abx80x.c |
3179 |
+@@ -28,7 +28,7 @@ |
3180 |
+ #define ABX8XX_REG_WD 0x07 |
3181 |
+ |
3182 |
+ #define ABX8XX_REG_CTRL1 0x10 |
3183 |
+-#define ABX8XX_CTRL_WRITE BIT(1) |
3184 |
++#define ABX8XX_CTRL_WRITE BIT(0) |
3185 |
+ #define ABX8XX_CTRL_12_24 BIT(6) |
3186 |
+ |
3187 |
+ #define ABX8XX_REG_CFG_KEY 0x1f |
3188 |
+diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c |
3189 |
+index a0f832362199..2e709e239dbc 100644 |
3190 |
+--- a/drivers/rtc/rtc-s3c.c |
3191 |
++++ b/drivers/rtc/rtc-s3c.c |
3192 |
+@@ -39,6 +39,7 @@ struct s3c_rtc { |
3193 |
+ void __iomem *base; |
3194 |
+ struct clk *rtc_clk; |
3195 |
+ struct clk *rtc_src_clk; |
3196 |
++ bool clk_disabled; |
3197 |
+ |
3198 |
+ struct s3c_rtc_data *data; |
3199 |
+ |
3200 |
+@@ -71,9 +72,12 @@ static void s3c_rtc_enable_clk(struct s3c_rtc *info) |
3201 |
+ unsigned long irq_flags; |
3202 |
+ |
3203 |
+ spin_lock_irqsave(&info->alarm_clk_lock, irq_flags); |
3204 |
+- clk_enable(info->rtc_clk); |
3205 |
+- if (info->data->needs_src_clk) |
3206 |
+- clk_enable(info->rtc_src_clk); |
3207 |
++ if (info->clk_disabled) { |
3208 |
++ clk_enable(info->rtc_clk); |
3209 |
++ if (info->data->needs_src_clk) |
3210 |
++ clk_enable(info->rtc_src_clk); |
3211 |
++ info->clk_disabled = false; |
3212 |
++ } |
3213 |
+ spin_unlock_irqrestore(&info->alarm_clk_lock, irq_flags); |
3214 |
+ } |
3215 |
+ |
3216 |
+@@ -82,9 +86,12 @@ static void s3c_rtc_disable_clk(struct s3c_rtc *info) |
3217 |
+ unsigned long irq_flags; |
3218 |
+ |
3219 |
+ spin_lock_irqsave(&info->alarm_clk_lock, irq_flags); |
3220 |
+- if (info->data->needs_src_clk) |
3221 |
+- clk_disable(info->rtc_src_clk); |
3222 |
+- clk_disable(info->rtc_clk); |
3223 |
++ if (!info->clk_disabled) { |
3224 |
++ if (info->data->needs_src_clk) |
3225 |
++ clk_disable(info->rtc_src_clk); |
3226 |
++ clk_disable(info->rtc_clk); |
3227 |
++ info->clk_disabled = true; |
3228 |
++ } |
3229 |
+ spin_unlock_irqrestore(&info->alarm_clk_lock, irq_flags); |
3230 |
+ } |
3231 |
+ |
3232 |
+@@ -128,6 +135,11 @@ static int s3c_rtc_setaie(struct device *dev, unsigned int enabled) |
3233 |
+ |
3234 |
+ s3c_rtc_disable_clk(info); |
3235 |
+ |
3236 |
++ if (enabled) |
3237 |
++ s3c_rtc_enable_clk(info); |
3238 |
++ else |
3239 |
++ s3c_rtc_disable_clk(info); |
3240 |
++ |
3241 |
+ return 0; |
3242 |
+ } |
3243 |
+ |
3244 |
+diff --git a/drivers/rtc/rtc-s5m.c b/drivers/rtc/rtc-s5m.c |
3245 |
+index 8c70d785ba73..ab60287ee72d 100644 |
3246 |
+--- a/drivers/rtc/rtc-s5m.c |
3247 |
++++ b/drivers/rtc/rtc-s5m.c |
3248 |
+@@ -635,6 +635,16 @@ static int s5m8767_rtc_init_reg(struct s5m_rtc_info *info) |
3249 |
+ case S2MPS13X: |
3250 |
+ data[0] = (0 << BCD_EN_SHIFT) | (1 << MODEL24_SHIFT); |
3251 |
+ ret = regmap_write(info->regmap, info->regs->ctrl, data[0]); |
3252 |
++ if (ret < 0) |
3253 |
++ break; |
3254 |
++ |
3255 |
++ /* |
3256 |
++ * Should set WUDR & (RUDR or AUDR) bits to high after writing |
3257 |
++ * RTC_CTRL register like writing Alarm registers. We can't find |
3258 |
++ * the description from datasheet but vendor code does that |
3259 |
++ * really. |
3260 |
++ */ |
3261 |
++ ret = s5m8767_rtc_set_alarm_reg(info); |
3262 |
+ break; |
3263 |
+ |
3264 |
+ default: |
3265 |
+diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c |
3266 |
+index f5021fcb154e..089e7f8543a5 100644 |
3267 |
+--- a/fs/btrfs/transaction.c |
3268 |
++++ b/fs/btrfs/transaction.c |
3269 |
+@@ -1893,8 +1893,11 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans, |
3270 |
+ spin_unlock(&root->fs_info->trans_lock); |
3271 |
+ |
3272 |
+ wait_for_commit(root, prev_trans); |
3273 |
++ ret = prev_trans->aborted; |
3274 |
+ |
3275 |
+ btrfs_put_transaction(prev_trans); |
3276 |
++ if (ret) |
3277 |
++ goto cleanup_transaction; |
3278 |
+ } else { |
3279 |
+ spin_unlock(&root->fs_info->trans_lock); |
3280 |
+ } |
3281 |
+diff --git a/fs/cifs/ioctl.c b/fs/cifs/ioctl.c |
3282 |
+index 49b8b6e41a18..c7b84f3bf6ad 100644 |
3283 |
+--- a/fs/cifs/ioctl.c |
3284 |
++++ b/fs/cifs/ioctl.c |
3285 |
+@@ -70,6 +70,12 @@ static long cifs_ioctl_clone(unsigned int xid, struct file *dst_file, |
3286 |
+ goto out_drop_write; |
3287 |
+ } |
3288 |
+ |
3289 |
++ if (src_file.file->f_op->unlocked_ioctl != cifs_ioctl) { |
3290 |
++ rc = -EBADF; |
3291 |
++ cifs_dbg(VFS, "src file seems to be from a different filesystem type\n"); |
3292 |
++ goto out_fput; |
3293 |
++ } |
3294 |
++ |
3295 |
+ if ((!src_file.file->private_data) || (!dst_file->private_data)) { |
3296 |
+ rc = -EBADF; |
3297 |
+ cifs_dbg(VFS, "missing cifsFileInfo on copy range src file\n"); |
3298 |
+diff --git a/fs/coredump.c b/fs/coredump.c |
3299 |
+index c5ecde6f3eed..a8f75640ac86 100644 |
3300 |
+--- a/fs/coredump.c |
3301 |
++++ b/fs/coredump.c |
3302 |
+@@ -513,10 +513,10 @@ void do_coredump(const siginfo_t *siginfo) |
3303 |
+ const struct cred *old_cred; |
3304 |
+ struct cred *cred; |
3305 |
+ int retval = 0; |
3306 |
+- int flag = 0; |
3307 |
+ int ispipe; |
3308 |
+ struct files_struct *displaced; |
3309 |
+- bool need_nonrelative = false; |
3310 |
++ /* require nonrelative corefile path and be extra careful */ |
3311 |
++ bool need_suid_safe = false; |
3312 |
+ bool core_dumped = false; |
3313 |
+ static atomic_t core_dump_count = ATOMIC_INIT(0); |
3314 |
+ struct coredump_params cprm = { |
3315 |
+@@ -550,9 +550,8 @@ void do_coredump(const siginfo_t *siginfo) |
3316 |
+ */ |
3317 |
+ if (__get_dumpable(cprm.mm_flags) == SUID_DUMP_ROOT) { |
3318 |
+ /* Setuid core dump mode */ |
3319 |
+- flag = O_EXCL; /* Stop rewrite attacks */ |
3320 |
+ cred->fsuid = GLOBAL_ROOT_UID; /* Dump root private */ |
3321 |
+- need_nonrelative = true; |
3322 |
++ need_suid_safe = true; |
3323 |
+ } |
3324 |
+ |
3325 |
+ retval = coredump_wait(siginfo->si_signo, &core_state); |
3326 |
+@@ -633,7 +632,7 @@ void do_coredump(const siginfo_t *siginfo) |
3327 |
+ if (cprm.limit < binfmt->min_coredump) |
3328 |
+ goto fail_unlock; |
3329 |
+ |
3330 |
+- if (need_nonrelative && cn.corename[0] != '/') { |
3331 |
++ if (need_suid_safe && cn.corename[0] != '/') { |
3332 |
+ printk(KERN_WARNING "Pid %d(%s) can only dump core "\ |
3333 |
+ "to fully qualified path!\n", |
3334 |
+ task_tgid_vnr(current), current->comm); |
3335 |
+@@ -641,8 +640,35 @@ void do_coredump(const siginfo_t *siginfo) |
3336 |
+ goto fail_unlock; |
3337 |
+ } |
3338 |
+ |
3339 |
++ /* |
3340 |
++ * Unlink the file if it exists unless this is a SUID |
3341 |
++ * binary - in that case, we're running around with root |
3342 |
++ * privs and don't want to unlink another user's coredump. |
3343 |
++ */ |
3344 |
++ if (!need_suid_safe) { |
3345 |
++ mm_segment_t old_fs; |
3346 |
++ |
3347 |
++ old_fs = get_fs(); |
3348 |
++ set_fs(KERNEL_DS); |
3349 |
++ /* |
3350 |
++ * If it doesn't exist, that's fine. If there's some |
3351 |
++ * other problem, we'll catch it at the filp_open(). |
3352 |
++ */ |
3353 |
++ (void) sys_unlink((const char __user *)cn.corename); |
3354 |
++ set_fs(old_fs); |
3355 |
++ } |
3356 |
++ |
3357 |
++ /* |
3358 |
++ * There is a race between unlinking and creating the |
3359 |
++ * file, but if that causes an EEXIST here, that's |
3360 |
++ * fine - another process raced with us while creating |
3361 |
++ * the corefile, and the other process won. To userspace, |
3362 |
++ * what matters is that at least one of the two processes |
3363 |
++ * writes its coredump successfully, not which one. |
3364 |
++ */ |
3365 |
+ cprm.file = filp_open(cn.corename, |
3366 |
+- O_CREAT | 2 | O_NOFOLLOW | O_LARGEFILE | flag, |
3367 |
++ O_CREAT | 2 | O_NOFOLLOW | |
3368 |
++ O_LARGEFILE | O_EXCL, |
3369 |
+ 0600); |
3370 |
+ if (IS_ERR(cprm.file)) |
3371 |
+ goto fail_unlock; |
3372 |
+@@ -659,11 +685,15 @@ void do_coredump(const siginfo_t *siginfo) |
3373 |
+ if (!S_ISREG(inode->i_mode)) |
3374 |
+ goto close_fail; |
3375 |
+ /* |
3376 |
+- * Dont allow local users get cute and trick others to coredump |
3377 |
+- * into their pre-created files. |
3378 |
++ * Don't dump core if the filesystem changed owner or mode |
3379 |
++ * of the file during file creation. This is an issue when |
3380 |
++ * a process dumps core while its cwd is e.g. on a vfat |
3381 |
++ * filesystem. |
3382 |
+ */ |
3383 |
+ if (!uid_eq(inode->i_uid, current_fsuid())) |
3384 |
+ goto close_fail; |
3385 |
++ if ((inode->i_mode & 0677) != 0600) |
3386 |
++ goto close_fail; |
3387 |
+ if (!(cprm.file->f_mode & FMODE_CAN_WRITE)) |
3388 |
+ goto close_fail; |
3389 |
+ if (do_truncate(cprm.file->f_path.dentry, 0, 0, cprm.file)) |
3390 |
+diff --git a/fs/ecryptfs/dentry.c b/fs/ecryptfs/dentry.c |
3391 |
+index 8db0b464483f..63cd2c147221 100644 |
3392 |
+--- a/fs/ecryptfs/dentry.c |
3393 |
++++ b/fs/ecryptfs/dentry.c |
3394 |
+@@ -45,20 +45,20 @@ |
3395 |
+ static int ecryptfs_d_revalidate(struct dentry *dentry, unsigned int flags) |
3396 |
+ { |
3397 |
+ struct dentry *lower_dentry = ecryptfs_dentry_to_lower(dentry); |
3398 |
+- int rc; |
3399 |
+- |
3400 |
+- if (!(lower_dentry->d_flags & DCACHE_OP_REVALIDATE)) |
3401 |
+- return 1; |
3402 |
++ int rc = 1; |
3403 |
+ |
3404 |
+ if (flags & LOOKUP_RCU) |
3405 |
+ return -ECHILD; |
3406 |
+ |
3407 |
+- rc = lower_dentry->d_op->d_revalidate(lower_dentry, flags); |
3408 |
++ if (lower_dentry->d_flags & DCACHE_OP_REVALIDATE) |
3409 |
++ rc = lower_dentry->d_op->d_revalidate(lower_dentry, flags); |
3410 |
++ |
3411 |
+ if (d_really_is_positive(dentry)) { |
3412 |
+- struct inode *lower_inode = |
3413 |
+- ecryptfs_inode_to_lower(d_inode(dentry)); |
3414 |
++ struct inode *inode = d_inode(dentry); |
3415 |
+ |
3416 |
+- fsstack_copy_attr_all(d_inode(dentry), lower_inode); |
3417 |
++ fsstack_copy_attr_all(inode, ecryptfs_inode_to_lower(inode)); |
3418 |
++ if (!inode->i_nlink) |
3419 |
++ return 0; |
3420 |
+ } |
3421 |
+ return rc; |
3422 |
+ } |
3423 |
+diff --git a/fs/ext4/super.c b/fs/ext4/super.c |
3424 |
+index 9981064c4a54..a5e8c744e962 100644 |
3425 |
+--- a/fs/ext4/super.c |
3426 |
++++ b/fs/ext4/super.c |
3427 |
+@@ -325,6 +325,22 @@ static void save_error_info(struct super_block *sb, const char *func, |
3428 |
+ ext4_commit_super(sb, 1); |
3429 |
+ } |
3430 |
+ |
3431 |
++/* |
3432 |
++ * The del_gendisk() function uninitializes the disk-specific data |
3433 |
++ * structures, including the bdi structure, without telling anyone |
3434 |
++ * else. Once this happens, any attempt to call mark_buffer_dirty() |
3435 |
++ * (for example, by ext4_commit_super), will cause a kernel OOPS. |
3436 |
++ * This is a kludge to prevent these oops until we can put in a proper |
3437 |
++ * hook in del_gendisk() to inform the VFS and file system layers. |
3438 |
++ */ |
3439 |
++static int block_device_ejected(struct super_block *sb) |
3440 |
++{ |
3441 |
++ struct inode *bd_inode = sb->s_bdev->bd_inode; |
3442 |
++ struct backing_dev_info *bdi = inode_to_bdi(bd_inode); |
3443 |
++ |
3444 |
++ return bdi->dev == NULL; |
3445 |
++} |
3446 |
++ |
3447 |
+ static void ext4_journal_commit_callback(journal_t *journal, transaction_t *txn) |
3448 |
+ { |
3449 |
+ struct super_block *sb = journal->j_private; |
3450 |
+@@ -4617,7 +4633,7 @@ static int ext4_commit_super(struct super_block *sb, int sync) |
3451 |
+ struct buffer_head *sbh = EXT4_SB(sb)->s_sbh; |
3452 |
+ int error = 0; |
3453 |
+ |
3454 |
+- if (!sbh) |
3455 |
++ if (!sbh || block_device_ejected(sb)) |
3456 |
+ return error; |
3457 |
+ if (buffer_write_io_error(sbh)) { |
3458 |
+ /* |
3459 |
+@@ -4833,10 +4849,11 @@ static int ext4_freeze(struct super_block *sb) |
3460 |
+ error = jbd2_journal_flush(journal); |
3461 |
+ if (error < 0) |
3462 |
+ goto out; |
3463 |
++ |
3464 |
++ /* Journal blocked and flushed, clear needs_recovery flag. */ |
3465 |
++ EXT4_CLEAR_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_RECOVER); |
3466 |
+ } |
3467 |
+ |
3468 |
+- /* Journal blocked and flushed, clear needs_recovery flag. */ |
3469 |
+- EXT4_CLEAR_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_RECOVER); |
3470 |
+ error = ext4_commit_super(sb, 1); |
3471 |
+ out: |
3472 |
+ if (journal) |
3473 |
+@@ -4854,8 +4871,11 @@ static int ext4_unfreeze(struct super_block *sb) |
3474 |
+ if (sb->s_flags & MS_RDONLY) |
3475 |
+ return 0; |
3476 |
+ |
3477 |
+- /* Reset the needs_recovery flag before the fs is unlocked. */ |
3478 |
+- EXT4_SET_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_RECOVER); |
3479 |
++ if (EXT4_SB(sb)->s_journal) { |
3480 |
++ /* Reset the needs_recovery flag before the fs is unlocked. */ |
3481 |
++ EXT4_SET_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_RECOVER); |
3482 |
++ } |
3483 |
++ |
3484 |
+ ext4_commit_super(sb, 1); |
3485 |
+ return 0; |
3486 |
+ } |
3487 |
+diff --git a/fs/hfs/bnode.c b/fs/hfs/bnode.c |
3488 |
+index d3fa6bd9503e..221719eac5de 100644 |
3489 |
+--- a/fs/hfs/bnode.c |
3490 |
++++ b/fs/hfs/bnode.c |
3491 |
+@@ -288,7 +288,6 @@ static struct hfs_bnode *__hfs_bnode_create(struct hfs_btree *tree, u32 cnid) |
3492 |
+ page_cache_release(page); |
3493 |
+ goto fail; |
3494 |
+ } |
3495 |
+- page_cache_release(page); |
3496 |
+ node->page[i] = page; |
3497 |
+ } |
3498 |
+ |
3499 |
+@@ -398,11 +397,11 @@ node_error: |
3500 |
+ |
3501 |
+ void hfs_bnode_free(struct hfs_bnode *node) |
3502 |
+ { |
3503 |
+- //int i; |
3504 |
++ int i; |
3505 |
+ |
3506 |
+- //for (i = 0; i < node->tree->pages_per_bnode; i++) |
3507 |
+- // if (node->page[i]) |
3508 |
+- // page_cache_release(node->page[i]); |
3509 |
++ for (i = 0; i < node->tree->pages_per_bnode; i++) |
3510 |
++ if (node->page[i]) |
3511 |
++ page_cache_release(node->page[i]); |
3512 |
+ kfree(node); |
3513 |
+ } |
3514 |
+ |
3515 |
+diff --git a/fs/hfs/brec.c b/fs/hfs/brec.c |
3516 |
+index 9f4ee7f52026..6fc766df0461 100644 |
3517 |
+--- a/fs/hfs/brec.c |
3518 |
++++ b/fs/hfs/brec.c |
3519 |
+@@ -131,13 +131,16 @@ skip: |
3520 |
+ hfs_bnode_write(node, entry, data_off + key_len, entry_len); |
3521 |
+ hfs_bnode_dump(node); |
3522 |
+ |
3523 |
+- if (new_node) { |
3524 |
+- /* update parent key if we inserted a key |
3525 |
+- * at the start of the first node |
3526 |
+- */ |
3527 |
+- if (!rec && new_node != node) |
3528 |
+- hfs_brec_update_parent(fd); |
3529 |
++ /* |
3530 |
++ * update parent key if we inserted a key |
3531 |
++ * at the start of the node and it is not the new node |
3532 |
++ */ |
3533 |
++ if (!rec && new_node != node) { |
3534 |
++ hfs_bnode_read_key(node, fd->search_key, data_off + size); |
3535 |
++ hfs_brec_update_parent(fd); |
3536 |
++ } |
3537 |
+ |
3538 |
++ if (new_node) { |
3539 |
+ hfs_bnode_put(fd->bnode); |
3540 |
+ if (!new_node->parent) { |
3541 |
+ hfs_btree_inc_height(tree); |
3542 |
+@@ -166,9 +169,6 @@ skip: |
3543 |
+ goto again; |
3544 |
+ } |
3545 |
+ |
3546 |
+- if (!rec) |
3547 |
+- hfs_brec_update_parent(fd); |
3548 |
+- |
3549 |
+ return 0; |
3550 |
+ } |
3551 |
+ |
3552 |
+@@ -366,6 +366,8 @@ again: |
3553 |
+ if (IS_ERR(parent)) |
3554 |
+ return PTR_ERR(parent); |
3555 |
+ __hfs_brec_find(parent, fd); |
3556 |
++ if (fd->record < 0) |
3557 |
++ return -ENOENT; |
3558 |
+ hfs_bnode_dump(parent); |
3559 |
+ rec = fd->record; |
3560 |
+ |
3561 |
+diff --git a/fs/hfsplus/bnode.c b/fs/hfsplus/bnode.c |
3562 |
+index 759708fd9331..63924662aaf3 100644 |
3563 |
+--- a/fs/hfsplus/bnode.c |
3564 |
++++ b/fs/hfsplus/bnode.c |
3565 |
+@@ -454,7 +454,6 @@ static struct hfs_bnode *__hfs_bnode_create(struct hfs_btree *tree, u32 cnid) |
3566 |
+ page_cache_release(page); |
3567 |
+ goto fail; |
3568 |
+ } |
3569 |
+- page_cache_release(page); |
3570 |
+ node->page[i] = page; |
3571 |
+ } |
3572 |
+ |
3573 |
+@@ -566,13 +565,11 @@ node_error: |
3574 |
+ |
3575 |
+ void hfs_bnode_free(struct hfs_bnode *node) |
3576 |
+ { |
3577 |
+-#if 0 |
3578 |
+ int i; |
3579 |
+ |
3580 |
+ for (i = 0; i < node->tree->pages_per_bnode; i++) |
3581 |
+ if (node->page[i]) |
3582 |
+ page_cache_release(node->page[i]); |
3583 |
+-#endif |
3584 |
+ kfree(node); |
3585 |
+ } |
3586 |
+ |
3587 |
+diff --git a/fs/jbd2/checkpoint.c b/fs/jbd2/checkpoint.c |
3588 |
+index 4227dc4f7437..8c44654ce274 100644 |
3589 |
+--- a/fs/jbd2/checkpoint.c |
3590 |
++++ b/fs/jbd2/checkpoint.c |
3591 |
+@@ -417,12 +417,12 @@ int jbd2_cleanup_journal_tail(journal_t *journal) |
3592 |
+ * journal_clean_one_cp_list |
3593 |
+ * |
3594 |
+ * Find all the written-back checkpoint buffers in the given list and |
3595 |
+- * release them. |
3596 |
++ * release them. If 'destroy' is set, clean all buffers unconditionally. |
3597 |
+ * |
3598 |
+ * Called with j_list_lock held. |
3599 |
+ * Returns 1 if we freed the transaction, 0 otherwise. |
3600 |
+ */ |
3601 |
+-static int journal_clean_one_cp_list(struct journal_head *jh) |
3602 |
++static int journal_clean_one_cp_list(struct journal_head *jh, bool destroy) |
3603 |
+ { |
3604 |
+ struct journal_head *last_jh; |
3605 |
+ struct journal_head *next_jh = jh; |
3606 |
+@@ -436,7 +436,10 @@ static int journal_clean_one_cp_list(struct journal_head *jh) |
3607 |
+ do { |
3608 |
+ jh = next_jh; |
3609 |
+ next_jh = jh->b_cpnext; |
3610 |
+- ret = __try_to_free_cp_buf(jh); |
3611 |
++ if (!destroy) |
3612 |
++ ret = __try_to_free_cp_buf(jh); |
3613 |
++ else |
3614 |
++ ret = __jbd2_journal_remove_checkpoint(jh) + 1; |
3615 |
+ if (!ret) |
3616 |
+ return freed; |
3617 |
+ if (ret == 2) |
3618 |
+@@ -459,10 +462,11 @@ static int journal_clean_one_cp_list(struct journal_head *jh) |
3619 |
+ * journal_clean_checkpoint_list |
3620 |
+ * |
3621 |
+ * Find all the written-back checkpoint buffers in the journal and release them. |
3622 |
++ * If 'destroy' is set, release all buffers unconditionally. |
3623 |
+ * |
3624 |
+ * Called with j_list_lock held. |
3625 |
+ */ |
3626 |
+-void __jbd2_journal_clean_checkpoint_list(journal_t *journal) |
3627 |
++void __jbd2_journal_clean_checkpoint_list(journal_t *journal, bool destroy) |
3628 |
+ { |
3629 |
+ transaction_t *transaction, *last_transaction, *next_transaction; |
3630 |
+ int ret; |
3631 |
+@@ -476,7 +480,8 @@ void __jbd2_journal_clean_checkpoint_list(journal_t *journal) |
3632 |
+ do { |
3633 |
+ transaction = next_transaction; |
3634 |
+ next_transaction = transaction->t_cpnext; |
3635 |
+- ret = journal_clean_one_cp_list(transaction->t_checkpoint_list); |
3636 |
++ ret = journal_clean_one_cp_list(transaction->t_checkpoint_list, |
3637 |
++ destroy); |
3638 |
+ /* |
3639 |
+ * This function only frees up some memory if possible so we |
3640 |
+ * dont have an obligation to finish processing. Bail out if |
3641 |
+@@ -492,7 +497,7 @@ void __jbd2_journal_clean_checkpoint_list(journal_t *journal) |
3642 |
+ * we can possibly see not yet submitted buffers on io_list |
3643 |
+ */ |
3644 |
+ ret = journal_clean_one_cp_list(transaction-> |
3645 |
+- t_checkpoint_io_list); |
3646 |
++ t_checkpoint_io_list, destroy); |
3647 |
+ if (need_resched()) |
3648 |
+ return; |
3649 |
+ /* |
3650 |
+@@ -506,6 +511,28 @@ void __jbd2_journal_clean_checkpoint_list(journal_t *journal) |
3651 |
+ } |
3652 |
+ |
3653 |
+ /* |
3654 |
++ * Remove buffers from all checkpoint lists as journal is aborted and we just |
3655 |
++ * need to free memory |
3656 |
++ */ |
3657 |
++void jbd2_journal_destroy_checkpoint(journal_t *journal) |
3658 |
++{ |
3659 |
++ /* |
3660 |
++ * We loop because __jbd2_journal_clean_checkpoint_list() may abort |
3661 |
++ * early due to a need of rescheduling. |
3662 |
++ */ |
3663 |
++ while (1) { |
3664 |
++ spin_lock(&journal->j_list_lock); |
3665 |
++ if (!journal->j_checkpoint_transactions) { |
3666 |
++ spin_unlock(&journal->j_list_lock); |
3667 |
++ break; |
3668 |
++ } |
3669 |
++ __jbd2_journal_clean_checkpoint_list(journal, true); |
3670 |
++ spin_unlock(&journal->j_list_lock); |
3671 |
++ cond_resched(); |
3672 |
++ } |
3673 |
++} |
3674 |
++ |
3675 |
++/* |
3676 |
+ * journal_remove_checkpoint: called after a buffer has been committed |
3677 |
+ * to disk (either by being write-back flushed to disk, or being |
3678 |
+ * committed to the log). |
3679 |
+diff --git a/fs/jbd2/commit.c b/fs/jbd2/commit.c |
3680 |
+index b73e0215baa7..362e5f614450 100644 |
3681 |
+--- a/fs/jbd2/commit.c |
3682 |
++++ b/fs/jbd2/commit.c |
3683 |
+@@ -510,7 +510,7 @@ void jbd2_journal_commit_transaction(journal_t *journal) |
3684 |
+ * frees some memory |
3685 |
+ */ |
3686 |
+ spin_lock(&journal->j_list_lock); |
3687 |
+- __jbd2_journal_clean_checkpoint_list(journal); |
3688 |
++ __jbd2_journal_clean_checkpoint_list(journal, false); |
3689 |
+ spin_unlock(&journal->j_list_lock); |
3690 |
+ |
3691 |
+ jbd_debug(3, "JBD2: commit phase 1\n"); |
3692 |
+diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c |
3693 |
+index 4ff3fad4e9e3..2721513adb1f 100644 |
3694 |
+--- a/fs/jbd2/journal.c |
3695 |
++++ b/fs/jbd2/journal.c |
3696 |
+@@ -1693,8 +1693,17 @@ int jbd2_journal_destroy(journal_t *journal) |
3697 |
+ while (journal->j_checkpoint_transactions != NULL) { |
3698 |
+ spin_unlock(&journal->j_list_lock); |
3699 |
+ mutex_lock(&journal->j_checkpoint_mutex); |
3700 |
+- jbd2_log_do_checkpoint(journal); |
3701 |
++ err = jbd2_log_do_checkpoint(journal); |
3702 |
+ mutex_unlock(&journal->j_checkpoint_mutex); |
3703 |
++ /* |
3704 |
++ * If checkpointing failed, just free the buffers to avoid |
3705 |
++ * looping forever |
3706 |
++ */ |
3707 |
++ if (err) { |
3708 |
++ jbd2_journal_destroy_checkpoint(journal); |
3709 |
++ spin_lock(&journal->j_list_lock); |
3710 |
++ break; |
3711 |
++ } |
3712 |
+ spin_lock(&journal->j_list_lock); |
3713 |
+ } |
3714 |
+ |
3715 |
+diff --git a/fs/nfs/flexfilelayout/flexfilelayout.c b/fs/nfs/flexfilelayout/flexfilelayout.c |
3716 |
+index b3289d701eea..14e3b1e1b17d 100644 |
3717 |
+--- a/fs/nfs/flexfilelayout/flexfilelayout.c |
3718 |
++++ b/fs/nfs/flexfilelayout/flexfilelayout.c |
3719 |
+@@ -1199,6 +1199,11 @@ static int ff_layout_write_done_cb(struct rpc_task *task, |
3720 |
+ hdr->res.verf->committed == NFS_DATA_SYNC) |
3721 |
+ ff_layout_set_layoutcommit(hdr); |
3722 |
+ |
3723 |
++ /* zero out fattr since we don't care DS attr at all */ |
3724 |
++ hdr->fattr.valid = 0; |
3725 |
++ if (task->tk_status >= 0) |
3726 |
++ nfs_writeback_update_inode(hdr); |
3727 |
++ |
3728 |
+ return 0; |
3729 |
+ } |
3730 |
+ |
3731 |
+diff --git a/fs/nfs/flexfilelayout/flexfilelayoutdev.c b/fs/nfs/flexfilelayout/flexfilelayoutdev.c |
3732 |
+index f13e1969eedd..b28fa4cbea52 100644 |
3733 |
+--- a/fs/nfs/flexfilelayout/flexfilelayoutdev.c |
3734 |
++++ b/fs/nfs/flexfilelayout/flexfilelayoutdev.c |
3735 |
+@@ -500,16 +500,19 @@ int ff_layout_encode_ds_ioerr(struct nfs4_flexfile_layout *flo, |
3736 |
+ range->offset, range->length)) |
3737 |
+ continue; |
3738 |
+ /* offset(8) + length(8) + stateid(NFS4_STATEID_SIZE) |
3739 |
+- * + deviceid(NFS4_DEVICEID4_SIZE) + status(4) + opnum(4) |
3740 |
++ * + array length + deviceid(NFS4_DEVICEID4_SIZE) |
3741 |
++ * + status(4) + opnum(4) |
3742 |
+ */ |
3743 |
+ p = xdr_reserve_space(xdr, |
3744 |
+- 24 + NFS4_STATEID_SIZE + NFS4_DEVICEID4_SIZE); |
3745 |
++ 28 + NFS4_STATEID_SIZE + NFS4_DEVICEID4_SIZE); |
3746 |
+ if (unlikely(!p)) |
3747 |
+ return -ENOBUFS; |
3748 |
+ p = xdr_encode_hyper(p, err->offset); |
3749 |
+ p = xdr_encode_hyper(p, err->length); |
3750 |
+ p = xdr_encode_opaque_fixed(p, &err->stateid, |
3751 |
+ NFS4_STATEID_SIZE); |
3752 |
++ /* Encode 1 error */ |
3753 |
++ *p++ = cpu_to_be32(1); |
3754 |
+ p = xdr_encode_opaque_fixed(p, &err->deviceid, |
3755 |
+ NFS4_DEVICEID4_SIZE); |
3756 |
+ *p++ = cpu_to_be32(err->status); |
3757 |
+diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c |
3758 |
+index 0adc7d245b3d..4afbe13321cb 100644 |
3759 |
+--- a/fs/nfs/inode.c |
3760 |
++++ b/fs/nfs/inode.c |
3761 |
+@@ -1273,13 +1273,6 @@ static int nfs_check_inode_attributes(struct inode *inode, struct nfs_fattr *fat |
3762 |
+ return 0; |
3763 |
+ } |
3764 |
+ |
3765 |
+-static int nfs_ctime_need_update(const struct inode *inode, const struct nfs_fattr *fattr) |
3766 |
+-{ |
3767 |
+- if (!(fattr->valid & NFS_ATTR_FATTR_CTIME)) |
3768 |
+- return 0; |
3769 |
+- return timespec_compare(&fattr->ctime, &inode->i_ctime) > 0; |
3770 |
+-} |
3771 |
+- |
3772 |
+ static atomic_long_t nfs_attr_generation_counter; |
3773 |
+ |
3774 |
+ static unsigned long nfs_read_attr_generation_counter(void) |
3775 |
+@@ -1428,7 +1421,6 @@ static int nfs_inode_attrs_need_update(const struct inode *inode, const struct n |
3776 |
+ const struct nfs_inode *nfsi = NFS_I(inode); |
3777 |
+ |
3778 |
+ return ((long)fattr->gencount - (long)nfsi->attr_gencount) > 0 || |
3779 |
+- nfs_ctime_need_update(inode, fattr) || |
3780 |
+ ((long)nfsi->attr_gencount - (long)nfs_read_attr_generation_counter() > 0); |
3781 |
+ } |
3782 |
+ |
3783 |
+@@ -1491,6 +1483,13 @@ static int nfs_post_op_update_inode_locked(struct inode *inode, struct nfs_fattr |
3784 |
+ { |
3785 |
+ unsigned long invalid = NFS_INO_INVALID_ATTR|NFS_INO_REVAL_PAGECACHE; |
3786 |
+ |
3787 |
++ /* |
3788 |
++ * Don't revalidate the pagecache if we hold a delegation, but do |
3789 |
++ * force an attribute update |
3790 |
++ */ |
3791 |
++ if (NFS_PROTO(inode)->have_delegation(inode, FMODE_READ)) |
3792 |
++ invalid = NFS_INO_INVALID_ATTR|NFS_INO_REVAL_FORCED; |
3793 |
++ |
3794 |
+ if (S_ISDIR(inode->i_mode)) |
3795 |
+ invalid |= NFS_INO_INVALID_DATA; |
3796 |
+ nfs_set_cache_invalid(inode, invalid); |
3797 |
+diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h |
3798 |
+index 9b372b845f6a..1dad18105ed0 100644 |
3799 |
+--- a/fs/nfs/internal.h |
3800 |
++++ b/fs/nfs/internal.h |
3801 |
+@@ -490,6 +490,9 @@ void nfs_retry_commit(struct list_head *page_list, |
3802 |
+ void nfs_commitdata_release(struct nfs_commit_data *data); |
3803 |
+ void nfs_request_add_commit_list(struct nfs_page *req, struct list_head *dst, |
3804 |
+ struct nfs_commit_info *cinfo); |
3805 |
++void nfs_request_add_commit_list_locked(struct nfs_page *req, |
3806 |
++ struct list_head *dst, |
3807 |
++ struct nfs_commit_info *cinfo); |
3808 |
+ void nfs_request_remove_commit_list(struct nfs_page *req, |
3809 |
+ struct nfs_commit_info *cinfo); |
3810 |
+ void nfs_init_cinfo(struct nfs_commit_info *cinfo, |
3811 |
+@@ -623,13 +626,15 @@ void nfs_super_set_maxbytes(struct super_block *sb, __u64 maxfilesize) |
3812 |
+ * Record the page as unstable and mark its inode as dirty. |
3813 |
+ */ |
3814 |
+ static inline |
3815 |
+-void nfs_mark_page_unstable(struct page *page) |
3816 |
++void nfs_mark_page_unstable(struct page *page, struct nfs_commit_info *cinfo) |
3817 |
+ { |
3818 |
+- struct inode *inode = page_file_mapping(page)->host; |
3819 |
++ if (!cinfo->dreq) { |
3820 |
++ struct inode *inode = page_file_mapping(page)->host; |
3821 |
+ |
3822 |
+- inc_zone_page_state(page, NR_UNSTABLE_NFS); |
3823 |
+- inc_wb_stat(&inode_to_bdi(inode)->wb, WB_RECLAIMABLE); |
3824 |
+- __mark_inode_dirty(inode, I_DIRTY_DATASYNC); |
3825 |
++ inc_zone_page_state(page, NR_UNSTABLE_NFS); |
3826 |
++ inc_wb_stat(&inode_to_bdi(inode)->wb, WB_RECLAIMABLE); |
3827 |
++ __mark_inode_dirty(inode, I_DIRTY_DATASYNC); |
3828 |
++ } |
3829 |
+ } |
3830 |
+ |
3831 |
+ /* |
3832 |
+diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c |
3833 |
+index 3acb1eb72930..73c8204ad463 100644 |
3834 |
+--- a/fs/nfs/nfs4proc.c |
3835 |
++++ b/fs/nfs/nfs4proc.c |
3836 |
+@@ -1156,6 +1156,8 @@ static int can_open_delegated(struct nfs_delegation *delegation, fmode_t fmode) |
3837 |
+ return 0; |
3838 |
+ if ((delegation->type & fmode) != fmode) |
3839 |
+ return 0; |
3840 |
++ if (test_bit(NFS_DELEGATION_NEED_RECLAIM, &delegation->flags)) |
3841 |
++ return 0; |
3842 |
+ if (test_bit(NFS_DELEGATION_RETURNING, &delegation->flags)) |
3843 |
+ return 0; |
3844 |
+ nfs_mark_delegation_referenced(delegation); |
3845 |
+@@ -1220,6 +1222,7 @@ static void nfs_resync_open_stateid_locked(struct nfs4_state *state) |
3846 |
+ } |
3847 |
+ |
3848 |
+ static void nfs_clear_open_stateid_locked(struct nfs4_state *state, |
3849 |
++ nfs4_stateid *arg_stateid, |
3850 |
+ nfs4_stateid *stateid, fmode_t fmode) |
3851 |
+ { |
3852 |
+ clear_bit(NFS_O_RDWR_STATE, &state->flags); |
3853 |
+@@ -1238,8 +1241,9 @@ static void nfs_clear_open_stateid_locked(struct nfs4_state *state, |
3854 |
+ if (stateid == NULL) |
3855 |
+ return; |
3856 |
+ /* Handle races with OPEN */ |
3857 |
+- if (!nfs4_stateid_match_other(stateid, &state->open_stateid) || |
3858 |
+- !nfs4_stateid_is_newer(stateid, &state->open_stateid)) { |
3859 |
++ if (!nfs4_stateid_match_other(arg_stateid, &state->open_stateid) || |
3860 |
++ (nfs4_stateid_match_other(stateid, &state->open_stateid) && |
3861 |
++ !nfs4_stateid_is_newer(stateid, &state->open_stateid))) { |
3862 |
+ nfs_resync_open_stateid_locked(state); |
3863 |
+ return; |
3864 |
+ } |
3865 |
+@@ -1248,10 +1252,12 @@ static void nfs_clear_open_stateid_locked(struct nfs4_state *state, |
3866 |
+ nfs4_stateid_copy(&state->open_stateid, stateid); |
3867 |
+ } |
3868 |
+ |
3869 |
+-static void nfs_clear_open_stateid(struct nfs4_state *state, nfs4_stateid *stateid, fmode_t fmode) |
3870 |
++static void nfs_clear_open_stateid(struct nfs4_state *state, |
3871 |
++ nfs4_stateid *arg_stateid, |
3872 |
++ nfs4_stateid *stateid, fmode_t fmode) |
3873 |
+ { |
3874 |
+ write_seqlock(&state->seqlock); |
3875 |
+- nfs_clear_open_stateid_locked(state, stateid, fmode); |
3876 |
++ nfs_clear_open_stateid_locked(state, arg_stateid, stateid, fmode); |
3877 |
+ write_sequnlock(&state->seqlock); |
3878 |
+ if (test_bit(NFS_STATE_RECLAIM_NOGRACE, &state->flags)) |
3879 |
+ nfs4_schedule_state_manager(state->owner->so_server->nfs_client); |
3880 |
+@@ -2425,7 +2431,7 @@ static int _nfs4_do_open(struct inode *dir, |
3881 |
+ goto err_free_label; |
3882 |
+ state = ctx->state; |
3883 |
+ |
3884 |
+- if ((opendata->o_arg.open_flags & O_EXCL) && |
3885 |
++ if ((opendata->o_arg.open_flags & (O_CREAT|O_EXCL)) == (O_CREAT|O_EXCL) && |
3886 |
+ (opendata->o_arg.createmode != NFS4_CREATE_GUARDED)) { |
3887 |
+ nfs4_exclusive_attrset(opendata, sattr); |
3888 |
+ |
3889 |
+@@ -2684,7 +2690,8 @@ static void nfs4_close_done(struct rpc_task *task, void *data) |
3890 |
+ goto out_release; |
3891 |
+ } |
3892 |
+ } |
3893 |
+- nfs_clear_open_stateid(state, res_stateid, calldata->arg.fmode); |
3894 |
++ nfs_clear_open_stateid(state, &calldata->arg.stateid, |
3895 |
++ res_stateid, calldata->arg.fmode); |
3896 |
+ out_release: |
3897 |
+ nfs_release_seqid(calldata->arg.seqid); |
3898 |
+ nfs_refresh_inode(calldata->inode, calldata->res.fattr); |
3899 |
+@@ -4984,7 +4991,7 @@ nfs4_init_nonuniform_client_string(struct nfs_client *clp) |
3900 |
+ return 0; |
3901 |
+ retry: |
3902 |
+ rcu_read_lock(); |
3903 |
+- len = 10 + strlen(clp->cl_ipaddr) + 1 + |
3904 |
++ len = 14 + strlen(clp->cl_ipaddr) + 1 + |
3905 |
+ strlen(rpc_peeraddr2str(clp->cl_rpcclient, RPC_DISPLAY_ADDR)) + |
3906 |
+ 1 + |
3907 |
+ strlen(rpc_peeraddr2str(clp->cl_rpcclient, RPC_DISPLAY_PROTO)) + |
3908 |
+@@ -8661,6 +8668,7 @@ static const struct nfs4_minor_version_ops nfs_v4_2_minor_ops = { |
3909 |
+ .reboot_recovery_ops = &nfs41_reboot_recovery_ops, |
3910 |
+ .nograce_recovery_ops = &nfs41_nograce_recovery_ops, |
3911 |
+ .state_renewal_ops = &nfs41_state_renewal_ops, |
3912 |
++ .mig_recovery_ops = &nfs41_mig_recovery_ops, |
3913 |
+ }; |
3914 |
+ #endif |
3915 |
+ |
3916 |
+diff --git a/fs/nfs/pagelist.c b/fs/nfs/pagelist.c |
3917 |
+index 4984bbe55ff1..7c5718ba625e 100644 |
3918 |
+--- a/fs/nfs/pagelist.c |
3919 |
++++ b/fs/nfs/pagelist.c |
3920 |
+@@ -77,8 +77,8 @@ EXPORT_SYMBOL_GPL(nfs_pgheader_init); |
3921 |
+ void nfs_set_pgio_error(struct nfs_pgio_header *hdr, int error, loff_t pos) |
3922 |
+ { |
3923 |
+ spin_lock(&hdr->lock); |
3924 |
+- if (pos < hdr->io_start + hdr->good_bytes) { |
3925 |
+- set_bit(NFS_IOHDR_ERROR, &hdr->flags); |
3926 |
++ if (!test_and_set_bit(NFS_IOHDR_ERROR, &hdr->flags) |
3927 |
++ || pos < hdr->io_start + hdr->good_bytes) { |
3928 |
+ clear_bit(NFS_IOHDR_EOF, &hdr->flags); |
3929 |
+ hdr->good_bytes = pos - hdr->io_start; |
3930 |
+ hdr->error = error; |
3931 |
+diff --git a/fs/nfs/pnfs_nfs.c b/fs/nfs/pnfs_nfs.c |
3932 |
+index f37e25b6311c..e5c679f04099 100644 |
3933 |
+--- a/fs/nfs/pnfs_nfs.c |
3934 |
++++ b/fs/nfs/pnfs_nfs.c |
3935 |
+@@ -359,26 +359,31 @@ same_sockaddr(struct sockaddr *addr1, struct sockaddr *addr2) |
3936 |
+ return false; |
3937 |
+ } |
3938 |
+ |
3939 |
++/* |
3940 |
++ * Checks if 'dsaddrs1' contains a subset of 'dsaddrs2'. If it does, |
3941 |
++ * declare a match. |
3942 |
++ */ |
3943 |
+ static bool |
3944 |
+ _same_data_server_addrs_locked(const struct list_head *dsaddrs1, |
3945 |
+ const struct list_head *dsaddrs2) |
3946 |
+ { |
3947 |
+ struct nfs4_pnfs_ds_addr *da1, *da2; |
3948 |
+- |
3949 |
+- /* step through both lists, comparing as we go */ |
3950 |
+- for (da1 = list_first_entry(dsaddrs1, typeof(*da1), da_node), |
3951 |
+- da2 = list_first_entry(dsaddrs2, typeof(*da2), da_node); |
3952 |
+- da1 != NULL && da2 != NULL; |
3953 |
+- da1 = list_entry(da1->da_node.next, typeof(*da1), da_node), |
3954 |
+- da2 = list_entry(da2->da_node.next, typeof(*da2), da_node)) { |
3955 |
+- if (!same_sockaddr((struct sockaddr *)&da1->da_addr, |
3956 |
+- (struct sockaddr *)&da2->da_addr)) |
3957 |
+- return false; |
3958 |
++ struct sockaddr *sa1, *sa2; |
3959 |
++ bool match = false; |
3960 |
++ |
3961 |
++ list_for_each_entry(da1, dsaddrs1, da_node) { |
3962 |
++ sa1 = (struct sockaddr *)&da1->da_addr; |
3963 |
++ match = false; |
3964 |
++ list_for_each_entry(da2, dsaddrs2, da_node) { |
3965 |
++ sa2 = (struct sockaddr *)&da2->da_addr; |
3966 |
++ match = same_sockaddr(sa1, sa2); |
3967 |
++ if (match) |
3968 |
++ break; |
3969 |
++ } |
3970 |
++ if (!match) |
3971 |
++ break; |
3972 |
+ } |
3973 |
+- if (da1 == NULL && da2 == NULL) |
3974 |
+- return true; |
3975 |
+- |
3976 |
+- return false; |
3977 |
++ return match; |
3978 |
+ } |
3979 |
+ |
3980 |
+ /* |
3981 |
+@@ -863,9 +868,10 @@ pnfs_layout_mark_request_commit(struct nfs_page *req, |
3982 |
+ } |
3983 |
+ set_bit(PG_COMMIT_TO_DS, &req->wb_flags); |
3984 |
+ cinfo->ds->nwritten++; |
3985 |
+- spin_unlock(cinfo->lock); |
3986 |
+ |
3987 |
+- nfs_request_add_commit_list(req, list, cinfo); |
3988 |
++ nfs_request_add_commit_list_locked(req, list, cinfo); |
3989 |
++ spin_unlock(cinfo->lock); |
3990 |
++ nfs_mark_page_unstable(req->wb_page, cinfo); |
3991 |
+ } |
3992 |
+ EXPORT_SYMBOL_GPL(pnfs_layout_mark_request_commit); |
3993 |
+ |
3994 |
+diff --git a/fs/nfs/write.c b/fs/nfs/write.c |
3995 |
+index 75a35a1afa79..fdee9270ca15 100644 |
3996 |
+--- a/fs/nfs/write.c |
3997 |
++++ b/fs/nfs/write.c |
3998 |
+@@ -768,6 +768,28 @@ nfs_page_search_commits_for_head_request_locked(struct nfs_inode *nfsi, |
3999 |
+ } |
4000 |
+ |
4001 |
+ /** |
4002 |
++ * nfs_request_add_commit_list_locked - add request to a commit list |
4003 |
++ * @req: pointer to a struct nfs_page |
4004 |
++ * @dst: commit list head |
4005 |
++ * @cinfo: holds list lock and accounting info |
4006 |
++ * |
4007 |
++ * This sets the PG_CLEAN bit, updates the cinfo count of |
4008 |
++ * number of outstanding requests requiring a commit as well as |
4009 |
++ * the MM page stats. |
4010 |
++ * |
4011 |
++ * The caller must hold the cinfo->lock, and the nfs_page lock. |
4012 |
++ */ |
4013 |
++void |
4014 |
++nfs_request_add_commit_list_locked(struct nfs_page *req, struct list_head *dst, |
4015 |
++ struct nfs_commit_info *cinfo) |
4016 |
++{ |
4017 |
++ set_bit(PG_CLEAN, &req->wb_flags); |
4018 |
++ nfs_list_add_request(req, dst); |
4019 |
++ cinfo->mds->ncommit++; |
4020 |
++} |
4021 |
++EXPORT_SYMBOL_GPL(nfs_request_add_commit_list_locked); |
4022 |
++ |
4023 |
++/** |
4024 |
+ * nfs_request_add_commit_list - add request to a commit list |
4025 |
+ * @req: pointer to a struct nfs_page |
4026 |
+ * @dst: commit list head |
4027 |
+@@ -784,13 +806,10 @@ void |
4028 |
+ nfs_request_add_commit_list(struct nfs_page *req, struct list_head *dst, |
4029 |
+ struct nfs_commit_info *cinfo) |
4030 |
+ { |
4031 |
+- set_bit(PG_CLEAN, &(req)->wb_flags); |
4032 |
+ spin_lock(cinfo->lock); |
4033 |
+- nfs_list_add_request(req, dst); |
4034 |
+- cinfo->mds->ncommit++; |
4035 |
++ nfs_request_add_commit_list_locked(req, dst, cinfo); |
4036 |
+ spin_unlock(cinfo->lock); |
4037 |
+- if (!cinfo->dreq) |
4038 |
+- nfs_mark_page_unstable(req->wb_page); |
4039 |
++ nfs_mark_page_unstable(req->wb_page, cinfo); |
4040 |
+ } |
4041 |
+ EXPORT_SYMBOL_GPL(nfs_request_add_commit_list); |
4042 |
+ |
4043 |
+diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c |
4044 |
+index 95202719a1fd..75189cd34583 100644 |
4045 |
+--- a/fs/nfsd/nfs4state.c |
4046 |
++++ b/fs/nfsd/nfs4state.c |
4047 |
+@@ -777,13 +777,16 @@ hash_delegation_locked(struct nfs4_delegation *dp, struct nfs4_file *fp) |
4048 |
+ list_add(&dp->dl_perclnt, &dp->dl_stid.sc_client->cl_delegations); |
4049 |
+ } |
4050 |
+ |
4051 |
+-static void |
4052 |
++static bool |
4053 |
+ unhash_delegation_locked(struct nfs4_delegation *dp) |
4054 |
+ { |
4055 |
+ struct nfs4_file *fp = dp->dl_stid.sc_file; |
4056 |
+ |
4057 |
+ lockdep_assert_held(&state_lock); |
4058 |
+ |
4059 |
++ if (list_empty(&dp->dl_perfile)) |
4060 |
++ return false; |
4061 |
++ |
4062 |
+ dp->dl_stid.sc_type = NFS4_CLOSED_DELEG_STID; |
4063 |
+ /* Ensure that deleg break won't try to requeue it */ |
4064 |
+ ++dp->dl_time; |
4065 |
+@@ -792,16 +795,21 @@ unhash_delegation_locked(struct nfs4_delegation *dp) |
4066 |
+ list_del_init(&dp->dl_recall_lru); |
4067 |
+ list_del_init(&dp->dl_perfile); |
4068 |
+ spin_unlock(&fp->fi_lock); |
4069 |
++ return true; |
4070 |
+ } |
4071 |
+ |
4072 |
+ static void destroy_delegation(struct nfs4_delegation *dp) |
4073 |
+ { |
4074 |
++ bool unhashed; |
4075 |
++ |
4076 |
+ spin_lock(&state_lock); |
4077 |
+- unhash_delegation_locked(dp); |
4078 |
++ unhashed = unhash_delegation_locked(dp); |
4079 |
+ spin_unlock(&state_lock); |
4080 |
+- put_clnt_odstate(dp->dl_clnt_odstate); |
4081 |
+- nfs4_put_deleg_lease(dp->dl_stid.sc_file); |
4082 |
+- nfs4_put_stid(&dp->dl_stid); |
4083 |
++ if (unhashed) { |
4084 |
++ put_clnt_odstate(dp->dl_clnt_odstate); |
4085 |
++ nfs4_put_deleg_lease(dp->dl_stid.sc_file); |
4086 |
++ nfs4_put_stid(&dp->dl_stid); |
4087 |
++ } |
4088 |
+ } |
4089 |
+ |
4090 |
+ static void revoke_delegation(struct nfs4_delegation *dp) |
4091 |
+@@ -1004,16 +1012,20 @@ static void nfs4_put_stateowner(struct nfs4_stateowner *sop) |
4092 |
+ sop->so_ops->so_free(sop); |
4093 |
+ } |
4094 |
+ |
4095 |
+-static void unhash_ol_stateid(struct nfs4_ol_stateid *stp) |
4096 |
++static bool unhash_ol_stateid(struct nfs4_ol_stateid *stp) |
4097 |
+ { |
4098 |
+ struct nfs4_file *fp = stp->st_stid.sc_file; |
4099 |
+ |
4100 |
+ lockdep_assert_held(&stp->st_stateowner->so_client->cl_lock); |
4101 |
+ |
4102 |
++ if (list_empty(&stp->st_perfile)) |
4103 |
++ return false; |
4104 |
++ |
4105 |
+ spin_lock(&fp->fi_lock); |
4106 |
+- list_del(&stp->st_perfile); |
4107 |
++ list_del_init(&stp->st_perfile); |
4108 |
+ spin_unlock(&fp->fi_lock); |
4109 |
+ list_del(&stp->st_perstateowner); |
4110 |
++ return true; |
4111 |
+ } |
4112 |
+ |
4113 |
+ static void nfs4_free_ol_stateid(struct nfs4_stid *stid) |
4114 |
+@@ -1063,25 +1075,27 @@ static void put_ol_stateid_locked(struct nfs4_ol_stateid *stp, |
4115 |
+ list_add(&stp->st_locks, reaplist); |
4116 |
+ } |
4117 |
+ |
4118 |
+-static void unhash_lock_stateid(struct nfs4_ol_stateid *stp) |
4119 |
++static bool unhash_lock_stateid(struct nfs4_ol_stateid *stp) |
4120 |
+ { |
4121 |
+ struct nfs4_openowner *oo = openowner(stp->st_openstp->st_stateowner); |
4122 |
+ |
4123 |
+ lockdep_assert_held(&oo->oo_owner.so_client->cl_lock); |
4124 |
+ |
4125 |
+ list_del_init(&stp->st_locks); |
4126 |
+- unhash_ol_stateid(stp); |
4127 |
+ nfs4_unhash_stid(&stp->st_stid); |
4128 |
++ return unhash_ol_stateid(stp); |
4129 |
+ } |
4130 |
+ |
4131 |
+ static void release_lock_stateid(struct nfs4_ol_stateid *stp) |
4132 |
+ { |
4133 |
+ struct nfs4_openowner *oo = openowner(stp->st_openstp->st_stateowner); |
4134 |
++ bool unhashed; |
4135 |
+ |
4136 |
+ spin_lock(&oo->oo_owner.so_client->cl_lock); |
4137 |
+- unhash_lock_stateid(stp); |
4138 |
++ unhashed = unhash_lock_stateid(stp); |
4139 |
+ spin_unlock(&oo->oo_owner.so_client->cl_lock); |
4140 |
+- nfs4_put_stid(&stp->st_stid); |
4141 |
++ if (unhashed) |
4142 |
++ nfs4_put_stid(&stp->st_stid); |
4143 |
+ } |
4144 |
+ |
4145 |
+ static void unhash_lockowner_locked(struct nfs4_lockowner *lo) |
4146 |
+@@ -1129,7 +1143,7 @@ static void release_lockowner(struct nfs4_lockowner *lo) |
4147 |
+ while (!list_empty(&lo->lo_owner.so_stateids)) { |
4148 |
+ stp = list_first_entry(&lo->lo_owner.so_stateids, |
4149 |
+ struct nfs4_ol_stateid, st_perstateowner); |
4150 |
+- unhash_lock_stateid(stp); |
4151 |
++ WARN_ON(!unhash_lock_stateid(stp)); |
4152 |
+ put_ol_stateid_locked(stp, &reaplist); |
4153 |
+ } |
4154 |
+ spin_unlock(&clp->cl_lock); |
4155 |
+@@ -1142,21 +1156,26 @@ static void release_open_stateid_locks(struct nfs4_ol_stateid *open_stp, |
4156 |
+ { |
4157 |
+ struct nfs4_ol_stateid *stp; |
4158 |
+ |
4159 |
++ lockdep_assert_held(&open_stp->st_stid.sc_client->cl_lock); |
4160 |
++ |
4161 |
+ while (!list_empty(&open_stp->st_locks)) { |
4162 |
+ stp = list_entry(open_stp->st_locks.next, |
4163 |
+ struct nfs4_ol_stateid, st_locks); |
4164 |
+- unhash_lock_stateid(stp); |
4165 |
++ WARN_ON(!unhash_lock_stateid(stp)); |
4166 |
+ put_ol_stateid_locked(stp, reaplist); |
4167 |
+ } |
4168 |
+ } |
4169 |
+ |
4170 |
+-static void unhash_open_stateid(struct nfs4_ol_stateid *stp, |
4171 |
++static bool unhash_open_stateid(struct nfs4_ol_stateid *stp, |
4172 |
+ struct list_head *reaplist) |
4173 |
+ { |
4174 |
++ bool unhashed; |
4175 |
++ |
4176 |
+ lockdep_assert_held(&stp->st_stid.sc_client->cl_lock); |
4177 |
+ |
4178 |
+- unhash_ol_stateid(stp); |
4179 |
++ unhashed = unhash_ol_stateid(stp); |
4180 |
+ release_open_stateid_locks(stp, reaplist); |
4181 |
++ return unhashed; |
4182 |
+ } |
4183 |
+ |
4184 |
+ static void release_open_stateid(struct nfs4_ol_stateid *stp) |
4185 |
+@@ -1164,8 +1183,8 @@ static void release_open_stateid(struct nfs4_ol_stateid *stp) |
4186 |
+ LIST_HEAD(reaplist); |
4187 |
+ |
4188 |
+ spin_lock(&stp->st_stid.sc_client->cl_lock); |
4189 |
+- unhash_open_stateid(stp, &reaplist); |
4190 |
+- put_ol_stateid_locked(stp, &reaplist); |
4191 |
++ if (unhash_open_stateid(stp, &reaplist)) |
4192 |
++ put_ol_stateid_locked(stp, &reaplist); |
4193 |
+ spin_unlock(&stp->st_stid.sc_client->cl_lock); |
4194 |
+ free_ol_stateid_reaplist(&reaplist); |
4195 |
+ } |
4196 |
+@@ -1210,8 +1229,8 @@ static void release_openowner(struct nfs4_openowner *oo) |
4197 |
+ while (!list_empty(&oo->oo_owner.so_stateids)) { |
4198 |
+ stp = list_first_entry(&oo->oo_owner.so_stateids, |
4199 |
+ struct nfs4_ol_stateid, st_perstateowner); |
4200 |
+- unhash_open_stateid(stp, &reaplist); |
4201 |
+- put_ol_stateid_locked(stp, &reaplist); |
4202 |
++ if (unhash_open_stateid(stp, &reaplist)) |
4203 |
++ put_ol_stateid_locked(stp, &reaplist); |
4204 |
+ } |
4205 |
+ spin_unlock(&clp->cl_lock); |
4206 |
+ free_ol_stateid_reaplist(&reaplist); |
4207 |
+@@ -1714,7 +1733,7 @@ __destroy_client(struct nfs4_client *clp) |
4208 |
+ spin_lock(&state_lock); |
4209 |
+ while (!list_empty(&clp->cl_delegations)) { |
4210 |
+ dp = list_entry(clp->cl_delegations.next, struct nfs4_delegation, dl_perclnt); |
4211 |
+- unhash_delegation_locked(dp); |
4212 |
++ WARN_ON(!unhash_delegation_locked(dp)); |
4213 |
+ list_add(&dp->dl_recall_lru, &reaplist); |
4214 |
+ } |
4215 |
+ spin_unlock(&state_lock); |
4216 |
+@@ -4345,7 +4364,7 @@ nfs4_laundromat(struct nfsd_net *nn) |
4217 |
+ new_timeo = min(new_timeo, t); |
4218 |
+ break; |
4219 |
+ } |
4220 |
+- unhash_delegation_locked(dp); |
4221 |
++ WARN_ON(!unhash_delegation_locked(dp)); |
4222 |
+ list_add(&dp->dl_recall_lru, &reaplist); |
4223 |
+ } |
4224 |
+ spin_unlock(&state_lock); |
4225 |
+@@ -4751,7 +4770,7 @@ nfsd4_free_stateid(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, |
4226 |
+ if (check_for_locks(stp->st_stid.sc_file, |
4227 |
+ lockowner(stp->st_stateowner))) |
4228 |
+ break; |
4229 |
+- unhash_lock_stateid(stp); |
4230 |
++ WARN_ON(!unhash_lock_stateid(stp)); |
4231 |
+ spin_unlock(&cl->cl_lock); |
4232 |
+ nfs4_put_stid(s); |
4233 |
+ ret = nfs_ok; |
4234 |
+@@ -4967,20 +4986,23 @@ out: |
4235 |
+ static void nfsd4_close_open_stateid(struct nfs4_ol_stateid *s) |
4236 |
+ { |
4237 |
+ struct nfs4_client *clp = s->st_stid.sc_client; |
4238 |
++ bool unhashed; |
4239 |
+ LIST_HEAD(reaplist); |
4240 |
+ |
4241 |
+ s->st_stid.sc_type = NFS4_CLOSED_STID; |
4242 |
+ spin_lock(&clp->cl_lock); |
4243 |
+- unhash_open_stateid(s, &reaplist); |
4244 |
++ unhashed = unhash_open_stateid(s, &reaplist); |
4245 |
+ |
4246 |
+ if (clp->cl_minorversion) { |
4247 |
+- put_ol_stateid_locked(s, &reaplist); |
4248 |
++ if (unhashed) |
4249 |
++ put_ol_stateid_locked(s, &reaplist); |
4250 |
+ spin_unlock(&clp->cl_lock); |
4251 |
+ free_ol_stateid_reaplist(&reaplist); |
4252 |
+ } else { |
4253 |
+ spin_unlock(&clp->cl_lock); |
4254 |
+ free_ol_stateid_reaplist(&reaplist); |
4255 |
+- move_to_close_lru(s, clp->net); |
4256 |
++ if (unhashed) |
4257 |
++ move_to_close_lru(s, clp->net); |
4258 |
+ } |
4259 |
+ } |
4260 |
+ |
4261 |
+@@ -6019,7 +6041,7 @@ nfsd_inject_add_lock_to_list(struct nfs4_ol_stateid *lst, |
4262 |
+ |
4263 |
+ static u64 nfsd_foreach_client_lock(struct nfs4_client *clp, u64 max, |
4264 |
+ struct list_head *collect, |
4265 |
+- void (*func)(struct nfs4_ol_stateid *)) |
4266 |
++ bool (*func)(struct nfs4_ol_stateid *)) |
4267 |
+ { |
4268 |
+ struct nfs4_openowner *oop; |
4269 |
+ struct nfs4_ol_stateid *stp, *st_next; |
4270 |
+@@ -6033,9 +6055,9 @@ static u64 nfsd_foreach_client_lock(struct nfs4_client *clp, u64 max, |
4271 |
+ list_for_each_entry_safe(lst, lst_next, |
4272 |
+ &stp->st_locks, st_locks) { |
4273 |
+ if (func) { |
4274 |
+- func(lst); |
4275 |
+- nfsd_inject_add_lock_to_list(lst, |
4276 |
+- collect); |
4277 |
++ if (func(lst)) |
4278 |
++ nfsd_inject_add_lock_to_list(lst, |
4279 |
++ collect); |
4280 |
+ } |
4281 |
+ ++count; |
4282 |
+ /* |
4283 |
+@@ -6305,7 +6327,7 @@ static u64 nfsd_find_all_delegations(struct nfs4_client *clp, u64 max, |
4284 |
+ continue; |
4285 |
+ |
4286 |
+ atomic_inc(&clp->cl_refcount); |
4287 |
+- unhash_delegation_locked(dp); |
4288 |
++ WARN_ON(!unhash_delegation_locked(dp)); |
4289 |
+ list_add(&dp->dl_recall_lru, victims); |
4290 |
+ } |
4291 |
+ ++count; |
4292 |
+@@ -6635,7 +6657,7 @@ nfs4_state_shutdown_net(struct net *net) |
4293 |
+ spin_lock(&state_lock); |
4294 |
+ list_for_each_safe(pos, next, &nn->del_recall_lru) { |
4295 |
+ dp = list_entry (pos, struct nfs4_delegation, dl_recall_lru); |
4296 |
+- unhash_delegation_locked(dp); |
4297 |
++ WARN_ON(!unhash_delegation_locked(dp)); |
4298 |
+ list_add(&dp->dl_recall_lru, &reaplist); |
4299 |
+ } |
4300 |
+ spin_unlock(&state_lock); |
4301 |
+diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c |
4302 |
+index 75e0563c09d1..b81f725ee21d 100644 |
4303 |
+--- a/fs/nfsd/nfs4xdr.c |
4304 |
++++ b/fs/nfsd/nfs4xdr.c |
4305 |
+@@ -2140,6 +2140,27 @@ nfsd4_encode_aclname(struct xdr_stream *xdr, struct svc_rqst *rqstp, |
4306 |
+ return nfsd4_encode_user(xdr, rqstp, ace->who_uid); |
4307 |
+ } |
4308 |
+ |
4309 |
++static inline __be32 |
4310 |
++nfsd4_encode_layout_type(struct xdr_stream *xdr, enum pnfs_layouttype layout_type) |
4311 |
++{ |
4312 |
++ __be32 *p; |
4313 |
++ |
4314 |
++ if (layout_type) { |
4315 |
++ p = xdr_reserve_space(xdr, 8); |
4316 |
++ if (!p) |
4317 |
++ return nfserr_resource; |
4318 |
++ *p++ = cpu_to_be32(1); |
4319 |
++ *p++ = cpu_to_be32(layout_type); |
4320 |
++ } else { |
4321 |
++ p = xdr_reserve_space(xdr, 4); |
4322 |
++ if (!p) |
4323 |
++ return nfserr_resource; |
4324 |
++ *p++ = cpu_to_be32(0); |
4325 |
++ } |
4326 |
++ |
4327 |
++ return 0; |
4328 |
++} |
4329 |
++ |
4330 |
+ #define WORD0_ABSENT_FS_ATTRS (FATTR4_WORD0_FS_LOCATIONS | FATTR4_WORD0_FSID | \ |
4331 |
+ FATTR4_WORD0_RDATTR_ERROR) |
4332 |
+ #define WORD1_ABSENT_FS_ATTRS FATTR4_WORD1_MOUNTED_ON_FILEID |
4333 |
+@@ -2688,20 +2709,16 @@ out_acl: |
4334 |
+ p = xdr_encode_hyper(p, stat.ino); |
4335 |
+ } |
4336 |
+ #ifdef CONFIG_NFSD_PNFS |
4337 |
+- if ((bmval1 & FATTR4_WORD1_FS_LAYOUT_TYPES) || |
4338 |
+- (bmval2 & FATTR4_WORD2_LAYOUT_TYPES)) { |
4339 |
+- if (exp->ex_layout_type) { |
4340 |
+- p = xdr_reserve_space(xdr, 8); |
4341 |
+- if (!p) |
4342 |
+- goto out_resource; |
4343 |
+- *p++ = cpu_to_be32(1); |
4344 |
+- *p++ = cpu_to_be32(exp->ex_layout_type); |
4345 |
+- } else { |
4346 |
+- p = xdr_reserve_space(xdr, 4); |
4347 |
+- if (!p) |
4348 |
+- goto out_resource; |
4349 |
+- *p++ = cpu_to_be32(0); |
4350 |
+- } |
4351 |
++ if (bmval1 & FATTR4_WORD1_FS_LAYOUT_TYPES) { |
4352 |
++ status = nfsd4_encode_layout_type(xdr, exp->ex_layout_type); |
4353 |
++ if (status) |
4354 |
++ goto out; |
4355 |
++ } |
4356 |
++ |
4357 |
++ if (bmval2 & FATTR4_WORD2_LAYOUT_TYPES) { |
4358 |
++ status = nfsd4_encode_layout_type(xdr, exp->ex_layout_type); |
4359 |
++ if (status) |
4360 |
++ goto out; |
4361 |
+ } |
4362 |
+ |
4363 |
+ if (bmval2 & FATTR4_WORD2_LAYOUT_BLKSIZE) { |
4364 |
+diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h |
4365 |
+index edb640ae9a94..eb1cebed3f36 100644 |
4366 |
+--- a/include/linux/jbd2.h |
4367 |
++++ b/include/linux/jbd2.h |
4368 |
+@@ -1042,8 +1042,9 @@ void jbd2_update_log_tail(journal_t *journal, tid_t tid, unsigned long block); |
4369 |
+ extern void jbd2_journal_commit_transaction(journal_t *); |
4370 |
+ |
4371 |
+ /* Checkpoint list management */ |
4372 |
+-void __jbd2_journal_clean_checkpoint_list(journal_t *journal); |
4373 |
++void __jbd2_journal_clean_checkpoint_list(journal_t *journal, bool destroy); |
4374 |
+ int __jbd2_journal_remove_checkpoint(struct journal_head *); |
4375 |
++void jbd2_journal_destroy_checkpoint(journal_t *journal); |
4376 |
+ void __jbd2_journal_insert_checkpoint(struct journal_head *, transaction_t *); |
4377 |
+ |
4378 |
+ |
4379 |
+diff --git a/include/linux/platform_data/st_nci.h b/include/linux/platform_data/st_nci.h |
4380 |
+deleted file mode 100644 |
4381 |
+index d9d400a297bd..000000000000 |
4382 |
+--- a/include/linux/platform_data/st_nci.h |
4383 |
++++ /dev/null |
4384 |
+@@ -1,29 +0,0 @@ |
4385 |
+-/* |
4386 |
+- * Driver include for ST NCI NFC chip family. |
4387 |
+- * |
4388 |
+- * Copyright (C) 2014-2015 STMicroelectronics SAS. All rights reserved. |
4389 |
+- * |
4390 |
+- * This program is free software; you can redistribute it and/or modify it |
4391 |
+- * under the terms and conditions of the GNU General Public License, |
4392 |
+- * version 2, as published by the Free Software Foundation. |
4393 |
+- * |
4394 |
+- * This program is distributed in the hope that it will be useful, |
4395 |
+- * but WITHOUT ANY WARRANTY; without even the implied warranty of |
4396 |
+- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4397 |
+- * GNU General Public License for more details. |
4398 |
+- * |
4399 |
+- * You should have received a copy of the GNU General Public License |
4400 |
+- * along with this program; if not, see <http://www.gnu.org/licenses/>. |
4401 |
+- */ |
4402 |
+- |
4403 |
+-#ifndef _ST_NCI_H_ |
4404 |
+-#define _ST_NCI_H_ |
4405 |
+- |
4406 |
+-#define ST_NCI_DRIVER_NAME "st_nci" |
4407 |
+- |
4408 |
+-struct st_nci_nfc_platform_data { |
4409 |
+- unsigned int gpio_reset; |
4410 |
+- unsigned int irq_polarity; |
4411 |
+-}; |
4412 |
+- |
4413 |
+-#endif /* _ST_NCI_H_ */ |
4414 |
+diff --git a/include/linux/sunrpc/svc_rdma.h b/include/linux/sunrpc/svc_rdma.h |
4415 |
+index cb94ee4181d4..4929a8a9fd52 100644 |
4416 |
+--- a/include/linux/sunrpc/svc_rdma.h |
4417 |
++++ b/include/linux/sunrpc/svc_rdma.h |
4418 |
+@@ -172,13 +172,6 @@ struct svcxprt_rdma { |
4419 |
+ #define RDMAXPRT_SQ_PENDING 2 |
4420 |
+ #define RDMAXPRT_CONN_PENDING 3 |
4421 |
+ |
4422 |
+-#define RPCRDMA_MAX_SVC_SEGS (64) /* server max scatter/gather */ |
4423 |
+-#if RPCSVC_MAXPAYLOAD < (RPCRDMA_MAX_SVC_SEGS << PAGE_SHIFT) |
4424 |
+-#define RPCRDMA_MAXPAYLOAD RPCSVC_MAXPAYLOAD |
4425 |
+-#else |
4426 |
+-#define RPCRDMA_MAXPAYLOAD (RPCRDMA_MAX_SVC_SEGS << PAGE_SHIFT) |
4427 |
+-#endif |
4428 |
+- |
4429 |
+ #define RPCRDMA_LISTEN_BACKLOG 10 |
4430 |
+ /* The default ORD value is based on two outstanding full-size writes with a |
4431 |
+ * page size of 4k, or 32k * 2 ops / 4k = 16 outstanding RDMA_READ. */ |
4432 |
+@@ -187,6 +180,8 @@ struct svcxprt_rdma { |
4433 |
+ #define RPCRDMA_MAX_REQUESTS 32 |
4434 |
+ #define RPCRDMA_MAX_REQ_SIZE 4096 |
4435 |
+ |
4436 |
++#define RPCSVC_MAXPAYLOAD_RDMA RPCSVC_MAXPAYLOAD |
4437 |
++ |
4438 |
+ /* svc_rdma_marshal.c */ |
4439 |
+ extern int svc_rdma_xdr_decode_req(struct rpcrdma_msg **, struct svc_rqst *); |
4440 |
+ extern int svc_rdma_xdr_encode_error(struct svcxprt_rdma *, |
4441 |
+diff --git a/include/linux/sunrpc/xprtsock.h b/include/linux/sunrpc/xprtsock.h |
4442 |
+index 7591788e9fbf..357e44c1a46b 100644 |
4443 |
+--- a/include/linux/sunrpc/xprtsock.h |
4444 |
++++ b/include/linux/sunrpc/xprtsock.h |
4445 |
+@@ -42,6 +42,7 @@ struct sock_xprt { |
4446 |
+ /* |
4447 |
+ * Connection of transports |
4448 |
+ */ |
4449 |
++ unsigned long sock_state; |
4450 |
+ struct delayed_work connect_worker; |
4451 |
+ struct sockaddr_storage srcaddr; |
4452 |
+ unsigned short srcport; |
4453 |
+@@ -76,6 +77,8 @@ struct sock_xprt { |
4454 |
+ */ |
4455 |
+ #define TCP_RPC_REPLY (1UL << 6) |
4456 |
+ |
4457 |
++#define XPRT_SOCK_CONNECTING 1U |
4458 |
++ |
4459 |
+ #endif /* __KERNEL__ */ |
4460 |
+ |
4461 |
+ #endif /* _LINUX_SUNRPC_XPRTSOCK_H */ |
4462 |
+diff --git a/include/soc/tegra/mc.h b/include/soc/tegra/mc.h |
4463 |
+index 1ab2813273cd..bf2058690ceb 100644 |
4464 |
+--- a/include/soc/tegra/mc.h |
4465 |
++++ b/include/soc/tegra/mc.h |
4466 |
+@@ -66,6 +66,7 @@ struct tegra_smmu_soc { |
4467 |
+ bool supports_round_robin_arbitration; |
4468 |
+ bool supports_request_limit; |
4469 |
+ |
4470 |
++ unsigned int num_tlb_lines; |
4471 |
+ unsigned int num_asids; |
4472 |
+ |
4473 |
+ const struct tegra_smmu_ops *ops; |
4474 |
+diff --git a/include/sound/hda_i915.h b/include/sound/hda_i915.h |
4475 |
+index adb5ba5cbd9d..ff99140831ba 100644 |
4476 |
+--- a/include/sound/hda_i915.h |
4477 |
++++ b/include/sound/hda_i915.h |
4478 |
+@@ -11,7 +11,7 @@ int snd_hdac_get_display_clk(struct hdac_bus *bus); |
4479 |
+ int snd_hdac_i915_init(struct hdac_bus *bus); |
4480 |
+ int snd_hdac_i915_exit(struct hdac_bus *bus); |
4481 |
+ #else |
4482 |
+-static int snd_hdac_set_codec_wakeup(struct hdac_bus *bus, bool enable) |
4483 |
++static inline int snd_hdac_set_codec_wakeup(struct hdac_bus *bus, bool enable) |
4484 |
+ { |
4485 |
+ return 0; |
4486 |
+ } |
4487 |
+diff --git a/include/trace/events/sunrpc.h b/include/trace/events/sunrpc.h |
4488 |
+index fd1a02cb3c82..003dca933803 100644 |
4489 |
+--- a/include/trace/events/sunrpc.h |
4490 |
++++ b/include/trace/events/sunrpc.h |
4491 |
+@@ -529,18 +529,21 @@ TRACE_EVENT(svc_xprt_do_enqueue, |
4492 |
+ |
4493 |
+ TP_STRUCT__entry( |
4494 |
+ __field(struct svc_xprt *, xprt) |
4495 |
+- __field(struct svc_rqst *, rqst) |
4496 |
++ __field_struct(struct sockaddr_storage, ss) |
4497 |
++ __field(int, pid) |
4498 |
++ __field(unsigned long, flags) |
4499 |
+ ), |
4500 |
+ |
4501 |
+ TP_fast_assign( |
4502 |
+ __entry->xprt = xprt; |
4503 |
+- __entry->rqst = rqst; |
4504 |
++ xprt ? memcpy(&__entry->ss, &xprt->xpt_remote, sizeof(__entry->ss)) : memset(&__entry->ss, 0, sizeof(__entry->ss)); |
4505 |
++ __entry->pid = rqst? rqst->rq_task->pid : 0; |
4506 |
++ __entry->flags = xprt ? xprt->xpt_flags : 0; |
4507 |
+ ), |
4508 |
+ |
4509 |
+ TP_printk("xprt=0x%p addr=%pIScp pid=%d flags=%s", __entry->xprt, |
4510 |
+- (struct sockaddr *)&__entry->xprt->xpt_remote, |
4511 |
+- __entry->rqst ? __entry->rqst->rq_task->pid : 0, |
4512 |
+- show_svc_xprt_flags(__entry->xprt->xpt_flags)) |
4513 |
++ (struct sockaddr *)&__entry->ss, |
4514 |
++ __entry->pid, show_svc_xprt_flags(__entry->flags)) |
4515 |
+ ); |
4516 |
+ |
4517 |
+ TRACE_EVENT(svc_xprt_dequeue, |
4518 |
+@@ -589,16 +592,20 @@ TRACE_EVENT(svc_handle_xprt, |
4519 |
+ TP_STRUCT__entry( |
4520 |
+ __field(struct svc_xprt *, xprt) |
4521 |
+ __field(int, len) |
4522 |
++ __field_struct(struct sockaddr_storage, ss) |
4523 |
++ __field(unsigned long, flags) |
4524 |
+ ), |
4525 |
+ |
4526 |
+ TP_fast_assign( |
4527 |
+ __entry->xprt = xprt; |
4528 |
++ xprt ? memcpy(&__entry->ss, &xprt->xpt_remote, sizeof(__entry->ss)) : memset(&__entry->ss, 0, sizeof(__entry->ss)); |
4529 |
+ __entry->len = len; |
4530 |
++ __entry->flags = xprt ? xprt->xpt_flags : 0; |
4531 |
+ ), |
4532 |
+ |
4533 |
+ TP_printk("xprt=0x%p addr=%pIScp len=%d flags=%s", __entry->xprt, |
4534 |
+- (struct sockaddr *)&__entry->xprt->xpt_remote, __entry->len, |
4535 |
+- show_svc_xprt_flags(__entry->xprt->xpt_flags)) |
4536 |
++ (struct sockaddr *)&__entry->ss, |
4537 |
++ __entry->len, show_svc_xprt_flags(__entry->flags)) |
4538 |
+ ); |
4539 |
+ #endif /* _TRACE_SUNRPC_H */ |
4540 |
+ |
4541 |
+diff --git a/kernel/fork.c b/kernel/fork.c |
4542 |
+index dbd9b8d7b7cc..26a70dc7a915 100644 |
4543 |
+--- a/kernel/fork.c |
4544 |
++++ b/kernel/fork.c |
4545 |
+@@ -1871,13 +1871,21 @@ static int check_unshare_flags(unsigned long unshare_flags) |
4546 |
+ CLONE_NEWUSER|CLONE_NEWPID)) |
4547 |
+ return -EINVAL; |
4548 |
+ /* |
4549 |
+- * Not implemented, but pretend it works if there is nothing to |
4550 |
+- * unshare. Note that unsharing CLONE_THREAD or CLONE_SIGHAND |
4551 |
+- * needs to unshare vm. |
4552 |
++ * Not implemented, but pretend it works if there is nothing |
4553 |
++ * to unshare. Note that unsharing the address space or the |
4554 |
++ * signal handlers also need to unshare the signal queues (aka |
4555 |
++ * CLONE_THREAD). |
4556 |
+ */ |
4557 |
+ if (unshare_flags & (CLONE_THREAD | CLONE_SIGHAND | CLONE_VM)) { |
4558 |
+- /* FIXME: get_task_mm() increments ->mm_users */ |
4559 |
+- if (atomic_read(¤t->mm->mm_users) > 1) |
4560 |
++ if (!thread_group_empty(current)) |
4561 |
++ return -EINVAL; |
4562 |
++ } |
4563 |
++ if (unshare_flags & (CLONE_SIGHAND | CLONE_VM)) { |
4564 |
++ if (atomic_read(¤t->sighand->count) > 1) |
4565 |
++ return -EINVAL; |
4566 |
++ } |
4567 |
++ if (unshare_flags & CLONE_VM) { |
4568 |
++ if (!current_is_single_threaded()) |
4569 |
+ return -EINVAL; |
4570 |
+ } |
4571 |
+ |
4572 |
+@@ -1946,16 +1954,16 @@ SYSCALL_DEFINE1(unshare, unsigned long, unshare_flags) |
4573 |
+ if (unshare_flags & CLONE_NEWUSER) |
4574 |
+ unshare_flags |= CLONE_THREAD | CLONE_FS; |
4575 |
+ /* |
4576 |
+- * If unsharing a thread from a thread group, must also unshare vm. |
4577 |
+- */ |
4578 |
+- if (unshare_flags & CLONE_THREAD) |
4579 |
+- unshare_flags |= CLONE_VM; |
4580 |
+- /* |
4581 |
+ * If unsharing vm, must also unshare signal handlers. |
4582 |
+ */ |
4583 |
+ if (unshare_flags & CLONE_VM) |
4584 |
+ unshare_flags |= CLONE_SIGHAND; |
4585 |
+ /* |
4586 |
++ * If unsharing a signal handlers, must also unshare the signal queues. |
4587 |
++ */ |
4588 |
++ if (unshare_flags & CLONE_SIGHAND) |
4589 |
++ unshare_flags |= CLONE_THREAD; |
4590 |
++ /* |
4591 |
+ * If unsharing namespace, must also unshare filesystem information. |
4592 |
+ */ |
4593 |
+ if (unshare_flags & CLONE_NEWNS) |
4594 |
+diff --git a/kernel/workqueue.c b/kernel/workqueue.c |
4595 |
+index 4c4f06176f74..a413acb59a07 100644 |
4596 |
+--- a/kernel/workqueue.c |
4597 |
++++ b/kernel/workqueue.c |
4598 |
+@@ -2614,7 +2614,7 @@ void flush_workqueue(struct workqueue_struct *wq) |
4599 |
+ out_unlock: |
4600 |
+ mutex_unlock(&wq->mutex); |
4601 |
+ } |
4602 |
+-EXPORT_SYMBOL_GPL(flush_workqueue); |
4603 |
++EXPORT_SYMBOL(flush_workqueue); |
4604 |
+ |
4605 |
+ /** |
4606 |
+ * drain_workqueue - drain a workqueue |
4607 |
+diff --git a/lib/decompress_bunzip2.c b/lib/decompress_bunzip2.c |
4608 |
+index 6dd0335ea61b..0234361b24b8 100644 |
4609 |
+--- a/lib/decompress_bunzip2.c |
4610 |
++++ b/lib/decompress_bunzip2.c |
4611 |
+@@ -743,12 +743,12 @@ exit_0: |
4612 |
+ } |
4613 |
+ |
4614 |
+ #ifdef PREBOOT |
4615 |
+-STATIC int INIT decompress(unsigned char *buf, long len, |
4616 |
++STATIC int INIT __decompress(unsigned char *buf, long len, |
4617 |
+ long (*fill)(void*, unsigned long), |
4618 |
+ long (*flush)(void*, unsigned long), |
4619 |
+- unsigned char *outbuf, |
4620 |
++ unsigned char *outbuf, long olen, |
4621 |
+ long *pos, |
4622 |
+- void(*error)(char *x)) |
4623 |
++ void (*error)(char *x)) |
4624 |
+ { |
4625 |
+ return bunzip2(buf, len - 4, fill, flush, outbuf, pos, error); |
4626 |
+ } |
4627 |
+diff --git a/lib/decompress_inflate.c b/lib/decompress_inflate.c |
4628 |
+index d4c7891635ec..555c06bf20da 100644 |
4629 |
+--- a/lib/decompress_inflate.c |
4630 |
++++ b/lib/decompress_inflate.c |
4631 |
+@@ -1,4 +1,5 @@ |
4632 |
+ #ifdef STATIC |
4633 |
++#define PREBOOT |
4634 |
+ /* Pre-boot environment: included */ |
4635 |
+ |
4636 |
+ /* prevent inclusion of _LINUX_KERNEL_H in pre-boot environment: lots |
4637 |
+@@ -33,23 +34,23 @@ static long INIT nofill(void *buffer, unsigned long len) |
4638 |
+ } |
4639 |
+ |
4640 |
+ /* Included from initramfs et al code */ |
4641 |
+-STATIC int INIT gunzip(unsigned char *buf, long len, |
4642 |
++STATIC int INIT __gunzip(unsigned char *buf, long len, |
4643 |
+ long (*fill)(void*, unsigned long), |
4644 |
+ long (*flush)(void*, unsigned long), |
4645 |
+- unsigned char *out_buf, |
4646 |
++ unsigned char *out_buf, long out_len, |
4647 |
+ long *pos, |
4648 |
+ void(*error)(char *x)) { |
4649 |
+ u8 *zbuf; |
4650 |
+ struct z_stream_s *strm; |
4651 |
+ int rc; |
4652 |
+- size_t out_len; |
4653 |
+ |
4654 |
+ rc = -1; |
4655 |
+ if (flush) { |
4656 |
+ out_len = 0x8000; /* 32 K */ |
4657 |
+ out_buf = malloc(out_len); |
4658 |
+ } else { |
4659 |
+- out_len = ((size_t)~0) - (size_t)out_buf; /* no limit */ |
4660 |
++ if (!out_len) |
4661 |
++ out_len = ((size_t)~0) - (size_t)out_buf; /* no limit */ |
4662 |
+ } |
4663 |
+ if (!out_buf) { |
4664 |
+ error("Out of memory while allocating output buffer"); |
4665 |
+@@ -181,4 +182,24 @@ gunzip_nomem1: |
4666 |
+ return rc; /* returns Z_OK (0) if successful */ |
4667 |
+ } |
4668 |
+ |
4669 |
+-#define decompress gunzip |
4670 |
++#ifndef PREBOOT |
4671 |
++STATIC int INIT gunzip(unsigned char *buf, long len, |
4672 |
++ long (*fill)(void*, unsigned long), |
4673 |
++ long (*flush)(void*, unsigned long), |
4674 |
++ unsigned char *out_buf, |
4675 |
++ long *pos, |
4676 |
++ void (*error)(char *x)) |
4677 |
++{ |
4678 |
++ return __gunzip(buf, len, fill, flush, out_buf, 0, pos, error); |
4679 |
++} |
4680 |
++#else |
4681 |
++STATIC int INIT __decompress(unsigned char *buf, long len, |
4682 |
++ long (*fill)(void*, unsigned long), |
4683 |
++ long (*flush)(void*, unsigned long), |
4684 |
++ unsigned char *out_buf, long out_len, |
4685 |
++ long *pos, |
4686 |
++ void (*error)(char *x)) |
4687 |
++{ |
4688 |
++ return __gunzip(buf, len, fill, flush, out_buf, out_len, pos, error); |
4689 |
++} |
4690 |
++#endif |
4691 |
+diff --git a/lib/decompress_unlz4.c b/lib/decompress_unlz4.c |
4692 |
+index 40f66ebe57b7..036fc882cd72 100644 |
4693 |
+--- a/lib/decompress_unlz4.c |
4694 |
++++ b/lib/decompress_unlz4.c |
4695 |
+@@ -196,12 +196,12 @@ exit_0: |
4696 |
+ } |
4697 |
+ |
4698 |
+ #ifdef PREBOOT |
4699 |
+-STATIC int INIT decompress(unsigned char *buf, long in_len, |
4700 |
++STATIC int INIT __decompress(unsigned char *buf, long in_len, |
4701 |
+ long (*fill)(void*, unsigned long), |
4702 |
+ long (*flush)(void*, unsigned long), |
4703 |
+- unsigned char *output, |
4704 |
++ unsigned char *output, long out_len, |
4705 |
+ long *posp, |
4706 |
+- void(*error)(char *x) |
4707 |
++ void (*error)(char *x) |
4708 |
+ ) |
4709 |
+ { |
4710 |
+ return unlz4(buf, in_len - 4, fill, flush, output, posp, error); |
4711 |
+diff --git a/lib/decompress_unlzma.c b/lib/decompress_unlzma.c |
4712 |
+index 0be83af62b88..decb64629c14 100644 |
4713 |
+--- a/lib/decompress_unlzma.c |
4714 |
++++ b/lib/decompress_unlzma.c |
4715 |
+@@ -667,13 +667,12 @@ exit_0: |
4716 |
+ } |
4717 |
+ |
4718 |
+ #ifdef PREBOOT |
4719 |
+-STATIC int INIT decompress(unsigned char *buf, long in_len, |
4720 |
++STATIC int INIT __decompress(unsigned char *buf, long in_len, |
4721 |
+ long (*fill)(void*, unsigned long), |
4722 |
+ long (*flush)(void*, unsigned long), |
4723 |
+- unsigned char *output, |
4724 |
++ unsigned char *output, long out_len, |
4725 |
+ long *posp, |
4726 |
+- void(*error)(char *x) |
4727 |
+- ) |
4728 |
++ void (*error)(char *x)) |
4729 |
+ { |
4730 |
+ return unlzma(buf, in_len - 4, fill, flush, output, posp, error); |
4731 |
+ } |
4732 |
+diff --git a/lib/decompress_unlzo.c b/lib/decompress_unlzo.c |
4733 |
+index b94a31bdd87d..f4c158e3a022 100644 |
4734 |
+--- a/lib/decompress_unlzo.c |
4735 |
++++ b/lib/decompress_unlzo.c |
4736 |
+@@ -31,6 +31,7 @@ |
4737 |
+ */ |
4738 |
+ |
4739 |
+ #ifdef STATIC |
4740 |
++#define PREBOOT |
4741 |
+ #include "lzo/lzo1x_decompress_safe.c" |
4742 |
+ #else |
4743 |
+ #include <linux/decompress/unlzo.h> |
4744 |
+@@ -287,4 +288,14 @@ exit: |
4745 |
+ return ret; |
4746 |
+ } |
4747 |
+ |
4748 |
+-#define decompress unlzo |
4749 |
++#ifdef PREBOOT |
4750 |
++STATIC int INIT __decompress(unsigned char *buf, long len, |
4751 |
++ long (*fill)(void*, unsigned long), |
4752 |
++ long (*flush)(void*, unsigned long), |
4753 |
++ unsigned char *out_buf, long olen, |
4754 |
++ long *pos, |
4755 |
++ void (*error)(char *x)) |
4756 |
++{ |
4757 |
++ return unlzo(buf, len, fill, flush, out_buf, pos, error); |
4758 |
++} |
4759 |
++#endif |
4760 |
+diff --git a/lib/decompress_unxz.c b/lib/decompress_unxz.c |
4761 |
+index b07a78340e9d..25d59a95bd66 100644 |
4762 |
+--- a/lib/decompress_unxz.c |
4763 |
++++ b/lib/decompress_unxz.c |
4764 |
+@@ -394,4 +394,14 @@ error_alloc_state: |
4765 |
+ * This macro is used by architecture-specific files to decompress |
4766 |
+ * the kernel image. |
4767 |
+ */ |
4768 |
+-#define decompress unxz |
4769 |
++#ifdef XZ_PREBOOT |
4770 |
++STATIC int INIT __decompress(unsigned char *buf, long len, |
4771 |
++ long (*fill)(void*, unsigned long), |
4772 |
++ long (*flush)(void*, unsigned long), |
4773 |
++ unsigned char *out_buf, long olen, |
4774 |
++ long *pos, |
4775 |
++ void (*error)(char *x)) |
4776 |
++{ |
4777 |
++ return unxz(buf, len, fill, flush, out_buf, pos, error); |
4778 |
++} |
4779 |
++#endif |
4780 |
+diff --git a/mm/vmscan.c b/mm/vmscan.c |
4781 |
+index 8286938c70de..26c86e2fb5af 100644 |
4782 |
+--- a/mm/vmscan.c |
4783 |
++++ b/mm/vmscan.c |
4784 |
+@@ -1190,7 +1190,7 @@ cull_mlocked: |
4785 |
+ if (PageSwapCache(page)) |
4786 |
+ try_to_free_swap(page); |
4787 |
+ unlock_page(page); |
4788 |
+- putback_lru_page(page); |
4789 |
++ list_add(&page->lru, &ret_pages); |
4790 |
+ continue; |
4791 |
+ |
4792 |
+ activate_locked: |
4793 |
+diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c |
4794 |
+index b8233505bf9f..8f1df6793650 100644 |
4795 |
+--- a/net/mac80211/tx.c |
4796 |
++++ b/net/mac80211/tx.c |
4797 |
+@@ -311,9 +311,6 @@ ieee80211_tx_h_check_assoc(struct ieee80211_tx_data *tx) |
4798 |
+ if (tx->sdata->vif.type == NL80211_IFTYPE_WDS) |
4799 |
+ return TX_CONTINUE; |
4800 |
+ |
4801 |
+- if (tx->sdata->vif.type == NL80211_IFTYPE_MESH_POINT) |
4802 |
+- return TX_CONTINUE; |
4803 |
+- |
4804 |
+ if (tx->flags & IEEE80211_TX_PS_BUFFERED) |
4805 |
+ return TX_CONTINUE; |
4806 |
+ |
4807 |
+diff --git a/net/nfc/nci/hci.c b/net/nfc/nci/hci.c |
4808 |
+index af002df640c7..609f92283d1b 100644 |
4809 |
+--- a/net/nfc/nci/hci.c |
4810 |
++++ b/net/nfc/nci/hci.c |
4811 |
+@@ -233,7 +233,7 @@ int nci_hci_send_cmd(struct nci_dev *ndev, u8 gate, u8 cmd, |
4812 |
+ r = nci_request(ndev, nci_hci_send_data_req, (unsigned long)&data, |
4813 |
+ msecs_to_jiffies(NCI_DATA_TIMEOUT)); |
4814 |
+ |
4815 |
+- if (r == NCI_STATUS_OK) |
4816 |
++ if (r == NCI_STATUS_OK && skb) |
4817 |
+ *skb = conn_info->rx_skb; |
4818 |
+ |
4819 |
+ return r; |
4820 |
+diff --git a/net/nfc/netlink.c b/net/nfc/netlink.c |
4821 |
+index f85f37ed19b2..73d1ca7c546c 100644 |
4822 |
+--- a/net/nfc/netlink.c |
4823 |
++++ b/net/nfc/netlink.c |
4824 |
+@@ -1518,12 +1518,13 @@ static int nfc_genl_vendor_cmd(struct sk_buff *skb, |
4825 |
+ if (!dev || !dev->vendor_cmds || !dev->n_vendor_cmds) |
4826 |
+ return -ENODEV; |
4827 |
+ |
4828 |
+- data = nla_data(info->attrs[NFC_ATTR_VENDOR_DATA]); |
4829 |
+- if (data) { |
4830 |
++ if (info->attrs[NFC_ATTR_VENDOR_DATA]) { |
4831 |
++ data = nla_data(info->attrs[NFC_ATTR_VENDOR_DATA]); |
4832 |
+ data_len = nla_len(info->attrs[NFC_ATTR_VENDOR_DATA]); |
4833 |
+ if (data_len == 0) |
4834 |
+ return -EINVAL; |
4835 |
+ } else { |
4836 |
++ data = NULL; |
4837 |
+ data_len = 0; |
4838 |
+ } |
4839 |
+ |
4840 |
+diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c |
4841 |
+index ab5dd621ae0c..2e98f4a243e5 100644 |
4842 |
+--- a/net/sunrpc/xprt.c |
4843 |
++++ b/net/sunrpc/xprt.c |
4844 |
+@@ -614,6 +614,7 @@ static void xprt_autoclose(struct work_struct *work) |
4845 |
+ clear_bit(XPRT_CLOSE_WAIT, &xprt->state); |
4846 |
+ xprt->ops->close(xprt); |
4847 |
+ xprt_release_write(xprt, NULL); |
4848 |
++ wake_up_bit(&xprt->state, XPRT_LOCKED); |
4849 |
+ } |
4850 |
+ |
4851 |
+ /** |
4852 |
+@@ -723,6 +724,7 @@ void xprt_unlock_connect(struct rpc_xprt *xprt, void *cookie) |
4853 |
+ xprt->ops->release_xprt(xprt, NULL); |
4854 |
+ out: |
4855 |
+ spin_unlock_bh(&xprt->transport_lock); |
4856 |
++ wake_up_bit(&xprt->state, XPRT_LOCKED); |
4857 |
+ } |
4858 |
+ |
4859 |
+ /** |
4860 |
+@@ -1394,6 +1396,10 @@ out: |
4861 |
+ static void xprt_destroy(struct rpc_xprt *xprt) |
4862 |
+ { |
4863 |
+ dprintk("RPC: destroying transport %p\n", xprt); |
4864 |
++ |
4865 |
++ /* Exclude transport connect/disconnect handlers */ |
4866 |
++ wait_on_bit_lock(&xprt->state, XPRT_LOCKED, TASK_UNINTERRUPTIBLE); |
4867 |
++ |
4868 |
+ del_timer_sync(&xprt->timer); |
4869 |
+ |
4870 |
+ rpc_xprt_debugfs_unregister(xprt); |
4871 |
+diff --git a/net/sunrpc/xprtrdma/svc_rdma_transport.c b/net/sunrpc/xprtrdma/svc_rdma_transport.c |
4872 |
+index 6b36279e4288..48f6de912f78 100644 |
4873 |
+--- a/net/sunrpc/xprtrdma/svc_rdma_transport.c |
4874 |
++++ b/net/sunrpc/xprtrdma/svc_rdma_transport.c |
4875 |
+@@ -91,7 +91,7 @@ struct svc_xprt_class svc_rdma_class = { |
4876 |
+ .xcl_name = "rdma", |
4877 |
+ .xcl_owner = THIS_MODULE, |
4878 |
+ .xcl_ops = &svc_rdma_ops, |
4879 |
+- .xcl_max_payload = RPCRDMA_MAXPAYLOAD, |
4880 |
++ .xcl_max_payload = RPCSVC_MAXPAYLOAD_RDMA, |
4881 |
+ .xcl_ident = XPRT_TRANSPORT_RDMA, |
4882 |
+ }; |
4883 |
+ |
4884 |
+diff --git a/net/sunrpc/xprtrdma/xprt_rdma.h b/net/sunrpc/xprtrdma/xprt_rdma.h |
4885 |
+index f49dd8b38122..e718d0959af3 100644 |
4886 |
+--- a/net/sunrpc/xprtrdma/xprt_rdma.h |
4887 |
++++ b/net/sunrpc/xprtrdma/xprt_rdma.h |
4888 |
+@@ -51,7 +51,6 @@ |
4889 |
+ #include <linux/sunrpc/clnt.h> /* rpc_xprt */ |
4890 |
+ #include <linux/sunrpc/rpc_rdma.h> /* RPC/RDMA protocol */ |
4891 |
+ #include <linux/sunrpc/xprtrdma.h> /* xprt parameters */ |
4892 |
+-#include <linux/sunrpc/svc.h> /* RPCSVC_MAXPAYLOAD */ |
4893 |
+ |
4894 |
+ #define RDMA_RESOLVE_TIMEOUT (5000) /* 5 seconds */ |
4895 |
+ #define RDMA_CONNECT_RETRY_MAX (2) /* retries if no listener backlog */ |
4896 |
+diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c |
4897 |
+index 0030376327b7..8a39b1e48bc4 100644 |
4898 |
+--- a/net/sunrpc/xprtsock.c |
4899 |
++++ b/net/sunrpc/xprtsock.c |
4900 |
+@@ -829,6 +829,7 @@ static void xs_reset_transport(struct sock_xprt *transport) |
4901 |
+ sk->sk_user_data = NULL; |
4902 |
+ |
4903 |
+ xs_restore_old_callbacks(transport, sk); |
4904 |
++ xprt_clear_connected(xprt); |
4905 |
+ write_unlock_bh(&sk->sk_callback_lock); |
4906 |
+ xs_sock_reset_connection_flags(xprt); |
4907 |
+ |
4908 |
+@@ -1432,6 +1433,7 @@ out: |
4909 |
+ static void xs_tcp_state_change(struct sock *sk) |
4910 |
+ { |
4911 |
+ struct rpc_xprt *xprt; |
4912 |
++ struct sock_xprt *transport; |
4913 |
+ |
4914 |
+ read_lock_bh(&sk->sk_callback_lock); |
4915 |
+ if (!(xprt = xprt_from_sock(sk))) |
4916 |
+@@ -1443,13 +1445,12 @@ static void xs_tcp_state_change(struct sock *sk) |
4917 |
+ sock_flag(sk, SOCK_ZAPPED), |
4918 |
+ sk->sk_shutdown); |
4919 |
+ |
4920 |
++ transport = container_of(xprt, struct sock_xprt, xprt); |
4921 |
+ trace_rpc_socket_state_change(xprt, sk->sk_socket); |
4922 |
+ switch (sk->sk_state) { |
4923 |
+ case TCP_ESTABLISHED: |
4924 |
+ spin_lock(&xprt->transport_lock); |
4925 |
+ if (!xprt_test_and_set_connected(xprt)) { |
4926 |
+- struct sock_xprt *transport = container_of(xprt, |
4927 |
+- struct sock_xprt, xprt); |
4928 |
+ |
4929 |
+ /* Reset TCP record info */ |
4930 |
+ transport->tcp_offset = 0; |
4931 |
+@@ -1458,6 +1459,8 @@ static void xs_tcp_state_change(struct sock *sk) |
4932 |
+ transport->tcp_flags = |
4933 |
+ TCP_RCV_COPY_FRAGHDR | TCP_RCV_COPY_XID; |
4934 |
+ xprt->connect_cookie++; |
4935 |
++ clear_bit(XPRT_SOCK_CONNECTING, &transport->sock_state); |
4936 |
++ xprt_clear_connecting(xprt); |
4937 |
+ |
4938 |
+ xprt_wake_pending_tasks(xprt, -EAGAIN); |
4939 |
+ } |
4940 |
+@@ -1493,6 +1496,9 @@ static void xs_tcp_state_change(struct sock *sk) |
4941 |
+ smp_mb__after_atomic(); |
4942 |
+ break; |
4943 |
+ case TCP_CLOSE: |
4944 |
++ if (test_and_clear_bit(XPRT_SOCK_CONNECTING, |
4945 |
++ &transport->sock_state)) |
4946 |
++ xprt_clear_connecting(xprt); |
4947 |
+ xs_sock_mark_closed(xprt); |
4948 |
+ } |
4949 |
+ out: |
4950 |
+@@ -2176,6 +2182,7 @@ static int xs_tcp_finish_connecting(struct rpc_xprt *xprt, struct socket *sock) |
4951 |
+ /* Tell the socket layer to start connecting... */ |
4952 |
+ xprt->stat.connect_count++; |
4953 |
+ xprt->stat.connect_start = jiffies; |
4954 |
++ set_bit(XPRT_SOCK_CONNECTING, &transport->sock_state); |
4955 |
+ ret = kernel_connect(sock, xs_addr(xprt), xprt->addrlen, O_NONBLOCK); |
4956 |
+ switch (ret) { |
4957 |
+ case 0: |
4958 |
+@@ -2237,7 +2244,6 @@ static void xs_tcp_setup_socket(struct work_struct *work) |
4959 |
+ case -EINPROGRESS: |
4960 |
+ case -EALREADY: |
4961 |
+ xprt_unlock_connect(xprt, transport); |
4962 |
+- xprt_clear_connecting(xprt); |
4963 |
+ return; |
4964 |
+ case -EINVAL: |
4965 |
+ /* Happens, for instance, if the user specified a link |
4966 |
+@@ -2279,13 +2285,14 @@ static void xs_connect(struct rpc_xprt *xprt, struct rpc_task *task) |
4967 |
+ |
4968 |
+ WARN_ON_ONCE(!xprt_lock_connect(xprt, task, transport)); |
4969 |
+ |
4970 |
+- /* Start by resetting any existing state */ |
4971 |
+- xs_reset_transport(transport); |
4972 |
+- |
4973 |
+- if (transport->sock != NULL && !RPC_IS_SOFTCONN(task)) { |
4974 |
++ if (transport->sock != NULL) { |
4975 |
+ dprintk("RPC: xs_connect delayed xprt %p for %lu " |
4976 |
+ "seconds\n", |
4977 |
+ xprt, xprt->reestablish_timeout / HZ); |
4978 |
++ |
4979 |
++ /* Start by resetting any existing state */ |
4980 |
++ xs_reset_transport(transport); |
4981 |
++ |
4982 |
+ queue_delayed_work(rpciod_workqueue, |
4983 |
+ &transport->connect_worker, |
4984 |
+ xprt->reestablish_timeout); |
4985 |
+diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c |
4986 |
+index 374ea53288ca..c8f01ccc2513 100644 |
4987 |
+--- a/sound/pci/hda/patch_realtek.c |
4988 |
++++ b/sound/pci/hda/patch_realtek.c |
4989 |
+@@ -1135,7 +1135,7 @@ static const struct hda_fixup alc880_fixups[] = { |
4990 |
+ /* override all pins as BIOS on old Amilo is broken */ |
4991 |
+ .type = HDA_FIXUP_PINS, |
4992 |
+ .v.pins = (const struct hda_pintbl[]) { |
4993 |
+- { 0x14, 0x0121411f }, /* HP */ |
4994 |
++ { 0x14, 0x0121401f }, /* HP */ |
4995 |
+ { 0x15, 0x99030120 }, /* speaker */ |
4996 |
+ { 0x16, 0x99030130 }, /* bass speaker */ |
4997 |
+ { 0x17, 0x411111f0 }, /* N/A */ |
4998 |
+@@ -1155,7 +1155,7 @@ static const struct hda_fixup alc880_fixups[] = { |
4999 |
+ /* almost compatible with FUJITSU, but no bass and SPDIF */ |
5000 |
+ .type = HDA_FIXUP_PINS, |
5001 |
+ .v.pins = (const struct hda_pintbl[]) { |
5002 |
+- { 0x14, 0x0121411f }, /* HP */ |
5003 |
++ { 0x14, 0x0121401f }, /* HP */ |
5004 |
+ { 0x15, 0x99030120 }, /* speaker */ |
5005 |
+ { 0x16, 0x411111f0 }, /* N/A */ |
5006 |
+ { 0x17, 0x411111f0 }, /* N/A */ |
5007 |
+@@ -1364,7 +1364,7 @@ static const struct snd_pci_quirk alc880_fixup_tbl[] = { |
5008 |
+ SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_FIXUP_W810), |
5009 |
+ SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_FIXUP_MEDION_RIM), |
5010 |
+ SND_PCI_QUIRK(0x1631, 0xe011, "PB 13201056", ALC880_FIXUP_6ST_AUTOMUTE), |
5011 |
+- SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_FIXUP_F1734), |
5012 |
++ SND_PCI_QUIRK(0x1734, 0x107c, "FSC Amilo M1437", ALC880_FIXUP_FUJITSU), |
5013 |
+ SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FIXUP_FUJITSU), |
5014 |
+ SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_FIXUP_F1734), |
5015 |
+ SND_PCI_QUIRK(0x1734, 0x10b0, "FSC Amilo Pi1556", ALC880_FIXUP_FUJITSU), |
5016 |
+@@ -5189,8 +5189,11 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { |
5017 |
+ SND_PCI_QUIRK(0x1028, 0x06c7, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE), |
5018 |
+ SND_PCI_QUIRK(0x1028, 0x06d9, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), |
5019 |
+ SND_PCI_QUIRK(0x1028, 0x06da, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), |
5020 |
+- SND_PCI_QUIRK(0x1028, 0x06de, "Dell", ALC292_FIXUP_DISABLE_AAMIX), |
5021 |
+ SND_PCI_QUIRK(0x1028, 0x06db, "Dell", ALC292_FIXUP_DISABLE_AAMIX), |
5022 |
++ SND_PCI_QUIRK(0x1028, 0x06dd, "Dell", ALC292_FIXUP_DISABLE_AAMIX), |
5023 |
++ SND_PCI_QUIRK(0x1028, 0x06de, "Dell", ALC292_FIXUP_DISABLE_AAMIX), |
5024 |
++ SND_PCI_QUIRK(0x1028, 0x06df, "Dell", ALC292_FIXUP_DISABLE_AAMIX), |
5025 |
++ SND_PCI_QUIRK(0x1028, 0x06e0, "Dell", ALC292_FIXUP_DISABLE_AAMIX), |
5026 |
+ SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), |
5027 |
+ SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), |
5028 |
+ SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2), |
5029 |
+@@ -6579,6 +6582,7 @@ static const struct snd_pci_quirk alc662_fixup_tbl[] = { |
5030 |
+ SND_PCI_QUIRK(0x1028, 0x05db, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE), |
5031 |
+ SND_PCI_QUIRK(0x1028, 0x05fe, "Dell XPS 15", ALC668_FIXUP_DELL_XPS13), |
5032 |
+ SND_PCI_QUIRK(0x1028, 0x060a, "Dell XPS 13", ALC668_FIXUP_DELL_XPS13), |
5033 |
++ SND_PCI_QUIRK(0x1028, 0x060d, "Dell M3800", ALC668_FIXUP_DELL_XPS13), |
5034 |
+ SND_PCI_QUIRK(0x1028, 0x0625, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE), |
5035 |
+ SND_PCI_QUIRK(0x1028, 0x0626, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE), |
5036 |
+ SND_PCI_QUIRK(0x1028, 0x0696, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE), |
5037 |
+diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c |
5038 |
+index 6b3acba5da7a..83d6e76435b4 100644 |
5039 |
+--- a/sound/usb/mixer.c |
5040 |
++++ b/sound/usb/mixer.c |
5041 |
+@@ -2522,7 +2522,7 @@ static int restore_mixer_value(struct usb_mixer_elem_list *list) |
5042 |
+ for (c = 0; c < MAX_CHANNELS; c++) { |
5043 |
+ if (!(cval->cmask & (1 << c))) |
5044 |
+ continue; |
5045 |
+- if (cval->cached & (1 << c)) { |
5046 |
++ if (cval->cached & (1 << (c + 1))) { |
5047 |
+ err = snd_usb_set_cur_mix_value(cval, c + 1, idx, |
5048 |
+ cval->cache_val[idx]); |
5049 |
+ if (err < 0) |