Magellan Linux

Contents of /trunk/kernel-alx/patches-5.4/0175-5.4.76-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3637 - (show annotations) (download)
Mon Oct 24 12:40:44 2022 UTC (18 months ago) by niro
File size: 120572 byte(s)
-add missing
1 diff --git a/Documentation/asm-annotations.rst b/Documentation/asm-annotations.rst
2 new file mode 100644
3 index 0000000000000..29ccd6e61fe5c
4 --- /dev/null
5 +++ b/Documentation/asm-annotations.rst
6 @@ -0,0 +1,216 @@
7 +Assembler Annotations
8 +=====================
9 +
10 +Copyright (c) 2017-2019 Jiri Slaby
11 +
12 +This document describes the new macros for annotation of data and code in
13 +assembly. In particular, it contains information about ``SYM_FUNC_START``,
14 +``SYM_FUNC_END``, ``SYM_CODE_START``, and similar.
15 +
16 +Rationale
17 +---------
18 +Some code like entries, trampolines, or boot code needs to be written in
19 +assembly. The same as in C, such code is grouped into functions and
20 +accompanied with data. Standard assemblers do not force users into precisely
21 +marking these pieces as code, data, or even specifying their length.
22 +Nevertheless, assemblers provide developers with such annotations to aid
23 +debuggers throughout assembly. On top of that, developers also want to mark
24 +some functions as *global* in order to be visible outside of their translation
25 +units.
26 +
27 +Over time, the Linux kernel has adopted macros from various projects (like
28 +``binutils``) to facilitate such annotations. So for historic reasons,
29 +developers have been using ``ENTRY``, ``END``, ``ENDPROC``, and other
30 +annotations in assembly. Due to the lack of their documentation, the macros
31 +are used in rather wrong contexts at some locations. Clearly, ``ENTRY`` was
32 +intended to denote the beginning of global symbols (be it data or code).
33 +``END`` used to mark the end of data or end of special functions with
34 +*non-standard* calling convention. In contrast, ``ENDPROC`` should annotate
35 +only ends of *standard* functions.
36 +
37 +When these macros are used correctly, they help assemblers generate a nice
38 +object with both sizes and types set correctly. For example, the result of
39 +``arch/x86/lib/putuser.S``::
40 +
41 + Num: Value Size Type Bind Vis Ndx Name
42 + 25: 0000000000000000 33 FUNC GLOBAL DEFAULT 1 __put_user_1
43 + 29: 0000000000000030 37 FUNC GLOBAL DEFAULT 1 __put_user_2
44 + 32: 0000000000000060 36 FUNC GLOBAL DEFAULT 1 __put_user_4
45 + 35: 0000000000000090 37 FUNC GLOBAL DEFAULT 1 __put_user_8
46 +
47 +This is not only important for debugging purposes. When there are properly
48 +annotated objects like this, tools can be run on them to generate more useful
49 +information. In particular, on properly annotated objects, ``objtool`` can be
50 +run to check and fix the object if needed. Currently, ``objtool`` can report
51 +missing frame pointer setup/destruction in functions. It can also
52 +automatically generate annotations for :doc:`ORC unwinder <x86/orc-unwinder>`
53 +for most code. Both of these are especially important to support reliable
54 +stack traces which are in turn necessary for :doc:`Kernel live patching
55 +<livepatch/livepatch>`.
56 +
57 +Caveat and Discussion
58 +---------------------
59 +As one might realize, there were only three macros previously. That is indeed
60 +insufficient to cover all the combinations of cases:
61 +
62 +* standard/non-standard function
63 +* code/data
64 +* global/local symbol
65 +
66 +There was a discussion_ and instead of extending the current ``ENTRY/END*``
67 +macros, it was decided that brand new macros should be introduced instead::
68 +
69 + So how about using macro names that actually show the purpose, instead
70 + of importing all the crappy, historic, essentially randomly chosen
71 + debug symbol macro names from the binutils and older kernels?
72 +
73 +.. _discussion: https://lkml.kernel.org/r/20170217104757.28588-1-jslaby@suse.cz
74 +
75 +Macros Description
76 +------------------
77 +
78 +The new macros are prefixed with the ``SYM_`` prefix and can be divided into
79 +three main groups:
80 +
81 +1. ``SYM_FUNC_*`` -- to annotate C-like functions. This means functions with
82 + standard C calling conventions, i.e. the stack contains a return address at
83 + the predefined place and a return from the function can happen in a
84 + standard way. When frame pointers are enabled, save/restore of frame
85 + pointer shall happen at the start/end of a function, respectively, too.
86 +
87 + Checking tools like ``objtool`` should ensure such marked functions conform
88 + to these rules. The tools can also easily annotate these functions with
89 + debugging information (like *ORC data*) automatically.
90 +
91 +2. ``SYM_CODE_*`` -- special functions called with special stack. Be it
92 + interrupt handlers with special stack content, trampolines, or startup
93 + functions.
94 +
95 + Checking tools mostly ignore checking of these functions. But some debug
96 + information still can be generated automatically. For correct debug data,
97 + this code needs hints like ``UNWIND_HINT_REGS`` provided by developers.
98 +
99 +3. ``SYM_DATA*`` -- obviously data belonging to ``.data`` sections and not to
100 + ``.text``. Data do not contain instructions, so they have to be treated
101 + specially by the tools: they should not treat the bytes as instructions,
102 + nor assign any debug information to them.
103 +
104 +Instruction Macros
105 +~~~~~~~~~~~~~~~~~~
106 +This section covers ``SYM_FUNC_*`` and ``SYM_CODE_*`` enumerated above.
107 +
108 +* ``SYM_FUNC_START`` and ``SYM_FUNC_START_LOCAL`` are supposed to be **the
109 + most frequent markings**. They are used for functions with standard calling
110 + conventions -- global and local. Like in C, they both align the functions to
111 + architecture specific ``__ALIGN`` bytes. There are also ``_NOALIGN`` variants
112 + for special cases where developers do not want this implicit alignment.
113 +
114 + ``SYM_FUNC_START_WEAK`` and ``SYM_FUNC_START_WEAK_NOALIGN`` markings are
115 + also offered as an assembler counterpart to the *weak* attribute known from
116 + C.
117 +
118 + All of these **shall** be coupled with ``SYM_FUNC_END``. First, it marks
119 + the sequence of instructions as a function and computes its size to the
120 + generated object file. Second, it also eases checking and processing such
121 + object files as the tools can trivially find exact function boundaries.
122 +
123 + So in most cases, developers should write something like in the following
124 + example, having some asm instructions in between the macros, of course::
125 +
126 + SYM_FUNC_START(function_hook)
127 + ... asm insns ...
128 + SYM_FUNC_END(function_hook)
129 +
130 + In fact, this kind of annotation corresponds to the now deprecated ``ENTRY``
131 + and ``ENDPROC`` macros.
132 +
133 +* ``SYM_FUNC_START_ALIAS`` and ``SYM_FUNC_START_LOCAL_ALIAS`` serve for those
134 + who decided to have two or more names for one function. The typical use is::
135 +
136 + SYM_FUNC_START_ALIAS(__memset)
137 + SYM_FUNC_START(memset)
138 + ... asm insns ...
139 + SYM_FUNC_END(memset)
140 + SYM_FUNC_END_ALIAS(__memset)
141 +
142 + In this example, one can call ``__memset`` or ``memset`` with the same
143 + result, except the debug information for the instructions is generated to
144 + the object file only once -- for the non-``ALIAS`` case.
145 +
146 +* ``SYM_CODE_START`` and ``SYM_CODE_START_LOCAL`` should be used only in
147 + special cases -- if you know what you are doing. This is used exclusively
148 + for interrupt handlers and similar where the calling convention is not the C
149 + one. ``_NOALIGN`` variants exist too. The use is the same as for the ``FUNC``
150 + category above::
151 +
152 + SYM_CODE_START_LOCAL(bad_put_user)
153 + ... asm insns ...
154 + SYM_CODE_END(bad_put_user)
155 +
156 + Again, every ``SYM_CODE_START*`` **shall** be coupled by ``SYM_CODE_END``.
157 +
158 + To some extent, this category corresponds to deprecated ``ENTRY`` and
159 + ``END``. Except ``END`` had several other meanings too.
160 +
161 +* ``SYM_INNER_LABEL*`` is used to denote a label inside some
162 + ``SYM_{CODE,FUNC}_START`` and ``SYM_{CODE,FUNC}_END``. They are very similar
163 + to C labels, except they can be made global. An example of use::
164 +
165 + SYM_CODE_START(ftrace_caller)
166 + /* save_mcount_regs fills in first two parameters */
167 + ...
168 +
169 + SYM_INNER_LABEL(ftrace_caller_op_ptr, SYM_L_GLOBAL)
170 + /* Load the ftrace_ops into the 3rd parameter */
171 + ...
172 +
173 + SYM_INNER_LABEL(ftrace_call, SYM_L_GLOBAL)
174 + call ftrace_stub
175 + ...
176 + retq
177 + SYM_CODE_END(ftrace_caller)
178 +
179 +Data Macros
180 +~~~~~~~~~~~
181 +Similar to instructions, there is a couple of macros to describe data in the
182 +assembly.
183 +
184 +* ``SYM_DATA_START`` and ``SYM_DATA_START_LOCAL`` mark the start of some data
185 + and shall be used in conjunction with either ``SYM_DATA_END``, or
186 + ``SYM_DATA_END_LABEL``. The latter adds also a label to the end, so that
187 + people can use ``lstack`` and (local) ``lstack_end`` in the following
188 + example::
189 +
190 + SYM_DATA_START_LOCAL(lstack)
191 + .skip 4096
192 + SYM_DATA_END_LABEL(lstack, SYM_L_LOCAL, lstack_end)
193 +
194 +* ``SYM_DATA`` and ``SYM_DATA_LOCAL`` are variants for simple, mostly one-line
195 + data::
196 +
197 + SYM_DATA(HEAP, .long rm_heap)
198 + SYM_DATA(heap_end, .long rm_stack)
199 +
200 + In the end, they expand to ``SYM_DATA_START`` with ``SYM_DATA_END``
201 + internally.
202 +
203 +Support Macros
204 +~~~~~~~~~~~~~~
205 +All the above reduce themselves to some invocation of ``SYM_START``,
206 +``SYM_END``, or ``SYM_ENTRY`` at last. Normally, developers should avoid using
207 +these.
208 +
209 +Further, in the above examples, one could see ``SYM_L_LOCAL``. There are also
210 +``SYM_L_GLOBAL`` and ``SYM_L_WEAK``. All are intended to denote linkage of a
211 +symbol marked by them. They are used either in ``_LABEL`` variants of the
212 +earlier macros, or in ``SYM_START``.
213 +
214 +
215 +Overriding Macros
216 +~~~~~~~~~~~~~~~~~
217 +Architecture can also override any of the macros in their own
218 +``asm/linkage.h``, including macros specifying the type of a symbol
219 +(``SYM_T_FUNC``, ``SYM_T_OBJECT``, and ``SYM_T_NONE``). As every macro
220 +described in this file is surrounded by ``#ifdef`` + ``#endif``, it is enough
221 +to define the macros differently in the aforementioned architecture-dependent
222 +header.
223 diff --git a/Documentation/index.rst b/Documentation/index.rst
224 index b843e313d2f2e..2ceab197246f7 100644
225 --- a/Documentation/index.rst
226 +++ b/Documentation/index.rst
227 @@ -135,6 +135,14 @@ needed).
228 mic/index
229 scheduler/index
230
231 +Architecture-agnostic documentation
232 +-----------------------------------
233 +
234 +.. toctree::
235 + :maxdepth: 2
236 +
237 + asm-annotations
238 +
239 Architecture-specific documentation
240 -----------------------------------
241
242 diff --git a/Makefile b/Makefile
243 index d38d0cab8e9aa..842ed84118107 100644
244 --- a/Makefile
245 +++ b/Makefile
246 @@ -1,7 +1,7 @@
247 # SPDX-License-Identifier: GPL-2.0
248 VERSION = 5
249 PATCHLEVEL = 4
250 -SUBLEVEL = 75
251 +SUBLEVEL = 76
252 EXTRAVERSION =
253 NAME = Kleptomaniac Octopus
254
255 diff --git a/arch/arc/kernel/stacktrace.c b/arch/arc/kernel/stacktrace.c
256 index 1e440bbfa876b..fc65d2921e3bd 100644
257 --- a/arch/arc/kernel/stacktrace.c
258 +++ b/arch/arc/kernel/stacktrace.c
259 @@ -112,7 +112,7 @@ arc_unwind_core(struct task_struct *tsk, struct pt_regs *regs,
260 int (*consumer_fn) (unsigned int, void *), void *arg)
261 {
262 #ifdef CONFIG_ARC_DW2_UNWIND
263 - int ret = 0;
264 + int ret = 0, cnt = 0;
265 unsigned int address;
266 struct unwind_frame_info frame_info;
267
268 @@ -132,6 +132,11 @@ arc_unwind_core(struct task_struct *tsk, struct pt_regs *regs,
269 break;
270
271 frame_info.regs.r63 = frame_info.regs.r31;
272 +
273 + if (cnt++ > 128) {
274 + printk("unwinder looping too long, aborting !\n");
275 + return 0;
276 + }
277 }
278
279 return address; /* return the last address it saw */
280 diff --git a/arch/arm/boot/dts/sun4i-a10.dtsi b/arch/arm/boot/dts/sun4i-a10.dtsi
281 index e0a9b371c248f..2265ca24c0c71 100644
282 --- a/arch/arm/boot/dts/sun4i-a10.dtsi
283 +++ b/arch/arm/boot/dts/sun4i-a10.dtsi
284 @@ -143,7 +143,7 @@
285 trips {
286 cpu_alert0: cpu-alert0 {
287 /* milliCelsius */
288 - temperature = <850000>;
289 + temperature = <85000>;
290 hysteresis = <2000>;
291 type = "passive";
292 };
293 diff --git a/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi
294 index 1234bc7974294..354ef2f3eac67 100644
295 --- a/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi
296 +++ b/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi
297 @@ -167,6 +167,8 @@
298 hwrng: rng@218 {
299 compatible = "amlogic,meson-rng";
300 reg = <0x0 0x218 0x0 0x4>;
301 + clocks = <&clkc CLKID_RNG0>;
302 + clock-names = "core";
303 };
304 };
305
306 diff --git a/arch/arm64/boot/dts/marvell/armada-3720-espressobin.dts b/arch/arm64/boot/dts/marvell/armada-3720-espressobin.dts
307 index 05dc58c13fa41..6226e7e809807 100644
308 --- a/arch/arm64/boot/dts/marvell/armada-3720-espressobin.dts
309 +++ b/arch/arm64/boot/dts/marvell/armada-3720-espressobin.dts
310 @@ -21,6 +21,10 @@
311
312 aliases {
313 ethernet0 = &eth0;
314 + /* for dsa slave device */
315 + ethernet1 = &switch0port1;
316 + ethernet2 = &switch0port2;
317 + ethernet3 = &switch0port3;
318 serial0 = &uart0;
319 serial1 = &uart1;
320 };
321 @@ -147,7 +151,7 @@
322 #address-cells = <1>;
323 #size-cells = <0>;
324
325 - port@0 {
326 + switch0port0: port@0 {
327 reg = <0>;
328 label = "cpu";
329 ethernet = <&eth0>;
330 @@ -158,19 +162,19 @@
331 };
332 };
333
334 - port@1 {
335 + switch0port1: port@1 {
336 reg = <1>;
337 label = "wan";
338 phy-handle = <&switch0phy0>;
339 };
340
341 - port@2 {
342 + switch0port2: port@2 {
343 reg = <2>;
344 label = "lan0";
345 phy-handle = <&switch0phy1>;
346 };
347
348 - port@3 {
349 + switch0port3: port@3 {
350 reg = <3>;
351 label = "lan1";
352 phy-handle = <&switch0phy2>;
353 diff --git a/arch/arm64/include/asm/assembler.h b/arch/arm64/include/asm/assembler.h
354 index b8cf7c85ffa2a..4a4258f17c868 100644
355 --- a/arch/arm64/include/asm/assembler.h
356 +++ b/arch/arm64/include/asm/assembler.h
357 @@ -462,6 +462,7 @@ USER(\label, ic ivau, \tmp2) // invalidate I line PoU
358 .endm
359
360 /*
361 + * Deprecated! Use SYM_FUNC_{START,START_WEAK,END}_PI instead.
362 * Annotate a function as position independent, i.e., safe to be called before
363 * the kernel virtual mapping is activated.
364 */
365 diff --git a/arch/arm64/include/asm/linkage.h b/arch/arm64/include/asm/linkage.h
366 index 1b266292f0bee..ebee3113a62ff 100644
367 --- a/arch/arm64/include/asm/linkage.h
368 +++ b/arch/arm64/include/asm/linkage.h
369 @@ -4,4 +4,20 @@
370 #define __ALIGN .align 2
371 #define __ALIGN_STR ".align 2"
372
373 +/*
374 + * Annotate a function as position independent, i.e., safe to be called before
375 + * the kernel virtual mapping is activated.
376 + */
377 +#define SYM_FUNC_START_PI(x) \
378 + SYM_FUNC_START_ALIAS(__pi_##x); \
379 + SYM_FUNC_START(x)
380 +
381 +#define SYM_FUNC_START_WEAK_PI(x) \
382 + SYM_FUNC_START_ALIAS(__pi_##x); \
383 + SYM_FUNC_START_WEAK(x)
384 +
385 +#define SYM_FUNC_END_PI(x) \
386 + SYM_FUNC_END(x); \
387 + SYM_FUNC_END_ALIAS(__pi_##x)
388 +
389 #endif
390 diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c
391 index 102dc3e7f2e1d..426409e0d0713 100644
392 --- a/arch/arm64/kernel/smp.c
393 +++ b/arch/arm64/kernel/smp.c
394 @@ -215,6 +215,7 @@ asmlinkage notrace void secondary_start_kernel(void)
395 if (system_uses_irq_prio_masking())
396 init_gic_priority_masking();
397
398 + rcu_cpu_starting(cpu);
399 preempt_disable();
400 trace_hardirqs_off();
401
402 diff --git a/arch/arm64/lib/clear_page.S b/arch/arm64/lib/clear_page.S
403 index 78a9ef66288ae..073acbf02a7c8 100644
404 --- a/arch/arm64/lib/clear_page.S
405 +++ b/arch/arm64/lib/clear_page.S
406 @@ -14,7 +14,7 @@
407 * Parameters:
408 * x0 - dest
409 */
410 -ENTRY(clear_page)
411 +SYM_FUNC_START(clear_page)
412 mrs x1, dczid_el0
413 and w1, w1, #0xf
414 mov x2, #4
415 @@ -25,5 +25,5 @@ ENTRY(clear_page)
416 tst x0, #(PAGE_SIZE - 1)
417 b.ne 1b
418 ret
419 -ENDPROC(clear_page)
420 +SYM_FUNC_END(clear_page)
421 EXPORT_SYMBOL(clear_page)
422 diff --git a/arch/arm64/lib/clear_user.S b/arch/arm64/lib/clear_user.S
423 index aeafc03e961a8..48a3a26eff663 100644
424 --- a/arch/arm64/lib/clear_user.S
425 +++ b/arch/arm64/lib/clear_user.S
426 @@ -19,7 +19,7 @@
427 *
428 * Alignment fixed up by hardware.
429 */
430 -ENTRY(__arch_clear_user)
431 +SYM_FUNC_START(__arch_clear_user)
432 mov x2, x1 // save the size for fixup return
433 subs x1, x1, #8
434 b.mi 2f
435 @@ -40,7 +40,7 @@ uao_user_alternative 9f, strh, sttrh, wzr, x0, 2
436 uao_user_alternative 9f, strb, sttrb, wzr, x0, 0
437 5: mov x0, #0
438 ret
439 -ENDPROC(__arch_clear_user)
440 +SYM_FUNC_END(__arch_clear_user)
441 EXPORT_SYMBOL(__arch_clear_user)
442
443 .section .fixup,"ax"
444 diff --git a/arch/arm64/lib/copy_from_user.S b/arch/arm64/lib/copy_from_user.S
445 index ebb3c06cbb5d8..8e25e89ad01fd 100644
446 --- a/arch/arm64/lib/copy_from_user.S
447 +++ b/arch/arm64/lib/copy_from_user.S
448 @@ -53,12 +53,12 @@
449 .endm
450
451 end .req x5
452 -ENTRY(__arch_copy_from_user)
453 +SYM_FUNC_START(__arch_copy_from_user)
454 add end, x0, x2
455 #include "copy_template.S"
456 mov x0, #0 // Nothing to copy
457 ret
458 -ENDPROC(__arch_copy_from_user)
459 +SYM_FUNC_END(__arch_copy_from_user)
460 EXPORT_SYMBOL(__arch_copy_from_user)
461
462 .section .fixup,"ax"
463 diff --git a/arch/arm64/lib/copy_in_user.S b/arch/arm64/lib/copy_in_user.S
464 index 3d8153a1ebce9..667139013ed17 100644
465 --- a/arch/arm64/lib/copy_in_user.S
466 +++ b/arch/arm64/lib/copy_in_user.S
467 @@ -55,12 +55,12 @@
468
469 end .req x5
470
471 -ENTRY(__arch_copy_in_user)
472 +SYM_FUNC_START(__arch_copy_in_user)
473 add end, x0, x2
474 #include "copy_template.S"
475 mov x0, #0
476 ret
477 -ENDPROC(__arch_copy_in_user)
478 +SYM_FUNC_END(__arch_copy_in_user)
479 EXPORT_SYMBOL(__arch_copy_in_user)
480
481 .section .fixup,"ax"
482 diff --git a/arch/arm64/lib/copy_page.S b/arch/arm64/lib/copy_page.S
483 index bbb8562396afe..e125a84eb4000 100644
484 --- a/arch/arm64/lib/copy_page.S
485 +++ b/arch/arm64/lib/copy_page.S
486 @@ -17,7 +17,7 @@
487 * x0 - dest
488 * x1 - src
489 */
490 -ENTRY(copy_page)
491 +SYM_FUNC_START(copy_page)
492 alternative_if ARM64_HAS_NO_HW_PREFETCH
493 // Prefetch three cache lines ahead.
494 prfm pldl1strm, [x1, #128]
495 @@ -75,5 +75,5 @@ alternative_else_nop_endif
496 stnp x16, x17, [x0, #112]
497
498 ret
499 -ENDPROC(copy_page)
500 +SYM_FUNC_END(copy_page)
501 EXPORT_SYMBOL(copy_page)
502 diff --git a/arch/arm64/lib/copy_to_user.S b/arch/arm64/lib/copy_to_user.S
503 index 357eae2c18ebb..1a104d0089f3a 100644
504 --- a/arch/arm64/lib/copy_to_user.S
505 +++ b/arch/arm64/lib/copy_to_user.S
506 @@ -52,12 +52,12 @@
507 .endm
508
509 end .req x5
510 -ENTRY(__arch_copy_to_user)
511 +SYM_FUNC_START(__arch_copy_to_user)
512 add end, x0, x2
513 #include "copy_template.S"
514 mov x0, #0
515 ret
516 -ENDPROC(__arch_copy_to_user)
517 +SYM_FUNC_END(__arch_copy_to_user)
518 EXPORT_SYMBOL(__arch_copy_to_user)
519
520 .section .fixup,"ax"
521 diff --git a/arch/arm64/lib/crc32.S b/arch/arm64/lib/crc32.S
522 index e6135f16649b1..243e107e98963 100644
523 --- a/arch/arm64/lib/crc32.S
524 +++ b/arch/arm64/lib/crc32.S
525 @@ -85,17 +85,17 @@ CPU_BE( rev16 w3, w3 )
526 .endm
527
528 .align 5
529 -ENTRY(crc32_le)
530 +SYM_FUNC_START(crc32_le)
531 alternative_if_not ARM64_HAS_CRC32
532 b crc32_le_base
533 alternative_else_nop_endif
534 __crc32
535 -ENDPROC(crc32_le)
536 +SYM_FUNC_END(crc32_le)
537
538 .align 5
539 -ENTRY(__crc32c_le)
540 +SYM_FUNC_START(__crc32c_le)
541 alternative_if_not ARM64_HAS_CRC32
542 b __crc32c_le_base
543 alternative_else_nop_endif
544 __crc32 c
545 -ENDPROC(__crc32c_le)
546 +SYM_FUNC_END(__crc32c_le)
547 diff --git a/arch/arm64/lib/memchr.S b/arch/arm64/lib/memchr.S
548 index 48a3ab636e4fb..edf6b970a2774 100644
549 --- a/arch/arm64/lib/memchr.S
550 +++ b/arch/arm64/lib/memchr.S
551 @@ -19,7 +19,7 @@
552 * Returns:
553 * x0 - address of first occurrence of 'c' or 0
554 */
555 -WEAK(memchr)
556 +SYM_FUNC_START_WEAK_PI(memchr)
557 and w1, w1, #0xff
558 1: subs x2, x2, #1
559 b.mi 2f
560 @@ -30,5 +30,5 @@ WEAK(memchr)
561 ret
562 2: mov x0, #0
563 ret
564 -ENDPIPROC(memchr)
565 +SYM_FUNC_END_PI(memchr)
566 EXPORT_SYMBOL_NOKASAN(memchr)
567 diff --git a/arch/arm64/lib/memcmp.S b/arch/arm64/lib/memcmp.S
568 index b297bdaaf5498..c0671e793ea91 100644
569 --- a/arch/arm64/lib/memcmp.S
570 +++ b/arch/arm64/lib/memcmp.S
571 @@ -46,7 +46,7 @@ pos .req x11
572 limit_wd .req x12
573 mask .req x13
574
575 -WEAK(memcmp)
576 +SYM_FUNC_START_WEAK_PI(memcmp)
577 cbz limit, .Lret0
578 eor tmp1, src1, src2
579 tst tmp1, #7
580 @@ -243,5 +243,5 @@ CPU_LE( rev data2, data2 )
581 .Lret0:
582 mov result, #0
583 ret
584 -ENDPIPROC(memcmp)
585 +SYM_FUNC_END_PI(memcmp)
586 EXPORT_SYMBOL_NOKASAN(memcmp)
587 diff --git a/arch/arm64/lib/memcpy.S b/arch/arm64/lib/memcpy.S
588 index d79f48994dbb2..b03cbb3455d4d 100644
589 --- a/arch/arm64/lib/memcpy.S
590 +++ b/arch/arm64/lib/memcpy.S
591 @@ -56,12 +56,11 @@
592 stp \ptr, \regB, [\regC], \val
593 .endm
594
595 - .weak memcpy
596 -ENTRY(__memcpy)
597 -ENTRY(memcpy)
598 +SYM_FUNC_START_ALIAS(__memcpy)
599 +SYM_FUNC_START_WEAK_PI(memcpy)
600 #include "copy_template.S"
601 ret
602 -ENDPIPROC(memcpy)
603 +SYM_FUNC_END_PI(memcpy)
604 EXPORT_SYMBOL(memcpy)
605 -ENDPROC(__memcpy)
606 +SYM_FUNC_END_ALIAS(__memcpy)
607 EXPORT_SYMBOL(__memcpy)
608 diff --git a/arch/arm64/lib/memmove.S b/arch/arm64/lib/memmove.S
609 index 7847751364806..1035dce4bdaf4 100644
610 --- a/arch/arm64/lib/memmove.S
611 +++ b/arch/arm64/lib/memmove.S
612 @@ -45,9 +45,8 @@ C_h .req x12
613 D_l .req x13
614 D_h .req x14
615
616 - .weak memmove
617 -ENTRY(__memmove)
618 -ENTRY(memmove)
619 +SYM_FUNC_START_ALIAS(__memmove)
620 +SYM_FUNC_START_WEAK_PI(memmove)
621 cmp dstin, src
622 b.lo __memcpy
623 add tmp1, src, count
624 @@ -184,7 +183,7 @@ ENTRY(memmove)
625 tst count, #0x3f
626 b.ne .Ltail63
627 ret
628 -ENDPIPROC(memmove)
629 +SYM_FUNC_END_PI(memmove)
630 EXPORT_SYMBOL(memmove)
631 -ENDPROC(__memmove)
632 +SYM_FUNC_END_ALIAS(__memmove)
633 EXPORT_SYMBOL(__memmove)
634 diff --git a/arch/arm64/lib/memset.S b/arch/arm64/lib/memset.S
635 index 9fb97e6bc5602..a9c1c9a01ea90 100644
636 --- a/arch/arm64/lib/memset.S
637 +++ b/arch/arm64/lib/memset.S
638 @@ -42,9 +42,8 @@ dst .req x8
639 tmp3w .req w9
640 tmp3 .req x9
641
642 - .weak memset
643 -ENTRY(__memset)
644 -ENTRY(memset)
645 +SYM_FUNC_START_ALIAS(__memset)
646 +SYM_FUNC_START_WEAK_PI(memset)
647 mov dst, dstin /* Preserve return value. */
648 and A_lw, val, #255
649 orr A_lw, A_lw, A_lw, lsl #8
650 @@ -203,7 +202,7 @@ ENTRY(memset)
651 ands count, count, zva_bits_x
652 b.ne .Ltail_maybe_long
653 ret
654 -ENDPIPROC(memset)
655 +SYM_FUNC_END_PI(memset)
656 EXPORT_SYMBOL(memset)
657 -ENDPROC(__memset)
658 +SYM_FUNC_END_ALIAS(__memset)
659 EXPORT_SYMBOL(__memset)
660 diff --git a/arch/arm64/lib/strchr.S b/arch/arm64/lib/strchr.S
661 index ca3ec18171a43..1f47eae3b0d6d 100644
662 --- a/arch/arm64/lib/strchr.S
663 +++ b/arch/arm64/lib/strchr.S
664 @@ -18,7 +18,7 @@
665 * Returns:
666 * x0 - address of first occurrence of 'c' or 0
667 */
668 -WEAK(strchr)
669 +SYM_FUNC_START_WEAK(strchr)
670 and w1, w1, #0xff
671 1: ldrb w2, [x0], #1
672 cmp w2, w1
673 @@ -28,5 +28,5 @@ WEAK(strchr)
674 cmp w2, w1
675 csel x0, x0, xzr, eq
676 ret
677 -ENDPROC(strchr)
678 +SYM_FUNC_END(strchr)
679 EXPORT_SYMBOL_NOKASAN(strchr)
680 diff --git a/arch/arm64/lib/strcmp.S b/arch/arm64/lib/strcmp.S
681 index e9aefbe0b7401..4767540d1b94e 100644
682 --- a/arch/arm64/lib/strcmp.S
683 +++ b/arch/arm64/lib/strcmp.S
684 @@ -48,7 +48,7 @@ tmp3 .req x9
685 zeroones .req x10
686 pos .req x11
687
688 -WEAK(strcmp)
689 +SYM_FUNC_START_WEAK_PI(strcmp)
690 eor tmp1, src1, src2
691 mov zeroones, #REP8_01
692 tst tmp1, #7
693 @@ -219,5 +219,5 @@ CPU_BE( orr syndrome, diff, has_nul )
694 lsr data1, data1, #56
695 sub result, data1, data2, lsr #56
696 ret
697 -ENDPIPROC(strcmp)
698 +SYM_FUNC_END_PI(strcmp)
699 EXPORT_SYMBOL_NOKASAN(strcmp)
700 diff --git a/arch/arm64/lib/strlen.S b/arch/arm64/lib/strlen.S
701 index 87b0cb066915f..ee3ed882dd79f 100644
702 --- a/arch/arm64/lib/strlen.S
703 +++ b/arch/arm64/lib/strlen.S
704 @@ -44,7 +44,7 @@ pos .req x12
705 #define REP8_7f 0x7f7f7f7f7f7f7f7f
706 #define REP8_80 0x8080808080808080
707
708 -WEAK(strlen)
709 +SYM_FUNC_START_WEAK_PI(strlen)
710 mov zeroones, #REP8_01
711 bic src, srcin, #15
712 ands tmp1, srcin, #15
713 @@ -111,5 +111,5 @@ CPU_LE( lsr tmp2, tmp2, tmp1 ) /* Shift (tmp1 & 63). */
714 csinv data1, data1, xzr, le
715 csel data2, data2, data2a, le
716 b .Lrealigned
717 -ENDPIPROC(strlen)
718 +SYM_FUNC_END_PI(strlen)
719 EXPORT_SYMBOL_NOKASAN(strlen)
720 diff --git a/arch/arm64/lib/strncmp.S b/arch/arm64/lib/strncmp.S
721 index f571581888fa4..2a7ee949ed471 100644
722 --- a/arch/arm64/lib/strncmp.S
723 +++ b/arch/arm64/lib/strncmp.S
724 @@ -52,7 +52,7 @@ limit_wd .req x13
725 mask .req x14
726 endloop .req x15
727
728 -WEAK(strncmp)
729 +SYM_FUNC_START_WEAK_PI(strncmp)
730 cbz limit, .Lret0
731 eor tmp1, src1, src2
732 mov zeroones, #REP8_01
733 @@ -295,5 +295,5 @@ CPU_BE( orr syndrome, diff, has_nul )
734 .Lret0:
735 mov result, #0
736 ret
737 -ENDPIPROC(strncmp)
738 +SYM_FUNC_END_PI(strncmp)
739 EXPORT_SYMBOL_NOKASAN(strncmp)
740 diff --git a/arch/arm64/lib/strnlen.S b/arch/arm64/lib/strnlen.S
741 index c0bac9493c683..b72913a990389 100644
742 --- a/arch/arm64/lib/strnlen.S
743 +++ b/arch/arm64/lib/strnlen.S
744 @@ -47,7 +47,7 @@ limit_wd .req x14
745 #define REP8_7f 0x7f7f7f7f7f7f7f7f
746 #define REP8_80 0x8080808080808080
747
748 -WEAK(strnlen)
749 +SYM_FUNC_START_WEAK_PI(strnlen)
750 cbz limit, .Lhit_limit
751 mov zeroones, #REP8_01
752 bic src, srcin, #15
753 @@ -156,5 +156,5 @@ CPU_LE( lsr tmp2, tmp2, tmp4 ) /* Shift (tmp1 & 63). */
754 .Lhit_limit:
755 mov len, limit
756 ret
757 -ENDPIPROC(strnlen)
758 +SYM_FUNC_END_PI(strnlen)
759 EXPORT_SYMBOL_NOKASAN(strnlen)
760 diff --git a/arch/arm64/lib/strrchr.S b/arch/arm64/lib/strrchr.S
761 index 794ac49ea4333..13132d1ed6d12 100644
762 --- a/arch/arm64/lib/strrchr.S
763 +++ b/arch/arm64/lib/strrchr.S
764 @@ -18,7 +18,7 @@
765 * Returns:
766 * x0 - address of last occurrence of 'c' or 0
767 */
768 -WEAK(strrchr)
769 +SYM_FUNC_START_WEAK_PI(strrchr)
770 mov x3, #0
771 and w1, w1, #0xff
772 1: ldrb w2, [x0], #1
773 @@ -29,5 +29,5 @@ WEAK(strrchr)
774 b 1b
775 2: mov x0, x3
776 ret
777 -ENDPIPROC(strrchr)
778 +SYM_FUNC_END_PI(strrchr)
779 EXPORT_SYMBOL_NOKASAN(strrchr)
780 diff --git a/arch/arm64/lib/tishift.S b/arch/arm64/lib/tishift.S
781 index 047622536535d..a88613834fb07 100644
782 --- a/arch/arm64/lib/tishift.S
783 +++ b/arch/arm64/lib/tishift.S
784 @@ -7,7 +7,7 @@
785
786 #include <asm/assembler.h>
787
788 -ENTRY(__ashlti3)
789 +SYM_FUNC_START(__ashlti3)
790 cbz x2, 1f
791 mov x3, #64
792 sub x3, x3, x2
793 @@ -26,10 +26,10 @@ ENTRY(__ashlti3)
794 lsl x1, x0, x1
795 mov x0, x2
796 ret
797 -ENDPROC(__ashlti3)
798 +SYM_FUNC_END(__ashlti3)
799 EXPORT_SYMBOL(__ashlti3)
800
801 -ENTRY(__ashrti3)
802 +SYM_FUNC_START(__ashrti3)
803 cbz x2, 1f
804 mov x3, #64
805 sub x3, x3, x2
806 @@ -48,10 +48,10 @@ ENTRY(__ashrti3)
807 asr x0, x1, x0
808 mov x1, x2
809 ret
810 -ENDPROC(__ashrti3)
811 +SYM_FUNC_END(__ashrti3)
812 EXPORT_SYMBOL(__ashrti3)
813
814 -ENTRY(__lshrti3)
815 +SYM_FUNC_START(__lshrti3)
816 cbz x2, 1f
817 mov x3, #64
818 sub x3, x3, x2
819 @@ -70,5 +70,5 @@ ENTRY(__lshrti3)
820 lsr x0, x1, x0
821 mov x1, x2
822 ret
823 -ENDPROC(__lshrti3)
824 +SYM_FUNC_END(__lshrti3)
825 EXPORT_SYMBOL(__lshrti3)
826 diff --git a/arch/x86/include/asm/linkage.h b/arch/x86/include/asm/linkage.h
827 index 14caa9d9fb7ff..e07188e8d7632 100644
828 --- a/arch/x86/include/asm/linkage.h
829 +++ b/arch/x86/include/asm/linkage.h
830 @@ -13,9 +13,13 @@
831
832 #ifdef __ASSEMBLY__
833
834 -#define GLOBAL(name) \
835 - .globl name; \
836 - name:
837 +/*
838 + * GLOBAL is DEPRECATED
839 + *
840 + * use SYM_DATA_START, SYM_FUNC_START, SYM_INNER_LABEL, SYM_CODE_START, or
841 + * similar
842 + */
843 +#define GLOBAL(name) SYM_ENTRY(name, SYM_L_GLOBAL, SYM_A_NONE)
844
845 #if defined(CONFIG_X86_64) || defined(CONFIG_X86_ALIGNMENT_16)
846 #define __ALIGN .p2align 4, 0x90
847 diff --git a/arch/x86/kernel/kexec-bzimage64.c b/arch/x86/kernel/kexec-bzimage64.c
848 index d2f4e706a428c..b8b3b84308edc 100644
849 --- a/arch/x86/kernel/kexec-bzimage64.c
850 +++ b/arch/x86/kernel/kexec-bzimage64.c
851 @@ -210,8 +210,7 @@ setup_boot_parameters(struct kimage *image, struct boot_params *params,
852 params->hdr.hardware_subarch = boot_params.hdr.hardware_subarch;
853
854 /* Copying screen_info will do? */
855 - memcpy(&params->screen_info, &boot_params.screen_info,
856 - sizeof(struct screen_info));
857 + memcpy(&params->screen_info, &screen_info, sizeof(struct screen_info));
858
859 /* Fill in memsize later */
860 params->screen_info.ext_mem_k = 0;
861 diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
862 index 0c7addcd19859..3d34ac02d76ef 100644
863 --- a/block/blk-cgroup.c
864 +++ b/block/blk-cgroup.c
865 @@ -855,13 +855,20 @@ int blkg_conf_prep(struct blkcg *blkcg, const struct blkcg_policy *pol,
866 goto fail;
867 }
868
869 + if (radix_tree_preload(GFP_KERNEL)) {
870 + blkg_free(new_blkg);
871 + ret = -ENOMEM;
872 + goto fail;
873 + }
874 +
875 rcu_read_lock();
876 spin_lock_irq(&q->queue_lock);
877
878 blkg = blkg_lookup_check(pos, pol, q);
879 if (IS_ERR(blkg)) {
880 ret = PTR_ERR(blkg);
881 - goto fail_unlock;
882 + blkg_free(new_blkg);
883 + goto fail_preloaded;
884 }
885
886 if (blkg) {
887 @@ -870,10 +877,12 @@ int blkg_conf_prep(struct blkcg *blkcg, const struct blkcg_policy *pol,
888 blkg = blkg_create(pos, q, new_blkg);
889 if (IS_ERR(blkg)) {
890 ret = PTR_ERR(blkg);
891 - goto fail_unlock;
892 + goto fail_preloaded;
893 }
894 }
895
896 + radix_tree_preload_end();
897 +
898 if (pos == blkcg)
899 goto success;
900 }
901 @@ -883,6 +892,8 @@ success:
902 ctx->body = input;
903 return 0;
904
905 +fail_preloaded:
906 + radix_tree_preload_end();
907 fail_unlock:
908 spin_unlock_irq(&q->queue_lock);
909 rcu_read_unlock();
910 diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c
911 index 12d980aafc5ff..9d78f29cf9967 100644
912 --- a/drivers/acpi/nfit/core.c
913 +++ b/drivers/acpi/nfit/core.c
914 @@ -1553,7 +1553,7 @@ static ssize_t format1_show(struct device *dev,
915 le16_to_cpu(nfit_dcr->dcr->code));
916 break;
917 }
918 - if (rc != ENXIO)
919 + if (rc != -ENXIO)
920 break;
921 }
922 mutex_unlock(&acpi_desc->init_mutex);
923 diff --git a/drivers/base/core.c b/drivers/base/core.c
924 index 0fde3e9e63ee3..ddfbd62d8bfc2 100644
925 --- a/drivers/base/core.c
926 +++ b/drivers/base/core.c
927 @@ -454,8 +454,7 @@ static void __device_link_del(struct kref *kref)
928 dev_dbg(link->consumer, "Dropping the link to %s\n",
929 dev_name(link->supplier));
930
931 - if (link->flags & DL_FLAG_PM_RUNTIME)
932 - pm_runtime_drop_link(link->consumer);
933 + pm_runtime_drop_link(link);
934
935 list_del_rcu(&link->s_node);
936 list_del_rcu(&link->c_node);
937 @@ -469,8 +468,7 @@ static void __device_link_del(struct kref *kref)
938 dev_info(link->consumer, "Dropping the link to %s\n",
939 dev_name(link->supplier));
940
941 - if (link->flags & DL_FLAG_PM_RUNTIME)
942 - pm_runtime_drop_link(link->consumer);
943 + pm_runtime_drop_link(link);
944
945 list_del(&link->s_node);
946 list_del(&link->c_node);
947 diff --git a/drivers/base/dd.c b/drivers/base/dd.c
948 index 84e757860ebb9..32823f36cffd0 100644
949 --- a/drivers/base/dd.c
950 +++ b/drivers/base/dd.c
951 @@ -1105,6 +1105,8 @@ static void __device_release_driver(struct device *dev, struct device *parent)
952
953 drv = dev->driver;
954 if (drv) {
955 + pm_runtime_get_sync(dev);
956 +
957 while (device_links_busy(dev)) {
958 __device_driver_unlock(dev, parent);
959
960 @@ -1116,13 +1118,12 @@ static void __device_release_driver(struct device *dev, struct device *parent)
961 * have released the driver successfully while this one
962 * was waiting, so check for that.
963 */
964 - if (dev->driver != drv)
965 + if (dev->driver != drv) {
966 + pm_runtime_put(dev);
967 return;
968 + }
969 }
970
971 - pm_runtime_get_sync(dev);
972 - pm_runtime_clean_up_links(dev);
973 -
974 driver_sysfs_remove(dev);
975
976 if (dev->bus)
977 diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c
978 index 4244e22e4b403..137a7ba053d78 100644
979 --- a/drivers/base/power/runtime.c
980 +++ b/drivers/base/power/runtime.c
981 @@ -1615,42 +1615,6 @@ void pm_runtime_remove(struct device *dev)
982 pm_runtime_reinit(dev);
983 }
984
985 -/**
986 - * pm_runtime_clean_up_links - Prepare links to consumers for driver removal.
987 - * @dev: Device whose driver is going to be removed.
988 - *
989 - * Check links from this device to any consumers and if any of them have active
990 - * runtime PM references to the device, drop the usage counter of the device
991 - * (as many times as needed).
992 - *
993 - * Links with the DL_FLAG_MANAGED flag unset are ignored.
994 - *
995 - * Since the device is guaranteed to be runtime-active at the point this is
996 - * called, nothing else needs to be done here.
997 - *
998 - * Moreover, this is called after device_links_busy() has returned 'false', so
999 - * the status of each link is guaranteed to be DL_STATE_SUPPLIER_UNBIND and
1000 - * therefore rpm_active can't be manipulated concurrently.
1001 - */
1002 -void pm_runtime_clean_up_links(struct device *dev)
1003 -{
1004 - struct device_link *link;
1005 - int idx;
1006 -
1007 - idx = device_links_read_lock();
1008 -
1009 - list_for_each_entry_rcu(link, &dev->links.consumers, s_node,
1010 - device_links_read_lock_held()) {
1011 - if (!(link->flags & DL_FLAG_MANAGED))
1012 - continue;
1013 -
1014 - while (refcount_dec_not_one(&link->rpm_active))
1015 - pm_runtime_put_noidle(dev);
1016 - }
1017 -
1018 - device_links_read_unlock(idx);
1019 -}
1020 -
1021 /**
1022 * pm_runtime_get_suppliers - Resume and reference-count supplier devices.
1023 * @dev: Consumer device.
1024 @@ -1702,7 +1666,7 @@ void pm_runtime_new_link(struct device *dev)
1025 spin_unlock_irq(&dev->power.lock);
1026 }
1027
1028 -void pm_runtime_drop_link(struct device *dev)
1029 +static void pm_runtime_drop_link_count(struct device *dev)
1030 {
1031 spin_lock_irq(&dev->power.lock);
1032 WARN_ON(dev->power.links_count == 0);
1033 @@ -1710,6 +1674,25 @@ void pm_runtime_drop_link(struct device *dev)
1034 spin_unlock_irq(&dev->power.lock);
1035 }
1036
1037 +/**
1038 + * pm_runtime_drop_link - Prepare for device link removal.
1039 + * @link: Device link going away.
1040 + *
1041 + * Drop the link count of the consumer end of @link and decrement the supplier
1042 + * device's runtime PM usage counter as many times as needed to drop all of the
1043 + * PM runtime reference to it from the consumer.
1044 + */
1045 +void pm_runtime_drop_link(struct device_link *link)
1046 +{
1047 + if (!(link->flags & DL_FLAG_PM_RUNTIME))
1048 + return;
1049 +
1050 + pm_runtime_drop_link_count(link->consumer);
1051 +
1052 + while (refcount_dec_not_one(&link->rpm_active))
1053 + pm_runtime_put(link->supplier);
1054 +}
1055 +
1056 static bool pm_runtime_need_not_resume(struct device *dev)
1057 {
1058 return atomic_read(&dev->power.usage_count) <= 1 &&
1059 diff --git a/drivers/crypto/chelsio/chtls/chtls_cm.c b/drivers/crypto/chelsio/chtls/chtls_cm.c
1060 index e2c64c943cfc7..385bd4dc66867 100644
1061 --- a/drivers/crypto/chelsio/chtls/chtls_cm.c
1062 +++ b/drivers/crypto/chelsio/chtls/chtls_cm.c
1063 @@ -174,7 +174,7 @@ static struct sk_buff *alloc_ctrl_skb(struct sk_buff *skb, int len)
1064 {
1065 if (likely(skb && !skb_shared(skb) && !skb_cloned(skb))) {
1066 __skb_trim(skb, 0);
1067 - refcount_add(2, &skb->users);
1068 + refcount_inc(&skb->users);
1069 } else {
1070 skb = alloc_skb(len, GFP_KERNEL | __GFP_NOFAIL);
1071 }
1072 diff --git a/drivers/crypto/chelsio/chtls/chtls_hw.c b/drivers/crypto/chelsio/chtls/chtls_hw.c
1073 index a217fe72602d4..3ef723e089537 100644
1074 --- a/drivers/crypto/chelsio/chtls/chtls_hw.c
1075 +++ b/drivers/crypto/chelsio/chtls/chtls_hw.c
1076 @@ -357,6 +357,9 @@ int chtls_setkey(struct chtls_sock *csk, u32 keylen, u32 optname)
1077 if (ret)
1078 goto out_notcb;
1079
1080 + if (unlikely(csk_flag(sk, CSK_ABORT_SHUTDOWN)))
1081 + goto out_notcb;
1082 +
1083 set_wr_txq(skb, CPL_PRIORITY_DATA, csk->tlshws.txqid);
1084 csk->wr_credits -= DIV_ROUND_UP(len, 16);
1085 csk->wr_unacked += DIV_ROUND_UP(len, 16);
1086 diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
1087 index fa2c0f29ad4de..e8e1720104160 100644
1088 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
1089 +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
1090 @@ -1011,6 +1011,7 @@ static const struct pci_device_id pciidlist[] = {
1091 {0x1002, 0x7319, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_NAVI10},
1092 {0x1002, 0x731A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_NAVI10},
1093 {0x1002, 0x731B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_NAVI10},
1094 + {0x1002, 0x731E, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_NAVI10},
1095 {0x1002, 0x731F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_NAVI10},
1096 /* Navi14 */
1097 {0x1002, 0x7340, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_NAVI14},
1098 diff --git a/drivers/gpu/drm/i915/gt/intel_lrc.c b/drivers/gpu/drm/i915/gt/intel_lrc.c
1099 index c169f0f70f3ae..2fa491f826824 100644
1100 --- a/drivers/gpu/drm/i915/gt/intel_lrc.c
1101 +++ b/drivers/gpu/drm/i915/gt/intel_lrc.c
1102 @@ -1574,6 +1574,9 @@ static void process_csb(struct intel_engine_cs *engine)
1103 if (!inject_preempt_hang(execlists))
1104 ring_set_paused(engine, 0);
1105
1106 + /* XXX Magic delay for tgl */
1107 + ENGINE_POSTING_READ(engine, RING_CONTEXT_STATUS_PTR);
1108 +
1109 WRITE_ONCE(execlists->pending[0], NULL);
1110 break;
1111
1112 diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c b/drivers/gpu/drm/i915/i915_gpu_error.c
1113 index fe9edbba997cb..b9af329eb3a34 100644
1114 --- a/drivers/gpu/drm/i915/i915_gpu_error.c
1115 +++ b/drivers/gpu/drm/i915/i915_gpu_error.c
1116 @@ -307,6 +307,8 @@ static int compress_page(struct compress *c,
1117
1118 if (zlib_deflate(zstream, Z_NO_FLUSH) != Z_OK)
1119 return -EIO;
1120 +
1121 + cond_resched();
1122 } while (zstream->avail_in);
1123
1124 /* Fallback to uncompressed if we increase size? */
1125 @@ -392,6 +394,7 @@ static int compress_page(struct compress *c,
1126 if (!i915_memcpy_from_wc(ptr, src, PAGE_SIZE))
1127 memcpy(ptr, src, PAGE_SIZE);
1128 dst->pages[dst->page_count++] = ptr;
1129 + cond_resched();
1130
1131 return 0;
1132 }
1133 diff --git a/drivers/gpu/drm/i915/intel_uncore.c b/drivers/gpu/drm/i915/intel_uncore.c
1134 index 9e583f13a9e48..62f8a47fda456 100644
1135 --- a/drivers/gpu/drm/i915/intel_uncore.c
1136 +++ b/drivers/gpu/drm/i915/intel_uncore.c
1137 @@ -1124,6 +1124,18 @@ unclaimed_reg_debug(struct intel_uncore *uncore,
1138 spin_unlock(&uncore->debug->lock);
1139 }
1140
1141 +#define __vgpu_read(x) \
1142 +static u##x \
1143 +vgpu_read##x(struct intel_uncore *uncore, i915_reg_t reg, bool trace) { \
1144 + u##x val = __raw_uncore_read##x(uncore, reg); \
1145 + trace_i915_reg_rw(false, reg, val, sizeof(val), trace); \
1146 + return val; \
1147 +}
1148 +__vgpu_read(8)
1149 +__vgpu_read(16)
1150 +__vgpu_read(32)
1151 +__vgpu_read(64)
1152 +
1153 #define GEN2_READ_HEADER(x) \
1154 u##x val = 0; \
1155 assert_rpm_wakelock_held(uncore->rpm);
1156 @@ -1327,6 +1339,16 @@ __gen_reg_write_funcs(gen8);
1157 #undef GEN6_WRITE_FOOTER
1158 #undef GEN6_WRITE_HEADER
1159
1160 +#define __vgpu_write(x) \
1161 +static void \
1162 +vgpu_write##x(struct intel_uncore *uncore, i915_reg_t reg, u##x val, bool trace) { \
1163 + trace_i915_reg_rw(true, reg, val, sizeof(val), trace); \
1164 + __raw_uncore_write##x(uncore, reg, val); \
1165 +}
1166 +__vgpu_write(8)
1167 +__vgpu_write(16)
1168 +__vgpu_write(32)
1169 +
1170 #define ASSIGN_RAW_WRITE_MMIO_VFUNCS(uncore, x) \
1171 do { \
1172 (uncore)->funcs.mmio_writeb = x##_write8; \
1173 @@ -1647,7 +1669,10 @@ static void uncore_raw_init(struct intel_uncore *uncore)
1174 {
1175 GEM_BUG_ON(intel_uncore_has_forcewake(uncore));
1176
1177 - if (IS_GEN(uncore->i915, 5)) {
1178 + if (intel_vgpu_active(uncore->i915)) {
1179 + ASSIGN_RAW_WRITE_MMIO_VFUNCS(uncore, vgpu);
1180 + ASSIGN_RAW_READ_MMIO_VFUNCS(uncore, vgpu);
1181 + } else if (IS_GEN(uncore->i915, 5)) {
1182 ASSIGN_RAW_WRITE_MMIO_VFUNCS(uncore, gen5);
1183 ASSIGN_RAW_READ_MMIO_VFUNCS(uncore, gen5);
1184 } else {
1185 diff --git a/drivers/gpu/drm/nouveau/nouveau_gem.c b/drivers/gpu/drm/nouveau/nouveau_gem.c
1186 index 7d39d4949ee77..2dd9fcab464b1 100644
1187 --- a/drivers/gpu/drm/nouveau/nouveau_gem.c
1188 +++ b/drivers/gpu/drm/nouveau/nouveau_gem.c
1189 @@ -197,7 +197,8 @@ nouveau_gem_new(struct nouveau_cli *cli, u64 size, int align, uint32_t domain,
1190 * to the caller, instead of a normal nouveau_bo ttm reference. */
1191 ret = drm_gem_object_init(drm->dev, &nvbo->bo.base, size);
1192 if (ret) {
1193 - nouveau_bo_ref(NULL, &nvbo);
1194 + drm_gem_object_release(&nvbo->bo.base);
1195 + kfree(nvbo);
1196 return ret;
1197 }
1198
1199 diff --git a/drivers/gpu/drm/nouveau/nouveau_svm.c b/drivers/gpu/drm/nouveau/nouveau_svm.c
1200 index 824654742a604..0be4668c780bf 100644
1201 --- a/drivers/gpu/drm/nouveau/nouveau_svm.c
1202 +++ b/drivers/gpu/drm/nouveau/nouveau_svm.c
1203 @@ -112,11 +112,11 @@ nouveau_svmm_bind(struct drm_device *dev, void *data,
1204 struct nouveau_cli *cli = nouveau_cli(file_priv);
1205 struct drm_nouveau_svm_bind *args = data;
1206 unsigned target, cmd, priority;
1207 - unsigned long addr, end, size;
1208 + unsigned long addr, end;
1209 struct mm_struct *mm;
1210
1211 args->va_start &= PAGE_MASK;
1212 - args->va_end &= PAGE_MASK;
1213 + args->va_end = ALIGN(args->va_end, PAGE_SIZE);
1214
1215 /* Sanity check arguments */
1216 if (args->reserved0 || args->reserved1)
1217 @@ -125,8 +125,6 @@ nouveau_svmm_bind(struct drm_device *dev, void *data,
1218 return -EINVAL;
1219 if (args->va_start >= args->va_end)
1220 return -EINVAL;
1221 - if (!args->npages)
1222 - return -EINVAL;
1223
1224 cmd = args->header >> NOUVEAU_SVM_BIND_COMMAND_SHIFT;
1225 cmd &= NOUVEAU_SVM_BIND_COMMAND_MASK;
1226 @@ -158,12 +156,6 @@ nouveau_svmm_bind(struct drm_device *dev, void *data,
1227 if (args->stride)
1228 return -EINVAL;
1229
1230 - size = ((unsigned long)args->npages) << PAGE_SHIFT;
1231 - if ((args->va_start + size) <= args->va_start)
1232 - return -EINVAL;
1233 - if ((args->va_start + size) > args->va_end)
1234 - return -EINVAL;
1235 -
1236 /*
1237 * Ok we are ask to do something sane, for now we only support migrate
1238 * commands but we will add things like memory policy (what to do on
1239 @@ -178,7 +170,7 @@ nouveau_svmm_bind(struct drm_device *dev, void *data,
1240 return -EINVAL;
1241 }
1242
1243 - for (addr = args->va_start, end = args->va_start + size; addr < end;) {
1244 + for (addr = args->va_start, end = args->va_end; addr < end;) {
1245 struct vm_area_struct *vma;
1246 unsigned long next;
1247
1248 diff --git a/drivers/gpu/drm/panfrost/panfrost_gem.c b/drivers/gpu/drm/panfrost/panfrost_gem.c
1249 index c05e013bb8e3d..ac9de37a8280a 100644
1250 --- a/drivers/gpu/drm/panfrost/panfrost_gem.c
1251 +++ b/drivers/gpu/drm/panfrost/panfrost_gem.c
1252 @@ -105,14 +105,12 @@ void panfrost_gem_mapping_put(struct panfrost_gem_mapping *mapping)
1253 kref_put(&mapping->refcount, panfrost_gem_mapping_release);
1254 }
1255
1256 -void panfrost_gem_teardown_mappings(struct panfrost_gem_object *bo)
1257 +void panfrost_gem_teardown_mappings_locked(struct panfrost_gem_object *bo)
1258 {
1259 struct panfrost_gem_mapping *mapping;
1260
1261 - mutex_lock(&bo->mappings.lock);
1262 list_for_each_entry(mapping, &bo->mappings.list, node)
1263 panfrost_gem_teardown_mapping(mapping);
1264 - mutex_unlock(&bo->mappings.lock);
1265 }
1266
1267 int panfrost_gem_open(struct drm_gem_object *obj, struct drm_file *file_priv)
1268 diff --git a/drivers/gpu/drm/panfrost/panfrost_gem.h b/drivers/gpu/drm/panfrost/panfrost_gem.h
1269 index b3517ff9630cb..8088d5fd8480e 100644
1270 --- a/drivers/gpu/drm/panfrost/panfrost_gem.h
1271 +++ b/drivers/gpu/drm/panfrost/panfrost_gem.h
1272 @@ -82,7 +82,7 @@ struct panfrost_gem_mapping *
1273 panfrost_gem_mapping_get(struct panfrost_gem_object *bo,
1274 struct panfrost_file_priv *priv);
1275 void panfrost_gem_mapping_put(struct panfrost_gem_mapping *mapping);
1276 -void panfrost_gem_teardown_mappings(struct panfrost_gem_object *bo);
1277 +void panfrost_gem_teardown_mappings_locked(struct panfrost_gem_object *bo);
1278
1279 void panfrost_gem_shrinker_init(struct drm_device *dev);
1280 void panfrost_gem_shrinker_cleanup(struct drm_device *dev);
1281 diff --git a/drivers/gpu/drm/panfrost/panfrost_gem_shrinker.c b/drivers/gpu/drm/panfrost/panfrost_gem_shrinker.c
1282 index 288e46c40673a..1b9f68d8e9aa6 100644
1283 --- a/drivers/gpu/drm/panfrost/panfrost_gem_shrinker.c
1284 +++ b/drivers/gpu/drm/panfrost/panfrost_gem_shrinker.c
1285 @@ -40,18 +40,26 @@ static bool panfrost_gem_purge(struct drm_gem_object *obj)
1286 {
1287 struct drm_gem_shmem_object *shmem = to_drm_gem_shmem_obj(obj);
1288 struct panfrost_gem_object *bo = to_panfrost_bo(obj);
1289 + bool ret = false;
1290
1291 if (atomic_read(&bo->gpu_usecount))
1292 return false;
1293
1294 - if (!mutex_trylock(&shmem->pages_lock))
1295 + if (!mutex_trylock(&bo->mappings.lock))
1296 return false;
1297
1298 - panfrost_gem_teardown_mappings(bo);
1299 + if (!mutex_trylock(&shmem->pages_lock))
1300 + goto unlock_mappings;
1301 +
1302 + panfrost_gem_teardown_mappings_locked(bo);
1303 drm_gem_shmem_purge_locked(obj);
1304 + ret = true;
1305
1306 mutex_unlock(&shmem->pages_lock);
1307 - return true;
1308 +
1309 +unlock_mappings:
1310 + mutex_unlock(&bo->mappings.lock);
1311 + return ret;
1312 }
1313
1314 static unsigned long
1315 diff --git a/drivers/gpu/drm/sun4i/sun4i_frontend.c b/drivers/gpu/drm/sun4i/sun4i_frontend.c
1316 index ec2a032e07b97..7186ba73d8e14 100644
1317 --- a/drivers/gpu/drm/sun4i/sun4i_frontend.c
1318 +++ b/drivers/gpu/drm/sun4i/sun4i_frontend.c
1319 @@ -407,6 +407,7 @@ int sun4i_frontend_update_formats(struct sun4i_frontend *frontend,
1320 struct drm_framebuffer *fb = state->fb;
1321 const struct drm_format_info *format = fb->format;
1322 uint64_t modifier = fb->modifier;
1323 + unsigned int ch1_phase_idx;
1324 u32 out_fmt_val;
1325 u32 in_fmt_val, in_mod_val, in_ps_val;
1326 unsigned int i;
1327 @@ -442,18 +443,19 @@ int sun4i_frontend_update_formats(struct sun4i_frontend *frontend,
1328 * I have no idea what this does exactly, but it seems to be
1329 * related to the scaler FIR filter phase parameters.
1330 */
1331 + ch1_phase_idx = (format->num_planes > 1) ? 1 : 0;
1332 regmap_write(frontend->regs, SUN4I_FRONTEND_CH0_HORZPHASE_REG,
1333 - frontend->data->ch_phase[0].horzphase);
1334 + frontend->data->ch_phase[0]);
1335 regmap_write(frontend->regs, SUN4I_FRONTEND_CH1_HORZPHASE_REG,
1336 - frontend->data->ch_phase[1].horzphase);
1337 + frontend->data->ch_phase[ch1_phase_idx]);
1338 regmap_write(frontend->regs, SUN4I_FRONTEND_CH0_VERTPHASE0_REG,
1339 - frontend->data->ch_phase[0].vertphase[0]);
1340 + frontend->data->ch_phase[0]);
1341 regmap_write(frontend->regs, SUN4I_FRONTEND_CH1_VERTPHASE0_REG,
1342 - frontend->data->ch_phase[1].vertphase[0]);
1343 + frontend->data->ch_phase[ch1_phase_idx]);
1344 regmap_write(frontend->regs, SUN4I_FRONTEND_CH0_VERTPHASE1_REG,
1345 - frontend->data->ch_phase[0].vertphase[1]);
1346 + frontend->data->ch_phase[0]);
1347 regmap_write(frontend->regs, SUN4I_FRONTEND_CH1_VERTPHASE1_REG,
1348 - frontend->data->ch_phase[1].vertphase[1]);
1349 + frontend->data->ch_phase[ch1_phase_idx]);
1350
1351 /*
1352 * Checking the input format is sufficient since we currently only
1353 @@ -687,30 +689,12 @@ static const struct dev_pm_ops sun4i_frontend_pm_ops = {
1354 };
1355
1356 static const struct sun4i_frontend_data sun4i_a10_frontend = {
1357 - .ch_phase = {
1358 - {
1359 - .horzphase = 0,
1360 - .vertphase = { 0, 0 },
1361 - },
1362 - {
1363 - .horzphase = 0xfc000,
1364 - .vertphase = { 0xfc000, 0xfc000 },
1365 - },
1366 - },
1367 + .ch_phase = { 0x000, 0xfc000 },
1368 .has_coef_rdy = true,
1369 };
1370
1371 static const struct sun4i_frontend_data sun8i_a33_frontend = {
1372 - .ch_phase = {
1373 - {
1374 - .horzphase = 0x400,
1375 - .vertphase = { 0x400, 0x400 },
1376 - },
1377 - {
1378 - .horzphase = 0x400,
1379 - .vertphase = { 0x400, 0x400 },
1380 - },
1381 - },
1382 + .ch_phase = { 0x400, 0xfc400 },
1383 .has_coef_access_ctrl = true,
1384 };
1385
1386 diff --git a/drivers/gpu/drm/sun4i/sun4i_frontend.h b/drivers/gpu/drm/sun4i/sun4i_frontend.h
1387 index 0c382c1ddb0fe..2e7b76e50c2ba 100644
1388 --- a/drivers/gpu/drm/sun4i/sun4i_frontend.h
1389 +++ b/drivers/gpu/drm/sun4i/sun4i_frontend.h
1390 @@ -115,11 +115,7 @@ struct reset_control;
1391 struct sun4i_frontend_data {
1392 bool has_coef_access_ctrl;
1393 bool has_coef_rdy;
1394 -
1395 - struct {
1396 - u32 horzphase;
1397 - u32 vertphase[2];
1398 - } ch_phase[2];
1399 + u32 ch_phase[2];
1400 };
1401
1402 struct sun4i_frontend {
1403 diff --git a/drivers/gpu/drm/vc4/vc4_drv.c b/drivers/gpu/drm/vc4/vc4_drv.c
1404 index 5e6fb6c2307f0..0d78ba017a29b 100644
1405 --- a/drivers/gpu/drm/vc4/vc4_drv.c
1406 +++ b/drivers/gpu/drm/vc4/vc4_drv.c
1407 @@ -309,6 +309,7 @@ unbind_all:
1408 component_unbind_all(dev, drm);
1409 gem_destroy:
1410 vc4_gem_destroy(drm);
1411 + drm_mode_config_cleanup(drm);
1412 vc4_bo_cache_destroy(drm);
1413 dev_put:
1414 drm_dev_put(drm);
1415 diff --git a/drivers/hwtracing/coresight/coresight-priv.h b/drivers/hwtracing/coresight/coresight-priv.h
1416 index dfd24b85a5775..82e563cdc8794 100644
1417 --- a/drivers/hwtracing/coresight/coresight-priv.h
1418 +++ b/drivers/hwtracing/coresight/coresight-priv.h
1419 @@ -147,8 +147,7 @@ static inline void coresight_write_reg_pair(void __iomem *addr, u64 val,
1420 void coresight_disable_path(struct list_head *path);
1421 int coresight_enable_path(struct list_head *path, u32 mode, void *sink_data);
1422 struct coresight_device *coresight_get_sink(struct list_head *path);
1423 -struct coresight_device *
1424 -coresight_get_enabled_sink(struct coresight_device *source);
1425 +struct coresight_device *coresight_get_enabled_sink(bool reset);
1426 struct coresight_device *coresight_get_sink_by_id(u32 id);
1427 struct list_head *coresight_build_path(struct coresight_device *csdev,
1428 struct coresight_device *sink);
1429 diff --git a/drivers/hwtracing/coresight/coresight.c b/drivers/hwtracing/coresight/coresight.c
1430 index 90ecd04a2f20b..0bbce0d291582 100644
1431 --- a/drivers/hwtracing/coresight/coresight.c
1432 +++ b/drivers/hwtracing/coresight/coresight.c
1433 @@ -481,46 +481,50 @@ struct coresight_device *coresight_get_sink(struct list_head *path)
1434 return csdev;
1435 }
1436
1437 -static struct coresight_device *
1438 -coresight_find_enabled_sink(struct coresight_device *csdev)
1439 +static int coresight_enabled_sink(struct device *dev, const void *data)
1440 {
1441 - int i;
1442 - struct coresight_device *sink;
1443 + const bool *reset = data;
1444 + struct coresight_device *csdev = to_coresight_device(dev);
1445
1446 if ((csdev->type == CORESIGHT_DEV_TYPE_SINK ||
1447 csdev->type == CORESIGHT_DEV_TYPE_LINKSINK) &&
1448 - csdev->activated)
1449 - return csdev;
1450 -
1451 - /*
1452 - * Recursively explore each port found on this element.
1453 - */
1454 - for (i = 0; i < csdev->pdata->nr_outport; i++) {
1455 - struct coresight_device *child_dev;
1456 + csdev->activated) {
1457 + /*
1458 + * Now that we have a handle on the sink for this session,
1459 + * disable the sysFS "enable_sink" flag so that possible
1460 + * concurrent perf session that wish to use another sink don't
1461 + * trip on it. Doing so has no ramification for the current
1462 + * session.
1463 + */
1464 + if (*reset)
1465 + csdev->activated = false;
1466
1467 - child_dev = csdev->pdata->conns[i].child_dev;
1468 - if (child_dev)
1469 - sink = coresight_find_enabled_sink(child_dev);
1470 - if (sink)
1471 - return sink;
1472 + return 1;
1473 }
1474
1475 - return NULL;
1476 + return 0;
1477 }
1478
1479 /**
1480 - * coresight_get_enabled_sink - returns the first enabled sink using
1481 - * connection based search starting from the source reference
1482 + * coresight_get_enabled_sink - returns the first enabled sink found on the bus
1483 + * @deactivate: Whether the 'enable_sink' flag should be reset
1484 *
1485 - * @source: Coresight source device reference
1486 + * When operated from perf the deactivate parameter should be set to 'true'.
1487 + * That way the "enabled_sink" flag of the sink that was selected can be reset,
1488 + * allowing for other concurrent perf sessions to choose a different sink.
1489 + *
1490 + * When operated from sysFS users have full control and as such the deactivate
1491 + * parameter should be set to 'false', hence mandating users to explicitly
1492 + * clear the flag.
1493 */
1494 -struct coresight_device *
1495 -coresight_get_enabled_sink(struct coresight_device *source)
1496 +struct coresight_device *coresight_get_enabled_sink(bool deactivate)
1497 {
1498 - if (!source)
1499 - return NULL;
1500 + struct device *dev = NULL;
1501 +
1502 + dev = bus_find_device(&coresight_bustype, NULL, &deactivate,
1503 + coresight_enabled_sink);
1504
1505 - return coresight_find_enabled_sink(source);
1506 + return dev ? to_coresight_device(dev) : NULL;
1507 }
1508
1509 static int coresight_sink_by_id(struct device *dev, const void *data)
1510 @@ -760,7 +764,11 @@ int coresight_enable(struct coresight_device *csdev)
1511 goto out;
1512 }
1513
1514 - sink = coresight_get_enabled_sink(csdev);
1515 + /*
1516 + * Search for a valid sink for this session but don't reset the
1517 + * "enable_sink" flag in sysFS. Users get to do that explicitly.
1518 + */
1519 + sink = coresight_get_enabled_sink(false);
1520 if (!sink) {
1521 ret = -EINVAL;
1522 goto out;
1523 diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c
1524 index f417fb680cd80..40586ad17f522 100644
1525 --- a/drivers/mtd/spi-nor/spi-nor.c
1526 +++ b/drivers/mtd/spi-nor/spi-nor.c
1527 @@ -4444,11 +4444,10 @@ static void spi_nor_sfdp_init_params(struct spi_nor *nor)
1528
1529 memcpy(&sfdp_params, &nor->params, sizeof(sfdp_params));
1530
1531 - if (spi_nor_parse_sfdp(nor, &sfdp_params)) {
1532 + if (spi_nor_parse_sfdp(nor, &nor->params)) {
1533 + memcpy(&nor->params, &sfdp_params, sizeof(nor->params));
1534 nor->addr_width = 0;
1535 nor->flags &= ~SNOR_F_4B_OPCODES;
1536 - } else {
1537 - memcpy(&nor->params, &sfdp_params, sizeof(nor->params));
1538 }
1539 }
1540
1541 diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
1542 index a5c4d4d66df35..3f74416bb8744 100644
1543 --- a/drivers/net/ethernet/cadence/macb_main.c
1544 +++ b/drivers/net/ethernet/cadence/macb_main.c
1545 @@ -1718,7 +1718,8 @@ static inline int macb_clear_csum(struct sk_buff *skb)
1546
1547 static int macb_pad_and_fcs(struct sk_buff **skb, struct net_device *ndev)
1548 {
1549 - bool cloned = skb_cloned(*skb) || skb_header_cloned(*skb);
1550 + bool cloned = skb_cloned(*skb) || skb_header_cloned(*skb) ||
1551 + skb_is_nonlinear(*skb);
1552 int padlen = ETH_ZLEN - (*skb)->len;
1553 int headroom = skb_headroom(*skb);
1554 int tailroom = skb_tailroom(*skb);
1555 diff --git a/drivers/net/ethernet/freescale/gianfar.c b/drivers/net/ethernet/freescale/gianfar.c
1556 index 3978d82c95989..5cb58ab1eec97 100644
1557 --- a/drivers/net/ethernet/freescale/gianfar.c
1558 +++ b/drivers/net/ethernet/freescale/gianfar.c
1559 @@ -1826,20 +1826,12 @@ static netdev_tx_t gfar_start_xmit(struct sk_buff *skb, struct net_device *dev)
1560 fcb_len = GMAC_FCB_LEN + GMAC_TXPAL_LEN;
1561
1562 /* make space for additional header when fcb is needed */
1563 - if (fcb_len && unlikely(skb_headroom(skb) < fcb_len)) {
1564 - struct sk_buff *skb_new;
1565 -
1566 - skb_new = skb_realloc_headroom(skb, fcb_len);
1567 - if (!skb_new) {
1568 + if (fcb_len) {
1569 + if (unlikely(skb_cow_head(skb, fcb_len))) {
1570 dev->stats.tx_errors++;
1571 dev_kfree_skb_any(skb);
1572 return NETDEV_TX_OK;
1573 }
1574 -
1575 - if (skb->sk)
1576 - skb_set_owner_w(skb_new, skb->sk);
1577 - dev_consume_skb_any(skb);
1578 - skb = skb_new;
1579 }
1580
1581 /* total number of fragments in the SKB */
1582 @@ -3377,7 +3369,7 @@ static int gfar_probe(struct platform_device *ofdev)
1583
1584 if (dev->features & NETIF_F_IP_CSUM ||
1585 priv->device_flags & FSL_GIANFAR_DEV_HAS_TIMER)
1586 - dev->needed_headroom = GMAC_FCB_LEN;
1587 + dev->needed_headroom = GMAC_FCB_LEN + GMAC_TXPAL_LEN;
1588
1589 /* Initializing some of the rx/tx queue level parameters */
1590 for (i = 0; i < priv->num_tx_queues; i++) {
1591 diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
1592 index 91559a52c7adb..f357b9cbfee72 100644
1593 --- a/drivers/net/ethernet/ibm/ibmvnic.c
1594 +++ b/drivers/net/ethernet/ibm/ibmvnic.c
1595 @@ -1109,18 +1109,27 @@ static int ibmvnic_open(struct net_device *netdev)
1596 if (adapter->state != VNIC_CLOSED) {
1597 rc = ibmvnic_login(netdev);
1598 if (rc)
1599 - return rc;
1600 + goto out;
1601
1602 rc = init_resources(adapter);
1603 if (rc) {
1604 netdev_err(netdev, "failed to initialize resources\n");
1605 release_resources(adapter);
1606 - return rc;
1607 + goto out;
1608 }
1609 }
1610
1611 rc = __ibmvnic_open(netdev);
1612
1613 +out:
1614 + /*
1615 + * If open fails due to a pending failover, set device state and
1616 + * return. Device operation will be handled by reset routine.
1617 + */
1618 + if (rc && adapter->failover_pending) {
1619 + adapter->state = VNIC_OPEN;
1620 + rc = 0;
1621 + }
1622 return rc;
1623 }
1624
1625 @@ -1842,6 +1851,13 @@ static int do_reset(struct ibmvnic_adapter *adapter,
1626 rwi->reset_reason);
1627
1628 rtnl_lock();
1629 + /*
1630 + * Now that we have the rtnl lock, clear any pending failover.
1631 + * This will ensure ibmvnic_open() has either completed or will
1632 + * block until failover is complete.
1633 + */
1634 + if (rwi->reset_reason == VNIC_RESET_FAILOVER)
1635 + adapter->failover_pending = false;
1636
1637 netif_carrier_off(netdev);
1638 adapter->reset_reason = rwi->reset_reason;
1639 @@ -2112,6 +2128,13 @@ static void __ibmvnic_reset(struct work_struct *work)
1640 /* CHANGE_PARAM requestor holds rtnl_lock */
1641 rc = do_change_param_reset(adapter, rwi, reset_state);
1642 } else if (adapter->force_reset_recovery) {
1643 + /*
1644 + * Since we are doing a hard reset now, clear the
1645 + * failover_pending flag so we don't ignore any
1646 + * future MOBILITY or other resets.
1647 + */
1648 + adapter->failover_pending = false;
1649 +
1650 /* Transport event occurred during previous reset */
1651 if (adapter->wait_for_reset) {
1652 /* Previous was CHANGE_PARAM; caller locked */
1653 @@ -2176,9 +2199,15 @@ static int ibmvnic_reset(struct ibmvnic_adapter *adapter,
1654 unsigned long flags;
1655 int ret;
1656
1657 + /*
1658 + * If failover is pending don't schedule any other reset.
1659 + * Instead let the failover complete. If there is already a
1660 + * a failover reset scheduled, we will detect and drop the
1661 + * duplicate reset when walking the ->rwi_list below.
1662 + */
1663 if (adapter->state == VNIC_REMOVING ||
1664 adapter->state == VNIC_REMOVED ||
1665 - adapter->failover_pending) {
1666 + (adapter->failover_pending && reason != VNIC_RESET_FAILOVER)) {
1667 ret = EBUSY;
1668 netdev_dbg(netdev, "Adapter removing or pending failover, skipping reset\n");
1669 goto err;
1670 @@ -4532,7 +4561,6 @@ static void ibmvnic_handle_crq(union ibmvnic_crq *crq,
1671 case IBMVNIC_CRQ_INIT:
1672 dev_info(dev, "Partner initialized\n");
1673 adapter->from_passive_init = true;
1674 - adapter->failover_pending = false;
1675 if (!completion_done(&adapter->init_done)) {
1676 complete(&adapter->init_done);
1677 adapter->init_done_rc = -EIO;
1678 diff --git a/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c b/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c
1679 index 5aacc00962df7..b8de3784d9769 100644
1680 --- a/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c
1681 +++ b/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c
1682 @@ -125,6 +125,11 @@ static int ionic_get_link_ksettings(struct net_device *netdev,
1683
1684 ethtool_link_ksettings_zero_link_mode(ks, supported);
1685
1686 + if (!idev->port_info) {
1687 + netdev_err(netdev, "port_info not initialized\n");
1688 + return -EOPNOTSUPP;
1689 + }
1690 +
1691 /* The port_info data is found in a DMA space that the NIC keeps
1692 * up-to-date, so there's no need to request the data from the
1693 * NIC, we already have it in our memory space.
1694 diff --git a/drivers/net/phy/sfp.c b/drivers/net/phy/sfp.c
1695 index 272d5773573e7..27b67f12ec455 100644
1696 --- a/drivers/net/phy/sfp.c
1697 +++ b/drivers/net/phy/sfp.c
1698 @@ -1970,7 +1970,8 @@ static int sfp_probe(struct platform_device *pdev)
1699 continue;
1700
1701 sfp->gpio_irq[i] = gpiod_to_irq(sfp->gpio[i]);
1702 - if (!sfp->gpio_irq[i]) {
1703 + if (sfp->gpio_irq[i] < 0) {
1704 + sfp->gpio_irq[i] = 0;
1705 poll = true;
1706 continue;
1707 }
1708 diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
1709 index 21d905d90650b..868acb4101412 100644
1710 --- a/drivers/net/usb/qmi_wwan.c
1711 +++ b/drivers/net/usb/qmi_wwan.c
1712 @@ -1331,6 +1331,7 @@ static const struct usb_device_id products[] = {
1713 {QMI_FIXED_INTF(0x1bc7, 0x1101, 3)}, /* Telit ME910 dual modem */
1714 {QMI_FIXED_INTF(0x1bc7, 0x1200, 5)}, /* Telit LE920 */
1715 {QMI_QUIRK_SET_DTR(0x1bc7, 0x1201, 2)}, /* Telit LE920, LE920A4 */
1716 + {QMI_QUIRK_SET_DTR(0x1bc7, 0x1230, 2)}, /* Telit LE910Cx */
1717 {QMI_QUIRK_SET_DTR(0x1bc7, 0x1260, 2)}, /* Telit LE910Cx */
1718 {QMI_QUIRK_SET_DTR(0x1bc7, 0x1261, 2)}, /* Telit LE910Cx */
1719 {QMI_QUIRK_SET_DTR(0x1bc7, 0x1900, 1)}, /* Telit LN940 series */
1720 diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c
1721 index a41ee9feab8e7..e957ad0a07f58 100644
1722 --- a/drivers/nvme/host/rdma.c
1723 +++ b/drivers/nvme/host/rdma.c
1724 @@ -1520,6 +1520,14 @@ static void nvme_rdma_recv_done(struct ib_cq *cq, struct ib_wc *wc)
1725 return;
1726 }
1727
1728 + /* sanity checking for received data length */
1729 + if (unlikely(wc->byte_len < len)) {
1730 + dev_err(queue->ctrl->ctrl.device,
1731 + "Unexpected nvme completion length(%d)\n", wc->byte_len);
1732 + nvme_rdma_error_recovery(queue->ctrl);
1733 + return;
1734 + }
1735 +
1736 ib_dma_sync_single_for_cpu(ibdev, qe->dma, len, DMA_FROM_DEVICE);
1737 /*
1738 * AEN requests are special as they don't time out and can
1739 diff --git a/drivers/nvme/target/core.c b/drivers/nvme/target/core.c
1740 index 6b2f1e290fa73..cca5a00c098a8 100644
1741 --- a/drivers/nvme/target/core.c
1742 +++ b/drivers/nvme/target/core.c
1743 @@ -878,8 +878,6 @@ bool nvmet_req_init(struct nvmet_req *req, struct nvmet_cq *cq,
1744 req->error_loc = NVMET_NO_ERROR_LOC;
1745 req->error_slba = 0;
1746
1747 - trace_nvmet_req_init(req, req->cmd);
1748 -
1749 /* no support for fused commands yet */
1750 if (unlikely(flags & (NVME_CMD_FUSE_FIRST | NVME_CMD_FUSE_SECOND))) {
1751 req->error_loc = offsetof(struct nvme_common_command, flags);
1752 @@ -913,6 +911,8 @@ bool nvmet_req_init(struct nvmet_req *req, struct nvmet_cq *cq,
1753 if (status)
1754 goto fail;
1755
1756 + trace_nvmet_req_init(req, req->cmd);
1757 +
1758 if (unlikely(!percpu_ref_tryget_live(&sq->ref))) {
1759 status = NVME_SC_INVALID_FIELD | NVME_SC_DNR;
1760 goto fail;
1761 diff --git a/drivers/nvme/target/trace.h b/drivers/nvme/target/trace.h
1762 index e645caa882dd3..3f61b6657175e 100644
1763 --- a/drivers/nvme/target/trace.h
1764 +++ b/drivers/nvme/target/trace.h
1765 @@ -46,19 +46,12 @@ static inline struct nvmet_ctrl *nvmet_req_to_ctrl(struct nvmet_req *req)
1766 return req->sq->ctrl;
1767 }
1768
1769 -static inline void __assign_disk_name(char *name, struct nvmet_req *req,
1770 - bool init)
1771 +static inline void __assign_req_name(char *name, struct nvmet_req *req)
1772 {
1773 - struct nvmet_ctrl *ctrl = nvmet_req_to_ctrl(req);
1774 - struct nvmet_ns *ns;
1775 -
1776 - if ((init && req->sq->qid) || (!init && req->cq->qid)) {
1777 - ns = nvmet_find_namespace(ctrl, req->cmd->rw.nsid);
1778 - strncpy(name, ns->device_path, DISK_NAME_LEN);
1779 - return;
1780 - }
1781 -
1782 - memset(name, 0, DISK_NAME_LEN);
1783 + if (req->ns)
1784 + strncpy(name, req->ns->device_path, DISK_NAME_LEN);
1785 + else
1786 + memset(name, 0, DISK_NAME_LEN);
1787 }
1788 #endif
1789
1790 @@ -81,7 +74,7 @@ TRACE_EVENT(nvmet_req_init,
1791 TP_fast_assign(
1792 __entry->cmd = cmd;
1793 __entry->ctrl = nvmet_req_to_ctrl(req);
1794 - __assign_disk_name(__entry->disk, req, true);
1795 + __assign_req_name(__entry->disk, req);
1796 __entry->qid = req->sq->qid;
1797 __entry->cid = cmd->common.command_id;
1798 __entry->opcode = cmd->common.opcode;
1799 @@ -121,7 +114,7 @@ TRACE_EVENT(nvmet_req_complete,
1800 __entry->cid = req->cqe->command_id;
1801 __entry->result = le64_to_cpu(req->cqe->result.u64);
1802 __entry->status = le16_to_cpu(req->cqe->status) >> 1;
1803 - __assign_disk_name(__entry->disk, req, false);
1804 + __assign_req_name(__entry->disk, req);
1805 ),
1806 TP_printk("nvmet%s: %sqid=%d, cmdid=%u, res=%#llx, status=%#x",
1807 __print_ctrl_name(__entry->ctrl),
1808 diff --git a/drivers/of/of_reserved_mem.c b/drivers/of/of_reserved_mem.c
1809 index 6bd610ee2cd73..3fb5d8caffd53 100644
1810 --- a/drivers/of/of_reserved_mem.c
1811 +++ b/drivers/of/of_reserved_mem.c
1812 @@ -200,6 +200,16 @@ static int __init __rmem_cmp(const void *a, const void *b)
1813 if (ra->base > rb->base)
1814 return 1;
1815
1816 + /*
1817 + * Put the dynamic allocations (address == 0, size == 0) before static
1818 + * allocations at address 0x0 so that overlap detection works
1819 + * correctly.
1820 + */
1821 + if (ra->size < rb->size)
1822 + return -1;
1823 + if (ra->size > rb->size)
1824 + return 1;
1825 +
1826 return 0;
1827 }
1828
1829 @@ -217,8 +227,7 @@ static void __init __rmem_check_for_overlap(void)
1830
1831 this = &reserved_mem[i];
1832 next = &reserved_mem[i + 1];
1833 - if (!(this->base && next->base))
1834 - continue;
1835 +
1836 if (this->base + this->size > next->base) {
1837 phys_addr_t this_end, next_end;
1838
1839 diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
1840 index ee850cffe1542..4da2d6ad22b0b 100644
1841 --- a/drivers/regulator/core.c
1842 +++ b/drivers/regulator/core.c
1843 @@ -4045,6 +4045,8 @@ int regulator_get_voltage_rdev(struct regulator_dev *rdev)
1844 ret = rdev->desc->fixed_uV;
1845 } else if (rdev->supply) {
1846 ret = regulator_get_voltage_rdev(rdev->supply->rdev);
1847 + } else if (rdev->supply_name) {
1848 + return -EPROBE_DEFER;
1849 } else {
1850 return -EINVAL;
1851 }
1852 diff --git a/drivers/s390/crypto/pkey_api.c b/drivers/s390/crypto/pkey_api.c
1853 index 5c9898e934d96..0658aa5030c6f 100644
1854 --- a/drivers/s390/crypto/pkey_api.c
1855 +++ b/drivers/s390/crypto/pkey_api.c
1856 @@ -33,9 +33,6 @@ MODULE_DESCRIPTION("s390 protected key interface");
1857 #define KEYBLOBBUFSIZE 8192 /* key buffer size used for internal processing */
1858 #define MAXAPQNSINLIST 64 /* max 64 apqns within a apqn list */
1859
1860 -/* mask of available pckmo subfunctions, fetched once at module init */
1861 -static cpacf_mask_t pckmo_functions;
1862 -
1863 /*
1864 * debug feature data and functions
1865 */
1866 @@ -78,6 +75,9 @@ static int pkey_clr2protkey(u32 keytype,
1867 const struct pkey_clrkey *clrkey,
1868 struct pkey_protkey *protkey)
1869 {
1870 + /* mask of available pckmo subfunctions */
1871 + static cpacf_mask_t pckmo_functions;
1872 +
1873 long fc;
1874 int keysize;
1875 u8 paramblock[64];
1876 @@ -101,11 +101,13 @@ static int pkey_clr2protkey(u32 keytype,
1877 return -EINVAL;
1878 }
1879
1880 - /*
1881 - * Check if the needed pckmo subfunction is available.
1882 - * These subfunctions can be enabled/disabled by customers
1883 - * in the LPAR profile or may even change on the fly.
1884 - */
1885 + /* Did we already check for PCKMO ? */
1886 + if (!pckmo_functions.bytes[0]) {
1887 + /* no, so check now */
1888 + if (!cpacf_query(CPACF_PCKMO, &pckmo_functions))
1889 + return -ENODEV;
1890 + }
1891 + /* check for the pckmo subfunction we need now */
1892 if (!cpacf_test_func(&pckmo_functions, fc)) {
1893 DEBUG_ERR("%s pckmo functions not available\n", __func__);
1894 return -ENODEV;
1895 @@ -1504,7 +1506,7 @@ static struct miscdevice pkey_dev = {
1896 */
1897 static int __init pkey_init(void)
1898 {
1899 - cpacf_mask_t kmc_functions;
1900 + cpacf_mask_t func_mask;
1901
1902 /*
1903 * The pckmo instruction should be available - even if we don't
1904 @@ -1512,15 +1514,15 @@ static int __init pkey_init(void)
1905 * is also the minimum level for the kmc instructions which
1906 * are able to work with protected keys.
1907 */
1908 - if (!cpacf_query(CPACF_PCKMO, &pckmo_functions))
1909 + if (!cpacf_query(CPACF_PCKMO, &func_mask))
1910 return -ENODEV;
1911
1912 /* check for kmc instructions available */
1913 - if (!cpacf_query(CPACF_KMC, &kmc_functions))
1914 + if (!cpacf_query(CPACF_KMC, &func_mask))
1915 return -ENODEV;
1916 - if (!cpacf_test_func(&kmc_functions, CPACF_KMC_PAES_128) ||
1917 - !cpacf_test_func(&kmc_functions, CPACF_KMC_PAES_192) ||
1918 - !cpacf_test_func(&kmc_functions, CPACF_KMC_PAES_256))
1919 + if (!cpacf_test_func(&func_mask, CPACF_KMC_PAES_128) ||
1920 + !cpacf_test_func(&func_mask, CPACF_KMC_PAES_192) ||
1921 + !cpacf_test_func(&func_mask, CPACF_KMC_PAES_256))
1922 return -ENODEV;
1923
1924 pkey_debug_init();
1925 diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c
1926 index c5711c659b517..1ab0a61e3fb59 100644
1927 --- a/drivers/scsi/ibmvscsi/ibmvscsi.c
1928 +++ b/drivers/scsi/ibmvscsi/ibmvscsi.c
1929 @@ -806,6 +806,22 @@ static void purge_requests(struct ibmvscsi_host_data *hostdata, int error_code)
1930 spin_unlock_irqrestore(hostdata->host->host_lock, flags);
1931 }
1932
1933 +/**
1934 + * ibmvscsi_set_request_limit - Set the adapter request_limit in response to
1935 + * an adapter failure, reset, or SRP Login. Done under host lock to prevent
1936 + * race with SCSI command submission.
1937 + * @hostdata: adapter to adjust
1938 + * @limit: new request limit
1939 + */
1940 +static void ibmvscsi_set_request_limit(struct ibmvscsi_host_data *hostdata, int limit)
1941 +{
1942 + unsigned long flags;
1943 +
1944 + spin_lock_irqsave(hostdata->host->host_lock, flags);
1945 + atomic_set(&hostdata->request_limit, limit);
1946 + spin_unlock_irqrestore(hostdata->host->host_lock, flags);
1947 +}
1948 +
1949 /**
1950 * ibmvscsi_reset_host - Reset the connection to the server
1951 * @hostdata: struct ibmvscsi_host_data to reset
1952 @@ -813,7 +829,7 @@ static void purge_requests(struct ibmvscsi_host_data *hostdata, int error_code)
1953 static void ibmvscsi_reset_host(struct ibmvscsi_host_data *hostdata)
1954 {
1955 scsi_block_requests(hostdata->host);
1956 - atomic_set(&hostdata->request_limit, 0);
1957 + ibmvscsi_set_request_limit(hostdata, 0);
1958
1959 purge_requests(hostdata, DID_ERROR);
1960 hostdata->action = IBMVSCSI_HOST_ACTION_RESET;
1961 @@ -1146,13 +1162,13 @@ static void login_rsp(struct srp_event_struct *evt_struct)
1962 dev_info(hostdata->dev, "SRP_LOGIN_REJ reason %u\n",
1963 evt_struct->xfer_iu->srp.login_rej.reason);
1964 /* Login failed. */
1965 - atomic_set(&hostdata->request_limit, -1);
1966 + ibmvscsi_set_request_limit(hostdata, -1);
1967 return;
1968 default:
1969 dev_err(hostdata->dev, "Invalid login response typecode 0x%02x!\n",
1970 evt_struct->xfer_iu->srp.login_rsp.opcode);
1971 /* Login failed. */
1972 - atomic_set(&hostdata->request_limit, -1);
1973 + ibmvscsi_set_request_limit(hostdata, -1);
1974 return;
1975 }
1976
1977 @@ -1163,7 +1179,7 @@ static void login_rsp(struct srp_event_struct *evt_struct)
1978 * This value is set rather than added to request_limit because
1979 * request_limit could have been set to -1 by this client.
1980 */
1981 - atomic_set(&hostdata->request_limit,
1982 + ibmvscsi_set_request_limit(hostdata,
1983 be32_to_cpu(evt_struct->xfer_iu->srp.login_rsp.req_lim_delta));
1984
1985 /* If we had any pending I/Os, kick them */
1986 @@ -1195,13 +1211,13 @@ static int send_srp_login(struct ibmvscsi_host_data *hostdata)
1987 login->req_buf_fmt = cpu_to_be16(SRP_BUF_FORMAT_DIRECT |
1988 SRP_BUF_FORMAT_INDIRECT);
1989
1990 - spin_lock_irqsave(hostdata->host->host_lock, flags);
1991 /* Start out with a request limit of 0, since this is negotiated in
1992 * the login request we are just sending and login requests always
1993 * get sent by the driver regardless of request_limit.
1994 */
1995 - atomic_set(&hostdata->request_limit, 0);
1996 + ibmvscsi_set_request_limit(hostdata, 0);
1997
1998 + spin_lock_irqsave(hostdata->host->host_lock, flags);
1999 rc = ibmvscsi_send_srp_event(evt_struct, hostdata, login_timeout * 2);
2000 spin_unlock_irqrestore(hostdata->host->host_lock, flags);
2001 dev_info(hostdata->dev, "sent SRP login\n");
2002 @@ -1781,7 +1797,7 @@ static void ibmvscsi_handle_crq(struct viosrp_crq *crq,
2003 return;
2004 case VIOSRP_CRQ_XPORT_EVENT: /* Hypervisor telling us the connection is closed */
2005 scsi_block_requests(hostdata->host);
2006 - atomic_set(&hostdata->request_limit, 0);
2007 + ibmvscsi_set_request_limit(hostdata, 0);
2008 if (crq->format == 0x06) {
2009 /* We need to re-setup the interpartition connection */
2010 dev_info(hostdata->dev, "Re-enabling adapter!\n");
2011 @@ -2137,12 +2153,12 @@ static void ibmvscsi_do_work(struct ibmvscsi_host_data *hostdata)
2012 }
2013
2014 hostdata->action = IBMVSCSI_HOST_ACTION_NONE;
2015 + spin_unlock_irqrestore(hostdata->host->host_lock, flags);
2016
2017 if (rc) {
2018 - atomic_set(&hostdata->request_limit, -1);
2019 + ibmvscsi_set_request_limit(hostdata, -1);
2020 dev_err(hostdata->dev, "error after %s\n", action);
2021 }
2022 - spin_unlock_irqrestore(hostdata->host->host_lock, flags);
2023
2024 scsi_unblock_requests(hostdata->host);
2025 }
2026 @@ -2226,7 +2242,7 @@ static int ibmvscsi_probe(struct vio_dev *vdev, const struct vio_device_id *id)
2027 init_waitqueue_head(&hostdata->work_wait_q);
2028 hostdata->host = host;
2029 hostdata->dev = dev;
2030 - atomic_set(&hostdata->request_limit, -1);
2031 + ibmvscsi_set_request_limit(hostdata, -1);
2032 hostdata->host->max_sectors = IBMVSCSI_MAX_SECTORS_DEFAULT;
2033
2034 if (map_persist_bufs(hostdata)) {
2035 diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
2036 index 058079f915f18..79232cef1af16 100644
2037 --- a/drivers/scsi/scsi_scan.c
2038 +++ b/drivers/scsi/scsi_scan.c
2039 @@ -1715,15 +1715,16 @@ static void scsi_sysfs_add_devices(struct Scsi_Host *shost)
2040 */
2041 static struct async_scan_data *scsi_prep_async_scan(struct Scsi_Host *shost)
2042 {
2043 - struct async_scan_data *data;
2044 + struct async_scan_data *data = NULL;
2045 unsigned long flags;
2046
2047 if (strncmp(scsi_scan_type, "sync", 4) == 0)
2048 return NULL;
2049
2050 + mutex_lock(&shost->scan_mutex);
2051 if (shost->async_scan) {
2052 shost_printk(KERN_DEBUG, shost, "%s called twice\n", __func__);
2053 - return NULL;
2054 + goto err;
2055 }
2056
2057 data = kmalloc(sizeof(*data), GFP_KERNEL);
2058 @@ -1734,7 +1735,6 @@ static struct async_scan_data *scsi_prep_async_scan(struct Scsi_Host *shost)
2059 goto err;
2060 init_completion(&data->prev_finished);
2061
2062 - mutex_lock(&shost->scan_mutex);
2063 spin_lock_irqsave(shost->host_lock, flags);
2064 shost->async_scan = 1;
2065 spin_unlock_irqrestore(shost->host_lock, flags);
2066 @@ -1749,6 +1749,7 @@ static struct async_scan_data *scsi_prep_async_scan(struct Scsi_Host *shost)
2067 return data;
2068
2069 err:
2070 + mutex_unlock(&shost->scan_mutex);
2071 kfree(data);
2072 return NULL;
2073 }
2074 diff --git a/drivers/spi/spi-bcm2835.c b/drivers/spi/spi-bcm2835.c
2075 index c88f5d99c9065..cfd9176e6413c 100644
2076 --- a/drivers/spi/spi-bcm2835.c
2077 +++ b/drivers/spi/spi-bcm2835.c
2078 @@ -1245,18 +1245,6 @@ static int bcm2835_spi_setup(struct spi_device *spi)
2079 if (!chip)
2080 return 0;
2081
2082 - /*
2083 - * Retrieve the corresponding GPIO line used for CS.
2084 - * The inversion semantics will be handled by the GPIO core
2085 - * code, so we pass GPIOS_OUT_LOW for "unasserted" and
2086 - * the correct flag for inversion semantics. The SPI_CS_HIGH
2087 - * on spi->mode cannot be checked for polarity in this case
2088 - * as the flag use_gpio_descriptors enforces SPI_CS_HIGH.
2089 - */
2090 - if (of_property_read_bool(spi->dev.of_node, "spi-cs-high"))
2091 - lflags = GPIO_ACTIVE_HIGH;
2092 - else
2093 - lflags = GPIO_ACTIVE_LOW;
2094 spi->cs_gpiod = gpiochip_request_own_desc(chip, 8 - spi->chip_select,
2095 DRV_NAME,
2096 lflags,
2097 diff --git a/drivers/tty/serial/8250/8250_mtk.c b/drivers/tty/serial/8250/8250_mtk.c
2098 index 2b59a43050771..e9eb454c24728 100644
2099 --- a/drivers/tty/serial/8250/8250_mtk.c
2100 +++ b/drivers/tty/serial/8250/8250_mtk.c
2101 @@ -316,7 +316,7 @@ mtk8250_set_termios(struct uart_port *port, struct ktermios *termios,
2102 */
2103 baud = tty_termios_baud_rate(termios);
2104
2105 - serial8250_do_set_termios(port, termios, old);
2106 + serial8250_do_set_termios(port, termios, NULL);
2107
2108 tty_termios_encode_baud_rate(termios, baud, baud);
2109
2110 diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c
2111 index ec8e608b46baa..6ad985e8dc653 100644
2112 --- a/drivers/tty/serial/fsl_lpuart.c
2113 +++ b/drivers/tty/serial/fsl_lpuart.c
2114 @@ -238,6 +238,7 @@ static DEFINE_IDA(fsl_lpuart_ida);
2115 enum lpuart_type {
2116 VF610_LPUART,
2117 LS1021A_LPUART,
2118 + LS1028A_LPUART,
2119 IMX7ULP_LPUART,
2120 IMX8QXP_LPUART,
2121 };
2122 @@ -282,11 +283,16 @@ static const struct lpuart_soc_data vf_data = {
2123 .iotype = UPIO_MEM,
2124 };
2125
2126 -static const struct lpuart_soc_data ls_data = {
2127 +static const struct lpuart_soc_data ls1021a_data = {
2128 .devtype = LS1021A_LPUART,
2129 .iotype = UPIO_MEM32BE,
2130 };
2131
2132 +static const struct lpuart_soc_data ls1028a_data = {
2133 + .devtype = LS1028A_LPUART,
2134 + .iotype = UPIO_MEM32,
2135 +};
2136 +
2137 static struct lpuart_soc_data imx7ulp_data = {
2138 .devtype = IMX7ULP_LPUART,
2139 .iotype = UPIO_MEM32,
2140 @@ -301,7 +307,8 @@ static struct lpuart_soc_data imx8qxp_data = {
2141
2142 static const struct of_device_id lpuart_dt_ids[] = {
2143 { .compatible = "fsl,vf610-lpuart", .data = &vf_data, },
2144 - { .compatible = "fsl,ls1021a-lpuart", .data = &ls_data, },
2145 + { .compatible = "fsl,ls1021a-lpuart", .data = &ls1021a_data, },
2146 + { .compatible = "fsl,ls1028a-lpuart", .data = &ls1028a_data, },
2147 { .compatible = "fsl,imx7ulp-lpuart", .data = &imx7ulp_data, },
2148 { .compatible = "fsl,imx8qxp-lpuart", .data = &imx8qxp_data, },
2149 { /* sentinel */ }
2150 @@ -311,6 +318,12 @@ MODULE_DEVICE_TABLE(of, lpuart_dt_ids);
2151 /* Forward declare this for the dma callbacks*/
2152 static void lpuart_dma_tx_complete(void *arg);
2153
2154 +static inline bool is_layerscape_lpuart(struct lpuart_port *sport)
2155 +{
2156 + return (sport->devtype == LS1021A_LPUART ||
2157 + sport->devtype == LS1028A_LPUART);
2158 +}
2159 +
2160 static inline bool is_imx8qxp_lpuart(struct lpuart_port *sport)
2161 {
2162 return sport->devtype == IMX8QXP_LPUART;
2163 @@ -1553,6 +1566,17 @@ static int lpuart32_startup(struct uart_port *port)
2164 sport->rxfifo_size = UARTFIFO_DEPTH((temp >> UARTFIFO_RXSIZE_OFF) &
2165 UARTFIFO_FIFOSIZE_MASK);
2166
2167 + /*
2168 + * The LS1021A and LS1028A have a fixed FIFO depth of 16 words.
2169 + * Although they support the RX/TXSIZE fields, their encoding is
2170 + * different. Eg the reference manual states 0b101 is 16 words.
2171 + */
2172 + if (is_layerscape_lpuart(sport)) {
2173 + sport->rxfifo_size = 16;
2174 + sport->txfifo_size = 16;
2175 + sport->port.fifosize = sport->txfifo_size;
2176 + }
2177 +
2178 spin_lock_irqsave(&sport->port.lock, flags);
2179
2180 lpuart32_setup_watermark_enable(sport);
2181 diff --git a/drivers/tty/serial/serial_txx9.c b/drivers/tty/serial/serial_txx9.c
2182 index d22ccb32aa9b7..8507f18900d09 100644
2183 --- a/drivers/tty/serial/serial_txx9.c
2184 +++ b/drivers/tty/serial/serial_txx9.c
2185 @@ -1283,6 +1283,9 @@ static int __init serial_txx9_init(void)
2186
2187 #ifdef ENABLE_SERIAL_TXX9_PCI
2188 ret = pci_register_driver(&serial_txx9_pci_driver);
2189 + if (ret) {
2190 + platform_driver_unregister(&serial_txx9_plat_driver);
2191 + }
2192 #endif
2193 if (ret == 0)
2194 goto out;
2195 diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
2196 index d07a9c9c76081..c55b6d7ccaf78 100644
2197 --- a/drivers/tty/vt/vt.c
2198 +++ b/drivers/tty/vt/vt.c
2199 @@ -4620,27 +4620,6 @@ static int con_font_default(struct vc_data *vc, struct console_font_op *op)
2200 return rc;
2201 }
2202
2203 -static int con_font_copy(struct vc_data *vc, struct console_font_op *op)
2204 -{
2205 - int con = op->height;
2206 - int rc;
2207 -
2208 -
2209 - console_lock();
2210 - if (vc->vc_mode != KD_TEXT)
2211 - rc = -EINVAL;
2212 - else if (!vc->vc_sw->con_font_copy)
2213 - rc = -ENOSYS;
2214 - else if (con < 0 || !vc_cons_allocated(con))
2215 - rc = -ENOTTY;
2216 - else if (con == vc->vc_num) /* nothing to do */
2217 - rc = 0;
2218 - else
2219 - rc = vc->vc_sw->con_font_copy(vc, con);
2220 - console_unlock();
2221 - return rc;
2222 -}
2223 -
2224 int con_font_op(struct vc_data *vc, struct console_font_op *op)
2225 {
2226 switch (op->op) {
2227 @@ -4651,7 +4630,8 @@ int con_font_op(struct vc_data *vc, struct console_font_op *op)
2228 case KD_FONT_OP_SET_DEFAULT:
2229 return con_font_default(vc, op);
2230 case KD_FONT_OP_COPY:
2231 - return con_font_copy(vc, op);
2232 + /* was buggy and never really used */
2233 + return -EINVAL;
2234 }
2235 return -ENOSYS;
2236 }
2237 diff --git a/drivers/usb/cdns3/gadget.h b/drivers/usb/cdns3/gadget.h
2238 index bc4024041ef26..ec5c05454531d 100644
2239 --- a/drivers/usb/cdns3/gadget.h
2240 +++ b/drivers/usb/cdns3/gadget.h
2241 @@ -1057,7 +1057,7 @@ struct cdns3_trb {
2242 #define TRB_TDL_SS_SIZE_GET(p) (((p) & GENMASK(23, 17)) >> 17)
2243
2244 /* transfer_len bitmasks - bits 31:24 */
2245 -#define TRB_BURST_LEN(p) (((p) << 24) & GENMASK(31, 24))
2246 +#define TRB_BURST_LEN(p) ((unsigned int)((p) << 24) & GENMASK(31, 24))
2247 #define TRB_BURST_LEN_GET(p) (((p) & GENMASK(31, 24)) >> 24)
2248
2249 /* Data buffer pointer bitmasks*/
2250 diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c
2251 index 4ee8105310989..5ad14cdd97623 100644
2252 --- a/drivers/usb/core/quirks.c
2253 +++ b/drivers/usb/core/quirks.c
2254 @@ -378,6 +378,9 @@ static const struct usb_device_id usb_quirk_list[] = {
2255 { USB_DEVICE(0x0926, 0x3333), .driver_info =
2256 USB_QUIRK_CONFIG_INTF_STRINGS },
2257
2258 + /* Kingston DataTraveler 3.0 */
2259 + { USB_DEVICE(0x0951, 0x1666), .driver_info = USB_QUIRK_NO_LPM },
2260 +
2261 /* X-Rite/Gretag-Macbeth Eye-One Pro display colorimeter */
2262 { USB_DEVICE(0x0971, 0x2000), .driver_info = USB_QUIRK_NO_SET_INTF },
2263
2264 diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c
2265 index 991cab9a7491d..4de8e5f091cb9 100644
2266 --- a/drivers/usb/dwc3/ep0.c
2267 +++ b/drivers/usb/dwc3/ep0.c
2268 @@ -1058,10 +1058,11 @@ void dwc3_ep0_send_delayed_status(struct dwc3 *dwc)
2269 {
2270 unsigned int direction = !dwc->ep0_expect_in;
2271
2272 + dwc->delayed_status = false;
2273 +
2274 if (dwc->ep0state != EP0_STATUS_PHASE)
2275 return;
2276
2277 - dwc->delayed_status = false;
2278 __dwc3_ep0_do_control_status(dwc, dwc->eps[direction]);
2279 }
2280
2281 diff --git a/drivers/usb/mtu3/mtu3_gadget.c b/drivers/usb/mtu3/mtu3_gadget.c
2282 index f93732e53fd89..08db02f3172df 100644
2283 --- a/drivers/usb/mtu3/mtu3_gadget.c
2284 +++ b/drivers/usb/mtu3/mtu3_gadget.c
2285 @@ -587,6 +587,7 @@ static int mtu3_gadget_stop(struct usb_gadget *g)
2286
2287 spin_unlock_irqrestore(&mtu->lock, flags);
2288
2289 + synchronize_irq(mtu->irq);
2290 return 0;
2291 }
2292
2293 diff --git a/drivers/usb/serial/cyberjack.c b/drivers/usb/serial/cyberjack.c
2294 index ebd76ab07b722..36dd688b5795c 100644
2295 --- a/drivers/usb/serial/cyberjack.c
2296 +++ b/drivers/usb/serial/cyberjack.c
2297 @@ -357,11 +357,12 @@ static void cyberjack_write_bulk_callback(struct urb *urb)
2298 struct device *dev = &port->dev;
2299 int status = urb->status;
2300 unsigned long flags;
2301 + bool resubmitted = false;
2302
2303 - set_bit(0, &port->write_urbs_free);
2304 if (status) {
2305 dev_dbg(dev, "%s - nonzero write bulk status received: %d\n",
2306 __func__, status);
2307 + set_bit(0, &port->write_urbs_free);
2308 return;
2309 }
2310
2311 @@ -394,6 +395,8 @@ static void cyberjack_write_bulk_callback(struct urb *urb)
2312 goto exit;
2313 }
2314
2315 + resubmitted = true;
2316 +
2317 dev_dbg(dev, "%s - priv->wrsent=%d\n", __func__, priv->wrsent);
2318 dev_dbg(dev, "%s - priv->wrfilled=%d\n", __func__, priv->wrfilled);
2319
2320 @@ -410,6 +413,8 @@ static void cyberjack_write_bulk_callback(struct urb *urb)
2321
2322 exit:
2323 spin_unlock_irqrestore(&priv->lock, flags);
2324 + if (!resubmitted)
2325 + set_bit(0, &port->write_urbs_free);
2326 usb_serial_port_softint(port);
2327 }
2328
2329 diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
2330 index eb5538a44ee9d..741c72bd499a9 100644
2331 --- a/drivers/usb/serial/option.c
2332 +++ b/drivers/usb/serial/option.c
2333 @@ -250,6 +250,7 @@ static void option_instat_callback(struct urb *urb);
2334 #define QUECTEL_PRODUCT_EP06 0x0306
2335 #define QUECTEL_PRODUCT_EM12 0x0512
2336 #define QUECTEL_PRODUCT_RM500Q 0x0800
2337 +#define QUECTEL_PRODUCT_EC200T 0x6026
2338
2339 #define CMOTECH_VENDOR_ID 0x16d8
2340 #define CMOTECH_PRODUCT_6001 0x6001
2341 @@ -1117,6 +1118,7 @@ static const struct usb_device_id option_ids[] = {
2342 { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_RM500Q, 0xff, 0, 0) },
2343 { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_RM500Q, 0xff, 0xff, 0x10),
2344 .driver_info = ZLP },
2345 + { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC200T, 0xff, 0, 0) },
2346
2347 { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6001) },
2348 { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CMU_300) },
2349 @@ -1189,6 +1191,8 @@ static const struct usb_device_id option_ids[] = {
2350 .driver_info = NCTRL(0) | RSVD(1) },
2351 { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1054, 0xff), /* Telit FT980-KS */
2352 .driver_info = NCTRL(2) | RSVD(3) },
2353 + { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1055, 0xff), /* Telit FN980 (PCIe) */
2354 + .driver_info = NCTRL(0) | RSVD(1) },
2355 { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_ME910),
2356 .driver_info = NCTRL(0) | RSVD(1) | RSVD(3) },
2357 { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_ME910_DUAL_MODEM),
2358 @@ -1201,6 +1205,8 @@ static const struct usb_device_id option_ids[] = {
2359 .driver_info = NCTRL(0) },
2360 { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE910),
2361 .driver_info = NCTRL(0) | RSVD(1) | RSVD(2) },
2362 + { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1203, 0xff), /* Telit LE910Cx (RNDIS) */
2363 + .driver_info = NCTRL(2) | RSVD(3) },
2364 { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE910_USBCFG4),
2365 .driver_info = NCTRL(0) | RSVD(1) | RSVD(2) | RSVD(3) },
2366 { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE920),
2367 @@ -1215,6 +1221,10 @@ static const struct usb_device_id option_ids[] = {
2368 { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, TELIT_PRODUCT_LE920A4_1213, 0xff) },
2369 { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE920A4_1214),
2370 .driver_info = NCTRL(0) | RSVD(1) | RSVD(2) | RSVD(3) },
2371 + { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1230, 0xff), /* Telit LE910Cx (rmnet) */
2372 + .driver_info = NCTRL(0) | RSVD(1) | RSVD(2) },
2373 + { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1231, 0xff), /* Telit LE910Cx (RNDIS) */
2374 + .driver_info = NCTRL(2) | RSVD(3) },
2375 { USB_DEVICE(TELIT_VENDOR_ID, 0x1260),
2376 .driver_info = NCTRL(0) | RSVD(1) | RSVD(2) },
2377 { USB_DEVICE(TELIT_VENDOR_ID, 0x1261),
2378 diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c
2379 index 0290a22ebccf5..9e1685a30bf8d 100644
2380 --- a/fs/gfs2/glock.c
2381 +++ b/fs/gfs2/glock.c
2382 @@ -873,7 +873,8 @@ int gfs2_glock_get(struct gfs2_sbd *sdp, u64 number,
2383 out_free:
2384 kfree(gl->gl_lksb.sb_lvbptr);
2385 kmem_cache_free(cachep, gl);
2386 - atomic_dec(&sdp->sd_glock_disposal);
2387 + if (atomic_dec_and_test(&sdp->sd_glock_disposal))
2388 + wake_up(&sdp->sd_glock_wait);
2389
2390 out:
2391 return ret;
2392 diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c
2393 index bf0435dbec436..b3021d9b34a5e 100644
2394 --- a/fs/xfs/xfs_ioctl.c
2395 +++ b/fs/xfs/xfs_ioctl.c
2396 @@ -622,7 +622,6 @@ xfs_ioc_space(
2397 error = xfs_break_layouts(inode, &iolock, BREAK_UNMAP);
2398 if (error)
2399 goto out_unlock;
2400 - inode_dio_wait(inode);
2401
2402 switch (bf->l_whence) {
2403 case 0: /*SEEK_SET*/
2404 @@ -668,6 +667,31 @@ xfs_ioc_space(
2405 goto out_unlock;
2406 }
2407
2408 + /*
2409 + * Must wait for all AIO to complete before we continue as AIO can
2410 + * change the file size on completion without holding any locks we
2411 + * currently hold. We must do this first because AIO can update both
2412 + * the on disk and in memory inode sizes, and the operations that follow
2413 + * require the in-memory size to be fully up-to-date.
2414 + */
2415 + inode_dio_wait(inode);
2416 +
2417 + /*
2418 + * Now that AIO and DIO has drained we can flush and (if necessary)
2419 + * invalidate the cached range over the first operation we are about to
2420 + * run. We include zero range here because it starts with a hole punch
2421 + * over the target range.
2422 + */
2423 + switch (cmd) {
2424 + case XFS_IOC_ZERO_RANGE:
2425 + case XFS_IOC_UNRESVSP:
2426 + case XFS_IOC_UNRESVSP64:
2427 + error = xfs_flush_unmap_range(ip, bf->l_start, bf->l_len);
2428 + if (error)
2429 + goto out_unlock;
2430 + break;
2431 + }
2432 +
2433 switch (cmd) {
2434 case XFS_IOC_ZERO_RANGE:
2435 flags |= XFS_PREALLOC_SET;
2436 diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h
2437 index 6fd08cf04add7..ea39a0b54c637 100644
2438 --- a/include/asm-generic/pgtable.h
2439 +++ b/include/asm-generic/pgtable.h
2440 @@ -1159,10 +1159,6 @@ static inline bool arch_has_pfn_modify_check(void)
2441
2442 #endif /* !__ASSEMBLY__ */
2443
2444 -#ifndef io_remap_pfn_range
2445 -#define io_remap_pfn_range remap_pfn_range
2446 -#endif
2447 -
2448 #ifndef has_transparent_hugepage
2449 #ifdef CONFIG_TRANSPARENT_HUGEPAGE
2450 #define has_transparent_hugepage() 1
2451 diff --git a/include/linux/linkage.h b/include/linux/linkage.h
2452 index 7e020782ade22..f3ae8f3dea2c7 100644
2453 --- a/include/linux/linkage.h
2454 +++ b/include/linux/linkage.h
2455 @@ -75,32 +75,58 @@
2456
2457 #ifdef __ASSEMBLY__
2458
2459 +/* SYM_T_FUNC -- type used by assembler to mark functions */
2460 +#ifndef SYM_T_FUNC
2461 +#define SYM_T_FUNC STT_FUNC
2462 +#endif
2463 +
2464 +/* SYM_T_OBJECT -- type used by assembler to mark data */
2465 +#ifndef SYM_T_OBJECT
2466 +#define SYM_T_OBJECT STT_OBJECT
2467 +#endif
2468 +
2469 +/* SYM_T_NONE -- type used by assembler to mark entries of unknown type */
2470 +#ifndef SYM_T_NONE
2471 +#define SYM_T_NONE STT_NOTYPE
2472 +#endif
2473 +
2474 +/* SYM_A_* -- align the symbol? */
2475 +#define SYM_A_ALIGN ALIGN
2476 +#define SYM_A_NONE /* nothing */
2477 +
2478 +/* SYM_L_* -- linkage of symbols */
2479 +#define SYM_L_GLOBAL(name) .globl name
2480 +#define SYM_L_WEAK(name) .weak name
2481 +#define SYM_L_LOCAL(name) /* nothing */
2482 +
2483 #ifndef LINKER_SCRIPT
2484 #define ALIGN __ALIGN
2485 #define ALIGN_STR __ALIGN_STR
2486
2487 +/* === DEPRECATED annotations === */
2488 +
2489 #ifndef GLOBAL
2490 +/* deprecated, use SYM_DATA*, SYM_ENTRY, or similar */
2491 #define GLOBAL(name) \
2492 .globl name ASM_NL \
2493 name:
2494 #endif
2495
2496 #ifndef ENTRY
2497 +/* deprecated, use SYM_FUNC_START */
2498 #define ENTRY(name) \
2499 - .globl name ASM_NL \
2500 - ALIGN ASM_NL \
2501 - name:
2502 + SYM_FUNC_START(name)
2503 #endif
2504 #endif /* LINKER_SCRIPT */
2505
2506 #ifndef WEAK
2507 +/* deprecated, use SYM_FUNC_START_WEAK* */
2508 #define WEAK(name) \
2509 - .weak name ASM_NL \
2510 - ALIGN ASM_NL \
2511 - name:
2512 + SYM_FUNC_START_WEAK(name)
2513 #endif
2514
2515 #ifndef END
2516 +/* deprecated, use SYM_FUNC_END, SYM_DATA_END, or SYM_END */
2517 #define END(name) \
2518 .size name, .-name
2519 #endif
2520 @@ -110,11 +136,214 @@
2521 * static analysis tools such as stack depth analyzer.
2522 */
2523 #ifndef ENDPROC
2524 +/* deprecated, use SYM_FUNC_END */
2525 #define ENDPROC(name) \
2526 - .type name, @function ASM_NL \
2527 - END(name)
2528 + SYM_FUNC_END(name)
2529 +#endif
2530 +
2531 +/* === generic annotations === */
2532 +
2533 +/* SYM_ENTRY -- use only if you have to for non-paired symbols */
2534 +#ifndef SYM_ENTRY
2535 +#define SYM_ENTRY(name, linkage, align...) \
2536 + linkage(name) ASM_NL \
2537 + align ASM_NL \
2538 + name:
2539 +#endif
2540 +
2541 +/* SYM_START -- use only if you have to */
2542 +#ifndef SYM_START
2543 +#define SYM_START(name, linkage, align...) \
2544 + SYM_ENTRY(name, linkage, align)
2545 +#endif
2546 +
2547 +/* SYM_END -- use only if you have to */
2548 +#ifndef SYM_END
2549 +#define SYM_END(name, sym_type) \
2550 + .type name sym_type ASM_NL \
2551 + .size name, .-name
2552 +#endif
2553 +
2554 +/* === code annotations === */
2555 +
2556 +/*
2557 + * FUNC -- C-like functions (proper stack frame etc.)
2558 + * CODE -- non-C code (e.g. irq handlers with different, special stack etc.)
2559 + *
2560 + * Objtool validates stack for FUNC, but not for CODE.
2561 + * Objtool generates debug info for both FUNC & CODE, but needs special
2562 + * annotations for each CODE's start (to describe the actual stack frame).
2563 + *
2564 + * ALIAS -- does not generate debug info -- the aliased function will
2565 + */
2566 +
2567 +/* SYM_INNER_LABEL_ALIGN -- only for labels in the middle of code */
2568 +#ifndef SYM_INNER_LABEL_ALIGN
2569 +#define SYM_INNER_LABEL_ALIGN(name, linkage) \
2570 + .type name SYM_T_NONE ASM_NL \
2571 + SYM_ENTRY(name, linkage, SYM_A_ALIGN)
2572 +#endif
2573 +
2574 +/* SYM_INNER_LABEL -- only for labels in the middle of code */
2575 +#ifndef SYM_INNER_LABEL
2576 +#define SYM_INNER_LABEL(name, linkage) \
2577 + .type name SYM_T_NONE ASM_NL \
2578 + SYM_ENTRY(name, linkage, SYM_A_NONE)
2579 +#endif
2580 +
2581 +/*
2582 + * SYM_FUNC_START_LOCAL_ALIAS -- use where there are two local names for one
2583 + * function
2584 + */
2585 +#ifndef SYM_FUNC_START_LOCAL_ALIAS
2586 +#define SYM_FUNC_START_LOCAL_ALIAS(name) \
2587 + SYM_START(name, SYM_L_LOCAL, SYM_A_ALIGN)
2588 +#endif
2589 +
2590 +/*
2591 + * SYM_FUNC_START_ALIAS -- use where there are two global names for one
2592 + * function
2593 + */
2594 +#ifndef SYM_FUNC_START_ALIAS
2595 +#define SYM_FUNC_START_ALIAS(name) \
2596 + SYM_START(name, SYM_L_GLOBAL, SYM_A_ALIGN)
2597 +#endif
2598 +
2599 +/* SYM_FUNC_START -- use for global functions */
2600 +#ifndef SYM_FUNC_START
2601 +/*
2602 + * The same as SYM_FUNC_START_ALIAS, but we will need to distinguish these two
2603 + * later.
2604 + */
2605 +#define SYM_FUNC_START(name) \
2606 + SYM_START(name, SYM_L_GLOBAL, SYM_A_ALIGN)
2607 +#endif
2608 +
2609 +/* SYM_FUNC_START_NOALIGN -- use for global functions, w/o alignment */
2610 +#ifndef SYM_FUNC_START_NOALIGN
2611 +#define SYM_FUNC_START_NOALIGN(name) \
2612 + SYM_START(name, SYM_L_GLOBAL, SYM_A_NONE)
2613 +#endif
2614 +
2615 +/* SYM_FUNC_START_LOCAL -- use for local functions */
2616 +#ifndef SYM_FUNC_START_LOCAL
2617 +/* the same as SYM_FUNC_START_LOCAL_ALIAS, see comment near SYM_FUNC_START */
2618 +#define SYM_FUNC_START_LOCAL(name) \
2619 + SYM_START(name, SYM_L_LOCAL, SYM_A_ALIGN)
2620 #endif
2621
2622 +/* SYM_FUNC_START_LOCAL_NOALIGN -- use for local functions, w/o alignment */
2623 +#ifndef SYM_FUNC_START_LOCAL_NOALIGN
2624 +#define SYM_FUNC_START_LOCAL_NOALIGN(name) \
2625 + SYM_START(name, SYM_L_LOCAL, SYM_A_NONE)
2626 #endif
2627
2628 +/* SYM_FUNC_START_WEAK -- use for weak functions */
2629 +#ifndef SYM_FUNC_START_WEAK
2630 +#define SYM_FUNC_START_WEAK(name) \
2631 + SYM_START(name, SYM_L_WEAK, SYM_A_ALIGN)
2632 #endif
2633 +
2634 +/* SYM_FUNC_START_WEAK_NOALIGN -- use for weak functions, w/o alignment */
2635 +#ifndef SYM_FUNC_START_WEAK_NOALIGN
2636 +#define SYM_FUNC_START_WEAK_NOALIGN(name) \
2637 + SYM_START(name, SYM_L_WEAK, SYM_A_NONE)
2638 +#endif
2639 +
2640 +/* SYM_FUNC_END_ALIAS -- the end of LOCAL_ALIASed or ALIASed function */
2641 +#ifndef SYM_FUNC_END_ALIAS
2642 +#define SYM_FUNC_END_ALIAS(name) \
2643 + SYM_END(name, SYM_T_FUNC)
2644 +#endif
2645 +
2646 +/*
2647 + * SYM_FUNC_END -- the end of SYM_FUNC_START_LOCAL, SYM_FUNC_START,
2648 + * SYM_FUNC_START_WEAK, ...
2649 + */
2650 +#ifndef SYM_FUNC_END
2651 +/* the same as SYM_FUNC_END_ALIAS, see comment near SYM_FUNC_START */
2652 +#define SYM_FUNC_END(name) \
2653 + SYM_END(name, SYM_T_FUNC)
2654 +#endif
2655 +
2656 +/* SYM_CODE_START -- use for non-C (special) functions */
2657 +#ifndef SYM_CODE_START
2658 +#define SYM_CODE_START(name) \
2659 + SYM_START(name, SYM_L_GLOBAL, SYM_A_ALIGN)
2660 +#endif
2661 +
2662 +/* SYM_CODE_START_NOALIGN -- use for non-C (special) functions, w/o alignment */
2663 +#ifndef SYM_CODE_START_NOALIGN
2664 +#define SYM_CODE_START_NOALIGN(name) \
2665 + SYM_START(name, SYM_L_GLOBAL, SYM_A_NONE)
2666 +#endif
2667 +
2668 +/* SYM_CODE_START_LOCAL -- use for local non-C (special) functions */
2669 +#ifndef SYM_CODE_START_LOCAL
2670 +#define SYM_CODE_START_LOCAL(name) \
2671 + SYM_START(name, SYM_L_LOCAL, SYM_A_ALIGN)
2672 +#endif
2673 +
2674 +/*
2675 + * SYM_CODE_START_LOCAL_NOALIGN -- use for local non-C (special) functions,
2676 + * w/o alignment
2677 + */
2678 +#ifndef SYM_CODE_START_LOCAL_NOALIGN
2679 +#define SYM_CODE_START_LOCAL_NOALIGN(name) \
2680 + SYM_START(name, SYM_L_LOCAL, SYM_A_NONE)
2681 +#endif
2682 +
2683 +/* SYM_CODE_END -- the end of SYM_CODE_START_LOCAL, SYM_CODE_START, ... */
2684 +#ifndef SYM_CODE_END
2685 +#define SYM_CODE_END(name) \
2686 + SYM_END(name, SYM_T_NONE)
2687 +#endif
2688 +
2689 +/* === data annotations === */
2690 +
2691 +/* SYM_DATA_START -- global data symbol */
2692 +#ifndef SYM_DATA_START
2693 +#define SYM_DATA_START(name) \
2694 + SYM_START(name, SYM_L_GLOBAL, SYM_A_NONE)
2695 +#endif
2696 +
2697 +/* SYM_DATA_START -- local data symbol */
2698 +#ifndef SYM_DATA_START_LOCAL
2699 +#define SYM_DATA_START_LOCAL(name) \
2700 + SYM_START(name, SYM_L_LOCAL, SYM_A_NONE)
2701 +#endif
2702 +
2703 +/* SYM_DATA_END -- the end of SYM_DATA_START symbol */
2704 +#ifndef SYM_DATA_END
2705 +#define SYM_DATA_END(name) \
2706 + SYM_END(name, SYM_T_OBJECT)
2707 +#endif
2708 +
2709 +/* SYM_DATA_END_LABEL -- the labeled end of SYM_DATA_START symbol */
2710 +#ifndef SYM_DATA_END_LABEL
2711 +#define SYM_DATA_END_LABEL(name, linkage, label) \
2712 + linkage(label) ASM_NL \
2713 + .type label SYM_T_OBJECT ASM_NL \
2714 + label: \
2715 + SYM_END(name, SYM_T_OBJECT)
2716 +#endif
2717 +
2718 +/* SYM_DATA -- start+end wrapper around simple global data */
2719 +#ifndef SYM_DATA
2720 +#define SYM_DATA(name, data...) \
2721 + SYM_DATA_START(name) ASM_NL \
2722 + data ASM_NL \
2723 + SYM_DATA_END(name)
2724 +#endif
2725 +
2726 +/* SYM_DATA_LOCAL -- start+end wrapper around simple local data */
2727 +#ifndef SYM_DATA_LOCAL
2728 +#define SYM_DATA_LOCAL(name, data...) \
2729 + SYM_DATA_START_LOCAL(name) ASM_NL \
2730 + data ASM_NL \
2731 + SYM_DATA_END(name)
2732 +#endif
2733 +
2734 +#endif /* __ASSEMBLY__ */
2735 +
2736 +#endif /* _LINUX_LINKAGE_H */
2737 diff --git a/include/linux/mm.h b/include/linux/mm.h
2738 index 34119f393a802..7249cf58f78d1 100644
2739 --- a/include/linux/mm.h
2740 +++ b/include/linux/mm.h
2741 @@ -2572,6 +2572,15 @@ static inline vm_fault_t vmf_insert_page(struct vm_area_struct *vma,
2742 return VM_FAULT_NOPAGE;
2743 }
2744
2745 +#ifndef io_remap_pfn_range
2746 +static inline int io_remap_pfn_range(struct vm_area_struct *vma,
2747 + unsigned long addr, unsigned long pfn,
2748 + unsigned long size, pgprot_t prot)
2749 +{
2750 + return remap_pfn_range(vma, addr, pfn, size, pgprot_decrypted(prot));
2751 +}
2752 +#endif
2753 +
2754 static inline vm_fault_t vmf_error(int err)
2755 {
2756 if (err == -ENOMEM)
2757 diff --git a/include/linux/pm_runtime.h b/include/linux/pm_runtime.h
2758 index 22af69d237a65..fe61e3b9a9ca2 100644
2759 --- a/include/linux/pm_runtime.h
2760 +++ b/include/linux/pm_runtime.h
2761 @@ -54,11 +54,10 @@ extern u64 pm_runtime_autosuspend_expiration(struct device *dev);
2762 extern void pm_runtime_update_max_time_suspended(struct device *dev,
2763 s64 delta_ns);
2764 extern void pm_runtime_set_memalloc_noio(struct device *dev, bool enable);
2765 -extern void pm_runtime_clean_up_links(struct device *dev);
2766 extern void pm_runtime_get_suppliers(struct device *dev);
2767 extern void pm_runtime_put_suppliers(struct device *dev);
2768 extern void pm_runtime_new_link(struct device *dev);
2769 -extern void pm_runtime_drop_link(struct device *dev);
2770 +extern void pm_runtime_drop_link(struct device_link *link);
2771
2772 static inline void pm_suspend_ignore_children(struct device *dev, bool enable)
2773 {
2774 @@ -173,11 +172,10 @@ static inline u64 pm_runtime_autosuspend_expiration(
2775 struct device *dev) { return 0; }
2776 static inline void pm_runtime_set_memalloc_noio(struct device *dev,
2777 bool enable){}
2778 -static inline void pm_runtime_clean_up_links(struct device *dev) {}
2779 static inline void pm_runtime_get_suppliers(struct device *dev) {}
2780 static inline void pm_runtime_put_suppliers(struct device *dev) {}
2781 static inline void pm_runtime_new_link(struct device *dev) {}
2782 -static inline void pm_runtime_drop_link(struct device *dev) {}
2783 +static inline void pm_runtime_drop_link(struct device_link *link) {}
2784
2785 #endif /* !CONFIG_PM */
2786
2787 diff --git a/kernel/events/core.c b/kernel/events/core.c
2788 index 09e1cc22221fe..1b60f9c508c9a 100644
2789 --- a/kernel/events/core.c
2790 +++ b/kernel/events/core.c
2791 @@ -9415,6 +9415,7 @@ perf_event_parse_addr_filter(struct perf_event *event, char *fstr,
2792 if (token == IF_SRC_FILE || token == IF_SRC_FILEADDR) {
2793 int fpos = token == IF_SRC_FILE ? 2 : 1;
2794
2795 + kfree(filename);
2796 filename = match_strdup(&args[fpos]);
2797 if (!filename) {
2798 ret = -ENOMEM;
2799 @@ -9461,16 +9462,13 @@ perf_event_parse_addr_filter(struct perf_event *event, char *fstr,
2800 */
2801 ret = -EOPNOTSUPP;
2802 if (!event->ctx->task)
2803 - goto fail_free_name;
2804 + goto fail;
2805
2806 /* look up the path and grab its inode */
2807 ret = kern_path(filename, LOOKUP_FOLLOW,
2808 &filter->path);
2809 if (ret)
2810 - goto fail_free_name;
2811 -
2812 - kfree(filename);
2813 - filename = NULL;
2814 + goto fail;
2815
2816 ret = -EINVAL;
2817 if (!filter->path.dentry ||
2818 @@ -9490,13 +9488,13 @@ perf_event_parse_addr_filter(struct perf_event *event, char *fstr,
2819 if (state != IF_STATE_ACTION)
2820 goto fail;
2821
2822 + kfree(filename);
2823 kfree(orig);
2824
2825 return 0;
2826
2827 -fail_free_name:
2828 - kfree(filename);
2829 fail:
2830 + kfree(filename);
2831 free_filters_list(filters);
2832 kfree(orig);
2833
2834 diff --git a/kernel/fork.c b/kernel/fork.c
2835 index e3d5963d8c6f5..419fff8eb9e55 100644
2836 --- a/kernel/fork.c
2837 +++ b/kernel/fork.c
2838 @@ -2100,14 +2100,9 @@ static __latent_entropy struct task_struct *copy_process(
2839 /* ok, now we should be set up.. */
2840 p->pid = pid_nr(pid);
2841 if (clone_flags & CLONE_THREAD) {
2842 - p->exit_signal = -1;
2843 p->group_leader = current->group_leader;
2844 p->tgid = current->tgid;
2845 } else {
2846 - if (clone_flags & CLONE_PARENT)
2847 - p->exit_signal = current->group_leader->exit_signal;
2848 - else
2849 - p->exit_signal = args->exit_signal;
2850 p->group_leader = p;
2851 p->tgid = p->pid;
2852 }
2853 @@ -2152,9 +2147,14 @@ static __latent_entropy struct task_struct *copy_process(
2854 if (clone_flags & (CLONE_PARENT|CLONE_THREAD)) {
2855 p->real_parent = current->real_parent;
2856 p->parent_exec_id = current->parent_exec_id;
2857 + if (clone_flags & CLONE_THREAD)
2858 + p->exit_signal = -1;
2859 + else
2860 + p->exit_signal = current->group_leader->exit_signal;
2861 } else {
2862 p->real_parent = current;
2863 p->parent_exec_id = current->self_exec_id;
2864 + p->exit_signal = args->exit_signal;
2865 }
2866
2867 klp_copy_process(p);
2868 diff --git a/kernel/futex.c b/kernel/futex.c
2869 index 17fba7a986e0f..9c4f9b868a491 100644
2870 --- a/kernel/futex.c
2871 +++ b/kernel/futex.c
2872 @@ -2511,10 +2511,22 @@ retry:
2873 }
2874
2875 /*
2876 - * Since we just failed the trylock; there must be an owner.
2877 + * The trylock just failed, so either there is an owner or
2878 + * there is a higher priority waiter than this one.
2879 */
2880 newowner = rt_mutex_owner(&pi_state->pi_mutex);
2881 - BUG_ON(!newowner);
2882 + /*
2883 + * If the higher priority waiter has not yet taken over the
2884 + * rtmutex then newowner is NULL. We can't return here with
2885 + * that state because it's inconsistent vs. the user space
2886 + * state. So drop the locks and try again. It's a valid
2887 + * situation and not any different from the other retry
2888 + * conditions.
2889 + */
2890 + if (unlikely(!newowner)) {
2891 + err = -EAGAIN;
2892 + goto handle_err;
2893 + }
2894 } else {
2895 WARN_ON_ONCE(argowner != current);
2896 if (oldowner == current) {
2897 diff --git a/kernel/kthread.c b/kernel/kthread.c
2898 index bfbfa481be3a5..e51f0006057df 100644
2899 --- a/kernel/kthread.c
2900 +++ b/kernel/kthread.c
2901 @@ -873,7 +873,8 @@ void kthread_delayed_work_timer_fn(struct timer_list *t)
2902 /* Move the work from worker->delayed_work_list. */
2903 WARN_ON_ONCE(list_empty(&work->node));
2904 list_del_init(&work->node);
2905 - kthread_insert_work(worker, work, &worker->work_list);
2906 + if (!work->canceling)
2907 + kthread_insert_work(worker, work, &worker->work_list);
2908
2909 raw_spin_unlock_irqrestore(&worker->lock, flags);
2910 }
2911 diff --git a/kernel/signal.c b/kernel/signal.c
2912 index 595a36ab87d02..8c97fc72d78bd 100644
2913 --- a/kernel/signal.c
2914 +++ b/kernel/signal.c
2915 @@ -391,16 +391,17 @@ static bool task_participate_group_stop(struct task_struct *task)
2916
2917 void task_join_group_stop(struct task_struct *task)
2918 {
2919 + unsigned long mask = current->jobctl & JOBCTL_STOP_SIGMASK;
2920 + struct signal_struct *sig = current->signal;
2921 +
2922 + if (sig->group_stop_count) {
2923 + sig->group_stop_count++;
2924 + mask |= JOBCTL_STOP_CONSUME;
2925 + } else if (!(sig->flags & SIGNAL_STOP_STOPPED))
2926 + return;
2927 +
2928 /* Have the new thread join an on-going signal group stop */
2929 - unsigned long jobctl = current->jobctl;
2930 - if (jobctl & JOBCTL_STOP_PENDING) {
2931 - struct signal_struct *sig = current->signal;
2932 - unsigned long signr = jobctl & JOBCTL_STOP_SIGMASK;
2933 - unsigned long gstop = JOBCTL_STOP_PENDING | JOBCTL_STOP_CONSUME;
2934 - if (task_set_jobctl_pending(task, signr | gstop)) {
2935 - sig->group_stop_count++;
2936 - }
2937 - }
2938 + task_set_jobctl_pending(task, mask | JOBCTL_STOP_PENDING);
2939 }
2940
2941 /*
2942 diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
2943 index 67cdb401c6ce5..6e5c6b023dc32 100644
2944 --- a/kernel/trace/ring_buffer.c
2945 +++ b/kernel/trace/ring_buffer.c
2946 @@ -422,14 +422,16 @@ struct rb_event_info {
2947
2948 /*
2949 * Used for which event context the event is in.
2950 - * NMI = 0
2951 - * IRQ = 1
2952 - * SOFTIRQ = 2
2953 - * NORMAL = 3
2954 + * TRANSITION = 0
2955 + * NMI = 1
2956 + * IRQ = 2
2957 + * SOFTIRQ = 3
2958 + * NORMAL = 4
2959 *
2960 * See trace_recursive_lock() comment below for more details.
2961 */
2962 enum {
2963 + RB_CTX_TRANSITION,
2964 RB_CTX_NMI,
2965 RB_CTX_IRQ,
2966 RB_CTX_SOFTIRQ,
2967 @@ -2660,10 +2662,10 @@ rb_wakeups(struct ring_buffer *buffer, struct ring_buffer_per_cpu *cpu_buffer)
2968 * a bit of overhead in something as critical as function tracing,
2969 * we use a bitmask trick.
2970 *
2971 - * bit 0 = NMI context
2972 - * bit 1 = IRQ context
2973 - * bit 2 = SoftIRQ context
2974 - * bit 3 = normal context.
2975 + * bit 1 = NMI context
2976 + * bit 2 = IRQ context
2977 + * bit 3 = SoftIRQ context
2978 + * bit 4 = normal context.
2979 *
2980 * This works because this is the order of contexts that can
2981 * preempt other contexts. A SoftIRQ never preempts an IRQ
2982 @@ -2686,6 +2688,30 @@ rb_wakeups(struct ring_buffer *buffer, struct ring_buffer_per_cpu *cpu_buffer)
2983 * The least significant bit can be cleared this way, and it
2984 * just so happens that it is the same bit corresponding to
2985 * the current context.
2986 + *
2987 + * Now the TRANSITION bit breaks the above slightly. The TRANSITION bit
2988 + * is set when a recursion is detected at the current context, and if
2989 + * the TRANSITION bit is already set, it will fail the recursion.
2990 + * This is needed because there's a lag between the changing of
2991 + * interrupt context and updating the preempt count. In this case,
2992 + * a false positive will be found. To handle this, one extra recursion
2993 + * is allowed, and this is done by the TRANSITION bit. If the TRANSITION
2994 + * bit is already set, then it is considered a recursion and the function
2995 + * ends. Otherwise, the TRANSITION bit is set, and that bit is returned.
2996 + *
2997 + * On the trace_recursive_unlock(), the TRANSITION bit will be the first
2998 + * to be cleared. Even if it wasn't the context that set it. That is,
2999 + * if an interrupt comes in while NORMAL bit is set and the ring buffer
3000 + * is called before preempt_count() is updated, since the check will
3001 + * be on the NORMAL bit, the TRANSITION bit will then be set. If an
3002 + * NMI then comes in, it will set the NMI bit, but when the NMI code
3003 + * does the trace_recursive_unlock() it will clear the TRANSTION bit
3004 + * and leave the NMI bit set. But this is fine, because the interrupt
3005 + * code that set the TRANSITION bit will then clear the NMI bit when it
3006 + * calls trace_recursive_unlock(). If another NMI comes in, it will
3007 + * set the TRANSITION bit and continue.
3008 + *
3009 + * Note: The TRANSITION bit only handles a single transition between context.
3010 */
3011
3012 static __always_inline int
3013 @@ -2701,8 +2727,16 @@ trace_recursive_lock(struct ring_buffer_per_cpu *cpu_buffer)
3014 bit = pc & NMI_MASK ? RB_CTX_NMI :
3015 pc & HARDIRQ_MASK ? RB_CTX_IRQ : RB_CTX_SOFTIRQ;
3016
3017 - if (unlikely(val & (1 << (bit + cpu_buffer->nest))))
3018 - return 1;
3019 + if (unlikely(val & (1 << (bit + cpu_buffer->nest)))) {
3020 + /*
3021 + * It is possible that this was called by transitioning
3022 + * between interrupt context, and preempt_count() has not
3023 + * been updated yet. In this case, use the TRANSITION bit.
3024 + */
3025 + bit = RB_CTX_TRANSITION;
3026 + if (val & (1 << (bit + cpu_buffer->nest)))
3027 + return 1;
3028 + }
3029
3030 val |= (1 << (bit + cpu_buffer->nest));
3031 cpu_buffer->current_context = val;
3032 @@ -2717,8 +2751,8 @@ trace_recursive_unlock(struct ring_buffer_per_cpu *cpu_buffer)
3033 cpu_buffer->current_context - (1 << cpu_buffer->nest);
3034 }
3035
3036 -/* The recursive locking above uses 4 bits */
3037 -#define NESTED_BITS 4
3038 +/* The recursive locking above uses 5 bits */
3039 +#define NESTED_BITS 5
3040
3041 /**
3042 * ring_buffer_nest_start - Allow to trace while nested
3043 diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
3044 index 5b2a664812b10..2a357bda45cf0 100644
3045 --- a/kernel/trace/trace.c
3046 +++ b/kernel/trace/trace.c
3047 @@ -3012,7 +3012,7 @@ static char *get_trace_buf(void)
3048
3049 /* Interrupts must see nesting incremented before we use the buffer */
3050 barrier();
3051 - return &buffer->buffer[buffer->nesting][0];
3052 + return &buffer->buffer[buffer->nesting - 1][0];
3053 }
3054
3055 static void put_trace_buf(void)
3056 diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
3057 index 4055158c1dd25..fc3aa81a43e3c 100644
3058 --- a/kernel/trace/trace.h
3059 +++ b/kernel/trace/trace.h
3060 @@ -592,6 +592,12 @@ enum {
3061 * function is called to clear it.
3062 */
3063 TRACE_GRAPH_NOTRACE_BIT,
3064 +
3065 + /*
3066 + * When transitioning between context, the preempt_count() may
3067 + * not be correct. Allow for a single recursion to cover this case.
3068 + */
3069 + TRACE_TRANSITION_BIT,
3070 };
3071
3072 #define trace_recursion_set(bit) do { (current)->trace_recursion |= (1<<(bit)); } while (0)
3073 @@ -646,14 +652,27 @@ static __always_inline int trace_test_and_set_recursion(int start, int max)
3074 return 0;
3075
3076 bit = trace_get_context_bit() + start;
3077 - if (unlikely(val & (1 << bit)))
3078 - return -1;
3079 + if (unlikely(val & (1 << bit))) {
3080 + /*
3081 + * It could be that preempt_count has not been updated during
3082 + * a switch between contexts. Allow for a single recursion.
3083 + */
3084 + bit = TRACE_TRANSITION_BIT;
3085 + if (trace_recursion_test(bit))
3086 + return -1;
3087 + trace_recursion_set(bit);
3088 + barrier();
3089 + return bit + 1;
3090 + }
3091 +
3092 + /* Normal check passed, clear the transition to allow it again */
3093 + trace_recursion_clear(TRACE_TRANSITION_BIT);
3094
3095 val |= 1 << bit;
3096 current->trace_recursion = val;
3097 barrier();
3098
3099 - return bit;
3100 + return bit + 1;
3101 }
3102
3103 static __always_inline void trace_clear_recursion(int bit)
3104 @@ -663,6 +682,7 @@ static __always_inline void trace_clear_recursion(int bit)
3105 if (!bit)
3106 return;
3107
3108 + bit--;
3109 bit = 1 << bit;
3110 val &= ~bit;
3111
3112 diff --git a/kernel/trace/trace_selftest.c b/kernel/trace/trace_selftest.c
3113 index 69ee8ef12cee3..0838c290ac7f3 100644
3114 --- a/kernel/trace/trace_selftest.c
3115 +++ b/kernel/trace/trace_selftest.c
3116 @@ -492,8 +492,13 @@ trace_selftest_function_recursion(void)
3117 unregister_ftrace_function(&test_rec_probe);
3118
3119 ret = -1;
3120 - if (trace_selftest_recursion_cnt != 1) {
3121 - pr_cont("*callback not called once (%d)* ",
3122 + /*
3123 + * Recursion allows for transitions between context,
3124 + * and may call the callback twice.
3125 + */
3126 + if (trace_selftest_recursion_cnt != 1 &&
3127 + trace_selftest_recursion_cnt != 2) {
3128 + pr_cont("*callback not called once (or twice) (%d)* ",
3129 trace_selftest_recursion_cnt);
3130 goto out;
3131 }
3132 diff --git a/lib/crc32test.c b/lib/crc32test.c
3133 index 97d6a57cefcc5..61ddce2cff777 100644
3134 --- a/lib/crc32test.c
3135 +++ b/lib/crc32test.c
3136 @@ -683,7 +683,6 @@ static int __init crc32c_test(void)
3137
3138 /* reduce OS noise */
3139 local_irq_save(flags);
3140 - local_irq_disable();
3141
3142 nsec = ktime_get_ns();
3143 for (i = 0; i < 100; i++) {
3144 @@ -694,7 +693,6 @@ static int __init crc32c_test(void)
3145 nsec = ktime_get_ns() - nsec;
3146
3147 local_irq_restore(flags);
3148 - local_irq_enable();
3149
3150 pr_info("crc32c: CRC_LE_BITS = %d\n", CRC_LE_BITS);
3151
3152 @@ -768,7 +766,6 @@ static int __init crc32_test(void)
3153
3154 /* reduce OS noise */
3155 local_irq_save(flags);
3156 - local_irq_disable();
3157
3158 nsec = ktime_get_ns();
3159 for (i = 0; i < 100; i++) {
3160 @@ -783,7 +780,6 @@ static int __init crc32_test(void)
3161 nsec = ktime_get_ns() - nsec;
3162
3163 local_irq_restore(flags);
3164 - local_irq_enable();
3165
3166 pr_info("crc32: CRC_LE_BITS = %d, CRC_BE BITS = %d\n",
3167 CRC_LE_BITS, CRC_BE_BITS);
3168 diff --git a/lib/fonts/font_10x18.c b/lib/fonts/font_10x18.c
3169 index 0e2deac97da0d..e02f9df24d1ee 100644
3170 --- a/lib/fonts/font_10x18.c
3171 +++ b/lib/fonts/font_10x18.c
3172 @@ -8,7 +8,7 @@
3173
3174 #define FONTDATAMAX 9216
3175
3176 -static struct font_data fontdata_10x18 = {
3177 +static const struct font_data fontdata_10x18 = {
3178 { 0, 0, FONTDATAMAX, 0 }, {
3179 /* 0 0x00 '^@' */
3180 0x00, 0x00, /* 0000000000 */
3181 diff --git a/lib/fonts/font_6x10.c b/lib/fonts/font_6x10.c
3182 index 87da8acd07db0..6e3c4b7691c85 100644
3183 --- a/lib/fonts/font_6x10.c
3184 +++ b/lib/fonts/font_6x10.c
3185 @@ -3,7 +3,7 @@
3186
3187 #define FONTDATAMAX 2560
3188
3189 -static struct font_data fontdata_6x10 = {
3190 +static const struct font_data fontdata_6x10 = {
3191 { 0, 0, FONTDATAMAX, 0 }, {
3192 /* 0 0x00 '^@' */
3193 0x00, /* 00000000 */
3194 diff --git a/lib/fonts/font_6x11.c b/lib/fonts/font_6x11.c
3195 index 5e975dfa10a53..2d22a24e816f0 100644
3196 --- a/lib/fonts/font_6x11.c
3197 +++ b/lib/fonts/font_6x11.c
3198 @@ -9,7 +9,7 @@
3199
3200 #define FONTDATAMAX (11*256)
3201
3202 -static struct font_data fontdata_6x11 = {
3203 +static const struct font_data fontdata_6x11 = {
3204 { 0, 0, FONTDATAMAX, 0 }, {
3205 /* 0 0x00 '^@' */
3206 0x00, /* 00000000 */
3207 diff --git a/lib/fonts/font_7x14.c b/lib/fonts/font_7x14.c
3208 index 86d298f385058..9cc7ae2e03f7d 100644
3209 --- a/lib/fonts/font_7x14.c
3210 +++ b/lib/fonts/font_7x14.c
3211 @@ -8,7 +8,7 @@
3212
3213 #define FONTDATAMAX 3584
3214
3215 -static struct font_data fontdata_7x14 = {
3216 +static const struct font_data fontdata_7x14 = {
3217 { 0, 0, FONTDATAMAX, 0 }, {
3218 /* 0 0x00 '^@' */
3219 0x00, /* 0000000 */
3220 diff --git a/lib/fonts/font_8x16.c b/lib/fonts/font_8x16.c
3221 index 37cedd36ca5ef..bab25dc59e8dd 100644
3222 --- a/lib/fonts/font_8x16.c
3223 +++ b/lib/fonts/font_8x16.c
3224 @@ -10,7 +10,7 @@
3225
3226 #define FONTDATAMAX 4096
3227
3228 -static struct font_data fontdata_8x16 = {
3229 +static const struct font_data fontdata_8x16 = {
3230 { 0, 0, FONTDATAMAX, 0 }, {
3231 /* 0 0x00 '^@' */
3232 0x00, /* 00000000 */
3233 diff --git a/lib/fonts/font_8x8.c b/lib/fonts/font_8x8.c
3234 index 8ab695538395d..109d0572368f4 100644
3235 --- a/lib/fonts/font_8x8.c
3236 +++ b/lib/fonts/font_8x8.c
3237 @@ -9,7 +9,7 @@
3238
3239 #define FONTDATAMAX 2048
3240
3241 -static struct font_data fontdata_8x8 = {
3242 +static const struct font_data fontdata_8x8 = {
3243 { 0, 0, FONTDATAMAX, 0 }, {
3244 /* 0 0x00 '^@' */
3245 0x00, /* 00000000 */
3246 diff --git a/lib/fonts/font_acorn_8x8.c b/lib/fonts/font_acorn_8x8.c
3247 index 069b3e80c4344..fb395f0d40317 100644
3248 --- a/lib/fonts/font_acorn_8x8.c
3249 +++ b/lib/fonts/font_acorn_8x8.c
3250 @@ -5,7 +5,7 @@
3251
3252 #define FONTDATAMAX 2048
3253
3254 -static struct font_data acorndata_8x8 = {
3255 +static const struct font_data acorndata_8x8 = {
3256 { 0, 0, FONTDATAMAX, 0 }, {
3257 /* 00 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* ^@ */
3258 /* 01 */ 0x7e, 0x81, 0xa5, 0x81, 0xbd, 0x99, 0x81, 0x7e, /* ^A */
3259 diff --git a/lib/fonts/font_mini_4x6.c b/lib/fonts/font_mini_4x6.c
3260 index 1449876c6a270..592774a90917b 100644
3261 --- a/lib/fonts/font_mini_4x6.c
3262 +++ b/lib/fonts/font_mini_4x6.c
3263 @@ -43,7 +43,7 @@ __END__;
3264
3265 #define FONTDATAMAX 1536
3266
3267 -static struct font_data fontdata_mini_4x6 = {
3268 +static const struct font_data fontdata_mini_4x6 = {
3269 { 0, 0, FONTDATAMAX, 0 }, {
3270 /*{*/
3271 /* Char 0: ' ' */
3272 diff --git a/lib/fonts/font_pearl_8x8.c b/lib/fonts/font_pearl_8x8.c
3273 index 32d65551e7ed2..a6f95ebce9507 100644
3274 --- a/lib/fonts/font_pearl_8x8.c
3275 +++ b/lib/fonts/font_pearl_8x8.c
3276 @@ -14,7 +14,7 @@
3277
3278 #define FONTDATAMAX 2048
3279
3280 -static struct font_data fontdata_pearl8x8 = {
3281 +static const struct font_data fontdata_pearl8x8 = {
3282 { 0, 0, FONTDATAMAX, 0 }, {
3283 /* 0 0x00 '^@' */
3284 0x00, /* 00000000 */
3285 diff --git a/lib/fonts/font_sun12x22.c b/lib/fonts/font_sun12x22.c
3286 index 641a6b4dca424..a5b65bd496045 100644
3287 --- a/lib/fonts/font_sun12x22.c
3288 +++ b/lib/fonts/font_sun12x22.c
3289 @@ -3,7 +3,7 @@
3290
3291 #define FONTDATAMAX 11264
3292
3293 -static struct font_data fontdata_sun12x22 = {
3294 +static const struct font_data fontdata_sun12x22 = {
3295 { 0, 0, FONTDATAMAX, 0 }, {
3296 /* 0 0x00 '^@' */
3297 0x00, 0x00, /* 000000000000 */
3298 diff --git a/lib/fonts/font_sun8x16.c b/lib/fonts/font_sun8x16.c
3299 index 193fe6d988e08..e577e76a6a7c0 100644
3300 --- a/lib/fonts/font_sun8x16.c
3301 +++ b/lib/fonts/font_sun8x16.c
3302 @@ -3,7 +3,7 @@
3303
3304 #define FONTDATAMAX 4096
3305
3306 -static struct font_data fontdata_sun8x16 = {
3307 +static const struct font_data fontdata_sun8x16 = {
3308 { 0, 0, FONTDATAMAX, 0 }, {
3309 /* */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
3310 /* */ 0x00,0x00,0x7e,0x81,0xa5,0x81,0x81,0xbd,0x99,0x81,0x81,0x7e,0x00,0x00,0x00,0x00,
3311 diff --git a/lib/fonts/font_ter16x32.c b/lib/fonts/font_ter16x32.c
3312 index 91b9c283bd9cc..f7c3abb6b99e2 100644
3313 --- a/lib/fonts/font_ter16x32.c
3314 +++ b/lib/fonts/font_ter16x32.c
3315 @@ -4,7 +4,7 @@
3316
3317 #define FONTDATAMAX 16384
3318
3319 -static struct font_data fontdata_ter16x32 = {
3320 +static const struct font_data fontdata_ter16x32 = {
3321 { 0, 0, FONTDATAMAX, 0 }, {
3322 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3323 0x00, 0x00, 0x00, 0x00, 0x7f, 0xfc, 0x7f, 0xfc,
3324 diff --git a/mm/mempolicy.c b/mm/mempolicy.c
3325 index 787c5fc91b217..87d165923fee2 100644
3326 --- a/mm/mempolicy.c
3327 +++ b/mm/mempolicy.c
3328 @@ -496,7 +496,7 @@ static int queue_pages_pte_range(pmd_t *pmd, unsigned long addr,
3329 unsigned long flags = qp->flags;
3330 int ret;
3331 bool has_unmovable = false;
3332 - pte_t *pte;
3333 + pte_t *pte, *mapped_pte;
3334 spinlock_t *ptl;
3335
3336 ptl = pmd_trans_huge_lock(pmd, vma);
3337 @@ -510,7 +510,7 @@ static int queue_pages_pte_range(pmd_t *pmd, unsigned long addr,
3338 if (pmd_trans_unstable(pmd))
3339 return 0;
3340
3341 - pte = pte_offset_map_lock(walk->mm, pmd, addr, &ptl);
3342 + mapped_pte = pte = pte_offset_map_lock(walk->mm, pmd, addr, &ptl);
3343 for (; addr != end; pte++, addr += PAGE_SIZE) {
3344 if (!pte_present(*pte))
3345 continue;
3346 @@ -542,7 +542,7 @@ static int queue_pages_pte_range(pmd_t *pmd, unsigned long addr,
3347 } else
3348 break;
3349 }
3350 - pte_unmap_unlock(pte - 1, ptl);
3351 + pte_unmap_unlock(mapped_pte, ptl);
3352 cond_resched();
3353
3354 if (has_unmovable)
3355 diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c
3356 index a0b4dc54f8a60..f61c5a0b502a8 100644
3357 --- a/net/ipv4/ip_tunnel.c
3358 +++ b/net/ipv4/ip_tunnel.c
3359 @@ -614,9 +614,6 @@ void ip_md_tunnel_xmit(struct sk_buff *skb, struct net_device *dev,
3360 ttl = ip4_dst_hoplimit(&rt->dst);
3361 }
3362
3363 - if (!df && skb->protocol == htons(ETH_P_IP))
3364 - df = inner_iph->frag_off & htons(IP_DF);
3365 -
3366 headroom += LL_RESERVED_SPACE(rt->dst.dev) + rt->dst.header_len;
3367 if (headroom > dev->needed_headroom)
3368 dev->needed_headroom = headroom;
3369 diff --git a/net/sctp/sm_sideeffect.c b/net/sctp/sm_sideeffect.c
3370 index 6927b658dad36..4b7edb3645c30 100644
3371 --- a/net/sctp/sm_sideeffect.c
3372 +++ b/net/sctp/sm_sideeffect.c
3373 @@ -1600,12 +1600,12 @@ static int sctp_cmd_interpreter(enum sctp_event_type event_type,
3374 break;
3375
3376 case SCTP_CMD_INIT_FAILED:
3377 - sctp_cmd_init_failed(commands, asoc, cmd->obj.u32);
3378 + sctp_cmd_init_failed(commands, asoc, cmd->obj.u16);
3379 break;
3380
3381 case SCTP_CMD_ASSOC_FAILED:
3382 sctp_cmd_assoc_failed(commands, asoc, event_type,
3383 - subtype, chunk, cmd->obj.u32);
3384 + subtype, chunk, cmd->obj.u16);
3385 break;
3386
3387 case SCTP_CMD_INIT_COUNTER_INC:
3388 diff --git a/net/tipc/core.c b/net/tipc/core.c
3389 index 12192e7f40503..2374adb505589 100644
3390 --- a/net/tipc/core.c
3391 +++ b/net/tipc/core.c
3392 @@ -98,6 +98,11 @@ static void __net_exit tipc_exit_net(struct net *net)
3393 {
3394 tipc_detach_loopback(net);
3395 tipc_net_stop(net);
3396 +
3397 + /* Make sure the tipc_net_finalize_work stopped
3398 + * before releasing the resources.
3399 + */
3400 + flush_scheduled_work();
3401 tipc_bcast_stop(net);
3402 tipc_nametbl_stop(net);
3403 tipc_sk_rht_destroy(net);
3404 diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c
3405 index 7bd6c8199ca67..3a074a03d3820 100644
3406 --- a/net/vmw_vsock/af_vsock.c
3407 +++ b/net/vmw_vsock/af_vsock.c
3408 @@ -621,7 +621,7 @@ struct sock *__vsock_create(struct net *net,
3409 vsk->owner = get_cred(psk->owner);
3410 vsk->connect_timeout = psk->connect_timeout;
3411 } else {
3412 - vsk->trusted = capable(CAP_NET_ADMIN);
3413 + vsk->trusted = ns_capable_noaudit(&init_user_ns, CAP_NET_ADMIN);
3414 vsk->owner = get_current_cred();
3415 vsk->connect_timeout = VSOCK_DEFAULT_CONNECT_TIMEOUT;
3416 }
3417 diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
3418 index 7a24e9f0d2fe7..d25c3bee56f87 100644
3419 --- a/sound/pci/hda/patch_realtek.c
3420 +++ b/sound/pci/hda/patch_realtek.c
3421 @@ -5990,6 +5990,27 @@ static void alc285_fixup_invalidate_dacs(struct hda_codec *codec,
3422 snd_hda_override_wcaps(codec, 0x03, 0);
3423 }
3424
3425 +static void alc_combo_jack_hp_jd_restart(struct hda_codec *codec)
3426 +{
3427 + switch (codec->core.vendor_id) {
3428 + case 0x10ec0274:
3429 + case 0x10ec0294:
3430 + case 0x10ec0225:
3431 + case 0x10ec0295:
3432 + case 0x10ec0299:
3433 + alc_update_coef_idx(codec, 0x4a, 0x8000, 1 << 15); /* Reset HP JD */
3434 + alc_update_coef_idx(codec, 0x4a, 0x8000, 0 << 15);
3435 + break;
3436 + case 0x10ec0235:
3437 + case 0x10ec0236:
3438 + case 0x10ec0255:
3439 + case 0x10ec0256:
3440 + alc_update_coef_idx(codec, 0x1b, 0x8000, 1 << 15); /* Reset HP JD */
3441 + alc_update_coef_idx(codec, 0x1b, 0x8000, 0 << 15);
3442 + break;
3443 + }
3444 +}
3445 +
3446 static void alc295_fixup_chromebook(struct hda_codec *codec,
3447 const struct hda_fixup *fix, int action)
3448 {
3449 @@ -6000,16 +6021,7 @@ static void alc295_fixup_chromebook(struct hda_codec *codec,
3450 spec->ultra_low_power = true;
3451 break;
3452 case HDA_FIXUP_ACT_INIT:
3453 - switch (codec->core.vendor_id) {
3454 - case 0x10ec0295:
3455 - alc_update_coef_idx(codec, 0x4a, 0x8000, 1 << 15); /* Reset HP JD */
3456 - alc_update_coef_idx(codec, 0x4a, 0x8000, 0 << 15);
3457 - break;
3458 - case 0x10ec0236:
3459 - alc_update_coef_idx(codec, 0x1b, 0x8000, 1 << 15); /* Reset HP JD */
3460 - alc_update_coef_idx(codec, 0x1b, 0x8000, 0 << 15);
3461 - break;
3462 - }
3463 + alc_combo_jack_hp_jd_restart(codec);
3464 break;
3465 }
3466 }
3467 @@ -6065,6 +6077,16 @@ static void alc285_fixup_hp_gpio_amp_init(struct hda_codec *codec,
3468 alc_write_coef_idx(codec, 0x65, 0x0);
3469 }
3470
3471 +static void alc274_fixup_hp_headset_mic(struct hda_codec *codec,
3472 + const struct hda_fixup *fix, int action)
3473 +{
3474 + switch (action) {
3475 + case HDA_FIXUP_ACT_INIT:
3476 + alc_combo_jack_hp_jd_restart(codec);
3477 + break;
3478 + }
3479 +}
3480 +
3481 /* for hda_fixup_thinkpad_acpi() */
3482 #include "thinkpad_helper.c"
3483
3484 @@ -6259,6 +6281,8 @@ enum {
3485 ALC256_FIXUP_INTEL_NUC8_RUGGED,
3486 ALC255_FIXUP_XIAOMI_HEADSET_MIC,
3487 ALC274_FIXUP_HP_MIC,
3488 + ALC274_FIXUP_HP_HEADSET_MIC,
3489 + ALC256_FIXUP_ASUS_HPE,
3490 };
3491
3492 static const struct hda_fixup alc269_fixups[] = {
3493 @@ -7646,6 +7670,23 @@ static const struct hda_fixup alc269_fixups[] = {
3494 { }
3495 },
3496 },
3497 + [ALC274_FIXUP_HP_HEADSET_MIC] = {
3498 + .type = HDA_FIXUP_FUNC,
3499 + .v.func = alc274_fixup_hp_headset_mic,
3500 + .chained = true,
3501 + .chain_id = ALC274_FIXUP_HP_MIC
3502 + },
3503 + [ALC256_FIXUP_ASUS_HPE] = {
3504 + .type = HDA_FIXUP_VERBS,
3505 + .v.verbs = (const struct hda_verb[]) {
3506 + /* Set EAPD high */
3507 + { 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
3508 + { 0x20, AC_VERB_SET_PROC_COEF, 0x7778 },
3509 + { }
3510 + },
3511 + .chained = true,
3512 + .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
3513 + },
3514 };
3515
3516 static const struct snd_pci_quirk alc269_fixup_tbl[] = {
3517 @@ -7797,7 +7838,6 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
3518 SND_PCI_QUIRK(0x103c, 0x869d, "HP", ALC236_FIXUP_HP_MUTE_LED),
3519 SND_PCI_QUIRK(0x103c, 0x8729, "HP", ALC285_FIXUP_HP_GPIO_LED),
3520 SND_PCI_QUIRK(0x103c, 0x8736, "HP", ALC285_FIXUP_HP_GPIO_AMP_INIT),
3521 - SND_PCI_QUIRK(0x103c, 0x874e, "HP", ALC274_FIXUP_HP_MIC),
3522 SND_PCI_QUIRK(0x103c, 0x8760, "HP", ALC285_FIXUP_HP_MUTE_LED),
3523 SND_PCI_QUIRK(0x103c, 0x877a, "HP", ALC285_FIXUP_HP_MUTE_LED),
3524 SND_PCI_QUIRK(0x103c, 0x877d, "HP", ALC236_FIXUP_HP_MUTE_LED),
3525 @@ -7830,6 +7870,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
3526 SND_PCI_QUIRK(0x1043, 0x1bbd, "ASUS Z550MA", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
3527 SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
3528 SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC),
3529 + SND_PCI_QUIRK(0x1043, 0x1d4e, "ASUS TM420", ALC256_FIXUP_ASUS_HPE),
3530 SND_PCI_QUIRK(0x1043, 0x1e11, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA502),
3531 SND_PCI_QUIRK(0x1043, 0x1f11, "ASUS Zephyrus G14", ALC289_FIXUP_ASUS_GA401),
3532 SND_PCI_QUIRK(0x1043, 0x1881, "ASUS Zephyrus S/M", ALC294_FIXUP_ASUS_GX502_PINS),
3533 @@ -8353,6 +8394,10 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
3534 {0x1a, 0x90a70130},
3535 {0x1b, 0x90170110},
3536 {0x21, 0x03211020}),
3537 + SND_HDA_PIN_QUIRK(0x10ec0274, 0x103c, "HP", ALC274_FIXUP_HP_HEADSET_MIC,
3538 + {0x17, 0x90170110},
3539 + {0x19, 0x03a11030},
3540 + {0x21, 0x03211020}),
3541 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC280_FIXUP_HP_GPIO4,
3542 {0x12, 0x90a60130},
3543 {0x14, 0x90170110},
3544 diff --git a/sound/soc/intel/skylake/skl-topology.c b/sound/soc/intel/skylake/skl-topology.c
3545 index 69cd7a81bf2ac..4b114ece58c61 100644
3546 --- a/sound/soc/intel/skylake/skl-topology.c
3547 +++ b/sound/soc/intel/skylake/skl-topology.c
3548 @@ -14,6 +14,7 @@
3549 #include <linux/uuid.h>
3550 #include <sound/intel-nhlt.h>
3551 #include <sound/soc.h>
3552 +#include <sound/soc-acpi.h>
3553 #include <sound/soc-topology.h>
3554 #include <uapi/sound/snd_sst_tokens.h>
3555 #include <uapi/sound/skl-tplg-interface.h>
3556 @@ -3565,8 +3566,20 @@ int skl_tplg_init(struct snd_soc_component *component, struct hdac_bus *bus)
3557
3558 ret = request_firmware(&fw, skl->tplg_name, bus->dev);
3559 if (ret < 0) {
3560 - dev_info(bus->dev, "tplg fw %s load failed with %d, falling back to dfw_sst.bin",
3561 - skl->tplg_name, ret);
3562 + char alt_tplg_name[64];
3563 +
3564 + snprintf(alt_tplg_name, sizeof(alt_tplg_name), "%s-tplg.bin",
3565 + skl->mach->drv_name);
3566 + dev_info(bus->dev, "tplg fw %s load failed with %d, trying alternative tplg name %s",
3567 + skl->tplg_name, ret, alt_tplg_name);
3568 +
3569 + ret = request_firmware(&fw, alt_tplg_name, bus->dev);
3570 + if (!ret)
3571 + goto component_load;
3572 +
3573 + dev_info(bus->dev, "tplg %s failed with %d, falling back to dfw_sst.bin",
3574 + alt_tplg_name, ret);
3575 +
3576 ret = request_firmware(&fw, "dfw_sst.bin", bus->dev);
3577 if (ret < 0) {
3578 dev_err(bus->dev, "Fallback tplg fw %s load failed with %d\n",
3579 @@ -3575,6 +3588,8 @@ int skl_tplg_init(struct snd_soc_component *component, struct hdac_bus *bus)
3580 }
3581 }
3582
3583 +component_load:
3584 +
3585 /*
3586 * The complete tplg for SKL is loaded as index 0, we don't use
3587 * any other index
3588 diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c
3589 index 878f1201aad6e..1a5e555002b2b 100644
3590 --- a/sound/usb/pcm.c
3591 +++ b/sound/usb/pcm.c
3592 @@ -323,6 +323,7 @@ static int set_sync_ep_implicit_fb_quirk(struct snd_usb_substream *subs,
3593 switch (subs->stream->chip->usb_id) {
3594 case USB_ID(0x0763, 0x2030): /* M-Audio Fast Track C400 */
3595 case USB_ID(0x0763, 0x2031): /* M-Audio Fast Track C600 */
3596 + case USB_ID(0x22f0, 0x0006): /* Allen&Heath Qu-16 */
3597 ep = 0x81;
3598 ifnum = 3;
3599 goto add_sync_ep_from_ifnum;
3600 @@ -332,6 +333,7 @@ static int set_sync_ep_implicit_fb_quirk(struct snd_usb_substream *subs,
3601 ifnum = 2;
3602 goto add_sync_ep_from_ifnum;
3603 case USB_ID(0x2466, 0x8003): /* Fractal Audio Axe-Fx II */
3604 + case USB_ID(0x0499, 0x172a): /* Yamaha MODX */
3605 ep = 0x86;
3606 ifnum = 2;
3607 goto add_sync_ep_from_ifnum;
3608 @@ -339,6 +341,10 @@ static int set_sync_ep_implicit_fb_quirk(struct snd_usb_substream *subs,
3609 ep = 0x81;
3610 ifnum = 2;
3611 goto add_sync_ep_from_ifnum;
3612 + case USB_ID(0x1686, 0xf029): /* Zoom UAC-2 */
3613 + ep = 0x82;
3614 + ifnum = 2;
3615 + goto add_sync_ep_from_ifnum;
3616 case USB_ID(0x1397, 0x0001): /* Behringer UFX1604 */
3617 case USB_ID(0x1397, 0x0002): /* Behringer UFX1204 */
3618 ep = 0x81;
3619 diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c
3620 index cc75d9749e9fa..825b6f2efada5 100644
3621 --- a/sound/usb/quirks.c
3622 +++ b/sound/usb/quirks.c
3623 @@ -1732,6 +1732,7 @@ u64 snd_usb_interface_dsd_format_quirks(struct snd_usb_audio *chip,
3624 case 0x278b: /* Rotel? */
3625 case 0x292b: /* Gustard/Ess based devices */
3626 case 0x2ab6: /* T+A devices */
3627 + case 0x3353: /* Khadas devices */
3628 case 0x3842: /* EVGA */
3629 case 0xc502: /* HiBy devices */
3630 if (fp->dsd_raw)