Gentoo Archives: gentoo-commits

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