Gentoo Archives: gentoo-commits

From: Mike Pagano <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/linux-patches:4.15 commit in: /
Date: Wed, 28 Mar 2018 17:03:52
Message-Id: 1522256620.dfca21c3d8cf051f97cc37a7e27b7640b98e0472.mpagano@gentoo
1 commit: dfca21c3d8cf051f97cc37a7e27b7640b98e0472
2 Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
3 AuthorDate: Wed Mar 28 17:03:40 2018 +0000
4 Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
5 CommitDate: Wed Mar 28 17:03:40 2018 +0000
6 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=dfca21c3
7
8 Linux patch 4.15.14
9
10 0000_README | 4 +
11 1013_linux-4.15.14.patch | 3891 ++++++++++++++++++++++++++++++++++++++++++++++
12 2 files changed, 3895 insertions(+)
13
14 diff --git a/0000_README b/0000_README
15 index 2b51c4d..f4d8a80 100644
16 --- a/0000_README
17 +++ b/0000_README
18 @@ -95,6 +95,10 @@ Patch: 1012_linux-4.15.13.patch
19 From: http://www.kernel.org
20 Desc: Linux 4.15.13
21
22 +Patch: 1013_linux-4.15.14.patch
23 +From: http://www.kernel.org
24 +Desc: Linux 4.15.14
25 +
26 Patch: 1500_XATTR_USER_PREFIX.patch
27 From: https://bugs.gentoo.org/show_bug.cgi?id=470644
28 Desc: Support for namespace user.pax.* on tmpfs.
29
30 diff --git a/1013_linux-4.15.14.patch b/1013_linux-4.15.14.patch
31 new file mode 100644
32 index 0000000..9227e36
33 --- /dev/null
34 +++ b/1013_linux-4.15.14.patch
35 @@ -0,0 +1,3891 @@
36 +diff --git a/Documentation/ABI/testing/sysfs-bus-iio b/Documentation/ABI/testing/sysfs-bus-iio
37 +index 2e3f919485f4..fdec308a5041 100644
38 +--- a/Documentation/ABI/testing/sysfs-bus-iio
39 ++++ b/Documentation/ABI/testing/sysfs-bus-iio
40 +@@ -32,7 +32,7 @@ Description:
41 + Description of the physical chip / device for device X.
42 + Typically a part number.
43 +
44 +-What: /sys/bus/iio/devices/iio:deviceX/timestamp_clock
45 ++What: /sys/bus/iio/devices/iio:deviceX/current_timestamp_clock
46 + KernelVersion: 4.5
47 + Contact: linux-iio@×××××××××××.org
48 + Description:
49 +diff --git a/Makefile b/Makefile
50 +index 82245e654d10..a5e561900daf 100644
51 +--- a/Makefile
52 ++++ b/Makefile
53 +@@ -1,7 +1,7 @@
54 + # SPDX-License-Identifier: GPL-2.0
55 + VERSION = 4
56 + PATCHLEVEL = 15
57 +-SUBLEVEL = 13
58 ++SUBLEVEL = 14
59 + EXTRAVERSION =
60 + NAME = Fearless Coyote
61 +
62 +@@ -798,6 +798,15 @@ KBUILD_CFLAGS += $(call cc-disable-warning, pointer-sign)
63 + # disable invalid "can't wrap" optimizations for signed / pointers
64 + KBUILD_CFLAGS += $(call cc-option,-fno-strict-overflow)
65 +
66 ++# clang sets -fmerge-all-constants by default as optimization, but this
67 ++# is non-conforming behavior for C and in fact breaks the kernel, so we
68 ++# need to disable it here generally.
69 ++KBUILD_CFLAGS += $(call cc-option,-fno-merge-all-constants)
70 ++
71 ++# for gcc -fno-merge-all-constants disables everything, but it is fine
72 ++# to have actual conforming behavior enabled.
73 ++KBUILD_CFLAGS += $(call cc-option,-fmerge-constants)
74 ++
75 + # Make sure -fstack-check isn't enabled (like gentoo apparently did)
76 + KBUILD_CFLAGS += $(call cc-option,-fno-stack-check,)
77 +
78 +diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c
79 +index 5bdc2c4db9ad..f15dc3dfecf8 100644
80 +--- a/arch/arm64/mm/mmu.c
81 ++++ b/arch/arm64/mm/mmu.c
82 +@@ -941,3 +941,13 @@ int pmd_clear_huge(pmd_t *pmd)
83 + pmd_clear(pmd);
84 + return 1;
85 + }
86 ++
87 ++int pud_free_pmd_page(pud_t *pud)
88 ++{
89 ++ return pud_none(*pud);
90 ++}
91 ++
92 ++int pmd_free_pte_page(pmd_t *pmd)
93 ++{
94 ++ return pmd_none(*pmd);
95 ++}
96 +diff --git a/arch/h8300/include/asm/byteorder.h b/arch/h8300/include/asm/byteorder.h
97 +index ecff2d1ca5a3..6eaa7ad5fc2c 100644
98 +--- a/arch/h8300/include/asm/byteorder.h
99 ++++ b/arch/h8300/include/asm/byteorder.h
100 +@@ -2,7 +2,6 @@
101 + #ifndef __H8300_BYTEORDER_H__
102 + #define __H8300_BYTEORDER_H__
103 +
104 +-#define __BIG_ENDIAN __ORDER_BIG_ENDIAN__
105 + #include <linux/byteorder/big_endian.h>
106 +
107 + #endif
108 +diff --git a/arch/mips/lantiq/Kconfig b/arch/mips/lantiq/Kconfig
109 +index 692ae85a3e3d..8e3a1fc2bc39 100644
110 +--- a/arch/mips/lantiq/Kconfig
111 ++++ b/arch/mips/lantiq/Kconfig
112 +@@ -13,6 +13,8 @@ choice
113 + config SOC_AMAZON_SE
114 + bool "Amazon SE"
115 + select SOC_TYPE_XWAY
116 ++ select MFD_SYSCON
117 ++ select MFD_CORE
118 +
119 + config SOC_XWAY
120 + bool "XWAY"
121 +diff --git a/arch/mips/lantiq/xway/sysctrl.c b/arch/mips/lantiq/xway/sysctrl.c
122 +index 52500d3b7004..e0af39b33e28 100644
123 +--- a/arch/mips/lantiq/xway/sysctrl.c
124 ++++ b/arch/mips/lantiq/xway/sysctrl.c
125 +@@ -549,9 +549,9 @@ void __init ltq_soc_init(void)
126 + clkdev_add_static(ltq_ar9_cpu_hz(), ltq_ar9_fpi_hz(),
127 + ltq_ar9_fpi_hz(), CLOCK_250M);
128 + clkdev_add_pmu("1f203018.usb2-phy", "phy", 1, 0, PMU_USB0_P);
129 +- clkdev_add_pmu("1e101000.usb", "otg", 1, 0, PMU_USB0);
130 ++ clkdev_add_pmu("1e101000.usb", "otg", 1, 0, PMU_USB0 | PMU_AHBM);
131 + clkdev_add_pmu("1f203034.usb2-phy", "phy", 1, 0, PMU_USB1_P);
132 +- clkdev_add_pmu("1e106000.usb", "otg", 1, 0, PMU_USB1);
133 ++ clkdev_add_pmu("1e106000.usb", "otg", 1, 0, PMU_USB1 | PMU_AHBM);
134 + clkdev_add_pmu("1e180000.etop", "switch", 1, 0, PMU_SWITCH);
135 + clkdev_add_pmu("1e103000.sdio", NULL, 1, 0, PMU_SDIO);
136 + clkdev_add_pmu("1e103100.deu", NULL, 1, 0, PMU_DEU);
137 +@@ -560,7 +560,7 @@ void __init ltq_soc_init(void)
138 + } else {
139 + clkdev_add_static(ltq_danube_cpu_hz(), ltq_danube_fpi_hz(),
140 + ltq_danube_fpi_hz(), ltq_danube_pp32_hz());
141 +- clkdev_add_pmu("1f203018.usb2-phy", "ctrl", 1, 0, PMU_USB0);
142 ++ clkdev_add_pmu("1e101000.usb", "otg", 1, 0, PMU_USB0 | PMU_AHBM);
143 + clkdev_add_pmu("1f203018.usb2-phy", "phy", 1, 0, PMU_USB0_P);
144 + clkdev_add_pmu("1e103000.sdio", NULL, 1, 0, PMU_SDIO);
145 + clkdev_add_pmu("1e103100.deu", NULL, 1, 0, PMU_DEU);
146 +diff --git a/arch/mips/ralink/mt7621.c b/arch/mips/ralink/mt7621.c
147 +index 1b274742077d..d2718de60b9b 100644
148 +--- a/arch/mips/ralink/mt7621.c
149 ++++ b/arch/mips/ralink/mt7621.c
150 +@@ -170,6 +170,28 @@ void prom_soc_init(struct ralink_soc_info *soc_info)
151 + u32 n1;
152 + u32 rev;
153 +
154 ++ /* Early detection of CMP support */
155 ++ mips_cm_probe();
156 ++ mips_cpc_probe();
157 ++
158 ++ if (mips_cps_numiocu(0)) {
159 ++ /*
160 ++ * mips_cm_probe() wipes out bootloader
161 ++ * config for CM regions and we have to configure them
162 ++ * again. This SoC cannot talk to pamlbus devices
163 ++ * witout proper iocu region set up.
164 ++ *
165 ++ * FIXME: it would be better to do this with values
166 ++ * from DT, but we need this very early because
167 ++ * without this we cannot talk to pretty much anything
168 ++ * including serial.
169 ++ */
170 ++ write_gcr_reg0_base(MT7621_PALMBUS_BASE);
171 ++ write_gcr_reg0_mask(~MT7621_PALMBUS_SIZE |
172 ++ CM_GCR_REGn_MASK_CMTGT_IOCU0);
173 ++ __sync();
174 ++ }
175 ++
176 + n0 = __raw_readl(sysc + SYSC_REG_CHIP_NAME0);
177 + n1 = __raw_readl(sysc + SYSC_REG_CHIP_NAME1);
178 +
179 +@@ -194,26 +216,6 @@ void prom_soc_init(struct ralink_soc_info *soc_info)
180 +
181 + rt2880_pinmux_data = mt7621_pinmux_data;
182 +
183 +- /* Early detection of CMP support */
184 +- mips_cm_probe();
185 +- mips_cpc_probe();
186 +-
187 +- if (mips_cps_numiocu(0)) {
188 +- /*
189 +- * mips_cm_probe() wipes out bootloader
190 +- * config for CM regions and we have to configure them
191 +- * again. This SoC cannot talk to pamlbus devices
192 +- * witout proper iocu region set up.
193 +- *
194 +- * FIXME: it would be better to do this with values
195 +- * from DT, but we need this very early because
196 +- * without this we cannot talk to pretty much anything
197 +- * including serial.
198 +- */
199 +- write_gcr_reg0_base(MT7621_PALMBUS_BASE);
200 +- write_gcr_reg0_mask(~MT7621_PALMBUS_SIZE |
201 +- CM_GCR_REGn_MASK_CMTGT_IOCU0);
202 +- }
203 +
204 + if (!register_cps_smp_ops())
205 + return;
206 +diff --git a/arch/mips/ralink/reset.c b/arch/mips/ralink/reset.c
207 +index 64543d66e76b..e9531fea23a2 100644
208 +--- a/arch/mips/ralink/reset.c
209 ++++ b/arch/mips/ralink/reset.c
210 +@@ -96,16 +96,9 @@ static void ralink_restart(char *command)
211 + unreachable();
212 + }
213 +
214 +-static void ralink_halt(void)
215 +-{
216 +- local_irq_disable();
217 +- unreachable();
218 +-}
219 +-
220 + static int __init mips_reboot_setup(void)
221 + {
222 + _machine_restart = ralink_restart;
223 +- _machine_halt = ralink_halt;
224 +
225 + return 0;
226 + }
227 +diff --git a/arch/x86/Makefile b/arch/x86/Makefile
228 +index 498c1b812300..1c4d012550ec 100644
229 +--- a/arch/x86/Makefile
230 ++++ b/arch/x86/Makefile
231 +@@ -223,6 +223,15 @@ KBUILD_CFLAGS += $(cfi) $(cfi-sigframe) $(cfi-sections) $(asinstr) $(avx_instr)
232 +
233 + LDFLAGS := -m elf_$(UTS_MACHINE)
234 +
235 ++#
236 ++# The 64-bit kernel must be aligned to 2MB. Pass -z max-page-size=0x200000 to
237 ++# the linker to force 2MB page size regardless of the default page size used
238 ++# by the linker.
239 ++#
240 ++ifdef CONFIG_X86_64
241 ++LDFLAGS += $(call ld-option, -z max-page-size=0x200000)
242 ++endif
243 ++
244 + # Speed up the build
245 + KBUILD_CFLAGS += -pipe
246 + # Workaround for a gcc prelease that unfortunately was shipped in a suse release
247 +diff --git a/arch/x86/boot/compressed/misc.c b/arch/x86/boot/compressed/misc.c
248 +index 98761a1576ce..252fee320816 100644
249 +--- a/arch/x86/boot/compressed/misc.c
250 ++++ b/arch/x86/boot/compressed/misc.c
251 +@@ -309,6 +309,10 @@ static void parse_elf(void *output)
252 +
253 + switch (phdr->p_type) {
254 + case PT_LOAD:
255 ++#ifdef CONFIG_X86_64
256 ++ if ((phdr->p_align % 0x200000) != 0)
257 ++ error("Alignment of LOAD segment isn't multiple of 2MB");
258 ++#endif
259 + #ifdef CONFIG_RELOCATABLE
260 + dest = output;
261 + dest += (phdr->p_paddr - LOAD_PHYSICAL_ADDR);
262 +diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S
263 +index 50dcbf640850..3a7d58384479 100644
264 +--- a/arch/x86/entry/entry_64.S
265 ++++ b/arch/x86/entry/entry_64.S
266 +@@ -1097,7 +1097,7 @@ apicinterrupt3 HYPERVISOR_CALLBACK_VECTOR \
267 + #endif /* CONFIG_HYPERV */
268 +
269 + idtentry debug do_debug has_error_code=0 paranoid=1 shift_ist=DEBUG_STACK
270 +-idtentry int3 do_int3 has_error_code=0 paranoid=1 shift_ist=DEBUG_STACK
271 ++idtentry int3 do_int3 has_error_code=0
272 + idtentry stack_segment do_stack_segment has_error_code=1
273 +
274 + #ifdef CONFIG_XEN
275 +diff --git a/arch/x86/entry/vsyscall/vsyscall_64.c b/arch/x86/entry/vsyscall/vsyscall_64.c
276 +index 577fa8adb785..542392b6aab6 100644
277 +--- a/arch/x86/entry/vsyscall/vsyscall_64.c
278 ++++ b/arch/x86/entry/vsyscall/vsyscall_64.c
279 +@@ -355,7 +355,7 @@ void __init set_vsyscall_pgtable_user_bits(pgd_t *root)
280 + set_pgd(pgd, __pgd(pgd_val(*pgd) | _PAGE_USER));
281 + p4d = p4d_offset(pgd, VSYSCALL_ADDR);
282 + #if CONFIG_PGTABLE_LEVELS >= 5
283 +- p4d->p4d |= _PAGE_USER;
284 ++ set_p4d(p4d, __p4d(p4d_val(*p4d) | _PAGE_USER));
285 + #endif
286 + pud = pud_offset(p4d, VSYSCALL_ADDR);
287 + set_pud(pud, __pud(pud_val(*pud) | _PAGE_USER));
288 +diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c
289 +index 56457cb73448..9b18a227fff7 100644
290 +--- a/arch/x86/events/intel/core.c
291 ++++ b/arch/x86/events/intel/core.c
292 +@@ -3194,7 +3194,7 @@ static unsigned bdw_limit_period(struct perf_event *event, unsigned left)
293 + X86_CONFIG(.event=0xc0, .umask=0x01)) {
294 + if (left < 128)
295 + left = 128;
296 +- left &= ~0x3fu;
297 ++ left &= ~0x3fULL;
298 + }
299 + return left;
300 + }
301 +diff --git a/arch/x86/events/intel/uncore_snbep.c b/arch/x86/events/intel/uncore_snbep.c
302 +index 6d8044ab1060..7da7a79eba53 100644
303 +--- a/arch/x86/events/intel/uncore_snbep.c
304 ++++ b/arch/x86/events/intel/uncore_snbep.c
305 +@@ -3562,24 +3562,27 @@ static struct intel_uncore_type *skx_msr_uncores[] = {
306 + NULL,
307 + };
308 +
309 ++/*
310 ++ * To determine the number of CHAs, it should read bits 27:0 in the CAPID6
311 ++ * register which located at Device 30, Function 3, Offset 0x9C. PCI ID 0x2083.
312 ++ */
313 ++#define SKX_CAPID6 0x9c
314 ++#define SKX_CHA_BIT_MASK GENMASK(27, 0)
315 ++
316 + static int skx_count_chabox(void)
317 + {
318 +- struct pci_dev *chabox_dev = NULL;
319 +- int bus, count = 0;
320 ++ struct pci_dev *dev = NULL;
321 ++ u32 val = 0;
322 +
323 +- while (1) {
324 +- chabox_dev = pci_get_device(PCI_VENDOR_ID_INTEL, 0x208d, chabox_dev);
325 +- if (!chabox_dev)
326 +- break;
327 +- if (count == 0)
328 +- bus = chabox_dev->bus->number;
329 +- if (bus != chabox_dev->bus->number)
330 +- break;
331 +- count++;
332 +- }
333 ++ dev = pci_get_device(PCI_VENDOR_ID_INTEL, 0x2083, dev);
334 ++ if (!dev)
335 ++ goto out;
336 +
337 +- pci_dev_put(chabox_dev);
338 +- return count;
339 ++ pci_read_config_dword(dev, SKX_CAPID6, &val);
340 ++ val &= SKX_CHA_BIT_MASK;
341 ++out:
342 ++ pci_dev_put(dev);
343 ++ return hweight32(val);
344 + }
345 +
346 + void skx_uncore_cpu_init(void)
347 +@@ -3606,7 +3609,7 @@ static struct intel_uncore_type skx_uncore_imc = {
348 + };
349 +
350 + static struct attribute *skx_upi_uncore_formats_attr[] = {
351 +- &format_attr_event_ext.attr,
352 ++ &format_attr_event.attr,
353 + &format_attr_umask_ext.attr,
354 + &format_attr_edge.attr,
355 + &format_attr_inv.attr,
356 +diff --git a/arch/x86/include/asm/vmx.h b/arch/x86/include/asm/vmx.h
357 +index 8b6780751132..5db8b0b10766 100644
358 +--- a/arch/x86/include/asm/vmx.h
359 ++++ b/arch/x86/include/asm/vmx.h
360 +@@ -352,6 +352,7 @@ enum vmcs_field {
361 + #define INTR_TYPE_NMI_INTR (2 << 8) /* NMI */
362 + #define INTR_TYPE_HARD_EXCEPTION (3 << 8) /* processor exception */
363 + #define INTR_TYPE_SOFT_INTR (4 << 8) /* software interrupt */
364 ++#define INTR_TYPE_PRIV_SW_EXCEPTION (5 << 8) /* ICE breakpoint - undocumented */
365 + #define INTR_TYPE_SOFT_EXCEPTION (6 << 8) /* software exception */
366 +
367 + /* GUEST_INTERRUPTIBILITY_INFO flags. */
368 +diff --git a/arch/x86/kernel/idt.c b/arch/x86/kernel/idt.c
369 +index 56d99be3706a..50bee5fe1140 100644
370 +--- a/arch/x86/kernel/idt.c
371 ++++ b/arch/x86/kernel/idt.c
372 +@@ -160,7 +160,6 @@ static const __initconst struct idt_data early_pf_idts[] = {
373 + */
374 + static const __initconst struct idt_data dbg_idts[] = {
375 + INTG(X86_TRAP_DB, debug),
376 +- INTG(X86_TRAP_BP, int3),
377 + };
378 + #endif
379 +
380 +@@ -183,7 +182,6 @@ gate_desc debug_idt_table[IDT_ENTRIES] __page_aligned_bss;
381 + static const __initconst struct idt_data ist_idts[] = {
382 + ISTG(X86_TRAP_DB, debug, DEBUG_STACK),
383 + ISTG(X86_TRAP_NMI, nmi, NMI_STACK),
384 +- SISTG(X86_TRAP_BP, int3, DEBUG_STACK),
385 + ISTG(X86_TRAP_DF, double_fault, DOUBLEFAULT_STACK),
386 + #ifdef CONFIG_X86_MCE
387 + ISTG(X86_TRAP_MC, &machine_check, MCE_STACK),
388 +diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c
389 +index 3d9b2308e7fa..03f3d7695dac 100644
390 +--- a/arch/x86/kernel/traps.c
391 ++++ b/arch/x86/kernel/traps.c
392 +@@ -577,7 +577,6 @@ do_general_protection(struct pt_regs *regs, long error_code)
393 + }
394 + NOKPROBE_SYMBOL(do_general_protection);
395 +
396 +-/* May run on IST stack. */
397 + dotraplinkage void notrace do_int3(struct pt_regs *regs, long error_code)
398 + {
399 + #ifdef CONFIG_DYNAMIC_FTRACE
400 +@@ -592,6 +591,13 @@ dotraplinkage void notrace do_int3(struct pt_regs *regs, long error_code)
401 + if (poke_int3_handler(regs))
402 + return;
403 +
404 ++ /*
405 ++ * Use ist_enter despite the fact that we don't use an IST stack.
406 ++ * We can be called from a kprobe in non-CONTEXT_KERNEL kernel
407 ++ * mode or even during context tracking state changes.
408 ++ *
409 ++ * This means that we can't schedule. That's okay.
410 ++ */
411 + ist_enter(regs);
412 + RCU_LOCKDEP_WARN(!rcu_is_watching(), "entry code didn't wake RCU");
413 + #ifdef CONFIG_KGDB_LOW_LEVEL_TRAP
414 +@@ -609,15 +615,10 @@ dotraplinkage void notrace do_int3(struct pt_regs *regs, long error_code)
415 + SIGTRAP) == NOTIFY_STOP)
416 + goto exit;
417 +
418 +- /*
419 +- * Let others (NMI) know that the debug stack is in use
420 +- * as we may switch to the interrupt stack.
421 +- */
422 +- debug_stack_usage_inc();
423 + cond_local_irq_enable(regs);
424 + do_trap(X86_TRAP_BP, SIGTRAP, "int3", regs, error_code, NULL);
425 + cond_local_irq_disable(regs);
426 +- debug_stack_usage_dec();
427 ++
428 + exit:
429 + ist_exit(regs);
430 + }
431 +diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
432 +index 87b453eeae40..2beb77c319e8 100644
433 +--- a/arch/x86/kvm/vmx.c
434 ++++ b/arch/x86/kvm/vmx.c
435 +@@ -1079,6 +1079,13 @@ static inline bool is_machine_check(u32 intr_info)
436 + (INTR_TYPE_HARD_EXCEPTION | MC_VECTOR | INTR_INFO_VALID_MASK);
437 + }
438 +
439 ++/* Undocumented: icebp/int1 */
440 ++static inline bool is_icebp(u32 intr_info)
441 ++{
442 ++ return (intr_info & (INTR_INFO_INTR_TYPE_MASK | INTR_INFO_VALID_MASK))
443 ++ == (INTR_TYPE_PRIV_SW_EXCEPTION | INTR_INFO_VALID_MASK);
444 ++}
445 ++
446 + static inline bool cpu_has_vmx_msr_bitmap(void)
447 + {
448 + return vmcs_config.cpu_based_exec_ctrl & CPU_BASED_USE_MSR_BITMAPS;
449 +@@ -6173,7 +6180,7 @@ static int handle_exception(struct kvm_vcpu *vcpu)
450 + (KVM_GUESTDBG_SINGLESTEP | KVM_GUESTDBG_USE_HW_BP))) {
451 + vcpu->arch.dr6 &= ~15;
452 + vcpu->arch.dr6 |= dr6 | DR6_RTM;
453 +- if (!(dr6 & ~DR6_RESERVED)) /* icebp */
454 ++ if (is_icebp(intr_info))
455 + skip_emulated_instruction(vcpu);
456 +
457 + kvm_queue_exception(vcpu, DB_VECTOR);
458 +diff --git a/arch/x86/mm/pgtable.c b/arch/x86/mm/pgtable.c
459 +index 004abf9ebf12..34cda7e0551b 100644
460 +--- a/arch/x86/mm/pgtable.c
461 ++++ b/arch/x86/mm/pgtable.c
462 +@@ -702,4 +702,52 @@ int pmd_clear_huge(pmd_t *pmd)
463 +
464 + return 0;
465 + }
466 ++
467 ++/**
468 ++ * pud_free_pmd_page - Clear pud entry and free pmd page.
469 ++ * @pud: Pointer to a PUD.
470 ++ *
471 ++ * Context: The pud range has been unmaped and TLB purged.
472 ++ * Return: 1 if clearing the entry succeeded. 0 otherwise.
473 ++ */
474 ++int pud_free_pmd_page(pud_t *pud)
475 ++{
476 ++ pmd_t *pmd;
477 ++ int i;
478 ++
479 ++ if (pud_none(*pud))
480 ++ return 1;
481 ++
482 ++ pmd = (pmd_t *)pud_page_vaddr(*pud);
483 ++
484 ++ for (i = 0; i < PTRS_PER_PMD; i++)
485 ++ if (!pmd_free_pte_page(&pmd[i]))
486 ++ return 0;
487 ++
488 ++ pud_clear(pud);
489 ++ free_page((unsigned long)pmd);
490 ++
491 ++ return 1;
492 ++}
493 ++
494 ++/**
495 ++ * pmd_free_pte_page - Clear pmd entry and free pte page.
496 ++ * @pmd: Pointer to a PMD.
497 ++ *
498 ++ * Context: The pmd range has been unmaped and TLB purged.
499 ++ * Return: 1 if clearing the entry succeeded. 0 otherwise.
500 ++ */
501 ++int pmd_free_pte_page(pmd_t *pmd)
502 ++{
503 ++ pte_t *pte;
504 ++
505 ++ if (pmd_none(*pmd))
506 ++ return 1;
507 ++
508 ++ pte = (pte_t *)pmd_page_vaddr(*pmd);
509 ++ pmd_clear(pmd);
510 ++ free_page((unsigned long)pte);
511 ++
512 ++ return 1;
513 ++}
514 + #endif /* CONFIG_HAVE_ARCH_HUGE_VMAP */
515 +diff --git a/arch/x86/net/bpf_jit_comp.c b/arch/x86/net/bpf_jit_comp.c
516 +index 940aac70b4da..bb77606d04e0 100644
517 +--- a/arch/x86/net/bpf_jit_comp.c
518 ++++ b/arch/x86/net/bpf_jit_comp.c
519 +@@ -1156,7 +1156,7 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *prog)
520 + * may converge on the last pass. In such case do one more
521 + * pass to emit the final image
522 + */
523 +- for (pass = 0; pass < 10 || image; pass++) {
524 ++ for (pass = 0; pass < 20 || image; pass++) {
525 + proglen = do_jit(prog, addrs, image, oldproglen, &ctx);
526 + if (proglen <= 0) {
527 + image = NULL;
528 +@@ -1183,6 +1183,7 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *prog)
529 + }
530 + }
531 + oldproglen = proglen;
532 ++ cond_resched();
533 + }
534 +
535 + if (bpf_jit_enable > 1)
536 +diff --git a/arch/x86/platform/efi/efi_64.c b/arch/x86/platform/efi/efi_64.c
537 +index 2dd15e967c3f..0167e526b04f 100644
538 +--- a/arch/x86/platform/efi/efi_64.c
539 ++++ b/arch/x86/platform/efi/efi_64.c
540 +@@ -228,7 +228,7 @@ int __init efi_alloc_page_tables(void)
541 + if (!pud) {
542 + if (CONFIG_PGTABLE_LEVELS > 4)
543 + free_page((unsigned long) pgd_page_vaddr(*pgd));
544 +- free_page((unsigned long)efi_pgd);
545 ++ free_pages((unsigned long)efi_pgd, PGD_ALLOCATION_ORDER);
546 + return -ENOMEM;
547 + }
548 +
549 +diff --git a/drivers/acpi/acpi_watchdog.c b/drivers/acpi/acpi_watchdog.c
550 +index 11b113f8e367..ebb626ffb5fa 100644
551 +--- a/drivers/acpi/acpi_watchdog.c
552 ++++ b/drivers/acpi/acpi_watchdog.c
553 +@@ -74,10 +74,10 @@ void __init acpi_watchdog_init(void)
554 + res.start = gas->address;
555 + if (gas->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) {
556 + res.flags = IORESOURCE_MEM;
557 +- res.end = res.start + ALIGN(gas->access_width, 4);
558 ++ res.end = res.start + ALIGN(gas->access_width, 4) - 1;
559 + } else if (gas->space_id == ACPI_ADR_SPACE_SYSTEM_IO) {
560 + res.flags = IORESOURCE_IO;
561 +- res.end = res.start + gas->access_width;
562 ++ res.end = res.start + gas->access_width - 1;
563 + } else {
564 + pr_warn("Unsupported address space: %u\n",
565 + gas->space_id);
566 +diff --git a/drivers/acpi/numa.c b/drivers/acpi/numa.c
567 +index 917f1cc0fda4..8fb74d9011da 100644
568 +--- a/drivers/acpi/numa.c
569 ++++ b/drivers/acpi/numa.c
570 +@@ -103,25 +103,27 @@ int acpi_map_pxm_to_node(int pxm)
571 + */
572 + int acpi_map_pxm_to_online_node(int pxm)
573 + {
574 +- int node, n, dist, min_dist;
575 ++ int node, min_node;
576 +
577 + node = acpi_map_pxm_to_node(pxm);
578 +
579 + if (node == NUMA_NO_NODE)
580 + node = 0;
581 +
582 ++ min_node = node;
583 + if (!node_online(node)) {
584 +- min_dist = INT_MAX;
585 ++ int min_dist = INT_MAX, dist, n;
586 ++
587 + for_each_online_node(n) {
588 + dist = node_distance(node, n);
589 + if (dist < min_dist) {
590 + min_dist = dist;
591 +- node = n;
592 ++ min_node = n;
593 + }
594 + }
595 + }
596 +
597 +- return node;
598 ++ return min_node;
599 + }
600 + EXPORT_SYMBOL(acpi_map_pxm_to_online_node);
601 +
602 +diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
603 +index 44a9d630b7ac..2badef1271fd 100644
604 +--- a/drivers/ata/ahci.c
605 ++++ b/drivers/ata/ahci.c
606 +@@ -542,7 +542,9 @@ static const struct pci_device_id ahci_pci_tbl[] = {
607 + .driver_data = board_ahci_yes_fbs },
608 + { PCI_DEVICE(PCI_VENDOR_ID_MARVELL_EXT, 0x9230),
609 + .driver_data = board_ahci_yes_fbs },
610 +- { PCI_DEVICE(PCI_VENDOR_ID_TTI, 0x0642),
611 ++ { PCI_DEVICE(PCI_VENDOR_ID_TTI, 0x0642), /* highpoint rocketraid 642L */
612 ++ .driver_data = board_ahci_yes_fbs },
613 ++ { PCI_DEVICE(PCI_VENDOR_ID_TTI, 0x0645), /* highpoint rocketraid 644L */
614 + .driver_data = board_ahci_yes_fbs },
615 +
616 + /* Promise */
617 +diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
618 +index 3c09122bf038..7431ccd03316 100644
619 +--- a/drivers/ata/libata-core.c
620 ++++ b/drivers/ata/libata-core.c
621 +@@ -4530,6 +4530,25 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = {
622 + { "PIONEER DVD-RW DVR-212D", NULL, ATA_HORKAGE_NOSETXFER },
623 + { "PIONEER DVD-RW DVR-216D", NULL, ATA_HORKAGE_NOSETXFER },
624 +
625 ++ /* Crucial BX100 SSD 500GB has broken LPM support */
626 ++ { "CT500BX100SSD1", NULL, ATA_HORKAGE_NOLPM },
627 ++
628 ++ /* 512GB MX100 with MU01 firmware has both queued TRIM and LPM issues */
629 ++ { "Crucial_CT512MX100*", "MU01", ATA_HORKAGE_NO_NCQ_TRIM |
630 ++ ATA_HORKAGE_ZERO_AFTER_TRIM |
631 ++ ATA_HORKAGE_NOLPM, },
632 ++ /* 512GB MX100 with newer firmware has only LPM issues */
633 ++ { "Crucial_CT512MX100*", NULL, ATA_HORKAGE_ZERO_AFTER_TRIM |
634 ++ ATA_HORKAGE_NOLPM, },
635 ++
636 ++ /* 480GB+ M500 SSDs have both queued TRIM and LPM issues */
637 ++ { "Crucial_CT480M500*", NULL, ATA_HORKAGE_NO_NCQ_TRIM |
638 ++ ATA_HORKAGE_ZERO_AFTER_TRIM |
639 ++ ATA_HORKAGE_NOLPM, },
640 ++ { "Crucial_CT960M500*", NULL, ATA_HORKAGE_NO_NCQ_TRIM |
641 ++ ATA_HORKAGE_ZERO_AFTER_TRIM |
642 ++ ATA_HORKAGE_NOLPM, },
643 ++
644 + /* devices that don't properly handle queued TRIM commands */
645 + { "Micron_M500_*", NULL, ATA_HORKAGE_NO_NCQ_TRIM |
646 + ATA_HORKAGE_ZERO_AFTER_TRIM, },
647 +@@ -4541,7 +4560,9 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = {
648 + ATA_HORKAGE_ZERO_AFTER_TRIM, },
649 + { "Crucial_CT*MX100*", "MU01", ATA_HORKAGE_NO_NCQ_TRIM |
650 + ATA_HORKAGE_ZERO_AFTER_TRIM, },
651 +- { "Samsung SSD 8*", NULL, ATA_HORKAGE_NO_NCQ_TRIM |
652 ++ { "Samsung SSD 840*", NULL, ATA_HORKAGE_NO_NCQ_TRIM |
653 ++ ATA_HORKAGE_ZERO_AFTER_TRIM, },
654 ++ { "Samsung SSD 850*", NULL, ATA_HORKAGE_NO_NCQ_TRIM |
655 + ATA_HORKAGE_ZERO_AFTER_TRIM, },
656 + { "FCCT*M500*", NULL, ATA_HORKAGE_NO_NCQ_TRIM |
657 + ATA_HORKAGE_ZERO_AFTER_TRIM, },
658 +@@ -5401,8 +5422,7 @@ void ata_qc_issue(struct ata_queued_cmd *qc)
659 + * We guarantee to LLDs that they will have at least one
660 + * non-zero sg if the command is a data command.
661 + */
662 +- if (WARN_ON_ONCE(ata_is_data(prot) &&
663 +- (!qc->sg || !qc->n_elem || !qc->nbytes)))
664 ++ if (ata_is_data(prot) && (!qc->sg || !qc->n_elem || !qc->nbytes))
665 + goto sys_err;
666 +
667 + if (ata_is_dma(prot) || (ata_is_pio(prot) &&
668 +diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
669 +index 66be961c93a4..197e110f8ac7 100644
670 +--- a/drivers/ata/libata-scsi.c
671 ++++ b/drivers/ata/libata-scsi.c
672 +@@ -3316,6 +3316,12 @@ static unsigned int ata_scsi_pass_thru(struct ata_queued_cmd *qc)
673 + goto invalid_fld;
674 + }
675 +
676 ++ /* We may not issue NCQ commands to devices not supporting NCQ */
677 ++ if (ata_is_ncq(tf->protocol) && !ata_ncq_enabled(dev)) {
678 ++ fp = 1;
679 ++ goto invalid_fld;
680 ++ }
681 ++
682 + /* sanity check for pio multi commands */
683 + if ((cdb[1] & 0xe0) && !is_multi_taskfile(tf)) {
684 + fp = 1;
685 +@@ -4309,7 +4315,9 @@ static inline int __ata_scsi_queuecmd(struct scsi_cmnd *scmd,
686 + if (likely((scsi_op != ATA_16) || !atapi_passthru16)) {
687 + /* relay SCSI command to ATAPI device */
688 + int len = COMMAND_SIZE(scsi_op);
689 +- if (unlikely(len > scmd->cmd_len || len > dev->cdb_len))
690 ++ if (unlikely(len > scmd->cmd_len ||
691 ++ len > dev->cdb_len ||
692 ++ scmd->cmd_len > ATAPI_CDB_LEN))
693 + goto bad_cdb_len;
694 +
695 + xlat_func = atapi_xlat;
696 +diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
697 +index e71e54c478da..2f57e8b88a7a 100644
698 +--- a/drivers/bluetooth/btusb.c
699 ++++ b/drivers/bluetooth/btusb.c
700 +@@ -230,7 +230,6 @@ static const struct usb_device_id blacklist_table[] = {
701 + { USB_DEVICE(0x0930, 0x0227), .driver_info = BTUSB_ATH3012 },
702 + { USB_DEVICE(0x0b05, 0x17d0), .driver_info = BTUSB_ATH3012 },
703 + { USB_DEVICE(0x0cf3, 0x0036), .driver_info = BTUSB_ATH3012 },
704 +- { USB_DEVICE(0x0cf3, 0x3004), .driver_info = BTUSB_ATH3012 },
705 + { USB_DEVICE(0x0cf3, 0x3008), .driver_info = BTUSB_ATH3012 },
706 + { USB_DEVICE(0x0cf3, 0x311d), .driver_info = BTUSB_ATH3012 },
707 + { USB_DEVICE(0x0cf3, 0x311e), .driver_info = BTUSB_ATH3012 },
708 +@@ -263,6 +262,7 @@ static const struct usb_device_id blacklist_table[] = {
709 + { USB_DEVICE(0x0489, 0xe03c), .driver_info = BTUSB_ATH3012 },
710 +
711 + /* QCA ROME chipset */
712 ++ { USB_DEVICE(0x0cf3, 0x3004), .driver_info = BTUSB_QCA_ROME },
713 + { USB_DEVICE(0x0cf3, 0xe007), .driver_info = BTUSB_QCA_ROME },
714 + { USB_DEVICE(0x0cf3, 0xe009), .driver_info = BTUSB_QCA_ROME },
715 + { USB_DEVICE(0x0cf3, 0xe300), .driver_info = BTUSB_QCA_ROME },
716 +@@ -383,10 +383,10 @@ static const struct usb_device_id blacklist_table[] = {
717 + */
718 + static const struct dmi_system_id btusb_needs_reset_resume_table[] = {
719 + {
720 +- /* Lenovo Yoga 920 (QCA Rome device 0cf3:e300) */
721 ++ /* Dell OptiPlex 3060 (QCA ROME device 0cf3:e007) */
722 + .matches = {
723 +- DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
724 +- DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo YOGA 920"),
725 ++ DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
726 ++ DMI_MATCH(DMI_PRODUCT_NAME, "OptiPlex 3060"),
727 + },
728 + },
729 + {}
730 +diff --git a/drivers/clk/bcm/clk-bcm2835.c b/drivers/clk/bcm/clk-bcm2835.c
731 +index 44301a3d9963..a07f6451694a 100644
732 +--- a/drivers/clk/bcm/clk-bcm2835.c
733 ++++ b/drivers/clk/bcm/clk-bcm2835.c
734 +@@ -449,17 +449,17 @@ struct bcm2835_pll_ana_bits {
735 + static const struct bcm2835_pll_ana_bits bcm2835_ana_default = {
736 + .mask0 = 0,
737 + .set0 = 0,
738 +- .mask1 = (u32)~(A2W_PLL_KI_MASK | A2W_PLL_KP_MASK),
739 ++ .mask1 = A2W_PLL_KI_MASK | A2W_PLL_KP_MASK,
740 + .set1 = (2 << A2W_PLL_KI_SHIFT) | (8 << A2W_PLL_KP_SHIFT),
741 +- .mask3 = (u32)~A2W_PLL_KA_MASK,
742 ++ .mask3 = A2W_PLL_KA_MASK,
743 + .set3 = (2 << A2W_PLL_KA_SHIFT),
744 + .fb_prediv_mask = BIT(14),
745 + };
746 +
747 + static const struct bcm2835_pll_ana_bits bcm2835_ana_pllh = {
748 +- .mask0 = (u32)~(A2W_PLLH_KA_MASK | A2W_PLLH_KI_LOW_MASK),
749 ++ .mask0 = A2W_PLLH_KA_MASK | A2W_PLLH_KI_LOW_MASK,
750 + .set0 = (2 << A2W_PLLH_KA_SHIFT) | (2 << A2W_PLLH_KI_LOW_SHIFT),
751 +- .mask1 = (u32)~(A2W_PLLH_KI_HIGH_MASK | A2W_PLLH_KP_MASK),
752 ++ .mask1 = A2W_PLLH_KI_HIGH_MASK | A2W_PLLH_KP_MASK,
753 + .set1 = (6 << A2W_PLLH_KP_SHIFT),
754 + .mask3 = 0,
755 + .set3 = 0,
756 +@@ -623,8 +623,10 @@ static int bcm2835_pll_on(struct clk_hw *hw)
757 + ~A2W_PLL_CTRL_PWRDN);
758 +
759 + /* Take the PLL out of reset. */
760 ++ spin_lock(&cprman->regs_lock);
761 + cprman_write(cprman, data->cm_ctrl_reg,
762 + cprman_read(cprman, data->cm_ctrl_reg) & ~CM_PLL_ANARST);
763 ++ spin_unlock(&cprman->regs_lock);
764 +
765 + /* Wait for the PLL to lock. */
766 + timeout = ktime_add_ns(ktime_get(), LOCK_TIMEOUT_NS);
767 +@@ -701,9 +703,11 @@ static int bcm2835_pll_set_rate(struct clk_hw *hw,
768 + }
769 +
770 + /* Unmask the reference clock from the oscillator. */
771 ++ spin_lock(&cprman->regs_lock);
772 + cprman_write(cprman, A2W_XOSC_CTRL,
773 + cprman_read(cprman, A2W_XOSC_CTRL) |
774 + data->reference_enable_mask);
775 ++ spin_unlock(&cprman->regs_lock);
776 +
777 + if (do_ana_setup_first)
778 + bcm2835_pll_write_ana(cprman, data->ana_reg_base, ana);
779 +diff --git a/drivers/clk/sunxi-ng/ccu-sun6i-a31.c b/drivers/clk/sunxi-ng/ccu-sun6i-a31.c
780 +index 72b16ed1012b..3b97f60540ad 100644
781 +--- a/drivers/clk/sunxi-ng/ccu-sun6i-a31.c
782 ++++ b/drivers/clk/sunxi-ng/ccu-sun6i-a31.c
783 +@@ -762,7 +762,7 @@ static struct ccu_mp out_a_clk = {
784 + .features = CCU_FEATURE_FIXED_PREDIV,
785 + .hw.init = CLK_HW_INIT_PARENTS("out-a",
786 + clk_out_parents,
787 +- &ccu_div_ops,
788 ++ &ccu_mp_ops,
789 + 0),
790 + },
791 + };
792 +@@ -783,7 +783,7 @@ static struct ccu_mp out_b_clk = {
793 + .features = CCU_FEATURE_FIXED_PREDIV,
794 + .hw.init = CLK_HW_INIT_PARENTS("out-b",
795 + clk_out_parents,
796 +- &ccu_div_ops,
797 ++ &ccu_mp_ops,
798 + 0),
799 + },
800 + };
801 +@@ -804,7 +804,7 @@ static struct ccu_mp out_c_clk = {
802 + .features = CCU_FEATURE_FIXED_PREDIV,
803 + .hw.init = CLK_HW_INIT_PARENTS("out-c",
804 + clk_out_parents,
805 +- &ccu_div_ops,
806 ++ &ccu_mp_ops,
807 + 0),
808 + },
809 + };
810 +diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
811 +index bb5fa895fb64..97ecfd16ee82 100644
812 +--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
813 ++++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
814 +@@ -3090,8 +3090,6 @@ static int amdgpu_dm_plane_init(struct amdgpu_display_manager *dm,
815 +
816 + switch (aplane->base.type) {
817 + case DRM_PLANE_TYPE_PRIMARY:
818 +- aplane->base.format_default = true;
819 +-
820 + res = drm_universal_plane_init(
821 + dm->adev->ddev,
822 + &aplane->base,
823 +diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c
824 +index 9bd142f65f9b..e1acc10e35a2 100644
825 +--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c
826 ++++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c
827 +@@ -109,7 +109,7 @@ enum dc_edid_status dm_helpers_parse_edid_caps(
828 + struct cea_sad *sad = &sads[i];
829 +
830 + edid_caps->audio_modes[i].format_code = sad->format;
831 +- edid_caps->audio_modes[i].channel_count = sad->channels;
832 ++ edid_caps->audio_modes[i].channel_count = sad->channels + 1;
833 + edid_caps->audio_modes[i].sample_rate = sad->freq;
834 + edid_caps->audio_modes[i].sample_size = sad->byte2;
835 + }
836 +diff --git a/drivers/gpu/drm/drm_framebuffer.c b/drivers/gpu/drm/drm_framebuffer.c
837 +index 5e1f1e2deb52..343cb5fa9b03 100644
838 +--- a/drivers/gpu/drm/drm_framebuffer.c
839 ++++ b/drivers/gpu/drm/drm_framebuffer.c
840 +@@ -458,6 +458,12 @@ int drm_mode_getfb(struct drm_device *dev,
841 + if (!fb)
842 + return -ENOENT;
843 +
844 ++ /* Multi-planar framebuffers need getfb2. */
845 ++ if (fb->format->num_planes > 1) {
846 ++ ret = -EINVAL;
847 ++ goto out;
848 ++ }
849 ++
850 + r->height = fb->height;
851 + r->width = fb->width;
852 + r->depth = fb->format->depth;
853 +@@ -481,6 +487,7 @@ int drm_mode_getfb(struct drm_device *dev,
854 + ret = -ENODEV;
855 + }
856 +
857 ++out:
858 + drm_framebuffer_put(fb);
859 +
860 + return ret;
861 +diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c
862 +index 30e129684c7c..fd0d0c758a94 100644
863 +--- a/drivers/gpu/drm/radeon/radeon_connectors.c
864 ++++ b/drivers/gpu/drm/radeon/radeon_connectors.c
865 +@@ -90,25 +90,18 @@ void radeon_connector_hotplug(struct drm_connector *connector)
866 + /* don't do anything if sink is not display port, i.e.,
867 + * passive dp->(dvi|hdmi) adaptor
868 + */
869 +- if (dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT) {
870 +- int saved_dpms = connector->dpms;
871 +- /* Only turn off the display if it's physically disconnected */
872 +- if (!radeon_hpd_sense(rdev, radeon_connector->hpd.hpd)) {
873 +- drm_helper_connector_dpms(connector, DRM_MODE_DPMS_OFF);
874 +- } else if (radeon_dp_needs_link_train(radeon_connector)) {
875 +- /* Don't try to start link training before we
876 +- * have the dpcd */
877 +- if (!radeon_dp_getdpcd(radeon_connector))
878 +- return;
879 +-
880 +- /* set it to OFF so that drm_helper_connector_dpms()
881 +- * won't return immediately since the current state
882 +- * is ON at this point.
883 +- */
884 +- connector->dpms = DRM_MODE_DPMS_OFF;
885 +- drm_helper_connector_dpms(connector, DRM_MODE_DPMS_ON);
886 +- }
887 +- connector->dpms = saved_dpms;
888 ++ if (dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT &&
889 ++ radeon_hpd_sense(rdev, radeon_connector->hpd.hpd) &&
890 ++ radeon_dp_needs_link_train(radeon_connector)) {
891 ++ /* Don't start link training before we have the DPCD */
892 ++ if (!radeon_dp_getdpcd(radeon_connector))
893 ++ return;
894 ++
895 ++ /* Turn the connector off and back on immediately, which
896 ++ * will trigger link training
897 ++ */
898 ++ drm_helper_connector_dpms(connector, DRM_MODE_DPMS_OFF);
899 ++ drm_helper_connector_dpms(connector, DRM_MODE_DPMS_ON);
900 + }
901 + }
902 + }
903 +diff --git a/drivers/gpu/drm/udl/udl_fb.c b/drivers/gpu/drm/udl/udl_fb.c
904 +index b5b335c9b2bb..2ebdc6d5a76e 100644
905 +--- a/drivers/gpu/drm/udl/udl_fb.c
906 ++++ b/drivers/gpu/drm/udl/udl_fb.c
907 +@@ -159,10 +159,15 @@ static int udl_fb_mmap(struct fb_info *info, struct vm_area_struct *vma)
908 + {
909 + unsigned long start = vma->vm_start;
910 + unsigned long size = vma->vm_end - vma->vm_start;
911 +- unsigned long offset = vma->vm_pgoff << PAGE_SHIFT;
912 ++ unsigned long offset;
913 + unsigned long page, pos;
914 +
915 +- if (offset + size > info->fix.smem_len)
916 ++ if (vma->vm_pgoff > (~0UL >> PAGE_SHIFT))
917 ++ return -EINVAL;
918 ++
919 ++ offset = vma->vm_pgoff << PAGE_SHIFT;
920 ++
921 ++ if (offset > info->fix.smem_len || size > info->fix.smem_len - offset)
922 + return -EINVAL;
923 +
924 + pos = (unsigned long)info->fix.smem_start + offset;
925 +diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
926 +index 184340d486c3..86d25f18aa99 100644
927 +--- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
928 ++++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
929 +@@ -1337,6 +1337,19 @@ static void __vmw_svga_disable(struct vmw_private *dev_priv)
930 + */
931 + void vmw_svga_disable(struct vmw_private *dev_priv)
932 + {
933 ++ /*
934 ++ * Disabling SVGA will turn off device modesetting capabilities, so
935 ++ * notify KMS about that so that it doesn't cache atomic state that
936 ++ * isn't valid anymore, for example crtcs turned on.
937 ++ * Strictly we'd want to do this under the SVGA lock (or an SVGA mutex),
938 ++ * but vmw_kms_lost_device() takes the reservation sem and thus we'll
939 ++ * end up with lock order reversal. Thus, a master may actually perform
940 ++ * a new modeset just after we call vmw_kms_lost_device() and race with
941 ++ * vmw_svga_disable(), but that should at worst cause atomic KMS state
942 ++ * to be inconsistent with the device, causing modesetting problems.
943 ++ *
944 ++ */
945 ++ vmw_kms_lost_device(dev_priv->dev);
946 + ttm_write_lock(&dev_priv->reservation_sem, false);
947 + spin_lock(&dev_priv->svga_lock);
948 + if (dev_priv->bdev.man[TTM_PL_VRAM].use_type) {
949 +diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
950 +index 7e5f30e234b1..8c65cc3b0dda 100644
951 +--- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
952 ++++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
953 +@@ -938,6 +938,7 @@ int vmw_kms_present(struct vmw_private *dev_priv,
954 + int vmw_kms_update_layout_ioctl(struct drm_device *dev, void *data,
955 + struct drm_file *file_priv);
956 + void vmw_kms_legacy_hotspot_clear(struct vmw_private *dev_priv);
957 ++void vmw_kms_lost_device(struct drm_device *dev);
958 +
959 + int vmw_dumb_create(struct drm_file *file_priv,
960 + struct drm_device *dev,
961 +diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
962 +index fcd58145d0da..dfaaf9a2d81e 100644
963 +--- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
964 ++++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
965 +@@ -31,7 +31,6 @@
966 + #include <drm/drm_atomic_helper.h>
967 + #include <drm/drm_rect.h>
968 +
969 +-
970 + /* Might need a hrtimer here? */
971 + #define VMWGFX_PRESENT_RATE ((HZ / 60 > 0) ? HZ / 60 : 1)
972 +
973 +@@ -2531,9 +2530,12 @@ void vmw_kms_helper_buffer_finish(struct vmw_private *dev_priv,
974 + * Helper to be used if an error forces the caller to undo the actions of
975 + * vmw_kms_helper_resource_prepare.
976 + */
977 +-void vmw_kms_helper_resource_revert(struct vmw_resource *res)
978 ++void vmw_kms_helper_resource_revert(struct vmw_validation_ctx *ctx)
979 + {
980 +- vmw_kms_helper_buffer_revert(res->backup);
981 ++ struct vmw_resource *res = ctx->res;
982 ++
983 ++ vmw_kms_helper_buffer_revert(ctx->buf);
984 ++ vmw_dmabuf_unreference(&ctx->buf);
985 + vmw_resource_unreserve(res, false, NULL, 0);
986 + mutex_unlock(&res->dev_priv->cmdbuf_mutex);
987 + }
988 +@@ -2550,10 +2552,14 @@ void vmw_kms_helper_resource_revert(struct vmw_resource *res)
989 + * interrupted by a signal.
990 + */
991 + int vmw_kms_helper_resource_prepare(struct vmw_resource *res,
992 +- bool interruptible)
993 ++ bool interruptible,
994 ++ struct vmw_validation_ctx *ctx)
995 + {
996 + int ret = 0;
997 +
998 ++ ctx->buf = NULL;
999 ++ ctx->res = res;
1000 ++
1001 + if (interruptible)
1002 + ret = mutex_lock_interruptible(&res->dev_priv->cmdbuf_mutex);
1003 + else
1004 +@@ -2572,6 +2578,8 @@ int vmw_kms_helper_resource_prepare(struct vmw_resource *res,
1005 + res->dev_priv->has_mob);
1006 + if (ret)
1007 + goto out_unreserve;
1008 ++
1009 ++ ctx->buf = vmw_dmabuf_reference(res->backup);
1010 + }
1011 + ret = vmw_resource_validate(res);
1012 + if (ret)
1013 +@@ -2579,7 +2587,7 @@ int vmw_kms_helper_resource_prepare(struct vmw_resource *res,
1014 + return 0;
1015 +
1016 + out_revert:
1017 +- vmw_kms_helper_buffer_revert(res->backup);
1018 ++ vmw_kms_helper_buffer_revert(ctx->buf);
1019 + out_unreserve:
1020 + vmw_resource_unreserve(res, false, NULL, 0);
1021 + out_unlock:
1022 +@@ -2595,11 +2603,13 @@ int vmw_kms_helper_resource_prepare(struct vmw_resource *res,
1023 + * @out_fence: Optional pointer to a fence pointer. If non-NULL, a
1024 + * ref-counted fence pointer is returned here.
1025 + */
1026 +-void vmw_kms_helper_resource_finish(struct vmw_resource *res,
1027 +- struct vmw_fence_obj **out_fence)
1028 ++void vmw_kms_helper_resource_finish(struct vmw_validation_ctx *ctx,
1029 ++ struct vmw_fence_obj **out_fence)
1030 + {
1031 +- if (res->backup || out_fence)
1032 +- vmw_kms_helper_buffer_finish(res->dev_priv, NULL, res->backup,
1033 ++ struct vmw_resource *res = ctx->res;
1034 ++
1035 ++ if (ctx->buf || out_fence)
1036 ++ vmw_kms_helper_buffer_finish(res->dev_priv, NULL, ctx->buf,
1037 + out_fence, NULL);
1038 +
1039 + vmw_resource_unreserve(res, false, NULL, 0);
1040 +@@ -2865,3 +2875,14 @@ int vmw_kms_set_config(struct drm_mode_set *set,
1041 +
1042 + return drm_atomic_helper_set_config(set, ctx);
1043 + }
1044 ++
1045 ++
1046 ++/**
1047 ++ * vmw_kms_lost_device - Notify kms that modesetting capabilities will be lost
1048 ++ *
1049 ++ * @dev: Pointer to the drm device
1050 ++ */
1051 ++void vmw_kms_lost_device(struct drm_device *dev)
1052 ++{
1053 ++ drm_atomic_helper_shutdown(dev);
1054 ++}
1055 +diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.h b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.h
1056 +index cd9da2dd79af..3d2ca280eaa7 100644
1057 +--- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.h
1058 ++++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.h
1059 +@@ -240,6 +240,11 @@ struct vmw_display_unit {
1060 + int set_gui_y;
1061 + };
1062 +
1063 ++struct vmw_validation_ctx {
1064 ++ struct vmw_resource *res;
1065 ++ struct vmw_dma_buffer *buf;
1066 ++};
1067 ++
1068 + #define vmw_crtc_to_du(x) \
1069 + container_of(x, struct vmw_display_unit, crtc)
1070 + #define vmw_connector_to_du(x) \
1071 +@@ -296,9 +301,10 @@ void vmw_kms_helper_buffer_finish(struct vmw_private *dev_priv,
1072 + struct drm_vmw_fence_rep __user *
1073 + user_fence_rep);
1074 + int vmw_kms_helper_resource_prepare(struct vmw_resource *res,
1075 +- bool interruptible);
1076 +-void vmw_kms_helper_resource_revert(struct vmw_resource *res);
1077 +-void vmw_kms_helper_resource_finish(struct vmw_resource *res,
1078 ++ bool interruptible,
1079 ++ struct vmw_validation_ctx *ctx);
1080 ++void vmw_kms_helper_resource_revert(struct vmw_validation_ctx *ctx);
1081 ++void vmw_kms_helper_resource_finish(struct vmw_validation_ctx *ctx,
1082 + struct vmw_fence_obj **out_fence);
1083 + int vmw_kms_readback(struct vmw_private *dev_priv,
1084 + struct drm_file *file_priv,
1085 +@@ -439,5 +445,4 @@ int vmw_kms_stdu_dma(struct vmw_private *dev_priv,
1086 +
1087 + int vmw_kms_set_config(struct drm_mode_set *set,
1088 + struct drm_modeset_acquire_ctx *ctx);
1089 +-
1090 + #endif
1091 +diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c b/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c
1092 +index 63a4cd794b73..3ec9eae831b8 100644
1093 +--- a/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c
1094 ++++ b/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c
1095 +@@ -909,12 +909,13 @@ int vmw_kms_sou_do_surface_dirty(struct vmw_private *dev_priv,
1096 + struct vmw_framebuffer_surface *vfbs =
1097 + container_of(framebuffer, typeof(*vfbs), base);
1098 + struct vmw_kms_sou_surface_dirty sdirty;
1099 ++ struct vmw_validation_ctx ctx;
1100 + int ret;
1101 +
1102 + if (!srf)
1103 + srf = &vfbs->surface->res;
1104 +
1105 +- ret = vmw_kms_helper_resource_prepare(srf, true);
1106 ++ ret = vmw_kms_helper_resource_prepare(srf, true, &ctx);
1107 + if (ret)
1108 + return ret;
1109 +
1110 +@@ -933,7 +934,7 @@ int vmw_kms_sou_do_surface_dirty(struct vmw_private *dev_priv,
1111 + ret = vmw_kms_helper_dirty(dev_priv, framebuffer, clips, vclips,
1112 + dest_x, dest_y, num_clips, inc,
1113 + &sdirty.base);
1114 +- vmw_kms_helper_resource_finish(srf, out_fence);
1115 ++ vmw_kms_helper_resource_finish(&ctx, out_fence);
1116 +
1117 + return ret;
1118 + }
1119 +diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c b/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c
1120 +index b68d74888ab1..6b969e5dea2a 100644
1121 +--- a/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c
1122 ++++ b/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c
1123 +@@ -980,12 +980,13 @@ int vmw_kms_stdu_surface_dirty(struct vmw_private *dev_priv,
1124 + struct vmw_framebuffer_surface *vfbs =
1125 + container_of(framebuffer, typeof(*vfbs), base);
1126 + struct vmw_stdu_dirty sdirty;
1127 ++ struct vmw_validation_ctx ctx;
1128 + int ret;
1129 +
1130 + if (!srf)
1131 + srf = &vfbs->surface->res;
1132 +
1133 +- ret = vmw_kms_helper_resource_prepare(srf, true);
1134 ++ ret = vmw_kms_helper_resource_prepare(srf, true, &ctx);
1135 + if (ret)
1136 + return ret;
1137 +
1138 +@@ -1008,7 +1009,7 @@ int vmw_kms_stdu_surface_dirty(struct vmw_private *dev_priv,
1139 + dest_x, dest_y, num_clips, inc,
1140 + &sdirty.base);
1141 + out_finish:
1142 +- vmw_kms_helper_resource_finish(srf, out_fence);
1143 ++ vmw_kms_helper_resource_finish(&ctx, out_fence);
1144 +
1145 + return ret;
1146 + }
1147 +diff --git a/drivers/hv/ring_buffer.c b/drivers/hv/ring_buffer.c
1148 +index 12eb8caa4263..3f8dde8d59ba 100644
1149 +--- a/drivers/hv/ring_buffer.c
1150 ++++ b/drivers/hv/ring_buffer.c
1151 +@@ -394,13 +394,24 @@ __hv_pkt_iter_next(struct vmbus_channel *channel,
1152 + }
1153 + EXPORT_SYMBOL_GPL(__hv_pkt_iter_next);
1154 +
1155 ++/* How many bytes were read in this iterator cycle */
1156 ++static u32 hv_pkt_iter_bytes_read(const struct hv_ring_buffer_info *rbi,
1157 ++ u32 start_read_index)
1158 ++{
1159 ++ if (rbi->priv_read_index >= start_read_index)
1160 ++ return rbi->priv_read_index - start_read_index;
1161 ++ else
1162 ++ return rbi->ring_datasize - start_read_index +
1163 ++ rbi->priv_read_index;
1164 ++}
1165 ++
1166 + /*
1167 + * Update host ring buffer after iterating over packets.
1168 + */
1169 + void hv_pkt_iter_close(struct vmbus_channel *channel)
1170 + {
1171 + struct hv_ring_buffer_info *rbi = &channel->inbound;
1172 +- u32 orig_write_sz = hv_get_bytes_to_write(rbi);
1173 ++ u32 curr_write_sz, pending_sz, bytes_read, start_read_index;
1174 +
1175 + /*
1176 + * Make sure all reads are done before we update the read index since
1177 +@@ -408,8 +419,12 @@ void hv_pkt_iter_close(struct vmbus_channel *channel)
1178 + * is updated.
1179 + */
1180 + virt_rmb();
1181 ++ start_read_index = rbi->ring_buffer->read_index;
1182 + rbi->ring_buffer->read_index = rbi->priv_read_index;
1183 +
1184 ++ if (!rbi->ring_buffer->feature_bits.feat_pending_send_sz)
1185 ++ return;
1186 ++
1187 + /*
1188 + * Issue a full memory barrier before making the signaling decision.
1189 + * Here is the reason for having this barrier:
1190 +@@ -423,26 +438,29 @@ void hv_pkt_iter_close(struct vmbus_channel *channel)
1191 + */
1192 + virt_mb();
1193 +
1194 +- /* If host has disabled notifications then skip */
1195 +- if (rbi->ring_buffer->interrupt_mask)
1196 ++ pending_sz = READ_ONCE(rbi->ring_buffer->pending_send_sz);
1197 ++ if (!pending_sz)
1198 + return;
1199 +
1200 +- if (rbi->ring_buffer->feature_bits.feat_pending_send_sz) {
1201 +- u32 pending_sz = READ_ONCE(rbi->ring_buffer->pending_send_sz);
1202 ++ /*
1203 ++ * Ensure the read of write_index in hv_get_bytes_to_write()
1204 ++ * happens after the read of pending_send_sz.
1205 ++ */
1206 ++ virt_rmb();
1207 ++ curr_write_sz = hv_get_bytes_to_write(rbi);
1208 ++ bytes_read = hv_pkt_iter_bytes_read(rbi, start_read_index);
1209 +
1210 +- /*
1211 +- * If there was space before we began iteration,
1212 +- * then host was not blocked. Also handles case where
1213 +- * pending_sz is zero then host has nothing pending
1214 +- * and does not need to be signaled.
1215 +- */
1216 +- if (orig_write_sz > pending_sz)
1217 +- return;
1218 ++ /*
1219 ++ * If there was space before we began iteration,
1220 ++ * then host was not blocked.
1221 ++ */
1222 +
1223 +- /* If pending write will not fit, don't give false hope. */
1224 +- if (hv_get_bytes_to_write(rbi) < pending_sz)
1225 +- return;
1226 +- }
1227 ++ if (curr_write_sz - bytes_read > pending_sz)
1228 ++ return;
1229 ++
1230 ++ /* If pending write will not fit, don't give false hope. */
1231 ++ if (curr_write_sz <= pending_sz)
1232 ++ return;
1233 +
1234 + vmbus_setevent(channel);
1235 + }
1236 +diff --git a/drivers/hwmon/k10temp.c b/drivers/hwmon/k10temp.c
1237 +index b960015cb073..051a72eecb24 100644
1238 +--- a/drivers/hwmon/k10temp.c
1239 ++++ b/drivers/hwmon/k10temp.c
1240 +@@ -86,6 +86,7 @@ static const struct tctl_offset tctl_offset_table[] = {
1241 + { 0x17, "AMD Ryzen 7 1800X", 20000 },
1242 + { 0x17, "AMD Ryzen Threadripper 1950X", 27000 },
1243 + { 0x17, "AMD Ryzen Threadripper 1920X", 27000 },
1244 ++ { 0x17, "AMD Ryzen Threadripper 1900X", 27000 },
1245 + { 0x17, "AMD Ryzen Threadripper 1950", 10000 },
1246 + { 0x17, "AMD Ryzen Threadripper 1920", 10000 },
1247 + { 0x17, "AMD Ryzen Threadripper 1910", 10000 },
1248 +@@ -128,7 +129,10 @@ static ssize_t temp1_input_show(struct device *dev,
1249 +
1250 + data->read_tempreg(data->pdev, &regval);
1251 + temp = (regval >> 21) * 125;
1252 +- temp -= data->temp_offset;
1253 ++ if (temp > data->temp_offset)
1254 ++ temp -= data->temp_offset;
1255 ++ else
1256 ++ temp = 0;
1257 +
1258 + return sprintf(buf, "%u\n", temp);
1259 + }
1260 +diff --git a/drivers/iio/accel/st_accel_core.c b/drivers/iio/accel/st_accel_core.c
1261 +index 460aa58e0159..3e6fd5a8ac5b 100644
1262 +--- a/drivers/iio/accel/st_accel_core.c
1263 ++++ b/drivers/iio/accel/st_accel_core.c
1264 +@@ -951,7 +951,7 @@ int st_accel_common_probe(struct iio_dev *indio_dev)
1265 + if (!pdata)
1266 + pdata = (struct st_sensors_platform_data *)&default_accel_pdata;
1267 +
1268 +- err = st_sensors_init_sensor(indio_dev, adata->dev->platform_data);
1269 ++ err = st_sensors_init_sensor(indio_dev, pdata);
1270 + if (err < 0)
1271 + goto st_accel_power_off;
1272 +
1273 +diff --git a/drivers/iio/adc/meson_saradc.c b/drivers/iio/adc/meson_saradc.c
1274 +index 36047147ce7c..0d237fd69769 100644
1275 +--- a/drivers/iio/adc/meson_saradc.c
1276 ++++ b/drivers/iio/adc/meson_saradc.c
1277 +@@ -462,8 +462,10 @@ static int meson_sar_adc_lock(struct iio_dev *indio_dev)
1278 + regmap_read(priv->regmap, MESON_SAR_ADC_DELAY, &val);
1279 + } while (val & MESON_SAR_ADC_DELAY_BL30_BUSY && timeout--);
1280 +
1281 +- if (timeout < 0)
1282 ++ if (timeout < 0) {
1283 ++ mutex_unlock(&indio_dev->mlock);
1284 + return -ETIMEDOUT;
1285 ++ }
1286 + }
1287 +
1288 + return 0;
1289 +diff --git a/drivers/iio/chemical/ccs811.c b/drivers/iio/chemical/ccs811.c
1290 +index fbe2431f5b81..1ea9f5513b02 100644
1291 +--- a/drivers/iio/chemical/ccs811.c
1292 ++++ b/drivers/iio/chemical/ccs811.c
1293 +@@ -133,6 +133,9 @@ static int ccs811_start_sensor_application(struct i2c_client *client)
1294 + if (ret < 0)
1295 + return ret;
1296 +
1297 ++ if ((ret & CCS811_STATUS_FW_MODE_APPLICATION))
1298 ++ return 0;
1299 ++
1300 + if ((ret & CCS811_STATUS_APP_VALID_MASK) !=
1301 + CCS811_STATUS_APP_VALID_LOADED)
1302 + return -EIO;
1303 +diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h
1304 +index 4fdb7fcc3ea8..cebc6bd31b79 100644
1305 +--- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h
1306 ++++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h
1307 +@@ -130,6 +130,7 @@ struct st_lsm6dsx_sensor {
1308 + * @irq: Device interrupt line (I2C or SPI).
1309 + * @lock: Mutex to protect read and write operations.
1310 + * @fifo_lock: Mutex to prevent concurrent access to the hw FIFO.
1311 ++ * @conf_lock: Mutex to prevent concurrent FIFO configuration update.
1312 + * @fifo_mode: FIFO operating mode supported by the device.
1313 + * @enable_mask: Enabled sensor bitmask.
1314 + * @sip: Total number of samples (acc/gyro) in a given pattern.
1315 +@@ -144,6 +145,7 @@ struct st_lsm6dsx_hw {
1316 +
1317 + struct mutex lock;
1318 + struct mutex fifo_lock;
1319 ++ struct mutex conf_lock;
1320 +
1321 + enum st_lsm6dsx_fifo_mode fifo_mode;
1322 + u8 enable_mask;
1323 +diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c
1324 +index 755c472e8a05..c899d658f6be 100644
1325 +--- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c
1326 ++++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c
1327 +@@ -325,38 +325,40 @@ static int st_lsm6dsx_update_fifo(struct iio_dev *iio_dev, bool enable)
1328 + struct st_lsm6dsx_hw *hw = sensor->hw;
1329 + int err;
1330 +
1331 ++ mutex_lock(&hw->conf_lock);
1332 ++
1333 + if (hw->fifo_mode != ST_LSM6DSX_FIFO_BYPASS) {
1334 + err = st_lsm6dsx_flush_fifo(hw);
1335 + if (err < 0)
1336 +- return err;
1337 ++ goto out;
1338 + }
1339 +
1340 + if (enable) {
1341 + err = st_lsm6dsx_sensor_enable(sensor);
1342 + if (err < 0)
1343 +- return err;
1344 ++ goto out;
1345 + } else {
1346 + err = st_lsm6dsx_sensor_disable(sensor);
1347 + if (err < 0)
1348 +- return err;
1349 ++ goto out;
1350 + }
1351 +
1352 + err = st_lsm6dsx_set_fifo_odr(sensor, enable);
1353 + if (err < 0)
1354 +- return err;
1355 ++ goto out;
1356 +
1357 + err = st_lsm6dsx_update_decimators(hw);
1358 + if (err < 0)
1359 +- return err;
1360 ++ goto out;
1361 +
1362 + err = st_lsm6dsx_update_watermark(sensor, sensor->watermark);
1363 + if (err < 0)
1364 +- return err;
1365 ++ goto out;
1366 +
1367 + if (hw->enable_mask) {
1368 + err = st_lsm6dsx_set_fifo_mode(hw, ST_LSM6DSX_FIFO_CONT);
1369 + if (err < 0)
1370 +- return err;
1371 ++ goto out;
1372 +
1373 + /*
1374 + * store enable buffer timestamp as reference to compute
1375 +@@ -365,7 +367,10 @@ static int st_lsm6dsx_update_fifo(struct iio_dev *iio_dev, bool enable)
1376 + sensor->ts = iio_get_time_ns(iio_dev);
1377 + }
1378 +
1379 +- return 0;
1380 ++out:
1381 ++ mutex_unlock(&hw->conf_lock);
1382 ++
1383 ++ return err;
1384 + }
1385 +
1386 + static irqreturn_t st_lsm6dsx_handler_irq(int irq, void *private)
1387 +diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
1388 +index 239c735242be..4d43c956d676 100644
1389 +--- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
1390 ++++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
1391 +@@ -448,7 +448,7 @@ static int st_lsm6dsx_read_oneshot(struct st_lsm6dsx_sensor *sensor,
1392 +
1393 + st_lsm6dsx_sensor_disable(sensor);
1394 +
1395 +- *val = (s16)data;
1396 ++ *val = (s16)le16_to_cpu(data);
1397 +
1398 + return IIO_VAL_INT;
1399 + }
1400 +@@ -528,7 +528,12 @@ static int st_lsm6dsx_set_watermark(struct iio_dev *iio_dev, unsigned int val)
1401 + if (val < 1 || val > hw->settings->max_fifo_size)
1402 + return -EINVAL;
1403 +
1404 ++ mutex_lock(&hw->conf_lock);
1405 ++
1406 + err = st_lsm6dsx_update_watermark(sensor, val);
1407 ++
1408 ++ mutex_unlock(&hw->conf_lock);
1409 ++
1410 + if (err < 0)
1411 + return err;
1412 +
1413 +@@ -739,6 +744,7 @@ int st_lsm6dsx_probe(struct device *dev, int irq, int hw_id, const char *name,
1414 +
1415 + mutex_init(&hw->lock);
1416 + mutex_init(&hw->fifo_lock);
1417 ++ mutex_init(&hw->conf_lock);
1418 +
1419 + hw->dev = dev;
1420 + hw->irq = irq;
1421 +diff --git a/drivers/iio/pressure/st_pressure_core.c b/drivers/iio/pressure/st_pressure_core.c
1422 +index 349e5c713c03..4ddb6cf7d401 100644
1423 +--- a/drivers/iio/pressure/st_pressure_core.c
1424 ++++ b/drivers/iio/pressure/st_pressure_core.c
1425 +@@ -640,7 +640,7 @@ int st_press_common_probe(struct iio_dev *indio_dev)
1426 + press_data->sensor_settings->drdy_irq.int2.addr))
1427 + pdata = (struct st_sensors_platform_data *)&default_press_pdata;
1428 +
1429 +- err = st_sensors_init_sensor(indio_dev, press_data->dev->platform_data);
1430 ++ err = st_sensors_init_sensor(indio_dev, pdata);
1431 + if (err < 0)
1432 + goto st_press_power_off;
1433 +
1434 +diff --git a/drivers/infiniband/hw/mlx5/mr.c b/drivers/infiniband/hw/mlx5/mr.c
1435 +index 1961c6a45437..c51c602f06d6 100644
1436 +--- a/drivers/infiniband/hw/mlx5/mr.c
1437 ++++ b/drivers/infiniband/hw/mlx5/mr.c
1438 +@@ -838,7 +838,8 @@ static int mr_umem_get(struct ib_pd *pd, u64 start, u64 length,
1439 + *umem = ib_umem_get(pd->uobject->context, start, length,
1440 + access_flags, 0);
1441 + err = PTR_ERR_OR_ZERO(*umem);
1442 +- if (err < 0) {
1443 ++ if (err) {
1444 ++ *umem = NULL;
1445 + mlx5_ib_err(dev, "umem get failed (%d)\n", err);
1446 + return err;
1447 + }
1448 +@@ -1415,6 +1416,7 @@ int mlx5_ib_rereg_user_mr(struct ib_mr *ib_mr, int flags, u64 start,
1449 + if (err) {
1450 + mlx5_ib_warn(dev, "Failed to rereg UMR\n");
1451 + ib_umem_release(mr->umem);
1452 ++ mr->umem = NULL;
1453 + clean_mr(dev, mr);
1454 + return err;
1455 + }
1456 +@@ -1498,14 +1500,11 @@ static int clean_mr(struct mlx5_ib_dev *dev, struct mlx5_ib_mr *mr)
1457 + u32 key = mr->mmkey.key;
1458 +
1459 + err = destroy_mkey(dev, mr);
1460 +- kfree(mr);
1461 + if (err) {
1462 + mlx5_ib_warn(dev, "failed to destroy mkey 0x%x (%d)\n",
1463 + key, err);
1464 + return err;
1465 + }
1466 +- } else {
1467 +- mlx5_mr_cache_free(dev, mr);
1468 + }
1469 +
1470 + return 0;
1471 +@@ -1548,6 +1547,11 @@ static int dereg_mr(struct mlx5_ib_dev *dev, struct mlx5_ib_mr *mr)
1472 + atomic_sub(npages, &dev->mdev->priv.reg_pages);
1473 + }
1474 +
1475 ++ if (!mr->allocated_from_cache)
1476 ++ kfree(mr);
1477 ++ else
1478 ++ mlx5_mr_cache_free(dev, mr);
1479 ++
1480 + return 0;
1481 + }
1482 +
1483 +diff --git a/drivers/media/platform/tegra-cec/tegra_cec.c b/drivers/media/platform/tegra-cec/tegra_cec.c
1484 +index 92f93a880015..aba488cd0e64 100644
1485 +--- a/drivers/media/platform/tegra-cec/tegra_cec.c
1486 ++++ b/drivers/media/platform/tegra-cec/tegra_cec.c
1487 +@@ -172,16 +172,13 @@ static irqreturn_t tegra_cec_irq_handler(int irq, void *data)
1488 + }
1489 + }
1490 +
1491 +- if (status & (TEGRA_CEC_INT_STAT_RX_REGISTER_OVERRUN |
1492 +- TEGRA_CEC_INT_STAT_RX_BUS_ANOMALY_DETECTED |
1493 +- TEGRA_CEC_INT_STAT_RX_START_BIT_DETECTED |
1494 +- TEGRA_CEC_INT_STAT_RX_BUS_ERROR_DETECTED)) {
1495 ++ if (status & TEGRA_CEC_INT_STAT_RX_START_BIT_DETECTED) {
1496 + cec_write(cec, TEGRA_CEC_INT_STAT,
1497 +- (TEGRA_CEC_INT_STAT_RX_REGISTER_OVERRUN |
1498 +- TEGRA_CEC_INT_STAT_RX_BUS_ANOMALY_DETECTED |
1499 +- TEGRA_CEC_INT_STAT_RX_START_BIT_DETECTED |
1500 +- TEGRA_CEC_INT_STAT_RX_BUS_ERROR_DETECTED));
1501 +- } else if (status & TEGRA_CEC_INT_STAT_RX_REGISTER_FULL) {
1502 ++ TEGRA_CEC_INT_STAT_RX_START_BIT_DETECTED);
1503 ++ cec->rx_done = false;
1504 ++ cec->rx_buf_cnt = 0;
1505 ++ }
1506 ++ if (status & TEGRA_CEC_INT_STAT_RX_REGISTER_FULL) {
1507 + u32 v;
1508 +
1509 + cec_write(cec, TEGRA_CEC_INT_STAT,
1510 +@@ -255,7 +252,7 @@ static int tegra_cec_adap_enable(struct cec_adapter *adap, bool enable)
1511 + TEGRA_CEC_INT_MASK_TX_BUS_ANOMALY_DETECTED |
1512 + TEGRA_CEC_INT_MASK_TX_FRAME_TRANSMITTED |
1513 + TEGRA_CEC_INT_MASK_RX_REGISTER_FULL |
1514 +- TEGRA_CEC_INT_MASK_RX_REGISTER_OVERRUN);
1515 ++ TEGRA_CEC_INT_MASK_RX_START_BIT_DETECTED);
1516 +
1517 + cec_write(cec, TEGRA_CEC_HW_CONTROL, TEGRA_CEC_HWCTRL_TX_RX_MODE);
1518 + return 0;
1519 +diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c
1520 +index b737a9540331..df5fe43072d6 100644
1521 +--- a/drivers/mmc/core/block.c
1522 ++++ b/drivers/mmc/core/block.c
1523 +@@ -66,6 +66,7 @@ MODULE_ALIAS("mmc:block");
1524 + #define MMC_BLK_TIMEOUT_MS (10 * 60 * 1000) /* 10 minute timeout */
1525 + #define MMC_SANITIZE_REQ_TIMEOUT 240000
1526 + #define MMC_EXTRACT_INDEX_FROM_ARG(x) ((x & 0x00FF0000) >> 16)
1527 ++#define MMC_EXTRACT_VALUE_FROM_ARG(x) ((x & 0x0000FF00) >> 8)
1528 +
1529 + #define mmc_req_rel_wr(req) ((req->cmd_flags & REQ_FUA) && \
1530 + (rq_data_dir(req) == WRITE))
1531 +@@ -579,6 +580,24 @@ static int __mmc_blk_ioctl_cmd(struct mmc_card *card, struct mmc_blk_data *md,
1532 + return data.error;
1533 + }
1534 +
1535 ++ /*
1536 ++ * Make sure the cache of the PARTITION_CONFIG register and
1537 ++ * PARTITION_ACCESS bits is updated in case the ioctl ext_csd write
1538 ++ * changed it successfully.
1539 ++ */
1540 ++ if ((MMC_EXTRACT_INDEX_FROM_ARG(cmd.arg) == EXT_CSD_PART_CONFIG) &&
1541 ++ (cmd.opcode == MMC_SWITCH)) {
1542 ++ struct mmc_blk_data *main_md = dev_get_drvdata(&card->dev);
1543 ++ u8 value = MMC_EXTRACT_VALUE_FROM_ARG(cmd.arg);
1544 ++
1545 ++ /*
1546 ++ * Update cache so the next mmc_blk_part_switch call operates
1547 ++ * on up-to-date data.
1548 ++ */
1549 ++ card->ext_csd.part_config = value;
1550 ++ main_md->part_curr = value & EXT_CSD_PART_CONFIG_ACC_MASK;
1551 ++ }
1552 ++
1553 + /*
1554 + * According to the SD specs, some commands require a delay after
1555 + * issuing the command.
1556 +diff --git a/drivers/mmc/core/card.h b/drivers/mmc/core/card.h
1557 +index 79a5b985ccf5..9c821eedd156 100644
1558 +--- a/drivers/mmc/core/card.h
1559 ++++ b/drivers/mmc/core/card.h
1560 +@@ -82,6 +82,7 @@ struct mmc_fixup {
1561 + #define CID_MANFID_APACER 0x27
1562 + #define CID_MANFID_KINGSTON 0x70
1563 + #define CID_MANFID_HYNIX 0x90
1564 ++#define CID_MANFID_NUMONYX 0xFE
1565 +
1566 + #define END_FIXUP { NULL }
1567 +
1568 +diff --git a/drivers/mmc/core/quirks.h b/drivers/mmc/core/quirks.h
1569 +index 75d317623852..5153577754f0 100644
1570 +--- a/drivers/mmc/core/quirks.h
1571 ++++ b/drivers/mmc/core/quirks.h
1572 +@@ -109,6 +109,12 @@ static const struct mmc_fixup mmc_ext_csd_fixups[] = {
1573 + */
1574 + MMC_FIXUP_EXT_CSD_REV(CID_NAME_ANY, CID_MANFID_HYNIX,
1575 + 0x014a, add_quirk, MMC_QUIRK_BROKEN_HPI, 5),
1576 ++ /*
1577 ++ * Certain Micron (Numonyx) eMMC 4.5 cards might get broken when HPI
1578 ++ * feature is used so disable the HPI feature for such buggy cards.
1579 ++ */
1580 ++ MMC_FIXUP_EXT_CSD_REV(CID_NAME_ANY, CID_MANFID_NUMONYX,
1581 ++ 0x014e, add_quirk, MMC_QUIRK_BROKEN_HPI, 6),
1582 +
1583 + END_FIXUP
1584 + };
1585 +diff --git a/drivers/mmc/host/dw_mmc-exynos.c b/drivers/mmc/host/dw_mmc-exynos.c
1586 +index fa41d9422d57..a84aa3f1ae85 100644
1587 +--- a/drivers/mmc/host/dw_mmc-exynos.c
1588 ++++ b/drivers/mmc/host/dw_mmc-exynos.c
1589 +@@ -165,9 +165,15 @@ static void dw_mci_exynos_set_clksel_timing(struct dw_mci *host, u32 timing)
1590 + static int dw_mci_exynos_runtime_resume(struct device *dev)
1591 + {
1592 + struct dw_mci *host = dev_get_drvdata(dev);
1593 ++ int ret;
1594 ++
1595 ++ ret = dw_mci_runtime_resume(dev);
1596 ++ if (ret)
1597 ++ return ret;
1598 +
1599 + dw_mci_exynos_config_smu(host);
1600 +- return dw_mci_runtime_resume(dev);
1601 ++
1602 ++ return ret;
1603 + }
1604 +
1605 + /**
1606 +diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
1607 +index d9b4acefed31..06d47414d0c1 100644
1608 +--- a/drivers/mmc/host/dw_mmc.c
1609 ++++ b/drivers/mmc/host/dw_mmc.c
1610 +@@ -413,7 +413,9 @@ static inline void dw_mci_set_cto(struct dw_mci *host)
1611 + cto_div = (mci_readl(host, CLKDIV) & 0xff) * 2;
1612 + if (cto_div == 0)
1613 + cto_div = 1;
1614 +- cto_ms = DIV_ROUND_UP(MSEC_PER_SEC * cto_clks * cto_div, host->bus_hz);
1615 ++
1616 ++ cto_ms = DIV_ROUND_UP_ULL((u64)MSEC_PER_SEC * cto_clks * cto_div,
1617 ++ host->bus_hz);
1618 +
1619 + /* add a bit spare time */
1620 + cto_ms += 10;
1621 +@@ -562,6 +564,7 @@ static int dw_mci_idmac_init(struct dw_mci *host)
1622 + (sizeof(struct idmac_desc_64addr) *
1623 + (i + 1))) >> 32;
1624 + /* Initialize reserved and buffer size fields to "0" */
1625 ++ p->des0 = 0;
1626 + p->des1 = 0;
1627 + p->des2 = 0;
1628 + p->des3 = 0;
1629 +@@ -584,6 +587,7 @@ static int dw_mci_idmac_init(struct dw_mci *host)
1630 + i++, p++) {
1631 + p->des3 = cpu_to_le32(host->sg_dma +
1632 + (sizeof(struct idmac_desc) * (i + 1)));
1633 ++ p->des0 = 0;
1634 + p->des1 = 0;
1635 + }
1636 +
1637 +@@ -1799,8 +1803,8 @@ static bool dw_mci_reset(struct dw_mci *host)
1638 + }
1639 +
1640 + if (host->use_dma == TRANS_MODE_IDMAC)
1641 +- /* It is also recommended that we reset and reprogram idmac */
1642 +- dw_mci_idmac_reset(host);
1643 ++ /* It is also required that we reinit idmac */
1644 ++ dw_mci_idmac_init(host);
1645 +
1646 + ret = true;
1647 +
1648 +@@ -1948,8 +1952,9 @@ static void dw_mci_set_drto(struct dw_mci *host)
1649 + drto_div = (mci_readl(host, CLKDIV) & 0xff) * 2;
1650 + if (drto_div == 0)
1651 + drto_div = 1;
1652 +- drto_ms = DIV_ROUND_UP(MSEC_PER_SEC * drto_clks * drto_div,
1653 +- host->bus_hz);
1654 ++
1655 ++ drto_ms = DIV_ROUND_UP_ULL((u64)MSEC_PER_SEC * drto_clks * drto_div,
1656 ++ host->bus_hz);
1657 +
1658 + /* add a bit spare time */
1659 + drto_ms += 10;
1660 +diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c
1661 +index de8c902059b8..7d80a8bb96fe 100644
1662 +--- a/drivers/mtd/mtdchar.c
1663 ++++ b/drivers/mtd/mtdchar.c
1664 +@@ -479,7 +479,7 @@ static int shrink_ecclayout(struct mtd_info *mtd,
1665 + for (i = 0; i < MTD_MAX_ECCPOS_ENTRIES;) {
1666 + u32 eccpos;
1667 +
1668 +- ret = mtd_ooblayout_ecc(mtd, section, &oobregion);
1669 ++ ret = mtd_ooblayout_ecc(mtd, section++, &oobregion);
1670 + if (ret < 0) {
1671 + if (ret != -ERANGE)
1672 + return ret;
1673 +@@ -526,7 +526,7 @@ static int get_oobinfo(struct mtd_info *mtd, struct nand_oobinfo *to)
1674 + for (i = 0; i < ARRAY_SIZE(to->eccpos);) {
1675 + u32 eccpos;
1676 +
1677 +- ret = mtd_ooblayout_ecc(mtd, section, &oobregion);
1678 ++ ret = mtd_ooblayout_ecc(mtd, section++, &oobregion);
1679 + if (ret < 0) {
1680 + if (ret != -ERANGE)
1681 + return ret;
1682 +diff --git a/drivers/mtd/nand/fsl_ifc_nand.c b/drivers/mtd/nand/fsl_ifc_nand.c
1683 +index bbdd68a54d68..4005b427023c 100644
1684 +--- a/drivers/mtd/nand/fsl_ifc_nand.c
1685 ++++ b/drivers/mtd/nand/fsl_ifc_nand.c
1686 +@@ -173,14 +173,9 @@ static void set_addr(struct mtd_info *mtd, int column, int page_addr, int oob)
1687 +
1688 + /* returns nonzero if entire page is blank */
1689 + static int check_read_ecc(struct mtd_info *mtd, struct fsl_ifc_ctrl *ctrl,
1690 +- u32 *eccstat, unsigned int bufnum)
1691 ++ u32 eccstat, unsigned int bufnum)
1692 + {
1693 +- u32 reg = eccstat[bufnum / 4];
1694 +- int errors;
1695 +-
1696 +- errors = (reg >> ((3 - bufnum % 4) * 8)) & 15;
1697 +-
1698 +- return errors;
1699 ++ return (eccstat >> ((3 - bufnum % 4) * 8)) & 15;
1700 + }
1701 +
1702 + /*
1703 +@@ -193,7 +188,7 @@ static void fsl_ifc_run_command(struct mtd_info *mtd)
1704 + struct fsl_ifc_ctrl *ctrl = priv->ctrl;
1705 + struct fsl_ifc_nand_ctrl *nctrl = ifc_nand_ctrl;
1706 + struct fsl_ifc_runtime __iomem *ifc = ctrl->rregs;
1707 +- u32 eccstat[4];
1708 ++ u32 eccstat;
1709 + int i;
1710 +
1711 + /* set the chip select for NAND Transaction */
1712 +@@ -228,19 +223,17 @@ static void fsl_ifc_run_command(struct mtd_info *mtd)
1713 + if (nctrl->eccread) {
1714 + int errors;
1715 + int bufnum = nctrl->page & priv->bufnum_mask;
1716 +- int sector = bufnum * chip->ecc.steps;
1717 +- int sector_end = sector + chip->ecc.steps - 1;
1718 ++ int sector_start = bufnum * chip->ecc.steps;
1719 ++ int sector_end = sector_start + chip->ecc.steps - 1;
1720 + __be32 *eccstat_regs;
1721 +
1722 +- if (ctrl->version >= FSL_IFC_VERSION_2_0_0)
1723 +- eccstat_regs = ifc->ifc_nand.v2_nand_eccstat;
1724 +- else
1725 +- eccstat_regs = ifc->ifc_nand.v1_nand_eccstat;
1726 ++ eccstat_regs = ifc->ifc_nand.nand_eccstat;
1727 ++ eccstat = ifc_in32(&eccstat_regs[sector_start / 4]);
1728 +
1729 +- for (i = sector / 4; i <= sector_end / 4; i++)
1730 +- eccstat[i] = ifc_in32(&eccstat_regs[i]);
1731 ++ for (i = sector_start; i <= sector_end; i++) {
1732 ++ if (i != sector_start && !(i % 4))
1733 ++ eccstat = ifc_in32(&eccstat_regs[i / 4]);
1734 +
1735 +- for (i = sector; i <= sector_end; i++) {
1736 + errors = check_read_ecc(mtd, ctrl, eccstat, i);
1737 +
1738 + if (errors == 15) {
1739 +@@ -626,6 +619,7 @@ static int fsl_ifc_wait(struct mtd_info *mtd, struct nand_chip *chip)
1740 + struct fsl_ifc_ctrl *ctrl = priv->ctrl;
1741 + struct fsl_ifc_runtime __iomem *ifc = ctrl->rregs;
1742 + u32 nand_fsr;
1743 ++ int status;
1744 +
1745 + /* Use READ_STATUS command, but wait for the device to be ready */
1746 + ifc_out32((IFC_FIR_OP_CW0 << IFC_NAND_FIR0_OP0_SHIFT) |
1747 +@@ -640,12 +634,12 @@ static int fsl_ifc_wait(struct mtd_info *mtd, struct nand_chip *chip)
1748 + fsl_ifc_run_command(mtd);
1749 +
1750 + nand_fsr = ifc_in32(&ifc->ifc_nand.nand_fsr);
1751 +-
1752 ++ status = nand_fsr >> 24;
1753 + /*
1754 + * The chip always seems to report that it is
1755 + * write-protected, even when it is not.
1756 + */
1757 +- return nand_fsr | NAND_STATUS_WP;
1758 ++ return status | NAND_STATUS_WP;
1759 + }
1760 +
1761 + /*
1762 +diff --git a/drivers/net/can/cc770/cc770.c b/drivers/net/can/cc770/cc770.c
1763 +index 1e37313054f3..6da69af103e6 100644
1764 +--- a/drivers/net/can/cc770/cc770.c
1765 ++++ b/drivers/net/can/cc770/cc770.c
1766 +@@ -390,37 +390,23 @@ static int cc770_get_berr_counter(const struct net_device *dev,
1767 + return 0;
1768 + }
1769 +
1770 +-static netdev_tx_t cc770_start_xmit(struct sk_buff *skb, struct net_device *dev)
1771 ++static void cc770_tx(struct net_device *dev, int mo)
1772 + {
1773 + struct cc770_priv *priv = netdev_priv(dev);
1774 +- struct net_device_stats *stats = &dev->stats;
1775 +- struct can_frame *cf = (struct can_frame *)skb->data;
1776 +- unsigned int mo = obj2msgobj(CC770_OBJ_TX);
1777 ++ struct can_frame *cf = (struct can_frame *)priv->tx_skb->data;
1778 + u8 dlc, rtr;
1779 + u32 id;
1780 + int i;
1781 +
1782 +- if (can_dropped_invalid_skb(dev, skb))
1783 +- return NETDEV_TX_OK;
1784 +-
1785 +- if ((cc770_read_reg(priv,
1786 +- msgobj[mo].ctrl1) & TXRQST_UNC) == TXRQST_SET) {
1787 +- netdev_err(dev, "TX register is still occupied!\n");
1788 +- return NETDEV_TX_BUSY;
1789 +- }
1790 +-
1791 +- netif_stop_queue(dev);
1792 +-
1793 + dlc = cf->can_dlc;
1794 + id = cf->can_id;
1795 +- if (cf->can_id & CAN_RTR_FLAG)
1796 +- rtr = 0;
1797 +- else
1798 +- rtr = MSGCFG_DIR;
1799 ++ rtr = cf->can_id & CAN_RTR_FLAG ? 0 : MSGCFG_DIR;
1800 ++
1801 ++ cc770_write_reg(priv, msgobj[mo].ctrl0,
1802 ++ MSGVAL_RES | TXIE_RES | RXIE_RES | INTPND_RES);
1803 + cc770_write_reg(priv, msgobj[mo].ctrl1,
1804 + RMTPND_RES | TXRQST_RES | CPUUPD_SET | NEWDAT_RES);
1805 +- cc770_write_reg(priv, msgobj[mo].ctrl0,
1806 +- MSGVAL_SET | TXIE_SET | RXIE_RES | INTPND_RES);
1807 ++
1808 + if (id & CAN_EFF_FLAG) {
1809 + id &= CAN_EFF_MASK;
1810 + cc770_write_reg(priv, msgobj[mo].config,
1811 +@@ -439,22 +425,30 @@ static netdev_tx_t cc770_start_xmit(struct sk_buff *skb, struct net_device *dev)
1812 + for (i = 0; i < dlc; i++)
1813 + cc770_write_reg(priv, msgobj[mo].data[i], cf->data[i]);
1814 +
1815 +- /* Store echo skb before starting the transfer */
1816 +- can_put_echo_skb(skb, dev, 0);
1817 +-
1818 + cc770_write_reg(priv, msgobj[mo].ctrl1,
1819 +- RMTPND_RES | TXRQST_SET | CPUUPD_RES | NEWDAT_UNC);
1820 ++ RMTPND_UNC | TXRQST_SET | CPUUPD_RES | NEWDAT_UNC);
1821 ++ cc770_write_reg(priv, msgobj[mo].ctrl0,
1822 ++ MSGVAL_SET | TXIE_SET | RXIE_SET | INTPND_UNC);
1823 ++}
1824 +
1825 +- stats->tx_bytes += dlc;
1826 ++static netdev_tx_t cc770_start_xmit(struct sk_buff *skb, struct net_device *dev)
1827 ++{
1828 ++ struct cc770_priv *priv = netdev_priv(dev);
1829 ++ unsigned int mo = obj2msgobj(CC770_OBJ_TX);
1830 +
1831 ++ if (can_dropped_invalid_skb(dev, skb))
1832 ++ return NETDEV_TX_OK;
1833 +
1834 +- /*
1835 +- * HM: We had some cases of repeated IRQs so make sure the
1836 +- * INT is acknowledged I know it's already further up, but
1837 +- * doing again fixed the issue
1838 +- */
1839 +- cc770_write_reg(priv, msgobj[mo].ctrl0,
1840 +- MSGVAL_UNC | TXIE_UNC | RXIE_UNC | INTPND_RES);
1841 ++ netif_stop_queue(dev);
1842 ++
1843 ++ if ((cc770_read_reg(priv,
1844 ++ msgobj[mo].ctrl1) & TXRQST_UNC) == TXRQST_SET) {
1845 ++ netdev_err(dev, "TX register is still occupied!\n");
1846 ++ return NETDEV_TX_BUSY;
1847 ++ }
1848 ++
1849 ++ priv->tx_skb = skb;
1850 ++ cc770_tx(dev, mo);
1851 +
1852 + return NETDEV_TX_OK;
1853 + }
1854 +@@ -680,19 +674,46 @@ static void cc770_tx_interrupt(struct net_device *dev, unsigned int o)
1855 + struct cc770_priv *priv = netdev_priv(dev);
1856 + struct net_device_stats *stats = &dev->stats;
1857 + unsigned int mo = obj2msgobj(o);
1858 ++ struct can_frame *cf;
1859 ++ u8 ctrl1;
1860 ++
1861 ++ ctrl1 = cc770_read_reg(priv, msgobj[mo].ctrl1);
1862 +
1863 +- /* Nothing more to send, switch off interrupts */
1864 + cc770_write_reg(priv, msgobj[mo].ctrl0,
1865 + MSGVAL_RES | TXIE_RES | RXIE_RES | INTPND_RES);
1866 +- /*
1867 +- * We had some cases of repeated IRQ so make sure the
1868 +- * INT is acknowledged
1869 ++ cc770_write_reg(priv, msgobj[mo].ctrl1,
1870 ++ RMTPND_RES | TXRQST_RES | MSGLST_RES | NEWDAT_RES);
1871 ++
1872 ++ if (unlikely(!priv->tx_skb)) {
1873 ++ netdev_err(dev, "missing tx skb in tx interrupt\n");
1874 ++ return;
1875 ++ }
1876 ++
1877 ++ if (unlikely(ctrl1 & MSGLST_SET)) {
1878 ++ stats->rx_over_errors++;
1879 ++ stats->rx_errors++;
1880 ++ }
1881 ++
1882 ++ /* When the CC770 is sending an RTR message and it receives a regular
1883 ++ * message that matches the id of the RTR message, it will overwrite the
1884 ++ * outgoing message in the TX register. When this happens we must
1885 ++ * process the received message and try to transmit the outgoing skb
1886 ++ * again.
1887 + */
1888 +- cc770_write_reg(priv, msgobj[mo].ctrl0,
1889 +- MSGVAL_UNC | TXIE_UNC | RXIE_UNC | INTPND_RES);
1890 ++ if (unlikely(ctrl1 & NEWDAT_SET)) {
1891 ++ cc770_rx(dev, mo, ctrl1);
1892 ++ cc770_tx(dev, mo);
1893 ++ return;
1894 ++ }
1895 +
1896 ++ cf = (struct can_frame *)priv->tx_skb->data;
1897 ++ stats->tx_bytes += cf->can_dlc;
1898 + stats->tx_packets++;
1899 ++
1900 ++ can_put_echo_skb(priv->tx_skb, dev, 0);
1901 + can_get_echo_skb(dev, 0);
1902 ++ priv->tx_skb = NULL;
1903 ++
1904 + netif_wake_queue(dev);
1905 + }
1906 +
1907 +@@ -804,6 +825,7 @@ struct net_device *alloc_cc770dev(int sizeof_priv)
1908 + priv->can.do_set_bittiming = cc770_set_bittiming;
1909 + priv->can.do_set_mode = cc770_set_mode;
1910 + priv->can.ctrlmode_supported = CAN_CTRLMODE_3_SAMPLES;
1911 ++ priv->tx_skb = NULL;
1912 +
1913 + memcpy(priv->obj_flags, cc770_obj_flags, sizeof(cc770_obj_flags));
1914 +
1915 +diff --git a/drivers/net/can/cc770/cc770.h b/drivers/net/can/cc770/cc770.h
1916 +index a1739db98d91..95752e1d1283 100644
1917 +--- a/drivers/net/can/cc770/cc770.h
1918 ++++ b/drivers/net/can/cc770/cc770.h
1919 +@@ -193,6 +193,8 @@ struct cc770_priv {
1920 + u8 cpu_interface; /* CPU interface register */
1921 + u8 clkout; /* Clock out register */
1922 + u8 bus_config; /* Bus conffiguration register */
1923 ++
1924 ++ struct sk_buff *tx_skb;
1925 + };
1926 +
1927 + struct net_device *alloc_cc770dev(int sizeof_priv);
1928 +diff --git a/drivers/net/can/ifi_canfd/ifi_canfd.c b/drivers/net/can/ifi_canfd/ifi_canfd.c
1929 +index 2772d05ff11c..fedd927ba6ed 100644
1930 +--- a/drivers/net/can/ifi_canfd/ifi_canfd.c
1931 ++++ b/drivers/net/can/ifi_canfd/ifi_canfd.c
1932 +@@ -30,6 +30,7 @@
1933 + #define IFI_CANFD_STCMD_ERROR_ACTIVE BIT(2)
1934 + #define IFI_CANFD_STCMD_ERROR_PASSIVE BIT(3)
1935 + #define IFI_CANFD_STCMD_BUSOFF BIT(4)
1936 ++#define IFI_CANFD_STCMD_ERROR_WARNING BIT(5)
1937 + #define IFI_CANFD_STCMD_BUSMONITOR BIT(16)
1938 + #define IFI_CANFD_STCMD_LOOPBACK BIT(18)
1939 + #define IFI_CANFD_STCMD_DISABLE_CANFD BIT(24)
1940 +@@ -52,7 +53,10 @@
1941 + #define IFI_CANFD_TXSTCMD_OVERFLOW BIT(13)
1942 +
1943 + #define IFI_CANFD_INTERRUPT 0xc
1944 ++#define IFI_CANFD_INTERRUPT_ERROR_BUSOFF BIT(0)
1945 + #define IFI_CANFD_INTERRUPT_ERROR_WARNING BIT(1)
1946 ++#define IFI_CANFD_INTERRUPT_ERROR_STATE_CHG BIT(2)
1947 ++#define IFI_CANFD_INTERRUPT_ERROR_REC_TEC_INC BIT(3)
1948 + #define IFI_CANFD_INTERRUPT_ERROR_COUNTER BIT(10)
1949 + #define IFI_CANFD_INTERRUPT_TXFIFO_EMPTY BIT(16)
1950 + #define IFI_CANFD_INTERRUPT_TXFIFO_REMOVE BIT(22)
1951 +@@ -61,6 +65,10 @@
1952 + #define IFI_CANFD_INTERRUPT_SET_IRQ ((u32)BIT(31))
1953 +
1954 + #define IFI_CANFD_IRQMASK 0x10
1955 ++#define IFI_CANFD_IRQMASK_ERROR_BUSOFF BIT(0)
1956 ++#define IFI_CANFD_IRQMASK_ERROR_WARNING BIT(1)
1957 ++#define IFI_CANFD_IRQMASK_ERROR_STATE_CHG BIT(2)
1958 ++#define IFI_CANFD_IRQMASK_ERROR_REC_TEC_INC BIT(3)
1959 + #define IFI_CANFD_IRQMASK_SET_ERR BIT(7)
1960 + #define IFI_CANFD_IRQMASK_SET_TS BIT(15)
1961 + #define IFI_CANFD_IRQMASK_TXFIFO_EMPTY BIT(16)
1962 +@@ -136,6 +144,8 @@
1963 + #define IFI_CANFD_SYSCLOCK 0x50
1964 +
1965 + #define IFI_CANFD_VER 0x54
1966 ++#define IFI_CANFD_VER_REV_MASK 0xff
1967 ++#define IFI_CANFD_VER_REV_MIN_SUPPORTED 0x15
1968 +
1969 + #define IFI_CANFD_IP_ID 0x58
1970 + #define IFI_CANFD_IP_ID_VALUE 0xD073CAFD
1971 +@@ -220,7 +230,10 @@ static void ifi_canfd_irq_enable(struct net_device *ndev, bool enable)
1972 +
1973 + if (enable) {
1974 + enirq = IFI_CANFD_IRQMASK_TXFIFO_EMPTY |
1975 +- IFI_CANFD_IRQMASK_RXFIFO_NEMPTY;
1976 ++ IFI_CANFD_IRQMASK_RXFIFO_NEMPTY |
1977 ++ IFI_CANFD_IRQMASK_ERROR_STATE_CHG |
1978 ++ IFI_CANFD_IRQMASK_ERROR_WARNING |
1979 ++ IFI_CANFD_IRQMASK_ERROR_BUSOFF;
1980 + if (priv->can.ctrlmode & CAN_CTRLMODE_BERR_REPORTING)
1981 + enirq |= IFI_CANFD_INTERRUPT_ERROR_COUNTER;
1982 + }
1983 +@@ -361,12 +374,13 @@ static int ifi_canfd_handle_lost_msg(struct net_device *ndev)
1984 + return 1;
1985 + }
1986 +
1987 +-static int ifi_canfd_handle_lec_err(struct net_device *ndev, const u32 errctr)
1988 ++static int ifi_canfd_handle_lec_err(struct net_device *ndev)
1989 + {
1990 + struct ifi_canfd_priv *priv = netdev_priv(ndev);
1991 + struct net_device_stats *stats = &ndev->stats;
1992 + struct can_frame *cf;
1993 + struct sk_buff *skb;
1994 ++ u32 errctr = readl(priv->base + IFI_CANFD_ERROR_CTR);
1995 + const u32 errmask = IFI_CANFD_ERROR_CTR_OVERLOAD_FIRST |
1996 + IFI_CANFD_ERROR_CTR_ACK_ERROR_FIRST |
1997 + IFI_CANFD_ERROR_CTR_BIT0_ERROR_FIRST |
1998 +@@ -449,6 +463,11 @@ static int ifi_canfd_handle_state_change(struct net_device *ndev,
1999 +
2000 + switch (new_state) {
2001 + case CAN_STATE_ERROR_ACTIVE:
2002 ++ /* error active state */
2003 ++ priv->can.can_stats.error_warning++;
2004 ++ priv->can.state = CAN_STATE_ERROR_ACTIVE;
2005 ++ break;
2006 ++ case CAN_STATE_ERROR_WARNING:
2007 + /* error warning state */
2008 + priv->can.can_stats.error_warning++;
2009 + priv->can.state = CAN_STATE_ERROR_WARNING;
2010 +@@ -477,7 +496,7 @@ static int ifi_canfd_handle_state_change(struct net_device *ndev,
2011 + ifi_canfd_get_berr_counter(ndev, &bec);
2012 +
2013 + switch (new_state) {
2014 +- case CAN_STATE_ERROR_ACTIVE:
2015 ++ case CAN_STATE_ERROR_WARNING:
2016 + /* error warning state */
2017 + cf->can_id |= CAN_ERR_CRTL;
2018 + cf->data[1] = (bec.txerr > bec.rxerr) ?
2019 +@@ -510,22 +529,21 @@ static int ifi_canfd_handle_state_change(struct net_device *ndev,
2020 + return 1;
2021 + }
2022 +
2023 +-static int ifi_canfd_handle_state_errors(struct net_device *ndev, u32 stcmd)
2024 ++static int ifi_canfd_handle_state_errors(struct net_device *ndev)
2025 + {
2026 + struct ifi_canfd_priv *priv = netdev_priv(ndev);
2027 ++ u32 stcmd = readl(priv->base + IFI_CANFD_STCMD);
2028 + int work_done = 0;
2029 +- u32 isr;
2030 +
2031 +- /*
2032 +- * The ErrWarn condition is a little special, since the bit is
2033 +- * located in the INTERRUPT register instead of STCMD register.
2034 +- */
2035 +- isr = readl(priv->base + IFI_CANFD_INTERRUPT);
2036 +- if ((isr & IFI_CANFD_INTERRUPT_ERROR_WARNING) &&
2037 ++ if ((stcmd & IFI_CANFD_STCMD_ERROR_ACTIVE) &&
2038 ++ (priv->can.state != CAN_STATE_ERROR_ACTIVE)) {
2039 ++ netdev_dbg(ndev, "Error, entered active state\n");
2040 ++ work_done += ifi_canfd_handle_state_change(ndev,
2041 ++ CAN_STATE_ERROR_ACTIVE);
2042 ++ }
2043 ++
2044 ++ if ((stcmd & IFI_CANFD_STCMD_ERROR_WARNING) &&
2045 + (priv->can.state != CAN_STATE_ERROR_WARNING)) {
2046 +- /* Clear the interrupt */
2047 +- writel(IFI_CANFD_INTERRUPT_ERROR_WARNING,
2048 +- priv->base + IFI_CANFD_INTERRUPT);
2049 + netdev_dbg(ndev, "Error, entered warning state\n");
2050 + work_done += ifi_canfd_handle_state_change(ndev,
2051 + CAN_STATE_ERROR_WARNING);
2052 +@@ -552,18 +570,11 @@ static int ifi_canfd_poll(struct napi_struct *napi, int quota)
2053 + {
2054 + struct net_device *ndev = napi->dev;
2055 + struct ifi_canfd_priv *priv = netdev_priv(ndev);
2056 +- const u32 stcmd_state_mask = IFI_CANFD_STCMD_ERROR_PASSIVE |
2057 +- IFI_CANFD_STCMD_BUSOFF;
2058 +- int work_done = 0;
2059 +-
2060 +- u32 stcmd = readl(priv->base + IFI_CANFD_STCMD);
2061 + u32 rxstcmd = readl(priv->base + IFI_CANFD_RXSTCMD);
2062 +- u32 errctr = readl(priv->base + IFI_CANFD_ERROR_CTR);
2063 ++ int work_done = 0;
2064 +
2065 + /* Handle bus state changes */
2066 +- if ((stcmd & stcmd_state_mask) ||
2067 +- ((stcmd & IFI_CANFD_STCMD_ERROR_ACTIVE) == 0))
2068 +- work_done += ifi_canfd_handle_state_errors(ndev, stcmd);
2069 ++ work_done += ifi_canfd_handle_state_errors(ndev);
2070 +
2071 + /* Handle lost messages on RX */
2072 + if (rxstcmd & IFI_CANFD_RXSTCMD_OVERFLOW)
2073 +@@ -571,7 +582,7 @@ static int ifi_canfd_poll(struct napi_struct *napi, int quota)
2074 +
2075 + /* Handle lec errors on the bus */
2076 + if (priv->can.ctrlmode & CAN_CTRLMODE_BERR_REPORTING)
2077 +- work_done += ifi_canfd_handle_lec_err(ndev, errctr);
2078 ++ work_done += ifi_canfd_handle_lec_err(ndev);
2079 +
2080 + /* Handle normal messages on RX */
2081 + if (!(rxstcmd & IFI_CANFD_RXSTCMD_EMPTY))
2082 +@@ -592,12 +603,13 @@ static irqreturn_t ifi_canfd_isr(int irq, void *dev_id)
2083 + struct net_device_stats *stats = &ndev->stats;
2084 + const u32 rx_irq_mask = IFI_CANFD_INTERRUPT_RXFIFO_NEMPTY |
2085 + IFI_CANFD_INTERRUPT_RXFIFO_NEMPTY_PER |
2086 ++ IFI_CANFD_INTERRUPT_ERROR_COUNTER |
2087 ++ IFI_CANFD_INTERRUPT_ERROR_STATE_CHG |
2088 + IFI_CANFD_INTERRUPT_ERROR_WARNING |
2089 +- IFI_CANFD_INTERRUPT_ERROR_COUNTER;
2090 ++ IFI_CANFD_INTERRUPT_ERROR_BUSOFF;
2091 + const u32 tx_irq_mask = IFI_CANFD_INTERRUPT_TXFIFO_EMPTY |
2092 + IFI_CANFD_INTERRUPT_TXFIFO_REMOVE;
2093 +- const u32 clr_irq_mask = ~((u32)(IFI_CANFD_INTERRUPT_SET_IRQ |
2094 +- IFI_CANFD_INTERRUPT_ERROR_WARNING));
2095 ++ const u32 clr_irq_mask = ~((u32)IFI_CANFD_INTERRUPT_SET_IRQ);
2096 + u32 isr;
2097 +
2098 + isr = readl(priv->base + IFI_CANFD_INTERRUPT);
2099 +@@ -933,7 +945,7 @@ static int ifi_canfd_plat_probe(struct platform_device *pdev)
2100 + struct resource *res;
2101 + void __iomem *addr;
2102 + int irq, ret;
2103 +- u32 id;
2104 ++ u32 id, rev;
2105 +
2106 + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
2107 + addr = devm_ioremap_resource(dev, res);
2108 +@@ -947,6 +959,13 @@ static int ifi_canfd_plat_probe(struct platform_device *pdev)
2109 + return -EINVAL;
2110 + }
2111 +
2112 ++ rev = readl(addr + IFI_CANFD_VER) & IFI_CANFD_VER_REV_MASK;
2113 ++ if (rev < IFI_CANFD_VER_REV_MIN_SUPPORTED) {
2114 ++ dev_err(dev, "This block is too old (rev %i), minimum supported is rev %i\n",
2115 ++ rev, IFI_CANFD_VER_REV_MIN_SUPPORTED);
2116 ++ return -EINVAL;
2117 ++ }
2118 ++
2119 + ndev = alloc_candev(sizeof(*priv), 1);
2120 + if (!ndev)
2121 + return -ENOMEM;
2122 +diff --git a/drivers/net/can/peak_canfd/peak_canfd.c b/drivers/net/can/peak_canfd/peak_canfd.c
2123 +index 55513411a82e..ed8561d4a90f 100644
2124 +--- a/drivers/net/can/peak_canfd/peak_canfd.c
2125 ++++ b/drivers/net/can/peak_canfd/peak_canfd.c
2126 +@@ -262,7 +262,6 @@ static int pucan_handle_can_rx(struct peak_canfd_priv *priv,
2127 +
2128 + spin_lock_irqsave(&priv->echo_lock, flags);
2129 + can_get_echo_skb(priv->ndev, msg->client);
2130 +- spin_unlock_irqrestore(&priv->echo_lock, flags);
2131 +
2132 + /* count bytes of the echo instead of skb */
2133 + stats->tx_bytes += cf_len;
2134 +@@ -271,6 +270,7 @@ static int pucan_handle_can_rx(struct peak_canfd_priv *priv,
2135 + /* restart tx queue (a slot is free) */
2136 + netif_wake_queue(priv->ndev);
2137 +
2138 ++ spin_unlock_irqrestore(&priv->echo_lock, flags);
2139 + return 0;
2140 + }
2141 +
2142 +@@ -333,7 +333,6 @@ static int pucan_handle_status(struct peak_canfd_priv *priv,
2143 +
2144 + /* this STATUS is the CNF of the RX_BARRIER: Tx path can be setup */
2145 + if (pucan_status_is_rx_barrier(msg)) {
2146 +- unsigned long flags;
2147 +
2148 + if (priv->enable_tx_path) {
2149 + int err = priv->enable_tx_path(priv);
2150 +@@ -342,16 +341,8 @@ static int pucan_handle_status(struct peak_canfd_priv *priv,
2151 + return err;
2152 + }
2153 +
2154 +- /* restart network queue only if echo skb array is free */
2155 +- spin_lock_irqsave(&priv->echo_lock, flags);
2156 +-
2157 +- if (!priv->can.echo_skb[priv->echo_idx]) {
2158 +- spin_unlock_irqrestore(&priv->echo_lock, flags);
2159 +-
2160 +- netif_wake_queue(ndev);
2161 +- } else {
2162 +- spin_unlock_irqrestore(&priv->echo_lock, flags);
2163 +- }
2164 ++ /* start network queue (echo_skb array is empty) */
2165 ++ netif_start_queue(ndev);
2166 +
2167 + return 0;
2168 + }
2169 +@@ -726,11 +717,6 @@ static netdev_tx_t peak_canfd_start_xmit(struct sk_buff *skb,
2170 + */
2171 + should_stop_tx_queue = !!(priv->can.echo_skb[priv->echo_idx]);
2172 +
2173 +- spin_unlock_irqrestore(&priv->echo_lock, flags);
2174 +-
2175 +- /* write the skb on the interface */
2176 +- priv->write_tx_msg(priv, msg);
2177 +-
2178 + /* stop network tx queue if not enough room to save one more msg too */
2179 + if (priv->can.ctrlmode & CAN_CTRLMODE_FD)
2180 + should_stop_tx_queue |= (room_left <
2181 +@@ -742,6 +728,11 @@ static netdev_tx_t peak_canfd_start_xmit(struct sk_buff *skb,
2182 + if (should_stop_tx_queue)
2183 + netif_stop_queue(ndev);
2184 +
2185 ++ spin_unlock_irqrestore(&priv->echo_lock, flags);
2186 ++
2187 ++ /* write the skb on the interface */
2188 ++ priv->write_tx_msg(priv, msg);
2189 ++
2190 + return NETDEV_TX_OK;
2191 + }
2192 +
2193 +diff --git a/drivers/net/can/peak_canfd/peak_pciefd_main.c b/drivers/net/can/peak_canfd/peak_pciefd_main.c
2194 +index 788c3464a3b0..3c51a884db87 100644
2195 +--- a/drivers/net/can/peak_canfd/peak_pciefd_main.c
2196 ++++ b/drivers/net/can/peak_canfd/peak_pciefd_main.c
2197 +@@ -349,8 +349,12 @@ static irqreturn_t pciefd_irq_handler(int irq, void *arg)
2198 + priv->tx_pages_free++;
2199 + spin_unlock_irqrestore(&priv->tx_lock, flags);
2200 +
2201 +- /* wake producer up */
2202 +- netif_wake_queue(priv->ucan.ndev);
2203 ++ /* wake producer up (only if enough room in echo_skb array) */
2204 ++ spin_lock_irqsave(&priv->ucan.echo_lock, flags);
2205 ++ if (!priv->ucan.can.echo_skb[priv->ucan.echo_idx])
2206 ++ netif_wake_queue(priv->ucan.ndev);
2207 ++
2208 ++ spin_unlock_irqrestore(&priv->ucan.echo_lock, flags);
2209 + }
2210 +
2211 + /* re-enable Rx DMA transfer for this CAN */
2212 +diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
2213 +index 2ee54133efa1..82064e909784 100644
2214 +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
2215 ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
2216 +@@ -462,25 +462,23 @@ static int brcmf_p2p_set_firmware(struct brcmf_if *ifp, u8 *p2p_mac)
2217 + * @dev_addr: optional device address.
2218 + *
2219 + * P2P needs mac addresses for P2P device and interface. If no device
2220 +- * address it specified, these are derived from the primary net device, ie.
2221 +- * the permanent ethernet address of the device.
2222 ++ * address it specified, these are derived from a random ethernet
2223 ++ * address.
2224 + */
2225 + static void brcmf_p2p_generate_bss_mac(struct brcmf_p2p_info *p2p, u8 *dev_addr)
2226 + {
2227 +- struct brcmf_if *pri_ifp = p2p->bss_idx[P2PAPI_BSSCFG_PRIMARY].vif->ifp;
2228 +- bool local_admin = false;
2229 ++ bool random_addr = false;
2230 +
2231 +- if (!dev_addr || is_zero_ether_addr(dev_addr)) {
2232 +- dev_addr = pri_ifp->mac_addr;
2233 +- local_admin = true;
2234 +- }
2235 ++ if (!dev_addr || is_zero_ether_addr(dev_addr))
2236 ++ random_addr = true;
2237 +
2238 +- /* Generate the P2P Device Address. This consists of the device's
2239 +- * primary MAC address with the locally administered bit set.
2240 ++ /* Generate the P2P Device Address obtaining a random ethernet
2241 ++ * address with the locally administered bit set.
2242 + */
2243 +- memcpy(p2p->dev_addr, dev_addr, ETH_ALEN);
2244 +- if (local_admin)
2245 +- p2p->dev_addr[0] |= 0x02;
2246 ++ if (random_addr)
2247 ++ eth_random_addr(p2p->dev_addr);
2248 ++ else
2249 ++ memcpy(p2p->dev_addr, dev_addr, ETH_ALEN);
2250 +
2251 + /* Generate the P2P Interface Address. If the discovery and connection
2252 + * BSSCFGs need to simultaneously co-exist, then this address must be
2253 +diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/hw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/hw.c
2254 +index 7cd1ffa7d4a7..7df0a02f9b34 100644
2255 +--- a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/hw.c
2256 ++++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/hw.c
2257 +@@ -1124,7 +1124,8 @@ static void _rtl8723be_enable_aspm_back_door(struct ieee80211_hw *hw)
2258 +
2259 + /* Configuration Space offset 0x70f BIT7 is used to control L0S */
2260 + tmp8 = _rtl8723be_dbi_read(rtlpriv, 0x70f);
2261 +- _rtl8723be_dbi_write(rtlpriv, 0x70f, tmp8 | BIT(7));
2262 ++ _rtl8723be_dbi_write(rtlpriv, 0x70f, tmp8 | BIT(7) |
2263 ++ ASPM_L1_LATENCY << 3);
2264 +
2265 + /* Configuration Space offset 0x719 Bit3 is for L1
2266 + * BIT4 is for clock request
2267 +diff --git a/drivers/nvdimm/blk.c b/drivers/nvdimm/blk.c
2268 +index 345acca576b3..1bd7b3734751 100644
2269 +--- a/drivers/nvdimm/blk.c
2270 ++++ b/drivers/nvdimm/blk.c
2271 +@@ -278,8 +278,6 @@ static int nsblk_attach_disk(struct nd_namespace_blk *nsblk)
2272 + disk->queue = q;
2273 + disk->flags = GENHD_FL_EXT_DEVT;
2274 + nvdimm_namespace_disk_name(&nsblk->common, disk->disk_name);
2275 +- set_capacity(disk, 0);
2276 +- device_add_disk(dev, disk);
2277 +
2278 + if (devm_add_action_or_reset(dev, nd_blk_release_disk, disk))
2279 + return -ENOMEM;
2280 +@@ -292,6 +290,7 @@ static int nsblk_attach_disk(struct nd_namespace_blk *nsblk)
2281 + }
2282 +
2283 + set_capacity(disk, available_disk_size >> SECTOR_SHIFT);
2284 ++ device_add_disk(dev, disk);
2285 + revalidate_disk(disk);
2286 + return 0;
2287 + }
2288 +diff --git a/drivers/nvdimm/btt.c b/drivers/nvdimm/btt.c
2289 +index c586bcdb5190..c625df951fa1 100644
2290 +--- a/drivers/nvdimm/btt.c
2291 ++++ b/drivers/nvdimm/btt.c
2292 +@@ -1545,8 +1545,6 @@ static int btt_blk_init(struct btt *btt)
2293 + queue_flag_set_unlocked(QUEUE_FLAG_NONROT, btt->btt_queue);
2294 + btt->btt_queue->queuedata = btt;
2295 +
2296 +- set_capacity(btt->btt_disk, 0);
2297 +- device_add_disk(&btt->nd_btt->dev, btt->btt_disk);
2298 + if (btt_meta_size(btt)) {
2299 + int rc = nd_integrity_init(btt->btt_disk, btt_meta_size(btt));
2300 +
2301 +@@ -1558,6 +1556,7 @@ static int btt_blk_init(struct btt *btt)
2302 + }
2303 + }
2304 + set_capacity(btt->btt_disk, btt->nlba * btt->sector_size >> 9);
2305 ++ device_add_disk(&btt->nd_btt->dev, btt->btt_disk);
2306 + btt->nd_btt->size = btt->nlba * (u64)btt->sector_size;
2307 + revalidate_disk(btt->btt_disk);
2308 +
2309 +diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
2310 +index d7135140bf40..a2f18c4a0346 100644
2311 +--- a/drivers/pci/quirks.c
2312 ++++ b/drivers/pci/quirks.c
2313 +@@ -3906,6 +3906,8 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL_EXT, 0x9230,
2314 + quirk_dma_func1_alias);
2315 + DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_TTI, 0x0642,
2316 + quirk_dma_func1_alias);
2317 ++DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_TTI, 0x0645,
2318 ++ quirk_dma_func1_alias);
2319 + /* https://bugs.gentoo.org/show_bug.cgi?id=497630 */
2320 + DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_JMICRON,
2321 + PCI_DEVICE_ID_JMICRON_JMB388_ESD,
2322 +diff --git a/drivers/pinctrl/samsung/pinctrl-exynos-arm.c b/drivers/pinctrl/samsung/pinctrl-exynos-arm.c
2323 +index 071084d3ee9c..92aeea174a56 100644
2324 +--- a/drivers/pinctrl/samsung/pinctrl-exynos-arm.c
2325 ++++ b/drivers/pinctrl/samsung/pinctrl-exynos-arm.c
2326 +@@ -129,7 +129,7 @@ static const struct samsung_pin_bank_data s5pv210_pin_bank[] __initconst = {
2327 + EXYNOS_PIN_BANK_EINTW(8, 0xc60, "gph3", 0x0c),
2328 + };
2329 +
2330 +-const struct samsung_pin_ctrl s5pv210_pin_ctrl[] __initconst = {
2331 ++static const struct samsung_pin_ctrl s5pv210_pin_ctrl[] __initconst = {
2332 + {
2333 + /* pin-controller instance 0 data */
2334 + .pin_banks = s5pv210_pin_bank,
2335 +@@ -142,6 +142,11 @@ const struct samsung_pin_ctrl s5pv210_pin_ctrl[] __initconst = {
2336 + },
2337 + };
2338 +
2339 ++const struct samsung_pinctrl_of_match_data s5pv210_of_data __initconst = {
2340 ++ .ctrl = s5pv210_pin_ctrl,
2341 ++ .num_ctrl = ARRAY_SIZE(s5pv210_pin_ctrl),
2342 ++};
2343 ++
2344 + /* Pad retention control code for accessing PMU regmap */
2345 + static atomic_t exynos_shared_retention_refcnt;
2346 +
2347 +@@ -204,7 +209,7 @@ static const struct samsung_retention_data exynos3250_retention_data __initconst
2348 + * Samsung pinctrl driver data for Exynos3250 SoC. Exynos3250 SoC includes
2349 + * two gpio/pin-mux/pinconfig controllers.
2350 + */
2351 +-const struct samsung_pin_ctrl exynos3250_pin_ctrl[] __initconst = {
2352 ++static const struct samsung_pin_ctrl exynos3250_pin_ctrl[] __initconst = {
2353 + {
2354 + /* pin-controller instance 0 data */
2355 + .pin_banks = exynos3250_pin_banks0,
2356 +@@ -225,6 +230,11 @@ const struct samsung_pin_ctrl exynos3250_pin_ctrl[] __initconst = {
2357 + },
2358 + };
2359 +
2360 ++const struct samsung_pinctrl_of_match_data exynos3250_of_data __initconst = {
2361 ++ .ctrl = exynos3250_pin_ctrl,
2362 ++ .num_ctrl = ARRAY_SIZE(exynos3250_pin_ctrl),
2363 ++};
2364 ++
2365 + /* pin banks of exynos4210 pin-controller 0 */
2366 + static const struct samsung_pin_bank_data exynos4210_pin_banks0[] __initconst = {
2367 + EXYNOS_PIN_BANK_EINTG(8, 0x000, "gpa0", 0x00),
2368 +@@ -308,7 +318,7 @@ static const struct samsung_retention_data exynos4_audio_retention_data __initco
2369 + * Samsung pinctrl driver data for Exynos4210 SoC. Exynos4210 SoC includes
2370 + * three gpio/pin-mux/pinconfig controllers.
2371 + */
2372 +-const struct samsung_pin_ctrl exynos4210_pin_ctrl[] __initconst = {
2373 ++static const struct samsung_pin_ctrl exynos4210_pin_ctrl[] __initconst = {
2374 + {
2375 + /* pin-controller instance 0 data */
2376 + .pin_banks = exynos4210_pin_banks0,
2377 +@@ -334,6 +344,11 @@ const struct samsung_pin_ctrl exynos4210_pin_ctrl[] __initconst = {
2378 + },
2379 + };
2380 +
2381 ++const struct samsung_pinctrl_of_match_data exynos4210_of_data __initconst = {
2382 ++ .ctrl = exynos4210_pin_ctrl,
2383 ++ .num_ctrl = ARRAY_SIZE(exynos4210_pin_ctrl),
2384 ++};
2385 ++
2386 + /* pin banks of exynos4x12 pin-controller 0 */
2387 + static const struct samsung_pin_bank_data exynos4x12_pin_banks0[] __initconst = {
2388 + EXYNOS_PIN_BANK_EINTG(8, 0x000, "gpa0", 0x00),
2389 +@@ -396,7 +411,7 @@ static const struct samsung_pin_bank_data exynos4x12_pin_banks3[] __initconst =
2390 + * Samsung pinctrl driver data for Exynos4x12 SoC. Exynos4x12 SoC includes
2391 + * four gpio/pin-mux/pinconfig controllers.
2392 + */
2393 +-const struct samsung_pin_ctrl exynos4x12_pin_ctrl[] __initconst = {
2394 ++static const struct samsung_pin_ctrl exynos4x12_pin_ctrl[] __initconst = {
2395 + {
2396 + /* pin-controller instance 0 data */
2397 + .pin_banks = exynos4x12_pin_banks0,
2398 +@@ -432,6 +447,11 @@ const struct samsung_pin_ctrl exynos4x12_pin_ctrl[] __initconst = {
2399 + },
2400 + };
2401 +
2402 ++const struct samsung_pinctrl_of_match_data exynos4x12_of_data __initconst = {
2403 ++ .ctrl = exynos4x12_pin_ctrl,
2404 ++ .num_ctrl = ARRAY_SIZE(exynos4x12_pin_ctrl),
2405 ++};
2406 ++
2407 + /* pin banks of exynos5250 pin-controller 0 */
2408 + static const struct samsung_pin_bank_data exynos5250_pin_banks0[] __initconst = {
2409 + EXYNOS_PIN_BANK_EINTG(8, 0x000, "gpa0", 0x00),
2410 +@@ -492,7 +512,7 @@ static const struct samsung_pin_bank_data exynos5250_pin_banks3[] __initconst =
2411 + * Samsung pinctrl driver data for Exynos5250 SoC. Exynos5250 SoC includes
2412 + * four gpio/pin-mux/pinconfig controllers.
2413 + */
2414 +-const struct samsung_pin_ctrl exynos5250_pin_ctrl[] __initconst = {
2415 ++static const struct samsung_pin_ctrl exynos5250_pin_ctrl[] __initconst = {
2416 + {
2417 + /* pin-controller instance 0 data */
2418 + .pin_banks = exynos5250_pin_banks0,
2419 +@@ -528,6 +548,11 @@ const struct samsung_pin_ctrl exynos5250_pin_ctrl[] __initconst = {
2420 + },
2421 + };
2422 +
2423 ++const struct samsung_pinctrl_of_match_data exynos5250_of_data __initconst = {
2424 ++ .ctrl = exynos5250_pin_ctrl,
2425 ++ .num_ctrl = ARRAY_SIZE(exynos5250_pin_ctrl),
2426 ++};
2427 ++
2428 + /* pin banks of exynos5260 pin-controller 0 */
2429 + static const struct samsung_pin_bank_data exynos5260_pin_banks0[] __initconst = {
2430 + EXYNOS_PIN_BANK_EINTG(4, 0x000, "gpa0", 0x00),
2431 +@@ -572,7 +597,7 @@ static const struct samsung_pin_bank_data exynos5260_pin_banks2[] __initconst =
2432 + * Samsung pinctrl driver data for Exynos5260 SoC. Exynos5260 SoC includes
2433 + * three gpio/pin-mux/pinconfig controllers.
2434 + */
2435 +-const struct samsung_pin_ctrl exynos5260_pin_ctrl[] __initconst = {
2436 ++static const struct samsung_pin_ctrl exynos5260_pin_ctrl[] __initconst = {
2437 + {
2438 + /* pin-controller instance 0 data */
2439 + .pin_banks = exynos5260_pin_banks0,
2440 +@@ -592,6 +617,11 @@ const struct samsung_pin_ctrl exynos5260_pin_ctrl[] __initconst = {
2441 + },
2442 + };
2443 +
2444 ++const struct samsung_pinctrl_of_match_data exynos5260_of_data __initconst = {
2445 ++ .ctrl = exynos5260_pin_ctrl,
2446 ++ .num_ctrl = ARRAY_SIZE(exynos5260_pin_ctrl),
2447 ++};
2448 ++
2449 + /* pin banks of exynos5410 pin-controller 0 */
2450 + static const struct samsung_pin_bank_data exynos5410_pin_banks0[] __initconst = {
2451 + EXYNOS_PIN_BANK_EINTG(8, 0x000, "gpa0", 0x00),
2452 +@@ -662,7 +692,7 @@ static const struct samsung_pin_bank_data exynos5410_pin_banks3[] __initconst =
2453 + * Samsung pinctrl driver data for Exynos5410 SoC. Exynos5410 SoC includes
2454 + * four gpio/pin-mux/pinconfig controllers.
2455 + */
2456 +-const struct samsung_pin_ctrl exynos5410_pin_ctrl[] __initconst = {
2457 ++static const struct samsung_pin_ctrl exynos5410_pin_ctrl[] __initconst = {
2458 + {
2459 + /* pin-controller instance 0 data */
2460 + .pin_banks = exynos5410_pin_banks0,
2461 +@@ -695,6 +725,11 @@ const struct samsung_pin_ctrl exynos5410_pin_ctrl[] __initconst = {
2462 + },
2463 + };
2464 +
2465 ++const struct samsung_pinctrl_of_match_data exynos5410_of_data __initconst = {
2466 ++ .ctrl = exynos5410_pin_ctrl,
2467 ++ .num_ctrl = ARRAY_SIZE(exynos5410_pin_ctrl),
2468 ++};
2469 ++
2470 + /* pin banks of exynos5420 pin-controller 0 */
2471 + static const struct samsung_pin_bank_data exynos5420_pin_banks0[] __initconst = {
2472 + EXYNOS_PIN_BANK_EINTG(8, 0x000, "gpy7", 0x00),
2473 +@@ -779,7 +814,7 @@ static const struct samsung_retention_data exynos5420_retention_data __initconst
2474 + * Samsung pinctrl driver data for Exynos5420 SoC. Exynos5420 SoC includes
2475 + * four gpio/pin-mux/pinconfig controllers.
2476 + */
2477 +-const struct samsung_pin_ctrl exynos5420_pin_ctrl[] __initconst = {
2478 ++static const struct samsung_pin_ctrl exynos5420_pin_ctrl[] __initconst = {
2479 + {
2480 + /* pin-controller instance 0 data */
2481 + .pin_banks = exynos5420_pin_banks0,
2482 +@@ -813,3 +848,8 @@ const struct samsung_pin_ctrl exynos5420_pin_ctrl[] __initconst = {
2483 + .retention_data = &exynos4_audio_retention_data,
2484 + },
2485 + };
2486 ++
2487 ++const struct samsung_pinctrl_of_match_data exynos5420_of_data __initconst = {
2488 ++ .ctrl = exynos5420_pin_ctrl,
2489 ++ .num_ctrl = ARRAY_SIZE(exynos5420_pin_ctrl),
2490 ++};
2491 +diff --git a/drivers/pinctrl/samsung/pinctrl-exynos-arm64.c b/drivers/pinctrl/samsung/pinctrl-exynos-arm64.c
2492 +index 08e9fdb58fd2..0ab88fc268ea 100644
2493 +--- a/drivers/pinctrl/samsung/pinctrl-exynos-arm64.c
2494 ++++ b/drivers/pinctrl/samsung/pinctrl-exynos-arm64.c
2495 +@@ -180,7 +180,7 @@ static const struct samsung_retention_data exynos5433_fsys_retention_data __init
2496 + * Samsung pinctrl driver data for Exynos5433 SoC. Exynos5433 SoC includes
2497 + * ten gpio/pin-mux/pinconfig controllers.
2498 + */
2499 +-const struct samsung_pin_ctrl exynos5433_pin_ctrl[] __initconst = {
2500 ++static const struct samsung_pin_ctrl exynos5433_pin_ctrl[] __initconst = {
2501 + {
2502 + /* pin-controller instance 0 data */
2503 + .pin_banks = exynos5433_pin_banks0,
2504 +@@ -265,6 +265,11 @@ const struct samsung_pin_ctrl exynos5433_pin_ctrl[] __initconst = {
2505 + },
2506 + };
2507 +
2508 ++const struct samsung_pinctrl_of_match_data exynos5433_of_data __initconst = {
2509 ++ .ctrl = exynos5433_pin_ctrl,
2510 ++ .num_ctrl = ARRAY_SIZE(exynos5433_pin_ctrl),
2511 ++};
2512 ++
2513 + /* pin banks of exynos7 pin-controller - ALIVE */
2514 + static const struct samsung_pin_bank_data exynos7_pin_banks0[] __initconst = {
2515 + EXYNOS_PIN_BANK_EINTW(8, 0x000, "gpa0", 0x00),
2516 +@@ -344,7 +349,7 @@ static const struct samsung_pin_bank_data exynos7_pin_banks9[] __initconst = {
2517 + EXYNOS_PIN_BANK_EINTG(4, 0x020, "gpz1", 0x04),
2518 + };
2519 +
2520 +-const struct samsung_pin_ctrl exynos7_pin_ctrl[] __initconst = {
2521 ++static const struct samsung_pin_ctrl exynos7_pin_ctrl[] __initconst = {
2522 + {
2523 + /* pin-controller instance 0 Alive data */
2524 + .pin_banks = exynos7_pin_banks0,
2525 +@@ -397,3 +402,8 @@ const struct samsung_pin_ctrl exynos7_pin_ctrl[] __initconst = {
2526 + .eint_gpio_init = exynos_eint_gpio_init,
2527 + },
2528 + };
2529 ++
2530 ++const struct samsung_pinctrl_of_match_data exynos7_of_data __initconst = {
2531 ++ .ctrl = exynos7_pin_ctrl,
2532 ++ .num_ctrl = ARRAY_SIZE(exynos7_pin_ctrl),
2533 ++};
2534 +diff --git a/drivers/pinctrl/samsung/pinctrl-s3c24xx.c b/drivers/pinctrl/samsung/pinctrl-s3c24xx.c
2535 +index edf27264b603..67da1cf18b68 100644
2536 +--- a/drivers/pinctrl/samsung/pinctrl-s3c24xx.c
2537 ++++ b/drivers/pinctrl/samsung/pinctrl-s3c24xx.c
2538 +@@ -570,7 +570,7 @@ static const struct samsung_pin_bank_data s3c2412_pin_banks[] __initconst = {
2539 + PIN_BANK_2BIT(13, 0x080, "gpj"),
2540 + };
2541 +
2542 +-const struct samsung_pin_ctrl s3c2412_pin_ctrl[] __initconst = {
2543 ++static const struct samsung_pin_ctrl s3c2412_pin_ctrl[] __initconst = {
2544 + {
2545 + .pin_banks = s3c2412_pin_banks,
2546 + .nr_banks = ARRAY_SIZE(s3c2412_pin_banks),
2547 +@@ -578,6 +578,11 @@ const struct samsung_pin_ctrl s3c2412_pin_ctrl[] __initconst = {
2548 + },
2549 + };
2550 +
2551 ++const struct samsung_pinctrl_of_match_data s3c2412_of_data __initconst = {
2552 ++ .ctrl = s3c2412_pin_ctrl,
2553 ++ .num_ctrl = ARRAY_SIZE(s3c2412_pin_ctrl),
2554 ++};
2555 ++
2556 + static const struct samsung_pin_bank_data s3c2416_pin_banks[] __initconst = {
2557 + PIN_BANK_A(27, 0x000, "gpa"),
2558 + PIN_BANK_2BIT(11, 0x010, "gpb"),
2559 +@@ -592,7 +597,7 @@ static const struct samsung_pin_bank_data s3c2416_pin_banks[] __initconst = {
2560 + PIN_BANK_2BIT(2, 0x100, "gpm"),
2561 + };
2562 +
2563 +-const struct samsung_pin_ctrl s3c2416_pin_ctrl[] __initconst = {
2564 ++static const struct samsung_pin_ctrl s3c2416_pin_ctrl[] __initconst = {
2565 + {
2566 + .pin_banks = s3c2416_pin_banks,
2567 + .nr_banks = ARRAY_SIZE(s3c2416_pin_banks),
2568 +@@ -600,6 +605,11 @@ const struct samsung_pin_ctrl s3c2416_pin_ctrl[] __initconst = {
2569 + },
2570 + };
2571 +
2572 ++const struct samsung_pinctrl_of_match_data s3c2416_of_data __initconst = {
2573 ++ .ctrl = s3c2416_pin_ctrl,
2574 ++ .num_ctrl = ARRAY_SIZE(s3c2416_pin_ctrl),
2575 ++};
2576 ++
2577 + static const struct samsung_pin_bank_data s3c2440_pin_banks[] __initconst = {
2578 + PIN_BANK_A(25, 0x000, "gpa"),
2579 + PIN_BANK_2BIT(11, 0x010, "gpb"),
2580 +@@ -612,7 +622,7 @@ static const struct samsung_pin_bank_data s3c2440_pin_banks[] __initconst = {
2581 + PIN_BANK_2BIT(13, 0x0d0, "gpj"),
2582 + };
2583 +
2584 +-const struct samsung_pin_ctrl s3c2440_pin_ctrl[] __initconst = {
2585 ++static const struct samsung_pin_ctrl s3c2440_pin_ctrl[] __initconst = {
2586 + {
2587 + .pin_banks = s3c2440_pin_banks,
2588 + .nr_banks = ARRAY_SIZE(s3c2440_pin_banks),
2589 +@@ -620,6 +630,11 @@ const struct samsung_pin_ctrl s3c2440_pin_ctrl[] __initconst = {
2590 + },
2591 + };
2592 +
2593 ++const struct samsung_pinctrl_of_match_data s3c2440_of_data __initconst = {
2594 ++ .ctrl = s3c2440_pin_ctrl,
2595 ++ .num_ctrl = ARRAY_SIZE(s3c2440_pin_ctrl),
2596 ++};
2597 ++
2598 + static const struct samsung_pin_bank_data s3c2450_pin_banks[] __initconst = {
2599 + PIN_BANK_A(28, 0x000, "gpa"),
2600 + PIN_BANK_2BIT(11, 0x010, "gpb"),
2601 +@@ -635,10 +650,15 @@ static const struct samsung_pin_bank_data s3c2450_pin_banks[] __initconst = {
2602 + PIN_BANK_2BIT(2, 0x100, "gpm"),
2603 + };
2604 +
2605 +-const struct samsung_pin_ctrl s3c2450_pin_ctrl[] __initconst = {
2606 ++static const struct samsung_pin_ctrl s3c2450_pin_ctrl[] __initconst = {
2607 + {
2608 + .pin_banks = s3c2450_pin_banks,
2609 + .nr_banks = ARRAY_SIZE(s3c2450_pin_banks),
2610 + .eint_wkup_init = s3c24xx_eint_init,
2611 + },
2612 + };
2613 ++
2614 ++const struct samsung_pinctrl_of_match_data s3c2450_of_data __initconst = {
2615 ++ .ctrl = s3c2450_pin_ctrl,
2616 ++ .num_ctrl = ARRAY_SIZE(s3c2450_pin_ctrl),
2617 ++};
2618 +diff --git a/drivers/pinctrl/samsung/pinctrl-s3c64xx.c b/drivers/pinctrl/samsung/pinctrl-s3c64xx.c
2619 +index e63663b32907..0bdc1e683181 100644
2620 +--- a/drivers/pinctrl/samsung/pinctrl-s3c64xx.c
2621 ++++ b/drivers/pinctrl/samsung/pinctrl-s3c64xx.c
2622 +@@ -794,7 +794,7 @@ static const struct samsung_pin_bank_data s3c64xx_pin_banks0[] __initconst = {
2623 + * Samsung pinctrl driver data for S3C64xx SoC. S3C64xx SoC includes
2624 + * one gpio/pin-mux/pinconfig controller.
2625 + */
2626 +-const struct samsung_pin_ctrl s3c64xx_pin_ctrl[] __initconst = {
2627 ++static const struct samsung_pin_ctrl s3c64xx_pin_ctrl[] __initconst = {
2628 + {
2629 + /* pin-controller instance 1 data */
2630 + .pin_banks = s3c64xx_pin_banks0,
2631 +@@ -803,3 +803,8 @@ const struct samsung_pin_ctrl s3c64xx_pin_ctrl[] __initconst = {
2632 + .eint_wkup_init = s3c64xx_eint_eint0_init,
2633 + },
2634 + };
2635 ++
2636 ++const struct samsung_pinctrl_of_match_data s3c64xx_of_data __initconst = {
2637 ++ .ctrl = s3c64xx_pin_ctrl,
2638 ++ .num_ctrl = ARRAY_SIZE(s3c64xx_pin_ctrl),
2639 ++};
2640 +diff --git a/drivers/pinctrl/samsung/pinctrl-samsung.c b/drivers/pinctrl/samsung/pinctrl-samsung.c
2641 +index e04f7fe0a65d..26e8fab736f1 100644
2642 +--- a/drivers/pinctrl/samsung/pinctrl-samsung.c
2643 ++++ b/drivers/pinctrl/samsung/pinctrl-samsung.c
2644 +@@ -947,12 +947,33 @@ static int samsung_gpiolib_register(struct platform_device *pdev,
2645 + return 0;
2646 + }
2647 +
2648 ++static const struct samsung_pin_ctrl *
2649 ++samsung_pinctrl_get_soc_data_for_of_alias(struct platform_device *pdev)
2650 ++{
2651 ++ struct device_node *node = pdev->dev.of_node;
2652 ++ const struct samsung_pinctrl_of_match_data *of_data;
2653 ++ int id;
2654 ++
2655 ++ id = of_alias_get_id(node, "pinctrl");
2656 ++ if (id < 0) {
2657 ++ dev_err(&pdev->dev, "failed to get alias id\n");
2658 ++ return NULL;
2659 ++ }
2660 ++
2661 ++ of_data = of_device_get_match_data(&pdev->dev);
2662 ++ if (id >= of_data->num_ctrl) {
2663 ++ dev_err(&pdev->dev, "invalid alias id %d\n", id);
2664 ++ return NULL;
2665 ++ }
2666 ++
2667 ++ return &(of_data->ctrl[id]);
2668 ++}
2669 ++
2670 + /* retrieve the soc specific data */
2671 + static const struct samsung_pin_ctrl *
2672 + samsung_pinctrl_get_soc_data(struct samsung_pinctrl_drv_data *d,
2673 + struct platform_device *pdev)
2674 + {
2675 +- int id;
2676 + struct device_node *node = pdev->dev.of_node;
2677 + struct device_node *np;
2678 + const struct samsung_pin_bank_data *bdata;
2679 +@@ -962,13 +983,9 @@ samsung_pinctrl_get_soc_data(struct samsung_pinctrl_drv_data *d,
2680 + void __iomem *virt_base[SAMSUNG_PINCTRL_NUM_RESOURCES];
2681 + unsigned int i;
2682 +
2683 +- id = of_alias_get_id(node, "pinctrl");
2684 +- if (id < 0) {
2685 +- dev_err(&pdev->dev, "failed to get alias id\n");
2686 ++ ctrl = samsung_pinctrl_get_soc_data_for_of_alias(pdev);
2687 ++ if (!ctrl)
2688 + return ERR_PTR(-ENOENT);
2689 +- }
2690 +- ctrl = of_device_get_match_data(&pdev->dev);
2691 +- ctrl += id;
2692 +
2693 + d->suspend = ctrl->suspend;
2694 + d->resume = ctrl->resume;
2695 +@@ -1193,41 +1210,41 @@ static int __maybe_unused samsung_pinctrl_resume(struct device *dev)
2696 + static const struct of_device_id samsung_pinctrl_dt_match[] = {
2697 + #ifdef CONFIG_PINCTRL_EXYNOS_ARM
2698 + { .compatible = "samsung,exynos3250-pinctrl",
2699 +- .data = exynos3250_pin_ctrl },
2700 ++ .data = &exynos3250_of_data },
2701 + { .compatible = "samsung,exynos4210-pinctrl",
2702 +- .data = exynos4210_pin_ctrl },
2703 ++ .data = &exynos4210_of_data },
2704 + { .compatible = "samsung,exynos4x12-pinctrl",
2705 +- .data = exynos4x12_pin_ctrl },
2706 ++ .data = &exynos4x12_of_data },
2707 + { .compatible = "samsung,exynos5250-pinctrl",
2708 +- .data = exynos5250_pin_ctrl },
2709 ++ .data = &exynos5250_of_data },
2710 + { .compatible = "samsung,exynos5260-pinctrl",
2711 +- .data = exynos5260_pin_ctrl },
2712 ++ .data = &exynos5260_of_data },
2713 + { .compatible = "samsung,exynos5410-pinctrl",
2714 +- .data = exynos5410_pin_ctrl },
2715 ++ .data = &exynos5410_of_data },
2716 + { .compatible = "samsung,exynos5420-pinctrl",
2717 +- .data = exynos5420_pin_ctrl },
2718 ++ .data = &exynos5420_of_data },
2719 + { .compatible = "samsung,s5pv210-pinctrl",
2720 +- .data = s5pv210_pin_ctrl },
2721 ++ .data = &s5pv210_of_data },
2722 + #endif
2723 + #ifdef CONFIG_PINCTRL_EXYNOS_ARM64
2724 + { .compatible = "samsung,exynos5433-pinctrl",
2725 +- .data = exynos5433_pin_ctrl },
2726 ++ .data = &exynos5433_of_data },
2727 + { .compatible = "samsung,exynos7-pinctrl",
2728 +- .data = exynos7_pin_ctrl },
2729 ++ .data = &exynos7_of_data },
2730 + #endif
2731 + #ifdef CONFIG_PINCTRL_S3C64XX
2732 + { .compatible = "samsung,s3c64xx-pinctrl",
2733 +- .data = s3c64xx_pin_ctrl },
2734 ++ .data = &s3c64xx_of_data },
2735 + #endif
2736 + #ifdef CONFIG_PINCTRL_S3C24XX
2737 + { .compatible = "samsung,s3c2412-pinctrl",
2738 +- .data = s3c2412_pin_ctrl },
2739 ++ .data = &s3c2412_of_data },
2740 + { .compatible = "samsung,s3c2416-pinctrl",
2741 +- .data = s3c2416_pin_ctrl },
2742 ++ .data = &s3c2416_of_data },
2743 + { .compatible = "samsung,s3c2440-pinctrl",
2744 +- .data = s3c2440_pin_ctrl },
2745 ++ .data = &s3c2440_of_data },
2746 + { .compatible = "samsung,s3c2450-pinctrl",
2747 +- .data = s3c2450_pin_ctrl },
2748 ++ .data = &s3c2450_of_data },
2749 + #endif
2750 + {},
2751 + };
2752 +diff --git a/drivers/pinctrl/samsung/pinctrl-samsung.h b/drivers/pinctrl/samsung/pinctrl-samsung.h
2753 +index 9af07af6cad6..ae932e0c05f2 100644
2754 +--- a/drivers/pinctrl/samsung/pinctrl-samsung.h
2755 ++++ b/drivers/pinctrl/samsung/pinctrl-samsung.h
2756 +@@ -285,6 +285,16 @@ struct samsung_pinctrl_drv_data {
2757 + void (*resume)(struct samsung_pinctrl_drv_data *);
2758 + };
2759 +
2760 ++/**
2761 ++ * struct samsung_pinctrl_of_match_data: OF match device specific configuration data.
2762 ++ * @ctrl: array of pin controller data.
2763 ++ * @num_ctrl: size of array @ctrl.
2764 ++ */
2765 ++struct samsung_pinctrl_of_match_data {
2766 ++ const struct samsung_pin_ctrl *ctrl;
2767 ++ unsigned int num_ctrl;
2768 ++};
2769 ++
2770 + /**
2771 + * struct samsung_pin_group: represent group of pins of a pinmux function.
2772 + * @name: name of the pin group, used to lookup the group.
2773 +@@ -313,20 +323,20 @@ struct samsung_pmx_func {
2774 + };
2775 +
2776 + /* list of all exported SoC specific data */
2777 +-extern const struct samsung_pin_ctrl exynos3250_pin_ctrl[];
2778 +-extern const struct samsung_pin_ctrl exynos4210_pin_ctrl[];
2779 +-extern const struct samsung_pin_ctrl exynos4x12_pin_ctrl[];
2780 +-extern const struct samsung_pin_ctrl exynos5250_pin_ctrl[];
2781 +-extern const struct samsung_pin_ctrl exynos5260_pin_ctrl[];
2782 +-extern const struct samsung_pin_ctrl exynos5410_pin_ctrl[];
2783 +-extern const struct samsung_pin_ctrl exynos5420_pin_ctrl[];
2784 +-extern const struct samsung_pin_ctrl exynos5433_pin_ctrl[];
2785 +-extern const struct samsung_pin_ctrl exynos7_pin_ctrl[];
2786 +-extern const struct samsung_pin_ctrl s3c64xx_pin_ctrl[];
2787 +-extern const struct samsung_pin_ctrl s3c2412_pin_ctrl[];
2788 +-extern const struct samsung_pin_ctrl s3c2416_pin_ctrl[];
2789 +-extern const struct samsung_pin_ctrl s3c2440_pin_ctrl[];
2790 +-extern const struct samsung_pin_ctrl s3c2450_pin_ctrl[];
2791 +-extern const struct samsung_pin_ctrl s5pv210_pin_ctrl[];
2792 ++extern const struct samsung_pinctrl_of_match_data exynos3250_of_data;
2793 ++extern const struct samsung_pinctrl_of_match_data exynos4210_of_data;
2794 ++extern const struct samsung_pinctrl_of_match_data exynos4x12_of_data;
2795 ++extern const struct samsung_pinctrl_of_match_data exynos5250_of_data;
2796 ++extern const struct samsung_pinctrl_of_match_data exynos5260_of_data;
2797 ++extern const struct samsung_pinctrl_of_match_data exynos5410_of_data;
2798 ++extern const struct samsung_pinctrl_of_match_data exynos5420_of_data;
2799 ++extern const struct samsung_pinctrl_of_match_data exynos5433_of_data;
2800 ++extern const struct samsung_pinctrl_of_match_data exynos7_of_data;
2801 ++extern const struct samsung_pinctrl_of_match_data s3c64xx_of_data;
2802 ++extern const struct samsung_pinctrl_of_match_data s3c2412_of_data;
2803 ++extern const struct samsung_pinctrl_of_match_data s3c2416_of_data;
2804 ++extern const struct samsung_pinctrl_of_match_data s3c2440_of_data;
2805 ++extern const struct samsung_pinctrl_of_match_data s3c2450_of_data;
2806 ++extern const struct samsung_pinctrl_of_match_data s5pv210_of_data;
2807 +
2808 + #endif /* __PINCTRL_SAMSUNG_H */
2809 +diff --git a/drivers/staging/android/ion/ion_cma_heap.c b/drivers/staging/android/ion/ion_cma_heap.c
2810 +index 86196ffd2faf..fa3e4b7e0c9f 100644
2811 +--- a/drivers/staging/android/ion/ion_cma_heap.c
2812 ++++ b/drivers/staging/android/ion/ion_cma_heap.c
2813 +@@ -21,6 +21,7 @@
2814 + #include <linux/err.h>
2815 + #include <linux/cma.h>
2816 + #include <linux/scatterlist.h>
2817 ++#include <linux/highmem.h>
2818 +
2819 + #include "ion.h"
2820 +
2821 +@@ -51,6 +52,22 @@ static int ion_cma_allocate(struct ion_heap *heap, struct ion_buffer *buffer,
2822 + if (!pages)
2823 + return -ENOMEM;
2824 +
2825 ++ if (PageHighMem(pages)) {
2826 ++ unsigned long nr_clear_pages = nr_pages;
2827 ++ struct page *page = pages;
2828 ++
2829 ++ while (nr_clear_pages > 0) {
2830 ++ void *vaddr = kmap_atomic(page);
2831 ++
2832 ++ memset(vaddr, 0, PAGE_SIZE);
2833 ++ kunmap_atomic(vaddr);
2834 ++ page++;
2835 ++ nr_clear_pages--;
2836 ++ }
2837 ++ } else {
2838 ++ memset(page_address(pages), 0, size);
2839 ++ }
2840 ++
2841 + table = kmalloc(sizeof(*table), GFP_KERNEL);
2842 + if (!table)
2843 + goto err;
2844 +diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
2845 +index 88b902c525d7..b4e57c5a8bba 100644
2846 +--- a/drivers/tty/vt/vt.c
2847 ++++ b/drivers/tty/vt/vt.c
2848 +@@ -1727,7 +1727,7 @@ static void reset_terminal(struct vc_data *vc, int do_clear)
2849 + default_attr(vc);
2850 + update_attr(vc);
2851 +
2852 +- vc->vc_tab_stop[0] = 0x01010100;
2853 ++ vc->vc_tab_stop[0] =
2854 + vc->vc_tab_stop[1] =
2855 + vc->vc_tab_stop[2] =
2856 + vc->vc_tab_stop[3] =
2857 +@@ -1771,7 +1771,7 @@ static void do_con_trol(struct tty_struct *tty, struct vc_data *vc, int c)
2858 + vc->vc_pos -= (vc->vc_x << 1);
2859 + while (vc->vc_x < vc->vc_cols - 1) {
2860 + vc->vc_x++;
2861 +- if (vc->vc_tab_stop[vc->vc_x >> 5] & (1 << (vc->vc_x & 31)))
2862 ++ if (vc->vc_tab_stop[7 & (vc->vc_x >> 5)] & (1 << (vc->vc_x & 31)))
2863 + break;
2864 + }
2865 + vc->vc_pos += (vc->vc_x << 1);
2866 +@@ -1831,7 +1831,7 @@ static void do_con_trol(struct tty_struct *tty, struct vc_data *vc, int c)
2867 + lf(vc);
2868 + return;
2869 + case 'H':
2870 +- vc->vc_tab_stop[vc->vc_x >> 5] |= (1 << (vc->vc_x & 31));
2871 ++ vc->vc_tab_stop[7 & (vc->vc_x >> 5)] |= (1 << (vc->vc_x & 31));
2872 + return;
2873 + case 'Z':
2874 + respond_ID(tty);
2875 +@@ -2024,7 +2024,7 @@ static void do_con_trol(struct tty_struct *tty, struct vc_data *vc, int c)
2876 + return;
2877 + case 'g':
2878 + if (!vc->vc_par[0])
2879 +- vc->vc_tab_stop[vc->vc_x >> 5] &= ~(1 << (vc->vc_x & 31));
2880 ++ vc->vc_tab_stop[7 & (vc->vc_x >> 5)] &= ~(1 << (vc->vc_x & 31));
2881 + else if (vc->vc_par[0] == 3) {
2882 + vc->vc_tab_stop[0] =
2883 + vc->vc_tab_stop[1] =
2884 +diff --git a/drivers/watchdog/wdat_wdt.c b/drivers/watchdog/wdat_wdt.c
2885 +index 6d1fbda0f461..0da9943d405f 100644
2886 +--- a/drivers/watchdog/wdat_wdt.c
2887 ++++ b/drivers/watchdog/wdat_wdt.c
2888 +@@ -392,7 +392,7 @@ static int wdat_wdt_probe(struct platform_device *pdev)
2889 +
2890 + memset(&r, 0, sizeof(r));
2891 + r.start = gas->address;
2892 +- r.end = r.start + gas->access_width;
2893 ++ r.end = r.start + gas->access_width - 1;
2894 + if (gas->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) {
2895 + r.flags = IORESOURCE_MEM;
2896 + } else if (gas->space_id == ACPI_ADR_SPACE_SYSTEM_IO) {
2897 +diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
2898 +index 8a85f3f53446..8a5bde8b1444 100644
2899 +--- a/fs/hugetlbfs/inode.c
2900 ++++ b/fs/hugetlbfs/inode.c
2901 +@@ -118,6 +118,16 @@ static void huge_pagevec_release(struct pagevec *pvec)
2902 + pagevec_reinit(pvec);
2903 + }
2904 +
2905 ++/*
2906 ++ * Mask used when checking the page offset value passed in via system
2907 ++ * calls. This value will be converted to a loff_t which is signed.
2908 ++ * Therefore, we want to check the upper PAGE_SHIFT + 1 bits of the
2909 ++ * value. The extra bit (- 1 in the shift value) is to take the sign
2910 ++ * bit into account.
2911 ++ */
2912 ++#define PGOFF_LOFFT_MAX \
2913 ++ (((1UL << (PAGE_SHIFT + 1)) - 1) << (BITS_PER_LONG - (PAGE_SHIFT + 1)))
2914 ++
2915 + static int hugetlbfs_file_mmap(struct file *file, struct vm_area_struct *vma)
2916 + {
2917 + struct inode *inode = file_inode(file);
2918 +@@ -137,12 +147,13 @@ static int hugetlbfs_file_mmap(struct file *file, struct vm_area_struct *vma)
2919 + vma->vm_ops = &hugetlb_vm_ops;
2920 +
2921 + /*
2922 +- * Offset passed to mmap (before page shift) could have been
2923 +- * negative when represented as a (l)off_t.
2924 ++ * page based offset in vm_pgoff could be sufficiently large to
2925 ++ * overflow a (l)off_t when converted to byte offset.
2926 + */
2927 +- if (((loff_t)vma->vm_pgoff << PAGE_SHIFT) < 0)
2928 ++ if (vma->vm_pgoff & PGOFF_LOFFT_MAX)
2929 + return -EINVAL;
2930 +
2931 ++ /* must be huge page aligned */
2932 + if (vma->vm_pgoff & (~huge_page_mask(h) >> PAGE_SHIFT))
2933 + return -EINVAL;
2934 +
2935 +diff --git a/fs/ncpfs/ncplib_kernel.c b/fs/ncpfs/ncplib_kernel.c
2936 +index 804adfebba2f..3e047eb4cc7c 100644
2937 +--- a/fs/ncpfs/ncplib_kernel.c
2938 ++++ b/fs/ncpfs/ncplib_kernel.c
2939 +@@ -981,6 +981,10 @@ ncp_read_kernel(struct ncp_server *server, const char *file_id,
2940 + goto out;
2941 + }
2942 + *bytes_read = ncp_reply_be16(server, 0);
2943 ++ if (*bytes_read > to_read) {
2944 ++ result = -EINVAL;
2945 ++ goto out;
2946 ++ }
2947 + source = ncp_reply_data(server, 2 + (offset & 1));
2948 +
2949 + memcpy(target, source, *bytes_read);
2950 +diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
2951 +index 5a75135f5f53..974b1be7f148 100644
2952 +--- a/fs/nfsd/nfs4state.c
2953 ++++ b/fs/nfsd/nfs4state.c
2954 +@@ -268,6 +268,35 @@ free_blocked_lock(struct nfsd4_blocked_lock *nbl)
2955 + kfree(nbl);
2956 + }
2957 +
2958 ++static void
2959 ++remove_blocked_locks(struct nfs4_lockowner *lo)
2960 ++{
2961 ++ struct nfs4_client *clp = lo->lo_owner.so_client;
2962 ++ struct nfsd_net *nn = net_generic(clp->net, nfsd_net_id);
2963 ++ struct nfsd4_blocked_lock *nbl;
2964 ++ LIST_HEAD(reaplist);
2965 ++
2966 ++ /* Dequeue all blocked locks */
2967 ++ spin_lock(&nn->blocked_locks_lock);
2968 ++ while (!list_empty(&lo->lo_blocked)) {
2969 ++ nbl = list_first_entry(&lo->lo_blocked,
2970 ++ struct nfsd4_blocked_lock,
2971 ++ nbl_list);
2972 ++ list_del_init(&nbl->nbl_list);
2973 ++ list_move(&nbl->nbl_lru, &reaplist);
2974 ++ }
2975 ++ spin_unlock(&nn->blocked_locks_lock);
2976 ++
2977 ++ /* Now free them */
2978 ++ while (!list_empty(&reaplist)) {
2979 ++ nbl = list_first_entry(&reaplist, struct nfsd4_blocked_lock,
2980 ++ nbl_lru);
2981 ++ list_del_init(&nbl->nbl_lru);
2982 ++ posix_unblock_lock(&nbl->nbl_lock);
2983 ++ free_blocked_lock(nbl);
2984 ++ }
2985 ++}
2986 ++
2987 + static int
2988 + nfsd4_cb_notify_lock_done(struct nfsd4_callback *cb, struct rpc_task *task)
2989 + {
2990 +@@ -1866,6 +1895,7 @@ static __be32 mark_client_expired_locked(struct nfs4_client *clp)
2991 + static void
2992 + __destroy_client(struct nfs4_client *clp)
2993 + {
2994 ++ int i;
2995 + struct nfs4_openowner *oo;
2996 + struct nfs4_delegation *dp;
2997 + struct list_head reaplist;
2998 +@@ -1895,6 +1925,16 @@ __destroy_client(struct nfs4_client *clp)
2999 + nfs4_get_stateowner(&oo->oo_owner);
3000 + release_openowner(oo);
3001 + }
3002 ++ for (i = 0; i < OWNER_HASH_SIZE; i++) {
3003 ++ struct nfs4_stateowner *so, *tmp;
3004 ++
3005 ++ list_for_each_entry_safe(so, tmp, &clp->cl_ownerstr_hashtbl[i],
3006 ++ so_strhash) {
3007 ++ /* Should be no openowners at this point */
3008 ++ WARN_ON_ONCE(so->so_is_open_owner);
3009 ++ remove_blocked_locks(lockowner(so));
3010 ++ }
3011 ++ }
3012 + nfsd4_return_all_client_layouts(clp);
3013 + nfsd4_shutdown_callback(clp);
3014 + if (clp->cl_cb_conn.cb_xprt)
3015 +@@ -6358,6 +6398,7 @@ nfsd4_release_lockowner(struct svc_rqst *rqstp,
3016 + }
3017 + spin_unlock(&clp->cl_lock);
3018 + free_ol_stateid_reaplist(&reaplist);
3019 ++ remove_blocked_locks(lo);
3020 + nfs4_put_stateowner(&lo->lo_owner);
3021 +
3022 + return status;
3023 +@@ -7143,6 +7184,8 @@ nfs4_state_destroy_net(struct net *net)
3024 + }
3025 + }
3026 +
3027 ++ WARN_ON(!list_empty(&nn->blocked_locks_lru));
3028 ++
3029 + for (i = 0; i < CLIENT_HASH_SIZE; i++) {
3030 + while (!list_empty(&nn->unconf_id_hashtbl[i])) {
3031 + clp = list_entry(nn->unconf_id_hashtbl[i].next, struct nfs4_client, cl_idhash);
3032 +@@ -7209,7 +7252,6 @@ nfs4_state_shutdown_net(struct net *net)
3033 + struct nfs4_delegation *dp = NULL;
3034 + struct list_head *pos, *next, reaplist;
3035 + struct nfsd_net *nn = net_generic(net, nfsd_net_id);
3036 +- struct nfsd4_blocked_lock *nbl;
3037 +
3038 + cancel_delayed_work_sync(&nn->laundromat_work);
3039 + locks_end_grace(&nn->nfsd4_manager);
3040 +@@ -7230,24 +7272,6 @@ nfs4_state_shutdown_net(struct net *net)
3041 + nfs4_put_stid(&dp->dl_stid);
3042 + }
3043 +
3044 +- BUG_ON(!list_empty(&reaplist));
3045 +- spin_lock(&nn->blocked_locks_lock);
3046 +- while (!list_empty(&nn->blocked_locks_lru)) {
3047 +- nbl = list_first_entry(&nn->blocked_locks_lru,
3048 +- struct nfsd4_blocked_lock, nbl_lru);
3049 +- list_move(&nbl->nbl_lru, &reaplist);
3050 +- list_del_init(&nbl->nbl_list);
3051 +- }
3052 +- spin_unlock(&nn->blocked_locks_lock);
3053 +-
3054 +- while (!list_empty(&reaplist)) {
3055 +- nbl = list_first_entry(&reaplist,
3056 +- struct nfsd4_blocked_lock, nbl_lru);
3057 +- list_del_init(&nbl->nbl_lru);
3058 +- posix_unblock_lock(&nbl->nbl_lock);
3059 +- free_blocked_lock(nbl);
3060 +- }
3061 +-
3062 + nfsd4_client_tracking_exit(net);
3063 + nfs4_state_destroy_net(net);
3064 + }
3065 +diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h
3066 +index 868e68561f91..dfc861caa478 100644
3067 +--- a/include/asm-generic/pgtable.h
3068 ++++ b/include/asm-generic/pgtable.h
3069 +@@ -976,6 +976,8 @@ int pud_set_huge(pud_t *pud, phys_addr_t addr, pgprot_t prot);
3070 + int pmd_set_huge(pmd_t *pmd, phys_addr_t addr, pgprot_t prot);
3071 + int pud_clear_huge(pud_t *pud);
3072 + int pmd_clear_huge(pmd_t *pmd);
3073 ++int pud_free_pmd_page(pud_t *pud);
3074 ++int pmd_free_pte_page(pmd_t *pmd);
3075 + #else /* !CONFIG_HAVE_ARCH_HUGE_VMAP */
3076 + static inline int p4d_set_huge(p4d_t *p4d, phys_addr_t addr, pgprot_t prot)
3077 + {
3078 +@@ -1001,6 +1003,14 @@ static inline int pmd_clear_huge(pmd_t *pmd)
3079 + {
3080 + return 0;
3081 + }
3082 ++static inline int pud_free_pmd_page(pud_t *pud)
3083 ++{
3084 ++ return 0;
3085 ++}
3086 ++static inline int pmd_free_pte_page(pmd_t *pmd)
3087 ++{
3088 ++ return 0;
3089 ++}
3090 + #endif /* CONFIG_HAVE_ARCH_HUGE_VMAP */
3091 +
3092 + #ifndef __HAVE_ARCH_FLUSH_PMD_TLB_RANGE
3093 +diff --git a/include/linux/fsl_ifc.h b/include/linux/fsl_ifc.h
3094 +index c332f0a45607..3fdfede2f0f3 100644
3095 +--- a/include/linux/fsl_ifc.h
3096 ++++ b/include/linux/fsl_ifc.h
3097 +@@ -734,11 +734,7 @@ struct fsl_ifc_nand {
3098 + u32 res19[0x10];
3099 + __be32 nand_fsr;
3100 + u32 res20;
3101 +- /* The V1 nand_eccstat is actually 4 words that overlaps the
3102 +- * V2 nand_eccstat.
3103 +- */
3104 +- __be32 v1_nand_eccstat[2];
3105 +- __be32 v2_nand_eccstat[6];
3106 ++ __be32 nand_eccstat[8];
3107 + u32 res21[0x1c];
3108 + __be32 nanndcr;
3109 + u32 res22[0x2];
3110 +diff --git a/include/linux/memblock.h b/include/linux/memblock.h
3111 +index 7ed0f7782d16..9efd592c5da4 100644
3112 +--- a/include/linux/memblock.h
3113 ++++ b/include/linux/memblock.h
3114 +@@ -187,7 +187,6 @@ int memblock_search_pfn_nid(unsigned long pfn, unsigned long *start_pfn,
3115 + unsigned long *end_pfn);
3116 + void __next_mem_pfn_range(int *idx, int nid, unsigned long *out_start_pfn,
3117 + unsigned long *out_end_pfn, int *out_nid);
3118 +-unsigned long memblock_next_valid_pfn(unsigned long pfn, unsigned long max_pfn);
3119 +
3120 + /**
3121 + * for_each_mem_pfn_range - early memory pfn range iterator
3122 +diff --git a/include/trace/events/mmc.h b/include/trace/events/mmc.h
3123 +index 200f731be557..7b706ff21335 100644
3124 +--- a/include/trace/events/mmc.h
3125 ++++ b/include/trace/events/mmc.h
3126 +@@ -86,8 +86,8 @@ TRACE_EVENT(mmc_request_start,
3127 + __entry->stop_flags, __entry->stop_retries,
3128 + __entry->sbc_opcode, __entry->sbc_arg,
3129 + __entry->sbc_flags, __entry->sbc_retries,
3130 +- __entry->blocks, __entry->blk_addr,
3131 +- __entry->blksz, __entry->data_flags, __entry->tag,
3132 ++ __entry->blocks, __entry->blksz,
3133 ++ __entry->blk_addr, __entry->data_flags, __entry->tag,
3134 + __entry->can_retune, __entry->doing_retune,
3135 + __entry->retune_now, __entry->need_retune,
3136 + __entry->hold_retune, __entry->retune_period)
3137 +diff --git a/include/uapi/linux/usb/audio.h b/include/uapi/linux/usb/audio.h
3138 +index 17a022c5b414..da3315ed1bcd 100644
3139 +--- a/include/uapi/linux/usb/audio.h
3140 ++++ b/include/uapi/linux/usb/audio.h
3141 +@@ -370,7 +370,7 @@ static inline __u8 uac_processing_unit_bControlSize(struct uac_processing_unit_d
3142 + {
3143 + return (protocol == UAC_VERSION_1) ?
3144 + desc->baSourceID[desc->bNrInPins + 4] :
3145 +- desc->baSourceID[desc->bNrInPins + 6];
3146 ++ 2; /* in UAC2, this value is constant */
3147 + }
3148 +
3149 + static inline __u8 *uac_processing_unit_bmControls(struct uac_processing_unit_descriptor *desc,
3150 +@@ -378,7 +378,7 @@ static inline __u8 *uac_processing_unit_bmControls(struct uac_processing_unit_de
3151 + {
3152 + return (protocol == UAC_VERSION_1) ?
3153 + &desc->baSourceID[desc->bNrInPins + 5] :
3154 +- &desc->baSourceID[desc->bNrInPins + 7];
3155 ++ &desc->baSourceID[desc->bNrInPins + 6];
3156 + }
3157 +
3158 + static inline __u8 uac_processing_unit_iProcessing(struct uac_processing_unit_descriptor *desc,
3159 +diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c
3160 +index 5cb783fc8224..b719351b48d2 100644
3161 +--- a/kernel/bpf/syscall.c
3162 ++++ b/kernel/bpf/syscall.c
3163 +@@ -1687,7 +1687,7 @@ SYSCALL_DEFINE3(bpf, int, cmd, union bpf_attr __user *, uattr, unsigned int, siz
3164 + union bpf_attr attr = {};
3165 + int err;
3166 +
3167 +- if (!capable(CAP_SYS_ADMIN) && sysctl_unprivileged_bpf_disabled)
3168 ++ if (sysctl_unprivileged_bpf_disabled && !capable(CAP_SYS_ADMIN))
3169 + return -EPERM;
3170 +
3171 + err = check_uarg_tail_zero(uattr, sizeof(attr), size);
3172 +diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c
3173 +index 7e4c44538119..2522fac782af 100644
3174 +--- a/kernel/cgroup/cgroup.c
3175 ++++ b/kernel/cgroup/cgroup.c
3176 +@@ -3183,6 +3183,16 @@ static int cgroup_enable_threaded(struct cgroup *cgrp)
3177 + if (cgroup_is_threaded(cgrp))
3178 + return 0;
3179 +
3180 ++ /*
3181 ++ * If @cgroup is populated or has domain controllers enabled, it
3182 ++ * can't be switched. While the below cgroup_can_be_thread_root()
3183 ++ * test can catch the same conditions, that's only when @parent is
3184 ++ * not mixable, so let's check it explicitly.
3185 ++ */
3186 ++ if (cgroup_is_populated(cgrp) ||
3187 ++ cgrp->subtree_control & ~cgrp_dfl_threaded_ss_mask)
3188 ++ return -EOPNOTSUPP;
3189 ++
3190 + /* we're joining the parent's domain, ensure its validity */
3191 + if (!cgroup_is_valid_domain(dom_cgrp) ||
3192 + !cgroup_can_be_thread_root(dom_cgrp))
3193 +diff --git a/kernel/events/core.c b/kernel/events/core.c
3194 +index 5d8f4031f8d5..385480a5aa45 100644
3195 +--- a/kernel/events/core.c
3196 ++++ b/kernel/events/core.c
3197 +@@ -2246,7 +2246,7 @@ static void ctx_resched(struct perf_cpu_context *cpuctx,
3198 + struct perf_event_context *task_ctx,
3199 + enum event_type_t event_type)
3200 + {
3201 +- enum event_type_t ctx_event_type = event_type & EVENT_ALL;
3202 ++ enum event_type_t ctx_event_type;
3203 + bool cpu_event = !!(event_type & EVENT_CPU);
3204 +
3205 + /*
3206 +@@ -2256,6 +2256,8 @@ static void ctx_resched(struct perf_cpu_context *cpuctx,
3207 + if (event_type & EVENT_PINNED)
3208 + event_type |= EVENT_FLEXIBLE;
3209 +
3210 ++ ctx_event_type = event_type & EVENT_ALL;
3211 ++
3212 + perf_pmu_disable(cpuctx->ctx.pmu);
3213 + if (task_ctx)
3214 + task_ctx_sched_out(cpuctx, task_ctx, event_type);
3215 +diff --git a/kernel/module.c b/kernel/module.c
3216 +index 09e48eee4d55..0c4530763f02 100644
3217 +--- a/kernel/module.c
3218 ++++ b/kernel/module.c
3219 +@@ -4223,7 +4223,7 @@ static int modules_open(struct inode *inode, struct file *file)
3220 + m->private = kallsyms_show_value() ? NULL : (void *)8ul;
3221 + }
3222 +
3223 +- return 0;
3224 ++ return err;
3225 + }
3226 +
3227 + static const struct file_operations proc_modules_operations = {
3228 +diff --git a/kernel/sched/core.c b/kernel/sched/core.c
3229 +index 5a31a85bbd84..b4f7f890c1b9 100644
3230 +--- a/kernel/sched/core.c
3231 ++++ b/kernel/sched/core.c
3232 +@@ -6611,13 +6611,18 @@ static int tg_cfs_schedulable_down(struct task_group *tg, void *data)
3233 + parent_quota = parent_b->hierarchical_quota;
3234 +
3235 + /*
3236 +- * Ensure max(child_quota) <= parent_quota, inherit when no
3237 ++ * Ensure max(child_quota) <= parent_quota. On cgroup2,
3238 ++ * always take the min. On cgroup1, only inherit when no
3239 + * limit is set:
3240 + */
3241 +- if (quota == RUNTIME_INF)
3242 +- quota = parent_quota;
3243 +- else if (parent_quota != RUNTIME_INF && quota > parent_quota)
3244 +- return -EINVAL;
3245 ++ if (cgroup_subsys_on_dfl(cpu_cgrp_subsys)) {
3246 ++ quota = min(quota, parent_quota);
3247 ++ } else {
3248 ++ if (quota == RUNTIME_INF)
3249 ++ quota = parent_quota;
3250 ++ else if (parent_quota != RUNTIME_INF && quota > parent_quota)
3251 ++ return -EINVAL;
3252 ++ }
3253 + }
3254 + cfs_b->hierarchical_quota = quota;
3255 +
3256 +diff --git a/kernel/time/posix-timers.c b/kernel/time/posix-timers.c
3257 +index ec999f32c840..708992708332 100644
3258 +--- a/kernel/time/posix-timers.c
3259 ++++ b/kernel/time/posix-timers.c
3260 +@@ -50,6 +50,7 @@
3261 + #include <linux/export.h>
3262 + #include <linux/hashtable.h>
3263 + #include <linux/compat.h>
3264 ++#include <linux/nospec.h>
3265 +
3266 + #include "timekeeping.h"
3267 + #include "posix-timers.h"
3268 +@@ -1346,11 +1347,15 @@ static const struct k_clock * const posix_clocks[] = {
3269 +
3270 + static const struct k_clock *clockid_to_kclock(const clockid_t id)
3271 + {
3272 +- if (id < 0)
3273 ++ clockid_t idx = id;
3274 ++
3275 ++ if (id < 0) {
3276 + return (id & CLOCKFD_MASK) == CLOCKFD ?
3277 + &clock_posix_dynamic : &clock_posix_cpu;
3278 ++ }
3279 +
3280 +- if (id >= ARRAY_SIZE(posix_clocks) || !posix_clocks[id])
3281 ++ if (id >= ARRAY_SIZE(posix_clocks))
3282 + return NULL;
3283 +- return posix_clocks[id];
3284 ++
3285 ++ return posix_clocks[array_index_nospec(idx, ARRAY_SIZE(posix_clocks))];
3286 + }
3287 +diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c
3288 +index 40207c2a4113..fe2429b382ca 100644
3289 +--- a/kernel/trace/bpf_trace.c
3290 ++++ b/kernel/trace/bpf_trace.c
3291 +@@ -636,7 +636,41 @@ static const struct bpf_func_proto bpf_get_stackid_proto_tp = {
3292 + .arg3_type = ARG_ANYTHING,
3293 + };
3294 +
3295 +-BPF_CALL_3(bpf_perf_prog_read_value_tp, struct bpf_perf_event_data_kern *, ctx,
3296 ++static const struct bpf_func_proto *tp_prog_func_proto(enum bpf_func_id func_id)
3297 ++{
3298 ++ switch (func_id) {
3299 ++ case BPF_FUNC_perf_event_output:
3300 ++ return &bpf_perf_event_output_proto_tp;
3301 ++ case BPF_FUNC_get_stackid:
3302 ++ return &bpf_get_stackid_proto_tp;
3303 ++ default:
3304 ++ return tracing_func_proto(func_id);
3305 ++ }
3306 ++}
3307 ++
3308 ++static bool tp_prog_is_valid_access(int off, int size, enum bpf_access_type type,
3309 ++ struct bpf_insn_access_aux *info)
3310 ++{
3311 ++ if (off < sizeof(void *) || off >= PERF_MAX_TRACE_SIZE)
3312 ++ return false;
3313 ++ if (type != BPF_READ)
3314 ++ return false;
3315 ++ if (off % size != 0)
3316 ++ return false;
3317 ++
3318 ++ BUILD_BUG_ON(PERF_MAX_TRACE_SIZE % sizeof(__u64));
3319 ++ return true;
3320 ++}
3321 ++
3322 ++const struct bpf_verifier_ops tracepoint_verifier_ops = {
3323 ++ .get_func_proto = tp_prog_func_proto,
3324 ++ .is_valid_access = tp_prog_is_valid_access,
3325 ++};
3326 ++
3327 ++const struct bpf_prog_ops tracepoint_prog_ops = {
3328 ++};
3329 ++
3330 ++BPF_CALL_3(bpf_perf_prog_read_value, struct bpf_perf_event_data_kern *, ctx,
3331 + struct bpf_perf_event_value *, buf, u32, size)
3332 + {
3333 + int err = -EINVAL;
3334 +@@ -653,8 +687,8 @@ BPF_CALL_3(bpf_perf_prog_read_value_tp, struct bpf_perf_event_data_kern *, ctx,
3335 + return err;
3336 + }
3337 +
3338 +-static const struct bpf_func_proto bpf_perf_prog_read_value_proto_tp = {
3339 +- .func = bpf_perf_prog_read_value_tp,
3340 ++static const struct bpf_func_proto bpf_perf_prog_read_value_proto = {
3341 ++ .func = bpf_perf_prog_read_value,
3342 + .gpl_only = true,
3343 + .ret_type = RET_INTEGER,
3344 + .arg1_type = ARG_PTR_TO_CTX,
3345 +@@ -662,7 +696,7 @@ static const struct bpf_func_proto bpf_perf_prog_read_value_proto_tp = {
3346 + .arg3_type = ARG_CONST_SIZE,
3347 + };
3348 +
3349 +-static const struct bpf_func_proto *tp_prog_func_proto(enum bpf_func_id func_id)
3350 ++static const struct bpf_func_proto *pe_prog_func_proto(enum bpf_func_id func_id)
3351 + {
3352 + switch (func_id) {
3353 + case BPF_FUNC_perf_event_output:
3354 +@@ -670,34 +704,12 @@ static const struct bpf_func_proto *tp_prog_func_proto(enum bpf_func_id func_id)
3355 + case BPF_FUNC_get_stackid:
3356 + return &bpf_get_stackid_proto_tp;
3357 + case BPF_FUNC_perf_prog_read_value:
3358 +- return &bpf_perf_prog_read_value_proto_tp;
3359 ++ return &bpf_perf_prog_read_value_proto;
3360 + default:
3361 + return tracing_func_proto(func_id);
3362 + }
3363 + }
3364 +
3365 +-static bool tp_prog_is_valid_access(int off, int size, enum bpf_access_type type,
3366 +- struct bpf_insn_access_aux *info)
3367 +-{
3368 +- if (off < sizeof(void *) || off >= PERF_MAX_TRACE_SIZE)
3369 +- return false;
3370 +- if (type != BPF_READ)
3371 +- return false;
3372 +- if (off % size != 0)
3373 +- return false;
3374 +-
3375 +- BUILD_BUG_ON(PERF_MAX_TRACE_SIZE % sizeof(__u64));
3376 +- return true;
3377 +-}
3378 +-
3379 +-const struct bpf_verifier_ops tracepoint_verifier_ops = {
3380 +- .get_func_proto = tp_prog_func_proto,
3381 +- .is_valid_access = tp_prog_is_valid_access,
3382 +-};
3383 +-
3384 +-const struct bpf_prog_ops tracepoint_prog_ops = {
3385 +-};
3386 +-
3387 + static bool pe_prog_is_valid_access(int off, int size, enum bpf_access_type type,
3388 + struct bpf_insn_access_aux *info)
3389 + {
3390 +@@ -754,7 +766,7 @@ static u32 pe_prog_convert_ctx_access(enum bpf_access_type type,
3391 + }
3392 +
3393 + const struct bpf_verifier_ops perf_event_verifier_ops = {
3394 +- .get_func_proto = tp_prog_func_proto,
3395 ++ .get_func_proto = pe_prog_func_proto,
3396 + .is_valid_access = pe_prog_is_valid_access,
3397 + .convert_ctx_access = pe_prog_convert_ctx_access,
3398 + };
3399 +diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
3400 +index 492700c5fb4d..fccf00a66298 100644
3401 +--- a/kernel/trace/trace_kprobe.c
3402 ++++ b/kernel/trace/trace_kprobe.c
3403 +@@ -635,7 +635,7 @@ static int create_trace_kprobe(int argc, char **argv)
3404 + char *symbol = NULL, *event = NULL, *group = NULL;
3405 + int maxactive = 0;
3406 + char *arg;
3407 +- unsigned long offset = 0;
3408 ++ long offset = 0;
3409 + void *addr = NULL;
3410 + char buf[MAX_EVENT_NAME_LEN];
3411 +
3412 +@@ -723,7 +723,7 @@ static int create_trace_kprobe(int argc, char **argv)
3413 + symbol = argv[1];
3414 + /* TODO: support .init module functions */
3415 + ret = traceprobe_split_symbol_offset(symbol, &offset);
3416 +- if (ret) {
3417 ++ if (ret || offset < 0 || offset > UINT_MAX) {
3418 + pr_info("Failed to parse either an address or a symbol.\n");
3419 + return ret;
3420 + }
3421 +diff --git a/kernel/trace/trace_probe.c b/kernel/trace/trace_probe.c
3422 +index d59357308677..daf54bda4dc8 100644
3423 +--- a/kernel/trace/trace_probe.c
3424 ++++ b/kernel/trace/trace_probe.c
3425 +@@ -320,7 +320,7 @@ static fetch_func_t get_fetch_size_function(const struct fetch_type *type,
3426 + }
3427 +
3428 + /* Split symbol and offset. */
3429 +-int traceprobe_split_symbol_offset(char *symbol, unsigned long *offset)
3430 ++int traceprobe_split_symbol_offset(char *symbol, long *offset)
3431 + {
3432 + char *tmp;
3433 + int ret;
3434 +@@ -328,13 +328,11 @@ int traceprobe_split_symbol_offset(char *symbol, unsigned long *offset)
3435 + if (!offset)
3436 + return -EINVAL;
3437 +
3438 +- tmp = strchr(symbol, '+');
3439 ++ tmp = strpbrk(symbol, "+-");
3440 + if (tmp) {
3441 +- /* skip sign because kstrtoul doesn't accept '+' */
3442 +- ret = kstrtoul(tmp + 1, 0, offset);
3443 ++ ret = kstrtol(tmp, 0, offset);
3444 + if (ret)
3445 + return ret;
3446 +-
3447 + *tmp = '\0';
3448 + } else
3449 + *offset = 0;
3450 +diff --git a/kernel/trace/trace_probe.h b/kernel/trace/trace_probe.h
3451 +index fb66e3eaa192..a0d750e3d17c 100644
3452 +--- a/kernel/trace/trace_probe.h
3453 ++++ b/kernel/trace/trace_probe.h
3454 +@@ -353,7 +353,7 @@ extern int traceprobe_conflict_field_name(const char *name,
3455 + extern void traceprobe_update_arg(struct probe_arg *arg);
3456 + extern void traceprobe_free_probe_arg(struct probe_arg *arg);
3457 +
3458 +-extern int traceprobe_split_symbol_offset(char *symbol, unsigned long *offset);
3459 ++extern int traceprobe_split_symbol_offset(char *symbol, long *offset);
3460 +
3461 + /* Sum up total data length for dynamic arraies (strings) */
3462 + static nokprobe_inline int
3463 +diff --git a/lib/ioremap.c b/lib/ioremap.c
3464 +index b808a390e4c3..54e5bbaa3200 100644
3465 +--- a/lib/ioremap.c
3466 ++++ b/lib/ioremap.c
3467 +@@ -91,7 +91,8 @@ static inline int ioremap_pmd_range(pud_t *pud, unsigned long addr,
3468 +
3469 + if (ioremap_pmd_enabled() &&
3470 + ((next - addr) == PMD_SIZE) &&
3471 +- IS_ALIGNED(phys_addr + addr, PMD_SIZE)) {
3472 ++ IS_ALIGNED(phys_addr + addr, PMD_SIZE) &&
3473 ++ pmd_free_pte_page(pmd)) {
3474 + if (pmd_set_huge(pmd, phys_addr + addr, prot))
3475 + continue;
3476 + }
3477 +@@ -117,7 +118,8 @@ static inline int ioremap_pud_range(p4d_t *p4d, unsigned long addr,
3478 +
3479 + if (ioremap_pud_enabled() &&
3480 + ((next - addr) == PUD_SIZE) &&
3481 +- IS_ALIGNED(phys_addr + addr, PUD_SIZE)) {
3482 ++ IS_ALIGNED(phys_addr + addr, PUD_SIZE) &&
3483 ++ pud_free_pmd_page(pud)) {
3484 + if (pud_set_huge(pud, phys_addr + addr, prot))
3485 + continue;
3486 + }
3487 +diff --git a/mm/huge_memory.c b/mm/huge_memory.c
3488 +index 0e7ded98d114..4ed6c89e95c3 100644
3489 +--- a/mm/huge_memory.c
3490 ++++ b/mm/huge_memory.c
3491 +@@ -2791,11 +2791,13 @@ static unsigned long deferred_split_scan(struct shrinker *shrink,
3492 +
3493 + list_for_each_safe(pos, next, &list) {
3494 + page = list_entry((void *)pos, struct page, mapping);
3495 +- lock_page(page);
3496 ++ if (!trylock_page(page))
3497 ++ goto next;
3498 + /* split_huge_page() removes page from list on success */
3499 + if (!split_huge_page(page))
3500 + split++;
3501 + unlock_page(page);
3502 ++next:
3503 + put_page(page);
3504 + }
3505 +
3506 +diff --git a/mm/hugetlb.c b/mm/hugetlb.c
3507 +index 9a334f5fb730..d01912be98da 100644
3508 +--- a/mm/hugetlb.c
3509 ++++ b/mm/hugetlb.c
3510 +@@ -18,6 +18,7 @@
3511 + #include <linux/bootmem.h>
3512 + #include <linux/sysfs.h>
3513 + #include <linux/slab.h>
3514 ++#include <linux/mmdebug.h>
3515 + #include <linux/sched/signal.h>
3516 + #include <linux/rmap.h>
3517 + #include <linux/string_helpers.h>
3518 +@@ -4354,6 +4355,12 @@ int hugetlb_reserve_pages(struct inode *inode,
3519 + struct resv_map *resv_map;
3520 + long gbl_reserve;
3521 +
3522 ++ /* This should never happen */
3523 ++ if (from > to) {
3524 ++ VM_WARN(1, "%s called with a negative range\n", __func__);
3525 ++ return -EINVAL;
3526 ++ }
3527 ++
3528 + /*
3529 + * Only apply hugepage reservation if asked. At fault time, an
3530 + * attempt will be made for VM_NORESERVE to allocate a page
3531 +diff --git a/mm/khugepaged.c b/mm/khugepaged.c
3532 +index ea4ff259b671..33255bf91074 100644
3533 +--- a/mm/khugepaged.c
3534 ++++ b/mm/khugepaged.c
3535 +@@ -530,7 +530,12 @@ static int __collapse_huge_page_isolate(struct vm_area_struct *vma,
3536 + goto out;
3537 + }
3538 +
3539 +- VM_BUG_ON_PAGE(PageCompound(page), page);
3540 ++ /* TODO: teach khugepaged to collapse THP mapped with pte */
3541 ++ if (PageCompound(page)) {
3542 ++ result = SCAN_PAGE_COMPOUND;
3543 ++ goto out;
3544 ++ }
3545 ++
3546 + VM_BUG_ON_PAGE(!PageAnon(page), page);
3547 +
3548 + /*
3549 +diff --git a/mm/memblock.c b/mm/memblock.c
3550 +index d25b5a456cca..028429d5bc38 100644
3551 +--- a/mm/memblock.c
3552 ++++ b/mm/memblock.c
3553 +@@ -1101,34 +1101,6 @@ void __init_memblock __next_mem_pfn_range(int *idx, int nid,
3554 + *out_nid = r->nid;
3555 + }
3556 +
3557 +-unsigned long __init_memblock memblock_next_valid_pfn(unsigned long pfn,
3558 +- unsigned long max_pfn)
3559 +-{
3560 +- struct memblock_type *type = &memblock.memory;
3561 +- unsigned int right = type->cnt;
3562 +- unsigned int mid, left = 0;
3563 +- phys_addr_t addr = PFN_PHYS(++pfn);
3564 +-
3565 +- do {
3566 +- mid = (right + left) / 2;
3567 +-
3568 +- if (addr < type->regions[mid].base)
3569 +- right = mid;
3570 +- else if (addr >= (type->regions[mid].base +
3571 +- type->regions[mid].size))
3572 +- left = mid + 1;
3573 +- else {
3574 +- /* addr is within the region, so pfn is valid */
3575 +- return pfn;
3576 +- }
3577 +- } while (left < right);
3578 +-
3579 +- if (right == type->cnt)
3580 +- return -1UL;
3581 +- else
3582 +- return PHYS_PFN(type->regions[right].base);
3583 +-}
3584 +-
3585 + /**
3586 + * memblock_set_node - set node ID on memblock regions
3587 + * @base: base of area to set node ID for
3588 +diff --git a/mm/page_alloc.c b/mm/page_alloc.c
3589 +index 9f927497f2f5..d8ee1effa4a6 100644
3590 +--- a/mm/page_alloc.c
3591 ++++ b/mm/page_alloc.c
3592 +@@ -3588,7 +3588,7 @@ static bool __need_fs_reclaim(gfp_t gfp_mask)
3593 + return false;
3594 +
3595 + /* this guy won't enter reclaim */
3596 +- if ((current->flags & PF_MEMALLOC) && !(gfp_mask & __GFP_NOMEMALLOC))
3597 ++ if (current->flags & PF_MEMALLOC)
3598 + return false;
3599 +
3600 + /* We're only interested __GFP_FS allocations for now */
3601 +@@ -5348,17 +5348,8 @@ void __meminit memmap_init_zone(unsigned long size, int nid, unsigned long zone,
3602 + if (context != MEMMAP_EARLY)
3603 + goto not_early;
3604 +
3605 +- if (!early_pfn_valid(pfn)) {
3606 +-#ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP
3607 +- /*
3608 +- * Skip to the pfn preceding the next valid one (or
3609 +- * end_pfn), such that we hit a valid pfn (or end_pfn)
3610 +- * on our next iteration of the loop.
3611 +- */
3612 +- pfn = memblock_next_valid_pfn(pfn, end_pfn) - 1;
3613 +-#endif
3614 ++ if (!early_pfn_valid(pfn))
3615 + continue;
3616 +- }
3617 + if (!early_pfn_in_nid(pfn, nid))
3618 + continue;
3619 + if (!update_defer_init(pgdat, pfn, end_pfn, &nr_initialised))
3620 +diff --git a/mm/shmem.c b/mm/shmem.c
3621 +index 7fbe67be86fa..29a369c2067f 100644
3622 +--- a/mm/shmem.c
3623 ++++ b/mm/shmem.c
3624 +@@ -493,36 +493,45 @@ static unsigned long shmem_unused_huge_shrink(struct shmem_sb_info *sbinfo,
3625 + info = list_entry(pos, struct shmem_inode_info, shrinklist);
3626 + inode = &info->vfs_inode;
3627 +
3628 +- if (nr_to_split && split >= nr_to_split) {
3629 +- iput(inode);
3630 +- continue;
3631 +- }
3632 ++ if (nr_to_split && split >= nr_to_split)
3633 ++ goto leave;
3634 +
3635 +- page = find_lock_page(inode->i_mapping,
3636 ++ page = find_get_page(inode->i_mapping,
3637 + (inode->i_size & HPAGE_PMD_MASK) >> PAGE_SHIFT);
3638 + if (!page)
3639 + goto drop;
3640 +
3641 ++ /* No huge page at the end of the file: nothing to split */
3642 + if (!PageTransHuge(page)) {
3643 +- unlock_page(page);
3644 + put_page(page);
3645 + goto drop;
3646 + }
3647 +
3648 ++ /*
3649 ++ * Leave the inode on the list if we failed to lock
3650 ++ * the page at this time.
3651 ++ *
3652 ++ * Waiting for the lock may lead to deadlock in the
3653 ++ * reclaim path.
3654 ++ */
3655 ++ if (!trylock_page(page)) {
3656 ++ put_page(page);
3657 ++ goto leave;
3658 ++ }
3659 ++
3660 + ret = split_huge_page(page);
3661 + unlock_page(page);
3662 + put_page(page);
3663 +
3664 +- if (ret) {
3665 +- /* split failed: leave it on the list */
3666 +- iput(inode);
3667 +- continue;
3668 +- }
3669 ++ /* If split failed leave the inode on the list */
3670 ++ if (ret)
3671 ++ goto leave;
3672 +
3673 + split++;
3674 + drop:
3675 + list_del_init(&info->shrinklist);
3676 + removed++;
3677 ++leave:
3678 + iput(inode);
3679 + }
3680 +
3681 +diff --git a/mm/vmscan.c b/mm/vmscan.c
3682 +index 47d5ced51f2d..503fa224c6b6 100644
3683 +--- a/mm/vmscan.c
3684 ++++ b/mm/vmscan.c
3685 +@@ -1846,6 +1846,20 @@ shrink_inactive_list(unsigned long nr_to_scan, struct lruvec *lruvec,
3686 + if (stat.nr_writeback && stat.nr_writeback == nr_taken)
3687 + set_bit(PGDAT_WRITEBACK, &pgdat->flags);
3688 +
3689 ++ /*
3690 ++ * If dirty pages are scanned that are not queued for IO, it
3691 ++ * implies that flushers are not doing their job. This can
3692 ++ * happen when memory pressure pushes dirty pages to the end of
3693 ++ * the LRU before the dirty limits are breached and the dirty
3694 ++ * data has expired. It can also happen when the proportion of
3695 ++ * dirty pages grows not through writes but through memory
3696 ++ * pressure reclaiming all the clean cache. And in some cases,
3697 ++ * the flushers simply cannot keep up with the allocation
3698 ++ * rate. Nudge the flusher threads in case they are asleep.
3699 ++ */
3700 ++ if (stat.nr_unqueued_dirty == nr_taken)
3701 ++ wakeup_flusher_threads(WB_REASON_VMSCAN);
3702 ++
3703 + /*
3704 + * Legacy memcg will stall in page writeback so avoid forcibly
3705 + * stalling here.
3706 +@@ -1858,22 +1872,9 @@ shrink_inactive_list(unsigned long nr_to_scan, struct lruvec *lruvec,
3707 + if (stat.nr_dirty && stat.nr_dirty == stat.nr_congested)
3708 + set_bit(PGDAT_CONGESTED, &pgdat->flags);
3709 +
3710 +- /*
3711 +- * If dirty pages are scanned that are not queued for IO, it
3712 +- * implies that flushers are not doing their job. This can
3713 +- * happen when memory pressure pushes dirty pages to the end of
3714 +- * the LRU before the dirty limits are breached and the dirty
3715 +- * data has expired. It can also happen when the proportion of
3716 +- * dirty pages grows not through writes but through memory
3717 +- * pressure reclaiming all the clean cache. And in some cases,
3718 +- * the flushers simply cannot keep up with the allocation
3719 +- * rate. Nudge the flusher threads in case they are asleep, but
3720 +- * also allow kswapd to start writing pages during reclaim.
3721 +- */
3722 +- if (stat.nr_unqueued_dirty == nr_taken) {
3723 +- wakeup_flusher_threads(WB_REASON_VMSCAN);
3724 ++ /* Allow kswapd to start writing pages during reclaim. */
3725 ++ if (stat.nr_unqueued_dirty == nr_taken)
3726 + set_bit(PGDAT_DIRTY, &pgdat->flags);
3727 +- }
3728 +
3729 + /*
3730 + * If kswapd scans pages marked marked for immediate
3731 +diff --git a/sound/drivers/aloop.c b/sound/drivers/aloop.c
3732 +index 0333143a1fa7..1063a4377502 100644
3733 +--- a/sound/drivers/aloop.c
3734 ++++ b/sound/drivers/aloop.c
3735 +@@ -192,6 +192,11 @@ static inline void loopback_timer_stop(struct loopback_pcm *dpcm)
3736 + dpcm->timer.expires = 0;
3737 + }
3738 +
3739 ++static inline void loopback_timer_stop_sync(struct loopback_pcm *dpcm)
3740 ++{
3741 ++ del_timer_sync(&dpcm->timer);
3742 ++}
3743 ++
3744 + #define CABLE_VALID_PLAYBACK (1 << SNDRV_PCM_STREAM_PLAYBACK)
3745 + #define CABLE_VALID_CAPTURE (1 << SNDRV_PCM_STREAM_CAPTURE)
3746 + #define CABLE_VALID_BOTH (CABLE_VALID_PLAYBACK|CABLE_VALID_CAPTURE)
3747 +@@ -326,6 +331,8 @@ static int loopback_prepare(struct snd_pcm_substream *substream)
3748 + struct loopback_cable *cable = dpcm->cable;
3749 + int bps, salign;
3750 +
3751 ++ loopback_timer_stop_sync(dpcm);
3752 ++
3753 + salign = (snd_pcm_format_width(runtime->format) *
3754 + runtime->channels) / 8;
3755 + bps = salign * runtime->rate;
3756 +@@ -659,7 +666,9 @@ static void free_cable(struct snd_pcm_substream *substream)
3757 + return;
3758 + if (cable->streams[!substream->stream]) {
3759 + /* other stream is still alive */
3760 ++ spin_lock_irq(&cable->lock);
3761 + cable->streams[substream->stream] = NULL;
3762 ++ spin_unlock_irq(&cable->lock);
3763 + } else {
3764 + /* free the cable */
3765 + loopback->cables[substream->number][dev] = NULL;
3766 +@@ -698,7 +707,6 @@ static int loopback_open(struct snd_pcm_substream *substream)
3767 + loopback->cables[substream->number][dev] = cable;
3768 + }
3769 + dpcm->cable = cable;
3770 +- cable->streams[substream->stream] = dpcm;
3771 +
3772 + snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS);
3773 +
3774 +@@ -730,6 +738,11 @@ static int loopback_open(struct snd_pcm_substream *substream)
3775 + runtime->hw = loopback_pcm_hardware;
3776 + else
3777 + runtime->hw = cable->hw;
3778 ++
3779 ++ spin_lock_irq(&cable->lock);
3780 ++ cable->streams[substream->stream] = dpcm;
3781 ++ spin_unlock_irq(&cable->lock);
3782 ++
3783 + unlock:
3784 + if (err < 0) {
3785 + free_cable(substream);
3786 +@@ -744,7 +757,7 @@ static int loopback_close(struct snd_pcm_substream *substream)
3787 + struct loopback *loopback = substream->private_data;
3788 + struct loopback_pcm *dpcm = substream->runtime->private_data;
3789 +
3790 +- loopback_timer_stop(dpcm);
3791 ++ loopback_timer_stop_sync(dpcm);
3792 + mutex_lock(&loopback->cable_lock);
3793 + free_cable(substream);
3794 + mutex_unlock(&loopback->cable_lock);
3795 +diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
3796 +index d5017adf9feb..c507c69029e3 100644
3797 +--- a/sound/pci/hda/hda_intel.c
3798 ++++ b/sound/pci/hda/hda_intel.c
3799 +@@ -375,6 +375,7 @@ enum {
3800 + ((pci)->device == 0x160c))
3801 +
3802 + #define IS_BXT(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0x5a98)
3803 ++#define IS_CFL(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0xa348)
3804 +
3805 + static char *driver_short_names[] = {
3806 + [AZX_DRIVER_ICH] = "HDA Intel",
3807 +@@ -1744,6 +1745,10 @@ static int azx_create(struct snd_card *card, struct pci_dev *pci,
3808 + else
3809 + chip->bdl_pos_adj = bdl_pos_adj[dev];
3810 +
3811 ++ /* Workaround for a communication error on CFL (bko#199007) */
3812 ++ if (IS_CFL(pci))
3813 ++ chip->polling_mode = 1;
3814 ++
3815 + err = azx_bus_init(chip, model[dev], &pci_hda_io_ops);
3816 + if (err < 0) {
3817 + kfree(hda);
3818 +diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
3819 +index 18bab5ffbe4a..206774703a33 100644
3820 +--- a/sound/pci/hda/patch_realtek.c
3821 ++++ b/sound/pci/hda/patch_realtek.c
3822 +@@ -3130,6 +3130,8 @@ static void alc256_init(struct hda_codec *codec)
3823 +
3824 + alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
3825 + alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
3826 ++ alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 1 << 15); /* Clear bit */
3827 ++ alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 0 << 15);
3828 + }
3829 +
3830 + static void alc256_shutup(struct hda_codec *codec)
3831 +@@ -3509,8 +3511,12 @@ static void alc269_fixup_mic_mute_hook(void *private_data, int enabled)
3832 + pinval = snd_hda_codec_get_pin_target(codec, spec->mute_led_nid);
3833 + pinval &= ~AC_PINCTL_VREFEN;
3834 + pinval |= enabled ? AC_PINCTL_VREF_HIZ : AC_PINCTL_VREF_80;
3835 +- if (spec->mute_led_nid)
3836 ++ if (spec->mute_led_nid) {
3837 ++ /* temporarily power up/down for setting VREF */
3838 ++ snd_hda_power_up_pm(codec);
3839 + snd_hda_set_pin_ctl_cache(codec, spec->mute_led_nid, pinval);
3840 ++ snd_hda_power_down_pm(codec);
3841 ++ }
3842 + }
3843 +
3844 + /* Make sure the led works even in runtime suspend */
3845 +@@ -5375,6 +5381,7 @@ enum {
3846 + ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
3847 + ALC298_FIXUP_TPT470_DOCK,
3848 + ALC255_FIXUP_DUMMY_LINEOUT_VERB,
3849 ++ ALC255_FIXUP_DELL_HEADSET_MIC,
3850 + };
3851 +
3852 + static const struct hda_fixup alc269_fixups[] = {
3853 +@@ -6235,6 +6242,13 @@ static const struct hda_fixup alc269_fixups[] = {
3854 + .chained = true,
3855 + .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
3856 + },
3857 ++ [ALC255_FIXUP_DELL_HEADSET_MIC] = {
3858 ++ .type = HDA_FIXUP_PINS,
3859 ++ .v.pins = (const struct hda_pintbl[]) {
3860 ++ { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
3861 ++ { }
3862 ++ },
3863 ++ },
3864 + };
3865 +
3866 + static const struct snd_pci_quirk alc269_fixup_tbl[] = {
3867 +@@ -6289,6 +6303,8 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
3868 + SND_PCI_QUIRK(0x1028, 0x082a, "Dell XPS 13 9360", ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE),
3869 + SND_PCI_QUIRK(0x1028, 0x084b, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
3870 + SND_PCI_QUIRK(0x1028, 0x084e, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
3871 ++ SND_PCI_QUIRK(0x1028, 0x0871, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
3872 ++ SND_PCI_QUIRK(0x1028, 0x0872, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
3873 + SND_PCI_QUIRK(0x1028, 0x0873, "Dell Precision 3930", ALC255_FIXUP_DUMMY_LINEOUT_VERB),
3874 + SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
3875 + SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
3876 +@@ -7032,6 +7048,8 @@ static int patch_alc269(struct hda_codec *codec)
3877 + break;
3878 + case 0x10ec0257:
3879 + spec->codec_variant = ALC269_TYPE_ALC257;
3880 ++ spec->shutup = alc256_shutup;
3881 ++ spec->init_hook = alc256_init;
3882 + spec->gen.mixer_nid = 0;
3883 + break;
3884 + case 0x10ec0215:
3885 +diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
3886 +index 59af5a8419e2..00be6e8c35a2 100644
3887 +--- a/tools/perf/builtin-stat.c
3888 ++++ b/tools/perf/builtin-stat.c
3889 +@@ -967,7 +967,7 @@ static void print_metric_csv(void *ctx,
3890 + char buf[64], *vals, *ends;
3891 +
3892 + if (unit == NULL || fmt == NULL) {
3893 +- fprintf(out, "%s%s%s%s", csv_sep, csv_sep, csv_sep, csv_sep);
3894 ++ fprintf(out, "%s%s", csv_sep, csv_sep);
3895 + return;
3896 + }
3897 + snprintf(buf, sizeof(buf), fmt, val);
3898 +diff --git a/tools/testing/selftests/x86/ptrace_syscall.c b/tools/testing/selftests/x86/ptrace_syscall.c
3899 +index 1ae1c5a7392e..6f22238f3217 100644
3900 +--- a/tools/testing/selftests/x86/ptrace_syscall.c
3901 ++++ b/tools/testing/selftests/x86/ptrace_syscall.c
3902 +@@ -183,8 +183,10 @@ static void test_ptrace_syscall_restart(void)
3903 + if (ptrace(PTRACE_TRACEME, 0, 0, 0) != 0)
3904 + err(1, "PTRACE_TRACEME");
3905 +
3906 ++ pid_t pid = getpid(), tid = syscall(SYS_gettid);
3907 ++
3908 + printf("\tChild will make one syscall\n");
3909 +- raise(SIGSTOP);
3910 ++ syscall(SYS_tgkill, pid, tid, SIGSTOP);
3911 +
3912 + syscall(SYS_gettid, 10, 11, 12, 13, 14, 15);
3913 + _exit(0);
3914 +@@ -301,9 +303,11 @@ static void test_restart_under_ptrace(void)
3915 + if (ptrace(PTRACE_TRACEME, 0, 0, 0) != 0)
3916 + err(1, "PTRACE_TRACEME");
3917 +
3918 ++ pid_t pid = getpid(), tid = syscall(SYS_gettid);
3919 ++
3920 + printf("\tChild will take a nap until signaled\n");
3921 + setsigign(SIGUSR1, SA_RESTART);
3922 +- raise(SIGSTOP);
3923 ++ syscall(SYS_tgkill, pid, tid, SIGSTOP);
3924 +
3925 + syscall(SYS_pause, 0, 0, 0, 0, 0, 0);
3926 + _exit(0);