Gentoo Archives: gentoo-commits

From: Alice Ferrazzi <alicef@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/linux-patches:4.14 commit in: /
Date: Wed, 28 Feb 2018 15:00:39
Message-Id: 1519830030.3eba7820bf6cda0c1d1c39e04bf86ad28643e815.alicef@gentoo
1 commit: 3eba7820bf6cda0c1d1c39e04bf86ad28643e815
2 Author: Alice Ferrazzi <alicef <AT> gentoo <DOT> org>
3 AuthorDate: Wed Feb 28 15:00:30 2018 +0000
4 Commit: Alice Ferrazzi <alicef <AT> gentoo <DOT> org>
5 CommitDate: Wed Feb 28 15:00:30 2018 +0000
6 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=3eba7820
7
8 linux kernel 4.14.23
9
10 0000_README | 4 +
11 1022_linux-4.14.23.patch | 1575 ++++++++++++++++++++++++++++++++++++++++++++++
12 2 files changed, 1579 insertions(+)
13
14 diff --git a/0000_README b/0000_README
15 index d7b4bf6..8345213 100644
16 --- a/0000_README
17 +++ b/0000_README
18 @@ -131,6 +131,10 @@ Patch: 1021_linux-4.14.22.patch
19 From: http://www.kernel.org
20 Desc: Linux 4.14.22
21
22 +Patch: 1022_linux-4.14.23.patch
23 +From: http://www.kernel.org
24 +Desc: Linux 4.14.23
25 +
26 Patch: 1500_XATTR_USER_PREFIX.patch
27 From: https://bugs.gentoo.org/show_bug.cgi?id=470644
28 Desc: Support for namespace user.pax.* on tmpfs.
29
30 diff --git a/1022_linux-4.14.23.patch b/1022_linux-4.14.23.patch
31 new file mode 100644
32 index 0000000..479bcb6
33 --- /dev/null
34 +++ b/1022_linux-4.14.23.patch
35 @@ -0,0 +1,1575 @@
36 +diff --git a/Makefile b/Makefile
37 +index 03d41143900c..169f3199274f 100644
38 +--- a/Makefile
39 ++++ b/Makefile
40 +@@ -1,7 +1,7 @@
41 + # SPDX-License-Identifier: GPL-2.0
42 + VERSION = 4
43 + PATCHLEVEL = 14
44 +-SUBLEVEL = 22
45 ++SUBLEVEL = 23
46 + EXTRAVERSION =
47 + NAME = Petit Gorille
48 +
49 +diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c
50 +index 582142ae92e1..345d4e521191 100644
51 +--- a/arch/arm64/kernel/cpufeature.c
52 ++++ b/arch/arm64/kernel/cpufeature.c
53 +@@ -175,9 +175,11 @@ static const struct arm64_ftr_bits ftr_id_aa64mmfr2[] = {
54 + };
55 +
56 + static const struct arm64_ftr_bits ftr_ctr[] = {
57 +- ARM64_FTR_BITS(FTR_VISIBLE, FTR_STRICT, FTR_EXACT, 31, 1, 1), /* RAO */
58 ++ ARM64_FTR_BITS(FTR_VISIBLE, FTR_STRICT, FTR_EXACT, 31, 1, 1), /* RES1 */
59 ++ ARM64_FTR_BITS(FTR_VISIBLE, FTR_STRICT, FTR_LOWER_SAFE, 29, 1, 1), /* DIC */
60 ++ ARM64_FTR_BITS(FTR_VISIBLE, FTR_STRICT, FTR_LOWER_SAFE, 28, 1, 1), /* IDC */
61 + ARM64_FTR_BITS(FTR_VISIBLE, FTR_STRICT, FTR_HIGHER_SAFE, 24, 4, 0), /* CWG */
62 +- ARM64_FTR_BITS(FTR_VISIBLE, FTR_STRICT, FTR_LOWER_SAFE, 20, 4, 0), /* ERG */
63 ++ ARM64_FTR_BITS(FTR_VISIBLE, FTR_STRICT, FTR_HIGHER_SAFE, 20, 4, 0), /* ERG */
64 + ARM64_FTR_BITS(FTR_VISIBLE, FTR_STRICT, FTR_LOWER_SAFE, 16, 4, 1), /* DminLine */
65 + /*
66 + * Linux can handle differing I-cache policies. Userspace JITs will
67 +diff --git a/arch/arm64/kernel/traps.c b/arch/arm64/kernel/traps.c
68 +index 8383af15a759..4fc0e958770b 100644
69 +--- a/arch/arm64/kernel/traps.c
70 ++++ b/arch/arm64/kernel/traps.c
71 +@@ -56,7 +56,7 @@ static const char *handler[]= {
72 + "Error"
73 + };
74 +
75 +-int show_unhandled_signals = 1;
76 ++int show_unhandled_signals = 0;
77 +
78 + /*
79 + * Dump out the contents of some kernel memory nicely...
80 +@@ -573,14 +573,6 @@ asmlinkage long do_ni_syscall(struct pt_regs *regs)
81 + }
82 + #endif
83 +
84 +- if (show_unhandled_signals_ratelimited()) {
85 +- pr_info("%s[%d]: syscall %d\n", current->comm,
86 +- task_pid_nr(current), regs->syscallno);
87 +- dump_instr("", regs);
88 +- if (user_mode(regs))
89 +- __show_regs(regs);
90 +- }
91 +-
92 + return sys_ni_syscall();
93 + }
94 +
95 +diff --git a/arch/arm64/mm/proc.S b/arch/arm64/mm/proc.S
96 +index 329a1c43365e..139320a7f7a2 100644
97 +--- a/arch/arm64/mm/proc.S
98 ++++ b/arch/arm64/mm/proc.S
99 +@@ -155,7 +155,7 @@ ENDPROC(cpu_do_switch_mm)
100 +
101 + .macro __idmap_cpu_set_reserved_ttbr1, tmp1, tmp2
102 + adrp \tmp1, empty_zero_page
103 +- msr ttbr1_el1, \tmp2
104 ++ msr ttbr1_el1, \tmp1
105 + isb
106 + tlbi vmalle1
107 + dsb nsh
108 +diff --git a/arch/m32r/Kconfig b/arch/m32r/Kconfig
109 +index 0d9446c37ae8..498398d915c1 100644
110 +--- a/arch/m32r/Kconfig
111 ++++ b/arch/m32r/Kconfig
112 +@@ -196,8 +196,8 @@ config TIMER_DIVIDE
113 + default "128"
114 +
115 + config CPU_BIG_ENDIAN
116 +- bool "Generate big endian code"
117 +- default n
118 ++ bool
119 ++ default !CPU_LITTLE_ENDIAN
120 +
121 + config CPU_LITTLE_ENDIAN
122 + bool "Generate little endian code"
123 +diff --git a/arch/microblaze/Makefile b/arch/microblaze/Makefile
124 +index 830ee7d42fa0..d269dd4b8279 100644
125 +--- a/arch/microblaze/Makefile
126 ++++ b/arch/microblaze/Makefile
127 +@@ -36,16 +36,21 @@ endif
128 + CPUFLAGS-$(CONFIG_XILINX_MICROBLAZE0_USE_DIV) += -mno-xl-soft-div
129 + CPUFLAGS-$(CONFIG_XILINX_MICROBLAZE0_USE_BARREL) += -mxl-barrel-shift
130 + CPUFLAGS-$(CONFIG_XILINX_MICROBLAZE0_USE_PCMP_INSTR) += -mxl-pattern-compare
131 +-CPUFLAGS-$(CONFIG_BIG_ENDIAN) += -mbig-endian
132 +-CPUFLAGS-$(CONFIG_LITTLE_ENDIAN) += -mlittle-endian
133 ++
134 ++ifdef CONFIG_CPU_BIG_ENDIAN
135 ++KBUILD_CFLAGS += -mbig-endian
136 ++KBUILD_AFLAGS += -mbig-endian
137 ++LD += -EB
138 ++else
139 ++KBUILD_CFLAGS += -mlittle-endian
140 ++KBUILD_AFLAGS += -mlittle-endian
141 ++LD += -EL
142 ++endif
143 +
144 + CPUFLAGS-1 += $(call cc-option,-mcpu=v$(CPU_VER))
145 +
146 + # r31 holds current when in kernel mode
147 +-KBUILD_CFLAGS += -ffixed-r31 $(CPUFLAGS-1) $(CPUFLAGS-2)
148 +-
149 +-LDFLAGS :=
150 +-LDFLAGS_vmlinux :=
151 ++KBUILD_CFLAGS += -ffixed-r31 $(CPUFLAGS-y) $(CPUFLAGS-1) $(CPUFLAGS-2)
152 +
153 + head-y := arch/microblaze/kernel/head.o
154 + libs-y += arch/microblaze/lib/
155 +diff --git a/arch/mips/boot/Makefile b/arch/mips/boot/Makefile
156 +index 1bd5c4f00d19..c22da16d67b8 100644
157 +--- a/arch/mips/boot/Makefile
158 ++++ b/arch/mips/boot/Makefile
159 +@@ -126,6 +126,7 @@ $(obj)/vmlinux.its.S: $(addprefix $(srctree)/arch/mips/$(PLATFORM)/,$(ITS_INPUTS
160 +
161 + quiet_cmd_cpp_its_S = ITS $@
162 + cmd_cpp_its_S = $(CPP) $(cpp_flags) -P -C -o $@ $< \
163 ++ -D__ASSEMBLY__ \
164 + -DKERNEL_NAME="\"Linux $(KERNELRELEASE)\"" \
165 + -DVMLINUX_BINARY="\"$(3)\"" \
166 + -DVMLINUX_COMPRESSION="\"$(2)\"" \
167 +diff --git a/arch/mips/include/asm/compat.h b/arch/mips/include/asm/compat.h
168 +index 49691331ada4..08ec0762ca50 100644
169 +--- a/arch/mips/include/asm/compat.h
170 ++++ b/arch/mips/include/asm/compat.h
171 +@@ -86,7 +86,6 @@ struct compat_flock {
172 + compat_off_t l_len;
173 + s32 l_sysid;
174 + compat_pid_t l_pid;
175 +- short __unused;
176 + s32 pad[4];
177 + };
178 +
179 +diff --git a/arch/x86/oprofile/nmi_int.c b/arch/x86/oprofile/nmi_int.c
180 +index ffdbc4836b4f..abff76bda9e6 100644
181 +--- a/arch/x86/oprofile/nmi_int.c
182 ++++ b/arch/x86/oprofile/nmi_int.c
183 +@@ -460,7 +460,7 @@ static int nmi_setup(void)
184 + goto fail;
185 +
186 + for_each_possible_cpu(cpu) {
187 +- if (!cpu)
188 ++ if (!IS_ENABLED(CONFIG_SMP) || !cpu)
189 + continue;
190 +
191 + memcpy(per_cpu(cpu_msrs, cpu).counters,
192 +diff --git a/arch/xtensa/mm/init.c b/arch/xtensa/mm/init.c
193 +index 720fe4e8b497..8dad076661fc 100644
194 +--- a/arch/xtensa/mm/init.c
195 ++++ b/arch/xtensa/mm/init.c
196 +@@ -79,19 +79,75 @@ void __init zones_init(void)
197 + free_area_init_node(0, zones_size, ARCH_PFN_OFFSET, NULL);
198 + }
199 +
200 ++#ifdef CONFIG_HIGHMEM
201 ++static void __init free_area_high(unsigned long pfn, unsigned long end)
202 ++{
203 ++ for (; pfn < end; pfn++)
204 ++ free_highmem_page(pfn_to_page(pfn));
205 ++}
206 ++
207 ++static void __init free_highpages(void)
208 ++{
209 ++ unsigned long max_low = max_low_pfn;
210 ++ struct memblock_region *mem, *res;
211 ++
212 ++ reset_all_zones_managed_pages();
213 ++ /* set highmem page free */
214 ++ for_each_memblock(memory, mem) {
215 ++ unsigned long start = memblock_region_memory_base_pfn(mem);
216 ++ unsigned long end = memblock_region_memory_end_pfn(mem);
217 ++
218 ++ /* Ignore complete lowmem entries */
219 ++ if (end <= max_low)
220 ++ continue;
221 ++
222 ++ if (memblock_is_nomap(mem))
223 ++ continue;
224 ++
225 ++ /* Truncate partial highmem entries */
226 ++ if (start < max_low)
227 ++ start = max_low;
228 ++
229 ++ /* Find and exclude any reserved regions */
230 ++ for_each_memblock(reserved, res) {
231 ++ unsigned long res_start, res_end;
232 ++
233 ++ res_start = memblock_region_reserved_base_pfn(res);
234 ++ res_end = memblock_region_reserved_end_pfn(res);
235 ++
236 ++ if (res_end < start)
237 ++ continue;
238 ++ if (res_start < start)
239 ++ res_start = start;
240 ++ if (res_start > end)
241 ++ res_start = end;
242 ++ if (res_end > end)
243 ++ res_end = end;
244 ++ if (res_start != start)
245 ++ free_area_high(start, res_start);
246 ++ start = res_end;
247 ++ if (start == end)
248 ++ break;
249 ++ }
250 ++
251 ++ /* And now free anything which remains */
252 ++ if (start < end)
253 ++ free_area_high(start, end);
254 ++ }
255 ++}
256 ++#else
257 ++static void __init free_highpages(void)
258 ++{
259 ++}
260 ++#endif
261 ++
262 + /*
263 + * Initialize memory pages.
264 + */
265 +
266 + void __init mem_init(void)
267 + {
268 +-#ifdef CONFIG_HIGHMEM
269 +- unsigned long tmp;
270 +-
271 +- reset_all_zones_managed_pages();
272 +- for (tmp = max_low_pfn; tmp < max_pfn; tmp++)
273 +- free_highmem_page(pfn_to_page(tmp));
274 +-#endif
275 ++ free_highpages();
276 +
277 + max_mapnr = max_pfn - ARCH_PFN_OFFSET;
278 + high_memory = (void *)__va(max_low_pfn << PAGE_SHIFT);
279 +diff --git a/crypto/asymmetric_keys/pkcs7_verify.c b/crypto/asymmetric_keys/pkcs7_verify.c
280 +index 986033e64a83..a18295651077 100644
281 +--- a/crypto/asymmetric_keys/pkcs7_verify.c
282 ++++ b/crypto/asymmetric_keys/pkcs7_verify.c
283 +@@ -273,7 +273,7 @@ static int pkcs7_verify_sig_chain(struct pkcs7_message *pkcs7,
284 + sinfo->index);
285 + return 0;
286 + }
287 +- ret = public_key_verify_signature(p->pub, p->sig);
288 ++ ret = public_key_verify_signature(p->pub, x509->sig);
289 + if (ret < 0)
290 + return ret;
291 + x509->signer = p;
292 +@@ -369,8 +369,7 @@ static int pkcs7_verify_one(struct pkcs7_message *pkcs7,
293 + *
294 + * (*) -EBADMSG if some part of the message was invalid, or:
295 + *
296 +- * (*) 0 if no signature chains were found to be blacklisted or to contain
297 +- * unsupported crypto, or:
298 ++ * (*) 0 if a signature chain passed verification, or:
299 + *
300 + * (*) -EKEYREJECTED if a blacklisted key was encountered, or:
301 + *
302 +@@ -426,8 +425,11 @@ int pkcs7_verify(struct pkcs7_message *pkcs7,
303 +
304 + for (sinfo = pkcs7->signed_infos; sinfo; sinfo = sinfo->next) {
305 + ret = pkcs7_verify_one(pkcs7, sinfo);
306 +- if (sinfo->blacklisted && actual_ret == -ENOPKG)
307 +- actual_ret = -EKEYREJECTED;
308 ++ if (sinfo->blacklisted) {
309 ++ if (actual_ret == -ENOPKG)
310 ++ actual_ret = -EKEYREJECTED;
311 ++ continue;
312 ++ }
313 + if (ret < 0) {
314 + if (ret == -ENOPKG) {
315 + sinfo->unsupported_crypto = true;
316 +diff --git a/crypto/asymmetric_keys/public_key.c b/crypto/asymmetric_keys/public_key.c
317 +index 3cd6e12cfc46..d1af69d2ff85 100644
318 +--- a/crypto/asymmetric_keys/public_key.c
319 ++++ b/crypto/asymmetric_keys/public_key.c
320 +@@ -93,9 +93,11 @@ int public_key_verify_signature(const struct public_key *pkey,
321 +
322 + BUG_ON(!pkey);
323 + BUG_ON(!sig);
324 +- BUG_ON(!sig->digest);
325 + BUG_ON(!sig->s);
326 +
327 ++ if (!sig->digest)
328 ++ return -ENOPKG;
329 ++
330 + alg_name = sig->pkey_algo;
331 + if (strcmp(sig->pkey_algo, "rsa") == 0) {
332 + /* The data wangled by the RSA algorithm is typically padded
333 +diff --git a/crypto/asymmetric_keys/restrict.c b/crypto/asymmetric_keys/restrict.c
334 +index 86fb68508952..7c93c7728454 100644
335 +--- a/crypto/asymmetric_keys/restrict.c
336 ++++ b/crypto/asymmetric_keys/restrict.c
337 +@@ -67,8 +67,9 @@ __setup("ca_keys=", ca_keys_setup);
338 + *
339 + * Returns 0 if the new certificate was accepted, -ENOKEY if we couldn't find a
340 + * matching parent certificate in the trusted list, -EKEYREJECTED if the
341 +- * signature check fails or the key is blacklisted and some other error if
342 +- * there is a matching certificate but the signature check cannot be performed.
343 ++ * signature check fails or the key is blacklisted, -ENOPKG if the signature
344 ++ * uses unsupported crypto, or some other error if there is a matching
345 ++ * certificate but the signature check cannot be performed.
346 + */
347 + int restrict_link_by_signature(struct key *dest_keyring,
348 + const struct key_type *type,
349 +@@ -88,6 +89,8 @@ int restrict_link_by_signature(struct key *dest_keyring,
350 + return -EOPNOTSUPP;
351 +
352 + sig = payload->data[asym_auth];
353 ++ if (!sig)
354 ++ return -ENOPKG;
355 + if (!sig->auth_ids[0] && !sig->auth_ids[1])
356 + return -ENOKEY;
357 +
358 +@@ -139,6 +142,8 @@ static int key_or_keyring_common(struct key *dest_keyring,
359 + return -EOPNOTSUPP;
360 +
361 + sig = payload->data[asym_auth];
362 ++ if (!sig)
363 ++ return -ENOPKG;
364 + if (!sig->auth_ids[0] && !sig->auth_ids[1])
365 + return -ENOKEY;
366 +
367 +@@ -222,9 +227,9 @@ static int key_or_keyring_common(struct key *dest_keyring,
368 + *
369 + * Returns 0 if the new certificate was accepted, -ENOKEY if we
370 + * couldn't find a matching parent certificate in the trusted list,
371 +- * -EKEYREJECTED if the signature check fails, and some other error if
372 +- * there is a matching certificate but the signature check cannot be
373 +- * performed.
374 ++ * -EKEYREJECTED if the signature check fails, -ENOPKG if the signature uses
375 ++ * unsupported crypto, or some other error if there is a matching certificate
376 ++ * but the signature check cannot be performed.
377 + */
378 + int restrict_link_by_key_or_keyring(struct key *dest_keyring,
379 + const struct key_type *type,
380 +@@ -249,9 +254,9 @@ int restrict_link_by_key_or_keyring(struct key *dest_keyring,
381 + *
382 + * Returns 0 if the new certificate was accepted, -ENOKEY if we
383 + * couldn't find a matching parent certificate in the trusted list,
384 +- * -EKEYREJECTED if the signature check fails, and some other error if
385 +- * there is a matching certificate but the signature check cannot be
386 +- * performed.
387 ++ * -EKEYREJECTED if the signature check fails, -ENOPKG if the signature uses
388 ++ * unsupported crypto, or some other error if there is a matching certificate
389 ++ * but the signature check cannot be performed.
390 + */
391 + int restrict_link_by_key_or_keyring_chain(struct key *dest_keyring,
392 + const struct key_type *type,
393 +diff --git a/drivers/extcon/extcon-intel-int3496.c b/drivers/extcon/extcon-intel-int3496.c
394 +index 1a45e745717d..a6661097b2f9 100644
395 +--- a/drivers/extcon/extcon-intel-int3496.c
396 ++++ b/drivers/extcon/extcon-intel-int3496.c
397 +@@ -153,8 +153,9 @@ static int int3496_probe(struct platform_device *pdev)
398 + return ret;
399 + }
400 +
401 +- /* queue initial processing of id-pin */
402 ++ /* process id-pin so that we start with the right status */
403 + queue_delayed_work(system_wq, &data->work, 0);
404 ++ flush_delayed_work(&data->work);
405 +
406 + platform_set_drvdata(pdev, data);
407 +
408 +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c
409 +index c13c51af0b68..c53095b3b0fb 100644
410 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c
411 ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c
412 +@@ -14,6 +14,16 @@
413 +
414 + #include "amd_acpi.h"
415 +
416 ++#define AMDGPU_PX_QUIRK_FORCE_ATPX (1 << 0)
417 ++
418 ++struct amdgpu_px_quirk {
419 ++ u32 chip_vendor;
420 ++ u32 chip_device;
421 ++ u32 subsys_vendor;
422 ++ u32 subsys_device;
423 ++ u32 px_quirk_flags;
424 ++};
425 ++
426 + struct amdgpu_atpx_functions {
427 + bool px_params;
428 + bool power_cntl;
429 +@@ -35,6 +45,7 @@ struct amdgpu_atpx {
430 + static struct amdgpu_atpx_priv {
431 + bool atpx_detected;
432 + bool bridge_pm_usable;
433 ++ unsigned int quirks;
434 + /* handle for device - and atpx */
435 + acpi_handle dhandle;
436 + acpi_handle other_handle;
437 +@@ -205,13 +216,19 @@ static int amdgpu_atpx_validate(struct amdgpu_atpx *atpx)
438 +
439 + atpx->is_hybrid = false;
440 + if (valid_bits & ATPX_MS_HYBRID_GFX_SUPPORTED) {
441 +- printk("ATPX Hybrid Graphics\n");
442 +- /*
443 +- * Disable legacy PM methods only when pcie port PM is usable,
444 +- * otherwise the device might fail to power off or power on.
445 +- */
446 +- atpx->functions.power_cntl = !amdgpu_atpx_priv.bridge_pm_usable;
447 +- atpx->is_hybrid = true;
448 ++ if (amdgpu_atpx_priv.quirks & AMDGPU_PX_QUIRK_FORCE_ATPX) {
449 ++ printk("ATPX Hybrid Graphics, forcing to ATPX\n");
450 ++ atpx->functions.power_cntl = true;
451 ++ atpx->is_hybrid = false;
452 ++ } else {
453 ++ printk("ATPX Hybrid Graphics\n");
454 ++ /*
455 ++ * Disable legacy PM methods only when pcie port PM is usable,
456 ++ * otherwise the device might fail to power off or power on.
457 ++ */
458 ++ atpx->functions.power_cntl = !amdgpu_atpx_priv.bridge_pm_usable;
459 ++ atpx->is_hybrid = true;
460 ++ }
461 + }
462 +
463 + atpx->dgpu_req_power_for_displays = false;
464 +@@ -547,6 +564,31 @@ static const struct vga_switcheroo_handler amdgpu_atpx_handler = {
465 + .get_client_id = amdgpu_atpx_get_client_id,
466 + };
467 +
468 ++static const struct amdgpu_px_quirk amdgpu_px_quirk_list[] = {
469 ++ /* HG _PR3 doesn't seem to work on this A+A weston board */
470 ++ { 0x1002, 0x6900, 0x1002, 0x0124, AMDGPU_PX_QUIRK_FORCE_ATPX },
471 ++ { 0x1002, 0x6900, 0x1028, 0x0812, AMDGPU_PX_QUIRK_FORCE_ATPX },
472 ++ { 0x1002, 0x6900, 0x1028, 0x0813, AMDGPU_PX_QUIRK_FORCE_ATPX },
473 ++ { 0, 0, 0, 0, 0 },
474 ++};
475 ++
476 ++static void amdgpu_atpx_get_quirks(struct pci_dev *pdev)
477 ++{
478 ++ const struct amdgpu_px_quirk *p = amdgpu_px_quirk_list;
479 ++
480 ++ /* Apply PX quirks */
481 ++ while (p && p->chip_device != 0) {
482 ++ if (pdev->vendor == p->chip_vendor &&
483 ++ pdev->device == p->chip_device &&
484 ++ pdev->subsystem_vendor == p->subsys_vendor &&
485 ++ pdev->subsystem_device == p->subsys_device) {
486 ++ amdgpu_atpx_priv.quirks |= p->px_quirk_flags;
487 ++ break;
488 ++ }
489 ++ ++p;
490 ++ }
491 ++}
492 ++
493 + /**
494 + * amdgpu_atpx_detect - detect whether we have PX
495 + *
496 +@@ -570,6 +612,7 @@ static bool amdgpu_atpx_detect(void)
497 +
498 + parent_pdev = pci_upstream_bridge(pdev);
499 + d3_supported |= parent_pdev && parent_pdev->bridge_d3;
500 ++ amdgpu_atpx_get_quirks(pdev);
501 + }
502 +
503 + while ((pdev = pci_get_class(PCI_CLASS_DISPLAY_OTHER << 8, pdev)) != NULL) {
504 +@@ -579,6 +622,7 @@ static bool amdgpu_atpx_detect(void)
505 +
506 + parent_pdev = pci_upstream_bridge(pdev);
507 + d3_supported |= parent_pdev && parent_pdev->bridge_d3;
508 ++ amdgpu_atpx_get_quirks(pdev);
509 + }
510 +
511 + if (has_atpx && vga_count == 2) {
512 +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
513 +index e630d918fefc..bc746a6e0ecc 100644
514 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
515 ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
516 +@@ -2076,8 +2076,6 @@ int amdgpu_device_init(struct amdgpu_device *adev,
517 + * ignore it */
518 + vga_client_register(adev->pdev, adev, NULL, amdgpu_vga_set_decode);
519 +
520 +- if (amdgpu_runtime_pm == 1)
521 +- runtime = true;
522 + if (amdgpu_device_is_px(ddev))
523 + runtime = true;
524 + if (!pci_is_thunderbolt_attached(adev->pdev))
525 +diff --git a/drivers/gpu/drm/amd/amdgpu/si_dpm.c b/drivers/gpu/drm/amd/amdgpu/si_dpm.c
526 +index d63873f3f574..a2aeb643ac51 100644
527 +--- a/drivers/gpu/drm/amd/amdgpu/si_dpm.c
528 ++++ b/drivers/gpu/drm/amd/amdgpu/si_dpm.c
529 +@@ -3465,6 +3465,11 @@ static void si_apply_state_adjust_rules(struct amdgpu_device *adev,
530 + (adev->pdev->device == 0x6667)) {
531 + max_sclk = 75000;
532 + }
533 ++ if ((adev->pdev->revision == 0xC3) ||
534 ++ (adev->pdev->device == 0x6665)) {
535 ++ max_sclk = 60000;
536 ++ max_mclk = 80000;
537 ++ }
538 + } else if (adev->asic_type == CHIP_OLAND) {
539 + if ((adev->pdev->revision == 0xC7) ||
540 + (adev->pdev->revision == 0x80) ||
541 +diff --git a/drivers/gpu/drm/amd/amdgpu/soc15.c b/drivers/gpu/drm/amd/amdgpu/soc15.c
542 +index 3e59c766722c..ff7d4827385e 100644
543 +--- a/drivers/gpu/drm/amd/amdgpu/soc15.c
544 ++++ b/drivers/gpu/drm/amd/amdgpu/soc15.c
545 +@@ -661,8 +661,8 @@ static int soc15_common_early_init(void *handle)
546 + AMD_CG_SUPPORT_MC_LS |
547 + AMD_CG_SUPPORT_SDMA_MGCG |
548 + AMD_CG_SUPPORT_SDMA_LS;
549 +- adev->pg_flags = AMD_PG_SUPPORT_SDMA |
550 +- AMD_PG_SUPPORT_MMHUB;
551 ++ adev->pg_flags = AMD_PG_SUPPORT_SDMA;
552 ++
553 + adev->external_rev_id = 0x1;
554 + break;
555 + default:
556 +diff --git a/drivers/gpu/drm/amd/amdgpu/vi.c b/drivers/gpu/drm/amd/amdgpu/vi.c
557 +index 9ff69b90df36..4968b6bb9466 100644
558 +--- a/drivers/gpu/drm/amd/amdgpu/vi.c
559 ++++ b/drivers/gpu/drm/amd/amdgpu/vi.c
560 +@@ -448,14 +448,19 @@ static bool vi_read_bios_from_rom(struct amdgpu_device *adev,
561 +
562 + static void vi_detect_hw_virtualization(struct amdgpu_device *adev)
563 + {
564 +- uint32_t reg = RREG32(mmBIF_IOV_FUNC_IDENTIFIER);
565 +- /* bit0: 0 means pf and 1 means vf */
566 +- /* bit31: 0 means disable IOV and 1 means enable */
567 +- if (reg & 1)
568 +- adev->virt.caps |= AMDGPU_SRIOV_CAPS_IS_VF;
569 +-
570 +- if (reg & 0x80000000)
571 +- adev->virt.caps |= AMDGPU_SRIOV_CAPS_ENABLE_IOV;
572 ++ uint32_t reg = 0;
573 ++
574 ++ if (adev->asic_type == CHIP_TONGA ||
575 ++ adev->asic_type == CHIP_FIJI) {
576 ++ reg = RREG32(mmBIF_IOV_FUNC_IDENTIFIER);
577 ++ /* bit0: 0 means pf and 1 means vf */
578 ++ /* bit31: 0 means disable IOV and 1 means enable */
579 ++ if (reg & 1)
580 ++ adev->virt.caps |= AMDGPU_SRIOV_CAPS_IS_VF;
581 ++
582 ++ if (reg & 0x80000000)
583 ++ adev->virt.caps |= AMDGPU_SRIOV_CAPS_ENABLE_IOV;
584 ++ }
585 +
586 + if (reg == 0) {
587 + if (is_virtual_machine()) /* passthrough mode exclus sr-iov mode */
588 +diff --git a/drivers/gpu/drm/cirrus/cirrus_mode.c b/drivers/gpu/drm/cirrus/cirrus_mode.c
589 +index a4c4a465b385..130483f2cd7f 100644
590 +--- a/drivers/gpu/drm/cirrus/cirrus_mode.c
591 ++++ b/drivers/gpu/drm/cirrus/cirrus_mode.c
592 +@@ -294,22 +294,7 @@ static void cirrus_crtc_prepare(struct drm_crtc *crtc)
593 + {
594 + }
595 +
596 +-/*
597 +- * This is called after a mode is programmed. It should reverse anything done
598 +- * by the prepare function
599 +- */
600 +-static void cirrus_crtc_commit(struct drm_crtc *crtc)
601 +-{
602 +-}
603 +-
604 +-/*
605 +- * The core can pass us a set of gamma values to program. We actually only
606 +- * use this for 8-bit mode so can't perform smooth fades on deeper modes,
607 +- * but it's a requirement that we provide the function
608 +- */
609 +-static int cirrus_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green,
610 +- u16 *blue, uint32_t size,
611 +- struct drm_modeset_acquire_ctx *ctx)
612 ++static void cirrus_crtc_load_lut(struct drm_crtc *crtc)
613 + {
614 + struct drm_device *dev = crtc->dev;
615 + struct cirrus_device *cdev = dev->dev_private;
616 +@@ -317,7 +302,7 @@ static int cirrus_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green,
617 + int i;
618 +
619 + if (!crtc->enabled)
620 +- return 0;
621 ++ return;
622 +
623 + r = crtc->gamma_store;
624 + g = r + crtc->gamma_size;
625 +@@ -330,6 +315,27 @@ static int cirrus_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green,
626 + WREG8(PALETTE_DATA, *g++ >> 8);
627 + WREG8(PALETTE_DATA, *b++ >> 8);
628 + }
629 ++}
630 ++
631 ++/*
632 ++ * This is called after a mode is programmed. It should reverse anything done
633 ++ * by the prepare function
634 ++ */
635 ++static void cirrus_crtc_commit(struct drm_crtc *crtc)
636 ++{
637 ++ cirrus_crtc_load_lut(crtc);
638 ++}
639 ++
640 ++/*
641 ++ * The core can pass us a set of gamma values to program. We actually only
642 ++ * use this for 8-bit mode so can't perform smooth fades on deeper modes,
643 ++ * but it's a requirement that we provide the function
644 ++ */
645 ++static int cirrus_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green,
646 ++ u16 *blue, uint32_t size,
647 ++ struct drm_modeset_acquire_ctx *ctx)
648 ++{
649 ++ cirrus_crtc_load_lut(crtc);
650 +
651 + return 0;
652 + }
653 +diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
654 +index fc7946eb6665..d52c9758d8cf 100644
655 +--- a/drivers/gpu/drm/drm_edid.c
656 ++++ b/drivers/gpu/drm/drm_edid.c
657 +@@ -111,6 +111,9 @@ static const struct edid_quirk {
658 + /* AEO model 0 reports 8 bpc, but is a 6 bpc panel */
659 + { "AEO", 0, EDID_QUIRK_FORCE_6BPC },
660 +
661 ++ /* CPT panel of Asus UX303LA reports 8 bpc, but is a 6 bpc panel */
662 ++ { "CPT", 0x17df, EDID_QUIRK_FORCE_6BPC },
663 ++
664 + /* Belinea 10 15 55 */
665 + { "MAX", 1516, EDID_QUIRK_PREFER_LARGE_60 },
666 + { "MAX", 0x77e, EDID_QUIRK_PREFER_LARGE_60 },
667 +diff --git a/drivers/gpu/drm/drm_mm.c b/drivers/gpu/drm/drm_mm.c
668 +index 61a1c8ea74bc..1acf3b1479a1 100644
669 +--- a/drivers/gpu/drm/drm_mm.c
670 ++++ b/drivers/gpu/drm/drm_mm.c
671 +@@ -834,9 +834,24 @@ struct drm_mm_node *drm_mm_scan_color_evict(struct drm_mm_scan *scan)
672 + if (!mm->color_adjust)
673 + return NULL;
674 +
675 +- hole = list_first_entry(&mm->hole_stack, typeof(*hole), hole_stack);
676 +- hole_start = __drm_mm_hole_node_start(hole);
677 +- hole_end = hole_start + hole->hole_size;
678 ++ /*
679 ++ * The hole found during scanning should ideally be the first element
680 ++ * in the hole_stack list, but due to side-effects in the driver it
681 ++ * may not be.
682 ++ */
683 ++ list_for_each_entry(hole, &mm->hole_stack, hole_stack) {
684 ++ hole_start = __drm_mm_hole_node_start(hole);
685 ++ hole_end = hole_start + hole->hole_size;
686 ++
687 ++ if (hole_start <= scan->hit_start &&
688 ++ hole_end >= scan->hit_end)
689 ++ break;
690 ++ }
691 ++
692 ++ /* We should only be called after we found the hole previously */
693 ++ DRM_MM_BUG_ON(&hole->hole_stack == &mm->hole_stack);
694 ++ if (unlikely(&hole->hole_stack == &mm->hole_stack))
695 ++ return NULL;
696 +
697 + DRM_MM_BUG_ON(hole_start > scan->hit_start);
698 + DRM_MM_BUG_ON(hole_end < scan->hit_end);
699 +diff --git a/drivers/gpu/drm/i915/intel_breadcrumbs.c b/drivers/gpu/drm/i915/intel_breadcrumbs.c
700 +index 4e00e5cb9fa1..5095c095da04 100644
701 +--- a/drivers/gpu/drm/i915/intel_breadcrumbs.c
702 ++++ b/drivers/gpu/drm/i915/intel_breadcrumbs.c
703 +@@ -541,29 +541,16 @@ void intel_engine_remove_wait(struct intel_engine_cs *engine,
704 + spin_unlock_irq(&b->rb_lock);
705 + }
706 +
707 +-static bool signal_valid(const struct drm_i915_gem_request *request)
708 +-{
709 +- return intel_wait_check_request(&request->signaling.wait, request);
710 +-}
711 +-
712 + static bool signal_complete(const struct drm_i915_gem_request *request)
713 + {
714 + if (!request)
715 + return false;
716 +
717 +- /* If another process served as the bottom-half it may have already
718 +- * signalled that this wait is already completed.
719 +- */
720 +- if (intel_wait_complete(&request->signaling.wait))
721 +- return signal_valid(request);
722 +-
723 +- /* Carefully check if the request is complete, giving time for the
724 ++ /*
725 ++ * Carefully check if the request is complete, giving time for the
726 + * seqno to be visible or if the GPU hung.
727 + */
728 +- if (__i915_request_irq_complete(request))
729 +- return true;
730 +-
731 +- return false;
732 ++ return __i915_request_irq_complete(request);
733 + }
734 +
735 + static struct drm_i915_gem_request *to_signaler(struct rb_node *rb)
736 +@@ -606,9 +593,13 @@ static int intel_breadcrumbs_signaler(void *arg)
737 + request = i915_gem_request_get_rcu(request);
738 + rcu_read_unlock();
739 + if (signal_complete(request)) {
740 +- local_bh_disable();
741 +- dma_fence_signal(&request->fence);
742 +- local_bh_enable(); /* kick start the tasklets */
743 ++ if (!test_bit(DMA_FENCE_FLAG_SIGNALED_BIT,
744 ++ &request->fence.flags)) {
745 ++ local_bh_disable();
746 ++ dma_fence_signal(&request->fence);
747 ++ GEM_BUG_ON(!i915_gem_request_completed(request));
748 ++ local_bh_enable(); /* kick start the tasklets */
749 ++ }
750 +
751 + spin_lock_irq(&b->rb_lock);
752 +
753 +diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
754 +index 5744eb729d24..ca2fbe56635a 100644
755 +--- a/drivers/hid/hid-core.c
756 ++++ b/drivers/hid/hid-core.c
757 +@@ -2716,6 +2716,9 @@ static const struct hid_device_id hid_ignore_list[] = {
758 + { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MICROCASSYTIME) },
759 + { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MICROCASSYTEMPERATURE) },
760 + { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MICROCASSYPH) },
761 ++ { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_POWERANALYSERCASSY) },
762 ++ { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_CONVERTERCONTROLLERCASSY) },
763 ++ { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MACHINETESTCASSY) },
764 + { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_JWM) },
765 + { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_DMMP) },
766 + { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_UMIP) },
767 +diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
768 +index be2e005c3c51..ff539c0b4637 100644
769 +--- a/drivers/hid/hid-ids.h
770 ++++ b/drivers/hid/hid-ids.h
771 +@@ -634,6 +634,9 @@
772 + #define USB_DEVICE_ID_LD_MICROCASSYTIME 0x1033
773 + #define USB_DEVICE_ID_LD_MICROCASSYTEMPERATURE 0x1035
774 + #define USB_DEVICE_ID_LD_MICROCASSYPH 0x1038
775 ++#define USB_DEVICE_ID_LD_POWERANALYSERCASSY 0x1040
776 ++#define USB_DEVICE_ID_LD_CONVERTERCONTROLLERCASSY 0x1042
777 ++#define USB_DEVICE_ID_LD_MACHINETESTCASSY 0x1043
778 + #define USB_DEVICE_ID_LD_JWM 0x1080
779 + #define USB_DEVICE_ID_LD_DMMP 0x1081
780 + #define USB_DEVICE_ID_LD_UMIP 0x1090
781 +diff --git a/drivers/i2c/busses/i2c-bcm2835.c b/drivers/i2c/busses/i2c-bcm2835.c
782 +index cd07a69e2e93..44deae78913e 100644
783 +--- a/drivers/i2c/busses/i2c-bcm2835.c
784 ++++ b/drivers/i2c/busses/i2c-bcm2835.c
785 +@@ -50,6 +50,9 @@
786 + #define BCM2835_I2C_S_CLKT BIT(9)
787 + #define BCM2835_I2C_S_LEN BIT(10) /* Fake bit for SW error reporting */
788 +
789 ++#define BCM2835_I2C_FEDL_SHIFT 16
790 ++#define BCM2835_I2C_REDL_SHIFT 0
791 ++
792 + #define BCM2835_I2C_CDIV_MIN 0x0002
793 + #define BCM2835_I2C_CDIV_MAX 0xFFFE
794 +
795 +@@ -81,7 +84,7 @@ static inline u32 bcm2835_i2c_readl(struct bcm2835_i2c_dev *i2c_dev, u32 reg)
796 +
797 + static int bcm2835_i2c_set_divider(struct bcm2835_i2c_dev *i2c_dev)
798 + {
799 +- u32 divider;
800 ++ u32 divider, redl, fedl;
801 +
802 + divider = DIV_ROUND_UP(clk_get_rate(i2c_dev->clk),
803 + i2c_dev->bus_clk_rate);
804 +@@ -100,6 +103,22 @@ static int bcm2835_i2c_set_divider(struct bcm2835_i2c_dev *i2c_dev)
805 +
806 + bcm2835_i2c_writel(i2c_dev, BCM2835_I2C_DIV, divider);
807 +
808 ++ /*
809 ++ * Number of core clocks to wait after falling edge before
810 ++ * outputting the next data bit. Note that both FEDL and REDL
811 ++ * can't be greater than CDIV/2.
812 ++ */
813 ++ fedl = max(divider / 16, 1u);
814 ++
815 ++ /*
816 ++ * Number of core clocks to wait after rising edge before
817 ++ * sampling the next incoming data bit.
818 ++ */
819 ++ redl = max(divider / 4, 1u);
820 ++
821 ++ bcm2835_i2c_writel(i2c_dev, BCM2835_I2C_DEL,
822 ++ (fedl << BCM2835_I2C_FEDL_SHIFT) |
823 ++ (redl << BCM2835_I2C_REDL_SHIFT));
824 + return 0;
825 + }
826 +
827 +diff --git a/drivers/i2c/busses/i2c-designware-master.c b/drivers/i2c/busses/i2c-designware-master.c
828 +index 418c233075d3..13e849bf9aa0 100644
829 +--- a/drivers/i2c/busses/i2c-designware-master.c
830 ++++ b/drivers/i2c/busses/i2c-designware-master.c
831 +@@ -207,7 +207,7 @@ static void i2c_dw_xfer_init(struct dw_i2c_dev *dev)
832 + i2c_dw_disable_int(dev);
833 +
834 + /* Enable the adapter */
835 +- __i2c_dw_enable(dev, true);
836 ++ __i2c_dw_enable_and_wait(dev, true);
837 +
838 + /* Clear and enable interrupts */
839 + dw_readl(dev, DW_IC_CLR_INTR);
840 +diff --git a/drivers/iio/adc/stm32-adc.c b/drivers/iio/adc/stm32-adc.c
841 +index 172753b14a4f..04be8bd951be 100644
842 +--- a/drivers/iio/adc/stm32-adc.c
843 ++++ b/drivers/iio/adc/stm32-adc.c
844 +@@ -764,8 +764,6 @@ static int stm32h7_adc_enable(struct stm32_adc *adc)
845 + int ret;
846 + u32 val;
847 +
848 +- /* Clear ADRDY by writing one, then enable ADC */
849 +- stm32_adc_set_bits(adc, STM32H7_ADC_ISR, STM32H7_ADRDY);
850 + stm32_adc_set_bits(adc, STM32H7_ADC_CR, STM32H7_ADEN);
851 +
852 + /* Poll for ADRDY to be set (after adc startup time) */
853 +@@ -773,8 +771,11 @@ static int stm32h7_adc_enable(struct stm32_adc *adc)
854 + val & STM32H7_ADRDY,
855 + 100, STM32_ADC_TIMEOUT_US);
856 + if (ret) {
857 +- stm32_adc_clr_bits(adc, STM32H7_ADC_CR, STM32H7_ADEN);
858 ++ stm32_adc_set_bits(adc, STM32H7_ADC_CR, STM32H7_ADDIS);
859 + dev_err(&indio_dev->dev, "Failed to enable ADC\n");
860 ++ } else {
861 ++ /* Clear ADRDY by writing one */
862 ++ stm32_adc_set_bits(adc, STM32H7_ADC_ISR, STM32H7_ADRDY);
863 + }
864 +
865 + return ret;
866 +diff --git a/drivers/iio/imu/adis_trigger.c b/drivers/iio/imu/adis_trigger.c
867 +index f53e9a803a0e..93b99bd93738 100644
868 +--- a/drivers/iio/imu/adis_trigger.c
869 ++++ b/drivers/iio/imu/adis_trigger.c
870 +@@ -47,6 +47,10 @@ int adis_probe_trigger(struct adis *adis, struct iio_dev *indio_dev)
871 + if (adis->trig == NULL)
872 + return -ENOMEM;
873 +
874 ++ adis->trig->dev.parent = &adis->spi->dev;
875 ++ adis->trig->ops = &adis_trigger_ops;
876 ++ iio_trigger_set_drvdata(adis->trig, adis);
877 ++
878 + ret = request_irq(adis->spi->irq,
879 + &iio_trigger_generic_data_rdy_poll,
880 + IRQF_TRIGGER_RISING,
881 +@@ -55,9 +59,6 @@ int adis_probe_trigger(struct adis *adis, struct iio_dev *indio_dev)
882 + if (ret)
883 + goto error_free_trig;
884 +
885 +- adis->trig->dev.parent = &adis->spi->dev;
886 +- adis->trig->ops = &adis_trigger_ops;
887 +- iio_trigger_set_drvdata(adis->trig, adis);
888 + ret = iio_trigger_register(adis->trig);
889 +
890 + indio_dev->trig = iio_trigger_get(adis->trig);
891 +diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio/industrialio-buffer.c
892 +index d2b465140a6b..78482d456c3b 100644
893 +--- a/drivers/iio/industrialio-buffer.c
894 ++++ b/drivers/iio/industrialio-buffer.c
895 +@@ -175,7 +175,7 @@ unsigned int iio_buffer_poll(struct file *filp,
896 + struct iio_dev *indio_dev = filp->private_data;
897 + struct iio_buffer *rb = indio_dev->buffer;
898 +
899 +- if (!indio_dev->info)
900 ++ if (!indio_dev->info || rb == NULL)
901 + return 0;
902 +
903 + poll_wait(filp, &rb->pollq, wait);
904 +diff --git a/drivers/iio/proximity/Kconfig b/drivers/iio/proximity/Kconfig
905 +index ae070950f920..c03de24d3c51 100644
906 +--- a/drivers/iio/proximity/Kconfig
907 ++++ b/drivers/iio/proximity/Kconfig
908 +@@ -58,6 +58,8 @@ config SX9500
909 +
910 + config SRF08
911 + tristate "Devantech SRF02/SRF08/SRF10 ultrasonic ranger sensor"
912 ++ select IIO_BUFFER
913 ++ select IIO_TRIGGERED_BUFFER
914 + depends on I2C
915 + help
916 + Say Y here to build a driver for Devantech SRF02/SRF08/SRF10
917 +diff --git a/drivers/infiniband/core/rdma_core.c b/drivers/infiniband/core/rdma_core.c
918 +index 85b5ee4defa4..4e1f76730855 100644
919 +--- a/drivers/infiniband/core/rdma_core.c
920 ++++ b/drivers/infiniband/core/rdma_core.c
921 +@@ -196,7 +196,15 @@ static struct ib_uobject *lookup_get_idr_uobject(const struct uverbs_obj_type *t
922 + goto free;
923 + }
924 +
925 +- uverbs_uobject_get(uobj);
926 ++ /*
927 ++ * The idr_find is guaranteed to return a pointer to something that
928 ++ * isn't freed yet, or NULL, as the free after idr_remove goes through
929 ++ * kfree_rcu(). However the object may still have been released and
930 ++ * kfree() could be called at any time.
931 ++ */
932 ++ if (!kref_get_unless_zero(&uobj->ref))
933 ++ uobj = ERR_PTR(-ENOENT);
934 ++
935 + free:
936 + rcu_read_unlock();
937 + return uobj;
938 +diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c
939 +index 93c1a57dbff1..186dce6bba8f 100644
940 +--- a/drivers/infiniband/core/uverbs_cmd.c
941 ++++ b/drivers/infiniband/core/uverbs_cmd.c
942 +@@ -565,9 +565,10 @@ ssize_t ib_uverbs_open_xrcd(struct ib_uverbs_file *file,
943 + if (f.file)
944 + fdput(f);
945 +
946 ++ mutex_unlock(&file->device->xrcd_tree_mutex);
947 ++
948 + uobj_alloc_commit(&obj->uobject);
949 +
950 +- mutex_unlock(&file->device->xrcd_tree_mutex);
951 + return in_len;
952 +
953 + err_copy:
954 +@@ -606,10 +607,8 @@ ssize_t ib_uverbs_close_xrcd(struct ib_uverbs_file *file,
955 +
956 + uobj = uobj_get_write(uobj_get_type(xrcd), cmd.xrcd_handle,
957 + file->ucontext);
958 +- if (IS_ERR(uobj)) {
959 +- mutex_unlock(&file->device->xrcd_tree_mutex);
960 ++ if (IS_ERR(uobj))
961 + return PTR_ERR(uobj);
962 +- }
963 +
964 + ret = uobj_remove_commit(uobj);
965 + return ret ?: in_len;
966 +@@ -1982,8 +1981,15 @@ static int modify_qp(struct ib_uverbs_file *file,
967 + goto release_qp;
968 + }
969 +
970 ++ if ((cmd->base.attr_mask & IB_QP_AV) &&
971 ++ !rdma_is_port_valid(qp->device, cmd->base.dest.port_num)) {
972 ++ ret = -EINVAL;
973 ++ goto release_qp;
974 ++ }
975 ++
976 + if ((cmd->base.attr_mask & IB_QP_ALT_PATH) &&
977 +- !rdma_is_port_valid(qp->device, cmd->base.alt_port_num)) {
978 ++ (!rdma_is_port_valid(qp->device, cmd->base.alt_port_num) ||
979 ++ !rdma_is_port_valid(qp->device, cmd->base.alt_dest.port_num))) {
980 + ret = -EINVAL;
981 + goto release_qp;
982 + }
983 +diff --git a/drivers/infiniband/core/uverbs_main.c b/drivers/infiniband/core/uverbs_main.c
984 +index dc2aed6fb21b..0f70ff91276e 100644
985 +--- a/drivers/infiniband/core/uverbs_main.c
986 ++++ b/drivers/infiniband/core/uverbs_main.c
987 +@@ -647,12 +647,21 @@ static int verify_command_mask(struct ib_device *ib_dev, __u32 command)
988 + return -1;
989 + }
990 +
991 ++static bool verify_command_idx(u32 command, bool extended)
992 ++{
993 ++ if (extended)
994 ++ return command < ARRAY_SIZE(uverbs_ex_cmd_table);
995 ++
996 ++ return command < ARRAY_SIZE(uverbs_cmd_table);
997 ++}
998 ++
999 + static ssize_t ib_uverbs_write(struct file *filp, const char __user *buf,
1000 + size_t count, loff_t *pos)
1001 + {
1002 + struct ib_uverbs_file *file = filp->private_data;
1003 + struct ib_device *ib_dev;
1004 + struct ib_uverbs_cmd_hdr hdr;
1005 ++ bool extended_command;
1006 + __u32 command;
1007 + __u32 flags;
1008 + int srcu_key;
1009 +@@ -685,6 +694,15 @@ static ssize_t ib_uverbs_write(struct file *filp, const char __user *buf,
1010 + }
1011 +
1012 + command = hdr.command & IB_USER_VERBS_CMD_COMMAND_MASK;
1013 ++ flags = (hdr.command &
1014 ++ IB_USER_VERBS_CMD_FLAGS_MASK) >> IB_USER_VERBS_CMD_FLAGS_SHIFT;
1015 ++
1016 ++ extended_command = flags & IB_USER_VERBS_CMD_FLAG_EXTENDED;
1017 ++ if (!verify_command_idx(command, extended_command)) {
1018 ++ ret = -EINVAL;
1019 ++ goto out;
1020 ++ }
1021 ++
1022 + if (verify_command_mask(ib_dev, command)) {
1023 + ret = -EOPNOTSUPP;
1024 + goto out;
1025 +@@ -696,12 +714,8 @@ static ssize_t ib_uverbs_write(struct file *filp, const char __user *buf,
1026 + goto out;
1027 + }
1028 +
1029 +- flags = (hdr.command &
1030 +- IB_USER_VERBS_CMD_FLAGS_MASK) >> IB_USER_VERBS_CMD_FLAGS_SHIFT;
1031 +-
1032 + if (!flags) {
1033 +- if (command >= ARRAY_SIZE(uverbs_cmd_table) ||
1034 +- !uverbs_cmd_table[command]) {
1035 ++ if (!uverbs_cmd_table[command]) {
1036 + ret = -EINVAL;
1037 + goto out;
1038 + }
1039 +@@ -722,8 +736,7 @@ static ssize_t ib_uverbs_write(struct file *filp, const char __user *buf,
1040 + struct ib_udata uhw;
1041 + size_t written_count = count;
1042 +
1043 +- if (command >= ARRAY_SIZE(uverbs_ex_cmd_table) ||
1044 +- !uverbs_ex_cmd_table[command]) {
1045 ++ if (!uverbs_ex_cmd_table[command]) {
1046 + ret = -ENOSYS;
1047 + goto out;
1048 + }
1049 +diff --git a/drivers/irqchip/irq-gic-v3.c b/drivers/irqchip/irq-gic-v3.c
1050 +index 3b35271114ee..ae9ff72e83ee 100644
1051 +--- a/drivers/irqchip/irq-gic-v3.c
1052 ++++ b/drivers/irqchip/irq-gic-v3.c
1053 +@@ -660,7 +660,7 @@ static void gic_raise_softirq(const struct cpumask *mask, unsigned int irq)
1054 + * Ensure that stores to Normal memory are visible to the
1055 + * other CPUs before issuing the IPI.
1056 + */
1057 +- smp_wmb();
1058 ++ wmb();
1059 +
1060 + for_each_cpu(cpu, mask) {
1061 + unsigned long cluster_id = cpu_logical_map(cpu) & ~0xffUL;
1062 +diff --git a/drivers/irqchip/irq-mips-gic.c b/drivers/irqchip/irq-mips-gic.c
1063 +index c90976d7e53c..a9f300efce54 100644
1064 +--- a/drivers/irqchip/irq-mips-gic.c
1065 ++++ b/drivers/irqchip/irq-mips-gic.c
1066 +@@ -427,8 +427,6 @@ static int gic_shared_irq_domain_map(struct irq_domain *d, unsigned int virq,
1067 + spin_lock_irqsave(&gic_lock, flags);
1068 + write_gic_map_pin(intr, GIC_MAP_PIN_MAP_TO_PIN | gic_cpu_pin);
1069 + write_gic_map_vp(intr, BIT(mips_cm_vp_id(cpu)));
1070 +- gic_clear_pcpu_masks(intr);
1071 +- set_bit(intr, per_cpu_ptr(pcpu_masks, cpu));
1072 + irq_data_update_effective_affinity(data, cpumask_of(cpu));
1073 + spin_unlock_irqrestore(&gic_lock, flags);
1074 +
1075 +diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
1076 +index b65ce26ff72f..1802debbd3c7 100644
1077 +--- a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
1078 ++++ b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
1079 +@@ -2632,7 +2632,6 @@ void t4_get_regs(struct adapter *adap, void *buf, size_t buf_size)
1080 + }
1081 +
1082 + #define EEPROM_STAT_ADDR 0x7bfc
1083 +-#define VPD_SIZE 0x800
1084 + #define VPD_BASE 0x400
1085 + #define VPD_BASE_OLD 0
1086 + #define VPD_LEN 1024
1087 +@@ -2670,15 +2669,6 @@ int t4_get_raw_vpd_params(struct adapter *adapter, struct vpd_params *p)
1088 + if (!vpd)
1089 + return -ENOMEM;
1090 +
1091 +- /* We have two VPD data structures stored in the adapter VPD area.
1092 +- * By default, Linux calculates the size of the VPD area by traversing
1093 +- * the first VPD area at offset 0x0, so we need to tell the OS what
1094 +- * our real VPD size is.
1095 +- */
1096 +- ret = pci_set_vpd_size(adapter->pdev, VPD_SIZE);
1097 +- if (ret < 0)
1098 +- goto out;
1099 +-
1100 + /* Card information normally starts at VPD_BASE but early cards had
1101 + * it at 0.
1102 + */
1103 +diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
1104 +index 4c3feb96f391..d18824772f6c 100644
1105 +--- a/drivers/pci/quirks.c
1106 ++++ b/drivers/pci/quirks.c
1107 +@@ -3412,22 +3412,29 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_PORT_RIDGE,
1108 +
1109 + static void quirk_chelsio_extend_vpd(struct pci_dev *dev)
1110 + {
1111 +- pci_set_vpd_size(dev, 8192);
1112 +-}
1113 +-
1114 +-DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CHELSIO, 0x20, quirk_chelsio_extend_vpd);
1115 +-DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CHELSIO, 0x21, quirk_chelsio_extend_vpd);
1116 +-DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CHELSIO, 0x22, quirk_chelsio_extend_vpd);
1117 +-DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CHELSIO, 0x23, quirk_chelsio_extend_vpd);
1118 +-DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CHELSIO, 0x24, quirk_chelsio_extend_vpd);
1119 +-DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CHELSIO, 0x25, quirk_chelsio_extend_vpd);
1120 +-DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CHELSIO, 0x26, quirk_chelsio_extend_vpd);
1121 +-DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CHELSIO, 0x30, quirk_chelsio_extend_vpd);
1122 +-DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CHELSIO, 0x31, quirk_chelsio_extend_vpd);
1123 +-DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CHELSIO, 0x32, quirk_chelsio_extend_vpd);
1124 +-DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CHELSIO, 0x35, quirk_chelsio_extend_vpd);
1125 +-DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CHELSIO, 0x36, quirk_chelsio_extend_vpd);
1126 +-DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CHELSIO, 0x37, quirk_chelsio_extend_vpd);
1127 ++ int chip = (dev->device & 0xf000) >> 12;
1128 ++ int func = (dev->device & 0x0f00) >> 8;
1129 ++ int prod = (dev->device & 0x00ff) >> 0;
1130 ++
1131 ++ /*
1132 ++ * If this is a T3-based adapter, there's a 1KB VPD area at offset
1133 ++ * 0xc00 which contains the preferred VPD values. If this is a T4 or
1134 ++ * later based adapter, the special VPD is at offset 0x400 for the
1135 ++ * Physical Functions (the SR-IOV Virtual Functions have no VPD
1136 ++ * Capabilities). The PCI VPD Access core routines will normally
1137 ++ * compute the size of the VPD by parsing the VPD Data Structure at
1138 ++ * offset 0x000. This will result in silent failures when attempting
1139 ++ * to accesses these other VPD areas which are beyond those computed
1140 ++ * limits.
1141 ++ */
1142 ++ if (chip == 0x0 && prod >= 0x20)
1143 ++ pci_set_vpd_size(dev, 8192);
1144 ++ else if (chip >= 0x4 && func < 0x8)
1145 ++ pci_set_vpd_size(dev, 2048);
1146 ++}
1147 ++
1148 ++DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CHELSIO, PCI_ANY_ID,
1149 ++ quirk_chelsio_extend_vpd);
1150 +
1151 + #ifdef CONFIG_ACPI
1152 + /*
1153 +diff --git a/drivers/scsi/ibmvscsi/ibmvfc.h b/drivers/scsi/ibmvscsi/ibmvfc.h
1154 +index 9a0696f68f37..b81a53c4a9a8 100644
1155 +--- a/drivers/scsi/ibmvscsi/ibmvfc.h
1156 ++++ b/drivers/scsi/ibmvscsi/ibmvfc.h
1157 +@@ -367,7 +367,7 @@ enum ibmvfc_fcp_rsp_info_codes {
1158 + };
1159 +
1160 + struct ibmvfc_fcp_rsp_info {
1161 +- __be16 reserved;
1162 ++ u8 reserved[3];
1163 + u8 rsp_code;
1164 + u8 reserved2[4];
1165 + }__attribute__((packed, aligned (2)));
1166 +diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c
1167 +index c05c4f877750..774c97bb1c08 100644
1168 +--- a/drivers/usb/core/quirks.c
1169 ++++ b/drivers/usb/core/quirks.c
1170 +@@ -225,6 +225,9 @@ static const struct usb_device_id usb_quirk_list[] = {
1171 + { USB_DEVICE(0x1a0a, 0x0200), .driver_info =
1172 + USB_QUIRK_LINEAR_UFRAME_INTR_BINTERVAL },
1173 +
1174 ++ /* Corsair K70 RGB */
1175 ++ { USB_DEVICE(0x1b1c, 0x1b13), .driver_info = USB_QUIRK_DELAY_INIT },
1176 ++
1177 + /* Corsair Strafe RGB */
1178 + { USB_DEVICE(0x1b1c, 0x1b20), .driver_info = USB_QUIRK_DELAY_INIT },
1179 +
1180 +diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c
1181 +index 75e6cb044eb2..89fe53c846ef 100644
1182 +--- a/drivers/usb/dwc3/ep0.c
1183 ++++ b/drivers/usb/dwc3/ep0.c
1184 +@@ -884,7 +884,12 @@ static void dwc3_ep0_complete_data(struct dwc3 *dwc,
1185 + trb++;
1186 + trb->ctrl &= ~DWC3_TRB_CTRL_HWO;
1187 + trace_dwc3_complete_trb(ep0, trb);
1188 +- ep0->trb_enqueue = 0;
1189 ++
1190 ++ if (r->direction)
1191 ++ dwc->eps[1]->trb_enqueue = 0;
1192 ++ else
1193 ++ dwc->eps[0]->trb_enqueue = 0;
1194 ++
1195 + dwc->ep0_bounced = false;
1196 + }
1197 +
1198 +diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
1199 +index 97e52c0d1a72..0ebdb313bb00 100644
1200 +--- a/drivers/usb/dwc3/gadget.c
1201 ++++ b/drivers/usb/dwc3/gadget.c
1202 +@@ -2774,6 +2774,8 @@ static void dwc3_gadget_conndone_interrupt(struct dwc3 *dwc)
1203 + break;
1204 + }
1205 +
1206 ++ dwc->eps[1]->endpoint.maxpacket = dwc->gadget.ep0->maxpacket;
1207 ++
1208 + /* Enable USB2 LPM Capability */
1209 +
1210 + if ((dwc->revision > DWC3_REVISION_194A) &&
1211 +diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c
1212 +index c0491dd73f53..a9c9ab01592b 100644
1213 +--- a/drivers/usb/gadget/function/f_fs.c
1214 ++++ b/drivers/usb/gadget/function/f_fs.c
1215 +@@ -1856,44 +1856,20 @@ static int ffs_func_eps_enable(struct ffs_function *func)
1216 +
1217 + spin_lock_irqsave(&func->ffs->eps_lock, flags);
1218 + while(count--) {
1219 +- struct usb_endpoint_descriptor *ds;
1220 +- struct usb_ss_ep_comp_descriptor *comp_desc = NULL;
1221 +- int needs_comp_desc = false;
1222 +- int desc_idx;
1223 +-
1224 +- if (ffs->gadget->speed == USB_SPEED_SUPER) {
1225 +- desc_idx = 2;
1226 +- needs_comp_desc = true;
1227 +- } else if (ffs->gadget->speed == USB_SPEED_HIGH)
1228 +- desc_idx = 1;
1229 +- else
1230 +- desc_idx = 0;
1231 +-
1232 +- /* fall-back to lower speed if desc missing for current speed */
1233 +- do {
1234 +- ds = ep->descs[desc_idx];
1235 +- } while (!ds && --desc_idx >= 0);
1236 +-
1237 +- if (!ds) {
1238 +- ret = -EINVAL;
1239 +- break;
1240 +- }
1241 +-
1242 + ep->ep->driver_data = ep;
1243 +- ep->ep->desc = ds;
1244 +
1245 +- if (needs_comp_desc) {
1246 +- comp_desc = (struct usb_ss_ep_comp_descriptor *)(ds +
1247 +- USB_DT_ENDPOINT_SIZE);
1248 +- ep->ep->maxburst = comp_desc->bMaxBurst + 1;
1249 +- ep->ep->comp_desc = comp_desc;
1250 ++ ret = config_ep_by_speed(func->gadget, &func->function, ep->ep);
1251 ++ if (ret) {
1252 ++ pr_err("%s: config_ep_by_speed(%s) returned %d\n",
1253 ++ __func__, ep->ep->name, ret);
1254 ++ break;
1255 + }
1256 +
1257 + ret = usb_ep_enable(ep->ep);
1258 + if (likely(!ret)) {
1259 + epfile->ep = ep;
1260 +- epfile->in = usb_endpoint_dir_in(ds);
1261 +- epfile->isoc = usb_endpoint_xfer_isoc(ds);
1262 ++ epfile->in = usb_endpoint_dir_in(ep->ep->desc);
1263 ++ epfile->isoc = usb_endpoint_xfer_isoc(ep->ep->desc);
1264 + } else {
1265 + break;
1266 + }
1267 +@@ -2980,10 +2956,8 @@ static int _ffs_func_bind(struct usb_configuration *c,
1268 + struct ffs_data *ffs = func->ffs;
1269 +
1270 + const int full = !!func->ffs->fs_descs_count;
1271 +- const int high = gadget_is_dualspeed(func->gadget) &&
1272 +- func->ffs->hs_descs_count;
1273 +- const int super = gadget_is_superspeed(func->gadget) &&
1274 +- func->ffs->ss_descs_count;
1275 ++ const int high = !!func->ffs->hs_descs_count;
1276 ++ const int super = !!func->ffs->ss_descs_count;
1277 +
1278 + int fs_len, hs_len, ss_len, ret, i;
1279 + struct ffs_ep *eps_ptr;
1280 +diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c
1281 +index df169c8e7225..37ef2ac9cdae 100644
1282 +--- a/drivers/usb/host/ehci-hub.c
1283 ++++ b/drivers/usb/host/ehci-hub.c
1284 +@@ -787,12 +787,12 @@ static struct urb *request_single_step_set_feature_urb(
1285 + atomic_inc(&urb->use_count);
1286 + atomic_inc(&urb->dev->urbnum);
1287 + urb->setup_dma = dma_map_single(
1288 +- hcd->self.controller,
1289 ++ hcd->self.sysdev,
1290 + urb->setup_packet,
1291 + sizeof(struct usb_ctrlrequest),
1292 + DMA_TO_DEVICE);
1293 + urb->transfer_dma = dma_map_single(
1294 +- hcd->self.controller,
1295 ++ hcd->self.sysdev,
1296 + urb->transfer_buffer,
1297 + urb->transfer_buffer_length,
1298 + DMA_FROM_DEVICE);
1299 +diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
1300 +index 44924824fa41..1099465b27f0 100644
1301 +--- a/drivers/usb/host/ohci-hcd.c
1302 ++++ b/drivers/usb/host/ohci-hcd.c
1303 +@@ -73,6 +73,7 @@ static const char hcd_name [] = "ohci_hcd";
1304 +
1305 + #define STATECHANGE_DELAY msecs_to_jiffies(300)
1306 + #define IO_WATCHDOG_DELAY msecs_to_jiffies(275)
1307 ++#define IO_WATCHDOG_OFF 0xffffff00
1308 +
1309 + #include "ohci.h"
1310 + #include "pci-quirks.h"
1311 +@@ -230,7 +231,7 @@ static int ohci_urb_enqueue (
1312 + }
1313 +
1314 + /* Start up the I/O watchdog timer, if it's not running */
1315 +- if (!timer_pending(&ohci->io_watchdog) &&
1316 ++ if (ohci->prev_frame_no == IO_WATCHDOG_OFF &&
1317 + list_empty(&ohci->eds_in_use) &&
1318 + !(ohci->flags & OHCI_QUIRK_QEMU)) {
1319 + ohci->prev_frame_no = ohci_frame_no(ohci);
1320 +@@ -501,6 +502,7 @@ static int ohci_init (struct ohci_hcd *ohci)
1321 +
1322 + setup_timer(&ohci->io_watchdog, io_watchdog_func,
1323 + (unsigned long) ohci);
1324 ++ ohci->prev_frame_no = IO_WATCHDOG_OFF;
1325 +
1326 + ohci->hcca = dma_alloc_coherent (hcd->self.controller,
1327 + sizeof(*ohci->hcca), &ohci->hcca_dma, GFP_KERNEL);
1328 +@@ -730,7 +732,7 @@ static void io_watchdog_func(unsigned long _ohci)
1329 + u32 head;
1330 + struct ed *ed;
1331 + struct td *td, *td_start, *td_next;
1332 +- unsigned frame_no;
1333 ++ unsigned frame_no, prev_frame_no = IO_WATCHDOG_OFF;
1334 + unsigned long flags;
1335 +
1336 + spin_lock_irqsave(&ohci->lock, flags);
1337 +@@ -835,7 +837,7 @@ static void io_watchdog_func(unsigned long _ohci)
1338 + }
1339 + }
1340 + if (!list_empty(&ohci->eds_in_use)) {
1341 +- ohci->prev_frame_no = frame_no;
1342 ++ prev_frame_no = frame_no;
1343 + ohci->prev_wdh_cnt = ohci->wdh_cnt;
1344 + ohci->prev_donehead = ohci_readl(ohci,
1345 + &ohci->regs->donehead);
1346 +@@ -845,6 +847,7 @@ static void io_watchdog_func(unsigned long _ohci)
1347 + }
1348 +
1349 + done:
1350 ++ ohci->prev_frame_no = prev_frame_no;
1351 + spin_unlock_irqrestore(&ohci->lock, flags);
1352 + }
1353 +
1354 +@@ -973,6 +976,7 @@ static void ohci_stop (struct usb_hcd *hcd)
1355 + if (quirk_nec(ohci))
1356 + flush_work(&ohci->nec_work);
1357 + del_timer_sync(&ohci->io_watchdog);
1358 ++ ohci->prev_frame_no = IO_WATCHDOG_OFF;
1359 +
1360 + ohci_writel (ohci, OHCI_INTR_MIE, &ohci->regs->intrdisable);
1361 + ohci_usb_reset(ohci);
1362 +diff --git a/drivers/usb/host/ohci-hub.c b/drivers/usb/host/ohci-hub.c
1363 +index 248eb7702463..aca57bcb9afe 100644
1364 +--- a/drivers/usb/host/ohci-hub.c
1365 ++++ b/drivers/usb/host/ohci-hub.c
1366 +@@ -310,8 +310,10 @@ static int ohci_bus_suspend (struct usb_hcd *hcd)
1367 + rc = ohci_rh_suspend (ohci, 0);
1368 + spin_unlock_irq (&ohci->lock);
1369 +
1370 +- if (rc == 0)
1371 ++ if (rc == 0) {
1372 + del_timer_sync(&ohci->io_watchdog);
1373 ++ ohci->prev_frame_no = IO_WATCHDOG_OFF;
1374 ++ }
1375 + return rc;
1376 + }
1377 +
1378 +diff --git a/drivers/usb/host/ohci-q.c b/drivers/usb/host/ohci-q.c
1379 +index 641fed609911..24edb7674710 100644
1380 +--- a/drivers/usb/host/ohci-q.c
1381 ++++ b/drivers/usb/host/ohci-q.c
1382 +@@ -1018,6 +1018,8 @@ static void finish_unlinks(struct ohci_hcd *ohci)
1383 + * have modified this list. normally it's just prepending
1384 + * entries (which we'd ignore), but paranoia won't hurt.
1385 + */
1386 ++ *last = ed->ed_next;
1387 ++ ed->ed_next = NULL;
1388 + modified = 0;
1389 +
1390 + /* unlink urbs as requested, but rescan the list after
1391 +@@ -1076,21 +1078,22 @@ static void finish_unlinks(struct ohci_hcd *ohci)
1392 + goto rescan_this;
1393 +
1394 + /*
1395 +- * If no TDs are queued, take ED off the ed_rm_list.
1396 ++ * If no TDs are queued, ED is now idle.
1397 + * Otherwise, if the HC is running, reschedule.
1398 +- * If not, leave it on the list for further dequeues.
1399 ++ * If the HC isn't running, add ED back to the
1400 ++ * start of the list for later processing.
1401 + */
1402 + if (list_empty(&ed->td_list)) {
1403 +- *last = ed->ed_next;
1404 +- ed->ed_next = NULL;
1405 + ed->state = ED_IDLE;
1406 + list_del(&ed->in_use_list);
1407 + } else if (ohci->rh_state == OHCI_RH_RUNNING) {
1408 +- *last = ed->ed_next;
1409 +- ed->ed_next = NULL;
1410 + ed_schedule(ohci, ed);
1411 + } else {
1412 +- last = &ed->ed_next;
1413 ++ ed->ed_next = ohci->ed_rm_list;
1414 ++ ohci->ed_rm_list = ed;
1415 ++ /* Don't loop on the same ED */
1416 ++ if (last == &ohci->ed_rm_list)
1417 ++ last = &ed->ed_next;
1418 + }
1419 +
1420 + if (modified)
1421 +diff --git a/drivers/usb/misc/ldusb.c b/drivers/usb/misc/ldusb.c
1422 +index 680bddb3ce05..6635a3c990f6 100644
1423 +--- a/drivers/usb/misc/ldusb.c
1424 ++++ b/drivers/usb/misc/ldusb.c
1425 +@@ -46,6 +46,9 @@
1426 + #define USB_DEVICE_ID_LD_MICROCASSYTIME 0x1033 /* USB Product ID of Micro-CASSY Time (reserved) */
1427 + #define USB_DEVICE_ID_LD_MICROCASSYTEMPERATURE 0x1035 /* USB Product ID of Micro-CASSY Temperature */
1428 + #define USB_DEVICE_ID_LD_MICROCASSYPH 0x1038 /* USB Product ID of Micro-CASSY pH */
1429 ++#define USB_DEVICE_ID_LD_POWERANALYSERCASSY 0x1040 /* USB Product ID of Power Analyser CASSY */
1430 ++#define USB_DEVICE_ID_LD_CONVERTERCONTROLLERCASSY 0x1042 /* USB Product ID of Converter Controller CASSY */
1431 ++#define USB_DEVICE_ID_LD_MACHINETESTCASSY 0x1043 /* USB Product ID of Machine Test CASSY */
1432 + #define USB_DEVICE_ID_LD_JWM 0x1080 /* USB Product ID of Joule and Wattmeter */
1433 + #define USB_DEVICE_ID_LD_DMMP 0x1081 /* USB Product ID of Digital Multimeter P (reserved) */
1434 + #define USB_DEVICE_ID_LD_UMIP 0x1090 /* USB Product ID of UMI P */
1435 +@@ -88,6 +91,9 @@ static const struct usb_device_id ld_usb_table[] = {
1436 + { USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MICROCASSYTIME) },
1437 + { USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MICROCASSYTEMPERATURE) },
1438 + { USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MICROCASSYPH) },
1439 ++ { USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_POWERANALYSERCASSY) },
1440 ++ { USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_CONVERTERCONTROLLERCASSY) },
1441 ++ { USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MACHINETESTCASSY) },
1442 + { USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_JWM) },
1443 + { USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_DMMP) },
1444 + { USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_UMIP) },
1445 +diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c
1446 +index b17450a59882..b5cc08d8aa22 100644
1447 +--- a/drivers/usb/musb/musb_host.c
1448 ++++ b/drivers/usb/musb/musb_host.c
1449 +@@ -418,13 +418,7 @@ static void musb_advance_schedule(struct musb *musb, struct urb *urb,
1450 + }
1451 + }
1452 +
1453 +- /*
1454 +- * The pipe must be broken if current urb->status is set, so don't
1455 +- * start next urb.
1456 +- * TODO: to minimize the risk of regression, only check urb->status
1457 +- * for RX, until we have a test case to understand the behavior of TX.
1458 +- */
1459 +- if ((!status || !is_in) && qh && qh->is_ready) {
1460 ++ if (qh != NULL && qh->is_ready) {
1461 + musb_dbg(musb, "... next ep%d %cX urb %p",
1462 + hw_ep->epnum, is_in ? 'R' : 'T', next_urb(qh));
1463 + musb_start_urb(musb, is_in, qh);
1464 +diff --git a/drivers/usb/renesas_usbhs/fifo.c b/drivers/usb/renesas_usbhs/fifo.c
1465 +index 50285b01da92..5d369b38868a 100644
1466 +--- a/drivers/usb/renesas_usbhs/fifo.c
1467 ++++ b/drivers/usb/renesas_usbhs/fifo.c
1468 +@@ -998,6 +998,10 @@ static int usbhsf_dma_prepare_pop_with_usb_dmac(struct usbhs_pkt *pkt,
1469 + if ((uintptr_t)pkt->buf & (USBHS_USB_DMAC_XFER_SIZE - 1))
1470 + goto usbhsf_pio_prepare_pop;
1471 +
1472 ++ /* return at this time if the pipe is running */
1473 ++ if (usbhs_pipe_is_running(pipe))
1474 ++ return 0;
1475 ++
1476 + usbhs_pipe_config_change_bfre(pipe, 1);
1477 +
1478 + ret = usbhsf_fifo_select(pipe, fifo, 0);
1479 +@@ -1188,6 +1192,7 @@ static int usbhsf_dma_pop_done_with_usb_dmac(struct usbhs_pkt *pkt,
1480 + usbhsf_fifo_clear(pipe, fifo);
1481 + pkt->actual = usbhs_dma_calc_received_size(pkt, chan, rcv_len);
1482 +
1483 ++ usbhs_pipe_running(pipe, 0);
1484 + usbhsf_dma_stop(pipe, fifo);
1485 + usbhsf_dma_unmap(pkt);
1486 + usbhsf_fifo_unselect(pipe, pipe->fifo);
1487 +diff --git a/drivers/xen/tmem.c b/drivers/xen/tmem.c
1488 +index bf13d1ec51f3..04e7b3b29bac 100644
1489 +--- a/drivers/xen/tmem.c
1490 ++++ b/drivers/xen/tmem.c
1491 +@@ -284,6 +284,10 @@ static int tmem_frontswap_store(unsigned type, pgoff_t offset,
1492 + int pool = tmem_frontswap_poolid;
1493 + int ret;
1494 +
1495 ++ /* THP isn't supported */
1496 ++ if (PageTransHuge(page))
1497 ++ return -1;
1498 ++
1499 + if (pool < 0)
1500 + return -1;
1501 + if (ind64 != ind)
1502 +diff --git a/include/linux/kconfig.h b/include/linux/kconfig.h
1503 +index fec5076eda91..dcde9471897d 100644
1504 +--- a/include/linux/kconfig.h
1505 ++++ b/include/linux/kconfig.h
1506 +@@ -4,6 +4,12 @@
1507 +
1508 + #include <generated/autoconf.h>
1509 +
1510 ++#ifdef CONFIG_CPU_BIG_ENDIAN
1511 ++#define __BIG_ENDIAN 4321
1512 ++#else
1513 ++#define __LITTLE_ENDIAN 1234
1514 ++#endif
1515 ++
1516 + #define __ARG_PLACEHOLDER_1 0,
1517 + #define __take_second_arg(__ignored, val, ...) val
1518 +
1519 +@@ -64,4 +70,7 @@
1520 + */
1521 + #define IS_ENABLED(option) __or(IS_BUILTIN(option), IS_MODULE(option))
1522 +
1523 ++/* Make sure we always have all types and struct attributes defined. */
1524 ++#include <linux/compiler_types.h>
1525 ++
1526 + #endif /* __LINUX_KCONFIG_H */
1527 +diff --git a/mm/zswap.c b/mm/zswap.c
1528 +index d39581a076c3..597008a44f70 100644
1529 +--- a/mm/zswap.c
1530 ++++ b/mm/zswap.c
1531 +@@ -970,6 +970,12 @@ static int zswap_frontswap_store(unsigned type, pgoff_t offset,
1532 + u8 *src, *dst;
1533 + struct zswap_header *zhdr;
1534 +
1535 ++ /* THP isn't supported */
1536 ++ if (PageTransHuge(page)) {
1537 ++ ret = -EINVAL;
1538 ++ goto reject;
1539 ++ }
1540 ++
1541 + if (!zswap_enabled || !tree) {
1542 + ret = -ENODEV;
1543 + goto reject;
1544 +diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c
1545 +index c7df4969f80a..f56aab54e0c8 100644
1546 +--- a/net/ipv4/ip_sockglue.c
1547 ++++ b/net/ipv4/ip_sockglue.c
1548 +@@ -1563,10 +1563,7 @@ int ip_getsockopt(struct sock *sk, int level,
1549 + if (get_user(len, optlen))
1550 + return -EFAULT;
1551 +
1552 +- lock_sock(sk);
1553 +- err = nf_getsockopt(sk, PF_INET, optname, optval,
1554 +- &len);
1555 +- release_sock(sk);
1556 ++ err = nf_getsockopt(sk, PF_INET, optname, optval, &len);
1557 + if (err >= 0)
1558 + err = put_user(len, optlen);
1559 + return err;
1560 +@@ -1598,9 +1595,7 @@ int compat_ip_getsockopt(struct sock *sk, int level, int optname,
1561 + if (get_user(len, optlen))
1562 + return -EFAULT;
1563 +
1564 +- lock_sock(sk);
1565 + err = compat_nf_getsockopt(sk, PF_INET, optname, optval, &len);
1566 +- release_sock(sk);
1567 + if (err >= 0)
1568 + err = put_user(len, optlen);
1569 + return err;
1570 +diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c
1571 +index 24b69384bdbf..1276d5bd5675 100644
1572 +--- a/net/ipv6/ipv6_sockglue.c
1573 ++++ b/net/ipv6/ipv6_sockglue.c
1574 +@@ -1355,10 +1355,7 @@ int ipv6_getsockopt(struct sock *sk, int level, int optname,
1575 + if (get_user(len, optlen))
1576 + return -EFAULT;
1577 +
1578 +- lock_sock(sk);
1579 +- err = nf_getsockopt(sk, PF_INET6, optname, optval,
1580 +- &len);
1581 +- release_sock(sk);
1582 ++ err = nf_getsockopt(sk, PF_INET6, optname, optval, &len);
1583 + if (err >= 0)
1584 + err = put_user(len, optlen);
1585 + }
1586 +@@ -1397,10 +1394,7 @@ int compat_ipv6_getsockopt(struct sock *sk, int level, int optname,
1587 + if (get_user(len, optlen))
1588 + return -EFAULT;
1589 +
1590 +- lock_sock(sk);
1591 +- err = compat_nf_getsockopt(sk, PF_INET6,
1592 +- optname, optval, &len);
1593 +- release_sock(sk);
1594 ++ err = compat_nf_getsockopt(sk, PF_INET6, optname, optval, &len);
1595 + if (err >= 0)
1596 + err = put_user(len, optlen);
1597 + }
1598 +diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
1599 +index fb15d3b97cb2..84f757c5d91a 100644
1600 +--- a/net/mac80211/cfg.c
1601 ++++ b/net/mac80211/cfg.c
1602 +@@ -2863,7 +2863,7 @@ cfg80211_beacon_dup(struct cfg80211_beacon_data *beacon)
1603 + }
1604 + if (beacon->probe_resp_len) {
1605 + new_beacon->probe_resp_len = beacon->probe_resp_len;
1606 +- beacon->probe_resp = pos;
1607 ++ new_beacon->probe_resp = pos;
1608 + memcpy(pos, beacon->probe_resp, beacon->probe_resp_len);
1609 + pos += beacon->probe_resp_len;
1610 + }