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