Gentoo Archives: gentoo-commits

From: Mike Pagano <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/linux-patches:5.16 commit in: /
Date: Tue, 08 Feb 2022 18:19:17
Message-Id: 1644344339.2f51148c7195ea86716547fd62f0f85cd9b4ce44.mpagano@gentoo
1 commit: 2f51148c7195ea86716547fd62f0f85cd9b4ce44
2 Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
3 AuthorDate: Tue Feb 8 18:18:59 2022 +0000
4 Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
5 CommitDate: Tue Feb 8 18:18:59 2022 +0000
6 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=2f51148c
7
8 Linux patch 5.16.8
9
10 Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org>
11
12 0000_README | 4 +
13 1007_linux-5.16.8.patch | 5970 +++++++++++++++++++++++++++++++++++++++++++++++
14 2 files changed, 5974 insertions(+)
15
16 diff --git a/0000_README b/0000_README
17 index 735f80d8..13f566fe 100644
18 --- a/0000_README
19 +++ b/0000_README
20 @@ -71,6 +71,10 @@ Patch: 1006_linux-5.16.7.patch
21 From: http://www.kernel.org
22 Desc: Linux 5.16.7
23
24 +Patch: 1007_linux-5.16.8.patch
25 +From: http://www.kernel.org
26 +Desc: Linux 5.16.8
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/1007_linux-5.16.8.patch b/1007_linux-5.16.8.patch
33 new file mode 100644
34 index 00000000..2a4a9628
35 --- /dev/null
36 +++ b/1007_linux-5.16.8.patch
37 @@ -0,0 +1,5970 @@
38 +diff --git a/Documentation/gpu/todo.rst b/Documentation/gpu/todo.rst
39 +index 60d1d7ee07197..01fb97dd2dd06 100644
40 +--- a/Documentation/gpu/todo.rst
41 ++++ b/Documentation/gpu/todo.rst
42 +@@ -311,30 +311,6 @@ Contact: Daniel Vetter, Noralf Tronnes
43 +
44 + Level: Advanced
45 +
46 +-Garbage collect fbdev scrolling acceleration
47 +---------------------------------------------
48 +-
49 +-Scroll acceleration has been disabled in fbcon. Now it works as the old
50 +-SCROLL_REDRAW mode. A ton of code was removed in fbcon.c and the hook bmove was
51 +-removed from fbcon_ops.
52 +-Remaining tasks:
53 +-
54 +-- a bunch of the hooks in fbcon_ops could be removed or simplified by calling
55 +- directly instead of the function table (with a switch on p->rotate)
56 +-
57 +-- fb_copyarea is unused after this, and can be deleted from all drivers
58 +-
59 +-- after that, fb_copyarea can be deleted from fb_ops in include/linux/fb.h as
60 +- well as cfb_copyarea
61 +-
62 +-Note that not all acceleration code can be deleted, since clearing and cursor
63 +-support is still accelerated, which might be good candidates for further
64 +-deletion projects.
65 +-
66 +-Contact: Daniel Vetter
67 +-
68 +-Level: Intermediate
69 +-
70 + idr_init_base()
71 + ---------------
72 +
73 +diff --git a/Makefile b/Makefile
74 +index b642e5650c0b1..0cbab4df51b92 100644
75 +--- a/Makefile
76 ++++ b/Makefile
77 +@@ -1,7 +1,7 @@
78 + # SPDX-License-Identifier: GPL-2.0
79 + VERSION = 5
80 + PATCHLEVEL = 16
81 +-SUBLEVEL = 7
82 ++SUBLEVEL = 8
83 + EXTRAVERSION =
84 + NAME = Gobble Gobble
85 +
86 +diff --git a/arch/arm64/include/asm/cputype.h b/arch/arm64/include/asm/cputype.h
87 +index 19b8441aa8f26..e8fdc10395b6a 100644
88 +--- a/arch/arm64/include/asm/cputype.h
89 ++++ b/arch/arm64/include/asm/cputype.h
90 +@@ -73,6 +73,7 @@
91 + #define ARM_CPU_PART_CORTEX_A76 0xD0B
92 + #define ARM_CPU_PART_NEOVERSE_N1 0xD0C
93 + #define ARM_CPU_PART_CORTEX_A77 0xD0D
94 ++#define ARM_CPU_PART_CORTEX_A510 0xD46
95 + #define ARM_CPU_PART_CORTEX_A710 0xD47
96 + #define ARM_CPU_PART_NEOVERSE_N2 0xD49
97 +
98 +@@ -115,6 +116,7 @@
99 + #define MIDR_CORTEX_A76 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A76)
100 + #define MIDR_NEOVERSE_N1 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_NEOVERSE_N1)
101 + #define MIDR_CORTEX_A77 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A77)
102 ++#define MIDR_CORTEX_A510 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A510)
103 + #define MIDR_CORTEX_A710 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A710)
104 + #define MIDR_NEOVERSE_N2 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_NEOVERSE_N2)
105 + #define MIDR_THUNDERX MIDR_CPU_MODEL(ARM_CPU_IMP_CAVIUM, CAVIUM_CPU_PART_THUNDERX)
106 +diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c
107 +index e4727dc771bf3..b2222d8eb0b55 100644
108 +--- a/arch/arm64/kvm/arm.c
109 ++++ b/arch/arm64/kvm/arm.c
110 +@@ -764,6 +764,24 @@ static bool kvm_vcpu_exit_request(struct kvm_vcpu *vcpu, int *ret)
111 + xfer_to_guest_mode_work_pending();
112 + }
113 +
114 ++/*
115 ++ * Actually run the vCPU, entering an RCU extended quiescent state (EQS) while
116 ++ * the vCPU is running.
117 ++ *
118 ++ * This must be noinstr as instrumentation may make use of RCU, and this is not
119 ++ * safe during the EQS.
120 ++ */
121 ++static int noinstr kvm_arm_vcpu_enter_exit(struct kvm_vcpu *vcpu)
122 ++{
123 ++ int ret;
124 ++
125 ++ guest_state_enter_irqoff();
126 ++ ret = kvm_call_hyp_ret(__kvm_vcpu_run, vcpu);
127 ++ guest_state_exit_irqoff();
128 ++
129 ++ return ret;
130 ++}
131 ++
132 + /**
133 + * kvm_arch_vcpu_ioctl_run - the main VCPU run function to execute guest code
134 + * @vcpu: The VCPU pointer
135 +@@ -854,9 +872,9 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu)
136 + * Enter the guest
137 + */
138 + trace_kvm_entry(*vcpu_pc(vcpu));
139 +- guest_enter_irqoff();
140 ++ guest_timing_enter_irqoff();
141 +
142 +- ret = kvm_call_hyp_ret(__kvm_vcpu_run, vcpu);
143 ++ ret = kvm_arm_vcpu_enter_exit(vcpu);
144 +
145 + vcpu->mode = OUTSIDE_GUEST_MODE;
146 + vcpu->stat.exits++;
147 +@@ -891,26 +909,23 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu)
148 + kvm_arch_vcpu_ctxsync_fp(vcpu);
149 +
150 + /*
151 +- * We may have taken a host interrupt in HYP mode (ie
152 +- * while executing the guest). This interrupt is still
153 +- * pending, as we haven't serviced it yet!
154 ++ * We must ensure that any pending interrupts are taken before
155 ++ * we exit guest timing so that timer ticks are accounted as
156 ++ * guest time. Transiently unmask interrupts so that any
157 ++ * pending interrupts are taken.
158 + *
159 +- * We're now back in SVC mode, with interrupts
160 +- * disabled. Enabling the interrupts now will have
161 +- * the effect of taking the interrupt again, in SVC
162 +- * mode this time.
163 ++ * Per ARM DDI 0487G.b section D1.13.4, an ISB (or other
164 ++ * context synchronization event) is necessary to ensure that
165 ++ * pending interrupts are taken.
166 + */
167 + local_irq_enable();
168 ++ isb();
169 ++ local_irq_disable();
170 ++
171 ++ guest_timing_exit_irqoff();
172 ++
173 ++ local_irq_enable();
174 +
175 +- /*
176 +- * We do local_irq_enable() before calling guest_exit() so
177 +- * that if a timer interrupt hits while running the guest we
178 +- * account that tick as being spent in the guest. We enable
179 +- * preemption after calling guest_exit() so that if we get
180 +- * preempted we make sure ticks after that is not counted as
181 +- * guest time.
182 +- */
183 +- guest_exit();
184 + trace_kvm_exit(ret, kvm_vcpu_trap_get_class(vcpu), *vcpu_pc(vcpu));
185 +
186 + /* Exit types that need handling before we can be preempted */
187 +diff --git a/arch/arm64/kvm/handle_exit.c b/arch/arm64/kvm/handle_exit.c
188 +index 275a27368a04c..a5ab5215094ee 100644
189 +--- a/arch/arm64/kvm/handle_exit.c
190 ++++ b/arch/arm64/kvm/handle_exit.c
191 +@@ -226,6 +226,14 @@ int handle_exit(struct kvm_vcpu *vcpu, int exception_index)
192 + {
193 + struct kvm_run *run = vcpu->run;
194 +
195 ++ if (ARM_SERROR_PENDING(exception_index)) {
196 ++ /*
197 ++ * The SError is handled by handle_exit_early(). If the guest
198 ++ * survives it will re-execute the original instruction.
199 ++ */
200 ++ return 1;
201 ++ }
202 ++
203 + exception_index = ARM_EXCEPTION_CODE(exception_index);
204 +
205 + switch (exception_index) {
206 +diff --git a/arch/arm64/kvm/hyp/include/hyp/switch.h b/arch/arm64/kvm/hyp/include/hyp/switch.h
207 +index 96c5f3fb78389..adb67f8c9d7d3 100644
208 +--- a/arch/arm64/kvm/hyp/include/hyp/switch.h
209 ++++ b/arch/arm64/kvm/hyp/include/hyp/switch.h
210 +@@ -446,7 +446,8 @@ static inline bool fixup_guest_exit(struct kvm_vcpu *vcpu, u64 *exit_code)
211 + if (ARM_EXCEPTION_CODE(*exit_code) != ARM_EXCEPTION_IRQ)
212 + vcpu->arch.fault.esr_el2 = read_sysreg_el2(SYS_ESR);
213 +
214 +- if (ARM_SERROR_PENDING(*exit_code)) {
215 ++ if (ARM_SERROR_PENDING(*exit_code) &&
216 ++ ARM_EXCEPTION_CODE(*exit_code) != ARM_EXCEPTION_IRQ) {
217 + u8 esr_ec = kvm_vcpu_trap_get_class(vcpu);
218 +
219 + /*
220 +diff --git a/arch/riscv/kvm/vcpu.c b/arch/riscv/kvm/vcpu.c
221 +index fb84619df0127..6078d7e1dd762 100644
222 +--- a/arch/riscv/kvm/vcpu.c
223 ++++ b/arch/riscv/kvm/vcpu.c
224 +@@ -74,6 +74,7 @@ int kvm_arch_vcpu_precreate(struct kvm *kvm, unsigned int id)
225 + int kvm_arch_vcpu_create(struct kvm_vcpu *vcpu)
226 + {
227 + struct kvm_cpu_context *cntx;
228 ++ struct kvm_vcpu_csr *reset_csr = &vcpu->arch.guest_reset_csr;
229 +
230 + /* Mark this VCPU never ran */
231 + vcpu->arch.ran_atleast_once = false;
232 +@@ -89,6 +90,9 @@ int kvm_arch_vcpu_create(struct kvm_vcpu *vcpu)
233 + cntx->hstatus |= HSTATUS_SPVP;
234 + cntx->hstatus |= HSTATUS_SPV;
235 +
236 ++ /* By default, make CY, TM, and IR counters accessible in VU mode */
237 ++ reset_csr->scounteren = 0x7;
238 ++
239 + /* Setup VCPU timer */
240 + kvm_riscv_vcpu_timer_init(vcpu);
241 +
242 +diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c
243 +index 18d825a39032a..5434030e851e4 100644
244 +--- a/arch/x86/events/intel/core.c
245 ++++ b/arch/x86/events/intel/core.c
246 +@@ -4709,6 +4709,19 @@ static __initconst const struct x86_pmu intel_pmu = {
247 + .lbr_read = intel_pmu_lbr_read_64,
248 + .lbr_save = intel_pmu_lbr_save,
249 + .lbr_restore = intel_pmu_lbr_restore,
250 ++
251 ++ /*
252 ++ * SMM has access to all 4 rings and while traditionally SMM code only
253 ++ * ran in CPL0, 2021-era firmware is starting to make use of CPL3 in SMM.
254 ++ *
255 ++ * Since the EVENTSEL.{USR,OS} CPL filtering makes no distinction
256 ++ * between SMM or not, this results in what should be pure userspace
257 ++ * counters including SMM data.
258 ++ *
259 ++ * This is a clear privilege issue, therefore globally disable
260 ++ * counting SMM by default.
261 ++ */
262 ++ .attr_freeze_on_smi = 1,
263 + };
264 +
265 + static __init void intel_clovertown_quirk(void)
266 +diff --git a/arch/x86/events/intel/pt.c b/arch/x86/events/intel/pt.c
267 +index 7f406c14715fd..2d33bba9a1440 100644
268 +--- a/arch/x86/events/intel/pt.c
269 ++++ b/arch/x86/events/intel/pt.c
270 +@@ -897,8 +897,9 @@ static void pt_handle_status(struct pt *pt)
271 + * means we are already losing data; need to let the decoder
272 + * know.
273 + */
274 +- if (!intel_pt_validate_hw_cap(PT_CAP_topa_multiple_entries) ||
275 +- buf->output_off == pt_buffer_region_size(buf)) {
276 ++ if (!buf->single &&
277 ++ (!intel_pt_validate_hw_cap(PT_CAP_topa_multiple_entries) ||
278 ++ buf->output_off == pt_buffer_region_size(buf))) {
279 + perf_aux_output_flag(&pt->handle,
280 + PERF_AUX_FLAG_TRUNCATED);
281 + advance++;
282 +diff --git a/block/bio-integrity.c b/block/bio-integrity.c
283 +index d251147154592..0827b19820c52 100644
284 +--- a/block/bio-integrity.c
285 ++++ b/block/bio-integrity.c
286 +@@ -373,7 +373,7 @@ void bio_integrity_advance(struct bio *bio, unsigned int bytes_done)
287 + struct blk_integrity *bi = blk_get_integrity(bio->bi_bdev->bd_disk);
288 + unsigned bytes = bio_integrity_bytes(bi, bytes_done >> 9);
289 +
290 +- bip->bip_iter.bi_sector += bytes_done >> 9;
291 ++ bip->bip_iter.bi_sector += bio_integrity_intervals(bi, bytes_done >> 9);
292 + bvec_iter_advance(bip->bip_vec, &bip->bip_iter, bytes);
293 + }
294 +
295 +diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
296 +index aba0c67d1bd65..1cdf8cfcc31b3 100644
297 +--- a/drivers/ata/libata-core.c
298 ++++ b/drivers/ata/libata-core.c
299 +@@ -2043,6 +2043,9 @@ static bool ata_log_supported(struct ata_device *dev, u8 log)
300 + {
301 + struct ata_port *ap = dev->link->ap;
302 +
303 ++ if (dev->horkage & ATA_HORKAGE_NO_LOG_DIR)
304 ++ return false;
305 ++
306 + if (ata_read_log_page(dev, ATA_LOG_DIRECTORY, 0, ap->sector_buf, 1))
307 + return false;
308 + return get_unaligned_le16(&ap->sector_buf[log * 2]) ? true : false;
309 +@@ -4123,6 +4126,13 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = {
310 + { "WDC WD3000JD-*", NULL, ATA_HORKAGE_WD_BROKEN_LPM },
311 + { "WDC WD3200JD-*", NULL, ATA_HORKAGE_WD_BROKEN_LPM },
312 +
313 ++ /*
314 ++ * This sata dom device goes on a walkabout when the ATA_LOG_DIRECTORY
315 ++ * log page is accessed. Ensure we never ask for this log page with
316 ++ * these devices.
317 ++ */
318 ++ { "SATADOM-ML 3ME", NULL, ATA_HORKAGE_NO_LOG_DIR },
319 ++
320 + /* End Marker */
321 + { }
322 + };
323 +diff --git a/drivers/dma-buf/dma-heap.c b/drivers/dma-buf/dma-heap.c
324 +index 56bf5ad01ad54..8f5848aa144fe 100644
325 +--- a/drivers/dma-buf/dma-heap.c
326 ++++ b/drivers/dma-buf/dma-heap.c
327 +@@ -14,6 +14,7 @@
328 + #include <linux/xarray.h>
329 + #include <linux/list.h>
330 + #include <linux/slab.h>
331 ++#include <linux/nospec.h>
332 + #include <linux/uaccess.h>
333 + #include <linux/syscalls.h>
334 + #include <linux/dma-heap.h>
335 +@@ -135,6 +136,7 @@ static long dma_heap_ioctl(struct file *file, unsigned int ucmd,
336 + if (nr >= ARRAY_SIZE(dma_heap_ioctl_cmds))
337 + return -EINVAL;
338 +
339 ++ nr = array_index_nospec(nr, ARRAY_SIZE(dma_heap_ioctl_cmds));
340 + /* Get the kernel ioctl cmd that matches */
341 + kcmd = dma_heap_ioctl_cmds[nr];
342 +
343 +diff --git a/drivers/edac/altera_edac.c b/drivers/edac/altera_edac.c
344 +index 3a6d2416cb0f6..5dd29789f97d3 100644
345 +--- a/drivers/edac/altera_edac.c
346 ++++ b/drivers/edac/altera_edac.c
347 +@@ -350,7 +350,7 @@ static int altr_sdram_probe(struct platform_device *pdev)
348 + if (irq < 0) {
349 + edac_printk(KERN_ERR, EDAC_MC,
350 + "No irq %d in DT\n", irq);
351 +- return -ENODEV;
352 ++ return irq;
353 + }
354 +
355 + /* Arria10 has a 2nd IRQ */
356 +diff --git a/drivers/edac/xgene_edac.c b/drivers/edac/xgene_edac.c
357 +index 2ccd1db5e98ff..7197f9fa02457 100644
358 +--- a/drivers/edac/xgene_edac.c
359 ++++ b/drivers/edac/xgene_edac.c
360 +@@ -1919,7 +1919,7 @@ static int xgene_edac_probe(struct platform_device *pdev)
361 + irq = platform_get_irq_optional(pdev, i);
362 + if (irq < 0) {
363 + dev_err(&pdev->dev, "No IRQ resource\n");
364 +- rc = -EINVAL;
365 ++ rc = irq;
366 + goto out_err;
367 + }
368 + rc = devm_request_irq(&pdev->dev, irq,
369 +diff --git a/drivers/gpio/gpio-idt3243x.c b/drivers/gpio/gpio-idt3243x.c
370 +index 08493b05be2da..52b8b72ded77f 100644
371 +--- a/drivers/gpio/gpio-idt3243x.c
372 ++++ b/drivers/gpio/gpio-idt3243x.c
373 +@@ -132,7 +132,7 @@ static int idt_gpio_probe(struct platform_device *pdev)
374 + struct device *dev = &pdev->dev;
375 + struct gpio_irq_chip *girq;
376 + struct idt_gpio_ctrl *ctrl;
377 +- unsigned int parent_irq;
378 ++ int parent_irq;
379 + int ngpios;
380 + int ret;
381 +
382 +diff --git a/drivers/gpio/gpio-mpc8xxx.c b/drivers/gpio/gpio-mpc8xxx.c
383 +index 01634c8d27b38..a964e25ea6206 100644
384 +--- a/drivers/gpio/gpio-mpc8xxx.c
385 ++++ b/drivers/gpio/gpio-mpc8xxx.c
386 +@@ -47,7 +47,7 @@ struct mpc8xxx_gpio_chip {
387 + unsigned offset, int value);
388 +
389 + struct irq_domain *irq;
390 +- unsigned int irqn;
391 ++ int irqn;
392 + };
393 +
394 + /*
395 +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
396 +index f999638a04ed6..c811161ce9f09 100644
397 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
398 ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
399 +@@ -2241,8 +2241,7 @@ static int amdgpu_pmops_prepare(struct device *dev)
400 + * DPM_FLAG_SMART_SUSPEND works properly
401 + */
402 + if (amdgpu_device_supports_boco(drm_dev))
403 +- return pm_runtime_suspended(dev) &&
404 +- pm_suspend_via_firmware();
405 ++ return pm_runtime_suspended(dev);
406 +
407 + return 0;
408 + }
409 +diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c
410 +index 61ec6145bbb16..614c1362a21d2 100644
411 +--- a/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c
412 ++++ b/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c
413 +@@ -1147,6 +1147,9 @@ static void gmc_v10_0_get_clockgating_state(void *handle, u32 *flags)
414 + {
415 + struct amdgpu_device *adev = (struct amdgpu_device *)handle;
416 +
417 ++ if (adev->ip_versions[GC_HWIP][0] == IP_VERSION(10, 1, 3))
418 ++ return;
419 ++
420 + adev->mmhub.funcs->get_clockgating(adev, flags);
421 +
422 + if (adev->ip_versions[ATHUB_HWIP][0] >= IP_VERSION(2, 1, 0))
423 +diff --git a/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn301/vg_clk_mgr.c b/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn301/vg_clk_mgr.c
424 +index 3eee32faa208c..329ce4e84b83c 100644
425 +--- a/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn301/vg_clk_mgr.c
426 ++++ b/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn301/vg_clk_mgr.c
427 +@@ -582,32 +582,32 @@ static struct wm_table lpddr5_wm_table = {
428 + .wm_inst = WM_A,
429 + .wm_type = WM_TYPE_PSTATE_CHG,
430 + .pstate_latency_us = 11.65333,
431 +- .sr_exit_time_us = 7.95,
432 +- .sr_enter_plus_exit_time_us = 9,
433 ++ .sr_exit_time_us = 13.5,
434 ++ .sr_enter_plus_exit_time_us = 16.5,
435 + .valid = true,
436 + },
437 + {
438 + .wm_inst = WM_B,
439 + .wm_type = WM_TYPE_PSTATE_CHG,
440 + .pstate_latency_us = 11.65333,
441 +- .sr_exit_time_us = 9.82,
442 +- .sr_enter_plus_exit_time_us = 11.196,
443 ++ .sr_exit_time_us = 13.5,
444 ++ .sr_enter_plus_exit_time_us = 16.5,
445 + .valid = true,
446 + },
447 + {
448 + .wm_inst = WM_C,
449 + .wm_type = WM_TYPE_PSTATE_CHG,
450 + .pstate_latency_us = 11.65333,
451 +- .sr_exit_time_us = 9.89,
452 +- .sr_enter_plus_exit_time_us = 11.24,
453 ++ .sr_exit_time_us = 13.5,
454 ++ .sr_enter_plus_exit_time_us = 16.5,
455 + .valid = true,
456 + },
457 + {
458 + .wm_inst = WM_D,
459 + .wm_type = WM_TYPE_PSTATE_CHG,
460 + .pstate_latency_us = 11.65333,
461 +- .sr_exit_time_us = 9.748,
462 +- .sr_enter_plus_exit_time_us = 11.102,
463 ++ .sr_exit_time_us = 13.5,
464 ++ .sr_enter_plus_exit_time_us = 16.5,
465 + .valid = true,
466 + },
467 + }
468 +diff --git a/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn31/dcn31_clk_mgr.c b/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn31/dcn31_clk_mgr.c
469 +index 9df38e2ee4f40..ed53dcead839e 100644
470 +--- a/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn31/dcn31_clk_mgr.c
471 ++++ b/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn31/dcn31_clk_mgr.c
472 +@@ -329,38 +329,38 @@ static struct clk_bw_params dcn31_bw_params = {
473 +
474 + };
475 +
476 +-static struct wm_table ddr4_wm_table = {
477 ++static struct wm_table ddr5_wm_table = {
478 + .entries = {
479 + {
480 + .wm_inst = WM_A,
481 + .wm_type = WM_TYPE_PSTATE_CHG,
482 + .pstate_latency_us = 11.72,
483 +- .sr_exit_time_us = 6.09,
484 +- .sr_enter_plus_exit_time_us = 7.14,
485 ++ .sr_exit_time_us = 9,
486 ++ .sr_enter_plus_exit_time_us = 11,
487 + .valid = true,
488 + },
489 + {
490 + .wm_inst = WM_B,
491 + .wm_type = WM_TYPE_PSTATE_CHG,
492 + .pstate_latency_us = 11.72,
493 +- .sr_exit_time_us = 10.12,
494 +- .sr_enter_plus_exit_time_us = 11.48,
495 ++ .sr_exit_time_us = 9,
496 ++ .sr_enter_plus_exit_time_us = 11,
497 + .valid = true,
498 + },
499 + {
500 + .wm_inst = WM_C,
501 + .wm_type = WM_TYPE_PSTATE_CHG,
502 + .pstate_latency_us = 11.72,
503 +- .sr_exit_time_us = 10.12,
504 +- .sr_enter_plus_exit_time_us = 11.48,
505 ++ .sr_exit_time_us = 9,
506 ++ .sr_enter_plus_exit_time_us = 11,
507 + .valid = true,
508 + },
509 + {
510 + .wm_inst = WM_D,
511 + .wm_type = WM_TYPE_PSTATE_CHG,
512 + .pstate_latency_us = 11.72,
513 +- .sr_exit_time_us = 10.12,
514 +- .sr_enter_plus_exit_time_us = 11.48,
515 ++ .sr_exit_time_us = 9,
516 ++ .sr_enter_plus_exit_time_us = 11,
517 + .valid = true,
518 + },
519 + }
520 +@@ -688,7 +688,7 @@ void dcn31_clk_mgr_construct(
521 + if (ctx->dc_bios->integrated_info->memory_type == LpDdr5MemType) {
522 + dcn31_bw_params.wm_table = lpddr5_wm_table;
523 + } else {
524 +- dcn31_bw_params.wm_table = ddr4_wm_table;
525 ++ dcn31_bw_params.wm_table = ddr5_wm_table;
526 + }
527 + /* Saved clocks configured at boot for debug purposes */
528 + dcn31_dump_clk_registers(&clk_mgr->base.base.boot_snapshot, &clk_mgr->base.base, &log_info);
529 +diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c b/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c
530 +index 13bc69d6b6791..ccd6cdbe46f43 100644
531 +--- a/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c
532 ++++ b/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c
533 +@@ -4730,6 +4730,26 @@ static bool retrieve_link_cap(struct dc_link *link)
534 + dp_hw_fw_revision.ieee_fw_rev,
535 + sizeof(dp_hw_fw_revision.ieee_fw_rev));
536 +
537 ++ /* Quirk for Apple MBP 2018 15" Retina panels: wrong DP_MAX_LINK_RATE */
538 ++ {
539 ++ uint8_t str_mbp_2018[] = { 101, 68, 21, 103, 98, 97 };
540 ++ uint8_t fwrev_mbp_2018[] = { 7, 4 };
541 ++ uint8_t fwrev_mbp_2018_vega[] = { 8, 4 };
542 ++
543 ++ /* We also check for the firmware revision as 16,1 models have an
544 ++ * identical device id and are incorrectly quirked otherwise.
545 ++ */
546 ++ if ((link->dpcd_caps.sink_dev_id == 0x0010fa) &&
547 ++ !memcmp(link->dpcd_caps.sink_dev_id_str, str_mbp_2018,
548 ++ sizeof(str_mbp_2018)) &&
549 ++ (!memcmp(link->dpcd_caps.sink_fw_revision, fwrev_mbp_2018,
550 ++ sizeof(fwrev_mbp_2018)) ||
551 ++ !memcmp(link->dpcd_caps.sink_fw_revision, fwrev_mbp_2018_vega,
552 ++ sizeof(fwrev_mbp_2018_vega)))) {
553 ++ link->reported_link_cap.link_rate = LINK_RATE_RBR2;
554 ++ }
555 ++ }
556 ++
557 + memset(&link->dpcd_caps.dsc_caps, '\0',
558 + sizeof(link->dpcd_caps.dsc_caps));
559 + memset(&link->dpcd_caps.fec_cap, '\0', sizeof(link->dpcd_caps.fec_cap));
560 +diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c
561 +index a4108025fe299..446d37320b948 100644
562 +--- a/drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c
563 ++++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c
564 +@@ -3681,14 +3681,14 @@ static ssize_t sienna_cichlid_get_gpu_metrics(struct smu_context *smu,
565 +
566 + static int sienna_cichlid_enable_mgpu_fan_boost(struct smu_context *smu)
567 + {
568 +- struct smu_table_context *table_context = &smu->smu_table;
569 +- PPTable_t *smc_pptable = table_context->driver_pptable;
570 ++ uint16_t *mgpu_fan_boost_limit_rpm;
571 +
572 ++ GET_PPTABLE_MEMBER(MGpuFanBoostLimitRpm, &mgpu_fan_boost_limit_rpm);
573 + /*
574 + * Skip the MGpuFanBoost setting for those ASICs
575 + * which do not support it
576 + */
577 +- if (!smc_pptable->MGpuFanBoostLimitRpm)
578 ++ if (*mgpu_fan_boost_limit_rpm == 0)
579 + return 0;
580 +
581 + return smu_cmn_send_smc_msg_with_param(smu,
582 +diff --git a/drivers/gpu/drm/i915/display/intel_overlay.c b/drivers/gpu/drm/i915/display/intel_overlay.c
583 +index 7e3f5c6ca4846..dfa5f18171e3b 100644
584 +--- a/drivers/gpu/drm/i915/display/intel_overlay.c
585 ++++ b/drivers/gpu/drm/i915/display/intel_overlay.c
586 +@@ -959,6 +959,9 @@ static int check_overlay_dst(struct intel_overlay *overlay,
587 + const struct intel_crtc_state *pipe_config =
588 + overlay->crtc->config;
589 +
590 ++ if (rec->dst_height == 0 || rec->dst_width == 0)
591 ++ return -EINVAL;
592 ++
593 + if (rec->dst_x < pipe_config->pipe_src_w &&
594 + rec->dst_x + rec->dst_width <= pipe_config->pipe_src_w &&
595 + rec->dst_y < pipe_config->pipe_src_h &&
596 +diff --git a/drivers/gpu/drm/i915/display/intel_tc.c b/drivers/gpu/drm/i915/display/intel_tc.c
597 +index 40faa18947c99..dbd7d0d83a141 100644
598 +--- a/drivers/gpu/drm/i915/display/intel_tc.c
599 ++++ b/drivers/gpu/drm/i915/display/intel_tc.c
600 +@@ -345,10 +345,11 @@ static bool icl_tc_phy_status_complete(struct intel_digital_port *dig_port)
601 + static bool adl_tc_phy_status_complete(struct intel_digital_port *dig_port)
602 + {
603 + struct drm_i915_private *i915 = to_i915(dig_port->base.base.dev);
604 ++ enum tc_port tc_port = intel_port_to_tc(i915, dig_port->base.port);
605 + struct intel_uncore *uncore = &i915->uncore;
606 + u32 val;
607 +
608 +- val = intel_uncore_read(uncore, TCSS_DDI_STATUS(dig_port->tc_phy_fia_idx));
609 ++ val = intel_uncore_read(uncore, TCSS_DDI_STATUS(tc_port));
610 + if (val == 0xffffffff) {
611 + drm_dbg_kms(&i915->drm,
612 + "Port %s: PHY in TCCOLD, assuming not complete\n",
613 +diff --git a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
614 +index cb0bf6ffd0e38..cf8d17128439f 100644
615 +--- a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
616 ++++ b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
617 +@@ -2372,9 +2372,14 @@ static int eb_pin_timeline(struct i915_execbuffer *eb, struct intel_context *ce,
618 + timeout) < 0) {
619 + i915_request_put(rq);
620 +
621 +- tl = intel_context_timeline_lock(ce);
622 ++ /*
623 ++ * Error path, cannot use intel_context_timeline_lock as
624 ++ * that is user interruptable and this clean up step
625 ++ * must be done.
626 ++ */
627 ++ mutex_lock(&ce->timeline->mutex);
628 + intel_context_exit(ce);
629 +- intel_context_timeline_unlock(tl);
630 ++ mutex_unlock(&ce->timeline->mutex);
631 +
632 + if (nonblock)
633 + return -EWOULDBLOCK;
634 +diff --git a/drivers/gpu/drm/i915/i915_pci.c b/drivers/gpu/drm/i915/i915_pci.c
635 +index 169837de395d3..8a4b8ff4cde10 100644
636 +--- a/drivers/gpu/drm/i915/i915_pci.c
637 ++++ b/drivers/gpu/drm/i915/i915_pci.c
638 +@@ -866,7 +866,7 @@ static const struct intel_device_info jsl_info = {
639 + TGL_CURSOR_OFFSETS, \
640 + .has_global_mocs = 1, \
641 + .has_pxp = 1, \
642 +- .display.has_dsb = 1
643 ++ .display.has_dsb = 0 /* FIXME: LUT load is broken with DSB */
644 +
645 + static const struct intel_device_info tgl_info = {
646 + GEN12_FEATURES,
647 +diff --git a/drivers/gpu/drm/kmb/kmb_plane.c b/drivers/gpu/drm/kmb/kmb_plane.c
648 +index 00404ba4126dd..2735b8eb35376 100644
649 +--- a/drivers/gpu/drm/kmb/kmb_plane.c
650 ++++ b/drivers/gpu/drm/kmb/kmb_plane.c
651 +@@ -158,12 +158,6 @@ static void kmb_plane_atomic_disable(struct drm_plane *plane,
652 + case LAYER_1:
653 + kmb->plane_status[plane_id].ctrl = LCD_CTRL_VL2_ENABLE;
654 + break;
655 +- case LAYER_2:
656 +- kmb->plane_status[plane_id].ctrl = LCD_CTRL_GL1_ENABLE;
657 +- break;
658 +- case LAYER_3:
659 +- kmb->plane_status[plane_id].ctrl = LCD_CTRL_GL2_ENABLE;
660 +- break;
661 + }
662 +
663 + kmb->plane_status[plane_id].disable = true;
664 +diff --git a/drivers/gpu/drm/mxsfb/mxsfb_kms.c b/drivers/gpu/drm/mxsfb/mxsfb_kms.c
665 +index 0655582ae8ed6..4cfb6c0016799 100644
666 +--- a/drivers/gpu/drm/mxsfb/mxsfb_kms.c
667 ++++ b/drivers/gpu/drm/mxsfb/mxsfb_kms.c
668 +@@ -361,7 +361,11 @@ static void mxsfb_crtc_atomic_enable(struct drm_crtc *crtc,
669 + bridge_state =
670 + drm_atomic_get_new_bridge_state(state,
671 + mxsfb->bridge);
672 +- bus_format = bridge_state->input_bus_cfg.format;
673 ++ if (!bridge_state)
674 ++ bus_format = MEDIA_BUS_FMT_FIXED;
675 ++ else
676 ++ bus_format = bridge_state->input_bus_cfg.format;
677 ++
678 + if (bus_format == MEDIA_BUS_FMT_FIXED) {
679 + dev_warn_once(drm->dev,
680 + "Bridge does not provide bus format, assuming MEDIA_BUS_FMT_RGB888_1X24.\n"
681 +diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/base.c b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/base.c
682 +index d0f52d59fc2f9..64e423dddd9e7 100644
683 +--- a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/base.c
684 ++++ b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/base.c
685 +@@ -38,7 +38,7 @@ nvbios_addr(struct nvkm_bios *bios, u32 *addr, u8 size)
686 + *addr += bios->imaged_addr;
687 + }
688 +
689 +- if (unlikely(*addr + size >= bios->size)) {
690 ++ if (unlikely(*addr + size > bios->size)) {
691 + nvkm_error(&bios->subdev, "OOB %d %08x %08x\n", size, p, *addr);
692 + return false;
693 + }
694 +diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c
695 +index c903b74f46a46..35f0d5e7533d6 100644
696 +--- a/drivers/infiniband/core/cm.c
697 ++++ b/drivers/infiniband/core/cm.c
698 +@@ -3322,7 +3322,7 @@ static int cm_lap_handler(struct cm_work *work)
699 + ret = cm_init_av_by_path(param->alternate_path, NULL, &alt_av);
700 + if (ret) {
701 + rdma_destroy_ah_attr(&ah_attr);
702 +- return -EINVAL;
703 ++ goto deref;
704 + }
705 +
706 + spin_lock_irq(&cm_id_priv->lock);
707 +diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
708 +index a3834ef691910..a8da4291e7e3b 100644
709 +--- a/drivers/infiniband/core/cma.c
710 ++++ b/drivers/infiniband/core/cma.c
711 +@@ -67,8 +67,8 @@ static const char * const cma_events[] = {
712 + [RDMA_CM_EVENT_TIMEWAIT_EXIT] = "timewait exit",
713 + };
714 +
715 +-static void cma_set_mgid(struct rdma_id_private *id_priv, struct sockaddr *addr,
716 +- union ib_gid *mgid);
717 ++static void cma_iboe_set_mgid(struct sockaddr *addr, union ib_gid *mgid,
718 ++ enum ib_gid_type gid_type);
719 +
720 + const char *__attribute_const__ rdma_event_msg(enum rdma_cm_event_type event)
721 + {
722 +@@ -1846,17 +1846,19 @@ static void destroy_mc(struct rdma_id_private *id_priv,
723 + if (dev_addr->bound_dev_if)
724 + ndev = dev_get_by_index(dev_addr->net,
725 + dev_addr->bound_dev_if);
726 +- if (ndev) {
727 ++ if (ndev && !send_only) {
728 ++ enum ib_gid_type gid_type;
729 + union ib_gid mgid;
730 +
731 +- cma_set_mgid(id_priv, (struct sockaddr *)&mc->addr,
732 +- &mgid);
733 +-
734 +- if (!send_only)
735 +- cma_igmp_send(ndev, &mgid, false);
736 +-
737 +- dev_put(ndev);
738 ++ gid_type = id_priv->cma_dev->default_gid_type
739 ++ [id_priv->id.port_num -
740 ++ rdma_start_port(
741 ++ id_priv->cma_dev->device)];
742 ++ cma_iboe_set_mgid((struct sockaddr *)&mc->addr, &mgid,
743 ++ gid_type);
744 ++ cma_igmp_send(ndev, &mgid, false);
745 + }
746 ++ dev_put(ndev);
747 +
748 + cancel_work_sync(&mc->iboe_join.work);
749 + }
750 +diff --git a/drivers/infiniband/core/ucma.c b/drivers/infiniband/core/ucma.c
751 +index 2b72c4fa95506..9d6ac9dff39a2 100644
752 +--- a/drivers/infiniband/core/ucma.c
753 ++++ b/drivers/infiniband/core/ucma.c
754 +@@ -95,6 +95,7 @@ struct ucma_context {
755 + u64 uid;
756 +
757 + struct list_head list;
758 ++ struct list_head mc_list;
759 + struct work_struct close_work;
760 + };
761 +
762 +@@ -105,6 +106,7 @@ struct ucma_multicast {
763 +
764 + u64 uid;
765 + u8 join_state;
766 ++ struct list_head list;
767 + struct sockaddr_storage addr;
768 + };
769 +
770 +@@ -198,6 +200,7 @@ static struct ucma_context *ucma_alloc_ctx(struct ucma_file *file)
771 +
772 + INIT_WORK(&ctx->close_work, ucma_close_id);
773 + init_completion(&ctx->comp);
774 ++ INIT_LIST_HEAD(&ctx->mc_list);
775 + /* So list_del() will work if we don't do ucma_finish_ctx() */
776 + INIT_LIST_HEAD(&ctx->list);
777 + ctx->file = file;
778 +@@ -484,19 +487,19 @@ err1:
779 +
780 + static void ucma_cleanup_multicast(struct ucma_context *ctx)
781 + {
782 +- struct ucma_multicast *mc;
783 +- unsigned long index;
784 ++ struct ucma_multicast *mc, *tmp;
785 +
786 +- xa_for_each(&multicast_table, index, mc) {
787 +- if (mc->ctx != ctx)
788 +- continue;
789 ++ xa_lock(&multicast_table);
790 ++ list_for_each_entry_safe(mc, tmp, &ctx->mc_list, list) {
791 ++ list_del(&mc->list);
792 + /*
793 + * At this point mc->ctx->ref is 0 so the mc cannot leave the
794 + * lock on the reader and this is enough serialization
795 + */
796 +- xa_erase(&multicast_table, index);
797 ++ __xa_erase(&multicast_table, mc->id);
798 + kfree(mc);
799 + }
800 ++ xa_unlock(&multicast_table);
801 + }
802 +
803 + static void ucma_cleanup_mc_events(struct ucma_multicast *mc)
804 +@@ -1469,12 +1472,16 @@ static ssize_t ucma_process_join(struct ucma_file *file,
805 + mc->uid = cmd->uid;
806 + memcpy(&mc->addr, addr, cmd->addr_size);
807 +
808 +- if (xa_alloc(&multicast_table, &mc->id, NULL, xa_limit_32b,
809 ++ xa_lock(&multicast_table);
810 ++ if (__xa_alloc(&multicast_table, &mc->id, NULL, xa_limit_32b,
811 + GFP_KERNEL)) {
812 + ret = -ENOMEM;
813 + goto err_free_mc;
814 + }
815 +
816 ++ list_add_tail(&mc->list, &ctx->mc_list);
817 ++ xa_unlock(&multicast_table);
818 ++
819 + mutex_lock(&ctx->mutex);
820 + ret = rdma_join_multicast(ctx->cm_id, (struct sockaddr *)&mc->addr,
821 + join_state, mc);
822 +@@ -1500,8 +1507,11 @@ err_leave_multicast:
823 + mutex_unlock(&ctx->mutex);
824 + ucma_cleanup_mc_events(mc);
825 + err_xa_erase:
826 +- xa_erase(&multicast_table, mc->id);
827 ++ xa_lock(&multicast_table);
828 ++ list_del(&mc->list);
829 ++ __xa_erase(&multicast_table, mc->id);
830 + err_free_mc:
831 ++ xa_unlock(&multicast_table);
832 + kfree(mc);
833 + err_put_ctx:
834 + ucma_put_ctx(ctx);
835 +@@ -1569,15 +1579,17 @@ static ssize_t ucma_leave_multicast(struct ucma_file *file,
836 + mc = ERR_PTR(-EINVAL);
837 + else if (!refcount_inc_not_zero(&mc->ctx->ref))
838 + mc = ERR_PTR(-ENXIO);
839 +- else
840 +- __xa_erase(&multicast_table, mc->id);
841 +- xa_unlock(&multicast_table);
842 +
843 + if (IS_ERR(mc)) {
844 ++ xa_unlock(&multicast_table);
845 + ret = PTR_ERR(mc);
846 + goto out;
847 + }
848 +
849 ++ list_del(&mc->list);
850 ++ __xa_erase(&multicast_table, mc->id);
851 ++ xa_unlock(&multicast_table);
852 ++
853 + mutex_lock(&mc->ctx->mutex);
854 + rdma_leave_multicast(mc->ctx->cm_id, (struct sockaddr *) &mc->addr);
855 + mutex_unlock(&mc->ctx->mutex);
856 +diff --git a/drivers/infiniband/hw/hfi1/ipoib.h b/drivers/infiniband/hw/hfi1/ipoib.h
857 +index 9091229342464..aec60d4888eb0 100644
858 +--- a/drivers/infiniband/hw/hfi1/ipoib.h
859 ++++ b/drivers/infiniband/hw/hfi1/ipoib.h
860 +@@ -55,7 +55,7 @@ union hfi1_ipoib_flow {
861 + */
862 + struct ipoib_txreq {
863 + struct sdma_txreq txreq;
864 +- struct hfi1_sdma_header sdma_hdr;
865 ++ struct hfi1_sdma_header *sdma_hdr;
866 + int sdma_status;
867 + int complete;
868 + struct hfi1_ipoib_dev_priv *priv;
869 +diff --git a/drivers/infiniband/hw/hfi1/ipoib_main.c b/drivers/infiniband/hw/hfi1/ipoib_main.c
870 +index e1a2b02bbd91b..5d814afdf7f39 100644
871 +--- a/drivers/infiniband/hw/hfi1/ipoib_main.c
872 ++++ b/drivers/infiniband/hw/hfi1/ipoib_main.c
873 +@@ -22,26 +22,35 @@ static int hfi1_ipoib_dev_init(struct net_device *dev)
874 + int ret;
875 +
876 + dev->tstats = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats);
877 ++ if (!dev->tstats)
878 ++ return -ENOMEM;
879 +
880 + ret = priv->netdev_ops->ndo_init(dev);
881 + if (ret)
882 +- return ret;
883 ++ goto out_ret;
884 +
885 + ret = hfi1_netdev_add_data(priv->dd,
886 + qpn_from_mac(priv->netdev->dev_addr),
887 + dev);
888 + if (ret < 0) {
889 + priv->netdev_ops->ndo_uninit(dev);
890 +- return ret;
891 ++ goto out_ret;
892 + }
893 +
894 + return 0;
895 ++out_ret:
896 ++ free_percpu(dev->tstats);
897 ++ dev->tstats = NULL;
898 ++ return ret;
899 + }
900 +
901 + static void hfi1_ipoib_dev_uninit(struct net_device *dev)
902 + {
903 + struct hfi1_ipoib_dev_priv *priv = hfi1_ipoib_priv(dev);
904 +
905 ++ free_percpu(dev->tstats);
906 ++ dev->tstats = NULL;
907 ++
908 + hfi1_netdev_remove_data(priv->dd, qpn_from_mac(priv->netdev->dev_addr));
909 +
910 + priv->netdev_ops->ndo_uninit(dev);
911 +@@ -166,12 +175,7 @@ static void hfi1_ipoib_netdev_dtor(struct net_device *dev)
912 + hfi1_ipoib_rxq_deinit(priv->netdev);
913 +
914 + free_percpu(dev->tstats);
915 +-}
916 +-
917 +-static void hfi1_ipoib_free_rdma_netdev(struct net_device *dev)
918 +-{
919 +- hfi1_ipoib_netdev_dtor(dev);
920 +- free_netdev(dev);
921 ++ dev->tstats = NULL;
922 + }
923 +
924 + static void hfi1_ipoib_set_id(struct net_device *dev, int id)
925 +@@ -211,24 +215,23 @@ static int hfi1_ipoib_setup_rn(struct ib_device *device,
926 + priv->port_num = port_num;
927 + priv->netdev_ops = netdev->netdev_ops;
928 +
929 +- netdev->netdev_ops = &hfi1_ipoib_netdev_ops;
930 +-
931 + ib_query_pkey(device, port_num, priv->pkey_index, &priv->pkey);
932 +
933 + rc = hfi1_ipoib_txreq_init(priv);
934 + if (rc) {
935 + dd_dev_err(dd, "IPoIB netdev TX init - failed(%d)\n", rc);
936 +- hfi1_ipoib_free_rdma_netdev(netdev);
937 + return rc;
938 + }
939 +
940 + rc = hfi1_ipoib_rxq_init(netdev);
941 + if (rc) {
942 + dd_dev_err(dd, "IPoIB netdev RX init - failed(%d)\n", rc);
943 +- hfi1_ipoib_free_rdma_netdev(netdev);
944 ++ hfi1_ipoib_txreq_deinit(priv);
945 + return rc;
946 + }
947 +
948 ++ netdev->netdev_ops = &hfi1_ipoib_netdev_ops;
949 ++
950 + netdev->priv_destructor = hfi1_ipoib_netdev_dtor;
951 + netdev->needs_free_netdev = true;
952 +
953 +diff --git a/drivers/infiniband/hw/hfi1/ipoib_tx.c b/drivers/infiniband/hw/hfi1/ipoib_tx.c
954 +index f4010890309f7..d6bbdb8fcb50a 100644
955 +--- a/drivers/infiniband/hw/hfi1/ipoib_tx.c
956 ++++ b/drivers/infiniband/hw/hfi1/ipoib_tx.c
957 +@@ -122,7 +122,7 @@ static void hfi1_ipoib_free_tx(struct ipoib_txreq *tx, int budget)
958 + dd_dev_warn(priv->dd,
959 + "%s: Status = 0x%x pbc 0x%llx txq = %d sde = %d\n",
960 + __func__, tx->sdma_status,
961 +- le64_to_cpu(tx->sdma_hdr.pbc), tx->txq->q_idx,
962 ++ le64_to_cpu(tx->sdma_hdr->pbc), tx->txq->q_idx,
963 + tx->txq->sde->this_idx);
964 + }
965 +
966 +@@ -231,7 +231,7 @@ static int hfi1_ipoib_build_tx_desc(struct ipoib_txreq *tx,
967 + {
968 + struct hfi1_devdata *dd = txp->dd;
969 + struct sdma_txreq *txreq = &tx->txreq;
970 +- struct hfi1_sdma_header *sdma_hdr = &tx->sdma_hdr;
971 ++ struct hfi1_sdma_header *sdma_hdr = tx->sdma_hdr;
972 + u16 pkt_bytes =
973 + sizeof(sdma_hdr->pbc) + (txp->hdr_dwords << 2) + tx->skb->len;
974 + int ret;
975 +@@ -256,7 +256,7 @@ static void hfi1_ipoib_build_ib_tx_headers(struct ipoib_txreq *tx,
976 + struct ipoib_txparms *txp)
977 + {
978 + struct hfi1_ipoib_dev_priv *priv = tx->txq->priv;
979 +- struct hfi1_sdma_header *sdma_hdr = &tx->sdma_hdr;
980 ++ struct hfi1_sdma_header *sdma_hdr = tx->sdma_hdr;
981 + struct sk_buff *skb = tx->skb;
982 + struct hfi1_pportdata *ppd = ppd_from_ibp(txp->ibp);
983 + struct rdma_ah_attr *ah_attr = txp->ah_attr;
984 +@@ -483,7 +483,7 @@ static int hfi1_ipoib_send_dma_single(struct net_device *dev,
985 + if (likely(!ret)) {
986 + tx_ok:
987 + trace_sdma_output_ibhdr(txq->priv->dd,
988 +- &tx->sdma_hdr.hdr,
989 ++ &tx->sdma_hdr->hdr,
990 + ib_is_sc5(txp->flow.sc5));
991 + hfi1_ipoib_check_queue_depth(txq);
992 + return NETDEV_TX_OK;
993 +@@ -547,7 +547,7 @@ static int hfi1_ipoib_send_dma_list(struct net_device *dev,
994 + hfi1_ipoib_check_queue_depth(txq);
995 +
996 + trace_sdma_output_ibhdr(txq->priv->dd,
997 +- &tx->sdma_hdr.hdr,
998 ++ &tx->sdma_hdr->hdr,
999 + ib_is_sc5(txp->flow.sc5));
1000 +
1001 + if (!netdev_xmit_more())
1002 +@@ -683,7 +683,8 @@ int hfi1_ipoib_txreq_init(struct hfi1_ipoib_dev_priv *priv)
1003 + {
1004 + struct net_device *dev = priv->netdev;
1005 + u32 tx_ring_size, tx_item_size;
1006 +- int i;
1007 ++ struct hfi1_ipoib_circ_buf *tx_ring;
1008 ++ int i, j;
1009 +
1010 + /*
1011 + * Ring holds 1 less than tx_ring_size
1012 +@@ -701,7 +702,9 @@ int hfi1_ipoib_txreq_init(struct hfi1_ipoib_dev_priv *priv)
1013 +
1014 + for (i = 0; i < dev->num_tx_queues; i++) {
1015 + struct hfi1_ipoib_txq *txq = &priv->txqs[i];
1016 ++ struct ipoib_txreq *tx;
1017 +
1018 ++ tx_ring = &txq->tx_ring;
1019 + iowait_init(&txq->wait,
1020 + 0,
1021 + hfi1_ipoib_flush_txq,
1022 +@@ -725,14 +728,19 @@ int hfi1_ipoib_txreq_init(struct hfi1_ipoib_dev_priv *priv)
1023 + priv->dd->node);
1024 +
1025 + txq->tx_ring.items =
1026 +- kcalloc_node(tx_ring_size, tx_item_size,
1027 +- GFP_KERNEL, priv->dd->node);
1028 ++ kvzalloc_node(array_size(tx_ring_size, tx_item_size),
1029 ++ GFP_KERNEL, priv->dd->node);
1030 + if (!txq->tx_ring.items)
1031 + goto free_txqs;
1032 +
1033 + txq->tx_ring.max_items = tx_ring_size;
1034 +- txq->tx_ring.shift = ilog2(tx_ring_size);
1035 ++ txq->tx_ring.shift = ilog2(tx_item_size);
1036 + txq->tx_ring.avail = hfi1_ipoib_ring_hwat(txq);
1037 ++ tx_ring = &txq->tx_ring;
1038 ++ for (j = 0; j < tx_ring_size; j++)
1039 ++ hfi1_txreq_from_idx(tx_ring, j)->sdma_hdr =
1040 ++ kzalloc_node(sizeof(*tx->sdma_hdr),
1041 ++ GFP_KERNEL, priv->dd->node);
1042 +
1043 + netif_tx_napi_add(dev, &txq->napi,
1044 + hfi1_ipoib_poll_tx_ring,
1045 +@@ -746,7 +754,10 @@ free_txqs:
1046 + struct hfi1_ipoib_txq *txq = &priv->txqs[i];
1047 +
1048 + netif_napi_del(&txq->napi);
1049 +- kfree(txq->tx_ring.items);
1050 ++ tx_ring = &txq->tx_ring;
1051 ++ for (j = 0; j < tx_ring_size; j++)
1052 ++ kfree(hfi1_txreq_from_idx(tx_ring, j)->sdma_hdr);
1053 ++ kvfree(tx_ring->items);
1054 + }
1055 +
1056 + kfree(priv->txqs);
1057 +@@ -780,17 +791,20 @@ static void hfi1_ipoib_drain_tx_list(struct hfi1_ipoib_txq *txq)
1058 +
1059 + void hfi1_ipoib_txreq_deinit(struct hfi1_ipoib_dev_priv *priv)
1060 + {
1061 +- int i;
1062 ++ int i, j;
1063 +
1064 + for (i = 0; i < priv->netdev->num_tx_queues; i++) {
1065 + struct hfi1_ipoib_txq *txq = &priv->txqs[i];
1066 ++ struct hfi1_ipoib_circ_buf *tx_ring = &txq->tx_ring;
1067 +
1068 + iowait_cancel_work(&txq->wait);
1069 + iowait_sdma_drain(&txq->wait);
1070 + hfi1_ipoib_drain_tx_list(txq);
1071 + netif_napi_del(&txq->napi);
1072 + hfi1_ipoib_drain_tx_ring(txq);
1073 +- kfree(txq->tx_ring.items);
1074 ++ for (j = 0; j < tx_ring->max_items; j++)
1075 ++ kfree(hfi1_txreq_from_idx(tx_ring, j)->sdma_hdr);
1076 ++ kvfree(tx_ring->items);
1077 + }
1078 +
1079 + kfree(priv->txqs);
1080 +diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c
1081 +index 0d2fa3338784e..accf65df627a2 100644
1082 +--- a/drivers/infiniband/hw/mlx4/main.c
1083 ++++ b/drivers/infiniband/hw/mlx4/main.c
1084 +@@ -3247,7 +3247,7 @@ static void mlx4_ib_event(struct mlx4_dev *dev, void *ibdev_ptr,
1085 + case MLX4_DEV_EVENT_PORT_MGMT_CHANGE:
1086 + ew = kmalloc(sizeof *ew, GFP_ATOMIC);
1087 + if (!ew)
1088 +- break;
1089 ++ return;
1090 +
1091 + INIT_WORK(&ew->work, handle_port_mgmt_change_event);
1092 + memcpy(&ew->ib_eqe, eqe, sizeof *eqe);
1093 +diff --git a/drivers/infiniband/sw/rdmavt/qp.c b/drivers/infiniband/sw/rdmavt/qp.c
1094 +index 3305f2744bfaa..ae50b56e89132 100644
1095 +--- a/drivers/infiniband/sw/rdmavt/qp.c
1096 ++++ b/drivers/infiniband/sw/rdmavt/qp.c
1097 +@@ -3073,6 +3073,8 @@ do_write:
1098 + case IB_WR_ATOMIC_FETCH_AND_ADD:
1099 + if (unlikely(!(qp->qp_access_flags & IB_ACCESS_REMOTE_ATOMIC)))
1100 + goto inv_err;
1101 ++ if (unlikely(wqe->atomic_wr.remote_addr & (sizeof(u64) - 1)))
1102 ++ goto inv_err;
1103 + if (unlikely(!rvt_rkey_ok(qp, &qp->r_sge.sge, sizeof(u64),
1104 + wqe->atomic_wr.remote_addr,
1105 + wqe->atomic_wr.rkey,
1106 +diff --git a/drivers/infiniband/sw/siw/siw.h b/drivers/infiniband/sw/siw/siw.h
1107 +index 368959ae9a8cc..df03d84c6868a 100644
1108 +--- a/drivers/infiniband/sw/siw/siw.h
1109 ++++ b/drivers/infiniband/sw/siw/siw.h
1110 +@@ -644,14 +644,9 @@ static inline struct siw_sqe *orq_get_current(struct siw_qp *qp)
1111 + return &qp->orq[qp->orq_get % qp->attrs.orq_size];
1112 + }
1113 +
1114 +-static inline struct siw_sqe *orq_get_tail(struct siw_qp *qp)
1115 +-{
1116 +- return &qp->orq[qp->orq_put % qp->attrs.orq_size];
1117 +-}
1118 +-
1119 + static inline struct siw_sqe *orq_get_free(struct siw_qp *qp)
1120 + {
1121 +- struct siw_sqe *orq_e = orq_get_tail(qp);
1122 ++ struct siw_sqe *orq_e = &qp->orq[qp->orq_put % qp->attrs.orq_size];
1123 +
1124 + if (READ_ONCE(orq_e->flags) == 0)
1125 + return orq_e;
1126 +diff --git a/drivers/infiniband/sw/siw/siw_qp_rx.c b/drivers/infiniband/sw/siw/siw_qp_rx.c
1127 +index 60116f20653c7..875ea6f1b04a2 100644
1128 +--- a/drivers/infiniband/sw/siw/siw_qp_rx.c
1129 ++++ b/drivers/infiniband/sw/siw/siw_qp_rx.c
1130 +@@ -1153,11 +1153,12 @@ static int siw_check_tx_fence(struct siw_qp *qp)
1131 +
1132 + spin_lock_irqsave(&qp->orq_lock, flags);
1133 +
1134 +- rreq = orq_get_current(qp);
1135 +-
1136 + /* free current orq entry */
1137 ++ rreq = orq_get_current(qp);
1138 + WRITE_ONCE(rreq->flags, 0);
1139 +
1140 ++ qp->orq_get++;
1141 ++
1142 + if (qp->tx_ctx.orq_fence) {
1143 + if (unlikely(tx_waiting->wr_status != SIW_WR_QUEUED)) {
1144 + pr_warn("siw: [QP %u]: fence resume: bad status %d\n",
1145 +@@ -1165,10 +1166,12 @@ static int siw_check_tx_fence(struct siw_qp *qp)
1146 + rv = -EPROTO;
1147 + goto out;
1148 + }
1149 +- /* resume SQ processing */
1150 ++ /* resume SQ processing, if possible */
1151 + if (tx_waiting->sqe.opcode == SIW_OP_READ ||
1152 + tx_waiting->sqe.opcode == SIW_OP_READ_LOCAL_INV) {
1153 +- rreq = orq_get_tail(qp);
1154 ++
1155 ++ /* SQ processing was stopped because of a full ORQ */
1156 ++ rreq = orq_get_free(qp);
1157 + if (unlikely(!rreq)) {
1158 + pr_warn("siw: [QP %u]: no ORQE\n", qp_id(qp));
1159 + rv = -EPROTO;
1160 +@@ -1181,15 +1184,14 @@ static int siw_check_tx_fence(struct siw_qp *qp)
1161 + resume_tx = 1;
1162 +
1163 + } else if (siw_orq_empty(qp)) {
1164 ++ /*
1165 ++ * SQ processing was stopped by fenced work request.
1166 ++ * Resume since all previous Read's are now completed.
1167 ++ */
1168 + qp->tx_ctx.orq_fence = 0;
1169 + resume_tx = 1;
1170 +- } else {
1171 +- pr_warn("siw: [QP %u]: fence resume: orq idx: %d:%d\n",
1172 +- qp_id(qp), qp->orq_get, qp->orq_put);
1173 +- rv = -EPROTO;
1174 + }
1175 + }
1176 +- qp->orq_get++;
1177 + out:
1178 + spin_unlock_irqrestore(&qp->orq_lock, flags);
1179 +
1180 +diff --git a/drivers/infiniband/sw/siw/siw_verbs.c b/drivers/infiniband/sw/siw/siw_verbs.c
1181 +index 1b36350601faa..aa3f60d54a70f 100644
1182 +--- a/drivers/infiniband/sw/siw/siw_verbs.c
1183 ++++ b/drivers/infiniband/sw/siw/siw_verbs.c
1184 +@@ -311,7 +311,8 @@ int siw_create_qp(struct ib_qp *ibqp, struct ib_qp_init_attr *attrs,
1185 +
1186 + if (atomic_inc_return(&sdev->num_qp) > SIW_MAX_QP) {
1187 + siw_dbg(base_dev, "too many QP's\n");
1188 +- return -ENOMEM;
1189 ++ rv = -ENOMEM;
1190 ++ goto err_atomic;
1191 + }
1192 + if (attrs->qp_type != IB_QPT_RC) {
1193 + siw_dbg(base_dev, "only RC QP's supported\n");
1194 +diff --git a/drivers/iommu/amd/init.c b/drivers/iommu/amd/init.c
1195 +index b94822fc2c9f7..ce952b0afbfd9 100644
1196 +--- a/drivers/iommu/amd/init.c
1197 ++++ b/drivers/iommu/amd/init.c
1198 +@@ -21,6 +21,7 @@
1199 + #include <linux/export.h>
1200 + #include <linux/kmemleak.h>
1201 + #include <linux/cc_platform.h>
1202 ++#include <linux/iopoll.h>
1203 + #include <asm/pci-direct.h>
1204 + #include <asm/iommu.h>
1205 + #include <asm/apic.h>
1206 +@@ -834,6 +835,7 @@ static int iommu_ga_log_enable(struct amd_iommu *iommu)
1207 + status = readl(iommu->mmio_base + MMIO_STATUS_OFFSET);
1208 + if (status & (MMIO_STATUS_GALOG_RUN_MASK))
1209 + break;
1210 ++ udelay(10);
1211 + }
1212 +
1213 + if (WARN_ON(i >= LOOP_TIMEOUT))
1214 +diff --git a/drivers/iommu/intel/irq_remapping.c b/drivers/iommu/intel/irq_remapping.c
1215 +index f912fe45bea2c..a673195978843 100644
1216 +--- a/drivers/iommu/intel/irq_remapping.c
1217 ++++ b/drivers/iommu/intel/irq_remapping.c
1218 +@@ -569,9 +569,8 @@ static int intel_setup_irq_remapping(struct intel_iommu *iommu)
1219 + fn, &intel_ir_domain_ops,
1220 + iommu);
1221 + if (!iommu->ir_domain) {
1222 +- irq_domain_free_fwnode(fn);
1223 + pr_err("IR%d: failed to allocate irqdomain\n", iommu->seq_id);
1224 +- goto out_free_bitmap;
1225 ++ goto out_free_fwnode;
1226 + }
1227 + iommu->ir_msi_domain =
1228 + arch_create_remap_msi_irq_domain(iommu->ir_domain,
1229 +@@ -595,7 +594,7 @@ static int intel_setup_irq_remapping(struct intel_iommu *iommu)
1230 +
1231 + if (dmar_enable_qi(iommu)) {
1232 + pr_err("Failed to enable queued invalidation\n");
1233 +- goto out_free_bitmap;
1234 ++ goto out_free_ir_domain;
1235 + }
1236 + }
1237 +
1238 +@@ -619,6 +618,14 @@ static int intel_setup_irq_remapping(struct intel_iommu *iommu)
1239 +
1240 + return 0;
1241 +
1242 ++out_free_ir_domain:
1243 ++ if (iommu->ir_msi_domain)
1244 ++ irq_domain_remove(iommu->ir_msi_domain);
1245 ++ iommu->ir_msi_domain = NULL;
1246 ++ irq_domain_remove(iommu->ir_domain);
1247 ++ iommu->ir_domain = NULL;
1248 ++out_free_fwnode:
1249 ++ irq_domain_free_fwnode(fn);
1250 + out_free_bitmap:
1251 + bitmap_free(bitmap);
1252 + out_free_pages:
1253 +diff --git a/drivers/net/dsa/Kconfig b/drivers/net/dsa/Kconfig
1254 +index 7b1457a6e327b..c0c91440340ae 100644
1255 +--- a/drivers/net/dsa/Kconfig
1256 ++++ b/drivers/net/dsa/Kconfig
1257 +@@ -36,6 +36,7 @@ config NET_DSA_LANTIQ_GSWIP
1258 + config NET_DSA_MT7530
1259 + tristate "MediaTek MT753x and MT7621 Ethernet switch support"
1260 + select NET_DSA_TAG_MTK
1261 ++ select MEDIATEK_GE_PHY
1262 + help
1263 + This enables support for the MediaTek MT7530, MT7531, and MT7621
1264 + Ethernet switch chips.
1265 +diff --git a/drivers/net/ethernet/google/gve/gve_adminq.c b/drivers/net/ethernet/google/gve/gve_adminq.c
1266 +index 326b56b49216a..89b026924196c 100644
1267 +--- a/drivers/net/ethernet/google/gve/gve_adminq.c
1268 ++++ b/drivers/net/ethernet/google/gve/gve_adminq.c
1269 +@@ -301,7 +301,7 @@ static int gve_adminq_parse_err(struct gve_priv *priv, u32 status)
1270 + */
1271 + static int gve_adminq_kick_and_wait(struct gve_priv *priv)
1272 + {
1273 +- u32 tail, head;
1274 ++ int tail, head;
1275 + int i;
1276 +
1277 + tail = ioread32be(&priv->reg_bar0->adminq_event_counter);
1278 +diff --git a/drivers/net/ethernet/intel/e1000e/e1000.h b/drivers/net/ethernet/intel/e1000e/e1000.h
1279 +index c3def0ee77884..8d06c9d8ff8b1 100644
1280 +--- a/drivers/net/ethernet/intel/e1000e/e1000.h
1281 ++++ b/drivers/net/ethernet/intel/e1000e/e1000.h
1282 +@@ -115,7 +115,8 @@ enum e1000_boards {
1283 + board_pch_lpt,
1284 + board_pch_spt,
1285 + board_pch_cnp,
1286 +- board_pch_tgp
1287 ++ board_pch_tgp,
1288 ++ board_pch_adp
1289 + };
1290 +
1291 + struct e1000_ps_page {
1292 +@@ -502,6 +503,7 @@ extern const struct e1000_info e1000_pch_lpt_info;
1293 + extern const struct e1000_info e1000_pch_spt_info;
1294 + extern const struct e1000_info e1000_pch_cnp_info;
1295 + extern const struct e1000_info e1000_pch_tgp_info;
1296 ++extern const struct e1000_info e1000_pch_adp_info;
1297 + extern const struct e1000_info e1000_es2_info;
1298 +
1299 + void e1000e_ptp_init(struct e1000_adapter *adapter);
1300 +diff --git a/drivers/net/ethernet/intel/e1000e/ich8lan.c b/drivers/net/ethernet/intel/e1000e/ich8lan.c
1301 +index 5e4fc9b4e2adb..c908c84b86d22 100644
1302 +--- a/drivers/net/ethernet/intel/e1000e/ich8lan.c
1303 ++++ b/drivers/net/ethernet/intel/e1000e/ich8lan.c
1304 +@@ -6021,3 +6021,23 @@ const struct e1000_info e1000_pch_tgp_info = {
1305 + .phy_ops = &ich8_phy_ops,
1306 + .nvm_ops = &spt_nvm_ops,
1307 + };
1308 ++
1309 ++const struct e1000_info e1000_pch_adp_info = {
1310 ++ .mac = e1000_pch_adp,
1311 ++ .flags = FLAG_IS_ICH
1312 ++ | FLAG_HAS_WOL
1313 ++ | FLAG_HAS_HW_TIMESTAMP
1314 ++ | FLAG_HAS_CTRLEXT_ON_LOAD
1315 ++ | FLAG_HAS_AMT
1316 ++ | FLAG_HAS_FLASH
1317 ++ | FLAG_HAS_JUMBO_FRAMES
1318 ++ | FLAG_APME_IN_WUC,
1319 ++ .flags2 = FLAG2_HAS_PHY_STATS
1320 ++ | FLAG2_HAS_EEE,
1321 ++ .pba = 26,
1322 ++ .max_hw_frame_size = 9022,
1323 ++ .get_variants = e1000_get_variants_ich8lan,
1324 ++ .mac_ops = &ich8_mac_ops,
1325 ++ .phy_ops = &ich8_phy_ops,
1326 ++ .nvm_ops = &spt_nvm_ops,
1327 ++};
1328 +diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c
1329 +index 85391ebf8714e..c063128ed1df3 100644
1330 +--- a/drivers/net/ethernet/intel/e1000e/netdev.c
1331 ++++ b/drivers/net/ethernet/intel/e1000e/netdev.c
1332 +@@ -52,6 +52,7 @@ static const struct e1000_info *e1000_info_tbl[] = {
1333 + [board_pch_spt] = &e1000_pch_spt_info,
1334 + [board_pch_cnp] = &e1000_pch_cnp_info,
1335 + [board_pch_tgp] = &e1000_pch_tgp_info,
1336 ++ [board_pch_adp] = &e1000_pch_adp_info,
1337 + };
1338 +
1339 + struct e1000_reg_info {
1340 +@@ -7904,22 +7905,22 @@ static const struct pci_device_id e1000_pci_tbl[] = {
1341 + { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_TGP_I219_V14), board_pch_tgp },
1342 + { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_TGP_I219_LM15), board_pch_tgp },
1343 + { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_TGP_I219_V15), board_pch_tgp },
1344 +- { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_RPL_I219_LM23), board_pch_tgp },
1345 +- { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_RPL_I219_V23), board_pch_tgp },
1346 +- { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_ADP_I219_LM16), board_pch_tgp },
1347 +- { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_ADP_I219_V16), board_pch_tgp },
1348 +- { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_ADP_I219_LM17), board_pch_tgp },
1349 +- { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_ADP_I219_V17), board_pch_tgp },
1350 +- { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_RPL_I219_LM22), board_pch_tgp },
1351 +- { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_RPL_I219_V22), board_pch_tgp },
1352 +- { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_MTP_I219_LM18), board_pch_tgp },
1353 +- { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_MTP_I219_V18), board_pch_tgp },
1354 +- { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_MTP_I219_LM19), board_pch_tgp },
1355 +- { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_MTP_I219_V19), board_pch_tgp },
1356 +- { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_LNP_I219_LM20), board_pch_tgp },
1357 +- { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_LNP_I219_V20), board_pch_tgp },
1358 +- { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_LNP_I219_LM21), board_pch_tgp },
1359 +- { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_LNP_I219_V21), board_pch_tgp },
1360 ++ { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_RPL_I219_LM23), board_pch_adp },
1361 ++ { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_RPL_I219_V23), board_pch_adp },
1362 ++ { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_ADP_I219_LM16), board_pch_adp },
1363 ++ { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_ADP_I219_V16), board_pch_adp },
1364 ++ { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_ADP_I219_LM17), board_pch_adp },
1365 ++ { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_ADP_I219_V17), board_pch_adp },
1366 ++ { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_RPL_I219_LM22), board_pch_adp },
1367 ++ { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_RPL_I219_V22), board_pch_adp },
1368 ++ { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_MTP_I219_LM18), board_pch_adp },
1369 ++ { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_MTP_I219_V18), board_pch_adp },
1370 ++ { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_MTP_I219_LM19), board_pch_adp },
1371 ++ { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_MTP_I219_V19), board_pch_adp },
1372 ++ { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_LNP_I219_LM20), board_pch_adp },
1373 ++ { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_LNP_I219_V20), board_pch_adp },
1374 ++ { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_LNP_I219_LM21), board_pch_adp },
1375 ++ { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_LNP_I219_V21), board_pch_adp },
1376 +
1377 + { 0, 0, 0, 0, 0, 0, 0 } /* terminate list */
1378 + };
1379 +diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-visconti.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-visconti.c
1380 +index dde5b772a5af7..c3f10a92b62b8 100644
1381 +--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-visconti.c
1382 ++++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-visconti.c
1383 +@@ -49,13 +49,15 @@ struct visconti_eth {
1384 + void __iomem *reg;
1385 + u32 phy_intf_sel;
1386 + struct clk *phy_ref_clk;
1387 ++ struct device *dev;
1388 + spinlock_t lock; /* lock to protect register update */
1389 + };
1390 +
1391 + static void visconti_eth_fix_mac_speed(void *priv, unsigned int speed)
1392 + {
1393 + struct visconti_eth *dwmac = priv;
1394 +- unsigned int val, clk_sel_val;
1395 ++ struct net_device *netdev = dev_get_drvdata(dwmac->dev);
1396 ++ unsigned int val, clk_sel_val = 0;
1397 + unsigned long flags;
1398 +
1399 + spin_lock_irqsave(&dwmac->lock, flags);
1400 +@@ -85,7 +87,9 @@ static void visconti_eth_fix_mac_speed(void *priv, unsigned int speed)
1401 + break;
1402 + default:
1403 + /* No bit control */
1404 +- break;
1405 ++ netdev_err(netdev, "Unsupported speed request (%d)", speed);
1406 ++ spin_unlock_irqrestore(&dwmac->lock, flags);
1407 ++ return;
1408 + }
1409 +
1410 + writel(val, dwmac->reg + MAC_CTRL_REG);
1411 +@@ -229,6 +233,7 @@ static int visconti_eth_dwmac_probe(struct platform_device *pdev)
1412 +
1413 + spin_lock_init(&dwmac->lock);
1414 + dwmac->reg = stmmac_res.addr;
1415 ++ dwmac->dev = &pdev->dev;
1416 + plat_dat->bsp_priv = dwmac;
1417 + plat_dat->fix_mac_speed = visconti_eth_fix_mac_speed;
1418 +
1419 +diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac_dma.h b/drivers/net/ethernet/stmicro/stmmac/dwmac_dma.h
1420 +index 1914ad698cab2..acd70b9a3173c 100644
1421 +--- a/drivers/net/ethernet/stmicro/stmmac/dwmac_dma.h
1422 ++++ b/drivers/net/ethernet/stmicro/stmmac/dwmac_dma.h
1423 +@@ -150,6 +150,7 @@
1424 +
1425 + #define NUM_DWMAC100_DMA_REGS 9
1426 + #define NUM_DWMAC1000_DMA_REGS 23
1427 ++#define NUM_DWMAC4_DMA_REGS 27
1428 +
1429 + void dwmac_enable_dma_transmission(void __iomem *ioaddr);
1430 + void dwmac_enable_dma_irq(void __iomem *ioaddr, u32 chan, bool rx, bool tx);
1431 +diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
1432 +index d89455803beda..8f563b446d5ca 100644
1433 +--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
1434 ++++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
1435 +@@ -21,10 +21,18 @@
1436 + #include "dwxgmac2.h"
1437 +
1438 + #define REG_SPACE_SIZE 0x1060
1439 ++#define GMAC4_REG_SPACE_SIZE 0x116C
1440 + #define MAC100_ETHTOOL_NAME "st_mac100"
1441 + #define GMAC_ETHTOOL_NAME "st_gmac"
1442 + #define XGMAC_ETHTOOL_NAME "st_xgmac"
1443 +
1444 ++/* Same as DMA_CHAN_BASE_ADDR defined in dwmac4_dma.h
1445 ++ *
1446 ++ * It is here because dwmac_dma.h and dwmac4_dam.h can not be included at the
1447 ++ * same time due to the conflicting macro names.
1448 ++ */
1449 ++#define GMAC4_DMA_CHAN_BASE_ADDR 0x00001100
1450 ++
1451 + #define ETHTOOL_DMA_OFFSET 55
1452 +
1453 + struct stmmac_stats {
1454 +@@ -435,6 +443,8 @@ static int stmmac_ethtool_get_regs_len(struct net_device *dev)
1455 +
1456 + if (priv->plat->has_xgmac)
1457 + return XGMAC_REGSIZE * 4;
1458 ++ else if (priv->plat->has_gmac4)
1459 ++ return GMAC4_REG_SPACE_SIZE;
1460 + return REG_SPACE_SIZE;
1461 + }
1462 +
1463 +@@ -447,8 +457,13 @@ static void stmmac_ethtool_gregs(struct net_device *dev,
1464 + stmmac_dump_mac_regs(priv, priv->hw, reg_space);
1465 + stmmac_dump_dma_regs(priv, priv->ioaddr, reg_space);
1466 +
1467 +- if (!priv->plat->has_xgmac) {
1468 +- /* Copy DMA registers to where ethtool expects them */
1469 ++ /* Copy DMA registers to where ethtool expects them */
1470 ++ if (priv->plat->has_gmac4) {
1471 ++ /* GMAC4 dumps its DMA registers at its DMA_CHAN_BASE_ADDR */
1472 ++ memcpy(&reg_space[ETHTOOL_DMA_OFFSET],
1473 ++ &reg_space[GMAC4_DMA_CHAN_BASE_ADDR / 4],
1474 ++ NUM_DWMAC4_DMA_REGS * 4);
1475 ++ } else if (!priv->plat->has_xgmac) {
1476 + memcpy(&reg_space[ETHTOOL_DMA_OFFSET],
1477 + &reg_space[DMA_BUS_MODE / 4],
1478 + NUM_DWMAC1000_DMA_REGS * 4);
1479 +diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c
1480 +index 074e2cdfb0fa6..a7ec9f4d46ced 100644
1481 +--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c
1482 ++++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c
1483 +@@ -145,15 +145,20 @@ static int adjust_systime(void __iomem *ioaddr, u32 sec, u32 nsec,
1484 +
1485 + static void get_systime(void __iomem *ioaddr, u64 *systime)
1486 + {
1487 +- u64 ns;
1488 +-
1489 +- /* Get the TSSS value */
1490 +- ns = readl(ioaddr + PTP_STNSR);
1491 +- /* Get the TSS and convert sec time value to nanosecond */
1492 +- ns += readl(ioaddr + PTP_STSR) * 1000000000ULL;
1493 ++ u64 ns, sec0, sec1;
1494 ++
1495 ++ /* Get the TSS value */
1496 ++ sec1 = readl_relaxed(ioaddr + PTP_STSR);
1497 ++ do {
1498 ++ sec0 = sec1;
1499 ++ /* Get the TSSS value */
1500 ++ ns = readl_relaxed(ioaddr + PTP_STNSR);
1501 ++ /* Get the TSS value */
1502 ++ sec1 = readl_relaxed(ioaddr + PTP_STSR);
1503 ++ } while (sec0 != sec1);
1504 +
1505 + if (systime)
1506 +- *systime = ns;
1507 ++ *systime = ns + (sec1 * 1000000000ULL);
1508 + }
1509 +
1510 + static void get_ptptime(void __iomem *ptpaddr, u64 *ptp_time)
1511 +diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
1512 +index ac8e3b932bf1e..c5ad28e543e43 100644
1513 +--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
1514 ++++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
1515 +@@ -7137,6 +7137,10 @@ int stmmac_dvr_remove(struct device *dev)
1516 +
1517 + netdev_info(priv->dev, "%s: removing driver", __func__);
1518 +
1519 ++ pm_runtime_get_sync(dev);
1520 ++ pm_runtime_disable(dev);
1521 ++ pm_runtime_put_noidle(dev);
1522 ++
1523 + stmmac_stop_all_dma(priv);
1524 + stmmac_mac_set(priv, priv->ioaddr, false);
1525 + netif_carrier_off(ndev);
1526 +@@ -7155,8 +7159,6 @@ int stmmac_dvr_remove(struct device *dev)
1527 + if (priv->plat->stmmac_rst)
1528 + reset_control_assert(priv->plat->stmmac_rst);
1529 + reset_control_assert(priv->plat->stmmac_ahb_rst);
1530 +- pm_runtime_put(dev);
1531 +- pm_runtime_disable(dev);
1532 + if (priv->hw->pcs != STMMAC_PCS_TBI &&
1533 + priv->hw->pcs != STMMAC_PCS_RTBI)
1534 + stmmac_mdio_unregister(ndev);
1535 +diff --git a/drivers/net/ieee802154/ca8210.c b/drivers/net/ieee802154/ca8210.c
1536 +index ece6ff6049f66..f3438d3e104ac 100644
1537 +--- a/drivers/net/ieee802154/ca8210.c
1538 ++++ b/drivers/net/ieee802154/ca8210.c
1539 +@@ -1771,6 +1771,7 @@ static int ca8210_async_xmit_complete(
1540 + status
1541 + );
1542 + if (status != MAC_TRANSACTION_OVERFLOW) {
1543 ++ dev_kfree_skb_any(priv->tx_skb);
1544 + ieee802154_wake_queue(priv->hw);
1545 + return 0;
1546 + }
1547 +diff --git a/drivers/net/ieee802154/mac802154_hwsim.c b/drivers/net/ieee802154/mac802154_hwsim.c
1548 +index 8caa61ec718f5..36f1c5aa98fc6 100644
1549 +--- a/drivers/net/ieee802154/mac802154_hwsim.c
1550 ++++ b/drivers/net/ieee802154/mac802154_hwsim.c
1551 +@@ -786,6 +786,7 @@ static int hwsim_add_one(struct genl_info *info, struct device *dev,
1552 + goto err_pib;
1553 + }
1554 +
1555 ++ pib->channel = 13;
1556 + rcu_assign_pointer(phy->pib, pib);
1557 + phy->idx = idx;
1558 + INIT_LIST_HEAD(&phy->edges);
1559 +diff --git a/drivers/net/ieee802154/mcr20a.c b/drivers/net/ieee802154/mcr20a.c
1560 +index 8dc04e2590b18..383231b854642 100644
1561 +--- a/drivers/net/ieee802154/mcr20a.c
1562 ++++ b/drivers/net/ieee802154/mcr20a.c
1563 +@@ -976,8 +976,8 @@ static void mcr20a_hw_setup(struct mcr20a_local *lp)
1564 + dev_dbg(printdev(lp), "%s\n", __func__);
1565 +
1566 + phy->symbol_duration = 16;
1567 +- phy->lifs_period = 40;
1568 +- phy->sifs_period = 12;
1569 ++ phy->lifs_period = 40 * phy->symbol_duration;
1570 ++ phy->sifs_period = 12 * phy->symbol_duration;
1571 +
1572 + hw->flags = IEEE802154_HW_TX_OMIT_CKSUM |
1573 + IEEE802154_HW_AFILT |
1574 +diff --git a/drivers/net/macsec.c b/drivers/net/macsec.c
1575 +index 16aa3a478e9e8..3d08743317634 100644
1576 +--- a/drivers/net/macsec.c
1577 ++++ b/drivers/net/macsec.c
1578 +@@ -3870,6 +3870,18 @@ static void macsec_common_dellink(struct net_device *dev, struct list_head *head
1579 + struct macsec_dev *macsec = macsec_priv(dev);
1580 + struct net_device *real_dev = macsec->real_dev;
1581 +
1582 ++ /* If h/w offloading is available, propagate to the device */
1583 ++ if (macsec_is_offloaded(macsec)) {
1584 ++ const struct macsec_ops *ops;
1585 ++ struct macsec_context ctx;
1586 ++
1587 ++ ops = macsec_get_ops(netdev_priv(dev), &ctx);
1588 ++ if (ops) {
1589 ++ ctx.secy = &macsec->secy;
1590 ++ macsec_offload(ops->mdo_del_secy, &ctx);
1591 ++ }
1592 ++ }
1593 ++
1594 + unregister_netdevice_queue(dev, head);
1595 + list_del_rcu(&macsec->secys);
1596 + macsec_del_dev(macsec);
1597 +@@ -3884,18 +3896,6 @@ static void macsec_dellink(struct net_device *dev, struct list_head *head)
1598 + struct net_device *real_dev = macsec->real_dev;
1599 + struct macsec_rxh_data *rxd = macsec_data_rtnl(real_dev);
1600 +
1601 +- /* If h/w offloading is available, propagate to the device */
1602 +- if (macsec_is_offloaded(macsec)) {
1603 +- const struct macsec_ops *ops;
1604 +- struct macsec_context ctx;
1605 +-
1606 +- ops = macsec_get_ops(netdev_priv(dev), &ctx);
1607 +- if (ops) {
1608 +- ctx.secy = &macsec->secy;
1609 +- macsec_offload(ops->mdo_del_secy, &ctx);
1610 +- }
1611 +- }
1612 +-
1613 + macsec_common_dellink(dev, head);
1614 +
1615 + if (list_empty(&rxd->secys)) {
1616 +@@ -4018,6 +4018,15 @@ static int macsec_newlink(struct net *net, struct net_device *dev,
1617 + !macsec_check_offload(macsec->offload, macsec))
1618 + return -EOPNOTSUPP;
1619 +
1620 ++ /* send_sci must be set to true when transmit sci explicitly is set */
1621 ++ if ((data && data[IFLA_MACSEC_SCI]) &&
1622 ++ (data && data[IFLA_MACSEC_INC_SCI])) {
1623 ++ u8 send_sci = !!nla_get_u8(data[IFLA_MACSEC_INC_SCI]);
1624 ++
1625 ++ if (!send_sci)
1626 ++ return -EINVAL;
1627 ++ }
1628 ++
1629 + if (data && data[IFLA_MACSEC_ICV_LEN])
1630 + icv_len = nla_get_u8(data[IFLA_MACSEC_ICV_LEN]);
1631 + mtu = real_dev->mtu - icv_len - macsec_extra_len(true);
1632 +diff --git a/drivers/nvme/host/fabrics.h b/drivers/nvme/host/fabrics.h
1633 +index c3203ff1c654c..1e3a09cad9611 100644
1634 +--- a/drivers/nvme/host/fabrics.h
1635 ++++ b/drivers/nvme/host/fabrics.h
1636 +@@ -170,6 +170,7 @@ nvmf_ctlr_matches_baseopts(struct nvme_ctrl *ctrl,
1637 + struct nvmf_ctrl_options *opts)
1638 + {
1639 + if (ctrl->state == NVME_CTRL_DELETING ||
1640 ++ ctrl->state == NVME_CTRL_DELETING_NOIO ||
1641 + ctrl->state == NVME_CTRL_DEAD ||
1642 + strcmp(opts->subsysnqn, ctrl->opts->subsysnqn) ||
1643 + strcmp(opts->host->nqn, ctrl->opts->host->nqn) ||
1644 +diff --git a/drivers/pinctrl/bcm/pinctrl-bcm2835.c b/drivers/pinctrl/bcm/pinctrl-bcm2835.c
1645 +index b607d10e4cbd8..e9e6b90c6e7ca 100644
1646 +--- a/drivers/pinctrl/bcm/pinctrl-bcm2835.c
1647 ++++ b/drivers/pinctrl/bcm/pinctrl-bcm2835.c
1648 +@@ -1264,16 +1264,18 @@ static int bcm2835_pinctrl_probe(struct platform_device *pdev)
1649 + sizeof(*girq->parents),
1650 + GFP_KERNEL);
1651 + if (!girq->parents) {
1652 +- pinctrl_remove_gpio_range(pc->pctl_dev, &pc->gpio_range);
1653 +- return -ENOMEM;
1654 ++ err = -ENOMEM;
1655 ++ goto out_remove;
1656 + }
1657 +
1658 + if (is_7211) {
1659 + pc->wake_irq = devm_kcalloc(dev, BCM2835_NUM_IRQS,
1660 + sizeof(*pc->wake_irq),
1661 + GFP_KERNEL);
1662 +- if (!pc->wake_irq)
1663 +- return -ENOMEM;
1664 ++ if (!pc->wake_irq) {
1665 ++ err = -ENOMEM;
1666 ++ goto out_remove;
1667 ++ }
1668 + }
1669 +
1670 + /*
1671 +@@ -1301,8 +1303,10 @@ static int bcm2835_pinctrl_probe(struct platform_device *pdev)
1672 +
1673 + len = strlen(dev_name(pc->dev)) + 16;
1674 + name = devm_kzalloc(pc->dev, len, GFP_KERNEL);
1675 +- if (!name)
1676 +- return -ENOMEM;
1677 ++ if (!name) {
1678 ++ err = -ENOMEM;
1679 ++ goto out_remove;
1680 ++ }
1681 +
1682 + snprintf(name, len, "%s:bank%d", dev_name(pc->dev), i);
1683 +
1684 +@@ -1321,11 +1325,14 @@ static int bcm2835_pinctrl_probe(struct platform_device *pdev)
1685 + err = gpiochip_add_data(&pc->gpio_chip, pc);
1686 + if (err) {
1687 + dev_err(dev, "could not add GPIO chip\n");
1688 +- pinctrl_remove_gpio_range(pc->pctl_dev, &pc->gpio_range);
1689 +- return err;
1690 ++ goto out_remove;
1691 + }
1692 +
1693 + return 0;
1694 ++
1695 ++out_remove:
1696 ++ pinctrl_remove_gpio_range(pc->pctl_dev, &pc->gpio_range);
1697 ++ return err;
1698 + }
1699 +
1700 + static struct platform_driver bcm2835_pinctrl_driver = {
1701 +diff --git a/drivers/pinctrl/intel/pinctrl-intel.c b/drivers/pinctrl/intel/pinctrl-intel.c
1702 +index 85750974d1825..826d494f3cc66 100644
1703 +--- a/drivers/pinctrl/intel/pinctrl-intel.c
1704 ++++ b/drivers/pinctrl/intel/pinctrl-intel.c
1705 +@@ -451,8 +451,8 @@ static void intel_gpio_set_gpio_mode(void __iomem *padcfg0)
1706 + value &= ~PADCFG0_PMODE_MASK;
1707 + value |= PADCFG0_PMODE_GPIO;
1708 +
1709 +- /* Disable input and output buffers */
1710 +- value |= PADCFG0_GPIORXDIS;
1711 ++ /* Disable TX buffer and enable RX (this will be input) */
1712 ++ value &= ~PADCFG0_GPIORXDIS;
1713 + value |= PADCFG0_GPIOTXDIS;
1714 +
1715 + /* Disable SCI/SMI/NMI generation */
1716 +@@ -497,9 +497,6 @@ static int intel_gpio_request_enable(struct pinctrl_dev *pctldev,
1717 +
1718 + intel_gpio_set_gpio_mode(padcfg0);
1719 +
1720 +- /* Disable TX buffer and enable RX (this will be input) */
1721 +- __intel_gpio_set_direction(padcfg0, true);
1722 +-
1723 + raw_spin_unlock_irqrestore(&pctrl->lock, flags);
1724 +
1725 + return 0;
1726 +@@ -1115,9 +1112,6 @@ static int intel_gpio_irq_type(struct irq_data *d, unsigned int type)
1727 +
1728 + intel_gpio_set_gpio_mode(reg);
1729 +
1730 +- /* Disable TX buffer and enable RX (this will be input) */
1731 +- __intel_gpio_set_direction(reg, true);
1732 +-
1733 + value = readl(reg);
1734 +
1735 + value &= ~(PADCFG0_RXEVCFG_MASK | PADCFG0_RXINV);
1736 +@@ -1216,6 +1210,39 @@ static irqreturn_t intel_gpio_irq(int irq, void *data)
1737 + return IRQ_RETVAL(ret);
1738 + }
1739 +
1740 ++static void intel_gpio_irq_init(struct intel_pinctrl *pctrl)
1741 ++{
1742 ++ int i;
1743 ++
1744 ++ for (i = 0; i < pctrl->ncommunities; i++) {
1745 ++ const struct intel_community *community;
1746 ++ void __iomem *base;
1747 ++ unsigned int gpp;
1748 ++
1749 ++ community = &pctrl->communities[i];
1750 ++ base = community->regs;
1751 ++
1752 ++ for (gpp = 0; gpp < community->ngpps; gpp++) {
1753 ++ /* Mask and clear all interrupts */
1754 ++ writel(0, base + community->ie_offset + gpp * 4);
1755 ++ writel(0xffff, base + community->is_offset + gpp * 4);
1756 ++ }
1757 ++ }
1758 ++}
1759 ++
1760 ++static int intel_gpio_irq_init_hw(struct gpio_chip *gc)
1761 ++{
1762 ++ struct intel_pinctrl *pctrl = gpiochip_get_data(gc);
1763 ++
1764 ++ /*
1765 ++ * Make sure the interrupt lines are in a proper state before
1766 ++ * further configuration.
1767 ++ */
1768 ++ intel_gpio_irq_init(pctrl);
1769 ++
1770 ++ return 0;
1771 ++}
1772 ++
1773 + static int intel_gpio_add_community_ranges(struct intel_pinctrl *pctrl,
1774 + const struct intel_community *community)
1775 + {
1776 +@@ -1320,6 +1347,7 @@ static int intel_gpio_probe(struct intel_pinctrl *pctrl, int irq)
1777 + girq->num_parents = 0;
1778 + girq->default_type = IRQ_TYPE_NONE;
1779 + girq->handler = handle_bad_irq;
1780 ++ girq->init_hw = intel_gpio_irq_init_hw;
1781 +
1782 + ret = devm_gpiochip_add_data(pctrl->dev, &pctrl->chip, pctrl);
1783 + if (ret) {
1784 +@@ -1695,26 +1723,6 @@ int intel_pinctrl_suspend_noirq(struct device *dev)
1785 + }
1786 + EXPORT_SYMBOL_GPL(intel_pinctrl_suspend_noirq);
1787 +
1788 +-static void intel_gpio_irq_init(struct intel_pinctrl *pctrl)
1789 +-{
1790 +- size_t i;
1791 +-
1792 +- for (i = 0; i < pctrl->ncommunities; i++) {
1793 +- const struct intel_community *community;
1794 +- void __iomem *base;
1795 +- unsigned int gpp;
1796 +-
1797 +- community = &pctrl->communities[i];
1798 +- base = community->regs;
1799 +-
1800 +- for (gpp = 0; gpp < community->ngpps; gpp++) {
1801 +- /* Mask and clear all interrupts */
1802 +- writel(0, base + community->ie_offset + gpp * 4);
1803 +- writel(0xffff, base + community->is_offset + gpp * 4);
1804 +- }
1805 +- }
1806 +-}
1807 +-
1808 + static bool intel_gpio_update_reg(void __iomem *reg, u32 mask, u32 value)
1809 + {
1810 + u32 curr, updated;
1811 +diff --git a/drivers/pinctrl/sunxi/pinctrl-sun50i-h616.c b/drivers/pinctrl/sunxi/pinctrl-sun50i-h616.c
1812 +index ce1917e230f41..152b71226a807 100644
1813 +--- a/drivers/pinctrl/sunxi/pinctrl-sun50i-h616.c
1814 ++++ b/drivers/pinctrl/sunxi/pinctrl-sun50i-h616.c
1815 +@@ -363,16 +363,16 @@ static const struct sunxi_desc_pin h616_pins[] = {
1816 + SUNXI_FUNCTION(0x0, "gpio_in"),
1817 + SUNXI_FUNCTION(0x1, "gpio_out"),
1818 + SUNXI_FUNCTION(0x2, "uart2"), /* CTS */
1819 +- SUNXI_FUNCTION(0x3, "i2s3"), /* DO0 */
1820 ++ SUNXI_FUNCTION(0x3, "i2s3_dout0"), /* DO0 */
1821 + SUNXI_FUNCTION(0x4, "spi1"), /* MISO */
1822 +- SUNXI_FUNCTION(0x5, "i2s3"), /* DI1 */
1823 ++ SUNXI_FUNCTION(0x5, "i2s3_din1"), /* DI1 */
1824 + SUNXI_FUNCTION_IRQ_BANK(0x6, 6, 8)), /* PH_EINT8 */
1825 + SUNXI_PIN(SUNXI_PINCTRL_PIN(H, 9),
1826 + SUNXI_FUNCTION(0x0, "gpio_in"),
1827 + SUNXI_FUNCTION(0x1, "gpio_out"),
1828 +- SUNXI_FUNCTION(0x3, "i2s3"), /* DI0 */
1829 ++ SUNXI_FUNCTION(0x3, "i2s3_din0"), /* DI0 */
1830 + SUNXI_FUNCTION(0x4, "spi1"), /* CS1 */
1831 +- SUNXI_FUNCTION(0x3, "i2s3"), /* DO1 */
1832 ++ SUNXI_FUNCTION(0x5, "i2s3_dout1"), /* DO1 */
1833 + SUNXI_FUNCTION_IRQ_BANK(0x6, 6, 9)), /* PH_EINT9 */
1834 + SUNXI_PIN(SUNXI_PINCTRL_PIN(H, 10),
1835 + SUNXI_FUNCTION(0x0, "gpio_in"),
1836 +diff --git a/drivers/rtc/rtc-mc146818-lib.c b/drivers/rtc/rtc-mc146818-lib.c
1837 +index dcfaf09946ee3..2065842f775d6 100644
1838 +--- a/drivers/rtc/rtc-mc146818-lib.c
1839 ++++ b/drivers/rtc/rtc-mc146818-lib.c
1840 +@@ -104,7 +104,7 @@ again:
1841 + time->tm_year += real_year - 72;
1842 + #endif
1843 +
1844 +- if (century > 20)
1845 ++ if (century > 19)
1846 + time->tm_year += (century - 19) * 100;
1847 +
1848 + /*
1849 +diff --git a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
1850 +index 9be273c320e21..a826456c60759 100644
1851 +--- a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
1852 ++++ b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
1853 +@@ -508,7 +508,8 @@ static int bnx2fc_l2_rcv_thread(void *arg)
1854 +
1855 + static void bnx2fc_recv_frame(struct sk_buff *skb)
1856 + {
1857 +- u32 fr_len;
1858 ++ u64 crc_err;
1859 ++ u32 fr_len, fr_crc;
1860 + struct fc_lport *lport;
1861 + struct fcoe_rcv_info *fr;
1862 + struct fc_stats *stats;
1863 +@@ -542,6 +543,11 @@ static void bnx2fc_recv_frame(struct sk_buff *skb)
1864 + skb_pull(skb, sizeof(struct fcoe_hdr));
1865 + fr_len = skb->len - sizeof(struct fcoe_crc_eof);
1866 +
1867 ++ stats = per_cpu_ptr(lport->stats, get_cpu());
1868 ++ stats->RxFrames++;
1869 ++ stats->RxWords += fr_len / FCOE_WORD_TO_BYTE;
1870 ++ put_cpu();
1871 ++
1872 + fp = (struct fc_frame *)skb;
1873 + fc_frame_init(fp);
1874 + fr_dev(fp) = lport;
1875 +@@ -624,16 +630,15 @@ static void bnx2fc_recv_frame(struct sk_buff *skb)
1876 + return;
1877 + }
1878 +
1879 +- stats = per_cpu_ptr(lport->stats, smp_processor_id());
1880 +- stats->RxFrames++;
1881 +- stats->RxWords += fr_len / FCOE_WORD_TO_BYTE;
1882 ++ fr_crc = le32_to_cpu(fr_crc(fp));
1883 +
1884 +- if (le32_to_cpu(fr_crc(fp)) !=
1885 +- ~crc32(~0, skb->data, fr_len)) {
1886 +- if (stats->InvalidCRCCount < 5)
1887 ++ if (unlikely(fr_crc != ~crc32(~0, skb->data, fr_len))) {
1888 ++ stats = per_cpu_ptr(lport->stats, get_cpu());
1889 ++ crc_err = (stats->InvalidCRCCount++);
1890 ++ put_cpu();
1891 ++ if (crc_err < 5)
1892 + printk(KERN_WARNING PFX "dropping frame with "
1893 + "CRC error\n");
1894 +- stats->InvalidCRCCount++;
1895 + kfree_skb(skb);
1896 + return;
1897 + }
1898 +diff --git a/drivers/soc/mediatek/mtk-scpsys.c b/drivers/soc/mediatek/mtk-scpsys.c
1899 +index 670cc82d17dc2..ca75b14931ec9 100644
1900 +--- a/drivers/soc/mediatek/mtk-scpsys.c
1901 ++++ b/drivers/soc/mediatek/mtk-scpsys.c
1902 +@@ -411,17 +411,12 @@ out:
1903 + return ret;
1904 + }
1905 +
1906 +-static int init_clks(struct platform_device *pdev, struct clk **clk)
1907 ++static void init_clks(struct platform_device *pdev, struct clk **clk)
1908 + {
1909 + int i;
1910 +
1911 +- for (i = CLK_NONE + 1; i < CLK_MAX; i++) {
1912 ++ for (i = CLK_NONE + 1; i < CLK_MAX; i++)
1913 + clk[i] = devm_clk_get(&pdev->dev, clk_names[i]);
1914 +- if (IS_ERR(clk[i]))
1915 +- return PTR_ERR(clk[i]);
1916 +- }
1917 +-
1918 +- return 0;
1919 + }
1920 +
1921 + static struct scp *init_scp(struct platform_device *pdev,
1922 +@@ -431,7 +426,7 @@ static struct scp *init_scp(struct platform_device *pdev,
1923 + {
1924 + struct genpd_onecell_data *pd_data;
1925 + struct resource *res;
1926 +- int i, j, ret;
1927 ++ int i, j;
1928 + struct scp *scp;
1929 + struct clk *clk[CLK_MAX];
1930 +
1931 +@@ -486,9 +481,7 @@ static struct scp *init_scp(struct platform_device *pdev,
1932 +
1933 + pd_data->num_domains = num;
1934 +
1935 +- ret = init_clks(pdev, clk);
1936 +- if (ret)
1937 +- return ERR_PTR(ret);
1938 ++ init_clks(pdev, clk);
1939 +
1940 + for (i = 0; i < num; i++) {
1941 + struct scp_domain *scpd = &scp->domains[i];
1942 +diff --git a/drivers/spi/spi-bcm-qspi.c b/drivers/spi/spi-bcm-qspi.c
1943 +index f3de3305d0f59..44744c55304e1 100644
1944 +--- a/drivers/spi/spi-bcm-qspi.c
1945 ++++ b/drivers/spi/spi-bcm-qspi.c
1946 +@@ -573,7 +573,7 @@ static void bcm_qspi_chip_select(struct bcm_qspi *qspi, int cs)
1947 + u32 rd = 0;
1948 + u32 wr = 0;
1949 +
1950 +- if (qspi->base[CHIP_SELECT]) {
1951 ++ if (cs >= 0 && qspi->base[CHIP_SELECT]) {
1952 + rd = bcm_qspi_read(qspi, CHIP_SELECT, 0);
1953 + wr = (rd & ~0xff) | (1 << cs);
1954 + if (rd == wr)
1955 +diff --git a/drivers/spi/spi-meson-spicc.c b/drivers/spi/spi-meson-spicc.c
1956 +index c208efeadd184..0bc7daa7afc83 100644
1957 +--- a/drivers/spi/spi-meson-spicc.c
1958 ++++ b/drivers/spi/spi-meson-spicc.c
1959 +@@ -693,6 +693,11 @@ static int meson_spicc_probe(struct platform_device *pdev)
1960 + writel_relaxed(0, spicc->base + SPICC_INTREG);
1961 +
1962 + irq = platform_get_irq(pdev, 0);
1963 ++ if (irq < 0) {
1964 ++ ret = irq;
1965 ++ goto out_master;
1966 ++ }
1967 ++
1968 + ret = devm_request_irq(&pdev->dev, irq, meson_spicc_irq,
1969 + 0, NULL, spicc);
1970 + if (ret) {
1971 +diff --git a/drivers/spi/spi-mt65xx.c b/drivers/spi/spi-mt65xx.c
1972 +index a15de10ee286a..753bd313e6fda 100644
1973 +--- a/drivers/spi/spi-mt65xx.c
1974 ++++ b/drivers/spi/spi-mt65xx.c
1975 +@@ -624,7 +624,7 @@ static irqreturn_t mtk_spi_interrupt(int irq, void *dev_id)
1976 + else
1977 + mdata->state = MTK_SPI_IDLE;
1978 +
1979 +- if (!master->can_dma(master, master->cur_msg->spi, trans)) {
1980 ++ if (!master->can_dma(master, NULL, trans)) {
1981 + if (trans->rx_buf) {
1982 + cnt = mdata->xfer_len / 4;
1983 + ioread32_rep(mdata->base + SPI_RX_DATA_REG,
1984 +diff --git a/drivers/spi/spi-stm32-qspi.c b/drivers/spi/spi-stm32-qspi.c
1985 +index 514337c86d2c3..ffdc55f87e821 100644
1986 +--- a/drivers/spi/spi-stm32-qspi.c
1987 ++++ b/drivers/spi/spi-stm32-qspi.c
1988 +@@ -688,7 +688,7 @@ static int stm32_qspi_probe(struct platform_device *pdev)
1989 + struct resource *res;
1990 + int ret, irq;
1991 +
1992 +- ctrl = spi_alloc_master(dev, sizeof(*qspi));
1993 ++ ctrl = devm_spi_alloc_master(dev, sizeof(*qspi));
1994 + if (!ctrl)
1995 + return -ENOMEM;
1996 +
1997 +@@ -697,58 +697,46 @@ static int stm32_qspi_probe(struct platform_device *pdev)
1998 +
1999 + res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "qspi");
2000 + qspi->io_base = devm_ioremap_resource(dev, res);
2001 +- if (IS_ERR(qspi->io_base)) {
2002 +- ret = PTR_ERR(qspi->io_base);
2003 +- goto err_master_put;
2004 +- }
2005 ++ if (IS_ERR(qspi->io_base))
2006 ++ return PTR_ERR(qspi->io_base);
2007 +
2008 + qspi->phys_base = res->start;
2009 +
2010 + res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "qspi_mm");
2011 + qspi->mm_base = devm_ioremap_resource(dev, res);
2012 +- if (IS_ERR(qspi->mm_base)) {
2013 +- ret = PTR_ERR(qspi->mm_base);
2014 +- goto err_master_put;
2015 +- }
2016 ++ if (IS_ERR(qspi->mm_base))
2017 ++ return PTR_ERR(qspi->mm_base);
2018 +
2019 + qspi->mm_size = resource_size(res);
2020 +- if (qspi->mm_size > STM32_QSPI_MAX_MMAP_SZ) {
2021 +- ret = -EINVAL;
2022 +- goto err_master_put;
2023 +- }
2024 ++ if (qspi->mm_size > STM32_QSPI_MAX_MMAP_SZ)
2025 ++ return -EINVAL;
2026 +
2027 + irq = platform_get_irq(pdev, 0);
2028 +- if (irq < 0) {
2029 +- ret = irq;
2030 +- goto err_master_put;
2031 +- }
2032 ++ if (irq < 0)
2033 ++ return irq;
2034 +
2035 + ret = devm_request_irq(dev, irq, stm32_qspi_irq, 0,
2036 + dev_name(dev), qspi);
2037 + if (ret) {
2038 + dev_err(dev, "failed to request irq\n");
2039 +- goto err_master_put;
2040 ++ return ret;
2041 + }
2042 +
2043 + init_completion(&qspi->data_completion);
2044 + init_completion(&qspi->match_completion);
2045 +
2046 + qspi->clk = devm_clk_get(dev, NULL);
2047 +- if (IS_ERR(qspi->clk)) {
2048 +- ret = PTR_ERR(qspi->clk);
2049 +- goto err_master_put;
2050 +- }
2051 ++ if (IS_ERR(qspi->clk))
2052 ++ return PTR_ERR(qspi->clk);
2053 +
2054 + qspi->clk_rate = clk_get_rate(qspi->clk);
2055 +- if (!qspi->clk_rate) {
2056 +- ret = -EINVAL;
2057 +- goto err_master_put;
2058 +- }
2059 ++ if (!qspi->clk_rate)
2060 ++ return -EINVAL;
2061 +
2062 + ret = clk_prepare_enable(qspi->clk);
2063 + if (ret) {
2064 + dev_err(dev, "can not enable the clock\n");
2065 +- goto err_master_put;
2066 ++ return ret;
2067 + }
2068 +
2069 + rstc = devm_reset_control_get_exclusive(dev, NULL);
2070 +@@ -784,7 +772,7 @@ static int stm32_qspi_probe(struct platform_device *pdev)
2071 + pm_runtime_enable(dev);
2072 + pm_runtime_get_noresume(dev);
2073 +
2074 +- ret = devm_spi_register_master(dev, ctrl);
2075 ++ ret = spi_register_master(ctrl);
2076 + if (ret)
2077 + goto err_pm_runtime_free;
2078 +
2079 +@@ -806,8 +794,6 @@ err_dma_free:
2080 + stm32_qspi_dma_free(qspi);
2081 + err_clk_disable:
2082 + clk_disable_unprepare(qspi->clk);
2083 +-err_master_put:
2084 +- spi_master_put(qspi->ctrl);
2085 +
2086 + return ret;
2087 + }
2088 +@@ -817,6 +803,7 @@ static int stm32_qspi_remove(struct platform_device *pdev)
2089 + struct stm32_qspi *qspi = platform_get_drvdata(pdev);
2090 +
2091 + pm_runtime_get_sync(qspi->dev);
2092 ++ spi_unregister_master(qspi->ctrl);
2093 + /* disable qspi */
2094 + writel_relaxed(0, qspi->io_base + QSPI_CR);
2095 + stm32_qspi_dma_free(qspi);
2096 +diff --git a/drivers/spi/spi-uniphier.c b/drivers/spi/spi-uniphier.c
2097 +index 342ee8d2c4761..cc0da48222311 100644
2098 +--- a/drivers/spi/spi-uniphier.c
2099 ++++ b/drivers/spi/spi-uniphier.c
2100 +@@ -726,7 +726,7 @@ static int uniphier_spi_probe(struct platform_device *pdev)
2101 + if (ret) {
2102 + dev_err(&pdev->dev, "failed to get TX DMA capacities: %d\n",
2103 + ret);
2104 +- goto out_disable_clk;
2105 ++ goto out_release_dma;
2106 + }
2107 + dma_tx_burst = caps.max_burst;
2108 + }
2109 +@@ -735,7 +735,7 @@ static int uniphier_spi_probe(struct platform_device *pdev)
2110 + if (IS_ERR_OR_NULL(master->dma_rx)) {
2111 + if (PTR_ERR(master->dma_rx) == -EPROBE_DEFER) {
2112 + ret = -EPROBE_DEFER;
2113 +- goto out_disable_clk;
2114 ++ goto out_release_dma;
2115 + }
2116 + master->dma_rx = NULL;
2117 + dma_rx_burst = INT_MAX;
2118 +@@ -744,7 +744,7 @@ static int uniphier_spi_probe(struct platform_device *pdev)
2119 + if (ret) {
2120 + dev_err(&pdev->dev, "failed to get RX DMA capacities: %d\n",
2121 + ret);
2122 +- goto out_disable_clk;
2123 ++ goto out_release_dma;
2124 + }
2125 + dma_rx_burst = caps.max_burst;
2126 + }
2127 +@@ -753,10 +753,20 @@ static int uniphier_spi_probe(struct platform_device *pdev)
2128 +
2129 + ret = devm_spi_register_master(&pdev->dev, master);
2130 + if (ret)
2131 +- goto out_disable_clk;
2132 ++ goto out_release_dma;
2133 +
2134 + return 0;
2135 +
2136 ++out_release_dma:
2137 ++ if (!IS_ERR_OR_NULL(master->dma_rx)) {
2138 ++ dma_release_channel(master->dma_rx);
2139 ++ master->dma_rx = NULL;
2140 ++ }
2141 ++ if (!IS_ERR_OR_NULL(master->dma_tx)) {
2142 ++ dma_release_channel(master->dma_tx);
2143 ++ master->dma_tx = NULL;
2144 ++ }
2145 ++
2146 + out_disable_clk:
2147 + clk_disable_unprepare(priv->clk);
2148 +
2149 +diff --git a/drivers/video/console/Kconfig b/drivers/video/console/Kconfig
2150 +index 840d9813b0bc6..fcc46380e7c91 100644
2151 +--- a/drivers/video/console/Kconfig
2152 ++++ b/drivers/video/console/Kconfig
2153 +@@ -78,6 +78,26 @@ config FRAMEBUFFER_CONSOLE
2154 + help
2155 + Low-level framebuffer-based console driver.
2156 +
2157 ++config FRAMEBUFFER_CONSOLE_LEGACY_ACCELERATION
2158 ++ bool "Enable legacy fbcon hardware acceleration code"
2159 ++ depends on FRAMEBUFFER_CONSOLE
2160 ++ default y if PARISC
2161 ++ default n
2162 ++ help
2163 ++ This option enables the fbcon (framebuffer text-based) hardware
2164 ++ acceleration for graphics drivers which were written for the fbdev
2165 ++ graphics interface.
2166 ++
2167 ++ On modern machines, on mainstream machines (like x86-64) or when
2168 ++ using a modern Linux distribution those fbdev drivers usually aren't used.
2169 ++ So enabling this option wouldn't have any effect, which is why you want
2170 ++ to disable this option on such newer machines.
2171 ++
2172 ++ If you compile this kernel for older machines which still require the
2173 ++ fbdev drivers, you may want to say Y.
2174 ++
2175 ++ If unsure, select n.
2176 ++
2177 + config FRAMEBUFFER_CONSOLE_DETECT_PRIMARY
2178 + bool "Map the console to the primary display device"
2179 + depends on FRAMEBUFFER_CONSOLE
2180 +diff --git a/drivers/video/fbdev/core/bitblit.c b/drivers/video/fbdev/core/bitblit.c
2181 +index 01fae2c96965c..f98e8f298bc19 100644
2182 +--- a/drivers/video/fbdev/core/bitblit.c
2183 ++++ b/drivers/video/fbdev/core/bitblit.c
2184 +@@ -43,6 +43,21 @@ static void update_attr(u8 *dst, u8 *src, int attribute,
2185 + }
2186 + }
2187 +
2188 ++static void bit_bmove(struct vc_data *vc, struct fb_info *info, int sy,
2189 ++ int sx, int dy, int dx, int height, int width)
2190 ++{
2191 ++ struct fb_copyarea area;
2192 ++
2193 ++ area.sx = sx * vc->vc_font.width;
2194 ++ area.sy = sy * vc->vc_font.height;
2195 ++ area.dx = dx * vc->vc_font.width;
2196 ++ area.dy = dy * vc->vc_font.height;
2197 ++ area.height = height * vc->vc_font.height;
2198 ++ area.width = width * vc->vc_font.width;
2199 ++
2200 ++ info->fbops->fb_copyarea(info, &area);
2201 ++}
2202 ++
2203 + static void bit_clear(struct vc_data *vc, struct fb_info *info, int sy,
2204 + int sx, int height, int width)
2205 + {
2206 +@@ -378,6 +393,7 @@ static int bit_update_start(struct fb_info *info)
2207 +
2208 + void fbcon_set_bitops(struct fbcon_ops *ops)
2209 + {
2210 ++ ops->bmove = bit_bmove;
2211 + ops->clear = bit_clear;
2212 + ops->putcs = bit_putcs;
2213 + ops->clear_margins = bit_clear_margins;
2214 +diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
2215 +index 99ecd9a6d844a..f36829eeb5a93 100644
2216 +--- a/drivers/video/fbdev/core/fbcon.c
2217 ++++ b/drivers/video/fbdev/core/fbcon.c
2218 +@@ -173,6 +173,8 @@ static void fbcon_putcs(struct vc_data *vc, const unsigned short *s,
2219 + int count, int ypos, int xpos);
2220 + static void fbcon_clear_margins(struct vc_data *vc, int bottom_only);
2221 + static void fbcon_cursor(struct vc_data *vc, int mode);
2222 ++static void fbcon_bmove(struct vc_data *vc, int sy, int sx, int dy, int dx,
2223 ++ int height, int width);
2224 + static int fbcon_switch(struct vc_data *vc);
2225 + static int fbcon_blank(struct vc_data *vc, int blank, int mode_switch);
2226 + static void fbcon_set_palette(struct vc_data *vc, const unsigned char *table);
2227 +@@ -180,8 +182,16 @@ static void fbcon_set_palette(struct vc_data *vc, const unsigned char *table);
2228 + /*
2229 + * Internal routines
2230 + */
2231 ++static __inline__ void ywrap_up(struct vc_data *vc, int count);
2232 ++static __inline__ void ywrap_down(struct vc_data *vc, int count);
2233 ++static __inline__ void ypan_up(struct vc_data *vc, int count);
2234 ++static __inline__ void ypan_down(struct vc_data *vc, int count);
2235 ++static void fbcon_bmove_rec(struct vc_data *vc, struct fbcon_display *p, int sy, int sx,
2236 ++ int dy, int dx, int height, int width, u_int y_break);
2237 + static void fbcon_set_disp(struct fb_info *info, struct fb_var_screeninfo *var,
2238 + int unit);
2239 ++static void fbcon_redraw_move(struct vc_data *vc, struct fbcon_display *p,
2240 ++ int line, int count, int dy);
2241 + static void fbcon_modechanged(struct fb_info *info);
2242 + static void fbcon_set_all_vcs(struct fb_info *info);
2243 + static void fbcon_start(void);
2244 +@@ -1015,7 +1025,7 @@ static void fbcon_init(struct vc_data *vc, int init)
2245 + struct vc_data *svc = *default_mode;
2246 + struct fbcon_display *t, *p = &fb_display[vc->vc_num];
2247 + int logo = 1, new_rows, new_cols, rows, cols;
2248 +- int ret;
2249 ++ int cap, ret;
2250 +
2251 + if (WARN_ON(info_idx == -1))
2252 + return;
2253 +@@ -1024,6 +1034,7 @@ static void fbcon_init(struct vc_data *vc, int init)
2254 + con2fb_map[vc->vc_num] = info_idx;
2255 +
2256 + info = registered_fb[con2fb_map[vc->vc_num]];
2257 ++ cap = info->flags;
2258 +
2259 + if (logo_shown < 0 && console_loglevel <= CONSOLE_LOGLEVEL_QUIET)
2260 + logo_shown = FBCON_LOGO_DONTSHOW;
2261 +@@ -1125,6 +1136,14 @@ static void fbcon_init(struct vc_data *vc, int init)
2262 +
2263 + ops->graphics = 0;
2264 +
2265 ++#ifdef CONFIG_FRAMEBUFFER_CONSOLE_LEGACY_ACCELERATION
2266 ++ if ((cap & FBINFO_HWACCEL_COPYAREA) &&
2267 ++ !(cap & FBINFO_HWACCEL_DISABLED))
2268 ++ p->scrollmode = SCROLL_MOVE;
2269 ++ else /* default to something safe */
2270 ++ p->scrollmode = SCROLL_REDRAW;
2271 ++#endif
2272 ++
2273 + /*
2274 + * ++guenther: console.c:vc_allocate() relies on initializing
2275 + * vc_{cols,rows}, but we must not set those if we are only
2276 +@@ -1211,13 +1230,14 @@ finished:
2277 + * This system is now divided into two levels because of complications
2278 + * caused by hardware scrolling. Top level functions:
2279 + *
2280 +- * fbcon_clear(), fbcon_putc(), fbcon_clear_margins()
2281 ++ * fbcon_bmove(), fbcon_clear(), fbcon_putc(), fbcon_clear_margins()
2282 + *
2283 + * handles y values in range [0, scr_height-1] that correspond to real
2284 + * screen positions. y_wrap shift means that first line of bitmap may be
2285 + * anywhere on this display. These functions convert lineoffsets to
2286 + * bitmap offsets and deal with the wrap-around case by splitting blits.
2287 + *
2288 ++ * fbcon_bmove_physical_8() -- These functions fast implementations
2289 + * fbcon_clear_physical_8() -- of original fbcon_XXX fns.
2290 + * fbcon_putc_physical_8() -- (font width != 8) may be added later
2291 + *
2292 +@@ -1390,6 +1410,224 @@ static void fbcon_set_disp(struct fb_info *info, struct fb_var_screeninfo *var,
2293 + }
2294 + }
2295 +
2296 ++static __inline__ void ywrap_up(struct vc_data *vc, int count)
2297 ++{
2298 ++ struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
2299 ++ struct fbcon_ops *ops = info->fbcon_par;
2300 ++ struct fbcon_display *p = &fb_display[vc->vc_num];
2301 ++
2302 ++ p->yscroll += count;
2303 ++ if (p->yscroll >= p->vrows) /* Deal with wrap */
2304 ++ p->yscroll -= p->vrows;
2305 ++ ops->var.xoffset = 0;
2306 ++ ops->var.yoffset = p->yscroll * vc->vc_font.height;
2307 ++ ops->var.vmode |= FB_VMODE_YWRAP;
2308 ++ ops->update_start(info);
2309 ++ scrollback_max += count;
2310 ++ if (scrollback_max > scrollback_phys_max)
2311 ++ scrollback_max = scrollback_phys_max;
2312 ++ scrollback_current = 0;
2313 ++}
2314 ++
2315 ++static __inline__ void ywrap_down(struct vc_data *vc, int count)
2316 ++{
2317 ++ struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
2318 ++ struct fbcon_ops *ops = info->fbcon_par;
2319 ++ struct fbcon_display *p = &fb_display[vc->vc_num];
2320 ++
2321 ++ p->yscroll -= count;
2322 ++ if (p->yscroll < 0) /* Deal with wrap */
2323 ++ p->yscroll += p->vrows;
2324 ++ ops->var.xoffset = 0;
2325 ++ ops->var.yoffset = p->yscroll * vc->vc_font.height;
2326 ++ ops->var.vmode |= FB_VMODE_YWRAP;
2327 ++ ops->update_start(info);
2328 ++ scrollback_max -= count;
2329 ++ if (scrollback_max < 0)
2330 ++ scrollback_max = 0;
2331 ++ scrollback_current = 0;
2332 ++}
2333 ++
2334 ++static __inline__ void ypan_up(struct vc_data *vc, int count)
2335 ++{
2336 ++ struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
2337 ++ struct fbcon_display *p = &fb_display[vc->vc_num];
2338 ++ struct fbcon_ops *ops = info->fbcon_par;
2339 ++
2340 ++ p->yscroll += count;
2341 ++ if (p->yscroll > p->vrows - vc->vc_rows) {
2342 ++ ops->bmove(vc, info, p->vrows - vc->vc_rows,
2343 ++ 0, 0, 0, vc->vc_rows, vc->vc_cols);
2344 ++ p->yscroll -= p->vrows - vc->vc_rows;
2345 ++ }
2346 ++
2347 ++ ops->var.xoffset = 0;
2348 ++ ops->var.yoffset = p->yscroll * vc->vc_font.height;
2349 ++ ops->var.vmode &= ~FB_VMODE_YWRAP;
2350 ++ ops->update_start(info);
2351 ++ fbcon_clear_margins(vc, 1);
2352 ++ scrollback_max += count;
2353 ++ if (scrollback_max > scrollback_phys_max)
2354 ++ scrollback_max = scrollback_phys_max;
2355 ++ scrollback_current = 0;
2356 ++}
2357 ++
2358 ++static __inline__ void ypan_up_redraw(struct vc_data *vc, int t, int count)
2359 ++{
2360 ++ struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
2361 ++ struct fbcon_ops *ops = info->fbcon_par;
2362 ++ struct fbcon_display *p = &fb_display[vc->vc_num];
2363 ++
2364 ++ p->yscroll += count;
2365 ++
2366 ++ if (p->yscroll > p->vrows - vc->vc_rows) {
2367 ++ p->yscroll -= p->vrows - vc->vc_rows;
2368 ++ fbcon_redraw_move(vc, p, t + count, vc->vc_rows - count, t);
2369 ++ }
2370 ++
2371 ++ ops->var.xoffset = 0;
2372 ++ ops->var.yoffset = p->yscroll * vc->vc_font.height;
2373 ++ ops->var.vmode &= ~FB_VMODE_YWRAP;
2374 ++ ops->update_start(info);
2375 ++ fbcon_clear_margins(vc, 1);
2376 ++ scrollback_max += count;
2377 ++ if (scrollback_max > scrollback_phys_max)
2378 ++ scrollback_max = scrollback_phys_max;
2379 ++ scrollback_current = 0;
2380 ++}
2381 ++
2382 ++static __inline__ void ypan_down(struct vc_data *vc, int count)
2383 ++{
2384 ++ struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
2385 ++ struct fbcon_display *p = &fb_display[vc->vc_num];
2386 ++ struct fbcon_ops *ops = info->fbcon_par;
2387 ++
2388 ++ p->yscroll -= count;
2389 ++ if (p->yscroll < 0) {
2390 ++ ops->bmove(vc, info, 0, 0, p->vrows - vc->vc_rows,
2391 ++ 0, vc->vc_rows, vc->vc_cols);
2392 ++ p->yscroll += p->vrows - vc->vc_rows;
2393 ++ }
2394 ++
2395 ++ ops->var.xoffset = 0;
2396 ++ ops->var.yoffset = p->yscroll * vc->vc_font.height;
2397 ++ ops->var.vmode &= ~FB_VMODE_YWRAP;
2398 ++ ops->update_start(info);
2399 ++ fbcon_clear_margins(vc, 1);
2400 ++ scrollback_max -= count;
2401 ++ if (scrollback_max < 0)
2402 ++ scrollback_max = 0;
2403 ++ scrollback_current = 0;
2404 ++}
2405 ++
2406 ++static __inline__ void ypan_down_redraw(struct vc_data *vc, int t, int count)
2407 ++{
2408 ++ struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
2409 ++ struct fbcon_ops *ops = info->fbcon_par;
2410 ++ struct fbcon_display *p = &fb_display[vc->vc_num];
2411 ++
2412 ++ p->yscroll -= count;
2413 ++
2414 ++ if (p->yscroll < 0) {
2415 ++ p->yscroll += p->vrows - vc->vc_rows;
2416 ++ fbcon_redraw_move(vc, p, t, vc->vc_rows - count, t + count);
2417 ++ }
2418 ++
2419 ++ ops->var.xoffset = 0;
2420 ++ ops->var.yoffset = p->yscroll * vc->vc_font.height;
2421 ++ ops->var.vmode &= ~FB_VMODE_YWRAP;
2422 ++ ops->update_start(info);
2423 ++ fbcon_clear_margins(vc, 1);
2424 ++ scrollback_max -= count;
2425 ++ if (scrollback_max < 0)
2426 ++ scrollback_max = 0;
2427 ++ scrollback_current = 0;
2428 ++}
2429 ++
2430 ++static void fbcon_redraw_move(struct vc_data *vc, struct fbcon_display *p,
2431 ++ int line, int count, int dy)
2432 ++{
2433 ++ unsigned short *s = (unsigned short *)
2434 ++ (vc->vc_origin + vc->vc_size_row * line);
2435 ++
2436 ++ while (count--) {
2437 ++ unsigned short *start = s;
2438 ++ unsigned short *le = advance_row(s, 1);
2439 ++ unsigned short c;
2440 ++ int x = 0;
2441 ++ unsigned short attr = 1;
2442 ++
2443 ++ do {
2444 ++ c = scr_readw(s);
2445 ++ if (attr != (c & 0xff00)) {
2446 ++ attr = c & 0xff00;
2447 ++ if (s > start) {
2448 ++ fbcon_putcs(vc, start, s - start,
2449 ++ dy, x);
2450 ++ x += s - start;
2451 ++ start = s;
2452 ++ }
2453 ++ }
2454 ++ console_conditional_schedule();
2455 ++ s++;
2456 ++ } while (s < le);
2457 ++ if (s > start)
2458 ++ fbcon_putcs(vc, start, s - start, dy, x);
2459 ++ console_conditional_schedule();
2460 ++ dy++;
2461 ++ }
2462 ++}
2463 ++
2464 ++static void fbcon_redraw_blit(struct vc_data *vc, struct fb_info *info,
2465 ++ struct fbcon_display *p, int line, int count, int ycount)
2466 ++{
2467 ++ int offset = ycount * vc->vc_cols;
2468 ++ unsigned short *d = (unsigned short *)
2469 ++ (vc->vc_origin + vc->vc_size_row * line);
2470 ++ unsigned short *s = d + offset;
2471 ++ struct fbcon_ops *ops = info->fbcon_par;
2472 ++
2473 ++ while (count--) {
2474 ++ unsigned short *start = s;
2475 ++ unsigned short *le = advance_row(s, 1);
2476 ++ unsigned short c;
2477 ++ int x = 0;
2478 ++
2479 ++ do {
2480 ++ c = scr_readw(s);
2481 ++
2482 ++ if (c == scr_readw(d)) {
2483 ++ if (s > start) {
2484 ++ ops->bmove(vc, info, line + ycount, x,
2485 ++ line, x, 1, s-start);
2486 ++ x += s - start + 1;
2487 ++ start = s + 1;
2488 ++ } else {
2489 ++ x++;
2490 ++ start++;
2491 ++ }
2492 ++ }
2493 ++
2494 ++ scr_writew(c, d);
2495 ++ console_conditional_schedule();
2496 ++ s++;
2497 ++ d++;
2498 ++ } while (s < le);
2499 ++ if (s > start)
2500 ++ ops->bmove(vc, info, line + ycount, x, line, x, 1,
2501 ++ s-start);
2502 ++ console_conditional_schedule();
2503 ++ if (ycount > 0)
2504 ++ line++;
2505 ++ else {
2506 ++ line--;
2507 ++ /* NOTE: We subtract two lines from these pointers */
2508 ++ s -= vc->vc_size_row;
2509 ++ d -= vc->vc_size_row;
2510 ++ }
2511 ++ }
2512 ++}
2513 ++
2514 + static void fbcon_redraw(struct vc_data *vc, struct fbcon_display *p,
2515 + int line, int count, int offset)
2516 + {
2517 +@@ -1450,6 +1688,7 @@ static bool fbcon_scroll(struct vc_data *vc, unsigned int t, unsigned int b,
2518 + {
2519 + struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
2520 + struct fbcon_display *p = &fb_display[vc->vc_num];
2521 ++ int scroll_partial = info->flags & FBINFO_PARTIAL_PAN_OK;
2522 +
2523 + if (fbcon_is_inactive(vc, info))
2524 + return true;
2525 +@@ -1466,32 +1705,291 @@ static bool fbcon_scroll(struct vc_data *vc, unsigned int t, unsigned int b,
2526 + case SM_UP:
2527 + if (count > vc->vc_rows) /* Maximum realistic size */
2528 + count = vc->vc_rows;
2529 +- fbcon_redraw(vc, p, t, b - t - count,
2530 +- count * vc->vc_cols);
2531 +- fbcon_clear(vc, b - count, 0, count, vc->vc_cols);
2532 +- scr_memsetw((unsigned short *) (vc->vc_origin +
2533 +- vc->vc_size_row *
2534 +- (b - count)),
2535 +- vc->vc_video_erase_char,
2536 +- vc->vc_size_row * count);
2537 +- return true;
2538 ++ if (logo_shown >= 0)
2539 ++ goto redraw_up;
2540 ++ switch (fb_scrollmode(p)) {
2541 ++ case SCROLL_MOVE:
2542 ++ fbcon_redraw_blit(vc, info, p, t, b - t - count,
2543 ++ count);
2544 ++ fbcon_clear(vc, b - count, 0, count, vc->vc_cols);
2545 ++ scr_memsetw((unsigned short *) (vc->vc_origin +
2546 ++ vc->vc_size_row *
2547 ++ (b - count)),
2548 ++ vc->vc_video_erase_char,
2549 ++ vc->vc_size_row * count);
2550 ++ return true;
2551 ++
2552 ++ case SCROLL_WRAP_MOVE:
2553 ++ if (b - t - count > 3 * vc->vc_rows >> 2) {
2554 ++ if (t > 0)
2555 ++ fbcon_bmove(vc, 0, 0, count, 0, t,
2556 ++ vc->vc_cols);
2557 ++ ywrap_up(vc, count);
2558 ++ if (vc->vc_rows - b > 0)
2559 ++ fbcon_bmove(vc, b - count, 0, b, 0,
2560 ++ vc->vc_rows - b,
2561 ++ vc->vc_cols);
2562 ++ } else if (info->flags & FBINFO_READS_FAST)
2563 ++ fbcon_bmove(vc, t + count, 0, t, 0,
2564 ++ b - t - count, vc->vc_cols);
2565 ++ else
2566 ++ goto redraw_up;
2567 ++ fbcon_clear(vc, b - count, 0, count, vc->vc_cols);
2568 ++ break;
2569 ++
2570 ++ case SCROLL_PAN_REDRAW:
2571 ++ if ((p->yscroll + count <=
2572 ++ 2 * (p->vrows - vc->vc_rows))
2573 ++ && ((!scroll_partial && (b - t == vc->vc_rows))
2574 ++ || (scroll_partial
2575 ++ && (b - t - count >
2576 ++ 3 * vc->vc_rows >> 2)))) {
2577 ++ if (t > 0)
2578 ++ fbcon_redraw_move(vc, p, 0, t, count);
2579 ++ ypan_up_redraw(vc, t, count);
2580 ++ if (vc->vc_rows - b > 0)
2581 ++ fbcon_redraw_move(vc, p, b,
2582 ++ vc->vc_rows - b, b);
2583 ++ } else
2584 ++ fbcon_redraw_move(vc, p, t + count, b - t - count, t);
2585 ++ fbcon_clear(vc, b - count, 0, count, vc->vc_cols);
2586 ++ break;
2587 ++
2588 ++ case SCROLL_PAN_MOVE:
2589 ++ if ((p->yscroll + count <=
2590 ++ 2 * (p->vrows - vc->vc_rows))
2591 ++ && ((!scroll_partial && (b - t == vc->vc_rows))
2592 ++ || (scroll_partial
2593 ++ && (b - t - count >
2594 ++ 3 * vc->vc_rows >> 2)))) {
2595 ++ if (t > 0)
2596 ++ fbcon_bmove(vc, 0, 0, count, 0, t,
2597 ++ vc->vc_cols);
2598 ++ ypan_up(vc, count);
2599 ++ if (vc->vc_rows - b > 0)
2600 ++ fbcon_bmove(vc, b - count, 0, b, 0,
2601 ++ vc->vc_rows - b,
2602 ++ vc->vc_cols);
2603 ++ } else if (info->flags & FBINFO_READS_FAST)
2604 ++ fbcon_bmove(vc, t + count, 0, t, 0,
2605 ++ b - t - count, vc->vc_cols);
2606 ++ else
2607 ++ goto redraw_up;
2608 ++ fbcon_clear(vc, b - count, 0, count, vc->vc_cols);
2609 ++ break;
2610 ++
2611 ++ case SCROLL_REDRAW:
2612 ++ redraw_up:
2613 ++ fbcon_redraw(vc, p, t, b - t - count,
2614 ++ count * vc->vc_cols);
2615 ++ fbcon_clear(vc, b - count, 0, count, vc->vc_cols);
2616 ++ scr_memsetw((unsigned short *) (vc->vc_origin +
2617 ++ vc->vc_size_row *
2618 ++ (b - count)),
2619 ++ vc->vc_video_erase_char,
2620 ++ vc->vc_size_row * count);
2621 ++ return true;
2622 ++ }
2623 ++ break;
2624 +
2625 + case SM_DOWN:
2626 + if (count > vc->vc_rows) /* Maximum realistic size */
2627 + count = vc->vc_rows;
2628 +- fbcon_redraw(vc, p, b - 1, b - t - count,
2629 +- -count * vc->vc_cols);
2630 +- fbcon_clear(vc, t, 0, count, vc->vc_cols);
2631 +- scr_memsetw((unsigned short *) (vc->vc_origin +
2632 +- vc->vc_size_row *
2633 +- t),
2634 +- vc->vc_video_erase_char,
2635 +- vc->vc_size_row * count);
2636 +- return true;
2637 ++ if (logo_shown >= 0)
2638 ++ goto redraw_down;
2639 ++ switch (fb_scrollmode(p)) {
2640 ++ case SCROLL_MOVE:
2641 ++ fbcon_redraw_blit(vc, info, p, b - 1, b - t - count,
2642 ++ -count);
2643 ++ fbcon_clear(vc, t, 0, count, vc->vc_cols);
2644 ++ scr_memsetw((unsigned short *) (vc->vc_origin +
2645 ++ vc->vc_size_row *
2646 ++ t),
2647 ++ vc->vc_video_erase_char,
2648 ++ vc->vc_size_row * count);
2649 ++ return true;
2650 ++
2651 ++ case SCROLL_WRAP_MOVE:
2652 ++ if (b - t - count > 3 * vc->vc_rows >> 2) {
2653 ++ if (vc->vc_rows - b > 0)
2654 ++ fbcon_bmove(vc, b, 0, b - count, 0,
2655 ++ vc->vc_rows - b,
2656 ++ vc->vc_cols);
2657 ++ ywrap_down(vc, count);
2658 ++ if (t > 0)
2659 ++ fbcon_bmove(vc, count, 0, 0, 0, t,
2660 ++ vc->vc_cols);
2661 ++ } else if (info->flags & FBINFO_READS_FAST)
2662 ++ fbcon_bmove(vc, t, 0, t + count, 0,
2663 ++ b - t - count, vc->vc_cols);
2664 ++ else
2665 ++ goto redraw_down;
2666 ++ fbcon_clear(vc, t, 0, count, vc->vc_cols);
2667 ++ break;
2668 ++
2669 ++ case SCROLL_PAN_MOVE:
2670 ++ if ((count - p->yscroll <= p->vrows - vc->vc_rows)
2671 ++ && ((!scroll_partial && (b - t == vc->vc_rows))
2672 ++ || (scroll_partial
2673 ++ && (b - t - count >
2674 ++ 3 * vc->vc_rows >> 2)))) {
2675 ++ if (vc->vc_rows - b > 0)
2676 ++ fbcon_bmove(vc, b, 0, b - count, 0,
2677 ++ vc->vc_rows - b,
2678 ++ vc->vc_cols);
2679 ++ ypan_down(vc, count);
2680 ++ if (t > 0)
2681 ++ fbcon_bmove(vc, count, 0, 0, 0, t,
2682 ++ vc->vc_cols);
2683 ++ } else if (info->flags & FBINFO_READS_FAST)
2684 ++ fbcon_bmove(vc, t, 0, t + count, 0,
2685 ++ b - t - count, vc->vc_cols);
2686 ++ else
2687 ++ goto redraw_down;
2688 ++ fbcon_clear(vc, t, 0, count, vc->vc_cols);
2689 ++ break;
2690 ++
2691 ++ case SCROLL_PAN_REDRAW:
2692 ++ if ((count - p->yscroll <= p->vrows - vc->vc_rows)
2693 ++ && ((!scroll_partial && (b - t == vc->vc_rows))
2694 ++ || (scroll_partial
2695 ++ && (b - t - count >
2696 ++ 3 * vc->vc_rows >> 2)))) {
2697 ++ if (vc->vc_rows - b > 0)
2698 ++ fbcon_redraw_move(vc, p, b, vc->vc_rows - b,
2699 ++ b - count);
2700 ++ ypan_down_redraw(vc, t, count);
2701 ++ if (t > 0)
2702 ++ fbcon_redraw_move(vc, p, count, t, 0);
2703 ++ } else
2704 ++ fbcon_redraw_move(vc, p, t, b - t - count, t + count);
2705 ++ fbcon_clear(vc, t, 0, count, vc->vc_cols);
2706 ++ break;
2707 ++
2708 ++ case SCROLL_REDRAW:
2709 ++ redraw_down:
2710 ++ fbcon_redraw(vc, p, b - 1, b - t - count,
2711 ++ -count * vc->vc_cols);
2712 ++ fbcon_clear(vc, t, 0, count, vc->vc_cols);
2713 ++ scr_memsetw((unsigned short *) (vc->vc_origin +
2714 ++ vc->vc_size_row *
2715 ++ t),
2716 ++ vc->vc_video_erase_char,
2717 ++ vc->vc_size_row * count);
2718 ++ return true;
2719 ++ }
2720 + }
2721 + return false;
2722 + }
2723 +
2724 ++
2725 ++static void fbcon_bmove(struct vc_data *vc, int sy, int sx, int dy, int dx,
2726 ++ int height, int width)
2727 ++{
2728 ++ struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
2729 ++ struct fbcon_display *p = &fb_display[vc->vc_num];
2730 ++
2731 ++ if (fbcon_is_inactive(vc, info))
2732 ++ return;
2733 ++
2734 ++ if (!width || !height)
2735 ++ return;
2736 ++
2737 ++ /* Split blits that cross physical y_wrap case.
2738 ++ * Pathological case involves 4 blits, better to use recursive
2739 ++ * code rather than unrolled case
2740 ++ *
2741 ++ * Recursive invocations don't need to erase the cursor over and
2742 ++ * over again, so we use fbcon_bmove_rec()
2743 ++ */
2744 ++ fbcon_bmove_rec(vc, p, sy, sx, dy, dx, height, width,
2745 ++ p->vrows - p->yscroll);
2746 ++}
2747 ++
2748 ++static void fbcon_bmove_rec(struct vc_data *vc, struct fbcon_display *p, int sy, int sx,
2749 ++ int dy, int dx, int height, int width, u_int y_break)
2750 ++{
2751 ++ struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
2752 ++ struct fbcon_ops *ops = info->fbcon_par;
2753 ++ u_int b;
2754 ++
2755 ++ if (sy < y_break && sy + height > y_break) {
2756 ++ b = y_break - sy;
2757 ++ if (dy < sy) { /* Avoid trashing self */
2758 ++ fbcon_bmove_rec(vc, p, sy, sx, dy, dx, b, width,
2759 ++ y_break);
2760 ++ fbcon_bmove_rec(vc, p, sy + b, sx, dy + b, dx,
2761 ++ height - b, width, y_break);
2762 ++ } else {
2763 ++ fbcon_bmove_rec(vc, p, sy + b, sx, dy + b, dx,
2764 ++ height - b, width, y_break);
2765 ++ fbcon_bmove_rec(vc, p, sy, sx, dy, dx, b, width,
2766 ++ y_break);
2767 ++ }
2768 ++ return;
2769 ++ }
2770 ++
2771 ++ if (dy < y_break && dy + height > y_break) {
2772 ++ b = y_break - dy;
2773 ++ if (dy < sy) { /* Avoid trashing self */
2774 ++ fbcon_bmove_rec(vc, p, sy, sx, dy, dx, b, width,
2775 ++ y_break);
2776 ++ fbcon_bmove_rec(vc, p, sy + b, sx, dy + b, dx,
2777 ++ height - b, width, y_break);
2778 ++ } else {
2779 ++ fbcon_bmove_rec(vc, p, sy + b, sx, dy + b, dx,
2780 ++ height - b, width, y_break);
2781 ++ fbcon_bmove_rec(vc, p, sy, sx, dy, dx, b, width,
2782 ++ y_break);
2783 ++ }
2784 ++ return;
2785 ++ }
2786 ++ ops->bmove(vc, info, real_y(p, sy), sx, real_y(p, dy), dx,
2787 ++ height, width);
2788 ++}
2789 ++
2790 ++static void updatescrollmode_accel(struct fbcon_display *p,
2791 ++ struct fb_info *info,
2792 ++ struct vc_data *vc)
2793 ++{
2794 ++#ifdef CONFIG_FRAMEBUFFER_CONSOLE_LEGACY_ACCELERATION
2795 ++ struct fbcon_ops *ops = info->fbcon_par;
2796 ++ int cap = info->flags;
2797 ++ u16 t = 0;
2798 ++ int ypan = FBCON_SWAP(ops->rotate, info->fix.ypanstep,
2799 ++ info->fix.xpanstep);
2800 ++ int ywrap = FBCON_SWAP(ops->rotate, info->fix.ywrapstep, t);
2801 ++ int yres = FBCON_SWAP(ops->rotate, info->var.yres, info->var.xres);
2802 ++ int vyres = FBCON_SWAP(ops->rotate, info->var.yres_virtual,
2803 ++ info->var.xres_virtual);
2804 ++ int good_pan = (cap & FBINFO_HWACCEL_YPAN) &&
2805 ++ divides(ypan, vc->vc_font.height) && vyres > yres;
2806 ++ int good_wrap = (cap & FBINFO_HWACCEL_YWRAP) &&
2807 ++ divides(ywrap, vc->vc_font.height) &&
2808 ++ divides(vc->vc_font.height, vyres) &&
2809 ++ divides(vc->vc_font.height, yres);
2810 ++ int reading_fast = cap & FBINFO_READS_FAST;
2811 ++ int fast_copyarea = (cap & FBINFO_HWACCEL_COPYAREA) &&
2812 ++ !(cap & FBINFO_HWACCEL_DISABLED);
2813 ++ int fast_imageblit = (cap & FBINFO_HWACCEL_IMAGEBLIT) &&
2814 ++ !(cap & FBINFO_HWACCEL_DISABLED);
2815 ++
2816 ++ if (good_wrap || good_pan) {
2817 ++ if (reading_fast || fast_copyarea)
2818 ++ p->scrollmode = good_wrap ?
2819 ++ SCROLL_WRAP_MOVE : SCROLL_PAN_MOVE;
2820 ++ else
2821 ++ p->scrollmode = good_wrap ? SCROLL_REDRAW :
2822 ++ SCROLL_PAN_REDRAW;
2823 ++ } else {
2824 ++ if (reading_fast || (fast_copyarea && !fast_imageblit))
2825 ++ p->scrollmode = SCROLL_MOVE;
2826 ++ else
2827 ++ p->scrollmode = SCROLL_REDRAW;
2828 ++ }
2829 ++#endif
2830 ++}
2831 ++
2832 + static void updatescrollmode(struct fbcon_display *p,
2833 + struct fb_info *info,
2834 + struct vc_data *vc)
2835 +@@ -1507,6 +2005,9 @@ static void updatescrollmode(struct fbcon_display *p,
2836 + p->vrows -= (yres - (fh * vc->vc_rows)) / fh;
2837 + if ((yres % fh) && (vyres % fh < yres % fh))
2838 + p->vrows--;
2839 ++
2840 ++ /* update scrollmode in case hardware acceleration is used */
2841 ++ updatescrollmode_accel(p, info, vc);
2842 + }
2843 +
2844 + #define PITCH(w) (((w) + 7) >> 3)
2845 +@@ -1664,7 +2165,21 @@ static int fbcon_switch(struct vc_data *vc)
2846 +
2847 + updatescrollmode(p, info, vc);
2848 +
2849 +- scrollback_phys_max = 0;
2850 ++ switch (fb_scrollmode(p)) {
2851 ++ case SCROLL_WRAP_MOVE:
2852 ++ scrollback_phys_max = p->vrows - vc->vc_rows;
2853 ++ break;
2854 ++ case SCROLL_PAN_MOVE:
2855 ++ case SCROLL_PAN_REDRAW:
2856 ++ scrollback_phys_max = p->vrows - 2 * vc->vc_rows;
2857 ++ if (scrollback_phys_max < 0)
2858 ++ scrollback_phys_max = 0;
2859 ++ break;
2860 ++ default:
2861 ++ scrollback_phys_max = 0;
2862 ++ break;
2863 ++ }
2864 ++
2865 + scrollback_max = 0;
2866 + scrollback_current = 0;
2867 +
2868 +diff --git a/drivers/video/fbdev/core/fbcon.h b/drivers/video/fbdev/core/fbcon.h
2869 +index a00603b4451ae..969d41ecede5f 100644
2870 +--- a/drivers/video/fbdev/core/fbcon.h
2871 ++++ b/drivers/video/fbdev/core/fbcon.h
2872 +@@ -29,6 +29,9 @@ struct fbcon_display {
2873 + /* Filled in by the low-level console driver */
2874 + const u_char *fontdata;
2875 + int userfont; /* != 0 if fontdata kmalloc()ed */
2876 ++#ifdef CONFIG_FRAMEBUFFER_CONSOLE_LEGACY_ACCELERATION
2877 ++ u_short scrollmode; /* Scroll Method, use fb_scrollmode() */
2878 ++#endif
2879 + u_short inverse; /* != 0 text black on white as default */
2880 + short yscroll; /* Hardware scrolling */
2881 + int vrows; /* number of virtual rows */
2882 +@@ -51,6 +54,8 @@ struct fbcon_display {
2883 + };
2884 +
2885 + struct fbcon_ops {
2886 ++ void (*bmove)(struct vc_data *vc, struct fb_info *info, int sy,
2887 ++ int sx, int dy, int dx, int height, int width);
2888 + void (*clear)(struct vc_data *vc, struct fb_info *info, int sy,
2889 + int sx, int height, int width);
2890 + void (*putcs)(struct vc_data *vc, struct fb_info *info,
2891 +@@ -149,6 +154,73 @@ static inline int attr_col_ec(int shift, struct vc_data *vc,
2892 + #define attr_bgcol_ec(bgshift, vc, info) attr_col_ec(bgshift, vc, info, 0)
2893 + #define attr_fgcol_ec(fgshift, vc, info) attr_col_ec(fgshift, vc, info, 1)
2894 +
2895 ++ /*
2896 ++ * Scroll Method
2897 ++ */
2898 ++
2899 ++/* There are several methods fbcon can use to move text around the screen:
2900 ++ *
2901 ++ * Operation Pan Wrap
2902 ++ *---------------------------------------------
2903 ++ * SCROLL_MOVE copyarea No No
2904 ++ * SCROLL_PAN_MOVE copyarea Yes No
2905 ++ * SCROLL_WRAP_MOVE copyarea No Yes
2906 ++ * SCROLL_REDRAW imageblit No No
2907 ++ * SCROLL_PAN_REDRAW imageblit Yes No
2908 ++ * SCROLL_WRAP_REDRAW imageblit No Yes
2909 ++ *
2910 ++ * (SCROLL_WRAP_REDRAW is not implemented yet)
2911 ++ *
2912 ++ * In general, fbcon will choose the best scrolling
2913 ++ * method based on the rule below:
2914 ++ *
2915 ++ * Pan/Wrap > accel imageblit > accel copyarea >
2916 ++ * soft imageblit > (soft copyarea)
2917 ++ *
2918 ++ * Exception to the rule: Pan + accel copyarea is
2919 ++ * preferred over Pan + accel imageblit.
2920 ++ *
2921 ++ * The above is typical for PCI/AGP cards. Unless
2922 ++ * overridden, fbcon will never use soft copyarea.
2923 ++ *
2924 ++ * If you need to override the above rule, set the
2925 ++ * appropriate flags in fb_info->flags. For example,
2926 ++ * to prefer copyarea over imageblit, set
2927 ++ * FBINFO_READS_FAST.
2928 ++ *
2929 ++ * Other notes:
2930 ++ * + use the hardware engine to move the text
2931 ++ * (hw-accelerated copyarea() and fillrect())
2932 ++ * + use hardware-supported panning on a large virtual screen
2933 ++ * + amifb can not only pan, but also wrap the display by N lines
2934 ++ * (i.e. visible line i = physical line (i+N) % yres).
2935 ++ * + read what's already rendered on the screen and
2936 ++ * write it in a different place (this is cfb_copyarea())
2937 ++ * + re-render the text to the screen
2938 ++ *
2939 ++ * Whether to use wrapping or panning can only be figured out at
2940 ++ * runtime (when we know whether our font height is a multiple
2941 ++ * of the pan/wrap step)
2942 ++ *
2943 ++ */
2944 ++
2945 ++#define SCROLL_MOVE 0x001
2946 ++#define SCROLL_PAN_MOVE 0x002
2947 ++#define SCROLL_WRAP_MOVE 0x003
2948 ++#define SCROLL_REDRAW 0x004
2949 ++#define SCROLL_PAN_REDRAW 0x005
2950 ++
2951 ++static inline u_short fb_scrollmode(struct fbcon_display *fb)
2952 ++{
2953 ++#ifdef CONFIG_FRAMEBUFFER_CONSOLE_LEGACY_ACCELERATION
2954 ++ return fb->scrollmode;
2955 ++#else
2956 ++ /* hardcoded to SCROLL_REDRAW if acceleration was disabled. */
2957 ++ return SCROLL_REDRAW;
2958 ++#endif
2959 ++}
2960 ++
2961 ++
2962 + #ifdef CONFIG_FB_TILEBLITTING
2963 + extern void fbcon_set_tileops(struct vc_data *vc, struct fb_info *info);
2964 + #endif
2965 +diff --git a/drivers/video/fbdev/core/fbcon_ccw.c b/drivers/video/fbdev/core/fbcon_ccw.c
2966 +index ffa78936eaab0..2789ace796342 100644
2967 +--- a/drivers/video/fbdev/core/fbcon_ccw.c
2968 ++++ b/drivers/video/fbdev/core/fbcon_ccw.c
2969 +@@ -59,12 +59,31 @@ static void ccw_update_attr(u8 *dst, u8 *src, int attribute,
2970 + }
2971 + }
2972 +
2973 ++
2974 ++static void ccw_bmove(struct vc_data *vc, struct fb_info *info, int sy,
2975 ++ int sx, int dy, int dx, int height, int width)
2976 ++{
2977 ++ struct fbcon_ops *ops = info->fbcon_par;
2978 ++ struct fb_copyarea area;
2979 ++ u32 vyres = GETVYRES(ops->p, info);
2980 ++
2981 ++ area.sx = sy * vc->vc_font.height;
2982 ++ area.sy = vyres - ((sx + width) * vc->vc_font.width);
2983 ++ area.dx = dy * vc->vc_font.height;
2984 ++ area.dy = vyres - ((dx + width) * vc->vc_font.width);
2985 ++ area.width = height * vc->vc_font.height;
2986 ++ area.height = width * vc->vc_font.width;
2987 ++
2988 ++ info->fbops->fb_copyarea(info, &area);
2989 ++}
2990 ++
2991 + static void ccw_clear(struct vc_data *vc, struct fb_info *info, int sy,
2992 + int sx, int height, int width)
2993 + {
2994 ++ struct fbcon_ops *ops = info->fbcon_par;
2995 + struct fb_fillrect region;
2996 + int bgshift = (vc->vc_hi_font_mask) ? 13 : 12;
2997 +- u32 vyres = info->var.yres;
2998 ++ u32 vyres = GETVYRES(ops->p, info);
2999 +
3000 + region.color = attr_bgcol_ec(bgshift,vc,info);
3001 + region.dx = sy * vc->vc_font.height;
3002 +@@ -121,7 +140,7 @@ static void ccw_putcs(struct vc_data *vc, struct fb_info *info,
3003 + u32 cnt, pitch, size;
3004 + u32 attribute = get_attribute(info, scr_readw(s));
3005 + u8 *dst, *buf = NULL;
3006 +- u32 vyres = info->var.yres;
3007 ++ u32 vyres = GETVYRES(ops->p, info);
3008 +
3009 + if (!ops->fontbuffer)
3010 + return;
3011 +@@ -210,7 +229,7 @@ static void ccw_cursor(struct vc_data *vc, struct fb_info *info, int mode,
3012 + int attribute, use_sw = vc->vc_cursor_type & CUR_SW;
3013 + int err = 1, dx, dy;
3014 + char *src;
3015 +- u32 vyres = info->var.yres;
3016 ++ u32 vyres = GETVYRES(ops->p, info);
3017 +
3018 + if (!ops->fontbuffer)
3019 + return;
3020 +@@ -368,7 +387,7 @@ static int ccw_update_start(struct fb_info *info)
3021 + {
3022 + struct fbcon_ops *ops = info->fbcon_par;
3023 + u32 yoffset;
3024 +- u32 vyres = info->var.yres;
3025 ++ u32 vyres = GETVYRES(ops->p, info);
3026 + int err;
3027 +
3028 + yoffset = (vyres - info->var.yres) - ops->var.xoffset;
3029 +@@ -383,6 +402,7 @@ static int ccw_update_start(struct fb_info *info)
3030 +
3031 + void fbcon_rotate_ccw(struct fbcon_ops *ops)
3032 + {
3033 ++ ops->bmove = ccw_bmove;
3034 + ops->clear = ccw_clear;
3035 + ops->putcs = ccw_putcs;
3036 + ops->clear_margins = ccw_clear_margins;
3037 +diff --git a/drivers/video/fbdev/core/fbcon_cw.c b/drivers/video/fbdev/core/fbcon_cw.c
3038 +index 92e5b7fb51ee2..86a254c1b2b7b 100644
3039 +--- a/drivers/video/fbdev/core/fbcon_cw.c
3040 ++++ b/drivers/video/fbdev/core/fbcon_cw.c
3041 +@@ -44,12 +44,31 @@ static void cw_update_attr(u8 *dst, u8 *src, int attribute,
3042 + }
3043 + }
3044 +
3045 ++
3046 ++static void cw_bmove(struct vc_data *vc, struct fb_info *info, int sy,
3047 ++ int sx, int dy, int dx, int height, int width)
3048 ++{
3049 ++ struct fbcon_ops *ops = info->fbcon_par;
3050 ++ struct fb_copyarea area;
3051 ++ u32 vxres = GETVXRES(ops->p, info);
3052 ++
3053 ++ area.sx = vxres - ((sy + height) * vc->vc_font.height);
3054 ++ area.sy = sx * vc->vc_font.width;
3055 ++ area.dx = vxres - ((dy + height) * vc->vc_font.height);
3056 ++ area.dy = dx * vc->vc_font.width;
3057 ++ area.width = height * vc->vc_font.height;
3058 ++ area.height = width * vc->vc_font.width;
3059 ++
3060 ++ info->fbops->fb_copyarea(info, &area);
3061 ++}
3062 ++
3063 + static void cw_clear(struct vc_data *vc, struct fb_info *info, int sy,
3064 + int sx, int height, int width)
3065 + {
3066 ++ struct fbcon_ops *ops = info->fbcon_par;
3067 + struct fb_fillrect region;
3068 + int bgshift = (vc->vc_hi_font_mask) ? 13 : 12;
3069 +- u32 vxres = info->var.xres;
3070 ++ u32 vxres = GETVXRES(ops->p, info);
3071 +
3072 + region.color = attr_bgcol_ec(bgshift,vc,info);
3073 + region.dx = vxres - ((sy + height) * vc->vc_font.height);
3074 +@@ -106,7 +125,7 @@ static void cw_putcs(struct vc_data *vc, struct fb_info *info,
3075 + u32 cnt, pitch, size;
3076 + u32 attribute = get_attribute(info, scr_readw(s));
3077 + u8 *dst, *buf = NULL;
3078 +- u32 vxres = info->var.xres;
3079 ++ u32 vxres = GETVXRES(ops->p, info);
3080 +
3081 + if (!ops->fontbuffer)
3082 + return;
3083 +@@ -193,7 +212,7 @@ static void cw_cursor(struct vc_data *vc, struct fb_info *info, int mode,
3084 + int attribute, use_sw = vc->vc_cursor_type & CUR_SW;
3085 + int err = 1, dx, dy;
3086 + char *src;
3087 +- u32 vxres = info->var.xres;
3088 ++ u32 vxres = GETVXRES(ops->p, info);
3089 +
3090 + if (!ops->fontbuffer)
3091 + return;
3092 +@@ -350,7 +369,7 @@ static void cw_cursor(struct vc_data *vc, struct fb_info *info, int mode,
3093 + static int cw_update_start(struct fb_info *info)
3094 + {
3095 + struct fbcon_ops *ops = info->fbcon_par;
3096 +- u32 vxres = info->var.xres;
3097 ++ u32 vxres = GETVXRES(ops->p, info);
3098 + u32 xoffset;
3099 + int err;
3100 +
3101 +@@ -366,6 +385,7 @@ static int cw_update_start(struct fb_info *info)
3102 +
3103 + void fbcon_rotate_cw(struct fbcon_ops *ops)
3104 + {
3105 ++ ops->bmove = cw_bmove;
3106 + ops->clear = cw_clear;
3107 + ops->putcs = cw_putcs;
3108 + ops->clear_margins = cw_clear_margins;
3109 +diff --git a/drivers/video/fbdev/core/fbcon_rotate.h b/drivers/video/fbdev/core/fbcon_rotate.h
3110 +index b528b2e54283a..01cbe303b8a29 100644
3111 +--- a/drivers/video/fbdev/core/fbcon_rotate.h
3112 ++++ b/drivers/video/fbdev/core/fbcon_rotate.h
3113 +@@ -11,6 +11,15 @@
3114 + #ifndef _FBCON_ROTATE_H
3115 + #define _FBCON_ROTATE_H
3116 +
3117 ++#define GETVYRES(s,i) ({ \
3118 ++ (fb_scrollmode(s) == SCROLL_REDRAW || fb_scrollmode(s) == SCROLL_MOVE) ? \
3119 ++ (i)->var.yres : (i)->var.yres_virtual; })
3120 ++
3121 ++#define GETVXRES(s,i) ({ \
3122 ++ (fb_scrollmode(s) == SCROLL_REDRAW || fb_scrollmode(s) == SCROLL_MOVE || !(i)->fix.xpanstep) ? \
3123 ++ (i)->var.xres : (i)->var.xres_virtual; })
3124 ++
3125 ++
3126 + static inline int pattern_test_bit(u32 x, u32 y, u32 pitch, const char *pat)
3127 + {
3128 + u32 tmp = (y * pitch) + x, index = tmp / 8, bit = tmp % 8;
3129 +diff --git a/drivers/video/fbdev/core/fbcon_ud.c b/drivers/video/fbdev/core/fbcon_ud.c
3130 +index 09619bd8e0217..23bc045769d08 100644
3131 +--- a/drivers/video/fbdev/core/fbcon_ud.c
3132 ++++ b/drivers/video/fbdev/core/fbcon_ud.c
3133 +@@ -44,13 +44,33 @@ static void ud_update_attr(u8 *dst, u8 *src, int attribute,
3134 + }
3135 + }
3136 +
3137 ++
3138 ++static void ud_bmove(struct vc_data *vc, struct fb_info *info, int sy,
3139 ++ int sx, int dy, int dx, int height, int width)
3140 ++{
3141 ++ struct fbcon_ops *ops = info->fbcon_par;
3142 ++ struct fb_copyarea area;
3143 ++ u32 vyres = GETVYRES(ops->p, info);
3144 ++ u32 vxres = GETVXRES(ops->p, info);
3145 ++
3146 ++ area.sy = vyres - ((sy + height) * vc->vc_font.height);
3147 ++ area.sx = vxres - ((sx + width) * vc->vc_font.width);
3148 ++ area.dy = vyres - ((dy + height) * vc->vc_font.height);
3149 ++ area.dx = vxres - ((dx + width) * vc->vc_font.width);
3150 ++ area.height = height * vc->vc_font.height;
3151 ++ area.width = width * vc->vc_font.width;
3152 ++
3153 ++ info->fbops->fb_copyarea(info, &area);
3154 ++}
3155 ++
3156 + static void ud_clear(struct vc_data *vc, struct fb_info *info, int sy,
3157 + int sx, int height, int width)
3158 + {
3159 ++ struct fbcon_ops *ops = info->fbcon_par;
3160 + struct fb_fillrect region;
3161 + int bgshift = (vc->vc_hi_font_mask) ? 13 : 12;
3162 +- u32 vyres = info->var.yres;
3163 +- u32 vxres = info->var.xres;
3164 ++ u32 vyres = GETVYRES(ops->p, info);
3165 ++ u32 vxres = GETVXRES(ops->p, info);
3166 +
3167 + region.color = attr_bgcol_ec(bgshift,vc,info);
3168 + region.dy = vyres - ((sy + height) * vc->vc_font.height);
3169 +@@ -142,8 +162,8 @@ static void ud_putcs(struct vc_data *vc, struct fb_info *info,
3170 + u32 mod = vc->vc_font.width % 8, cnt, pitch, size;
3171 + u32 attribute = get_attribute(info, scr_readw(s));
3172 + u8 *dst, *buf = NULL;
3173 +- u32 vyres = info->var.yres;
3174 +- u32 vxres = info->var.xres;
3175 ++ u32 vyres = GETVYRES(ops->p, info);
3176 ++ u32 vxres = GETVXRES(ops->p, info);
3177 +
3178 + if (!ops->fontbuffer)
3179 + return;
3180 +@@ -239,8 +259,8 @@ static void ud_cursor(struct vc_data *vc, struct fb_info *info, int mode,
3181 + int attribute, use_sw = vc->vc_cursor_type & CUR_SW;
3182 + int err = 1, dx, dy;
3183 + char *src;
3184 +- u32 vyres = info->var.yres;
3185 +- u32 vxres = info->var.xres;
3186 ++ u32 vyres = GETVYRES(ops->p, info);
3187 ++ u32 vxres = GETVXRES(ops->p, info);
3188 +
3189 + if (!ops->fontbuffer)
3190 + return;
3191 +@@ -390,8 +410,8 @@ static int ud_update_start(struct fb_info *info)
3192 + {
3193 + struct fbcon_ops *ops = info->fbcon_par;
3194 + int xoffset, yoffset;
3195 +- u32 vyres = info->var.yres;
3196 +- u32 vxres = info->var.xres;
3197 ++ u32 vyres = GETVYRES(ops->p, info);
3198 ++ u32 vxres = GETVXRES(ops->p, info);
3199 + int err;
3200 +
3201 + xoffset = vxres - info->var.xres - ops->var.xoffset;
3202 +@@ -409,6 +429,7 @@ static int ud_update_start(struct fb_info *info)
3203 +
3204 + void fbcon_rotate_ud(struct fbcon_ops *ops)
3205 + {
3206 ++ ops->bmove = ud_bmove;
3207 + ops->clear = ud_clear;
3208 + ops->putcs = ud_putcs;
3209 + ops->clear_margins = ud_clear_margins;
3210 +diff --git a/drivers/video/fbdev/core/tileblit.c b/drivers/video/fbdev/core/tileblit.c
3211 +index 72af95053bcb5..2768eff247ba4 100644
3212 +--- a/drivers/video/fbdev/core/tileblit.c
3213 ++++ b/drivers/video/fbdev/core/tileblit.c
3214 +@@ -16,6 +16,21 @@
3215 + #include <asm/types.h>
3216 + #include "fbcon.h"
3217 +
3218 ++static void tile_bmove(struct vc_data *vc, struct fb_info *info, int sy,
3219 ++ int sx, int dy, int dx, int height, int width)
3220 ++{
3221 ++ struct fb_tilearea area;
3222 ++
3223 ++ area.sx = sx;
3224 ++ area.sy = sy;
3225 ++ area.dx = dx;
3226 ++ area.dy = dy;
3227 ++ area.height = height;
3228 ++ area.width = width;
3229 ++
3230 ++ info->tileops->fb_tilecopy(info, &area);
3231 ++}
3232 ++
3233 + static void tile_clear(struct vc_data *vc, struct fb_info *info, int sy,
3234 + int sx, int height, int width)
3235 + {
3236 +@@ -118,6 +133,7 @@ void fbcon_set_tileops(struct vc_data *vc, struct fb_info *info)
3237 + struct fb_tilemap map;
3238 + struct fbcon_ops *ops = info->fbcon_par;
3239 +
3240 ++ ops->bmove = tile_bmove;
3241 + ops->clear = tile_clear;
3242 + ops->putcs = tile_putcs;
3243 + ops->clear_margins = tile_clear_margins;
3244 +diff --git a/drivers/video/fbdev/skeletonfb.c b/drivers/video/fbdev/skeletonfb.c
3245 +index 0fe922f726e98..bcacfb6934fa9 100644
3246 +--- a/drivers/video/fbdev/skeletonfb.c
3247 ++++ b/drivers/video/fbdev/skeletonfb.c
3248 +@@ -505,15 +505,15 @@ void xxxfb_fillrect(struct fb_info *p, const struct fb_fillrect *region)
3249 + }
3250 +
3251 + /**
3252 +- * xxxfb_copyarea - OBSOLETE function.
3253 ++ * xxxfb_copyarea - REQUIRED function. Can use generic routines if
3254 ++ * non acclerated hardware and packed pixel based.
3255 + * Copies one area of the screen to another area.
3256 +- * Will be deleted in a future version
3257 + *
3258 + * @info: frame buffer structure that represents a single frame buffer
3259 + * @area: Structure providing the data to copy the framebuffer contents
3260 + * from one region to another.
3261 + *
3262 +- * This drawing operation copied a rectangular area from one area of the
3263 ++ * This drawing operation copies a rectangular area from one area of the
3264 + * screen to another area.
3265 + */
3266 + void xxxfb_copyarea(struct fb_info *p, const struct fb_copyarea *area)
3267 +@@ -645,9 +645,9 @@ static const struct fb_ops xxxfb_ops = {
3268 + .fb_setcolreg = xxxfb_setcolreg,
3269 + .fb_blank = xxxfb_blank,
3270 + .fb_pan_display = xxxfb_pan_display,
3271 +- .fb_fillrect = xxxfb_fillrect, /* Needed !!! */
3272 +- .fb_copyarea = xxxfb_copyarea, /* Obsolete */
3273 +- .fb_imageblit = xxxfb_imageblit, /* Needed !!! */
3274 ++ .fb_fillrect = xxxfb_fillrect, /* Needed !!! */
3275 ++ .fb_copyarea = xxxfb_copyarea, /* Needed !!! */
3276 ++ .fb_imageblit = xxxfb_imageblit, /* Needed !!! */
3277 + .fb_cursor = xxxfb_cursor, /* Optional !!! */
3278 + .fb_sync = xxxfb_sync,
3279 + .fb_ioctl = xxxfb_ioctl,
3280 +diff --git a/fs/9p/fid.c b/fs/9p/fid.c
3281 +index 6aab046c98e29..79df61fe0e596 100644
3282 +--- a/fs/9p/fid.c
3283 ++++ b/fs/9p/fid.c
3284 +@@ -96,12 +96,8 @@ static struct p9_fid *v9fs_fid_find(struct dentry *dentry, kuid_t uid, int any)
3285 + dentry, dentry, from_kuid(&init_user_ns, uid),
3286 + any);
3287 + ret = NULL;
3288 +-
3289 +- if (d_inode(dentry))
3290 +- ret = v9fs_fid_find_inode(d_inode(dentry), uid);
3291 +-
3292 + /* we'll recheck under lock if there's anything to look in */
3293 +- if (!ret && dentry->d_fsdata) {
3294 ++ if (dentry->d_fsdata) {
3295 + struct hlist_head *h = (struct hlist_head *)&dentry->d_fsdata;
3296 +
3297 + spin_lock(&dentry->d_lock);
3298 +@@ -113,6 +109,9 @@ static struct p9_fid *v9fs_fid_find(struct dentry *dentry, kuid_t uid, int any)
3299 + }
3300 + }
3301 + spin_unlock(&dentry->d_lock);
3302 ++ } else {
3303 ++ if (dentry->d_inode)
3304 ++ ret = v9fs_fid_find_inode(dentry->d_inode, uid);
3305 + }
3306 +
3307 + return ret;
3308 +diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
3309 +index 444e9c89ff3e9..b67c965725ea6 100644
3310 +--- a/fs/btrfs/block-group.c
3311 ++++ b/fs/btrfs/block-group.c
3312 +@@ -2547,6 +2547,19 @@ int btrfs_inc_block_group_ro(struct btrfs_block_group *cache,
3313 + int ret;
3314 + bool dirty_bg_running;
3315 +
3316 ++ /*
3317 ++ * This can only happen when we are doing read-only scrub on read-only
3318 ++ * mount.
3319 ++ * In that case we should not start a new transaction on read-only fs.
3320 ++ * Thus here we skip all chunk allocations.
3321 ++ */
3322 ++ if (sb_rdonly(fs_info->sb)) {
3323 ++ mutex_lock(&fs_info->ro_block_group_mutex);
3324 ++ ret = inc_block_group_ro(cache, 0);
3325 ++ mutex_unlock(&fs_info->ro_block_group_mutex);
3326 ++ return ret;
3327 ++ }
3328 ++
3329 + do {
3330 + trans = btrfs_join_transaction(fs_info->extent_root);
3331 + if (IS_ERR(trans))
3332 +diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
3333 +index 124b9e6815e5f..48e03e176f319 100644
3334 +--- a/fs/btrfs/ioctl.c
3335 ++++ b/fs/btrfs/ioctl.c
3336 +@@ -779,10 +779,7 @@ static int create_snapshot(struct btrfs_root *root, struct inode *dir,
3337 + goto fail;
3338 + }
3339 +
3340 +- spin_lock(&fs_info->trans_lock);
3341 +- list_add(&pending_snapshot->list,
3342 +- &trans->transaction->pending_snapshots);
3343 +- spin_unlock(&fs_info->trans_lock);
3344 ++ trans->pending_snapshot = pending_snapshot;
3345 +
3346 + ret = btrfs_commit_transaction(trans);
3347 + if (ret)
3348 +@@ -3313,7 +3310,7 @@ static long btrfs_ioctl_rm_dev(struct file *file, void __user *arg)
3349 + struct block_device *bdev = NULL;
3350 + fmode_t mode;
3351 + int ret;
3352 +- bool cancel;
3353 ++ bool cancel = false;
3354 +
3355 + if (!capable(CAP_SYS_ADMIN))
3356 + return -EPERM;
3357 +diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c
3358 +index 071f7334f8189..26134b7476a2f 100644
3359 +--- a/fs/btrfs/qgroup.c
3360 ++++ b/fs/btrfs/qgroup.c
3361 +@@ -1185,9 +1185,24 @@ int btrfs_quota_disable(struct btrfs_fs_info *fs_info)
3362 + struct btrfs_trans_handle *trans = NULL;
3363 + int ret = 0;
3364 +
3365 ++ /*
3366 ++ * We need to have subvol_sem write locked, to prevent races between
3367 ++ * concurrent tasks trying to disable quotas, because we will unlock
3368 ++ * and relock qgroup_ioctl_lock across BTRFS_FS_QUOTA_ENABLED changes.
3369 ++ */
3370 ++ lockdep_assert_held_write(&fs_info->subvol_sem);
3371 ++
3372 + mutex_lock(&fs_info->qgroup_ioctl_lock);
3373 + if (!fs_info->quota_root)
3374 + goto out;
3375 ++
3376 ++ /*
3377 ++ * Request qgroup rescan worker to complete and wait for it. This wait
3378 ++ * must be done before transaction start for quota disable since it may
3379 ++ * deadlock with transaction by the qgroup rescan worker.
3380 ++ */
3381 ++ clear_bit(BTRFS_FS_QUOTA_ENABLED, &fs_info->flags);
3382 ++ btrfs_qgroup_wait_for_completion(fs_info, false);
3383 + mutex_unlock(&fs_info->qgroup_ioctl_lock);
3384 +
3385 + /*
3386 +@@ -1205,14 +1220,13 @@ int btrfs_quota_disable(struct btrfs_fs_info *fs_info)
3387 + if (IS_ERR(trans)) {
3388 + ret = PTR_ERR(trans);
3389 + trans = NULL;
3390 ++ set_bit(BTRFS_FS_QUOTA_ENABLED, &fs_info->flags);
3391 + goto out;
3392 + }
3393 +
3394 + if (!fs_info->quota_root)
3395 + goto out;
3396 +
3397 +- clear_bit(BTRFS_FS_QUOTA_ENABLED, &fs_info->flags);
3398 +- btrfs_qgroup_wait_for_completion(fs_info, false);
3399 + spin_lock(&fs_info->qgroup_lock);
3400 + quota_root = fs_info->quota_root;
3401 + fs_info->quota_root = NULL;
3402 +@@ -3380,6 +3394,9 @@ qgroup_rescan_init(struct btrfs_fs_info *fs_info, u64 progress_objectid,
3403 + btrfs_warn(fs_info,
3404 + "qgroup rescan init failed, qgroup is not enabled");
3405 + ret = -EINVAL;
3406 ++ } else if (!test_bit(BTRFS_FS_QUOTA_ENABLED, &fs_info->flags)) {
3407 ++ /* Quota disable is in progress */
3408 ++ ret = -EBUSY;
3409 + }
3410 +
3411 + if (ret) {
3412 +diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
3413 +index 1c3a1189c0bdf..27b93a6c41bb4 100644
3414 +--- a/fs/btrfs/transaction.c
3415 ++++ b/fs/btrfs/transaction.c
3416 +@@ -2032,6 +2032,27 @@ static inline void btrfs_wait_delalloc_flush(struct btrfs_fs_info *fs_info)
3417 + btrfs_wait_ordered_roots(fs_info, U64_MAX, 0, (u64)-1);
3418 + }
3419 +
3420 ++/*
3421 ++ * Add a pending snapshot associated with the given transaction handle to the
3422 ++ * respective handle. This must be called after the transaction commit started
3423 ++ * and while holding fs_info->trans_lock.
3424 ++ * This serves to guarantee a caller of btrfs_commit_transaction() that it can
3425 ++ * safely free the pending snapshot pointer in case btrfs_commit_transaction()
3426 ++ * returns an error.
3427 ++ */
3428 ++static void add_pending_snapshot(struct btrfs_trans_handle *trans)
3429 ++{
3430 ++ struct btrfs_transaction *cur_trans = trans->transaction;
3431 ++
3432 ++ if (!trans->pending_snapshot)
3433 ++ return;
3434 ++
3435 ++ lockdep_assert_held(&trans->fs_info->trans_lock);
3436 ++ ASSERT(cur_trans->state >= TRANS_STATE_COMMIT_START);
3437 ++
3438 ++ list_add(&trans->pending_snapshot->list, &cur_trans->pending_snapshots);
3439 ++}
3440 ++
3441 + int btrfs_commit_transaction(struct btrfs_trans_handle *trans)
3442 + {
3443 + struct btrfs_fs_info *fs_info = trans->fs_info;
3444 +@@ -2105,6 +2126,8 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans)
3445 + if (cur_trans->state >= TRANS_STATE_COMMIT_START) {
3446 + enum btrfs_trans_state want_state = TRANS_STATE_COMPLETED;
3447 +
3448 ++ add_pending_snapshot(trans);
3449 ++
3450 + spin_unlock(&fs_info->trans_lock);
3451 + refcount_inc(&cur_trans->use_count);
3452 +
3453 +@@ -2195,6 +2218,7 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans)
3454 + * COMMIT_DOING so make sure to wait for num_writers to == 1 again.
3455 + */
3456 + spin_lock(&fs_info->trans_lock);
3457 ++ add_pending_snapshot(trans);
3458 + cur_trans->state = TRANS_STATE_COMMIT_DOING;
3459 + spin_unlock(&fs_info->trans_lock);
3460 + wait_event(cur_trans->writer_wait,
3461 +diff --git a/fs/btrfs/transaction.h b/fs/btrfs/transaction.h
3462 +index ba45065f94511..eba07b8119bbd 100644
3463 +--- a/fs/btrfs/transaction.h
3464 ++++ b/fs/btrfs/transaction.h
3465 +@@ -123,6 +123,8 @@ struct btrfs_trans_handle {
3466 + struct btrfs_transaction *transaction;
3467 + struct btrfs_block_rsv *block_rsv;
3468 + struct btrfs_block_rsv *orig_rsv;
3469 ++ /* Set by a task that wants to create a snapshot. */
3470 ++ struct btrfs_pending_snapshot *pending_snapshot;
3471 + refcount_t use_count;
3472 + unsigned int type;
3473 + /*
3474 +diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
3475 +index 1060164b984a7..cefd0e9623ba9 100644
3476 +--- a/fs/cifs/connect.c
3477 ++++ b/fs/cifs/connect.c
3478 +@@ -1945,6 +1945,19 @@ cifs_set_cifscreds(struct smb3_fs_context *ctx, struct cifs_ses *ses)
3479 + }
3480 + }
3481 +
3482 ++ ctx->workstation_name = kstrdup(ses->workstation_name, GFP_KERNEL);
3483 ++ if (!ctx->workstation_name) {
3484 ++ cifs_dbg(FYI, "Unable to allocate memory for workstation_name\n");
3485 ++ rc = -ENOMEM;
3486 ++ kfree(ctx->username);
3487 ++ ctx->username = NULL;
3488 ++ kfree_sensitive(ctx->password);
3489 ++ ctx->password = NULL;
3490 ++ kfree(ctx->domainname);
3491 ++ ctx->domainname = NULL;
3492 ++ goto out_key_put;
3493 ++ }
3494 ++
3495 + out_key_put:
3496 + up_read(&key->sem);
3497 + key_put(key);
3498 +diff --git a/fs/cifs/sess.c b/fs/cifs/sess.c
3499 +index 3eee806fd29f0..38574fc70117e 100644
3500 +--- a/fs/cifs/sess.c
3501 ++++ b/fs/cifs/sess.c
3502 +@@ -675,7 +675,11 @@ static int size_of_ntlmssp_blob(struct cifs_ses *ses, int base_size)
3503 + else
3504 + sz += sizeof(__le16);
3505 +
3506 +- sz += sizeof(__le16) * strnlen(ses->workstation_name, CIFS_MAX_WORKSTATION_LEN);
3507 ++ if (ses->workstation_name)
3508 ++ sz += sizeof(__le16) * strnlen(ses->workstation_name,
3509 ++ CIFS_MAX_WORKSTATION_LEN);
3510 ++ else
3511 ++ sz += sizeof(__le16);
3512 +
3513 + return sz;
3514 + }
3515 +diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
3516 +index af7088085d4e4..d248a01132c3b 100644
3517 +--- a/fs/ext4/ext4.h
3518 ++++ b/fs/ext4/ext4.h
3519 +@@ -2936,6 +2936,9 @@ void ext4_fc_replay_cleanup(struct super_block *sb);
3520 + int ext4_fc_commit(journal_t *journal, tid_t commit_tid);
3521 + int __init ext4_fc_init_dentry_cache(void);
3522 + void ext4_fc_destroy_dentry_cache(void);
3523 ++int ext4_fc_record_regions(struct super_block *sb, int ino,
3524 ++ ext4_lblk_t lblk, ext4_fsblk_t pblk,
3525 ++ int len, int replay);
3526 +
3527 + /* mballoc.c */
3528 + extern const struct seq_operations ext4_mb_seq_groups_ops;
3529 +diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
3530 +index fac884dbb42e2..9b37d16b24ffd 100644
3531 +--- a/fs/ext4/extents.c
3532 ++++ b/fs/ext4/extents.c
3533 +@@ -6101,11 +6101,15 @@ int ext4_ext_clear_bb(struct inode *inode)
3534 +
3535 + ext4_mb_mark_bb(inode->i_sb,
3536 + path[j].p_block, 1, 0);
3537 ++ ext4_fc_record_regions(inode->i_sb, inode->i_ino,
3538 ++ 0, path[j].p_block, 1, 1);
3539 + }
3540 + ext4_ext_drop_refs(path);
3541 + kfree(path);
3542 + }
3543 + ext4_mb_mark_bb(inode->i_sb, map.m_pblk, map.m_len, 0);
3544 ++ ext4_fc_record_regions(inode->i_sb, inode->i_ino,
3545 ++ map.m_lblk, map.m_pblk, map.m_len, 1);
3546 + }
3547 + cur = cur + map.m_len;
3548 + }
3549 +diff --git a/fs/ext4/fast_commit.c b/fs/ext4/fast_commit.c
3550 +index ace68ca90b01e..3b79fb063c07a 100644
3551 +--- a/fs/ext4/fast_commit.c
3552 ++++ b/fs/ext4/fast_commit.c
3553 +@@ -1435,14 +1435,15 @@ static int ext4_fc_record_modified_inode(struct super_block *sb, int ino)
3554 + if (state->fc_modified_inodes[i] == ino)
3555 + return 0;
3556 + if (state->fc_modified_inodes_used == state->fc_modified_inodes_size) {
3557 +- state->fc_modified_inodes_size +=
3558 +- EXT4_FC_REPLAY_REALLOC_INCREMENT;
3559 + state->fc_modified_inodes = krealloc(
3560 +- state->fc_modified_inodes, sizeof(int) *
3561 +- state->fc_modified_inodes_size,
3562 +- GFP_KERNEL);
3563 ++ state->fc_modified_inodes,
3564 ++ sizeof(int) * (state->fc_modified_inodes_size +
3565 ++ EXT4_FC_REPLAY_REALLOC_INCREMENT),
3566 ++ GFP_KERNEL);
3567 + if (!state->fc_modified_inodes)
3568 + return -ENOMEM;
3569 ++ state->fc_modified_inodes_size +=
3570 ++ EXT4_FC_REPLAY_REALLOC_INCREMENT;
3571 + }
3572 + state->fc_modified_inodes[state->fc_modified_inodes_used++] = ino;
3573 + return 0;
3574 +@@ -1474,7 +1475,9 @@ static int ext4_fc_replay_inode(struct super_block *sb, struct ext4_fc_tl *tl,
3575 + }
3576 + inode = NULL;
3577 +
3578 +- ext4_fc_record_modified_inode(sb, ino);
3579 ++ ret = ext4_fc_record_modified_inode(sb, ino);
3580 ++ if (ret)
3581 ++ goto out;
3582 +
3583 + raw_fc_inode = (struct ext4_inode *)
3584 + (val + offsetof(struct ext4_fc_inode, fc_raw_inode));
3585 +@@ -1606,16 +1609,23 @@ out:
3586 + }
3587 +
3588 + /*
3589 +- * Record physical disk regions which are in use as per fast commit area. Our
3590 +- * simple replay phase allocator excludes these regions from allocation.
3591 ++ * Record physical disk regions which are in use as per fast commit area,
3592 ++ * and used by inodes during replay phase. Our simple replay phase
3593 ++ * allocator excludes these regions from allocation.
3594 + */
3595 +-static int ext4_fc_record_regions(struct super_block *sb, int ino,
3596 +- ext4_lblk_t lblk, ext4_fsblk_t pblk, int len)
3597 ++int ext4_fc_record_regions(struct super_block *sb, int ino,
3598 ++ ext4_lblk_t lblk, ext4_fsblk_t pblk, int len, int replay)
3599 + {
3600 + struct ext4_fc_replay_state *state;
3601 + struct ext4_fc_alloc_region *region;
3602 +
3603 + state = &EXT4_SB(sb)->s_fc_replay_state;
3604 ++ /*
3605 ++ * during replay phase, the fc_regions_valid may not same as
3606 ++ * fc_regions_used, update it when do new additions.
3607 ++ */
3608 ++ if (replay && state->fc_regions_used != state->fc_regions_valid)
3609 ++ state->fc_regions_used = state->fc_regions_valid;
3610 + if (state->fc_regions_used == state->fc_regions_size) {
3611 + state->fc_regions_size +=
3612 + EXT4_FC_REPLAY_REALLOC_INCREMENT;
3613 +@@ -1633,6 +1643,9 @@ static int ext4_fc_record_regions(struct super_block *sb, int ino,
3614 + region->pblk = pblk;
3615 + region->len = len;
3616 +
3617 ++ if (replay)
3618 ++ state->fc_regions_valid++;
3619 ++
3620 + return 0;
3621 + }
3622 +
3623 +@@ -1664,6 +1677,8 @@ static int ext4_fc_replay_add_range(struct super_block *sb,
3624 + }
3625 +
3626 + ret = ext4_fc_record_modified_inode(sb, inode->i_ino);
3627 ++ if (ret)
3628 ++ goto out;
3629 +
3630 + start = le32_to_cpu(ex->ee_block);
3631 + start_pblk = ext4_ext_pblock(ex);
3632 +@@ -1681,18 +1696,14 @@ static int ext4_fc_replay_add_range(struct super_block *sb,
3633 + map.m_pblk = 0;
3634 + ret = ext4_map_blocks(NULL, inode, &map, 0);
3635 +
3636 +- if (ret < 0) {
3637 +- iput(inode);
3638 +- return 0;
3639 +- }
3640 ++ if (ret < 0)
3641 ++ goto out;
3642 +
3643 + if (ret == 0) {
3644 + /* Range is not mapped */
3645 + path = ext4_find_extent(inode, cur, NULL, 0);
3646 +- if (IS_ERR(path)) {
3647 +- iput(inode);
3648 +- return 0;
3649 +- }
3650 ++ if (IS_ERR(path))
3651 ++ goto out;
3652 + memset(&newex, 0, sizeof(newex));
3653 + newex.ee_block = cpu_to_le32(cur);
3654 + ext4_ext_store_pblock(
3655 +@@ -1706,10 +1717,8 @@ static int ext4_fc_replay_add_range(struct super_block *sb,
3656 + up_write((&EXT4_I(inode)->i_data_sem));
3657 + ext4_ext_drop_refs(path);
3658 + kfree(path);
3659 +- if (ret) {
3660 +- iput(inode);
3661 +- return 0;
3662 +- }
3663 ++ if (ret)
3664 ++ goto out;
3665 + goto next;
3666 + }
3667 +
3668 +@@ -1722,10 +1731,8 @@ static int ext4_fc_replay_add_range(struct super_block *sb,
3669 + ret = ext4_ext_replay_update_ex(inode, cur, map.m_len,
3670 + ext4_ext_is_unwritten(ex),
3671 + start_pblk + cur - start);
3672 +- if (ret) {
3673 +- iput(inode);
3674 +- return 0;
3675 +- }
3676 ++ if (ret)
3677 ++ goto out;
3678 + /*
3679 + * Mark the old blocks as free since they aren't used
3680 + * anymore. We maintain an array of all the modified
3681 +@@ -1745,10 +1752,8 @@ static int ext4_fc_replay_add_range(struct super_block *sb,
3682 + ext4_ext_is_unwritten(ex), map.m_pblk);
3683 + ret = ext4_ext_replay_update_ex(inode, cur, map.m_len,
3684 + ext4_ext_is_unwritten(ex), map.m_pblk);
3685 +- if (ret) {
3686 +- iput(inode);
3687 +- return 0;
3688 +- }
3689 ++ if (ret)
3690 ++ goto out;
3691 + /*
3692 + * We may have split the extent tree while toggling the state.
3693 + * Try to shrink the extent tree now.
3694 +@@ -1760,6 +1765,7 @@ next:
3695 + }
3696 + ext4_ext_replay_shrink_inode(inode, i_size_read(inode) >>
3697 + sb->s_blocksize_bits);
3698 ++out:
3699 + iput(inode);
3700 + return 0;
3701 + }
3702 +@@ -1789,6 +1795,8 @@ ext4_fc_replay_del_range(struct super_block *sb, struct ext4_fc_tl *tl,
3703 + }
3704 +
3705 + ret = ext4_fc_record_modified_inode(sb, inode->i_ino);
3706 ++ if (ret)
3707 ++ goto out;
3708 +
3709 + jbd_debug(1, "DEL_RANGE, inode %ld, lblk %d, len %d\n",
3710 + inode->i_ino, le32_to_cpu(lrange.fc_lblk),
3711 +@@ -1798,10 +1806,8 @@ ext4_fc_replay_del_range(struct super_block *sb, struct ext4_fc_tl *tl,
3712 + map.m_len = remaining;
3713 +
3714 + ret = ext4_map_blocks(NULL, inode, &map, 0);
3715 +- if (ret < 0) {
3716 +- iput(inode);
3717 +- return 0;
3718 +- }
3719 ++ if (ret < 0)
3720 ++ goto out;
3721 + if (ret > 0) {
3722 + remaining -= ret;
3723 + cur += ret;
3724 +@@ -1813,18 +1819,17 @@ ext4_fc_replay_del_range(struct super_block *sb, struct ext4_fc_tl *tl,
3725 + }
3726 +
3727 + down_write(&EXT4_I(inode)->i_data_sem);
3728 +- ret = ext4_ext_remove_space(inode, lrange.fc_lblk,
3729 +- lrange.fc_lblk + lrange.fc_len - 1);
3730 ++ ret = ext4_ext_remove_space(inode, le32_to_cpu(lrange.fc_lblk),
3731 ++ le32_to_cpu(lrange.fc_lblk) +
3732 ++ le32_to_cpu(lrange.fc_len) - 1);
3733 + up_write(&EXT4_I(inode)->i_data_sem);
3734 +- if (ret) {
3735 +- iput(inode);
3736 +- return 0;
3737 +- }
3738 ++ if (ret)
3739 ++ goto out;
3740 + ext4_ext_replay_shrink_inode(inode,
3741 + i_size_read(inode) >> sb->s_blocksize_bits);
3742 + ext4_mark_inode_dirty(NULL, inode);
3743 ++out:
3744 + iput(inode);
3745 +-
3746 + return 0;
3747 + }
3748 +
3749 +@@ -1980,7 +1985,7 @@ static int ext4_fc_replay_scan(journal_t *journal,
3750 + ret = ext4_fc_record_regions(sb,
3751 + le32_to_cpu(ext.fc_ino),
3752 + le32_to_cpu(ex->ee_block), ext4_ext_pblock(ex),
3753 +- ext4_ext_get_actual_len(ex));
3754 ++ ext4_ext_get_actual_len(ex), 0);
3755 + if (ret < 0)
3756 + break;
3757 + ret = JBD2_FC_REPLAY_CONTINUE;
3758 +diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c
3759 +index 39a1ab129fdc9..d091133a4b460 100644
3760 +--- a/fs/ext4/inline.c
3761 ++++ b/fs/ext4/inline.c
3762 +@@ -1133,7 +1133,15 @@ static void ext4_restore_inline_data(handle_t *handle, struct inode *inode,
3763 + struct ext4_iloc *iloc,
3764 + void *buf, int inline_size)
3765 + {
3766 +- ext4_create_inline_data(handle, inode, inline_size);
3767 ++ int ret;
3768 ++
3769 ++ ret = ext4_create_inline_data(handle, inode, inline_size);
3770 ++ if (ret) {
3771 ++ ext4_msg(inode->i_sb, KERN_EMERG,
3772 ++ "error restoring inline_data for inode -- potential data loss! (inode %lu, error %d)",
3773 ++ inode->i_ino, ret);
3774 ++ return;
3775 ++ }
3776 + ext4_write_inline_data(inode, iloc, buf, 0, inline_size);
3777 + ext4_set_inode_state(inode, EXT4_STATE_MAY_INLINE_DATA);
3778 + }
3779 +diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
3780 +index ea764137462ef..c849fd845d9b8 100644
3781 +--- a/fs/ext4/mballoc.c
3782 ++++ b/fs/ext4/mballoc.c
3783 +@@ -5753,7 +5753,8 @@ static ext4_fsblk_t ext4_mb_new_blocks_simple(handle_t *handle,
3784 + struct super_block *sb = ar->inode->i_sb;
3785 + ext4_group_t group;
3786 + ext4_grpblk_t blkoff;
3787 +- int i = sb->s_blocksize;
3788 ++ ext4_grpblk_t max = EXT4_CLUSTERS_PER_GROUP(sb);
3789 ++ ext4_grpblk_t i = 0;
3790 + ext4_fsblk_t goal, block;
3791 + struct ext4_super_block *es = EXT4_SB(sb)->s_es;
3792 +
3793 +@@ -5775,19 +5776,26 @@ static ext4_fsblk_t ext4_mb_new_blocks_simple(handle_t *handle,
3794 + ext4_get_group_no_and_offset(sb,
3795 + max(ext4_group_first_block_no(sb, group), goal),
3796 + NULL, &blkoff);
3797 +- i = mb_find_next_zero_bit(bitmap_bh->b_data, sb->s_blocksize,
3798 ++ while (1) {
3799 ++ i = mb_find_next_zero_bit(bitmap_bh->b_data, max,
3800 + blkoff);
3801 ++ if (i >= max)
3802 ++ break;
3803 ++ if (ext4_fc_replay_check_excluded(sb,
3804 ++ ext4_group_first_block_no(sb, group) + i)) {
3805 ++ blkoff = i + 1;
3806 ++ } else
3807 ++ break;
3808 ++ }
3809 + brelse(bitmap_bh);
3810 +- if (i >= sb->s_blocksize)
3811 +- continue;
3812 +- if (ext4_fc_replay_check_excluded(sb,
3813 +- ext4_group_first_block_no(sb, group) + i))
3814 +- continue;
3815 +- break;
3816 ++ if (i < max)
3817 ++ break;
3818 + }
3819 +
3820 +- if (group >= ext4_get_groups_count(sb) && i >= sb->s_blocksize)
3821 ++ if (group >= ext4_get_groups_count(sb) || i >= max) {
3822 ++ *errp = -ENOSPC;
3823 + return 0;
3824 ++ }
3825 +
3826 + block = ext4_group_first_block_no(sb, group) + i;
3827 + ext4_mb_mark_bb(sb, block, 1, 1);
3828 +diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
3829 +index b94b3bb2b8a6e..ac0ddde8beef2 100644
3830 +--- a/fs/nfsd/nfs4state.c
3831 ++++ b/fs/nfsd/nfs4state.c
3832 +@@ -4112,8 +4112,10 @@ nfsd4_setclientid_confirm(struct svc_rqst *rqstp,
3833 + status = nfserr_clid_inuse;
3834 + if (client_has_state(old)
3835 + && !same_creds(&unconf->cl_cred,
3836 +- &old->cl_cred))
3837 ++ &old->cl_cred)) {
3838 ++ old = NULL;
3839 + goto out;
3840 ++ }
3841 + status = mark_client_expired_locked(old);
3842 + if (status) {
3843 + old = NULL;
3844 +diff --git a/include/linux/fb.h b/include/linux/fb.h
3845 +index 3da95842b2075..02f362c661c80 100644
3846 +--- a/include/linux/fb.h
3847 ++++ b/include/linux/fb.h
3848 +@@ -262,7 +262,7 @@ struct fb_ops {
3849 +
3850 + /* Draws a rectangle */
3851 + void (*fb_fillrect) (struct fb_info *info, const struct fb_fillrect *rect);
3852 +- /* Copy data from area to another. Obsolete. */
3853 ++ /* Copy data from area to another */
3854 + void (*fb_copyarea) (struct fb_info *info, const struct fb_copyarea *region);
3855 + /* Draws a image to the display */
3856 + void (*fb_imageblit) (struct fb_info *info, const struct fb_image *image);
3857 +diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
3858 +index c310648cc8f1a..05e7fd79f1acc 100644
3859 +--- a/include/linux/kvm_host.h
3860 ++++ b/include/linux/kvm_host.h
3861 +@@ -15,6 +15,8 @@
3862 + #include <linux/minmax.h>
3863 + #include <linux/mm.h>
3864 + #include <linux/mmu_notifier.h>
3865 ++#include <linux/ftrace.h>
3866 ++#include <linux/instrumentation.h>
3867 + #include <linux/preempt.h>
3868 + #include <linux/msi.h>
3869 + #include <linux/slab.h>
3870 +@@ -362,8 +364,11 @@ struct kvm_vcpu {
3871 + int last_used_slot;
3872 + };
3873 +
3874 +-/* must be called with irqs disabled */
3875 +-static __always_inline void guest_enter_irqoff(void)
3876 ++/*
3877 ++ * Start accounting time towards a guest.
3878 ++ * Must be called before entering guest context.
3879 ++ */
3880 ++static __always_inline void guest_timing_enter_irqoff(void)
3881 + {
3882 + /*
3883 + * This is running in ioctl context so its safe to assume that it's the
3884 +@@ -372,7 +377,18 @@ static __always_inline void guest_enter_irqoff(void)
3885 + instrumentation_begin();
3886 + vtime_account_guest_enter();
3887 + instrumentation_end();
3888 ++}
3889 +
3890 ++/*
3891 ++ * Enter guest context and enter an RCU extended quiescent state.
3892 ++ *
3893 ++ * Between guest_context_enter_irqoff() and guest_context_exit_irqoff() it is
3894 ++ * unsafe to use any code which may directly or indirectly use RCU, tracing
3895 ++ * (including IRQ flag tracing), or lockdep. All code in this period must be
3896 ++ * non-instrumentable.
3897 ++ */
3898 ++static __always_inline void guest_context_enter_irqoff(void)
3899 ++{
3900 + /*
3901 + * KVM does not hold any references to rcu protected data when it
3902 + * switches CPU into a guest mode. In fact switching to a guest mode
3903 +@@ -388,16 +404,79 @@ static __always_inline void guest_enter_irqoff(void)
3904 + }
3905 + }
3906 +
3907 +-static __always_inline void guest_exit_irqoff(void)
3908 ++/*
3909 ++ * Deprecated. Architectures should move to guest_timing_enter_irqoff() and
3910 ++ * guest_state_enter_irqoff().
3911 ++ */
3912 ++static __always_inline void guest_enter_irqoff(void)
3913 ++{
3914 ++ guest_timing_enter_irqoff();
3915 ++ guest_context_enter_irqoff();
3916 ++}
3917 ++
3918 ++/**
3919 ++ * guest_state_enter_irqoff - Fixup state when entering a guest
3920 ++ *
3921 ++ * Entry to a guest will enable interrupts, but the kernel state is interrupts
3922 ++ * disabled when this is invoked. Also tell RCU about it.
3923 ++ *
3924 ++ * 1) Trace interrupts on state
3925 ++ * 2) Invoke context tracking if enabled to adjust RCU state
3926 ++ * 3) Tell lockdep that interrupts are enabled
3927 ++ *
3928 ++ * Invoked from architecture specific code before entering a guest.
3929 ++ * Must be called with interrupts disabled and the caller must be
3930 ++ * non-instrumentable.
3931 ++ * The caller has to invoke guest_timing_enter_irqoff() before this.
3932 ++ *
3933 ++ * Note: this is analogous to exit_to_user_mode().
3934 ++ */
3935 ++static __always_inline void guest_state_enter_irqoff(void)
3936 ++{
3937 ++ instrumentation_begin();
3938 ++ trace_hardirqs_on_prepare();
3939 ++ lockdep_hardirqs_on_prepare(CALLER_ADDR0);
3940 ++ instrumentation_end();
3941 ++
3942 ++ guest_context_enter_irqoff();
3943 ++ lockdep_hardirqs_on(CALLER_ADDR0);
3944 ++}
3945 ++
3946 ++/*
3947 ++ * Exit guest context and exit an RCU extended quiescent state.
3948 ++ *
3949 ++ * Between guest_context_enter_irqoff() and guest_context_exit_irqoff() it is
3950 ++ * unsafe to use any code which may directly or indirectly use RCU, tracing
3951 ++ * (including IRQ flag tracing), or lockdep. All code in this period must be
3952 ++ * non-instrumentable.
3953 ++ */
3954 ++static __always_inline void guest_context_exit_irqoff(void)
3955 + {
3956 + context_tracking_guest_exit();
3957 ++}
3958 +
3959 ++/*
3960 ++ * Stop accounting time towards a guest.
3961 ++ * Must be called after exiting guest context.
3962 ++ */
3963 ++static __always_inline void guest_timing_exit_irqoff(void)
3964 ++{
3965 + instrumentation_begin();
3966 + /* Flush the guest cputime we spent on the guest */
3967 + vtime_account_guest_exit();
3968 + instrumentation_end();
3969 + }
3970 +
3971 ++/*
3972 ++ * Deprecated. Architectures should move to guest_state_exit_irqoff() and
3973 ++ * guest_timing_exit_irqoff().
3974 ++ */
3975 ++static __always_inline void guest_exit_irqoff(void)
3976 ++{
3977 ++ guest_context_exit_irqoff();
3978 ++ guest_timing_exit_irqoff();
3979 ++}
3980 ++
3981 + static inline void guest_exit(void)
3982 + {
3983 + unsigned long flags;
3984 +@@ -407,6 +486,33 @@ static inline void guest_exit(void)
3985 + local_irq_restore(flags);
3986 + }
3987 +
3988 ++/**
3989 ++ * guest_state_exit_irqoff - Establish state when returning from guest mode
3990 ++ *
3991 ++ * Entry from a guest disables interrupts, but guest mode is traced as
3992 ++ * interrupts enabled. Also with NO_HZ_FULL RCU might be idle.
3993 ++ *
3994 ++ * 1) Tell lockdep that interrupts are disabled
3995 ++ * 2) Invoke context tracking if enabled to reactivate RCU
3996 ++ * 3) Trace interrupts off state
3997 ++ *
3998 ++ * Invoked from architecture specific code after exiting a guest.
3999 ++ * Must be invoked with interrupts disabled and the caller must be
4000 ++ * non-instrumentable.
4001 ++ * The caller has to invoke guest_timing_exit_irqoff() after this.
4002 ++ *
4003 ++ * Note: this is analogous to enter_from_user_mode().
4004 ++ */
4005 ++static __always_inline void guest_state_exit_irqoff(void)
4006 ++{
4007 ++ lockdep_hardirqs_off(CALLER_ADDR0);
4008 ++ guest_context_exit_irqoff();
4009 ++
4010 ++ instrumentation_begin();
4011 ++ trace_hardirqs_off_finish();
4012 ++ instrumentation_end();
4013 ++}
4014 ++
4015 + static inline int kvm_vcpu_exiting_guest_mode(struct kvm_vcpu *vcpu)
4016 + {
4017 + /*
4018 +diff --git a/include/linux/libata.h b/include/linux/libata.h
4019 +index 2a8404b26083c..430b460221082 100644
4020 +--- a/include/linux/libata.h
4021 ++++ b/include/linux/libata.h
4022 +@@ -428,6 +428,7 @@ enum {
4023 + ATA_HORKAGE_MAX_TRIM_128M = (1 << 26), /* Limit max trim size to 128M */
4024 + ATA_HORKAGE_NO_NCQ_ON_ATI = (1 << 27), /* Disable NCQ on ATI chipset */
4025 + ATA_HORKAGE_NO_ID_DEV_LOG = (1 << 28), /* Identify device log missing */
4026 ++ ATA_HORKAGE_NO_LOG_DIR = (1 << 29), /* Do not read log directory */
4027 +
4028 + /* DMA mask for user DMA control: User visible values; DO NOT
4029 + renumber */
4030 +diff --git a/include/linux/pgtable.h b/include/linux/pgtable.h
4031 +index e24d2c992b112..d468efcf48f45 100644
4032 +--- a/include/linux/pgtable.h
4033 ++++ b/include/linux/pgtable.h
4034 +@@ -62,6 +62,7 @@ static inline unsigned long pte_index(unsigned long address)
4035 + {
4036 + return (address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1);
4037 + }
4038 ++#define pte_index pte_index
4039 +
4040 + #ifndef pmd_index
4041 + static inline unsigned long pmd_index(unsigned long address)
4042 +diff --git a/include/net/neighbour.h b/include/net/neighbour.h
4043 +index 38a0c1d245708..85a10c251542e 100644
4044 +--- a/include/net/neighbour.h
4045 ++++ b/include/net/neighbour.h
4046 +@@ -336,7 +336,8 @@ static inline struct neighbour *neigh_create(struct neigh_table *tbl,
4047 + return __neigh_create(tbl, pkey, dev, true);
4048 + }
4049 + void neigh_destroy(struct neighbour *neigh);
4050 +-int __neigh_event_send(struct neighbour *neigh, struct sk_buff *skb);
4051 ++int __neigh_event_send(struct neighbour *neigh, struct sk_buff *skb,
4052 ++ const bool immediate_ok);
4053 + int neigh_update(struct neighbour *neigh, const u8 *lladdr, u8 new, u32 flags,
4054 + u32 nlmsg_pid);
4055 + void __neigh_set_probe_once(struct neighbour *neigh);
4056 +@@ -446,17 +447,24 @@ static inline struct neighbour * neigh_clone(struct neighbour *neigh)
4057 +
4058 + #define neigh_hold(n) refcount_inc(&(n)->refcnt)
4059 +
4060 +-static inline int neigh_event_send(struct neighbour *neigh, struct sk_buff *skb)
4061 ++static __always_inline int neigh_event_send_probe(struct neighbour *neigh,
4062 ++ struct sk_buff *skb,
4063 ++ const bool immediate_ok)
4064 + {
4065 + unsigned long now = jiffies;
4066 +-
4067 ++
4068 + if (READ_ONCE(neigh->used) != now)
4069 + WRITE_ONCE(neigh->used, now);
4070 +- if (!(neigh->nud_state&(NUD_CONNECTED|NUD_DELAY|NUD_PROBE)))
4071 +- return __neigh_event_send(neigh, skb);
4072 ++ if (!(neigh->nud_state & (NUD_CONNECTED | NUD_DELAY | NUD_PROBE)))
4073 ++ return __neigh_event_send(neigh, skb, immediate_ok);
4074 + return 0;
4075 + }
4076 +
4077 ++static inline int neigh_event_send(struct neighbour *neigh, struct sk_buff *skb)
4078 ++{
4079 ++ return neigh_event_send_probe(neigh, skb, true);
4080 ++}
4081 ++
4082 + #if IS_ENABLED(CONFIG_BRIDGE_NETFILTER)
4083 + static inline int neigh_hh_bridge(struct hh_cache *hh, struct sk_buff *skb)
4084 + {
4085 +diff --git a/include/uapi/sound/asound.h b/include/uapi/sound/asound.h
4086 +index 5fbb79e30819a..c245ad2ca5d49 100644
4087 +--- a/include/uapi/sound/asound.h
4088 ++++ b/include/uapi/sound/asound.h
4089 +@@ -56,8 +56,10 @@
4090 + * *
4091 + ****************************************************************************/
4092 +
4093 ++#define AES_IEC958_STATUS_SIZE 24
4094 ++
4095 + struct snd_aes_iec958 {
4096 +- unsigned char status[24]; /* AES/IEC958 channel status bits */
4097 ++ unsigned char status[AES_IEC958_STATUS_SIZE]; /* AES/IEC958 channel status bits */
4098 + unsigned char subcode[147]; /* AES/IEC958 subcode bits */
4099 + unsigned char pad; /* nothing */
4100 + unsigned char dig_subframe[4]; /* AES/IEC958 subframe bits */
4101 +diff --git a/ipc/sem.c b/ipc/sem.c
4102 +index 6693daf4fe112..0dbdb98fdf2d9 100644
4103 +--- a/ipc/sem.c
4104 ++++ b/ipc/sem.c
4105 +@@ -1964,6 +1964,7 @@ static struct sem_undo *find_alloc_undo(struct ipc_namespace *ns, int semid)
4106 + */
4107 + un = lookup_undo(ulp, semid);
4108 + if (un) {
4109 ++ spin_unlock(&ulp->lock);
4110 + kvfree(new);
4111 + goto success;
4112 + }
4113 +@@ -1976,9 +1977,8 @@ static struct sem_undo *find_alloc_undo(struct ipc_namespace *ns, int semid)
4114 + ipc_assert_locked_object(&sma->sem_perm);
4115 + list_add(&new->list_id, &sma->list_id);
4116 + un = new;
4117 +-
4118 +-success:
4119 + spin_unlock(&ulp->lock);
4120 ++success:
4121 + sem_unlock(sma, -1);
4122 + out:
4123 + return un;
4124 +diff --git a/kernel/audit.c b/kernel/audit.c
4125 +index eab7282668ab9..94ded5de91317 100644
4126 +--- a/kernel/audit.c
4127 ++++ b/kernel/audit.c
4128 +@@ -541,20 +541,22 @@ static void kauditd_printk_skb(struct sk_buff *skb)
4129 + /**
4130 + * kauditd_rehold_skb - Handle a audit record send failure in the hold queue
4131 + * @skb: audit record
4132 ++ * @error: error code (unused)
4133 + *
4134 + * Description:
4135 + * This should only be used by the kauditd_thread when it fails to flush the
4136 + * hold queue.
4137 + */
4138 +-static void kauditd_rehold_skb(struct sk_buff *skb)
4139 ++static void kauditd_rehold_skb(struct sk_buff *skb, __always_unused int error)
4140 + {
4141 +- /* put the record back in the queue at the same place */
4142 +- skb_queue_head(&audit_hold_queue, skb);
4143 ++ /* put the record back in the queue */
4144 ++ skb_queue_tail(&audit_hold_queue, skb);
4145 + }
4146 +
4147 + /**
4148 + * kauditd_hold_skb - Queue an audit record, waiting for auditd
4149 + * @skb: audit record
4150 ++ * @error: error code
4151 + *
4152 + * Description:
4153 + * Queue the audit record, waiting for an instance of auditd. When this
4154 +@@ -564,19 +566,31 @@ static void kauditd_rehold_skb(struct sk_buff *skb)
4155 + * and queue it, if we have room. If we want to hold on to the record, but we
4156 + * don't have room, record a record lost message.
4157 + */
4158 +-static void kauditd_hold_skb(struct sk_buff *skb)
4159 ++static void kauditd_hold_skb(struct sk_buff *skb, int error)
4160 + {
4161 + /* at this point it is uncertain if we will ever send this to auditd so
4162 + * try to send the message via printk before we go any further */
4163 + kauditd_printk_skb(skb);
4164 +
4165 + /* can we just silently drop the message? */
4166 +- if (!audit_default) {
4167 +- kfree_skb(skb);
4168 +- return;
4169 ++ if (!audit_default)
4170 ++ goto drop;
4171 ++
4172 ++ /* the hold queue is only for when the daemon goes away completely,
4173 ++ * not -EAGAIN failures; if we are in a -EAGAIN state requeue the
4174 ++ * record on the retry queue unless it's full, in which case drop it
4175 ++ */
4176 ++ if (error == -EAGAIN) {
4177 ++ if (!audit_backlog_limit ||
4178 ++ skb_queue_len(&audit_retry_queue) < audit_backlog_limit) {
4179 ++ skb_queue_tail(&audit_retry_queue, skb);
4180 ++ return;
4181 ++ }
4182 ++ audit_log_lost("kauditd retry queue overflow");
4183 ++ goto drop;
4184 + }
4185 +
4186 +- /* if we have room, queue the message */
4187 ++ /* if we have room in the hold queue, queue the message */
4188 + if (!audit_backlog_limit ||
4189 + skb_queue_len(&audit_hold_queue) < audit_backlog_limit) {
4190 + skb_queue_tail(&audit_hold_queue, skb);
4191 +@@ -585,24 +599,32 @@ static void kauditd_hold_skb(struct sk_buff *skb)
4192 +
4193 + /* we have no other options - drop the message */
4194 + audit_log_lost("kauditd hold queue overflow");
4195 ++drop:
4196 + kfree_skb(skb);
4197 + }
4198 +
4199 + /**
4200 + * kauditd_retry_skb - Queue an audit record, attempt to send again to auditd
4201 + * @skb: audit record
4202 ++ * @error: error code (unused)
4203 + *
4204 + * Description:
4205 + * Not as serious as kauditd_hold_skb() as we still have a connected auditd,
4206 + * but for some reason we are having problems sending it audit records so
4207 + * queue the given record and attempt to resend.
4208 + */
4209 +-static void kauditd_retry_skb(struct sk_buff *skb)
4210 ++static void kauditd_retry_skb(struct sk_buff *skb, __always_unused int error)
4211 + {
4212 +- /* NOTE: because records should only live in the retry queue for a
4213 +- * short period of time, before either being sent or moved to the hold
4214 +- * queue, we don't currently enforce a limit on this queue */
4215 +- skb_queue_tail(&audit_retry_queue, skb);
4216 ++ if (!audit_backlog_limit ||
4217 ++ skb_queue_len(&audit_retry_queue) < audit_backlog_limit) {
4218 ++ skb_queue_tail(&audit_retry_queue, skb);
4219 ++ return;
4220 ++ }
4221 ++
4222 ++ /* we have to drop the record, send it via printk as a last effort */
4223 ++ kauditd_printk_skb(skb);
4224 ++ audit_log_lost("kauditd retry queue overflow");
4225 ++ kfree_skb(skb);
4226 + }
4227 +
4228 + /**
4229 +@@ -640,7 +662,7 @@ static void auditd_reset(const struct auditd_connection *ac)
4230 + /* flush the retry queue to the hold queue, but don't touch the main
4231 + * queue since we need to process that normally for multicast */
4232 + while ((skb = skb_dequeue(&audit_retry_queue)))
4233 +- kauditd_hold_skb(skb);
4234 ++ kauditd_hold_skb(skb, -ECONNREFUSED);
4235 + }
4236 +
4237 + /**
4238 +@@ -714,16 +736,18 @@ static int kauditd_send_queue(struct sock *sk, u32 portid,
4239 + struct sk_buff_head *queue,
4240 + unsigned int retry_limit,
4241 + void (*skb_hook)(struct sk_buff *skb),
4242 +- void (*err_hook)(struct sk_buff *skb))
4243 ++ void (*err_hook)(struct sk_buff *skb, int error))
4244 + {
4245 + int rc = 0;
4246 +- struct sk_buff *skb;
4247 ++ struct sk_buff *skb = NULL;
4248 ++ struct sk_buff *skb_tail;
4249 + unsigned int failed = 0;
4250 +
4251 + /* NOTE: kauditd_thread takes care of all our locking, we just use
4252 + * the netlink info passed to us (e.g. sk and portid) */
4253 +
4254 +- while ((skb = skb_dequeue(queue))) {
4255 ++ skb_tail = skb_peek_tail(queue);
4256 ++ while ((skb != skb_tail) && (skb = skb_dequeue(queue))) {
4257 + /* call the skb_hook for each skb we touch */
4258 + if (skb_hook)
4259 + (*skb_hook)(skb);
4260 +@@ -731,7 +755,7 @@ static int kauditd_send_queue(struct sock *sk, u32 portid,
4261 + /* can we send to anyone via unicast? */
4262 + if (!sk) {
4263 + if (err_hook)
4264 +- (*err_hook)(skb);
4265 ++ (*err_hook)(skb, -ECONNREFUSED);
4266 + continue;
4267 + }
4268 +
4269 +@@ -745,7 +769,7 @@ retry:
4270 + rc == -ECONNREFUSED || rc == -EPERM) {
4271 + sk = NULL;
4272 + if (err_hook)
4273 +- (*err_hook)(skb);
4274 ++ (*err_hook)(skb, rc);
4275 + if (rc == -EAGAIN)
4276 + rc = 0;
4277 + /* continue to drain the queue */
4278 +diff --git a/kernel/bpf/ringbuf.c b/kernel/bpf/ringbuf.c
4279 +index 9e0c10c6892ad..f1c51c45667d3 100644
4280 +--- a/kernel/bpf/ringbuf.c
4281 ++++ b/kernel/bpf/ringbuf.c
4282 +@@ -104,7 +104,7 @@ static struct bpf_ringbuf *bpf_ringbuf_area_alloc(size_t data_sz, int numa_node)
4283 + }
4284 +
4285 + rb = vmap(pages, nr_meta_pages + 2 * nr_data_pages,
4286 +- VM_ALLOC | VM_USERMAP, PAGE_KERNEL);
4287 ++ VM_MAP | VM_USERMAP, PAGE_KERNEL);
4288 + if (rb) {
4289 + kmemleak_not_leak(pages);
4290 + rb->pages = pages;
4291 +diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
4292 +index ff8f2f522eb55..d729cbd2445af 100644
4293 +--- a/kernel/cgroup/cpuset.c
4294 ++++ b/kernel/cgroup/cpuset.c
4295 +@@ -1530,10 +1530,15 @@ static void update_sibling_cpumasks(struct cpuset *parent, struct cpuset *cs,
4296 + struct cpuset *sibling;
4297 + struct cgroup_subsys_state *pos_css;
4298 +
4299 ++ percpu_rwsem_assert_held(&cpuset_rwsem);
4300 ++
4301 + /*
4302 + * Check all its siblings and call update_cpumasks_hier()
4303 + * if their use_parent_ecpus flag is set in order for them
4304 + * to use the right effective_cpus value.
4305 ++ *
4306 ++ * The update_cpumasks_hier() function may sleep. So we have to
4307 ++ * release the RCU read lock before calling it.
4308 + */
4309 + rcu_read_lock();
4310 + cpuset_for_each_child(sibling, pos_css, parent) {
4311 +@@ -1541,8 +1546,13 @@ static void update_sibling_cpumasks(struct cpuset *parent, struct cpuset *cs,
4312 + continue;
4313 + if (!sibling->use_parent_ecpus)
4314 + continue;
4315 ++ if (!css_tryget_online(&sibling->css))
4316 ++ continue;
4317 +
4318 ++ rcu_read_unlock();
4319 + update_cpumasks_hier(sibling, tmp);
4320 ++ rcu_read_lock();
4321 ++ css_put(&sibling->css);
4322 + }
4323 + rcu_read_unlock();
4324 + }
4325 +diff --git a/kernel/events/core.c b/kernel/events/core.c
4326 +index 6ed890480c4aa..04e6e2dae60e4 100644
4327 +--- a/kernel/events/core.c
4328 ++++ b/kernel/events/core.c
4329 +@@ -3234,6 +3234,15 @@ static int perf_event_modify_breakpoint(struct perf_event *bp,
4330 + return err;
4331 + }
4332 +
4333 ++/*
4334 ++ * Copy event-type-independent attributes that may be modified.
4335 ++ */
4336 ++static void perf_event_modify_copy_attr(struct perf_event_attr *to,
4337 ++ const struct perf_event_attr *from)
4338 ++{
4339 ++ to->sig_data = from->sig_data;
4340 ++}
4341 ++
4342 + static int perf_event_modify_attr(struct perf_event *event,
4343 + struct perf_event_attr *attr)
4344 + {
4345 +@@ -3256,10 +3265,17 @@ static int perf_event_modify_attr(struct perf_event *event,
4346 + WARN_ON_ONCE(event->ctx->parent_ctx);
4347 +
4348 + mutex_lock(&event->child_mutex);
4349 ++ /*
4350 ++ * Event-type-independent attributes must be copied before event-type
4351 ++ * modification, which will validate that final attributes match the
4352 ++ * source attributes after all relevant attributes have been copied.
4353 ++ */
4354 ++ perf_event_modify_copy_attr(&event->attr, attr);
4355 + err = func(event, attr);
4356 + if (err)
4357 + goto out;
4358 + list_for_each_entry(child, &event->child_list, child_list) {
4359 ++ perf_event_modify_copy_attr(&child->attr, attr);
4360 + err = func(child, attr);
4361 + if (err)
4362 + goto out;
4363 +diff --git a/mm/debug_vm_pgtable.c b/mm/debug_vm_pgtable.c
4364 +index 228e3954b90c1..983ec5974aaf8 100644
4365 +--- a/mm/debug_vm_pgtable.c
4366 ++++ b/mm/debug_vm_pgtable.c
4367 +@@ -171,6 +171,8 @@ static void __init pte_advanced_tests(struct pgtable_debug_args *args)
4368 + ptep_test_and_clear_young(args->vma, args->vaddr, args->ptep);
4369 + pte = ptep_get(args->ptep);
4370 + WARN_ON(pte_young(pte));
4371 ++
4372 ++ ptep_get_and_clear_full(args->mm, args->vaddr, args->ptep, 1);
4373 + }
4374 +
4375 + static void __init pte_savedwrite_tests(struct pgtable_debug_args *args)
4376 +diff --git a/mm/kmemleak.c b/mm/kmemleak.c
4377 +index b57383c17cf60..adbe5aa011848 100644
4378 +--- a/mm/kmemleak.c
4379 ++++ b/mm/kmemleak.c
4380 +@@ -1403,7 +1403,8 @@ static void kmemleak_scan(void)
4381 + {
4382 + unsigned long flags;
4383 + struct kmemleak_object *object;
4384 +- int i;
4385 ++ struct zone *zone;
4386 ++ int __maybe_unused i;
4387 + int new_leaks = 0;
4388 +
4389 + jiffies_last_scan = jiffies;
4390 +@@ -1443,9 +1444,9 @@ static void kmemleak_scan(void)
4391 + * Struct page scanning for each node.
4392 + */
4393 + get_online_mems();
4394 +- for_each_online_node(i) {
4395 +- unsigned long start_pfn = node_start_pfn(i);
4396 +- unsigned long end_pfn = node_end_pfn(i);
4397 ++ for_each_populated_zone(zone) {
4398 ++ unsigned long start_pfn = zone->zone_start_pfn;
4399 ++ unsigned long end_pfn = zone_end_pfn(zone);
4400 + unsigned long pfn;
4401 +
4402 + for (pfn = start_pfn; pfn < end_pfn; pfn++) {
4403 +@@ -1454,8 +1455,8 @@ static void kmemleak_scan(void)
4404 + if (!page)
4405 + continue;
4406 +
4407 +- /* only scan pages belonging to this node */
4408 +- if (page_to_nid(page) != i)
4409 ++ /* only scan pages belonging to this zone */
4410 ++ if (page_zone(page) != zone)
4411 + continue;
4412 + /* only scan if page is in use */
4413 + if (page_count(page) == 0)
4414 +diff --git a/net/bridge/netfilter/nft_reject_bridge.c b/net/bridge/netfilter/nft_reject_bridge.c
4415 +index eba0efe64d05a..fbf858ddec352 100644
4416 +--- a/net/bridge/netfilter/nft_reject_bridge.c
4417 ++++ b/net/bridge/netfilter/nft_reject_bridge.c
4418 +@@ -49,7 +49,7 @@ static void nft_reject_br_send_v4_tcp_reset(struct net *net,
4419 + {
4420 + struct sk_buff *nskb;
4421 +
4422 +- nskb = nf_reject_skb_v4_tcp_reset(net, oldskb, dev, hook);
4423 ++ nskb = nf_reject_skb_v4_tcp_reset(net, oldskb, NULL, hook);
4424 + if (!nskb)
4425 + return;
4426 +
4427 +@@ -65,7 +65,7 @@ static void nft_reject_br_send_v4_unreach(struct net *net,
4428 + {
4429 + struct sk_buff *nskb;
4430 +
4431 +- nskb = nf_reject_skb_v4_unreach(net, oldskb, dev, hook, code);
4432 ++ nskb = nf_reject_skb_v4_unreach(net, oldskb, NULL, hook, code);
4433 + if (!nskb)
4434 + return;
4435 +
4436 +@@ -81,7 +81,7 @@ static void nft_reject_br_send_v6_tcp_reset(struct net *net,
4437 + {
4438 + struct sk_buff *nskb;
4439 +
4440 +- nskb = nf_reject_skb_v6_tcp_reset(net, oldskb, dev, hook);
4441 ++ nskb = nf_reject_skb_v6_tcp_reset(net, oldskb, NULL, hook);
4442 + if (!nskb)
4443 + return;
4444 +
4445 +@@ -98,7 +98,7 @@ static void nft_reject_br_send_v6_unreach(struct net *net,
4446 + {
4447 + struct sk_buff *nskb;
4448 +
4449 +- nskb = nf_reject_skb_v6_unreach(net, oldskb, dev, hook, code);
4450 ++ nskb = nf_reject_skb_v6_unreach(net, oldskb, NULL, hook, code);
4451 + if (!nskb)
4452 + return;
4453 +
4454 +diff --git a/net/core/neighbour.c b/net/core/neighbour.c
4455 +index dda12fbd177ba..63a1142d85685 100644
4456 +--- a/net/core/neighbour.c
4457 ++++ b/net/core/neighbour.c
4458 +@@ -1133,7 +1133,8 @@ out:
4459 + neigh_release(neigh);
4460 + }
4461 +
4462 +-int __neigh_event_send(struct neighbour *neigh, struct sk_buff *skb)
4463 ++int __neigh_event_send(struct neighbour *neigh, struct sk_buff *skb,
4464 ++ const bool immediate_ok)
4465 + {
4466 + int rc;
4467 + bool immediate_probe = false;
4468 +@@ -1154,12 +1155,17 @@ int __neigh_event_send(struct neighbour *neigh, struct sk_buff *skb)
4469 + atomic_set(&neigh->probes,
4470 + NEIGH_VAR(neigh->parms, UCAST_PROBES));
4471 + neigh_del_timer(neigh);
4472 +- neigh->nud_state = NUD_INCOMPLETE;
4473 ++ neigh->nud_state = NUD_INCOMPLETE;
4474 + neigh->updated = now;
4475 +- next = now + max(NEIGH_VAR(neigh->parms, RETRANS_TIME),
4476 +- HZ/100);
4477 ++ if (!immediate_ok) {
4478 ++ next = now + 1;
4479 ++ } else {
4480 ++ immediate_probe = true;
4481 ++ next = now + max(NEIGH_VAR(neigh->parms,
4482 ++ RETRANS_TIME),
4483 ++ HZ / 100);
4484 ++ }
4485 + neigh_add_timer(neigh, next);
4486 +- immediate_probe = true;
4487 + } else {
4488 + neigh->nud_state = NUD_FAILED;
4489 + neigh->updated = jiffies;
4490 +@@ -1571,7 +1577,7 @@ static void neigh_managed_work(struct work_struct *work)
4491 +
4492 + write_lock_bh(&tbl->lock);
4493 + list_for_each_entry(neigh, &tbl->managed_list, managed_list)
4494 +- neigh_event_send(neigh, NULL);
4495 ++ neigh_event_send_probe(neigh, NULL, false);
4496 + queue_delayed_work(system_power_efficient_wq, &tbl->managed_work,
4497 + NEIGH_VAR(&tbl->parms, DELAY_PROBE_TIME));
4498 + write_unlock_bh(&tbl->lock);
4499 +diff --git a/net/ieee802154/nl802154.c b/net/ieee802154/nl802154.c
4500 +index 277124f206e06..e0b072aecf0f3 100644
4501 +--- a/net/ieee802154/nl802154.c
4502 ++++ b/net/ieee802154/nl802154.c
4503 +@@ -1441,7 +1441,7 @@ static int nl802154_send_key(struct sk_buff *msg, u32 cmd, u32 portid,
4504 +
4505 + hdr = nl802154hdr_put(msg, portid, seq, flags, cmd);
4506 + if (!hdr)
4507 +- return -1;
4508 ++ return -ENOBUFS;
4509 +
4510 + if (nla_put_u32(msg, NL802154_ATTR_IFINDEX, dev->ifindex))
4511 + goto nla_put_failure;
4512 +@@ -1634,7 +1634,7 @@ static int nl802154_send_device(struct sk_buff *msg, u32 cmd, u32 portid,
4513 +
4514 + hdr = nl802154hdr_put(msg, portid, seq, flags, cmd);
4515 + if (!hdr)
4516 +- return -1;
4517 ++ return -ENOBUFS;
4518 +
4519 + if (nla_put_u32(msg, NL802154_ATTR_IFINDEX, dev->ifindex))
4520 + goto nla_put_failure;
4521 +@@ -1812,7 +1812,7 @@ static int nl802154_send_devkey(struct sk_buff *msg, u32 cmd, u32 portid,
4522 +
4523 + hdr = nl802154hdr_put(msg, portid, seq, flags, cmd);
4524 + if (!hdr)
4525 +- return -1;
4526 ++ return -ENOBUFS;
4527 +
4528 + if (nla_put_u32(msg, NL802154_ATTR_IFINDEX, dev->ifindex))
4529 + goto nla_put_failure;
4530 +@@ -1988,7 +1988,7 @@ static int nl802154_send_seclevel(struct sk_buff *msg, u32 cmd, u32 portid,
4531 +
4532 + hdr = nl802154hdr_put(msg, portid, seq, flags, cmd);
4533 + if (!hdr)
4534 +- return -1;
4535 ++ return -ENOBUFS;
4536 +
4537 + if (nla_put_u32(msg, NL802154_ATTR_IFINDEX, dev->ifindex))
4538 + goto nla_put_failure;
4539 +diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c
4540 +index 65764c8171b37..5d305fafd0e99 100644
4541 +--- a/net/mptcp/pm_netlink.c
4542 ++++ b/net/mptcp/pm_netlink.c
4543 +@@ -459,6 +459,18 @@ static unsigned int fill_remote_addresses_vec(struct mptcp_sock *msk, bool fullm
4544 + return i;
4545 + }
4546 +
4547 ++static struct mptcp_pm_addr_entry *
4548 ++__lookup_addr(struct pm_nl_pernet *pernet, struct mptcp_addr_info *info)
4549 ++{
4550 ++ struct mptcp_pm_addr_entry *entry;
4551 ++
4552 ++ list_for_each_entry(entry, &pernet->local_addr_list, list) {
4553 ++ if (addresses_equal(&entry->addr, info, true))
4554 ++ return entry;
4555 ++ }
4556 ++ return NULL;
4557 ++}
4558 ++
4559 + static void mptcp_pm_create_subflow_or_signal_addr(struct mptcp_sock *msk)
4560 + {
4561 + struct sock *sk = (struct sock *)msk;
4562 +@@ -1725,17 +1737,21 @@ static int mptcp_nl_cmd_set_flags(struct sk_buff *skb, struct genl_info *info)
4563 + if (addr.flags & MPTCP_PM_ADDR_FLAG_BACKUP)
4564 + bkup = 1;
4565 +
4566 +- list_for_each_entry(entry, &pernet->local_addr_list, list) {
4567 +- if (addresses_equal(&entry->addr, &addr.addr, true)) {
4568 +- mptcp_nl_addr_backup(net, &entry->addr, bkup);
4569 +-
4570 +- if (bkup)
4571 +- entry->flags |= MPTCP_PM_ADDR_FLAG_BACKUP;
4572 +- else
4573 +- entry->flags &= ~MPTCP_PM_ADDR_FLAG_BACKUP;
4574 +- }
4575 ++ spin_lock_bh(&pernet->lock);
4576 ++ entry = __lookup_addr(pernet, &addr.addr);
4577 ++ if (!entry) {
4578 ++ spin_unlock_bh(&pernet->lock);
4579 ++ return -EINVAL;
4580 + }
4581 +
4582 ++ if (bkup)
4583 ++ entry->flags |= MPTCP_PM_ADDR_FLAG_BACKUP;
4584 ++ else
4585 ++ entry->flags &= ~MPTCP_PM_ADDR_FLAG_BACKUP;
4586 ++ addr = *entry;
4587 ++ spin_unlock_bh(&pernet->lock);
4588 ++
4589 ++ mptcp_nl_addr_backup(net, &addr.addr, bkup);
4590 + return 0;
4591 + }
4592 +
4593 +diff --git a/net/smc/af_smc.c b/net/smc/af_smc.c
4594 +index 85e077a69c67d..0f5c305c55c5a 100644
4595 +--- a/net/smc/af_smc.c
4596 ++++ b/net/smc/af_smc.c
4597 +@@ -566,17 +566,115 @@ static void smc_stat_fallback(struct smc_sock *smc)
4598 + mutex_unlock(&net->smc.mutex_fback_rsn);
4599 + }
4600 +
4601 ++/* must be called under rcu read lock */
4602 ++static void smc_fback_wakeup_waitqueue(struct smc_sock *smc, void *key)
4603 ++{
4604 ++ struct socket_wq *wq;
4605 ++ __poll_t flags;
4606 ++
4607 ++ wq = rcu_dereference(smc->sk.sk_wq);
4608 ++ if (!skwq_has_sleeper(wq))
4609 ++ return;
4610 ++
4611 ++ /* wake up smc sk->sk_wq */
4612 ++ if (!key) {
4613 ++ /* sk_state_change */
4614 ++ wake_up_interruptible_all(&wq->wait);
4615 ++ } else {
4616 ++ flags = key_to_poll(key);
4617 ++ if (flags & (EPOLLIN | EPOLLOUT))
4618 ++ /* sk_data_ready or sk_write_space */
4619 ++ wake_up_interruptible_sync_poll(&wq->wait, flags);
4620 ++ else if (flags & EPOLLERR)
4621 ++ /* sk_error_report */
4622 ++ wake_up_interruptible_poll(&wq->wait, flags);
4623 ++ }
4624 ++}
4625 ++
4626 ++static int smc_fback_mark_woken(wait_queue_entry_t *wait,
4627 ++ unsigned int mode, int sync, void *key)
4628 ++{
4629 ++ struct smc_mark_woken *mark =
4630 ++ container_of(wait, struct smc_mark_woken, wait_entry);
4631 ++
4632 ++ mark->woken = true;
4633 ++ mark->key = key;
4634 ++ return 0;
4635 ++}
4636 ++
4637 ++static void smc_fback_forward_wakeup(struct smc_sock *smc, struct sock *clcsk,
4638 ++ void (*clcsock_callback)(struct sock *sk))
4639 ++{
4640 ++ struct smc_mark_woken mark = { .woken = false };
4641 ++ struct socket_wq *wq;
4642 ++
4643 ++ init_waitqueue_func_entry(&mark.wait_entry,
4644 ++ smc_fback_mark_woken);
4645 ++ rcu_read_lock();
4646 ++ wq = rcu_dereference(clcsk->sk_wq);
4647 ++ if (!wq)
4648 ++ goto out;
4649 ++ add_wait_queue(sk_sleep(clcsk), &mark.wait_entry);
4650 ++ clcsock_callback(clcsk);
4651 ++ remove_wait_queue(sk_sleep(clcsk), &mark.wait_entry);
4652 ++
4653 ++ if (mark.woken)
4654 ++ smc_fback_wakeup_waitqueue(smc, mark.key);
4655 ++out:
4656 ++ rcu_read_unlock();
4657 ++}
4658 ++
4659 ++static void smc_fback_state_change(struct sock *clcsk)
4660 ++{
4661 ++ struct smc_sock *smc =
4662 ++ smc_clcsock_user_data(clcsk);
4663 ++
4664 ++ if (!smc)
4665 ++ return;
4666 ++ smc_fback_forward_wakeup(smc, clcsk, smc->clcsk_state_change);
4667 ++}
4668 ++
4669 ++static void smc_fback_data_ready(struct sock *clcsk)
4670 ++{
4671 ++ struct smc_sock *smc =
4672 ++ smc_clcsock_user_data(clcsk);
4673 ++
4674 ++ if (!smc)
4675 ++ return;
4676 ++ smc_fback_forward_wakeup(smc, clcsk, smc->clcsk_data_ready);
4677 ++}
4678 ++
4679 ++static void smc_fback_write_space(struct sock *clcsk)
4680 ++{
4681 ++ struct smc_sock *smc =
4682 ++ smc_clcsock_user_data(clcsk);
4683 ++
4684 ++ if (!smc)
4685 ++ return;
4686 ++ smc_fback_forward_wakeup(smc, clcsk, smc->clcsk_write_space);
4687 ++}
4688 ++
4689 ++static void smc_fback_error_report(struct sock *clcsk)
4690 ++{
4691 ++ struct smc_sock *smc =
4692 ++ smc_clcsock_user_data(clcsk);
4693 ++
4694 ++ if (!smc)
4695 ++ return;
4696 ++ smc_fback_forward_wakeup(smc, clcsk, smc->clcsk_error_report);
4697 ++}
4698 ++
4699 + static int smc_switch_to_fallback(struct smc_sock *smc, int reason_code)
4700 + {
4701 +- wait_queue_head_t *smc_wait = sk_sleep(&smc->sk);
4702 +- wait_queue_head_t *clc_wait;
4703 +- unsigned long flags;
4704 ++ struct sock *clcsk;
4705 +
4706 + mutex_lock(&smc->clcsock_release_lock);
4707 + if (!smc->clcsock) {
4708 + mutex_unlock(&smc->clcsock_release_lock);
4709 + return -EBADF;
4710 + }
4711 ++ clcsk = smc->clcsock->sk;
4712 ++
4713 + smc->use_fallback = true;
4714 + smc->fallback_rsn = reason_code;
4715 + smc_stat_fallback(smc);
4716 +@@ -587,16 +685,22 @@ static int smc_switch_to_fallback(struct smc_sock *smc, int reason_code)
4717 + smc->clcsock->wq.fasync_list =
4718 + smc->sk.sk_socket->wq.fasync_list;
4719 +
4720 +- /* There may be some entries remaining in
4721 +- * smc socket->wq, which should be removed
4722 +- * to clcsocket->wq during the fallback.
4723 ++ /* There might be some wait entries remaining
4724 ++ * in smc sk->sk_wq and they should be woken up
4725 ++ * as clcsock's wait queue is woken up.
4726 + */
4727 +- clc_wait = sk_sleep(smc->clcsock->sk);
4728 +- spin_lock_irqsave(&smc_wait->lock, flags);
4729 +- spin_lock_nested(&clc_wait->lock, SINGLE_DEPTH_NESTING);
4730 +- list_splice_init(&smc_wait->head, &clc_wait->head);
4731 +- spin_unlock(&clc_wait->lock);
4732 +- spin_unlock_irqrestore(&smc_wait->lock, flags);
4733 ++ smc->clcsk_state_change = clcsk->sk_state_change;
4734 ++ smc->clcsk_data_ready = clcsk->sk_data_ready;
4735 ++ smc->clcsk_write_space = clcsk->sk_write_space;
4736 ++ smc->clcsk_error_report = clcsk->sk_error_report;
4737 ++
4738 ++ clcsk->sk_state_change = smc_fback_state_change;
4739 ++ clcsk->sk_data_ready = smc_fback_data_ready;
4740 ++ clcsk->sk_write_space = smc_fback_write_space;
4741 ++ clcsk->sk_error_report = smc_fback_error_report;
4742 ++
4743 ++ smc->clcsock->sk->sk_user_data =
4744 ++ (void *)((uintptr_t)smc | SK_USER_DATA_NOCOPY);
4745 + }
4746 + mutex_unlock(&smc->clcsock_release_lock);
4747 + return 0;
4748 +@@ -2111,10 +2215,9 @@ out:
4749 +
4750 + static void smc_clcsock_data_ready(struct sock *listen_clcsock)
4751 + {
4752 +- struct smc_sock *lsmc;
4753 ++ struct smc_sock *lsmc =
4754 ++ smc_clcsock_user_data(listen_clcsock);
4755 +
4756 +- lsmc = (struct smc_sock *)
4757 +- ((uintptr_t)listen_clcsock->sk_user_data & ~SK_USER_DATA_NOCOPY);
4758 + if (!lsmc)
4759 + return;
4760 + lsmc->clcsk_data_ready(listen_clcsock);
4761 +diff --git a/net/smc/smc.h b/net/smc/smc.h
4762 +index 1a4fc1c6c4ab6..b2e1d9e03dcf6 100644
4763 +--- a/net/smc/smc.h
4764 ++++ b/net/smc/smc.h
4765 +@@ -139,6 +139,12 @@ enum smc_urg_state {
4766 + SMC_URG_READ = 3, /* data was already read */
4767 + };
4768 +
4769 ++struct smc_mark_woken {
4770 ++ bool woken;
4771 ++ void *key;
4772 ++ wait_queue_entry_t wait_entry;
4773 ++};
4774 ++
4775 + struct smc_connection {
4776 + struct rb_node alert_node;
4777 + struct smc_link_group *lgr; /* link group of connection */
4778 +@@ -227,8 +233,14 @@ struct smc_connection {
4779 + struct smc_sock { /* smc sock container */
4780 + struct sock sk;
4781 + struct socket *clcsock; /* internal tcp socket */
4782 ++ void (*clcsk_state_change)(struct sock *sk);
4783 ++ /* original stat_change fct. */
4784 + void (*clcsk_data_ready)(struct sock *sk);
4785 +- /* original data_ready fct. **/
4786 ++ /* original data_ready fct. */
4787 ++ void (*clcsk_write_space)(struct sock *sk);
4788 ++ /* original write_space fct. */
4789 ++ void (*clcsk_error_report)(struct sock *sk);
4790 ++ /* original error_report fct. */
4791 + struct smc_connection conn; /* smc connection */
4792 + struct smc_sock *listen_smc; /* listen parent */
4793 + struct work_struct connect_work; /* handle non-blocking connect*/
4794 +@@ -263,6 +275,12 @@ static inline struct smc_sock *smc_sk(const struct sock *sk)
4795 + return (struct smc_sock *)sk;
4796 + }
4797 +
4798 ++static inline struct smc_sock *smc_clcsock_user_data(struct sock *clcsk)
4799 ++{
4800 ++ return (struct smc_sock *)
4801 ++ ((uintptr_t)clcsk->sk_user_data & ~SK_USER_DATA_NOCOPY);
4802 ++}
4803 ++
4804 + extern struct workqueue_struct *smc_hs_wq; /* wq for handshake work */
4805 + extern struct workqueue_struct *smc_close_wq; /* wq for close work */
4806 +
4807 +diff --git a/security/selinux/ss/conditional.c b/security/selinux/ss/conditional.c
4808 +index 2ec6e5cd25d9b..feb206f3acb4a 100644
4809 +--- a/security/selinux/ss/conditional.c
4810 ++++ b/security/selinux/ss/conditional.c
4811 +@@ -152,6 +152,8 @@ static void cond_list_destroy(struct policydb *p)
4812 + for (i = 0; i < p->cond_list_len; i++)
4813 + cond_node_destroy(&p->cond_list[i]);
4814 + kfree(p->cond_list);
4815 ++ p->cond_list = NULL;
4816 ++ p->cond_list_len = 0;
4817 + }
4818 +
4819 + void cond_policydb_destroy(struct policydb *p)
4820 +@@ -441,7 +443,6 @@ int cond_read_list(struct policydb *p, void *fp)
4821 + return 0;
4822 + err:
4823 + cond_list_destroy(p);
4824 +- p->cond_list = NULL;
4825 + return rc;
4826 + }
4827 +
4828 +diff --git a/sound/pci/hda/hda_auto_parser.c b/sound/pci/hda/hda_auto_parser.c
4829 +index 4a854475a0e60..500d0d474d27b 100644
4830 +--- a/sound/pci/hda/hda_auto_parser.c
4831 ++++ b/sound/pci/hda/hda_auto_parser.c
4832 +@@ -985,7 +985,7 @@ void snd_hda_pick_fixup(struct hda_codec *codec,
4833 + int id = HDA_FIXUP_ID_NOT_SET;
4834 + const char *name = NULL;
4835 + const char *type = NULL;
4836 +- int vendor, device;
4837 ++ unsigned int vendor, device;
4838 +
4839 + if (codec->fixup_id != HDA_FIXUP_ID_NOT_SET)
4840 + return;
4841 +diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
4842 +index 7016b48227bf2..f552785d301e0 100644
4843 +--- a/sound/pci/hda/hda_codec.c
4844 ++++ b/sound/pci/hda/hda_codec.c
4845 +@@ -3000,6 +3000,10 @@ void snd_hda_codec_shutdown(struct hda_codec *codec)
4846 + {
4847 + struct hda_pcm *cpcm;
4848 +
4849 ++ /* Skip the shutdown if codec is not registered */
4850 ++ if (!codec->registered)
4851 ++ return;
4852 ++
4853 + list_for_each_entry(cpcm, &codec->pcm_list_head, list)
4854 + snd_pcm_suspend_all(cpcm->pcm);
4855 +
4856 +diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c
4857 +index 3bf5e34107038..fc114e5224806 100644
4858 +--- a/sound/pci/hda/hda_generic.c
4859 ++++ b/sound/pci/hda/hda_generic.c
4860 +@@ -91,6 +91,12 @@ static void snd_hda_gen_spec_free(struct hda_gen_spec *spec)
4861 + free_kctls(spec);
4862 + snd_array_free(&spec->paths);
4863 + snd_array_free(&spec->loopback_list);
4864 ++#ifdef CONFIG_SND_HDA_GENERIC_LEDS
4865 ++ if (spec->led_cdevs[LED_AUDIO_MUTE])
4866 ++ led_classdev_unregister(spec->led_cdevs[LED_AUDIO_MUTE]);
4867 ++ if (spec->led_cdevs[LED_AUDIO_MICMUTE])
4868 ++ led_classdev_unregister(spec->led_cdevs[LED_AUDIO_MICMUTE]);
4869 ++#endif
4870 + }
4871 +
4872 + /*
4873 +@@ -3922,7 +3928,10 @@ static int create_mute_led_cdev(struct hda_codec *codec,
4874 + enum led_brightness),
4875 + bool micmute)
4876 + {
4877 ++ struct hda_gen_spec *spec = codec->spec;
4878 + struct led_classdev *cdev;
4879 ++ int idx = micmute ? LED_AUDIO_MICMUTE : LED_AUDIO_MUTE;
4880 ++ int err;
4881 +
4882 + cdev = devm_kzalloc(&codec->core.dev, sizeof(*cdev), GFP_KERNEL);
4883 + if (!cdev)
4884 +@@ -3932,10 +3941,14 @@ static int create_mute_led_cdev(struct hda_codec *codec,
4885 + cdev->max_brightness = 1;
4886 + cdev->default_trigger = micmute ? "audio-micmute" : "audio-mute";
4887 + cdev->brightness_set_blocking = callback;
4888 +- cdev->brightness = ledtrig_audio_get(micmute ? LED_AUDIO_MICMUTE : LED_AUDIO_MUTE);
4889 ++ cdev->brightness = ledtrig_audio_get(idx);
4890 + cdev->flags = LED_CORE_SUSPENDRESUME;
4891 +
4892 +- return devm_led_classdev_register(&codec->core.dev, cdev);
4893 ++ err = led_classdev_register(&codec->core.dev, cdev);
4894 ++ if (err < 0)
4895 ++ return err;
4896 ++ spec->led_cdevs[idx] = cdev;
4897 ++ return 0;
4898 + }
4899 +
4900 + /**
4901 +diff --git a/sound/pci/hda/hda_generic.h b/sound/pci/hda/hda_generic.h
4902 +index c43bd0f0338ea..362ddcaea15b3 100644
4903 +--- a/sound/pci/hda/hda_generic.h
4904 ++++ b/sound/pci/hda/hda_generic.h
4905 +@@ -294,6 +294,9 @@ struct hda_gen_spec {
4906 + struct hda_jack_callback *cb);
4907 + void (*mic_autoswitch_hook)(struct hda_codec *codec,
4908 + struct hda_jack_callback *cb);
4909 ++
4910 ++ /* leds */
4911 ++ struct led_classdev *led_cdevs[NUM_AUDIO_LEDS];
4912 + };
4913 +
4914 + /* values for add_stereo_mix_input flag */
4915 +diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
4916 +index fa80a79e9f966..18f04137f61cf 100644
4917 +--- a/sound/pci/hda/patch_realtek.c
4918 ++++ b/sound/pci/hda/patch_realtek.c
4919 +@@ -97,6 +97,7 @@ struct alc_spec {
4920 + unsigned int gpio_mic_led_mask;
4921 + struct alc_coef_led mute_led_coef;
4922 + struct alc_coef_led mic_led_coef;
4923 ++ struct mutex coef_mutex;
4924 +
4925 + hda_nid_t headset_mic_pin;
4926 + hda_nid_t headphone_mic_pin;
4927 +@@ -132,8 +133,8 @@ struct alc_spec {
4928 + * COEF access helper functions
4929 + */
4930 +
4931 +-static int alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
4932 +- unsigned int coef_idx)
4933 ++static int __alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
4934 ++ unsigned int coef_idx)
4935 + {
4936 + unsigned int val;
4937 +
4938 +@@ -142,28 +143,61 @@ static int alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
4939 + return val;
4940 + }
4941 +
4942 ++static int alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
4943 ++ unsigned int coef_idx)
4944 ++{
4945 ++ struct alc_spec *spec = codec->spec;
4946 ++ unsigned int val;
4947 ++
4948 ++ mutex_lock(&spec->coef_mutex);
4949 ++ val = __alc_read_coefex_idx(codec, nid, coef_idx);
4950 ++ mutex_unlock(&spec->coef_mutex);
4951 ++ return val;
4952 ++}
4953 ++
4954 + #define alc_read_coef_idx(codec, coef_idx) \
4955 + alc_read_coefex_idx(codec, 0x20, coef_idx)
4956 +
4957 +-static void alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
4958 +- unsigned int coef_idx, unsigned int coef_val)
4959 ++static void __alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
4960 ++ unsigned int coef_idx, unsigned int coef_val)
4961 + {
4962 + snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
4963 + snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PROC_COEF, coef_val);
4964 + }
4965 +
4966 ++static void alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
4967 ++ unsigned int coef_idx, unsigned int coef_val)
4968 ++{
4969 ++ struct alc_spec *spec = codec->spec;
4970 ++
4971 ++ mutex_lock(&spec->coef_mutex);
4972 ++ __alc_write_coefex_idx(codec, nid, coef_idx, coef_val);
4973 ++ mutex_unlock(&spec->coef_mutex);
4974 ++}
4975 ++
4976 + #define alc_write_coef_idx(codec, coef_idx, coef_val) \
4977 + alc_write_coefex_idx(codec, 0x20, coef_idx, coef_val)
4978 +
4979 ++static void __alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
4980 ++ unsigned int coef_idx, unsigned int mask,
4981 ++ unsigned int bits_set)
4982 ++{
4983 ++ unsigned int val = __alc_read_coefex_idx(codec, nid, coef_idx);
4984 ++
4985 ++ if (val != -1)
4986 ++ __alc_write_coefex_idx(codec, nid, coef_idx,
4987 ++ (val & ~mask) | bits_set);
4988 ++}
4989 ++
4990 + static void alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
4991 + unsigned int coef_idx, unsigned int mask,
4992 + unsigned int bits_set)
4993 + {
4994 +- unsigned int val = alc_read_coefex_idx(codec, nid, coef_idx);
4995 ++ struct alc_spec *spec = codec->spec;
4996 +
4997 +- if (val != -1)
4998 +- alc_write_coefex_idx(codec, nid, coef_idx,
4999 +- (val & ~mask) | bits_set);
5000 ++ mutex_lock(&spec->coef_mutex);
5001 ++ __alc_update_coefex_idx(codec, nid, coef_idx, mask, bits_set);
5002 ++ mutex_unlock(&spec->coef_mutex);
5003 + }
5004 +
5005 + #define alc_update_coef_idx(codec, coef_idx, mask, bits_set) \
5006 +@@ -196,13 +230,17 @@ struct coef_fw {
5007 + static void alc_process_coef_fw(struct hda_codec *codec,
5008 + const struct coef_fw *fw)
5009 + {
5010 ++ struct alc_spec *spec = codec->spec;
5011 ++
5012 ++ mutex_lock(&spec->coef_mutex);
5013 + for (; fw->nid; fw++) {
5014 + if (fw->mask == (unsigned short)-1)
5015 +- alc_write_coefex_idx(codec, fw->nid, fw->idx, fw->val);
5016 ++ __alc_write_coefex_idx(codec, fw->nid, fw->idx, fw->val);
5017 + else
5018 +- alc_update_coefex_idx(codec, fw->nid, fw->idx,
5019 +- fw->mask, fw->val);
5020 ++ __alc_update_coefex_idx(codec, fw->nid, fw->idx,
5021 ++ fw->mask, fw->val);
5022 + }
5023 ++ mutex_unlock(&spec->coef_mutex);
5024 + }
5025 +
5026 + /*
5027 +@@ -1148,6 +1186,7 @@ static int alc_alloc_spec(struct hda_codec *codec, hda_nid_t mixer_nid)
5028 + codec->spdif_status_reset = 1;
5029 + codec->forced_resume = 1;
5030 + codec->patch_ops = alc_patch_ops;
5031 ++ mutex_init(&spec->coef_mutex);
5032 +
5033 + err = alc_codec_rename_from_preset(codec);
5034 + if (err < 0) {
5035 +@@ -2120,6 +2159,7 @@ static void alc1220_fixup_gb_x570(struct hda_codec *codec,
5036 + {
5037 + static const hda_nid_t conn1[] = { 0x0c };
5038 + static const struct coef_fw gb_x570_coefs[] = {
5039 ++ WRITE_COEF(0x07, 0x03c0),
5040 + WRITE_COEF(0x1a, 0x01c1),
5041 + WRITE_COEF(0x1b, 0x0202),
5042 + WRITE_COEF(0x43, 0x3005),
5043 +@@ -2546,7 +2586,8 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = {
5044 + SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", ALC889_FIXUP_FRONT_HP_NO_PRESENCE),
5045 + SND_PCI_QUIRK(0x1458, 0xa0b8, "Gigabyte AZ370-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
5046 + SND_PCI_QUIRK(0x1458, 0xa0cd, "Gigabyte X570 Aorus Master", ALC1220_FIXUP_GB_X570),
5047 +- SND_PCI_QUIRK(0x1458, 0xa0ce, "Gigabyte X570 Aorus Xtreme", ALC1220_FIXUP_CLEVO_P950),
5048 ++ SND_PCI_QUIRK(0x1458, 0xa0ce, "Gigabyte X570 Aorus Xtreme", ALC1220_FIXUP_GB_X570),
5049 ++ SND_PCI_QUIRK(0x1458, 0xa0d5, "Gigabyte X570S Aorus Master", ALC1220_FIXUP_GB_X570),
5050 + SND_PCI_QUIRK(0x1462, 0x11f7, "MSI-GE63", ALC1220_FIXUP_CLEVO_P950),
5051 + SND_PCI_QUIRK(0x1462, 0x1228, "MSI-GP63", ALC1220_FIXUP_CLEVO_P950),
5052 + SND_PCI_QUIRK(0x1462, 0x1229, "MSI-GP73", ALC1220_FIXUP_CLEVO_P950),
5053 +@@ -2621,6 +2662,7 @@ static const struct hda_model_fixup alc882_fixup_models[] = {
5054 + {.id = ALC882_FIXUP_NO_PRIMARY_HP, .name = "no-primary-hp"},
5055 + {.id = ALC887_FIXUP_ASUS_BASS, .name = "asus-bass"},
5056 + {.id = ALC1220_FIXUP_GB_DUAL_CODECS, .name = "dual-codecs"},
5057 ++ {.id = ALC1220_FIXUP_GB_X570, .name = "gb-x570"},
5058 + {.id = ALC1220_FIXUP_CLEVO_P950, .name = "clevo-p950"},
5059 + {}
5060 + };
5061 +@@ -8815,6 +8857,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
5062 + SND_PCI_QUIRK(0x1043, 0x1e51, "ASUS Zephyrus M15", ALC294_FIXUP_ASUS_GU502_PINS),
5063 + SND_PCI_QUIRK(0x1043, 0x1e8e, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA401),
5064 + SND_PCI_QUIRK(0x1043, 0x1f11, "ASUS Zephyrus G14", ALC289_FIXUP_ASUS_GA401),
5065 ++ SND_PCI_QUIRK(0x1043, 0x16b2, "ASUS GU603", ALC289_FIXUP_ASUS_GA401),
5066 + SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2),
5067 + SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC),
5068 + SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC),
5069 +diff --git a/sound/soc/codecs/cpcap.c b/sound/soc/codecs/cpcap.c
5070 +index 598e09024e239..ffdf8b615efaa 100644
5071 +--- a/sound/soc/codecs/cpcap.c
5072 ++++ b/sound/soc/codecs/cpcap.c
5073 +@@ -1667,6 +1667,8 @@ static int cpcap_codec_probe(struct platform_device *pdev)
5074 + {
5075 + struct device_node *codec_node =
5076 + of_get_child_by_name(pdev->dev.parent->of_node, "audio-codec");
5077 ++ if (!codec_node)
5078 ++ return -ENODEV;
5079 +
5080 + pdev->dev.of_node = codec_node;
5081 +
5082 +diff --git a/sound/soc/codecs/hdmi-codec.c b/sound/soc/codecs/hdmi-codec.c
5083 +index b61f980cabdc0..b07607a9ecea4 100644
5084 +--- a/sound/soc/codecs/hdmi-codec.c
5085 ++++ b/sound/soc/codecs/hdmi-codec.c
5086 +@@ -277,7 +277,7 @@ struct hdmi_codec_priv {
5087 + bool busy;
5088 + struct snd_soc_jack *jack;
5089 + unsigned int jack_status;
5090 +- u8 iec_status[5];
5091 ++ u8 iec_status[AES_IEC958_STATUS_SIZE];
5092 + };
5093 +
5094 + static const struct snd_soc_dapm_widget hdmi_widgets[] = {
5095 +diff --git a/sound/soc/codecs/lpass-rx-macro.c b/sound/soc/codecs/lpass-rx-macro.c
5096 +index aec5127260fd4..6ffe88345de5f 100644
5097 +--- a/sound/soc/codecs/lpass-rx-macro.c
5098 ++++ b/sound/soc/codecs/lpass-rx-macro.c
5099 +@@ -2688,8 +2688,8 @@ static uint32_t get_iir_band_coeff(struct snd_soc_component *component,
5100 + int reg, b2_reg;
5101 +
5102 + /* Address does not automatically update if reading */
5103 +- reg = CDC_RX_SIDETONE_IIR0_IIR_COEF_B1_CTL + 16 * iir_idx;
5104 +- b2_reg = CDC_RX_SIDETONE_IIR0_IIR_COEF_B2_CTL + 16 * iir_idx;
5105 ++ reg = CDC_RX_SIDETONE_IIR0_IIR_COEF_B1_CTL + 0x80 * iir_idx;
5106 ++ b2_reg = CDC_RX_SIDETONE_IIR0_IIR_COEF_B2_CTL + 0x80 * iir_idx;
5107 +
5108 + snd_soc_component_write(component, reg,
5109 + ((band_idx * BAND_MAX + coeff_idx) *
5110 +@@ -2718,7 +2718,7 @@ static uint32_t get_iir_band_coeff(struct snd_soc_component *component,
5111 + static void set_iir_band_coeff(struct snd_soc_component *component,
5112 + int iir_idx, int band_idx, uint32_t value)
5113 + {
5114 +- int reg = CDC_RX_SIDETONE_IIR0_IIR_COEF_B2_CTL + 16 * iir_idx;
5115 ++ int reg = CDC_RX_SIDETONE_IIR0_IIR_COEF_B2_CTL + 0x80 * iir_idx;
5116 +
5117 + snd_soc_component_write(component, reg, (value & 0xFF));
5118 + snd_soc_component_write(component, reg, (value >> 8) & 0xFF);
5119 +@@ -2739,7 +2739,7 @@ static int rx_macro_put_iir_band_audio_mixer(
5120 + int iir_idx = ctl->iir_idx;
5121 + int band_idx = ctl->band_idx;
5122 + u32 coeff[BAND_MAX];
5123 +- int reg = CDC_RX_SIDETONE_IIR0_IIR_COEF_B1_CTL + 16 * iir_idx;
5124 ++ int reg = CDC_RX_SIDETONE_IIR0_IIR_COEF_B1_CTL + 0x80 * iir_idx;
5125 +
5126 + memcpy(&coeff[0], ucontrol->value.bytes.data, params->max);
5127 +
5128 +diff --git a/sound/soc/codecs/max9759.c b/sound/soc/codecs/max9759.c
5129 +index 00e9d4fd1651f..0c261335c8a16 100644
5130 +--- a/sound/soc/codecs/max9759.c
5131 ++++ b/sound/soc/codecs/max9759.c
5132 +@@ -64,7 +64,8 @@ static int speaker_gain_control_put(struct snd_kcontrol *kcontrol,
5133 + struct snd_soc_component *c = snd_soc_kcontrol_component(kcontrol);
5134 + struct max9759 *priv = snd_soc_component_get_drvdata(c);
5135 +
5136 +- if (ucontrol->value.integer.value[0] > 3)
5137 ++ if (ucontrol->value.integer.value[0] < 0 ||
5138 ++ ucontrol->value.integer.value[0] > 3)
5139 + return -EINVAL;
5140 +
5141 + priv->gain = ucontrol->value.integer.value[0];
5142 +diff --git a/sound/soc/codecs/rt5682-i2c.c b/sound/soc/codecs/rt5682-i2c.c
5143 +index 20e0f90ea4986..20fc0f3766ded 100644
5144 +--- a/sound/soc/codecs/rt5682-i2c.c
5145 ++++ b/sound/soc/codecs/rt5682-i2c.c
5146 +@@ -59,18 +59,12 @@ static void rt5682_jd_check_handler(struct work_struct *work)
5147 + struct rt5682_priv *rt5682 = container_of(work, struct rt5682_priv,
5148 + jd_check_work.work);
5149 +
5150 +- if (snd_soc_component_read(rt5682->component, RT5682_AJD1_CTRL)
5151 +- & RT5682_JDH_RS_MASK) {
5152 ++ if (snd_soc_component_read(rt5682->component, RT5682_AJD1_CTRL) & RT5682_JDH_RS_MASK)
5153 + /* jack out */
5154 +- rt5682->jack_type = rt5682_headset_detect(rt5682->component, 0);
5155 +-
5156 +- snd_soc_jack_report(rt5682->hs_jack, rt5682->jack_type,
5157 +- SND_JACK_HEADSET |
5158 +- SND_JACK_BTN_0 | SND_JACK_BTN_1 |
5159 +- SND_JACK_BTN_2 | SND_JACK_BTN_3);
5160 +- } else {
5161 ++ mod_delayed_work(system_power_efficient_wq,
5162 ++ &rt5682->jack_detect_work, 0);
5163 ++ else
5164 + schedule_delayed_work(&rt5682->jd_check_work, 500);
5165 +- }
5166 + }
5167 +
5168 + static irqreturn_t rt5682_irq(int irq, void *data)
5169 +@@ -198,7 +192,6 @@ static int rt5682_i2c_probe(struct i2c_client *i2c,
5170 + }
5171 +
5172 + mutex_init(&rt5682->calibrate_mutex);
5173 +- mutex_init(&rt5682->jdet_mutex);
5174 + rt5682_calibrate(rt5682);
5175 +
5176 + rt5682_apply_patch_list(rt5682, &i2c->dev);
5177 +diff --git a/sound/soc/codecs/rt5682.c b/sound/soc/codecs/rt5682.c
5178 +index b34a8542077dc..7e6e2f26accd0 100644
5179 +--- a/sound/soc/codecs/rt5682.c
5180 ++++ b/sound/soc/codecs/rt5682.c
5181 +@@ -922,15 +922,13 @@ static void rt5682_enable_push_button_irq(struct snd_soc_component *component,
5182 + *
5183 + * Returns detect status.
5184 + */
5185 +-int rt5682_headset_detect(struct snd_soc_component *component, int jack_insert)
5186 ++static int rt5682_headset_detect(struct snd_soc_component *component, int jack_insert)
5187 + {
5188 + struct rt5682_priv *rt5682 = snd_soc_component_get_drvdata(component);
5189 + struct snd_soc_dapm_context *dapm = &component->dapm;
5190 + unsigned int val, count;
5191 +
5192 + if (jack_insert) {
5193 +- snd_soc_dapm_mutex_lock(dapm);
5194 +-
5195 + snd_soc_component_update_bits(component, RT5682_PWR_ANLG_1,
5196 + RT5682_PWR_VREF2 | RT5682_PWR_MB,
5197 + RT5682_PWR_VREF2 | RT5682_PWR_MB);
5198 +@@ -981,8 +979,6 @@ int rt5682_headset_detect(struct snd_soc_component *component, int jack_insert)
5199 + snd_soc_component_update_bits(component, RT5682_MICBIAS_2,
5200 + RT5682_PWR_CLK25M_MASK | RT5682_PWR_CLK1M_MASK,
5201 + RT5682_PWR_CLK25M_PU | RT5682_PWR_CLK1M_PU);
5202 +-
5203 +- snd_soc_dapm_mutex_unlock(dapm);
5204 + } else {
5205 + rt5682_enable_push_button_irq(component, false);
5206 + snd_soc_component_update_bits(component, RT5682_CBJ_CTRL_1,
5207 +@@ -1011,7 +1007,6 @@ int rt5682_headset_detect(struct snd_soc_component *component, int jack_insert)
5208 + dev_dbg(component->dev, "jack_type = %d\n", rt5682->jack_type);
5209 + return rt5682->jack_type;
5210 + }
5211 +-EXPORT_SYMBOL_GPL(rt5682_headset_detect);
5212 +
5213 + static int rt5682_set_jack_detect(struct snd_soc_component *component,
5214 + struct snd_soc_jack *hs_jack, void *data)
5215 +@@ -1094,6 +1089,7 @@ void rt5682_jack_detect_handler(struct work_struct *work)
5216 + {
5217 + struct rt5682_priv *rt5682 =
5218 + container_of(work, struct rt5682_priv, jack_detect_work.work);
5219 ++ struct snd_soc_dapm_context *dapm;
5220 + int val, btn_type;
5221 +
5222 + while (!rt5682->component)
5223 +@@ -1102,7 +1098,9 @@ void rt5682_jack_detect_handler(struct work_struct *work)
5224 + while (!rt5682->component->card->instantiated)
5225 + usleep_range(10000, 15000);
5226 +
5227 +- mutex_lock(&rt5682->jdet_mutex);
5228 ++ dapm = snd_soc_component_get_dapm(rt5682->component);
5229 ++
5230 ++ snd_soc_dapm_mutex_lock(dapm);
5231 + mutex_lock(&rt5682->calibrate_mutex);
5232 +
5233 + val = snd_soc_component_read(rt5682->component, RT5682_AJD1_CTRL)
5234 +@@ -1162,6 +1160,9 @@ void rt5682_jack_detect_handler(struct work_struct *work)
5235 + rt5682->irq_work_delay_time = 50;
5236 + }
5237 +
5238 ++ mutex_unlock(&rt5682->calibrate_mutex);
5239 ++ snd_soc_dapm_mutex_unlock(dapm);
5240 ++
5241 + snd_soc_jack_report(rt5682->hs_jack, rt5682->jack_type,
5242 + SND_JACK_HEADSET |
5243 + SND_JACK_BTN_0 | SND_JACK_BTN_1 |
5244 +@@ -1174,9 +1175,6 @@ void rt5682_jack_detect_handler(struct work_struct *work)
5245 + else
5246 + cancel_delayed_work_sync(&rt5682->jd_check_work);
5247 + }
5248 +-
5249 +- mutex_unlock(&rt5682->calibrate_mutex);
5250 +- mutex_unlock(&rt5682->jdet_mutex);
5251 + }
5252 + EXPORT_SYMBOL_GPL(rt5682_jack_detect_handler);
5253 +
5254 +@@ -1526,7 +1524,6 @@ static int rt5682_hp_event(struct snd_soc_dapm_widget *w,
5255 + {
5256 + struct snd_soc_component *component =
5257 + snd_soc_dapm_to_component(w->dapm);
5258 +- struct rt5682_priv *rt5682 = snd_soc_component_get_drvdata(component);
5259 +
5260 + switch (event) {
5261 + case SND_SOC_DAPM_PRE_PMU:
5262 +@@ -1538,17 +1535,12 @@ static int rt5682_hp_event(struct snd_soc_dapm_widget *w,
5263 + RT5682_DEPOP_1, 0x60, 0x60);
5264 + snd_soc_component_update_bits(component,
5265 + RT5682_DAC_ADC_DIG_VOL1, 0x00c0, 0x0080);
5266 +-
5267 +- mutex_lock(&rt5682->jdet_mutex);
5268 +-
5269 + snd_soc_component_update_bits(component, RT5682_HP_CTRL_2,
5270 + RT5682_HP_C2_DAC_L_EN | RT5682_HP_C2_DAC_R_EN,
5271 + RT5682_HP_C2_DAC_L_EN | RT5682_HP_C2_DAC_R_EN);
5272 + usleep_range(5000, 10000);
5273 + snd_soc_component_update_bits(component, RT5682_CHARGE_PUMP_1,
5274 + RT5682_CP_SW_SIZE_MASK, RT5682_CP_SW_SIZE_L);
5275 +-
5276 +- mutex_unlock(&rt5682->jdet_mutex);
5277 + break;
5278 +
5279 + case SND_SOC_DAPM_POST_PMD:
5280 +diff --git a/sound/soc/codecs/rt5682.h b/sound/soc/codecs/rt5682.h
5281 +index c917c76200ea2..52ff0d9c36c58 100644
5282 +--- a/sound/soc/codecs/rt5682.h
5283 ++++ b/sound/soc/codecs/rt5682.h
5284 +@@ -1463,7 +1463,6 @@ struct rt5682_priv {
5285 +
5286 + int jack_type;
5287 + int irq_work_delay_time;
5288 +- struct mutex jdet_mutex;
5289 + };
5290 +
5291 + extern const char *rt5682_supply_names[RT5682_NUM_SUPPLIES];
5292 +@@ -1473,7 +1472,6 @@ int rt5682_sel_asrc_clk_src(struct snd_soc_component *component,
5293 +
5294 + void rt5682_apply_patch_list(struct rt5682_priv *rt5682, struct device *dev);
5295 +
5296 +-int rt5682_headset_detect(struct snd_soc_component *component, int jack_insert);
5297 + void rt5682_jack_detect_handler(struct work_struct *work);
5298 +
5299 + bool rt5682_volatile_register(struct device *dev, unsigned int reg);
5300 +diff --git a/sound/soc/codecs/wcd938x.c b/sound/soc/codecs/wcd938x.c
5301 +index 67151c7770c65..bbc261ab2025b 100644
5302 +--- a/sound/soc/codecs/wcd938x.c
5303 ++++ b/sound/soc/codecs/wcd938x.c
5304 +@@ -1432,14 +1432,10 @@ static int wcd938x_sdw_connect_port(struct wcd938x_sdw_ch_info *ch_info,
5305 + return 0;
5306 + }
5307 +
5308 +-static int wcd938x_connect_port(struct wcd938x_sdw_priv *wcd, u8 ch_id, u8 enable)
5309 ++static int wcd938x_connect_port(struct wcd938x_sdw_priv *wcd, u8 port_num, u8 ch_id, u8 enable)
5310 + {
5311 +- u8 port_num;
5312 +-
5313 +- port_num = wcd->ch_info[ch_id].port_num;
5314 +-
5315 + return wcd938x_sdw_connect_port(&wcd->ch_info[ch_id],
5316 +- &wcd->port_config[port_num],
5317 ++ &wcd->port_config[port_num - 1],
5318 + enable);
5319 + }
5320 +
5321 +@@ -2563,7 +2559,7 @@ static int wcd938x_ear_pa_put_gain(struct snd_kcontrol *kcontrol,
5322 + WCD938X_EAR_GAIN_MASK,
5323 + ucontrol->value.integer.value[0]);
5324 +
5325 +- return 0;
5326 ++ return 1;
5327 + }
5328 +
5329 + static int wcd938x_get_compander(struct snd_kcontrol *kcontrol,
5330 +@@ -2593,6 +2589,7 @@ static int wcd938x_set_compander(struct snd_kcontrol *kcontrol,
5331 + struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component);
5332 + struct wcd938x_sdw_priv *wcd;
5333 + int value = ucontrol->value.integer.value[0];
5334 ++ int portidx;
5335 + struct soc_mixer_control *mc;
5336 + bool hphr;
5337 +
5338 +@@ -2606,12 +2603,14 @@ static int wcd938x_set_compander(struct snd_kcontrol *kcontrol,
5339 + else
5340 + wcd938x->comp1_enable = value;
5341 +
5342 ++ portidx = wcd->ch_info[mc->reg].port_num;
5343 ++
5344 + if (value)
5345 +- wcd938x_connect_port(wcd, mc->reg, true);
5346 ++ wcd938x_connect_port(wcd, portidx, mc->reg, true);
5347 + else
5348 +- wcd938x_connect_port(wcd, mc->reg, false);
5349 ++ wcd938x_connect_port(wcd, portidx, mc->reg, false);
5350 +
5351 +- return 0;
5352 ++ return 1;
5353 + }
5354 +
5355 + static int wcd938x_ldoh_get(struct snd_kcontrol *kcontrol,
5356 +@@ -2882,9 +2881,11 @@ static int wcd938x_get_swr_port(struct snd_kcontrol *kcontrol,
5357 + struct wcd938x_sdw_priv *wcd;
5358 + struct soc_mixer_control *mixer = (struct soc_mixer_control *)kcontrol->private_value;
5359 + int dai_id = mixer->shift;
5360 +- int portidx = mixer->reg;
5361 ++ int portidx, ch_idx = mixer->reg;
5362 ++
5363 +
5364 + wcd = wcd938x->sdw_priv[dai_id];
5365 ++ portidx = wcd->ch_info[ch_idx].port_num;
5366 +
5367 + ucontrol->value.integer.value[0] = wcd->port_enable[portidx];
5368 +
5369 +@@ -2899,12 +2900,14 @@ static int wcd938x_set_swr_port(struct snd_kcontrol *kcontrol,
5370 + struct wcd938x_sdw_priv *wcd;
5371 + struct soc_mixer_control *mixer =
5372 + (struct soc_mixer_control *)kcontrol->private_value;
5373 +- int portidx = mixer->reg;
5374 ++ int ch_idx = mixer->reg;
5375 ++ int portidx;
5376 + int dai_id = mixer->shift;
5377 + bool enable;
5378 +
5379 + wcd = wcd938x->sdw_priv[dai_id];
5380 +
5381 ++ portidx = wcd->ch_info[ch_idx].port_num;
5382 + if (ucontrol->value.integer.value[0])
5383 + enable = true;
5384 + else
5385 +@@ -2912,9 +2915,9 @@ static int wcd938x_set_swr_port(struct snd_kcontrol *kcontrol,
5386 +
5387 + wcd->port_enable[portidx] = enable;
5388 +
5389 +- wcd938x_connect_port(wcd, portidx, enable);
5390 ++ wcd938x_connect_port(wcd, portidx, ch_idx, enable);
5391 +
5392 +- return 0;
5393 ++ return 1;
5394 +
5395 + }
5396 +
5397 +diff --git a/sound/soc/fsl/pcm030-audio-fabric.c b/sound/soc/fsl/pcm030-audio-fabric.c
5398 +index af3c3b90c0aca..83b4a22bf15ac 100644
5399 +--- a/sound/soc/fsl/pcm030-audio-fabric.c
5400 ++++ b/sound/soc/fsl/pcm030-audio-fabric.c
5401 +@@ -93,16 +93,21 @@ static int pcm030_fabric_probe(struct platform_device *op)
5402 + dev_err(&op->dev, "platform_device_alloc() failed\n");
5403 +
5404 + ret = platform_device_add(pdata->codec_device);
5405 +- if (ret)
5406 ++ if (ret) {
5407 + dev_err(&op->dev, "platform_device_add() failed: %d\n", ret);
5408 ++ platform_device_put(pdata->codec_device);
5409 ++ }
5410 +
5411 + ret = snd_soc_register_card(card);
5412 +- if (ret)
5413 ++ if (ret) {
5414 + dev_err(&op->dev, "snd_soc_register_card() failed: %d\n", ret);
5415 ++ platform_device_del(pdata->codec_device);
5416 ++ platform_device_put(pdata->codec_device);
5417 ++ }
5418 +
5419 + platform_set_drvdata(op, pdata);
5420 +-
5421 + return ret;
5422 ++
5423 + }
5424 +
5425 + static int pcm030_fabric_remove(struct platform_device *op)
5426 +diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
5427 +index a3a7990b5cb66..bc3e24c6a28a8 100644
5428 +--- a/sound/soc/generic/simple-card.c
5429 ++++ b/sound/soc/generic/simple-card.c
5430 +@@ -28,6 +28,30 @@ static const struct snd_soc_ops simple_ops = {
5431 + .hw_params = asoc_simple_hw_params,
5432 + };
5433 +
5434 ++static int asoc_simple_parse_platform(struct device_node *node,
5435 ++ struct snd_soc_dai_link_component *dlc)
5436 ++{
5437 ++ struct of_phandle_args args;
5438 ++ int ret;
5439 ++
5440 ++ if (!node)
5441 ++ return 0;
5442 ++
5443 ++ /*
5444 ++ * Get node via "sound-dai = <&phandle port>"
5445 ++ * it will be used as xxx_of_node on soc_bind_dai_link()
5446 ++ */
5447 ++ ret = of_parse_phandle_with_args(node, DAI, CELL, 0, &args);
5448 ++ if (ret)
5449 ++ return ret;
5450 ++
5451 ++ /* dai_name is not required and may not exist for plat component */
5452 ++
5453 ++ dlc->of_node = args.np;
5454 ++
5455 ++ return 0;
5456 ++}
5457 ++
5458 + static int asoc_simple_parse_dai(struct device_node *node,
5459 + struct snd_soc_dai_link_component *dlc,
5460 + int *is_single_link)
5461 +@@ -289,7 +313,7 @@ static int simple_dai_link_of(struct asoc_simple_priv *priv,
5462 + if (ret < 0)
5463 + goto dai_link_of_err;
5464 +
5465 +- ret = asoc_simple_parse_dai(plat, platforms, NULL);
5466 ++ ret = asoc_simple_parse_platform(plat, platforms);
5467 + if (ret < 0)
5468 + goto dai_link_of_err;
5469 +
5470 +diff --git a/sound/soc/qcom/qdsp6/q6apm-dai.c b/sound/soc/qcom/qdsp6/q6apm-dai.c
5471 +index eb1c3aec479ba..19c4a90ec1ea9 100644
5472 +--- a/sound/soc/qcom/qdsp6/q6apm-dai.c
5473 ++++ b/sound/soc/qcom/qdsp6/q6apm-dai.c
5474 +@@ -308,8 +308,11 @@ static int q6apm_dai_close(struct snd_soc_component *component,
5475 + struct snd_pcm_runtime *runtime = substream->runtime;
5476 + struct q6apm_dai_rtd *prtd = runtime->private_data;
5477 +
5478 +- q6apm_graph_stop(prtd->graph);
5479 +- q6apm_unmap_memory_regions(prtd->graph, substream->stream);
5480 ++ if (prtd->state) { /* only stop graph that is started */
5481 ++ q6apm_graph_stop(prtd->graph);
5482 ++ q6apm_unmap_memory_regions(prtd->graph, substream->stream);
5483 ++ }
5484 ++
5485 + q6apm_graph_close(prtd->graph);
5486 + prtd->graph = NULL;
5487 + kfree(prtd);
5488 +diff --git a/sound/soc/soc-ops.c b/sound/soc/soc-ops.c
5489 +index 08eaa9ddf191e..dc0e7c8d31f37 100644
5490 +--- a/sound/soc/soc-ops.c
5491 ++++ b/sound/soc/soc-ops.c
5492 +@@ -316,13 +316,27 @@ int snd_soc_put_volsw(struct snd_kcontrol *kcontrol,
5493 + if (sign_bit)
5494 + mask = BIT(sign_bit + 1) - 1;
5495 +
5496 +- val = ((ucontrol->value.integer.value[0] + min) & mask);
5497 ++ val = ucontrol->value.integer.value[0];
5498 ++ if (mc->platform_max && val > mc->platform_max)
5499 ++ return -EINVAL;
5500 ++ if (val > max - min)
5501 ++ return -EINVAL;
5502 ++ if (val < 0)
5503 ++ return -EINVAL;
5504 ++ val = (val + min) & mask;
5505 + if (invert)
5506 + val = max - val;
5507 + val_mask = mask << shift;
5508 + val = val << shift;
5509 + if (snd_soc_volsw_is_stereo(mc)) {
5510 +- val2 = ((ucontrol->value.integer.value[1] + min) & mask);
5511 ++ val2 = ucontrol->value.integer.value[1];
5512 ++ if (mc->platform_max && val2 > mc->platform_max)
5513 ++ return -EINVAL;
5514 ++ if (val2 > max - min)
5515 ++ return -EINVAL;
5516 ++ if (val2 < 0)
5517 ++ return -EINVAL;
5518 ++ val2 = (val2 + min) & mask;
5519 + if (invert)
5520 + val2 = max - val2;
5521 + if (reg == reg2) {
5522 +@@ -409,8 +423,15 @@ int snd_soc_put_volsw_sx(struct snd_kcontrol *kcontrol,
5523 + int err = 0;
5524 + unsigned int val, val_mask;
5525 +
5526 ++ val = ucontrol->value.integer.value[0];
5527 ++ if (mc->platform_max && val > mc->platform_max)
5528 ++ return -EINVAL;
5529 ++ if (val > max - min)
5530 ++ return -EINVAL;
5531 ++ if (val < 0)
5532 ++ return -EINVAL;
5533 + val_mask = mask << shift;
5534 +- val = (ucontrol->value.integer.value[0] + min) & mask;
5535 ++ val = (val + min) & mask;
5536 + val = val << shift;
5537 +
5538 + err = snd_soc_component_update_bits(component, reg, val_mask, val);
5539 +@@ -858,6 +879,8 @@ int snd_soc_put_xr_sx(struct snd_kcontrol *kcontrol,
5540 + long val = ucontrol->value.integer.value[0];
5541 + unsigned int i;
5542 +
5543 ++ if (val < mc->min || val > mc->max)
5544 ++ return -EINVAL;
5545 + if (invert)
5546 + val = max - val;
5547 + val &= mask;
5548 +diff --git a/sound/soc/xilinx/xlnx_formatter_pcm.c b/sound/soc/xilinx/xlnx_formatter_pcm.c
5549 +index 91afea9d5de67..ce19a6058b279 100644
5550 +--- a/sound/soc/xilinx/xlnx_formatter_pcm.c
5551 ++++ b/sound/soc/xilinx/xlnx_formatter_pcm.c
5552 +@@ -37,6 +37,7 @@
5553 + #define XLNX_AUD_XFER_COUNT 0x28
5554 + #define XLNX_AUD_CH_STS_START 0x2C
5555 + #define XLNX_BYTES_PER_CH 0x44
5556 ++#define XLNX_AUD_ALIGN_BYTES 64
5557 +
5558 + #define AUD_STS_IOC_IRQ_MASK BIT(31)
5559 + #define AUD_STS_CH_STS_MASK BIT(29)
5560 +@@ -368,12 +369,32 @@ static int xlnx_formatter_pcm_open(struct snd_soc_component *component,
5561 + snd_soc_set_runtime_hwparams(substream, &xlnx_pcm_hardware);
5562 + runtime->private_data = stream_data;
5563 +
5564 +- /* Resize the period size divisible by 64 */
5565 ++ /* Resize the period bytes as divisible by 64 */
5566 + err = snd_pcm_hw_constraint_step(runtime, 0,
5567 +- SNDRV_PCM_HW_PARAM_PERIOD_BYTES, 64);
5568 ++ SNDRV_PCM_HW_PARAM_PERIOD_BYTES,
5569 ++ XLNX_AUD_ALIGN_BYTES);
5570 + if (err) {
5571 + dev_err(component->dev,
5572 +- "unable to set constraint on period bytes\n");
5573 ++ "Unable to set constraint on period bytes\n");
5574 ++ return err;
5575 ++ }
5576 ++
5577 ++ /* Resize the buffer bytes as divisible by 64 */
5578 ++ err = snd_pcm_hw_constraint_step(runtime, 0,
5579 ++ SNDRV_PCM_HW_PARAM_BUFFER_BYTES,
5580 ++ XLNX_AUD_ALIGN_BYTES);
5581 ++ if (err) {
5582 ++ dev_err(component->dev,
5583 ++ "Unable to set constraint on buffer bytes\n");
5584 ++ return err;
5585 ++ }
5586 ++
5587 ++ /* Set periods as integer multiple */
5588 ++ err = snd_pcm_hw_constraint_integer(runtime,
5589 ++ SNDRV_PCM_HW_PARAM_PERIODS);
5590 ++ if (err < 0) {
5591 ++ dev_err(component->dev,
5592 ++ "Unable to set constraint on periods to be integer\n");
5593 + return err;
5594 + }
5595 +
5596 +diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
5597 +index 6e7bac8203baa..2bd28474e8fae 100644
5598 +--- a/sound/usb/mixer.c
5599 ++++ b/sound/usb/mixer.c
5600 +@@ -1526,6 +1526,10 @@ error:
5601 + usb_audio_err(chip,
5602 + "cannot get connectors status: req = %#x, wValue = %#x, wIndex = %#x, type = %d\n",
5603 + UAC_GET_CUR, validx, idx, cval->val_type);
5604 ++
5605 ++ if (val)
5606 ++ *val = 0;
5607 ++
5608 + return filter_error(cval, ret);
5609 + }
5610 +
5611 +diff --git a/sound/usb/quirks-table.h b/sound/usb/quirks-table.h
5612 +index b1522e43173e1..0ea39565e6232 100644
5613 +--- a/sound/usb/quirks-table.h
5614 ++++ b/sound/usb/quirks-table.h
5615 +@@ -84,7 +84,7 @@
5616 + * combination.
5617 + */
5618 + {
5619 +- USB_DEVICE(0x041e, 0x4095),
5620 ++ USB_AUDIO_DEVICE(0x041e, 0x4095),
5621 + .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) {
5622 + .ifnum = QUIRK_ANY_INTERFACE,
5623 + .type = QUIRK_COMPOSITE,
5624 +diff --git a/tools/bpf/resolve_btfids/Makefile b/tools/bpf/resolve_btfids/Makefile
5625 +index 751643f860b29..0292fe94fc706 100644
5626 +--- a/tools/bpf/resolve_btfids/Makefile
5627 ++++ b/tools/bpf/resolve_btfids/Makefile
5628 +@@ -9,7 +9,11 @@ ifeq ($(V),1)
5629 + msg =
5630 + else
5631 + Q = @
5632 +- msg = @printf ' %-8s %s%s\n' "$(1)" "$(notdir $(2))" "$(if $(3), $(3))";
5633 ++ ifeq ($(silent),1)
5634 ++ msg =
5635 ++ else
5636 ++ msg = @printf ' %-8s %s%s\n' "$(1)" "$(notdir $(2))" "$(if $(3), $(3))";
5637 ++ endif
5638 + MAKEFLAGS=--no-print-directory
5639 + endif
5640 +
5641 +diff --git a/tools/include/uapi/sound/asound.h b/tools/include/uapi/sound/asound.h
5642 +index 5fbb79e30819a..c245ad2ca5d49 100644
5643 +--- a/tools/include/uapi/sound/asound.h
5644 ++++ b/tools/include/uapi/sound/asound.h
5645 +@@ -56,8 +56,10 @@
5646 + * *
5647 + ****************************************************************************/
5648 +
5649 ++#define AES_IEC958_STATUS_SIZE 24
5650 ++
5651 + struct snd_aes_iec958 {
5652 +- unsigned char status[24]; /* AES/IEC958 channel status bits */
5653 ++ unsigned char status[AES_IEC958_STATUS_SIZE]; /* AES/IEC958 channel status bits */
5654 + unsigned char subcode[147]; /* AES/IEC958 subcode bits */
5655 + unsigned char pad; /* nothing */
5656 + unsigned char dig_subframe[4]; /* AES/IEC958 subframe bits */
5657 +diff --git a/tools/objtool/check.c b/tools/objtool/check.c
5658 +index 21735829b860c..750ef1c446c8a 100644
5659 +--- a/tools/objtool/check.c
5660 ++++ b/tools/objtool/check.c
5661 +@@ -2823,7 +2823,7 @@ static inline bool func_uaccess_safe(struct symbol *func)
5662 +
5663 + static inline const char *call_dest_name(struct instruction *insn)
5664 + {
5665 +- static char pvname[16];
5666 ++ static char pvname[19];
5667 + struct reloc *rel;
5668 + int idx;
5669 +
5670 +diff --git a/tools/perf/util/stat-display.c b/tools/perf/util/stat-display.c
5671 +index 588601000f3f9..db00ca6a67deb 100644
5672 +--- a/tools/perf/util/stat-display.c
5673 ++++ b/tools/perf/util/stat-display.c
5674 +@@ -584,15 +584,16 @@ static void collect_all_aliases(struct perf_stat_config *config, struct evsel *c
5675 +
5676 + alias = list_prepare_entry(counter, &(evlist->core.entries), core.node);
5677 + list_for_each_entry_continue (alias, &evlist->core.entries, core.node) {
5678 +- if (strcmp(evsel__name(alias), evsel__name(counter)) ||
5679 +- alias->scale != counter->scale ||
5680 +- alias->cgrp != counter->cgrp ||
5681 +- strcmp(alias->unit, counter->unit) ||
5682 +- evsel__is_clock(alias) != evsel__is_clock(counter) ||
5683 +- !strcmp(alias->pmu_name, counter->pmu_name))
5684 +- break;
5685 +- alias->merged_stat = true;
5686 +- cb(config, alias, data, false);
5687 ++ /* Merge events with the same name, etc. but on different PMUs. */
5688 ++ if (!strcmp(evsel__name(alias), evsel__name(counter)) &&
5689 ++ alias->scale == counter->scale &&
5690 ++ alias->cgrp == counter->cgrp &&
5691 ++ !strcmp(alias->unit, counter->unit) &&
5692 ++ evsel__is_clock(alias) == evsel__is_clock(counter) &&
5693 ++ strcmp(alias->pmu_name, counter->pmu_name)) {
5694 ++ alias->merged_stat = true;
5695 ++ cb(config, alias, data, false);
5696 ++ }
5697 + }
5698 + }
5699 +
5700 +diff --git a/tools/testing/selftests/exec/Makefile b/tools/testing/selftests/exec/Makefile
5701 +index dd61118df66ed..12c5e27d32c16 100644
5702 +--- a/tools/testing/selftests/exec/Makefile
5703 ++++ b/tools/testing/selftests/exec/Makefile
5704 +@@ -5,7 +5,7 @@ CFLAGS += -D_GNU_SOURCE
5705 +
5706 + TEST_PROGS := binfmt_script non-regular
5707 + TEST_GEN_PROGS := execveat load_address_4096 load_address_2097152 load_address_16777216
5708 +-TEST_GEN_FILES := execveat.symlink execveat.denatured script subdir pipe
5709 ++TEST_GEN_FILES := execveat.symlink execveat.denatured script subdir
5710 + # Makefile is a run-time dependency, since it's accessed by the execveat test
5711 + TEST_FILES := Makefile
5712 +
5713 +diff --git a/tools/testing/selftests/futex/Makefile b/tools/testing/selftests/futex/Makefile
5714 +index 12631f0076a10..11e157d7533b8 100644
5715 +--- a/tools/testing/selftests/futex/Makefile
5716 ++++ b/tools/testing/selftests/futex/Makefile
5717 +@@ -11,7 +11,7 @@ all:
5718 + @for DIR in $(SUBDIRS); do \
5719 + BUILD_TARGET=$(OUTPUT)/$$DIR; \
5720 + mkdir $$BUILD_TARGET -p; \
5721 +- make OUTPUT=$$BUILD_TARGET -C $$DIR $@;\
5722 ++ $(MAKE) OUTPUT=$$BUILD_TARGET -C $$DIR $@;\
5723 + if [ -e $$DIR/$(TEST_PROGS) ]; then \
5724 + rsync -a $$DIR/$(TEST_PROGS) $$BUILD_TARGET/; \
5725 + fi \
5726 +@@ -32,6 +32,6 @@ override define CLEAN
5727 + @for DIR in $(SUBDIRS); do \
5728 + BUILD_TARGET=$(OUTPUT)/$$DIR; \
5729 + mkdir $$BUILD_TARGET -p; \
5730 +- make OUTPUT=$$BUILD_TARGET -C $$DIR $@;\
5731 ++ $(MAKE) OUTPUT=$$BUILD_TARGET -C $$DIR $@;\
5732 + done
5733 + endef
5734 +diff --git a/tools/testing/selftests/netfilter/nft_concat_range.sh b/tools/testing/selftests/netfilter/nft_concat_range.sh
5735 +index ed61f6cab60f4..df322e47a54fb 100755
5736 +--- a/tools/testing/selftests/netfilter/nft_concat_range.sh
5737 ++++ b/tools/testing/selftests/netfilter/nft_concat_range.sh
5738 +@@ -27,7 +27,7 @@ TYPES="net_port port_net net6_port port_proto net6_port_mac net6_port_mac_proto
5739 + net6_port_net6_port net_port_mac_proto_net"
5740 +
5741 + # Reported bugs, also described by TYPE_ variables below
5742 +-BUGS="flush_remove_add"
5743 ++BUGS="flush_remove_add reload"
5744 +
5745 + # List of possible paths to pktgen script from kernel tree for performance tests
5746 + PKTGEN_SCRIPT_PATHS="
5747 +@@ -354,6 +354,23 @@ TYPE_flush_remove_add="
5748 + display Add two elements, flush, re-add
5749 + "
5750 +
5751 ++TYPE_reload="
5752 ++display net,mac with reload
5753 ++type_spec ipv4_addr . ether_addr
5754 ++chain_spec ip daddr . ether saddr
5755 ++dst addr4
5756 ++src mac
5757 ++start 1
5758 ++count 1
5759 ++src_delta 2000
5760 ++tools sendip nc bash
5761 ++proto udp
5762 ++
5763 ++race_repeat 0
5764 ++
5765 ++perf_duration 0
5766 ++"
5767 ++
5768 + # Set template for all tests, types and rules are filled in depending on test
5769 + set_template='
5770 + flush ruleset
5771 +@@ -1473,6 +1490,59 @@ test_bug_flush_remove_add() {
5772 + nft flush ruleset
5773 + }
5774 +
5775 ++# - add ranged element, check that packets match it
5776 ++# - reload the set, check packets still match
5777 ++test_bug_reload() {
5778 ++ setup veth send_"${proto}" set || return ${KSELFTEST_SKIP}
5779 ++ rstart=${start}
5780 ++
5781 ++ range_size=1
5782 ++ for i in $(seq "${start}" $((start + count))); do
5783 ++ end=$((start + range_size))
5784 ++
5785 ++ # Avoid negative or zero-sized port ranges
5786 ++ if [ $((end / 65534)) -gt $((start / 65534)) ]; then
5787 ++ start=${end}
5788 ++ end=$((end + 1))
5789 ++ fi
5790 ++ srcstart=$((start + src_delta))
5791 ++ srcend=$((end + src_delta))
5792 ++
5793 ++ add "$(format)" || return 1
5794 ++ range_size=$((range_size + 1))
5795 ++ start=$((end + range_size))
5796 ++ done
5797 ++
5798 ++ # check kernel does allocate pcpu sctrach map
5799 ++ # for reload with no elemet add/delete
5800 ++ ( echo flush set inet filter test ;
5801 ++ nft list set inet filter test ) | nft -f -
5802 ++
5803 ++ start=${rstart}
5804 ++ range_size=1
5805 ++
5806 ++ for i in $(seq "${start}" $((start + count))); do
5807 ++ end=$((start + range_size))
5808 ++
5809 ++ # Avoid negative or zero-sized port ranges
5810 ++ if [ $((end / 65534)) -gt $((start / 65534)) ]; then
5811 ++ start=${end}
5812 ++ end=$((end + 1))
5813 ++ fi
5814 ++ srcstart=$((start + src_delta))
5815 ++ srcend=$((end + src_delta))
5816 ++
5817 ++ for j in $(seq ${start} $((range_size / 2 + 1)) ${end}); do
5818 ++ send_match "${j}" $((j + src_delta)) || return 1
5819 ++ done
5820 ++
5821 ++ range_size=$((range_size + 1))
5822 ++ start=$((end + range_size))
5823 ++ done
5824 ++
5825 ++ nft flush ruleset
5826 ++}
5827 ++
5828 + test_reported_issues() {
5829 + eval test_bug_"${subtest}"
5830 + }
5831 +diff --git a/tools/testing/selftests/netfilter/nft_nat.sh b/tools/testing/selftests/netfilter/nft_nat.sh
5832 +index d88867d2fed75..eb8543b9a5c40 100755
5833 +--- a/tools/testing/selftests/netfilter/nft_nat.sh
5834 ++++ b/tools/testing/selftests/netfilter/nft_nat.sh
5835 +@@ -898,6 +898,144 @@ EOF
5836 + ip netns exec "$ns0" nft delete table $family nat
5837 + }
5838 +
5839 ++test_stateless_nat_ip()
5840 ++{
5841 ++ local lret=0
5842 ++
5843 ++ ip netns exec "$ns0" sysctl net.ipv4.conf.veth0.forwarding=1 > /dev/null
5844 ++ ip netns exec "$ns0" sysctl net.ipv4.conf.veth1.forwarding=1 > /dev/null
5845 ++
5846 ++ ip netns exec "$ns2" ping -q -c 1 10.0.1.99 > /dev/null # ping ns2->ns1
5847 ++ if [ $? -ne 0 ] ; then
5848 ++ echo "ERROR: cannot ping $ns1 from $ns2 before loading stateless rules"
5849 ++ return 1
5850 ++ fi
5851 ++
5852 ++ip netns exec "$ns0" nft -f /dev/stdin <<EOF
5853 ++table ip stateless {
5854 ++ map xlate_in {
5855 ++ typeof meta iifname . ip saddr . ip daddr : ip daddr
5856 ++ elements = {
5857 ++ "veth1" . 10.0.2.99 . 10.0.1.99 : 10.0.2.2,
5858 ++ }
5859 ++ }
5860 ++ map xlate_out {
5861 ++ typeof meta iifname . ip saddr . ip daddr : ip daddr
5862 ++ elements = {
5863 ++ "veth0" . 10.0.1.99 . 10.0.2.2 : 10.0.2.99
5864 ++ }
5865 ++ }
5866 ++
5867 ++ chain prerouting {
5868 ++ type filter hook prerouting priority -400; policy accept;
5869 ++ ip saddr set meta iifname . ip saddr . ip daddr map @xlate_in
5870 ++ ip daddr set meta iifname . ip saddr . ip daddr map @xlate_out
5871 ++ }
5872 ++}
5873 ++EOF
5874 ++ if [ $? -ne 0 ]; then
5875 ++ echo "SKIP: Could not add ip statless rules"
5876 ++ return $ksft_skip
5877 ++ fi
5878 ++
5879 ++ reset_counters
5880 ++
5881 ++ ip netns exec "$ns2" ping -q -c 1 10.0.1.99 > /dev/null # ping ns2->ns1
5882 ++ if [ $? -ne 0 ] ; then
5883 ++ echo "ERROR: cannot ping $ns1 from $ns2 with stateless rules"
5884 ++ lret=1
5885 ++ fi
5886 ++
5887 ++ # ns1 should have seen packets from .2.2, due to stateless rewrite.
5888 ++ expect="packets 1 bytes 84"
5889 ++ cnt=$(ip netns exec "$ns1" nft list counter inet filter ns0insl | grep -q "$expect")
5890 ++ if [ $? -ne 0 ]; then
5891 ++ bad_counter "$ns1" ns0insl "$expect" "test_stateless 1"
5892 ++ lret=1
5893 ++ fi
5894 ++
5895 ++ for dir in "in" "out" ; do
5896 ++ cnt=$(ip netns exec "$ns2" nft list counter inet filter ns1${dir} | grep -q "$expect")
5897 ++ if [ $? -ne 0 ]; then
5898 ++ bad_counter "$ns2" ns1$dir "$expect" "test_stateless 2"
5899 ++ lret=1
5900 ++ fi
5901 ++ done
5902 ++
5903 ++ # ns1 should not have seen packets from ns2, due to masquerade
5904 ++ expect="packets 0 bytes 0"
5905 ++ for dir in "in" "out" ; do
5906 ++ cnt=$(ip netns exec "$ns1" nft list counter inet filter ns2${dir} | grep -q "$expect")
5907 ++ if [ $? -ne 0 ]; then
5908 ++ bad_counter "$ns1" ns0$dir "$expect" "test_stateless 3"
5909 ++ lret=1
5910 ++ fi
5911 ++
5912 ++ cnt=$(ip netns exec "$ns0" nft list counter inet filter ns1${dir} | grep -q "$expect")
5913 ++ if [ $? -ne 0 ]; then
5914 ++ bad_counter "$ns0" ns1$dir "$expect" "test_stateless 4"
5915 ++ lret=1
5916 ++ fi
5917 ++ done
5918 ++
5919 ++ reset_counters
5920 ++
5921 ++ socat -h > /dev/null 2>&1
5922 ++ if [ $? -ne 0 ];then
5923 ++ echo "SKIP: Could not run stateless nat frag test without socat tool"
5924 ++ if [ $lret -eq 0 ]; then
5925 ++ return $ksft_skip
5926 ++ fi
5927 ++
5928 ++ ip netns exec "$ns0" nft delete table ip stateless
5929 ++ return $lret
5930 ++ fi
5931 ++
5932 ++ local tmpfile=$(mktemp)
5933 ++ dd if=/dev/urandom of=$tmpfile bs=4096 count=1 2>/dev/null
5934 ++
5935 ++ local outfile=$(mktemp)
5936 ++ ip netns exec "$ns1" timeout 3 socat -u UDP4-RECV:4233 OPEN:$outfile < /dev/null &
5937 ++ sc_r=$!
5938 ++
5939 ++ sleep 1
5940 ++ # re-do with large ping -> ip fragmentation
5941 ++ ip netns exec "$ns2" timeout 3 socat - UDP4-SENDTO:"10.0.1.99:4233" < "$tmpfile" > /dev/null
5942 ++ if [ $? -ne 0 ] ; then
5943 ++ echo "ERROR: failed to test udp $ns1 to $ns2 with stateless ip nat" 1>&2
5944 ++ lret=1
5945 ++ fi
5946 ++
5947 ++ wait
5948 ++
5949 ++ cmp "$tmpfile" "$outfile"
5950 ++ if [ $? -ne 0 ]; then
5951 ++ ls -l "$tmpfile" "$outfile"
5952 ++ echo "ERROR: in and output file mismatch when checking udp with stateless nat" 1>&2
5953 ++ lret=1
5954 ++ fi
5955 ++
5956 ++ rm -f "$tmpfile" "$outfile"
5957 ++
5958 ++ # ns1 should have seen packets from 2.2, due to stateless rewrite.
5959 ++ expect="packets 3 bytes 4164"
5960 ++ cnt=$(ip netns exec "$ns1" nft list counter inet filter ns0insl | grep -q "$expect")
5961 ++ if [ $? -ne 0 ]; then
5962 ++ bad_counter "$ns1" ns0insl "$expect" "test_stateless 5"
5963 ++ lret=1
5964 ++ fi
5965 ++
5966 ++ ip netns exec "$ns0" nft delete table ip stateless
5967 ++ if [ $? -ne 0 ]; then
5968 ++ echo "ERROR: Could not delete table ip stateless" 1>&2
5969 ++ lret=1
5970 ++ fi
5971 ++
5972 ++ test $lret -eq 0 && echo "PASS: IP statless for $ns2"
5973 ++
5974 ++ return $lret
5975 ++}
5976 ++
5977 + # ip netns exec "$ns0" ping -c 1 -q 10.0.$i.99
5978 + for i in 0 1 2; do
5979 + ip netns exec ns$i-$sfx nft -f /dev/stdin <<EOF
5980 +@@ -964,6 +1102,19 @@ table inet filter {
5981 + EOF
5982 + done
5983 +
5984 ++# special case for stateless nat check, counter needs to
5985 ++# be done before (input) ip defragmentation
5986 ++ip netns exec ns1-$sfx nft -f /dev/stdin <<EOF
5987 ++table inet filter {
5988 ++ counter ns0insl {}
5989 ++
5990 ++ chain pre {
5991 ++ type filter hook prerouting priority -400; policy accept;
5992 ++ ip saddr 10.0.2.2 counter name "ns0insl"
5993 ++ }
5994 ++}
5995 ++EOF
5996 ++
5997 + sleep 3
5998 + # test basic connectivity
5999 + for i in 1 2; do
6000 +@@ -1018,6 +1169,7 @@ $test_inet_nat && test_redirect inet
6001 + $test_inet_nat && test_redirect6 inet
6002 +
6003 + test_port_shadowing
6004 ++test_stateless_nat_ip
6005 +
6006 + if [ $ret -ne 0 ];then
6007 + echo -n "FAIL: "