Gentoo Archives: gentoo-commits

From: Mike Pagano <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/linux-patches:5.4 commit in: /
Date: Thu, 05 Mar 2020 16:26:32
Message-Id: 1583425572.52bbce7c6e0c063309a727e93db5281c0a3317c7.mpagano@gentoo
1 commit: 52bbce7c6e0c063309a727e93db5281c0a3317c7
2 Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
3 AuthorDate: Thu Mar 5 16:26:12 2020 +0000
4 Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
5 CommitDate: Thu Mar 5 16:26:12 2020 +0000
6 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=52bbce7c
7
8 Linux patch 5.4.24
9
10 Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org>
11
12 0000_README | 4 +
13 1023_linux-5.4.24.patch | 8611 +++++++++++++++++++++++++++++++++++++++++++++++
14 2 files changed, 8615 insertions(+)
15
16 diff --git a/0000_README b/0000_README
17 index 8dd1902..c24327d 100644
18 --- a/0000_README
19 +++ b/0000_README
20 @@ -135,6 +135,10 @@ Patch: 1022_linux-5.4.23.patch
21 From: http://www.kernel.org
22 Desc: Linux 5.4.23
23
24 +Patch: 1023_linux-5.4.24.patch
25 +From: http://www.kernel.org
26 +Desc: Linux 5.4.24
27 +
28 Patch: 1500_XATTR_USER_PREFIX.patch
29 From: https://bugs.gentoo.org/show_bug.cgi?id=470644
30 Desc: Support for namespace user.pax.* on tmpfs.
31
32 diff --git a/1023_linux-5.4.24.patch b/1023_linux-5.4.24.patch
33 new file mode 100644
34 index 0000000..6757dd3
35 --- /dev/null
36 +++ b/1023_linux-5.4.24.patch
37 @@ -0,0 +1,8611 @@
38 +diff --git a/Documentation/kbuild/makefiles.rst b/Documentation/kbuild/makefiles.rst
39 +index b89c88168d6a..b9b50553bfc5 100644
40 +--- a/Documentation/kbuild/makefiles.rst
41 ++++ b/Documentation/kbuild/makefiles.rst
42 +@@ -1115,23 +1115,6 @@ When kbuild executes, the following steps are followed (roughly):
43 + In this example, extra-y is used to list object files that
44 + shall be built, but shall not be linked as part of built-in.a.
45 +
46 +- header-test-y
47 +-
48 +- header-test-y specifies headers (`*.h`) in the current directory that
49 +- should be compile tested to ensure they are self-contained,
50 +- i.e. compilable as standalone units. If CONFIG_HEADER_TEST is enabled,
51 +- this builds them as part of extra-y.
52 +-
53 +- header-test-pattern-y
54 +-
55 +- This works as a weaker version of header-test-y, and accepts wildcard
56 +- patterns. The typical usage is::
57 +-
58 +- header-test-pattern-y += *.h
59 +-
60 +- This specifies all the files that matches to `*.h` in the current
61 +- directory, but the files in 'header-test-' are excluded.
62 +-
63 + 6.7 Commands useful for building a boot image
64 + ---------------------------------------------
65 +
66 +diff --git a/Documentation/networking/nf_flowtable.txt b/Documentation/networking/nf_flowtable.txt
67 +index ca2136c76042..0bf32d1121be 100644
68 +--- a/Documentation/networking/nf_flowtable.txt
69 ++++ b/Documentation/networking/nf_flowtable.txt
70 +@@ -76,7 +76,7 @@ flowtable and add one rule to your forward chain.
71 +
72 + table inet x {
73 + flowtable f {
74 +- hook ingress priority 0 devices = { eth0, eth1 };
75 ++ hook ingress priority 0; devices = { eth0, eth1 };
76 + }
77 + chain y {
78 + type filter hook forward priority 0; policy accept;
79 +diff --git a/Makefile b/Makefile
80 +index af5e90075514..c32c78cf2fe5 100644
81 +--- a/Makefile
82 ++++ b/Makefile
83 +@@ -1,7 +1,7 @@
84 + # SPDX-License-Identifier: GPL-2.0
85 + VERSION = 5
86 + PATCHLEVEL = 4
87 +-SUBLEVEL = 23
88 ++SUBLEVEL = 24
89 + EXTRAVERSION =
90 + NAME = Kleptomaniac Octopus
91 +
92 +@@ -618,7 +618,6 @@ ifeq ($(KBUILD_EXTMOD),)
93 + init-y := init/
94 + drivers-y := drivers/ sound/
95 + drivers-$(CONFIG_SAMPLES) += samples/
96 +-drivers-$(CONFIG_KERNEL_HEADER_TEST) += include/
97 + net-y := net/
98 + libs-y := lib/
99 + core-y := usr/
100 +@@ -1196,19 +1195,15 @@ headers: $(version_h) scripts_unifdef uapi-asm-generic archheaders archscripts
101 + $(Q)$(MAKE) $(hdr-inst)=include/uapi
102 + $(Q)$(MAKE) $(hdr-inst)=arch/$(SRCARCH)/include/uapi
103 +
104 ++# Deprecated. It is no-op now.
105 + PHONY += headers_check
106 +-headers_check: headers
107 +- $(Q)$(MAKE) $(hdr-inst)=include/uapi HDRCHECK=1
108 +- $(Q)$(MAKE) $(hdr-inst)=arch/$(SRCARCH)/include/uapi HDRCHECK=1
109 ++headers_check:
110 ++ @:
111 +
112 + ifdef CONFIG_HEADERS_INSTALL
113 + prepare: headers
114 + endif
115 +
116 +-ifdef CONFIG_HEADERS_CHECK
117 +-all: headers_check
118 +-endif
119 +-
120 + PHONY += scripts_unifdef
121 + scripts_unifdef: scripts_basic
122 + $(Q)$(MAKE) $(build)=scripts scripts/unifdef
123 +@@ -1476,7 +1471,6 @@ help:
124 + @echo ' versioncheck - Sanity check on version.h usage'
125 + @echo ' includecheck - Check for duplicate included header files'
126 + @echo ' export_report - List the usages of all exported symbols'
127 +- @echo ' headers_check - Sanity check on exported headers'
128 + @echo ' headerdep - Detect inclusion cycles in headers'
129 + @echo ' coccicheck - Check with Coccinelle'
130 + @echo ''
131 +@@ -1641,6 +1635,50 @@ help:
132 + PHONY += prepare
133 + endif # KBUILD_EXTMOD
134 +
135 ++# Single targets
136 ++# ---------------------------------------------------------------------------
137 ++# To build individual files in subdirectories, you can do like this:
138 ++#
139 ++# make foo/bar/baz.s
140 ++#
141 ++# The supported suffixes for single-target are listed in 'single-targets'
142 ++#
143 ++# To build only under specific subdirectories, you can do like this:
144 ++#
145 ++# make foo/bar/baz/
146 ++
147 ++ifdef single-build
148 ++
149 ++# .ko is special because modpost is needed
150 ++single-ko := $(sort $(filter %.ko, $(MAKECMDGOALS)))
151 ++single-no-ko := $(sort $(patsubst %.ko,%.mod, $(MAKECMDGOALS)))
152 ++
153 ++$(single-ko): single_modpost
154 ++ @:
155 ++$(single-no-ko): descend
156 ++ @:
157 ++
158 ++ifeq ($(KBUILD_EXTMOD),)
159 ++# For the single build of in-tree modules, use a temporary file to avoid
160 ++# the situation of modules_install installing an invalid modules.order.
161 ++MODORDER := .modules.tmp
162 ++endif
163 ++
164 ++PHONY += single_modpost
165 ++single_modpost: $(single-no-ko)
166 ++ $(Q){ $(foreach m, $(single-ko), echo $(extmod-prefix)$m;) } > $(MODORDER)
167 ++ $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
168 ++
169 ++KBUILD_MODULES := 1
170 ++
171 ++export KBUILD_SINGLE_TARGETS := $(addprefix $(extmod-prefix), $(single-no-ko))
172 ++
173 ++# trim unrelated directories
174 ++build-dirs := $(foreach d, $(build-dirs), \
175 ++ $(if $(filter $(d)/%, $(KBUILD_SINGLE_TARGETS)), $(d)))
176 ++
177 ++endif
178 ++
179 + # Handle descending into subdirectories listed in $(build-dirs)
180 + # Preset locale variables to speed up the build process. Limit locale
181 + # tweaks to this spot to avoid wrong language settings when running
182 +@@ -1649,7 +1687,9 @@ endif # KBUILD_EXTMOD
183 + PHONY += descend $(build-dirs)
184 + descend: $(build-dirs)
185 + $(build-dirs): prepare
186 +- $(Q)$(MAKE) $(build)=$@ single-build=$(single-build) need-builtin=1 need-modorder=1
187 ++ $(Q)$(MAKE) $(build)=$@ \
188 ++ single-build=$(if $(filter-out $@/, $(single-no-ko)),1) \
189 ++ need-builtin=1 need-modorder=1
190 +
191 + clean-dirs := $(addprefix _clean_, $(clean-dirs))
192 + PHONY += $(clean-dirs) clean
193 +@@ -1753,50 +1793,6 @@ tools/%: FORCE
194 + $(Q)mkdir -p $(objtree)/tools
195 + $(Q)$(MAKE) LDFLAGS= MAKEFLAGS="$(tools_silent) $(filter --j% -j,$(MAKEFLAGS))" O=$(abspath $(objtree)) subdir=tools -C $(srctree)/tools/ $*
196 +
197 +-# Single targets
198 +-# ---------------------------------------------------------------------------
199 +-# To build individual files in subdirectories, you can do like this:
200 +-#
201 +-# make foo/bar/baz.s
202 +-#
203 +-# The supported suffixes for single-target are listed in 'single-targets'
204 +-#
205 +-# To build only under specific subdirectories, you can do like this:
206 +-#
207 +-# make foo/bar/baz/
208 +-
209 +-ifdef single-build
210 +-
211 +-single-all := $(filter $(single-targets), $(MAKECMDGOALS))
212 +-
213 +-# .ko is special because modpost is needed
214 +-single-ko := $(sort $(filter %.ko, $(single-all)))
215 +-single-no-ko := $(sort $(patsubst %.ko,%.mod, $(single-all)))
216 +-
217 +-$(single-ko): single_modpost
218 +- @:
219 +-$(single-no-ko): descend
220 +- @:
221 +-
222 +-ifeq ($(KBUILD_EXTMOD),)
223 +-# For the single build of in-tree modules, use a temporary file to avoid
224 +-# the situation of modules_install installing an invalid modules.order.
225 +-MODORDER := .modules.tmp
226 +-endif
227 +-
228 +-PHONY += single_modpost
229 +-single_modpost: $(single-no-ko)
230 +- $(Q){ $(foreach m, $(single-ko), echo $(extmod-prefix)$m;) } > $(MODORDER)
231 +- $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
232 +-
233 +-KBUILD_MODULES := 1
234 +-
235 +-export KBUILD_SINGLE_TARGETS := $(addprefix $(extmod-prefix), $(single-no-ko))
236 +-
237 +-single-build = $(if $(filter-out $@/, $(single-no-ko)),1)
238 +-
239 +-endif
240 +-
241 + # FIXME Should go into a make.lib or something
242 + # ===========================================================================
243 +
244 +diff --git a/arch/arm/boot/dts/stihxxx-b2120.dtsi b/arch/arm/boot/dts/stihxxx-b2120.dtsi
245 +index 60e11045ad76..d051f080e52e 100644
246 +--- a/arch/arm/boot/dts/stihxxx-b2120.dtsi
247 ++++ b/arch/arm/boot/dts/stihxxx-b2120.dtsi
248 +@@ -46,7 +46,7 @@
249 + /* DAC */
250 + format = "i2s";
251 + mclk-fs = <256>;
252 +- frame-inversion = <1>;
253 ++ frame-inversion;
254 + cpu {
255 + sound-dai = <&sti_uni_player2>;
256 + };
257 +diff --git a/arch/mips/kernel/vpe.c b/arch/mips/kernel/vpe.c
258 +index 6176b9acba95..d0d832ab3d3b 100644
259 +--- a/arch/mips/kernel/vpe.c
260 ++++ b/arch/mips/kernel/vpe.c
261 +@@ -134,7 +134,7 @@ void release_vpe(struct vpe *v)
262 + {
263 + list_del(&v->list);
264 + if (v->load_addr)
265 +- release_progmem(v);
266 ++ release_progmem(v->load_addr);
267 + kfree(v);
268 + }
269 +
270 +diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c
271 +index fcef678c3423..c531e3f3269e 100644
272 +--- a/arch/x86/events/intel/core.c
273 ++++ b/arch/x86/events/intel/core.c
274 +@@ -4746,6 +4746,7 @@ __init int intel_pmu_init(void)
275 + break;
276 +
277 + case INTEL_FAM6_ATOM_TREMONT_D:
278 ++ case INTEL_FAM6_ATOM_TREMONT:
279 + x86_pmu.late_ack = true;
280 + memcpy(hw_cache_event_ids, glp_hw_cache_event_ids,
281 + sizeof(hw_cache_event_ids));
282 +diff --git a/arch/x86/events/intel/cstate.c b/arch/x86/events/intel/cstate.c
283 +index e1daf4151e11..4814c964692c 100644
284 +--- a/arch/x86/events/intel/cstate.c
285 ++++ b/arch/x86/events/intel/cstate.c
286 +@@ -40,17 +40,18 @@
287 + * Model specific counters:
288 + * MSR_CORE_C1_RES: CORE C1 Residency Counter
289 + * perf code: 0x00
290 +- * Available model: SLM,AMT,GLM,CNL
291 ++ * Available model: SLM,AMT,GLM,CNL,TNT
292 + * Scope: Core (each processor core has a MSR)
293 + * MSR_CORE_C3_RESIDENCY: CORE C3 Residency Counter
294 + * perf code: 0x01
295 + * Available model: NHM,WSM,SNB,IVB,HSW,BDW,SKL,GLM,
296 +- * CNL,KBL,CML
297 ++ * CNL,KBL,CML,TNT
298 + * Scope: Core
299 + * MSR_CORE_C6_RESIDENCY: CORE C6 Residency Counter
300 + * perf code: 0x02
301 + * Available model: SLM,AMT,NHM,WSM,SNB,IVB,HSW,BDW,
302 +- * SKL,KNL,GLM,CNL,KBL,CML,ICL,TGL
303 ++ * SKL,KNL,GLM,CNL,KBL,CML,ICL,TGL,
304 ++ * TNT
305 + * Scope: Core
306 + * MSR_CORE_C7_RESIDENCY: CORE C7 Residency Counter
307 + * perf code: 0x03
308 +@@ -60,17 +61,18 @@
309 + * MSR_PKG_C2_RESIDENCY: Package C2 Residency Counter.
310 + * perf code: 0x00
311 + * Available model: SNB,IVB,HSW,BDW,SKL,KNL,GLM,CNL,
312 +- * KBL,CML,ICL,TGL
313 ++ * KBL,CML,ICL,TGL,TNT
314 + * Scope: Package (physical package)
315 + * MSR_PKG_C3_RESIDENCY: Package C3 Residency Counter.
316 + * perf code: 0x01
317 + * Available model: NHM,WSM,SNB,IVB,HSW,BDW,SKL,KNL,
318 +- * GLM,CNL,KBL,CML,ICL,TGL
319 ++ * GLM,CNL,KBL,CML,ICL,TGL,TNT
320 + * Scope: Package (physical package)
321 + * MSR_PKG_C6_RESIDENCY: Package C6 Residency Counter.
322 + * perf code: 0x02
323 +- * Available model: SLM,AMT,NHM,WSM,SNB,IVB,HSW,BDW
324 +- * SKL,KNL,GLM,CNL,KBL,CML,ICL,TGL
325 ++ * Available model: SLM,AMT,NHM,WSM,SNB,IVB,HSW,BDW,
326 ++ * SKL,KNL,GLM,CNL,KBL,CML,ICL,TGL,
327 ++ * TNT
328 + * Scope: Package (physical package)
329 + * MSR_PKG_C7_RESIDENCY: Package C7 Residency Counter.
330 + * perf code: 0x03
331 +@@ -87,7 +89,8 @@
332 + * Scope: Package (physical package)
333 + * MSR_PKG_C10_RESIDENCY: Package C10 Residency Counter.
334 + * perf code: 0x06
335 +- * Available model: HSW ULT,KBL,GLM,CNL,CML,ICL,TGL
336 ++ * Available model: HSW ULT,KBL,GLM,CNL,CML,ICL,TGL,
337 ++ * TNT
338 + * Scope: Package (physical package)
339 + *
340 + */
341 +@@ -640,8 +643,9 @@ static const struct x86_cpu_id intel_cstates_match[] __initconst = {
342 +
343 + X86_CSTATES_MODEL(INTEL_FAM6_ATOM_GOLDMONT, glm_cstates),
344 + X86_CSTATES_MODEL(INTEL_FAM6_ATOM_GOLDMONT_D, glm_cstates),
345 +-
346 + X86_CSTATES_MODEL(INTEL_FAM6_ATOM_GOLDMONT_PLUS, glm_cstates),
347 ++ X86_CSTATES_MODEL(INTEL_FAM6_ATOM_TREMONT_D, glm_cstates),
348 ++ X86_CSTATES_MODEL(INTEL_FAM6_ATOM_TREMONT, glm_cstates),
349 +
350 + X86_CSTATES_MODEL(INTEL_FAM6_ICELAKE_L, icl_cstates),
351 + X86_CSTATES_MODEL(INTEL_FAM6_ICELAKE, icl_cstates),
352 +diff --git a/arch/x86/events/msr.c b/arch/x86/events/msr.c
353 +index 6f86650b3f77..a949f6f55991 100644
354 +--- a/arch/x86/events/msr.c
355 ++++ b/arch/x86/events/msr.c
356 +@@ -75,8 +75,9 @@ static bool test_intel(int idx, void *data)
357 +
358 + case INTEL_FAM6_ATOM_GOLDMONT:
359 + case INTEL_FAM6_ATOM_GOLDMONT_D:
360 +-
361 + case INTEL_FAM6_ATOM_GOLDMONT_PLUS:
362 ++ case INTEL_FAM6_ATOM_TREMONT_D:
363 ++ case INTEL_FAM6_ATOM_TREMONT:
364 +
365 + case INTEL_FAM6_XEON_PHI_KNL:
366 + case INTEL_FAM6_XEON_PHI_KNM:
367 +diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/resctrl/internal.h
368 +index e49b77283924..181c992f448c 100644
369 +--- a/arch/x86/kernel/cpu/resctrl/internal.h
370 ++++ b/arch/x86/kernel/cpu/resctrl/internal.h
371 +@@ -57,6 +57,7 @@ static inline struct rdt_fs_context *rdt_fc2context(struct fs_context *fc)
372 + }
373 +
374 + DECLARE_STATIC_KEY_FALSE(rdt_enable_key);
375 ++DECLARE_STATIC_KEY_FALSE(rdt_mon_enable_key);
376 +
377 + /**
378 + * struct mon_evt - Entry in the event list of a resource
379 +diff --git a/arch/x86/kernel/cpu/resctrl/monitor.c b/arch/x86/kernel/cpu/resctrl/monitor.c
380 +index 397206f23d14..773124b0e18a 100644
381 +--- a/arch/x86/kernel/cpu/resctrl/monitor.c
382 ++++ b/arch/x86/kernel/cpu/resctrl/monitor.c
383 +@@ -514,7 +514,7 @@ void mbm_handle_overflow(struct work_struct *work)
384 +
385 + mutex_lock(&rdtgroup_mutex);
386 +
387 +- if (!static_branch_likely(&rdt_enable_key))
388 ++ if (!static_branch_likely(&rdt_mon_enable_key))
389 + goto out_unlock;
390 +
391 + d = get_domain_from_cpu(cpu, &rdt_resources_all[RDT_RESOURCE_L3]);
392 +@@ -543,7 +543,7 @@ void mbm_setup_overflow_handler(struct rdt_domain *dom, unsigned long delay_ms)
393 + unsigned long delay = msecs_to_jiffies(delay_ms);
394 + int cpu;
395 +
396 +- if (!static_branch_likely(&rdt_enable_key))
397 ++ if (!static_branch_likely(&rdt_mon_enable_key))
398 + return;
399 + cpu = cpumask_any(&dom->cpu_mask);
400 + dom->mbm_work_cpu = cpu;
401 +diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
402 +index 207030db3481..07459120a222 100644
403 +--- a/arch/x86/kvm/svm.c
404 ++++ b/arch/x86/kvm/svm.c
405 +@@ -1298,6 +1298,47 @@ static void shrink_ple_window(struct kvm_vcpu *vcpu)
406 + }
407 + }
408 +
409 ++/*
410 ++ * The default MMIO mask is a single bit (excluding the present bit),
411 ++ * which could conflict with the memory encryption bit. Check for
412 ++ * memory encryption support and override the default MMIO mask if
413 ++ * memory encryption is enabled.
414 ++ */
415 ++static __init void svm_adjust_mmio_mask(void)
416 ++{
417 ++ unsigned int enc_bit, mask_bit;
418 ++ u64 msr, mask;
419 ++
420 ++ /* If there is no memory encryption support, use existing mask */
421 ++ if (cpuid_eax(0x80000000) < 0x8000001f)
422 ++ return;
423 ++
424 ++ /* If memory encryption is not enabled, use existing mask */
425 ++ rdmsrl(MSR_K8_SYSCFG, msr);
426 ++ if (!(msr & MSR_K8_SYSCFG_MEM_ENCRYPT))
427 ++ return;
428 ++
429 ++ enc_bit = cpuid_ebx(0x8000001f) & 0x3f;
430 ++ mask_bit = boot_cpu_data.x86_phys_bits;
431 ++
432 ++ /* Increment the mask bit if it is the same as the encryption bit */
433 ++ if (enc_bit == mask_bit)
434 ++ mask_bit++;
435 ++
436 ++ /*
437 ++ * If the mask bit location is below 52, then some bits above the
438 ++ * physical addressing limit will always be reserved, so use the
439 ++ * rsvd_bits() function to generate the mask. This mask, along with
440 ++ * the present bit, will be used to generate a page fault with
441 ++ * PFER.RSV = 1.
442 ++ *
443 ++ * If the mask bit location is 52 (or above), then clear the mask.
444 ++ */
445 ++ mask = (mask_bit < 52) ? rsvd_bits(mask_bit, 51) | PT_PRESENT_MASK : 0;
446 ++
447 ++ kvm_mmu_set_mmio_spte_mask(mask, mask, PT_WRITABLE_MASK | PT_USER_MASK);
448 ++}
449 ++
450 + static __init int svm_hardware_setup(void)
451 + {
452 + int cpu;
453 +@@ -1352,6 +1393,8 @@ static __init int svm_hardware_setup(void)
454 + }
455 + }
456 +
457 ++ svm_adjust_mmio_mask();
458 ++
459 + for_each_possible_cpu(cpu) {
460 + r = svm_cpu_init(cpu);
461 + if (r)
462 +diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c
463 +index 802ef7177d53..e1d8062ef12e 100644
464 +--- a/arch/x86/kvm/vmx/nested.c
465 ++++ b/arch/x86/kvm/vmx/nested.c
466 +@@ -4609,32 +4609,28 @@ static int handle_vmread(struct kvm_vcpu *vcpu)
467 + {
468 + unsigned long field;
469 + u64 field_value;
470 ++ struct vcpu_vmx *vmx = to_vmx(vcpu);
471 + unsigned long exit_qualification = vmcs_readl(EXIT_QUALIFICATION);
472 + u32 vmx_instruction_info = vmcs_read32(VMX_INSTRUCTION_INFO);
473 + int len;
474 + gva_t gva = 0;
475 +- struct vmcs12 *vmcs12;
476 ++ struct vmcs12 *vmcs12 = is_guest_mode(vcpu) ? get_shadow_vmcs12(vcpu)
477 ++ : get_vmcs12(vcpu);
478 + struct x86_exception e;
479 + short offset;
480 +
481 + if (!nested_vmx_check_permission(vcpu))
482 + return 1;
483 +
484 +- if (to_vmx(vcpu)->nested.current_vmptr == -1ull)
485 ++ /*
486 ++ * In VMX non-root operation, when the VMCS-link pointer is -1ull,
487 ++ * any VMREAD sets the ALU flags for VMfailInvalid.
488 ++ */
489 ++ if (vmx->nested.current_vmptr == -1ull ||
490 ++ (is_guest_mode(vcpu) &&
491 ++ get_vmcs12(vcpu)->vmcs_link_pointer == -1ull))
492 + return nested_vmx_failInvalid(vcpu);
493 +
494 +- if (!is_guest_mode(vcpu))
495 +- vmcs12 = get_vmcs12(vcpu);
496 +- else {
497 +- /*
498 +- * When vmcs->vmcs_link_pointer is -1ull, any VMREAD
499 +- * to shadowed-field sets the ALU flags for VMfailInvalid.
500 +- */
501 +- if (get_vmcs12(vcpu)->vmcs_link_pointer == -1ull)
502 +- return nested_vmx_failInvalid(vcpu);
503 +- vmcs12 = get_shadow_vmcs12(vcpu);
504 +- }
505 +-
506 + /* Decode instruction info and find the field to read */
507 + field = kvm_register_readl(vcpu, (((vmx_instruction_info) >> 28) & 0xf));
508 +
509 +@@ -4713,13 +4709,20 @@ static int handle_vmwrite(struct kvm_vcpu *vcpu)
510 + */
511 + u64 field_value = 0;
512 + struct x86_exception e;
513 +- struct vmcs12 *vmcs12;
514 ++ struct vmcs12 *vmcs12 = is_guest_mode(vcpu) ? get_shadow_vmcs12(vcpu)
515 ++ : get_vmcs12(vcpu);
516 + short offset;
517 +
518 + if (!nested_vmx_check_permission(vcpu))
519 + return 1;
520 +
521 +- if (vmx->nested.current_vmptr == -1ull)
522 ++ /*
523 ++ * In VMX non-root operation, when the VMCS-link pointer is -1ull,
524 ++ * any VMWRITE sets the ALU flags for VMfailInvalid.
525 ++ */
526 ++ if (vmx->nested.current_vmptr == -1ull ||
527 ++ (is_guest_mode(vcpu) &&
528 ++ get_vmcs12(vcpu)->vmcs_link_pointer == -1ull))
529 + return nested_vmx_failInvalid(vcpu);
530 +
531 + if (vmx_instruction_info & (1u << 10))
532 +@@ -4738,6 +4741,12 @@ static int handle_vmwrite(struct kvm_vcpu *vcpu)
533 +
534 +
535 + field = kvm_register_readl(vcpu, (((vmx_instruction_info) >> 28) & 0xf));
536 ++
537 ++ offset = vmcs_field_to_offset(field);
538 ++ if (offset < 0)
539 ++ return nested_vmx_failValid(vcpu,
540 ++ VMXERR_UNSUPPORTED_VMCS_COMPONENT);
541 ++
542 + /*
543 + * If the vCPU supports "VMWRITE to any supported field in the
544 + * VMCS," then the "read-only" fields are actually read/write.
545 +@@ -4747,29 +4756,12 @@ static int handle_vmwrite(struct kvm_vcpu *vcpu)
546 + return nested_vmx_failValid(vcpu,
547 + VMXERR_VMWRITE_READ_ONLY_VMCS_COMPONENT);
548 +
549 +- if (!is_guest_mode(vcpu)) {
550 +- vmcs12 = get_vmcs12(vcpu);
551 +-
552 +- /*
553 +- * Ensure vmcs12 is up-to-date before any VMWRITE that dirties
554 +- * vmcs12, else we may crush a field or consume a stale value.
555 +- */
556 +- if (!is_shadow_field_rw(field))
557 +- copy_vmcs02_to_vmcs12_rare(vcpu, vmcs12);
558 +- } else {
559 +- /*
560 +- * When vmcs->vmcs_link_pointer is -1ull, any VMWRITE
561 +- * to shadowed-field sets the ALU flags for VMfailInvalid.
562 +- */
563 +- if (get_vmcs12(vcpu)->vmcs_link_pointer == -1ull)
564 +- return nested_vmx_failInvalid(vcpu);
565 +- vmcs12 = get_shadow_vmcs12(vcpu);
566 +- }
567 +-
568 +- offset = vmcs_field_to_offset(field);
569 +- if (offset < 0)
570 +- return nested_vmx_failValid(vcpu,
571 +- VMXERR_UNSUPPORTED_VMCS_COMPONENT);
572 ++ /*
573 ++ * Ensure vmcs12 is up-to-date before any VMWRITE that dirties
574 ++ * vmcs12, else we may crush a field or consume a stale value.
575 ++ */
576 ++ if (!is_guest_mode(vcpu) && !is_shadow_field_rw(field))
577 ++ copy_vmcs02_to_vmcs12_rare(vcpu, vmcs12);
578 +
579 + /*
580 + * Some Intel CPUs intentionally drop the reserved bits of the AR byte
581 +diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
582 +index 8ebcd9de87a2..8129b6b27c93 100644
583 +--- a/arch/x86/kvm/vmx/vmx.c
584 ++++ b/arch/x86/kvm/vmx/vmx.c
585 +@@ -7165,6 +7165,7 @@ static int vmx_check_intercept_io(struct kvm_vcpu *vcpu,
586 + else
587 + intercept = nested_vmx_check_io_bitmaps(vcpu, port, size);
588 +
589 ++ /* FIXME: produce nested vmexit and return X86EMUL_INTERCEPTED. */
590 + return intercept ? X86EMUL_UNHANDLEABLE : X86EMUL_CONTINUE;
591 + }
592 +
593 +@@ -7194,6 +7195,20 @@ static int vmx_check_intercept(struct kvm_vcpu *vcpu,
594 + case x86_intercept_outs:
595 + return vmx_check_intercept_io(vcpu, info);
596 +
597 ++ case x86_intercept_lgdt:
598 ++ case x86_intercept_lidt:
599 ++ case x86_intercept_lldt:
600 ++ case x86_intercept_ltr:
601 ++ case x86_intercept_sgdt:
602 ++ case x86_intercept_sidt:
603 ++ case x86_intercept_sldt:
604 ++ case x86_intercept_str:
605 ++ if (!nested_cpu_has2(vmcs12, SECONDARY_EXEC_DESC))
606 ++ return X86EMUL_CONTINUE;
607 ++
608 ++ /* FIXME: produce nested vmexit and return X86EMUL_INTERCEPTED. */
609 ++ break;
610 ++
611 + /* TODO: check more intercepts... */
612 + default:
613 + break;
614 +diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
615 +index 95180d67d570..c5e15eba8052 100644
616 +--- a/arch/x86/kvm/x86.c
617 ++++ b/arch/x86/kvm/x86.c
618 +@@ -9192,12 +9192,6 @@ void kvm_arch_vcpu_postcreate(struct kvm_vcpu *vcpu)
619 +
620 + void kvm_arch_vcpu_destroy(struct kvm_vcpu *vcpu)
621 + {
622 +- vcpu->arch.apf.msr_val = 0;
623 +-
624 +- vcpu_load(vcpu);
625 +- kvm_mmu_unload(vcpu);
626 +- vcpu_put(vcpu);
627 +-
628 + kvm_arch_vcpu_free(vcpu);
629 + }
630 +
631 +diff --git a/drivers/acpi/acpi_watchdog.c b/drivers/acpi/acpi_watchdog.c
632 +index b5516b04ffc0..d827a4a3e946 100644
633 +--- a/drivers/acpi/acpi_watchdog.c
634 ++++ b/drivers/acpi/acpi_watchdog.c
635 +@@ -126,12 +126,11 @@ void __init acpi_watchdog_init(void)
636 + gas = &entries[i].register_region;
637 +
638 + res.start = gas->address;
639 ++ res.end = res.start + ACPI_ACCESS_BYTE_WIDTH(gas->access_width) - 1;
640 + if (gas->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) {
641 + res.flags = IORESOURCE_MEM;
642 +- res.end = res.start + ALIGN(gas->access_width, 4) - 1;
643 + } else if (gas->space_id == ACPI_ADR_SPACE_SYSTEM_IO) {
644 + res.flags = IORESOURCE_IO;
645 +- res.end = res.start + gas->access_width - 1;
646 + } else {
647 + pr_warn("Unsupported address space: %u\n",
648 + gas->space_id);
649 +diff --git a/drivers/bus/Kconfig b/drivers/bus/Kconfig
650 +index 6b331061d34b..47c2bb444ab4 100644
651 +--- a/drivers/bus/Kconfig
652 ++++ b/drivers/bus/Kconfig
653 +@@ -138,7 +138,6 @@ config TEGRA_ACONNECT
654 + tristate "Tegra ACONNECT Bus Driver"
655 + depends on ARCH_TEGRA_210_SOC
656 + depends on OF && PM
657 +- select PM_CLK
658 + help
659 + Driver for the Tegra ACONNECT bus which is used to interface with
660 + the devices inside the Audio Processing Engine (APE) for Tegra210.
661 +diff --git a/drivers/char/ipmi/ipmi_ssif.c b/drivers/char/ipmi/ipmi_ssif.c
662 +index 22c6a2e61236..8ac390c2b514 100644
663 +--- a/drivers/char/ipmi/ipmi_ssif.c
664 ++++ b/drivers/char/ipmi/ipmi_ssif.c
665 +@@ -775,10 +775,14 @@ static void msg_done_handler(struct ssif_info *ssif_info, int result,
666 + flags = ipmi_ssif_lock_cond(ssif_info, &oflags);
667 + msg = ssif_info->curr_msg;
668 + if (msg) {
669 ++ if (data) {
670 ++ if (len > IPMI_MAX_MSG_LENGTH)
671 ++ len = IPMI_MAX_MSG_LENGTH;
672 ++ memcpy(msg->rsp, data, len);
673 ++ } else {
674 ++ len = 0;
675 ++ }
676 + msg->rsp_size = len;
677 +- if (msg->rsp_size > IPMI_MAX_MSG_LENGTH)
678 +- msg->rsp_size = IPMI_MAX_MSG_LENGTH;
679 +- memcpy(msg->rsp, data, msg->rsp_size);
680 + ssif_info->curr_msg = NULL;
681 + }
682 +
683 +diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
684 +index 7679f8a91745..35f8e098e9fa 100644
685 +--- a/drivers/cpufreq/cpufreq.c
686 ++++ b/drivers/cpufreq/cpufreq.c
687 +@@ -1071,9 +1071,17 @@ static int cpufreq_init_policy(struct cpufreq_policy *policy)
688 + pol = policy->last_policy;
689 + } else if (def_gov) {
690 + pol = cpufreq_parse_policy(def_gov->name);
691 +- } else {
692 +- return -ENODATA;
693 ++ /*
694 ++ * In case the default governor is neiter "performance"
695 ++ * nor "powersave", fall back to the initial policy
696 ++ * value set by the driver.
697 ++ */
698 ++ if (pol == CPUFREQ_POLICY_UNKNOWN)
699 ++ pol = policy->policy;
700 + }
701 ++ if (pol != CPUFREQ_POLICY_PERFORMANCE &&
702 ++ pol != CPUFREQ_POLICY_POWERSAVE)
703 ++ return -ENODATA;
704 + }
705 +
706 + return cpufreq_set_policy(policy, gov, pol);
707 +diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
708 +index 174795ecbd3b..ff81b7cdab71 100644
709 +--- a/drivers/devfreq/devfreq.c
710 ++++ b/drivers/devfreq/devfreq.c
711 +@@ -613,7 +613,6 @@ struct devfreq *devfreq_add_device(struct device *dev,
712 + {
713 + struct devfreq *devfreq;
714 + struct devfreq_governor *governor;
715 +- static atomic_t devfreq_no = ATOMIC_INIT(-1);
716 + int err = 0;
717 +
718 + if (!dev || !profile || !governor_name) {
719 +@@ -677,8 +676,7 @@ struct devfreq *devfreq_add_device(struct device *dev,
720 + devfreq->suspend_freq = dev_pm_opp_get_suspend_opp_freq(dev);
721 + atomic_set(&devfreq->suspend_count, 0);
722 +
723 +- dev_set_name(&devfreq->dev, "devfreq%d",
724 +- atomic_inc_return(&devfreq_no));
725 ++ dev_set_name(&devfreq->dev, "%s", dev_name(dev));
726 + err = device_register(&devfreq->dev);
727 + if (err) {
728 + mutex_unlock(&devfreq->lock);
729 +diff --git a/drivers/edac/skx_common.c b/drivers/edac/skx_common.c
730 +index d8ff63d91b86..a04349c6d17e 100644
731 +--- a/drivers/edac/skx_common.c
732 ++++ b/drivers/edac/skx_common.c
733 +@@ -235,7 +235,7 @@ int skx_get_hi_lo(unsigned int did, int off[], u64 *tolm, u64 *tohm)
734 +
735 + pdev = pci_get_device(PCI_VENDOR_ID_INTEL, did, NULL);
736 + if (!pdev) {
737 +- skx_printk(KERN_ERR, "Can't get tolm/tohm\n");
738 ++ edac_dbg(2, "Can't get tolm/tohm\n");
739 + return -ENODEV;
740 + }
741 +
742 +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
743 +index bb9a2771a0f9..05d114a72ca1 100644
744 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
745 ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
746 +@@ -1421,7 +1421,7 @@ amdgpu_get_crtc_scanout_position(struct drm_device *dev, unsigned int pipe,
747 +
748 + static struct drm_driver kms_driver = {
749 + .driver_features =
750 +- DRIVER_USE_AGP | DRIVER_ATOMIC |
751 ++ DRIVER_ATOMIC |
752 + DRIVER_GEM |
753 + DRIVER_RENDER | DRIVER_MODESET | DRIVER_SYNCOBJ,
754 + .load = amdgpu_driver_load_kms,
755 +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h
756 +index aef6c396bd58..8c0ac66d31d0 100644
757 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h
758 ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h
759 +@@ -157,6 +157,7 @@ struct amdgpu_gmc {
760 + uint32_t srbm_soft_reset;
761 + bool prt_warning;
762 + uint64_t stolen_size;
763 ++ uint32_t sdpif_register;
764 + /* apertures */
765 + u64 shared_aperture_start;
766 + u64 shared_aperture_end;
767 +diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
768 +index d7caca042173..da53a55bf955 100644
769 +--- a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
770 ++++ b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
771 +@@ -1382,6 +1382,19 @@ static void gmc_v9_0_init_golden_registers(struct amdgpu_device *adev)
772 + }
773 + }
774 +
775 ++/**
776 ++ * gmc_v9_0_restore_registers - restores regs
777 ++ *
778 ++ * @adev: amdgpu_device pointer
779 ++ *
780 ++ * This restores register values, saved at suspend.
781 ++ */
782 ++static void gmc_v9_0_restore_registers(struct amdgpu_device *adev)
783 ++{
784 ++ if (adev->asic_type == CHIP_RAVEN)
785 ++ WREG32(mmDCHUBBUB_SDPIF_MMIO_CNTRL_0, adev->gmc.sdpif_register);
786 ++}
787 ++
788 + /**
789 + * gmc_v9_0_gart_enable - gart enable
790 + *
791 +@@ -1478,6 +1491,20 @@ static int gmc_v9_0_hw_init(void *handle)
792 + return r;
793 + }
794 +
795 ++/**
796 ++ * gmc_v9_0_save_registers - saves regs
797 ++ *
798 ++ * @adev: amdgpu_device pointer
799 ++ *
800 ++ * This saves potential register values that should be
801 ++ * restored upon resume
802 ++ */
803 ++static void gmc_v9_0_save_registers(struct amdgpu_device *adev)
804 ++{
805 ++ if (adev->asic_type == CHIP_RAVEN)
806 ++ adev->gmc.sdpif_register = RREG32(mmDCHUBBUB_SDPIF_MMIO_CNTRL_0);
807 ++}
808 ++
809 + /**
810 + * gmc_v9_0_gart_disable - gart disable
811 + *
812 +@@ -1514,9 +1541,16 @@ static int gmc_v9_0_hw_fini(void *handle)
813 +
814 + static int gmc_v9_0_suspend(void *handle)
815 + {
816 ++ int r;
817 + struct amdgpu_device *adev = (struct amdgpu_device *)handle;
818 +
819 +- return gmc_v9_0_hw_fini(adev);
820 ++ r = gmc_v9_0_hw_fini(adev);
821 ++ if (r)
822 ++ return r;
823 ++
824 ++ gmc_v9_0_save_registers(adev);
825 ++
826 ++ return 0;
827 + }
828 +
829 + static int gmc_v9_0_resume(void *handle)
830 +@@ -1524,6 +1558,7 @@ static int gmc_v9_0_resume(void *handle)
831 + int r;
832 + struct amdgpu_device *adev = (struct amdgpu_device *)handle;
833 +
834 ++ gmc_v9_0_restore_registers(adev);
835 + r = gmc_v9_0_hw_init(adev);
836 + if (r)
837 + return r;
838 +diff --git a/drivers/gpu/drm/amd/display/dc/clk_mgr/Makefile b/drivers/gpu/drm/amd/display/dc/clk_mgr/Makefile
839 +index b864869cc7e3..6fa7422c51da 100644
840 +--- a/drivers/gpu/drm/amd/display/dc/clk_mgr/Makefile
841 ++++ b/drivers/gpu/drm/amd/display/dc/clk_mgr/Makefile
842 +@@ -91,6 +91,12 @@ ifdef CONFIG_DRM_AMD_DC_DCN2_1
843 + ###############################################################################
844 + CLK_MGR_DCN21 = rn_clk_mgr.o rn_clk_mgr_vbios_smu.o
845 +
846 ++# prevent build errors regarding soft-float vs hard-float FP ABI tags
847 ++# this code is currently unused on ppc64, as it applies to Renoir APUs only
848 ++ifdef CONFIG_PPC64
849 ++CFLAGS_$(AMDDALPATH)/dc/clk_mgr/dcn21/rn_clk_mgr.o := $(call cc-option,-mno-gnu-attribute)
850 ++endif
851 ++
852 + AMD_DAL_CLK_MGR_DCN21 = $(addprefix $(AMDDALPATH)/dc/clk_mgr/dcn21/,$(CLK_MGR_DCN21))
853 +
854 + AMD_DISPLAY_FILES += $(AMD_DAL_CLK_MGR_DCN21)
855 +diff --git a/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn21/rn_clk_mgr.c b/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn21/rn_clk_mgr.c
856 +index 787f94d815f4..dd92f9c295b4 100644
857 +--- a/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn21/rn_clk_mgr.c
858 ++++ b/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn21/rn_clk_mgr.c
859 +@@ -91,6 +91,12 @@ void rn_update_clocks(struct clk_mgr *clk_mgr_base,
860 + rn_vbios_smu_set_min_deep_sleep_dcfclk(clk_mgr, clk_mgr_base->clks.dcfclk_deep_sleep_khz);
861 + }
862 +
863 ++ // workaround: Limit dppclk to 100Mhz to avoid lower eDP panel switch to plus 4K monitor underflow.
864 ++ if (!IS_DIAG_DC(dc->ctx->dce_environment)) {
865 ++ if (new_clocks->dppclk_khz < 100000)
866 ++ new_clocks->dppclk_khz = 100000;
867 ++ }
868 ++
869 + if (should_set_clock(safe_to_lower, new_clocks->dppclk_khz, clk_mgr->base.clks.dppclk_khz)) {
870 + if (clk_mgr->base.clks.dppclk_khz > new_clocks->dppclk_khz)
871 + dpp_clock_lowered = true;
872 +diff --git a/drivers/gpu/drm/amd/display/dc/dce/dce_aux.c b/drivers/gpu/drm/amd/display/dc/dce/dce_aux.c
873 +index c3f9f4185ce8..cf877238fff9 100644
874 +--- a/drivers/gpu/drm/amd/display/dc/dce/dce_aux.c
875 ++++ b/drivers/gpu/drm/amd/display/dc/dce/dce_aux.c
876 +@@ -386,7 +386,7 @@ static bool acquire(
877 + {
878 + enum gpio_result result;
879 +
880 +- if (!is_engine_available(engine))
881 ++ if ((engine == NULL) || !is_engine_available(engine))
882 + return false;
883 +
884 + result = dal_ddc_open(ddc, GPIO_MODE_HARDWARE,
885 +diff --git a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c
886 +index 937a8ba81160..e933f6a369f9 100644
887 +--- a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c
888 ++++ b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c
889 +@@ -493,7 +493,6 @@ static void dcn20_plane_atomic_disable(struct dc *dc, struct pipe_ctx *pipe_ctx)
890 + dpp->funcs->dpp_dppclk_control(dpp, false, false);
891 +
892 + hubp->power_gated = true;
893 +- dc->optimized_required = false; /* We're powering off, no need to optimize */
894 +
895 + dc->hwss.plane_atomic_power_down(dc,
896 + pipe_ctx->plane_res.dpp,
897 +diff --git a/drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c b/drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c
898 +index b0e5e64df212..161bf7caf3ae 100644
899 +--- a/drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c
900 ++++ b/drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c
901 +@@ -57,6 +57,7 @@
902 + #include "dcn20/dcn20_dccg.h"
903 + #include "dcn21_hubbub.h"
904 + #include "dcn10/dcn10_resource.h"
905 ++#include "dce110/dce110_resource.h"
906 +
907 + #include "dcn20/dcn20_dwb.h"
908 + #include "dcn20/dcn20_mmhubbub.h"
909 +@@ -824,6 +825,7 @@ static const struct dc_debug_options debug_defaults_diags = {
910 + enum dcn20_clk_src_array_id {
911 + DCN20_CLK_SRC_PLL0,
912 + DCN20_CLK_SRC_PLL1,
913 ++ DCN20_CLK_SRC_PLL2,
914 + DCN20_CLK_SRC_TOTAL_DCN21
915 + };
916 +
917 +@@ -1492,6 +1494,10 @@ static bool construct(
918 + dcn21_clock_source_create(ctx, ctx->dc_bios,
919 + CLOCK_SOURCE_COMBO_PHY_PLL1,
920 + &clk_src_regs[1], false);
921 ++ pool->base.clock_sources[DCN20_CLK_SRC_PLL2] =
922 ++ dcn21_clock_source_create(ctx, ctx->dc_bios,
923 ++ CLOCK_SOURCE_COMBO_PHY_PLL2,
924 ++ &clk_src_regs[2], false);
925 +
926 + pool->base.clk_src_count = DCN20_CLK_SRC_TOTAL_DCN21;
927 +
928 +diff --git a/drivers/gpu/drm/amd/include/asic_reg/dce/dce_12_0_offset.h b/drivers/gpu/drm/amd/include/asic_reg/dce/dce_12_0_offset.h
929 +index b6f74bf4af02..27bb8c1ab858 100644
930 +--- a/drivers/gpu/drm/amd/include/asic_reg/dce/dce_12_0_offset.h
931 ++++ b/drivers/gpu/drm/amd/include/asic_reg/dce/dce_12_0_offset.h
932 +@@ -7376,6 +7376,8 @@
933 + #define mmCRTC4_CRTC_DRR_CONTROL 0x0f3e
934 + #define mmCRTC4_CRTC_DRR_CONTROL_BASE_IDX 2
935 +
936 ++#define mmDCHUBBUB_SDPIF_MMIO_CNTRL_0 0x395d
937 ++#define mmDCHUBBUB_SDPIF_MMIO_CNTRL_0_BASE_IDX 2
938 +
939 + // addressBlock: dce_dc_fmt4_dispdec
940 + // base address: 0x2000
941 +diff --git a/drivers/gpu/drm/i915/Kconfig.debug b/drivers/gpu/drm/i915/Kconfig.debug
942 +index 00786a142ff0..41c8e39a73ba 100644
943 +--- a/drivers/gpu/drm/i915/Kconfig.debug
944 ++++ b/drivers/gpu/drm/i915/Kconfig.debug
945 +@@ -7,7 +7,6 @@ config DRM_I915_WERROR
946 + # We use the dependency on !COMPILE_TEST to not be enabled in
947 + # allmodconfig or allyesconfig configurations
948 + depends on !COMPILE_TEST
949 +- select HEADER_TEST
950 + default n
951 + help
952 + Add -Werror to the build flags for (and only for) i915.ko.
953 +diff --git a/drivers/gpu/drm/i915/gvt/dmabuf.c b/drivers/gpu/drm/i915/gvt/dmabuf.c
954 +index 4bfaefdf548d..c0347956f7cf 100644
955 +--- a/drivers/gpu/drm/i915/gvt/dmabuf.c
956 ++++ b/drivers/gpu/drm/i915/gvt/dmabuf.c
957 +@@ -96,12 +96,12 @@ static void dmabuf_gem_object_free(struct kref *kref)
958 + dmabuf_obj = container_of(pos,
959 + struct intel_vgpu_dmabuf_obj, list);
960 + if (dmabuf_obj == obj) {
961 ++ list_del(pos);
962 + intel_gvt_hypervisor_put_vfio_device(vgpu);
963 + idr_remove(&vgpu->object_idr,
964 + dmabuf_obj->dmabuf_id);
965 + kfree(dmabuf_obj->info);
966 + kfree(dmabuf_obj);
967 +- list_del(pos);
968 + break;
969 + }
970 + }
971 +diff --git a/drivers/gpu/drm/i915/gvt/vgpu.c b/drivers/gpu/drm/i915/gvt/vgpu.c
972 +index d5a6e4e3d0fd..b232965b45b5 100644
973 +--- a/drivers/gpu/drm/i915/gvt/vgpu.c
974 ++++ b/drivers/gpu/drm/i915/gvt/vgpu.c
975 +@@ -560,9 +560,9 @@ void intel_gvt_reset_vgpu_locked(struct intel_vgpu *vgpu, bool dmlr,
976 +
977 + intel_vgpu_reset_mmio(vgpu, dmlr);
978 + populate_pvinfo_page(vgpu);
979 +- intel_vgpu_reset_display(vgpu);
980 +
981 + if (dmlr) {
982 ++ intel_vgpu_reset_display(vgpu);
983 + intel_vgpu_reset_cfg_space(vgpu);
984 + /* only reset the failsafe mode when dmlr reset */
985 + vgpu->failsafe = false;
986 +diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c
987 +index c84f0a8b3f2c..b73fbb65e14b 100644
988 +--- a/drivers/gpu/drm/msm/msm_drv.c
989 ++++ b/drivers/gpu/drm/msm/msm_drv.c
990 +@@ -441,6 +441,14 @@ static int msm_drm_init(struct device *dev, struct drm_driver *drv)
991 + if (ret)
992 + goto err_msm_uninit;
993 +
994 ++ if (!dev->dma_parms) {
995 ++ dev->dma_parms = devm_kzalloc(dev, sizeof(*dev->dma_parms),
996 ++ GFP_KERNEL);
997 ++ if (!dev->dma_parms)
998 ++ return -ENOMEM;
999 ++ }
1000 ++ dma_set_max_seg_size(dev, DMA_BIT_MASK(32));
1001 ++
1002 + msm_gem_shrinker_init(ddev);
1003 +
1004 + switch (get_mdp_ver(pdev)) {
1005 +diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c
1006 +index 4528f4dc0b2d..6128792ab883 100644
1007 +--- a/drivers/gpu/drm/radeon/radeon_drv.c
1008 ++++ b/drivers/gpu/drm/radeon/radeon_drv.c
1009 +@@ -37,6 +37,7 @@
1010 + #include <linux/vga_switcheroo.h>
1011 + #include <linux/mmu_notifier.h>
1012 +
1013 ++#include <drm/drm_agpsupport.h>
1014 + #include <drm/drm_crtc_helper.h>
1015 + #include <drm/drm_drv.h>
1016 + #include <drm/drm_fb_helper.h>
1017 +@@ -325,6 +326,7 @@ static int radeon_pci_probe(struct pci_dev *pdev,
1018 + const struct pci_device_id *ent)
1019 + {
1020 + unsigned long flags = 0;
1021 ++ struct drm_device *dev;
1022 + int ret;
1023 +
1024 + if (!ent)
1025 +@@ -365,7 +367,44 @@ static int radeon_pci_probe(struct pci_dev *pdev,
1026 + if (ret)
1027 + return ret;
1028 +
1029 +- return drm_get_pci_dev(pdev, ent, &kms_driver);
1030 ++ dev = drm_dev_alloc(&kms_driver, &pdev->dev);
1031 ++ if (IS_ERR(dev))
1032 ++ return PTR_ERR(dev);
1033 ++
1034 ++ ret = pci_enable_device(pdev);
1035 ++ if (ret)
1036 ++ goto err_free;
1037 ++
1038 ++ dev->pdev = pdev;
1039 ++#ifdef __alpha__
1040 ++ dev->hose = pdev->sysdata;
1041 ++#endif
1042 ++
1043 ++ pci_set_drvdata(pdev, dev);
1044 ++
1045 ++ if (pci_find_capability(dev->pdev, PCI_CAP_ID_AGP))
1046 ++ dev->agp = drm_agp_init(dev);
1047 ++ if (dev->agp) {
1048 ++ dev->agp->agp_mtrr = arch_phys_wc_add(
1049 ++ dev->agp->agp_info.aper_base,
1050 ++ dev->agp->agp_info.aper_size *
1051 ++ 1024 * 1024);
1052 ++ }
1053 ++
1054 ++ ret = drm_dev_register(dev, ent->driver_data);
1055 ++ if (ret)
1056 ++ goto err_agp;
1057 ++
1058 ++ return 0;
1059 ++
1060 ++err_agp:
1061 ++ if (dev->agp)
1062 ++ arch_phys_wc_del(dev->agp->agp_mtrr);
1063 ++ kfree(dev->agp);
1064 ++ pci_disable_device(pdev);
1065 ++err_free:
1066 ++ drm_dev_put(dev);
1067 ++ return ret;
1068 + }
1069 +
1070 + static void
1071 +@@ -578,7 +617,7 @@ radeon_get_crtc_scanout_position(struct drm_device *dev, unsigned int pipe,
1072 +
1073 + static struct drm_driver kms_driver = {
1074 + .driver_features =
1075 +- DRIVER_USE_AGP | DRIVER_GEM | DRIVER_RENDER,
1076 ++ DRIVER_GEM | DRIVER_RENDER,
1077 + .load = radeon_driver_load_kms,
1078 + .open = radeon_driver_open_kms,
1079 + .postclose = radeon_driver_postclose_kms,
1080 +diff --git a/drivers/gpu/drm/radeon/radeon_kms.c b/drivers/gpu/drm/radeon/radeon_kms.c
1081 +index e85c554eeaa9..2bb0187c5bc7 100644
1082 +--- a/drivers/gpu/drm/radeon/radeon_kms.c
1083 ++++ b/drivers/gpu/drm/radeon/radeon_kms.c
1084 +@@ -31,6 +31,7 @@
1085 + #include <linux/uaccess.h>
1086 + #include <linux/vga_switcheroo.h>
1087 +
1088 ++#include <drm/drm_agpsupport.h>
1089 + #include <drm/drm_fb_helper.h>
1090 + #include <drm/drm_file.h>
1091 + #include <drm/drm_ioctl.h>
1092 +@@ -77,6 +78,11 @@ void radeon_driver_unload_kms(struct drm_device *dev)
1093 + radeon_modeset_fini(rdev);
1094 + radeon_device_fini(rdev);
1095 +
1096 ++ if (dev->agp)
1097 ++ arch_phys_wc_del(dev->agp->agp_mtrr);
1098 ++ kfree(dev->agp);
1099 ++ dev->agp = NULL;
1100 ++
1101 + done_free:
1102 + kfree(rdev);
1103 + dev->dev_private = NULL;
1104 +diff --git a/drivers/hid/hid-alps.c b/drivers/hid/hid-alps.c
1105 +index ae79a7c66737..fa704153cb00 100644
1106 +--- a/drivers/hid/hid-alps.c
1107 ++++ b/drivers/hid/hid-alps.c
1108 +@@ -730,7 +730,7 @@ static int alps_input_configured(struct hid_device *hdev, struct hid_input *hi)
1109 + if (data->has_sp) {
1110 + input2 = input_allocate_device();
1111 + if (!input2) {
1112 +- input_free_device(input2);
1113 ++ ret = -ENOMEM;
1114 + goto exit;
1115 + }
1116 +
1117 +diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
1118 +index 851fe54ea59e..359616e3efbb 100644
1119 +--- a/drivers/hid/hid-core.c
1120 ++++ b/drivers/hid/hid-core.c
1121 +@@ -1741,7 +1741,9 @@ int hid_report_raw_event(struct hid_device *hid, int type, u8 *data, u32 size,
1122 +
1123 + rsize = ((report->size - 1) >> 3) + 1;
1124 +
1125 +- if (rsize > HID_MAX_BUFFER_SIZE)
1126 ++ if (report_enum->numbered && rsize >= HID_MAX_BUFFER_SIZE)
1127 ++ rsize = HID_MAX_BUFFER_SIZE - 1;
1128 ++ else if (rsize > HID_MAX_BUFFER_SIZE)
1129 + rsize = HID_MAX_BUFFER_SIZE;
1130 +
1131 + if (csize < rsize) {
1132 +diff --git a/drivers/hid/hid-ite.c b/drivers/hid/hid-ite.c
1133 +index c436e12feb23..6c55682c5974 100644
1134 +--- a/drivers/hid/hid-ite.c
1135 ++++ b/drivers/hid/hid-ite.c
1136 +@@ -41,8 +41,9 @@ static const struct hid_device_id ite_devices[] = {
1137 + { HID_USB_DEVICE(USB_VENDOR_ID_ITE, USB_DEVICE_ID_ITE8595) },
1138 + { HID_USB_DEVICE(USB_VENDOR_ID_258A, USB_DEVICE_ID_258A_6A88) },
1139 + /* ITE8595 USB kbd ctlr, with Synaptics touchpad connected to it. */
1140 +- { HID_USB_DEVICE(USB_VENDOR_ID_SYNAPTICS,
1141 +- USB_DEVICE_ID_SYNAPTICS_ACER_SWITCH5_012) },
1142 ++ { HID_DEVICE(BUS_USB, HID_GROUP_GENERIC,
1143 ++ USB_VENDOR_ID_SYNAPTICS,
1144 ++ USB_DEVICE_ID_SYNAPTICS_ACER_SWITCH5_012) },
1145 + { }
1146 + };
1147 + MODULE_DEVICE_TABLE(hid, ite_devices);
1148 +diff --git a/drivers/hid/usbhid/hiddev.c b/drivers/hid/usbhid/hiddev.c
1149 +index c879b214a479..35b1fa6d962e 100644
1150 +--- a/drivers/hid/usbhid/hiddev.c
1151 ++++ b/drivers/hid/usbhid/hiddev.c
1152 +@@ -941,9 +941,9 @@ void hiddev_disconnect(struct hid_device *hid)
1153 + hiddev->exist = 0;
1154 +
1155 + if (hiddev->open) {
1156 +- mutex_unlock(&hiddev->existancelock);
1157 + hid_hw_close(hiddev->hid);
1158 + wake_up_interruptible(&hiddev->wait);
1159 ++ mutex_unlock(&hiddev->existancelock);
1160 + } else {
1161 + mutex_unlock(&hiddev->existancelock);
1162 + kfree(hiddev);
1163 +diff --git a/drivers/i2c/busses/i2c-altera.c b/drivers/i2c/busses/i2c-altera.c
1164 +index 5255d3755411..1de23b4f3809 100644
1165 +--- a/drivers/i2c/busses/i2c-altera.c
1166 ++++ b/drivers/i2c/busses/i2c-altera.c
1167 +@@ -171,7 +171,7 @@ static void altr_i2c_init(struct altr_i2c_dev *idev)
1168 + /* SCL Low Time */
1169 + writel(t_low, idev->base + ALTR_I2C_SCL_LOW);
1170 + /* SDA Hold Time, 300ns */
1171 +- writel(div_u64(300 * clk_mhz, 1000), idev->base + ALTR_I2C_SDA_HOLD);
1172 ++ writel(3 * clk_mhz / 10, idev->base + ALTR_I2C_SDA_HOLD);
1173 +
1174 + /* Mask all master interrupt bits */
1175 + altr_i2c_int_enable(idev, ALTR_I2C_ALL_IRQ, false);
1176 +diff --git a/drivers/i2c/busses/i2c-jz4780.c b/drivers/i2c/busses/i2c-jz4780.c
1177 +index 25dcd73acd63..8f0e1f802f2d 100644
1178 +--- a/drivers/i2c/busses/i2c-jz4780.c
1179 ++++ b/drivers/i2c/busses/i2c-jz4780.c
1180 +@@ -73,25 +73,6 @@
1181 + #define JZ4780_I2C_STA_TFNF BIT(1)
1182 + #define JZ4780_I2C_STA_ACT BIT(0)
1183 +
1184 +-static const char * const jz4780_i2c_abrt_src[] = {
1185 +- "ABRT_7B_ADDR_NOACK",
1186 +- "ABRT_10ADDR1_NOACK",
1187 +- "ABRT_10ADDR2_NOACK",
1188 +- "ABRT_XDATA_NOACK",
1189 +- "ABRT_GCALL_NOACK",
1190 +- "ABRT_GCALL_READ",
1191 +- "ABRT_HS_ACKD",
1192 +- "SBYTE_ACKDET",
1193 +- "ABRT_HS_NORSTRT",
1194 +- "SBYTE_NORSTRT",
1195 +- "ABRT_10B_RD_NORSTRT",
1196 +- "ABRT_MASTER_DIS",
1197 +- "ARB_LOST",
1198 +- "SLVFLUSH_TXFIFO",
1199 +- "SLV_ARBLOST",
1200 +- "SLVRD_INTX",
1201 +-};
1202 +-
1203 + #define JZ4780_I2C_INTST_IGC BIT(11)
1204 + #define JZ4780_I2C_INTST_ISTT BIT(10)
1205 + #define JZ4780_I2C_INTST_ISTP BIT(9)
1206 +@@ -529,21 +510,8 @@ done:
1207 +
1208 + static void jz4780_i2c_txabrt(struct jz4780_i2c *i2c, int src)
1209 + {
1210 +- int i;
1211 +-
1212 +- dev_err(&i2c->adap.dev, "txabrt: 0x%08x\n", src);
1213 +- dev_err(&i2c->adap.dev, "device addr=%x\n",
1214 +- jz4780_i2c_readw(i2c, JZ4780_I2C_TAR));
1215 +- dev_err(&i2c->adap.dev, "send cmd count:%d %d\n",
1216 +- i2c->cmd, i2c->cmd_buf[i2c->cmd]);
1217 +- dev_err(&i2c->adap.dev, "receive data count:%d %d\n",
1218 +- i2c->cmd, i2c->data_buf[i2c->cmd]);
1219 +-
1220 +- for (i = 0; i < 16; i++) {
1221 +- if (src & BIT(i))
1222 +- dev_dbg(&i2c->adap.dev, "I2C TXABRT[%d]=%s\n",
1223 +- i, jz4780_i2c_abrt_src[i]);
1224 +- }
1225 ++ dev_dbg(&i2c->adap.dev, "txabrt: 0x%08x, cmd: %d, send: %d, recv: %d\n",
1226 ++ src, i2c->cmd, i2c->cmd_buf[i2c->cmd], i2c->data_buf[i2c->cmd]);
1227 + }
1228 +
1229 + static inline int jz4780_i2c_xfer_read(struct jz4780_i2c *i2c,
1230 +diff --git a/drivers/infiniband/hw/hns/hns_roce_device.h b/drivers/infiniband/hw/hns/hns_roce_device.h
1231 +index 96d1302abde1..e36d31569081 100644
1232 +--- a/drivers/infiniband/hw/hns/hns_roce_device.h
1233 ++++ b/drivers/infiniband/hw/hns/hns_roce_device.h
1234 +@@ -425,7 +425,7 @@ struct hns_roce_mr_table {
1235 + struct hns_roce_wq {
1236 + u64 *wrid; /* Work request ID */
1237 + spinlock_t lock;
1238 +- int wqe_cnt; /* WQE num */
1239 ++ u32 wqe_cnt; /* WQE num */
1240 + u32 max_post;
1241 + int max_gs;
1242 + int offset;
1243 +@@ -658,7 +658,6 @@ struct hns_roce_qp {
1244 + u8 sdb_en;
1245 + u32 doorbell_qpn;
1246 + u32 sq_signal_bits;
1247 +- u32 sq_next_wqe;
1248 + struct hns_roce_wq sq;
1249 +
1250 + struct ib_umem *umem;
1251 +diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v1.c b/drivers/infiniband/hw/hns/hns_roce_hw_v1.c
1252 +index 5f74bf55f471..a79fa67df871 100644
1253 +--- a/drivers/infiniband/hw/hns/hns_roce_hw_v1.c
1254 ++++ b/drivers/infiniband/hw/hns/hns_roce_hw_v1.c
1255 +@@ -74,8 +74,8 @@ static int hns_roce_v1_post_send(struct ib_qp *ibqp,
1256 + unsigned long flags = 0;
1257 + void *wqe = NULL;
1258 + __le32 doorbell[2];
1259 ++ u32 wqe_idx = 0;
1260 + int nreq = 0;
1261 +- u32 ind = 0;
1262 + int ret = 0;
1263 + u8 *smac;
1264 + int loopback;
1265 +@@ -88,7 +88,7 @@ static int hns_roce_v1_post_send(struct ib_qp *ibqp,
1266 + }
1267 +
1268 + spin_lock_irqsave(&qp->sq.lock, flags);
1269 +- ind = qp->sq_next_wqe;
1270 ++
1271 + for (nreq = 0; wr; ++nreq, wr = wr->next) {
1272 + if (hns_roce_wq_overflow(&qp->sq, nreq, qp->ibqp.send_cq)) {
1273 + ret = -ENOMEM;
1274 +@@ -96,6 +96,8 @@ static int hns_roce_v1_post_send(struct ib_qp *ibqp,
1275 + goto out;
1276 + }
1277 +
1278 ++ wqe_idx = (qp->sq.head + nreq) & (qp->sq.wqe_cnt - 1);
1279 ++
1280 + if (unlikely(wr->num_sge > qp->sq.max_gs)) {
1281 + dev_err(dev, "num_sge=%d > qp->sq.max_gs=%d\n",
1282 + wr->num_sge, qp->sq.max_gs);
1283 +@@ -104,9 +106,8 @@ static int hns_roce_v1_post_send(struct ib_qp *ibqp,
1284 + goto out;
1285 + }
1286 +
1287 +- wqe = get_send_wqe(qp, ind & (qp->sq.wqe_cnt - 1));
1288 +- qp->sq.wrid[(qp->sq.head + nreq) & (qp->sq.wqe_cnt - 1)] =
1289 +- wr->wr_id;
1290 ++ wqe = get_send_wqe(qp, wqe_idx);
1291 ++ qp->sq.wrid[wqe_idx] = wr->wr_id;
1292 +
1293 + /* Corresponding to the RC and RD type wqe process separately */
1294 + if (ibqp->qp_type == IB_QPT_GSI) {
1295 +@@ -210,7 +211,6 @@ static int hns_roce_v1_post_send(struct ib_qp *ibqp,
1296 + cpu_to_le32((wr->sg_list[1].addr) >> 32);
1297 + ud_sq_wqe->l_key1 =
1298 + cpu_to_le32(wr->sg_list[1].lkey);
1299 +- ind++;
1300 + } else if (ibqp->qp_type == IB_QPT_RC) {
1301 + u32 tmp_len = 0;
1302 +
1303 +@@ -308,7 +308,6 @@ static int hns_roce_v1_post_send(struct ib_qp *ibqp,
1304 + ctrl->flag |= cpu_to_le32(wr->num_sge <<
1305 + HNS_ROCE_WQE_SGE_NUM_BIT);
1306 + }
1307 +- ind++;
1308 + }
1309 + }
1310 +
1311 +@@ -336,7 +335,6 @@ out:
1312 + doorbell[1] = sq_db.u32_8;
1313 +
1314 + hns_roce_write64_k(doorbell, qp->sq.db_reg_l);
1315 +- qp->sq_next_wqe = ind;
1316 + }
1317 +
1318 + spin_unlock_irqrestore(&qp->sq.lock, flags);
1319 +@@ -348,12 +346,6 @@ static int hns_roce_v1_post_recv(struct ib_qp *ibqp,
1320 + const struct ib_recv_wr *wr,
1321 + const struct ib_recv_wr **bad_wr)
1322 + {
1323 +- int ret = 0;
1324 +- int nreq = 0;
1325 +- int ind = 0;
1326 +- int i = 0;
1327 +- u32 reg_val;
1328 +- unsigned long flags = 0;
1329 + struct hns_roce_rq_wqe_ctrl *ctrl = NULL;
1330 + struct hns_roce_wqe_data_seg *scat = NULL;
1331 + struct hns_roce_qp *hr_qp = to_hr_qp(ibqp);
1332 +@@ -361,9 +353,14 @@ static int hns_roce_v1_post_recv(struct ib_qp *ibqp,
1333 + struct device *dev = &hr_dev->pdev->dev;
1334 + struct hns_roce_rq_db rq_db;
1335 + __le32 doorbell[2] = {0};
1336 ++ unsigned long flags = 0;
1337 ++ unsigned int wqe_idx;
1338 ++ int ret = 0;
1339 ++ int nreq = 0;
1340 ++ int i = 0;
1341 ++ u32 reg_val;
1342 +
1343 + spin_lock_irqsave(&hr_qp->rq.lock, flags);
1344 +- ind = hr_qp->rq.head & (hr_qp->rq.wqe_cnt - 1);
1345 +
1346 + for (nreq = 0; wr; ++nreq, wr = wr->next) {
1347 + if (hns_roce_wq_overflow(&hr_qp->rq, nreq,
1348 +@@ -373,6 +370,8 @@ static int hns_roce_v1_post_recv(struct ib_qp *ibqp,
1349 + goto out;
1350 + }
1351 +
1352 ++ wqe_idx = (hr_qp->rq.head + nreq) & (hr_qp->rq.wqe_cnt - 1);
1353 ++
1354 + if (unlikely(wr->num_sge > hr_qp->rq.max_gs)) {
1355 + dev_err(dev, "rq:num_sge=%d > qp->sq.max_gs=%d\n",
1356 + wr->num_sge, hr_qp->rq.max_gs);
1357 +@@ -381,7 +380,7 @@ static int hns_roce_v1_post_recv(struct ib_qp *ibqp,
1358 + goto out;
1359 + }
1360 +
1361 +- ctrl = get_recv_wqe(hr_qp, ind);
1362 ++ ctrl = get_recv_wqe(hr_qp, wqe_idx);
1363 +
1364 + roce_set_field(ctrl->rwqe_byte_12,
1365 + RQ_WQE_CTRL_RWQE_BYTE_12_RWQE_SGE_NUM_M,
1366 +@@ -393,9 +392,7 @@ static int hns_roce_v1_post_recv(struct ib_qp *ibqp,
1367 + for (i = 0; i < wr->num_sge; i++)
1368 + set_data_seg(scat + i, wr->sg_list + i);
1369 +
1370 +- hr_qp->rq.wrid[ind] = wr->wr_id;
1371 +-
1372 +- ind = (ind + 1) & (hr_qp->rq.wqe_cnt - 1);
1373 ++ hr_qp->rq.wrid[wqe_idx] = wr->wr_id;
1374 + }
1375 +
1376 + out:
1377 +@@ -2702,7 +2699,6 @@ static int hns_roce_v1_m_sqp(struct ib_qp *ibqp, const struct ib_qp_attr *attr,
1378 + hr_qp->rq.tail = 0;
1379 + hr_qp->sq.head = 0;
1380 + hr_qp->sq.tail = 0;
1381 +- hr_qp->sq_next_wqe = 0;
1382 + }
1383 +
1384 + kfree(context);
1385 +@@ -3316,7 +3312,6 @@ static int hns_roce_v1_m_qp(struct ib_qp *ibqp, const struct ib_qp_attr *attr,
1386 + hr_qp->rq.tail = 0;
1387 + hr_qp->sq.head = 0;
1388 + hr_qp->sq.tail = 0;
1389 +- hr_qp->sq_next_wqe = 0;
1390 + }
1391 + out:
1392 + kfree(context);
1393 +diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
1394 +index 79294f278b26..4540b00ccee9 100644
1395 +--- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
1396 ++++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
1397 +@@ -110,7 +110,7 @@ static void set_atomic_seg(struct hns_roce_wqe_atomic_seg *aseg,
1398 + }
1399 +
1400 + static void set_extend_sge(struct hns_roce_qp *qp, const struct ib_send_wr *wr,
1401 +- unsigned int *sge_ind)
1402 ++ unsigned int *sge_ind, int valid_num_sge)
1403 + {
1404 + struct hns_roce_v2_wqe_data_seg *dseg;
1405 + struct ib_sge *sg;
1406 +@@ -123,7 +123,7 @@ static void set_extend_sge(struct hns_roce_qp *qp, const struct ib_send_wr *wr,
1407 +
1408 + if (qp->ibqp.qp_type == IB_QPT_RC || qp->ibqp.qp_type == IB_QPT_UC)
1409 + num_in_wqe = HNS_ROCE_V2_UC_RC_SGE_NUM_IN_WQE;
1410 +- extend_sge_num = wr->num_sge - num_in_wqe;
1411 ++ extend_sge_num = valid_num_sge - num_in_wqe;
1412 + sg = wr->sg_list + num_in_wqe;
1413 + shift = qp->hr_buf.page_shift;
1414 +
1415 +@@ -159,14 +159,16 @@ static void set_extend_sge(struct hns_roce_qp *qp, const struct ib_send_wr *wr,
1416 + static int set_rwqe_data_seg(struct ib_qp *ibqp, const struct ib_send_wr *wr,
1417 + struct hns_roce_v2_rc_send_wqe *rc_sq_wqe,
1418 + void *wqe, unsigned int *sge_ind,
1419 ++ int valid_num_sge,
1420 + const struct ib_send_wr **bad_wr)
1421 + {
1422 + struct hns_roce_dev *hr_dev = to_hr_dev(ibqp->device);
1423 + struct hns_roce_v2_wqe_data_seg *dseg = wqe;
1424 + struct hns_roce_qp *qp = to_hr_qp(ibqp);
1425 ++ int j = 0;
1426 + int i;
1427 +
1428 +- if (wr->send_flags & IB_SEND_INLINE && wr->num_sge) {
1429 ++ if (wr->send_flags & IB_SEND_INLINE && valid_num_sge) {
1430 + if (le32_to_cpu(rc_sq_wqe->msg_len) >
1431 + hr_dev->caps.max_sq_inline) {
1432 + *bad_wr = wr;
1433 +@@ -190,7 +192,7 @@ static int set_rwqe_data_seg(struct ib_qp *ibqp, const struct ib_send_wr *wr,
1434 + roce_set_bit(rc_sq_wqe->byte_4, V2_RC_SEND_WQE_BYTE_4_INLINE_S,
1435 + 1);
1436 + } else {
1437 +- if (wr->num_sge <= HNS_ROCE_V2_UC_RC_SGE_NUM_IN_WQE) {
1438 ++ if (valid_num_sge <= HNS_ROCE_V2_UC_RC_SGE_NUM_IN_WQE) {
1439 + for (i = 0; i < wr->num_sge; i++) {
1440 + if (likely(wr->sg_list[i].length)) {
1441 + set_data_seg_v2(dseg, wr->sg_list + i);
1442 +@@ -203,19 +205,21 @@ static int set_rwqe_data_seg(struct ib_qp *ibqp, const struct ib_send_wr *wr,
1443 + V2_RC_SEND_WQE_BYTE_20_MSG_START_SGE_IDX_S,
1444 + (*sge_ind) & (qp->sge.sge_cnt - 1));
1445 +
1446 +- for (i = 0; i < HNS_ROCE_V2_UC_RC_SGE_NUM_IN_WQE; i++) {
1447 ++ for (i = 0; i < wr->num_sge &&
1448 ++ j < HNS_ROCE_V2_UC_RC_SGE_NUM_IN_WQE; i++) {
1449 + if (likely(wr->sg_list[i].length)) {
1450 + set_data_seg_v2(dseg, wr->sg_list + i);
1451 + dseg++;
1452 ++ j++;
1453 + }
1454 + }
1455 +
1456 +- set_extend_sge(qp, wr, sge_ind);
1457 ++ set_extend_sge(qp, wr, sge_ind, valid_num_sge);
1458 + }
1459 +
1460 + roce_set_field(rc_sq_wqe->byte_16,
1461 + V2_RC_SEND_WQE_BYTE_16_SGE_NUM_M,
1462 +- V2_RC_SEND_WQE_BYTE_16_SGE_NUM_S, wr->num_sge);
1463 ++ V2_RC_SEND_WQE_BYTE_16_SGE_NUM_S, valid_num_sge);
1464 + }
1465 +
1466 + return 0;
1467 +@@ -239,10 +243,11 @@ static int hns_roce_v2_post_send(struct ib_qp *ibqp,
1468 + struct device *dev = hr_dev->dev;
1469 + struct hns_roce_v2_db sq_db;
1470 + struct ib_qp_attr attr;
1471 +- unsigned int sge_ind;
1472 + unsigned int owner_bit;
1473 ++ unsigned int sge_idx;
1474 ++ unsigned int wqe_idx;
1475 + unsigned long flags;
1476 +- unsigned int ind;
1477 ++ int valid_num_sge;
1478 + void *wqe = NULL;
1479 + bool loopback;
1480 + int attr_mask;
1481 +@@ -269,8 +274,7 @@ static int hns_roce_v2_post_send(struct ib_qp *ibqp,
1482 + }
1483 +
1484 + spin_lock_irqsave(&qp->sq.lock, flags);
1485 +- ind = qp->sq_next_wqe;
1486 +- sge_ind = qp->next_sge;
1487 ++ sge_idx = qp->next_sge;
1488 +
1489 + for (nreq = 0; wr; ++nreq, wr = wr->next) {
1490 + if (hns_roce_wq_overflow(&qp->sq, nreq, qp->ibqp.send_cq)) {
1491 +@@ -279,6 +283,8 @@ static int hns_roce_v2_post_send(struct ib_qp *ibqp,
1492 + goto out;
1493 + }
1494 +
1495 ++ wqe_idx = (qp->sq.head + nreq) & (qp->sq.wqe_cnt - 1);
1496 ++
1497 + if (unlikely(wr->num_sge > qp->sq.max_gs)) {
1498 + dev_err(dev, "num_sge=%d > qp->sq.max_gs=%d\n",
1499 + wr->num_sge, qp->sq.max_gs);
1500 +@@ -287,14 +293,20 @@ static int hns_roce_v2_post_send(struct ib_qp *ibqp,
1501 + goto out;
1502 + }
1503 +
1504 +- wqe = get_send_wqe(qp, ind & (qp->sq.wqe_cnt - 1));
1505 +- qp->sq.wrid[(qp->sq.head + nreq) & (qp->sq.wqe_cnt - 1)] =
1506 +- wr->wr_id;
1507 +-
1508 ++ wqe = get_send_wqe(qp, wqe_idx);
1509 ++ qp->sq.wrid[wqe_idx] = wr->wr_id;
1510 + owner_bit =
1511 + ~(((qp->sq.head + nreq) >> ilog2(qp->sq.wqe_cnt)) & 0x1);
1512 ++ valid_num_sge = 0;
1513 + tmp_len = 0;
1514 +
1515 ++ for (i = 0; i < wr->num_sge; i++) {
1516 ++ if (likely(wr->sg_list[i].length)) {
1517 ++ tmp_len += wr->sg_list[i].length;
1518 ++ valid_num_sge++;
1519 ++ }
1520 ++ }
1521 ++
1522 + /* Corresponding to the QP type, wqe process separately */
1523 + if (ibqp->qp_type == IB_QPT_GSI) {
1524 + ud_sq_wqe = wqe;
1525 +@@ -330,9 +342,6 @@ static int hns_roce_v2_post_send(struct ib_qp *ibqp,
1526 + V2_UD_SEND_WQE_BYTE_4_OPCODE_S,
1527 + HNS_ROCE_V2_WQE_OP_SEND);
1528 +
1529 +- for (i = 0; i < wr->num_sge; i++)
1530 +- tmp_len += wr->sg_list[i].length;
1531 +-
1532 + ud_sq_wqe->msg_len =
1533 + cpu_to_le32(le32_to_cpu(ud_sq_wqe->msg_len) + tmp_len);
1534 +
1535 +@@ -368,12 +377,12 @@ static int hns_roce_v2_post_send(struct ib_qp *ibqp,
1536 + roce_set_field(ud_sq_wqe->byte_16,
1537 + V2_UD_SEND_WQE_BYTE_16_SGE_NUM_M,
1538 + V2_UD_SEND_WQE_BYTE_16_SGE_NUM_S,
1539 +- wr->num_sge);
1540 ++ valid_num_sge);
1541 +
1542 + roce_set_field(ud_sq_wqe->byte_20,
1543 + V2_UD_SEND_WQE_BYTE_20_MSG_START_SGE_IDX_M,
1544 + V2_UD_SEND_WQE_BYTE_20_MSG_START_SGE_IDX_S,
1545 +- sge_ind & (qp->sge.sge_cnt - 1));
1546 ++ sge_idx & (qp->sge.sge_cnt - 1));
1547 +
1548 + roce_set_field(ud_sq_wqe->byte_24,
1549 + V2_UD_SEND_WQE_BYTE_24_UDPSPN_M,
1550 +@@ -423,13 +432,10 @@ static int hns_roce_v2_post_send(struct ib_qp *ibqp,
1551 + memcpy(&ud_sq_wqe->dgid[0], &ah->av.dgid[0],
1552 + GID_LEN_V2);
1553 +
1554 +- set_extend_sge(qp, wr, &sge_ind);
1555 +- ind++;
1556 ++ set_extend_sge(qp, wr, &sge_idx, valid_num_sge);
1557 + } else if (ibqp->qp_type == IB_QPT_RC) {
1558 + rc_sq_wqe = wqe;
1559 + memset(rc_sq_wqe, 0, sizeof(*rc_sq_wqe));
1560 +- for (i = 0; i < wr->num_sge; i++)
1561 +- tmp_len += wr->sg_list[i].length;
1562 +
1563 + rc_sq_wqe->msg_len =
1564 + cpu_to_le32(le32_to_cpu(rc_sq_wqe->msg_len) + tmp_len);
1565 +@@ -550,15 +556,14 @@ static int hns_roce_v2_post_send(struct ib_qp *ibqp,
1566 + roce_set_field(rc_sq_wqe->byte_16,
1567 + V2_RC_SEND_WQE_BYTE_16_SGE_NUM_M,
1568 + V2_RC_SEND_WQE_BYTE_16_SGE_NUM_S,
1569 +- wr->num_sge);
1570 ++ valid_num_sge);
1571 + } else if (wr->opcode != IB_WR_REG_MR) {
1572 + ret = set_rwqe_data_seg(ibqp, wr, rc_sq_wqe,
1573 +- wqe, &sge_ind, bad_wr);
1574 ++ wqe, &sge_idx,
1575 ++ valid_num_sge, bad_wr);
1576 + if (ret)
1577 + goto out;
1578 + }
1579 +-
1580 +- ind++;
1581 + } else {
1582 + dev_err(dev, "Illegal qp_type(0x%x)\n", ibqp->qp_type);
1583 + spin_unlock_irqrestore(&qp->sq.lock, flags);
1584 +@@ -588,8 +593,7 @@ out:
1585 +
1586 + hns_roce_write64(hr_dev, (__le32 *)&sq_db, qp->sq.db_reg_l);
1587 +
1588 +- qp->sq_next_wqe = ind;
1589 +- qp->next_sge = sge_ind;
1590 ++ qp->next_sge = sge_idx;
1591 +
1592 + if (qp->state == IB_QPS_ERR) {
1593 + attr_mask = IB_QP_STATE;
1594 +@@ -623,13 +627,12 @@ static int hns_roce_v2_post_recv(struct ib_qp *ibqp,
1595 + unsigned long flags;
1596 + void *wqe = NULL;
1597 + int attr_mask;
1598 ++ u32 wqe_idx;
1599 + int ret = 0;
1600 + int nreq;
1601 +- int ind;
1602 + int i;
1603 +
1604 + spin_lock_irqsave(&hr_qp->rq.lock, flags);
1605 +- ind = hr_qp->rq.head & (hr_qp->rq.wqe_cnt - 1);
1606 +
1607 + if (hr_qp->state == IB_QPS_RESET) {
1608 + spin_unlock_irqrestore(&hr_qp->rq.lock, flags);
1609 +@@ -645,6 +648,8 @@ static int hns_roce_v2_post_recv(struct ib_qp *ibqp,
1610 + goto out;
1611 + }
1612 +
1613 ++ wqe_idx = (hr_qp->rq.head + nreq) & (hr_qp->rq.wqe_cnt - 1);
1614 ++
1615 + if (unlikely(wr->num_sge > hr_qp->rq.max_gs)) {
1616 + dev_err(dev, "rq:num_sge=%d > qp->sq.max_gs=%d\n",
1617 + wr->num_sge, hr_qp->rq.max_gs);
1618 +@@ -653,7 +658,7 @@ static int hns_roce_v2_post_recv(struct ib_qp *ibqp,
1619 + goto out;
1620 + }
1621 +
1622 +- wqe = get_recv_wqe(hr_qp, ind);
1623 ++ wqe = get_recv_wqe(hr_qp, wqe_idx);
1624 + dseg = (struct hns_roce_v2_wqe_data_seg *)wqe;
1625 + for (i = 0; i < wr->num_sge; i++) {
1626 + if (!wr->sg_list[i].length)
1627 +@@ -669,8 +674,8 @@ static int hns_roce_v2_post_recv(struct ib_qp *ibqp,
1628 +
1629 + /* rq support inline data */
1630 + if (hr_dev->caps.flags & HNS_ROCE_CAP_FLAG_RQ_INLINE) {
1631 +- sge_list = hr_qp->rq_inl_buf.wqe_list[ind].sg_list;
1632 +- hr_qp->rq_inl_buf.wqe_list[ind].sge_cnt =
1633 ++ sge_list = hr_qp->rq_inl_buf.wqe_list[wqe_idx].sg_list;
1634 ++ hr_qp->rq_inl_buf.wqe_list[wqe_idx].sge_cnt =
1635 + (u32)wr->num_sge;
1636 + for (i = 0; i < wr->num_sge; i++) {
1637 + sge_list[i].addr =
1638 +@@ -679,9 +684,7 @@ static int hns_roce_v2_post_recv(struct ib_qp *ibqp,
1639 + }
1640 + }
1641 +
1642 +- hr_qp->rq.wrid[ind] = wr->wr_id;
1643 +-
1644 +- ind = (ind + 1) & (hr_qp->rq.wqe_cnt - 1);
1645 ++ hr_qp->rq.wrid[wqe_idx] = wr->wr_id;
1646 + }
1647 +
1648 + out:
1649 +@@ -4465,7 +4468,6 @@ static int hns_roce_v2_modify_qp(struct ib_qp *ibqp,
1650 + hr_qp->rq.tail = 0;
1651 + hr_qp->sq.head = 0;
1652 + hr_qp->sq.tail = 0;
1653 +- hr_qp->sq_next_wqe = 0;
1654 + hr_qp->next_sge = 0;
1655 + if (hr_qp->rq.wqe_cnt)
1656 + *hr_qp->rdb.db_record = 0;
1657 +diff --git a/drivers/infiniband/sw/siw/siw_cm.c b/drivers/infiniband/sw/siw/siw_cm.c
1658 +index 0454561718d9..31aa41d85ccf 100644
1659 +--- a/drivers/infiniband/sw/siw/siw_cm.c
1660 ++++ b/drivers/infiniband/sw/siw/siw_cm.c
1661 +@@ -1225,10 +1225,9 @@ static void siw_cm_llp_data_ready(struct sock *sk)
1662 + read_lock(&sk->sk_callback_lock);
1663 +
1664 + cep = sk_to_cep(sk);
1665 +- if (!cep) {
1666 +- WARN_ON(1);
1667 ++ if (!cep)
1668 + goto out;
1669 +- }
1670 ++
1671 + siw_dbg_cep(cep, "state: %d\n", cep->state);
1672 +
1673 + switch (cep->state) {
1674 +diff --git a/drivers/macintosh/therm_windtunnel.c b/drivers/macintosh/therm_windtunnel.c
1675 +index 8c744578122a..a0d87ed9da69 100644
1676 +--- a/drivers/macintosh/therm_windtunnel.c
1677 ++++ b/drivers/macintosh/therm_windtunnel.c
1678 +@@ -300,9 +300,11 @@ static int control_loop(void *dummy)
1679 + /* i2c probing and setup */
1680 + /************************************************************************/
1681 +
1682 +-static int
1683 +-do_attach( struct i2c_adapter *adapter )
1684 ++static void do_attach(struct i2c_adapter *adapter)
1685 + {
1686 ++ struct i2c_board_info info = { };
1687 ++ struct device_node *np;
1688 ++
1689 + /* scan 0x48-0x4f (DS1775) and 0x2c-2x2f (ADM1030) */
1690 + static const unsigned short scan_ds1775[] = {
1691 + 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f,
1692 +@@ -313,25 +315,24 @@ do_attach( struct i2c_adapter *adapter )
1693 + I2C_CLIENT_END
1694 + };
1695 +
1696 +- if( strncmp(adapter->name, "uni-n", 5) )
1697 +- return 0;
1698 +-
1699 +- if( !x.running ) {
1700 +- struct i2c_board_info info;
1701 ++ if (x.running || strncmp(adapter->name, "uni-n", 5))
1702 ++ return;
1703 +
1704 +- memset(&info, 0, sizeof(struct i2c_board_info));
1705 +- strlcpy(info.type, "therm_ds1775", I2C_NAME_SIZE);
1706 ++ np = of_find_compatible_node(adapter->dev.of_node, NULL, "MAC,ds1775");
1707 ++ if (np) {
1708 ++ of_node_put(np);
1709 ++ } else {
1710 ++ strlcpy(info.type, "MAC,ds1775", I2C_NAME_SIZE);
1711 + i2c_new_probed_device(adapter, &info, scan_ds1775, NULL);
1712 ++ }
1713 +
1714 +- strlcpy(info.type, "therm_adm1030", I2C_NAME_SIZE);
1715 ++ np = of_find_compatible_node(adapter->dev.of_node, NULL, "MAC,adm1030");
1716 ++ if (np) {
1717 ++ of_node_put(np);
1718 ++ } else {
1719 ++ strlcpy(info.type, "MAC,adm1030", I2C_NAME_SIZE);
1720 + i2c_new_probed_device(adapter, &info, scan_adm1030, NULL);
1721 +-
1722 +- if( x.thermostat && x.fan ) {
1723 +- x.running = 1;
1724 +- x.poll_task = kthread_run(control_loop, NULL, "g4fand");
1725 +- }
1726 + }
1727 +- return 0;
1728 + }
1729 +
1730 + static int
1731 +@@ -404,8 +405,8 @@ out:
1732 + enum chip { ds1775, adm1030 };
1733 +
1734 + static const struct i2c_device_id therm_windtunnel_id[] = {
1735 +- { "therm_ds1775", ds1775 },
1736 +- { "therm_adm1030", adm1030 },
1737 ++ { "MAC,ds1775", ds1775 },
1738 ++ { "MAC,adm1030", adm1030 },
1739 + { }
1740 + };
1741 + MODULE_DEVICE_TABLE(i2c, therm_windtunnel_id);
1742 +@@ -414,6 +415,7 @@ static int
1743 + do_probe(struct i2c_client *cl, const struct i2c_device_id *id)
1744 + {
1745 + struct i2c_adapter *adapter = cl->adapter;
1746 ++ int ret = 0;
1747 +
1748 + if( !i2c_check_functionality(adapter, I2C_FUNC_SMBUS_WORD_DATA
1749 + | I2C_FUNC_SMBUS_WRITE_BYTE) )
1750 +@@ -421,11 +423,19 @@ do_probe(struct i2c_client *cl, const struct i2c_device_id *id)
1751 +
1752 + switch (id->driver_data) {
1753 + case adm1030:
1754 +- return attach_fan( cl );
1755 ++ ret = attach_fan(cl);
1756 ++ break;
1757 + case ds1775:
1758 +- return attach_thermostat(cl);
1759 ++ ret = attach_thermostat(cl);
1760 ++ break;
1761 + }
1762 +- return 0;
1763 ++
1764 ++ if (!x.running && x.thermostat && x.fan) {
1765 ++ x.running = 1;
1766 ++ x.poll_task = kthread_run(control_loop, NULL, "g4fand");
1767 ++ }
1768 ++
1769 ++ return ret;
1770 + }
1771 +
1772 + static struct i2c_driver g4fan_driver = {
1773 +diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
1774 +index 7dcd709f4ac3..703c5c2c80e5 100644
1775 +--- a/drivers/net/bonding/bond_main.c
1776 ++++ b/drivers/net/bonding/bond_main.c
1777 +@@ -3436,6 +3436,47 @@ static void bond_fold_stats(struct rtnl_link_stats64 *_res,
1778 + }
1779 + }
1780 +
1781 ++#ifdef CONFIG_LOCKDEP
1782 ++static int bond_get_lowest_level_rcu(struct net_device *dev)
1783 ++{
1784 ++ struct net_device *ldev, *next, *now, *dev_stack[MAX_NEST_DEV + 1];
1785 ++ struct list_head *niter, *iter, *iter_stack[MAX_NEST_DEV + 1];
1786 ++ int cur = 0, max = 0;
1787 ++
1788 ++ now = dev;
1789 ++ iter = &dev->adj_list.lower;
1790 ++
1791 ++ while (1) {
1792 ++ next = NULL;
1793 ++ while (1) {
1794 ++ ldev = netdev_next_lower_dev_rcu(now, &iter);
1795 ++ if (!ldev)
1796 ++ break;
1797 ++
1798 ++ next = ldev;
1799 ++ niter = &ldev->adj_list.lower;
1800 ++ dev_stack[cur] = now;
1801 ++ iter_stack[cur++] = iter;
1802 ++ if (max <= cur)
1803 ++ max = cur;
1804 ++ break;
1805 ++ }
1806 ++
1807 ++ if (!next) {
1808 ++ if (!cur)
1809 ++ return max;
1810 ++ next = dev_stack[--cur];
1811 ++ niter = iter_stack[cur];
1812 ++ }
1813 ++
1814 ++ now = next;
1815 ++ iter = niter;
1816 ++ }
1817 ++
1818 ++ return max;
1819 ++}
1820 ++#endif
1821 ++
1822 + static void bond_get_stats(struct net_device *bond_dev,
1823 + struct rtnl_link_stats64 *stats)
1824 + {
1825 +@@ -3443,11 +3484,17 @@ static void bond_get_stats(struct net_device *bond_dev,
1826 + struct rtnl_link_stats64 temp;
1827 + struct list_head *iter;
1828 + struct slave *slave;
1829 ++ int nest_level = 0;
1830 +
1831 +- spin_lock(&bond->stats_lock);
1832 +- memcpy(stats, &bond->bond_stats, sizeof(*stats));
1833 +
1834 + rcu_read_lock();
1835 ++#ifdef CONFIG_LOCKDEP
1836 ++ nest_level = bond_get_lowest_level_rcu(bond_dev);
1837 ++#endif
1838 ++
1839 ++ spin_lock_nested(&bond->stats_lock, nest_level);
1840 ++ memcpy(stats, &bond->bond_stats, sizeof(*stats));
1841 ++
1842 + bond_for_each_slave_rcu(bond, slave, iter) {
1843 + const struct rtnl_link_stats64 *new =
1844 + dev_get_stats(slave->dev, &temp);
1845 +@@ -3457,10 +3504,10 @@ static void bond_get_stats(struct net_device *bond_dev,
1846 + /* save off the slave stats for the next run */
1847 + memcpy(&slave->slave_stats, new, sizeof(*new));
1848 + }
1849 +- rcu_read_unlock();
1850 +
1851 + memcpy(&bond->bond_stats, stats, sizeof(*stats));
1852 + spin_unlock(&bond->stats_lock);
1853 ++ rcu_read_unlock();
1854 + }
1855 +
1856 + static int bond_do_ioctl(struct net_device *bond_dev, struct ifreq *ifr, int cmd)
1857 +@@ -3550,6 +3597,8 @@ static int bond_do_ioctl(struct net_device *bond_dev, struct ifreq *ifr, int cmd
1858 + case BOND_RELEASE_OLD:
1859 + case SIOCBONDRELEASE:
1860 + res = bond_release(bond_dev, slave_dev);
1861 ++ if (!res)
1862 ++ netdev_update_lockdep_key(slave_dev);
1863 + break;
1864 + case BOND_SETHWADDR_OLD:
1865 + case SIOCBONDSETHWADDR:
1866 +diff --git a/drivers/net/bonding/bond_options.c b/drivers/net/bonding/bond_options.c
1867 +index ddb3916d3506..215c10923289 100644
1868 +--- a/drivers/net/bonding/bond_options.c
1869 ++++ b/drivers/net/bonding/bond_options.c
1870 +@@ -1398,6 +1398,8 @@ static int bond_option_slaves_set(struct bonding *bond,
1871 + case '-':
1872 + slave_dbg(bond->dev, dev, "Releasing interface\n");
1873 + ret = bond_release(bond->dev, dev);
1874 ++ if (!ret)
1875 ++ netdev_update_lockdep_key(dev);
1876 + break;
1877 +
1878 + default:
1879 +diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c
1880 +index 7ed667b304d1..d618650533b6 100644
1881 +--- a/drivers/net/dsa/b53/b53_common.c
1882 ++++ b/drivers/net/dsa/b53/b53_common.c
1883 +@@ -1353,6 +1353,9 @@ void b53_vlan_add(struct dsa_switch *ds, int port,
1884 +
1885 + b53_get_vlan_entry(dev, vid, vl);
1886 +
1887 ++ if (vid == 0 && vid == b53_default_pvid(dev))
1888 ++ untagged = true;
1889 ++
1890 + vl->members |= BIT(port);
1891 + if (untagged && !dsa_is_cpu_port(ds, port))
1892 + vl->untag |= BIT(port);
1893 +diff --git a/drivers/net/ethernet/amazon/ena/ena_com.c b/drivers/net/ethernet/amazon/ena/ena_com.c
1894 +index ea62604fdf8c..48de4bee209e 100644
1895 +--- a/drivers/net/ethernet/amazon/ena/ena_com.c
1896 ++++ b/drivers/net/ethernet/amazon/ena/ena_com.c
1897 +@@ -200,6 +200,11 @@ static void comp_ctxt_release(struct ena_com_admin_queue *queue,
1898 + static struct ena_comp_ctx *get_comp_ctxt(struct ena_com_admin_queue *queue,
1899 + u16 command_id, bool capture)
1900 + {
1901 ++ if (unlikely(!queue->comp_ctx)) {
1902 ++ pr_err("Completion context is NULL\n");
1903 ++ return NULL;
1904 ++ }
1905 ++
1906 + if (unlikely(command_id >= queue->q_depth)) {
1907 + pr_err("command id is larger than the queue size. cmd_id: %u queue size %d\n",
1908 + command_id, queue->q_depth);
1909 +@@ -1041,9 +1046,41 @@ static int ena_com_get_feature(struct ena_com_dev *ena_dev,
1910 + feature_ver);
1911 + }
1912 +
1913 ++static void ena_com_hash_key_fill_default_key(struct ena_com_dev *ena_dev)
1914 ++{
1915 ++ struct ena_admin_feature_rss_flow_hash_control *hash_key =
1916 ++ (ena_dev->rss).hash_key;
1917 ++
1918 ++ netdev_rss_key_fill(&hash_key->key, sizeof(hash_key->key));
1919 ++ /* The key is stored in the device in u32 array
1920 ++ * as well as the API requires the key to be passed in this
1921 ++ * format. Thus the size of our array should be divided by 4
1922 ++ */
1923 ++ hash_key->keys_num = sizeof(hash_key->key) / sizeof(u32);
1924 ++}
1925 ++
1926 ++int ena_com_get_current_hash_function(struct ena_com_dev *ena_dev)
1927 ++{
1928 ++ return ena_dev->rss.hash_func;
1929 ++}
1930 ++
1931 + static int ena_com_hash_key_allocate(struct ena_com_dev *ena_dev)
1932 + {
1933 + struct ena_rss *rss = &ena_dev->rss;
1934 ++ struct ena_admin_feature_rss_flow_hash_control *hash_key;
1935 ++ struct ena_admin_get_feat_resp get_resp;
1936 ++ int rc;
1937 ++
1938 ++ hash_key = (ena_dev->rss).hash_key;
1939 ++
1940 ++ rc = ena_com_get_feature_ex(ena_dev, &get_resp,
1941 ++ ENA_ADMIN_RSS_HASH_FUNCTION,
1942 ++ ena_dev->rss.hash_key_dma_addr,
1943 ++ sizeof(ena_dev->rss.hash_key), 0);
1944 ++ if (unlikely(rc)) {
1945 ++ hash_key = NULL;
1946 ++ return -EOPNOTSUPP;
1947 ++ }
1948 +
1949 + rss->hash_key =
1950 + dma_alloc_coherent(ena_dev->dmadev, sizeof(*rss->hash_key),
1951 +@@ -1254,30 +1291,6 @@ static int ena_com_ind_tbl_convert_to_device(struct ena_com_dev *ena_dev)
1952 + return 0;
1953 + }
1954 +
1955 +-static int ena_com_ind_tbl_convert_from_device(struct ena_com_dev *ena_dev)
1956 +-{
1957 +- u16 dev_idx_to_host_tbl[ENA_TOTAL_NUM_QUEUES] = { (u16)-1 };
1958 +- struct ena_rss *rss = &ena_dev->rss;
1959 +- u8 idx;
1960 +- u16 i;
1961 +-
1962 +- for (i = 0; i < ENA_TOTAL_NUM_QUEUES; i++)
1963 +- dev_idx_to_host_tbl[ena_dev->io_sq_queues[i].idx] = i;
1964 +-
1965 +- for (i = 0; i < 1 << rss->tbl_log_size; i++) {
1966 +- if (rss->rss_ind_tbl[i].cq_idx > ENA_TOTAL_NUM_QUEUES)
1967 +- return -EINVAL;
1968 +- idx = (u8)rss->rss_ind_tbl[i].cq_idx;
1969 +-
1970 +- if (dev_idx_to_host_tbl[idx] > ENA_TOTAL_NUM_QUEUES)
1971 +- return -EINVAL;
1972 +-
1973 +- rss->host_rss_ind_tbl[i] = dev_idx_to_host_tbl[idx];
1974 +- }
1975 +-
1976 +- return 0;
1977 +-}
1978 +-
1979 + static void ena_com_update_intr_delay_resolution(struct ena_com_dev *ena_dev,
1980 + u16 intr_delay_resolution)
1981 + {
1982 +@@ -2297,15 +2310,16 @@ int ena_com_fill_hash_function(struct ena_com_dev *ena_dev,
1983 +
1984 + switch (func) {
1985 + case ENA_ADMIN_TOEPLITZ:
1986 +- if (key_len > sizeof(hash_key->key)) {
1987 +- pr_err("key len (%hu) is bigger than the max supported (%zu)\n",
1988 +- key_len, sizeof(hash_key->key));
1989 +- return -EINVAL;
1990 ++ if (key) {
1991 ++ if (key_len != sizeof(hash_key->key)) {
1992 ++ pr_err("key len (%hu) doesn't equal the supported size (%zu)\n",
1993 ++ key_len, sizeof(hash_key->key));
1994 ++ return -EINVAL;
1995 ++ }
1996 ++ memcpy(hash_key->key, key, key_len);
1997 ++ rss->hash_init_val = init_val;
1998 ++ hash_key->keys_num = key_len >> 2;
1999 + }
2000 +-
2001 +- memcpy(hash_key->key, key, key_len);
2002 +- rss->hash_init_val = init_val;
2003 +- hash_key->keys_num = key_len >> 2;
2004 + break;
2005 + case ENA_ADMIN_CRC32:
2006 + rss->hash_init_val = init_val;
2007 +@@ -2342,7 +2356,11 @@ int ena_com_get_hash_function(struct ena_com_dev *ena_dev,
2008 + if (unlikely(rc))
2009 + return rc;
2010 +
2011 +- rss->hash_func = get_resp.u.flow_hash_func.selected_func;
2012 ++ /* ffs() returns 1 in case the lsb is set */
2013 ++ rss->hash_func = ffs(get_resp.u.flow_hash_func.selected_func);
2014 ++ if (rss->hash_func)
2015 ++ rss->hash_func--;
2016 ++
2017 + if (func)
2018 + *func = rss->hash_func;
2019 +
2020 +@@ -2606,10 +2624,6 @@ int ena_com_indirect_table_get(struct ena_com_dev *ena_dev, u32 *ind_tbl)
2021 + if (!ind_tbl)
2022 + return 0;
2023 +
2024 +- rc = ena_com_ind_tbl_convert_from_device(ena_dev);
2025 +- if (unlikely(rc))
2026 +- return rc;
2027 +-
2028 + for (i = 0; i < (1 << rss->tbl_log_size); i++)
2029 + ind_tbl[i] = rss->host_rss_ind_tbl[i];
2030 +
2031 +@@ -2626,9 +2640,15 @@ int ena_com_rss_init(struct ena_com_dev *ena_dev, u16 indr_tbl_log_size)
2032 + if (unlikely(rc))
2033 + goto err_indr_tbl;
2034 +
2035 ++ /* The following function might return unsupported in case the
2036 ++ * device doesn't support setting the key / hash function. We can safely
2037 ++ * ignore this error and have indirection table support only.
2038 ++ */
2039 + rc = ena_com_hash_key_allocate(ena_dev);
2040 +- if (unlikely(rc))
2041 ++ if (unlikely(rc) && rc != -EOPNOTSUPP)
2042 + goto err_hash_key;
2043 ++ else if (rc != -EOPNOTSUPP)
2044 ++ ena_com_hash_key_fill_default_key(ena_dev);
2045 +
2046 + rc = ena_com_hash_ctrl_init(ena_dev);
2047 + if (unlikely(rc))
2048 +diff --git a/drivers/net/ethernet/amazon/ena/ena_com.h b/drivers/net/ethernet/amazon/ena/ena_com.h
2049 +index 0ce37d54ed10..469f298199a7 100644
2050 +--- a/drivers/net/ethernet/amazon/ena/ena_com.h
2051 ++++ b/drivers/net/ethernet/amazon/ena/ena_com.h
2052 +@@ -44,6 +44,7 @@
2053 + #include <linux/spinlock.h>
2054 + #include <linux/types.h>
2055 + #include <linux/wait.h>
2056 ++#include <linux/netdevice.h>
2057 +
2058 + #include "ena_common_defs.h"
2059 + #include "ena_admin_defs.h"
2060 +@@ -655,6 +656,14 @@ int ena_com_rss_init(struct ena_com_dev *ena_dev, u16 log_size);
2061 + */
2062 + void ena_com_rss_destroy(struct ena_com_dev *ena_dev);
2063 +
2064 ++/* ena_com_get_current_hash_function - Get RSS hash function
2065 ++ * @ena_dev: ENA communication layer struct
2066 ++ *
2067 ++ * Return the current hash function.
2068 ++ * @return: 0 or one of the ena_admin_hash_functions values.
2069 ++ */
2070 ++int ena_com_get_current_hash_function(struct ena_com_dev *ena_dev);
2071 ++
2072 + /* ena_com_fill_hash_function - Fill RSS hash function
2073 + * @ena_dev: ENA communication layer struct
2074 + * @func: The hash function (Toeplitz or crc)
2075 +diff --git a/drivers/net/ethernet/amazon/ena/ena_ethtool.c b/drivers/net/ethernet/amazon/ena/ena_ethtool.c
2076 +index 8c1c73b0ced7..ae631b8770fc 100644
2077 +--- a/drivers/net/ethernet/amazon/ena/ena_ethtool.c
2078 ++++ b/drivers/net/ethernet/amazon/ena/ena_ethtool.c
2079 +@@ -636,6 +636,28 @@ static u32 ena_get_rxfh_key_size(struct net_device *netdev)
2080 + return ENA_HASH_KEY_SIZE;
2081 + }
2082 +
2083 ++static int ena_indirection_table_get(struct ena_adapter *adapter, u32 *indir)
2084 ++{
2085 ++ struct ena_com_dev *ena_dev = adapter->ena_dev;
2086 ++ int i, rc;
2087 ++
2088 ++ if (!indir)
2089 ++ return 0;
2090 ++
2091 ++ rc = ena_com_indirect_table_get(ena_dev, indir);
2092 ++ if (rc)
2093 ++ return rc;
2094 ++
2095 ++ /* Our internal representation of the indices is: even indices
2096 ++ * for Tx and uneven indices for Rx. We need to convert the Rx
2097 ++ * indices to be consecutive
2098 ++ */
2099 ++ for (i = 0; i < ENA_RX_RSS_TABLE_SIZE; i++)
2100 ++ indir[i] = ENA_IO_RXQ_IDX_TO_COMBINED_IDX(indir[i]);
2101 ++
2102 ++ return rc;
2103 ++}
2104 ++
2105 + static int ena_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key,
2106 + u8 *hfunc)
2107 + {
2108 +@@ -644,11 +666,25 @@ static int ena_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key,
2109 + u8 func;
2110 + int rc;
2111 +
2112 +- rc = ena_com_indirect_table_get(adapter->ena_dev, indir);
2113 ++ rc = ena_indirection_table_get(adapter, indir);
2114 + if (rc)
2115 + return rc;
2116 +
2117 ++ /* We call this function in order to check if the device
2118 ++ * supports getting/setting the hash function.
2119 ++ */
2120 + rc = ena_com_get_hash_function(adapter->ena_dev, &ena_func, key);
2121 ++
2122 ++ if (rc) {
2123 ++ if (rc == -EOPNOTSUPP) {
2124 ++ key = NULL;
2125 ++ hfunc = NULL;
2126 ++ rc = 0;
2127 ++ }
2128 ++
2129 ++ return rc;
2130 ++ }
2131 ++
2132 + if (rc)
2133 + return rc;
2134 +
2135 +@@ -657,7 +693,7 @@ static int ena_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key,
2136 + func = ETH_RSS_HASH_TOP;
2137 + break;
2138 + case ENA_ADMIN_CRC32:
2139 +- func = ETH_RSS_HASH_XOR;
2140 ++ func = ETH_RSS_HASH_CRC32;
2141 + break;
2142 + default:
2143 + netif_err(adapter, drv, netdev,
2144 +@@ -700,10 +736,13 @@ static int ena_set_rxfh(struct net_device *netdev, const u32 *indir,
2145 + }
2146 +
2147 + switch (hfunc) {
2148 ++ case ETH_RSS_HASH_NO_CHANGE:
2149 ++ func = ena_com_get_current_hash_function(ena_dev);
2150 ++ break;
2151 + case ETH_RSS_HASH_TOP:
2152 + func = ENA_ADMIN_TOEPLITZ;
2153 + break;
2154 +- case ETH_RSS_HASH_XOR:
2155 ++ case ETH_RSS_HASH_CRC32:
2156 + func = ENA_ADMIN_CRC32;
2157 + break;
2158 + default:
2159 +@@ -805,6 +844,7 @@ static const struct ethtool_ops ena_ethtool_ops = {
2160 + .get_channels = ena_get_channels,
2161 + .get_tunable = ena_get_tunable,
2162 + .set_tunable = ena_set_tunable,
2163 ++ .get_ts_info = ethtool_op_get_ts_info,
2164 + };
2165 +
2166 + void ena_set_ethtool_ops(struct net_device *netdev)
2167 +diff --git a/drivers/net/ethernet/amazon/ena/ena_netdev.c b/drivers/net/ethernet/amazon/ena/ena_netdev.c
2168 +index b4a145220aba..f0cddf250cfd 100644
2169 +--- a/drivers/net/ethernet/amazon/ena/ena_netdev.c
2170 ++++ b/drivers/net/ethernet/amazon/ena/ena_netdev.c
2171 +@@ -3035,8 +3035,8 @@ static void check_for_missing_keep_alive(struct ena_adapter *adapter)
2172 + if (adapter->keep_alive_timeout == ENA_HW_HINTS_NO_TIMEOUT)
2173 + return;
2174 +
2175 +- keep_alive_expired = round_jiffies(adapter->last_keep_alive_jiffies +
2176 +- adapter->keep_alive_timeout);
2177 ++ keep_alive_expired = adapter->last_keep_alive_jiffies +
2178 ++ adapter->keep_alive_timeout;
2179 + if (unlikely(time_is_before_jiffies(keep_alive_expired))) {
2180 + netif_err(adapter, drv, adapter->netdev,
2181 + "Keep alive watchdog timeout.\n");
2182 +@@ -3138,7 +3138,7 @@ static void ena_timer_service(struct timer_list *t)
2183 + }
2184 +
2185 + /* Reset the timer */
2186 +- mod_timer(&adapter->timer_service, jiffies + HZ);
2187 ++ mod_timer(&adapter->timer_service, round_jiffies(jiffies + HZ));
2188 + }
2189 +
2190 + static int ena_calc_io_queue_num(struct pci_dev *pdev,
2191 +diff --git a/drivers/net/ethernet/amazon/ena/ena_netdev.h b/drivers/net/ethernet/amazon/ena/ena_netdev.h
2192 +index 72ee51a82ec7..dc02950a96b8 100644
2193 +--- a/drivers/net/ethernet/amazon/ena/ena_netdev.h
2194 ++++ b/drivers/net/ethernet/amazon/ena/ena_netdev.h
2195 +@@ -127,6 +127,8 @@
2196 +
2197 + #define ENA_IO_TXQ_IDX(q) (2 * (q))
2198 + #define ENA_IO_RXQ_IDX(q) (2 * (q) + 1)
2199 ++#define ENA_IO_TXQ_IDX_TO_COMBINED_IDX(q) ((q) / 2)
2200 ++#define ENA_IO_RXQ_IDX_TO_COMBINED_IDX(q) (((q) - 1) / 2)
2201 +
2202 + #define ENA_MGMNT_IRQ_IDX 0
2203 + #define ENA_IO_IRQ_FIRST_IDX 1
2204 +diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
2205 +index d8612131c55e..cc8031ae9aa3 100644
2206 +--- a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
2207 ++++ b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
2208 +@@ -2020,7 +2020,7 @@ static int xgene_enet_probe(struct platform_device *pdev)
2209 + int ret;
2210 +
2211 + ndev = alloc_etherdev_mqs(sizeof(struct xgene_enet_pdata),
2212 +- XGENE_NUM_RX_RING, XGENE_NUM_TX_RING);
2213 ++ XGENE_NUM_TX_RING, XGENE_NUM_RX_RING);
2214 + if (!ndev)
2215 + return -ENOMEM;
2216 +
2217 +diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_filters.c b/drivers/net/ethernet/aquantia/atlantic/aq_filters.c
2218 +index aee827f07c16..01af0f028693 100644
2219 +--- a/drivers/net/ethernet/aquantia/atlantic/aq_filters.c
2220 ++++ b/drivers/net/ethernet/aquantia/atlantic/aq_filters.c
2221 +@@ -158,7 +158,7 @@ aq_check_approve_fvlan(struct aq_nic_s *aq_nic,
2222 + }
2223 +
2224 + if ((aq_nic->ndev->features & NETIF_F_HW_VLAN_CTAG_FILTER) &&
2225 +- (!test_bit(be16_to_cpu(fsp->h_ext.vlan_tci),
2226 ++ (!test_bit(be16_to_cpu(fsp->h_ext.vlan_tci) & VLAN_VID_MASK,
2227 + aq_nic->active_vlans))) {
2228 + netdev_err(aq_nic->ndev,
2229 + "ethtool: unknown vlan-id specified");
2230 +diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
2231 +index 137c1de4c6ec..12949f1ec1ea 100644
2232 +--- a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
2233 ++++ b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
2234 +@@ -467,8 +467,10 @@ static unsigned int aq_nic_map_skb(struct aq_nic_s *self,
2235 + dx_buff->len,
2236 + DMA_TO_DEVICE);
2237 +
2238 +- if (unlikely(dma_mapping_error(aq_nic_get_dev(self), dx_buff->pa)))
2239 ++ if (unlikely(dma_mapping_error(aq_nic_get_dev(self), dx_buff->pa))) {
2240 ++ ret = 0;
2241 + goto exit;
2242 ++ }
2243 +
2244 + first = dx_buff;
2245 + dx_buff->len_pkt = skb->len;
2246 +@@ -598,10 +600,6 @@ int aq_nic_xmit(struct aq_nic_s *self, struct sk_buff *skb)
2247 + if (likely(frags)) {
2248 + err = self->aq_hw_ops->hw_ring_tx_xmit(self->aq_hw,
2249 + ring, frags);
2250 +- if (err >= 0) {
2251 +- ++ring->stats.tx.packets;
2252 +- ring->stats.tx.bytes += skb->len;
2253 +- }
2254 + } else {
2255 + err = NETDEV_TX_BUSY;
2256 + }
2257 +diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_ring.c b/drivers/net/ethernet/aquantia/atlantic/aq_ring.c
2258 +index 76bdbe1596d6..03821b46a8cb 100644
2259 +--- a/drivers/net/ethernet/aquantia/atlantic/aq_ring.c
2260 ++++ b/drivers/net/ethernet/aquantia/atlantic/aq_ring.c
2261 +@@ -243,9 +243,12 @@ bool aq_ring_tx_clean(struct aq_ring_s *self)
2262 + }
2263 + }
2264 +
2265 +- if (unlikely(buff->is_eop))
2266 +- dev_kfree_skb_any(buff->skb);
2267 ++ if (unlikely(buff->is_eop)) {
2268 ++ ++self->stats.rx.packets;
2269 ++ self->stats.tx.bytes += buff->skb->len;
2270 +
2271 ++ dev_kfree_skb_any(buff->skb);
2272 ++ }
2273 + buff->pa = 0U;
2274 + buff->eop_index = 0xffffU;
2275 + self->sw_head = aq_ring_next_dx(self, self->sw_head);
2276 +diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
2277 +index 68618891b0e4..374e11a91790 100644
2278 +--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
2279 ++++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
2280 +@@ -11712,6 +11712,14 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
2281 + if (version_printed++ == 0)
2282 + pr_info("%s", version);
2283 +
2284 ++ /* Clear any pending DMA transactions from crash kernel
2285 ++ * while loading driver in capture kernel.
2286 ++ */
2287 ++ if (is_kdump_kernel()) {
2288 ++ pci_clear_master(pdev);
2289 ++ pcie_flr(pdev);
2290 ++ }
2291 ++
2292 + max_irqs = bnxt_get_max_irq(pdev);
2293 + dev = alloc_etherdev_mq(sizeof(*bp), max_irqs);
2294 + if (!dev)
2295 +@@ -11908,10 +11916,10 @@ static void bnxt_shutdown(struct pci_dev *pdev)
2296 + dev_close(dev);
2297 +
2298 + bnxt_ulp_shutdown(bp);
2299 ++ bnxt_clear_int_mode(bp);
2300 ++ pci_disable_device(pdev);
2301 +
2302 + if (system_state == SYSTEM_POWER_OFF) {
2303 +- bnxt_clear_int_mode(bp);
2304 +- pci_disable_device(pdev);
2305 + pci_wake_from_d3(pdev, bp->wol);
2306 + pci_set_power_state(pdev, PCI_D3hot);
2307 + }
2308 +diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
2309 +index 95a94507cec1..234c13ebbc41 100644
2310 +--- a/drivers/net/ethernet/cadence/macb_main.c
2311 ++++ b/drivers/net/ethernet/cadence/macb_main.c
2312 +@@ -3690,6 +3690,10 @@ static int at91ether_open(struct net_device *dev)
2313 + u32 ctl;
2314 + int ret;
2315 +
2316 ++ ret = pm_runtime_get_sync(&lp->pdev->dev);
2317 ++ if (ret < 0)
2318 ++ return ret;
2319 ++
2320 + /* Clear internal statistics */
2321 + ctl = macb_readl(lp, NCR);
2322 + macb_writel(lp, NCR, ctl | MACB_BIT(CLRSTAT));
2323 +@@ -3750,7 +3754,7 @@ static int at91ether_close(struct net_device *dev)
2324 + q->rx_buffers, q->rx_buffers_dma);
2325 + q->rx_buffers = NULL;
2326 +
2327 +- return 0;
2328 ++ return pm_runtime_put(&lp->pdev->dev);
2329 + }
2330 +
2331 + /* Transmit packet */
2332 +diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
2333 +index 162881005a6d..c01cf8ef69df 100644
2334 +--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
2335 ++++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
2336 +@@ -6003,6 +6003,9 @@ static int hclge_get_all_rules(struct hnae3_handle *handle,
2337 + static void hclge_fd_get_flow_tuples(const struct flow_keys *fkeys,
2338 + struct hclge_fd_rule_tuples *tuples)
2339 + {
2340 ++#define flow_ip6_src fkeys->addrs.v6addrs.src.in6_u.u6_addr32
2341 ++#define flow_ip6_dst fkeys->addrs.v6addrs.dst.in6_u.u6_addr32
2342 ++
2343 + tuples->ether_proto = be16_to_cpu(fkeys->basic.n_proto);
2344 + tuples->ip_proto = fkeys->basic.ip_proto;
2345 + tuples->dst_port = be16_to_cpu(fkeys->ports.dst);
2346 +@@ -6011,12 +6014,12 @@ static void hclge_fd_get_flow_tuples(const struct flow_keys *fkeys,
2347 + tuples->src_ip[3] = be32_to_cpu(fkeys->addrs.v4addrs.src);
2348 + tuples->dst_ip[3] = be32_to_cpu(fkeys->addrs.v4addrs.dst);
2349 + } else {
2350 +- memcpy(tuples->src_ip,
2351 +- fkeys->addrs.v6addrs.src.in6_u.u6_addr32,
2352 +- sizeof(tuples->src_ip));
2353 +- memcpy(tuples->dst_ip,
2354 +- fkeys->addrs.v6addrs.dst.in6_u.u6_addr32,
2355 +- sizeof(tuples->dst_ip));
2356 ++ int i;
2357 ++
2358 ++ for (i = 0; i < IPV6_SIZE; i++) {
2359 ++ tuples->src_ip[i] = be32_to_cpu(flow_ip6_src[i]);
2360 ++ tuples->dst_ip[i] = be32_to_cpu(flow_ip6_dst[i]);
2361 ++ }
2362 + }
2363 + }
2364 +
2365 +@@ -9437,6 +9440,13 @@ static int hclge_reset_ae_dev(struct hnae3_ae_dev *ae_dev)
2366 + return ret;
2367 + }
2368 +
2369 ++ ret = init_mgr_tbl(hdev);
2370 ++ if (ret) {
2371 ++ dev_err(&pdev->dev,
2372 ++ "failed to reinit manager table, ret = %d\n", ret);
2373 ++ return ret;
2374 ++ }
2375 ++
2376 + ret = hclge_init_fd_config(hdev);
2377 + if (ret) {
2378 + dev_err(&pdev->dev, "fd table init fail, ret=%d\n", ret);
2379 +diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
2380 +index 3515ace0f020..38042d610f82 100644
2381 +--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
2382 ++++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
2383 +@@ -2363,7 +2363,7 @@ static int i40e_vc_enable_queues_msg(struct i40e_vf *vf, u8 *msg)
2384 + goto error_param;
2385 + }
2386 +
2387 +- if (i40e_vc_validate_vqs_bitmaps(vqs)) {
2388 ++ if (!i40e_vc_validate_vqs_bitmaps(vqs)) {
2389 + aq_ret = I40E_ERR_PARAM;
2390 + goto error_param;
2391 + }
2392 +@@ -2425,7 +2425,7 @@ static int i40e_vc_disable_queues_msg(struct i40e_vf *vf, u8 *msg)
2393 + goto error_param;
2394 + }
2395 +
2396 +- if (i40e_vc_validate_vqs_bitmaps(vqs)) {
2397 ++ if (!i40e_vc_validate_vqs_bitmaps(vqs)) {
2398 + aq_ret = I40E_ERR_PARAM;
2399 + goto error_param;
2400 + }
2401 +diff --git a/drivers/net/ethernet/intel/ice/ice_common.c b/drivers/net/ethernet/intel/ice/ice_common.c
2402 +index 3a6b3950eb0e..171f0b625407 100644
2403 +--- a/drivers/net/ethernet/intel/ice/ice_common.c
2404 ++++ b/drivers/net/ethernet/intel/ice/ice_common.c
2405 +@@ -934,7 +934,7 @@ void ice_deinit_hw(struct ice_hw *hw)
2406 + */
2407 + enum ice_status ice_check_reset(struct ice_hw *hw)
2408 + {
2409 +- u32 cnt, reg = 0, grst_delay;
2410 ++ u32 cnt, reg = 0, grst_delay, uld_mask;
2411 +
2412 + /* Poll for Device Active state in case a recent CORER, GLOBR,
2413 + * or EMPR has occurred. The grst delay value is in 100ms units.
2414 +@@ -956,13 +956,20 @@ enum ice_status ice_check_reset(struct ice_hw *hw)
2415 + return ICE_ERR_RESET_FAILED;
2416 + }
2417 +
2418 +-#define ICE_RESET_DONE_MASK (GLNVM_ULD_CORER_DONE_M | \
2419 +- GLNVM_ULD_GLOBR_DONE_M)
2420 ++#define ICE_RESET_DONE_MASK (GLNVM_ULD_PCIER_DONE_M |\
2421 ++ GLNVM_ULD_PCIER_DONE_1_M |\
2422 ++ GLNVM_ULD_CORER_DONE_M |\
2423 ++ GLNVM_ULD_GLOBR_DONE_M |\
2424 ++ GLNVM_ULD_POR_DONE_M |\
2425 ++ GLNVM_ULD_POR_DONE_1_M |\
2426 ++ GLNVM_ULD_PCIER_DONE_2_M)
2427 ++
2428 ++ uld_mask = ICE_RESET_DONE_MASK;
2429 +
2430 + /* Device is Active; check Global Reset processes are done */
2431 + for (cnt = 0; cnt < ICE_PF_RESET_WAIT_COUNT; cnt++) {
2432 +- reg = rd32(hw, GLNVM_ULD) & ICE_RESET_DONE_MASK;
2433 +- if (reg == ICE_RESET_DONE_MASK) {
2434 ++ reg = rd32(hw, GLNVM_ULD) & uld_mask;
2435 ++ if (reg == uld_mask) {
2436 + ice_debug(hw, ICE_DBG_INIT,
2437 + "Global reset processes done. %d\n", cnt);
2438 + break;
2439 +diff --git a/drivers/net/ethernet/intel/ice/ice_hw_autogen.h b/drivers/net/ethernet/intel/ice/ice_hw_autogen.h
2440 +index 152fbd556e9b..9138b19de87e 100644
2441 +--- a/drivers/net/ethernet/intel/ice/ice_hw_autogen.h
2442 ++++ b/drivers/net/ethernet/intel/ice/ice_hw_autogen.h
2443 +@@ -273,8 +273,14 @@
2444 + #define GLNVM_GENS_SR_SIZE_S 5
2445 + #define GLNVM_GENS_SR_SIZE_M ICE_M(0x7, 5)
2446 + #define GLNVM_ULD 0x000B6008
2447 ++#define GLNVM_ULD_PCIER_DONE_M BIT(0)
2448 ++#define GLNVM_ULD_PCIER_DONE_1_M BIT(1)
2449 + #define GLNVM_ULD_CORER_DONE_M BIT(3)
2450 + #define GLNVM_ULD_GLOBR_DONE_M BIT(4)
2451 ++#define GLNVM_ULD_POR_DONE_M BIT(5)
2452 ++#define GLNVM_ULD_POR_DONE_1_M BIT(8)
2453 ++#define GLNVM_ULD_PCIER_DONE_2_M BIT(9)
2454 ++#define GLNVM_ULD_PE_DONE_M BIT(10)
2455 + #define GLPCI_CNF2 0x000BE004
2456 + #define GLPCI_CNF2_CACHELINE_SIZE_M BIT(1)
2457 + #define PF_FUNC_RID 0x0009E880
2458 +diff --git a/drivers/net/ethernet/mscc/ocelot_board.c b/drivers/net/ethernet/mscc/ocelot_board.c
2459 +index aac115136720..337156232501 100644
2460 +--- a/drivers/net/ethernet/mscc/ocelot_board.c
2461 ++++ b/drivers/net/ethernet/mscc/ocelot_board.c
2462 +@@ -112,6 +112,14 @@ static irqreturn_t ocelot_xtr_irq_handler(int irq, void *arg)
2463 + if (err != 4)
2464 + break;
2465 +
2466 ++ /* At this point the IFH was read correctly, so it is safe to
2467 ++ * presume that there is no error. The err needs to be reset
2468 ++ * otherwise a frame could come in CPU queue between the while
2469 ++ * condition and the check for error later on. And in that case
2470 ++ * the new frame is just removed and not processed.
2471 ++ */
2472 ++ err = 0;
2473 ++
2474 + ocelot_parse_ifh(ifh, &info);
2475 +
2476 + dev = ocelot->ports[info.port]->dev;
2477 +diff --git a/drivers/net/ethernet/qlogic/qede/qede.h b/drivers/net/ethernet/qlogic/qede/qede.h
2478 +index c303a92d5b06..1f27f9866b80 100644
2479 +--- a/drivers/net/ethernet/qlogic/qede/qede.h
2480 ++++ b/drivers/net/ethernet/qlogic/qede/qede.h
2481 +@@ -163,6 +163,8 @@ struct qede_rdma_dev {
2482 + struct list_head entry;
2483 + struct list_head rdma_event_list;
2484 + struct workqueue_struct *rdma_wq;
2485 ++ struct kref refcnt;
2486 ++ struct completion event_comp;
2487 + bool exp_recovery;
2488 + };
2489 +
2490 +diff --git a/drivers/net/ethernet/qlogic/qede/qede_rdma.c b/drivers/net/ethernet/qlogic/qede/qede_rdma.c
2491 +index ffabc2d2f082..2d873ae8a234 100644
2492 +--- a/drivers/net/ethernet/qlogic/qede/qede_rdma.c
2493 ++++ b/drivers/net/ethernet/qlogic/qede/qede_rdma.c
2494 +@@ -59,6 +59,9 @@ static void _qede_rdma_dev_add(struct qede_dev *edev)
2495 + static int qede_rdma_create_wq(struct qede_dev *edev)
2496 + {
2497 + INIT_LIST_HEAD(&edev->rdma_info.rdma_event_list);
2498 ++ kref_init(&edev->rdma_info.refcnt);
2499 ++ init_completion(&edev->rdma_info.event_comp);
2500 ++
2501 + edev->rdma_info.rdma_wq = create_singlethread_workqueue("rdma_wq");
2502 + if (!edev->rdma_info.rdma_wq) {
2503 + DP_NOTICE(edev, "qedr: Could not create workqueue\n");
2504 +@@ -83,8 +86,23 @@ static void qede_rdma_cleanup_event(struct qede_dev *edev)
2505 + }
2506 + }
2507 +
2508 ++static void qede_rdma_complete_event(struct kref *ref)
2509 ++{
2510 ++ struct qede_rdma_dev *rdma_dev =
2511 ++ container_of(ref, struct qede_rdma_dev, refcnt);
2512 ++
2513 ++ /* no more events will be added after this */
2514 ++ complete(&rdma_dev->event_comp);
2515 ++}
2516 ++
2517 + static void qede_rdma_destroy_wq(struct qede_dev *edev)
2518 + {
2519 ++ /* Avoid race with add_event flow, make sure it finishes before
2520 ++ * we start accessing the list and cleaning up the work
2521 ++ */
2522 ++ kref_put(&edev->rdma_info.refcnt, qede_rdma_complete_event);
2523 ++ wait_for_completion(&edev->rdma_info.event_comp);
2524 ++
2525 + qede_rdma_cleanup_event(edev);
2526 + destroy_workqueue(edev->rdma_info.rdma_wq);
2527 + }
2528 +@@ -310,15 +328,24 @@ static void qede_rdma_add_event(struct qede_dev *edev,
2529 + if (!edev->rdma_info.qedr_dev)
2530 + return;
2531 +
2532 ++ /* We don't want the cleanup flow to start while we're allocating and
2533 ++ * scheduling the work
2534 ++ */
2535 ++ if (!kref_get_unless_zero(&edev->rdma_info.refcnt))
2536 ++ return; /* already being destroyed */
2537 ++
2538 + event_node = qede_rdma_get_free_event_node(edev);
2539 + if (!event_node)
2540 +- return;
2541 ++ goto out;
2542 +
2543 + event_node->event = event;
2544 + event_node->ptr = edev;
2545 +
2546 + INIT_WORK(&event_node->work, qede_rdma_handle_event);
2547 + queue_work(edev->rdma_info.rdma_wq, &event_node->work);
2548 ++
2549 ++out:
2550 ++ kref_put(&edev->rdma_info.refcnt, qede_rdma_complete_event);
2551 + }
2552 +
2553 + void qede_rdma_dev_event_open(struct qede_dev *edev)
2554 +diff --git a/drivers/net/hyperv/netvsc.c b/drivers/net/hyperv/netvsc.c
2555 +index eab83e71567a..6c0732fc8c25 100644
2556 +--- a/drivers/net/hyperv/netvsc.c
2557 ++++ b/drivers/net/hyperv/netvsc.c
2558 +@@ -99,7 +99,7 @@ static struct netvsc_device *alloc_net_device(void)
2559 +
2560 + init_waitqueue_head(&net_device->wait_drain);
2561 + net_device->destroy = false;
2562 +- net_device->tx_disable = false;
2563 ++ net_device->tx_disable = true;
2564 +
2565 + net_device->max_pkt = RNDIS_MAX_PKT_DEFAULT;
2566 + net_device->pkt_align = RNDIS_PKT_ALIGN_DEFAULT;
2567 +diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c
2568 +index 0dee358864f3..ca16ae8c8332 100644
2569 +--- a/drivers/net/hyperv/netvsc_drv.c
2570 ++++ b/drivers/net/hyperv/netvsc_drv.c
2571 +@@ -973,6 +973,7 @@ static int netvsc_attach(struct net_device *ndev,
2572 + }
2573 +
2574 + /* In any case device is now ready */
2575 ++ nvdev->tx_disable = false;
2576 + netif_device_attach(ndev);
2577 +
2578 + /* Note: enable and attach happen when sub-channels setup */
2579 +@@ -2350,6 +2351,8 @@ static int netvsc_probe(struct hv_device *dev,
2580 + else
2581 + net->max_mtu = ETH_DATA_LEN;
2582 +
2583 ++ nvdev->tx_disable = false;
2584 ++
2585 + ret = register_netdevice(net);
2586 + if (ret != 0) {
2587 + pr_err("Unable to register netdev.\n");
2588 +diff --git a/drivers/net/phy/mdio-bcm-iproc.c b/drivers/net/phy/mdio-bcm-iproc.c
2589 +index 7e9975d25066..f1ded03f0229 100644
2590 +--- a/drivers/net/phy/mdio-bcm-iproc.c
2591 ++++ b/drivers/net/phy/mdio-bcm-iproc.c
2592 +@@ -178,6 +178,23 @@ static int iproc_mdio_remove(struct platform_device *pdev)
2593 + return 0;
2594 + }
2595 +
2596 ++#ifdef CONFIG_PM_SLEEP
2597 ++int iproc_mdio_resume(struct device *dev)
2598 ++{
2599 ++ struct platform_device *pdev = to_platform_device(dev);
2600 ++ struct iproc_mdio_priv *priv = platform_get_drvdata(pdev);
2601 ++
2602 ++ /* restore the mii clock configuration */
2603 ++ iproc_mdio_config_clk(priv->base);
2604 ++
2605 ++ return 0;
2606 ++}
2607 ++
2608 ++static const struct dev_pm_ops iproc_mdio_pm_ops = {
2609 ++ .resume = iproc_mdio_resume
2610 ++};
2611 ++#endif /* CONFIG_PM_SLEEP */
2612 ++
2613 + static const struct of_device_id iproc_mdio_of_match[] = {
2614 + { .compatible = "brcm,iproc-mdio", },
2615 + { /* sentinel */ },
2616 +@@ -188,6 +205,9 @@ static struct platform_driver iproc_mdio_driver = {
2617 + .driver = {
2618 + .name = "iproc-mdio",
2619 + .of_match_table = iproc_mdio_of_match,
2620 ++#ifdef CONFIG_PM_SLEEP
2621 ++ .pm = &iproc_mdio_pm_ops,
2622 ++#endif
2623 + },
2624 + .probe = iproc_mdio_probe,
2625 + .remove = iproc_mdio_remove,
2626 +diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
2627 +index 9485c8d1de8a..3b7a3b8a5e06 100644
2628 +--- a/drivers/net/usb/qmi_wwan.c
2629 ++++ b/drivers/net/usb/qmi_wwan.c
2630 +@@ -61,7 +61,6 @@ enum qmi_wwan_flags {
2631 +
2632 + enum qmi_wwan_quirks {
2633 + QMI_WWAN_QUIRK_DTR = 1 << 0, /* needs "set DTR" request */
2634 +- QMI_WWAN_QUIRK_QUECTEL_DYNCFG = 1 << 1, /* check num. endpoints */
2635 + };
2636 +
2637 + struct qmimux_hdr {
2638 +@@ -916,16 +915,6 @@ static const struct driver_info qmi_wwan_info_quirk_dtr = {
2639 + .data = QMI_WWAN_QUIRK_DTR,
2640 + };
2641 +
2642 +-static const struct driver_info qmi_wwan_info_quirk_quectel_dyncfg = {
2643 +- .description = "WWAN/QMI device",
2644 +- .flags = FLAG_WWAN | FLAG_SEND_ZLP,
2645 +- .bind = qmi_wwan_bind,
2646 +- .unbind = qmi_wwan_unbind,
2647 +- .manage_power = qmi_wwan_manage_power,
2648 +- .rx_fixup = qmi_wwan_rx_fixup,
2649 +- .data = QMI_WWAN_QUIRK_DTR | QMI_WWAN_QUIRK_QUECTEL_DYNCFG,
2650 +-};
2651 +-
2652 + #define HUAWEI_VENDOR_ID 0x12D1
2653 +
2654 + /* map QMI/wwan function by a fixed interface number */
2655 +@@ -946,14 +935,18 @@ static const struct driver_info qmi_wwan_info_quirk_quectel_dyncfg = {
2656 + #define QMI_GOBI_DEVICE(vend, prod) \
2657 + QMI_FIXED_INTF(vend, prod, 0)
2658 +
2659 +-/* Quectel does not use fixed interface numbers on at least some of their
2660 +- * devices. We need to check the number of endpoints to ensure that we bind to
2661 +- * the correct interface.
2662 ++/* Many devices have QMI and DIAG functions which are distinguishable
2663 ++ * from other vendor specific functions by class, subclass and
2664 ++ * protocol all being 0xff. The DIAG function has exactly 2 endpoints
2665 ++ * and is silently rejected when probed.
2666 ++ *
2667 ++ * This makes it possible to match dynamically numbered QMI functions
2668 ++ * as seen on e.g. many Quectel modems.
2669 + */
2670 +-#define QMI_QUIRK_QUECTEL_DYNCFG(vend, prod) \
2671 ++#define QMI_MATCH_FF_FF_FF(vend, prod) \
2672 + USB_DEVICE_AND_INTERFACE_INFO(vend, prod, USB_CLASS_VENDOR_SPEC, \
2673 + USB_SUBCLASS_VENDOR_SPEC, 0xff), \
2674 +- .driver_info = (unsigned long)&qmi_wwan_info_quirk_quectel_dyncfg
2675 ++ .driver_info = (unsigned long)&qmi_wwan_info_quirk_dtr
2676 +
2677 + static const struct usb_device_id products[] = {
2678 + /* 1. CDC ECM like devices match on the control interface */
2679 +@@ -1059,10 +1052,10 @@ static const struct usb_device_id products[] = {
2680 + USB_DEVICE_AND_INTERFACE_INFO(0x03f0, 0x581d, USB_CLASS_VENDOR_SPEC, 1, 7),
2681 + .driver_info = (unsigned long)&qmi_wwan_info,
2682 + },
2683 +- {QMI_QUIRK_QUECTEL_DYNCFG(0x2c7c, 0x0125)}, /* Quectel EC25, EC20 R2.0 Mini PCIe */
2684 +- {QMI_QUIRK_QUECTEL_DYNCFG(0x2c7c, 0x0306)}, /* Quectel EP06/EG06/EM06 */
2685 +- {QMI_QUIRK_QUECTEL_DYNCFG(0x2c7c, 0x0512)}, /* Quectel EG12/EM12 */
2686 +- {QMI_QUIRK_QUECTEL_DYNCFG(0x2c7c, 0x0800)}, /* Quectel RM500Q-GL */
2687 ++ {QMI_MATCH_FF_FF_FF(0x2c7c, 0x0125)}, /* Quectel EC25, EC20 R2.0 Mini PCIe */
2688 ++ {QMI_MATCH_FF_FF_FF(0x2c7c, 0x0306)}, /* Quectel EP06/EG06/EM06 */
2689 ++ {QMI_MATCH_FF_FF_FF(0x2c7c, 0x0512)}, /* Quectel EG12/EM12 */
2690 ++ {QMI_MATCH_FF_FF_FF(0x2c7c, 0x0800)}, /* Quectel RM500Q-GL */
2691 +
2692 + /* 3. Combined interface devices matching on interface number */
2693 + {QMI_FIXED_INTF(0x0408, 0xea42, 4)}, /* Yota / Megafon M100-1 */
2694 +@@ -1363,6 +1356,7 @@ static const struct usb_device_id products[] = {
2695 + {QMI_FIXED_INTF(0x413c, 0x81b6, 8)}, /* Dell Wireless 5811e */
2696 + {QMI_FIXED_INTF(0x413c, 0x81b6, 10)}, /* Dell Wireless 5811e */
2697 + {QMI_FIXED_INTF(0x413c, 0x81d7, 0)}, /* Dell Wireless 5821e */
2698 ++ {QMI_FIXED_INTF(0x413c, 0x81d7, 1)}, /* Dell Wireless 5821e preproduction config */
2699 + {QMI_FIXED_INTF(0x413c, 0x81e0, 0)}, /* Dell Wireless 5821e with eSIM support*/
2700 + {QMI_FIXED_INTF(0x03f0, 0x4e1d, 8)}, /* HP lt4111 LTE/EV-DO/HSPA+ Gobi 4G Module */
2701 + {QMI_FIXED_INTF(0x03f0, 0x9d1d, 1)}, /* HP lt4120 Snapdragon X5 LTE */
2702 +@@ -1454,7 +1448,6 @@ static int qmi_wwan_probe(struct usb_interface *intf,
2703 + {
2704 + struct usb_device_id *id = (struct usb_device_id *)prod;
2705 + struct usb_interface_descriptor *desc = &intf->cur_altsetting->desc;
2706 +- const struct driver_info *info;
2707 +
2708 + /* Workaround to enable dynamic IDs. This disables usbnet
2709 + * blacklisting functionality. Which, if required, can be
2710 +@@ -1490,12 +1483,8 @@ static int qmi_wwan_probe(struct usb_interface *intf,
2711 + * different. Ignore the current interface if the number of endpoints
2712 + * equals the number for the diag interface (two).
2713 + */
2714 +- info = (void *)id->driver_info;
2715 +-
2716 +- if (info->data & QMI_WWAN_QUIRK_QUECTEL_DYNCFG) {
2717 +- if (desc->bNumEndpoints == 2)
2718 +- return -ENODEV;
2719 +- }
2720 ++ if (desc->bNumEndpoints == 2)
2721 ++ return -ENODEV;
2722 +
2723 + return usbnet_probe(intf, id);
2724 + }
2725 +diff --git a/drivers/net/wireless/marvell/mwifiex/main.h b/drivers/net/wireless/marvell/mwifiex/main.h
2726 +index 547ff3c578ee..fa5634af40f7 100644
2727 +--- a/drivers/net/wireless/marvell/mwifiex/main.h
2728 ++++ b/drivers/net/wireless/marvell/mwifiex/main.h
2729 +@@ -1295,19 +1295,6 @@ mwifiex_copy_rates(u8 *dest, u32 pos, u8 *src, int len)
2730 + return pos;
2731 + }
2732 +
2733 +-/* This function return interface number with the same bss_type.
2734 +- */
2735 +-static inline u8
2736 +-mwifiex_get_intf_num(struct mwifiex_adapter *adapter, u8 bss_type)
2737 +-{
2738 +- u8 i, num = 0;
2739 +-
2740 +- for (i = 0; i < adapter->priv_num; i++)
2741 +- if (adapter->priv[i] && adapter->priv[i]->bss_type == bss_type)
2742 +- num++;
2743 +- return num;
2744 +-}
2745 +-
2746 + /*
2747 + * This function returns the correct private structure pointer based
2748 + * upon the BSS type and BSS number.
2749 +diff --git a/drivers/net/wireless/marvell/mwifiex/tdls.c b/drivers/net/wireless/marvell/mwifiex/tdls.c
2750 +index 7caf1d26124a..f8f282ce39bd 100644
2751 +--- a/drivers/net/wireless/marvell/mwifiex/tdls.c
2752 ++++ b/drivers/net/wireless/marvell/mwifiex/tdls.c
2753 +@@ -894,7 +894,7 @@ void mwifiex_process_tdls_action_frame(struct mwifiex_private *priv,
2754 + u8 *peer, *pos, *end;
2755 + u8 i, action, basic;
2756 + u16 cap = 0;
2757 +- int ie_len = 0;
2758 ++ int ies_len = 0;
2759 +
2760 + if (len < (sizeof(struct ethhdr) + 3))
2761 + return;
2762 +@@ -916,7 +916,7 @@ void mwifiex_process_tdls_action_frame(struct mwifiex_private *priv,
2763 + pos = buf + sizeof(struct ethhdr) + 4;
2764 + /* payload 1+ category 1 + action 1 + dialog 1 */
2765 + cap = get_unaligned_le16(pos);
2766 +- ie_len = len - sizeof(struct ethhdr) - TDLS_REQ_FIX_LEN;
2767 ++ ies_len = len - sizeof(struct ethhdr) - TDLS_REQ_FIX_LEN;
2768 + pos += 2;
2769 + break;
2770 +
2771 +@@ -926,7 +926,7 @@ void mwifiex_process_tdls_action_frame(struct mwifiex_private *priv,
2772 + /* payload 1+ category 1 + action 1 + dialog 1 + status code 2*/
2773 + pos = buf + sizeof(struct ethhdr) + 6;
2774 + cap = get_unaligned_le16(pos);
2775 +- ie_len = len - sizeof(struct ethhdr) - TDLS_RESP_FIX_LEN;
2776 ++ ies_len = len - sizeof(struct ethhdr) - TDLS_RESP_FIX_LEN;
2777 + pos += 2;
2778 + break;
2779 +
2780 +@@ -934,7 +934,7 @@ void mwifiex_process_tdls_action_frame(struct mwifiex_private *priv,
2781 + if (len < (sizeof(struct ethhdr) + TDLS_CONFIRM_FIX_LEN))
2782 + return;
2783 + pos = buf + sizeof(struct ethhdr) + TDLS_CONFIRM_FIX_LEN;
2784 +- ie_len = len - sizeof(struct ethhdr) - TDLS_CONFIRM_FIX_LEN;
2785 ++ ies_len = len - sizeof(struct ethhdr) - TDLS_CONFIRM_FIX_LEN;
2786 + break;
2787 + default:
2788 + mwifiex_dbg(priv->adapter, ERROR, "Unknown TDLS frame type.\n");
2789 +@@ -947,33 +947,33 @@ void mwifiex_process_tdls_action_frame(struct mwifiex_private *priv,
2790 +
2791 + sta_ptr->tdls_cap.capab = cpu_to_le16(cap);
2792 +
2793 +- for (end = pos + ie_len; pos + 1 < end; pos += 2 + pos[1]) {
2794 +- if (pos + 2 + pos[1] > end)
2795 ++ for (end = pos + ies_len; pos + 1 < end; pos += 2 + pos[1]) {
2796 ++ u8 ie_len = pos[1];
2797 ++
2798 ++ if (pos + 2 + ie_len > end)
2799 + break;
2800 +
2801 + switch (*pos) {
2802 + case WLAN_EID_SUPP_RATES:
2803 +- if (pos[1] > 32)
2804 ++ if (ie_len > sizeof(sta_ptr->tdls_cap.rates))
2805 + return;
2806 +- sta_ptr->tdls_cap.rates_len = pos[1];
2807 +- for (i = 0; i < pos[1]; i++)
2808 ++ sta_ptr->tdls_cap.rates_len = ie_len;
2809 ++ for (i = 0; i < ie_len; i++)
2810 + sta_ptr->tdls_cap.rates[i] = pos[i + 2];
2811 + break;
2812 +
2813 + case WLAN_EID_EXT_SUPP_RATES:
2814 +- if (pos[1] > 32)
2815 ++ if (ie_len > sizeof(sta_ptr->tdls_cap.rates))
2816 + return;
2817 + basic = sta_ptr->tdls_cap.rates_len;
2818 +- if (pos[1] > 32 - basic)
2819 ++ if (ie_len > sizeof(sta_ptr->tdls_cap.rates) - basic)
2820 + return;
2821 +- for (i = 0; i < pos[1]; i++)
2822 ++ for (i = 0; i < ie_len; i++)
2823 + sta_ptr->tdls_cap.rates[basic + i] = pos[i + 2];
2824 +- sta_ptr->tdls_cap.rates_len += pos[1];
2825 ++ sta_ptr->tdls_cap.rates_len += ie_len;
2826 + break;
2827 + case WLAN_EID_HT_CAPABILITY:
2828 +- if (pos > end - sizeof(struct ieee80211_ht_cap) - 2)
2829 +- return;
2830 +- if (pos[1] != sizeof(struct ieee80211_ht_cap))
2831 ++ if (ie_len != sizeof(struct ieee80211_ht_cap))
2832 + return;
2833 + /* copy the ie's value into ht_capb*/
2834 + memcpy((u8 *)&sta_ptr->tdls_cap.ht_capb, pos + 2,
2835 +@@ -981,59 +981,45 @@ void mwifiex_process_tdls_action_frame(struct mwifiex_private *priv,
2836 + sta_ptr->is_11n_enabled = 1;
2837 + break;
2838 + case WLAN_EID_HT_OPERATION:
2839 +- if (pos > end -
2840 +- sizeof(struct ieee80211_ht_operation) - 2)
2841 +- return;
2842 +- if (pos[1] != sizeof(struct ieee80211_ht_operation))
2843 ++ if (ie_len != sizeof(struct ieee80211_ht_operation))
2844 + return;
2845 + /* copy the ie's value into ht_oper*/
2846 + memcpy(&sta_ptr->tdls_cap.ht_oper, pos + 2,
2847 + sizeof(struct ieee80211_ht_operation));
2848 + break;
2849 + case WLAN_EID_BSS_COEX_2040:
2850 +- if (pos > end - 3)
2851 +- return;
2852 +- if (pos[1] != 1)
2853 ++ if (ie_len != sizeof(pos[2]))
2854 + return;
2855 + sta_ptr->tdls_cap.coex_2040 = pos[2];
2856 + break;
2857 + case WLAN_EID_EXT_CAPABILITY:
2858 +- if (pos > end - sizeof(struct ieee_types_header))
2859 +- return;
2860 +- if (pos[1] < sizeof(struct ieee_types_header))
2861 ++ if (ie_len < sizeof(struct ieee_types_header))
2862 + return;
2863 +- if (pos[1] > 8)
2864 ++ if (ie_len > 8)
2865 + return;
2866 + memcpy((u8 *)&sta_ptr->tdls_cap.extcap, pos,
2867 + sizeof(struct ieee_types_header) +
2868 +- min_t(u8, pos[1], 8));
2869 ++ min_t(u8, ie_len, 8));
2870 + break;
2871 + case WLAN_EID_RSN:
2872 +- if (pos > end - sizeof(struct ieee_types_header))
2873 ++ if (ie_len < sizeof(struct ieee_types_header))
2874 + return;
2875 +- if (pos[1] < sizeof(struct ieee_types_header))
2876 +- return;
2877 +- if (pos[1] > IEEE_MAX_IE_SIZE -
2878 ++ if (ie_len > IEEE_MAX_IE_SIZE -
2879 + sizeof(struct ieee_types_header))
2880 + return;
2881 + memcpy((u8 *)&sta_ptr->tdls_cap.rsn_ie, pos,
2882 + sizeof(struct ieee_types_header) +
2883 +- min_t(u8, pos[1], IEEE_MAX_IE_SIZE -
2884 ++ min_t(u8, ie_len, IEEE_MAX_IE_SIZE -
2885 + sizeof(struct ieee_types_header)));
2886 + break;
2887 + case WLAN_EID_QOS_CAPA:
2888 +- if (pos > end - 3)
2889 +- return;
2890 +- if (pos[1] != 1)
2891 ++ if (ie_len != sizeof(pos[2]))
2892 + return;
2893 + sta_ptr->tdls_cap.qos_info = pos[2];
2894 + break;
2895 + case WLAN_EID_VHT_OPERATION:
2896 + if (priv->adapter->is_hw_11ac_capable) {
2897 +- if (pos > end -
2898 +- sizeof(struct ieee80211_vht_operation) - 2)
2899 +- return;
2900 +- if (pos[1] !=
2901 ++ if (ie_len !=
2902 + sizeof(struct ieee80211_vht_operation))
2903 + return;
2904 + /* copy the ie's value into vhtoper*/
2905 +@@ -1043,10 +1029,7 @@ void mwifiex_process_tdls_action_frame(struct mwifiex_private *priv,
2906 + break;
2907 + case WLAN_EID_VHT_CAPABILITY:
2908 + if (priv->adapter->is_hw_11ac_capable) {
2909 +- if (pos > end -
2910 +- sizeof(struct ieee80211_vht_cap) - 2)
2911 +- return;
2912 +- if (pos[1] != sizeof(struct ieee80211_vht_cap))
2913 ++ if (ie_len != sizeof(struct ieee80211_vht_cap))
2914 + return;
2915 + /* copy the ie's value into vhtcap*/
2916 + memcpy((u8 *)&sta_ptr->tdls_cap.vhtcap, pos + 2,
2917 +@@ -1056,9 +1039,7 @@ void mwifiex_process_tdls_action_frame(struct mwifiex_private *priv,
2918 + break;
2919 + case WLAN_EID_AID:
2920 + if (priv->adapter->is_hw_11ac_capable) {
2921 +- if (pos > end - 4)
2922 +- return;
2923 +- if (pos[1] != 2)
2924 ++ if (ie_len != sizeof(u16))
2925 + return;
2926 + sta_ptr->tdls_cap.aid =
2927 + get_unaligned_le16((pos + 2));
2928 +diff --git a/drivers/nfc/pn544/i2c.c b/drivers/nfc/pn544/i2c.c
2929 +index 720c89d6066e..4ac8cb262559 100644
2930 +--- a/drivers/nfc/pn544/i2c.c
2931 ++++ b/drivers/nfc/pn544/i2c.c
2932 +@@ -225,6 +225,7 @@ static void pn544_hci_i2c_platform_init(struct pn544_i2c_phy *phy)
2933 +
2934 + out:
2935 + gpiod_set_value_cansleep(phy->gpiod_en, !phy->en_polarity);
2936 ++ usleep_range(10000, 15000);
2937 + }
2938 +
2939 + static void pn544_hci_i2c_enable_mode(struct pn544_i2c_phy *phy, int run_mode)
2940 +diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
2941 +index e703827d27e9..7dacfd102a99 100644
2942 +--- a/drivers/nvme/host/core.c
2943 ++++ b/drivers/nvme/host/core.c
2944 +@@ -66,8 +66,8 @@ MODULE_PARM_DESC(streams, "turn on support for Streams write directives");
2945 + * nvme_reset_wq - hosts nvme reset works
2946 + * nvme_delete_wq - hosts nvme delete works
2947 + *
2948 +- * nvme_wq will host works such are scan, aen handling, fw activation,
2949 +- * keep-alive error recovery, periodic reconnects etc. nvme_reset_wq
2950 ++ * nvme_wq will host works such as scan, aen handling, fw activation,
2951 ++ * keep-alive, periodic reconnects etc. nvme_reset_wq
2952 + * runs reset works which also flush works hosted on nvme_wq for
2953 + * serialization purposes. nvme_delete_wq host controller deletion
2954 + * works which flush reset works for serialization.
2955 +@@ -972,7 +972,7 @@ static void nvme_keep_alive_end_io(struct request *rq, blk_status_t status)
2956 + startka = true;
2957 + spin_unlock_irqrestore(&ctrl->lock, flags);
2958 + if (startka)
2959 +- schedule_delayed_work(&ctrl->ka_work, ctrl->kato * HZ);
2960 ++ queue_delayed_work(nvme_wq, &ctrl->ka_work, ctrl->kato * HZ);
2961 + }
2962 +
2963 + static int nvme_keep_alive(struct nvme_ctrl *ctrl)
2964 +@@ -1002,7 +1002,7 @@ static void nvme_keep_alive_work(struct work_struct *work)
2965 + dev_dbg(ctrl->device,
2966 + "reschedule traffic based keep-alive timer\n");
2967 + ctrl->comp_seen = false;
2968 +- schedule_delayed_work(&ctrl->ka_work, ctrl->kato * HZ);
2969 ++ queue_delayed_work(nvme_wq, &ctrl->ka_work, ctrl->kato * HZ);
2970 + return;
2971 + }
2972 +
2973 +@@ -1019,7 +1019,7 @@ static void nvme_start_keep_alive(struct nvme_ctrl *ctrl)
2974 + if (unlikely(ctrl->kato == 0))
2975 + return;
2976 +
2977 +- schedule_delayed_work(&ctrl->ka_work, ctrl->kato * HZ);
2978 ++ queue_delayed_work(nvme_wq, &ctrl->ka_work, ctrl->kato * HZ);
2979 + }
2980 +
2981 + void nvme_stop_keep_alive(struct nvme_ctrl *ctrl)
2982 +diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
2983 +index f34a56d588d3..570c75c92e29 100644
2984 +--- a/drivers/nvme/host/pci.c
2985 ++++ b/drivers/nvme/host/pci.c
2986 +@@ -1084,9 +1084,9 @@ static int nvme_poll(struct blk_mq_hw_ctx *hctx)
2987 +
2988 + spin_lock(&nvmeq->cq_poll_lock);
2989 + found = nvme_process_cq(nvmeq, &start, &end, -1);
2990 ++ nvme_complete_cqes(nvmeq, start, end);
2991 + spin_unlock(&nvmeq->cq_poll_lock);
2992 +
2993 +- nvme_complete_cqes(nvmeq, start, end);
2994 + return found;
2995 + }
2996 +
2997 +@@ -1407,6 +1407,23 @@ static void nvme_disable_admin_queue(struct nvme_dev *dev, bool shutdown)
2998 + nvme_poll_irqdisable(nvmeq, -1);
2999 + }
3000 +
3001 ++/*
3002 ++ * Called only on a device that has been disabled and after all other threads
3003 ++ * that can check this device's completion queues have synced. This is the
3004 ++ * last chance for the driver to see a natural completion before
3005 ++ * nvme_cancel_request() terminates all incomplete requests.
3006 ++ */
3007 ++static void nvme_reap_pending_cqes(struct nvme_dev *dev)
3008 ++{
3009 ++ u16 start, end;
3010 ++ int i;
3011 ++
3012 ++ for (i = dev->ctrl.queue_count - 1; i > 0; i--) {
3013 ++ nvme_process_cq(&dev->queues[i], &start, &end, -1);
3014 ++ nvme_complete_cqes(&dev->queues[i], start, end);
3015 ++ }
3016 ++}
3017 ++
3018 + static int nvme_cmb_qdepth(struct nvme_dev *dev, int nr_io_queues,
3019 + int entry_size)
3020 + {
3021 +@@ -2241,11 +2258,6 @@ static bool __nvme_disable_io_queues(struct nvme_dev *dev, u8 opcode)
3022 + if (timeout == 0)
3023 + return false;
3024 +
3025 +- /* handle any remaining CQEs */
3026 +- if (opcode == nvme_admin_delete_cq &&
3027 +- !test_bit(NVMEQ_DELETE_ERROR, &nvmeq->flags))
3028 +- nvme_poll_irqdisable(nvmeq, -1);
3029 +-
3030 + sent--;
3031 + if (nr_queues)
3032 + goto retry;
3033 +@@ -2434,6 +2446,7 @@ static void nvme_dev_disable(struct nvme_dev *dev, bool shutdown)
3034 + nvme_suspend_io_queues(dev);
3035 + nvme_suspend_queue(&dev->queues[0]);
3036 + nvme_pci_disable(dev);
3037 ++ nvme_reap_pending_cqes(dev);
3038 +
3039 + blk_mq_tagset_busy_iter(&dev->tagset, nvme_cancel_request, &dev->ctrl);
3040 + blk_mq_tagset_busy_iter(&dev->admin_tagset, nvme_cancel_request, &dev->ctrl);
3041 +diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c
3042 +index cb4c3000a57e..4ff51da3b13f 100644
3043 +--- a/drivers/nvme/host/rdma.c
3044 ++++ b/drivers/nvme/host/rdma.c
3045 +@@ -1088,7 +1088,7 @@ static void nvme_rdma_error_recovery(struct nvme_rdma_ctrl *ctrl)
3046 + if (!nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_RESETTING))
3047 + return;
3048 +
3049 +- queue_work(nvme_wq, &ctrl->err_work);
3050 ++ queue_work(nvme_reset_wq, &ctrl->err_work);
3051 + }
3052 +
3053 + static void nvme_rdma_wr_error(struct ib_cq *cq, struct ib_wc *wc,
3054 +diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c
3055 +index 7544be84ab35..244984420b41 100644
3056 +--- a/drivers/nvme/host/tcp.c
3057 ++++ b/drivers/nvme/host/tcp.c
3058 +@@ -422,7 +422,7 @@ static void nvme_tcp_error_recovery(struct nvme_ctrl *ctrl)
3059 + if (!nvme_change_ctrl_state(ctrl, NVME_CTRL_RESETTING))
3060 + return;
3061 +
3062 +- queue_work(nvme_wq, &to_tcp_ctrl(ctrl)->err_work);
3063 ++ queue_work(nvme_reset_wq, &to_tcp_ctrl(ctrl)->err_work);
3064 + }
3065 +
3066 + static int nvme_tcp_process_nvme_cqe(struct nvme_tcp_queue *queue,
3067 +@@ -1054,7 +1054,12 @@ static void nvme_tcp_io_work(struct work_struct *w)
3068 + } else if (unlikely(result < 0)) {
3069 + dev_err(queue->ctrl->ctrl.device,
3070 + "failed to send request %d\n", result);
3071 +- if (result != -EPIPE)
3072 ++
3073 ++ /*
3074 ++ * Fail the request unless peer closed the connection,
3075 ++ * in which case error recovery flow will complete all.
3076 ++ */
3077 ++ if ((result != -EPIPE) && (result != -ECONNRESET))
3078 + nvme_tcp_fail_request(queue->request);
3079 + nvme_tcp_done_send_req(queue);
3080 + return;
3081 +diff --git a/drivers/perf/arm_smmuv3_pmu.c b/drivers/perf/arm_smmuv3_pmu.c
3082 +index 191f410cf35c..2f8787276d9b 100644
3083 +--- a/drivers/perf/arm_smmuv3_pmu.c
3084 ++++ b/drivers/perf/arm_smmuv3_pmu.c
3085 +@@ -772,7 +772,7 @@ static int smmu_pmu_probe(struct platform_device *pdev)
3086 + smmu_pmu->reloc_base = smmu_pmu->reg_base;
3087 + }
3088 +
3089 +- irq = platform_get_irq(pdev, 0);
3090 ++ irq = platform_get_irq_optional(pdev, 0);
3091 + if (irq > 0)
3092 + smmu_pmu->irq = irq;
3093 +
3094 +diff --git a/drivers/pwm/pwm-omap-dmtimer.c b/drivers/pwm/pwm-omap-dmtimer.c
3095 +index e36fcad668a6..88a3c5690fea 100644
3096 +--- a/drivers/pwm/pwm-omap-dmtimer.c
3097 ++++ b/drivers/pwm/pwm-omap-dmtimer.c
3098 +@@ -256,7 +256,7 @@ static int pwm_omap_dmtimer_probe(struct platform_device *pdev)
3099 + if (!timer_pdev) {
3100 + dev_err(&pdev->dev, "Unable to find Timer pdev\n");
3101 + ret = -ENODEV;
3102 +- goto put;
3103 ++ goto err_find_timer_pdev;
3104 + }
3105 +
3106 + timer_pdata = dev_get_platdata(&timer_pdev->dev);
3107 +@@ -264,7 +264,7 @@ static int pwm_omap_dmtimer_probe(struct platform_device *pdev)
3108 + dev_dbg(&pdev->dev,
3109 + "dmtimer pdata structure NULL, deferring probe\n");
3110 + ret = -EPROBE_DEFER;
3111 +- goto put;
3112 ++ goto err_platdata;
3113 + }
3114 +
3115 + pdata = timer_pdata->timer_ops;
3116 +@@ -283,19 +283,19 @@ static int pwm_omap_dmtimer_probe(struct platform_device *pdev)
3117 + !pdata->write_counter) {
3118 + dev_err(&pdev->dev, "Incomplete dmtimer pdata structure\n");
3119 + ret = -EINVAL;
3120 +- goto put;
3121 ++ goto err_platdata;
3122 + }
3123 +
3124 + if (!of_get_property(timer, "ti,timer-pwm", NULL)) {
3125 + dev_err(&pdev->dev, "Missing ti,timer-pwm capability\n");
3126 + ret = -ENODEV;
3127 +- goto put;
3128 ++ goto err_timer_property;
3129 + }
3130 +
3131 + dm_timer = pdata->request_by_node(timer);
3132 + if (!dm_timer) {
3133 + ret = -EPROBE_DEFER;
3134 +- goto put;
3135 ++ goto err_request_timer;
3136 + }
3137 +
3138 + omap = devm_kzalloc(&pdev->dev, sizeof(*omap), GFP_KERNEL);
3139 +@@ -352,7 +352,14 @@ err_pwmchip_add:
3140 + err_alloc_omap:
3141 +
3142 + pdata->free(dm_timer);
3143 +-put:
3144 ++err_request_timer:
3145 ++
3146 ++err_timer_property:
3147 ++err_platdata:
3148 ++
3149 ++ put_device(&timer_pdev->dev);
3150 ++err_find_timer_pdev:
3151 ++
3152 + of_node_put(timer);
3153 +
3154 + return ret;
3155 +@@ -372,6 +379,8 @@ static int pwm_omap_dmtimer_remove(struct platform_device *pdev)
3156 +
3157 + omap->pdata->free(omap->dm_timer);
3158 +
3159 ++ put_device(&omap->dm_timer_pdev->dev);
3160 ++
3161 + mutex_destroy(&omap->mutex);
3162 +
3163 + return 0;
3164 +diff --git a/drivers/s390/crypto/ap_bus.h b/drivers/s390/crypto/ap_bus.h
3165 +index bb35ba4a8d24..4348fdff1c61 100644
3166 +--- a/drivers/s390/crypto/ap_bus.h
3167 ++++ b/drivers/s390/crypto/ap_bus.h
3168 +@@ -162,7 +162,7 @@ struct ap_card {
3169 + unsigned int functions; /* AP device function bitfield. */
3170 + int queue_depth; /* AP queue depth.*/
3171 + int id; /* AP card number. */
3172 +- atomic_t total_request_count; /* # requests ever for this AP device.*/
3173 ++ atomic64_t total_request_count; /* # requests ever for this AP device.*/
3174 + };
3175 +
3176 + #define to_ap_card(x) container_of((x), struct ap_card, ap_dev.device)
3177 +@@ -179,7 +179,7 @@ struct ap_queue {
3178 + enum ap_state state; /* State of the AP device. */
3179 + int pendingq_count; /* # requests on pendingq list. */
3180 + int requestq_count; /* # requests on requestq list. */
3181 +- int total_request_count; /* # requests ever for this AP device.*/
3182 ++ u64 total_request_count; /* # requests ever for this AP device.*/
3183 + int request_timeout; /* Request timeout in jiffies. */
3184 + struct timer_list timeout; /* Timer for request timeouts. */
3185 + struct list_head pendingq; /* List of message sent to AP queue. */
3186 +diff --git a/drivers/s390/crypto/ap_card.c b/drivers/s390/crypto/ap_card.c
3187 +index 63b4cc6cd7e5..e85bfca1ed16 100644
3188 +--- a/drivers/s390/crypto/ap_card.c
3189 ++++ b/drivers/s390/crypto/ap_card.c
3190 +@@ -63,13 +63,13 @@ static ssize_t request_count_show(struct device *dev,
3191 + char *buf)
3192 + {
3193 + struct ap_card *ac = to_ap_card(dev);
3194 +- unsigned int req_cnt;
3195 ++ u64 req_cnt;
3196 +
3197 + req_cnt = 0;
3198 + spin_lock_bh(&ap_list_lock);
3199 +- req_cnt = atomic_read(&ac->total_request_count);
3200 ++ req_cnt = atomic64_read(&ac->total_request_count);
3201 + spin_unlock_bh(&ap_list_lock);
3202 +- return snprintf(buf, PAGE_SIZE, "%d\n", req_cnt);
3203 ++ return snprintf(buf, PAGE_SIZE, "%llu\n", req_cnt);
3204 + }
3205 +
3206 + static ssize_t request_count_store(struct device *dev,
3207 +@@ -83,7 +83,7 @@ static ssize_t request_count_store(struct device *dev,
3208 + for_each_ap_queue(aq, ac)
3209 + aq->total_request_count = 0;
3210 + spin_unlock_bh(&ap_list_lock);
3211 +- atomic_set(&ac->total_request_count, 0);
3212 ++ atomic64_set(&ac->total_request_count, 0);
3213 +
3214 + return count;
3215 + }
3216 +diff --git a/drivers/s390/crypto/ap_queue.c b/drivers/s390/crypto/ap_queue.c
3217 +index 37c3bdc3642d..a317ab484932 100644
3218 +--- a/drivers/s390/crypto/ap_queue.c
3219 ++++ b/drivers/s390/crypto/ap_queue.c
3220 +@@ -479,12 +479,12 @@ static ssize_t request_count_show(struct device *dev,
3221 + char *buf)
3222 + {
3223 + struct ap_queue *aq = to_ap_queue(dev);
3224 +- unsigned int req_cnt;
3225 ++ u64 req_cnt;
3226 +
3227 + spin_lock_bh(&aq->lock);
3228 + req_cnt = aq->total_request_count;
3229 + spin_unlock_bh(&aq->lock);
3230 +- return snprintf(buf, PAGE_SIZE, "%d\n", req_cnt);
3231 ++ return snprintf(buf, PAGE_SIZE, "%llu\n", req_cnt);
3232 + }
3233 +
3234 + static ssize_t request_count_store(struct device *dev,
3235 +@@ -676,7 +676,7 @@ void ap_queue_message(struct ap_queue *aq, struct ap_message *ap_msg)
3236 + list_add_tail(&ap_msg->list, &aq->requestq);
3237 + aq->requestq_count++;
3238 + aq->total_request_count++;
3239 +- atomic_inc(&aq->card->total_request_count);
3240 ++ atomic64_inc(&aq->card->total_request_count);
3241 + /* Send/receive as many request from the queue as possible. */
3242 + ap_wait(ap_sm_event_loop(aq, AP_EVENT_POLL));
3243 + spin_unlock_bh(&aq->lock);
3244 +diff --git a/drivers/s390/crypto/zcrypt_api.c b/drivers/s390/crypto/zcrypt_api.c
3245 +index 9157e728a362..7fa0262e91af 100644
3246 +--- a/drivers/s390/crypto/zcrypt_api.c
3247 ++++ b/drivers/s390/crypto/zcrypt_api.c
3248 +@@ -605,8 +605,8 @@ static inline bool zcrypt_card_compare(struct zcrypt_card *zc,
3249 + weight += atomic_read(&zc->load);
3250 + pref_weight += atomic_read(&pref_zc->load);
3251 + if (weight == pref_weight)
3252 +- return atomic_read(&zc->card->total_request_count) >
3253 +- atomic_read(&pref_zc->card->total_request_count);
3254 ++ return atomic64_read(&zc->card->total_request_count) >
3255 ++ atomic64_read(&pref_zc->card->total_request_count);
3256 + return weight > pref_weight;
3257 + }
3258 +
3259 +@@ -1216,11 +1216,12 @@ static void zcrypt_qdepth_mask(char qdepth[], size_t max_adapters)
3260 + spin_unlock(&zcrypt_list_lock);
3261 + }
3262 +
3263 +-static void zcrypt_perdev_reqcnt(int reqcnt[], size_t max_adapters)
3264 ++static void zcrypt_perdev_reqcnt(u32 reqcnt[], size_t max_adapters)
3265 + {
3266 + struct zcrypt_card *zc;
3267 + struct zcrypt_queue *zq;
3268 + int card;
3269 ++ u64 cnt;
3270 +
3271 + memset(reqcnt, 0, sizeof(int) * max_adapters);
3272 + spin_lock(&zcrypt_list_lock);
3273 +@@ -1232,8 +1233,9 @@ static void zcrypt_perdev_reqcnt(int reqcnt[], size_t max_adapters)
3274 + || card >= max_adapters)
3275 + continue;
3276 + spin_lock(&zq->queue->lock);
3277 +- reqcnt[card] = zq->queue->total_request_count;
3278 ++ cnt = zq->queue->total_request_count;
3279 + spin_unlock(&zq->queue->lock);
3280 ++ reqcnt[card] = (cnt < UINT_MAX) ? (u32) cnt : UINT_MAX;
3281 + }
3282 + }
3283 + local_bh_enable();
3284 +@@ -1411,9 +1413,9 @@ static long zcrypt_unlocked_ioctl(struct file *filp, unsigned int cmd,
3285 + return 0;
3286 + }
3287 + case ZCRYPT_PERDEV_REQCNT: {
3288 +- int *reqcnt;
3289 ++ u32 *reqcnt;
3290 +
3291 +- reqcnt = kcalloc(AP_DEVICES, sizeof(int), GFP_KERNEL);
3292 ++ reqcnt = kcalloc(AP_DEVICES, sizeof(u32), GFP_KERNEL);
3293 + if (!reqcnt)
3294 + return -ENOMEM;
3295 + zcrypt_perdev_reqcnt(reqcnt, AP_DEVICES);
3296 +@@ -1470,7 +1472,7 @@ static long zcrypt_unlocked_ioctl(struct file *filp, unsigned int cmd,
3297 + }
3298 + case Z90STAT_PERDEV_REQCNT: {
3299 + /* the old ioctl supports only 64 adapters */
3300 +- int reqcnt[MAX_ZDEV_CARDIDS];
3301 ++ u32 reqcnt[MAX_ZDEV_CARDIDS];
3302 +
3303 + zcrypt_perdev_reqcnt(reqcnt, MAX_ZDEV_CARDIDS);
3304 + if (copy_to_user((int __user *) arg, reqcnt, sizeof(reqcnt)))
3305 +diff --git a/drivers/s390/net/qeth_l2_main.c b/drivers/s390/net/qeth_l2_main.c
3306 +index 59e220749ad1..92bace3b28fd 100644
3307 +--- a/drivers/s390/net/qeth_l2_main.c
3308 ++++ b/drivers/s390/net/qeth_l2_main.c
3309 +@@ -1846,15 +1846,14 @@ int qeth_l2_vnicc_set_state(struct qeth_card *card, u32 vnicc, bool state)
3310 +
3311 + QETH_CARD_TEXT(card, 2, "vniccsch");
3312 +
3313 +- /* do not change anything if BridgePort is enabled */
3314 +- if (qeth_bridgeport_is_in_use(card))
3315 +- return -EBUSY;
3316 +-
3317 + /* check if characteristic and enable/disable are supported */
3318 + if (!(card->options.vnicc.sup_chars & vnicc) ||
3319 + !(card->options.vnicc.set_char_sup & vnicc))
3320 + return -EOPNOTSUPP;
3321 +
3322 ++ if (qeth_bridgeport_is_in_use(card))
3323 ++ return -EBUSY;
3324 ++
3325 + /* set enable/disable command and store wanted characteristic */
3326 + if (state) {
3327 + cmd = IPA_VNICC_ENABLE;
3328 +@@ -1900,14 +1899,13 @@ int qeth_l2_vnicc_get_state(struct qeth_card *card, u32 vnicc, bool *state)
3329 +
3330 + QETH_CARD_TEXT(card, 2, "vniccgch");
3331 +
3332 +- /* do not get anything if BridgePort is enabled */
3333 +- if (qeth_bridgeport_is_in_use(card))
3334 +- return -EBUSY;
3335 +-
3336 + /* check if characteristic is supported */
3337 + if (!(card->options.vnicc.sup_chars & vnicc))
3338 + return -EOPNOTSUPP;
3339 +
3340 ++ if (qeth_bridgeport_is_in_use(card))
3341 ++ return -EBUSY;
3342 ++
3343 + /* if card is ready, query current VNICC state */
3344 + if (qeth_card_hw_is_reachable(card))
3345 + rc = qeth_l2_vnicc_query_chars(card);
3346 +@@ -1925,15 +1923,14 @@ int qeth_l2_vnicc_set_timeout(struct qeth_card *card, u32 timeout)
3347 +
3348 + QETH_CARD_TEXT(card, 2, "vniccsto");
3349 +
3350 +- /* do not change anything if BridgePort is enabled */
3351 +- if (qeth_bridgeport_is_in_use(card))
3352 +- return -EBUSY;
3353 +-
3354 + /* check if characteristic and set_timeout are supported */
3355 + if (!(card->options.vnicc.sup_chars & QETH_VNICC_LEARNING) ||
3356 + !(card->options.vnicc.getset_timeout_sup & QETH_VNICC_LEARNING))
3357 + return -EOPNOTSUPP;
3358 +
3359 ++ if (qeth_bridgeport_is_in_use(card))
3360 ++ return -EBUSY;
3361 ++
3362 + /* do we need to do anything? */
3363 + if (card->options.vnicc.learning_timeout == timeout)
3364 + return rc;
3365 +@@ -1962,14 +1959,14 @@ int qeth_l2_vnicc_get_timeout(struct qeth_card *card, u32 *timeout)
3366 +
3367 + QETH_CARD_TEXT(card, 2, "vniccgto");
3368 +
3369 +- /* do not get anything if BridgePort is enabled */
3370 +- if (qeth_bridgeport_is_in_use(card))
3371 +- return -EBUSY;
3372 +-
3373 + /* check if characteristic and get_timeout are supported */
3374 + if (!(card->options.vnicc.sup_chars & QETH_VNICC_LEARNING) ||
3375 + !(card->options.vnicc.getset_timeout_sup & QETH_VNICC_LEARNING))
3376 + return -EOPNOTSUPP;
3377 ++
3378 ++ if (qeth_bridgeport_is_in_use(card))
3379 ++ return -EBUSY;
3380 ++
3381 + /* if card is ready, get timeout. Otherwise, just return stored value */
3382 + *timeout = card->options.vnicc.learning_timeout;
3383 + if (qeth_card_hw_is_reachable(card))
3384 +diff --git a/drivers/soc/tegra/fuse/fuse-tegra30.c b/drivers/soc/tegra/fuse/fuse-tegra30.c
3385 +index be9424a87173..9c3ef0a02fd4 100644
3386 +--- a/drivers/soc/tegra/fuse/fuse-tegra30.c
3387 ++++ b/drivers/soc/tegra/fuse/fuse-tegra30.c
3388 +@@ -35,7 +35,8 @@
3389 + defined(CONFIG_ARCH_TEGRA_124_SOC) || \
3390 + defined(CONFIG_ARCH_TEGRA_132_SOC) || \
3391 + defined(CONFIG_ARCH_TEGRA_210_SOC) || \
3392 +- defined(CONFIG_ARCH_TEGRA_186_SOC)
3393 ++ defined(CONFIG_ARCH_TEGRA_186_SOC) || \
3394 ++ defined(CONFIG_ARCH_TEGRA_194_SOC)
3395 + static u32 tegra30_fuse_read_early(struct tegra_fuse *fuse, unsigned int offset)
3396 + {
3397 + if (WARN_ON(!fuse->base))
3398 +diff --git a/drivers/thermal/broadcom/brcmstb_thermal.c b/drivers/thermal/broadcom/brcmstb_thermal.c
3399 +index 5825ac581f56..680f1a070606 100644
3400 +--- a/drivers/thermal/broadcom/brcmstb_thermal.c
3401 ++++ b/drivers/thermal/broadcom/brcmstb_thermal.c
3402 +@@ -49,7 +49,7 @@
3403 + #define AVS_TMON_TP_TEST_ENABLE 0x20
3404 +
3405 + /* Default coefficients */
3406 +-#define AVS_TMON_TEMP_SLOPE -487
3407 ++#define AVS_TMON_TEMP_SLOPE 487
3408 + #define AVS_TMON_TEMP_OFFSET 410040
3409 +
3410 + /* HW related temperature constants */
3411 +@@ -108,23 +108,12 @@ struct brcmstb_thermal_priv {
3412 + struct thermal_zone_device *thermal;
3413 + };
3414 +
3415 +-static void avs_tmon_get_coeffs(struct thermal_zone_device *tz, int *slope,
3416 +- int *offset)
3417 +-{
3418 +- *slope = thermal_zone_get_slope(tz);
3419 +- *offset = thermal_zone_get_offset(tz);
3420 +-}
3421 +-
3422 + /* Convert a HW code to a temperature reading (millidegree celsius) */
3423 + static inline int avs_tmon_code_to_temp(struct thermal_zone_device *tz,
3424 + u32 code)
3425 + {
3426 +- const int val = code & AVS_TMON_TEMP_MASK;
3427 +- int slope, offset;
3428 +-
3429 +- avs_tmon_get_coeffs(tz, &slope, &offset);
3430 +-
3431 +- return slope * val + offset;
3432 ++ return (AVS_TMON_TEMP_OFFSET -
3433 ++ (int)((code & AVS_TMON_TEMP_MAX) * AVS_TMON_TEMP_SLOPE));
3434 + }
3435 +
3436 + /*
3437 +@@ -136,20 +125,18 @@ static inline int avs_tmon_code_to_temp(struct thermal_zone_device *tz,
3438 + static inline u32 avs_tmon_temp_to_code(struct thermal_zone_device *tz,
3439 + int temp, bool low)
3440 + {
3441 +- int slope, offset;
3442 +-
3443 + if (temp < AVS_TMON_TEMP_MIN)
3444 +- return AVS_TMON_TEMP_MAX; /* Maximum code value */
3445 +-
3446 +- avs_tmon_get_coeffs(tz, &slope, &offset);
3447 ++ return AVS_TMON_TEMP_MAX; /* Maximum code value */
3448 +
3449 +- if (temp >= offset)
3450 ++ if (temp >= AVS_TMON_TEMP_OFFSET)
3451 + return 0; /* Minimum code value */
3452 +
3453 + if (low)
3454 +- return (u32)(DIV_ROUND_UP(offset - temp, abs(slope)));
3455 ++ return (u32)(DIV_ROUND_UP(AVS_TMON_TEMP_OFFSET - temp,
3456 ++ AVS_TMON_TEMP_SLOPE));
3457 + else
3458 +- return (u32)((offset - temp) / abs(slope));
3459 ++ return (u32)((AVS_TMON_TEMP_OFFSET - temp) /
3460 ++ AVS_TMON_TEMP_SLOPE);
3461 + }
3462 +
3463 + static int brcmstb_get_temp(void *data, int *temp)
3464 +diff --git a/drivers/thermal/db8500_thermal.c b/drivers/thermal/db8500_thermal.c
3465 +index 372dbbaaafb8..21d4d6e6409a 100644
3466 +--- a/drivers/thermal/db8500_thermal.c
3467 ++++ b/drivers/thermal/db8500_thermal.c
3468 +@@ -152,8 +152,8 @@ static irqreturn_t prcmu_high_irq_handler(int irq, void *irq_data)
3469 + db8500_thermal_update_config(th, idx, THERMAL_TREND_RAISING,
3470 + next_low, next_high);
3471 +
3472 +- dev_info(&th->tz->device,
3473 +- "PRCMU set max %ld, min %ld\n", next_high, next_low);
3474 ++ dev_dbg(&th->tz->device,
3475 ++ "PRCMU set max %ld, min %ld\n", next_high, next_low);
3476 + } else if (idx == num_points - 1)
3477 + /* So we roof out 1 degree over the max point */
3478 + th->interpolated_temp = db8500_thermal_points[idx] + 1;
3479 +diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
3480 +index 1a2dd53caade..b53b6528d6ce 100644
3481 +--- a/drivers/vhost/net.c
3482 ++++ b/drivers/vhost/net.c
3483 +@@ -1414,10 +1414,6 @@ static int vhost_net_release(struct inode *inode, struct file *f)
3484 +
3485 + static struct socket *get_raw_socket(int fd)
3486 + {
3487 +- struct {
3488 +- struct sockaddr_ll sa;
3489 +- char buf[MAX_ADDR_LEN];
3490 +- } uaddr;
3491 + int r;
3492 + struct socket *sock = sockfd_lookup(fd, &r);
3493 +
3494 +@@ -1430,11 +1426,7 @@ static struct socket *get_raw_socket(int fd)
3495 + goto err;
3496 + }
3497 +
3498 +- r = sock->ops->getname(sock, (struct sockaddr *)&uaddr.sa, 0);
3499 +- if (r < 0)
3500 +- goto err;
3501 +-
3502 +- if (uaddr.sa.sll_family != AF_PACKET) {
3503 ++ if (sock->sk->sk_family != AF_PACKET) {
3504 + r = -EPFNOSUPPORT;
3505 + goto err;
3506 + }
3507 +diff --git a/drivers/watchdog/wdat_wdt.c b/drivers/watchdog/wdat_wdt.c
3508 +index e7cf41aa26c3..1ce39de917f0 100644
3509 +--- a/drivers/watchdog/wdat_wdt.c
3510 ++++ b/drivers/watchdog/wdat_wdt.c
3511 +@@ -389,7 +389,7 @@ static int wdat_wdt_probe(struct platform_device *pdev)
3512 +
3513 + memset(&r, 0, sizeof(r));
3514 + r.start = gas->address;
3515 +- r.end = r.start + gas->access_width - 1;
3516 ++ r.end = r.start + ACPI_ACCESS_BYTE_WIDTH(gas->access_width) - 1;
3517 + if (gas->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) {
3518 + r.flags = IORESOURCE_MEM;
3519 + } else if (gas->space_id == ACPI_ADR_SPACE_SYSTEM_IO) {
3520 +diff --git a/fs/ceph/file.c b/fs/ceph/file.c
3521 +index 11929d2bb594..cd09e63d682b 100644
3522 +--- a/fs/ceph/file.c
3523 ++++ b/fs/ceph/file.c
3524 +@@ -1418,6 +1418,7 @@ static ssize_t ceph_write_iter(struct kiocb *iocb, struct iov_iter *from)
3525 + struct ceph_cap_flush *prealloc_cf;
3526 + ssize_t count, written = 0;
3527 + int err, want, got;
3528 ++ bool direct_lock = false;
3529 + loff_t pos;
3530 + loff_t limit = max(i_size_read(inode), fsc->max_file_size);
3531 +
3532 +@@ -1428,8 +1429,11 @@ static ssize_t ceph_write_iter(struct kiocb *iocb, struct iov_iter *from)
3533 + if (!prealloc_cf)
3534 + return -ENOMEM;
3535 +
3536 ++ if ((iocb->ki_flags & (IOCB_DIRECT | IOCB_APPEND)) == IOCB_DIRECT)
3537 ++ direct_lock = true;
3538 ++
3539 + retry_snap:
3540 +- if (iocb->ki_flags & IOCB_DIRECT)
3541 ++ if (direct_lock)
3542 + ceph_start_io_direct(inode);
3543 + else
3544 + ceph_start_io_write(inode);
3545 +@@ -1519,14 +1523,15 @@ retry_snap:
3546 +
3547 + /* we might need to revert back to that point */
3548 + data = *from;
3549 +- if (iocb->ki_flags & IOCB_DIRECT) {
3550 ++ if (iocb->ki_flags & IOCB_DIRECT)
3551 + written = ceph_direct_read_write(iocb, &data, snapc,
3552 + &prealloc_cf);
3553 +- ceph_end_io_direct(inode);
3554 +- } else {
3555 ++ else
3556 + written = ceph_sync_write(iocb, &data, pos, snapc);
3557 ++ if (direct_lock)
3558 ++ ceph_end_io_direct(inode);
3559 ++ else
3560 + ceph_end_io_write(inode);
3561 +- }
3562 + if (written > 0)
3563 + iov_iter_advance(from, written);
3564 + ceph_put_snap_context(snapc);
3565 +@@ -1577,7 +1582,7 @@ retry_snap:
3566 +
3567 + goto out_unlocked;
3568 + out:
3569 +- if (iocb->ki_flags & IOCB_DIRECT)
3570 ++ if (direct_lock)
3571 + ceph_end_io_direct(inode);
3572 + else
3573 + ceph_end_io_write(inode);
3574 +diff --git a/fs/cifs/cifsacl.c b/fs/cifs/cifsacl.c
3575 +index f842944a5c76..1619af216677 100644
3576 +--- a/fs/cifs/cifsacl.c
3577 ++++ b/fs/cifs/cifsacl.c
3578 +@@ -603,7 +603,7 @@ static void access_flags_to_mode(__le32 ace_flags, int type, umode_t *pmode,
3579 + ((flags & FILE_EXEC_RIGHTS) == FILE_EXEC_RIGHTS))
3580 + *pmode |= (S_IXUGO & (*pbits_to_set));
3581 +
3582 +- cifs_dbg(NOISY, "access flags 0x%x mode now 0x%x\n", flags, *pmode);
3583 ++ cifs_dbg(NOISY, "access flags 0x%x mode now %04o\n", flags, *pmode);
3584 + return;
3585 + }
3586 +
3587 +@@ -632,7 +632,7 @@ static void mode_to_access_flags(umode_t mode, umode_t bits_to_use,
3588 + if (mode & S_IXUGO)
3589 + *pace_flags |= SET_FILE_EXEC_RIGHTS;
3590 +
3591 +- cifs_dbg(NOISY, "mode: 0x%x, access flags now 0x%x\n",
3592 ++ cifs_dbg(NOISY, "mode: %04o, access flags now 0x%x\n",
3593 + mode, *pace_flags);
3594 + return;
3595 + }
3596 +diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
3597 +index 5d3c867bdc80..bcda48c03882 100644
3598 +--- a/fs/cifs/connect.c
3599 ++++ b/fs/cifs/connect.c
3600 +@@ -4094,7 +4094,7 @@ int cifs_setup_cifs_sb(struct smb_vol *pvolume_info,
3601 + cifs_sb->mnt_gid = pvolume_info->linux_gid;
3602 + cifs_sb->mnt_file_mode = pvolume_info->file_mode;
3603 + cifs_sb->mnt_dir_mode = pvolume_info->dir_mode;
3604 +- cifs_dbg(FYI, "file mode: 0x%hx dir mode: 0x%hx\n",
3605 ++ cifs_dbg(FYI, "file mode: %04ho dir mode: %04ho\n",
3606 + cifs_sb->mnt_file_mode, cifs_sb->mnt_dir_mode);
3607 +
3608 + cifs_sb->actimeo = pvolume_info->actimeo;
3609 +diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
3610 +index ed59e4a8db59..aafcd79c4772 100644
3611 +--- a/fs/cifs/inode.c
3612 ++++ b/fs/cifs/inode.c
3613 +@@ -1586,7 +1586,7 @@ int cifs_mkdir(struct inode *inode, struct dentry *direntry, umode_t mode)
3614 + struct TCP_Server_Info *server;
3615 + char *full_path;
3616 +
3617 +- cifs_dbg(FYI, "In cifs_mkdir, mode = 0x%hx inode = 0x%p\n",
3618 ++ cifs_dbg(FYI, "In cifs_mkdir, mode = %04ho inode = 0x%p\n",
3619 + mode, inode);
3620 +
3621 + cifs_sb = CIFS_SB(inode->i_sb);
3622 +diff --git a/fs/dax.c b/fs/dax.c
3623 +index 2cc43cd914eb..cc56313c6b3b 100644
3624 +--- a/fs/dax.c
3625 ++++ b/fs/dax.c
3626 +@@ -1207,6 +1207,9 @@ dax_iomap_rw(struct kiocb *iocb, struct iov_iter *iter,
3627 + lockdep_assert_held(&inode->i_rwsem);
3628 + }
3629 +
3630 ++ if (iocb->ki_flags & IOCB_NOWAIT)
3631 ++ flags |= IOMAP_NOWAIT;
3632 ++
3633 + while (iov_iter_count(iter)) {
3634 + ret = iomap_apply(inode, pos, iov_iter_count(iter), flags, ops,
3635 + iter, dax_iomap_actor);
3636 +diff --git a/fs/ext4/super.c b/fs/ext4/super.c
3637 +index 3ca604807839..8bd806a03a90 100644
3638 +--- a/fs/ext4/super.c
3639 ++++ b/fs/ext4/super.c
3640 +@@ -2343,7 +2343,7 @@ int ext4_alloc_flex_bg_array(struct super_block *sb, ext4_group_t ngroup)
3641 + {
3642 + struct ext4_sb_info *sbi = EXT4_SB(sb);
3643 + struct flex_groups **old_groups, **new_groups;
3644 +- int size, i;
3645 ++ int size, i, j;
3646 +
3647 + if (!sbi->s_log_groups_per_flex)
3648 + return 0;
3649 +@@ -2364,8 +2364,8 @@ int ext4_alloc_flex_bg_array(struct super_block *sb, ext4_group_t ngroup)
3650 + sizeof(struct flex_groups)),
3651 + GFP_KERNEL);
3652 + if (!new_groups[i]) {
3653 +- for (i--; i >= sbi->s_flex_groups_allocated; i--)
3654 +- kvfree(new_groups[i]);
3655 ++ for (j = sbi->s_flex_groups_allocated; j < i; j++)
3656 ++ kvfree(new_groups[j]);
3657 + kvfree(new_groups);
3658 + ext4_msg(sb, KERN_ERR,
3659 + "not enough memory for %d flex groups", size);
3660 +diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
3661 +index 5d6fd940aab2..ec9a1f9ce2dd 100644
3662 +--- a/fs/f2fs/data.c
3663 ++++ b/fs/f2fs/data.c
3664 +@@ -3030,7 +3030,8 @@ int f2fs_migrate_page(struct address_space *mapping,
3665 +
3666 + #ifdef CONFIG_SWAP
3667 + /* Copied from generic_swapfile_activate() to check any holes */
3668 +-static int check_swap_activate(struct file *swap_file, unsigned int max)
3669 ++static int check_swap_activate(struct swap_info_struct *sis,
3670 ++ struct file *swap_file, sector_t *span)
3671 + {
3672 + struct address_space *mapping = swap_file->f_mapping;
3673 + struct inode *inode = mapping->host;
3674 +@@ -3041,6 +3042,8 @@ static int check_swap_activate(struct file *swap_file, unsigned int max)
3675 + sector_t last_block;
3676 + sector_t lowest_block = -1;
3677 + sector_t highest_block = 0;
3678 ++ int nr_extents = 0;
3679 ++ int ret;
3680 +
3681 + blkbits = inode->i_blkbits;
3682 + blocks_per_page = PAGE_SIZE >> blkbits;
3683 +@@ -3052,7 +3055,8 @@ static int check_swap_activate(struct file *swap_file, unsigned int max)
3684 + probe_block = 0;
3685 + page_no = 0;
3686 + last_block = i_size_read(inode) >> blkbits;
3687 +- while ((probe_block + blocks_per_page) <= last_block && page_no < max) {
3688 ++ while ((probe_block + blocks_per_page) <= last_block &&
3689 ++ page_no < sis->max) {
3690 + unsigned block_in_page;
3691 + sector_t first_block;
3692 +
3693 +@@ -3092,13 +3096,27 @@ static int check_swap_activate(struct file *swap_file, unsigned int max)
3694 + highest_block = first_block;
3695 + }
3696 +
3697 ++ /*
3698 ++ * We found a PAGE_SIZE-length, PAGE_SIZE-aligned run of blocks
3699 ++ */
3700 ++ ret = add_swap_extent(sis, page_no, 1, first_block);
3701 ++ if (ret < 0)
3702 ++ goto out;
3703 ++ nr_extents += ret;
3704 + page_no++;
3705 + probe_block += blocks_per_page;
3706 + reprobe:
3707 + continue;
3708 + }
3709 +- return 0;
3710 +-
3711 ++ ret = nr_extents;
3712 ++ *span = 1 + highest_block - lowest_block;
3713 ++ if (page_no == 0)
3714 ++ page_no = 1; /* force Empty message */
3715 ++ sis->max = page_no;
3716 ++ sis->pages = page_no - 1;
3717 ++ sis->highest_bit = page_no - 1;
3718 ++out:
3719 ++ return ret;
3720 + bad_bmap:
3721 + pr_err("swapon: swapfile has holes\n");
3722 + return -EINVAL;
3723 +@@ -3120,14 +3138,14 @@ static int f2fs_swap_activate(struct swap_info_struct *sis, struct file *file,
3724 + if (ret)
3725 + return ret;
3726 +
3727 +- ret = check_swap_activate(file, sis->max);
3728 +- if (ret)
3729 ++ ret = check_swap_activate(sis, file, span);
3730 ++ if (ret < 0)
3731 + return ret;
3732 +
3733 + set_inode_flag(inode, FI_PIN_FILE);
3734 + f2fs_precache_extents(inode);
3735 + f2fs_update_time(F2FS_I_SB(inode), REQ_TIME);
3736 +- return 0;
3737 ++ return ret;
3738 + }
3739 +
3740 + static void f2fs_swap_deactivate(struct file *file)
3741 +diff --git a/fs/io_uring.c b/fs/io_uring.c
3742 +index ed9a551882cf..e37b84146453 100644
3743 +--- a/fs/io_uring.c
3744 ++++ b/fs/io_uring.c
3745 +@@ -71,6 +71,7 @@
3746 + #include <linux/sizes.h>
3747 + #include <linux/hugetlb.h>
3748 + #include <linux/highmem.h>
3749 ++#include <linux/fs_struct.h>
3750 +
3751 + #include <uapi/linux/io_uring.h>
3752 +
3753 +@@ -334,6 +335,8 @@ struct io_kiocb {
3754 + u32 result;
3755 + u32 sequence;
3756 +
3757 ++ struct fs_struct *fs;
3758 ++
3759 + struct work_struct work;
3760 + };
3761 +
3762 +@@ -651,6 +654,7 @@ static struct io_kiocb *io_get_req(struct io_ring_ctx *ctx,
3763 + /* one is dropped after submission, the other at completion */
3764 + refcount_set(&req->refs, 2);
3765 + req->result = 0;
3766 ++ req->fs = NULL;
3767 + return req;
3768 + out:
3769 + percpu_ref_put(&ctx->refs);
3770 +@@ -1653,6 +1657,11 @@ static int io_send_recvmsg(struct io_kiocb *req, const struct io_uring_sqe *sqe,
3771 + else if (force_nonblock)
3772 + flags |= MSG_DONTWAIT;
3773 +
3774 ++#ifdef CONFIG_COMPAT
3775 ++ if (req->ctx->compat)
3776 ++ flags |= MSG_CMSG_COMPAT;
3777 ++#endif
3778 ++
3779 + msg = (struct user_msghdr __user *) (unsigned long)
3780 + READ_ONCE(sqe->addr);
3781 +
3782 +@@ -1663,6 +1672,16 @@ static int io_send_recvmsg(struct io_kiocb *req, const struct io_uring_sqe *sqe,
3783 + ret = -EINTR;
3784 + }
3785 +
3786 ++ if (req->fs) {
3787 ++ struct fs_struct *fs = req->fs;
3788 ++
3789 ++ spin_lock(&req->fs->lock);
3790 ++ if (--fs->users)
3791 ++ fs = NULL;
3792 ++ spin_unlock(&req->fs->lock);
3793 ++ if (fs)
3794 ++ free_fs_struct(fs);
3795 ++ }
3796 + io_cqring_add_event(req->ctx, sqe->user_data, ret);
3797 + io_put_req(req);
3798 + return 0;
3799 +@@ -2159,6 +2178,7 @@ static inline bool io_sqe_needs_user(const struct io_uring_sqe *sqe)
3800 + static void io_sq_wq_submit_work(struct work_struct *work)
3801 + {
3802 + struct io_kiocb *req = container_of(work, struct io_kiocb, work);
3803 ++ struct fs_struct *old_fs_struct = current->fs;
3804 + struct io_ring_ctx *ctx = req->ctx;
3805 + struct mm_struct *cur_mm = NULL;
3806 + struct async_list *async_list;
3807 +@@ -2178,6 +2198,15 @@ restart:
3808 + /* Ensure we clear previously set non-block flag */
3809 + req->rw.ki_flags &= ~IOCB_NOWAIT;
3810 +
3811 ++ if (req->fs != current->fs && current->fs != old_fs_struct) {
3812 ++ task_lock(current);
3813 ++ if (req->fs)
3814 ++ current->fs = req->fs;
3815 ++ else
3816 ++ current->fs = old_fs_struct;
3817 ++ task_unlock(current);
3818 ++ }
3819 ++
3820 + ret = 0;
3821 + if (io_sqe_needs_user(sqe) && !cur_mm) {
3822 + if (!mmget_not_zero(ctx->sqo_mm)) {
3823 +@@ -2276,6 +2305,11 @@ out:
3824 + mmput(cur_mm);
3825 + }
3826 + revert_creds(old_cred);
3827 ++ if (old_fs_struct) {
3828 ++ task_lock(current);
3829 ++ current->fs = old_fs_struct;
3830 ++ task_unlock(current);
3831 ++ }
3832 + }
3833 +
3834 + /*
3835 +@@ -2503,6 +2537,23 @@ err:
3836 +
3837 + req->user_data = s->sqe->user_data;
3838 +
3839 ++#if defined(CONFIG_NET)
3840 ++ switch (READ_ONCE(s->sqe->opcode)) {
3841 ++ case IORING_OP_SENDMSG:
3842 ++ case IORING_OP_RECVMSG:
3843 ++ spin_lock(&current->fs->lock);
3844 ++ if (!current->fs->in_exec) {
3845 ++ req->fs = current->fs;
3846 ++ req->fs->users++;
3847 ++ }
3848 ++ spin_unlock(&current->fs->lock);
3849 ++ if (!req->fs) {
3850 ++ ret = -EAGAIN;
3851 ++ goto err_req;
3852 ++ }
3853 ++ }
3854 ++#endif
3855 ++
3856 + /*
3857 + * If we already have a head request, queue this one for async
3858 + * submittal once the head completes. If we don't have a head but
3859 +diff --git a/fs/namei.c b/fs/namei.c
3860 +index bd1c0ca4151c..5b5759d70822 100644
3861 +--- a/fs/namei.c
3862 ++++ b/fs/namei.c
3863 +@@ -1360,7 +1360,7 @@ static int follow_dotdot_rcu(struct nameidata *nd)
3864 + nd->path.dentry = parent;
3865 + nd->seq = seq;
3866 + if (unlikely(!path_connected(&nd->path)))
3867 +- return -ENOENT;
3868 ++ return -ECHILD;
3869 + break;
3870 + } else {
3871 + struct mount *mnt = real_mount(nd->path.mnt);
3872 +diff --git a/fs/nfs/nfs4file.c b/fs/nfs/nfs4file.c
3873 +index 339663d04bf8..54f1c1f626fc 100644
3874 +--- a/fs/nfs/nfs4file.c
3875 ++++ b/fs/nfs/nfs4file.c
3876 +@@ -86,7 +86,6 @@ nfs4_file_open(struct inode *inode, struct file *filp)
3877 + if (inode != d_inode(dentry))
3878 + goto out_drop;
3879 +
3880 +- nfs_set_verifier(dentry, nfs_save_change_attribute(dir));
3881 + nfs_file_set_open_context(filp, ctx);
3882 + nfs_fscache_open_file(inode, filp);
3883 + err = 0;
3884 +diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
3885 +index f808fb34b110..6b29703d2fe1 100644
3886 +--- a/fs/nfs/nfs4proc.c
3887 ++++ b/fs/nfs/nfs4proc.c
3888 +@@ -2962,10 +2962,13 @@ static int _nfs4_open_and_get_state(struct nfs4_opendata *opendata,
3889 + struct dentry *dentry;
3890 + struct nfs4_state *state;
3891 + fmode_t acc_mode = _nfs4_ctx_to_accessmode(ctx);
3892 ++ struct inode *dir = d_inode(opendata->dir);
3893 ++ unsigned long dir_verifier;
3894 + unsigned int seq;
3895 + int ret;
3896 +
3897 + seq = raw_seqcount_begin(&sp->so_reclaim_seqcount);
3898 ++ dir_verifier = nfs_save_change_attribute(dir);
3899 +
3900 + ret = _nfs4_proc_open(opendata, ctx);
3901 + if (ret != 0)
3902 +@@ -2993,8 +2996,19 @@ static int _nfs4_open_and_get_state(struct nfs4_opendata *opendata,
3903 + dput(ctx->dentry);
3904 + ctx->dentry = dentry = alias;
3905 + }
3906 +- nfs_set_verifier(dentry,
3907 +- nfs_save_change_attribute(d_inode(opendata->dir)));
3908 ++ }
3909 ++
3910 ++ switch(opendata->o_arg.claim) {
3911 ++ default:
3912 ++ break;
3913 ++ case NFS4_OPEN_CLAIM_NULL:
3914 ++ case NFS4_OPEN_CLAIM_DELEGATE_CUR:
3915 ++ case NFS4_OPEN_CLAIM_DELEGATE_PREV:
3916 ++ if (!opendata->rpc_done)
3917 ++ break;
3918 ++ if (opendata->o_res.delegation_type != 0)
3919 ++ dir_verifier = nfs_save_change_attribute(dir);
3920 ++ nfs_set_verifier(dentry, dir_verifier);
3921 + }
3922 +
3923 + /* Parse layoutget results before we check for access */
3924 +diff --git a/fs/ubifs/orphan.c b/fs/ubifs/orphan.c
3925 +index 54d6db61106f..edf43ddd7dce 100644
3926 +--- a/fs/ubifs/orphan.c
3927 ++++ b/fs/ubifs/orphan.c
3928 +@@ -129,7 +129,7 @@ static void __orphan_drop(struct ubifs_info *c, struct ubifs_orphan *o)
3929 + static void orphan_delete(struct ubifs_info *c, struct ubifs_orphan *orph)
3930 + {
3931 + if (orph->del) {
3932 +- dbg_gen("deleted twice ino %lu", orph->inum);
3933 ++ dbg_gen("deleted twice ino %lu", (unsigned long)orph->inum);
3934 + return;
3935 + }
3936 +
3937 +@@ -137,7 +137,7 @@ static void orphan_delete(struct ubifs_info *c, struct ubifs_orphan *orph)
3938 + orph->del = 1;
3939 + orph->dnext = c->orph_dnext;
3940 + c->orph_dnext = orph;
3941 +- dbg_gen("delete later ino %lu", orph->inum);
3942 ++ dbg_gen("delete later ino %lu", (unsigned long)orph->inum);
3943 + return;
3944 + }
3945 +
3946 +diff --git a/fs/xfs/libxfs/xfs_attr.h b/fs/xfs/libxfs/xfs_attr.h
3947 +index 94badfa1743e..91c2cb14276e 100644
3948 +--- a/fs/xfs/libxfs/xfs_attr.h
3949 ++++ b/fs/xfs/libxfs/xfs_attr.h
3950 +@@ -26,7 +26,7 @@ struct xfs_attr_list_context;
3951 + *========================================================================*/
3952 +
3953 +
3954 +-#define ATTR_DONTFOLLOW 0x0001 /* -- unused, from IRIX -- */
3955 ++#define ATTR_DONTFOLLOW 0x0001 /* -- ignored, from IRIX -- */
3956 + #define ATTR_ROOT 0x0002 /* use attrs in root (trusted) namespace */
3957 + #define ATTR_TRUST 0x0004 /* -- unused, from IRIX -- */
3958 + #define ATTR_SECURE 0x0008 /* use attrs in security namespace */
3959 +@@ -37,7 +37,10 @@ struct xfs_attr_list_context;
3960 + #define ATTR_KERNOVAL 0x2000 /* [kernel] get attr size only, not value */
3961 +
3962 + #define ATTR_INCOMPLETE 0x4000 /* [kernel] return INCOMPLETE attr keys */
3963 +-#define ATTR_ALLOC 0x8000 /* allocate xattr buffer on demand */
3964 ++#define ATTR_ALLOC 0x8000 /* [kernel] allocate xattr buffer on demand */
3965 ++
3966 ++#define ATTR_KERNEL_FLAGS \
3967 ++ (ATTR_KERNOTIME | ATTR_KERNOVAL | ATTR_INCOMPLETE | ATTR_ALLOC)
3968 +
3969 + #define XFS_ATTR_FLAGS \
3970 + { ATTR_DONTFOLLOW, "DONTFOLLOW" }, \
3971 +diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c
3972 +index d58f0d6a699e..2a1909397cb4 100644
3973 +--- a/fs/xfs/xfs_ioctl.c
3974 ++++ b/fs/xfs/xfs_ioctl.c
3975 +@@ -536,6 +536,8 @@ xfs_attrmulti_by_handle(
3976 +
3977 + error = 0;
3978 + for (i = 0; i < am_hreq.opcount; i++) {
3979 ++ ops[i].am_flags &= ~ATTR_KERNEL_FLAGS;
3980 ++
3981 + ops[i].am_error = strncpy_from_user((char *)attr_name,
3982 + ops[i].am_attrname, MAXNAMELEN);
3983 + if (ops[i].am_error == 0 || ops[i].am_error == MAXNAMELEN)
3984 +diff --git a/fs/xfs/xfs_ioctl32.c b/fs/xfs/xfs_ioctl32.c
3985 +index 1e08bf79b478..e61cc41189f8 100644
3986 +--- a/fs/xfs/xfs_ioctl32.c
3987 ++++ b/fs/xfs/xfs_ioctl32.c
3988 +@@ -450,6 +450,8 @@ xfs_compat_attrmulti_by_handle(
3989 +
3990 + error = 0;
3991 + for (i = 0; i < am_hreq.opcount; i++) {
3992 ++ ops[i].am_flags &= ~ATTR_KERNEL_FLAGS;
3993 ++
3994 + ops[i].am_error = strncpy_from_user((char *)attr_name,
3995 + compat_ptr(ops[i].am_attrname),
3996 + MAXNAMELEN);
3997 +diff --git a/include/Kbuild b/include/Kbuild
3998 +deleted file mode 100644
3999 +index ffba79483cc5..000000000000
4000 +--- a/include/Kbuild
4001 ++++ /dev/null
4002 +@@ -1,1185 +0,0 @@
4003 +-# SPDX-License-Identifier: GPL-2.0-only
4004 +-
4005 +-# Add header-test-$(CONFIG_...) guard to headers that are only compiled
4006 +-# for particular architectures.
4007 +-#
4008 +-# Headers listed in header-test- are excluded from the test coverage.
4009 +-# Many headers are excluded for now because they fail to build. Please
4010 +-# consider to fix headers first before adding new ones to the blacklist.
4011 +-#
4012 +-# Sorted alphabetically.
4013 +-header-test- += acpi/acbuffer.h
4014 +-header-test- += acpi/acpi.h
4015 +-header-test- += acpi/acpi_bus.h
4016 +-header-test- += acpi/acpi_drivers.h
4017 +-header-test- += acpi/acpi_io.h
4018 +-header-test- += acpi/acpi_lpat.h
4019 +-header-test- += acpi/acpiosxf.h
4020 +-header-test- += acpi/acpixf.h
4021 +-header-test- += acpi/acrestyp.h
4022 +-header-test- += acpi/actbl.h
4023 +-header-test- += acpi/actbl1.h
4024 +-header-test- += acpi/actbl2.h
4025 +-header-test- += acpi/actbl3.h
4026 +-header-test- += acpi/actypes.h
4027 +-header-test- += acpi/battery.h
4028 +-header-test- += acpi/cppc_acpi.h
4029 +-header-test- += acpi/nfit.h
4030 +-header-test- += acpi/platform/acenv.h
4031 +-header-test- += acpi/platform/acenvex.h
4032 +-header-test- += acpi/platform/acintel.h
4033 +-header-test- += acpi/platform/aclinux.h
4034 +-header-test- += acpi/platform/aclinuxex.h
4035 +-header-test- += acpi/processor.h
4036 +-header-test-$(CONFIG_X86) += clocksource/hyperv_timer.h
4037 +-header-test- += clocksource/timer-sp804.h
4038 +-header-test- += crypto/cast_common.h
4039 +-header-test- += crypto/internal/cryptouser.h
4040 +-header-test- += crypto/pkcs7.h
4041 +-header-test- += crypto/poly1305.h
4042 +-header-test- += crypto/sha3.h
4043 +-header-test- += drm/ati_pcigart.h
4044 +-header-test- += drm/bridge/dw_hdmi.h
4045 +-header-test- += drm/bridge/dw_mipi_dsi.h
4046 +-header-test- += drm/drm_audio_component.h
4047 +-header-test- += drm/drm_auth.h
4048 +-header-test- += drm/drm_debugfs.h
4049 +-header-test- += drm/drm_debugfs_crc.h
4050 +-header-test- += drm/drm_displayid.h
4051 +-header-test- += drm/drm_encoder_slave.h
4052 +-header-test- += drm/drm_fb_cma_helper.h
4053 +-header-test- += drm/drm_fb_helper.h
4054 +-header-test- += drm/drm_fixed.h
4055 +-header-test- += drm/drm_format_helper.h
4056 +-header-test- += drm/drm_lease.h
4057 +-header-test- += drm/drm_legacy.h
4058 +-header-test- += drm/drm_panel.h
4059 +-header-test- += drm/drm_plane_helper.h
4060 +-header-test- += drm/drm_rect.h
4061 +-header-test- += drm/i915_component.h
4062 +-header-test- += drm/intel-gtt.h
4063 +-header-test- += drm/tinydrm/tinydrm-helpers.h
4064 +-header-test- += drm/ttm/ttm_debug.h
4065 +-header-test- += keys/asymmetric-parser.h
4066 +-header-test- += keys/asymmetric-subtype.h
4067 +-header-test- += keys/asymmetric-type.h
4068 +-header-test- += keys/big_key-type.h
4069 +-header-test- += keys/request_key_auth-type.h
4070 +-header-test- += keys/trusted.h
4071 +-header-test- += kvm/arm_arch_timer.h
4072 +-header-test- += kvm/arm_pmu.h
4073 +-header-test-$(CONFIG_ARM) += kvm/arm_psci.h
4074 +-header-test-$(CONFIG_ARM64) += kvm/arm_psci.h
4075 +-header-test- += kvm/arm_vgic.h
4076 +-header-test- += linux/8250_pci.h
4077 +-header-test- += linux/a.out.h
4078 +-header-test- += linux/adxl.h
4079 +-header-test- += linux/agpgart.h
4080 +-header-test- += linux/alcor_pci.h
4081 +-header-test- += linux/amba/clcd.h
4082 +-header-test- += linux/amba/pl080.h
4083 +-header-test- += linux/amd-iommu.h
4084 +-header-test-$(CONFIG_ARM) += linux/arm-cci.h
4085 +-header-test-$(CONFIG_ARM64) += linux/arm-cci.h
4086 +-header-test- += linux/arm_sdei.h
4087 +-header-test- += linux/asn1_decoder.h
4088 +-header-test- += linux/ata_platform.h
4089 +-header-test- += linux/ath9k_platform.h
4090 +-header-test- += linux/atm_tcp.h
4091 +-header-test- += linux/atomic-fallback.h
4092 +-header-test- += linux/avf/virtchnl.h
4093 +-header-test- += linux/bcm47xx_sprom.h
4094 +-header-test- += linux/bcma/bcma_driver_gmac_cmn.h
4095 +-header-test- += linux/bcma/bcma_driver_mips.h
4096 +-header-test- += linux/bcma/bcma_driver_pci.h
4097 +-header-test- += linux/bcma/bcma_driver_pcie2.h
4098 +-header-test- += linux/bit_spinlock.h
4099 +-header-test- += linux/blk-mq-rdma.h
4100 +-header-test- += linux/blk-mq.h
4101 +-header-test- += linux/blktrace_api.h
4102 +-header-test- += linux/blockgroup_lock.h
4103 +-header-test- += linux/bma150.h
4104 +-header-test- += linux/bpf_lirc.h
4105 +-header-test- += linux/bpf_types.h
4106 +-header-test- += linux/bsg-lib.h
4107 +-header-test- += linux/bsg.h
4108 +-header-test- += linux/btf.h
4109 +-header-test- += linux/btree-128.h
4110 +-header-test- += linux/btree-type.h
4111 +-header-test-$(CONFIG_CPU_BIG_ENDIAN) += linux/byteorder/big_endian.h
4112 +-header-test- += linux/byteorder/generic.h
4113 +-header-test-$(CONFIG_CPU_LITTLE_ENDIAN) += linux/byteorder/little_endian.h
4114 +-header-test- += linux/c2port.h
4115 +-header-test- += linux/can/dev/peak_canfd.h
4116 +-header-test- += linux/can/platform/cc770.h
4117 +-header-test- += linux/can/platform/sja1000.h
4118 +-header-test- += linux/ceph/ceph_features.h
4119 +-header-test- += linux/ceph/ceph_frag.h
4120 +-header-test- += linux/ceph/ceph_fs.h
4121 +-header-test- += linux/ceph/debugfs.h
4122 +-header-test- += linux/ceph/msgr.h
4123 +-header-test- += linux/ceph/rados.h
4124 +-header-test- += linux/cgroup_subsys.h
4125 +-header-test- += linux/clk/sunxi-ng.h
4126 +-header-test- += linux/clk/ti.h
4127 +-header-test- += linux/cn_proc.h
4128 +-header-test- += linux/coda_psdev.h
4129 +-header-test- += linux/compaction.h
4130 +-header-test- += linux/console_struct.h
4131 +-header-test- += linux/count_zeros.h
4132 +-header-test- += linux/cs5535.h
4133 +-header-test- += linux/cuda.h
4134 +-header-test- += linux/cyclades.h
4135 +-header-test- += linux/dcookies.h
4136 +-header-test- += linux/delayacct.h
4137 +-header-test- += linux/delayed_call.h
4138 +-header-test- += linux/device-mapper.h
4139 +-header-test- += linux/devpts_fs.h
4140 +-header-test- += linux/dio.h
4141 +-header-test- += linux/dirent.h
4142 +-header-test- += linux/dlm_plock.h
4143 +-header-test- += linux/dm-dirty-log.h
4144 +-header-test- += linux/dm-region-hash.h
4145 +-header-test- += linux/dma-debug.h
4146 +-header-test- += linux/dma/mmp-pdma.h
4147 +-header-test- += linux/dma/sprd-dma.h
4148 +-header-test- += linux/dns_resolver.h
4149 +-header-test- += linux/drbd_genl.h
4150 +-header-test- += linux/drbd_genl_api.h
4151 +-header-test- += linux/dw_apb_timer.h
4152 +-header-test- += linux/dynamic_debug.h
4153 +-header-test- += linux/dynamic_queue_limits.h
4154 +-header-test- += linux/ecryptfs.h
4155 +-header-test- += linux/edma.h
4156 +-header-test- += linux/eeprom_93cx6.h
4157 +-header-test- += linux/efs_vh.h
4158 +-header-test- += linux/elevator.h
4159 +-header-test- += linux/elfcore-compat.h
4160 +-header-test- += linux/error-injection.h
4161 +-header-test- += linux/errseq.h
4162 +-header-test- += linux/eventpoll.h
4163 +-header-test- += linux/ext2_fs.h
4164 +-header-test- += linux/f75375s.h
4165 +-header-test- += linux/falloc.h
4166 +-header-test- += linux/fault-inject.h
4167 +-header-test- += linux/fbcon.h
4168 +-header-test- += linux/firmware/intel/stratix10-svc-client.h
4169 +-header-test- += linux/firmware/meson/meson_sm.h
4170 +-header-test- += linux/firmware/trusted_foundations.h
4171 +-header-test- += linux/firmware/xlnx-zynqmp.h
4172 +-header-test- += linux/fixp-arith.h
4173 +-header-test- += linux/flat.h
4174 +-header-test- += linux/fs_types.h
4175 +-header-test- += linux/fs_uart_pd.h
4176 +-header-test- += linux/fsi-occ.h
4177 +-header-test- += linux/fsi-sbefifo.h
4178 +-header-test- += linux/fsl/bestcomm/ata.h
4179 +-header-test- += linux/fsl/bestcomm/bestcomm.h
4180 +-header-test- += linux/fsl/bestcomm/bestcomm_priv.h
4181 +-header-test- += linux/fsl/bestcomm/fec.h
4182 +-header-test- += linux/fsl/bestcomm/gen_bd.h
4183 +-header-test- += linux/fsl/bestcomm/sram.h
4184 +-header-test- += linux/fsl_hypervisor.h
4185 +-header-test- += linux/fsldma.h
4186 +-header-test- += linux/ftrace_irq.h
4187 +-header-test- += linux/gameport.h
4188 +-header-test- += linux/genl_magic_func.h
4189 +-header-test- += linux/genl_magic_struct.h
4190 +-header-test- += linux/gpio/aspeed.h
4191 +-header-test- += linux/gpio/gpio-reg.h
4192 +-header-test- += linux/hid-debug.h
4193 +-header-test- += linux/hiddev.h
4194 +-header-test- += linux/hippidevice.h
4195 +-header-test- += linux/hmm.h
4196 +-header-test- += linux/hp_sdc.h
4197 +-header-test- += linux/huge_mm.h
4198 +-header-test- += linux/hugetlb_cgroup.h
4199 +-header-test- += linux/hugetlb_inline.h
4200 +-header-test- += linux/hwmon-vid.h
4201 +-header-test- += linux/hyperv.h
4202 +-header-test- += linux/i2c-algo-pca.h
4203 +-header-test- += linux/i2c-algo-pcf.h
4204 +-header-test- += linux/i3c/ccc.h
4205 +-header-test- += linux/i3c/device.h
4206 +-header-test- += linux/i3c/master.h
4207 +-header-test- += linux/i8042.h
4208 +-header-test- += linux/ide.h
4209 +-header-test- += linux/idle_inject.h
4210 +-header-test- += linux/if_frad.h
4211 +-header-test- += linux/if_rmnet.h
4212 +-header-test- += linux/if_tap.h
4213 +-header-test- += linux/iio/accel/kxcjk_1013.h
4214 +-header-test- += linux/iio/adc/ad_sigma_delta.h
4215 +-header-test- += linux/iio/buffer-dma.h
4216 +-header-test- += linux/iio/buffer_impl.h
4217 +-header-test- += linux/iio/common/st_sensors.h
4218 +-header-test- += linux/iio/common/st_sensors_i2c.h
4219 +-header-test- += linux/iio/common/st_sensors_spi.h
4220 +-header-test- += linux/iio/dac/ad5421.h
4221 +-header-test- += linux/iio/dac/ad5504.h
4222 +-header-test- += linux/iio/dac/ad5791.h
4223 +-header-test- += linux/iio/dac/max517.h
4224 +-header-test- += linux/iio/dac/mcp4725.h
4225 +-header-test- += linux/iio/frequency/ad9523.h
4226 +-header-test- += linux/iio/frequency/adf4350.h
4227 +-header-test- += linux/iio/hw-consumer.h
4228 +-header-test- += linux/iio/imu/adis.h
4229 +-header-test- += linux/iio/sysfs.h
4230 +-header-test- += linux/iio/timer/stm32-timer-trigger.h
4231 +-header-test- += linux/iio/trigger.h
4232 +-header-test- += linux/iio/triggered_event.h
4233 +-header-test- += linux/imx-media.h
4234 +-header-test- += linux/inet_diag.h
4235 +-header-test- += linux/init_ohci1394_dma.h
4236 +-header-test- += linux/initrd.h
4237 +-header-test- += linux/input/adp5589.h
4238 +-header-test- += linux/input/bu21013.h
4239 +-header-test- += linux/input/cma3000.h
4240 +-header-test- += linux/input/kxtj9.h
4241 +-header-test- += linux/input/lm8333.h
4242 +-header-test- += linux/input/sparse-keymap.h
4243 +-header-test- += linux/input/touchscreen.h
4244 +-header-test- += linux/input/tps6507x-ts.h
4245 +-header-test-$(CONFIG_X86) += linux/intel-iommu.h
4246 +-header-test- += linux/intel-ish-client-if.h
4247 +-header-test- += linux/intel-pti.h
4248 +-header-test- += linux/intel-svm.h
4249 +-header-test- += linux/interconnect-provider.h
4250 +-header-test- += linux/ioc3.h
4251 +-header-test-$(CONFIG_BLOCK) += linux/iomap.h
4252 +-header-test- += linux/ipack.h
4253 +-header-test- += linux/irq_cpustat.h
4254 +-header-test- += linux/irq_poll.h
4255 +-header-test- += linux/irqchip/arm-gic-v3.h
4256 +-header-test- += linux/irqchip/arm-gic-v4.h
4257 +-header-test- += linux/irqchip/irq-madera.h
4258 +-header-test- += linux/irqchip/irq-sa11x0.h
4259 +-header-test- += linux/irqchip/mxs.h
4260 +-header-test- += linux/irqchip/versatile-fpga.h
4261 +-header-test- += linux/irqdesc.h
4262 +-header-test- += linux/irqflags.h
4263 +-header-test- += linux/iscsi_boot_sysfs.h
4264 +-header-test- += linux/isdn/capiutil.h
4265 +-header-test- += linux/isdn/hdlc.h
4266 +-header-test- += linux/isdn_ppp.h
4267 +-header-test- += linux/jbd2.h
4268 +-header-test- += linux/jump_label.h
4269 +-header-test- += linux/jump_label_ratelimit.h
4270 +-header-test- += linux/jz4740-adc.h
4271 +-header-test- += linux/kasan.h
4272 +-header-test- += linux/kcore.h
4273 +-header-test- += linux/kdev_t.h
4274 +-header-test- += linux/kernelcapi.h
4275 +-header-test- += linux/khugepaged.h
4276 +-header-test- += linux/kobj_map.h
4277 +-header-test- += linux/kobject_ns.h
4278 +-header-test- += linux/kvm_host.h
4279 +-header-test- += linux/kvm_irqfd.h
4280 +-header-test- += linux/kvm_para.h
4281 +-header-test- += linux/lantiq.h
4282 +-header-test- += linux/lapb.h
4283 +-header-test- += linux/latencytop.h
4284 +-header-test- += linux/led-lm3530.h
4285 +-header-test- += linux/leds-bd2802.h
4286 +-header-test- += linux/leds-lp3944.h
4287 +-header-test- += linux/leds-lp3952.h
4288 +-header-test- += linux/leds_pwm.h
4289 +-header-test- += linux/libata.h
4290 +-header-test- += linux/license.h
4291 +-header-test- += linux/lightnvm.h
4292 +-header-test- += linux/lis3lv02d.h
4293 +-header-test- += linux/list_bl.h
4294 +-header-test- += linux/list_lru.h
4295 +-header-test- += linux/list_nulls.h
4296 +-header-test- += linux/lockd/share.h
4297 +-header-test- += linux/lzo.h
4298 +-header-test- += linux/mailbox/zynqmp-ipi-message.h
4299 +-header-test- += linux/maple.h
4300 +-header-test- += linux/mbcache.h
4301 +-header-test- += linux/mbus.h
4302 +-header-test- += linux/mc146818rtc.h
4303 +-header-test- += linux/mc6821.h
4304 +-header-test- += linux/mdev.h
4305 +-header-test- += linux/mem_encrypt.h
4306 +-header-test- += linux/memfd.h
4307 +-header-test- += linux/mfd/88pm80x.h
4308 +-header-test- += linux/mfd/88pm860x.h
4309 +-header-test- += linux/mfd/abx500/ab8500-bm.h
4310 +-header-test- += linux/mfd/abx500/ab8500-gpadc.h
4311 +-header-test- += linux/mfd/adp5520.h
4312 +-header-test- += linux/mfd/arizona/pdata.h
4313 +-header-test- += linux/mfd/as3711.h
4314 +-header-test- += linux/mfd/as3722.h
4315 +-header-test- += linux/mfd/da903x.h
4316 +-header-test- += linux/mfd/da9055/pdata.h
4317 +-header-test- += linux/mfd/db8500-prcmu.h
4318 +-header-test- += linux/mfd/dbx500-prcmu.h
4319 +-header-test- += linux/mfd/dln2.h
4320 +-header-test- += linux/mfd/dm355evm_msp.h
4321 +-header-test- += linux/mfd/ds1wm.h
4322 +-header-test- += linux/mfd/ezx-pcap.h
4323 +-header-test- += linux/mfd/intel_msic.h
4324 +-header-test- += linux/mfd/janz.h
4325 +-header-test- += linux/mfd/kempld.h
4326 +-header-test- += linux/mfd/lm3533.h
4327 +-header-test- += linux/mfd/lp8788-isink.h
4328 +-header-test- += linux/mfd/lpc_ich.h
4329 +-header-test- += linux/mfd/max77693.h
4330 +-header-test- += linux/mfd/max8998-private.h
4331 +-header-test- += linux/mfd/menelaus.h
4332 +-header-test- += linux/mfd/mt6397/core.h
4333 +-header-test- += linux/mfd/palmas.h
4334 +-header-test- += linux/mfd/pcf50633/backlight.h
4335 +-header-test- += linux/mfd/rc5t583.h
4336 +-header-test- += linux/mfd/retu.h
4337 +-header-test- += linux/mfd/samsung/core.h
4338 +-header-test- += linux/mfd/si476x-platform.h
4339 +-header-test- += linux/mfd/si476x-reports.h
4340 +-header-test- += linux/mfd/sky81452.h
4341 +-header-test- += linux/mfd/smsc.h
4342 +-header-test- += linux/mfd/sta2x11-mfd.h
4343 +-header-test- += linux/mfd/stmfx.h
4344 +-header-test- += linux/mfd/tc3589x.h
4345 +-header-test- += linux/mfd/tc6387xb.h
4346 +-header-test- += linux/mfd/tc6393xb.h
4347 +-header-test- += linux/mfd/tps65090.h
4348 +-header-test- += linux/mfd/tps6586x.h
4349 +-header-test- += linux/mfd/tps65910.h
4350 +-header-test- += linux/mfd/tps80031.h
4351 +-header-test- += linux/mfd/ucb1x00.h
4352 +-header-test- += linux/mfd/viperboard.h
4353 +-header-test- += linux/mfd/wm831x/core.h
4354 +-header-test- += linux/mfd/wm831x/otp.h
4355 +-header-test- += linux/mfd/wm831x/pdata.h
4356 +-header-test- += linux/mfd/wm8994/core.h
4357 +-header-test- += linux/mfd/wm8994/pdata.h
4358 +-header-test- += linux/mlx4/doorbell.h
4359 +-header-test- += linux/mlx4/srq.h
4360 +-header-test- += linux/mlx5/doorbell.h
4361 +-header-test- += linux/mlx5/eq.h
4362 +-header-test- += linux/mlx5/fs_helpers.h
4363 +-header-test- += linux/mlx5/mlx5_ifc.h
4364 +-header-test- += linux/mlx5/mlx5_ifc_fpga.h
4365 +-header-test- += linux/mm-arch-hooks.h
4366 +-header-test- += linux/mm_inline.h
4367 +-header-test- += linux/mmu_context.h
4368 +-header-test- += linux/mpage.h
4369 +-header-test- += linux/mtd/bbm.h
4370 +-header-test- += linux/mtd/cfi.h
4371 +-header-test- += linux/mtd/doc2000.h
4372 +-header-test- += linux/mtd/flashchip.h
4373 +-header-test- += linux/mtd/ftl.h
4374 +-header-test- += linux/mtd/gen_probe.h
4375 +-header-test- += linux/mtd/jedec.h
4376 +-header-test- += linux/mtd/nand_bch.h
4377 +-header-test- += linux/mtd/nand_ecc.h
4378 +-header-test- += linux/mtd/ndfc.h
4379 +-header-test- += linux/mtd/onenand.h
4380 +-header-test- += linux/mtd/pismo.h
4381 +-header-test- += linux/mtd/plat-ram.h
4382 +-header-test- += linux/mtd/spi-nor.h
4383 +-header-test- += linux/mv643xx.h
4384 +-header-test- += linux/mv643xx_eth.h
4385 +-header-test- += linux/mvebu-pmsu.h
4386 +-header-test- += linux/mxm-wmi.h
4387 +-header-test- += linux/n_r3964.h
4388 +-header-test- += linux/ndctl.h
4389 +-header-test- += linux/nfs.h
4390 +-header-test- += linux/nfs_fs_i.h
4391 +-header-test- += linux/nfs_fs_sb.h
4392 +-header-test- += linux/nfs_page.h
4393 +-header-test- += linux/nfs_xdr.h
4394 +-header-test- += linux/nfsacl.h
4395 +-header-test- += linux/nl802154.h
4396 +-header-test- += linux/ns_common.h
4397 +-header-test- += linux/nsc_gpio.h
4398 +-header-test- += linux/ntb_transport.h
4399 +-header-test- += linux/nubus.h
4400 +-header-test- += linux/nvme-fc-driver.h
4401 +-header-test- += linux/nvme-fc.h
4402 +-header-test- += linux/nvme-rdma.h
4403 +-header-test- += linux/nvram.h
4404 +-header-test- += linux/objagg.h
4405 +-header-test- += linux/of_clk.h
4406 +-header-test- += linux/of_net.h
4407 +-header-test- += linux/of_pdt.h
4408 +-header-test- += linux/olpc-ec.h
4409 +-header-test- += linux/omap-dma.h
4410 +-header-test- += linux/omap-dmaengine.h
4411 +-header-test- += linux/omap-gpmc.h
4412 +-header-test- += linux/omap-iommu.h
4413 +-header-test- += linux/omap-mailbox.h
4414 +-header-test- += linux/once.h
4415 +-header-test- += linux/osq_lock.h
4416 +-header-test- += linux/overflow.h
4417 +-header-test- += linux/page-flags-layout.h
4418 +-header-test- += linux/page-isolation.h
4419 +-header-test- += linux/page_ext.h
4420 +-header-test- += linux/page_owner.h
4421 +-header-test- += linux/parport_pc.h
4422 +-header-test- += linux/parser.h
4423 +-header-test- += linux/pci-acpi.h
4424 +-header-test- += linux/pci-dma-compat.h
4425 +-header-test- += linux/pci_hotplug.h
4426 +-header-test- += linux/pda_power.h
4427 +-header-test- += linux/perf/arm_pmu.h
4428 +-header-test- += linux/perf_regs.h
4429 +-header-test- += linux/phy/omap_control_phy.h
4430 +-header-test- += linux/phy/tegra/xusb.h
4431 +-header-test- += linux/phy/ulpi_phy.h
4432 +-header-test- += linux/phy_fixed.h
4433 +-header-test- += linux/pipe_fs_i.h
4434 +-header-test- += linux/pktcdvd.h
4435 +-header-test- += linux/pl320-ipc.h
4436 +-header-test- += linux/pl353-smc.h
4437 +-header-test- += linux/platform_data/ad5449.h
4438 +-header-test- += linux/platform_data/ad5755.h
4439 +-header-test- += linux/platform_data/ad7266.h
4440 +-header-test- += linux/platform_data/ad7291.h
4441 +-header-test- += linux/platform_data/ad7298.h
4442 +-header-test- += linux/platform_data/ad7303.h
4443 +-header-test- += linux/platform_data/ad7791.h
4444 +-header-test- += linux/platform_data/ad7793.h
4445 +-header-test- += linux/platform_data/ad7887.h
4446 +-header-test- += linux/platform_data/adau17x1.h
4447 +-header-test- += linux/platform_data/adp8870.h
4448 +-header-test- += linux/platform_data/ads1015.h
4449 +-header-test- += linux/platform_data/ads7828.h
4450 +-header-test- += linux/platform_data/apds990x.h
4451 +-header-test- += linux/platform_data/arm-ux500-pm.h
4452 +-header-test- += linux/platform_data/asoc-s3c.h
4453 +-header-test- += linux/platform_data/at91_adc.h
4454 +-header-test- += linux/platform_data/ata-pxa.h
4455 +-header-test- += linux/platform_data/atmel.h
4456 +-header-test- += linux/platform_data/bh1770glc.h
4457 +-header-test- += linux/platform_data/brcmfmac.h
4458 +-header-test- += linux/platform_data/cros_ec_commands.h
4459 +-header-test- += linux/platform_data/clk-u300.h
4460 +-header-test- += linux/platform_data/cyttsp4.h
4461 +-header-test- += linux/platform_data/dma-coh901318.h
4462 +-header-test- += linux/platform_data/dma-imx-sdma.h
4463 +-header-test- += linux/platform_data/dma-mcf-edma.h
4464 +-header-test- += linux/platform_data/dma-s3c24xx.h
4465 +-header-test- += linux/platform_data/dmtimer-omap.h
4466 +-header-test- += linux/platform_data/dsa.h
4467 +-header-test- += linux/platform_data/edma.h
4468 +-header-test- += linux/platform_data/elm.h
4469 +-header-test- += linux/platform_data/emif_plat.h
4470 +-header-test- += linux/platform_data/fsa9480.h
4471 +-header-test- += linux/platform_data/g762.h
4472 +-header-test- += linux/platform_data/gpio-ath79.h
4473 +-header-test- += linux/platform_data/gpio-davinci.h
4474 +-header-test- += linux/platform_data/gpio-dwapb.h
4475 +-header-test- += linux/platform_data/gpio-htc-egpio.h
4476 +-header-test- += linux/platform_data/gpmc-omap.h
4477 +-header-test- += linux/platform_data/hsmmc-omap.h
4478 +-header-test- += linux/platform_data/hwmon-s3c.h
4479 +-header-test- += linux/platform_data/i2c-davinci.h
4480 +-header-test- += linux/platform_data/i2c-imx.h
4481 +-header-test- += linux/platform_data/i2c-mux-reg.h
4482 +-header-test- += linux/platform_data/i2c-ocores.h
4483 +-header-test- += linux/platform_data/i2c-xiic.h
4484 +-header-test- += linux/platform_data/intel-spi.h
4485 +-header-test- += linux/platform_data/invensense_mpu6050.h
4486 +-header-test- += linux/platform_data/irda-pxaficp.h
4487 +-header-test- += linux/platform_data/irda-sa11x0.h
4488 +-header-test- += linux/platform_data/itco_wdt.h
4489 +-header-test- += linux/platform_data/jz4740/jz4740_nand.h
4490 +-header-test- += linux/platform_data/keyboard-pxa930_rotary.h
4491 +-header-test- += linux/platform_data/keypad-omap.h
4492 +-header-test- += linux/platform_data/leds-lp55xx.h
4493 +-header-test- += linux/platform_data/leds-omap.h
4494 +-header-test- += linux/platform_data/lp855x.h
4495 +-header-test- += linux/platform_data/lp8727.h
4496 +-header-test- += linux/platform_data/max197.h
4497 +-header-test- += linux/platform_data/max3421-hcd.h
4498 +-header-test- += linux/platform_data/max732x.h
4499 +-header-test- += linux/platform_data/mcs.h
4500 +-header-test- += linux/platform_data/mdio-bcm-unimac.h
4501 +-header-test- += linux/platform_data/mdio-gpio.h
4502 +-header-test- += linux/platform_data/media/si4713.h
4503 +-header-test- += linux/platform_data/mlxreg.h
4504 +-header-test- += linux/platform_data/mmc-omap.h
4505 +-header-test- += linux/platform_data/mmc-sdhci-s3c.h
4506 +-header-test- += linux/platform_data/mmp_audio.h
4507 +-header-test- += linux/platform_data/mtd-orion_nand.h
4508 +-header-test- += linux/platform_data/mv88e6xxx.h
4509 +-header-test- += linux/platform_data/net-cw1200.h
4510 +-header-test- += linux/platform_data/omap-twl4030.h
4511 +-header-test- += linux/platform_data/omapdss.h
4512 +-header-test- += linux/platform_data/pcf857x.h
4513 +-header-test- += linux/platform_data/pixcir_i2c_ts.h
4514 +-header-test- += linux/platform_data/pwm_omap_dmtimer.h
4515 +-header-test- += linux/platform_data/pxa2xx_udc.h
4516 +-header-test- += linux/platform_data/pxa_sdhci.h
4517 +-header-test- += linux/platform_data/remoteproc-omap.h
4518 +-header-test- += linux/platform_data/sa11x0-serial.h
4519 +-header-test- += linux/platform_data/sc18is602.h
4520 +-header-test- += linux/platform_data/sdhci-pic32.h
4521 +-header-test- += linux/platform_data/serial-sccnxp.h
4522 +-header-test- += linux/platform_data/sht3x.h
4523 +-header-test- += linux/platform_data/shtc1.h
4524 +-header-test- += linux/platform_data/si5351.h
4525 +-header-test- += linux/platform_data/sky81452-backlight.h
4526 +-header-test- += linux/platform_data/spi-davinci.h
4527 +-header-test- += linux/platform_data/spi-ep93xx.h
4528 +-header-test- += linux/platform_data/spi-mt65xx.h
4529 +-header-test- += linux/platform_data/st_sensors_pdata.h
4530 +-header-test- += linux/platform_data/ti-sysc.h
4531 +-header-test- += linux/platform_data/timer-ixp4xx.h
4532 +-header-test- += linux/platform_data/touchscreen-s3c2410.h
4533 +-header-test- += linux/platform_data/tsc2007.h
4534 +-header-test- += linux/platform_data/tsl2772.h
4535 +-header-test- += linux/platform_data/uio_pruss.h
4536 +-header-test- += linux/platform_data/usb-davinci.h
4537 +-header-test- += linux/platform_data/usb-ehci-mxc.h
4538 +-header-test- += linux/platform_data/usb-ehci-orion.h
4539 +-header-test- += linux/platform_data/usb-mx2.h
4540 +-header-test- += linux/platform_data/usb-ohci-s3c2410.h
4541 +-header-test- += linux/platform_data/usb-omap.h
4542 +-header-test- += linux/platform_data/usb-s3c2410_udc.h
4543 +-header-test- += linux/platform_data/usb3503.h
4544 +-header-test- += linux/platform_data/ux500_wdt.h
4545 +-header-test- += linux/platform_data/video-clcd-versatile.h
4546 +-header-test- += linux/platform_data/video-imxfb.h
4547 +-header-test- += linux/platform_data/video-pxafb.h
4548 +-header-test- += linux/platform_data/video_s3c.h
4549 +-header-test- += linux/platform_data/voltage-omap.h
4550 +-header-test- += linux/platform_data/x86/apple.h
4551 +-header-test- += linux/platform_data/x86/clk-pmc-atom.h
4552 +-header-test- += linux/platform_data/x86/pmc_atom.h
4553 +-header-test- += linux/platform_data/xtalk-bridge.h
4554 +-header-test- += linux/pm2301_charger.h
4555 +-header-test- += linux/pm_wakeirq.h
4556 +-header-test- += linux/pm_wakeup.h
4557 +-header-test- += linux/pmbus.h
4558 +-header-test- += linux/pmu.h
4559 +-header-test- += linux/posix_acl.h
4560 +-header-test- += linux/posix_acl_xattr.h
4561 +-header-test- += linux/power/ab8500.h
4562 +-header-test- += linux/power/bq27xxx_battery.h
4563 +-header-test- += linux/power/generic-adc-battery.h
4564 +-header-test- += linux/power/jz4740-battery.h
4565 +-header-test- += linux/power/max17042_battery.h
4566 +-header-test- += linux/power/max8903_charger.h
4567 +-header-test- += linux/ppp-comp.h
4568 +-header-test- += linux/pps-gpio.h
4569 +-header-test- += linux/pr.h
4570 +-header-test- += linux/proc_ns.h
4571 +-header-test- += linux/processor.h
4572 +-header-test- += linux/psi.h
4573 +-header-test- += linux/psp-sev.h
4574 +-header-test- += linux/pstore.h
4575 +-header-test- += linux/ptr_ring.h
4576 +-header-test- += linux/ptrace.h
4577 +-header-test- += linux/qcom-geni-se.h
4578 +-header-test- += linux/qed/eth_common.h
4579 +-header-test- += linux/qed/fcoe_common.h
4580 +-header-test- += linux/qed/iscsi_common.h
4581 +-header-test- += linux/qed/iwarp_common.h
4582 +-header-test- += linux/qed/qed_eth_if.h
4583 +-header-test- += linux/qed/qed_fcoe_if.h
4584 +-header-test- += linux/qed/rdma_common.h
4585 +-header-test- += linux/qed/storage_common.h
4586 +-header-test- += linux/qed/tcp_common.h
4587 +-header-test- += linux/qnx6_fs.h
4588 +-header-test- += linux/quicklist.h
4589 +-header-test- += linux/ramfs.h
4590 +-header-test- += linux/range.h
4591 +-header-test- += linux/rcu_node_tree.h
4592 +-header-test- += linux/rculist_bl.h
4593 +-header-test- += linux/rculist_nulls.h
4594 +-header-test- += linux/rcutiny.h
4595 +-header-test- += linux/rcutree.h
4596 +-header-test- += linux/reboot-mode.h
4597 +-header-test- += linux/regulator/fixed.h
4598 +-header-test- += linux/regulator/gpio-regulator.h
4599 +-header-test- += linux/regulator/max8973-regulator.h
4600 +-header-test- += linux/regulator/of_regulator.h
4601 +-header-test- += linux/regulator/tps51632-regulator.h
4602 +-header-test- += linux/regulator/tps62360.h
4603 +-header-test- += linux/regulator/tps6507x.h
4604 +-header-test- += linux/regulator/userspace-consumer.h
4605 +-header-test- += linux/remoteproc/st_slim_rproc.h
4606 +-header-test- += linux/reset/socfpga.h
4607 +-header-test- += linux/reset/sunxi.h
4608 +-header-test- += linux/rtc/m48t59.h
4609 +-header-test- += linux/rtc/rtc-omap.h
4610 +-header-test- += linux/rtc/sirfsoc_rtciobrg.h
4611 +-header-test- += linux/rwlock.h
4612 +-header-test- += linux/rwlock_types.h
4613 +-header-test- += linux/scc.h
4614 +-header-test- += linux/sched/deadline.h
4615 +-header-test- += linux/sched/smt.h
4616 +-header-test- += linux/sched/sysctl.h
4617 +-header-test- += linux/sched_clock.h
4618 +-header-test- += linux/scpi_protocol.h
4619 +-header-test- += linux/scx200_gpio.h
4620 +-header-test- += linux/seccomp.h
4621 +-header-test- += linux/sed-opal.h
4622 +-header-test- += linux/seg6_iptunnel.h
4623 +-header-test- += linux/selection.h
4624 +-header-test- += linux/set_memory.h
4625 +-header-test- += linux/shrinker.h
4626 +-header-test- += linux/sirfsoc_dma.h
4627 +-header-test- += linux/skb_array.h
4628 +-header-test- += linux/slab_def.h
4629 +-header-test- += linux/slub_def.h
4630 +-header-test- += linux/sm501.h
4631 +-header-test- += linux/smc91x.h
4632 +-header-test- += linux/static_key.h
4633 +-header-test- += linux/soc/actions/owl-sps.h
4634 +-header-test- += linux/soc/amlogic/meson-canvas.h
4635 +-header-test- += linux/soc/brcmstb/brcmstb.h
4636 +-header-test- += linux/soc/ixp4xx/npe.h
4637 +-header-test- += linux/soc/mediatek/infracfg.h
4638 +-header-test- += linux/soc/qcom/smd-rpm.h
4639 +-header-test- += linux/soc/qcom/smem.h
4640 +-header-test- += linux/soc/qcom/smem_state.h
4641 +-header-test- += linux/soc/qcom/wcnss_ctrl.h
4642 +-header-test- += linux/soc/renesas/rcar-rst.h
4643 +-header-test- += linux/soc/samsung/exynos-pmu.h
4644 +-header-test- += linux/soc/sunxi/sunxi_sram.h
4645 +-header-test- += linux/soc/ti/ti-msgmgr.h
4646 +-header-test- += linux/soc/ti/ti_sci_inta_msi.h
4647 +-header-test- += linux/soc/ti/ti_sci_protocol.h
4648 +-header-test- += linux/soundwire/sdw.h
4649 +-header-test- += linux/soundwire/sdw_intel.h
4650 +-header-test- += linux/soundwire/sdw_type.h
4651 +-header-test- += linux/spi/ad7877.h
4652 +-header-test- += linux/spi/ads7846.h
4653 +-header-test- += linux/spi/at86rf230.h
4654 +-header-test- += linux/spi/ds1305.h
4655 +-header-test- += linux/spi/libertas_spi.h
4656 +-header-test- += linux/spi/lms283gf05.h
4657 +-header-test- += linux/spi/max7301.h
4658 +-header-test- += linux/spi/mcp23s08.h
4659 +-header-test- += linux/spi/rspi.h
4660 +-header-test- += linux/spi/s3c24xx.h
4661 +-header-test- += linux/spi/sh_msiof.h
4662 +-header-test- += linux/spi/spi-fsl-dspi.h
4663 +-header-test- += linux/spi/spi_bitbang.h
4664 +-header-test- += linux/spi/spi_gpio.h
4665 +-header-test- += linux/spi/xilinx_spi.h
4666 +-header-test- += linux/spinlock_api_smp.h
4667 +-header-test- += linux/spinlock_api_up.h
4668 +-header-test- += linux/spinlock_types.h
4669 +-header-test- += linux/splice.h
4670 +-header-test- += linux/sram.h
4671 +-header-test- += linux/srcutiny.h
4672 +-header-test- += linux/srcutree.h
4673 +-header-test- += linux/ssb/ssb_driver_chipcommon.h
4674 +-header-test- += linux/ssb/ssb_driver_extif.h
4675 +-header-test- += linux/ssb/ssb_driver_mips.h
4676 +-header-test- += linux/ssb/ssb_driver_pci.h
4677 +-header-test- += linux/ssbi.h
4678 +-header-test- += linux/stackdepot.h
4679 +-header-test- += linux/stmp3xxx_rtc_wdt.h
4680 +-header-test- += linux/string_helpers.h
4681 +-header-test- += linux/sungem_phy.h
4682 +-header-test- += linux/sunrpc/msg_prot.h
4683 +-header-test- += linux/sunrpc/rpc_pipe_fs.h
4684 +-header-test- += linux/sunrpc/xprtmultipath.h
4685 +-header-test- += linux/sunrpc/xprtsock.h
4686 +-header-test- += linux/sunxi-rsb.h
4687 +-header-test- += linux/svga.h
4688 +-header-test- += linux/sw842.h
4689 +-header-test- += linux/swapfile.h
4690 +-header-test- += linux/swapops.h
4691 +-header-test- += linux/swiotlb.h
4692 +-header-test- += linux/sysv_fs.h
4693 +-header-test- += linux/t10-pi.h
4694 +-header-test- += linux/task_io_accounting.h
4695 +-header-test- += linux/tick.h
4696 +-header-test- += linux/timb_dma.h
4697 +-header-test- += linux/timekeeping.h
4698 +-header-test- += linux/timekeeping32.h
4699 +-header-test- += linux/ts-nbus.h
4700 +-header-test- += linux/tsacct_kern.h
4701 +-header-test- += linux/tty_flip.h
4702 +-header-test- += linux/tty_ldisc.h
4703 +-header-test- += linux/ucb1400.h
4704 +-header-test- += linux/usb/association.h
4705 +-header-test- += linux/usb/cdc-wdm.h
4706 +-header-test- += linux/usb/cdc_ncm.h
4707 +-header-test- += linux/usb/ezusb.h
4708 +-header-test- += linux/usb/gadget_configfs.h
4709 +-header-test- += linux/usb/gpio_vbus.h
4710 +-header-test- += linux/usb/hcd.h
4711 +-header-test- += linux/usb/iowarrior.h
4712 +-header-test- += linux/usb/irda.h
4713 +-header-test- += linux/usb/isp116x.h
4714 +-header-test- += linux/usb/isp1362.h
4715 +-header-test- += linux/usb/musb.h
4716 +-header-test- += linux/usb/net2280.h
4717 +-header-test- += linux/usb/ohci_pdriver.h
4718 +-header-test- += linux/usb/otg-fsm.h
4719 +-header-test- += linux/usb/pd_ado.h
4720 +-header-test- += linux/usb/r8a66597.h
4721 +-header-test- += linux/usb/rndis_host.h
4722 +-header-test- += linux/usb/serial.h
4723 +-header-test- += linux/usb/sl811.h
4724 +-header-test- += linux/usb/storage.h
4725 +-header-test- += linux/usb/uas.h
4726 +-header-test- += linux/usb/usb338x.h
4727 +-header-test- += linux/usb/usbnet.h
4728 +-header-test- += linux/usb/wusb-wa.h
4729 +-header-test- += linux/usb/xhci-dbgp.h
4730 +-header-test- += linux/usb_usual.h
4731 +-header-test- += linux/user-return-notifier.h
4732 +-header-test- += linux/userfaultfd_k.h
4733 +-header-test- += linux/verification.h
4734 +-header-test- += linux/vgaarb.h
4735 +-header-test- += linux/via_core.h
4736 +-header-test- += linux/via_i2c.h
4737 +-header-test- += linux/virtio_byteorder.h
4738 +-header-test- += linux/virtio_ring.h
4739 +-header-test- += linux/visorbus.h
4740 +-header-test- += linux/vme.h
4741 +-header-test- += linux/vmstat.h
4742 +-header-test- += linux/vmw_vmci_api.h
4743 +-header-test- += linux/vmw_vmci_defs.h
4744 +-header-test- += linux/vringh.h
4745 +-header-test- += linux/vt_buffer.h
4746 +-header-test- += linux/zorro.h
4747 +-header-test- += linux/zpool.h
4748 +-header-test- += math-emu/double.h
4749 +-header-test- += math-emu/op-common.h
4750 +-header-test- += math-emu/quad.h
4751 +-header-test- += math-emu/single.h
4752 +-header-test- += math-emu/soft-fp.h
4753 +-header-test- += media/davinci/dm355_ccdc.h
4754 +-header-test- += media/davinci/dm644x_ccdc.h
4755 +-header-test- += media/davinci/isif.h
4756 +-header-test- += media/davinci/vpbe_osd.h
4757 +-header-test- += media/davinci/vpbe_types.h
4758 +-header-test- += media/davinci/vpif_types.h
4759 +-header-test- += media/demux.h
4760 +-header-test- += media/drv-intf/soc_mediabus.h
4761 +-header-test- += media/dvb_net.h
4762 +-header-test- += media/fwht-ctrls.h
4763 +-header-test- += media/i2c/ad9389b.h
4764 +-header-test- += media/i2c/adv7343.h
4765 +-header-test- += media/i2c/adv7511.h
4766 +-header-test- += media/i2c/adv7842.h
4767 +-header-test- += media/i2c/m5mols.h
4768 +-header-test- += media/i2c/mt9m032.h
4769 +-header-test- += media/i2c/mt9t112.h
4770 +-header-test- += media/i2c/mt9v032.h
4771 +-header-test- += media/i2c/ov2659.h
4772 +-header-test- += media/i2c/ov7670.h
4773 +-header-test- += media/i2c/rj54n1cb0c.h
4774 +-header-test- += media/i2c/saa6588.h
4775 +-header-test- += media/i2c/saa7115.h
4776 +-header-test- += media/i2c/sr030pc30.h
4777 +-header-test- += media/i2c/tc358743.h
4778 +-header-test- += media/i2c/tda1997x.h
4779 +-header-test- += media/i2c/ths7303.h
4780 +-header-test- += media/i2c/tvaudio.h
4781 +-header-test- += media/i2c/tvp514x.h
4782 +-header-test- += media/i2c/tvp7002.h
4783 +-header-test- += media/i2c/wm8775.h
4784 +-header-test- += media/imx.h
4785 +-header-test- += media/media-dev-allocator.h
4786 +-header-test- += media/mpeg2-ctrls.h
4787 +-header-test- += media/rcar-fcp.h
4788 +-header-test- += media/tuner-types.h
4789 +-header-test- += media/tveeprom.h
4790 +-header-test- += media/v4l2-flash-led-class.h
4791 +-header-test- += misc/altera.h
4792 +-header-test- += misc/cxl-base.h
4793 +-header-test- += misc/cxllib.h
4794 +-header-test- += net/9p/9p.h
4795 +-header-test- += net/9p/client.h
4796 +-header-test- += net/9p/transport.h
4797 +-header-test- += net/af_vsock.h
4798 +-header-test- += net/ax88796.h
4799 +-header-test- += net/bluetooth/hci.h
4800 +-header-test- += net/bluetooth/hci_core.h
4801 +-header-test- += net/bluetooth/hci_mon.h
4802 +-header-test- += net/bluetooth/hci_sock.h
4803 +-header-test- += net/bluetooth/l2cap.h
4804 +-header-test- += net/bluetooth/mgmt.h
4805 +-header-test- += net/bluetooth/rfcomm.h
4806 +-header-test- += net/bluetooth/sco.h
4807 +-header-test- += net/bond_options.h
4808 +-header-test- += net/caif/cfsrvl.h
4809 +-header-test- += net/codel_impl.h
4810 +-header-test- += net/codel_qdisc.h
4811 +-header-test- += net/compat.h
4812 +-header-test- += net/datalink.h
4813 +-header-test- += net/dcbevent.h
4814 +-header-test- += net/dcbnl.h
4815 +-header-test- += net/dn_dev.h
4816 +-header-test- += net/dn_fib.h
4817 +-header-test- += net/dn_neigh.h
4818 +-header-test- += net/dn_nsp.h
4819 +-header-test- += net/dn_route.h
4820 +-header-test- += net/erspan.h
4821 +-header-test- += net/esp.h
4822 +-header-test- += net/ethoc.h
4823 +-header-test- += net/firewire.h
4824 +-header-test- += net/flow_offload.h
4825 +-header-test- += net/fq.h
4826 +-header-test- += net/fq_impl.h
4827 +-header-test- += net/garp.h
4828 +-header-test- += net/gtp.h
4829 +-header-test- += net/gue.h
4830 +-header-test- += net/hwbm.h
4831 +-header-test- += net/ila.h
4832 +-header-test- += net/inet6_connection_sock.h
4833 +-header-test- += net/inet_common.h
4834 +-header-test- += net/inet_frag.h
4835 +-header-test- += net/ip6_route.h
4836 +-header-test- += net/ip_vs.h
4837 +-header-test- += net/ipcomp.h
4838 +-header-test- += net/ipconfig.h
4839 +-header-test- += net/iucv/af_iucv.h
4840 +-header-test- += net/iucv/iucv.h
4841 +-header-test- += net/lapb.h
4842 +-header-test- += net/llc_c_ac.h
4843 +-header-test- += net/llc_c_st.h
4844 +-header-test- += net/llc_s_ac.h
4845 +-header-test- += net/llc_s_ev.h
4846 +-header-test- += net/llc_s_st.h
4847 +-header-test- += net/mpls_iptunnel.h
4848 +-header-test- += net/mrp.h
4849 +-header-test- += net/ncsi.h
4850 +-header-test- += net/netevent.h
4851 +-header-test- += net/netns/can.h
4852 +-header-test- += net/netns/generic.h
4853 +-header-test- += net/netns/ieee802154_6lowpan.h
4854 +-header-test- += net/netns/ipv4.h
4855 +-header-test- += net/netns/ipv6.h
4856 +-header-test- += net/netns/mpls.h
4857 +-header-test- += net/netns/nftables.h
4858 +-header-test- += net/netns/sctp.h
4859 +-header-test- += net/netrom.h
4860 +-header-test- += net/p8022.h
4861 +-header-test- += net/phonet/pep.h
4862 +-header-test- += net/phonet/phonet.h
4863 +-header-test- += net/phonet/pn_dev.h
4864 +-header-test- += net/pptp.h
4865 +-header-test- += net/psample.h
4866 +-header-test- += net/psnap.h
4867 +-header-test- += net/regulatory.h
4868 +-header-test- += net/rose.h
4869 +-header-test- += net/sctp/auth.h
4870 +-header-test- += net/sctp/stream_interleave.h
4871 +-header-test- += net/sctp/stream_sched.h
4872 +-header-test- += net/sctp/tsnmap.h
4873 +-header-test- += net/sctp/ulpevent.h
4874 +-header-test- += net/sctp/ulpqueue.h
4875 +-header-test- += net/secure_seq.h
4876 +-header-test- += net/smc.h
4877 +-header-test- += net/stp.h
4878 +-header-test- += net/transp_v6.h
4879 +-header-test- += net/tun_proto.h
4880 +-header-test- += net/udplite.h
4881 +-header-test- += net/xdp.h
4882 +-header-test- += net/xdp_priv.h
4883 +-header-test- += pcmcia/cistpl.h
4884 +-header-test- += pcmcia/ds.h
4885 +-header-test- += rdma/tid_rdma_defs.h
4886 +-header-test- += scsi/fc/fc_encaps.h
4887 +-header-test- += scsi/fc/fc_fc2.h
4888 +-header-test- += scsi/fc/fc_fcoe.h
4889 +-header-test- += scsi/fc/fc_fip.h
4890 +-header-test- += scsi/fc_encode.h
4891 +-header-test- += scsi/fc_frame.h
4892 +-header-test- += scsi/iser.h
4893 +-header-test- += scsi/libfc.h
4894 +-header-test- += scsi/libfcoe.h
4895 +-header-test- += scsi/libsas.h
4896 +-header-test- += scsi/sas_ata.h
4897 +-header-test- += scsi/scsi_cmnd.h
4898 +-header-test- += scsi/scsi_dbg.h
4899 +-header-test- += scsi/scsi_device.h
4900 +-header-test- += scsi/scsi_dh.h
4901 +-header-test- += scsi/scsi_eh.h
4902 +-header-test- += scsi/scsi_host.h
4903 +-header-test- += scsi/scsi_ioctl.h
4904 +-header-test- += scsi/scsi_request.h
4905 +-header-test- += scsi/scsi_tcq.h
4906 +-header-test- += scsi/scsi_transport.h
4907 +-header-test- += scsi/scsi_transport_fc.h
4908 +-header-test- += scsi/scsi_transport_sas.h
4909 +-header-test- += scsi/scsi_transport_spi.h
4910 +-header-test- += scsi/scsi_transport_srp.h
4911 +-header-test- += scsi/scsicam.h
4912 +-header-test- += scsi/sg.h
4913 +-header-test- += soc/arc/aux.h
4914 +-header-test- += soc/arc/mcip.h
4915 +-header-test- += soc/arc/timers.h
4916 +-header-test- += soc/brcmstb/common.h
4917 +-header-test- += soc/fsl/bman.h
4918 +-header-test- += soc/fsl/qe/qe.h
4919 +-header-test- += soc/fsl/qe/qe_ic.h
4920 +-header-test- += soc/fsl/qe/qe_tdm.h
4921 +-header-test- += soc/fsl/qe/ucc.h
4922 +-header-test- += soc/fsl/qe/ucc_fast.h
4923 +-header-test- += soc/fsl/qe/ucc_slow.h
4924 +-header-test- += soc/fsl/qman.h
4925 +-header-test- += soc/nps/common.h
4926 +-header-test-$(CONFIG_ARC) += soc/nps/mtm.h
4927 +-header-test- += soc/qcom/cmd-db.h
4928 +-header-test- += soc/qcom/rpmh.h
4929 +-header-test- += soc/qcom/tcs.h
4930 +-header-test- += soc/tegra/ahb.h
4931 +-header-test- += soc/tegra/bpmp-abi.h
4932 +-header-test- += soc/tegra/common.h
4933 +-header-test- += soc/tegra/flowctrl.h
4934 +-header-test- += soc/tegra/fuse.h
4935 +-header-test- += soc/tegra/mc.h
4936 +-header-test- += sound/ac97/compat.h
4937 +-header-test- += sound/aci.h
4938 +-header-test- += sound/ad1843.h
4939 +-header-test- += sound/adau1373.h
4940 +-header-test- += sound/ak4113.h
4941 +-header-test- += sound/ak4114.h
4942 +-header-test- += sound/ak4117.h
4943 +-header-test- += sound/cs35l33.h
4944 +-header-test- += sound/cs35l34.h
4945 +-header-test- += sound/cs35l35.h
4946 +-header-test- += sound/cs35l36.h
4947 +-header-test- += sound/cs4271.h
4948 +-header-test- += sound/cs42l52.h
4949 +-header-test- += sound/cs8427.h
4950 +-header-test- += sound/da7218.h
4951 +-header-test- += sound/da7219-aad.h
4952 +-header-test- += sound/da7219.h
4953 +-header-test- += sound/da9055.h
4954 +-header-test- += sound/emu8000.h
4955 +-header-test- += sound/emux_synth.h
4956 +-header-test- += sound/hda_component.h
4957 +-header-test- += sound/hda_hwdep.h
4958 +-header-test- += sound/hda_i915.h
4959 +-header-test- += sound/hwdep.h
4960 +-header-test- += sound/i2c.h
4961 +-header-test- += sound/l3.h
4962 +-header-test- += sound/max98088.h
4963 +-header-test- += sound/max98095.h
4964 +-header-test- += sound/mixer_oss.h
4965 +-header-test- += sound/omap-hdmi-audio.h
4966 +-header-test- += sound/pcm_drm_eld.h
4967 +-header-test- += sound/pcm_iec958.h
4968 +-header-test- += sound/pcm_oss.h
4969 +-header-test- += sound/pxa2xx-lib.h
4970 +-header-test- += sound/rt286.h
4971 +-header-test- += sound/rt298.h
4972 +-header-test- += sound/rt5645.h
4973 +-header-test- += sound/rt5659.h
4974 +-header-test- += sound/rt5660.h
4975 +-header-test- += sound/rt5665.h
4976 +-header-test- += sound/rt5670.h
4977 +-header-test- += sound/s3c24xx_uda134x.h
4978 +-header-test- += sound/seq_device.h
4979 +-header-test- += sound/seq_kernel.h
4980 +-header-test- += sound/seq_midi_emul.h
4981 +-header-test- += sound/seq_oss.h
4982 +-header-test- += sound/soc-acpi-intel-match.h
4983 +-header-test- += sound/soc-dai.h
4984 +-header-test- += sound/soc-dapm.h
4985 +-header-test- += sound/soc-dpcm.h
4986 +-header-test- += sound/sof/control.h
4987 +-header-test- += sound/sof/dai-intel.h
4988 +-header-test- += sound/sof/dai.h
4989 +-header-test- += sound/sof/header.h
4990 +-header-test- += sound/sof/info.h
4991 +-header-test- += sound/sof/pm.h
4992 +-header-test- += sound/sof/stream.h
4993 +-header-test- += sound/sof/topology.h
4994 +-header-test- += sound/sof/trace.h
4995 +-header-test- += sound/sof/xtensa.h
4996 +-header-test- += sound/spear_spdif.h
4997 +-header-test- += sound/sta32x.h
4998 +-header-test- += sound/sta350.h
4999 +-header-test- += sound/tea6330t.h
5000 +-header-test- += sound/tlv320aic32x4.h
5001 +-header-test- += sound/tlv320dac33-plat.h
5002 +-header-test- += sound/uda134x.h
5003 +-header-test- += sound/wavefront.h
5004 +-header-test- += sound/wm8903.h
5005 +-header-test- += sound/wm8904.h
5006 +-header-test- += sound/wm8960.h
5007 +-header-test- += sound/wm8962.h
5008 +-header-test- += sound/wm8993.h
5009 +-header-test- += sound/wm8996.h
5010 +-header-test- += sound/wm9081.h
5011 +-header-test- += sound/wm9090.h
5012 +-header-test- += target/iscsi/iscsi_target_stat.h
5013 +-header-test- += trace/bpf_probe.h
5014 +-header-test- += trace/events/9p.h
5015 +-header-test- += trace/events/afs.h
5016 +-header-test- += trace/events/asoc.h
5017 +-header-test- += trace/events/bcache.h
5018 +-header-test- += trace/events/block.h
5019 +-header-test- += trace/events/cachefiles.h
5020 +-header-test- += trace/events/cgroup.h
5021 +-header-test- += trace/events/clk.h
5022 +-header-test- += trace/events/cma.h
5023 +-header-test- += trace/events/ext4.h
5024 +-header-test- += trace/events/f2fs.h
5025 +-header-test- += trace/events/fs_dax.h
5026 +-header-test- += trace/events/fscache.h
5027 +-header-test- += trace/events/fsi.h
5028 +-header-test- += trace/events/fsi_master_ast_cf.h
5029 +-header-test- += trace/events/fsi_master_gpio.h
5030 +-header-test- += trace/events/huge_memory.h
5031 +-header-test- += trace/events/ib_mad.h
5032 +-header-test- += trace/events/ib_umad.h
5033 +-header-test- += trace/events/iscsi.h
5034 +-header-test- += trace/events/jbd2.h
5035 +-header-test- += trace/events/kvm.h
5036 +-header-test- += trace/events/kyber.h
5037 +-header-test- += trace/events/libata.h
5038 +-header-test- += trace/events/mce.h
5039 +-header-test- += trace/events/mdio.h
5040 +-header-test- += trace/events/migrate.h
5041 +-header-test- += trace/events/mmflags.h
5042 +-header-test- += trace/events/nbd.h
5043 +-header-test- += trace/events/nilfs2.h
5044 +-header-test- += trace/events/pwc.h
5045 +-header-test- += trace/events/rdma.h
5046 +-header-test- += trace/events/rpcgss.h
5047 +-header-test- += trace/events/rpcrdma.h
5048 +-header-test- += trace/events/rxrpc.h
5049 +-header-test- += trace/events/scsi.h
5050 +-header-test- += trace/events/siox.h
5051 +-header-test- += trace/events/spi.h
5052 +-header-test- += trace/events/swiotlb.h
5053 +-header-test- += trace/events/syscalls.h
5054 +-header-test- += trace/events/target.h
5055 +-header-test- += trace/events/thermal_power_allocator.h
5056 +-header-test- += trace/events/timer.h
5057 +-header-test- += trace/events/wbt.h
5058 +-header-test- += trace/events/xen.h
5059 +-header-test- += trace/perf.h
5060 +-header-test- += trace/trace_events.h
5061 +-header-test- += uapi/drm/vmwgfx_drm.h
5062 +-header-test- += uapi/linux/a.out.h
5063 +-header-test- += uapi/linux/coda.h
5064 +-header-test- += uapi/linux/coda_psdev.h
5065 +-header-test- += uapi/linux/errqueue.h
5066 +-header-test- += uapi/linux/eventpoll.h
5067 +-header-test- += uapi/linux/hdlc/ioctl.h
5068 +-header-test- += uapi/linux/input.h
5069 +-header-test- += uapi/linux/kvm.h
5070 +-header-test- += uapi/linux/kvm_para.h
5071 +-header-test- += uapi/linux/lightnvm.h
5072 +-header-test- += uapi/linux/mic_common.h
5073 +-header-test- += uapi/linux/mman.h
5074 +-header-test- += uapi/linux/nilfs2_ondisk.h
5075 +-header-test- += uapi/linux/patchkey.h
5076 +-header-test- += uapi/linux/ptrace.h
5077 +-header-test- += uapi/linux/scc.h
5078 +-header-test- += uapi/linux/seg6_iptunnel.h
5079 +-header-test- += uapi/linux/smc_diag.h
5080 +-header-test- += uapi/linux/timex.h
5081 +-header-test- += uapi/linux/videodev2.h
5082 +-header-test- += uapi/scsi/scsi_bsg_fc.h
5083 +-header-test- += uapi/sound/asound.h
5084 +-header-test- += uapi/sound/sof/eq.h
5085 +-header-test- += uapi/sound/sof/fw.h
5086 +-header-test- += uapi/sound/sof/header.h
5087 +-header-test- += uapi/sound/sof/manifest.h
5088 +-header-test- += uapi/sound/sof/trace.h
5089 +-header-test- += uapi/xen/evtchn.h
5090 +-header-test- += uapi/xen/gntdev.h
5091 +-header-test- += uapi/xen/privcmd.h
5092 +-header-test- += vdso/vsyscall.h
5093 +-header-test- += video/broadsheetfb.h
5094 +-header-test- += video/cvisionppc.h
5095 +-header-test- += video/gbe.h
5096 +-header-test- += video/kyro.h
5097 +-header-test- += video/maxinefb.h
5098 +-header-test- += video/metronomefb.h
5099 +-header-test- += video/neomagic.h
5100 +-header-test- += video/of_display_timing.h
5101 +-header-test- += video/omapvrfb.h
5102 +-header-test- += video/s1d13xxxfb.h
5103 +-header-test- += video/sstfb.h
5104 +-header-test- += video/tgafb.h
5105 +-header-test- += video/udlfb.h
5106 +-header-test- += video/uvesafb.h
5107 +-header-test- += video/vga.h
5108 +-header-test- += video/w100fb.h
5109 +-header-test- += xen/acpi.h
5110 +-header-test- += xen/arm/hypercall.h
5111 +-header-test- += xen/arm/page-coherent.h
5112 +-header-test- += xen/arm/page.h
5113 +-header-test- += xen/balloon.h
5114 +-header-test- += xen/events.h
5115 +-header-test- += xen/features.h
5116 +-header-test- += xen/grant_table.h
5117 +-header-test- += xen/hvm.h
5118 +-header-test- += xen/interface/callback.h
5119 +-header-test- += xen/interface/event_channel.h
5120 +-header-test- += xen/interface/grant_table.h
5121 +-header-test- += xen/interface/hvm/dm_op.h
5122 +-header-test- += xen/interface/hvm/hvm_op.h
5123 +-header-test- += xen/interface/hvm/hvm_vcpu.h
5124 +-header-test- += xen/interface/hvm/params.h
5125 +-header-test- += xen/interface/hvm/start_info.h
5126 +-header-test- += xen/interface/io/9pfs.h
5127 +-header-test- += xen/interface/io/blkif.h
5128 +-header-test- += xen/interface/io/console.h
5129 +-header-test- += xen/interface/io/displif.h
5130 +-header-test- += xen/interface/io/fbif.h
5131 +-header-test- += xen/interface/io/kbdif.h
5132 +-header-test- += xen/interface/io/netif.h
5133 +-header-test- += xen/interface/io/pciif.h
5134 +-header-test- += xen/interface/io/protocols.h
5135 +-header-test- += xen/interface/io/pvcalls.h
5136 +-header-test- += xen/interface/io/ring.h
5137 +-header-test- += xen/interface/io/sndif.h
5138 +-header-test- += xen/interface/io/tpmif.h
5139 +-header-test- += xen/interface/io/vscsiif.h
5140 +-header-test- += xen/interface/io/xs_wire.h
5141 +-header-test- += xen/interface/memory.h
5142 +-header-test- += xen/interface/nmi.h
5143 +-header-test- += xen/interface/physdev.h
5144 +-header-test- += xen/interface/platform.h
5145 +-header-test- += xen/interface/sched.h
5146 +-header-test- += xen/interface/vcpu.h
5147 +-header-test- += xen/interface/version.h
5148 +-header-test- += xen/interface/xen-mca.h
5149 +-header-test- += xen/interface/xen.h
5150 +-header-test- += xen/interface/xenpmu.h
5151 +-header-test- += xen/mem-reservation.h
5152 +-header-test- += xen/page.h
5153 +-header-test- += xen/platform_pci.h
5154 +-header-test- += xen/swiotlb-xen.h
5155 +-header-test- += xen/xen-front-pgdir-shbuf.h
5156 +-header-test- += xen/xen-ops.h
5157 +-header-test- += xen/xen.h
5158 +-header-test- += xen/xenbus.h
5159 +-
5160 +-# Do not include directly
5161 +-header-test- += linux/compiler-clang.h
5162 +-header-test- += linux/compiler-gcc.h
5163 +-header-test- += linux/patchkey.h
5164 +-header-test- += linux/rwlock_api_smp.h
5165 +-header-test- += linux/spinlock_types_up.h
5166 +-header-test- += linux/spinlock_up.h
5167 +-header-test- += linux/wimax/debug.h
5168 +-header-test- += rdma/uverbs_named_ioctl.h
5169 +-
5170 +-# asm-generic/*.h is used by asm/*.h, and should not be included directly
5171 +-header-test- += asm-generic/% uapi/asm-generic/%
5172 +-
5173 +-# Timestamp files touched by Kconfig
5174 +-header-test- += config/%
5175 +-
5176 +-# Timestamp files touched by scripts/adjust_autoksyms.sh
5177 +-header-test- += ksym/%
5178 +-
5179 +-# You could compile-test these, but maybe not so useful...
5180 +-header-test- += dt-bindings/%
5181 +-
5182 +-# Do not test generated headers. Stale headers are often left over when you
5183 +-# traverse the git history without cleaning.
5184 +-header-test- += generated/%
5185 +-
5186 +-# The rest are compile-tested
5187 +-header-test-pattern-y += */*.h */*/*.h */*/*/*.h */*/*/*/*.h
5188 +diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h
5189 +index 2f3f28c7cea3..9373662cdb44 100644
5190 +--- a/include/acpi/actypes.h
5191 ++++ b/include/acpi/actypes.h
5192 +@@ -532,11 +532,12 @@ typedef u64 acpi_integer;
5193 + strnlen (a, ACPI_NAMESEG_SIZE) == ACPI_NAMESEG_SIZE)
5194 +
5195 + /*
5196 +- * Algorithm to obtain access bit width.
5197 ++ * Algorithm to obtain access bit or byte width.
5198 + * Can be used with access_width of struct acpi_generic_address and access_size of
5199 + * struct acpi_resource_generic_register.
5200 + */
5201 + #define ACPI_ACCESS_BIT_WIDTH(size) (1 << ((size) + 2))
5202 ++#define ACPI_ACCESS_BYTE_WIDTH(size) (1 << ((size) - 1))
5203 +
5204 + /*******************************************************************************
5205 + *
5206 +diff --git a/include/asm-generic/vdso/vsyscall.h b/include/asm-generic/vdso/vsyscall.h
5207 +index ce4103208619..cec543d9e87b 100644
5208 +--- a/include/asm-generic/vdso/vsyscall.h
5209 ++++ b/include/asm-generic/vdso/vsyscall.h
5210 +@@ -12,9 +12,9 @@ static __always_inline struct vdso_data *__arch_get_k_vdso_data(void)
5211 + #endif /* __arch_get_k_vdso_data */
5212 +
5213 + #ifndef __arch_update_vdso_data
5214 +-static __always_inline int __arch_update_vdso_data(void)
5215 ++static __always_inline bool __arch_update_vdso_data(void)
5216 + {
5217 +- return 0;
5218 ++ return true;
5219 + }
5220 + #endif /* __arch_update_vdso_data */
5221 +
5222 +diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
5223 +index 51ccb4b8770a..bff1def62eed 100644
5224 +--- a/include/linux/blkdev.h
5225 ++++ b/include/linux/blkdev.h
5226 +@@ -531,7 +531,7 @@ struct request_queue {
5227 + unsigned int sg_reserved_size;
5228 + int node;
5229 + #ifdef CONFIG_BLK_DEV_IO_TRACE
5230 +- struct blk_trace *blk_trace;
5231 ++ struct blk_trace __rcu *blk_trace;
5232 + struct mutex blk_trace_mutex;
5233 + #endif
5234 + /*
5235 +diff --git a/include/linux/blktrace_api.h b/include/linux/blktrace_api.h
5236 +index 7bb2d8de9f30..3b6ff5902edc 100644
5237 +--- a/include/linux/blktrace_api.h
5238 ++++ b/include/linux/blktrace_api.h
5239 +@@ -51,9 +51,13 @@ void __trace_note_message(struct blk_trace *, struct blkcg *blkcg, const char *f
5240 + **/
5241 + #define blk_add_cgroup_trace_msg(q, cg, fmt, ...) \
5242 + do { \
5243 +- struct blk_trace *bt = (q)->blk_trace; \
5244 ++ struct blk_trace *bt; \
5245 ++ \
5246 ++ rcu_read_lock(); \
5247 ++ bt = rcu_dereference((q)->blk_trace); \
5248 + if (unlikely(bt)) \
5249 + __trace_note_message(bt, cg, fmt, ##__VA_ARGS__);\
5250 ++ rcu_read_unlock(); \
5251 + } while (0)
5252 + #define blk_add_trace_msg(q, fmt, ...) \
5253 + blk_add_cgroup_trace_msg(q, NULL, fmt, ##__VA_ARGS__)
5254 +@@ -61,10 +65,14 @@ void __trace_note_message(struct blk_trace *, struct blkcg *blkcg, const char *f
5255 +
5256 + static inline bool blk_trace_note_message_enabled(struct request_queue *q)
5257 + {
5258 +- struct blk_trace *bt = q->blk_trace;
5259 +- if (likely(!bt))
5260 +- return false;
5261 +- return bt->act_mask & BLK_TC_NOTIFY;
5262 ++ struct blk_trace *bt;
5263 ++ bool ret;
5264 ++
5265 ++ rcu_read_lock();
5266 ++ bt = rcu_dereference(q->blk_trace);
5267 ++ ret = bt && (bt->act_mask & BLK_TC_NOTIFY);
5268 ++ rcu_read_unlock();
5269 ++ return ret;
5270 + }
5271 +
5272 + extern void blk_add_driver_data(struct request_queue *q, struct request *rq,
5273 +diff --git a/include/linux/hid.h b/include/linux/hid.h
5274 +index cd41f209043f..875f71132b14 100644
5275 +--- a/include/linux/hid.h
5276 ++++ b/include/linux/hid.h
5277 +@@ -492,7 +492,7 @@ struct hid_report_enum {
5278 + };
5279 +
5280 + #define HID_MIN_BUFFER_SIZE 64 /* make sure there is at least a packet size of space */
5281 +-#define HID_MAX_BUFFER_SIZE 4096 /* 4kb */
5282 ++#define HID_MAX_BUFFER_SIZE 8192 /* 8kb */
5283 + #define HID_CONTROL_FIFO_SIZE 256 /* to init devices with >100 reports */
5284 + #define HID_OUTPUT_FIFO_SIZE 64
5285 +
5286 +diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
5287 +index f8fde9fa479c..b580a35f50ea 100644
5288 +--- a/include/linux/netdevice.h
5289 ++++ b/include/linux/netdevice.h
5290 +@@ -72,6 +72,8 @@ void netdev_set_default_ethtool_ops(struct net_device *dev,
5291 + #define NET_RX_SUCCESS 0 /* keep 'em coming, baby */
5292 + #define NET_RX_DROP 1 /* packet dropped */
5293 +
5294 ++#define MAX_NEST_DEV 8
5295 ++
5296 + /*
5297 + * Transmit return codes: transmit return codes originate from three different
5298 + * namespaces:
5299 +@@ -4294,11 +4296,8 @@ void *netdev_lower_get_next(struct net_device *dev,
5300 + ldev; \
5301 + ldev = netdev_lower_get_next(dev, &(iter)))
5302 +
5303 +-struct net_device *netdev_all_lower_get_next(struct net_device *dev,
5304 ++struct net_device *netdev_next_lower_dev_rcu(struct net_device *dev,
5305 + struct list_head **iter);
5306 +-struct net_device *netdev_all_lower_get_next_rcu(struct net_device *dev,
5307 +- struct list_head **iter);
5308 +-
5309 + int netdev_walk_all_lower_dev(struct net_device *dev,
5310 + int (*fn)(struct net_device *lower_dev,
5311 + void *data),
5312 +diff --git a/include/linux/netfilter/ipset/ip_set.h b/include/linux/netfilter/ipset/ip_set.h
5313 +index 77336f4c4b1c..32658749e9db 100644
5314 +--- a/include/linux/netfilter/ipset/ip_set.h
5315 ++++ b/include/linux/netfilter/ipset/ip_set.h
5316 +@@ -121,6 +121,7 @@ struct ip_set_ext {
5317 + u32 timeout;
5318 + u8 packets_op;
5319 + u8 bytes_op;
5320 ++ bool target;
5321 + };
5322 +
5323 + struct ip_set;
5324 +@@ -187,6 +188,14 @@ struct ip_set_type_variant {
5325 + /* Return true if "b" set is the same as "a"
5326 + * according to the create set parameters */
5327 + bool (*same_set)(const struct ip_set *a, const struct ip_set *b);
5328 ++ /* Region-locking is used */
5329 ++ bool region_lock;
5330 ++};
5331 ++
5332 ++struct ip_set_region {
5333 ++ spinlock_t lock; /* Region lock */
5334 ++ size_t ext_size; /* Size of the dynamic extensions */
5335 ++ u32 elements; /* Number of elements vs timeout */
5336 + };
5337 +
5338 + /* The core set type structure */
5339 +@@ -681,7 +690,7 @@ ip_set_init_skbinfo(struct ip_set_skbinfo *skbinfo,
5340 + }
5341 +
5342 + #define IP_SET_INIT_KEXT(skb, opt, set) \
5343 +- { .bytes = (skb)->len, .packets = 1, \
5344 ++ { .bytes = (skb)->len, .packets = 1, .target = true,\
5345 + .timeout = ip_set_adt_opt_timeout(opt, set) }
5346 +
5347 + #define IP_SET_INIT_UEXT(set) \
5348 +diff --git a/include/linux/sched/nohz.h b/include/linux/sched/nohz.h
5349 +index 1abe91ff6e4a..6d67e9a5af6b 100644
5350 +--- a/include/linux/sched/nohz.h
5351 ++++ b/include/linux/sched/nohz.h
5352 +@@ -15,9 +15,11 @@ static inline void nohz_balance_enter_idle(int cpu) { }
5353 +
5354 + #ifdef CONFIG_NO_HZ_COMMON
5355 + void calc_load_nohz_start(void);
5356 ++void calc_load_nohz_remote(struct rq *rq);
5357 + void calc_load_nohz_stop(void);
5358 + #else
5359 + static inline void calc_load_nohz_start(void) { }
5360 ++static inline void calc_load_nohz_remote(struct rq *rq) { }
5361 + static inline void calc_load_nohz_stop(void) { }
5362 + #endif /* CONFIG_NO_HZ_COMMON */
5363 +
5364 +diff --git a/include/net/flow_dissector.h b/include/net/flow_dissector.h
5365 +index e5fc8db1f783..78f6437cbc3a 100644
5366 +--- a/include/net/flow_dissector.h
5367 ++++ b/include/net/flow_dissector.h
5368 +@@ -5,6 +5,7 @@
5369 + #include <linux/types.h>
5370 + #include <linux/in6.h>
5371 + #include <linux/siphash.h>
5372 ++#include <linux/string.h>
5373 + #include <uapi/linux/if_ether.h>
5374 +
5375 + /**
5376 +@@ -338,4 +339,12 @@ struct bpf_flow_dissector {
5377 + void *data_end;
5378 + };
5379 +
5380 ++static inline void
5381 ++flow_dissector_init_keys(struct flow_dissector_key_control *key_control,
5382 ++ struct flow_dissector_key_basic *key_basic)
5383 ++{
5384 ++ memset(key_control, 0, sizeof(*key_control));
5385 ++ memset(key_basic, 0, sizeof(*key_basic));
5386 ++}
5387 ++
5388 + #endif
5389 +diff --git a/include/uapi/linux/usb/charger.h b/include/uapi/linux/usb/charger.h
5390 +index 5f72af35b3ed..ad22079125bf 100644
5391 +--- a/include/uapi/linux/usb/charger.h
5392 ++++ b/include/uapi/linux/usb/charger.h
5393 +@@ -14,18 +14,18 @@
5394 + * ACA (Accessory Charger Adapters)
5395 + */
5396 + enum usb_charger_type {
5397 +- UNKNOWN_TYPE,
5398 +- SDP_TYPE,
5399 +- DCP_TYPE,
5400 +- CDP_TYPE,
5401 +- ACA_TYPE,
5402 ++ UNKNOWN_TYPE = 0,
5403 ++ SDP_TYPE = 1,
5404 ++ DCP_TYPE = 2,
5405 ++ CDP_TYPE = 3,
5406 ++ ACA_TYPE = 4,
5407 + };
5408 +
5409 + /* USB charger state */
5410 + enum usb_charger_state {
5411 +- USB_CHARGER_DEFAULT,
5412 +- USB_CHARGER_PRESENT,
5413 +- USB_CHARGER_ABSENT,
5414 ++ USB_CHARGER_DEFAULT = 0,
5415 ++ USB_CHARGER_PRESENT = 1,
5416 ++ USB_CHARGER_ABSENT = 2,
5417 + };
5418 +
5419 + #endif /* _UAPI__LINUX_USB_CHARGER_H */
5420 +diff --git a/init/Kconfig b/init/Kconfig
5421 +index 0328b53d09ad..0bffc8fdbf3d 100644
5422 +--- a/init/Kconfig
5423 ++++ b/init/Kconfig
5424 +@@ -105,29 +105,9 @@ config COMPILE_TEST
5425 + here. If you are a user/distributor, say N here to exclude useless
5426 + drivers to be distributed.
5427 +
5428 +-config HEADER_TEST
5429 +- bool "Compile test headers that should be standalone compilable"
5430 +- help
5431 +- Compile test headers listed in header-test-y target to ensure they are
5432 +- self-contained, i.e. compilable as standalone units.
5433 +-
5434 +- If you are a developer or tester and want to ensure the requested
5435 +- headers are self-contained, say Y here. Otherwise, choose N.
5436 +-
5437 +-config KERNEL_HEADER_TEST
5438 +- bool "Compile test kernel headers"
5439 +- depends on HEADER_TEST
5440 +- help
5441 +- Headers in include/ are used to build external moduls.
5442 +- Compile test them to ensure they are self-contained, i.e.
5443 +- compilable as standalone units.
5444 +-
5445 +- If you are a developer or tester and want to ensure the headers
5446 +- in include/ are self-contained, say Y here. Otherwise, choose N.
5447 +-
5448 + config UAPI_HEADER_TEST
5449 + bool "Compile test UAPI headers"
5450 +- depends on HEADER_TEST && HEADERS_INSTALL && CC_CAN_LINK
5451 ++ depends on HEADERS_INSTALL && CC_CAN_LINK
5452 + help
5453 + Compile test headers exported to user-space to ensure they are
5454 + self-contained, i.e. compilable as standalone units.
5455 +diff --git a/kernel/audit.c b/kernel/audit.c
5456 +index da8dc0db5bd3..dfc45063cb56 100644
5457 +--- a/kernel/audit.c
5458 ++++ b/kernel/audit.c
5459 +@@ -1100,13 +1100,11 @@ static void audit_log_feature_change(int which, u32 old_feature, u32 new_feature
5460 + audit_log_end(ab);
5461 + }
5462 +
5463 +-static int audit_set_feature(struct sk_buff *skb)
5464 ++static int audit_set_feature(struct audit_features *uaf)
5465 + {
5466 +- struct audit_features *uaf;
5467 + int i;
5468 +
5469 + BUILD_BUG_ON(AUDIT_LAST_FEATURE + 1 > ARRAY_SIZE(audit_feature_names));
5470 +- uaf = nlmsg_data(nlmsg_hdr(skb));
5471 +
5472 + /* if there is ever a version 2 we should handle that here */
5473 +
5474 +@@ -1174,6 +1172,7 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
5475 + {
5476 + u32 seq;
5477 + void *data;
5478 ++ int data_len;
5479 + int err;
5480 + struct audit_buffer *ab;
5481 + u16 msg_type = nlh->nlmsg_type;
5482 +@@ -1187,6 +1186,7 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
5483 +
5484 + seq = nlh->nlmsg_seq;
5485 + data = nlmsg_data(nlh);
5486 ++ data_len = nlmsg_len(nlh);
5487 +
5488 + switch (msg_type) {
5489 + case AUDIT_GET: {
5490 +@@ -1210,7 +1210,7 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
5491 + struct audit_status s;
5492 + memset(&s, 0, sizeof(s));
5493 + /* guard against past and future API changes */
5494 +- memcpy(&s, data, min_t(size_t, sizeof(s), nlmsg_len(nlh)));
5495 ++ memcpy(&s, data, min_t(size_t, sizeof(s), data_len));
5496 + if (s.mask & AUDIT_STATUS_ENABLED) {
5497 + err = audit_set_enabled(s.enabled);
5498 + if (err < 0)
5499 +@@ -1314,7 +1314,9 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
5500 + return err;
5501 + break;
5502 + case AUDIT_SET_FEATURE:
5503 +- err = audit_set_feature(skb);
5504 ++ if (data_len < sizeof(struct audit_features))
5505 ++ return -EINVAL;
5506 ++ err = audit_set_feature(data);
5507 + if (err)
5508 + return err;
5509 + break;
5510 +@@ -1326,6 +1328,8 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
5511 +
5512 + err = audit_filter(msg_type, AUDIT_FILTER_USER);
5513 + if (err == 1) { /* match or error */
5514 ++ char *str = data;
5515 ++
5516 + err = 0;
5517 + if (msg_type == AUDIT_USER_TTY) {
5518 + err = tty_audit_push();
5519 +@@ -1333,26 +1337,24 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
5520 + break;
5521 + }
5522 + audit_log_user_recv_msg(&ab, msg_type);
5523 +- if (msg_type != AUDIT_USER_TTY)
5524 ++ if (msg_type != AUDIT_USER_TTY) {
5525 ++ /* ensure NULL termination */
5526 ++ str[data_len - 1] = '\0';
5527 + audit_log_format(ab, " msg='%.*s'",
5528 + AUDIT_MESSAGE_TEXT_MAX,
5529 +- (char *)data);
5530 +- else {
5531 +- int size;
5532 +-
5533 ++ str);
5534 ++ } else {
5535 + audit_log_format(ab, " data=");
5536 +- size = nlmsg_len(nlh);
5537 +- if (size > 0 &&
5538 +- ((unsigned char *)data)[size - 1] == '\0')
5539 +- size--;
5540 +- audit_log_n_untrustedstring(ab, data, size);
5541 ++ if (data_len > 0 && str[data_len - 1] == '\0')
5542 ++ data_len--;
5543 ++ audit_log_n_untrustedstring(ab, str, data_len);
5544 + }
5545 + audit_log_end(ab);
5546 + }
5547 + break;
5548 + case AUDIT_ADD_RULE:
5549 + case AUDIT_DEL_RULE:
5550 +- if (nlmsg_len(nlh) < sizeof(struct audit_rule_data))
5551 ++ if (data_len < sizeof(struct audit_rule_data))
5552 + return -EINVAL;
5553 + if (audit_enabled == AUDIT_LOCKED) {
5554 + audit_log_common_recv_msg(audit_context(), &ab,
5555 +@@ -1364,7 +1366,7 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
5556 + audit_log_end(ab);
5557 + return -EPERM;
5558 + }
5559 +- err = audit_rule_change(msg_type, seq, data, nlmsg_len(nlh));
5560 ++ err = audit_rule_change(msg_type, seq, data, data_len);
5561 + break;
5562 + case AUDIT_LIST_RULES:
5563 + err = audit_list_rules_send(skb, seq);
5564 +@@ -1379,7 +1381,7 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
5565 + case AUDIT_MAKE_EQUIV: {
5566 + void *bufp = data;
5567 + u32 sizes[2];
5568 +- size_t msglen = nlmsg_len(nlh);
5569 ++ size_t msglen = data_len;
5570 + char *old, *new;
5571 +
5572 + err = -EINVAL;
5573 +@@ -1455,7 +1457,7 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
5574 +
5575 + memset(&s, 0, sizeof(s));
5576 + /* guard against past and future API changes */
5577 +- memcpy(&s, data, min_t(size_t, sizeof(s), nlmsg_len(nlh)));
5578 ++ memcpy(&s, data, min_t(size_t, sizeof(s), data_len));
5579 + /* check if new data is valid */
5580 + if ((s.enabled != 0 && s.enabled != 1) ||
5581 + (s.log_passwd != 0 && s.log_passwd != 1))
5582 +diff --git a/kernel/auditfilter.c b/kernel/auditfilter.c
5583 +index b0126e9c0743..026e34da4ace 100644
5584 +--- a/kernel/auditfilter.c
5585 ++++ b/kernel/auditfilter.c
5586 +@@ -456,6 +456,7 @@ static struct audit_entry *audit_data_to_entry(struct audit_rule_data *data,
5587 + bufp = data->buf;
5588 + for (i = 0; i < data->field_count; i++) {
5589 + struct audit_field *f = &entry->rule.fields[i];
5590 ++ u32 f_val;
5591 +
5592 + err = -EINVAL;
5593 +
5594 +@@ -464,12 +465,12 @@ static struct audit_entry *audit_data_to_entry(struct audit_rule_data *data,
5595 + goto exit_free;
5596 +
5597 + f->type = data->fields[i];
5598 +- f->val = data->values[i];
5599 ++ f_val = data->values[i];
5600 +
5601 + /* Support legacy tests for a valid loginuid */
5602 +- if ((f->type == AUDIT_LOGINUID) && (f->val == AUDIT_UID_UNSET)) {
5603 ++ if ((f->type == AUDIT_LOGINUID) && (f_val == AUDIT_UID_UNSET)) {
5604 + f->type = AUDIT_LOGINUID_SET;
5605 +- f->val = 0;
5606 ++ f_val = 0;
5607 + entry->rule.pflags |= AUDIT_LOGINUID_LEGACY;
5608 + }
5609 +
5610 +@@ -485,7 +486,7 @@ static struct audit_entry *audit_data_to_entry(struct audit_rule_data *data,
5611 + case AUDIT_SUID:
5612 + case AUDIT_FSUID:
5613 + case AUDIT_OBJ_UID:
5614 +- f->uid = make_kuid(current_user_ns(), f->val);
5615 ++ f->uid = make_kuid(current_user_ns(), f_val);
5616 + if (!uid_valid(f->uid))
5617 + goto exit_free;
5618 + break;
5619 +@@ -494,11 +495,12 @@ static struct audit_entry *audit_data_to_entry(struct audit_rule_data *data,
5620 + case AUDIT_SGID:
5621 + case AUDIT_FSGID:
5622 + case AUDIT_OBJ_GID:
5623 +- f->gid = make_kgid(current_user_ns(), f->val);
5624 ++ f->gid = make_kgid(current_user_ns(), f_val);
5625 + if (!gid_valid(f->gid))
5626 + goto exit_free;
5627 + break;
5628 + case AUDIT_ARCH:
5629 ++ f->val = f_val;
5630 + entry->rule.arch_f = f;
5631 + break;
5632 + case AUDIT_SUBJ_USER:
5633 +@@ -511,11 +513,13 @@ static struct audit_entry *audit_data_to_entry(struct audit_rule_data *data,
5634 + case AUDIT_OBJ_TYPE:
5635 + case AUDIT_OBJ_LEV_LOW:
5636 + case AUDIT_OBJ_LEV_HIGH:
5637 +- str = audit_unpack_string(&bufp, &remain, f->val);
5638 +- if (IS_ERR(str))
5639 ++ str = audit_unpack_string(&bufp, &remain, f_val);
5640 ++ if (IS_ERR(str)) {
5641 ++ err = PTR_ERR(str);
5642 + goto exit_free;
5643 +- entry->rule.buflen += f->val;
5644 +-
5645 ++ }
5646 ++ entry->rule.buflen += f_val;
5647 ++ f->lsm_str = str;
5648 + err = security_audit_rule_init(f->type, f->op, str,
5649 + (void **)&f->lsm_rule);
5650 + /* Keep currently invalid fields around in case they
5651 +@@ -524,68 +528,71 @@ static struct audit_entry *audit_data_to_entry(struct audit_rule_data *data,
5652 + pr_warn("audit rule for LSM \'%s\' is invalid\n",
5653 + str);
5654 + err = 0;
5655 +- }
5656 +- if (err) {
5657 +- kfree(str);
5658 ++ } else if (err)
5659 + goto exit_free;
5660 +- } else
5661 +- f->lsm_str = str;
5662 + break;
5663 + case AUDIT_WATCH:
5664 +- str = audit_unpack_string(&bufp, &remain, f->val);
5665 +- if (IS_ERR(str))
5666 ++ str = audit_unpack_string(&bufp, &remain, f_val);
5667 ++ if (IS_ERR(str)) {
5668 ++ err = PTR_ERR(str);
5669 + goto exit_free;
5670 +- entry->rule.buflen += f->val;
5671 +-
5672 +- err = audit_to_watch(&entry->rule, str, f->val, f->op);
5673 ++ }
5674 ++ err = audit_to_watch(&entry->rule, str, f_val, f->op);
5675 + if (err) {
5676 + kfree(str);
5677 + goto exit_free;
5678 + }
5679 ++ entry->rule.buflen += f_val;
5680 + break;
5681 + case AUDIT_DIR:
5682 +- str = audit_unpack_string(&bufp, &remain, f->val);
5683 +- if (IS_ERR(str))
5684 ++ str = audit_unpack_string(&bufp, &remain, f_val);
5685 ++ if (IS_ERR(str)) {
5686 ++ err = PTR_ERR(str);
5687 + goto exit_free;
5688 +- entry->rule.buflen += f->val;
5689 +-
5690 ++ }
5691 + err = audit_make_tree(&entry->rule, str, f->op);
5692 + kfree(str);
5693 + if (err)
5694 + goto exit_free;
5695 ++ entry->rule.buflen += f_val;
5696 + break;
5697 + case AUDIT_INODE:
5698 ++ f->val = f_val;
5699 + err = audit_to_inode(&entry->rule, f);
5700 + if (err)
5701 + goto exit_free;
5702 + break;
5703 + case AUDIT_FILTERKEY:
5704 +- if (entry->rule.filterkey || f->val > AUDIT_MAX_KEY_LEN)
5705 ++ if (entry->rule.filterkey || f_val > AUDIT_MAX_KEY_LEN)
5706 + goto exit_free;
5707 +- str = audit_unpack_string(&bufp, &remain, f->val);
5708 +- if (IS_ERR(str))
5709 ++ str = audit_unpack_string(&bufp, &remain, f_val);
5710 ++ if (IS_ERR(str)) {
5711 ++ err = PTR_ERR(str);
5712 + goto exit_free;
5713 +- entry->rule.buflen += f->val;
5714 ++ }
5715 ++ entry->rule.buflen += f_val;
5716 + entry->rule.filterkey = str;
5717 + break;
5718 + case AUDIT_EXE:
5719 +- if (entry->rule.exe || f->val > PATH_MAX)
5720 ++ if (entry->rule.exe || f_val > PATH_MAX)
5721 + goto exit_free;
5722 +- str = audit_unpack_string(&bufp, &remain, f->val);
5723 ++ str = audit_unpack_string(&bufp, &remain, f_val);
5724 + if (IS_ERR(str)) {
5725 + err = PTR_ERR(str);
5726 + goto exit_free;
5727 + }
5728 +- entry->rule.buflen += f->val;
5729 +-
5730 +- audit_mark = audit_alloc_mark(&entry->rule, str, f->val);
5731 ++ audit_mark = audit_alloc_mark(&entry->rule, str, f_val);
5732 + if (IS_ERR(audit_mark)) {
5733 + kfree(str);
5734 + err = PTR_ERR(audit_mark);
5735 + goto exit_free;
5736 + }
5737 ++ entry->rule.buflen += f_val;
5738 + entry->rule.exe = audit_mark;
5739 + break;
5740 ++ default:
5741 ++ f->val = f_val;
5742 ++ break;
5743 + }
5744 + }
5745 +
5746 +diff --git a/kernel/kprobes.c b/kernel/kprobes.c
5747 +index 53534aa258a6..34e28b236d68 100644
5748 +--- a/kernel/kprobes.c
5749 ++++ b/kernel/kprobes.c
5750 +@@ -510,6 +510,8 @@ static void do_unoptimize_kprobes(void)
5751 + arch_unoptimize_kprobes(&unoptimizing_list, &freeing_list);
5752 + /* Loop free_list for disarming */
5753 + list_for_each_entry_safe(op, tmp, &freeing_list, list) {
5754 ++ /* Switching from detour code to origin */
5755 ++ op->kp.flags &= ~KPROBE_FLAG_OPTIMIZED;
5756 + /* Disarm probes if marked disabled */
5757 + if (kprobe_disabled(&op->kp))
5758 + arch_disarm_kprobe(&op->kp);
5759 +@@ -649,6 +651,7 @@ static void force_unoptimize_kprobe(struct optimized_kprobe *op)
5760 + {
5761 + lockdep_assert_cpus_held();
5762 + arch_unoptimize_kprobe(op);
5763 ++ op->kp.flags &= ~KPROBE_FLAG_OPTIMIZED;
5764 + if (kprobe_disabled(&op->kp))
5765 + arch_disarm_kprobe(&op->kp);
5766 + }
5767 +@@ -676,7 +679,6 @@ static void unoptimize_kprobe(struct kprobe *p, bool force)
5768 + return;
5769 + }
5770 +
5771 +- op->kp.flags &= ~KPROBE_FLAG_OPTIMIZED;
5772 + if (!list_empty(&op->list)) {
5773 + /* Dequeue from the optimization queue */
5774 + list_del_init(&op->list);
5775 +diff --git a/kernel/locking/lockdep_proc.c b/kernel/locking/lockdep_proc.c
5776 +index dadb7b7fba37..9bb6d2497b04 100644
5777 +--- a/kernel/locking/lockdep_proc.c
5778 ++++ b/kernel/locking/lockdep_proc.c
5779 +@@ -286,9 +286,9 @@ static int lockdep_stats_show(struct seq_file *m, void *v)
5780 + seq_printf(m, " stack-trace entries: %11lu [max: %lu]\n",
5781 + nr_stack_trace_entries, MAX_STACK_TRACE_ENTRIES);
5782 + #if defined(CONFIG_TRACE_IRQFLAGS) && defined(CONFIG_PROVE_LOCKING)
5783 +- seq_printf(m, " number of stack traces: %llu\n",
5784 ++ seq_printf(m, " number of stack traces: %11llu\n",
5785 + lockdep_stack_trace_count());
5786 +- seq_printf(m, " number of stack hash chains: %llu\n",
5787 ++ seq_printf(m, " number of stack hash chains: %11llu\n",
5788 + lockdep_stack_hash_count());
5789 + #endif
5790 + seq_printf(m, " combined max dependencies: %11u\n",
5791 +diff --git a/kernel/rcu/tree_exp.h b/kernel/rcu/tree_exp.h
5792 +index f504ac831779..df90d4d7ad2e 100644
5793 +--- a/kernel/rcu/tree_exp.h
5794 ++++ b/kernel/rcu/tree_exp.h
5795 +@@ -540,14 +540,13 @@ static void rcu_exp_wait_wake(unsigned long s)
5796 + struct rcu_node *rnp;
5797 +
5798 + synchronize_sched_expedited_wait();
5799 +- rcu_exp_gp_seq_end();
5800 +- trace_rcu_exp_grace_period(rcu_state.name, s, TPS("end"));
5801 +
5802 +- /*
5803 +- * Switch over to wakeup mode, allowing the next GP, but -only- the
5804 +- * next GP, to proceed.
5805 +- */
5806 ++ // Switch over to wakeup mode, allowing the next GP to proceed.
5807 ++ // End the previous grace period only after acquiring the mutex
5808 ++ // to ensure that only one GP runs concurrently with wakeups.
5809 + mutex_lock(&rcu_state.exp_wake_mutex);
5810 ++ rcu_exp_gp_seq_end();
5811 ++ trace_rcu_exp_grace_period(rcu_state.name, s, TPS("end"));
5812 +
5813 + rcu_for_each_node_breadth_first(rnp) {
5814 + if (ULONG_CMP_LT(READ_ONCE(rnp->exp_seq_rq), s)) {
5815 +diff --git a/kernel/sched/core.c b/kernel/sched/core.c
5816 +index e6c65725b7ce..e921126aec84 100644
5817 +--- a/kernel/sched/core.c
5818 ++++ b/kernel/sched/core.c
5819 +@@ -3668,28 +3668,32 @@ static void sched_tick_remote(struct work_struct *work)
5820 + * statistics and checks timeslices in a time-independent way, regardless
5821 + * of when exactly it is running.
5822 + */
5823 +- if (idle_cpu(cpu) || !tick_nohz_tick_stopped_cpu(cpu))
5824 ++ if (!tick_nohz_tick_stopped_cpu(cpu))
5825 + goto out_requeue;
5826 +
5827 + rq_lock_irq(rq, &rf);
5828 + curr = rq->curr;
5829 +- if (is_idle_task(curr) || cpu_is_offline(cpu))
5830 ++ if (cpu_is_offline(cpu))
5831 + goto out_unlock;
5832 +
5833 ++ curr = rq->curr;
5834 + update_rq_clock(rq);
5835 +- delta = rq_clock_task(rq) - curr->se.exec_start;
5836 +
5837 +- /*
5838 +- * Make sure the next tick runs within a reasonable
5839 +- * amount of time.
5840 +- */
5841 +- WARN_ON_ONCE(delta > (u64)NSEC_PER_SEC * 3);
5842 ++ if (!is_idle_task(curr)) {
5843 ++ /*
5844 ++ * Make sure the next tick runs within a reasonable
5845 ++ * amount of time.
5846 ++ */
5847 ++ delta = rq_clock_task(rq) - curr->se.exec_start;
5848 ++ WARN_ON_ONCE(delta > (u64)NSEC_PER_SEC * 3);
5849 ++ }
5850 + curr->sched_class->task_tick(rq, curr, 0);
5851 +
5852 ++ calc_load_nohz_remote(rq);
5853 + out_unlock:
5854 + rq_unlock_irq(rq, &rf);
5855 +-
5856 + out_requeue:
5857 ++
5858 + /*
5859 + * Run the remote tick once per second (1Hz). This arbitrary
5860 + * frequency is large enough to avoid overload but short enough
5861 +@@ -7054,8 +7058,15 @@ void sched_move_task(struct task_struct *tsk)
5862 +
5863 + if (queued)
5864 + enqueue_task(rq, tsk, queue_flags);
5865 +- if (running)
5866 ++ if (running) {
5867 + set_next_task(rq, tsk);
5868 ++ /*
5869 ++ * After changing group, the running task may have joined a
5870 ++ * throttled one but it's still the running task. Trigger a
5871 ++ * resched to make sure that task can still run.
5872 ++ */
5873 ++ resched_curr(rq);
5874 ++ }
5875 +
5876 + task_rq_unlock(rq, tsk, &rf);
5877 + }
5878 +diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
5879 +index c87a798d1456..f32ce3a359fa 100644
5880 +--- a/kernel/sched/fair.c
5881 ++++ b/kernel/sched/fair.c
5882 +@@ -5933,6 +5933,7 @@ static inline int select_idle_smt(struct task_struct *p, int target)
5883 + */
5884 + static int select_idle_cpu(struct task_struct *p, struct sched_domain *sd, int target)
5885 + {
5886 ++ struct cpumask *cpus = this_cpu_cpumask_var_ptr(select_idle_mask);
5887 + struct sched_domain *this_sd;
5888 + u64 avg_cost, avg_idle;
5889 + u64 time, cost;
5890 +@@ -5964,11 +5965,11 @@ static int select_idle_cpu(struct task_struct *p, struct sched_domain *sd, int t
5891 +
5892 + time = cpu_clock(this);
5893 +
5894 +- for_each_cpu_wrap(cpu, sched_domain_span(sd), target) {
5895 ++ cpumask_and(cpus, sched_domain_span(sd), p->cpus_ptr);
5896 ++
5897 ++ for_each_cpu_wrap(cpu, cpus, target) {
5898 + if (!--nr)
5899 + return si_cpu;
5900 +- if (!cpumask_test_cpu(cpu, p->cpus_ptr))
5901 +- continue;
5902 + if (available_idle_cpu(cpu))
5903 + break;
5904 + if (si_cpu == -1 && sched_idle_cpu(cpu))
5905 +diff --git a/kernel/sched/loadavg.c b/kernel/sched/loadavg.c
5906 +index 28a516575c18..de22da666ac7 100644
5907 +--- a/kernel/sched/loadavg.c
5908 ++++ b/kernel/sched/loadavg.c
5909 +@@ -231,16 +231,11 @@ static inline int calc_load_read_idx(void)
5910 + return calc_load_idx & 1;
5911 + }
5912 +
5913 +-void calc_load_nohz_start(void)
5914 ++static void calc_load_nohz_fold(struct rq *rq)
5915 + {
5916 +- struct rq *this_rq = this_rq();
5917 + long delta;
5918 +
5919 +- /*
5920 +- * We're going into NO_HZ mode, if there's any pending delta, fold it
5921 +- * into the pending NO_HZ delta.
5922 +- */
5923 +- delta = calc_load_fold_active(this_rq, 0);
5924 ++ delta = calc_load_fold_active(rq, 0);
5925 + if (delta) {
5926 + int idx = calc_load_write_idx();
5927 +
5928 +@@ -248,6 +243,24 @@ void calc_load_nohz_start(void)
5929 + }
5930 + }
5931 +
5932 ++void calc_load_nohz_start(void)
5933 ++{
5934 ++ /*
5935 ++ * We're going into NO_HZ mode, if there's any pending delta, fold it
5936 ++ * into the pending NO_HZ delta.
5937 ++ */
5938 ++ calc_load_nohz_fold(this_rq());
5939 ++}
5940 ++
5941 ++/*
5942 ++ * Keep track of the load for NOHZ_FULL, must be called between
5943 ++ * calc_load_nohz_{start,stop}().
5944 ++ */
5945 ++void calc_load_nohz_remote(struct rq *rq)
5946 ++{
5947 ++ calc_load_nohz_fold(rq);
5948 ++}
5949 ++
5950 + void calc_load_nohz_stop(void)
5951 + {
5952 + struct rq *this_rq = this_rq();
5953 +@@ -268,7 +281,7 @@ void calc_load_nohz_stop(void)
5954 + this_rq->calc_load_update += LOAD_FREQ;
5955 + }
5956 +
5957 +-static long calc_load_nohz_fold(void)
5958 ++static long calc_load_nohz_read(void)
5959 + {
5960 + int idx = calc_load_read_idx();
5961 + long delta = 0;
5962 +@@ -323,7 +336,7 @@ static void calc_global_nohz(void)
5963 + }
5964 + #else /* !CONFIG_NO_HZ_COMMON */
5965 +
5966 +-static inline long calc_load_nohz_fold(void) { return 0; }
5967 ++static inline long calc_load_nohz_read(void) { return 0; }
5968 + static inline void calc_global_nohz(void) { }
5969 +
5970 + #endif /* CONFIG_NO_HZ_COMMON */
5971 +@@ -346,7 +359,7 @@ void calc_global_load(unsigned long ticks)
5972 + /*
5973 + * Fold the 'old' NO_HZ-delta to include all NO_HZ CPUs.
5974 + */
5975 +- delta = calc_load_nohz_fold();
5976 ++ delta = calc_load_nohz_read();
5977 + if (delta)
5978 + atomic_long_add(delta, &calc_load_tasks);
5979 +
5980 +diff --git a/kernel/time/vsyscall.c b/kernel/time/vsyscall.c
5981 +index 5ee0f7709410..9577c89179cd 100644
5982 +--- a/kernel/time/vsyscall.c
5983 ++++ b/kernel/time/vsyscall.c
5984 +@@ -28,11 +28,6 @@ static inline void update_vdso_data(struct vdso_data *vdata,
5985 + vdata[CS_RAW].mult = tk->tkr_raw.mult;
5986 + vdata[CS_RAW].shift = tk->tkr_raw.shift;
5987 +
5988 +- /* CLOCK_REALTIME */
5989 +- vdso_ts = &vdata[CS_HRES_COARSE].basetime[CLOCK_REALTIME];
5990 +- vdso_ts->sec = tk->xtime_sec;
5991 +- vdso_ts->nsec = tk->tkr_mono.xtime_nsec;
5992 +-
5993 + /* CLOCK_MONOTONIC */
5994 + vdso_ts = &vdata[CS_HRES_COARSE].basetime[CLOCK_MONOTONIC];
5995 + vdso_ts->sec = tk->xtime_sec + tk->wall_to_monotonic.tv_sec;
5996 +@@ -70,12 +65,6 @@ static inline void update_vdso_data(struct vdso_data *vdata,
5997 + vdso_ts = &vdata[CS_HRES_COARSE].basetime[CLOCK_TAI];
5998 + vdso_ts->sec = tk->xtime_sec + (s64)tk->tai_offset;
5999 + vdso_ts->nsec = tk->tkr_mono.xtime_nsec;
6000 +-
6001 +- /*
6002 +- * Read without the seqlock held by clock_getres().
6003 +- * Note: No need to have a second copy.
6004 +- */
6005 +- WRITE_ONCE(vdata[CS_HRES_COARSE].hrtimer_res, hrtimer_resolution);
6006 + }
6007 +
6008 + void update_vsyscall(struct timekeeper *tk)
6009 +@@ -84,20 +73,17 @@ void update_vsyscall(struct timekeeper *tk)
6010 + struct vdso_timestamp *vdso_ts;
6011 + u64 nsec;
6012 +
6013 +- if (__arch_update_vdso_data()) {
6014 +- /*
6015 +- * Some architectures might want to skip the update of the
6016 +- * data page.
6017 +- */
6018 +- return;
6019 +- }
6020 +-
6021 + /* copy vsyscall data */
6022 + vdso_write_begin(vdata);
6023 +
6024 + vdata[CS_HRES_COARSE].clock_mode = __arch_get_clock_mode(tk);
6025 + vdata[CS_RAW].clock_mode = __arch_get_clock_mode(tk);
6026 +
6027 ++ /* CLOCK_REALTIME also required for time() */
6028 ++ vdso_ts = &vdata[CS_HRES_COARSE].basetime[CLOCK_REALTIME];
6029 ++ vdso_ts->sec = tk->xtime_sec;
6030 ++ vdso_ts->nsec = tk->tkr_mono.xtime_nsec;
6031 ++
6032 + /* CLOCK_REALTIME_COARSE */
6033 + vdso_ts = &vdata[CS_HRES_COARSE].basetime[CLOCK_REALTIME_COARSE];
6034 + vdso_ts->sec = tk->xtime_sec;
6035 +@@ -110,7 +96,18 @@ void update_vsyscall(struct timekeeper *tk)
6036 + nsec = nsec + tk->wall_to_monotonic.tv_nsec;
6037 + vdso_ts->sec += __iter_div_u64_rem(nsec, NSEC_PER_SEC, &vdso_ts->nsec);
6038 +
6039 +- update_vdso_data(vdata, tk);
6040 ++ /*
6041 ++ * Read without the seqlock held by clock_getres().
6042 ++ * Note: No need to have a second copy.
6043 ++ */
6044 ++ WRITE_ONCE(vdata[CS_HRES_COARSE].hrtimer_res, hrtimer_resolution);
6045 ++
6046 ++ /*
6047 ++ * Architectures can opt out of updating the high resolution part
6048 ++ * of the VDSO.
6049 ++ */
6050 ++ if (__arch_update_vdso_data())
6051 ++ update_vdso_data(vdata, tk);
6052 +
6053 + __arch_update_vsyscall(vdata, tk);
6054 +
6055 +diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c
6056 +index 2d6e93ab0478..4b2ad374167b 100644
6057 +--- a/kernel/trace/blktrace.c
6058 ++++ b/kernel/trace/blktrace.c
6059 +@@ -336,6 +336,7 @@ static void put_probe_ref(void)
6060 +
6061 + static void blk_trace_cleanup(struct blk_trace *bt)
6062 + {
6063 ++ synchronize_rcu();
6064 + blk_trace_free(bt);
6065 + put_probe_ref();
6066 + }
6067 +@@ -630,8 +631,10 @@ static int compat_blk_trace_setup(struct request_queue *q, char *name,
6068 + static int __blk_trace_startstop(struct request_queue *q, int start)
6069 + {
6070 + int ret;
6071 +- struct blk_trace *bt = q->blk_trace;
6072 ++ struct blk_trace *bt;
6073 +
6074 ++ bt = rcu_dereference_protected(q->blk_trace,
6075 ++ lockdep_is_held(&q->blk_trace_mutex));
6076 + if (bt == NULL)
6077 + return -EINVAL;
6078 +
6079 +@@ -741,8 +744,8 @@ int blk_trace_ioctl(struct block_device *bdev, unsigned cmd, char __user *arg)
6080 + void blk_trace_shutdown(struct request_queue *q)
6081 + {
6082 + mutex_lock(&q->blk_trace_mutex);
6083 +-
6084 +- if (q->blk_trace) {
6085 ++ if (rcu_dereference_protected(q->blk_trace,
6086 ++ lockdep_is_held(&q->blk_trace_mutex))) {
6087 + __blk_trace_startstop(q, 0);
6088 + __blk_trace_remove(q);
6089 + }
6090 +@@ -754,8 +757,10 @@ void blk_trace_shutdown(struct request_queue *q)
6091 + static union kernfs_node_id *
6092 + blk_trace_bio_get_cgid(struct request_queue *q, struct bio *bio)
6093 + {
6094 +- struct blk_trace *bt = q->blk_trace;
6095 ++ struct blk_trace *bt;
6096 +
6097 ++ /* We don't use the 'bt' value here except as an optimization... */
6098 ++ bt = rcu_dereference_protected(q->blk_trace, 1);
6099 + if (!bt || !(blk_tracer_flags.val & TRACE_BLK_OPT_CGROUP))
6100 + return NULL;
6101 +
6102 +@@ -800,10 +805,14 @@ static void blk_add_trace_rq(struct request *rq, int error,
6103 + unsigned int nr_bytes, u32 what,
6104 + union kernfs_node_id *cgid)
6105 + {
6106 +- struct blk_trace *bt = rq->q->blk_trace;
6107 ++ struct blk_trace *bt;
6108 +
6109 +- if (likely(!bt))
6110 ++ rcu_read_lock();
6111 ++ bt = rcu_dereference(rq->q->blk_trace);
6112 ++ if (likely(!bt)) {
6113 ++ rcu_read_unlock();
6114 + return;
6115 ++ }
6116 +
6117 + if (blk_rq_is_passthrough(rq))
6118 + what |= BLK_TC_ACT(BLK_TC_PC);
6119 +@@ -812,6 +821,7 @@ static void blk_add_trace_rq(struct request *rq, int error,
6120 +
6121 + __blk_add_trace(bt, blk_rq_trace_sector(rq), nr_bytes, req_op(rq),
6122 + rq->cmd_flags, what, error, 0, NULL, cgid);
6123 ++ rcu_read_unlock();
6124 + }
6125 +
6126 + static void blk_add_trace_rq_insert(void *ignore,
6127 +@@ -857,14 +867,19 @@ static void blk_add_trace_rq_complete(void *ignore, struct request *rq,
6128 + static void blk_add_trace_bio(struct request_queue *q, struct bio *bio,
6129 + u32 what, int error)
6130 + {
6131 +- struct blk_trace *bt = q->blk_trace;
6132 ++ struct blk_trace *bt;
6133 +
6134 +- if (likely(!bt))
6135 ++ rcu_read_lock();
6136 ++ bt = rcu_dereference(q->blk_trace);
6137 ++ if (likely(!bt)) {
6138 ++ rcu_read_unlock();
6139 + return;
6140 ++ }
6141 +
6142 + __blk_add_trace(bt, bio->bi_iter.bi_sector, bio->bi_iter.bi_size,
6143 + bio_op(bio), bio->bi_opf, what, error, 0, NULL,
6144 + blk_trace_bio_get_cgid(q, bio));
6145 ++ rcu_read_unlock();
6146 + }
6147 +
6148 + static void blk_add_trace_bio_bounce(void *ignore,
6149 +@@ -909,11 +924,14 @@ static void blk_add_trace_getrq(void *ignore,
6150 + if (bio)
6151 + blk_add_trace_bio(q, bio, BLK_TA_GETRQ, 0);
6152 + else {
6153 +- struct blk_trace *bt = q->blk_trace;
6154 ++ struct blk_trace *bt;
6155 +
6156 ++ rcu_read_lock();
6157 ++ bt = rcu_dereference(q->blk_trace);
6158 + if (bt)
6159 + __blk_add_trace(bt, 0, 0, rw, 0, BLK_TA_GETRQ, 0, 0,
6160 + NULL, NULL);
6161 ++ rcu_read_unlock();
6162 + }
6163 + }
6164 +
6165 +@@ -925,27 +943,35 @@ static void blk_add_trace_sleeprq(void *ignore,
6166 + if (bio)
6167 + blk_add_trace_bio(q, bio, BLK_TA_SLEEPRQ, 0);
6168 + else {
6169 +- struct blk_trace *bt = q->blk_trace;
6170 ++ struct blk_trace *bt;
6171 +
6172 ++ rcu_read_lock();
6173 ++ bt = rcu_dereference(q->blk_trace);
6174 + if (bt)
6175 + __blk_add_trace(bt, 0, 0, rw, 0, BLK_TA_SLEEPRQ,
6176 + 0, 0, NULL, NULL);
6177 ++ rcu_read_unlock();
6178 + }
6179 + }
6180 +
6181 + static void blk_add_trace_plug(void *ignore, struct request_queue *q)
6182 + {
6183 +- struct blk_trace *bt = q->blk_trace;
6184 ++ struct blk_trace *bt;
6185 +
6186 ++ rcu_read_lock();
6187 ++ bt = rcu_dereference(q->blk_trace);
6188 + if (bt)
6189 + __blk_add_trace(bt, 0, 0, 0, 0, BLK_TA_PLUG, 0, 0, NULL, NULL);
6190 ++ rcu_read_unlock();
6191 + }
6192 +
6193 + static void blk_add_trace_unplug(void *ignore, struct request_queue *q,
6194 + unsigned int depth, bool explicit)
6195 + {
6196 +- struct blk_trace *bt = q->blk_trace;
6197 ++ struct blk_trace *bt;
6198 +
6199 ++ rcu_read_lock();
6200 ++ bt = rcu_dereference(q->blk_trace);
6201 + if (bt) {
6202 + __be64 rpdu = cpu_to_be64(depth);
6203 + u32 what;
6204 +@@ -957,14 +983,17 @@ static void blk_add_trace_unplug(void *ignore, struct request_queue *q,
6205 +
6206 + __blk_add_trace(bt, 0, 0, 0, 0, what, 0, sizeof(rpdu), &rpdu, NULL);
6207 + }
6208 ++ rcu_read_unlock();
6209 + }
6210 +
6211 + static void blk_add_trace_split(void *ignore,
6212 + struct request_queue *q, struct bio *bio,
6213 + unsigned int pdu)
6214 + {
6215 +- struct blk_trace *bt = q->blk_trace;
6216 ++ struct blk_trace *bt;
6217 +
6218 ++ rcu_read_lock();
6219 ++ bt = rcu_dereference(q->blk_trace);
6220 + if (bt) {
6221 + __be64 rpdu = cpu_to_be64(pdu);
6222 +
6223 +@@ -973,6 +1002,7 @@ static void blk_add_trace_split(void *ignore,
6224 + BLK_TA_SPLIT, bio->bi_status, sizeof(rpdu),
6225 + &rpdu, blk_trace_bio_get_cgid(q, bio));
6226 + }
6227 ++ rcu_read_unlock();
6228 + }
6229 +
6230 + /**
6231 +@@ -992,11 +1022,15 @@ static void blk_add_trace_bio_remap(void *ignore,
6232 + struct request_queue *q, struct bio *bio,
6233 + dev_t dev, sector_t from)
6234 + {
6235 +- struct blk_trace *bt = q->blk_trace;
6236 ++ struct blk_trace *bt;
6237 + struct blk_io_trace_remap r;
6238 +
6239 +- if (likely(!bt))
6240 ++ rcu_read_lock();
6241 ++ bt = rcu_dereference(q->blk_trace);
6242 ++ if (likely(!bt)) {
6243 ++ rcu_read_unlock();
6244 + return;
6245 ++ }
6246 +
6247 + r.device_from = cpu_to_be32(dev);
6248 + r.device_to = cpu_to_be32(bio_dev(bio));
6249 +@@ -1005,6 +1039,7 @@ static void blk_add_trace_bio_remap(void *ignore,
6250 + __blk_add_trace(bt, bio->bi_iter.bi_sector, bio->bi_iter.bi_size,
6251 + bio_op(bio), bio->bi_opf, BLK_TA_REMAP, bio->bi_status,
6252 + sizeof(r), &r, blk_trace_bio_get_cgid(q, bio));
6253 ++ rcu_read_unlock();
6254 + }
6255 +
6256 + /**
6257 +@@ -1025,11 +1060,15 @@ static void blk_add_trace_rq_remap(void *ignore,
6258 + struct request *rq, dev_t dev,
6259 + sector_t from)
6260 + {
6261 +- struct blk_trace *bt = q->blk_trace;
6262 ++ struct blk_trace *bt;
6263 + struct blk_io_trace_remap r;
6264 +
6265 +- if (likely(!bt))
6266 ++ rcu_read_lock();
6267 ++ bt = rcu_dereference(q->blk_trace);
6268 ++ if (likely(!bt)) {
6269 ++ rcu_read_unlock();
6270 + return;
6271 ++ }
6272 +
6273 + r.device_from = cpu_to_be32(dev);
6274 + r.device_to = cpu_to_be32(disk_devt(rq->rq_disk));
6275 +@@ -1038,6 +1077,7 @@ static void blk_add_trace_rq_remap(void *ignore,
6276 + __blk_add_trace(bt, blk_rq_pos(rq), blk_rq_bytes(rq),
6277 + rq_data_dir(rq), 0, BLK_TA_REMAP, 0,
6278 + sizeof(r), &r, blk_trace_request_get_cgid(q, rq));
6279 ++ rcu_read_unlock();
6280 + }
6281 +
6282 + /**
6283 +@@ -1055,14 +1095,19 @@ void blk_add_driver_data(struct request_queue *q,
6284 + struct request *rq,
6285 + void *data, size_t len)
6286 + {
6287 +- struct blk_trace *bt = q->blk_trace;
6288 ++ struct blk_trace *bt;
6289 +
6290 +- if (likely(!bt))
6291 ++ rcu_read_lock();
6292 ++ bt = rcu_dereference(q->blk_trace);
6293 ++ if (likely(!bt)) {
6294 ++ rcu_read_unlock();
6295 + return;
6296 ++ }
6297 +
6298 + __blk_add_trace(bt, blk_rq_trace_sector(rq), blk_rq_bytes(rq), 0, 0,
6299 + BLK_TA_DRV_DATA, 0, len, data,
6300 + blk_trace_request_get_cgid(q, rq));
6301 ++ rcu_read_unlock();
6302 + }
6303 + EXPORT_SYMBOL_GPL(blk_add_driver_data);
6304 +
6305 +@@ -1589,6 +1634,7 @@ static int blk_trace_remove_queue(struct request_queue *q)
6306 + return -EINVAL;
6307 +
6308 + put_probe_ref();
6309 ++ synchronize_rcu();
6310 + blk_trace_free(bt);
6311 + return 0;
6312 + }
6313 +@@ -1750,6 +1796,7 @@ static ssize_t sysfs_blk_trace_attr_show(struct device *dev,
6314 + struct hd_struct *p = dev_to_part(dev);
6315 + struct request_queue *q;
6316 + struct block_device *bdev;
6317 ++ struct blk_trace *bt;
6318 + ssize_t ret = -ENXIO;
6319 +
6320 + bdev = bdget(part_devt(p));
6321 +@@ -1762,21 +1809,23 @@ static ssize_t sysfs_blk_trace_attr_show(struct device *dev,
6322 +
6323 + mutex_lock(&q->blk_trace_mutex);
6324 +
6325 ++ bt = rcu_dereference_protected(q->blk_trace,
6326 ++ lockdep_is_held(&q->blk_trace_mutex));
6327 + if (attr == &dev_attr_enable) {
6328 +- ret = sprintf(buf, "%u\n", !!q->blk_trace);
6329 ++ ret = sprintf(buf, "%u\n", !!bt);
6330 + goto out_unlock_bdev;
6331 + }
6332 +
6333 +- if (q->blk_trace == NULL)
6334 ++ if (bt == NULL)
6335 + ret = sprintf(buf, "disabled\n");
6336 + else if (attr == &dev_attr_act_mask)
6337 +- ret = blk_trace_mask2str(buf, q->blk_trace->act_mask);
6338 ++ ret = blk_trace_mask2str(buf, bt->act_mask);
6339 + else if (attr == &dev_attr_pid)
6340 +- ret = sprintf(buf, "%u\n", q->blk_trace->pid);
6341 ++ ret = sprintf(buf, "%u\n", bt->pid);
6342 + else if (attr == &dev_attr_start_lba)
6343 +- ret = sprintf(buf, "%llu\n", q->blk_trace->start_lba);
6344 ++ ret = sprintf(buf, "%llu\n", bt->start_lba);
6345 + else if (attr == &dev_attr_end_lba)
6346 +- ret = sprintf(buf, "%llu\n", q->blk_trace->end_lba);
6347 ++ ret = sprintf(buf, "%llu\n", bt->end_lba);
6348 +
6349 + out_unlock_bdev:
6350 + mutex_unlock(&q->blk_trace_mutex);
6351 +@@ -1793,6 +1842,7 @@ static ssize_t sysfs_blk_trace_attr_store(struct device *dev,
6352 + struct block_device *bdev;
6353 + struct request_queue *q;
6354 + struct hd_struct *p;
6355 ++ struct blk_trace *bt;
6356 + u64 value;
6357 + ssize_t ret = -EINVAL;
6358 +
6359 +@@ -1823,8 +1873,10 @@ static ssize_t sysfs_blk_trace_attr_store(struct device *dev,
6360 +
6361 + mutex_lock(&q->blk_trace_mutex);
6362 +
6363 ++ bt = rcu_dereference_protected(q->blk_trace,
6364 ++ lockdep_is_held(&q->blk_trace_mutex));
6365 + if (attr == &dev_attr_enable) {
6366 +- if (!!value == !!q->blk_trace) {
6367 ++ if (!!value == !!bt) {
6368 + ret = 0;
6369 + goto out_unlock_bdev;
6370 + }
6371 +@@ -1836,18 +1888,18 @@ static ssize_t sysfs_blk_trace_attr_store(struct device *dev,
6372 + }
6373 +
6374 + ret = 0;
6375 +- if (q->blk_trace == NULL)
6376 ++ if (bt == NULL)
6377 + ret = blk_trace_setup_queue(q, bdev);
6378 +
6379 + if (ret == 0) {
6380 + if (attr == &dev_attr_act_mask)
6381 +- q->blk_trace->act_mask = value;
6382 ++ bt->act_mask = value;
6383 + else if (attr == &dev_attr_pid)
6384 +- q->blk_trace->pid = value;
6385 ++ bt->pid = value;
6386 + else if (attr == &dev_attr_start_lba)
6387 +- q->blk_trace->start_lba = value;
6388 ++ bt->start_lba = value;
6389 + else if (attr == &dev_attr_end_lba)
6390 +- q->blk_trace->end_lba = value;
6391 ++ bt->end_lba = value;
6392 + }
6393 +
6394 + out_unlock_bdev:
6395 +diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
6396 +index 341aab32c946..c6ccaf6c62f7 100644
6397 +--- a/kernel/trace/trace.c
6398 ++++ b/kernel/trace/trace.c
6399 +@@ -1743,6 +1743,7 @@ static __init int init_trace_selftests(void)
6400 +
6401 + pr_info("Running postponed tracer tests:\n");
6402 +
6403 ++ tracing_selftest_running = true;
6404 + list_for_each_entry_safe(p, n, &postponed_selftests, list) {
6405 + /* This loop can take minutes when sanitizers are enabled, so
6406 + * lets make sure we allow RCU processing.
6407 +@@ -1765,6 +1766,7 @@ static __init int init_trace_selftests(void)
6408 + list_del(&p->list);
6409 + kfree(p);
6410 + }
6411 ++ tracing_selftest_running = false;
6412 +
6413 + out:
6414 + mutex_unlock(&trace_types_lock);
6415 +diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
6416 +index 93d97f9b0157..f61d834e02fe 100644
6417 +--- a/lib/Kconfig.debug
6418 ++++ b/lib/Kconfig.debug
6419 +@@ -299,17 +299,6 @@ config HEADERS_INSTALL
6420 + user-space program samples. It is also needed by some features such
6421 + as uapi header sanity checks.
6422 +
6423 +-config HEADERS_CHECK
6424 +- bool "Run sanity checks on uapi headers when building 'all'"
6425 +- depends on HEADERS_INSTALL
6426 +- help
6427 +- This option will run basic sanity checks on uapi headers when
6428 +- building the 'all' target, for example, ensure that they do not
6429 +- attempt to include files which were not exported, etc.
6430 +-
6431 +- If you're making modifications to header files which are
6432 +- relevant for userspace, say 'Y'.
6433 +-
6434 + config OPTIMIZE_INLINING
6435 + def_bool y
6436 + help
6437 +diff --git a/mm/debug.c b/mm/debug.c
6438 +index 0461df1207cb..6a52316af839 100644
6439 +--- a/mm/debug.c
6440 ++++ b/mm/debug.c
6441 +@@ -47,6 +47,7 @@ void __dump_page(struct page *page, const char *reason)
6442 + struct address_space *mapping;
6443 + bool page_poisoned = PagePoisoned(page);
6444 + int mapcount;
6445 ++ char *type = "";
6446 +
6447 + /*
6448 + * If struct page is poisoned don't access Page*() functions as that
6449 +@@ -78,9 +79,9 @@ void __dump_page(struct page *page, const char *reason)
6450 + page, page_ref_count(page), mapcount,
6451 + page->mapping, page_to_pgoff(page));
6452 + if (PageKsm(page))
6453 +- pr_warn("ksm flags: %#lx(%pGp)\n", page->flags, &page->flags);
6454 ++ type = "ksm ";
6455 + else if (PageAnon(page))
6456 +- pr_warn("anon flags: %#lx(%pGp)\n", page->flags, &page->flags);
6457 ++ type = "anon ";
6458 + else if (mapping) {
6459 + if (mapping->host && mapping->host->i_dentry.first) {
6460 + struct dentry *dentry;
6461 +@@ -88,10 +89,11 @@ void __dump_page(struct page *page, const char *reason)
6462 + pr_warn("%ps name:\"%pd\"\n", mapping->a_ops, dentry);
6463 + } else
6464 + pr_warn("%ps\n", mapping->a_ops);
6465 +- pr_warn("flags: %#lx(%pGp)\n", page->flags, &page->flags);
6466 + }
6467 + BUILD_BUG_ON(ARRAY_SIZE(pageflag_names) != __NR_PAGEFLAGS + 1);
6468 +
6469 ++ pr_warn("%sflags: %#lx(%pGp)\n", type, page->flags, &page->flags);
6470 ++
6471 + hex_only:
6472 + print_hex_dump(KERN_WARNING, "raw: ", DUMP_PREFIX_NONE, 32,
6473 + sizeof(unsigned long), page,
6474 +diff --git a/mm/gup.c b/mm/gup.c
6475 +index 8f236a335ae9..745b4036cdfd 100644
6476 +--- a/mm/gup.c
6477 ++++ b/mm/gup.c
6478 +@@ -2401,7 +2401,8 @@ int get_user_pages_fast(unsigned long start, int nr_pages,
6479 + unsigned long addr, len, end;
6480 + int nr = 0, ret = 0;
6481 +
6482 +- if (WARN_ON_ONCE(gup_flags & ~(FOLL_WRITE | FOLL_LONGTERM)))
6483 ++ if (WARN_ON_ONCE(gup_flags & ~(FOLL_WRITE | FOLL_LONGTERM |
6484 ++ FOLL_FORCE)))
6485 + return -EINVAL;
6486 +
6487 + start = untagged_addr(start) & PAGE_MASK;
6488 +diff --git a/mm/huge_memory.c b/mm/huge_memory.c
6489 +index 1de7f53621a0..6c9689281c07 100644
6490 +--- a/mm/huge_memory.c
6491 ++++ b/mm/huge_memory.c
6492 +@@ -177,16 +177,13 @@ static ssize_t enabled_store(struct kobject *kobj,
6493 + {
6494 + ssize_t ret = count;
6495 +
6496 +- if (!memcmp("always", buf,
6497 +- min(sizeof("always")-1, count))) {
6498 ++ if (sysfs_streq(buf, "always")) {
6499 + clear_bit(TRANSPARENT_HUGEPAGE_REQ_MADV_FLAG, &transparent_hugepage_flags);
6500 + set_bit(TRANSPARENT_HUGEPAGE_FLAG, &transparent_hugepage_flags);
6501 +- } else if (!memcmp("madvise", buf,
6502 +- min(sizeof("madvise")-1, count))) {
6503 ++ } else if (sysfs_streq(buf, "madvise")) {
6504 + clear_bit(TRANSPARENT_HUGEPAGE_FLAG, &transparent_hugepage_flags);
6505 + set_bit(TRANSPARENT_HUGEPAGE_REQ_MADV_FLAG, &transparent_hugepage_flags);
6506 +- } else if (!memcmp("never", buf,
6507 +- min(sizeof("never")-1, count))) {
6508 ++ } else if (sysfs_streq(buf, "never")) {
6509 + clear_bit(TRANSPARENT_HUGEPAGE_FLAG, &transparent_hugepage_flags);
6510 + clear_bit(TRANSPARENT_HUGEPAGE_REQ_MADV_FLAG, &transparent_hugepage_flags);
6511 + } else
6512 +@@ -250,32 +247,27 @@ static ssize_t defrag_store(struct kobject *kobj,
6513 + struct kobj_attribute *attr,
6514 + const char *buf, size_t count)
6515 + {
6516 +- if (!memcmp("always", buf,
6517 +- min(sizeof("always")-1, count))) {
6518 ++ if (sysfs_streq(buf, "always")) {
6519 + clear_bit(TRANSPARENT_HUGEPAGE_DEFRAG_KSWAPD_FLAG, &transparent_hugepage_flags);
6520 + clear_bit(TRANSPARENT_HUGEPAGE_DEFRAG_KSWAPD_OR_MADV_FLAG, &transparent_hugepage_flags);
6521 + clear_bit(TRANSPARENT_HUGEPAGE_DEFRAG_REQ_MADV_FLAG, &transparent_hugepage_flags);
6522 + set_bit(TRANSPARENT_HUGEPAGE_DEFRAG_DIRECT_FLAG, &transparent_hugepage_flags);
6523 +- } else if (!memcmp("defer+madvise", buf,
6524 +- min(sizeof("defer+madvise")-1, count))) {
6525 ++ } else if (sysfs_streq(buf, "defer+madvise")) {
6526 + clear_bit(TRANSPARENT_HUGEPAGE_DEFRAG_DIRECT_FLAG, &transparent_hugepage_flags);
6527 + clear_bit(TRANSPARENT_HUGEPAGE_DEFRAG_KSWAPD_FLAG, &transparent_hugepage_flags);
6528 + clear_bit(TRANSPARENT_HUGEPAGE_DEFRAG_REQ_MADV_FLAG, &transparent_hugepage_flags);
6529 + set_bit(TRANSPARENT_HUGEPAGE_DEFRAG_KSWAPD_OR_MADV_FLAG, &transparent_hugepage_flags);
6530 +- } else if (!memcmp("defer", buf,
6531 +- min(sizeof("defer")-1, count))) {
6532 ++ } else if (sysfs_streq(buf, "defer")) {
6533 + clear_bit(TRANSPARENT_HUGEPAGE_DEFRAG_DIRECT_FLAG, &transparent_hugepage_flags);
6534 + clear_bit(TRANSPARENT_HUGEPAGE_DEFRAG_KSWAPD_OR_MADV_FLAG, &transparent_hugepage_flags);
6535 + clear_bit(TRANSPARENT_HUGEPAGE_DEFRAG_REQ_MADV_FLAG, &transparent_hugepage_flags);
6536 + set_bit(TRANSPARENT_HUGEPAGE_DEFRAG_KSWAPD_FLAG, &transparent_hugepage_flags);
6537 +- } else if (!memcmp("madvise", buf,
6538 +- min(sizeof("madvise")-1, count))) {
6539 ++ } else if (sysfs_streq(buf, "madvise")) {
6540 + clear_bit(TRANSPARENT_HUGEPAGE_DEFRAG_DIRECT_FLAG, &transparent_hugepage_flags);
6541 + clear_bit(TRANSPARENT_HUGEPAGE_DEFRAG_KSWAPD_FLAG, &transparent_hugepage_flags);
6542 + clear_bit(TRANSPARENT_HUGEPAGE_DEFRAG_KSWAPD_OR_MADV_FLAG, &transparent_hugepage_flags);
6543 + set_bit(TRANSPARENT_HUGEPAGE_DEFRAG_REQ_MADV_FLAG, &transparent_hugepage_flags);
6544 +- } else if (!memcmp("never", buf,
6545 +- min(sizeof("never")-1, count))) {
6546 ++ } else if (sysfs_streq(buf, "never")) {
6547 + clear_bit(TRANSPARENT_HUGEPAGE_DEFRAG_DIRECT_FLAG, &transparent_hugepage_flags);
6548 + clear_bit(TRANSPARENT_HUGEPAGE_DEFRAG_KSWAPD_FLAG, &transparent_hugepage_flags);
6549 + clear_bit(TRANSPARENT_HUGEPAGE_DEFRAG_KSWAPD_OR_MADV_FLAG, &transparent_hugepage_flags);
6550 +@@ -2712,7 +2704,7 @@ int split_huge_page_to_list(struct page *page, struct list_head *list)
6551 + unsigned long flags;
6552 + pgoff_t end;
6553 +
6554 +- VM_BUG_ON_PAGE(is_huge_zero_page(page), page);
6555 ++ VM_BUG_ON_PAGE(is_huge_zero_page(head), head);
6556 + VM_BUG_ON_PAGE(!PageLocked(page), page);
6557 + VM_BUG_ON_PAGE(!PageCompound(page), page);
6558 +
6559 +diff --git a/net/core/dev.c b/net/core/dev.c
6560 +index a7e2e57af63a..db8c229e0f4a 100644
6561 +--- a/net/core/dev.c
6562 ++++ b/net/core/dev.c
6563 +@@ -146,7 +146,6 @@
6564 + #include "net-sysfs.h"
6565 +
6566 + #define MAX_GRO_SKBS 8
6567 +-#define MAX_NEST_DEV 8
6568 +
6569 + /* This should be increased if a protocol with a bigger head is added. */
6570 + #define GRO_MAX_HEAD (MAX_HEADER + 128)
6571 +@@ -3386,26 +3385,8 @@ static inline int __dev_xmit_skb(struct sk_buff *skb, struct Qdisc *q,
6572 + qdisc_calculate_pkt_len(skb, q);
6573 +
6574 + if (q->flags & TCQ_F_NOLOCK) {
6575 +- if ((q->flags & TCQ_F_CAN_BYPASS) && READ_ONCE(q->empty) &&
6576 +- qdisc_run_begin(q)) {
6577 +- if (unlikely(test_bit(__QDISC_STATE_DEACTIVATED,
6578 +- &q->state))) {
6579 +- __qdisc_drop(skb, &to_free);
6580 +- rc = NET_XMIT_DROP;
6581 +- goto end_run;
6582 +- }
6583 +- qdisc_bstats_cpu_update(q, skb);
6584 +-
6585 +- rc = NET_XMIT_SUCCESS;
6586 +- if (sch_direct_xmit(skb, q, dev, txq, NULL, true))
6587 +- __qdisc_run(q);
6588 +-
6589 +-end_run:
6590 +- qdisc_run_end(q);
6591 +- } else {
6592 +- rc = q->enqueue(skb, q, &to_free) & NET_XMIT_MASK;
6593 +- qdisc_run(q);
6594 +- }
6595 ++ rc = q->enqueue(skb, q, &to_free) & NET_XMIT_MASK;
6596 ++ qdisc_run(q);
6597 +
6598 + if (unlikely(to_free))
6599 + kfree_skb_list(to_free);
6600 +@@ -6932,8 +6913,8 @@ static int __netdev_walk_all_lower_dev(struct net_device *dev,
6601 + return 0;
6602 + }
6603 +
6604 +-static struct net_device *netdev_next_lower_dev_rcu(struct net_device *dev,
6605 +- struct list_head **iter)
6606 ++struct net_device *netdev_next_lower_dev_rcu(struct net_device *dev,
6607 ++ struct list_head **iter)
6608 + {
6609 + struct netdev_adjacent *lower;
6610 +
6611 +@@ -6945,6 +6926,7 @@ static struct net_device *netdev_next_lower_dev_rcu(struct net_device *dev,
6612 +
6613 + return lower->dev;
6614 + }
6615 ++EXPORT_SYMBOL(netdev_next_lower_dev_rcu);
6616 +
6617 + static u8 __netdev_upper_depth(struct net_device *dev)
6618 + {
6619 +diff --git a/net/core/fib_rules.c b/net/core/fib_rules.c
6620 +index dd220ce7ca7a..bb11fc87bbae 100644
6621 +--- a/net/core/fib_rules.c
6622 ++++ b/net/core/fib_rules.c
6623 +@@ -967,7 +967,7 @@ static int fib_nl_fill_rule(struct sk_buff *skb, struct fib_rule *rule,
6624 +
6625 + frh = nlmsg_data(nlh);
6626 + frh->family = ops->family;
6627 +- frh->table = rule->table;
6628 ++ frh->table = rule->table < 256 ? rule->table : RT_TABLE_COMPAT;
6629 + if (nla_put_u32(skb, FRA_TABLE, rule->table))
6630 + goto nla_put_failure;
6631 + if (nla_put_u32(skb, FRA_SUPPRESS_PREFIXLEN, rule->suppress_prefixlen))
6632 +diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
6633 +index 7ae7065758bd..f3b7cb725c1b 100644
6634 +--- a/net/ipv4/udp.c
6635 ++++ b/net/ipv4/udp.c
6636 +@@ -1856,8 +1856,12 @@ int __udp_disconnect(struct sock *sk, int flags)
6637 + inet->inet_dport = 0;
6638 + sock_rps_reset_rxhash(sk);
6639 + sk->sk_bound_dev_if = 0;
6640 +- if (!(sk->sk_userlocks & SOCK_BINDADDR_LOCK))
6641 ++ if (!(sk->sk_userlocks & SOCK_BINDADDR_LOCK)) {
6642 + inet_reset_saddr(sk);
6643 ++ if (sk->sk_prot->rehash &&
6644 ++ (sk->sk_userlocks & SOCK_BINDPORT_LOCK))
6645 ++ sk->sk_prot->rehash(sk);
6646 ++ }
6647 +
6648 + if (!(sk->sk_userlocks & SOCK_BINDPORT_LOCK)) {
6649 + sk->sk_prot->unhash(sk);
6650 +diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c
6651 +index 6e2af411cd9c..c75274e0745c 100644
6652 +--- a/net/ipv6/ip6_fib.c
6653 ++++ b/net/ipv6/ip6_fib.c
6654 +@@ -1050,8 +1050,7 @@ static int fib6_add_rt2node(struct fib6_node *fn, struct fib6_info *rt,
6655 + found++;
6656 + break;
6657 + }
6658 +- if (rt_can_ecmp)
6659 +- fallback_ins = fallback_ins ?: ins;
6660 ++ fallback_ins = fallback_ins ?: ins;
6661 + goto next_iter;
6662 + }
6663 +
6664 +@@ -1094,7 +1093,9 @@ next_iter:
6665 + }
6666 +
6667 + if (fallback_ins && !found) {
6668 +- /* No ECMP-able route found, replace first non-ECMP one */
6669 ++ /* No matching route with same ecmp-able-ness found, replace
6670 ++ * first matching route
6671 ++ */
6672 + ins = fallback_ins;
6673 + iter = rcu_dereference_protected(*ins,
6674 + lockdep_is_held(&rt->fib6_table->tb6_lock));
6675 +diff --git a/net/ipv6/route.c b/net/ipv6/route.c
6676 +index e4ed9c7b43b0..894c7370c1bd 100644
6677 +--- a/net/ipv6/route.c
6678 ++++ b/net/ipv6/route.c
6679 +@@ -5155,6 +5155,7 @@ static int ip6_route_multipath_add(struct fib6_config *cfg,
6680 + */
6681 + cfg->fc_nlinfo.nlh->nlmsg_flags &= ~(NLM_F_EXCL |
6682 + NLM_F_REPLACE);
6683 ++ cfg->fc_nlinfo.nlh->nlmsg_flags |= NLM_F_CREATE;
6684 + nhn++;
6685 + }
6686 +
6687 +diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
6688 +index 1e3b9d34aaa4..c7d8044ff0fa 100644
6689 +--- a/net/mac80211/mlme.c
6690 ++++ b/net/mac80211/mlme.c
6691 +@@ -2959,7 +2959,7 @@ static void ieee80211_rx_mgmt_auth(struct ieee80211_sub_if_data *sdata,
6692 + (auth_transaction == 2 &&
6693 + ifmgd->auth_data->expected_transaction == 2)) {
6694 + if (!ieee80211_mark_sta_auth(sdata, bssid))
6695 +- goto out_err;
6696 ++ return; /* ignore frame -- wait for timeout */
6697 + } else if (ifmgd->auth_data->algorithm == WLAN_AUTH_SAE &&
6698 + auth_transaction == 2) {
6699 + sdata_info(sdata, "SAE peer confirmed\n");
6700 +@@ -2967,10 +2967,6 @@ static void ieee80211_rx_mgmt_auth(struct ieee80211_sub_if_data *sdata,
6701 + }
6702 +
6703 + cfg80211_rx_mlme_mgmt(sdata->dev, (u8 *)mgmt, len);
6704 +- return;
6705 +- out_err:
6706 +- mutex_unlock(&sdata->local->sta_mtx);
6707 +- /* ignore frame -- wait for timeout */
6708 + }
6709 +
6710 + #define case_WLAN(type) \
6711 +diff --git a/net/mac80211/util.c b/net/mac80211/util.c
6712 +index 32a7a53833c0..decd46b38393 100644
6713 +--- a/net/mac80211/util.c
6714 ++++ b/net/mac80211/util.c
6715 +@@ -1063,16 +1063,22 @@ _ieee802_11_parse_elems_crc(const u8 *start, size_t len, bool action,
6716 + elem_parse_failed = true;
6717 + break;
6718 + case WLAN_EID_VHT_OPERATION:
6719 +- if (elen >= sizeof(struct ieee80211_vht_operation))
6720 ++ if (elen >= sizeof(struct ieee80211_vht_operation)) {
6721 + elems->vht_operation = (void *)pos;
6722 +- else
6723 +- elem_parse_failed = true;
6724 ++ if (calc_crc)
6725 ++ crc = crc32_be(crc, pos - 2, elen + 2);
6726 ++ break;
6727 ++ }
6728 ++ elem_parse_failed = true;
6729 + break;
6730 + case WLAN_EID_OPMODE_NOTIF:
6731 +- if (elen > 0)
6732 ++ if (elen > 0) {
6733 + elems->opmode_notif = pos;
6734 +- else
6735 +- elem_parse_failed = true;
6736 ++ if (calc_crc)
6737 ++ crc = crc32_be(crc, pos - 2, elen + 2);
6738 ++ break;
6739 ++ }
6740 ++ elem_parse_failed = true;
6741 + break;
6742 + case WLAN_EID_MESH_ID:
6743 + elems->mesh_id = pos;
6744 +@@ -2987,10 +2993,22 @@ bool ieee80211_chandef_vht_oper(struct ieee80211_hw *hw,
6745 + int cf0, cf1;
6746 + int ccfs0, ccfs1, ccfs2;
6747 + int ccf0, ccf1;
6748 ++ u32 vht_cap;
6749 ++ bool support_80_80 = false;
6750 ++ bool support_160 = false;
6751 +
6752 + if (!oper || !htop)
6753 + return false;
6754 +
6755 ++ vht_cap = hw->wiphy->bands[chandef->chan->band]->vht_cap.cap;
6756 ++ support_160 = (vht_cap & (IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK |
6757 ++ IEEE80211_VHT_CAP_EXT_NSS_BW_MASK));
6758 ++ support_80_80 = ((vht_cap &
6759 ++ IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ) ||
6760 ++ (vht_cap & IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ &&
6761 ++ vht_cap & IEEE80211_VHT_CAP_EXT_NSS_BW_MASK) ||
6762 ++ ((vht_cap & IEEE80211_VHT_CAP_EXT_NSS_BW_MASK) >>
6763 ++ IEEE80211_VHT_CAP_EXT_NSS_BW_SHIFT > 1));
6764 + ccfs0 = oper->center_freq_seg0_idx;
6765 + ccfs1 = oper->center_freq_seg1_idx;
6766 + ccfs2 = (le16_to_cpu(htop->operation_mode) &
6767 +@@ -3018,10 +3036,10 @@ bool ieee80211_chandef_vht_oper(struct ieee80211_hw *hw,
6768 + unsigned int diff;
6769 +
6770 + diff = abs(ccf1 - ccf0);
6771 +- if (diff == 8) {
6772 ++ if ((diff == 8) && support_160) {
6773 + new.width = NL80211_CHAN_WIDTH_160;
6774 + new.center_freq1 = cf1;
6775 +- } else if (diff > 8) {
6776 ++ } else if ((diff > 8) && support_80_80) {
6777 + new.width = NL80211_CHAN_WIDTH_80P80;
6778 + new.center_freq2 = cf1;
6779 + }
6780 +diff --git a/net/netfilter/ipset/ip_set_core.c b/net/netfilter/ipset/ip_set_core.c
6781 +index a9df9dac57b2..75da200aa5d8 100644
6782 +--- a/net/netfilter/ipset/ip_set_core.c
6783 ++++ b/net/netfilter/ipset/ip_set_core.c
6784 +@@ -557,6 +557,20 @@ ip_set_rcu_get(struct net *net, ip_set_id_t index)
6785 + return set;
6786 + }
6787 +
6788 ++static inline void
6789 ++ip_set_lock(struct ip_set *set)
6790 ++{
6791 ++ if (!set->variant->region_lock)
6792 ++ spin_lock_bh(&set->lock);
6793 ++}
6794 ++
6795 ++static inline void
6796 ++ip_set_unlock(struct ip_set *set)
6797 ++{
6798 ++ if (!set->variant->region_lock)
6799 ++ spin_unlock_bh(&set->lock);
6800 ++}
6801 ++
6802 + int
6803 + ip_set_test(ip_set_id_t index, const struct sk_buff *skb,
6804 + const struct xt_action_param *par, struct ip_set_adt_opt *opt)
6805 +@@ -578,9 +592,9 @@ ip_set_test(ip_set_id_t index, const struct sk_buff *skb,
6806 + if (ret == -EAGAIN) {
6807 + /* Type requests element to be completed */
6808 + pr_debug("element must be completed, ADD is triggered\n");
6809 +- spin_lock_bh(&set->lock);
6810 ++ ip_set_lock(set);
6811 + set->variant->kadt(set, skb, par, IPSET_ADD, opt);
6812 +- spin_unlock_bh(&set->lock);
6813 ++ ip_set_unlock(set);
6814 + ret = 1;
6815 + } else {
6816 + /* --return-nomatch: invert matched element */
6817 +@@ -609,9 +623,9 @@ ip_set_add(ip_set_id_t index, const struct sk_buff *skb,
6818 + !(opt->family == set->family || set->family == NFPROTO_UNSPEC))
6819 + return -IPSET_ERR_TYPE_MISMATCH;
6820 +
6821 +- spin_lock_bh(&set->lock);
6822 ++ ip_set_lock(set);
6823 + ret = set->variant->kadt(set, skb, par, IPSET_ADD, opt);
6824 +- spin_unlock_bh(&set->lock);
6825 ++ ip_set_unlock(set);
6826 +
6827 + return ret;
6828 + }
6829 +@@ -631,9 +645,9 @@ ip_set_del(ip_set_id_t index, const struct sk_buff *skb,
6830 + !(opt->family == set->family || set->family == NFPROTO_UNSPEC))
6831 + return -IPSET_ERR_TYPE_MISMATCH;
6832 +
6833 +- spin_lock_bh(&set->lock);
6834 ++ ip_set_lock(set);
6835 + ret = set->variant->kadt(set, skb, par, IPSET_DEL, opt);
6836 +- spin_unlock_bh(&set->lock);
6837 ++ ip_set_unlock(set);
6838 +
6839 + return ret;
6840 + }
6841 +@@ -1098,9 +1112,9 @@ ip_set_flush_set(struct ip_set *set)
6842 + {
6843 + pr_debug("set: %s\n", set->name);
6844 +
6845 +- spin_lock_bh(&set->lock);
6846 ++ ip_set_lock(set);
6847 + set->variant->flush(set);
6848 +- spin_unlock_bh(&set->lock);
6849 ++ ip_set_unlock(set);
6850 + }
6851 +
6852 + static int ip_set_flush(struct net *net, struct sock *ctnl, struct sk_buff *skb,
6853 +@@ -1523,9 +1537,9 @@ call_ad(struct sock *ctnl, struct sk_buff *skb, struct ip_set *set,
6854 + bool eexist = flags & IPSET_FLAG_EXIST, retried = false;
6855 +
6856 + do {
6857 +- spin_lock_bh(&set->lock);
6858 ++ ip_set_lock(set);
6859 + ret = set->variant->uadt(set, tb, adt, &lineno, flags, retried);
6860 +- spin_unlock_bh(&set->lock);
6861 ++ ip_set_unlock(set);
6862 + retried = true;
6863 + } while (ret == -EAGAIN &&
6864 + set->variant->resize &&
6865 +diff --git a/net/netfilter/ipset/ip_set_hash_gen.h b/net/netfilter/ipset/ip_set_hash_gen.h
6866 +index d098d87bc331..2389c9f89e48 100644
6867 +--- a/net/netfilter/ipset/ip_set_hash_gen.h
6868 ++++ b/net/netfilter/ipset/ip_set_hash_gen.h
6869 +@@ -7,13 +7,21 @@
6870 + #include <linux/rcupdate.h>
6871 + #include <linux/jhash.h>
6872 + #include <linux/types.h>
6873 ++#include <linux/netfilter/nfnetlink.h>
6874 + #include <linux/netfilter/ipset/ip_set.h>
6875 +
6876 +-#define __ipset_dereference_protected(p, c) rcu_dereference_protected(p, c)
6877 +-#define ipset_dereference_protected(p, set) \
6878 +- __ipset_dereference_protected(p, lockdep_is_held(&(set)->lock))
6879 +-
6880 +-#define rcu_dereference_bh_nfnl(p) rcu_dereference_bh_check(p, 1)
6881 ++#define __ipset_dereference(p) \
6882 ++ rcu_dereference_protected(p, 1)
6883 ++#define ipset_dereference_nfnl(p) \
6884 ++ rcu_dereference_protected(p, \
6885 ++ lockdep_nfnl_is_held(NFNL_SUBSYS_IPSET))
6886 ++#define ipset_dereference_set(p, set) \
6887 ++ rcu_dereference_protected(p, \
6888 ++ lockdep_nfnl_is_held(NFNL_SUBSYS_IPSET) || \
6889 ++ lockdep_is_held(&(set)->lock))
6890 ++#define ipset_dereference_bh_nfnl(p) \
6891 ++ rcu_dereference_bh_check(p, \
6892 ++ lockdep_nfnl_is_held(NFNL_SUBSYS_IPSET))
6893 +
6894 + /* Hashing which uses arrays to resolve clashing. The hash table is resized
6895 + * (doubled) when searching becomes too long.
6896 +@@ -72,11 +80,35 @@ struct hbucket {
6897 + __aligned(__alignof__(u64));
6898 + };
6899 +
6900 ++/* Region size for locking == 2^HTABLE_REGION_BITS */
6901 ++#define HTABLE_REGION_BITS 10
6902 ++#define ahash_numof_locks(htable_bits) \
6903 ++ ((htable_bits) < HTABLE_REGION_BITS ? 1 \
6904 ++ : jhash_size((htable_bits) - HTABLE_REGION_BITS))
6905 ++#define ahash_sizeof_regions(htable_bits) \
6906 ++ (ahash_numof_locks(htable_bits) * sizeof(struct ip_set_region))
6907 ++#define ahash_region(n, htable_bits) \
6908 ++ ((n) % ahash_numof_locks(htable_bits))
6909 ++#define ahash_bucket_start(h, htable_bits) \
6910 ++ ((htable_bits) < HTABLE_REGION_BITS ? 0 \
6911 ++ : (h) * jhash_size(HTABLE_REGION_BITS))
6912 ++#define ahash_bucket_end(h, htable_bits) \
6913 ++ ((htable_bits) < HTABLE_REGION_BITS ? jhash_size(htable_bits) \
6914 ++ : ((h) + 1) * jhash_size(HTABLE_REGION_BITS))
6915 ++
6916 ++struct htable_gc {
6917 ++ struct delayed_work dwork;
6918 ++ struct ip_set *set; /* Set the gc belongs to */
6919 ++ u32 region; /* Last gc run position */
6920 ++};
6921 ++
6922 + /* The hash table: the table size stored here in order to make resizing easy */
6923 + struct htable {
6924 + atomic_t ref; /* References for resizing */
6925 +- atomic_t uref; /* References for dumping */
6926 ++ atomic_t uref; /* References for dumping and gc */
6927 + u8 htable_bits; /* size of hash table == 2^htable_bits */
6928 ++ u32 maxelem; /* Maxelem per region */
6929 ++ struct ip_set_region *hregion; /* Region locks and ext sizes */
6930 + struct hbucket __rcu *bucket[0]; /* hashtable buckets */
6931 + };
6932 +
6933 +@@ -162,6 +194,10 @@ htable_bits(u32 hashsize)
6934 + #define NLEN 0
6935 + #endif /* IP_SET_HASH_WITH_NETS */
6936 +
6937 ++#define SET_ELEM_EXPIRED(set, d) \
6938 ++ (SET_WITH_TIMEOUT(set) && \
6939 ++ ip_set_timeout_expired(ext_timeout(d, set)))
6940 ++
6941 + #endif /* _IP_SET_HASH_GEN_H */
6942 +
6943 + #ifndef MTYPE
6944 +@@ -205,10 +241,12 @@ htable_bits(u32 hashsize)
6945 + #undef mtype_test_cidrs
6946 + #undef mtype_test
6947 + #undef mtype_uref
6948 +-#undef mtype_expire
6949 + #undef mtype_resize
6950 ++#undef mtype_ext_size
6951 ++#undef mtype_resize_ad
6952 + #undef mtype_head
6953 + #undef mtype_list
6954 ++#undef mtype_gc_do
6955 + #undef mtype_gc
6956 + #undef mtype_gc_init
6957 + #undef mtype_variant
6958 +@@ -247,10 +285,12 @@ htable_bits(u32 hashsize)
6959 + #define mtype_test_cidrs IPSET_TOKEN(MTYPE, _test_cidrs)
6960 + #define mtype_test IPSET_TOKEN(MTYPE, _test)
6961 + #define mtype_uref IPSET_TOKEN(MTYPE, _uref)
6962 +-#define mtype_expire IPSET_TOKEN(MTYPE, _expire)
6963 + #define mtype_resize IPSET_TOKEN(MTYPE, _resize)
6964 ++#define mtype_ext_size IPSET_TOKEN(MTYPE, _ext_size)
6965 ++#define mtype_resize_ad IPSET_TOKEN(MTYPE, _resize_ad)
6966 + #define mtype_head IPSET_TOKEN(MTYPE, _head)
6967 + #define mtype_list IPSET_TOKEN(MTYPE, _list)
6968 ++#define mtype_gc_do IPSET_TOKEN(MTYPE, _gc_do)
6969 + #define mtype_gc IPSET_TOKEN(MTYPE, _gc)
6970 + #define mtype_gc_init IPSET_TOKEN(MTYPE, _gc_init)
6971 + #define mtype_variant IPSET_TOKEN(MTYPE, _variant)
6972 +@@ -275,8 +315,7 @@ htable_bits(u32 hashsize)
6973 + /* The generic hash structure */
6974 + struct htype {
6975 + struct htable __rcu *table; /* the hash table */
6976 +- struct timer_list gc; /* garbage collection when timeout enabled */
6977 +- struct ip_set *set; /* attached to this ip_set */
6978 ++ struct htable_gc gc; /* gc workqueue */
6979 + u32 maxelem; /* max elements in the hash */
6980 + u32 initval; /* random jhash init value */
6981 + #ifdef IP_SET_HASH_WITH_MARKMASK
6982 +@@ -288,21 +327,33 @@ struct htype {
6983 + #ifdef IP_SET_HASH_WITH_NETMASK
6984 + u8 netmask; /* netmask value for subnets to store */
6985 + #endif
6986 ++ struct list_head ad; /* Resize add|del backlist */
6987 + struct mtype_elem next; /* temporary storage for uadd */
6988 + #ifdef IP_SET_HASH_WITH_NETS
6989 + struct net_prefixes nets[NLEN]; /* book-keeping of prefixes */
6990 + #endif
6991 + };
6992 +
6993 ++/* ADD|DEL entries saved during resize */
6994 ++struct mtype_resize_ad {
6995 ++ struct list_head list;
6996 ++ enum ipset_adt ad; /* ADD|DEL element */
6997 ++ struct mtype_elem d; /* Element value */
6998 ++ struct ip_set_ext ext; /* Extensions for ADD */
6999 ++ struct ip_set_ext mext; /* Target extensions for ADD */
7000 ++ u32 flags; /* Flags for ADD */
7001 ++};
7002 ++
7003 + #ifdef IP_SET_HASH_WITH_NETS
7004 + /* Network cidr size book keeping when the hash stores different
7005 + * sized networks. cidr == real cidr + 1 to support /0.
7006 + */
7007 + static void
7008 +-mtype_add_cidr(struct htype *h, u8 cidr, u8 n)
7009 ++mtype_add_cidr(struct ip_set *set, struct htype *h, u8 cidr, u8 n)
7010 + {
7011 + int i, j;
7012 +
7013 ++ spin_lock_bh(&set->lock);
7014 + /* Add in increasing prefix order, so larger cidr first */
7015 + for (i = 0, j = -1; i < NLEN && h->nets[i].cidr[n]; i++) {
7016 + if (j != -1) {
7017 +@@ -311,7 +362,7 @@ mtype_add_cidr(struct htype *h, u8 cidr, u8 n)
7018 + j = i;
7019 + } else if (h->nets[i].cidr[n] == cidr) {
7020 + h->nets[CIDR_POS(cidr)].nets[n]++;
7021 +- return;
7022 ++ goto unlock;
7023 + }
7024 + }
7025 + if (j != -1) {
7026 +@@ -320,24 +371,29 @@ mtype_add_cidr(struct htype *h, u8 cidr, u8 n)
7027 + }
7028 + h->nets[i].cidr[n] = cidr;
7029 + h->nets[CIDR_POS(cidr)].nets[n] = 1;
7030 ++unlock:
7031 ++ spin_unlock_bh(&set->lock);
7032 + }
7033 +
7034 + static void
7035 +-mtype_del_cidr(struct htype *h, u8 cidr, u8 n)
7036 ++mtype_del_cidr(struct ip_set *set, struct htype *h, u8 cidr, u8 n)
7037 + {
7038 + u8 i, j, net_end = NLEN - 1;
7039 +
7040 ++ spin_lock_bh(&set->lock);
7041 + for (i = 0; i < NLEN; i++) {
7042 + if (h->nets[i].cidr[n] != cidr)
7043 + continue;
7044 + h->nets[CIDR_POS(cidr)].nets[n]--;
7045 + if (h->nets[CIDR_POS(cidr)].nets[n] > 0)
7046 +- return;
7047 ++ goto unlock;
7048 + for (j = i; j < net_end && h->nets[j].cidr[n]; j++)
7049 + h->nets[j].cidr[n] = h->nets[j + 1].cidr[n];
7050 + h->nets[j].cidr[n] = 0;
7051 +- return;
7052 ++ goto unlock;
7053 + }
7054 ++unlock:
7055 ++ spin_unlock_bh(&set->lock);
7056 + }
7057 + #endif
7058 +
7059 +@@ -345,7 +401,7 @@ mtype_del_cidr(struct htype *h, u8 cidr, u8 n)
7060 + static size_t
7061 + mtype_ahash_memsize(const struct htype *h, const struct htable *t)
7062 + {
7063 +- return sizeof(*h) + sizeof(*t);
7064 ++ return sizeof(*h) + sizeof(*t) + ahash_sizeof_regions(t->htable_bits);
7065 + }
7066 +
7067 + /* Get the ith element from the array block n */
7068 +@@ -369,24 +425,29 @@ mtype_flush(struct ip_set *set)
7069 + struct htype *h = set->data;
7070 + struct htable *t;
7071 + struct hbucket *n;
7072 +- u32 i;
7073 +-
7074 +- t = ipset_dereference_protected(h->table, set);
7075 +- for (i = 0; i < jhash_size(t->htable_bits); i++) {
7076 +- n = __ipset_dereference_protected(hbucket(t, i), 1);
7077 +- if (!n)
7078 +- continue;
7079 +- if (set->extensions & IPSET_EXT_DESTROY)
7080 +- mtype_ext_cleanup(set, n);
7081 +- /* FIXME: use slab cache */
7082 +- rcu_assign_pointer(hbucket(t, i), NULL);
7083 +- kfree_rcu(n, rcu);
7084 ++ u32 r, i;
7085 ++
7086 ++ t = ipset_dereference_nfnl(h->table);
7087 ++ for (r = 0; r < ahash_numof_locks(t->htable_bits); r++) {
7088 ++ spin_lock_bh(&t->hregion[r].lock);
7089 ++ for (i = ahash_bucket_start(r, t->htable_bits);
7090 ++ i < ahash_bucket_end(r, t->htable_bits); i++) {
7091 ++ n = __ipset_dereference(hbucket(t, i));
7092 ++ if (!n)
7093 ++ continue;
7094 ++ if (set->extensions & IPSET_EXT_DESTROY)
7095 ++ mtype_ext_cleanup(set, n);
7096 ++ /* FIXME: use slab cache */
7097 ++ rcu_assign_pointer(hbucket(t, i), NULL);
7098 ++ kfree_rcu(n, rcu);
7099 ++ }
7100 ++ t->hregion[r].ext_size = 0;
7101 ++ t->hregion[r].elements = 0;
7102 ++ spin_unlock_bh(&t->hregion[r].lock);
7103 + }
7104 + #ifdef IP_SET_HASH_WITH_NETS
7105 + memset(h->nets, 0, sizeof(h->nets));
7106 + #endif
7107 +- set->elements = 0;
7108 +- set->ext_size = 0;
7109 + }
7110 +
7111 + /* Destroy the hashtable part of the set */
7112 +@@ -397,7 +458,7 @@ mtype_ahash_destroy(struct ip_set *set, struct htable *t, bool ext_destroy)
7113 + u32 i;
7114 +
7115 + for (i = 0; i < jhash_size(t->htable_bits); i++) {
7116 +- n = __ipset_dereference_protected(hbucket(t, i), 1);
7117 ++ n = __ipset_dereference(hbucket(t, i));
7118 + if (!n)
7119 + continue;
7120 + if (set->extensions & IPSET_EXT_DESTROY && ext_destroy)
7121 +@@ -406,6 +467,7 @@ mtype_ahash_destroy(struct ip_set *set, struct htable *t, bool ext_destroy)
7122 + kfree(n);
7123 + }
7124 +
7125 ++ ip_set_free(t->hregion);
7126 + ip_set_free(t);
7127 + }
7128 +
7129 +@@ -414,28 +476,21 @@ static void
7130 + mtype_destroy(struct ip_set *set)
7131 + {
7132 + struct htype *h = set->data;
7133 ++ struct list_head *l, *lt;
7134 +
7135 + if (SET_WITH_TIMEOUT(set))
7136 +- del_timer_sync(&h->gc);
7137 ++ cancel_delayed_work_sync(&h->gc.dwork);
7138 +
7139 +- mtype_ahash_destroy(set,
7140 +- __ipset_dereference_protected(h->table, 1), true);
7141 ++ mtype_ahash_destroy(set, ipset_dereference_nfnl(h->table), true);
7142 ++ list_for_each_safe(l, lt, &h->ad) {
7143 ++ list_del(l);
7144 ++ kfree(l);
7145 ++ }
7146 + kfree(h);
7147 +
7148 + set->data = NULL;
7149 + }
7150 +
7151 +-static void
7152 +-mtype_gc_init(struct ip_set *set, void (*gc)(struct timer_list *t))
7153 +-{
7154 +- struct htype *h = set->data;
7155 +-
7156 +- timer_setup(&h->gc, gc, 0);
7157 +- mod_timer(&h->gc, jiffies + IPSET_GC_PERIOD(set->timeout) * HZ);
7158 +- pr_debug("gc initialized, run in every %u\n",
7159 +- IPSET_GC_PERIOD(set->timeout));
7160 +-}
7161 +-
7162 + static bool
7163 + mtype_same_set(const struct ip_set *a, const struct ip_set *b)
7164 + {
7165 +@@ -454,11 +509,9 @@ mtype_same_set(const struct ip_set *a, const struct ip_set *b)
7166 + a->extensions == b->extensions;
7167 + }
7168 +
7169 +-/* Delete expired elements from the hashtable */
7170 + static void
7171 +-mtype_expire(struct ip_set *set, struct htype *h)
7172 ++mtype_gc_do(struct ip_set *set, struct htype *h, struct htable *t, u32 r)
7173 + {
7174 +- struct htable *t;
7175 + struct hbucket *n, *tmp;
7176 + struct mtype_elem *data;
7177 + u32 i, j, d;
7178 +@@ -466,10 +519,12 @@ mtype_expire(struct ip_set *set, struct htype *h)
7179 + #ifdef IP_SET_HASH_WITH_NETS
7180 + u8 k;
7181 + #endif
7182 ++ u8 htable_bits = t->htable_bits;
7183 +
7184 +- t = ipset_dereference_protected(h->table, set);
7185 +- for (i = 0; i < jhash_size(t->htable_bits); i++) {
7186 +- n = __ipset_dereference_protected(hbucket(t, i), 1);
7187 ++ spin_lock_bh(&t->hregion[r].lock);
7188 ++ for (i = ahash_bucket_start(r, htable_bits);
7189 ++ i < ahash_bucket_end(r, htable_bits); i++) {
7190 ++ n = __ipset_dereference(hbucket(t, i));
7191 + if (!n)
7192 + continue;
7193 + for (j = 0, d = 0; j < n->pos; j++) {
7194 +@@ -485,58 +540,100 @@ mtype_expire(struct ip_set *set, struct htype *h)
7195 + smp_mb__after_atomic();
7196 + #ifdef IP_SET_HASH_WITH_NETS
7197 + for (k = 0; k < IPSET_NET_COUNT; k++)
7198 +- mtype_del_cidr(h,
7199 ++ mtype_del_cidr(set, h,
7200 + NCIDR_PUT(DCIDR_GET(data->cidr, k)),
7201 + k);
7202 + #endif
7203 ++ t->hregion[r].elements--;
7204 + ip_set_ext_destroy(set, data);
7205 +- set->elements--;
7206 + d++;
7207 + }
7208 + if (d >= AHASH_INIT_SIZE) {
7209 + if (d >= n->size) {
7210 ++ t->hregion[r].ext_size -=
7211 ++ ext_size(n->size, dsize);
7212 + rcu_assign_pointer(hbucket(t, i), NULL);
7213 + kfree_rcu(n, rcu);
7214 + continue;
7215 + }
7216 + tmp = kzalloc(sizeof(*tmp) +
7217 +- (n->size - AHASH_INIT_SIZE) * dsize,
7218 +- GFP_ATOMIC);
7219 ++ (n->size - AHASH_INIT_SIZE) * dsize,
7220 ++ GFP_ATOMIC);
7221 + if (!tmp)
7222 +- /* Still try to delete expired elements */
7223 ++ /* Still try to delete expired elements. */
7224 + continue;
7225 + tmp->size = n->size - AHASH_INIT_SIZE;
7226 + for (j = 0, d = 0; j < n->pos; j++) {
7227 + if (!test_bit(j, n->used))
7228 + continue;
7229 + data = ahash_data(n, j, dsize);
7230 +- memcpy(tmp->value + d * dsize, data, dsize);
7231 ++ memcpy(tmp->value + d * dsize,
7232 ++ data, dsize);
7233 + set_bit(d, tmp->used);
7234 + d++;
7235 + }
7236 + tmp->pos = d;
7237 +- set->ext_size -= ext_size(AHASH_INIT_SIZE, dsize);
7238 ++ t->hregion[r].ext_size -=
7239 ++ ext_size(AHASH_INIT_SIZE, dsize);
7240 + rcu_assign_pointer(hbucket(t, i), tmp);
7241 + kfree_rcu(n, rcu);
7242 + }
7243 + }
7244 ++ spin_unlock_bh(&t->hregion[r].lock);
7245 + }
7246 +
7247 + static void
7248 +-mtype_gc(struct timer_list *t)
7249 ++mtype_gc(struct work_struct *work)
7250 + {
7251 +- struct htype *h = from_timer(h, t, gc);
7252 +- struct ip_set *set = h->set;
7253 ++ struct htable_gc *gc;
7254 ++ struct ip_set *set;
7255 ++ struct htype *h;
7256 ++ struct htable *t;
7257 ++ u32 r, numof_locks;
7258 ++ unsigned int next_run;
7259 ++
7260 ++ gc = container_of(work, struct htable_gc, dwork.work);
7261 ++ set = gc->set;
7262 ++ h = set->data;
7263 +
7264 +- pr_debug("called\n");
7265 + spin_lock_bh(&set->lock);
7266 +- mtype_expire(set, h);
7267 ++ t = ipset_dereference_set(h->table, set);
7268 ++ atomic_inc(&t->uref);
7269 ++ numof_locks = ahash_numof_locks(t->htable_bits);
7270 ++ r = gc->region++;
7271 ++ if (r >= numof_locks) {
7272 ++ r = gc->region = 0;
7273 ++ }
7274 ++ next_run = (IPSET_GC_PERIOD(set->timeout) * HZ) / numof_locks;
7275 ++ if (next_run < HZ/10)
7276 ++ next_run = HZ/10;
7277 + spin_unlock_bh(&set->lock);
7278 +
7279 +- h->gc.expires = jiffies + IPSET_GC_PERIOD(set->timeout) * HZ;
7280 +- add_timer(&h->gc);
7281 ++ mtype_gc_do(set, h, t, r);
7282 ++
7283 ++ if (atomic_dec_and_test(&t->uref) && atomic_read(&t->ref)) {
7284 ++ pr_debug("Table destroy after resize by expire: %p\n", t);
7285 ++ mtype_ahash_destroy(set, t, false);
7286 ++ }
7287 ++
7288 ++ queue_delayed_work(system_power_efficient_wq, &gc->dwork, next_run);
7289 ++
7290 ++}
7291 ++
7292 ++static void
7293 ++mtype_gc_init(struct htable_gc *gc)
7294 ++{
7295 ++ INIT_DEFERRABLE_WORK(&gc->dwork, mtype_gc);
7296 ++ queue_delayed_work(system_power_efficient_wq, &gc->dwork, HZ);
7297 + }
7298 +
7299 ++static int
7300 ++mtype_add(struct ip_set *set, void *value, const struct ip_set_ext *ext,
7301 ++ struct ip_set_ext *mext, u32 flags);
7302 ++static int
7303 ++mtype_del(struct ip_set *set, void *value, const struct ip_set_ext *ext,
7304 ++ struct ip_set_ext *mext, u32 flags);
7305 ++
7306 + /* Resize a hash: create a new hash table with doubling the hashsize
7307 + * and inserting the elements to it. Repeat until we succeed or
7308 + * fail due to memory pressures.
7309 +@@ -547,7 +644,7 @@ mtype_resize(struct ip_set *set, bool retried)
7310 + struct htype *h = set->data;
7311 + struct htable *t, *orig;
7312 + u8 htable_bits;
7313 +- size_t extsize, dsize = set->dsize;
7314 ++ size_t dsize = set->dsize;
7315 + #ifdef IP_SET_HASH_WITH_NETS
7316 + u8 flags;
7317 + struct mtype_elem *tmp;
7318 +@@ -555,7 +652,9 @@ mtype_resize(struct ip_set *set, bool retried)
7319 + struct mtype_elem *data;
7320 + struct mtype_elem *d;
7321 + struct hbucket *n, *m;
7322 +- u32 i, j, key;
7323 ++ struct list_head *l, *lt;
7324 ++ struct mtype_resize_ad *x;
7325 ++ u32 i, j, r, nr, key;
7326 + int ret;
7327 +
7328 + #ifdef IP_SET_HASH_WITH_NETS
7329 +@@ -563,10 +662,8 @@ mtype_resize(struct ip_set *set, bool retried)
7330 + if (!tmp)
7331 + return -ENOMEM;
7332 + #endif
7333 +- rcu_read_lock_bh();
7334 +- orig = rcu_dereference_bh_nfnl(h->table);
7335 ++ orig = ipset_dereference_bh_nfnl(h->table);
7336 + htable_bits = orig->htable_bits;
7337 +- rcu_read_unlock_bh();
7338 +
7339 + retry:
7340 + ret = 0;
7341 +@@ -583,88 +680,124 @@ retry:
7342 + ret = -ENOMEM;
7343 + goto out;
7344 + }
7345 ++ t->hregion = ip_set_alloc(ahash_sizeof_regions(htable_bits));
7346 ++ if (!t->hregion) {
7347 ++ kfree(t);
7348 ++ ret = -ENOMEM;
7349 ++ goto out;
7350 ++ }
7351 + t->htable_bits = htable_bits;
7352 ++ t->maxelem = h->maxelem / ahash_numof_locks(htable_bits);
7353 ++ for (i = 0; i < ahash_numof_locks(htable_bits); i++)
7354 ++ spin_lock_init(&t->hregion[i].lock);
7355 +
7356 +- spin_lock_bh(&set->lock);
7357 +- orig = __ipset_dereference_protected(h->table, 1);
7358 +- /* There can't be another parallel resizing, but dumping is possible */
7359 ++ /* There can't be another parallel resizing,
7360 ++ * but dumping, gc, kernel side add/del are possible
7361 ++ */
7362 ++ orig = ipset_dereference_bh_nfnl(h->table);
7363 + atomic_set(&orig->ref, 1);
7364 + atomic_inc(&orig->uref);
7365 +- extsize = 0;
7366 + pr_debug("attempt to resize set %s from %u to %u, t %p\n",
7367 + set->name, orig->htable_bits, htable_bits, orig);
7368 +- for (i = 0; i < jhash_size(orig->htable_bits); i++) {
7369 +- n = __ipset_dereference_protected(hbucket(orig, i), 1);
7370 +- if (!n)
7371 +- continue;
7372 +- for (j = 0; j < n->pos; j++) {
7373 +- if (!test_bit(j, n->used))
7374 ++ for (r = 0; r < ahash_numof_locks(orig->htable_bits); r++) {
7375 ++ /* Expire may replace a hbucket with another one */
7376 ++ rcu_read_lock_bh();
7377 ++ for (i = ahash_bucket_start(r, orig->htable_bits);
7378 ++ i < ahash_bucket_end(r, orig->htable_bits); i++) {
7379 ++ n = __ipset_dereference(hbucket(orig, i));
7380 ++ if (!n)
7381 + continue;
7382 +- data = ahash_data(n, j, dsize);
7383 ++ for (j = 0; j < n->pos; j++) {
7384 ++ if (!test_bit(j, n->used))
7385 ++ continue;
7386 ++ data = ahash_data(n, j, dsize);
7387 ++ if (SET_ELEM_EXPIRED(set, data))
7388 ++ continue;
7389 + #ifdef IP_SET_HASH_WITH_NETS
7390 +- /* We have readers running parallel with us,
7391 +- * so the live data cannot be modified.
7392 +- */
7393 +- flags = 0;
7394 +- memcpy(tmp, data, dsize);
7395 +- data = tmp;
7396 +- mtype_data_reset_flags(data, &flags);
7397 ++ /* We have readers running parallel with us,
7398 ++ * so the live data cannot be modified.
7399 ++ */
7400 ++ flags = 0;
7401 ++ memcpy(tmp, data, dsize);
7402 ++ data = tmp;
7403 ++ mtype_data_reset_flags(data, &flags);
7404 + #endif
7405 +- key = HKEY(data, h->initval, htable_bits);
7406 +- m = __ipset_dereference_protected(hbucket(t, key), 1);
7407 +- if (!m) {
7408 +- m = kzalloc(sizeof(*m) +
7409 ++ key = HKEY(data, h->initval, htable_bits);
7410 ++ m = __ipset_dereference(hbucket(t, key));
7411 ++ nr = ahash_region(key, htable_bits);
7412 ++ if (!m) {
7413 ++ m = kzalloc(sizeof(*m) +
7414 + AHASH_INIT_SIZE * dsize,
7415 + GFP_ATOMIC);
7416 +- if (!m) {
7417 +- ret = -ENOMEM;
7418 +- goto cleanup;
7419 +- }
7420 +- m->size = AHASH_INIT_SIZE;
7421 +- extsize += ext_size(AHASH_INIT_SIZE, dsize);
7422 +- RCU_INIT_POINTER(hbucket(t, key), m);
7423 +- } else if (m->pos >= m->size) {
7424 +- struct hbucket *ht;
7425 +-
7426 +- if (m->size >= AHASH_MAX(h)) {
7427 +- ret = -EAGAIN;
7428 +- } else {
7429 +- ht = kzalloc(sizeof(*ht) +
7430 ++ if (!m) {
7431 ++ ret = -ENOMEM;
7432 ++ goto cleanup;
7433 ++ }
7434 ++ m->size = AHASH_INIT_SIZE;
7435 ++ t->hregion[nr].ext_size +=
7436 ++ ext_size(AHASH_INIT_SIZE,
7437 ++ dsize);
7438 ++ RCU_INIT_POINTER(hbucket(t, key), m);
7439 ++ } else if (m->pos >= m->size) {
7440 ++ struct hbucket *ht;
7441 ++
7442 ++ if (m->size >= AHASH_MAX(h)) {
7443 ++ ret = -EAGAIN;
7444 ++ } else {
7445 ++ ht = kzalloc(sizeof(*ht) +
7446 + (m->size + AHASH_INIT_SIZE)
7447 + * dsize,
7448 + GFP_ATOMIC);
7449 +- if (!ht)
7450 +- ret = -ENOMEM;
7451 ++ if (!ht)
7452 ++ ret = -ENOMEM;
7453 ++ }
7454 ++ if (ret < 0)
7455 ++ goto cleanup;
7456 ++ memcpy(ht, m, sizeof(struct hbucket) +
7457 ++ m->size * dsize);
7458 ++ ht->size = m->size + AHASH_INIT_SIZE;
7459 ++ t->hregion[nr].ext_size +=
7460 ++ ext_size(AHASH_INIT_SIZE,
7461 ++ dsize);
7462 ++ kfree(m);
7463 ++ m = ht;
7464 ++ RCU_INIT_POINTER(hbucket(t, key), ht);
7465 + }
7466 +- if (ret < 0)
7467 +- goto cleanup;
7468 +- memcpy(ht, m, sizeof(struct hbucket) +
7469 +- m->size * dsize);
7470 +- ht->size = m->size + AHASH_INIT_SIZE;
7471 +- extsize += ext_size(AHASH_INIT_SIZE, dsize);
7472 +- kfree(m);
7473 +- m = ht;
7474 +- RCU_INIT_POINTER(hbucket(t, key), ht);
7475 +- }
7476 +- d = ahash_data(m, m->pos, dsize);
7477 +- memcpy(d, data, dsize);
7478 +- set_bit(m->pos++, m->used);
7479 ++ d = ahash_data(m, m->pos, dsize);
7480 ++ memcpy(d, data, dsize);
7481 ++ set_bit(m->pos++, m->used);
7482 ++ t->hregion[nr].elements++;
7483 + #ifdef IP_SET_HASH_WITH_NETS
7484 +- mtype_data_reset_flags(d, &flags);
7485 ++ mtype_data_reset_flags(d, &flags);
7486 + #endif
7487 ++ }
7488 + }
7489 ++ rcu_read_unlock_bh();
7490 + }
7491 +- rcu_assign_pointer(h->table, t);
7492 +- set->ext_size = extsize;
7493 +
7494 +- spin_unlock_bh(&set->lock);
7495 ++ /* There can't be any other writer. */
7496 ++ rcu_assign_pointer(h->table, t);
7497 +
7498 + /* Give time to other readers of the set */
7499 + synchronize_rcu();
7500 +
7501 + pr_debug("set %s resized from %u (%p) to %u (%p)\n", set->name,
7502 + orig->htable_bits, orig, t->htable_bits, t);
7503 +- /* If there's nobody else dumping the table, destroy it */
7504 ++ /* Add/delete elements processed by the SET target during resize.
7505 ++ * Kernel-side add cannot trigger a resize and userspace actions
7506 ++ * are serialized by the mutex.
7507 ++ */
7508 ++ list_for_each_safe(l, lt, &h->ad) {
7509 ++ x = list_entry(l, struct mtype_resize_ad, list);
7510 ++ if (x->ad == IPSET_ADD) {
7511 ++ mtype_add(set, &x->d, &x->ext, &x->mext, x->flags);
7512 ++ } else {
7513 ++ mtype_del(set, &x->d, NULL, NULL, 0);
7514 ++ }
7515 ++ list_del(l);
7516 ++ kfree(l);
7517 ++ }
7518 ++ /* If there's nobody else using the table, destroy it */
7519 + if (atomic_dec_and_test(&orig->uref)) {
7520 + pr_debug("Table destroy by resize %p\n", orig);
7521 + mtype_ahash_destroy(set, orig, false);
7522 +@@ -677,15 +810,44 @@ out:
7523 + return ret;
7524 +
7525 + cleanup:
7526 ++ rcu_read_unlock_bh();
7527 + atomic_set(&orig->ref, 0);
7528 + atomic_dec(&orig->uref);
7529 +- spin_unlock_bh(&set->lock);
7530 + mtype_ahash_destroy(set, t, false);
7531 + if (ret == -EAGAIN)
7532 + goto retry;
7533 + goto out;
7534 + }
7535 +
7536 ++/* Get the current number of elements and ext_size in the set */
7537 ++static void
7538 ++mtype_ext_size(struct ip_set *set, u32 *elements, size_t *ext_size)
7539 ++{
7540 ++ struct htype *h = set->data;
7541 ++ const struct htable *t;
7542 ++ u32 i, j, r;
7543 ++ struct hbucket *n;
7544 ++ struct mtype_elem *data;
7545 ++
7546 ++ t = rcu_dereference_bh(h->table);
7547 ++ for (r = 0; r < ahash_numof_locks(t->htable_bits); r++) {
7548 ++ for (i = ahash_bucket_start(r, t->htable_bits);
7549 ++ i < ahash_bucket_end(r, t->htable_bits); i++) {
7550 ++ n = rcu_dereference_bh(hbucket(t, i));
7551 ++ if (!n)
7552 ++ continue;
7553 ++ for (j = 0; j < n->pos; j++) {
7554 ++ if (!test_bit(j, n->used))
7555 ++ continue;
7556 ++ data = ahash_data(n, j, set->dsize);
7557 ++ if (!SET_ELEM_EXPIRED(set, data))
7558 ++ (*elements)++;
7559 ++ }
7560 ++ }
7561 ++ *ext_size += t->hregion[r].ext_size;
7562 ++ }
7563 ++}
7564 ++
7565 + /* Add an element to a hash and update the internal counters when succeeded,
7566 + * otherwise report the proper error code.
7567 + */
7568 +@@ -698,32 +860,49 @@ mtype_add(struct ip_set *set, void *value, const struct ip_set_ext *ext,
7569 + const struct mtype_elem *d = value;
7570 + struct mtype_elem *data;
7571 + struct hbucket *n, *old = ERR_PTR(-ENOENT);
7572 +- int i, j = -1;
7573 ++ int i, j = -1, ret;
7574 + bool flag_exist = flags & IPSET_FLAG_EXIST;
7575 + bool deleted = false, forceadd = false, reuse = false;
7576 +- u32 key, multi = 0;
7577 ++ u32 r, key, multi = 0, elements, maxelem;
7578 +
7579 +- if (set->elements >= h->maxelem) {
7580 +- if (SET_WITH_TIMEOUT(set))
7581 +- /* FIXME: when set is full, we slow down here */
7582 +- mtype_expire(set, h);
7583 +- if (set->elements >= h->maxelem && SET_WITH_FORCEADD(set))
7584 ++ rcu_read_lock_bh();
7585 ++ t = rcu_dereference_bh(h->table);
7586 ++ key = HKEY(value, h->initval, t->htable_bits);
7587 ++ r = ahash_region(key, t->htable_bits);
7588 ++ atomic_inc(&t->uref);
7589 ++ elements = t->hregion[r].elements;
7590 ++ maxelem = t->maxelem;
7591 ++ if (elements >= maxelem) {
7592 ++ u32 e;
7593 ++ if (SET_WITH_TIMEOUT(set)) {
7594 ++ rcu_read_unlock_bh();
7595 ++ mtype_gc_do(set, h, t, r);
7596 ++ rcu_read_lock_bh();
7597 ++ }
7598 ++ maxelem = h->maxelem;
7599 ++ elements = 0;
7600 ++ for (e = 0; e < ahash_numof_locks(t->htable_bits); e++)
7601 ++ elements += t->hregion[e].elements;
7602 ++ if (elements >= maxelem && SET_WITH_FORCEADD(set))
7603 + forceadd = true;
7604 + }
7605 ++ rcu_read_unlock_bh();
7606 +
7607 +- t = ipset_dereference_protected(h->table, set);
7608 +- key = HKEY(value, h->initval, t->htable_bits);
7609 +- n = __ipset_dereference_protected(hbucket(t, key), 1);
7610 ++ spin_lock_bh(&t->hregion[r].lock);
7611 ++ n = rcu_dereference_bh(hbucket(t, key));
7612 + if (!n) {
7613 +- if (forceadd || set->elements >= h->maxelem)
7614 ++ if (forceadd || elements >= maxelem)
7615 + goto set_full;
7616 + old = NULL;
7617 + n = kzalloc(sizeof(*n) + AHASH_INIT_SIZE * set->dsize,
7618 + GFP_ATOMIC);
7619 +- if (!n)
7620 +- return -ENOMEM;
7621 ++ if (!n) {
7622 ++ ret = -ENOMEM;
7623 ++ goto unlock;
7624 ++ }
7625 + n->size = AHASH_INIT_SIZE;
7626 +- set->ext_size += ext_size(AHASH_INIT_SIZE, set->dsize);
7627 ++ t->hregion[r].ext_size +=
7628 ++ ext_size(AHASH_INIT_SIZE, set->dsize);
7629 + goto copy_elem;
7630 + }
7631 + for (i = 0; i < n->pos; i++) {
7632 +@@ -737,38 +916,37 @@ mtype_add(struct ip_set *set, void *value, const struct ip_set_ext *ext,
7633 + }
7634 + data = ahash_data(n, i, set->dsize);
7635 + if (mtype_data_equal(data, d, &multi)) {
7636 +- if (flag_exist ||
7637 +- (SET_WITH_TIMEOUT(set) &&
7638 +- ip_set_timeout_expired(ext_timeout(data, set)))) {
7639 ++ if (flag_exist || SET_ELEM_EXPIRED(set, data)) {
7640 + /* Just the extensions could be overwritten */
7641 + j = i;
7642 + goto overwrite_extensions;
7643 + }
7644 +- return -IPSET_ERR_EXIST;
7645 ++ ret = -IPSET_ERR_EXIST;
7646 ++ goto unlock;
7647 + }
7648 + /* Reuse first timed out entry */
7649 +- if (SET_WITH_TIMEOUT(set) &&
7650 +- ip_set_timeout_expired(ext_timeout(data, set)) &&
7651 +- j == -1) {
7652 ++ if (SET_ELEM_EXPIRED(set, data) && j == -1) {
7653 + j = i;
7654 + reuse = true;
7655 + }
7656 + }
7657 + if (reuse || forceadd) {
7658 ++ if (j == -1)
7659 ++ j = 0;
7660 + data = ahash_data(n, j, set->dsize);
7661 + if (!deleted) {
7662 + #ifdef IP_SET_HASH_WITH_NETS
7663 + for (i = 0; i < IPSET_NET_COUNT; i++)
7664 +- mtype_del_cidr(h,
7665 ++ mtype_del_cidr(set, h,
7666 + NCIDR_PUT(DCIDR_GET(data->cidr, i)),
7667 + i);
7668 + #endif
7669 + ip_set_ext_destroy(set, data);
7670 +- set->elements--;
7671 ++ t->hregion[r].elements--;
7672 + }
7673 + goto copy_data;
7674 + }
7675 +- if (set->elements >= h->maxelem)
7676 ++ if (elements >= maxelem)
7677 + goto set_full;
7678 + /* Create a new slot */
7679 + if (n->pos >= n->size) {
7680 +@@ -776,28 +954,32 @@ mtype_add(struct ip_set *set, void *value, const struct ip_set_ext *ext,
7681 + if (n->size >= AHASH_MAX(h)) {
7682 + /* Trigger rehashing */
7683 + mtype_data_next(&h->next, d);
7684 +- return -EAGAIN;
7685 ++ ret = -EAGAIN;
7686 ++ goto resize;
7687 + }
7688 + old = n;
7689 + n = kzalloc(sizeof(*n) +
7690 + (old->size + AHASH_INIT_SIZE) * set->dsize,
7691 + GFP_ATOMIC);
7692 +- if (!n)
7693 +- return -ENOMEM;
7694 ++ if (!n) {
7695 ++ ret = -ENOMEM;
7696 ++ goto unlock;
7697 ++ }
7698 + memcpy(n, old, sizeof(struct hbucket) +
7699 + old->size * set->dsize);
7700 + n->size = old->size + AHASH_INIT_SIZE;
7701 +- set->ext_size += ext_size(AHASH_INIT_SIZE, set->dsize);
7702 ++ t->hregion[r].ext_size +=
7703 ++ ext_size(AHASH_INIT_SIZE, set->dsize);
7704 + }
7705 +
7706 + copy_elem:
7707 + j = n->pos++;
7708 + data = ahash_data(n, j, set->dsize);
7709 + copy_data:
7710 +- set->elements++;
7711 ++ t->hregion[r].elements++;
7712 + #ifdef IP_SET_HASH_WITH_NETS
7713 + for (i = 0; i < IPSET_NET_COUNT; i++)
7714 +- mtype_add_cidr(h, NCIDR_PUT(DCIDR_GET(d->cidr, i)), i);
7715 ++ mtype_add_cidr(set, h, NCIDR_PUT(DCIDR_GET(d->cidr, i)), i);
7716 + #endif
7717 + memcpy(data, d, sizeof(struct mtype_elem));
7718 + overwrite_extensions:
7719 +@@ -820,13 +1002,41 @@ overwrite_extensions:
7720 + if (old)
7721 + kfree_rcu(old, rcu);
7722 + }
7723 ++ ret = 0;
7724 ++resize:
7725 ++ spin_unlock_bh(&t->hregion[r].lock);
7726 ++ if (atomic_read(&t->ref) && ext->target) {
7727 ++ /* Resize is in process and kernel side add, save values */
7728 ++ struct mtype_resize_ad *x;
7729 ++
7730 ++ x = kzalloc(sizeof(struct mtype_resize_ad), GFP_ATOMIC);
7731 ++ if (!x)
7732 ++ /* Don't bother */
7733 ++ goto out;
7734 ++ x->ad = IPSET_ADD;
7735 ++ memcpy(&x->d, value, sizeof(struct mtype_elem));
7736 ++ memcpy(&x->ext, ext, sizeof(struct ip_set_ext));
7737 ++ memcpy(&x->mext, mext, sizeof(struct ip_set_ext));
7738 ++ x->flags = flags;
7739 ++ spin_lock_bh(&set->lock);
7740 ++ list_add_tail(&x->list, &h->ad);
7741 ++ spin_unlock_bh(&set->lock);
7742 ++ }
7743 ++ goto out;
7744 +
7745 +- return 0;
7746 + set_full:
7747 + if (net_ratelimit())
7748 + pr_warn("Set %s is full, maxelem %u reached\n",
7749 +- set->name, h->maxelem);
7750 +- return -IPSET_ERR_HASH_FULL;
7751 ++ set->name, maxelem);
7752 ++ ret = -IPSET_ERR_HASH_FULL;
7753 ++unlock:
7754 ++ spin_unlock_bh(&t->hregion[r].lock);
7755 ++out:
7756 ++ if (atomic_dec_and_test(&t->uref) && atomic_read(&t->ref)) {
7757 ++ pr_debug("Table destroy after resize by add: %p\n", t);
7758 ++ mtype_ahash_destroy(set, t, false);
7759 ++ }
7760 ++ return ret;
7761 + }
7762 +
7763 + /* Delete an element from the hash and free up space if possible.
7764 +@@ -840,13 +1050,23 @@ mtype_del(struct ip_set *set, void *value, const struct ip_set_ext *ext,
7765 + const struct mtype_elem *d = value;
7766 + struct mtype_elem *data;
7767 + struct hbucket *n;
7768 +- int i, j, k, ret = -IPSET_ERR_EXIST;
7769 ++ struct mtype_resize_ad *x = NULL;
7770 ++ int i, j, k, r, ret = -IPSET_ERR_EXIST;
7771 + u32 key, multi = 0;
7772 + size_t dsize = set->dsize;
7773 +
7774 +- t = ipset_dereference_protected(h->table, set);
7775 ++ /* Userspace add and resize is excluded by the mutex.
7776 ++ * Kernespace add does not trigger resize.
7777 ++ */
7778 ++ rcu_read_lock_bh();
7779 ++ t = rcu_dereference_bh(h->table);
7780 + key = HKEY(value, h->initval, t->htable_bits);
7781 +- n = __ipset_dereference_protected(hbucket(t, key), 1);
7782 ++ r = ahash_region(key, t->htable_bits);
7783 ++ atomic_inc(&t->uref);
7784 ++ rcu_read_unlock_bh();
7785 ++
7786 ++ spin_lock_bh(&t->hregion[r].lock);
7787 ++ n = rcu_dereference_bh(hbucket(t, key));
7788 + if (!n)
7789 + goto out;
7790 + for (i = 0, k = 0; i < n->pos; i++) {
7791 +@@ -857,8 +1077,7 @@ mtype_del(struct ip_set *set, void *value, const struct ip_set_ext *ext,
7792 + data = ahash_data(n, i, dsize);
7793 + if (!mtype_data_equal(data, d, &multi))
7794 + continue;
7795 +- if (SET_WITH_TIMEOUT(set) &&
7796 +- ip_set_timeout_expired(ext_timeout(data, set)))
7797 ++ if (SET_ELEM_EXPIRED(set, data))
7798 + goto out;
7799 +
7800 + ret = 0;
7801 +@@ -866,20 +1085,33 @@ mtype_del(struct ip_set *set, void *value, const struct ip_set_ext *ext,
7802 + smp_mb__after_atomic();
7803 + if (i + 1 == n->pos)
7804 + n->pos--;
7805 +- set->elements--;
7806 ++ t->hregion[r].elements--;
7807 + #ifdef IP_SET_HASH_WITH_NETS
7808 + for (j = 0; j < IPSET_NET_COUNT; j++)
7809 +- mtype_del_cidr(h, NCIDR_PUT(DCIDR_GET(d->cidr, j)),
7810 +- j);
7811 ++ mtype_del_cidr(set, h,
7812 ++ NCIDR_PUT(DCIDR_GET(d->cidr, j)), j);
7813 + #endif
7814 + ip_set_ext_destroy(set, data);
7815 +
7816 ++ if (atomic_read(&t->ref) && ext->target) {
7817 ++ /* Resize is in process and kernel side del,
7818 ++ * save values
7819 ++ */
7820 ++ x = kzalloc(sizeof(struct mtype_resize_ad),
7821 ++ GFP_ATOMIC);
7822 ++ if (x) {
7823 ++ x->ad = IPSET_DEL;
7824 ++ memcpy(&x->d, value,
7825 ++ sizeof(struct mtype_elem));
7826 ++ x->flags = flags;
7827 ++ }
7828 ++ }
7829 + for (; i < n->pos; i++) {
7830 + if (!test_bit(i, n->used))
7831 + k++;
7832 + }
7833 + if (n->pos == 0 && k == 0) {
7834 +- set->ext_size -= ext_size(n->size, dsize);
7835 ++ t->hregion[r].ext_size -= ext_size(n->size, dsize);
7836 + rcu_assign_pointer(hbucket(t, key), NULL);
7837 + kfree_rcu(n, rcu);
7838 + } else if (k >= AHASH_INIT_SIZE) {
7839 +@@ -898,7 +1130,8 @@ mtype_del(struct ip_set *set, void *value, const struct ip_set_ext *ext,
7840 + k++;
7841 + }
7842 + tmp->pos = k;
7843 +- set->ext_size -= ext_size(AHASH_INIT_SIZE, dsize);
7844 ++ t->hregion[r].ext_size -=
7845 ++ ext_size(AHASH_INIT_SIZE, dsize);
7846 + rcu_assign_pointer(hbucket(t, key), tmp);
7847 + kfree_rcu(n, rcu);
7848 + }
7849 +@@ -906,6 +1139,16 @@ mtype_del(struct ip_set *set, void *value, const struct ip_set_ext *ext,
7850 + }
7851 +
7852 + out:
7853 ++ spin_unlock_bh(&t->hregion[r].lock);
7854 ++ if (x) {
7855 ++ spin_lock_bh(&set->lock);
7856 ++ list_add(&x->list, &h->ad);
7857 ++ spin_unlock_bh(&set->lock);
7858 ++ }
7859 ++ if (atomic_dec_and_test(&t->uref) && atomic_read(&t->ref)) {
7860 ++ pr_debug("Table destroy after resize by del: %p\n", t);
7861 ++ mtype_ahash_destroy(set, t, false);
7862 ++ }
7863 + return ret;
7864 + }
7865 +
7866 +@@ -991,6 +1234,7 @@ mtype_test(struct ip_set *set, void *value, const struct ip_set_ext *ext,
7867 + int i, ret = 0;
7868 + u32 key, multi = 0;
7869 +
7870 ++ rcu_read_lock_bh();
7871 + t = rcu_dereference_bh(h->table);
7872 + #ifdef IP_SET_HASH_WITH_NETS
7873 + /* If we test an IP address and not a network address,
7874 +@@ -1022,6 +1266,7 @@ mtype_test(struct ip_set *set, void *value, const struct ip_set_ext *ext,
7875 + goto out;
7876 + }
7877 + out:
7878 ++ rcu_read_unlock_bh();
7879 + return ret;
7880 + }
7881 +
7882 +@@ -1033,23 +1278,14 @@ mtype_head(struct ip_set *set, struct sk_buff *skb)
7883 + const struct htable *t;
7884 + struct nlattr *nested;
7885 + size_t memsize;
7886 ++ u32 elements = 0;
7887 ++ size_t ext_size = 0;
7888 + u8 htable_bits;
7889 +
7890 +- /* If any members have expired, set->elements will be wrong
7891 +- * mytype_expire function will update it with the right count.
7892 +- * we do not hold set->lock here, so grab it first.
7893 +- * set->elements can still be incorrect in the case of a huge set,
7894 +- * because elements might time out during the listing.
7895 +- */
7896 +- if (SET_WITH_TIMEOUT(set)) {
7897 +- spin_lock_bh(&set->lock);
7898 +- mtype_expire(set, h);
7899 +- spin_unlock_bh(&set->lock);
7900 +- }
7901 +-
7902 + rcu_read_lock_bh();
7903 +- t = rcu_dereference_bh_nfnl(h->table);
7904 +- memsize = mtype_ahash_memsize(h, t) + set->ext_size;
7905 ++ t = rcu_dereference_bh(h->table);
7906 ++ mtype_ext_size(set, &elements, &ext_size);
7907 ++ memsize = mtype_ahash_memsize(h, t) + ext_size + set->ext_size;
7908 + htable_bits = t->htable_bits;
7909 + rcu_read_unlock_bh();
7910 +
7911 +@@ -1071,7 +1307,7 @@ mtype_head(struct ip_set *set, struct sk_buff *skb)
7912 + #endif
7913 + if (nla_put_net32(skb, IPSET_ATTR_REFERENCES, htonl(set->ref)) ||
7914 + nla_put_net32(skb, IPSET_ATTR_MEMSIZE, htonl(memsize)) ||
7915 +- nla_put_net32(skb, IPSET_ATTR_ELEMENTS, htonl(set->elements)))
7916 ++ nla_put_net32(skb, IPSET_ATTR_ELEMENTS, htonl(elements)))
7917 + goto nla_put_failure;
7918 + if (unlikely(ip_set_put_flags(skb, set)))
7919 + goto nla_put_failure;
7920 +@@ -1091,15 +1327,15 @@ mtype_uref(struct ip_set *set, struct netlink_callback *cb, bool start)
7921 +
7922 + if (start) {
7923 + rcu_read_lock_bh();
7924 +- t = rcu_dereference_bh_nfnl(h->table);
7925 ++ t = ipset_dereference_bh_nfnl(h->table);
7926 + atomic_inc(&t->uref);
7927 + cb->args[IPSET_CB_PRIVATE] = (unsigned long)t;
7928 + rcu_read_unlock_bh();
7929 + } else if (cb->args[IPSET_CB_PRIVATE]) {
7930 + t = (struct htable *)cb->args[IPSET_CB_PRIVATE];
7931 + if (atomic_dec_and_test(&t->uref) && atomic_read(&t->ref)) {
7932 +- /* Resizing didn't destroy the hash table */
7933 +- pr_debug("Table destroy by dump: %p\n", t);
7934 ++ pr_debug("Table destroy after resize "
7935 ++ " by dump: %p\n", t);
7936 + mtype_ahash_destroy(set, t, false);
7937 + }
7938 + cb->args[IPSET_CB_PRIVATE] = 0;
7939 +@@ -1141,8 +1377,7 @@ mtype_list(const struct ip_set *set,
7940 + if (!test_bit(i, n->used))
7941 + continue;
7942 + e = ahash_data(n, i, set->dsize);
7943 +- if (SET_WITH_TIMEOUT(set) &&
7944 +- ip_set_timeout_expired(ext_timeout(e, set)))
7945 ++ if (SET_ELEM_EXPIRED(set, e))
7946 + continue;
7947 + pr_debug("list hash %lu hbucket %p i %u, data %p\n",
7948 + cb->args[IPSET_CB_ARG0], n, i, e);
7949 +@@ -1208,6 +1443,7 @@ static const struct ip_set_type_variant mtype_variant = {
7950 + .uref = mtype_uref,
7951 + .resize = mtype_resize,
7952 + .same_set = mtype_same_set,
7953 ++ .region_lock = true,
7954 + };
7955 +
7956 + #ifdef IP_SET_EMIT_CREATE
7957 +@@ -1226,6 +1462,7 @@ IPSET_TOKEN(HTYPE, _create)(struct net *net, struct ip_set *set,
7958 + size_t hsize;
7959 + struct htype *h;
7960 + struct htable *t;
7961 ++ u32 i;
7962 +
7963 + pr_debug("Create set %s with family %s\n",
7964 + set->name, set->family == NFPROTO_IPV4 ? "inet" : "inet6");
7965 +@@ -1294,6 +1531,15 @@ IPSET_TOKEN(HTYPE, _create)(struct net *net, struct ip_set *set,
7966 + kfree(h);
7967 + return -ENOMEM;
7968 + }
7969 ++ t->hregion = ip_set_alloc(ahash_sizeof_regions(hbits));
7970 ++ if (!t->hregion) {
7971 ++ kfree(t);
7972 ++ kfree(h);
7973 ++ return -ENOMEM;
7974 ++ }
7975 ++ h->gc.set = set;
7976 ++ for (i = 0; i < ahash_numof_locks(hbits); i++)
7977 ++ spin_lock_init(&t->hregion[i].lock);
7978 + h->maxelem = maxelem;
7979 + #ifdef IP_SET_HASH_WITH_NETMASK
7980 + h->netmask = netmask;
7981 +@@ -1304,9 +1550,10 @@ IPSET_TOKEN(HTYPE, _create)(struct net *net, struct ip_set *set,
7982 + get_random_bytes(&h->initval, sizeof(h->initval));
7983 +
7984 + t->htable_bits = hbits;
7985 ++ t->maxelem = h->maxelem / ahash_numof_locks(hbits);
7986 + RCU_INIT_POINTER(h->table, t);
7987 +
7988 +- h->set = set;
7989 ++ INIT_LIST_HEAD(&h->ad);
7990 + set->data = h;
7991 + #ifndef IP_SET_PROTO_UNDEF
7992 + if (set->family == NFPROTO_IPV4) {
7993 +@@ -1329,12 +1576,10 @@ IPSET_TOKEN(HTYPE, _create)(struct net *net, struct ip_set *set,
7994 + #ifndef IP_SET_PROTO_UNDEF
7995 + if (set->family == NFPROTO_IPV4)
7996 + #endif
7997 +- IPSET_TOKEN(HTYPE, 4_gc_init)(set,
7998 +- IPSET_TOKEN(HTYPE, 4_gc));
7999 ++ IPSET_TOKEN(HTYPE, 4_gc_init)(&h->gc);
8000 + #ifndef IP_SET_PROTO_UNDEF
8001 + else
8002 +- IPSET_TOKEN(HTYPE, 6_gc_init)(set,
8003 +- IPSET_TOKEN(HTYPE, 6_gc));
8004 ++ IPSET_TOKEN(HTYPE, 6_gc_init)(&h->gc);
8005 + #endif
8006 + }
8007 + pr_debug("create %s hashsize %u (%u) maxelem %u: %p(%p)\n",
8008 +diff --git a/net/netfilter/nft_tunnel.c b/net/netfilter/nft_tunnel.c
8009 +index f8d2919cf9fd..037e8fce9b30 100644
8010 +--- a/net/netfilter/nft_tunnel.c
8011 ++++ b/net/netfilter/nft_tunnel.c
8012 +@@ -505,8 +505,8 @@ static int nft_tunnel_opts_dump(struct sk_buff *skb,
8013 + static int nft_tunnel_ports_dump(struct sk_buff *skb,
8014 + struct ip_tunnel_info *info)
8015 + {
8016 +- if (nla_put_be16(skb, NFTA_TUNNEL_KEY_SPORT, htons(info->key.tp_src)) < 0 ||
8017 +- nla_put_be16(skb, NFTA_TUNNEL_KEY_DPORT, htons(info->key.tp_dst)) < 0)
8018 ++ if (nla_put_be16(skb, NFTA_TUNNEL_KEY_SPORT, info->key.tp_src) < 0 ||
8019 ++ nla_put_be16(skb, NFTA_TUNNEL_KEY_DPORT, info->key.tp_dst) < 0)
8020 + return -1;
8021 +
8022 + return 0;
8023 +diff --git a/net/netfilter/xt_hashlimit.c b/net/netfilter/xt_hashlimit.c
8024 +index 6520d9ec1297..1b68a131083c 100644
8025 +--- a/net/netfilter/xt_hashlimit.c
8026 ++++ b/net/netfilter/xt_hashlimit.c
8027 +@@ -36,6 +36,7 @@
8028 + #include <linux/netfilter_ipv6/ip6_tables.h>
8029 + #include <linux/mutex.h>
8030 + #include <linux/kernel.h>
8031 ++#include <linux/refcount.h>
8032 + #include <uapi/linux/netfilter/xt_hashlimit.h>
8033 +
8034 + #define XT_HASHLIMIT_ALL (XT_HASHLIMIT_HASH_DIP | XT_HASHLIMIT_HASH_DPT | \
8035 +@@ -114,7 +115,7 @@ struct dsthash_ent {
8036 +
8037 + struct xt_hashlimit_htable {
8038 + struct hlist_node node; /* global list of all htables */
8039 +- int use;
8040 ++ refcount_t use;
8041 + u_int8_t family;
8042 + bool rnd_initialized;
8043 +
8044 +@@ -315,7 +316,7 @@ static int htable_create(struct net *net, struct hashlimit_cfg3 *cfg,
8045 + for (i = 0; i < hinfo->cfg.size; i++)
8046 + INIT_HLIST_HEAD(&hinfo->hash[i]);
8047 +
8048 +- hinfo->use = 1;
8049 ++ refcount_set(&hinfo->use, 1);
8050 + hinfo->count = 0;
8051 + hinfo->family = family;
8052 + hinfo->rnd_initialized = false;
8053 +@@ -434,7 +435,7 @@ static struct xt_hashlimit_htable *htable_find_get(struct net *net,
8054 + hlist_for_each_entry(hinfo, &hashlimit_net->htables, node) {
8055 + if (!strcmp(name, hinfo->name) &&
8056 + hinfo->family == family) {
8057 +- hinfo->use++;
8058 ++ refcount_inc(&hinfo->use);
8059 + return hinfo;
8060 + }
8061 + }
8062 +@@ -443,12 +444,11 @@ static struct xt_hashlimit_htable *htable_find_get(struct net *net,
8063 +
8064 + static void htable_put(struct xt_hashlimit_htable *hinfo)
8065 + {
8066 +- mutex_lock(&hashlimit_mutex);
8067 +- if (--hinfo->use == 0) {
8068 ++ if (refcount_dec_and_mutex_lock(&hinfo->use, &hashlimit_mutex)) {
8069 + hlist_del(&hinfo->node);
8070 ++ mutex_unlock(&hashlimit_mutex);
8071 + htable_destroy(hinfo);
8072 + }
8073 +- mutex_unlock(&hashlimit_mutex);
8074 + }
8075 +
8076 + /* The algorithm used is the Simple Token Bucket Filter (TBF)
8077 +diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
8078 +index 90b2ab9dd449..e64b8784d487 100644
8079 +--- a/net/netlink/af_netlink.c
8080 ++++ b/net/netlink/af_netlink.c
8081 +@@ -1014,7 +1014,8 @@ static int netlink_bind(struct socket *sock, struct sockaddr *addr,
8082 + if (nlk->netlink_bind && groups) {
8083 + int group;
8084 +
8085 +- for (group = 0; group < nlk->ngroups; group++) {
8086 ++ /* nl_groups is a u32, so cap the maximum groups we can bind */
8087 ++ for (group = 0; group < BITS_PER_TYPE(u32); group++) {
8088 + if (!test_bit(group, &groups))
8089 + continue;
8090 + err = nlk->netlink_bind(net, group + 1);
8091 +@@ -1033,7 +1034,7 @@ static int netlink_bind(struct socket *sock, struct sockaddr *addr,
8092 + netlink_insert(sk, nladdr->nl_pid) :
8093 + netlink_autobind(sock);
8094 + if (err) {
8095 +- netlink_undo_bind(nlk->ngroups, groups, sk);
8096 ++ netlink_undo_bind(BITS_PER_TYPE(u32), groups, sk);
8097 + goto unlock;
8098 + }
8099 + }
8100 +diff --git a/net/sched/cls_flower.c b/net/sched/cls_flower.c
8101 +index 5eceeee593cf..1d270540e74d 100644
8102 +--- a/net/sched/cls_flower.c
8103 ++++ b/net/sched/cls_flower.c
8104 +@@ -303,6 +303,7 @@ static int fl_classify(struct sk_buff *skb, const struct tcf_proto *tp,
8105 + struct cls_fl_filter *f;
8106 +
8107 + list_for_each_entry_rcu(mask, &head->masks, list) {
8108 ++ flow_dissector_init_keys(&skb_key.control, &skb_key.basic);
8109 + fl_clear_masked_range(&skb_key, mask);
8110 +
8111 + skb_flow_dissect_meta(skb, &mask->dissector, &skb_key);
8112 +diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c
8113 +index 4ab8208a2dd4..c6d83a64eac3 100644
8114 +--- a/net/sctp/sm_statefuns.c
8115 ++++ b/net/sctp/sm_statefuns.c
8116 +@@ -170,6 +170,16 @@ static inline bool sctp_chunk_length_valid(struct sctp_chunk *chunk,
8117 + return true;
8118 + }
8119 +
8120 ++/* Check for format error in an ABORT chunk */
8121 ++static inline bool sctp_err_chunk_valid(struct sctp_chunk *chunk)
8122 ++{
8123 ++ struct sctp_errhdr *err;
8124 ++
8125 ++ sctp_walk_errors(err, chunk->chunk_hdr);
8126 ++
8127 ++ return (void *)err == (void *)chunk->chunk_end;
8128 ++}
8129 ++
8130 + /**********************************************************
8131 + * These are the state functions for handling chunk events.
8132 + **********************************************************/
8133 +@@ -2255,6 +2265,9 @@ enum sctp_disposition sctp_sf_shutdown_pending_abort(
8134 + sctp_bind_addr_state(&asoc->base.bind_addr, &chunk->dest))
8135 + return sctp_sf_discard_chunk(net, ep, asoc, type, arg, commands);
8136 +
8137 ++ if (!sctp_err_chunk_valid(chunk))
8138 ++ return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands);
8139 ++
8140 + return __sctp_sf_do_9_1_abort(net, ep, asoc, type, arg, commands);
8141 + }
8142 +
8143 +@@ -2298,6 +2311,9 @@ enum sctp_disposition sctp_sf_shutdown_sent_abort(
8144 + sctp_bind_addr_state(&asoc->base.bind_addr, &chunk->dest))
8145 + return sctp_sf_discard_chunk(net, ep, asoc, type, arg, commands);
8146 +
8147 ++ if (!sctp_err_chunk_valid(chunk))
8148 ++ return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands);
8149 ++
8150 + /* Stop the T2-shutdown timer. */
8151 + sctp_add_cmd_sf(commands, SCTP_CMD_TIMER_STOP,
8152 + SCTP_TO(SCTP_EVENT_TIMEOUT_T2_SHUTDOWN));
8153 +@@ -2565,6 +2581,9 @@ enum sctp_disposition sctp_sf_do_9_1_abort(
8154 + sctp_bind_addr_state(&asoc->base.bind_addr, &chunk->dest))
8155 + return sctp_sf_discard_chunk(net, ep, asoc, type, arg, commands);
8156 +
8157 ++ if (!sctp_err_chunk_valid(chunk))
8158 ++ return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands);
8159 ++
8160 + return __sctp_sf_do_9_1_abort(net, ep, asoc, type, arg, commands);
8161 + }
8162 +
8163 +@@ -2582,16 +2601,8 @@ static enum sctp_disposition __sctp_sf_do_9_1_abort(
8164 +
8165 + /* See if we have an error cause code in the chunk. */
8166 + len = ntohs(chunk->chunk_hdr->length);
8167 +- if (len >= sizeof(struct sctp_chunkhdr) + sizeof(struct sctp_errhdr)) {
8168 +- struct sctp_errhdr *err;
8169 +-
8170 +- sctp_walk_errors(err, chunk->chunk_hdr);
8171 +- if ((void *)err != (void *)chunk->chunk_end)
8172 +- return sctp_sf_pdiscard(net, ep, asoc, type, arg,
8173 +- commands);
8174 +-
8175 ++ if (len >= sizeof(struct sctp_chunkhdr) + sizeof(struct sctp_errhdr))
8176 + error = ((struct sctp_errhdr *)chunk->skb->data)->cause;
8177 +- }
8178 +
8179 + sctp_add_cmd_sf(commands, SCTP_CMD_SET_SK_ERR, SCTP_ERROR(ECONNRESET));
8180 + /* ASSOC_FAILED will DELETE_TCB. */
8181 +diff --git a/net/smc/af_smc.c b/net/smc/af_smc.c
8182 +index 6a6d3b2aa5a9..dc09a72f8110 100644
8183 +--- a/net/smc/af_smc.c
8184 ++++ b/net/smc/af_smc.c
8185 +@@ -467,6 +467,8 @@ static void smc_switch_to_fallback(struct smc_sock *smc)
8186 + if (smc->sk.sk_socket && smc->sk.sk_socket->file) {
8187 + smc->clcsock->file = smc->sk.sk_socket->file;
8188 + smc->clcsock->file->private_data = smc->clcsock;
8189 ++ smc->clcsock->wq.fasync_list =
8190 ++ smc->sk.sk_socket->wq.fasync_list;
8191 + }
8192 + }
8193 +
8194 +diff --git a/net/smc/smc_clc.c b/net/smc/smc_clc.c
8195 +index 49bcebff6378..aee9ccfa99c2 100644
8196 +--- a/net/smc/smc_clc.c
8197 ++++ b/net/smc/smc_clc.c
8198 +@@ -372,7 +372,9 @@ int smc_clc_send_decline(struct smc_sock *smc, u32 peer_diag_info)
8199 + dclc.hdr.length = htons(sizeof(struct smc_clc_msg_decline));
8200 + dclc.hdr.version = SMC_CLC_V1;
8201 + dclc.hdr.flag = (peer_diag_info == SMC_CLC_DECL_SYNCERR) ? 1 : 0;
8202 +- memcpy(dclc.id_for_peer, local_systemid, sizeof(local_systemid));
8203 ++ if (smc->conn.lgr && !smc->conn.lgr->is_smcd)
8204 ++ memcpy(dclc.id_for_peer, local_systemid,
8205 ++ sizeof(local_systemid));
8206 + dclc.peer_diagnosis = htonl(peer_diag_info);
8207 + memcpy(dclc.trl.eyecatcher, SMC_EYECATCHER, sizeof(SMC_EYECATCHER));
8208 +
8209 +diff --git a/net/tls/tls_device.c b/net/tls/tls_device.c
8210 +index 3f5209e2d4ee..1adeb1c0473b 100644
8211 +--- a/net/tls/tls_device.c
8212 ++++ b/net/tls/tls_device.c
8213 +@@ -581,7 +581,7 @@ struct tls_record_info *tls_get_record(struct tls_offload_context_tx *context,
8214 + u32 seq, u64 *p_record_sn)
8215 + {
8216 + u64 record_sn = context->hint_record_sn;
8217 +- struct tls_record_info *info;
8218 ++ struct tls_record_info *info, *last;
8219 +
8220 + info = context->retransmit_hint;
8221 + if (!info ||
8222 +@@ -593,6 +593,24 @@ struct tls_record_info *tls_get_record(struct tls_offload_context_tx *context,
8223 + struct tls_record_info, list);
8224 + if (!info)
8225 + return NULL;
8226 ++ /* send the start_marker record if seq number is before the
8227 ++ * tls offload start marker sequence number. This record is
8228 ++ * required to handle TCP packets which are before TLS offload
8229 ++ * started.
8230 ++ * And if it's not start marker, look if this seq number
8231 ++ * belongs to the list.
8232 ++ */
8233 ++ if (likely(!tls_record_is_start_marker(info))) {
8234 ++ /* we have the first record, get the last record to see
8235 ++ * if this seq number belongs to the list.
8236 ++ */
8237 ++ last = list_last_entry(&context->records_list,
8238 ++ struct tls_record_info, list);
8239 ++
8240 ++ if (!between(seq, tls_record_start_seq(info),
8241 ++ last->end_seq))
8242 ++ return NULL;
8243 ++ }
8244 + record_sn = context->unacked_record_sn;
8245 + }
8246 +
8247 +diff --git a/net/wireless/ethtool.c b/net/wireless/ethtool.c
8248 +index a9c0f368db5d..24e18405cdb4 100644
8249 +--- a/net/wireless/ethtool.c
8250 ++++ b/net/wireless/ethtool.c
8251 +@@ -7,9 +7,13 @@
8252 + void cfg80211_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
8253 + {
8254 + struct wireless_dev *wdev = dev->ieee80211_ptr;
8255 ++ struct device *pdev = wiphy_dev(wdev->wiphy);
8256 +
8257 +- strlcpy(info->driver, wiphy_dev(wdev->wiphy)->driver->name,
8258 +- sizeof(info->driver));
8259 ++ if (pdev->driver)
8260 ++ strlcpy(info->driver, pdev->driver->name,
8261 ++ sizeof(info->driver));
8262 ++ else
8263 ++ strlcpy(info->driver, "N/A", sizeof(info->driver));
8264 +
8265 + strlcpy(info->version, init_utsname()->release, sizeof(info->version));
8266 +
8267 +diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
8268 +index c74646b7a751..17514744af9e 100644
8269 +--- a/net/wireless/nl80211.c
8270 ++++ b/net/wireless/nl80211.c
8271 +@@ -437,6 +437,7 @@ const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = {
8272 + [NL80211_ATTR_CONTROL_PORT_NO_ENCRYPT] = { .type = NLA_FLAG },
8273 + [NL80211_ATTR_CONTROL_PORT_OVER_NL80211] = { .type = NLA_FLAG },
8274 + [NL80211_ATTR_PRIVACY] = { .type = NLA_FLAG },
8275 ++ [NL80211_ATTR_STATUS_CODE] = { .type = NLA_U16 },
8276 + [NL80211_ATTR_CIPHER_SUITE_GROUP] = { .type = NLA_U32 },
8277 + [NL80211_ATTR_WPA_VERSIONS] = { .type = NLA_U32 },
8278 + [NL80211_ATTR_PID] = { .type = NLA_U32 },
8279 +@@ -4794,8 +4795,7 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info)
8280 + err = nl80211_parse_he_obss_pd(
8281 + info->attrs[NL80211_ATTR_HE_OBSS_PD],
8282 + &params.he_obss_pd);
8283 +- if (err)
8284 +- return err;
8285 ++ goto out;
8286 + }
8287 +
8288 + nl80211_calculate_ap_params(&params);
8289 +@@ -4817,6 +4817,7 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info)
8290 + }
8291 + wdev_unlock(wdev);
8292 +
8293 ++out:
8294 + kfree(params.acl);
8295 +
8296 + return err;
8297 +diff --git a/scripts/Makefile.build b/scripts/Makefile.build
8298 +index a9e47953ca53..24a33c01bbf7 100644
8299 +--- a/scripts/Makefile.build
8300 ++++ b/scripts/Makefile.build
8301 +@@ -283,15 +283,6 @@ quiet_cmd_cc_lst_c = MKLST $@
8302 + $(obj)/%.lst: $(src)/%.c FORCE
8303 + $(call if_changed_dep,cc_lst_c)
8304 +
8305 +-# header test (header-test-y, header-test-m target)
8306 +-# ---------------------------------------------------------------------------
8307 +-
8308 +-quiet_cmd_cc_s_h = CC $@
8309 +- cmd_cc_s_h = $(CC) $(c_flags) -S -o $@ -x c /dev/null -include $<
8310 +-
8311 +-$(obj)/%.h.s: $(src)/%.h FORCE
8312 +- $(call if_changed_dep,cc_s_h)
8313 +-
8314 + # Compile assembler sources (.S)
8315 + # ---------------------------------------------------------------------------
8316 +
8317 +diff --git a/scripts/Makefile.headersinst b/scripts/Makefile.headersinst
8318 +index 1b405a7ed14f..708fbd08a2c5 100644
8319 +--- a/scripts/Makefile.headersinst
8320 ++++ b/scripts/Makefile.headersinst
8321 +@@ -56,9 +56,6 @@ new-dirs := $(filter-out $(existing-dirs), $(wanted-dirs))
8322 + $(if $(new-dirs), $(shell mkdir -p $(new-dirs)))
8323 +
8324 + # Rules
8325 +-
8326 +-ifndef HDRCHECK
8327 +-
8328 + quiet_cmd_install = HDRINST $@
8329 + cmd_install = $(CONFIG_SHELL) $(srctree)/scripts/headers_install.sh $< $@
8330 +
8331 +@@ -81,21 +78,6 @@ existing-headers := $(filter $(old-headers), $(all-headers))
8332 +
8333 + -include $(foreach f,$(existing-headers),$(dir $(f)).$(notdir $(f)).cmd)
8334 +
8335 +-else
8336 +-
8337 +-quiet_cmd_check = HDRCHK $<
8338 +- cmd_check = $(PERL) $(srctree)/scripts/headers_check.pl $(dst) $(SRCARCH) $<; touch $@
8339 +-
8340 +-check-files := $(addsuffix .chk, $(all-headers))
8341 +-
8342 +-$(check-files): $(dst)/%.chk : $(dst)/% $(srctree)/scripts/headers_check.pl
8343 +- $(call cmd,check)
8344 +-
8345 +-__headers: $(check-files)
8346 +- @:
8347 +-
8348 +-endif
8349 +-
8350 + PHONY += FORCE
8351 + FORCE:
8352 +
8353 +diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
8354 +index 179d55af5852..a66fc0acad1e 100644
8355 +--- a/scripts/Makefile.lib
8356 ++++ b/scripts/Makefile.lib
8357 +@@ -65,20 +65,6 @@ extra-y += $(patsubst %.dtb,%.dt.yaml, $(dtb-y))
8358 + extra-$(CONFIG_OF_ALL_DTBS) += $(patsubst %.dtb,%.dt.yaml, $(dtb-))
8359 + endif
8360 +
8361 +-# Test self-contained headers
8362 +-
8363 +-# Wildcard searches in $(srctree)/$(src)/, but not in $(objtree)/$(obj)/.
8364 +-# Stale generated headers are often left over, so pattern matching should
8365 +-# be avoided. Please notice $(srctree)/$(src)/ and $(objtree)/$(obj) point
8366 +-# to the same location for in-tree building. So, header-test-pattern-y should
8367 +-# be used with care.
8368 +-header-test-y += $(filter-out $(header-test-), \
8369 +- $(patsubst $(srctree)/$(src)/%, %, \
8370 +- $(wildcard $(addprefix $(srctree)/$(src)/, \
8371 +- $(header-test-pattern-y)))))
8372 +-
8373 +-extra-$(CONFIG_HEADER_TEST) += $(addsuffix .s, $(header-test-y) $(header-test-m))
8374 +-
8375 + # Add subdir path
8376 +
8377 + extra-y := $(addprefix $(obj)/,$(extra-y))
8378 +@@ -305,13 +291,13 @@ DT_TMP_SCHEMA := $(objtree)/$(DT_BINDING_DIR)/processed-schema.yaml
8379 + quiet_cmd_dtb_check = CHECK $@
8380 + cmd_dtb_check = $(DT_CHECKER) -u $(srctree)/$(DT_BINDING_DIR) -p $(DT_TMP_SCHEMA) $@ ;
8381 +
8382 +-define rule_dtc_dt_yaml
8383 ++define rule_dtc
8384 + $(call cmd_and_fixdep,dtc,yaml)
8385 + $(call cmd,dtb_check)
8386 + endef
8387 +
8388 + $(obj)/%.dt.yaml: $(src)/%.dts $(DTC) $(DT_TMP_SCHEMA) FORCE
8389 +- $(call if_changed_rule,dtc_dt_yaml)
8390 ++ $(call if_changed_rule,dtc)
8391 +
8392 + dtc-tmp = $(subst $(comma),_,$(dot-target).dts.tmp)
8393 +
8394 +diff --git a/security/integrity/ima/ima_policy.c b/security/integrity/ima/ima_policy.c
8395 +index 5380aca2b351..ee9aec5e98f0 100644
8396 +--- a/security/integrity/ima/ima_policy.c
8397 ++++ b/security/integrity/ima/ima_policy.c
8398 +@@ -263,7 +263,7 @@ static void ima_lsm_free_rule(struct ima_rule_entry *entry)
8399 + static struct ima_rule_entry *ima_lsm_copy_rule(struct ima_rule_entry *entry)
8400 + {
8401 + struct ima_rule_entry *nentry;
8402 +- int i, result;
8403 ++ int i;
8404 +
8405 + nentry = kmalloc(sizeof(*nentry), GFP_KERNEL);
8406 + if (!nentry)
8407 +@@ -277,7 +277,7 @@ static struct ima_rule_entry *ima_lsm_copy_rule(struct ima_rule_entry *entry)
8408 + memset(nentry->lsm, 0, FIELD_SIZEOF(struct ima_rule_entry, lsm));
8409 +
8410 + for (i = 0; i < MAX_LSM_RULES; i++) {
8411 +- if (!entry->lsm[i].rule)
8412 ++ if (!entry->lsm[i].args_p)
8413 + continue;
8414 +
8415 + nentry->lsm[i].type = entry->lsm[i].type;
8416 +@@ -286,13 +286,13 @@ static struct ima_rule_entry *ima_lsm_copy_rule(struct ima_rule_entry *entry)
8417 + if (!nentry->lsm[i].args_p)
8418 + goto out_err;
8419 +
8420 +- result = security_filter_rule_init(nentry->lsm[i].type,
8421 +- Audit_equal,
8422 +- nentry->lsm[i].args_p,
8423 +- &nentry->lsm[i].rule);
8424 +- if (result == -EINVAL)
8425 +- pr_warn("ima: rule for LSM \'%d\' is undefined\n",
8426 +- entry->lsm[i].type);
8427 ++ security_filter_rule_init(nentry->lsm[i].type,
8428 ++ Audit_equal,
8429 ++ nentry->lsm[i].args_p,
8430 ++ &nentry->lsm[i].rule);
8431 ++ if (!nentry->lsm[i].rule)
8432 ++ pr_warn("rule for LSM \'%s\' is undefined\n",
8433 ++ (char *)entry->lsm[i].args_p);
8434 + }
8435 + return nentry;
8436 +
8437 +@@ -329,7 +329,7 @@ static void ima_lsm_update_rules(void)
8438 + list_for_each_entry_safe(entry, e, &ima_policy_rules, list) {
8439 + needs_update = 0;
8440 + for (i = 0; i < MAX_LSM_RULES; i++) {
8441 +- if (entry->lsm[i].rule) {
8442 ++ if (entry->lsm[i].args_p) {
8443 + needs_update = 1;
8444 + break;
8445 + }
8446 +@@ -339,8 +339,7 @@ static void ima_lsm_update_rules(void)
8447 +
8448 + result = ima_lsm_update_rule(entry);
8449 + if (result) {
8450 +- pr_err("ima: lsm rule update error %d\n",
8451 +- result);
8452 ++ pr_err("lsm rule update error %d\n", result);
8453 + return;
8454 + }
8455 + }
8456 +@@ -357,7 +356,7 @@ int ima_lsm_policy_change(struct notifier_block *nb, unsigned long event,
8457 + }
8458 +
8459 + /**
8460 +- * ima_match_rules - determine whether an inode matches the measure rule.
8461 ++ * ima_match_rules - determine whether an inode matches the policy rule.
8462 + * @rule: a pointer to a rule
8463 + * @inode: a pointer to an inode
8464 + * @cred: a pointer to a credentials structure for user validation
8465 +@@ -415,9 +414,12 @@ static bool ima_match_rules(struct ima_rule_entry *rule, struct inode *inode,
8466 + int rc = 0;
8467 + u32 osid;
8468 +
8469 +- if (!rule->lsm[i].rule)
8470 +- continue;
8471 +-
8472 ++ if (!rule->lsm[i].rule) {
8473 ++ if (!rule->lsm[i].args_p)
8474 ++ continue;
8475 ++ else
8476 ++ return false;
8477 ++ }
8478 + switch (i) {
8479 + case LSM_OBJ_USER:
8480 + case LSM_OBJ_ROLE:
8481 +@@ -822,8 +824,14 @@ static int ima_lsm_rule_init(struct ima_rule_entry *entry,
8482 + entry->lsm[lsm_rule].args_p,
8483 + &entry->lsm[lsm_rule].rule);
8484 + if (!entry->lsm[lsm_rule].rule) {
8485 +- kfree(entry->lsm[lsm_rule].args_p);
8486 +- return -EINVAL;
8487 ++ pr_warn("rule for LSM \'%s\' is undefined\n",
8488 ++ (char *)entry->lsm[lsm_rule].args_p);
8489 ++
8490 ++ if (ima_rules == &ima_default_rules) {
8491 ++ kfree(entry->lsm[lsm_rule].args_p);
8492 ++ result = -EINVAL;
8493 ++ } else
8494 ++ result = 0;
8495 + }
8496 +
8497 + return result;
8498 +diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
8499 +index 7a7187e069b4..88c3df24b748 100644
8500 +--- a/tools/perf/ui/browsers/hists.c
8501 ++++ b/tools/perf/ui/browsers/hists.c
8502 +@@ -3054,6 +3054,7 @@ static int perf_evsel__hists_browse(struct evsel *evsel, int nr_events,
8503 +
8504 + continue;
8505 + }
8506 ++ actions->ms.map = map;
8507 + top = pstack__peek(browser->pstack);
8508 + if (top == &browser->hists->dso_filter) {
8509 + /*
8510 +diff --git a/tools/perf/ui/gtk/Build b/tools/perf/ui/gtk/Build
8511 +index ec22e899a224..9b5d5cbb7af7 100644
8512 +--- a/tools/perf/ui/gtk/Build
8513 ++++ b/tools/perf/ui/gtk/Build
8514 +@@ -7,3 +7,8 @@ gtk-y += util.o
8515 + gtk-y += helpline.o
8516 + gtk-y += progress.o
8517 + gtk-y += annotate.o
8518 ++gtk-y += zalloc.o
8519 ++
8520 ++$(OUTPUT)ui/gtk/zalloc.o: ../lib/zalloc.c FORCE
8521 ++ $(call rule_mkdir)
8522 ++ $(call if_changed_dep,cc_o_c)
8523 +diff --git a/tools/testing/selftests/ftrace/Makefile b/tools/testing/selftests/ftrace/Makefile
8524 +index cd1f5b3a7774..d6e106fbce11 100644
8525 +--- a/tools/testing/selftests/ftrace/Makefile
8526 ++++ b/tools/testing/selftests/ftrace/Makefile
8527 +@@ -2,7 +2,7 @@
8528 + all:
8529 +
8530 + TEST_PROGS := ftracetest
8531 +-TEST_FILES := test.d
8532 ++TEST_FILES := test.d settings
8533 + EXTRA_CLEAN := $(OUTPUT)/logs/*
8534 +
8535 + include ../lib.mk
8536 +diff --git a/tools/testing/selftests/livepatch/Makefile b/tools/testing/selftests/livepatch/Makefile
8537 +index fd405402c3ff..485696a01989 100644
8538 +--- a/tools/testing/selftests/livepatch/Makefile
8539 ++++ b/tools/testing/selftests/livepatch/Makefile
8540 +@@ -6,4 +6,6 @@ TEST_PROGS := \
8541 + test-callbacks.sh \
8542 + test-shadow-vars.sh
8543 +
8544 ++TEST_FILES := settings
8545 ++
8546 + include ../lib.mk
8547 +diff --git a/tools/testing/selftests/net/fib_tests.sh b/tools/testing/selftests/net/fib_tests.sh
8548 +index 76c1897e6352..474638ef2697 100755
8549 +--- a/tools/testing/selftests/net/fib_tests.sh
8550 ++++ b/tools/testing/selftests/net/fib_tests.sh
8551 +@@ -910,6 +910,12 @@ ipv6_rt_replace_mpath()
8552 + check_route6 "2001:db8:104::/64 via 2001:db8:101::3 dev veth1 metric 1024"
8553 + log_test $? 0 "Multipath with single path via multipath attribute"
8554 +
8555 ++ # multipath with dev-only
8556 ++ add_initial_route6 "nexthop via 2001:db8:101::2 nexthop via 2001:db8:103::2"
8557 ++ run_cmd "$IP -6 ro replace 2001:db8:104::/64 dev veth1"
8558 ++ check_route6 "2001:db8:104::/64 dev veth1 metric 1024"
8559 ++ log_test $? 0 "Multipath with dev-only"
8560 ++
8561 + # route replace fails - invalid nexthop 1
8562 + add_initial_route6 "nexthop via 2001:db8:101::2 nexthop via 2001:db8:103::2"
8563 + run_cmd "$IP -6 ro replace 2001:db8:104::/64 nexthop via 2001:db8:111::3 nexthop via 2001:db8:103::3"
8564 +diff --git a/tools/testing/selftests/rseq/Makefile b/tools/testing/selftests/rseq/Makefile
8565 +index d6469535630a..f1053630bb6f 100644
8566 +--- a/tools/testing/selftests/rseq/Makefile
8567 ++++ b/tools/testing/selftests/rseq/Makefile
8568 +@@ -19,6 +19,8 @@ TEST_GEN_PROGS_EXTENDED = librseq.so
8569 +
8570 + TEST_PROGS = run_param_test.sh
8571 +
8572 ++TEST_FILES := settings
8573 ++
8574 + include ../lib.mk
8575 +
8576 + $(OUTPUT)/librseq.so: rseq.c rseq.h rseq-*.h
8577 +diff --git a/tools/testing/selftests/rtc/Makefile b/tools/testing/selftests/rtc/Makefile
8578 +index de9c8566672a..90fa1a346908 100644
8579 +--- a/tools/testing/selftests/rtc/Makefile
8580 ++++ b/tools/testing/selftests/rtc/Makefile
8581 +@@ -6,4 +6,6 @@ TEST_GEN_PROGS = rtctest
8582 +
8583 + TEST_GEN_PROGS_EXTENDED = setdate
8584 +
8585 ++TEST_FILES := settings
8586 ++
8587 + include ../lib.mk
8588 +diff --git a/usr/include/Makefile b/usr/include/Makefile
8589 +index 57b20f7b6729..47cb91d3a51d 100644
8590 +--- a/usr/include/Makefile
8591 ++++ b/usr/include/Makefile
8592 +@@ -99,9 +99,16 @@ endif
8593 + # asm-generic/*.h is used by asm/*.h, and should not be included directly
8594 + header-test- += asm-generic/%
8595 +
8596 +-# The rest are compile-tested
8597 +-header-test-y += $(filter-out $(header-test-), \
8598 +- $(patsubst $(obj)/%,%, $(wildcard \
8599 +- $(addprefix $(obj)/, *.h */*.h */*/*.h */*/*/*.h))))
8600 ++extra-y := $(patsubst $(obj)/%.h,%.hdrtest, $(shell find $(obj) -name '*.h'))
8601 ++
8602 ++quiet_cmd_hdrtest = HDRTEST $<
8603 ++ cmd_hdrtest = \
8604 ++ $(CC) $(c_flags) -S -o /dev/null -x c /dev/null \
8605 ++ $(if $(filter-out $(header-test-), $*.h), -include $<); \
8606 ++ $(PERL) $(srctree)/scripts/headers_check.pl $(obj) $(SRCARCH) $<; \
8607 ++ touch $@
8608 ++
8609 ++$(obj)/%.hdrtest: $(obj)/%.h FORCE
8610 ++ $(call if_changed_dep,hdrtest)
8611 +
8612 + clean-files += $(filter-out Makefile, $(notdir $(wildcard $(obj)/*)))
8613 +diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
8614 +index b5ea1bafe513..03c681568ab1 100644
8615 +--- a/virt/kvm/kvm_main.c
8616 ++++ b/virt/kvm/kvm_main.c
8617 +@@ -2275,12 +2275,12 @@ int kvm_write_guest_offset_cached(struct kvm *kvm, struct gfn_to_hva_cache *ghc,
8618 + if (slots->generation != ghc->generation)
8619 + __kvm_gfn_to_hva_cache_init(slots, ghc, ghc->gpa, ghc->len);
8620 +
8621 +- if (unlikely(!ghc->memslot))
8622 +- return kvm_write_guest(kvm, gpa, data, len);
8623 +-
8624 + if (kvm_is_error_hva(ghc->hva))
8625 + return -EFAULT;
8626 +
8627 ++ if (unlikely(!ghc->memslot))
8628 ++ return kvm_write_guest(kvm, gpa, data, len);
8629 ++
8630 + r = __copy_to_user((void __user *)ghc->hva + offset, data, len);
8631 + if (r)
8632 + return -EFAULT;
8633 +@@ -2308,12 +2308,12 @@ int kvm_read_guest_cached(struct kvm *kvm, struct gfn_to_hva_cache *ghc,
8634 + if (slots->generation != ghc->generation)
8635 + __kvm_gfn_to_hva_cache_init(slots, ghc, ghc->gpa, ghc->len);
8636 +
8637 +- if (unlikely(!ghc->memslot))
8638 +- return kvm_read_guest(kvm, ghc->gpa, data, len);
8639 +-
8640 + if (kvm_is_error_hva(ghc->hva))
8641 + return -EFAULT;
8642 +
8643 ++ if (unlikely(!ghc->memslot))
8644 ++ return kvm_read_guest(kvm, ghc->gpa, data, len);
8645 ++
8646 + r = __copy_from_user(data, (void __user *)ghc->hva, len);
8647 + if (r)
8648 + return -EFAULT;