Magellan Linux

Annotation of /trunk/kernel-magellan/patches-4.15/0106-4.15.7-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3090 - (hide annotations) (download)
Wed Mar 21 14:52:38 2018 UTC (6 years, 2 months ago) by niro
File size: 68791 byte(s)
-linux-4.15.7
1 niro 3090 diff --git a/Makefile b/Makefile
2     index 51563c76bdf6..49f524444050 100644
3     --- a/Makefile
4     +++ b/Makefile
5     @@ -1,7 +1,7 @@
6     # SPDX-License-Identifier: GPL-2.0
7     VERSION = 4
8     PATCHLEVEL = 15
9     -SUBLEVEL = 6
10     +SUBLEVEL = 7
11     EXTRAVERSION =
12     NAME = Fearless Coyote
13    
14     diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c
15     index 46dee071bab1..1bcf03b5cd04 100644
16     --- a/arch/arm64/kernel/cpufeature.c
17     +++ b/arch/arm64/kernel/cpufeature.c
18     @@ -197,9 +197,11 @@ static const struct arm64_ftr_bits ftr_id_aa64mmfr2[] = {
19     };
20    
21     static const struct arm64_ftr_bits ftr_ctr[] = {
22     - ARM64_FTR_BITS(FTR_VISIBLE, FTR_STRICT, FTR_EXACT, 31, 1, 1), /* RAO */
23     + ARM64_FTR_BITS(FTR_VISIBLE, FTR_STRICT, FTR_EXACT, 31, 1, 1), /* RES1 */
24     + ARM64_FTR_BITS(FTR_VISIBLE, FTR_STRICT, FTR_LOWER_SAFE, 29, 1, 1), /* DIC */
25     + ARM64_FTR_BITS(FTR_VISIBLE, FTR_STRICT, FTR_LOWER_SAFE, 28, 1, 1), /* IDC */
26     ARM64_FTR_BITS(FTR_VISIBLE, FTR_STRICT, FTR_HIGHER_SAFE, 24, 4, 0), /* CWG */
27     - ARM64_FTR_BITS(FTR_VISIBLE, FTR_STRICT, FTR_LOWER_SAFE, 20, 4, 0), /* ERG */
28     + ARM64_FTR_BITS(FTR_VISIBLE, FTR_STRICT, FTR_HIGHER_SAFE, 20, 4, 0), /* ERG */
29     ARM64_FTR_BITS(FTR_VISIBLE, FTR_STRICT, FTR_LOWER_SAFE, 16, 4, 1), /* DminLine */
30     /*
31     * Linux can handle differing I-cache policies. Userspace JITs will
32     diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c
33     index 583fd8154695..d6ca5fccb229 100644
34     --- a/arch/arm64/kernel/process.c
35     +++ b/arch/arm64/kernel/process.c
36     @@ -221,8 +221,15 @@ void __show_regs(struct pt_regs *regs)
37    
38     show_regs_print_info(KERN_DEFAULT);
39     print_pstate(regs);
40     - print_symbol("pc : %s\n", regs->pc);
41     - print_symbol("lr : %s\n", lr);
42     +
43     + if (!user_mode(regs)) {
44     + print_symbol("pc : %s\n", regs->pc);
45     + print_symbol("lr : %s\n", lr);
46     + } else {
47     + printk("pc : %016llx\n", regs->pc);
48     + printk("lr : %016llx\n", lr);
49     + }
50     +
51     printk("sp : %016llx\n", sp);
52    
53     i = top_reg;
54     diff --git a/arch/arm64/kernel/traps.c b/arch/arm64/kernel/traps.c
55     index 3d3588fcd1c7..c759d9ca0e5a 100644
56     --- a/arch/arm64/kernel/traps.c
57     +++ b/arch/arm64/kernel/traps.c
58     @@ -57,7 +57,7 @@ static const char *handler[]= {
59     "Error"
60     };
61    
62     -int show_unhandled_signals = 1;
63     +int show_unhandled_signals = 0;
64    
65     static void dump_backtrace_entry(unsigned long where)
66     {
67     @@ -526,14 +526,6 @@ asmlinkage long do_ni_syscall(struct pt_regs *regs)
68     }
69     #endif
70    
71     - if (show_unhandled_signals_ratelimited()) {
72     - pr_info("%s[%d]: syscall %d\n", current->comm,
73     - task_pid_nr(current), regs->syscallno);
74     - dump_instr("", regs);
75     - if (user_mode(regs))
76     - __show_regs(regs);
77     - }
78     -
79     return sys_ni_syscall();
80     }
81    
82     diff --git a/arch/arm64/mm/proc.S b/arch/arm64/mm/proc.S
83     index 248f2e7b24ab..a233975848cc 100644
84     --- a/arch/arm64/mm/proc.S
85     +++ b/arch/arm64/mm/proc.S
86     @@ -155,7 +155,7 @@ ENDPROC(cpu_do_switch_mm)
87    
88     .macro __idmap_cpu_set_reserved_ttbr1, tmp1, tmp2
89     adrp \tmp1, empty_zero_page
90     - msr ttbr1_el1, \tmp2
91     + msr ttbr1_el1, \tmp1
92     isb
93     tlbi vmalle1
94     dsb nsh
95     diff --git a/arch/microblaze/Makefile b/arch/microblaze/Makefile
96     index 830ee7d42fa0..d269dd4b8279 100644
97     --- a/arch/microblaze/Makefile
98     +++ b/arch/microblaze/Makefile
99     @@ -36,16 +36,21 @@ endif
100     CPUFLAGS-$(CONFIG_XILINX_MICROBLAZE0_USE_DIV) += -mno-xl-soft-div
101     CPUFLAGS-$(CONFIG_XILINX_MICROBLAZE0_USE_BARREL) += -mxl-barrel-shift
102     CPUFLAGS-$(CONFIG_XILINX_MICROBLAZE0_USE_PCMP_INSTR) += -mxl-pattern-compare
103     -CPUFLAGS-$(CONFIG_BIG_ENDIAN) += -mbig-endian
104     -CPUFLAGS-$(CONFIG_LITTLE_ENDIAN) += -mlittle-endian
105     +
106     +ifdef CONFIG_CPU_BIG_ENDIAN
107     +KBUILD_CFLAGS += -mbig-endian
108     +KBUILD_AFLAGS += -mbig-endian
109     +LD += -EB
110     +else
111     +KBUILD_CFLAGS += -mlittle-endian
112     +KBUILD_AFLAGS += -mlittle-endian
113     +LD += -EL
114     +endif
115    
116     CPUFLAGS-1 += $(call cc-option,-mcpu=v$(CPU_VER))
117    
118     # r31 holds current when in kernel mode
119     -KBUILD_CFLAGS += -ffixed-r31 $(CPUFLAGS-1) $(CPUFLAGS-2)
120     -
121     -LDFLAGS :=
122     -LDFLAGS_vmlinux :=
123     +KBUILD_CFLAGS += -ffixed-r31 $(CPUFLAGS-y) $(CPUFLAGS-1) $(CPUFLAGS-2)
124    
125     head-y := arch/microblaze/kernel/head.o
126     libs-y += arch/microblaze/lib/
127     diff --git a/arch/mips/boot/Makefile b/arch/mips/boot/Makefile
128     index 1bd5c4f00d19..c22da16d67b8 100644
129     --- a/arch/mips/boot/Makefile
130     +++ b/arch/mips/boot/Makefile
131     @@ -126,6 +126,7 @@ $(obj)/vmlinux.its.S: $(addprefix $(srctree)/arch/mips/$(PLATFORM)/,$(ITS_INPUTS
132    
133     quiet_cmd_cpp_its_S = ITS $@
134     cmd_cpp_its_S = $(CPP) $(cpp_flags) -P -C -o $@ $< \
135     + -D__ASSEMBLY__ \
136     -DKERNEL_NAME="\"Linux $(KERNELRELEASE)\"" \
137     -DVMLINUX_BINARY="\"$(3)\"" \
138     -DVMLINUX_COMPRESSION="\"$(2)\"" \
139     diff --git a/arch/mips/include/asm/compat.h b/arch/mips/include/asm/compat.h
140     index 49691331ada4..08ec0762ca50 100644
141     --- a/arch/mips/include/asm/compat.h
142     +++ b/arch/mips/include/asm/compat.h
143     @@ -86,7 +86,6 @@ struct compat_flock {
144     compat_off_t l_len;
145     s32 l_sysid;
146     compat_pid_t l_pid;
147     - short __unused;
148     s32 pad[4];
149     };
150    
151     diff --git a/arch/x86/kernel/apic/vector.c b/arch/x86/kernel/apic/vector.c
152     index 3cc471beb50b..bb6f7a2148d7 100644
153     --- a/arch/x86/kernel/apic/vector.c
154     +++ b/arch/x86/kernel/apic/vector.c
155     @@ -134,21 +134,40 @@ static void apic_update_vector(struct irq_data *irqd, unsigned int newvec,
156     {
157     struct apic_chip_data *apicd = apic_chip_data(irqd);
158     struct irq_desc *desc = irq_data_to_desc(irqd);
159     + bool managed = irqd_affinity_is_managed(irqd);
160    
161     lockdep_assert_held(&vector_lock);
162    
163     trace_vector_update(irqd->irq, newvec, newcpu, apicd->vector,
164     apicd->cpu);
165    
166     - /* Setup the vector move, if required */
167     - if (apicd->vector && cpu_online(apicd->cpu)) {
168     + /*
169     + * If there is no vector associated or if the associated vector is
170     + * the shutdown vector, which is associated to make PCI/MSI
171     + * shutdown mode work, then there is nothing to release. Clear out
172     + * prev_vector for this and the offlined target case.
173     + */
174     + apicd->prev_vector = 0;
175     + if (!apicd->vector || apicd->vector == MANAGED_IRQ_SHUTDOWN_VECTOR)
176     + goto setnew;
177     + /*
178     + * If the target CPU of the previous vector is online, then mark
179     + * the vector as move in progress and store it for cleanup when the
180     + * first interrupt on the new vector arrives. If the target CPU is
181     + * offline then the regular release mechanism via the cleanup
182     + * vector is not possible and the vector can be immediately freed
183     + * in the underlying matrix allocator.
184     + */
185     + if (cpu_online(apicd->cpu)) {
186     apicd->move_in_progress = true;
187     apicd->prev_vector = apicd->vector;
188     apicd->prev_cpu = apicd->cpu;
189     } else {
190     - apicd->prev_vector = 0;
191     + irq_matrix_free(vector_matrix, apicd->cpu, apicd->vector,
192     + managed);
193     }
194    
195     +setnew:
196     apicd->vector = newvec;
197     apicd->cpu = newcpu;
198     BUG_ON(!IS_ERR_OR_NULL(per_cpu(vector_irq, newcpu)[newvec]));
199     diff --git a/arch/x86/oprofile/nmi_int.c b/arch/x86/oprofile/nmi_int.c
200     index 174c59774cc9..a7a7677265b6 100644
201     --- a/arch/x86/oprofile/nmi_int.c
202     +++ b/arch/x86/oprofile/nmi_int.c
203     @@ -460,7 +460,7 @@ static int nmi_setup(void)
204     goto fail;
205    
206     for_each_possible_cpu(cpu) {
207     - if (!cpu)
208     + if (!IS_ENABLED(CONFIG_SMP) || !cpu)
209     continue;
210    
211     memcpy(per_cpu(cpu_msrs, cpu).counters,
212     diff --git a/arch/xtensa/mm/init.c b/arch/xtensa/mm/init.c
213     index 720fe4e8b497..8dad076661fc 100644
214     --- a/arch/xtensa/mm/init.c
215     +++ b/arch/xtensa/mm/init.c
216     @@ -79,19 +79,75 @@ void __init zones_init(void)
217     free_area_init_node(0, zones_size, ARCH_PFN_OFFSET, NULL);
218     }
219    
220     +#ifdef CONFIG_HIGHMEM
221     +static void __init free_area_high(unsigned long pfn, unsigned long end)
222     +{
223     + for (; pfn < end; pfn++)
224     + free_highmem_page(pfn_to_page(pfn));
225     +}
226     +
227     +static void __init free_highpages(void)
228     +{
229     + unsigned long max_low = max_low_pfn;
230     + struct memblock_region *mem, *res;
231     +
232     + reset_all_zones_managed_pages();
233     + /* set highmem page free */
234     + for_each_memblock(memory, mem) {
235     + unsigned long start = memblock_region_memory_base_pfn(mem);
236     + unsigned long end = memblock_region_memory_end_pfn(mem);
237     +
238     + /* Ignore complete lowmem entries */
239     + if (end <= max_low)
240     + continue;
241     +
242     + if (memblock_is_nomap(mem))
243     + continue;
244     +
245     + /* Truncate partial highmem entries */
246     + if (start < max_low)
247     + start = max_low;
248     +
249     + /* Find and exclude any reserved regions */
250     + for_each_memblock(reserved, res) {
251     + unsigned long res_start, res_end;
252     +
253     + res_start = memblock_region_reserved_base_pfn(res);
254     + res_end = memblock_region_reserved_end_pfn(res);
255     +
256     + if (res_end < start)
257     + continue;
258     + if (res_start < start)
259     + res_start = start;
260     + if (res_start > end)
261     + res_start = end;
262     + if (res_end > end)
263     + res_end = end;
264     + if (res_start != start)
265     + free_area_high(start, res_start);
266     + start = res_end;
267     + if (start == end)
268     + break;
269     + }
270     +
271     + /* And now free anything which remains */
272     + if (start < end)
273     + free_area_high(start, end);
274     + }
275     +}
276     +#else
277     +static void __init free_highpages(void)
278     +{
279     +}
280     +#endif
281     +
282     /*
283     * Initialize memory pages.
284     */
285    
286     void __init mem_init(void)
287     {
288     -#ifdef CONFIG_HIGHMEM
289     - unsigned long tmp;
290     -
291     - reset_all_zones_managed_pages();
292     - for (tmp = max_low_pfn; tmp < max_pfn; tmp++)
293     - free_highmem_page(pfn_to_page(tmp));
294     -#endif
295     + free_highpages();
296    
297     max_mapnr = max_pfn - ARCH_PFN_OFFSET;
298     high_memory = (void *)__va(max_low_pfn << PAGE_SHIFT);
299     diff --git a/crypto/asymmetric_keys/pkcs7_verify.c b/crypto/asymmetric_keys/pkcs7_verify.c
300     index 39e6de0c2761..97c77f66b20d 100644
301     --- a/crypto/asymmetric_keys/pkcs7_verify.c
302     +++ b/crypto/asymmetric_keys/pkcs7_verify.c
303     @@ -270,7 +270,7 @@ static int pkcs7_verify_sig_chain(struct pkcs7_message *pkcs7,
304     sinfo->index);
305     return 0;
306     }
307     - ret = public_key_verify_signature(p->pub, p->sig);
308     + ret = public_key_verify_signature(p->pub, x509->sig);
309     if (ret < 0)
310     return ret;
311     x509->signer = p;
312     @@ -366,8 +366,7 @@ static int pkcs7_verify_one(struct pkcs7_message *pkcs7,
313     *
314     * (*) -EBADMSG if some part of the message was invalid, or:
315     *
316     - * (*) 0 if no signature chains were found to be blacklisted or to contain
317     - * unsupported crypto, or:
318     + * (*) 0 if a signature chain passed verification, or:
319     *
320     * (*) -EKEYREJECTED if a blacklisted key was encountered, or:
321     *
322     @@ -423,8 +422,11 @@ int pkcs7_verify(struct pkcs7_message *pkcs7,
323    
324     for (sinfo = pkcs7->signed_infos; sinfo; sinfo = sinfo->next) {
325     ret = pkcs7_verify_one(pkcs7, sinfo);
326     - if (sinfo->blacklisted && actual_ret == -ENOPKG)
327     - actual_ret = -EKEYREJECTED;
328     + if (sinfo->blacklisted) {
329     + if (actual_ret == -ENOPKG)
330     + actual_ret = -EKEYREJECTED;
331     + continue;
332     + }
333     if (ret < 0) {
334     if (ret == -ENOPKG) {
335     sinfo->unsupported_crypto = true;
336     diff --git a/crypto/asymmetric_keys/public_key.c b/crypto/asymmetric_keys/public_key.c
337     index de996586762a..e929fe1e4106 100644
338     --- a/crypto/asymmetric_keys/public_key.c
339     +++ b/crypto/asymmetric_keys/public_key.c
340     @@ -79,9 +79,11 @@ int public_key_verify_signature(const struct public_key *pkey,
341    
342     BUG_ON(!pkey);
343     BUG_ON(!sig);
344     - BUG_ON(!sig->digest);
345     BUG_ON(!sig->s);
346    
347     + if (!sig->digest)
348     + return -ENOPKG;
349     +
350     alg_name = sig->pkey_algo;
351     if (strcmp(sig->pkey_algo, "rsa") == 0) {
352     /* The data wangled by the RSA algorithm is typically padded
353     diff --git a/crypto/asymmetric_keys/restrict.c b/crypto/asymmetric_keys/restrict.c
354     index 86fb68508952..7c93c7728454 100644
355     --- a/crypto/asymmetric_keys/restrict.c
356     +++ b/crypto/asymmetric_keys/restrict.c
357     @@ -67,8 +67,9 @@ __setup("ca_keys=", ca_keys_setup);
358     *
359     * Returns 0 if the new certificate was accepted, -ENOKEY if we couldn't find a
360     * matching parent certificate in the trusted list, -EKEYREJECTED if the
361     - * signature check fails or the key is blacklisted and some other error if
362     - * there is a matching certificate but the signature check cannot be performed.
363     + * signature check fails or the key is blacklisted, -ENOPKG if the signature
364     + * uses unsupported crypto, or some other error if there is a matching
365     + * certificate but the signature check cannot be performed.
366     */
367     int restrict_link_by_signature(struct key *dest_keyring,
368     const struct key_type *type,
369     @@ -88,6 +89,8 @@ int restrict_link_by_signature(struct key *dest_keyring,
370     return -EOPNOTSUPP;
371    
372     sig = payload->data[asym_auth];
373     + if (!sig)
374     + return -ENOPKG;
375     if (!sig->auth_ids[0] && !sig->auth_ids[1])
376     return -ENOKEY;
377    
378     @@ -139,6 +142,8 @@ static int key_or_keyring_common(struct key *dest_keyring,
379     return -EOPNOTSUPP;
380    
381     sig = payload->data[asym_auth];
382     + if (!sig)
383     + return -ENOPKG;
384     if (!sig->auth_ids[0] && !sig->auth_ids[1])
385     return -ENOKEY;
386    
387     @@ -222,9 +227,9 @@ static int key_or_keyring_common(struct key *dest_keyring,
388     *
389     * Returns 0 if the new certificate was accepted, -ENOKEY if we
390     * couldn't find a matching parent certificate in the trusted list,
391     - * -EKEYREJECTED if the signature check fails, and some other error if
392     - * there is a matching certificate but the signature check cannot be
393     - * performed.
394     + * -EKEYREJECTED if the signature check fails, -ENOPKG if the signature uses
395     + * unsupported crypto, or some other error if there is a matching certificate
396     + * but the signature check cannot be performed.
397     */
398     int restrict_link_by_key_or_keyring(struct key *dest_keyring,
399     const struct key_type *type,
400     @@ -249,9 +254,9 @@ int restrict_link_by_key_or_keyring(struct key *dest_keyring,
401     *
402     * Returns 0 if the new certificate was accepted, -ENOKEY if we
403     * couldn't find a matching parent certificate in the trusted list,
404     - * -EKEYREJECTED if the signature check fails, and some other error if
405     - * there is a matching certificate but the signature check cannot be
406     - * performed.
407     + * -EKEYREJECTED if the signature check fails, -ENOPKG if the signature uses
408     + * unsupported crypto, or some other error if there is a matching certificate
409     + * but the signature check cannot be performed.
410     */
411     int restrict_link_by_key_or_keyring_chain(struct key *dest_keyring,
412     const struct key_type *type,
413     diff --git a/drivers/extcon/extcon-intel-int3496.c b/drivers/extcon/extcon-intel-int3496.c
414     index c8691b5a9cb0..191e99f06a9a 100644
415     --- a/drivers/extcon/extcon-intel-int3496.c
416     +++ b/drivers/extcon/extcon-intel-int3496.c
417     @@ -153,8 +153,9 @@ static int int3496_probe(struct platform_device *pdev)
418     return ret;
419     }
420    
421     - /* queue initial processing of id-pin */
422     + /* process id-pin so that we start with the right status */
423     queue_delayed_work(system_wq, &data->work, 0);
424     + flush_delayed_work(&data->work);
425    
426     platform_set_drvdata(pdev, data);
427    
428     diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c
429     index c13c51af0b68..c53095b3b0fb 100644
430     --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c
431     +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c
432     @@ -14,6 +14,16 @@
433    
434     #include "amd_acpi.h"
435    
436     +#define AMDGPU_PX_QUIRK_FORCE_ATPX (1 << 0)
437     +
438     +struct amdgpu_px_quirk {
439     + u32 chip_vendor;
440     + u32 chip_device;
441     + u32 subsys_vendor;
442     + u32 subsys_device;
443     + u32 px_quirk_flags;
444     +};
445     +
446     struct amdgpu_atpx_functions {
447     bool px_params;
448     bool power_cntl;
449     @@ -35,6 +45,7 @@ struct amdgpu_atpx {
450     static struct amdgpu_atpx_priv {
451     bool atpx_detected;
452     bool bridge_pm_usable;
453     + unsigned int quirks;
454     /* handle for device - and atpx */
455     acpi_handle dhandle;
456     acpi_handle other_handle;
457     @@ -205,13 +216,19 @@ static int amdgpu_atpx_validate(struct amdgpu_atpx *atpx)
458    
459     atpx->is_hybrid = false;
460     if (valid_bits & ATPX_MS_HYBRID_GFX_SUPPORTED) {
461     - printk("ATPX Hybrid Graphics\n");
462     - /*
463     - * Disable legacy PM methods only when pcie port PM is usable,
464     - * otherwise the device might fail to power off or power on.
465     - */
466     - atpx->functions.power_cntl = !amdgpu_atpx_priv.bridge_pm_usable;
467     - atpx->is_hybrid = true;
468     + if (amdgpu_atpx_priv.quirks & AMDGPU_PX_QUIRK_FORCE_ATPX) {
469     + printk("ATPX Hybrid Graphics, forcing to ATPX\n");
470     + atpx->functions.power_cntl = true;
471     + atpx->is_hybrid = false;
472     + } else {
473     + printk("ATPX Hybrid Graphics\n");
474     + /*
475     + * Disable legacy PM methods only when pcie port PM is usable,
476     + * otherwise the device might fail to power off or power on.
477     + */
478     + atpx->functions.power_cntl = !amdgpu_atpx_priv.bridge_pm_usable;
479     + atpx->is_hybrid = true;
480     + }
481     }
482    
483     atpx->dgpu_req_power_for_displays = false;
484     @@ -547,6 +564,31 @@ static const struct vga_switcheroo_handler amdgpu_atpx_handler = {
485     .get_client_id = amdgpu_atpx_get_client_id,
486     };
487    
488     +static const struct amdgpu_px_quirk amdgpu_px_quirk_list[] = {
489     + /* HG _PR3 doesn't seem to work on this A+A weston board */
490     + { 0x1002, 0x6900, 0x1002, 0x0124, AMDGPU_PX_QUIRK_FORCE_ATPX },
491     + { 0x1002, 0x6900, 0x1028, 0x0812, AMDGPU_PX_QUIRK_FORCE_ATPX },
492     + { 0x1002, 0x6900, 0x1028, 0x0813, AMDGPU_PX_QUIRK_FORCE_ATPX },
493     + { 0, 0, 0, 0, 0 },
494     +};
495     +
496     +static void amdgpu_atpx_get_quirks(struct pci_dev *pdev)
497     +{
498     + const struct amdgpu_px_quirk *p = amdgpu_px_quirk_list;
499     +
500     + /* Apply PX quirks */
501     + while (p && p->chip_device != 0) {
502     + if (pdev->vendor == p->chip_vendor &&
503     + pdev->device == p->chip_device &&
504     + pdev->subsystem_vendor == p->subsys_vendor &&
505     + pdev->subsystem_device == p->subsys_device) {
506     + amdgpu_atpx_priv.quirks |= p->px_quirk_flags;
507     + break;
508     + }
509     + ++p;
510     + }
511     +}
512     +
513     /**
514     * amdgpu_atpx_detect - detect whether we have PX
515     *
516     @@ -570,6 +612,7 @@ static bool amdgpu_atpx_detect(void)
517    
518     parent_pdev = pci_upstream_bridge(pdev);
519     d3_supported |= parent_pdev && parent_pdev->bridge_d3;
520     + amdgpu_atpx_get_quirks(pdev);
521     }
522    
523     while ((pdev = pci_get_class(PCI_CLASS_DISPLAY_OTHER << 8, pdev)) != NULL) {
524     @@ -579,6 +622,7 @@ static bool amdgpu_atpx_detect(void)
525    
526     parent_pdev = pci_upstream_bridge(pdev);
527     d3_supported |= parent_pdev && parent_pdev->bridge_d3;
528     + amdgpu_atpx_get_quirks(pdev);
529     }
530    
531     if (has_atpx && vga_count == 2) {
532     diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
533     index 57abf7abd7a9..b9cfcffbf80f 100644
534     --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
535     +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
536     @@ -865,8 +865,8 @@ static int amdgpu_cs_ib_vm_chunk(struct amdgpu_device *adev,
537     struct amdgpu_bo_va_mapping *m;
538     struct amdgpu_bo *aobj = NULL;
539     struct amdgpu_cs_chunk *chunk;
540     + uint64_t offset, va_start;
541     struct amdgpu_ib *ib;
542     - uint64_t offset;
543     uint8_t *kptr;
544    
545     chunk = &p->chunks[i];
546     @@ -876,14 +876,14 @@ static int amdgpu_cs_ib_vm_chunk(struct amdgpu_device *adev,
547     if (chunk->chunk_id != AMDGPU_CHUNK_ID_IB)
548     continue;
549    
550     - r = amdgpu_cs_find_mapping(p, chunk_ib->va_start,
551     - &aobj, &m);
552     + va_start = chunk_ib->va_start & AMDGPU_VA_HOLE_MASK;
553     + r = amdgpu_cs_find_mapping(p, va_start, &aobj, &m);
554     if (r) {
555     DRM_ERROR("IB va_start is invalid\n");
556     return r;
557     }
558    
559     - if ((chunk_ib->va_start + chunk_ib->ib_bytes) >
560     + if ((va_start + chunk_ib->ib_bytes) >
561     (m->last + 1) * AMDGPU_GPU_PAGE_SIZE) {
562     DRM_ERROR("IB va_start+ib_bytes is invalid\n");
563     return -EINVAL;
564     @@ -896,7 +896,7 @@ static int amdgpu_cs_ib_vm_chunk(struct amdgpu_device *adev,
565     }
566    
567     offset = m->start * AMDGPU_GPU_PAGE_SIZE;
568     - kptr += chunk_ib->va_start - offset;
569     + kptr += va_start - offset;
570    
571     memcpy(ib->ptr, kptr, chunk_ib->ib_bytes);
572     amdgpu_bo_kunmap(aobj);
573     diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
574     index 3573ecdb06ee..3288cbdd2df0 100644
575     --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
576     +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
577     @@ -2228,8 +2228,6 @@ int amdgpu_device_init(struct amdgpu_device *adev,
578     * ignore it */
579     vga_client_register(adev->pdev, adev, NULL, amdgpu_vga_set_decode);
580    
581     - if (amdgpu_runtime_pm == 1)
582     - runtime = true;
583     if (amdgpu_device_is_px(ddev))
584     runtime = true;
585     if (!pci_is_thunderbolt_attached(adev->pdev))
586     diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
587     index e87eedcc0da9..1eac7c3c687b 100644
588     --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
589     +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
590     @@ -563,6 +563,17 @@ int amdgpu_gem_va_ioctl(struct drm_device *dev, void *data,
591     return -EINVAL;
592     }
593    
594     + if (args->va_address >= AMDGPU_VA_HOLE_START &&
595     + args->va_address < AMDGPU_VA_HOLE_END) {
596     + dev_dbg(&dev->pdev->dev,
597     + "va_address 0x%LX is in VA hole 0x%LX-0x%LX\n",
598     + args->va_address, AMDGPU_VA_HOLE_START,
599     + AMDGPU_VA_HOLE_END);
600     + return -EINVAL;
601     + }
602     +
603     + args->va_address &= AMDGPU_VA_HOLE_MASK;
604     +
605     if ((args->flags & ~valid_flags) && (args->flags & ~prt_flags)) {
606     dev_err(&dev->pdev->dev, "invalid flags combination 0x%08X\n",
607     args->flags);
608     diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
609     index 720139e182a3..c8b7abf887ed 100644
610     --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
611     +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
612     @@ -586,7 +586,9 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file
613     if (amdgpu_sriov_vf(adev))
614     dev_info.ids_flags |= AMDGPU_IDS_FLAGS_PREEMPTION;
615     dev_info.virtual_address_offset = AMDGPU_VA_RESERVED_SIZE;
616     - dev_info.virtual_address_max = (uint64_t)adev->vm_manager.max_pfn * AMDGPU_GPU_PAGE_SIZE;
617     + dev_info.virtual_address_max =
618     + min(adev->vm_manager.max_pfn * AMDGPU_GPU_PAGE_SIZE,
619     + AMDGPU_VA_HOLE_START);
620     dev_info.virtual_address_alignment = max((int)PAGE_SIZE, AMDGPU_GPU_PAGE_SIZE);
621     dev_info.pte_fragment_size = (1 << adev->vm_manager.fragment_size) * AMDGPU_GPU_PAGE_SIZE;
622     dev_info.gart_page_size = AMDGPU_GPU_PAGE_SIZE;
623     diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h
624     index bae77353447b..aef9ae5cec51 100644
625     --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h
626     +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h
627     @@ -96,6 +96,19 @@ struct amdgpu_bo_list_entry;
628     /* hardcode that limit for now */
629     #define AMDGPU_VA_RESERVED_SIZE (8ULL << 20)
630    
631     +/* VA hole for 48bit addresses on Vega10 */
632     +#define AMDGPU_VA_HOLE_START 0x0000800000000000ULL
633     +#define AMDGPU_VA_HOLE_END 0xffff800000000000ULL
634     +
635     +/*
636     + * Hardware is programmed as if the hole doesn't exists with start and end
637     + * address values.
638     + *
639     + * This mask is used to remove the upper 16bits of the VA and so come up with
640     + * the linear addr value.
641     + */
642     +#define AMDGPU_VA_HOLE_MASK 0x0000ffffffffffffULL
643     +
644     /* max vmids dedicated for process */
645     #define AMDGPU_VM_MAX_RESERVED_VMID 1
646    
647     diff --git a/drivers/gpu/drm/amd/amdgpu/si_dpm.c b/drivers/gpu/drm/amd/amdgpu/si_dpm.c
648     index 51fd0c9a20a5..3af322adae76 100644
649     --- a/drivers/gpu/drm/amd/amdgpu/si_dpm.c
650     +++ b/drivers/gpu/drm/amd/amdgpu/si_dpm.c
651     @@ -3464,6 +3464,11 @@ static void si_apply_state_adjust_rules(struct amdgpu_device *adev,
652     (adev->pdev->device == 0x6667)) {
653     max_sclk = 75000;
654     }
655     + if ((adev->pdev->revision == 0xC3) ||
656     + (adev->pdev->device == 0x6665)) {
657     + max_sclk = 60000;
658     + max_mclk = 80000;
659     + }
660     } else if (adev->asic_type == CHIP_OLAND) {
661     if ((adev->pdev->revision == 0xC7) ||
662     (adev->pdev->revision == 0x80) ||
663     diff --git a/drivers/gpu/drm/amd/amdgpu/soc15.c b/drivers/gpu/drm/amd/amdgpu/soc15.c
664     index 4e67fe1e7955..40767fdb6cd3 100644
665     --- a/drivers/gpu/drm/amd/amdgpu/soc15.c
666     +++ b/drivers/gpu/drm/amd/amdgpu/soc15.c
667     @@ -659,8 +659,8 @@ static int soc15_common_early_init(void *handle)
668     AMD_CG_SUPPORT_MC_LS |
669     AMD_CG_SUPPORT_SDMA_MGCG |
670     AMD_CG_SUPPORT_SDMA_LS;
671     - adev->pg_flags = AMD_PG_SUPPORT_SDMA |
672     - AMD_PG_SUPPORT_MMHUB;
673     + adev->pg_flags = AMD_PG_SUPPORT_SDMA;
674     +
675     adev->external_rev_id = 0x1;
676     break;
677     default:
678     diff --git a/drivers/gpu/drm/amd/amdgpu/vi.c b/drivers/gpu/drm/amd/amdgpu/vi.c
679     index 3a4c2fa7e36d..d582964702ad 100644
680     --- a/drivers/gpu/drm/amd/amdgpu/vi.c
681     +++ b/drivers/gpu/drm/amd/amdgpu/vi.c
682     @@ -449,14 +449,19 @@ static bool vi_read_bios_from_rom(struct amdgpu_device *adev,
683    
684     static void vi_detect_hw_virtualization(struct amdgpu_device *adev)
685     {
686     - uint32_t reg = RREG32(mmBIF_IOV_FUNC_IDENTIFIER);
687     - /* bit0: 0 means pf and 1 means vf */
688     - /* bit31: 0 means disable IOV and 1 means enable */
689     - if (reg & 1)
690     - adev->virt.caps |= AMDGPU_SRIOV_CAPS_IS_VF;
691     -
692     - if (reg & 0x80000000)
693     - adev->virt.caps |= AMDGPU_SRIOV_CAPS_ENABLE_IOV;
694     + uint32_t reg = 0;
695     +
696     + if (adev->asic_type == CHIP_TONGA ||
697     + adev->asic_type == CHIP_FIJI) {
698     + reg = RREG32(mmBIF_IOV_FUNC_IDENTIFIER);
699     + /* bit0: 0 means pf and 1 means vf */
700     + /* bit31: 0 means disable IOV and 1 means enable */
701     + if (reg & 1)
702     + adev->virt.caps |= AMDGPU_SRIOV_CAPS_IS_VF;
703     +
704     + if (reg & 0x80000000)
705     + adev->virt.caps |= AMDGPU_SRIOV_CAPS_ENABLE_IOV;
706     + }
707    
708     if (reg == 0) {
709     if (is_virtual_machine()) /* passthrough mode exclus sr-iov mode */
710     diff --git a/drivers/gpu/drm/cirrus/cirrus_mode.c b/drivers/gpu/drm/cirrus/cirrus_mode.c
711     index cd23b1b28259..c91b9b054e3f 100644
712     --- a/drivers/gpu/drm/cirrus/cirrus_mode.c
713     +++ b/drivers/gpu/drm/cirrus/cirrus_mode.c
714     @@ -294,22 +294,7 @@ static void cirrus_crtc_prepare(struct drm_crtc *crtc)
715     {
716     }
717    
718     -/*
719     - * This is called after a mode is programmed. It should reverse anything done
720     - * by the prepare function
721     - */
722     -static void cirrus_crtc_commit(struct drm_crtc *crtc)
723     -{
724     -}
725     -
726     -/*
727     - * The core can pass us a set of gamma values to program. We actually only
728     - * use this for 8-bit mode so can't perform smooth fades on deeper modes,
729     - * but it's a requirement that we provide the function
730     - */
731     -static int cirrus_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green,
732     - u16 *blue, uint32_t size,
733     - struct drm_modeset_acquire_ctx *ctx)
734     +static void cirrus_crtc_load_lut(struct drm_crtc *crtc)
735     {
736     struct drm_device *dev = crtc->dev;
737     struct cirrus_device *cdev = dev->dev_private;
738     @@ -317,7 +302,7 @@ static int cirrus_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green,
739     int i;
740    
741     if (!crtc->enabled)
742     - return 0;
743     + return;
744    
745     r = crtc->gamma_store;
746     g = r + crtc->gamma_size;
747     @@ -330,6 +315,27 @@ static int cirrus_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green,
748     WREG8(PALETTE_DATA, *g++ >> 8);
749     WREG8(PALETTE_DATA, *b++ >> 8);
750     }
751     +}
752     +
753     +/*
754     + * This is called after a mode is programmed. It should reverse anything done
755     + * by the prepare function
756     + */
757     +static void cirrus_crtc_commit(struct drm_crtc *crtc)
758     +{
759     + cirrus_crtc_load_lut(crtc);
760     +}
761     +
762     +/*
763     + * The core can pass us a set of gamma values to program. We actually only
764     + * use this for 8-bit mode so can't perform smooth fades on deeper modes,
765     + * but it's a requirement that we provide the function
766     + */
767     +static int cirrus_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green,
768     + u16 *blue, uint32_t size,
769     + struct drm_modeset_acquire_ctx *ctx)
770     +{
771     + cirrus_crtc_load_lut(crtc);
772    
773     return 0;
774     }
775     diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
776     index b16f1d69a0bb..e8c249361d7e 100644
777     --- a/drivers/gpu/drm/drm_atomic_helper.c
778     +++ b/drivers/gpu/drm/drm_atomic_helper.c
779     @@ -1778,6 +1778,8 @@ int drm_atomic_helper_setup_commit(struct drm_atomic_state *state,
780     new_crtc_state->event->base.completion = &commit->flip_done;
781     new_crtc_state->event->base.completion_release = release_crtc_commit;
782     drm_crtc_commit_get(commit);
783     +
784     + commit->abort_completion = true;
785     }
786    
787     for_each_oldnew_connector_in_state(state, conn, old_conn_state, new_conn_state, i) {
788     @@ -3327,8 +3329,21 @@ EXPORT_SYMBOL(drm_atomic_helper_crtc_duplicate_state);
789     void __drm_atomic_helper_crtc_destroy_state(struct drm_crtc_state *state)
790     {
791     if (state->commit) {
792     + /*
793     + * In the event that a non-blocking commit returns
794     + * -ERESTARTSYS before the commit_tail work is queued, we will
795     + * have an extra reference to the commit object. Release it, if
796     + * the event has not been consumed by the worker.
797     + *
798     + * state->event may be freed, so we can't directly look at
799     + * state->event->base.completion.
800     + */
801     + if (state->event && state->commit->abort_completion)
802     + drm_crtc_commit_put(state->commit);
803     +
804     kfree(state->commit->event);
805     state->commit->event = NULL;
806     +
807     drm_crtc_commit_put(state->commit);
808     }
809    
810     diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
811     index cb487148359a..16fb76ba6509 100644
812     --- a/drivers/gpu/drm/drm_edid.c
813     +++ b/drivers/gpu/drm/drm_edid.c
814     @@ -113,6 +113,9 @@ static const struct edid_quirk {
815     /* AEO model 0 reports 8 bpc, but is a 6 bpc panel */
816     { "AEO", 0, EDID_QUIRK_FORCE_6BPC },
817    
818     + /* CPT panel of Asus UX303LA reports 8 bpc, but is a 6 bpc panel */
819     + { "CPT", 0x17df, EDID_QUIRK_FORCE_6BPC },
820     +
821     /* Belinea 10 15 55 */
822     { "MAX", 1516, EDID_QUIRK_PREFER_LARGE_60 },
823     { "MAX", 0x77e, EDID_QUIRK_PREFER_LARGE_60 },
824     diff --git a/drivers/gpu/drm/drm_mm.c b/drivers/gpu/drm/drm_mm.c
825     index c3c79ee6119e..edab571dbc90 100644
826     --- a/drivers/gpu/drm/drm_mm.c
827     +++ b/drivers/gpu/drm/drm_mm.c
828     @@ -836,9 +836,24 @@ struct drm_mm_node *drm_mm_scan_color_evict(struct drm_mm_scan *scan)
829     if (!mm->color_adjust)
830     return NULL;
831    
832     - hole = list_first_entry(&mm->hole_stack, typeof(*hole), hole_stack);
833     - hole_start = __drm_mm_hole_node_start(hole);
834     - hole_end = hole_start + hole->hole_size;
835     + /*
836     + * The hole found during scanning should ideally be the first element
837     + * in the hole_stack list, but due to side-effects in the driver it
838     + * may not be.
839     + */
840     + list_for_each_entry(hole, &mm->hole_stack, hole_stack) {
841     + hole_start = __drm_mm_hole_node_start(hole);
842     + hole_end = hole_start + hole->hole_size;
843     +
844     + if (hole_start <= scan->hit_start &&
845     + hole_end >= scan->hit_end)
846     + break;
847     + }
848     +
849     + /* We should only be called after we found the hole previously */
850     + DRM_MM_BUG_ON(&hole->hole_stack == &mm->hole_stack);
851     + if (unlikely(&hole->hole_stack == &mm->hole_stack))
852     + return NULL;
853    
854     DRM_MM_BUG_ON(hole_start > scan->hit_start);
855     DRM_MM_BUG_ON(hole_end < scan->hit_end);
856     diff --git a/drivers/gpu/drm/i915/intel_breadcrumbs.c b/drivers/gpu/drm/i915/intel_breadcrumbs.c
857     index bcbc7abe6693..5d0c6504efe8 100644
858     --- a/drivers/gpu/drm/i915/intel_breadcrumbs.c
859     +++ b/drivers/gpu/drm/i915/intel_breadcrumbs.c
860     @@ -552,29 +552,16 @@ void intel_engine_remove_wait(struct intel_engine_cs *engine,
861     spin_unlock_irq(&b->rb_lock);
862     }
863    
864     -static bool signal_valid(const struct drm_i915_gem_request *request)
865     -{
866     - return intel_wait_check_request(&request->signaling.wait, request);
867     -}
868     -
869     static bool signal_complete(const struct drm_i915_gem_request *request)
870     {
871     if (!request)
872     return false;
873    
874     - /* If another process served as the bottom-half it may have already
875     - * signalled that this wait is already completed.
876     - */
877     - if (intel_wait_complete(&request->signaling.wait))
878     - return signal_valid(request);
879     -
880     - /* Carefully check if the request is complete, giving time for the
881     + /*
882     + * Carefully check if the request is complete, giving time for the
883     * seqno to be visible or if the GPU hung.
884     */
885     - if (__i915_request_irq_complete(request))
886     - return true;
887     -
888     - return false;
889     + return __i915_request_irq_complete(request);
890     }
891    
892     static struct drm_i915_gem_request *to_signaler(struct rb_node *rb)
893     @@ -617,9 +604,13 @@ static int intel_breadcrumbs_signaler(void *arg)
894     request = i915_gem_request_get_rcu(request);
895     rcu_read_unlock();
896     if (signal_complete(request)) {
897     - local_bh_disable();
898     - dma_fence_signal(&request->fence);
899     - local_bh_enable(); /* kick start the tasklets */
900     + if (!test_bit(DMA_FENCE_FLAG_SIGNALED_BIT,
901     + &request->fence.flags)) {
902     + local_bh_disable();
903     + dma_fence_signal(&request->fence);
904     + GEM_BUG_ON(!i915_gem_request_completed(request));
905     + local_bh_enable(); /* kick start the tasklets */
906     + }
907    
908     spin_lock_irq(&b->rb_lock);
909    
910     diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
911     index b5f85d6f6bef..721633658544 100644
912     --- a/drivers/hid/hid-core.c
913     +++ b/drivers/hid/hid-core.c
914     @@ -2721,6 +2721,9 @@ static const struct hid_device_id hid_ignore_list[] = {
915     { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MICROCASSYTIME) },
916     { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MICROCASSYTEMPERATURE) },
917     { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MICROCASSYPH) },
918     + { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_POWERANALYSERCASSY) },
919     + { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_CONVERTERCONTROLLERCASSY) },
920     + { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MACHINETESTCASSY) },
921     { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_JWM) },
922     { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_DMMP) },
923     { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_UMIP) },
924     diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
925     index 5da3d6256d25..a0baa5ba5b84 100644
926     --- a/drivers/hid/hid-ids.h
927     +++ b/drivers/hid/hid-ids.h
928     @@ -641,6 +641,9 @@
929     #define USB_DEVICE_ID_LD_MICROCASSYTIME 0x1033
930     #define USB_DEVICE_ID_LD_MICROCASSYTEMPERATURE 0x1035
931     #define USB_DEVICE_ID_LD_MICROCASSYPH 0x1038
932     +#define USB_DEVICE_ID_LD_POWERANALYSERCASSY 0x1040
933     +#define USB_DEVICE_ID_LD_CONVERTERCONTROLLERCASSY 0x1042
934     +#define USB_DEVICE_ID_LD_MACHINETESTCASSY 0x1043
935     #define USB_DEVICE_ID_LD_JWM 0x1080
936     #define USB_DEVICE_ID_LD_DMMP 0x1081
937     #define USB_DEVICE_ID_LD_UMIP 0x1090
938     diff --git a/drivers/i2c/busses/i2c-bcm2835.c b/drivers/i2c/busses/i2c-bcm2835.c
939     index cd07a69e2e93..44deae78913e 100644
940     --- a/drivers/i2c/busses/i2c-bcm2835.c
941     +++ b/drivers/i2c/busses/i2c-bcm2835.c
942     @@ -50,6 +50,9 @@
943     #define BCM2835_I2C_S_CLKT BIT(9)
944     #define BCM2835_I2C_S_LEN BIT(10) /* Fake bit for SW error reporting */
945    
946     +#define BCM2835_I2C_FEDL_SHIFT 16
947     +#define BCM2835_I2C_REDL_SHIFT 0
948     +
949     #define BCM2835_I2C_CDIV_MIN 0x0002
950     #define BCM2835_I2C_CDIV_MAX 0xFFFE
951    
952     @@ -81,7 +84,7 @@ static inline u32 bcm2835_i2c_readl(struct bcm2835_i2c_dev *i2c_dev, u32 reg)
953    
954     static int bcm2835_i2c_set_divider(struct bcm2835_i2c_dev *i2c_dev)
955     {
956     - u32 divider;
957     + u32 divider, redl, fedl;
958    
959     divider = DIV_ROUND_UP(clk_get_rate(i2c_dev->clk),
960     i2c_dev->bus_clk_rate);
961     @@ -100,6 +103,22 @@ static int bcm2835_i2c_set_divider(struct bcm2835_i2c_dev *i2c_dev)
962    
963     bcm2835_i2c_writel(i2c_dev, BCM2835_I2C_DIV, divider);
964    
965     + /*
966     + * Number of core clocks to wait after falling edge before
967     + * outputting the next data bit. Note that both FEDL and REDL
968     + * can't be greater than CDIV/2.
969     + */
970     + fedl = max(divider / 16, 1u);
971     +
972     + /*
973     + * Number of core clocks to wait after rising edge before
974     + * sampling the next incoming data bit.
975     + */
976     + redl = max(divider / 4, 1u);
977     +
978     + bcm2835_i2c_writel(i2c_dev, BCM2835_I2C_DEL,
979     + (fedl << BCM2835_I2C_FEDL_SHIFT) |
980     + (redl << BCM2835_I2C_REDL_SHIFT));
981     return 0;
982     }
983    
984     diff --git a/drivers/i2c/busses/i2c-designware-master.c b/drivers/i2c/busses/i2c-designware-master.c
985     index 418c233075d3..13e849bf9aa0 100644
986     --- a/drivers/i2c/busses/i2c-designware-master.c
987     +++ b/drivers/i2c/busses/i2c-designware-master.c
988     @@ -207,7 +207,7 @@ static void i2c_dw_xfer_init(struct dw_i2c_dev *dev)
989     i2c_dw_disable_int(dev);
990    
991     /* Enable the adapter */
992     - __i2c_dw_enable(dev, true);
993     + __i2c_dw_enable_and_wait(dev, true);
994    
995     /* Clear and enable interrupts */
996     dw_readl(dev, DW_IC_CLR_INTR);
997     diff --git a/drivers/iio/adc/stm32-adc.c b/drivers/iio/adc/stm32-adc.c
998     index cecf1e5b244c..b61b52f43179 100644
999     --- a/drivers/iio/adc/stm32-adc.c
1000     +++ b/drivers/iio/adc/stm32-adc.c
1001     @@ -765,8 +765,6 @@ static int stm32h7_adc_enable(struct stm32_adc *adc)
1002     int ret;
1003     u32 val;
1004    
1005     - /* Clear ADRDY by writing one, then enable ADC */
1006     - stm32_adc_set_bits(adc, STM32H7_ADC_ISR, STM32H7_ADRDY);
1007     stm32_adc_set_bits(adc, STM32H7_ADC_CR, STM32H7_ADEN);
1008    
1009     /* Poll for ADRDY to be set (after adc startup time) */
1010     @@ -774,8 +772,11 @@ static int stm32h7_adc_enable(struct stm32_adc *adc)
1011     val & STM32H7_ADRDY,
1012     100, STM32_ADC_TIMEOUT_US);
1013     if (ret) {
1014     - stm32_adc_clr_bits(adc, STM32H7_ADC_CR, STM32H7_ADEN);
1015     + stm32_adc_set_bits(adc, STM32H7_ADC_CR, STM32H7_ADDIS);
1016     dev_err(&indio_dev->dev, "Failed to enable ADC\n");
1017     + } else {
1018     + /* Clear ADRDY by writing one */
1019     + stm32_adc_set_bits(adc, STM32H7_ADC_ISR, STM32H7_ADRDY);
1020     }
1021    
1022     return ret;
1023     diff --git a/drivers/iio/imu/adis_trigger.c b/drivers/iio/imu/adis_trigger.c
1024     index 0dd5a381be64..457372f36791 100644
1025     --- a/drivers/iio/imu/adis_trigger.c
1026     +++ b/drivers/iio/imu/adis_trigger.c
1027     @@ -46,6 +46,10 @@ int adis_probe_trigger(struct adis *adis, struct iio_dev *indio_dev)
1028     if (adis->trig == NULL)
1029     return -ENOMEM;
1030    
1031     + adis->trig->dev.parent = &adis->spi->dev;
1032     + adis->trig->ops = &adis_trigger_ops;
1033     + iio_trigger_set_drvdata(adis->trig, adis);
1034     +
1035     ret = request_irq(adis->spi->irq,
1036     &iio_trigger_generic_data_rdy_poll,
1037     IRQF_TRIGGER_RISING,
1038     @@ -54,9 +58,6 @@ int adis_probe_trigger(struct adis *adis, struct iio_dev *indio_dev)
1039     if (ret)
1040     goto error_free_trig;
1041    
1042     - adis->trig->dev.parent = &adis->spi->dev;
1043     - adis->trig->ops = &adis_trigger_ops;
1044     - iio_trigger_set_drvdata(adis->trig, adis);
1045     ret = iio_trigger_register(adis->trig);
1046    
1047     indio_dev->trig = iio_trigger_get(adis->trig);
1048     diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio/industrialio-buffer.c
1049     index d2b465140a6b..78482d456c3b 100644
1050     --- a/drivers/iio/industrialio-buffer.c
1051     +++ b/drivers/iio/industrialio-buffer.c
1052     @@ -175,7 +175,7 @@ unsigned int iio_buffer_poll(struct file *filp,
1053     struct iio_dev *indio_dev = filp->private_data;
1054     struct iio_buffer *rb = indio_dev->buffer;
1055    
1056     - if (!indio_dev->info)
1057     + if (!indio_dev->info || rb == NULL)
1058     return 0;
1059    
1060     poll_wait(filp, &rb->pollq, wait);
1061     diff --git a/drivers/iio/proximity/Kconfig b/drivers/iio/proximity/Kconfig
1062     index fcb1c4ba5e41..f726f9427602 100644
1063     --- a/drivers/iio/proximity/Kconfig
1064     +++ b/drivers/iio/proximity/Kconfig
1065     @@ -68,6 +68,8 @@ config SX9500
1066    
1067     config SRF08
1068     tristate "Devantech SRF02/SRF08/SRF10 ultrasonic ranger sensor"
1069     + select IIO_BUFFER
1070     + select IIO_TRIGGERED_BUFFER
1071     depends on I2C
1072     help
1073     Say Y here to build a driver for Devantech SRF02/SRF08/SRF10
1074     diff --git a/drivers/infiniband/core/rdma_core.c b/drivers/infiniband/core/rdma_core.c
1075     index 85b5ee4defa4..4e1f76730855 100644
1076     --- a/drivers/infiniband/core/rdma_core.c
1077     +++ b/drivers/infiniband/core/rdma_core.c
1078     @@ -196,7 +196,15 @@ static struct ib_uobject *lookup_get_idr_uobject(const struct uverbs_obj_type *t
1079     goto free;
1080     }
1081    
1082     - uverbs_uobject_get(uobj);
1083     + /*
1084     + * The idr_find is guaranteed to return a pointer to something that
1085     + * isn't freed yet, or NULL, as the free after idr_remove goes through
1086     + * kfree_rcu(). However the object may still have been released and
1087     + * kfree() could be called at any time.
1088     + */
1089     + if (!kref_get_unless_zero(&uobj->ref))
1090     + uobj = ERR_PTR(-ENOENT);
1091     +
1092     free:
1093     rcu_read_unlock();
1094     return uobj;
1095     diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c
1096     index 840b24096690..df127c8b9a9f 100644
1097     --- a/drivers/infiniband/core/uverbs_cmd.c
1098     +++ b/drivers/infiniband/core/uverbs_cmd.c
1099     @@ -560,9 +560,10 @@ ssize_t ib_uverbs_open_xrcd(struct ib_uverbs_file *file,
1100     if (f.file)
1101     fdput(f);
1102    
1103     + mutex_unlock(&file->device->xrcd_tree_mutex);
1104     +
1105     uobj_alloc_commit(&obj->uobject);
1106    
1107     - mutex_unlock(&file->device->xrcd_tree_mutex);
1108     return in_len;
1109    
1110     err_copy:
1111     @@ -601,10 +602,8 @@ ssize_t ib_uverbs_close_xrcd(struct ib_uverbs_file *file,
1112    
1113     uobj = uobj_get_write(uobj_get_type(xrcd), cmd.xrcd_handle,
1114     file->ucontext);
1115     - if (IS_ERR(uobj)) {
1116     - mutex_unlock(&file->device->xrcd_tree_mutex);
1117     + if (IS_ERR(uobj))
1118     return PTR_ERR(uobj);
1119     - }
1120    
1121     ret = uobj_remove_commit(uobj);
1122     return ret ?: in_len;
1123     @@ -1971,8 +1970,15 @@ static int modify_qp(struct ib_uverbs_file *file,
1124     goto release_qp;
1125     }
1126    
1127     + if ((cmd->base.attr_mask & IB_QP_AV) &&
1128     + !rdma_is_port_valid(qp->device, cmd->base.dest.port_num)) {
1129     + ret = -EINVAL;
1130     + goto release_qp;
1131     + }
1132     +
1133     if ((cmd->base.attr_mask & IB_QP_ALT_PATH) &&
1134     - !rdma_is_port_valid(qp->device, cmd->base.alt_port_num)) {
1135     + (!rdma_is_port_valid(qp->device, cmd->base.alt_port_num) ||
1136     + !rdma_is_port_valid(qp->device, cmd->base.alt_dest.port_num))) {
1137     ret = -EINVAL;
1138     goto release_qp;
1139     }
1140     diff --git a/drivers/infiniband/core/uverbs_main.c b/drivers/infiniband/core/uverbs_main.c
1141     index 381fd9c096ae..0804239e43f0 100644
1142     --- a/drivers/infiniband/core/uverbs_main.c
1143     +++ b/drivers/infiniband/core/uverbs_main.c
1144     @@ -648,12 +648,21 @@ static int verify_command_mask(struct ib_device *ib_dev, __u32 command)
1145     return -1;
1146     }
1147    
1148     +static bool verify_command_idx(u32 command, bool extended)
1149     +{
1150     + if (extended)
1151     + return command < ARRAY_SIZE(uverbs_ex_cmd_table);
1152     +
1153     + return command < ARRAY_SIZE(uverbs_cmd_table);
1154     +}
1155     +
1156     static ssize_t ib_uverbs_write(struct file *filp, const char __user *buf,
1157     size_t count, loff_t *pos)
1158     {
1159     struct ib_uverbs_file *file = filp->private_data;
1160     struct ib_device *ib_dev;
1161     struct ib_uverbs_cmd_hdr hdr;
1162     + bool extended_command;
1163     __u32 command;
1164     __u32 flags;
1165     int srcu_key;
1166     @@ -686,6 +695,15 @@ static ssize_t ib_uverbs_write(struct file *filp, const char __user *buf,
1167     }
1168    
1169     command = hdr.command & IB_USER_VERBS_CMD_COMMAND_MASK;
1170     + flags = (hdr.command &
1171     + IB_USER_VERBS_CMD_FLAGS_MASK) >> IB_USER_VERBS_CMD_FLAGS_SHIFT;
1172     +
1173     + extended_command = flags & IB_USER_VERBS_CMD_FLAG_EXTENDED;
1174     + if (!verify_command_idx(command, extended_command)) {
1175     + ret = -EINVAL;
1176     + goto out;
1177     + }
1178     +
1179     if (verify_command_mask(ib_dev, command)) {
1180     ret = -EOPNOTSUPP;
1181     goto out;
1182     @@ -697,12 +715,8 @@ static ssize_t ib_uverbs_write(struct file *filp, const char __user *buf,
1183     goto out;
1184     }
1185    
1186     - flags = (hdr.command &
1187     - IB_USER_VERBS_CMD_FLAGS_MASK) >> IB_USER_VERBS_CMD_FLAGS_SHIFT;
1188     -
1189     if (!flags) {
1190     - if (command >= ARRAY_SIZE(uverbs_cmd_table) ||
1191     - !uverbs_cmd_table[command]) {
1192     + if (!uverbs_cmd_table[command]) {
1193     ret = -EINVAL;
1194     goto out;
1195     }
1196     @@ -723,8 +737,7 @@ static ssize_t ib_uverbs_write(struct file *filp, const char __user *buf,
1197     struct ib_udata uhw;
1198     size_t written_count = count;
1199    
1200     - if (command >= ARRAY_SIZE(uverbs_ex_cmd_table) ||
1201     - !uverbs_ex_cmd_table[command]) {
1202     + if (!uverbs_ex_cmd_table[command]) {
1203     ret = -ENOSYS;
1204     goto out;
1205     }
1206     diff --git a/drivers/irqchip/irq-gic-v3.c b/drivers/irqchip/irq-gic-v3.c
1207     index b56c3e23f0af..980ae8e7df30 100644
1208     --- a/drivers/irqchip/irq-gic-v3.c
1209     +++ b/drivers/irqchip/irq-gic-v3.c
1210     @@ -688,7 +688,7 @@ static void gic_raise_softirq(const struct cpumask *mask, unsigned int irq)
1211     * Ensure that stores to Normal memory are visible to the
1212     * other CPUs before issuing the IPI.
1213     */
1214     - smp_wmb();
1215     + wmb();
1216    
1217     for_each_cpu(cpu, mask) {
1218     u64 cluster_id = MPIDR_TO_SGI_CLUSTER_ID(cpu_logical_map(cpu));
1219     diff --git a/drivers/irqchip/irq-mips-gic.c b/drivers/irqchip/irq-mips-gic.c
1220     index ef92a4d2038e..d32268cc1174 100644
1221     --- a/drivers/irqchip/irq-mips-gic.c
1222     +++ b/drivers/irqchip/irq-mips-gic.c
1223     @@ -424,8 +424,6 @@ static int gic_shared_irq_domain_map(struct irq_domain *d, unsigned int virq,
1224     spin_lock_irqsave(&gic_lock, flags);
1225     write_gic_map_pin(intr, GIC_MAP_PIN_MAP_TO_PIN | gic_cpu_pin);
1226     write_gic_map_vp(intr, BIT(mips_cm_vp_id(cpu)));
1227     - gic_clear_pcpu_masks(intr);
1228     - set_bit(intr, per_cpu_ptr(pcpu_masks, cpu));
1229     irq_data_update_effective_affinity(data, cpumask_of(cpu));
1230     spin_unlock_irqrestore(&gic_lock, flags);
1231    
1232     diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
1233     index 375ef86a84da..322671076c9c 100644
1234     --- a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
1235     +++ b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
1236     @@ -2632,7 +2632,6 @@ void t4_get_regs(struct adapter *adap, void *buf, size_t buf_size)
1237     }
1238    
1239     #define EEPROM_STAT_ADDR 0x7bfc
1240     -#define VPD_SIZE 0x800
1241     #define VPD_BASE 0x400
1242     #define VPD_BASE_OLD 0
1243     #define VPD_LEN 1024
1244     @@ -2699,15 +2698,6 @@ int t4_get_raw_vpd_params(struct adapter *adapter, struct vpd_params *p)
1245     if (!vpd)
1246     return -ENOMEM;
1247    
1248     - /* We have two VPD data structures stored in the adapter VPD area.
1249     - * By default, Linux calculates the size of the VPD area by traversing
1250     - * the first VPD area at offset 0x0, so we need to tell the OS what
1251     - * our real VPD size is.
1252     - */
1253     - ret = pci_set_vpd_size(adapter->pdev, VPD_SIZE);
1254     - if (ret < 0)
1255     - goto out;
1256     -
1257     /* Card information normally starts at VPD_BASE but early cards had
1258     * it at 0.
1259     */
1260     diff --git a/drivers/net/thunderbolt.c b/drivers/net/thunderbolt.c
1261     index ca5e375de27c..e0d6760f3219 100644
1262     --- a/drivers/net/thunderbolt.c
1263     +++ b/drivers/net/thunderbolt.c
1264     @@ -166,6 +166,8 @@ struct tbnet_ring {
1265     * @connected_work: Worker that finalizes the ThunderboltIP connection
1266     * setup and enables DMA paths for high speed data
1267     * transfers
1268     + * @disconnect_work: Worker that handles tearing down the ThunderboltIP
1269     + * connection
1270     * @rx_hdr: Copy of the currently processed Rx frame. Used when a
1271     * network packet consists of multiple Thunderbolt frames.
1272     * In host byte order.
1273     @@ -190,6 +192,7 @@ struct tbnet {
1274     int login_retries;
1275     struct delayed_work login_work;
1276     struct work_struct connected_work;
1277     + struct work_struct disconnect_work;
1278     struct thunderbolt_ip_frame_header rx_hdr;
1279     struct tbnet_ring rx_ring;
1280     atomic_t frame_id;
1281     @@ -445,7 +448,7 @@ static int tbnet_handle_packet(const void *buf, size_t size, void *data)
1282     case TBIP_LOGOUT:
1283     ret = tbnet_logout_response(net, route, sequence, command_id);
1284     if (!ret)
1285     - tbnet_tear_down(net, false);
1286     + queue_work(system_long_wq, &net->disconnect_work);
1287     break;
1288    
1289     default:
1290     @@ -659,6 +662,13 @@ static void tbnet_login_work(struct work_struct *work)
1291     }
1292     }
1293    
1294     +static void tbnet_disconnect_work(struct work_struct *work)
1295     +{
1296     + struct tbnet *net = container_of(work, typeof(*net), disconnect_work);
1297     +
1298     + tbnet_tear_down(net, false);
1299     +}
1300     +
1301     static bool tbnet_check_frame(struct tbnet *net, const struct tbnet_frame *tf,
1302     const struct thunderbolt_ip_frame_header *hdr)
1303     {
1304     @@ -881,6 +891,7 @@ static int tbnet_stop(struct net_device *dev)
1305    
1306     napi_disable(&net->napi);
1307    
1308     + cancel_work_sync(&net->disconnect_work);
1309     tbnet_tear_down(net, true);
1310    
1311     tb_ring_free(net->rx_ring.ring);
1312     @@ -1195,6 +1206,7 @@ static int tbnet_probe(struct tb_service *svc, const struct tb_service_id *id)
1313     net = netdev_priv(dev);
1314     INIT_DELAYED_WORK(&net->login_work, tbnet_login_work);
1315     INIT_WORK(&net->connected_work, tbnet_connected_work);
1316     + INIT_WORK(&net->disconnect_work, tbnet_disconnect_work);
1317     mutex_init(&net->connection_lock);
1318     atomic_set(&net->command_id, 0);
1319     atomic_set(&net->frame_id, 0);
1320     @@ -1270,10 +1282,7 @@ static int __maybe_unused tbnet_suspend(struct device *dev)
1321     stop_login(net);
1322     if (netif_running(net->dev)) {
1323     netif_device_detach(net->dev);
1324     - tb_ring_stop(net->rx_ring.ring);
1325     - tb_ring_stop(net->tx_ring.ring);
1326     - tbnet_free_buffers(&net->rx_ring);
1327     - tbnet_free_buffers(&net->tx_ring);
1328     + tbnet_tear_down(net, true);
1329     }
1330    
1331     return 0;
1332     diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
1333     index d22750ea7444..d7135140bf40 100644
1334     --- a/drivers/pci/quirks.c
1335     +++ b/drivers/pci/quirks.c
1336     @@ -3419,22 +3419,29 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_PORT_RIDGE,
1337    
1338     static void quirk_chelsio_extend_vpd(struct pci_dev *dev)
1339     {
1340     - pci_set_vpd_size(dev, 8192);
1341     -}
1342     -
1343     -DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CHELSIO, 0x20, quirk_chelsio_extend_vpd);
1344     -DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CHELSIO, 0x21, quirk_chelsio_extend_vpd);
1345     -DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CHELSIO, 0x22, quirk_chelsio_extend_vpd);
1346     -DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CHELSIO, 0x23, quirk_chelsio_extend_vpd);
1347     -DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CHELSIO, 0x24, quirk_chelsio_extend_vpd);
1348     -DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CHELSIO, 0x25, quirk_chelsio_extend_vpd);
1349     -DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CHELSIO, 0x26, quirk_chelsio_extend_vpd);
1350     -DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CHELSIO, 0x30, quirk_chelsio_extend_vpd);
1351     -DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CHELSIO, 0x31, quirk_chelsio_extend_vpd);
1352     -DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CHELSIO, 0x32, quirk_chelsio_extend_vpd);
1353     -DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CHELSIO, 0x35, quirk_chelsio_extend_vpd);
1354     -DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CHELSIO, 0x36, quirk_chelsio_extend_vpd);
1355     -DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CHELSIO, 0x37, quirk_chelsio_extend_vpd);
1356     + int chip = (dev->device & 0xf000) >> 12;
1357     + int func = (dev->device & 0x0f00) >> 8;
1358     + int prod = (dev->device & 0x00ff) >> 0;
1359     +
1360     + /*
1361     + * If this is a T3-based adapter, there's a 1KB VPD area at offset
1362     + * 0xc00 which contains the preferred VPD values. If this is a T4 or
1363     + * later based adapter, the special VPD is at offset 0x400 for the
1364     + * Physical Functions (the SR-IOV Virtual Functions have no VPD
1365     + * Capabilities). The PCI VPD Access core routines will normally
1366     + * compute the size of the VPD by parsing the VPD Data Structure at
1367     + * offset 0x000. This will result in silent failures when attempting
1368     + * to accesses these other VPD areas which are beyond those computed
1369     + * limits.
1370     + */
1371     + if (chip == 0x0 && prod >= 0x20)
1372     + pci_set_vpd_size(dev, 8192);
1373     + else if (chip >= 0x4 && func < 0x8)
1374     + pci_set_vpd_size(dev, 2048);
1375     +}
1376     +
1377     +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CHELSIO, PCI_ANY_ID,
1378     + quirk_chelsio_extend_vpd);
1379    
1380     #ifdef CONFIG_ACPI
1381     /*
1382     diff --git a/drivers/scsi/ibmvscsi/ibmvfc.h b/drivers/scsi/ibmvscsi/ibmvfc.h
1383     index 9a0696f68f37..b81a53c4a9a8 100644
1384     --- a/drivers/scsi/ibmvscsi/ibmvfc.h
1385     +++ b/drivers/scsi/ibmvscsi/ibmvfc.h
1386     @@ -367,7 +367,7 @@ enum ibmvfc_fcp_rsp_info_codes {
1387     };
1388    
1389     struct ibmvfc_fcp_rsp_info {
1390     - __be16 reserved;
1391     + u8 reserved[3];
1392     u8 rsp_code;
1393     u8 reserved2[4];
1394     }__attribute__((packed, aligned (2)));
1395     diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c
1396     index 4024926c1d68..f4a548471f0f 100644
1397     --- a/drivers/usb/core/quirks.c
1398     +++ b/drivers/usb/core/quirks.c
1399     @@ -226,6 +226,9 @@ static const struct usb_device_id usb_quirk_list[] = {
1400     { USB_DEVICE(0x1a0a, 0x0200), .driver_info =
1401     USB_QUIRK_LINEAR_UFRAME_INTR_BINTERVAL },
1402    
1403     + /* Corsair K70 RGB */
1404     + { USB_DEVICE(0x1b1c, 0x1b13), .driver_info = USB_QUIRK_DELAY_INIT },
1405     +
1406     /* Corsair Strafe RGB */
1407     { USB_DEVICE(0x1b1c, 0x1b20), .driver_info = USB_QUIRK_DELAY_INIT },
1408    
1409     diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c
1410     index fd3e7ad2eb0e..618b4260f0d9 100644
1411     --- a/drivers/usb/dwc3/ep0.c
1412     +++ b/drivers/usb/dwc3/ep0.c
1413     @@ -858,7 +858,12 @@ static void dwc3_ep0_complete_data(struct dwc3 *dwc,
1414     trb++;
1415     trb->ctrl &= ~DWC3_TRB_CTRL_HWO;
1416     trace_dwc3_complete_trb(ep0, trb);
1417     - ep0->trb_enqueue = 0;
1418     +
1419     + if (r->direction)
1420     + dwc->eps[1]->trb_enqueue = 0;
1421     + else
1422     + dwc->eps[0]->trb_enqueue = 0;
1423     +
1424     dwc->ep0_bounced = false;
1425     }
1426    
1427     diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
1428     index 639dd1b163a0..21abea0ac622 100644
1429     --- a/drivers/usb/dwc3/gadget.c
1430     +++ b/drivers/usb/dwc3/gadget.c
1431     @@ -2744,6 +2744,8 @@ static void dwc3_gadget_conndone_interrupt(struct dwc3 *dwc)
1432     break;
1433     }
1434    
1435     + dwc->eps[1]->endpoint.maxpacket = dwc->gadget.ep0->maxpacket;
1436     +
1437     /* Enable USB2 LPM Capability */
1438    
1439     if ((dwc->revision > DWC3_REVISION_194A) &&
1440     diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c
1441     index f9bd351637cd..0ef08a909ba6 100644
1442     --- a/drivers/usb/gadget/function/f_fs.c
1443     +++ b/drivers/usb/gadget/function/f_fs.c
1444     @@ -1852,44 +1852,20 @@ static int ffs_func_eps_enable(struct ffs_function *func)
1445    
1446     spin_lock_irqsave(&func->ffs->eps_lock, flags);
1447     while(count--) {
1448     - struct usb_endpoint_descriptor *ds;
1449     - struct usb_ss_ep_comp_descriptor *comp_desc = NULL;
1450     - int needs_comp_desc = false;
1451     - int desc_idx;
1452     -
1453     - if (ffs->gadget->speed == USB_SPEED_SUPER) {
1454     - desc_idx = 2;
1455     - needs_comp_desc = true;
1456     - } else if (ffs->gadget->speed == USB_SPEED_HIGH)
1457     - desc_idx = 1;
1458     - else
1459     - desc_idx = 0;
1460     -
1461     - /* fall-back to lower speed if desc missing for current speed */
1462     - do {
1463     - ds = ep->descs[desc_idx];
1464     - } while (!ds && --desc_idx >= 0);
1465     -
1466     - if (!ds) {
1467     - ret = -EINVAL;
1468     - break;
1469     - }
1470     -
1471     ep->ep->driver_data = ep;
1472     - ep->ep->desc = ds;
1473    
1474     - if (needs_comp_desc) {
1475     - comp_desc = (struct usb_ss_ep_comp_descriptor *)(ds +
1476     - USB_DT_ENDPOINT_SIZE);
1477     - ep->ep->maxburst = comp_desc->bMaxBurst + 1;
1478     - ep->ep->comp_desc = comp_desc;
1479     + ret = config_ep_by_speed(func->gadget, &func->function, ep->ep);
1480     + if (ret) {
1481     + pr_err("%s: config_ep_by_speed(%s) returned %d\n",
1482     + __func__, ep->ep->name, ret);
1483     + break;
1484     }
1485    
1486     ret = usb_ep_enable(ep->ep);
1487     if (likely(!ret)) {
1488     epfile->ep = ep;
1489     - epfile->in = usb_endpoint_dir_in(ds);
1490     - epfile->isoc = usb_endpoint_xfer_isoc(ds);
1491     + epfile->in = usb_endpoint_dir_in(ep->ep->desc);
1492     + epfile->isoc = usb_endpoint_xfer_isoc(ep->ep->desc);
1493     } else {
1494     break;
1495     }
1496     @@ -2976,10 +2952,8 @@ static int _ffs_func_bind(struct usb_configuration *c,
1497     struct ffs_data *ffs = func->ffs;
1498    
1499     const int full = !!func->ffs->fs_descs_count;
1500     - const int high = gadget_is_dualspeed(func->gadget) &&
1501     - func->ffs->hs_descs_count;
1502     - const int super = gadget_is_superspeed(func->gadget) &&
1503     - func->ffs->ss_descs_count;
1504     + const int high = !!func->ffs->hs_descs_count;
1505     + const int super = !!func->ffs->ss_descs_count;
1506    
1507     int fs_len, hs_len, ss_len, ret, i;
1508     struct ffs_ep *eps_ptr;
1509     diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c
1510     index facafdf8fb95..d7641cbdee43 100644
1511     --- a/drivers/usb/host/ehci-hub.c
1512     +++ b/drivers/usb/host/ehci-hub.c
1513     @@ -774,12 +774,12 @@ static struct urb *request_single_step_set_feature_urb(
1514     atomic_inc(&urb->use_count);
1515     atomic_inc(&urb->dev->urbnum);
1516     urb->setup_dma = dma_map_single(
1517     - hcd->self.controller,
1518     + hcd->self.sysdev,
1519     urb->setup_packet,
1520     sizeof(struct usb_ctrlrequest),
1521     DMA_TO_DEVICE);
1522     urb->transfer_dma = dma_map_single(
1523     - hcd->self.controller,
1524     + hcd->self.sysdev,
1525     urb->transfer_buffer,
1526     urb->transfer_buffer_length,
1527     DMA_FROM_DEVICE);
1528     diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
1529     index ee9676349333..84f88fa411cd 100644
1530     --- a/drivers/usb/host/ohci-hcd.c
1531     +++ b/drivers/usb/host/ohci-hcd.c
1532     @@ -74,6 +74,7 @@ static const char hcd_name [] = "ohci_hcd";
1533    
1534     #define STATECHANGE_DELAY msecs_to_jiffies(300)
1535     #define IO_WATCHDOG_DELAY msecs_to_jiffies(275)
1536     +#define IO_WATCHDOG_OFF 0xffffff00
1537    
1538     #include "ohci.h"
1539     #include "pci-quirks.h"
1540     @@ -231,7 +232,7 @@ static int ohci_urb_enqueue (
1541     }
1542    
1543     /* Start up the I/O watchdog timer, if it's not running */
1544     - if (!timer_pending(&ohci->io_watchdog) &&
1545     + if (ohci->prev_frame_no == IO_WATCHDOG_OFF &&
1546     list_empty(&ohci->eds_in_use) &&
1547     !(ohci->flags & OHCI_QUIRK_QEMU)) {
1548     ohci->prev_frame_no = ohci_frame_no(ohci);
1549     @@ -501,6 +502,7 @@ static int ohci_init (struct ohci_hcd *ohci)
1550     return 0;
1551    
1552     timer_setup(&ohci->io_watchdog, io_watchdog_func, 0);
1553     + ohci->prev_frame_no = IO_WATCHDOG_OFF;
1554    
1555     ohci->hcca = dma_alloc_coherent (hcd->self.controller,
1556     sizeof(*ohci->hcca), &ohci->hcca_dma, GFP_KERNEL);
1557     @@ -730,7 +732,7 @@ static void io_watchdog_func(struct timer_list *t)
1558     u32 head;
1559     struct ed *ed;
1560     struct td *td, *td_start, *td_next;
1561     - unsigned frame_no;
1562     + unsigned frame_no, prev_frame_no = IO_WATCHDOG_OFF;
1563     unsigned long flags;
1564    
1565     spin_lock_irqsave(&ohci->lock, flags);
1566     @@ -835,7 +837,7 @@ static void io_watchdog_func(struct timer_list *t)
1567     }
1568     }
1569     if (!list_empty(&ohci->eds_in_use)) {
1570     - ohci->prev_frame_no = frame_no;
1571     + prev_frame_no = frame_no;
1572     ohci->prev_wdh_cnt = ohci->wdh_cnt;
1573     ohci->prev_donehead = ohci_readl(ohci,
1574     &ohci->regs->donehead);
1575     @@ -845,6 +847,7 @@ static void io_watchdog_func(struct timer_list *t)
1576     }
1577    
1578     done:
1579     + ohci->prev_frame_no = prev_frame_no;
1580     spin_unlock_irqrestore(&ohci->lock, flags);
1581     }
1582    
1583     @@ -973,6 +976,7 @@ static void ohci_stop (struct usb_hcd *hcd)
1584     if (quirk_nec(ohci))
1585     flush_work(&ohci->nec_work);
1586     del_timer_sync(&ohci->io_watchdog);
1587     + ohci->prev_frame_no = IO_WATCHDOG_OFF;
1588    
1589     ohci_writel (ohci, OHCI_INTR_MIE, &ohci->regs->intrdisable);
1590     ohci_usb_reset(ohci);
1591     diff --git a/drivers/usb/host/ohci-hub.c b/drivers/usb/host/ohci-hub.c
1592     index fb7aaa3b9d06..634f3c7bf774 100644
1593     --- a/drivers/usb/host/ohci-hub.c
1594     +++ b/drivers/usb/host/ohci-hub.c
1595     @@ -311,8 +311,10 @@ static int ohci_bus_suspend (struct usb_hcd *hcd)
1596     rc = ohci_rh_suspend (ohci, 0);
1597     spin_unlock_irq (&ohci->lock);
1598    
1599     - if (rc == 0)
1600     + if (rc == 0) {
1601     del_timer_sync(&ohci->io_watchdog);
1602     + ohci->prev_frame_no = IO_WATCHDOG_OFF;
1603     + }
1604     return rc;
1605     }
1606    
1607     diff --git a/drivers/usb/host/ohci-q.c b/drivers/usb/host/ohci-q.c
1608     index b2ec8c399363..4ccb85a67bb3 100644
1609     --- a/drivers/usb/host/ohci-q.c
1610     +++ b/drivers/usb/host/ohci-q.c
1611     @@ -1019,6 +1019,8 @@ static void finish_unlinks(struct ohci_hcd *ohci)
1612     * have modified this list. normally it's just prepending
1613     * entries (which we'd ignore), but paranoia won't hurt.
1614     */
1615     + *last = ed->ed_next;
1616     + ed->ed_next = NULL;
1617     modified = 0;
1618    
1619     /* unlink urbs as requested, but rescan the list after
1620     @@ -1077,21 +1079,22 @@ static void finish_unlinks(struct ohci_hcd *ohci)
1621     goto rescan_this;
1622    
1623     /*
1624     - * If no TDs are queued, take ED off the ed_rm_list.
1625     + * If no TDs are queued, ED is now idle.
1626     * Otherwise, if the HC is running, reschedule.
1627     - * If not, leave it on the list for further dequeues.
1628     + * If the HC isn't running, add ED back to the
1629     + * start of the list for later processing.
1630     */
1631     if (list_empty(&ed->td_list)) {
1632     - *last = ed->ed_next;
1633     - ed->ed_next = NULL;
1634     ed->state = ED_IDLE;
1635     list_del(&ed->in_use_list);
1636     } else if (ohci->rh_state == OHCI_RH_RUNNING) {
1637     - *last = ed->ed_next;
1638     - ed->ed_next = NULL;
1639     ed_schedule(ohci, ed);
1640     } else {
1641     - last = &ed->ed_next;
1642     + ed->ed_next = ohci->ed_rm_list;
1643     + ohci->ed_rm_list = ed;
1644     + /* Don't loop on the same ED */
1645     + if (last == &ohci->ed_rm_list)
1646     + last = &ed->ed_next;
1647     }
1648    
1649     if (modified)
1650     diff --git a/drivers/usb/misc/ldusb.c b/drivers/usb/misc/ldusb.c
1651     index 5c1a3b852453..98ef7fcbda58 100644
1652     --- a/drivers/usb/misc/ldusb.c
1653     +++ b/drivers/usb/misc/ldusb.c
1654     @@ -42,6 +42,9 @@
1655     #define USB_DEVICE_ID_LD_MICROCASSYTIME 0x1033 /* USB Product ID of Micro-CASSY Time (reserved) */
1656     #define USB_DEVICE_ID_LD_MICROCASSYTEMPERATURE 0x1035 /* USB Product ID of Micro-CASSY Temperature */
1657     #define USB_DEVICE_ID_LD_MICROCASSYPH 0x1038 /* USB Product ID of Micro-CASSY pH */
1658     +#define USB_DEVICE_ID_LD_POWERANALYSERCASSY 0x1040 /* USB Product ID of Power Analyser CASSY */
1659     +#define USB_DEVICE_ID_LD_CONVERTERCONTROLLERCASSY 0x1042 /* USB Product ID of Converter Controller CASSY */
1660     +#define USB_DEVICE_ID_LD_MACHINETESTCASSY 0x1043 /* USB Product ID of Machine Test CASSY */
1661     #define USB_DEVICE_ID_LD_JWM 0x1080 /* USB Product ID of Joule and Wattmeter */
1662     #define USB_DEVICE_ID_LD_DMMP 0x1081 /* USB Product ID of Digital Multimeter P (reserved) */
1663     #define USB_DEVICE_ID_LD_UMIP 0x1090 /* USB Product ID of UMI P */
1664     @@ -84,6 +87,9 @@ static const struct usb_device_id ld_usb_table[] = {
1665     { USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MICROCASSYTIME) },
1666     { USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MICROCASSYTEMPERATURE) },
1667     { USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MICROCASSYPH) },
1668     + { USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_POWERANALYSERCASSY) },
1669     + { USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_CONVERTERCONTROLLERCASSY) },
1670     + { USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MACHINETESTCASSY) },
1671     { USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_JWM) },
1672     { USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_DMMP) },
1673     { USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_UMIP) },
1674     diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c
1675     index 2627363fb4fe..6f311212f3c5 100644
1676     --- a/drivers/usb/musb/musb_host.c
1677     +++ b/drivers/usb/musb/musb_host.c
1678     @@ -393,13 +393,7 @@ static void musb_advance_schedule(struct musb *musb, struct urb *urb,
1679     }
1680     }
1681    
1682     - /*
1683     - * The pipe must be broken if current urb->status is set, so don't
1684     - * start next urb.
1685     - * TODO: to minimize the risk of regression, only check urb->status
1686     - * for RX, until we have a test case to understand the behavior of TX.
1687     - */
1688     - if ((!status || !is_in) && qh && qh->is_ready) {
1689     + if (qh != NULL && qh->is_ready) {
1690     musb_dbg(musb, "... next ep%d %cX urb %p",
1691     hw_ep->epnum, is_in ? 'R' : 'T', next_urb(qh));
1692     musb_start_urb(musb, is_in, qh);
1693     diff --git a/drivers/usb/phy/phy-mxs-usb.c b/drivers/usb/phy/phy-mxs-usb.c
1694     index da031c45395a..fbec863350f6 100644
1695     --- a/drivers/usb/phy/phy-mxs-usb.c
1696     +++ b/drivers/usb/phy/phy-mxs-usb.c
1697     @@ -602,6 +602,9 @@ static enum usb_charger_type mxs_phy_charger_detect(struct usb_phy *phy)
1698     void __iomem *base = phy->io_priv;
1699     enum usb_charger_type chgr_type = UNKNOWN_TYPE;
1700    
1701     + if (!regmap)
1702     + return UNKNOWN_TYPE;
1703     +
1704     if (mxs_charger_data_contact_detect(mxs_phy))
1705     return chgr_type;
1706    
1707     diff --git a/drivers/usb/renesas_usbhs/fifo.c b/drivers/usb/renesas_usbhs/fifo.c
1708     index 2d24ef3076ef..b295e204a575 100644
1709     --- a/drivers/usb/renesas_usbhs/fifo.c
1710     +++ b/drivers/usb/renesas_usbhs/fifo.c
1711     @@ -989,6 +989,10 @@ static int usbhsf_dma_prepare_pop_with_usb_dmac(struct usbhs_pkt *pkt,
1712     if ((uintptr_t)pkt->buf & (USBHS_USB_DMAC_XFER_SIZE - 1))
1713     goto usbhsf_pio_prepare_pop;
1714    
1715     + /* return at this time if the pipe is running */
1716     + if (usbhs_pipe_is_running(pipe))
1717     + return 0;
1718     +
1719     usbhs_pipe_config_change_bfre(pipe, 1);
1720    
1721     ret = usbhsf_fifo_select(pipe, fifo, 0);
1722     @@ -1179,6 +1183,7 @@ static int usbhsf_dma_pop_done_with_usb_dmac(struct usbhs_pkt *pkt,
1723     usbhsf_fifo_clear(pipe, fifo);
1724     pkt->actual = usbhs_dma_calc_received_size(pkt, chan, rcv_len);
1725    
1726     + usbhs_pipe_running(pipe, 0);
1727     usbhsf_dma_stop(pipe, fifo);
1728     usbhsf_dma_unmap(pkt);
1729     usbhsf_fifo_unselect(pipe, pipe->fifo);
1730     diff --git a/drivers/xen/tmem.c b/drivers/xen/tmem.c
1731     index bf13d1ec51f3..04e7b3b29bac 100644
1732     --- a/drivers/xen/tmem.c
1733     +++ b/drivers/xen/tmem.c
1734     @@ -284,6 +284,10 @@ static int tmem_frontswap_store(unsigned type, pgoff_t offset,
1735     int pool = tmem_frontswap_poolid;
1736     int ret;
1737    
1738     + /* THP isn't supported */
1739     + if (PageTransHuge(page))
1740     + return -1;
1741     +
1742     if (pool < 0)
1743     return -1;
1744     if (ind64 != ind)
1745     diff --git a/include/drm/drm_atomic.h b/include/drm/drm_atomic.h
1746     index 5afd6e364fb6..c63b0b48e884 100644
1747     --- a/include/drm/drm_atomic.h
1748     +++ b/include/drm/drm_atomic.h
1749     @@ -134,6 +134,15 @@ struct drm_crtc_commit {
1750     * &drm_pending_vblank_event pointer to clean up private events.
1751     */
1752     struct drm_pending_vblank_event *event;
1753     +
1754     + /**
1755     + * @abort_completion:
1756     + *
1757     + * A flag that's set after drm_atomic_helper_setup_commit takes a second
1758     + * reference for the completion of $drm_crtc_state.event. It's used by
1759     + * the free code to remove the second reference if commit fails.
1760     + */
1761     + bool abort_completion;
1762     };
1763    
1764     struct __drm_planes_state {
1765     diff --git a/include/linux/kconfig.h b/include/linux/kconfig.h
1766     index fec5076eda91..dcde9471897d 100644
1767     --- a/include/linux/kconfig.h
1768     +++ b/include/linux/kconfig.h
1769     @@ -4,6 +4,12 @@
1770    
1771     #include <generated/autoconf.h>
1772    
1773     +#ifdef CONFIG_CPU_BIG_ENDIAN
1774     +#define __BIG_ENDIAN 4321
1775     +#else
1776     +#define __LITTLE_ENDIAN 1234
1777     +#endif
1778     +
1779     #define __ARG_PLACEHOLDER_1 0,
1780     #define __take_second_arg(__ignored, val, ...) val
1781    
1782     @@ -64,4 +70,7 @@
1783     */
1784     #define IS_ENABLED(option) __or(IS_BUILTIN(option), IS_MODULE(option))
1785    
1786     +/* Make sure we always have all types and struct attributes defined. */
1787     +#include <linux/compiler_types.h>
1788     +
1789     #endif /* __LINUX_KCONFIG_H */
1790     diff --git a/include/uapi/linux/if_ether.h b/include/uapi/linux/if_ether.h
1791     index 144de4d2f385..153c9c2eaaa7 100644
1792     --- a/include/uapi/linux/if_ether.h
1793     +++ b/include/uapi/linux/if_ether.h
1794     @@ -23,7 +23,6 @@
1795     #define _UAPI_LINUX_IF_ETHER_H
1796    
1797     #include <linux/types.h>
1798     -#include <linux/libc-compat.h>
1799    
1800     /*
1801     * IEEE 802.3 Ethernet magic constants. The frame sizes omit the preamble
1802     @@ -150,6 +149,11 @@
1803     * This is an Ethernet frame header.
1804     */
1805    
1806     +/* allow libcs like musl to deactivate this, glibc does not implement this. */
1807     +#ifndef __UAPI_DEF_ETHHDR
1808     +#define __UAPI_DEF_ETHHDR 1
1809     +#endif
1810     +
1811     #if __UAPI_DEF_ETHHDR
1812     struct ethhdr {
1813     unsigned char h_dest[ETH_ALEN]; /* destination eth addr */
1814     diff --git a/include/uapi/linux/libc-compat.h b/include/uapi/linux/libc-compat.h
1815     index fc29efaa918c..8254c937c9f4 100644
1816     --- a/include/uapi/linux/libc-compat.h
1817     +++ b/include/uapi/linux/libc-compat.h
1818     @@ -264,10 +264,4 @@
1819    
1820     #endif /* __GLIBC__ */
1821    
1822     -/* Definitions for if_ether.h */
1823     -/* allow libcs like musl to deactivate this, glibc does not implement this. */
1824     -#ifndef __UAPI_DEF_ETHHDR
1825     -#define __UAPI_DEF_ETHHDR 1
1826     -#endif
1827     -
1828     #endif /* _UAPI_LIBC_COMPAT_H */
1829     diff --git a/kernel/irq/matrix.c b/kernel/irq/matrix.c
1830     index 5187dfe809ac..4c5770407031 100644
1831     --- a/kernel/irq/matrix.c
1832     +++ b/kernel/irq/matrix.c
1833     @@ -16,6 +16,7 @@ struct cpumap {
1834     unsigned int available;
1835     unsigned int allocated;
1836     unsigned int managed;
1837     + bool initialized;
1838     bool online;
1839     unsigned long alloc_map[IRQ_MATRIX_SIZE];
1840     unsigned long managed_map[IRQ_MATRIX_SIZE];
1841     @@ -81,9 +82,11 @@ void irq_matrix_online(struct irq_matrix *m)
1842    
1843     BUG_ON(cm->online);
1844    
1845     - bitmap_zero(cm->alloc_map, m->matrix_bits);
1846     - cm->available = m->alloc_size - (cm->managed + m->systembits_inalloc);
1847     - cm->allocated = 0;
1848     + if (!cm->initialized) {
1849     + cm->available = m->alloc_size;
1850     + cm->available -= cm->managed + m->systembits_inalloc;
1851     + cm->initialized = true;
1852     + }
1853     m->global_available += cm->available;
1854     cm->online = true;
1855     m->online_maps++;
1856     @@ -370,14 +373,16 @@ void irq_matrix_free(struct irq_matrix *m, unsigned int cpu,
1857     if (WARN_ON_ONCE(bit < m->alloc_start || bit >= m->alloc_end))
1858     return;
1859    
1860     - if (cm->online) {
1861     - clear_bit(bit, cm->alloc_map);
1862     - cm->allocated--;
1863     + clear_bit(bit, cm->alloc_map);
1864     + cm->allocated--;
1865     +
1866     + if (cm->online)
1867     m->total_allocated--;
1868     - if (!managed) {
1869     - cm->available++;
1870     +
1871     + if (!managed) {
1872     + cm->available++;
1873     + if (cm->online)
1874     m->global_available++;
1875     - }
1876     }
1877     trace_irq_matrix_free(bit, cpu, m, cm);
1878     }
1879     diff --git a/mm/page_alloc.c b/mm/page_alloc.c
1880     index d23818c5465a..9f927497f2f5 100644
1881     --- a/mm/page_alloc.c
1882     +++ b/mm/page_alloc.c
1883     @@ -46,6 +46,7 @@
1884     #include <linux/stop_machine.h>
1885     #include <linux/sort.h>
1886     #include <linux/pfn.h>
1887     +#include <xen/xen.h>
1888     #include <linux/backing-dev.h>
1889     #include <linux/fault-inject.h>
1890     #include <linux/page-isolation.h>
1891     @@ -347,6 +348,9 @@ static inline bool update_defer_init(pg_data_t *pgdat,
1892     /* Always populate low zones for address-contrained allocations */
1893     if (zone_end < pgdat_end_pfn(pgdat))
1894     return true;
1895     + /* Xen PV domains need page structures early */
1896     + if (xen_pv_domain())
1897     + return true;
1898     (*nr_initialised)++;
1899     if ((*nr_initialised > pgdat->static_init_pgcnt) &&
1900     (pfn & (PAGES_PER_SECTION - 1)) == 0) {
1901     diff --git a/mm/zswap.c b/mm/zswap.c
1902     index d39581a076c3..597008a44f70 100644
1903     --- a/mm/zswap.c
1904     +++ b/mm/zswap.c
1905     @@ -970,6 +970,12 @@ static int zswap_frontswap_store(unsigned type, pgoff_t offset,
1906     u8 *src, *dst;
1907     struct zswap_header *zhdr;
1908    
1909     + /* THP isn't supported */
1910     + if (PageTransHuge(page)) {
1911     + ret = -EINVAL;
1912     + goto reject;
1913     + }
1914     +
1915     if (!zswap_enabled || !tree) {
1916     ret = -ENODEV;
1917     goto reject;
1918     diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c
1919     index c7df4969f80a..f56aab54e0c8 100644
1920     --- a/net/ipv4/ip_sockglue.c
1921     +++ b/net/ipv4/ip_sockglue.c
1922     @@ -1563,10 +1563,7 @@ int ip_getsockopt(struct sock *sk, int level,
1923     if (get_user(len, optlen))
1924     return -EFAULT;
1925    
1926     - lock_sock(sk);
1927     - err = nf_getsockopt(sk, PF_INET, optname, optval,
1928     - &len);
1929     - release_sock(sk);
1930     + err = nf_getsockopt(sk, PF_INET, optname, optval, &len);
1931     if (err >= 0)
1932     err = put_user(len, optlen);
1933     return err;
1934     @@ -1598,9 +1595,7 @@ int compat_ip_getsockopt(struct sock *sk, int level, int optname,
1935     if (get_user(len, optlen))
1936     return -EFAULT;
1937    
1938     - lock_sock(sk);
1939     err = compat_nf_getsockopt(sk, PF_INET, optname, optval, &len);
1940     - release_sock(sk);
1941     if (err >= 0)
1942     err = put_user(len, optlen);
1943     return err;
1944     diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c
1945     index d78d41fc4b1a..24535169663d 100644
1946     --- a/net/ipv6/ipv6_sockglue.c
1947     +++ b/net/ipv6/ipv6_sockglue.c
1948     @@ -1367,10 +1367,7 @@ int ipv6_getsockopt(struct sock *sk, int level, int optname,
1949     if (get_user(len, optlen))
1950     return -EFAULT;
1951    
1952     - lock_sock(sk);
1953     - err = nf_getsockopt(sk, PF_INET6, optname, optval,
1954     - &len);
1955     - release_sock(sk);
1956     + err = nf_getsockopt(sk, PF_INET6, optname, optval, &len);
1957     if (err >= 0)
1958     err = put_user(len, optlen);
1959     }
1960     @@ -1409,10 +1406,7 @@ int compat_ipv6_getsockopt(struct sock *sk, int level, int optname,
1961     if (get_user(len, optlen))
1962     return -EFAULT;
1963    
1964     - lock_sock(sk);
1965     - err = compat_nf_getsockopt(sk, PF_INET6,
1966     - optname, optval, &len);
1967     - release_sock(sk);
1968     + err = compat_nf_getsockopt(sk, PF_INET6, optname, optval, &len);
1969     if (err >= 0)
1970     err = put_user(len, optlen);
1971     }
1972     diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
1973     index fb15d3b97cb2..84f757c5d91a 100644
1974     --- a/net/mac80211/cfg.c
1975     +++ b/net/mac80211/cfg.c
1976     @@ -2863,7 +2863,7 @@ cfg80211_beacon_dup(struct cfg80211_beacon_data *beacon)
1977     }
1978     if (beacon->probe_resp_len) {
1979     new_beacon->probe_resp_len = beacon->probe_resp_len;
1980     - beacon->probe_resp = pos;
1981     + new_beacon->probe_resp = pos;
1982     memcpy(pos, beacon->probe_resp, beacon->probe_resp_len);
1983     pos += beacon->probe_resp_len;
1984     }