Annotation of /trunk/kernel-magellan/patches-4.19/0105-4.19.6-all-fixes.patch
Parent Directory | Revision Log
Revision 3267 -
(hide annotations)
(download)
Wed Dec 12 10:30:55 2018 UTC (5 years, 9 months ago) by niro
File size: 156483 byte(s)
Wed Dec 12 10:30:55 2018 UTC (5 years, 9 months ago) by niro
File size: 156483 byte(s)
-linux-4.19.6
1 | niro | 3267 | diff --git a/Documentation/admin-guide/security-bugs.rst b/Documentation/admin-guide/security-bugs.rst |
2 | index 30491d91e93d..30187d49dc2c 100644 | ||
3 | --- a/Documentation/admin-guide/security-bugs.rst | ||
4 | +++ b/Documentation/admin-guide/security-bugs.rst | ||
5 | @@ -26,23 +26,35 @@ information is helpful. Any exploit code is very helpful and will not | ||
6 | be released without consent from the reporter unless it has already been | ||
7 | made public. | ||
8 | |||
9 | -Disclosure | ||
10 | ----------- | ||
11 | - | ||
12 | -The goal of the Linux kernel security team is to work with the bug | ||
13 | -submitter to understand and fix the bug. We prefer to publish the fix as | ||
14 | -soon as possible, but try to avoid public discussion of the bug itself | ||
15 | -and leave that to others. | ||
16 | - | ||
17 | -Publishing the fix may be delayed when the bug or the fix is not yet | ||
18 | -fully understood, the solution is not well-tested or for vendor | ||
19 | -coordination. However, we expect these delays to be short, measurable in | ||
20 | -days, not weeks or months. A release date is negotiated by the security | ||
21 | -team working with the bug submitter as well as vendors. However, the | ||
22 | -kernel security team holds the final say when setting a timeframe. The | ||
23 | -timeframe varies from immediate (esp. if it's already publicly known bug) | ||
24 | -to a few weeks. As a basic default policy, we expect report date to | ||
25 | -release date to be on the order of 7 days. | ||
26 | +Disclosure and embargoed information | ||
27 | +------------------------------------ | ||
28 | + | ||
29 | +The security list is not a disclosure channel. For that, see Coordination | ||
30 | +below. | ||
31 | + | ||
32 | +Once a robust fix has been developed, the release process starts. Fixes | ||
33 | +for publicly known bugs are released immediately. | ||
34 | + | ||
35 | +Although our preference is to release fixes for publicly undisclosed bugs | ||
36 | +as soon as they become available, this may be postponed at the request of | ||
37 | +the reporter or an affected party for up to 7 calendar days from the start | ||
38 | +of the release process, with an exceptional extension to 14 calendar days | ||
39 | +if it is agreed that the criticality of the bug requires more time. The | ||
40 | +only valid reason for deferring the publication of a fix is to accommodate | ||
41 | +the logistics of QA and large scale rollouts which require release | ||
42 | +coordination. | ||
43 | + | ||
44 | +Whilst embargoed information may be shared with trusted individuals in | ||
45 | +order to develop a fix, such information will not be published alongside | ||
46 | +the fix or on any other disclosure channel without the permission of the | ||
47 | +reporter. This includes but is not limited to the original bug report | ||
48 | +and followup discussions (if any), exploits, CVE information or the | ||
49 | +identity of the reporter. | ||
50 | + | ||
51 | +In other words our only interest is in getting bugs fixed. All other | ||
52 | +information submitted to the security list and any followup discussions | ||
53 | +of the report are treated confidentially even after the embargo has been | ||
54 | +lifted, in perpetuity. | ||
55 | |||
56 | Coordination | ||
57 | ------------ | ||
58 | @@ -68,7 +80,7 @@ may delay the bug handling. If a reporter wishes to have a CVE identifier | ||
59 | assigned ahead of public disclosure, they will need to contact the private | ||
60 | linux-distros list, described above. When such a CVE identifier is known | ||
61 | before a patch is provided, it is desirable to mention it in the commit | ||
62 | -message, though. | ||
63 | +message if the reporter agrees. | ||
64 | |||
65 | Non-disclosure agreements | ||
66 | ------------------------- | ||
67 | diff --git a/Documentation/devicetree/bindings/net/can/holt_hi311x.txt b/Documentation/devicetree/bindings/net/can/holt_hi311x.txt | ||
68 | index 903a78da65be..3a9926f99937 100644 | ||
69 | --- a/Documentation/devicetree/bindings/net/can/holt_hi311x.txt | ||
70 | +++ b/Documentation/devicetree/bindings/net/can/holt_hi311x.txt | ||
71 | @@ -17,7 +17,7 @@ Example: | ||
72 | reg = <1>; | ||
73 | clocks = <&clk32m>; | ||
74 | interrupt-parent = <&gpio4>; | ||
75 | - interrupts = <13 IRQ_TYPE_EDGE_RISING>; | ||
76 | + interrupts = <13 IRQ_TYPE_LEVEL_HIGH>; | ||
77 | vdd-supply = <®5v0>; | ||
78 | xceiver-supply = <®5v0>; | ||
79 | }; | ||
80 | diff --git a/MAINTAINERS b/MAINTAINERS | ||
81 | index b2f710eee67a..9e9b19ecf6f7 100644 | ||
82 | --- a/MAINTAINERS | ||
83 | +++ b/MAINTAINERS | ||
84 | @@ -13769,6 +13769,7 @@ F: drivers/i2c/busses/i2c-stm32* | ||
85 | |||
86 | STABLE BRANCH | ||
87 | M: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | ||
88 | +M: Sasha Levin <sashal@kernel.org> | ||
89 | L: stable@vger.kernel.org | ||
90 | S: Supported | ||
91 | F: Documentation/process/stable-kernel-rules.rst | ||
92 | diff --git a/Makefile b/Makefile | ||
93 | index a07830185bdf..20cbb8e84650 100644 | ||
94 | --- a/Makefile | ||
95 | +++ b/Makefile | ||
96 | @@ -1,7 +1,7 @@ | ||
97 | # SPDX-License-Identifier: GPL-2.0 | ||
98 | VERSION = 4 | ||
99 | PATCHLEVEL = 19 | ||
100 | -SUBLEVEL = 5 | ||
101 | +SUBLEVEL = 6 | ||
102 | EXTRAVERSION = | ||
103 | NAME = "People's Front" | ||
104 | |||
105 | diff --git a/arch/powerpc/include/asm/io.h b/arch/powerpc/include/asm/io.h | ||
106 | index e0331e754568..b855f56489ac 100644 | ||
107 | --- a/arch/powerpc/include/asm/io.h | ||
108 | +++ b/arch/powerpc/include/asm/io.h | ||
109 | @@ -285,19 +285,13 @@ extern void _memcpy_toio(volatile void __iomem *dest, const void *src, | ||
110 | * their hooks, a bitfield is reserved for use by the platform near the | ||
111 | * top of MMIO addresses (not PIO, those have to cope the hard way). | ||
112 | * | ||
113 | - * This bit field is 12 bits and is at the top of the IO virtual | ||
114 | - * addresses PCI_IO_INDIRECT_TOKEN_MASK. | ||
115 | + * The highest address in the kernel virtual space are: | ||
116 | * | ||
117 | - * The kernel virtual space is thus: | ||
118 | + * d0003fffffffffff # with Hash MMU | ||
119 | + * c00fffffffffffff # with Radix MMU | ||
120 | * | ||
121 | - * 0xD000000000000000 : vmalloc | ||
122 | - * 0xD000080000000000 : PCI PHB IO space | ||
123 | - * 0xD000080080000000 : ioremap | ||
124 | - * 0xD0000fffffffffff : end of ioremap region | ||
125 | - * | ||
126 | - * Since the top 4 bits are reserved as the region ID, we use thus | ||
127 | - * the next 12 bits and keep 4 bits available for the future if the | ||
128 | - * virtual address space is ever to be extended. | ||
129 | + * The top 4 bits are reserved as the region ID on hash, leaving us 8 bits | ||
130 | + * that can be used for the field. | ||
131 | * | ||
132 | * The direct IO mapping operations will then mask off those bits | ||
133 | * before doing the actual access, though that only happen when | ||
134 | @@ -309,8 +303,8 @@ extern void _memcpy_toio(volatile void __iomem *dest, const void *src, | ||
135 | */ | ||
136 | |||
137 | #ifdef CONFIG_PPC_INDIRECT_MMIO | ||
138 | -#define PCI_IO_IND_TOKEN_MASK 0x0fff000000000000ul | ||
139 | -#define PCI_IO_IND_TOKEN_SHIFT 48 | ||
140 | +#define PCI_IO_IND_TOKEN_SHIFT 52 | ||
141 | +#define PCI_IO_IND_TOKEN_MASK (0xfful << PCI_IO_IND_TOKEN_SHIFT) | ||
142 | #define PCI_FIX_ADDR(addr) \ | ||
143 | ((PCI_IO_ADDR)(((unsigned long)(addr)) & ~PCI_IO_IND_TOKEN_MASK)) | ||
144 | #define PCI_GET_ADDR_TOKEN(addr) \ | ||
145 | diff --git a/arch/powerpc/kvm/trace.h b/arch/powerpc/kvm/trace.h | ||
146 | index 491b0f715d6b..ea1d7c808319 100644 | ||
147 | --- a/arch/powerpc/kvm/trace.h | ||
148 | +++ b/arch/powerpc/kvm/trace.h | ||
149 | @@ -6,8 +6,6 @@ | ||
150 | |||
151 | #undef TRACE_SYSTEM | ||
152 | #define TRACE_SYSTEM kvm | ||
153 | -#define TRACE_INCLUDE_PATH . | ||
154 | -#define TRACE_INCLUDE_FILE trace | ||
155 | |||
156 | /* | ||
157 | * Tracepoint for guest mode entry. | ||
158 | @@ -120,4 +118,10 @@ TRACE_EVENT(kvm_check_requests, | ||
159 | #endif /* _TRACE_KVM_H */ | ||
160 | |||
161 | /* This part must be outside protection */ | ||
162 | +#undef TRACE_INCLUDE_PATH | ||
163 | +#undef TRACE_INCLUDE_FILE | ||
164 | + | ||
165 | +#define TRACE_INCLUDE_PATH . | ||
166 | +#define TRACE_INCLUDE_FILE trace | ||
167 | + | ||
168 | #include <trace/define_trace.h> | ||
169 | diff --git a/arch/powerpc/kvm/trace_booke.h b/arch/powerpc/kvm/trace_booke.h | ||
170 | index ac640e81fdc5..3837842986aa 100644 | ||
171 | --- a/arch/powerpc/kvm/trace_booke.h | ||
172 | +++ b/arch/powerpc/kvm/trace_booke.h | ||
173 | @@ -6,8 +6,6 @@ | ||
174 | |||
175 | #undef TRACE_SYSTEM | ||
176 | #define TRACE_SYSTEM kvm_booke | ||
177 | -#define TRACE_INCLUDE_PATH . | ||
178 | -#define TRACE_INCLUDE_FILE trace_booke | ||
179 | |||
180 | #define kvm_trace_symbol_exit \ | ||
181 | {0, "CRITICAL"}, \ | ||
182 | @@ -218,4 +216,11 @@ TRACE_EVENT(kvm_booke_queue_irqprio, | ||
183 | #endif | ||
184 | |||
185 | /* This part must be outside protection */ | ||
186 | + | ||
187 | +#undef TRACE_INCLUDE_PATH | ||
188 | +#undef TRACE_INCLUDE_FILE | ||
189 | + | ||
190 | +#define TRACE_INCLUDE_PATH . | ||
191 | +#define TRACE_INCLUDE_FILE trace_booke | ||
192 | + | ||
193 | #include <trace/define_trace.h> | ||
194 | diff --git a/arch/powerpc/kvm/trace_hv.h b/arch/powerpc/kvm/trace_hv.h | ||
195 | index bcfe8a987f6a..8a1e3b0047f1 100644 | ||
196 | --- a/arch/powerpc/kvm/trace_hv.h | ||
197 | +++ b/arch/powerpc/kvm/trace_hv.h | ||
198 | @@ -9,8 +9,6 @@ | ||
199 | |||
200 | #undef TRACE_SYSTEM | ||
201 | #define TRACE_SYSTEM kvm_hv | ||
202 | -#define TRACE_INCLUDE_PATH . | ||
203 | -#define TRACE_INCLUDE_FILE trace_hv | ||
204 | |||
205 | #define kvm_trace_symbol_hcall \ | ||
206 | {H_REMOVE, "H_REMOVE"}, \ | ||
207 | @@ -497,4 +495,11 @@ TRACE_EVENT(kvmppc_run_vcpu_exit, | ||
208 | #endif /* _TRACE_KVM_HV_H */ | ||
209 | |||
210 | /* This part must be outside protection */ | ||
211 | + | ||
212 | +#undef TRACE_INCLUDE_PATH | ||
213 | +#undef TRACE_INCLUDE_FILE | ||
214 | + | ||
215 | +#define TRACE_INCLUDE_PATH . | ||
216 | +#define TRACE_INCLUDE_FILE trace_hv | ||
217 | + | ||
218 | #include <trace/define_trace.h> | ||
219 | diff --git a/arch/powerpc/kvm/trace_pr.h b/arch/powerpc/kvm/trace_pr.h | ||
220 | index 2f9a8829552b..46a46d328fbf 100644 | ||
221 | --- a/arch/powerpc/kvm/trace_pr.h | ||
222 | +++ b/arch/powerpc/kvm/trace_pr.h | ||
223 | @@ -8,8 +8,6 @@ | ||
224 | |||
225 | #undef TRACE_SYSTEM | ||
226 | #define TRACE_SYSTEM kvm_pr | ||
227 | -#define TRACE_INCLUDE_PATH . | ||
228 | -#define TRACE_INCLUDE_FILE trace_pr | ||
229 | |||
230 | TRACE_EVENT(kvm_book3s_reenter, | ||
231 | TP_PROTO(int r, struct kvm_vcpu *vcpu), | ||
232 | @@ -257,4 +255,11 @@ TRACE_EVENT(kvm_exit, | ||
233 | #endif /* _TRACE_KVM_H */ | ||
234 | |||
235 | /* This part must be outside protection */ | ||
236 | + | ||
237 | +#undef TRACE_INCLUDE_PATH | ||
238 | +#undef TRACE_INCLUDE_FILE | ||
239 | + | ||
240 | +#define TRACE_INCLUDE_PATH . | ||
241 | +#define TRACE_INCLUDE_FILE trace_pr | ||
242 | + | ||
243 | #include <trace/define_trace.h> | ||
244 | diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c | ||
245 | index 055b211b7126..5500e4edabc6 100644 | ||
246 | --- a/arch/powerpc/mm/numa.c | ||
247 | +++ b/arch/powerpc/mm/numa.c | ||
248 | @@ -1179,7 +1179,7 @@ static long vphn_get_associativity(unsigned long cpu, | ||
249 | |||
250 | switch (rc) { | ||
251 | case H_FUNCTION: | ||
252 | - printk(KERN_INFO | ||
253 | + printk_once(KERN_INFO | ||
254 | "VPHN is not supported. Disabling polling...\n"); | ||
255 | stop_topology_update(); | ||
256 | break; | ||
257 | diff --git a/arch/riscv/Makefile b/arch/riscv/Makefile | ||
258 | index 61ec42405ec9..110be14e6122 100644 | ||
259 | --- a/arch/riscv/Makefile | ||
260 | +++ b/arch/riscv/Makefile | ||
261 | @@ -82,4 +82,8 @@ core-y += arch/riscv/kernel/ arch/riscv/mm/ | ||
262 | |||
263 | libs-y += arch/riscv/lib/ | ||
264 | |||
265 | +PHONY += vdso_install | ||
266 | +vdso_install: | ||
267 | + $(Q)$(MAKE) $(build)=arch/riscv/kernel/vdso $@ | ||
268 | + | ||
269 | all: vmlinux | ||
270 | diff --git a/arch/riscv/kernel/module.c b/arch/riscv/kernel/module.c | ||
271 | index 3303ed2cd419..7dd308129b40 100644 | ||
272 | --- a/arch/riscv/kernel/module.c | ||
273 | +++ b/arch/riscv/kernel/module.c | ||
274 | @@ -21,7 +21,7 @@ static int apply_r_riscv_32_rela(struct module *me, u32 *location, Elf_Addr v) | ||
275 | { | ||
276 | if (v != (u32)v) { | ||
277 | pr_err("%s: value %016llx out of range for 32-bit field\n", | ||
278 | - me->name, v); | ||
279 | + me->name, (long long)v); | ||
280 | return -EINVAL; | ||
281 | } | ||
282 | *location = v; | ||
283 | @@ -102,7 +102,7 @@ static int apply_r_riscv_pcrel_hi20_rela(struct module *me, u32 *location, | ||
284 | if (offset != (s32)offset) { | ||
285 | pr_err( | ||
286 | "%s: target %016llx can not be addressed by the 32-bit offset from PC = %p\n", | ||
287 | - me->name, v, location); | ||
288 | + me->name, (long long)v, location); | ||
289 | return -EINVAL; | ||
290 | } | ||
291 | |||
292 | @@ -144,7 +144,7 @@ static int apply_r_riscv_hi20_rela(struct module *me, u32 *location, | ||
293 | if (IS_ENABLED(CMODEL_MEDLOW)) { | ||
294 | pr_err( | ||
295 | "%s: target %016llx can not be addressed by the 32-bit offset from PC = %p\n", | ||
296 | - me->name, v, location); | ||
297 | + me->name, (long long)v, location); | ||
298 | return -EINVAL; | ||
299 | } | ||
300 | |||
301 | @@ -188,7 +188,7 @@ static int apply_r_riscv_got_hi20_rela(struct module *me, u32 *location, | ||
302 | } else { | ||
303 | pr_err( | ||
304 | "%s: can not generate the GOT entry for symbol = %016llx from PC = %p\n", | ||
305 | - me->name, v, location); | ||
306 | + me->name, (long long)v, location); | ||
307 | return -EINVAL; | ||
308 | } | ||
309 | |||
310 | @@ -212,7 +212,7 @@ static int apply_r_riscv_call_plt_rela(struct module *me, u32 *location, | ||
311 | } else { | ||
312 | pr_err( | ||
313 | "%s: target %016llx can not be addressed by the 32-bit offset from PC = %p\n", | ||
314 | - me->name, v, location); | ||
315 | + me->name, (long long)v, location); | ||
316 | return -EINVAL; | ||
317 | } | ||
318 | } | ||
319 | @@ -234,7 +234,7 @@ static int apply_r_riscv_call_rela(struct module *me, u32 *location, | ||
320 | if (offset != fill_v) { | ||
321 | pr_err( | ||
322 | "%s: target %016llx can not be addressed by the 32-bit offset from PC = %p\n", | ||
323 | - me->name, v, location); | ||
324 | + me->name, (long long)v, location); | ||
325 | return -EINVAL; | ||
326 | } | ||
327 | |||
328 | diff --git a/arch/x86/events/intel/uncore_snb.c b/arch/x86/events/intel/uncore_snb.c | ||
329 | index 8527c3e1038b..bfa25814fe5f 100644 | ||
330 | --- a/arch/x86/events/intel/uncore_snb.c | ||
331 | +++ b/arch/x86/events/intel/uncore_snb.c | ||
332 | @@ -15,6 +15,25 @@ | ||
333 | #define PCI_DEVICE_ID_INTEL_SKL_HQ_IMC 0x1910 | ||
334 | #define PCI_DEVICE_ID_INTEL_SKL_SD_IMC 0x190f | ||
335 | #define PCI_DEVICE_ID_INTEL_SKL_SQ_IMC 0x191f | ||
336 | +#define PCI_DEVICE_ID_INTEL_KBL_Y_IMC 0x590c | ||
337 | +#define PCI_DEVICE_ID_INTEL_KBL_U_IMC 0x5904 | ||
338 | +#define PCI_DEVICE_ID_INTEL_KBL_UQ_IMC 0x5914 | ||
339 | +#define PCI_DEVICE_ID_INTEL_KBL_SD_IMC 0x590f | ||
340 | +#define PCI_DEVICE_ID_INTEL_KBL_SQ_IMC 0x591f | ||
341 | +#define PCI_DEVICE_ID_INTEL_CFL_2U_IMC 0x3ecc | ||
342 | +#define PCI_DEVICE_ID_INTEL_CFL_4U_IMC 0x3ed0 | ||
343 | +#define PCI_DEVICE_ID_INTEL_CFL_4H_IMC 0x3e10 | ||
344 | +#define PCI_DEVICE_ID_INTEL_CFL_6H_IMC 0x3ec4 | ||
345 | +#define PCI_DEVICE_ID_INTEL_CFL_2S_D_IMC 0x3e0f | ||
346 | +#define PCI_DEVICE_ID_INTEL_CFL_4S_D_IMC 0x3e1f | ||
347 | +#define PCI_DEVICE_ID_INTEL_CFL_6S_D_IMC 0x3ec2 | ||
348 | +#define PCI_DEVICE_ID_INTEL_CFL_8S_D_IMC 0x3e30 | ||
349 | +#define PCI_DEVICE_ID_INTEL_CFL_4S_W_IMC 0x3e18 | ||
350 | +#define PCI_DEVICE_ID_INTEL_CFL_6S_W_IMC 0x3ec6 | ||
351 | +#define PCI_DEVICE_ID_INTEL_CFL_8S_W_IMC 0x3e31 | ||
352 | +#define PCI_DEVICE_ID_INTEL_CFL_4S_S_IMC 0x3e33 | ||
353 | +#define PCI_DEVICE_ID_INTEL_CFL_6S_S_IMC 0x3eca | ||
354 | +#define PCI_DEVICE_ID_INTEL_CFL_8S_S_IMC 0x3e32 | ||
355 | |||
356 | /* SNB event control */ | ||
357 | #define SNB_UNC_CTL_EV_SEL_MASK 0x000000ff | ||
358 | @@ -569,7 +588,82 @@ static const struct pci_device_id skl_uncore_pci_ids[] = { | ||
359 | PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_SKL_SQ_IMC), | ||
360 | .driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0), | ||
361 | }, | ||
362 | - | ||
363 | + { /* IMC */ | ||
364 | + PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_KBL_Y_IMC), | ||
365 | + .driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0), | ||
366 | + }, | ||
367 | + { /* IMC */ | ||
368 | + PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_KBL_U_IMC), | ||
369 | + .driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0), | ||
370 | + }, | ||
371 | + { /* IMC */ | ||
372 | + PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_KBL_UQ_IMC), | ||
373 | + .driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0), | ||
374 | + }, | ||
375 | + { /* IMC */ | ||
376 | + PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_KBL_SD_IMC), | ||
377 | + .driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0), | ||
378 | + }, | ||
379 | + { /* IMC */ | ||
380 | + PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_KBL_SQ_IMC), | ||
381 | + .driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0), | ||
382 | + }, | ||
383 | + { /* IMC */ | ||
384 | + PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_CFL_2U_IMC), | ||
385 | + .driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0), | ||
386 | + }, | ||
387 | + { /* IMC */ | ||
388 | + PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_CFL_4U_IMC), | ||
389 | + .driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0), | ||
390 | + }, | ||
391 | + { /* IMC */ | ||
392 | + PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_CFL_4H_IMC), | ||
393 | + .driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0), | ||
394 | + }, | ||
395 | + { /* IMC */ | ||
396 | + PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_CFL_6H_IMC), | ||
397 | + .driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0), | ||
398 | + }, | ||
399 | + { /* IMC */ | ||
400 | + PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_CFL_2S_D_IMC), | ||
401 | + .driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0), | ||
402 | + }, | ||
403 | + { /* IMC */ | ||
404 | + PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_CFL_4S_D_IMC), | ||
405 | + .driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0), | ||
406 | + }, | ||
407 | + { /* IMC */ | ||
408 | + PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_CFL_6S_D_IMC), | ||
409 | + .driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0), | ||
410 | + }, | ||
411 | + { /* IMC */ | ||
412 | + PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_CFL_8S_D_IMC), | ||
413 | + .driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0), | ||
414 | + }, | ||
415 | + { /* IMC */ | ||
416 | + PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_CFL_4S_W_IMC), | ||
417 | + .driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0), | ||
418 | + }, | ||
419 | + { /* IMC */ | ||
420 | + PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_CFL_6S_W_IMC), | ||
421 | + .driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0), | ||
422 | + }, | ||
423 | + { /* IMC */ | ||
424 | + PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_CFL_8S_W_IMC), | ||
425 | + .driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0), | ||
426 | + }, | ||
427 | + { /* IMC */ | ||
428 | + PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_CFL_4S_S_IMC), | ||
429 | + .driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0), | ||
430 | + }, | ||
431 | + { /* IMC */ | ||
432 | + PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_CFL_6S_S_IMC), | ||
433 | + .driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0), | ||
434 | + }, | ||
435 | + { /* IMC */ | ||
436 | + PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_CFL_8S_S_IMC), | ||
437 | + .driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0), | ||
438 | + }, | ||
439 | { /* end: all zeroes */ }, | ||
440 | }; | ||
441 | |||
442 | @@ -618,6 +712,25 @@ static const struct imc_uncore_pci_dev desktop_imc_pci_ids[] = { | ||
443 | IMC_DEV(SKL_HQ_IMC, &skl_uncore_pci_driver), /* 6th Gen Core H Quad Core */ | ||
444 | IMC_DEV(SKL_SD_IMC, &skl_uncore_pci_driver), /* 6th Gen Core S Dual Core */ | ||
445 | IMC_DEV(SKL_SQ_IMC, &skl_uncore_pci_driver), /* 6th Gen Core S Quad Core */ | ||
446 | + IMC_DEV(KBL_Y_IMC, &skl_uncore_pci_driver), /* 7th Gen Core Y */ | ||
447 | + IMC_DEV(KBL_U_IMC, &skl_uncore_pci_driver), /* 7th Gen Core U */ | ||
448 | + IMC_DEV(KBL_UQ_IMC, &skl_uncore_pci_driver), /* 7th Gen Core U Quad Core */ | ||
449 | + IMC_DEV(KBL_SD_IMC, &skl_uncore_pci_driver), /* 7th Gen Core S Dual Core */ | ||
450 | + IMC_DEV(KBL_SQ_IMC, &skl_uncore_pci_driver), /* 7th Gen Core S Quad Core */ | ||
451 | + IMC_DEV(CFL_2U_IMC, &skl_uncore_pci_driver), /* 8th Gen Core U 2 Cores */ | ||
452 | + IMC_DEV(CFL_4U_IMC, &skl_uncore_pci_driver), /* 8th Gen Core U 4 Cores */ | ||
453 | + IMC_DEV(CFL_4H_IMC, &skl_uncore_pci_driver), /* 8th Gen Core H 4 Cores */ | ||
454 | + IMC_DEV(CFL_6H_IMC, &skl_uncore_pci_driver), /* 8th Gen Core H 6 Cores */ | ||
455 | + IMC_DEV(CFL_2S_D_IMC, &skl_uncore_pci_driver), /* 8th Gen Core S 2 Cores Desktop */ | ||
456 | + IMC_DEV(CFL_4S_D_IMC, &skl_uncore_pci_driver), /* 8th Gen Core S 4 Cores Desktop */ | ||
457 | + IMC_DEV(CFL_6S_D_IMC, &skl_uncore_pci_driver), /* 8th Gen Core S 6 Cores Desktop */ | ||
458 | + IMC_DEV(CFL_8S_D_IMC, &skl_uncore_pci_driver), /* 8th Gen Core S 8 Cores Desktop */ | ||
459 | + IMC_DEV(CFL_4S_W_IMC, &skl_uncore_pci_driver), /* 8th Gen Core S 4 Cores Work Station */ | ||
460 | + IMC_DEV(CFL_6S_W_IMC, &skl_uncore_pci_driver), /* 8th Gen Core S 6 Cores Work Station */ | ||
461 | + IMC_DEV(CFL_8S_W_IMC, &skl_uncore_pci_driver), /* 8th Gen Core S 8 Cores Work Station */ | ||
462 | + IMC_DEV(CFL_4S_S_IMC, &skl_uncore_pci_driver), /* 8th Gen Core S 4 Cores Server */ | ||
463 | + IMC_DEV(CFL_6S_S_IMC, &skl_uncore_pci_driver), /* 8th Gen Core S 6 Cores Server */ | ||
464 | + IMC_DEV(CFL_8S_S_IMC, &skl_uncore_pci_driver), /* 8th Gen Core S 8 Cores Server */ | ||
465 | { /* end marker */ } | ||
466 | }; | ||
467 | |||
468 | diff --git a/block/bio.c b/block/bio.c | ||
469 | index 41173710430c..c4ef8aa46452 100644 | ||
470 | --- a/block/bio.c | ||
471 | +++ b/block/bio.c | ||
472 | @@ -605,6 +605,7 @@ void __bio_clone_fast(struct bio *bio, struct bio *bio_src) | ||
473 | if (bio_flagged(bio_src, BIO_THROTTLED)) | ||
474 | bio_set_flag(bio, BIO_THROTTLED); | ||
475 | bio->bi_opf = bio_src->bi_opf; | ||
476 | + bio->bi_ioprio = bio_src->bi_ioprio; | ||
477 | bio->bi_write_hint = bio_src->bi_write_hint; | ||
478 | bio->bi_iter = bio_src->bi_iter; | ||
479 | bio->bi_io_vec = bio_src->bi_io_vec; | ||
480 | diff --git a/block/bounce.c b/block/bounce.c | ||
481 | index 418677dcec60..abb50e7e5fab 100644 | ||
482 | --- a/block/bounce.c | ||
483 | +++ b/block/bounce.c | ||
484 | @@ -248,6 +248,7 @@ static struct bio *bounce_clone_bio(struct bio *bio_src, gfp_t gfp_mask, | ||
485 | return NULL; | ||
486 | bio->bi_disk = bio_src->bi_disk; | ||
487 | bio->bi_opf = bio_src->bi_opf; | ||
488 | + bio->bi_ioprio = bio_src->bi_ioprio; | ||
489 | bio->bi_write_hint = bio_src->bi_write_hint; | ||
490 | bio->bi_iter.bi_sector = bio_src->bi_iter.bi_sector; | ||
491 | bio->bi_iter.bi_size = bio_src->bi_iter.bi_size; | ||
492 | diff --git a/crypto/simd.c b/crypto/simd.c | ||
493 | index ea7240be3001..78e8d037ae2b 100644 | ||
494 | --- a/crypto/simd.c | ||
495 | +++ b/crypto/simd.c | ||
496 | @@ -124,8 +124,9 @@ static int simd_skcipher_init(struct crypto_skcipher *tfm) | ||
497 | |||
498 | ctx->cryptd_tfm = cryptd_tfm; | ||
499 | |||
500 | - reqsize = sizeof(struct skcipher_request); | ||
501 | - reqsize += crypto_skcipher_reqsize(&cryptd_tfm->base); | ||
502 | + reqsize = crypto_skcipher_reqsize(cryptd_skcipher_child(cryptd_tfm)); | ||
503 | + reqsize = max(reqsize, crypto_skcipher_reqsize(&cryptd_tfm->base)); | ||
504 | + reqsize += sizeof(struct skcipher_request); | ||
505 | |||
506 | crypto_skcipher_set_reqsize(tfm, reqsize); | ||
507 | |||
508 | diff --git a/drivers/acpi/acpica/dsopcode.c b/drivers/acpi/acpica/dsopcode.c | ||
509 | index e9fb0bf3c8d2..78f9de260d5f 100644 | ||
510 | --- a/drivers/acpi/acpica/dsopcode.c | ||
511 | +++ b/drivers/acpi/acpica/dsopcode.c | ||
512 | @@ -417,6 +417,10 @@ acpi_ds_eval_region_operands(struct acpi_walk_state *walk_state, | ||
513 | ACPI_FORMAT_UINT64(obj_desc->region.address), | ||
514 | obj_desc->region.length)); | ||
515 | |||
516 | + status = acpi_ut_add_address_range(obj_desc->region.space_id, | ||
517 | + obj_desc->region.address, | ||
518 | + obj_desc->region.length, node); | ||
519 | + | ||
520 | /* Now the address and length are valid for this opregion */ | ||
521 | |||
522 | obj_desc->region.flags |= AOPOBJ_DATA_VALID; | ||
523 | diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c | ||
524 | index f2b6f4da1034..fdabd0b74492 100644 | ||
525 | --- a/drivers/block/floppy.c | ||
526 | +++ b/drivers/block/floppy.c | ||
527 | @@ -4151,10 +4151,11 @@ static int __floppy_read_block_0(struct block_device *bdev, int drive) | ||
528 | bio.bi_end_io = floppy_rb0_cb; | ||
529 | bio_set_op_attrs(&bio, REQ_OP_READ, 0); | ||
530 | |||
531 | + init_completion(&cbdata.complete); | ||
532 | + | ||
533 | submit_bio(&bio); | ||
534 | process_fd_request(); | ||
535 | |||
536 | - init_completion(&cbdata.complete); | ||
537 | wait_for_completion(&cbdata.complete); | ||
538 | |||
539 | __free_page(page); | ||
540 | diff --git a/drivers/cpufreq/imx6q-cpufreq.c b/drivers/cpufreq/imx6q-cpufreq.c | ||
541 | index b2ff423ad7f8..f4880a4f865b 100644 | ||
542 | --- a/drivers/cpufreq/imx6q-cpufreq.c | ||
543 | +++ b/drivers/cpufreq/imx6q-cpufreq.c | ||
544 | @@ -159,8 +159,13 @@ static int imx6q_set_target(struct cpufreq_policy *policy, unsigned int index) | ||
545 | /* Ensure the arm clock divider is what we expect */ | ||
546 | ret = clk_set_rate(clks[ARM].clk, new_freq * 1000); | ||
547 | if (ret) { | ||
548 | + int ret1; | ||
549 | + | ||
550 | dev_err(cpu_dev, "failed to set clock rate: %d\n", ret); | ||
551 | - regulator_set_voltage_tol(arm_reg, volt_old, 0); | ||
552 | + ret1 = regulator_set_voltage_tol(arm_reg, volt_old, 0); | ||
553 | + if (ret1) | ||
554 | + dev_warn(cpu_dev, | ||
555 | + "failed to restore vddarm voltage: %d\n", ret1); | ||
556 | return ret; | ||
557 | } | ||
558 | |||
559 | diff --git a/drivers/firmware/efi/arm-init.c b/drivers/firmware/efi/arm-init.c | ||
560 | index 388a929baf95..1a6a77df8a5e 100644 | ||
561 | --- a/drivers/firmware/efi/arm-init.c | ||
562 | +++ b/drivers/firmware/efi/arm-init.c | ||
563 | @@ -265,6 +265,10 @@ void __init efi_init(void) | ||
564 | (params.mmap & ~PAGE_MASK))); | ||
565 | |||
566 | init_screen_info(); | ||
567 | + | ||
568 | + /* ARM does not permit early mappings to persist across paging_init() */ | ||
569 | + if (IS_ENABLED(CONFIG_ARM)) | ||
570 | + efi_memmap_unmap(); | ||
571 | } | ||
572 | |||
573 | static int __init register_gop_device(void) | ||
574 | diff --git a/drivers/firmware/efi/arm-runtime.c b/drivers/firmware/efi/arm-runtime.c | ||
575 | index 922cfb813109..a00934d263c5 100644 | ||
576 | --- a/drivers/firmware/efi/arm-runtime.c | ||
577 | +++ b/drivers/firmware/efi/arm-runtime.c | ||
578 | @@ -110,7 +110,7 @@ static int __init arm_enable_runtime_services(void) | ||
579 | { | ||
580 | u64 mapsize; | ||
581 | |||
582 | - if (!efi_enabled(EFI_BOOT) || !efi_enabled(EFI_MEMMAP)) { | ||
583 | + if (!efi_enabled(EFI_BOOT)) { | ||
584 | pr_info("EFI services will not be available.\n"); | ||
585 | return 0; | ||
586 | } | ||
587 | diff --git a/drivers/firmware/efi/libstub/Makefile b/drivers/firmware/efi/libstub/Makefile | ||
588 | index 14c40a7750d1..c51627660dbb 100644 | ||
589 | --- a/drivers/firmware/efi/libstub/Makefile | ||
590 | +++ b/drivers/firmware/efi/libstub/Makefile | ||
591 | @@ -16,7 +16,8 @@ cflags-$(CONFIG_X86) += -m$(BITS) -D__KERNEL__ -O2 \ | ||
592 | cflags-$(CONFIG_ARM64) := $(subst -pg,,$(KBUILD_CFLAGS)) -fpie \ | ||
593 | $(DISABLE_STACKLEAK_PLUGIN) | ||
594 | cflags-$(CONFIG_ARM) := $(subst -pg,,$(KBUILD_CFLAGS)) \ | ||
595 | - -fno-builtin -fpic -mno-single-pic-base | ||
596 | + -fno-builtin -fpic \ | ||
597 | + $(call cc-option,-mno-single-pic-base) | ||
598 | |||
599 | cflags-$(CONFIG_EFI_ARMSTUB) += -I$(srctree)/scripts/dtc/libfdt | ||
600 | |||
601 | diff --git a/drivers/firmware/efi/memmap.c b/drivers/firmware/efi/memmap.c | ||
602 | index 5fc70520e04c..1907db2b38d8 100644 | ||
603 | --- a/drivers/firmware/efi/memmap.c | ||
604 | +++ b/drivers/firmware/efi/memmap.c | ||
605 | @@ -118,6 +118,9 @@ int __init efi_memmap_init_early(struct efi_memory_map_data *data) | ||
606 | |||
607 | void __init efi_memmap_unmap(void) | ||
608 | { | ||
609 | + if (!efi_enabled(EFI_MEMMAP)) | ||
610 | + return; | ||
611 | + | ||
612 | if (!efi.memmap.late) { | ||
613 | unsigned long size; | ||
614 | |||
615 | diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c | ||
616 | index 25187403e3ac..a8e01d99919c 100644 | ||
617 | --- a/drivers/gpio/gpiolib.c | ||
618 | +++ b/drivers/gpio/gpiolib.c | ||
619 | @@ -1285,7 +1285,7 @@ int gpiochip_add_data_with_key(struct gpio_chip *chip, void *data, | ||
620 | gdev->descs = kcalloc(chip->ngpio, sizeof(gdev->descs[0]), GFP_KERNEL); | ||
621 | if (!gdev->descs) { | ||
622 | status = -ENOMEM; | ||
623 | - goto err_free_gdev; | ||
624 | + goto err_free_ida; | ||
625 | } | ||
626 | |||
627 | if (chip->ngpio == 0) { | ||
628 | @@ -1413,8 +1413,9 @@ err_free_label: | ||
629 | kfree_const(gdev->label); | ||
630 | err_free_descs: | ||
631 | kfree(gdev->descs); | ||
632 | -err_free_gdev: | ||
633 | +err_free_ida: | ||
634 | ida_simple_remove(&gpio_ida, gdev->id); | ||
635 | +err_free_gdev: | ||
636 | /* failures here can mean systems won't boot... */ | ||
637 | pr_err("%s: GPIOs %d..%d (%s) failed to register, %d\n", __func__, | ||
638 | gdev->base, gdev->base + gdev->ngpio - 1, | ||
639 | diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c | ||
640 | index 0c791e35acf0..79bd8bd97fae 100644 | ||
641 | --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c | ||
642 | +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c | ||
643 | @@ -496,8 +496,11 @@ void amdgpu_amdkfd_set_compute_idle(struct kgd_dev *kgd, bool idle) | ||
644 | { | ||
645 | struct amdgpu_device *adev = (struct amdgpu_device *)kgd; | ||
646 | |||
647 | - amdgpu_dpm_switch_power_profile(adev, | ||
648 | - PP_SMC_POWER_PROFILE_COMPUTE, !idle); | ||
649 | + if (adev->powerplay.pp_funcs && | ||
650 | + adev->powerplay.pp_funcs->switch_power_profile) | ||
651 | + amdgpu_dpm_switch_power_profile(adev, | ||
652 | + PP_SMC_POWER_PROFILE_COMPUTE, | ||
653 | + !idle); | ||
654 | } | ||
655 | |||
656 | bool amdgpu_amdkfd_is_kfd_vmid(struct amdgpu_device *adev, u32 vmid) | ||
657 | diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c | ||
658 | index ad151fefa41f..db406a35808f 100644 | ||
659 | --- a/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c | ||
660 | +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c | ||
661 | @@ -45,6 +45,7 @@ MODULE_FIRMWARE("amdgpu/tahiti_mc.bin"); | ||
662 | MODULE_FIRMWARE("amdgpu/pitcairn_mc.bin"); | ||
663 | MODULE_FIRMWARE("amdgpu/verde_mc.bin"); | ||
664 | MODULE_FIRMWARE("amdgpu/oland_mc.bin"); | ||
665 | +MODULE_FIRMWARE("amdgpu/hainan_mc.bin"); | ||
666 | MODULE_FIRMWARE("amdgpu/si58_mc.bin"); | ||
667 | |||
668 | #define MC_SEQ_MISC0__MT__MASK 0xf0000000 | ||
669 | diff --git a/drivers/gpu/drm/amd/amdgpu/vega10_ih.c b/drivers/gpu/drm/amd/amdgpu/vega10_ih.c | ||
670 | index 5ae5ed2e62d6..21bc12e02311 100644 | ||
671 | --- a/drivers/gpu/drm/amd/amdgpu/vega10_ih.c | ||
672 | +++ b/drivers/gpu/drm/amd/amdgpu/vega10_ih.c | ||
673 | @@ -129,7 +129,7 @@ static int vega10_ih_irq_init(struct amdgpu_device *adev) | ||
674 | else | ||
675 | wptr_off = adev->wb.gpu_addr + (adev->irq.ih.wptr_offs * 4); | ||
676 | WREG32_SOC15(OSSSYS, 0, mmIH_RB_WPTR_ADDR_LO, lower_32_bits(wptr_off)); | ||
677 | - WREG32_SOC15(OSSSYS, 0, mmIH_RB_WPTR_ADDR_HI, upper_32_bits(wptr_off) & 0xFF); | ||
678 | + WREG32_SOC15(OSSSYS, 0, mmIH_RB_WPTR_ADDR_HI, upper_32_bits(wptr_off) & 0xFFFF); | ||
679 | |||
680 | /* set rptr, wptr to 0 */ | ||
681 | WREG32_SOC15(OSSSYS, 0, mmIH_RB_RPTR, 0); | ||
682 | diff --git a/drivers/gpu/drm/ast/ast_drv.c b/drivers/gpu/drm/ast/ast_drv.c | ||
683 | index 69dab82a3771..bf589c53b908 100644 | ||
684 | --- a/drivers/gpu/drm/ast/ast_drv.c | ||
685 | +++ b/drivers/gpu/drm/ast/ast_drv.c | ||
686 | @@ -60,8 +60,29 @@ static const struct pci_device_id pciidlist[] = { | ||
687 | |||
688 | MODULE_DEVICE_TABLE(pci, pciidlist); | ||
689 | |||
690 | +static void ast_kick_out_firmware_fb(struct pci_dev *pdev) | ||
691 | +{ | ||
692 | + struct apertures_struct *ap; | ||
693 | + bool primary = false; | ||
694 | + | ||
695 | + ap = alloc_apertures(1); | ||
696 | + if (!ap) | ||
697 | + return; | ||
698 | + | ||
699 | + ap->ranges[0].base = pci_resource_start(pdev, 0); | ||
700 | + ap->ranges[0].size = pci_resource_len(pdev, 0); | ||
701 | + | ||
702 | +#ifdef CONFIG_X86 | ||
703 | + primary = pdev->resource[PCI_ROM_RESOURCE].flags & IORESOURCE_ROM_SHADOW; | ||
704 | +#endif | ||
705 | + drm_fb_helper_remove_conflicting_framebuffers(ap, "astdrmfb", primary); | ||
706 | + kfree(ap); | ||
707 | +} | ||
708 | + | ||
709 | static int ast_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | ||
710 | { | ||
711 | + ast_kick_out_firmware_fb(pdev); | ||
712 | + | ||
713 | return drm_get_pci_dev(pdev, ent, &driver); | ||
714 | } | ||
715 | |||
716 | diff --git a/drivers/gpu/drm/ast/ast_mode.c b/drivers/gpu/drm/ast/ast_mode.c | ||
717 | index 5e77d456d9bb..7c6ac3cadb6b 100644 | ||
718 | --- a/drivers/gpu/drm/ast/ast_mode.c | ||
719 | +++ b/drivers/gpu/drm/ast/ast_mode.c | ||
720 | @@ -568,6 +568,7 @@ static int ast_crtc_do_set_base(struct drm_crtc *crtc, | ||
721 | } | ||
722 | ast_bo_unreserve(bo); | ||
723 | |||
724 | + ast_set_offset_reg(crtc); | ||
725 | ast_set_start_address_crt1(crtc, (u32)gpu_addr); | ||
726 | |||
727 | return 0; | ||
728 | @@ -1254,7 +1255,7 @@ static int ast_cursor_move(struct drm_crtc *crtc, | ||
729 | ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xc7, ((y >> 8) & 0x07)); | ||
730 | |||
731 | /* dummy write to fire HWC */ | ||
732 | - ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xCB, 0xFF, 0x00); | ||
733 | + ast_show_cursor(crtc); | ||
734 | |||
735 | return 0; | ||
736 | } | ||
737 | diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c | ||
738 | index 9628dd617826..9214c8b02484 100644 | ||
739 | --- a/drivers/gpu/drm/drm_fb_helper.c | ||
740 | +++ b/drivers/gpu/drm/drm_fb_helper.c | ||
741 | @@ -200,6 +200,9 @@ int drm_fb_helper_single_add_all_connectors(struct drm_fb_helper *fb_helper) | ||
742 | mutex_lock(&fb_helper->lock); | ||
743 | drm_connector_list_iter_begin(dev, &conn_iter); | ||
744 | drm_for_each_connector_iter(connector, &conn_iter) { | ||
745 | + if (connector->connector_type == DRM_MODE_CONNECTOR_WRITEBACK) | ||
746 | + continue; | ||
747 | + | ||
748 | ret = __drm_fb_helper_add_one_connector(fb_helper, connector); | ||
749 | if (ret) | ||
750 | goto fail; | ||
751 | diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c | ||
752 | index 43ae9de12ba3..c3a64d6a18df 100644 | ||
753 | --- a/drivers/gpu/drm/i915/intel_pm.c | ||
754 | +++ b/drivers/gpu/drm/i915/intel_pm.c | ||
755 | @@ -2492,6 +2492,9 @@ static uint32_t ilk_compute_pri_wm(const struct intel_crtc_state *cstate, | ||
756 | uint32_t method1, method2; | ||
757 | int cpp; | ||
758 | |||
759 | + if (mem_value == 0) | ||
760 | + return U32_MAX; | ||
761 | + | ||
762 | if (!intel_wm_plane_visible(cstate, pstate)) | ||
763 | return 0; | ||
764 | |||
765 | @@ -2521,6 +2524,9 @@ static uint32_t ilk_compute_spr_wm(const struct intel_crtc_state *cstate, | ||
766 | uint32_t method1, method2; | ||
767 | int cpp; | ||
768 | |||
769 | + if (mem_value == 0) | ||
770 | + return U32_MAX; | ||
771 | + | ||
772 | if (!intel_wm_plane_visible(cstate, pstate)) | ||
773 | return 0; | ||
774 | |||
775 | @@ -2544,6 +2550,9 @@ static uint32_t ilk_compute_cur_wm(const struct intel_crtc_state *cstate, | ||
776 | { | ||
777 | int cpp; | ||
778 | |||
779 | + if (mem_value == 0) | ||
780 | + return U32_MAX; | ||
781 | + | ||
782 | if (!intel_wm_plane_visible(cstate, pstate)) | ||
783 | return 0; | ||
784 | |||
785 | @@ -2998,6 +3007,34 @@ static void snb_wm_latency_quirk(struct drm_i915_private *dev_priv) | ||
786 | intel_print_wm_latency(dev_priv, "Cursor", dev_priv->wm.cur_latency); | ||
787 | } | ||
788 | |||
789 | +static void snb_wm_lp3_irq_quirk(struct drm_i915_private *dev_priv) | ||
790 | +{ | ||
791 | + /* | ||
792 | + * On some SNB machines (Thinkpad X220 Tablet at least) | ||
793 | + * LP3 usage can cause vblank interrupts to be lost. | ||
794 | + * The DEIIR bit will go high but it looks like the CPU | ||
795 | + * never gets interrupted. | ||
796 | + * | ||
797 | + * It's not clear whether other interrupt source could | ||
798 | + * be affected or if this is somehow limited to vblank | ||
799 | + * interrupts only. To play it safe we disable LP3 | ||
800 | + * watermarks entirely. | ||
801 | + */ | ||
802 | + if (dev_priv->wm.pri_latency[3] == 0 && | ||
803 | + dev_priv->wm.spr_latency[3] == 0 && | ||
804 | + dev_priv->wm.cur_latency[3] == 0) | ||
805 | + return; | ||
806 | + | ||
807 | + dev_priv->wm.pri_latency[3] = 0; | ||
808 | + dev_priv->wm.spr_latency[3] = 0; | ||
809 | + dev_priv->wm.cur_latency[3] = 0; | ||
810 | + | ||
811 | + DRM_DEBUG_KMS("LP3 watermarks disabled due to potential for lost interrupts\n"); | ||
812 | + intel_print_wm_latency(dev_priv, "Primary", dev_priv->wm.pri_latency); | ||
813 | + intel_print_wm_latency(dev_priv, "Sprite", dev_priv->wm.spr_latency); | ||
814 | + intel_print_wm_latency(dev_priv, "Cursor", dev_priv->wm.cur_latency); | ||
815 | +} | ||
816 | + | ||
817 | static void ilk_setup_wm_latency(struct drm_i915_private *dev_priv) | ||
818 | { | ||
819 | intel_read_wm_latency(dev_priv, dev_priv->wm.pri_latency); | ||
820 | @@ -3014,8 +3051,10 @@ static void ilk_setup_wm_latency(struct drm_i915_private *dev_priv) | ||
821 | intel_print_wm_latency(dev_priv, "Sprite", dev_priv->wm.spr_latency); | ||
822 | intel_print_wm_latency(dev_priv, "Cursor", dev_priv->wm.cur_latency); | ||
823 | |||
824 | - if (IS_GEN6(dev_priv)) | ||
825 | + if (IS_GEN6(dev_priv)) { | ||
826 | snb_wm_latency_quirk(dev_priv); | ||
827 | + snb_wm_lp3_irq_quirk(dev_priv); | ||
828 | + } | ||
829 | } | ||
830 | |||
831 | static void skl_setup_wm_latency(struct drm_i915_private *dev_priv) | ||
832 | diff --git a/drivers/gpu/drm/vc4/vc4_kms.c b/drivers/gpu/drm/vc4/vc4_kms.c | ||
833 | index ca5aa7fba769..f4d8a730e821 100644 | ||
834 | --- a/drivers/gpu/drm/vc4/vc4_kms.c | ||
835 | +++ b/drivers/gpu/drm/vc4/vc4_kms.c | ||
836 | @@ -216,6 +216,12 @@ static int vc4_atomic_commit(struct drm_device *dev, | ||
837 | return 0; | ||
838 | } | ||
839 | |||
840 | + /* We know for sure we don't want an async update here. Set | ||
841 | + * state->legacy_cursor_update to false to prevent | ||
842 | + * drm_atomic_helper_setup_commit() from auto-completing | ||
843 | + * commit->flip_done. | ||
844 | + */ | ||
845 | + state->legacy_cursor_update = false; | ||
846 | ret = drm_atomic_helper_setup_commit(state, nonblock); | ||
847 | if (ret) | ||
848 | return ret; | ||
849 | diff --git a/drivers/hid/hid-steam.c b/drivers/hid/hid-steam.c | ||
850 | index 0422ec2b13d2..dc4128bfe2ca 100644 | ||
851 | --- a/drivers/hid/hid-steam.c | ||
852 | +++ b/drivers/hid/hid-steam.c | ||
853 | @@ -23,8 +23,9 @@ | ||
854 | * In order to avoid breaking them this driver creates a layered hidraw device, | ||
855 | * so it can detect when the client is running and then: | ||
856 | * - it will not send any command to the controller. | ||
857 | - * - this input device will be disabled, to avoid double input of the same | ||
858 | + * - this input device will be removed, to avoid double input of the same | ||
859 | * user action. | ||
860 | + * When the client is closed, this input device will be created again. | ||
861 | * | ||
862 | * For additional functions, such as changing the right-pad margin or switching | ||
863 | * the led, you can use the user-space tool at: | ||
864 | @@ -113,7 +114,7 @@ struct steam_device { | ||
865 | spinlock_t lock; | ||
866 | struct hid_device *hdev, *client_hdev; | ||
867 | struct mutex mutex; | ||
868 | - bool client_opened, input_opened; | ||
869 | + bool client_opened; | ||
870 | struct input_dev __rcu *input; | ||
871 | unsigned long quirks; | ||
872 | struct work_struct work_connect; | ||
873 | @@ -279,18 +280,6 @@ static void steam_set_lizard_mode(struct steam_device *steam, bool enable) | ||
874 | } | ||
875 | } | ||
876 | |||
877 | -static void steam_update_lizard_mode(struct steam_device *steam) | ||
878 | -{ | ||
879 | - mutex_lock(&steam->mutex); | ||
880 | - if (!steam->client_opened) { | ||
881 | - if (steam->input_opened) | ||
882 | - steam_set_lizard_mode(steam, false); | ||
883 | - else | ||
884 | - steam_set_lizard_mode(steam, lizard_mode); | ||
885 | - } | ||
886 | - mutex_unlock(&steam->mutex); | ||
887 | -} | ||
888 | - | ||
889 | static int steam_input_open(struct input_dev *dev) | ||
890 | { | ||
891 | struct steam_device *steam = input_get_drvdata(dev); | ||
892 | @@ -301,7 +290,6 @@ static int steam_input_open(struct input_dev *dev) | ||
893 | return ret; | ||
894 | |||
895 | mutex_lock(&steam->mutex); | ||
896 | - steam->input_opened = true; | ||
897 | if (!steam->client_opened && lizard_mode) | ||
898 | steam_set_lizard_mode(steam, false); | ||
899 | mutex_unlock(&steam->mutex); | ||
900 | @@ -313,7 +301,6 @@ static void steam_input_close(struct input_dev *dev) | ||
901 | struct steam_device *steam = input_get_drvdata(dev); | ||
902 | |||
903 | mutex_lock(&steam->mutex); | ||
904 | - steam->input_opened = false; | ||
905 | if (!steam->client_opened && lizard_mode) | ||
906 | steam_set_lizard_mode(steam, true); | ||
907 | mutex_unlock(&steam->mutex); | ||
908 | @@ -400,7 +387,7 @@ static int steam_battery_register(struct steam_device *steam) | ||
909 | return 0; | ||
910 | } | ||
911 | |||
912 | -static int steam_register(struct steam_device *steam) | ||
913 | +static int steam_input_register(struct steam_device *steam) | ||
914 | { | ||
915 | struct hid_device *hdev = steam->hdev; | ||
916 | struct input_dev *input; | ||
917 | @@ -414,17 +401,6 @@ static int steam_register(struct steam_device *steam) | ||
918 | return 0; | ||
919 | } | ||
920 | |||
921 | - /* | ||
922 | - * Unlikely, but getting the serial could fail, and it is not so | ||
923 | - * important, so make up a serial number and go on. | ||
924 | - */ | ||
925 | - if (steam_get_serial(steam) < 0) | ||
926 | - strlcpy(steam->serial_no, "XXXXXXXXXX", | ||
927 | - sizeof(steam->serial_no)); | ||
928 | - | ||
929 | - hid_info(hdev, "Steam Controller '%s' connected", | ||
930 | - steam->serial_no); | ||
931 | - | ||
932 | input = input_allocate_device(); | ||
933 | if (!input) | ||
934 | return -ENOMEM; | ||
935 | @@ -492,11 +468,6 @@ static int steam_register(struct steam_device *steam) | ||
936 | goto input_register_fail; | ||
937 | |||
938 | rcu_assign_pointer(steam->input, input); | ||
939 | - | ||
940 | - /* ignore battery errors, we can live without it */ | ||
941 | - if (steam->quirks & STEAM_QUIRK_WIRELESS) | ||
942 | - steam_battery_register(steam); | ||
943 | - | ||
944 | return 0; | ||
945 | |||
946 | input_register_fail: | ||
947 | @@ -504,27 +475,88 @@ input_register_fail: | ||
948 | return ret; | ||
949 | } | ||
950 | |||
951 | -static void steam_unregister(struct steam_device *steam) | ||
952 | +static void steam_input_unregister(struct steam_device *steam) | ||
953 | { | ||
954 | struct input_dev *input; | ||
955 | + rcu_read_lock(); | ||
956 | + input = rcu_dereference(steam->input); | ||
957 | + rcu_read_unlock(); | ||
958 | + if (!input) | ||
959 | + return; | ||
960 | + RCU_INIT_POINTER(steam->input, NULL); | ||
961 | + synchronize_rcu(); | ||
962 | + input_unregister_device(input); | ||
963 | +} | ||
964 | + | ||
965 | +static void steam_battery_unregister(struct steam_device *steam) | ||
966 | +{ | ||
967 | struct power_supply *battery; | ||
968 | |||
969 | rcu_read_lock(); | ||
970 | - input = rcu_dereference(steam->input); | ||
971 | battery = rcu_dereference(steam->battery); | ||
972 | rcu_read_unlock(); | ||
973 | |||
974 | - if (battery) { | ||
975 | - RCU_INIT_POINTER(steam->battery, NULL); | ||
976 | - synchronize_rcu(); | ||
977 | - power_supply_unregister(battery); | ||
978 | + if (!battery) | ||
979 | + return; | ||
980 | + RCU_INIT_POINTER(steam->battery, NULL); | ||
981 | + synchronize_rcu(); | ||
982 | + power_supply_unregister(battery); | ||
983 | +} | ||
984 | + | ||
985 | +static int steam_register(struct steam_device *steam) | ||
986 | +{ | ||
987 | + int ret; | ||
988 | + | ||
989 | + /* | ||
990 | + * This function can be called several times in a row with the | ||
991 | + * wireless adaptor, without steam_unregister() between them, because | ||
992 | + * another client send a get_connection_status command, for example. | ||
993 | + * The battery and serial number are set just once per device. | ||
994 | + */ | ||
995 | + if (!steam->serial_no[0]) { | ||
996 | + /* | ||
997 | + * Unlikely, but getting the serial could fail, and it is not so | ||
998 | + * important, so make up a serial number and go on. | ||
999 | + */ | ||
1000 | + if (steam_get_serial(steam) < 0) | ||
1001 | + strlcpy(steam->serial_no, "XXXXXXXXXX", | ||
1002 | + sizeof(steam->serial_no)); | ||
1003 | + | ||
1004 | + hid_info(steam->hdev, "Steam Controller '%s' connected", | ||
1005 | + steam->serial_no); | ||
1006 | + | ||
1007 | + /* ignore battery errors, we can live without it */ | ||
1008 | + if (steam->quirks & STEAM_QUIRK_WIRELESS) | ||
1009 | + steam_battery_register(steam); | ||
1010 | + | ||
1011 | + mutex_lock(&steam_devices_lock); | ||
1012 | + list_add(&steam->list, &steam_devices); | ||
1013 | + mutex_unlock(&steam_devices_lock); | ||
1014 | } | ||
1015 | - if (input) { | ||
1016 | - RCU_INIT_POINTER(steam->input, NULL); | ||
1017 | - synchronize_rcu(); | ||
1018 | + | ||
1019 | + mutex_lock(&steam->mutex); | ||
1020 | + if (!steam->client_opened) { | ||
1021 | + steam_set_lizard_mode(steam, lizard_mode); | ||
1022 | + ret = steam_input_register(steam); | ||
1023 | + } else { | ||
1024 | + ret = 0; | ||
1025 | + } | ||
1026 | + mutex_unlock(&steam->mutex); | ||
1027 | + | ||
1028 | + return ret; | ||
1029 | +} | ||
1030 | + | ||
1031 | +static void steam_unregister(struct steam_device *steam) | ||
1032 | +{ | ||
1033 | + steam_battery_unregister(steam); | ||
1034 | + steam_input_unregister(steam); | ||
1035 | + if (steam->serial_no[0]) { | ||
1036 | hid_info(steam->hdev, "Steam Controller '%s' disconnected", | ||
1037 | steam->serial_no); | ||
1038 | - input_unregister_device(input); | ||
1039 | + mutex_lock(&steam_devices_lock); | ||
1040 | + list_del(&steam->list); | ||
1041 | + mutex_unlock(&steam_devices_lock); | ||
1042 | + steam->serial_no[0] = 0; | ||
1043 | } | ||
1044 | } | ||
1045 | |||
1046 | @@ -600,6 +632,9 @@ static int steam_client_ll_open(struct hid_device *hdev) | ||
1047 | mutex_lock(&steam->mutex); | ||
1048 | steam->client_opened = true; | ||
1049 | mutex_unlock(&steam->mutex); | ||
1050 | + | ||
1051 | + steam_input_unregister(steam); | ||
1052 | + | ||
1053 | return ret; | ||
1054 | } | ||
1055 | |||
1056 | @@ -609,13 +644,13 @@ static void steam_client_ll_close(struct hid_device *hdev) | ||
1057 | |||
1058 | mutex_lock(&steam->mutex); | ||
1059 | steam->client_opened = false; | ||
1060 | - if (steam->input_opened) | ||
1061 | - steam_set_lizard_mode(steam, false); | ||
1062 | - else | ||
1063 | - steam_set_lizard_mode(steam, lizard_mode); | ||
1064 | mutex_unlock(&steam->mutex); | ||
1065 | |||
1066 | hid_hw_close(steam->hdev); | ||
1067 | + if (steam->connected) { | ||
1068 | + steam_set_lizard_mode(steam, lizard_mode); | ||
1069 | + steam_input_register(steam); | ||
1070 | + } | ||
1071 | } | ||
1072 | |||
1073 | static int steam_client_ll_raw_request(struct hid_device *hdev, | ||
1074 | @@ -744,11 +779,6 @@ static int steam_probe(struct hid_device *hdev, | ||
1075 | } | ||
1076 | } | ||
1077 | |||
1078 | - mutex_lock(&steam_devices_lock); | ||
1079 | - steam_update_lizard_mode(steam); | ||
1080 | - list_add(&steam->list, &steam_devices); | ||
1081 | - mutex_unlock(&steam_devices_lock); | ||
1082 | - | ||
1083 | return 0; | ||
1084 | |||
1085 | hid_hw_open_fail: | ||
1086 | @@ -774,10 +804,6 @@ static void steam_remove(struct hid_device *hdev) | ||
1087 | return; | ||
1088 | } | ||
1089 | |||
1090 | - mutex_lock(&steam_devices_lock); | ||
1091 | - list_del(&steam->list); | ||
1092 | - mutex_unlock(&steam_devices_lock); | ||
1093 | - | ||
1094 | hid_destroy_device(steam->client_hdev); | ||
1095 | steam->client_opened = false; | ||
1096 | cancel_work_sync(&steam->work_connect); | ||
1097 | @@ -792,12 +818,14 @@ static void steam_remove(struct hid_device *hdev) | ||
1098 | static void steam_do_connect_event(struct steam_device *steam, bool connected) | ||
1099 | { | ||
1100 | unsigned long flags; | ||
1101 | + bool changed; | ||
1102 | |||
1103 | spin_lock_irqsave(&steam->lock, flags); | ||
1104 | + changed = steam->connected != connected; | ||
1105 | steam->connected = connected; | ||
1106 | spin_unlock_irqrestore(&steam->lock, flags); | ||
1107 | |||
1108 | - if (schedule_work(&steam->work_connect) == 0) | ||
1109 | + if (changed && schedule_work(&steam->work_connect) == 0) | ||
1110 | dbg_hid("%s: connected=%d event already queued\n", | ||
1111 | __func__, connected); | ||
1112 | } | ||
1113 | @@ -1019,13 +1047,8 @@ static int steam_raw_event(struct hid_device *hdev, | ||
1114 | return 0; | ||
1115 | rcu_read_lock(); | ||
1116 | input = rcu_dereference(steam->input); | ||
1117 | - if (likely(input)) { | ||
1118 | + if (likely(input)) | ||
1119 | steam_do_input_event(steam, input, data); | ||
1120 | - } else { | ||
1121 | - dbg_hid("%s: input data without connect event\n", | ||
1122 | - __func__); | ||
1123 | - steam_do_connect_event(steam, true); | ||
1124 | - } | ||
1125 | rcu_read_unlock(); | ||
1126 | break; | ||
1127 | case STEAM_EV_CONNECT: | ||
1128 | @@ -1074,7 +1097,10 @@ static int steam_param_set_lizard_mode(const char *val, | ||
1129 | |||
1130 | mutex_lock(&steam_devices_lock); | ||
1131 | list_for_each_entry(steam, &steam_devices, list) { | ||
1132 | - steam_update_lizard_mode(steam); | ||
1133 | + mutex_lock(&steam->mutex); | ||
1134 | + if (!steam->client_opened) | ||
1135 | + steam_set_lizard_mode(steam, lizard_mode); | ||
1136 | + mutex_unlock(&steam->mutex); | ||
1137 | } | ||
1138 | mutex_unlock(&steam_devices_lock); | ||
1139 | return 0; | ||
1140 | diff --git a/drivers/infiniband/hw/hfi1/user_sdma.c b/drivers/infiniband/hw/hfi1/user_sdma.c | ||
1141 | index 5c88706121c1..39134dd305f5 100644 | ||
1142 | --- a/drivers/infiniband/hw/hfi1/user_sdma.c | ||
1143 | +++ b/drivers/infiniband/hw/hfi1/user_sdma.c | ||
1144 | @@ -328,7 +328,6 @@ int hfi1_user_sdma_process_request(struct hfi1_filedata *fd, | ||
1145 | u8 opcode, sc, vl; | ||
1146 | u16 pkey; | ||
1147 | u32 slid; | ||
1148 | - int req_queued = 0; | ||
1149 | u16 dlid; | ||
1150 | u32 selector; | ||
1151 | |||
1152 | @@ -392,7 +391,6 @@ int hfi1_user_sdma_process_request(struct hfi1_filedata *fd, | ||
1153 | req->data_len = 0; | ||
1154 | req->pq = pq; | ||
1155 | req->cq = cq; | ||
1156 | - req->status = -1; | ||
1157 | req->ahg_idx = -1; | ||
1158 | req->iov_idx = 0; | ||
1159 | req->sent = 0; | ||
1160 | @@ -400,12 +398,14 @@ int hfi1_user_sdma_process_request(struct hfi1_filedata *fd, | ||
1161 | req->seqcomp = 0; | ||
1162 | req->seqsubmitted = 0; | ||
1163 | req->tids = NULL; | ||
1164 | - req->done = 0; | ||
1165 | req->has_error = 0; | ||
1166 | INIT_LIST_HEAD(&req->txps); | ||
1167 | |||
1168 | memcpy(&req->info, &info, sizeof(info)); | ||
1169 | |||
1170 | + /* The request is initialized, count it */ | ||
1171 | + atomic_inc(&pq->n_reqs); | ||
1172 | + | ||
1173 | if (req_opcode(info.ctrl) == EXPECTED) { | ||
1174 | /* expected must have a TID info and at least one data vector */ | ||
1175 | if (req->data_iovs < 2) { | ||
1176 | @@ -500,7 +500,6 @@ int hfi1_user_sdma_process_request(struct hfi1_filedata *fd, | ||
1177 | ret = pin_vector_pages(req, &req->iovs[i]); | ||
1178 | if (ret) { | ||
1179 | req->data_iovs = i; | ||
1180 | - req->status = ret; | ||
1181 | goto free_req; | ||
1182 | } | ||
1183 | req->data_len += req->iovs[i].iov.iov_len; | ||
1184 | @@ -561,14 +560,10 @@ int hfi1_user_sdma_process_request(struct hfi1_filedata *fd, | ||
1185 | req->ahg_idx = sdma_ahg_alloc(req->sde); | ||
1186 | |||
1187 | set_comp_state(pq, cq, info.comp_idx, QUEUED, 0); | ||
1188 | - atomic_inc(&pq->n_reqs); | ||
1189 | - req_queued = 1; | ||
1190 | /* Send the first N packets in the request to buy us some time */ | ||
1191 | ret = user_sdma_send_pkts(req, pcount); | ||
1192 | - if (unlikely(ret < 0 && ret != -EBUSY)) { | ||
1193 | - req->status = ret; | ||
1194 | + if (unlikely(ret < 0 && ret != -EBUSY)) | ||
1195 | goto free_req; | ||
1196 | - } | ||
1197 | |||
1198 | /* | ||
1199 | * It is possible that the SDMA engine would have processed all the | ||
1200 | @@ -588,14 +583,8 @@ int hfi1_user_sdma_process_request(struct hfi1_filedata *fd, | ||
1201 | while (req->seqsubmitted != req->info.npkts) { | ||
1202 | ret = user_sdma_send_pkts(req, pcount); | ||
1203 | if (ret < 0) { | ||
1204 | - if (ret != -EBUSY) { | ||
1205 | - req->status = ret; | ||
1206 | - WRITE_ONCE(req->has_error, 1); | ||
1207 | - if (READ_ONCE(req->seqcomp) == | ||
1208 | - req->seqsubmitted - 1) | ||
1209 | - goto free_req; | ||
1210 | - return ret; | ||
1211 | - } | ||
1212 | + if (ret != -EBUSY) | ||
1213 | + goto free_req; | ||
1214 | wait_event_interruptible_timeout( | ||
1215 | pq->busy.wait_dma, | ||
1216 | (pq->state == SDMA_PKT_Q_ACTIVE), | ||
1217 | @@ -606,10 +595,19 @@ int hfi1_user_sdma_process_request(struct hfi1_filedata *fd, | ||
1218 | *count += idx; | ||
1219 | return 0; | ||
1220 | free_req: | ||
1221 | - user_sdma_free_request(req, true); | ||
1222 | - if (req_queued) | ||
1223 | + /* | ||
1224 | + * If the submitted seqsubmitted == npkts, the completion routine | ||
1225 | + * controls the final state. If sequbmitted < npkts, wait for any | ||
1226 | + * outstanding packets to finish before cleaning up. | ||
1227 | + */ | ||
1228 | + if (req->seqsubmitted < req->info.npkts) { | ||
1229 | + if (req->seqsubmitted) | ||
1230 | + wait_event(pq->busy.wait_dma, | ||
1231 | + (req->seqcomp == req->seqsubmitted - 1)); | ||
1232 | + user_sdma_free_request(req, true); | ||
1233 | pq_update(pq); | ||
1234 | - set_comp_state(pq, cq, info.comp_idx, ERROR, req->status); | ||
1235 | + set_comp_state(pq, cq, info.comp_idx, ERROR, ret); | ||
1236 | + } | ||
1237 | return ret; | ||
1238 | } | ||
1239 | |||
1240 | @@ -917,7 +915,6 @@ dosend: | ||
1241 | ret = sdma_send_txlist(req->sde, &pq->busy, &req->txps, &count); | ||
1242 | req->seqsubmitted += count; | ||
1243 | if (req->seqsubmitted == req->info.npkts) { | ||
1244 | - WRITE_ONCE(req->done, 1); | ||
1245 | /* | ||
1246 | * The txreq has already been submitted to the HW queue | ||
1247 | * so we can free the AHG entry now. Corruption will not | ||
1248 | @@ -1365,11 +1362,15 @@ static int set_txreq_header_ahg(struct user_sdma_request *req, | ||
1249 | return idx; | ||
1250 | } | ||
1251 | |||
1252 | -/* | ||
1253 | - * SDMA tx request completion callback. Called when the SDMA progress | ||
1254 | - * state machine gets notification that the SDMA descriptors for this | ||
1255 | - * tx request have been processed by the DMA engine. Called in | ||
1256 | - * interrupt context. | ||
1257 | +/** | ||
1258 | + * user_sdma_txreq_cb() - SDMA tx request completion callback. | ||
1259 | + * @txreq: valid sdma tx request | ||
1260 | + * @status: success/failure of request | ||
1261 | + * | ||
1262 | + * Called when the SDMA progress state machine gets notification that | ||
1263 | + * the SDMA descriptors for this tx request have been processed by the | ||
1264 | + * DMA engine. Called in interrupt context. | ||
1265 | + * Only do work on completed sequences. | ||
1266 | */ | ||
1267 | static void user_sdma_txreq_cb(struct sdma_txreq *txreq, int status) | ||
1268 | { | ||
1269 | @@ -1378,7 +1379,7 @@ static void user_sdma_txreq_cb(struct sdma_txreq *txreq, int status) | ||
1270 | struct user_sdma_request *req; | ||
1271 | struct hfi1_user_sdma_pkt_q *pq; | ||
1272 | struct hfi1_user_sdma_comp_q *cq; | ||
1273 | - u16 idx; | ||
1274 | + enum hfi1_sdma_comp_state state = COMPLETE; | ||
1275 | |||
1276 | if (!tx->req) | ||
1277 | return; | ||
1278 | @@ -1391,31 +1392,19 @@ static void user_sdma_txreq_cb(struct sdma_txreq *txreq, int status) | ||
1279 | SDMA_DBG(req, "SDMA completion with error %d", | ||
1280 | status); | ||
1281 | WRITE_ONCE(req->has_error, 1); | ||
1282 | + state = ERROR; | ||
1283 | } | ||
1284 | |||
1285 | req->seqcomp = tx->seqnum; | ||
1286 | kmem_cache_free(pq->txreq_cache, tx); | ||
1287 | - tx = NULL; | ||
1288 | - | ||
1289 | - idx = req->info.comp_idx; | ||
1290 | - if (req->status == -1 && status == SDMA_TXREQ_S_OK) { | ||
1291 | - if (req->seqcomp == req->info.npkts - 1) { | ||
1292 | - req->status = 0; | ||
1293 | - user_sdma_free_request(req, false); | ||
1294 | - pq_update(pq); | ||
1295 | - set_comp_state(pq, cq, idx, COMPLETE, 0); | ||
1296 | - } | ||
1297 | - } else { | ||
1298 | - if (status != SDMA_TXREQ_S_OK) | ||
1299 | - req->status = status; | ||
1300 | - if (req->seqcomp == (READ_ONCE(req->seqsubmitted) - 1) && | ||
1301 | - (READ_ONCE(req->done) || | ||
1302 | - READ_ONCE(req->has_error))) { | ||
1303 | - user_sdma_free_request(req, false); | ||
1304 | - pq_update(pq); | ||
1305 | - set_comp_state(pq, cq, idx, ERROR, req->status); | ||
1306 | - } | ||
1307 | - } | ||
1308 | + | ||
1309 | + /* sequence isn't complete? We are done */ | ||
1310 | + if (req->seqcomp != req->info.npkts - 1) | ||
1311 | + return; | ||
1312 | + | ||
1313 | + user_sdma_free_request(req, false); | ||
1314 | + set_comp_state(pq, cq, req->info.comp_idx, state, status); | ||
1315 | + pq_update(pq); | ||
1316 | } | ||
1317 | |||
1318 | static inline void pq_update(struct hfi1_user_sdma_pkt_q *pq) | ||
1319 | @@ -1448,6 +1437,8 @@ static void user_sdma_free_request(struct user_sdma_request *req, bool unpin) | ||
1320 | if (!node) | ||
1321 | continue; | ||
1322 | |||
1323 | + req->iovs[i].node = NULL; | ||
1324 | + | ||
1325 | if (unpin) | ||
1326 | hfi1_mmu_rb_remove(req->pq->handler, | ||
1327 | &node->rb); | ||
1328 | diff --git a/drivers/infiniband/hw/hfi1/user_sdma.h b/drivers/infiniband/hw/hfi1/user_sdma.h | ||
1329 | index d2bc77f75253..0ae06456c868 100644 | ||
1330 | --- a/drivers/infiniband/hw/hfi1/user_sdma.h | ||
1331 | +++ b/drivers/infiniband/hw/hfi1/user_sdma.h | ||
1332 | @@ -205,8 +205,6 @@ struct user_sdma_request { | ||
1333 | /* Writeable fields shared with interrupt */ | ||
1334 | u64 seqcomp ____cacheline_aligned_in_smp; | ||
1335 | u64 seqsubmitted; | ||
1336 | - /* status of the last txreq completed */ | ||
1337 | - int status; | ||
1338 | |||
1339 | /* Send side fields */ | ||
1340 | struct list_head txps ____cacheline_aligned_in_smp; | ||
1341 | @@ -228,7 +226,6 @@ struct user_sdma_request { | ||
1342 | u16 tididx; | ||
1343 | /* progress index moving along the iovs array */ | ||
1344 | u8 iov_idx; | ||
1345 | - u8 done; | ||
1346 | u8 has_error; | ||
1347 | |||
1348 | struct user_sdma_iovec iovs[MAX_VECTORS_PER_REQ]; | ||
1349 | diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c | ||
1350 | index 55d33500d55e..5e85f3cca867 100644 | ||
1351 | --- a/drivers/input/mouse/synaptics.c | ||
1352 | +++ b/drivers/input/mouse/synaptics.c | ||
1353 | @@ -99,9 +99,7 @@ static int synaptics_mode_cmd(struct psmouse *psmouse, u8 mode) | ||
1354 | int synaptics_detect(struct psmouse *psmouse, bool set_properties) | ||
1355 | { | ||
1356 | struct ps2dev *ps2dev = &psmouse->ps2dev; | ||
1357 | - u8 param[4]; | ||
1358 | - | ||
1359 | - param[0] = 0; | ||
1360 | + u8 param[4] = { 0 }; | ||
1361 | |||
1362 | ps2_command(ps2dev, param, PSMOUSE_CMD_SETRES); | ||
1363 | ps2_command(ps2dev, param, PSMOUSE_CMD_SETRES); | ||
1364 | diff --git a/drivers/media/i2c/ov5640.c b/drivers/media/i2c/ov5640.c | ||
1365 | index 7b662bd1c7a0..30b15e91d8be 100644 | ||
1366 | --- a/drivers/media/i2c/ov5640.c | ||
1367 | +++ b/drivers/media/i2c/ov5640.c | ||
1368 | @@ -288,10 +288,10 @@ static const struct reg_value ov5640_init_setting_30fps_VGA[] = { | ||
1369 | {0x3a0d, 0x04, 0, 0}, {0x3a14, 0x03, 0, 0}, {0x3a15, 0xd8, 0, 0}, | ||
1370 | {0x4001, 0x02, 0, 0}, {0x4004, 0x02, 0, 0}, {0x3000, 0x00, 0, 0}, | ||
1371 | {0x3002, 0x1c, 0, 0}, {0x3004, 0xff, 0, 0}, {0x3006, 0xc3, 0, 0}, | ||
1372 | - {0x300e, 0x45, 0, 0}, {0x302e, 0x08, 0, 0}, {0x4300, 0x3f, 0, 0}, | ||
1373 | + {0x302e, 0x08, 0, 0}, {0x4300, 0x3f, 0, 0}, | ||
1374 | {0x501f, 0x00, 0, 0}, {0x4713, 0x03, 0, 0}, {0x4407, 0x04, 0, 0}, | ||
1375 | {0x440e, 0x00, 0, 0}, {0x460b, 0x35, 0, 0}, {0x460c, 0x22, 0, 0}, | ||
1376 | - {0x4837, 0x0a, 0, 0}, {0x4800, 0x04, 0, 0}, {0x3824, 0x02, 0, 0}, | ||
1377 | + {0x4837, 0x0a, 0, 0}, {0x3824, 0x02, 0, 0}, | ||
1378 | {0x5000, 0xa7, 0, 0}, {0x5001, 0xa3, 0, 0}, {0x5180, 0xff, 0, 0}, | ||
1379 | {0x5181, 0xf2, 0, 0}, {0x5182, 0x00, 0, 0}, {0x5183, 0x14, 0, 0}, | ||
1380 | {0x5184, 0x25, 0, 0}, {0x5185, 0x24, 0, 0}, {0x5186, 0x09, 0, 0}, | ||
1381 | @@ -910,6 +910,26 @@ static int ov5640_mod_reg(struct ov5640_dev *sensor, u16 reg, | ||
1382 | } | ||
1383 | |||
1384 | /* download ov5640 settings to sensor through i2c */ | ||
1385 | +static int ov5640_set_timings(struct ov5640_dev *sensor, | ||
1386 | + const struct ov5640_mode_info *mode) | ||
1387 | +{ | ||
1388 | + int ret; | ||
1389 | + | ||
1390 | + ret = ov5640_write_reg16(sensor, OV5640_REG_TIMING_DVPHO, mode->hact); | ||
1391 | + if (ret < 0) | ||
1392 | + return ret; | ||
1393 | + | ||
1394 | + ret = ov5640_write_reg16(sensor, OV5640_REG_TIMING_DVPVO, mode->vact); | ||
1395 | + if (ret < 0) | ||
1396 | + return ret; | ||
1397 | + | ||
1398 | + ret = ov5640_write_reg16(sensor, OV5640_REG_TIMING_HTS, mode->htot); | ||
1399 | + if (ret < 0) | ||
1400 | + return ret; | ||
1401 | + | ||
1402 | + return ov5640_write_reg16(sensor, OV5640_REG_TIMING_VTS, mode->vtot); | ||
1403 | +} | ||
1404 | + | ||
1405 | static int ov5640_load_regs(struct ov5640_dev *sensor, | ||
1406 | const struct ov5640_mode_info *mode) | ||
1407 | { | ||
1408 | @@ -937,7 +957,13 @@ static int ov5640_load_regs(struct ov5640_dev *sensor, | ||
1409 | usleep_range(1000 * delay_ms, 1000 * delay_ms + 100); | ||
1410 | } | ||
1411 | |||
1412 | - return ret; | ||
1413 | + return ov5640_set_timings(sensor, mode); | ||
1414 | +} | ||
1415 | + | ||
1416 | +static int ov5640_set_autoexposure(struct ov5640_dev *sensor, bool on) | ||
1417 | +{ | ||
1418 | + return ov5640_mod_reg(sensor, OV5640_REG_AEC_PK_MANUAL, | ||
1419 | + BIT(0), on ? 0 : BIT(0)); | ||
1420 | } | ||
1421 | |||
1422 | /* read exposure, in number of line periods */ | ||
1423 | @@ -996,6 +1022,18 @@ static int ov5640_get_gain(struct ov5640_dev *sensor) | ||
1424 | return gain & 0x3ff; | ||
1425 | } | ||
1426 | |||
1427 | +static int ov5640_set_gain(struct ov5640_dev *sensor, int gain) | ||
1428 | +{ | ||
1429 | + return ov5640_write_reg16(sensor, OV5640_REG_AEC_PK_REAL_GAIN, | ||
1430 | + (u16)gain & 0x3ff); | ||
1431 | +} | ||
1432 | + | ||
1433 | +static int ov5640_set_autogain(struct ov5640_dev *sensor, bool on) | ||
1434 | +{ | ||
1435 | + return ov5640_mod_reg(sensor, OV5640_REG_AEC_PK_MANUAL, | ||
1436 | + BIT(1), on ? 0 : BIT(1)); | ||
1437 | +} | ||
1438 | + | ||
1439 | static int ov5640_set_stream_dvp(struct ov5640_dev *sensor, bool on) | ||
1440 | { | ||
1441 | int ret; | ||
1442 | @@ -1104,12 +1142,25 @@ static int ov5640_set_stream_mipi(struct ov5640_dev *sensor, bool on) | ||
1443 | { | ||
1444 | int ret; | ||
1445 | |||
1446 | - ret = ov5640_mod_reg(sensor, OV5640_REG_MIPI_CTRL00, BIT(5), | ||
1447 | - on ? 0 : BIT(5)); | ||
1448 | - if (ret) | ||
1449 | - return ret; | ||
1450 | - ret = ov5640_write_reg(sensor, OV5640_REG_PAD_OUTPUT00, | ||
1451 | - on ? 0x00 : 0x70); | ||
1452 | + /* | ||
1453 | + * Enable/disable the MIPI interface | ||
1454 | + * | ||
1455 | + * 0x300e = on ? 0x45 : 0x40 | ||
1456 | + * | ||
1457 | + * FIXME: the sensor manual (version 2.03) reports | ||
1458 | + * [7:5] = 000 : 1 data lane mode | ||
1459 | + * [7:5] = 001 : 2 data lanes mode | ||
1460 | + * But this settings do not work, while the following ones | ||
1461 | + * have been validated for 2 data lanes mode. | ||
1462 | + * | ||
1463 | + * [7:5] = 010 : 2 data lanes mode | ||
1464 | + * [4] = 0 : Power up MIPI HS Tx | ||
1465 | + * [3] = 0 : Power up MIPI LS Rx | ||
1466 | + * [2] = 1/0 : MIPI interface enable/disable | ||
1467 | + * [1:0] = 01/00: FIXME: 'debug' | ||
1468 | + */ | ||
1469 | + ret = ov5640_write_reg(sensor, OV5640_REG_IO_MIPI_CTRL00, | ||
1470 | + on ? 0x45 : 0x40); | ||
1471 | if (ret) | ||
1472 | return ret; | ||
1473 | |||
1474 | @@ -1333,7 +1384,7 @@ static int ov5640_set_ae_target(struct ov5640_dev *sensor, int target) | ||
1475 | return ov5640_write_reg(sensor, OV5640_REG_AEC_CTRL1F, fast_low); | ||
1476 | } | ||
1477 | |||
1478 | -static int ov5640_binning_on(struct ov5640_dev *sensor) | ||
1479 | +static int ov5640_get_binning(struct ov5640_dev *sensor) | ||
1480 | { | ||
1481 | u8 temp; | ||
1482 | int ret; | ||
1483 | @@ -1341,8 +1392,8 @@ static int ov5640_binning_on(struct ov5640_dev *sensor) | ||
1484 | ret = ov5640_read_reg(sensor, OV5640_REG_TIMING_TC_REG21, &temp); | ||
1485 | if (ret) | ||
1486 | return ret; | ||
1487 | - temp &= 0xfe; | ||
1488 | - return temp ? 1 : 0; | ||
1489 | + | ||
1490 | + return temp & BIT(0); | ||
1491 | } | ||
1492 | |||
1493 | static int ov5640_set_binning(struct ov5640_dev *sensor, bool enable) | ||
1494 | @@ -1387,30 +1438,6 @@ static int ov5640_set_virtual_channel(struct ov5640_dev *sensor) | ||
1495 | return ov5640_write_reg(sensor, OV5640_REG_DEBUG_MODE, temp); | ||
1496 | } | ||
1497 | |||
1498 | -static int ov5640_set_timings(struct ov5640_dev *sensor, | ||
1499 | - const struct ov5640_mode_info *mode) | ||
1500 | -{ | ||
1501 | - int ret; | ||
1502 | - | ||
1503 | - ret = ov5640_write_reg16(sensor, OV5640_REG_TIMING_DVPHO, mode->hact); | ||
1504 | - if (ret < 0) | ||
1505 | - return ret; | ||
1506 | - | ||
1507 | - ret = ov5640_write_reg16(sensor, OV5640_REG_TIMING_DVPVO, mode->vact); | ||
1508 | - if (ret < 0) | ||
1509 | - return ret; | ||
1510 | - | ||
1511 | - ret = ov5640_write_reg16(sensor, OV5640_REG_TIMING_HTS, mode->htot); | ||
1512 | - if (ret < 0) | ||
1513 | - return ret; | ||
1514 | - | ||
1515 | - ret = ov5640_write_reg16(sensor, OV5640_REG_TIMING_VTS, mode->vtot); | ||
1516 | - if (ret < 0) | ||
1517 | - return ret; | ||
1518 | - | ||
1519 | - return 0; | ||
1520 | -} | ||
1521 | - | ||
1522 | static const struct ov5640_mode_info * | ||
1523 | ov5640_find_mode(struct ov5640_dev *sensor, enum ov5640_frame_rate fr, | ||
1524 | int width, int height, bool nearest) | ||
1525 | @@ -1452,7 +1479,7 @@ static int ov5640_set_mode_exposure_calc(struct ov5640_dev *sensor, | ||
1526 | if (ret < 0) | ||
1527 | return ret; | ||
1528 | prev_shutter = ret; | ||
1529 | - ret = ov5640_binning_on(sensor); | ||
1530 | + ret = ov5640_get_binning(sensor); | ||
1531 | if (ret < 0) | ||
1532 | return ret; | ||
1533 | if (ret && mode->id != OV5640_MODE_720P_1280_720 && | ||
1534 | @@ -1573,7 +1600,7 @@ static int ov5640_set_mode_exposure_calc(struct ov5640_dev *sensor, | ||
1535 | } | ||
1536 | |||
1537 | /* set capture gain */ | ||
1538 | - ret = __v4l2_ctrl_s_ctrl(sensor->ctrls.gain, cap_gain16); | ||
1539 | + ret = ov5640_set_gain(sensor, cap_gain16); | ||
1540 | if (ret) | ||
1541 | return ret; | ||
1542 | |||
1543 | @@ -1586,7 +1613,7 @@ static int ov5640_set_mode_exposure_calc(struct ov5640_dev *sensor, | ||
1544 | } | ||
1545 | |||
1546 | /* set exposure */ | ||
1547 | - return __v4l2_ctrl_s_ctrl(sensor->ctrls.exposure, cap_shutter); | ||
1548 | + return ov5640_set_exposure(sensor, cap_shutter); | ||
1549 | } | ||
1550 | |||
1551 | /* | ||
1552 | @@ -1594,25 +1621,13 @@ static int ov5640_set_mode_exposure_calc(struct ov5640_dev *sensor, | ||
1553 | * change mode directly | ||
1554 | */ | ||
1555 | static int ov5640_set_mode_direct(struct ov5640_dev *sensor, | ||
1556 | - const struct ov5640_mode_info *mode, | ||
1557 | - s32 exposure) | ||
1558 | + const struct ov5640_mode_info *mode) | ||
1559 | { | ||
1560 | - int ret; | ||
1561 | - | ||
1562 | if (!mode->reg_data) | ||
1563 | return -EINVAL; | ||
1564 | |||
1565 | /* Write capture setting */ | ||
1566 | - ret = ov5640_load_regs(sensor, mode); | ||
1567 | - if (ret < 0) | ||
1568 | - return ret; | ||
1569 | - | ||
1570 | - /* turn auto gain/exposure back on for direct mode */ | ||
1571 | - ret = __v4l2_ctrl_s_ctrl(sensor->ctrls.auto_gain, 1); | ||
1572 | - if (ret) | ||
1573 | - return ret; | ||
1574 | - | ||
1575 | - return __v4l2_ctrl_s_ctrl(sensor->ctrls.auto_exp, exposure); | ||
1576 | + return ov5640_load_regs(sensor, mode); | ||
1577 | } | ||
1578 | |||
1579 | static int ov5640_set_mode(struct ov5640_dev *sensor) | ||
1580 | @@ -1620,27 +1635,31 @@ static int ov5640_set_mode(struct ov5640_dev *sensor) | ||
1581 | const struct ov5640_mode_info *mode = sensor->current_mode; | ||
1582 | const struct ov5640_mode_info *orig_mode = sensor->last_mode; | ||
1583 | enum ov5640_downsize_mode dn_mode, orig_dn_mode; | ||
1584 | - s32 exposure; | ||
1585 | + bool auto_gain = sensor->ctrls.auto_gain->val == 1; | ||
1586 | + bool auto_exp = sensor->ctrls.auto_exp->val == V4L2_EXPOSURE_AUTO; | ||
1587 | int ret; | ||
1588 | |||
1589 | dn_mode = mode->dn_mode; | ||
1590 | orig_dn_mode = orig_mode->dn_mode; | ||
1591 | |||
1592 | /* auto gain and exposure must be turned off when changing modes */ | ||
1593 | - ret = __v4l2_ctrl_s_ctrl(sensor->ctrls.auto_gain, 0); | ||
1594 | - if (ret) | ||
1595 | - return ret; | ||
1596 | + if (auto_gain) { | ||
1597 | + ret = ov5640_set_autogain(sensor, false); | ||
1598 | + if (ret) | ||
1599 | + return ret; | ||
1600 | + } | ||
1601 | |||
1602 | - exposure = sensor->ctrls.auto_exp->val; | ||
1603 | - ret = ov5640_set_exposure(sensor, V4L2_EXPOSURE_MANUAL); | ||
1604 | - if (ret) | ||
1605 | - return ret; | ||
1606 | + if (auto_exp) { | ||
1607 | + ret = ov5640_set_autoexposure(sensor, false); | ||
1608 | + if (ret) | ||
1609 | + goto restore_auto_gain; | ||
1610 | + } | ||
1611 | |||
1612 | if ((dn_mode == SUBSAMPLING && orig_dn_mode == SCALING) || | ||
1613 | (dn_mode == SCALING && orig_dn_mode == SUBSAMPLING)) { | ||
1614 | /* | ||
1615 | * change between subsampling and scaling | ||
1616 | - * go through exposure calucation | ||
1617 | + * go through exposure calculation | ||
1618 | */ | ||
1619 | ret = ov5640_set_mode_exposure_calc(sensor, mode); | ||
1620 | } else { | ||
1621 | @@ -1648,15 +1667,16 @@ static int ov5640_set_mode(struct ov5640_dev *sensor) | ||
1622 | * change inside subsampling or scaling | ||
1623 | * download firmware directly | ||
1624 | */ | ||
1625 | - ret = ov5640_set_mode_direct(sensor, mode, exposure); | ||
1626 | + ret = ov5640_set_mode_direct(sensor, mode); | ||
1627 | } | ||
1628 | - | ||
1629 | if (ret < 0) | ||
1630 | - return ret; | ||
1631 | + goto restore_auto_exp_gain; | ||
1632 | |||
1633 | - ret = ov5640_set_timings(sensor, mode); | ||
1634 | - if (ret < 0) | ||
1635 | - return ret; | ||
1636 | + /* restore auto gain and exposure */ | ||
1637 | + if (auto_gain) | ||
1638 | + ov5640_set_autogain(sensor, true); | ||
1639 | + if (auto_exp) | ||
1640 | + ov5640_set_autoexposure(sensor, true); | ||
1641 | |||
1642 | ret = ov5640_set_binning(sensor, dn_mode != SCALING); | ||
1643 | if (ret < 0) | ||
1644 | @@ -1678,6 +1698,15 @@ static int ov5640_set_mode(struct ov5640_dev *sensor) | ||
1645 | sensor->last_mode = mode; | ||
1646 | |||
1647 | return 0; | ||
1648 | + | ||
1649 | +restore_auto_exp_gain: | ||
1650 | + if (auto_exp) | ||
1651 | + ov5640_set_autoexposure(sensor, true); | ||
1652 | +restore_auto_gain: | ||
1653 | + if (auto_gain) | ||
1654 | + ov5640_set_autogain(sensor, true); | ||
1655 | + | ||
1656 | + return ret; | ||
1657 | } | ||
1658 | |||
1659 | static int ov5640_set_framefmt(struct ov5640_dev *sensor, | ||
1660 | @@ -1790,23 +1819,69 @@ static int ov5640_set_power(struct ov5640_dev *sensor, bool on) | ||
1661 | if (ret) | ||
1662 | goto power_off; | ||
1663 | |||
1664 | + /* We're done here for DVP bus, while CSI-2 needs setup. */ | ||
1665 | + if (sensor->ep.bus_type != V4L2_MBUS_CSI2) | ||
1666 | + return 0; | ||
1667 | + | ||
1668 | + /* | ||
1669 | + * Power up MIPI HS Tx and LS Rx; 2 data lanes mode | ||
1670 | + * | ||
1671 | + * 0x300e = 0x40 | ||
1672 | + * [7:5] = 010 : 2 data lanes mode (see FIXME note in | ||
1673 | + * "ov5640_set_stream_mipi()") | ||
1674 | + * [4] = 0 : Power up MIPI HS Tx | ||
1675 | + * [3] = 0 : Power up MIPI LS Rx | ||
1676 | + * [2] = 0 : MIPI interface disabled | ||
1677 | + */ | ||
1678 | + ret = ov5640_write_reg(sensor, | ||
1679 | + OV5640_REG_IO_MIPI_CTRL00, 0x40); | ||
1680 | + if (ret) | ||
1681 | + goto power_off; | ||
1682 | + | ||
1683 | + /* | ||
1684 | + * Gate clock and set LP11 in 'no packets mode' (idle) | ||
1685 | + * | ||
1686 | + * 0x4800 = 0x24 | ||
1687 | + * [5] = 1 : Gate clock when 'no packets' | ||
1688 | + * [2] = 1 : MIPI bus in LP11 when 'no packets' | ||
1689 | + */ | ||
1690 | + ret = ov5640_write_reg(sensor, | ||
1691 | + OV5640_REG_MIPI_CTRL00, 0x24); | ||
1692 | + if (ret) | ||
1693 | + goto power_off; | ||
1694 | + | ||
1695 | + /* | ||
1696 | + * Set data lanes and clock in LP11 when 'sleeping' | ||
1697 | + * | ||
1698 | + * 0x3019 = 0x70 | ||
1699 | + * [6] = 1 : MIPI data lane 2 in LP11 when 'sleeping' | ||
1700 | + * [5] = 1 : MIPI data lane 1 in LP11 when 'sleeping' | ||
1701 | + * [4] = 1 : MIPI clock lane in LP11 when 'sleeping' | ||
1702 | + */ | ||
1703 | + ret = ov5640_write_reg(sensor, | ||
1704 | + OV5640_REG_PAD_OUTPUT00, 0x70); | ||
1705 | + if (ret) | ||
1706 | + goto power_off; | ||
1707 | + | ||
1708 | + /* Give lanes some time to coax into LP11 state. */ | ||
1709 | + usleep_range(500, 1000); | ||
1710 | + | ||
1711 | + } else { | ||
1712 | if (sensor->ep.bus_type == V4L2_MBUS_CSI2) { | ||
1713 | - /* | ||
1714 | - * start streaming briefly followed by stream off in | ||
1715 | - * order to coax the clock lane into LP-11 state. | ||
1716 | - */ | ||
1717 | - ret = ov5640_set_stream_mipi(sensor, true); | ||
1718 | - if (ret) | ||
1719 | - goto power_off; | ||
1720 | - usleep_range(1000, 2000); | ||
1721 | - ret = ov5640_set_stream_mipi(sensor, false); | ||
1722 | - if (ret) | ||
1723 | - goto power_off; | ||
1724 | + /* Reset MIPI bus settings to their default values. */ | ||
1725 | + ov5640_write_reg(sensor, | ||
1726 | + OV5640_REG_IO_MIPI_CTRL00, 0x58); | ||
1727 | + ov5640_write_reg(sensor, | ||
1728 | + OV5640_REG_MIPI_CTRL00, 0x04); | ||
1729 | + ov5640_write_reg(sensor, | ||
1730 | + OV5640_REG_PAD_OUTPUT00, 0x00); | ||
1731 | } | ||
1732 | |||
1733 | - return 0; | ||
1734 | + ov5640_set_power_off(sensor); | ||
1735 | } | ||
1736 | |||
1737 | + return 0; | ||
1738 | + | ||
1739 | power_off: | ||
1740 | ov5640_set_power_off(sensor); | ||
1741 | return ret; | ||
1742 | @@ -2144,20 +2219,20 @@ static int ov5640_set_ctrl_white_balance(struct ov5640_dev *sensor, int awb) | ||
1743 | return ret; | ||
1744 | } | ||
1745 | |||
1746 | -static int ov5640_set_ctrl_exposure(struct ov5640_dev *sensor, int exp) | ||
1747 | +static int ov5640_set_ctrl_exposure(struct ov5640_dev *sensor, | ||
1748 | + enum v4l2_exposure_auto_type auto_exposure) | ||
1749 | { | ||
1750 | struct ov5640_ctrls *ctrls = &sensor->ctrls; | ||
1751 | - bool auto_exposure = (exp == V4L2_EXPOSURE_AUTO); | ||
1752 | + bool auto_exp = (auto_exposure == V4L2_EXPOSURE_AUTO); | ||
1753 | int ret = 0; | ||
1754 | |||
1755 | if (ctrls->auto_exp->is_new) { | ||
1756 | - ret = ov5640_mod_reg(sensor, OV5640_REG_AEC_PK_MANUAL, | ||
1757 | - BIT(0), auto_exposure ? 0 : BIT(0)); | ||
1758 | + ret = ov5640_set_autoexposure(sensor, auto_exp); | ||
1759 | if (ret) | ||
1760 | return ret; | ||
1761 | } | ||
1762 | |||
1763 | - if (!auto_exposure && ctrls->exposure->is_new) { | ||
1764 | + if (!auto_exp && ctrls->exposure->is_new) { | ||
1765 | u16 max_exp; | ||
1766 | |||
1767 | ret = ov5640_read_reg16(sensor, OV5640_REG_AEC_PK_VTS, | ||
1768 | @@ -2177,25 +2252,19 @@ static int ov5640_set_ctrl_exposure(struct ov5640_dev *sensor, int exp) | ||
1769 | return ret; | ||
1770 | } | ||
1771 | |||
1772 | -static int ov5640_set_ctrl_gain(struct ov5640_dev *sensor, int auto_gain) | ||
1773 | +static int ov5640_set_ctrl_gain(struct ov5640_dev *sensor, bool auto_gain) | ||
1774 | { | ||
1775 | struct ov5640_ctrls *ctrls = &sensor->ctrls; | ||
1776 | int ret = 0; | ||
1777 | |||
1778 | if (ctrls->auto_gain->is_new) { | ||
1779 | - ret = ov5640_mod_reg(sensor, OV5640_REG_AEC_PK_MANUAL, | ||
1780 | - BIT(1), | ||
1781 | - ctrls->auto_gain->val ? 0 : BIT(1)); | ||
1782 | + ret = ov5640_set_autogain(sensor, auto_gain); | ||
1783 | if (ret) | ||
1784 | return ret; | ||
1785 | } | ||
1786 | |||
1787 | - if (!auto_gain && ctrls->gain->is_new) { | ||
1788 | - u16 gain = (u16)ctrls->gain->val; | ||
1789 | - | ||
1790 | - ret = ov5640_write_reg16(sensor, OV5640_REG_AEC_PK_REAL_GAIN, | ||
1791 | - gain & 0x3ff); | ||
1792 | - } | ||
1793 | + if (!auto_gain && ctrls->gain->is_new) | ||
1794 | + ret = ov5640_set_gain(sensor, ctrls->gain->val); | ||
1795 | |||
1796 | return ret; | ||
1797 | } | ||
1798 | @@ -2268,16 +2337,12 @@ static int ov5640_g_volatile_ctrl(struct v4l2_ctrl *ctrl) | ||
1799 | |||
1800 | switch (ctrl->id) { | ||
1801 | case V4L2_CID_AUTOGAIN: | ||
1802 | - if (!ctrl->val) | ||
1803 | - return 0; | ||
1804 | val = ov5640_get_gain(sensor); | ||
1805 | if (val < 0) | ||
1806 | return val; | ||
1807 | sensor->ctrls.gain->val = val; | ||
1808 | break; | ||
1809 | case V4L2_CID_EXPOSURE_AUTO: | ||
1810 | - if (ctrl->val == V4L2_EXPOSURE_MANUAL) | ||
1811 | - return 0; | ||
1812 | val = ov5640_get_exposure(sensor); | ||
1813 | if (val < 0) | ||
1814 | return val; | ||
1815 | diff --git a/drivers/mmc/host/sdhci-pci-core.c b/drivers/mmc/host/sdhci-pci-core.c | ||
1816 | index 7bfd366d970d..c4115bae5db1 100644 | ||
1817 | --- a/drivers/mmc/host/sdhci-pci-core.c | ||
1818 | +++ b/drivers/mmc/host/sdhci-pci-core.c | ||
1819 | @@ -12,6 +12,7 @@ | ||
1820 | * - JMicron (hardware and technical support) | ||
1821 | */ | ||
1822 | |||
1823 | +#include <linux/bitfield.h> | ||
1824 | #include <linux/string.h> | ||
1825 | #include <linux/delay.h> | ||
1826 | #include <linux/highmem.h> | ||
1827 | @@ -462,6 +463,9 @@ struct intel_host { | ||
1828 | u32 dsm_fns; | ||
1829 | int drv_strength; | ||
1830 | bool d3_retune; | ||
1831 | + bool rpm_retune_ok; | ||
1832 | + u32 glk_rx_ctrl1; | ||
1833 | + u32 glk_tun_val; | ||
1834 | }; | ||
1835 | |||
1836 | static const guid_t intel_dsm_guid = | ||
1837 | @@ -791,6 +795,77 @@ cleanup: | ||
1838 | return ret; | ||
1839 | } | ||
1840 | |||
1841 | +#ifdef CONFIG_PM | ||
1842 | +#define GLK_RX_CTRL1 0x834 | ||
1843 | +#define GLK_TUN_VAL 0x840 | ||
1844 | +#define GLK_PATH_PLL GENMASK(13, 8) | ||
1845 | +#define GLK_DLY GENMASK(6, 0) | ||
1846 | +/* Workaround firmware failing to restore the tuning value */ | ||
1847 | +static void glk_rpm_retune_wa(struct sdhci_pci_chip *chip, bool susp) | ||
1848 | +{ | ||
1849 | + struct sdhci_pci_slot *slot = chip->slots[0]; | ||
1850 | + struct intel_host *intel_host = sdhci_pci_priv(slot); | ||
1851 | + struct sdhci_host *host = slot->host; | ||
1852 | + u32 glk_rx_ctrl1; | ||
1853 | + u32 glk_tun_val; | ||
1854 | + u32 dly; | ||
1855 | + | ||
1856 | + if (intel_host->rpm_retune_ok || !mmc_can_retune(host->mmc)) | ||
1857 | + return; | ||
1858 | + | ||
1859 | + glk_rx_ctrl1 = sdhci_readl(host, GLK_RX_CTRL1); | ||
1860 | + glk_tun_val = sdhci_readl(host, GLK_TUN_VAL); | ||
1861 | + | ||
1862 | + if (susp) { | ||
1863 | + intel_host->glk_rx_ctrl1 = glk_rx_ctrl1; | ||
1864 | + intel_host->glk_tun_val = glk_tun_val; | ||
1865 | + return; | ||
1866 | + } | ||
1867 | + | ||
1868 | + if (!intel_host->glk_tun_val) | ||
1869 | + return; | ||
1870 | + | ||
1871 | + if (glk_rx_ctrl1 != intel_host->glk_rx_ctrl1) { | ||
1872 | + intel_host->rpm_retune_ok = true; | ||
1873 | + return; | ||
1874 | + } | ||
1875 | + | ||
1876 | + dly = FIELD_PREP(GLK_DLY, FIELD_GET(GLK_PATH_PLL, glk_rx_ctrl1) + | ||
1877 | + (intel_host->glk_tun_val << 1)); | ||
1878 | + if (dly == FIELD_GET(GLK_DLY, glk_rx_ctrl1)) | ||
1879 | + return; | ||
1880 | + | ||
1881 | + glk_rx_ctrl1 = (glk_rx_ctrl1 & ~GLK_DLY) | dly; | ||
1882 | + sdhci_writel(host, glk_rx_ctrl1, GLK_RX_CTRL1); | ||
1883 | + | ||
1884 | + intel_host->rpm_retune_ok = true; | ||
1885 | + chip->rpm_retune = true; | ||
1886 | + mmc_retune_needed(host->mmc); | ||
1887 | + pr_info("%s: Requiring re-tune after rpm resume", mmc_hostname(host->mmc)); | ||
1888 | +} | ||
1889 | + | ||
1890 | +static void glk_rpm_retune_chk(struct sdhci_pci_chip *chip, bool susp) | ||
1891 | +{ | ||
1892 | + if (chip->pdev->device == PCI_DEVICE_ID_INTEL_GLK_EMMC && | ||
1893 | + !chip->rpm_retune) | ||
1894 | + glk_rpm_retune_wa(chip, susp); | ||
1895 | +} | ||
1896 | + | ||
1897 | +static int glk_runtime_suspend(struct sdhci_pci_chip *chip) | ||
1898 | +{ | ||
1899 | + glk_rpm_retune_chk(chip, true); | ||
1900 | + | ||
1901 | + return sdhci_cqhci_runtime_suspend(chip); | ||
1902 | +} | ||
1903 | + | ||
1904 | +static int glk_runtime_resume(struct sdhci_pci_chip *chip) | ||
1905 | +{ | ||
1906 | + glk_rpm_retune_chk(chip, false); | ||
1907 | + | ||
1908 | + return sdhci_cqhci_runtime_resume(chip); | ||
1909 | +} | ||
1910 | +#endif | ||
1911 | + | ||
1912 | #ifdef CONFIG_ACPI | ||
1913 | static int ni_set_max_freq(struct sdhci_pci_slot *slot) | ||
1914 | { | ||
1915 | @@ -879,8 +954,8 @@ static const struct sdhci_pci_fixes sdhci_intel_glk_emmc = { | ||
1916 | .resume = sdhci_cqhci_resume, | ||
1917 | #endif | ||
1918 | #ifdef CONFIG_PM | ||
1919 | - .runtime_suspend = sdhci_cqhci_runtime_suspend, | ||
1920 | - .runtime_resume = sdhci_cqhci_runtime_resume, | ||
1921 | + .runtime_suspend = glk_runtime_suspend, | ||
1922 | + .runtime_resume = glk_runtime_resume, | ||
1923 | #endif | ||
1924 | .quirks = SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC, | ||
1925 | .quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN | | ||
1926 | @@ -1762,8 +1837,13 @@ static struct sdhci_pci_slot *sdhci_pci_probe_slot( | ||
1927 | device_init_wakeup(&pdev->dev, true); | ||
1928 | |||
1929 | if (slot->cd_idx >= 0) { | ||
1930 | - ret = mmc_gpiod_request_cd(host->mmc, NULL, slot->cd_idx, | ||
1931 | + ret = mmc_gpiod_request_cd(host->mmc, "cd", slot->cd_idx, | ||
1932 | slot->cd_override_level, 0, NULL); | ||
1933 | + if (ret && ret != -EPROBE_DEFER) | ||
1934 | + ret = mmc_gpiod_request_cd(host->mmc, NULL, | ||
1935 | + slot->cd_idx, | ||
1936 | + slot->cd_override_level, | ||
1937 | + 0, NULL); | ||
1938 | if (ret == -EPROBE_DEFER) | ||
1939 | goto remove; | ||
1940 | |||
1941 | diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c | ||
1942 | index 49163570a63a..3b3f88ffab53 100644 | ||
1943 | --- a/drivers/net/can/dev.c | ||
1944 | +++ b/drivers/net/can/dev.c | ||
1945 | @@ -477,6 +477,34 @@ void can_put_echo_skb(struct sk_buff *skb, struct net_device *dev, | ||
1946 | } | ||
1947 | EXPORT_SYMBOL_GPL(can_put_echo_skb); | ||
1948 | |||
1949 | +struct sk_buff *__can_get_echo_skb(struct net_device *dev, unsigned int idx, u8 *len_ptr) | ||
1950 | +{ | ||
1951 | + struct can_priv *priv = netdev_priv(dev); | ||
1952 | + struct sk_buff *skb = priv->echo_skb[idx]; | ||
1953 | + struct canfd_frame *cf; | ||
1954 | + | ||
1955 | + if (idx >= priv->echo_skb_max) { | ||
1956 | + netdev_err(dev, "%s: BUG! Trying to access can_priv::echo_skb out of bounds (%u/max %u)\n", | ||
1957 | + __func__, idx, priv->echo_skb_max); | ||
1958 | + return NULL; | ||
1959 | + } | ||
1960 | + | ||
1961 | + if (!skb) { | ||
1962 | + netdev_err(dev, "%s: BUG! Trying to echo non existing skb: can_priv::echo_skb[%u]\n", | ||
1963 | + __func__, idx); | ||
1964 | + return NULL; | ||
1965 | + } | ||
1966 | + | ||
1967 | + /* Using "struct canfd_frame::len" for the frame | ||
1968 | + * length is supported on both CAN and CANFD frames. | ||
1969 | + */ | ||
1970 | + cf = (struct canfd_frame *)skb->data; | ||
1971 | + *len_ptr = cf->len; | ||
1972 | + priv->echo_skb[idx] = NULL; | ||
1973 | + | ||
1974 | + return skb; | ||
1975 | +} | ||
1976 | + | ||
1977 | /* | ||
1978 | * Get the skb from the stack and loop it back locally | ||
1979 | * | ||
1980 | @@ -486,22 +514,16 @@ EXPORT_SYMBOL_GPL(can_put_echo_skb); | ||
1981 | */ | ||
1982 | unsigned int can_get_echo_skb(struct net_device *dev, unsigned int idx) | ||
1983 | { | ||
1984 | - struct can_priv *priv = netdev_priv(dev); | ||
1985 | - | ||
1986 | - BUG_ON(idx >= priv->echo_skb_max); | ||
1987 | - | ||
1988 | - if (priv->echo_skb[idx]) { | ||
1989 | - struct sk_buff *skb = priv->echo_skb[idx]; | ||
1990 | - struct can_frame *cf = (struct can_frame *)skb->data; | ||
1991 | - u8 dlc = cf->can_dlc; | ||
1992 | + struct sk_buff *skb; | ||
1993 | + u8 len; | ||
1994 | |||
1995 | - netif_rx(priv->echo_skb[idx]); | ||
1996 | - priv->echo_skb[idx] = NULL; | ||
1997 | + skb = __can_get_echo_skb(dev, idx, &len); | ||
1998 | + if (!skb) | ||
1999 | + return 0; | ||
2000 | |||
2001 | - return dlc; | ||
2002 | - } | ||
2003 | + netif_rx(skb); | ||
2004 | |||
2005 | - return 0; | ||
2006 | + return len; | ||
2007 | } | ||
2008 | EXPORT_SYMBOL_GPL(can_get_echo_skb); | ||
2009 | |||
2010 | diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c | ||
2011 | index 8e972ef08637..75ce11395ee8 100644 | ||
2012 | --- a/drivers/net/can/flexcan.c | ||
2013 | +++ b/drivers/net/can/flexcan.c | ||
2014 | @@ -135,13 +135,12 @@ | ||
2015 | |||
2016 | /* FLEXCAN interrupt flag register (IFLAG) bits */ | ||
2017 | /* Errata ERR005829 step7: Reserve first valid MB */ | ||
2018 | -#define FLEXCAN_TX_MB_RESERVED_OFF_FIFO 8 | ||
2019 | -#define FLEXCAN_TX_MB_OFF_FIFO 9 | ||
2020 | +#define FLEXCAN_TX_MB_RESERVED_OFF_FIFO 8 | ||
2021 | #define FLEXCAN_TX_MB_RESERVED_OFF_TIMESTAMP 0 | ||
2022 | -#define FLEXCAN_TX_MB_OFF_TIMESTAMP 1 | ||
2023 | -#define FLEXCAN_RX_MB_OFF_TIMESTAMP_FIRST (FLEXCAN_TX_MB_OFF_TIMESTAMP + 1) | ||
2024 | -#define FLEXCAN_RX_MB_OFF_TIMESTAMP_LAST 63 | ||
2025 | -#define FLEXCAN_IFLAG_MB(x) BIT(x) | ||
2026 | +#define FLEXCAN_TX_MB 63 | ||
2027 | +#define FLEXCAN_RX_MB_OFF_TIMESTAMP_FIRST (FLEXCAN_TX_MB_RESERVED_OFF_TIMESTAMP + 1) | ||
2028 | +#define FLEXCAN_RX_MB_OFF_TIMESTAMP_LAST (FLEXCAN_TX_MB - 1) | ||
2029 | +#define FLEXCAN_IFLAG_MB(x) BIT(x & 0x1f) | ||
2030 | #define FLEXCAN_IFLAG_RX_FIFO_OVERFLOW BIT(7) | ||
2031 | #define FLEXCAN_IFLAG_RX_FIFO_WARN BIT(6) | ||
2032 | #define FLEXCAN_IFLAG_RX_FIFO_AVAILABLE BIT(5) | ||
2033 | @@ -259,9 +258,7 @@ struct flexcan_priv { | ||
2034 | struct can_rx_offload offload; | ||
2035 | |||
2036 | struct flexcan_regs __iomem *regs; | ||
2037 | - struct flexcan_mb __iomem *tx_mb; | ||
2038 | struct flexcan_mb __iomem *tx_mb_reserved; | ||
2039 | - u8 tx_mb_idx; | ||
2040 | u32 reg_ctrl_default; | ||
2041 | u32 reg_imask1_default; | ||
2042 | u32 reg_imask2_default; | ||
2043 | @@ -515,6 +512,7 @@ static int flexcan_get_berr_counter(const struct net_device *dev, | ||
2044 | static netdev_tx_t flexcan_start_xmit(struct sk_buff *skb, struct net_device *dev) | ||
2045 | { | ||
2046 | const struct flexcan_priv *priv = netdev_priv(dev); | ||
2047 | + struct flexcan_regs __iomem *regs = priv->regs; | ||
2048 | struct can_frame *cf = (struct can_frame *)skb->data; | ||
2049 | u32 can_id; | ||
2050 | u32 data; | ||
2051 | @@ -537,17 +535,17 @@ static netdev_tx_t flexcan_start_xmit(struct sk_buff *skb, struct net_device *de | ||
2052 | |||
2053 | if (cf->can_dlc > 0) { | ||
2054 | data = be32_to_cpup((__be32 *)&cf->data[0]); | ||
2055 | - priv->write(data, &priv->tx_mb->data[0]); | ||
2056 | + priv->write(data, ®s->mb[FLEXCAN_TX_MB].data[0]); | ||
2057 | } | ||
2058 | if (cf->can_dlc > 4) { | ||
2059 | data = be32_to_cpup((__be32 *)&cf->data[4]); | ||
2060 | - priv->write(data, &priv->tx_mb->data[1]); | ||
2061 | + priv->write(data, ®s->mb[FLEXCAN_TX_MB].data[1]); | ||
2062 | } | ||
2063 | |||
2064 | can_put_echo_skb(skb, dev, 0); | ||
2065 | |||
2066 | - priv->write(can_id, &priv->tx_mb->can_id); | ||
2067 | - priv->write(ctrl, &priv->tx_mb->can_ctrl); | ||
2068 | + priv->write(can_id, ®s->mb[FLEXCAN_TX_MB].can_id); | ||
2069 | + priv->write(ctrl, ®s->mb[FLEXCAN_TX_MB].can_ctrl); | ||
2070 | |||
2071 | /* Errata ERR005829 step8: | ||
2072 | * Write twice INACTIVE(0x8) code to first MB. | ||
2073 | @@ -563,9 +561,13 @@ static netdev_tx_t flexcan_start_xmit(struct sk_buff *skb, struct net_device *de | ||
2074 | static void flexcan_irq_bus_err(struct net_device *dev, u32 reg_esr) | ||
2075 | { | ||
2076 | struct flexcan_priv *priv = netdev_priv(dev); | ||
2077 | + struct flexcan_regs __iomem *regs = priv->regs; | ||
2078 | struct sk_buff *skb; | ||
2079 | struct can_frame *cf; | ||
2080 | bool rx_errors = false, tx_errors = false; | ||
2081 | + u32 timestamp; | ||
2082 | + | ||
2083 | + timestamp = priv->read(®s->timer) << 16; | ||
2084 | |||
2085 | skb = alloc_can_err_skb(dev, &cf); | ||
2086 | if (unlikely(!skb)) | ||
2087 | @@ -612,17 +614,21 @@ static void flexcan_irq_bus_err(struct net_device *dev, u32 reg_esr) | ||
2088 | if (tx_errors) | ||
2089 | dev->stats.tx_errors++; | ||
2090 | |||
2091 | - can_rx_offload_irq_queue_err_skb(&priv->offload, skb); | ||
2092 | + can_rx_offload_queue_sorted(&priv->offload, skb, timestamp); | ||
2093 | } | ||
2094 | |||
2095 | static void flexcan_irq_state(struct net_device *dev, u32 reg_esr) | ||
2096 | { | ||
2097 | struct flexcan_priv *priv = netdev_priv(dev); | ||
2098 | + struct flexcan_regs __iomem *regs = priv->regs; | ||
2099 | struct sk_buff *skb; | ||
2100 | struct can_frame *cf; | ||
2101 | enum can_state new_state, rx_state, tx_state; | ||
2102 | int flt; | ||
2103 | struct can_berr_counter bec; | ||
2104 | + u32 timestamp; | ||
2105 | + | ||
2106 | + timestamp = priv->read(®s->timer) << 16; | ||
2107 | |||
2108 | flt = reg_esr & FLEXCAN_ESR_FLT_CONF_MASK; | ||
2109 | if (likely(flt == FLEXCAN_ESR_FLT_CONF_ACTIVE)) { | ||
2110 | @@ -652,7 +658,7 @@ static void flexcan_irq_state(struct net_device *dev, u32 reg_esr) | ||
2111 | if (unlikely(new_state == CAN_STATE_BUS_OFF)) | ||
2112 | can_bus_off(dev); | ||
2113 | |||
2114 | - can_rx_offload_irq_queue_err_skb(&priv->offload, skb); | ||
2115 | + can_rx_offload_queue_sorted(&priv->offload, skb, timestamp); | ||
2116 | } | ||
2117 | |||
2118 | static inline struct flexcan_priv *rx_offload_to_priv(struct can_rx_offload *offload) | ||
2119 | @@ -720,9 +726,14 @@ static unsigned int flexcan_mailbox_read(struct can_rx_offload *offload, | ||
2120 | priv->write(BIT(n - 32), ®s->iflag2); | ||
2121 | } else { | ||
2122 | priv->write(FLEXCAN_IFLAG_RX_FIFO_AVAILABLE, ®s->iflag1); | ||
2123 | - priv->read(®s->timer); | ||
2124 | } | ||
2125 | |||
2126 | + /* Read the Free Running Timer. It is optional but recommended | ||
2127 | + * to unlock Mailbox as soon as possible and make it available | ||
2128 | + * for reception. | ||
2129 | + */ | ||
2130 | + priv->read(®s->timer); | ||
2131 | + | ||
2132 | return 1; | ||
2133 | } | ||
2134 | |||
2135 | @@ -732,9 +743,9 @@ static inline u64 flexcan_read_reg_iflag_rx(struct flexcan_priv *priv) | ||
2136 | struct flexcan_regs __iomem *regs = priv->regs; | ||
2137 | u32 iflag1, iflag2; | ||
2138 | |||
2139 | - iflag2 = priv->read(®s->iflag2) & priv->reg_imask2_default; | ||
2140 | - iflag1 = priv->read(®s->iflag1) & priv->reg_imask1_default & | ||
2141 | - ~FLEXCAN_IFLAG_MB(priv->tx_mb_idx); | ||
2142 | + iflag2 = priv->read(®s->iflag2) & priv->reg_imask2_default & | ||
2143 | + ~FLEXCAN_IFLAG_MB(FLEXCAN_TX_MB); | ||
2144 | + iflag1 = priv->read(®s->iflag1) & priv->reg_imask1_default; | ||
2145 | |||
2146 | return (u64)iflag2 << 32 | iflag1; | ||
2147 | } | ||
2148 | @@ -746,11 +757,9 @@ static irqreturn_t flexcan_irq(int irq, void *dev_id) | ||
2149 | struct flexcan_priv *priv = netdev_priv(dev); | ||
2150 | struct flexcan_regs __iomem *regs = priv->regs; | ||
2151 | irqreturn_t handled = IRQ_NONE; | ||
2152 | - u32 reg_iflag1, reg_esr; | ||
2153 | + u32 reg_iflag2, reg_esr; | ||
2154 | enum can_state last_state = priv->can.state; | ||
2155 | |||
2156 | - reg_iflag1 = priv->read(®s->iflag1); | ||
2157 | - | ||
2158 | /* reception interrupt */ | ||
2159 | if (priv->devtype_data->quirks & FLEXCAN_QUIRK_USE_OFF_TIMESTAMP) { | ||
2160 | u64 reg_iflag; | ||
2161 | @@ -764,6 +773,9 @@ static irqreturn_t flexcan_irq(int irq, void *dev_id) | ||
2162 | break; | ||
2163 | } | ||
2164 | } else { | ||
2165 | + u32 reg_iflag1; | ||
2166 | + | ||
2167 | + reg_iflag1 = priv->read(®s->iflag1); | ||
2168 | if (reg_iflag1 & FLEXCAN_IFLAG_RX_FIFO_AVAILABLE) { | ||
2169 | handled = IRQ_HANDLED; | ||
2170 | can_rx_offload_irq_offload_fifo(&priv->offload); | ||
2171 | @@ -779,17 +791,22 @@ static irqreturn_t flexcan_irq(int irq, void *dev_id) | ||
2172 | } | ||
2173 | } | ||
2174 | |||
2175 | + reg_iflag2 = priv->read(®s->iflag2); | ||
2176 | + | ||
2177 | /* transmission complete interrupt */ | ||
2178 | - if (reg_iflag1 & FLEXCAN_IFLAG_MB(priv->tx_mb_idx)) { | ||
2179 | + if (reg_iflag2 & FLEXCAN_IFLAG_MB(FLEXCAN_TX_MB)) { | ||
2180 | + u32 reg_ctrl = priv->read(®s->mb[FLEXCAN_TX_MB].can_ctrl); | ||
2181 | + | ||
2182 | handled = IRQ_HANDLED; | ||
2183 | - stats->tx_bytes += can_get_echo_skb(dev, 0); | ||
2184 | + stats->tx_bytes += can_rx_offload_get_echo_skb(&priv->offload, | ||
2185 | + 0, reg_ctrl << 16); | ||
2186 | stats->tx_packets++; | ||
2187 | can_led_event(dev, CAN_LED_EVENT_TX); | ||
2188 | |||
2189 | /* after sending a RTR frame MB is in RX mode */ | ||
2190 | priv->write(FLEXCAN_MB_CODE_TX_INACTIVE, | ||
2191 | - &priv->tx_mb->can_ctrl); | ||
2192 | - priv->write(FLEXCAN_IFLAG_MB(priv->tx_mb_idx), ®s->iflag1); | ||
2193 | + ®s->mb[FLEXCAN_TX_MB].can_ctrl); | ||
2194 | + priv->write(FLEXCAN_IFLAG_MB(FLEXCAN_TX_MB), ®s->iflag2); | ||
2195 | netif_wake_queue(dev); | ||
2196 | } | ||
2197 | |||
2198 | @@ -931,15 +948,13 @@ static int flexcan_chip_start(struct net_device *dev) | ||
2199 | reg_mcr &= ~FLEXCAN_MCR_MAXMB(0xff); | ||
2200 | reg_mcr |= FLEXCAN_MCR_FRZ | FLEXCAN_MCR_HALT | FLEXCAN_MCR_SUPV | | ||
2201 | FLEXCAN_MCR_WRN_EN | FLEXCAN_MCR_SRX_DIS | FLEXCAN_MCR_IRMQ | | ||
2202 | - FLEXCAN_MCR_IDAM_C; | ||
2203 | + FLEXCAN_MCR_IDAM_C | FLEXCAN_MCR_MAXMB(FLEXCAN_TX_MB); | ||
2204 | |||
2205 | - if (priv->devtype_data->quirks & FLEXCAN_QUIRK_USE_OFF_TIMESTAMP) { | ||
2206 | + if (priv->devtype_data->quirks & FLEXCAN_QUIRK_USE_OFF_TIMESTAMP) | ||
2207 | reg_mcr &= ~FLEXCAN_MCR_FEN; | ||
2208 | - reg_mcr |= FLEXCAN_MCR_MAXMB(priv->offload.mb_last); | ||
2209 | - } else { | ||
2210 | - reg_mcr |= FLEXCAN_MCR_FEN | | ||
2211 | - FLEXCAN_MCR_MAXMB(priv->tx_mb_idx); | ||
2212 | - } | ||
2213 | + else | ||
2214 | + reg_mcr |= FLEXCAN_MCR_FEN; | ||
2215 | + | ||
2216 | netdev_dbg(dev, "%s: writing mcr=0x%08x", __func__, reg_mcr); | ||
2217 | priv->write(reg_mcr, ®s->mcr); | ||
2218 | |||
2219 | @@ -982,16 +997,17 @@ static int flexcan_chip_start(struct net_device *dev) | ||
2220 | priv->write(reg_ctrl2, ®s->ctrl2); | ||
2221 | } | ||
2222 | |||
2223 | - /* clear and invalidate all mailboxes first */ | ||
2224 | - for (i = priv->tx_mb_idx; i < ARRAY_SIZE(regs->mb); i++) { | ||
2225 | - priv->write(FLEXCAN_MB_CODE_RX_INACTIVE, | ||
2226 | - ®s->mb[i].can_ctrl); | ||
2227 | - } | ||
2228 | - | ||
2229 | if (priv->devtype_data->quirks & FLEXCAN_QUIRK_USE_OFF_TIMESTAMP) { | ||
2230 | - for (i = priv->offload.mb_first; i <= priv->offload.mb_last; i++) | ||
2231 | + for (i = priv->offload.mb_first; i <= priv->offload.mb_last; i++) { | ||
2232 | priv->write(FLEXCAN_MB_CODE_RX_EMPTY, | ||
2233 | ®s->mb[i].can_ctrl); | ||
2234 | + } | ||
2235 | + } else { | ||
2236 | + /* clear and invalidate unused mailboxes first */ | ||
2237 | + for (i = FLEXCAN_TX_MB_RESERVED_OFF_FIFO; i <= ARRAY_SIZE(regs->mb); i++) { | ||
2238 | + priv->write(FLEXCAN_MB_CODE_RX_INACTIVE, | ||
2239 | + ®s->mb[i].can_ctrl); | ||
2240 | + } | ||
2241 | } | ||
2242 | |||
2243 | /* Errata ERR005829: mark first TX mailbox as INACTIVE */ | ||
2244 | @@ -1000,7 +1016,7 @@ static int flexcan_chip_start(struct net_device *dev) | ||
2245 | |||
2246 | /* mark TX mailbox as INACTIVE */ | ||
2247 | priv->write(FLEXCAN_MB_CODE_TX_INACTIVE, | ||
2248 | - &priv->tx_mb->can_ctrl); | ||
2249 | + ®s->mb[FLEXCAN_TX_MB].can_ctrl); | ||
2250 | |||
2251 | /* acceptance mask/acceptance code (accept everything) */ | ||
2252 | priv->write(0x0, ®s->rxgmask); | ||
2253 | @@ -1355,17 +1371,13 @@ static int flexcan_probe(struct platform_device *pdev) | ||
2254 | priv->devtype_data = devtype_data; | ||
2255 | priv->reg_xceiver = reg_xceiver; | ||
2256 | |||
2257 | - if (priv->devtype_data->quirks & FLEXCAN_QUIRK_USE_OFF_TIMESTAMP) { | ||
2258 | - priv->tx_mb_idx = FLEXCAN_TX_MB_OFF_TIMESTAMP; | ||
2259 | + if (priv->devtype_data->quirks & FLEXCAN_QUIRK_USE_OFF_TIMESTAMP) | ||
2260 | priv->tx_mb_reserved = ®s->mb[FLEXCAN_TX_MB_RESERVED_OFF_TIMESTAMP]; | ||
2261 | - } else { | ||
2262 | - priv->tx_mb_idx = FLEXCAN_TX_MB_OFF_FIFO; | ||
2263 | + else | ||
2264 | priv->tx_mb_reserved = ®s->mb[FLEXCAN_TX_MB_RESERVED_OFF_FIFO]; | ||
2265 | - } | ||
2266 | - priv->tx_mb = ®s->mb[priv->tx_mb_idx]; | ||
2267 | |||
2268 | - priv->reg_imask1_default = FLEXCAN_IFLAG_MB(priv->tx_mb_idx); | ||
2269 | - priv->reg_imask2_default = 0; | ||
2270 | + priv->reg_imask1_default = 0; | ||
2271 | + priv->reg_imask2_default = FLEXCAN_IFLAG_MB(FLEXCAN_TX_MB); | ||
2272 | |||
2273 | priv->offload.mailbox_read = flexcan_mailbox_read; | ||
2274 | |||
2275 | diff --git a/drivers/net/can/rx-offload.c b/drivers/net/can/rx-offload.c | ||
2276 | index d94dae216820..727691dd08fb 100644 | ||
2277 | --- a/drivers/net/can/rx-offload.c | ||
2278 | +++ b/drivers/net/can/rx-offload.c | ||
2279 | @@ -209,7 +209,54 @@ int can_rx_offload_irq_offload_fifo(struct can_rx_offload *offload) | ||
2280 | } | ||
2281 | EXPORT_SYMBOL_GPL(can_rx_offload_irq_offload_fifo); | ||
2282 | |||
2283 | -int can_rx_offload_irq_queue_err_skb(struct can_rx_offload *offload, struct sk_buff *skb) | ||
2284 | +int can_rx_offload_queue_sorted(struct can_rx_offload *offload, | ||
2285 | + struct sk_buff *skb, u32 timestamp) | ||
2286 | +{ | ||
2287 | + struct can_rx_offload_cb *cb; | ||
2288 | + unsigned long flags; | ||
2289 | + | ||
2290 | + if (skb_queue_len(&offload->skb_queue) > | ||
2291 | + offload->skb_queue_len_max) | ||
2292 | + return -ENOMEM; | ||
2293 | + | ||
2294 | + cb = can_rx_offload_get_cb(skb); | ||
2295 | + cb->timestamp = timestamp; | ||
2296 | + | ||
2297 | + spin_lock_irqsave(&offload->skb_queue.lock, flags); | ||
2298 | + __skb_queue_add_sort(&offload->skb_queue, skb, can_rx_offload_compare); | ||
2299 | + spin_unlock_irqrestore(&offload->skb_queue.lock, flags); | ||
2300 | + | ||
2301 | + can_rx_offload_schedule(offload); | ||
2302 | + | ||
2303 | + return 0; | ||
2304 | +} | ||
2305 | +EXPORT_SYMBOL_GPL(can_rx_offload_queue_sorted); | ||
2306 | + | ||
2307 | +unsigned int can_rx_offload_get_echo_skb(struct can_rx_offload *offload, | ||
2308 | + unsigned int idx, u32 timestamp) | ||
2309 | +{ | ||
2310 | + struct net_device *dev = offload->dev; | ||
2311 | + struct net_device_stats *stats = &dev->stats; | ||
2312 | + struct sk_buff *skb; | ||
2313 | + u8 len; | ||
2314 | + int err; | ||
2315 | + | ||
2316 | + skb = __can_get_echo_skb(dev, idx, &len); | ||
2317 | + if (!skb) | ||
2318 | + return 0; | ||
2319 | + | ||
2320 | + err = can_rx_offload_queue_sorted(offload, skb, timestamp); | ||
2321 | + if (err) { | ||
2322 | + stats->rx_errors++; | ||
2323 | + stats->tx_fifo_errors++; | ||
2324 | + } | ||
2325 | + | ||
2326 | + return len; | ||
2327 | +} | ||
2328 | +EXPORT_SYMBOL_GPL(can_rx_offload_get_echo_skb); | ||
2329 | + | ||
2330 | +int can_rx_offload_queue_tail(struct can_rx_offload *offload, | ||
2331 | + struct sk_buff *skb) | ||
2332 | { | ||
2333 | if (skb_queue_len(&offload->skb_queue) > | ||
2334 | offload->skb_queue_len_max) | ||
2335 | @@ -220,7 +267,7 @@ int can_rx_offload_irq_queue_err_skb(struct can_rx_offload *offload, struct sk_b | ||
2336 | |||
2337 | return 0; | ||
2338 | } | ||
2339 | -EXPORT_SYMBOL_GPL(can_rx_offload_irq_queue_err_skb); | ||
2340 | +EXPORT_SYMBOL_GPL(can_rx_offload_queue_tail); | ||
2341 | |||
2342 | static int can_rx_offload_init_queue(struct net_device *dev, struct can_rx_offload *offload, unsigned int weight) | ||
2343 | { | ||
2344 | diff --git a/drivers/net/can/spi/hi311x.c b/drivers/net/can/spi/hi311x.c | ||
2345 | index 53e320c92a8b..ddaf46239e39 100644 | ||
2346 | --- a/drivers/net/can/spi/hi311x.c | ||
2347 | +++ b/drivers/net/can/spi/hi311x.c | ||
2348 | @@ -760,7 +760,7 @@ static int hi3110_open(struct net_device *net) | ||
2349 | { | ||
2350 | struct hi3110_priv *priv = netdev_priv(net); | ||
2351 | struct spi_device *spi = priv->spi; | ||
2352 | - unsigned long flags = IRQF_ONESHOT | IRQF_TRIGGER_RISING; | ||
2353 | + unsigned long flags = IRQF_ONESHOT | IRQF_TRIGGER_HIGH; | ||
2354 | int ret; | ||
2355 | |||
2356 | ret = open_candev(net); | ||
2357 | diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | ||
2358 | index 5444e6213d45..64a794be7fcb 100644 | ||
2359 | --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | ||
2360 | +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | ||
2361 | @@ -5997,7 +5997,8 @@ static int brcmf_construct_chaninfo(struct brcmf_cfg80211_info *cfg, | ||
2362 | * for subsequent chanspecs. | ||
2363 | */ | ||
2364 | channel->flags = IEEE80211_CHAN_NO_HT40 | | ||
2365 | - IEEE80211_CHAN_NO_80MHZ; | ||
2366 | + IEEE80211_CHAN_NO_80MHZ | | ||
2367 | + IEEE80211_CHAN_NO_160MHZ; | ||
2368 | ch.bw = BRCMU_CHAN_BW_20; | ||
2369 | cfg->d11inf.encchspec(&ch); | ||
2370 | chaninfo = ch.chspec; | ||
2371 | diff --git a/drivers/net/wireless/intel/iwlwifi/fw/acpi.h b/drivers/net/wireless/intel/iwlwifi/fw/acpi.h | ||
2372 | index cb5f32c1d705..0b3b1223cff7 100644 | ||
2373 | --- a/drivers/net/wireless/intel/iwlwifi/fw/acpi.h | ||
2374 | +++ b/drivers/net/wireless/intel/iwlwifi/fw/acpi.h | ||
2375 | @@ -6,6 +6,7 @@ | ||
2376 | * GPL LICENSE SUMMARY | ||
2377 | * | ||
2378 | * Copyright(c) 2017 Intel Deutschland GmbH | ||
2379 | + * Copyright(c) 2018 Intel Corporation | ||
2380 | * | ||
2381 | * This program is free software; you can redistribute it and/or modify | ||
2382 | * it under the terms of version 2 of the GNU General Public License as | ||
2383 | @@ -29,6 +30,7 @@ | ||
2384 | * BSD LICENSE | ||
2385 | * | ||
2386 | * Copyright(c) 2017 Intel Deutschland GmbH | ||
2387 | + * Copyright(c) 2018 Intel Corporation | ||
2388 | * All rights reserved. | ||
2389 | * | ||
2390 | * Redistribution and use in source and binary forms, with or without | ||
2391 | @@ -84,7 +86,7 @@ | ||
2392 | #define ACPI_WRDS_WIFI_DATA_SIZE (ACPI_SAR_TABLE_SIZE + 2) | ||
2393 | #define ACPI_EWRD_WIFI_DATA_SIZE ((ACPI_SAR_PROFILE_NUM - 1) * \ | ||
2394 | ACPI_SAR_TABLE_SIZE + 3) | ||
2395 | -#define ACPI_WGDS_WIFI_DATA_SIZE 18 | ||
2396 | +#define ACPI_WGDS_WIFI_DATA_SIZE 19 | ||
2397 | #define ACPI_WRDD_WIFI_DATA_SIZE 2 | ||
2398 | #define ACPI_SPLC_WIFI_DATA_SIZE 2 | ||
2399 | |||
2400 | diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c | ||
2401 | index 48a3611d6a31..4d49a1a3f504 100644 | ||
2402 | --- a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c | ||
2403 | +++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c | ||
2404 | @@ -880,7 +880,7 @@ static int iwl_mvm_sar_geo_init(struct iwl_mvm *mvm) | ||
2405 | IWL_DEBUG_RADIO(mvm, "Sending GEO_TX_POWER_LIMIT\n"); | ||
2406 | |||
2407 | BUILD_BUG_ON(ACPI_NUM_GEO_PROFILES * ACPI_WGDS_NUM_BANDS * | ||
2408 | - ACPI_WGDS_TABLE_SIZE != ACPI_WGDS_WIFI_DATA_SIZE); | ||
2409 | + ACPI_WGDS_TABLE_SIZE + 1 != ACPI_WGDS_WIFI_DATA_SIZE); | ||
2410 | |||
2411 | BUILD_BUG_ON(ACPI_NUM_GEO_PROFILES > IWL_NUM_GEO_PROFILES); | ||
2412 | |||
2413 | @@ -915,6 +915,11 @@ static int iwl_mvm_sar_get_ewrd_table(struct iwl_mvm *mvm) | ||
2414 | return -ENOENT; | ||
2415 | } | ||
2416 | |||
2417 | +static int iwl_mvm_sar_get_wgds_table(struct iwl_mvm *mvm) | ||
2418 | +{ | ||
2419 | + return -ENOENT; | ||
2420 | +} | ||
2421 | + | ||
2422 | static int iwl_mvm_sar_geo_init(struct iwl_mvm *mvm) | ||
2423 | { | ||
2424 | return 0; | ||
2425 | @@ -941,8 +946,11 @@ static int iwl_mvm_sar_init(struct iwl_mvm *mvm) | ||
2426 | IWL_DEBUG_RADIO(mvm, | ||
2427 | "WRDS SAR BIOS table invalid or unavailable. (%d)\n", | ||
2428 | ret); | ||
2429 | - /* if not available, don't fail and don't bother with EWRD */ | ||
2430 | - return 0; | ||
2431 | + /* | ||
2432 | + * If not available, don't fail and don't bother with EWRD. | ||
2433 | + * Return 1 to tell that we can't use WGDS either. | ||
2434 | + */ | ||
2435 | + return 1; | ||
2436 | } | ||
2437 | |||
2438 | ret = iwl_mvm_sar_get_ewrd_table(mvm); | ||
2439 | @@ -955,9 +963,13 @@ static int iwl_mvm_sar_init(struct iwl_mvm *mvm) | ||
2440 | /* choose profile 1 (WRDS) as default for both chains */ | ||
2441 | ret = iwl_mvm_sar_select_profile(mvm, 1, 1); | ||
2442 | |||
2443 | - /* if we don't have profile 0 from BIOS, just skip it */ | ||
2444 | + /* | ||
2445 | + * If we don't have profile 0 from BIOS, just skip it. This | ||
2446 | + * means that SAR Geo will not be enabled either, even if we | ||
2447 | + * have other valid profiles. | ||
2448 | + */ | ||
2449 | if (ret == -ENOENT) | ||
2450 | - return 0; | ||
2451 | + return 1; | ||
2452 | |||
2453 | return ret; | ||
2454 | } | ||
2455 | @@ -1155,11 +1167,19 @@ int iwl_mvm_up(struct iwl_mvm *mvm) | ||
2456 | iwl_mvm_unref(mvm, IWL_MVM_REF_UCODE_DOWN); | ||
2457 | |||
2458 | ret = iwl_mvm_sar_init(mvm); | ||
2459 | - if (ret) | ||
2460 | - goto error; | ||
2461 | + if (ret == 0) { | ||
2462 | + ret = iwl_mvm_sar_geo_init(mvm); | ||
2463 | + } else if (ret > 0 && !iwl_mvm_sar_get_wgds_table(mvm)) { | ||
2464 | + /* | ||
2465 | + * If basic SAR is not available, we check for WGDS, | ||
2466 | + * which should *not* be available either. If it is | ||
2467 | + * available, issue an error, because we can't use SAR | ||
2468 | + * Geo without basic SAR. | ||
2469 | + */ | ||
2470 | + IWL_ERR(mvm, "BIOS contains WGDS but no WRDS\n"); | ||
2471 | + } | ||
2472 | |||
2473 | - ret = iwl_mvm_sar_geo_init(mvm); | ||
2474 | - if (ret) | ||
2475 | + if (ret < 0) | ||
2476 | goto error; | ||
2477 | |||
2478 | iwl_mvm_leds_sync(mvm); | ||
2479 | diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c | ||
2480 | index 155cc2ac0120..afed549f5645 100644 | ||
2481 | --- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c | ||
2482 | +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c | ||
2483 | @@ -306,8 +306,12 @@ struct ieee80211_regdomain *iwl_mvm_get_regdomain(struct wiphy *wiphy, | ||
2484 | goto out; | ||
2485 | } | ||
2486 | |||
2487 | - if (changed) | ||
2488 | - *changed = (resp->status == MCC_RESP_NEW_CHAN_PROFILE); | ||
2489 | + if (changed) { | ||
2490 | + u32 status = le32_to_cpu(resp->status); | ||
2491 | + | ||
2492 | + *changed = (status == MCC_RESP_NEW_CHAN_PROFILE || | ||
2493 | + status == MCC_RESP_ILLEGAL); | ||
2494 | + } | ||
2495 | |||
2496 | regd = iwl_parse_nvm_mcc_info(mvm->trans->dev, mvm->cfg, | ||
2497 | __le32_to_cpu(resp->n_channels), | ||
2498 | @@ -4416,10 +4420,6 @@ static void iwl_mvm_mac_sta_statistics(struct ieee80211_hw *hw, | ||
2499 | sinfo->filled |= BIT_ULL(NL80211_STA_INFO_SIGNAL_AVG); | ||
2500 | } | ||
2501 | |||
2502 | - if (!fw_has_capa(&mvm->fw->ucode_capa, | ||
2503 | - IWL_UCODE_TLV_CAPA_RADIO_BEACON_STATS)) | ||
2504 | - return; | ||
2505 | - | ||
2506 | /* if beacon filtering isn't on mac80211 does it anyway */ | ||
2507 | if (!(vif->driver_flags & IEEE80211_VIF_BEACON_FILTER)) | ||
2508 | return; | ||
2509 | diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/nvm.c b/drivers/net/wireless/intel/iwlwifi/mvm/nvm.c | ||
2510 | index cf48517944ec..f2579c94ffdb 100644 | ||
2511 | --- a/drivers/net/wireless/intel/iwlwifi/mvm/nvm.c | ||
2512 | +++ b/drivers/net/wireless/intel/iwlwifi/mvm/nvm.c | ||
2513 | @@ -545,9 +545,8 @@ iwl_mvm_update_mcc(struct iwl_mvm *mvm, const char *alpha2, | ||
2514 | } | ||
2515 | |||
2516 | IWL_DEBUG_LAR(mvm, | ||
2517 | - "MCC response status: 0x%x. new MCC: 0x%x ('%c%c') change: %d n_chans: %d\n", | ||
2518 | - status, mcc, mcc >> 8, mcc & 0xff, | ||
2519 | - !!(status == MCC_RESP_NEW_CHAN_PROFILE), n_channels); | ||
2520 | + "MCC response status: 0x%x. new MCC: 0x%x ('%c%c') n_chans: %d\n", | ||
2521 | + status, mcc, mcc >> 8, mcc & 0xff, n_channels); | ||
2522 | |||
2523 | exit: | ||
2524 | iwl_free_resp(&cmd); | ||
2525 | diff --git a/drivers/opp/ti-opp-supply.c b/drivers/opp/ti-opp-supply.c | ||
2526 | index 9e5a9a3112c9..3f4fb4dbbe33 100644 | ||
2527 | --- a/drivers/opp/ti-opp-supply.c | ||
2528 | +++ b/drivers/opp/ti-opp-supply.c | ||
2529 | @@ -288,7 +288,10 @@ static int ti_opp_supply_set_opp(struct dev_pm_set_opp_data *data) | ||
2530 | int ret; | ||
2531 | |||
2532 | vdd_uv = _get_optimal_vdd_voltage(dev, &opp_data, | ||
2533 | - new_supply_vbb->u_volt); | ||
2534 | + new_supply_vdd->u_volt); | ||
2535 | + | ||
2536 | + if (new_supply_vdd->u_volt_min < vdd_uv) | ||
2537 | + new_supply_vdd->u_volt_min = vdd_uv; | ||
2538 | |||
2539 | /* Scaling up? Scale voltage before frequency */ | ||
2540 | if (freq > old_freq) { | ||
2541 | diff --git a/drivers/pinctrl/meson/pinctrl-meson-gxbb.c b/drivers/pinctrl/meson/pinctrl-meson-gxbb.c | ||
2542 | index 4ceb06f8a33c..4edeb4cae72a 100644 | ||
2543 | --- a/drivers/pinctrl/meson/pinctrl-meson-gxbb.c | ||
2544 | +++ b/drivers/pinctrl/meson/pinctrl-meson-gxbb.c | ||
2545 | @@ -830,7 +830,7 @@ static struct meson_bank meson_gxbb_periphs_banks[] = { | ||
2546 | |||
2547 | static struct meson_bank meson_gxbb_aobus_banks[] = { | ||
2548 | /* name first last irq pullen pull dir out in */ | ||
2549 | - BANK("AO", GPIOAO_0, GPIOAO_13, 0, 13, 0, 0, 0, 16, 0, 0, 0, 16, 1, 0), | ||
2550 | + BANK("AO", GPIOAO_0, GPIOAO_13, 0, 13, 0, 16, 0, 0, 0, 0, 0, 16, 1, 0), | ||
2551 | }; | ||
2552 | |||
2553 | static struct meson_pinctrl_data meson_gxbb_periphs_pinctrl_data = { | ||
2554 | diff --git a/drivers/pinctrl/meson/pinctrl-meson-gxl.c b/drivers/pinctrl/meson/pinctrl-meson-gxl.c | ||
2555 | index 7dae1d7bf6b0..158f618f1695 100644 | ||
2556 | --- a/drivers/pinctrl/meson/pinctrl-meson-gxl.c | ||
2557 | +++ b/drivers/pinctrl/meson/pinctrl-meson-gxl.c | ||
2558 | @@ -807,7 +807,7 @@ static struct meson_bank meson_gxl_periphs_banks[] = { | ||
2559 | |||
2560 | static struct meson_bank meson_gxl_aobus_banks[] = { | ||
2561 | /* name first last irq pullen pull dir out in */ | ||
2562 | - BANK("AO", GPIOAO_0, GPIOAO_9, 0, 9, 0, 0, 0, 16, 0, 0, 0, 16, 1, 0), | ||
2563 | + BANK("AO", GPIOAO_0, GPIOAO_9, 0, 9, 0, 16, 0, 0, 0, 0, 0, 16, 1, 0), | ||
2564 | }; | ||
2565 | |||
2566 | static struct meson_pinctrl_data meson_gxl_periphs_pinctrl_data = { | ||
2567 | diff --git a/drivers/pinctrl/meson/pinctrl-meson.c b/drivers/pinctrl/meson/pinctrl-meson.c | ||
2568 | index 29a458da78db..4f3ab18636a3 100644 | ||
2569 | --- a/drivers/pinctrl/meson/pinctrl-meson.c | ||
2570 | +++ b/drivers/pinctrl/meson/pinctrl-meson.c | ||
2571 | @@ -192,7 +192,7 @@ static int meson_pinconf_set(struct pinctrl_dev *pcdev, unsigned int pin, | ||
2572 | dev_dbg(pc->dev, "pin %u: disable bias\n", pin); | ||
2573 | |||
2574 | meson_calc_reg_and_bit(bank, pin, REG_PULL, ®, &bit); | ||
2575 | - ret = regmap_update_bits(pc->reg_pull, reg, | ||
2576 | + ret = regmap_update_bits(pc->reg_pullen, reg, | ||
2577 | BIT(bit), 0); | ||
2578 | if (ret) | ||
2579 | return ret; | ||
2580 | diff --git a/drivers/pinctrl/meson/pinctrl-meson8.c b/drivers/pinctrl/meson/pinctrl-meson8.c | ||
2581 | index c6d79315218f..86466173114d 100644 | ||
2582 | --- a/drivers/pinctrl/meson/pinctrl-meson8.c | ||
2583 | +++ b/drivers/pinctrl/meson/pinctrl-meson8.c | ||
2584 | @@ -1053,7 +1053,7 @@ static struct meson_bank meson8_cbus_banks[] = { | ||
2585 | |||
2586 | static struct meson_bank meson8_aobus_banks[] = { | ||
2587 | /* name first last irq pullen pull dir out in */ | ||
2588 | - BANK("AO", GPIOAO_0, GPIO_TEST_N, 0, 13, 0, 0, 0, 16, 0, 0, 0, 16, 1, 0), | ||
2589 | + BANK("AO", GPIOAO_0, GPIO_TEST_N, 0, 13, 0, 16, 0, 0, 0, 0, 0, 16, 1, 0), | ||
2590 | }; | ||
2591 | |||
2592 | static struct meson_pinctrl_data meson8_cbus_pinctrl_data = { | ||
2593 | diff --git a/drivers/pinctrl/meson/pinctrl-meson8b.c b/drivers/pinctrl/meson/pinctrl-meson8b.c | ||
2594 | index bb2a30964fc6..647ad15d5c3c 100644 | ||
2595 | --- a/drivers/pinctrl/meson/pinctrl-meson8b.c | ||
2596 | +++ b/drivers/pinctrl/meson/pinctrl-meson8b.c | ||
2597 | @@ -906,7 +906,7 @@ static struct meson_bank meson8b_cbus_banks[] = { | ||
2598 | |||
2599 | static struct meson_bank meson8b_aobus_banks[] = { | ||
2600 | /* name first lastc irq pullen pull dir out in */ | ||
2601 | - BANK("AO", GPIOAO_0, GPIO_TEST_N, 0, 13, 0, 0, 0, 16, 0, 0, 0, 16, 1, 0), | ||
2602 | + BANK("AO", GPIOAO_0, GPIO_TEST_N, 0, 13, 0, 16, 0, 0, 0, 0, 0, 16, 1, 0), | ||
2603 | }; | ||
2604 | |||
2605 | static struct meson_pinctrl_data meson8b_cbus_pinctrl_data = { | ||
2606 | diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c | ||
2607 | index df0c5776d49b..a5a19ff10535 100644 | ||
2608 | --- a/drivers/rtc/rtc-cmos.c | ||
2609 | +++ b/drivers/rtc/rtc-cmos.c | ||
2610 | @@ -257,6 +257,7 @@ static int cmos_read_alarm(struct device *dev, struct rtc_wkalrm *t) | ||
2611 | struct cmos_rtc *cmos = dev_get_drvdata(dev); | ||
2612 | unsigned char rtc_control; | ||
2613 | |||
2614 | + /* This not only a rtc_op, but also called directly */ | ||
2615 | if (!is_valid_irq(cmos->irq)) | ||
2616 | return -EIO; | ||
2617 | |||
2618 | @@ -452,6 +453,7 @@ static int cmos_set_alarm(struct device *dev, struct rtc_wkalrm *t) | ||
2619 | unsigned char mon, mday, hrs, min, sec, rtc_control; | ||
2620 | int ret; | ||
2621 | |||
2622 | + /* This not only a rtc_op, but also called directly */ | ||
2623 | if (!is_valid_irq(cmos->irq)) | ||
2624 | return -EIO; | ||
2625 | |||
2626 | @@ -516,9 +518,6 @@ static int cmos_alarm_irq_enable(struct device *dev, unsigned int enabled) | ||
2627 | struct cmos_rtc *cmos = dev_get_drvdata(dev); | ||
2628 | unsigned long flags; | ||
2629 | |||
2630 | - if (!is_valid_irq(cmos->irq)) | ||
2631 | - return -EINVAL; | ||
2632 | - | ||
2633 | spin_lock_irqsave(&rtc_lock, flags); | ||
2634 | |||
2635 | if (enabled) | ||
2636 | @@ -579,6 +578,12 @@ static const struct rtc_class_ops cmos_rtc_ops = { | ||
2637 | .alarm_irq_enable = cmos_alarm_irq_enable, | ||
2638 | }; | ||
2639 | |||
2640 | +static const struct rtc_class_ops cmos_rtc_ops_no_alarm = { | ||
2641 | + .read_time = cmos_read_time, | ||
2642 | + .set_time = cmos_set_time, | ||
2643 | + .proc = cmos_procfs, | ||
2644 | +}; | ||
2645 | + | ||
2646 | /*----------------------------------------------------------------*/ | ||
2647 | |||
2648 | /* | ||
2649 | @@ -855,9 +860,12 @@ cmos_do_probe(struct device *dev, struct resource *ports, int rtc_irq) | ||
2650 | dev_dbg(dev, "IRQ %d is already in use\n", rtc_irq); | ||
2651 | goto cleanup1; | ||
2652 | } | ||
2653 | + | ||
2654 | + cmos_rtc.rtc->ops = &cmos_rtc_ops; | ||
2655 | + } else { | ||
2656 | + cmos_rtc.rtc->ops = &cmos_rtc_ops_no_alarm; | ||
2657 | } | ||
2658 | |||
2659 | - cmos_rtc.rtc->ops = &cmos_rtc_ops; | ||
2660 | cmos_rtc.rtc->nvram_old_abi = true; | ||
2661 | retval = rtc_register_device(cmos_rtc.rtc); | ||
2662 | if (retval) | ||
2663 | diff --git a/drivers/rtc/rtc-pcf2127.c b/drivers/rtc/rtc-pcf2127.c | ||
2664 | index 9f99a0966550..7cb786d76e3c 100644 | ||
2665 | --- a/drivers/rtc/rtc-pcf2127.c | ||
2666 | +++ b/drivers/rtc/rtc-pcf2127.c | ||
2667 | @@ -303,6 +303,9 @@ static int pcf2127_i2c_gather_write(void *context, | ||
2668 | memcpy(buf + 1, val, val_size); | ||
2669 | |||
2670 | ret = i2c_master_send(client, buf, val_size + 1); | ||
2671 | + | ||
2672 | + kfree(buf); | ||
2673 | + | ||
2674 | if (ret != val_size + 1) | ||
2675 | return ret < 0 ? ret : -EIO; | ||
2676 | |||
2677 | diff --git a/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c | ||
2678 | index 8f60f0e04599..410eccf0bc5e 100644 | ||
2679 | --- a/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c | ||
2680 | +++ b/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c | ||
2681 | @@ -904,11 +904,9 @@ static void start_delivery_v1_hw(struct hisi_sas_dq *dq) | ||
2682 | { | ||
2683 | struct hisi_hba *hisi_hba = dq->hisi_hba; | ||
2684 | struct hisi_sas_slot *s, *s1, *s2 = NULL; | ||
2685 | - struct list_head *dq_list; | ||
2686 | int dlvry_queue = dq->id; | ||
2687 | int wp; | ||
2688 | |||
2689 | - dq_list = &dq->list; | ||
2690 | list_for_each_entry_safe(s, s1, &dq->list, delivery) { | ||
2691 | if (!s->ready) | ||
2692 | break; | ||
2693 | diff --git a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c | ||
2694 | index 9c5c5a601332..1c4ea58da1ae 100644 | ||
2695 | --- a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c | ||
2696 | +++ b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c | ||
2697 | @@ -1666,11 +1666,9 @@ static void start_delivery_v2_hw(struct hisi_sas_dq *dq) | ||
2698 | { | ||
2699 | struct hisi_hba *hisi_hba = dq->hisi_hba; | ||
2700 | struct hisi_sas_slot *s, *s1, *s2 = NULL; | ||
2701 | - struct list_head *dq_list; | ||
2702 | int dlvry_queue = dq->id; | ||
2703 | int wp; | ||
2704 | |||
2705 | - dq_list = &dq->list; | ||
2706 | list_for_each_entry_safe(s, s1, &dq->list, delivery) { | ||
2707 | if (!s->ready) | ||
2708 | break; | ||
2709 | diff --git a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | ||
2710 | index 08b503e274b8..687ff61bba9f 100644 | ||
2711 | --- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | ||
2712 | +++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | ||
2713 | @@ -883,11 +883,9 @@ static void start_delivery_v3_hw(struct hisi_sas_dq *dq) | ||
2714 | { | ||
2715 | struct hisi_hba *hisi_hba = dq->hisi_hba; | ||
2716 | struct hisi_sas_slot *s, *s1, *s2 = NULL; | ||
2717 | - struct list_head *dq_list; | ||
2718 | int dlvry_queue = dq->id; | ||
2719 | int wp; | ||
2720 | |||
2721 | - dq_list = &dq->list; | ||
2722 | list_for_each_entry_safe(s, s1, &dq->list, delivery) { | ||
2723 | if (!s->ready) | ||
2724 | break; | ||
2725 | diff --git a/drivers/scsi/lpfc/lpfc_debugfs.c b/drivers/scsi/lpfc/lpfc_debugfs.c | ||
2726 | index aec5b10a8c85..ca6c3982548d 100644 | ||
2727 | --- a/drivers/scsi/lpfc/lpfc_debugfs.c | ||
2728 | +++ b/drivers/scsi/lpfc/lpfc_debugfs.c | ||
2729 | @@ -700,6 +700,8 @@ lpfc_debugfs_nodelist_data(struct lpfc_vport *vport, char *buf, int size) | ||
2730 | rport = lpfc_ndlp_get_nrport(ndlp); | ||
2731 | if (rport) | ||
2732 | nrport = rport->remoteport; | ||
2733 | + else | ||
2734 | + nrport = NULL; | ||
2735 | spin_unlock(&phba->hbalock); | ||
2736 | if (!nrport) | ||
2737 | continue; | ||
2738 | diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c | ||
2739 | index 431742201709..3ad460219fd6 100644 | ||
2740 | --- a/drivers/tty/n_tty.c | ||
2741 | +++ b/drivers/tty/n_tty.c | ||
2742 | @@ -152,17 +152,28 @@ static inline unsigned char *echo_buf_addr(struct n_tty_data *ldata, size_t i) | ||
2743 | return &ldata->echo_buf[i & (N_TTY_BUF_SIZE - 1)]; | ||
2744 | } | ||
2745 | |||
2746 | +/* If we are not echoing the data, perhaps this is a secret so erase it */ | ||
2747 | +static void zero_buffer(struct tty_struct *tty, u8 *buffer, int size) | ||
2748 | +{ | ||
2749 | + bool icanon = !!L_ICANON(tty); | ||
2750 | + bool no_echo = !L_ECHO(tty); | ||
2751 | + | ||
2752 | + if (icanon && no_echo) | ||
2753 | + memset(buffer, 0x00, size); | ||
2754 | +} | ||
2755 | + | ||
2756 | static int tty_copy_to_user(struct tty_struct *tty, void __user *to, | ||
2757 | size_t tail, size_t n) | ||
2758 | { | ||
2759 | struct n_tty_data *ldata = tty->disc_data; | ||
2760 | size_t size = N_TTY_BUF_SIZE - tail; | ||
2761 | - const void *from = read_buf_addr(ldata, tail); | ||
2762 | + void *from = read_buf_addr(ldata, tail); | ||
2763 | int uncopied; | ||
2764 | |||
2765 | if (n > size) { | ||
2766 | tty_audit_add_data(tty, from, size); | ||
2767 | uncopied = copy_to_user(to, from, size); | ||
2768 | + zero_buffer(tty, from, size - uncopied); | ||
2769 | if (uncopied) | ||
2770 | return uncopied; | ||
2771 | to += size; | ||
2772 | @@ -171,7 +182,9 @@ static int tty_copy_to_user(struct tty_struct *tty, void __user *to, | ||
2773 | } | ||
2774 | |||
2775 | tty_audit_add_data(tty, from, n); | ||
2776 | - return copy_to_user(to, from, n); | ||
2777 | + uncopied = copy_to_user(to, from, n); | ||
2778 | + zero_buffer(tty, from, n - uncopied); | ||
2779 | + return uncopied; | ||
2780 | } | ||
2781 | |||
2782 | /** | ||
2783 | @@ -1960,11 +1973,12 @@ static int copy_from_read_buf(struct tty_struct *tty, | ||
2784 | n = min(head - ldata->read_tail, N_TTY_BUF_SIZE - tail); | ||
2785 | n = min(*nr, n); | ||
2786 | if (n) { | ||
2787 | - const unsigned char *from = read_buf_addr(ldata, tail); | ||
2788 | + unsigned char *from = read_buf_addr(ldata, tail); | ||
2789 | retval = copy_to_user(*b, from, n); | ||
2790 | n -= retval; | ||
2791 | is_eof = n == 1 && *from == EOF_CHAR(tty); | ||
2792 | tty_audit_add_data(tty, from, n); | ||
2793 | + zero_buffer(tty, from, n); | ||
2794 | smp_store_release(&ldata->read_tail, ldata->read_tail + n); | ||
2795 | /* Turn single EOF into zero-length read */ | ||
2796 | if (L_EXTPROC(tty) && ldata->icanon && is_eof && | ||
2797 | diff --git a/drivers/tty/tty_buffer.c b/drivers/tty/tty_buffer.c | ||
2798 | index c996b6859c5e..ae3ce330200e 100644 | ||
2799 | --- a/drivers/tty/tty_buffer.c | ||
2800 | +++ b/drivers/tty/tty_buffer.c | ||
2801 | @@ -468,11 +468,15 @@ receive_buf(struct tty_port *port, struct tty_buffer *head, int count) | ||
2802 | { | ||
2803 | unsigned char *p = char_buf_ptr(head, head->read); | ||
2804 | char *f = NULL; | ||
2805 | + int n; | ||
2806 | |||
2807 | if (~head->flags & TTYB_NORMAL) | ||
2808 | f = flag_buf_ptr(head, head->read); | ||
2809 | |||
2810 | - return port->client_ops->receive_buf(port, p, f, count); | ||
2811 | + n = port->client_ops->receive_buf(port, p, f, count); | ||
2812 | + if (n > 0) | ||
2813 | + memset(p, 0, n); | ||
2814 | + return n; | ||
2815 | } | ||
2816 | |||
2817 | /** | ||
2818 | diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c | ||
2819 | index 6e0823790bee..f79979ae482a 100644 | ||
2820 | --- a/drivers/usb/core/hub.c | ||
2821 | +++ b/drivers/usb/core/hub.c | ||
2822 | @@ -2847,7 +2847,9 @@ static int hub_port_reset(struct usb_hub *hub, int port1, | ||
2823 | USB_PORT_FEAT_C_BH_PORT_RESET); | ||
2824 | usb_clear_port_feature(hub->hdev, port1, | ||
2825 | USB_PORT_FEAT_C_PORT_LINK_STATE); | ||
2826 | - usb_clear_port_feature(hub->hdev, port1, | ||
2827 | + | ||
2828 | + if (udev) | ||
2829 | + usb_clear_port_feature(hub->hdev, port1, | ||
2830 | USB_PORT_FEAT_C_CONNECTION); | ||
2831 | |||
2832 | /* | ||
2833 | diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c | ||
2834 | index 88c80fcc39f5..fec97465ccac 100644 | ||
2835 | --- a/drivers/usb/dwc3/core.c | ||
2836 | +++ b/drivers/usb/dwc3/core.c | ||
2837 | @@ -1499,6 +1499,7 @@ static int dwc3_probe(struct platform_device *pdev) | ||
2838 | |||
2839 | err5: | ||
2840 | dwc3_event_buffers_cleanup(dwc); | ||
2841 | + dwc3_ulpi_exit(dwc); | ||
2842 | |||
2843 | err4: | ||
2844 | dwc3_free_scratch_buffers(dwc); | ||
2845 | diff --git a/drivers/usb/dwc3/dwc3-pci.c b/drivers/usb/dwc3/dwc3-pci.c | ||
2846 | index 1286076a8890..842795856bf4 100644 | ||
2847 | --- a/drivers/usb/dwc3/dwc3-pci.c | ||
2848 | +++ b/drivers/usb/dwc3/dwc3-pci.c | ||
2849 | @@ -283,8 +283,10 @@ err: | ||
2850 | static void dwc3_pci_remove(struct pci_dev *pci) | ||
2851 | { | ||
2852 | struct dwc3_pci *dwc = pci_get_drvdata(pci); | ||
2853 | + struct pci_dev *pdev = dwc->pci; | ||
2854 | |||
2855 | - gpiod_remove_lookup_table(&platform_bytcr_gpios); | ||
2856 | + if (pdev->device == PCI_DEVICE_ID_INTEL_BYT) | ||
2857 | + gpiod_remove_lookup_table(&platform_bytcr_gpios); | ||
2858 | #ifdef CONFIG_PM | ||
2859 | cancel_work_sync(&dwc->wakeup_work); | ||
2860 | #endif | ||
2861 | diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c | ||
2862 | index 2b53194081ba..2de1a3971a26 100644 | ||
2863 | --- a/drivers/usb/dwc3/gadget.c | ||
2864 | +++ b/drivers/usb/dwc3/gadget.c | ||
2865 | @@ -1072,7 +1072,7 @@ static void dwc3_prepare_one_trb_sg(struct dwc3_ep *dep, | ||
2866 | /* Now prepare one extra TRB to align transfer size */ | ||
2867 | trb = &dep->trb_pool[dep->trb_enqueue]; | ||
2868 | __dwc3_prepare_one_trb(dep, trb, dwc->bounce_addr, | ||
2869 | - maxp - rem, false, 0, | ||
2870 | + maxp - rem, false, 1, | ||
2871 | req->request.stream_id, | ||
2872 | req->request.short_not_ok, | ||
2873 | req->request.no_interrupt); | ||
2874 | @@ -1116,7 +1116,7 @@ static void dwc3_prepare_one_trb_linear(struct dwc3_ep *dep, | ||
2875 | /* Now prepare one extra TRB to align transfer size */ | ||
2876 | trb = &dep->trb_pool[dep->trb_enqueue]; | ||
2877 | __dwc3_prepare_one_trb(dep, trb, dwc->bounce_addr, maxp - rem, | ||
2878 | - false, 0, req->request.stream_id, | ||
2879 | + false, 1, req->request.stream_id, | ||
2880 | req->request.short_not_ok, | ||
2881 | req->request.no_interrupt); | ||
2882 | } else if (req->request.zero && req->request.length && | ||
2883 | @@ -1132,7 +1132,7 @@ static void dwc3_prepare_one_trb_linear(struct dwc3_ep *dep, | ||
2884 | /* Now prepare one extra TRB to handle ZLP */ | ||
2885 | trb = &dep->trb_pool[dep->trb_enqueue]; | ||
2886 | __dwc3_prepare_one_trb(dep, trb, dwc->bounce_addr, 0, | ||
2887 | - false, 0, req->request.stream_id, | ||
2888 | + false, 1, req->request.stream_id, | ||
2889 | req->request.short_not_ok, | ||
2890 | req->request.no_interrupt); | ||
2891 | } else { | ||
2892 | @@ -2250,7 +2250,7 @@ static int dwc3_gadget_ep_reclaim_completed_trb(struct dwc3_ep *dep, | ||
2893 | * with one TRB pending in the ring. We need to manually clear HWO bit | ||
2894 | * from that TRB. | ||
2895 | */ | ||
2896 | - if ((req->zero || req->unaligned) && (trb->ctrl & DWC3_TRB_CTRL_HWO)) { | ||
2897 | + if ((req->zero || req->unaligned) && !(trb->ctrl & DWC3_TRB_CTRL_CHN)) { | ||
2898 | trb->ctrl &= ~DWC3_TRB_CTRL_HWO; | ||
2899 | return 1; | ||
2900 | } | ||
2901 | diff --git a/drivers/usb/host/xhci-histb.c b/drivers/usb/host/xhci-histb.c | ||
2902 | index 27f00160332e..3c4abb5a1c3f 100644 | ||
2903 | --- a/drivers/usb/host/xhci-histb.c | ||
2904 | +++ b/drivers/usb/host/xhci-histb.c | ||
2905 | @@ -325,14 +325,16 @@ static int xhci_histb_remove(struct platform_device *dev) | ||
2906 | struct xhci_hcd_histb *histb = platform_get_drvdata(dev); | ||
2907 | struct usb_hcd *hcd = histb->hcd; | ||
2908 | struct xhci_hcd *xhci = hcd_to_xhci(hcd); | ||
2909 | + struct usb_hcd *shared_hcd = xhci->shared_hcd; | ||
2910 | |||
2911 | xhci->xhc_state |= XHCI_STATE_REMOVING; | ||
2912 | |||
2913 | - usb_remove_hcd(xhci->shared_hcd); | ||
2914 | + usb_remove_hcd(shared_hcd); | ||
2915 | + xhci->shared_hcd = NULL; | ||
2916 | device_wakeup_disable(&dev->dev); | ||
2917 | |||
2918 | usb_remove_hcd(hcd); | ||
2919 | - usb_put_hcd(xhci->shared_hcd); | ||
2920 | + usb_put_hcd(shared_hcd); | ||
2921 | |||
2922 | xhci_histb_host_disable(histb); | ||
2923 | usb_put_hcd(hcd); | ||
2924 | diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c | ||
2925 | index 12eea73d9f20..94aca1b5ac8a 100644 | ||
2926 | --- a/drivers/usb/host/xhci-hub.c | ||
2927 | +++ b/drivers/usb/host/xhci-hub.c | ||
2928 | @@ -876,7 +876,7 @@ static u32 xhci_get_port_status(struct usb_hcd *hcd, | ||
2929 | status |= USB_PORT_STAT_SUSPEND; | ||
2930 | } | ||
2931 | if ((raw_port_status & PORT_PLS_MASK) == XDEV_RESUME && | ||
2932 | - !DEV_SUPERSPEED_ANY(raw_port_status)) { | ||
2933 | + !DEV_SUPERSPEED_ANY(raw_port_status) && hcd->speed < HCD_USB3) { | ||
2934 | if ((raw_port_status & PORT_RESET) || | ||
2935 | !(raw_port_status & PORT_PE)) | ||
2936 | return 0xffffffff; | ||
2937 | @@ -921,7 +921,7 @@ static u32 xhci_get_port_status(struct usb_hcd *hcd, | ||
2938 | time_left = wait_for_completion_timeout( | ||
2939 | &bus_state->rexit_done[wIndex], | ||
2940 | msecs_to_jiffies( | ||
2941 | - XHCI_MAX_REXIT_TIMEOUT)); | ||
2942 | + XHCI_MAX_REXIT_TIMEOUT_MS)); | ||
2943 | spin_lock_irqsave(&xhci->lock, flags); | ||
2944 | |||
2945 | if (time_left) { | ||
2946 | @@ -935,7 +935,7 @@ static u32 xhci_get_port_status(struct usb_hcd *hcd, | ||
2947 | } else { | ||
2948 | int port_status = readl(port->addr); | ||
2949 | xhci_warn(xhci, "Port resume took longer than %i msec, port status = 0x%x\n", | ||
2950 | - XHCI_MAX_REXIT_TIMEOUT, | ||
2951 | + XHCI_MAX_REXIT_TIMEOUT_MS, | ||
2952 | port_status); | ||
2953 | status |= USB_PORT_STAT_SUSPEND; | ||
2954 | clear_bit(wIndex, &bus_state->rexit_ports); | ||
2955 | @@ -1474,15 +1474,18 @@ int xhci_bus_suspend(struct usb_hcd *hcd) | ||
2956 | unsigned long flags; | ||
2957 | struct xhci_hub *rhub; | ||
2958 | struct xhci_port **ports; | ||
2959 | + u32 portsc_buf[USB_MAXCHILDREN]; | ||
2960 | + bool wake_enabled; | ||
2961 | |||
2962 | rhub = xhci_get_rhub(hcd); | ||
2963 | ports = rhub->ports; | ||
2964 | max_ports = rhub->num_ports; | ||
2965 | bus_state = &xhci->bus_state[hcd_index(hcd)]; | ||
2966 | + wake_enabled = hcd->self.root_hub->do_remote_wakeup; | ||
2967 | |||
2968 | spin_lock_irqsave(&xhci->lock, flags); | ||
2969 | |||
2970 | - if (hcd->self.root_hub->do_remote_wakeup) { | ||
2971 | + if (wake_enabled) { | ||
2972 | if (bus_state->resuming_ports || /* USB2 */ | ||
2973 | bus_state->port_remote_wakeup) { /* USB3 */ | ||
2974 | spin_unlock_irqrestore(&xhci->lock, flags); | ||
2975 | @@ -1490,26 +1493,36 @@ int xhci_bus_suspend(struct usb_hcd *hcd) | ||
2976 | return -EBUSY; | ||
2977 | } | ||
2978 | } | ||
2979 | - | ||
2980 | - port_index = max_ports; | ||
2981 | + /* | ||
2982 | + * Prepare ports for suspend, but don't write anything before all ports | ||
2983 | + * are checked and we know bus suspend can proceed | ||
2984 | + */ | ||
2985 | bus_state->bus_suspended = 0; | ||
2986 | + port_index = max_ports; | ||
2987 | while (port_index--) { | ||
2988 | - /* suspend the port if the port is not suspended */ | ||
2989 | u32 t1, t2; | ||
2990 | - int slot_id; | ||
2991 | |||
2992 | t1 = readl(ports[port_index]->addr); | ||
2993 | t2 = xhci_port_state_to_neutral(t1); | ||
2994 | + portsc_buf[port_index] = 0; | ||
2995 | |||
2996 | - if ((t1 & PORT_PE) && !(t1 & PORT_PLS_MASK)) { | ||
2997 | - xhci_dbg(xhci, "port %d not suspended\n", port_index); | ||
2998 | - slot_id = xhci_find_slot_id_by_port(hcd, xhci, | ||
2999 | - port_index + 1); | ||
3000 | - if (slot_id) { | ||
3001 | + /* Bail out if a USB3 port has a new device in link training */ | ||
3002 | + if ((t1 & PORT_PLS_MASK) == XDEV_POLLING) { | ||
3003 | + bus_state->bus_suspended = 0; | ||
3004 | + spin_unlock_irqrestore(&xhci->lock, flags); | ||
3005 | + xhci_dbg(xhci, "Bus suspend bailout, port in polling\n"); | ||
3006 | + return -EBUSY; | ||
3007 | + } | ||
3008 | + | ||
3009 | + /* suspend ports in U0, or bail out for new connect changes */ | ||
3010 | + if ((t1 & PORT_PE) && (t1 & PORT_PLS_MASK) == XDEV_U0) { | ||
3011 | + if ((t1 & PORT_CSC) && wake_enabled) { | ||
3012 | + bus_state->bus_suspended = 0; | ||
3013 | spin_unlock_irqrestore(&xhci->lock, flags); | ||
3014 | - xhci_stop_device(xhci, slot_id, 1); | ||
3015 | - spin_lock_irqsave(&xhci->lock, flags); | ||
3016 | + xhci_dbg(xhci, "Bus suspend bailout, port connect change\n"); | ||
3017 | + return -EBUSY; | ||
3018 | } | ||
3019 | + xhci_dbg(xhci, "port %d not suspended\n", port_index); | ||
3020 | t2 &= ~PORT_PLS_MASK; | ||
3021 | t2 |= PORT_LINK_STROBE | XDEV_U3; | ||
3022 | set_bit(port_index, &bus_state->bus_suspended); | ||
3023 | @@ -1518,7 +1531,7 @@ int xhci_bus_suspend(struct usb_hcd *hcd) | ||
3024 | * including the USB 3.0 roothub, but only if CONFIG_PM | ||
3025 | * is enabled, so also enable remote wake here. | ||
3026 | */ | ||
3027 | - if (hcd->self.root_hub->do_remote_wakeup) { | ||
3028 | + if (wake_enabled) { | ||
3029 | if (t1 & PORT_CONNECT) { | ||
3030 | t2 |= PORT_WKOC_E | PORT_WKDISC_E; | ||
3031 | t2 &= ~PORT_WKCONN_E; | ||
3032 | @@ -1538,7 +1551,26 @@ int xhci_bus_suspend(struct usb_hcd *hcd) | ||
3033 | |||
3034 | t1 = xhci_port_state_to_neutral(t1); | ||
3035 | if (t1 != t2) | ||
3036 | - writel(t2, ports[port_index]->addr); | ||
3037 | + portsc_buf[port_index] = t2; | ||
3038 | + } | ||
3039 | + | ||
3040 | + /* write port settings, stopping and suspending ports if needed */ | ||
3041 | + port_index = max_ports; | ||
3042 | + while (port_index--) { | ||
3043 | + if (!portsc_buf[port_index]) | ||
3044 | + continue; | ||
3045 | + if (test_bit(port_index, &bus_state->bus_suspended)) { | ||
3046 | + int slot_id; | ||
3047 | + | ||
3048 | + slot_id = xhci_find_slot_id_by_port(hcd, xhci, | ||
3049 | + port_index + 1); | ||
3050 | + if (slot_id) { | ||
3051 | + spin_unlock_irqrestore(&xhci->lock, flags); | ||
3052 | + xhci_stop_device(xhci, slot_id, 1); | ||
3053 | + spin_lock_irqsave(&xhci->lock, flags); | ||
3054 | + } | ||
3055 | + } | ||
3056 | + writel(portsc_buf[port_index], ports[port_index]->addr); | ||
3057 | } | ||
3058 | hcd->state = HC_STATE_SUSPENDED; | ||
3059 | bus_state->next_statechange = jiffies + msecs_to_jiffies(10); | ||
3060 | diff --git a/drivers/usb/host/xhci-mtk.c b/drivers/usb/host/xhci-mtk.c | ||
3061 | index 71d0d33c3286..60987c787e44 100644 | ||
3062 | --- a/drivers/usb/host/xhci-mtk.c | ||
3063 | +++ b/drivers/usb/host/xhci-mtk.c | ||
3064 | @@ -590,12 +590,14 @@ static int xhci_mtk_remove(struct platform_device *dev) | ||
3065 | struct xhci_hcd_mtk *mtk = platform_get_drvdata(dev); | ||
3066 | struct usb_hcd *hcd = mtk->hcd; | ||
3067 | struct xhci_hcd *xhci = hcd_to_xhci(hcd); | ||
3068 | + struct usb_hcd *shared_hcd = xhci->shared_hcd; | ||
3069 | |||
3070 | - usb_remove_hcd(xhci->shared_hcd); | ||
3071 | + usb_remove_hcd(shared_hcd); | ||
3072 | + xhci->shared_hcd = NULL; | ||
3073 | device_init_wakeup(&dev->dev, false); | ||
3074 | |||
3075 | usb_remove_hcd(hcd); | ||
3076 | - usb_put_hcd(xhci->shared_hcd); | ||
3077 | + usb_put_hcd(shared_hcd); | ||
3078 | usb_put_hcd(hcd); | ||
3079 | xhci_mtk_sch_exit(mtk); | ||
3080 | xhci_mtk_clks_disable(mtk); | ||
3081 | diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c | ||
3082 | index 51dd8e00c4f8..beeda27b3789 100644 | ||
3083 | --- a/drivers/usb/host/xhci-pci.c | ||
3084 | +++ b/drivers/usb/host/xhci-pci.c | ||
3085 | @@ -231,6 +231,11 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) | ||
3086 | if (pdev->vendor == PCI_VENDOR_ID_TI && pdev->device == 0x8241) | ||
3087 | xhci->quirks |= XHCI_LIMIT_ENDPOINT_INTERVAL_7; | ||
3088 | |||
3089 | + if ((pdev->vendor == PCI_VENDOR_ID_BROADCOM || | ||
3090 | + pdev->vendor == PCI_VENDOR_ID_CAVIUM) && | ||
3091 | + pdev->device == 0x9026) | ||
3092 | + xhci->quirks |= XHCI_RESET_PLL_ON_DISCONNECT; | ||
3093 | + | ||
3094 | if (xhci->quirks & XHCI_RESET_ON_RESUME) | ||
3095 | xhci_dbg_trace(xhci, trace_xhci_dbg_quirks, | ||
3096 | "QUIRK: Resetting on resume"); | ||
3097 | @@ -356,6 +361,7 @@ static void xhci_pci_remove(struct pci_dev *dev) | ||
3098 | if (xhci->shared_hcd) { | ||
3099 | usb_remove_hcd(xhci->shared_hcd); | ||
3100 | usb_put_hcd(xhci->shared_hcd); | ||
3101 | + xhci->shared_hcd = NULL; | ||
3102 | } | ||
3103 | |||
3104 | /* Workaround for spurious wakeups at shutdown with HSW */ | ||
3105 | diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c | ||
3106 | index 94e939249b2b..e5da8ce62914 100644 | ||
3107 | --- a/drivers/usb/host/xhci-plat.c | ||
3108 | +++ b/drivers/usb/host/xhci-plat.c | ||
3109 | @@ -359,14 +359,16 @@ static int xhci_plat_remove(struct platform_device *dev) | ||
3110 | struct xhci_hcd *xhci = hcd_to_xhci(hcd); | ||
3111 | struct clk *clk = xhci->clk; | ||
3112 | struct clk *reg_clk = xhci->reg_clk; | ||
3113 | + struct usb_hcd *shared_hcd = xhci->shared_hcd; | ||
3114 | |||
3115 | xhci->xhc_state |= XHCI_STATE_REMOVING; | ||
3116 | |||
3117 | - usb_remove_hcd(xhci->shared_hcd); | ||
3118 | + usb_remove_hcd(shared_hcd); | ||
3119 | + xhci->shared_hcd = NULL; | ||
3120 | usb_phy_shutdown(hcd->usb_phy); | ||
3121 | |||
3122 | usb_remove_hcd(hcd); | ||
3123 | - usb_put_hcd(xhci->shared_hcd); | ||
3124 | + usb_put_hcd(shared_hcd); | ||
3125 | |||
3126 | clk_disable_unprepare(clk); | ||
3127 | clk_disable_unprepare(reg_clk); | ||
3128 | diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c | ||
3129 | index cd4659703647..9ae17a666bdb 100644 | ||
3130 | --- a/drivers/usb/host/xhci-ring.c | ||
3131 | +++ b/drivers/usb/host/xhci-ring.c | ||
3132 | @@ -1517,6 +1517,35 @@ static void handle_device_notification(struct xhci_hcd *xhci, | ||
3133 | usb_wakeup_notification(udev->parent, udev->portnum); | ||
3134 | } | ||
3135 | |||
3136 | +/* | ||
3137 | + * Quirk hanlder for errata seen on Cavium ThunderX2 processor XHCI | ||
3138 | + * Controller. | ||
3139 | + * As per ThunderX2errata-129 USB 2 device may come up as USB 1 | ||
3140 | + * If a connection to a USB 1 device is followed by another connection | ||
3141 | + * to a USB 2 device. | ||
3142 | + * | ||
3143 | + * Reset the PHY after the USB device is disconnected if device speed | ||
3144 | + * is less than HCD_USB3. | ||
3145 | + * Retry the reset sequence max of 4 times checking the PLL lock status. | ||
3146 | + * | ||
3147 | + */ | ||
3148 | +static void xhci_cavium_reset_phy_quirk(struct xhci_hcd *xhci) | ||
3149 | +{ | ||
3150 | + struct usb_hcd *hcd = xhci_to_hcd(xhci); | ||
3151 | + u32 pll_lock_check; | ||
3152 | + u32 retry_count = 4; | ||
3153 | + | ||
3154 | + do { | ||
3155 | + /* Assert PHY reset */ | ||
3156 | + writel(0x6F, hcd->regs + 0x1048); | ||
3157 | + udelay(10); | ||
3158 | + /* De-assert the PHY reset */ | ||
3159 | + writel(0x7F, hcd->regs + 0x1048); | ||
3160 | + udelay(200); | ||
3161 | + pll_lock_check = readl(hcd->regs + 0x1070); | ||
3162 | + } while (!(pll_lock_check & 0x1) && --retry_count); | ||
3163 | +} | ||
3164 | + | ||
3165 | static void handle_port_status(struct xhci_hcd *xhci, | ||
3166 | union xhci_trb *event) | ||
3167 | { | ||
3168 | @@ -1552,6 +1581,13 @@ static void handle_port_status(struct xhci_hcd *xhci, | ||
3169 | goto cleanup; | ||
3170 | } | ||
3171 | |||
3172 | + /* We might get interrupts after shared_hcd is removed */ | ||
3173 | + if (port->rhub == &xhci->usb3_rhub && xhci->shared_hcd == NULL) { | ||
3174 | + xhci_dbg(xhci, "ignore port event for removed USB3 hcd\n"); | ||
3175 | + bogus_port_status = true; | ||
3176 | + goto cleanup; | ||
3177 | + } | ||
3178 | + | ||
3179 | hcd = port->rhub->hcd; | ||
3180 | bus_state = &xhci->bus_state[hcd_index(hcd)]; | ||
3181 | hcd_portnum = port->hcd_portnum; | ||
3182 | @@ -1635,7 +1671,7 @@ static void handle_port_status(struct xhci_hcd *xhci, | ||
3183 | * RExit to a disconnect state). If so, let the the driver know it's | ||
3184 | * out of the RExit state. | ||
3185 | */ | ||
3186 | - if (!DEV_SUPERSPEED_ANY(portsc) && | ||
3187 | + if (!DEV_SUPERSPEED_ANY(portsc) && hcd->speed < HCD_USB3 && | ||
3188 | test_and_clear_bit(hcd_portnum, | ||
3189 | &bus_state->rexit_ports)) { | ||
3190 | complete(&bus_state->rexit_done[hcd_portnum]); | ||
3191 | @@ -1643,8 +1679,12 @@ static void handle_port_status(struct xhci_hcd *xhci, | ||
3192 | goto cleanup; | ||
3193 | } | ||
3194 | |||
3195 | - if (hcd->speed < HCD_USB3) | ||
3196 | + if (hcd->speed < HCD_USB3) { | ||
3197 | xhci_test_and_clear_bit(xhci, port, PORT_PLC); | ||
3198 | + if ((xhci->quirks & XHCI_RESET_PLL_ON_DISCONNECT) && | ||
3199 | + (portsc & PORT_CSC) && !(portsc & PORT_CONNECT)) | ||
3200 | + xhci_cavium_reset_phy_quirk(xhci); | ||
3201 | + } | ||
3202 | |||
3203 | cleanup: | ||
3204 | /* Update event ring dequeue pointer before dropping the lock */ | ||
3205 | @@ -2247,6 +2287,7 @@ static int handle_tx_event(struct xhci_hcd *xhci, | ||
3206 | goto cleanup; | ||
3207 | case COMP_RING_UNDERRUN: | ||
3208 | case COMP_RING_OVERRUN: | ||
3209 | + case COMP_STOPPED_LENGTH_INVALID: | ||
3210 | goto cleanup; | ||
3211 | default: | ||
3212 | xhci_err(xhci, "ERROR Transfer event for unknown stream ring slot %u ep %u\n", | ||
3213 | diff --git a/drivers/usb/host/xhci-tegra.c b/drivers/usb/host/xhci-tegra.c | ||
3214 | index 4b463e5202a4..b1cce989bd12 100644 | ||
3215 | --- a/drivers/usb/host/xhci-tegra.c | ||
3216 | +++ b/drivers/usb/host/xhci-tegra.c | ||
3217 | @@ -1240,6 +1240,7 @@ static int tegra_xusb_remove(struct platform_device *pdev) | ||
3218 | |||
3219 | usb_remove_hcd(xhci->shared_hcd); | ||
3220 | usb_put_hcd(xhci->shared_hcd); | ||
3221 | + xhci->shared_hcd = NULL; | ||
3222 | usb_remove_hcd(tegra->hcd); | ||
3223 | usb_put_hcd(tegra->hcd); | ||
3224 | |||
3225 | diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c | ||
3226 | index 0420eefa647a..c928dbbff881 100644 | ||
3227 | --- a/drivers/usb/host/xhci.c | ||
3228 | +++ b/drivers/usb/host/xhci.c | ||
3229 | @@ -719,8 +719,6 @@ static void xhci_stop(struct usb_hcd *hcd) | ||
3230 | |||
3231 | /* Only halt host and free memory after both hcds are removed */ | ||
3232 | if (!usb_hcd_is_primary_hcd(hcd)) { | ||
3233 | - /* usb core will free this hcd shortly, unset pointer */ | ||
3234 | - xhci->shared_hcd = NULL; | ||
3235 | mutex_unlock(&xhci->mutex); | ||
3236 | return; | ||
3237 | } | ||
3238 | diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h | ||
3239 | index 6230a578324c..e936e4c8af98 100644 | ||
3240 | --- a/drivers/usb/host/xhci.h | ||
3241 | +++ b/drivers/usb/host/xhci.h | ||
3242 | @@ -1678,7 +1678,7 @@ struct xhci_bus_state { | ||
3243 | * It can take up to 20 ms to transition from RExit to U0 on the | ||
3244 | * Intel Lynx Point LP xHCI host. | ||
3245 | */ | ||
3246 | -#define XHCI_MAX_REXIT_TIMEOUT (20 * 1000) | ||
3247 | +#define XHCI_MAX_REXIT_TIMEOUT_MS 20 | ||
3248 | |||
3249 | static inline unsigned int hcd_index(struct usb_hcd *hcd) | ||
3250 | { | ||
3251 | @@ -1846,6 +1846,7 @@ struct xhci_hcd { | ||
3252 | #define XHCI_SUSPEND_DELAY BIT_ULL(30) | ||
3253 | #define XHCI_INTEL_USB_ROLE_SW BIT_ULL(31) | ||
3254 | #define XHCI_ZERO_64B_REGS BIT_ULL(32) | ||
3255 | +#define XHCI_RESET_PLL_ON_DISCONNECT BIT_ULL(34) | ||
3256 | |||
3257 | unsigned int num_active_eps; | ||
3258 | unsigned int limit_active_eps; | ||
3259 | diff --git a/fs/9p/vfs_dir.c b/fs/9p/vfs_dir.c | ||
3260 | index b0405d6aac85..48db9a9f13f9 100644 | ||
3261 | --- a/fs/9p/vfs_dir.c | ||
3262 | +++ b/fs/9p/vfs_dir.c | ||
3263 | @@ -76,15 +76,6 @@ static inline int dt_type(struct p9_wstat *mistat) | ||
3264 | return rettype; | ||
3265 | } | ||
3266 | |||
3267 | -static void p9stat_init(struct p9_wstat *stbuf) | ||
3268 | -{ | ||
3269 | - stbuf->name = NULL; | ||
3270 | - stbuf->uid = NULL; | ||
3271 | - stbuf->gid = NULL; | ||
3272 | - stbuf->muid = NULL; | ||
3273 | - stbuf->extension = NULL; | ||
3274 | -} | ||
3275 | - | ||
3276 | /** | ||
3277 | * v9fs_alloc_rdir_buf - Allocate buffer used for read and readdir | ||
3278 | * @filp: opened file structure | ||
3279 | @@ -145,12 +136,10 @@ static int v9fs_dir_readdir(struct file *file, struct dir_context *ctx) | ||
3280 | rdir->tail = n; | ||
3281 | } | ||
3282 | while (rdir->head < rdir->tail) { | ||
3283 | - p9stat_init(&st); | ||
3284 | err = p9stat_read(fid->clnt, rdir->buf + rdir->head, | ||
3285 | rdir->tail - rdir->head, &st); | ||
3286 | if (err) { | ||
3287 | p9_debug(P9_DEBUG_VFS, "returned %d\n", err); | ||
3288 | - p9stat_free(&st); | ||
3289 | return -EIO; | ||
3290 | } | ||
3291 | reclen = st.size+2; | ||
3292 | diff --git a/fs/bfs/inode.c b/fs/bfs/inode.c | ||
3293 | index 9a69392f1fb3..d81c148682e7 100644 | ||
3294 | --- a/fs/bfs/inode.c | ||
3295 | +++ b/fs/bfs/inode.c | ||
3296 | @@ -350,7 +350,8 @@ static int bfs_fill_super(struct super_block *s, void *data, int silent) | ||
3297 | |||
3298 | s->s_magic = BFS_MAGIC; | ||
3299 | |||
3300 | - if (le32_to_cpu(bfs_sb->s_start) > le32_to_cpu(bfs_sb->s_end)) { | ||
3301 | + if (le32_to_cpu(bfs_sb->s_start) > le32_to_cpu(bfs_sb->s_end) || | ||
3302 | + le32_to_cpu(bfs_sb->s_start) < BFS_BSIZE) { | ||
3303 | printf("Superblock is corrupted\n"); | ||
3304 | goto out1; | ||
3305 | } | ||
3306 | @@ -359,9 +360,11 @@ static int bfs_fill_super(struct super_block *s, void *data, int silent) | ||
3307 | sizeof(struct bfs_inode) | ||
3308 | + BFS_ROOT_INO - 1; | ||
3309 | imap_len = (info->si_lasti / 8) + 1; | ||
3310 | - info->si_imap = kzalloc(imap_len, GFP_KERNEL); | ||
3311 | - if (!info->si_imap) | ||
3312 | + info->si_imap = kzalloc(imap_len, GFP_KERNEL | __GFP_NOWARN); | ||
3313 | + if (!info->si_imap) { | ||
3314 | + printf("Cannot allocate %u bytes\n", imap_len); | ||
3315 | goto out1; | ||
3316 | + } | ||
3317 | for (i = 0; i < BFS_ROOT_INO; i++) | ||
3318 | set_bit(i, info->si_imap); | ||
3319 | |||
3320 | diff --git a/fs/dax.c b/fs/dax.c | ||
3321 | index 0fb270f0a0ef..b0cd1364c68f 100644 | ||
3322 | --- a/fs/dax.c | ||
3323 | +++ b/fs/dax.c | ||
3324 | @@ -217,6 +217,9 @@ static inline void *unlock_slot(struct address_space *mapping, void **slot) | ||
3325 | return (void *)entry; | ||
3326 | } | ||
3327 | |||
3328 | +static void put_unlocked_mapping_entry(struct address_space *mapping, | ||
3329 | + pgoff_t index, void *entry); | ||
3330 | + | ||
3331 | /* | ||
3332 | * Lookup entry in radix tree, wait for it to become unlocked if it is | ||
3333 | * exceptional entry and return it. The caller must call | ||
3334 | @@ -256,8 +259,10 @@ static void *__get_unlocked_mapping_entry(struct address_space *mapping, | ||
3335 | revalidate = wait_fn(); | ||
3336 | finish_wait(wq, &ewait.wait); | ||
3337 | xa_lock_irq(&mapping->i_pages); | ||
3338 | - if (revalidate) | ||
3339 | + if (revalidate) { | ||
3340 | + put_unlocked_mapping_entry(mapping, index, entry); | ||
3341 | return ERR_PTR(-EAGAIN); | ||
3342 | + } | ||
3343 | } | ||
3344 | } | ||
3345 | |||
3346 | diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c | ||
3347 | index 8748539c04ed..7f8bb0868c0f 100644 | ||
3348 | --- a/fs/gfs2/bmap.c | ||
3349 | +++ b/fs/gfs2/bmap.c | ||
3350 | @@ -826,7 +826,7 @@ static int gfs2_iomap_get(struct inode *inode, loff_t pos, loff_t length, | ||
3351 | ret = gfs2_meta_inode_buffer(ip, &dibh); | ||
3352 | if (ret) | ||
3353 | goto unlock; | ||
3354 | - iomap->private = dibh; | ||
3355 | + mp->mp_bh[0] = dibh; | ||
3356 | |||
3357 | if (gfs2_is_stuffed(ip)) { | ||
3358 | if (flags & IOMAP_WRITE) { | ||
3359 | @@ -863,9 +863,6 @@ unstuff: | ||
3360 | len = lblock_stop - lblock + 1; | ||
3361 | iomap->length = len << inode->i_blkbits; | ||
3362 | |||
3363 | - get_bh(dibh); | ||
3364 | - mp->mp_bh[0] = dibh; | ||
3365 | - | ||
3366 | height = ip->i_height; | ||
3367 | while ((lblock + 1) * sdp->sd_sb.sb_bsize > sdp->sd_heightsize[height]) | ||
3368 | height++; | ||
3369 | @@ -898,8 +895,6 @@ out: | ||
3370 | iomap->bdev = inode->i_sb->s_bdev; | ||
3371 | unlock: | ||
3372 | up_read(&ip->i_rw_mutex); | ||
3373 | - if (ret && dibh) | ||
3374 | - brelse(dibh); | ||
3375 | return ret; | ||
3376 | |||
3377 | do_alloc: | ||
3378 | @@ -980,9 +975,9 @@ static void gfs2_iomap_journaled_page_done(struct inode *inode, loff_t pos, | ||
3379 | |||
3380 | static int gfs2_iomap_begin_write(struct inode *inode, loff_t pos, | ||
3381 | loff_t length, unsigned flags, | ||
3382 | - struct iomap *iomap) | ||
3383 | + struct iomap *iomap, | ||
3384 | + struct metapath *mp) | ||
3385 | { | ||
3386 | - struct metapath mp = { .mp_aheight = 1, }; | ||
3387 | struct gfs2_inode *ip = GFS2_I(inode); | ||
3388 | struct gfs2_sbd *sdp = GFS2_SB(inode); | ||
3389 | unsigned int data_blocks = 0, ind_blocks = 0, rblocks; | ||
3390 | @@ -996,9 +991,9 @@ static int gfs2_iomap_begin_write(struct inode *inode, loff_t pos, | ||
3391 | unstuff = gfs2_is_stuffed(ip) && | ||
3392 | pos + length > gfs2_max_stuffed_size(ip); | ||
3393 | |||
3394 | - ret = gfs2_iomap_get(inode, pos, length, flags, iomap, &mp); | ||
3395 | + ret = gfs2_iomap_get(inode, pos, length, flags, iomap, mp); | ||
3396 | if (ret) | ||
3397 | - goto out_release; | ||
3398 | + goto out_unlock; | ||
3399 | |||
3400 | alloc_required = unstuff || iomap->type == IOMAP_HOLE; | ||
3401 | |||
3402 | @@ -1013,7 +1008,7 @@ static int gfs2_iomap_begin_write(struct inode *inode, loff_t pos, | ||
3403 | |||
3404 | ret = gfs2_quota_lock_check(ip, &ap); | ||
3405 | if (ret) | ||
3406 | - goto out_release; | ||
3407 | + goto out_unlock; | ||
3408 | |||
3409 | ret = gfs2_inplace_reserve(ip, &ap); | ||
3410 | if (ret) | ||
3411 | @@ -1038,17 +1033,15 @@ static int gfs2_iomap_begin_write(struct inode *inode, loff_t pos, | ||
3412 | ret = gfs2_unstuff_dinode(ip, NULL); | ||
3413 | if (ret) | ||
3414 | goto out_trans_end; | ||
3415 | - release_metapath(&mp); | ||
3416 | - brelse(iomap->private); | ||
3417 | - iomap->private = NULL; | ||
3418 | + release_metapath(mp); | ||
3419 | ret = gfs2_iomap_get(inode, iomap->offset, iomap->length, | ||
3420 | - flags, iomap, &mp); | ||
3421 | + flags, iomap, mp); | ||
3422 | if (ret) | ||
3423 | goto out_trans_end; | ||
3424 | } | ||
3425 | |||
3426 | if (iomap->type == IOMAP_HOLE) { | ||
3427 | - ret = gfs2_iomap_alloc(inode, iomap, flags, &mp); | ||
3428 | + ret = gfs2_iomap_alloc(inode, iomap, flags, mp); | ||
3429 | if (ret) { | ||
3430 | gfs2_trans_end(sdp); | ||
3431 | gfs2_inplace_release(ip); | ||
3432 | @@ -1056,7 +1049,6 @@ static int gfs2_iomap_begin_write(struct inode *inode, loff_t pos, | ||
3433 | goto out_qunlock; | ||
3434 | } | ||
3435 | } | ||
3436 | - release_metapath(&mp); | ||
3437 | if (!gfs2_is_stuffed(ip) && gfs2_is_jdata(ip)) | ||
3438 | iomap->page_done = gfs2_iomap_journaled_page_done; | ||
3439 | return 0; | ||
3440 | @@ -1069,10 +1061,7 @@ out_trans_fail: | ||
3441 | out_qunlock: | ||
3442 | if (alloc_required) | ||
3443 | gfs2_quota_unlock(ip); | ||
3444 | -out_release: | ||
3445 | - if (iomap->private) | ||
3446 | - brelse(iomap->private); | ||
3447 | - release_metapath(&mp); | ||
3448 | +out_unlock: | ||
3449 | gfs2_write_unlock(inode); | ||
3450 | return ret; | ||
3451 | } | ||
3452 | @@ -1088,10 +1077,10 @@ static int gfs2_iomap_begin(struct inode *inode, loff_t pos, loff_t length, | ||
3453 | |||
3454 | trace_gfs2_iomap_start(ip, pos, length, flags); | ||
3455 | if ((flags & IOMAP_WRITE) && !(flags & IOMAP_DIRECT)) { | ||
3456 | - ret = gfs2_iomap_begin_write(inode, pos, length, flags, iomap); | ||
3457 | + ret = gfs2_iomap_begin_write(inode, pos, length, flags, iomap, &mp); | ||
3458 | } else { | ||
3459 | ret = gfs2_iomap_get(inode, pos, length, flags, iomap, &mp); | ||
3460 | - release_metapath(&mp); | ||
3461 | + | ||
3462 | /* | ||
3463 | * Silently fall back to buffered I/O for stuffed files or if | ||
3464 | * we've hot a hole (see gfs2_file_direct_write). | ||
3465 | @@ -1100,6 +1089,11 @@ static int gfs2_iomap_begin(struct inode *inode, loff_t pos, loff_t length, | ||
3466 | iomap->type != IOMAP_MAPPED) | ||
3467 | ret = -ENOTBLK; | ||
3468 | } | ||
3469 | + if (!ret) { | ||
3470 | + get_bh(mp.mp_bh[0]); | ||
3471 | + iomap->private = mp.mp_bh[0]; | ||
3472 | + } | ||
3473 | + release_metapath(&mp); | ||
3474 | trace_gfs2_iomap_end(ip, iomap, ret); | ||
3475 | return ret; | ||
3476 | } | ||
3477 | diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c | ||
3478 | index 6b84ef6ccff3..b041cb8ae383 100644 | ||
3479 | --- a/fs/gfs2/ops_fstype.c | ||
3480 | +++ b/fs/gfs2/ops_fstype.c | ||
3481 | @@ -72,13 +72,13 @@ static struct gfs2_sbd *init_sbd(struct super_block *sb) | ||
3482 | if (!sdp) | ||
3483 | return NULL; | ||
3484 | |||
3485 | - sb->s_fs_info = sdp; | ||
3486 | sdp->sd_vfs = sb; | ||
3487 | sdp->sd_lkstats = alloc_percpu(struct gfs2_pcpu_lkstats); | ||
3488 | if (!sdp->sd_lkstats) { | ||
3489 | kfree(sdp); | ||
3490 | return NULL; | ||
3491 | } | ||
3492 | + sb->s_fs_info = sdp; | ||
3493 | |||
3494 | set_bit(SDF_NOJOURNALID, &sdp->sd_flags); | ||
3495 | gfs2_tune_init(&sdp->sd_tune); | ||
3496 | diff --git a/fs/nfs/callback_proc.c b/fs/nfs/callback_proc.c | ||
3497 | index fa515d5ea5ba..7b861bbc0b43 100644 | ||
3498 | --- a/fs/nfs/callback_proc.c | ||
3499 | +++ b/fs/nfs/callback_proc.c | ||
3500 | @@ -66,7 +66,7 @@ __be32 nfs4_callback_getattr(void *argp, void *resp, | ||
3501 | out_iput: | ||
3502 | rcu_read_unlock(); | ||
3503 | trace_nfs4_cb_getattr(cps->clp, &args->fh, inode, -ntohl(res->status)); | ||
3504 | - iput(inode); | ||
3505 | + nfs_iput_and_deactive(inode); | ||
3506 | out: | ||
3507 | dprintk("%s: exit with status = %d\n", __func__, ntohl(res->status)); | ||
3508 | return res->status; | ||
3509 | @@ -108,7 +108,7 @@ __be32 nfs4_callback_recall(void *argp, void *resp, | ||
3510 | } | ||
3511 | trace_nfs4_cb_recall(cps->clp, &args->fh, inode, | ||
3512 | &args->stateid, -ntohl(res)); | ||
3513 | - iput(inode); | ||
3514 | + nfs_iput_and_deactive(inode); | ||
3515 | out: | ||
3516 | dprintk("%s: exit with status = %d\n", __func__, ntohl(res)); | ||
3517 | return res; | ||
3518 | diff --git a/fs/nfs/delegation.c b/fs/nfs/delegation.c | ||
3519 | index f033f3a69a3b..75fe92eaa681 100644 | ||
3520 | --- a/fs/nfs/delegation.c | ||
3521 | +++ b/fs/nfs/delegation.c | ||
3522 | @@ -849,16 +849,23 @@ nfs_delegation_find_inode_server(struct nfs_server *server, | ||
3523 | const struct nfs_fh *fhandle) | ||
3524 | { | ||
3525 | struct nfs_delegation *delegation; | ||
3526 | - struct inode *res = NULL; | ||
3527 | + struct inode *freeme, *res = NULL; | ||
3528 | |||
3529 | list_for_each_entry_rcu(delegation, &server->delegations, super_list) { | ||
3530 | spin_lock(&delegation->lock); | ||
3531 | if (delegation->inode != NULL && | ||
3532 | nfs_compare_fh(fhandle, &NFS_I(delegation->inode)->fh) == 0) { | ||
3533 | - res = igrab(delegation->inode); | ||
3534 | + freeme = igrab(delegation->inode); | ||
3535 | + if (freeme && nfs_sb_active(freeme->i_sb)) | ||
3536 | + res = freeme; | ||
3537 | spin_unlock(&delegation->lock); | ||
3538 | if (res != NULL) | ||
3539 | return res; | ||
3540 | + if (freeme) { | ||
3541 | + rcu_read_unlock(); | ||
3542 | + iput(freeme); | ||
3543 | + rcu_read_lock(); | ||
3544 | + } | ||
3545 | return ERR_PTR(-EAGAIN); | ||
3546 | } | ||
3547 | spin_unlock(&delegation->lock); | ||
3548 | diff --git a/fs/notify/fanotify/fanotify.c b/fs/notify/fanotify/fanotify.c | ||
3549 | index 94b52157bf8d..29dee9630eec 100644 | ||
3550 | --- a/fs/notify/fanotify/fanotify.c | ||
3551 | +++ b/fs/notify/fanotify/fanotify.c | ||
3552 | @@ -115,12 +115,12 @@ static bool fanotify_should_send_event(struct fsnotify_iter_info *iter_info, | ||
3553 | continue; | ||
3554 | mark = iter_info->marks[type]; | ||
3555 | /* | ||
3556 | - * if the event is for a child and this inode doesn't care about | ||
3557 | - * events on the child, don't send it! | ||
3558 | + * If the event is for a child and this mark doesn't care about | ||
3559 | + * events on a child, don't send it! | ||
3560 | */ | ||
3561 | - if (type == FSNOTIFY_OBJ_TYPE_INODE && | ||
3562 | - (event_mask & FS_EVENT_ON_CHILD) && | ||
3563 | - !(mark->mask & FS_EVENT_ON_CHILD)) | ||
3564 | + if (event_mask & FS_EVENT_ON_CHILD && | ||
3565 | + (type != FSNOTIFY_OBJ_TYPE_INODE || | ||
3566 | + !(mark->mask & FS_EVENT_ON_CHILD))) | ||
3567 | continue; | ||
3568 | |||
3569 | marks_mask |= mark->mask; | ||
3570 | diff --git a/fs/notify/fsnotify.c b/fs/notify/fsnotify.c | ||
3571 | index f43ea1aad542..170a733454f7 100644 | ||
3572 | --- a/fs/notify/fsnotify.c | ||
3573 | +++ b/fs/notify/fsnotify.c | ||
3574 | @@ -161,9 +161,9 @@ int __fsnotify_parent(const struct path *path, struct dentry *dentry, __u32 mask | ||
3575 | parent = dget_parent(dentry); | ||
3576 | p_inode = parent->d_inode; | ||
3577 | |||
3578 | - if (unlikely(!fsnotify_inode_watches_children(p_inode))) | ||
3579 | + if (unlikely(!fsnotify_inode_watches_children(p_inode))) { | ||
3580 | __fsnotify_update_child_dentry_flags(p_inode); | ||
3581 | - else if (p_inode->i_fsnotify_mask & mask) { | ||
3582 | + } else if (p_inode->i_fsnotify_mask & mask & ALL_FSNOTIFY_EVENTS) { | ||
3583 | struct name_snapshot name; | ||
3584 | |||
3585 | /* we are notifying a parent so come up with the new mask which | ||
3586 | @@ -193,7 +193,7 @@ static int send_to_group(struct inode *to_tell, | ||
3587 | struct fsnotify_iter_info *iter_info) | ||
3588 | { | ||
3589 | struct fsnotify_group *group = NULL; | ||
3590 | - __u32 test_mask = (mask & ~FS_EVENT_ON_CHILD); | ||
3591 | + __u32 test_mask = (mask & ALL_FSNOTIFY_EVENTS); | ||
3592 | __u32 marks_mask = 0; | ||
3593 | __u32 marks_ignored_mask = 0; | ||
3594 | struct fsnotify_mark *mark; | ||
3595 | @@ -324,14 +324,17 @@ int fsnotify(struct inode *to_tell, __u32 mask, const void *data, int data_is, | ||
3596 | struct fsnotify_iter_info iter_info = {}; | ||
3597 | struct mount *mnt; | ||
3598 | int ret = 0; | ||
3599 | - /* global tests shouldn't care about events on child only the specific event */ | ||
3600 | - __u32 test_mask = (mask & ~FS_EVENT_ON_CHILD); | ||
3601 | + __u32 test_mask = (mask & ALL_FSNOTIFY_EVENTS); | ||
3602 | |||
3603 | if (data_is == FSNOTIFY_EVENT_PATH) | ||
3604 | mnt = real_mount(((const struct path *)data)->mnt); | ||
3605 | else | ||
3606 | mnt = NULL; | ||
3607 | |||
3608 | + /* An event "on child" is not intended for a mount mark */ | ||
3609 | + if (mask & FS_EVENT_ON_CHILD) | ||
3610 | + mnt = NULL; | ||
3611 | + | ||
3612 | /* | ||
3613 | * Optimization: srcu_read_lock() has a memory barrier which can | ||
3614 | * be expensive. It protects walking the *_fsnotify_marks lists. | ||
3615 | @@ -389,7 +392,7 @@ static __init int fsnotify_init(void) | ||
3616 | { | ||
3617 | int ret; | ||
3618 | |||
3619 | - BUG_ON(hweight32(ALL_FSNOTIFY_EVENTS) != 23); | ||
3620 | + BUG_ON(hweight32(ALL_FSNOTIFY_BITS) != 23); | ||
3621 | |||
3622 | ret = init_srcu_struct(&fsnotify_mark_srcu); | ||
3623 | if (ret) | ||
3624 | diff --git a/include/linux/can/dev.h b/include/linux/can/dev.h | ||
3625 | index a83e1f632eb7..f01623aef2f7 100644 | ||
3626 | --- a/include/linux/can/dev.h | ||
3627 | +++ b/include/linux/can/dev.h | ||
3628 | @@ -169,6 +169,7 @@ void can_change_state(struct net_device *dev, struct can_frame *cf, | ||
3629 | |||
3630 | void can_put_echo_skb(struct sk_buff *skb, struct net_device *dev, | ||
3631 | unsigned int idx); | ||
3632 | +struct sk_buff *__can_get_echo_skb(struct net_device *dev, unsigned int idx, u8 *len_ptr); | ||
3633 | unsigned int can_get_echo_skb(struct net_device *dev, unsigned int idx); | ||
3634 | void can_free_echo_skb(struct net_device *dev, unsigned int idx); | ||
3635 | |||
3636 | diff --git a/include/linux/can/rx-offload.h b/include/linux/can/rx-offload.h | ||
3637 | index cb31683bbe15..8268811a697e 100644 | ||
3638 | --- a/include/linux/can/rx-offload.h | ||
3639 | +++ b/include/linux/can/rx-offload.h | ||
3640 | @@ -41,7 +41,12 @@ int can_rx_offload_add_timestamp(struct net_device *dev, struct can_rx_offload * | ||
3641 | int can_rx_offload_add_fifo(struct net_device *dev, struct can_rx_offload *offload, unsigned int weight); | ||
3642 | int can_rx_offload_irq_offload_timestamp(struct can_rx_offload *offload, u64 reg); | ||
3643 | int can_rx_offload_irq_offload_fifo(struct can_rx_offload *offload); | ||
3644 | -int can_rx_offload_irq_queue_err_skb(struct can_rx_offload *offload, struct sk_buff *skb); | ||
3645 | +int can_rx_offload_queue_sorted(struct can_rx_offload *offload, | ||
3646 | + struct sk_buff *skb, u32 timestamp); | ||
3647 | +unsigned int can_rx_offload_get_echo_skb(struct can_rx_offload *offload, | ||
3648 | + unsigned int idx, u32 timestamp); | ||
3649 | +int can_rx_offload_queue_tail(struct can_rx_offload *offload, | ||
3650 | + struct sk_buff *skb); | ||
3651 | void can_rx_offload_reset(struct can_rx_offload *offload); | ||
3652 | void can_rx_offload_del(struct can_rx_offload *offload); | ||
3653 | void can_rx_offload_enable(struct can_rx_offload *offload); | ||
3654 | diff --git a/include/linux/fsnotify_backend.h b/include/linux/fsnotify_backend.h | ||
3655 | index b8f4182f42f1..4599d1c95f8c 100644 | ||
3656 | --- a/include/linux/fsnotify_backend.h | ||
3657 | +++ b/include/linux/fsnotify_backend.h | ||
3658 | @@ -68,15 +68,20 @@ | ||
3659 | |||
3660 | #define ALL_FSNOTIFY_PERM_EVENTS (FS_OPEN_PERM | FS_ACCESS_PERM) | ||
3661 | |||
3662 | +/* Events that can be reported to backends */ | ||
3663 | #define ALL_FSNOTIFY_EVENTS (FS_ACCESS | FS_MODIFY | FS_ATTRIB | \ | ||
3664 | FS_CLOSE_WRITE | FS_CLOSE_NOWRITE | FS_OPEN | \ | ||
3665 | FS_MOVED_FROM | FS_MOVED_TO | FS_CREATE | \ | ||
3666 | FS_DELETE | FS_DELETE_SELF | FS_MOVE_SELF | \ | ||
3667 | FS_UNMOUNT | FS_Q_OVERFLOW | FS_IN_IGNORED | \ | ||
3668 | - FS_OPEN_PERM | FS_ACCESS_PERM | FS_EXCL_UNLINK | \ | ||
3669 | - FS_ISDIR | FS_IN_ONESHOT | FS_DN_RENAME | \ | ||
3670 | + FS_OPEN_PERM | FS_ACCESS_PERM | FS_DN_RENAME) | ||
3671 | + | ||
3672 | +/* Extra flags that may be reported with event or control handling of events */ | ||
3673 | +#define ALL_FSNOTIFY_FLAGS (FS_EXCL_UNLINK | FS_ISDIR | FS_IN_ONESHOT | \ | ||
3674 | FS_DN_MULTISHOT | FS_EVENT_ON_CHILD) | ||
3675 | |||
3676 | +#define ALL_FSNOTIFY_BITS (ALL_FSNOTIFY_EVENTS | ALL_FSNOTIFY_FLAGS) | ||
3677 | + | ||
3678 | struct fsnotify_group; | ||
3679 | struct fsnotify_event; | ||
3680 | struct fsnotify_mark; | ||
3681 | diff --git a/include/linux/pfn_t.h b/include/linux/pfn_t.h | ||
3682 | index 21713dc14ce2..673546ba7342 100644 | ||
3683 | --- a/include/linux/pfn_t.h | ||
3684 | +++ b/include/linux/pfn_t.h | ||
3685 | @@ -10,7 +10,7 @@ | ||
3686 | * PFN_DEV - pfn is not covered by system memmap by default | ||
3687 | * PFN_MAP - pfn has a dynamic page mapping established by a device driver | ||
3688 | */ | ||
3689 | -#define PFN_FLAGS_MASK (((u64) ~PAGE_MASK) << (BITS_PER_LONG_LONG - PAGE_SHIFT)) | ||
3690 | +#define PFN_FLAGS_MASK (((u64) (~PAGE_MASK)) << (BITS_PER_LONG_LONG - PAGE_SHIFT)) | ||
3691 | #define PFN_SG_CHAIN (1ULL << (BITS_PER_LONG_LONG - 1)) | ||
3692 | #define PFN_SG_LAST (1ULL << (BITS_PER_LONG_LONG - 2)) | ||
3693 | #define PFN_DEV (1ULL << (BITS_PER_LONG_LONG - 3)) | ||
3694 | diff --git a/include/net/sock.h b/include/net/sock.h | ||
3695 | index c64a1cff9eb3..f18dbd6da906 100644 | ||
3696 | --- a/include/net/sock.h | ||
3697 | +++ b/include/net/sock.h | ||
3698 | @@ -1491,6 +1491,7 @@ static inline void lock_sock(struct sock *sk) | ||
3699 | lock_sock_nested(sk, 0); | ||
3700 | } | ||
3701 | |||
3702 | +void __release_sock(struct sock *sk); | ||
3703 | void release_sock(struct sock *sk); | ||
3704 | |||
3705 | /* BH context may only use the following locking interface. */ | ||
3706 | diff --git a/kernel/debug/kdb/kdb_io.c b/kernel/debug/kdb/kdb_io.c | ||
3707 | index ed5d34925ad0..6a4b41484afe 100644 | ||
3708 | --- a/kernel/debug/kdb/kdb_io.c | ||
3709 | +++ b/kernel/debug/kdb/kdb_io.c | ||
3710 | @@ -216,7 +216,7 @@ static char *kdb_read(char *buffer, size_t bufsize) | ||
3711 | int count; | ||
3712 | int i; | ||
3713 | int diag, dtab_count; | ||
3714 | - int key; | ||
3715 | + int key, buf_size, ret; | ||
3716 | |||
3717 | |||
3718 | diag = kdbgetintenv("DTABCOUNT", &dtab_count); | ||
3719 | @@ -336,9 +336,8 @@ poll_again: | ||
3720 | else | ||
3721 | p_tmp = tmpbuffer; | ||
3722 | len = strlen(p_tmp); | ||
3723 | - count = kallsyms_symbol_complete(p_tmp, | ||
3724 | - sizeof(tmpbuffer) - | ||
3725 | - (p_tmp - tmpbuffer)); | ||
3726 | + buf_size = sizeof(tmpbuffer) - (p_tmp - tmpbuffer); | ||
3727 | + count = kallsyms_symbol_complete(p_tmp, buf_size); | ||
3728 | if (tab == 2 && count > 0) { | ||
3729 | kdb_printf("\n%d symbols are found.", count); | ||
3730 | if (count > dtab_count) { | ||
3731 | @@ -350,9 +349,13 @@ poll_again: | ||
3732 | } | ||
3733 | kdb_printf("\n"); | ||
3734 | for (i = 0; i < count; i++) { | ||
3735 | - if (WARN_ON(!kallsyms_symbol_next(p_tmp, i))) | ||
3736 | + ret = kallsyms_symbol_next(p_tmp, i, buf_size); | ||
3737 | + if (WARN_ON(!ret)) | ||
3738 | break; | ||
3739 | - kdb_printf("%s ", p_tmp); | ||
3740 | + if (ret != -E2BIG) | ||
3741 | + kdb_printf("%s ", p_tmp); | ||
3742 | + else | ||
3743 | + kdb_printf("%s... ", p_tmp); | ||
3744 | *(p_tmp + len) = '\0'; | ||
3745 | } | ||
3746 | if (i >= dtab_count) | ||
3747 | diff --git a/kernel/debug/kdb/kdb_private.h b/kernel/debug/kdb/kdb_private.h | ||
3748 | index 1e5a502ba4a7..2118d8258b7c 100644 | ||
3749 | --- a/kernel/debug/kdb/kdb_private.h | ||
3750 | +++ b/kernel/debug/kdb/kdb_private.h | ||
3751 | @@ -83,7 +83,7 @@ typedef struct __ksymtab { | ||
3752 | unsigned long sym_start; | ||
3753 | unsigned long sym_end; | ||
3754 | } kdb_symtab_t; | ||
3755 | -extern int kallsyms_symbol_next(char *prefix_name, int flag); | ||
3756 | +extern int kallsyms_symbol_next(char *prefix_name, int flag, int buf_size); | ||
3757 | extern int kallsyms_symbol_complete(char *prefix_name, int max_len); | ||
3758 | |||
3759 | /* Exported Symbols for kernel loadable modules to use. */ | ||
3760 | diff --git a/kernel/debug/kdb/kdb_support.c b/kernel/debug/kdb/kdb_support.c | ||
3761 | index 987eb73284d2..b14b0925c184 100644 | ||
3762 | --- a/kernel/debug/kdb/kdb_support.c | ||
3763 | +++ b/kernel/debug/kdb/kdb_support.c | ||
3764 | @@ -221,11 +221,13 @@ int kallsyms_symbol_complete(char *prefix_name, int max_len) | ||
3765 | * Parameters: | ||
3766 | * prefix_name prefix of a symbol name to lookup | ||
3767 | * flag 0 means search from the head, 1 means continue search. | ||
3768 | + * buf_size maximum length that can be written to prefix_name | ||
3769 | + * buffer | ||
3770 | * Returns: | ||
3771 | * 1 if a symbol matches the given prefix. | ||
3772 | * 0 if no string found | ||
3773 | */ | ||
3774 | -int kallsyms_symbol_next(char *prefix_name, int flag) | ||
3775 | +int kallsyms_symbol_next(char *prefix_name, int flag, int buf_size) | ||
3776 | { | ||
3777 | int prefix_len = strlen(prefix_name); | ||
3778 | static loff_t pos; | ||
3779 | @@ -235,10 +237,8 @@ int kallsyms_symbol_next(char *prefix_name, int flag) | ||
3780 | pos = 0; | ||
3781 | |||
3782 | while ((name = kdb_walk_kallsyms(&pos))) { | ||
3783 | - if (strncmp(name, prefix_name, prefix_len) == 0) { | ||
3784 | - strncpy(prefix_name, name, strlen(name)+1); | ||
3785 | - return 1; | ||
3786 | - } | ||
3787 | + if (!strncmp(name, prefix_name, prefix_len)) | ||
3788 | + return strscpy(prefix_name, name, buf_size); | ||
3789 | } | ||
3790 | return 0; | ||
3791 | } | ||
3792 | diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c | ||
3793 | index 0b760c1369f7..15301ed19da6 100644 | ||
3794 | --- a/kernel/rcu/tree.c | ||
3795 | +++ b/kernel/rcu/tree.c | ||
3796 | @@ -2662,6 +2662,15 @@ void rcu_check_callbacks(int user) | ||
3797 | rcu_bh_qs(); | ||
3798 | } | ||
3799 | rcu_preempt_check_callbacks(); | ||
3800 | + /* The load-acquire pairs with the store-release setting to true. */ | ||
3801 | + if (smp_load_acquire(this_cpu_ptr(&rcu_dynticks.rcu_urgent_qs))) { | ||
3802 | + /* Idle and userspace execution already are quiescent states. */ | ||
3803 | + if (!rcu_is_cpu_rrupt_from_idle() && !user) { | ||
3804 | + set_tsk_need_resched(current); | ||
3805 | + set_preempt_need_resched(); | ||
3806 | + } | ||
3807 | + __this_cpu_write(rcu_dynticks.rcu_urgent_qs, false); | ||
3808 | + } | ||
3809 | if (rcu_pending()) | ||
3810 | invoke_rcu_core(); | ||
3811 | |||
3812 | diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c | ||
3813 | index 908c9cdae2f0..1162552dc3cc 100644 | ||
3814 | --- a/kernel/sched/fair.c | ||
3815 | +++ b/kernel/sched/fair.c | ||
3816 | @@ -5672,11 +5672,11 @@ static int wake_affine(struct sched_domain *sd, struct task_struct *p, | ||
3817 | return target; | ||
3818 | } | ||
3819 | |||
3820 | -static unsigned long cpu_util_wake(int cpu, struct task_struct *p); | ||
3821 | +static unsigned long cpu_util_without(int cpu, struct task_struct *p); | ||
3822 | |||
3823 | -static unsigned long capacity_spare_wake(int cpu, struct task_struct *p) | ||
3824 | +static unsigned long capacity_spare_without(int cpu, struct task_struct *p) | ||
3825 | { | ||
3826 | - return max_t(long, capacity_of(cpu) - cpu_util_wake(cpu, p), 0); | ||
3827 | + return max_t(long, capacity_of(cpu) - cpu_util_without(cpu, p), 0); | ||
3828 | } | ||
3829 | |||
3830 | /* | ||
3831 | @@ -5736,7 +5736,7 @@ find_idlest_group(struct sched_domain *sd, struct task_struct *p, | ||
3832 | |||
3833 | avg_load += cfs_rq_load_avg(&cpu_rq(i)->cfs); | ||
3834 | |||
3835 | - spare_cap = capacity_spare_wake(i, p); | ||
3836 | + spare_cap = capacity_spare_without(i, p); | ||
3837 | |||
3838 | if (spare_cap > max_spare_cap) | ||
3839 | max_spare_cap = spare_cap; | ||
3840 | @@ -5887,8 +5887,8 @@ static inline int find_idlest_cpu(struct sched_domain *sd, struct task_struct *p | ||
3841 | return prev_cpu; | ||
3842 | |||
3843 | /* | ||
3844 | - * We need task's util for capacity_spare_wake, sync it up to prev_cpu's | ||
3845 | - * last_update_time. | ||
3846 | + * We need task's util for capacity_spare_without, sync it up to | ||
3847 | + * prev_cpu's last_update_time. | ||
3848 | */ | ||
3849 | if (!(sd_flag & SD_BALANCE_FORK)) | ||
3850 | sync_entity_load_avg(&p->se); | ||
3851 | @@ -6214,10 +6214,19 @@ static inline unsigned long cpu_util(int cpu) | ||
3852 | } | ||
3853 | |||
3854 | /* | ||
3855 | - * cpu_util_wake: Compute CPU utilization with any contributions from | ||
3856 | - * the waking task p removed. | ||
3857 | + * cpu_util_without: compute cpu utilization without any contributions from *p | ||
3858 | + * @cpu: the CPU which utilization is requested | ||
3859 | + * @p: the task which utilization should be discounted | ||
3860 | + * | ||
3861 | + * The utilization of a CPU is defined by the utilization of tasks currently | ||
3862 | + * enqueued on that CPU as well as tasks which are currently sleeping after an | ||
3863 | + * execution on that CPU. | ||
3864 | + * | ||
3865 | + * This method returns the utilization of the specified CPU by discounting the | ||
3866 | + * utilization of the specified task, whenever the task is currently | ||
3867 | + * contributing to the CPU utilization. | ||
3868 | */ | ||
3869 | -static unsigned long cpu_util_wake(int cpu, struct task_struct *p) | ||
3870 | +static unsigned long cpu_util_without(int cpu, struct task_struct *p) | ||
3871 | { | ||
3872 | struct cfs_rq *cfs_rq; | ||
3873 | unsigned int util; | ||
3874 | @@ -6229,7 +6238,7 @@ static unsigned long cpu_util_wake(int cpu, struct task_struct *p) | ||
3875 | cfs_rq = &cpu_rq(cpu)->cfs; | ||
3876 | util = READ_ONCE(cfs_rq->avg.util_avg); | ||
3877 | |||
3878 | - /* Discount task's blocked util from CPU's util */ | ||
3879 | + /* Discount task's util from CPU's util */ | ||
3880 | util -= min_t(unsigned int, util, task_util(p)); | ||
3881 | |||
3882 | /* | ||
3883 | @@ -6238,14 +6247,14 @@ static unsigned long cpu_util_wake(int cpu, struct task_struct *p) | ||
3884 | * a) if *p is the only task sleeping on this CPU, then: | ||
3885 | * cpu_util (== task_util) > util_est (== 0) | ||
3886 | * and thus we return: | ||
3887 | - * cpu_util_wake = (cpu_util - task_util) = 0 | ||
3888 | + * cpu_util_without = (cpu_util - task_util) = 0 | ||
3889 | * | ||
3890 | * b) if other tasks are SLEEPING on this CPU, which is now exiting | ||
3891 | * IDLE, then: | ||
3892 | * cpu_util >= task_util | ||
3893 | * cpu_util > util_est (== 0) | ||
3894 | * and thus we discount *p's blocked utilization to return: | ||
3895 | - * cpu_util_wake = (cpu_util - task_util) >= 0 | ||
3896 | + * cpu_util_without = (cpu_util - task_util) >= 0 | ||
3897 | * | ||
3898 | * c) if other tasks are RUNNABLE on that CPU and | ||
3899 | * util_est > cpu_util | ||
3900 | @@ -6258,8 +6267,33 @@ static unsigned long cpu_util_wake(int cpu, struct task_struct *p) | ||
3901 | * covered by the following code when estimated utilization is | ||
3902 | * enabled. | ||
3903 | */ | ||
3904 | - if (sched_feat(UTIL_EST)) | ||
3905 | - util = max(util, READ_ONCE(cfs_rq->avg.util_est.enqueued)); | ||
3906 | + if (sched_feat(UTIL_EST)) { | ||
3907 | + unsigned int estimated = | ||
3908 | + READ_ONCE(cfs_rq->avg.util_est.enqueued); | ||
3909 | + | ||
3910 | + /* | ||
3911 | + * Despite the following checks we still have a small window | ||
3912 | + * for a possible race, when an execl's select_task_rq_fair() | ||
3913 | + * races with LB's detach_task(): | ||
3914 | + * | ||
3915 | + * detach_task() | ||
3916 | + * p->on_rq = TASK_ON_RQ_MIGRATING; | ||
3917 | + * ---------------------------------- A | ||
3918 | + * deactivate_task() \ | ||
3919 | + * dequeue_task() + RaceTime | ||
3920 | + * util_est_dequeue() / | ||
3921 | + * ---------------------------------- B | ||
3922 | + * | ||
3923 | + * The additional check on "current == p" it's required to | ||
3924 | + * properly fix the execl regression and it helps in further | ||
3925 | + * reducing the chances for the above race. | ||
3926 | + */ | ||
3927 | + if (unlikely(task_on_rq_queued(p) || current == p)) { | ||
3928 | + estimated -= min_t(unsigned int, estimated, | ||
3929 | + (_task_util_est(p) | UTIL_AVG_UNCHANGED)); | ||
3930 | + } | ||
3931 | + util = max(util, estimated); | ||
3932 | + } | ||
3933 | |||
3934 | /* | ||
3935 | * Utilization (estimated) can exceed the CPU capacity, thus let's | ||
3936 | diff --git a/mm/memory.c b/mm/memory.c | ||
3937 | index c467102a5cbc..5c5df53dbdf9 100644 | ||
3938 | --- a/mm/memory.c | ||
3939 | +++ b/mm/memory.c | ||
3940 | @@ -3745,10 +3745,36 @@ static vm_fault_t do_fault(struct vm_fault *vmf) | ||
3941 | struct vm_area_struct *vma = vmf->vma; | ||
3942 | vm_fault_t ret; | ||
3943 | |||
3944 | - /* The VMA was not fully populated on mmap() or missing VM_DONTEXPAND */ | ||
3945 | - if (!vma->vm_ops->fault) | ||
3946 | - ret = VM_FAULT_SIGBUS; | ||
3947 | - else if (!(vmf->flags & FAULT_FLAG_WRITE)) | ||
3948 | + /* | ||
3949 | + * The VMA was not fully populated on mmap() or missing VM_DONTEXPAND | ||
3950 | + */ | ||
3951 | + if (!vma->vm_ops->fault) { | ||
3952 | + /* | ||
3953 | + * If we find a migration pmd entry or a none pmd entry, which | ||
3954 | + * should never happen, return SIGBUS | ||
3955 | + */ | ||
3956 | + if (unlikely(!pmd_present(*vmf->pmd))) | ||
3957 | + ret = VM_FAULT_SIGBUS; | ||
3958 | + else { | ||
3959 | + vmf->pte = pte_offset_map_lock(vmf->vma->vm_mm, | ||
3960 | + vmf->pmd, | ||
3961 | + vmf->address, | ||
3962 | + &vmf->ptl); | ||
3963 | + /* | ||
3964 | + * Make sure this is not a temporary clearing of pte | ||
3965 | + * by holding ptl and checking again. A R/M/W update | ||
3966 | + * of pte involves: take ptl, clearing the pte so that | ||
3967 | + * we don't have concurrent modification by hardware | ||
3968 | + * followed by an update. | ||
3969 | + */ | ||
3970 | + if (unlikely(pte_none(*vmf->pte))) | ||
3971 | + ret = VM_FAULT_SIGBUS; | ||
3972 | + else | ||
3973 | + ret = VM_FAULT_NOPAGE; | ||
3974 | + | ||
3975 | + pte_unmap_unlock(vmf->pte, vmf->ptl); | ||
3976 | + } | ||
3977 | + } else if (!(vmf->flags & FAULT_FLAG_WRITE)) | ||
3978 | ret = do_read_fault(vmf); | ||
3979 | else if (!(vma->vm_flags & VM_SHARED)) | ||
3980 | ret = do_cow_fault(vmf); | ||
3981 | diff --git a/mm/page_alloc.c b/mm/page_alloc.c | ||
3982 | index e2ef1c17942f..b721631d78ab 100644 | ||
3983 | --- a/mm/page_alloc.c | ||
3984 | +++ b/mm/page_alloc.c | ||
3985 | @@ -4055,17 +4055,6 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order, | ||
3986 | unsigned int cpuset_mems_cookie; | ||
3987 | int reserve_flags; | ||
3988 | |||
3989 | - /* | ||
3990 | - * In the slowpath, we sanity check order to avoid ever trying to | ||
3991 | - * reclaim >= MAX_ORDER areas which will never succeed. Callers may | ||
3992 | - * be using allocators in order of preference for an area that is | ||
3993 | - * too large. | ||
3994 | - */ | ||
3995 | - if (order >= MAX_ORDER) { | ||
3996 | - WARN_ON_ONCE(!(gfp_mask & __GFP_NOWARN)); | ||
3997 | - return NULL; | ||
3998 | - } | ||
3999 | - | ||
4000 | /* | ||
4001 | * We also sanity check to catch abuse of atomic reserves being used by | ||
4002 | * callers that are not in atomic context. | ||
4003 | @@ -4359,6 +4348,15 @@ __alloc_pages_nodemask(gfp_t gfp_mask, unsigned int order, int preferred_nid, | ||
4004 | gfp_t alloc_mask; /* The gfp_t that was actually used for allocation */ | ||
4005 | struct alloc_context ac = { }; | ||
4006 | |||
4007 | + /* | ||
4008 | + * There are several places where we assume that the order value is sane | ||
4009 | + * so bail out early if the request is out of bound. | ||
4010 | + */ | ||
4011 | + if (unlikely(order >= MAX_ORDER)) { | ||
4012 | + WARN_ON_ONCE(!(gfp_mask & __GFP_NOWARN)); | ||
4013 | + return NULL; | ||
4014 | + } | ||
4015 | + | ||
4016 | gfp_mask &= gfp_allowed_mask; | ||
4017 | alloc_mask = gfp_mask; | ||
4018 | if (!prepare_alloc_pages(gfp_mask, order, preferred_nid, nodemask, &ac, &alloc_mask, &alloc_flags)) | ||
4019 | @@ -7690,6 +7688,14 @@ bool has_unmovable_pages(struct zone *zone, struct page *page, int count, | ||
4020 | if (PageReserved(page)) | ||
4021 | goto unmovable; | ||
4022 | |||
4023 | + /* | ||
4024 | + * If the zone is movable and we have ruled out all reserved | ||
4025 | + * pages then it should be reasonably safe to assume the rest | ||
4026 | + * is movable. | ||
4027 | + */ | ||
4028 | + if (zone_idx(zone) == ZONE_MOVABLE) | ||
4029 | + continue; | ||
4030 | + | ||
4031 | /* | ||
4032 | * Hugepages are not in LRU lists, but they're movable. | ||
4033 | * We need not scan over tail pages bacause we don't | ||
4034 | diff --git a/mm/shmem.c b/mm/shmem.c | ||
4035 | index 446942677cd4..38d228a30fdc 100644 | ||
4036 | --- a/mm/shmem.c | ||
4037 | +++ b/mm/shmem.c | ||
4038 | @@ -2610,9 +2610,7 @@ static loff_t shmem_file_llseek(struct file *file, loff_t offset, int whence) | ||
4039 | inode_lock(inode); | ||
4040 | /* We're holding i_mutex so we can access i_size directly */ | ||
4041 | |||
4042 | - if (offset < 0) | ||
4043 | - offset = -EINVAL; | ||
4044 | - else if (offset >= inode->i_size) | ||
4045 | + if (offset < 0 || offset >= inode->i_size) | ||
4046 | offset = -ENXIO; | ||
4047 | else { | ||
4048 | start = offset >> PAGE_SHIFT; | ||
4049 | diff --git a/mm/slab.c b/mm/slab.c | ||
4050 | index aa76a70e087e..d73c7a4820a4 100644 | ||
4051 | --- a/mm/slab.c | ||
4052 | +++ b/mm/slab.c | ||
4053 | @@ -3675,6 +3675,8 @@ __do_kmalloc_node(size_t size, gfp_t flags, int node, unsigned long caller) | ||
4054 | struct kmem_cache *cachep; | ||
4055 | void *ret; | ||
4056 | |||
4057 | + if (unlikely(size > KMALLOC_MAX_CACHE_SIZE)) | ||
4058 | + return NULL; | ||
4059 | cachep = kmalloc_slab(size, flags); | ||
4060 | if (unlikely(ZERO_OR_NULL_PTR(cachep))) | ||
4061 | return cachep; | ||
4062 | @@ -3710,6 +3712,8 @@ static __always_inline void *__do_kmalloc(size_t size, gfp_t flags, | ||
4063 | struct kmem_cache *cachep; | ||
4064 | void *ret; | ||
4065 | |||
4066 | + if (unlikely(size > KMALLOC_MAX_CACHE_SIZE)) | ||
4067 | + return NULL; | ||
4068 | cachep = kmalloc_slab(size, flags); | ||
4069 | if (unlikely(ZERO_OR_NULL_PTR(cachep))) | ||
4070 | return cachep; | ||
4071 | diff --git a/mm/slab_common.c b/mm/slab_common.c | ||
4072 | index fea3376f9816..3a7ac4f15194 100644 | ||
4073 | --- a/mm/slab_common.c | ||
4074 | +++ b/mm/slab_common.c | ||
4075 | @@ -1027,18 +1027,18 @@ struct kmem_cache *kmalloc_slab(size_t size, gfp_t flags) | ||
4076 | { | ||
4077 | unsigned int index; | ||
4078 | |||
4079 | - if (unlikely(size > KMALLOC_MAX_SIZE)) { | ||
4080 | - WARN_ON_ONCE(!(flags & __GFP_NOWARN)); | ||
4081 | - return NULL; | ||
4082 | - } | ||
4083 | - | ||
4084 | if (size <= 192) { | ||
4085 | if (!size) | ||
4086 | return ZERO_SIZE_PTR; | ||
4087 | |||
4088 | index = size_index[size_index_elem(size)]; | ||
4089 | - } else | ||
4090 | + } else { | ||
4091 | + if (unlikely(size > KMALLOC_MAX_CACHE_SIZE)) { | ||
4092 | + WARN_ON(1); | ||
4093 | + return NULL; | ||
4094 | + } | ||
4095 | index = fls(size - 1); | ||
4096 | + } | ||
4097 | |||
4098 | #ifdef CONFIG_ZONE_DMA | ||
4099 | if (unlikely((flags & GFP_DMA))) | ||
4100 | diff --git a/mm/z3fold.c b/mm/z3fold.c | ||
4101 | index 4b366d181f35..aee9b0b8d907 100644 | ||
4102 | --- a/mm/z3fold.c | ||
4103 | +++ b/mm/z3fold.c | ||
4104 | @@ -99,6 +99,7 @@ struct z3fold_header { | ||
4105 | #define NCHUNKS ((PAGE_SIZE - ZHDR_SIZE_ALIGNED) >> CHUNK_SHIFT) | ||
4106 | |||
4107 | #define BUDDY_MASK (0x3) | ||
4108 | +#define BUDDY_SHIFT 2 | ||
4109 | |||
4110 | /** | ||
4111 | * struct z3fold_pool - stores metadata for each z3fold pool | ||
4112 | @@ -145,7 +146,7 @@ enum z3fold_page_flags { | ||
4113 | MIDDLE_CHUNK_MAPPED, | ||
4114 | NEEDS_COMPACTING, | ||
4115 | PAGE_STALE, | ||
4116 | - UNDER_RECLAIM | ||
4117 | + PAGE_CLAIMED, /* by either reclaim or free */ | ||
4118 | }; | ||
4119 | |||
4120 | /***************** | ||
4121 | @@ -174,7 +175,7 @@ static struct z3fold_header *init_z3fold_page(struct page *page, | ||
4122 | clear_bit(MIDDLE_CHUNK_MAPPED, &page->private); | ||
4123 | clear_bit(NEEDS_COMPACTING, &page->private); | ||
4124 | clear_bit(PAGE_STALE, &page->private); | ||
4125 | - clear_bit(UNDER_RECLAIM, &page->private); | ||
4126 | + clear_bit(PAGE_CLAIMED, &page->private); | ||
4127 | |||
4128 | spin_lock_init(&zhdr->page_lock); | ||
4129 | kref_init(&zhdr->refcount); | ||
4130 | @@ -223,8 +224,11 @@ static unsigned long encode_handle(struct z3fold_header *zhdr, enum buddy bud) | ||
4131 | unsigned long handle; | ||
4132 | |||
4133 | handle = (unsigned long)zhdr; | ||
4134 | - if (bud != HEADLESS) | ||
4135 | - handle += (bud + zhdr->first_num) & BUDDY_MASK; | ||
4136 | + if (bud != HEADLESS) { | ||
4137 | + handle |= (bud + zhdr->first_num) & BUDDY_MASK; | ||
4138 | + if (bud == LAST) | ||
4139 | + handle |= (zhdr->last_chunks << BUDDY_SHIFT); | ||
4140 | + } | ||
4141 | return handle; | ||
4142 | } | ||
4143 | |||
4144 | @@ -234,6 +238,12 @@ static struct z3fold_header *handle_to_z3fold_header(unsigned long handle) | ||
4145 | return (struct z3fold_header *)(handle & PAGE_MASK); | ||
4146 | } | ||
4147 | |||
4148 | +/* only for LAST bud, returns zero otherwise */ | ||
4149 | +static unsigned short handle_to_chunks(unsigned long handle) | ||
4150 | +{ | ||
4151 | + return (handle & ~PAGE_MASK) >> BUDDY_SHIFT; | ||
4152 | +} | ||
4153 | + | ||
4154 | /* | ||
4155 | * (handle & BUDDY_MASK) < zhdr->first_num is possible in encode_handle | ||
4156 | * but that doesn't matter. because the masking will result in the | ||
4157 | @@ -720,37 +730,39 @@ static void z3fold_free(struct z3fold_pool *pool, unsigned long handle) | ||
4158 | page = virt_to_page(zhdr); | ||
4159 | |||
4160 | if (test_bit(PAGE_HEADLESS, &page->private)) { | ||
4161 | - /* HEADLESS page stored */ | ||
4162 | - bud = HEADLESS; | ||
4163 | - } else { | ||
4164 | - z3fold_page_lock(zhdr); | ||
4165 | - bud = handle_to_buddy(handle); | ||
4166 | - | ||
4167 | - switch (bud) { | ||
4168 | - case FIRST: | ||
4169 | - zhdr->first_chunks = 0; | ||
4170 | - break; | ||
4171 | - case MIDDLE: | ||
4172 | - zhdr->middle_chunks = 0; | ||
4173 | - zhdr->start_middle = 0; | ||
4174 | - break; | ||
4175 | - case LAST: | ||
4176 | - zhdr->last_chunks = 0; | ||
4177 | - break; | ||
4178 | - default: | ||
4179 | - pr_err("%s: unknown bud %d\n", __func__, bud); | ||
4180 | - WARN_ON(1); | ||
4181 | - z3fold_page_unlock(zhdr); | ||
4182 | - return; | ||
4183 | + /* if a headless page is under reclaim, just leave. | ||
4184 | + * NB: we use test_and_set_bit for a reason: if the bit | ||
4185 | + * has not been set before, we release this page | ||
4186 | + * immediately so we don't care about its value any more. | ||
4187 | + */ | ||
4188 | + if (!test_and_set_bit(PAGE_CLAIMED, &page->private)) { | ||
4189 | + spin_lock(&pool->lock); | ||
4190 | + list_del(&page->lru); | ||
4191 | + spin_unlock(&pool->lock); | ||
4192 | + free_z3fold_page(page); | ||
4193 | + atomic64_dec(&pool->pages_nr); | ||
4194 | } | ||
4195 | + return; | ||
4196 | } | ||
4197 | |||
4198 | - if (bud == HEADLESS) { | ||
4199 | - spin_lock(&pool->lock); | ||
4200 | - list_del(&page->lru); | ||
4201 | - spin_unlock(&pool->lock); | ||
4202 | - free_z3fold_page(page); | ||
4203 | - atomic64_dec(&pool->pages_nr); | ||
4204 | + /* Non-headless case */ | ||
4205 | + z3fold_page_lock(zhdr); | ||
4206 | + bud = handle_to_buddy(handle); | ||
4207 | + | ||
4208 | + switch (bud) { | ||
4209 | + case FIRST: | ||
4210 | + zhdr->first_chunks = 0; | ||
4211 | + break; | ||
4212 | + case MIDDLE: | ||
4213 | + zhdr->middle_chunks = 0; | ||
4214 | + break; | ||
4215 | + case LAST: | ||
4216 | + zhdr->last_chunks = 0; | ||
4217 | + break; | ||
4218 | + default: | ||
4219 | + pr_err("%s: unknown bud %d\n", __func__, bud); | ||
4220 | + WARN_ON(1); | ||
4221 | + z3fold_page_unlock(zhdr); | ||
4222 | return; | ||
4223 | } | ||
4224 | |||
4225 | @@ -758,7 +770,7 @@ static void z3fold_free(struct z3fold_pool *pool, unsigned long handle) | ||
4226 | atomic64_dec(&pool->pages_nr); | ||
4227 | return; | ||
4228 | } | ||
4229 | - if (test_bit(UNDER_RECLAIM, &page->private)) { | ||
4230 | + if (test_bit(PAGE_CLAIMED, &page->private)) { | ||
4231 | z3fold_page_unlock(zhdr); | ||
4232 | return; | ||
4233 | } | ||
4234 | @@ -836,20 +848,30 @@ static int z3fold_reclaim_page(struct z3fold_pool *pool, unsigned int retries) | ||
4235 | } | ||
4236 | list_for_each_prev(pos, &pool->lru) { | ||
4237 | page = list_entry(pos, struct page, lru); | ||
4238 | + | ||
4239 | + /* this bit could have been set by free, in which case | ||
4240 | + * we pass over to the next page in the pool. | ||
4241 | + */ | ||
4242 | + if (test_and_set_bit(PAGE_CLAIMED, &page->private)) | ||
4243 | + continue; | ||
4244 | + | ||
4245 | + zhdr = page_address(page); | ||
4246 | if (test_bit(PAGE_HEADLESS, &page->private)) | ||
4247 | - /* candidate found */ | ||
4248 | break; | ||
4249 | |||
4250 | - zhdr = page_address(page); | ||
4251 | - if (!z3fold_page_trylock(zhdr)) | ||
4252 | + if (!z3fold_page_trylock(zhdr)) { | ||
4253 | + zhdr = NULL; | ||
4254 | continue; /* can't evict at this point */ | ||
4255 | + } | ||
4256 | kref_get(&zhdr->refcount); | ||
4257 | list_del_init(&zhdr->buddy); | ||
4258 | zhdr->cpu = -1; | ||
4259 | - set_bit(UNDER_RECLAIM, &page->private); | ||
4260 | break; | ||
4261 | } | ||
4262 | |||
4263 | + if (!zhdr) | ||
4264 | + break; | ||
4265 | + | ||
4266 | list_del_init(&page->lru); | ||
4267 | spin_unlock(&pool->lock); | ||
4268 | |||
4269 | @@ -898,6 +920,7 @@ next: | ||
4270 | if (test_bit(PAGE_HEADLESS, &page->private)) { | ||
4271 | if (ret == 0) { | ||
4272 | free_z3fold_page(page); | ||
4273 | + atomic64_dec(&pool->pages_nr); | ||
4274 | return 0; | ||
4275 | } | ||
4276 | spin_lock(&pool->lock); | ||
4277 | @@ -905,7 +928,7 @@ next: | ||
4278 | spin_unlock(&pool->lock); | ||
4279 | } else { | ||
4280 | z3fold_page_lock(zhdr); | ||
4281 | - clear_bit(UNDER_RECLAIM, &page->private); | ||
4282 | + clear_bit(PAGE_CLAIMED, &page->private); | ||
4283 | if (kref_put(&zhdr->refcount, | ||
4284 | release_z3fold_page_locked)) { | ||
4285 | atomic64_dec(&pool->pages_nr); | ||
4286 | @@ -964,7 +987,7 @@ static void *z3fold_map(struct z3fold_pool *pool, unsigned long handle) | ||
4287 | set_bit(MIDDLE_CHUNK_MAPPED, &page->private); | ||
4288 | break; | ||
4289 | case LAST: | ||
4290 | - addr += PAGE_SIZE - (zhdr->last_chunks << CHUNK_SHIFT); | ||
4291 | + addr += PAGE_SIZE - (handle_to_chunks(handle) << CHUNK_SHIFT); | ||
4292 | break; | ||
4293 | default: | ||
4294 | pr_err("unknown buddy id %d\n", buddy); | ||
4295 | diff --git a/net/can/raw.c b/net/can/raw.c | ||
4296 | index 1051eee82581..3aab7664933f 100644 | ||
4297 | --- a/net/can/raw.c | ||
4298 | +++ b/net/can/raw.c | ||
4299 | @@ -745,18 +745,19 @@ static int raw_sendmsg(struct socket *sock, struct msghdr *msg, size_t size) | ||
4300 | } else | ||
4301 | ifindex = ro->ifindex; | ||
4302 | |||
4303 | - if (ro->fd_frames) { | ||
4304 | + dev = dev_get_by_index(sock_net(sk), ifindex); | ||
4305 | + if (!dev) | ||
4306 | + return -ENXIO; | ||
4307 | + | ||
4308 | + err = -EINVAL; | ||
4309 | + if (ro->fd_frames && dev->mtu == CANFD_MTU) { | ||
4310 | if (unlikely(size != CANFD_MTU && size != CAN_MTU)) | ||
4311 | - return -EINVAL; | ||
4312 | + goto put_dev; | ||
4313 | } else { | ||
4314 | if (unlikely(size != CAN_MTU)) | ||
4315 | - return -EINVAL; | ||
4316 | + goto put_dev; | ||
4317 | } | ||
4318 | |||
4319 | - dev = dev_get_by_index(sock_net(sk), ifindex); | ||
4320 | - if (!dev) | ||
4321 | - return -ENXIO; | ||
4322 | - | ||
4323 | skb = sock_alloc_send_skb(sk, size + sizeof(struct can_skb_priv), | ||
4324 | msg->msg_flags & MSG_DONTWAIT, &err); | ||
4325 | if (!skb) | ||
4326 | diff --git a/net/core/sock.c b/net/core/sock.c | ||
4327 | index 3730eb855095..748765e35423 100644 | ||
4328 | --- a/net/core/sock.c | ||
4329 | +++ b/net/core/sock.c | ||
4330 | @@ -2317,7 +2317,7 @@ static void __lock_sock(struct sock *sk) | ||
4331 | finish_wait(&sk->sk_lock.wq, &wait); | ||
4332 | } | ||
4333 | |||
4334 | -static void __release_sock(struct sock *sk) | ||
4335 | +void __release_sock(struct sock *sk) | ||
4336 | __releases(&sk->sk_lock.slock) | ||
4337 | __acquires(&sk->sk_lock.slock) | ||
4338 | { | ||
4339 | diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c | ||
4340 | index bbd07736fb0f..a32a0f4cc138 100644 | ||
4341 | --- a/net/ipv4/tcp.c | ||
4342 | +++ b/net/ipv4/tcp.c | ||
4343 | @@ -2403,16 +2403,10 @@ adjudge_to_death: | ||
4344 | sock_hold(sk); | ||
4345 | sock_orphan(sk); | ||
4346 | |||
4347 | - /* It is the last release_sock in its life. It will remove backlog. */ | ||
4348 | - release_sock(sk); | ||
4349 | - | ||
4350 | - | ||
4351 | - /* Now socket is owned by kernel and we acquire BH lock | ||
4352 | - * to finish close. No need to check for user refs. | ||
4353 | - */ | ||
4354 | local_bh_disable(); | ||
4355 | bh_lock_sock(sk); | ||
4356 | - WARN_ON(sock_owned_by_user(sk)); | ||
4357 | + /* remove backlog if any, without releasing ownership. */ | ||
4358 | + __release_sock(sk); | ||
4359 | |||
4360 | percpu_counter_inc(sk->sk_prot->orphan_count); | ||
4361 | |||
4362 | @@ -2481,6 +2475,7 @@ adjudge_to_death: | ||
4363 | out: | ||
4364 | bh_unlock_sock(sk); | ||
4365 | local_bh_enable(); | ||
4366 | + release_sock(sk); | ||
4367 | sock_put(sk); | ||
4368 | } | ||
4369 | EXPORT_SYMBOL(tcp_close); | ||
4370 | diff --git a/net/llc/af_llc.c b/net/llc/af_llc.c | ||
4371 | index 1beeea9549fa..b99e73a7e7e0 100644 | ||
4372 | --- a/net/llc/af_llc.c | ||
4373 | +++ b/net/llc/af_llc.c | ||
4374 | @@ -730,7 +730,6 @@ static int llc_ui_recvmsg(struct socket *sock, struct msghdr *msg, size_t len, | ||
4375 | struct sk_buff *skb = NULL; | ||
4376 | struct sock *sk = sock->sk; | ||
4377 | struct llc_sock *llc = llc_sk(sk); | ||
4378 | - unsigned long cpu_flags; | ||
4379 | size_t copied = 0; | ||
4380 | u32 peek_seq = 0; | ||
4381 | u32 *seq, skb_len; | ||
4382 | @@ -855,9 +854,8 @@ static int llc_ui_recvmsg(struct socket *sock, struct msghdr *msg, size_t len, | ||
4383 | goto copy_uaddr; | ||
4384 | |||
4385 | if (!(flags & MSG_PEEK)) { | ||
4386 | - spin_lock_irqsave(&sk->sk_receive_queue.lock, cpu_flags); | ||
4387 | - sk_eat_skb(sk, skb); | ||
4388 | - spin_unlock_irqrestore(&sk->sk_receive_queue.lock, cpu_flags); | ||
4389 | + skb_unlink(skb, &sk->sk_receive_queue); | ||
4390 | + kfree_skb(skb); | ||
4391 | *seq = 0; | ||
4392 | } | ||
4393 | |||
4394 | @@ -878,9 +876,8 @@ copy_uaddr: | ||
4395 | llc_cmsg_rcv(msg, skb); | ||
4396 | |||
4397 | if (!(flags & MSG_PEEK)) { | ||
4398 | - spin_lock_irqsave(&sk->sk_receive_queue.lock, cpu_flags); | ||
4399 | - sk_eat_skb(sk, skb); | ||
4400 | - spin_unlock_irqrestore(&sk->sk_receive_queue.lock, cpu_flags); | ||
4401 | + skb_unlink(skb, &sk->sk_receive_queue); | ||
4402 | + kfree_skb(skb); | ||
4403 | *seq = 0; | ||
4404 | } | ||
4405 | |||
4406 | diff --git a/net/sctp/associola.c b/net/sctp/associola.c | ||
4407 | index a827a1f562bf..6a28b96e779e 100644 | ||
4408 | --- a/net/sctp/associola.c | ||
4409 | +++ b/net/sctp/associola.c | ||
4410 | @@ -499,8 +499,9 @@ void sctp_assoc_set_primary(struct sctp_association *asoc, | ||
4411 | void sctp_assoc_rm_peer(struct sctp_association *asoc, | ||
4412 | struct sctp_transport *peer) | ||
4413 | { | ||
4414 | - struct list_head *pos; | ||
4415 | - struct sctp_transport *transport; | ||
4416 | + struct sctp_transport *transport; | ||
4417 | + struct list_head *pos; | ||
4418 | + struct sctp_chunk *ch; | ||
4419 | |||
4420 | pr_debug("%s: association:%p addr:%pISpc\n", | ||
4421 | __func__, asoc, &peer->ipaddr.sa); | ||
4422 | @@ -564,7 +565,6 @@ void sctp_assoc_rm_peer(struct sctp_association *asoc, | ||
4423 | */ | ||
4424 | if (!list_empty(&peer->transmitted)) { | ||
4425 | struct sctp_transport *active = asoc->peer.active_path; | ||
4426 | - struct sctp_chunk *ch; | ||
4427 | |||
4428 | /* Reset the transport of each chunk on this list */ | ||
4429 | list_for_each_entry(ch, &peer->transmitted, | ||
4430 | @@ -586,6 +586,10 @@ void sctp_assoc_rm_peer(struct sctp_association *asoc, | ||
4431 | sctp_transport_hold(active); | ||
4432 | } | ||
4433 | |||
4434 | + list_for_each_entry(ch, &asoc->outqueue.out_chunk_list, list) | ||
4435 | + if (ch->transport == peer) | ||
4436 | + ch->transport = NULL; | ||
4437 | + | ||
4438 | asoc->peer.transport_count--; | ||
4439 | |||
4440 | sctp_transport_free(peer); | ||
4441 | diff --git a/net/sunrpc/auth_generic.c b/net/sunrpc/auth_generic.c | ||
4442 | index f1df9837f1ac..1ac08dcbf85d 100644 | ||
4443 | --- a/net/sunrpc/auth_generic.c | ||
4444 | +++ b/net/sunrpc/auth_generic.c | ||
4445 | @@ -281,13 +281,7 @@ static bool generic_key_to_expire(struct rpc_cred *cred) | ||
4446 | { | ||
4447 | struct auth_cred *acred = &container_of(cred, struct generic_cred, | ||
4448 | gc_base)->acred; | ||
4449 | - bool ret; | ||
4450 | - | ||
4451 | - get_rpccred(cred); | ||
4452 | - ret = test_bit(RPC_CRED_KEY_EXPIRE_SOON, &acred->ac_flags); | ||
4453 | - put_rpccred(cred); | ||
4454 | - | ||
4455 | - return ret; | ||
4456 | + return test_bit(RPC_CRED_KEY_EXPIRE_SOON, &acred->ac_flags); | ||
4457 | } | ||
4458 | |||
4459 | static const struct rpc_credops generic_credops = { | ||
4460 | diff --git a/security/selinux/ss/policydb.c b/security/selinux/ss/policydb.c | ||
4461 | index e9394e7adc84..f4eadd3f7350 100644 | ||
4462 | --- a/security/selinux/ss/policydb.c | ||
4463 | +++ b/security/selinux/ss/policydb.c | ||
4464 | @@ -1101,7 +1101,7 @@ static int str_read(char **strp, gfp_t flags, void *fp, u32 len) | ||
4465 | if ((len == 0) || (len == (u32)-1)) | ||
4466 | return -EINVAL; | ||
4467 | |||
4468 | - str = kmalloc(len + 1, flags); | ||
4469 | + str = kmalloc(len + 1, flags | __GFP_NOWARN); | ||
4470 | if (!str) | ||
4471 | return -ENOMEM; | ||
4472 | |||
4473 | diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c | ||
4474 | index f8d4a419f3af..467039b342b5 100644 | ||
4475 | --- a/sound/core/oss/pcm_oss.c | ||
4476 | +++ b/sound/core/oss/pcm_oss.c | ||
4477 | @@ -1062,8 +1062,8 @@ static int snd_pcm_oss_change_params_locked(struct snd_pcm_substream *substream) | ||
4478 | runtime->oss.channels = params_channels(params); | ||
4479 | runtime->oss.rate = params_rate(params); | ||
4480 | |||
4481 | - vfree(runtime->oss.buffer); | ||
4482 | - runtime->oss.buffer = vmalloc(runtime->oss.period_bytes); | ||
4483 | + kvfree(runtime->oss.buffer); | ||
4484 | + runtime->oss.buffer = kvzalloc(runtime->oss.period_bytes, GFP_KERNEL); | ||
4485 | if (!runtime->oss.buffer) { | ||
4486 | err = -ENOMEM; | ||
4487 | goto failure; | ||
4488 | @@ -2328,7 +2328,7 @@ static void snd_pcm_oss_release_substream(struct snd_pcm_substream *substream) | ||
4489 | { | ||
4490 | struct snd_pcm_runtime *runtime; | ||
4491 | runtime = substream->runtime; | ||
4492 | - vfree(runtime->oss.buffer); | ||
4493 | + kvfree(runtime->oss.buffer); | ||
4494 | runtime->oss.buffer = NULL; | ||
4495 | #ifdef CONFIG_SND_PCM_OSS_PLUGINS | ||
4496 | snd_pcm_oss_plugin_clear(substream); | ||
4497 | diff --git a/sound/core/oss/pcm_plugin.c b/sound/core/oss/pcm_plugin.c | ||
4498 | index 0391cb1a4f19..71571d992159 100644 | ||
4499 | --- a/sound/core/oss/pcm_plugin.c | ||
4500 | +++ b/sound/core/oss/pcm_plugin.c | ||
4501 | @@ -66,8 +66,8 @@ static int snd_pcm_plugin_alloc(struct snd_pcm_plugin *plugin, snd_pcm_uframes_t | ||
4502 | return -ENXIO; | ||
4503 | size /= 8; | ||
4504 | if (plugin->buf_frames < frames) { | ||
4505 | - vfree(plugin->buf); | ||
4506 | - plugin->buf = vmalloc(size); | ||
4507 | + kvfree(plugin->buf); | ||
4508 | + plugin->buf = kvzalloc(size, GFP_KERNEL); | ||
4509 | plugin->buf_frames = frames; | ||
4510 | } | ||
4511 | if (!plugin->buf) { | ||
4512 | @@ -191,7 +191,7 @@ int snd_pcm_plugin_free(struct snd_pcm_plugin *plugin) | ||
4513 | if (plugin->private_free) | ||
4514 | plugin->private_free(plugin); | ||
4515 | kfree(plugin->buf_channels); | ||
4516 | - vfree(plugin->buf); | ||
4517 | + kvfree(plugin->buf); | ||
4518 | kfree(plugin); | ||
4519 | return 0; | ||
4520 | } | ||
4521 | diff --git a/tools/power/cpupower/bench/Makefile b/tools/power/cpupower/bench/Makefile | ||
4522 | index d79ab161cc75..f68b4bc55273 100644 | ||
4523 | --- a/tools/power/cpupower/bench/Makefile | ||
4524 | +++ b/tools/power/cpupower/bench/Makefile | ||
4525 | @@ -9,7 +9,7 @@ endif | ||
4526 | ifeq ($(strip $(STATIC)),true) | ||
4527 | LIBS = -L../ -L$(OUTPUT) -lm | ||
4528 | OBJS = $(OUTPUT)main.o $(OUTPUT)parse.o $(OUTPUT)system.o $(OUTPUT)benchmark.o \ | ||
4529 | - $(OUTPUT)../lib/cpufreq.o $(OUTPUT)../lib/sysfs.o | ||
4530 | + $(OUTPUT)../lib/cpufreq.o $(OUTPUT)../lib/cpupower.o | ||
4531 | else | ||
4532 | LIBS = -L../ -L$(OUTPUT) -lm -lcpupower | ||
4533 | OBJS = $(OUTPUT)main.o $(OUTPUT)parse.o $(OUTPUT)system.o $(OUTPUT)benchmark.o | ||
4534 | diff --git a/tools/power/cpupower/lib/cpufreq.c b/tools/power/cpupower/lib/cpufreq.c | ||
4535 | index 1b993fe1ce23..0c0f3e3f0d80 100644 | ||
4536 | --- a/tools/power/cpupower/lib/cpufreq.c | ||
4537 | +++ b/tools/power/cpupower/lib/cpufreq.c | ||
4538 | @@ -28,7 +28,7 @@ static unsigned int sysfs_cpufreq_read_file(unsigned int cpu, const char *fname, | ||
4539 | |||
4540 | snprintf(path, sizeof(path), PATH_TO_CPU "cpu%u/cpufreq/%s", | ||
4541 | cpu, fname); | ||
4542 | - return sysfs_read_file(path, buf, buflen); | ||
4543 | + return cpupower_read_sysfs(path, buf, buflen); | ||
4544 | } | ||
4545 | |||
4546 | /* helper function to write a new value to a /sys file */ | ||
4547 | diff --git a/tools/power/cpupower/lib/cpuidle.c b/tools/power/cpupower/lib/cpuidle.c | ||
4548 | index 9bd4c7655fdb..852d25462388 100644 | ||
4549 | --- a/tools/power/cpupower/lib/cpuidle.c | ||
4550 | +++ b/tools/power/cpupower/lib/cpuidle.c | ||
4551 | @@ -319,7 +319,7 @@ static unsigned int sysfs_cpuidle_read_file(const char *fname, char *buf, | ||
4552 | |||
4553 | snprintf(path, sizeof(path), PATH_TO_CPU "cpuidle/%s", fname); | ||
4554 | |||
4555 | - return sysfs_read_file(path, buf, buflen); | ||
4556 | + return cpupower_read_sysfs(path, buf, buflen); | ||
4557 | } | ||
4558 | |||
4559 | |||
4560 | diff --git a/tools/power/cpupower/lib/cpupower.c b/tools/power/cpupower/lib/cpupower.c | ||
4561 | index 9c395ec924de..9711d628b0f4 100644 | ||
4562 | --- a/tools/power/cpupower/lib/cpupower.c | ||
4563 | +++ b/tools/power/cpupower/lib/cpupower.c | ||
4564 | @@ -15,7 +15,7 @@ | ||
4565 | #include "cpupower.h" | ||
4566 | #include "cpupower_intern.h" | ||
4567 | |||
4568 | -unsigned int sysfs_read_file(const char *path, char *buf, size_t buflen) | ||
4569 | +unsigned int cpupower_read_sysfs(const char *path, char *buf, size_t buflen) | ||
4570 | { | ||
4571 | int fd; | ||
4572 | ssize_t numread; | ||
4573 | @@ -95,7 +95,7 @@ static int sysfs_topology_read_file(unsigned int cpu, const char *fname, int *re | ||
4574 | |||
4575 | snprintf(path, sizeof(path), PATH_TO_CPU "cpu%u/topology/%s", | ||
4576 | cpu, fname); | ||
4577 | - if (sysfs_read_file(path, linebuf, MAX_LINE_LEN) == 0) | ||
4578 | + if (cpupower_read_sysfs(path, linebuf, MAX_LINE_LEN) == 0) | ||
4579 | return -1; | ||
4580 | *result = strtol(linebuf, &endp, 0); | ||
4581 | if (endp == linebuf || errno == ERANGE) | ||
4582 | diff --git a/tools/power/cpupower/lib/cpupower_intern.h b/tools/power/cpupower/lib/cpupower_intern.h | ||
4583 | index 92affdfbe417..4887c76d23f8 100644 | ||
4584 | --- a/tools/power/cpupower/lib/cpupower_intern.h | ||
4585 | +++ b/tools/power/cpupower/lib/cpupower_intern.h | ||
4586 | @@ -3,4 +3,4 @@ | ||
4587 | #define MAX_LINE_LEN 4096 | ||
4588 | #define SYSFS_PATH_MAX 255 | ||
4589 | |||
4590 | -unsigned int sysfs_read_file(const char *path, char *buf, size_t buflen); | ||
4591 | +unsigned int cpupower_read_sysfs(const char *path, char *buf, size_t buflen); | ||
4592 | diff --git a/tools/testing/nvdimm/test/nfit.c b/tools/testing/nvdimm/test/nfit.c | ||
4593 | index cffc2c5a778d..ec50d2a95076 100644 | ||
4594 | --- a/tools/testing/nvdimm/test/nfit.c | ||
4595 | +++ b/tools/testing/nvdimm/test/nfit.c | ||
4596 | @@ -139,8 +139,8 @@ static u32 handle[] = { | ||
4597 | [6] = NFIT_DIMM_HANDLE(1, 0, 0, 0, 1), | ||
4598 | }; | ||
4599 | |||
4600 | -static unsigned long dimm_fail_cmd_flags[NUM_DCR]; | ||
4601 | -static int dimm_fail_cmd_code[NUM_DCR]; | ||
4602 | +static unsigned long dimm_fail_cmd_flags[ARRAY_SIZE(handle)]; | ||
4603 | +static int dimm_fail_cmd_code[ARRAY_SIZE(handle)]; | ||
4604 | |||
4605 | static const struct nd_intel_smart smart_def = { | ||
4606 | .flags = ND_INTEL_SMART_HEALTH_VALID | ||
4607 | @@ -203,7 +203,7 @@ struct nfit_test { | ||
4608 | unsigned long deadline; | ||
4609 | spinlock_t lock; | ||
4610 | } ars_state; | ||
4611 | - struct device *dimm_dev[NUM_DCR]; | ||
4612 | + struct device *dimm_dev[ARRAY_SIZE(handle)]; | ||
4613 | struct nd_intel_smart *smart; | ||
4614 | struct nd_intel_smart_threshold *smart_threshold; | ||
4615 | struct badrange badrange; | ||
4616 | @@ -2678,7 +2678,7 @@ static int nfit_test_probe(struct platform_device *pdev) | ||
4617 | u32 nfit_handle = __to_nfit_memdev(nfit_mem)->device_handle; | ||
4618 | int i; | ||
4619 | |||
4620 | - for (i = 0; i < NUM_DCR; i++) | ||
4621 | + for (i = 0; i < ARRAY_SIZE(handle); i++) | ||
4622 | if (nfit_handle == handle[i]) | ||
4623 | dev_set_drvdata(nfit_test->dimm_dev[i], | ||
4624 | nfit_mem); |