Contents of /trunk/kernel-alx/patches-4.19/0166-4.19.67-all-fixes.patch
Parent Directory | Revision Log
Revision 3463 -
(show annotations)
(download)
Tue Oct 29 10:31:24 2019 UTC (4 years, 11 months ago) by niro
File size: 91288 byte(s)
Tue Oct 29 10:31:24 2019 UTC (4 years, 11 months ago) by niro
File size: 91288 byte(s)
-linux-4.19.67
1 | diff --git a/Makefile b/Makefile |
2 | index 065e5b34dc02..b6aa6e8d4411 100644 |
3 | --- a/Makefile |
4 | +++ b/Makefile |
5 | @@ -1,7 +1,7 @@ |
6 | # SPDX-License-Identifier: GPL-2.0 |
7 | VERSION = 4 |
8 | PATCHLEVEL = 19 |
9 | -SUBLEVEL = 66 |
10 | +SUBLEVEL = 67 |
11 | EXTRAVERSION = |
12 | NAME = "People's Front" |
13 | |
14 | diff --git a/arch/arm/boot/dts/bcm47094-linksys-panamera.dts b/arch/arm/boot/dts/bcm47094-linksys-panamera.dts |
15 | index 36efe410dcd7..9e33c41f5411 100644 |
16 | --- a/arch/arm/boot/dts/bcm47094-linksys-panamera.dts |
17 | +++ b/arch/arm/boot/dts/bcm47094-linksys-panamera.dts |
18 | @@ -125,6 +125,9 @@ |
19 | }; |
20 | |
21 | mdio-bus-mux { |
22 | + #address-cells = <1>; |
23 | + #size-cells = <0>; |
24 | + |
25 | /* BIT(9) = 1 => external mdio */ |
26 | mdio_ext: mdio@200 { |
27 | reg = <0x200>; |
28 | diff --git a/arch/arm/mach-davinci/sleep.S b/arch/arm/mach-davinci/sleep.S |
29 | index cd350dee4df3..efcd400b2abb 100644 |
30 | --- a/arch/arm/mach-davinci/sleep.S |
31 | +++ b/arch/arm/mach-davinci/sleep.S |
32 | @@ -37,6 +37,7 @@ |
33 | #define DEEPSLEEP_SLEEPENABLE_BIT BIT(31) |
34 | |
35 | .text |
36 | + .arch armv5te |
37 | /* |
38 | * Move DaVinci into deep sleep state |
39 | * |
40 | diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c |
41 | index 578174a33d22..51cd66dc1bb0 100644 |
42 | --- a/arch/powerpc/kvm/powerpc.c |
43 | +++ b/arch/powerpc/kvm/powerpc.c |
44 | @@ -61,6 +61,11 @@ int kvm_arch_vcpu_runnable(struct kvm_vcpu *v) |
45 | return !!(v->arch.pending_exceptions) || kvm_request_pending(v); |
46 | } |
47 | |
48 | +bool kvm_arch_dy_runnable(struct kvm_vcpu *vcpu) |
49 | +{ |
50 | + return kvm_arch_vcpu_runnable(vcpu); |
51 | +} |
52 | + |
53 | bool kvm_arch_vcpu_in_kernel(struct kvm_vcpu *vcpu) |
54 | { |
55 | return false; |
56 | diff --git a/arch/s390/include/asm/page.h b/arch/s390/include/asm/page.h |
57 | index 41e3908b397f..0d753291c43c 100644 |
58 | --- a/arch/s390/include/asm/page.h |
59 | +++ b/arch/s390/include/asm/page.h |
60 | @@ -176,6 +176,8 @@ static inline int devmem_is_allowed(unsigned long pfn) |
61 | #define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | \ |
62 | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) |
63 | |
64 | +#define ARCH_ZONE_DMA_BITS 31 |
65 | + |
66 | #include <asm-generic/memory_model.h> |
67 | #include <asm-generic/getorder.h> |
68 | |
69 | diff --git a/arch/x86/boot/string.c b/arch/x86/boot/string.c |
70 | index c4428a176973..2622c0742c92 100644 |
71 | --- a/arch/x86/boot/string.c |
72 | +++ b/arch/x86/boot/string.c |
73 | @@ -34,6 +34,14 @@ int memcmp(const void *s1, const void *s2, size_t len) |
74 | return diff; |
75 | } |
76 | |
77 | +/* |
78 | + * Clang may lower `memcmp == 0` to `bcmp == 0`. |
79 | + */ |
80 | +int bcmp(const void *s1, const void *s2, size_t len) |
81 | +{ |
82 | + return memcmp(s1, s2, len); |
83 | +} |
84 | + |
85 | int strcmp(const char *str1, const char *str2) |
86 | { |
87 | const unsigned char *s1 = (const unsigned char *)str1; |
88 | diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h |
89 | index 2877e1fbadd8..3245b95ad2d9 100644 |
90 | --- a/arch/x86/include/asm/kvm_host.h |
91 | +++ b/arch/x86/include/asm/kvm_host.h |
92 | @@ -1113,6 +1113,7 @@ struct kvm_x86_ops { |
93 | int (*update_pi_irte)(struct kvm *kvm, unsigned int host_irq, |
94 | uint32_t guest_irq, bool set); |
95 | void (*apicv_post_state_restore)(struct kvm_vcpu *vcpu); |
96 | + bool (*dy_apicv_has_pending_interrupt)(struct kvm_vcpu *vcpu); |
97 | |
98 | int (*set_hv_timer)(struct kvm_vcpu *vcpu, u64 guest_deadline_tsc); |
99 | void (*cancel_hv_timer)(struct kvm_vcpu *vcpu); |
100 | diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c |
101 | index ea454d3f7763..0f33f00aa4df 100644 |
102 | --- a/arch/x86/kvm/svm.c |
103 | +++ b/arch/x86/kvm/svm.c |
104 | @@ -5146,6 +5146,11 @@ static void svm_deliver_avic_intr(struct kvm_vcpu *vcpu, int vec) |
105 | kvm_vcpu_wake_up(vcpu); |
106 | } |
107 | |
108 | +static bool svm_dy_apicv_has_pending_interrupt(struct kvm_vcpu *vcpu) |
109 | +{ |
110 | + return false; |
111 | +} |
112 | + |
113 | static void svm_ir_list_del(struct vcpu_svm *svm, struct amd_iommu_pi_data *pi) |
114 | { |
115 | unsigned long flags; |
116 | @@ -7203,6 +7208,7 @@ static struct kvm_x86_ops svm_x86_ops __ro_after_init = { |
117 | |
118 | .pmu_ops = &amd_pmu_ops, |
119 | .deliver_posted_interrupt = svm_deliver_avic_intr, |
120 | + .dy_apicv_has_pending_interrupt = svm_dy_apicv_has_pending_interrupt, |
121 | .update_pi_irte = svm_update_pi_irte, |
122 | .setup_mce = svm_setup_mce, |
123 | |
124 | diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c |
125 | index 4cf16378dffe..2e310ea62d60 100644 |
126 | --- a/arch/x86/kvm/vmx.c |
127 | +++ b/arch/x86/kvm/vmx.c |
128 | @@ -10411,6 +10411,11 @@ static u8 vmx_has_apicv_interrupt(struct kvm_vcpu *vcpu) |
129 | return ((rvi & 0xf0) > (vppr & 0xf0)); |
130 | } |
131 | |
132 | +static bool vmx_dy_apicv_has_pending_interrupt(struct kvm_vcpu *vcpu) |
133 | +{ |
134 | + return pi_test_on(vcpu_to_pi_desc(vcpu)); |
135 | +} |
136 | + |
137 | static void vmx_load_eoi_exitmap(struct kvm_vcpu *vcpu, u64 *eoi_exit_bitmap) |
138 | { |
139 | if (!kvm_vcpu_apicv_active(vcpu)) |
140 | @@ -14387,6 +14392,7 @@ static struct kvm_x86_ops vmx_x86_ops __ro_after_init = { |
141 | .guest_apic_has_interrupt = vmx_guest_apic_has_interrupt, |
142 | .sync_pir_to_irr = vmx_sync_pir_to_irr, |
143 | .deliver_posted_interrupt = vmx_deliver_posted_interrupt, |
144 | + .dy_apicv_has_pending_interrupt = vmx_dy_apicv_has_pending_interrupt, |
145 | |
146 | .set_tss_addr = vmx_set_tss_addr, |
147 | .set_identity_map_addr = vmx_set_identity_map_addr, |
148 | diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c |
149 | index cea6568667c4..e10a7a42449b 100644 |
150 | --- a/arch/x86/kvm/x86.c |
151 | +++ b/arch/x86/kvm/x86.c |
152 | @@ -9336,6 +9336,22 @@ int kvm_arch_vcpu_runnable(struct kvm_vcpu *vcpu) |
153 | return kvm_vcpu_running(vcpu) || kvm_vcpu_has_events(vcpu); |
154 | } |
155 | |
156 | +bool kvm_arch_dy_runnable(struct kvm_vcpu *vcpu) |
157 | +{ |
158 | + if (READ_ONCE(vcpu->arch.pv.pv_unhalted)) |
159 | + return true; |
160 | + |
161 | + if (kvm_test_request(KVM_REQ_NMI, vcpu) || |
162 | + kvm_test_request(KVM_REQ_SMI, vcpu) || |
163 | + kvm_test_request(KVM_REQ_EVENT, vcpu)) |
164 | + return true; |
165 | + |
166 | + if (vcpu->arch.apicv_active && kvm_x86_ops->dy_apicv_has_pending_interrupt(vcpu)) |
167 | + return true; |
168 | + |
169 | + return false; |
170 | +} |
171 | + |
172 | bool kvm_arch_vcpu_in_kernel(struct kvm_vcpu *vcpu) |
173 | { |
174 | return vcpu->arch.preempted_in_kernel; |
175 | diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c |
176 | index 9d9765e4d1ef..1bcb7242ad79 100644 |
177 | --- a/arch/x86/mm/fault.c |
178 | +++ b/arch/x86/mm/fault.c |
179 | @@ -261,13 +261,14 @@ static inline pmd_t *vmalloc_sync_one(pgd_t *pgd, unsigned long address) |
180 | |
181 | pmd = pmd_offset(pud, address); |
182 | pmd_k = pmd_offset(pud_k, address); |
183 | - if (!pmd_present(*pmd_k)) |
184 | - return NULL; |
185 | |
186 | - if (!pmd_present(*pmd)) |
187 | + if (pmd_present(*pmd) != pmd_present(*pmd_k)) |
188 | set_pmd(pmd, *pmd_k); |
189 | + |
190 | + if (!pmd_present(*pmd_k)) |
191 | + return NULL; |
192 | else |
193 | - BUG_ON(pmd_page(*pmd) != pmd_page(*pmd_k)); |
194 | + BUG_ON(pmd_pfn(*pmd) != pmd_pfn(*pmd_k)); |
195 | |
196 | return pmd_k; |
197 | } |
198 | @@ -287,17 +288,13 @@ void vmalloc_sync_all(void) |
199 | spin_lock(&pgd_lock); |
200 | list_for_each_entry(page, &pgd_list, lru) { |
201 | spinlock_t *pgt_lock; |
202 | - pmd_t *ret; |
203 | |
204 | /* the pgt_lock only for Xen */ |
205 | pgt_lock = &pgd_page_get_mm(page)->page_table_lock; |
206 | |
207 | spin_lock(pgt_lock); |
208 | - ret = vmalloc_sync_one(page_address(page), address); |
209 | + vmalloc_sync_one(page_address(page), address); |
210 | spin_unlock(pgt_lock); |
211 | - |
212 | - if (!ret) |
213 | - break; |
214 | } |
215 | spin_unlock(&pgd_lock); |
216 | } |
217 | diff --git a/arch/x86/purgatory/Makefile b/arch/x86/purgatory/Makefile |
218 | index 3cf302b26332..8901a1f89cf5 100644 |
219 | --- a/arch/x86/purgatory/Makefile |
220 | +++ b/arch/x86/purgatory/Makefile |
221 | @@ -6,6 +6,9 @@ purgatory-y := purgatory.o stack.o setup-x86_$(BITS).o sha256.o entry64.o string |
222 | targets += $(purgatory-y) |
223 | PURGATORY_OBJS = $(addprefix $(obj)/,$(purgatory-y)) |
224 | |
225 | +$(obj)/string.o: $(srctree)/arch/x86/boot/compressed/string.c FORCE |
226 | + $(call if_changed_rule,cc_o_c) |
227 | + |
228 | $(obj)/sha256.o: $(srctree)/lib/sha256.c FORCE |
229 | $(call if_changed_rule,cc_o_c) |
230 | |
231 | @@ -17,11 +20,34 @@ KCOV_INSTRUMENT := n |
232 | |
233 | # Default KBUILD_CFLAGS can have -pg option set when FTRACE is enabled. That |
234 | # in turn leaves some undefined symbols like __fentry__ in purgatory and not |
235 | -# sure how to relocate those. Like kexec-tools, use custom flags. |
236 | - |
237 | -KBUILD_CFLAGS := -fno-strict-aliasing -Wall -Wstrict-prototypes -fno-zero-initialized-in-bss -fno-builtin -ffreestanding -c -Os -mcmodel=large |
238 | -KBUILD_CFLAGS += -m$(BITS) |
239 | -KBUILD_CFLAGS += $(call cc-option,-fno-PIE) |
240 | +# sure how to relocate those. |
241 | +ifdef CONFIG_FUNCTION_TRACER |
242 | +CFLAGS_REMOVE_sha256.o += $(CC_FLAGS_FTRACE) |
243 | +CFLAGS_REMOVE_purgatory.o += $(CC_FLAGS_FTRACE) |
244 | +CFLAGS_REMOVE_string.o += $(CC_FLAGS_FTRACE) |
245 | +CFLAGS_REMOVE_kexec-purgatory.o += $(CC_FLAGS_FTRACE) |
246 | +endif |
247 | + |
248 | +ifdef CONFIG_STACKPROTECTOR |
249 | +CFLAGS_REMOVE_sha256.o += -fstack-protector |
250 | +CFLAGS_REMOVE_purgatory.o += -fstack-protector |
251 | +CFLAGS_REMOVE_string.o += -fstack-protector |
252 | +CFLAGS_REMOVE_kexec-purgatory.o += -fstack-protector |
253 | +endif |
254 | + |
255 | +ifdef CONFIG_STACKPROTECTOR_STRONG |
256 | +CFLAGS_REMOVE_sha256.o += -fstack-protector-strong |
257 | +CFLAGS_REMOVE_purgatory.o += -fstack-protector-strong |
258 | +CFLAGS_REMOVE_string.o += -fstack-protector-strong |
259 | +CFLAGS_REMOVE_kexec-purgatory.o += -fstack-protector-strong |
260 | +endif |
261 | + |
262 | +ifdef CONFIG_RETPOLINE |
263 | +CFLAGS_REMOVE_sha256.o += $(RETPOLINE_CFLAGS) |
264 | +CFLAGS_REMOVE_purgatory.o += $(RETPOLINE_CFLAGS) |
265 | +CFLAGS_REMOVE_string.o += $(RETPOLINE_CFLAGS) |
266 | +CFLAGS_REMOVE_kexec-purgatory.o += $(RETPOLINE_CFLAGS) |
267 | +endif |
268 | |
269 | $(obj)/purgatory.ro: $(PURGATORY_OBJS) FORCE |
270 | $(call if_changed,ld) |
271 | diff --git a/arch/x86/purgatory/purgatory.c b/arch/x86/purgatory/purgatory.c |
272 | index 025c34ac0d84..7971f7a8af59 100644 |
273 | --- a/arch/x86/purgatory/purgatory.c |
274 | +++ b/arch/x86/purgatory/purgatory.c |
275 | @@ -70,3 +70,9 @@ void purgatory(void) |
276 | } |
277 | copy_backup_region(); |
278 | } |
279 | + |
280 | +/* |
281 | + * Defined in order to reuse memcpy() and memset() from |
282 | + * arch/x86/boot/compressed/string.c |
283 | + */ |
284 | +void warn(const char *msg) {} |
285 | diff --git a/arch/x86/purgatory/string.c b/arch/x86/purgatory/string.c |
286 | deleted file mode 100644 |
287 | index 795ca4f2cb3c..000000000000 |
288 | --- a/arch/x86/purgatory/string.c |
289 | +++ /dev/null |
290 | @@ -1,25 +0,0 @@ |
291 | -/* |
292 | - * Simple string functions. |
293 | - * |
294 | - * Copyright (C) 2014 Red Hat Inc. |
295 | - * |
296 | - * Author: |
297 | - * Vivek Goyal <vgoyal@redhat.com> |
298 | - * |
299 | - * This source code is licensed under the GNU General Public License, |
300 | - * Version 2. See the file COPYING for more details. |
301 | - */ |
302 | - |
303 | -#include <linux/types.h> |
304 | - |
305 | -#include "../boot/string.c" |
306 | - |
307 | -void *memcpy(void *dst, const void *src, size_t len) |
308 | -{ |
309 | - return __builtin_memcpy(dst, src, len); |
310 | -} |
311 | - |
312 | -void *memset(void *dst, int c, size_t len) |
313 | -{ |
314 | - return __builtin_memset(dst, c, len); |
315 | -} |
316 | diff --git a/drivers/acpi/arm64/iort.c b/drivers/acpi/arm64/iort.c |
317 | index 43c2615434b4..e11b5da6f828 100644 |
318 | --- a/drivers/acpi/arm64/iort.c |
319 | +++ b/drivers/acpi/arm64/iort.c |
320 | @@ -616,8 +616,8 @@ static int iort_dev_find_its_id(struct device *dev, u32 req_id, |
321 | |
322 | /* Move to ITS specific data */ |
323 | its = (struct acpi_iort_its_group *)node->node_data; |
324 | - if (idx > its->its_count) { |
325 | - dev_err(dev, "requested ITS ID index [%d] is greater than available [%d]\n", |
326 | + if (idx >= its->its_count) { |
327 | + dev_err(dev, "requested ITS ID index [%d] overruns ITS entries [%d]\n", |
328 | idx, its->its_count); |
329 | return -ENXIO; |
330 | } |
331 | diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c |
332 | index cb919b964066..3cdadf75c82d 100644 |
333 | --- a/drivers/block/drbd/drbd_receiver.c |
334 | +++ b/drivers/block/drbd/drbd_receiver.c |
335 | @@ -5240,7 +5240,7 @@ static int drbd_do_auth(struct drbd_connection *connection) |
336 | unsigned int key_len; |
337 | char secret[SHARED_SECRET_MAX]; /* 64 byte */ |
338 | unsigned int resp_size; |
339 | - SHASH_DESC_ON_STACK(desc, connection->cram_hmac_tfm); |
340 | + struct shash_desc *desc; |
341 | struct packet_info pi; |
342 | struct net_conf *nc; |
343 | int err, rv; |
344 | @@ -5253,6 +5253,13 @@ static int drbd_do_auth(struct drbd_connection *connection) |
345 | memcpy(secret, nc->shared_secret, key_len); |
346 | rcu_read_unlock(); |
347 | |
348 | + desc = kmalloc(sizeof(struct shash_desc) + |
349 | + crypto_shash_descsize(connection->cram_hmac_tfm), |
350 | + GFP_KERNEL); |
351 | + if (!desc) { |
352 | + rv = -1; |
353 | + goto fail; |
354 | + } |
355 | desc->tfm = connection->cram_hmac_tfm; |
356 | desc->flags = 0; |
357 | |
358 | @@ -5395,7 +5402,10 @@ static int drbd_do_auth(struct drbd_connection *connection) |
359 | kfree(peers_ch); |
360 | kfree(response); |
361 | kfree(right_response); |
362 | - shash_desc_zero(desc); |
363 | + if (desc) { |
364 | + shash_desc_zero(desc); |
365 | + kfree(desc); |
366 | + } |
367 | |
368 | return rv; |
369 | } |
370 | diff --git a/drivers/block/loop.c b/drivers/block/loop.c |
371 | index f1e63eb7cbca..cef8e00c9d9d 100644 |
372 | --- a/drivers/block/loop.c |
373 | +++ b/drivers/block/loop.c |
374 | @@ -886,7 +886,7 @@ static void loop_unprepare_queue(struct loop_device *lo) |
375 | |
376 | static int loop_kthread_worker_fn(void *worker_ptr) |
377 | { |
378 | - current->flags |= PF_LESS_THROTTLE; |
379 | + current->flags |= PF_LESS_THROTTLE | PF_MEMALLOC_NOIO; |
380 | return kthread_worker_fn(worker_ptr); |
381 | } |
382 | |
383 | diff --git a/drivers/cpufreq/pasemi-cpufreq.c b/drivers/cpufreq/pasemi-cpufreq.c |
384 | index c7710c149de8..a0620c9ec064 100644 |
385 | --- a/drivers/cpufreq/pasemi-cpufreq.c |
386 | +++ b/drivers/cpufreq/pasemi-cpufreq.c |
387 | @@ -145,10 +145,18 @@ static int pas_cpufreq_cpu_init(struct cpufreq_policy *policy) |
388 | int err = -ENODEV; |
389 | |
390 | cpu = of_get_cpu_node(policy->cpu, NULL); |
391 | + if (!cpu) |
392 | + goto out; |
393 | |
394 | + max_freqp = of_get_property(cpu, "clock-frequency", NULL); |
395 | of_node_put(cpu); |
396 | - if (!cpu) |
397 | + if (!max_freqp) { |
398 | + err = -EINVAL; |
399 | goto out; |
400 | + } |
401 | + |
402 | + /* we need the freq in kHz */ |
403 | + max_freq = *max_freqp / 1000; |
404 | |
405 | dn = of_find_compatible_node(NULL, NULL, "1682m-sdc"); |
406 | if (!dn) |
407 | @@ -185,16 +193,6 @@ static int pas_cpufreq_cpu_init(struct cpufreq_policy *policy) |
408 | } |
409 | |
410 | pr_debug("init cpufreq on CPU %d\n", policy->cpu); |
411 | - |
412 | - max_freqp = of_get_property(cpu, "clock-frequency", NULL); |
413 | - if (!max_freqp) { |
414 | - err = -EINVAL; |
415 | - goto out_unmap_sdcpwr; |
416 | - } |
417 | - |
418 | - /* we need the freq in kHz */ |
419 | - max_freq = *max_freqp / 1000; |
420 | - |
421 | pr_debug("max clock-frequency is at %u kHz\n", max_freq); |
422 | pr_debug("initializing frequency table\n"); |
423 | |
424 | @@ -212,9 +210,6 @@ static int pas_cpufreq_cpu_init(struct cpufreq_policy *policy) |
425 | |
426 | return cpufreq_generic_init(policy, pas_freqs, get_gizmo_latency()); |
427 | |
428 | -out_unmap_sdcpwr: |
429 | - iounmap(sdcpwr_mapbase); |
430 | - |
431 | out_unmap_sdcasr: |
432 | iounmap(sdcasr_mapbase); |
433 | out: |
434 | diff --git a/drivers/crypto/ccp/ccp-crypto-aes-galois.c b/drivers/crypto/ccp/ccp-crypto-aes-galois.c |
435 | index ca1f0d780b61..e5dcb29b687f 100644 |
436 | --- a/drivers/crypto/ccp/ccp-crypto-aes-galois.c |
437 | +++ b/drivers/crypto/ccp/ccp-crypto-aes-galois.c |
438 | @@ -61,6 +61,19 @@ static int ccp_aes_gcm_setkey(struct crypto_aead *tfm, const u8 *key, |
439 | static int ccp_aes_gcm_setauthsize(struct crypto_aead *tfm, |
440 | unsigned int authsize) |
441 | { |
442 | + switch (authsize) { |
443 | + case 16: |
444 | + case 15: |
445 | + case 14: |
446 | + case 13: |
447 | + case 12: |
448 | + case 8: |
449 | + case 4: |
450 | + break; |
451 | + default: |
452 | + return -EINVAL; |
453 | + } |
454 | + |
455 | return 0; |
456 | } |
457 | |
458 | @@ -107,6 +120,7 @@ static int ccp_aes_gcm_crypt(struct aead_request *req, bool encrypt) |
459 | memset(&rctx->cmd, 0, sizeof(rctx->cmd)); |
460 | INIT_LIST_HEAD(&rctx->cmd.entry); |
461 | rctx->cmd.engine = CCP_ENGINE_AES; |
462 | + rctx->cmd.u.aes.authsize = crypto_aead_authsize(tfm); |
463 | rctx->cmd.u.aes.type = ctx->u.aes.type; |
464 | rctx->cmd.u.aes.mode = ctx->u.aes.mode; |
465 | rctx->cmd.u.aes.action = encrypt; |
466 | diff --git a/drivers/crypto/ccp/ccp-ops.c b/drivers/crypto/ccp/ccp-ops.c |
467 | index e212badd39fa..1e2e42106dee 100644 |
468 | --- a/drivers/crypto/ccp/ccp-ops.c |
469 | +++ b/drivers/crypto/ccp/ccp-ops.c |
470 | @@ -625,6 +625,7 @@ static int ccp_run_aes_gcm_cmd(struct ccp_cmd_queue *cmd_q, |
471 | |
472 | unsigned long long *final; |
473 | unsigned int dm_offset; |
474 | + unsigned int authsize; |
475 | unsigned int jobid; |
476 | unsigned int ilen; |
477 | bool in_place = true; /* Default value */ |
478 | @@ -646,6 +647,21 @@ static int ccp_run_aes_gcm_cmd(struct ccp_cmd_queue *cmd_q, |
479 | if (!aes->key) /* Gotta have a key SGL */ |
480 | return -EINVAL; |
481 | |
482 | + /* Zero defaults to 16 bytes, the maximum size */ |
483 | + authsize = aes->authsize ? aes->authsize : AES_BLOCK_SIZE; |
484 | + switch (authsize) { |
485 | + case 16: |
486 | + case 15: |
487 | + case 14: |
488 | + case 13: |
489 | + case 12: |
490 | + case 8: |
491 | + case 4: |
492 | + break; |
493 | + default: |
494 | + return -EINVAL; |
495 | + } |
496 | + |
497 | /* First, decompose the source buffer into AAD & PT, |
498 | * and the destination buffer into AAD, CT & tag, or |
499 | * the input into CT & tag. |
500 | @@ -660,7 +676,7 @@ static int ccp_run_aes_gcm_cmd(struct ccp_cmd_queue *cmd_q, |
501 | p_tag = scatterwalk_ffwd(sg_tag, p_outp, ilen); |
502 | } else { |
503 | /* Input length for decryption includes tag */ |
504 | - ilen = aes->src_len - AES_BLOCK_SIZE; |
505 | + ilen = aes->src_len - authsize; |
506 | p_tag = scatterwalk_ffwd(sg_tag, p_inp, ilen); |
507 | } |
508 | |
509 | @@ -769,8 +785,7 @@ static int ccp_run_aes_gcm_cmd(struct ccp_cmd_queue *cmd_q, |
510 | while (src.sg_wa.bytes_left) { |
511 | ccp_prepare_data(&src, &dst, &op, AES_BLOCK_SIZE, true); |
512 | if (!src.sg_wa.bytes_left) { |
513 | - unsigned int nbytes = aes->src_len |
514 | - % AES_BLOCK_SIZE; |
515 | + unsigned int nbytes = ilen % AES_BLOCK_SIZE; |
516 | |
517 | if (nbytes) { |
518 | op.eom = 1; |
519 | @@ -842,19 +857,19 @@ static int ccp_run_aes_gcm_cmd(struct ccp_cmd_queue *cmd_q, |
520 | |
521 | if (aes->action == CCP_AES_ACTION_ENCRYPT) { |
522 | /* Put the ciphered tag after the ciphertext. */ |
523 | - ccp_get_dm_area(&final_wa, 0, p_tag, 0, AES_BLOCK_SIZE); |
524 | + ccp_get_dm_area(&final_wa, 0, p_tag, 0, authsize); |
525 | } else { |
526 | /* Does this ciphered tag match the input? */ |
527 | - ret = ccp_init_dm_workarea(&tag, cmd_q, AES_BLOCK_SIZE, |
528 | + ret = ccp_init_dm_workarea(&tag, cmd_q, authsize, |
529 | DMA_BIDIRECTIONAL); |
530 | if (ret) |
531 | goto e_tag; |
532 | - ret = ccp_set_dm_area(&tag, 0, p_tag, 0, AES_BLOCK_SIZE); |
533 | + ret = ccp_set_dm_area(&tag, 0, p_tag, 0, authsize); |
534 | if (ret) |
535 | goto e_tag; |
536 | |
537 | ret = crypto_memneq(tag.address, final_wa.address, |
538 | - AES_BLOCK_SIZE) ? -EBADMSG : 0; |
539 | + authsize) ? -EBADMSG : 0; |
540 | ccp_dm_free(&tag); |
541 | } |
542 | |
543 | @@ -862,11 +877,11 @@ e_tag: |
544 | ccp_dm_free(&final_wa); |
545 | |
546 | e_dst: |
547 | - if (aes->src_len && !in_place) |
548 | + if (ilen > 0 && !in_place) |
549 | ccp_free_data(&dst, cmd_q); |
550 | |
551 | e_src: |
552 | - if (aes->src_len) |
553 | + if (ilen > 0) |
554 | ccp_free_data(&src, cmd_q); |
555 | |
556 | e_aad: |
557 | diff --git a/drivers/firmware/Kconfig b/drivers/firmware/Kconfig |
558 | index 6e83880046d7..ed212c8b4108 100644 |
559 | --- a/drivers/firmware/Kconfig |
560 | +++ b/drivers/firmware/Kconfig |
561 | @@ -198,7 +198,7 @@ config DMI_SCAN_MACHINE_NON_EFI_FALLBACK |
562 | |
563 | config ISCSI_IBFT_FIND |
564 | bool "iSCSI Boot Firmware Table Attributes" |
565 | - depends on X86 && ACPI |
566 | + depends on X86 && ISCSI_IBFT |
567 | default n |
568 | help |
569 | This option enables the kernel to find the region of memory |
570 | @@ -209,7 +209,8 @@ config ISCSI_IBFT_FIND |
571 | config ISCSI_IBFT |
572 | tristate "iSCSI Boot Firmware Table Attributes module" |
573 | select ISCSI_BOOT_SYSFS |
574 | - depends on ISCSI_IBFT_FIND && SCSI && SCSI_LOWLEVEL |
575 | + select ISCSI_IBFT_FIND if X86 |
576 | + depends on ACPI && SCSI && SCSI_LOWLEVEL |
577 | default n |
578 | help |
579 | This option enables support for detection and exposing of iSCSI |
580 | diff --git a/drivers/firmware/iscsi_ibft.c b/drivers/firmware/iscsi_ibft.c |
581 | index c51462f5aa1e..966aef334c42 100644 |
582 | --- a/drivers/firmware/iscsi_ibft.c |
583 | +++ b/drivers/firmware/iscsi_ibft.c |
584 | @@ -93,6 +93,10 @@ MODULE_DESCRIPTION("sysfs interface to BIOS iBFT information"); |
585 | MODULE_LICENSE("GPL"); |
586 | MODULE_VERSION(IBFT_ISCSI_VERSION); |
587 | |
588 | +#ifndef CONFIG_ISCSI_IBFT_FIND |
589 | +struct acpi_table_ibft *ibft_addr; |
590 | +#endif |
591 | + |
592 | struct ibft_hdr { |
593 | u8 id; |
594 | u8 version; |
595 | diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c b/drivers/gpu/drm/amd/display/dc/core/dc.c |
596 | index e3f5e5d6f0c1..f4b89d1ea6f6 100644 |
597 | --- a/drivers/gpu/drm/amd/display/dc/core/dc.c |
598 | +++ b/drivers/gpu/drm/amd/display/dc/core/dc.c |
599 | @@ -462,8 +462,10 @@ void dc_link_set_test_pattern(struct dc_link *link, |
600 | |
601 | static void destruct(struct dc *dc) |
602 | { |
603 | - dc_release_state(dc->current_state); |
604 | - dc->current_state = NULL; |
605 | + if (dc->current_state) { |
606 | + dc_release_state(dc->current_state); |
607 | + dc->current_state = NULL; |
608 | + } |
609 | |
610 | destroy_links(dc); |
611 | |
612 | diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c b/drivers/gpu/drm/amd/display/dc/core/dc_resource.c |
613 | index e0a96abb3c46..f0d68aa7c8fc 100644 |
614 | --- a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c |
615 | +++ b/drivers/gpu/drm/amd/display/dc/core/dc_resource.c |
616 | @@ -222,7 +222,7 @@ bool resource_construct( |
617 | * PORT_CONNECTIVITY == 1 (as instructed by HW team). |
618 | */ |
619 | update_num_audio(&straps, &num_audio, &pool->audio_support); |
620 | - for (i = 0; i < pool->pipe_count && i < num_audio; i++) { |
621 | + for (i = 0; i < caps->num_audio; i++) { |
622 | struct audio *aud = create_funcs->create_audio(ctx, i); |
623 | |
624 | if (aud == NULL) { |
625 | @@ -1713,6 +1713,12 @@ static struct audio *find_first_free_audio( |
626 | return pool->audios[i]; |
627 | } |
628 | } |
629 | + |
630 | + /* use engine id to find free audio */ |
631 | + if ((id < pool->audio_count) && (res_ctx->is_audio_acquired[id] == false)) { |
632 | + return pool->audios[id]; |
633 | + } |
634 | + |
635 | /*not found the matching one, first come first serve*/ |
636 | for (i = 0; i < pool->audio_count; i++) { |
637 | if (res_ctx->is_audio_acquired[i] == false) { |
638 | @@ -1866,6 +1872,7 @@ static int get_norm_pix_clk(const struct dc_crtc_timing *timing) |
639 | pix_clk /= 2; |
640 | if (timing->pixel_encoding != PIXEL_ENCODING_YCBCR422) { |
641 | switch (timing->display_color_depth) { |
642 | + case COLOR_DEPTH_666: |
643 | case COLOR_DEPTH_888: |
644 | normalized_pix_clk = pix_clk; |
645 | break; |
646 | @@ -1949,7 +1956,7 @@ enum dc_status resource_map_pool_resources( |
647 | /* TODO: Add check if ASIC support and EDID audio */ |
648 | if (!stream->sink->converter_disable_audio && |
649 | dc_is_audio_capable_signal(pipe_ctx->stream->signal) && |
650 | - stream->audio_info.mode_count) { |
651 | + stream->audio_info.mode_count && stream->audio_info.flags.all) { |
652 | pipe_ctx->stream_res.audio = find_first_free_audio( |
653 | &context->res_ctx, pool, pipe_ctx->stream_res.stream_enc->id); |
654 | |
655 | diff --git a/drivers/gpu/drm/amd/display/dc/dce/dce_abm.c b/drivers/gpu/drm/amd/display/dc/dce/dce_abm.c |
656 | index 070ab56a8aca..da8b198538e5 100644 |
657 | --- a/drivers/gpu/drm/amd/display/dc/dce/dce_abm.c |
658 | +++ b/drivers/gpu/drm/amd/display/dc/dce/dce_abm.c |
659 | @@ -242,6 +242,10 @@ static void dmcu_set_backlight_level( |
660 | s2 |= (level << ATOM_S2_CURRENT_BL_LEVEL_SHIFT); |
661 | |
662 | REG_WRITE(BIOS_SCRATCH_2, s2); |
663 | + |
664 | + /* waitDMCUReadyForCmd */ |
665 | + REG_WAIT(MASTER_COMM_CNTL_REG, MASTER_COMM_INTERRUPT, |
666 | + 0, 1, 80000); |
667 | } |
668 | |
669 | static void dce_abm_init(struct abm *abm) |
670 | diff --git a/drivers/gpu/drm/amd/display/dc/inc/core_types.h b/drivers/gpu/drm/amd/display/dc/inc/core_types.h |
671 | index c0b9ca13393b..f4469fa5afb5 100644 |
672 | --- a/drivers/gpu/drm/amd/display/dc/inc/core_types.h |
673 | +++ b/drivers/gpu/drm/amd/display/dc/inc/core_types.h |
674 | @@ -159,7 +159,7 @@ struct resource_pool { |
675 | struct clock_source *clock_sources[MAX_CLOCK_SOURCES]; |
676 | unsigned int clk_src_count; |
677 | |
678 | - struct audio *audios[MAX_PIPES]; |
679 | + struct audio *audios[MAX_AUDIOS]; |
680 | unsigned int audio_count; |
681 | struct audio_support audio_support; |
682 | |
683 | diff --git a/drivers/gpu/drm/amd/display/dc/inc/hw/hw_shared.h b/drivers/gpu/drm/amd/display/dc/inc/hw/hw_shared.h |
684 | index cf7433ebf91a..71901743a938 100644 |
685 | --- a/drivers/gpu/drm/amd/display/dc/inc/hw/hw_shared.h |
686 | +++ b/drivers/gpu/drm/amd/display/dc/inc/hw/hw_shared.h |
687 | @@ -34,6 +34,7 @@ |
688 | * Data types shared between different Virtual HW blocks |
689 | ******************************************************************************/ |
690 | |
691 | +#define MAX_AUDIOS 7 |
692 | #define MAX_PIPES 6 |
693 | |
694 | struct gamma_curve { |
695 | diff --git a/drivers/gpu/drm/drm_framebuffer.c b/drivers/gpu/drm/drm_framebuffer.c |
696 | index 781af1d42d76..b64a6ffc0aed 100644 |
697 | --- a/drivers/gpu/drm/drm_framebuffer.c |
698 | +++ b/drivers/gpu/drm/drm_framebuffer.c |
699 | @@ -793,7 +793,7 @@ static int atomic_remove_fb(struct drm_framebuffer *fb) |
700 | struct drm_device *dev = fb->dev; |
701 | struct drm_atomic_state *state; |
702 | struct drm_plane *plane; |
703 | - struct drm_connector *conn; |
704 | + struct drm_connector *conn __maybe_unused; |
705 | struct drm_connector_state *conn_state; |
706 | int i, ret; |
707 | unsigned plane_mask; |
708 | diff --git a/drivers/gpu/drm/i915/vlv_dsi_pll.c b/drivers/gpu/drm/i915/vlv_dsi_pll.c |
709 | index a132a8037ecc..77df7903e071 100644 |
710 | --- a/drivers/gpu/drm/i915/vlv_dsi_pll.c |
711 | +++ b/drivers/gpu/drm/i915/vlv_dsi_pll.c |
712 | @@ -413,8 +413,8 @@ static void glk_dsi_program_esc_clock(struct drm_device *dev, |
713 | else |
714 | txesc2_div = 10; |
715 | |
716 | - I915_WRITE(MIPIO_TXESC_CLK_DIV1, txesc1_div & GLK_TX_ESC_CLK_DIV1_MASK); |
717 | - I915_WRITE(MIPIO_TXESC_CLK_DIV2, txesc2_div & GLK_TX_ESC_CLK_DIV2_MASK); |
718 | + I915_WRITE(MIPIO_TXESC_CLK_DIV1, (1 << (txesc1_div - 1)) & GLK_TX_ESC_CLK_DIV1_MASK); |
719 | + I915_WRITE(MIPIO_TXESC_CLK_DIV2, (1 << (txesc2_div - 1)) & GLK_TX_ESC_CLK_DIV2_MASK); |
720 | } |
721 | |
722 | /* Program BXT Mipi clocks and dividers */ |
723 | diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c |
724 | index 9671a4bad643..31f1023214d3 100644 |
725 | --- a/drivers/hid/hid-sony.c |
726 | +++ b/drivers/hid/hid-sony.c |
727 | @@ -587,10 +587,14 @@ static void sony_set_leds(struct sony_sc *sc); |
728 | static inline void sony_schedule_work(struct sony_sc *sc, |
729 | enum sony_worker which) |
730 | { |
731 | + unsigned long flags; |
732 | + |
733 | switch (which) { |
734 | case SONY_WORKER_STATE: |
735 | - if (!sc->defer_initialization) |
736 | + spin_lock_irqsave(&sc->lock, flags); |
737 | + if (!sc->defer_initialization && sc->state_worker_initialized) |
738 | schedule_work(&sc->state_worker); |
739 | + spin_unlock_irqrestore(&sc->lock, flags); |
740 | break; |
741 | case SONY_WORKER_HOTPLUG: |
742 | if (sc->hotplug_worker_initialized) |
743 | @@ -2553,13 +2557,18 @@ static inline void sony_init_output_report(struct sony_sc *sc, |
744 | |
745 | static inline void sony_cancel_work_sync(struct sony_sc *sc) |
746 | { |
747 | + unsigned long flags; |
748 | + |
749 | if (sc->hotplug_worker_initialized) |
750 | cancel_work_sync(&sc->hotplug_worker); |
751 | - if (sc->state_worker_initialized) |
752 | + if (sc->state_worker_initialized) { |
753 | + spin_lock_irqsave(&sc->lock, flags); |
754 | + sc->state_worker_initialized = 0; |
755 | + spin_unlock_irqrestore(&sc->lock, flags); |
756 | cancel_work_sync(&sc->state_worker); |
757 | + } |
758 | } |
759 | |
760 | - |
761 | static int sony_input_configured(struct hid_device *hdev, |
762 | struct hid_input *hidinput) |
763 | { |
764 | diff --git a/drivers/hwmon/nct6775.c b/drivers/hwmon/nct6775.c |
765 | index 78603b78cf41..eba692cddbde 100644 |
766 | --- a/drivers/hwmon/nct6775.c |
767 | +++ b/drivers/hwmon/nct6775.c |
768 | @@ -818,7 +818,7 @@ static const u16 NCT6106_REG_TARGET[] = { 0x111, 0x121, 0x131 }; |
769 | static const u16 NCT6106_REG_WEIGHT_TEMP_SEL[] = { 0x168, 0x178, 0x188 }; |
770 | static const u16 NCT6106_REG_WEIGHT_TEMP_STEP[] = { 0x169, 0x179, 0x189 }; |
771 | static const u16 NCT6106_REG_WEIGHT_TEMP_STEP_TOL[] = { 0x16a, 0x17a, 0x18a }; |
772 | -static const u16 NCT6106_REG_WEIGHT_DUTY_STEP[] = { 0x16b, 0x17b, 0x17c }; |
773 | +static const u16 NCT6106_REG_WEIGHT_DUTY_STEP[] = { 0x16b, 0x17b, 0x18b }; |
774 | static const u16 NCT6106_REG_WEIGHT_TEMP_BASE[] = { 0x16c, 0x17c, 0x18c }; |
775 | static const u16 NCT6106_REG_WEIGHT_DUTY_BASE[] = { 0x16d, 0x17d, 0x18d }; |
776 | |
777 | @@ -3673,6 +3673,7 @@ static int nct6775_probe(struct platform_device *pdev) |
778 | data->REG_FAN_TIME[0] = NCT6106_REG_FAN_STOP_TIME; |
779 | data->REG_FAN_TIME[1] = NCT6106_REG_FAN_STEP_UP_TIME; |
780 | data->REG_FAN_TIME[2] = NCT6106_REG_FAN_STEP_DOWN_TIME; |
781 | + data->REG_TOLERANCE_H = NCT6106_REG_TOLERANCE_H; |
782 | data->REG_PWM[0] = NCT6106_REG_PWM; |
783 | data->REG_PWM[1] = NCT6106_REG_FAN_START_OUTPUT; |
784 | data->REG_PWM[2] = NCT6106_REG_FAN_STOP_OUTPUT; |
785 | diff --git a/drivers/hwmon/nct7802.c b/drivers/hwmon/nct7802.c |
786 | index 2876c18ed841..38ffbdb0a85f 100644 |
787 | --- a/drivers/hwmon/nct7802.c |
788 | +++ b/drivers/hwmon/nct7802.c |
789 | @@ -768,7 +768,7 @@ static struct attribute *nct7802_in_attrs[] = { |
790 | &sensor_dev_attr_in3_alarm.dev_attr.attr, |
791 | &sensor_dev_attr_in3_beep.dev_attr.attr, |
792 | |
793 | - &sensor_dev_attr_in4_input.dev_attr.attr, /* 17 */ |
794 | + &sensor_dev_attr_in4_input.dev_attr.attr, /* 16 */ |
795 | &sensor_dev_attr_in4_min.dev_attr.attr, |
796 | &sensor_dev_attr_in4_max.dev_attr.attr, |
797 | &sensor_dev_attr_in4_alarm.dev_attr.attr, |
798 | @@ -794,9 +794,9 @@ static umode_t nct7802_in_is_visible(struct kobject *kobj, |
799 | |
800 | if (index >= 6 && index < 11 && (reg & 0x03) != 0x03) /* VSEN1 */ |
801 | return 0; |
802 | - if (index >= 11 && index < 17 && (reg & 0x0c) != 0x0c) /* VSEN2 */ |
803 | + if (index >= 11 && index < 16 && (reg & 0x0c) != 0x0c) /* VSEN2 */ |
804 | return 0; |
805 | - if (index >= 17 && (reg & 0x30) != 0x30) /* VSEN3 */ |
806 | + if (index >= 16 && (reg & 0x30) != 0x30) /* VSEN3 */ |
807 | return 0; |
808 | |
809 | return attr->mode; |
810 | diff --git a/drivers/iio/accel/cros_ec_accel_legacy.c b/drivers/iio/accel/cros_ec_accel_legacy.c |
811 | index 063e89eff791..c776a3509a71 100644 |
812 | --- a/drivers/iio/accel/cros_ec_accel_legacy.c |
813 | +++ b/drivers/iio/accel/cros_ec_accel_legacy.c |
814 | @@ -328,7 +328,6 @@ static const struct iio_chan_spec_ext_info cros_ec_accel_legacy_ext_info[] = { |
815 | .modified = 1, \ |
816 | .info_mask_separate = \ |
817 | BIT(IIO_CHAN_INFO_RAW) | \ |
818 | - BIT(IIO_CHAN_INFO_SCALE) | \ |
819 | BIT(IIO_CHAN_INFO_CALIBBIAS), \ |
820 | .info_mask_shared_by_all = BIT(IIO_CHAN_INFO_SCALE), \ |
821 | .ext_info = cros_ec_accel_legacy_ext_info, \ |
822 | diff --git a/drivers/iio/adc/max9611.c b/drivers/iio/adc/max9611.c |
823 | index 0538ff8c4ac1..ce9af43fa2de 100644 |
824 | --- a/drivers/iio/adc/max9611.c |
825 | +++ b/drivers/iio/adc/max9611.c |
826 | @@ -86,7 +86,7 @@ |
827 | #define MAX9611_TEMP_MAX_POS 0x7f80 |
828 | #define MAX9611_TEMP_MAX_NEG 0xff80 |
829 | #define MAX9611_TEMP_MIN_NEG 0xd980 |
830 | -#define MAX9611_TEMP_MASK GENMASK(7, 15) |
831 | +#define MAX9611_TEMP_MASK GENMASK(15, 7) |
832 | #define MAX9611_TEMP_SHIFT 0x07 |
833 | #define MAX9611_TEMP_RAW(_r) ((_r) >> MAX9611_TEMP_SHIFT) |
834 | #define MAX9611_TEMP_SCALE_NUM 1000000 |
835 | diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c |
836 | index 530142b5a115..eb9b9de47fd1 100644 |
837 | --- a/drivers/input/mouse/elantech.c |
838 | +++ b/drivers/input/mouse/elantech.c |
839 | @@ -1810,6 +1810,30 @@ static int elantech_create_smbus(struct psmouse *psmouse, |
840 | leave_breadcrumbs); |
841 | } |
842 | |
843 | +static bool elantech_use_host_notify(struct psmouse *psmouse, |
844 | + struct elantech_device_info *info) |
845 | +{ |
846 | + if (ETP_NEW_IC_SMBUS_HOST_NOTIFY(info->fw_version)) |
847 | + return true; |
848 | + |
849 | + switch (info->bus) { |
850 | + case ETP_BUS_PS2_ONLY: |
851 | + /* expected case */ |
852 | + break; |
853 | + case ETP_BUS_SMB_HST_NTFY_ONLY: |
854 | + case ETP_BUS_PS2_SMB_HST_NTFY: |
855 | + /* SMbus implementation is stable since 2018 */ |
856 | + if (dmi_get_bios_year() >= 2018) |
857 | + return true; |
858 | + default: |
859 | + psmouse_dbg(psmouse, |
860 | + "Ignoring SMBus bus provider %d\n", info->bus); |
861 | + break; |
862 | + } |
863 | + |
864 | + return false; |
865 | +} |
866 | + |
867 | /** |
868 | * elantech_setup_smbus - called once the PS/2 devices are enumerated |
869 | * and decides to instantiate a SMBus InterTouch device. |
870 | @@ -1829,7 +1853,7 @@ static int elantech_setup_smbus(struct psmouse *psmouse, |
871 | * i2c_blacklist_pnp_ids. |
872 | * Old ICs are up to the user to decide. |
873 | */ |
874 | - if (!ETP_NEW_IC_SMBUS_HOST_NOTIFY(info->fw_version) || |
875 | + if (!elantech_use_host_notify(psmouse, info) || |
876 | psmouse_matches_pnp_id(psmouse, i2c_blacklist_pnp_ids)) |
877 | return -ENXIO; |
878 | } |
879 | @@ -1849,34 +1873,6 @@ static int elantech_setup_smbus(struct psmouse *psmouse, |
880 | return 0; |
881 | } |
882 | |
883 | -static bool elantech_use_host_notify(struct psmouse *psmouse, |
884 | - struct elantech_device_info *info) |
885 | -{ |
886 | - if (ETP_NEW_IC_SMBUS_HOST_NOTIFY(info->fw_version)) |
887 | - return true; |
888 | - |
889 | - switch (info->bus) { |
890 | - case ETP_BUS_PS2_ONLY: |
891 | - /* expected case */ |
892 | - break; |
893 | - case ETP_BUS_SMB_ALERT_ONLY: |
894 | - /* fall-through */ |
895 | - case ETP_BUS_PS2_SMB_ALERT: |
896 | - psmouse_dbg(psmouse, "Ignoring SMBus provider through alert protocol.\n"); |
897 | - break; |
898 | - case ETP_BUS_SMB_HST_NTFY_ONLY: |
899 | - /* fall-through */ |
900 | - case ETP_BUS_PS2_SMB_HST_NTFY: |
901 | - return true; |
902 | - default: |
903 | - psmouse_dbg(psmouse, |
904 | - "Ignoring SMBus bus provider %d.\n", |
905 | - info->bus); |
906 | - } |
907 | - |
908 | - return false; |
909 | -} |
910 | - |
911 | int elantech_init_smbus(struct psmouse *psmouse) |
912 | { |
913 | struct elantech_device_info info; |
914 | diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c |
915 | index af7d48431b85..06cebde2422e 100644 |
916 | --- a/drivers/input/mouse/synaptics.c |
917 | +++ b/drivers/input/mouse/synaptics.c |
918 | @@ -185,6 +185,7 @@ static const char * const smbus_pnp_ids[] = { |
919 | "LEN2055", /* E580 */ |
920 | "SYN3052", /* HP EliteBook 840 G4 */ |
921 | "SYN3221", /* HP 15-ay000 */ |
922 | + "SYN323d", /* HP Spectre X360 13-w013dx */ |
923 | NULL |
924 | }; |
925 | |
926 | diff --git a/drivers/input/touchscreen/usbtouchscreen.c b/drivers/input/touchscreen/usbtouchscreen.c |
927 | index d61570d64ee7..48304e26f988 100644 |
928 | --- a/drivers/input/touchscreen/usbtouchscreen.c |
929 | +++ b/drivers/input/touchscreen/usbtouchscreen.c |
930 | @@ -1672,6 +1672,8 @@ static int usbtouch_probe(struct usb_interface *intf, |
931 | if (!usbtouch || !input_dev) |
932 | goto out_free; |
933 | |
934 | + mutex_init(&usbtouch->pm_mutex); |
935 | + |
936 | type = &usbtouch_dev_info[id->driver_info]; |
937 | usbtouch->type = type; |
938 | if (!type->process_pkt) |
939 | diff --git a/drivers/mmc/host/cavium.c b/drivers/mmc/host/cavium.c |
940 | index ed5cefb83768..89deb451e0ac 100644 |
941 | --- a/drivers/mmc/host/cavium.c |
942 | +++ b/drivers/mmc/host/cavium.c |
943 | @@ -374,6 +374,7 @@ static int finish_dma_single(struct cvm_mmc_host *host, struct mmc_data *data) |
944 | { |
945 | data->bytes_xfered = data->blocks * data->blksz; |
946 | data->error = 0; |
947 | + dma_unmap_sg(host->dev, data->sg, data->sg_len, get_dma_dir(data)); |
948 | return 1; |
949 | } |
950 | |
951 | @@ -1046,7 +1047,8 @@ int cvm_mmc_of_slot_probe(struct device *dev, struct cvm_mmc_host *host) |
952 | mmc->max_segs = 1; |
953 | |
954 | /* DMA size field can address up to 8 MB */ |
955 | - mmc->max_seg_size = 8 * 1024 * 1024; |
956 | + mmc->max_seg_size = min_t(unsigned int, 8 * 1024 * 1024, |
957 | + dma_get_max_seg_size(host->dev)); |
958 | mmc->max_req_size = mmc->max_seg_size; |
959 | /* External DMA is in 512 byte blocks */ |
960 | mmc->max_blk_size = 512; |
961 | diff --git a/drivers/net/can/rcar/rcar_canfd.c b/drivers/net/can/rcar/rcar_canfd.c |
962 | index 602c19e23f05..786d852a70d5 100644 |
963 | --- a/drivers/net/can/rcar/rcar_canfd.c |
964 | +++ b/drivers/net/can/rcar/rcar_canfd.c |
965 | @@ -1512,10 +1512,11 @@ static int rcar_canfd_rx_poll(struct napi_struct *napi, int quota) |
966 | |
967 | /* All packets processed */ |
968 | if (num_pkts < quota) { |
969 | - napi_complete_done(napi, num_pkts); |
970 | - /* Enable Rx FIFO interrupts */ |
971 | - rcar_canfd_set_bit(priv->base, RCANFD_RFCC(ridx), |
972 | - RCANFD_RFCC_RFIE); |
973 | + if (napi_complete_done(napi, num_pkts)) { |
974 | + /* Enable Rx FIFO interrupts */ |
975 | + rcar_canfd_set_bit(priv->base, RCANFD_RFCC(ridx), |
976 | + RCANFD_RFCC_RFIE); |
977 | + } |
978 | } |
979 | return num_pkts; |
980 | } |
981 | diff --git a/drivers/net/can/usb/peak_usb/pcan_usb_core.c b/drivers/net/can/usb/peak_usb/pcan_usb_core.c |
982 | index 611f9d31be5d..740ef47eab01 100644 |
983 | --- a/drivers/net/can/usb/peak_usb/pcan_usb_core.c |
984 | +++ b/drivers/net/can/usb/peak_usb/pcan_usb_core.c |
985 | @@ -576,16 +576,16 @@ static int peak_usb_ndo_stop(struct net_device *netdev) |
986 | dev->state &= ~PCAN_USB_STATE_STARTED; |
987 | netif_stop_queue(netdev); |
988 | |
989 | + close_candev(netdev); |
990 | + |
991 | + dev->can.state = CAN_STATE_STOPPED; |
992 | + |
993 | /* unlink all pending urbs and free used memory */ |
994 | peak_usb_unlink_all_urbs(dev); |
995 | |
996 | if (dev->adapter->dev_stop) |
997 | dev->adapter->dev_stop(dev); |
998 | |
999 | - close_candev(netdev); |
1000 | - |
1001 | - dev->can.state = CAN_STATE_STOPPED; |
1002 | - |
1003 | /* can set bus off now */ |
1004 | if (dev->adapter->dev_set_bus) { |
1005 | int err = dev->adapter->dev_set_bus(dev, 0); |
1006 | diff --git a/drivers/net/can/usb/peak_usb/pcan_usb_fd.c b/drivers/net/can/usb/peak_usb/pcan_usb_fd.c |
1007 | index dd161c5eea8e..41988358f63c 100644 |
1008 | --- a/drivers/net/can/usb/peak_usb/pcan_usb_fd.c |
1009 | +++ b/drivers/net/can/usb/peak_usb/pcan_usb_fd.c |
1010 | @@ -849,7 +849,7 @@ static int pcan_usb_fd_init(struct peak_usb_device *dev) |
1011 | goto err_out; |
1012 | |
1013 | /* allocate command buffer once for all for the interface */ |
1014 | - pdev->cmd_buffer_addr = kmalloc(PCAN_UFD_CMD_BUFFER_SIZE, |
1015 | + pdev->cmd_buffer_addr = kzalloc(PCAN_UFD_CMD_BUFFER_SIZE, |
1016 | GFP_KERNEL); |
1017 | if (!pdev->cmd_buffer_addr) |
1018 | goto err_out_1; |
1019 | diff --git a/drivers/net/can/usb/peak_usb/pcan_usb_pro.c b/drivers/net/can/usb/peak_usb/pcan_usb_pro.c |
1020 | index d516def846ab..b304198f0b3a 100644 |
1021 | --- a/drivers/net/can/usb/peak_usb/pcan_usb_pro.c |
1022 | +++ b/drivers/net/can/usb/peak_usb/pcan_usb_pro.c |
1023 | @@ -502,7 +502,7 @@ static int pcan_usb_pro_drv_loaded(struct peak_usb_device *dev, int loaded) |
1024 | u8 *buffer; |
1025 | int err; |
1026 | |
1027 | - buffer = kmalloc(PCAN_USBPRO_FCT_DRVLD_REQ_LEN, GFP_KERNEL); |
1028 | + buffer = kzalloc(PCAN_USBPRO_FCT_DRVLD_REQ_LEN, GFP_KERNEL); |
1029 | if (!buffer) |
1030 | return -ENOMEM; |
1031 | |
1032 | diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_flower.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_flower.c |
1033 | index f2aba5b160c2..d45c435a599d 100644 |
1034 | --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_flower.c |
1035 | +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_flower.c |
1036 | @@ -67,7 +67,8 @@ static struct ch_tc_pedit_fields pedits[] = { |
1037 | static struct ch_tc_flower_entry *allocate_flower_entry(void) |
1038 | { |
1039 | struct ch_tc_flower_entry *new = kzalloc(sizeof(*new), GFP_KERNEL); |
1040 | - spin_lock_init(&new->lock); |
1041 | + if (new) |
1042 | + spin_lock_init(&new->lock); |
1043 | return new; |
1044 | } |
1045 | |
1046 | diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c |
1047 | index 8b7d70e3a379..3fe7605a2cca 100644 |
1048 | --- a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c |
1049 | +++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c |
1050 | @@ -724,7 +724,7 @@ static int iwl_mvm_sar_get_ewrd_table(struct iwl_mvm *mvm) |
1051 | |
1052 | for (i = 0; i < n_profiles; i++) { |
1053 | /* the tables start at element 3 */ |
1054 | - static int pos = 3; |
1055 | + int pos = 3; |
1056 | |
1057 | /* The EWRD profiles officially go from 2 to 4, but we |
1058 | * save them in sar_profiles[1-3] (because we don't |
1059 | @@ -836,6 +836,22 @@ int iwl_mvm_sar_select_profile(struct iwl_mvm *mvm, int prof_a, int prof_b) |
1060 | return iwl_mvm_send_cmd_pdu(mvm, REDUCE_TX_POWER_CMD, 0, len, &cmd); |
1061 | } |
1062 | |
1063 | +static bool iwl_mvm_sar_geo_support(struct iwl_mvm *mvm) |
1064 | +{ |
1065 | + /* |
1066 | + * The GEO_TX_POWER_LIMIT command is not supported on earlier |
1067 | + * firmware versions. Unfortunately, we don't have a TLV API |
1068 | + * flag to rely on, so rely on the major version which is in |
1069 | + * the first byte of ucode_ver. This was implemented |
1070 | + * initially on version 38 and then backported to 36, 29 and |
1071 | + * 17. |
1072 | + */ |
1073 | + return IWL_UCODE_SERIAL(mvm->fw->ucode_ver) >= 38 || |
1074 | + IWL_UCODE_SERIAL(mvm->fw->ucode_ver) == 36 || |
1075 | + IWL_UCODE_SERIAL(mvm->fw->ucode_ver) == 29 || |
1076 | + IWL_UCODE_SERIAL(mvm->fw->ucode_ver) == 17; |
1077 | +} |
1078 | + |
1079 | int iwl_mvm_get_sar_geo_profile(struct iwl_mvm *mvm) |
1080 | { |
1081 | struct iwl_geo_tx_power_profiles_resp *resp; |
1082 | @@ -851,6 +867,9 @@ int iwl_mvm_get_sar_geo_profile(struct iwl_mvm *mvm) |
1083 | .data = { &geo_cmd }, |
1084 | }; |
1085 | |
1086 | + if (!iwl_mvm_sar_geo_support(mvm)) |
1087 | + return -EOPNOTSUPP; |
1088 | + |
1089 | ret = iwl_mvm_send_cmd(mvm, &cmd); |
1090 | if (ret) { |
1091 | IWL_ERR(mvm, "Failed to get geographic profile info %d\n", ret); |
1092 | @@ -876,13 +895,7 @@ static int iwl_mvm_sar_geo_init(struct iwl_mvm *mvm) |
1093 | int ret, i, j; |
1094 | u16 cmd_wide_id = WIDE_ID(PHY_OPS_GROUP, GEO_TX_POWER_LIMIT); |
1095 | |
1096 | - /* |
1097 | - * This command is not supported on earlier firmware versions. |
1098 | - * Unfortunately, we don't have a TLV API flag to rely on, so |
1099 | - * rely on the major version which is in the first byte of |
1100 | - * ucode_ver. |
1101 | - */ |
1102 | - if (IWL_UCODE_SERIAL(mvm->fw->ucode_ver) < 41) |
1103 | + if (!iwl_mvm_sar_geo_support(mvm)) |
1104 | return 0; |
1105 | |
1106 | ret = iwl_mvm_sar_get_wgds_table(mvm); |
1107 | diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/tx.c b/drivers/net/wireless/intel/iwlwifi/pcie/tx.c |
1108 | index 93f0d387688a..42fdb7970cfd 100644 |
1109 | --- a/drivers/net/wireless/intel/iwlwifi/pcie/tx.c |
1110 | +++ b/drivers/net/wireless/intel/iwlwifi/pcie/tx.c |
1111 | @@ -403,6 +403,8 @@ static void iwl_pcie_tfd_unmap(struct iwl_trans *trans, |
1112 | DMA_TO_DEVICE); |
1113 | } |
1114 | |
1115 | + meta->tbs = 0; |
1116 | + |
1117 | if (trans->cfg->use_tfh) { |
1118 | struct iwl_tfh_tfd *tfd_fh = (void *)tfd; |
1119 | |
1120 | diff --git a/drivers/net/wireless/marvell/mwifiex/main.h b/drivers/net/wireless/marvell/mwifiex/main.h |
1121 | index b025ba164412..e39bb5c42c9a 100644 |
1122 | --- a/drivers/net/wireless/marvell/mwifiex/main.h |
1123 | +++ b/drivers/net/wireless/marvell/mwifiex/main.h |
1124 | @@ -124,6 +124,7 @@ enum { |
1125 | |
1126 | #define MWIFIEX_MAX_TOTAL_SCAN_TIME (MWIFIEX_TIMER_10S - MWIFIEX_TIMER_1S) |
1127 | |
1128 | +#define WPA_GTK_OUI_OFFSET 2 |
1129 | #define RSN_GTK_OUI_OFFSET 2 |
1130 | |
1131 | #define MWIFIEX_OUI_NOT_PRESENT 0 |
1132 | diff --git a/drivers/net/wireless/marvell/mwifiex/scan.c b/drivers/net/wireless/marvell/mwifiex/scan.c |
1133 | index 6dd771ce68a3..ed27147efcb3 100644 |
1134 | --- a/drivers/net/wireless/marvell/mwifiex/scan.c |
1135 | +++ b/drivers/net/wireless/marvell/mwifiex/scan.c |
1136 | @@ -181,7 +181,8 @@ mwifiex_is_wpa_oui_present(struct mwifiex_bssdescriptor *bss_desc, u32 cipher) |
1137 | u8 ret = MWIFIEX_OUI_NOT_PRESENT; |
1138 | |
1139 | if (has_vendor_hdr(bss_desc->bcn_wpa_ie, WLAN_EID_VENDOR_SPECIFIC)) { |
1140 | - iebody = (struct ie_body *) bss_desc->bcn_wpa_ie->data; |
1141 | + iebody = (struct ie_body *)((u8 *)bss_desc->bcn_wpa_ie->data + |
1142 | + WPA_GTK_OUI_OFFSET); |
1143 | oui = &mwifiex_wpa_oui[cipher][0]; |
1144 | ret = mwifiex_search_oui_in_ie(iebody, oui); |
1145 | if (ret) |
1146 | diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c |
1147 | index 260248fbb8fe..a11e210d173e 100644 |
1148 | --- a/drivers/nvme/host/multipath.c |
1149 | +++ b/drivers/nvme/host/multipath.c |
1150 | @@ -20,11 +20,6 @@ module_param(multipath, bool, 0444); |
1151 | MODULE_PARM_DESC(multipath, |
1152 | "turn on native support for multiple controllers per subsystem"); |
1153 | |
1154 | -inline bool nvme_ctrl_use_ana(struct nvme_ctrl *ctrl) |
1155 | -{ |
1156 | - return multipath && ctrl->subsys && (ctrl->subsys->cmic & (1 << 3)); |
1157 | -} |
1158 | - |
1159 | /* |
1160 | * If multipathing is enabled we need to always use the subsystem instance |
1161 | * number for numbering our devices to avoid conflicts between subsystems that |
1162 | @@ -516,7 +511,8 @@ int nvme_mpath_init(struct nvme_ctrl *ctrl, struct nvme_id_ctrl *id) |
1163 | { |
1164 | int error; |
1165 | |
1166 | - if (!nvme_ctrl_use_ana(ctrl)) |
1167 | + /* check if multipath is enabled and we have the capability */ |
1168 | + if (!multipath || !ctrl->subsys || !(ctrl->subsys->cmic & (1 << 3))) |
1169 | return 0; |
1170 | |
1171 | ctrl->anacap = id->anacap; |
1172 | diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h |
1173 | index e82cdaec81c9..d5e29b57eb34 100644 |
1174 | --- a/drivers/nvme/host/nvme.h |
1175 | +++ b/drivers/nvme/host/nvme.h |
1176 | @@ -464,7 +464,11 @@ extern const struct attribute_group nvme_ns_id_attr_group; |
1177 | extern const struct block_device_operations nvme_ns_head_ops; |
1178 | |
1179 | #ifdef CONFIG_NVME_MULTIPATH |
1180 | -bool nvme_ctrl_use_ana(struct nvme_ctrl *ctrl); |
1181 | +static inline bool nvme_ctrl_use_ana(struct nvme_ctrl *ctrl) |
1182 | +{ |
1183 | + return ctrl->ana_log_buf != NULL; |
1184 | +} |
1185 | + |
1186 | void nvme_set_disk_name(char *disk_name, struct nvme_ns *ns, |
1187 | struct nvme_ctrl *ctrl, int *flags); |
1188 | void nvme_failover_req(struct request *req); |
1189 | diff --git a/drivers/s390/cio/qdio_main.c b/drivers/s390/cio/qdio_main.c |
1190 | index 4ac4a73037f5..4b7cc8d425b1 100644 |
1191 | --- a/drivers/s390/cio/qdio_main.c |
1192 | +++ b/drivers/s390/cio/qdio_main.c |
1193 | @@ -1569,13 +1569,13 @@ static int handle_outbound(struct qdio_q *q, unsigned int callflags, |
1194 | rc = qdio_kick_outbound_q(q, phys_aob); |
1195 | } else if (need_siga_sync(q)) { |
1196 | rc = qdio_siga_sync_q(q); |
1197 | + } else if (count < QDIO_MAX_BUFFERS_PER_Q && |
1198 | + get_buf_state(q, prev_buf(bufnr), &state, 0) > 0 && |
1199 | + state == SLSB_CU_OUTPUT_PRIMED) { |
1200 | + /* The previous buffer is not processed yet, tack on. */ |
1201 | + qperf_inc(q, fast_requeue); |
1202 | } else { |
1203 | - /* try to fast requeue buffers */ |
1204 | - get_buf_state(q, prev_buf(bufnr), &state, 0); |
1205 | - if (state != SLSB_CU_OUTPUT_PRIMED) |
1206 | - rc = qdio_kick_outbound_q(q, 0); |
1207 | - else |
1208 | - qperf_inc(q, fast_requeue); |
1209 | + rc = qdio_kick_outbound_q(q, 0); |
1210 | } |
1211 | |
1212 | /* in case of SIGA errors we must process the error immediately */ |
1213 | diff --git a/drivers/s390/cio/vfio_ccw_cp.c b/drivers/s390/cio/vfio_ccw_cp.c |
1214 | index 70a006ba4d05..4fe06ff7b2c8 100644 |
1215 | --- a/drivers/s390/cio/vfio_ccw_cp.c |
1216 | +++ b/drivers/s390/cio/vfio_ccw_cp.c |
1217 | @@ -89,8 +89,10 @@ static int pfn_array_alloc_pin(struct pfn_array *pa, struct device *mdev, |
1218 | sizeof(*pa->pa_iova_pfn) + |
1219 | sizeof(*pa->pa_pfn), |
1220 | GFP_KERNEL); |
1221 | - if (unlikely(!pa->pa_iova_pfn)) |
1222 | + if (unlikely(!pa->pa_iova_pfn)) { |
1223 | + pa->pa_nr = 0; |
1224 | return -ENOMEM; |
1225 | + } |
1226 | pa->pa_pfn = pa->pa_iova_pfn + pa->pa_nr; |
1227 | |
1228 | pa->pa_iova_pfn[0] = pa->pa_iova >> PAGE_SHIFT; |
1229 | diff --git a/drivers/scsi/device_handler/scsi_dh_alua.c b/drivers/scsi/device_handler/scsi_dh_alua.c |
1230 | index d1154baa9436..9c21938ed67e 100644 |
1231 | --- a/drivers/scsi/device_handler/scsi_dh_alua.c |
1232 | +++ b/drivers/scsi/device_handler/scsi_dh_alua.c |
1233 | @@ -54,6 +54,7 @@ |
1234 | #define ALUA_FAILOVER_TIMEOUT 60 |
1235 | #define ALUA_FAILOVER_RETRIES 5 |
1236 | #define ALUA_RTPG_DELAY_MSECS 5 |
1237 | +#define ALUA_RTPG_RETRY_DELAY 2 |
1238 | |
1239 | /* device handler flags */ |
1240 | #define ALUA_OPTIMIZE_STPG 0x01 |
1241 | @@ -696,7 +697,7 @@ static int alua_rtpg(struct scsi_device *sdev, struct alua_port_group *pg) |
1242 | case SCSI_ACCESS_STATE_TRANSITIONING: |
1243 | if (time_before(jiffies, pg->expiry)) { |
1244 | /* State transition, retry */ |
1245 | - pg->interval = 2; |
1246 | + pg->interval = ALUA_RTPG_RETRY_DELAY; |
1247 | err = SCSI_DH_RETRY; |
1248 | } else { |
1249 | struct alua_dh_data *h; |
1250 | @@ -821,6 +822,8 @@ static void alua_rtpg_work(struct work_struct *work) |
1251 | spin_lock_irqsave(&pg->lock, flags); |
1252 | pg->flags &= ~ALUA_PG_RUNNING; |
1253 | pg->flags |= ALUA_PG_RUN_RTPG; |
1254 | + if (!pg->interval) |
1255 | + pg->interval = ALUA_RTPG_RETRY_DELAY; |
1256 | spin_unlock_irqrestore(&pg->lock, flags); |
1257 | queue_delayed_work(kaluad_wq, &pg->rtpg_work, |
1258 | pg->interval * HZ); |
1259 | @@ -832,6 +835,8 @@ static void alua_rtpg_work(struct work_struct *work) |
1260 | spin_lock_irqsave(&pg->lock, flags); |
1261 | if (err == SCSI_DH_RETRY || pg->flags & ALUA_PG_RUN_RTPG) { |
1262 | pg->flags &= ~ALUA_PG_RUNNING; |
1263 | + if (!pg->interval && !(pg->flags & ALUA_PG_RUN_RTPG)) |
1264 | + pg->interval = ALUA_RTPG_RETRY_DELAY; |
1265 | pg->flags |= ALUA_PG_RUN_RTPG; |
1266 | spin_unlock_irqrestore(&pg->lock, flags); |
1267 | queue_delayed_work(kaluad_wq, &pg->rtpg_work, |
1268 | diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c |
1269 | index b64ca977825d..71d53bb239e2 100644 |
1270 | --- a/drivers/scsi/ibmvscsi/ibmvfc.c |
1271 | +++ b/drivers/scsi/ibmvscsi/ibmvfc.c |
1272 | @@ -4874,8 +4874,8 @@ static int ibmvfc_remove(struct vio_dev *vdev) |
1273 | |
1274 | spin_lock_irqsave(vhost->host->host_lock, flags); |
1275 | ibmvfc_purge_requests(vhost, DID_ERROR); |
1276 | - ibmvfc_free_event_pool(vhost); |
1277 | spin_unlock_irqrestore(vhost->host->host_lock, flags); |
1278 | + ibmvfc_free_event_pool(vhost); |
1279 | |
1280 | ibmvfc_free_mem(vhost); |
1281 | spin_lock(&ibmvfc_driver_lock); |
1282 | diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c |
1283 | index e0c87228438d..806ceabcabc3 100644 |
1284 | --- a/drivers/scsi/megaraid/megaraid_sas_base.c |
1285 | +++ b/drivers/scsi/megaraid/megaraid_sas_base.c |
1286 | @@ -3025,6 +3025,7 @@ megasas_fw_crash_buffer_show(struct device *cdev, |
1287 | u32 size; |
1288 | unsigned long buff_addr; |
1289 | unsigned long dmachunk = CRASH_DMA_BUF_SIZE; |
1290 | + unsigned long chunk_left_bytes; |
1291 | unsigned long src_addr; |
1292 | unsigned long flags; |
1293 | u32 buff_offset; |
1294 | @@ -3050,6 +3051,8 @@ megasas_fw_crash_buffer_show(struct device *cdev, |
1295 | } |
1296 | |
1297 | size = (instance->fw_crash_buffer_size * dmachunk) - buff_offset; |
1298 | + chunk_left_bytes = dmachunk - (buff_offset % dmachunk); |
1299 | + size = (size > chunk_left_bytes) ? chunk_left_bytes : size; |
1300 | size = (size >= PAGE_SIZE) ? (PAGE_SIZE - 1) : size; |
1301 | |
1302 | src_addr = (unsigned long)instance->crash_buf[buff_offset / dmachunk] + |
1303 | diff --git a/drivers/staging/android/ion/ion_page_pool.c b/drivers/staging/android/ion/ion_page_pool.c |
1304 | index 9bc56eb48d2a..890d264ac687 100644 |
1305 | --- a/drivers/staging/android/ion/ion_page_pool.c |
1306 | +++ b/drivers/staging/android/ion/ion_page_pool.c |
1307 | @@ -8,11 +8,14 @@ |
1308 | #include <linux/list.h> |
1309 | #include <linux/slab.h> |
1310 | #include <linux/swap.h> |
1311 | +#include <linux/sched/signal.h> |
1312 | |
1313 | #include "ion.h" |
1314 | |
1315 | static inline struct page *ion_page_pool_alloc_pages(struct ion_page_pool *pool) |
1316 | { |
1317 | + if (fatal_signal_pending(current)) |
1318 | + return NULL; |
1319 | return alloc_pages(pool->gfp_mask, pool->order); |
1320 | } |
1321 | |
1322 | diff --git a/drivers/staging/gasket/apex_driver.c b/drivers/staging/gasket/apex_driver.c |
1323 | index c747e9ca4518..0cef1d6d2e2b 100644 |
1324 | --- a/drivers/staging/gasket/apex_driver.c |
1325 | +++ b/drivers/staging/gasket/apex_driver.c |
1326 | @@ -538,7 +538,7 @@ static ssize_t sysfs_show(struct device *device, struct device_attribute *attr, |
1327 | break; |
1328 | case ATTR_KERNEL_HIB_SIMPLE_PAGE_TABLE_SIZE: |
1329 | ret = scnprintf(buf, PAGE_SIZE, "%u\n", |
1330 | - gasket_page_table_num_entries( |
1331 | + gasket_page_table_num_simple_entries( |
1332 | gasket_dev->page_table[0])); |
1333 | break; |
1334 | case ATTR_KERNEL_HIB_NUM_ACTIVE_PAGES: |
1335 | diff --git a/drivers/tty/tty_ldsem.c b/drivers/tty/tty_ldsem.c |
1336 | index b989ca26fc78..2f0372976459 100644 |
1337 | --- a/drivers/tty/tty_ldsem.c |
1338 | +++ b/drivers/tty/tty_ldsem.c |
1339 | @@ -116,8 +116,7 @@ static void __ldsem_wake_readers(struct ld_semaphore *sem) |
1340 | |
1341 | list_for_each_entry_safe(waiter, next, &sem->read_wait, list) { |
1342 | tsk = waiter->task; |
1343 | - smp_mb(); |
1344 | - waiter->task = NULL; |
1345 | + smp_store_release(&waiter->task, NULL); |
1346 | wake_up_process(tsk); |
1347 | put_task_struct(tsk); |
1348 | } |
1349 | @@ -217,7 +216,7 @@ down_read_failed(struct ld_semaphore *sem, long count, long timeout) |
1350 | for (;;) { |
1351 | set_current_state(TASK_UNINTERRUPTIBLE); |
1352 | |
1353 | - if (!waiter.task) |
1354 | + if (!smp_load_acquire(&waiter.task)) |
1355 | break; |
1356 | if (!timeout) |
1357 | break; |
1358 | diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c |
1359 | index ffccd40ea67d..29c6414f48f1 100644 |
1360 | --- a/drivers/usb/core/devio.c |
1361 | +++ b/drivers/usb/core/devio.c |
1362 | @@ -1792,8 +1792,6 @@ static int proc_do_submiturb(struct usb_dev_state *ps, struct usbdevfs_urb *uurb |
1363 | return 0; |
1364 | |
1365 | error: |
1366 | - if (as && as->usbm) |
1367 | - dec_usb_memory_use_count(as->usbm, &as->usbm->urb_use_count); |
1368 | kfree(isopkt); |
1369 | kfree(dr); |
1370 | if (as) |
1371 | diff --git a/drivers/usb/host/xhci-rcar.c b/drivers/usb/host/xhci-rcar.c |
1372 | index 671bce18782c..8616c52849c6 100644 |
1373 | --- a/drivers/usb/host/xhci-rcar.c |
1374 | +++ b/drivers/usb/host/xhci-rcar.c |
1375 | @@ -238,10 +238,15 @@ int xhci_rcar_init_quirk(struct usb_hcd *hcd) |
1376 | * pointers. So, this driver clears the AC64 bit of xhci->hcc_params |
1377 | * to call dma_set_coherent_mask(dev, DMA_BIT_MASK(32)) in |
1378 | * xhci_gen_setup(). |
1379 | + * |
1380 | + * And, since the firmware/internal CPU control the USBSTS.STS_HALT |
1381 | + * and the process speed is down when the roothub port enters U3, |
1382 | + * long delay for the handshake of STS_HALT is neeed in xhci_suspend(). |
1383 | */ |
1384 | if (xhci_rcar_is_gen2(hcd->self.controller) || |
1385 | - xhci_rcar_is_gen3(hcd->self.controller)) |
1386 | - xhci->quirks |= XHCI_NO_64BIT_SUPPORT; |
1387 | + xhci_rcar_is_gen3(hcd->self.controller)) { |
1388 | + xhci->quirks |= XHCI_NO_64BIT_SUPPORT | XHCI_SLOW_SUSPEND; |
1389 | + } |
1390 | |
1391 | if (!xhci_rcar_wait_for_pll_active(hcd)) |
1392 | return -ETIMEDOUT; |
1393 | diff --git a/drivers/usb/misc/iowarrior.c b/drivers/usb/misc/iowarrior.c |
1394 | index c2991b8a65ce..55db0fc87927 100644 |
1395 | --- a/drivers/usb/misc/iowarrior.c |
1396 | +++ b/drivers/usb/misc/iowarrior.c |
1397 | @@ -866,19 +866,20 @@ static void iowarrior_disconnect(struct usb_interface *interface) |
1398 | dev = usb_get_intfdata(interface); |
1399 | mutex_lock(&iowarrior_open_disc_lock); |
1400 | usb_set_intfdata(interface, NULL); |
1401 | + /* prevent device read, write and ioctl */ |
1402 | + dev->present = 0; |
1403 | |
1404 | minor = dev->minor; |
1405 | + mutex_unlock(&iowarrior_open_disc_lock); |
1406 | + /* give back our minor - this will call close() locks need to be dropped at this point*/ |
1407 | |
1408 | - /* give back our minor */ |
1409 | usb_deregister_dev(interface, &iowarrior_class); |
1410 | |
1411 | mutex_lock(&dev->mutex); |
1412 | |
1413 | /* prevent device read, write and ioctl */ |
1414 | - dev->present = 0; |
1415 | |
1416 | mutex_unlock(&dev->mutex); |
1417 | - mutex_unlock(&iowarrior_open_disc_lock); |
1418 | |
1419 | if (dev->opened) { |
1420 | /* There is a process that holds a filedescriptor to the device , |
1421 | diff --git a/drivers/usb/misc/yurex.c b/drivers/usb/misc/yurex.c |
1422 | index 7b306aa22d25..6715a128e6c8 100644 |
1423 | --- a/drivers/usb/misc/yurex.c |
1424 | +++ b/drivers/usb/misc/yurex.c |
1425 | @@ -92,7 +92,6 @@ static void yurex_delete(struct kref *kref) |
1426 | |
1427 | dev_dbg(&dev->interface->dev, "%s\n", __func__); |
1428 | |
1429 | - usb_put_dev(dev->udev); |
1430 | if (dev->cntl_urb) { |
1431 | usb_kill_urb(dev->cntl_urb); |
1432 | kfree(dev->cntl_req); |
1433 | @@ -108,6 +107,7 @@ static void yurex_delete(struct kref *kref) |
1434 | dev->int_buffer, dev->urb->transfer_dma); |
1435 | usb_free_urb(dev->urb); |
1436 | } |
1437 | + usb_put_dev(dev->udev); |
1438 | kfree(dev); |
1439 | } |
1440 | |
1441 | diff --git a/drivers/usb/typec/tcpm.c b/drivers/usb/typec/tcpm.c |
1442 | index 3457c1fdebd1..5f29ce8d6c3f 100644 |
1443 | --- a/drivers/usb/typec/tcpm.c |
1444 | +++ b/drivers/usb/typec/tcpm.c |
1445 | @@ -378,7 +378,8 @@ static enum tcpm_state tcpm_default_state(struct tcpm_port *port) |
1446 | return SNK_UNATTACHED; |
1447 | else if (port->try_role == TYPEC_SOURCE) |
1448 | return SRC_UNATTACHED; |
1449 | - else if (port->tcpc->config->default_role == TYPEC_SINK) |
1450 | + else if (port->tcpc->config && |
1451 | + port->tcpc->config->default_role == TYPEC_SINK) |
1452 | return SNK_UNATTACHED; |
1453 | /* Fall through to return SRC_UNATTACHED */ |
1454 | } else if (port->port_type == TYPEC_PORT_SNK) { |
1455 | @@ -585,7 +586,20 @@ static void tcpm_debugfs_init(struct tcpm_port *port) |
1456 | |
1457 | static void tcpm_debugfs_exit(struct tcpm_port *port) |
1458 | { |
1459 | + int i; |
1460 | + |
1461 | + mutex_lock(&port->logbuffer_lock); |
1462 | + for (i = 0; i < LOG_BUFFER_ENTRIES; i++) { |
1463 | + kfree(port->logbuffer[i]); |
1464 | + port->logbuffer[i] = NULL; |
1465 | + } |
1466 | + mutex_unlock(&port->logbuffer_lock); |
1467 | + |
1468 | debugfs_remove(port->dentry); |
1469 | + if (list_empty(&rootdir->d_subdirs)) { |
1470 | + debugfs_remove(rootdir); |
1471 | + rootdir = NULL; |
1472 | + } |
1473 | } |
1474 | |
1475 | #else |
1476 | @@ -1094,7 +1108,8 @@ static int tcpm_pd_svdm(struct tcpm_port *port, const __le32 *payload, int cnt, |
1477 | break; |
1478 | case CMD_ATTENTION: |
1479 | /* Attention command does not have response */ |
1480 | - typec_altmode_attention(adev, p[1]); |
1481 | + if (adev) |
1482 | + typec_altmode_attention(adev, p[1]); |
1483 | return 0; |
1484 | default: |
1485 | break; |
1486 | @@ -1146,20 +1161,26 @@ static int tcpm_pd_svdm(struct tcpm_port *port, const __le32 *payload, int cnt, |
1487 | } |
1488 | break; |
1489 | case CMD_ENTER_MODE: |
1490 | - typec_altmode_update_active(pdev, true); |
1491 | - |
1492 | - if (typec_altmode_vdm(adev, p[0], &p[1], cnt)) { |
1493 | - response[0] = VDO(adev->svid, 1, CMD_EXIT_MODE); |
1494 | - response[0] |= VDO_OPOS(adev->mode); |
1495 | - return 1; |
1496 | + if (adev && pdev) { |
1497 | + typec_altmode_update_active(pdev, true); |
1498 | + |
1499 | + if (typec_altmode_vdm(adev, p[0], &p[1], cnt)) { |
1500 | + response[0] = VDO(adev->svid, 1, |
1501 | + CMD_EXIT_MODE); |
1502 | + response[0] |= VDO_OPOS(adev->mode); |
1503 | + return 1; |
1504 | + } |
1505 | } |
1506 | return 0; |
1507 | case CMD_EXIT_MODE: |
1508 | - typec_altmode_update_active(pdev, false); |
1509 | + if (adev && pdev) { |
1510 | + typec_altmode_update_active(pdev, false); |
1511 | |
1512 | - /* Back to USB Operation */ |
1513 | - WARN_ON(typec_altmode_notify(adev, TYPEC_STATE_USB, |
1514 | - NULL)); |
1515 | + /* Back to USB Operation */ |
1516 | + WARN_ON(typec_altmode_notify(adev, |
1517 | + TYPEC_STATE_USB, |
1518 | + NULL)); |
1519 | + } |
1520 | break; |
1521 | default: |
1522 | break; |
1523 | @@ -1169,8 +1190,10 @@ static int tcpm_pd_svdm(struct tcpm_port *port, const __le32 *payload, int cnt, |
1524 | switch (cmd) { |
1525 | case CMD_ENTER_MODE: |
1526 | /* Back to USB Operation */ |
1527 | - WARN_ON(typec_altmode_notify(adev, TYPEC_STATE_USB, |
1528 | - NULL)); |
1529 | + if (adev) |
1530 | + WARN_ON(typec_altmode_notify(adev, |
1531 | + TYPEC_STATE_USB, |
1532 | + NULL)); |
1533 | break; |
1534 | default: |
1535 | break; |
1536 | @@ -1181,7 +1204,8 @@ static int tcpm_pd_svdm(struct tcpm_port *port, const __le32 *payload, int cnt, |
1537 | } |
1538 | |
1539 | /* Informing the alternate mode drivers about everything */ |
1540 | - typec_altmode_vdm(adev, p[0], &p[1], cnt); |
1541 | + if (adev) |
1542 | + typec_altmode_vdm(adev, p[0], &p[1], cnt); |
1543 | |
1544 | return rlen; |
1545 | } |
1546 | @@ -4083,7 +4107,7 @@ static int tcpm_try_role(const struct typec_capability *cap, int role) |
1547 | mutex_lock(&port->lock); |
1548 | if (tcpc->try_role) |
1549 | ret = tcpc->try_role(tcpc, role); |
1550 | - if (!ret && !tcpc->config->try_role_hw) |
1551 | + if (!ret && (!tcpc->config || !tcpc->config->try_role_hw)) |
1552 | port->try_role = role; |
1553 | port->try_src_count = 0; |
1554 | port->try_snk_count = 0; |
1555 | @@ -4730,7 +4754,7 @@ static int tcpm_copy_caps(struct tcpm_port *port, |
1556 | port->typec_caps.prefer_role = tcfg->default_role; |
1557 | port->typec_caps.type = tcfg->type; |
1558 | port->typec_caps.data = tcfg->data; |
1559 | - port->self_powered = port->tcpc->config->self_powered; |
1560 | + port->self_powered = tcfg->self_powered; |
1561 | |
1562 | return 0; |
1563 | } |
1564 | diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c |
1565 | index c181f1621e1a..2bc47eb6215e 100644 |
1566 | --- a/fs/cifs/smb2pdu.c |
1567 | +++ b/fs/cifs/smb2pdu.c |
1568 | @@ -168,7 +168,7 @@ smb2_reconnect(__le16 smb2_command, struct cifs_tcon *tcon) |
1569 | if (tcon == NULL) |
1570 | return 0; |
1571 | |
1572 | - if (smb2_command == SMB2_TREE_CONNECT) |
1573 | + if (smb2_command == SMB2_TREE_CONNECT || smb2_command == SMB2_IOCTL) |
1574 | return 0; |
1575 | |
1576 | if (tcon->tidStatus == CifsExiting) { |
1577 | @@ -1006,7 +1006,12 @@ SMB2_sess_alloc_buffer(struct SMB2_sess_data *sess_data) |
1578 | else |
1579 | req->SecurityMode = 0; |
1580 | |
1581 | +#ifdef CONFIG_CIFS_DFS_UPCALL |
1582 | + req->Capabilities = cpu_to_le32(SMB2_GLOBAL_CAP_DFS); |
1583 | +#else |
1584 | req->Capabilities = 0; |
1585 | +#endif /* DFS_UPCALL */ |
1586 | + |
1587 | req->Channel = 0; /* MBZ */ |
1588 | |
1589 | sess_data->iov[0].iov_base = (char *)req; |
1590 | diff --git a/fs/dax.c b/fs/dax.c |
1591 | index 75a289c31c7e..f0d932fa39c2 100644 |
1592 | --- a/fs/dax.c |
1593 | +++ b/fs/dax.c |
1594 | @@ -659,7 +659,7 @@ struct page *dax_layout_busy_page(struct address_space *mapping) |
1595 | * guaranteed to either see new references or prevent new |
1596 | * references from being established. |
1597 | */ |
1598 | - unmap_mapping_range(mapping, 0, 0, 1); |
1599 | + unmap_mapping_range(mapping, 0, 0, 0); |
1600 | |
1601 | while (index < end && pagevec_lookup_entries(&pvec, mapping, index, |
1602 | min(end - index, (pgoff_t)PAGEVEC_SIZE), |
1603 | diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c |
1604 | index 7f8bb0868c0f..d14d71d8d7ee 100644 |
1605 | --- a/fs/gfs2/bmap.c |
1606 | +++ b/fs/gfs2/bmap.c |
1607 | @@ -392,6 +392,19 @@ static int fillup_metapath(struct gfs2_inode *ip, struct metapath *mp, int h) |
1608 | return mp->mp_aheight - x - 1; |
1609 | } |
1610 | |
1611 | +static sector_t metapath_to_block(struct gfs2_sbd *sdp, struct metapath *mp) |
1612 | +{ |
1613 | + sector_t factor = 1, block = 0; |
1614 | + int hgt; |
1615 | + |
1616 | + for (hgt = mp->mp_fheight - 1; hgt >= 0; hgt--) { |
1617 | + if (hgt < mp->mp_aheight) |
1618 | + block += mp->mp_list[hgt] * factor; |
1619 | + factor *= sdp->sd_inptrs; |
1620 | + } |
1621 | + return block; |
1622 | +} |
1623 | + |
1624 | static void release_metapath(struct metapath *mp) |
1625 | { |
1626 | int i; |
1627 | @@ -432,60 +445,84 @@ static inline unsigned int gfs2_extent_length(struct buffer_head *bh, __be64 *pt |
1628 | return ptr - first; |
1629 | } |
1630 | |
1631 | -typedef const __be64 *(*gfs2_metadata_walker)( |
1632 | - struct metapath *mp, |
1633 | - const __be64 *start, const __be64 *end, |
1634 | - u64 factor, void *data); |
1635 | +enum walker_status { WALK_STOP, WALK_FOLLOW, WALK_CONTINUE }; |
1636 | |
1637 | -#define WALK_STOP ((__be64 *)0) |
1638 | -#define WALK_NEXT ((__be64 *)1) |
1639 | +/* |
1640 | + * gfs2_metadata_walker - walk an indirect block |
1641 | + * @mp: Metapath to indirect block |
1642 | + * @ptrs: Number of pointers to look at |
1643 | + * |
1644 | + * When returning WALK_FOLLOW, the walker must update @mp to point at the right |
1645 | + * indirect block to follow. |
1646 | + */ |
1647 | +typedef enum walker_status (*gfs2_metadata_walker)(struct metapath *mp, |
1648 | + unsigned int ptrs); |
1649 | + |
1650 | +/* |
1651 | + * gfs2_walk_metadata - walk a tree of indirect blocks |
1652 | + * @inode: The inode |
1653 | + * @mp: Starting point of walk |
1654 | + * @max_len: Maximum number of blocks to walk |
1655 | + * @walker: Called during the walk |
1656 | + * |
1657 | + * Returns 1 if the walk was stopped by @walker, 0 if we went past @max_len or |
1658 | + * past the end of metadata, and a negative error code otherwise. |
1659 | + */ |
1660 | |
1661 | -static int gfs2_walk_metadata(struct inode *inode, sector_t lblock, |
1662 | - u64 len, struct metapath *mp, gfs2_metadata_walker walker, |
1663 | - void *data) |
1664 | +static int gfs2_walk_metadata(struct inode *inode, struct metapath *mp, |
1665 | + u64 max_len, gfs2_metadata_walker walker) |
1666 | { |
1667 | - struct metapath clone; |
1668 | struct gfs2_inode *ip = GFS2_I(inode); |
1669 | struct gfs2_sbd *sdp = GFS2_SB(inode); |
1670 | - const __be64 *start, *end, *ptr; |
1671 | u64 factor = 1; |
1672 | unsigned int hgt; |
1673 | - int ret = 0; |
1674 | + int ret; |
1675 | |
1676 | - for (hgt = ip->i_height - 1; hgt >= mp->mp_aheight; hgt--) |
1677 | + /* |
1678 | + * The walk starts in the lowest allocated indirect block, which may be |
1679 | + * before the position indicated by @mp. Adjust @max_len accordingly |
1680 | + * to avoid a short walk. |
1681 | + */ |
1682 | + for (hgt = mp->mp_fheight - 1; hgt >= mp->mp_aheight; hgt--) { |
1683 | + max_len += mp->mp_list[hgt] * factor; |
1684 | + mp->mp_list[hgt] = 0; |
1685 | factor *= sdp->sd_inptrs; |
1686 | + } |
1687 | |
1688 | for (;;) { |
1689 | - u64 step; |
1690 | + u16 start = mp->mp_list[hgt]; |
1691 | + enum walker_status status; |
1692 | + unsigned int ptrs; |
1693 | + u64 len; |
1694 | |
1695 | /* Walk indirect block. */ |
1696 | - start = metapointer(hgt, mp); |
1697 | - end = metaend(hgt, mp); |
1698 | - |
1699 | - step = (end - start) * factor; |
1700 | - if (step > len) |
1701 | - end = start + DIV_ROUND_UP_ULL(len, factor); |
1702 | - |
1703 | - ptr = walker(mp, start, end, factor, data); |
1704 | - if (ptr == WALK_STOP) |
1705 | + ptrs = (hgt >= 1 ? sdp->sd_inptrs : sdp->sd_diptrs) - start; |
1706 | + len = ptrs * factor; |
1707 | + if (len > max_len) |
1708 | + ptrs = DIV_ROUND_UP_ULL(max_len, factor); |
1709 | + status = walker(mp, ptrs); |
1710 | + switch (status) { |
1711 | + case WALK_STOP: |
1712 | + return 1; |
1713 | + case WALK_FOLLOW: |
1714 | + BUG_ON(mp->mp_aheight == mp->mp_fheight); |
1715 | + ptrs = mp->mp_list[hgt] - start; |
1716 | + len = ptrs * factor; |
1717 | break; |
1718 | - if (step >= len) |
1719 | + case WALK_CONTINUE: |
1720 | break; |
1721 | - len -= step; |
1722 | - if (ptr != WALK_NEXT) { |
1723 | - BUG_ON(!*ptr); |
1724 | - mp->mp_list[hgt] += ptr - start; |
1725 | - goto fill_up_metapath; |
1726 | } |
1727 | + if (len >= max_len) |
1728 | + break; |
1729 | + max_len -= len; |
1730 | + if (status == WALK_FOLLOW) |
1731 | + goto fill_up_metapath; |
1732 | |
1733 | lower_metapath: |
1734 | /* Decrease height of metapath. */ |
1735 | - if (mp != &clone) { |
1736 | - clone_metapath(&clone, mp); |
1737 | - mp = &clone; |
1738 | - } |
1739 | brelse(mp->mp_bh[hgt]); |
1740 | mp->mp_bh[hgt] = NULL; |
1741 | + mp->mp_list[hgt] = 0; |
1742 | if (!hgt) |
1743 | break; |
1744 | hgt--; |
1745 | @@ -493,10 +530,7 @@ lower_metapath: |
1746 | |
1747 | /* Advance in metadata tree. */ |
1748 | (mp->mp_list[hgt])++; |
1749 | - start = metapointer(hgt, mp); |
1750 | - end = metaend(hgt, mp); |
1751 | - if (start >= end) { |
1752 | - mp->mp_list[hgt] = 0; |
1753 | + if (mp->mp_list[hgt] >= sdp->sd_inptrs) { |
1754 | if (!hgt) |
1755 | break; |
1756 | goto lower_metapath; |
1757 | @@ -504,44 +538,36 @@ lower_metapath: |
1758 | |
1759 | fill_up_metapath: |
1760 | /* Increase height of metapath. */ |
1761 | - if (mp != &clone) { |
1762 | - clone_metapath(&clone, mp); |
1763 | - mp = &clone; |
1764 | - } |
1765 | ret = fillup_metapath(ip, mp, ip->i_height - 1); |
1766 | if (ret < 0) |
1767 | - break; |
1768 | + return ret; |
1769 | hgt += ret; |
1770 | for (; ret; ret--) |
1771 | do_div(factor, sdp->sd_inptrs); |
1772 | mp->mp_aheight = hgt + 1; |
1773 | } |
1774 | - if (mp == &clone) |
1775 | - release_metapath(mp); |
1776 | - return ret; |
1777 | + return 0; |
1778 | } |
1779 | |
1780 | -struct gfs2_hole_walker_args { |
1781 | - u64 blocks; |
1782 | -}; |
1783 | - |
1784 | -static const __be64 *gfs2_hole_walker(struct metapath *mp, |
1785 | - const __be64 *start, const __be64 *end, |
1786 | - u64 factor, void *data) |
1787 | +static enum walker_status gfs2_hole_walker(struct metapath *mp, |
1788 | + unsigned int ptrs) |
1789 | { |
1790 | - struct gfs2_hole_walker_args *args = data; |
1791 | - const __be64 *ptr; |
1792 | + const __be64 *start, *ptr, *end; |
1793 | + unsigned int hgt; |
1794 | + |
1795 | + hgt = mp->mp_aheight - 1; |
1796 | + start = metapointer(hgt, mp); |
1797 | + end = start + ptrs; |
1798 | |
1799 | for (ptr = start; ptr < end; ptr++) { |
1800 | if (*ptr) { |
1801 | - args->blocks += (ptr - start) * factor; |
1802 | + mp->mp_list[hgt] += ptr - start; |
1803 | if (mp->mp_aheight == mp->mp_fheight) |
1804 | return WALK_STOP; |
1805 | - return ptr; /* increase height */ |
1806 | + return WALK_FOLLOW; |
1807 | } |
1808 | } |
1809 | - args->blocks += (end - start) * factor; |
1810 | - return WALK_NEXT; |
1811 | + return WALK_CONTINUE; |
1812 | } |
1813 | |
1814 | /** |
1815 | @@ -559,12 +585,24 @@ static const __be64 *gfs2_hole_walker(struct metapath *mp, |
1816 | static int gfs2_hole_size(struct inode *inode, sector_t lblock, u64 len, |
1817 | struct metapath *mp, struct iomap *iomap) |
1818 | { |
1819 | - struct gfs2_hole_walker_args args = { }; |
1820 | - int ret = 0; |
1821 | + struct metapath clone; |
1822 | + u64 hole_size; |
1823 | + int ret; |
1824 | |
1825 | - ret = gfs2_walk_metadata(inode, lblock, len, mp, gfs2_hole_walker, &args); |
1826 | - if (!ret) |
1827 | - iomap->length = args.blocks << inode->i_blkbits; |
1828 | + clone_metapath(&clone, mp); |
1829 | + ret = gfs2_walk_metadata(inode, &clone, len, gfs2_hole_walker); |
1830 | + if (ret < 0) |
1831 | + goto out; |
1832 | + |
1833 | + if (ret == 1) |
1834 | + hole_size = metapath_to_block(GFS2_SB(inode), &clone) - lblock; |
1835 | + else |
1836 | + hole_size = len; |
1837 | + iomap->length = hole_size << inode->i_blkbits; |
1838 | + ret = 0; |
1839 | + |
1840 | +out: |
1841 | + release_metapath(&clone); |
1842 | return ret; |
1843 | } |
1844 | |
1845 | diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c |
1846 | index 904e08bbb289..31ae3bd5d9d2 100644 |
1847 | --- a/fs/nfs/nfs4proc.c |
1848 | +++ b/fs/nfs/nfs4proc.c |
1849 | @@ -3133,7 +3133,7 @@ static int _nfs4_do_setattr(struct inode *inode, |
1850 | |
1851 | if (nfs4_copy_delegation_stateid(inode, FMODE_WRITE, &arg->stateid, &delegation_cred)) { |
1852 | /* Use that stateid */ |
1853 | - } else if (ctx != NULL) { |
1854 | + } else if (ctx != NULL && ctx->state) { |
1855 | struct nfs_lock_context *l_ctx; |
1856 | if (!nfs4_valid_open_stateid(ctx->state)) |
1857 | return -EBADF; |
1858 | diff --git a/include/linux/ccp.h b/include/linux/ccp.h |
1859 | index 7e9c991c95e0..43ed9e77cf81 100644 |
1860 | --- a/include/linux/ccp.h |
1861 | +++ b/include/linux/ccp.h |
1862 | @@ -173,6 +173,8 @@ struct ccp_aes_engine { |
1863 | enum ccp_aes_mode mode; |
1864 | enum ccp_aes_action action; |
1865 | |
1866 | + u32 authsize; |
1867 | + |
1868 | struct scatterlist *key; |
1869 | u32 key_len; /* In bytes */ |
1870 | |
1871 | diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h |
1872 | index 30efb3663892..d42a36e4e6c2 100644 |
1873 | --- a/include/linux/kvm_host.h |
1874 | +++ b/include/linux/kvm_host.h |
1875 | @@ -818,6 +818,7 @@ void kvm_arch_check_processor_compat(void *rtn); |
1876 | int kvm_arch_vcpu_runnable(struct kvm_vcpu *vcpu); |
1877 | bool kvm_arch_vcpu_in_kernel(struct kvm_vcpu *vcpu); |
1878 | int kvm_arch_vcpu_should_kick(struct kvm_vcpu *vcpu); |
1879 | +bool kvm_arch_dy_runnable(struct kvm_vcpu *vcpu); |
1880 | |
1881 | #ifndef __KVM_HAVE_ARCH_VM_ALLOC |
1882 | /* |
1883 | diff --git a/include/sound/compress_driver.h b/include/sound/compress_driver.h |
1884 | index e87f2d5b3cc6..127c2713b543 100644 |
1885 | --- a/include/sound/compress_driver.h |
1886 | +++ b/include/sound/compress_driver.h |
1887 | @@ -171,10 +171,7 @@ static inline void snd_compr_drain_notify(struct snd_compr_stream *stream) |
1888 | if (snd_BUG_ON(!stream)) |
1889 | return; |
1890 | |
1891 | - if (stream->direction == SND_COMPRESS_PLAYBACK) |
1892 | - stream->runtime->state = SNDRV_PCM_STATE_SETUP; |
1893 | - else |
1894 | - stream->runtime->state = SNDRV_PCM_STATE_PREPARED; |
1895 | + stream->runtime->state = SNDRV_PCM_STATE_SETUP; |
1896 | |
1897 | wake_up(&stream->runtime->sleep); |
1898 | } |
1899 | diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h |
1900 | index 7acc16f34942..fa43dd5a7b3d 100644 |
1901 | --- a/include/uapi/linux/nl80211.h |
1902 | +++ b/include/uapi/linux/nl80211.h |
1903 | @@ -2732,7 +2732,7 @@ enum nl80211_attrs { |
1904 | #define NL80211_HT_CAPABILITY_LEN 26 |
1905 | #define NL80211_VHT_CAPABILITY_LEN 12 |
1906 | #define NL80211_HE_MIN_CAPABILITY_LEN 16 |
1907 | -#define NL80211_HE_MAX_CAPABILITY_LEN 51 |
1908 | +#define NL80211_HE_MAX_CAPABILITY_LEN 54 |
1909 | #define NL80211_MAX_NR_CIPHER_SUITES 5 |
1910 | #define NL80211_MAX_NR_AKM_SUITES 2 |
1911 | |
1912 | diff --git a/kernel/events/core.c b/kernel/events/core.c |
1913 | index e8979c72514b..7ca44b8523c8 100644 |
1914 | --- a/kernel/events/core.c |
1915 | +++ b/kernel/events/core.c |
1916 | @@ -10957,7 +10957,7 @@ perf_event_create_kernel_counter(struct perf_event_attr *attr, int cpu, |
1917 | goto err_unlock; |
1918 | } |
1919 | |
1920 | - perf_install_in_context(ctx, event, cpu); |
1921 | + perf_install_in_context(ctx, event, event->cpu); |
1922 | perf_unpin_context(ctx); |
1923 | mutex_unlock(&ctx->mutex); |
1924 | |
1925 | diff --git a/lib/test_firmware.c b/lib/test_firmware.c |
1926 | index fd48a15a0710..a74b1aae7461 100644 |
1927 | --- a/lib/test_firmware.c |
1928 | +++ b/lib/test_firmware.c |
1929 | @@ -894,8 +894,11 @@ static int __init test_firmware_init(void) |
1930 | return -ENOMEM; |
1931 | |
1932 | rc = __test_firmware_config_init(); |
1933 | - if (rc) |
1934 | + if (rc) { |
1935 | + kfree(test_fw_config); |
1936 | + pr_err("could not init firmware test config: %d\n", rc); |
1937 | return rc; |
1938 | + } |
1939 | |
1940 | rc = misc_register(&test_fw_misc_device); |
1941 | if (rc) { |
1942 | diff --git a/mm/vmalloc.c b/mm/vmalloc.c |
1943 | index a46ec261a44e..d8e877365f9f 100644 |
1944 | --- a/mm/vmalloc.c |
1945 | +++ b/mm/vmalloc.c |
1946 | @@ -1751,6 +1751,12 @@ void *__vmalloc_node_range(unsigned long size, unsigned long align, |
1947 | if (!addr) |
1948 | return NULL; |
1949 | |
1950 | + /* |
1951 | + * First make sure the mappings are removed from all page-tables |
1952 | + * before they are freed. |
1953 | + */ |
1954 | + vmalloc_sync_all(); |
1955 | + |
1956 | /* |
1957 | * In this function, newly allocated vm_struct has VM_UNINITIALIZED |
1958 | * flag. It means that vm_struct is not fully initialized. |
1959 | @@ -2296,6 +2302,9 @@ EXPORT_SYMBOL(remap_vmalloc_range); |
1960 | /* |
1961 | * Implement a stub for vmalloc_sync_all() if the architecture chose not to |
1962 | * have one. |
1963 | + * |
1964 | + * The purpose of this function is to make sure the vmalloc area |
1965 | + * mappings are identical in all page-tables in the system. |
1966 | */ |
1967 | void __weak vmalloc_sync_all(void) |
1968 | { |
1969 | diff --git a/net/ipv4/netfilter/ipt_rpfilter.c b/net/ipv4/netfilter/ipt_rpfilter.c |
1970 | index 12843c9ef142..74b19a5c572e 100644 |
1971 | --- a/net/ipv4/netfilter/ipt_rpfilter.c |
1972 | +++ b/net/ipv4/netfilter/ipt_rpfilter.c |
1973 | @@ -96,6 +96,7 @@ static bool rpfilter_mt(const struct sk_buff *skb, struct xt_action_param *par) |
1974 | flow.flowi4_mark = info->flags & XT_RPFILTER_VALID_MARK ? skb->mark : 0; |
1975 | flow.flowi4_tos = RT_TOS(iph->tos); |
1976 | flow.flowi4_scope = RT_SCOPE_UNIVERSE; |
1977 | + flow.flowi4_oif = l3mdev_master_ifindex_rcu(xt_in(par)); |
1978 | |
1979 | return rpfilter_lookup_reverse(xt_net(par), &flow, xt_in(par), info->flags) ^ invert; |
1980 | } |
1981 | diff --git a/net/ipv6/netfilter/ip6t_rpfilter.c b/net/ipv6/netfilter/ip6t_rpfilter.c |
1982 | index c3c6b09acdc4..0f3407f2851e 100644 |
1983 | --- a/net/ipv6/netfilter/ip6t_rpfilter.c |
1984 | +++ b/net/ipv6/netfilter/ip6t_rpfilter.c |
1985 | @@ -58,7 +58,9 @@ static bool rpfilter_lookup_reverse6(struct net *net, const struct sk_buff *skb, |
1986 | if (rpfilter_addr_linklocal(&iph->saddr)) { |
1987 | lookup_flags |= RT6_LOOKUP_F_IFACE; |
1988 | fl6.flowi6_oif = dev->ifindex; |
1989 | - } else if ((flags & XT_RPFILTER_LOOSE) == 0) |
1990 | + /* Set flowi6_oif for vrf devices to lookup route in l3mdev domain. */ |
1991 | + } else if (netif_is_l3_master(dev) || netif_is_l3_slave(dev) || |
1992 | + (flags & XT_RPFILTER_LOOSE) == 0) |
1993 | fl6.flowi6_oif = dev->ifindex; |
1994 | |
1995 | rt = (void *)ip6_route_lookup(net, &fl6, skb, lookup_flags); |
1996 | @@ -73,7 +75,9 @@ static bool rpfilter_lookup_reverse6(struct net *net, const struct sk_buff *skb, |
1997 | goto out; |
1998 | } |
1999 | |
2000 | - if (rt->rt6i_idev->dev == dev || (flags & XT_RPFILTER_LOOSE)) |
2001 | + if (rt->rt6i_idev->dev == dev || |
2002 | + l3mdev_master_ifindex_rcu(rt->rt6i_idev->dev) == dev->ifindex || |
2003 | + (flags & XT_RPFILTER_LOOSE)) |
2004 | ret = true; |
2005 | out: |
2006 | ip6_rt_put(rt); |
2007 | diff --git a/net/mac80211/driver-ops.c b/net/mac80211/driver-ops.c |
2008 | index bb886e7db47f..f783d1377d9a 100644 |
2009 | --- a/net/mac80211/driver-ops.c |
2010 | +++ b/net/mac80211/driver-ops.c |
2011 | @@ -169,11 +169,16 @@ int drv_conf_tx(struct ieee80211_local *local, |
2012 | if (!check_sdata_in_driver(sdata)) |
2013 | return -EIO; |
2014 | |
2015 | - if (WARN_ONCE(params->cw_min == 0 || |
2016 | - params->cw_min > params->cw_max, |
2017 | - "%s: invalid CW_min/CW_max: %d/%d\n", |
2018 | - sdata->name, params->cw_min, params->cw_max)) |
2019 | + if (params->cw_min == 0 || params->cw_min > params->cw_max) { |
2020 | + /* |
2021 | + * If we can't configure hardware anyway, don't warn. We may |
2022 | + * never have initialized the CW parameters. |
2023 | + */ |
2024 | + WARN_ONCE(local->ops->conf_tx, |
2025 | + "%s: invalid CW_min/CW_max: %d/%d\n", |
2026 | + sdata->name, params->cw_min, params->cw_max); |
2027 | return -EINVAL; |
2028 | + } |
2029 | |
2030 | trace_drv_conf_tx(local, sdata, ac, params); |
2031 | if (local->ops->conf_tx) |
2032 | diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c |
2033 | index 1aaa73fa308e..b5c06242a92e 100644 |
2034 | --- a/net/mac80211/mlme.c |
2035 | +++ b/net/mac80211/mlme.c |
2036 | @@ -1967,6 +1967,16 @@ ieee80211_sta_wmm_params(struct ieee80211_local *local, |
2037 | ieee80211_regulatory_limit_wmm_params(sdata, ¶ms[ac], ac); |
2038 | } |
2039 | |
2040 | + /* WMM specification requires all 4 ACIs. */ |
2041 | + for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) { |
2042 | + if (params[ac].cw_min == 0) { |
2043 | + sdata_info(sdata, |
2044 | + "AP has invalid WMM params (missing AC %d), using defaults\n", |
2045 | + ac); |
2046 | + return false; |
2047 | + } |
2048 | + } |
2049 | + |
2050 | for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) { |
2051 | mlme_dbg(sdata, |
2052 | "WMM AC=%d acm=%d aifs=%d cWmin=%d cWmax=%d txop=%d uapsd=%d, downgraded=%d\n", |
2053 | diff --git a/net/netfilter/nf_conntrack_proto_tcp.c b/net/netfilter/nf_conntrack_proto_tcp.c |
2054 | index 842f3f86fb2e..7011ab27c437 100644 |
2055 | --- a/net/netfilter/nf_conntrack_proto_tcp.c |
2056 | +++ b/net/netfilter/nf_conntrack_proto_tcp.c |
2057 | @@ -480,6 +480,7 @@ static bool tcp_in_window(const struct nf_conn *ct, |
2058 | struct ip_ct_tcp_state *receiver = &state->seen[!dir]; |
2059 | const struct nf_conntrack_tuple *tuple = &ct->tuplehash[dir].tuple; |
2060 | __u32 seq, ack, sack, end, win, swin; |
2061 | + u16 win_raw; |
2062 | s32 receiver_offset; |
2063 | bool res, in_recv_win; |
2064 | |
2065 | @@ -488,7 +489,8 @@ static bool tcp_in_window(const struct nf_conn *ct, |
2066 | */ |
2067 | seq = ntohl(tcph->seq); |
2068 | ack = sack = ntohl(tcph->ack_seq); |
2069 | - win = ntohs(tcph->window); |
2070 | + win_raw = ntohs(tcph->window); |
2071 | + win = win_raw; |
2072 | end = segment_seq_plus_len(seq, skb->len, dataoff, tcph); |
2073 | |
2074 | if (receiver->flags & IP_CT_TCP_FLAG_SACK_PERM) |
2075 | @@ -663,14 +665,14 @@ static bool tcp_in_window(const struct nf_conn *ct, |
2076 | && state->last_seq == seq |
2077 | && state->last_ack == ack |
2078 | && state->last_end == end |
2079 | - && state->last_win == win) |
2080 | + && state->last_win == win_raw) |
2081 | state->retrans++; |
2082 | else { |
2083 | state->last_dir = dir; |
2084 | state->last_seq = seq; |
2085 | state->last_ack = ack; |
2086 | state->last_end = end; |
2087 | - state->last_win = win; |
2088 | + state->last_win = win_raw; |
2089 | state->retrans = 0; |
2090 | } |
2091 | } |
2092 | diff --git a/net/netfilter/nfnetlink.c b/net/netfilter/nfnetlink.c |
2093 | index 916913454624..7f2c1915763f 100644 |
2094 | --- a/net/netfilter/nfnetlink.c |
2095 | +++ b/net/netfilter/nfnetlink.c |
2096 | @@ -575,7 +575,7 @@ static int nfnetlink_bind(struct net *net, int group) |
2097 | ss = nfnetlink_get_subsys(type << 8); |
2098 | rcu_read_unlock(); |
2099 | if (!ss) |
2100 | - request_module("nfnetlink-subsys-%d", type); |
2101 | + request_module_nowait("nfnetlink-subsys-%d", type); |
2102 | return 0; |
2103 | } |
2104 | #endif |
2105 | diff --git a/net/netfilter/nft_hash.c b/net/netfilter/nft_hash.c |
2106 | index c2d237144f74..b8f23f75aea6 100644 |
2107 | --- a/net/netfilter/nft_hash.c |
2108 | +++ b/net/netfilter/nft_hash.c |
2109 | @@ -196,7 +196,7 @@ static int nft_symhash_init(const struct nft_ctx *ctx, |
2110 | priv->dreg = nft_parse_register(tb[NFTA_HASH_DREG]); |
2111 | |
2112 | priv->modulus = ntohl(nla_get_be32(tb[NFTA_HASH_MODULUS])); |
2113 | - if (priv->modulus <= 1) |
2114 | + if (priv->modulus < 1) |
2115 | return -ERANGE; |
2116 | |
2117 | if (priv->offset + priv->modulus - 1 < priv->offset) |
2118 | diff --git a/scripts/sphinx-pre-install b/scripts/sphinx-pre-install |
2119 | index 067459760a7b..3524dbc31316 100755 |
2120 | --- a/scripts/sphinx-pre-install |
2121 | +++ b/scripts/sphinx-pre-install |
2122 | @@ -301,7 +301,7 @@ sub give_redhat_hints() |
2123 | # |
2124 | # Checks valid for RHEL/CentOS version 7.x. |
2125 | # |
2126 | - if (! $system_release =~ /Fedora/) { |
2127 | + if (!($system_release =~ /Fedora/)) { |
2128 | $map{"virtualenv"} = "python-virtualenv"; |
2129 | } |
2130 | |
2131 | diff --git a/sound/core/compress_offload.c b/sound/core/compress_offload.c |
2132 | index 8b78ddffa509..516ec3587325 100644 |
2133 | --- a/sound/core/compress_offload.c |
2134 | +++ b/sound/core/compress_offload.c |
2135 | @@ -575,10 +575,7 @@ snd_compr_set_params(struct snd_compr_stream *stream, unsigned long arg) |
2136 | stream->metadata_set = false; |
2137 | stream->next_track = false; |
2138 | |
2139 | - if (stream->direction == SND_COMPRESS_PLAYBACK) |
2140 | - stream->runtime->state = SNDRV_PCM_STATE_SETUP; |
2141 | - else |
2142 | - stream->runtime->state = SNDRV_PCM_STATE_PREPARED; |
2143 | + stream->runtime->state = SNDRV_PCM_STATE_SETUP; |
2144 | } else { |
2145 | return -EPERM; |
2146 | } |
2147 | @@ -694,8 +691,17 @@ static int snd_compr_start(struct snd_compr_stream *stream) |
2148 | { |
2149 | int retval; |
2150 | |
2151 | - if (stream->runtime->state != SNDRV_PCM_STATE_PREPARED) |
2152 | + switch (stream->runtime->state) { |
2153 | + case SNDRV_PCM_STATE_SETUP: |
2154 | + if (stream->direction != SND_COMPRESS_CAPTURE) |
2155 | + return -EPERM; |
2156 | + break; |
2157 | + case SNDRV_PCM_STATE_PREPARED: |
2158 | + break; |
2159 | + default: |
2160 | return -EPERM; |
2161 | + } |
2162 | + |
2163 | retval = stream->ops->trigger(stream, SNDRV_PCM_TRIGGER_START); |
2164 | if (!retval) |
2165 | stream->runtime->state = SNDRV_PCM_STATE_RUNNING; |
2166 | @@ -706,9 +712,15 @@ static int snd_compr_stop(struct snd_compr_stream *stream) |
2167 | { |
2168 | int retval; |
2169 | |
2170 | - if (stream->runtime->state == SNDRV_PCM_STATE_PREPARED || |
2171 | - stream->runtime->state == SNDRV_PCM_STATE_SETUP) |
2172 | + switch (stream->runtime->state) { |
2173 | + case SNDRV_PCM_STATE_OPEN: |
2174 | + case SNDRV_PCM_STATE_SETUP: |
2175 | + case SNDRV_PCM_STATE_PREPARED: |
2176 | return -EPERM; |
2177 | + default: |
2178 | + break; |
2179 | + } |
2180 | + |
2181 | retval = stream->ops->trigger(stream, SNDRV_PCM_TRIGGER_STOP); |
2182 | if (!retval) { |
2183 | snd_compr_drain_notify(stream); |
2184 | @@ -796,9 +808,17 @@ static int snd_compr_drain(struct snd_compr_stream *stream) |
2185 | { |
2186 | int retval; |
2187 | |
2188 | - if (stream->runtime->state == SNDRV_PCM_STATE_PREPARED || |
2189 | - stream->runtime->state == SNDRV_PCM_STATE_SETUP) |
2190 | + switch (stream->runtime->state) { |
2191 | + case SNDRV_PCM_STATE_OPEN: |
2192 | + case SNDRV_PCM_STATE_SETUP: |
2193 | + case SNDRV_PCM_STATE_PREPARED: |
2194 | + case SNDRV_PCM_STATE_PAUSED: |
2195 | return -EPERM; |
2196 | + case SNDRV_PCM_STATE_XRUN: |
2197 | + return -EPIPE; |
2198 | + default: |
2199 | + break; |
2200 | + } |
2201 | |
2202 | retval = stream->ops->trigger(stream, SND_COMPR_TRIGGER_DRAIN); |
2203 | if (retval) { |
2204 | @@ -818,6 +838,10 @@ static int snd_compr_next_track(struct snd_compr_stream *stream) |
2205 | if (stream->runtime->state != SNDRV_PCM_STATE_RUNNING) |
2206 | return -EPERM; |
2207 | |
2208 | + /* next track doesn't have any meaning for capture streams */ |
2209 | + if (stream->direction == SND_COMPRESS_CAPTURE) |
2210 | + return -EPERM; |
2211 | + |
2212 | /* you can signal next track if this is intended to be a gapless stream |
2213 | * and current track metadata is set |
2214 | */ |
2215 | @@ -835,9 +859,23 @@ static int snd_compr_next_track(struct snd_compr_stream *stream) |
2216 | static int snd_compr_partial_drain(struct snd_compr_stream *stream) |
2217 | { |
2218 | int retval; |
2219 | - if (stream->runtime->state == SNDRV_PCM_STATE_PREPARED || |
2220 | - stream->runtime->state == SNDRV_PCM_STATE_SETUP) |
2221 | + |
2222 | + switch (stream->runtime->state) { |
2223 | + case SNDRV_PCM_STATE_OPEN: |
2224 | + case SNDRV_PCM_STATE_SETUP: |
2225 | + case SNDRV_PCM_STATE_PREPARED: |
2226 | + case SNDRV_PCM_STATE_PAUSED: |
2227 | + return -EPERM; |
2228 | + case SNDRV_PCM_STATE_XRUN: |
2229 | + return -EPIPE; |
2230 | + default: |
2231 | + break; |
2232 | + } |
2233 | + |
2234 | + /* partial drain doesn't have any meaning for capture streams */ |
2235 | + if (stream->direction == SND_COMPRESS_CAPTURE) |
2236 | return -EPERM; |
2237 | + |
2238 | /* stream can be drained only when next track has been signalled */ |
2239 | if (stream->next_track == false) |
2240 | return -EPERM; |
2241 | diff --git a/sound/firewire/packets-buffer.c b/sound/firewire/packets-buffer.c |
2242 | index 1ebf00c83409..715cd99f28de 100644 |
2243 | --- a/sound/firewire/packets-buffer.c |
2244 | +++ b/sound/firewire/packets-buffer.c |
2245 | @@ -37,7 +37,7 @@ int iso_packets_buffer_init(struct iso_packets_buffer *b, struct fw_unit *unit, |
2246 | packets_per_page = PAGE_SIZE / packet_size; |
2247 | if (WARN_ON(!packets_per_page)) { |
2248 | err = -EINVAL; |
2249 | - goto error; |
2250 | + goto err_packets; |
2251 | } |
2252 | pages = DIV_ROUND_UP(count, packets_per_page); |
2253 | |
2254 | diff --git a/sound/pci/hda/hda_controller.c b/sound/pci/hda/hda_controller.c |
2255 | index a12e594d4e3b..a41c1bec7c88 100644 |
2256 | --- a/sound/pci/hda/hda_controller.c |
2257 | +++ b/sound/pci/hda/hda_controller.c |
2258 | @@ -609,11 +609,9 @@ static int azx_pcm_open(struct snd_pcm_substream *substream) |
2259 | } |
2260 | runtime->private_data = azx_dev; |
2261 | |
2262 | - if (chip->gts_present) |
2263 | - azx_pcm_hw.info = azx_pcm_hw.info | |
2264 | - SNDRV_PCM_INFO_HAS_LINK_SYNCHRONIZED_ATIME; |
2265 | - |
2266 | runtime->hw = azx_pcm_hw; |
2267 | + if (chip->gts_present) |
2268 | + runtime->hw.info |= SNDRV_PCM_INFO_HAS_LINK_SYNCHRONIZED_ATIME; |
2269 | runtime->hw.channels_min = hinfo->channels_min; |
2270 | runtime->hw.channels_max = hinfo->channels_max; |
2271 | runtime->hw.formats = hinfo->formats; |
2272 | @@ -626,6 +624,13 @@ static int azx_pcm_open(struct snd_pcm_substream *substream) |
2273 | 20, |
2274 | 178000000); |
2275 | |
2276 | + /* by some reason, the playback stream stalls on PulseAudio with |
2277 | + * tsched=1 when a capture stream triggers. Until we figure out the |
2278 | + * real cause, disable tsched mode by telling the PCM info flag. |
2279 | + */ |
2280 | + if (chip->driver_caps & AZX_DCAPS_AMD_WORKAROUND) |
2281 | + runtime->hw.info |= SNDRV_PCM_INFO_BATCH; |
2282 | + |
2283 | if (chip->align_buffer_size) |
2284 | /* constrain buffer sizes to be multiple of 128 |
2285 | bytes. This is more efficient in terms of memory |
2286 | diff --git a/sound/pci/hda/hda_controller.h b/sound/pci/hda/hda_controller.h |
2287 | index 53c3cd28bc99..8a9dd4767b1e 100644 |
2288 | --- a/sound/pci/hda/hda_controller.h |
2289 | +++ b/sound/pci/hda/hda_controller.h |
2290 | @@ -40,7 +40,7 @@ |
2291 | /* 14 unused */ |
2292 | #define AZX_DCAPS_CTX_WORKAROUND (1 << 15) /* X-Fi workaround */ |
2293 | #define AZX_DCAPS_POSFIX_LPIB (1 << 16) /* Use LPIB as default */ |
2294 | -/* 17 unused */ |
2295 | +#define AZX_DCAPS_AMD_WORKAROUND (1 << 17) /* AMD-specific workaround */ |
2296 | #define AZX_DCAPS_NO_64BIT (1 << 18) /* No 64bit address */ |
2297 | #define AZX_DCAPS_SYNC_WRITE (1 << 19) /* sync each cmd write */ |
2298 | #define AZX_DCAPS_OLD_SSYNC (1 << 20) /* Old SSYNC reg for ICH */ |
2299 | diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c |
2300 | index 308ce76149cc..81cea34aff1c 100644 |
2301 | --- a/sound/pci/hda/hda_intel.c |
2302 | +++ b/sound/pci/hda/hda_intel.c |
2303 | @@ -78,6 +78,7 @@ enum { |
2304 | POS_FIX_VIACOMBO, |
2305 | POS_FIX_COMBO, |
2306 | POS_FIX_SKL, |
2307 | + POS_FIX_FIFO, |
2308 | }; |
2309 | |
2310 | /* Defines for ATI HD Audio support in SB450 south bridge */ |
2311 | @@ -149,7 +150,7 @@ module_param_array(model, charp, NULL, 0444); |
2312 | MODULE_PARM_DESC(model, "Use the given board model."); |
2313 | module_param_array(position_fix, int, NULL, 0444); |
2314 | MODULE_PARM_DESC(position_fix, "DMA pointer read method." |
2315 | - "(-1 = system default, 0 = auto, 1 = LPIB, 2 = POSBUF, 3 = VIACOMBO, 4 = COMBO, 5 = SKL+)."); |
2316 | + "(-1 = system default, 0 = auto, 1 = LPIB, 2 = POSBUF, 3 = VIACOMBO, 4 = COMBO, 5 = SKL+, 6 = FIFO)."); |
2317 | module_param_array(bdl_pos_adj, int, NULL, 0644); |
2318 | MODULE_PARM_DESC(bdl_pos_adj, "BDL position adjustment offset."); |
2319 | module_param_array(probe_mask, int, NULL, 0444); |
2320 | @@ -350,6 +351,11 @@ enum { |
2321 | #define AZX_DCAPS_PRESET_ATI_HDMI_NS \ |
2322 | (AZX_DCAPS_PRESET_ATI_HDMI | AZX_DCAPS_SNOOP_OFF) |
2323 | |
2324 | +/* quirks for AMD SB */ |
2325 | +#define AZX_DCAPS_PRESET_AMD_SB \ |
2326 | + (AZX_DCAPS_NO_TCSEL | AZX_DCAPS_SYNC_WRITE | AZX_DCAPS_AMD_WORKAROUND |\ |
2327 | + AZX_DCAPS_SNOOP_TYPE(ATI) | AZX_DCAPS_PM_RUNTIME) |
2328 | + |
2329 | /* quirks for Nvidia */ |
2330 | #define AZX_DCAPS_PRESET_NVIDIA \ |
2331 | (AZX_DCAPS_NO_MSI | AZX_DCAPS_CORBRP_SELF_CLEAR |\ |
2332 | @@ -920,6 +926,49 @@ static unsigned int azx_via_get_position(struct azx *chip, |
2333 | return bound_pos + mod_dma_pos; |
2334 | } |
2335 | |
2336 | +#define AMD_FIFO_SIZE 32 |
2337 | + |
2338 | +/* get the current DMA position with FIFO size correction */ |
2339 | +static unsigned int azx_get_pos_fifo(struct azx *chip, struct azx_dev *azx_dev) |
2340 | +{ |
2341 | + struct snd_pcm_substream *substream = azx_dev->core.substream; |
2342 | + struct snd_pcm_runtime *runtime = substream->runtime; |
2343 | + unsigned int pos, delay; |
2344 | + |
2345 | + pos = snd_hdac_stream_get_pos_lpib(azx_stream(azx_dev)); |
2346 | + if (!runtime) |
2347 | + return pos; |
2348 | + |
2349 | + runtime->delay = AMD_FIFO_SIZE; |
2350 | + delay = frames_to_bytes(runtime, AMD_FIFO_SIZE); |
2351 | + if (azx_dev->insufficient) { |
2352 | + if (pos < delay) { |
2353 | + delay = pos; |
2354 | + runtime->delay = bytes_to_frames(runtime, pos); |
2355 | + } else { |
2356 | + azx_dev->insufficient = 0; |
2357 | + } |
2358 | + } |
2359 | + |
2360 | + /* correct the DMA position for capture stream */ |
2361 | + if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) { |
2362 | + if (pos < delay) |
2363 | + pos += azx_dev->core.bufsize; |
2364 | + pos -= delay; |
2365 | + } |
2366 | + |
2367 | + return pos; |
2368 | +} |
2369 | + |
2370 | +static int azx_get_delay_from_fifo(struct azx *chip, struct azx_dev *azx_dev, |
2371 | + unsigned int pos) |
2372 | +{ |
2373 | + struct snd_pcm_substream *substream = azx_dev->core.substream; |
2374 | + |
2375 | + /* just read back the calculated value in the above */ |
2376 | + return substream->runtime->delay; |
2377 | +} |
2378 | + |
2379 | static unsigned int azx_skl_get_dpib_pos(struct azx *chip, |
2380 | struct azx_dev *azx_dev) |
2381 | { |
2382 | @@ -1528,6 +1577,7 @@ static int check_position_fix(struct azx *chip, int fix) |
2383 | case POS_FIX_VIACOMBO: |
2384 | case POS_FIX_COMBO: |
2385 | case POS_FIX_SKL: |
2386 | + case POS_FIX_FIFO: |
2387 | return fix; |
2388 | } |
2389 | |
2390 | @@ -1544,6 +1594,10 @@ static int check_position_fix(struct azx *chip, int fix) |
2391 | dev_dbg(chip->card->dev, "Using VIACOMBO position fix\n"); |
2392 | return POS_FIX_VIACOMBO; |
2393 | } |
2394 | + if (chip->driver_caps & AZX_DCAPS_AMD_WORKAROUND) { |
2395 | + dev_dbg(chip->card->dev, "Using FIFO position fix\n"); |
2396 | + return POS_FIX_FIFO; |
2397 | + } |
2398 | if (chip->driver_caps & AZX_DCAPS_POSFIX_LPIB) { |
2399 | dev_dbg(chip->card->dev, "Using LPIB position fix\n"); |
2400 | return POS_FIX_LPIB; |
2401 | @@ -1564,6 +1618,7 @@ static void assign_position_fix(struct azx *chip, int fix) |
2402 | [POS_FIX_VIACOMBO] = azx_via_get_position, |
2403 | [POS_FIX_COMBO] = azx_get_pos_lpib, |
2404 | [POS_FIX_SKL] = azx_get_pos_skl, |
2405 | + [POS_FIX_FIFO] = azx_get_pos_fifo, |
2406 | }; |
2407 | |
2408 | chip->get_position[0] = chip->get_position[1] = callbacks[fix]; |
2409 | @@ -1578,6 +1633,9 @@ static void assign_position_fix(struct azx *chip, int fix) |
2410 | azx_get_delay_from_lpib; |
2411 | } |
2412 | |
2413 | + if (fix == POS_FIX_FIFO) |
2414 | + chip->get_delay[0] = chip->get_delay[1] = |
2415 | + azx_get_delay_from_fifo; |
2416 | } |
2417 | |
2418 | /* |
2419 | @@ -2594,6 +2652,9 @@ static const struct pci_device_id azx_ids[] = { |
2420 | /* AMD Hudson */ |
2421 | { PCI_DEVICE(0x1022, 0x780d), |
2422 | .driver_data = AZX_DRIVER_GENERIC | AZX_DCAPS_PRESET_ATI_SB }, |
2423 | + /* AMD, X370 & co */ |
2424 | + { PCI_DEVICE(0x1022, 0x1457), |
2425 | + .driver_data = AZX_DRIVER_GENERIC | AZX_DCAPS_PRESET_AMD_SB }, |
2426 | /* AMD Stoney */ |
2427 | { PCI_DEVICE(0x1022, 0x157a), |
2428 | .driver_data = AZX_DRIVER_GENERIC | AZX_DCAPS_PRESET_ATI_SB | |
2429 | diff --git a/sound/sound_core.c b/sound/sound_core.c |
2430 | index 40ad000c2e3c..dd64c4b19f23 100644 |
2431 | --- a/sound/sound_core.c |
2432 | +++ b/sound/sound_core.c |
2433 | @@ -280,7 +280,8 @@ retry: |
2434 | goto retry; |
2435 | } |
2436 | spin_unlock(&sound_loader_lock); |
2437 | - return -EBUSY; |
2438 | + r = -EBUSY; |
2439 | + goto fail; |
2440 | } |
2441 | } |
2442 | |
2443 | diff --git a/sound/usb/hiface/pcm.c b/sound/usb/hiface/pcm.c |
2444 | index e1fbb9cc9ea7..a197fc3b9ab0 100644 |
2445 | --- a/sound/usb/hiface/pcm.c |
2446 | +++ b/sound/usb/hiface/pcm.c |
2447 | @@ -604,14 +604,13 @@ int hiface_pcm_init(struct hiface_chip *chip, u8 extra_freq) |
2448 | ret = hiface_pcm_init_urb(&rt->out_urbs[i], chip, OUT_EP, |
2449 | hiface_pcm_out_urb_handler); |
2450 | if (ret < 0) |
2451 | - return ret; |
2452 | + goto error; |
2453 | } |
2454 | |
2455 | ret = snd_pcm_new(chip->card, "USB-SPDIF Audio", 0, 1, 0, &pcm); |
2456 | if (ret < 0) { |
2457 | - kfree(rt); |
2458 | dev_err(&chip->dev->dev, "Cannot create pcm instance\n"); |
2459 | - return ret; |
2460 | + goto error; |
2461 | } |
2462 | |
2463 | pcm->private_data = rt; |
2464 | @@ -624,4 +623,10 @@ int hiface_pcm_init(struct hiface_chip *chip, u8 extra_freq) |
2465 | |
2466 | chip->pcm = rt; |
2467 | return 0; |
2468 | + |
2469 | +error: |
2470 | + for (i = 0; i < PCM_N_URBS; i++) |
2471 | + kfree(rt->out_urbs[i].buffer); |
2472 | + kfree(rt); |
2473 | + return ret; |
2474 | } |
2475 | diff --git a/sound/usb/stream.c b/sound/usb/stream.c |
2476 | index d9e3de495c16..bc582202bd10 100644 |
2477 | --- a/sound/usb/stream.c |
2478 | +++ b/sound/usb/stream.c |
2479 | @@ -1053,6 +1053,7 @@ found_clock: |
2480 | |
2481 | pd = kzalloc(sizeof(*pd), GFP_KERNEL); |
2482 | if (!pd) { |
2483 | + kfree(fp->chmap); |
2484 | kfree(fp->rate_table); |
2485 | kfree(fp); |
2486 | return NULL; |
2487 | diff --git a/tools/perf/arch/s390/util/machine.c b/tools/perf/arch/s390/util/machine.c |
2488 | index a19690a17291..c8c86a0c9b79 100644 |
2489 | --- a/tools/perf/arch/s390/util/machine.c |
2490 | +++ b/tools/perf/arch/s390/util/machine.c |
2491 | @@ -6,8 +6,9 @@ |
2492 | #include "machine.h" |
2493 | #include "api/fs/fs.h" |
2494 | #include "debug.h" |
2495 | +#include "symbol.h" |
2496 | |
2497 | -int arch__fix_module_text_start(u64 *start, const char *name) |
2498 | +int arch__fix_module_text_start(u64 *start, u64 *size, const char *name) |
2499 | { |
2500 | u64 m_start = *start; |
2501 | char path[PATH_MAX]; |
2502 | @@ -17,7 +18,35 @@ int arch__fix_module_text_start(u64 *start, const char *name) |
2503 | if (sysfs__read_ull(path, (unsigned long long *)start) < 0) { |
2504 | pr_debug2("Using module %s start:%#lx\n", path, m_start); |
2505 | *start = m_start; |
2506 | + } else { |
2507 | + /* Successful read of the modules segment text start address. |
2508 | + * Calculate difference between module start address |
2509 | + * in memory and module text segment start address. |
2510 | + * For example module load address is 0x3ff8011b000 |
2511 | + * (from /proc/modules) and module text segment start |
2512 | + * address is 0x3ff8011b870 (from file above). |
2513 | + * |
2514 | + * Adjust the module size and subtract the GOT table |
2515 | + * size located at the beginning of the module. |
2516 | + */ |
2517 | + *size -= (*start - m_start); |
2518 | } |
2519 | |
2520 | return 0; |
2521 | } |
2522 | + |
2523 | +/* On s390 kernel text segment start is located at very low memory addresses, |
2524 | + * for example 0x10000. Modules are located at very high memory addresses, |
2525 | + * for example 0x3ff xxxx xxxx. The gap between end of kernel text segment |
2526 | + * and beginning of first module's text segment is very big. |
2527 | + * Therefore do not fill this gap and do not assign it to the kernel dso map. |
2528 | + */ |
2529 | +void arch__symbols__fixup_end(struct symbol *p, struct symbol *c) |
2530 | +{ |
2531 | + if (strchr(p->name, '[') == NULL && strchr(c->name, '[')) |
2532 | + /* Last kernel symbol mapped to end of page */ |
2533 | + p->end = roundup(p->end, page_size); |
2534 | + else |
2535 | + p->end = c->start; |
2536 | + pr_debug4("%s sym:%s end:%#lx\n", __func__, p->name, p->end); |
2537 | +} |
2538 | diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c |
2539 | index 99de91698de1..0bdb34fee9d8 100644 |
2540 | --- a/tools/perf/builtin-probe.c |
2541 | +++ b/tools/perf/builtin-probe.c |
2542 | @@ -711,6 +711,16 @@ __cmd_probe(int argc, const char **argv) |
2543 | |
2544 | ret = perf_add_probe_events(params.events, params.nevents); |
2545 | if (ret < 0) { |
2546 | + |
2547 | + /* |
2548 | + * When perf_add_probe_events() fails it calls |
2549 | + * cleanup_perf_probe_events(pevs, npevs), i.e. |
2550 | + * cleanup_perf_probe_events(params.events, params.nevents), which |
2551 | + * will call clear_perf_probe_event(), so set nevents to zero |
2552 | + * to avoid cleanup_params() to call clear_perf_probe_event() again |
2553 | + * on the same pevs. |
2554 | + */ |
2555 | + params.nevents = 0; |
2556 | pr_err_with_code(" Error: Failed to add events.", ret); |
2557 | return ret; |
2558 | } |
2559 | diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c |
2560 | index 7f2e3b1c746c..a94bd6850a0b 100644 |
2561 | --- a/tools/perf/util/header.c |
2562 | +++ b/tools/perf/util/header.c |
2563 | @@ -3472,7 +3472,7 @@ int perf_event__process_feature(struct perf_tool *tool, |
2564 | return 0; |
2565 | |
2566 | ff.buf = (void *)fe->data; |
2567 | - ff.size = event->header.size - sizeof(event->header); |
2568 | + ff.size = event->header.size - sizeof(*fe); |
2569 | ff.ph = &session->header; |
2570 | |
2571 | if (feat_ops[feat].process(&ff, NULL)) |
2572 | diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c |
2573 | index 076718a7b3ea..003b70daf0bf 100644 |
2574 | --- a/tools/perf/util/machine.c |
2575 | +++ b/tools/perf/util/machine.c |
2576 | @@ -1295,6 +1295,7 @@ static int machine__set_modules_path(struct machine *machine) |
2577 | return map_groups__set_modules_path_dir(&machine->kmaps, modules_path, 0); |
2578 | } |
2579 | int __weak arch__fix_module_text_start(u64 *start __maybe_unused, |
2580 | + u64 *size __maybe_unused, |
2581 | const char *name __maybe_unused) |
2582 | { |
2583 | return 0; |
2584 | @@ -1306,7 +1307,7 @@ static int machine__create_module(void *arg, const char *name, u64 start, |
2585 | struct machine *machine = arg; |
2586 | struct map *map; |
2587 | |
2588 | - if (arch__fix_module_text_start(&start, name) < 0) |
2589 | + if (arch__fix_module_text_start(&start, &size, name) < 0) |
2590 | return -1; |
2591 | |
2592 | map = machine__findnew_module_map(machine, start, name); |
2593 | diff --git a/tools/perf/util/machine.h b/tools/perf/util/machine.h |
2594 | index ebde3ea70225..6f3767808bd9 100644 |
2595 | --- a/tools/perf/util/machine.h |
2596 | +++ b/tools/perf/util/machine.h |
2597 | @@ -219,7 +219,7 @@ struct symbol *machine__find_kernel_symbol_by_name(struct machine *machine, |
2598 | |
2599 | struct map *machine__findnew_module_map(struct machine *machine, u64 start, |
2600 | const char *filename); |
2601 | -int arch__fix_module_text_start(u64 *start, const char *name); |
2602 | +int arch__fix_module_text_start(u64 *start, u64 *size, const char *name); |
2603 | |
2604 | int machine__load_kallsyms(struct machine *machine, const char *filename); |
2605 | |
2606 | diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c |
2607 | index 0715f972a275..91404bacc3df 100644 |
2608 | --- a/tools/perf/util/symbol.c |
2609 | +++ b/tools/perf/util/symbol.c |
2610 | @@ -86,6 +86,11 @@ static int prefix_underscores_count(const char *str) |
2611 | return tail - str; |
2612 | } |
2613 | |
2614 | +void __weak arch__symbols__fixup_end(struct symbol *p, struct symbol *c) |
2615 | +{ |
2616 | + p->end = c->start; |
2617 | +} |
2618 | + |
2619 | const char * __weak arch__normalize_symbol_name(const char *name) |
2620 | { |
2621 | return name; |
2622 | @@ -212,7 +217,7 @@ void symbols__fixup_end(struct rb_root *symbols) |
2623 | curr = rb_entry(nd, struct symbol, rb_node); |
2624 | |
2625 | if (prev->end == prev->start && prev->end != curr->start) |
2626 | - prev->end = curr->start; |
2627 | + arch__symbols__fixup_end(prev, curr); |
2628 | } |
2629 | |
2630 | /* Last entry */ |
2631 | diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h |
2632 | index f25fae4b5743..76ef2facd934 100644 |
2633 | --- a/tools/perf/util/symbol.h |
2634 | +++ b/tools/perf/util/symbol.h |
2635 | @@ -349,6 +349,7 @@ const char *arch__normalize_symbol_name(const char *name); |
2636 | #define SYMBOL_A 0 |
2637 | #define SYMBOL_B 1 |
2638 | |
2639 | +void arch__symbols__fixup_end(struct symbol *p, struct symbol *c); |
2640 | int arch__compare_symbol_names(const char *namea, const char *nameb); |
2641 | int arch__compare_symbol_names_n(const char *namea, const char *nameb, |
2642 | unsigned int n); |
2643 | diff --git a/tools/perf/util/thread.c b/tools/perf/util/thread.c |
2644 | index 56007a7e0b4d..2c146d0c217b 100644 |
2645 | --- a/tools/perf/util/thread.c |
2646 | +++ b/tools/perf/util/thread.c |
2647 | @@ -192,14 +192,24 @@ struct comm *thread__comm(const struct thread *thread) |
2648 | |
2649 | struct comm *thread__exec_comm(const struct thread *thread) |
2650 | { |
2651 | - struct comm *comm, *last = NULL; |
2652 | + struct comm *comm, *last = NULL, *second_last = NULL; |
2653 | |
2654 | list_for_each_entry(comm, &thread->comm_list, list) { |
2655 | if (comm->exec) |
2656 | return comm; |
2657 | + second_last = last; |
2658 | last = comm; |
2659 | } |
2660 | |
2661 | + /* |
2662 | + * 'last' with no start time might be the parent's comm of a synthesized |
2663 | + * thread (created by processing a synthesized fork event). For a main |
2664 | + * thread, that is very probably wrong. Prefer a later comm to avoid |
2665 | + * that case. |
2666 | + */ |
2667 | + if (second_last && !last->start && thread->pid_ == thread->tid) |
2668 | + return second_last; |
2669 | + |
2670 | return last; |
2671 | } |
2672 | |
2673 | diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c |
2674 | index 2b36a51afb57..4a584a575221 100644 |
2675 | --- a/virt/kvm/kvm_main.c |
2676 | +++ b/virt/kvm/kvm_main.c |
2677 | @@ -2317,6 +2317,29 @@ static bool kvm_vcpu_eligible_for_directed_yield(struct kvm_vcpu *vcpu) |
2678 | #endif |
2679 | } |
2680 | |
2681 | +/* |
2682 | + * Unlike kvm_arch_vcpu_runnable, this function is called outside |
2683 | + * a vcpu_load/vcpu_put pair. However, for most architectures |
2684 | + * kvm_arch_vcpu_runnable does not require vcpu_load. |
2685 | + */ |
2686 | +bool __weak kvm_arch_dy_runnable(struct kvm_vcpu *vcpu) |
2687 | +{ |
2688 | + return kvm_arch_vcpu_runnable(vcpu); |
2689 | +} |
2690 | + |
2691 | +static bool vcpu_dy_runnable(struct kvm_vcpu *vcpu) |
2692 | +{ |
2693 | + if (kvm_arch_dy_runnable(vcpu)) |
2694 | + return true; |
2695 | + |
2696 | +#ifdef CONFIG_KVM_ASYNC_PF |
2697 | + if (!list_empty_careful(&vcpu->async_pf.done)) |
2698 | + return true; |
2699 | +#endif |
2700 | + |
2701 | + return false; |
2702 | +} |
2703 | + |
2704 | void kvm_vcpu_on_spin(struct kvm_vcpu *me, bool yield_to_kernel_mode) |
2705 | { |
2706 | struct kvm *kvm = me->kvm; |
2707 | @@ -2346,7 +2369,7 @@ void kvm_vcpu_on_spin(struct kvm_vcpu *me, bool yield_to_kernel_mode) |
2708 | continue; |
2709 | if (vcpu == me) |
2710 | continue; |
2711 | - if (swait_active(&vcpu->wq) && !kvm_arch_vcpu_runnable(vcpu)) |
2712 | + if (swait_active(&vcpu->wq) && !vcpu_dy_runnable(vcpu)) |
2713 | continue; |
2714 | if (yield_to_kernel_mode && !kvm_arch_vcpu_in_kernel(vcpu)) |
2715 | continue; |