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