Gentoo Archives: gentoo-commits

From: Mike Pagano <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/linux-patches:4.14 commit in: /
Date: Sun, 26 May 2019 17:11:45
Message-Id: 1558890683.2cb6fa9babbc792865ddf0f123ca3248196fbb68.mpagano@gentoo
1 commit: 2cb6fa9babbc792865ddf0f123ca3248196fbb68
2 Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
3 AuthorDate: Sun May 26 17:11:23 2019 +0000
4 Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
5 CommitDate: Sun May 26 17:11:23 2019 +0000
6 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=2cb6fa9b
7
8 Linux patch 4.14.122
9
10 Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org>
11
12 0000_README | 4 +
13 1121_linux-4.14.122.patch | 2435 +++++++++++++++++++++++++++++++++++++++++++++
14 2 files changed, 2439 insertions(+)
15
16 diff --git a/0000_README b/0000_README
17 index 5301105..ac52010 100644
18 --- a/0000_README
19 +++ b/0000_README
20 @@ -527,6 +527,10 @@ Patch: 1120_4.14.121.patch
21 From: http://www.kernel.org
22 Desc: Linux 4.14.121
23
24 +Patch: 1121_4.14.122.patch
25 +From: http://www.kernel.org
26 +Desc: Linux 4.14.122
27 +
28 Patch: 1500_XATTR_USER_PREFIX.patch
29 From: https://bugs.gentoo.org/show_bug.cgi?id=470644
30 Desc: Support for namespace user.pax.* on tmpfs.
31
32 diff --git a/1121_linux-4.14.122.patch b/1121_linux-4.14.122.patch
33 new file mode 100644
34 index 0000000..cf5208c
35 --- /dev/null
36 +++ b/1121_linux-4.14.122.patch
37 @@ -0,0 +1,2435 @@
38 +diff --git a/Makefile b/Makefile
39 +index 0e4063e1d0d7..0c4424292649 100644
40 +--- a/Makefile
41 ++++ b/Makefile
42 +@@ -1,7 +1,7 @@
43 + # SPDX-License-Identifier: GPL-2.0
44 + VERSION = 4
45 + PATCHLEVEL = 14
46 +-SUBLEVEL = 121
47 ++SUBLEVEL = 122
48 + EXTRAVERSION =
49 + NAME = Petit Gorille
50 +
51 +diff --git a/arch/parisc/boot/compressed/head.S b/arch/parisc/boot/compressed/head.S
52 +index 5aba20fa48aa..e8b798fd0cf0 100644
53 +--- a/arch/parisc/boot/compressed/head.S
54 ++++ b/arch/parisc/boot/compressed/head.S
55 +@@ -22,7 +22,7 @@
56 + __HEAD
57 +
58 + ENTRY(startup)
59 +- .level LEVEL
60 ++ .level PA_ASM_LEVEL
61 +
62 + #define PSW_W_SM 0x200
63 + #define PSW_W_BIT 36
64 +@@ -63,7 +63,7 @@ $bss_loop:
65 + load32 BOOTADDR(decompress_kernel),%r3
66 +
67 + #ifdef CONFIG_64BIT
68 +- .level LEVEL
69 ++ .level PA_ASM_LEVEL
70 + ssm PSW_W_SM, %r0 /* set W-bit */
71 + depdi 0, 31, 32, %r3
72 + #endif
73 +@@ -72,7 +72,7 @@ $bss_loop:
74 +
75 + startup_continue:
76 + #ifdef CONFIG_64BIT
77 +- .level LEVEL
78 ++ .level PA_ASM_LEVEL
79 + rsm PSW_W_SM, %r0 /* clear W-bit */
80 + #endif
81 +
82 +diff --git a/arch/parisc/include/asm/assembly.h b/arch/parisc/include/asm/assembly.h
83 +index 60e6f07b7e32..eb83d65153b8 100644
84 +--- a/arch/parisc/include/asm/assembly.h
85 ++++ b/arch/parisc/include/asm/assembly.h
86 +@@ -59,14 +59,14 @@
87 + #define LDCW ldcw,co
88 + #define BL b,l
89 + # ifdef CONFIG_64BIT
90 +-# define LEVEL 2.0w
91 ++# define PA_ASM_LEVEL 2.0w
92 + # else
93 +-# define LEVEL 2.0
94 ++# define PA_ASM_LEVEL 2.0
95 + # endif
96 + #else
97 + #define LDCW ldcw
98 + #define BL bl
99 +-#define LEVEL 1.1
100 ++#define PA_ASM_LEVEL 1.1
101 + #endif
102 +
103 + #ifdef __ASSEMBLY__
104 +diff --git a/arch/parisc/kernel/head.S b/arch/parisc/kernel/head.S
105 +index bbbe360b458f..9b99eb0712ad 100644
106 +--- a/arch/parisc/kernel/head.S
107 ++++ b/arch/parisc/kernel/head.S
108 +@@ -22,7 +22,7 @@
109 + #include <linux/linkage.h>
110 + #include <linux/init.h>
111 +
112 +- .level LEVEL
113 ++ .level PA_ASM_LEVEL
114 +
115 + __INITDATA
116 + ENTRY(boot_args)
117 +@@ -254,7 +254,7 @@ stext_pdc_ret:
118 + ldo R%PA(fault_vector_11)(%r10),%r10
119 +
120 + $is_pa20:
121 +- .level LEVEL /* restore 1.1 || 2.0w */
122 ++ .level PA_ASM_LEVEL /* restore 1.1 || 2.0w */
123 + #endif /*!CONFIG_64BIT*/
124 + load32 PA(fault_vector_20),%r10
125 +
126 +diff --git a/arch/parisc/kernel/process.c b/arch/parisc/kernel/process.c
127 +index 4d712c1d64b8..77650dc80830 100644
128 +--- a/arch/parisc/kernel/process.c
129 ++++ b/arch/parisc/kernel/process.c
130 +@@ -192,6 +192,7 @@ int dump_task_fpu (struct task_struct *tsk, elf_fpregset_t *r)
131 + */
132 +
133 + int running_on_qemu __read_mostly;
134 ++EXPORT_SYMBOL(running_on_qemu);
135 +
136 + void __cpuidle arch_cpu_idle_dead(void)
137 + {
138 +diff --git a/arch/parisc/kernel/syscall.S b/arch/parisc/kernel/syscall.S
139 +index 5f7e57fcaeef..0cf379acb5ed 100644
140 +--- a/arch/parisc/kernel/syscall.S
141 ++++ b/arch/parisc/kernel/syscall.S
142 +@@ -48,7 +48,7 @@ registers).
143 + */
144 + #define KILL_INSN break 0,0
145 +
146 +- .level LEVEL
147 ++ .level PA_ASM_LEVEL
148 +
149 + .text
150 +
151 +diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S
152 +index 09896f1c114f..e09ba4bc8b98 100644
153 +--- a/arch/x86/entry/entry_64.S
154 ++++ b/arch/x86/entry/entry_64.S
155 +@@ -853,7 +853,7 @@ ENTRY(switch_to_thread_stack)
156 + ret
157 + END(switch_to_thread_stack)
158 +
159 +-.macro idtentry sym do_sym has_error_code:req paranoid=0 shift_ist=-1
160 ++.macro idtentry sym do_sym has_error_code:req paranoid=0 shift_ist=-1 create_gap=0
161 + ENTRY(\sym)
162 + UNWIND_HINT_IRET_REGS offset=\has_error_code*8
163 +
164 +@@ -873,6 +873,20 @@ ENTRY(\sym)
165 + jnz .Lfrom_usermode_switch_stack_\@
166 + .endif
167 +
168 ++ .if \create_gap == 1
169 ++ /*
170 ++ * If coming from kernel space, create a 6-word gap to allow the
171 ++ * int3 handler to emulate a call instruction.
172 ++ */
173 ++ testb $3, CS-ORIG_RAX(%rsp)
174 ++ jnz .Lfrom_usermode_no_gap_\@
175 ++ .rept 6
176 ++ pushq 5*8(%rsp)
177 ++ .endr
178 ++ UNWIND_HINT_IRET_REGS offset=8
179 ++.Lfrom_usermode_no_gap_\@:
180 ++ .endif
181 ++
182 + .if \paranoid
183 + call paranoid_entry
184 + .else
185 +@@ -1093,7 +1107,7 @@ apicinterrupt3 HYPERVISOR_CALLBACK_VECTOR \
186 + #endif /* CONFIG_HYPERV */
187 +
188 + idtentry debug do_debug has_error_code=0 paranoid=1 shift_ist=DEBUG_STACK
189 +-idtentry int3 do_int3 has_error_code=0
190 ++idtentry int3 do_int3 has_error_code=0 create_gap=1
191 + idtentry stack_segment do_stack_segment has_error_code=1
192 +
193 + #ifdef CONFIG_XEN
194 +diff --git a/arch/x86/include/asm/text-patching.h b/arch/x86/include/asm/text-patching.h
195 +index 2ecd34e2d46c..ab3b9887e140 100644
196 +--- a/arch/x86/include/asm/text-patching.h
197 ++++ b/arch/x86/include/asm/text-patching.h
198 +@@ -38,4 +38,32 @@ extern void *text_poke(void *addr, const void *opcode, size_t len);
199 + extern int poke_int3_handler(struct pt_regs *regs);
200 + extern void *text_poke_bp(void *addr, const void *opcode, size_t len, void *handler);
201 +
202 ++static inline void int3_emulate_jmp(struct pt_regs *regs, unsigned long ip)
203 ++{
204 ++ regs->ip = ip;
205 ++}
206 ++
207 ++#define INT3_INSN_SIZE 1
208 ++#define CALL_INSN_SIZE 5
209 ++
210 ++#ifdef CONFIG_X86_64
211 ++static inline void int3_emulate_push(struct pt_regs *regs, unsigned long val)
212 ++{
213 ++ /*
214 ++ * The int3 handler in entry_64.S adds a gap between the
215 ++ * stack where the break point happened, and the saving of
216 ++ * pt_regs. We can extend the original stack because of
217 ++ * this gap. See the idtentry macro's create_gap option.
218 ++ */
219 ++ regs->sp -= sizeof(unsigned long);
220 ++ *(unsigned long *)regs->sp = val;
221 ++}
222 ++
223 ++static inline void int3_emulate_call(struct pt_regs *regs, unsigned long func)
224 ++{
225 ++ int3_emulate_push(regs, regs->ip - INT3_INSN_SIZE + CALL_INSN_SIZE);
226 ++ int3_emulate_jmp(regs, func);
227 ++}
228 ++#endif
229 ++
230 + #endif /* _ASM_X86_TEXT_PATCHING_H */
231 +diff --git a/arch/x86/kernel/ftrace.c b/arch/x86/kernel/ftrace.c
232 +index 7acb87cb2da8..c020ba4b7eb6 100644
233 +--- a/arch/x86/kernel/ftrace.c
234 ++++ b/arch/x86/kernel/ftrace.c
235 +@@ -30,6 +30,7 @@
236 + #include <asm/sections.h>
237 + #include <asm/ftrace.h>
238 + #include <asm/nops.h>
239 ++#include <asm/text-patching.h>
240 +
241 + #ifdef CONFIG_DYNAMIC_FTRACE
242 +
243 +@@ -229,6 +230,7 @@ int ftrace_modify_call(struct dyn_ftrace *rec, unsigned long old_addr,
244 + }
245 +
246 + static unsigned long ftrace_update_func;
247 ++static unsigned long ftrace_update_func_call;
248 +
249 + static int update_ftrace_func(unsigned long ip, void *new)
250 + {
251 +@@ -257,6 +259,8 @@ int ftrace_update_ftrace_func(ftrace_func_t func)
252 + unsigned char *new;
253 + int ret;
254 +
255 ++ ftrace_update_func_call = (unsigned long)func;
256 ++
257 + new = ftrace_call_replace(ip, (unsigned long)func);
258 + ret = update_ftrace_func(ip, new);
259 +
260 +@@ -292,13 +296,28 @@ int ftrace_int3_handler(struct pt_regs *regs)
261 + if (WARN_ON_ONCE(!regs))
262 + return 0;
263 +
264 +- ip = regs->ip - 1;
265 +- if (!ftrace_location(ip) && !is_ftrace_caller(ip))
266 +- return 0;
267 ++ ip = regs->ip - INT3_INSN_SIZE;
268 +
269 +- regs->ip += MCOUNT_INSN_SIZE - 1;
270 ++#ifdef CONFIG_X86_64
271 ++ if (ftrace_location(ip)) {
272 ++ int3_emulate_call(regs, (unsigned long)ftrace_regs_caller);
273 ++ return 1;
274 ++ } else if (is_ftrace_caller(ip)) {
275 ++ if (!ftrace_update_func_call) {
276 ++ int3_emulate_jmp(regs, ip + CALL_INSN_SIZE);
277 ++ return 1;
278 ++ }
279 ++ int3_emulate_call(regs, ftrace_update_func_call);
280 ++ return 1;
281 ++ }
282 ++#else
283 ++ if (ftrace_location(ip) || is_ftrace_caller(ip)) {
284 ++ int3_emulate_jmp(regs, ip + CALL_INSN_SIZE);
285 ++ return 1;
286 ++ }
287 ++#endif
288 +
289 +- return 1;
290 ++ return 0;
291 + }
292 +
293 + static int ftrace_write(unsigned long ip, const char *val, int size)
294 +@@ -869,6 +888,8 @@ void arch_ftrace_update_trampoline(struct ftrace_ops *ops)
295 +
296 + func = ftrace_ops_get_func(ops);
297 +
298 ++ ftrace_update_func_call = (unsigned long)func;
299 ++
300 + /* Do a safe modify in case the trampoline is executing */
301 + new = ftrace_call_replace(ip, (unsigned long)func);
302 + ret = update_ftrace_func(ip, new);
303 +@@ -965,6 +986,7 @@ static int ftrace_mod_jmp(unsigned long ip, void *func)
304 + {
305 + unsigned char *new;
306 +
307 ++ ftrace_update_func_call = 0UL;
308 + new = ftrace_jmp_replace(ip, (unsigned long)func);
309 +
310 + return update_ftrace_func(ip, new);
311 +diff --git a/arch/x86/lib/Makefile b/arch/x86/lib/Makefile
312 +index d435c89875c1..60b410ff31e8 100644
313 +--- a/arch/x86/lib/Makefile
314 ++++ b/arch/x86/lib/Makefile
315 +@@ -6,6 +6,18 @@
316 + # Produces uninteresting flaky coverage.
317 + KCOV_INSTRUMENT_delay.o := n
318 +
319 ++# Early boot use of cmdline; don't instrument it
320 ++ifdef CONFIG_AMD_MEM_ENCRYPT
321 ++KCOV_INSTRUMENT_cmdline.o := n
322 ++KASAN_SANITIZE_cmdline.o := n
323 ++
324 ++ifdef CONFIG_FUNCTION_TRACER
325 ++CFLAGS_REMOVE_cmdline.o = -pg
326 ++endif
327 ++
328 ++CFLAGS_cmdline.o := $(call cc-option, -fno-stack-protector)
329 ++endif
330 ++
331 + inat_tables_script = $(srctree)/arch/x86/tools/gen-insn-attr-x86.awk
332 + inat_tables_maps = $(srctree)/arch/x86/lib/x86-opcode-map.txt
333 + quiet_cmd_inat_tables = GEN $@
334 +diff --git a/drivers/base/dd.c b/drivers/base/dd.c
335 +index cb3672cfdaaa..536c9ac3b848 100644
336 +--- a/drivers/base/dd.c
337 ++++ b/drivers/base/dd.c
338 +@@ -387,7 +387,7 @@ re_probe:
339 +
340 + ret = dma_configure(dev);
341 + if (ret)
342 +- goto dma_failed;
343 ++ goto probe_failed;
344 +
345 + if (driver_sysfs_add(dev)) {
346 + printk(KERN_ERR "%s: driver_sysfs_add(%s) failed\n",
347 +@@ -442,14 +442,13 @@ re_probe:
348 + goto done;
349 +
350 + probe_failed:
351 +- dma_deconfigure(dev);
352 +-dma_failed:
353 + if (dev->bus)
354 + blocking_notifier_call_chain(&dev->bus->p->bus_notifier,
355 + BUS_NOTIFY_DRIVER_NOT_BOUND, dev);
356 + pinctrl_bind_failed:
357 + device_links_no_driver(dev);
358 + devres_release_all(dev);
359 ++ dma_deconfigure(dev);
360 + driver_sysfs_remove(dev);
361 + dev->driver = NULL;
362 + dev_set_drvdata(dev, NULL);
363 +diff --git a/drivers/clk/hisilicon/clk-hi3660.c b/drivers/clk/hisilicon/clk-hi3660.c
364 +index f40419959656..794eeff0d5d2 100644
365 +--- a/drivers/clk/hisilicon/clk-hi3660.c
366 ++++ b/drivers/clk/hisilicon/clk-hi3660.c
367 +@@ -163,8 +163,12 @@ static const struct hisi_gate_clock hi3660_crgctrl_gate_sep_clks[] = {
368 + "clk_isp_snclk_mux", CLK_SET_RATE_PARENT, 0x50, 17, 0, },
369 + { HI3660_CLK_GATE_ISP_SNCLK2, "clk_gate_isp_snclk2",
370 + "clk_isp_snclk_mux", CLK_SET_RATE_PARENT, 0x50, 18, 0, },
371 ++ /*
372 ++ * clk_gate_ufs_subsys is a system bus clock, mark it as critical
373 ++ * clock and keep it on for system suspend and resume.
374 ++ */
375 + { HI3660_CLK_GATE_UFS_SUBSYS, "clk_gate_ufs_subsys", "clk_div_sysbus",
376 +- CLK_SET_RATE_PARENT, 0x50, 21, 0, },
377 ++ CLK_SET_RATE_PARENT | CLK_IS_CRITICAL, 0x50, 21, 0, },
378 + { HI3660_PCLK_GATE_DSI0, "pclk_gate_dsi0", "clk_div_cfgbus",
379 + CLK_SET_RATE_PARENT, 0x50, 28, 0, },
380 + { HI3660_PCLK_GATE_DSI1, "pclk_gate_dsi1", "clk_div_cfgbus",
381 +diff --git a/drivers/clk/rockchip/clk-rk3328.c b/drivers/clk/rockchip/clk-rk3328.c
382 +index 559abf76891e..33d1cf4e6d80 100644
383 +--- a/drivers/clk/rockchip/clk-rk3328.c
384 ++++ b/drivers/clk/rockchip/clk-rk3328.c
385 +@@ -458,7 +458,7 @@ static struct rockchip_clk_branch rk3328_clk_branches[] __initdata = {
386 + RK3328_CLKSEL_CON(35), 15, 1, MFLAGS, 8, 7, DFLAGS,
387 + RK3328_CLKGATE_CON(2), 12, GFLAGS),
388 + COMPOSITE(SCLK_CRYPTO, "clk_crypto", mux_2plls_p, 0,
389 +- RK3328_CLKSEL_CON(20), 7, 1, MFLAGS, 0, 7, DFLAGS,
390 ++ RK3328_CLKSEL_CON(20), 7, 1, MFLAGS, 0, 5, DFLAGS,
391 + RK3328_CLKGATE_CON(2), 4, GFLAGS),
392 + COMPOSITE_NOMUX(SCLK_TSADC, "clk_tsadc", "clk_24m", 0,
393 + RK3328_CLKSEL_CON(22), 0, 10, DFLAGS,
394 +@@ -550,15 +550,15 @@ static struct rockchip_clk_branch rk3328_clk_branches[] __initdata = {
395 + GATE(0, "hclk_rkvenc_niu", "hclk_rkvenc", CLK_IGNORE_UNUSED,
396 + RK3328_CLKGATE_CON(25), 1, GFLAGS),
397 + GATE(ACLK_H265, "aclk_h265", "aclk_rkvenc", 0,
398 +- RK3328_CLKGATE_CON(25), 0, GFLAGS),
399 ++ RK3328_CLKGATE_CON(25), 2, GFLAGS),
400 + GATE(PCLK_H265, "pclk_h265", "hclk_rkvenc", 0,
401 +- RK3328_CLKGATE_CON(25), 1, GFLAGS),
402 ++ RK3328_CLKGATE_CON(25), 3, GFLAGS),
403 + GATE(ACLK_H264, "aclk_h264", "aclk_rkvenc", 0,
404 +- RK3328_CLKGATE_CON(25), 0, GFLAGS),
405 ++ RK3328_CLKGATE_CON(25), 4, GFLAGS),
406 + GATE(HCLK_H264, "hclk_h264", "hclk_rkvenc", 0,
407 +- RK3328_CLKGATE_CON(25), 1, GFLAGS),
408 ++ RK3328_CLKGATE_CON(25), 5, GFLAGS),
409 + GATE(ACLK_AXISRAM, "aclk_axisram", "aclk_rkvenc", CLK_IGNORE_UNUSED,
410 +- RK3328_CLKGATE_CON(25), 0, GFLAGS),
411 ++ RK3328_CLKGATE_CON(25), 6, GFLAGS),
412 +
413 + COMPOSITE(SCLK_VENC_CORE, "sclk_venc_core", mux_4plls_p, 0,
414 + RK3328_CLKSEL_CON(51), 14, 2, MFLAGS, 8, 5, DFLAGS,
415 +@@ -663,7 +663,7 @@ static struct rockchip_clk_branch rk3328_clk_branches[] __initdata = {
416 +
417 + /* PD_GMAC */
418 + COMPOSITE(ACLK_GMAC, "aclk_gmac", mux_2plls_hdmiphy_p, 0,
419 +- RK3328_CLKSEL_CON(35), 6, 2, MFLAGS, 0, 5, DFLAGS,
420 ++ RK3328_CLKSEL_CON(25), 6, 2, MFLAGS, 0, 5, DFLAGS,
421 + RK3328_CLKGATE_CON(3), 2, GFLAGS),
422 + COMPOSITE_NOMUX(PCLK_GMAC, "pclk_gmac", "aclk_gmac", 0,
423 + RK3328_CLKSEL_CON(25), 8, 3, DFLAGS,
424 +@@ -733,7 +733,7 @@ static struct rockchip_clk_branch rk3328_clk_branches[] __initdata = {
425 +
426 + /* PD_PERI */
427 + GATE(0, "aclk_peri_noc", "aclk_peri", CLK_IGNORE_UNUSED, RK3328_CLKGATE_CON(19), 11, GFLAGS),
428 +- GATE(ACLK_USB3OTG, "aclk_usb3otg", "aclk_peri", 0, RK3328_CLKGATE_CON(19), 4, GFLAGS),
429 ++ GATE(ACLK_USB3OTG, "aclk_usb3otg", "aclk_peri", 0, RK3328_CLKGATE_CON(19), 14, GFLAGS),
430 +
431 + GATE(HCLK_SDMMC, "hclk_sdmmc", "hclk_peri", 0, RK3328_CLKGATE_CON(19), 0, GFLAGS),
432 + GATE(HCLK_SDIO, "hclk_sdio", "hclk_peri", 0, RK3328_CLKGATE_CON(19), 1, GFLAGS),
433 +@@ -894,7 +894,7 @@ static void __init rk3328_clk_init(struct device_node *np)
434 + &rk3328_cpuclk_data, rk3328_cpuclk_rates,
435 + ARRAY_SIZE(rk3328_cpuclk_rates));
436 +
437 +- rockchip_register_softrst(np, 11, reg_base + RK3328_SOFTRST_CON(0),
438 ++ rockchip_register_softrst(np, 12, reg_base + RK3328_SOFTRST_CON(0),
439 + ROCKCHIP_SOFTRST_HIWORD_MASK);
440 +
441 + rockchip_register_restart_notifier(ctx, RK3328_GLB_SRST_FST, NULL);
442 +diff --git a/drivers/clk/tegra/clk-pll.c b/drivers/clk/tegra/clk-pll.c
443 +index 830d1c87fa7c..dc87866233b9 100644
444 +--- a/drivers/clk/tegra/clk-pll.c
445 ++++ b/drivers/clk/tegra/clk-pll.c
446 +@@ -662,8 +662,8 @@ static void _update_pll_mnp(struct tegra_clk_pll *pll,
447 + pll_override_writel(val, params->pmc_divp_reg, pll);
448 +
449 + val = pll_override_readl(params->pmc_divnm_reg, pll);
450 +- val &= ~(divm_mask(pll) << div_nmp->override_divm_shift) |
451 +- ~(divn_mask(pll) << div_nmp->override_divn_shift);
452 ++ val &= ~((divm_mask(pll) << div_nmp->override_divm_shift) |
453 ++ (divn_mask(pll) << div_nmp->override_divn_shift));
454 + val |= (cfg->m << div_nmp->override_divm_shift) |
455 + (cfg->n << div_nmp->override_divn_shift);
456 + pll_override_writel(val, params->pmc_divnm_reg, pll);
457 +diff --git a/drivers/hwtracing/intel_th/msu.c b/drivers/hwtracing/intel_th/msu.c
458 +index 82f2b70ca5bf..36016c09dd96 100644
459 +--- a/drivers/hwtracing/intel_th/msu.c
460 ++++ b/drivers/hwtracing/intel_th/msu.c
461 +@@ -92,6 +92,7 @@ struct msc_iter {
462 + * @reg_base: register window base address
463 + * @thdev: intel_th_device pointer
464 + * @win_list: list of windows in multiblock mode
465 ++ * @single_sgt: single mode buffer
466 + * @nr_pages: total number of pages allocated for this buffer
467 + * @single_sz: amount of data in single mode
468 + * @single_wrap: single mode wrap occurred
469 +@@ -112,6 +113,7 @@ struct msc {
470 + struct intel_th_device *thdev;
471 +
472 + struct list_head win_list;
473 ++ struct sg_table single_sgt;
474 + unsigned long nr_pages;
475 + unsigned long single_sz;
476 + unsigned int single_wrap : 1;
477 +@@ -625,22 +627,45 @@ static void intel_th_msc_deactivate(struct intel_th_device *thdev)
478 + */
479 + static int msc_buffer_contig_alloc(struct msc *msc, unsigned long size)
480 + {
481 ++ unsigned long nr_pages = size >> PAGE_SHIFT;
482 + unsigned int order = get_order(size);
483 + struct page *page;
484 ++ int ret;
485 +
486 + if (!size)
487 + return 0;
488 +
489 ++ ret = sg_alloc_table(&msc->single_sgt, 1, GFP_KERNEL);
490 ++ if (ret)
491 ++ goto err_out;
492 ++
493 ++ ret = -ENOMEM;
494 + page = alloc_pages(GFP_KERNEL | __GFP_ZERO, order);
495 + if (!page)
496 +- return -ENOMEM;
497 ++ goto err_free_sgt;
498 +
499 + split_page(page, order);
500 +- msc->nr_pages = size >> PAGE_SHIFT;
501 ++ sg_set_buf(msc->single_sgt.sgl, page_address(page), size);
502 ++
503 ++ ret = dma_map_sg(msc_dev(msc)->parent->parent, msc->single_sgt.sgl, 1,
504 ++ DMA_FROM_DEVICE);
505 ++ if (ret < 0)
506 ++ goto err_free_pages;
507 ++
508 ++ msc->nr_pages = nr_pages;
509 + msc->base = page_address(page);
510 +- msc->base_addr = page_to_phys(page);
511 ++ msc->base_addr = sg_dma_address(msc->single_sgt.sgl);
512 +
513 + return 0;
514 ++
515 ++err_free_pages:
516 ++ __free_pages(page, order);
517 ++
518 ++err_free_sgt:
519 ++ sg_free_table(&msc->single_sgt);
520 ++
521 ++err_out:
522 ++ return ret;
523 + }
524 +
525 + /**
526 +@@ -651,6 +676,10 @@ static void msc_buffer_contig_free(struct msc *msc)
527 + {
528 + unsigned long off;
529 +
530 ++ dma_unmap_sg(msc_dev(msc)->parent->parent, msc->single_sgt.sgl,
531 ++ 1, DMA_FROM_DEVICE);
532 ++ sg_free_table(&msc->single_sgt);
533 ++
534 + for (off = 0; off < msc->nr_pages << PAGE_SHIFT; off += PAGE_SIZE) {
535 + struct page *page = virt_to_page(msc->base + off);
536 +
537 +diff --git a/drivers/hwtracing/stm/core.c b/drivers/hwtracing/stm/core.c
538 +index 41724d18e712..f4530b08b1e5 100644
539 +--- a/drivers/hwtracing/stm/core.c
540 ++++ b/drivers/hwtracing/stm/core.c
541 +@@ -226,8 +226,8 @@ stm_output_disclaim(struct stm_device *stm, struct stm_output *output)
542 + bitmap_release_region(&master->chan_map[0], output->channel,
543 + ilog2(output->nr_chans));
544 +
545 +- output->nr_chans = 0;
546 + master->nr_free += output->nr_chans;
547 ++ output->nr_chans = 0;
548 + }
549 +
550 + /*
551 +diff --git a/drivers/iommu/tegra-smmu.c b/drivers/iommu/tegra-smmu.c
552 +index 3b6449e2cbf1..40eb8138546a 100644
553 +--- a/drivers/iommu/tegra-smmu.c
554 ++++ b/drivers/iommu/tegra-smmu.c
555 +@@ -94,7 +94,6 @@ static inline u32 smmu_readl(struct tegra_smmu *smmu, unsigned long offset)
556 + #define SMMU_TLB_FLUSH_VA_MATCH_ALL (0 << 0)
557 + #define SMMU_TLB_FLUSH_VA_MATCH_SECTION (2 << 0)
558 + #define SMMU_TLB_FLUSH_VA_MATCH_GROUP (3 << 0)
559 +-#define SMMU_TLB_FLUSH_ASID(x) (((x) & 0x7f) << 24)
560 + #define SMMU_TLB_FLUSH_VA_SECTION(addr) ((((addr) & 0xffc00000) >> 12) | \
561 + SMMU_TLB_FLUSH_VA_MATCH_SECTION)
562 + #define SMMU_TLB_FLUSH_VA_GROUP(addr) ((((addr) & 0xffffc000) >> 12) | \
563 +@@ -197,8 +196,12 @@ static inline void smmu_flush_tlb_asid(struct tegra_smmu *smmu,
564 + {
565 + u32 value;
566 +
567 +- value = SMMU_TLB_FLUSH_ASID_MATCH | SMMU_TLB_FLUSH_ASID(asid) |
568 +- SMMU_TLB_FLUSH_VA_MATCH_ALL;
569 ++ if (smmu->soc->num_asids == 4)
570 ++ value = (asid & 0x3) << 29;
571 ++ else
572 ++ value = (asid & 0x7f) << 24;
573 ++
574 ++ value |= SMMU_TLB_FLUSH_ASID_MATCH | SMMU_TLB_FLUSH_VA_MATCH_ALL;
575 + smmu_writel(smmu, value, SMMU_TLB_FLUSH);
576 + }
577 +
578 +@@ -208,8 +211,12 @@ static inline void smmu_flush_tlb_section(struct tegra_smmu *smmu,
579 + {
580 + u32 value;
581 +
582 +- value = SMMU_TLB_FLUSH_ASID_MATCH | SMMU_TLB_FLUSH_ASID(asid) |
583 +- SMMU_TLB_FLUSH_VA_SECTION(iova);
584 ++ if (smmu->soc->num_asids == 4)
585 ++ value = (asid & 0x3) << 29;
586 ++ else
587 ++ value = (asid & 0x7f) << 24;
588 ++
589 ++ value |= SMMU_TLB_FLUSH_ASID_MATCH | SMMU_TLB_FLUSH_VA_SECTION(iova);
590 + smmu_writel(smmu, value, SMMU_TLB_FLUSH);
591 + }
592 +
593 +@@ -219,8 +226,12 @@ static inline void smmu_flush_tlb_group(struct tegra_smmu *smmu,
594 + {
595 + u32 value;
596 +
597 +- value = SMMU_TLB_FLUSH_ASID_MATCH | SMMU_TLB_FLUSH_ASID(asid) |
598 +- SMMU_TLB_FLUSH_VA_GROUP(iova);
599 ++ if (smmu->soc->num_asids == 4)
600 ++ value = (asid & 0x3) << 29;
601 ++ else
602 ++ value = (asid & 0x7f) << 24;
603 ++
604 ++ value |= SMMU_TLB_FLUSH_ASID_MATCH | SMMU_TLB_FLUSH_VA_GROUP(iova);
605 + smmu_writel(smmu, value, SMMU_TLB_FLUSH);
606 + }
607 +
608 +diff --git a/drivers/md/dm-cache-metadata.c b/drivers/md/dm-cache-metadata.c
609 +index bc60db87e6f1..394e53afc259 100644
610 +--- a/drivers/md/dm-cache-metadata.c
611 ++++ b/drivers/md/dm-cache-metadata.c
612 +@@ -1166,11 +1166,18 @@ static int __load_discards(struct dm_cache_metadata *cmd,
613 + if (r)
614 + return r;
615 +
616 +- for (b = 0; b < from_dblock(cmd->discard_nr_blocks); b++) {
617 ++ for (b = 0; ; b++) {
618 + r = fn(context, cmd->discard_block_size, to_dblock(b),
619 + dm_bitset_cursor_get_value(&c));
620 + if (r)
621 + break;
622 ++
623 ++ if (b >= (from_dblock(cmd->discard_nr_blocks) - 1))
624 ++ break;
625 ++
626 ++ r = dm_bitset_cursor_next(&c);
627 ++ if (r)
628 ++ break;
629 + }
630 +
631 + dm_bitset_cursor_end(&c);
632 +diff --git a/drivers/md/dm-delay.c b/drivers/md/dm-delay.c
633 +index 2209a9700acd..cb733a5afdc8 100644
634 +--- a/drivers/md/dm-delay.c
635 ++++ b/drivers/md/dm-delay.c
636 +@@ -222,7 +222,8 @@ static void delay_dtr(struct dm_target *ti)
637 + {
638 + struct delay_c *dc = ti->private;
639 +
640 +- destroy_workqueue(dc->kdelayd_wq);
641 ++ if (dc->kdelayd_wq)
642 ++ destroy_workqueue(dc->kdelayd_wq);
643 +
644 + dm_put_device(ti, dc->dev_read);
645 +
646 +diff --git a/drivers/md/dm-zoned-metadata.c b/drivers/md/dm-zoned-metadata.c
647 +index 34968ca6b84a..167686189fd2 100644
648 +--- a/drivers/md/dm-zoned-metadata.c
649 ++++ b/drivers/md/dm-zoned-metadata.c
650 +@@ -1169,6 +1169,9 @@ static int dmz_init_zones(struct dmz_metadata *zmd)
651 + goto out;
652 + }
653 +
654 ++ if (!nr_blkz)
655 ++ break;
656 ++
657 + /* Process report */
658 + for (i = 0; i < nr_blkz; i++) {
659 + ret = dmz_init_zone(zmd, zone, &blkz[i]);
660 +@@ -1204,6 +1207,8 @@ static int dmz_update_zone(struct dmz_metadata *zmd, struct dm_zone *zone)
661 + /* Get zone information from disk */
662 + ret = blkdev_report_zones(zmd->dev->bdev, dmz_start_sect(zmd, zone),
663 + &blkz, &nr_blkz, GFP_NOIO);
664 ++ if (!nr_blkz)
665 ++ ret = -EIO;
666 + if (ret) {
667 + dmz_dev_err(zmd->dev, "Get zone %u report failed",
668 + dmz_id(zmd, zone));
669 +diff --git a/drivers/md/md.c b/drivers/md/md.c
670 +index 5599712d478e..b27a69388dcd 100644
671 +--- a/drivers/md/md.c
672 ++++ b/drivers/md/md.c
673 +@@ -2845,8 +2845,10 @@ state_store(struct md_rdev *rdev, const char *buf, size_t len)
674 + err = 0;
675 + }
676 + } else if (cmd_match(buf, "re-add")) {
677 +- if (test_bit(Faulty, &rdev->flags) && (rdev->raid_disk == -1) &&
678 +- rdev->saved_raid_disk >= 0) {
679 ++ if (!rdev->mddev->pers)
680 ++ err = -EINVAL;
681 ++ else if (test_bit(Faulty, &rdev->flags) && (rdev->raid_disk == -1) &&
682 ++ rdev->saved_raid_disk >= 0) {
683 + /* clear_bit is performed _after_ all the devices
684 + * have their local Faulty bit cleared. If any writes
685 + * happen in the meantime in the local node, they
686 +diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
687 +index b8f887bfa06a..65608c6b6836 100644
688 +--- a/drivers/md/raid5.c
689 ++++ b/drivers/md/raid5.c
690 +@@ -4182,7 +4182,7 @@ static void handle_parity_checks6(struct r5conf *conf, struct stripe_head *sh,
691 + /* now write out any block on a failed drive,
692 + * or P or Q if they were recomputed
693 + */
694 +- BUG_ON(s->uptodate < disks - 1); /* We don't need Q to recover */
695 ++ dev = NULL;
696 + if (s->failed == 2) {
697 + dev = &sh->dev[s->failed_num[1]];
698 + s->locked++;
699 +@@ -4207,6 +4207,14 @@ static void handle_parity_checks6(struct r5conf *conf, struct stripe_head *sh,
700 + set_bit(R5_LOCKED, &dev->flags);
701 + set_bit(R5_Wantwrite, &dev->flags);
702 + }
703 ++ if (WARN_ONCE(dev && !test_bit(R5_UPTODATE, &dev->flags),
704 ++ "%s: disk%td not up to date\n",
705 ++ mdname(conf->mddev),
706 ++ dev - (struct r5dev *) &sh->dev)) {
707 ++ clear_bit(R5_LOCKED, &dev->flags);
708 ++ clear_bit(R5_Wantwrite, &dev->flags);
709 ++ s->locked--;
710 ++ }
711 + clear_bit(STRIPE_DEGRADED, &sh->state);
712 +
713 + set_bit(STRIPE_INSYNC, &sh->state);
714 +@@ -4218,15 +4226,26 @@ static void handle_parity_checks6(struct r5conf *conf, struct stripe_head *sh,
715 + case check_state_check_result:
716 + sh->check_state = check_state_idle;
717 +
718 +- if (s->failed > 1)
719 +- break;
720 + /* handle a successful check operation, if parity is correct
721 + * we are done. Otherwise update the mismatch count and repair
722 + * parity if !MD_RECOVERY_CHECK
723 + */
724 + if (sh->ops.zero_sum_result == 0) {
725 +- /* Any parity checked was correct */
726 +- set_bit(STRIPE_INSYNC, &sh->state);
727 ++ /* both parities are correct */
728 ++ if (!s->failed)
729 ++ set_bit(STRIPE_INSYNC, &sh->state);
730 ++ else {
731 ++ /* in contrast to the raid5 case we can validate
732 ++ * parity, but still have a failure to write
733 ++ * back
734 ++ */
735 ++ sh->check_state = check_state_compute_result;
736 ++ /* Returning at this point means that we may go
737 ++ * off and bring p and/or q uptodate again so
738 ++ * we make sure to check zero_sum_result again
739 ++ * to verify if p or q need writeback
740 ++ */
741 ++ }
742 + } else {
743 + atomic64_add(STRIPE_SECTORS, &conf->mddev->resync_mismatches);
744 + if (test_bit(MD_RECOVERY_CHECK, &conf->mddev->recovery)) {
745 +diff --git a/drivers/media/i2c/ov6650.c b/drivers/media/i2c/ov6650.c
746 +index 768f2950ea36..07bc819f5819 100644
747 +--- a/drivers/media/i2c/ov6650.c
748 ++++ b/drivers/media/i2c/ov6650.c
749 +@@ -826,6 +826,8 @@ static int ov6650_video_probe(struct i2c_client *client)
750 + if (ret < 0)
751 + return ret;
752 +
753 ++ msleep(20);
754 ++
755 + /*
756 + * check and show product ID and manufacturer ID
757 + */
758 +diff --git a/drivers/memory/tegra/mc.c b/drivers/memory/tegra/mc.c
759 +index 1d49a8dd4a37..7c040a3b45be 100644
760 +--- a/drivers/memory/tegra/mc.c
761 ++++ b/drivers/memory/tegra/mc.c
762 +@@ -72,7 +72,7 @@ static int tegra_mc_setup_latency_allowance(struct tegra_mc *mc)
763 + u32 value;
764 +
765 + /* compute the number of MC clock cycles per tick */
766 +- tick = mc->tick * clk_get_rate(mc->clk);
767 ++ tick = (unsigned long long)mc->tick * clk_get_rate(mc->clk);
768 + do_div(tick, NSEC_PER_SEC);
769 +
770 + value = readl(mc->regs + MC_EMEM_ARB_CFG);
771 +diff --git a/drivers/net/Makefile b/drivers/net/Makefile
772 +index 676a75f4182a..f07c0bae1f67 100644
773 +--- a/drivers/net/Makefile
774 ++++ b/drivers/net/Makefile
775 +@@ -41,7 +41,7 @@ obj-$(CONFIG_DEV_APPLETALK) += appletalk/
776 + obj-$(CONFIG_CAIF) += caif/
777 + obj-$(CONFIG_CAN) += can/
778 + obj-$(CONFIG_ETRAX_ETHERNET) += cris/
779 +-obj-$(CONFIG_NET_DSA) += dsa/
780 ++obj-y += dsa/
781 + obj-$(CONFIG_ETHERNET) += ethernet/
782 + obj-$(CONFIG_FDDI) += fddi/
783 + obj-$(CONFIG_HIPPI) += hippi/
784 +diff --git a/drivers/net/ethernet/mellanox/mlx4/mcg.c b/drivers/net/ethernet/mellanox/mlx4/mcg.c
785 +index 4c5306dbcf11..71fdd23147ea 100644
786 +--- a/drivers/net/ethernet/mellanox/mlx4/mcg.c
787 ++++ b/drivers/net/ethernet/mellanox/mlx4/mcg.c
788 +@@ -1490,7 +1490,7 @@ int mlx4_flow_steer_promisc_add(struct mlx4_dev *dev, u8 port,
789 + rule.port = port;
790 + rule.qpn = qpn;
791 + INIT_LIST_HEAD(&rule.list);
792 +- mlx4_err(dev, "going promisc on %x\n", port);
793 ++ mlx4_info(dev, "going promisc on %x\n", port);
794 +
795 + return mlx4_flow_attach(dev, &rule, regid_p);
796 + }
797 +diff --git a/drivers/net/ppp/ppp_deflate.c b/drivers/net/ppp/ppp_deflate.c
798 +index b5edc7f96a39..685e875f5164 100644
799 +--- a/drivers/net/ppp/ppp_deflate.c
800 ++++ b/drivers/net/ppp/ppp_deflate.c
801 +@@ -610,12 +610,20 @@ static struct compressor ppp_deflate_draft = {
802 +
803 + static int __init deflate_init(void)
804 + {
805 +- int answer = ppp_register_compressor(&ppp_deflate);
806 +- if (answer == 0)
807 +- printk(KERN_INFO
808 +- "PPP Deflate Compression module registered\n");
809 +- ppp_register_compressor(&ppp_deflate_draft);
810 +- return answer;
811 ++ int rc;
812 ++
813 ++ rc = ppp_register_compressor(&ppp_deflate);
814 ++ if (rc)
815 ++ return rc;
816 ++
817 ++ rc = ppp_register_compressor(&ppp_deflate_draft);
818 ++ if (rc) {
819 ++ ppp_unregister_compressor(&ppp_deflate);
820 ++ return rc;
821 ++ }
822 ++
823 ++ pr_info("PPP Deflate Compression module registered\n");
824 ++ return 0;
825 + }
826 +
827 + static void __exit deflate_cleanup(void)
828 +diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
829 +index 01abe8eea753..6d39dab497f7 100644
830 +--- a/drivers/net/usb/qmi_wwan.c
831 ++++ b/drivers/net/usb/qmi_wwan.c
832 +@@ -1225,6 +1225,8 @@ static const struct usb_device_id products[] = {
833 + {QMI_FIXED_INTF(0x1bc7, 0x1101, 3)}, /* Telit ME910 dual modem */
834 + {QMI_FIXED_INTF(0x1bc7, 0x1200, 5)}, /* Telit LE920 */
835 + {QMI_QUIRK_SET_DTR(0x1bc7, 0x1201, 2)}, /* Telit LE920, LE920A4 */
836 ++ {QMI_QUIRK_SET_DTR(0x1bc7, 0x1260, 2)}, /* Telit LE910Cx */
837 ++ {QMI_QUIRK_SET_DTR(0x1bc7, 0x1261, 2)}, /* Telit LE910Cx */
838 + {QMI_QUIRK_SET_DTR(0x1bc7, 0x1900, 1)}, /* Telit LN940 series */
839 + {QMI_FIXED_INTF(0x1c9e, 0x9801, 3)}, /* Telewell TW-3G HSPA+ */
840 + {QMI_FIXED_INTF(0x1c9e, 0x9803, 4)}, /* Telewell TW-3G HSPA+ */
841 +diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c b/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c
842 +index 8ba8c70571fb..7fb8bbaf2142 100644
843 +--- a/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c
844 ++++ b/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c
845 +@@ -141,9 +141,9 @@ static inline int iwl_mvm_check_pn(struct iwl_mvm *mvm, struct sk_buff *skb,
846 + }
847 +
848 + /* iwl_mvm_create_skb Adds the rxb to a new skb */
849 +-static void iwl_mvm_create_skb(struct sk_buff *skb, struct ieee80211_hdr *hdr,
850 +- u16 len, u8 crypt_len,
851 +- struct iwl_rx_cmd_buffer *rxb)
852 ++static int iwl_mvm_create_skb(struct iwl_mvm *mvm, struct sk_buff *skb,
853 ++ struct ieee80211_hdr *hdr, u16 len, u8 crypt_len,
854 ++ struct iwl_rx_cmd_buffer *rxb)
855 + {
856 + struct iwl_rx_packet *pkt = rxb_addr(rxb);
857 + struct iwl_rx_mpdu_desc *desc = (void *)pkt->data;
858 +@@ -184,6 +184,20 @@ static void iwl_mvm_create_skb(struct sk_buff *skb, struct ieee80211_hdr *hdr,
859 + * present before copying packet data.
860 + */
861 + hdrlen += crypt_len;
862 ++
863 ++ if (WARN_ONCE(headlen < hdrlen,
864 ++ "invalid packet lengths (hdrlen=%d, len=%d, crypt_len=%d)\n",
865 ++ hdrlen, len, crypt_len)) {
866 ++ /*
867 ++ * We warn and trace because we want to be able to see
868 ++ * it in trace-cmd as well.
869 ++ */
870 ++ IWL_DEBUG_RX(mvm,
871 ++ "invalid packet lengths (hdrlen=%d, len=%d, crypt_len=%d)\n",
872 ++ hdrlen, len, crypt_len);
873 ++ return -EINVAL;
874 ++ }
875 ++
876 + skb_put_data(skb, hdr, hdrlen);
877 + skb_put_data(skb, (u8 *)hdr + hdrlen + pad_len, headlen - hdrlen);
878 +
879 +@@ -196,6 +210,8 @@ static void iwl_mvm_create_skb(struct sk_buff *skb, struct ieee80211_hdr *hdr,
880 + skb_add_rx_frag(skb, 0, rxb_steal_page(rxb), offset,
881 + fraglen, rxb->truesize);
882 + }
883 ++
884 ++ return 0;
885 + }
886 +
887 + /* iwl_mvm_pass_packet_to_mac80211 - passes the packet for mac80211 */
888 +@@ -1033,7 +1049,11 @@ void iwl_mvm_rx_mpdu_mq(struct iwl_mvm *mvm, struct napi_struct *napi,
889 + rx_status->boottime_ns = ktime_get_boot_ns();
890 + }
891 +
892 +- iwl_mvm_create_skb(skb, hdr, len, crypt_len, rxb);
893 ++ if (iwl_mvm_create_skb(mvm, skb, hdr, len, crypt_len, rxb)) {
894 ++ kfree_skb(skb);
895 ++ goto out;
896 ++ }
897 ++
898 + if (!iwl_mvm_reorder(mvm, napi, queue, sta, skb, desc))
899 + iwl_mvm_pass_packet_to_mac80211(mvm, napi, skb, queue, sta);
900 + out:
901 +diff --git a/drivers/net/wireless/intersil/p54/p54pci.c b/drivers/net/wireless/intersil/p54/p54pci.c
902 +index 27a49068d32d..57ad56435dda 100644
903 +--- a/drivers/net/wireless/intersil/p54/p54pci.c
904 ++++ b/drivers/net/wireless/intersil/p54/p54pci.c
905 +@@ -554,7 +554,7 @@ static int p54p_probe(struct pci_dev *pdev,
906 + err = pci_enable_device(pdev);
907 + if (err) {
908 + dev_err(&pdev->dev, "Cannot enable new PCI device\n");
909 +- return err;
910 ++ goto err_put;
911 + }
912 +
913 + mem_addr = pci_resource_start(pdev, 0);
914 +@@ -639,6 +639,7 @@ static int p54p_probe(struct pci_dev *pdev,
915 + pci_release_regions(pdev);
916 + err_disable_dev:
917 + pci_disable_device(pdev);
918 ++err_put:
919 + pci_dev_put(pdev);
920 + return err;
921 + }
922 +diff --git a/drivers/parisc/led.c b/drivers/parisc/led.c
923 +index ff1a332d76e4..665e5de909b0 100644
924 +--- a/drivers/parisc/led.c
925 ++++ b/drivers/parisc/led.c
926 +@@ -568,6 +568,9 @@ int __init register_led_driver(int model, unsigned long cmd_reg, unsigned long d
927 + break;
928 +
929 + case DISPLAY_MODEL_LASI:
930 ++ /* Skip to register LED in QEMU */
931 ++ if (running_on_qemu)
932 ++ return 1;
933 + LED_DATA_REG = data_reg;
934 + led_func_ptr = led_LASI_driver;
935 + printk(KERN_INFO "LED display at %lx registered\n", LED_DATA_REG);
936 +diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c
937 +index c0e1985e4c75..6b4e82a4b64e 100644
938 +--- a/drivers/pci/pcie/aspm.c
939 ++++ b/drivers/pci/pcie/aspm.c
940 +@@ -211,6 +211,38 @@ static void pcie_clkpm_cap_init(struct pcie_link_state *link, int blacklist)
941 + link->clkpm_capable = (blacklist) ? 0 : capable;
942 + }
943 +
944 ++static bool pcie_retrain_link(struct pcie_link_state *link)
945 ++{
946 ++ struct pci_dev *parent = link->pdev;
947 ++ unsigned long start_jiffies;
948 ++ u16 reg16;
949 ++
950 ++ pcie_capability_read_word(parent, PCI_EXP_LNKCTL, &reg16);
951 ++ reg16 |= PCI_EXP_LNKCTL_RL;
952 ++ pcie_capability_write_word(parent, PCI_EXP_LNKCTL, reg16);
953 ++ if (parent->clear_retrain_link) {
954 ++ /*
955 ++ * Due to an erratum in some devices the Retrain Link bit
956 ++ * needs to be cleared again manually to allow the link
957 ++ * training to succeed.
958 ++ */
959 ++ reg16 &= ~PCI_EXP_LNKCTL_RL;
960 ++ pcie_capability_write_word(parent, PCI_EXP_LNKCTL, reg16);
961 ++ }
962 ++
963 ++ /* Wait for link training end. Break out after waiting for timeout */
964 ++ start_jiffies = jiffies;
965 ++ for (;;) {
966 ++ pcie_capability_read_word(parent, PCI_EXP_LNKSTA, &reg16);
967 ++ if (!(reg16 & PCI_EXP_LNKSTA_LT))
968 ++ break;
969 ++ if (time_after(jiffies, start_jiffies + LINK_RETRAIN_TIMEOUT))
970 ++ break;
971 ++ msleep(1);
972 ++ }
973 ++ return !(reg16 & PCI_EXP_LNKSTA_LT);
974 ++}
975 ++
976 + /*
977 + * pcie_aspm_configure_common_clock: check if the 2 ends of a link
978 + * could use common clock. If they are, configure them to use the
979 +@@ -220,7 +252,6 @@ static void pcie_aspm_configure_common_clock(struct pcie_link_state *link)
980 + {
981 + int same_clock = 1;
982 + u16 reg16, parent_reg, child_reg[8];
983 +- unsigned long start_jiffies;
984 + struct pci_dev *child, *parent = link->pdev;
985 + struct pci_bus *linkbus = parent->subordinate;
986 + /*
987 +@@ -260,21 +291,7 @@ static void pcie_aspm_configure_common_clock(struct pcie_link_state *link)
988 + reg16 &= ~PCI_EXP_LNKCTL_CCC;
989 + pcie_capability_write_word(parent, PCI_EXP_LNKCTL, reg16);
990 +
991 +- /* Retrain link */
992 +- reg16 |= PCI_EXP_LNKCTL_RL;
993 +- pcie_capability_write_word(parent, PCI_EXP_LNKCTL, reg16);
994 +-
995 +- /* Wait for link training end. Break out after waiting for timeout */
996 +- start_jiffies = jiffies;
997 +- for (;;) {
998 +- pcie_capability_read_word(parent, PCI_EXP_LNKSTA, &reg16);
999 +- if (!(reg16 & PCI_EXP_LNKSTA_LT))
1000 +- break;
1001 +- if (time_after(jiffies, start_jiffies + LINK_RETRAIN_TIMEOUT))
1002 +- break;
1003 +- msleep(1);
1004 +- }
1005 +- if (!(reg16 & PCI_EXP_LNKSTA_LT))
1006 ++ if (pcie_retrain_link(link))
1007 + return;
1008 +
1009 + /* Training failed. Restore common clock configurations */
1010 +diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
1011 +index 867056395d48..45c3fbd38f50 100644
1012 +--- a/drivers/pci/quirks.c
1013 ++++ b/drivers/pci/quirks.c
1014 +@@ -2085,6 +2085,23 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x10f1, quirk_disable_aspm_l0s);
1015 + DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x10f4, quirk_disable_aspm_l0s);
1016 + DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x1508, quirk_disable_aspm_l0s);
1017 +
1018 ++/*
1019 ++ * Some Pericom PCIe-to-PCI bridges in reverse mode need the PCIe Retrain
1020 ++ * Link bit cleared after starting the link retrain process to allow this
1021 ++ * process to finish.
1022 ++ *
1023 ++ * Affected devices: PI7C9X110, PI7C9X111SL, PI7C9X130. See also the
1024 ++ * Pericom Errata Sheet PI7C9X111SLB_errata_rev1.2_102711.pdf.
1025 ++ */
1026 ++static void quirk_enable_clear_retrain_link(struct pci_dev *dev)
1027 ++{
1028 ++ dev->clear_retrain_link = 1;
1029 ++ pci_info(dev, "Enable PCIe Retrain Link quirk\n");
1030 ++}
1031 ++DECLARE_PCI_FIXUP_HEADER(0x12d8, 0xe110, quirk_enable_clear_retrain_link);
1032 ++DECLARE_PCI_FIXUP_HEADER(0x12d8, 0xe111, quirk_enable_clear_retrain_link);
1033 ++DECLARE_PCI_FIXUP_HEADER(0x12d8, 0xe130, quirk_enable_clear_retrain_link);
1034 ++
1035 + static void fixup_rev1_53c810(struct pci_dev *dev)
1036 + {
1037 + u32 class = dev->class;
1038 +@@ -3369,6 +3386,7 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATHEROS, 0x0030, quirk_no_bus_reset);
1039 + DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATHEROS, 0x0032, quirk_no_bus_reset);
1040 + DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATHEROS, 0x003c, quirk_no_bus_reset);
1041 + DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATHEROS, 0x0033, quirk_no_bus_reset);
1042 ++DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATHEROS, 0x0034, quirk_no_bus_reset);
1043 +
1044 + static void quirk_no_pm_reset(struct pci_dev *dev)
1045 + {
1046 +@@ -4852,4 +4870,5 @@ static void quirk_no_ats(struct pci_dev *pdev)
1047 +
1048 + /* AMD Stoney platform GPU */
1049 + DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x98e4, quirk_no_ats);
1050 ++DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x6900, quirk_no_ats);
1051 + #endif /* CONFIG_PCI_ATS */
1052 +diff --git a/drivers/power/supply/cpcap-battery.c b/drivers/power/supply/cpcap-battery.c
1053 +index ee71a2b37b12..fe7fcf3a2ad0 100644
1054 +--- a/drivers/power/supply/cpcap-battery.c
1055 ++++ b/drivers/power/supply/cpcap-battery.c
1056 +@@ -221,6 +221,9 @@ static int cpcap_battery_cc_raw_div(struct cpcap_battery_ddata *ddata,
1057 + int avg_current;
1058 + u32 cc_lsb;
1059 +
1060 ++ if (!divider)
1061 ++ return 0;
1062 ++
1063 + sample &= 0xffffff; /* 24-bits, unsigned */
1064 + offset &= 0x7ff; /* 10-bits, signed */
1065 +
1066 +diff --git a/drivers/power/supply/power_supply_sysfs.c b/drivers/power/supply/power_supply_sysfs.c
1067 +index 5204f115970f..eb5dc7482053 100644
1068 +--- a/drivers/power/supply/power_supply_sysfs.c
1069 ++++ b/drivers/power/supply/power_supply_sysfs.c
1070 +@@ -325,15 +325,11 @@ int power_supply_uevent(struct device *dev, struct kobj_uevent_env *env)
1071 + char *prop_buf;
1072 + char *attrname;
1073 +
1074 +- dev_dbg(dev, "uevent\n");
1075 +-
1076 + if (!psy || !psy->desc) {
1077 + dev_dbg(dev, "No power supply yet\n");
1078 + return ret;
1079 + }
1080 +
1081 +- dev_dbg(dev, "POWER_SUPPLY_NAME=%s\n", psy->desc->name);
1082 +-
1083 + ret = add_uevent_var(env, "POWER_SUPPLY_NAME=%s", psy->desc->name);
1084 + if (ret)
1085 + return ret;
1086 +@@ -369,8 +365,6 @@ int power_supply_uevent(struct device *dev, struct kobj_uevent_env *env)
1087 + goto out;
1088 + }
1089 +
1090 +- dev_dbg(dev, "prop %s=%s\n", attrname, prop_buf);
1091 +-
1092 + ret = add_uevent_var(env, "POWER_SUPPLY_%s=%s", attrname, prop_buf);
1093 + kfree(attrname);
1094 + if (ret)
1095 +diff --git a/drivers/video/fbdev/sm712.h b/drivers/video/fbdev/sm712.h
1096 +index aad1cc4be34a..c7ebf03b8d53 100644
1097 +--- a/drivers/video/fbdev/sm712.h
1098 ++++ b/drivers/video/fbdev/sm712.h
1099 +@@ -15,14 +15,10 @@
1100 +
1101 + #define FB_ACCEL_SMI_LYNX 88
1102 +
1103 +-#define SCREEN_X_RES 1024
1104 +-#define SCREEN_Y_RES 600
1105 +-#define SCREEN_BPP 16
1106 +-
1107 +-/*Assume SM712 graphics chip has 4MB VRAM */
1108 +-#define SM712_VIDEOMEMORYSIZE 0x00400000
1109 +-/*Assume SM722 graphics chip has 8MB VRAM */
1110 +-#define SM722_VIDEOMEMORYSIZE 0x00800000
1111 ++#define SCREEN_X_RES 1024
1112 ++#define SCREEN_Y_RES_PC 768
1113 ++#define SCREEN_Y_RES_NETBOOK 600
1114 ++#define SCREEN_BPP 16
1115 +
1116 + #define dac_reg (0x3c8)
1117 + #define dac_val (0x3c9)
1118 +diff --git a/drivers/video/fbdev/sm712fb.c b/drivers/video/fbdev/sm712fb.c
1119 +index 502d0de2feec..f1dcc6766d1e 100644
1120 +--- a/drivers/video/fbdev/sm712fb.c
1121 ++++ b/drivers/video/fbdev/sm712fb.c
1122 +@@ -530,6 +530,65 @@ static const struct modeinit vgamode[] = {
1123 + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x15, 0x03,
1124 + },
1125 + },
1126 ++ { /* 1024 x 768 16Bpp 60Hz */
1127 ++ 1024, 768, 16, 60,
1128 ++ /* Init_MISC */
1129 ++ 0xEB,
1130 ++ { /* Init_SR0_SR4 */
1131 ++ 0x03, 0x01, 0x0F, 0x03, 0x0E,
1132 ++ },
1133 ++ { /* Init_SR10_SR24 */
1134 ++ 0xF3, 0xB6, 0xC0, 0xDD, 0x00, 0x0E, 0x17, 0x2C,
1135 ++ 0x99, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
1136 ++ 0xC4, 0x30, 0x02, 0x01, 0x01,
1137 ++ },
1138 ++ { /* Init_SR30_SR75 */
1139 ++ 0x38, 0x03, 0x20, 0x09, 0xC0, 0x3A, 0x3A, 0x3A,
1140 ++ 0x3A, 0x3A, 0x3A, 0x3A, 0x00, 0x00, 0x03, 0xFF,
1141 ++ 0x00, 0xFC, 0x00, 0x00, 0x20, 0x18, 0x00, 0xFC,
1142 ++ 0x20, 0x0C, 0x44, 0x20, 0x00, 0x00, 0x00, 0x3A,
1143 ++ 0x06, 0x68, 0xA7, 0x7F, 0x83, 0x24, 0xFF, 0x03,
1144 ++ 0x0F, 0x60, 0x59, 0x3A, 0x3A, 0x00, 0x00, 0x3A,
1145 ++ 0x01, 0x80, 0x7E, 0x1A, 0x1A, 0x00, 0x00, 0x00,
1146 ++ 0x50, 0x03, 0x74, 0x14, 0x3B, 0x0D, 0x09, 0x02,
1147 ++ 0x04, 0x45, 0x30, 0x30, 0x40, 0x20,
1148 ++ },
1149 ++ { /* Init_SR80_SR93 */
1150 ++ 0xFF, 0x07, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x3A,
1151 ++ 0xF7, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x3A, 0x3A,
1152 ++ 0x00, 0x00, 0x00, 0x00,
1153 ++ },
1154 ++ { /* Init_SRA0_SRAF */
1155 ++ 0x00, 0xFB, 0x9F, 0x01, 0x00, 0xED, 0xED, 0xED,
1156 ++ 0x7B, 0xFB, 0xFF, 0xFF, 0x97, 0xEF, 0xBF, 0xDF,
1157 ++ },
1158 ++ { /* Init_GR00_GR08 */
1159 ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x05, 0x0F,
1160 ++ 0xFF,
1161 ++ },
1162 ++ { /* Init_AR00_AR14 */
1163 ++ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
1164 ++ 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
1165 ++ 0x41, 0x00, 0x0F, 0x00, 0x00,
1166 ++ },
1167 ++ { /* Init_CR00_CR18 */
1168 ++ 0xA3, 0x7F, 0x7F, 0x00, 0x85, 0x16, 0x24, 0xF5,
1169 ++ 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1170 ++ 0x03, 0x09, 0xFF, 0x80, 0x40, 0xFF, 0x00, 0xE3,
1171 ++ 0xFF,
1172 ++ },
1173 ++ { /* Init_CR30_CR4D */
1174 ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x02, 0x20,
1175 ++ 0x00, 0x00, 0x00, 0x40, 0x00, 0xFF, 0xBF, 0xFF,
1176 ++ 0xA3, 0x7F, 0x00, 0x86, 0x15, 0x24, 0xFF, 0x00,
1177 ++ 0x01, 0x07, 0xE5, 0x20, 0x7F, 0xFF,
1178 ++ },
1179 ++ { /* Init_CR90_CRA7 */
1180 ++ 0x55, 0xD9, 0x5D, 0xE1, 0x86, 0x1B, 0x8E, 0x26,
1181 ++ 0xDA, 0x8D, 0xDE, 0x94, 0x00, 0x00, 0x18, 0x00,
1182 ++ 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x15, 0x03,
1183 ++ },
1184 ++ },
1185 + { /* mode#5: 1024 x 768 24Bpp 60Hz */
1186 + 1024, 768, 24, 60,
1187 + /* Init_MISC */
1188 +@@ -827,67 +886,80 @@ static inline unsigned int chan_to_field(unsigned int chan,
1189 +
1190 + static int smtc_blank(int blank_mode, struct fb_info *info)
1191 + {
1192 ++ struct smtcfb_info *sfb = info->par;
1193 ++
1194 + /* clear DPMS setting */
1195 + switch (blank_mode) {
1196 + case FB_BLANK_UNBLANK:
1197 + /* Screen On: HSync: On, VSync : On */
1198 ++
1199 ++ switch (sfb->chip_id) {
1200 ++ case 0x710:
1201 ++ case 0x712:
1202 ++ smtc_seqw(0x6a, 0x16);
1203 ++ smtc_seqw(0x6b, 0x02);
1204 ++ break;
1205 ++ case 0x720:
1206 ++ smtc_seqw(0x6a, 0x0d);
1207 ++ smtc_seqw(0x6b, 0x02);
1208 ++ break;
1209 ++ }
1210 ++
1211 ++ smtc_seqw(0x23, (smtc_seqr(0x23) & (~0xc0)));
1212 + smtc_seqw(0x01, (smtc_seqr(0x01) & (~0x20)));
1213 +- smtc_seqw(0x6a, 0x16);
1214 +- smtc_seqw(0x6b, 0x02);
1215 + smtc_seqw(0x21, (smtc_seqr(0x21) & 0x77));
1216 + smtc_seqw(0x22, (smtc_seqr(0x22) & (~0x30)));
1217 +- smtc_seqw(0x23, (smtc_seqr(0x23) & (~0xc0)));
1218 +- smtc_seqw(0x24, (smtc_seqr(0x24) | 0x01));
1219 + smtc_seqw(0x31, (smtc_seqr(0x31) | 0x03));
1220 ++ smtc_seqw(0x24, (smtc_seqr(0x24) | 0x01));
1221 + break;
1222 + case FB_BLANK_NORMAL:
1223 + /* Screen Off: HSync: On, VSync : On Soft blank */
1224 ++ smtc_seqw(0x24, (smtc_seqr(0x24) | 0x01));
1225 ++ smtc_seqw(0x31, ((smtc_seqr(0x31) & (~0x07)) | 0x00));
1226 ++ smtc_seqw(0x23, (smtc_seqr(0x23) & (~0xc0)));
1227 + smtc_seqw(0x01, (smtc_seqr(0x01) & (~0x20)));
1228 ++ smtc_seqw(0x22, (smtc_seqr(0x22) & (~0x30)));
1229 + smtc_seqw(0x6a, 0x16);
1230 + smtc_seqw(0x6b, 0x02);
1231 +- smtc_seqw(0x22, (smtc_seqr(0x22) & (~0x30)));
1232 +- smtc_seqw(0x23, (smtc_seqr(0x23) & (~0xc0)));
1233 +- smtc_seqw(0x24, (smtc_seqr(0x24) | 0x01));
1234 +- smtc_seqw(0x31, ((smtc_seqr(0x31) & (~0x07)) | 0x00));
1235 + break;
1236 + case FB_BLANK_VSYNC_SUSPEND:
1237 + /* Screen On: HSync: On, VSync : Off */
1238 ++ smtc_seqw(0x24, (smtc_seqr(0x24) & (~0x01)));
1239 ++ smtc_seqw(0x31, ((smtc_seqr(0x31) & (~0x07)) | 0x00));
1240 ++ smtc_seqw(0x23, ((smtc_seqr(0x23) & (~0xc0)) | 0x20));
1241 + smtc_seqw(0x01, (smtc_seqr(0x01) | 0x20));
1242 +- smtc_seqw(0x20, (smtc_seqr(0x20) & (~0xB0)));
1243 +- smtc_seqw(0x6a, 0x0c);
1244 +- smtc_seqw(0x6b, 0x02);
1245 + smtc_seqw(0x21, (smtc_seqr(0x21) | 0x88));
1246 ++ smtc_seqw(0x20, (smtc_seqr(0x20) & (~0xB0)));
1247 + smtc_seqw(0x22, ((smtc_seqr(0x22) & (~0x30)) | 0x20));
1248 +- smtc_seqw(0x23, ((smtc_seqr(0x23) & (~0xc0)) | 0x20));
1249 +- smtc_seqw(0x24, (smtc_seqr(0x24) & (~0x01)));
1250 +- smtc_seqw(0x31, ((smtc_seqr(0x31) & (~0x07)) | 0x00));
1251 + smtc_seqw(0x34, (smtc_seqr(0x34) | 0x80));
1252 ++ smtc_seqw(0x6a, 0x0c);
1253 ++ smtc_seqw(0x6b, 0x02);
1254 + break;
1255 + case FB_BLANK_HSYNC_SUSPEND:
1256 + /* Screen On: HSync: Off, VSync : On */
1257 ++ smtc_seqw(0x24, (smtc_seqr(0x24) & (~0x01)));
1258 ++ smtc_seqw(0x31, ((smtc_seqr(0x31) & (~0x07)) | 0x00));
1259 ++ smtc_seqw(0x23, ((smtc_seqr(0x23) & (~0xc0)) | 0xD8));
1260 + smtc_seqw(0x01, (smtc_seqr(0x01) | 0x20));
1261 +- smtc_seqw(0x20, (smtc_seqr(0x20) & (~0xB0)));
1262 +- smtc_seqw(0x6a, 0x0c);
1263 +- smtc_seqw(0x6b, 0x02);
1264 + smtc_seqw(0x21, (smtc_seqr(0x21) | 0x88));
1265 ++ smtc_seqw(0x20, (smtc_seqr(0x20) & (~0xB0)));
1266 + smtc_seqw(0x22, ((smtc_seqr(0x22) & (~0x30)) | 0x10));
1267 +- smtc_seqw(0x23, ((smtc_seqr(0x23) & (~0xc0)) | 0xD8));
1268 +- smtc_seqw(0x24, (smtc_seqr(0x24) & (~0x01)));
1269 +- smtc_seqw(0x31, ((smtc_seqr(0x31) & (~0x07)) | 0x00));
1270 + smtc_seqw(0x34, (smtc_seqr(0x34) | 0x80));
1271 ++ smtc_seqw(0x6a, 0x0c);
1272 ++ smtc_seqw(0x6b, 0x02);
1273 + break;
1274 + case FB_BLANK_POWERDOWN:
1275 + /* Screen On: HSync: Off, VSync : Off */
1276 ++ smtc_seqw(0x24, (smtc_seqr(0x24) & (~0x01)));
1277 ++ smtc_seqw(0x31, ((smtc_seqr(0x31) & (~0x07)) | 0x00));
1278 ++ smtc_seqw(0x23, ((smtc_seqr(0x23) & (~0xc0)) | 0xD8));
1279 + smtc_seqw(0x01, (smtc_seqr(0x01) | 0x20));
1280 +- smtc_seqw(0x20, (smtc_seqr(0x20) & (~0xB0)));
1281 +- smtc_seqw(0x6a, 0x0c);
1282 +- smtc_seqw(0x6b, 0x02);
1283 + smtc_seqw(0x21, (smtc_seqr(0x21) | 0x88));
1284 ++ smtc_seqw(0x20, (smtc_seqr(0x20) & (~0xB0)));
1285 + smtc_seqw(0x22, ((smtc_seqr(0x22) & (~0x30)) | 0x30));
1286 +- smtc_seqw(0x23, ((smtc_seqr(0x23) & (~0xc0)) | 0xD8));
1287 +- smtc_seqw(0x24, (smtc_seqr(0x24) & (~0x01)));
1288 +- smtc_seqw(0x31, ((smtc_seqr(0x31) & (~0x07)) | 0x00));
1289 + smtc_seqw(0x34, (smtc_seqr(0x34) | 0x80));
1290 ++ smtc_seqw(0x6a, 0x0c);
1291 ++ smtc_seqw(0x6b, 0x02);
1292 + break;
1293 + default:
1294 + return -EINVAL;
1295 +@@ -1145,8 +1217,10 @@ static void sm7xx_set_timing(struct smtcfb_info *sfb)
1296 +
1297 + /* init SEQ register SR30 - SR75 */
1298 + for (i = 0; i < SIZE_SR30_SR75; i++)
1299 +- if ((i + 0x30) != 0x62 && (i + 0x30) != 0x6a &&
1300 +- (i + 0x30) != 0x6b)
1301 ++ if ((i + 0x30) != 0x30 && (i + 0x30) != 0x62 &&
1302 ++ (i + 0x30) != 0x6a && (i + 0x30) != 0x6b &&
1303 ++ (i + 0x30) != 0x70 && (i + 0x30) != 0x71 &&
1304 ++ (i + 0x30) != 0x74 && (i + 0x30) != 0x75)
1305 + smtc_seqw(i + 0x30,
1306 + vgamode[j].init_sr30_sr75[i]);
1307 +
1308 +@@ -1171,8 +1245,12 @@ static void sm7xx_set_timing(struct smtcfb_info *sfb)
1309 + smtc_crtcw(i, vgamode[j].init_cr00_cr18[i]);
1310 +
1311 + /* init CRTC register CR30 - CR4D */
1312 +- for (i = 0; i < SIZE_CR30_CR4D; i++)
1313 ++ for (i = 0; i < SIZE_CR30_CR4D; i++) {
1314 ++ if ((i + 0x30) >= 0x3B && (i + 0x30) <= 0x3F)
1315 ++ /* side-effect, don't write to CR3B-CR3F */
1316 ++ continue;
1317 + smtc_crtcw(i + 0x30, vgamode[j].init_cr30_cr4d[i]);
1318 ++ }
1319 +
1320 + /* init CRTC register CR90 - CRA7 */
1321 + for (i = 0; i < SIZE_CR90_CRA7; i++)
1322 +@@ -1323,6 +1401,11 @@ static int smtc_map_smem(struct smtcfb_info *sfb,
1323 + {
1324 + sfb->fb->fix.smem_start = pci_resource_start(pdev, 0);
1325 +
1326 ++ if (sfb->chip_id == 0x720)
1327 ++ /* on SM720, the framebuffer starts at the 1 MB offset */
1328 ++ sfb->fb->fix.smem_start += 0x00200000;
1329 ++
1330 ++ /* XXX: is it safe for SM720 on Big-Endian? */
1331 + if (sfb->fb->var.bits_per_pixel == 32)
1332 + sfb->fb->fix.smem_start += big_addr;
1333 +
1334 +@@ -1360,12 +1443,82 @@ static inline void sm7xx_init_hw(void)
1335 + outb_p(0x11, 0x3c5);
1336 + }
1337 +
1338 ++static u_long sm7xx_vram_probe(struct smtcfb_info *sfb)
1339 ++{
1340 ++ u8 vram;
1341 ++
1342 ++ switch (sfb->chip_id) {
1343 ++ case 0x710:
1344 ++ case 0x712:
1345 ++ /*
1346 ++ * Assume SM712 graphics chip has 4MB VRAM.
1347 ++ *
1348 ++ * FIXME: SM712 can have 2MB VRAM, which is used on earlier
1349 ++ * laptops, such as IBM Thinkpad 240X. This driver would
1350 ++ * probably crash on those machines. If anyone gets one of
1351 ++ * those and is willing to help, run "git blame" and send me
1352 ++ * an E-mail.
1353 ++ */
1354 ++ return 0x00400000;
1355 ++ case 0x720:
1356 ++ outb_p(0x76, 0x3c4);
1357 ++ vram = inb_p(0x3c5) >> 6;
1358 ++
1359 ++ if (vram == 0x00)
1360 ++ return 0x00800000; /* 8 MB */
1361 ++ else if (vram == 0x01)
1362 ++ return 0x01000000; /* 16 MB */
1363 ++ else if (vram == 0x02)
1364 ++ return 0x00400000; /* illegal, fallback to 4 MB */
1365 ++ else if (vram == 0x03)
1366 ++ return 0x00400000; /* 4 MB */
1367 ++ }
1368 ++ return 0; /* unknown hardware */
1369 ++}
1370 ++
1371 ++static void sm7xx_resolution_probe(struct smtcfb_info *sfb)
1372 ++{
1373 ++ /* get mode parameter from smtc_scr_info */
1374 ++ if (smtc_scr_info.lfb_width != 0) {
1375 ++ sfb->fb->var.xres = smtc_scr_info.lfb_width;
1376 ++ sfb->fb->var.yres = smtc_scr_info.lfb_height;
1377 ++ sfb->fb->var.bits_per_pixel = smtc_scr_info.lfb_depth;
1378 ++ goto final;
1379 ++ }
1380 ++
1381 ++ /*
1382 ++ * No parameter, default resolution is 1024x768-16.
1383 ++ *
1384 ++ * FIXME: earlier laptops, such as IBM Thinkpad 240X, has a 800x600
1385 ++ * panel, also see the comments about Thinkpad 240X above.
1386 ++ */
1387 ++ sfb->fb->var.xres = SCREEN_X_RES;
1388 ++ sfb->fb->var.yres = SCREEN_Y_RES_PC;
1389 ++ sfb->fb->var.bits_per_pixel = SCREEN_BPP;
1390 ++
1391 ++#ifdef CONFIG_MIPS
1392 ++ /*
1393 ++ * Loongson MIPS netbooks use 1024x600 LCD panels, which is the original
1394 ++ * target platform of this driver, but nearly all old x86 laptops have
1395 ++ * 1024x768. Lighting 768 panels using 600's timings would partially
1396 ++ * garble the display, so we don't want that. But it's not possible to
1397 ++ * distinguish them reliably.
1398 ++ *
1399 ++ * So we change the default to 768, but keep 600 as-is on MIPS.
1400 ++ */
1401 ++ sfb->fb->var.yres = SCREEN_Y_RES_NETBOOK;
1402 ++#endif
1403 ++
1404 ++final:
1405 ++ big_pixel_depth(sfb->fb->var.bits_per_pixel, smtc_scr_info.lfb_depth);
1406 ++}
1407 ++
1408 + static int smtcfb_pci_probe(struct pci_dev *pdev,
1409 + const struct pci_device_id *ent)
1410 + {
1411 + struct smtcfb_info *sfb;
1412 + struct fb_info *info;
1413 +- u_long smem_size = 0x00800000; /* default 8MB */
1414 ++ u_long smem_size;
1415 + int err;
1416 + unsigned long mmio_base;
1417 +
1418 +@@ -1405,29 +1558,19 @@ static int smtcfb_pci_probe(struct pci_dev *pdev,
1419 +
1420 + sm7xx_init_hw();
1421 +
1422 +- /* get mode parameter from smtc_scr_info */
1423 +- if (smtc_scr_info.lfb_width != 0) {
1424 +- sfb->fb->var.xres = smtc_scr_info.lfb_width;
1425 +- sfb->fb->var.yres = smtc_scr_info.lfb_height;
1426 +- sfb->fb->var.bits_per_pixel = smtc_scr_info.lfb_depth;
1427 +- } else {
1428 +- /* default resolution 1024x600 16bit mode */
1429 +- sfb->fb->var.xres = SCREEN_X_RES;
1430 +- sfb->fb->var.yres = SCREEN_Y_RES;
1431 +- sfb->fb->var.bits_per_pixel = SCREEN_BPP;
1432 +- }
1433 +-
1434 +- big_pixel_depth(sfb->fb->var.bits_per_pixel, smtc_scr_info.lfb_depth);
1435 + /* Map address and memory detection */
1436 + mmio_base = pci_resource_start(pdev, 0);
1437 + pci_read_config_byte(pdev, PCI_REVISION_ID, &sfb->chip_rev_id);
1438 +
1439 ++ smem_size = sm7xx_vram_probe(sfb);
1440 ++ dev_info(&pdev->dev, "%lu MiB of VRAM detected.\n",
1441 ++ smem_size / 1048576);
1442 ++
1443 + switch (sfb->chip_id) {
1444 + case 0x710:
1445 + case 0x712:
1446 + sfb->fb->fix.mmio_start = mmio_base + 0x00400000;
1447 + sfb->fb->fix.mmio_len = 0x00400000;
1448 +- smem_size = SM712_VIDEOMEMORYSIZE;
1449 + sfb->lfb = ioremap(mmio_base, mmio_addr);
1450 + if (!sfb->lfb) {
1451 + dev_err(&pdev->dev,
1452 +@@ -1459,8 +1602,7 @@ static int smtcfb_pci_probe(struct pci_dev *pdev,
1453 + case 0x720:
1454 + sfb->fb->fix.mmio_start = mmio_base;
1455 + sfb->fb->fix.mmio_len = 0x00200000;
1456 +- smem_size = SM722_VIDEOMEMORYSIZE;
1457 +- sfb->dp_regs = ioremap(mmio_base, 0x00a00000);
1458 ++ sfb->dp_regs = ioremap(mmio_base, 0x00200000 + smem_size);
1459 + sfb->lfb = sfb->dp_regs + 0x00200000;
1460 + sfb->mmio = (smtc_regbaseaddress =
1461 + sfb->dp_regs + 0x000c0000);
1462 +@@ -1477,6 +1619,9 @@ static int smtcfb_pci_probe(struct pci_dev *pdev,
1463 + goto failed_fb;
1464 + }
1465 +
1466 ++ /* probe and decide resolution */
1467 ++ sm7xx_resolution_probe(sfb);
1468 ++
1469 + /* can support 32 bpp */
1470 + if (sfb->fb->var.bits_per_pixel == 15)
1471 + sfb->fb->var.bits_per_pixel = 16;
1472 +@@ -1487,7 +1632,11 @@ static int smtcfb_pci_probe(struct pci_dev *pdev,
1473 + if (err)
1474 + goto failed;
1475 +
1476 +- smtcfb_setmode(sfb);
1477 ++ /*
1478 ++ * The screen would be temporarily garbled when sm712fb takes over
1479 ++ * vesafb or VGA text mode. Zero the framebuffer.
1480 ++ */
1481 ++ memset_io(sfb->lfb, 0, sfb->fb->fix.smem_len);
1482 +
1483 + err = register_framebuffer(info);
1484 + if (err < 0)
1485 +diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
1486 +index 83791d13c204..54bb5d79723a 100644
1487 +--- a/fs/btrfs/extent-tree.c
1488 ++++ b/fs/btrfs/extent-tree.c
1489 +@@ -11058,9 +11058,9 @@ int btrfs_error_unpin_extent_range(struct btrfs_fs_info *fs_info,
1490 + * transaction.
1491 + */
1492 + static int btrfs_trim_free_extents(struct btrfs_device *device,
1493 +- u64 minlen, u64 *trimmed)
1494 ++ struct fstrim_range *range, u64 *trimmed)
1495 + {
1496 +- u64 start = 0, len = 0;
1497 ++ u64 start = range->start, len = 0;
1498 + int ret;
1499 +
1500 + *trimmed = 0;
1501 +@@ -11096,8 +11096,8 @@ static int btrfs_trim_free_extents(struct btrfs_device *device,
1502 + refcount_inc(&trans->use_count);
1503 + spin_unlock(&fs_info->trans_lock);
1504 +
1505 +- ret = find_free_dev_extent_start(trans, device, minlen, start,
1506 +- &start, &len);
1507 ++ ret = find_free_dev_extent_start(trans, device, range->minlen,
1508 ++ start, &start, &len);
1509 + if (trans)
1510 + btrfs_put_transaction(trans);
1511 +
1512 +@@ -11109,6 +11109,16 @@ static int btrfs_trim_free_extents(struct btrfs_device *device,
1513 + break;
1514 + }
1515 +
1516 ++ /* If we are out of the passed range break */
1517 ++ if (start > range->start + range->len - 1) {
1518 ++ mutex_unlock(&fs_info->chunk_mutex);
1519 ++ ret = 0;
1520 ++ break;
1521 ++ }
1522 ++
1523 ++ start = max(range->start, start);
1524 ++ len = min(range->len, len);
1525 ++
1526 + ret = btrfs_issue_discard(device->bdev, start, len, &bytes);
1527 + up_read(&fs_info->commit_root_sem);
1528 + mutex_unlock(&fs_info->chunk_mutex);
1529 +@@ -11119,6 +11129,10 @@ static int btrfs_trim_free_extents(struct btrfs_device *device,
1530 + start += len;
1531 + *trimmed += bytes;
1532 +
1533 ++ /* We've trimmed enough */
1534 ++ if (*trimmed >= range->len)
1535 ++ break;
1536 ++
1537 + if (fatal_signal_pending(current)) {
1538 + ret = -ERESTARTSYS;
1539 + break;
1540 +@@ -11202,8 +11216,7 @@ int btrfs_trim_fs(struct btrfs_fs_info *fs_info, struct fstrim_range *range)
1541 + mutex_lock(&fs_info->fs_devices->device_list_mutex);
1542 + devices = &fs_info->fs_devices->devices;
1543 + list_for_each_entry(device, devices, dev_list) {
1544 +- ret = btrfs_trim_free_extents(device, range->minlen,
1545 +- &group_trimmed);
1546 ++ ret = btrfs_trim_free_extents(device, range, &group_trimmed);
1547 + if (ret) {
1548 + dev_failed++;
1549 + dev_ret = ret;
1550 +diff --git a/fs/ceph/super.c b/fs/ceph/super.c
1551 +index b79b1211a2b5..f0694293b31a 100644
1552 +--- a/fs/ceph/super.c
1553 ++++ b/fs/ceph/super.c
1554 +@@ -768,6 +768,12 @@ static void ceph_umount_begin(struct super_block *sb)
1555 + return;
1556 + }
1557 +
1558 ++static int ceph_remount(struct super_block *sb, int *flags, char *data)
1559 ++{
1560 ++ sync_filesystem(sb);
1561 ++ return 0;
1562 ++}
1563 ++
1564 + static const struct super_operations ceph_super_ops = {
1565 + .alloc_inode = ceph_alloc_inode,
1566 + .destroy_inode = ceph_destroy_inode,
1567 +@@ -775,6 +781,7 @@ static const struct super_operations ceph_super_ops = {
1568 + .drop_inode = ceph_drop_inode,
1569 + .sync_fs = ceph_sync_fs,
1570 + .put_super = ceph_put_super,
1571 ++ .remount_fs = ceph_remount,
1572 + .show_options = ceph_show_options,
1573 + .statfs = ceph_statfs,
1574 + .umount_begin = ceph_umount_begin,
1575 +diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
1576 +index 418062c7f040..23326b0cd562 100644
1577 +--- a/fs/cifs/smb2ops.c
1578 ++++ b/fs/cifs/smb2ops.c
1579 +@@ -1969,26 +1969,28 @@ smb21_set_oplock_level(struct cifsInodeInfo *cinode, __u32 oplock,
1580 + unsigned int epoch, bool *purge_cache)
1581 + {
1582 + char message[5] = {0};
1583 ++ unsigned int new_oplock = 0;
1584 +
1585 + oplock &= 0xFF;
1586 + if (oplock == SMB2_OPLOCK_LEVEL_NOCHANGE)
1587 + return;
1588 +
1589 +- cinode->oplock = 0;
1590 + if (oplock & SMB2_LEASE_READ_CACHING_HE) {
1591 +- cinode->oplock |= CIFS_CACHE_READ_FLG;
1592 ++ new_oplock |= CIFS_CACHE_READ_FLG;
1593 + strcat(message, "R");
1594 + }
1595 + if (oplock & SMB2_LEASE_HANDLE_CACHING_HE) {
1596 +- cinode->oplock |= CIFS_CACHE_HANDLE_FLG;
1597 ++ new_oplock |= CIFS_CACHE_HANDLE_FLG;
1598 + strcat(message, "H");
1599 + }
1600 + if (oplock & SMB2_LEASE_WRITE_CACHING_HE) {
1601 +- cinode->oplock |= CIFS_CACHE_WRITE_FLG;
1602 ++ new_oplock |= CIFS_CACHE_WRITE_FLG;
1603 + strcat(message, "W");
1604 + }
1605 +- if (!cinode->oplock)
1606 +- strcat(message, "None");
1607 ++ if (!new_oplock)
1608 ++ strncpy(message, "None", sizeof(message));
1609 ++
1610 ++ cinode->oplock = new_oplock;
1611 + cifs_dbg(FYI, "%s Lease granted on inode %p\n", message,
1612 + &cinode->vfs_inode);
1613 + }
1614 +diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
1615 +index 7936eac5a38a..fd2d199dd413 100644
1616 +--- a/fs/cifs/smb2pdu.c
1617 ++++ b/fs/cifs/smb2pdu.c
1618 +@@ -2699,7 +2699,6 @@ SMB2_read(const unsigned int xid, struct cifs_io_parms *io_parms,
1619 + cifs_dbg(VFS, "Send error in read = %d\n", rc);
1620 + }
1621 + free_rsp_buf(resp_buftype, rsp_iov.iov_base);
1622 +- cifs_small_buf_release(req);
1623 + return rc == -ENODATA ? 0 : rc;
1624 + }
1625 +
1626 +diff --git a/fs/fuse/file.c b/fs/fuse/file.c
1627 +index 19ea122a7d03..7882fc34113c 100644
1628 +--- a/fs/fuse/file.c
1629 ++++ b/fs/fuse/file.c
1630 +@@ -1525,7 +1525,7 @@ __acquires(fc->lock)
1631 + {
1632 + struct fuse_conn *fc = get_fuse_conn(inode);
1633 + struct fuse_inode *fi = get_fuse_inode(inode);
1634 +- size_t crop = i_size_read(inode);
1635 ++ loff_t crop = i_size_read(inode);
1636 + struct fuse_req *req;
1637 +
1638 + while (fi->writectr >= 0 && !list_empty(&fi->queued_writes)) {
1639 +@@ -2974,6 +2974,13 @@ static long fuse_file_fallocate(struct file *file, int mode, loff_t offset,
1640 + }
1641 + }
1642 +
1643 ++ if (!(mode & FALLOC_FL_KEEP_SIZE) &&
1644 ++ offset + length > i_size_read(inode)) {
1645 ++ err = inode_newsize_ok(inode, offset + length);
1646 ++ if (err)
1647 ++ return err;
1648 ++ }
1649 ++
1650 + if (!(mode & FALLOC_FL_KEEP_SIZE))
1651 + set_bit(FUSE_I_SIZE_UNSTABLE, &fi->state);
1652 +
1653 +diff --git a/fs/nfs/filelayout/filelayout.c b/fs/nfs/filelayout/filelayout.c
1654 +index 3db2b7464748..03da4e0b0098 100644
1655 +--- a/fs/nfs/filelayout/filelayout.c
1656 ++++ b/fs/nfs/filelayout/filelayout.c
1657 +@@ -904,7 +904,7 @@ fl_pnfs_update_layout(struct inode *ino,
1658 + status = filelayout_check_deviceid(lo, fl, gfp_flags);
1659 + if (status) {
1660 + pnfs_put_lseg(lseg);
1661 +- lseg = ERR_PTR(status);
1662 ++ lseg = NULL;
1663 + }
1664 + out:
1665 + return lseg;
1666 +diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
1667 +index e1d88bca815e..85ec07e4aa91 100644
1668 +--- a/fs/nfs/nfs4state.c
1669 ++++ b/fs/nfs/nfs4state.c
1670 +@@ -143,6 +143,10 @@ int nfs40_discover_server_trunking(struct nfs_client *clp,
1671 + /* Sustain the lease, even if it's empty. If the clientid4
1672 + * goes stale it's of no use for trunking discovery. */
1673 + nfs4_schedule_state_renewal(*result);
1674 ++
1675 ++ /* If the client state need to recover, do it. */
1676 ++ if (clp->cl_state)
1677 ++ nfs4_schedule_state_manager(clp);
1678 + }
1679 + out:
1680 + return status;
1681 +diff --git a/fs/ufs/util.h b/fs/ufs/util.h
1682 +index 1907be6d5808..f3092d513551 100644
1683 +--- a/fs/ufs/util.h
1684 ++++ b/fs/ufs/util.h
1685 +@@ -229,7 +229,7 @@ ufs_get_inode_gid(struct super_block *sb, struct ufs_inode *inode)
1686 + case UFS_UID_44BSD:
1687 + return fs32_to_cpu(sb, inode->ui_u3.ui_44.ui_gid);
1688 + case UFS_UID_EFT:
1689 +- if (inode->ui_u1.oldids.ui_suid == 0xFFFF)
1690 ++ if (inode->ui_u1.oldids.ui_sgid == 0xFFFF)
1691 + return fs32_to_cpu(sb, inode->ui_u3.ui_sun.ui_gid);
1692 + /* Fall through */
1693 + default:
1694 +diff --git a/include/linux/bpf.h b/include/linux/bpf.h
1695 +index c9d2a1a3ef11..e9e87599338e 100644
1696 +--- a/include/linux/bpf.h
1697 ++++ b/include/linux/bpf.h
1698 +@@ -28,6 +28,7 @@ struct bpf_map_ops {
1699 + void (*map_free)(struct bpf_map *map);
1700 + int (*map_get_next_key)(struct bpf_map *map, void *key, void *next_key);
1701 + void (*map_release_uref)(struct bpf_map *map);
1702 ++ void *(*map_lookup_elem_sys_only)(struct bpf_map *map, void *key);
1703 +
1704 + /* funcs callable from userspace and from eBPF programs */
1705 + void *(*map_lookup_elem)(struct bpf_map *map, void *key);
1706 +diff --git a/include/linux/of.h b/include/linux/of.h
1707 +index 70b7dacf9238..3c108f9be5e7 100644
1708 +--- a/include/linux/of.h
1709 ++++ b/include/linux/of.h
1710 +@@ -229,8 +229,8 @@ extern struct device_node *of_find_all_nodes(struct device_node *prev);
1711 + static inline u64 of_read_number(const __be32 *cell, int size)
1712 + {
1713 + u64 r = 0;
1714 +- while (size--)
1715 +- r = (r << 32) | be32_to_cpu(*(cell++));
1716 ++ for (; size--; cell++)
1717 ++ r = (r << 32) | be32_to_cpu(*cell);
1718 + return r;
1719 + }
1720 +
1721 +diff --git a/include/linux/pci.h b/include/linux/pci.h
1722 +index b1abbcc614cf..59f4d10568c6 100644
1723 +--- a/include/linux/pci.h
1724 ++++ b/include/linux/pci.h
1725 +@@ -350,6 +350,8 @@ struct pci_dev {
1726 + unsigned int hotplug_user_indicators:1; /* SlotCtl indicators
1727 + controlled exclusively by
1728 + user sysfs */
1729 ++ unsigned int clear_retrain_link:1; /* Need to clear Retrain Link
1730 ++ bit manually */
1731 + unsigned int d3_delay; /* D3->D0 transition time in ms */
1732 + unsigned int d3cold_delay; /* D3cold->D0 transition time in ms */
1733 +
1734 +diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
1735 +index 3172e14d9398..fdb0cd0699b6 100644
1736 +--- a/include/linux/skbuff.h
1737 ++++ b/include/linux/skbuff.h
1738 +@@ -1310,10 +1310,12 @@ static inline void skb_zcopy_clear(struct sk_buff *skb, bool zerocopy)
1739 + struct ubuf_info *uarg = skb_zcopy(skb);
1740 +
1741 + if (uarg) {
1742 +- if (uarg->callback == sock_zerocopy_callback) {
1743 ++ if (skb_zcopy_is_nouarg(skb)) {
1744 ++ /* no notification callback */
1745 ++ } else if (uarg->callback == sock_zerocopy_callback) {
1746 + uarg->zerocopy = uarg->zerocopy && zerocopy;
1747 + sock_zerocopy_put(uarg);
1748 +- } else if (!skb_zcopy_is_nouarg(skb)) {
1749 ++ } else {
1750 + uarg->callback(uarg, zerocopy);
1751 + }
1752 +
1753 +@@ -2572,7 +2574,8 @@ static inline int skb_orphan_frags(struct sk_buff *skb, gfp_t gfp_mask)
1754 + {
1755 + if (likely(!skb_zcopy(skb)))
1756 + return 0;
1757 +- if (skb_uarg(skb)->callback == sock_zerocopy_callback)
1758 ++ if (!skb_zcopy_is_nouarg(skb) &&
1759 ++ skb_uarg(skb)->callback == sock_zerocopy_callback)
1760 + return 0;
1761 + return skb_copy_ubufs(skb, gfp_mask);
1762 + }
1763 +diff --git a/kernel/bpf/hashtab.c b/kernel/bpf/hashtab.c
1764 +index 84237f640789..505e69854eb8 100644
1765 +--- a/kernel/bpf/hashtab.c
1766 ++++ b/kernel/bpf/hashtab.c
1767 +@@ -498,18 +498,30 @@ static u32 htab_map_gen_lookup(struct bpf_map *map, struct bpf_insn *insn_buf)
1768 + return insn - insn_buf;
1769 + }
1770 +
1771 +-static void *htab_lru_map_lookup_elem(struct bpf_map *map, void *key)
1772 ++static __always_inline void *__htab_lru_map_lookup_elem(struct bpf_map *map,
1773 ++ void *key, const bool mark)
1774 + {
1775 + struct htab_elem *l = __htab_map_lookup_elem(map, key);
1776 +
1777 + if (l) {
1778 +- bpf_lru_node_set_ref(&l->lru_node);
1779 ++ if (mark)
1780 ++ bpf_lru_node_set_ref(&l->lru_node);
1781 + return l->key + round_up(map->key_size, 8);
1782 + }
1783 +
1784 + return NULL;
1785 + }
1786 +
1787 ++static void *htab_lru_map_lookup_elem(struct bpf_map *map, void *key)
1788 ++{
1789 ++ return __htab_lru_map_lookup_elem(map, key, true);
1790 ++}
1791 ++
1792 ++static void *htab_lru_map_lookup_elem_sys(struct bpf_map *map, void *key)
1793 ++{
1794 ++ return __htab_lru_map_lookup_elem(map, key, false);
1795 ++}
1796 ++
1797 + static u32 htab_lru_map_gen_lookup(struct bpf_map *map,
1798 + struct bpf_insn *insn_buf)
1799 + {
1800 +@@ -1160,6 +1172,7 @@ const struct bpf_map_ops htab_lru_map_ops = {
1801 + .map_free = htab_map_free,
1802 + .map_get_next_key = htab_map_get_next_key,
1803 + .map_lookup_elem = htab_lru_map_lookup_elem,
1804 ++ .map_lookup_elem_sys_only = htab_lru_map_lookup_elem_sys,
1805 + .map_update_elem = htab_lru_map_update_elem,
1806 + .map_delete_elem = htab_lru_map_delete_elem,
1807 + .map_gen_lookup = htab_lru_map_gen_lookup,
1808 +@@ -1190,7 +1203,6 @@ static void *htab_lru_percpu_map_lookup_elem(struct bpf_map *map, void *key)
1809 +
1810 + int bpf_percpu_hash_copy(struct bpf_map *map, void *key, void *value)
1811 + {
1812 +- struct bpf_htab *htab = container_of(map, struct bpf_htab, map);
1813 + struct htab_elem *l;
1814 + void __percpu *pptr;
1815 + int ret = -ENOENT;
1816 +@@ -1206,8 +1218,9 @@ int bpf_percpu_hash_copy(struct bpf_map *map, void *key, void *value)
1817 + l = __htab_map_lookup_elem(map, key);
1818 + if (!l)
1819 + goto out;
1820 +- if (htab_is_lru(htab))
1821 +- bpf_lru_node_set_ref(&l->lru_node);
1822 ++ /* We do not mark LRU map element here in order to not mess up
1823 ++ * eviction heuristics when user space does a map walk.
1824 ++ */
1825 + pptr = htab_elem_get_ptr(l, map->key_size);
1826 + for_each_possible_cpu(cpu) {
1827 + bpf_long_memcpy(value + off,
1828 +diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c
1829 +index 5c9deed4524e..2d828d346982 100644
1830 +--- a/kernel/bpf/syscall.c
1831 ++++ b/kernel/bpf/syscall.c
1832 +@@ -493,7 +493,10 @@ static int map_lookup_elem(union bpf_attr *attr)
1833 + err = bpf_fd_htab_map_lookup_elem(map, key, value);
1834 + } else {
1835 + rcu_read_lock();
1836 +- ptr = map->ops->map_lookup_elem(map, key);
1837 ++ if (map->ops->map_lookup_elem_sys_only)
1838 ++ ptr = map->ops->map_lookup_elem_sys_only(map, key);
1839 ++ else
1840 ++ ptr = map->ops->map_lookup_elem(map, key);
1841 + if (ptr)
1842 + memcpy(value, ptr, value_size);
1843 + rcu_read_unlock();
1844 +diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c
1845 +index b314c9eaa71d..f8c45d30ec6d 100644
1846 +--- a/kernel/sched/cpufreq_schedutil.c
1847 ++++ b/kernel/sched/cpufreq_schedutil.c
1848 +@@ -600,6 +600,7 @@ out:
1849 + return 0;
1850 +
1851 + fail:
1852 ++ kobject_put(&tunables->attr_set.kobj);
1853 + policy->governor_data = NULL;
1854 + sugov_tunables_free(tunables);
1855 +
1856 +diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
1857 +index d53268a4e167..654a1587f6dd 100644
1858 +--- a/kernel/trace/trace_events.c
1859 ++++ b/kernel/trace/trace_events.c
1860 +@@ -1319,9 +1319,6 @@ event_id_read(struct file *filp, char __user *ubuf, size_t cnt, loff_t *ppos)
1861 + char buf[32];
1862 + int len;
1863 +
1864 +- if (*ppos)
1865 +- return 0;
1866 +-
1867 + if (unlikely(!id))
1868 + return -ENODEV;
1869 +
1870 +diff --git a/lib/Makefile b/lib/Makefile
1871 +index b1ac45032903..4ea31c2d982d 100644
1872 +--- a/lib/Makefile
1873 ++++ b/lib/Makefile
1874 +@@ -17,6 +17,17 @@ KCOV_INSTRUMENT_list_debug.o := n
1875 + KCOV_INSTRUMENT_debugobjects.o := n
1876 + KCOV_INSTRUMENT_dynamic_debug.o := n
1877 +
1878 ++# Early boot use of cmdline, don't instrument it
1879 ++ifdef CONFIG_AMD_MEM_ENCRYPT
1880 ++KASAN_SANITIZE_string.o := n
1881 ++
1882 ++ifdef CONFIG_FUNCTION_TRACER
1883 ++CFLAGS_REMOVE_string.o = -pg
1884 ++endif
1885 ++
1886 ++CFLAGS_string.o := $(call cc-option, -fno-stack-protector)
1887 ++endif
1888 ++
1889 + lib-y := ctype.o string.o vsprintf.o cmdline.o \
1890 + rbtree.o radix-tree.o dump_stack.o timerqueue.o\
1891 + idr.o int_sqrt.o extable.o \
1892 +diff --git a/net/core/dev.c b/net/core/dev.c
1893 +index 90ec30d5b851..1212c814b3bc 100644
1894 +--- a/net/core/dev.c
1895 ++++ b/net/core/dev.c
1896 +@@ -7852,7 +7852,7 @@ static void netdev_wait_allrefs(struct net_device *dev)
1897 +
1898 + refcnt = netdev_refcnt_read(dev);
1899 +
1900 +- if (time_after(jiffies, warning_time + 10 * HZ)) {
1901 ++ if (refcnt && time_after(jiffies, warning_time + 10 * HZ)) {
1902 + pr_emerg("unregister_netdevice: waiting for %s to become free. Usage count = %d\n",
1903 + dev->name, refcnt);
1904 + warning_time = jiffies;
1905 +diff --git a/net/ipv4/esp4.c b/net/ipv4/esp4.c
1906 +index d30285c5d52d..c8e32f167ebb 100644
1907 +--- a/net/ipv4/esp4.c
1908 ++++ b/net/ipv4/esp4.c
1909 +@@ -205,7 +205,7 @@ static void esp_output_fill_trailer(u8 *tail, int tfclen, int plen, __u8 proto)
1910 + tail[plen - 1] = proto;
1911 + }
1912 +
1913 +-static void esp_output_udp_encap(struct xfrm_state *x, struct sk_buff *skb, struct esp_info *esp)
1914 ++static int esp_output_udp_encap(struct xfrm_state *x, struct sk_buff *skb, struct esp_info *esp)
1915 + {
1916 + int encap_type;
1917 + struct udphdr *uh;
1918 +@@ -213,6 +213,7 @@ static void esp_output_udp_encap(struct xfrm_state *x, struct sk_buff *skb, stru
1919 + __be16 sport, dport;
1920 + struct xfrm_encap_tmpl *encap = x->encap;
1921 + struct ip_esp_hdr *esph = esp->esph;
1922 ++ unsigned int len;
1923 +
1924 + spin_lock_bh(&x->lock);
1925 + sport = encap->encap_sport;
1926 +@@ -220,11 +221,14 @@ static void esp_output_udp_encap(struct xfrm_state *x, struct sk_buff *skb, stru
1927 + encap_type = encap->encap_type;
1928 + spin_unlock_bh(&x->lock);
1929 +
1930 ++ len = skb->len + esp->tailen - skb_transport_offset(skb);
1931 ++ if (len + sizeof(struct iphdr) >= IP_MAX_MTU)
1932 ++ return -EMSGSIZE;
1933 ++
1934 + uh = (struct udphdr *)esph;
1935 + uh->source = sport;
1936 + uh->dest = dport;
1937 +- uh->len = htons(skb->len + esp->tailen
1938 +- - skb_transport_offset(skb));
1939 ++ uh->len = htons(len);
1940 + uh->check = 0;
1941 +
1942 + switch (encap_type) {
1943 +@@ -241,6 +245,8 @@ static void esp_output_udp_encap(struct xfrm_state *x, struct sk_buff *skb, stru
1944 +
1945 + *skb_mac_header(skb) = IPPROTO_UDP;
1946 + esp->esph = esph;
1947 ++
1948 ++ return 0;
1949 + }
1950 +
1951 + int esp_output_head(struct xfrm_state *x, struct sk_buff *skb, struct esp_info *esp)
1952 +@@ -254,8 +260,12 @@ int esp_output_head(struct xfrm_state *x, struct sk_buff *skb, struct esp_info *
1953 + int tailen = esp->tailen;
1954 +
1955 + /* this is non-NULL only with UDP Encapsulation */
1956 +- if (x->encap)
1957 +- esp_output_udp_encap(x, skb, esp);
1958 ++ if (x->encap) {
1959 ++ int err = esp_output_udp_encap(x, skb, esp);
1960 ++
1961 ++ if (err < 0)
1962 ++ return err;
1963 ++ }
1964 +
1965 + if (!skb_cloned(skb)) {
1966 + if (tailen <= skb_tailroom(skb)) {
1967 +diff --git a/net/ipv4/ip_vti.c b/net/ipv4/ip_vti.c
1968 +index 306603a7f351..c07065b7e3b0 100644
1969 +--- a/net/ipv4/ip_vti.c
1970 ++++ b/net/ipv4/ip_vti.c
1971 +@@ -663,9 +663,9 @@ static int __init vti_init(void)
1972 + return err;
1973 +
1974 + rtnl_link_failed:
1975 +- xfrm4_protocol_deregister(&vti_ipcomp4_protocol, IPPROTO_COMP);
1976 +-xfrm_tunnel_failed:
1977 + xfrm4_tunnel_deregister(&ipip_handler, AF_INET);
1978 ++xfrm_tunnel_failed:
1979 ++ xfrm4_protocol_deregister(&vti_ipcomp4_protocol, IPPROTO_COMP);
1980 + xfrm_proto_comp_failed:
1981 + xfrm4_protocol_deregister(&vti_ah4_protocol, IPPROTO_AH);
1982 + xfrm_proto_ah_failed:
1983 +@@ -680,6 +680,7 @@ pernet_dev_failed:
1984 + static void __exit vti_fini(void)
1985 + {
1986 + rtnl_link_unregister(&vti_link_ops);
1987 ++ xfrm4_tunnel_deregister(&ipip_handler, AF_INET);
1988 + xfrm4_protocol_deregister(&vti_ipcomp4_protocol, IPPROTO_COMP);
1989 + xfrm4_protocol_deregister(&vti_ah4_protocol, IPPROTO_AH);
1990 + xfrm4_protocol_deregister(&vti_esp4_protocol, IPPROTO_ESP);
1991 +diff --git a/net/ipv4/xfrm4_policy.c b/net/ipv4/xfrm4_policy.c
1992 +index 4b586e7d5637..5952dca98e6b 100644
1993 +--- a/net/ipv4/xfrm4_policy.c
1994 ++++ b/net/ipv4/xfrm4_policy.c
1995 +@@ -111,7 +111,8 @@ static void
1996 + _decode_session4(struct sk_buff *skb, struct flowi *fl, int reverse)
1997 + {
1998 + const struct iphdr *iph = ip_hdr(skb);
1999 +- u8 *xprth = skb_network_header(skb) + iph->ihl * 4;
2000 ++ int ihl = iph->ihl;
2001 ++ u8 *xprth = skb_network_header(skb) + ihl * 4;
2002 + struct flowi4 *fl4 = &fl->u.ip4;
2003 + int oif = 0;
2004 +
2005 +@@ -122,6 +123,11 @@ _decode_session4(struct sk_buff *skb, struct flowi *fl, int reverse)
2006 + fl4->flowi4_mark = skb->mark;
2007 + fl4->flowi4_oif = reverse ? skb->skb_iif : oif;
2008 +
2009 ++ fl4->flowi4_proto = iph->protocol;
2010 ++ fl4->daddr = reverse ? iph->saddr : iph->daddr;
2011 ++ fl4->saddr = reverse ? iph->daddr : iph->saddr;
2012 ++ fl4->flowi4_tos = iph->tos;
2013 ++
2014 + if (!ip_is_fragment(iph)) {
2015 + switch (iph->protocol) {
2016 + case IPPROTO_UDP:
2017 +@@ -133,7 +139,7 @@ _decode_session4(struct sk_buff *skb, struct flowi *fl, int reverse)
2018 + pskb_may_pull(skb, xprth + 4 - skb->data)) {
2019 + __be16 *ports;
2020 +
2021 +- xprth = skb_network_header(skb) + iph->ihl * 4;
2022 ++ xprth = skb_network_header(skb) + ihl * 4;
2023 + ports = (__be16 *)xprth;
2024 +
2025 + fl4->fl4_sport = ports[!!reverse];
2026 +@@ -146,7 +152,7 @@ _decode_session4(struct sk_buff *skb, struct flowi *fl, int reverse)
2027 + pskb_may_pull(skb, xprth + 2 - skb->data)) {
2028 + u8 *icmp;
2029 +
2030 +- xprth = skb_network_header(skb) + iph->ihl * 4;
2031 ++ xprth = skb_network_header(skb) + ihl * 4;
2032 + icmp = xprth;
2033 +
2034 + fl4->fl4_icmp_type = icmp[0];
2035 +@@ -159,7 +165,7 @@ _decode_session4(struct sk_buff *skb, struct flowi *fl, int reverse)
2036 + pskb_may_pull(skb, xprth + 4 - skb->data)) {
2037 + __be32 *ehdr;
2038 +
2039 +- xprth = skb_network_header(skb) + iph->ihl * 4;
2040 ++ xprth = skb_network_header(skb) + ihl * 4;
2041 + ehdr = (__be32 *)xprth;
2042 +
2043 + fl4->fl4_ipsec_spi = ehdr[0];
2044 +@@ -171,7 +177,7 @@ _decode_session4(struct sk_buff *skb, struct flowi *fl, int reverse)
2045 + pskb_may_pull(skb, xprth + 8 - skb->data)) {
2046 + __be32 *ah_hdr;
2047 +
2048 +- xprth = skb_network_header(skb) + iph->ihl * 4;
2049 ++ xprth = skb_network_header(skb) + ihl * 4;
2050 + ah_hdr = (__be32 *)xprth;
2051 +
2052 + fl4->fl4_ipsec_spi = ah_hdr[1];
2053 +@@ -183,7 +189,7 @@ _decode_session4(struct sk_buff *skb, struct flowi *fl, int reverse)
2054 + pskb_may_pull(skb, xprth + 4 - skb->data)) {
2055 + __be16 *ipcomp_hdr;
2056 +
2057 +- xprth = skb_network_header(skb) + iph->ihl * 4;
2058 ++ xprth = skb_network_header(skb) + ihl * 4;
2059 + ipcomp_hdr = (__be16 *)xprth;
2060 +
2061 + fl4->fl4_ipsec_spi = htonl(ntohs(ipcomp_hdr[1]));
2062 +@@ -196,7 +202,7 @@ _decode_session4(struct sk_buff *skb, struct flowi *fl, int reverse)
2063 + __be16 *greflags;
2064 + __be32 *gre_hdr;
2065 +
2066 +- xprth = skb_network_header(skb) + iph->ihl * 4;
2067 ++ xprth = skb_network_header(skb) + ihl * 4;
2068 + greflags = (__be16 *)xprth;
2069 + gre_hdr = (__be32 *)xprth;
2070 +
2071 +@@ -213,10 +219,6 @@ _decode_session4(struct sk_buff *skb, struct flowi *fl, int reverse)
2072 + break;
2073 + }
2074 + }
2075 +- fl4->flowi4_proto = iph->protocol;
2076 +- fl4->daddr = reverse ? iph->saddr : iph->daddr;
2077 +- fl4->saddr = reverse ? iph->daddr : iph->saddr;
2078 +- fl4->flowi4_tos = iph->tos;
2079 + }
2080 +
2081 + static void xfrm4_update_pmtu(struct dst_entry *dst, struct sock *sk,
2082 +diff --git a/net/ipv6/xfrm6_tunnel.c b/net/ipv6/xfrm6_tunnel.c
2083 +index c28e3eaad7c2..b51368ebd1e6 100644
2084 +--- a/net/ipv6/xfrm6_tunnel.c
2085 ++++ b/net/ipv6/xfrm6_tunnel.c
2086 +@@ -391,6 +391,10 @@ static void __exit xfrm6_tunnel_fini(void)
2087 + xfrm6_tunnel_deregister(&xfrm6_tunnel_handler, AF_INET6);
2088 + xfrm_unregister_type(&xfrm6_tunnel_type, AF_INET6);
2089 + unregister_pernet_subsys(&xfrm6_tunnel_net_ops);
2090 ++ /* Someone maybe has gotten the xfrm6_tunnel_spi.
2091 ++ * So need to wait it.
2092 ++ */
2093 ++ rcu_barrier();
2094 + kmem_cache_destroy(xfrm6_tunnel_spi_kmem);
2095 + }
2096 +
2097 +diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
2098 +index 222c063244f5..6ce13e976b7a 100644
2099 +--- a/net/mac80211/iface.c
2100 ++++ b/net/mac80211/iface.c
2101 +@@ -1924,6 +1924,9 @@ void ieee80211_if_remove(struct ieee80211_sub_if_data *sdata)
2102 + list_del_rcu(&sdata->list);
2103 + mutex_unlock(&sdata->local->iflist_mtx);
2104 +
2105 ++ if (sdata->vif.txq)
2106 ++ ieee80211_txq_purge(sdata->local, to_txq_info(sdata->vif.txq));
2107 ++
2108 + synchronize_rcu();
2109 +
2110 + if (sdata->dev) {
2111 +diff --git a/net/tipc/core.c b/net/tipc/core.c
2112 +index 0b982d048fb9..297430beaa7f 100644
2113 +--- a/net/tipc/core.c
2114 ++++ b/net/tipc/core.c
2115 +@@ -62,6 +62,10 @@ static int __net_init tipc_init_net(struct net *net)
2116 + INIT_LIST_HEAD(&tn->node_list);
2117 + spin_lock_init(&tn->node_list_lock);
2118 +
2119 ++ err = tipc_socket_init();
2120 ++ if (err)
2121 ++ goto out_socket;
2122 ++
2123 + err = tipc_sk_rht_init(net);
2124 + if (err)
2125 + goto out_sk_rht;
2126 +@@ -88,6 +92,8 @@ out_subscr:
2127 + out_nametbl:
2128 + tipc_sk_rht_destroy(net);
2129 + out_sk_rht:
2130 ++ tipc_socket_stop();
2131 ++out_socket:
2132 + return err;
2133 + }
2134 +
2135 +@@ -98,6 +104,7 @@ static void __net_exit tipc_exit_net(struct net *net)
2136 + tipc_bcast_stop(net);
2137 + tipc_nametbl_stop(net);
2138 + tipc_sk_rht_destroy(net);
2139 ++ tipc_socket_stop();
2140 + }
2141 +
2142 + static struct pernet_operations tipc_net_ops = {
2143 +@@ -125,10 +132,6 @@ static int __init tipc_init(void)
2144 + if (err)
2145 + goto out_netlink_compat;
2146 +
2147 +- err = tipc_socket_init();
2148 +- if (err)
2149 +- goto out_socket;
2150 +-
2151 + err = tipc_register_sysctl();
2152 + if (err)
2153 + goto out_sysctl;
2154 +@@ -148,8 +151,6 @@ out_bearer:
2155 + out_pernet:
2156 + tipc_unregister_sysctl();
2157 + out_sysctl:
2158 +- tipc_socket_stop();
2159 +-out_socket:
2160 + tipc_netlink_compat_stop();
2161 + out_netlink_compat:
2162 + tipc_netlink_stop();
2163 +@@ -164,7 +165,6 @@ static void __exit tipc_exit(void)
2164 + unregister_pernet_subsys(&tipc_net_ops);
2165 + tipc_netlink_stop();
2166 + tipc_netlink_compat_stop();
2167 +- tipc_socket_stop();
2168 + tipc_unregister_sysctl();
2169 +
2170 + pr_info("Deactivated\n");
2171 +diff --git a/net/vmw_vsock/virtio_transport.c b/net/vmw_vsock/virtio_transport.c
2172 +index 2ff751eba037..5ebeef8ae3fa 100644
2173 +--- a/net/vmw_vsock/virtio_transport.c
2174 ++++ b/net/vmw_vsock/virtio_transport.c
2175 +@@ -702,28 +702,27 @@ static int __init virtio_vsock_init(void)
2176 + if (!virtio_vsock_workqueue)
2177 + return -ENOMEM;
2178 +
2179 +- ret = register_virtio_driver(&virtio_vsock_driver);
2180 ++ ret = vsock_core_init(&virtio_transport.transport);
2181 + if (ret)
2182 + goto out_wq;
2183 +
2184 +- ret = vsock_core_init(&virtio_transport.transport);
2185 ++ ret = register_virtio_driver(&virtio_vsock_driver);
2186 + if (ret)
2187 +- goto out_vdr;
2188 ++ goto out_vci;
2189 +
2190 + return 0;
2191 +
2192 +-out_vdr:
2193 +- unregister_virtio_driver(&virtio_vsock_driver);
2194 ++out_vci:
2195 ++ vsock_core_exit();
2196 + out_wq:
2197 + destroy_workqueue(virtio_vsock_workqueue);
2198 + return ret;
2199 +-
2200 + }
2201 +
2202 + static void __exit virtio_vsock_exit(void)
2203 + {
2204 +- vsock_core_exit();
2205 + unregister_virtio_driver(&virtio_vsock_driver);
2206 ++ vsock_core_exit();
2207 + destroy_workqueue(virtio_vsock_workqueue);
2208 + }
2209 +
2210 +diff --git a/net/vmw_vsock/virtio_transport_common.c b/net/vmw_vsock/virtio_transport_common.c
2211 +index 40a8731c663b..84d3c0aadd73 100644
2212 +--- a/net/vmw_vsock/virtio_transport_common.c
2213 ++++ b/net/vmw_vsock/virtio_transport_common.c
2214 +@@ -786,12 +786,19 @@ static bool virtio_transport_close(struct vsock_sock *vsk)
2215 +
2216 + void virtio_transport_release(struct vsock_sock *vsk)
2217 + {
2218 ++ struct virtio_vsock_sock *vvs = vsk->trans;
2219 ++ struct virtio_vsock_pkt *pkt, *tmp;
2220 + struct sock *sk = &vsk->sk;
2221 + bool remove_sock = true;
2222 +
2223 + lock_sock(sk);
2224 + if (sk->sk_type == SOCK_STREAM)
2225 + remove_sock = virtio_transport_close(vsk);
2226 ++
2227 ++ list_for_each_entry_safe(pkt, tmp, &vvs->rx_queue, list) {
2228 ++ list_del(&pkt->list);
2229 ++ virtio_transport_free_pkt(pkt);
2230 ++ }
2231 + release_sock(sk);
2232 +
2233 + if (remove_sock)
2234 +diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
2235 +index 9ff9255d2191..919b8406028c 100644
2236 +--- a/net/xfrm/xfrm_user.c
2237 ++++ b/net/xfrm/xfrm_user.c
2238 +@@ -1381,7 +1381,7 @@ static int verify_newpolicy_info(struct xfrm_userpolicy_info *p)
2239 + ret = verify_policy_dir(p->dir);
2240 + if (ret)
2241 + return ret;
2242 +- if (p->index && ((p->index & XFRM_POLICY_MAX) != p->dir))
2243 ++ if (p->index && (xfrm_policy_id2dir(p->index) != p->dir))
2244 + return -EINVAL;
2245 +
2246 + return 0;
2247 +diff --git a/security/apparmor/apparmorfs.c b/security/apparmor/apparmorfs.c
2248 +index 0e03377bb83e..dd746bd69a9b 100644
2249 +--- a/security/apparmor/apparmorfs.c
2250 ++++ b/security/apparmor/apparmorfs.c
2251 +@@ -126,17 +126,22 @@ static int aafs_show_path(struct seq_file *seq, struct dentry *dentry)
2252 + return 0;
2253 + }
2254 +
2255 +-static void aafs_evict_inode(struct inode *inode)
2256 ++static void aafs_i_callback(struct rcu_head *head)
2257 + {
2258 +- truncate_inode_pages_final(&inode->i_data);
2259 +- clear_inode(inode);
2260 ++ struct inode *inode = container_of(head, struct inode, i_rcu);
2261 + if (S_ISLNK(inode->i_mode))
2262 + kfree(inode->i_link);
2263 ++ free_inode_nonrcu(inode);
2264 ++}
2265 ++
2266 ++static void aafs_destroy_inode(struct inode *inode)
2267 ++{
2268 ++ call_rcu(&inode->i_rcu, aafs_i_callback);
2269 + }
2270 +
2271 + static const struct super_operations aafs_super_ops = {
2272 + .statfs = simple_statfs,
2273 +- .evict_inode = aafs_evict_inode,
2274 ++ .destroy_inode = aafs_destroy_inode,
2275 + .show_path = aafs_show_path,
2276 + };
2277 +
2278 +diff --git a/security/inode.c b/security/inode.c
2279 +index 8dd9ca8848e4..829f15672e01 100644
2280 +--- a/security/inode.c
2281 ++++ b/security/inode.c
2282 +@@ -26,17 +26,22 @@
2283 + static struct vfsmount *mount;
2284 + static int mount_count;
2285 +
2286 +-static void securityfs_evict_inode(struct inode *inode)
2287 ++static void securityfs_i_callback(struct rcu_head *head)
2288 + {
2289 +- truncate_inode_pages_final(&inode->i_data);
2290 +- clear_inode(inode);
2291 ++ struct inode *inode = container_of(head, struct inode, i_rcu);
2292 + if (S_ISLNK(inode->i_mode))
2293 + kfree(inode->i_link);
2294 ++ free_inode_nonrcu(inode);
2295 ++}
2296 ++
2297 ++static void securityfs_destroy_inode(struct inode *inode)
2298 ++{
2299 ++ call_rcu(&inode->i_rcu, securityfs_i_callback);
2300 + }
2301 +
2302 + static const struct super_operations securityfs_super_operations = {
2303 + .statfs = simple_statfs,
2304 +- .evict_inode = securityfs_evict_inode,
2305 ++ .destroy_inode = securityfs_destroy_inode,
2306 + };
2307 +
2308 + static int fill_super(struct super_block *sb, void *data, int silent)
2309 +diff --git a/tools/objtool/Makefile b/tools/objtool/Makefile
2310 +index 8ae824dbfca3..884d4f1ed0c1 100644
2311 +--- a/tools/objtool/Makefile
2312 ++++ b/tools/objtool/Makefile
2313 +@@ -7,11 +7,12 @@ ARCH := x86
2314 + endif
2315 +
2316 + # always use the host compiler
2317 ++HOSTAR ?= ar
2318 + HOSTCC ?= gcc
2319 + HOSTLD ?= ld
2320 ++AR = $(HOSTAR)
2321 + CC = $(HOSTCC)
2322 + LD = $(HOSTLD)
2323 +-AR = ar
2324 +
2325 + ifeq ($(srctree),)
2326 + srctree := $(patsubst %/,%,$(dir $(CURDIR)))
2327 +diff --git a/tools/perf/bench/numa.c b/tools/perf/bench/numa.c
2328 +index 0afcc7eccc61..997875c770b1 100644
2329 +--- a/tools/perf/bench/numa.c
2330 ++++ b/tools/perf/bench/numa.c
2331 +@@ -38,6 +38,10 @@
2332 + #include <numa.h>
2333 + #include <numaif.h>
2334 +
2335 ++#ifndef RUSAGE_THREAD
2336 ++# define RUSAGE_THREAD 1
2337 ++#endif
2338 ++
2339 + /*
2340 + * Regular printout to the terminal, supressed if -q is specified:
2341 + */
2342 +diff --git a/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c b/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c
2343 +index 0bc3e6e93c31..4357141c7c92 100644
2344 +--- a/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c
2345 ++++ b/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c
2346 +@@ -58,6 +58,7 @@ enum intel_pt_pkt_state {
2347 + INTEL_PT_STATE_NO_IP,
2348 + INTEL_PT_STATE_ERR_RESYNC,
2349 + INTEL_PT_STATE_IN_SYNC,
2350 ++ INTEL_PT_STATE_TNT_CONT,
2351 + INTEL_PT_STATE_TNT,
2352 + INTEL_PT_STATE_TIP,
2353 + INTEL_PT_STATE_TIP_PGD,
2354 +@@ -72,8 +73,9 @@ static inline bool intel_pt_sample_time(enum intel_pt_pkt_state pkt_state)
2355 + case INTEL_PT_STATE_NO_IP:
2356 + case INTEL_PT_STATE_ERR_RESYNC:
2357 + case INTEL_PT_STATE_IN_SYNC:
2358 +- case INTEL_PT_STATE_TNT:
2359 ++ case INTEL_PT_STATE_TNT_CONT:
2360 + return true;
2361 ++ case INTEL_PT_STATE_TNT:
2362 + case INTEL_PT_STATE_TIP:
2363 + case INTEL_PT_STATE_TIP_PGD:
2364 + case INTEL_PT_STATE_FUP:
2365 +@@ -888,16 +890,20 @@ static uint64_t intel_pt_next_period(struct intel_pt_decoder *decoder)
2366 + timestamp = decoder->timestamp + decoder->timestamp_insn_cnt;
2367 + masked_timestamp = timestamp & decoder->period_mask;
2368 + if (decoder->continuous_period) {
2369 +- if (masked_timestamp != decoder->last_masked_timestamp)
2370 ++ if (masked_timestamp > decoder->last_masked_timestamp)
2371 + return 1;
2372 + } else {
2373 + timestamp += 1;
2374 + masked_timestamp = timestamp & decoder->period_mask;
2375 +- if (masked_timestamp != decoder->last_masked_timestamp) {
2376 ++ if (masked_timestamp > decoder->last_masked_timestamp) {
2377 + decoder->last_masked_timestamp = masked_timestamp;
2378 + decoder->continuous_period = true;
2379 + }
2380 + }
2381 ++
2382 ++ if (masked_timestamp < decoder->last_masked_timestamp)
2383 ++ return decoder->period_ticks;
2384 ++
2385 + return decoder->period_ticks - (timestamp - masked_timestamp);
2386 + }
2387 +
2388 +@@ -926,7 +932,10 @@ static void intel_pt_sample_insn(struct intel_pt_decoder *decoder)
2389 + case INTEL_PT_PERIOD_TICKS:
2390 + timestamp = decoder->timestamp + decoder->timestamp_insn_cnt;
2391 + masked_timestamp = timestamp & decoder->period_mask;
2392 +- decoder->last_masked_timestamp = masked_timestamp;
2393 ++ if (masked_timestamp > decoder->last_masked_timestamp)
2394 ++ decoder->last_masked_timestamp = masked_timestamp;
2395 ++ else
2396 ++ decoder->last_masked_timestamp += decoder->period_ticks;
2397 + break;
2398 + case INTEL_PT_PERIOD_NONE:
2399 + case INTEL_PT_PERIOD_MTC:
2400 +@@ -1249,7 +1258,9 @@ static int intel_pt_walk_tnt(struct intel_pt_decoder *decoder)
2401 + return -ENOENT;
2402 + }
2403 + decoder->tnt.count -= 1;
2404 +- if (!decoder->tnt.count)
2405 ++ if (decoder->tnt.count)
2406 ++ decoder->pkt_state = INTEL_PT_STATE_TNT_CONT;
2407 ++ else
2408 + decoder->pkt_state = INTEL_PT_STATE_IN_SYNC;
2409 + decoder->tnt.payload <<= 1;
2410 + decoder->state.from_ip = decoder->ip;
2411 +@@ -1280,7 +1291,9 @@ static int intel_pt_walk_tnt(struct intel_pt_decoder *decoder)
2412 +
2413 + if (intel_pt_insn.branch == INTEL_PT_BR_CONDITIONAL) {
2414 + decoder->tnt.count -= 1;
2415 +- if (!decoder->tnt.count)
2416 ++ if (decoder->tnt.count)
2417 ++ decoder->pkt_state = INTEL_PT_STATE_TNT_CONT;
2418 ++ else
2419 + decoder->pkt_state = INTEL_PT_STATE_IN_SYNC;
2420 + if (decoder->tnt.payload & BIT63) {
2421 + decoder->tnt.payload <<= 1;
2422 +@@ -1300,8 +1313,11 @@ static int intel_pt_walk_tnt(struct intel_pt_decoder *decoder)
2423 + return 0;
2424 + }
2425 + decoder->ip += intel_pt_insn.length;
2426 +- if (!decoder->tnt.count)
2427 ++ if (!decoder->tnt.count) {
2428 ++ decoder->sample_timestamp = decoder->timestamp;
2429 ++ decoder->sample_insn_cnt = decoder->timestamp_insn_cnt;
2430 + return -EAGAIN;
2431 ++ }
2432 + decoder->tnt.payload <<= 1;
2433 + continue;
2434 + }
2435 +@@ -2349,6 +2365,7 @@ const struct intel_pt_state *intel_pt_decode(struct intel_pt_decoder *decoder)
2436 + err = intel_pt_walk_trace(decoder);
2437 + break;
2438 + case INTEL_PT_STATE_TNT:
2439 ++ case INTEL_PT_STATE_TNT_CONT:
2440 + err = intel_pt_walk_tnt(decoder);
2441 + if (err == -EAGAIN)
2442 + err = intel_pt_walk_trace(decoder);
2443 +diff --git a/virt/kvm/arm/arm.c b/virt/kvm/arm/arm.c
2444 +index 32aa88c19b8d..4154f98b337c 100644
2445 +--- a/virt/kvm/arm/arm.c
2446 ++++ b/virt/kvm/arm/arm.c
2447 +@@ -856,7 +856,7 @@ int kvm_vm_ioctl_irq_line(struct kvm *kvm, struct kvm_irq_level *irq_level,
2448 + static int kvm_vcpu_set_target(struct kvm_vcpu *vcpu,
2449 + const struct kvm_vcpu_init *init)
2450 + {
2451 +- unsigned int i;
2452 ++ unsigned int i, ret;
2453 + int phys_target = kvm_target_cpu();
2454 +
2455 + if (init->target != phys_target)
2456 +@@ -891,9 +891,14 @@ static int kvm_vcpu_set_target(struct kvm_vcpu *vcpu,
2457 + vcpu->arch.target = phys_target;
2458 +
2459 + /* Now we know what it is, we can reset it. */
2460 +- return kvm_reset_vcpu(vcpu);
2461 +-}
2462 ++ ret = kvm_reset_vcpu(vcpu);
2463 ++ if (ret) {
2464 ++ vcpu->arch.target = -1;
2465 ++ bitmap_zero(vcpu->arch.features, KVM_VCPU_MAX_FEATURES);
2466 ++ }
2467 +
2468 ++ return ret;
2469 ++}
2470 +
2471 + static int kvm_arch_vcpu_ioctl_vcpu_init(struct kvm_vcpu *vcpu,
2472 + struct kvm_vcpu_init *init)