1 |
commit: b80f0b1fd45f663435ca84e9a9694c636e502613 |
2 |
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sat Jun 6 22:03:54 2015 +0000 |
4 |
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat Jun 6 22:03:54 2015 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=b80f0b1f |
7 |
|
8 |
Linux patch 4.0.5 |
9 |
|
10 |
0000_README | 4 + |
11 |
1004_linux-4.0.5.patch | 4937 ++++++++++++++++++++++++++++++++++++++++++++++++ |
12 |
2 files changed, 4941 insertions(+) |
13 |
|
14 |
diff --git a/0000_README b/0000_README |
15 |
index 3bcb0f8..0f63559 100644 |
16 |
--- a/0000_README |
17 |
+++ b/0000_README |
18 |
@@ -59,6 +59,10 @@ Patch: 1003_linux-4.0.4.patch |
19 |
From: http://www.kernel.org |
20 |
Desc: Linux 4.0.4 |
21 |
|
22 |
+Patch: 1004_linux-4.0.5.patch |
23 |
+From: http://www.kernel.org |
24 |
+Desc: Linux 4.0.5 |
25 |
+ |
26 |
Patch: 1500_XATTR_USER_PREFIX.patch |
27 |
From: https://bugs.gentoo.org/show_bug.cgi?id=470644 |
28 |
Desc: Support for namespace user.pax.* on tmpfs. |
29 |
|
30 |
diff --git a/1004_linux-4.0.5.patch b/1004_linux-4.0.5.patch |
31 |
new file mode 100644 |
32 |
index 0000000..84509c0 |
33 |
--- /dev/null |
34 |
+++ b/1004_linux-4.0.5.patch |
35 |
@@ -0,0 +1,4937 @@ |
36 |
+diff --git a/Documentation/hwmon/tmp401 b/Documentation/hwmon/tmp401 |
37 |
+index 8eb88e974055..711f75e189eb 100644 |
38 |
+--- a/Documentation/hwmon/tmp401 |
39 |
++++ b/Documentation/hwmon/tmp401 |
40 |
+@@ -20,7 +20,7 @@ Supported chips: |
41 |
+ Datasheet: http://focus.ti.com/docs/prod/folders/print/tmp432.html |
42 |
+ * Texas Instruments TMP435 |
43 |
+ Prefix: 'tmp435' |
44 |
+- Addresses scanned: I2C 0x37, 0x48 - 0x4f |
45 |
++ Addresses scanned: I2C 0x48 - 0x4f |
46 |
+ Datasheet: http://focus.ti.com/docs/prod/folders/print/tmp435.html |
47 |
+ |
48 |
+ Authors: |
49 |
+diff --git a/Documentation/serial/tty.txt b/Documentation/serial/tty.txt |
50 |
+index 1e52d67d0abf..dbe6623fed1c 100644 |
51 |
+--- a/Documentation/serial/tty.txt |
52 |
++++ b/Documentation/serial/tty.txt |
53 |
+@@ -198,6 +198,9 @@ TTY_IO_ERROR If set, causes all subsequent userspace read/write |
54 |
+ |
55 |
+ TTY_OTHER_CLOSED Device is a pty and the other side has closed. |
56 |
+ |
57 |
++TTY_OTHER_DONE Device is a pty and the other side has closed and |
58 |
++ all pending input processing has been completed. |
59 |
++ |
60 |
+ TTY_NO_WRITE_SPLIT Prevent driver from splitting up writes into |
61 |
+ smaller chunks. |
62 |
+ |
63 |
+diff --git a/Documentation/virtual/kvm/mmu.txt b/Documentation/virtual/kvm/mmu.txt |
64 |
+index 53838d9c6295..c59bd9bc41ef 100644 |
65 |
+--- a/Documentation/virtual/kvm/mmu.txt |
66 |
++++ b/Documentation/virtual/kvm/mmu.txt |
67 |
+@@ -169,6 +169,10 @@ Shadow pages contain the following information: |
68 |
+ Contains the value of cr4.smep && !cr0.wp for which the page is valid |
69 |
+ (pages for which this is true are different from other pages; see the |
70 |
+ treatment of cr0.wp=0 below). |
71 |
++ role.smap_andnot_wp: |
72 |
++ Contains the value of cr4.smap && !cr0.wp for which the page is valid |
73 |
++ (pages for which this is true are different from other pages; see the |
74 |
++ treatment of cr0.wp=0 below). |
75 |
+ gfn: |
76 |
+ Either the guest page table containing the translations shadowed by this |
77 |
+ page, or the base page frame for linear translations. See role.direct. |
78 |
+@@ -344,10 +348,16 @@ on fault type: |
79 |
+ |
80 |
+ (user write faults generate a #PF) |
81 |
+ |
82 |
+-In the first case there is an additional complication if CR4.SMEP is |
83 |
+-enabled: since we've turned the page into a kernel page, the kernel may now |
84 |
+-execute it. We handle this by also setting spte.nx. If we get a user |
85 |
+-fetch or read fault, we'll change spte.u=1 and spte.nx=gpte.nx back. |
86 |
++In the first case there are two additional complications: |
87 |
++- if CR4.SMEP is enabled: since we've turned the page into a kernel page, |
88 |
++ the kernel may now execute it. We handle this by also setting spte.nx. |
89 |
++ If we get a user fetch or read fault, we'll change spte.u=1 and |
90 |
++ spte.nx=gpte.nx back. |
91 |
++- if CR4.SMAP is disabled: since the page has been changed to a kernel |
92 |
++ page, it can not be reused when CR4.SMAP is enabled. We set |
93 |
++ CR4.SMAP && !CR0.WP into shadow page's role to avoid this case. Note, |
94 |
++ here we do not care the case that CR4.SMAP is enabled since KVM will |
95 |
++ directly inject #PF to guest due to failed permission check. |
96 |
+ |
97 |
+ To prevent an spte that was converted into a kernel page with cr0.wp=0 |
98 |
+ from being written by the kernel after cr0.wp has changed to 1, we make |
99 |
+diff --git a/Makefile b/Makefile |
100 |
+index 3d16bcc87585..1880cf77059b 100644 |
101 |
+--- a/Makefile |
102 |
++++ b/Makefile |
103 |
+@@ -1,6 +1,6 @@ |
104 |
+ VERSION = 4 |
105 |
+ PATCHLEVEL = 0 |
106 |
+-SUBLEVEL = 4 |
107 |
++SUBLEVEL = 5 |
108 |
+ EXTRAVERSION = |
109 |
+ NAME = Hurr durr I'ma sheep |
110 |
+ |
111 |
+diff --git a/arch/arc/include/asm/atomic.h b/arch/arc/include/asm/atomic.h |
112 |
+index 067551b6920a..9917a45fc430 100644 |
113 |
+--- a/arch/arc/include/asm/atomic.h |
114 |
++++ b/arch/arc/include/asm/atomic.h |
115 |
+@@ -99,7 +99,7 @@ static inline void atomic_##op(int i, atomic_t *v) \ |
116 |
+ atomic_ops_unlock(flags); \ |
117 |
+ } |
118 |
+ |
119 |
+-#define ATOMIC_OP_RETURN(op, c_op) \ |
120 |
++#define ATOMIC_OP_RETURN(op, c_op, asm_op) \ |
121 |
+ static inline int atomic_##op##_return(int i, atomic_t *v) \ |
122 |
+ { \ |
123 |
+ unsigned long flags; \ |
124 |
+diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile |
125 |
+index a1c776b8dcec..992ea0b063d5 100644 |
126 |
+--- a/arch/arm/boot/dts/Makefile |
127 |
++++ b/arch/arm/boot/dts/Makefile |
128 |
+@@ -215,7 +215,7 @@ dtb-$(CONFIG_SOC_IMX25) += \ |
129 |
+ imx25-eukrea-mbimxsd25-baseboard-dvi-vga.dtb \ |
130 |
+ imx25-karo-tx25.dtb \ |
131 |
+ imx25-pdk.dtb |
132 |
+-dtb-$(CONFIG_SOC_IMX31) += \ |
133 |
++dtb-$(CONFIG_SOC_IMX27) += \ |
134 |
+ imx27-apf27.dtb \ |
135 |
+ imx27-apf27dev.dtb \ |
136 |
+ imx27-eukrea-mbimxsd27-baseboard.dtb \ |
137 |
+diff --git a/arch/arm/boot/dts/exynos4412-trats2.dts b/arch/arm/boot/dts/exynos4412-trats2.dts |
138 |
+index 173ffa479ad3..792394dd0f2a 100644 |
139 |
+--- a/arch/arm/boot/dts/exynos4412-trats2.dts |
140 |
++++ b/arch/arm/boot/dts/exynos4412-trats2.dts |
141 |
+@@ -736,7 +736,7 @@ |
142 |
+ |
143 |
+ display-timings { |
144 |
+ timing-0 { |
145 |
+- clock-frequency = <0>; |
146 |
++ clock-frequency = <57153600>; |
147 |
+ hactive = <720>; |
148 |
+ vactive = <1280>; |
149 |
+ hfront-porch = <5>; |
150 |
+diff --git a/arch/arm/boot/dts/imx27.dtsi b/arch/arm/boot/dts/imx27.dtsi |
151 |
+index 4b063b68db44..9ce1d2128749 100644 |
152 |
+--- a/arch/arm/boot/dts/imx27.dtsi |
153 |
++++ b/arch/arm/boot/dts/imx27.dtsi |
154 |
+@@ -531,7 +531,7 @@ |
155 |
+ |
156 |
+ fec: ethernet@1002b000 { |
157 |
+ compatible = "fsl,imx27-fec"; |
158 |
+- reg = <0x1002b000 0x4000>; |
159 |
++ reg = <0x1002b000 0x1000>; |
160 |
+ interrupts = <50>; |
161 |
+ clocks = <&clks IMX27_CLK_FEC_IPG_GATE>, |
162 |
+ <&clks IMX27_CLK_FEC_AHB_GATE>; |
163 |
+diff --git a/arch/arm/kernel/entry-common.S b/arch/arm/kernel/entry-common.S |
164 |
+index f8ccc21fa032..4e7f40c577e6 100644 |
165 |
+--- a/arch/arm/kernel/entry-common.S |
166 |
++++ b/arch/arm/kernel/entry-common.S |
167 |
+@@ -33,7 +33,9 @@ ret_fast_syscall: |
168 |
+ UNWIND(.fnstart ) |
169 |
+ UNWIND(.cantunwind ) |
170 |
+ disable_irq @ disable interrupts |
171 |
+- ldr r1, [tsk, #TI_FLAGS] |
172 |
++ ldr r1, [tsk, #TI_FLAGS] @ re-check for syscall tracing |
173 |
++ tst r1, #_TIF_SYSCALL_WORK |
174 |
++ bne __sys_trace_return |
175 |
+ tst r1, #_TIF_WORK_MASK |
176 |
+ bne fast_work_pending |
177 |
+ asm_trace_hardirqs_on |
178 |
+diff --git a/arch/arm/mach-exynos/pm_domains.c b/arch/arm/mach-exynos/pm_domains.c |
179 |
+index 37266a826437..1f02bcb350e5 100644 |
180 |
+--- a/arch/arm/mach-exynos/pm_domains.c |
181 |
++++ b/arch/arm/mach-exynos/pm_domains.c |
182 |
+@@ -169,7 +169,7 @@ no_clk: |
183 |
+ args.np = np; |
184 |
+ args.args_count = 0; |
185 |
+ child_domain = of_genpd_get_from_provider(&args); |
186 |
+- if (!child_domain) |
187 |
++ if (IS_ERR(child_domain)) |
188 |
+ continue; |
189 |
+ |
190 |
+ if (of_parse_phandle_with_args(np, "power-domains", |
191 |
+@@ -177,7 +177,7 @@ no_clk: |
192 |
+ continue; |
193 |
+ |
194 |
+ parent_domain = of_genpd_get_from_provider(&args); |
195 |
+- if (!parent_domain) |
196 |
++ if (IS_ERR(parent_domain)) |
197 |
+ continue; |
198 |
+ |
199 |
+ if (pm_genpd_add_subdomain(parent_domain, child_domain)) |
200 |
+diff --git a/arch/arm/mach-exynos/sleep.S b/arch/arm/mach-exynos/sleep.S |
201 |
+index 31d25834b9c4..cf950790fbdc 100644 |
202 |
+--- a/arch/arm/mach-exynos/sleep.S |
203 |
++++ b/arch/arm/mach-exynos/sleep.S |
204 |
+@@ -23,14 +23,7 @@ |
205 |
+ #define CPU_MASK 0xff0ffff0 |
206 |
+ #define CPU_CORTEX_A9 0x410fc090 |
207 |
+ |
208 |
+- /* |
209 |
+- * The following code is located into the .data section. This is to |
210 |
+- * allow l2x0_regs_phys to be accessed with a relative load while we |
211 |
+- * can't rely on any MMU translation. We could have put l2x0_regs_phys |
212 |
+- * in the .text section as well, but some setups might insist on it to |
213 |
+- * be truly read-only. (Reference from: arch/arm/kernel/sleep.S) |
214 |
+- */ |
215 |
+- .data |
216 |
++ .text |
217 |
+ .align |
218 |
+ |
219 |
+ /* |
220 |
+@@ -69,10 +62,12 @@ ENTRY(exynos_cpu_resume_ns) |
221 |
+ cmp r0, r1 |
222 |
+ bne skip_cp15 |
223 |
+ |
224 |
+- adr r0, cp15_save_power |
225 |
++ adr r0, _cp15_save_power |
226 |
+ ldr r1, [r0] |
227 |
+- adr r0, cp15_save_diag |
228 |
++ ldr r1, [r0, r1] |
229 |
++ adr r0, _cp15_save_diag |
230 |
+ ldr r2, [r0] |
231 |
++ ldr r2, [r0, r2] |
232 |
+ mov r0, #SMC_CMD_C15RESUME |
233 |
+ dsb |
234 |
+ smc #0 |
235 |
+@@ -118,14 +113,20 @@ skip_l2x0: |
236 |
+ skip_cp15: |
237 |
+ b cpu_resume |
238 |
+ ENDPROC(exynos_cpu_resume_ns) |
239 |
++ |
240 |
++ .align |
241 |
++_cp15_save_power: |
242 |
++ .long cp15_save_power - . |
243 |
++_cp15_save_diag: |
244 |
++ .long cp15_save_diag - . |
245 |
++#ifdef CONFIG_CACHE_L2X0 |
246 |
++1: .long l2x0_saved_regs - . |
247 |
++#endif /* CONFIG_CACHE_L2X0 */ |
248 |
++ |
249 |
++ .data |
250 |
+ .globl cp15_save_diag |
251 |
+ cp15_save_diag: |
252 |
+ .long 0 @ cp15 diagnostic |
253 |
+ .globl cp15_save_power |
254 |
+ cp15_save_power: |
255 |
+ .long 0 @ cp15 power control |
256 |
+- |
257 |
+-#ifdef CONFIG_CACHE_L2X0 |
258 |
+- .align |
259 |
+-1: .long l2x0_saved_regs - . |
260 |
+-#endif /* CONFIG_CACHE_L2X0 */ |
261 |
+diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c |
262 |
+index 4e6ef896c619..7186382672b5 100644 |
263 |
+--- a/arch/arm/mm/mmu.c |
264 |
++++ b/arch/arm/mm/mmu.c |
265 |
+@@ -1112,22 +1112,22 @@ void __init sanity_check_meminfo(void) |
266 |
+ } |
267 |
+ |
268 |
+ /* |
269 |
+- * Find the first non-section-aligned page, and point |
270 |
++ * Find the first non-pmd-aligned page, and point |
271 |
+ * memblock_limit at it. This relies on rounding the |
272 |
+- * limit down to be section-aligned, which happens at |
273 |
+- * the end of this function. |
274 |
++ * limit down to be pmd-aligned, which happens at the |
275 |
++ * end of this function. |
276 |
+ * |
277 |
+ * With this algorithm, the start or end of almost any |
278 |
+- * bank can be non-section-aligned. The only exception |
279 |
+- * is that the start of the bank 0 must be section- |
280 |
++ * bank can be non-pmd-aligned. The only exception is |
281 |
++ * that the start of the bank 0 must be section- |
282 |
+ * aligned, since otherwise memory would need to be |
283 |
+ * allocated when mapping the start of bank 0, which |
284 |
+ * occurs before any free memory is mapped. |
285 |
+ */ |
286 |
+ if (!memblock_limit) { |
287 |
+- if (!IS_ALIGNED(block_start, SECTION_SIZE)) |
288 |
++ if (!IS_ALIGNED(block_start, PMD_SIZE)) |
289 |
+ memblock_limit = block_start; |
290 |
+- else if (!IS_ALIGNED(block_end, SECTION_SIZE)) |
291 |
++ else if (!IS_ALIGNED(block_end, PMD_SIZE)) |
292 |
+ memblock_limit = arm_lowmem_limit; |
293 |
+ } |
294 |
+ |
295 |
+@@ -1137,12 +1137,12 @@ void __init sanity_check_meminfo(void) |
296 |
+ high_memory = __va(arm_lowmem_limit - 1) + 1; |
297 |
+ |
298 |
+ /* |
299 |
+- * Round the memblock limit down to a section size. This |
300 |
++ * Round the memblock limit down to a pmd size. This |
301 |
+ * helps to ensure that we will allocate memory from the |
302 |
+- * last full section, which should be mapped. |
303 |
++ * last full pmd, which should be mapped. |
304 |
+ */ |
305 |
+ if (memblock_limit) |
306 |
+- memblock_limit = round_down(memblock_limit, SECTION_SIZE); |
307 |
++ memblock_limit = round_down(memblock_limit, PMD_SIZE); |
308 |
+ if (!memblock_limit) |
309 |
+ memblock_limit = arm_lowmem_limit; |
310 |
+ |
311 |
+diff --git a/arch/arm64/net/bpf_jit_comp.c b/arch/arm64/net/bpf_jit_comp.c |
312 |
+index edba042b2325..dc6a4842683a 100644 |
313 |
+--- a/arch/arm64/net/bpf_jit_comp.c |
314 |
++++ b/arch/arm64/net/bpf_jit_comp.c |
315 |
+@@ -487,7 +487,7 @@ emit_cond_jmp: |
316 |
+ return -EINVAL; |
317 |
+ } |
318 |
+ |
319 |
+- imm64 = (u64)insn1.imm << 32 | imm; |
320 |
++ imm64 = (u64)insn1.imm << 32 | (u32)imm; |
321 |
+ emit_a64_mov_i64(dst, imm64, ctx); |
322 |
+ |
323 |
+ return 1; |
324 |
+diff --git a/arch/mips/kernel/elf.c b/arch/mips/kernel/elf.c |
325 |
+index d2c09f6475c5..f20cedcb50f1 100644 |
326 |
+--- a/arch/mips/kernel/elf.c |
327 |
++++ b/arch/mips/kernel/elf.c |
328 |
+@@ -76,14 +76,6 @@ int arch_elf_pt_proc(void *_ehdr, void *_phdr, struct file *elf, |
329 |
+ |
330 |
+ /* Lets see if this is an O32 ELF */ |
331 |
+ if (ehdr32->e_ident[EI_CLASS] == ELFCLASS32) { |
332 |
+- /* FR = 1 for N32 */ |
333 |
+- if (ehdr32->e_flags & EF_MIPS_ABI2) |
334 |
+- state->overall_fp_mode = FP_FR1; |
335 |
+- else |
336 |
+- /* Set a good default FPU mode for O32 */ |
337 |
+- state->overall_fp_mode = cpu_has_mips_r6 ? |
338 |
+- FP_FRE : FP_FR0; |
339 |
+- |
340 |
+ if (ehdr32->e_flags & EF_MIPS_FP64) { |
341 |
+ /* |
342 |
+ * Set MIPS_ABI_FP_OLD_64 for EF_MIPS_FP64. We will override it |
343 |
+@@ -104,9 +96,6 @@ int arch_elf_pt_proc(void *_ehdr, void *_phdr, struct file *elf, |
344 |
+ (char *)&abiflags, |
345 |
+ sizeof(abiflags)); |
346 |
+ } else { |
347 |
+- /* FR=1 is really the only option for 64-bit */ |
348 |
+- state->overall_fp_mode = FP_FR1; |
349 |
+- |
350 |
+ if (phdr64->p_type != PT_MIPS_ABIFLAGS) |
351 |
+ return 0; |
352 |
+ if (phdr64->p_filesz < sizeof(abiflags)) |
353 |
+@@ -147,6 +136,7 @@ int arch_check_elf(void *_ehdr, bool has_interpreter, |
354 |
+ struct elf32_hdr *ehdr = _ehdr; |
355 |
+ struct mode_req prog_req, interp_req; |
356 |
+ int fp_abi, interp_fp_abi, abi0, abi1, max_abi; |
357 |
++ bool is_mips64; |
358 |
+ |
359 |
+ if (!config_enabled(CONFIG_MIPS_O32_FP64_SUPPORT)) |
360 |
+ return 0; |
361 |
+@@ -162,10 +152,22 @@ int arch_check_elf(void *_ehdr, bool has_interpreter, |
362 |
+ abi0 = abi1 = fp_abi; |
363 |
+ } |
364 |
+ |
365 |
+- /* ABI limits. O32 = FP_64A, N32/N64 = FP_SOFT */ |
366 |
+- max_abi = ((ehdr->e_ident[EI_CLASS] == ELFCLASS32) && |
367 |
+- (!(ehdr->e_flags & EF_MIPS_ABI2))) ? |
368 |
+- MIPS_ABI_FP_64A : MIPS_ABI_FP_SOFT; |
369 |
++ is_mips64 = (ehdr->e_ident[EI_CLASS] == ELFCLASS64) || |
370 |
++ (ehdr->e_flags & EF_MIPS_ABI2); |
371 |
++ |
372 |
++ if (is_mips64) { |
373 |
++ /* MIPS64 code always uses FR=1, thus the default is easy */ |
374 |
++ state->overall_fp_mode = FP_FR1; |
375 |
++ |
376 |
++ /* Disallow access to the various FPXX & FP64 ABIs */ |
377 |
++ max_abi = MIPS_ABI_FP_SOFT; |
378 |
++ } else { |
379 |
++ /* Default to a mode capable of running code expecting FR=0 */ |
380 |
++ state->overall_fp_mode = cpu_has_mips_r6 ? FP_FRE : FP_FR0; |
381 |
++ |
382 |
++ /* Allow all ABIs we know about */ |
383 |
++ max_abi = MIPS_ABI_FP_64A; |
384 |
++ } |
385 |
+ |
386 |
+ if ((abi0 > max_abi && abi0 != MIPS_ABI_FP_UNKNOWN) || |
387 |
+ (abi1 > max_abi && abi1 != MIPS_ABI_FP_UNKNOWN)) |
388 |
+diff --git a/arch/parisc/include/asm/elf.h b/arch/parisc/include/asm/elf.h |
389 |
+index 3391d061eccc..78c9fd32c554 100644 |
390 |
+--- a/arch/parisc/include/asm/elf.h |
391 |
++++ b/arch/parisc/include/asm/elf.h |
392 |
+@@ -348,6 +348,10 @@ struct pt_regs; /* forward declaration... */ |
393 |
+ |
394 |
+ #define ELF_HWCAP 0 |
395 |
+ |
396 |
++#define STACK_RND_MASK (is_32bit_task() ? \ |
397 |
++ 0x7ff >> (PAGE_SHIFT - 12) : \ |
398 |
++ 0x3ffff >> (PAGE_SHIFT - 12)) |
399 |
++ |
400 |
+ struct mm_struct; |
401 |
+ extern unsigned long arch_randomize_brk(struct mm_struct *); |
402 |
+ #define arch_randomize_brk arch_randomize_brk |
403 |
+diff --git a/arch/parisc/kernel/sys_parisc.c b/arch/parisc/kernel/sys_parisc.c |
404 |
+index e1ffea2f9a0b..5aba01ac457f 100644 |
405 |
+--- a/arch/parisc/kernel/sys_parisc.c |
406 |
++++ b/arch/parisc/kernel/sys_parisc.c |
407 |
+@@ -77,6 +77,9 @@ static unsigned long mmap_upper_limit(void) |
408 |
+ if (stack_base > STACK_SIZE_MAX) |
409 |
+ stack_base = STACK_SIZE_MAX; |
410 |
+ |
411 |
++ /* Add space for stack randomization. */ |
412 |
++ stack_base += (STACK_RND_MASK << PAGE_SHIFT); |
413 |
++ |
414 |
+ return PAGE_ALIGN(STACK_TOP - stack_base); |
415 |
+ } |
416 |
+ |
417 |
+diff --git a/arch/powerpc/kernel/mce.c b/arch/powerpc/kernel/mce.c |
418 |
+index 15c99b649b04..b2eb4686bd8f 100644 |
419 |
+--- a/arch/powerpc/kernel/mce.c |
420 |
++++ b/arch/powerpc/kernel/mce.c |
421 |
+@@ -73,7 +73,7 @@ void save_mce_event(struct pt_regs *regs, long handled, |
422 |
+ uint64_t nip, uint64_t addr) |
423 |
+ { |
424 |
+ uint64_t srr1; |
425 |
+- int index = __this_cpu_inc_return(mce_nest_count); |
426 |
++ int index = __this_cpu_inc_return(mce_nest_count) - 1; |
427 |
+ struct machine_check_event *mce = this_cpu_ptr(&mce_event[index]); |
428 |
+ |
429 |
+ /* |
430 |
+@@ -184,7 +184,7 @@ void machine_check_queue_event(void) |
431 |
+ if (!get_mce_event(&evt, MCE_EVENT_RELEASE)) |
432 |
+ return; |
433 |
+ |
434 |
+- index = __this_cpu_inc_return(mce_queue_count); |
435 |
++ index = __this_cpu_inc_return(mce_queue_count) - 1; |
436 |
+ /* If queue is full, just return for now. */ |
437 |
+ if (index >= MAX_MC_EVT) { |
438 |
+ __this_cpu_dec(mce_queue_count); |
439 |
+diff --git a/arch/powerpc/kernel/vmlinux.lds.S b/arch/powerpc/kernel/vmlinux.lds.S |
440 |
+index f096e72262f4..1db685104ffc 100644 |
441 |
+--- a/arch/powerpc/kernel/vmlinux.lds.S |
442 |
++++ b/arch/powerpc/kernel/vmlinux.lds.S |
443 |
+@@ -213,6 +213,7 @@ SECTIONS |
444 |
+ *(.opd) |
445 |
+ } |
446 |
+ |
447 |
++ . = ALIGN(256); |
448 |
+ .got : AT(ADDR(.got) - LOAD_OFFSET) { |
449 |
+ __toc_start = .; |
450 |
+ #ifndef CONFIG_RELOCATABLE |
451 |
+diff --git a/arch/s390/crypto/ghash_s390.c b/arch/s390/crypto/ghash_s390.c |
452 |
+index 7940dc90e80b..b258110da952 100644 |
453 |
+--- a/arch/s390/crypto/ghash_s390.c |
454 |
++++ b/arch/s390/crypto/ghash_s390.c |
455 |
+@@ -16,11 +16,12 @@ |
456 |
+ #define GHASH_DIGEST_SIZE 16 |
457 |
+ |
458 |
+ struct ghash_ctx { |
459 |
+- u8 icv[16]; |
460 |
+- u8 key[16]; |
461 |
++ u8 key[GHASH_BLOCK_SIZE]; |
462 |
+ }; |
463 |
+ |
464 |
+ struct ghash_desc_ctx { |
465 |
++ u8 icv[GHASH_BLOCK_SIZE]; |
466 |
++ u8 key[GHASH_BLOCK_SIZE]; |
467 |
+ u8 buffer[GHASH_BLOCK_SIZE]; |
468 |
+ u32 bytes; |
469 |
+ }; |
470 |
+@@ -28,8 +29,10 @@ struct ghash_desc_ctx { |
471 |
+ static int ghash_init(struct shash_desc *desc) |
472 |
+ { |
473 |
+ struct ghash_desc_ctx *dctx = shash_desc_ctx(desc); |
474 |
++ struct ghash_ctx *ctx = crypto_shash_ctx(desc->tfm); |
475 |
+ |
476 |
+ memset(dctx, 0, sizeof(*dctx)); |
477 |
++ memcpy(dctx->key, ctx->key, GHASH_BLOCK_SIZE); |
478 |
+ |
479 |
+ return 0; |
480 |
+ } |
481 |
+@@ -45,7 +48,6 @@ static int ghash_setkey(struct crypto_shash *tfm, |
482 |
+ } |
483 |
+ |
484 |
+ memcpy(ctx->key, key, GHASH_BLOCK_SIZE); |
485 |
+- memset(ctx->icv, 0, GHASH_BLOCK_SIZE); |
486 |
+ |
487 |
+ return 0; |
488 |
+ } |
489 |
+@@ -54,7 +56,6 @@ static int ghash_update(struct shash_desc *desc, |
490 |
+ const u8 *src, unsigned int srclen) |
491 |
+ { |
492 |
+ struct ghash_desc_ctx *dctx = shash_desc_ctx(desc); |
493 |
+- struct ghash_ctx *ctx = crypto_shash_ctx(desc->tfm); |
494 |
+ unsigned int n; |
495 |
+ u8 *buf = dctx->buffer; |
496 |
+ int ret; |
497 |
+@@ -70,7 +71,7 @@ static int ghash_update(struct shash_desc *desc, |
498 |
+ src += n; |
499 |
+ |
500 |
+ if (!dctx->bytes) { |
501 |
+- ret = crypt_s390_kimd(KIMD_GHASH, ctx, buf, |
502 |
++ ret = crypt_s390_kimd(KIMD_GHASH, dctx, buf, |
503 |
+ GHASH_BLOCK_SIZE); |
504 |
+ if (ret != GHASH_BLOCK_SIZE) |
505 |
+ return -EIO; |
506 |
+@@ -79,7 +80,7 @@ static int ghash_update(struct shash_desc *desc, |
507 |
+ |
508 |
+ n = srclen & ~(GHASH_BLOCK_SIZE - 1); |
509 |
+ if (n) { |
510 |
+- ret = crypt_s390_kimd(KIMD_GHASH, ctx, src, n); |
511 |
++ ret = crypt_s390_kimd(KIMD_GHASH, dctx, src, n); |
512 |
+ if (ret != n) |
513 |
+ return -EIO; |
514 |
+ src += n; |
515 |
+@@ -94,7 +95,7 @@ static int ghash_update(struct shash_desc *desc, |
516 |
+ return 0; |
517 |
+ } |
518 |
+ |
519 |
+-static int ghash_flush(struct ghash_ctx *ctx, struct ghash_desc_ctx *dctx) |
520 |
++static int ghash_flush(struct ghash_desc_ctx *dctx) |
521 |
+ { |
522 |
+ u8 *buf = dctx->buffer; |
523 |
+ int ret; |
524 |
+@@ -104,24 +105,24 @@ static int ghash_flush(struct ghash_ctx *ctx, struct ghash_desc_ctx *dctx) |
525 |
+ |
526 |
+ memset(pos, 0, dctx->bytes); |
527 |
+ |
528 |
+- ret = crypt_s390_kimd(KIMD_GHASH, ctx, buf, GHASH_BLOCK_SIZE); |
529 |
++ ret = crypt_s390_kimd(KIMD_GHASH, dctx, buf, GHASH_BLOCK_SIZE); |
530 |
+ if (ret != GHASH_BLOCK_SIZE) |
531 |
+ return -EIO; |
532 |
++ |
533 |
++ dctx->bytes = 0; |
534 |
+ } |
535 |
+ |
536 |
+- dctx->bytes = 0; |
537 |
+ return 0; |
538 |
+ } |
539 |
+ |
540 |
+ static int ghash_final(struct shash_desc *desc, u8 *dst) |
541 |
+ { |
542 |
+ struct ghash_desc_ctx *dctx = shash_desc_ctx(desc); |
543 |
+- struct ghash_ctx *ctx = crypto_shash_ctx(desc->tfm); |
544 |
+ int ret; |
545 |
+ |
546 |
+- ret = ghash_flush(ctx, dctx); |
547 |
++ ret = ghash_flush(dctx); |
548 |
+ if (!ret) |
549 |
+- memcpy(dst, ctx->icv, GHASH_BLOCK_SIZE); |
550 |
++ memcpy(dst, dctx->icv, GHASH_BLOCK_SIZE); |
551 |
+ return ret; |
552 |
+ } |
553 |
+ |
554 |
+diff --git a/arch/s390/include/asm/pgtable.h b/arch/s390/include/asm/pgtable.h |
555 |
+index e08ec38f8c6e..e10112da008d 100644 |
556 |
+--- a/arch/s390/include/asm/pgtable.h |
557 |
++++ b/arch/s390/include/asm/pgtable.h |
558 |
+@@ -600,7 +600,7 @@ static inline int pmd_large(pmd_t pmd) |
559 |
+ return (pmd_val(pmd) & _SEGMENT_ENTRY_LARGE) != 0; |
560 |
+ } |
561 |
+ |
562 |
+-static inline int pmd_pfn(pmd_t pmd) |
563 |
++static inline unsigned long pmd_pfn(pmd_t pmd) |
564 |
+ { |
565 |
+ unsigned long origin_mask; |
566 |
+ |
567 |
+diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h |
568 |
+index a236e39cc385..1c0fb570b5c2 100644 |
569 |
+--- a/arch/x86/include/asm/kvm_host.h |
570 |
++++ b/arch/x86/include/asm/kvm_host.h |
571 |
+@@ -212,6 +212,7 @@ union kvm_mmu_page_role { |
572 |
+ unsigned nxe:1; |
573 |
+ unsigned cr0_wp:1; |
574 |
+ unsigned smep_andnot_wp:1; |
575 |
++ unsigned smap_andnot_wp:1; |
576 |
+ }; |
577 |
+ }; |
578 |
+ |
579 |
+@@ -404,6 +405,7 @@ struct kvm_vcpu_arch { |
580 |
+ struct kvm_mmu_memory_cache mmu_page_header_cache; |
581 |
+ |
582 |
+ struct fpu guest_fpu; |
583 |
++ bool eager_fpu; |
584 |
+ u64 xcr0; |
585 |
+ u64 guest_supported_xcr0; |
586 |
+ u32 guest_xstate_size; |
587 |
+@@ -735,6 +737,7 @@ struct kvm_x86_ops { |
588 |
+ void (*cache_reg)(struct kvm_vcpu *vcpu, enum kvm_reg reg); |
589 |
+ unsigned long (*get_rflags)(struct kvm_vcpu *vcpu); |
590 |
+ void (*set_rflags)(struct kvm_vcpu *vcpu, unsigned long rflags); |
591 |
++ void (*fpu_activate)(struct kvm_vcpu *vcpu); |
592 |
+ void (*fpu_deactivate)(struct kvm_vcpu *vcpu); |
593 |
+ |
594 |
+ void (*tlb_flush)(struct kvm_vcpu *vcpu); |
595 |
+diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c |
596 |
+index 3c036cb4a370..11dd8f23fcea 100644 |
597 |
+--- a/arch/x86/kernel/cpu/mcheck/mce.c |
598 |
++++ b/arch/x86/kernel/cpu/mcheck/mce.c |
599 |
+@@ -705,6 +705,7 @@ static int mce_no_way_out(struct mce *m, char **msg, unsigned long *validp, |
600 |
+ struct pt_regs *regs) |
601 |
+ { |
602 |
+ int i, ret = 0; |
603 |
++ char *tmp; |
604 |
+ |
605 |
+ for (i = 0; i < mca_cfg.banks; i++) { |
606 |
+ m->status = mce_rdmsrl(MSR_IA32_MCx_STATUS(i)); |
607 |
+@@ -713,9 +714,11 @@ static int mce_no_way_out(struct mce *m, char **msg, unsigned long *validp, |
608 |
+ if (quirk_no_way_out) |
609 |
+ quirk_no_way_out(i, m, regs); |
610 |
+ } |
611 |
+- if (mce_severity(m, mca_cfg.tolerant, msg, true) >= |
612 |
+- MCE_PANIC_SEVERITY) |
613 |
++ |
614 |
++ if (mce_severity(m, mca_cfg.tolerant, &tmp, true) >= MCE_PANIC_SEVERITY) { |
615 |
++ *msg = tmp; |
616 |
+ ret = 1; |
617 |
++ } |
618 |
+ } |
619 |
+ return ret; |
620 |
+ } |
621 |
+diff --git a/arch/x86/kernel/cpu/perf_event_intel_rapl.c b/arch/x86/kernel/cpu/perf_event_intel_rapl.c |
622 |
+index c4bb8b8e5017..76d8cbe5a10f 100644 |
623 |
+--- a/arch/x86/kernel/cpu/perf_event_intel_rapl.c |
624 |
++++ b/arch/x86/kernel/cpu/perf_event_intel_rapl.c |
625 |
+@@ -680,6 +680,7 @@ static int __init rapl_pmu_init(void) |
626 |
+ break; |
627 |
+ case 60: /* Haswell */ |
628 |
+ case 69: /* Haswell-Celeron */ |
629 |
++ case 61: /* Broadwell */ |
630 |
+ rapl_cntr_mask = RAPL_IDX_HSW; |
631 |
+ rapl_pmu_events_group.attrs = rapl_events_hsw_attr; |
632 |
+ break; |
633 |
+diff --git a/arch/x86/kernel/i387.c b/arch/x86/kernel/i387.c |
634 |
+index d5651fce0b71..f341d56b7883 100644 |
635 |
+--- a/arch/x86/kernel/i387.c |
636 |
++++ b/arch/x86/kernel/i387.c |
637 |
+@@ -169,6 +169,21 @@ static void init_thread_xstate(void) |
638 |
+ xstate_size = sizeof(struct i387_fxsave_struct); |
639 |
+ else |
640 |
+ xstate_size = sizeof(struct i387_fsave_struct); |
641 |
++ |
642 |
++ /* |
643 |
++ * Quirk: we don't yet handle the XSAVES* instructions |
644 |
++ * correctly, as we don't correctly convert between |
645 |
++ * standard and compacted format when interfacing |
646 |
++ * with user-space - so disable it for now. |
647 |
++ * |
648 |
++ * The difference is small: with recent CPUs the |
649 |
++ * compacted format is only marginally smaller than |
650 |
++ * the standard FPU state format. |
651 |
++ * |
652 |
++ * ( This is easy to backport while we are fixing |
653 |
++ * XSAVES* support. ) |
654 |
++ */ |
655 |
++ setup_clear_cpu_cap(X86_FEATURE_XSAVES); |
656 |
+ } |
657 |
+ |
658 |
+ /* |
659 |
+diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c |
660 |
+index 8a80737ee6e6..307f9ec28e08 100644 |
661 |
+--- a/arch/x86/kvm/cpuid.c |
662 |
++++ b/arch/x86/kvm/cpuid.c |
663 |
+@@ -16,6 +16,8 @@ |
664 |
+ #include <linux/module.h> |
665 |
+ #include <linux/vmalloc.h> |
666 |
+ #include <linux/uaccess.h> |
667 |
++#include <asm/i387.h> /* For use_eager_fpu. Ugh! */ |
668 |
++#include <asm/fpu-internal.h> /* For use_eager_fpu. Ugh! */ |
669 |
+ #include <asm/user.h> |
670 |
+ #include <asm/xsave.h> |
671 |
+ #include "cpuid.h" |
672 |
+@@ -95,6 +97,8 @@ int kvm_update_cpuid(struct kvm_vcpu *vcpu) |
673 |
+ if (best && (best->eax & (F(XSAVES) | F(XSAVEC)))) |
674 |
+ best->ebx = xstate_required_size(vcpu->arch.xcr0, true); |
675 |
+ |
676 |
++ vcpu->arch.eager_fpu = guest_cpuid_has_mpx(vcpu); |
677 |
++ |
678 |
+ /* |
679 |
+ * The existing code assumes virtual address is 48-bit in the canonical |
680 |
+ * address checks; exit if it is ever changed. |
681 |
+diff --git a/arch/x86/kvm/cpuid.h b/arch/x86/kvm/cpuid.h |
682 |
+index 4452eedfaedd..9bec2b8cdced 100644 |
683 |
+--- a/arch/x86/kvm/cpuid.h |
684 |
++++ b/arch/x86/kvm/cpuid.h |
685 |
+@@ -111,4 +111,12 @@ static inline bool guest_cpuid_has_rtm(struct kvm_vcpu *vcpu) |
686 |
+ best = kvm_find_cpuid_entry(vcpu, 7, 0); |
687 |
+ return best && (best->ebx & bit(X86_FEATURE_RTM)); |
688 |
+ } |
689 |
++ |
690 |
++static inline bool guest_cpuid_has_mpx(struct kvm_vcpu *vcpu) |
691 |
++{ |
692 |
++ struct kvm_cpuid_entry2 *best; |
693 |
++ |
694 |
++ best = kvm_find_cpuid_entry(vcpu, 7, 0); |
695 |
++ return best && (best->ebx & bit(X86_FEATURE_MPX)); |
696 |
++} |
697 |
+ #endif |
698 |
+diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c |
699 |
+index cee759299a35..88ee9282a57e 100644 |
700 |
+--- a/arch/x86/kvm/mmu.c |
701 |
++++ b/arch/x86/kvm/mmu.c |
702 |
+@@ -3736,8 +3736,8 @@ static void reset_rsvds_bits_mask_ept(struct kvm_vcpu *vcpu, |
703 |
+ } |
704 |
+ } |
705 |
+ |
706 |
+-void update_permission_bitmask(struct kvm_vcpu *vcpu, |
707 |
+- struct kvm_mmu *mmu, bool ept) |
708 |
++static void update_permission_bitmask(struct kvm_vcpu *vcpu, |
709 |
++ struct kvm_mmu *mmu, bool ept) |
710 |
+ { |
711 |
+ unsigned bit, byte, pfec; |
712 |
+ u8 map; |
713 |
+@@ -3918,6 +3918,7 @@ static void init_kvm_tdp_mmu(struct kvm_vcpu *vcpu) |
714 |
+ void kvm_init_shadow_mmu(struct kvm_vcpu *vcpu) |
715 |
+ { |
716 |
+ bool smep = kvm_read_cr4_bits(vcpu, X86_CR4_SMEP); |
717 |
++ bool smap = kvm_read_cr4_bits(vcpu, X86_CR4_SMAP); |
718 |
+ struct kvm_mmu *context = &vcpu->arch.mmu; |
719 |
+ |
720 |
+ MMU_WARN_ON(VALID_PAGE(context->root_hpa)); |
721 |
+@@ -3936,6 +3937,8 @@ void kvm_init_shadow_mmu(struct kvm_vcpu *vcpu) |
722 |
+ context->base_role.cr0_wp = is_write_protection(vcpu); |
723 |
+ context->base_role.smep_andnot_wp |
724 |
+ = smep && !is_write_protection(vcpu); |
725 |
++ context->base_role.smap_andnot_wp |
726 |
++ = smap && !is_write_protection(vcpu); |
727 |
+ } |
728 |
+ EXPORT_SYMBOL_GPL(kvm_init_shadow_mmu); |
729 |
+ |
730 |
+@@ -4207,12 +4210,18 @@ void kvm_mmu_pte_write(struct kvm_vcpu *vcpu, gpa_t gpa, |
731 |
+ const u8 *new, int bytes) |
732 |
+ { |
733 |
+ gfn_t gfn = gpa >> PAGE_SHIFT; |
734 |
+- union kvm_mmu_page_role mask = { .word = 0 }; |
735 |
+ struct kvm_mmu_page *sp; |
736 |
+ LIST_HEAD(invalid_list); |
737 |
+ u64 entry, gentry, *spte; |
738 |
+ int npte; |
739 |
+ bool remote_flush, local_flush, zap_page; |
740 |
++ union kvm_mmu_page_role mask = (union kvm_mmu_page_role) { |
741 |
++ .cr0_wp = 1, |
742 |
++ .cr4_pae = 1, |
743 |
++ .nxe = 1, |
744 |
++ .smep_andnot_wp = 1, |
745 |
++ .smap_andnot_wp = 1, |
746 |
++ }; |
747 |
+ |
748 |
+ /* |
749 |
+ * If we don't have indirect shadow pages, it means no page is |
750 |
+@@ -4238,7 +4247,6 @@ void kvm_mmu_pte_write(struct kvm_vcpu *vcpu, gpa_t gpa, |
751 |
+ ++vcpu->kvm->stat.mmu_pte_write; |
752 |
+ kvm_mmu_audit(vcpu, AUDIT_PRE_PTE_WRITE); |
753 |
+ |
754 |
+- mask.cr0_wp = mask.cr4_pae = mask.nxe = 1; |
755 |
+ for_each_gfn_indirect_valid_sp(vcpu->kvm, sp, gfn) { |
756 |
+ if (detect_write_misaligned(sp, gpa, bytes) || |
757 |
+ detect_write_flooding(sp)) { |
758 |
+diff --git a/arch/x86/kvm/mmu.h b/arch/x86/kvm/mmu.h |
759 |
+index c7d65637c851..0ada65ecddcf 100644 |
760 |
+--- a/arch/x86/kvm/mmu.h |
761 |
++++ b/arch/x86/kvm/mmu.h |
762 |
+@@ -71,8 +71,6 @@ enum { |
763 |
+ int handle_mmio_page_fault_common(struct kvm_vcpu *vcpu, u64 addr, bool direct); |
764 |
+ void kvm_init_shadow_mmu(struct kvm_vcpu *vcpu); |
765 |
+ void kvm_init_shadow_ept_mmu(struct kvm_vcpu *vcpu, bool execonly); |
766 |
+-void update_permission_bitmask(struct kvm_vcpu *vcpu, struct kvm_mmu *mmu, |
767 |
+- bool ept); |
768 |
+ |
769 |
+ static inline unsigned int kvm_mmu_available_pages(struct kvm *kvm) |
770 |
+ { |
771 |
+@@ -166,6 +164,8 @@ static inline bool permission_fault(struct kvm_vcpu *vcpu, struct kvm_mmu *mmu, |
772 |
+ int index = (pfec >> 1) + |
773 |
+ (smap >> (X86_EFLAGS_AC_BIT - PFERR_RSVD_BIT + 1)); |
774 |
+ |
775 |
++ WARN_ON(pfec & PFERR_RSVD_MASK); |
776 |
++ |
777 |
+ return (mmu->permissions[index] >> pte_access) & 1; |
778 |
+ } |
779 |
+ |
780 |
+diff --git a/arch/x86/kvm/paging_tmpl.h b/arch/x86/kvm/paging_tmpl.h |
781 |
+index fd49c867b25a..6e6d115fe9b5 100644 |
782 |
+--- a/arch/x86/kvm/paging_tmpl.h |
783 |
++++ b/arch/x86/kvm/paging_tmpl.h |
784 |
+@@ -718,6 +718,13 @@ static int FNAME(page_fault)(struct kvm_vcpu *vcpu, gva_t addr, u32 error_code, |
785 |
+ mmu_is_nested(vcpu)); |
786 |
+ if (likely(r != RET_MMIO_PF_INVALID)) |
787 |
+ return r; |
788 |
++ |
789 |
++ /* |
790 |
++ * page fault with PFEC.RSVD = 1 is caused by shadow |
791 |
++ * page fault, should not be used to walk guest page |
792 |
++ * table. |
793 |
++ */ |
794 |
++ error_code &= ~PFERR_RSVD_MASK; |
795 |
+ }; |
796 |
+ |
797 |
+ r = mmu_topup_memory_caches(vcpu); |
798 |
+diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c |
799 |
+index cc618c882f90..a4e62fcfabcb 100644 |
800 |
+--- a/arch/x86/kvm/svm.c |
801 |
++++ b/arch/x86/kvm/svm.c |
802 |
+@@ -4374,6 +4374,7 @@ static struct kvm_x86_ops svm_x86_ops = { |
803 |
+ .cache_reg = svm_cache_reg, |
804 |
+ .get_rflags = svm_get_rflags, |
805 |
+ .set_rflags = svm_set_rflags, |
806 |
++ .fpu_activate = svm_fpu_activate, |
807 |
+ .fpu_deactivate = svm_fpu_deactivate, |
808 |
+ |
809 |
+ .tlb_flush = svm_flush_tlb, |
810 |
+diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c |
811 |
+index a60bd3aa0965..5318d64674b0 100644 |
812 |
+--- a/arch/x86/kvm/vmx.c |
813 |
++++ b/arch/x86/kvm/vmx.c |
814 |
+@@ -10179,6 +10179,7 @@ static struct kvm_x86_ops vmx_x86_ops = { |
815 |
+ .cache_reg = vmx_cache_reg, |
816 |
+ .get_rflags = vmx_get_rflags, |
817 |
+ .set_rflags = vmx_set_rflags, |
818 |
++ .fpu_activate = vmx_fpu_activate, |
819 |
+ .fpu_deactivate = vmx_fpu_deactivate, |
820 |
+ |
821 |
+ .tlb_flush = vmx_flush_tlb, |
822 |
+diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c |
823 |
+index e222ba5d2beb..8838057da9c3 100644 |
824 |
+--- a/arch/x86/kvm/x86.c |
825 |
++++ b/arch/x86/kvm/x86.c |
826 |
+@@ -702,8 +702,9 @@ EXPORT_SYMBOL_GPL(kvm_set_xcr); |
827 |
+ int kvm_set_cr4(struct kvm_vcpu *vcpu, unsigned long cr4) |
828 |
+ { |
829 |
+ unsigned long old_cr4 = kvm_read_cr4(vcpu); |
830 |
+- unsigned long pdptr_bits = X86_CR4_PGE | X86_CR4_PSE | |
831 |
+- X86_CR4_PAE | X86_CR4_SMEP; |
832 |
++ unsigned long pdptr_bits = X86_CR4_PGE | X86_CR4_PSE | X86_CR4_PAE | |
833 |
++ X86_CR4_SMEP | X86_CR4_SMAP; |
834 |
++ |
835 |
+ if (cr4 & CR4_RESERVED_BITS) |
836 |
+ return 1; |
837 |
+ |
838 |
+@@ -744,9 +745,6 @@ int kvm_set_cr4(struct kvm_vcpu *vcpu, unsigned long cr4) |
839 |
+ (!(cr4 & X86_CR4_PCIDE) && (old_cr4 & X86_CR4_PCIDE))) |
840 |
+ kvm_mmu_reset_context(vcpu); |
841 |
+ |
842 |
+- if ((cr4 ^ old_cr4) & X86_CR4_SMAP) |
843 |
+- update_permission_bitmask(vcpu, vcpu->arch.walk_mmu, false); |
844 |
+- |
845 |
+ if ((cr4 ^ old_cr4) & X86_CR4_OSXSAVE) |
846 |
+ kvm_update_cpuid(vcpu); |
847 |
+ |
848 |
+@@ -6141,6 +6139,8 @@ void kvm_vcpu_reload_apic_access_page(struct kvm_vcpu *vcpu) |
849 |
+ return; |
850 |
+ |
851 |
+ page = gfn_to_page(vcpu->kvm, APIC_DEFAULT_PHYS_BASE >> PAGE_SHIFT); |
852 |
++ if (is_error_page(page)) |
853 |
++ return; |
854 |
+ kvm_x86_ops->set_apic_access_page_addr(vcpu, page_to_phys(page)); |
855 |
+ |
856 |
+ /* |
857 |
+@@ -6996,7 +6996,9 @@ void kvm_put_guest_fpu(struct kvm_vcpu *vcpu) |
858 |
+ fpu_save_init(&vcpu->arch.guest_fpu); |
859 |
+ __kernel_fpu_end(); |
860 |
+ ++vcpu->stat.fpu_reload; |
861 |
+- kvm_make_request(KVM_REQ_DEACTIVATE_FPU, vcpu); |
862 |
++ if (!vcpu->arch.eager_fpu) |
863 |
++ kvm_make_request(KVM_REQ_DEACTIVATE_FPU, vcpu); |
864 |
++ |
865 |
+ trace_kvm_fpu(0); |
866 |
+ } |
867 |
+ |
868 |
+@@ -7012,11 +7014,21 @@ void kvm_arch_vcpu_free(struct kvm_vcpu *vcpu) |
869 |
+ struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm, |
870 |
+ unsigned int id) |
871 |
+ { |
872 |
++ struct kvm_vcpu *vcpu; |
873 |
++ |
874 |
+ if (check_tsc_unstable() && atomic_read(&kvm->online_vcpus) != 0) |
875 |
+ printk_once(KERN_WARNING |
876 |
+ "kvm: SMP vm created on host with unstable TSC; " |
877 |
+ "guest TSC will not be reliable\n"); |
878 |
+- return kvm_x86_ops->vcpu_create(kvm, id); |
879 |
++ |
880 |
++ vcpu = kvm_x86_ops->vcpu_create(kvm, id); |
881 |
++ |
882 |
++ /* |
883 |
++ * Activate fpu unconditionally in case the guest needs eager FPU. It will be |
884 |
++ * deactivated soon if it doesn't. |
885 |
++ */ |
886 |
++ kvm_x86_ops->fpu_activate(vcpu); |
887 |
++ return vcpu; |
888 |
+ } |
889 |
+ |
890 |
+ int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu) |
891 |
+diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c |
892 |
+index f9eeae871593..5aa1f6e281d2 100644 |
893 |
+--- a/drivers/acpi/osl.c |
894 |
++++ b/drivers/acpi/osl.c |
895 |
+@@ -182,7 +182,7 @@ static void __init acpi_request_region (struct acpi_generic_address *gas, |
896 |
+ request_mem_region(addr, length, desc); |
897 |
+ } |
898 |
+ |
899 |
+-static int __init acpi_reserve_resources(void) |
900 |
++static void __init acpi_reserve_resources(void) |
901 |
+ { |
902 |
+ acpi_request_region(&acpi_gbl_FADT.xpm1a_event_block, acpi_gbl_FADT.pm1_event_length, |
903 |
+ "ACPI PM1a_EVT_BLK"); |
904 |
+@@ -211,10 +211,7 @@ static int __init acpi_reserve_resources(void) |
905 |
+ if (!(acpi_gbl_FADT.gpe1_block_length & 0x1)) |
906 |
+ acpi_request_region(&acpi_gbl_FADT.xgpe1_block, |
907 |
+ acpi_gbl_FADT.gpe1_block_length, "ACPI GPE1_BLK"); |
908 |
+- |
909 |
+- return 0; |
910 |
+ } |
911 |
+-device_initcall(acpi_reserve_resources); |
912 |
+ |
913 |
+ void acpi_os_printf(const char *fmt, ...) |
914 |
+ { |
915 |
+@@ -1845,6 +1842,7 @@ acpi_status __init acpi_os_initialize(void) |
916 |
+ |
917 |
+ acpi_status __init acpi_os_initialize1(void) |
918 |
+ { |
919 |
++ acpi_reserve_resources(); |
920 |
+ kacpid_wq = alloc_workqueue("kacpid", 0, 1); |
921 |
+ kacpi_notify_wq = alloc_workqueue("kacpi_notify", 0, 1); |
922 |
+ kacpi_hotplug_wq = alloc_ordered_workqueue("kacpi_hotplug", 0); |
923 |
+diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c |
924 |
+index 33bb06e006c9..adce56fa9cef 100644 |
925 |
+--- a/drivers/ata/ahci.c |
926 |
++++ b/drivers/ata/ahci.c |
927 |
+@@ -66,6 +66,7 @@ enum board_ids { |
928 |
+ board_ahci_yes_fbs, |
929 |
+ |
930 |
+ /* board IDs for specific chipsets in alphabetical order */ |
931 |
++ board_ahci_avn, |
932 |
+ board_ahci_mcp65, |
933 |
+ board_ahci_mcp77, |
934 |
+ board_ahci_mcp89, |
935 |
+@@ -84,6 +85,8 @@ enum board_ids { |
936 |
+ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent); |
937 |
+ static int ahci_vt8251_hardreset(struct ata_link *link, unsigned int *class, |
938 |
+ unsigned long deadline); |
939 |
++static int ahci_avn_hardreset(struct ata_link *link, unsigned int *class, |
940 |
++ unsigned long deadline); |
941 |
+ static void ahci_mcp89_apple_enable(struct pci_dev *pdev); |
942 |
+ static bool is_mcp89_apple(struct pci_dev *pdev); |
943 |
+ static int ahci_p5wdh_hardreset(struct ata_link *link, unsigned int *class, |
944 |
+@@ -107,6 +110,11 @@ static struct ata_port_operations ahci_p5wdh_ops = { |
945 |
+ .hardreset = ahci_p5wdh_hardreset, |
946 |
+ }; |
947 |
+ |
948 |
++static struct ata_port_operations ahci_avn_ops = { |
949 |
++ .inherits = &ahci_ops, |
950 |
++ .hardreset = ahci_avn_hardreset, |
951 |
++}; |
952 |
++ |
953 |
+ static const struct ata_port_info ahci_port_info[] = { |
954 |
+ /* by features */ |
955 |
+ [board_ahci] = { |
956 |
+@@ -151,6 +159,12 @@ static const struct ata_port_info ahci_port_info[] = { |
957 |
+ .port_ops = &ahci_ops, |
958 |
+ }, |
959 |
+ /* by chipsets */ |
960 |
++ [board_ahci_avn] = { |
961 |
++ .flags = AHCI_FLAG_COMMON, |
962 |
++ .pio_mask = ATA_PIO4, |
963 |
++ .udma_mask = ATA_UDMA6, |
964 |
++ .port_ops = &ahci_avn_ops, |
965 |
++ }, |
966 |
+ [board_ahci_mcp65] = { |
967 |
+ AHCI_HFLAGS (AHCI_HFLAG_NO_FPDMA_AA | AHCI_HFLAG_NO_PMP | |
968 |
+ AHCI_HFLAG_YES_NCQ), |
969 |
+@@ -290,14 +304,14 @@ static const struct pci_device_id ahci_pci_tbl[] = { |
970 |
+ { PCI_VDEVICE(INTEL, 0x1f27), board_ahci }, /* Avoton RAID */ |
971 |
+ { PCI_VDEVICE(INTEL, 0x1f2e), board_ahci }, /* Avoton RAID */ |
972 |
+ { PCI_VDEVICE(INTEL, 0x1f2f), board_ahci }, /* Avoton RAID */ |
973 |
+- { PCI_VDEVICE(INTEL, 0x1f32), board_ahci }, /* Avoton AHCI */ |
974 |
+- { PCI_VDEVICE(INTEL, 0x1f33), board_ahci }, /* Avoton AHCI */ |
975 |
+- { PCI_VDEVICE(INTEL, 0x1f34), board_ahci }, /* Avoton RAID */ |
976 |
+- { PCI_VDEVICE(INTEL, 0x1f35), board_ahci }, /* Avoton RAID */ |
977 |
+- { PCI_VDEVICE(INTEL, 0x1f36), board_ahci }, /* Avoton RAID */ |
978 |
+- { PCI_VDEVICE(INTEL, 0x1f37), board_ahci }, /* Avoton RAID */ |
979 |
+- { PCI_VDEVICE(INTEL, 0x1f3e), board_ahci }, /* Avoton RAID */ |
980 |
+- { PCI_VDEVICE(INTEL, 0x1f3f), board_ahci }, /* Avoton RAID */ |
981 |
++ { PCI_VDEVICE(INTEL, 0x1f32), board_ahci_avn }, /* Avoton AHCI */ |
982 |
++ { PCI_VDEVICE(INTEL, 0x1f33), board_ahci_avn }, /* Avoton AHCI */ |
983 |
++ { PCI_VDEVICE(INTEL, 0x1f34), board_ahci_avn }, /* Avoton RAID */ |
984 |
++ { PCI_VDEVICE(INTEL, 0x1f35), board_ahci_avn }, /* Avoton RAID */ |
985 |
++ { PCI_VDEVICE(INTEL, 0x1f36), board_ahci_avn }, /* Avoton RAID */ |
986 |
++ { PCI_VDEVICE(INTEL, 0x1f37), board_ahci_avn }, /* Avoton RAID */ |
987 |
++ { PCI_VDEVICE(INTEL, 0x1f3e), board_ahci_avn }, /* Avoton RAID */ |
988 |
++ { PCI_VDEVICE(INTEL, 0x1f3f), board_ahci_avn }, /* Avoton RAID */ |
989 |
+ { PCI_VDEVICE(INTEL, 0x2823), board_ahci }, /* Wellsburg RAID */ |
990 |
+ { PCI_VDEVICE(INTEL, 0x2827), board_ahci }, /* Wellsburg RAID */ |
991 |
+ { PCI_VDEVICE(INTEL, 0x8d02), board_ahci }, /* Wellsburg AHCI */ |
992 |
+@@ -670,6 +684,79 @@ static int ahci_p5wdh_hardreset(struct ata_link *link, unsigned int *class, |
993 |
+ return rc; |
994 |
+ } |
995 |
+ |
996 |
++/* |
997 |
++ * ahci_avn_hardreset - attempt more aggressive recovery of Avoton ports. |
998 |
++ * |
999 |
++ * It has been observed with some SSDs that the timing of events in the |
1000 |
++ * link synchronization phase can leave the port in a state that can not |
1001 |
++ * be recovered by a SATA-hard-reset alone. The failing signature is |
1002 |
++ * SStatus.DET stuck at 1 ("Device presence detected but Phy |
1003 |
++ * communication not established"). It was found that unloading and |
1004 |
++ * reloading the driver when this problem occurs allows the drive |
1005 |
++ * connection to be recovered (DET advanced to 0x3). The critical |
1006 |
++ * component of reloading the driver is that the port state machines are |
1007 |
++ * reset by bouncing "port enable" in the AHCI PCS configuration |
1008 |
++ * register. So, reproduce that effect by bouncing a port whenever we |
1009 |
++ * see DET==1 after a reset. |
1010 |
++ */ |
1011 |
++static int ahci_avn_hardreset(struct ata_link *link, unsigned int *class, |
1012 |
++ unsigned long deadline) |
1013 |
++{ |
1014 |
++ const unsigned long *timing = sata_ehc_deb_timing(&link->eh_context); |
1015 |
++ struct ata_port *ap = link->ap; |
1016 |
++ struct ahci_port_priv *pp = ap->private_data; |
1017 |
++ struct ahci_host_priv *hpriv = ap->host->private_data; |
1018 |
++ u8 *d2h_fis = pp->rx_fis + RX_FIS_D2H_REG; |
1019 |
++ unsigned long tmo = deadline - jiffies; |
1020 |
++ struct ata_taskfile tf; |
1021 |
++ bool online; |
1022 |
++ int rc, i; |
1023 |
++ |
1024 |
++ DPRINTK("ENTER\n"); |
1025 |
++ |
1026 |
++ ahci_stop_engine(ap); |
1027 |
++ |
1028 |
++ for (i = 0; i < 2; i++) { |
1029 |
++ u16 val; |
1030 |
++ u32 sstatus; |
1031 |
++ int port = ap->port_no; |
1032 |
++ struct ata_host *host = ap->host; |
1033 |
++ struct pci_dev *pdev = to_pci_dev(host->dev); |
1034 |
++ |
1035 |
++ /* clear D2H reception area to properly wait for D2H FIS */ |
1036 |
++ ata_tf_init(link->device, &tf); |
1037 |
++ tf.command = ATA_BUSY; |
1038 |
++ ata_tf_to_fis(&tf, 0, 0, d2h_fis); |
1039 |
++ |
1040 |
++ rc = sata_link_hardreset(link, timing, deadline, &online, |
1041 |
++ ahci_check_ready); |
1042 |
++ |
1043 |
++ if (sata_scr_read(link, SCR_STATUS, &sstatus) != 0 || |
1044 |
++ (sstatus & 0xf) != 1) |
1045 |
++ break; |
1046 |
++ |
1047 |
++ ata_link_printk(link, KERN_INFO, "avn bounce port%d\n", |
1048 |
++ port); |
1049 |
++ |
1050 |
++ pci_read_config_word(pdev, 0x92, &val); |
1051 |
++ val &= ~(1 << port); |
1052 |
++ pci_write_config_word(pdev, 0x92, val); |
1053 |
++ ata_msleep(ap, 1000); |
1054 |
++ val |= 1 << port; |
1055 |
++ pci_write_config_word(pdev, 0x92, val); |
1056 |
++ deadline += tmo; |
1057 |
++ } |
1058 |
++ |
1059 |
++ hpriv->start_engine(ap); |
1060 |
++ |
1061 |
++ if (online) |
1062 |
++ *class = ahci_dev_classify(ap); |
1063 |
++ |
1064 |
++ DPRINTK("EXIT, rc=%d, class=%u\n", rc, *class); |
1065 |
++ return rc; |
1066 |
++} |
1067 |
++ |
1068 |
++ |
1069 |
+ #ifdef CONFIG_PM |
1070 |
+ static int ahci_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg) |
1071 |
+ { |
1072 |
+diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c |
1073 |
+index 61a9c07e0dff..287c4ba0219f 100644 |
1074 |
+--- a/drivers/ata/libahci.c |
1075 |
++++ b/drivers/ata/libahci.c |
1076 |
+@@ -1707,8 +1707,7 @@ static void ahci_handle_port_interrupt(struct ata_port *ap, |
1077 |
+ if (unlikely(resetting)) |
1078 |
+ status &= ~PORT_IRQ_BAD_PMP; |
1079 |
+ |
1080 |
+- /* if LPM is enabled, PHYRDY doesn't mean anything */ |
1081 |
+- if (ap->link.lpm_policy > ATA_LPM_MAX_POWER) { |
1082 |
++ if (sata_lpm_ignore_phy_events(&ap->link)) { |
1083 |
+ status &= ~PORT_IRQ_PHYRDY; |
1084 |
+ ahci_scr_write(&ap->link, SCR_ERROR, SERR_PHYRDY_CHG); |
1085 |
+ } |
1086 |
+diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c |
1087 |
+index 23dac3babfe3..87b4b7f9fdc6 100644 |
1088 |
+--- a/drivers/ata/libata-core.c |
1089 |
++++ b/drivers/ata/libata-core.c |
1090 |
+@@ -4214,7 +4214,7 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { |
1091 |
+ ATA_HORKAGE_ZERO_AFTER_TRIM, }, |
1092 |
+ { "Crucial_CT*MX100*", "MU01", ATA_HORKAGE_NO_NCQ_TRIM | |
1093 |
+ ATA_HORKAGE_ZERO_AFTER_TRIM, }, |
1094 |
+- { "Samsung SSD 850 PRO*", NULL, ATA_HORKAGE_NO_NCQ_TRIM | |
1095 |
++ { "Samsung SSD 8*", NULL, ATA_HORKAGE_NO_NCQ_TRIM | |
1096 |
+ ATA_HORKAGE_ZERO_AFTER_TRIM, }, |
1097 |
+ |
1098 |
+ /* |
1099 |
+@@ -6728,6 +6728,38 @@ u32 ata_wait_register(struct ata_port *ap, void __iomem *reg, u32 mask, u32 val, |
1100 |
+ return tmp; |
1101 |
+ } |
1102 |
+ |
1103 |
++/** |
1104 |
++ * sata_lpm_ignore_phy_events - test if PHY event should be ignored |
1105 |
++ * @link: Link receiving the event |
1106 |
++ * |
1107 |
++ * Test whether the received PHY event has to be ignored or not. |
1108 |
++ * |
1109 |
++ * LOCKING: |
1110 |
++ * None: |
1111 |
++ * |
1112 |
++ * RETURNS: |
1113 |
++ * True if the event has to be ignored. |
1114 |
++ */ |
1115 |
++bool sata_lpm_ignore_phy_events(struct ata_link *link) |
1116 |
++{ |
1117 |
++ unsigned long lpm_timeout = link->last_lpm_change + |
1118 |
++ msecs_to_jiffies(ATA_TMOUT_SPURIOUS_PHY); |
1119 |
++ |
1120 |
++ /* if LPM is enabled, PHYRDY doesn't mean anything */ |
1121 |
++ if (link->lpm_policy > ATA_LPM_MAX_POWER) |
1122 |
++ return true; |
1123 |
++ |
1124 |
++ /* ignore the first PHY event after the LPM policy changed |
1125 |
++ * as it is might be spurious |
1126 |
++ */ |
1127 |
++ if ((link->flags & ATA_LFLAG_CHANGED) && |
1128 |
++ time_before(jiffies, lpm_timeout)) |
1129 |
++ return true; |
1130 |
++ |
1131 |
++ return false; |
1132 |
++} |
1133 |
++EXPORT_SYMBOL_GPL(sata_lpm_ignore_phy_events); |
1134 |
++ |
1135 |
+ /* |
1136 |
+ * Dummy port_ops |
1137 |
+ */ |
1138 |
+diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c |
1139 |
+index d2029a462e2c..89c3d83e1ca7 100644 |
1140 |
+--- a/drivers/ata/libata-eh.c |
1141 |
++++ b/drivers/ata/libata-eh.c |
1142 |
+@@ -3489,6 +3489,9 @@ static int ata_eh_set_lpm(struct ata_link *link, enum ata_lpm_policy policy, |
1143 |
+ } |
1144 |
+ } |
1145 |
+ |
1146 |
++ link->last_lpm_change = jiffies; |
1147 |
++ link->flags |= ATA_LFLAG_CHANGED; |
1148 |
++ |
1149 |
+ return 0; |
1150 |
+ |
1151 |
+ fail: |
1152 |
+diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c |
1153 |
+index 237f23f68bfc..1daa0ea2f1ac 100644 |
1154 |
+--- a/drivers/clk/clk.c |
1155 |
++++ b/drivers/clk/clk.c |
1156 |
+@@ -1443,8 +1443,10 @@ static struct clk_core *__clk_set_parent_before(struct clk_core *clk, |
1157 |
+ */ |
1158 |
+ if (clk->prepare_count) { |
1159 |
+ clk_core_prepare(parent); |
1160 |
++ flags = clk_enable_lock(); |
1161 |
+ clk_core_enable(parent); |
1162 |
+ clk_core_enable(clk); |
1163 |
++ clk_enable_unlock(flags); |
1164 |
+ } |
1165 |
+ |
1166 |
+ /* update the clk tree topology */ |
1167 |
+@@ -1459,13 +1461,17 @@ static void __clk_set_parent_after(struct clk_core *core, |
1168 |
+ struct clk_core *parent, |
1169 |
+ struct clk_core *old_parent) |
1170 |
+ { |
1171 |
++ unsigned long flags; |
1172 |
++ |
1173 |
+ /* |
1174 |
+ * Finish the migration of prepare state and undo the changes done |
1175 |
+ * for preventing a race with clk_enable(). |
1176 |
+ */ |
1177 |
+ if (core->prepare_count) { |
1178 |
++ flags = clk_enable_lock(); |
1179 |
+ clk_core_disable(core); |
1180 |
+ clk_core_disable(old_parent); |
1181 |
++ clk_enable_unlock(flags); |
1182 |
+ clk_core_unprepare(old_parent); |
1183 |
+ } |
1184 |
+ } |
1185 |
+@@ -1489,8 +1495,10 @@ static int __clk_set_parent(struct clk_core *clk, struct clk_core *parent, |
1186 |
+ clk_enable_unlock(flags); |
1187 |
+ |
1188 |
+ if (clk->prepare_count) { |
1189 |
++ flags = clk_enable_lock(); |
1190 |
+ clk_core_disable(clk); |
1191 |
+ clk_core_disable(parent); |
1192 |
++ clk_enable_unlock(flags); |
1193 |
+ clk_core_unprepare(parent); |
1194 |
+ } |
1195 |
+ return ret; |
1196 |
+diff --git a/drivers/clk/samsung/clk-exynos5420.c b/drivers/clk/samsung/clk-exynos5420.c |
1197 |
+index 07d666cc6a29..bea4a173eef5 100644 |
1198 |
+--- a/drivers/clk/samsung/clk-exynos5420.c |
1199 |
++++ b/drivers/clk/samsung/clk-exynos5420.c |
1200 |
+@@ -271,6 +271,7 @@ static const struct samsung_clk_reg_dump exynos5420_set_clksrc[] = { |
1201 |
+ { .offset = SRC_MASK_PERIC0, .value = 0x11111110, }, |
1202 |
+ { .offset = SRC_MASK_PERIC1, .value = 0x11111100, }, |
1203 |
+ { .offset = SRC_MASK_ISP, .value = 0x11111000, }, |
1204 |
++ { .offset = GATE_BUS_TOP, .value = 0xffffffff, }, |
1205 |
+ { .offset = GATE_BUS_DISP1, .value = 0xffffffff, }, |
1206 |
+ { .offset = GATE_IP_PERIC, .value = 0xffffffff, }, |
1207 |
+ }; |
1208 |
+diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c |
1209 |
+index 2eebd28b4c40..ccc20188f00c 100644 |
1210 |
+--- a/drivers/firmware/dmi_scan.c |
1211 |
++++ b/drivers/firmware/dmi_scan.c |
1212 |
+@@ -499,18 +499,19 @@ static int __init dmi_present(const u8 *buf) |
1213 |
+ buf += 16; |
1214 |
+ |
1215 |
+ if (memcmp(buf, "_DMI_", 5) == 0 && dmi_checksum(buf, 15)) { |
1216 |
++ if (smbios_ver) |
1217 |
++ dmi_ver = smbios_ver; |
1218 |
++ else |
1219 |
++ dmi_ver = (buf[14] & 0xF0) << 4 | (buf[14] & 0x0F); |
1220 |
+ dmi_num = get_unaligned_le16(buf + 12); |
1221 |
+ dmi_len = get_unaligned_le16(buf + 6); |
1222 |
+ dmi_base = get_unaligned_le32(buf + 8); |
1223 |
+ |
1224 |
+ if (dmi_walk_early(dmi_decode) == 0) { |
1225 |
+ if (smbios_ver) { |
1226 |
+- dmi_ver = smbios_ver; |
1227 |
+ pr_info("SMBIOS %d.%d present.\n", |
1228 |
+ dmi_ver >> 8, dmi_ver & 0xFF); |
1229 |
+ } else { |
1230 |
+- dmi_ver = (buf[14] & 0xF0) << 4 | |
1231 |
+- (buf[14] & 0x0F); |
1232 |
+ pr_info("Legacy DMI %d.%d present.\n", |
1233 |
+ dmi_ver >> 8, dmi_ver & 0xFF); |
1234 |
+ } |
1235 |
+diff --git a/drivers/gpio/gpio-kempld.c b/drivers/gpio/gpio-kempld.c |
1236 |
+index 443518f63f15..a6b0def4bd7b 100644 |
1237 |
+--- a/drivers/gpio/gpio-kempld.c |
1238 |
++++ b/drivers/gpio/gpio-kempld.c |
1239 |
+@@ -117,7 +117,7 @@ static int kempld_gpio_get_direction(struct gpio_chip *chip, unsigned offset) |
1240 |
+ = container_of(chip, struct kempld_gpio_data, chip); |
1241 |
+ struct kempld_device_data *pld = gpio->pld; |
1242 |
+ |
1243 |
+- return kempld_gpio_get_bit(pld, KEMPLD_GPIO_DIR_NUM(offset), offset); |
1244 |
++ return !kempld_gpio_get_bit(pld, KEMPLD_GPIO_DIR_NUM(offset), offset); |
1245 |
+ } |
1246 |
+ |
1247 |
+ static int kempld_gpio_pincount(struct kempld_device_data *pld) |
1248 |
+diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_topology.c b/drivers/gpu/drm/amd/amdkfd/kfd_topology.c |
1249 |
+index 498399323a8c..406624a0b201 100644 |
1250 |
+--- a/drivers/gpu/drm/amd/amdkfd/kfd_topology.c |
1251 |
++++ b/drivers/gpu/drm/amd/amdkfd/kfd_topology.c |
1252 |
+@@ -729,7 +729,7 @@ static ssize_t node_show(struct kobject *kobj, struct attribute *attr, |
1253 |
+ kfd2kgd->get_max_engine_clock_in_mhz( |
1254 |
+ dev->gpu->kgd)); |
1255 |
+ sysfs_show_64bit_prop(buffer, "local_mem_size", |
1256 |
+- kfd2kgd->get_vmem_size(dev->gpu->kgd)); |
1257 |
++ (unsigned long long int) 0); |
1258 |
+ |
1259 |
+ sysfs_show_32bit_prop(buffer, "fw_version", |
1260 |
+ kfd2kgd->get_fw_version( |
1261 |
+diff --git a/drivers/gpu/drm/drm_plane_helper.c b/drivers/gpu/drm/drm_plane_helper.c |
1262 |
+index 5ba5792bfdba..98b125763ecd 100644 |
1263 |
+--- a/drivers/gpu/drm/drm_plane_helper.c |
1264 |
++++ b/drivers/gpu/drm/drm_plane_helper.c |
1265 |
+@@ -476,6 +476,9 @@ int drm_plane_helper_commit(struct drm_plane *plane, |
1266 |
+ if (!crtc[i]) |
1267 |
+ continue; |
1268 |
+ |
1269 |
++ if (crtc[i]->cursor == plane) |
1270 |
++ continue; |
1271 |
++ |
1272 |
+ /* There's no other way to figure out whether the crtc is running. */ |
1273 |
+ ret = drm_crtc_vblank_get(crtc[i]); |
1274 |
+ if (ret == 0) { |
1275 |
+diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c |
1276 |
+index 1afc0b419da2..965a45619f6b 100644 |
1277 |
+--- a/drivers/gpu/drm/radeon/atombios_crtc.c |
1278 |
++++ b/drivers/gpu/drm/radeon/atombios_crtc.c |
1279 |
+@@ -1789,7 +1789,9 @@ static int radeon_get_shared_nondp_ppll(struct drm_crtc *crtc) |
1280 |
+ if ((crtc->mode.clock == test_crtc->mode.clock) && |
1281 |
+ (adjusted_clock == test_adjusted_clock) && |
1282 |
+ (radeon_crtc->ss_enabled == test_radeon_crtc->ss_enabled) && |
1283 |
+- (test_radeon_crtc->pll_id != ATOM_PPLL_INVALID)) |
1284 |
++ (test_radeon_crtc->pll_id != ATOM_PPLL_INVALID) && |
1285 |
++ (drm_detect_monitor_audio(radeon_connector_edid(test_radeon_crtc->connector)) == |
1286 |
++ drm_detect_monitor_audio(radeon_connector_edid(radeon_crtc->connector)))) |
1287 |
+ return test_radeon_crtc->pll_id; |
1288 |
+ } |
1289 |
+ } |
1290 |
+diff --git a/drivers/gpu/drm/radeon/atombios_dp.c b/drivers/gpu/drm/radeon/atombios_dp.c |
1291 |
+index 8d74de82456e..8b2c4c890507 100644 |
1292 |
+--- a/drivers/gpu/drm/radeon/atombios_dp.c |
1293 |
++++ b/drivers/gpu/drm/radeon/atombios_dp.c |
1294 |
+@@ -412,19 +412,21 @@ bool radeon_dp_getdpcd(struct radeon_connector *radeon_connector) |
1295 |
+ { |
1296 |
+ struct radeon_connector_atom_dig *dig_connector = radeon_connector->con_priv; |
1297 |
+ u8 msg[DP_DPCD_SIZE]; |
1298 |
+- int ret; |
1299 |
++ int ret, i; |
1300 |
+ |
1301 |
+- ret = drm_dp_dpcd_read(&radeon_connector->ddc_bus->aux, DP_DPCD_REV, msg, |
1302 |
+- DP_DPCD_SIZE); |
1303 |
+- if (ret > 0) { |
1304 |
+- memcpy(dig_connector->dpcd, msg, DP_DPCD_SIZE); |
1305 |
++ for (i = 0; i < 7; i++) { |
1306 |
++ ret = drm_dp_dpcd_read(&radeon_connector->ddc_bus->aux, DP_DPCD_REV, msg, |
1307 |
++ DP_DPCD_SIZE); |
1308 |
++ if (ret == DP_DPCD_SIZE) { |
1309 |
++ memcpy(dig_connector->dpcd, msg, DP_DPCD_SIZE); |
1310 |
+ |
1311 |
+- DRM_DEBUG_KMS("DPCD: %*ph\n", (int)sizeof(dig_connector->dpcd), |
1312 |
+- dig_connector->dpcd); |
1313 |
++ DRM_DEBUG_KMS("DPCD: %*ph\n", (int)sizeof(dig_connector->dpcd), |
1314 |
++ dig_connector->dpcd); |
1315 |
+ |
1316 |
+- radeon_dp_probe_oui(radeon_connector); |
1317 |
++ radeon_dp_probe_oui(radeon_connector); |
1318 |
+ |
1319 |
+- return true; |
1320 |
++ return true; |
1321 |
++ } |
1322 |
+ } |
1323 |
+ dig_connector->dpcd[0] = 0; |
1324 |
+ return false; |
1325 |
+diff --git a/drivers/gpu/drm/radeon/cik.c b/drivers/gpu/drm/radeon/cik.c |
1326 |
+index 3e670d344a20..19aafb71fd8e 100644 |
1327 |
+--- a/drivers/gpu/drm/radeon/cik.c |
1328 |
++++ b/drivers/gpu/drm/radeon/cik.c |
1329 |
+@@ -5804,7 +5804,7 @@ static int cik_pcie_gart_enable(struct radeon_device *rdev) |
1330 |
+ /* restore context1-15 */ |
1331 |
+ /* set vm size, must be a multiple of 4 */ |
1332 |
+ WREG32(VM_CONTEXT1_PAGE_TABLE_START_ADDR, 0); |
1333 |
+- WREG32(VM_CONTEXT1_PAGE_TABLE_END_ADDR, rdev->vm_manager.max_pfn); |
1334 |
++ WREG32(VM_CONTEXT1_PAGE_TABLE_END_ADDR, rdev->vm_manager.max_pfn - 1); |
1335 |
+ for (i = 1; i < 16; i++) { |
1336 |
+ if (i < 8) |
1337 |
+ WREG32(VM_CONTEXT0_PAGE_TABLE_BASE_ADDR + (i << 2), |
1338 |
+diff --git a/drivers/gpu/drm/radeon/evergreen_hdmi.c b/drivers/gpu/drm/radeon/evergreen_hdmi.c |
1339 |
+index 0926739c9fa7..9953356fe263 100644 |
1340 |
+--- a/drivers/gpu/drm/radeon/evergreen_hdmi.c |
1341 |
++++ b/drivers/gpu/drm/radeon/evergreen_hdmi.c |
1342 |
+@@ -400,7 +400,7 @@ void evergreen_hdmi_enable(struct drm_encoder *encoder, bool enable) |
1343 |
+ if (enable) { |
1344 |
+ struct drm_connector *connector = radeon_get_connector_for_encoder(encoder); |
1345 |
+ |
1346 |
+- if (drm_detect_monitor_audio(radeon_connector_edid(connector))) { |
1347 |
++ if (connector && drm_detect_monitor_audio(radeon_connector_edid(connector))) { |
1348 |
+ WREG32(HDMI_INFOFRAME_CONTROL0 + dig->afmt->offset, |
1349 |
+ HDMI_AVI_INFO_SEND | /* enable AVI info frames */ |
1350 |
+ HDMI_AVI_INFO_CONT | /* required for audio info values to be updated */ |
1351 |
+@@ -438,7 +438,8 @@ void evergreen_dp_enable(struct drm_encoder *encoder, bool enable) |
1352 |
+ if (!dig || !dig->afmt) |
1353 |
+ return; |
1354 |
+ |
1355 |
+- if (enable && drm_detect_monitor_audio(radeon_connector_edid(connector))) { |
1356 |
++ if (enable && connector && |
1357 |
++ drm_detect_monitor_audio(radeon_connector_edid(connector))) { |
1358 |
+ struct drm_connector *connector = radeon_get_connector_for_encoder(encoder); |
1359 |
+ struct radeon_connector *radeon_connector = to_radeon_connector(connector); |
1360 |
+ struct radeon_connector_atom_dig *dig_connector; |
1361 |
+diff --git a/drivers/gpu/drm/radeon/ni.c b/drivers/gpu/drm/radeon/ni.c |
1362 |
+index dab00812abaa..02d585455f49 100644 |
1363 |
+--- a/drivers/gpu/drm/radeon/ni.c |
1364 |
++++ b/drivers/gpu/drm/radeon/ni.c |
1365 |
+@@ -1272,7 +1272,8 @@ static int cayman_pcie_gart_enable(struct radeon_device *rdev) |
1366 |
+ */ |
1367 |
+ for (i = 1; i < 8; i++) { |
1368 |
+ WREG32(VM_CONTEXT0_PAGE_TABLE_START_ADDR + (i << 2), 0); |
1369 |
+- WREG32(VM_CONTEXT0_PAGE_TABLE_END_ADDR + (i << 2), rdev->vm_manager.max_pfn); |
1370 |
++ WREG32(VM_CONTEXT0_PAGE_TABLE_END_ADDR + (i << 2), |
1371 |
++ rdev->vm_manager.max_pfn - 1); |
1372 |
+ WREG32(VM_CONTEXT0_PAGE_TABLE_BASE_ADDR + (i << 2), |
1373 |
+ rdev->vm_manager.saved_table_addr[i]); |
1374 |
+ } |
1375 |
+diff --git a/drivers/gpu/drm/radeon/radeon_audio.c b/drivers/gpu/drm/radeon/radeon_audio.c |
1376 |
+index b7c6bb69f3c7..88c04bc0a7f6 100644 |
1377 |
+--- a/drivers/gpu/drm/radeon/radeon_audio.c |
1378 |
++++ b/drivers/gpu/drm/radeon/radeon_audio.c |
1379 |
+@@ -460,9 +460,6 @@ void radeon_audio_detect(struct drm_connector *connector, |
1380 |
+ if (!connector || !connector->encoder) |
1381 |
+ return; |
1382 |
+ |
1383 |
+- if (!radeon_encoder_is_digital(connector->encoder)) |
1384 |
+- return; |
1385 |
+- |
1386 |
+ rdev = connector->encoder->dev->dev_private; |
1387 |
+ |
1388 |
+ if (!radeon_audio_chipset_supported(rdev)) |
1389 |
+@@ -471,26 +468,26 @@ void radeon_audio_detect(struct drm_connector *connector, |
1390 |
+ radeon_encoder = to_radeon_encoder(connector->encoder); |
1391 |
+ dig = radeon_encoder->enc_priv; |
1392 |
+ |
1393 |
+- if (!dig->afmt) |
1394 |
+- return; |
1395 |
+- |
1396 |
+ if (status == connector_status_connected) { |
1397 |
+- struct radeon_connector *radeon_connector = to_radeon_connector(connector); |
1398 |
++ struct radeon_connector *radeon_connector; |
1399 |
++ int sink_type; |
1400 |
++ |
1401 |
++ if (!drm_detect_monitor_audio(radeon_connector_edid(connector))) { |
1402 |
++ radeon_encoder->audio = NULL; |
1403 |
++ return; |
1404 |
++ } |
1405 |
++ |
1406 |
++ radeon_connector = to_radeon_connector(connector); |
1407 |
++ sink_type = radeon_dp_getsinktype(radeon_connector); |
1408 |
+ |
1409 |
+ if (connector->connector_type == DRM_MODE_CONNECTOR_DisplayPort && |
1410 |
+- radeon_dp_getsinktype(radeon_connector) == |
1411 |
+- CONNECTOR_OBJECT_ID_DISPLAYPORT) |
1412 |
++ sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT) |
1413 |
+ radeon_encoder->audio = rdev->audio.dp_funcs; |
1414 |
+ else |
1415 |
+ radeon_encoder->audio = rdev->audio.hdmi_funcs; |
1416 |
+ |
1417 |
+ dig->afmt->pin = radeon_audio_get_pin(connector->encoder); |
1418 |
+- if (drm_detect_monitor_audio(radeon_connector_edid(connector))) { |
1419 |
+- radeon_audio_enable(rdev, dig->afmt->pin, 0xf); |
1420 |
+- } else { |
1421 |
+- radeon_audio_enable(rdev, dig->afmt->pin, 0); |
1422 |
+- dig->afmt->pin = NULL; |
1423 |
+- } |
1424 |
++ radeon_audio_enable(rdev, dig->afmt->pin, 0xf); |
1425 |
+ } else { |
1426 |
+ radeon_audio_enable(rdev, dig->afmt->pin, 0); |
1427 |
+ dig->afmt->pin = NULL; |
1428 |
+diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c |
1429 |
+index 27973e3faf0e..27def67cb6be 100644 |
1430 |
+--- a/drivers/gpu/drm/radeon/radeon_connectors.c |
1431 |
++++ b/drivers/gpu/drm/radeon/radeon_connectors.c |
1432 |
+@@ -1333,10 +1333,8 @@ out: |
1433 |
+ /* updated in get modes as well since we need to know if it's analog or digital */ |
1434 |
+ radeon_connector_update_scratch_regs(connector, ret); |
1435 |
+ |
1436 |
+- if (radeon_audio != 0) { |
1437 |
+- radeon_connector_get_edid(connector); |
1438 |
++ if (radeon_audio != 0) |
1439 |
+ radeon_audio_detect(connector, ret); |
1440 |
+- } |
1441 |
+ |
1442 |
+ exit: |
1443 |
+ pm_runtime_mark_last_busy(connector->dev->dev); |
1444 |
+@@ -1661,10 +1659,8 @@ radeon_dp_detect(struct drm_connector *connector, bool force) |
1445 |
+ |
1446 |
+ radeon_connector_update_scratch_regs(connector, ret); |
1447 |
+ |
1448 |
+- if (radeon_audio != 0) { |
1449 |
+- radeon_connector_get_edid(connector); |
1450 |
++ if (radeon_audio != 0) |
1451 |
+ radeon_audio_detect(connector, ret); |
1452 |
+- } |
1453 |
+ |
1454 |
+ out: |
1455 |
+ pm_runtime_mark_last_busy(connector->dev->dev); |
1456 |
+diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c |
1457 |
+index a7fb2735d4a9..f433491fab6f 100644 |
1458 |
+--- a/drivers/gpu/drm/radeon/si.c |
1459 |
++++ b/drivers/gpu/drm/radeon/si.c |
1460 |
+@@ -4288,7 +4288,7 @@ static int si_pcie_gart_enable(struct radeon_device *rdev) |
1461 |
+ /* empty context1-15 */ |
1462 |
+ /* set vm size, must be a multiple of 4 */ |
1463 |
+ WREG32(VM_CONTEXT1_PAGE_TABLE_START_ADDR, 0); |
1464 |
+- WREG32(VM_CONTEXT1_PAGE_TABLE_END_ADDR, rdev->vm_manager.max_pfn); |
1465 |
++ WREG32(VM_CONTEXT1_PAGE_TABLE_END_ADDR, rdev->vm_manager.max_pfn - 1); |
1466 |
+ /* Assign the pt base to something valid for now; the pts used for |
1467 |
+ * the VMs are determined by the application and setup and assigned |
1468 |
+ * on the fly in the vm part of radeon_gart.c |
1469 |
+diff --git a/drivers/hid/hid-logitech-hidpp.c b/drivers/hid/hid-logitech-hidpp.c |
1470 |
+index e77658cd037c..2caf5b2f3446 100644 |
1471 |
+--- a/drivers/hid/hid-logitech-hidpp.c |
1472 |
++++ b/drivers/hid/hid-logitech-hidpp.c |
1473 |
+@@ -39,7 +39,6 @@ MODULE_AUTHOR("Nestor Lopez Casado <nlopezcasad@××××××××.com>"); |
1474 |
+ /* bits 1..20 are reserved for classes */ |
1475 |
+ #define HIDPP_QUIRK_DELAYED_INIT BIT(21) |
1476 |
+ #define HIDPP_QUIRK_WTP_PHYSICAL_BUTTONS BIT(22) |
1477 |
+-#define HIDPP_QUIRK_MULTI_INPUT BIT(23) |
1478 |
+ |
1479 |
+ /* |
1480 |
+ * There are two hidpp protocols in use, the first version hidpp10 is known |
1481 |
+@@ -701,12 +700,6 @@ static int wtp_input_mapping(struct hid_device *hdev, struct hid_input *hi, |
1482 |
+ struct hid_field *field, struct hid_usage *usage, |
1483 |
+ unsigned long **bit, int *max) |
1484 |
+ { |
1485 |
+- struct hidpp_device *hidpp = hid_get_drvdata(hdev); |
1486 |
+- |
1487 |
+- if ((hidpp->quirks & HIDPP_QUIRK_MULTI_INPUT) && |
1488 |
+- (field->application == HID_GD_KEYBOARD)) |
1489 |
+- return 0; |
1490 |
+- |
1491 |
+ return -1; |
1492 |
+ } |
1493 |
+ |
1494 |
+@@ -715,10 +708,6 @@ static void wtp_populate_input(struct hidpp_device *hidpp, |
1495 |
+ { |
1496 |
+ struct wtp_data *wd = hidpp->private_data; |
1497 |
+ |
1498 |
+- if ((hidpp->quirks & HIDPP_QUIRK_MULTI_INPUT) && origin_is_hid_core) |
1499 |
+- /* this is the generic hid-input call */ |
1500 |
+- return; |
1501 |
+- |
1502 |
+ __set_bit(EV_ABS, input_dev->evbit); |
1503 |
+ __set_bit(EV_KEY, input_dev->evbit); |
1504 |
+ __clear_bit(EV_REL, input_dev->evbit); |
1505 |
+@@ -1234,10 +1223,6 @@ static int hidpp_probe(struct hid_device *hdev, const struct hid_device_id *id) |
1506 |
+ if (hidpp->quirks & HIDPP_QUIRK_DELAYED_INIT) |
1507 |
+ connect_mask &= ~HID_CONNECT_HIDINPUT; |
1508 |
+ |
1509 |
+- /* Re-enable hidinput for multi-input devices */ |
1510 |
+- if (hidpp->quirks & HIDPP_QUIRK_MULTI_INPUT) |
1511 |
+- connect_mask |= HID_CONNECT_HIDINPUT; |
1512 |
+- |
1513 |
+ ret = hid_hw_start(hdev, connect_mask); |
1514 |
+ if (ret) { |
1515 |
+ hid_err(hdev, "%s:hid_hw_start returned error\n", __func__); |
1516 |
+@@ -1285,11 +1270,6 @@ static const struct hid_device_id hidpp_devices[] = { |
1517 |
+ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, |
1518 |
+ USB_DEVICE_ID_LOGITECH_T651), |
1519 |
+ .driver_data = HIDPP_QUIRK_CLASS_WTP }, |
1520 |
+- { /* Keyboard TK820 */ |
1521 |
+- HID_DEVICE(BUS_USB, HID_GROUP_LOGITECH_DJ_DEVICE, |
1522 |
+- USB_VENDOR_ID_LOGITECH, 0x4102), |
1523 |
+- .driver_data = HIDPP_QUIRK_DELAYED_INIT | HIDPP_QUIRK_MULTI_INPUT | |
1524 |
+- HIDPP_QUIRK_CLASS_WTP }, |
1525 |
+ |
1526 |
+ { HID_DEVICE(BUS_USB, HID_GROUP_LOGITECH_DJ_DEVICE, |
1527 |
+ USB_VENDOR_ID_LOGITECH, HID_ANY_ID)}, |
1528 |
+diff --git a/drivers/hwmon/nct6683.c b/drivers/hwmon/nct6683.c |
1529 |
+index f3830db02d46..37f01702d081 100644 |
1530 |
+--- a/drivers/hwmon/nct6683.c |
1531 |
++++ b/drivers/hwmon/nct6683.c |
1532 |
+@@ -439,6 +439,7 @@ nct6683_create_attr_group(struct device *dev, struct sensor_template_group *tg, |
1533 |
+ (*t)->dev_attr.attr.name, tg->base + i); |
1534 |
+ if ((*t)->s2) { |
1535 |
+ a2 = &su->u.a2; |
1536 |
++ sysfs_attr_init(&a2->dev_attr.attr); |
1537 |
+ a2->dev_attr.attr.name = su->name; |
1538 |
+ a2->nr = (*t)->u.s.nr + i; |
1539 |
+ a2->index = (*t)->u.s.index; |
1540 |
+@@ -449,6 +450,7 @@ nct6683_create_attr_group(struct device *dev, struct sensor_template_group *tg, |
1541 |
+ *attrs = &a2->dev_attr.attr; |
1542 |
+ } else { |
1543 |
+ a = &su->u.a1; |
1544 |
++ sysfs_attr_init(&a->dev_attr.attr); |
1545 |
+ a->dev_attr.attr.name = su->name; |
1546 |
+ a->index = (*t)->u.index + i; |
1547 |
+ a->dev_attr.attr.mode = |
1548 |
+diff --git a/drivers/hwmon/nct6775.c b/drivers/hwmon/nct6775.c |
1549 |
+index 1be41177b620..0773930c110e 100644 |
1550 |
+--- a/drivers/hwmon/nct6775.c |
1551 |
++++ b/drivers/hwmon/nct6775.c |
1552 |
+@@ -994,6 +994,7 @@ nct6775_create_attr_group(struct device *dev, struct sensor_template_group *tg, |
1553 |
+ (*t)->dev_attr.attr.name, tg->base + i); |
1554 |
+ if ((*t)->s2) { |
1555 |
+ a2 = &su->u.a2; |
1556 |
++ sysfs_attr_init(&a2->dev_attr.attr); |
1557 |
+ a2->dev_attr.attr.name = su->name; |
1558 |
+ a2->nr = (*t)->u.s.nr + i; |
1559 |
+ a2->index = (*t)->u.s.index; |
1560 |
+@@ -1004,6 +1005,7 @@ nct6775_create_attr_group(struct device *dev, struct sensor_template_group *tg, |
1561 |
+ *attrs = &a2->dev_attr.attr; |
1562 |
+ } else { |
1563 |
+ a = &su->u.a1; |
1564 |
++ sysfs_attr_init(&a->dev_attr.attr); |
1565 |
+ a->dev_attr.attr.name = su->name; |
1566 |
+ a->index = (*t)->u.index + i; |
1567 |
+ a->dev_attr.attr.mode = |
1568 |
+diff --git a/drivers/hwmon/ntc_thermistor.c b/drivers/hwmon/ntc_thermistor.c |
1569 |
+index 112e4d45e4a0..68800115876b 100644 |
1570 |
+--- a/drivers/hwmon/ntc_thermistor.c |
1571 |
++++ b/drivers/hwmon/ntc_thermistor.c |
1572 |
+@@ -239,8 +239,10 @@ static struct ntc_thermistor_platform_data * |
1573 |
+ ntc_thermistor_parse_dt(struct platform_device *pdev) |
1574 |
+ { |
1575 |
+ struct iio_channel *chan; |
1576 |
++ enum iio_chan_type type; |
1577 |
+ struct device_node *np = pdev->dev.of_node; |
1578 |
+ struct ntc_thermistor_platform_data *pdata; |
1579 |
++ int ret; |
1580 |
+ |
1581 |
+ if (!np) |
1582 |
+ return NULL; |
1583 |
+@@ -253,6 +255,13 @@ ntc_thermistor_parse_dt(struct platform_device *pdev) |
1584 |
+ if (IS_ERR(chan)) |
1585 |
+ return ERR_CAST(chan); |
1586 |
+ |
1587 |
++ ret = iio_get_channel_type(chan, &type); |
1588 |
++ if (ret < 0) |
1589 |
++ return ERR_PTR(ret); |
1590 |
++ |
1591 |
++ if (type != IIO_VOLTAGE) |
1592 |
++ return ERR_PTR(-EINVAL); |
1593 |
++ |
1594 |
+ if (of_property_read_u32(np, "pullup-uv", &pdata->pullup_uv)) |
1595 |
+ return ERR_PTR(-ENODEV); |
1596 |
+ if (of_property_read_u32(np, "pullup-ohm", &pdata->pullup_ohm)) |
1597 |
+diff --git a/drivers/hwmon/tmp401.c b/drivers/hwmon/tmp401.c |
1598 |
+index 99664ebc738d..ccf4cffe0ee1 100644 |
1599 |
+--- a/drivers/hwmon/tmp401.c |
1600 |
++++ b/drivers/hwmon/tmp401.c |
1601 |
+@@ -44,7 +44,7 @@ |
1602 |
+ #include <linux/sysfs.h> |
1603 |
+ |
1604 |
+ /* Addresses to scan */ |
1605 |
+-static const unsigned short normal_i2c[] = { 0x37, 0x48, 0x49, 0x4a, 0x4c, 0x4d, |
1606 |
++static const unsigned short normal_i2c[] = { 0x48, 0x49, 0x4a, 0x4c, 0x4d, |
1607 |
+ 0x4e, 0x4f, I2C_CLIENT_END }; |
1608 |
+ |
1609 |
+ enum chips { tmp401, tmp411, tmp431, tmp432, tmp435 }; |
1610 |
+diff --git a/drivers/iio/accel/st_accel_core.c b/drivers/iio/accel/st_accel_core.c |
1611 |
+index 53f32629283a..6805db0e4f07 100644 |
1612 |
+--- a/drivers/iio/accel/st_accel_core.c |
1613 |
++++ b/drivers/iio/accel/st_accel_core.c |
1614 |
+@@ -465,6 +465,7 @@ int st_accel_common_probe(struct iio_dev *indio_dev) |
1615 |
+ |
1616 |
+ indio_dev->modes = INDIO_DIRECT_MODE; |
1617 |
+ indio_dev->info = &accel_info; |
1618 |
++ mutex_init(&adata->tb.buf_lock); |
1619 |
+ |
1620 |
+ st_sensors_power_enable(indio_dev); |
1621 |
+ |
1622 |
+diff --git a/drivers/iio/adc/axp288_adc.c b/drivers/iio/adc/axp288_adc.c |
1623 |
+index 08bcfb061ca5..56008a86b78f 100644 |
1624 |
+--- a/drivers/iio/adc/axp288_adc.c |
1625 |
++++ b/drivers/iio/adc/axp288_adc.c |
1626 |
+@@ -53,39 +53,42 @@ static const struct iio_chan_spec const axp288_adc_channels[] = { |
1627 |
+ .channel = 0, |
1628 |
+ .address = AXP288_TS_ADC_H, |
1629 |
+ .datasheet_name = "TS_PIN", |
1630 |
++ .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), |
1631 |
+ }, { |
1632 |
+ .indexed = 1, |
1633 |
+ .type = IIO_TEMP, |
1634 |
+ .channel = 1, |
1635 |
+ .address = AXP288_PMIC_ADC_H, |
1636 |
+ .datasheet_name = "PMIC_TEMP", |
1637 |
++ .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), |
1638 |
+ }, { |
1639 |
+ .indexed = 1, |
1640 |
+ .type = IIO_TEMP, |
1641 |
+ .channel = 2, |
1642 |
+ .address = AXP288_GP_ADC_H, |
1643 |
+ .datasheet_name = "GPADC", |
1644 |
++ .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), |
1645 |
+ }, { |
1646 |
+ .indexed = 1, |
1647 |
+ .type = IIO_CURRENT, |
1648 |
+ .channel = 3, |
1649 |
+ .address = AXP20X_BATT_CHRG_I_H, |
1650 |
+ .datasheet_name = "BATT_CHG_I", |
1651 |
+- .info_mask_separate = BIT(IIO_CHAN_INFO_PROCESSED), |
1652 |
++ .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), |
1653 |
+ }, { |
1654 |
+ .indexed = 1, |
1655 |
+ .type = IIO_CURRENT, |
1656 |
+ .channel = 4, |
1657 |
+ .address = AXP20X_BATT_DISCHRG_I_H, |
1658 |
+ .datasheet_name = "BATT_DISCHRG_I", |
1659 |
+- .info_mask_separate = BIT(IIO_CHAN_INFO_PROCESSED), |
1660 |
++ .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), |
1661 |
+ }, { |
1662 |
+ .indexed = 1, |
1663 |
+ .type = IIO_VOLTAGE, |
1664 |
+ .channel = 5, |
1665 |
+ .address = AXP20X_BATT_V_H, |
1666 |
+ .datasheet_name = "BATT_V", |
1667 |
+- .info_mask_separate = BIT(IIO_CHAN_INFO_PROCESSED), |
1668 |
++ .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), |
1669 |
+ }, |
1670 |
+ }; |
1671 |
+ |
1672 |
+@@ -151,9 +154,6 @@ static int axp288_adc_read_raw(struct iio_dev *indio_dev, |
1673 |
+ chan->address)) |
1674 |
+ dev_err(&indio_dev->dev, "TS pin restore\n"); |
1675 |
+ break; |
1676 |
+- case IIO_CHAN_INFO_PROCESSED: |
1677 |
+- ret = axp288_adc_read_channel(val, chan->address, info->regmap); |
1678 |
+- break; |
1679 |
+ default: |
1680 |
+ ret = -EINVAL; |
1681 |
+ } |
1682 |
+diff --git a/drivers/iio/adc/cc10001_adc.c b/drivers/iio/adc/cc10001_adc.c |
1683 |
+index 51e2a83c9404..115f6e99a7fa 100644 |
1684 |
+--- a/drivers/iio/adc/cc10001_adc.c |
1685 |
++++ b/drivers/iio/adc/cc10001_adc.c |
1686 |
+@@ -35,8 +35,9 @@ |
1687 |
+ #define CC10001_ADC_EOC_SET BIT(0) |
1688 |
+ |
1689 |
+ #define CC10001_ADC_CHSEL_SAMPLED 0x0c |
1690 |
+-#define CC10001_ADC_POWER_UP 0x10 |
1691 |
+-#define CC10001_ADC_POWER_UP_SET BIT(0) |
1692 |
++#define CC10001_ADC_POWER_DOWN 0x10 |
1693 |
++#define CC10001_ADC_POWER_DOWN_SET BIT(0) |
1694 |
++ |
1695 |
+ #define CC10001_ADC_DEBUG 0x14 |
1696 |
+ #define CC10001_ADC_DATA_COUNT 0x20 |
1697 |
+ |
1698 |
+@@ -62,7 +63,6 @@ struct cc10001_adc_device { |
1699 |
+ u16 *buf; |
1700 |
+ |
1701 |
+ struct mutex lock; |
1702 |
+- unsigned long channel_map; |
1703 |
+ unsigned int start_delay_ns; |
1704 |
+ unsigned int eoc_delay_ns; |
1705 |
+ }; |
1706 |
+@@ -79,6 +79,18 @@ static inline u32 cc10001_adc_read_reg(struct cc10001_adc_device *adc_dev, |
1707 |
+ return readl(adc_dev->reg_base + reg); |
1708 |
+ } |
1709 |
+ |
1710 |
++static void cc10001_adc_power_up(struct cc10001_adc_device *adc_dev) |
1711 |
++{ |
1712 |
++ cc10001_adc_write_reg(adc_dev, CC10001_ADC_POWER_DOWN, 0); |
1713 |
++ ndelay(adc_dev->start_delay_ns); |
1714 |
++} |
1715 |
++ |
1716 |
++static void cc10001_adc_power_down(struct cc10001_adc_device *adc_dev) |
1717 |
++{ |
1718 |
++ cc10001_adc_write_reg(adc_dev, CC10001_ADC_POWER_DOWN, |
1719 |
++ CC10001_ADC_POWER_DOWN_SET); |
1720 |
++} |
1721 |
++ |
1722 |
+ static void cc10001_adc_start(struct cc10001_adc_device *adc_dev, |
1723 |
+ unsigned int channel) |
1724 |
+ { |
1725 |
+@@ -88,6 +100,7 @@ static void cc10001_adc_start(struct cc10001_adc_device *adc_dev, |
1726 |
+ val = (channel & CC10001_ADC_CH_MASK) | CC10001_ADC_MODE_SINGLE_CONV; |
1727 |
+ cc10001_adc_write_reg(adc_dev, CC10001_ADC_CONFIG, val); |
1728 |
+ |
1729 |
++ udelay(1); |
1730 |
+ val = cc10001_adc_read_reg(adc_dev, CC10001_ADC_CONFIG); |
1731 |
+ val = val | CC10001_ADC_START_CONV; |
1732 |
+ cc10001_adc_write_reg(adc_dev, CC10001_ADC_CONFIG, val); |
1733 |
+@@ -129,6 +142,7 @@ static irqreturn_t cc10001_adc_trigger_h(int irq, void *p) |
1734 |
+ struct iio_dev *indio_dev; |
1735 |
+ unsigned int delay_ns; |
1736 |
+ unsigned int channel; |
1737 |
++ unsigned int scan_idx; |
1738 |
+ bool sample_invalid; |
1739 |
+ u16 *data; |
1740 |
+ int i; |
1741 |
+@@ -139,20 +153,17 @@ static irqreturn_t cc10001_adc_trigger_h(int irq, void *p) |
1742 |
+ |
1743 |
+ mutex_lock(&adc_dev->lock); |
1744 |
+ |
1745 |
+- cc10001_adc_write_reg(adc_dev, CC10001_ADC_POWER_UP, |
1746 |
+- CC10001_ADC_POWER_UP_SET); |
1747 |
+- |
1748 |
+- /* Wait for 8 (6+2) clock cycles before activating START */ |
1749 |
+- ndelay(adc_dev->start_delay_ns); |
1750 |
++ cc10001_adc_power_up(adc_dev); |
1751 |
+ |
1752 |
+ /* Calculate delay step for eoc and sampled data */ |
1753 |
+ delay_ns = adc_dev->eoc_delay_ns / CC10001_MAX_POLL_COUNT; |
1754 |
+ |
1755 |
+ i = 0; |
1756 |
+ sample_invalid = false; |
1757 |
+- for_each_set_bit(channel, indio_dev->active_scan_mask, |
1758 |
++ for_each_set_bit(scan_idx, indio_dev->active_scan_mask, |
1759 |
+ indio_dev->masklength) { |
1760 |
+ |
1761 |
++ channel = indio_dev->channels[scan_idx].channel; |
1762 |
+ cc10001_adc_start(adc_dev, channel); |
1763 |
+ |
1764 |
+ data[i] = cc10001_adc_poll_done(indio_dev, channel, delay_ns); |
1765 |
+@@ -166,7 +177,7 @@ static irqreturn_t cc10001_adc_trigger_h(int irq, void *p) |
1766 |
+ } |
1767 |
+ |
1768 |
+ done: |
1769 |
+- cc10001_adc_write_reg(adc_dev, CC10001_ADC_POWER_UP, 0); |
1770 |
++ cc10001_adc_power_down(adc_dev); |
1771 |
+ |
1772 |
+ mutex_unlock(&adc_dev->lock); |
1773 |
+ |
1774 |
+@@ -185,11 +196,7 @@ static u16 cc10001_adc_read_raw_voltage(struct iio_dev *indio_dev, |
1775 |
+ unsigned int delay_ns; |
1776 |
+ u16 val; |
1777 |
+ |
1778 |
+- cc10001_adc_write_reg(adc_dev, CC10001_ADC_POWER_UP, |
1779 |
+- CC10001_ADC_POWER_UP_SET); |
1780 |
+- |
1781 |
+- /* Wait for 8 (6+2) clock cycles before activating START */ |
1782 |
+- ndelay(adc_dev->start_delay_ns); |
1783 |
++ cc10001_adc_power_up(adc_dev); |
1784 |
+ |
1785 |
+ /* Calculate delay step for eoc and sampled data */ |
1786 |
+ delay_ns = adc_dev->eoc_delay_ns / CC10001_MAX_POLL_COUNT; |
1787 |
+@@ -198,7 +205,7 @@ static u16 cc10001_adc_read_raw_voltage(struct iio_dev *indio_dev, |
1788 |
+ |
1789 |
+ val = cc10001_adc_poll_done(indio_dev, chan->channel, delay_ns); |
1790 |
+ |
1791 |
+- cc10001_adc_write_reg(adc_dev, CC10001_ADC_POWER_UP, 0); |
1792 |
++ cc10001_adc_power_down(adc_dev); |
1793 |
+ |
1794 |
+ return val; |
1795 |
+ } |
1796 |
+@@ -224,7 +231,7 @@ static int cc10001_adc_read_raw(struct iio_dev *indio_dev, |
1797 |
+ |
1798 |
+ case IIO_CHAN_INFO_SCALE: |
1799 |
+ ret = regulator_get_voltage(adc_dev->reg); |
1800 |
+- if (ret) |
1801 |
++ if (ret < 0) |
1802 |
+ return ret; |
1803 |
+ |
1804 |
+ *val = ret / 1000; |
1805 |
+@@ -255,22 +262,22 @@ static const struct iio_info cc10001_adc_info = { |
1806 |
+ .update_scan_mode = &cc10001_update_scan_mode, |
1807 |
+ }; |
1808 |
+ |
1809 |
+-static int cc10001_adc_channel_init(struct iio_dev *indio_dev) |
1810 |
++static int cc10001_adc_channel_init(struct iio_dev *indio_dev, |
1811 |
++ unsigned long channel_map) |
1812 |
+ { |
1813 |
+- struct cc10001_adc_device *adc_dev = iio_priv(indio_dev); |
1814 |
+ struct iio_chan_spec *chan_array, *timestamp; |
1815 |
+ unsigned int bit, idx = 0; |
1816 |
+ |
1817 |
+- indio_dev->num_channels = bitmap_weight(&adc_dev->channel_map, |
1818 |
+- CC10001_ADC_NUM_CHANNELS); |
1819 |
++ indio_dev->num_channels = bitmap_weight(&channel_map, |
1820 |
++ CC10001_ADC_NUM_CHANNELS) + 1; |
1821 |
+ |
1822 |
+- chan_array = devm_kcalloc(&indio_dev->dev, indio_dev->num_channels + 1, |
1823 |
++ chan_array = devm_kcalloc(&indio_dev->dev, indio_dev->num_channels, |
1824 |
+ sizeof(struct iio_chan_spec), |
1825 |
+ GFP_KERNEL); |
1826 |
+ if (!chan_array) |
1827 |
+ return -ENOMEM; |
1828 |
+ |
1829 |
+- for_each_set_bit(bit, &adc_dev->channel_map, CC10001_ADC_NUM_CHANNELS) { |
1830 |
++ for_each_set_bit(bit, &channel_map, CC10001_ADC_NUM_CHANNELS) { |
1831 |
+ struct iio_chan_spec *chan = &chan_array[idx]; |
1832 |
+ |
1833 |
+ chan->type = IIO_VOLTAGE; |
1834 |
+@@ -305,6 +312,7 @@ static int cc10001_adc_probe(struct platform_device *pdev) |
1835 |
+ unsigned long adc_clk_rate; |
1836 |
+ struct resource *res; |
1837 |
+ struct iio_dev *indio_dev; |
1838 |
++ unsigned long channel_map; |
1839 |
+ int ret; |
1840 |
+ |
1841 |
+ indio_dev = devm_iio_device_alloc(&pdev->dev, sizeof(*adc_dev)); |
1842 |
+@@ -313,9 +321,9 @@ static int cc10001_adc_probe(struct platform_device *pdev) |
1843 |
+ |
1844 |
+ adc_dev = iio_priv(indio_dev); |
1845 |
+ |
1846 |
+- adc_dev->channel_map = GENMASK(CC10001_ADC_NUM_CHANNELS - 1, 0); |
1847 |
++ channel_map = GENMASK(CC10001_ADC_NUM_CHANNELS - 1, 0); |
1848 |
+ if (!of_property_read_u32(node, "adc-reserved-channels", &ret)) |
1849 |
+- adc_dev->channel_map &= ~ret; |
1850 |
++ channel_map &= ~ret; |
1851 |
+ |
1852 |
+ adc_dev->reg = devm_regulator_get(&pdev->dev, "vref"); |
1853 |
+ if (IS_ERR(adc_dev->reg)) |
1854 |
+@@ -361,7 +369,7 @@ static int cc10001_adc_probe(struct platform_device *pdev) |
1855 |
+ adc_dev->start_delay_ns = adc_dev->eoc_delay_ns * CC10001_WAIT_CYCLES; |
1856 |
+ |
1857 |
+ /* Setup the ADC channels available on the device */ |
1858 |
+- ret = cc10001_adc_channel_init(indio_dev); |
1859 |
++ ret = cc10001_adc_channel_init(indio_dev, channel_map); |
1860 |
+ if (ret < 0) |
1861 |
+ goto err_disable_clk; |
1862 |
+ |
1863 |
+diff --git a/drivers/iio/adc/qcom-spmi-vadc.c b/drivers/iio/adc/qcom-spmi-vadc.c |
1864 |
+index 3211729bcb0b..0c4618b4d515 100644 |
1865 |
+--- a/drivers/iio/adc/qcom-spmi-vadc.c |
1866 |
++++ b/drivers/iio/adc/qcom-spmi-vadc.c |
1867 |
+@@ -18,6 +18,7 @@ |
1868 |
+ #include <linux/iio/iio.h> |
1869 |
+ #include <linux/interrupt.h> |
1870 |
+ #include <linux/kernel.h> |
1871 |
++#include <linux/math64.h> |
1872 |
+ #include <linux/module.h> |
1873 |
+ #include <linux/of.h> |
1874 |
+ #include <linux/platform_device.h> |
1875 |
+@@ -471,11 +472,11 @@ static s32 vadc_calibrate(struct vadc_priv *vadc, |
1876 |
+ const struct vadc_channel_prop *prop, u16 adc_code) |
1877 |
+ { |
1878 |
+ const struct vadc_prescale_ratio *prescale; |
1879 |
+- s32 voltage; |
1880 |
++ s64 voltage; |
1881 |
+ |
1882 |
+ voltage = adc_code - vadc->graph[prop->calibration].gnd; |
1883 |
+ voltage *= vadc->graph[prop->calibration].dx; |
1884 |
+- voltage = voltage / vadc->graph[prop->calibration].dy; |
1885 |
++ voltage = div64_s64(voltage, vadc->graph[prop->calibration].dy); |
1886 |
+ |
1887 |
+ if (prop->calibration == VADC_CALIB_ABSOLUTE) |
1888 |
+ voltage += vadc->graph[prop->calibration].dx; |
1889 |
+@@ -487,7 +488,7 @@ static s32 vadc_calibrate(struct vadc_priv *vadc, |
1890 |
+ |
1891 |
+ voltage = voltage * prescale->den; |
1892 |
+ |
1893 |
+- return voltage / prescale->num; |
1894 |
++ return div64_s64(voltage, prescale->num); |
1895 |
+ } |
1896 |
+ |
1897 |
+ static int vadc_decimation_from_dt(u32 value) |
1898 |
+diff --git a/drivers/iio/adc/xilinx-xadc-core.c b/drivers/iio/adc/xilinx-xadc-core.c |
1899 |
+index a221f7329b79..ce93bd8e3f68 100644 |
1900 |
+--- a/drivers/iio/adc/xilinx-xadc-core.c |
1901 |
++++ b/drivers/iio/adc/xilinx-xadc-core.c |
1902 |
+@@ -856,6 +856,7 @@ static int xadc_read_raw(struct iio_dev *indio_dev, |
1903 |
+ switch (chan->address) { |
1904 |
+ case XADC_REG_VCCINT: |
1905 |
+ case XADC_REG_VCCAUX: |
1906 |
++ case XADC_REG_VREFP: |
1907 |
+ case XADC_REG_VCCBRAM: |
1908 |
+ case XADC_REG_VCCPINT: |
1909 |
+ case XADC_REG_VCCPAUX: |
1910 |
+@@ -996,7 +997,7 @@ static const struct iio_event_spec xadc_voltage_events[] = { |
1911 |
+ .num_event_specs = (_alarm) ? ARRAY_SIZE(xadc_voltage_events) : 0, \ |
1912 |
+ .scan_index = (_scan_index), \ |
1913 |
+ .scan_type = { \ |
1914 |
+- .sign = 'u', \ |
1915 |
++ .sign = ((_addr) == XADC_REG_VREFN) ? 's' : 'u', \ |
1916 |
+ .realbits = 12, \ |
1917 |
+ .storagebits = 16, \ |
1918 |
+ .shift = 4, \ |
1919 |
+@@ -1008,7 +1009,7 @@ static const struct iio_event_spec xadc_voltage_events[] = { |
1920 |
+ static const struct iio_chan_spec xadc_channels[] = { |
1921 |
+ XADC_CHAN_TEMP(0, 8, XADC_REG_TEMP), |
1922 |
+ XADC_CHAN_VOLTAGE(0, 9, XADC_REG_VCCINT, "vccint", true), |
1923 |
+- XADC_CHAN_VOLTAGE(1, 10, XADC_REG_VCCINT, "vccaux", true), |
1924 |
++ XADC_CHAN_VOLTAGE(1, 10, XADC_REG_VCCAUX, "vccaux", true), |
1925 |
+ XADC_CHAN_VOLTAGE(2, 14, XADC_REG_VCCBRAM, "vccbram", true), |
1926 |
+ XADC_CHAN_VOLTAGE(3, 5, XADC_REG_VCCPINT, "vccpint", true), |
1927 |
+ XADC_CHAN_VOLTAGE(4, 6, XADC_REG_VCCPAUX, "vccpaux", true), |
1928 |
+diff --git a/drivers/iio/adc/xilinx-xadc.h b/drivers/iio/adc/xilinx-xadc.h |
1929 |
+index c7487e8d7f80..54adc5087210 100644 |
1930 |
+--- a/drivers/iio/adc/xilinx-xadc.h |
1931 |
++++ b/drivers/iio/adc/xilinx-xadc.h |
1932 |
+@@ -145,9 +145,9 @@ static inline int xadc_write_adc_reg(struct xadc *xadc, unsigned int reg, |
1933 |
+ #define XADC_REG_MAX_VCCPINT 0x28 |
1934 |
+ #define XADC_REG_MAX_VCCPAUX 0x29 |
1935 |
+ #define XADC_REG_MAX_VCCO_DDR 0x2a |
1936 |
+-#define XADC_REG_MIN_VCCPINT 0x2b |
1937 |
+-#define XADC_REG_MIN_VCCPAUX 0x2c |
1938 |
+-#define XADC_REG_MIN_VCCO_DDR 0x2d |
1939 |
++#define XADC_REG_MIN_VCCPINT 0x2c |
1940 |
++#define XADC_REG_MIN_VCCPAUX 0x2d |
1941 |
++#define XADC_REG_MIN_VCCO_DDR 0x2e |
1942 |
+ |
1943 |
+ #define XADC_REG_CONF0 0x40 |
1944 |
+ #define XADC_REG_CONF1 0x41 |
1945 |
+diff --git a/drivers/iio/common/st_sensors/st_sensors_core.c b/drivers/iio/common/st_sensors/st_sensors_core.c |
1946 |
+index edd13d2b4121..8dd0477e201c 100644 |
1947 |
+--- a/drivers/iio/common/st_sensors/st_sensors_core.c |
1948 |
++++ b/drivers/iio/common/st_sensors/st_sensors_core.c |
1949 |
+@@ -304,8 +304,6 @@ int st_sensors_init_sensor(struct iio_dev *indio_dev, |
1950 |
+ struct st_sensors_platform_data *of_pdata; |
1951 |
+ int err = 0; |
1952 |
+ |
1953 |
+- mutex_init(&sdata->tb.buf_lock); |
1954 |
+- |
1955 |
+ /* If OF/DT pdata exists, it will take precedence of anything else */ |
1956 |
+ of_pdata = st_sensors_of_probe(indio_dev->dev.parent, pdata); |
1957 |
+ if (of_pdata) |
1958 |
+diff --git a/drivers/iio/gyro/st_gyro_core.c b/drivers/iio/gyro/st_gyro_core.c |
1959 |
+index f07a2336f7dc..566f7d2df031 100644 |
1960 |
+--- a/drivers/iio/gyro/st_gyro_core.c |
1961 |
++++ b/drivers/iio/gyro/st_gyro_core.c |
1962 |
+@@ -317,6 +317,7 @@ int st_gyro_common_probe(struct iio_dev *indio_dev) |
1963 |
+ |
1964 |
+ indio_dev->modes = INDIO_DIRECT_MODE; |
1965 |
+ indio_dev->info = &gyro_info; |
1966 |
++ mutex_init(&gdata->tb.buf_lock); |
1967 |
+ |
1968 |
+ st_sensors_power_enable(indio_dev); |
1969 |
+ |
1970 |
+diff --git a/drivers/iio/light/hid-sensor-prox.c b/drivers/iio/light/hid-sensor-prox.c |
1971 |
+index 3ecf79ed08ac..88f21bbe947c 100644 |
1972 |
+--- a/drivers/iio/light/hid-sensor-prox.c |
1973 |
++++ b/drivers/iio/light/hid-sensor-prox.c |
1974 |
+@@ -43,8 +43,6 @@ struct prox_state { |
1975 |
+ static const struct iio_chan_spec prox_channels[] = { |
1976 |
+ { |
1977 |
+ .type = IIO_PROXIMITY, |
1978 |
+- .modified = 1, |
1979 |
+- .channel2 = IIO_NO_MOD, |
1980 |
+ .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), |
1981 |
+ .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_OFFSET) | |
1982 |
+ BIT(IIO_CHAN_INFO_SCALE) | |
1983 |
+diff --git a/drivers/iio/magnetometer/st_magn_core.c b/drivers/iio/magnetometer/st_magn_core.c |
1984 |
+index 8ade473f99fe..2e56f812a644 100644 |
1985 |
+--- a/drivers/iio/magnetometer/st_magn_core.c |
1986 |
++++ b/drivers/iio/magnetometer/st_magn_core.c |
1987 |
+@@ -369,6 +369,7 @@ int st_magn_common_probe(struct iio_dev *indio_dev) |
1988 |
+ |
1989 |
+ indio_dev->modes = INDIO_DIRECT_MODE; |
1990 |
+ indio_dev->info = &magn_info; |
1991 |
++ mutex_init(&mdata->tb.buf_lock); |
1992 |
+ |
1993 |
+ st_sensors_power_enable(indio_dev); |
1994 |
+ |
1995 |
+diff --git a/drivers/iio/pressure/hid-sensor-press.c b/drivers/iio/pressure/hid-sensor-press.c |
1996 |
+index 1af314926ebd..476a7d03d2ce 100644 |
1997 |
+--- a/drivers/iio/pressure/hid-sensor-press.c |
1998 |
++++ b/drivers/iio/pressure/hid-sensor-press.c |
1999 |
+@@ -47,8 +47,6 @@ struct press_state { |
2000 |
+ static const struct iio_chan_spec press_channels[] = { |
2001 |
+ { |
2002 |
+ .type = IIO_PRESSURE, |
2003 |
+- .modified = 1, |
2004 |
+- .channel2 = IIO_NO_MOD, |
2005 |
+ .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), |
2006 |
+ .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_OFFSET) | |
2007 |
+ BIT(IIO_CHAN_INFO_SCALE) | |
2008 |
+diff --git a/drivers/iio/pressure/st_pressure_core.c b/drivers/iio/pressure/st_pressure_core.c |
2009 |
+index 97baf40d424b..e881fa6291e9 100644 |
2010 |
+--- a/drivers/iio/pressure/st_pressure_core.c |
2011 |
++++ b/drivers/iio/pressure/st_pressure_core.c |
2012 |
+@@ -417,6 +417,7 @@ int st_press_common_probe(struct iio_dev *indio_dev) |
2013 |
+ |
2014 |
+ indio_dev->modes = INDIO_DIRECT_MODE; |
2015 |
+ indio_dev->info = &press_info; |
2016 |
++ mutex_init(&press_data->tb.buf_lock); |
2017 |
+ |
2018 |
+ st_sensors_power_enable(indio_dev); |
2019 |
+ |
2020 |
+diff --git a/drivers/infiniband/core/iwpm_msg.c b/drivers/infiniband/core/iwpm_msg.c |
2021 |
+index b85ddbc979e0..e5558b2660f2 100644 |
2022 |
+--- a/drivers/infiniband/core/iwpm_msg.c |
2023 |
++++ b/drivers/infiniband/core/iwpm_msg.c |
2024 |
+@@ -33,7 +33,7 @@ |
2025 |
+ |
2026 |
+ #include "iwpm_util.h" |
2027 |
+ |
2028 |
+-static const char iwpm_ulib_name[] = "iWarpPortMapperUser"; |
2029 |
++static const char iwpm_ulib_name[IWPM_ULIBNAME_SIZE] = "iWarpPortMapperUser"; |
2030 |
+ static int iwpm_ulib_version = 3; |
2031 |
+ static int iwpm_user_pid = IWPM_PID_UNDEFINED; |
2032 |
+ static atomic_t echo_nlmsg_seq; |
2033 |
+diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c |
2034 |
+index 991dc6b20a58..79363b687195 100644 |
2035 |
+--- a/drivers/input/mouse/elantech.c |
2036 |
++++ b/drivers/input/mouse/elantech.c |
2037 |
+@@ -315,7 +315,7 @@ static void elantech_report_semi_mt_data(struct input_dev *dev, |
2038 |
+ unsigned int x2, unsigned int y2) |
2039 |
+ { |
2040 |
+ elantech_set_slot(dev, 0, num_fingers != 0, x1, y1); |
2041 |
+- elantech_set_slot(dev, 1, num_fingers == 2, x2, y2); |
2042 |
++ elantech_set_slot(dev, 1, num_fingers >= 2, x2, y2); |
2043 |
+ } |
2044 |
+ |
2045 |
+ /* |
2046 |
+diff --git a/drivers/iommu/amd_iommu_v2.c b/drivers/iommu/amd_iommu_v2.c |
2047 |
+index 6d5a5c44453b..173e70dbf61b 100644 |
2048 |
+--- a/drivers/iommu/amd_iommu_v2.c |
2049 |
++++ b/drivers/iommu/amd_iommu_v2.c |
2050 |
+@@ -266,6 +266,7 @@ static void put_pasid_state(struct pasid_state *pasid_state) |
2051 |
+ |
2052 |
+ static void put_pasid_state_wait(struct pasid_state *pasid_state) |
2053 |
+ { |
2054 |
++ atomic_dec(&pasid_state->count); |
2055 |
+ wait_event(pasid_state->wq, !atomic_read(&pasid_state->count)); |
2056 |
+ free_pasid_state(pasid_state); |
2057 |
+ } |
2058 |
+diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c |
2059 |
+index a3adde6519f0..bd6252b01510 100644 |
2060 |
+--- a/drivers/iommu/arm-smmu.c |
2061 |
++++ b/drivers/iommu/arm-smmu.c |
2062 |
+@@ -224,14 +224,7 @@ |
2063 |
+ #define RESUME_TERMINATE (1 << 0) |
2064 |
+ |
2065 |
+ #define TTBCR2_SEP_SHIFT 15 |
2066 |
+-#define TTBCR2_SEP_MASK 0x7 |
2067 |
+- |
2068 |
+-#define TTBCR2_ADDR_32 0 |
2069 |
+-#define TTBCR2_ADDR_36 1 |
2070 |
+-#define TTBCR2_ADDR_40 2 |
2071 |
+-#define TTBCR2_ADDR_42 3 |
2072 |
+-#define TTBCR2_ADDR_44 4 |
2073 |
+-#define TTBCR2_ADDR_48 5 |
2074 |
++#define TTBCR2_SEP_UPSTREAM (0x7 << TTBCR2_SEP_SHIFT) |
2075 |
+ |
2076 |
+ #define TTBRn_HI_ASID_SHIFT 16 |
2077 |
+ |
2078 |
+@@ -783,26 +776,7 @@ static void arm_smmu_init_context_bank(struct arm_smmu_domain *smmu_domain, |
2079 |
+ writel_relaxed(reg, cb_base + ARM_SMMU_CB_TTBCR); |
2080 |
+ if (smmu->version > ARM_SMMU_V1) { |
2081 |
+ reg = pgtbl_cfg->arm_lpae_s1_cfg.tcr >> 32; |
2082 |
+- switch (smmu->va_size) { |
2083 |
+- case 32: |
2084 |
+- reg |= (TTBCR2_ADDR_32 << TTBCR2_SEP_SHIFT); |
2085 |
+- break; |
2086 |
+- case 36: |
2087 |
+- reg |= (TTBCR2_ADDR_36 << TTBCR2_SEP_SHIFT); |
2088 |
+- break; |
2089 |
+- case 40: |
2090 |
+- reg |= (TTBCR2_ADDR_40 << TTBCR2_SEP_SHIFT); |
2091 |
+- break; |
2092 |
+- case 42: |
2093 |
+- reg |= (TTBCR2_ADDR_42 << TTBCR2_SEP_SHIFT); |
2094 |
+- break; |
2095 |
+- case 44: |
2096 |
+- reg |= (TTBCR2_ADDR_44 << TTBCR2_SEP_SHIFT); |
2097 |
+- break; |
2098 |
+- case 48: |
2099 |
+- reg |= (TTBCR2_ADDR_48 << TTBCR2_SEP_SHIFT); |
2100 |
+- break; |
2101 |
+- } |
2102 |
++ reg |= TTBCR2_SEP_UPSTREAM; |
2103 |
+ writel_relaxed(reg, cb_base + ARM_SMMU_CB_TTBCR2); |
2104 |
+ } |
2105 |
+ } else { |
2106 |
+diff --git a/drivers/lguest/core.c b/drivers/lguest/core.c |
2107 |
+index 7dc93aa004c8..312ffd3d0017 100644 |
2108 |
+--- a/drivers/lguest/core.c |
2109 |
++++ b/drivers/lguest/core.c |
2110 |
+@@ -173,7 +173,7 @@ static void unmap_switcher(void) |
2111 |
+ bool lguest_address_ok(const struct lguest *lg, |
2112 |
+ unsigned long addr, unsigned long len) |
2113 |
+ { |
2114 |
+- return (addr+len) / PAGE_SIZE < lg->pfn_limit && (addr+len >= addr); |
2115 |
++ return addr+len <= lg->pfn_limit * PAGE_SIZE && (addr+len >= addr); |
2116 |
+ } |
2117 |
+ |
2118 |
+ /* |
2119 |
+diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c |
2120 |
+index 6554d9148927..757f1ba34c4d 100644 |
2121 |
+--- a/drivers/md/dm-table.c |
2122 |
++++ b/drivers/md/dm-table.c |
2123 |
+@@ -823,6 +823,12 @@ void dm_consume_args(struct dm_arg_set *as, unsigned num_args) |
2124 |
+ } |
2125 |
+ EXPORT_SYMBOL(dm_consume_args); |
2126 |
+ |
2127 |
++static bool __table_type_request_based(unsigned table_type) |
2128 |
++{ |
2129 |
++ return (table_type == DM_TYPE_REQUEST_BASED || |
2130 |
++ table_type == DM_TYPE_MQ_REQUEST_BASED); |
2131 |
++} |
2132 |
++ |
2133 |
+ static int dm_table_set_type(struct dm_table *t) |
2134 |
+ { |
2135 |
+ unsigned i; |
2136 |
+@@ -855,8 +861,7 @@ static int dm_table_set_type(struct dm_table *t) |
2137 |
+ * Determine the type from the live device. |
2138 |
+ * Default to bio-based if device is new. |
2139 |
+ */ |
2140 |
+- if (live_md_type == DM_TYPE_REQUEST_BASED || |
2141 |
+- live_md_type == DM_TYPE_MQ_REQUEST_BASED) |
2142 |
++ if (__table_type_request_based(live_md_type)) |
2143 |
+ request_based = 1; |
2144 |
+ else |
2145 |
+ bio_based = 1; |
2146 |
+@@ -906,7 +911,7 @@ static int dm_table_set_type(struct dm_table *t) |
2147 |
+ } |
2148 |
+ t->type = DM_TYPE_MQ_REQUEST_BASED; |
2149 |
+ |
2150 |
+- } else if (hybrid && list_empty(devices) && live_md_type != DM_TYPE_NONE) { |
2151 |
++ } else if (list_empty(devices) && __table_type_request_based(live_md_type)) { |
2152 |
+ /* inherit live MD type */ |
2153 |
+ t->type = live_md_type; |
2154 |
+ |
2155 |
+@@ -928,10 +933,7 @@ struct target_type *dm_table_get_immutable_target_type(struct dm_table *t) |
2156 |
+ |
2157 |
+ bool dm_table_request_based(struct dm_table *t) |
2158 |
+ { |
2159 |
+- unsigned table_type = dm_table_get_type(t); |
2160 |
+- |
2161 |
+- return (table_type == DM_TYPE_REQUEST_BASED || |
2162 |
+- table_type == DM_TYPE_MQ_REQUEST_BASED); |
2163 |
++ return __table_type_request_based(dm_table_get_type(t)); |
2164 |
+ } |
2165 |
+ |
2166 |
+ bool dm_table_mq_request_based(struct dm_table *t) |
2167 |
+diff --git a/drivers/md/dm.c b/drivers/md/dm.c |
2168 |
+index 8001fe9e3434..9b4e30a82e4a 100644 |
2169 |
+--- a/drivers/md/dm.c |
2170 |
++++ b/drivers/md/dm.c |
2171 |
+@@ -1642,8 +1642,7 @@ static int dm_merge_bvec(struct request_queue *q, |
2172 |
+ struct mapped_device *md = q->queuedata; |
2173 |
+ struct dm_table *map = dm_get_live_table_fast(md); |
2174 |
+ struct dm_target *ti; |
2175 |
+- sector_t max_sectors; |
2176 |
+- int max_size = 0; |
2177 |
++ sector_t max_sectors, max_size = 0; |
2178 |
+ |
2179 |
+ if (unlikely(!map)) |
2180 |
+ goto out; |
2181 |
+@@ -1658,8 +1657,16 @@ static int dm_merge_bvec(struct request_queue *q, |
2182 |
+ max_sectors = min(max_io_len(bvm->bi_sector, ti), |
2183 |
+ (sector_t) queue_max_sectors(q)); |
2184 |
+ max_size = (max_sectors << SECTOR_SHIFT) - bvm->bi_size; |
2185 |
+- if (unlikely(max_size < 0)) /* this shouldn't _ever_ happen */ |
2186 |
+- max_size = 0; |
2187 |
++ |
2188 |
++ /* |
2189 |
++ * FIXME: this stop-gap fix _must_ be cleaned up (by passing a sector_t |
2190 |
++ * to the targets' merge function since it holds sectors not bytes). |
2191 |
++ * Just doing this as an interim fix for stable@ because the more |
2192 |
++ * comprehensive cleanup of switching to sector_t will impact every |
2193 |
++ * DM target that implements a ->merge hook. |
2194 |
++ */ |
2195 |
++ if (max_size > INT_MAX) |
2196 |
++ max_size = INT_MAX; |
2197 |
+ |
2198 |
+ /* |
2199 |
+ * merge_bvec_fn() returns number of bytes |
2200 |
+@@ -1667,7 +1674,7 @@ static int dm_merge_bvec(struct request_queue *q, |
2201 |
+ * max is precomputed maximal io size |
2202 |
+ */ |
2203 |
+ if (max_size && ti->type->merge) |
2204 |
+- max_size = ti->type->merge(ti, bvm, biovec, max_size); |
2205 |
++ max_size = ti->type->merge(ti, bvm, biovec, (int) max_size); |
2206 |
+ /* |
2207 |
+ * If the target doesn't support merge method and some of the devices |
2208 |
+ * provided their merge_bvec method (we know this by looking for the |
2209 |
+diff --git a/drivers/md/md.c b/drivers/md/md.c |
2210 |
+index e47d1dd046da..907534b7f40d 100644 |
2211 |
+--- a/drivers/md/md.c |
2212 |
++++ b/drivers/md/md.c |
2213 |
+@@ -4138,12 +4138,12 @@ action_store(struct mddev *mddev, const char *page, size_t len) |
2214 |
+ if (!mddev->pers || !mddev->pers->sync_request) |
2215 |
+ return -EINVAL; |
2216 |
+ |
2217 |
+- if (cmd_match(page, "frozen")) |
2218 |
+- set_bit(MD_RECOVERY_FROZEN, &mddev->recovery); |
2219 |
+- else |
2220 |
+- clear_bit(MD_RECOVERY_FROZEN, &mddev->recovery); |
2221 |
+ |
2222 |
+ if (cmd_match(page, "idle") || cmd_match(page, "frozen")) { |
2223 |
++ if (cmd_match(page, "frozen")) |
2224 |
++ set_bit(MD_RECOVERY_FROZEN, &mddev->recovery); |
2225 |
++ else |
2226 |
++ clear_bit(MD_RECOVERY_FROZEN, &mddev->recovery); |
2227 |
+ flush_workqueue(md_misc_wq); |
2228 |
+ if (mddev->sync_thread) { |
2229 |
+ set_bit(MD_RECOVERY_INTR, &mddev->recovery); |
2230 |
+@@ -4156,16 +4156,17 @@ action_store(struct mddev *mddev, const char *page, size_t len) |
2231 |
+ test_bit(MD_RECOVERY_NEEDED, &mddev->recovery)) |
2232 |
+ return -EBUSY; |
2233 |
+ else if (cmd_match(page, "resync")) |
2234 |
+- set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); |
2235 |
++ clear_bit(MD_RECOVERY_FROZEN, &mddev->recovery); |
2236 |
+ else if (cmd_match(page, "recover")) { |
2237 |
++ clear_bit(MD_RECOVERY_FROZEN, &mddev->recovery); |
2238 |
+ set_bit(MD_RECOVERY_RECOVER, &mddev->recovery); |
2239 |
+- set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); |
2240 |
+ } else if (cmd_match(page, "reshape")) { |
2241 |
+ int err; |
2242 |
+ if (mddev->pers->start_reshape == NULL) |
2243 |
+ return -EINVAL; |
2244 |
+ err = mddev_lock(mddev); |
2245 |
+ if (!err) { |
2246 |
++ clear_bit(MD_RECOVERY_FROZEN, &mddev->recovery); |
2247 |
+ err = mddev->pers->start_reshape(mddev); |
2248 |
+ mddev_unlock(mddev); |
2249 |
+ } |
2250 |
+@@ -4177,6 +4178,7 @@ action_store(struct mddev *mddev, const char *page, size_t len) |
2251 |
+ set_bit(MD_RECOVERY_CHECK, &mddev->recovery); |
2252 |
+ else if (!cmd_match(page, "repair")) |
2253 |
+ return -EINVAL; |
2254 |
++ clear_bit(MD_RECOVERY_FROZEN, &mddev->recovery); |
2255 |
+ set_bit(MD_RECOVERY_REQUESTED, &mddev->recovery); |
2256 |
+ set_bit(MD_RECOVERY_SYNC, &mddev->recovery); |
2257 |
+ } |
2258 |
+diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c |
2259 |
+index 3b5d7f704aa3..903391ce9353 100644 |
2260 |
+--- a/drivers/md/raid0.c |
2261 |
++++ b/drivers/md/raid0.c |
2262 |
+@@ -517,6 +517,9 @@ static void raid0_make_request(struct mddev *mddev, struct bio *bio) |
2263 |
+ ? (sector & (chunk_sects-1)) |
2264 |
+ : sector_div(sector, chunk_sects)); |
2265 |
+ |
2266 |
++ /* Restore due to sector_div */ |
2267 |
++ sector = bio->bi_iter.bi_sector; |
2268 |
++ |
2269 |
+ if (sectors < bio_sectors(bio)) { |
2270 |
+ split = bio_split(bio, sectors, GFP_NOIO, fs_bio_set); |
2271 |
+ bio_chain(split, bio); |
2272 |
+@@ -524,7 +527,6 @@ static void raid0_make_request(struct mddev *mddev, struct bio *bio) |
2273 |
+ split = bio; |
2274 |
+ } |
2275 |
+ |
2276 |
+- sector = bio->bi_iter.bi_sector; |
2277 |
+ zone = find_zone(mddev->private, §or); |
2278 |
+ tmp_dev = map_sector(mddev, zone, sector, §or); |
2279 |
+ split->bi_bdev = tmp_dev->bdev; |
2280 |
+diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c |
2281 |
+index cd2f96b2c572..007ab861eca0 100644 |
2282 |
+--- a/drivers/md/raid5.c |
2283 |
++++ b/drivers/md/raid5.c |
2284 |
+@@ -1933,7 +1933,8 @@ static int resize_stripes(struct r5conf *conf, int newsize) |
2285 |
+ |
2286 |
+ conf->slab_cache = sc; |
2287 |
+ conf->active_name = 1-conf->active_name; |
2288 |
+- conf->pool_size = newsize; |
2289 |
++ if (!err) |
2290 |
++ conf->pool_size = newsize; |
2291 |
+ return err; |
2292 |
+ } |
2293 |
+ |
2294 |
+diff --git a/drivers/mfd/da9052-core.c b/drivers/mfd/da9052-core.c |
2295 |
+index ae498b53ee40..46e3840c7a37 100644 |
2296 |
+--- a/drivers/mfd/da9052-core.c |
2297 |
++++ b/drivers/mfd/da9052-core.c |
2298 |
+@@ -433,6 +433,10 @@ EXPORT_SYMBOL_GPL(da9052_adc_read_temp); |
2299 |
+ static const struct mfd_cell da9052_subdev_info[] = { |
2300 |
+ { |
2301 |
+ .name = "da9052-regulator", |
2302 |
++ .id = 0, |
2303 |
++ }, |
2304 |
++ { |
2305 |
++ .name = "da9052-regulator", |
2306 |
+ .id = 1, |
2307 |
+ }, |
2308 |
+ { |
2309 |
+@@ -484,10 +488,6 @@ static const struct mfd_cell da9052_subdev_info[] = { |
2310 |
+ .id = 13, |
2311 |
+ }, |
2312 |
+ { |
2313 |
+- .name = "da9052-regulator", |
2314 |
+- .id = 14, |
2315 |
+- }, |
2316 |
+- { |
2317 |
+ .name = "da9052-onkey", |
2318 |
+ }, |
2319 |
+ { |
2320 |
+diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c |
2321 |
+index 03d7c7521d97..9a39e0b7e583 100644 |
2322 |
+--- a/drivers/mmc/host/atmel-mci.c |
2323 |
++++ b/drivers/mmc/host/atmel-mci.c |
2324 |
+@@ -1304,7 +1304,7 @@ static void atmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) |
2325 |
+ |
2326 |
+ if (ios->clock) { |
2327 |
+ unsigned int clock_min = ~0U; |
2328 |
+- u32 clkdiv; |
2329 |
++ int clkdiv; |
2330 |
+ |
2331 |
+ spin_lock_bh(&host->lock); |
2332 |
+ if (!host->mode_reg) { |
2333 |
+@@ -1328,7 +1328,12 @@ static void atmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) |
2334 |
+ /* Calculate clock divider */ |
2335 |
+ if (host->caps.has_odd_clk_div) { |
2336 |
+ clkdiv = DIV_ROUND_UP(host->bus_hz, clock_min) - 2; |
2337 |
+- if (clkdiv > 511) { |
2338 |
++ if (clkdiv < 0) { |
2339 |
++ dev_warn(&mmc->class_dev, |
2340 |
++ "clock %u too fast; using %lu\n", |
2341 |
++ clock_min, host->bus_hz / 2); |
2342 |
++ clkdiv = 0; |
2343 |
++ } else if (clkdiv > 511) { |
2344 |
+ dev_warn(&mmc->class_dev, |
2345 |
+ "clock %u too slow; using %lu\n", |
2346 |
+ clock_min, host->bus_hz / (511 + 2)); |
2347 |
+diff --git a/drivers/mtd/ubi/block.c b/drivers/mtd/ubi/block.c |
2348 |
+index db2c05b6fe7f..c9eb78f10a0d 100644 |
2349 |
+--- a/drivers/mtd/ubi/block.c |
2350 |
++++ b/drivers/mtd/ubi/block.c |
2351 |
+@@ -310,6 +310,8 @@ static void ubiblock_do_work(struct work_struct *work) |
2352 |
+ blk_rq_map_sg(req->q, req, pdu->usgl.sg); |
2353 |
+ |
2354 |
+ ret = ubiblock_read(pdu); |
2355 |
++ rq_flush_dcache_pages(req); |
2356 |
++ |
2357 |
+ blk_mq_end_request(req, ret); |
2358 |
+ } |
2359 |
+ |
2360 |
+diff --git a/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c b/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c |
2361 |
+index 6262612dec45..7a3231d8b933 100644 |
2362 |
+--- a/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c |
2363 |
++++ b/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c |
2364 |
+@@ -512,11 +512,9 @@ static int brcmf_msgbuf_query_dcmd(struct brcmf_pub *drvr, int ifidx, |
2365 |
+ msgbuf->rx_pktids, |
2366 |
+ msgbuf->ioctl_resp_pktid); |
2367 |
+ if (msgbuf->ioctl_resp_ret_len != 0) { |
2368 |
+- if (!skb) { |
2369 |
+- brcmf_err("Invalid packet id idx recv'd %d\n", |
2370 |
+- msgbuf->ioctl_resp_pktid); |
2371 |
++ if (!skb) |
2372 |
+ return -EBADF; |
2373 |
+- } |
2374 |
++ |
2375 |
+ memcpy(buf, skb->data, (len < msgbuf->ioctl_resp_ret_len) ? |
2376 |
+ len : msgbuf->ioctl_resp_ret_len); |
2377 |
+ } |
2378 |
+@@ -875,10 +873,8 @@ brcmf_msgbuf_process_txstatus(struct brcmf_msgbuf *msgbuf, void *buf) |
2379 |
+ flowid -= BRCMF_NROF_H2D_COMMON_MSGRINGS; |
2380 |
+ skb = brcmf_msgbuf_get_pktid(msgbuf->drvr->bus_if->dev, |
2381 |
+ msgbuf->tx_pktids, idx); |
2382 |
+- if (!skb) { |
2383 |
+- brcmf_err("Invalid packet id idx recv'd %d\n", idx); |
2384 |
++ if (!skb) |
2385 |
+ return; |
2386 |
+- } |
2387 |
+ |
2388 |
+ set_bit(flowid, msgbuf->txstatus_done_map); |
2389 |
+ commonring = msgbuf->flowrings[flowid]; |
2390 |
+@@ -1157,6 +1153,8 @@ brcmf_msgbuf_process_rx_complete(struct brcmf_msgbuf *msgbuf, void *buf) |
2391 |
+ |
2392 |
+ skb = brcmf_msgbuf_get_pktid(msgbuf->drvr->bus_if->dev, |
2393 |
+ msgbuf->rx_pktids, idx); |
2394 |
++ if (!skb) |
2395 |
++ return; |
2396 |
+ |
2397 |
+ if (data_offset) |
2398 |
+ skb_pull(skb, data_offset); |
2399 |
+diff --git a/drivers/net/wireless/iwlwifi/mvm/d3.c b/drivers/net/wireless/iwlwifi/mvm/d3.c |
2400 |
+index 14e8fd661889..fd5a0bb1493f 100644 |
2401 |
+--- a/drivers/net/wireless/iwlwifi/mvm/d3.c |
2402 |
++++ b/drivers/net/wireless/iwlwifi/mvm/d3.c |
2403 |
+@@ -1742,8 +1742,10 @@ static void iwl_mvm_query_netdetect_reasons(struct iwl_mvm *mvm, |
2404 |
+ int i, j, n_matches, ret; |
2405 |
+ |
2406 |
+ fw_status = iwl_mvm_get_wakeup_status(mvm, vif); |
2407 |
+- if (!IS_ERR_OR_NULL(fw_status)) |
2408 |
++ if (!IS_ERR_OR_NULL(fw_status)) { |
2409 |
+ reasons = le32_to_cpu(fw_status->wakeup_reasons); |
2410 |
++ kfree(fw_status); |
2411 |
++ } |
2412 |
+ |
2413 |
+ if (reasons & IWL_WOWLAN_WAKEUP_BY_RFKILL_DEASSERTED) |
2414 |
+ wakeup.rfkill_release = true; |
2415 |
+@@ -1860,15 +1862,15 @@ static int __iwl_mvm_resume(struct iwl_mvm *mvm, bool test) |
2416 |
+ /* get the BSS vif pointer again */ |
2417 |
+ vif = iwl_mvm_get_bss_vif(mvm); |
2418 |
+ if (IS_ERR_OR_NULL(vif)) |
2419 |
+- goto out_unlock; |
2420 |
++ goto err; |
2421 |
+ |
2422 |
+ ret = iwl_trans_d3_resume(mvm->trans, &d3_status, test); |
2423 |
+ if (ret) |
2424 |
+- goto out_unlock; |
2425 |
++ goto err; |
2426 |
+ |
2427 |
+ if (d3_status != IWL_D3_STATUS_ALIVE) { |
2428 |
+ IWL_INFO(mvm, "Device was reset during suspend\n"); |
2429 |
+- goto out_unlock; |
2430 |
++ goto err; |
2431 |
+ } |
2432 |
+ |
2433 |
+ /* query SRAM first in case we want event logging */ |
2434 |
+@@ -1886,7 +1888,8 @@ static int __iwl_mvm_resume(struct iwl_mvm *mvm, bool test) |
2435 |
+ /* has unlocked the mutex, so skip that */ |
2436 |
+ goto out; |
2437 |
+ |
2438 |
+- out_unlock: |
2439 |
++err: |
2440 |
++ iwl_mvm_free_nd(mvm); |
2441 |
+ mutex_unlock(&mvm->mutex); |
2442 |
+ |
2443 |
+ out: |
2444 |
+diff --git a/drivers/net/wireless/iwlwifi/pcie/trans.c b/drivers/net/wireless/iwlwifi/pcie/trans.c |
2445 |
+index 69935aa5a1b3..cb72edb3d16a 100644 |
2446 |
+--- a/drivers/net/wireless/iwlwifi/pcie/trans.c |
2447 |
++++ b/drivers/net/wireless/iwlwifi/pcie/trans.c |
2448 |
+@@ -5,8 +5,8 @@ |
2449 |
+ * |
2450 |
+ * GPL LICENSE SUMMARY |
2451 |
+ * |
2452 |
+- * Copyright(c) 2007 - 2014 Intel Corporation. All rights reserved. |
2453 |
+- * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH |
2454 |
++ * Copyright(c) 2007 - 2015 Intel Corporation. All rights reserved. |
2455 |
++ * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH |
2456 |
+ * |
2457 |
+ * This program is free software; you can redistribute it and/or modify |
2458 |
+ * it under the terms of version 2 of the GNU General Public License as |
2459 |
+@@ -31,8 +31,8 @@ |
2460 |
+ * |
2461 |
+ * BSD LICENSE |
2462 |
+ * |
2463 |
+- * Copyright(c) 2005 - 2014 Intel Corporation. All rights reserved. |
2464 |
+- * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH |
2465 |
++ * Copyright(c) 2005 - 2015 Intel Corporation. All rights reserved. |
2466 |
++ * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH |
2467 |
+ * All rights reserved. |
2468 |
+ * |
2469 |
+ * Redistribution and use in source and binary forms, with or without |
2470 |
+@@ -104,7 +104,7 @@ static void iwl_pcie_free_fw_monitor(struct iwl_trans *trans) |
2471 |
+ static void iwl_pcie_alloc_fw_monitor(struct iwl_trans *trans) |
2472 |
+ { |
2473 |
+ struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); |
2474 |
+- struct page *page; |
2475 |
++ struct page *page = NULL; |
2476 |
+ dma_addr_t phys; |
2477 |
+ u32 size; |
2478 |
+ u8 power; |
2479 |
+@@ -131,6 +131,7 @@ static void iwl_pcie_alloc_fw_monitor(struct iwl_trans *trans) |
2480 |
+ DMA_FROM_DEVICE); |
2481 |
+ if (dma_mapping_error(trans->dev, phys)) { |
2482 |
+ __free_pages(page, order); |
2483 |
++ page = NULL; |
2484 |
+ continue; |
2485 |
+ } |
2486 |
+ IWL_INFO(trans, |
2487 |
+diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c |
2488 |
+index 8444313eabe2..8694dddcce9a 100644 |
2489 |
+--- a/drivers/net/wireless/rt2x00/rt2800usb.c |
2490 |
++++ b/drivers/net/wireless/rt2x00/rt2800usb.c |
2491 |
+@@ -1040,6 +1040,7 @@ static struct usb_device_id rt2800usb_device_table[] = { |
2492 |
+ { USB_DEVICE(0x07d1, 0x3c17) }, |
2493 |
+ { USB_DEVICE(0x2001, 0x3317) }, |
2494 |
+ { USB_DEVICE(0x2001, 0x3c1b) }, |
2495 |
++ { USB_DEVICE(0x2001, 0x3c25) }, |
2496 |
+ /* Draytek */ |
2497 |
+ { USB_DEVICE(0x07fa, 0x7712) }, |
2498 |
+ /* DVICO */ |
2499 |
+diff --git a/drivers/net/wireless/rtlwifi/usb.c b/drivers/net/wireless/rtlwifi/usb.c |
2500 |
+index 46ee956d0235..27cd6cabf6c5 100644 |
2501 |
+--- a/drivers/net/wireless/rtlwifi/usb.c |
2502 |
++++ b/drivers/net/wireless/rtlwifi/usb.c |
2503 |
+@@ -126,7 +126,7 @@ static int _usbctrl_vendorreq_sync_read(struct usb_device *udev, u8 request, |
2504 |
+ |
2505 |
+ do { |
2506 |
+ status = usb_control_msg(udev, pipe, request, reqtype, value, |
2507 |
+- index, pdata, len, 0); /*max. timeout*/ |
2508 |
++ index, pdata, len, 1000); |
2509 |
+ if (status < 0) { |
2510 |
+ /* firmware download is checksumed, don't retry */ |
2511 |
+ if ((value >= FW_8192C_START_ADDRESS && |
2512 |
+diff --git a/drivers/power/reset/at91-reset.c b/drivers/power/reset/at91-reset.c |
2513 |
+index 13584e24736a..4d7d60e593b8 100644 |
2514 |
+--- a/drivers/power/reset/at91-reset.c |
2515 |
++++ b/drivers/power/reset/at91-reset.c |
2516 |
+@@ -212,9 +212,9 @@ static int at91_reset_platform_probe(struct platform_device *pdev) |
2517 |
+ res = platform_get_resource(pdev, IORESOURCE_MEM, idx + 1 ); |
2518 |
+ at91_ramc_base[idx] = devm_ioremap(&pdev->dev, res->start, |
2519 |
+ resource_size(res)); |
2520 |
+- if (IS_ERR(at91_ramc_base[idx])) { |
2521 |
++ if (!at91_ramc_base[idx]) { |
2522 |
+ dev_err(&pdev->dev, "Could not map ram controller address\n"); |
2523 |
+- return PTR_ERR(at91_ramc_base[idx]); |
2524 |
++ return -ENOMEM; |
2525 |
+ } |
2526 |
+ } |
2527 |
+ |
2528 |
+diff --git a/drivers/pwm/pwm-img.c b/drivers/pwm/pwm-img.c |
2529 |
+index 476171a768d6..8a029f9bc18c 100644 |
2530 |
+--- a/drivers/pwm/pwm-img.c |
2531 |
++++ b/drivers/pwm/pwm-img.c |
2532 |
+@@ -16,6 +16,7 @@ |
2533 |
+ #include <linux/mfd/syscon.h> |
2534 |
+ #include <linux/module.h> |
2535 |
+ #include <linux/of.h> |
2536 |
++#include <linux/of_device.h> |
2537 |
+ #include <linux/platform_device.h> |
2538 |
+ #include <linux/pwm.h> |
2539 |
+ #include <linux/regmap.h> |
2540 |
+@@ -38,7 +39,22 @@ |
2541 |
+ #define PERIP_PWM_PDM_CONTROL_CH_MASK 0x1 |
2542 |
+ #define PERIP_PWM_PDM_CONTROL_CH_SHIFT(ch) ((ch) * 4) |
2543 |
+ |
2544 |
+-#define MAX_TMBASE_STEPS 65536 |
2545 |
++/* |
2546 |
++ * PWM period is specified with a timebase register, |
2547 |
++ * in number of step periods. The PWM duty cycle is also |
2548 |
++ * specified in step periods, in the [0, $timebase] range. |
2549 |
++ * In other words, the timebase imposes the duty cycle |
2550 |
++ * resolution. Therefore, let's constraint the timebase to |
2551 |
++ * a minimum value to allow a sane range of duty cycle values. |
2552 |
++ * Imposing a minimum timebase, will impose a maximum PWM frequency. |
2553 |
++ * |
2554 |
++ * The value chosen is completely arbitrary. |
2555 |
++ */ |
2556 |
++#define MIN_TMBASE_STEPS 16 |
2557 |
++ |
2558 |
++struct img_pwm_soc_data { |
2559 |
++ u32 max_timebase; |
2560 |
++}; |
2561 |
+ |
2562 |
+ struct img_pwm_chip { |
2563 |
+ struct device *dev; |
2564 |
+@@ -47,6 +63,9 @@ struct img_pwm_chip { |
2565 |
+ struct clk *sys_clk; |
2566 |
+ void __iomem *base; |
2567 |
+ struct regmap *periph_regs; |
2568 |
++ int max_period_ns; |
2569 |
++ int min_period_ns; |
2570 |
++ const struct img_pwm_soc_data *data; |
2571 |
+ }; |
2572 |
+ |
2573 |
+ static inline struct img_pwm_chip *to_img_pwm_chip(struct pwm_chip *chip) |
2574 |
+@@ -72,24 +91,31 @@ static int img_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm, |
2575 |
+ u32 val, div, duty, timebase; |
2576 |
+ unsigned long mul, output_clk_hz, input_clk_hz; |
2577 |
+ struct img_pwm_chip *pwm_chip = to_img_pwm_chip(chip); |
2578 |
++ unsigned int max_timebase = pwm_chip->data->max_timebase; |
2579 |
++ |
2580 |
++ if (period_ns < pwm_chip->min_period_ns || |
2581 |
++ period_ns > pwm_chip->max_period_ns) { |
2582 |
++ dev_err(chip->dev, "configured period not in range\n"); |
2583 |
++ return -ERANGE; |
2584 |
++ } |
2585 |
+ |
2586 |
+ input_clk_hz = clk_get_rate(pwm_chip->pwm_clk); |
2587 |
+ output_clk_hz = DIV_ROUND_UP(NSEC_PER_SEC, period_ns); |
2588 |
+ |
2589 |
+ mul = DIV_ROUND_UP(input_clk_hz, output_clk_hz); |
2590 |
+- if (mul <= MAX_TMBASE_STEPS) { |
2591 |
++ if (mul <= max_timebase) { |
2592 |
+ div = PWM_CTRL_CFG_NO_SUB_DIV; |
2593 |
+ timebase = DIV_ROUND_UP(mul, 1); |
2594 |
+- } else if (mul <= MAX_TMBASE_STEPS * 8) { |
2595 |
++ } else if (mul <= max_timebase * 8) { |
2596 |
+ div = PWM_CTRL_CFG_SUB_DIV0; |
2597 |
+ timebase = DIV_ROUND_UP(mul, 8); |
2598 |
+- } else if (mul <= MAX_TMBASE_STEPS * 64) { |
2599 |
++ } else if (mul <= max_timebase * 64) { |
2600 |
+ div = PWM_CTRL_CFG_SUB_DIV1; |
2601 |
+ timebase = DIV_ROUND_UP(mul, 64); |
2602 |
+- } else if (mul <= MAX_TMBASE_STEPS * 512) { |
2603 |
++ } else if (mul <= max_timebase * 512) { |
2604 |
+ div = PWM_CTRL_CFG_SUB_DIV0_DIV1; |
2605 |
+ timebase = DIV_ROUND_UP(mul, 512); |
2606 |
+- } else if (mul > MAX_TMBASE_STEPS * 512) { |
2607 |
++ } else if (mul > max_timebase * 512) { |
2608 |
+ dev_err(chip->dev, |
2609 |
+ "failed to configure timebase steps/divider value\n"); |
2610 |
+ return -EINVAL; |
2611 |
+@@ -143,11 +169,27 @@ static const struct pwm_ops img_pwm_ops = { |
2612 |
+ .owner = THIS_MODULE, |
2613 |
+ }; |
2614 |
+ |
2615 |
++static const struct img_pwm_soc_data pistachio_pwm = { |
2616 |
++ .max_timebase = 255, |
2617 |
++}; |
2618 |
++ |
2619 |
++static const struct of_device_id img_pwm_of_match[] = { |
2620 |
++ { |
2621 |
++ .compatible = "img,pistachio-pwm", |
2622 |
++ .data = &pistachio_pwm, |
2623 |
++ }, |
2624 |
++ { } |
2625 |
++}; |
2626 |
++MODULE_DEVICE_TABLE(of, img_pwm_of_match); |
2627 |
++ |
2628 |
+ static int img_pwm_probe(struct platform_device *pdev) |
2629 |
+ { |
2630 |
+ int ret; |
2631 |
++ u64 val; |
2632 |
++ unsigned long clk_rate; |
2633 |
+ struct resource *res; |
2634 |
+ struct img_pwm_chip *pwm; |
2635 |
++ const struct of_device_id *of_dev_id; |
2636 |
+ |
2637 |
+ pwm = devm_kzalloc(&pdev->dev, sizeof(*pwm), GFP_KERNEL); |
2638 |
+ if (!pwm) |
2639 |
+@@ -160,6 +202,11 @@ static int img_pwm_probe(struct platform_device *pdev) |
2640 |
+ if (IS_ERR(pwm->base)) |
2641 |
+ return PTR_ERR(pwm->base); |
2642 |
+ |
2643 |
++ of_dev_id = of_match_device(img_pwm_of_match, &pdev->dev); |
2644 |
++ if (!of_dev_id) |
2645 |
++ return -ENODEV; |
2646 |
++ pwm->data = of_dev_id->data; |
2647 |
++ |
2648 |
+ pwm->periph_regs = syscon_regmap_lookup_by_phandle(pdev->dev.of_node, |
2649 |
+ "img,cr-periph"); |
2650 |
+ if (IS_ERR(pwm->periph_regs)) |
2651 |
+@@ -189,6 +236,17 @@ static int img_pwm_probe(struct platform_device *pdev) |
2652 |
+ goto disable_sysclk; |
2653 |
+ } |
2654 |
+ |
2655 |
++ clk_rate = clk_get_rate(pwm->pwm_clk); |
2656 |
++ |
2657 |
++ /* The maximum input clock divider is 512 */ |
2658 |
++ val = (u64)NSEC_PER_SEC * 512 * pwm->data->max_timebase; |
2659 |
++ do_div(val, clk_rate); |
2660 |
++ pwm->max_period_ns = val; |
2661 |
++ |
2662 |
++ val = (u64)NSEC_PER_SEC * MIN_TMBASE_STEPS; |
2663 |
++ do_div(val, clk_rate); |
2664 |
++ pwm->min_period_ns = val; |
2665 |
++ |
2666 |
+ pwm->chip.dev = &pdev->dev; |
2667 |
+ pwm->chip.ops = &img_pwm_ops; |
2668 |
+ pwm->chip.base = -1; |
2669 |
+@@ -228,12 +286,6 @@ static int img_pwm_remove(struct platform_device *pdev) |
2670 |
+ return pwmchip_remove(&pwm_chip->chip); |
2671 |
+ } |
2672 |
+ |
2673 |
+-static const struct of_device_id img_pwm_of_match[] = { |
2674 |
+- { .compatible = "img,pistachio-pwm", }, |
2675 |
+- { } |
2676 |
+-}; |
2677 |
+-MODULE_DEVICE_TABLE(of, img_pwm_of_match); |
2678 |
+- |
2679 |
+ static struct platform_driver img_pwm_driver = { |
2680 |
+ .driver = { |
2681 |
+ .name = "img-pwm", |
2682 |
+diff --git a/drivers/regulator/da9052-regulator.c b/drivers/regulator/da9052-regulator.c |
2683 |
+index 8a4df7a1f2ee..e628d4c2f2ae 100644 |
2684 |
+--- a/drivers/regulator/da9052-regulator.c |
2685 |
++++ b/drivers/regulator/da9052-regulator.c |
2686 |
+@@ -394,6 +394,7 @@ static inline struct da9052_regulator_info *find_regulator_info(u8 chip_id, |
2687 |
+ |
2688 |
+ static int da9052_regulator_probe(struct platform_device *pdev) |
2689 |
+ { |
2690 |
++ const struct mfd_cell *cell = mfd_get_cell(pdev); |
2691 |
+ struct regulator_config config = { }; |
2692 |
+ struct da9052_regulator *regulator; |
2693 |
+ struct da9052 *da9052; |
2694 |
+@@ -409,7 +410,7 @@ static int da9052_regulator_probe(struct platform_device *pdev) |
2695 |
+ regulator->da9052 = da9052; |
2696 |
+ |
2697 |
+ regulator->info = find_regulator_info(regulator->da9052->chip_id, |
2698 |
+- pdev->id); |
2699 |
++ cell->id); |
2700 |
+ if (regulator->info == NULL) { |
2701 |
+ dev_err(&pdev->dev, "invalid regulator ID specified\n"); |
2702 |
+ return -EINVAL; |
2703 |
+@@ -419,7 +420,7 @@ static int da9052_regulator_probe(struct platform_device *pdev) |
2704 |
+ config.driver_data = regulator; |
2705 |
+ config.regmap = da9052->regmap; |
2706 |
+ if (pdata && pdata->regulators) { |
2707 |
+- config.init_data = pdata->regulators[pdev->id]; |
2708 |
++ config.init_data = pdata->regulators[cell->id]; |
2709 |
+ } else { |
2710 |
+ #ifdef CONFIG_OF |
2711 |
+ struct device_node *nproot = da9052->dev->of_node; |
2712 |
+diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c |
2713 |
+index 3290a3ed5b31..a661d339adf7 100644 |
2714 |
+--- a/drivers/scsi/sd.c |
2715 |
++++ b/drivers/scsi/sd.c |
2716 |
+@@ -1624,6 +1624,7 @@ static unsigned int sd_completed_bytes(struct scsi_cmnd *scmd) |
2717 |
+ { |
2718 |
+ u64 start_lba = blk_rq_pos(scmd->request); |
2719 |
+ u64 end_lba = blk_rq_pos(scmd->request) + (scsi_bufflen(scmd) / 512); |
2720 |
++ u64 factor = scmd->device->sector_size / 512; |
2721 |
+ u64 bad_lba; |
2722 |
+ int info_valid; |
2723 |
+ /* |
2724 |
+@@ -1645,16 +1646,9 @@ static unsigned int sd_completed_bytes(struct scsi_cmnd *scmd) |
2725 |
+ if (scsi_bufflen(scmd) <= scmd->device->sector_size) |
2726 |
+ return 0; |
2727 |
+ |
2728 |
+- if (scmd->device->sector_size < 512) { |
2729 |
+- /* only legitimate sector_size here is 256 */ |
2730 |
+- start_lba <<= 1; |
2731 |
+- end_lba <<= 1; |
2732 |
+- } else { |
2733 |
+- /* be careful ... don't want any overflows */ |
2734 |
+- unsigned int factor = scmd->device->sector_size / 512; |
2735 |
+- do_div(start_lba, factor); |
2736 |
+- do_div(end_lba, factor); |
2737 |
+- } |
2738 |
++ /* be careful ... don't want any overflows */ |
2739 |
++ do_div(start_lba, factor); |
2740 |
++ do_div(end_lba, factor); |
2741 |
+ |
2742 |
+ /* The bad lba was reported incorrectly, we have no idea where |
2743 |
+ * the error is. |
2744 |
+@@ -2212,8 +2206,7 @@ got_data: |
2745 |
+ if (sector_size != 512 && |
2746 |
+ sector_size != 1024 && |
2747 |
+ sector_size != 2048 && |
2748 |
+- sector_size != 4096 && |
2749 |
+- sector_size != 256) { |
2750 |
++ sector_size != 4096) { |
2751 |
+ sd_printk(KERN_NOTICE, sdkp, "Unsupported sector size %d.\n", |
2752 |
+ sector_size); |
2753 |
+ /* |
2754 |
+@@ -2268,8 +2261,6 @@ got_data: |
2755 |
+ sdkp->capacity <<= 2; |
2756 |
+ else if (sector_size == 1024) |
2757 |
+ sdkp->capacity <<= 1; |
2758 |
+- else if (sector_size == 256) |
2759 |
+- sdkp->capacity >>= 1; |
2760 |
+ |
2761 |
+ blk_queue_physical_block_size(sdp->request_queue, |
2762 |
+ sdkp->physical_block_size); |
2763 |
+diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c |
2764 |
+index bf8c5c1e254e..75efaaeb0eca 100644 |
2765 |
+--- a/drivers/scsi/storvsc_drv.c |
2766 |
++++ b/drivers/scsi/storvsc_drv.c |
2767 |
+@@ -1565,8 +1565,7 @@ static int storvsc_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *scmnd) |
2768 |
+ break; |
2769 |
+ default: |
2770 |
+ vm_srb->data_in = UNKNOWN_TYPE; |
2771 |
+- vm_srb->win8_extension.srb_flags |= (SRB_FLAGS_DATA_IN | |
2772 |
+- SRB_FLAGS_DATA_OUT); |
2773 |
++ vm_srb->win8_extension.srb_flags |= SRB_FLAGS_NO_DATA_TRANSFER; |
2774 |
+ break; |
2775 |
+ } |
2776 |
+ |
2777 |
+diff --git a/drivers/staging/gdm724x/gdm_mux.c b/drivers/staging/gdm724x/gdm_mux.c |
2778 |
+index d1ab996b3305..a21a51efaad0 100644 |
2779 |
+--- a/drivers/staging/gdm724x/gdm_mux.c |
2780 |
++++ b/drivers/staging/gdm724x/gdm_mux.c |
2781 |
+@@ -158,7 +158,7 @@ static int up_to_host(struct mux_rx *r) |
2782 |
+ unsigned int start_flag; |
2783 |
+ unsigned int payload_size; |
2784 |
+ unsigned short packet_type; |
2785 |
+- int dummy_cnt; |
2786 |
++ int total_len; |
2787 |
+ u32 packet_size_sum = r->offset; |
2788 |
+ int index; |
2789 |
+ int ret = TO_HOST_INVALID_PACKET; |
2790 |
+@@ -176,10 +176,10 @@ static int up_to_host(struct mux_rx *r) |
2791 |
+ break; |
2792 |
+ } |
2793 |
+ |
2794 |
+- dummy_cnt = ALIGN(MUX_HEADER_SIZE + payload_size, 4); |
2795 |
++ total_len = ALIGN(MUX_HEADER_SIZE + payload_size, 4); |
2796 |
+ |
2797 |
+ if (len - packet_size_sum < |
2798 |
+- MUX_HEADER_SIZE + payload_size + dummy_cnt) { |
2799 |
++ total_len) { |
2800 |
+ pr_err("invalid payload : %d %d %04x\n", |
2801 |
+ payload_size, len, packet_type); |
2802 |
+ break; |
2803 |
+@@ -202,7 +202,7 @@ static int up_to_host(struct mux_rx *r) |
2804 |
+ break; |
2805 |
+ } |
2806 |
+ |
2807 |
+- packet_size_sum += MUX_HEADER_SIZE + payload_size + dummy_cnt; |
2808 |
++ packet_size_sum += total_len; |
2809 |
+ if (len - packet_size_sum <= MUX_HEADER_SIZE + 2) { |
2810 |
+ ret = r->callback(NULL, |
2811 |
+ 0, |
2812 |
+@@ -361,7 +361,6 @@ static int gdm_mux_send(void *priv_dev, void *data, int len, int tty_index, |
2813 |
+ struct mux_pkt_header *mux_header; |
2814 |
+ struct mux_tx *t = NULL; |
2815 |
+ static u32 seq_num = 1; |
2816 |
+- int dummy_cnt; |
2817 |
+ int total_len; |
2818 |
+ int ret; |
2819 |
+ unsigned long flags; |
2820 |
+@@ -374,9 +373,7 @@ static int gdm_mux_send(void *priv_dev, void *data, int len, int tty_index, |
2821 |
+ |
2822 |
+ spin_lock_irqsave(&mux_dev->write_lock, flags); |
2823 |
+ |
2824 |
+- dummy_cnt = ALIGN(MUX_HEADER_SIZE + len, 4); |
2825 |
+- |
2826 |
+- total_len = len + MUX_HEADER_SIZE + dummy_cnt; |
2827 |
++ total_len = ALIGN(MUX_HEADER_SIZE + len, 4); |
2828 |
+ |
2829 |
+ t = alloc_mux_tx(total_len); |
2830 |
+ if (!t) { |
2831 |
+@@ -392,7 +389,8 @@ static int gdm_mux_send(void *priv_dev, void *data, int len, int tty_index, |
2832 |
+ mux_header->packet_type = __cpu_to_le16(packet_type[tty_index]); |
2833 |
+ |
2834 |
+ memcpy(t->buf+MUX_HEADER_SIZE, data, len); |
2835 |
+- memset(t->buf+MUX_HEADER_SIZE+len, 0, dummy_cnt); |
2836 |
++ memset(t->buf+MUX_HEADER_SIZE+len, 0, total_len - MUX_HEADER_SIZE - |
2837 |
++ len); |
2838 |
+ |
2839 |
+ t->len = total_len; |
2840 |
+ t->callback = cb; |
2841 |
+diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/device_main.c |
2842 |
+index 03b2a90b9ac0..992236f605d8 100644 |
2843 |
+--- a/drivers/staging/vt6655/device_main.c |
2844 |
++++ b/drivers/staging/vt6655/device_main.c |
2845 |
+@@ -911,7 +911,11 @@ static int vnt_int_report_rate(struct vnt_private *priv, |
2846 |
+ |
2847 |
+ if (!(tsr1 & TSR1_TERR)) { |
2848 |
+ info->status.rates[0].idx = idx; |
2849 |
+- info->flags |= IEEE80211_TX_STAT_ACK; |
2850 |
++ |
2851 |
++ if (info->flags & IEEE80211_TX_CTL_NO_ACK) |
2852 |
++ info->flags |= IEEE80211_TX_STAT_NOACK_TRANSMITTED; |
2853 |
++ else |
2854 |
++ info->flags |= IEEE80211_TX_STAT_ACK; |
2855 |
+ } |
2856 |
+ |
2857 |
+ return 0; |
2858 |
+@@ -936,9 +940,6 @@ static int device_tx_srv(struct vnt_private *pDevice, unsigned int uIdx) |
2859 |
+ //Only the status of first TD in the chain is correct |
2860 |
+ if (pTD->m_td1TD1.byTCR & TCR_STP) { |
2861 |
+ if ((pTD->pTDInfo->byFlags & TD_FLAGS_NETIF_SKB) != 0) { |
2862 |
+- |
2863 |
+- vnt_int_report_rate(pDevice, pTD->pTDInfo, byTsr0, byTsr1); |
2864 |
+- |
2865 |
+ if (!(byTsr1 & TSR1_TERR)) { |
2866 |
+ if (byTsr0 != 0) { |
2867 |
+ pr_debug(" Tx[%d] OK but has error. tsr1[%02X] tsr0[%02X]\n", |
2868 |
+@@ -957,6 +958,9 @@ static int device_tx_srv(struct vnt_private *pDevice, unsigned int uIdx) |
2869 |
+ (int)uIdx, byTsr1, byTsr0); |
2870 |
+ } |
2871 |
+ } |
2872 |
++ |
2873 |
++ vnt_int_report_rate(pDevice, pTD->pTDInfo, byTsr0, byTsr1); |
2874 |
++ |
2875 |
+ device_free_tx_buf(pDevice, pTD); |
2876 |
+ pDevice->iTDUsed[uIdx]--; |
2877 |
+ } |
2878 |
+@@ -988,10 +992,8 @@ static void device_free_tx_buf(struct vnt_private *pDevice, PSTxDesc pDesc) |
2879 |
+ PCI_DMA_TODEVICE); |
2880 |
+ } |
2881 |
+ |
2882 |
+- if (pTDInfo->byFlags & TD_FLAGS_NETIF_SKB) |
2883 |
++ if (skb) |
2884 |
+ ieee80211_tx_status_irqsafe(pDevice->hw, skb); |
2885 |
+- else |
2886 |
+- dev_kfree_skb_irq(skb); |
2887 |
+ |
2888 |
+ pTDInfo->skb_dma = 0; |
2889 |
+ pTDInfo->skb = NULL; |
2890 |
+@@ -1201,14 +1203,6 @@ static int vnt_tx_packet(struct vnt_private *priv, struct sk_buff *skb) |
2891 |
+ if (dma_idx == TYPE_AC0DMA) |
2892 |
+ head_td->pTDInfo->byFlags = TD_FLAGS_NETIF_SKB; |
2893 |
+ |
2894 |
+- priv->iTDUsed[dma_idx]++; |
2895 |
+- |
2896 |
+- /* Take ownership */ |
2897 |
+- wmb(); |
2898 |
+- head_td->m_td0TD0.f1Owner = OWNED_BY_NIC; |
2899 |
+- |
2900 |
+- /* get Next */ |
2901 |
+- wmb(); |
2902 |
+ priv->apCurrTD[dma_idx] = head_td->next; |
2903 |
+ |
2904 |
+ spin_unlock_irqrestore(&priv->lock, flags); |
2905 |
+@@ -1229,11 +1223,18 @@ static int vnt_tx_packet(struct vnt_private *priv, struct sk_buff *skb) |
2906 |
+ |
2907 |
+ head_td->buff_addr = cpu_to_le32(head_td->pTDInfo->skb_dma); |
2908 |
+ |
2909 |
++ /* Poll Transmit the adapter */ |
2910 |
++ wmb(); |
2911 |
++ head_td->m_td0TD0.f1Owner = OWNED_BY_NIC; |
2912 |
++ wmb(); /* second memory barrier */ |
2913 |
++ |
2914 |
+ if (head_td->pTDInfo->byFlags & TD_FLAGS_NETIF_SKB) |
2915 |
+ MACvTransmitAC0(priv->PortOffset); |
2916 |
+ else |
2917 |
+ MACvTransmit0(priv->PortOffset); |
2918 |
+ |
2919 |
++ priv->iTDUsed[dma_idx]++; |
2920 |
++ |
2921 |
+ spin_unlock_irqrestore(&priv->lock, flags); |
2922 |
+ |
2923 |
+ return 0; |
2924 |
+@@ -1413,9 +1414,16 @@ static void vnt_bss_info_changed(struct ieee80211_hw *hw, |
2925 |
+ |
2926 |
+ priv->current_aid = conf->aid; |
2927 |
+ |
2928 |
+- if (changed & BSS_CHANGED_BSSID) |
2929 |
++ if (changed & BSS_CHANGED_BSSID) { |
2930 |
++ unsigned long flags; |
2931 |
++ |
2932 |
++ spin_lock_irqsave(&priv->lock, flags); |
2933 |
++ |
2934 |
+ MACvWriteBSSIDAddress(priv->PortOffset, (u8 *)conf->bssid); |
2935 |
+ |
2936 |
++ spin_unlock_irqrestore(&priv->lock, flags); |
2937 |
++ } |
2938 |
++ |
2939 |
+ if (changed & BSS_CHANGED_BASIC_RATES) { |
2940 |
+ priv->basic_rates = conf->basic_rates; |
2941 |
+ |
2942 |
+diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c |
2943 |
+index 33baf26de4b5..ee9ce165dcde 100644 |
2944 |
+--- a/drivers/staging/vt6656/rxtx.c |
2945 |
++++ b/drivers/staging/vt6656/rxtx.c |
2946 |
+@@ -805,10 +805,18 @@ int vnt_tx_packet(struct vnt_private *priv, struct sk_buff *skb) |
2947 |
+ vnt_schedule_command(priv, WLAN_CMD_SETPOWER); |
2948 |
+ } |
2949 |
+ |
2950 |
+- if (current_rate > RATE_11M) |
2951 |
+- pkt_type = priv->packet_type; |
2952 |
+- else |
2953 |
++ if (current_rate > RATE_11M) { |
2954 |
++ if (info->band == IEEE80211_BAND_5GHZ) { |
2955 |
++ pkt_type = PK_TYPE_11A; |
2956 |
++ } else { |
2957 |
++ if (tx_rate->flags & IEEE80211_TX_RC_USE_CTS_PROTECT) |
2958 |
++ pkt_type = PK_TYPE_11GB; |
2959 |
++ else |
2960 |
++ pkt_type = PK_TYPE_11GA; |
2961 |
++ } |
2962 |
++ } else { |
2963 |
+ pkt_type = PK_TYPE_11B; |
2964 |
++ } |
2965 |
+ |
2966 |
+ spin_lock_irqsave(&priv->lock, flags); |
2967 |
+ |
2968 |
+diff --git a/drivers/target/target_core_pscsi.c b/drivers/target/target_core_pscsi.c |
2969 |
+index f6c954c4635f..4073869d2090 100644 |
2970 |
+--- a/drivers/target/target_core_pscsi.c |
2971 |
++++ b/drivers/target/target_core_pscsi.c |
2972 |
+@@ -521,6 +521,7 @@ static int pscsi_configure_device(struct se_device *dev) |
2973 |
+ " pdv_host_id: %d\n", pdv->pdv_host_id); |
2974 |
+ return -EINVAL; |
2975 |
+ } |
2976 |
++ pdv->pdv_lld_host = sh; |
2977 |
+ } |
2978 |
+ } else { |
2979 |
+ if (phv->phv_mode == PHV_VIRTUAL_HOST_ID) { |
2980 |
+@@ -603,6 +604,8 @@ static void pscsi_free_device(struct se_device *dev) |
2981 |
+ if ((phv->phv_mode == PHV_LLD_SCSI_HOST_NO) && |
2982 |
+ (phv->phv_lld_host != NULL)) |
2983 |
+ scsi_host_put(phv->phv_lld_host); |
2984 |
++ else if (pdv->pdv_lld_host) |
2985 |
++ scsi_host_put(pdv->pdv_lld_host); |
2986 |
+ |
2987 |
+ if ((sd->type == TYPE_DISK) || (sd->type == TYPE_ROM)) |
2988 |
+ scsi_device_put(sd); |
2989 |
+diff --git a/drivers/target/target_core_pscsi.h b/drivers/target/target_core_pscsi.h |
2990 |
+index 1bd757dff8ee..820d3052b775 100644 |
2991 |
+--- a/drivers/target/target_core_pscsi.h |
2992 |
++++ b/drivers/target/target_core_pscsi.h |
2993 |
+@@ -45,6 +45,7 @@ struct pscsi_dev_virt { |
2994 |
+ int pdv_lun_id; |
2995 |
+ struct block_device *pdv_bd; |
2996 |
+ struct scsi_device *pdv_sd; |
2997 |
++ struct Scsi_Host *pdv_lld_host; |
2998 |
+ } ____cacheline_aligned; |
2999 |
+ |
3000 |
+ typedef enum phv_modes { |
3001 |
+diff --git a/drivers/thermal/armada_thermal.c b/drivers/thermal/armada_thermal.c |
3002 |
+index c2556cf5186b..01255fd65135 100644 |
3003 |
+--- a/drivers/thermal/armada_thermal.c |
3004 |
++++ b/drivers/thermal/armada_thermal.c |
3005 |
+@@ -224,9 +224,9 @@ static const struct armada_thermal_data armada380_data = { |
3006 |
+ .is_valid_shift = 10, |
3007 |
+ .temp_shift = 0, |
3008 |
+ .temp_mask = 0x3ff, |
3009 |
+- .coef_b = 1169498786UL, |
3010 |
+- .coef_m = 2000000UL, |
3011 |
+- .coef_div = 4289, |
3012 |
++ .coef_b = 2931108200UL, |
3013 |
++ .coef_m = 5000000UL, |
3014 |
++ .coef_div = 10502, |
3015 |
+ .inverted = true, |
3016 |
+ }; |
3017 |
+ |
3018 |
+diff --git a/drivers/tty/hvc/hvc_xen.c b/drivers/tty/hvc/hvc_xen.c |
3019 |
+index 5bab1c684bb1..7a3d146a5f0e 100644 |
3020 |
+--- a/drivers/tty/hvc/hvc_xen.c |
3021 |
++++ b/drivers/tty/hvc/hvc_xen.c |
3022 |
+@@ -289,7 +289,7 @@ static int xen_initial_domain_console_init(void) |
3023 |
+ return -ENOMEM; |
3024 |
+ } |
3025 |
+ |
3026 |
+- info->irq = bind_virq_to_irq(VIRQ_CONSOLE, 0); |
3027 |
++ info->irq = bind_virq_to_irq(VIRQ_CONSOLE, 0, false); |
3028 |
+ info->vtermno = HVC_COOKIE; |
3029 |
+ |
3030 |
+ spin_lock(&xencons_lock); |
3031 |
+diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c |
3032 |
+index c4343764cc5b..bce16e405d59 100644 |
3033 |
+--- a/drivers/tty/n_gsm.c |
3034 |
++++ b/drivers/tty/n_gsm.c |
3035 |
+@@ -3170,7 +3170,7 @@ static int gsmtty_break_ctl(struct tty_struct *tty, int state) |
3036 |
+ return gsmtty_modem_update(dlci, encode); |
3037 |
+ } |
3038 |
+ |
3039 |
+-static void gsmtty_remove(struct tty_driver *driver, struct tty_struct *tty) |
3040 |
++static void gsmtty_cleanup(struct tty_struct *tty) |
3041 |
+ { |
3042 |
+ struct gsm_dlci *dlci = tty->driver_data; |
3043 |
+ struct gsm_mux *gsm = dlci->gsm; |
3044 |
+@@ -3178,7 +3178,6 @@ static void gsmtty_remove(struct tty_driver *driver, struct tty_struct *tty) |
3045 |
+ dlci_put(dlci); |
3046 |
+ dlci_put(gsm->dlci[0]); |
3047 |
+ mux_put(gsm); |
3048 |
+- driver->ttys[tty->index] = NULL; |
3049 |
+ } |
3050 |
+ |
3051 |
+ /* Virtual ttys for the demux */ |
3052 |
+@@ -3199,7 +3198,7 @@ static const struct tty_operations gsmtty_ops = { |
3053 |
+ .tiocmget = gsmtty_tiocmget, |
3054 |
+ .tiocmset = gsmtty_tiocmset, |
3055 |
+ .break_ctl = gsmtty_break_ctl, |
3056 |
+- .remove = gsmtty_remove, |
3057 |
++ .cleanup = gsmtty_cleanup, |
3058 |
+ }; |
3059 |
+ |
3060 |
+ |
3061 |
+diff --git a/drivers/tty/n_hdlc.c b/drivers/tty/n_hdlc.c |
3062 |
+index 644ddb841d9f..bbc4ce66c2c1 100644 |
3063 |
+--- a/drivers/tty/n_hdlc.c |
3064 |
++++ b/drivers/tty/n_hdlc.c |
3065 |
+@@ -600,7 +600,7 @@ static ssize_t n_hdlc_tty_read(struct tty_struct *tty, struct file *file, |
3066 |
+ add_wait_queue(&tty->read_wait, &wait); |
3067 |
+ |
3068 |
+ for (;;) { |
3069 |
+- if (test_bit(TTY_OTHER_CLOSED, &tty->flags)) { |
3070 |
++ if (test_bit(TTY_OTHER_DONE, &tty->flags)) { |
3071 |
+ ret = -EIO; |
3072 |
+ break; |
3073 |
+ } |
3074 |
+@@ -828,7 +828,7 @@ static unsigned int n_hdlc_tty_poll(struct tty_struct *tty, struct file *filp, |
3075 |
+ /* set bits for operations that won't block */ |
3076 |
+ if (n_hdlc->rx_buf_list.head) |
3077 |
+ mask |= POLLIN | POLLRDNORM; /* readable */ |
3078 |
+- if (test_bit(TTY_OTHER_CLOSED, &tty->flags)) |
3079 |
++ if (test_bit(TTY_OTHER_DONE, &tty->flags)) |
3080 |
+ mask |= POLLHUP; |
3081 |
+ if (tty_hung_up_p(filp)) |
3082 |
+ mask |= POLLHUP; |
3083 |
+diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c |
3084 |
+index cf6e0f2e1331..cc57a3a6b02b 100644 |
3085 |
+--- a/drivers/tty/n_tty.c |
3086 |
++++ b/drivers/tty/n_tty.c |
3087 |
+@@ -1949,6 +1949,18 @@ static inline int input_available_p(struct tty_struct *tty, int poll) |
3088 |
+ return ldata->commit_head - ldata->read_tail >= amt; |
3089 |
+ } |
3090 |
+ |
3091 |
++static inline int check_other_done(struct tty_struct *tty) |
3092 |
++{ |
3093 |
++ int done = test_bit(TTY_OTHER_DONE, &tty->flags); |
3094 |
++ if (done) { |
3095 |
++ /* paired with cmpxchg() in check_other_closed(); ensures |
3096 |
++ * read buffer head index is not stale |
3097 |
++ */ |
3098 |
++ smp_mb__after_atomic(); |
3099 |
++ } |
3100 |
++ return done; |
3101 |
++} |
3102 |
++ |
3103 |
+ /** |
3104 |
+ * copy_from_read_buf - copy read data directly |
3105 |
+ * @tty: terminal device |
3106 |
+@@ -2167,7 +2179,7 @@ static ssize_t n_tty_read(struct tty_struct *tty, struct file *file, |
3107 |
+ struct n_tty_data *ldata = tty->disc_data; |
3108 |
+ unsigned char __user *b = buf; |
3109 |
+ DEFINE_WAIT_FUNC(wait, woken_wake_function); |
3110 |
+- int c; |
3111 |
++ int c, done; |
3112 |
+ int minimum, time; |
3113 |
+ ssize_t retval = 0; |
3114 |
+ long timeout; |
3115 |
+@@ -2235,8 +2247,10 @@ static ssize_t n_tty_read(struct tty_struct *tty, struct file *file, |
3116 |
+ ((minimum - (b - buf)) >= 1)) |
3117 |
+ ldata->minimum_to_wake = (minimum - (b - buf)); |
3118 |
+ |
3119 |
++ done = check_other_done(tty); |
3120 |
++ |
3121 |
+ if (!input_available_p(tty, 0)) { |
3122 |
+- if (test_bit(TTY_OTHER_CLOSED, &tty->flags)) { |
3123 |
++ if (done) { |
3124 |
+ retval = -EIO; |
3125 |
+ break; |
3126 |
+ } |
3127 |
+@@ -2443,12 +2457,12 @@ static unsigned int n_tty_poll(struct tty_struct *tty, struct file *file, |
3128 |
+ |
3129 |
+ poll_wait(file, &tty->read_wait, wait); |
3130 |
+ poll_wait(file, &tty->write_wait, wait); |
3131 |
++ if (check_other_done(tty)) |
3132 |
++ mask |= POLLHUP; |
3133 |
+ if (input_available_p(tty, 1)) |
3134 |
+ mask |= POLLIN | POLLRDNORM; |
3135 |
+ if (tty->packet && tty->link->ctrl_status) |
3136 |
+ mask |= POLLPRI | POLLIN | POLLRDNORM; |
3137 |
+- if (test_bit(TTY_OTHER_CLOSED, &tty->flags)) |
3138 |
+- mask |= POLLHUP; |
3139 |
+ if (tty_hung_up_p(file)) |
3140 |
+ mask |= POLLHUP; |
3141 |
+ if (!(mask & (POLLHUP | POLLIN | POLLRDNORM))) { |
3142 |
+diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c |
3143 |
+index e72ee629cead..4d5e8409769c 100644 |
3144 |
+--- a/drivers/tty/pty.c |
3145 |
++++ b/drivers/tty/pty.c |
3146 |
+@@ -53,9 +53,8 @@ static void pty_close(struct tty_struct *tty, struct file *filp) |
3147 |
+ /* Review - krefs on tty_link ?? */ |
3148 |
+ if (!tty->link) |
3149 |
+ return; |
3150 |
+- tty_flush_to_ldisc(tty->link); |
3151 |
+ set_bit(TTY_OTHER_CLOSED, &tty->link->flags); |
3152 |
+- wake_up_interruptible(&tty->link->read_wait); |
3153 |
++ tty_flip_buffer_push(tty->link->port); |
3154 |
+ wake_up_interruptible(&tty->link->write_wait); |
3155 |
+ if (tty->driver->subtype == PTY_TYPE_MASTER) { |
3156 |
+ set_bit(TTY_OTHER_CLOSED, &tty->flags); |
3157 |
+@@ -243,7 +242,9 @@ static int pty_open(struct tty_struct *tty, struct file *filp) |
3158 |
+ goto out; |
3159 |
+ |
3160 |
+ clear_bit(TTY_IO_ERROR, &tty->flags); |
3161 |
++ /* TTY_OTHER_CLOSED must be cleared before TTY_OTHER_DONE */ |
3162 |
+ clear_bit(TTY_OTHER_CLOSED, &tty->link->flags); |
3163 |
++ clear_bit(TTY_OTHER_DONE, &tty->link->flags); |
3164 |
+ set_bit(TTY_THROTTLED, &tty->flags); |
3165 |
+ return 0; |
3166 |
+ |
3167 |
+diff --git a/drivers/tty/tty_buffer.c b/drivers/tty/tty_buffer.c |
3168 |
+index 75661641f5fe..2f78b77f0f81 100644 |
3169 |
+--- a/drivers/tty/tty_buffer.c |
3170 |
++++ b/drivers/tty/tty_buffer.c |
3171 |
+@@ -37,6 +37,28 @@ |
3172 |
+ |
3173 |
+ #define TTY_BUFFER_PAGE (((PAGE_SIZE - sizeof(struct tty_buffer)) / 2) & ~0xFF) |
3174 |
+ |
3175 |
++/* |
3176 |
++ * If all tty flip buffers have been processed by flush_to_ldisc() or |
3177 |
++ * dropped by tty_buffer_flush(), check if the linked pty has been closed. |
3178 |
++ * If so, wake the reader/poll to process |
3179 |
++ */ |
3180 |
++static inline void check_other_closed(struct tty_struct *tty) |
3181 |
++{ |
3182 |
++ unsigned long flags, old; |
3183 |
++ |
3184 |
++ /* transition from TTY_OTHER_CLOSED => TTY_OTHER_DONE must be atomic */ |
3185 |
++ for (flags = ACCESS_ONCE(tty->flags); |
3186 |
++ test_bit(TTY_OTHER_CLOSED, &flags); |
3187 |
++ ) { |
3188 |
++ old = flags; |
3189 |
++ __set_bit(TTY_OTHER_DONE, &flags); |
3190 |
++ flags = cmpxchg(&tty->flags, old, flags); |
3191 |
++ if (old == flags) { |
3192 |
++ wake_up_interruptible(&tty->read_wait); |
3193 |
++ break; |
3194 |
++ } |
3195 |
++ } |
3196 |
++} |
3197 |
+ |
3198 |
+ /** |
3199 |
+ * tty_buffer_lock_exclusive - gain exclusive access to buffer |
3200 |
+@@ -229,6 +251,8 @@ void tty_buffer_flush(struct tty_struct *tty, struct tty_ldisc *ld) |
3201 |
+ if (ld && ld->ops->flush_buffer) |
3202 |
+ ld->ops->flush_buffer(tty); |
3203 |
+ |
3204 |
++ check_other_closed(tty); |
3205 |
++ |
3206 |
+ atomic_dec(&buf->priority); |
3207 |
+ mutex_unlock(&buf->lock); |
3208 |
+ } |
3209 |
+@@ -471,8 +495,10 @@ static void flush_to_ldisc(struct work_struct *work) |
3210 |
+ smp_rmb(); |
3211 |
+ count = head->commit - head->read; |
3212 |
+ if (!count) { |
3213 |
+- if (next == NULL) |
3214 |
++ if (next == NULL) { |
3215 |
++ check_other_closed(tty); |
3216 |
+ break; |
3217 |
++ } |
3218 |
+ buf->head = next; |
3219 |
+ tty_buffer_free(port, head); |
3220 |
+ continue; |
3221 |
+@@ -489,19 +515,6 @@ static void flush_to_ldisc(struct work_struct *work) |
3222 |
+ } |
3223 |
+ |
3224 |
+ /** |
3225 |
+- * tty_flush_to_ldisc |
3226 |
+- * @tty: tty to push |
3227 |
+- * |
3228 |
+- * Push the terminal flip buffers to the line discipline. |
3229 |
+- * |
3230 |
+- * Must not be called from IRQ context. |
3231 |
+- */ |
3232 |
+-void tty_flush_to_ldisc(struct tty_struct *tty) |
3233 |
+-{ |
3234 |
+- flush_work(&tty->port->buf.work); |
3235 |
+-} |
3236 |
+- |
3237 |
+-/** |
3238 |
+ * tty_flip_buffer_push - terminal |
3239 |
+ * @port: tty port to push |
3240 |
+ * |
3241 |
+diff --git a/drivers/usb/gadget/configfs.c b/drivers/usb/gadget/configfs.c |
3242 |
+index c42765b3a060..0495c94a23d7 100644 |
3243 |
+--- a/drivers/usb/gadget/configfs.c |
3244 |
++++ b/drivers/usb/gadget/configfs.c |
3245 |
+@@ -1295,6 +1295,7 @@ static void purge_configs_funcs(struct gadget_info *gi) |
3246 |
+ } |
3247 |
+ } |
3248 |
+ c->next_interface_id = 0; |
3249 |
++ memset(c->interface, 0, sizeof(c->interface)); |
3250 |
+ c->superspeed = 0; |
3251 |
+ c->highspeed = 0; |
3252 |
+ c->fullspeed = 0; |
3253 |
+diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c |
3254 |
+index eeedde8c435a..6994c99e58a6 100644 |
3255 |
+--- a/drivers/usb/host/xhci-ring.c |
3256 |
++++ b/drivers/usb/host/xhci-ring.c |
3257 |
+@@ -2026,8 +2026,13 @@ static int process_isoc_td(struct xhci_hcd *xhci, struct xhci_td *td, |
3258 |
+ break; |
3259 |
+ case COMP_DEV_ERR: |
3260 |
+ case COMP_STALL: |
3261 |
++ frame->status = -EPROTO; |
3262 |
++ skip_td = true; |
3263 |
++ break; |
3264 |
+ case COMP_TX_ERR: |
3265 |
+ frame->status = -EPROTO; |
3266 |
++ if (event_trb != td->last_trb) |
3267 |
++ return 0; |
3268 |
+ skip_td = true; |
3269 |
+ break; |
3270 |
+ case COMP_STOP: |
3271 |
+@@ -2640,7 +2645,7 @@ irqreturn_t xhci_irq(struct usb_hcd *hcd) |
3272 |
+ xhci_halt(xhci); |
3273 |
+ hw_died: |
3274 |
+ spin_unlock(&xhci->lock); |
3275 |
+- return -ESHUTDOWN; |
3276 |
++ return IRQ_HANDLED; |
3277 |
+ } |
3278 |
+ |
3279 |
+ /* |
3280 |
+diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h |
3281 |
+index 8e421b89632d..ea75e8ccd3c1 100644 |
3282 |
+--- a/drivers/usb/host/xhci.h |
3283 |
++++ b/drivers/usb/host/xhci.h |
3284 |
+@@ -1267,7 +1267,7 @@ union xhci_trb { |
3285 |
+ * since the command ring is 64-byte aligned. |
3286 |
+ * It must also be greater than 16. |
3287 |
+ */ |
3288 |
+-#define TRBS_PER_SEGMENT 64 |
3289 |
++#define TRBS_PER_SEGMENT 256 |
3290 |
+ /* Allow two commands + a link TRB, along with any reserved command TRBs */ |
3291 |
+ #define MAX_RSVD_CMD_TRBS (TRBS_PER_SEGMENT - 3) |
3292 |
+ #define TRB_SEGMENT_SIZE (TRBS_PER_SEGMENT*16) |
3293 |
+diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c |
3294 |
+index 84ce2d74894c..9031750e7404 100644 |
3295 |
+--- a/drivers/usb/serial/cp210x.c |
3296 |
++++ b/drivers/usb/serial/cp210x.c |
3297 |
+@@ -127,6 +127,7 @@ static const struct usb_device_id id_table[] = { |
3298 |
+ { USB_DEVICE(0x10C4, 0x88A5) }, /* Planet Innovation Ingeni ZigBee USB Device */ |
3299 |
+ { USB_DEVICE(0x10C4, 0x8946) }, /* Ketra N1 Wireless Interface */ |
3300 |
+ { USB_DEVICE(0x10C4, 0x8977) }, /* CEL MeshWorks DevKit Device */ |
3301 |
++ { USB_DEVICE(0x10C4, 0x8998) }, /* KCF Technologies PRN */ |
3302 |
+ { USB_DEVICE(0x10C4, 0xEA60) }, /* Silicon Labs factory default */ |
3303 |
+ { USB_DEVICE(0x10C4, 0xEA61) }, /* Silicon Labs factory default */ |
3304 |
+ { USB_DEVICE(0x10C4, 0xEA70) }, /* Silicon Labs factory default */ |
3305 |
+diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c |
3306 |
+index 829604d11f3f..f5257af33ecf 100644 |
3307 |
+--- a/drivers/usb/serial/pl2303.c |
3308 |
++++ b/drivers/usb/serial/pl2303.c |
3309 |
+@@ -61,7 +61,6 @@ static const struct usb_device_id id_table[] = { |
3310 |
+ { USB_DEVICE(DCU10_VENDOR_ID, DCU10_PRODUCT_ID) }, |
3311 |
+ { USB_DEVICE(SITECOM_VENDOR_ID, SITECOM_PRODUCT_ID) }, |
3312 |
+ { USB_DEVICE(ALCATEL_VENDOR_ID, ALCATEL_PRODUCT_ID) }, |
3313 |
+- { USB_DEVICE(SAMSUNG_VENDOR_ID, SAMSUNG_PRODUCT_ID) }, |
3314 |
+ { USB_DEVICE(SIEMENS_VENDOR_ID, SIEMENS_PRODUCT_ID_SX1), |
3315 |
+ .driver_info = PL2303_QUIRK_UART_STATE_IDX0 }, |
3316 |
+ { USB_DEVICE(SIEMENS_VENDOR_ID, SIEMENS_PRODUCT_ID_X65), |
3317 |
+diff --git a/drivers/usb/serial/pl2303.h b/drivers/usb/serial/pl2303.h |
3318 |
+index 71fd9da1d6e7..e3b7af8adfb7 100644 |
3319 |
+--- a/drivers/usb/serial/pl2303.h |
3320 |
++++ b/drivers/usb/serial/pl2303.h |
3321 |
+@@ -62,10 +62,6 @@ |
3322 |
+ #define ALCATEL_VENDOR_ID 0x11f7 |
3323 |
+ #define ALCATEL_PRODUCT_ID 0x02df |
3324 |
+ |
3325 |
+-/* Samsung I330 phone cradle */ |
3326 |
+-#define SAMSUNG_VENDOR_ID 0x04e8 |
3327 |
+-#define SAMSUNG_PRODUCT_ID 0x8001 |
3328 |
+- |
3329 |
+ #define SIEMENS_VENDOR_ID 0x11f5 |
3330 |
+ #define SIEMENS_PRODUCT_ID_SX1 0x0001 |
3331 |
+ #define SIEMENS_PRODUCT_ID_X65 0x0003 |
3332 |
+diff --git a/drivers/usb/serial/visor.c b/drivers/usb/serial/visor.c |
3333 |
+index bf2bd40e5f2a..60afb39eb73c 100644 |
3334 |
+--- a/drivers/usb/serial/visor.c |
3335 |
++++ b/drivers/usb/serial/visor.c |
3336 |
+@@ -95,7 +95,7 @@ static const struct usb_device_id id_table[] = { |
3337 |
+ .driver_info = (kernel_ulong_t)&palm_os_4_probe }, |
3338 |
+ { USB_DEVICE(ACER_VENDOR_ID, ACER_S10_ID), |
3339 |
+ .driver_info = (kernel_ulong_t)&palm_os_4_probe }, |
3340 |
+- { USB_DEVICE(SAMSUNG_VENDOR_ID, SAMSUNG_SCH_I330_ID), |
3341 |
++ { USB_DEVICE_INTERFACE_CLASS(SAMSUNG_VENDOR_ID, SAMSUNG_SCH_I330_ID, 0xff), |
3342 |
+ .driver_info = (kernel_ulong_t)&palm_os_4_probe }, |
3343 |
+ { USB_DEVICE(SAMSUNG_VENDOR_ID, SAMSUNG_SPH_I500_ID), |
3344 |
+ .driver_info = (kernel_ulong_t)&palm_os_4_probe }, |
3345 |
+diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h |
3346 |
+index d684b4b8108f..caf188800c67 100644 |
3347 |
+--- a/drivers/usb/storage/unusual_devs.h |
3348 |
++++ b/drivers/usb/storage/unusual_devs.h |
3349 |
+@@ -766,6 +766,13 @@ UNUSUAL_DEV( 0x059f, 0x0643, 0x0000, 0x0000, |
3350 |
+ USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
3351 |
+ US_FL_GO_SLOW ), |
3352 |
+ |
3353 |
++/* Reported by Christian Schaller <cschalle@××××××.com> */ |
3354 |
++UNUSUAL_DEV( 0x059f, 0x0651, 0x0000, 0x0000, |
3355 |
++ "LaCie", |
3356 |
++ "External HDD", |
3357 |
++ USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
3358 |
++ US_FL_NO_WP_DETECT ), |
3359 |
++ |
3360 |
+ /* Submitted by Joel Bourquard <numlock@××××××××.ch> |
3361 |
+ * Some versions of this device need the SubClass and Protocol overrides |
3362 |
+ * while others don't. |
3363 |
+diff --git a/drivers/xen/events/events_base.c b/drivers/xen/events/events_base.c |
3364 |
+index 2b8553bd8715..38387950490e 100644 |
3365 |
+--- a/drivers/xen/events/events_base.c |
3366 |
++++ b/drivers/xen/events/events_base.c |
3367 |
+@@ -957,7 +957,7 @@ unsigned xen_evtchn_nr_channels(void) |
3368 |
+ } |
3369 |
+ EXPORT_SYMBOL_GPL(xen_evtchn_nr_channels); |
3370 |
+ |
3371 |
+-int bind_virq_to_irq(unsigned int virq, unsigned int cpu) |
3372 |
++int bind_virq_to_irq(unsigned int virq, unsigned int cpu, bool percpu) |
3373 |
+ { |
3374 |
+ struct evtchn_bind_virq bind_virq; |
3375 |
+ int evtchn, irq, ret; |
3376 |
+@@ -971,8 +971,12 @@ int bind_virq_to_irq(unsigned int virq, unsigned int cpu) |
3377 |
+ if (irq < 0) |
3378 |
+ goto out; |
3379 |
+ |
3380 |
+- irq_set_chip_and_handler_name(irq, &xen_percpu_chip, |
3381 |
+- handle_percpu_irq, "virq"); |
3382 |
++ if (percpu) |
3383 |
++ irq_set_chip_and_handler_name(irq, &xen_percpu_chip, |
3384 |
++ handle_percpu_irq, "virq"); |
3385 |
++ else |
3386 |
++ irq_set_chip_and_handler_name(irq, &xen_dynamic_chip, |
3387 |
++ handle_edge_irq, "virq"); |
3388 |
+ |
3389 |
+ bind_virq.virq = virq; |
3390 |
+ bind_virq.vcpu = cpu; |
3391 |
+@@ -1062,7 +1066,7 @@ int bind_virq_to_irqhandler(unsigned int virq, unsigned int cpu, |
3392 |
+ { |
3393 |
+ int irq, retval; |
3394 |
+ |
3395 |
+- irq = bind_virq_to_irq(virq, cpu); |
3396 |
++ irq = bind_virq_to_irq(virq, cpu, irqflags & IRQF_PERCPU); |
3397 |
+ if (irq < 0) |
3398 |
+ return irq; |
3399 |
+ retval = request_irq(irq, handler, irqflags, devname, dev_id); |
3400 |
+diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c |
3401 |
+index d925f55e4857..8081aba116a7 100644 |
3402 |
+--- a/fs/binfmt_elf.c |
3403 |
++++ b/fs/binfmt_elf.c |
3404 |
+@@ -928,7 +928,7 @@ static int load_elf_binary(struct linux_binprm *bprm) |
3405 |
+ total_size = total_mapping_size(elf_phdata, |
3406 |
+ loc->elf_ex.e_phnum); |
3407 |
+ if (!total_size) { |
3408 |
+- error = -EINVAL; |
3409 |
++ retval = -EINVAL; |
3410 |
+ goto out_free_dentry; |
3411 |
+ } |
3412 |
+ } |
3413 |
+diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c |
3414 |
+index 0a795c969c78..8b33da6ec3dd 100644 |
3415 |
+--- a/fs/btrfs/extent-tree.c |
3416 |
++++ b/fs/btrfs/extent-tree.c |
3417 |
+@@ -8548,7 +8548,9 @@ int btrfs_set_block_group_ro(struct btrfs_root *root, |
3418 |
+ out: |
3419 |
+ if (cache->flags & BTRFS_BLOCK_GROUP_SYSTEM) { |
3420 |
+ alloc_flags = update_block_group_flags(root, cache->flags); |
3421 |
++ lock_chunks(root->fs_info->chunk_root); |
3422 |
+ check_system_chunk(trans, root, alloc_flags); |
3423 |
++ unlock_chunks(root->fs_info->chunk_root); |
3424 |
+ } |
3425 |
+ |
3426 |
+ btrfs_end_transaction(trans, root); |
3427 |
+diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c |
3428 |
+index 8222f6f74147..44a7e0398d97 100644 |
3429 |
+--- a/fs/btrfs/volumes.c |
3430 |
++++ b/fs/btrfs/volumes.c |
3431 |
+@@ -4626,6 +4626,7 @@ int btrfs_alloc_chunk(struct btrfs_trans_handle *trans, |
3432 |
+ { |
3433 |
+ u64 chunk_offset; |
3434 |
+ |
3435 |
++ ASSERT(mutex_is_locked(&extent_root->fs_info->chunk_mutex)); |
3436 |
+ chunk_offset = find_next_chunk(extent_root->fs_info); |
3437 |
+ return __btrfs_alloc_chunk(trans, extent_root, chunk_offset, type); |
3438 |
+ } |
3439 |
+diff --git a/fs/dcache.c b/fs/dcache.c |
3440 |
+index c71e3732e53b..922f23ef6041 100644 |
3441 |
+--- a/fs/dcache.c |
3442 |
++++ b/fs/dcache.c |
3443 |
+@@ -1205,13 +1205,13 @@ ascend: |
3444 |
+ /* might go back up the wrong parent if we have had a rename. */ |
3445 |
+ if (need_seqretry(&rename_lock, seq)) |
3446 |
+ goto rename_retry; |
3447 |
+- next = child->d_child.next; |
3448 |
+- while (unlikely(child->d_flags & DCACHE_DENTRY_KILLED)) { |
3449 |
++ /* go into the first sibling still alive */ |
3450 |
++ do { |
3451 |
++ next = child->d_child.next; |
3452 |
+ if (next == &this_parent->d_subdirs) |
3453 |
+ goto ascend; |
3454 |
+ child = list_entry(next, struct dentry, d_child); |
3455 |
+- next = next->next; |
3456 |
+- } |
3457 |
++ } while (unlikely(child->d_flags & DCACHE_DENTRY_KILLED)); |
3458 |
+ rcu_read_unlock(); |
3459 |
+ goto resume; |
3460 |
+ } |
3461 |
+diff --git a/fs/exec.c b/fs/exec.c |
3462 |
+index 00400cf522dc..120244523647 100644 |
3463 |
+--- a/fs/exec.c |
3464 |
++++ b/fs/exec.c |
3465 |
+@@ -659,6 +659,9 @@ int setup_arg_pages(struct linux_binprm *bprm, |
3466 |
+ if (stack_base > STACK_SIZE_MAX) |
3467 |
+ stack_base = STACK_SIZE_MAX; |
3468 |
+ |
3469 |
++ /* Add space for stack randomization. */ |
3470 |
++ stack_base += (STACK_RND_MASK << PAGE_SHIFT); |
3471 |
++ |
3472 |
+ /* Make sure we didn't let the argument array grow too large. */ |
3473 |
+ if (vma->vm_end - vma->vm_start > stack_base) |
3474 |
+ return -ENOMEM; |
3475 |
+diff --git a/fs/ext4/ext4_jbd2.c b/fs/ext4/ext4_jbd2.c |
3476 |
+index 3445035c7e01..d41843181818 100644 |
3477 |
+--- a/fs/ext4/ext4_jbd2.c |
3478 |
++++ b/fs/ext4/ext4_jbd2.c |
3479 |
+@@ -87,6 +87,12 @@ int __ext4_journal_stop(const char *where, unsigned int line, handle_t *handle) |
3480 |
+ ext4_put_nojournal(handle); |
3481 |
+ return 0; |
3482 |
+ } |
3483 |
++ |
3484 |
++ if (!handle->h_transaction) { |
3485 |
++ err = jbd2_journal_stop(handle); |
3486 |
++ return handle->h_err ? handle->h_err : err; |
3487 |
++ } |
3488 |
++ |
3489 |
+ sb = handle->h_transaction->t_journal->j_private; |
3490 |
+ err = handle->h_err; |
3491 |
+ rc = jbd2_journal_stop(handle); |
3492 |
+diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c |
3493 |
+index 16f6365f65e7..ea4ee1732143 100644 |
3494 |
+--- a/fs/ext4/extents.c |
3495 |
++++ b/fs/ext4/extents.c |
3496 |
+@@ -377,7 +377,7 @@ static int ext4_valid_extent(struct inode *inode, struct ext4_extent *ext) |
3497 |
+ ext4_lblk_t lblock = le32_to_cpu(ext->ee_block); |
3498 |
+ ext4_lblk_t last = lblock + len - 1; |
3499 |
+ |
3500 |
+- if (lblock > last) |
3501 |
++ if (len == 0 || lblock > last) |
3502 |
+ return 0; |
3503 |
+ return ext4_data_block_valid(EXT4_SB(inode->i_sb), block, len); |
3504 |
+ } |
3505 |
+diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c |
3506 |
+index 852cc521f327..1f252b4e0f51 100644 |
3507 |
+--- a/fs/ext4/inode.c |
3508 |
++++ b/fs/ext4/inode.c |
3509 |
+@@ -4233,7 +4233,7 @@ static void ext4_update_other_inodes_time(struct super_block *sb, |
3510 |
+ int inode_size = EXT4_INODE_SIZE(sb); |
3511 |
+ |
3512 |
+ oi.orig_ino = orig_ino; |
3513 |
+- ino = orig_ino & ~(inodes_per_block - 1); |
3514 |
++ ino = (orig_ino & ~(inodes_per_block - 1)) + 1; |
3515 |
+ for (i = 0; i < inodes_per_block; i++, ino++, buf += inode_size) { |
3516 |
+ if (ino == orig_ino) |
3517 |
+ continue; |
3518 |
+diff --git a/fs/fhandle.c b/fs/fhandle.c |
3519 |
+index 999ff5c3cab0..d59712dfa3e7 100644 |
3520 |
+--- a/fs/fhandle.c |
3521 |
++++ b/fs/fhandle.c |
3522 |
+@@ -195,8 +195,9 @@ static int handle_to_path(int mountdirfd, struct file_handle __user *ufh, |
3523 |
+ goto out_err; |
3524 |
+ } |
3525 |
+ /* copy the full handle */ |
3526 |
+- if (copy_from_user(handle, ufh, |
3527 |
+- sizeof(struct file_handle) + |
3528 |
++ *handle = f_handle; |
3529 |
++ if (copy_from_user(&handle->f_handle, |
3530 |
++ &ufh->f_handle, |
3531 |
+ f_handle.handle_bytes)) { |
3532 |
+ retval = -EFAULT; |
3533 |
+ goto out_handle; |
3534 |
+diff --git a/fs/fs_pin.c b/fs/fs_pin.c |
3535 |
+index b06c98796afb..611b5408f6ec 100644 |
3536 |
+--- a/fs/fs_pin.c |
3537 |
++++ b/fs/fs_pin.c |
3538 |
+@@ -9,8 +9,8 @@ static DEFINE_SPINLOCK(pin_lock); |
3539 |
+ void pin_remove(struct fs_pin *pin) |
3540 |
+ { |
3541 |
+ spin_lock(&pin_lock); |
3542 |
+- hlist_del(&pin->m_list); |
3543 |
+- hlist_del(&pin->s_list); |
3544 |
++ hlist_del_init(&pin->m_list); |
3545 |
++ hlist_del_init(&pin->s_list); |
3546 |
+ spin_unlock(&pin_lock); |
3547 |
+ spin_lock_irq(&pin->wait.lock); |
3548 |
+ pin->done = 1; |
3549 |
+diff --git a/fs/jbd2/recovery.c b/fs/jbd2/recovery.c |
3550 |
+index b5128c6e63ad..a9079d035ae5 100644 |
3551 |
+--- a/fs/jbd2/recovery.c |
3552 |
++++ b/fs/jbd2/recovery.c |
3553 |
+@@ -842,15 +842,23 @@ static int scan_revoke_records(journal_t *journal, struct buffer_head *bh, |
3554 |
+ { |
3555 |
+ jbd2_journal_revoke_header_t *header; |
3556 |
+ int offset, max; |
3557 |
++ int csum_size = 0; |
3558 |
++ __u32 rcount; |
3559 |
+ int record_len = 4; |
3560 |
+ |
3561 |
+ header = (jbd2_journal_revoke_header_t *) bh->b_data; |
3562 |
+ offset = sizeof(jbd2_journal_revoke_header_t); |
3563 |
+- max = be32_to_cpu(header->r_count); |
3564 |
++ rcount = be32_to_cpu(header->r_count); |
3565 |
+ |
3566 |
+ if (!jbd2_revoke_block_csum_verify(journal, header)) |
3567 |
+ return -EINVAL; |
3568 |
+ |
3569 |
++ if (jbd2_journal_has_csum_v2or3(journal)) |
3570 |
++ csum_size = sizeof(struct jbd2_journal_revoke_tail); |
3571 |
++ if (rcount > journal->j_blocksize - csum_size) |
3572 |
++ return -EINVAL; |
3573 |
++ max = rcount; |
3574 |
++ |
3575 |
+ if (JBD2_HAS_INCOMPAT_FEATURE(journal, JBD2_FEATURE_INCOMPAT_64BIT)) |
3576 |
+ record_len = 8; |
3577 |
+ |
3578 |
+diff --git a/fs/jbd2/revoke.c b/fs/jbd2/revoke.c |
3579 |
+index c6cbaef2bda1..14214da80eb8 100644 |
3580 |
+--- a/fs/jbd2/revoke.c |
3581 |
++++ b/fs/jbd2/revoke.c |
3582 |
+@@ -577,7 +577,7 @@ static void write_one_revoke_record(journal_t *journal, |
3583 |
+ { |
3584 |
+ int csum_size = 0; |
3585 |
+ struct buffer_head *descriptor; |
3586 |
+- int offset; |
3587 |
++ int sz, offset; |
3588 |
+ journal_header_t *header; |
3589 |
+ |
3590 |
+ /* If we are already aborting, this all becomes a noop. We |
3591 |
+@@ -594,9 +594,14 @@ static void write_one_revoke_record(journal_t *journal, |
3592 |
+ if (jbd2_journal_has_csum_v2or3(journal)) |
3593 |
+ csum_size = sizeof(struct jbd2_journal_revoke_tail); |
3594 |
+ |
3595 |
++ if (JBD2_HAS_INCOMPAT_FEATURE(journal, JBD2_FEATURE_INCOMPAT_64BIT)) |
3596 |
++ sz = 8; |
3597 |
++ else |
3598 |
++ sz = 4; |
3599 |
++ |
3600 |
+ /* Make sure we have a descriptor with space left for the record */ |
3601 |
+ if (descriptor) { |
3602 |
+- if (offset >= journal->j_blocksize - csum_size) { |
3603 |
++ if (offset + sz > journal->j_blocksize - csum_size) { |
3604 |
+ flush_descriptor(journal, descriptor, offset, write_op); |
3605 |
+ descriptor = NULL; |
3606 |
+ } |
3607 |
+@@ -619,16 +624,13 @@ static void write_one_revoke_record(journal_t *journal, |
3608 |
+ *descriptorp = descriptor; |
3609 |
+ } |
3610 |
+ |
3611 |
+- if (JBD2_HAS_INCOMPAT_FEATURE(journal, JBD2_FEATURE_INCOMPAT_64BIT)) { |
3612 |
++ if (JBD2_HAS_INCOMPAT_FEATURE(journal, JBD2_FEATURE_INCOMPAT_64BIT)) |
3613 |
+ * ((__be64 *)(&descriptor->b_data[offset])) = |
3614 |
+ cpu_to_be64(record->blocknr); |
3615 |
+- offset += 8; |
3616 |
+- |
3617 |
+- } else { |
3618 |
++ else |
3619 |
+ * ((__be32 *)(&descriptor->b_data[offset])) = |
3620 |
+ cpu_to_be32(record->blocknr); |
3621 |
+- offset += 4; |
3622 |
+- } |
3623 |
++ offset += sz; |
3624 |
+ |
3625 |
+ *offsetp = offset; |
3626 |
+ } |
3627 |
+diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c |
3628 |
+index 5f09370c90a8..ff2f2e6ad311 100644 |
3629 |
+--- a/fs/jbd2/transaction.c |
3630 |
++++ b/fs/jbd2/transaction.c |
3631 |
+@@ -551,7 +551,6 @@ int jbd2_journal_extend(handle_t *handle, int nblocks) |
3632 |
+ int result; |
3633 |
+ int wanted; |
3634 |
+ |
3635 |
+- WARN_ON(!transaction); |
3636 |
+ if (is_handle_aborted(handle)) |
3637 |
+ return -EROFS; |
3638 |
+ journal = transaction->t_journal; |
3639 |
+@@ -627,7 +626,6 @@ int jbd2__journal_restart(handle_t *handle, int nblocks, gfp_t gfp_mask) |
3640 |
+ tid_t tid; |
3641 |
+ int need_to_start, ret; |
3642 |
+ |
3643 |
+- WARN_ON(!transaction); |
3644 |
+ /* If we've had an abort of any type, don't even think about |
3645 |
+ * actually doing the restart! */ |
3646 |
+ if (is_handle_aborted(handle)) |
3647 |
+@@ -785,7 +783,6 @@ do_get_write_access(handle_t *handle, struct journal_head *jh, |
3648 |
+ int need_copy = 0; |
3649 |
+ unsigned long start_lock, time_lock; |
3650 |
+ |
3651 |
+- WARN_ON(!transaction); |
3652 |
+ if (is_handle_aborted(handle)) |
3653 |
+ return -EROFS; |
3654 |
+ journal = transaction->t_journal; |
3655 |
+@@ -1051,7 +1048,6 @@ int jbd2_journal_get_create_access(handle_t *handle, struct buffer_head *bh) |
3656 |
+ int err; |
3657 |
+ |
3658 |
+ jbd_debug(5, "journal_head %p\n", jh); |
3659 |
+- WARN_ON(!transaction); |
3660 |
+ err = -EROFS; |
3661 |
+ if (is_handle_aborted(handle)) |
3662 |
+ goto out; |
3663 |
+@@ -1266,7 +1262,6 @@ int jbd2_journal_dirty_metadata(handle_t *handle, struct buffer_head *bh) |
3664 |
+ struct journal_head *jh; |
3665 |
+ int ret = 0; |
3666 |
+ |
3667 |
+- WARN_ON(!transaction); |
3668 |
+ if (is_handle_aborted(handle)) |
3669 |
+ return -EROFS; |
3670 |
+ journal = transaction->t_journal; |
3671 |
+@@ -1397,7 +1392,6 @@ int jbd2_journal_forget (handle_t *handle, struct buffer_head *bh) |
3672 |
+ int err = 0; |
3673 |
+ int was_modified = 0; |
3674 |
+ |
3675 |
+- WARN_ON(!transaction); |
3676 |
+ if (is_handle_aborted(handle)) |
3677 |
+ return -EROFS; |
3678 |
+ journal = transaction->t_journal; |
3679 |
+@@ -1530,8 +1524,22 @@ int jbd2_journal_stop(handle_t *handle) |
3680 |
+ tid_t tid; |
3681 |
+ pid_t pid; |
3682 |
+ |
3683 |
+- if (!transaction) |
3684 |
+- goto free_and_exit; |
3685 |
++ if (!transaction) { |
3686 |
++ /* |
3687 |
++ * Handle is already detached from the transaction so |
3688 |
++ * there is nothing to do other than decrease a refcount, |
3689 |
++ * or free the handle if refcount drops to zero |
3690 |
++ */ |
3691 |
++ if (--handle->h_ref > 0) { |
3692 |
++ jbd_debug(4, "h_ref %d -> %d\n", handle->h_ref + 1, |
3693 |
++ handle->h_ref); |
3694 |
++ return err; |
3695 |
++ } else { |
3696 |
++ if (handle->h_rsv_handle) |
3697 |
++ jbd2_free_handle(handle->h_rsv_handle); |
3698 |
++ goto free_and_exit; |
3699 |
++ } |
3700 |
++ } |
3701 |
+ journal = transaction->t_journal; |
3702 |
+ |
3703 |
+ J_ASSERT(journal_current_handle() == handle); |
3704 |
+@@ -2373,7 +2381,6 @@ int jbd2_journal_file_inode(handle_t *handle, struct jbd2_inode *jinode) |
3705 |
+ transaction_t *transaction = handle->h_transaction; |
3706 |
+ journal_t *journal; |
3707 |
+ |
3708 |
+- WARN_ON(!transaction); |
3709 |
+ if (is_handle_aborted(handle)) |
3710 |
+ return -EROFS; |
3711 |
+ journal = transaction->t_journal; |
3712 |
+diff --git a/fs/kernfs/dir.c b/fs/kernfs/dir.c |
3713 |
+index 6acc9648f986..345b35fd329d 100644 |
3714 |
+--- a/fs/kernfs/dir.c |
3715 |
++++ b/fs/kernfs/dir.c |
3716 |
+@@ -518,7 +518,14 @@ static struct kernfs_node *__kernfs_new_node(struct kernfs_root *root, |
3717 |
+ if (!kn) |
3718 |
+ goto err_out1; |
3719 |
+ |
3720 |
+- ret = ida_simple_get(&root->ino_ida, 1, 0, GFP_KERNEL); |
3721 |
++ /* |
3722 |
++ * If the ino of the sysfs entry created for a kmem cache gets |
3723 |
++ * allocated from an ida layer, which is accounted to the memcg that |
3724 |
++ * owns the cache, the memcg will get pinned forever. So do not account |
3725 |
++ * ino ida allocations. |
3726 |
++ */ |
3727 |
++ ret = ida_simple_get(&root->ino_ida, 1, 0, |
3728 |
++ GFP_KERNEL | __GFP_NOACCOUNT); |
3729 |
+ if (ret < 0) |
3730 |
+ goto err_out2; |
3731 |
+ kn->ino = ret; |
3732 |
+diff --git a/fs/namespace.c b/fs/namespace.c |
3733 |
+index 38ed1e1bed41..13b0f7bfc096 100644 |
3734 |
+--- a/fs/namespace.c |
3735 |
++++ b/fs/namespace.c |
3736 |
+@@ -1709,8 +1709,11 @@ struct vfsmount *collect_mounts(struct path *path) |
3737 |
+ { |
3738 |
+ struct mount *tree; |
3739 |
+ namespace_lock(); |
3740 |
+- tree = copy_tree(real_mount(path->mnt), path->dentry, |
3741 |
+- CL_COPY_ALL | CL_PRIVATE); |
3742 |
++ if (!check_mnt(real_mount(path->mnt))) |
3743 |
++ tree = ERR_PTR(-EINVAL); |
3744 |
++ else |
3745 |
++ tree = copy_tree(real_mount(path->mnt), path->dentry, |
3746 |
++ CL_COPY_ALL | CL_PRIVATE); |
3747 |
+ namespace_unlock(); |
3748 |
+ if (IS_ERR(tree)) |
3749 |
+ return ERR_CAST(tree); |
3750 |
+diff --git a/fs/nfsd/blocklayout.c b/fs/nfsd/blocklayout.c |
3751 |
+index 03d647bf195d..cdefaa331a07 100644 |
3752 |
+--- a/fs/nfsd/blocklayout.c |
3753 |
++++ b/fs/nfsd/blocklayout.c |
3754 |
+@@ -181,6 +181,17 @@ nfsd4_block_proc_layoutcommit(struct inode *inode, |
3755 |
+ } |
3756 |
+ |
3757 |
+ const struct nfsd4_layout_ops bl_layout_ops = { |
3758 |
++ /* |
3759 |
++ * Pretend that we send notification to the client. This is a blatant |
3760 |
++ * lie to force recent Linux clients to cache our device IDs. |
3761 |
++ * We rarely ever change the device ID, so the harm of leaking deviceids |
3762 |
++ * for a while isn't too bad. Unfortunately RFC5661 is a complete mess |
3763 |
++ * in this regard, but I filed errata 4119 for this a while ago, and |
3764 |
++ * hopefully the Linux client will eventually start caching deviceids |
3765 |
++ * without this again. |
3766 |
++ */ |
3767 |
++ .notify_types = |
3768 |
++ NOTIFY_DEVICEID4_DELETE | NOTIFY_DEVICEID4_CHANGE, |
3769 |
+ .proc_getdeviceinfo = nfsd4_block_proc_getdeviceinfo, |
3770 |
+ .encode_getdeviceinfo = nfsd4_block_encode_getdeviceinfo, |
3771 |
+ .proc_layoutget = nfsd4_block_proc_layoutget, |
3772 |
+diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c |
3773 |
+index ee1cccdb083a..b4541ede7cb8 100644 |
3774 |
+--- a/fs/nfsd/nfs4state.c |
3775 |
++++ b/fs/nfsd/nfs4state.c |
3776 |
+@@ -4386,10 +4386,17 @@ static __be32 check_stateid_generation(stateid_t *in, stateid_t *ref, bool has_s |
3777 |
+ return nfserr_old_stateid; |
3778 |
+ } |
3779 |
+ |
3780 |
++static __be32 nfsd4_check_openowner_confirmed(struct nfs4_ol_stateid *ols) |
3781 |
++{ |
3782 |
++ if (ols->st_stateowner->so_is_open_owner && |
3783 |
++ !(openowner(ols->st_stateowner)->oo_flags & NFS4_OO_CONFIRMED)) |
3784 |
++ return nfserr_bad_stateid; |
3785 |
++ return nfs_ok; |
3786 |
++} |
3787 |
++ |
3788 |
+ static __be32 nfsd4_validate_stateid(struct nfs4_client *cl, stateid_t *stateid) |
3789 |
+ { |
3790 |
+ struct nfs4_stid *s; |
3791 |
+- struct nfs4_ol_stateid *ols; |
3792 |
+ __be32 status = nfserr_bad_stateid; |
3793 |
+ |
3794 |
+ if (ZERO_STATEID(stateid) || ONE_STATEID(stateid)) |
3795 |
+@@ -4419,13 +4426,7 @@ static __be32 nfsd4_validate_stateid(struct nfs4_client *cl, stateid_t *stateid) |
3796 |
+ break; |
3797 |
+ case NFS4_OPEN_STID: |
3798 |
+ case NFS4_LOCK_STID: |
3799 |
+- ols = openlockstateid(s); |
3800 |
+- if (ols->st_stateowner->so_is_open_owner |
3801 |
+- && !(openowner(ols->st_stateowner)->oo_flags |
3802 |
+- & NFS4_OO_CONFIRMED)) |
3803 |
+- status = nfserr_bad_stateid; |
3804 |
+- else |
3805 |
+- status = nfs_ok; |
3806 |
++ status = nfsd4_check_openowner_confirmed(openlockstateid(s)); |
3807 |
+ break; |
3808 |
+ default: |
3809 |
+ printk("unknown stateid type %x\n", s->sc_type); |
3810 |
+@@ -4517,8 +4518,8 @@ nfs4_preprocess_stateid_op(struct net *net, struct nfsd4_compound_state *cstate, |
3811 |
+ status = nfs4_check_fh(current_fh, stp); |
3812 |
+ if (status) |
3813 |
+ goto out; |
3814 |
+- if (stp->st_stateowner->so_is_open_owner |
3815 |
+- && !(openowner(stp->st_stateowner)->oo_flags & NFS4_OO_CONFIRMED)) |
3816 |
++ status = nfsd4_check_openowner_confirmed(stp); |
3817 |
++ if (status) |
3818 |
+ goto out; |
3819 |
+ status = nfs4_check_openmode(stp, flags); |
3820 |
+ if (status) |
3821 |
+diff --git a/fs/omfs/inode.c b/fs/omfs/inode.c |
3822 |
+index 138321b0c6c2..454111a3308e 100644 |
3823 |
+--- a/fs/omfs/inode.c |
3824 |
++++ b/fs/omfs/inode.c |
3825 |
+@@ -306,7 +306,8 @@ static const struct super_operations omfs_sops = { |
3826 |
+ */ |
3827 |
+ static int omfs_get_imap(struct super_block *sb) |
3828 |
+ { |
3829 |
+- unsigned int bitmap_size, count, array_size; |
3830 |
++ unsigned int bitmap_size, array_size; |
3831 |
++ int count; |
3832 |
+ struct omfs_sb_info *sbi = OMFS_SB(sb); |
3833 |
+ struct buffer_head *bh; |
3834 |
+ unsigned long **ptr; |
3835 |
+@@ -359,7 +360,7 @@ nomem: |
3836 |
+ } |
3837 |
+ |
3838 |
+ enum { |
3839 |
+- Opt_uid, Opt_gid, Opt_umask, Opt_dmask, Opt_fmask |
3840 |
++ Opt_uid, Opt_gid, Opt_umask, Opt_dmask, Opt_fmask, Opt_err |
3841 |
+ }; |
3842 |
+ |
3843 |
+ static const match_table_t tokens = { |
3844 |
+@@ -368,6 +369,7 @@ static const match_table_t tokens = { |
3845 |
+ {Opt_umask, "umask=%o"}, |
3846 |
+ {Opt_dmask, "dmask=%o"}, |
3847 |
+ {Opt_fmask, "fmask=%o"}, |
3848 |
++ {Opt_err, NULL}, |
3849 |
+ }; |
3850 |
+ |
3851 |
+ static int parse_options(char *options, struct omfs_sb_info *sbi) |
3852 |
+diff --git a/fs/overlayfs/copy_up.c b/fs/overlayfs/copy_up.c |
3853 |
+index 24f640441bd9..84d693d37428 100644 |
3854 |
+--- a/fs/overlayfs/copy_up.c |
3855 |
++++ b/fs/overlayfs/copy_up.c |
3856 |
+@@ -299,6 +299,9 @@ int ovl_copy_up_one(struct dentry *parent, struct dentry *dentry, |
3857 |
+ struct cred *override_cred; |
3858 |
+ char *link = NULL; |
3859 |
+ |
3860 |
++ if (WARN_ON(!workdir)) |
3861 |
++ return -EROFS; |
3862 |
++ |
3863 |
+ ovl_path_upper(parent, &parentpath); |
3864 |
+ upperdir = parentpath.dentry; |
3865 |
+ |
3866 |
+diff --git a/fs/overlayfs/dir.c b/fs/overlayfs/dir.c |
3867 |
+index d139405d2bfa..692ceda3bc21 100644 |
3868 |
+--- a/fs/overlayfs/dir.c |
3869 |
++++ b/fs/overlayfs/dir.c |
3870 |
+@@ -222,6 +222,9 @@ static struct dentry *ovl_clear_empty(struct dentry *dentry, |
3871 |
+ struct kstat stat; |
3872 |
+ int err; |
3873 |
+ |
3874 |
++ if (WARN_ON(!workdir)) |
3875 |
++ return ERR_PTR(-EROFS); |
3876 |
++ |
3877 |
+ err = ovl_lock_rename_workdir(workdir, upperdir); |
3878 |
+ if (err) |
3879 |
+ goto out; |
3880 |
+@@ -322,6 +325,9 @@ static int ovl_create_over_whiteout(struct dentry *dentry, struct inode *inode, |
3881 |
+ struct dentry *newdentry; |
3882 |
+ int err; |
3883 |
+ |
3884 |
++ if (WARN_ON(!workdir)) |
3885 |
++ return -EROFS; |
3886 |
++ |
3887 |
+ err = ovl_lock_rename_workdir(workdir, upperdir); |
3888 |
+ if (err) |
3889 |
+ goto out; |
3890 |
+@@ -506,11 +512,28 @@ static int ovl_remove_and_whiteout(struct dentry *dentry, bool is_dir) |
3891 |
+ struct dentry *opaquedir = NULL; |
3892 |
+ int err; |
3893 |
+ |
3894 |
+- if (is_dir && OVL_TYPE_MERGE_OR_LOWER(ovl_path_type(dentry))) { |
3895 |
+- opaquedir = ovl_check_empty_and_clear(dentry); |
3896 |
+- err = PTR_ERR(opaquedir); |
3897 |
+- if (IS_ERR(opaquedir)) |
3898 |
+- goto out; |
3899 |
++ if (WARN_ON(!workdir)) |
3900 |
++ return -EROFS; |
3901 |
++ |
3902 |
++ if (is_dir) { |
3903 |
++ if (OVL_TYPE_MERGE_OR_LOWER(ovl_path_type(dentry))) { |
3904 |
++ opaquedir = ovl_check_empty_and_clear(dentry); |
3905 |
++ err = PTR_ERR(opaquedir); |
3906 |
++ if (IS_ERR(opaquedir)) |
3907 |
++ goto out; |
3908 |
++ } else { |
3909 |
++ LIST_HEAD(list); |
3910 |
++ |
3911 |
++ /* |
3912 |
++ * When removing an empty opaque directory, then it |
3913 |
++ * makes no sense to replace it with an exact replica of |
3914 |
++ * itself. But emptiness still needs to be checked. |
3915 |
++ */ |
3916 |
++ err = ovl_check_empty_dir(dentry, &list); |
3917 |
++ ovl_cache_free(&list); |
3918 |
++ if (err) |
3919 |
++ goto out; |
3920 |
++ } |
3921 |
+ } |
3922 |
+ |
3923 |
+ err = ovl_lock_rename_workdir(workdir, upperdir); |
3924 |
+diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c |
3925 |
+index 5f0d1993e6e3..bf8537c7f455 100644 |
3926 |
+--- a/fs/overlayfs/super.c |
3927 |
++++ b/fs/overlayfs/super.c |
3928 |
+@@ -529,7 +529,7 @@ static int ovl_remount(struct super_block *sb, int *flags, char *data) |
3929 |
+ { |
3930 |
+ struct ovl_fs *ufs = sb->s_fs_info; |
3931 |
+ |
3932 |
+- if (!(*flags & MS_RDONLY) && !ufs->upper_mnt) |
3933 |
++ if (!(*flags & MS_RDONLY) && (!ufs->upper_mnt || !ufs->workdir)) |
3934 |
+ return -EROFS; |
3935 |
+ |
3936 |
+ return 0; |
3937 |
+@@ -925,9 +925,10 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent) |
3938 |
+ ufs->workdir = ovl_workdir_create(ufs->upper_mnt, workpath.dentry); |
3939 |
+ err = PTR_ERR(ufs->workdir); |
3940 |
+ if (IS_ERR(ufs->workdir)) { |
3941 |
+- pr_err("overlayfs: failed to create directory %s/%s\n", |
3942 |
+- ufs->config.workdir, OVL_WORKDIR_NAME); |
3943 |
+- goto out_put_upper_mnt; |
3944 |
++ pr_warn("overlayfs: failed to create directory %s/%s (errno: %i); mounting read-only\n", |
3945 |
++ ufs->config.workdir, OVL_WORKDIR_NAME, -err); |
3946 |
++ sb->s_flags |= MS_RDONLY; |
3947 |
++ ufs->workdir = NULL; |
3948 |
+ } |
3949 |
+ } |
3950 |
+ |
3951 |
+@@ -997,7 +998,6 @@ out_put_lower_mnt: |
3952 |
+ kfree(ufs->lower_mnt); |
3953 |
+ out_put_workdir: |
3954 |
+ dput(ufs->workdir); |
3955 |
+-out_put_upper_mnt: |
3956 |
+ mntput(ufs->upper_mnt); |
3957 |
+ out_put_lowerpath: |
3958 |
+ for (i = 0; i < numlower; i++) |
3959 |
+diff --git a/fs/xfs/libxfs/xfs_attr_leaf.c b/fs/xfs/libxfs/xfs_attr_leaf.c |
3960 |
+index 15105dbc9e28..0166e7e829a7 100644 |
3961 |
+--- a/fs/xfs/libxfs/xfs_attr_leaf.c |
3962 |
++++ b/fs/xfs/libxfs/xfs_attr_leaf.c |
3963 |
+@@ -498,8 +498,8 @@ xfs_attr_shortform_add(xfs_da_args_t *args, int forkoff) |
3964 |
+ * After the last attribute is removed revert to original inode format, |
3965 |
+ * making all literal area available to the data fork once more. |
3966 |
+ */ |
3967 |
+-STATIC void |
3968 |
+-xfs_attr_fork_reset( |
3969 |
++void |
3970 |
++xfs_attr_fork_remove( |
3971 |
+ struct xfs_inode *ip, |
3972 |
+ struct xfs_trans *tp) |
3973 |
+ { |
3974 |
+@@ -565,7 +565,7 @@ xfs_attr_shortform_remove(xfs_da_args_t *args) |
3975 |
+ (mp->m_flags & XFS_MOUNT_ATTR2) && |
3976 |
+ (dp->i_d.di_format != XFS_DINODE_FMT_BTREE) && |
3977 |
+ !(args->op_flags & XFS_DA_OP_ADDNAME)) { |
3978 |
+- xfs_attr_fork_reset(dp, args->trans); |
3979 |
++ xfs_attr_fork_remove(dp, args->trans); |
3980 |
+ } else { |
3981 |
+ xfs_idata_realloc(dp, -size, XFS_ATTR_FORK); |
3982 |
+ dp->i_d.di_forkoff = xfs_attr_shortform_bytesfit(dp, totsize); |
3983 |
+@@ -828,7 +828,7 @@ xfs_attr3_leaf_to_shortform( |
3984 |
+ if (forkoff == -1) { |
3985 |
+ ASSERT(dp->i_mount->m_flags & XFS_MOUNT_ATTR2); |
3986 |
+ ASSERT(dp->i_d.di_format != XFS_DINODE_FMT_BTREE); |
3987 |
+- xfs_attr_fork_reset(dp, args->trans); |
3988 |
++ xfs_attr_fork_remove(dp, args->trans); |
3989 |
+ goto out; |
3990 |
+ } |
3991 |
+ |
3992 |
+diff --git a/fs/xfs/libxfs/xfs_attr_leaf.h b/fs/xfs/libxfs/xfs_attr_leaf.h |
3993 |
+index e2929da7c3ba..4f3a60aa93d4 100644 |
3994 |
+--- a/fs/xfs/libxfs/xfs_attr_leaf.h |
3995 |
++++ b/fs/xfs/libxfs/xfs_attr_leaf.h |
3996 |
+@@ -53,7 +53,7 @@ int xfs_attr_shortform_remove(struct xfs_da_args *args); |
3997 |
+ int xfs_attr_shortform_list(struct xfs_attr_list_context *context); |
3998 |
+ int xfs_attr_shortform_allfit(struct xfs_buf *bp, struct xfs_inode *dp); |
3999 |
+ int xfs_attr_shortform_bytesfit(xfs_inode_t *dp, int bytes); |
4000 |
+- |
4001 |
++void xfs_attr_fork_remove(struct xfs_inode *ip, struct xfs_trans *tp); |
4002 |
+ |
4003 |
+ /* |
4004 |
+ * Internal routines when attribute fork size == XFS_LBSIZE(mp). |
4005 |
+diff --git a/fs/xfs/xfs_attr_inactive.c b/fs/xfs/xfs_attr_inactive.c |
4006 |
+index 83af4c149635..487c8374a1e0 100644 |
4007 |
+--- a/fs/xfs/xfs_attr_inactive.c |
4008 |
++++ b/fs/xfs/xfs_attr_inactive.c |
4009 |
+@@ -379,23 +379,31 @@ xfs_attr3_root_inactive( |
4010 |
+ return error; |
4011 |
+ } |
4012 |
+ |
4013 |
++/* |
4014 |
++ * xfs_attr_inactive kills all traces of an attribute fork on an inode. It |
4015 |
++ * removes both the on-disk and in-memory inode fork. Note that this also has to |
4016 |
++ * handle the condition of inodes without attributes but with an attribute fork |
4017 |
++ * configured, so we can't use xfs_inode_hasattr() here. |
4018 |
++ * |
4019 |
++ * The in-memory attribute fork is removed even on error. |
4020 |
++ */ |
4021 |
+ int |
4022 |
+-xfs_attr_inactive(xfs_inode_t *dp) |
4023 |
++xfs_attr_inactive( |
4024 |
++ struct xfs_inode *dp) |
4025 |
+ { |
4026 |
+- xfs_trans_t *trans; |
4027 |
+- xfs_mount_t *mp; |
4028 |
+- int error; |
4029 |
++ struct xfs_trans *trans; |
4030 |
++ struct xfs_mount *mp; |
4031 |
++ int cancel_flags = 0; |
4032 |
++ int lock_mode = XFS_ILOCK_SHARED; |
4033 |
++ int error = 0; |
4034 |
+ |
4035 |
+ mp = dp->i_mount; |
4036 |
+ ASSERT(! XFS_NOT_DQATTACHED(mp, dp)); |
4037 |
+ |
4038 |
+- xfs_ilock(dp, XFS_ILOCK_SHARED); |
4039 |
+- if (!xfs_inode_hasattr(dp) || |
4040 |
+- dp->i_d.di_aformat == XFS_DINODE_FMT_LOCAL) { |
4041 |
+- xfs_iunlock(dp, XFS_ILOCK_SHARED); |
4042 |
+- return 0; |
4043 |
+- } |
4044 |
+- xfs_iunlock(dp, XFS_ILOCK_SHARED); |
4045 |
++ xfs_ilock(dp, lock_mode); |
4046 |
++ if (!XFS_IFORK_Q(dp)) |
4047 |
++ goto out_destroy_fork; |
4048 |
++ xfs_iunlock(dp, lock_mode); |
4049 |
+ |
4050 |
+ /* |
4051 |
+ * Start our first transaction of the day. |
4052 |
+@@ -407,13 +415,18 @@ xfs_attr_inactive(xfs_inode_t *dp) |
4053 |
+ * the inode in every transaction to let it float upward through |
4054 |
+ * the log. |
4055 |
+ */ |
4056 |
++ lock_mode = 0; |
4057 |
+ trans = xfs_trans_alloc(mp, XFS_TRANS_ATTRINVAL); |
4058 |
+ error = xfs_trans_reserve(trans, &M_RES(mp)->tr_attrinval, 0, 0); |
4059 |
+- if (error) { |
4060 |
+- xfs_trans_cancel(trans, 0); |
4061 |
+- return error; |
4062 |
+- } |
4063 |
+- xfs_ilock(dp, XFS_ILOCK_EXCL); |
4064 |
++ if (error) |
4065 |
++ goto out_cancel; |
4066 |
++ |
4067 |
++ lock_mode = XFS_ILOCK_EXCL; |
4068 |
++ cancel_flags = XFS_TRANS_RELEASE_LOG_RES | XFS_TRANS_ABORT; |
4069 |
++ xfs_ilock(dp, lock_mode); |
4070 |
++ |
4071 |
++ if (!XFS_IFORK_Q(dp)) |
4072 |
++ goto out_cancel; |
4073 |
+ |
4074 |
+ /* |
4075 |
+ * No need to make quota reservations here. We expect to release some |
4076 |
+@@ -421,29 +434,31 @@ xfs_attr_inactive(xfs_inode_t *dp) |
4077 |
+ */ |
4078 |
+ xfs_trans_ijoin(trans, dp, 0); |
4079 |
+ |
4080 |
+- /* |
4081 |
+- * Decide on what work routines to call based on the inode size. |
4082 |
+- */ |
4083 |
+- if (!xfs_inode_hasattr(dp) || |
4084 |
+- dp->i_d.di_aformat == XFS_DINODE_FMT_LOCAL) { |
4085 |
+- error = 0; |
4086 |
+- goto out; |
4087 |
++ /* invalidate and truncate the attribute fork extents */ |
4088 |
++ if (dp->i_d.di_aformat != XFS_DINODE_FMT_LOCAL) { |
4089 |
++ error = xfs_attr3_root_inactive(&trans, dp); |
4090 |
++ if (error) |
4091 |
++ goto out_cancel; |
4092 |
++ |
4093 |
++ error = xfs_itruncate_extents(&trans, dp, XFS_ATTR_FORK, 0); |
4094 |
++ if (error) |
4095 |
++ goto out_cancel; |
4096 |
+ } |
4097 |
+- error = xfs_attr3_root_inactive(&trans, dp); |
4098 |
+- if (error) |
4099 |
+- goto out; |
4100 |
+ |
4101 |
+- error = xfs_itruncate_extents(&trans, dp, XFS_ATTR_FORK, 0); |
4102 |
+- if (error) |
4103 |
+- goto out; |
4104 |
++ /* Reset the attribute fork - this also destroys the in-core fork */ |
4105 |
++ xfs_attr_fork_remove(dp, trans); |
4106 |
+ |
4107 |
+ error = xfs_trans_commit(trans, XFS_TRANS_RELEASE_LOG_RES); |
4108 |
+- xfs_iunlock(dp, XFS_ILOCK_EXCL); |
4109 |
+- |
4110 |
++ xfs_iunlock(dp, lock_mode); |
4111 |
+ return error; |
4112 |
+ |
4113 |
+-out: |
4114 |
+- xfs_trans_cancel(trans, XFS_TRANS_RELEASE_LOG_RES|XFS_TRANS_ABORT); |
4115 |
+- xfs_iunlock(dp, XFS_ILOCK_EXCL); |
4116 |
++out_cancel: |
4117 |
++ xfs_trans_cancel(trans, cancel_flags); |
4118 |
++out_destroy_fork: |
4119 |
++ /* kill the in-core attr fork before we drop the inode lock */ |
4120 |
++ if (dp->i_afp) |
4121 |
++ xfs_idestroy_fork(dp, XFS_ATTR_FORK); |
4122 |
++ if (lock_mode) |
4123 |
++ xfs_iunlock(dp, lock_mode); |
4124 |
+ return error; |
4125 |
+ } |
4126 |
+diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c |
4127 |
+index a2e1cb8a568b..f3ba637a8ece 100644 |
4128 |
+--- a/fs/xfs/xfs_file.c |
4129 |
++++ b/fs/xfs/xfs_file.c |
4130 |
+@@ -125,7 +125,7 @@ xfs_iozero( |
4131 |
+ status = 0; |
4132 |
+ } while (count); |
4133 |
+ |
4134 |
+- return (-status); |
4135 |
++ return status; |
4136 |
+ } |
4137 |
+ |
4138 |
+ int |
4139 |
+diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c |
4140 |
+index 6163767aa856..b1edda7890f4 100644 |
4141 |
+--- a/fs/xfs/xfs_inode.c |
4142 |
++++ b/fs/xfs/xfs_inode.c |
4143 |
+@@ -1889,21 +1889,17 @@ xfs_inactive( |
4144 |
+ /* |
4145 |
+ * If there are attributes associated with the file then blow them away |
4146 |
+ * now. The code calls a routine that recursively deconstructs the |
4147 |
+- * attribute fork. We need to just commit the current transaction |
4148 |
+- * because we can't use it for xfs_attr_inactive(). |
4149 |
++ * attribute fork. If also blows away the in-core attribute fork. |
4150 |
+ */ |
4151 |
+- if (ip->i_d.di_anextents > 0) { |
4152 |
+- ASSERT(ip->i_d.di_forkoff != 0); |
4153 |
+- |
4154 |
++ if (XFS_IFORK_Q(ip)) { |
4155 |
+ error = xfs_attr_inactive(ip); |
4156 |
+ if (error) |
4157 |
+ return; |
4158 |
+ } |
4159 |
+ |
4160 |
+- if (ip->i_afp) |
4161 |
+- xfs_idestroy_fork(ip, XFS_ATTR_FORK); |
4162 |
+- |
4163 |
++ ASSERT(!ip->i_afp); |
4164 |
+ ASSERT(ip->i_d.di_anextents == 0); |
4165 |
++ ASSERT(ip->i_d.di_forkoff == 0); |
4166 |
+ |
4167 |
+ /* |
4168 |
+ * Free the inode. |
4169 |
+diff --git a/include/drm/drm_pciids.h b/include/drm/drm_pciids.h |
4170 |
+index 2dd405c9be78..45c39a37f924 100644 |
4171 |
+--- a/include/drm/drm_pciids.h |
4172 |
++++ b/include/drm/drm_pciids.h |
4173 |
+@@ -186,6 +186,7 @@ |
4174 |
+ {0x1002, 0x6658, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE|RADEON_NEW_MEMMAP}, \ |
4175 |
+ {0x1002, 0x665c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE|RADEON_NEW_MEMMAP}, \ |
4176 |
+ {0x1002, 0x665d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE|RADEON_NEW_MEMMAP}, \ |
4177 |
++ {0x1002, 0x665f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE|RADEON_NEW_MEMMAP}, \ |
4178 |
+ {0x1002, 0x6660, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_HAINAN|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ |
4179 |
+ {0x1002, 0x6663, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_HAINAN|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ |
4180 |
+ {0x1002, 0x6664, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_HAINAN|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ |
4181 |
+diff --git a/include/linux/fs_pin.h b/include/linux/fs_pin.h |
4182 |
+index 9dc4e0384bfb..3886b3bffd7f 100644 |
4183 |
+--- a/include/linux/fs_pin.h |
4184 |
++++ b/include/linux/fs_pin.h |
4185 |
+@@ -13,6 +13,8 @@ struct vfsmount; |
4186 |
+ static inline void init_fs_pin(struct fs_pin *p, void (*kill)(struct fs_pin *)) |
4187 |
+ { |
4188 |
+ init_waitqueue_head(&p->wait); |
4189 |
++ INIT_HLIST_NODE(&p->s_list); |
4190 |
++ INIT_HLIST_NODE(&p->m_list); |
4191 |
+ p->kill = kill; |
4192 |
+ } |
4193 |
+ |
4194 |
+diff --git a/include/linux/gfp.h b/include/linux/gfp.h |
4195 |
+index 51bd1e72a917..eb6fafe66bec 100644 |
4196 |
+--- a/include/linux/gfp.h |
4197 |
++++ b/include/linux/gfp.h |
4198 |
+@@ -30,6 +30,7 @@ struct vm_area_struct; |
4199 |
+ #define ___GFP_HARDWALL 0x20000u |
4200 |
+ #define ___GFP_THISNODE 0x40000u |
4201 |
+ #define ___GFP_RECLAIMABLE 0x80000u |
4202 |
++#define ___GFP_NOACCOUNT 0x100000u |
4203 |
+ #define ___GFP_NOTRACK 0x200000u |
4204 |
+ #define ___GFP_NO_KSWAPD 0x400000u |
4205 |
+ #define ___GFP_OTHER_NODE 0x800000u |
4206 |
+@@ -85,6 +86,7 @@ struct vm_area_struct; |
4207 |
+ #define __GFP_HARDWALL ((__force gfp_t)___GFP_HARDWALL) /* Enforce hardwall cpuset memory allocs */ |
4208 |
+ #define __GFP_THISNODE ((__force gfp_t)___GFP_THISNODE)/* No fallback, no policies */ |
4209 |
+ #define __GFP_RECLAIMABLE ((__force gfp_t)___GFP_RECLAIMABLE) /* Page is reclaimable */ |
4210 |
++#define __GFP_NOACCOUNT ((__force gfp_t)___GFP_NOACCOUNT) /* Don't account to kmemcg */ |
4211 |
+ #define __GFP_NOTRACK ((__force gfp_t)___GFP_NOTRACK) /* Don't track with kmemcheck */ |
4212 |
+ |
4213 |
+ #define __GFP_NO_KSWAPD ((__force gfp_t)___GFP_NO_KSWAPD) |
4214 |
+diff --git a/include/linux/ktime.h b/include/linux/ktime.h |
4215 |
+index 5fc3d1083071..2b6a204bd8d4 100644 |
4216 |
+--- a/include/linux/ktime.h |
4217 |
++++ b/include/linux/ktime.h |
4218 |
+@@ -166,19 +166,34 @@ static inline bool ktime_before(const ktime_t cmp1, const ktime_t cmp2) |
4219 |
+ } |
4220 |
+ |
4221 |
+ #if BITS_PER_LONG < 64 |
4222 |
+-extern u64 __ktime_divns(const ktime_t kt, s64 div); |
4223 |
+-static inline u64 ktime_divns(const ktime_t kt, s64 div) |
4224 |
++extern s64 __ktime_divns(const ktime_t kt, s64 div); |
4225 |
++static inline s64 ktime_divns(const ktime_t kt, s64 div) |
4226 |
+ { |
4227 |
++ /* |
4228 |
++ * Negative divisors could cause an inf loop, |
4229 |
++ * so bug out here. |
4230 |
++ */ |
4231 |
++ BUG_ON(div < 0); |
4232 |
+ if (__builtin_constant_p(div) && !(div >> 32)) { |
4233 |
+- u64 ns = kt.tv64; |
4234 |
+- do_div(ns, div); |
4235 |
+- return ns; |
4236 |
++ s64 ns = kt.tv64; |
4237 |
++ u64 tmp = ns < 0 ? -ns : ns; |
4238 |
++ |
4239 |
++ do_div(tmp, div); |
4240 |
++ return ns < 0 ? -tmp : tmp; |
4241 |
+ } else { |
4242 |
+ return __ktime_divns(kt, div); |
4243 |
+ } |
4244 |
+ } |
4245 |
+ #else /* BITS_PER_LONG < 64 */ |
4246 |
+-# define ktime_divns(kt, div) (u64)((kt).tv64 / (div)) |
4247 |
++static inline s64 ktime_divns(const ktime_t kt, s64 div) |
4248 |
++{ |
4249 |
++ /* |
4250 |
++ * 32-bit implementation cannot handle negative divisors, |
4251 |
++ * so catch them on 64bit as well. |
4252 |
++ */ |
4253 |
++ WARN_ON(div < 0); |
4254 |
++ return kt.tv64 / div; |
4255 |
++} |
4256 |
+ #endif |
4257 |
+ |
4258 |
+ static inline s64 ktime_to_us(const ktime_t kt) |
4259 |
+diff --git a/include/linux/libata.h b/include/linux/libata.h |
4260 |
+index 6b08cc106c21..f8994b4b122c 100644 |
4261 |
+--- a/include/linux/libata.h |
4262 |
++++ b/include/linux/libata.h |
4263 |
+@@ -205,6 +205,7 @@ enum { |
4264 |
+ ATA_LFLAG_SW_ACTIVITY = (1 << 7), /* keep activity stats */ |
4265 |
+ ATA_LFLAG_NO_LPM = (1 << 8), /* disable LPM on this link */ |
4266 |
+ ATA_LFLAG_RST_ONCE = (1 << 9), /* limit recovery to one reset */ |
4267 |
++ ATA_LFLAG_CHANGED = (1 << 10), /* LPM state changed on this link */ |
4268 |
+ |
4269 |
+ /* struct ata_port flags */ |
4270 |
+ ATA_FLAG_SLAVE_POSS = (1 << 0), /* host supports slave dev */ |
4271 |
+@@ -310,6 +311,12 @@ enum { |
4272 |
+ */ |
4273 |
+ ATA_TMOUT_PMP_SRST_WAIT = 5000, |
4274 |
+ |
4275 |
++ /* When the LPM policy is set to ATA_LPM_MAX_POWER, there might |
4276 |
++ * be a spurious PHY event, so ignore the first PHY event that |
4277 |
++ * occurs within 10s after the policy change. |
4278 |
++ */ |
4279 |
++ ATA_TMOUT_SPURIOUS_PHY = 10000, |
4280 |
++ |
4281 |
+ /* ATA bus states */ |
4282 |
+ BUS_UNKNOWN = 0, |
4283 |
+ BUS_DMA = 1, |
4284 |
+@@ -789,6 +796,8 @@ struct ata_link { |
4285 |
+ struct ata_eh_context eh_context; |
4286 |
+ |
4287 |
+ struct ata_device device[ATA_MAX_DEVICES]; |
4288 |
++ |
4289 |
++ unsigned long last_lpm_change; /* when last LPM change happened */ |
4290 |
+ }; |
4291 |
+ #define ATA_LINK_CLEAR_BEGIN offsetof(struct ata_link, active_tag) |
4292 |
+ #define ATA_LINK_CLEAR_END offsetof(struct ata_link, device[0]) |
4293 |
+@@ -1202,6 +1211,7 @@ extern struct ata_device *ata_dev_pair(struct ata_device *adev); |
4294 |
+ extern int ata_do_set_mode(struct ata_link *link, struct ata_device **r_failed_dev); |
4295 |
+ extern void ata_scsi_port_error_handler(struct Scsi_Host *host, struct ata_port *ap); |
4296 |
+ extern void ata_scsi_cmd_error_handler(struct Scsi_Host *host, struct ata_port *ap, struct list_head *eh_q); |
4297 |
++extern bool sata_lpm_ignore_phy_events(struct ata_link *link); |
4298 |
+ |
4299 |
+ extern int ata_cable_40wire(struct ata_port *ap); |
4300 |
+ extern int ata_cable_80wire(struct ata_port *ap); |
4301 |
+diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h |
4302 |
+index 72dff5fb0d0c..6c8918114804 100644 |
4303 |
+--- a/include/linux/memcontrol.h |
4304 |
++++ b/include/linux/memcontrol.h |
4305 |
+@@ -463,6 +463,8 @@ memcg_kmem_newpage_charge(gfp_t gfp, struct mem_cgroup **memcg, int order) |
4306 |
+ if (!memcg_kmem_enabled()) |
4307 |
+ return true; |
4308 |
+ |
4309 |
++ if (gfp & __GFP_NOACCOUNT) |
4310 |
++ return true; |
4311 |
+ /* |
4312 |
+ * __GFP_NOFAIL allocations will move on even if charging is not |
4313 |
+ * possible. Therefore we don't even try, and have this allocation |
4314 |
+@@ -522,6 +524,8 @@ memcg_kmem_get_cache(struct kmem_cache *cachep, gfp_t gfp) |
4315 |
+ { |
4316 |
+ if (!memcg_kmem_enabled()) |
4317 |
+ return cachep; |
4318 |
++ if (gfp & __GFP_NOACCOUNT) |
4319 |
++ return cachep; |
4320 |
+ if (gfp & __GFP_NOFAIL) |
4321 |
+ return cachep; |
4322 |
+ if (in_interrupt() || (!current->mm) || (current->flags & PF_KTHREAD)) |
4323 |
+diff --git a/include/linux/sched/rt.h b/include/linux/sched/rt.h |
4324 |
+index 6341f5be6e24..a30b172df6e1 100644 |
4325 |
+--- a/include/linux/sched/rt.h |
4326 |
++++ b/include/linux/sched/rt.h |
4327 |
+@@ -18,7 +18,7 @@ static inline int rt_task(struct task_struct *p) |
4328 |
+ #ifdef CONFIG_RT_MUTEXES |
4329 |
+ extern int rt_mutex_getprio(struct task_struct *p); |
4330 |
+ extern void rt_mutex_setprio(struct task_struct *p, int prio); |
4331 |
+-extern int rt_mutex_check_prio(struct task_struct *task, int newprio); |
4332 |
++extern int rt_mutex_get_effective_prio(struct task_struct *task, int newprio); |
4333 |
+ extern struct task_struct *rt_mutex_get_top_task(struct task_struct *task); |
4334 |
+ extern void rt_mutex_adjust_pi(struct task_struct *p); |
4335 |
+ static inline bool tsk_is_pi_blocked(struct task_struct *tsk) |
4336 |
+@@ -31,9 +31,10 @@ static inline int rt_mutex_getprio(struct task_struct *p) |
4337 |
+ return p->normal_prio; |
4338 |
+ } |
4339 |
+ |
4340 |
+-static inline int rt_mutex_check_prio(struct task_struct *task, int newprio) |
4341 |
++static inline int rt_mutex_get_effective_prio(struct task_struct *task, |
4342 |
++ int newprio) |
4343 |
+ { |
4344 |
+- return 0; |
4345 |
++ return newprio; |
4346 |
+ } |
4347 |
+ |
4348 |
+ static inline struct task_struct *rt_mutex_get_top_task(struct task_struct *task) |
4349 |
+diff --git a/include/linux/tty.h b/include/linux/tty.h |
4350 |
+index 358a337af598..790752ac074a 100644 |
4351 |
+--- a/include/linux/tty.h |
4352 |
++++ b/include/linux/tty.h |
4353 |
+@@ -339,6 +339,7 @@ struct tty_file_private { |
4354 |
+ #define TTY_EXCLUSIVE 3 /* Exclusive open mode */ |
4355 |
+ #define TTY_DEBUG 4 /* Debugging */ |
4356 |
+ #define TTY_DO_WRITE_WAKEUP 5 /* Call write_wakeup after queuing new */ |
4357 |
++#define TTY_OTHER_DONE 6 /* Closed pty has completed input processing */ |
4358 |
+ #define TTY_LDISC_OPEN 11 /* Line discipline is open */ |
4359 |
+ #define TTY_PTY_LOCK 16 /* pty private */ |
4360 |
+ #define TTY_NO_WRITE_SPLIT 17 /* Preserve write boundaries to driver */ |
4361 |
+@@ -462,7 +463,6 @@ extern int tty_hung_up_p(struct file *filp); |
4362 |
+ extern void do_SAK(struct tty_struct *tty); |
4363 |
+ extern void __do_SAK(struct tty_struct *tty); |
4364 |
+ extern void no_tty(void); |
4365 |
+-extern void tty_flush_to_ldisc(struct tty_struct *tty); |
4366 |
+ extern void tty_buffer_free_all(struct tty_port *port); |
4367 |
+ extern void tty_buffer_flush(struct tty_struct *tty, struct tty_ldisc *ld); |
4368 |
+ extern void tty_buffer_init(struct tty_port *port); |
4369 |
+diff --git a/include/xen/events.h b/include/xen/events.h |
4370 |
+index 5321cd9636e6..7d95fdf9cf3e 100644 |
4371 |
+--- a/include/xen/events.h |
4372 |
++++ b/include/xen/events.h |
4373 |
+@@ -17,7 +17,7 @@ int bind_evtchn_to_irqhandler(unsigned int evtchn, |
4374 |
+ irq_handler_t handler, |
4375 |
+ unsigned long irqflags, const char *devname, |
4376 |
+ void *dev_id); |
4377 |
+-int bind_virq_to_irq(unsigned int virq, unsigned int cpu); |
4378 |
++int bind_virq_to_irq(unsigned int virq, unsigned int cpu, bool percpu); |
4379 |
+ int bind_virq_to_irqhandler(unsigned int virq, unsigned int cpu, |
4380 |
+ irq_handler_t handler, |
4381 |
+ unsigned long irqflags, const char *devname, |
4382 |
+diff --git a/kernel/locking/rtmutex.c b/kernel/locking/rtmutex.c |
4383 |
+index 6357265a31ad..ce9108c059fb 100644 |
4384 |
+--- a/kernel/locking/rtmutex.c |
4385 |
++++ b/kernel/locking/rtmutex.c |
4386 |
+@@ -265,15 +265,17 @@ struct task_struct *rt_mutex_get_top_task(struct task_struct *task) |
4387 |
+ } |
4388 |
+ |
4389 |
+ /* |
4390 |
+- * Called by sched_setscheduler() to check whether the priority change |
4391 |
+- * is overruled by a possible priority boosting. |
4392 |
++ * Called by sched_setscheduler() to get the priority which will be |
4393 |
++ * effective after the change. |
4394 |
+ */ |
4395 |
+-int rt_mutex_check_prio(struct task_struct *task, int newprio) |
4396 |
++int rt_mutex_get_effective_prio(struct task_struct *task, int newprio) |
4397 |
+ { |
4398 |
+ if (!task_has_pi_waiters(task)) |
4399 |
+- return 0; |
4400 |
++ return newprio; |
4401 |
+ |
4402 |
+- return task_top_pi_waiter(task)->task->prio <= newprio; |
4403 |
++ if (task_top_pi_waiter(task)->task->prio <= newprio) |
4404 |
++ return task_top_pi_waiter(task)->task->prio; |
4405 |
++ return newprio; |
4406 |
+ } |
4407 |
+ |
4408 |
+ /* |
4409 |
+diff --git a/kernel/module.c b/kernel/module.c |
4410 |
+index ec53f594e9c9..538794ce3cc7 100644 |
4411 |
+--- a/kernel/module.c |
4412 |
++++ b/kernel/module.c |
4413 |
+@@ -3366,6 +3366,9 @@ static int load_module(struct load_info *info, const char __user *uargs, |
4414 |
+ module_bug_cleanup(mod); |
4415 |
+ mutex_unlock(&module_mutex); |
4416 |
+ |
4417 |
++ blocking_notifier_call_chain(&module_notify_list, |
4418 |
++ MODULE_STATE_GOING, mod); |
4419 |
++ |
4420 |
+ /* we can't deallocate the module until we clear memory protection */ |
4421 |
+ unset_module_init_ro_nx(mod); |
4422 |
+ unset_module_core_ro_nx(mod); |
4423 |
+diff --git a/kernel/sched/core.c b/kernel/sched/core.c |
4424 |
+index 3d5f6f6d14c2..f4da2cbbfd7f 100644 |
4425 |
+--- a/kernel/sched/core.c |
4426 |
++++ b/kernel/sched/core.c |
4427 |
+@@ -3295,15 +3295,18 @@ static void __setscheduler_params(struct task_struct *p, |
4428 |
+ |
4429 |
+ /* Actually do priority change: must hold pi & rq lock. */ |
4430 |
+ static void __setscheduler(struct rq *rq, struct task_struct *p, |
4431 |
+- const struct sched_attr *attr) |
4432 |
++ const struct sched_attr *attr, bool keep_boost) |
4433 |
+ { |
4434 |
+ __setscheduler_params(p, attr); |
4435 |
+ |
4436 |
+ /* |
4437 |
+- * If we get here, there was no pi waiters boosting the |
4438 |
+- * task. It is safe to use the normal prio. |
4439 |
++ * Keep a potential priority boosting if called from |
4440 |
++ * sched_setscheduler(). |
4441 |
+ */ |
4442 |
+- p->prio = normal_prio(p); |
4443 |
++ if (keep_boost) |
4444 |
++ p->prio = rt_mutex_get_effective_prio(p, normal_prio(p)); |
4445 |
++ else |
4446 |
++ p->prio = normal_prio(p); |
4447 |
+ |
4448 |
+ if (dl_prio(p->prio)) |
4449 |
+ p->sched_class = &dl_sched_class; |
4450 |
+@@ -3403,7 +3406,7 @@ static int __sched_setscheduler(struct task_struct *p, |
4451 |
+ int newprio = dl_policy(attr->sched_policy) ? MAX_DL_PRIO - 1 : |
4452 |
+ MAX_RT_PRIO - 1 - attr->sched_priority; |
4453 |
+ int retval, oldprio, oldpolicy = -1, queued, running; |
4454 |
+- int policy = attr->sched_policy; |
4455 |
++ int new_effective_prio, policy = attr->sched_policy; |
4456 |
+ unsigned long flags; |
4457 |
+ const struct sched_class *prev_class; |
4458 |
+ struct rq *rq; |
4459 |
+@@ -3585,15 +3588,14 @@ change: |
4460 |
+ oldprio = p->prio; |
4461 |
+ |
4462 |
+ /* |
4463 |
+- * Special case for priority boosted tasks. |
4464 |
+- * |
4465 |
+- * If the new priority is lower or equal (user space view) |
4466 |
+- * than the current (boosted) priority, we just store the new |
4467 |
++ * Take priority boosted tasks into account. If the new |
4468 |
++ * effective priority is unchanged, we just store the new |
4469 |
+ * normal parameters and do not touch the scheduler class and |
4470 |
+ * the runqueue. This will be done when the task deboost |
4471 |
+ * itself. |
4472 |
+ */ |
4473 |
+- if (rt_mutex_check_prio(p, newprio)) { |
4474 |
++ new_effective_prio = rt_mutex_get_effective_prio(p, newprio); |
4475 |
++ if (new_effective_prio == oldprio) { |
4476 |
+ __setscheduler_params(p, attr); |
4477 |
+ task_rq_unlock(rq, p, &flags); |
4478 |
+ return 0; |
4479 |
+@@ -3607,7 +3609,7 @@ change: |
4480 |
+ put_prev_task(rq, p); |
4481 |
+ |
4482 |
+ prev_class = p->sched_class; |
4483 |
+- __setscheduler(rq, p, attr); |
4484 |
++ __setscheduler(rq, p, attr, true); |
4485 |
+ |
4486 |
+ if (running) |
4487 |
+ p->sched_class->set_curr_task(rq); |
4488 |
+@@ -4382,10 +4384,7 @@ long __sched io_schedule_timeout(long timeout) |
4489 |
+ long ret; |
4490 |
+ |
4491 |
+ current->in_iowait = 1; |
4492 |
+- if (old_iowait) |
4493 |
+- blk_schedule_flush_plug(current); |
4494 |
+- else |
4495 |
+- blk_flush_plug(current); |
4496 |
++ blk_schedule_flush_plug(current); |
4497 |
+ |
4498 |
+ delayacct_blkio_start(); |
4499 |
+ rq = raw_rq(); |
4500 |
+@@ -7357,7 +7356,7 @@ static void normalize_task(struct rq *rq, struct task_struct *p) |
4501 |
+ queued = task_on_rq_queued(p); |
4502 |
+ if (queued) |
4503 |
+ dequeue_task(rq, p, 0); |
4504 |
+- __setscheduler(rq, p, &attr); |
4505 |
++ __setscheduler(rq, p, &attr, false); |
4506 |
+ if (queued) { |
4507 |
+ enqueue_task(rq, p, 0); |
4508 |
+ resched_curr(rq); |
4509 |
+diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c |
4510 |
+index bee0c1f78091..38f586c076fe 100644 |
4511 |
+--- a/kernel/time/hrtimer.c |
4512 |
++++ b/kernel/time/hrtimer.c |
4513 |
+@@ -266,21 +266,23 @@ lock_hrtimer_base(const struct hrtimer *timer, unsigned long *flags) |
4514 |
+ /* |
4515 |
+ * Divide a ktime value by a nanosecond value |
4516 |
+ */ |
4517 |
+-u64 __ktime_divns(const ktime_t kt, s64 div) |
4518 |
++s64 __ktime_divns(const ktime_t kt, s64 div) |
4519 |
+ { |
4520 |
+- u64 dclc; |
4521 |
+ int sft = 0; |
4522 |
++ s64 dclc; |
4523 |
++ u64 tmp; |
4524 |
+ |
4525 |
+ dclc = ktime_to_ns(kt); |
4526 |
++ tmp = dclc < 0 ? -dclc : dclc; |
4527 |
++ |
4528 |
+ /* Make sure the divisor is less than 2^32: */ |
4529 |
+ while (div >> 32) { |
4530 |
+ sft++; |
4531 |
+ div >>= 1; |
4532 |
+ } |
4533 |
+- dclc >>= sft; |
4534 |
+- do_div(dclc, (unsigned long) div); |
4535 |
+- |
4536 |
+- return dclc; |
4537 |
++ tmp >>= sft; |
4538 |
++ do_div(tmp, (unsigned long) div); |
4539 |
++ return dclc < 0 ? -tmp : tmp; |
4540 |
+ } |
4541 |
+ EXPORT_SYMBOL_GPL(__ktime_divns); |
4542 |
+ #endif /* BITS_PER_LONG >= 64 */ |
4543 |
+diff --git a/lib/strnlen_user.c b/lib/strnlen_user.c |
4544 |
+index a28df5206d95..11649615c505 100644 |
4545 |
+--- a/lib/strnlen_user.c |
4546 |
++++ b/lib/strnlen_user.c |
4547 |
+@@ -57,7 +57,8 @@ static inline long do_strnlen_user(const char __user *src, unsigned long count, |
4548 |
+ return res + find_zero(data) + 1 - align; |
4549 |
+ } |
4550 |
+ res += sizeof(unsigned long); |
4551 |
+- if (unlikely(max < sizeof(unsigned long))) |
4552 |
++ /* We already handled 'unsigned long' bytes. Did we do it all ? */ |
4553 |
++ if (unlikely(max <= sizeof(unsigned long))) |
4554 |
+ break; |
4555 |
+ max -= sizeof(unsigned long); |
4556 |
+ if (unlikely(__get_user(c,(unsigned long __user *)(src+res)))) |
4557 |
+diff --git a/mm/kmemleak.c b/mm/kmemleak.c |
4558 |
+index 5405aff5a590..f0fe4f2c1fa7 100644 |
4559 |
+--- a/mm/kmemleak.c |
4560 |
++++ b/mm/kmemleak.c |
4561 |
+@@ -115,7 +115,8 @@ |
4562 |
+ #define BYTES_PER_POINTER sizeof(void *) |
4563 |
+ |
4564 |
+ /* GFP bitmask for kmemleak internal allocations */ |
4565 |
+-#define gfp_kmemleak_mask(gfp) (((gfp) & (GFP_KERNEL | GFP_ATOMIC)) | \ |
4566 |
++#define gfp_kmemleak_mask(gfp) (((gfp) & (GFP_KERNEL | GFP_ATOMIC | \ |
4567 |
++ __GFP_NOACCOUNT)) | \ |
4568 |
+ __GFP_NORETRY | __GFP_NOMEMALLOC | \ |
4569 |
+ __GFP_NOWARN) |
4570 |
+ |
4571 |
+diff --git a/mm/mempolicy.c b/mm/mempolicy.c |
4572 |
+index de5dc5e12691..0f7d73b3e4b1 100644 |
4573 |
+--- a/mm/mempolicy.c |
4574 |
++++ b/mm/mempolicy.c |
4575 |
+@@ -2517,7 +2517,7 @@ static void __init check_numabalancing_enable(void) |
4576 |
+ if (numabalancing_override) |
4577 |
+ set_numabalancing_state(numabalancing_override == 1); |
4578 |
+ |
4579 |
+- if (nr_node_ids > 1 && !numabalancing_override) { |
4580 |
++ if (num_online_nodes() > 1 && !numabalancing_override) { |
4581 |
+ pr_info("%s automatic NUMA balancing. " |
4582 |
+ "Configure with numa_balancing= or the " |
4583 |
+ "kernel.numa_balancing sysctl", |
4584 |
+diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c |
4585 |
+index 41a4abc7e98e..c4ec9239249a 100644 |
4586 |
+--- a/net/ceph/osd_client.c |
4587 |
++++ b/net/ceph/osd_client.c |
4588 |
+@@ -1306,8 +1306,6 @@ static void __unregister_linger_request(struct ceph_osd_client *osdc, |
4589 |
+ if (list_empty(&req->r_osd_item)) |
4590 |
+ req->r_osd = NULL; |
4591 |
+ } |
4592 |
+- |
4593 |
+- list_del_init(&req->r_req_lru_item); /* can be on notarget */ |
4594 |
+ ceph_osdc_put_request(req); |
4595 |
+ } |
4596 |
+ |
4597 |
+@@ -2017,20 +2015,29 @@ static void kick_requests(struct ceph_osd_client *osdc, bool force_resend, |
4598 |
+ err = __map_request(osdc, req, |
4599 |
+ force_resend || force_resend_writes); |
4600 |
+ dout("__map_request returned %d\n", err); |
4601 |
+- if (err == 0) |
4602 |
+- continue; /* no change and no osd was specified */ |
4603 |
+ if (err < 0) |
4604 |
+ continue; /* hrm! */ |
4605 |
+- if (req->r_osd == NULL) { |
4606 |
+- dout("tid %llu maps to no valid osd\n", req->r_tid); |
4607 |
+- needmap++; /* request a newer map */ |
4608 |
+- continue; |
4609 |
+- } |
4610 |
++ if (req->r_osd == NULL || err > 0) { |
4611 |
++ if (req->r_osd == NULL) { |
4612 |
++ dout("lingering %p tid %llu maps to no osd\n", |
4613 |
++ req, req->r_tid); |
4614 |
++ /* |
4615 |
++ * A homeless lingering request makes |
4616 |
++ * no sense, as it's job is to keep |
4617 |
++ * a particular OSD connection open. |
4618 |
++ * Request a newer map and kick the |
4619 |
++ * request, knowing that it won't be |
4620 |
++ * resent until we actually get a map |
4621 |
++ * that can tell us where to send it. |
4622 |
++ */ |
4623 |
++ needmap++; |
4624 |
++ } |
4625 |
+ |
4626 |
+- dout("kicking lingering %p tid %llu osd%d\n", req, req->r_tid, |
4627 |
+- req->r_osd ? req->r_osd->o_osd : -1); |
4628 |
+- __register_request(osdc, req); |
4629 |
+- __unregister_linger_request(osdc, req); |
4630 |
++ dout("kicking lingering %p tid %llu osd%d\n", req, |
4631 |
++ req->r_tid, req->r_osd ? req->r_osd->o_osd : -1); |
4632 |
++ __register_request(osdc, req); |
4633 |
++ __unregister_linger_request(osdc, req); |
4634 |
++ } |
4635 |
+ } |
4636 |
+ reset_changed_osds(osdc); |
4637 |
+ mutex_unlock(&osdc->request_mutex); |
4638 |
+diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h |
4639 |
+index 8d53d65bd2ab..81e8dc5cb7f9 100644 |
4640 |
+--- a/net/mac80211/ieee80211_i.h |
4641 |
++++ b/net/mac80211/ieee80211_i.h |
4642 |
+@@ -204,6 +204,8 @@ enum ieee80211_packet_rx_flags { |
4643 |
+ * @IEEE80211_RX_CMNTR: received on cooked monitor already |
4644 |
+ * @IEEE80211_RX_BEACON_REPORTED: This frame was already reported |
4645 |
+ * to cfg80211_report_obss_beacon(). |
4646 |
++ * @IEEE80211_RX_REORDER_TIMER: this frame is released by the |
4647 |
++ * reorder buffer timeout timer, not the normal RX path |
4648 |
+ * |
4649 |
+ * These flags are used across handling multiple interfaces |
4650 |
+ * for a single frame. |
4651 |
+@@ -211,6 +213,7 @@ enum ieee80211_packet_rx_flags { |
4652 |
+ enum ieee80211_rx_flags { |
4653 |
+ IEEE80211_RX_CMNTR = BIT(0), |
4654 |
+ IEEE80211_RX_BEACON_REPORTED = BIT(1), |
4655 |
++ IEEE80211_RX_REORDER_TIMER = BIT(2), |
4656 |
+ }; |
4657 |
+ |
4658 |
+ struct ieee80211_rx_data { |
4659 |
+diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c |
4660 |
+index 1eb730bf8752..4c887d053333 100644 |
4661 |
+--- a/net/mac80211/rx.c |
4662 |
++++ b/net/mac80211/rx.c |
4663 |
+@@ -2106,7 +2106,8 @@ ieee80211_deliver_skb(struct ieee80211_rx_data *rx) |
4664 |
+ /* deliver to local stack */ |
4665 |
+ skb->protocol = eth_type_trans(skb, dev); |
4666 |
+ memset(skb->cb, 0, sizeof(skb->cb)); |
4667 |
+- if (rx->local->napi) |
4668 |
++ if (!(rx->flags & IEEE80211_RX_REORDER_TIMER) && |
4669 |
++ rx->local->napi) |
4670 |
+ napi_gro_receive(rx->local->napi, skb); |
4671 |
+ else |
4672 |
+ netif_receive_skb(skb); |
4673 |
+@@ -3215,7 +3216,7 @@ void ieee80211_release_reorder_timeout(struct sta_info *sta, int tid) |
4674 |
+ /* This is OK -- must be QoS data frame */ |
4675 |
+ .security_idx = tid, |
4676 |
+ .seqno_idx = tid, |
4677 |
+- .flags = 0, |
4678 |
++ .flags = IEEE80211_RX_REORDER_TIMER, |
4679 |
+ }; |
4680 |
+ struct tid_ampdu_rx *tid_agg_rx; |
4681 |
+ |
4682 |
+diff --git a/net/mac80211/wep.c b/net/mac80211/wep.c |
4683 |
+index a4220e92f0cc..efa3f48f1ec5 100644 |
4684 |
+--- a/net/mac80211/wep.c |
4685 |
++++ b/net/mac80211/wep.c |
4686 |
+@@ -98,8 +98,7 @@ static u8 *ieee80211_wep_add_iv(struct ieee80211_local *local, |
4687 |
+ |
4688 |
+ hdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_PROTECTED); |
4689 |
+ |
4690 |
+- if (WARN_ON(skb_tailroom(skb) < IEEE80211_WEP_ICV_LEN || |
4691 |
+- skb_headroom(skb) < IEEE80211_WEP_IV_LEN)) |
4692 |
++ if (WARN_ON(skb_headroom(skb) < IEEE80211_WEP_IV_LEN)) |
4693 |
+ return NULL; |
4694 |
+ |
4695 |
+ hdrlen = ieee80211_hdrlen(hdr->frame_control); |
4696 |
+@@ -167,6 +166,9 @@ int ieee80211_wep_encrypt(struct ieee80211_local *local, |
4697 |
+ size_t len; |
4698 |
+ u8 rc4key[3 + WLAN_KEY_LEN_WEP104]; |
4699 |
+ |
4700 |
++ if (WARN_ON(skb_tailroom(skb) < IEEE80211_WEP_ICV_LEN)) |
4701 |
++ return -1; |
4702 |
++ |
4703 |
+ iv = ieee80211_wep_add_iv(local, skb, keylen, keyidx); |
4704 |
+ if (!iv) |
4705 |
+ return -1; |
4706 |
+diff --git a/net/sunrpc/auth_gss/gss_rpc_xdr.c b/net/sunrpc/auth_gss/gss_rpc_xdr.c |
4707 |
+index 1ec19f6f0c2b..eeeba5adee6d 100644 |
4708 |
+--- a/net/sunrpc/auth_gss/gss_rpc_xdr.c |
4709 |
++++ b/net/sunrpc/auth_gss/gss_rpc_xdr.c |
4710 |
+@@ -793,20 +793,26 @@ int gssx_dec_accept_sec_context(struct rpc_rqst *rqstp, |
4711 |
+ { |
4712 |
+ u32 value_follows; |
4713 |
+ int err; |
4714 |
++ struct page *scratch; |
4715 |
++ |
4716 |
++ scratch = alloc_page(GFP_KERNEL); |
4717 |
++ if (!scratch) |
4718 |
++ return -ENOMEM; |
4719 |
++ xdr_set_scratch_buffer(xdr, page_address(scratch), PAGE_SIZE); |
4720 |
+ |
4721 |
+ /* res->status */ |
4722 |
+ err = gssx_dec_status(xdr, &res->status); |
4723 |
+ if (err) |
4724 |
+- return err; |
4725 |
++ goto out_free; |
4726 |
+ |
4727 |
+ /* res->context_handle */ |
4728 |
+ err = gssx_dec_bool(xdr, &value_follows); |
4729 |
+ if (err) |
4730 |
+- return err; |
4731 |
++ goto out_free; |
4732 |
+ if (value_follows) { |
4733 |
+ err = gssx_dec_ctx(xdr, res->context_handle); |
4734 |
+ if (err) |
4735 |
+- return err; |
4736 |
++ goto out_free; |
4737 |
+ } else { |
4738 |
+ res->context_handle = NULL; |
4739 |
+ } |
4740 |
+@@ -814,11 +820,11 @@ int gssx_dec_accept_sec_context(struct rpc_rqst *rqstp, |
4741 |
+ /* res->output_token */ |
4742 |
+ err = gssx_dec_bool(xdr, &value_follows); |
4743 |
+ if (err) |
4744 |
+- return err; |
4745 |
++ goto out_free; |
4746 |
+ if (value_follows) { |
4747 |
+ err = gssx_dec_buffer(xdr, res->output_token); |
4748 |
+ if (err) |
4749 |
+- return err; |
4750 |
++ goto out_free; |
4751 |
+ } else { |
4752 |
+ res->output_token = NULL; |
4753 |
+ } |
4754 |
+@@ -826,14 +832,17 @@ int gssx_dec_accept_sec_context(struct rpc_rqst *rqstp, |
4755 |
+ /* res->delegated_cred_handle */ |
4756 |
+ err = gssx_dec_bool(xdr, &value_follows); |
4757 |
+ if (err) |
4758 |
+- return err; |
4759 |
++ goto out_free; |
4760 |
+ if (value_follows) { |
4761 |
+ /* we do not support upcall servers sending this data. */ |
4762 |
+- return -EINVAL; |
4763 |
++ err = -EINVAL; |
4764 |
++ goto out_free; |
4765 |
+ } |
4766 |
+ |
4767 |
+ /* res->options */ |
4768 |
+ err = gssx_dec_option_array(xdr, &res->options); |
4769 |
+ |
4770 |
++out_free: |
4771 |
++ __free_page(scratch); |
4772 |
+ return err; |
4773 |
+ } |
4774 |
+diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c |
4775 |
+index a8a1e14272a1..a002a6d1e6da 100644 |
4776 |
+--- a/sound/pci/hda/hda_intel.c |
4777 |
++++ b/sound/pci/hda/hda_intel.c |
4778 |
+@@ -2108,6 +2108,8 @@ static const struct pci_device_id azx_ids[] = { |
4779 |
+ .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS }, |
4780 |
+ { PCI_DEVICE(0x1002, 0xaab0), |
4781 |
+ .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS }, |
4782 |
++ { PCI_DEVICE(0x1002, 0xaac8), |
4783 |
++ .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS }, |
4784 |
+ /* VIA VT8251/VT8237A */ |
4785 |
+ { PCI_DEVICE(0x1106, 0x3288), |
4786 |
+ .driver_data = AZX_DRIVER_VIA | AZX_DCAPS_POSFIX_VIA }, |
4787 |
+diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c |
4788 |
+index da67ea8645a6..e27298bdcd6d 100644 |
4789 |
+--- a/sound/pci/hda/patch_conexant.c |
4790 |
++++ b/sound/pci/hda/patch_conexant.c |
4791 |
+@@ -973,6 +973,14 @@ static const struct hda_codec_preset snd_hda_preset_conexant[] = { |
4792 |
+ .patch = patch_conexant_auto }, |
4793 |
+ { .id = 0x14f150b9, .name = "CX20665", |
4794 |
+ .patch = patch_conexant_auto }, |
4795 |
++ { .id = 0x14f150f1, .name = "CX20721", |
4796 |
++ .patch = patch_conexant_auto }, |
4797 |
++ { .id = 0x14f150f2, .name = "CX20722", |
4798 |
++ .patch = patch_conexant_auto }, |
4799 |
++ { .id = 0x14f150f3, .name = "CX20723", |
4800 |
++ .patch = patch_conexant_auto }, |
4801 |
++ { .id = 0x14f150f4, .name = "CX20724", |
4802 |
++ .patch = patch_conexant_auto }, |
4803 |
+ { .id = 0x14f1510f, .name = "CX20751/2", |
4804 |
+ .patch = patch_conexant_auto }, |
4805 |
+ { .id = 0x14f15110, .name = "CX20751/2", |
4806 |
+@@ -1007,6 +1015,10 @@ MODULE_ALIAS("snd-hda-codec-id:14f150ab"); |
4807 |
+ MODULE_ALIAS("snd-hda-codec-id:14f150ac"); |
4808 |
+ MODULE_ALIAS("snd-hda-codec-id:14f150b8"); |
4809 |
+ MODULE_ALIAS("snd-hda-codec-id:14f150b9"); |
4810 |
++MODULE_ALIAS("snd-hda-codec-id:14f150f1"); |
4811 |
++MODULE_ALIAS("snd-hda-codec-id:14f150f2"); |
4812 |
++MODULE_ALIAS("snd-hda-codec-id:14f150f3"); |
4813 |
++MODULE_ALIAS("snd-hda-codec-id:14f150f4"); |
4814 |
+ MODULE_ALIAS("snd-hda-codec-id:14f1510f"); |
4815 |
+ MODULE_ALIAS("snd-hda-codec-id:14f15110"); |
4816 |
+ MODULE_ALIAS("snd-hda-codec-id:14f15111"); |
4817 |
+diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c |
4818 |
+index 2fd490b1764b..93c78c3c4b95 100644 |
4819 |
+--- a/sound/pci/hda/patch_realtek.c |
4820 |
++++ b/sound/pci/hda/patch_realtek.c |
4821 |
+@@ -5027,6 +5027,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { |
4822 |
+ SND_PCI_QUIRK(0x104d, 0x9099, "Sony VAIO S13", ALC275_FIXUP_SONY_DISABLE_AAMIX), |
4823 |
+ SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook", ALC269_FIXUP_LIFEBOOK), |
4824 |
+ SND_PCI_QUIRK(0x10cf, 0x15dc, "Lifebook T731", ALC269_FIXUP_LIFEBOOK_HP_PIN), |
4825 |
++ SND_PCI_QUIRK(0x10cf, 0x1757, "Lifebook E752", ALC269_FIXUP_LIFEBOOK_HP_PIN), |
4826 |
+ SND_PCI_QUIRK(0x10cf, 0x1845, "Lifebook U904", ALC269_FIXUP_LIFEBOOK_EXTMIC), |
4827 |
+ SND_PCI_QUIRK(0x144d, 0xc109, "Samsung Ativ book 9 (NP900X3G)", ALC269_FIXUP_INV_DMIC), |
4828 |
+ SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_BXBT2807_MIC), |
4829 |
+@@ -5056,6 +5057,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { |
4830 |
+ SND_PCI_QUIRK(0x17aa, 0x5026, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), |
4831 |
+ SND_PCI_QUIRK(0x17aa, 0x5034, "Thinkpad T450", ALC292_FIXUP_TPT440_DOCK), |
4832 |
+ SND_PCI_QUIRK(0x17aa, 0x5036, "Thinkpad T450s", ALC292_FIXUP_TPT440_DOCK), |
4833 |
++ SND_PCI_QUIRK(0x17aa, 0x503c, "Thinkpad L450", ALC292_FIXUP_TPT440_DOCK), |
4834 |
+ SND_PCI_QUIRK(0x17aa, 0x5109, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), |
4835 |
+ SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K), |
4836 |
+ SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD), |
4837 |
+@@ -5246,6 +5248,13 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = { |
4838 |
+ {0x17, 0x40000000}, |
4839 |
+ {0x1d, 0x40700001}, |
4840 |
+ {0x21, 0x02211050}), |
4841 |
++ SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5548", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, |
4842 |
++ ALC255_STANDARD_PINS, |
4843 |
++ {0x12, 0x90a60180}, |
4844 |
++ {0x14, 0x90170130}, |
4845 |
++ {0x17, 0x40000000}, |
4846 |
++ {0x1d, 0x40700001}, |
4847 |
++ {0x21, 0x02211040}), |
4848 |
+ SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, |
4849 |
+ ALC256_STANDARD_PINS, |
4850 |
+ {0x13, 0x40000000}), |
4851 |
+diff --git a/sound/pci/hda/thinkpad_helper.c b/sound/pci/hda/thinkpad_helper.c |
4852 |
+index 2341fc334163..6ba0b5517c40 100644 |
4853 |
+--- a/sound/pci/hda/thinkpad_helper.c |
4854 |
++++ b/sound/pci/hda/thinkpad_helper.c |
4855 |
+@@ -72,7 +72,6 @@ static void hda_fixup_thinkpad_acpi(struct hda_codec *codec, |
4856 |
+ if (led_set_func(TPACPI_LED_MUTE, false) >= 0) { |
4857 |
+ old_vmaster_hook = spec->vmaster_mute.hook; |
4858 |
+ spec->vmaster_mute.hook = update_tpacpi_mute_led; |
4859 |
+- spec->vmaster_mute_enum = 1; |
4860 |
+ removefunc = false; |
4861 |
+ } |
4862 |
+ if (led_set_func(TPACPI_LED_MICMUTE, false) >= 0) { |
4863 |
+diff --git a/sound/soc/codecs/mc13783.c b/sound/soc/codecs/mc13783.c |
4864 |
+index 2ffb9a0570dc..3d44fc50e4d0 100644 |
4865 |
+--- a/sound/soc/codecs/mc13783.c |
4866 |
++++ b/sound/soc/codecs/mc13783.c |
4867 |
+@@ -623,14 +623,14 @@ static int mc13783_probe(struct snd_soc_codec *codec) |
4868 |
+ AUDIO_SSI_SEL, 0); |
4869 |
+ else |
4870 |
+ mc13xxx_reg_rmw(priv->mc13xxx, MC13783_AUDIO_CODEC, |
4871 |
+- 0, AUDIO_SSI_SEL); |
4872 |
++ AUDIO_SSI_SEL, AUDIO_SSI_SEL); |
4873 |
+ |
4874 |
+ if (priv->dac_ssi_port == MC13783_SSI1_PORT) |
4875 |
+ mc13xxx_reg_rmw(priv->mc13xxx, MC13783_AUDIO_DAC, |
4876 |
+ AUDIO_SSI_SEL, 0); |
4877 |
+ else |
4878 |
+ mc13xxx_reg_rmw(priv->mc13xxx, MC13783_AUDIO_DAC, |
4879 |
+- 0, AUDIO_SSI_SEL); |
4880 |
++ AUDIO_SSI_SEL, AUDIO_SSI_SEL); |
4881 |
+ |
4882 |
+ return 0; |
4883 |
+ } |
4884 |
+diff --git a/sound/soc/codecs/uda1380.c b/sound/soc/codecs/uda1380.c |
4885 |
+index dc7778b6dd7f..c3c33bd0df1c 100644 |
4886 |
+--- a/sound/soc/codecs/uda1380.c |
4887 |
++++ b/sound/soc/codecs/uda1380.c |
4888 |
+@@ -437,7 +437,7 @@ static int uda1380_set_dai_fmt_both(struct snd_soc_dai *codec_dai, |
4889 |
+ if ((fmt & SND_SOC_DAIFMT_MASTER_MASK) != SND_SOC_DAIFMT_CBS_CFS) |
4890 |
+ return -EINVAL; |
4891 |
+ |
4892 |
+- uda1380_write(codec, UDA1380_IFACE, iface); |
4893 |
++ uda1380_write_reg_cache(codec, UDA1380_IFACE, iface); |
4894 |
+ |
4895 |
+ return 0; |
4896 |
+ } |
4897 |
+diff --git a/sound/soc/codecs/wm8960.c b/sound/soc/codecs/wm8960.c |
4898 |
+index 3035d9856415..e97a7615df85 100644 |
4899 |
+--- a/sound/soc/codecs/wm8960.c |
4900 |
++++ b/sound/soc/codecs/wm8960.c |
4901 |
+@@ -395,7 +395,7 @@ static const struct snd_soc_dapm_route audio_paths[] = { |
4902 |
+ { "Right Input Mixer", "Boost Switch", "Right Boost Mixer", }, |
4903 |
+ { "Right Input Mixer", NULL, "RINPUT1", }, /* Really Boost Switch */ |
4904 |
+ { "Right Input Mixer", NULL, "RINPUT2" }, |
4905 |
+- { "Right Input Mixer", NULL, "LINPUT3" }, |
4906 |
++ { "Right Input Mixer", NULL, "RINPUT3" }, |
4907 |
+ |
4908 |
+ { "Left ADC", NULL, "Left Input Mixer" }, |
4909 |
+ { "Right ADC", NULL, "Right Input Mixer" }, |
4910 |
+diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c |
4911 |
+index 4fbc7689339a..a1c04dab6684 100644 |
4912 |
+--- a/sound/soc/codecs/wm8994.c |
4913 |
++++ b/sound/soc/codecs/wm8994.c |
4914 |
+@@ -2754,7 +2754,7 @@ static struct { |
4915 |
+ }; |
4916 |
+ |
4917 |
+ static int fs_ratios[] = { |
4918 |
+- 64, 128, 192, 256, 348, 512, 768, 1024, 1408, 1536 |
4919 |
++ 64, 128, 192, 256, 384, 512, 768, 1024, 1408, 1536 |
4920 |
+ }; |
4921 |
+ |
4922 |
+ static int bclk_divs[] = { |
4923 |
+diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c |
4924 |
+index b6f88202b8c9..e19a6765bd8a 100644 |
4925 |
+--- a/sound/soc/soc-dapm.c |
4926 |
++++ b/sound/soc/soc-dapm.c |
4927 |
+@@ -3074,11 +3074,16 @@ snd_soc_dapm_new_control(struct snd_soc_dapm_context *dapm, |
4928 |
+ } |
4929 |
+ |
4930 |
+ prefix = soc_dapm_prefix(dapm); |
4931 |
+- if (prefix) |
4932 |
++ if (prefix) { |
4933 |
+ w->name = kasprintf(GFP_KERNEL, "%s %s", prefix, widget->name); |
4934 |
+- else |
4935 |
++ if (widget->sname) |
4936 |
++ w->sname = kasprintf(GFP_KERNEL, "%s %s", prefix, |
4937 |
++ widget->sname); |
4938 |
++ } else { |
4939 |
+ w->name = kasprintf(GFP_KERNEL, "%s", widget->name); |
4940 |
+- |
4941 |
++ if (widget->sname) |
4942 |
++ w->sname = kasprintf(GFP_KERNEL, "%s", widget->sname); |
4943 |
++ } |
4944 |
+ if (w->name == NULL) { |
4945 |
+ kfree(w); |
4946 |
+ return NULL; |
4947 |
+diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c |
4948 |
+index 32631a86078b..e21ec5abcc3a 100644 |
4949 |
+--- a/sound/usb/quirks.c |
4950 |
++++ b/sound/usb/quirks.c |
4951 |
+@@ -1117,6 +1117,8 @@ bool snd_usb_get_sample_rate_quirk(struct snd_usb_audio *chip) |
4952 |
+ switch (chip->usb_id) { |
4953 |
+ case USB_ID(0x045E, 0x075D): /* MS Lifecam Cinema */ |
4954 |
+ case USB_ID(0x045E, 0x076D): /* MS Lifecam HD-5000 */ |
4955 |
++ case USB_ID(0x045E, 0x0772): /* MS Lifecam Studio */ |
4956 |
++ case USB_ID(0x045E, 0x0779): /* MS Lifecam HD-3000 */ |
4957 |
+ case USB_ID(0x04D8, 0xFEEA): /* Benchmark DAC1 Pre */ |
4958 |
+ return true; |
4959 |
+ } |
4960 |
+diff --git a/tools/vm/Makefile b/tools/vm/Makefile |
4961 |
+index ac884b65a072..93aadaf7ff63 100644 |
4962 |
+--- a/tools/vm/Makefile |
4963 |
++++ b/tools/vm/Makefile |
4964 |
+@@ -3,7 +3,7 @@ |
4965 |
+ TARGETS=page-types slabinfo page_owner_sort |
4966 |
+ |
4967 |
+ LIB_DIR = ../lib/api |
4968 |
+-LIBS = $(LIB_DIR)/libapikfs.a |
4969 |
++LIBS = $(LIB_DIR)/libapi.a |
4970 |
+ |
4971 |
+ CC = $(CROSS_COMPILE)gcc |
4972 |
+ CFLAGS = -Wall -Wextra -I../lib/ |