Gentoo Archives: gentoo-commits

From: Mike Pagano <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/linux-patches:5.6 commit in: /
Date: Wed, 27 May 2020 16:32:31
Message-Id: 1590597136.4d328115ad37428d4e514eb35f786e11283b745d.mpagano@gentoo
1 commit: 4d328115ad37428d4e514eb35f786e11283b745d
2 Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
3 AuthorDate: Wed May 27 16:32:16 2020 +0000
4 Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
5 CommitDate: Wed May 27 16:32:16 2020 +0000
6 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=4d328115
7
8 Linux patch 5.6.15
9
10 Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org>
11
12 0000_README | 4 +-
13 1014_linux-5.6.15.patch | 4946 +++++++++++++++++++++++++++++++++++++++++++++++
14 2 files changed, 4948 insertions(+), 2 deletions(-)
15
16 diff --git a/0000_README b/0000_README
17 index 50aaa31..1c0ea04 100644
18 --- a/0000_README
19 +++ b/0000_README
20 @@ -99,9 +99,9 @@ Patch: 1013_linux-5.6.14.patch
21 From: http://www.kernel.org
22 Desc: Linux 5.6.14
23
24 -Patch: 1013_linux-5.6.14.patch
25 +Patch: 1014_linux-5.6.15.patch
26 From: http://www.kernel.org
27 -Desc: Linux 5.6.14
28 +Desc: Linux 5.6.15
29
30 Patch: 1500_XATTR_USER_PREFIX.patch
31 From: https://bugs.gentoo.org/show_bug.cgi?id=470644
32
33 diff --git a/1014_linux-5.6.15.patch b/1014_linux-5.6.15.patch
34 new file mode 100644
35 index 0000000..a62c0e3
36 --- /dev/null
37 +++ b/1014_linux-5.6.15.patch
38 @@ -0,0 +1,4946 @@
39 +diff --git a/Makefile b/Makefile
40 +index 713f93cceffe..3eca0c523098 100644
41 +--- a/Makefile
42 ++++ b/Makefile
43 +@@ -1,7 +1,7 @@
44 + # SPDX-License-Identifier: GPL-2.0
45 + VERSION = 5
46 + PATCHLEVEL = 6
47 +-SUBLEVEL = 14
48 ++SUBLEVEL = 15
49 + EXTRAVERSION =
50 + NAME = Kleptomaniac Octopus
51 +
52 +@@ -1248,11 +1248,15 @@ ifneq ($(dtstree),)
53 + $(Q)$(MAKE) $(build)=$(dtstree) $(dtstree)/$@
54 +
55 + PHONY += dtbs dtbs_install dtbs_check
56 +-dtbs dtbs_check: include/config/kernel.release scripts_dtc
57 ++dtbs: include/config/kernel.release scripts_dtc
58 + $(Q)$(MAKE) $(build)=$(dtstree)
59 +
60 ++ifneq ($(filter dtbs_check, $(MAKECMDGOALS)),)
61 ++dtbs: dt_binding_check
62 ++endif
63 ++
64 + dtbs_check: export CHECK_DTBS=1
65 +-dtbs_check: dt_binding_check
66 ++dtbs_check: dtbs
67 +
68 + dtbs_install:
69 + $(Q)$(MAKE) $(dtbinst)=$(dtstree)
70 +diff --git a/arch/arc/configs/hsdk_defconfig b/arch/arc/configs/hsdk_defconfig
71 +index 0974226fab55..aa000075a575 100644
72 +--- a/arch/arc/configs/hsdk_defconfig
73 ++++ b/arch/arc/configs/hsdk_defconfig
74 +@@ -65,6 +65,7 @@ CONFIG_DRM_UDL=y
75 + CONFIG_DRM_ETNAVIV=y
76 + CONFIG_FB=y
77 + CONFIG_FRAMEBUFFER_CONSOLE=y
78 ++CONFIG_USB=y
79 + CONFIG_USB_EHCI_HCD=y
80 + CONFIG_USB_EHCI_HCD_PLATFORM=y
81 + CONFIG_USB_OHCI_HCD=y
82 +diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
83 +index 97864aabc2a6..579f7eb6968a 100644
84 +--- a/arch/arm/Kconfig
85 ++++ b/arch/arm/Kconfig
86 +@@ -13,6 +13,7 @@ config ARM
87 + select ARCH_HAS_KEEPINITRD
88 + select ARCH_HAS_KCOV
89 + select ARCH_HAS_MEMBARRIER_SYNC_CORE
90 ++ select ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE
91 + select ARCH_HAS_PTE_SPECIAL if ARM_LPAE
92 + select ARCH_HAS_PHYS_TO_DMA
93 + select ARCH_HAS_SETUP_DMA_OPS
94 +diff --git a/arch/arm/include/asm/futex.h b/arch/arm/include/asm/futex.h
95 +index 83c391b597d4..fdc4ae3e7378 100644
96 +--- a/arch/arm/include/asm/futex.h
97 ++++ b/arch/arm/include/asm/futex.h
98 +@@ -164,8 +164,13 @@ arch_futex_atomic_op_inuser(int op, int oparg, int *oval, u32 __user *uaddr)
99 + preempt_enable();
100 + #endif
101 +
102 +- if (!ret)
103 +- *oval = oldval;
104 ++ /*
105 ++ * Store unconditionally. If ret != 0 the extra store is the least
106 ++ * of the worries but GCC cannot figure out that __futex_atomic_op()
107 ++ * is either setting ret to -EFAULT or storing the old value in
108 ++ * oldval which results in a uninitialized warning at the call site.
109 ++ */
110 ++ *oval = oldval;
111 +
112 + return ret;
113 + }
114 +diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
115 +index 0b30e884e088..84e1f0a43cdb 100644
116 +--- a/arch/arm64/Kconfig
117 ++++ b/arch/arm64/Kconfig
118 +@@ -21,6 +21,7 @@ config ARM64
119 + select ARCH_HAS_KCOV
120 + select ARCH_HAS_KEEPINITRD
121 + select ARCH_HAS_MEMBARRIER_SYNC_CORE
122 ++ select ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE
123 + select ARCH_HAS_PTE_DEVMAP
124 + select ARCH_HAS_PTE_SPECIAL
125 + select ARCH_HAS_SETUP_DMA_OPS
126 +diff --git a/arch/arm64/kernel/ptrace.c b/arch/arm64/kernel/ptrace.c
127 +index cd6e5fa48b9c..c30f77bd875f 100644
128 +--- a/arch/arm64/kernel/ptrace.c
129 ++++ b/arch/arm64/kernel/ptrace.c
130 +@@ -1829,10 +1829,11 @@ static void tracehook_report_syscall(struct pt_regs *regs,
131 +
132 + int syscall_trace_enter(struct pt_regs *regs)
133 + {
134 +- if (test_thread_flag(TIF_SYSCALL_TRACE) ||
135 +- test_thread_flag(TIF_SYSCALL_EMU)) {
136 ++ unsigned long flags = READ_ONCE(current_thread_info()->flags);
137 ++
138 ++ if (flags & (_TIF_SYSCALL_EMU | _TIF_SYSCALL_TRACE)) {
139 + tracehook_report_syscall(regs, PTRACE_SYSCALL_ENTER);
140 +- if (!in_syscall(regs) || test_thread_flag(TIF_SYSCALL_EMU))
141 ++ if (!in_syscall(regs) || (flags & _TIF_SYSCALL_EMU))
142 + return -1;
143 + }
144 +
145 +diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
146 +index 497b7d0b2d7e..b0fb42b0bf4b 100644
147 +--- a/arch/powerpc/Kconfig
148 ++++ b/arch/powerpc/Kconfig
149 +@@ -129,7 +129,7 @@ config PPC
150 + select ARCH_HAS_PTE_SPECIAL
151 + select ARCH_HAS_MEMBARRIER_CALLBACKS
152 + select ARCH_HAS_SCALED_CPUTIME if VIRT_CPU_ACCOUNTING_NATIVE && PPC_BOOK3S_64
153 +- select ARCH_HAS_STRICT_KERNEL_RWX if ((PPC_BOOK3S_64 || PPC32) && !HIBERNATION)
154 ++ select ARCH_HAS_STRICT_KERNEL_RWX if (PPC32 && !HIBERNATION)
155 + select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
156 + select ARCH_HAS_UACCESS_FLUSHCACHE
157 + select ARCH_HAS_UACCESS_MCSAFE if PPC64
158 +diff --git a/arch/s390/include/asm/pci_io.h b/arch/s390/include/asm/pci_io.h
159 +index cd060b5dd8fd..e4dc64cc9c55 100644
160 +--- a/arch/s390/include/asm/pci_io.h
161 ++++ b/arch/s390/include/asm/pci_io.h
162 +@@ -8,6 +8,10 @@
163 + #include <linux/slab.h>
164 + #include <asm/pci_insn.h>
165 +
166 ++/* I/O size constraints */
167 ++#define ZPCI_MAX_READ_SIZE 8
168 ++#define ZPCI_MAX_WRITE_SIZE 128
169 ++
170 + /* I/O Map */
171 + #define ZPCI_IOMAP_SHIFT 48
172 + #define ZPCI_IOMAP_ADDR_BASE 0x8000000000000000UL
173 +@@ -140,7 +144,8 @@ static inline int zpci_memcpy_fromio(void *dst,
174 +
175 + while (n > 0) {
176 + size = zpci_get_max_write_size((u64 __force) src,
177 +- (u64) dst, n, 8);
178 ++ (u64) dst, n,
179 ++ ZPCI_MAX_READ_SIZE);
180 + rc = zpci_read_single(dst, src, size);
181 + if (rc)
182 + break;
183 +@@ -161,7 +166,8 @@ static inline int zpci_memcpy_toio(volatile void __iomem *dst,
184 +
185 + while (n > 0) {
186 + size = zpci_get_max_write_size((u64 __force) dst,
187 +- (u64) src, n, 128);
188 ++ (u64) src, n,
189 ++ ZPCI_MAX_WRITE_SIZE);
190 + if (size > 8) /* main path */
191 + rc = zpci_write_block(dst, src, size);
192 + else
193 +diff --git a/arch/s390/kernel/machine_kexec_file.c b/arch/s390/kernel/machine_kexec_file.c
194 +index 8415ae7d2a23..f9e4baa64b67 100644
195 +--- a/arch/s390/kernel/machine_kexec_file.c
196 ++++ b/arch/s390/kernel/machine_kexec_file.c
197 +@@ -151,7 +151,7 @@ static int kexec_file_add_initrd(struct kimage *image,
198 + buf.mem += crashk_res.start;
199 + buf.memsz = buf.bufsz;
200 +
201 +- data->parm->initrd_start = buf.mem;
202 ++ data->parm->initrd_start = data->memsz;
203 + data->parm->initrd_size = buf.memsz;
204 + data->memsz += buf.memsz;
205 +
206 +diff --git a/arch/s390/kernel/machine_kexec_reloc.c b/arch/s390/kernel/machine_kexec_reloc.c
207 +index d5035de9020e..b7182cec48dc 100644
208 +--- a/arch/s390/kernel/machine_kexec_reloc.c
209 ++++ b/arch/s390/kernel/machine_kexec_reloc.c
210 +@@ -28,6 +28,7 @@ int arch_kexec_do_relocs(int r_type, void *loc, unsigned long val,
211 + break;
212 + case R_390_64: /* Direct 64 bit. */
213 + case R_390_GLOB_DAT:
214 ++ case R_390_JMP_SLOT:
215 + *(u64 *)loc = val;
216 + break;
217 + case R_390_PC16: /* PC relative 16 bit. */
218 +diff --git a/arch/s390/pci/pci_mmio.c b/arch/s390/pci/pci_mmio.c
219 +index 7d42a8794f10..020a2c514d96 100644
220 +--- a/arch/s390/pci/pci_mmio.c
221 ++++ b/arch/s390/pci/pci_mmio.c
222 +@@ -11,6 +11,113 @@
223 + #include <linux/mm.h>
224 + #include <linux/errno.h>
225 + #include <linux/pci.h>
226 ++#include <asm/pci_io.h>
227 ++#include <asm/pci_debug.h>
228 ++
229 ++static inline void zpci_err_mmio(u8 cc, u8 status, u64 offset)
230 ++{
231 ++ struct {
232 ++ u64 offset;
233 ++ u8 cc;
234 ++ u8 status;
235 ++ } data = {offset, cc, status};
236 ++
237 ++ zpci_err_hex(&data, sizeof(data));
238 ++}
239 ++
240 ++static inline int __pcistb_mio_inuser(
241 ++ void __iomem *ioaddr, const void __user *src,
242 ++ u64 len, u8 *status)
243 ++{
244 ++ int cc = -ENXIO;
245 ++
246 ++ asm volatile (
247 ++ " sacf 256\n"
248 ++ "0: .insn rsy,0xeb00000000d4,%[len],%[ioaddr],%[src]\n"
249 ++ "1: ipm %[cc]\n"
250 ++ " srl %[cc],28\n"
251 ++ "2: sacf 768\n"
252 ++ EX_TABLE(0b, 2b) EX_TABLE(1b, 2b)
253 ++ : [cc] "+d" (cc), [len] "+d" (len)
254 ++ : [ioaddr] "a" (ioaddr), [src] "Q" (*((u8 __force *)src))
255 ++ : "cc", "memory");
256 ++ *status = len >> 24 & 0xff;
257 ++ return cc;
258 ++}
259 ++
260 ++static inline int __pcistg_mio_inuser(
261 ++ void __iomem *ioaddr, const void __user *src,
262 ++ u64 ulen, u8 *status)
263 ++{
264 ++ register u64 addr asm("2") = (u64 __force) ioaddr;
265 ++ register u64 len asm("3") = ulen;
266 ++ int cc = -ENXIO;
267 ++ u64 val = 0;
268 ++ u64 cnt = ulen;
269 ++ u8 tmp;
270 ++
271 ++ /*
272 ++ * copy 0 < @len <= 8 bytes from @src into the right most bytes of
273 ++ * a register, then store it to PCI at @ioaddr while in secondary
274 ++ * address space. pcistg then uses the user mappings.
275 ++ */
276 ++ asm volatile (
277 ++ " sacf 256\n"
278 ++ "0: llgc %[tmp],0(%[src])\n"
279 ++ " sllg %[val],%[val],8\n"
280 ++ " aghi %[src],1\n"
281 ++ " ogr %[val],%[tmp]\n"
282 ++ " brctg %[cnt],0b\n"
283 ++ "1: .insn rre,0xb9d40000,%[val],%[ioaddr]\n"
284 ++ "2: ipm %[cc]\n"
285 ++ " srl %[cc],28\n"
286 ++ "3: sacf 768\n"
287 ++ EX_TABLE(0b, 3b) EX_TABLE(1b, 3b) EX_TABLE(2b, 3b)
288 ++ :
289 ++ [src] "+a" (src), [cnt] "+d" (cnt),
290 ++ [val] "+d" (val), [tmp] "=d" (tmp),
291 ++ [len] "+d" (len), [cc] "+d" (cc),
292 ++ [ioaddr] "+a" (addr)
293 ++ :: "cc", "memory");
294 ++ *status = len >> 24 & 0xff;
295 ++
296 ++ /* did we read everything from user memory? */
297 ++ if (!cc && cnt != 0)
298 ++ cc = -EFAULT;
299 ++
300 ++ return cc;
301 ++}
302 ++
303 ++static inline int __memcpy_toio_inuser(void __iomem *dst,
304 ++ const void __user *src, size_t n)
305 ++{
306 ++ int size, rc = 0;
307 ++ u8 status = 0;
308 ++ mm_segment_t old_fs;
309 ++
310 ++ if (!src)
311 ++ return -EINVAL;
312 ++
313 ++ old_fs = enable_sacf_uaccess();
314 ++ while (n > 0) {
315 ++ size = zpci_get_max_write_size((u64 __force) dst,
316 ++ (u64 __force) src, n,
317 ++ ZPCI_MAX_WRITE_SIZE);
318 ++ if (size > 8) /* main path */
319 ++ rc = __pcistb_mio_inuser(dst, src, size, &status);
320 ++ else
321 ++ rc = __pcistg_mio_inuser(dst, src, size, &status);
322 ++ if (rc)
323 ++ break;
324 ++ src += size;
325 ++ dst += size;
326 ++ n -= size;
327 ++ }
328 ++ disable_sacf_uaccess(old_fs);
329 ++ if (rc)
330 ++ zpci_err_mmio(rc, status, (__force u64) dst);
331 ++ return rc;
332 ++}
333 +
334 + static long get_pfn(unsigned long user_addr, unsigned long access,
335 + unsigned long *pfn)
336 +@@ -46,6 +153,20 @@ SYSCALL_DEFINE3(s390_pci_mmio_write, unsigned long, mmio_addr,
337 +
338 + if (length <= 0 || PAGE_SIZE - (mmio_addr & ~PAGE_MASK) < length)
339 + return -EINVAL;
340 ++
341 ++ /*
342 ++ * Only support read access to MIO capable devices on a MIO enabled
343 ++ * system. Otherwise we would have to check for every address if it is
344 ++ * a special ZPCI_ADDR and we would have to do a get_pfn() which we
345 ++ * don't need for MIO capable devices.
346 ++ */
347 ++ if (static_branch_likely(&have_mio)) {
348 ++ ret = __memcpy_toio_inuser((void __iomem *) mmio_addr,
349 ++ user_buffer,
350 ++ length);
351 ++ return ret;
352 ++ }
353 ++
354 + if (length > 64) {
355 + buf = kmalloc(length, GFP_KERNEL);
356 + if (!buf)
357 +@@ -56,7 +177,8 @@ SYSCALL_DEFINE3(s390_pci_mmio_write, unsigned long, mmio_addr,
358 + ret = get_pfn(mmio_addr, VM_WRITE, &pfn);
359 + if (ret)
360 + goto out;
361 +- io_addr = (void __iomem *)((pfn << PAGE_SHIFT) | (mmio_addr & ~PAGE_MASK));
362 ++ io_addr = (void __iomem *)((pfn << PAGE_SHIFT) |
363 ++ (mmio_addr & ~PAGE_MASK));
364 +
365 + ret = -EFAULT;
366 + if ((unsigned long) io_addr < ZPCI_IOMAP_ADDR_BASE)
367 +@@ -72,6 +194,78 @@ out:
368 + return ret;
369 + }
370 +
371 ++static inline int __pcilg_mio_inuser(
372 ++ void __user *dst, const void __iomem *ioaddr,
373 ++ u64 ulen, u8 *status)
374 ++{
375 ++ register u64 addr asm("2") = (u64 __force) ioaddr;
376 ++ register u64 len asm("3") = ulen;
377 ++ u64 cnt = ulen;
378 ++ int shift = ulen * 8;
379 ++ int cc = -ENXIO;
380 ++ u64 val, tmp;
381 ++
382 ++ /*
383 ++ * read 0 < @len <= 8 bytes from the PCI memory mapped at @ioaddr (in
384 ++ * user space) into a register using pcilg then store these bytes at
385 ++ * user address @dst
386 ++ */
387 ++ asm volatile (
388 ++ " sacf 256\n"
389 ++ "0: .insn rre,0xb9d60000,%[val],%[ioaddr]\n"
390 ++ "1: ipm %[cc]\n"
391 ++ " srl %[cc],28\n"
392 ++ " ltr %[cc],%[cc]\n"
393 ++ " jne 4f\n"
394 ++ "2: ahi %[shift],-8\n"
395 ++ " srlg %[tmp],%[val],0(%[shift])\n"
396 ++ "3: stc %[tmp],0(%[dst])\n"
397 ++ " aghi %[dst],1\n"
398 ++ " brctg %[cnt],2b\n"
399 ++ "4: sacf 768\n"
400 ++ EX_TABLE(0b, 4b) EX_TABLE(1b, 4b) EX_TABLE(3b, 4b)
401 ++ :
402 ++ [cc] "+d" (cc), [val] "=d" (val), [len] "+d" (len),
403 ++ [dst] "+a" (dst), [cnt] "+d" (cnt), [tmp] "=d" (tmp),
404 ++ [shift] "+d" (shift)
405 ++ :
406 ++ [ioaddr] "a" (addr)
407 ++ : "cc", "memory");
408 ++
409 ++ /* did we write everything to the user space buffer? */
410 ++ if (!cc && cnt != 0)
411 ++ cc = -EFAULT;
412 ++
413 ++ *status = len >> 24 & 0xff;
414 ++ return cc;
415 ++}
416 ++
417 ++static inline int __memcpy_fromio_inuser(void __user *dst,
418 ++ const void __iomem *src,
419 ++ unsigned long n)
420 ++{
421 ++ int size, rc = 0;
422 ++ u8 status;
423 ++ mm_segment_t old_fs;
424 ++
425 ++ old_fs = enable_sacf_uaccess();
426 ++ while (n > 0) {
427 ++ size = zpci_get_max_write_size((u64 __force) src,
428 ++ (u64 __force) dst, n,
429 ++ ZPCI_MAX_READ_SIZE);
430 ++ rc = __pcilg_mio_inuser(dst, src, size, &status);
431 ++ if (rc)
432 ++ break;
433 ++ src += size;
434 ++ dst += size;
435 ++ n -= size;
436 ++ }
437 ++ disable_sacf_uaccess(old_fs);
438 ++ if (rc)
439 ++ zpci_err_mmio(rc, status, (__force u64) dst);
440 ++ return rc;
441 ++}
442 ++
443 + SYSCALL_DEFINE3(s390_pci_mmio_read, unsigned long, mmio_addr,
444 + void __user *, user_buffer, size_t, length)
445 + {
446 +@@ -86,12 +280,27 @@ SYSCALL_DEFINE3(s390_pci_mmio_read, unsigned long, mmio_addr,
447 +
448 + if (length <= 0 || PAGE_SIZE - (mmio_addr & ~PAGE_MASK) < length)
449 + return -EINVAL;
450 ++
451 ++ /*
452 ++ * Only support write access to MIO capable devices on a MIO enabled
453 ++ * system. Otherwise we would have to check for every address if it is
454 ++ * a special ZPCI_ADDR and we would have to do a get_pfn() which we
455 ++ * don't need for MIO capable devices.
456 ++ */
457 ++ if (static_branch_likely(&have_mio)) {
458 ++ ret = __memcpy_fromio_inuser(
459 ++ user_buffer, (const void __iomem *)mmio_addr,
460 ++ length);
461 ++ return ret;
462 ++ }
463 ++
464 + if (length > 64) {
465 + buf = kmalloc(length, GFP_KERNEL);
466 + if (!buf)
467 + return -ENOMEM;
468 +- } else
469 ++ } else {
470 + buf = local_buf;
471 ++ }
472 +
473 + ret = get_pfn(mmio_addr, VM_READ, &pfn);
474 + if (ret)
475 +diff --git a/arch/sh/include/uapi/asm/sockios.h b/arch/sh/include/uapi/asm/sockios.h
476 +index 3da561453260..ef01ced9e169 100644
477 +--- a/arch/sh/include/uapi/asm/sockios.h
478 ++++ b/arch/sh/include/uapi/asm/sockios.h
479 +@@ -2,6 +2,8 @@
480 + #ifndef __ASM_SH_SOCKIOS_H
481 + #define __ASM_SH_SOCKIOS_H
482 +
483 ++#include <linux/time_types.h>
484 ++
485 + /* Socket-level I/O control calls. */
486 + #define FIOGETOWN _IOR('f', 123, int)
487 + #define FIOSETOWN _IOW('f', 124, int)
488 +diff --git a/arch/sparc/mm/srmmu.c b/arch/sparc/mm/srmmu.c
489 +index f56c3c9a9793..80061bc93bdc 100644
490 +--- a/arch/sparc/mm/srmmu.c
491 ++++ b/arch/sparc/mm/srmmu.c
492 +@@ -331,9 +331,9 @@ static void __init srmmu_nocache_init(void)
493 +
494 + while (vaddr < srmmu_nocache_end) {
495 + pgd = pgd_offset_k(vaddr);
496 +- p4d = p4d_offset(__nocache_fix(pgd), vaddr);
497 +- pud = pud_offset(__nocache_fix(p4d), vaddr);
498 +- pmd = pmd_offset(__nocache_fix(pgd), vaddr);
499 ++ p4d = p4d_offset(pgd, vaddr);
500 ++ pud = pud_offset(p4d, vaddr);
501 ++ pmd = pmd_offset(__nocache_fix(pud), vaddr);
502 + pte = pte_offset_kernel(__nocache_fix(pmd), vaddr);
503 +
504 + pteval = ((paddr >> 4) | SRMMU_ET_PTE | SRMMU_PRIV);
505 +diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
506 +index beea77046f9b..0bc9a74468be 100644
507 +--- a/arch/x86/Kconfig
508 ++++ b/arch/x86/Kconfig
509 +@@ -70,6 +70,7 @@ config X86
510 + select ARCH_HAS_KCOV if X86_64
511 + select ARCH_HAS_MEM_ENCRYPT
512 + select ARCH_HAS_MEMBARRIER_SYNC_CORE
513 ++ select ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE
514 + select ARCH_HAS_PMEM_API if X86_64
515 + select ARCH_HAS_PTE_DEVMAP if X86_64
516 + select ARCH_HAS_PTE_SPECIAL
517 +diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
518 +index 5f973fed3c9f..e289722b04f6 100644
519 +--- a/arch/x86/kernel/apic/apic.c
520 ++++ b/arch/x86/kernel/apic/apic.c
521 +@@ -352,8 +352,6 @@ static void __setup_APIC_LVTT(unsigned int clocks, int oneshot, int irqen)
522 + * According to Intel, MFENCE can do the serialization here.
523 + */
524 + asm volatile("mfence" : : : "memory");
525 +-
526 +- printk_once(KERN_DEBUG "TSC deadline timer enabled\n");
527 + return;
528 + }
529 +
530 +@@ -552,7 +550,7 @@ static DEFINE_PER_CPU(struct clock_event_device, lapic_events);
531 + #define DEADLINE_MODEL_MATCH_REV(model, rev) \
532 + { X86_VENDOR_INTEL, 6, model, X86_FEATURE_ANY, (unsigned long)rev }
533 +
534 +-static u32 hsx_deadline_rev(void)
535 ++static __init u32 hsx_deadline_rev(void)
536 + {
537 + switch (boot_cpu_data.x86_stepping) {
538 + case 0x02: return 0x3a; /* EP */
539 +@@ -562,7 +560,7 @@ static u32 hsx_deadline_rev(void)
540 + return ~0U;
541 + }
542 +
543 +-static u32 bdx_deadline_rev(void)
544 ++static __init u32 bdx_deadline_rev(void)
545 + {
546 + switch (boot_cpu_data.x86_stepping) {
547 + case 0x02: return 0x00000011;
548 +@@ -574,7 +572,7 @@ static u32 bdx_deadline_rev(void)
549 + return ~0U;
550 + }
551 +
552 +-static u32 skx_deadline_rev(void)
553 ++static __init u32 skx_deadline_rev(void)
554 + {
555 + switch (boot_cpu_data.x86_stepping) {
556 + case 0x03: return 0x01000136;
557 +@@ -587,7 +585,7 @@ static u32 skx_deadline_rev(void)
558 + return ~0U;
559 + }
560 +
561 +-static const struct x86_cpu_id deadline_match[] = {
562 ++static const struct x86_cpu_id deadline_match[] __initconst = {
563 + DEADLINE_MODEL_MATCH_FUNC( INTEL_FAM6_HASWELL_X, hsx_deadline_rev),
564 + DEADLINE_MODEL_MATCH_REV ( INTEL_FAM6_BROADWELL_X, 0x0b000020),
565 + DEADLINE_MODEL_MATCH_FUNC( INTEL_FAM6_BROADWELL_D, bdx_deadline_rev),
566 +@@ -609,18 +607,19 @@ static const struct x86_cpu_id deadline_match[] = {
567 + {},
568 + };
569 +
570 +-static void apic_check_deadline_errata(void)
571 ++static __init bool apic_validate_deadline_timer(void)
572 + {
573 + const struct x86_cpu_id *m;
574 + u32 rev;
575 +
576 +- if (!boot_cpu_has(X86_FEATURE_TSC_DEADLINE_TIMER) ||
577 +- boot_cpu_has(X86_FEATURE_HYPERVISOR))
578 +- return;
579 ++ if (!boot_cpu_has(X86_FEATURE_TSC_DEADLINE_TIMER))
580 ++ return false;
581 ++ if (boot_cpu_has(X86_FEATURE_HYPERVISOR))
582 ++ return true;
583 +
584 + m = x86_match_cpu(deadline_match);
585 + if (!m)
586 +- return;
587 ++ return true;
588 +
589 + /*
590 + * Function pointers will have the MSB set due to address layout,
591 +@@ -632,11 +631,12 @@ static void apic_check_deadline_errata(void)
592 + rev = (u32)m->driver_data;
593 +
594 + if (boot_cpu_data.microcode >= rev)
595 +- return;
596 ++ return true;
597 +
598 + setup_clear_cpu_cap(X86_FEATURE_TSC_DEADLINE_TIMER);
599 + pr_err(FW_BUG "TSC_DEADLINE disabled due to Errata; "
600 + "please update microcode to version: 0x%x (or later)\n", rev);
601 ++ return false;
602 + }
603 +
604 + /*
605 +@@ -2098,7 +2098,8 @@ void __init init_apic_mappings(void)
606 + {
607 + unsigned int new_apicid;
608 +
609 +- apic_check_deadline_errata();
610 ++ if (apic_validate_deadline_timer())
611 ++ pr_debug("TSC deadline timer available\n");
612 +
613 + if (x2apic_mode) {
614 + boot_cpu_physical_apicid = read_apic_id();
615 +diff --git a/arch/x86/kernel/unwind_orc.c b/arch/x86/kernel/unwind_orc.c
616 +index 9414f02a55ea..1a90abeca5f3 100644
617 +--- a/arch/x86/kernel/unwind_orc.c
618 ++++ b/arch/x86/kernel/unwind_orc.c
619 +@@ -314,12 +314,19 @@ EXPORT_SYMBOL_GPL(unwind_get_return_address);
620 +
621 + unsigned long *unwind_get_return_address_ptr(struct unwind_state *state)
622 + {
623 ++ struct task_struct *task = state->task;
624 ++
625 + if (unwind_done(state))
626 + return NULL;
627 +
628 + if (state->regs)
629 + return &state->regs->ip;
630 +
631 ++ if (task != current && state->sp == task->thread.sp) {
632 ++ struct inactive_task_frame *frame = (void *)task->thread.sp;
633 ++ return &frame->ret_addr;
634 ++ }
635 ++
636 + if (state->sp)
637 + return (unsigned long *)state->sp - 1;
638 +
639 +diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
640 +index 03b3067811c9..2713ddb3348c 100644
641 +--- a/drivers/acpi/ec.c
642 ++++ b/drivers/acpi/ec.c
643 +@@ -2064,9 +2064,13 @@ bool acpi_ec_dispatch_gpe(void)
644 + * to allow the caller to process events properly after that.
645 + */
646 + ret = acpi_dispatch_gpe(NULL, first_ec->gpe);
647 +- if (ret == ACPI_INTERRUPT_HANDLED)
648 ++ if (ret == ACPI_INTERRUPT_HANDLED) {
649 + pm_pr_dbg("EC GPE dispatched\n");
650 +
651 ++ /* Flush the event and query workqueues. */
652 ++ acpi_ec_flush_work();
653 ++ }
654 ++
655 + return false;
656 + }
657 + #endif /* CONFIG_PM_SLEEP */
658 +diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c
659 +index 3850704570c0..fd9d4e8318e9 100644
660 +--- a/drivers/acpi/sleep.c
661 ++++ b/drivers/acpi/sleep.c
662 +@@ -980,13 +980,6 @@ static int acpi_s2idle_prepare_late(void)
663 + return 0;
664 + }
665 +
666 +-static void acpi_s2idle_sync(void)
667 +-{
668 +- /* The EC driver uses special workqueues that need to be flushed. */
669 +- acpi_ec_flush_work();
670 +- acpi_os_wait_events_complete(); /* synchronize Notify handling */
671 +-}
672 +-
673 + static bool acpi_s2idle_wake(void)
674 + {
675 + if (!acpi_sci_irq_valid())
676 +@@ -1018,7 +1011,7 @@ static bool acpi_s2idle_wake(void)
677 + return true;
678 +
679 + /*
680 +- * Cancel the wakeup and process all pending events in case
681 ++ * Cancel the SCI wakeup and process all pending events in case
682 + * there are any wakeup ones in there.
683 + *
684 + * Note that if any non-EC GPEs are active at this point, the
685 +@@ -1026,8 +1019,7 @@ static bool acpi_s2idle_wake(void)
686 + * should be missed by canceling the wakeup here.
687 + */
688 + pm_system_cancel_wakeup();
689 +-
690 +- acpi_s2idle_sync();
691 ++ acpi_os_wait_events_complete();
692 +
693 + /*
694 + * The SCI is in the "suspended" state now and it cannot produce
695 +@@ -1060,7 +1052,8 @@ static void acpi_s2idle_restore(void)
696 + * of GPEs.
697 + */
698 + acpi_os_wait_events_complete(); /* synchronize GPE processing */
699 +- acpi_s2idle_sync();
700 ++ acpi_ec_flush_work(); /* flush the EC driver's workqueues */
701 ++ acpi_os_wait_events_complete(); /* synchronize Notify handling */
702 +
703 + s2idle_wakeup = false;
704 +
705 +diff --git a/drivers/base/component.c b/drivers/base/component.c
706 +index c7879f5ae2fb..53b19daca750 100644
707 +--- a/drivers/base/component.c
708 ++++ b/drivers/base/component.c
709 +@@ -256,7 +256,8 @@ static int try_to_bring_up_master(struct master *master,
710 + ret = master->ops->bind(master->dev);
711 + if (ret < 0) {
712 + devres_release_group(master->dev, NULL);
713 +- dev_info(master->dev, "master bind failed: %d\n", ret);
714 ++ if (ret != -EPROBE_DEFER)
715 ++ dev_info(master->dev, "master bind failed: %d\n", ret);
716 + return ret;
717 + }
718 +
719 +@@ -610,8 +611,9 @@ static int component_bind(struct component *component, struct master *master,
720 + devres_release_group(component->dev, NULL);
721 + devres_release_group(master->dev, NULL);
722 +
723 +- dev_err(master->dev, "failed to bind %s (ops %ps): %d\n",
724 +- dev_name(component->dev), component->ops, ret);
725 ++ if (ret != -EPROBE_DEFER)
726 ++ dev_err(master->dev, "failed to bind %s (ops %ps): %d\n",
727 ++ dev_name(component->dev), component->ops, ret);
728 + }
729 +
730 + return ret;
731 +diff --git a/drivers/base/core.c b/drivers/base/core.c
732 +index d32a3aefff32..68277687c160 100644
733 +--- a/drivers/base/core.c
734 ++++ b/drivers/base/core.c
735 +@@ -365,6 +365,7 @@ struct device_link *device_link_add(struct device *consumer,
736 + link->flags |= DL_FLAG_STATELESS;
737 + goto reorder;
738 + } else {
739 ++ link->flags |= DL_FLAG_STATELESS;
740 + goto out;
741 + }
742 + }
743 +@@ -433,12 +434,16 @@ struct device_link *device_link_add(struct device *consumer,
744 + flags & DL_FLAG_PM_RUNTIME)
745 + pm_runtime_resume(supplier);
746 +
747 ++ list_add_tail_rcu(&link->s_node, &supplier->links.consumers);
748 ++ list_add_tail_rcu(&link->c_node, &consumer->links.suppliers);
749 ++
750 + if (flags & DL_FLAG_SYNC_STATE_ONLY) {
751 + dev_dbg(consumer,
752 + "Linked as a sync state only consumer to %s\n",
753 + dev_name(supplier));
754 + goto out;
755 + }
756 ++
757 + reorder:
758 + /*
759 + * Move the consumer and all of the devices depending on it to the end
760 +@@ -449,12 +454,9 @@ reorder:
761 + */
762 + device_reorder_to_tail(consumer, NULL);
763 +
764 +- list_add_tail_rcu(&link->s_node, &supplier->links.consumers);
765 +- list_add_tail_rcu(&link->c_node, &consumer->links.suppliers);
766 +-
767 + dev_dbg(consumer, "Linked as a consumer to %s\n", dev_name(supplier));
768 +
769 +- out:
770 ++out:
771 + device_pm_unlock();
772 + device_links_write_unlock();
773 +
774 +@@ -829,6 +831,13 @@ static void __device_links_supplier_defer_sync(struct device *sup)
775 + list_add_tail(&sup->links.defer_sync, &deferred_sync);
776 + }
777 +
778 ++static void device_link_drop_managed(struct device_link *link)
779 ++{
780 ++ link->flags &= ~DL_FLAG_MANAGED;
781 ++ WRITE_ONCE(link->status, DL_STATE_NONE);
782 ++ kref_put(&link->kref, __device_link_del);
783 ++}
784 ++
785 + /**
786 + * device_links_driver_bound - Update device links after probing its driver.
787 + * @dev: Device to update the links for.
788 +@@ -842,7 +851,7 @@ static void __device_links_supplier_defer_sync(struct device *sup)
789 + */
790 + void device_links_driver_bound(struct device *dev)
791 + {
792 +- struct device_link *link;
793 ++ struct device_link *link, *ln;
794 + LIST_HEAD(sync_list);
795 +
796 + /*
797 +@@ -882,18 +891,35 @@ void device_links_driver_bound(struct device *dev)
798 + else
799 + __device_links_queue_sync_state(dev, &sync_list);
800 +
801 +- list_for_each_entry(link, &dev->links.suppliers, c_node) {
802 ++ list_for_each_entry_safe(link, ln, &dev->links.suppliers, c_node) {
803 ++ struct device *supplier;
804 ++
805 + if (!(link->flags & DL_FLAG_MANAGED))
806 + continue;
807 +
808 +- WARN_ON(link->status != DL_STATE_CONSUMER_PROBE);
809 +- WRITE_ONCE(link->status, DL_STATE_ACTIVE);
810 ++ supplier = link->supplier;
811 ++ if (link->flags & DL_FLAG_SYNC_STATE_ONLY) {
812 ++ /*
813 ++ * When DL_FLAG_SYNC_STATE_ONLY is set, it means no
814 ++ * other DL_MANAGED_LINK_FLAGS have been set. So, it's
815 ++ * save to drop the managed link completely.
816 ++ */
817 ++ device_link_drop_managed(link);
818 ++ } else {
819 ++ WARN_ON(link->status != DL_STATE_CONSUMER_PROBE);
820 ++ WRITE_ONCE(link->status, DL_STATE_ACTIVE);
821 ++ }
822 +
823 ++ /*
824 ++ * This needs to be done even for the deleted
825 ++ * DL_FLAG_SYNC_STATE_ONLY device link in case it was the last
826 ++ * device link that was preventing the supplier from getting a
827 ++ * sync_state() call.
828 ++ */
829 + if (defer_sync_state_count)
830 +- __device_links_supplier_defer_sync(link->supplier);
831 ++ __device_links_supplier_defer_sync(supplier);
832 + else
833 +- __device_links_queue_sync_state(link->supplier,
834 +- &sync_list);
835 ++ __device_links_queue_sync_state(supplier, &sync_list);
836 + }
837 +
838 + dev->links.status = DL_DEV_DRIVER_BOUND;
839 +@@ -903,13 +929,6 @@ void device_links_driver_bound(struct device *dev)
840 + device_links_flush_sync_list(&sync_list, dev);
841 + }
842 +
843 +-static void device_link_drop_managed(struct device_link *link)
844 +-{
845 +- link->flags &= ~DL_FLAG_MANAGED;
846 +- WRITE_ONCE(link->status, DL_STATE_NONE);
847 +- kref_put(&link->kref, __device_link_del);
848 +-}
849 +-
850 + /**
851 + * __device_links_no_driver - Update links of a device without a driver.
852 + * @dev: Device without a drvier.
853 +diff --git a/drivers/base/platform.c b/drivers/base/platform.c
854 +index c81b68d5d66d..b5ce7b085795 100644
855 +--- a/drivers/base/platform.c
856 ++++ b/drivers/base/platform.c
857 +@@ -361,8 +361,6 @@ struct platform_object {
858 + */
859 + static void setup_pdev_dma_masks(struct platform_device *pdev)
860 + {
861 +- pdev->dev.dma_parms = &pdev->dma_parms;
862 +-
863 + if (!pdev->dev.coherent_dma_mask)
864 + pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
865 + if (!pdev->dev.dma_mask) {
866 +diff --git a/drivers/dax/kmem.c b/drivers/dax/kmem.c
867 +index 3d0a7e702c94..1e678bdf5aed 100644
868 +--- a/drivers/dax/kmem.c
869 ++++ b/drivers/dax/kmem.c
870 +@@ -22,6 +22,7 @@ int dev_dax_kmem_probe(struct device *dev)
871 + resource_size_t kmem_size;
872 + resource_size_t kmem_end;
873 + struct resource *new_res;
874 ++ const char *new_res_name;
875 + int numa_node;
876 + int rc;
877 +
878 +@@ -48,11 +49,16 @@ int dev_dax_kmem_probe(struct device *dev)
879 + kmem_size &= ~(memory_block_size_bytes() - 1);
880 + kmem_end = kmem_start + kmem_size;
881 +
882 +- /* Region is permanently reserved. Hot-remove not yet implemented. */
883 +- new_res = request_mem_region(kmem_start, kmem_size, dev_name(dev));
884 ++ new_res_name = kstrdup(dev_name(dev), GFP_KERNEL);
885 ++ if (!new_res_name)
886 ++ return -ENOMEM;
887 ++
888 ++ /* Region is permanently reserved if hotremove fails. */
889 ++ new_res = request_mem_region(kmem_start, kmem_size, new_res_name);
890 + if (!new_res) {
891 + dev_warn(dev, "could not reserve region [%pa-%pa]\n",
892 + &kmem_start, &kmem_end);
893 ++ kfree(new_res_name);
894 + return -EBUSY;
895 + }
896 +
897 +@@ -63,12 +69,12 @@ int dev_dax_kmem_probe(struct device *dev)
898 + * unknown to us that will break add_memory() below.
899 + */
900 + new_res->flags = IORESOURCE_SYSTEM_RAM;
901 +- new_res->name = dev_name(dev);
902 +
903 + rc = add_memory(numa_node, new_res->start, resource_size(new_res));
904 + if (rc) {
905 + release_resource(new_res);
906 + kfree(new_res);
907 ++ kfree(new_res_name);
908 + return rc;
909 + }
910 + dev_dax->dax_kmem_res = new_res;
911 +@@ -83,6 +89,7 @@ static int dev_dax_kmem_remove(struct device *dev)
912 + struct resource *res = dev_dax->dax_kmem_res;
913 + resource_size_t kmem_start = res->start;
914 + resource_size_t kmem_size = resource_size(res);
915 ++ const char *res_name = res->name;
916 + int rc;
917 +
918 + /*
919 +@@ -102,6 +109,7 @@ static int dev_dax_kmem_remove(struct device *dev)
920 + /* Release and free dax resources */
921 + release_resource(res);
922 + kfree(res);
923 ++ kfree(res_name);
924 + dev_dax->dax_kmem_res = NULL;
925 +
926 + return 0;
927 +diff --git a/drivers/dma/dmatest.c b/drivers/dma/dmatest.c
928 +index 364dd34799d4..0425984db118 100644
929 +--- a/drivers/dma/dmatest.c
930 ++++ b/drivers/dma/dmatest.c
931 +@@ -1166,10 +1166,11 @@ static int dmatest_run_set(const char *val, const struct kernel_param *kp)
932 + mutex_unlock(&info->lock);
933 + return ret;
934 + } else if (dmatest_run) {
935 +- if (is_threaded_test_pending(info))
936 +- start_threaded_tests(info);
937 +- else
938 +- pr_info("Could not start test, no channels configured\n");
939 ++ if (!is_threaded_test_pending(info)) {
940 ++ pr_info("No channels configured, continue with any\n");
941 ++ add_threaded_test(info);
942 ++ }
943 ++ start_threaded_tests(info);
944 + } else {
945 + stop_threaded_test(info);
946 + }
947 +diff --git a/drivers/dma/idxd/device.c b/drivers/dma/idxd/device.c
948 +index f6f49f0f6fae..8d79a8787104 100644
949 +--- a/drivers/dma/idxd/device.c
950 ++++ b/drivers/dma/idxd/device.c
951 +@@ -62,6 +62,13 @@ int idxd_unmask_msix_vector(struct idxd_device *idxd, int vec_id)
952 + perm.ignore = 0;
953 + iowrite32(perm.bits, idxd->reg_base + offset);
954 +
955 ++ /*
956 ++ * A readback from the device ensures that any previously generated
957 ++ * completion record writes are visible to software based on PCI
958 ++ * ordering rules.
959 ++ */
960 ++ perm.bits = ioread32(idxd->reg_base + offset);
961 ++
962 + return 0;
963 + }
964 +
965 +diff --git a/drivers/dma/idxd/irq.c b/drivers/dma/idxd/irq.c
966 +index d6fcd2e60103..6510791b9921 100644
967 +--- a/drivers/dma/idxd/irq.c
968 ++++ b/drivers/dma/idxd/irq.c
969 +@@ -173,6 +173,7 @@ static int irq_process_pending_llist(struct idxd_irq_entry *irq_entry,
970 + struct llist_node *head;
971 + int queued = 0;
972 +
973 ++ *processed = 0;
974 + head = llist_del_all(&irq_entry->pending_llist);
975 + if (!head)
976 + return 0;
977 +@@ -197,6 +198,7 @@ static int irq_process_work_list(struct idxd_irq_entry *irq_entry,
978 + struct list_head *node, *next;
979 + int queued = 0;
980 +
981 ++ *processed = 0;
982 + if (list_empty(&irq_entry->work_list))
983 + return 0;
984 +
985 +@@ -218,10 +220,9 @@ static int irq_process_work_list(struct idxd_irq_entry *irq_entry,
986 + return queued;
987 + }
988 +
989 +-irqreturn_t idxd_wq_thread(int irq, void *data)
990 ++static int idxd_desc_process(struct idxd_irq_entry *irq_entry)
991 + {
992 +- struct idxd_irq_entry *irq_entry = data;
993 +- int rc, processed = 0, retry = 0;
994 ++ int rc, processed, total = 0;
995 +
996 + /*
997 + * There are two lists we are processing. The pending_llist is where
998 +@@ -244,15 +245,26 @@ irqreturn_t idxd_wq_thread(int irq, void *data)
999 + */
1000 + do {
1001 + rc = irq_process_work_list(irq_entry, &processed);
1002 +- if (rc != 0) {
1003 +- retry++;
1004 ++ total += processed;
1005 ++ if (rc != 0)
1006 + continue;
1007 +- }
1008 +
1009 + rc = irq_process_pending_llist(irq_entry, &processed);
1010 +- } while (rc != 0 && retry != 10);
1011 ++ total += processed;
1012 ++ } while (rc != 0);
1013 ++
1014 ++ return total;
1015 ++}
1016 ++
1017 ++irqreturn_t idxd_wq_thread(int irq, void *data)
1018 ++{
1019 ++ struct idxd_irq_entry *irq_entry = data;
1020 ++ int processed;
1021 +
1022 ++ processed = idxd_desc_process(irq_entry);
1023 + idxd_unmask_msix_vector(irq_entry->idxd, irq_entry->id);
1024 ++ /* catch anything unprocessed after unmasking */
1025 ++ processed += idxd_desc_process(irq_entry);
1026 +
1027 + if (processed == 0)
1028 + return IRQ_NONE;
1029 +diff --git a/drivers/dma/owl-dma.c b/drivers/dma/owl-dma.c
1030 +index c683051257fd..66ef70b00ec0 100644
1031 +--- a/drivers/dma/owl-dma.c
1032 ++++ b/drivers/dma/owl-dma.c
1033 +@@ -175,13 +175,11 @@ struct owl_dma_txd {
1034 + * @id: physical index to this channel
1035 + * @base: virtual memory base for the dma channel
1036 + * @vchan: the virtual channel currently being served by this physical channel
1037 +- * @lock: a lock to use when altering an instance of this struct
1038 + */
1039 + struct owl_dma_pchan {
1040 + u32 id;
1041 + void __iomem *base;
1042 + struct owl_dma_vchan *vchan;
1043 +- spinlock_t lock;
1044 + };
1045 +
1046 + /**
1047 +@@ -437,14 +435,14 @@ static struct owl_dma_pchan *owl_dma_get_pchan(struct owl_dma *od,
1048 + for (i = 0; i < od->nr_pchans; i++) {
1049 + pchan = &od->pchans[i];
1050 +
1051 +- spin_lock_irqsave(&pchan->lock, flags);
1052 ++ spin_lock_irqsave(&od->lock, flags);
1053 + if (!pchan->vchan) {
1054 + pchan->vchan = vchan;
1055 +- spin_unlock_irqrestore(&pchan->lock, flags);
1056 ++ spin_unlock_irqrestore(&od->lock, flags);
1057 + break;
1058 + }
1059 +
1060 +- spin_unlock_irqrestore(&pchan->lock, flags);
1061 ++ spin_unlock_irqrestore(&od->lock, flags);
1062 + }
1063 +
1064 + return pchan;
1065 +diff --git a/drivers/dma/tegra210-adma.c b/drivers/dma/tegra210-adma.c
1066 +index 6e1268552f74..914901a680c8 100644
1067 +--- a/drivers/dma/tegra210-adma.c
1068 ++++ b/drivers/dma/tegra210-adma.c
1069 +@@ -900,7 +900,7 @@ static int tegra_adma_probe(struct platform_device *pdev)
1070 + ret = dma_async_device_register(&tdma->dma_dev);
1071 + if (ret < 0) {
1072 + dev_err(&pdev->dev, "ADMA registration failed: %d\n", ret);
1073 +- goto irq_dispose;
1074 ++ goto rpm_put;
1075 + }
1076 +
1077 + ret = of_dma_controller_register(pdev->dev.of_node,
1078 +diff --git a/drivers/firmware/efi/libstub/tpm.c b/drivers/firmware/efi/libstub/tpm.c
1079 +index 1d59e103a2e3..e9a684637b70 100644
1080 +--- a/drivers/firmware/efi/libstub/tpm.c
1081 ++++ b/drivers/firmware/efi/libstub/tpm.c
1082 +@@ -54,7 +54,7 @@ void efi_retrieve_tpm2_eventlog(void)
1083 + efi_status_t status;
1084 + efi_physical_addr_t log_location = 0, log_last_entry = 0;
1085 + struct linux_efi_tpm_eventlog *log_tbl = NULL;
1086 +- struct efi_tcg2_final_events_table *final_events_table;
1087 ++ struct efi_tcg2_final_events_table *final_events_table = NULL;
1088 + unsigned long first_entry_addr, last_entry_addr;
1089 + size_t log_size, last_entry_size;
1090 + efi_bool_t truncated;
1091 +@@ -127,7 +127,8 @@ void efi_retrieve_tpm2_eventlog(void)
1092 + * Figure out whether any events have already been logged to the
1093 + * final events structure, and if so how much space they take up
1094 + */
1095 +- final_events_table = get_efi_config_table(LINUX_EFI_TPM_FINAL_LOG_GUID);
1096 ++ if (version == EFI_TCG2_EVENT_LOG_FORMAT_TCG_2)
1097 ++ final_events_table = get_efi_config_table(LINUX_EFI_TPM_FINAL_LOG_GUID);
1098 + if (final_events_table && final_events_table->nr_events) {
1099 + struct tcg_pcr_event2_head *header;
1100 + int offset;
1101 +diff --git a/drivers/firmware/efi/tpm.c b/drivers/firmware/efi/tpm.c
1102 +index 55b031d2c989..c1955d320fec 100644
1103 +--- a/drivers/firmware/efi/tpm.c
1104 ++++ b/drivers/firmware/efi/tpm.c
1105 +@@ -62,8 +62,11 @@ int __init efi_tpm_eventlog_init(void)
1106 + tbl_size = sizeof(*log_tbl) + log_tbl->size;
1107 + memblock_reserve(efi.tpm_log, tbl_size);
1108 +
1109 +- if (efi.tpm_final_log == EFI_INVALID_TABLE_ADDR)
1110 ++ if (efi.tpm_final_log == EFI_INVALID_TABLE_ADDR ||
1111 ++ log_tbl->version != EFI_TCG2_EVENT_LOG_FORMAT_TCG_2) {
1112 ++ pr_warn(FW_BUG "TPM Final Events table missing or invalid\n");
1113 + goto out;
1114 ++ }
1115 +
1116 + final_tbl = early_memremap(efi.tpm_final_log, sizeof(*final_tbl));
1117 +
1118 +diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
1119 +index 5e27a67fbc58..0cd11d3d4cf4 100644
1120 +--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
1121 ++++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
1122 +@@ -1941,17 +1941,22 @@ amdgpu_dm_update_connector_after_detect(struct amdgpu_dm_connector *aconnector)
1123 + dc_sink_retain(aconnector->dc_sink);
1124 + if (sink->dc_edid.length == 0) {
1125 + aconnector->edid = NULL;
1126 +- drm_dp_cec_unset_edid(&aconnector->dm_dp_aux.aux);
1127 ++ if (aconnector->dc_link->aux_mode) {
1128 ++ drm_dp_cec_unset_edid(
1129 ++ &aconnector->dm_dp_aux.aux);
1130 ++ }
1131 + } else {
1132 + aconnector->edid =
1133 +- (struct edid *) sink->dc_edid.raw_edid;
1134 +-
1135 ++ (struct edid *)sink->dc_edid.raw_edid;
1136 +
1137 + drm_connector_update_edid_property(connector,
1138 +- aconnector->edid);
1139 +- drm_dp_cec_set_edid(&aconnector->dm_dp_aux.aux,
1140 +- aconnector->edid);
1141 ++ aconnector->edid);
1142 ++
1143 ++ if (aconnector->dc_link->aux_mode)
1144 ++ drm_dp_cec_set_edid(&aconnector->dm_dp_aux.aux,
1145 ++ aconnector->edid);
1146 + }
1147 ++
1148 + amdgpu_dm_update_freesync_caps(connector, aconnector->edid);
1149 +
1150 + } else {
1151 +diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c b/drivers/gpu/drm/amd/display/dc/core/dc.c
1152 +index 188e51600070..b3987124183a 100644
1153 +--- a/drivers/gpu/drm/amd/display/dc/core/dc.c
1154 ++++ b/drivers/gpu/drm/amd/display/dc/core/dc.c
1155 +@@ -803,11 +803,10 @@ static void disable_dangling_plane(struct dc *dc, struct dc_state *context)
1156 + static void wait_for_no_pipes_pending(struct dc *dc, struct dc_state *context)
1157 + {
1158 + int i;
1159 +- int count = 0;
1160 +- struct pipe_ctx *pipe;
1161 + PERF_TRACE();
1162 + for (i = 0; i < MAX_PIPES; i++) {
1163 +- pipe = &context->res_ctx.pipe_ctx[i];
1164 ++ int count = 0;
1165 ++ struct pipe_ctx *pipe = &context->res_ctx.pipe_ctx[i];
1166 +
1167 + if (!pipe->plane_state)
1168 + continue;
1169 +diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c b/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c
1170 +index 3b0afa156d92..54def341c1db 100644
1171 +--- a/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c
1172 ++++ b/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c
1173 +@@ -238,8 +238,10 @@ static int submit_pin_objects(struct etnaviv_gem_submit *submit)
1174 + }
1175 +
1176 + if ((submit->flags & ETNA_SUBMIT_SOFTPIN) &&
1177 +- submit->bos[i].va != mapping->iova)
1178 ++ submit->bos[i].va != mapping->iova) {
1179 ++ etnaviv_gem_mapping_unreference(mapping);
1180 + return -EINVAL;
1181 ++ }
1182 +
1183 + atomic_inc(&etnaviv_obj->gpu_active);
1184 +
1185 +diff --git a/drivers/gpu/drm/etnaviv/etnaviv_perfmon.c b/drivers/gpu/drm/etnaviv/etnaviv_perfmon.c
1186 +index e6795bafcbb9..75f9db8f7bec 100644
1187 +--- a/drivers/gpu/drm/etnaviv/etnaviv_perfmon.c
1188 ++++ b/drivers/gpu/drm/etnaviv/etnaviv_perfmon.c
1189 +@@ -453,7 +453,7 @@ static const struct etnaviv_pm_domain *pm_domain(const struct etnaviv_gpu *gpu,
1190 + if (!(gpu->identity.features & meta->feature))
1191 + continue;
1192 +
1193 +- if (meta->nr_domains < (index - offset)) {
1194 ++ if (index - offset >= meta->nr_domains) {
1195 + offset += meta->nr_domains;
1196 + continue;
1197 + }
1198 +diff --git a/drivers/gpu/drm/i915/gvt/display.c b/drivers/gpu/drm/i915/gvt/display.c
1199 +index a62bdf9be682..59aa5e64acb0 100644
1200 +--- a/drivers/gpu/drm/i915/gvt/display.c
1201 ++++ b/drivers/gpu/drm/i915/gvt/display.c
1202 +@@ -207,14 +207,41 @@ static void emulate_monitor_status_change(struct intel_vgpu *vgpu)
1203 + SKL_FUSE_PG_DIST_STATUS(SKL_PG0) |
1204 + SKL_FUSE_PG_DIST_STATUS(SKL_PG1) |
1205 + SKL_FUSE_PG_DIST_STATUS(SKL_PG2);
1206 +- vgpu_vreg_t(vgpu, LCPLL1_CTL) |=
1207 +- LCPLL_PLL_ENABLE |
1208 +- LCPLL_PLL_LOCK;
1209 +- vgpu_vreg_t(vgpu, LCPLL2_CTL) |= LCPLL_PLL_ENABLE;
1210 +-
1211 ++ /*
1212 ++ * Only 1 PIPE enabled in current vGPU display and PIPE_A is
1213 ++ * tied to TRANSCODER_A in HW, so it's safe to assume PIPE_A,
1214 ++ * TRANSCODER_A can be enabled. PORT_x depends on the input of
1215 ++ * setup_virtual_dp_monitor, we can bind DPLL0 to any PORT_x
1216 ++ * so we fixed to DPLL0 here.
1217 ++ * Setup DPLL0: DP link clk 1620 MHz, non SSC, DP Mode
1218 ++ */
1219 ++ vgpu_vreg_t(vgpu, DPLL_CTRL1) =
1220 ++ DPLL_CTRL1_OVERRIDE(DPLL_ID_SKL_DPLL0);
1221 ++ vgpu_vreg_t(vgpu, DPLL_CTRL1) |=
1222 ++ DPLL_CTRL1_LINK_RATE(DPLL_CTRL1_LINK_RATE_1620, DPLL_ID_SKL_DPLL0);
1223 ++ vgpu_vreg_t(vgpu, LCPLL1_CTL) =
1224 ++ LCPLL_PLL_ENABLE | LCPLL_PLL_LOCK;
1225 ++ vgpu_vreg_t(vgpu, DPLL_STATUS) = DPLL_LOCK(DPLL_ID_SKL_DPLL0);
1226 ++ /*
1227 ++ * Golden M/N are calculated based on:
1228 ++ * 24 bpp, 4 lanes, 154000 pixel clk (from virtual EDID),
1229 ++ * DP link clk 1620 MHz and non-constant_n.
1230 ++ * TODO: calculate DP link symbol clk and stream clk m/n.
1231 ++ */
1232 ++ vgpu_vreg_t(vgpu, PIPE_DATA_M1(TRANSCODER_A)) = 63 << TU_SIZE_SHIFT;
1233 ++ vgpu_vreg_t(vgpu, PIPE_DATA_M1(TRANSCODER_A)) |= 0x5b425e;
1234 ++ vgpu_vreg_t(vgpu, PIPE_DATA_N1(TRANSCODER_A)) = 0x800000;
1235 ++ vgpu_vreg_t(vgpu, PIPE_LINK_M1(TRANSCODER_A)) = 0x3cd6e;
1236 ++ vgpu_vreg_t(vgpu, PIPE_LINK_N1(TRANSCODER_A)) = 0x80000;
1237 + }
1238 +
1239 + if (intel_vgpu_has_monitor_on_port(vgpu, PORT_B)) {
1240 ++ vgpu_vreg_t(vgpu, DPLL_CTRL2) &=
1241 ++ ~DPLL_CTRL2_DDI_CLK_OFF(PORT_B);
1242 ++ vgpu_vreg_t(vgpu, DPLL_CTRL2) |=
1243 ++ DPLL_CTRL2_DDI_CLK_SEL(DPLL_ID_SKL_DPLL0, PORT_B);
1244 ++ vgpu_vreg_t(vgpu, DPLL_CTRL2) |=
1245 ++ DPLL_CTRL2_DDI_SEL_OVERRIDE(PORT_B);
1246 + vgpu_vreg_t(vgpu, SFUSE_STRAP) |= SFUSE_STRAP_DDIB_DETECTED;
1247 + vgpu_vreg_t(vgpu, TRANS_DDI_FUNC_CTL(TRANSCODER_A)) &=
1248 + ~(TRANS_DDI_BPC_MASK | TRANS_DDI_MODE_SELECT_MASK |
1249 +@@ -235,6 +262,12 @@ static void emulate_monitor_status_change(struct intel_vgpu *vgpu)
1250 + }
1251 +
1252 + if (intel_vgpu_has_monitor_on_port(vgpu, PORT_C)) {
1253 ++ vgpu_vreg_t(vgpu, DPLL_CTRL2) &=
1254 ++ ~DPLL_CTRL2_DDI_CLK_OFF(PORT_C);
1255 ++ vgpu_vreg_t(vgpu, DPLL_CTRL2) |=
1256 ++ DPLL_CTRL2_DDI_CLK_SEL(DPLL_ID_SKL_DPLL0, PORT_C);
1257 ++ vgpu_vreg_t(vgpu, DPLL_CTRL2) |=
1258 ++ DPLL_CTRL2_DDI_SEL_OVERRIDE(PORT_C);
1259 + vgpu_vreg_t(vgpu, SDEISR) |= SDE_PORTC_HOTPLUG_CPT;
1260 + vgpu_vreg_t(vgpu, TRANS_DDI_FUNC_CTL(TRANSCODER_A)) &=
1261 + ~(TRANS_DDI_BPC_MASK | TRANS_DDI_MODE_SELECT_MASK |
1262 +@@ -255,6 +288,12 @@ static void emulate_monitor_status_change(struct intel_vgpu *vgpu)
1263 + }
1264 +
1265 + if (intel_vgpu_has_monitor_on_port(vgpu, PORT_D)) {
1266 ++ vgpu_vreg_t(vgpu, DPLL_CTRL2) &=
1267 ++ ~DPLL_CTRL2_DDI_CLK_OFF(PORT_D);
1268 ++ vgpu_vreg_t(vgpu, DPLL_CTRL2) |=
1269 ++ DPLL_CTRL2_DDI_CLK_SEL(DPLL_ID_SKL_DPLL0, PORT_D);
1270 ++ vgpu_vreg_t(vgpu, DPLL_CTRL2) |=
1271 ++ DPLL_CTRL2_DDI_SEL_OVERRIDE(PORT_D);
1272 + vgpu_vreg_t(vgpu, SDEISR) |= SDE_PORTD_HOTPLUG_CPT;
1273 + vgpu_vreg_t(vgpu, TRANS_DDI_FUNC_CTL(TRANSCODER_A)) &=
1274 + ~(TRANS_DDI_BPC_MASK | TRANS_DDI_MODE_SELECT_MASK |
1275 +diff --git a/drivers/gpu/drm/i915/i915_request.c b/drivers/gpu/drm/i915/i915_request.c
1276 +index 32ab154db788..1f50fc8bcebf 100644
1277 +--- a/drivers/gpu/drm/i915/i915_request.c
1278 ++++ b/drivers/gpu/drm/i915/i915_request.c
1279 +@@ -947,8 +947,10 @@ i915_request_await_request(struct i915_request *to, struct i915_request *from)
1280 + GEM_BUG_ON(to == from);
1281 + GEM_BUG_ON(to->timeline == from->timeline);
1282 +
1283 +- if (i915_request_completed(from))
1284 ++ if (i915_request_completed(from)) {
1285 ++ i915_sw_fence_set_error_once(&to->submit, from->fence.error);
1286 + return 0;
1287 ++ }
1288 +
1289 + if (to->engine->schedule) {
1290 + ret = i915_sched_node_add_dependency(&to->sched,
1291 +diff --git a/drivers/hid/hid-alps.c b/drivers/hid/hid-alps.c
1292 +index fa704153cb00..b2ad319a74b9 100644
1293 +--- a/drivers/hid/hid-alps.c
1294 ++++ b/drivers/hid/hid-alps.c
1295 +@@ -802,6 +802,7 @@ static int alps_probe(struct hid_device *hdev, const struct hid_device_id *id)
1296 + break;
1297 + case HID_DEVICE_ID_ALPS_U1_DUAL:
1298 + case HID_DEVICE_ID_ALPS_U1:
1299 ++ case HID_DEVICE_ID_ALPS_U1_UNICORN_LEGACY:
1300 + data->dev_type = U1;
1301 + break;
1302 + default:
1303 +diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
1304 +index 9f2213426556..b1d6156ebf9d 100644
1305 +--- a/drivers/hid/hid-ids.h
1306 ++++ b/drivers/hid/hid-ids.h
1307 +@@ -79,10 +79,10 @@
1308 + #define HID_DEVICE_ID_ALPS_U1_DUAL_PTP 0x121F
1309 + #define HID_DEVICE_ID_ALPS_U1_DUAL_3BTN_PTP 0x1220
1310 + #define HID_DEVICE_ID_ALPS_U1 0x1215
1311 ++#define HID_DEVICE_ID_ALPS_U1_UNICORN_LEGACY 0x121E
1312 + #define HID_DEVICE_ID_ALPS_T4_BTNLESS 0x120C
1313 + #define HID_DEVICE_ID_ALPS_1222 0x1222
1314 +
1315 +-
1316 + #define USB_VENDOR_ID_AMI 0x046b
1317 + #define USB_DEVICE_ID_AMI_VIRT_KEYBOARD_AND_MOUSE 0xff10
1318 +
1319 +@@ -385,6 +385,7 @@
1320 + #define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7349 0x7349
1321 + #define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_73F7 0x73f7
1322 + #define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_A001 0xa001
1323 ++#define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_C002 0xc002
1324 +
1325 + #define USB_VENDOR_ID_ELAN 0x04f3
1326 + #define USB_DEVICE_ID_TOSHIBA_CLICK_L9W 0x0401
1327 +@@ -755,6 +756,7 @@
1328 + #define USB_DEVICE_ID_LOGITECH_RUMBLEPAD2 0xc218
1329 + #define USB_DEVICE_ID_LOGITECH_RUMBLEPAD2_2 0xc219
1330 + #define USB_DEVICE_ID_LOGITECH_G15_LCD 0xc222
1331 ++#define USB_DEVICE_ID_LOGITECH_G11 0xc225
1332 + #define USB_DEVICE_ID_LOGITECH_G15_V2_LCD 0xc227
1333 + #define USB_DEVICE_ID_LOGITECH_G510 0xc22d
1334 + #define USB_DEVICE_ID_LOGITECH_G510_USB_AUDIO 0xc22e
1335 +@@ -1092,6 +1094,9 @@
1336 + #define USB_DEVICE_ID_SYMBOL_SCANNER_2 0x1300
1337 + #define USB_DEVICE_ID_SYMBOL_SCANNER_3 0x1200
1338 +
1339 ++#define I2C_VENDOR_ID_SYNAPTICS 0x06cb
1340 ++#define I2C_PRODUCT_ID_SYNAPTICS_SYNA2393 0x7a13
1341 ++
1342 + #define USB_VENDOR_ID_SYNAPTICS 0x06cb
1343 + #define USB_DEVICE_ID_SYNAPTICS_TP 0x0001
1344 + #define USB_DEVICE_ID_SYNAPTICS_INT_TP 0x0002
1345 +@@ -1106,6 +1111,7 @@
1346 + #define USB_DEVICE_ID_SYNAPTICS_LTS2 0x1d10
1347 + #define USB_DEVICE_ID_SYNAPTICS_HD 0x0ac3
1348 + #define USB_DEVICE_ID_SYNAPTICS_QUAD_HD 0x1ac3
1349 ++#define USB_DEVICE_ID_SYNAPTICS_DELL_K12A 0x2819
1350 + #define USB_DEVICE_ID_SYNAPTICS_ACER_SWITCH5_012 0x2968
1351 + #define USB_DEVICE_ID_SYNAPTICS_TP_V103 0x5710
1352 + #define USB_DEVICE_ID_SYNAPTICS_ACER_SWITCH5 0x81a7
1353 +diff --git a/drivers/hid/hid-lg-g15.c b/drivers/hid/hid-lg-g15.c
1354 +index ad4b5412a9f4..ef0cbcd7540d 100644
1355 +--- a/drivers/hid/hid-lg-g15.c
1356 ++++ b/drivers/hid/hid-lg-g15.c
1357 +@@ -872,6 +872,10 @@ error_hw_stop:
1358 + }
1359 +
1360 + static const struct hid_device_id lg_g15_devices[] = {
1361 ++ /* The G11 is a G15 without the LCD, treat it as a G15 */
1362 ++ { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH,
1363 ++ USB_DEVICE_ID_LOGITECH_G11),
1364 ++ .driver_data = LG_G15 },
1365 + { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH,
1366 + USB_DEVICE_ID_LOGITECH_G15_LCD),
1367 + .driver_data = LG_G15 },
1368 +diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c
1369 +index 362805ddf377..03c720b47306 100644
1370 +--- a/drivers/hid/hid-multitouch.c
1371 ++++ b/drivers/hid/hid-multitouch.c
1372 +@@ -1922,6 +1922,9 @@ static const struct hid_device_id mt_devices[] = {
1373 + { .driver_data = MT_CLS_EGALAX_SERIAL,
1374 + MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
1375 + USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_A001) },
1376 ++ { .driver_data = MT_CLS_EGALAX,
1377 ++ MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
1378 ++ USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_C002) },
1379 +
1380 + /* Elitegroup panel */
1381 + { .driver_data = MT_CLS_SERIAL,
1382 +diff --git a/drivers/hid/hid-quirks.c b/drivers/hid/hid-quirks.c
1383 +index 3735546bb524..acc7c14f7fbc 100644
1384 +--- a/drivers/hid/hid-quirks.c
1385 ++++ b/drivers/hid/hid-quirks.c
1386 +@@ -163,6 +163,7 @@ static const struct hid_device_id hid_quirks[] = {
1387 + { HID_USB_DEVICE(USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_LTS2), HID_QUIRK_NO_INIT_REPORTS },
1388 + { HID_USB_DEVICE(USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_QUAD_HD), HID_QUIRK_NO_INIT_REPORTS },
1389 + { HID_USB_DEVICE(USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_TP_V103), HID_QUIRK_NO_INIT_REPORTS },
1390 ++ { HID_USB_DEVICE(USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_DELL_K12A), HID_QUIRK_NO_INIT_REPORTS },
1391 + { HID_USB_DEVICE(USB_VENDOR_ID_TOPMAX, USB_DEVICE_ID_TOPMAX_COBRAPAD), HID_QUIRK_BADPAD },
1392 + { HID_USB_DEVICE(USB_VENDOR_ID_TOUCHPACK, USB_DEVICE_ID_TOUCHPACK_RTS), HID_QUIRK_MULTI_INPUT },
1393 + { HID_USB_DEVICE(USB_VENDOR_ID_TPV, USB_DEVICE_ID_TPV_OPTICAL_TOUCHSCREEN_8882), HID_QUIRK_NOGET },
1394 +diff --git a/drivers/hid/i2c-hid/i2c-hid-core.c b/drivers/hid/i2c-hid/i2c-hid-core.c
1395 +index 009000c5d55c..294c84e136d7 100644
1396 +--- a/drivers/hid/i2c-hid/i2c-hid-core.c
1397 ++++ b/drivers/hid/i2c-hid/i2c-hid-core.c
1398 +@@ -177,6 +177,8 @@ static const struct i2c_hid_quirks {
1399 + I2C_HID_QUIRK_BOGUS_IRQ },
1400 + { USB_VENDOR_ID_ALPS_JP, HID_ANY_ID,
1401 + I2C_HID_QUIRK_RESET_ON_RESUME },
1402 ++ { I2C_VENDOR_ID_SYNAPTICS, I2C_PRODUCT_ID_SYNAPTICS_SYNA2393,
1403 ++ I2C_HID_QUIRK_RESET_ON_RESUME },
1404 + { USB_VENDOR_ID_ITE, I2C_DEVICE_ID_ITE_LENOVO_LEGION_Y720,
1405 + I2C_HID_QUIRK_BAD_INPUT_SIZE },
1406 + { 0, 0 }
1407 +diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c
1408 +index cefad0881942..fd3199782b6e 100644
1409 +--- a/drivers/i2c/i2c-core-base.c
1410 ++++ b/drivers/i2c/i2c-core-base.c
1411 +@@ -338,8 +338,10 @@ static int i2c_device_probe(struct device *dev)
1412 + } else if (ACPI_COMPANION(dev)) {
1413 + irq = i2c_acpi_get_irq(client);
1414 + }
1415 +- if (irq == -EPROBE_DEFER)
1416 +- return irq;
1417 ++ if (irq == -EPROBE_DEFER) {
1418 ++ status = irq;
1419 ++ goto put_sync_adapter;
1420 ++ }
1421 +
1422 + if (irq < 0)
1423 + irq = 0;
1424 +@@ -353,15 +355,19 @@ static int i2c_device_probe(struct device *dev)
1425 + */
1426 + if (!driver->id_table &&
1427 + !i2c_acpi_match_device(dev->driver->acpi_match_table, client) &&
1428 +- !i2c_of_match_device(dev->driver->of_match_table, client))
1429 +- return -ENODEV;
1430 ++ !i2c_of_match_device(dev->driver->of_match_table, client)) {
1431 ++ status = -ENODEV;
1432 ++ goto put_sync_adapter;
1433 ++ }
1434 +
1435 + if (client->flags & I2C_CLIENT_WAKE) {
1436 + int wakeirq;
1437 +
1438 + wakeirq = of_irq_get_byname(dev->of_node, "wakeup");
1439 +- if (wakeirq == -EPROBE_DEFER)
1440 +- return wakeirq;
1441 ++ if (wakeirq == -EPROBE_DEFER) {
1442 ++ status = wakeirq;
1443 ++ goto put_sync_adapter;
1444 ++ }
1445 +
1446 + device_init_wakeup(&client->dev, true);
1447 +
1448 +@@ -408,6 +414,10 @@ err_detach_pm_domain:
1449 + err_clear_wakeup_irq:
1450 + dev_pm_clear_wake_irq(&client->dev);
1451 + device_init_wakeup(&client->dev, false);
1452 ++put_sync_adapter:
1453 ++ if (client->flags & I2C_CLIENT_HOST_NOTIFY)
1454 ++ pm_runtime_put_sync(&client->adapter->dev);
1455 ++
1456 + return status;
1457 + }
1458 +
1459 +diff --git a/drivers/i2c/i2c-dev.c b/drivers/i2c/i2c-dev.c
1460 +index 2ea4585d18c5..94beacc41302 100644
1461 +--- a/drivers/i2c/i2c-dev.c
1462 ++++ b/drivers/i2c/i2c-dev.c
1463 +@@ -40,7 +40,7 @@
1464 + struct i2c_dev {
1465 + struct list_head list;
1466 + struct i2c_adapter *adap;
1467 +- struct device *dev;
1468 ++ struct device dev;
1469 + struct cdev cdev;
1470 + };
1471 +
1472 +@@ -84,12 +84,14 @@ static struct i2c_dev *get_free_i2c_dev(struct i2c_adapter *adap)
1473 + return i2c_dev;
1474 + }
1475 +
1476 +-static void put_i2c_dev(struct i2c_dev *i2c_dev)
1477 ++static void put_i2c_dev(struct i2c_dev *i2c_dev, bool del_cdev)
1478 + {
1479 + spin_lock(&i2c_dev_list_lock);
1480 + list_del(&i2c_dev->list);
1481 + spin_unlock(&i2c_dev_list_lock);
1482 +- kfree(i2c_dev);
1483 ++ if (del_cdev)
1484 ++ cdev_device_del(&i2c_dev->cdev, &i2c_dev->dev);
1485 ++ put_device(&i2c_dev->dev);
1486 + }
1487 +
1488 + static ssize_t name_show(struct device *dev,
1489 +@@ -628,6 +630,14 @@ static const struct file_operations i2cdev_fops = {
1490 +
1491 + static struct class *i2c_dev_class;
1492 +
1493 ++static void i2cdev_dev_release(struct device *dev)
1494 ++{
1495 ++ struct i2c_dev *i2c_dev;
1496 ++
1497 ++ i2c_dev = container_of(dev, struct i2c_dev, dev);
1498 ++ kfree(i2c_dev);
1499 ++}
1500 ++
1501 + static int i2cdev_attach_adapter(struct device *dev, void *dummy)
1502 + {
1503 + struct i2c_adapter *adap;
1504 +@@ -644,27 +654,23 @@ static int i2cdev_attach_adapter(struct device *dev, void *dummy)
1505 +
1506 + cdev_init(&i2c_dev->cdev, &i2cdev_fops);
1507 + i2c_dev->cdev.owner = THIS_MODULE;
1508 +- res = cdev_add(&i2c_dev->cdev, MKDEV(I2C_MAJOR, adap->nr), 1);
1509 +- if (res)
1510 +- goto error_cdev;
1511 +-
1512 +- /* register this i2c device with the driver core */
1513 +- i2c_dev->dev = device_create(i2c_dev_class, &adap->dev,
1514 +- MKDEV(I2C_MAJOR, adap->nr), NULL,
1515 +- "i2c-%d", adap->nr);
1516 +- if (IS_ERR(i2c_dev->dev)) {
1517 +- res = PTR_ERR(i2c_dev->dev);
1518 +- goto error;
1519 ++
1520 ++ device_initialize(&i2c_dev->dev);
1521 ++ i2c_dev->dev.devt = MKDEV(I2C_MAJOR, adap->nr);
1522 ++ i2c_dev->dev.class = i2c_dev_class;
1523 ++ i2c_dev->dev.parent = &adap->dev;
1524 ++ i2c_dev->dev.release = i2cdev_dev_release;
1525 ++ dev_set_name(&i2c_dev->dev, "i2c-%d", adap->nr);
1526 ++
1527 ++ res = cdev_device_add(&i2c_dev->cdev, &i2c_dev->dev);
1528 ++ if (res) {
1529 ++ put_i2c_dev(i2c_dev, false);
1530 ++ return res;
1531 + }
1532 +
1533 + pr_debug("i2c-dev: adapter [%s] registered as minor %d\n",
1534 + adap->name, adap->nr);
1535 + return 0;
1536 +-error:
1537 +- cdev_del(&i2c_dev->cdev);
1538 +-error_cdev:
1539 +- put_i2c_dev(i2c_dev);
1540 +- return res;
1541 + }
1542 +
1543 + static int i2cdev_detach_adapter(struct device *dev, void *dummy)
1544 +@@ -680,9 +686,7 @@ static int i2cdev_detach_adapter(struct device *dev, void *dummy)
1545 + if (!i2c_dev) /* attach_adapter must have failed */
1546 + return 0;
1547 +
1548 +- cdev_del(&i2c_dev->cdev);
1549 +- put_i2c_dev(i2c_dev);
1550 +- device_destroy(i2c_dev_class, MKDEV(I2C_MAJOR, adap->nr));
1551 ++ put_i2c_dev(i2c_dev, true);
1552 +
1553 + pr_debug("i2c-dev: adapter [%s] unregistered\n", adap->name);
1554 + return 0;
1555 +diff --git a/drivers/i2c/muxes/i2c-demux-pinctrl.c b/drivers/i2c/muxes/i2c-demux-pinctrl.c
1556 +index 0e16490eb3a1..5365199a31f4 100644
1557 +--- a/drivers/i2c/muxes/i2c-demux-pinctrl.c
1558 ++++ b/drivers/i2c/muxes/i2c-demux-pinctrl.c
1559 +@@ -272,6 +272,7 @@ static int i2c_demux_pinctrl_probe(struct platform_device *pdev)
1560 + err_rollback_available:
1561 + device_remove_file(&pdev->dev, &dev_attr_available_masters);
1562 + err_rollback:
1563 ++ i2c_demux_deactivate_master(priv);
1564 + for (j = 0; j < i; j++) {
1565 + of_node_put(priv->chan[j].parent_np);
1566 + of_changeset_destroy(&priv->chan[j].chgset);
1567 +diff --git a/drivers/iio/accel/sca3000.c b/drivers/iio/accel/sca3000.c
1568 +index 66d768d971e1..6e429072e44a 100644
1569 +--- a/drivers/iio/accel/sca3000.c
1570 ++++ b/drivers/iio/accel/sca3000.c
1571 +@@ -980,7 +980,7 @@ static int sca3000_read_data(struct sca3000_state *st,
1572 + st->tx[0] = SCA3000_READ_REG(reg_address_high);
1573 + ret = spi_sync_transfer(st->us, xfer, ARRAY_SIZE(xfer));
1574 + if (ret) {
1575 +- dev_err(get_device(&st->us->dev), "problem reading register");
1576 ++ dev_err(&st->us->dev, "problem reading register\n");
1577 + return ret;
1578 + }
1579 +
1580 +diff --git a/drivers/iio/adc/stm32-adc.c b/drivers/iio/adc/stm32-adc.c
1581 +index ae622ee6d08c..dfc3a306c667 100644
1582 +--- a/drivers/iio/adc/stm32-adc.c
1583 ++++ b/drivers/iio/adc/stm32-adc.c
1584 +@@ -1812,18 +1812,18 @@ static int stm32_adc_chan_of_init(struct iio_dev *indio_dev)
1585 + return 0;
1586 + }
1587 +
1588 +-static int stm32_adc_dma_request(struct iio_dev *indio_dev)
1589 ++static int stm32_adc_dma_request(struct device *dev, struct iio_dev *indio_dev)
1590 + {
1591 + struct stm32_adc *adc = iio_priv(indio_dev);
1592 + struct dma_slave_config config;
1593 + int ret;
1594 +
1595 +- adc->dma_chan = dma_request_chan(&indio_dev->dev, "rx");
1596 ++ adc->dma_chan = dma_request_chan(dev, "rx");
1597 + if (IS_ERR(adc->dma_chan)) {
1598 + ret = PTR_ERR(adc->dma_chan);
1599 + if (ret != -ENODEV) {
1600 + if (ret != -EPROBE_DEFER)
1601 +- dev_err(&indio_dev->dev,
1602 ++ dev_err(dev,
1603 + "DMA channel request failed with %d\n",
1604 + ret);
1605 + return ret;
1606 +@@ -1930,7 +1930,7 @@ static int stm32_adc_probe(struct platform_device *pdev)
1607 + if (ret < 0)
1608 + return ret;
1609 +
1610 +- ret = stm32_adc_dma_request(indio_dev);
1611 ++ ret = stm32_adc_dma_request(dev, indio_dev);
1612 + if (ret < 0)
1613 + return ret;
1614 +
1615 +diff --git a/drivers/iio/adc/stm32-dfsdm-adc.c b/drivers/iio/adc/stm32-dfsdm-adc.c
1616 +index 76a60d93fe23..506bf519f64c 100644
1617 +--- a/drivers/iio/adc/stm32-dfsdm-adc.c
1618 ++++ b/drivers/iio/adc/stm32-dfsdm-adc.c
1619 +@@ -62,7 +62,7 @@ enum sd_converter_type {
1620 +
1621 + struct stm32_dfsdm_dev_data {
1622 + int type;
1623 +- int (*init)(struct iio_dev *indio_dev);
1624 ++ int (*init)(struct device *dev, struct iio_dev *indio_dev);
1625 + unsigned int num_channels;
1626 + const struct regmap_config *regmap_cfg;
1627 + };
1628 +@@ -1365,11 +1365,12 @@ static void stm32_dfsdm_dma_release(struct iio_dev *indio_dev)
1629 + }
1630 + }
1631 +
1632 +-static int stm32_dfsdm_dma_request(struct iio_dev *indio_dev)
1633 ++static int stm32_dfsdm_dma_request(struct device *dev,
1634 ++ struct iio_dev *indio_dev)
1635 + {
1636 + struct stm32_dfsdm_adc *adc = iio_priv(indio_dev);
1637 +
1638 +- adc->dma_chan = dma_request_chan(&indio_dev->dev, "rx");
1639 ++ adc->dma_chan = dma_request_chan(dev, "rx");
1640 + if (IS_ERR(adc->dma_chan)) {
1641 + int ret = PTR_ERR(adc->dma_chan);
1642 +
1643 +@@ -1425,7 +1426,7 @@ static int stm32_dfsdm_adc_chan_init_one(struct iio_dev *indio_dev,
1644 + &adc->dfsdm->ch_list[ch->channel]);
1645 + }
1646 +
1647 +-static int stm32_dfsdm_audio_init(struct iio_dev *indio_dev)
1648 ++static int stm32_dfsdm_audio_init(struct device *dev, struct iio_dev *indio_dev)
1649 + {
1650 + struct iio_chan_spec *ch;
1651 + struct stm32_dfsdm_adc *adc = iio_priv(indio_dev);
1652 +@@ -1452,10 +1453,10 @@ static int stm32_dfsdm_audio_init(struct iio_dev *indio_dev)
1653 + indio_dev->num_channels = 1;
1654 + indio_dev->channels = ch;
1655 +
1656 +- return stm32_dfsdm_dma_request(indio_dev);
1657 ++ return stm32_dfsdm_dma_request(dev, indio_dev);
1658 + }
1659 +
1660 +-static int stm32_dfsdm_adc_init(struct iio_dev *indio_dev)
1661 ++static int stm32_dfsdm_adc_init(struct device *dev, struct iio_dev *indio_dev)
1662 + {
1663 + struct iio_chan_spec *ch;
1664 + struct stm32_dfsdm_adc *adc = iio_priv(indio_dev);
1665 +@@ -1499,17 +1500,17 @@ static int stm32_dfsdm_adc_init(struct iio_dev *indio_dev)
1666 + init_completion(&adc->completion);
1667 +
1668 + /* Optionally request DMA */
1669 +- ret = stm32_dfsdm_dma_request(indio_dev);
1670 ++ ret = stm32_dfsdm_dma_request(dev, indio_dev);
1671 + if (ret) {
1672 + if (ret != -ENODEV) {
1673 + if (ret != -EPROBE_DEFER)
1674 +- dev_err(&indio_dev->dev,
1675 ++ dev_err(dev,
1676 + "DMA channel request failed with %d\n",
1677 + ret);
1678 + return ret;
1679 + }
1680 +
1681 +- dev_dbg(&indio_dev->dev, "No DMA support\n");
1682 ++ dev_dbg(dev, "No DMA support\n");
1683 + return 0;
1684 + }
1685 +
1686 +@@ -1622,7 +1623,7 @@ static int stm32_dfsdm_adc_probe(struct platform_device *pdev)
1687 + adc->dfsdm->fl_list[adc->fl_id].sync_mode = val;
1688 +
1689 + adc->dev_data = dev_data;
1690 +- ret = dev_data->init(iio);
1691 ++ ret = dev_data->init(dev, iio);
1692 + if (ret < 0)
1693 + return ret;
1694 +
1695 +diff --git a/drivers/iio/adc/ti-ads8344.c b/drivers/iio/adc/ti-ads8344.c
1696 +index abe4b56c847c..8a8792010c20 100644
1697 +--- a/drivers/iio/adc/ti-ads8344.c
1698 ++++ b/drivers/iio/adc/ti-ads8344.c
1699 +@@ -32,16 +32,17 @@ struct ads8344 {
1700 + u8 rx_buf[3];
1701 + };
1702 +
1703 +-#define ADS8344_VOLTAGE_CHANNEL(chan, si) \
1704 ++#define ADS8344_VOLTAGE_CHANNEL(chan, addr) \
1705 + { \
1706 + .type = IIO_VOLTAGE, \
1707 + .indexed = 1, \
1708 + .channel = chan, \
1709 + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), \
1710 + .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), \
1711 ++ .address = addr, \
1712 + }
1713 +
1714 +-#define ADS8344_VOLTAGE_CHANNEL_DIFF(chan1, chan2, si) \
1715 ++#define ADS8344_VOLTAGE_CHANNEL_DIFF(chan1, chan2, addr) \
1716 + { \
1717 + .type = IIO_VOLTAGE, \
1718 + .indexed = 1, \
1719 +@@ -50,6 +51,7 @@ struct ads8344 {
1720 + .differential = 1, \
1721 + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), \
1722 + .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), \
1723 ++ .address = addr, \
1724 + }
1725 +
1726 + static const struct iio_chan_spec ads8344_channels[] = {
1727 +@@ -105,7 +107,7 @@ static int ads8344_read_raw(struct iio_dev *iio,
1728 + switch (mask) {
1729 + case IIO_CHAN_INFO_RAW:
1730 + mutex_lock(&adc->lock);
1731 +- *value = ads8344_adc_conversion(adc, channel->scan_index,
1732 ++ *value = ads8344_adc_conversion(adc, channel->address,
1733 + channel->differential);
1734 + mutex_unlock(&adc->lock);
1735 + if (*value < 0)
1736 +diff --git a/drivers/iio/dac/vf610_dac.c b/drivers/iio/dac/vf610_dac.c
1737 +index 71f8a5c471c4..7f1e9317c3f3 100644
1738 +--- a/drivers/iio/dac/vf610_dac.c
1739 ++++ b/drivers/iio/dac/vf610_dac.c
1740 +@@ -223,6 +223,7 @@ static int vf610_dac_probe(struct platform_device *pdev)
1741 + return 0;
1742 +
1743 + error_iio_device_register:
1744 ++ vf610_dac_exit(info);
1745 + clk_disable_unprepare(info->clk);
1746 +
1747 + return ret;
1748 +diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_shub.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_shub.c
1749 +index 64ef07a30726..1cf98195f84d 100644
1750 +--- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_shub.c
1751 ++++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_shub.c
1752 +@@ -544,8 +544,10 @@ st_lsm6dsx_shub_write_raw(struct iio_dev *iio_dev,
1753 +
1754 + ref_sensor = iio_priv(hw->iio_devs[ST_LSM6DSX_ID_ACC]);
1755 + odr = st_lsm6dsx_check_odr(ref_sensor, val, &odr_val);
1756 +- if (odr < 0)
1757 +- return odr;
1758 ++ if (odr < 0) {
1759 ++ err = odr;
1760 ++ goto release;
1761 ++ }
1762 +
1763 + sensor->ext_info.slv_odr = val;
1764 + sensor->odr = odr;
1765 +@@ -557,6 +559,7 @@ st_lsm6dsx_shub_write_raw(struct iio_dev *iio_dev,
1766 + break;
1767 + }
1768 +
1769 ++release:
1770 + iio_device_release_direct_mode(iio_dev);
1771 +
1772 + return err;
1773 +diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c
1774 +index 500d0a8c966f..2aa46a6de172 100644
1775 +--- a/drivers/iommu/amd_iommu.c
1776 ++++ b/drivers/iommu/amd_iommu.c
1777 +@@ -127,7 +127,8 @@ static inline int get_acpihid_device_id(struct device *dev,
1778 + return -ENODEV;
1779 +
1780 + list_for_each_entry(p, &acpihid_map, list) {
1781 +- if (acpi_dev_hid_uid_match(adev, p->hid, p->uid)) {
1782 ++ if (acpi_dev_hid_uid_match(adev, p->hid,
1783 ++ p->uid[0] ? p->uid : NULL)) {
1784 + if (entry)
1785 + *entry = p;
1786 + return p->devid;
1787 +@@ -1499,8 +1500,19 @@ static u64 *alloc_pte(struct protection_domain *domain,
1788 + amd_iommu_domain_get_pgtable(domain, &pgtable);
1789 +
1790 + while (address > PM_LEVEL_SIZE(pgtable.mode)) {
1791 +- *updated = increase_address_space(domain, address, gfp) || *updated;
1792 ++ bool upd = increase_address_space(domain, address, gfp);
1793 ++
1794 ++ /* Read new values to check if update was successful */
1795 + amd_iommu_domain_get_pgtable(domain, &pgtable);
1796 ++
1797 ++ /*
1798 ++ * Return an error if there is no memory to update the
1799 ++ * page-table.
1800 ++ */
1801 ++ if (!upd && (address > PM_LEVEL_SIZE(pgtable.mode)))
1802 ++ return NULL;
1803 ++
1804 ++ *updated = *updated || upd;
1805 + }
1806 +
1807 +
1808 +@@ -2333,6 +2345,7 @@ static void update_domain(struct protection_domain *domain)
1809 +
1810 + /* Flush domain TLB(s) and wait for completion */
1811 + domain_flush_tlb_pde(domain);
1812 ++ domain_flush_complete(domain);
1813 + }
1814 +
1815 + int __init amd_iommu_init_api(void)
1816 +diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c
1817 +index 2b9a67ecc6ac..5b81fd16f5fa 100644
1818 +--- a/drivers/iommu/amd_iommu_init.c
1819 ++++ b/drivers/iommu/amd_iommu_init.c
1820 +@@ -1329,8 +1329,8 @@ static int __init init_iommu_from_acpi(struct amd_iommu *iommu,
1821 + }
1822 + case IVHD_DEV_ACPI_HID: {
1823 + u16 devid;
1824 +- u8 hid[ACPIHID_HID_LEN] = {0};
1825 +- u8 uid[ACPIHID_UID_LEN] = {0};
1826 ++ u8 hid[ACPIHID_HID_LEN];
1827 ++ u8 uid[ACPIHID_UID_LEN];
1828 + int ret;
1829 +
1830 + if (h->type != 0x40) {
1831 +@@ -1347,6 +1347,7 @@ static int __init init_iommu_from_acpi(struct amd_iommu *iommu,
1832 + break;
1833 + }
1834 +
1835 ++ uid[0] = '\0';
1836 + switch (e->uidf) {
1837 + case UID_NOT_PRESENT:
1838 +
1839 +@@ -1361,8 +1362,8 @@ static int __init init_iommu_from_acpi(struct amd_iommu *iommu,
1840 + break;
1841 + case UID_IS_CHARACTER:
1842 +
1843 +- memcpy(uid, (u8 *)(&e->uid), ACPIHID_UID_LEN - 1);
1844 +- uid[ACPIHID_UID_LEN - 1] = '\0';
1845 ++ memcpy(uid, &e->uid, e->uidl);
1846 ++ uid[e->uidl] = '\0';
1847 +
1848 + break;
1849 + default:
1850 +diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
1851 +index 8d2477941fd9..22b28076d48e 100644
1852 +--- a/drivers/iommu/iommu.c
1853 ++++ b/drivers/iommu/iommu.c
1854 +@@ -692,6 +692,15 @@ out:
1855 + return ret;
1856 + }
1857 +
1858 ++static bool iommu_is_attach_deferred(struct iommu_domain *domain,
1859 ++ struct device *dev)
1860 ++{
1861 ++ if (domain->ops->is_attach_deferred)
1862 ++ return domain->ops->is_attach_deferred(domain, dev);
1863 ++
1864 ++ return false;
1865 ++}
1866 ++
1867 + /**
1868 + * iommu_group_add_device - add a device to an iommu group
1869 + * @group: the group into which to add the device (reference should be held)
1870 +@@ -746,7 +755,7 @@ rename:
1871 +
1872 + mutex_lock(&group->mutex);
1873 + list_add_tail(&device->list, &group->devices);
1874 +- if (group->domain)
1875 ++ if (group->domain && !iommu_is_attach_deferred(group->domain, dev))
1876 + ret = __iommu_attach_device(group->domain, dev);
1877 + mutex_unlock(&group->mutex);
1878 + if (ret)
1879 +@@ -1652,9 +1661,6 @@ static int __iommu_attach_device(struct iommu_domain *domain,
1880 + struct device *dev)
1881 + {
1882 + int ret;
1883 +- if ((domain->ops->is_attach_deferred != NULL) &&
1884 +- domain->ops->is_attach_deferred(domain, dev))
1885 +- return 0;
1886 +
1887 + if (unlikely(domain->ops->attach_dev == NULL))
1888 + return -ENODEV;
1889 +@@ -1726,8 +1732,7 @@ EXPORT_SYMBOL_GPL(iommu_sva_unbind_gpasid);
1890 + static void __iommu_detach_device(struct iommu_domain *domain,
1891 + struct device *dev)
1892 + {
1893 +- if ((domain->ops->is_attach_deferred != NULL) &&
1894 +- domain->ops->is_attach_deferred(domain, dev))
1895 ++ if (iommu_is_attach_deferred(domain, dev))
1896 + return;
1897 +
1898 + if (unlikely(domain->ops->detach_dev == NULL))
1899 +diff --git a/drivers/ipack/carriers/tpci200.c b/drivers/ipack/carriers/tpci200.c
1900 +index 23445ebfda5c..ec71063fff76 100644
1901 +--- a/drivers/ipack/carriers/tpci200.c
1902 ++++ b/drivers/ipack/carriers/tpci200.c
1903 +@@ -306,6 +306,7 @@ static int tpci200_register(struct tpci200_board *tpci200)
1904 + "(bn 0x%X, sn 0x%X) failed to map driver user space!",
1905 + tpci200->info->pdev->bus->number,
1906 + tpci200->info->pdev->devfn);
1907 ++ res = -ENOMEM;
1908 + goto out_release_mem8_space;
1909 + }
1910 +
1911 +diff --git a/drivers/misc/cardreader/rtsx_pcr.c b/drivers/misc/cardreader/rtsx_pcr.c
1912 +index 06038b325b02..55da6428ceb0 100644
1913 +--- a/drivers/misc/cardreader/rtsx_pcr.c
1914 ++++ b/drivers/misc/cardreader/rtsx_pcr.c
1915 +@@ -142,6 +142,9 @@ static void rtsx_comm_pm_full_on(struct rtsx_pcr *pcr)
1916 +
1917 + rtsx_disable_aspm(pcr);
1918 +
1919 ++ /* Fixes DMA transfer timout issue after disabling ASPM on RTS5260 */
1920 ++ msleep(1);
1921 ++
1922 + if (option->ltr_enabled)
1923 + rtsx_set_ltr_latency(pcr, option->ltr_active_latency);
1924 +
1925 +diff --git a/drivers/misc/mei/client.c b/drivers/misc/mei/client.c
1926 +index 1e3edbbacb1e..c6b163060c76 100644
1927 +--- a/drivers/misc/mei/client.c
1928 ++++ b/drivers/misc/mei/client.c
1929 +@@ -266,6 +266,7 @@ void mei_me_cl_rm_by_uuid(struct mei_device *dev, const uuid_le *uuid)
1930 + down_write(&dev->me_clients_rwsem);
1931 + me_cl = __mei_me_cl_by_uuid(dev, uuid);
1932 + __mei_me_cl_del(dev, me_cl);
1933 ++ mei_me_cl_put(me_cl);
1934 + up_write(&dev->me_clients_rwsem);
1935 + }
1936 +
1937 +@@ -287,6 +288,7 @@ void mei_me_cl_rm_by_uuid_id(struct mei_device *dev, const uuid_le *uuid, u8 id)
1938 + down_write(&dev->me_clients_rwsem);
1939 + me_cl = __mei_me_cl_by_uuid_id(dev, uuid, id);
1940 + __mei_me_cl_del(dev, me_cl);
1941 ++ mei_me_cl_put(me_cl);
1942 + up_write(&dev->me_clients_rwsem);
1943 + }
1944 +
1945 +diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c
1946 +index 5fac4355b9c2..559b6930b6f6 100644
1947 +--- a/drivers/mtd/mtdcore.c
1948 ++++ b/drivers/mtd/mtdcore.c
1949 +@@ -551,7 +551,7 @@ static int mtd_nvmem_add(struct mtd_info *mtd)
1950 +
1951 + config.id = -1;
1952 + config.dev = &mtd->dev;
1953 +- config.name = mtd->name;
1954 ++ config.name = dev_name(&mtd->dev);
1955 + config.owner = THIS_MODULE;
1956 + config.reg_read = mtd_nvmem_reg_read;
1957 + config.size = mtd->size;
1958 +diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c
1959 +index 8dda51bbdd11..0d21c68bfe24 100644
1960 +--- a/drivers/mtd/nand/spi/core.c
1961 ++++ b/drivers/mtd/nand/spi/core.c
1962 +@@ -1049,6 +1049,10 @@ static int spinand_init(struct spinand_device *spinand)
1963 +
1964 + mtd->oobavail = ret;
1965 +
1966 ++ /* Propagate ECC information to mtd_info */
1967 ++ mtd->ecc_strength = nand->eccreq.strength;
1968 ++ mtd->ecc_step_size = nand->eccreq.step_size;
1969 ++
1970 + return 0;
1971 +
1972 + err_cleanup_nanddev:
1973 +diff --git a/drivers/mtd/ubi/debug.c b/drivers/mtd/ubi/debug.c
1974 +index 54646c2c2744..ac2bdba8bb1a 100644
1975 +--- a/drivers/mtd/ubi/debug.c
1976 ++++ b/drivers/mtd/ubi/debug.c
1977 +@@ -393,9 +393,6 @@ static void *eraseblk_count_seq_start(struct seq_file *s, loff_t *pos)
1978 + {
1979 + struct ubi_device *ubi = s->private;
1980 +
1981 +- if (*pos == 0)
1982 +- return SEQ_START_TOKEN;
1983 +-
1984 + if (*pos < ubi->peb_count)
1985 + return pos;
1986 +
1987 +@@ -409,8 +406,6 @@ static void *eraseblk_count_seq_next(struct seq_file *s, void *v, loff_t *pos)
1988 + {
1989 + struct ubi_device *ubi = s->private;
1990 +
1991 +- if (v == SEQ_START_TOKEN)
1992 +- return pos;
1993 + (*pos)++;
1994 +
1995 + if (*pos < ubi->peb_count)
1996 +@@ -432,11 +427,8 @@ static int eraseblk_count_seq_show(struct seq_file *s, void *iter)
1997 + int err;
1998 +
1999 + /* If this is the start, print a header */
2000 +- if (iter == SEQ_START_TOKEN) {
2001 +- seq_puts(s,
2002 +- "physical_block_number\terase_count\tblock_status\tread_status\n");
2003 +- return 0;
2004 +- }
2005 ++ if (*block_number == 0)
2006 ++ seq_puts(s, "physical_block_number\terase_count\n");
2007 +
2008 + err = ubi_io_is_bad(ubi, *block_number);
2009 + if (err)
2010 +diff --git a/drivers/net/ethernet/amazon/ena/ena_netdev.h b/drivers/net/ethernet/amazon/ena/ena_netdev.h
2011 +index 8795e0b1dc3c..8984aa211112 100644
2012 +--- a/drivers/net/ethernet/amazon/ena/ena_netdev.h
2013 ++++ b/drivers/net/ethernet/amazon/ena/ena_netdev.h
2014 +@@ -69,7 +69,7 @@
2015 + * 16kB.
2016 + */
2017 + #if PAGE_SIZE > SZ_16K
2018 +-#define ENA_PAGE_SIZE SZ_16K
2019 ++#define ENA_PAGE_SIZE (_AC(SZ_16K, UL))
2020 + #else
2021 + #define ENA_PAGE_SIZE PAGE_SIZE
2022 + #endif
2023 +diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c b/drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c
2024 +index 78b6f3248756..e0625c67eed3 100644
2025 +--- a/drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c
2026 ++++ b/drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c
2027 +@@ -56,7 +56,7 @@ static const struct aq_board_revision_s hw_atl_boards[] = {
2028 + { AQ_DEVICE_ID_D108, AQ_HWREV_2, &hw_atl_ops_b0, &hw_atl_b0_caps_aqc108, },
2029 + { AQ_DEVICE_ID_D109, AQ_HWREV_2, &hw_atl_ops_b0, &hw_atl_b0_caps_aqc109, },
2030 +
2031 +- { AQ_DEVICE_ID_AQC100, AQ_HWREV_ANY, &hw_atl_ops_b1, &hw_atl_b0_caps_aqc107, },
2032 ++ { AQ_DEVICE_ID_AQC100, AQ_HWREV_ANY, &hw_atl_ops_b1, &hw_atl_b0_caps_aqc100, },
2033 + { AQ_DEVICE_ID_AQC107, AQ_HWREV_ANY, &hw_atl_ops_b1, &hw_atl_b0_caps_aqc107, },
2034 + { AQ_DEVICE_ID_AQC108, AQ_HWREV_ANY, &hw_atl_ops_b1, &hw_atl_b0_caps_aqc108, },
2035 + { AQ_DEVICE_ID_AQC109, AQ_HWREV_ANY, &hw_atl_ops_b1, &hw_atl_b0_caps_aqc109, },
2036 +diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
2037 +index 4bd33245bad6..3de549c6c693 100644
2038 +--- a/drivers/net/ethernet/ibm/ibmvnic.c
2039 ++++ b/drivers/net/ethernet/ibm/ibmvnic.c
2040 +@@ -2189,7 +2189,8 @@ static void __ibmvnic_reset(struct work_struct *work)
2041 + rc = do_hard_reset(adapter, rwi, reset_state);
2042 + rtnl_unlock();
2043 + }
2044 +- } else {
2045 ++ } else if (!(rwi->reset_reason == VNIC_RESET_FATAL &&
2046 ++ adapter->from_passive_init)) {
2047 + rc = do_reset(adapter, rwi, reset_state);
2048 + }
2049 + kfree(rwi);
2050 +diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
2051 +index 7da18c9afa01..d564459290ce 100644
2052 +--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
2053 ++++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
2054 +@@ -3988,7 +3988,7 @@ static int stmmac_set_features(struct net_device *netdev,
2055 + /**
2056 + * stmmac_interrupt - main ISR
2057 + * @irq: interrupt number.
2058 +- * @dev_id: to pass the net device pointer.
2059 ++ * @dev_id: to pass the net device pointer (must be valid).
2060 + * Description: this is the main driver interrupt service routine.
2061 + * It can call:
2062 + * o DMA service routine (to manage incoming frame reception and transmission
2063 +@@ -4012,11 +4012,6 @@ static irqreturn_t stmmac_interrupt(int irq, void *dev_id)
2064 + if (priv->irq_wake)
2065 + pm_wakeup_event(priv->device, 0);
2066 +
2067 +- if (unlikely(!dev)) {
2068 +- netdev_err(priv->dev, "%s: invalid dev pointer\n", __func__);
2069 +- return IRQ_NONE;
2070 +- }
2071 +-
2072 + /* Check if adapter is up */
2073 + if (test_bit(STMMAC_DOWN, &priv->state))
2074 + return IRQ_HANDLED;
2075 +diff --git a/drivers/net/gtp.c b/drivers/net/gtp.c
2076 +index 672cd2caf2fb..21640a035d7d 100644
2077 +--- a/drivers/net/gtp.c
2078 ++++ b/drivers/net/gtp.c
2079 +@@ -1169,11 +1169,11 @@ out_unlock:
2080 + static struct genl_family gtp_genl_family;
2081 +
2082 + static int gtp_genl_fill_info(struct sk_buff *skb, u32 snd_portid, u32 snd_seq,
2083 +- u32 type, struct pdp_ctx *pctx)
2084 ++ int flags, u32 type, struct pdp_ctx *pctx)
2085 + {
2086 + void *genlh;
2087 +
2088 +- genlh = genlmsg_put(skb, snd_portid, snd_seq, &gtp_genl_family, 0,
2089 ++ genlh = genlmsg_put(skb, snd_portid, snd_seq, &gtp_genl_family, flags,
2090 + type);
2091 + if (genlh == NULL)
2092 + goto nlmsg_failure;
2093 +@@ -1227,8 +1227,8 @@ static int gtp_genl_get_pdp(struct sk_buff *skb, struct genl_info *info)
2094 + goto err_unlock;
2095 + }
2096 +
2097 +- err = gtp_genl_fill_info(skb2, NETLINK_CB(skb).portid,
2098 +- info->snd_seq, info->nlhdr->nlmsg_type, pctx);
2099 ++ err = gtp_genl_fill_info(skb2, NETLINK_CB(skb).portid, info->snd_seq,
2100 ++ 0, info->nlhdr->nlmsg_type, pctx);
2101 + if (err < 0)
2102 + goto err_unlock_free;
2103 +
2104 +@@ -1271,6 +1271,7 @@ static int gtp_genl_dump_pdp(struct sk_buff *skb,
2105 + gtp_genl_fill_info(skb,
2106 + NETLINK_CB(cb->skb).portid,
2107 + cb->nlh->nlmsg_seq,
2108 ++ NLM_F_MULTI,
2109 + cb->nlh->nlmsg_type, pctx)) {
2110 + cb->args[0] = i;
2111 + cb->args[1] = j;
2112 +diff --git a/drivers/pinctrl/qcom/pinctrl-msm.c b/drivers/pinctrl/qcom/pinctrl-msm.c
2113 +index 9f1c9951949e..14a8f8fa0ea3 100644
2114 +--- a/drivers/pinctrl/qcom/pinctrl-msm.c
2115 ++++ b/drivers/pinctrl/qcom/pinctrl-msm.c
2116 +@@ -1010,6 +1010,29 @@ static void msm_gpio_irq_relres(struct irq_data *d)
2117 + module_put(gc->owner);
2118 + }
2119 +
2120 ++static int msm_gpio_irq_set_affinity(struct irq_data *d,
2121 ++ const struct cpumask *dest, bool force)
2122 ++{
2123 ++ struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
2124 ++ struct msm_pinctrl *pctrl = gpiochip_get_data(gc);
2125 ++
2126 ++ if (d->parent_data && test_bit(d->hwirq, pctrl->skip_wake_irqs))
2127 ++ return irq_chip_set_affinity_parent(d, dest, force);
2128 ++
2129 ++ return 0;
2130 ++}
2131 ++
2132 ++static int msm_gpio_irq_set_vcpu_affinity(struct irq_data *d, void *vcpu_info)
2133 ++{
2134 ++ struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
2135 ++ struct msm_pinctrl *pctrl = gpiochip_get_data(gc);
2136 ++
2137 ++ if (d->parent_data && test_bit(d->hwirq, pctrl->skip_wake_irqs))
2138 ++ return irq_chip_set_vcpu_affinity_parent(d, vcpu_info);
2139 ++
2140 ++ return 0;
2141 ++}
2142 ++
2143 + static void msm_gpio_irq_handler(struct irq_desc *desc)
2144 + {
2145 + struct gpio_chip *gc = irq_desc_get_handler_data(desc);
2146 +@@ -1108,6 +1131,8 @@ static int msm_gpio_init(struct msm_pinctrl *pctrl)
2147 + pctrl->irq_chip.irq_set_wake = msm_gpio_irq_set_wake;
2148 + pctrl->irq_chip.irq_request_resources = msm_gpio_irq_reqres;
2149 + pctrl->irq_chip.irq_release_resources = msm_gpio_irq_relres;
2150 ++ pctrl->irq_chip.irq_set_affinity = msm_gpio_irq_set_affinity;
2151 ++ pctrl->irq_chip.irq_set_vcpu_affinity = msm_gpio_irq_set_vcpu_affinity;
2152 +
2153 + np = of_parse_phandle(pctrl->dev->of_node, "wakeup-parent", 0);
2154 + if (np) {
2155 +diff --git a/drivers/platform/x86/asus-nb-wmi.c b/drivers/platform/x86/asus-nb-wmi.c
2156 +index 6f12747a359a..c4404d9c1de4 100644
2157 +--- a/drivers/platform/x86/asus-nb-wmi.c
2158 ++++ b/drivers/platform/x86/asus-nb-wmi.c
2159 +@@ -515,9 +515,33 @@ static struct asus_wmi_driver asus_nb_wmi_driver = {
2160 + .detect_quirks = asus_nb_wmi_quirks,
2161 + };
2162 +
2163 ++static const struct dmi_system_id asus_nb_wmi_blacklist[] __initconst = {
2164 ++ {
2165 ++ /*
2166 ++ * asus-nb-wm adds no functionality. The T100TA has a detachable
2167 ++ * USB kbd, so no hotkeys and it has no WMI rfkill; and loading
2168 ++ * asus-nb-wm causes the camera LED to turn and _stay_ on.
2169 ++ */
2170 ++ .matches = {
2171 ++ DMI_EXACT_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
2172 ++ DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "T100TA"),
2173 ++ },
2174 ++ },
2175 ++ {
2176 ++ /* The Asus T200TA has the same issue as the T100TA */
2177 ++ .matches = {
2178 ++ DMI_EXACT_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
2179 ++ DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "T200TA"),
2180 ++ },
2181 ++ },
2182 ++ {} /* Terminating entry */
2183 ++};
2184 +
2185 + static int __init asus_nb_wmi_init(void)
2186 + {
2187 ++ if (dmi_check_system(asus_nb_wmi_blacklist))
2188 ++ return -ENODEV;
2189 ++
2190 + return asus_wmi_register_driver(&asus_nb_wmi_driver);
2191 + }
2192 +
2193 +diff --git a/drivers/rapidio/devices/rio_mport_cdev.c b/drivers/rapidio/devices/rio_mport_cdev.c
2194 +index 8155f59ece38..10af330153b5 100644
2195 +--- a/drivers/rapidio/devices/rio_mport_cdev.c
2196 ++++ b/drivers/rapidio/devices/rio_mport_cdev.c
2197 +@@ -877,6 +877,11 @@ rio_dma_transfer(struct file *filp, u32 transfer_mode,
2198 + rmcd_error("pinned %ld out of %ld pages",
2199 + pinned, nr_pages);
2200 + ret = -EFAULT;
2201 ++ /*
2202 ++ * Set nr_pages up to mean "how many pages to unpin, in
2203 ++ * the error handler:
2204 ++ */
2205 ++ nr_pages = pinned;
2206 + goto err_pg;
2207 + }
2208 +
2209 +diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c
2210 +index 7f66a7783209..59f0f1030c54 100644
2211 +--- a/drivers/scsi/ibmvscsi/ibmvscsi.c
2212 ++++ b/drivers/scsi/ibmvscsi/ibmvscsi.c
2213 +@@ -2320,16 +2320,12 @@ static int ibmvscsi_probe(struct vio_dev *vdev, const struct vio_device_id *id)
2214 + static int ibmvscsi_remove(struct vio_dev *vdev)
2215 + {
2216 + struct ibmvscsi_host_data *hostdata = dev_get_drvdata(&vdev->dev);
2217 +- unsigned long flags;
2218 +
2219 + srp_remove_host(hostdata->host);
2220 + scsi_remove_host(hostdata->host);
2221 +
2222 + purge_requests(hostdata, DID_ERROR);
2223 +-
2224 +- spin_lock_irqsave(hostdata->host->host_lock, flags);
2225 + release_event_pool(&hostdata->pool, hostdata);
2226 +- spin_unlock_irqrestore(hostdata->host->host_lock, flags);
2227 +
2228 + ibmvscsi_release_crq_queue(&hostdata->queue, hostdata,
2229 + max_events);
2230 +diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c
2231 +index d7e7043f9eab..e3c45edd0e18 100644
2232 +--- a/drivers/scsi/qla2xxx/qla_attr.c
2233 ++++ b/drivers/scsi/qla2xxx/qla_attr.c
2234 +@@ -1777,9 +1777,6 @@ qla2x00_port_speed_show(struct device *dev, struct device_attribute *attr,
2235 + return -EINVAL;
2236 + }
2237 +
2238 +- ql_log(ql_log_info, vha, 0x70d6,
2239 +- "port speed:%d\n", ha->link_data_rate);
2240 +-
2241 + return scnprintf(buf, PAGE_SIZE, "%s\n", spd[ha->link_data_rate]);
2242 + }
2243 +
2244 +@@ -2928,11 +2925,11 @@ qla24xx_vport_delete(struct fc_vport *fc_vport)
2245 + test_bit(FCPORT_UPDATE_NEEDED, &vha->dpc_flags))
2246 + msleep(1000);
2247 +
2248 +- qla_nvme_delete(vha);
2249 +
2250 + qla24xx_disable_vp(vha);
2251 + qla2x00_wait_for_sess_deletion(vha);
2252 +
2253 ++ qla_nvme_delete(vha);
2254 + vha->flags.delete_progress = 1;
2255 +
2256 + qlt_remove_target(ha, vha);
2257 +diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c
2258 +index 9e09964f5c0e..7b341e41bb85 100644
2259 +--- a/drivers/scsi/qla2xxx/qla_mbx.c
2260 ++++ b/drivers/scsi/qla2xxx/qla_mbx.c
2261 +@@ -3117,7 +3117,7 @@ qla24xx_abort_command(srb_t *sp)
2262 + ql_dbg(ql_dbg_mbx + ql_dbg_verbose, vha, 0x108c,
2263 + "Entered %s.\n", __func__);
2264 +
2265 +- if (vha->flags.qpairs_available && sp->qpair)
2266 ++ if (sp->qpair)
2267 + req = sp->qpair->req;
2268 + else
2269 + return QLA_FUNCTION_FAILED;
2270 +diff --git a/drivers/staging/greybus/uart.c b/drivers/staging/greybus/uart.c
2271 +index 55c51143bb09..4ffb334cd5cd 100644
2272 +--- a/drivers/staging/greybus/uart.c
2273 ++++ b/drivers/staging/greybus/uart.c
2274 +@@ -537,9 +537,9 @@ static void gb_tty_set_termios(struct tty_struct *tty,
2275 + }
2276 +
2277 + if (C_CRTSCTS(tty) && C_BAUD(tty) != B0)
2278 +- newline.flow_control |= GB_SERIAL_AUTO_RTSCTS_EN;
2279 ++ newline.flow_control = GB_SERIAL_AUTO_RTSCTS_EN;
2280 + else
2281 +- newline.flow_control &= ~GB_SERIAL_AUTO_RTSCTS_EN;
2282 ++ newline.flow_control = 0;
2283 +
2284 + if (memcmp(&gb_tty->line_coding, &newline, sizeof(newline))) {
2285 + memcpy(&gb_tty->line_coding, &newline, sizeof(newline));
2286 +diff --git a/drivers/staging/iio/resolver/ad2s1210.c b/drivers/staging/iio/resolver/ad2s1210.c
2287 +index 4b25a3a314ed..ed404355ea4c 100644
2288 +--- a/drivers/staging/iio/resolver/ad2s1210.c
2289 ++++ b/drivers/staging/iio/resolver/ad2s1210.c
2290 +@@ -130,17 +130,24 @@ static int ad2s1210_config_write(struct ad2s1210_state *st, u8 data)
2291 + static int ad2s1210_config_read(struct ad2s1210_state *st,
2292 + unsigned char address)
2293 + {
2294 +- struct spi_transfer xfer = {
2295 +- .len = 2,
2296 +- .rx_buf = st->rx,
2297 +- .tx_buf = st->tx,
2298 ++ struct spi_transfer xfers[] = {
2299 ++ {
2300 ++ .len = 1,
2301 ++ .rx_buf = &st->rx[0],
2302 ++ .tx_buf = &st->tx[0],
2303 ++ .cs_change = 1,
2304 ++ }, {
2305 ++ .len = 1,
2306 ++ .rx_buf = &st->rx[1],
2307 ++ .tx_buf = &st->tx[1],
2308 ++ },
2309 + };
2310 + int ret = 0;
2311 +
2312 + ad2s1210_set_mode(MOD_CONFIG, st);
2313 + st->tx[0] = address | AD2S1210_MSB_IS_HIGH;
2314 + st->tx[1] = AD2S1210_REG_FAULT;
2315 +- ret = spi_sync_transfer(st->sdev, &xfer, 1);
2316 ++ ret = spi_sync_transfer(st->sdev, xfers, 2);
2317 + if (ret < 0)
2318 + return ret;
2319 +
2320 +diff --git a/drivers/staging/kpc2000/kpc2000/core.c b/drivers/staging/kpc2000/kpc2000/core.c
2321 +index 7b00d7069e21..358d7b2f4ad1 100644
2322 +--- a/drivers/staging/kpc2000/kpc2000/core.c
2323 ++++ b/drivers/staging/kpc2000/kpc2000/core.c
2324 +@@ -298,7 +298,6 @@ static int kp2000_pcie_probe(struct pci_dev *pdev,
2325 + {
2326 + int err = 0;
2327 + struct kp2000_device *pcard;
2328 +- int rv;
2329 + unsigned long reg_bar_phys_addr;
2330 + unsigned long reg_bar_phys_len;
2331 + unsigned long dma_bar_phys_addr;
2332 +@@ -445,11 +444,11 @@ static int kp2000_pcie_probe(struct pci_dev *pdev,
2333 + if (err < 0)
2334 + goto err_release_dma;
2335 +
2336 +- rv = request_irq(pcard->pdev->irq, kp2000_irq_handler, IRQF_SHARED,
2337 +- pcard->name, pcard);
2338 +- if (rv) {
2339 ++ err = request_irq(pcard->pdev->irq, kp2000_irq_handler, IRQF_SHARED,
2340 ++ pcard->name, pcard);
2341 ++ if (err) {
2342 + dev_err(&pcard->pdev->dev,
2343 +- "%s: failed to request_irq: %d\n", __func__, rv);
2344 ++ "%s: failed to request_irq: %d\n", __func__, err);
2345 + goto err_disable_msi;
2346 + }
2347 +
2348 +diff --git a/drivers/staging/wfx/scan.c b/drivers/staging/wfx/scan.c
2349 +index 6e1e50048651..9aa14331affd 100644
2350 +--- a/drivers/staging/wfx/scan.c
2351 ++++ b/drivers/staging/wfx/scan.c
2352 +@@ -57,8 +57,10 @@ static int send_scan_req(struct wfx_vif *wvif,
2353 + wvif->scan_abort = false;
2354 + reinit_completion(&wvif->scan_complete);
2355 + timeout = hif_scan(wvif, req, start_idx, i - start_idx);
2356 +- if (timeout < 0)
2357 ++ if (timeout < 0) {
2358 ++ wfx_tx_unlock(wvif->wdev);
2359 + return timeout;
2360 ++ }
2361 + ret = wait_for_completion_timeout(&wvif->scan_complete, timeout);
2362 + if (req->channels[start_idx]->max_power != wvif->vif->bss_conf.txpower)
2363 + hif_set_output_power(wvif, wvif->vif->bss_conf.txpower);
2364 +diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c
2365 +index 0ae9e60fc4d5..61486e5abee4 100644
2366 +--- a/drivers/target/target_core_transport.c
2367 ++++ b/drivers/target/target_core_transport.c
2368 +@@ -3349,6 +3349,7 @@ static void target_tmr_work(struct work_struct *work)
2369 +
2370 + cmd->se_tfo->queue_tm_rsp(cmd);
2371 +
2372 ++ transport_lun_remove_cmd(cmd);
2373 + transport_cmd_check_stop_to_fabric(cmd);
2374 + return;
2375 +
2376 +diff --git a/drivers/tty/serial/sifive.c b/drivers/tty/serial/sifive.c
2377 +index d5f81b98e4d7..38133eba83a8 100644
2378 +--- a/drivers/tty/serial/sifive.c
2379 ++++ b/drivers/tty/serial/sifive.c
2380 +@@ -840,6 +840,7 @@ console_initcall(sifive_console_init);
2381 +
2382 + static void __ssp_add_console_port(struct sifive_serial_port *ssp)
2383 + {
2384 ++ spin_lock_init(&ssp->port.lock);
2385 + sifive_serial_console_ports[ssp->port.line] = ssp;
2386 + }
2387 +
2388 +diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c
2389 +index 02eaac7e1e34..a1ac2f0723b0 100644
2390 +--- a/drivers/usb/core/message.c
2391 ++++ b/drivers/usb/core/message.c
2392 +@@ -1143,11 +1143,11 @@ void usb_disable_endpoint(struct usb_device *dev, unsigned int epaddr,
2393 +
2394 + if (usb_endpoint_out(epaddr)) {
2395 + ep = dev->ep_out[epnum];
2396 +- if (reset_hardware)
2397 ++ if (reset_hardware && epnum != 0)
2398 + dev->ep_out[epnum] = NULL;
2399 + } else {
2400 + ep = dev->ep_in[epnum];
2401 +- if (reset_hardware)
2402 ++ if (reset_hardware && epnum != 0)
2403 + dev->ep_in[epnum] = NULL;
2404 + }
2405 + if (ep) {
2406 +diff --git a/drivers/vhost/vsock.c b/drivers/vhost/vsock.c
2407 +index bb3f63386b47..53294c2f8cff 100644
2408 +--- a/drivers/vhost/vsock.c
2409 ++++ b/drivers/vhost/vsock.c
2410 +@@ -181,14 +181,14 @@ vhost_transport_do_send_pkt(struct vhost_vsock *vsock,
2411 + break;
2412 + }
2413 +
2414 +- vhost_add_used(vq, head, sizeof(pkt->hdr) + payload_len);
2415 +- added = true;
2416 +-
2417 +- /* Deliver to monitoring devices all correctly transmitted
2418 +- * packets.
2419 ++ /* Deliver to monitoring devices all packets that we
2420 ++ * will transmit.
2421 + */
2422 + virtio_transport_deliver_tap_pkt(pkt);
2423 +
2424 ++ vhost_add_used(vq, head, sizeof(pkt->hdr) + payload_len);
2425 ++ added = true;
2426 ++
2427 + pkt->off += payload_len;
2428 + total_len += payload_len;
2429 +
2430 +diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c
2431 +index 44375a22307b..341458fd95ca 100644
2432 +--- a/drivers/virtio/virtio_balloon.c
2433 ++++ b/drivers/virtio/virtio_balloon.c
2434 +@@ -14,7 +14,6 @@
2435 + #include <linux/slab.h>
2436 + #include <linux/module.h>
2437 + #include <linux/balloon_compaction.h>
2438 +-#include <linux/oom.h>
2439 + #include <linux/wait.h>
2440 + #include <linux/mm.h>
2441 + #include <linux/mount.h>
2442 +@@ -28,9 +27,7 @@
2443 + */
2444 + #define VIRTIO_BALLOON_PAGES_PER_PAGE (unsigned)(PAGE_SIZE >> VIRTIO_BALLOON_PFN_SHIFT)
2445 + #define VIRTIO_BALLOON_ARRAY_PFNS_MAX 256
2446 +-/* Maximum number of (4k) pages to deflate on OOM notifications. */
2447 +-#define VIRTIO_BALLOON_OOM_NR_PAGES 256
2448 +-#define VIRTIO_BALLOON_OOM_NOTIFY_PRIORITY 80
2449 ++#define VIRTBALLOON_OOM_NOTIFY_PRIORITY 80
2450 +
2451 + #define VIRTIO_BALLOON_FREE_PAGE_ALLOC_FLAG (__GFP_NORETRY | __GFP_NOWARN | \
2452 + __GFP_NOMEMALLOC)
2453 +@@ -115,11 +112,8 @@ struct virtio_balloon {
2454 + /* Memory statistics */
2455 + struct virtio_balloon_stat stats[VIRTIO_BALLOON_S_NR];
2456 +
2457 +- /* Shrinker to return free pages - VIRTIO_BALLOON_F_FREE_PAGE_HINT */
2458 ++ /* To register a shrinker to shrink memory upon memory pressure */
2459 + struct shrinker shrinker;
2460 +-
2461 +- /* OOM notifier to deflate on OOM - VIRTIO_BALLOON_F_DEFLATE_ON_OOM */
2462 +- struct notifier_block oom_nb;
2463 + };
2464 +
2465 + static struct virtio_device_id id_table[] = {
2466 +@@ -794,13 +788,50 @@ static unsigned long shrink_free_pages(struct virtio_balloon *vb,
2467 + return blocks_freed * VIRTIO_BALLOON_HINT_BLOCK_PAGES;
2468 + }
2469 +
2470 ++static unsigned long leak_balloon_pages(struct virtio_balloon *vb,
2471 ++ unsigned long pages_to_free)
2472 ++{
2473 ++ return leak_balloon(vb, pages_to_free * VIRTIO_BALLOON_PAGES_PER_PAGE) /
2474 ++ VIRTIO_BALLOON_PAGES_PER_PAGE;
2475 ++}
2476 ++
2477 ++static unsigned long shrink_balloon_pages(struct virtio_balloon *vb,
2478 ++ unsigned long pages_to_free)
2479 ++{
2480 ++ unsigned long pages_freed = 0;
2481 ++
2482 ++ /*
2483 ++ * One invocation of leak_balloon can deflate at most
2484 ++ * VIRTIO_BALLOON_ARRAY_PFNS_MAX balloon pages, so we call it
2485 ++ * multiple times to deflate pages till reaching pages_to_free.
2486 ++ */
2487 ++ while (vb->num_pages && pages_freed < pages_to_free)
2488 ++ pages_freed += leak_balloon_pages(vb,
2489 ++ pages_to_free - pages_freed);
2490 ++
2491 ++ update_balloon_size(vb);
2492 ++
2493 ++ return pages_freed;
2494 ++}
2495 ++
2496 + static unsigned long virtio_balloon_shrinker_scan(struct shrinker *shrinker,
2497 + struct shrink_control *sc)
2498 + {
2499 ++ unsigned long pages_to_free, pages_freed = 0;
2500 + struct virtio_balloon *vb = container_of(shrinker,
2501 + struct virtio_balloon, shrinker);
2502 +
2503 +- return shrink_free_pages(vb, sc->nr_to_scan);
2504 ++ pages_to_free = sc->nr_to_scan;
2505 ++
2506 ++ if (virtio_has_feature(vb->vdev, VIRTIO_BALLOON_F_FREE_PAGE_HINT))
2507 ++ pages_freed = shrink_free_pages(vb, pages_to_free);
2508 ++
2509 ++ if (pages_freed >= pages_to_free)
2510 ++ return pages_freed;
2511 ++
2512 ++ pages_freed += shrink_balloon_pages(vb, pages_to_free - pages_freed);
2513 ++
2514 ++ return pages_freed;
2515 + }
2516 +
2517 + static unsigned long virtio_balloon_shrinker_count(struct shrinker *shrinker,
2518 +@@ -808,22 +839,26 @@ static unsigned long virtio_balloon_shrinker_count(struct shrinker *shrinker,
2519 + {
2520 + struct virtio_balloon *vb = container_of(shrinker,
2521 + struct virtio_balloon, shrinker);
2522 ++ unsigned long count;
2523 ++
2524 ++ count = vb->num_pages / VIRTIO_BALLOON_PAGES_PER_PAGE;
2525 ++ count += vb->num_free_page_blocks * VIRTIO_BALLOON_HINT_BLOCK_PAGES;
2526 +
2527 +- return vb->num_free_page_blocks * VIRTIO_BALLOON_HINT_BLOCK_PAGES;
2528 ++ return count;
2529 + }
2530 +
2531 +-static int virtio_balloon_oom_notify(struct notifier_block *nb,
2532 +- unsigned long dummy, void *parm)
2533 ++static void virtio_balloon_unregister_shrinker(struct virtio_balloon *vb)
2534 + {
2535 +- struct virtio_balloon *vb = container_of(nb,
2536 +- struct virtio_balloon, oom_nb);
2537 +- unsigned long *freed = parm;
2538 ++ unregister_shrinker(&vb->shrinker);
2539 ++}
2540 +
2541 +- *freed += leak_balloon(vb, VIRTIO_BALLOON_OOM_NR_PAGES) /
2542 +- VIRTIO_BALLOON_PAGES_PER_PAGE;
2543 +- update_balloon_size(vb);
2544 ++static int virtio_balloon_register_shrinker(struct virtio_balloon *vb)
2545 ++{
2546 ++ vb->shrinker.scan_objects = virtio_balloon_shrinker_scan;
2547 ++ vb->shrinker.count_objects = virtio_balloon_shrinker_count;
2548 ++ vb->shrinker.seeks = DEFAULT_SEEKS;
2549 +
2550 +- return NOTIFY_OK;
2551 ++ return register_shrinker(&vb->shrinker);
2552 + }
2553 +
2554 + static int virtballoon_probe(struct virtio_device *vdev)
2555 +@@ -900,35 +935,22 @@ static int virtballoon_probe(struct virtio_device *vdev)
2556 + virtio_cwrite(vb->vdev, struct virtio_balloon_config,
2557 + poison_val, &poison_val);
2558 + }
2559 +-
2560 +- /*
2561 +- * We're allowed to reuse any free pages, even if they are
2562 +- * still to be processed by the host.
2563 +- */
2564 +- vb->shrinker.scan_objects = virtio_balloon_shrinker_scan;
2565 +- vb->shrinker.count_objects = virtio_balloon_shrinker_count;
2566 +- vb->shrinker.seeks = DEFAULT_SEEKS;
2567 +- err = register_shrinker(&vb->shrinker);
2568 ++ }
2569 ++ /*
2570 ++ * We continue to use VIRTIO_BALLOON_F_DEFLATE_ON_OOM to decide if a
2571 ++ * shrinker needs to be registered to relieve memory pressure.
2572 ++ */
2573 ++ if (virtio_has_feature(vb->vdev, VIRTIO_BALLOON_F_DEFLATE_ON_OOM)) {
2574 ++ err = virtio_balloon_register_shrinker(vb);
2575 + if (err)
2576 + goto out_del_balloon_wq;
2577 + }
2578 +- if (virtio_has_feature(vdev, VIRTIO_BALLOON_F_DEFLATE_ON_OOM)) {
2579 +- vb->oom_nb.notifier_call = virtio_balloon_oom_notify;
2580 +- vb->oom_nb.priority = VIRTIO_BALLOON_OOM_NOTIFY_PRIORITY;
2581 +- err = register_oom_notifier(&vb->oom_nb);
2582 +- if (err < 0)
2583 +- goto out_unregister_shrinker;
2584 +- }
2585 +-
2586 + virtio_device_ready(vdev);
2587 +
2588 + if (towards_target(vb))
2589 + virtballoon_changed(vdev);
2590 + return 0;
2591 +
2592 +-out_unregister_shrinker:
2593 +- if (virtio_has_feature(vdev, VIRTIO_BALLOON_F_FREE_PAGE_HINT))
2594 +- unregister_shrinker(&vb->shrinker);
2595 + out_del_balloon_wq:
2596 + if (virtio_has_feature(vdev, VIRTIO_BALLOON_F_FREE_PAGE_HINT))
2597 + destroy_workqueue(vb->balloon_wq);
2598 +@@ -967,11 +989,8 @@ static void virtballoon_remove(struct virtio_device *vdev)
2599 + {
2600 + struct virtio_balloon *vb = vdev->priv;
2601 +
2602 +- if (virtio_has_feature(vdev, VIRTIO_BALLOON_F_DEFLATE_ON_OOM))
2603 +- unregister_oom_notifier(&vb->oom_nb);
2604 +- if (virtio_has_feature(vdev, VIRTIO_BALLOON_F_FREE_PAGE_HINT))
2605 +- unregister_shrinker(&vb->shrinker);
2606 +-
2607 ++ if (virtio_has_feature(vb->vdev, VIRTIO_BALLOON_F_DEFLATE_ON_OOM))
2608 ++ virtio_balloon_unregister_shrinker(vb);
2609 + spin_lock_irq(&vb->stop_update_lock);
2610 + vb->stop_update = true;
2611 + spin_unlock_irq(&vb->stop_update_lock);
2612 +diff --git a/fs/afs/fs_probe.c b/fs/afs/fs_probe.c
2613 +index e1b9ed679045..02e976ca5732 100644
2614 +--- a/fs/afs/fs_probe.c
2615 ++++ b/fs/afs/fs_probe.c
2616 +@@ -32,9 +32,8 @@ void afs_fileserver_probe_result(struct afs_call *call)
2617 + struct afs_server *server = call->server;
2618 + unsigned int server_index = call->server_index;
2619 + unsigned int index = call->addr_ix;
2620 +- unsigned int rtt = UINT_MAX;
2621 ++ unsigned int rtt_us;
2622 + bool have_result = false;
2623 +- u64 _rtt;
2624 + int ret = call->error;
2625 +
2626 + _enter("%pU,%u", &server->uuid, index);
2627 +@@ -93,15 +92,9 @@ responded:
2628 + }
2629 + }
2630 +
2631 +- /* Get the RTT and scale it to fit into a 32-bit value that represents
2632 +- * over a minute of time so that we can access it with one instruction
2633 +- * on a 32-bit system.
2634 +- */
2635 +- _rtt = rxrpc_kernel_get_rtt(call->net->socket, call->rxcall);
2636 +- _rtt /= 64;
2637 +- rtt = (_rtt > UINT_MAX) ? UINT_MAX : _rtt;
2638 +- if (rtt < server->probe.rtt) {
2639 +- server->probe.rtt = rtt;
2640 ++ rtt_us = rxrpc_kernel_get_srtt(call->net->socket, call->rxcall);
2641 ++ if (rtt_us < server->probe.rtt) {
2642 ++ server->probe.rtt = rtt_us;
2643 + alist->preferred = index;
2644 + have_result = true;
2645 + }
2646 +@@ -113,8 +106,7 @@ out:
2647 + spin_unlock(&server->probe_lock);
2648 +
2649 + _debug("probe [%u][%u] %pISpc rtt=%u ret=%d",
2650 +- server_index, index, &alist->addrs[index].transport,
2651 +- (unsigned int)rtt, ret);
2652 ++ server_index, index, &alist->addrs[index].transport, rtt_us, ret);
2653 +
2654 + have_result |= afs_fs_probe_done(server);
2655 + if (have_result) {
2656 +diff --git a/fs/afs/fsclient.c b/fs/afs/fsclient.c
2657 +index 68fc46634346..d2b3798c1932 100644
2658 +--- a/fs/afs/fsclient.c
2659 ++++ b/fs/afs/fsclient.c
2660 +@@ -385,8 +385,6 @@ static int afs_deliver_fs_fetch_data(struct afs_call *call)
2661 + ASSERTCMP(req->offset, <=, PAGE_SIZE);
2662 + if (req->offset == PAGE_SIZE) {
2663 + req->offset = 0;
2664 +- if (req->page_done)
2665 +- req->page_done(req);
2666 + req->index++;
2667 + if (req->remain > 0)
2668 + goto begin_page;
2669 +@@ -440,11 +438,13 @@ static int afs_deliver_fs_fetch_data(struct afs_call *call)
2670 + if (req->offset < PAGE_SIZE)
2671 + zero_user_segment(req->pages[req->index],
2672 + req->offset, PAGE_SIZE);
2673 +- if (req->page_done)
2674 +- req->page_done(req);
2675 + req->offset = 0;
2676 + }
2677 +
2678 ++ if (req->page_done)
2679 ++ for (req->index = 0; req->index < req->nr_pages; req->index++)
2680 ++ req->page_done(req);
2681 ++
2682 + _leave(" = 0 [done]");
2683 + return 0;
2684 + }
2685 +diff --git a/fs/afs/vl_probe.c b/fs/afs/vl_probe.c
2686 +index 858498cc1b05..e3aa013c2177 100644
2687 +--- a/fs/afs/vl_probe.c
2688 ++++ b/fs/afs/vl_probe.c
2689 +@@ -31,10 +31,9 @@ void afs_vlserver_probe_result(struct afs_call *call)
2690 + struct afs_addr_list *alist = call->alist;
2691 + struct afs_vlserver *server = call->vlserver;
2692 + unsigned int server_index = call->server_index;
2693 ++ unsigned int rtt_us = 0;
2694 + unsigned int index = call->addr_ix;
2695 +- unsigned int rtt = UINT_MAX;
2696 + bool have_result = false;
2697 +- u64 _rtt;
2698 + int ret = call->error;
2699 +
2700 + _enter("%s,%u,%u,%d,%d", server->name, server_index, index, ret, call->abort_code);
2701 +@@ -93,15 +92,9 @@ responded:
2702 + }
2703 + }
2704 +
2705 +- /* Get the RTT and scale it to fit into a 32-bit value that represents
2706 +- * over a minute of time so that we can access it with one instruction
2707 +- * on a 32-bit system.
2708 +- */
2709 +- _rtt = rxrpc_kernel_get_rtt(call->net->socket, call->rxcall);
2710 +- _rtt /= 64;
2711 +- rtt = (_rtt > UINT_MAX) ? UINT_MAX : _rtt;
2712 +- if (rtt < server->probe.rtt) {
2713 +- server->probe.rtt = rtt;
2714 ++ rtt_us = rxrpc_kernel_get_srtt(call->net->socket, call->rxcall);
2715 ++ if (rtt_us < server->probe.rtt) {
2716 ++ server->probe.rtt = rtt_us;
2717 + alist->preferred = index;
2718 + have_result = true;
2719 + }
2720 +@@ -113,8 +106,7 @@ out:
2721 + spin_unlock(&server->probe_lock);
2722 +
2723 + _debug("probe [%u][%u] %pISpc rtt=%u ret=%d",
2724 +- server_index, index, &alist->addrs[index].transport,
2725 +- (unsigned int)rtt, ret);
2726 ++ server_index, index, &alist->addrs[index].transport, rtt_us, ret);
2727 +
2728 + have_result |= afs_vl_probe_done(server);
2729 + if (have_result) {
2730 +diff --git a/fs/afs/yfsclient.c b/fs/afs/yfsclient.c
2731 +index b5b45c57e1b1..fe413e7a5cf4 100644
2732 +--- a/fs/afs/yfsclient.c
2733 ++++ b/fs/afs/yfsclient.c
2734 +@@ -497,8 +497,6 @@ static int yfs_deliver_fs_fetch_data64(struct afs_call *call)
2735 + ASSERTCMP(req->offset, <=, PAGE_SIZE);
2736 + if (req->offset == PAGE_SIZE) {
2737 + req->offset = 0;
2738 +- if (req->page_done)
2739 +- req->page_done(req);
2740 + req->index++;
2741 + if (req->remain > 0)
2742 + goto begin_page;
2743 +@@ -556,11 +554,13 @@ static int yfs_deliver_fs_fetch_data64(struct afs_call *call)
2744 + if (req->offset < PAGE_SIZE)
2745 + zero_user_segment(req->pages[req->index],
2746 + req->offset, PAGE_SIZE);
2747 +- if (req->page_done)
2748 +- req->page_done(req);
2749 + req->offset = 0;
2750 + }
2751 +
2752 ++ if (req->page_done)
2753 ++ for (req->index = 0; req->index < req->nr_pages; req->index++)
2754 ++ req->page_done(req);
2755 ++
2756 + _leave(" = 0 [done]");
2757 + return 0;
2758 + }
2759 +diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c
2760 +index d050acc1fd5d..f50204380a65 100644
2761 +--- a/fs/ceph/caps.c
2762 ++++ b/fs/ceph/caps.c
2763 +@@ -3707,6 +3707,7 @@ retry:
2764 + WARN_ON(1);
2765 + tsession = NULL;
2766 + target = -1;
2767 ++ mutex_lock(&session->s_mutex);
2768 + }
2769 + goto retry;
2770 +
2771 +diff --git a/fs/configfs/dir.c b/fs/configfs/dir.c
2772 +index cf7b7e1d5bd7..cb733652ecca 100644
2773 +--- a/fs/configfs/dir.c
2774 ++++ b/fs/configfs/dir.c
2775 +@@ -1519,6 +1519,7 @@ static int configfs_rmdir(struct inode *dir, struct dentry *dentry)
2776 + spin_lock(&configfs_dirent_lock);
2777 + configfs_detach_rollback(dentry);
2778 + spin_unlock(&configfs_dirent_lock);
2779 ++ config_item_put(parent_item);
2780 + return -EINTR;
2781 + }
2782 + frag->frag_dead = true;
2783 +diff --git a/fs/file.c b/fs/file.c
2784 +index c8a4e4c86e55..abb8b7081d7a 100644
2785 +--- a/fs/file.c
2786 ++++ b/fs/file.c
2787 +@@ -70,7 +70,7 @@ static void copy_fd_bitmaps(struct fdtable *nfdt, struct fdtable *ofdt,
2788 + */
2789 + static void copy_fdtable(struct fdtable *nfdt, struct fdtable *ofdt)
2790 + {
2791 +- unsigned int cpy, set;
2792 ++ size_t cpy, set;
2793 +
2794 + BUG_ON(nfdt->max_fds < ofdt->max_fds);
2795 +
2796 +diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c
2797 +index 19ebc6cd0f2b..d0eceaff3cea 100644
2798 +--- a/fs/gfs2/glock.c
2799 ++++ b/fs/gfs2/glock.c
2800 +@@ -645,9 +645,6 @@ __acquires(&gl->gl_lockref.lock)
2801 + goto out_unlock;
2802 + if (nonblock)
2803 + goto out_sched;
2804 +- smp_mb();
2805 +- if (atomic_read(&gl->gl_revokes) != 0)
2806 +- goto out_sched;
2807 + set_bit(GLF_DEMOTE_IN_PROGRESS, &gl->gl_flags);
2808 + GLOCK_BUG_ON(gl, gl->gl_demote_state == LM_ST_EXCLUSIVE);
2809 + gl->gl_target = gl->gl_demote_state;
2810 +diff --git a/fs/overlayfs/export.c b/fs/overlayfs/export.c
2811 +index 6f54d70cef27..e605017031ee 100644
2812 +--- a/fs/overlayfs/export.c
2813 ++++ b/fs/overlayfs/export.c
2814 +@@ -777,6 +777,9 @@ static struct ovl_fh *ovl_fid_to_fh(struct fid *fid, int buflen, int fh_type)
2815 + if (fh_type != OVL_FILEID_V0)
2816 + return ERR_PTR(-EINVAL);
2817 +
2818 ++ if (buflen <= OVL_FH_WIRE_OFFSET)
2819 ++ return ERR_PTR(-EINVAL);
2820 ++
2821 + fh = kzalloc(buflen, GFP_KERNEL);
2822 + if (!fh)
2823 + return ERR_PTR(-ENOMEM);
2824 +diff --git a/fs/splice.c b/fs/splice.c
2825 +index d671936d0aad..39b11a9a6b98 100644
2826 +--- a/fs/splice.c
2827 ++++ b/fs/splice.c
2828 +@@ -1503,7 +1503,7 @@ static int opipe_prep(struct pipe_inode_info *pipe, unsigned int flags)
2829 + * Check pipe occupancy without the inode lock first. This function
2830 + * is speculative anyways, so missing one is ok.
2831 + */
2832 +- if (pipe_full(pipe->head, pipe->tail, pipe->max_usage))
2833 ++ if (!pipe_full(pipe->head, pipe->tail, pipe->max_usage))
2834 + return 0;
2835 +
2836 + ret = 0;
2837 +diff --git a/fs/ubifs/auth.c b/fs/ubifs/auth.c
2838 +index 8cdbd53d780c..f985a3fbbb36 100644
2839 +--- a/fs/ubifs/auth.c
2840 ++++ b/fs/ubifs/auth.c
2841 +@@ -79,13 +79,9 @@ int ubifs_prepare_auth_node(struct ubifs_info *c, void *node,
2842 + struct shash_desc *inhash)
2843 + {
2844 + struct ubifs_auth_node *auth = node;
2845 +- u8 *hash;
2846 ++ u8 hash[UBIFS_HASH_ARR_SZ];
2847 + int err;
2848 +
2849 +- hash = kmalloc(crypto_shash_descsize(c->hash_tfm), GFP_NOFS);
2850 +- if (!hash)
2851 +- return -ENOMEM;
2852 +-
2853 + {
2854 + SHASH_DESC_ON_STACK(hash_desc, c->hash_tfm);
2855 +
2856 +@@ -94,21 +90,16 @@ int ubifs_prepare_auth_node(struct ubifs_info *c, void *node,
2857 +
2858 + err = crypto_shash_final(hash_desc, hash);
2859 + if (err)
2860 +- goto out;
2861 ++ return err;
2862 + }
2863 +
2864 + err = ubifs_hash_calc_hmac(c, hash, auth->hmac);
2865 + if (err)
2866 +- goto out;
2867 ++ return err;
2868 +
2869 + auth->ch.node_type = UBIFS_AUTH_NODE;
2870 + ubifs_prepare_node(c, auth, ubifs_auth_node_sz(c), 0);
2871 +-
2872 +- err = 0;
2873 +-out:
2874 +- kfree(hash);
2875 +-
2876 +- return err;
2877 ++ return 0;
2878 + }
2879 +
2880 + static struct shash_desc *ubifs_get_desc(const struct ubifs_info *c,
2881 +diff --git a/fs/ubifs/file.c b/fs/ubifs/file.c
2882 +index 743928efffc1..49fe062ce45e 100644
2883 +--- a/fs/ubifs/file.c
2884 ++++ b/fs/ubifs/file.c
2885 +@@ -1375,7 +1375,6 @@ int ubifs_update_time(struct inode *inode, struct timespec64 *time,
2886 + struct ubifs_info *c = inode->i_sb->s_fs_info;
2887 + struct ubifs_budget_req req = { .dirtied_ino = 1,
2888 + .dirtied_ino_d = ALIGN(ui->data_len, 8) };
2889 +- int iflags = I_DIRTY_TIME;
2890 + int err, release;
2891 +
2892 + if (!IS_ENABLED(CONFIG_UBIFS_ATIME_SUPPORT))
2893 +@@ -1393,11 +1392,8 @@ int ubifs_update_time(struct inode *inode, struct timespec64 *time,
2894 + if (flags & S_MTIME)
2895 + inode->i_mtime = *time;
2896 +
2897 +- if (!(inode->i_sb->s_flags & SB_LAZYTIME))
2898 +- iflags |= I_DIRTY_SYNC;
2899 +-
2900 + release = ui->dirty;
2901 +- __mark_inode_dirty(inode, iflags);
2902 ++ __mark_inode_dirty(inode, I_DIRTY_SYNC);
2903 + mutex_unlock(&ui->ui_mutex);
2904 + if (release)
2905 + ubifs_release_budget(c, &req);
2906 +diff --git a/fs/ubifs/replay.c b/fs/ubifs/replay.c
2907 +index b28ac4dfb407..01fcf7975047 100644
2908 +--- a/fs/ubifs/replay.c
2909 ++++ b/fs/ubifs/replay.c
2910 +@@ -601,18 +601,12 @@ static int authenticate_sleb(struct ubifs_info *c, struct ubifs_scan_leb *sleb,
2911 + struct ubifs_scan_node *snod;
2912 + int n_nodes = 0;
2913 + int err;
2914 +- u8 *hash, *hmac;
2915 ++ u8 hash[UBIFS_HASH_ARR_SZ];
2916 ++ u8 hmac[UBIFS_HMAC_ARR_SZ];
2917 +
2918 + if (!ubifs_authenticated(c))
2919 + return sleb->nodes_cnt;
2920 +
2921 +- hash = kmalloc(crypto_shash_descsize(c->hash_tfm), GFP_NOFS);
2922 +- hmac = kmalloc(c->hmac_desc_len, GFP_NOFS);
2923 +- if (!hash || !hmac) {
2924 +- err = -ENOMEM;
2925 +- goto out;
2926 +- }
2927 +-
2928 + list_for_each_entry(snod, &sleb->nodes, list) {
2929 +
2930 + n_nodes++;
2931 +@@ -662,9 +656,6 @@ static int authenticate_sleb(struct ubifs_info *c, struct ubifs_scan_leb *sleb,
2932 + err = 0;
2933 + }
2934 + out:
2935 +- kfree(hash);
2936 +- kfree(hmac);
2937 +-
2938 + return err ? err : n_nodes - n_not_auth;
2939 + }
2940 +
2941 +diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h
2942 +index 81900b3cbe37..041bfa412aa0 100644
2943 +--- a/include/linux/platform_device.h
2944 ++++ b/include/linux/platform_device.h
2945 +@@ -25,7 +25,6 @@ struct platform_device {
2946 + bool id_auto;
2947 + struct device dev;
2948 + u64 platform_dma_mask;
2949 +- struct device_dma_parameters dma_parms;
2950 + u32 num_resources;
2951 + struct resource *resource;
2952 +
2953 +diff --git a/include/net/af_rxrpc.h b/include/net/af_rxrpc.h
2954 +index 04e97bab6f28..ab988940bf04 100644
2955 +--- a/include/net/af_rxrpc.h
2956 ++++ b/include/net/af_rxrpc.h
2957 +@@ -59,7 +59,7 @@ bool rxrpc_kernel_abort_call(struct socket *, struct rxrpc_call *,
2958 + void rxrpc_kernel_end_call(struct socket *, struct rxrpc_call *);
2959 + void rxrpc_kernel_get_peer(struct socket *, struct rxrpc_call *,
2960 + struct sockaddr_rxrpc *);
2961 +-u64 rxrpc_kernel_get_rtt(struct socket *, struct rxrpc_call *);
2962 ++u32 rxrpc_kernel_get_srtt(struct socket *, struct rxrpc_call *);
2963 + int rxrpc_kernel_charge_accept(struct socket *, rxrpc_notify_rx_t,
2964 + rxrpc_user_attach_call_t, unsigned long, gfp_t,
2965 + unsigned int);
2966 +diff --git a/include/net/drop_monitor.h b/include/net/drop_monitor.h
2967 +index 2ab668461463..f68bc373544a 100644
2968 +--- a/include/net/drop_monitor.h
2969 ++++ b/include/net/drop_monitor.h
2970 +@@ -19,7 +19,7 @@ struct net_dm_hw_metadata {
2971 + struct net_device *input_dev;
2972 + };
2973 +
2974 +-#if IS_ENABLED(CONFIG_NET_DROP_MONITOR)
2975 ++#if IS_REACHABLE(CONFIG_NET_DROP_MONITOR)
2976 + void net_dm_hw_report(struct sk_buff *skb,
2977 + const struct net_dm_hw_metadata *hw_metadata);
2978 + #else
2979 +diff --git a/include/trace/events/rxrpc.h b/include/trace/events/rxrpc.h
2980 +index 191fe447f990..ba9efdc848f9 100644
2981 +--- a/include/trace/events/rxrpc.h
2982 ++++ b/include/trace/events/rxrpc.h
2983 +@@ -1112,18 +1112,17 @@ TRACE_EVENT(rxrpc_rtt_tx,
2984 + TRACE_EVENT(rxrpc_rtt_rx,
2985 + TP_PROTO(struct rxrpc_call *call, enum rxrpc_rtt_rx_trace why,
2986 + rxrpc_serial_t send_serial, rxrpc_serial_t resp_serial,
2987 +- s64 rtt, u8 nr, s64 avg),
2988 ++ u32 rtt, u32 rto),
2989 +
2990 +- TP_ARGS(call, why, send_serial, resp_serial, rtt, nr, avg),
2991 ++ TP_ARGS(call, why, send_serial, resp_serial, rtt, rto),
2992 +
2993 + TP_STRUCT__entry(
2994 + __field(unsigned int, call )
2995 + __field(enum rxrpc_rtt_rx_trace, why )
2996 +- __field(u8, nr )
2997 + __field(rxrpc_serial_t, send_serial )
2998 + __field(rxrpc_serial_t, resp_serial )
2999 +- __field(s64, rtt )
3000 +- __field(u64, avg )
3001 ++ __field(u32, rtt )
3002 ++ __field(u32, rto )
3003 + ),
3004 +
3005 + TP_fast_assign(
3006 +@@ -1132,18 +1131,16 @@ TRACE_EVENT(rxrpc_rtt_rx,
3007 + __entry->send_serial = send_serial;
3008 + __entry->resp_serial = resp_serial;
3009 + __entry->rtt = rtt;
3010 +- __entry->nr = nr;
3011 +- __entry->avg = avg;
3012 ++ __entry->rto = rto;
3013 + ),
3014 +
3015 +- TP_printk("c=%08x %s sr=%08x rr=%08x rtt=%lld nr=%u avg=%lld",
3016 ++ TP_printk("c=%08x %s sr=%08x rr=%08x rtt=%u rto=%u",
3017 + __entry->call,
3018 + __print_symbolic(__entry->why, rxrpc_rtt_rx_traces),
3019 + __entry->send_serial,
3020 + __entry->resp_serial,
3021 + __entry->rtt,
3022 +- __entry->nr,
3023 +- __entry->avg)
3024 ++ __entry->rto)
3025 + );
3026 +
3027 + TRACE_EVENT(rxrpc_timer,
3028 +@@ -1544,6 +1541,41 @@ TRACE_EVENT(rxrpc_notify_socket,
3029 + __entry->serial)
3030 + );
3031 +
3032 ++TRACE_EVENT(rxrpc_rx_discard_ack,
3033 ++ TP_PROTO(unsigned int debug_id, rxrpc_serial_t serial,
3034 ++ rxrpc_seq_t first_soft_ack, rxrpc_seq_t call_ackr_first,
3035 ++ rxrpc_seq_t prev_pkt, rxrpc_seq_t call_ackr_prev),
3036 ++
3037 ++ TP_ARGS(debug_id, serial, first_soft_ack, call_ackr_first,
3038 ++ prev_pkt, call_ackr_prev),
3039 ++
3040 ++ TP_STRUCT__entry(
3041 ++ __field(unsigned int, debug_id )
3042 ++ __field(rxrpc_serial_t, serial )
3043 ++ __field(rxrpc_seq_t, first_soft_ack)
3044 ++ __field(rxrpc_seq_t, call_ackr_first)
3045 ++ __field(rxrpc_seq_t, prev_pkt)
3046 ++ __field(rxrpc_seq_t, call_ackr_prev)
3047 ++ ),
3048 ++
3049 ++ TP_fast_assign(
3050 ++ __entry->debug_id = debug_id;
3051 ++ __entry->serial = serial;
3052 ++ __entry->first_soft_ack = first_soft_ack;
3053 ++ __entry->call_ackr_first = call_ackr_first;
3054 ++ __entry->prev_pkt = prev_pkt;
3055 ++ __entry->call_ackr_prev = call_ackr_prev;
3056 ++ ),
3057 ++
3058 ++ TP_printk("c=%08x r=%08x %08x<%08x %08x<%08x",
3059 ++ __entry->debug_id,
3060 ++ __entry->serial,
3061 ++ __entry->first_soft_ack,
3062 ++ __entry->call_ackr_first,
3063 ++ __entry->prev_pkt,
3064 ++ __entry->call_ackr_prev)
3065 ++ );
3066 ++
3067 + #endif /* _TRACE_RXRPC_H */
3068 +
3069 + /* This part must be outside protection */
3070 +diff --git a/init/Kconfig b/init/Kconfig
3071 +index ef59c5c36cdb..59908e87ece2 100644
3072 +--- a/init/Kconfig
3073 ++++ b/init/Kconfig
3074 +@@ -2223,6 +2223,9 @@ config ASN1
3075 +
3076 + source "kernel/Kconfig.locks"
3077 +
3078 ++config ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE
3079 ++ bool
3080 ++
3081 + config ARCH_HAS_SYNC_CORE_BEFORE_USERMODE
3082 + bool
3083 +
3084 +diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c
3085 +index e04ea4c8f935..c0ab9bfdf28a 100644
3086 +--- a/kernel/bpf/syscall.c
3087 ++++ b/kernel/bpf/syscall.c
3088 +@@ -629,9 +629,20 @@ static int bpf_map_mmap(struct file *filp, struct vm_area_struct *vma)
3089 +
3090 + mutex_lock(&map->freeze_mutex);
3091 +
3092 +- if ((vma->vm_flags & VM_WRITE) && map->frozen) {
3093 +- err = -EPERM;
3094 +- goto out;
3095 ++ if (vma->vm_flags & VM_WRITE) {
3096 ++ if (map->frozen) {
3097 ++ err = -EPERM;
3098 ++ goto out;
3099 ++ }
3100 ++ /* map is meant to be read-only, so do not allow mapping as
3101 ++ * writable, because it's possible to leak a writable page
3102 ++ * reference and allows user-space to still modify it after
3103 ++ * freezing, while verifier will assume contents do not change
3104 ++ */
3105 ++ if (map->map_flags & BPF_F_RDONLY_PROG) {
3106 ++ err = -EACCES;
3107 ++ goto out;
3108 ++ }
3109 + }
3110 +
3111 + /* set default open/close callbacks */
3112 +diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
3113 +index c1bb5be530e9..775fca737909 100644
3114 +--- a/kernel/bpf/verifier.c
3115 ++++ b/kernel/bpf/verifier.c
3116 +@@ -4113,7 +4113,9 @@ static int do_refine_retval_range(struct bpf_verifier_env *env,
3117 +
3118 + if (ret_type != RET_INTEGER ||
3119 + (func_id != BPF_FUNC_get_stack &&
3120 +- func_id != BPF_FUNC_probe_read_str))
3121 ++ func_id != BPF_FUNC_probe_read_str &&
3122 ++ func_id != BPF_FUNC_probe_read_kernel_str &&
3123 ++ func_id != BPF_FUNC_probe_read_user_str))
3124 + return 0;
3125 +
3126 + /* Error case where ret is in interval [S32MIN, -1]. */
3127 +diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
3128 +index c76a20648b72..603d3d3cbf77 100644
3129 +--- a/kernel/sched/fair.c
3130 ++++ b/kernel/sched/fair.c
3131 +@@ -5276,32 +5276,38 @@ enqueue_task_fair(struct rq *rq, struct task_struct *p, int flags)
3132 + cfs_rq = cfs_rq_of(se);
3133 + enqueue_entity(cfs_rq, se, flags);
3134 +
3135 +- /*
3136 +- * end evaluation on encountering a throttled cfs_rq
3137 +- *
3138 +- * note: in the case of encountering a throttled cfs_rq we will
3139 +- * post the final h_nr_running increment below.
3140 +- */
3141 +- if (cfs_rq_throttled(cfs_rq))
3142 +- break;
3143 + cfs_rq->h_nr_running++;
3144 + cfs_rq->idle_h_nr_running += idle_h_nr_running;
3145 +
3146 ++ /* end evaluation on encountering a throttled cfs_rq */
3147 ++ if (cfs_rq_throttled(cfs_rq))
3148 ++ goto enqueue_throttle;
3149 ++
3150 + flags = ENQUEUE_WAKEUP;
3151 + }
3152 +
3153 + for_each_sched_entity(se) {
3154 + cfs_rq = cfs_rq_of(se);
3155 ++
3156 ++ update_load_avg(cfs_rq, se, UPDATE_TG);
3157 ++ update_cfs_group(se);
3158 ++
3159 + cfs_rq->h_nr_running++;
3160 + cfs_rq->idle_h_nr_running += idle_h_nr_running;
3161 +
3162 ++ /* end evaluation on encountering a throttled cfs_rq */
3163 + if (cfs_rq_throttled(cfs_rq))
3164 +- break;
3165 ++ goto enqueue_throttle;
3166 +
3167 +- update_load_avg(cfs_rq, se, UPDATE_TG);
3168 +- update_cfs_group(se);
3169 ++ /*
3170 ++ * One parent has been throttled and cfs_rq removed from the
3171 ++ * list. Add it back to not break the leaf list.
3172 ++ */
3173 ++ if (throttled_hierarchy(cfs_rq))
3174 ++ list_add_leaf_cfs_rq(cfs_rq);
3175 + }
3176 +
3177 ++enqueue_throttle:
3178 + if (!se) {
3179 + add_nr_running(rq, 1);
3180 + /*
3181 +@@ -5362,17 +5368,13 @@ static void dequeue_task_fair(struct rq *rq, struct task_struct *p, int flags)
3182 + cfs_rq = cfs_rq_of(se);
3183 + dequeue_entity(cfs_rq, se, flags);
3184 +
3185 +- /*
3186 +- * end evaluation on encountering a throttled cfs_rq
3187 +- *
3188 +- * note: in the case of encountering a throttled cfs_rq we will
3189 +- * post the final h_nr_running decrement below.
3190 +- */
3191 +- if (cfs_rq_throttled(cfs_rq))
3192 +- break;
3193 + cfs_rq->h_nr_running--;
3194 + cfs_rq->idle_h_nr_running -= idle_h_nr_running;
3195 +
3196 ++ /* end evaluation on encountering a throttled cfs_rq */
3197 ++ if (cfs_rq_throttled(cfs_rq))
3198 ++ goto dequeue_throttle;
3199 ++
3200 + /* Don't dequeue parent if it has other entities besides us */
3201 + if (cfs_rq->load.weight) {
3202 + /* Avoid re-evaluating load for this entity: */
3203 +@@ -5390,16 +5392,20 @@ static void dequeue_task_fair(struct rq *rq, struct task_struct *p, int flags)
3204 +
3205 + for_each_sched_entity(se) {
3206 + cfs_rq = cfs_rq_of(se);
3207 ++
3208 ++ update_load_avg(cfs_rq, se, UPDATE_TG);
3209 ++ update_cfs_group(se);
3210 ++
3211 + cfs_rq->h_nr_running--;
3212 + cfs_rq->idle_h_nr_running -= idle_h_nr_running;
3213 +
3214 ++ /* end evaluation on encountering a throttled cfs_rq */
3215 + if (cfs_rq_throttled(cfs_rq))
3216 +- break;
3217 ++ goto dequeue_throttle;
3218 +
3219 +- update_load_avg(cfs_rq, se, UPDATE_TG);
3220 +- update_cfs_group(se);
3221 + }
3222 +
3223 ++dequeue_throttle:
3224 + if (!se)
3225 + sub_nr_running(rq, 1);
3226 +
3227 +diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c
3228 +index b899a2d7e900..158233a2ab6c 100644
3229 +--- a/kernel/trace/bpf_trace.c
3230 ++++ b/kernel/trace/bpf_trace.c
3231 +@@ -857,14 +857,16 @@ tracing_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog)
3232 + return &bpf_probe_read_user_proto;
3233 + case BPF_FUNC_probe_read_kernel:
3234 + return &bpf_probe_read_kernel_proto;
3235 +- case BPF_FUNC_probe_read:
3236 +- return &bpf_probe_read_compat_proto;
3237 + case BPF_FUNC_probe_read_user_str:
3238 + return &bpf_probe_read_user_str_proto;
3239 + case BPF_FUNC_probe_read_kernel_str:
3240 + return &bpf_probe_read_kernel_str_proto;
3241 ++#ifdef CONFIG_ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE
3242 ++ case BPF_FUNC_probe_read:
3243 ++ return &bpf_probe_read_compat_proto;
3244 + case BPF_FUNC_probe_read_str:
3245 + return &bpf_probe_read_compat_str_proto;
3246 ++#endif
3247 + #ifdef CONFIG_CGROUPS
3248 + case BPF_FUNC_get_current_cgroup_id:
3249 + return &bpf_get_current_cgroup_id_proto;
3250 +diff --git a/lib/test_printf.c b/lib/test_printf.c
3251 +index 2d9f520d2f27..6b1622f4d7c2 100644
3252 +--- a/lib/test_printf.c
3253 ++++ b/lib/test_printf.c
3254 +@@ -214,6 +214,7 @@ test_string(void)
3255 + #define PTR_STR "ffff0123456789ab"
3256 + #define PTR_VAL_NO_CRNG "(____ptrval____)"
3257 + #define ZEROS "00000000" /* hex 32 zero bits */
3258 ++#define ONES "ffffffff" /* hex 32 one bits */
3259 +
3260 + static int __init
3261 + plain_format(void)
3262 +@@ -245,6 +246,7 @@ plain_format(void)
3263 + #define PTR_STR "456789ab"
3264 + #define PTR_VAL_NO_CRNG "(ptrval)"
3265 + #define ZEROS ""
3266 ++#define ONES ""
3267 +
3268 + static int __init
3269 + plain_format(void)
3270 +@@ -330,14 +332,28 @@ test_hashed(const char *fmt, const void *p)
3271 + test(buf, fmt, p);
3272 + }
3273 +
3274 ++/*
3275 ++ * NULL pointers aren't hashed.
3276 ++ */
3277 + static void __init
3278 + null_pointer(void)
3279 + {
3280 +- test_hashed("%p", NULL);
3281 ++ test(ZEROS "00000000", "%p", NULL);
3282 + test(ZEROS "00000000", "%px", NULL);
3283 + test("(null)", "%pE", NULL);
3284 + }
3285 +
3286 ++/*
3287 ++ * Error pointers aren't hashed.
3288 ++ */
3289 ++static void __init
3290 ++error_pointer(void)
3291 ++{
3292 ++ test(ONES "fffffff5", "%p", ERR_PTR(-11));
3293 ++ test(ONES "fffffff5", "%px", ERR_PTR(-11));
3294 ++ test("(efault)", "%pE", ERR_PTR(-11));
3295 ++}
3296 ++
3297 + #define PTR_INVALID ((void *)0x000000ab)
3298 +
3299 + static void __init
3300 +@@ -649,6 +665,7 @@ test_pointer(void)
3301 + {
3302 + plain();
3303 + null_pointer();
3304 ++ error_pointer();
3305 + invalid_pointer();
3306 + symbol_ptr();
3307 + kernel_ptr();
3308 +diff --git a/lib/vsprintf.c b/lib/vsprintf.c
3309 +index 532b6606a18a..7c47ad52ce2f 100644
3310 +--- a/lib/vsprintf.c
3311 ++++ b/lib/vsprintf.c
3312 +@@ -794,6 +794,13 @@ static char *ptr_to_id(char *buf, char *end, const void *ptr,
3313 + unsigned long hashval;
3314 + int ret;
3315 +
3316 ++ /*
3317 ++ * Print the real pointer value for NULL and error pointers,
3318 ++ * as they are not actual addresses.
3319 ++ */
3320 ++ if (IS_ERR_OR_NULL(ptr))
3321 ++ return pointer_string(buf, end, ptr, spec);
3322 ++
3323 + /* When debugging early boot use non-cryptographically secure hash. */
3324 + if (unlikely(debug_boot_weak_hash)) {
3325 + hashval = hash_long((unsigned long)ptr, 32);
3326 +diff --git a/mm/kasan/Makefile b/mm/kasan/Makefile
3327 +index 08b43de2383b..f36ffc090f5f 100644
3328 +--- a/mm/kasan/Makefile
3329 ++++ b/mm/kasan/Makefile
3330 +@@ -14,10 +14,10 @@ CFLAGS_REMOVE_tags.o = $(CC_FLAGS_FTRACE)
3331 + # Function splitter causes unnecessary splits in __asan_load1/__asan_store1
3332 + # see: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63533
3333 +
3334 +-CFLAGS_common.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector)
3335 +-CFLAGS_generic.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector)
3336 +-CFLAGS_generic_report.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector)
3337 +-CFLAGS_tags.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector)
3338 ++CFLAGS_common.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector) -DDISABLE_BRANCH_PROFILING
3339 ++CFLAGS_generic.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector) -DDISABLE_BRANCH_PROFILING
3340 ++CFLAGS_generic_report.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector) -DDISABLE_BRANCH_PROFILING
3341 ++CFLAGS_tags.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector) -DDISABLE_BRANCH_PROFILING
3342 +
3343 + obj-$(CONFIG_KASAN) := common.o init.o report.o
3344 + obj-$(CONFIG_KASAN_GENERIC) += generic.o generic_report.o quarantine.o
3345 +diff --git a/mm/kasan/generic.c b/mm/kasan/generic.c
3346 +index 616f9dd82d12..76a80033e0b7 100644
3347 +--- a/mm/kasan/generic.c
3348 ++++ b/mm/kasan/generic.c
3349 +@@ -15,7 +15,6 @@
3350 + */
3351 +
3352 + #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
3353 +-#define DISABLE_BRANCH_PROFILING
3354 +
3355 + #include <linux/export.h>
3356 + #include <linux/interrupt.h>
3357 +diff --git a/mm/kasan/tags.c b/mm/kasan/tags.c
3358 +index 0e987c9ca052..caf4efd9888c 100644
3359 +--- a/mm/kasan/tags.c
3360 ++++ b/mm/kasan/tags.c
3361 +@@ -12,7 +12,6 @@
3362 + */
3363 +
3364 + #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
3365 +-#define DISABLE_BRANCH_PROFILING
3366 +
3367 + #include <linux/export.h>
3368 + #include <linux/interrupt.h>
3369 +diff --git a/mm/z3fold.c b/mm/z3fold.c
3370 +index 42f31c4b53ad..8c3bb5e508b8 100644
3371 +--- a/mm/z3fold.c
3372 ++++ b/mm/z3fold.c
3373 +@@ -318,16 +318,16 @@ static inline void free_handle(unsigned long handle)
3374 + slots = handle_to_slots(handle);
3375 + write_lock(&slots->lock);
3376 + *(unsigned long *)handle = 0;
3377 +- write_unlock(&slots->lock);
3378 +- if (zhdr->slots == slots)
3379 ++ if (zhdr->slots == slots) {
3380 ++ write_unlock(&slots->lock);
3381 + return; /* simple case, nothing else to do */
3382 ++ }
3383 +
3384 + /* we are freeing a foreign handle if we are here */
3385 + zhdr->foreign_handles--;
3386 + is_free = true;
3387 +- read_lock(&slots->lock);
3388 + if (!test_bit(HANDLES_ORPHANED, &slots->pool)) {
3389 +- read_unlock(&slots->lock);
3390 ++ write_unlock(&slots->lock);
3391 + return;
3392 + }
3393 + for (i = 0; i <= BUDDY_MASK; i++) {
3394 +@@ -336,7 +336,7 @@ static inline void free_handle(unsigned long handle)
3395 + break;
3396 + }
3397 + }
3398 +- read_unlock(&slots->lock);
3399 ++ write_unlock(&slots->lock);
3400 +
3401 + if (is_free) {
3402 + struct z3fold_pool *pool = slots_to_pool(slots);
3403 +@@ -422,6 +422,7 @@ static struct z3fold_header *init_z3fold_page(struct page *page, bool headless,
3404 + zhdr->start_middle = 0;
3405 + zhdr->cpu = -1;
3406 + zhdr->foreign_handles = 0;
3407 ++ zhdr->mapped_count = 0;
3408 + zhdr->slots = slots;
3409 + zhdr->pool = pool;
3410 + INIT_LIST_HEAD(&zhdr->buddy);
3411 +diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c
3412 +index a1670dff0629..0e5012d7b7b5 100644
3413 +--- a/net/core/flow_dissector.c
3414 ++++ b/net/core/flow_dissector.c
3415 +@@ -160,12 +160,10 @@ out:
3416 + return ret;
3417 + }
3418 +
3419 +-int skb_flow_dissector_bpf_prog_detach(const union bpf_attr *attr)
3420 ++static int flow_dissector_bpf_prog_detach(struct net *net)
3421 + {
3422 + struct bpf_prog *attached;
3423 +- struct net *net;
3424 +
3425 +- net = current->nsproxy->net_ns;
3426 + mutex_lock(&flow_dissector_mutex);
3427 + attached = rcu_dereference_protected(net->flow_dissector_prog,
3428 + lockdep_is_held(&flow_dissector_mutex));
3429 +@@ -179,6 +177,24 @@ int skb_flow_dissector_bpf_prog_detach(const union bpf_attr *attr)
3430 + return 0;
3431 + }
3432 +
3433 ++int skb_flow_dissector_bpf_prog_detach(const union bpf_attr *attr)
3434 ++{
3435 ++ return flow_dissector_bpf_prog_detach(current->nsproxy->net_ns);
3436 ++}
3437 ++
3438 ++static void __net_exit flow_dissector_pernet_pre_exit(struct net *net)
3439 ++{
3440 ++ /* We're not racing with attach/detach because there are no
3441 ++ * references to netns left when pre_exit gets called.
3442 ++ */
3443 ++ if (rcu_access_pointer(net->flow_dissector_prog))
3444 ++ flow_dissector_bpf_prog_detach(net);
3445 ++}
3446 ++
3447 ++static struct pernet_operations flow_dissector_pernet_ops __net_initdata = {
3448 ++ .pre_exit = flow_dissector_pernet_pre_exit,
3449 ++};
3450 ++
3451 + /**
3452 + * __skb_flow_get_ports - extract the upper layer ports and return them
3453 + * @skb: sk_buff to extract the ports from
3454 +@@ -1838,7 +1854,7 @@ static int __init init_default_flow_dissectors(void)
3455 + skb_flow_dissector_init(&flow_keys_basic_dissector,
3456 + flow_keys_basic_dissector_keys,
3457 + ARRAY_SIZE(flow_keys_basic_dissector_keys));
3458 +- return 0;
3459 +-}
3460 +
3461 ++ return register_pernet_subsys(&flow_dissector_pernet_ops);
3462 ++}
3463 + core_initcall(init_default_flow_dissectors);
3464 +diff --git a/net/rxrpc/Makefile b/net/rxrpc/Makefile
3465 +index 6ffb7e9887ce..ddd0f95713a9 100644
3466 +--- a/net/rxrpc/Makefile
3467 ++++ b/net/rxrpc/Makefile
3468 +@@ -25,6 +25,7 @@ rxrpc-y := \
3469 + peer_event.o \
3470 + peer_object.o \
3471 + recvmsg.o \
3472 ++ rtt.o \
3473 + security.o \
3474 + sendmsg.o \
3475 + skbuff.o \
3476 +diff --git a/net/rxrpc/ar-internal.h b/net/rxrpc/ar-internal.h
3477 +index 3eb1ab40ca5c..9fe264bec70c 100644
3478 +--- a/net/rxrpc/ar-internal.h
3479 ++++ b/net/rxrpc/ar-internal.h
3480 +@@ -7,6 +7,7 @@
3481 +
3482 + #include <linux/atomic.h>
3483 + #include <linux/seqlock.h>
3484 ++#include <linux/win_minmax.h>
3485 + #include <net/net_namespace.h>
3486 + #include <net/netns/generic.h>
3487 + #include <net/sock.h>
3488 +@@ -311,11 +312,14 @@ struct rxrpc_peer {
3489 + #define RXRPC_RTT_CACHE_SIZE 32
3490 + spinlock_t rtt_input_lock; /* RTT lock for input routine */
3491 + ktime_t rtt_last_req; /* Time of last RTT request */
3492 +- u64 rtt; /* Current RTT estimate (in nS) */
3493 +- u64 rtt_sum; /* Sum of cache contents */
3494 +- u64 rtt_cache[RXRPC_RTT_CACHE_SIZE]; /* Determined RTT cache */
3495 +- u8 rtt_cursor; /* next entry at which to insert */
3496 +- u8 rtt_usage; /* amount of cache actually used */
3497 ++ unsigned int rtt_count; /* Number of samples we've got */
3498 ++
3499 ++ u32 srtt_us; /* smoothed round trip time << 3 in usecs */
3500 ++ u32 mdev_us; /* medium deviation */
3501 ++ u32 mdev_max_us; /* maximal mdev for the last rtt period */
3502 ++ u32 rttvar_us; /* smoothed mdev_max */
3503 ++ u32 rto_j; /* Retransmission timeout in jiffies */
3504 ++ u8 backoff; /* Backoff timeout */
3505 +
3506 + u8 cong_cwnd; /* Congestion window size */
3507 + };
3508 +@@ -1041,7 +1045,6 @@ extern unsigned long rxrpc_idle_ack_delay;
3509 + extern unsigned int rxrpc_rx_window_size;
3510 + extern unsigned int rxrpc_rx_mtu;
3511 + extern unsigned int rxrpc_rx_jumbo_max;
3512 +-extern unsigned long rxrpc_resend_timeout;
3513 +
3514 + extern const s8 rxrpc_ack_priority[];
3515 +
3516 +@@ -1069,8 +1072,6 @@ void rxrpc_send_keepalive(struct rxrpc_peer *);
3517 + * peer_event.c
3518 + */
3519 + void rxrpc_error_report(struct sock *);
3520 +-void rxrpc_peer_add_rtt(struct rxrpc_call *, enum rxrpc_rtt_rx_trace,
3521 +- rxrpc_serial_t, rxrpc_serial_t, ktime_t, ktime_t);
3522 + void rxrpc_peer_keepalive_worker(struct work_struct *);
3523 +
3524 + /*
3525 +@@ -1102,6 +1103,14 @@ extern const struct seq_operations rxrpc_peer_seq_ops;
3526 + void rxrpc_notify_socket(struct rxrpc_call *);
3527 + int rxrpc_recvmsg(struct socket *, struct msghdr *, size_t, int);
3528 +
3529 ++/*
3530 ++ * rtt.c
3531 ++ */
3532 ++void rxrpc_peer_add_rtt(struct rxrpc_call *, enum rxrpc_rtt_rx_trace,
3533 ++ rxrpc_serial_t, rxrpc_serial_t, ktime_t, ktime_t);
3534 ++unsigned long rxrpc_get_rto_backoff(struct rxrpc_peer *, bool);
3535 ++void rxrpc_peer_init_rtt(struct rxrpc_peer *);
3536 ++
3537 + /*
3538 + * rxkad.c
3539 + */
3540 +diff --git a/net/rxrpc/call_accept.c b/net/rxrpc/call_accept.c
3541 +index 70e44abf106c..b7611cc159e5 100644
3542 +--- a/net/rxrpc/call_accept.c
3543 ++++ b/net/rxrpc/call_accept.c
3544 +@@ -248,7 +248,7 @@ static void rxrpc_send_ping(struct rxrpc_call *call, struct sk_buff *skb)
3545 + struct rxrpc_skb_priv *sp = rxrpc_skb(skb);
3546 + ktime_t now = skb->tstamp;
3547 +
3548 +- if (call->peer->rtt_usage < 3 ||
3549 ++ if (call->peer->rtt_count < 3 ||
3550 + ktime_before(ktime_add_ms(call->peer->rtt_last_req, 1000), now))
3551 + rxrpc_propose_ACK(call, RXRPC_ACK_PING, sp->hdr.serial,
3552 + true, true,
3553 +diff --git a/net/rxrpc/call_event.c b/net/rxrpc/call_event.c
3554 +index cedbbb3a7c2e..2a65ac41055f 100644
3555 +--- a/net/rxrpc/call_event.c
3556 ++++ b/net/rxrpc/call_event.c
3557 +@@ -111,8 +111,8 @@ static void __rxrpc_propose_ACK(struct rxrpc_call *call, u8 ack_reason,
3558 + } else {
3559 + unsigned long now = jiffies, ack_at;
3560 +
3561 +- if (call->peer->rtt_usage > 0)
3562 +- ack_at = nsecs_to_jiffies(call->peer->rtt);
3563 ++ if (call->peer->srtt_us != 0)
3564 ++ ack_at = usecs_to_jiffies(call->peer->srtt_us >> 3);
3565 + else
3566 + ack_at = expiry;
3567 +
3568 +@@ -157,24 +157,18 @@ static void rxrpc_congestion_timeout(struct rxrpc_call *call)
3569 + static void rxrpc_resend(struct rxrpc_call *call, unsigned long now_j)
3570 + {
3571 + struct sk_buff *skb;
3572 +- unsigned long resend_at;
3573 ++ unsigned long resend_at, rto_j;
3574 + rxrpc_seq_t cursor, seq, top;
3575 +- ktime_t now, max_age, oldest, ack_ts, timeout, min_timeo;
3576 ++ ktime_t now, max_age, oldest, ack_ts;
3577 + int ix;
3578 + u8 annotation, anno_type, retrans = 0, unacked = 0;
3579 +
3580 + _enter("{%d,%d}", call->tx_hard_ack, call->tx_top);
3581 +
3582 +- if (call->peer->rtt_usage > 1)
3583 +- timeout = ns_to_ktime(call->peer->rtt * 3 / 2);
3584 +- else
3585 +- timeout = ms_to_ktime(rxrpc_resend_timeout);
3586 +- min_timeo = ns_to_ktime((1000000000 / HZ) * 4);
3587 +- if (ktime_before(timeout, min_timeo))
3588 +- timeout = min_timeo;
3589 ++ rto_j = call->peer->rto_j;
3590 +
3591 + now = ktime_get_real();
3592 +- max_age = ktime_sub(now, timeout);
3593 ++ max_age = ktime_sub(now, jiffies_to_usecs(rto_j));
3594 +
3595 + spin_lock_bh(&call->lock);
3596 +
3597 +@@ -219,7 +213,7 @@ static void rxrpc_resend(struct rxrpc_call *call, unsigned long now_j)
3598 + }
3599 +
3600 + resend_at = nsecs_to_jiffies(ktime_to_ns(ktime_sub(now, oldest)));
3601 +- resend_at += jiffies + rxrpc_resend_timeout;
3602 ++ resend_at += jiffies + rto_j;
3603 + WRITE_ONCE(call->resend_at, resend_at);
3604 +
3605 + if (unacked)
3606 +@@ -234,7 +228,7 @@ static void rxrpc_resend(struct rxrpc_call *call, unsigned long now_j)
3607 + rxrpc_timer_set_for_resend);
3608 + spin_unlock_bh(&call->lock);
3609 + ack_ts = ktime_sub(now, call->acks_latest_ts);
3610 +- if (ktime_to_ns(ack_ts) < call->peer->rtt)
3611 ++ if (ktime_to_us(ack_ts) < (call->peer->srtt_us >> 3))
3612 + goto out;
3613 + rxrpc_propose_ACK(call, RXRPC_ACK_PING, 0, true, false,
3614 + rxrpc_propose_ack_ping_for_lost_ack);
3615 +diff --git a/net/rxrpc/input.c b/net/rxrpc/input.c
3616 +index 69e09d69c896..3be4177baf70 100644
3617 +--- a/net/rxrpc/input.c
3618 ++++ b/net/rxrpc/input.c
3619 +@@ -91,11 +91,11 @@ static void rxrpc_congestion_management(struct rxrpc_call *call,
3620 + /* We analyse the number of packets that get ACK'd per RTT
3621 + * period and increase the window if we managed to fill it.
3622 + */
3623 +- if (call->peer->rtt_usage == 0)
3624 ++ if (call->peer->rtt_count == 0)
3625 + goto out;
3626 + if (ktime_before(skb->tstamp,
3627 +- ktime_add_ns(call->cong_tstamp,
3628 +- call->peer->rtt)))
3629 ++ ktime_add_us(call->cong_tstamp,
3630 ++ call->peer->srtt_us >> 3)))
3631 + goto out_no_clear_ca;
3632 + change = rxrpc_cong_rtt_window_end;
3633 + call->cong_tstamp = skb->tstamp;
3634 +@@ -802,6 +802,30 @@ static void rxrpc_input_soft_acks(struct rxrpc_call *call, u8 *acks,
3635 + }
3636 + }
3637 +
3638 ++/*
3639 ++ * Return true if the ACK is valid - ie. it doesn't appear to have regressed
3640 ++ * with respect to the ack state conveyed by preceding ACKs.
3641 ++ */
3642 ++static bool rxrpc_is_ack_valid(struct rxrpc_call *call,
3643 ++ rxrpc_seq_t first_pkt, rxrpc_seq_t prev_pkt)
3644 ++{
3645 ++ rxrpc_seq_t base = READ_ONCE(call->ackr_first_seq);
3646 ++
3647 ++ if (after(first_pkt, base))
3648 ++ return true; /* The window advanced */
3649 ++
3650 ++ if (before(first_pkt, base))
3651 ++ return false; /* firstPacket regressed */
3652 ++
3653 ++ if (after_eq(prev_pkt, call->ackr_prev_seq))
3654 ++ return true; /* previousPacket hasn't regressed. */
3655 ++
3656 ++ /* Some rx implementations put a serial number in previousPacket. */
3657 ++ if (after_eq(prev_pkt, base + call->tx_winsize))
3658 ++ return false;
3659 ++ return true;
3660 ++}
3661 ++
3662 + /*
3663 + * Process an ACK packet.
3664 + *
3665 +@@ -865,9 +889,12 @@ static void rxrpc_input_ack(struct rxrpc_call *call, struct sk_buff *skb)
3666 + }
3667 +
3668 + /* Discard any out-of-order or duplicate ACKs (outside lock). */
3669 +- if (before(first_soft_ack, call->ackr_first_seq) ||
3670 +- before(prev_pkt, call->ackr_prev_seq))
3671 ++ if (!rxrpc_is_ack_valid(call, first_soft_ack, prev_pkt)) {
3672 ++ trace_rxrpc_rx_discard_ack(call->debug_id, sp->hdr.serial,
3673 ++ first_soft_ack, call->ackr_first_seq,
3674 ++ prev_pkt, call->ackr_prev_seq);
3675 + return;
3676 ++ }
3677 +
3678 + buf.info.rxMTU = 0;
3679 + ioffset = offset + nr_acks + 3;
3680 +@@ -878,9 +905,12 @@ static void rxrpc_input_ack(struct rxrpc_call *call, struct sk_buff *skb)
3681 + spin_lock(&call->input_lock);
3682 +
3683 + /* Discard any out-of-order or duplicate ACKs (inside lock). */
3684 +- if (before(first_soft_ack, call->ackr_first_seq) ||
3685 +- before(prev_pkt, call->ackr_prev_seq))
3686 ++ if (!rxrpc_is_ack_valid(call, first_soft_ack, prev_pkt)) {
3687 ++ trace_rxrpc_rx_discard_ack(call->debug_id, sp->hdr.serial,
3688 ++ first_soft_ack, call->ackr_first_seq,
3689 ++ prev_pkt, call->ackr_prev_seq);
3690 + goto out;
3691 ++ }
3692 + call->acks_latest_ts = skb->tstamp;
3693 +
3694 + call->ackr_first_seq = first_soft_ack;
3695 +diff --git a/net/rxrpc/misc.c b/net/rxrpc/misc.c
3696 +index 214405f75346..d4144fd86f84 100644
3697 +--- a/net/rxrpc/misc.c
3698 ++++ b/net/rxrpc/misc.c
3699 +@@ -63,11 +63,6 @@ unsigned int rxrpc_rx_mtu = 5692;
3700 + */
3701 + unsigned int rxrpc_rx_jumbo_max = 4;
3702 +
3703 +-/*
3704 +- * Time till packet resend (in milliseconds).
3705 +- */
3706 +-unsigned long rxrpc_resend_timeout = 4 * HZ;
3707 +-
3708 + const s8 rxrpc_ack_priority[] = {
3709 + [0] = 0,
3710 + [RXRPC_ACK_DELAY] = 1,
3711 +diff --git a/net/rxrpc/output.c b/net/rxrpc/output.c
3712 +index 90e263c6aa69..f8b632a5c619 100644
3713 +--- a/net/rxrpc/output.c
3714 ++++ b/net/rxrpc/output.c
3715 +@@ -369,7 +369,7 @@ int rxrpc_send_data_packet(struct rxrpc_call *call, struct sk_buff *skb,
3716 + (test_and_clear_bit(RXRPC_CALL_EV_ACK_LOST, &call->events) ||
3717 + retrans ||
3718 + call->cong_mode == RXRPC_CALL_SLOW_START ||
3719 +- (call->peer->rtt_usage < 3 && sp->hdr.seq & 1) ||
3720 ++ (call->peer->rtt_count < 3 && sp->hdr.seq & 1) ||
3721 + ktime_before(ktime_add_ms(call->peer->rtt_last_req, 1000),
3722 + ktime_get_real())))
3723 + whdr.flags |= RXRPC_REQUEST_ACK;
3724 +@@ -423,13 +423,10 @@ done:
3725 + if (whdr.flags & RXRPC_REQUEST_ACK) {
3726 + call->peer->rtt_last_req = skb->tstamp;
3727 + trace_rxrpc_rtt_tx(call, rxrpc_rtt_tx_data, serial);
3728 +- if (call->peer->rtt_usage > 1) {
3729 ++ if (call->peer->rtt_count > 1) {
3730 + unsigned long nowj = jiffies, ack_lost_at;
3731 +
3732 +- ack_lost_at = nsecs_to_jiffies(2 * call->peer->rtt);
3733 +- if (ack_lost_at < 1)
3734 +- ack_lost_at = 1;
3735 +-
3736 ++ ack_lost_at = rxrpc_get_rto_backoff(call->peer, retrans);
3737 + ack_lost_at += nowj;
3738 + WRITE_ONCE(call->ack_lost_at, ack_lost_at);
3739 + rxrpc_reduce_call_timer(call, ack_lost_at, nowj,
3740 +diff --git a/net/rxrpc/peer_event.c b/net/rxrpc/peer_event.c
3741 +index 923b263c401b..b1449d971883 100644
3742 +--- a/net/rxrpc/peer_event.c
3743 ++++ b/net/rxrpc/peer_event.c
3744 +@@ -295,52 +295,6 @@ static void rxrpc_distribute_error(struct rxrpc_peer *peer, int error,
3745 + }
3746 + }
3747 +
3748 +-/*
3749 +- * Add RTT information to cache. This is called in softirq mode and has
3750 +- * exclusive access to the peer RTT data.
3751 +- */
3752 +-void rxrpc_peer_add_rtt(struct rxrpc_call *call, enum rxrpc_rtt_rx_trace why,
3753 +- rxrpc_serial_t send_serial, rxrpc_serial_t resp_serial,
3754 +- ktime_t send_time, ktime_t resp_time)
3755 +-{
3756 +- struct rxrpc_peer *peer = call->peer;
3757 +- s64 rtt;
3758 +- u64 sum = peer->rtt_sum, avg;
3759 +- u8 cursor = peer->rtt_cursor, usage = peer->rtt_usage;
3760 +-
3761 +- rtt = ktime_to_ns(ktime_sub(resp_time, send_time));
3762 +- if (rtt < 0)
3763 +- return;
3764 +-
3765 +- spin_lock(&peer->rtt_input_lock);
3766 +-
3767 +- /* Replace the oldest datum in the RTT buffer */
3768 +- sum -= peer->rtt_cache[cursor];
3769 +- sum += rtt;
3770 +- peer->rtt_cache[cursor] = rtt;
3771 +- peer->rtt_cursor = (cursor + 1) & (RXRPC_RTT_CACHE_SIZE - 1);
3772 +- peer->rtt_sum = sum;
3773 +- if (usage < RXRPC_RTT_CACHE_SIZE) {
3774 +- usage++;
3775 +- peer->rtt_usage = usage;
3776 +- }
3777 +-
3778 +- spin_unlock(&peer->rtt_input_lock);
3779 +-
3780 +- /* Now recalculate the average */
3781 +- if (usage == RXRPC_RTT_CACHE_SIZE) {
3782 +- avg = sum / RXRPC_RTT_CACHE_SIZE;
3783 +- } else {
3784 +- avg = sum;
3785 +- do_div(avg, usage);
3786 +- }
3787 +-
3788 +- /* Don't need to update this under lock */
3789 +- peer->rtt = avg;
3790 +- trace_rxrpc_rtt_rx(call, why, send_serial, resp_serial, rtt,
3791 +- usage, avg);
3792 +-}
3793 +-
3794 + /*
3795 + * Perform keep-alive pings.
3796 + */
3797 +diff --git a/net/rxrpc/peer_object.c b/net/rxrpc/peer_object.c
3798 +index 452163eadb98..ca29976bb193 100644
3799 +--- a/net/rxrpc/peer_object.c
3800 ++++ b/net/rxrpc/peer_object.c
3801 +@@ -225,6 +225,8 @@ struct rxrpc_peer *rxrpc_alloc_peer(struct rxrpc_local *local, gfp_t gfp)
3802 + spin_lock_init(&peer->rtt_input_lock);
3803 + peer->debug_id = atomic_inc_return(&rxrpc_debug_id);
3804 +
3805 ++ rxrpc_peer_init_rtt(peer);
3806 ++
3807 + if (RXRPC_TX_SMSS > 2190)
3808 + peer->cong_cwnd = 2;
3809 + else if (RXRPC_TX_SMSS > 1095)
3810 +@@ -497,14 +499,14 @@ void rxrpc_kernel_get_peer(struct socket *sock, struct rxrpc_call *call,
3811 + EXPORT_SYMBOL(rxrpc_kernel_get_peer);
3812 +
3813 + /**
3814 +- * rxrpc_kernel_get_rtt - Get a call's peer RTT
3815 ++ * rxrpc_kernel_get_srtt - Get a call's peer smoothed RTT
3816 + * @sock: The socket on which the call is in progress.
3817 + * @call: The call to query
3818 + *
3819 +- * Get the call's peer RTT.
3820 ++ * Get the call's peer smoothed RTT.
3821 + */
3822 +-u64 rxrpc_kernel_get_rtt(struct socket *sock, struct rxrpc_call *call)
3823 ++u32 rxrpc_kernel_get_srtt(struct socket *sock, struct rxrpc_call *call)
3824 + {
3825 +- return call->peer->rtt;
3826 ++ return call->peer->srtt_us >> 3;
3827 + }
3828 +-EXPORT_SYMBOL(rxrpc_kernel_get_rtt);
3829 ++EXPORT_SYMBOL(rxrpc_kernel_get_srtt);
3830 +diff --git a/net/rxrpc/proc.c b/net/rxrpc/proc.c
3831 +index b9d053e42821..8b179e3c802a 100644
3832 +--- a/net/rxrpc/proc.c
3833 ++++ b/net/rxrpc/proc.c
3834 +@@ -222,7 +222,7 @@ static int rxrpc_peer_seq_show(struct seq_file *seq, void *v)
3835 + seq_puts(seq,
3836 + "Proto Local "
3837 + " Remote "
3838 +- " Use CW MTU LastUse RTT Rc\n"
3839 ++ " Use CW MTU LastUse RTT RTO\n"
3840 + );
3841 + return 0;
3842 + }
3843 +@@ -236,15 +236,15 @@ static int rxrpc_peer_seq_show(struct seq_file *seq, void *v)
3844 + now = ktime_get_seconds();
3845 + seq_printf(seq,
3846 + "UDP %-47.47s %-47.47s %3u"
3847 +- " %3u %5u %6llus %12llu %2u\n",
3848 ++ " %3u %5u %6llus %8u %8u\n",
3849 + lbuff,
3850 + rbuff,
3851 + atomic_read(&peer->usage),
3852 + peer->cong_cwnd,
3853 + peer->mtu,
3854 + now - peer->last_tx_at,
3855 +- peer->rtt,
3856 +- peer->rtt_cursor);
3857 ++ peer->srtt_us >> 3,
3858 ++ jiffies_to_usecs(peer->rto_j));
3859 +
3860 + return 0;
3861 + }
3862 +diff --git a/net/rxrpc/rtt.c b/net/rxrpc/rtt.c
3863 +new file mode 100644
3864 +index 000000000000..928d8b34a3ee
3865 +--- /dev/null
3866 ++++ b/net/rxrpc/rtt.c
3867 +@@ -0,0 +1,195 @@
3868 ++// SPDX-License-Identifier: GPL-2.0
3869 ++/* RTT/RTO calculation.
3870 ++ *
3871 ++ * Adapted from TCP for AF_RXRPC by David Howells (dhowells@××××××.com)
3872 ++ *
3873 ++ * https://tools.ietf.org/html/rfc6298
3874 ++ * https://tools.ietf.org/html/rfc1122#section-4.2.3.1
3875 ++ * http://ccr.sigcomm.org/archive/1995/jan95/ccr-9501-partridge87.pdf
3876 ++ */
3877 ++
3878 ++#include <linux/net.h>
3879 ++#include "ar-internal.h"
3880 ++
3881 ++#define RXRPC_RTO_MAX ((unsigned)(120 * HZ))
3882 ++#define RXRPC_TIMEOUT_INIT ((unsigned)(1*HZ)) /* RFC6298 2.1 initial RTO value */
3883 ++#define rxrpc_jiffies32 ((u32)jiffies) /* As rxrpc_jiffies32 */
3884 ++#define rxrpc_min_rtt_wlen 300 /* As sysctl_tcp_min_rtt_wlen */
3885 ++
3886 ++static u32 rxrpc_rto_min_us(struct rxrpc_peer *peer)
3887 ++{
3888 ++ return 200;
3889 ++}
3890 ++
3891 ++static u32 __rxrpc_set_rto(const struct rxrpc_peer *peer)
3892 ++{
3893 ++ return _usecs_to_jiffies((peer->srtt_us >> 3) + peer->rttvar_us);
3894 ++}
3895 ++
3896 ++static u32 rxrpc_bound_rto(u32 rto)
3897 ++{
3898 ++ return min(rto, RXRPC_RTO_MAX);
3899 ++}
3900 ++
3901 ++/*
3902 ++ * Called to compute a smoothed rtt estimate. The data fed to this
3903 ++ * routine either comes from timestamps, or from segments that were
3904 ++ * known _not_ to have been retransmitted [see Karn/Partridge
3905 ++ * Proceedings SIGCOMM 87]. The algorithm is from the SIGCOMM 88
3906 ++ * piece by Van Jacobson.
3907 ++ * NOTE: the next three routines used to be one big routine.
3908 ++ * To save cycles in the RFC 1323 implementation it was better to break
3909 ++ * it up into three procedures. -- erics
3910 ++ */
3911 ++static void rxrpc_rtt_estimator(struct rxrpc_peer *peer, long sample_rtt_us)
3912 ++{
3913 ++ long m = sample_rtt_us; /* RTT */
3914 ++ u32 srtt = peer->srtt_us;
3915 ++
3916 ++ /* The following amusing code comes from Jacobson's
3917 ++ * article in SIGCOMM '88. Note that rtt and mdev
3918 ++ * are scaled versions of rtt and mean deviation.
3919 ++ * This is designed to be as fast as possible
3920 ++ * m stands for "measurement".
3921 ++ *
3922 ++ * On a 1990 paper the rto value is changed to:
3923 ++ * RTO = rtt + 4 * mdev
3924 ++ *
3925 ++ * Funny. This algorithm seems to be very broken.
3926 ++ * These formulae increase RTO, when it should be decreased, increase
3927 ++ * too slowly, when it should be increased quickly, decrease too quickly
3928 ++ * etc. I guess in BSD RTO takes ONE value, so that it is absolutely
3929 ++ * does not matter how to _calculate_ it. Seems, it was trap
3930 ++ * that VJ failed to avoid. 8)
3931 ++ */
3932 ++ if (srtt != 0) {
3933 ++ m -= (srtt >> 3); /* m is now error in rtt est */
3934 ++ srtt += m; /* rtt = 7/8 rtt + 1/8 new */
3935 ++ if (m < 0) {
3936 ++ m = -m; /* m is now abs(error) */
3937 ++ m -= (peer->mdev_us >> 2); /* similar update on mdev */
3938 ++ /* This is similar to one of Eifel findings.
3939 ++ * Eifel blocks mdev updates when rtt decreases.
3940 ++ * This solution is a bit different: we use finer gain
3941 ++ * for mdev in this case (alpha*beta).
3942 ++ * Like Eifel it also prevents growth of rto,
3943 ++ * but also it limits too fast rto decreases,
3944 ++ * happening in pure Eifel.
3945 ++ */
3946 ++ if (m > 0)
3947 ++ m >>= 3;
3948 ++ } else {
3949 ++ m -= (peer->mdev_us >> 2); /* similar update on mdev */
3950 ++ }
3951 ++
3952 ++ peer->mdev_us += m; /* mdev = 3/4 mdev + 1/4 new */
3953 ++ if (peer->mdev_us > peer->mdev_max_us) {
3954 ++ peer->mdev_max_us = peer->mdev_us;
3955 ++ if (peer->mdev_max_us > peer->rttvar_us)
3956 ++ peer->rttvar_us = peer->mdev_max_us;
3957 ++ }
3958 ++ } else {
3959 ++ /* no previous measure. */
3960 ++ srtt = m << 3; /* take the measured time to be rtt */
3961 ++ peer->mdev_us = m << 1; /* make sure rto = 3*rtt */
3962 ++ peer->rttvar_us = max(peer->mdev_us, rxrpc_rto_min_us(peer));
3963 ++ peer->mdev_max_us = peer->rttvar_us;
3964 ++ }
3965 ++
3966 ++ peer->srtt_us = max(1U, srtt);
3967 ++}
3968 ++
3969 ++/*
3970 ++ * Calculate rto without backoff. This is the second half of Van Jacobson's
3971 ++ * routine referred to above.
3972 ++ */
3973 ++static void rxrpc_set_rto(struct rxrpc_peer *peer)
3974 ++{
3975 ++ u32 rto;
3976 ++
3977 ++ /* 1. If rtt variance happened to be less 50msec, it is hallucination.
3978 ++ * It cannot be less due to utterly erratic ACK generation made
3979 ++ * at least by solaris and freebsd. "Erratic ACKs" has _nothing_
3980 ++ * to do with delayed acks, because at cwnd>2 true delack timeout
3981 ++ * is invisible. Actually, Linux-2.4 also generates erratic
3982 ++ * ACKs in some circumstances.
3983 ++ */
3984 ++ rto = __rxrpc_set_rto(peer);
3985 ++
3986 ++ /* 2. Fixups made earlier cannot be right.
3987 ++ * If we do not estimate RTO correctly without them,
3988 ++ * all the algo is pure shit and should be replaced
3989 ++ * with correct one. It is exactly, which we pretend to do.
3990 ++ */
3991 ++
3992 ++ /* NOTE: clamping at RXRPC_RTO_MIN is not required, current algo
3993 ++ * guarantees that rto is higher.
3994 ++ */
3995 ++ peer->rto_j = rxrpc_bound_rto(rto);
3996 ++}
3997 ++
3998 ++static void rxrpc_ack_update_rtt(struct rxrpc_peer *peer, long rtt_us)
3999 ++{
4000 ++ if (rtt_us < 0)
4001 ++ return;
4002 ++
4003 ++ //rxrpc_update_rtt_min(peer, rtt_us);
4004 ++ rxrpc_rtt_estimator(peer, rtt_us);
4005 ++ rxrpc_set_rto(peer);
4006 ++
4007 ++ /* RFC6298: only reset backoff on valid RTT measurement. */
4008 ++ peer->backoff = 0;
4009 ++}
4010 ++
4011 ++/*
4012 ++ * Add RTT information to cache. This is called in softirq mode and has
4013 ++ * exclusive access to the peer RTT data.
4014 ++ */
4015 ++void rxrpc_peer_add_rtt(struct rxrpc_call *call, enum rxrpc_rtt_rx_trace why,
4016 ++ rxrpc_serial_t send_serial, rxrpc_serial_t resp_serial,
4017 ++ ktime_t send_time, ktime_t resp_time)
4018 ++{
4019 ++ struct rxrpc_peer *peer = call->peer;
4020 ++ s64 rtt_us;
4021 ++
4022 ++ rtt_us = ktime_to_us(ktime_sub(resp_time, send_time));
4023 ++ if (rtt_us < 0)
4024 ++ return;
4025 ++
4026 ++ spin_lock(&peer->rtt_input_lock);
4027 ++ rxrpc_ack_update_rtt(peer, rtt_us);
4028 ++ if (peer->rtt_count < 3)
4029 ++ peer->rtt_count++;
4030 ++ spin_unlock(&peer->rtt_input_lock);
4031 ++
4032 ++ trace_rxrpc_rtt_rx(call, why, send_serial, resp_serial,
4033 ++ peer->srtt_us >> 3, peer->rto_j);
4034 ++}
4035 ++
4036 ++/*
4037 ++ * Get the retransmission timeout to set in jiffies, backing it off each time
4038 ++ * we retransmit.
4039 ++ */
4040 ++unsigned long rxrpc_get_rto_backoff(struct rxrpc_peer *peer, bool retrans)
4041 ++{
4042 ++ u64 timo_j;
4043 ++ u8 backoff = READ_ONCE(peer->backoff);
4044 ++
4045 ++ timo_j = peer->rto_j;
4046 ++ timo_j <<= backoff;
4047 ++ if (retrans && timo_j * 2 <= RXRPC_RTO_MAX)
4048 ++ WRITE_ONCE(peer->backoff, backoff + 1);
4049 ++
4050 ++ if (timo_j < 1)
4051 ++ timo_j = 1;
4052 ++
4053 ++ return timo_j;
4054 ++}
4055 ++
4056 ++void rxrpc_peer_init_rtt(struct rxrpc_peer *peer)
4057 ++{
4058 ++ peer->rto_j = RXRPC_TIMEOUT_INIT;
4059 ++ peer->mdev_us = jiffies_to_usecs(RXRPC_TIMEOUT_INIT);
4060 ++ peer->backoff = 0;
4061 ++ //minmax_reset(&peer->rtt_min, rxrpc_jiffies32, ~0U);
4062 ++}
4063 +diff --git a/net/rxrpc/rxkad.c b/net/rxrpc/rxkad.c
4064 +index 098f1f9ec53b..52a24d4ef5d8 100644
4065 +--- a/net/rxrpc/rxkad.c
4066 ++++ b/net/rxrpc/rxkad.c
4067 +@@ -1148,7 +1148,7 @@ static int rxkad_verify_response(struct rxrpc_connection *conn,
4068 + ret = rxkad_decrypt_ticket(conn, skb, ticket, ticket_len, &session_key,
4069 + &expiry, _abort_code);
4070 + if (ret < 0)
4071 +- goto temporary_error_free_resp;
4072 ++ goto temporary_error_free_ticket;
4073 +
4074 + /* use the session key from inside the ticket to decrypt the
4075 + * response */
4076 +@@ -1230,7 +1230,6 @@ protocol_error:
4077 +
4078 + temporary_error_free_ticket:
4079 + kfree(ticket);
4080 +-temporary_error_free_resp:
4081 + kfree(response);
4082 + temporary_error:
4083 + /* Ignore the response packet if we got a temporary error such as
4084 +diff --git a/net/rxrpc/sendmsg.c b/net/rxrpc/sendmsg.c
4085 +index 0fcf157aa09f..5e9c43d4a314 100644
4086 +--- a/net/rxrpc/sendmsg.c
4087 ++++ b/net/rxrpc/sendmsg.c
4088 +@@ -66,15 +66,14 @@ static int rxrpc_wait_for_tx_window_waitall(struct rxrpc_sock *rx,
4089 + struct rxrpc_call *call)
4090 + {
4091 + rxrpc_seq_t tx_start, tx_win;
4092 +- signed long rtt2, timeout;
4093 +- u64 rtt;
4094 ++ signed long rtt, timeout;
4095 +
4096 +- rtt = READ_ONCE(call->peer->rtt);
4097 +- rtt2 = nsecs_to_jiffies64(rtt) * 2;
4098 +- if (rtt2 < 2)
4099 +- rtt2 = 2;
4100 ++ rtt = READ_ONCE(call->peer->srtt_us) >> 3;
4101 ++ rtt = usecs_to_jiffies(rtt) * 2;
4102 ++ if (rtt < 2)
4103 ++ rtt = 2;
4104 +
4105 +- timeout = rtt2;
4106 ++ timeout = rtt;
4107 + tx_start = READ_ONCE(call->tx_hard_ack);
4108 +
4109 + for (;;) {
4110 +@@ -92,7 +91,7 @@ static int rxrpc_wait_for_tx_window_waitall(struct rxrpc_sock *rx,
4111 + return -EINTR;
4112 +
4113 + if (tx_win != tx_start) {
4114 +- timeout = rtt2;
4115 ++ timeout = rtt;
4116 + tx_start = tx_win;
4117 + }
4118 +
4119 +@@ -271,16 +270,9 @@ static int rxrpc_queue_packet(struct rxrpc_sock *rx, struct rxrpc_call *call,
4120 + _debug("need instant resend %d", ret);
4121 + rxrpc_instant_resend(call, ix);
4122 + } else {
4123 +- unsigned long now = jiffies, resend_at;
4124 ++ unsigned long now = jiffies;
4125 ++ unsigned long resend_at = now + call->peer->rto_j;
4126 +
4127 +- if (call->peer->rtt_usage > 1)
4128 +- resend_at = nsecs_to_jiffies(call->peer->rtt * 3 / 2);
4129 +- else
4130 +- resend_at = rxrpc_resend_timeout;
4131 +- if (resend_at < 1)
4132 +- resend_at = 1;
4133 +-
4134 +- resend_at += now;
4135 + WRITE_ONCE(call->resend_at, resend_at);
4136 + rxrpc_reduce_call_timer(call, resend_at, now,
4137 + rxrpc_timer_set_for_send);
4138 +diff --git a/net/rxrpc/sysctl.c b/net/rxrpc/sysctl.c
4139 +index 2bbb38161851..18dade4e6f9a 100644
4140 +--- a/net/rxrpc/sysctl.c
4141 ++++ b/net/rxrpc/sysctl.c
4142 +@@ -71,15 +71,6 @@ static struct ctl_table rxrpc_sysctl_table[] = {
4143 + .extra1 = (void *)&one_jiffy,
4144 + .extra2 = (void *)&max_jiffies,
4145 + },
4146 +- {
4147 +- .procname = "resend_timeout",
4148 +- .data = &rxrpc_resend_timeout,
4149 +- .maxlen = sizeof(unsigned long),
4150 +- .mode = 0644,
4151 +- .proc_handler = proc_doulongvec_ms_jiffies_minmax,
4152 +- .extra1 = (void *)&one_jiffy,
4153 +- .extra2 = (void *)&max_jiffies,
4154 +- },
4155 +
4156 + /* Non-time values */
4157 + {
4158 +diff --git a/scripts/gcc-plugins/Makefile b/scripts/gcc-plugins/Makefile
4159 +index f2ee8bd7abc6..1d0b9382e759 100644
4160 +--- a/scripts/gcc-plugins/Makefile
4161 ++++ b/scripts/gcc-plugins/Makefile
4162 +@@ -11,6 +11,7 @@ else
4163 + HOST_EXTRACXXFLAGS += -I$(GCC_PLUGINS_DIR)/include -I$(src) -std=gnu++98 -fno-rtti
4164 + HOST_EXTRACXXFLAGS += -fno-exceptions -fasynchronous-unwind-tables -ggdb
4165 + HOST_EXTRACXXFLAGS += -Wno-narrowing -Wno-unused-variable
4166 ++ HOST_EXTRACXXFLAGS += -Wno-format-diag
4167 + export HOST_EXTRACXXFLAGS
4168 + endif
4169 +
4170 +diff --git a/scripts/gcc-plugins/gcc-common.h b/scripts/gcc-plugins/gcc-common.h
4171 +index 17f06079a712..9ad76b7f3f10 100644
4172 +--- a/scripts/gcc-plugins/gcc-common.h
4173 ++++ b/scripts/gcc-plugins/gcc-common.h
4174 +@@ -35,7 +35,9 @@
4175 + #include "ggc.h"
4176 + #include "timevar.h"
4177 +
4178 ++#if BUILDING_GCC_VERSION < 10000
4179 + #include "params.h"
4180 ++#endif
4181 +
4182 + #if BUILDING_GCC_VERSION <= 4009
4183 + #include "pointer-set.h"
4184 +@@ -847,6 +849,7 @@ static inline gimple gimple_build_assign_with_ops(enum tree_code subcode, tree l
4185 + return gimple_build_assign(lhs, subcode, op1, op2 PASS_MEM_STAT);
4186 + }
4187 +
4188 ++#if BUILDING_GCC_VERSION < 10000
4189 + template <>
4190 + template <>
4191 + inline bool is_a_helper<const ggoto *>::test(const_gimple gs)
4192 +@@ -860,6 +863,7 @@ inline bool is_a_helper<const greturn *>::test(const_gimple gs)
4193 + {
4194 + return gs->code == GIMPLE_RETURN;
4195 + }
4196 ++#endif
4197 +
4198 + static inline gasm *as_a_gasm(gimple stmt)
4199 + {
4200 +diff --git a/scripts/gdb/linux/rbtree.py b/scripts/gdb/linux/rbtree.py
4201 +index 39db889b874c..c4b991607917 100644
4202 +--- a/scripts/gdb/linux/rbtree.py
4203 ++++ b/scripts/gdb/linux/rbtree.py
4204 +@@ -12,7 +12,7 @@ rb_node_type = utils.CachedType("struct rb_node")
4205 +
4206 + def rb_first(root):
4207 + if root.type == rb_root_type.get_type():
4208 +- node = node.address.cast(rb_root_type.get_type().pointer())
4209 ++ node = root.address.cast(rb_root_type.get_type().pointer())
4210 + elif root.type != rb_root_type.get_type().pointer():
4211 + raise gdb.GdbError("Must be struct rb_root not {}".format(root.type))
4212 +
4213 +@@ -28,7 +28,7 @@ def rb_first(root):
4214 +
4215 + def rb_last(root):
4216 + if root.type == rb_root_type.get_type():
4217 +- node = node.address.cast(rb_root_type.get_type().pointer())
4218 ++ node = root.address.cast(rb_root_type.get_type().pointer())
4219 + elif root.type != rb_root_type.get_type().pointer():
4220 + raise gdb.GdbError("Must be struct rb_root not {}".format(root.type))
4221 +
4222 +diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh
4223 +index dd484e92752e..ac569e197bfa 100755
4224 +--- a/scripts/link-vmlinux.sh
4225 ++++ b/scripts/link-vmlinux.sh
4226 +@@ -63,12 +63,18 @@ vmlinux_link()
4227 + local lds="${objtree}/${KBUILD_LDS}"
4228 + local output=${1}
4229 + local objects
4230 ++ local strip_debug
4231 +
4232 + info LD ${output}
4233 +
4234 + # skip output file argument
4235 + shift
4236 +
4237 ++ # The kallsyms linking does not need debug symbols included.
4238 ++ if [ "$output" != "${output#.tmp_vmlinux.kallsyms}" ] ; then
4239 ++ strip_debug=-Wl,--strip-debug
4240 ++ fi
4241 ++
4242 + if [ "${SRCARCH}" != "um" ]; then
4243 + objects="--whole-archive \
4244 + ${KBUILD_VMLINUX_OBJS} \
4245 +@@ -79,6 +85,7 @@ vmlinux_link()
4246 + ${@}"
4247 +
4248 + ${LD} ${KBUILD_LDFLAGS} ${LDFLAGS_vmlinux} \
4249 ++ ${strip_debug#-Wl,} \
4250 + -o ${output} \
4251 + -T ${lds} ${objects}
4252 + else
4253 +@@ -91,6 +98,7 @@ vmlinux_link()
4254 + ${@}"
4255 +
4256 + ${CC} ${CFLAGS_vmlinux} \
4257 ++ ${strip_debug} \
4258 + -o ${output} \
4259 + -Wl,-T,${lds} \
4260 + ${objects} \
4261 +@@ -106,6 +114,8 @@ gen_btf()
4262 + {
4263 + local pahole_ver
4264 + local bin_arch
4265 ++ local bin_format
4266 ++ local bin_file
4267 +
4268 + if ! [ -x "$(command -v ${PAHOLE})" ]; then
4269 + echo >&2 "BTF: ${1}: pahole (${PAHOLE}) is not available"
4270 +@@ -118,8 +128,9 @@ gen_btf()
4271 + return 1
4272 + fi
4273 +
4274 +- info "BTF" ${2}
4275 + vmlinux_link ${1}
4276 ++
4277 ++ info "BTF" ${2}
4278 + LLVM_OBJCOPY=${OBJCOPY} ${PAHOLE} -J ${1}
4279 +
4280 + # dump .BTF section into raw binary file to link with final vmlinux
4281 +@@ -127,11 +138,12 @@ gen_btf()
4282 + cut -d, -f1 | cut -d' ' -f2)
4283 + bin_format=$(LANG=C ${OBJDUMP} -f ${1} | grep 'file format' | \
4284 + awk '{print $4}')
4285 ++ bin_file=.btf.vmlinux.bin
4286 + ${OBJCOPY} --change-section-address .BTF=0 \
4287 + --set-section-flags .BTF=alloc -O binary \
4288 +- --only-section=.BTF ${1} .btf.vmlinux.bin
4289 ++ --only-section=.BTF ${1} $bin_file
4290 + ${OBJCOPY} -I binary -O ${bin_format} -B ${bin_arch} \
4291 +- --rename-section .data=.BTF .btf.vmlinux.bin ${2}
4292 ++ --rename-section .data=.BTF $bin_file ${2}
4293 + }
4294 +
4295 + # Create ${2} .o file with all symbols from the ${1} object file
4296 +@@ -166,8 +178,8 @@ kallsyms()
4297 + kallsyms_step()
4298 + {
4299 + kallsymso_prev=${kallsymso}
4300 +- kallsymso=.tmp_kallsyms${1}.o
4301 +- kallsyms_vmlinux=.tmp_vmlinux${1}
4302 ++ kallsyms_vmlinux=.tmp_vmlinux.kallsyms${1}
4303 ++ kallsymso=${kallsyms_vmlinux}.o
4304 +
4305 + vmlinux_link ${kallsyms_vmlinux} "${kallsymso_prev}" ${btf_vmlinux_bin_o}
4306 + kallsyms ${kallsyms_vmlinux} ${kallsymso}
4307 +@@ -190,7 +202,6 @@ cleanup()
4308 + {
4309 + rm -f .btf.*
4310 + rm -f .tmp_System.map
4311 +- rm -f .tmp_kallsyms*
4312 + rm -f .tmp_vmlinux*
4313 + rm -f System.map
4314 + rm -f vmlinux
4315 +@@ -257,9 +268,8 @@ tr '\0' '\n' < modules.builtin.modinfo | sed -n 's/^[[:alnum:]:_]*\.file=//p' |
4316 +
4317 + btf_vmlinux_bin_o=""
4318 + if [ -n "${CONFIG_DEBUG_INFO_BTF}" ]; then
4319 +- if gen_btf .tmp_vmlinux.btf .btf.vmlinux.bin.o ; then
4320 +- btf_vmlinux_bin_o=.btf.vmlinux.bin.o
4321 +- else
4322 ++ btf_vmlinux_bin_o=.btf.vmlinux.bin.o
4323 ++ if ! gen_btf .tmp_vmlinux.btf $btf_vmlinux_bin_o ; then
4324 + echo >&2 "Failed to generate BTF for vmlinux"
4325 + echo >&2 "Try to disable CONFIG_DEBUG_INFO_BTF"
4326 + exit 1
4327 +diff --git a/security/apparmor/apparmorfs.c b/security/apparmor/apparmorfs.c
4328 +index 280741fc0f5f..f6a3ecfadf80 100644
4329 +--- a/security/apparmor/apparmorfs.c
4330 ++++ b/security/apparmor/apparmorfs.c
4331 +@@ -454,7 +454,7 @@ static ssize_t policy_update(u32 mask, const char __user *buf, size_t size,
4332 + */
4333 + error = aa_may_manage_policy(label, ns, mask);
4334 + if (error)
4335 +- return error;
4336 ++ goto end_section;
4337 +
4338 + data = aa_simple_write_to_buffer(buf, size, size, pos);
4339 + error = PTR_ERR(data);
4340 +@@ -462,6 +462,7 @@ static ssize_t policy_update(u32 mask, const char __user *buf, size_t size,
4341 + error = aa_replace_profiles(ns, label, mask, data);
4342 + aa_put_loaddata(data);
4343 + }
4344 ++end_section:
4345 + end_current_label_crit_section(label);
4346 +
4347 + return error;
4348 +diff --git a/security/apparmor/audit.c b/security/apparmor/audit.c
4349 +index 5a98661a8b46..597732503815 100644
4350 +--- a/security/apparmor/audit.c
4351 ++++ b/security/apparmor/audit.c
4352 +@@ -197,8 +197,9 @@ int aa_audit_rule_init(u32 field, u32 op, char *rulestr, void **vrule)
4353 + rule->label = aa_label_parse(&root_ns->unconfined->label, rulestr,
4354 + GFP_KERNEL, true, false);
4355 + if (IS_ERR(rule->label)) {
4356 ++ int err = PTR_ERR(rule->label);
4357 + aa_audit_rule_free(rule);
4358 +- return PTR_ERR(rule->label);
4359 ++ return err;
4360 + }
4361 +
4362 + *vrule = rule;
4363 +diff --git a/security/apparmor/domain.c b/security/apparmor/domain.c
4364 +index 6ceb74e0f789..a84ef030fbd7 100644
4365 +--- a/security/apparmor/domain.c
4366 ++++ b/security/apparmor/domain.c
4367 +@@ -1328,6 +1328,7 @@ int aa_change_profile(const char *fqname, int flags)
4368 + ctx->nnp = aa_get_label(label);
4369 +
4370 + if (!fqname || !*fqname) {
4371 ++ aa_put_label(label);
4372 + AA_DEBUG("no profile name");
4373 + return -EINVAL;
4374 + }
4375 +@@ -1346,8 +1347,6 @@ int aa_change_profile(const char *fqname, int flags)
4376 + op = OP_CHANGE_PROFILE;
4377 + }
4378 +
4379 +- label = aa_get_current_label();
4380 +-
4381 + if (*fqname == '&') {
4382 + stack = true;
4383 + /* don't have label_parse() do stacking */
4384 +diff --git a/security/integrity/evm/evm_crypto.c b/security/integrity/evm/evm_crypto.c
4385 +index d485f6fc908e..cc826c2767a3 100644
4386 +--- a/security/integrity/evm/evm_crypto.c
4387 ++++ b/security/integrity/evm/evm_crypto.c
4388 +@@ -75,7 +75,7 @@ static struct shash_desc *init_desc(char type, uint8_t hash_algo)
4389 + {
4390 + long rc;
4391 + const char *algo;
4392 +- struct crypto_shash **tfm;
4393 ++ struct crypto_shash **tfm, *tmp_tfm;
4394 + struct shash_desc *desc;
4395 +
4396 + if (type == EVM_XATTR_HMAC) {
4397 +@@ -93,31 +93,31 @@ static struct shash_desc *init_desc(char type, uint8_t hash_algo)
4398 + algo = hash_algo_name[hash_algo];
4399 + }
4400 +
4401 +- if (*tfm == NULL) {
4402 +- mutex_lock(&mutex);
4403 +- if (*tfm)
4404 +- goto out;
4405 +- *tfm = crypto_alloc_shash(algo, 0, CRYPTO_NOLOAD);
4406 +- if (IS_ERR(*tfm)) {
4407 +- rc = PTR_ERR(*tfm);
4408 +- pr_err("Can not allocate %s (reason: %ld)\n", algo, rc);
4409 +- *tfm = NULL;
4410 ++ if (*tfm)
4411 ++ goto alloc;
4412 ++ mutex_lock(&mutex);
4413 ++ if (*tfm)
4414 ++ goto unlock;
4415 ++
4416 ++ tmp_tfm = crypto_alloc_shash(algo, 0, CRYPTO_NOLOAD);
4417 ++ if (IS_ERR(tmp_tfm)) {
4418 ++ pr_err("Can not allocate %s (reason: %ld)\n", algo,
4419 ++ PTR_ERR(tmp_tfm));
4420 ++ mutex_unlock(&mutex);
4421 ++ return ERR_CAST(tmp_tfm);
4422 ++ }
4423 ++ if (type == EVM_XATTR_HMAC) {
4424 ++ rc = crypto_shash_setkey(tmp_tfm, evmkey, evmkey_len);
4425 ++ if (rc) {
4426 ++ crypto_free_shash(tmp_tfm);
4427 + mutex_unlock(&mutex);
4428 + return ERR_PTR(rc);
4429 + }
4430 +- if (type == EVM_XATTR_HMAC) {
4431 +- rc = crypto_shash_setkey(*tfm, evmkey, evmkey_len);
4432 +- if (rc) {
4433 +- crypto_free_shash(*tfm);
4434 +- *tfm = NULL;
4435 +- mutex_unlock(&mutex);
4436 +- return ERR_PTR(rc);
4437 +- }
4438 +- }
4439 +-out:
4440 +- mutex_unlock(&mutex);
4441 + }
4442 +-
4443 ++ *tfm = tmp_tfm;
4444 ++unlock:
4445 ++ mutex_unlock(&mutex);
4446 ++alloc:
4447 + desc = kmalloc(sizeof(*desc) + crypto_shash_descsize(*tfm),
4448 + GFP_KERNEL);
4449 + if (!desc)
4450 +diff --git a/security/integrity/ima/ima_crypto.c b/security/integrity/ima/ima_crypto.c
4451 +index 7967a6904851..e8fa23cd4a6c 100644
4452 +--- a/security/integrity/ima/ima_crypto.c
4453 ++++ b/security/integrity/ima/ima_crypto.c
4454 +@@ -413,7 +413,7 @@ int ima_calc_file_hash(struct file *file, struct ima_digest_data *hash)
4455 + loff_t i_size;
4456 + int rc;
4457 + struct file *f = file;
4458 +- bool new_file_instance = false, modified_flags = false;
4459 ++ bool new_file_instance = false, modified_mode = false;
4460 +
4461 + /*
4462 + * For consistency, fail file's opened with the O_DIRECT flag on
4463 +@@ -433,13 +433,13 @@ int ima_calc_file_hash(struct file *file, struct ima_digest_data *hash)
4464 + f = dentry_open(&file->f_path, flags, file->f_cred);
4465 + if (IS_ERR(f)) {
4466 + /*
4467 +- * Cannot open the file again, lets modify f_flags
4468 ++ * Cannot open the file again, lets modify f_mode
4469 + * of original and continue
4470 + */
4471 + pr_info_ratelimited("Unable to reopen file for reading.\n");
4472 + f = file;
4473 +- f->f_flags |= FMODE_READ;
4474 +- modified_flags = true;
4475 ++ f->f_mode |= FMODE_READ;
4476 ++ modified_mode = true;
4477 + } else {
4478 + new_file_instance = true;
4479 + }
4480 +@@ -457,8 +457,8 @@ int ima_calc_file_hash(struct file *file, struct ima_digest_data *hash)
4481 + out:
4482 + if (new_file_instance)
4483 + fput(f);
4484 +- else if (modified_flags)
4485 +- f->f_flags &= ~FMODE_READ;
4486 ++ else if (modified_mode)
4487 ++ f->f_mode &= ~FMODE_READ;
4488 + return rc;
4489 + }
4490 +
4491 +diff --git a/security/integrity/ima/ima_fs.c b/security/integrity/ima/ima_fs.c
4492 +index 2000e8df0301..68571c40d61f 100644
4493 +--- a/security/integrity/ima/ima_fs.c
4494 ++++ b/security/integrity/ima/ima_fs.c
4495 +@@ -340,8 +340,7 @@ static ssize_t ima_write_policy(struct file *file, const char __user *buf,
4496 + integrity_audit_msg(AUDIT_INTEGRITY_STATUS, NULL, NULL,
4497 + "policy_update", "signed policy required",
4498 + 1, 0);
4499 +- if (ima_appraise & IMA_APPRAISE_ENFORCE)
4500 +- result = -EACCES;
4501 ++ result = -EACCES;
4502 + } else {
4503 + result = ima_parse_add_rule(data);
4504 + }
4505 +diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c
4506 +index 872a852de75c..d531e1bc2b81 100644
4507 +--- a/sound/core/pcm_lib.c
4508 ++++ b/sound/core/pcm_lib.c
4509 +@@ -433,6 +433,7 @@ static int snd_pcm_update_hw_ptr0(struct snd_pcm_substream *substream,
4510 +
4511 + no_delta_check:
4512 + if (runtime->status->hw_ptr == new_hw_ptr) {
4513 ++ runtime->hw_ptr_jiffies = curr_jiffies;
4514 + update_audio_tstamp(substream, &curr_tstamp, &audio_tstamp);
4515 + return 0;
4516 + }
4517 +diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
4518 +index d73c814358bf..041d2a32059b 100644
4519 +--- a/sound/pci/hda/patch_realtek.c
4520 ++++ b/sound/pci/hda/patch_realtek.c
4521 +@@ -86,6 +86,14 @@ struct alc_spec {
4522 +
4523 + unsigned int gpio_mute_led_mask;
4524 + unsigned int gpio_mic_led_mask;
4525 ++ unsigned int mute_led_coef_idx;
4526 ++ unsigned int mute_led_coefbit_mask;
4527 ++ unsigned int mute_led_coefbit_on;
4528 ++ unsigned int mute_led_coefbit_off;
4529 ++ unsigned int mic_led_coef_idx;
4530 ++ unsigned int mic_led_coefbit_mask;
4531 ++ unsigned int mic_led_coefbit_on;
4532 ++ unsigned int mic_led_coefbit_off;
4533 +
4534 + hda_nid_t headset_mic_pin;
4535 + hda_nid_t headphone_mic_pin;
4536 +@@ -2449,6 +2457,7 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = {
4537 + SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", ALC889_FIXUP_FRONT_HP_NO_PRESENCE),
4538 + SND_PCI_QUIRK(0x1458, 0xa0b8, "Gigabyte AZ370-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
4539 + SND_PCI_QUIRK(0x1458, 0xa0cd, "Gigabyte X570 Aorus Master", ALC1220_FIXUP_CLEVO_P950),
4540 ++ SND_PCI_QUIRK(0x1458, 0xa0ce, "Gigabyte X570 Aorus Xtreme", ALC1220_FIXUP_CLEVO_P950),
4541 + SND_PCI_QUIRK(0x1462, 0x1228, "MSI-GP63", ALC1220_FIXUP_CLEVO_P950),
4542 + SND_PCI_QUIRK(0x1462, 0x1275, "MSI-GL63", ALC1220_FIXUP_CLEVO_P950),
4543 + SND_PCI_QUIRK(0x1462, 0x1276, "MSI-GL73", ALC1220_FIXUP_CLEVO_P950),
4544 +@@ -2464,6 +2473,9 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = {
4545 + SND_PCI_QUIRK(0x1558, 0x97e1, "Clevo P970[ER][CDFN]", ALC1220_FIXUP_CLEVO_P950),
4546 + SND_PCI_QUIRK(0x1558, 0x65d1, "Clevo PB51[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
4547 + SND_PCI_QUIRK(0x1558, 0x67d1, "Clevo PB71[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
4548 ++ SND_PCI_QUIRK(0x1558, 0x50d3, "Clevo PC50[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
4549 ++ SND_PCI_QUIRK(0x1558, 0x70d1, "Clevo PC70[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
4550 ++ SND_PCI_QUIRK(0x1558, 0x7714, "Clevo X170", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
4551 + SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD),
4552 + SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD),
4553 + SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", ALC882_FIXUP_LENOVO_Y530),
4554 +@@ -4182,6 +4194,111 @@ static void alc280_fixup_hp_gpio4(struct hda_codec *codec,
4555 + }
4556 + }
4557 +
4558 ++/* update mute-LED according to the speaker mute state via COEF bit */
4559 ++static void alc_fixup_mute_led_coefbit_hook(void *private_data, int enabled)
4560 ++{
4561 ++ struct hda_codec *codec = private_data;
4562 ++ struct alc_spec *spec = codec->spec;
4563 ++
4564 ++ if (spec->mute_led_polarity)
4565 ++ enabled = !enabled;
4566 ++
4567 ++ /* temporarily power up/down for setting COEF bit */
4568 ++ enabled ? alc_update_coef_idx(codec, spec->mute_led_coef_idx,
4569 ++ spec->mute_led_coefbit_mask, spec->mute_led_coefbit_off) :
4570 ++ alc_update_coef_idx(codec, spec->mute_led_coef_idx,
4571 ++ spec->mute_led_coefbit_mask, spec->mute_led_coefbit_on);
4572 ++}
4573 ++
4574 ++static void alc285_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4575 ++ const struct hda_fixup *fix,
4576 ++ int action)
4577 ++{
4578 ++ struct alc_spec *spec = codec->spec;
4579 ++
4580 ++ if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4581 ++ spec->mute_led_polarity = 0;
4582 ++ spec->mute_led_coef_idx = 0x0b;
4583 ++ spec->mute_led_coefbit_mask = 1<<3;
4584 ++ spec->mute_led_coefbit_on = 1<<3;
4585 ++ spec->mute_led_coefbit_off = 0;
4586 ++ spec->gen.vmaster_mute.hook = alc_fixup_mute_led_coefbit_hook;
4587 ++ spec->gen.vmaster_mute_enum = 1;
4588 ++ }
4589 ++}
4590 ++
4591 ++static void alc236_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4592 ++ const struct hda_fixup *fix,
4593 ++ int action)
4594 ++{
4595 ++ struct alc_spec *spec = codec->spec;
4596 ++
4597 ++ if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4598 ++ spec->mute_led_polarity = 0;
4599 ++ spec->mute_led_coef_idx = 0x34;
4600 ++ spec->mute_led_coefbit_mask = 1<<5;
4601 ++ spec->mute_led_coefbit_on = 0;
4602 ++ spec->mute_led_coefbit_off = 1<<5;
4603 ++ spec->gen.vmaster_mute.hook = alc_fixup_mute_led_coefbit_hook;
4604 ++ spec->gen.vmaster_mute_enum = 1;
4605 ++ }
4606 ++}
4607 ++
4608 ++/* turn on/off mic-mute LED per capture hook by coef bit */
4609 ++static void alc_hp_cap_micmute_update(struct hda_codec *codec)
4610 ++{
4611 ++ struct alc_spec *spec = codec->spec;
4612 ++
4613 ++ if (spec->gen.micmute_led.led_value)
4614 ++ alc_update_coef_idx(codec, spec->mic_led_coef_idx,
4615 ++ spec->mic_led_coefbit_mask, spec->mic_led_coefbit_on);
4616 ++ else
4617 ++ alc_update_coef_idx(codec, spec->mic_led_coef_idx,
4618 ++ spec->mic_led_coefbit_mask, spec->mic_led_coefbit_off);
4619 ++}
4620 ++
4621 ++static void alc285_fixup_hp_coef_micmute_led(struct hda_codec *codec,
4622 ++ const struct hda_fixup *fix, int action)
4623 ++{
4624 ++ struct alc_spec *spec = codec->spec;
4625 ++
4626 ++ if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4627 ++ spec->mic_led_coef_idx = 0x19;
4628 ++ spec->mic_led_coefbit_mask = 1<<13;
4629 ++ spec->mic_led_coefbit_on = 1<<13;
4630 ++ spec->mic_led_coefbit_off = 0;
4631 ++ snd_hda_gen_add_micmute_led(codec, alc_hp_cap_micmute_update);
4632 ++ }
4633 ++}
4634 ++
4635 ++static void alc236_fixup_hp_coef_micmute_led(struct hda_codec *codec,
4636 ++ const struct hda_fixup *fix, int action)
4637 ++{
4638 ++ struct alc_spec *spec = codec->spec;
4639 ++
4640 ++ if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4641 ++ spec->mic_led_coef_idx = 0x35;
4642 ++ spec->mic_led_coefbit_mask = 3<<2;
4643 ++ spec->mic_led_coefbit_on = 2<<2;
4644 ++ spec->mic_led_coefbit_off = 1<<2;
4645 ++ snd_hda_gen_add_micmute_led(codec, alc_hp_cap_micmute_update);
4646 ++ }
4647 ++}
4648 ++
4649 ++static void alc285_fixup_hp_mute_led(struct hda_codec *codec,
4650 ++ const struct hda_fixup *fix, int action)
4651 ++{
4652 ++ alc285_fixup_hp_mute_led_coefbit(codec, fix, action);
4653 ++ alc285_fixup_hp_coef_micmute_led(codec, fix, action);
4654 ++}
4655 ++
4656 ++static void alc236_fixup_hp_mute_led(struct hda_codec *codec,
4657 ++ const struct hda_fixup *fix, int action)
4658 ++{
4659 ++ alc236_fixup_hp_mute_led_coefbit(codec, fix, action);
4660 ++ alc236_fixup_hp_coef_micmute_led(codec, fix, action);
4661 ++}
4662 ++
4663 + #if IS_REACHABLE(CONFIG_INPUT)
4664 + static void gpio2_mic_hotkey_event(struct hda_codec *codec,
4665 + struct hda_jack_callback *event)
4666 +@@ -5980,6 +6097,10 @@ enum {
4667 + ALC294_FIXUP_ASUS_HPE,
4668 + ALC294_FIXUP_ASUS_COEF_1B,
4669 + ALC285_FIXUP_HP_GPIO_LED,
4670 ++ ALC285_FIXUP_HP_MUTE_LED,
4671 ++ ALC236_FIXUP_HP_MUTE_LED,
4672 ++ ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET,
4673 ++ ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
4674 + };
4675 +
4676 + static const struct hda_fixup alc269_fixups[] = {
4677 +@@ -7128,6 +7249,30 @@ static const struct hda_fixup alc269_fixups[] = {
4678 + .type = HDA_FIXUP_FUNC,
4679 + .v.func = alc285_fixup_hp_gpio_led,
4680 + },
4681 ++ [ALC285_FIXUP_HP_MUTE_LED] = {
4682 ++ .type = HDA_FIXUP_FUNC,
4683 ++ .v.func = alc285_fixup_hp_mute_led,
4684 ++ },
4685 ++ [ALC236_FIXUP_HP_MUTE_LED] = {
4686 ++ .type = HDA_FIXUP_FUNC,
4687 ++ .v.func = alc236_fixup_hp_mute_led,
4688 ++ },
4689 ++ [ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET] = {
4690 ++ .type = HDA_FIXUP_VERBS,
4691 ++ .v.verbs = (const struct hda_verb[]) {
4692 ++ { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc5 },
4693 ++ { }
4694 ++ },
4695 ++ },
4696 ++ [ALC295_FIXUP_ASUS_MIC_NO_PRESENCE] = {
4697 ++ .type = HDA_FIXUP_PINS,
4698 ++ .v.pins = (const struct hda_pintbl[]) {
4699 ++ { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
4700 ++ { }
4701 ++ },
4702 ++ .chained = true,
4703 ++ .chain_id = ALC269_FIXUP_HEADSET_MODE
4704 ++ },
4705 + };
4706 +
4707 + static const struct snd_pci_quirk alc269_fixup_tbl[] = {
4708 +@@ -7273,6 +7418,8 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
4709 + SND_PCI_QUIRK(0x103c, 0x8497, "HP Envy x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
4710 + SND_PCI_QUIRK(0x103c, 0x84e7, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3),
4711 + SND_PCI_QUIRK(0x103c, 0x8736, "HP", ALC285_FIXUP_HP_GPIO_LED),
4712 ++ SND_PCI_QUIRK(0x103c, 0x877a, "HP", ALC285_FIXUP_HP_MUTE_LED),
4713 ++ SND_PCI_QUIRK(0x103c, 0x877d, "HP", ALC236_FIXUP_HP_MUTE_LED),
4714 + SND_PCI_QUIRK(0x1043, 0x103e, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
4715 + SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300),
4716 + SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
4717 +@@ -7293,6 +7440,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
4718 + SND_PCI_QUIRK(0x1043, 0x18b1, "Asus MJ401TA", ALC256_FIXUP_ASUS_HEADSET_MIC),
4719 + SND_PCI_QUIRK(0x1043, 0x18f1, "Asus FX505DT", ALC256_FIXUP_ASUS_HEADSET_MIC),
4720 + SND_PCI_QUIRK(0x1043, 0x19ce, "ASUS B9450FA", ALC294_FIXUP_ASUS_HPE),
4721 ++ SND_PCI_QUIRK(0x1043, 0x19e1, "ASUS UX581LV", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE),
4722 + SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
4723 + SND_PCI_QUIRK(0x1043, 0x1a30, "ASUS X705UD", ALC256_FIXUP_ASUS_MIC),
4724 + SND_PCI_QUIRK(0x1043, 0x1b11, "ASUS UX431DA", ALC294_FIXUP_ASUS_COEF_1B),
4725 +@@ -7321,6 +7469,8 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
4726 + SND_PCI_QUIRK(0x10ec, 0x10f2, "Intel Reference board", ALC700_FIXUP_INTEL_REFERENCE),
4727 + SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-SZ6", ALC269_FIXUP_HEADSET_MODE),
4728 + SND_PCI_QUIRK(0x144d, 0xc109, "Samsung Ativ book 9 (NP900X3G)", ALC269_FIXUP_INV_DMIC),
4729 ++ SND_PCI_QUIRK(0x144d, 0xc169, "Samsung Notebook 9 Pen (NP930SBE-K01US)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
4730 ++ SND_PCI_QUIRK(0x144d, 0xc176, "Samsung Notebook 9 Pro (NP930MBE-K04US)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
4731 + SND_PCI_QUIRK(0x144d, 0xc740, "Samsung Ativ book 8 (NP870Z5G)", ALC269_FIXUP_ATIV_BOOK_8),
4732 + SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_HEADSET_MIC),
4733 + SND_PCI_QUIRK(0x1462, 0xb120, "MSI Cubi MS-B120", ALC283_FIXUP_HEADSET_MIC),
4734 +@@ -7905,6 +8055,18 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
4735 + {0x12, 0x90a60130},
4736 + {0x17, 0x90170110},
4737 + {0x21, 0x03211020}),
4738 ++ SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
4739 ++ {0x12, 0x90a60120},
4740 ++ {0x17, 0x90170110},
4741 ++ {0x21, 0x04211030}),
4742 ++ SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
4743 ++ {0x12, 0x90a60130},
4744 ++ {0x17, 0x90170110},
4745 ++ {0x21, 0x03211020}),
4746 ++ SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
4747 ++ {0x12, 0x90a60130},
4748 ++ {0x17, 0x90170110},
4749 ++ {0x21, 0x03211020}),
4750 + SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
4751 + {0x14, 0x90170110},
4752 + {0x21, 0x04211020}),
4753 +diff --git a/sound/pci/ice1712/ice1712.c b/sound/pci/ice1712/ice1712.c
4754 +index 884d0cdec08c..73e1e5400506 100644
4755 +--- a/sound/pci/ice1712/ice1712.c
4756 ++++ b/sound/pci/ice1712/ice1712.c
4757 +@@ -2332,7 +2332,8 @@ static int snd_ice1712_chip_init(struct snd_ice1712 *ice)
4758 + pci_write_config_byte(ice->pci, 0x61, ice->eeprom.data[ICE_EEP1_ACLINK]);
4759 + pci_write_config_byte(ice->pci, 0x62, ice->eeprom.data[ICE_EEP1_I2SID]);
4760 + pci_write_config_byte(ice->pci, 0x63, ice->eeprom.data[ICE_EEP1_SPDIF]);
4761 +- if (ice->eeprom.subvendor != ICE1712_SUBDEVICE_STDSP24) {
4762 ++ if (ice->eeprom.subvendor != ICE1712_SUBDEVICE_STDSP24 &&
4763 ++ ice->eeprom.subvendor != ICE1712_SUBDEVICE_STAUDIO_ADCIII) {
4764 + ice->gpio.write_mask = ice->eeprom.gpiomask;
4765 + ice->gpio.direction = ice->eeprom.gpiodir;
4766 + snd_ice1712_write(ice, ICE1712_IREG_GPIO_WRITE_MASK,
4767 +diff --git a/tools/bootconfig/main.c b/tools/bootconfig/main.c
4768 +index a9b97814d1a9..37fb2e85de12 100644
4769 +--- a/tools/bootconfig/main.c
4770 ++++ b/tools/bootconfig/main.c
4771 +@@ -287,6 +287,7 @@ int apply_xbc(const char *path, const char *xbc_path)
4772 + ret = delete_xbc(path);
4773 + if (ret < 0) {
4774 + pr_err("Failed to delete previous boot config: %d\n", ret);
4775 ++ free(data);
4776 + return ret;
4777 + }
4778 +
4779 +@@ -294,24 +295,27 @@ int apply_xbc(const char *path, const char *xbc_path)
4780 + fd = open(path, O_RDWR | O_APPEND);
4781 + if (fd < 0) {
4782 + pr_err("Failed to open %s: %d\n", path, fd);
4783 ++ free(data);
4784 + return fd;
4785 + }
4786 + /* TODO: Ensure the @path is initramfs/initrd image */
4787 + ret = write(fd, data, size + 8);
4788 + if (ret < 0) {
4789 + pr_err("Failed to apply a boot config: %d\n", ret);
4790 +- return ret;
4791 ++ goto out;
4792 + }
4793 + /* Write a magic word of the bootconfig */
4794 + ret = write(fd, BOOTCONFIG_MAGIC, BOOTCONFIG_MAGIC_LEN);
4795 + if (ret < 0) {
4796 + pr_err("Failed to apply a boot config magic: %d\n", ret);
4797 +- return ret;
4798 ++ goto out;
4799 + }
4800 ++ ret = 0;
4801 ++out:
4802 + close(fd);
4803 + free(data);
4804 +
4805 +- return 0;
4806 ++ return ret;
4807 + }
4808 +
4809 + int usage(void)
4810 +diff --git a/tools/testing/selftests/bpf/prog_tests/mmap.c b/tools/testing/selftests/bpf/prog_tests/mmap.c
4811 +index b0e789678aa4..5495b669fccc 100644
4812 +--- a/tools/testing/selftests/bpf/prog_tests/mmap.c
4813 ++++ b/tools/testing/selftests/bpf/prog_tests/mmap.c
4814 +@@ -19,7 +19,7 @@ void test_mmap(void)
4815 + const size_t map_sz = roundup_page(sizeof(struct map_data));
4816 + const int zero = 0, one = 1, two = 2, far = 1500;
4817 + const long page_size = sysconf(_SC_PAGE_SIZE);
4818 +- int err, duration = 0, i, data_map_fd;
4819 ++ int err, duration = 0, i, data_map_fd, rdmap_fd;
4820 + struct bpf_map *data_map, *bss_map;
4821 + void *bss_mmaped = NULL, *map_mmaped = NULL, *tmp1, *tmp2;
4822 + struct test_mmap__bss *bss_data;
4823 +@@ -36,6 +36,17 @@ void test_mmap(void)
4824 + data_map = skel->maps.data_map;
4825 + data_map_fd = bpf_map__fd(data_map);
4826 +
4827 ++ rdmap_fd = bpf_map__fd(skel->maps.rdonly_map);
4828 ++ tmp1 = mmap(NULL, 4096, PROT_READ | PROT_WRITE, MAP_SHARED, rdmap_fd, 0);
4829 ++ if (CHECK(tmp1 != MAP_FAILED, "rdonly_write_mmap", "unexpected success\n")) {
4830 ++ munmap(tmp1, 4096);
4831 ++ goto cleanup;
4832 ++ }
4833 ++ /* now double-check if it's mmap()'able at all */
4834 ++ tmp1 = mmap(NULL, 4096, PROT_READ, MAP_SHARED, rdmap_fd, 0);
4835 ++ if (CHECK(tmp1 == MAP_FAILED, "rdonly_read_mmap", "failed: %d\n", errno))
4836 ++ goto cleanup;
4837 ++
4838 + bss_mmaped = mmap(NULL, bss_sz, PROT_READ | PROT_WRITE, MAP_SHARED,
4839 + bpf_map__fd(bss_map), 0);
4840 + if (CHECK(bss_mmaped == MAP_FAILED, "bss_mmap",
4841 +diff --git a/tools/testing/selftests/bpf/progs/test_mmap.c b/tools/testing/selftests/bpf/progs/test_mmap.c
4842 +index 6239596cd14e..4eb42cff5fe9 100644
4843 +--- a/tools/testing/selftests/bpf/progs/test_mmap.c
4844 ++++ b/tools/testing/selftests/bpf/progs/test_mmap.c
4845 +@@ -7,6 +7,14 @@
4846 +
4847 + char _license[] SEC("license") = "GPL";
4848 +
4849 ++struct {
4850 ++ __uint(type, BPF_MAP_TYPE_ARRAY);
4851 ++ __uint(max_entries, 4096);
4852 ++ __uint(map_flags, BPF_F_MMAPABLE | BPF_F_RDONLY_PROG);
4853 ++ __type(key, __u32);
4854 ++ __type(value, char);
4855 ++} rdonly_map SEC(".maps");
4856 ++
4857 + struct {
4858 + __uint(type, BPF_MAP_TYPE_ARRAY);
4859 + __uint(max_entries, 512 * 4); /* at least 4 pages of data */
4860 +diff --git a/tools/testing/selftests/ftrace/ftracetest b/tools/testing/selftests/ftrace/ftracetest
4861 +index 144308a757b7..19e9236dec5e 100755
4862 +--- a/tools/testing/selftests/ftrace/ftracetest
4863 ++++ b/tools/testing/selftests/ftrace/ftracetest
4864 +@@ -17,6 +17,7 @@ echo " -v|--verbose Increase verbosity of test messages"
4865 + echo " -vv Alias of -v -v (Show all results in stdout)"
4866 + echo " -vvv Alias of -v -v -v (Show all commands immediately)"
4867 + echo " --fail-unsupported Treat UNSUPPORTED as a failure"
4868 ++echo " --fail-unresolved Treat UNRESOLVED as a failure"
4869 + echo " -d|--debug Debug mode (trace all shell commands)"
4870 + echo " -l|--logdir <dir> Save logs on the <dir>"
4871 + echo " If <dir> is -, all logs output in console only"
4872 +@@ -112,6 +113,10 @@ parse_opts() { # opts
4873 + UNSUPPORTED_RESULT=1
4874 + shift 1
4875 + ;;
4876 ++ --fail-unresolved)
4877 ++ UNRESOLVED_RESULT=1
4878 ++ shift 1
4879 ++ ;;
4880 + --logdir|-l)
4881 + LOG_DIR=$2
4882 + shift 2
4883 +@@ -176,6 +181,7 @@ KEEP_LOG=0
4884 + DEBUG=0
4885 + VERBOSE=0
4886 + UNSUPPORTED_RESULT=0
4887 ++UNRESOLVED_RESULT=0
4888 + STOP_FAILURE=0
4889 + # Parse command-line options
4890 + parse_opts $*
4891 +@@ -280,7 +286,7 @@ eval_result() { # sigval
4892 + $UNRESOLVED)
4893 + prlog " [${color_blue}UNRESOLVED${color_reset}]"
4894 + UNRESOLVED_CASES="$UNRESOLVED_CASES $CASENO"
4895 +- return 1 # this is a kind of bug.. something happened.
4896 ++ return $UNRESOLVED_RESULT # depends on use case
4897 + ;;
4898 + $UNTESTED)
4899 + prlog " [${color_blue}UNTESTED${color_reset}]"
4900 +diff --git a/tools/testing/selftests/kvm/Makefile b/tools/testing/selftests/kvm/Makefile
4901 +index d91c53b726e6..75dec268787f 100644
4902 +--- a/tools/testing/selftests/kvm/Makefile
4903 ++++ b/tools/testing/selftests/kvm/Makefile
4904 +@@ -5,8 +5,34 @@ all:
4905 +
4906 + top_srcdir = ../../../..
4907 + KSFT_KHDR_INSTALL := 1
4908 ++
4909 ++# For cross-builds to work, UNAME_M has to map to ARCH and arch specific
4910 ++# directories and targets in this Makefile. "uname -m" doesn't map to
4911 ++# arch specific sub-directory names.
4912 ++#
4913 ++# UNAME_M variable to used to run the compiles pointing to the right arch
4914 ++# directories and build the right targets for these supported architectures.
4915 ++#
4916 ++# TEST_GEN_PROGS and LIBKVM are set using UNAME_M variable.
4917 ++# LINUX_TOOL_ARCH_INCLUDE is set using ARCH variable.
4918 ++#
4919 ++# x86_64 targets are named to include x86_64 as a suffix and directories
4920 ++# for includes are in x86_64 sub-directory. s390x and aarch64 follow the
4921 ++# same convention. "uname -m" doesn't result in the correct mapping for
4922 ++# s390x and aarch64.
4923 ++#
4924 ++# No change necessary for x86_64
4925 + UNAME_M := $(shell uname -m)
4926 +
4927 ++# Set UNAME_M for arm64 compile/install to work
4928 ++ifeq ($(ARCH),arm64)
4929 ++ UNAME_M := aarch64
4930 ++endif
4931 ++# Set UNAME_M s390x compile/install to work
4932 ++ifeq ($(ARCH),s390)
4933 ++ UNAME_M := s390x
4934 ++endif
4935 ++
4936 + LIBKVM = lib/assert.c lib/elf.c lib/io.c lib/kvm_util.c lib/sparsebit.c
4937 + LIBKVM_x86_64 = lib/x86_64/processor.c lib/x86_64/vmx.c lib/x86_64/svm.c lib/x86_64/ucall.c
4938 + LIBKVM_aarch64 = lib/aarch64/processor.c lib/aarch64/ucall.c
4939 +@@ -47,7 +73,7 @@ LIBKVM += $(LIBKVM_$(UNAME_M))
4940 + INSTALL_HDR_PATH = $(top_srcdir)/usr
4941 + LINUX_HDR_PATH = $(INSTALL_HDR_PATH)/include/
4942 + LINUX_TOOL_INCLUDE = $(top_srcdir)/tools/include
4943 +-LINUX_TOOL_ARCH_INCLUDE = $(top_srcdir)/tools/arch/x86/include
4944 ++LINUX_TOOL_ARCH_INCLUDE = $(top_srcdir)/tools/arch/$(ARCH)/include
4945 + CFLAGS += -Wall -Wstrict-prototypes -Wuninitialized -O2 -g -std=gnu99 \
4946 + -fno-stack-protector -fno-PIE -I$(LINUX_TOOL_INCLUDE) \
4947 + -I$(LINUX_TOOL_ARCH_INCLUDE) -I$(LINUX_HDR_PATH) -Iinclude \
4948 +@@ -78,6 +104,7 @@ $(LIBKVM_OBJ): $(OUTPUT)/%.o: %.c
4949 + $(OUTPUT)/libkvm.a: $(LIBKVM_OBJ)
4950 + $(AR) crs $@ $^
4951 +
4952 ++x := $(shell mkdir -p $(sort $(dir $(TEST_GEN_PROGS))))
4953 + all: $(STATIC_LIBS)
4954 + $(TEST_GEN_PROGS): $(STATIC_LIBS)
4955 +
4956 +diff --git a/tools/testing/selftests/kvm/include/evmcs.h b/tools/testing/selftests/kvm/include/evmcs.h
4957 +index 4912d23844bc..e31ac9c5ead0 100644
4958 +--- a/tools/testing/selftests/kvm/include/evmcs.h
4959 ++++ b/tools/testing/selftests/kvm/include/evmcs.h
4960 +@@ -217,8 +217,8 @@ struct hv_enlightened_vmcs {
4961 + #define HV_X64_MSR_VP_ASSIST_PAGE_ADDRESS_MASK \
4962 + (~((1ull << HV_X64_MSR_VP_ASSIST_PAGE_ADDRESS_SHIFT) - 1))
4963 +
4964 +-struct hv_enlightened_vmcs *current_evmcs;
4965 +-struct hv_vp_assist_page *current_vp_assist;
4966 ++extern struct hv_enlightened_vmcs *current_evmcs;
4967 ++extern struct hv_vp_assist_page *current_vp_assist;
4968 +
4969 + int vcpu_enable_evmcs(struct kvm_vm *vm, int vcpu_id);
4970 +
4971 +diff --git a/tools/testing/selftests/kvm/lib/x86_64/vmx.c b/tools/testing/selftests/kvm/lib/x86_64/vmx.c
4972 +index 7aaa99ca4dbc..ce528f3cf093 100644
4973 +--- a/tools/testing/selftests/kvm/lib/x86_64/vmx.c
4974 ++++ b/tools/testing/selftests/kvm/lib/x86_64/vmx.c
4975 +@@ -17,6 +17,9 @@
4976 +
4977 + bool enable_evmcs;
4978 +
4979 ++struct hv_enlightened_vmcs *current_evmcs;
4980 ++struct hv_vp_assist_page *current_vp_assist;
4981 ++
4982 + struct eptPageTableEntry {
4983 + uint64_t readable:1;
4984 + uint64_t writable:1;