Annotation of /trunk/kernel-alx/patches-4.9/0210-4.9.111-all-fixes.patch
Parent Directory | Revision Log
Revision 3187 -
(hide annotations)
(download)
Wed Aug 8 14:17:38 2018 UTC (6 years, 1 month ago) by niro
File size: 103520 byte(s)
Wed Aug 8 14:17:38 2018 UTC (6 years, 1 month ago) by niro
File size: 103520 byte(s)
-linux-4.9.111
1 | niro | 3187 | diff --git a/Documentation/printk-formats.txt b/Documentation/printk-formats.txt |
2 | index 5962949944fd..d2fbeeb29582 100644 | ||
3 | --- a/Documentation/printk-formats.txt | ||
4 | +++ b/Documentation/printk-formats.txt | ||
5 | @@ -279,11 +279,10 @@ struct clk: | ||
6 | |||
7 | %pC pll1 | ||
8 | %pCn pll1 | ||
9 | - %pCr 1560000000 | ||
10 | |||
11 | For printing struct clk structures. '%pC' and '%pCn' print the name | ||
12 | (Common Clock Framework) or address (legacy clock framework) of the | ||
13 | - structure; '%pCr' prints the current clock rate. | ||
14 | + structure. | ||
15 | |||
16 | Passed by reference. | ||
17 | |||
18 | diff --git a/Makefile b/Makefile | ||
19 | index 2fcfe1147eaa..b10646531fcd 100644 | ||
20 | --- a/Makefile | ||
21 | +++ b/Makefile | ||
22 | @@ -1,6 +1,6 @@ | ||
23 | VERSION = 4 | ||
24 | PATCHLEVEL = 9 | ||
25 | -SUBLEVEL = 110 | ||
26 | +SUBLEVEL = 111 | ||
27 | EXTRAVERSION = | ||
28 | NAME = Roaring Lionus | ||
29 | |||
30 | diff --git a/arch/arm/include/asm/kgdb.h b/arch/arm/include/asm/kgdb.h | ||
31 | index 0a9d5dd93294..6949c7d4481c 100644 | ||
32 | --- a/arch/arm/include/asm/kgdb.h | ||
33 | +++ b/arch/arm/include/asm/kgdb.h | ||
34 | @@ -76,7 +76,7 @@ extern int kgdb_fault_expected; | ||
35 | |||
36 | #define KGDB_MAX_NO_CPUS 1 | ||
37 | #define BUFMAX 400 | ||
38 | -#define NUMREGBYTES (DBG_MAX_REG_NUM << 2) | ||
39 | +#define NUMREGBYTES (GDB_MAX_REGS << 2) | ||
40 | #define NUMCRITREGBYTES (32 << 2) | ||
41 | |||
42 | #define _R0 0 | ||
43 | diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c | ||
44 | index 7959d2c92010..625c2b240ffb 100644 | ||
45 | --- a/arch/arm64/kernel/cpufeature.c | ||
46 | +++ b/arch/arm64/kernel/cpufeature.c | ||
47 | @@ -826,7 +826,7 @@ static int __init parse_kpti(char *str) | ||
48 | __kpti_forced = enabled ? 1 : -1; | ||
49 | return 0; | ||
50 | } | ||
51 | -__setup("kpti=", parse_kpti); | ||
52 | +early_param("kpti", parse_kpti); | ||
53 | #endif /* CONFIG_UNMAP_KERNEL_AT_EL0 */ | ||
54 | |||
55 | static const struct arm64_cpu_capabilities arm64_features[] = { | ||
56 | diff --git a/arch/arm64/mm/proc.S b/arch/arm64/mm/proc.S | ||
57 | index 66cce2138f95..18d96d349a8b 100644 | ||
58 | --- a/arch/arm64/mm/proc.S | ||
59 | +++ b/arch/arm64/mm/proc.S | ||
60 | @@ -186,8 +186,9 @@ ENDPROC(idmap_cpu_replace_ttbr1) | ||
61 | |||
62 | .macro __idmap_kpti_put_pgtable_ent_ng, type | ||
63 | orr \type, \type, #PTE_NG // Same bit for blocks and pages | ||
64 | - str \type, [cur_\()\type\()p] // Update the entry and ensure it | ||
65 | - dc civac, cur_\()\type\()p // is visible to all CPUs. | ||
66 | + str \type, [cur_\()\type\()p] // Update the entry and ensure | ||
67 | + dmb sy // that it is visible to all | ||
68 | + dc civac, cur_\()\type\()p // CPUs. | ||
69 | .endm | ||
70 | |||
71 | /* | ||
72 | diff --git a/arch/m68k/mm/kmap.c b/arch/m68k/mm/kmap.c | ||
73 | index 6e4955bc542b..fcd52cefee29 100644 | ||
74 | --- a/arch/m68k/mm/kmap.c | ||
75 | +++ b/arch/m68k/mm/kmap.c | ||
76 | @@ -88,7 +88,8 @@ static inline void free_io_area(void *addr) | ||
77 | for (p = &iolist ; (tmp = *p) ; p = &tmp->next) { | ||
78 | if (tmp->addr == addr) { | ||
79 | *p = tmp->next; | ||
80 | - __iounmap(tmp->addr, tmp->size); | ||
81 | + /* remove gap added in get_io_area() */ | ||
82 | + __iounmap(tmp->addr, tmp->size - IO_SIZE); | ||
83 | kfree(tmp); | ||
84 | return; | ||
85 | } | ||
86 | diff --git a/arch/mips/bcm47xx/setup.c b/arch/mips/bcm47xx/setup.c | ||
87 | index 6054d49e608e..8c9cbf13d32a 100644 | ||
88 | --- a/arch/mips/bcm47xx/setup.c | ||
89 | +++ b/arch/mips/bcm47xx/setup.c | ||
90 | @@ -212,6 +212,12 @@ static int __init bcm47xx_cpu_fixes(void) | ||
91 | */ | ||
92 | if (bcm47xx_bus.bcma.bus.chipinfo.id == BCMA_CHIP_ID_BCM4706) | ||
93 | cpu_wait = NULL; | ||
94 | + | ||
95 | + /* | ||
96 | + * BCM47XX Erratum "R10: PCIe Transactions Periodically Fail" | ||
97 | + * Enable ExternalSync for sync instruction to take effect | ||
98 | + */ | ||
99 | + set_c0_config7(MIPS_CONF7_ES); | ||
100 | break; | ||
101 | #endif | ||
102 | } | ||
103 | diff --git a/arch/mips/include/asm/io.h b/arch/mips/include/asm/io.h | ||
104 | index ecabc00c1e66..853b2f4954fa 100644 | ||
105 | --- a/arch/mips/include/asm/io.h | ||
106 | +++ b/arch/mips/include/asm/io.h | ||
107 | @@ -412,6 +412,8 @@ static inline type pfx##in##bwlq##p(unsigned long port) \ | ||
108 | __val = *__addr; \ | ||
109 | slow; \ | ||
110 | \ | ||
111 | + /* prevent prefetching of coherent DMA data prematurely */ \ | ||
112 | + rmb(); \ | ||
113 | return pfx##ioswab##bwlq(__addr, __val); \ | ||
114 | } | ||
115 | |||
116 | diff --git a/arch/mips/include/asm/mipsregs.h b/arch/mips/include/asm/mipsregs.h | ||
117 | index df78b2ca70eb..22a6782f84f5 100644 | ||
118 | --- a/arch/mips/include/asm/mipsregs.h | ||
119 | +++ b/arch/mips/include/asm/mipsregs.h | ||
120 | @@ -663,6 +663,8 @@ | ||
121 | #define MIPS_CONF7_WII (_ULCAST_(1) << 31) | ||
122 | |||
123 | #define MIPS_CONF7_RPS (_ULCAST_(1) << 2) | ||
124 | +/* ExternalSync */ | ||
125 | +#define MIPS_CONF7_ES (_ULCAST_(1) << 8) | ||
126 | |||
127 | #define MIPS_CONF7_IAR (_ULCAST_(1) << 10) | ||
128 | #define MIPS_CONF7_AR (_ULCAST_(1) << 16) | ||
129 | @@ -2641,6 +2643,7 @@ __BUILD_SET_C0(status) | ||
130 | __BUILD_SET_C0(cause) | ||
131 | __BUILD_SET_C0(config) | ||
132 | __BUILD_SET_C0(config5) | ||
133 | +__BUILD_SET_C0(config7) | ||
134 | __BUILD_SET_C0(intcontrol) | ||
135 | __BUILD_SET_C0(intctl) | ||
136 | __BUILD_SET_C0(srsmap) | ||
137 | diff --git a/arch/mips/kernel/mcount.S b/arch/mips/kernel/mcount.S | ||
138 | index 2f7c734771f4..0df911e772ae 100644 | ||
139 | --- a/arch/mips/kernel/mcount.S | ||
140 | +++ b/arch/mips/kernel/mcount.S | ||
141 | @@ -116,10 +116,20 @@ ftrace_stub: | ||
142 | NESTED(_mcount, PT_SIZE, ra) | ||
143 | PTR_LA t1, ftrace_stub | ||
144 | PTR_L t2, ftrace_trace_function /* Prepare t2 for (1) */ | ||
145 | - bne t1, t2, static_trace | ||
146 | + beq t1, t2, fgraph_trace | ||
147 | nop | ||
148 | |||
149 | + MCOUNT_SAVE_REGS | ||
150 | + | ||
151 | + move a0, ra /* arg1: self return address */ | ||
152 | + jalr t2 /* (1) call *ftrace_trace_function */ | ||
153 | + move a1, AT /* arg2: parent's return address */ | ||
154 | + | ||
155 | + MCOUNT_RESTORE_REGS | ||
156 | + | ||
157 | +fgraph_trace: | ||
158 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER | ||
159 | + PTR_LA t1, ftrace_stub | ||
160 | PTR_L t3, ftrace_graph_return | ||
161 | bne t1, t3, ftrace_graph_caller | ||
162 | nop | ||
163 | @@ -128,24 +138,11 @@ NESTED(_mcount, PT_SIZE, ra) | ||
164 | bne t1, t3, ftrace_graph_caller | ||
165 | nop | ||
166 | #endif | ||
167 | - b ftrace_stub | ||
168 | -#ifdef CONFIG_32BIT | ||
169 | - addiu sp, sp, 8 | ||
170 | -#else | ||
171 | - nop | ||
172 | -#endif | ||
173 | |||
174 | -static_trace: | ||
175 | - MCOUNT_SAVE_REGS | ||
176 | - | ||
177 | - move a0, ra /* arg1: self return address */ | ||
178 | - jalr t2 /* (1) call *ftrace_trace_function */ | ||
179 | - move a1, AT /* arg2: parent's return address */ | ||
180 | - | ||
181 | - MCOUNT_RESTORE_REGS | ||
182 | #ifdef CONFIG_32BIT | ||
183 | addiu sp, sp, 8 | ||
184 | #endif | ||
185 | + | ||
186 | .globl ftrace_stub | ||
187 | ftrace_stub: | ||
188 | RETURN_BACK | ||
189 | diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S | ||
190 | index 2dc52e6d2af4..e24ae0fa80ed 100644 | ||
191 | --- a/arch/powerpc/kernel/entry_64.S | ||
192 | +++ b/arch/powerpc/kernel/entry_64.S | ||
193 | @@ -586,6 +586,7 @@ END_MMU_FTR_SECTION_IFSET(MMU_FTR_1T_SEGMENT) | ||
194 | * actually hit this code path. | ||
195 | */ | ||
196 | |||
197 | + isync | ||
198 | slbie r6 | ||
199 | slbie r6 /* Workaround POWER5 < DD2.1 issue */ | ||
200 | slbmte r7,r0 | ||
201 | diff --git a/arch/powerpc/kernel/fadump.c b/arch/powerpc/kernel/fadump.c | ||
202 | index 8f0c7c5d93f2..93a6eeba3ace 100644 | ||
203 | --- a/arch/powerpc/kernel/fadump.c | ||
204 | +++ b/arch/powerpc/kernel/fadump.c | ||
205 | @@ -1033,6 +1033,9 @@ void fadump_cleanup(void) | ||
206 | init_fadump_mem_struct(&fdm, | ||
207 | be64_to_cpu(fdm_active->cpu_state_data.destination_address)); | ||
208 | fadump_invalidate_dump(&fdm); | ||
209 | + } else if (fw_dump.dump_registered) { | ||
210 | + /* Un-register Firmware-assisted dump if it was registered. */ | ||
211 | + fadump_unregister_dump(&fdm); | ||
212 | } | ||
213 | } | ||
214 | |||
215 | diff --git a/arch/powerpc/kernel/hw_breakpoint.c b/arch/powerpc/kernel/hw_breakpoint.c | ||
216 | index 469d86d1c2a5..532c585ec24b 100644 | ||
217 | --- a/arch/powerpc/kernel/hw_breakpoint.c | ||
218 | +++ b/arch/powerpc/kernel/hw_breakpoint.c | ||
219 | @@ -175,8 +175,8 @@ int arch_validate_hwbkpt_settings(struct perf_event *bp) | ||
220 | if (cpu_has_feature(CPU_FTR_DAWR)) { | ||
221 | length_max = 512 ; /* 64 doublewords */ | ||
222 | /* DAWR region can't cross 512 boundary */ | ||
223 | - if ((bp->attr.bp_addr >> 10) != | ||
224 | - ((bp->attr.bp_addr + bp->attr.bp_len - 1) >> 10)) | ||
225 | + if ((bp->attr.bp_addr >> 9) != | ||
226 | + ((bp->attr.bp_addr + bp->attr.bp_len - 1) >> 9)) | ||
227 | return -EINVAL; | ||
228 | } | ||
229 | if (info->len > | ||
230 | diff --git a/arch/powerpc/kernel/ptrace.c b/arch/powerpc/kernel/ptrace.c | ||
231 | index d97370866a5f..adfa63e7df8c 100644 | ||
232 | --- a/arch/powerpc/kernel/ptrace.c | ||
233 | +++ b/arch/powerpc/kernel/ptrace.c | ||
234 | @@ -2380,6 +2380,7 @@ static int ptrace_set_debugreg(struct task_struct *task, unsigned long addr, | ||
235 | /* Create a new breakpoint request if one doesn't exist already */ | ||
236 | hw_breakpoint_init(&attr); | ||
237 | attr.bp_addr = hw_brk.address; | ||
238 | + attr.bp_len = 8; | ||
239 | arch_bp_generic_fields(hw_brk.type, | ||
240 | &attr.bp_type); | ||
241 | |||
242 | diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c | ||
243 | index f602307a4386..9ed90c502005 100644 | ||
244 | --- a/arch/powerpc/platforms/powernv/pci-ioda.c | ||
245 | +++ b/arch/powerpc/platforms/powernv/pci-ioda.c | ||
246 | @@ -3424,7 +3424,6 @@ static void pnv_pci_ioda2_release_pe_dma(struct pnv_ioda_pe *pe) | ||
247 | WARN_ON(pe->table_group.group); | ||
248 | } | ||
249 | |||
250 | - pnv_pci_ioda2_table_free_pages(tbl); | ||
251 | iommu_free_table(tbl, "pnv"); | ||
252 | } | ||
253 | |||
254 | diff --git a/arch/x86/include/asm/barrier.h b/arch/x86/include/asm/barrier.h | ||
255 | index 78d1c6a3d221..eb53c2c78a1f 100644 | ||
256 | --- a/arch/x86/include/asm/barrier.h | ||
257 | +++ b/arch/x86/include/asm/barrier.h | ||
258 | @@ -37,7 +37,7 @@ static inline unsigned long array_index_mask_nospec(unsigned long index, | ||
259 | { | ||
260 | unsigned long mask; | ||
261 | |||
262 | - asm ("cmp %1,%2; sbb %0,%0;" | ||
263 | + asm volatile ("cmp %1,%2; sbb %0,%0;" | ||
264 | :"=r" (mask) | ||
265 | :"g"(size),"r" (index) | ||
266 | :"cc"); | ||
267 | diff --git a/arch/x86/kernel/cpu/mcheck/mce-severity.c b/arch/x86/kernel/cpu/mcheck/mce-severity.c | ||
268 | index f46071cb2c90..3e0199ee5a2f 100644 | ||
269 | --- a/arch/x86/kernel/cpu/mcheck/mce-severity.c | ||
270 | +++ b/arch/x86/kernel/cpu/mcheck/mce-severity.c | ||
271 | @@ -143,6 +143,11 @@ static struct severity { | ||
272 | SER, MASK(MCI_STATUS_OVER|MCI_UC_SAR|MCI_ADDR|MCACOD, MCI_UC_SAR|MCI_ADDR|MCACOD_INSTR), | ||
273 | USER | ||
274 | ), | ||
275 | + MCESEV( | ||
276 | + PANIC, "Data load in unrecoverable area of kernel", | ||
277 | + SER, MASK(MCI_STATUS_OVER|MCI_UC_SAR|MCI_ADDR|MCACOD, MCI_UC_SAR|MCI_ADDR|MCACOD_DATA), | ||
278 | + KERNEL | ||
279 | + ), | ||
280 | #endif | ||
281 | MCESEV( | ||
282 | PANIC, "Action required: unknown MCACOD", | ||
283 | diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c | ||
284 | index 7bbd50fa72ad..c49e146d4332 100644 | ||
285 | --- a/arch/x86/kernel/cpu/mcheck/mce.c | ||
286 | +++ b/arch/x86/kernel/cpu/mcheck/mce.c | ||
287 | @@ -738,23 +738,25 @@ EXPORT_SYMBOL_GPL(machine_check_poll); | ||
288 | static int mce_no_way_out(struct mce *m, char **msg, unsigned long *validp, | ||
289 | struct pt_regs *regs) | ||
290 | { | ||
291 | - int i, ret = 0; | ||
292 | char *tmp; | ||
293 | + int i; | ||
294 | |||
295 | for (i = 0; i < mca_cfg.banks; i++) { | ||
296 | m->status = mce_rdmsrl(msr_ops.status(i)); | ||
297 | - if (m->status & MCI_STATUS_VAL) { | ||
298 | - __set_bit(i, validp); | ||
299 | - if (quirk_no_way_out) | ||
300 | - quirk_no_way_out(i, m, regs); | ||
301 | - } | ||
302 | + if (!(m->status & MCI_STATUS_VAL)) | ||
303 | + continue; | ||
304 | + | ||
305 | + __set_bit(i, validp); | ||
306 | + if (quirk_no_way_out) | ||
307 | + quirk_no_way_out(i, m, regs); | ||
308 | |||
309 | if (mce_severity(m, mca_cfg.tolerant, &tmp, true) >= MCE_PANIC_SEVERITY) { | ||
310 | + mce_read_aux(m, i); | ||
311 | *msg = tmp; | ||
312 | - ret = 1; | ||
313 | + return 1; | ||
314 | } | ||
315 | } | ||
316 | - return ret; | ||
317 | + return 0; | ||
318 | } | ||
319 | |||
320 | /* | ||
321 | @@ -1140,13 +1142,18 @@ void do_machine_check(struct pt_regs *regs, long error_code) | ||
322 | lmce = m.mcgstatus & MCG_STATUS_LMCES; | ||
323 | |||
324 | /* | ||
325 | + * Local machine check may already know that we have to panic. | ||
326 | + * Broadcast machine check begins rendezvous in mce_start() | ||
327 | * Go through all banks in exclusion of the other CPUs. This way we | ||
328 | * don't report duplicated events on shared banks because the first one | ||
329 | - * to see it will clear it. If this is a Local MCE, then no need to | ||
330 | - * perform rendezvous. | ||
331 | + * to see it will clear it. | ||
332 | */ | ||
333 | - if (!lmce) | ||
334 | + if (lmce) { | ||
335 | + if (no_way_out) | ||
336 | + mce_panic("Fatal local machine check", &m, msg); | ||
337 | + } else { | ||
338 | order = mce_start(&no_way_out); | ||
339 | + } | ||
340 | |||
341 | for (i = 0; i < cfg->banks; i++) { | ||
342 | __clear_bit(i, toclear); | ||
343 | @@ -1222,12 +1229,17 @@ void do_machine_check(struct pt_regs *regs, long error_code) | ||
344 | no_way_out = worst >= MCE_PANIC_SEVERITY; | ||
345 | } else { | ||
346 | /* | ||
347 | - * Local MCE skipped calling mce_reign() | ||
348 | - * If we found a fatal error, we need to panic here. | ||
349 | + * If there was a fatal machine check we should have | ||
350 | + * already called mce_panic earlier in this function. | ||
351 | + * Since we re-read the banks, we might have found | ||
352 | + * something new. Check again to see if we found a | ||
353 | + * fatal error. We call "mce_severity()" again to | ||
354 | + * make sure we have the right "msg". | ||
355 | */ | ||
356 | - if (worst >= MCE_PANIC_SEVERITY && mca_cfg.tolerant < 3) | ||
357 | - mce_panic("Machine check from unknown source", | ||
358 | - NULL, NULL); | ||
359 | + if (worst >= MCE_PANIC_SEVERITY && mca_cfg.tolerant < 3) { | ||
360 | + mce_severity(&m, cfg->tolerant, &msg, true); | ||
361 | + mce_panic("Local fatal machine check!", &m, msg); | ||
362 | + } | ||
363 | } | ||
364 | |||
365 | /* | ||
366 | diff --git a/arch/x86/kernel/quirks.c b/arch/x86/kernel/quirks.c | ||
367 | index 0bee04d41bed..b57100a2c834 100644 | ||
368 | --- a/arch/x86/kernel/quirks.c | ||
369 | +++ b/arch/x86/kernel/quirks.c | ||
370 | @@ -643,12 +643,19 @@ static void quirk_intel_brickland_xeon_ras_cap(struct pci_dev *pdev) | ||
371 | /* Skylake */ | ||
372 | static void quirk_intel_purley_xeon_ras_cap(struct pci_dev *pdev) | ||
373 | { | ||
374 | - u32 capid0; | ||
375 | + u32 capid0, capid5; | ||
376 | |||
377 | pci_read_config_dword(pdev, 0x84, &capid0); | ||
378 | + pci_read_config_dword(pdev, 0x98, &capid5); | ||
379 | |||
380 | - if ((capid0 & 0xc0) == 0xc0) | ||
381 | + /* | ||
382 | + * CAPID0{7:6} indicate whether this is an advanced RAS SKU | ||
383 | + * CAPID5{8:5} indicate that various NVDIMM usage modes are | ||
384 | + * enabled, so memory machine check recovery is also enabled. | ||
385 | + */ | ||
386 | + if ((capid0 & 0xc0) == 0xc0 || (capid5 & 0x1e0)) | ||
387 | static_branch_inc(&mcsafe_key); | ||
388 | + | ||
389 | } | ||
390 | DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x0ec3, quirk_intel_brickland_xeon_ras_cap); | ||
391 | DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x2fc0, quirk_intel_brickland_xeon_ras_cap); | ||
392 | diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c | ||
393 | index f2142932ff0b..5bbfa2f63b8c 100644 | ||
394 | --- a/arch/x86/kernel/traps.c | ||
395 | +++ b/arch/x86/kernel/traps.c | ||
396 | @@ -799,16 +799,18 @@ static void math_error(struct pt_regs *regs, int error_code, int trapnr) | ||
397 | char *str = (trapnr == X86_TRAP_MF) ? "fpu exception" : | ||
398 | "simd exception"; | ||
399 | |||
400 | - if (notify_die(DIE_TRAP, str, regs, error_code, trapnr, SIGFPE) == NOTIFY_STOP) | ||
401 | - return; | ||
402 | cond_local_irq_enable(regs); | ||
403 | |||
404 | if (!user_mode(regs)) { | ||
405 | - if (!fixup_exception(regs, trapnr)) { | ||
406 | - task->thread.error_code = error_code; | ||
407 | - task->thread.trap_nr = trapnr; | ||
408 | + if (fixup_exception(regs, trapnr)) | ||
409 | + return; | ||
410 | + | ||
411 | + task->thread.error_code = error_code; | ||
412 | + task->thread.trap_nr = trapnr; | ||
413 | + | ||
414 | + if (notify_die(DIE_TRAP, str, regs, error_code, | ||
415 | + trapnr, SIGFPE) != NOTIFY_STOP) | ||
416 | die(str, regs, error_code); | ||
417 | - } | ||
418 | return; | ||
419 | } | ||
420 | |||
421 | diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c | ||
422 | index f92bdb9f4e46..ae9b84cae57c 100644 | ||
423 | --- a/arch/x86/mm/init.c | ||
424 | +++ b/arch/x86/mm/init.c | ||
425 | @@ -653,7 +653,9 @@ void __init init_mem_mapping(void) | ||
426 | */ | ||
427 | int devmem_is_allowed(unsigned long pagenr) | ||
428 | { | ||
429 | - if (page_is_ram(pagenr)) { | ||
430 | + if (region_intersects(PFN_PHYS(pagenr), PAGE_SIZE, | ||
431 | + IORESOURCE_SYSTEM_RAM, IORES_DESC_NONE) | ||
432 | + != REGION_DISJOINT) { | ||
433 | /* | ||
434 | * For disallowed memory regions in the low 1MB range, | ||
435 | * request that the page be shown as all zeros. | ||
436 | diff --git a/arch/xtensa/kernel/traps.c b/arch/xtensa/kernel/traps.c | ||
437 | index ce37d5b899fe..44bd9a377ad1 100644 | ||
438 | --- a/arch/xtensa/kernel/traps.c | ||
439 | +++ b/arch/xtensa/kernel/traps.c | ||
440 | @@ -334,7 +334,7 @@ do_unaligned_user (struct pt_regs *regs) | ||
441 | info.si_errno = 0; | ||
442 | info.si_code = BUS_ADRALN; | ||
443 | info.si_addr = (void *) regs->excvaddr; | ||
444 | - force_sig_info(SIGSEGV, &info, current); | ||
445 | + force_sig_info(SIGBUS, &info, current); | ||
446 | |||
447 | } | ||
448 | #endif | ||
449 | diff --git a/crypto/asymmetric_keys/x509_cert_parser.c b/crypto/asymmetric_keys/x509_cert_parser.c | ||
450 | index ce2df8c9c583..7e6a43ffdcbe 100644 | ||
451 | --- a/crypto/asymmetric_keys/x509_cert_parser.c | ||
452 | +++ b/crypto/asymmetric_keys/x509_cert_parser.c | ||
453 | @@ -249,6 +249,15 @@ int x509_note_signature(void *context, size_t hdrlen, | ||
454 | return -EINVAL; | ||
455 | } | ||
456 | |||
457 | + if (strcmp(ctx->cert->sig->pkey_algo, "rsa") == 0) { | ||
458 | + /* Discard the BIT STRING metadata */ | ||
459 | + if (vlen < 1 || *(const u8 *)value != 0) | ||
460 | + return -EBADMSG; | ||
461 | + | ||
462 | + value++; | ||
463 | + vlen--; | ||
464 | + } | ||
465 | + | ||
466 | ctx->cert->raw_sig = value; | ||
467 | ctx->cert->raw_sig_size = vlen; | ||
468 | return 0; | ||
469 | diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c | ||
470 | index 343cad9bf7e7..ef3016a467a0 100644 | ||
471 | --- a/drivers/block/rbd.c | ||
472 | +++ b/drivers/block/rbd.c | ||
473 | @@ -3900,7 +3900,6 @@ static void cancel_tasks_sync(struct rbd_device *rbd_dev) | ||
474 | { | ||
475 | dout("%s rbd_dev %p\n", __func__, rbd_dev); | ||
476 | |||
477 | - cancel_delayed_work_sync(&rbd_dev->watch_dwork); | ||
478 | cancel_work_sync(&rbd_dev->acquired_lock_work); | ||
479 | cancel_work_sync(&rbd_dev->released_lock_work); | ||
480 | cancel_delayed_work_sync(&rbd_dev->lock_dwork); | ||
481 | @@ -3918,6 +3917,7 @@ static void rbd_unregister_watch(struct rbd_device *rbd_dev) | ||
482 | rbd_dev->watch_state = RBD_WATCH_STATE_UNREGISTERED; | ||
483 | mutex_unlock(&rbd_dev->watch_mutex); | ||
484 | |||
485 | + cancel_delayed_work_sync(&rbd_dev->watch_dwork); | ||
486 | ceph_osdc_flush_notifies(&rbd_dev->rbd_client->client->osdc); | ||
487 | } | ||
488 | |||
489 | diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c | ||
490 | index 74b2f4a14643..3a8b9aef96a6 100644 | ||
491 | --- a/drivers/bluetooth/hci_qca.c | ||
492 | +++ b/drivers/bluetooth/hci_qca.c | ||
493 | @@ -939,6 +939,12 @@ static int qca_setup(struct hci_uart *hu) | ||
494 | } else if (ret == -ENOENT) { | ||
495 | /* No patch/nvm-config found, run with original fw/config */ | ||
496 | ret = 0; | ||
497 | + } else if (ret == -EAGAIN) { | ||
498 | + /* | ||
499 | + * Userspace firmware loader will return -EAGAIN in case no | ||
500 | + * patch/nvm-config is found, so run with original fw/config. | ||
501 | + */ | ||
502 | + ret = 0; | ||
503 | } | ||
504 | |||
505 | /* Setup bdaddr */ | ||
506 | diff --git a/drivers/char/ipmi/ipmi_bt_sm.c b/drivers/char/ipmi/ipmi_bt_sm.c | ||
507 | index feafdab734ae..4835b588b783 100644 | ||
508 | --- a/drivers/char/ipmi/ipmi_bt_sm.c | ||
509 | +++ b/drivers/char/ipmi/ipmi_bt_sm.c | ||
510 | @@ -522,11 +522,12 @@ static enum si_sm_result bt_event(struct si_sm_data *bt, long time) | ||
511 | if (status & BT_H_BUSY) /* clear a leftover H_BUSY */ | ||
512 | BT_CONTROL(BT_H_BUSY); | ||
513 | |||
514 | + bt->timeout = bt->BT_CAP_req2rsp; | ||
515 | + | ||
516 | /* Read BT capabilities if it hasn't been done yet */ | ||
517 | if (!bt->BT_CAP_outreqs) | ||
518 | BT_STATE_CHANGE(BT_STATE_CAPABILITIES_BEGIN, | ||
519 | SI_SM_CALL_WITHOUT_DELAY); | ||
520 | - bt->timeout = bt->BT_CAP_req2rsp; | ||
521 | BT_SI_SM_RETURN(SI_SM_IDLE); | ||
522 | |||
523 | case BT_STATE_XACTION_START: | ||
524 | diff --git a/drivers/clk/at91/clk-pll.c b/drivers/clk/at91/clk-pll.c | ||
525 | index 45ad168e1496..2bb2551c6245 100644 | ||
526 | --- a/drivers/clk/at91/clk-pll.c | ||
527 | +++ b/drivers/clk/at91/clk-pll.c | ||
528 | @@ -132,19 +132,8 @@ static unsigned long clk_pll_recalc_rate(struct clk_hw *hw, | ||
529 | unsigned long parent_rate) | ||
530 | { | ||
531 | struct clk_pll *pll = to_clk_pll(hw); | ||
532 | - unsigned int pllr; | ||
533 | - u16 mul; | ||
534 | - u8 div; | ||
535 | - | ||
536 | - regmap_read(pll->regmap, PLL_REG(pll->id), &pllr); | ||
537 | - | ||
538 | - div = PLL_DIV(pllr); | ||
539 | - mul = PLL_MUL(pllr, pll->layout); | ||
540 | - | ||
541 | - if (!div || !mul) | ||
542 | - return 0; | ||
543 | |||
544 | - return (parent_rate / div) * (mul + 1); | ||
545 | + return (parent_rate / pll->div) * (pll->mul + 1); | ||
546 | } | ||
547 | |||
548 | static long clk_pll_get_best_div_mul(struct clk_pll *pll, unsigned long rate, | ||
549 | diff --git a/drivers/clk/renesas/renesas-cpg-mssr.c b/drivers/clk/renesas/renesas-cpg-mssr.c | ||
550 | index 25c41cd9cdfc..7ecc5eac3d7f 100644 | ||
551 | --- a/drivers/clk/renesas/renesas-cpg-mssr.c | ||
552 | +++ b/drivers/clk/renesas/renesas-cpg-mssr.c | ||
553 | @@ -243,8 +243,9 @@ struct clk *cpg_mssr_clk_src_twocell_get(struct of_phandle_args *clkspec, | ||
554 | dev_err(dev, "Cannot get %s clock %u: %ld", type, clkidx, | ||
555 | PTR_ERR(clk)); | ||
556 | else | ||
557 | - dev_dbg(dev, "clock (%u, %u) is %pC at %pCr Hz\n", | ||
558 | - clkspec->args[0], clkspec->args[1], clk, clk); | ||
559 | + dev_dbg(dev, "clock (%u, %u) is %pC at %lu Hz\n", | ||
560 | + clkspec->args[0], clkspec->args[1], clk, | ||
561 | + clk_get_rate(clk)); | ||
562 | return clk; | ||
563 | } | ||
564 | |||
565 | @@ -304,7 +305,7 @@ static void __init cpg_mssr_register_core_clk(const struct cpg_core_clk *core, | ||
566 | if (IS_ERR_OR_NULL(clk)) | ||
567 | goto fail; | ||
568 | |||
569 | - dev_dbg(dev, "Core clock %pC at %pCr Hz\n", clk, clk); | ||
570 | + dev_dbg(dev, "Core clock %pC at %lu Hz\n", clk, clk_get_rate(clk)); | ||
571 | priv->clks[id] = clk; | ||
572 | return; | ||
573 | |||
574 | @@ -372,7 +373,7 @@ static void __init cpg_mssr_register_mod_clk(const struct mssr_mod_clk *mod, | ||
575 | if (IS_ERR(clk)) | ||
576 | goto fail; | ||
577 | |||
578 | - dev_dbg(dev, "Module clock %pC at %pCr Hz\n", clk, clk); | ||
579 | + dev_dbg(dev, "Module clock %pC at %lu Hz\n", clk, clk_get_rate(clk)); | ||
580 | priv->clks[id] = clk; | ||
581 | return; | ||
582 | |||
583 | diff --git a/drivers/cpuidle/cpuidle-powernv.c b/drivers/cpuidle/cpuidle-powernv.c | ||
584 | index 854a56781100..fd96af1d2ef0 100644 | ||
585 | --- a/drivers/cpuidle/cpuidle-powernv.c | ||
586 | +++ b/drivers/cpuidle/cpuidle-powernv.c | ||
587 | @@ -32,9 +32,31 @@ static struct cpuidle_state *cpuidle_state_table; | ||
588 | |||
589 | static u64 stop_psscr_table[CPUIDLE_STATE_MAX]; | ||
590 | |||
591 | -static u64 snooze_timeout; | ||
592 | +static u64 default_snooze_timeout; | ||
593 | static bool snooze_timeout_en; | ||
594 | |||
595 | +static u64 get_snooze_timeout(struct cpuidle_device *dev, | ||
596 | + struct cpuidle_driver *drv, | ||
597 | + int index) | ||
598 | +{ | ||
599 | + int i; | ||
600 | + | ||
601 | + if (unlikely(!snooze_timeout_en)) | ||
602 | + return default_snooze_timeout; | ||
603 | + | ||
604 | + for (i = index + 1; i < drv->state_count; i++) { | ||
605 | + struct cpuidle_state *s = &drv->states[i]; | ||
606 | + struct cpuidle_state_usage *su = &dev->states_usage[i]; | ||
607 | + | ||
608 | + if (s->disabled || su->disable) | ||
609 | + continue; | ||
610 | + | ||
611 | + return s->target_residency * tb_ticks_per_usec; | ||
612 | + } | ||
613 | + | ||
614 | + return default_snooze_timeout; | ||
615 | +} | ||
616 | + | ||
617 | static int snooze_loop(struct cpuidle_device *dev, | ||
618 | struct cpuidle_driver *drv, | ||
619 | int index) | ||
620 | @@ -44,7 +66,7 @@ static int snooze_loop(struct cpuidle_device *dev, | ||
621 | local_irq_enable(); | ||
622 | set_thread_flag(TIF_POLLING_NRFLAG); | ||
623 | |||
624 | - snooze_exit_time = get_tb() + snooze_timeout; | ||
625 | + snooze_exit_time = get_tb() + get_snooze_timeout(dev, drv, index); | ||
626 | ppc64_runlatch_off(); | ||
627 | while (!need_resched()) { | ||
628 | HMT_low(); | ||
629 | @@ -337,11 +359,9 @@ static int powernv_idle_probe(void) | ||
630 | cpuidle_state_table = powernv_states; | ||
631 | /* Device tree can indicate more idle states */ | ||
632 | max_idle_state = powernv_add_idle_states(); | ||
633 | - if (max_idle_state > 1) { | ||
634 | + default_snooze_timeout = TICK_USEC * tb_ticks_per_usec; | ||
635 | + if (max_idle_state > 1) | ||
636 | snooze_timeout_en = true; | ||
637 | - snooze_timeout = powernv_states[1].target_residency * | ||
638 | - tb_ticks_per_usec; | ||
639 | - } | ||
640 | } else | ||
641 | return -ENODEV; | ||
642 | |||
643 | diff --git a/drivers/iio/buffer/kfifo_buf.c b/drivers/iio/buffer/kfifo_buf.c | ||
644 | index 7ef9b13262a8..e44181f9eb36 100644 | ||
645 | --- a/drivers/iio/buffer/kfifo_buf.c | ||
646 | +++ b/drivers/iio/buffer/kfifo_buf.c | ||
647 | @@ -19,7 +19,7 @@ struct iio_kfifo { | ||
648 | #define iio_to_kfifo(r) container_of(r, struct iio_kfifo, buffer) | ||
649 | |||
650 | static inline int __iio_allocate_kfifo(struct iio_kfifo *buf, | ||
651 | - int bytes_per_datum, int length) | ||
652 | + size_t bytes_per_datum, unsigned int length) | ||
653 | { | ||
654 | if ((length == 0) || (bytes_per_datum == 0)) | ||
655 | return -EINVAL; | ||
656 | @@ -71,7 +71,7 @@ static int iio_set_bytes_per_datum_kfifo(struct iio_buffer *r, size_t bpd) | ||
657 | return 0; | ||
658 | } | ||
659 | |||
660 | -static int iio_set_length_kfifo(struct iio_buffer *r, int length) | ||
661 | +static int iio_set_length_kfifo(struct iio_buffer *r, unsigned int length) | ||
662 | { | ||
663 | /* Avoid an invalid state */ | ||
664 | if (length < 2) | ||
665 | diff --git a/drivers/infiniband/hw/hfi1/hfi.h b/drivers/infiniband/hw/hfi1/hfi.h | ||
666 | index a3279f3d2578..a79d9b340cfa 100644 | ||
667 | --- a/drivers/infiniband/hw/hfi1/hfi.h | ||
668 | +++ b/drivers/infiniband/hw/hfi1/hfi.h | ||
669 | @@ -1631,6 +1631,7 @@ struct cc_state *get_cc_state_protected(struct hfi1_pportdata *ppd) | ||
670 | #define HFI1_HAS_SDMA_TIMEOUT 0x8 | ||
671 | #define HFI1_HAS_SEND_DMA 0x10 /* Supports Send DMA */ | ||
672 | #define HFI1_FORCED_FREEZE 0x80 /* driver forced freeze mode */ | ||
673 | +#define HFI1_SHUTDOWN 0x100 /* device is shutting down */ | ||
674 | |||
675 | /* IB dword length mask in PBC (lower 11 bits); same for all chips */ | ||
676 | #define HFI1_PBC_LENGTH_MASK ((1 << 11) - 1) | ||
677 | diff --git a/drivers/infiniband/hw/hfi1/init.c b/drivers/infiniband/hw/hfi1/init.c | ||
678 | index ae1f90ddd4e8..c81c44525dd5 100644 | ||
679 | --- a/drivers/infiniband/hw/hfi1/init.c | ||
680 | +++ b/drivers/infiniband/hw/hfi1/init.c | ||
681 | @@ -857,6 +857,10 @@ static void shutdown_device(struct hfi1_devdata *dd) | ||
682 | unsigned pidx; | ||
683 | int i; | ||
684 | |||
685 | + if (dd->flags & HFI1_SHUTDOWN) | ||
686 | + return; | ||
687 | + dd->flags |= HFI1_SHUTDOWN; | ||
688 | + | ||
689 | for (pidx = 0; pidx < dd->num_pports; ++pidx) { | ||
690 | ppd = dd->pport + pidx; | ||
691 | |||
692 | @@ -1168,6 +1172,7 @@ void hfi1_disable_after_error(struct hfi1_devdata *dd) | ||
693 | |||
694 | static void remove_one(struct pci_dev *); | ||
695 | static int init_one(struct pci_dev *, const struct pci_device_id *); | ||
696 | +static void shutdown_one(struct pci_dev *); | ||
697 | |||
698 | #define DRIVER_LOAD_MSG "Intel " DRIVER_NAME " loaded: " | ||
699 | #define PFX DRIVER_NAME ": " | ||
700 | @@ -1184,6 +1189,7 @@ static struct pci_driver hfi1_pci_driver = { | ||
701 | .name = DRIVER_NAME, | ||
702 | .probe = init_one, | ||
703 | .remove = remove_one, | ||
704 | + .shutdown = shutdown_one, | ||
705 | .id_table = hfi1_pci_tbl, | ||
706 | .err_handler = &hfi1_pci_err_handler, | ||
707 | }; | ||
708 | @@ -1590,6 +1596,13 @@ static void remove_one(struct pci_dev *pdev) | ||
709 | postinit_cleanup(dd); | ||
710 | } | ||
711 | |||
712 | +static void shutdown_one(struct pci_dev *pdev) | ||
713 | +{ | ||
714 | + struct hfi1_devdata *dd = pci_get_drvdata(pdev); | ||
715 | + | ||
716 | + shutdown_device(dd); | ||
717 | +} | ||
718 | + | ||
719 | /** | ||
720 | * hfi1_create_rcvhdrq - create a receive header queue | ||
721 | * @dd: the hfi1_ib device | ||
722 | diff --git a/drivers/infiniband/hw/mlx4/mad.c b/drivers/infiniband/hw/mlx4/mad.c | ||
723 | index 18d309e40f1b..d9323d7c479c 100644 | ||
724 | --- a/drivers/infiniband/hw/mlx4/mad.c | ||
725 | +++ b/drivers/infiniband/hw/mlx4/mad.c | ||
726 | @@ -1897,7 +1897,6 @@ static void mlx4_ib_sqp_comp_worker(struct work_struct *work) | ||
727 | "buf:%lld\n", wc.wr_id); | ||
728 | break; | ||
729 | default: | ||
730 | - BUG_ON(1); | ||
731 | break; | ||
732 | } | ||
733 | } else { | ||
734 | diff --git a/drivers/infiniband/hw/mlx5/cq.c b/drivers/infiniband/hw/mlx5/cq.c | ||
735 | index fc62a7ded734..a19ebb19952e 100644 | ||
736 | --- a/drivers/infiniband/hw/mlx5/cq.c | ||
737 | +++ b/drivers/infiniband/hw/mlx5/cq.c | ||
738 | @@ -645,7 +645,7 @@ static int mlx5_poll_one(struct mlx5_ib_cq *cq, | ||
739 | } | ||
740 | |||
741 | static int poll_soft_wc(struct mlx5_ib_cq *cq, int num_entries, | ||
742 | - struct ib_wc *wc) | ||
743 | + struct ib_wc *wc, bool is_fatal_err) | ||
744 | { | ||
745 | struct mlx5_ib_dev *dev = to_mdev(cq->ibcq.device); | ||
746 | struct mlx5_ib_wc *soft_wc, *next; | ||
747 | @@ -658,6 +658,10 @@ static int poll_soft_wc(struct mlx5_ib_cq *cq, int num_entries, | ||
748 | mlx5_ib_dbg(dev, "polled software generated completion on CQ 0x%x\n", | ||
749 | cq->mcq.cqn); | ||
750 | |||
751 | + if (unlikely(is_fatal_err)) { | ||
752 | + soft_wc->wc.status = IB_WC_WR_FLUSH_ERR; | ||
753 | + soft_wc->wc.vendor_err = MLX5_CQE_SYNDROME_WR_FLUSH_ERR; | ||
754 | + } | ||
755 | wc[npolled++] = soft_wc->wc; | ||
756 | list_del(&soft_wc->list); | ||
757 | kfree(soft_wc); | ||
758 | @@ -678,12 +682,17 @@ int mlx5_ib_poll_cq(struct ib_cq *ibcq, int num_entries, struct ib_wc *wc) | ||
759 | |||
760 | spin_lock_irqsave(&cq->lock, flags); | ||
761 | if (mdev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR) { | ||
762 | - mlx5_ib_poll_sw_comp(cq, num_entries, wc, &npolled); | ||
763 | + /* make sure no soft wqe's are waiting */ | ||
764 | + if (unlikely(!list_empty(&cq->wc_list))) | ||
765 | + soft_polled = poll_soft_wc(cq, num_entries, wc, true); | ||
766 | + | ||
767 | + mlx5_ib_poll_sw_comp(cq, num_entries - soft_polled, | ||
768 | + wc + soft_polled, &npolled); | ||
769 | goto out; | ||
770 | } | ||
771 | |||
772 | if (unlikely(!list_empty(&cq->wc_list))) | ||
773 | - soft_polled = poll_soft_wc(cq, num_entries, wc); | ||
774 | + soft_polled = poll_soft_wc(cq, num_entries, wc, false); | ||
775 | |||
776 | for (npolled = 0; npolled < num_entries - soft_polled; npolled++) { | ||
777 | if (mlx5_poll_one(cq, &cur_qp, wc + soft_polled + npolled)) | ||
778 | diff --git a/drivers/infiniband/hw/qib/qib.h b/drivers/infiniband/hw/qib/qib.h | ||
779 | index a3e21a25cea5..ef092cca092e 100644 | ||
780 | --- a/drivers/infiniband/hw/qib/qib.h | ||
781 | +++ b/drivers/infiniband/hw/qib/qib.h | ||
782 | @@ -1250,6 +1250,7 @@ static inline struct qib_ibport *to_iport(struct ib_device *ibdev, u8 port) | ||
783 | #define QIB_BADINTR 0x8000 /* severe interrupt problems */ | ||
784 | #define QIB_DCA_ENABLED 0x10000 /* Direct Cache Access enabled */ | ||
785 | #define QIB_HAS_QSFP 0x20000 /* device (card instance) has QSFP */ | ||
786 | +#define QIB_SHUTDOWN 0x40000 /* device is shutting down */ | ||
787 | |||
788 | /* | ||
789 | * values for ppd->lflags (_ib_port_ related flags) | ||
790 | @@ -1448,8 +1449,7 @@ u64 qib_sps_ints(void); | ||
791 | /* | ||
792 | * dma_addr wrappers - all 0's invalid for hw | ||
793 | */ | ||
794 | -dma_addr_t qib_map_page(struct pci_dev *, struct page *, unsigned long, | ||
795 | - size_t, int); | ||
796 | +int qib_map_page(struct pci_dev *d, struct page *p, dma_addr_t *daddr); | ||
797 | const char *qib_get_unit_name(int unit); | ||
798 | const char *qib_get_card_name(struct rvt_dev_info *rdi); | ||
799 | struct pci_dev *qib_get_pci_dev(struct rvt_dev_info *rdi); | ||
800 | diff --git a/drivers/infiniband/hw/qib/qib_file_ops.c b/drivers/infiniband/hw/qib/qib_file_ops.c | ||
801 | index 382466a90da7..cc6a92316c7c 100644 | ||
802 | --- a/drivers/infiniband/hw/qib/qib_file_ops.c | ||
803 | +++ b/drivers/infiniband/hw/qib/qib_file_ops.c | ||
804 | @@ -364,6 +364,8 @@ static int qib_tid_update(struct qib_ctxtdata *rcd, struct file *fp, | ||
805 | goto done; | ||
806 | } | ||
807 | for (i = 0; i < cnt; i++, vaddr += PAGE_SIZE) { | ||
808 | + dma_addr_t daddr; | ||
809 | + | ||
810 | for (; ntids--; tid++) { | ||
811 | if (tid == tidcnt) | ||
812 | tid = 0; | ||
813 | @@ -380,12 +382,14 @@ static int qib_tid_update(struct qib_ctxtdata *rcd, struct file *fp, | ||
814 | ret = -ENOMEM; | ||
815 | break; | ||
816 | } | ||
817 | + ret = qib_map_page(dd->pcidev, pagep[i], &daddr); | ||
818 | + if (ret) | ||
819 | + break; | ||
820 | + | ||
821 | tidlist[i] = tid + tidoff; | ||
822 | /* we "know" system pages and TID pages are same size */ | ||
823 | dd->pageshadow[ctxttid + tid] = pagep[i]; | ||
824 | - dd->physshadow[ctxttid + tid] = | ||
825 | - qib_map_page(dd->pcidev, pagep[i], 0, PAGE_SIZE, | ||
826 | - PCI_DMA_FROMDEVICE); | ||
827 | + dd->physshadow[ctxttid + tid] = daddr; | ||
828 | /* | ||
829 | * don't need atomic or it's overhead | ||
830 | */ | ||
831 | diff --git a/drivers/infiniband/hw/qib/qib_init.c b/drivers/infiniband/hw/qib/qib_init.c | ||
832 | index 1730aa839a47..caf7c5120b0a 100644 | ||
833 | --- a/drivers/infiniband/hw/qib/qib_init.c | ||
834 | +++ b/drivers/infiniband/hw/qib/qib_init.c | ||
835 | @@ -878,6 +878,10 @@ static void qib_shutdown_device(struct qib_devdata *dd) | ||
836 | struct qib_pportdata *ppd; | ||
837 | unsigned pidx; | ||
838 | |||
839 | + if (dd->flags & QIB_SHUTDOWN) | ||
840 | + return; | ||
841 | + dd->flags |= QIB_SHUTDOWN; | ||
842 | + | ||
843 | for (pidx = 0; pidx < dd->num_pports; ++pidx) { | ||
844 | ppd = dd->pport + pidx; | ||
845 | |||
846 | @@ -1223,6 +1227,7 @@ void qib_disable_after_error(struct qib_devdata *dd) | ||
847 | |||
848 | static void qib_remove_one(struct pci_dev *); | ||
849 | static int qib_init_one(struct pci_dev *, const struct pci_device_id *); | ||
850 | +static void qib_shutdown_one(struct pci_dev *); | ||
851 | |||
852 | #define DRIVER_LOAD_MSG "Intel " QIB_DRV_NAME " loaded: " | ||
853 | #define PFX QIB_DRV_NAME ": " | ||
854 | @@ -1240,6 +1245,7 @@ static struct pci_driver qib_driver = { | ||
855 | .name = QIB_DRV_NAME, | ||
856 | .probe = qib_init_one, | ||
857 | .remove = qib_remove_one, | ||
858 | + .shutdown = qib_shutdown_one, | ||
859 | .id_table = qib_pci_tbl, | ||
860 | .err_handler = &qib_pci_err_handler, | ||
861 | }; | ||
862 | @@ -1591,6 +1597,13 @@ static void qib_remove_one(struct pci_dev *pdev) | ||
863 | qib_postinit_cleanup(dd); | ||
864 | } | ||
865 | |||
866 | +static void qib_shutdown_one(struct pci_dev *pdev) | ||
867 | +{ | ||
868 | + struct qib_devdata *dd = pci_get_drvdata(pdev); | ||
869 | + | ||
870 | + qib_shutdown_device(dd); | ||
871 | +} | ||
872 | + | ||
873 | /** | ||
874 | * qib_create_rcvhdrq - create a receive header queue | ||
875 | * @dd: the qlogic_ib device | ||
876 | diff --git a/drivers/infiniband/hw/qib/qib_user_pages.c b/drivers/infiniband/hw/qib/qib_user_pages.c | ||
877 | index 75f08624ac05..4715edff5488 100644 | ||
878 | --- a/drivers/infiniband/hw/qib/qib_user_pages.c | ||
879 | +++ b/drivers/infiniband/hw/qib/qib_user_pages.c | ||
880 | @@ -98,23 +98,27 @@ static int __qib_get_user_pages(unsigned long start_page, size_t num_pages, | ||
881 | * | ||
882 | * I'm sure we won't be so lucky with other iommu's, so FIXME. | ||
883 | */ | ||
884 | -dma_addr_t qib_map_page(struct pci_dev *hwdev, struct page *page, | ||
885 | - unsigned long offset, size_t size, int direction) | ||
886 | +int qib_map_page(struct pci_dev *hwdev, struct page *page, dma_addr_t *daddr) | ||
887 | { | ||
888 | dma_addr_t phys; | ||
889 | |||
890 | - phys = pci_map_page(hwdev, page, offset, size, direction); | ||
891 | + phys = pci_map_page(hwdev, page, 0, PAGE_SIZE, PCI_DMA_FROMDEVICE); | ||
892 | + if (pci_dma_mapping_error(hwdev, phys)) | ||
893 | + return -ENOMEM; | ||
894 | |||
895 | - if (phys == 0) { | ||
896 | - pci_unmap_page(hwdev, phys, size, direction); | ||
897 | - phys = pci_map_page(hwdev, page, offset, size, direction); | ||
898 | + if (!phys) { | ||
899 | + pci_unmap_page(hwdev, phys, PAGE_SIZE, PCI_DMA_FROMDEVICE); | ||
900 | + phys = pci_map_page(hwdev, page, 0, PAGE_SIZE, | ||
901 | + PCI_DMA_FROMDEVICE); | ||
902 | + if (pci_dma_mapping_error(hwdev, phys)) | ||
903 | + return -ENOMEM; | ||
904 | /* | ||
905 | * FIXME: If we get 0 again, we should keep this page, | ||
906 | * map another, then free the 0 page. | ||
907 | */ | ||
908 | } | ||
909 | - | ||
910 | - return phys; | ||
911 | + *daddr = phys; | ||
912 | + return 0; | ||
913 | } | ||
914 | |||
915 | /** | ||
916 | diff --git a/drivers/infiniband/ulp/isert/ib_isert.c b/drivers/infiniband/ulp/isert/ib_isert.c | ||
917 | index b879d21b7548..02a5e2d7e574 100644 | ||
918 | --- a/drivers/infiniband/ulp/isert/ib_isert.c | ||
919 | +++ b/drivers/infiniband/ulp/isert/ib_isert.c | ||
920 | @@ -879,15 +879,9 @@ isert_login_post_send(struct isert_conn *isert_conn, struct iser_tx_desc *tx_des | ||
921 | } | ||
922 | |||
923 | static void | ||
924 | -isert_create_send_desc(struct isert_conn *isert_conn, | ||
925 | - struct isert_cmd *isert_cmd, | ||
926 | - struct iser_tx_desc *tx_desc) | ||
927 | +__isert_create_send_desc(struct isert_device *device, | ||
928 | + struct iser_tx_desc *tx_desc) | ||
929 | { | ||
930 | - struct isert_device *device = isert_conn->device; | ||
931 | - struct ib_device *ib_dev = device->ib_device; | ||
932 | - | ||
933 | - ib_dma_sync_single_for_cpu(ib_dev, tx_desc->dma_addr, | ||
934 | - ISER_HEADERS_LEN, DMA_TO_DEVICE); | ||
935 | |||
936 | memset(&tx_desc->iser_header, 0, sizeof(struct iser_ctrl)); | ||
937 | tx_desc->iser_header.flags = ISCSI_CTRL; | ||
938 | @@ -900,6 +894,20 @@ isert_create_send_desc(struct isert_conn *isert_conn, | ||
939 | } | ||
940 | } | ||
941 | |||
942 | +static void | ||
943 | +isert_create_send_desc(struct isert_conn *isert_conn, | ||
944 | + struct isert_cmd *isert_cmd, | ||
945 | + struct iser_tx_desc *tx_desc) | ||
946 | +{ | ||
947 | + struct isert_device *device = isert_conn->device; | ||
948 | + struct ib_device *ib_dev = device->ib_device; | ||
949 | + | ||
950 | + ib_dma_sync_single_for_cpu(ib_dev, tx_desc->dma_addr, | ||
951 | + ISER_HEADERS_LEN, DMA_TO_DEVICE); | ||
952 | + | ||
953 | + __isert_create_send_desc(device, tx_desc); | ||
954 | +} | ||
955 | + | ||
956 | static int | ||
957 | isert_init_tx_hdrs(struct isert_conn *isert_conn, | ||
958 | struct iser_tx_desc *tx_desc) | ||
959 | @@ -987,7 +995,7 @@ isert_put_login_tx(struct iscsi_conn *conn, struct iscsi_login *login, | ||
960 | struct iser_tx_desc *tx_desc = &isert_conn->login_tx_desc; | ||
961 | int ret; | ||
962 | |||
963 | - isert_create_send_desc(isert_conn, NULL, tx_desc); | ||
964 | + __isert_create_send_desc(device, tx_desc); | ||
965 | |||
966 | memcpy(&tx_desc->iscsi_header, &login->rsp[0], | ||
967 | sizeof(struct iscsi_hdr)); | ||
968 | @@ -2082,7 +2090,7 @@ isert_set_sig_attrs(struct se_cmd *se_cmd, struct ib_sig_attrs *sig_attrs) | ||
969 | |||
970 | sig_attrs->check_mask = | ||
971 | (se_cmd->prot_checks & TARGET_DIF_CHECK_GUARD ? 0xc0 : 0) | | ||
972 | - (se_cmd->prot_checks & TARGET_DIF_CHECK_REFTAG ? 0x30 : 0) | | ||
973 | + (se_cmd->prot_checks & TARGET_DIF_CHECK_APPTAG ? 0x30 : 0) | | ||
974 | (se_cmd->prot_checks & TARGET_DIF_CHECK_REFTAG ? 0x0f : 0); | ||
975 | return 0; | ||
976 | } | ||
977 | diff --git a/drivers/input/mouse/elan_i2c.h b/drivers/input/mouse/elan_i2c.h | ||
978 | index c0ec26118732..83dd0ce3ad2a 100644 | ||
979 | --- a/drivers/input/mouse/elan_i2c.h | ||
980 | +++ b/drivers/input/mouse/elan_i2c.h | ||
981 | @@ -27,6 +27,8 @@ | ||
982 | #define ETP_DISABLE_POWER 0x0001 | ||
983 | #define ETP_PRESSURE_OFFSET 25 | ||
984 | |||
985 | +#define ETP_CALIBRATE_MAX_LEN 3 | ||
986 | + | ||
987 | /* IAP Firmware handling */ | ||
988 | #define ETP_PRODUCT_ID_FORMAT_STRING "%d.0" | ||
989 | #define ETP_FW_NAME "elan_i2c_" ETP_PRODUCT_ID_FORMAT_STRING ".bin" | ||
990 | diff --git a/drivers/input/mouse/elan_i2c_core.c b/drivers/input/mouse/elan_i2c_core.c | ||
991 | index aeb8250ab079..97f6e05cffce 100644 | ||
992 | --- a/drivers/input/mouse/elan_i2c_core.c | ||
993 | +++ b/drivers/input/mouse/elan_i2c_core.c | ||
994 | @@ -595,7 +595,7 @@ static ssize_t calibrate_store(struct device *dev, | ||
995 | int tries = 20; | ||
996 | int retval; | ||
997 | int error; | ||
998 | - u8 val[3]; | ||
999 | + u8 val[ETP_CALIBRATE_MAX_LEN]; | ||
1000 | |||
1001 | retval = mutex_lock_interruptible(&data->sysfs_mutex); | ||
1002 | if (retval) | ||
1003 | @@ -1250,6 +1250,7 @@ static const struct acpi_device_id elan_acpi_id[] = { | ||
1004 | { "ELAN060C", 0 }, | ||
1005 | { "ELAN0611", 0 }, | ||
1006 | { "ELAN0612", 0 }, | ||
1007 | + { "ELAN0618", 0 }, | ||
1008 | { "ELAN1000", 0 }, | ||
1009 | { } | ||
1010 | }; | ||
1011 | diff --git a/drivers/input/mouse/elan_i2c_smbus.c b/drivers/input/mouse/elan_i2c_smbus.c | ||
1012 | index 05b8695a6369..d21bd55f3c42 100644 | ||
1013 | --- a/drivers/input/mouse/elan_i2c_smbus.c | ||
1014 | +++ b/drivers/input/mouse/elan_i2c_smbus.c | ||
1015 | @@ -56,7 +56,7 @@ | ||
1016 | static int elan_smbus_initialize(struct i2c_client *client) | ||
1017 | { | ||
1018 | u8 check[ETP_SMBUS_HELLOPACKET_LEN] = { 0x55, 0x55, 0x55, 0x55, 0x55 }; | ||
1019 | - u8 values[ETP_SMBUS_HELLOPACKET_LEN] = { 0, 0, 0, 0, 0 }; | ||
1020 | + u8 values[I2C_SMBUS_BLOCK_MAX] = {0}; | ||
1021 | int len, error; | ||
1022 | |||
1023 | /* Get hello packet */ | ||
1024 | @@ -117,12 +117,16 @@ static int elan_smbus_calibrate(struct i2c_client *client) | ||
1025 | static int elan_smbus_calibrate_result(struct i2c_client *client, u8 *val) | ||
1026 | { | ||
1027 | int error; | ||
1028 | + u8 buf[I2C_SMBUS_BLOCK_MAX] = {0}; | ||
1029 | + | ||
1030 | + BUILD_BUG_ON(ETP_CALIBRATE_MAX_LEN > sizeof(buf)); | ||
1031 | |||
1032 | error = i2c_smbus_read_block_data(client, | ||
1033 | - ETP_SMBUS_CALIBRATE_QUERY, val); | ||
1034 | + ETP_SMBUS_CALIBRATE_QUERY, buf); | ||
1035 | if (error < 0) | ||
1036 | return error; | ||
1037 | |||
1038 | + memcpy(val, buf, ETP_CALIBRATE_MAX_LEN); | ||
1039 | return 0; | ||
1040 | } | ||
1041 | |||
1042 | @@ -470,6 +474,8 @@ static int elan_smbus_get_report(struct i2c_client *client, u8 *report) | ||
1043 | { | ||
1044 | int len; | ||
1045 | |||
1046 | + BUILD_BUG_ON(I2C_SMBUS_BLOCK_MAX > ETP_SMBUS_REPORT_LEN); | ||
1047 | + | ||
1048 | len = i2c_smbus_read_block_data(client, | ||
1049 | ETP_SMBUS_PACKET_QUERY, | ||
1050 | &report[ETP_SMBUS_REPORT_OFFSET]); | ||
1051 | diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c | ||
1052 | index c519c0b09568..4e77adbfa835 100644 | ||
1053 | --- a/drivers/input/mouse/elantech.c | ||
1054 | +++ b/drivers/input/mouse/elantech.c | ||
1055 | @@ -800,7 +800,7 @@ static int elantech_packet_check_v4(struct psmouse *psmouse) | ||
1056 | else if (ic_version == 7 && etd->samples[1] == 0x2A) | ||
1057 | sanity_check = ((packet[3] & 0x1c) == 0x10); | ||
1058 | else | ||
1059 | - sanity_check = ((packet[0] & 0x0c) == 0x04 && | ||
1060 | + sanity_check = ((packet[0] & 0x08) == 0x00 && | ||
1061 | (packet[3] & 0x1c) == 0x10); | ||
1062 | |||
1063 | if (!sanity_check) | ||
1064 | @@ -1173,6 +1173,12 @@ static const struct dmi_system_id elantech_dmi_has_middle_button[] = { | ||
1065 | { } | ||
1066 | }; | ||
1067 | |||
1068 | +static const char * const middle_button_pnp_ids[] = { | ||
1069 | + "LEN2131", /* ThinkPad P52 w/ NFC */ | ||
1070 | + "LEN2132", /* ThinkPad P52 */ | ||
1071 | + NULL | ||
1072 | +}; | ||
1073 | + | ||
1074 | /* | ||
1075 | * Set the appropriate event bits for the input subsystem | ||
1076 | */ | ||
1077 | @@ -1192,7 +1198,8 @@ static int elantech_set_input_params(struct psmouse *psmouse) | ||
1078 | __clear_bit(EV_REL, dev->evbit); | ||
1079 | |||
1080 | __set_bit(BTN_LEFT, dev->keybit); | ||
1081 | - if (dmi_check_system(elantech_dmi_has_middle_button)) | ||
1082 | + if (dmi_check_system(elantech_dmi_has_middle_button) || | ||
1083 | + psmouse_matches_pnp_id(psmouse, middle_button_pnp_ids)) | ||
1084 | __set_bit(BTN_MIDDLE, dev->keybit); | ||
1085 | __set_bit(BTN_RIGHT, dev->keybit); | ||
1086 | |||
1087 | diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c | ||
1088 | index 0b678b5da4c4..0f0374a4ac6e 100644 | ||
1089 | --- a/drivers/md/dm-thin.c | ||
1090 | +++ b/drivers/md/dm-thin.c | ||
1091 | @@ -1384,6 +1384,8 @@ static void schedule_external_copy(struct thin_c *tc, dm_block_t virt_block, | ||
1092 | |||
1093 | static void set_pool_mode(struct pool *pool, enum pool_mode new_mode); | ||
1094 | |||
1095 | +static void requeue_bios(struct pool *pool); | ||
1096 | + | ||
1097 | static void check_for_space(struct pool *pool) | ||
1098 | { | ||
1099 | int r; | ||
1100 | @@ -1396,8 +1398,10 @@ static void check_for_space(struct pool *pool) | ||
1101 | if (r) | ||
1102 | return; | ||
1103 | |||
1104 | - if (nr_free) | ||
1105 | + if (nr_free) { | ||
1106 | set_pool_mode(pool, PM_WRITE); | ||
1107 | + requeue_bios(pool); | ||
1108 | + } | ||
1109 | } | ||
1110 | |||
1111 | /* | ||
1112 | @@ -1474,7 +1478,10 @@ static int alloc_data_block(struct thin_c *tc, dm_block_t *result) | ||
1113 | |||
1114 | r = dm_pool_alloc_data_block(pool->pmd, result); | ||
1115 | if (r) { | ||
1116 | - metadata_operation_failed(pool, "dm_pool_alloc_data_block", r); | ||
1117 | + if (r == -ENOSPC) | ||
1118 | + set_pool_mode(pool, PM_OUT_OF_DATA_SPACE); | ||
1119 | + else | ||
1120 | + metadata_operation_failed(pool, "dm_pool_alloc_data_block", r); | ||
1121 | return r; | ||
1122 | } | ||
1123 | |||
1124 | diff --git a/drivers/md/md.c b/drivers/md/md.c | ||
1125 | index cae8f3c12e32..3bb985679f34 100644 | ||
1126 | --- a/drivers/md/md.c | ||
1127 | +++ b/drivers/md/md.c | ||
1128 | @@ -2694,7 +2694,8 @@ state_store(struct md_rdev *rdev, const char *buf, size_t len) | ||
1129 | err = 0; | ||
1130 | } | ||
1131 | } else if (cmd_match(buf, "re-add")) { | ||
1132 | - if (test_bit(Faulty, &rdev->flags) && (rdev->raid_disk == -1)) { | ||
1133 | + if (test_bit(Faulty, &rdev->flags) && (rdev->raid_disk == -1) && | ||
1134 | + rdev->saved_raid_disk >= 0) { | ||
1135 | /* clear_bit is performed _after_ all the devices | ||
1136 | * have their local Faulty bit cleared. If any writes | ||
1137 | * happen in the meantime in the local node, they | ||
1138 | @@ -8272,6 +8273,7 @@ static int remove_and_add_spares(struct mddev *mddev, | ||
1139 | if (mddev->pers->hot_remove_disk( | ||
1140 | mddev, rdev) == 0) { | ||
1141 | sysfs_unlink_rdev(mddev, rdev); | ||
1142 | + rdev->saved_raid_disk = rdev->raid_disk; | ||
1143 | rdev->raid_disk = -1; | ||
1144 | removed++; | ||
1145 | } | ||
1146 | diff --git a/drivers/media/dvb-core/dvb_frontend.c b/drivers/media/dvb-core/dvb_frontend.c | ||
1147 | index 01511e5a5566..2f054db8807b 100644 | ||
1148 | --- a/drivers/media/dvb-core/dvb_frontend.c | ||
1149 | +++ b/drivers/media/dvb-core/dvb_frontend.c | ||
1150 | @@ -251,8 +251,20 @@ static void dvb_frontend_add_event(struct dvb_frontend *fe, | ||
1151 | wake_up_interruptible (&events->wait_queue); | ||
1152 | } | ||
1153 | |||
1154 | +static int dvb_frontend_test_event(struct dvb_frontend_private *fepriv, | ||
1155 | + struct dvb_fe_events *events) | ||
1156 | +{ | ||
1157 | + int ret; | ||
1158 | + | ||
1159 | + up(&fepriv->sem); | ||
1160 | + ret = events->eventw != events->eventr; | ||
1161 | + down(&fepriv->sem); | ||
1162 | + | ||
1163 | + return ret; | ||
1164 | +} | ||
1165 | + | ||
1166 | static int dvb_frontend_get_event(struct dvb_frontend *fe, | ||
1167 | - struct dvb_frontend_event *event, int flags) | ||
1168 | + struct dvb_frontend_event *event, int flags) | ||
1169 | { | ||
1170 | struct dvb_frontend_private *fepriv = fe->frontend_priv; | ||
1171 | struct dvb_fe_events *events = &fepriv->events; | ||
1172 | @@ -270,13 +282,8 @@ static int dvb_frontend_get_event(struct dvb_frontend *fe, | ||
1173 | if (flags & O_NONBLOCK) | ||
1174 | return -EWOULDBLOCK; | ||
1175 | |||
1176 | - up(&fepriv->sem); | ||
1177 | - | ||
1178 | - ret = wait_event_interruptible (events->wait_queue, | ||
1179 | - events->eventw != events->eventr); | ||
1180 | - | ||
1181 | - if (down_interruptible (&fepriv->sem)) | ||
1182 | - return -ERESTARTSYS; | ||
1183 | + ret = wait_event_interruptible(events->wait_queue, | ||
1184 | + dvb_frontend_test_event(fepriv, events)); | ||
1185 | |||
1186 | if (ret < 0) | ||
1187 | return ret; | ||
1188 | diff --git a/drivers/media/usb/cx231xx/cx231xx-cards.c b/drivers/media/usb/cx231xx/cx231xx-cards.c | ||
1189 | index 921cf1edb3b1..69156affd0ae 100644 | ||
1190 | --- a/drivers/media/usb/cx231xx/cx231xx-cards.c | ||
1191 | +++ b/drivers/media/usb/cx231xx/cx231xx-cards.c | ||
1192 | @@ -864,6 +864,9 @@ struct usb_device_id cx231xx_id_table[] = { | ||
1193 | .driver_info = CX231XX_BOARD_CNXT_RDE_250}, | ||
1194 | {USB_DEVICE(0x0572, 0x58A0), | ||
1195 | .driver_info = CX231XX_BOARD_CNXT_RDU_250}, | ||
1196 | + /* AverMedia DVD EZMaker 7 */ | ||
1197 | + {USB_DEVICE(0x07ca, 0xc039), | ||
1198 | + .driver_info = CX231XX_BOARD_CNXT_VIDEO_GRABBER}, | ||
1199 | {USB_DEVICE(0x2040, 0xb110), | ||
1200 | .driver_info = CX231XX_BOARD_HAUPPAUGE_USB2_FM_PAL}, | ||
1201 | {USB_DEVICE(0x2040, 0xb111), | ||
1202 | diff --git a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c | ||
1203 | index a9fc64557c53..f1f697296ca0 100644 | ||
1204 | --- a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c | ||
1205 | +++ b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c | ||
1206 | @@ -864,7 +864,7 @@ static int put_v4l2_ext_controls32(struct file *file, | ||
1207 | get_user(kcontrols, &kp->controls)) | ||
1208 | return -EFAULT; | ||
1209 | |||
1210 | - if (!count) | ||
1211 | + if (!count || count > (U32_MAX/sizeof(*ucontrols))) | ||
1212 | return 0; | ||
1213 | if (get_user(p, &up->controls)) | ||
1214 | return -EFAULT; | ||
1215 | diff --git a/drivers/mfd/intel-lpss.c b/drivers/mfd/intel-lpss.c | ||
1216 | index 70c646b0097d..19ac8bc8e7ea 100644 | ||
1217 | --- a/drivers/mfd/intel-lpss.c | ||
1218 | +++ b/drivers/mfd/intel-lpss.c | ||
1219 | @@ -275,11 +275,11 @@ static void intel_lpss_init_dev(const struct intel_lpss *lpss) | ||
1220 | |||
1221 | intel_lpss_deassert_reset(lpss); | ||
1222 | |||
1223 | + intel_lpss_set_remap_addr(lpss); | ||
1224 | + | ||
1225 | if (!intel_lpss_has_idma(lpss)) | ||
1226 | return; | ||
1227 | |||
1228 | - intel_lpss_set_remap_addr(lpss); | ||
1229 | - | ||
1230 | /* Make sure that SPI multiblock DMA transfers are re-enabled */ | ||
1231 | if (lpss->type == LPSS_DEV_SPI) | ||
1232 | writel(value, lpss->priv + LPSS_PRIV_SSP_REG); | ||
1233 | diff --git a/drivers/mtd/chips/cfi_cmdset_0002.c b/drivers/mtd/chips/cfi_cmdset_0002.c | ||
1234 | index 107c05b3ddbb..33d025e42793 100644 | ||
1235 | --- a/drivers/mtd/chips/cfi_cmdset_0002.c | ||
1236 | +++ b/drivers/mtd/chips/cfi_cmdset_0002.c | ||
1237 | @@ -1876,7 +1876,7 @@ static int __xipram do_write_buffer(struct map_info *map, struct flchip *chip, | ||
1238 | if (time_after(jiffies, timeo) && !chip_ready(map, adr)) | ||
1239 | break; | ||
1240 | |||
1241 | - if (chip_ready(map, adr)) { | ||
1242 | + if (chip_good(map, adr, datum)) { | ||
1243 | xip_enable(map, chip, adr); | ||
1244 | goto op_done; | ||
1245 | } | ||
1246 | @@ -2531,7 +2531,7 @@ static int cfi_atmel_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len) | ||
1247 | |||
1248 | struct ppb_lock { | ||
1249 | struct flchip *chip; | ||
1250 | - loff_t offset; | ||
1251 | + unsigned long adr; | ||
1252 | int locked; | ||
1253 | }; | ||
1254 | |||
1255 | @@ -2549,8 +2549,9 @@ static int __maybe_unused do_ppb_xxlock(struct map_info *map, | ||
1256 | unsigned long timeo; | ||
1257 | int ret; | ||
1258 | |||
1259 | + adr += chip->start; | ||
1260 | mutex_lock(&chip->mutex); | ||
1261 | - ret = get_chip(map, chip, adr + chip->start, FL_LOCKING); | ||
1262 | + ret = get_chip(map, chip, adr, FL_LOCKING); | ||
1263 | if (ret) { | ||
1264 | mutex_unlock(&chip->mutex); | ||
1265 | return ret; | ||
1266 | @@ -2568,8 +2569,8 @@ static int __maybe_unused do_ppb_xxlock(struct map_info *map, | ||
1267 | |||
1268 | if (thunk == DO_XXLOCK_ONEBLOCK_LOCK) { | ||
1269 | chip->state = FL_LOCKING; | ||
1270 | - map_write(map, CMD(0xA0), chip->start + adr); | ||
1271 | - map_write(map, CMD(0x00), chip->start + adr); | ||
1272 | + map_write(map, CMD(0xA0), adr); | ||
1273 | + map_write(map, CMD(0x00), adr); | ||
1274 | } else if (thunk == DO_XXLOCK_ONEBLOCK_UNLOCK) { | ||
1275 | /* | ||
1276 | * Unlocking of one specific sector is not supported, so we | ||
1277 | @@ -2607,7 +2608,7 @@ static int __maybe_unused do_ppb_xxlock(struct map_info *map, | ||
1278 | map_write(map, CMD(0x00), chip->start); | ||
1279 | |||
1280 | chip->state = FL_READY; | ||
1281 | - put_chip(map, chip, adr + chip->start); | ||
1282 | + put_chip(map, chip, adr); | ||
1283 | mutex_unlock(&chip->mutex); | ||
1284 | |||
1285 | return ret; | ||
1286 | @@ -2664,9 +2665,9 @@ static int __maybe_unused cfi_ppb_unlock(struct mtd_info *mtd, loff_t ofs, | ||
1287 | * sectors shall be unlocked, so lets keep their locking | ||
1288 | * status at "unlocked" (locked=0) for the final re-locking. | ||
1289 | */ | ||
1290 | - if ((adr < ofs) || (adr >= (ofs + len))) { | ||
1291 | + if ((offset < ofs) || (offset >= (ofs + len))) { | ||
1292 | sect[sectors].chip = &cfi->chips[chipnum]; | ||
1293 | - sect[sectors].offset = offset; | ||
1294 | + sect[sectors].adr = adr; | ||
1295 | sect[sectors].locked = do_ppb_xxlock( | ||
1296 | map, &cfi->chips[chipnum], adr, 0, | ||
1297 | DO_XXLOCK_ONEBLOCK_GETLOCK); | ||
1298 | @@ -2680,6 +2681,8 @@ static int __maybe_unused cfi_ppb_unlock(struct mtd_info *mtd, loff_t ofs, | ||
1299 | i++; | ||
1300 | |||
1301 | if (adr >> cfi->chipshift) { | ||
1302 | + if (offset >= (ofs + len)) | ||
1303 | + break; | ||
1304 | adr = 0; | ||
1305 | chipnum++; | ||
1306 | |||
1307 | @@ -2710,7 +2713,7 @@ static int __maybe_unused cfi_ppb_unlock(struct mtd_info *mtd, loff_t ofs, | ||
1308 | */ | ||
1309 | for (i = 0; i < sectors; i++) { | ||
1310 | if (sect[i].locked) | ||
1311 | - do_ppb_xxlock(map, sect[i].chip, sect[i].offset, 0, | ||
1312 | + do_ppb_xxlock(map, sect[i].chip, sect[i].adr, 0, | ||
1313 | DO_XXLOCK_ONEBLOCK_LOCK); | ||
1314 | } | ||
1315 | |||
1316 | diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c | ||
1317 | index 6cb5ca52cb5a..ad2b57c6b13f 100644 | ||
1318 | --- a/drivers/mtd/ubi/build.c | ||
1319 | +++ b/drivers/mtd/ubi/build.c | ||
1320 | @@ -1137,6 +1137,9 @@ int ubi_detach_mtd_dev(int ubi_num, int anyway) | ||
1321 | */ | ||
1322 | get_device(&ubi->dev); | ||
1323 | |||
1324 | +#ifdef CONFIG_MTD_UBI_FASTMAP | ||
1325 | + cancel_work_sync(&ubi->fm_work); | ||
1326 | +#endif | ||
1327 | ubi_debugfs_exit_dev(ubi); | ||
1328 | uif_close(ubi); | ||
1329 | |||
1330 | diff --git a/drivers/mtd/ubi/eba.c b/drivers/mtd/ubi/eba.c | ||
1331 | index 388e46be6ad9..d0884bd9d955 100644 | ||
1332 | --- a/drivers/mtd/ubi/eba.c | ||
1333 | +++ b/drivers/mtd/ubi/eba.c | ||
1334 | @@ -490,6 +490,82 @@ int ubi_eba_unmap_leb(struct ubi_device *ubi, struct ubi_volume *vol, | ||
1335 | return err; | ||
1336 | } | ||
1337 | |||
1338 | +#ifdef CONFIG_MTD_UBI_FASTMAP | ||
1339 | +/** | ||
1340 | + * check_mapping - check and fixup a mapping | ||
1341 | + * @ubi: UBI device description object | ||
1342 | + * @vol: volume description object | ||
1343 | + * @lnum: logical eraseblock number | ||
1344 | + * @pnum: physical eraseblock number | ||
1345 | + * | ||
1346 | + * Checks whether a given mapping is valid. Fastmap cannot track LEB unmap | ||
1347 | + * operations, if such an operation is interrupted the mapping still looks | ||
1348 | + * good, but upon first read an ECC is reported to the upper layer. | ||
1349 | + * Normaly during the full-scan at attach time this is fixed, for Fastmap | ||
1350 | + * we have to deal with it while reading. | ||
1351 | + * If the PEB behind a LEB shows this symthom we change the mapping to | ||
1352 | + * %UBI_LEB_UNMAPPED and schedule the PEB for erasure. | ||
1353 | + * | ||
1354 | + * Returns 0 on success, negative error code in case of failure. | ||
1355 | + */ | ||
1356 | +static int check_mapping(struct ubi_device *ubi, struct ubi_volume *vol, int lnum, | ||
1357 | + int *pnum) | ||
1358 | +{ | ||
1359 | + int err; | ||
1360 | + struct ubi_vid_io_buf *vidb; | ||
1361 | + | ||
1362 | + if (!ubi->fast_attach) | ||
1363 | + return 0; | ||
1364 | + | ||
1365 | + vidb = ubi_alloc_vid_buf(ubi, GFP_NOFS); | ||
1366 | + if (!vidb) | ||
1367 | + return -ENOMEM; | ||
1368 | + | ||
1369 | + err = ubi_io_read_vid_hdr(ubi, *pnum, vidb, 0); | ||
1370 | + if (err > 0 && err != UBI_IO_BITFLIPS) { | ||
1371 | + int torture = 0; | ||
1372 | + | ||
1373 | + switch (err) { | ||
1374 | + case UBI_IO_FF: | ||
1375 | + case UBI_IO_FF_BITFLIPS: | ||
1376 | + case UBI_IO_BAD_HDR: | ||
1377 | + case UBI_IO_BAD_HDR_EBADMSG: | ||
1378 | + break; | ||
1379 | + default: | ||
1380 | + ubi_assert(0); | ||
1381 | + } | ||
1382 | + | ||
1383 | + if (err == UBI_IO_BAD_HDR_EBADMSG || err == UBI_IO_FF_BITFLIPS) | ||
1384 | + torture = 1; | ||
1385 | + | ||
1386 | + down_read(&ubi->fm_eba_sem); | ||
1387 | + vol->eba_tbl->entries[lnum].pnum = UBI_LEB_UNMAPPED; | ||
1388 | + up_read(&ubi->fm_eba_sem); | ||
1389 | + ubi_wl_put_peb(ubi, vol->vol_id, lnum, *pnum, torture); | ||
1390 | + | ||
1391 | + *pnum = UBI_LEB_UNMAPPED; | ||
1392 | + } else if (err < 0) { | ||
1393 | + ubi_err(ubi, "unable to read VID header back from PEB %i: %i", | ||
1394 | + *pnum, err); | ||
1395 | + | ||
1396 | + goto out_free; | ||
1397 | + } | ||
1398 | + | ||
1399 | + err = 0; | ||
1400 | + | ||
1401 | +out_free: | ||
1402 | + ubi_free_vid_buf(vidb); | ||
1403 | + | ||
1404 | + return err; | ||
1405 | +} | ||
1406 | +#else | ||
1407 | +static int check_mapping(struct ubi_device *ubi, struct ubi_volume *vol, int lnum, | ||
1408 | + int *pnum) | ||
1409 | +{ | ||
1410 | + return 0; | ||
1411 | +} | ||
1412 | +#endif | ||
1413 | + | ||
1414 | /** | ||
1415 | * ubi_eba_read_leb - read data. | ||
1416 | * @ubi: UBI device description object | ||
1417 | @@ -522,7 +598,13 @@ int ubi_eba_read_leb(struct ubi_device *ubi, struct ubi_volume *vol, int lnum, | ||
1418 | return err; | ||
1419 | |||
1420 | pnum = vol->eba_tbl->entries[lnum].pnum; | ||
1421 | - if (pnum < 0) { | ||
1422 | + if (pnum >= 0) { | ||
1423 | + err = check_mapping(ubi, vol, lnum, &pnum); | ||
1424 | + if (err < 0) | ||
1425 | + goto out_unlock; | ||
1426 | + } | ||
1427 | + | ||
1428 | + if (pnum == UBI_LEB_UNMAPPED) { | ||
1429 | /* | ||
1430 | * The logical eraseblock is not mapped, fill the whole buffer | ||
1431 | * with 0xFF bytes. The exception is static volumes for which | ||
1432 | @@ -930,6 +1012,12 @@ int ubi_eba_write_leb(struct ubi_device *ubi, struct ubi_volume *vol, int lnum, | ||
1433 | return err; | ||
1434 | |||
1435 | pnum = vol->eba_tbl->entries[lnum].pnum; | ||
1436 | + if (pnum >= 0) { | ||
1437 | + err = check_mapping(ubi, vol, lnum, &pnum); | ||
1438 | + if (err < 0) | ||
1439 | + goto out; | ||
1440 | + } | ||
1441 | + | ||
1442 | if (pnum >= 0) { | ||
1443 | dbg_eba("write %d bytes at offset %d of LEB %d:%d, PEB %d", | ||
1444 | len, offset, vol_id, lnum, pnum); | ||
1445 | diff --git a/drivers/mtd/ubi/wl.c b/drivers/mtd/ubi/wl.c | ||
1446 | index 668b46202507..23a6986d512b 100644 | ||
1447 | --- a/drivers/mtd/ubi/wl.c | ||
1448 | +++ b/drivers/mtd/ubi/wl.c | ||
1449 | @@ -1505,6 +1505,7 @@ int ubi_thread(void *u) | ||
1450 | } | ||
1451 | |||
1452 | dbg_wl("background thread \"%s\" is killed", ubi->bgt_name); | ||
1453 | + ubi->thread_enabled = 0; | ||
1454 | return 0; | ||
1455 | } | ||
1456 | |||
1457 | @@ -1514,9 +1515,6 @@ int ubi_thread(void *u) | ||
1458 | */ | ||
1459 | static void shutdown_work(struct ubi_device *ubi) | ||
1460 | { | ||
1461 | -#ifdef CONFIG_MTD_UBI_FASTMAP | ||
1462 | - flush_work(&ubi->fm_work); | ||
1463 | -#endif | ||
1464 | while (!list_empty(&ubi->works)) { | ||
1465 | struct ubi_work *wrk; | ||
1466 | |||
1467 | diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c | ||
1468 | index feb61eaffe32..3086cae62fdc 100644 | ||
1469 | --- a/drivers/net/usb/cdc_ncm.c | ||
1470 | +++ b/drivers/net/usb/cdc_ncm.c | ||
1471 | @@ -1124,7 +1124,7 @@ cdc_ncm_fill_tx_frame(struct usbnet *dev, struct sk_buff *skb, __le32 sign) | ||
1472 | * accordingly. Otherwise, we should check here. | ||
1473 | */ | ||
1474 | if (ctx->drvflags & CDC_NCM_FLAG_NDP_TO_END) | ||
1475 | - delayed_ndp_size = ctx->max_ndp_size; | ||
1476 | + delayed_ndp_size = ALIGN(ctx->max_ndp_size, ctx->tx_ndp_modulus); | ||
1477 | else | ||
1478 | delayed_ndp_size = 0; | ||
1479 | |||
1480 | @@ -1257,7 +1257,7 @@ cdc_ncm_fill_tx_frame(struct usbnet *dev, struct sk_buff *skb, __le32 sign) | ||
1481 | /* If requested, put NDP at end of frame. */ | ||
1482 | if (ctx->drvflags & CDC_NCM_FLAG_NDP_TO_END) { | ||
1483 | nth16 = (struct usb_cdc_ncm_nth16 *)skb_out->data; | ||
1484 | - cdc_ncm_align_tail(skb_out, ctx->tx_ndp_modulus, 0, ctx->tx_max); | ||
1485 | + cdc_ncm_align_tail(skb_out, ctx->tx_ndp_modulus, 0, ctx->tx_max - ctx->max_ndp_size); | ||
1486 | nth16->wNdpIndex = cpu_to_le16(skb_out->len); | ||
1487 | memcpy(skb_put(skb_out, ctx->max_ndp_size), ctx->delayed_ndp16, ctx->max_ndp_size); | ||
1488 | |||
1489 | diff --git a/drivers/nvdimm/bus.c b/drivers/nvdimm/bus.c | ||
1490 | index 8311a93cabd8..c1a65ce31243 100644 | ||
1491 | --- a/drivers/nvdimm/bus.c | ||
1492 | +++ b/drivers/nvdimm/bus.c | ||
1493 | @@ -505,14 +505,18 @@ int nvdimm_revalidate_disk(struct gendisk *disk) | ||
1494 | { | ||
1495 | struct device *dev = disk_to_dev(disk)->parent; | ||
1496 | struct nd_region *nd_region = to_nd_region(dev->parent); | ||
1497 | - const char *pol = nd_region->ro ? "only" : "write"; | ||
1498 | + int disk_ro = get_disk_ro(disk); | ||
1499 | |||
1500 | - if (nd_region->ro == get_disk_ro(disk)) | ||
1501 | + /* | ||
1502 | + * Upgrade to read-only if the region is read-only preserve as | ||
1503 | + * read-only if the disk is already read-only. | ||
1504 | + */ | ||
1505 | + if (disk_ro || nd_region->ro == disk_ro) | ||
1506 | return 0; | ||
1507 | |||
1508 | - dev_info(dev, "%s read-%s, marking %s read-%s\n", | ||
1509 | - dev_name(&nd_region->dev), pol, disk->disk_name, pol); | ||
1510 | - set_disk_ro(disk, nd_region->ro); | ||
1511 | + dev_info(dev, "%s read-only, marking %s read-only\n", | ||
1512 | + dev_name(&nd_region->dev), disk->disk_name); | ||
1513 | + set_disk_ro(disk, 1); | ||
1514 | |||
1515 | return 0; | ||
1516 | |||
1517 | diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c | ||
1518 | index 53c83d66eb7e..90b5a898d6b1 100644 | ||
1519 | --- a/drivers/of/unittest.c | ||
1520 | +++ b/drivers/of/unittest.c | ||
1521 | @@ -155,20 +155,20 @@ static void __init of_unittest_dynamic(void) | ||
1522 | /* Add a new property - should pass*/ | ||
1523 | prop->name = "new-property"; | ||
1524 | prop->value = "new-property-data"; | ||
1525 | - prop->length = strlen(prop->value); | ||
1526 | + prop->length = strlen(prop->value) + 1; | ||
1527 | unittest(of_add_property(np, prop) == 0, "Adding a new property failed\n"); | ||
1528 | |||
1529 | /* Try to add an existing property - should fail */ | ||
1530 | prop++; | ||
1531 | prop->name = "new-property"; | ||
1532 | prop->value = "new-property-data-should-fail"; | ||
1533 | - prop->length = strlen(prop->value); | ||
1534 | + prop->length = strlen(prop->value) + 1; | ||
1535 | unittest(of_add_property(np, prop) != 0, | ||
1536 | "Adding an existing property should have failed\n"); | ||
1537 | |||
1538 | /* Try to modify an existing property - should pass */ | ||
1539 | prop->value = "modify-property-data-should-pass"; | ||
1540 | - prop->length = strlen(prop->value); | ||
1541 | + prop->length = strlen(prop->value) + 1; | ||
1542 | unittest(of_update_property(np, prop) == 0, | ||
1543 | "Updating an existing property should have passed\n"); | ||
1544 | |||
1545 | @@ -176,7 +176,7 @@ static void __init of_unittest_dynamic(void) | ||
1546 | prop++; | ||
1547 | prop->name = "modify-property"; | ||
1548 | prop->value = "modify-missing-property-data-should-pass"; | ||
1549 | - prop->length = strlen(prop->value); | ||
1550 | + prop->length = strlen(prop->value) + 1; | ||
1551 | unittest(of_update_property(np, prop) == 0, | ||
1552 | "Updating a missing property should have passed\n"); | ||
1553 | |||
1554 | diff --git a/drivers/pci/hotplug/pciehp.h b/drivers/pci/hotplug/pciehp.h | ||
1555 | index 37d70b5ad22f..2bba8481beb1 100644 | ||
1556 | --- a/drivers/pci/hotplug/pciehp.h | ||
1557 | +++ b/drivers/pci/hotplug/pciehp.h | ||
1558 | @@ -134,7 +134,7 @@ struct controller *pcie_init(struct pcie_device *dev); | ||
1559 | int pcie_init_notification(struct controller *ctrl); | ||
1560 | int pciehp_enable_slot(struct slot *p_slot); | ||
1561 | int pciehp_disable_slot(struct slot *p_slot); | ||
1562 | -void pcie_enable_notification(struct controller *ctrl); | ||
1563 | +void pcie_reenable_notification(struct controller *ctrl); | ||
1564 | int pciehp_power_on_slot(struct slot *slot); | ||
1565 | void pciehp_power_off_slot(struct slot *slot); | ||
1566 | void pciehp_get_power_status(struct slot *slot, u8 *status); | ||
1567 | diff --git a/drivers/pci/hotplug/pciehp_core.c b/drivers/pci/hotplug/pciehp_core.c | ||
1568 | index 7d32fa33dcef..6620b1095046 100644 | ||
1569 | --- a/drivers/pci/hotplug/pciehp_core.c | ||
1570 | +++ b/drivers/pci/hotplug/pciehp_core.c | ||
1571 | @@ -297,7 +297,7 @@ static int pciehp_resume(struct pcie_device *dev) | ||
1572 | ctrl = get_service_data(dev); | ||
1573 | |||
1574 | /* reinitialize the chipset's event detection logic */ | ||
1575 | - pcie_enable_notification(ctrl); | ||
1576 | + pcie_reenable_notification(ctrl); | ||
1577 | |||
1578 | slot = ctrl->slot; | ||
1579 | |||
1580 | diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c | ||
1581 | index d08dfc8b9ba9..8d811ea353c8 100644 | ||
1582 | --- a/drivers/pci/hotplug/pciehp_hpc.c | ||
1583 | +++ b/drivers/pci/hotplug/pciehp_hpc.c | ||
1584 | @@ -673,7 +673,7 @@ static irqreturn_t pcie_isr(int irq, void *dev_id) | ||
1585 | return handled; | ||
1586 | } | ||
1587 | |||
1588 | -void pcie_enable_notification(struct controller *ctrl) | ||
1589 | +static void pcie_enable_notification(struct controller *ctrl) | ||
1590 | { | ||
1591 | u16 cmd, mask; | ||
1592 | |||
1593 | @@ -711,6 +711,17 @@ void pcie_enable_notification(struct controller *ctrl) | ||
1594 | pci_pcie_cap(ctrl->pcie->port) + PCI_EXP_SLTCTL, cmd); | ||
1595 | } | ||
1596 | |||
1597 | +void pcie_reenable_notification(struct controller *ctrl) | ||
1598 | +{ | ||
1599 | + /* | ||
1600 | + * Clear both Presence and Data Link Layer Changed to make sure | ||
1601 | + * those events still fire after we have re-enabled them. | ||
1602 | + */ | ||
1603 | + pcie_capability_write_word(ctrl->pcie->port, PCI_EXP_SLTSTA, | ||
1604 | + PCI_EXP_SLTSTA_PDC | PCI_EXP_SLTSTA_DLLSC); | ||
1605 | + pcie_enable_notification(ctrl); | ||
1606 | +} | ||
1607 | + | ||
1608 | static void pcie_disable_notification(struct controller *ctrl) | ||
1609 | { | ||
1610 | u16 mask; | ||
1611 | diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c | ||
1612 | index b55f9179c94e..a05d143ac43b 100644 | ||
1613 | --- a/drivers/pci/quirks.c | ||
1614 | +++ b/drivers/pci/quirks.c | ||
1615 | @@ -4225,11 +4225,29 @@ static int pci_quirk_qcom_rp_acs(struct pci_dev *dev, u16 acs_flags) | ||
1616 | * 0xa290-0xa29f PCI Express Root port #{0-16} | ||
1617 | * 0xa2e7-0xa2ee PCI Express Root port #{17-24} | ||
1618 | * | ||
1619 | + * Mobile chipsets are also affected, 7th & 8th Generation | ||
1620 | + * Specification update confirms ACS errata 22, status no fix: (7th Generation | ||
1621 | + * Intel Processor Family I/O for U/Y Platforms and 8th Generation Intel | ||
1622 | + * Processor Family I/O for U Quad Core Platforms Specification Update, | ||
1623 | + * August 2017, Revision 002, Document#: 334660-002)[6] | ||
1624 | + * Device IDs from I/O datasheet: (7th Generation Intel Processor Family I/O | ||
1625 | + * for U/Y Platforms and 8th Generation Intel ® Processor Family I/O for U | ||
1626 | + * Quad Core Platforms, Vol 1 of 2, August 2017, Document#: 334658-003)[7] | ||
1627 | + * | ||
1628 | + * 0x9d10-0x9d1b PCI Express Root port #{1-12} | ||
1629 | + * | ||
1630 | + * The 300 series chipset suffers from the same bug so include those root | ||
1631 | + * ports here as well. | ||
1632 | + * | ||
1633 | + * 0xa32c-0xa343 PCI Express Root port #{0-24} | ||
1634 | + * | ||
1635 | * [1] http://www.intel.com/content/www/us/en/chipsets/100-series-chipset-datasheet-vol-2.html | ||
1636 | * [2] http://www.intel.com/content/www/us/en/chipsets/100-series-chipset-datasheet-vol-1.html | ||
1637 | * [3] http://www.intel.com/content/www/us/en/chipsets/100-series-chipset-spec-update.html | ||
1638 | * [4] http://www.intel.com/content/www/us/en/chipsets/200-series-chipset-pch-spec-update.html | ||
1639 | * [5] http://www.intel.com/content/www/us/en/chipsets/200-series-chipset-pch-datasheet-vol-1.html | ||
1640 | + * [6] https://www.intel.com/content/www/us/en/processors/core/7th-gen-core-family-mobile-u-y-processor-lines-i-o-spec-update.html | ||
1641 | + * [7] https://www.intel.com/content/www/us/en/processors/core/7th-gen-core-family-mobile-u-y-processor-lines-i-o-datasheet-vol-1.html | ||
1642 | */ | ||
1643 | static bool pci_quirk_intel_spt_pch_acs_match(struct pci_dev *dev) | ||
1644 | { | ||
1645 | @@ -4239,6 +4257,8 @@ static bool pci_quirk_intel_spt_pch_acs_match(struct pci_dev *dev) | ||
1646 | switch (dev->device) { | ||
1647 | case 0xa110 ... 0xa11f: case 0xa167 ... 0xa16a: /* Sunrise Point */ | ||
1648 | case 0xa290 ... 0xa29f: case 0xa2e7 ... 0xa2ee: /* Union Point */ | ||
1649 | + case 0x9d10 ... 0x9d1b: /* 7th & 8th Gen Mobile */ | ||
1650 | + case 0xa32c ... 0xa343: /* 300 series */ | ||
1651 | return true; | ||
1652 | } | ||
1653 | |||
1654 | diff --git a/drivers/pwm/pwm-lpss-platform.c b/drivers/pwm/pwm-lpss-platform.c | ||
1655 | index 54433fc6d1a4..e4eaefc2a2ef 100644 | ||
1656 | --- a/drivers/pwm/pwm-lpss-platform.c | ||
1657 | +++ b/drivers/pwm/pwm-lpss-platform.c | ||
1658 | @@ -52,6 +52,10 @@ static int pwm_lpss_remove_platform(struct platform_device *pdev) | ||
1659 | return pwm_lpss_remove(lpwm); | ||
1660 | } | ||
1661 | |||
1662 | +static SIMPLE_DEV_PM_OPS(pwm_lpss_platform_pm_ops, | ||
1663 | + pwm_lpss_suspend, | ||
1664 | + pwm_lpss_resume); | ||
1665 | + | ||
1666 | static const struct acpi_device_id pwm_lpss_acpi_match[] = { | ||
1667 | { "80860F09", (unsigned long)&pwm_lpss_byt_info }, | ||
1668 | { "80862288", (unsigned long)&pwm_lpss_bsw_info }, | ||
1669 | @@ -64,6 +68,7 @@ static struct platform_driver pwm_lpss_driver_platform = { | ||
1670 | .driver = { | ||
1671 | .name = "pwm-lpss", | ||
1672 | .acpi_match_table = pwm_lpss_acpi_match, | ||
1673 | + .pm = &pwm_lpss_platform_pm_ops, | ||
1674 | }, | ||
1675 | .probe = pwm_lpss_probe_platform, | ||
1676 | .remove = pwm_lpss_remove_platform, | ||
1677 | diff --git a/drivers/pwm/pwm-lpss.c b/drivers/pwm/pwm-lpss.c | ||
1678 | index 72c0bce5a75c..5208b3f80ad8 100644 | ||
1679 | --- a/drivers/pwm/pwm-lpss.c | ||
1680 | +++ b/drivers/pwm/pwm-lpss.c | ||
1681 | @@ -31,10 +31,13 @@ | ||
1682 | /* Size of each PWM register space if multiple */ | ||
1683 | #define PWM_SIZE 0x400 | ||
1684 | |||
1685 | +#define MAX_PWMS 4 | ||
1686 | + | ||
1687 | struct pwm_lpss_chip { | ||
1688 | struct pwm_chip chip; | ||
1689 | void __iomem *regs; | ||
1690 | const struct pwm_lpss_boardinfo *info; | ||
1691 | + u32 saved_ctrl[MAX_PWMS]; | ||
1692 | }; | ||
1693 | |||
1694 | /* BayTrail */ | ||
1695 | @@ -168,6 +171,9 @@ struct pwm_lpss_chip *pwm_lpss_probe(struct device *dev, struct resource *r, | ||
1696 | unsigned long c; | ||
1697 | int ret; | ||
1698 | |||
1699 | + if (WARN_ON(info->npwm > MAX_PWMS)) | ||
1700 | + return ERR_PTR(-ENODEV); | ||
1701 | + | ||
1702 | lpwm = devm_kzalloc(dev, sizeof(*lpwm), GFP_KERNEL); | ||
1703 | if (!lpwm) | ||
1704 | return ERR_PTR(-ENOMEM); | ||
1705 | @@ -203,6 +209,30 @@ int pwm_lpss_remove(struct pwm_lpss_chip *lpwm) | ||
1706 | } | ||
1707 | EXPORT_SYMBOL_GPL(pwm_lpss_remove); | ||
1708 | |||
1709 | +int pwm_lpss_suspend(struct device *dev) | ||
1710 | +{ | ||
1711 | + struct pwm_lpss_chip *lpwm = dev_get_drvdata(dev); | ||
1712 | + int i; | ||
1713 | + | ||
1714 | + for (i = 0; i < lpwm->info->npwm; i++) | ||
1715 | + lpwm->saved_ctrl[i] = readl(lpwm->regs + i * PWM_SIZE + PWM); | ||
1716 | + | ||
1717 | + return 0; | ||
1718 | +} | ||
1719 | +EXPORT_SYMBOL_GPL(pwm_lpss_suspend); | ||
1720 | + | ||
1721 | +int pwm_lpss_resume(struct device *dev) | ||
1722 | +{ | ||
1723 | + struct pwm_lpss_chip *lpwm = dev_get_drvdata(dev); | ||
1724 | + int i; | ||
1725 | + | ||
1726 | + for (i = 0; i < lpwm->info->npwm; i++) | ||
1727 | + writel(lpwm->saved_ctrl[i], lpwm->regs + i * PWM_SIZE + PWM); | ||
1728 | + | ||
1729 | + return 0; | ||
1730 | +} | ||
1731 | +EXPORT_SYMBOL_GPL(pwm_lpss_resume); | ||
1732 | + | ||
1733 | MODULE_DESCRIPTION("PWM driver for Intel LPSS"); | ||
1734 | MODULE_AUTHOR("Mika Westerberg <mika.westerberg@linux.intel.com>"); | ||
1735 | MODULE_LICENSE("GPL v2"); | ||
1736 | diff --git a/drivers/pwm/pwm-lpss.h b/drivers/pwm/pwm-lpss.h | ||
1737 | index 04766e0d41aa..27d5081ec218 100644 | ||
1738 | --- a/drivers/pwm/pwm-lpss.h | ||
1739 | +++ b/drivers/pwm/pwm-lpss.h | ||
1740 | @@ -31,5 +31,7 @@ extern const struct pwm_lpss_boardinfo pwm_lpss_bxt_info; | ||
1741 | struct pwm_lpss_chip *pwm_lpss_probe(struct device *dev, struct resource *r, | ||
1742 | const struct pwm_lpss_boardinfo *info); | ||
1743 | int pwm_lpss_remove(struct pwm_lpss_chip *lpwm); | ||
1744 | +int pwm_lpss_suspend(struct device *dev); | ||
1745 | +int pwm_lpss_resume(struct device *dev); | ||
1746 | |||
1747 | #endif /* __PWM_LPSS_H */ | ||
1748 | diff --git a/drivers/rpmsg/qcom_smd.c b/drivers/rpmsg/qcom_smd.c | ||
1749 | index 1d4770c02e57..fd3d9419c468 100644 | ||
1750 | --- a/drivers/rpmsg/qcom_smd.c | ||
1751 | +++ b/drivers/rpmsg/qcom_smd.c | ||
1752 | @@ -1006,12 +1006,12 @@ static struct qcom_smd_channel *qcom_smd_create_channel(struct qcom_smd_edge *ed | ||
1753 | void *info; | ||
1754 | int ret; | ||
1755 | |||
1756 | - channel = devm_kzalloc(&edge->dev, sizeof(*channel), GFP_KERNEL); | ||
1757 | + channel = kzalloc(sizeof(*channel), GFP_KERNEL); | ||
1758 | if (!channel) | ||
1759 | return ERR_PTR(-ENOMEM); | ||
1760 | |||
1761 | channel->edge = edge; | ||
1762 | - channel->name = devm_kstrdup(&edge->dev, name, GFP_KERNEL); | ||
1763 | + channel->name = kstrdup(name, GFP_KERNEL); | ||
1764 | if (!channel->name) | ||
1765 | return ERR_PTR(-ENOMEM); | ||
1766 | |||
1767 | @@ -1061,8 +1061,8 @@ static struct qcom_smd_channel *qcom_smd_create_channel(struct qcom_smd_edge *ed | ||
1768 | return channel; | ||
1769 | |||
1770 | free_name_and_channel: | ||
1771 | - devm_kfree(&edge->dev, channel->name); | ||
1772 | - devm_kfree(&edge->dev, channel); | ||
1773 | + kfree(channel->name); | ||
1774 | + kfree(channel); | ||
1775 | |||
1776 | return ERR_PTR(ret); | ||
1777 | } | ||
1778 | @@ -1279,13 +1279,13 @@ static int qcom_smd_parse_edge(struct device *dev, | ||
1779 | */ | ||
1780 | static void qcom_smd_edge_release(struct device *dev) | ||
1781 | { | ||
1782 | - struct qcom_smd_channel *channel; | ||
1783 | + struct qcom_smd_channel *channel, *tmp; | ||
1784 | struct qcom_smd_edge *edge = to_smd_edge(dev); | ||
1785 | |||
1786 | - list_for_each_entry(channel, &edge->channels, list) { | ||
1787 | - SET_RX_CHANNEL_INFO(channel, state, SMD_CHANNEL_CLOSED); | ||
1788 | - SET_RX_CHANNEL_INFO(channel, head, 0); | ||
1789 | - SET_RX_CHANNEL_INFO(channel, tail, 0); | ||
1790 | + list_for_each_entry_safe(channel, tmp, &edge->channels, list) { | ||
1791 | + list_del(&channel->list); | ||
1792 | + kfree(channel->name); | ||
1793 | + kfree(channel); | ||
1794 | } | ||
1795 | |||
1796 | kfree(edge); | ||
1797 | diff --git a/drivers/s390/scsi/zfcp_dbf.c b/drivers/s390/scsi/zfcp_dbf.c | ||
1798 | index 4534a7ce77b8..b6caad0fee24 100644 | ||
1799 | --- a/drivers/s390/scsi/zfcp_dbf.c | ||
1800 | +++ b/drivers/s390/scsi/zfcp_dbf.c | ||
1801 | @@ -625,6 +625,46 @@ void zfcp_dbf_scsi(char *tag, int level, struct scsi_cmnd *sc, | ||
1802 | spin_unlock_irqrestore(&dbf->scsi_lock, flags); | ||
1803 | } | ||
1804 | |||
1805 | +/** | ||
1806 | + * zfcp_dbf_scsi_eh() - Trace event for special cases of scsi_eh callbacks. | ||
1807 | + * @tag: Identifier for event. | ||
1808 | + * @adapter: Pointer to zfcp adapter as context for this event. | ||
1809 | + * @scsi_id: SCSI ID/target to indicate scope of task management function (TMF). | ||
1810 | + * @ret: Return value of calling function. | ||
1811 | + * | ||
1812 | + * This SCSI trace variant does not depend on any of: | ||
1813 | + * scsi_cmnd, zfcp_fsf_req, scsi_device. | ||
1814 | + */ | ||
1815 | +void zfcp_dbf_scsi_eh(char *tag, struct zfcp_adapter *adapter, | ||
1816 | + unsigned int scsi_id, int ret) | ||
1817 | +{ | ||
1818 | + struct zfcp_dbf *dbf = adapter->dbf; | ||
1819 | + struct zfcp_dbf_scsi *rec = &dbf->scsi_buf; | ||
1820 | + unsigned long flags; | ||
1821 | + static int const level = 1; | ||
1822 | + | ||
1823 | + if (unlikely(!debug_level_enabled(adapter->dbf->scsi, level))) | ||
1824 | + return; | ||
1825 | + | ||
1826 | + spin_lock_irqsave(&dbf->scsi_lock, flags); | ||
1827 | + memset(rec, 0, sizeof(*rec)); | ||
1828 | + | ||
1829 | + memcpy(rec->tag, tag, ZFCP_DBF_TAG_LEN); | ||
1830 | + rec->id = ZFCP_DBF_SCSI_CMND; | ||
1831 | + rec->scsi_result = ret; /* re-use field, int is 4 bytes and fits */ | ||
1832 | + rec->scsi_retries = ~0; | ||
1833 | + rec->scsi_allowed = ~0; | ||
1834 | + rec->fcp_rsp_info = ~0; | ||
1835 | + rec->scsi_id = scsi_id; | ||
1836 | + rec->scsi_lun = (u32)ZFCP_DBF_INVALID_LUN; | ||
1837 | + rec->scsi_lun_64_hi = (u32)(ZFCP_DBF_INVALID_LUN >> 32); | ||
1838 | + rec->host_scribble = ~0; | ||
1839 | + memset(rec->scsi_opcode, 0xff, ZFCP_DBF_SCSI_OPCODE); | ||
1840 | + | ||
1841 | + debug_event(dbf->scsi, level, rec, sizeof(*rec)); | ||
1842 | + spin_unlock_irqrestore(&dbf->scsi_lock, flags); | ||
1843 | +} | ||
1844 | + | ||
1845 | static debug_info_t *zfcp_dbf_reg(const char *name, int size, int rec_size) | ||
1846 | { | ||
1847 | struct debug_info *d; | ||
1848 | diff --git a/drivers/s390/scsi/zfcp_erp.c b/drivers/s390/scsi/zfcp_erp.c | ||
1849 | index 3b23d6754598..2abcd331b05d 100644 | ||
1850 | --- a/drivers/s390/scsi/zfcp_erp.c | ||
1851 | +++ b/drivers/s390/scsi/zfcp_erp.c | ||
1852 | @@ -34,11 +34,28 @@ enum zfcp_erp_steps { | ||
1853 | ZFCP_ERP_STEP_LUN_OPENING = 0x2000, | ||
1854 | }; | ||
1855 | |||
1856 | +/** | ||
1857 | + * enum zfcp_erp_act_type - Type of ERP action object. | ||
1858 | + * @ZFCP_ERP_ACTION_REOPEN_LUN: LUN recovery. | ||
1859 | + * @ZFCP_ERP_ACTION_REOPEN_PORT: Port recovery. | ||
1860 | + * @ZFCP_ERP_ACTION_REOPEN_PORT_FORCED: Forced port recovery. | ||
1861 | + * @ZFCP_ERP_ACTION_REOPEN_ADAPTER: Adapter recovery. | ||
1862 | + * @ZFCP_ERP_ACTION_NONE: Eyecatcher pseudo flag to bitwise or-combine with | ||
1863 | + * either of the first four enum values. | ||
1864 | + * Used to indicate that an ERP action could not be | ||
1865 | + * set up despite a detected need for some recovery. | ||
1866 | + * @ZFCP_ERP_ACTION_FAILED: Eyecatcher pseudo flag to bitwise or-combine with | ||
1867 | + * either of the first four enum values. | ||
1868 | + * Used to indicate that ERP not needed because | ||
1869 | + * the object has ZFCP_STATUS_COMMON_ERP_FAILED. | ||
1870 | + */ | ||
1871 | enum zfcp_erp_act_type { | ||
1872 | ZFCP_ERP_ACTION_REOPEN_LUN = 1, | ||
1873 | ZFCP_ERP_ACTION_REOPEN_PORT = 2, | ||
1874 | ZFCP_ERP_ACTION_REOPEN_PORT_FORCED = 3, | ||
1875 | ZFCP_ERP_ACTION_REOPEN_ADAPTER = 4, | ||
1876 | + ZFCP_ERP_ACTION_NONE = 0xc0, | ||
1877 | + ZFCP_ERP_ACTION_FAILED = 0xe0, | ||
1878 | }; | ||
1879 | |||
1880 | enum zfcp_erp_act_state { | ||
1881 | @@ -125,6 +142,49 @@ static void zfcp_erp_action_dismiss_adapter(struct zfcp_adapter *adapter) | ||
1882 | } | ||
1883 | } | ||
1884 | |||
1885 | +static int zfcp_erp_handle_failed(int want, struct zfcp_adapter *adapter, | ||
1886 | + struct zfcp_port *port, | ||
1887 | + struct scsi_device *sdev) | ||
1888 | +{ | ||
1889 | + int need = want; | ||
1890 | + struct zfcp_scsi_dev *zsdev; | ||
1891 | + | ||
1892 | + switch (want) { | ||
1893 | + case ZFCP_ERP_ACTION_REOPEN_LUN: | ||
1894 | + zsdev = sdev_to_zfcp(sdev); | ||
1895 | + if (atomic_read(&zsdev->status) & ZFCP_STATUS_COMMON_ERP_FAILED) | ||
1896 | + need = 0; | ||
1897 | + break; | ||
1898 | + case ZFCP_ERP_ACTION_REOPEN_PORT_FORCED: | ||
1899 | + if (atomic_read(&port->status) & ZFCP_STATUS_COMMON_ERP_FAILED) | ||
1900 | + need = 0; | ||
1901 | + break; | ||
1902 | + case ZFCP_ERP_ACTION_REOPEN_PORT: | ||
1903 | + if (atomic_read(&port->status) & | ||
1904 | + ZFCP_STATUS_COMMON_ERP_FAILED) { | ||
1905 | + need = 0; | ||
1906 | + /* ensure propagation of failed status to new devices */ | ||
1907 | + zfcp_erp_set_port_status( | ||
1908 | + port, ZFCP_STATUS_COMMON_ERP_FAILED); | ||
1909 | + } | ||
1910 | + break; | ||
1911 | + case ZFCP_ERP_ACTION_REOPEN_ADAPTER: | ||
1912 | + if (atomic_read(&adapter->status) & | ||
1913 | + ZFCP_STATUS_COMMON_ERP_FAILED) { | ||
1914 | + need = 0; | ||
1915 | + /* ensure propagation of failed status to new devices */ | ||
1916 | + zfcp_erp_set_adapter_status( | ||
1917 | + adapter, ZFCP_STATUS_COMMON_ERP_FAILED); | ||
1918 | + } | ||
1919 | + break; | ||
1920 | + default: | ||
1921 | + need = 0; | ||
1922 | + break; | ||
1923 | + } | ||
1924 | + | ||
1925 | + return need; | ||
1926 | +} | ||
1927 | + | ||
1928 | static int zfcp_erp_required_act(int want, struct zfcp_adapter *adapter, | ||
1929 | struct zfcp_port *port, | ||
1930 | struct scsi_device *sdev) | ||
1931 | @@ -248,16 +308,27 @@ static int zfcp_erp_action_enqueue(int want, struct zfcp_adapter *adapter, | ||
1932 | int retval = 1, need; | ||
1933 | struct zfcp_erp_action *act; | ||
1934 | |||
1935 | - if (!adapter->erp_thread) | ||
1936 | - return -EIO; | ||
1937 | + need = zfcp_erp_handle_failed(want, adapter, port, sdev); | ||
1938 | + if (!need) { | ||
1939 | + need = ZFCP_ERP_ACTION_FAILED; /* marker for trace */ | ||
1940 | + goto out; | ||
1941 | + } | ||
1942 | + | ||
1943 | + if (!adapter->erp_thread) { | ||
1944 | + need = ZFCP_ERP_ACTION_NONE; /* marker for trace */ | ||
1945 | + retval = -EIO; | ||
1946 | + goto out; | ||
1947 | + } | ||
1948 | |||
1949 | need = zfcp_erp_required_act(want, adapter, port, sdev); | ||
1950 | if (!need) | ||
1951 | goto out; | ||
1952 | |||
1953 | act = zfcp_erp_setup_act(need, act_status, adapter, port, sdev); | ||
1954 | - if (!act) | ||
1955 | + if (!act) { | ||
1956 | + need |= ZFCP_ERP_ACTION_NONE; /* marker for trace */ | ||
1957 | goto out; | ||
1958 | + } | ||
1959 | atomic_or(ZFCP_STATUS_ADAPTER_ERP_PENDING, &adapter->status); | ||
1960 | ++adapter->erp_total_count; | ||
1961 | list_add_tail(&act->list, &adapter->erp_ready_head); | ||
1962 | @@ -268,18 +339,32 @@ static int zfcp_erp_action_enqueue(int want, struct zfcp_adapter *adapter, | ||
1963 | return retval; | ||
1964 | } | ||
1965 | |||
1966 | +void zfcp_erp_port_forced_no_port_dbf(char *id, struct zfcp_adapter *adapter, | ||
1967 | + u64 port_name, u32 port_id) | ||
1968 | +{ | ||
1969 | + unsigned long flags; | ||
1970 | + static /* don't waste stack */ struct zfcp_port tmpport; | ||
1971 | + | ||
1972 | + write_lock_irqsave(&adapter->erp_lock, flags); | ||
1973 | + /* Stand-in zfcp port with fields just good enough for | ||
1974 | + * zfcp_dbf_rec_trig() and zfcp_dbf_set_common(). | ||
1975 | + * Under lock because tmpport is static. | ||
1976 | + */ | ||
1977 | + atomic_set(&tmpport.status, -1); /* unknown */ | ||
1978 | + tmpport.wwpn = port_name; | ||
1979 | + tmpport.d_id = port_id; | ||
1980 | + zfcp_dbf_rec_trig(id, adapter, &tmpport, NULL, | ||
1981 | + ZFCP_ERP_ACTION_REOPEN_PORT_FORCED, | ||
1982 | + ZFCP_ERP_ACTION_NONE); | ||
1983 | + write_unlock_irqrestore(&adapter->erp_lock, flags); | ||
1984 | +} | ||
1985 | + | ||
1986 | static int _zfcp_erp_adapter_reopen(struct zfcp_adapter *adapter, | ||
1987 | int clear_mask, char *id) | ||
1988 | { | ||
1989 | zfcp_erp_adapter_block(adapter, clear_mask); | ||
1990 | zfcp_scsi_schedule_rports_block(adapter); | ||
1991 | |||
1992 | - /* ensure propagation of failed status to new devices */ | ||
1993 | - if (atomic_read(&adapter->status) & ZFCP_STATUS_COMMON_ERP_FAILED) { | ||
1994 | - zfcp_erp_set_adapter_status(adapter, | ||
1995 | - ZFCP_STATUS_COMMON_ERP_FAILED); | ||
1996 | - return -EIO; | ||
1997 | - } | ||
1998 | return zfcp_erp_action_enqueue(ZFCP_ERP_ACTION_REOPEN_ADAPTER, | ||
1999 | adapter, NULL, NULL, id, 0); | ||
2000 | } | ||
2001 | @@ -298,12 +383,8 @@ void zfcp_erp_adapter_reopen(struct zfcp_adapter *adapter, int clear, char *id) | ||
2002 | zfcp_scsi_schedule_rports_block(adapter); | ||
2003 | |||
2004 | write_lock_irqsave(&adapter->erp_lock, flags); | ||
2005 | - if (atomic_read(&adapter->status) & ZFCP_STATUS_COMMON_ERP_FAILED) | ||
2006 | - zfcp_erp_set_adapter_status(adapter, | ||
2007 | - ZFCP_STATUS_COMMON_ERP_FAILED); | ||
2008 | - else | ||
2009 | - zfcp_erp_action_enqueue(ZFCP_ERP_ACTION_REOPEN_ADAPTER, adapter, | ||
2010 | - NULL, NULL, id, 0); | ||
2011 | + zfcp_erp_action_enqueue(ZFCP_ERP_ACTION_REOPEN_ADAPTER, adapter, | ||
2012 | + NULL, NULL, id, 0); | ||
2013 | write_unlock_irqrestore(&adapter->erp_lock, flags); | ||
2014 | } | ||
2015 | |||
2016 | @@ -344,9 +425,6 @@ static void _zfcp_erp_port_forced_reopen(struct zfcp_port *port, int clear, | ||
2017 | zfcp_erp_port_block(port, clear); | ||
2018 | zfcp_scsi_schedule_rport_block(port); | ||
2019 | |||
2020 | - if (atomic_read(&port->status) & ZFCP_STATUS_COMMON_ERP_FAILED) | ||
2021 | - return; | ||
2022 | - | ||
2023 | zfcp_erp_action_enqueue(ZFCP_ERP_ACTION_REOPEN_PORT_FORCED, | ||
2024 | port->adapter, port, NULL, id, 0); | ||
2025 | } | ||
2026 | @@ -372,12 +450,6 @@ static int _zfcp_erp_port_reopen(struct zfcp_port *port, int clear, char *id) | ||
2027 | zfcp_erp_port_block(port, clear); | ||
2028 | zfcp_scsi_schedule_rport_block(port); | ||
2029 | |||
2030 | - if (atomic_read(&port->status) & ZFCP_STATUS_COMMON_ERP_FAILED) { | ||
2031 | - /* ensure propagation of failed status to new devices */ | ||
2032 | - zfcp_erp_set_port_status(port, ZFCP_STATUS_COMMON_ERP_FAILED); | ||
2033 | - return -EIO; | ||
2034 | - } | ||
2035 | - | ||
2036 | return zfcp_erp_action_enqueue(ZFCP_ERP_ACTION_REOPEN_PORT, | ||
2037 | port->adapter, port, NULL, id, 0); | ||
2038 | } | ||
2039 | @@ -417,9 +489,6 @@ static void _zfcp_erp_lun_reopen(struct scsi_device *sdev, int clear, char *id, | ||
2040 | |||
2041 | zfcp_erp_lun_block(sdev, clear); | ||
2042 | |||
2043 | - if (atomic_read(&zfcp_sdev->status) & ZFCP_STATUS_COMMON_ERP_FAILED) | ||
2044 | - return; | ||
2045 | - | ||
2046 | zfcp_erp_action_enqueue(ZFCP_ERP_ACTION_REOPEN_LUN, adapter, | ||
2047 | zfcp_sdev->port, sdev, id, act_status); | ||
2048 | } | ||
2049 | diff --git a/drivers/s390/scsi/zfcp_ext.h b/drivers/s390/scsi/zfcp_ext.h | ||
2050 | index 7a7984a50683..b326f05c7f89 100644 | ||
2051 | --- a/drivers/s390/scsi/zfcp_ext.h | ||
2052 | +++ b/drivers/s390/scsi/zfcp_ext.h | ||
2053 | @@ -52,10 +52,15 @@ extern void zfcp_dbf_san_res(char *, struct zfcp_fsf_req *); | ||
2054 | extern void zfcp_dbf_san_in_els(char *, struct zfcp_fsf_req *); | ||
2055 | extern void zfcp_dbf_scsi(char *, int, struct scsi_cmnd *, | ||
2056 | struct zfcp_fsf_req *); | ||
2057 | +extern void zfcp_dbf_scsi_eh(char *tag, struct zfcp_adapter *adapter, | ||
2058 | + unsigned int scsi_id, int ret); | ||
2059 | |||
2060 | /* zfcp_erp.c */ | ||
2061 | extern void zfcp_erp_set_adapter_status(struct zfcp_adapter *, u32); | ||
2062 | extern void zfcp_erp_clear_adapter_status(struct zfcp_adapter *, u32); | ||
2063 | +extern void zfcp_erp_port_forced_no_port_dbf(char *id, | ||
2064 | + struct zfcp_adapter *adapter, | ||
2065 | + u64 port_name, u32 port_id); | ||
2066 | extern void zfcp_erp_adapter_reopen(struct zfcp_adapter *, int, char *); | ||
2067 | extern void zfcp_erp_adapter_shutdown(struct zfcp_adapter *, int, char *); | ||
2068 | extern void zfcp_erp_set_port_status(struct zfcp_port *, u32); | ||
2069 | diff --git a/drivers/s390/scsi/zfcp_scsi.c b/drivers/s390/scsi/zfcp_scsi.c | ||
2070 | index bb99db2948ab..3afb200b2829 100644 | ||
2071 | --- a/drivers/s390/scsi/zfcp_scsi.c | ||
2072 | +++ b/drivers/s390/scsi/zfcp_scsi.c | ||
2073 | @@ -180,6 +180,7 @@ static int zfcp_scsi_eh_abort_handler(struct scsi_cmnd *scpnt) | ||
2074 | if (abrt_req) | ||
2075 | break; | ||
2076 | |||
2077 | + zfcp_dbf_scsi_abort("abrt_wt", scpnt, NULL); | ||
2078 | zfcp_erp_wait(adapter); | ||
2079 | ret = fc_block_scsi_eh(scpnt); | ||
2080 | if (ret) { | ||
2081 | @@ -276,6 +277,7 @@ static int zfcp_task_mgmt_function(struct scsi_cmnd *scpnt, u8 tm_flags) | ||
2082 | if (fsf_req) | ||
2083 | break; | ||
2084 | |||
2085 | + zfcp_dbf_scsi_devreset("wait", scpnt, tm_flags, NULL); | ||
2086 | zfcp_erp_wait(adapter); | ||
2087 | ret = fc_block_scsi_eh(scpnt); | ||
2088 | if (ret) { | ||
2089 | @@ -322,15 +324,16 @@ static int zfcp_scsi_eh_host_reset_handler(struct scsi_cmnd *scpnt) | ||
2090 | { | ||
2091 | struct zfcp_scsi_dev *zfcp_sdev = sdev_to_zfcp(scpnt->device); | ||
2092 | struct zfcp_adapter *adapter = zfcp_sdev->port->adapter; | ||
2093 | - int ret; | ||
2094 | + int ret = SUCCESS, fc_ret; | ||
2095 | |||
2096 | zfcp_erp_adapter_reopen(adapter, 0, "schrh_1"); | ||
2097 | zfcp_erp_wait(adapter); | ||
2098 | - ret = fc_block_scsi_eh(scpnt); | ||
2099 | - if (ret) | ||
2100 | - return ret; | ||
2101 | + fc_ret = fc_block_scsi_eh(scpnt); | ||
2102 | + if (fc_ret) | ||
2103 | + ret = fc_ret; | ||
2104 | |||
2105 | - return SUCCESS; | ||
2106 | + zfcp_dbf_scsi_eh("schrh_r", adapter, ~0, ret); | ||
2107 | + return ret; | ||
2108 | } | ||
2109 | |||
2110 | struct scsi_transport_template *zfcp_scsi_transport_template; | ||
2111 | @@ -600,6 +603,11 @@ static void zfcp_scsi_terminate_rport_io(struct fc_rport *rport) | ||
2112 | if (port) { | ||
2113 | zfcp_erp_port_forced_reopen(port, 0, "sctrpi1"); | ||
2114 | put_device(&port->dev); | ||
2115 | + } else { | ||
2116 | + zfcp_erp_port_forced_no_port_dbf( | ||
2117 | + "sctrpin", adapter, | ||
2118 | + rport->port_name /* zfcp_scsi_rport_register */, | ||
2119 | + rport->port_id /* zfcp_scsi_rport_register */); | ||
2120 | } | ||
2121 | } | ||
2122 | |||
2123 | diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c | ||
2124 | index 4441a559f139..34bbcfcae67c 100644 | ||
2125 | --- a/drivers/scsi/qla2xxx/qla_init.c | ||
2126 | +++ b/drivers/scsi/qla2xxx/qla_init.c | ||
2127 | @@ -3319,7 +3319,8 @@ qla2x00_iidma_fcport(scsi_qla_host_t *vha, fc_port_t *fcport) | ||
2128 | return; | ||
2129 | |||
2130 | if (fcport->fp_speed == PORT_SPEED_UNKNOWN || | ||
2131 | - fcport->fp_speed > ha->link_data_rate) | ||
2132 | + fcport->fp_speed > ha->link_data_rate || | ||
2133 | + !ha->flags.gpsc_supported) | ||
2134 | return; | ||
2135 | |||
2136 | rval = qla2x00_set_idma_speed(vha, fcport->loop_id, fcport->fp_speed, | ||
2137 | diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c | ||
2138 | index da46f0fba5da..6ff53b604ff6 100644 | ||
2139 | --- a/drivers/tty/serial/sh-sci.c | ||
2140 | +++ b/drivers/tty/serial/sh-sci.c | ||
2141 | @@ -2807,16 +2807,15 @@ static void serial_console_write(struct console *co, const char *s, | ||
2142 | unsigned long flags; | ||
2143 | int locked = 1; | ||
2144 | |||
2145 | - local_irq_save(flags); | ||
2146 | #if defined(SUPPORT_SYSRQ) | ||
2147 | if (port->sysrq) | ||
2148 | locked = 0; | ||
2149 | else | ||
2150 | #endif | ||
2151 | if (oops_in_progress) | ||
2152 | - locked = spin_trylock(&port->lock); | ||
2153 | + locked = spin_trylock_irqsave(&port->lock, flags); | ||
2154 | else | ||
2155 | - spin_lock(&port->lock); | ||
2156 | + spin_lock_irqsave(&port->lock, flags); | ||
2157 | |||
2158 | /* first save SCSCR then disable interrupts, keep clock source */ | ||
2159 | ctrl = serial_port_in(port, SCSCR); | ||
2160 | @@ -2835,8 +2834,7 @@ static void serial_console_write(struct console *co, const char *s, | ||
2161 | serial_port_out(port, SCSCR, ctrl); | ||
2162 | |||
2163 | if (locked) | ||
2164 | - spin_unlock(&port->lock); | ||
2165 | - local_irq_restore(flags); | ||
2166 | + spin_unlock_irqrestore(&port->lock, flags); | ||
2167 | } | ||
2168 | |||
2169 | static int serial_console_setup(struct console *co, char *options) | ||
2170 | diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c | ||
2171 | index d8d992b73e88..8bf0090218dd 100644 | ||
2172 | --- a/drivers/usb/core/hub.c | ||
2173 | +++ b/drivers/usb/core/hub.c | ||
2174 | @@ -4509,7 +4509,9 @@ hub_port_init(struct usb_hub *hub, struct usb_device *udev, int port1, | ||
2175 | * reset. But only on the first attempt, | ||
2176 | * lest we get into a time out/reset loop | ||
2177 | */ | ||
2178 | - if (r == 0 || (r == -ETIMEDOUT && retries == 0)) | ||
2179 | + if (r == 0 || (r == -ETIMEDOUT && | ||
2180 | + retries == 0 && | ||
2181 | + udev->speed > USB_SPEED_FULL)) | ||
2182 | break; | ||
2183 | } | ||
2184 | udev->descriptor.bMaxPacketSize0 = | ||
2185 | diff --git a/drivers/video/backlight/as3711_bl.c b/drivers/video/backlight/as3711_bl.c | ||
2186 | index 734a9158946b..e55304d5cf07 100644 | ||
2187 | --- a/drivers/video/backlight/as3711_bl.c | ||
2188 | +++ b/drivers/video/backlight/as3711_bl.c | ||
2189 | @@ -262,10 +262,10 @@ static int as3711_bl_register(struct platform_device *pdev, | ||
2190 | static int as3711_backlight_parse_dt(struct device *dev) | ||
2191 | { | ||
2192 | struct as3711_bl_pdata *pdata = dev_get_platdata(dev); | ||
2193 | - struct device_node *bl = | ||
2194 | - of_find_node_by_name(dev->parent->of_node, "backlight"), *fb; | ||
2195 | + struct device_node *bl, *fb; | ||
2196 | int ret; | ||
2197 | |||
2198 | + bl = of_get_child_by_name(dev->parent->of_node, "backlight"); | ||
2199 | if (!bl) { | ||
2200 | dev_dbg(dev, "backlight node not found\n"); | ||
2201 | return -ENODEV; | ||
2202 | @@ -279,7 +279,7 @@ static int as3711_backlight_parse_dt(struct device *dev) | ||
2203 | if (pdata->su1_max_uA <= 0) | ||
2204 | ret = -EINVAL; | ||
2205 | if (ret < 0) | ||
2206 | - return ret; | ||
2207 | + goto err_put_bl; | ||
2208 | } | ||
2209 | |||
2210 | fb = of_parse_phandle(bl, "su2-dev", 0); | ||
2211 | @@ -292,7 +292,7 @@ static int as3711_backlight_parse_dt(struct device *dev) | ||
2212 | if (pdata->su2_max_uA <= 0) | ||
2213 | ret = -EINVAL; | ||
2214 | if (ret < 0) | ||
2215 | - return ret; | ||
2216 | + goto err_put_bl; | ||
2217 | |||
2218 | if (of_find_property(bl, "su2-feedback-voltage", NULL)) { | ||
2219 | pdata->su2_feedback = AS3711_SU2_VOLTAGE; | ||
2220 | @@ -314,8 +314,10 @@ static int as3711_backlight_parse_dt(struct device *dev) | ||
2221 | pdata->su2_feedback = AS3711_SU2_CURR_AUTO; | ||
2222 | count++; | ||
2223 | } | ||
2224 | - if (count != 1) | ||
2225 | - return -EINVAL; | ||
2226 | + if (count != 1) { | ||
2227 | + ret = -EINVAL; | ||
2228 | + goto err_put_bl; | ||
2229 | + } | ||
2230 | |||
2231 | count = 0; | ||
2232 | if (of_find_property(bl, "su2-fbprot-lx-sd4", NULL)) { | ||
2233 | @@ -334,8 +336,10 @@ static int as3711_backlight_parse_dt(struct device *dev) | ||
2234 | pdata->su2_fbprot = AS3711_SU2_GPIO4; | ||
2235 | count++; | ||
2236 | } | ||
2237 | - if (count != 1) | ||
2238 | - return -EINVAL; | ||
2239 | + if (count != 1) { | ||
2240 | + ret = -EINVAL; | ||
2241 | + goto err_put_bl; | ||
2242 | + } | ||
2243 | |||
2244 | count = 0; | ||
2245 | if (of_find_property(bl, "su2-auto-curr1", NULL)) { | ||
2246 | @@ -355,11 +359,20 @@ static int as3711_backlight_parse_dt(struct device *dev) | ||
2247 | * At least one su2-auto-curr* must be specified iff | ||
2248 | * AS3711_SU2_CURR_AUTO is used | ||
2249 | */ | ||
2250 | - if (!count ^ (pdata->su2_feedback != AS3711_SU2_CURR_AUTO)) | ||
2251 | - return -EINVAL; | ||
2252 | + if (!count ^ (pdata->su2_feedback != AS3711_SU2_CURR_AUTO)) { | ||
2253 | + ret = -EINVAL; | ||
2254 | + goto err_put_bl; | ||
2255 | + } | ||
2256 | } | ||
2257 | |||
2258 | + of_node_put(bl); | ||
2259 | + | ||
2260 | return 0; | ||
2261 | + | ||
2262 | +err_put_bl: | ||
2263 | + of_node_put(bl); | ||
2264 | + | ||
2265 | + return ret; | ||
2266 | } | ||
2267 | |||
2268 | static int as3711_backlight_probe(struct platform_device *pdev) | ||
2269 | diff --git a/drivers/video/backlight/max8925_bl.c b/drivers/video/backlight/max8925_bl.c | ||
2270 | index 7b738d60ecc2..f3aa6088f1d9 100644 | ||
2271 | --- a/drivers/video/backlight/max8925_bl.c | ||
2272 | +++ b/drivers/video/backlight/max8925_bl.c | ||
2273 | @@ -116,7 +116,7 @@ static void max8925_backlight_dt_init(struct platform_device *pdev) | ||
2274 | if (!pdata) | ||
2275 | return; | ||
2276 | |||
2277 | - np = of_find_node_by_name(nproot, "backlight"); | ||
2278 | + np = of_get_child_by_name(nproot, "backlight"); | ||
2279 | if (!np) { | ||
2280 | dev_err(&pdev->dev, "failed to find backlight node\n"); | ||
2281 | return; | ||
2282 | @@ -125,6 +125,8 @@ static void max8925_backlight_dt_init(struct platform_device *pdev) | ||
2283 | if (!of_property_read_u32(np, "maxim,max8925-dual-string", &val)) | ||
2284 | pdata->dual_string = val; | ||
2285 | |||
2286 | + of_node_put(np); | ||
2287 | + | ||
2288 | pdev->dev.platform_data = pdata; | ||
2289 | } | ||
2290 | |||
2291 | diff --git a/drivers/video/backlight/tps65217_bl.c b/drivers/video/backlight/tps65217_bl.c | ||
2292 | index fd524ad860a5..f45d0c9467db 100644 | ||
2293 | --- a/drivers/video/backlight/tps65217_bl.c | ||
2294 | +++ b/drivers/video/backlight/tps65217_bl.c | ||
2295 | @@ -184,11 +184,11 @@ static struct tps65217_bl_pdata * | ||
2296 | tps65217_bl_parse_dt(struct platform_device *pdev) | ||
2297 | { | ||
2298 | struct tps65217 *tps = dev_get_drvdata(pdev->dev.parent); | ||
2299 | - struct device_node *node = of_node_get(tps->dev->of_node); | ||
2300 | + struct device_node *node; | ||
2301 | struct tps65217_bl_pdata *pdata, *err; | ||
2302 | u32 val; | ||
2303 | |||
2304 | - node = of_find_node_by_name(node, "backlight"); | ||
2305 | + node = of_get_child_by_name(tps->dev->of_node, "backlight"); | ||
2306 | if (!node) | ||
2307 | return ERR_PTR(-ENODEV); | ||
2308 | |||
2309 | diff --git a/drivers/video/fbdev/uvesafb.c b/drivers/video/fbdev/uvesafb.c | ||
2310 | index 98af9e02959b..9fe0d0bcdf62 100644 | ||
2311 | --- a/drivers/video/fbdev/uvesafb.c | ||
2312 | +++ b/drivers/video/fbdev/uvesafb.c | ||
2313 | @@ -1059,7 +1059,8 @@ static int uvesafb_setcmap(struct fb_cmap *cmap, struct fb_info *info) | ||
2314 | info->cmap.len || cmap->start < info->cmap.start) | ||
2315 | return -EINVAL; | ||
2316 | |||
2317 | - entries = kmalloc(sizeof(*entries) * cmap->len, GFP_KERNEL); | ||
2318 | + entries = kmalloc_array(cmap->len, sizeof(*entries), | ||
2319 | + GFP_KERNEL); | ||
2320 | if (!entries) | ||
2321 | return -ENOMEM; | ||
2322 | |||
2323 | diff --git a/drivers/w1/w1.c b/drivers/w1/w1.c | ||
2324 | index ab0931e7a9bb..aa458f2fced1 100644 | ||
2325 | --- a/drivers/w1/w1.c | ||
2326 | +++ b/drivers/w1/w1.c | ||
2327 | @@ -741,7 +741,7 @@ int w1_attach_slave_device(struct w1_master *dev, struct w1_reg_num *rn) | ||
2328 | |||
2329 | /* slave modules need to be loaded in a context with unlocked mutex */ | ||
2330 | mutex_unlock(&dev->mutex); | ||
2331 | - request_module("w1-family-0x%02x", rn->family); | ||
2332 | + request_module("w1-family-0x%02X", rn->family); | ||
2333 | mutex_lock(&dev->mutex); | ||
2334 | |||
2335 | spin_lock(&w1_flock); | ||
2336 | diff --git a/drivers/xen/events/events_base.c b/drivers/xen/events/events_base.c | ||
2337 | index 6d3b32ccc2c4..1435d8c58ea0 100644 | ||
2338 | --- a/drivers/xen/events/events_base.c | ||
2339 | +++ b/drivers/xen/events/events_base.c | ||
2340 | @@ -637,8 +637,6 @@ static void __unbind_from_irq(unsigned int irq) | ||
2341 | xen_irq_info_cleanup(info); | ||
2342 | } | ||
2343 | |||
2344 | - BUG_ON(info_for_irq(irq)->type == IRQT_UNBOUND); | ||
2345 | - | ||
2346 | xen_free_irq(irq); | ||
2347 | } | ||
2348 | |||
2349 | diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c | ||
2350 | index f073de65e818..bd036557c6bc 100644 | ||
2351 | --- a/fs/btrfs/inode.c | ||
2352 | +++ b/fs/btrfs/inode.c | ||
2353 | @@ -1230,6 +1230,8 @@ static noinline int csum_exist_in_range(struct btrfs_root *root, | ||
2354 | list_del(&sums->list); | ||
2355 | kfree(sums); | ||
2356 | } | ||
2357 | + if (ret < 0) | ||
2358 | + return ret; | ||
2359 | return 1; | ||
2360 | } | ||
2361 | |||
2362 | @@ -1381,10 +1383,23 @@ static noinline int run_delalloc_nocow(struct inode *inode, | ||
2363 | goto out_check; | ||
2364 | if (btrfs_extent_readonly(root, disk_bytenr)) | ||
2365 | goto out_check; | ||
2366 | - if (btrfs_cross_ref_exist(trans, root, ino, | ||
2367 | + ret = btrfs_cross_ref_exist(trans, root, ino, | ||
2368 | found_key.offset - | ||
2369 | - extent_offset, disk_bytenr)) | ||
2370 | + extent_offset, disk_bytenr); | ||
2371 | + if (ret) { | ||
2372 | + /* | ||
2373 | + * ret could be -EIO if the above fails to read | ||
2374 | + * metadata. | ||
2375 | + */ | ||
2376 | + if (ret < 0) { | ||
2377 | + if (cow_start != (u64)-1) | ||
2378 | + cur_offset = cow_start; | ||
2379 | + goto error; | ||
2380 | + } | ||
2381 | + | ||
2382 | + WARN_ON_ONCE(nolock); | ||
2383 | goto out_check; | ||
2384 | + } | ||
2385 | disk_bytenr += extent_offset; | ||
2386 | disk_bytenr += cur_offset - found_key.offset; | ||
2387 | num_bytes = min(end + 1, extent_end) - cur_offset; | ||
2388 | @@ -1402,8 +1417,20 @@ static noinline int run_delalloc_nocow(struct inode *inode, | ||
2389 | * this ensure that csum for a given extent are | ||
2390 | * either valid or do not exist. | ||
2391 | */ | ||
2392 | - if (csum_exist_in_range(root, disk_bytenr, num_bytes)) | ||
2393 | + ret = csum_exist_in_range(root, disk_bytenr, num_bytes); | ||
2394 | + if (ret) { | ||
2395 | + /* | ||
2396 | + * ret could be -EIO if the above fails to read | ||
2397 | + * metadata. | ||
2398 | + */ | ||
2399 | + if (ret < 0) { | ||
2400 | + if (cow_start != (u64)-1) | ||
2401 | + cur_offset = cow_start; | ||
2402 | + goto error; | ||
2403 | + } | ||
2404 | + WARN_ON_ONCE(nolock); | ||
2405 | goto out_check; | ||
2406 | + } | ||
2407 | if (!btrfs_inc_nocow_writers(root->fs_info, | ||
2408 | disk_bytenr)) | ||
2409 | goto out_check; | ||
2410 | @@ -9561,6 +9588,7 @@ static int btrfs_rename_exchange(struct inode *old_dir, | ||
2411 | u64 new_idx = 0; | ||
2412 | u64 root_objectid; | ||
2413 | int ret; | ||
2414 | + int ret2; | ||
2415 | bool root_log_pinned = false; | ||
2416 | bool dest_log_pinned = false; | ||
2417 | |||
2418 | @@ -9751,7 +9779,8 @@ static int btrfs_rename_exchange(struct inode *old_dir, | ||
2419 | dest_log_pinned = false; | ||
2420 | } | ||
2421 | } | ||
2422 | - ret = btrfs_end_transaction(trans, root); | ||
2423 | + ret2 = btrfs_end_transaction(trans, root); | ||
2424 | + ret = ret ? ret : ret2; | ||
2425 | out_notrans: | ||
2426 | if (new_ino == BTRFS_FIRST_FREE_OBJECTID) | ||
2427 | up_read(&dest->fs_info->subvol_sem); | ||
2428 | diff --git a/fs/fuse/control.c b/fs/fuse/control.c | ||
2429 | index 6e22748b0704..e25c40c10f4f 100644 | ||
2430 | --- a/fs/fuse/control.c | ||
2431 | +++ b/fs/fuse/control.c | ||
2432 | @@ -211,10 +211,11 @@ static struct dentry *fuse_ctl_add_dentry(struct dentry *parent, | ||
2433 | if (!dentry) | ||
2434 | return NULL; | ||
2435 | |||
2436 | - fc->ctl_dentry[fc->ctl_ndents++] = dentry; | ||
2437 | inode = new_inode(fuse_control_sb); | ||
2438 | - if (!inode) | ||
2439 | + if (!inode) { | ||
2440 | + dput(dentry); | ||
2441 | return NULL; | ||
2442 | + } | ||
2443 | |||
2444 | inode->i_ino = get_next_ino(); | ||
2445 | inode->i_mode = mode; | ||
2446 | @@ -228,6 +229,9 @@ static struct dentry *fuse_ctl_add_dentry(struct dentry *parent, | ||
2447 | set_nlink(inode, nlink); | ||
2448 | inode->i_private = fc; | ||
2449 | d_add(dentry, inode); | ||
2450 | + | ||
2451 | + fc->ctl_dentry[fc->ctl_ndents++] = dentry; | ||
2452 | + | ||
2453 | return dentry; | ||
2454 | } | ||
2455 | |||
2456 | @@ -284,7 +288,10 @@ void fuse_ctl_remove_conn(struct fuse_conn *fc) | ||
2457 | for (i = fc->ctl_ndents - 1; i >= 0; i--) { | ||
2458 | struct dentry *dentry = fc->ctl_dentry[i]; | ||
2459 | d_inode(dentry)->i_private = NULL; | ||
2460 | - d_drop(dentry); | ||
2461 | + if (!i) { | ||
2462 | + /* Get rid of submounts: */ | ||
2463 | + d_invalidate(dentry); | ||
2464 | + } | ||
2465 | dput(dentry); | ||
2466 | } | ||
2467 | drop_nlink(d_inode(fuse_control_sb->s_root)); | ||
2468 | diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c | ||
2469 | index 4bbad745415a..cca8dd3bda09 100644 | ||
2470 | --- a/fs/fuse/dir.c | ||
2471 | +++ b/fs/fuse/dir.c | ||
2472 | @@ -1633,8 +1633,19 @@ int fuse_do_setattr(struct dentry *dentry, struct iattr *attr, | ||
2473 | return err; | ||
2474 | |||
2475 | if (attr->ia_valid & ATTR_OPEN) { | ||
2476 | - if (fc->atomic_o_trunc) | ||
2477 | + /* This is coming from open(..., ... | O_TRUNC); */ | ||
2478 | + WARN_ON(!(attr->ia_valid & ATTR_SIZE)); | ||
2479 | + WARN_ON(attr->ia_size != 0); | ||
2480 | + if (fc->atomic_o_trunc) { | ||
2481 | + /* | ||
2482 | + * No need to send request to userspace, since actual | ||
2483 | + * truncation has already been done by OPEN. But still | ||
2484 | + * need to truncate page cache. | ||
2485 | + */ | ||
2486 | + i_size_write(inode, 0); | ||
2487 | + truncate_pagecache(inode, 0); | ||
2488 | return 0; | ||
2489 | + } | ||
2490 | file = NULL; | ||
2491 | } | ||
2492 | |||
2493 | diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c | ||
2494 | index 6fe6a88ecb4a..f95e1d49b048 100644 | ||
2495 | --- a/fs/fuse/inode.c | ||
2496 | +++ b/fs/fuse/inode.c | ||
2497 | @@ -1184,6 +1184,7 @@ static int fuse_fill_super(struct super_block *sb, void *data, int silent) | ||
2498 | err_put_conn: | ||
2499 | fuse_bdi_destroy(fc); | ||
2500 | fuse_conn_put(fc); | ||
2501 | + sb->s_fs_info = NULL; | ||
2502 | err_fput: | ||
2503 | fput(file); | ||
2504 | err: | ||
2505 | diff --git a/fs/nfs/callback_proc.c b/fs/nfs/callback_proc.c | ||
2506 | index e9aa235e9d10..2e7ebd9d7168 100644 | ||
2507 | --- a/fs/nfs/callback_proc.c | ||
2508 | +++ b/fs/nfs/callback_proc.c | ||
2509 | @@ -402,11 +402,8 @@ validate_seqid(const struct nfs4_slot_table *tbl, const struct nfs4_slot *slot, | ||
2510 | return htonl(NFS4ERR_SEQ_FALSE_RETRY); | ||
2511 | } | ||
2512 | |||
2513 | - /* Wraparound */ | ||
2514 | - if (unlikely(slot->seq_nr == 0xFFFFFFFFU)) { | ||
2515 | - if (args->csa_sequenceid == 1) | ||
2516 | - return htonl(NFS4_OK); | ||
2517 | - } else if (likely(args->csa_sequenceid == slot->seq_nr + 1)) | ||
2518 | + /* Note: wraparound relies on seq_nr being of type u32 */ | ||
2519 | + if (likely(args->csa_sequenceid == slot->seq_nr + 1)) | ||
2520 | return htonl(NFS4_OK); | ||
2521 | |||
2522 | /* Misordered request */ | ||
2523 | diff --git a/fs/nfs/nfs4idmap.c b/fs/nfs/nfs4idmap.c | ||
2524 | index f1160cdd4682..3d4602d66068 100644 | ||
2525 | --- a/fs/nfs/nfs4idmap.c | ||
2526 | +++ b/fs/nfs/nfs4idmap.c | ||
2527 | @@ -343,7 +343,7 @@ static ssize_t nfs_idmap_lookup_name(__u32 id, const char *type, char *buf, | ||
2528 | int id_len; | ||
2529 | ssize_t ret; | ||
2530 | |||
2531 | - id_len = snprintf(id_str, sizeof(id_str), "%u", id); | ||
2532 | + id_len = nfs_map_numeric_to_string(id, id_str, sizeof(id_str)); | ||
2533 | ret = nfs_idmap_get_key(id_str, id_len, type, buf, buflen, idmap); | ||
2534 | if (ret < 0) | ||
2535 | return -EINVAL; | ||
2536 | @@ -626,7 +626,8 @@ static int nfs_idmap_read_and_verify_message(struct idmap_msg *im, | ||
2537 | if (strcmp(upcall->im_name, im->im_name) != 0) | ||
2538 | break; | ||
2539 | /* Note: here we store the NUL terminator too */ | ||
2540 | - len = sprintf(id_str, "%d", im->im_id) + 1; | ||
2541 | + len = 1 + nfs_map_numeric_to_string(im->im_id, id_str, | ||
2542 | + sizeof(id_str)); | ||
2543 | ret = nfs_idmap_instantiate(key, authkey, id_str, len); | ||
2544 | break; | ||
2545 | case IDMAP_CONV_IDTONAME: | ||
2546 | diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c | ||
2547 | index 2c4f7a22e128..bdbd9e6d1ace 100644 | ||
2548 | --- a/fs/nfsd/nfs4xdr.c | ||
2549 | +++ b/fs/nfsd/nfs4xdr.c | ||
2550 | @@ -3638,7 +3638,8 @@ nfsd4_encode_readdir(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4 | ||
2551 | nfserr = nfserr_resource; | ||
2552 | goto err_no_verf; | ||
2553 | } | ||
2554 | - maxcount = min_t(u32, readdir->rd_maxcount, INT_MAX); | ||
2555 | + maxcount = svc_max_payload(resp->rqstp); | ||
2556 | + maxcount = min_t(u32, readdir->rd_maxcount, maxcount); | ||
2557 | /* | ||
2558 | * Note the rfc defines rd_maxcount as the size of the | ||
2559 | * READDIR4resok structure, which includes the verifier above | ||
2560 | @@ -3652,7 +3653,7 @@ nfsd4_encode_readdir(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4 | ||
2561 | |||
2562 | /* RFC 3530 14.2.24 allows us to ignore dircount when it's 0: */ | ||
2563 | if (!readdir->rd_dircount) | ||
2564 | - readdir->rd_dircount = INT_MAX; | ||
2565 | + readdir->rd_dircount = svc_max_payload(resp->rqstp); | ||
2566 | |||
2567 | readdir->xdr = xdr; | ||
2568 | readdir->rd_maxcount = maxcount; | ||
2569 | diff --git a/fs/ubifs/journal.c b/fs/ubifs/journal.c | ||
2570 | index 7d764e3b6c79..504658fd0d08 100644 | ||
2571 | --- a/fs/ubifs/journal.c | ||
2572 | +++ b/fs/ubifs/journal.c | ||
2573 | @@ -1265,7 +1265,7 @@ static int recomp_data_node(const struct ubifs_info *c, | ||
2574 | int err, len, compr_type, out_len; | ||
2575 | |||
2576 | out_len = le32_to_cpu(dn->size); | ||
2577 | - buf = kmalloc(out_len * WORST_COMPR_FACTOR, GFP_NOFS); | ||
2578 | + buf = kmalloc_array(out_len, WORST_COMPR_FACTOR, GFP_NOFS); | ||
2579 | if (!buf) | ||
2580 | return -ENOMEM; | ||
2581 | |||
2582 | diff --git a/fs/udf/directory.c b/fs/udf/directory.c | ||
2583 | index 988d5352bdb8..48ef184929ec 100644 | ||
2584 | --- a/fs/udf/directory.c | ||
2585 | +++ b/fs/udf/directory.c | ||
2586 | @@ -150,6 +150,9 @@ struct fileIdentDesc *udf_fileident_read(struct inode *dir, loff_t *nf_pos, | ||
2587 | sizeof(struct fileIdentDesc)); | ||
2588 | } | ||
2589 | } | ||
2590 | + /* Got last entry outside of dir size - fs is corrupted! */ | ||
2591 | + if (*nf_pos > dir->i_size) | ||
2592 | + return NULL; | ||
2593 | return fi; | ||
2594 | } | ||
2595 | |||
2596 | diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h | ||
2597 | index f6a816129856..bd738aafd432 100644 | ||
2598 | --- a/include/linux/blkdev.h | ||
2599 | +++ b/include/linux/blkdev.h | ||
2600 | @@ -901,8 +901,8 @@ static inline unsigned int blk_max_size_offset(struct request_queue *q, | ||
2601 | if (!q->limits.chunk_sectors) | ||
2602 | return q->limits.max_sectors; | ||
2603 | |||
2604 | - return q->limits.chunk_sectors - | ||
2605 | - (offset & (q->limits.chunk_sectors - 1)); | ||
2606 | + return min(q->limits.max_sectors, (unsigned int)(q->limits.chunk_sectors - | ||
2607 | + (offset & (q->limits.chunk_sectors - 1)))); | ||
2608 | } | ||
2609 | |||
2610 | static inline unsigned int blk_rq_get_max_sectors(struct request *rq, | ||
2611 | diff --git a/include/linux/compiler.h b/include/linux/compiler.h | ||
2612 | index 5ce911db7d88..4f3dfabb680f 100644 | ||
2613 | --- a/include/linux/compiler.h | ||
2614 | +++ b/include/linux/compiler.h | ||
2615 | @@ -113,7 +113,7 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect); | ||
2616 | #define unlikely_notrace(x) __builtin_expect(!!(x), 0) | ||
2617 | |||
2618 | #define __branch_check__(x, expect) ({ \ | ||
2619 | - int ______r; \ | ||
2620 | + long ______r; \ | ||
2621 | static struct ftrace_branch_data \ | ||
2622 | __attribute__((__aligned__(4))) \ | ||
2623 | __attribute__((section("_ftrace_annotated_branch"))) \ | ||
2624 | diff --git a/include/linux/iio/buffer.h b/include/linux/iio/buffer.h | ||
2625 | index 70a5164f4728..821965c90070 100644 | ||
2626 | --- a/include/linux/iio/buffer.h | ||
2627 | +++ b/include/linux/iio/buffer.h | ||
2628 | @@ -61,7 +61,7 @@ struct iio_buffer_access_funcs { | ||
2629 | int (*request_update)(struct iio_buffer *buffer); | ||
2630 | |||
2631 | int (*set_bytes_per_datum)(struct iio_buffer *buffer, size_t bpd); | ||
2632 | - int (*set_length)(struct iio_buffer *buffer, int length); | ||
2633 | + int (*set_length)(struct iio_buffer *buffer, unsigned int length); | ||
2634 | |||
2635 | int (*enable)(struct iio_buffer *buffer, struct iio_dev *indio_dev); | ||
2636 | int (*disable)(struct iio_buffer *buffer, struct iio_dev *indio_dev); | ||
2637 | @@ -96,8 +96,8 @@ struct iio_buffer_access_funcs { | ||
2638 | * @watermark: [INTERN] number of datums to wait for poll/read. | ||
2639 | */ | ||
2640 | struct iio_buffer { | ||
2641 | - int length; | ||
2642 | - int bytes_per_datum; | ||
2643 | + unsigned int length; | ||
2644 | + size_t bytes_per_datum; | ||
2645 | struct attribute_group *scan_el_attrs; | ||
2646 | long *scan_mask; | ||
2647 | bool scan_timestamp; | ||
2648 | diff --git a/kernel/printk/nmi.c b/kernel/printk/nmi.c | ||
2649 | index 16bab471c7e2..5fa65aa904d3 100644 | ||
2650 | --- a/kernel/printk/nmi.c | ||
2651 | +++ b/kernel/printk/nmi.c | ||
2652 | @@ -63,6 +63,7 @@ static int vprintk_nmi(const char *fmt, va_list args) | ||
2653 | struct nmi_seq_buf *s = this_cpu_ptr(&nmi_print_seq); | ||
2654 | int add = 0; | ||
2655 | size_t len; | ||
2656 | + va_list ap; | ||
2657 | |||
2658 | again: | ||
2659 | len = atomic_read(&s->len); | ||
2660 | @@ -79,7 +80,9 @@ static int vprintk_nmi(const char *fmt, va_list args) | ||
2661 | if (!len) | ||
2662 | smp_rmb(); | ||
2663 | |||
2664 | - add = vsnprintf(s->buffer + len, sizeof(s->buffer) - len, fmt, args); | ||
2665 | + va_copy(ap, args); | ||
2666 | + add = vsnprintf(s->buffer + len, sizeof(s->buffer) - len, fmt, ap); | ||
2667 | + va_end(ap); | ||
2668 | |||
2669 | /* | ||
2670 | * Do it once again if the buffer has been flushed in the meantime. | ||
2671 | diff --git a/kernel/time/time.c b/kernel/time/time.c | ||
2672 | index bd62fb8e8e77..39468651a064 100644 | ||
2673 | --- a/kernel/time/time.c | ||
2674 | +++ b/kernel/time/time.c | ||
2675 | @@ -28,6 +28,7 @@ | ||
2676 | */ | ||
2677 | |||
2678 | #include <linux/export.h> | ||
2679 | +#include <linux/kernel.h> | ||
2680 | #include <linux/timex.h> | ||
2681 | #include <linux/capability.h> | ||
2682 | #include <linux/timekeeper_internal.h> | ||
2683 | @@ -258,9 +259,10 @@ unsigned int jiffies_to_msecs(const unsigned long j) | ||
2684 | return (j + (HZ / MSEC_PER_SEC) - 1)/(HZ / MSEC_PER_SEC); | ||
2685 | #else | ||
2686 | # if BITS_PER_LONG == 32 | ||
2687 | - return (HZ_TO_MSEC_MUL32 * j) >> HZ_TO_MSEC_SHR32; | ||
2688 | + return (HZ_TO_MSEC_MUL32 * j + (1ULL << HZ_TO_MSEC_SHR32) - 1) >> | ||
2689 | + HZ_TO_MSEC_SHR32; | ||
2690 | # else | ||
2691 | - return (j * HZ_TO_MSEC_NUM) / HZ_TO_MSEC_DEN; | ||
2692 | + return DIV_ROUND_UP(j * HZ_TO_MSEC_NUM, HZ_TO_MSEC_DEN); | ||
2693 | # endif | ||
2694 | #endif | ||
2695 | } | ||
2696 | diff --git a/lib/vsprintf.c b/lib/vsprintf.c | ||
2697 | index 0967771d8f7f..79ba3cc07026 100644 | ||
2698 | --- a/lib/vsprintf.c | ||
2699 | +++ b/lib/vsprintf.c | ||
2700 | @@ -1391,9 +1391,6 @@ char *clock(char *buf, char *end, struct clk *clk, struct printf_spec spec, | ||
2701 | return string(buf, end, NULL, spec); | ||
2702 | |||
2703 | switch (fmt[1]) { | ||
2704 | - case 'r': | ||
2705 | - return number(buf, end, clk_get_rate(clk), spec); | ||
2706 | - | ||
2707 | case 'n': | ||
2708 | default: | ||
2709 | #ifdef CONFIG_COMMON_CLK | ||
2710 | diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c | ||
2711 | index 183436e4a8c1..f03a1430a3cb 100644 | ||
2712 | --- a/sound/pci/hda/patch_realtek.c | ||
2713 | +++ b/sound/pci/hda/patch_realtek.c | ||
2714 | @@ -2448,6 +2448,7 @@ static const struct snd_pci_quirk alc262_fixup_tbl[] = { | ||
2715 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu Lifebook S7110", ALC262_FIXUP_FSC_S7110), | ||
2716 | SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FIXUP_BENQ), | ||
2717 | SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_FIXUP_TYAN), | ||
2718 | + SND_PCI_QUIRK(0x1734, 0x1141, "FSC ESPRIMO U9210", ALC262_FIXUP_FSC_H270), | ||
2719 | SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", ALC262_FIXUP_FSC_H270), | ||
2720 | SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000", ALC262_FIXUP_LENOVO_3000), | ||
2721 | SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_FIXUP_BENQ), | ||
2722 | @@ -4473,7 +4474,6 @@ static void alc_fixup_tpt440_dock(struct hda_codec *codec, | ||
2723 | struct alc_spec *spec = codec->spec; | ||
2724 | |||
2725 | if (action == HDA_FIXUP_ACT_PRE_PROBE) { | ||
2726 | - spec->shutup = alc_no_shutup; /* reduce click noise */ | ||
2727 | spec->reboot_notify = alc_d3_at_reboot; /* reduce noise */ | ||
2728 | spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP; | ||
2729 | codec->power_save_node = 0; /* avoid click noises */ | ||
2730 | @@ -4835,6 +4835,13 @@ static void alc280_fixup_hp_9480m(struct hda_codec *codec, | ||
2731 | /* for hda_fixup_thinkpad_acpi() */ | ||
2732 | #include "thinkpad_helper.c" | ||
2733 | |||
2734 | +static void alc_fixup_thinkpad_acpi(struct hda_codec *codec, | ||
2735 | + const struct hda_fixup *fix, int action) | ||
2736 | +{ | ||
2737 | + alc_fixup_no_shutup(codec, fix, action); /* reduce click noise */ | ||
2738 | + hda_fixup_thinkpad_acpi(codec, fix, action); | ||
2739 | +} | ||
2740 | + | ||
2741 | /* for dell wmi mic mute led */ | ||
2742 | #include "dell_wmi_helper.c" | ||
2743 | |||
2744 | @@ -5350,7 +5357,7 @@ static const struct hda_fixup alc269_fixups[] = { | ||
2745 | }, | ||
2746 | [ALC269_FIXUP_THINKPAD_ACPI] = { | ||
2747 | .type = HDA_FIXUP_FUNC, | ||
2748 | - .v.func = hda_fixup_thinkpad_acpi, | ||
2749 | + .v.func = alc_fixup_thinkpad_acpi, | ||
2750 | .chained = true, | ||
2751 | .chain_id = ALC269_FIXUP_SKU_IGNORE, | ||
2752 | }, | ||
2753 | diff --git a/sound/soc/cirrus/edb93xx.c b/sound/soc/cirrus/edb93xx.c | ||
2754 | index 85962657aabe..517963ef4847 100644 | ||
2755 | --- a/sound/soc/cirrus/edb93xx.c | ||
2756 | +++ b/sound/soc/cirrus/edb93xx.c | ||
2757 | @@ -67,7 +67,7 @@ static struct snd_soc_dai_link edb93xx_dai = { | ||
2758 | .cpu_dai_name = "ep93xx-i2s", | ||
2759 | .codec_name = "spi0.0", | ||
2760 | .codec_dai_name = "cs4271-hifi", | ||
2761 | - .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_IF | | ||
2762 | + .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | | ||
2763 | SND_SOC_DAIFMT_CBS_CFS, | ||
2764 | .ops = &edb93xx_ops, | ||
2765 | }; | ||
2766 | diff --git a/sound/soc/cirrus/ep93xx-i2s.c b/sound/soc/cirrus/ep93xx-i2s.c | ||
2767 | index 934f8aefdd90..0dc3852c4621 100644 | ||
2768 | --- a/sound/soc/cirrus/ep93xx-i2s.c | ||
2769 | +++ b/sound/soc/cirrus/ep93xx-i2s.c | ||
2770 | @@ -51,7 +51,9 @@ | ||
2771 | #define EP93XX_I2S_WRDLEN_24 (1 << 0) | ||
2772 | #define EP93XX_I2S_WRDLEN_32 (2 << 0) | ||
2773 | |||
2774 | -#define EP93XX_I2S_LINCTRLDATA_R_JUST (1 << 2) /* Right justify */ | ||
2775 | +#define EP93XX_I2S_RXLINCTRLDATA_R_JUST BIT(1) /* Right justify */ | ||
2776 | + | ||
2777 | +#define EP93XX_I2S_TXLINCTRLDATA_R_JUST BIT(2) /* Right justify */ | ||
2778 | |||
2779 | #define EP93XX_I2S_CLKCFG_LRS (1 << 0) /* lrclk polarity */ | ||
2780 | #define EP93XX_I2S_CLKCFG_CKP (1 << 1) /* Bit clock polarity */ | ||
2781 | @@ -170,25 +172,25 @@ static int ep93xx_i2s_set_dai_fmt(struct snd_soc_dai *cpu_dai, | ||
2782 | unsigned int fmt) | ||
2783 | { | ||
2784 | struct ep93xx_i2s_info *info = snd_soc_dai_get_drvdata(cpu_dai); | ||
2785 | - unsigned int clk_cfg, lin_ctrl; | ||
2786 | + unsigned int clk_cfg; | ||
2787 | + unsigned int txlin_ctrl = 0; | ||
2788 | + unsigned int rxlin_ctrl = 0; | ||
2789 | |||
2790 | clk_cfg = ep93xx_i2s_read_reg(info, EP93XX_I2S_RXCLKCFG); | ||
2791 | - lin_ctrl = ep93xx_i2s_read_reg(info, EP93XX_I2S_RXLINCTRLDATA); | ||
2792 | |||
2793 | switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { | ||
2794 | case SND_SOC_DAIFMT_I2S: | ||
2795 | clk_cfg |= EP93XX_I2S_CLKCFG_REL; | ||
2796 | - lin_ctrl &= ~EP93XX_I2S_LINCTRLDATA_R_JUST; | ||
2797 | break; | ||
2798 | |||
2799 | case SND_SOC_DAIFMT_LEFT_J: | ||
2800 | clk_cfg &= ~EP93XX_I2S_CLKCFG_REL; | ||
2801 | - lin_ctrl &= ~EP93XX_I2S_LINCTRLDATA_R_JUST; | ||
2802 | break; | ||
2803 | |||
2804 | case SND_SOC_DAIFMT_RIGHT_J: | ||
2805 | clk_cfg &= ~EP93XX_I2S_CLKCFG_REL; | ||
2806 | - lin_ctrl |= EP93XX_I2S_LINCTRLDATA_R_JUST; | ||
2807 | + rxlin_ctrl |= EP93XX_I2S_RXLINCTRLDATA_R_JUST; | ||
2808 | + txlin_ctrl |= EP93XX_I2S_TXLINCTRLDATA_R_JUST; | ||
2809 | break; | ||
2810 | |||
2811 | default: | ||
2812 | @@ -213,32 +215,32 @@ static int ep93xx_i2s_set_dai_fmt(struct snd_soc_dai *cpu_dai, | ||
2813 | switch (fmt & SND_SOC_DAIFMT_INV_MASK) { | ||
2814 | case SND_SOC_DAIFMT_NB_NF: | ||
2815 | /* Negative bit clock, lrclk low on left word */ | ||
2816 | - clk_cfg &= ~(EP93XX_I2S_CLKCFG_CKP | EP93XX_I2S_CLKCFG_REL); | ||
2817 | + clk_cfg &= ~(EP93XX_I2S_CLKCFG_CKP | EP93XX_I2S_CLKCFG_LRS); | ||
2818 | break; | ||
2819 | |||
2820 | case SND_SOC_DAIFMT_NB_IF: | ||
2821 | /* Negative bit clock, lrclk low on right word */ | ||
2822 | clk_cfg &= ~EP93XX_I2S_CLKCFG_CKP; | ||
2823 | - clk_cfg |= EP93XX_I2S_CLKCFG_REL; | ||
2824 | + clk_cfg |= EP93XX_I2S_CLKCFG_LRS; | ||
2825 | break; | ||
2826 | |||
2827 | case SND_SOC_DAIFMT_IB_NF: | ||
2828 | /* Positive bit clock, lrclk low on left word */ | ||
2829 | clk_cfg |= EP93XX_I2S_CLKCFG_CKP; | ||
2830 | - clk_cfg &= ~EP93XX_I2S_CLKCFG_REL; | ||
2831 | + clk_cfg &= ~EP93XX_I2S_CLKCFG_LRS; | ||
2832 | break; | ||
2833 | |||
2834 | case SND_SOC_DAIFMT_IB_IF: | ||
2835 | /* Positive bit clock, lrclk low on right word */ | ||
2836 | - clk_cfg |= EP93XX_I2S_CLKCFG_CKP | EP93XX_I2S_CLKCFG_REL; | ||
2837 | + clk_cfg |= EP93XX_I2S_CLKCFG_CKP | EP93XX_I2S_CLKCFG_LRS; | ||
2838 | break; | ||
2839 | } | ||
2840 | |||
2841 | /* Write new register values */ | ||
2842 | ep93xx_i2s_write_reg(info, EP93XX_I2S_RXCLKCFG, clk_cfg); | ||
2843 | ep93xx_i2s_write_reg(info, EP93XX_I2S_TXCLKCFG, clk_cfg); | ||
2844 | - ep93xx_i2s_write_reg(info, EP93XX_I2S_RXLINCTRLDATA, lin_ctrl); | ||
2845 | - ep93xx_i2s_write_reg(info, EP93XX_I2S_TXLINCTRLDATA, lin_ctrl); | ||
2846 | + ep93xx_i2s_write_reg(info, EP93XX_I2S_RXLINCTRLDATA, rxlin_ctrl); | ||
2847 | + ep93xx_i2s_write_reg(info, EP93XX_I2S_TXLINCTRLDATA, txlin_ctrl); | ||
2848 | return 0; | ||
2849 | } | ||
2850 | |||
2851 | diff --git a/sound/soc/cirrus/snappercl15.c b/sound/soc/cirrus/snappercl15.c | ||
2852 | index 98089df08df6..c6737a573bc0 100644 | ||
2853 | --- a/sound/soc/cirrus/snappercl15.c | ||
2854 | +++ b/sound/soc/cirrus/snappercl15.c | ||
2855 | @@ -72,7 +72,7 @@ static struct snd_soc_dai_link snappercl15_dai = { | ||
2856 | .codec_dai_name = "tlv320aic23-hifi", | ||
2857 | .codec_name = "tlv320aic23-codec.0-001a", | ||
2858 | .platform_name = "ep93xx-i2s", | ||
2859 | - .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_IF | | ||
2860 | + .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | | ||
2861 | SND_SOC_DAIFMT_CBS_CFS, | ||
2862 | .ops = &snappercl15_ops, | ||
2863 | }; | ||
2864 | diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c | ||
2865 | index 6780eba55ec2..0b5d132bc3dd 100644 | ||
2866 | --- a/sound/soc/soc-dapm.c | ||
2867 | +++ b/sound/soc/soc-dapm.c | ||
2868 | @@ -425,6 +425,8 @@ static int dapm_kcontrol_data_alloc(struct snd_soc_dapm_widget *widget, | ||
2869 | static void dapm_kcontrol_free(struct snd_kcontrol *kctl) | ||
2870 | { | ||
2871 | struct dapm_kcontrol_data *data = snd_kcontrol_chip(kctl); | ||
2872 | + | ||
2873 | + list_del(&data->paths); | ||
2874 | kfree(data->wlist); | ||
2875 | kfree(data); | ||
2876 | } | ||
2877 | diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c | ||
2878 | index d2c6cdd9d42b..8bec05365aae 100644 | ||
2879 | --- a/tools/perf/util/dso.c | ||
2880 | +++ b/tools/perf/util/dso.c | ||
2881 | @@ -253,6 +253,8 @@ int __kmod_path__parse(struct kmod_path *m, const char *path, | ||
2882 | if ((strncmp(name, "[kernel.kallsyms]", 17) == 0) || | ||
2883 | (strncmp(name, "[guest.kernel.kallsyms", 22) == 0) || | ||
2884 | (strncmp(name, "[vdso]", 6) == 0) || | ||
2885 | + (strncmp(name, "[vdso32]", 8) == 0) || | ||
2886 | + (strncmp(name, "[vdsox32]", 9) == 0) || | ||
2887 | (strncmp(name, "[vsyscall]", 10) == 0)) { | ||
2888 | m->kmod = false; | ||
2889 | |||
2890 | diff --git a/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c b/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c | ||
2891 | index cac39532c057..d27715ff9a5f 100644 | ||
2892 | --- a/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c | ||
2893 | +++ b/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c | ||
2894 | @@ -112,6 +112,7 @@ struct intel_pt_decoder { | ||
2895 | bool have_cyc; | ||
2896 | bool fixup_last_mtc; | ||
2897 | bool have_last_ip; | ||
2898 | + enum intel_pt_param_flags flags; | ||
2899 | uint64_t pos; | ||
2900 | uint64_t last_ip; | ||
2901 | uint64_t ip; | ||
2902 | @@ -215,6 +216,8 @@ struct intel_pt_decoder *intel_pt_decoder_new(struct intel_pt_params *params) | ||
2903 | decoder->data = params->data; | ||
2904 | decoder->return_compression = params->return_compression; | ||
2905 | |||
2906 | + decoder->flags = params->flags; | ||
2907 | + | ||
2908 | decoder->period = params->period; | ||
2909 | decoder->period_type = params->period_type; | ||
2910 | |||
2911 | @@ -1012,6 +1015,15 @@ static int intel_pt_walk_insn(struct intel_pt_decoder *decoder, | ||
2912 | return err; | ||
2913 | } | ||
2914 | |||
2915 | +static inline bool intel_pt_fup_with_nlip(struct intel_pt_decoder *decoder, | ||
2916 | + struct intel_pt_insn *intel_pt_insn, | ||
2917 | + uint64_t ip, int err) | ||
2918 | +{ | ||
2919 | + return decoder->flags & INTEL_PT_FUP_WITH_NLIP && !err && | ||
2920 | + intel_pt_insn->branch == INTEL_PT_BR_INDIRECT && | ||
2921 | + ip == decoder->ip + intel_pt_insn->length; | ||
2922 | +} | ||
2923 | + | ||
2924 | static int intel_pt_walk_fup(struct intel_pt_decoder *decoder) | ||
2925 | { | ||
2926 | struct intel_pt_insn intel_pt_insn; | ||
2927 | @@ -1024,7 +1036,8 @@ static int intel_pt_walk_fup(struct intel_pt_decoder *decoder) | ||
2928 | err = intel_pt_walk_insn(decoder, &intel_pt_insn, ip); | ||
2929 | if (err == INTEL_PT_RETURN) | ||
2930 | return 0; | ||
2931 | - if (err == -EAGAIN) { | ||
2932 | + if (err == -EAGAIN || | ||
2933 | + intel_pt_fup_with_nlip(decoder, &intel_pt_insn, ip, err)) { | ||
2934 | if (decoder->set_fup_tx_flags) { | ||
2935 | decoder->set_fup_tx_flags = false; | ||
2936 | decoder->tx_flags = decoder->fup_tx_flags; | ||
2937 | @@ -1034,7 +1047,7 @@ static int intel_pt_walk_fup(struct intel_pt_decoder *decoder) | ||
2938 | decoder->state.flags = decoder->fup_tx_flags; | ||
2939 | return 0; | ||
2940 | } | ||
2941 | - return err; | ||
2942 | + return -EAGAIN; | ||
2943 | } | ||
2944 | decoder->set_fup_tx_flags = false; | ||
2945 | if (err) | ||
2946 | @@ -1298,7 +1311,6 @@ static int intel_pt_overflow(struct intel_pt_decoder *decoder) | ||
2947 | { | ||
2948 | intel_pt_log("ERROR: Buffer overflow\n"); | ||
2949 | intel_pt_clear_tx_flags(decoder); | ||
2950 | - decoder->have_tma = false; | ||
2951 | decoder->cbr = 0; | ||
2952 | decoder->timestamp_insn_cnt = 0; | ||
2953 | decoder->pkt_state = INTEL_PT_STATE_ERR_RESYNC; | ||
2954 | @@ -1517,7 +1529,6 @@ static int intel_pt_walk_fup_tip(struct intel_pt_decoder *decoder) | ||
2955 | case INTEL_PT_PSB: | ||
2956 | case INTEL_PT_TSC: | ||
2957 | case INTEL_PT_TMA: | ||
2958 | - case INTEL_PT_CBR: | ||
2959 | case INTEL_PT_MODE_TSX: | ||
2960 | case INTEL_PT_BAD: | ||
2961 | case INTEL_PT_PSBEND: | ||
2962 | @@ -1526,6 +1537,10 @@ static int intel_pt_walk_fup_tip(struct intel_pt_decoder *decoder) | ||
2963 | decoder->pkt_step = 0; | ||
2964 | return -ENOENT; | ||
2965 | |||
2966 | + case INTEL_PT_CBR: | ||
2967 | + intel_pt_calc_cbr(decoder); | ||
2968 | + break; | ||
2969 | + | ||
2970 | case INTEL_PT_OVF: | ||
2971 | return intel_pt_overflow(decoder); | ||
2972 | |||
2973 | diff --git a/tools/perf/util/intel-pt-decoder/intel-pt-decoder.h b/tools/perf/util/intel-pt-decoder/intel-pt-decoder.h | ||
2974 | index 9ae4df1dcedc..2fe8f4c5aeb5 100644 | ||
2975 | --- a/tools/perf/util/intel-pt-decoder/intel-pt-decoder.h | ||
2976 | +++ b/tools/perf/util/intel-pt-decoder/intel-pt-decoder.h | ||
2977 | @@ -53,6 +53,14 @@ enum { | ||
2978 | INTEL_PT_ERR_MAX, | ||
2979 | }; | ||
2980 | |||
2981 | +enum intel_pt_param_flags { | ||
2982 | + /* | ||
2983 | + * FUP packet can contain next linear instruction pointer instead of | ||
2984 | + * current linear instruction pointer. | ||
2985 | + */ | ||
2986 | + INTEL_PT_FUP_WITH_NLIP = 1 << 0, | ||
2987 | +}; | ||
2988 | + | ||
2989 | struct intel_pt_state { | ||
2990 | enum intel_pt_sample_type type; | ||
2991 | int err; | ||
2992 | @@ -92,6 +100,7 @@ struct intel_pt_params { | ||
2993 | unsigned int mtc_period; | ||
2994 | uint32_t tsc_ctc_ratio_n; | ||
2995 | uint32_t tsc_ctc_ratio_d; | ||
2996 | + enum intel_pt_param_flags flags; | ||
2997 | }; | ||
2998 | |||
2999 | struct intel_pt_decoder; | ||
3000 | diff --git a/tools/perf/util/intel-pt-decoder/intel-pt-pkt-decoder.c b/tools/perf/util/intel-pt-decoder/intel-pt-pkt-decoder.c | ||
3001 | index 7528ae4f7e28..e5c6caf913f3 100644 | ||
3002 | --- a/tools/perf/util/intel-pt-decoder/intel-pt-pkt-decoder.c | ||
3003 | +++ b/tools/perf/util/intel-pt-decoder/intel-pt-pkt-decoder.c | ||
3004 | @@ -281,7 +281,7 @@ static int intel_pt_get_cyc(unsigned int byte, const unsigned char *buf, | ||
3005 | if (len < offs) | ||
3006 | return INTEL_PT_NEED_MORE_BYTES; | ||
3007 | byte = buf[offs++]; | ||
3008 | - payload |= (byte >> 1) << shift; | ||
3009 | + payload |= ((uint64_t)byte >> 1) << shift; | ||
3010 | } | ||
3011 | |||
3012 | packet->type = INTEL_PT_CYC; | ||
3013 | diff --git a/tools/perf/util/intel-pt.c b/tools/perf/util/intel-pt.c | ||
3014 | index b1161d725ce9..d40ab4cf8932 100644 | ||
3015 | --- a/tools/perf/util/intel-pt.c | ||
3016 | +++ b/tools/perf/util/intel-pt.c | ||
3017 | @@ -752,6 +752,7 @@ static struct intel_pt_queue *intel_pt_alloc_queue(struct intel_pt *pt, | ||
3018 | unsigned int queue_nr) | ||
3019 | { | ||
3020 | struct intel_pt_params params = { .get_trace = 0, }; | ||
3021 | + struct perf_env *env = pt->machine->env; | ||
3022 | struct intel_pt_queue *ptq; | ||
3023 | |||
3024 | ptq = zalloc(sizeof(struct intel_pt_queue)); | ||
3025 | @@ -832,6 +833,9 @@ static struct intel_pt_queue *intel_pt_alloc_queue(struct intel_pt *pt, | ||
3026 | } | ||
3027 | } | ||
3028 | |||
3029 | + if (env->cpuid && !strncmp(env->cpuid, "GenuineIntel,6,92,", 18)) | ||
3030 | + params.flags |= INTEL_PT_FUP_WITH_NLIP; | ||
3031 | + | ||
3032 | ptq->decoder = intel_pt_decoder_new(¶ms); | ||
3033 | if (!ptq->decoder) | ||
3034 | goto out_free; | ||
3035 | @@ -1344,6 +1348,7 @@ static int intel_pt_sample(struct intel_pt_queue *ptq) | ||
3036 | |||
3037 | if (intel_pt_is_switch_ip(ptq, state->to_ip)) { | ||
3038 | switch (ptq->switch_state) { | ||
3039 | + case INTEL_PT_SS_NOT_TRACING: | ||
3040 | case INTEL_PT_SS_UNKNOWN: | ||
3041 | case INTEL_PT_SS_EXPECTING_SWITCH_IP: | ||
3042 | err = intel_pt_next_tid(pt, ptq); |