1 |
commit: 448bfd8c526185bebc0dd972622b7ac6b3f14c2b |
2 |
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
3 |
AuthorDate: Tue Feb 8 17:52:47 2022 +0000 |
4 |
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Feb 8 17:52:47 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=448bfd8c |
7 |
|
8 |
Linux patch 5.15.22 |
9 |
|
10 |
Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org> |
11 |
|
12 |
0000_README | 4 + |
13 |
1021_linux-5.15.22.patch | 4544 ++++++++++++++++++++++++++++++++++++++++++++++ |
14 |
2 files changed, 4548 insertions(+) |
15 |
|
16 |
diff --git a/0000_README b/0000_README |
17 |
index 3e49e689..8fbaf6ad 100644 |
18 |
--- a/0000_README |
19 |
+++ b/0000_README |
20 |
@@ -127,6 +127,10 @@ Patch: 1020_linux-5.15.21.patch |
21 |
From: http://www.kernel.org |
22 |
Desc: Linux 5.15.21 |
23 |
|
24 |
+Patch: 1021_linux-5.15.22.patch |
25 |
+From: http://www.kernel.org |
26 |
+Desc: Linux 5.15.22 |
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/1021_linux-5.15.22.patch b/1021_linux-5.15.22.patch |
33 |
new file mode 100644 |
34 |
index 00000000..1ccf7577 |
35 |
--- /dev/null |
36 |
+++ b/1021_linux-5.15.22.patch |
37 |
@@ -0,0 +1,4544 @@ |
38 |
+diff --git a/Documentation/gpu/todo.rst b/Documentation/gpu/todo.rst |
39 |
+index 12e61869939e8..67de1e94fdf76 100644 |
40 |
+--- a/Documentation/gpu/todo.rst |
41 |
++++ b/Documentation/gpu/todo.rst |
42 |
+@@ -311,27 +311,6 @@ Contact: Daniel Vetter, Noralf Tronnes |
43 |
+ |
44 |
+ Level: Advanced |
45 |
+ |
46 |
+-Garbage collect fbdev scrolling acceleration |
47 |
+--------------------------------------------- |
48 |
+- |
49 |
+-Scroll acceleration is disabled in fbcon by hard-wiring p->scrollmode = |
50 |
+-SCROLL_REDRAW. There's a ton of code this will allow us to remove: |
51 |
+- |
52 |
+-- lots of code in fbcon.c |
53 |
+- |
54 |
+-- a bunch of the hooks in fbcon_ops, maybe the remaining hooks could be called |
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 |
+-Note that not all acceleration code can be deleted, since clearing and cursor |
60 |
+-support is still accelerated, which might be good candidates for further |
61 |
+-deletion projects. |
62 |
+- |
63 |
+-Contact: Daniel Vetter |
64 |
+- |
65 |
+-Level: Intermediate |
66 |
+- |
67 |
+ idr_init_base() |
68 |
+ --------------- |
69 |
+ |
70 |
+diff --git a/Makefile b/Makefile |
71 |
+index b4770cdda9b6d..5bddd61954847 100644 |
72 |
+--- a/Makefile |
73 |
++++ b/Makefile |
74 |
+@@ -1,7 +1,7 @@ |
75 |
+ # SPDX-License-Identifier: GPL-2.0 |
76 |
+ VERSION = 5 |
77 |
+ PATCHLEVEL = 15 |
78 |
+-SUBLEVEL = 21 |
79 |
++SUBLEVEL = 22 |
80 |
+ EXTRAVERSION = |
81 |
+ NAME = Trick or Treat |
82 |
+ |
83 |
+diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c |
84 |
+index 9b328bb05596a..f9c7e4e61b296 100644 |
85 |
+--- a/arch/arm64/kvm/arm.c |
86 |
++++ b/arch/arm64/kvm/arm.c |
87 |
+@@ -755,6 +755,24 @@ static bool kvm_vcpu_exit_request(struct kvm_vcpu *vcpu, int *ret) |
88 |
+ xfer_to_guest_mode_work_pending(); |
89 |
+ } |
90 |
+ |
91 |
++/* |
92 |
++ * Actually run the vCPU, entering an RCU extended quiescent state (EQS) while |
93 |
++ * the vCPU is running. |
94 |
++ * |
95 |
++ * This must be noinstr as instrumentation may make use of RCU, and this is not |
96 |
++ * safe during the EQS. |
97 |
++ */ |
98 |
++static int noinstr kvm_arm_vcpu_enter_exit(struct kvm_vcpu *vcpu) |
99 |
++{ |
100 |
++ int ret; |
101 |
++ |
102 |
++ guest_state_enter_irqoff(); |
103 |
++ ret = kvm_call_hyp_ret(__kvm_vcpu_run, vcpu); |
104 |
++ guest_state_exit_irqoff(); |
105 |
++ |
106 |
++ return ret; |
107 |
++} |
108 |
++ |
109 |
+ /** |
110 |
+ * kvm_arch_vcpu_ioctl_run - the main VCPU run function to execute guest code |
111 |
+ * @vcpu: The VCPU pointer |
112 |
+@@ -845,9 +863,9 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu) |
113 |
+ * Enter the guest |
114 |
+ */ |
115 |
+ trace_kvm_entry(*vcpu_pc(vcpu)); |
116 |
+- guest_enter_irqoff(); |
117 |
++ guest_timing_enter_irqoff(); |
118 |
+ |
119 |
+- ret = kvm_call_hyp_ret(__kvm_vcpu_run, vcpu); |
120 |
++ ret = kvm_arm_vcpu_enter_exit(vcpu); |
121 |
+ |
122 |
+ vcpu->mode = OUTSIDE_GUEST_MODE; |
123 |
+ vcpu->stat.exits++; |
124 |
+@@ -882,26 +900,23 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu) |
125 |
+ kvm_arch_vcpu_ctxsync_fp(vcpu); |
126 |
+ |
127 |
+ /* |
128 |
+- * We may have taken a host interrupt in HYP mode (ie |
129 |
+- * while executing the guest). This interrupt is still |
130 |
+- * pending, as we haven't serviced it yet! |
131 |
++ * We must ensure that any pending interrupts are taken before |
132 |
++ * we exit guest timing so that timer ticks are accounted as |
133 |
++ * guest time. Transiently unmask interrupts so that any |
134 |
++ * pending interrupts are taken. |
135 |
+ * |
136 |
+- * We're now back in SVC mode, with interrupts |
137 |
+- * disabled. Enabling the interrupts now will have |
138 |
+- * the effect of taking the interrupt again, in SVC |
139 |
+- * mode this time. |
140 |
++ * Per ARM DDI 0487G.b section D1.13.4, an ISB (or other |
141 |
++ * context synchronization event) is necessary to ensure that |
142 |
++ * pending interrupts are taken. |
143 |
+ */ |
144 |
+ local_irq_enable(); |
145 |
++ isb(); |
146 |
++ local_irq_disable(); |
147 |
++ |
148 |
++ guest_timing_exit_irqoff(); |
149 |
++ |
150 |
++ local_irq_enable(); |
151 |
+ |
152 |
+- /* |
153 |
+- * We do local_irq_enable() before calling guest_exit() so |
154 |
+- * that if a timer interrupt hits while running the guest we |
155 |
+- * account that tick as being spent in the guest. We enable |
156 |
+- * preemption after calling guest_exit() so that if we get |
157 |
+- * preempted we make sure ticks after that is not counted as |
158 |
+- * guest time. |
159 |
+- */ |
160 |
+- guest_exit(); |
161 |
+ trace_kvm_exit(ret, kvm_vcpu_trap_get_class(vcpu), *vcpu_pc(vcpu)); |
162 |
+ |
163 |
+ /* Exit types that need handling before we can be preempted */ |
164 |
+diff --git a/arch/arm64/kvm/handle_exit.c b/arch/arm64/kvm/handle_exit.c |
165 |
+index 275a27368a04c..a5ab5215094ee 100644 |
166 |
+--- a/arch/arm64/kvm/handle_exit.c |
167 |
++++ b/arch/arm64/kvm/handle_exit.c |
168 |
+@@ -226,6 +226,14 @@ int handle_exit(struct kvm_vcpu *vcpu, int exception_index) |
169 |
+ { |
170 |
+ struct kvm_run *run = vcpu->run; |
171 |
+ |
172 |
++ if (ARM_SERROR_PENDING(exception_index)) { |
173 |
++ /* |
174 |
++ * The SError is handled by handle_exit_early(). If the guest |
175 |
++ * survives it will re-execute the original instruction. |
176 |
++ */ |
177 |
++ return 1; |
178 |
++ } |
179 |
++ |
180 |
+ exception_index = ARM_EXCEPTION_CODE(exception_index); |
181 |
+ |
182 |
+ switch (exception_index) { |
183 |
+diff --git a/arch/arm64/kvm/hyp/include/hyp/switch.h b/arch/arm64/kvm/hyp/include/hyp/switch.h |
184 |
+index c75e84489f57b..ecd41844eda09 100644 |
185 |
+--- a/arch/arm64/kvm/hyp/include/hyp/switch.h |
186 |
++++ b/arch/arm64/kvm/hyp/include/hyp/switch.h |
187 |
+@@ -425,7 +425,8 @@ static inline bool fixup_guest_exit(struct kvm_vcpu *vcpu, u64 *exit_code) |
188 |
+ if (ARM_EXCEPTION_CODE(*exit_code) != ARM_EXCEPTION_IRQ) |
189 |
+ vcpu->arch.fault.esr_el2 = read_sysreg_el2(SYS_ESR); |
190 |
+ |
191 |
+- if (ARM_SERROR_PENDING(*exit_code)) { |
192 |
++ if (ARM_SERROR_PENDING(*exit_code) && |
193 |
++ ARM_EXCEPTION_CODE(*exit_code) != ARM_EXCEPTION_IRQ) { |
194 |
+ u8 esr_ec = kvm_vcpu_trap_get_class(vcpu); |
195 |
+ |
196 |
+ /* |
197 |
+diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c |
198 |
+index dcf455525cfcb..97ede6fb15f26 100644 |
199 |
+--- a/arch/x86/events/intel/core.c |
200 |
++++ b/arch/x86/events/intel/core.c |
201 |
+@@ -4654,6 +4654,19 @@ static __initconst const struct x86_pmu intel_pmu = { |
202 |
+ .lbr_read = intel_pmu_lbr_read_64, |
203 |
+ .lbr_save = intel_pmu_lbr_save, |
204 |
+ .lbr_restore = intel_pmu_lbr_restore, |
205 |
++ |
206 |
++ /* |
207 |
++ * SMM has access to all 4 rings and while traditionally SMM code only |
208 |
++ * ran in CPL0, 2021-era firmware is starting to make use of CPL3 in SMM. |
209 |
++ * |
210 |
++ * Since the EVENTSEL.{USR,OS} CPL filtering makes no distinction |
211 |
++ * between SMM or not, this results in what should be pure userspace |
212 |
++ * counters including SMM data. |
213 |
++ * |
214 |
++ * This is a clear privilege issue, therefore globally disable |
215 |
++ * counting SMM by default. |
216 |
++ */ |
217 |
++ .attr_freeze_on_smi = 1, |
218 |
+ }; |
219 |
+ |
220 |
+ static __init void intel_clovertown_quirk(void) |
221 |
+diff --git a/arch/x86/events/intel/pt.c b/arch/x86/events/intel/pt.c |
222 |
+index 7f406c14715fd..2d33bba9a1440 100644 |
223 |
+--- a/arch/x86/events/intel/pt.c |
224 |
++++ b/arch/x86/events/intel/pt.c |
225 |
+@@ -897,8 +897,9 @@ static void pt_handle_status(struct pt *pt) |
226 |
+ * means we are already losing data; need to let the decoder |
227 |
+ * know. |
228 |
+ */ |
229 |
+- if (!intel_pt_validate_hw_cap(PT_CAP_topa_multiple_entries) || |
230 |
+- buf->output_off == pt_buffer_region_size(buf)) { |
231 |
++ if (!buf->single && |
232 |
++ (!intel_pt_validate_hw_cap(PT_CAP_topa_multiple_entries) || |
233 |
++ buf->output_off == pt_buffer_region_size(buf))) { |
234 |
+ perf_aux_output_flag(&pt->handle, |
235 |
+ PERF_AUX_FLAG_TRUNCATED); |
236 |
+ advance++; |
237 |
+diff --git a/block/bio-integrity.c b/block/bio-integrity.c |
238 |
+index 6b47cddbbca17..4a7c33ed9a661 100644 |
239 |
+--- a/block/bio-integrity.c |
240 |
++++ b/block/bio-integrity.c |
241 |
+@@ -373,7 +373,7 @@ void bio_integrity_advance(struct bio *bio, unsigned int bytes_done) |
242 |
+ struct blk_integrity *bi = blk_get_integrity(bio->bi_bdev->bd_disk); |
243 |
+ unsigned bytes = bio_integrity_bytes(bi, bytes_done >> 9); |
244 |
+ |
245 |
+- bip->bip_iter.bi_sector += bytes_done >> 9; |
246 |
++ bip->bip_iter.bi_sector += bio_integrity_intervals(bi, bytes_done >> 9); |
247 |
+ bvec_iter_advance(bip->bip_vec, &bip->bip_iter, bytes); |
248 |
+ } |
249 |
+ |
250 |
+diff --git a/drivers/dma-buf/dma-heap.c b/drivers/dma-buf/dma-heap.c |
251 |
+index 56bf5ad01ad54..8f5848aa144fe 100644 |
252 |
+--- a/drivers/dma-buf/dma-heap.c |
253 |
++++ b/drivers/dma-buf/dma-heap.c |
254 |
+@@ -14,6 +14,7 @@ |
255 |
+ #include <linux/xarray.h> |
256 |
+ #include <linux/list.h> |
257 |
+ #include <linux/slab.h> |
258 |
++#include <linux/nospec.h> |
259 |
+ #include <linux/uaccess.h> |
260 |
+ #include <linux/syscalls.h> |
261 |
+ #include <linux/dma-heap.h> |
262 |
+@@ -135,6 +136,7 @@ static long dma_heap_ioctl(struct file *file, unsigned int ucmd, |
263 |
+ if (nr >= ARRAY_SIZE(dma_heap_ioctl_cmds)) |
264 |
+ return -EINVAL; |
265 |
+ |
266 |
++ nr = array_index_nospec(nr, ARRAY_SIZE(dma_heap_ioctl_cmds)); |
267 |
+ /* Get the kernel ioctl cmd that matches */ |
268 |
+ kcmd = dma_heap_ioctl_cmds[nr]; |
269 |
+ |
270 |
+diff --git a/drivers/edac/altera_edac.c b/drivers/edac/altera_edac.c |
271 |
+index 3a6d2416cb0f6..5dd29789f97d3 100644 |
272 |
+--- a/drivers/edac/altera_edac.c |
273 |
++++ b/drivers/edac/altera_edac.c |
274 |
+@@ -350,7 +350,7 @@ static int altr_sdram_probe(struct platform_device *pdev) |
275 |
+ if (irq < 0) { |
276 |
+ edac_printk(KERN_ERR, EDAC_MC, |
277 |
+ "No irq %d in DT\n", irq); |
278 |
+- return -ENODEV; |
279 |
++ return irq; |
280 |
+ } |
281 |
+ |
282 |
+ /* Arria10 has a 2nd IRQ */ |
283 |
+diff --git a/drivers/edac/xgene_edac.c b/drivers/edac/xgene_edac.c |
284 |
+index 2ccd1db5e98ff..7197f9fa02457 100644 |
285 |
+--- a/drivers/edac/xgene_edac.c |
286 |
++++ b/drivers/edac/xgene_edac.c |
287 |
+@@ -1919,7 +1919,7 @@ static int xgene_edac_probe(struct platform_device *pdev) |
288 |
+ irq = platform_get_irq_optional(pdev, i); |
289 |
+ if (irq < 0) { |
290 |
+ dev_err(&pdev->dev, "No IRQ resource\n"); |
291 |
+- rc = -EINVAL; |
292 |
++ rc = irq; |
293 |
+ goto out_err; |
294 |
+ } |
295 |
+ rc = devm_request_irq(&pdev->dev, irq, |
296 |
+diff --git a/drivers/gpio/gpio-idt3243x.c b/drivers/gpio/gpio-idt3243x.c |
297 |
+index 08493b05be2da..52b8b72ded77f 100644 |
298 |
+--- a/drivers/gpio/gpio-idt3243x.c |
299 |
++++ b/drivers/gpio/gpio-idt3243x.c |
300 |
+@@ -132,7 +132,7 @@ static int idt_gpio_probe(struct platform_device *pdev) |
301 |
+ struct device *dev = &pdev->dev; |
302 |
+ struct gpio_irq_chip *girq; |
303 |
+ struct idt_gpio_ctrl *ctrl; |
304 |
+- unsigned int parent_irq; |
305 |
++ int parent_irq; |
306 |
+ int ngpios; |
307 |
+ int ret; |
308 |
+ |
309 |
+diff --git a/drivers/gpio/gpio-mpc8xxx.c b/drivers/gpio/gpio-mpc8xxx.c |
310 |
+index 01634c8d27b38..a964e25ea6206 100644 |
311 |
+--- a/drivers/gpio/gpio-mpc8xxx.c |
312 |
++++ b/drivers/gpio/gpio-mpc8xxx.c |
313 |
+@@ -47,7 +47,7 @@ struct mpc8xxx_gpio_chip { |
314 |
+ unsigned offset, int value); |
315 |
+ |
316 |
+ struct irq_domain *irq; |
317 |
+- unsigned int irqn; |
318 |
++ int irqn; |
319 |
+ }; |
320 |
+ |
321 |
+ /* |
322 |
+diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c |
323 |
+index 41677f99c67b1..30059b7db0b25 100644 |
324 |
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c |
325 |
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c |
326 |
+@@ -1504,8 +1504,7 @@ static int amdgpu_pmops_prepare(struct device *dev) |
327 |
+ * DPM_FLAG_SMART_SUSPEND works properly |
328 |
+ */ |
329 |
+ if (amdgpu_device_supports_boco(drm_dev)) |
330 |
+- return pm_runtime_suspended(dev) && |
331 |
+- pm_suspend_via_firmware(); |
332 |
++ return pm_runtime_suspended(dev); |
333 |
+ |
334 |
+ return 0; |
335 |
+ } |
336 |
+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 |
337 |
+index 407e19412a949..8f6e6496ea787 100644 |
338 |
+--- a/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn31/dcn31_clk_mgr.c |
339 |
++++ b/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn31/dcn31_clk_mgr.c |
340 |
+@@ -324,38 +324,38 @@ static struct clk_bw_params dcn31_bw_params = { |
341 |
+ |
342 |
+ }; |
343 |
+ |
344 |
+-static struct wm_table ddr4_wm_table = { |
345 |
++static struct wm_table ddr5_wm_table = { |
346 |
+ .entries = { |
347 |
+ { |
348 |
+ .wm_inst = WM_A, |
349 |
+ .wm_type = WM_TYPE_PSTATE_CHG, |
350 |
+ .pstate_latency_us = 11.72, |
351 |
+- .sr_exit_time_us = 6.09, |
352 |
+- .sr_enter_plus_exit_time_us = 7.14, |
353 |
++ .sr_exit_time_us = 9, |
354 |
++ .sr_enter_plus_exit_time_us = 11, |
355 |
+ .valid = true, |
356 |
+ }, |
357 |
+ { |
358 |
+ .wm_inst = WM_B, |
359 |
+ .wm_type = WM_TYPE_PSTATE_CHG, |
360 |
+ .pstate_latency_us = 11.72, |
361 |
+- .sr_exit_time_us = 10.12, |
362 |
+- .sr_enter_plus_exit_time_us = 11.48, |
363 |
++ .sr_exit_time_us = 9, |
364 |
++ .sr_enter_plus_exit_time_us = 11, |
365 |
+ .valid = true, |
366 |
+ }, |
367 |
+ { |
368 |
+ .wm_inst = WM_C, |
369 |
+ .wm_type = WM_TYPE_PSTATE_CHG, |
370 |
+ .pstate_latency_us = 11.72, |
371 |
+- .sr_exit_time_us = 10.12, |
372 |
+- .sr_enter_plus_exit_time_us = 11.48, |
373 |
++ .sr_exit_time_us = 9, |
374 |
++ .sr_enter_plus_exit_time_us = 11, |
375 |
+ .valid = true, |
376 |
+ }, |
377 |
+ { |
378 |
+ .wm_inst = WM_D, |
379 |
+ .wm_type = WM_TYPE_PSTATE_CHG, |
380 |
+ .pstate_latency_us = 11.72, |
381 |
+- .sr_exit_time_us = 10.12, |
382 |
+- .sr_enter_plus_exit_time_us = 11.48, |
383 |
++ .sr_exit_time_us = 9, |
384 |
++ .sr_enter_plus_exit_time_us = 11, |
385 |
+ .valid = true, |
386 |
+ }, |
387 |
+ } |
388 |
+@@ -683,7 +683,7 @@ void dcn31_clk_mgr_construct( |
389 |
+ if (ctx->dc_bios->integrated_info->memory_type == LpDdr5MemType) { |
390 |
+ dcn31_bw_params.wm_table = lpddr5_wm_table; |
391 |
+ } else { |
392 |
+- dcn31_bw_params.wm_table = ddr4_wm_table; |
393 |
++ dcn31_bw_params.wm_table = ddr5_wm_table; |
394 |
+ } |
395 |
+ /* Saved clocks configured at boot for debug purposes */ |
396 |
+ dcn31_dump_clk_registers(&clk_mgr->base.base.boot_snapshot, &clk_mgr->base.base, &log_info); |
397 |
+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 |
398 |
+index 61c18637f84dc..93c20844848c7 100644 |
399 |
+--- a/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c |
400 |
++++ b/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c |
401 |
+@@ -3913,6 +3913,26 @@ static bool retrieve_link_cap(struct dc_link *link) |
402 |
+ dp_hw_fw_revision.ieee_fw_rev, |
403 |
+ sizeof(dp_hw_fw_revision.ieee_fw_rev)); |
404 |
+ |
405 |
++ /* Quirk for Apple MBP 2018 15" Retina panels: wrong DP_MAX_LINK_RATE */ |
406 |
++ { |
407 |
++ uint8_t str_mbp_2018[] = { 101, 68, 21, 103, 98, 97 }; |
408 |
++ uint8_t fwrev_mbp_2018[] = { 7, 4 }; |
409 |
++ uint8_t fwrev_mbp_2018_vega[] = { 8, 4 }; |
410 |
++ |
411 |
++ /* We also check for the firmware revision as 16,1 models have an |
412 |
++ * identical device id and are incorrectly quirked otherwise. |
413 |
++ */ |
414 |
++ if ((link->dpcd_caps.sink_dev_id == 0x0010fa) && |
415 |
++ !memcmp(link->dpcd_caps.sink_dev_id_str, str_mbp_2018, |
416 |
++ sizeof(str_mbp_2018)) && |
417 |
++ (!memcmp(link->dpcd_caps.sink_fw_revision, fwrev_mbp_2018, |
418 |
++ sizeof(fwrev_mbp_2018)) || |
419 |
++ !memcmp(link->dpcd_caps.sink_fw_revision, fwrev_mbp_2018_vega, |
420 |
++ sizeof(fwrev_mbp_2018_vega)))) { |
421 |
++ link->reported_link_cap.link_rate = LINK_RATE_RBR2; |
422 |
++ } |
423 |
++ } |
424 |
++ |
425 |
+ memset(&link->dpcd_caps.dsc_caps, '\0', |
426 |
+ sizeof(link->dpcd_caps.dsc_caps)); |
427 |
+ memset(&link->dpcd_caps.fec_cap, '\0', sizeof(link->dpcd_caps.fec_cap)); |
428 |
+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 |
429 |
+index ca57221e39629..f89bf49965fcd 100644 |
430 |
+--- a/drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c |
431 |
++++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c |
432 |
+@@ -3728,14 +3728,14 @@ static ssize_t sienna_cichlid_get_gpu_metrics(struct smu_context *smu, |
433 |
+ |
434 |
+ static int sienna_cichlid_enable_mgpu_fan_boost(struct smu_context *smu) |
435 |
+ { |
436 |
+- struct smu_table_context *table_context = &smu->smu_table; |
437 |
+- PPTable_t *smc_pptable = table_context->driver_pptable; |
438 |
++ uint16_t *mgpu_fan_boost_limit_rpm; |
439 |
+ |
440 |
++ GET_PPTABLE_MEMBER(MGpuFanBoostLimitRpm, &mgpu_fan_boost_limit_rpm); |
441 |
+ /* |
442 |
+ * Skip the MGpuFanBoost setting for those ASICs |
443 |
+ * which do not support it |
444 |
+ */ |
445 |
+- if (!smc_pptable->MGpuFanBoostLimitRpm) |
446 |
++ if (*mgpu_fan_boost_limit_rpm == 0) |
447 |
+ return 0; |
448 |
+ |
449 |
+ return smu_cmn_send_smc_msg_with_param(smu, |
450 |
+diff --git a/drivers/gpu/drm/i915/display/intel_overlay.c b/drivers/gpu/drm/i915/display/intel_overlay.c |
451 |
+index 7e3f5c6ca4846..dfa5f18171e3b 100644 |
452 |
+--- a/drivers/gpu/drm/i915/display/intel_overlay.c |
453 |
++++ b/drivers/gpu/drm/i915/display/intel_overlay.c |
454 |
+@@ -959,6 +959,9 @@ static int check_overlay_dst(struct intel_overlay *overlay, |
455 |
+ const struct intel_crtc_state *pipe_config = |
456 |
+ overlay->crtc->config; |
457 |
+ |
458 |
++ if (rec->dst_height == 0 || rec->dst_width == 0) |
459 |
++ return -EINVAL; |
460 |
++ |
461 |
+ if (rec->dst_x < pipe_config->pipe_src_w && |
462 |
+ rec->dst_x + rec->dst_width <= pipe_config->pipe_src_w && |
463 |
+ rec->dst_y < pipe_config->pipe_src_h && |
464 |
+diff --git a/drivers/gpu/drm/i915/display/intel_tc.c b/drivers/gpu/drm/i915/display/intel_tc.c |
465 |
+index 3ffece568ed98..0e885440be242 100644 |
466 |
+--- a/drivers/gpu/drm/i915/display/intel_tc.c |
467 |
++++ b/drivers/gpu/drm/i915/display/intel_tc.c |
468 |
+@@ -291,10 +291,11 @@ static bool icl_tc_phy_status_complete(struct intel_digital_port *dig_port) |
469 |
+ static bool adl_tc_phy_status_complete(struct intel_digital_port *dig_port) |
470 |
+ { |
471 |
+ struct drm_i915_private *i915 = to_i915(dig_port->base.base.dev); |
472 |
++ enum tc_port tc_port = intel_port_to_tc(i915, dig_port->base.port); |
473 |
+ struct intel_uncore *uncore = &i915->uncore; |
474 |
+ u32 val; |
475 |
+ |
476 |
+- val = intel_uncore_read(uncore, TCSS_DDI_STATUS(dig_port->tc_phy_fia_idx)); |
477 |
++ val = intel_uncore_read(uncore, TCSS_DDI_STATUS(tc_port)); |
478 |
+ if (val == 0xffffffff) { |
479 |
+ drm_dbg_kms(&i915->drm, |
480 |
+ "Port %s: PHY in TCCOLD, assuming not complete\n", |
481 |
+diff --git a/drivers/gpu/drm/i915/i915_pci.c b/drivers/gpu/drm/i915/i915_pci.c |
482 |
+index 1bbd09ad52873..1ad7259fb1f0c 100644 |
483 |
+--- a/drivers/gpu/drm/i915/i915_pci.c |
484 |
++++ b/drivers/gpu/drm/i915/i915_pci.c |
485 |
+@@ -865,7 +865,7 @@ static const struct intel_device_info jsl_info = { |
486 |
+ }, \ |
487 |
+ TGL_CURSOR_OFFSETS, \ |
488 |
+ .has_global_mocs = 1, \ |
489 |
+- .display.has_dsb = 1 |
490 |
++ .display.has_dsb = 0 /* FIXME: LUT load is broken with DSB */ |
491 |
+ |
492 |
+ static const struct intel_device_info tgl_info = { |
493 |
+ GEN12_FEATURES, |
494 |
+diff --git a/drivers/gpu/drm/kmb/kmb_plane.c b/drivers/gpu/drm/kmb/kmb_plane.c |
495 |
+index 00404ba4126dd..2735b8eb35376 100644 |
496 |
+--- a/drivers/gpu/drm/kmb/kmb_plane.c |
497 |
++++ b/drivers/gpu/drm/kmb/kmb_plane.c |
498 |
+@@ -158,12 +158,6 @@ static void kmb_plane_atomic_disable(struct drm_plane *plane, |
499 |
+ case LAYER_1: |
500 |
+ kmb->plane_status[plane_id].ctrl = LCD_CTRL_VL2_ENABLE; |
501 |
+ break; |
502 |
+- case LAYER_2: |
503 |
+- kmb->plane_status[plane_id].ctrl = LCD_CTRL_GL1_ENABLE; |
504 |
+- break; |
505 |
+- case LAYER_3: |
506 |
+- kmb->plane_status[plane_id].ctrl = LCD_CTRL_GL2_ENABLE; |
507 |
+- break; |
508 |
+ } |
509 |
+ |
510 |
+ kmb->plane_status[plane_id].disable = true; |
511 |
+diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/base.c b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/base.c |
512 |
+index d0f52d59fc2f9..64e423dddd9e7 100644 |
513 |
+--- a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/base.c |
514 |
++++ b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/base.c |
515 |
+@@ -38,7 +38,7 @@ nvbios_addr(struct nvkm_bios *bios, u32 *addr, u8 size) |
516 |
+ *addr += bios->imaged_addr; |
517 |
+ } |
518 |
+ |
519 |
+- if (unlikely(*addr + size >= bios->size)) { |
520 |
++ if (unlikely(*addr + size > bios->size)) { |
521 |
+ nvkm_error(&bios->subdev, "OOB %d %08x %08x\n", size, p, *addr); |
522 |
+ return false; |
523 |
+ } |
524 |
+diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c |
525 |
+index c903b74f46a46..35f0d5e7533d6 100644 |
526 |
+--- a/drivers/infiniband/core/cm.c |
527 |
++++ b/drivers/infiniband/core/cm.c |
528 |
+@@ -3322,7 +3322,7 @@ static int cm_lap_handler(struct cm_work *work) |
529 |
+ ret = cm_init_av_by_path(param->alternate_path, NULL, &alt_av); |
530 |
+ if (ret) { |
531 |
+ rdma_destroy_ah_attr(&ah_attr); |
532 |
+- return -EINVAL; |
533 |
++ goto deref; |
534 |
+ } |
535 |
+ |
536 |
+ spin_lock_irq(&cm_id_priv->lock); |
537 |
+diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c |
538 |
+index 3d419741e8916..13679c7b65774 100644 |
539 |
+--- a/drivers/infiniband/core/cma.c |
540 |
++++ b/drivers/infiniband/core/cma.c |
541 |
+@@ -67,8 +67,8 @@ static const char * const cma_events[] = { |
542 |
+ [RDMA_CM_EVENT_TIMEWAIT_EXIT] = "timewait exit", |
543 |
+ }; |
544 |
+ |
545 |
+-static void cma_set_mgid(struct rdma_id_private *id_priv, struct sockaddr *addr, |
546 |
+- union ib_gid *mgid); |
547 |
++static void cma_iboe_set_mgid(struct sockaddr *addr, union ib_gid *mgid, |
548 |
++ enum ib_gid_type gid_type); |
549 |
+ |
550 |
+ const char *__attribute_const__ rdma_event_msg(enum rdma_cm_event_type event) |
551 |
+ { |
552 |
+@@ -1844,17 +1844,19 @@ static void destroy_mc(struct rdma_id_private *id_priv, |
553 |
+ if (dev_addr->bound_dev_if) |
554 |
+ ndev = dev_get_by_index(dev_addr->net, |
555 |
+ dev_addr->bound_dev_if); |
556 |
+- if (ndev) { |
557 |
++ if (ndev && !send_only) { |
558 |
++ enum ib_gid_type gid_type; |
559 |
+ union ib_gid mgid; |
560 |
+ |
561 |
+- cma_set_mgid(id_priv, (struct sockaddr *)&mc->addr, |
562 |
+- &mgid); |
563 |
+- |
564 |
+- if (!send_only) |
565 |
+- cma_igmp_send(ndev, &mgid, false); |
566 |
+- |
567 |
+- dev_put(ndev); |
568 |
++ gid_type = id_priv->cma_dev->default_gid_type |
569 |
++ [id_priv->id.port_num - |
570 |
++ rdma_start_port( |
571 |
++ id_priv->cma_dev->device)]; |
572 |
++ cma_iboe_set_mgid((struct sockaddr *)&mc->addr, &mgid, |
573 |
++ gid_type); |
574 |
++ cma_igmp_send(ndev, &mgid, false); |
575 |
+ } |
576 |
++ dev_put(ndev); |
577 |
+ |
578 |
+ cancel_work_sync(&mc->iboe_join.work); |
579 |
+ } |
580 |
+diff --git a/drivers/infiniband/core/ucma.c b/drivers/infiniband/core/ucma.c |
581 |
+index 2b72c4fa95506..9d6ac9dff39a2 100644 |
582 |
+--- a/drivers/infiniband/core/ucma.c |
583 |
++++ b/drivers/infiniband/core/ucma.c |
584 |
+@@ -95,6 +95,7 @@ struct ucma_context { |
585 |
+ u64 uid; |
586 |
+ |
587 |
+ struct list_head list; |
588 |
++ struct list_head mc_list; |
589 |
+ struct work_struct close_work; |
590 |
+ }; |
591 |
+ |
592 |
+@@ -105,6 +106,7 @@ struct ucma_multicast { |
593 |
+ |
594 |
+ u64 uid; |
595 |
+ u8 join_state; |
596 |
++ struct list_head list; |
597 |
+ struct sockaddr_storage addr; |
598 |
+ }; |
599 |
+ |
600 |
+@@ -198,6 +200,7 @@ static struct ucma_context *ucma_alloc_ctx(struct ucma_file *file) |
601 |
+ |
602 |
+ INIT_WORK(&ctx->close_work, ucma_close_id); |
603 |
+ init_completion(&ctx->comp); |
604 |
++ INIT_LIST_HEAD(&ctx->mc_list); |
605 |
+ /* So list_del() will work if we don't do ucma_finish_ctx() */ |
606 |
+ INIT_LIST_HEAD(&ctx->list); |
607 |
+ ctx->file = file; |
608 |
+@@ -484,19 +487,19 @@ err1: |
609 |
+ |
610 |
+ static void ucma_cleanup_multicast(struct ucma_context *ctx) |
611 |
+ { |
612 |
+- struct ucma_multicast *mc; |
613 |
+- unsigned long index; |
614 |
++ struct ucma_multicast *mc, *tmp; |
615 |
+ |
616 |
+- xa_for_each(&multicast_table, index, mc) { |
617 |
+- if (mc->ctx != ctx) |
618 |
+- continue; |
619 |
++ xa_lock(&multicast_table); |
620 |
++ list_for_each_entry_safe(mc, tmp, &ctx->mc_list, list) { |
621 |
++ list_del(&mc->list); |
622 |
+ /* |
623 |
+ * At this point mc->ctx->ref is 0 so the mc cannot leave the |
624 |
+ * lock on the reader and this is enough serialization |
625 |
+ */ |
626 |
+- xa_erase(&multicast_table, index); |
627 |
++ __xa_erase(&multicast_table, mc->id); |
628 |
+ kfree(mc); |
629 |
+ } |
630 |
++ xa_unlock(&multicast_table); |
631 |
+ } |
632 |
+ |
633 |
+ static void ucma_cleanup_mc_events(struct ucma_multicast *mc) |
634 |
+@@ -1469,12 +1472,16 @@ static ssize_t ucma_process_join(struct ucma_file *file, |
635 |
+ mc->uid = cmd->uid; |
636 |
+ memcpy(&mc->addr, addr, cmd->addr_size); |
637 |
+ |
638 |
+- if (xa_alloc(&multicast_table, &mc->id, NULL, xa_limit_32b, |
639 |
++ xa_lock(&multicast_table); |
640 |
++ if (__xa_alloc(&multicast_table, &mc->id, NULL, xa_limit_32b, |
641 |
+ GFP_KERNEL)) { |
642 |
+ ret = -ENOMEM; |
643 |
+ goto err_free_mc; |
644 |
+ } |
645 |
+ |
646 |
++ list_add_tail(&mc->list, &ctx->mc_list); |
647 |
++ xa_unlock(&multicast_table); |
648 |
++ |
649 |
+ mutex_lock(&ctx->mutex); |
650 |
+ ret = rdma_join_multicast(ctx->cm_id, (struct sockaddr *)&mc->addr, |
651 |
+ join_state, mc); |
652 |
+@@ -1500,8 +1507,11 @@ err_leave_multicast: |
653 |
+ mutex_unlock(&ctx->mutex); |
654 |
+ ucma_cleanup_mc_events(mc); |
655 |
+ err_xa_erase: |
656 |
+- xa_erase(&multicast_table, mc->id); |
657 |
++ xa_lock(&multicast_table); |
658 |
++ list_del(&mc->list); |
659 |
++ __xa_erase(&multicast_table, mc->id); |
660 |
+ err_free_mc: |
661 |
++ xa_unlock(&multicast_table); |
662 |
+ kfree(mc); |
663 |
+ err_put_ctx: |
664 |
+ ucma_put_ctx(ctx); |
665 |
+@@ -1569,15 +1579,17 @@ static ssize_t ucma_leave_multicast(struct ucma_file *file, |
666 |
+ mc = ERR_PTR(-EINVAL); |
667 |
+ else if (!refcount_inc_not_zero(&mc->ctx->ref)) |
668 |
+ mc = ERR_PTR(-ENXIO); |
669 |
+- else |
670 |
+- __xa_erase(&multicast_table, mc->id); |
671 |
+- xa_unlock(&multicast_table); |
672 |
+ |
673 |
+ if (IS_ERR(mc)) { |
674 |
++ xa_unlock(&multicast_table); |
675 |
+ ret = PTR_ERR(mc); |
676 |
+ goto out; |
677 |
+ } |
678 |
+ |
679 |
++ list_del(&mc->list); |
680 |
++ __xa_erase(&multicast_table, mc->id); |
681 |
++ xa_unlock(&multicast_table); |
682 |
++ |
683 |
+ mutex_lock(&mc->ctx->mutex); |
684 |
+ rdma_leave_multicast(mc->ctx->cm_id, (struct sockaddr *) &mc->addr); |
685 |
+ mutex_unlock(&mc->ctx->mutex); |
686 |
+diff --git a/drivers/infiniband/hw/hfi1/ipoib_main.c b/drivers/infiniband/hw/hfi1/ipoib_main.c |
687 |
+index e594a961f513e..3e475814b6fa6 100644 |
688 |
+--- a/drivers/infiniband/hw/hfi1/ipoib_main.c |
689 |
++++ b/drivers/infiniband/hw/hfi1/ipoib_main.c |
690 |
+@@ -22,26 +22,35 @@ static int hfi1_ipoib_dev_init(struct net_device *dev) |
691 |
+ int ret; |
692 |
+ |
693 |
+ dev->tstats = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats); |
694 |
++ if (!dev->tstats) |
695 |
++ return -ENOMEM; |
696 |
+ |
697 |
+ ret = priv->netdev_ops->ndo_init(dev); |
698 |
+ if (ret) |
699 |
+- return ret; |
700 |
++ goto out_ret; |
701 |
+ |
702 |
+ ret = hfi1_netdev_add_data(priv->dd, |
703 |
+ qpn_from_mac(priv->netdev->dev_addr), |
704 |
+ dev); |
705 |
+ if (ret < 0) { |
706 |
+ priv->netdev_ops->ndo_uninit(dev); |
707 |
+- return ret; |
708 |
++ goto out_ret; |
709 |
+ } |
710 |
+ |
711 |
+ return 0; |
712 |
++out_ret: |
713 |
++ free_percpu(dev->tstats); |
714 |
++ dev->tstats = NULL; |
715 |
++ return ret; |
716 |
+ } |
717 |
+ |
718 |
+ static void hfi1_ipoib_dev_uninit(struct net_device *dev) |
719 |
+ { |
720 |
+ struct hfi1_ipoib_dev_priv *priv = hfi1_ipoib_priv(dev); |
721 |
+ |
722 |
++ free_percpu(dev->tstats); |
723 |
++ dev->tstats = NULL; |
724 |
++ |
725 |
+ hfi1_netdev_remove_data(priv->dd, qpn_from_mac(priv->netdev->dev_addr)); |
726 |
+ |
727 |
+ priv->netdev_ops->ndo_uninit(dev); |
728 |
+@@ -166,12 +175,7 @@ static void hfi1_ipoib_netdev_dtor(struct net_device *dev) |
729 |
+ hfi1_ipoib_rxq_deinit(priv->netdev); |
730 |
+ |
731 |
+ free_percpu(dev->tstats); |
732 |
+-} |
733 |
+- |
734 |
+-static void hfi1_ipoib_free_rdma_netdev(struct net_device *dev) |
735 |
+-{ |
736 |
+- hfi1_ipoib_netdev_dtor(dev); |
737 |
+- free_netdev(dev); |
738 |
++ dev->tstats = NULL; |
739 |
+ } |
740 |
+ |
741 |
+ static void hfi1_ipoib_set_id(struct net_device *dev, int id) |
742 |
+@@ -211,24 +215,23 @@ static int hfi1_ipoib_setup_rn(struct ib_device *device, |
743 |
+ priv->port_num = port_num; |
744 |
+ priv->netdev_ops = netdev->netdev_ops; |
745 |
+ |
746 |
+- netdev->netdev_ops = &hfi1_ipoib_netdev_ops; |
747 |
+- |
748 |
+ ib_query_pkey(device, port_num, priv->pkey_index, &priv->pkey); |
749 |
+ |
750 |
+ rc = hfi1_ipoib_txreq_init(priv); |
751 |
+ if (rc) { |
752 |
+ dd_dev_err(dd, "IPoIB netdev TX init - failed(%d)\n", rc); |
753 |
+- hfi1_ipoib_free_rdma_netdev(netdev); |
754 |
+ return rc; |
755 |
+ } |
756 |
+ |
757 |
+ rc = hfi1_ipoib_rxq_init(netdev); |
758 |
+ if (rc) { |
759 |
+ dd_dev_err(dd, "IPoIB netdev RX init - failed(%d)\n", rc); |
760 |
+- hfi1_ipoib_free_rdma_netdev(netdev); |
761 |
++ hfi1_ipoib_txreq_deinit(priv); |
762 |
+ return rc; |
763 |
+ } |
764 |
+ |
765 |
++ netdev->netdev_ops = &hfi1_ipoib_netdev_ops; |
766 |
++ |
767 |
+ netdev->priv_destructor = hfi1_ipoib_netdev_dtor; |
768 |
+ netdev->needs_free_netdev = true; |
769 |
+ |
770 |
+diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c |
771 |
+index aec2e1851fa70..53d83212cda81 100644 |
772 |
+--- a/drivers/infiniband/hw/mlx4/main.c |
773 |
++++ b/drivers/infiniband/hw/mlx4/main.c |
774 |
+@@ -3249,7 +3249,7 @@ static void mlx4_ib_event(struct mlx4_dev *dev, void *ibdev_ptr, |
775 |
+ case MLX4_DEV_EVENT_PORT_MGMT_CHANGE: |
776 |
+ ew = kmalloc(sizeof *ew, GFP_ATOMIC); |
777 |
+ if (!ew) |
778 |
+- break; |
779 |
++ return; |
780 |
+ |
781 |
+ INIT_WORK(&ew->work, handle_port_mgmt_change_event); |
782 |
+ memcpy(&ew->ib_eqe, eqe, sizeof *eqe); |
783 |
+diff --git a/drivers/infiniband/sw/rdmavt/qp.c b/drivers/infiniband/sw/rdmavt/qp.c |
784 |
+index 3305f2744bfaa..ae50b56e89132 100644 |
785 |
+--- a/drivers/infiniband/sw/rdmavt/qp.c |
786 |
++++ b/drivers/infiniband/sw/rdmavt/qp.c |
787 |
+@@ -3073,6 +3073,8 @@ do_write: |
788 |
+ case IB_WR_ATOMIC_FETCH_AND_ADD: |
789 |
+ if (unlikely(!(qp->qp_access_flags & IB_ACCESS_REMOTE_ATOMIC))) |
790 |
+ goto inv_err; |
791 |
++ if (unlikely(wqe->atomic_wr.remote_addr & (sizeof(u64) - 1))) |
792 |
++ goto inv_err; |
793 |
+ if (unlikely(!rvt_rkey_ok(qp, &qp->r_sge.sge, sizeof(u64), |
794 |
+ wqe->atomic_wr.remote_addr, |
795 |
+ wqe->atomic_wr.rkey, |
796 |
+diff --git a/drivers/infiniband/sw/siw/siw.h b/drivers/infiniband/sw/siw/siw.h |
797 |
+index 368959ae9a8cc..df03d84c6868a 100644 |
798 |
+--- a/drivers/infiniband/sw/siw/siw.h |
799 |
++++ b/drivers/infiniband/sw/siw/siw.h |
800 |
+@@ -644,14 +644,9 @@ static inline struct siw_sqe *orq_get_current(struct siw_qp *qp) |
801 |
+ return &qp->orq[qp->orq_get % qp->attrs.orq_size]; |
802 |
+ } |
803 |
+ |
804 |
+-static inline struct siw_sqe *orq_get_tail(struct siw_qp *qp) |
805 |
+-{ |
806 |
+- return &qp->orq[qp->orq_put % qp->attrs.orq_size]; |
807 |
+-} |
808 |
+- |
809 |
+ static inline struct siw_sqe *orq_get_free(struct siw_qp *qp) |
810 |
+ { |
811 |
+- struct siw_sqe *orq_e = orq_get_tail(qp); |
812 |
++ struct siw_sqe *orq_e = &qp->orq[qp->orq_put % qp->attrs.orq_size]; |
813 |
+ |
814 |
+ if (READ_ONCE(orq_e->flags) == 0) |
815 |
+ return orq_e; |
816 |
+diff --git a/drivers/infiniband/sw/siw/siw_qp_rx.c b/drivers/infiniband/sw/siw/siw_qp_rx.c |
817 |
+index 60116f20653c7..875ea6f1b04a2 100644 |
818 |
+--- a/drivers/infiniband/sw/siw/siw_qp_rx.c |
819 |
++++ b/drivers/infiniband/sw/siw/siw_qp_rx.c |
820 |
+@@ -1153,11 +1153,12 @@ static int siw_check_tx_fence(struct siw_qp *qp) |
821 |
+ |
822 |
+ spin_lock_irqsave(&qp->orq_lock, flags); |
823 |
+ |
824 |
+- rreq = orq_get_current(qp); |
825 |
+- |
826 |
+ /* free current orq entry */ |
827 |
++ rreq = orq_get_current(qp); |
828 |
+ WRITE_ONCE(rreq->flags, 0); |
829 |
+ |
830 |
++ qp->orq_get++; |
831 |
++ |
832 |
+ if (qp->tx_ctx.orq_fence) { |
833 |
+ if (unlikely(tx_waiting->wr_status != SIW_WR_QUEUED)) { |
834 |
+ pr_warn("siw: [QP %u]: fence resume: bad status %d\n", |
835 |
+@@ -1165,10 +1166,12 @@ static int siw_check_tx_fence(struct siw_qp *qp) |
836 |
+ rv = -EPROTO; |
837 |
+ goto out; |
838 |
+ } |
839 |
+- /* resume SQ processing */ |
840 |
++ /* resume SQ processing, if possible */ |
841 |
+ if (tx_waiting->sqe.opcode == SIW_OP_READ || |
842 |
+ tx_waiting->sqe.opcode == SIW_OP_READ_LOCAL_INV) { |
843 |
+- rreq = orq_get_tail(qp); |
844 |
++ |
845 |
++ /* SQ processing was stopped because of a full ORQ */ |
846 |
++ rreq = orq_get_free(qp); |
847 |
+ if (unlikely(!rreq)) { |
848 |
+ pr_warn("siw: [QP %u]: no ORQE\n", qp_id(qp)); |
849 |
+ rv = -EPROTO; |
850 |
+@@ -1181,15 +1184,14 @@ static int siw_check_tx_fence(struct siw_qp *qp) |
851 |
+ resume_tx = 1; |
852 |
+ |
853 |
+ } else if (siw_orq_empty(qp)) { |
854 |
++ /* |
855 |
++ * SQ processing was stopped by fenced work request. |
856 |
++ * Resume since all previous Read's are now completed. |
857 |
++ */ |
858 |
+ qp->tx_ctx.orq_fence = 0; |
859 |
+ resume_tx = 1; |
860 |
+- } else { |
861 |
+- pr_warn("siw: [QP %u]: fence resume: orq idx: %d:%d\n", |
862 |
+- qp_id(qp), qp->orq_get, qp->orq_put); |
863 |
+- rv = -EPROTO; |
864 |
+ } |
865 |
+ } |
866 |
+- qp->orq_get++; |
867 |
+ out: |
868 |
+ spin_unlock_irqrestore(&qp->orq_lock, flags); |
869 |
+ |
870 |
+diff --git a/drivers/infiniband/sw/siw/siw_verbs.c b/drivers/infiniband/sw/siw/siw_verbs.c |
871 |
+index 1b36350601faa..aa3f60d54a70f 100644 |
872 |
+--- a/drivers/infiniband/sw/siw/siw_verbs.c |
873 |
++++ b/drivers/infiniband/sw/siw/siw_verbs.c |
874 |
+@@ -311,7 +311,8 @@ int siw_create_qp(struct ib_qp *ibqp, struct ib_qp_init_attr *attrs, |
875 |
+ |
876 |
+ if (atomic_inc_return(&sdev->num_qp) > SIW_MAX_QP) { |
877 |
+ siw_dbg(base_dev, "too many QP's\n"); |
878 |
+- return -ENOMEM; |
879 |
++ rv = -ENOMEM; |
880 |
++ goto err_atomic; |
881 |
+ } |
882 |
+ if (attrs->qp_type != IB_QPT_RC) { |
883 |
+ siw_dbg(base_dev, "only RC QP's supported\n"); |
884 |
+diff --git a/drivers/iommu/amd/init.c b/drivers/iommu/amd/init.c |
885 |
+index 50e5a728f12a1..72cad85e5e5f3 100644 |
886 |
+--- a/drivers/iommu/amd/init.c |
887 |
++++ b/drivers/iommu/amd/init.c |
888 |
+@@ -21,6 +21,7 @@ |
889 |
+ #include <linux/export.h> |
890 |
+ #include <linux/kmemleak.h> |
891 |
+ #include <linux/mem_encrypt.h> |
892 |
++#include <linux/iopoll.h> |
893 |
+ #include <asm/pci-direct.h> |
894 |
+ #include <asm/iommu.h> |
895 |
+ #include <asm/apic.h> |
896 |
+@@ -832,6 +833,7 @@ static int iommu_ga_log_enable(struct amd_iommu *iommu) |
897 |
+ status = readl(iommu->mmio_base + MMIO_STATUS_OFFSET); |
898 |
+ if (status & (MMIO_STATUS_GALOG_RUN_MASK)) |
899 |
+ break; |
900 |
++ udelay(10); |
901 |
+ } |
902 |
+ |
903 |
+ if (WARN_ON(i >= LOOP_TIMEOUT)) |
904 |
+diff --git a/drivers/iommu/intel/irq_remapping.c b/drivers/iommu/intel/irq_remapping.c |
905 |
+index f912fe45bea2c..a673195978843 100644 |
906 |
+--- a/drivers/iommu/intel/irq_remapping.c |
907 |
++++ b/drivers/iommu/intel/irq_remapping.c |
908 |
+@@ -569,9 +569,8 @@ static int intel_setup_irq_remapping(struct intel_iommu *iommu) |
909 |
+ fn, &intel_ir_domain_ops, |
910 |
+ iommu); |
911 |
+ if (!iommu->ir_domain) { |
912 |
+- irq_domain_free_fwnode(fn); |
913 |
+ pr_err("IR%d: failed to allocate irqdomain\n", iommu->seq_id); |
914 |
+- goto out_free_bitmap; |
915 |
++ goto out_free_fwnode; |
916 |
+ } |
917 |
+ iommu->ir_msi_domain = |
918 |
+ arch_create_remap_msi_irq_domain(iommu->ir_domain, |
919 |
+@@ -595,7 +594,7 @@ static int intel_setup_irq_remapping(struct intel_iommu *iommu) |
920 |
+ |
921 |
+ if (dmar_enable_qi(iommu)) { |
922 |
+ pr_err("Failed to enable queued invalidation\n"); |
923 |
+- goto out_free_bitmap; |
924 |
++ goto out_free_ir_domain; |
925 |
+ } |
926 |
+ } |
927 |
+ |
928 |
+@@ -619,6 +618,14 @@ static int intel_setup_irq_remapping(struct intel_iommu *iommu) |
929 |
+ |
930 |
+ return 0; |
931 |
+ |
932 |
++out_free_ir_domain: |
933 |
++ if (iommu->ir_msi_domain) |
934 |
++ irq_domain_remove(iommu->ir_msi_domain); |
935 |
++ iommu->ir_msi_domain = NULL; |
936 |
++ irq_domain_remove(iommu->ir_domain); |
937 |
++ iommu->ir_domain = NULL; |
938 |
++out_free_fwnode: |
939 |
++ irq_domain_free_fwnode(fn); |
940 |
+ out_free_bitmap: |
941 |
+ bitmap_free(bitmap); |
942 |
+ out_free_pages: |
943 |
+diff --git a/drivers/net/dsa/Kconfig b/drivers/net/dsa/Kconfig |
944 |
+index a5f1aa911fe2a..9891b072b4625 100644 |
945 |
+--- a/drivers/net/dsa/Kconfig |
946 |
++++ b/drivers/net/dsa/Kconfig |
947 |
+@@ -36,6 +36,7 @@ config NET_DSA_LANTIQ_GSWIP |
948 |
+ config NET_DSA_MT7530 |
949 |
+ tristate "MediaTek MT753x and MT7621 Ethernet switch support" |
950 |
+ select NET_DSA_TAG_MTK |
951 |
++ select MEDIATEK_GE_PHY |
952 |
+ help |
953 |
+ This enables support for the MediaTek MT7530, MT7531, and MT7621 |
954 |
+ Ethernet switch chips. |
955 |
+diff --git a/drivers/net/ethernet/google/gve/gve_adminq.c b/drivers/net/ethernet/google/gve/gve_adminq.c |
956 |
+index f089d33dd48e0..ce507464f3d62 100644 |
957 |
+--- a/drivers/net/ethernet/google/gve/gve_adminq.c |
958 |
++++ b/drivers/net/ethernet/google/gve/gve_adminq.c |
959 |
+@@ -281,7 +281,7 @@ static int gve_adminq_parse_err(struct gve_priv *priv, u32 status) |
960 |
+ */ |
961 |
+ static int gve_adminq_kick_and_wait(struct gve_priv *priv) |
962 |
+ { |
963 |
+- u32 tail, head; |
964 |
++ int tail, head; |
965 |
+ int i; |
966 |
+ |
967 |
+ tail = ioread32be(&priv->reg_bar0->adminq_event_counter); |
968 |
+diff --git a/drivers/net/ethernet/intel/e1000e/e1000.h b/drivers/net/ethernet/intel/e1000e/e1000.h |
969 |
+index 3178efd980066..eb6961d901c16 100644 |
970 |
+--- a/drivers/net/ethernet/intel/e1000e/e1000.h |
971 |
++++ b/drivers/net/ethernet/intel/e1000e/e1000.h |
972 |
+@@ -114,7 +114,8 @@ enum e1000_boards { |
973 |
+ board_pch_lpt, |
974 |
+ board_pch_spt, |
975 |
+ board_pch_cnp, |
976 |
+- board_pch_tgp |
977 |
++ board_pch_tgp, |
978 |
++ board_pch_adp |
979 |
+ }; |
980 |
+ |
981 |
+ struct e1000_ps_page { |
982 |
+@@ -501,6 +502,7 @@ extern const struct e1000_info e1000_pch_lpt_info; |
983 |
+ extern const struct e1000_info e1000_pch_spt_info; |
984 |
+ extern const struct e1000_info e1000_pch_cnp_info; |
985 |
+ extern const struct e1000_info e1000_pch_tgp_info; |
986 |
++extern const struct e1000_info e1000_pch_adp_info; |
987 |
+ extern const struct e1000_info e1000_es2_info; |
988 |
+ |
989 |
+ void e1000e_ptp_init(struct e1000_adapter *adapter); |
990 |
+diff --git a/drivers/net/ethernet/intel/e1000e/ich8lan.c b/drivers/net/ethernet/intel/e1000e/ich8lan.c |
991 |
+index 5e4fc9b4e2adb..c908c84b86d22 100644 |
992 |
+--- a/drivers/net/ethernet/intel/e1000e/ich8lan.c |
993 |
++++ b/drivers/net/ethernet/intel/e1000e/ich8lan.c |
994 |
+@@ -6021,3 +6021,23 @@ const struct e1000_info e1000_pch_tgp_info = { |
995 |
+ .phy_ops = &ich8_phy_ops, |
996 |
+ .nvm_ops = &spt_nvm_ops, |
997 |
+ }; |
998 |
++ |
999 |
++const struct e1000_info e1000_pch_adp_info = { |
1000 |
++ .mac = e1000_pch_adp, |
1001 |
++ .flags = FLAG_IS_ICH |
1002 |
++ | FLAG_HAS_WOL |
1003 |
++ | FLAG_HAS_HW_TIMESTAMP |
1004 |
++ | FLAG_HAS_CTRLEXT_ON_LOAD |
1005 |
++ | FLAG_HAS_AMT |
1006 |
++ | FLAG_HAS_FLASH |
1007 |
++ | FLAG_HAS_JUMBO_FRAMES |
1008 |
++ | FLAG_APME_IN_WUC, |
1009 |
++ .flags2 = FLAG2_HAS_PHY_STATS |
1010 |
++ | FLAG2_HAS_EEE, |
1011 |
++ .pba = 26, |
1012 |
++ .max_hw_frame_size = 9022, |
1013 |
++ .get_variants = e1000_get_variants_ich8lan, |
1014 |
++ .mac_ops = &ich8_mac_ops, |
1015 |
++ .phy_ops = &ich8_phy_ops, |
1016 |
++ .nvm_ops = &spt_nvm_ops, |
1017 |
++}; |
1018 |
+diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c |
1019 |
+index 276a0aa1ed4ab..af2029bb43e35 100644 |
1020 |
+--- a/drivers/net/ethernet/intel/e1000e/netdev.c |
1021 |
++++ b/drivers/net/ethernet/intel/e1000e/netdev.c |
1022 |
+@@ -52,6 +52,7 @@ static const struct e1000_info *e1000_info_tbl[] = { |
1023 |
+ [board_pch_spt] = &e1000_pch_spt_info, |
1024 |
+ [board_pch_cnp] = &e1000_pch_cnp_info, |
1025 |
+ [board_pch_tgp] = &e1000_pch_tgp_info, |
1026 |
++ [board_pch_adp] = &e1000_pch_adp_info, |
1027 |
+ }; |
1028 |
+ |
1029 |
+ struct e1000_reg_info { |
1030 |
+@@ -7905,22 +7906,22 @@ static const struct pci_device_id e1000_pci_tbl[] = { |
1031 |
+ { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_TGP_I219_V14), board_pch_tgp }, |
1032 |
+ { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_TGP_I219_LM15), board_pch_tgp }, |
1033 |
+ { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_TGP_I219_V15), board_pch_tgp }, |
1034 |
+- { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_RPL_I219_LM23), board_pch_tgp }, |
1035 |
+- { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_RPL_I219_V23), board_pch_tgp }, |
1036 |
+- { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_ADP_I219_LM16), board_pch_tgp }, |
1037 |
+- { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_ADP_I219_V16), board_pch_tgp }, |
1038 |
+- { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_ADP_I219_LM17), board_pch_tgp }, |
1039 |
+- { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_ADP_I219_V17), board_pch_tgp }, |
1040 |
+- { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_RPL_I219_LM22), board_pch_tgp }, |
1041 |
+- { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_RPL_I219_V22), board_pch_tgp }, |
1042 |
+- { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_MTP_I219_LM18), board_pch_tgp }, |
1043 |
+- { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_MTP_I219_V18), board_pch_tgp }, |
1044 |
+- { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_MTP_I219_LM19), board_pch_tgp }, |
1045 |
+- { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_MTP_I219_V19), board_pch_tgp }, |
1046 |
+- { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_LNP_I219_LM20), board_pch_tgp }, |
1047 |
+- { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_LNP_I219_V20), board_pch_tgp }, |
1048 |
+- { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_LNP_I219_LM21), board_pch_tgp }, |
1049 |
+- { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_LNP_I219_V21), board_pch_tgp }, |
1050 |
++ { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_RPL_I219_LM23), board_pch_adp }, |
1051 |
++ { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_RPL_I219_V23), board_pch_adp }, |
1052 |
++ { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_ADP_I219_LM16), board_pch_adp }, |
1053 |
++ { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_ADP_I219_V16), board_pch_adp }, |
1054 |
++ { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_ADP_I219_LM17), board_pch_adp }, |
1055 |
++ { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_ADP_I219_V17), board_pch_adp }, |
1056 |
++ { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_RPL_I219_LM22), board_pch_adp }, |
1057 |
++ { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_RPL_I219_V22), board_pch_adp }, |
1058 |
++ { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_MTP_I219_LM18), board_pch_adp }, |
1059 |
++ { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_MTP_I219_V18), board_pch_adp }, |
1060 |
++ { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_MTP_I219_LM19), board_pch_adp }, |
1061 |
++ { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_MTP_I219_V19), board_pch_adp }, |
1062 |
++ { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_LNP_I219_LM20), board_pch_adp }, |
1063 |
++ { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_LNP_I219_V20), board_pch_adp }, |
1064 |
++ { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_LNP_I219_LM21), board_pch_adp }, |
1065 |
++ { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_LNP_I219_V21), board_pch_adp }, |
1066 |
+ |
1067 |
+ { 0, 0, 0, 0, 0, 0, 0 } /* terminate list */ |
1068 |
+ }; |
1069 |
+diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-visconti.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-visconti.c |
1070 |
+index 4578c64953eac..c27441c08dd6f 100644 |
1071 |
+--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-visconti.c |
1072 |
++++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-visconti.c |
1073 |
+@@ -49,13 +49,15 @@ struct visconti_eth { |
1074 |
+ void __iomem *reg; |
1075 |
+ u32 phy_intf_sel; |
1076 |
+ struct clk *phy_ref_clk; |
1077 |
++ struct device *dev; |
1078 |
+ spinlock_t lock; /* lock to protect register update */ |
1079 |
+ }; |
1080 |
+ |
1081 |
+ static void visconti_eth_fix_mac_speed(void *priv, unsigned int speed) |
1082 |
+ { |
1083 |
+ struct visconti_eth *dwmac = priv; |
1084 |
+- unsigned int val, clk_sel_val; |
1085 |
++ struct net_device *netdev = dev_get_drvdata(dwmac->dev); |
1086 |
++ unsigned int val, clk_sel_val = 0; |
1087 |
+ unsigned long flags; |
1088 |
+ |
1089 |
+ spin_lock_irqsave(&dwmac->lock, flags); |
1090 |
+@@ -85,7 +87,9 @@ static void visconti_eth_fix_mac_speed(void *priv, unsigned int speed) |
1091 |
+ break; |
1092 |
+ default: |
1093 |
+ /* No bit control */ |
1094 |
+- break; |
1095 |
++ netdev_err(netdev, "Unsupported speed request (%d)", speed); |
1096 |
++ spin_unlock_irqrestore(&dwmac->lock, flags); |
1097 |
++ return; |
1098 |
+ } |
1099 |
+ |
1100 |
+ writel(val, dwmac->reg + MAC_CTRL_REG); |
1101 |
+@@ -230,6 +234,7 @@ static int visconti_eth_dwmac_probe(struct platform_device *pdev) |
1102 |
+ |
1103 |
+ spin_lock_init(&dwmac->lock); |
1104 |
+ dwmac->reg = stmmac_res.addr; |
1105 |
++ dwmac->dev = &pdev->dev; |
1106 |
+ plat_dat->bsp_priv = dwmac; |
1107 |
+ plat_dat->fix_mac_speed = visconti_eth_fix_mac_speed; |
1108 |
+ |
1109 |
+diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac_dma.h b/drivers/net/ethernet/stmicro/stmmac/dwmac_dma.h |
1110 |
+index 1914ad698cab2..acd70b9a3173c 100644 |
1111 |
+--- a/drivers/net/ethernet/stmicro/stmmac/dwmac_dma.h |
1112 |
++++ b/drivers/net/ethernet/stmicro/stmmac/dwmac_dma.h |
1113 |
+@@ -150,6 +150,7 @@ |
1114 |
+ |
1115 |
+ #define NUM_DWMAC100_DMA_REGS 9 |
1116 |
+ #define NUM_DWMAC1000_DMA_REGS 23 |
1117 |
++#define NUM_DWMAC4_DMA_REGS 27 |
1118 |
+ |
1119 |
+ void dwmac_enable_dma_transmission(void __iomem *ioaddr); |
1120 |
+ void dwmac_enable_dma_irq(void __iomem *ioaddr, u32 chan, bool rx, bool tx); |
1121 |
+diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c |
1122 |
+index d89455803beda..8f563b446d5ca 100644 |
1123 |
+--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c |
1124 |
++++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c |
1125 |
+@@ -21,10 +21,18 @@ |
1126 |
+ #include "dwxgmac2.h" |
1127 |
+ |
1128 |
+ #define REG_SPACE_SIZE 0x1060 |
1129 |
++#define GMAC4_REG_SPACE_SIZE 0x116C |
1130 |
+ #define MAC100_ETHTOOL_NAME "st_mac100" |
1131 |
+ #define GMAC_ETHTOOL_NAME "st_gmac" |
1132 |
+ #define XGMAC_ETHTOOL_NAME "st_xgmac" |
1133 |
+ |
1134 |
++/* Same as DMA_CHAN_BASE_ADDR defined in dwmac4_dma.h |
1135 |
++ * |
1136 |
++ * It is here because dwmac_dma.h and dwmac4_dam.h can not be included at the |
1137 |
++ * same time due to the conflicting macro names. |
1138 |
++ */ |
1139 |
++#define GMAC4_DMA_CHAN_BASE_ADDR 0x00001100 |
1140 |
++ |
1141 |
+ #define ETHTOOL_DMA_OFFSET 55 |
1142 |
+ |
1143 |
+ struct stmmac_stats { |
1144 |
+@@ -435,6 +443,8 @@ static int stmmac_ethtool_get_regs_len(struct net_device *dev) |
1145 |
+ |
1146 |
+ if (priv->plat->has_xgmac) |
1147 |
+ return XGMAC_REGSIZE * 4; |
1148 |
++ else if (priv->plat->has_gmac4) |
1149 |
++ return GMAC4_REG_SPACE_SIZE; |
1150 |
+ return REG_SPACE_SIZE; |
1151 |
+ } |
1152 |
+ |
1153 |
+@@ -447,8 +457,13 @@ static void stmmac_ethtool_gregs(struct net_device *dev, |
1154 |
+ stmmac_dump_mac_regs(priv, priv->hw, reg_space); |
1155 |
+ stmmac_dump_dma_regs(priv, priv->ioaddr, reg_space); |
1156 |
+ |
1157 |
+- if (!priv->plat->has_xgmac) { |
1158 |
+- /* Copy DMA registers to where ethtool expects them */ |
1159 |
++ /* Copy DMA registers to where ethtool expects them */ |
1160 |
++ if (priv->plat->has_gmac4) { |
1161 |
++ /* GMAC4 dumps its DMA registers at its DMA_CHAN_BASE_ADDR */ |
1162 |
++ memcpy(®_space[ETHTOOL_DMA_OFFSET], |
1163 |
++ ®_space[GMAC4_DMA_CHAN_BASE_ADDR / 4], |
1164 |
++ NUM_DWMAC4_DMA_REGS * 4); |
1165 |
++ } else if (!priv->plat->has_xgmac) { |
1166 |
+ memcpy(®_space[ETHTOOL_DMA_OFFSET], |
1167 |
+ ®_space[DMA_BUS_MODE / 4], |
1168 |
+ NUM_DWMAC1000_DMA_REGS * 4); |
1169 |
+diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c |
1170 |
+index 074e2cdfb0fa6..a7ec9f4d46ced 100644 |
1171 |
+--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c |
1172 |
++++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c |
1173 |
+@@ -145,15 +145,20 @@ static int adjust_systime(void __iomem *ioaddr, u32 sec, u32 nsec, |
1174 |
+ |
1175 |
+ static void get_systime(void __iomem *ioaddr, u64 *systime) |
1176 |
+ { |
1177 |
+- u64 ns; |
1178 |
+- |
1179 |
+- /* Get the TSSS value */ |
1180 |
+- ns = readl(ioaddr + PTP_STNSR); |
1181 |
+- /* Get the TSS and convert sec time value to nanosecond */ |
1182 |
+- ns += readl(ioaddr + PTP_STSR) * 1000000000ULL; |
1183 |
++ u64 ns, sec0, sec1; |
1184 |
++ |
1185 |
++ /* Get the TSS value */ |
1186 |
++ sec1 = readl_relaxed(ioaddr + PTP_STSR); |
1187 |
++ do { |
1188 |
++ sec0 = sec1; |
1189 |
++ /* Get the TSSS value */ |
1190 |
++ ns = readl_relaxed(ioaddr + PTP_STNSR); |
1191 |
++ /* Get the TSS value */ |
1192 |
++ sec1 = readl_relaxed(ioaddr + PTP_STSR); |
1193 |
++ } while (sec0 != sec1); |
1194 |
+ |
1195 |
+ if (systime) |
1196 |
+- *systime = ns; |
1197 |
++ *systime = ns + (sec1 * 1000000000ULL); |
1198 |
+ } |
1199 |
+ |
1200 |
+ static void get_ptptime(void __iomem *ptpaddr, u64 *ptp_time) |
1201 |
+diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c |
1202 |
+index 9f3d18abf62b3..161e65333ed94 100644 |
1203 |
+--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c |
1204 |
++++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c |
1205 |
+@@ -7120,6 +7120,10 @@ int stmmac_dvr_remove(struct device *dev) |
1206 |
+ |
1207 |
+ netdev_info(priv->dev, "%s: removing driver", __func__); |
1208 |
+ |
1209 |
++ pm_runtime_get_sync(dev); |
1210 |
++ pm_runtime_disable(dev); |
1211 |
++ pm_runtime_put_noidle(dev); |
1212 |
++ |
1213 |
+ stmmac_stop_all_dma(priv); |
1214 |
+ stmmac_mac_set(priv, priv->ioaddr, false); |
1215 |
+ netif_carrier_off(ndev); |
1216 |
+@@ -7138,8 +7142,6 @@ int stmmac_dvr_remove(struct device *dev) |
1217 |
+ if (priv->plat->stmmac_rst) |
1218 |
+ reset_control_assert(priv->plat->stmmac_rst); |
1219 |
+ reset_control_assert(priv->plat->stmmac_ahb_rst); |
1220 |
+- pm_runtime_put(dev); |
1221 |
+- pm_runtime_disable(dev); |
1222 |
+ if (priv->hw->pcs != STMMAC_PCS_TBI && |
1223 |
+ priv->hw->pcs != STMMAC_PCS_RTBI) |
1224 |
+ stmmac_mdio_unregister(ndev); |
1225 |
+diff --git a/drivers/net/ieee802154/ca8210.c b/drivers/net/ieee802154/ca8210.c |
1226 |
+index 3a2824f24caa8..97fbe850de9ba 100644 |
1227 |
+--- a/drivers/net/ieee802154/ca8210.c |
1228 |
++++ b/drivers/net/ieee802154/ca8210.c |
1229 |
+@@ -1771,6 +1771,7 @@ static int ca8210_async_xmit_complete( |
1230 |
+ status |
1231 |
+ ); |
1232 |
+ if (status != MAC_TRANSACTION_OVERFLOW) { |
1233 |
++ dev_kfree_skb_any(priv->tx_skb); |
1234 |
+ ieee802154_wake_queue(priv->hw); |
1235 |
+ return 0; |
1236 |
+ } |
1237 |
+diff --git a/drivers/net/ieee802154/mac802154_hwsim.c b/drivers/net/ieee802154/mac802154_hwsim.c |
1238 |
+index 8caa61ec718f5..36f1c5aa98fc6 100644 |
1239 |
+--- a/drivers/net/ieee802154/mac802154_hwsim.c |
1240 |
++++ b/drivers/net/ieee802154/mac802154_hwsim.c |
1241 |
+@@ -786,6 +786,7 @@ static int hwsim_add_one(struct genl_info *info, struct device *dev, |
1242 |
+ goto err_pib; |
1243 |
+ } |
1244 |
+ |
1245 |
++ pib->channel = 13; |
1246 |
+ rcu_assign_pointer(phy->pib, pib); |
1247 |
+ phy->idx = idx; |
1248 |
+ INIT_LIST_HEAD(&phy->edges); |
1249 |
+diff --git a/drivers/net/ieee802154/mcr20a.c b/drivers/net/ieee802154/mcr20a.c |
1250 |
+index 8dc04e2590b18..383231b854642 100644 |
1251 |
+--- a/drivers/net/ieee802154/mcr20a.c |
1252 |
++++ b/drivers/net/ieee802154/mcr20a.c |
1253 |
+@@ -976,8 +976,8 @@ static void mcr20a_hw_setup(struct mcr20a_local *lp) |
1254 |
+ dev_dbg(printdev(lp), "%s\n", __func__); |
1255 |
+ |
1256 |
+ phy->symbol_duration = 16; |
1257 |
+- phy->lifs_period = 40; |
1258 |
+- phy->sifs_period = 12; |
1259 |
++ phy->lifs_period = 40 * phy->symbol_duration; |
1260 |
++ phy->sifs_period = 12 * phy->symbol_duration; |
1261 |
+ |
1262 |
+ hw->flags = IEEE802154_HW_TX_OMIT_CKSUM | |
1263 |
+ IEEE802154_HW_AFILT | |
1264 |
+diff --git a/drivers/net/macsec.c b/drivers/net/macsec.c |
1265 |
+index 93dc48b9b4f24..e53b40359fd10 100644 |
1266 |
+--- a/drivers/net/macsec.c |
1267 |
++++ b/drivers/net/macsec.c |
1268 |
+@@ -3870,6 +3870,18 @@ static void macsec_common_dellink(struct net_device *dev, struct list_head *head |
1269 |
+ struct macsec_dev *macsec = macsec_priv(dev); |
1270 |
+ struct net_device *real_dev = macsec->real_dev; |
1271 |
+ |
1272 |
++ /* If h/w offloading is available, propagate to the device */ |
1273 |
++ if (macsec_is_offloaded(macsec)) { |
1274 |
++ const struct macsec_ops *ops; |
1275 |
++ struct macsec_context ctx; |
1276 |
++ |
1277 |
++ ops = macsec_get_ops(netdev_priv(dev), &ctx); |
1278 |
++ if (ops) { |
1279 |
++ ctx.secy = &macsec->secy; |
1280 |
++ macsec_offload(ops->mdo_del_secy, &ctx); |
1281 |
++ } |
1282 |
++ } |
1283 |
++ |
1284 |
+ unregister_netdevice_queue(dev, head); |
1285 |
+ list_del_rcu(&macsec->secys); |
1286 |
+ macsec_del_dev(macsec); |
1287 |
+@@ -3884,18 +3896,6 @@ static void macsec_dellink(struct net_device *dev, struct list_head *head) |
1288 |
+ struct net_device *real_dev = macsec->real_dev; |
1289 |
+ struct macsec_rxh_data *rxd = macsec_data_rtnl(real_dev); |
1290 |
+ |
1291 |
+- /* If h/w offloading is available, propagate to the device */ |
1292 |
+- if (macsec_is_offloaded(macsec)) { |
1293 |
+- const struct macsec_ops *ops; |
1294 |
+- struct macsec_context ctx; |
1295 |
+- |
1296 |
+- ops = macsec_get_ops(netdev_priv(dev), &ctx); |
1297 |
+- if (ops) { |
1298 |
+- ctx.secy = &macsec->secy; |
1299 |
+- macsec_offload(ops->mdo_del_secy, &ctx); |
1300 |
+- } |
1301 |
+- } |
1302 |
+- |
1303 |
+ macsec_common_dellink(dev, head); |
1304 |
+ |
1305 |
+ if (list_empty(&rxd->secys)) { |
1306 |
+@@ -4018,6 +4018,15 @@ static int macsec_newlink(struct net *net, struct net_device *dev, |
1307 |
+ !macsec_check_offload(macsec->offload, macsec)) |
1308 |
+ return -EOPNOTSUPP; |
1309 |
+ |
1310 |
++ /* send_sci must be set to true when transmit sci explicitly is set */ |
1311 |
++ if ((data && data[IFLA_MACSEC_SCI]) && |
1312 |
++ (data && data[IFLA_MACSEC_INC_SCI])) { |
1313 |
++ u8 send_sci = !!nla_get_u8(data[IFLA_MACSEC_INC_SCI]); |
1314 |
++ |
1315 |
++ if (!send_sci) |
1316 |
++ return -EINVAL; |
1317 |
++ } |
1318 |
++ |
1319 |
+ if (data && data[IFLA_MACSEC_ICV_LEN]) |
1320 |
+ icv_len = nla_get_u8(data[IFLA_MACSEC_ICV_LEN]); |
1321 |
+ mtu = real_dev->mtu - icv_len - macsec_extra_len(true); |
1322 |
+diff --git a/drivers/nvme/host/fabrics.h b/drivers/nvme/host/fabrics.h |
1323 |
+index a146cb903869c..561c2abd3892b 100644 |
1324 |
+--- a/drivers/nvme/host/fabrics.h |
1325 |
++++ b/drivers/nvme/host/fabrics.h |
1326 |
+@@ -169,6 +169,7 @@ nvmf_ctlr_matches_baseopts(struct nvme_ctrl *ctrl, |
1327 |
+ struct nvmf_ctrl_options *opts) |
1328 |
+ { |
1329 |
+ if (ctrl->state == NVME_CTRL_DELETING || |
1330 |
++ ctrl->state == NVME_CTRL_DELETING_NOIO || |
1331 |
+ ctrl->state == NVME_CTRL_DEAD || |
1332 |
+ strcmp(opts->subsysnqn, ctrl->opts->subsysnqn) || |
1333 |
+ strcmp(opts->host->nqn, ctrl->opts->host->nqn) || |
1334 |
+diff --git a/drivers/pinctrl/bcm/pinctrl-bcm2835.c b/drivers/pinctrl/bcm/pinctrl-bcm2835.c |
1335 |
+index cc39c0e18b474..cb339299adf92 100644 |
1336 |
+--- a/drivers/pinctrl/bcm/pinctrl-bcm2835.c |
1337 |
++++ b/drivers/pinctrl/bcm/pinctrl-bcm2835.c |
1338 |
+@@ -1263,16 +1263,18 @@ static int bcm2835_pinctrl_probe(struct platform_device *pdev) |
1339 |
+ sizeof(*girq->parents), |
1340 |
+ GFP_KERNEL); |
1341 |
+ if (!girq->parents) { |
1342 |
+- pinctrl_remove_gpio_range(pc->pctl_dev, &pc->gpio_range); |
1343 |
+- return -ENOMEM; |
1344 |
++ err = -ENOMEM; |
1345 |
++ goto out_remove; |
1346 |
+ } |
1347 |
+ |
1348 |
+ if (is_7211) { |
1349 |
+ pc->wake_irq = devm_kcalloc(dev, BCM2835_NUM_IRQS, |
1350 |
+ sizeof(*pc->wake_irq), |
1351 |
+ GFP_KERNEL); |
1352 |
+- if (!pc->wake_irq) |
1353 |
+- return -ENOMEM; |
1354 |
++ if (!pc->wake_irq) { |
1355 |
++ err = -ENOMEM; |
1356 |
++ goto out_remove; |
1357 |
++ } |
1358 |
+ } |
1359 |
+ |
1360 |
+ /* |
1361 |
+@@ -1300,8 +1302,10 @@ static int bcm2835_pinctrl_probe(struct platform_device *pdev) |
1362 |
+ |
1363 |
+ len = strlen(dev_name(pc->dev)) + 16; |
1364 |
+ name = devm_kzalloc(pc->dev, len, GFP_KERNEL); |
1365 |
+- if (!name) |
1366 |
+- return -ENOMEM; |
1367 |
++ if (!name) { |
1368 |
++ err = -ENOMEM; |
1369 |
++ goto out_remove; |
1370 |
++ } |
1371 |
+ |
1372 |
+ snprintf(name, len, "%s:bank%d", dev_name(pc->dev), i); |
1373 |
+ |
1374 |
+@@ -1320,11 +1324,14 @@ static int bcm2835_pinctrl_probe(struct platform_device *pdev) |
1375 |
+ err = gpiochip_add_data(&pc->gpio_chip, pc); |
1376 |
+ if (err) { |
1377 |
+ dev_err(dev, "could not add GPIO chip\n"); |
1378 |
+- pinctrl_remove_gpio_range(pc->pctl_dev, &pc->gpio_range); |
1379 |
+- return err; |
1380 |
++ goto out_remove; |
1381 |
+ } |
1382 |
+ |
1383 |
+ return 0; |
1384 |
++ |
1385 |
++out_remove: |
1386 |
++ pinctrl_remove_gpio_range(pc->pctl_dev, &pc->gpio_range); |
1387 |
++ return err; |
1388 |
+ } |
1389 |
+ |
1390 |
+ static struct platform_driver bcm2835_pinctrl_driver = { |
1391 |
+diff --git a/drivers/pinctrl/intel/pinctrl-intel.c b/drivers/pinctrl/intel/pinctrl-intel.c |
1392 |
+index 85750974d1825..826d494f3cc66 100644 |
1393 |
+--- a/drivers/pinctrl/intel/pinctrl-intel.c |
1394 |
++++ b/drivers/pinctrl/intel/pinctrl-intel.c |
1395 |
+@@ -451,8 +451,8 @@ static void intel_gpio_set_gpio_mode(void __iomem *padcfg0) |
1396 |
+ value &= ~PADCFG0_PMODE_MASK; |
1397 |
+ value |= PADCFG0_PMODE_GPIO; |
1398 |
+ |
1399 |
+- /* Disable input and output buffers */ |
1400 |
+- value |= PADCFG0_GPIORXDIS; |
1401 |
++ /* Disable TX buffer and enable RX (this will be input) */ |
1402 |
++ value &= ~PADCFG0_GPIORXDIS; |
1403 |
+ value |= PADCFG0_GPIOTXDIS; |
1404 |
+ |
1405 |
+ /* Disable SCI/SMI/NMI generation */ |
1406 |
+@@ -497,9 +497,6 @@ static int intel_gpio_request_enable(struct pinctrl_dev *pctldev, |
1407 |
+ |
1408 |
+ intel_gpio_set_gpio_mode(padcfg0); |
1409 |
+ |
1410 |
+- /* Disable TX buffer and enable RX (this will be input) */ |
1411 |
+- __intel_gpio_set_direction(padcfg0, true); |
1412 |
+- |
1413 |
+ raw_spin_unlock_irqrestore(&pctrl->lock, flags); |
1414 |
+ |
1415 |
+ return 0; |
1416 |
+@@ -1115,9 +1112,6 @@ static int intel_gpio_irq_type(struct irq_data *d, unsigned int type) |
1417 |
+ |
1418 |
+ intel_gpio_set_gpio_mode(reg); |
1419 |
+ |
1420 |
+- /* Disable TX buffer and enable RX (this will be input) */ |
1421 |
+- __intel_gpio_set_direction(reg, true); |
1422 |
+- |
1423 |
+ value = readl(reg); |
1424 |
+ |
1425 |
+ value &= ~(PADCFG0_RXEVCFG_MASK | PADCFG0_RXINV); |
1426 |
+@@ -1216,6 +1210,39 @@ static irqreturn_t intel_gpio_irq(int irq, void *data) |
1427 |
+ return IRQ_RETVAL(ret); |
1428 |
+ } |
1429 |
+ |
1430 |
++static void intel_gpio_irq_init(struct intel_pinctrl *pctrl) |
1431 |
++{ |
1432 |
++ int i; |
1433 |
++ |
1434 |
++ for (i = 0; i < pctrl->ncommunities; i++) { |
1435 |
++ const struct intel_community *community; |
1436 |
++ void __iomem *base; |
1437 |
++ unsigned int gpp; |
1438 |
++ |
1439 |
++ community = &pctrl->communities[i]; |
1440 |
++ base = community->regs; |
1441 |
++ |
1442 |
++ for (gpp = 0; gpp < community->ngpps; gpp++) { |
1443 |
++ /* Mask and clear all interrupts */ |
1444 |
++ writel(0, base + community->ie_offset + gpp * 4); |
1445 |
++ writel(0xffff, base + community->is_offset + gpp * 4); |
1446 |
++ } |
1447 |
++ } |
1448 |
++} |
1449 |
++ |
1450 |
++static int intel_gpio_irq_init_hw(struct gpio_chip *gc) |
1451 |
++{ |
1452 |
++ struct intel_pinctrl *pctrl = gpiochip_get_data(gc); |
1453 |
++ |
1454 |
++ /* |
1455 |
++ * Make sure the interrupt lines are in a proper state before |
1456 |
++ * further configuration. |
1457 |
++ */ |
1458 |
++ intel_gpio_irq_init(pctrl); |
1459 |
++ |
1460 |
++ return 0; |
1461 |
++} |
1462 |
++ |
1463 |
+ static int intel_gpio_add_community_ranges(struct intel_pinctrl *pctrl, |
1464 |
+ const struct intel_community *community) |
1465 |
+ { |
1466 |
+@@ -1320,6 +1347,7 @@ static int intel_gpio_probe(struct intel_pinctrl *pctrl, int irq) |
1467 |
+ girq->num_parents = 0; |
1468 |
+ girq->default_type = IRQ_TYPE_NONE; |
1469 |
+ girq->handler = handle_bad_irq; |
1470 |
++ girq->init_hw = intel_gpio_irq_init_hw; |
1471 |
+ |
1472 |
+ ret = devm_gpiochip_add_data(pctrl->dev, &pctrl->chip, pctrl); |
1473 |
+ if (ret) { |
1474 |
+@@ -1695,26 +1723,6 @@ int intel_pinctrl_suspend_noirq(struct device *dev) |
1475 |
+ } |
1476 |
+ EXPORT_SYMBOL_GPL(intel_pinctrl_suspend_noirq); |
1477 |
+ |
1478 |
+-static void intel_gpio_irq_init(struct intel_pinctrl *pctrl) |
1479 |
+-{ |
1480 |
+- size_t i; |
1481 |
+- |
1482 |
+- for (i = 0; i < pctrl->ncommunities; i++) { |
1483 |
+- const struct intel_community *community; |
1484 |
+- void __iomem *base; |
1485 |
+- unsigned int gpp; |
1486 |
+- |
1487 |
+- community = &pctrl->communities[i]; |
1488 |
+- base = community->regs; |
1489 |
+- |
1490 |
+- for (gpp = 0; gpp < community->ngpps; gpp++) { |
1491 |
+- /* Mask and clear all interrupts */ |
1492 |
+- writel(0, base + community->ie_offset + gpp * 4); |
1493 |
+- writel(0xffff, base + community->is_offset + gpp * 4); |
1494 |
+- } |
1495 |
+- } |
1496 |
+-} |
1497 |
+- |
1498 |
+ static bool intel_gpio_update_reg(void __iomem *reg, u32 mask, u32 value) |
1499 |
+ { |
1500 |
+ u32 curr, updated; |
1501 |
+diff --git a/drivers/pinctrl/sunxi/pinctrl-sun50i-h616.c b/drivers/pinctrl/sunxi/pinctrl-sun50i-h616.c |
1502 |
+index ce1917e230f41..152b71226a807 100644 |
1503 |
+--- a/drivers/pinctrl/sunxi/pinctrl-sun50i-h616.c |
1504 |
++++ b/drivers/pinctrl/sunxi/pinctrl-sun50i-h616.c |
1505 |
+@@ -363,16 +363,16 @@ static const struct sunxi_desc_pin h616_pins[] = { |
1506 |
+ SUNXI_FUNCTION(0x0, "gpio_in"), |
1507 |
+ SUNXI_FUNCTION(0x1, "gpio_out"), |
1508 |
+ SUNXI_FUNCTION(0x2, "uart2"), /* CTS */ |
1509 |
+- SUNXI_FUNCTION(0x3, "i2s3"), /* DO0 */ |
1510 |
++ SUNXI_FUNCTION(0x3, "i2s3_dout0"), /* DO0 */ |
1511 |
+ SUNXI_FUNCTION(0x4, "spi1"), /* MISO */ |
1512 |
+- SUNXI_FUNCTION(0x5, "i2s3"), /* DI1 */ |
1513 |
++ SUNXI_FUNCTION(0x5, "i2s3_din1"), /* DI1 */ |
1514 |
+ SUNXI_FUNCTION_IRQ_BANK(0x6, 6, 8)), /* PH_EINT8 */ |
1515 |
+ SUNXI_PIN(SUNXI_PINCTRL_PIN(H, 9), |
1516 |
+ SUNXI_FUNCTION(0x0, "gpio_in"), |
1517 |
+ SUNXI_FUNCTION(0x1, "gpio_out"), |
1518 |
+- SUNXI_FUNCTION(0x3, "i2s3"), /* DI0 */ |
1519 |
++ SUNXI_FUNCTION(0x3, "i2s3_din0"), /* DI0 */ |
1520 |
+ SUNXI_FUNCTION(0x4, "spi1"), /* CS1 */ |
1521 |
+- SUNXI_FUNCTION(0x3, "i2s3"), /* DO1 */ |
1522 |
++ SUNXI_FUNCTION(0x5, "i2s3_dout1"), /* DO1 */ |
1523 |
+ SUNXI_FUNCTION_IRQ_BANK(0x6, 6, 9)), /* PH_EINT9 */ |
1524 |
+ SUNXI_PIN(SUNXI_PINCTRL_PIN(H, 10), |
1525 |
+ SUNXI_FUNCTION(0x0, "gpio_in"), |
1526 |
+diff --git a/drivers/rtc/rtc-mc146818-lib.c b/drivers/rtc/rtc-mc146818-lib.c |
1527 |
+index dcfaf09946ee3..2065842f775d6 100644 |
1528 |
+--- a/drivers/rtc/rtc-mc146818-lib.c |
1529 |
++++ b/drivers/rtc/rtc-mc146818-lib.c |
1530 |
+@@ -104,7 +104,7 @@ again: |
1531 |
+ time->tm_year += real_year - 72; |
1532 |
+ #endif |
1533 |
+ |
1534 |
+- if (century > 20) |
1535 |
++ if (century > 19) |
1536 |
+ time->tm_year += (century - 19) * 100; |
1537 |
+ |
1538 |
+ /* |
1539 |
+diff --git a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c |
1540 |
+index a8ce854c46847..e2586472ecad4 100644 |
1541 |
+--- a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c |
1542 |
++++ b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c |
1543 |
+@@ -508,7 +508,8 @@ static int bnx2fc_l2_rcv_thread(void *arg) |
1544 |
+ |
1545 |
+ static void bnx2fc_recv_frame(struct sk_buff *skb) |
1546 |
+ { |
1547 |
+- u32 fr_len; |
1548 |
++ u64 crc_err; |
1549 |
++ u32 fr_len, fr_crc; |
1550 |
+ struct fc_lport *lport; |
1551 |
+ struct fcoe_rcv_info *fr; |
1552 |
+ struct fc_stats *stats; |
1553 |
+@@ -542,6 +543,11 @@ static void bnx2fc_recv_frame(struct sk_buff *skb) |
1554 |
+ skb_pull(skb, sizeof(struct fcoe_hdr)); |
1555 |
+ fr_len = skb->len - sizeof(struct fcoe_crc_eof); |
1556 |
+ |
1557 |
++ stats = per_cpu_ptr(lport->stats, get_cpu()); |
1558 |
++ stats->RxFrames++; |
1559 |
++ stats->RxWords += fr_len / FCOE_WORD_TO_BYTE; |
1560 |
++ put_cpu(); |
1561 |
++ |
1562 |
+ fp = (struct fc_frame *)skb; |
1563 |
+ fc_frame_init(fp); |
1564 |
+ fr_dev(fp) = lport; |
1565 |
+@@ -624,16 +630,15 @@ static void bnx2fc_recv_frame(struct sk_buff *skb) |
1566 |
+ return; |
1567 |
+ } |
1568 |
+ |
1569 |
+- stats = per_cpu_ptr(lport->stats, smp_processor_id()); |
1570 |
+- stats->RxFrames++; |
1571 |
+- stats->RxWords += fr_len / FCOE_WORD_TO_BYTE; |
1572 |
++ fr_crc = le32_to_cpu(fr_crc(fp)); |
1573 |
+ |
1574 |
+- if (le32_to_cpu(fr_crc(fp)) != |
1575 |
+- ~crc32(~0, skb->data, fr_len)) { |
1576 |
+- if (stats->InvalidCRCCount < 5) |
1577 |
++ if (unlikely(fr_crc != ~crc32(~0, skb->data, fr_len))) { |
1578 |
++ stats = per_cpu_ptr(lport->stats, get_cpu()); |
1579 |
++ crc_err = (stats->InvalidCRCCount++); |
1580 |
++ put_cpu(); |
1581 |
++ if (crc_err < 5) |
1582 |
+ printk(KERN_WARNING PFX "dropping frame with " |
1583 |
+ "CRC error\n"); |
1584 |
+- stats->InvalidCRCCount++; |
1585 |
+ kfree_skb(skb); |
1586 |
+ return; |
1587 |
+ } |
1588 |
+diff --git a/drivers/soc/mediatek/mtk-scpsys.c b/drivers/soc/mediatek/mtk-scpsys.c |
1589 |
+index 670cc82d17dc2..ca75b14931ec9 100644 |
1590 |
+--- a/drivers/soc/mediatek/mtk-scpsys.c |
1591 |
++++ b/drivers/soc/mediatek/mtk-scpsys.c |
1592 |
+@@ -411,17 +411,12 @@ out: |
1593 |
+ return ret; |
1594 |
+ } |
1595 |
+ |
1596 |
+-static int init_clks(struct platform_device *pdev, struct clk **clk) |
1597 |
++static void init_clks(struct platform_device *pdev, struct clk **clk) |
1598 |
+ { |
1599 |
+ int i; |
1600 |
+ |
1601 |
+- for (i = CLK_NONE + 1; i < CLK_MAX; i++) { |
1602 |
++ for (i = CLK_NONE + 1; i < CLK_MAX; i++) |
1603 |
+ clk[i] = devm_clk_get(&pdev->dev, clk_names[i]); |
1604 |
+- if (IS_ERR(clk[i])) |
1605 |
+- return PTR_ERR(clk[i]); |
1606 |
+- } |
1607 |
+- |
1608 |
+- return 0; |
1609 |
+ } |
1610 |
+ |
1611 |
+ static struct scp *init_scp(struct platform_device *pdev, |
1612 |
+@@ -431,7 +426,7 @@ static struct scp *init_scp(struct platform_device *pdev, |
1613 |
+ { |
1614 |
+ struct genpd_onecell_data *pd_data; |
1615 |
+ struct resource *res; |
1616 |
+- int i, j, ret; |
1617 |
++ int i, j; |
1618 |
+ struct scp *scp; |
1619 |
+ struct clk *clk[CLK_MAX]; |
1620 |
+ |
1621 |
+@@ -486,9 +481,7 @@ static struct scp *init_scp(struct platform_device *pdev, |
1622 |
+ |
1623 |
+ pd_data->num_domains = num; |
1624 |
+ |
1625 |
+- ret = init_clks(pdev, clk); |
1626 |
+- if (ret) |
1627 |
+- return ERR_PTR(ret); |
1628 |
++ init_clks(pdev, clk); |
1629 |
+ |
1630 |
+ for (i = 0; i < num; i++) { |
1631 |
+ struct scp_domain *scpd = &scp->domains[i]; |
1632 |
+diff --git a/drivers/spi/spi-bcm-qspi.c b/drivers/spi/spi-bcm-qspi.c |
1633 |
+index 151e154284bde..ae8c86be77869 100644 |
1634 |
+--- a/drivers/spi/spi-bcm-qspi.c |
1635 |
++++ b/drivers/spi/spi-bcm-qspi.c |
1636 |
+@@ -552,7 +552,7 @@ static void bcm_qspi_chip_select(struct bcm_qspi *qspi, int cs) |
1637 |
+ u32 rd = 0; |
1638 |
+ u32 wr = 0; |
1639 |
+ |
1640 |
+- if (qspi->base[CHIP_SELECT]) { |
1641 |
++ if (cs >= 0 && qspi->base[CHIP_SELECT]) { |
1642 |
+ rd = bcm_qspi_read(qspi, CHIP_SELECT, 0); |
1643 |
+ wr = (rd & ~0xff) | (1 << cs); |
1644 |
+ if (rd == wr) |
1645 |
+diff --git a/drivers/spi/spi-meson-spicc.c b/drivers/spi/spi-meson-spicc.c |
1646 |
+index c208efeadd184..0bc7daa7afc83 100644 |
1647 |
+--- a/drivers/spi/spi-meson-spicc.c |
1648 |
++++ b/drivers/spi/spi-meson-spicc.c |
1649 |
+@@ -693,6 +693,11 @@ static int meson_spicc_probe(struct platform_device *pdev) |
1650 |
+ writel_relaxed(0, spicc->base + SPICC_INTREG); |
1651 |
+ |
1652 |
+ irq = platform_get_irq(pdev, 0); |
1653 |
++ if (irq < 0) { |
1654 |
++ ret = irq; |
1655 |
++ goto out_master; |
1656 |
++ } |
1657 |
++ |
1658 |
+ ret = devm_request_irq(&pdev->dev, irq, meson_spicc_irq, |
1659 |
+ 0, NULL, spicc); |
1660 |
+ if (ret) { |
1661 |
+diff --git a/drivers/spi/spi-mt65xx.c b/drivers/spi/spi-mt65xx.c |
1662 |
+index a15de10ee286a..753bd313e6fda 100644 |
1663 |
+--- a/drivers/spi/spi-mt65xx.c |
1664 |
++++ b/drivers/spi/spi-mt65xx.c |
1665 |
+@@ -624,7 +624,7 @@ static irqreturn_t mtk_spi_interrupt(int irq, void *dev_id) |
1666 |
+ else |
1667 |
+ mdata->state = MTK_SPI_IDLE; |
1668 |
+ |
1669 |
+- if (!master->can_dma(master, master->cur_msg->spi, trans)) { |
1670 |
++ if (!master->can_dma(master, NULL, trans)) { |
1671 |
+ if (trans->rx_buf) { |
1672 |
+ cnt = mdata->xfer_len / 4; |
1673 |
+ ioread32_rep(mdata->base + SPI_RX_DATA_REG, |
1674 |
+diff --git a/drivers/spi/spi-stm32-qspi.c b/drivers/spi/spi-stm32-qspi.c |
1675 |
+index 514337c86d2c3..ffdc55f87e821 100644 |
1676 |
+--- a/drivers/spi/spi-stm32-qspi.c |
1677 |
++++ b/drivers/spi/spi-stm32-qspi.c |
1678 |
+@@ -688,7 +688,7 @@ static int stm32_qspi_probe(struct platform_device *pdev) |
1679 |
+ struct resource *res; |
1680 |
+ int ret, irq; |
1681 |
+ |
1682 |
+- ctrl = spi_alloc_master(dev, sizeof(*qspi)); |
1683 |
++ ctrl = devm_spi_alloc_master(dev, sizeof(*qspi)); |
1684 |
+ if (!ctrl) |
1685 |
+ return -ENOMEM; |
1686 |
+ |
1687 |
+@@ -697,58 +697,46 @@ static int stm32_qspi_probe(struct platform_device *pdev) |
1688 |
+ |
1689 |
+ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "qspi"); |
1690 |
+ qspi->io_base = devm_ioremap_resource(dev, res); |
1691 |
+- if (IS_ERR(qspi->io_base)) { |
1692 |
+- ret = PTR_ERR(qspi->io_base); |
1693 |
+- goto err_master_put; |
1694 |
+- } |
1695 |
++ if (IS_ERR(qspi->io_base)) |
1696 |
++ return PTR_ERR(qspi->io_base); |
1697 |
+ |
1698 |
+ qspi->phys_base = res->start; |
1699 |
+ |
1700 |
+ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "qspi_mm"); |
1701 |
+ qspi->mm_base = devm_ioremap_resource(dev, res); |
1702 |
+- if (IS_ERR(qspi->mm_base)) { |
1703 |
+- ret = PTR_ERR(qspi->mm_base); |
1704 |
+- goto err_master_put; |
1705 |
+- } |
1706 |
++ if (IS_ERR(qspi->mm_base)) |
1707 |
++ return PTR_ERR(qspi->mm_base); |
1708 |
+ |
1709 |
+ qspi->mm_size = resource_size(res); |
1710 |
+- if (qspi->mm_size > STM32_QSPI_MAX_MMAP_SZ) { |
1711 |
+- ret = -EINVAL; |
1712 |
+- goto err_master_put; |
1713 |
+- } |
1714 |
++ if (qspi->mm_size > STM32_QSPI_MAX_MMAP_SZ) |
1715 |
++ return -EINVAL; |
1716 |
+ |
1717 |
+ irq = platform_get_irq(pdev, 0); |
1718 |
+- if (irq < 0) { |
1719 |
+- ret = irq; |
1720 |
+- goto err_master_put; |
1721 |
+- } |
1722 |
++ if (irq < 0) |
1723 |
++ return irq; |
1724 |
+ |
1725 |
+ ret = devm_request_irq(dev, irq, stm32_qspi_irq, 0, |
1726 |
+ dev_name(dev), qspi); |
1727 |
+ if (ret) { |
1728 |
+ dev_err(dev, "failed to request irq\n"); |
1729 |
+- goto err_master_put; |
1730 |
++ return ret; |
1731 |
+ } |
1732 |
+ |
1733 |
+ init_completion(&qspi->data_completion); |
1734 |
+ init_completion(&qspi->match_completion); |
1735 |
+ |
1736 |
+ qspi->clk = devm_clk_get(dev, NULL); |
1737 |
+- if (IS_ERR(qspi->clk)) { |
1738 |
+- ret = PTR_ERR(qspi->clk); |
1739 |
+- goto err_master_put; |
1740 |
+- } |
1741 |
++ if (IS_ERR(qspi->clk)) |
1742 |
++ return PTR_ERR(qspi->clk); |
1743 |
+ |
1744 |
+ qspi->clk_rate = clk_get_rate(qspi->clk); |
1745 |
+- if (!qspi->clk_rate) { |
1746 |
+- ret = -EINVAL; |
1747 |
+- goto err_master_put; |
1748 |
+- } |
1749 |
++ if (!qspi->clk_rate) |
1750 |
++ return -EINVAL; |
1751 |
+ |
1752 |
+ ret = clk_prepare_enable(qspi->clk); |
1753 |
+ if (ret) { |
1754 |
+ dev_err(dev, "can not enable the clock\n"); |
1755 |
+- goto err_master_put; |
1756 |
++ return ret; |
1757 |
+ } |
1758 |
+ |
1759 |
+ rstc = devm_reset_control_get_exclusive(dev, NULL); |
1760 |
+@@ -784,7 +772,7 @@ static int stm32_qspi_probe(struct platform_device *pdev) |
1761 |
+ pm_runtime_enable(dev); |
1762 |
+ pm_runtime_get_noresume(dev); |
1763 |
+ |
1764 |
+- ret = devm_spi_register_master(dev, ctrl); |
1765 |
++ ret = spi_register_master(ctrl); |
1766 |
+ if (ret) |
1767 |
+ goto err_pm_runtime_free; |
1768 |
+ |
1769 |
+@@ -806,8 +794,6 @@ err_dma_free: |
1770 |
+ stm32_qspi_dma_free(qspi); |
1771 |
+ err_clk_disable: |
1772 |
+ clk_disable_unprepare(qspi->clk); |
1773 |
+-err_master_put: |
1774 |
+- spi_master_put(qspi->ctrl); |
1775 |
+ |
1776 |
+ return ret; |
1777 |
+ } |
1778 |
+@@ -817,6 +803,7 @@ static int stm32_qspi_remove(struct platform_device *pdev) |
1779 |
+ struct stm32_qspi *qspi = platform_get_drvdata(pdev); |
1780 |
+ |
1781 |
+ pm_runtime_get_sync(qspi->dev); |
1782 |
++ spi_unregister_master(qspi->ctrl); |
1783 |
+ /* disable qspi */ |
1784 |
+ writel_relaxed(0, qspi->io_base + QSPI_CR); |
1785 |
+ stm32_qspi_dma_free(qspi); |
1786 |
+diff --git a/drivers/spi/spi-uniphier.c b/drivers/spi/spi-uniphier.c |
1787 |
+index 342ee8d2c4761..cc0da48222311 100644 |
1788 |
+--- a/drivers/spi/spi-uniphier.c |
1789 |
++++ b/drivers/spi/spi-uniphier.c |
1790 |
+@@ -726,7 +726,7 @@ static int uniphier_spi_probe(struct platform_device *pdev) |
1791 |
+ if (ret) { |
1792 |
+ dev_err(&pdev->dev, "failed to get TX DMA capacities: %d\n", |
1793 |
+ ret); |
1794 |
+- goto out_disable_clk; |
1795 |
++ goto out_release_dma; |
1796 |
+ } |
1797 |
+ dma_tx_burst = caps.max_burst; |
1798 |
+ } |
1799 |
+@@ -735,7 +735,7 @@ static int uniphier_spi_probe(struct platform_device *pdev) |
1800 |
+ if (IS_ERR_OR_NULL(master->dma_rx)) { |
1801 |
+ if (PTR_ERR(master->dma_rx) == -EPROBE_DEFER) { |
1802 |
+ ret = -EPROBE_DEFER; |
1803 |
+- goto out_disable_clk; |
1804 |
++ goto out_release_dma; |
1805 |
+ } |
1806 |
+ master->dma_rx = NULL; |
1807 |
+ dma_rx_burst = INT_MAX; |
1808 |
+@@ -744,7 +744,7 @@ static int uniphier_spi_probe(struct platform_device *pdev) |
1809 |
+ if (ret) { |
1810 |
+ dev_err(&pdev->dev, "failed to get RX DMA capacities: %d\n", |
1811 |
+ ret); |
1812 |
+- goto out_disable_clk; |
1813 |
++ goto out_release_dma; |
1814 |
+ } |
1815 |
+ dma_rx_burst = caps.max_burst; |
1816 |
+ } |
1817 |
+@@ -753,10 +753,20 @@ static int uniphier_spi_probe(struct platform_device *pdev) |
1818 |
+ |
1819 |
+ ret = devm_spi_register_master(&pdev->dev, master); |
1820 |
+ if (ret) |
1821 |
+- goto out_disable_clk; |
1822 |
++ goto out_release_dma; |
1823 |
+ |
1824 |
+ return 0; |
1825 |
+ |
1826 |
++out_release_dma: |
1827 |
++ if (!IS_ERR_OR_NULL(master->dma_rx)) { |
1828 |
++ dma_release_channel(master->dma_rx); |
1829 |
++ master->dma_rx = NULL; |
1830 |
++ } |
1831 |
++ if (!IS_ERR_OR_NULL(master->dma_tx)) { |
1832 |
++ dma_release_channel(master->dma_tx); |
1833 |
++ master->dma_tx = NULL; |
1834 |
++ } |
1835 |
++ |
1836 |
+ out_disable_clk: |
1837 |
+ clk_disable_unprepare(priv->clk); |
1838 |
+ |
1839 |
+diff --git a/drivers/video/console/Kconfig b/drivers/video/console/Kconfig |
1840 |
+index 840d9813b0bc6..fcc46380e7c91 100644 |
1841 |
+--- a/drivers/video/console/Kconfig |
1842 |
++++ b/drivers/video/console/Kconfig |
1843 |
+@@ -78,6 +78,26 @@ config FRAMEBUFFER_CONSOLE |
1844 |
+ help |
1845 |
+ Low-level framebuffer-based console driver. |
1846 |
+ |
1847 |
++config FRAMEBUFFER_CONSOLE_LEGACY_ACCELERATION |
1848 |
++ bool "Enable legacy fbcon hardware acceleration code" |
1849 |
++ depends on FRAMEBUFFER_CONSOLE |
1850 |
++ default y if PARISC |
1851 |
++ default n |
1852 |
++ help |
1853 |
++ This option enables the fbcon (framebuffer text-based) hardware |
1854 |
++ acceleration for graphics drivers which were written for the fbdev |
1855 |
++ graphics interface. |
1856 |
++ |
1857 |
++ On modern machines, on mainstream machines (like x86-64) or when |
1858 |
++ using a modern Linux distribution those fbdev drivers usually aren't used. |
1859 |
++ So enabling this option wouldn't have any effect, which is why you want |
1860 |
++ to disable this option on such newer machines. |
1861 |
++ |
1862 |
++ If you compile this kernel for older machines which still require the |
1863 |
++ fbdev drivers, you may want to say Y. |
1864 |
++ |
1865 |
++ If unsure, select n. |
1866 |
++ |
1867 |
+ config FRAMEBUFFER_CONSOLE_DETECT_PRIMARY |
1868 |
+ bool "Map the console to the primary display device" |
1869 |
+ depends on FRAMEBUFFER_CONSOLE |
1870 |
+diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c |
1871 |
+index 22bb3892f6bd1..f7b7d35953e81 100644 |
1872 |
+--- a/drivers/video/fbdev/core/fbcon.c |
1873 |
++++ b/drivers/video/fbdev/core/fbcon.c |
1874 |
+@@ -1025,7 +1025,7 @@ static void fbcon_init(struct vc_data *vc, int init) |
1875 |
+ struct vc_data *svc = *default_mode; |
1876 |
+ struct fbcon_display *t, *p = &fb_display[vc->vc_num]; |
1877 |
+ int logo = 1, new_rows, new_cols, rows, cols; |
1878 |
+- int ret; |
1879 |
++ int cap, ret; |
1880 |
+ |
1881 |
+ if (WARN_ON(info_idx == -1)) |
1882 |
+ return; |
1883 |
+@@ -1034,6 +1034,7 @@ static void fbcon_init(struct vc_data *vc, int init) |
1884 |
+ con2fb_map[vc->vc_num] = info_idx; |
1885 |
+ |
1886 |
+ info = registered_fb[con2fb_map[vc->vc_num]]; |
1887 |
++ cap = info->flags; |
1888 |
+ |
1889 |
+ if (logo_shown < 0 && console_loglevel <= CONSOLE_LOGLEVEL_QUIET) |
1890 |
+ logo_shown = FBCON_LOGO_DONTSHOW; |
1891 |
+@@ -1135,13 +1136,13 @@ static void fbcon_init(struct vc_data *vc, int init) |
1892 |
+ |
1893 |
+ ops->graphics = 0; |
1894 |
+ |
1895 |
+- /* |
1896 |
+- * No more hw acceleration for fbcon. |
1897 |
+- * |
1898 |
+- * FIXME: Garbage collect all the now dead code after sufficient time |
1899 |
+- * has passed. |
1900 |
+- */ |
1901 |
+- p->scrollmode = SCROLL_REDRAW; |
1902 |
++#ifdef CONFIG_FRAMEBUFFER_CONSOLE_LEGACY_ACCELERATION |
1903 |
++ if ((cap & FBINFO_HWACCEL_COPYAREA) && |
1904 |
++ !(cap & FBINFO_HWACCEL_DISABLED)) |
1905 |
++ p->scrollmode = SCROLL_MOVE; |
1906 |
++ else /* default to something safe */ |
1907 |
++ p->scrollmode = SCROLL_REDRAW; |
1908 |
++#endif |
1909 |
+ |
1910 |
+ /* |
1911 |
+ * ++guenther: console.c:vc_allocate() relies on initializing |
1912 |
+@@ -1706,7 +1707,7 @@ static bool fbcon_scroll(struct vc_data *vc, unsigned int t, unsigned int b, |
1913 |
+ count = vc->vc_rows; |
1914 |
+ if (logo_shown >= 0) |
1915 |
+ goto redraw_up; |
1916 |
+- switch (p->scrollmode) { |
1917 |
++ switch (fb_scrollmode(p)) { |
1918 |
+ case SCROLL_MOVE: |
1919 |
+ fbcon_redraw_blit(vc, info, p, t, b - t - count, |
1920 |
+ count); |
1921 |
+@@ -1796,7 +1797,7 @@ static bool fbcon_scroll(struct vc_data *vc, unsigned int t, unsigned int b, |
1922 |
+ count = vc->vc_rows; |
1923 |
+ if (logo_shown >= 0) |
1924 |
+ goto redraw_down; |
1925 |
+- switch (p->scrollmode) { |
1926 |
++ switch (fb_scrollmode(p)) { |
1927 |
+ case SCROLL_MOVE: |
1928 |
+ fbcon_redraw_blit(vc, info, p, b - 1, b - t - count, |
1929 |
+ -count); |
1930 |
+@@ -1947,6 +1948,48 @@ static void fbcon_bmove_rec(struct vc_data *vc, struct fbcon_display *p, int sy, |
1931 |
+ height, width); |
1932 |
+ } |
1933 |
+ |
1934 |
++static void updatescrollmode_accel(struct fbcon_display *p, |
1935 |
++ struct fb_info *info, |
1936 |
++ struct vc_data *vc) |
1937 |
++{ |
1938 |
++#ifdef CONFIG_FRAMEBUFFER_CONSOLE_LEGACY_ACCELERATION |
1939 |
++ struct fbcon_ops *ops = info->fbcon_par; |
1940 |
++ int cap = info->flags; |
1941 |
++ u16 t = 0; |
1942 |
++ int ypan = FBCON_SWAP(ops->rotate, info->fix.ypanstep, |
1943 |
++ info->fix.xpanstep); |
1944 |
++ int ywrap = FBCON_SWAP(ops->rotate, info->fix.ywrapstep, t); |
1945 |
++ int yres = FBCON_SWAP(ops->rotate, info->var.yres, info->var.xres); |
1946 |
++ int vyres = FBCON_SWAP(ops->rotate, info->var.yres_virtual, |
1947 |
++ info->var.xres_virtual); |
1948 |
++ int good_pan = (cap & FBINFO_HWACCEL_YPAN) && |
1949 |
++ divides(ypan, vc->vc_font.height) && vyres > yres; |
1950 |
++ int good_wrap = (cap & FBINFO_HWACCEL_YWRAP) && |
1951 |
++ divides(ywrap, vc->vc_font.height) && |
1952 |
++ divides(vc->vc_font.height, vyres) && |
1953 |
++ divides(vc->vc_font.height, yres); |
1954 |
++ int reading_fast = cap & FBINFO_READS_FAST; |
1955 |
++ int fast_copyarea = (cap & FBINFO_HWACCEL_COPYAREA) && |
1956 |
++ !(cap & FBINFO_HWACCEL_DISABLED); |
1957 |
++ int fast_imageblit = (cap & FBINFO_HWACCEL_IMAGEBLIT) && |
1958 |
++ !(cap & FBINFO_HWACCEL_DISABLED); |
1959 |
++ |
1960 |
++ if (good_wrap || good_pan) { |
1961 |
++ if (reading_fast || fast_copyarea) |
1962 |
++ p->scrollmode = good_wrap ? |
1963 |
++ SCROLL_WRAP_MOVE : SCROLL_PAN_MOVE; |
1964 |
++ else |
1965 |
++ p->scrollmode = good_wrap ? SCROLL_REDRAW : |
1966 |
++ SCROLL_PAN_REDRAW; |
1967 |
++ } else { |
1968 |
++ if (reading_fast || (fast_copyarea && !fast_imageblit)) |
1969 |
++ p->scrollmode = SCROLL_MOVE; |
1970 |
++ else |
1971 |
++ p->scrollmode = SCROLL_REDRAW; |
1972 |
++ } |
1973 |
++#endif |
1974 |
++} |
1975 |
++ |
1976 |
+ static void updatescrollmode(struct fbcon_display *p, |
1977 |
+ struct fb_info *info, |
1978 |
+ struct vc_data *vc) |
1979 |
+@@ -1962,6 +2005,9 @@ static void updatescrollmode(struct fbcon_display *p, |
1980 |
+ p->vrows -= (yres - (fh * vc->vc_rows)) / fh; |
1981 |
+ if ((yres % fh) && (vyres % fh < yres % fh)) |
1982 |
+ p->vrows--; |
1983 |
++ |
1984 |
++ /* update scrollmode in case hardware acceleration is used */ |
1985 |
++ updatescrollmode_accel(p, info, vc); |
1986 |
+ } |
1987 |
+ |
1988 |
+ #define PITCH(w) (((w) + 7) >> 3) |
1989 |
+@@ -2119,7 +2165,7 @@ static int fbcon_switch(struct vc_data *vc) |
1990 |
+ |
1991 |
+ updatescrollmode(p, info, vc); |
1992 |
+ |
1993 |
+- switch (p->scrollmode) { |
1994 |
++ switch (fb_scrollmode(p)) { |
1995 |
+ case SCROLL_WRAP_MOVE: |
1996 |
+ scrollback_phys_max = p->vrows - vc->vc_rows; |
1997 |
+ break; |
1998 |
+diff --git a/drivers/video/fbdev/core/fbcon.h b/drivers/video/fbdev/core/fbcon.h |
1999 |
+index 9315b360c8981..0f16cbc99e6a4 100644 |
2000 |
+--- a/drivers/video/fbdev/core/fbcon.h |
2001 |
++++ b/drivers/video/fbdev/core/fbcon.h |
2002 |
+@@ -29,7 +29,9 @@ struct fbcon_display { |
2003 |
+ /* Filled in by the low-level console driver */ |
2004 |
+ const u_char *fontdata; |
2005 |
+ int userfont; /* != 0 if fontdata kmalloc()ed */ |
2006 |
+- u_short scrollmode; /* Scroll Method */ |
2007 |
++#ifdef CONFIG_FRAMEBUFFER_CONSOLE_LEGACY_ACCELERATION |
2008 |
++ u_short scrollmode; /* Scroll Method, use fb_scrollmode() */ |
2009 |
++#endif |
2010 |
+ u_short inverse; /* != 0 text black on white as default */ |
2011 |
+ short yscroll; /* Hardware scrolling */ |
2012 |
+ int vrows; /* number of virtual rows */ |
2013 |
+@@ -208,6 +210,17 @@ static inline int attr_col_ec(int shift, struct vc_data *vc, |
2014 |
+ #define SCROLL_REDRAW 0x004 |
2015 |
+ #define SCROLL_PAN_REDRAW 0x005 |
2016 |
+ |
2017 |
++static inline u_short fb_scrollmode(struct fbcon_display *fb) |
2018 |
++{ |
2019 |
++#ifdef CONFIG_FRAMEBUFFER_CONSOLE_LEGACY_ACCELERATION |
2020 |
++ return fb->scrollmode; |
2021 |
++#else |
2022 |
++ /* hardcoded to SCROLL_REDRAW if acceleration was disabled. */ |
2023 |
++ return SCROLL_REDRAW; |
2024 |
++#endif |
2025 |
++} |
2026 |
++ |
2027 |
++ |
2028 |
+ #ifdef CONFIG_FB_TILEBLITTING |
2029 |
+ extern void fbcon_set_tileops(struct vc_data *vc, struct fb_info *info); |
2030 |
+ #endif |
2031 |
+diff --git a/drivers/video/fbdev/core/fbcon_ccw.c b/drivers/video/fbdev/core/fbcon_ccw.c |
2032 |
+index 9cd2c4b05c328..2789ace796342 100644 |
2033 |
+--- a/drivers/video/fbdev/core/fbcon_ccw.c |
2034 |
++++ b/drivers/video/fbdev/core/fbcon_ccw.c |
2035 |
+@@ -65,7 +65,7 @@ static void ccw_bmove(struct vc_data *vc, struct fb_info *info, int sy, |
2036 |
+ { |
2037 |
+ struct fbcon_ops *ops = info->fbcon_par; |
2038 |
+ struct fb_copyarea area; |
2039 |
+- u32 vyres = GETVYRES(ops->p->scrollmode, info); |
2040 |
++ u32 vyres = GETVYRES(ops->p, info); |
2041 |
+ |
2042 |
+ area.sx = sy * vc->vc_font.height; |
2043 |
+ area.sy = vyres - ((sx + width) * vc->vc_font.width); |
2044 |
+@@ -83,7 +83,7 @@ static void ccw_clear(struct vc_data *vc, struct fb_info *info, int sy, |
2045 |
+ struct fbcon_ops *ops = info->fbcon_par; |
2046 |
+ struct fb_fillrect region; |
2047 |
+ int bgshift = (vc->vc_hi_font_mask) ? 13 : 12; |
2048 |
+- u32 vyres = GETVYRES(ops->p->scrollmode, info); |
2049 |
++ u32 vyres = GETVYRES(ops->p, info); |
2050 |
+ |
2051 |
+ region.color = attr_bgcol_ec(bgshift,vc,info); |
2052 |
+ region.dx = sy * vc->vc_font.height; |
2053 |
+@@ -140,7 +140,7 @@ static void ccw_putcs(struct vc_data *vc, struct fb_info *info, |
2054 |
+ u32 cnt, pitch, size; |
2055 |
+ u32 attribute = get_attribute(info, scr_readw(s)); |
2056 |
+ u8 *dst, *buf = NULL; |
2057 |
+- u32 vyres = GETVYRES(ops->p->scrollmode, info); |
2058 |
++ u32 vyres = GETVYRES(ops->p, info); |
2059 |
+ |
2060 |
+ if (!ops->fontbuffer) |
2061 |
+ return; |
2062 |
+@@ -229,7 +229,7 @@ static void ccw_cursor(struct vc_data *vc, struct fb_info *info, int mode, |
2063 |
+ int attribute, use_sw = vc->vc_cursor_type & CUR_SW; |
2064 |
+ int err = 1, dx, dy; |
2065 |
+ char *src; |
2066 |
+- u32 vyres = GETVYRES(ops->p->scrollmode, info); |
2067 |
++ u32 vyres = GETVYRES(ops->p, info); |
2068 |
+ |
2069 |
+ if (!ops->fontbuffer) |
2070 |
+ return; |
2071 |
+@@ -387,7 +387,7 @@ static int ccw_update_start(struct fb_info *info) |
2072 |
+ { |
2073 |
+ struct fbcon_ops *ops = info->fbcon_par; |
2074 |
+ u32 yoffset; |
2075 |
+- u32 vyres = GETVYRES(ops->p->scrollmode, info); |
2076 |
++ u32 vyres = GETVYRES(ops->p, info); |
2077 |
+ int err; |
2078 |
+ |
2079 |
+ yoffset = (vyres - info->var.yres) - ops->var.xoffset; |
2080 |
+diff --git a/drivers/video/fbdev/core/fbcon_cw.c b/drivers/video/fbdev/core/fbcon_cw.c |
2081 |
+index 88d89fad3f05e..86a254c1b2b7b 100644 |
2082 |
+--- a/drivers/video/fbdev/core/fbcon_cw.c |
2083 |
++++ b/drivers/video/fbdev/core/fbcon_cw.c |
2084 |
+@@ -50,7 +50,7 @@ static void cw_bmove(struct vc_data *vc, struct fb_info *info, int sy, |
2085 |
+ { |
2086 |
+ struct fbcon_ops *ops = info->fbcon_par; |
2087 |
+ struct fb_copyarea area; |
2088 |
+- u32 vxres = GETVXRES(ops->p->scrollmode, info); |
2089 |
++ u32 vxres = GETVXRES(ops->p, info); |
2090 |
+ |
2091 |
+ area.sx = vxres - ((sy + height) * vc->vc_font.height); |
2092 |
+ area.sy = sx * vc->vc_font.width; |
2093 |
+@@ -68,7 +68,7 @@ static void cw_clear(struct vc_data *vc, struct fb_info *info, int sy, |
2094 |
+ struct fbcon_ops *ops = info->fbcon_par; |
2095 |
+ struct fb_fillrect region; |
2096 |
+ int bgshift = (vc->vc_hi_font_mask) ? 13 : 12; |
2097 |
+- u32 vxres = GETVXRES(ops->p->scrollmode, info); |
2098 |
++ u32 vxres = GETVXRES(ops->p, info); |
2099 |
+ |
2100 |
+ region.color = attr_bgcol_ec(bgshift,vc,info); |
2101 |
+ region.dx = vxres - ((sy + height) * vc->vc_font.height); |
2102 |
+@@ -125,7 +125,7 @@ static void cw_putcs(struct vc_data *vc, struct fb_info *info, |
2103 |
+ u32 cnt, pitch, size; |
2104 |
+ u32 attribute = get_attribute(info, scr_readw(s)); |
2105 |
+ u8 *dst, *buf = NULL; |
2106 |
+- u32 vxres = GETVXRES(ops->p->scrollmode, info); |
2107 |
++ u32 vxres = GETVXRES(ops->p, info); |
2108 |
+ |
2109 |
+ if (!ops->fontbuffer) |
2110 |
+ return; |
2111 |
+@@ -212,7 +212,7 @@ static void cw_cursor(struct vc_data *vc, struct fb_info *info, int mode, |
2112 |
+ int attribute, use_sw = vc->vc_cursor_type & CUR_SW; |
2113 |
+ int err = 1, dx, dy; |
2114 |
+ char *src; |
2115 |
+- u32 vxres = GETVXRES(ops->p->scrollmode, info); |
2116 |
++ u32 vxres = GETVXRES(ops->p, info); |
2117 |
+ |
2118 |
+ if (!ops->fontbuffer) |
2119 |
+ return; |
2120 |
+@@ -369,7 +369,7 @@ static void cw_cursor(struct vc_data *vc, struct fb_info *info, int mode, |
2121 |
+ static int cw_update_start(struct fb_info *info) |
2122 |
+ { |
2123 |
+ struct fbcon_ops *ops = info->fbcon_par; |
2124 |
+- u32 vxres = GETVXRES(ops->p->scrollmode, info); |
2125 |
++ u32 vxres = GETVXRES(ops->p, info); |
2126 |
+ u32 xoffset; |
2127 |
+ int err; |
2128 |
+ |
2129 |
+diff --git a/drivers/video/fbdev/core/fbcon_rotate.h b/drivers/video/fbdev/core/fbcon_rotate.h |
2130 |
+index e233444cda664..01cbe303b8a29 100644 |
2131 |
+--- a/drivers/video/fbdev/core/fbcon_rotate.h |
2132 |
++++ b/drivers/video/fbdev/core/fbcon_rotate.h |
2133 |
+@@ -12,11 +12,11 @@ |
2134 |
+ #define _FBCON_ROTATE_H |
2135 |
+ |
2136 |
+ #define GETVYRES(s,i) ({ \ |
2137 |
+- (s == SCROLL_REDRAW || s == SCROLL_MOVE) ? \ |
2138 |
++ (fb_scrollmode(s) == SCROLL_REDRAW || fb_scrollmode(s) == SCROLL_MOVE) ? \ |
2139 |
+ (i)->var.yres : (i)->var.yres_virtual; }) |
2140 |
+ |
2141 |
+ #define GETVXRES(s,i) ({ \ |
2142 |
+- (s == SCROLL_REDRAW || s == SCROLL_MOVE || !(i)->fix.xpanstep) ? \ |
2143 |
++ (fb_scrollmode(s) == SCROLL_REDRAW || fb_scrollmode(s) == SCROLL_MOVE || !(i)->fix.xpanstep) ? \ |
2144 |
+ (i)->var.xres : (i)->var.xres_virtual; }) |
2145 |
+ |
2146 |
+ |
2147 |
+diff --git a/drivers/video/fbdev/core/fbcon_ud.c b/drivers/video/fbdev/core/fbcon_ud.c |
2148 |
+index 8d5e66b1bdfbb..23bc045769d08 100644 |
2149 |
+--- a/drivers/video/fbdev/core/fbcon_ud.c |
2150 |
++++ b/drivers/video/fbdev/core/fbcon_ud.c |
2151 |
+@@ -50,8 +50,8 @@ static void ud_bmove(struct vc_data *vc, struct fb_info *info, int sy, |
2152 |
+ { |
2153 |
+ struct fbcon_ops *ops = info->fbcon_par; |
2154 |
+ struct fb_copyarea area; |
2155 |
+- u32 vyres = GETVYRES(ops->p->scrollmode, info); |
2156 |
+- u32 vxres = GETVXRES(ops->p->scrollmode, info); |
2157 |
++ u32 vyres = GETVYRES(ops->p, info); |
2158 |
++ u32 vxres = GETVXRES(ops->p, info); |
2159 |
+ |
2160 |
+ area.sy = vyres - ((sy + height) * vc->vc_font.height); |
2161 |
+ area.sx = vxres - ((sx + width) * vc->vc_font.width); |
2162 |
+@@ -69,8 +69,8 @@ static void ud_clear(struct vc_data *vc, struct fb_info *info, int sy, |
2163 |
+ struct fbcon_ops *ops = info->fbcon_par; |
2164 |
+ struct fb_fillrect region; |
2165 |
+ int bgshift = (vc->vc_hi_font_mask) ? 13 : 12; |
2166 |
+- u32 vyres = GETVYRES(ops->p->scrollmode, info); |
2167 |
+- u32 vxres = GETVXRES(ops->p->scrollmode, info); |
2168 |
++ u32 vyres = GETVYRES(ops->p, info); |
2169 |
++ u32 vxres = GETVXRES(ops->p, info); |
2170 |
+ |
2171 |
+ region.color = attr_bgcol_ec(bgshift,vc,info); |
2172 |
+ region.dy = vyres - ((sy + height) * vc->vc_font.height); |
2173 |
+@@ -162,8 +162,8 @@ static void ud_putcs(struct vc_data *vc, struct fb_info *info, |
2174 |
+ u32 mod = vc->vc_font.width % 8, cnt, pitch, size; |
2175 |
+ u32 attribute = get_attribute(info, scr_readw(s)); |
2176 |
+ u8 *dst, *buf = NULL; |
2177 |
+- u32 vyres = GETVYRES(ops->p->scrollmode, info); |
2178 |
+- u32 vxres = GETVXRES(ops->p->scrollmode, info); |
2179 |
++ u32 vyres = GETVYRES(ops->p, info); |
2180 |
++ u32 vxres = GETVXRES(ops->p, info); |
2181 |
+ |
2182 |
+ if (!ops->fontbuffer) |
2183 |
+ return; |
2184 |
+@@ -259,8 +259,8 @@ static void ud_cursor(struct vc_data *vc, struct fb_info *info, int mode, |
2185 |
+ int attribute, use_sw = vc->vc_cursor_type & CUR_SW; |
2186 |
+ int err = 1, dx, dy; |
2187 |
+ char *src; |
2188 |
+- u32 vyres = GETVYRES(ops->p->scrollmode, info); |
2189 |
+- u32 vxres = GETVXRES(ops->p->scrollmode, info); |
2190 |
++ u32 vyres = GETVYRES(ops->p, info); |
2191 |
++ u32 vxres = GETVXRES(ops->p, info); |
2192 |
+ |
2193 |
+ if (!ops->fontbuffer) |
2194 |
+ return; |
2195 |
+@@ -410,8 +410,8 @@ static int ud_update_start(struct fb_info *info) |
2196 |
+ { |
2197 |
+ struct fbcon_ops *ops = info->fbcon_par; |
2198 |
+ int xoffset, yoffset; |
2199 |
+- u32 vyres = GETVYRES(ops->p->scrollmode, info); |
2200 |
+- u32 vxres = GETVXRES(ops->p->scrollmode, info); |
2201 |
++ u32 vyres = GETVYRES(ops->p, info); |
2202 |
++ u32 vxres = GETVXRES(ops->p, info); |
2203 |
+ int err; |
2204 |
+ |
2205 |
+ xoffset = vxres - info->var.xres - ops->var.xoffset; |
2206 |
+diff --git a/fs/9p/fid.c b/fs/9p/fid.c |
2207 |
+index b8863dd0de5cc..e8a3b891b0366 100644 |
2208 |
+--- a/fs/9p/fid.c |
2209 |
++++ b/fs/9p/fid.c |
2210 |
+@@ -96,12 +96,8 @@ static struct p9_fid *v9fs_fid_find(struct dentry *dentry, kuid_t uid, int any) |
2211 |
+ dentry, dentry, from_kuid(&init_user_ns, uid), |
2212 |
+ any); |
2213 |
+ ret = NULL; |
2214 |
+- |
2215 |
+- if (d_inode(dentry)) |
2216 |
+- ret = v9fs_fid_find_inode(d_inode(dentry), uid); |
2217 |
+- |
2218 |
+ /* we'll recheck under lock if there's anything to look in */ |
2219 |
+- if (!ret && dentry->d_fsdata) { |
2220 |
++ if (dentry->d_fsdata) { |
2221 |
+ struct hlist_head *h = (struct hlist_head *)&dentry->d_fsdata; |
2222 |
+ spin_lock(&dentry->d_lock); |
2223 |
+ hlist_for_each_entry(fid, h, dlist) { |
2224 |
+@@ -112,6 +108,9 @@ static struct p9_fid *v9fs_fid_find(struct dentry *dentry, kuid_t uid, int any) |
2225 |
+ } |
2226 |
+ } |
2227 |
+ spin_unlock(&dentry->d_lock); |
2228 |
++ } else { |
2229 |
++ if (dentry->d_inode) |
2230 |
++ ret = v9fs_fid_find_inode(dentry->d_inode, uid); |
2231 |
+ } |
2232 |
+ |
2233 |
+ return ret; |
2234 |
+diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c |
2235 |
+index a53ebc52bd51f..d721c66d0b41b 100644 |
2236 |
+--- a/fs/btrfs/block-group.c |
2237 |
++++ b/fs/btrfs/block-group.c |
2238 |
+@@ -2511,6 +2511,19 @@ int btrfs_inc_block_group_ro(struct btrfs_block_group *cache, |
2239 |
+ int ret; |
2240 |
+ bool dirty_bg_running; |
2241 |
+ |
2242 |
++ /* |
2243 |
++ * This can only happen when we are doing read-only scrub on read-only |
2244 |
++ * mount. |
2245 |
++ * In that case we should not start a new transaction on read-only fs. |
2246 |
++ * Thus here we skip all chunk allocations. |
2247 |
++ */ |
2248 |
++ if (sb_rdonly(fs_info->sb)) { |
2249 |
++ mutex_lock(&fs_info->ro_block_group_mutex); |
2250 |
++ ret = inc_block_group_ro(cache, 0); |
2251 |
++ mutex_unlock(&fs_info->ro_block_group_mutex); |
2252 |
++ return ret; |
2253 |
++ } |
2254 |
++ |
2255 |
+ do { |
2256 |
+ trans = btrfs_join_transaction(fs_info->extent_root); |
2257 |
+ if (IS_ERR(trans)) |
2258 |
+diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c |
2259 |
+index 0b6b9c3283ff0..6a863b3f6de03 100644 |
2260 |
+--- a/fs/btrfs/ioctl.c |
2261 |
++++ b/fs/btrfs/ioctl.c |
2262 |
+@@ -775,10 +775,7 @@ static int create_snapshot(struct btrfs_root *root, struct inode *dir, |
2263 |
+ goto fail; |
2264 |
+ } |
2265 |
+ |
2266 |
+- spin_lock(&fs_info->trans_lock); |
2267 |
+- list_add(&pending_snapshot->list, |
2268 |
+- &trans->transaction->pending_snapshots); |
2269 |
+- spin_unlock(&fs_info->trans_lock); |
2270 |
++ trans->pending_snapshot = pending_snapshot; |
2271 |
+ |
2272 |
+ ret = btrfs_commit_transaction(trans); |
2273 |
+ if (ret) |
2274 |
+diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c |
2275 |
+index 7f6a05e670f57..24fb17d5b28f5 100644 |
2276 |
+--- a/fs/btrfs/qgroup.c |
2277 |
++++ b/fs/btrfs/qgroup.c |
2278 |
+@@ -1185,9 +1185,24 @@ int btrfs_quota_disable(struct btrfs_fs_info *fs_info) |
2279 |
+ struct btrfs_trans_handle *trans = NULL; |
2280 |
+ int ret = 0; |
2281 |
+ |
2282 |
++ /* |
2283 |
++ * We need to have subvol_sem write locked, to prevent races between |
2284 |
++ * concurrent tasks trying to disable quotas, because we will unlock |
2285 |
++ * and relock qgroup_ioctl_lock across BTRFS_FS_QUOTA_ENABLED changes. |
2286 |
++ */ |
2287 |
++ lockdep_assert_held_write(&fs_info->subvol_sem); |
2288 |
++ |
2289 |
+ mutex_lock(&fs_info->qgroup_ioctl_lock); |
2290 |
+ if (!fs_info->quota_root) |
2291 |
+ goto out; |
2292 |
++ |
2293 |
++ /* |
2294 |
++ * Request qgroup rescan worker to complete and wait for it. This wait |
2295 |
++ * must be done before transaction start for quota disable since it may |
2296 |
++ * deadlock with transaction by the qgroup rescan worker. |
2297 |
++ */ |
2298 |
++ clear_bit(BTRFS_FS_QUOTA_ENABLED, &fs_info->flags); |
2299 |
++ btrfs_qgroup_wait_for_completion(fs_info, false); |
2300 |
+ mutex_unlock(&fs_info->qgroup_ioctl_lock); |
2301 |
+ |
2302 |
+ /* |
2303 |
+@@ -1205,14 +1220,13 @@ int btrfs_quota_disable(struct btrfs_fs_info *fs_info) |
2304 |
+ if (IS_ERR(trans)) { |
2305 |
+ ret = PTR_ERR(trans); |
2306 |
+ trans = NULL; |
2307 |
++ set_bit(BTRFS_FS_QUOTA_ENABLED, &fs_info->flags); |
2308 |
+ goto out; |
2309 |
+ } |
2310 |
+ |
2311 |
+ if (!fs_info->quota_root) |
2312 |
+ goto out; |
2313 |
+ |
2314 |
+- clear_bit(BTRFS_FS_QUOTA_ENABLED, &fs_info->flags); |
2315 |
+- btrfs_qgroup_wait_for_completion(fs_info, false); |
2316 |
+ spin_lock(&fs_info->qgroup_lock); |
2317 |
+ quota_root = fs_info->quota_root; |
2318 |
+ fs_info->quota_root = NULL; |
2319 |
+@@ -3379,6 +3393,9 @@ qgroup_rescan_init(struct btrfs_fs_info *fs_info, u64 progress_objectid, |
2320 |
+ btrfs_warn(fs_info, |
2321 |
+ "qgroup rescan init failed, qgroup is not enabled"); |
2322 |
+ ret = -EINVAL; |
2323 |
++ } else if (!test_bit(BTRFS_FS_QUOTA_ENABLED, &fs_info->flags)) { |
2324 |
++ /* Quota disable is in progress */ |
2325 |
++ ret = -EBUSY; |
2326 |
+ } |
2327 |
+ |
2328 |
+ if (ret) { |
2329 |
+diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c |
2330 |
+index 14b9fdc8aaa9a..f1ae5a5b79c68 100644 |
2331 |
+--- a/fs/btrfs/transaction.c |
2332 |
++++ b/fs/btrfs/transaction.c |
2333 |
+@@ -2033,6 +2033,27 @@ static inline void btrfs_wait_delalloc_flush(struct btrfs_fs_info *fs_info) |
2334 |
+ btrfs_wait_ordered_roots(fs_info, U64_MAX, 0, (u64)-1); |
2335 |
+ } |
2336 |
+ |
2337 |
++/* |
2338 |
++ * Add a pending snapshot associated with the given transaction handle to the |
2339 |
++ * respective handle. This must be called after the transaction commit started |
2340 |
++ * and while holding fs_info->trans_lock. |
2341 |
++ * This serves to guarantee a caller of btrfs_commit_transaction() that it can |
2342 |
++ * safely free the pending snapshot pointer in case btrfs_commit_transaction() |
2343 |
++ * returns an error. |
2344 |
++ */ |
2345 |
++static void add_pending_snapshot(struct btrfs_trans_handle *trans) |
2346 |
++{ |
2347 |
++ struct btrfs_transaction *cur_trans = trans->transaction; |
2348 |
++ |
2349 |
++ if (!trans->pending_snapshot) |
2350 |
++ return; |
2351 |
++ |
2352 |
++ lockdep_assert_held(&trans->fs_info->trans_lock); |
2353 |
++ ASSERT(cur_trans->state >= TRANS_STATE_COMMIT_START); |
2354 |
++ |
2355 |
++ list_add(&trans->pending_snapshot->list, &cur_trans->pending_snapshots); |
2356 |
++} |
2357 |
++ |
2358 |
+ int btrfs_commit_transaction(struct btrfs_trans_handle *trans) |
2359 |
+ { |
2360 |
+ struct btrfs_fs_info *fs_info = trans->fs_info; |
2361 |
+@@ -2106,6 +2127,8 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans) |
2362 |
+ if (cur_trans->state >= TRANS_STATE_COMMIT_START) { |
2363 |
+ enum btrfs_trans_state want_state = TRANS_STATE_COMPLETED; |
2364 |
+ |
2365 |
++ add_pending_snapshot(trans); |
2366 |
++ |
2367 |
+ spin_unlock(&fs_info->trans_lock); |
2368 |
+ refcount_inc(&cur_trans->use_count); |
2369 |
+ |
2370 |
+@@ -2196,6 +2219,7 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans) |
2371 |
+ * COMMIT_DOING so make sure to wait for num_writers to == 1 again. |
2372 |
+ */ |
2373 |
+ spin_lock(&fs_info->trans_lock); |
2374 |
++ add_pending_snapshot(trans); |
2375 |
+ cur_trans->state = TRANS_STATE_COMMIT_DOING; |
2376 |
+ spin_unlock(&fs_info->trans_lock); |
2377 |
+ wait_event(cur_trans->writer_wait, |
2378 |
+diff --git a/fs/btrfs/transaction.h b/fs/btrfs/transaction.h |
2379 |
+index ba45065f94511..eba07b8119bbd 100644 |
2380 |
+--- a/fs/btrfs/transaction.h |
2381 |
++++ b/fs/btrfs/transaction.h |
2382 |
+@@ -123,6 +123,8 @@ struct btrfs_trans_handle { |
2383 |
+ struct btrfs_transaction *transaction; |
2384 |
+ struct btrfs_block_rsv *block_rsv; |
2385 |
+ struct btrfs_block_rsv *orig_rsv; |
2386 |
++ /* Set by a task that wants to create a snapshot. */ |
2387 |
++ struct btrfs_pending_snapshot *pending_snapshot; |
2388 |
+ refcount_t use_count; |
2389 |
+ unsigned int type; |
2390 |
+ /* |
2391 |
+diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h |
2392 |
+index c97860ef322db..7ebc816ae39f8 100644 |
2393 |
+--- a/fs/ext4/ext4.h |
2394 |
++++ b/fs/ext4/ext4.h |
2395 |
+@@ -2935,6 +2935,9 @@ void ext4_fc_replay_cleanup(struct super_block *sb); |
2396 |
+ int ext4_fc_commit(journal_t *journal, tid_t commit_tid); |
2397 |
+ int __init ext4_fc_init_dentry_cache(void); |
2398 |
+ void ext4_fc_destroy_dentry_cache(void); |
2399 |
++int ext4_fc_record_regions(struct super_block *sb, int ino, |
2400 |
++ ext4_lblk_t lblk, ext4_fsblk_t pblk, |
2401 |
++ int len, int replay); |
2402 |
+ |
2403 |
+ /* mballoc.c */ |
2404 |
+ extern const struct seq_operations ext4_mb_seq_groups_ops; |
2405 |
+diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c |
2406 |
+index f9bd3231a1415..c35cb6d9b7b5f 100644 |
2407 |
+--- a/fs/ext4/extents.c |
2408 |
++++ b/fs/ext4/extents.c |
2409 |
+@@ -6096,11 +6096,15 @@ int ext4_ext_clear_bb(struct inode *inode) |
2410 |
+ |
2411 |
+ ext4_mb_mark_bb(inode->i_sb, |
2412 |
+ path[j].p_block, 1, 0); |
2413 |
++ ext4_fc_record_regions(inode->i_sb, inode->i_ino, |
2414 |
++ 0, path[j].p_block, 1, 1); |
2415 |
+ } |
2416 |
+ ext4_ext_drop_refs(path); |
2417 |
+ kfree(path); |
2418 |
+ } |
2419 |
+ ext4_mb_mark_bb(inode->i_sb, map.m_pblk, map.m_len, 0); |
2420 |
++ ext4_fc_record_regions(inode->i_sb, inode->i_ino, |
2421 |
++ map.m_lblk, map.m_pblk, map.m_len, 1); |
2422 |
+ } |
2423 |
+ cur = cur + map.m_len; |
2424 |
+ } |
2425 |
+diff --git a/fs/ext4/fast_commit.c b/fs/ext4/fast_commit.c |
2426 |
+index e0d393425caca..7bcd3be07ee46 100644 |
2427 |
+--- a/fs/ext4/fast_commit.c |
2428 |
++++ b/fs/ext4/fast_commit.c |
2429 |
+@@ -1433,14 +1433,15 @@ static int ext4_fc_record_modified_inode(struct super_block *sb, int ino) |
2430 |
+ if (state->fc_modified_inodes[i] == ino) |
2431 |
+ return 0; |
2432 |
+ if (state->fc_modified_inodes_used == state->fc_modified_inodes_size) { |
2433 |
+- state->fc_modified_inodes_size += |
2434 |
+- EXT4_FC_REPLAY_REALLOC_INCREMENT; |
2435 |
+ state->fc_modified_inodes = krealloc( |
2436 |
+- state->fc_modified_inodes, sizeof(int) * |
2437 |
+- state->fc_modified_inodes_size, |
2438 |
+- GFP_KERNEL); |
2439 |
++ state->fc_modified_inodes, |
2440 |
++ sizeof(int) * (state->fc_modified_inodes_size + |
2441 |
++ EXT4_FC_REPLAY_REALLOC_INCREMENT), |
2442 |
++ GFP_KERNEL); |
2443 |
+ if (!state->fc_modified_inodes) |
2444 |
+ return -ENOMEM; |
2445 |
++ state->fc_modified_inodes_size += |
2446 |
++ EXT4_FC_REPLAY_REALLOC_INCREMENT; |
2447 |
+ } |
2448 |
+ state->fc_modified_inodes[state->fc_modified_inodes_used++] = ino; |
2449 |
+ return 0; |
2450 |
+@@ -1472,7 +1473,9 @@ static int ext4_fc_replay_inode(struct super_block *sb, struct ext4_fc_tl *tl, |
2451 |
+ } |
2452 |
+ inode = NULL; |
2453 |
+ |
2454 |
+- ext4_fc_record_modified_inode(sb, ino); |
2455 |
++ ret = ext4_fc_record_modified_inode(sb, ino); |
2456 |
++ if (ret) |
2457 |
++ goto out; |
2458 |
+ |
2459 |
+ raw_fc_inode = (struct ext4_inode *) |
2460 |
+ (val + offsetof(struct ext4_fc_inode, fc_raw_inode)); |
2461 |
+@@ -1603,16 +1606,23 @@ out: |
2462 |
+ } |
2463 |
+ |
2464 |
+ /* |
2465 |
+- * Record physical disk regions which are in use as per fast commit area. Our |
2466 |
+- * simple replay phase allocator excludes these regions from allocation. |
2467 |
++ * Record physical disk regions which are in use as per fast commit area, |
2468 |
++ * and used by inodes during replay phase. Our simple replay phase |
2469 |
++ * allocator excludes these regions from allocation. |
2470 |
+ */ |
2471 |
+-static int ext4_fc_record_regions(struct super_block *sb, int ino, |
2472 |
+- ext4_lblk_t lblk, ext4_fsblk_t pblk, int len) |
2473 |
++int ext4_fc_record_regions(struct super_block *sb, int ino, |
2474 |
++ ext4_lblk_t lblk, ext4_fsblk_t pblk, int len, int replay) |
2475 |
+ { |
2476 |
+ struct ext4_fc_replay_state *state; |
2477 |
+ struct ext4_fc_alloc_region *region; |
2478 |
+ |
2479 |
+ state = &EXT4_SB(sb)->s_fc_replay_state; |
2480 |
++ /* |
2481 |
++ * during replay phase, the fc_regions_valid may not same as |
2482 |
++ * fc_regions_used, update it when do new additions. |
2483 |
++ */ |
2484 |
++ if (replay && state->fc_regions_used != state->fc_regions_valid) |
2485 |
++ state->fc_regions_used = state->fc_regions_valid; |
2486 |
+ if (state->fc_regions_used == state->fc_regions_size) { |
2487 |
+ state->fc_regions_size += |
2488 |
+ EXT4_FC_REPLAY_REALLOC_INCREMENT; |
2489 |
+@@ -1630,6 +1640,9 @@ static int ext4_fc_record_regions(struct super_block *sb, int ino, |
2490 |
+ region->pblk = pblk; |
2491 |
+ region->len = len; |
2492 |
+ |
2493 |
++ if (replay) |
2494 |
++ state->fc_regions_valid++; |
2495 |
++ |
2496 |
+ return 0; |
2497 |
+ } |
2498 |
+ |
2499 |
+@@ -1661,6 +1674,8 @@ static int ext4_fc_replay_add_range(struct super_block *sb, |
2500 |
+ } |
2501 |
+ |
2502 |
+ ret = ext4_fc_record_modified_inode(sb, inode->i_ino); |
2503 |
++ if (ret) |
2504 |
++ goto out; |
2505 |
+ |
2506 |
+ start = le32_to_cpu(ex->ee_block); |
2507 |
+ start_pblk = ext4_ext_pblock(ex); |
2508 |
+@@ -1678,18 +1693,14 @@ static int ext4_fc_replay_add_range(struct super_block *sb, |
2509 |
+ map.m_pblk = 0; |
2510 |
+ ret = ext4_map_blocks(NULL, inode, &map, 0); |
2511 |
+ |
2512 |
+- if (ret < 0) { |
2513 |
+- iput(inode); |
2514 |
+- return 0; |
2515 |
+- } |
2516 |
++ if (ret < 0) |
2517 |
++ goto out; |
2518 |
+ |
2519 |
+ if (ret == 0) { |
2520 |
+ /* Range is not mapped */ |
2521 |
+ path = ext4_find_extent(inode, cur, NULL, 0); |
2522 |
+- if (IS_ERR(path)) { |
2523 |
+- iput(inode); |
2524 |
+- return 0; |
2525 |
+- } |
2526 |
++ if (IS_ERR(path)) |
2527 |
++ goto out; |
2528 |
+ memset(&newex, 0, sizeof(newex)); |
2529 |
+ newex.ee_block = cpu_to_le32(cur); |
2530 |
+ ext4_ext_store_pblock( |
2531 |
+@@ -1703,10 +1714,8 @@ static int ext4_fc_replay_add_range(struct super_block *sb, |
2532 |
+ up_write((&EXT4_I(inode)->i_data_sem)); |
2533 |
+ ext4_ext_drop_refs(path); |
2534 |
+ kfree(path); |
2535 |
+- if (ret) { |
2536 |
+- iput(inode); |
2537 |
+- return 0; |
2538 |
+- } |
2539 |
++ if (ret) |
2540 |
++ goto out; |
2541 |
+ goto next; |
2542 |
+ } |
2543 |
+ |
2544 |
+@@ -1719,10 +1728,8 @@ static int ext4_fc_replay_add_range(struct super_block *sb, |
2545 |
+ ret = ext4_ext_replay_update_ex(inode, cur, map.m_len, |
2546 |
+ ext4_ext_is_unwritten(ex), |
2547 |
+ start_pblk + cur - start); |
2548 |
+- if (ret) { |
2549 |
+- iput(inode); |
2550 |
+- return 0; |
2551 |
+- } |
2552 |
++ if (ret) |
2553 |
++ goto out; |
2554 |
+ /* |
2555 |
+ * Mark the old blocks as free since they aren't used |
2556 |
+ * anymore. We maintain an array of all the modified |
2557 |
+@@ -1742,10 +1749,8 @@ static int ext4_fc_replay_add_range(struct super_block *sb, |
2558 |
+ ext4_ext_is_unwritten(ex), map.m_pblk); |
2559 |
+ ret = ext4_ext_replay_update_ex(inode, cur, map.m_len, |
2560 |
+ ext4_ext_is_unwritten(ex), map.m_pblk); |
2561 |
+- if (ret) { |
2562 |
+- iput(inode); |
2563 |
+- return 0; |
2564 |
+- } |
2565 |
++ if (ret) |
2566 |
++ goto out; |
2567 |
+ /* |
2568 |
+ * We may have split the extent tree while toggling the state. |
2569 |
+ * Try to shrink the extent tree now. |
2570 |
+@@ -1757,6 +1762,7 @@ next: |
2571 |
+ } |
2572 |
+ ext4_ext_replay_shrink_inode(inode, i_size_read(inode) >> |
2573 |
+ sb->s_blocksize_bits); |
2574 |
++out: |
2575 |
+ iput(inode); |
2576 |
+ return 0; |
2577 |
+ } |
2578 |
+@@ -1786,6 +1792,8 @@ ext4_fc_replay_del_range(struct super_block *sb, struct ext4_fc_tl *tl, |
2579 |
+ } |
2580 |
+ |
2581 |
+ ret = ext4_fc_record_modified_inode(sb, inode->i_ino); |
2582 |
++ if (ret) |
2583 |
++ goto out; |
2584 |
+ |
2585 |
+ jbd_debug(1, "DEL_RANGE, inode %ld, lblk %d, len %d\n", |
2586 |
+ inode->i_ino, le32_to_cpu(lrange.fc_lblk), |
2587 |
+@@ -1795,10 +1803,8 @@ ext4_fc_replay_del_range(struct super_block *sb, struct ext4_fc_tl *tl, |
2588 |
+ map.m_len = remaining; |
2589 |
+ |
2590 |
+ ret = ext4_map_blocks(NULL, inode, &map, 0); |
2591 |
+- if (ret < 0) { |
2592 |
+- iput(inode); |
2593 |
+- return 0; |
2594 |
+- } |
2595 |
++ if (ret < 0) |
2596 |
++ goto out; |
2597 |
+ if (ret > 0) { |
2598 |
+ remaining -= ret; |
2599 |
+ cur += ret; |
2600 |
+@@ -1810,18 +1816,17 @@ ext4_fc_replay_del_range(struct super_block *sb, struct ext4_fc_tl *tl, |
2601 |
+ } |
2602 |
+ |
2603 |
+ down_write(&EXT4_I(inode)->i_data_sem); |
2604 |
+- ret = ext4_ext_remove_space(inode, lrange.fc_lblk, |
2605 |
+- lrange.fc_lblk + lrange.fc_len - 1); |
2606 |
++ ret = ext4_ext_remove_space(inode, le32_to_cpu(lrange.fc_lblk), |
2607 |
++ le32_to_cpu(lrange.fc_lblk) + |
2608 |
++ le32_to_cpu(lrange.fc_len) - 1); |
2609 |
+ up_write(&EXT4_I(inode)->i_data_sem); |
2610 |
+- if (ret) { |
2611 |
+- iput(inode); |
2612 |
+- return 0; |
2613 |
+- } |
2614 |
++ if (ret) |
2615 |
++ goto out; |
2616 |
+ ext4_ext_replay_shrink_inode(inode, |
2617 |
+ i_size_read(inode) >> sb->s_blocksize_bits); |
2618 |
+ ext4_mark_inode_dirty(NULL, inode); |
2619 |
++out: |
2620 |
+ iput(inode); |
2621 |
+- |
2622 |
+ return 0; |
2623 |
+ } |
2624 |
+ |
2625 |
+@@ -1973,7 +1978,7 @@ static int ext4_fc_replay_scan(journal_t *journal, |
2626 |
+ ret = ext4_fc_record_regions(sb, |
2627 |
+ le32_to_cpu(ext.fc_ino), |
2628 |
+ le32_to_cpu(ex->ee_block), ext4_ext_pblock(ex), |
2629 |
+- ext4_ext_get_actual_len(ex)); |
2630 |
++ ext4_ext_get_actual_len(ex), 0); |
2631 |
+ if (ret < 0) |
2632 |
+ break; |
2633 |
+ ret = JBD2_FC_REPLAY_CONTINUE; |
2634 |
+diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c |
2635 |
+index 39a1ab129fdc9..d091133a4b460 100644 |
2636 |
+--- a/fs/ext4/inline.c |
2637 |
++++ b/fs/ext4/inline.c |
2638 |
+@@ -1133,7 +1133,15 @@ static void ext4_restore_inline_data(handle_t *handle, struct inode *inode, |
2639 |
+ struct ext4_iloc *iloc, |
2640 |
+ void *buf, int inline_size) |
2641 |
+ { |
2642 |
+- ext4_create_inline_data(handle, inode, inline_size); |
2643 |
++ int ret; |
2644 |
++ |
2645 |
++ ret = ext4_create_inline_data(handle, inode, inline_size); |
2646 |
++ if (ret) { |
2647 |
++ ext4_msg(inode->i_sb, KERN_EMERG, |
2648 |
++ "error restoring inline_data for inode -- potential data loss! (inode %lu, error %d)", |
2649 |
++ inode->i_ino, ret); |
2650 |
++ return; |
2651 |
++ } |
2652 |
+ ext4_write_inline_data(inode, iloc, buf, 0, inline_size); |
2653 |
+ ext4_set_inode_state(inode, EXT4_STATE_MAY_INLINE_DATA); |
2654 |
+ } |
2655 |
+diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c |
2656 |
+index b05a83be88715..74e3286d0e262 100644 |
2657 |
+--- a/fs/ext4/mballoc.c |
2658 |
++++ b/fs/ext4/mballoc.c |
2659 |
+@@ -5753,7 +5753,8 @@ static ext4_fsblk_t ext4_mb_new_blocks_simple(handle_t *handle, |
2660 |
+ struct super_block *sb = ar->inode->i_sb; |
2661 |
+ ext4_group_t group; |
2662 |
+ ext4_grpblk_t blkoff; |
2663 |
+- int i = sb->s_blocksize; |
2664 |
++ ext4_grpblk_t max = EXT4_CLUSTERS_PER_GROUP(sb); |
2665 |
++ ext4_grpblk_t i = 0; |
2666 |
+ ext4_fsblk_t goal, block; |
2667 |
+ struct ext4_super_block *es = EXT4_SB(sb)->s_es; |
2668 |
+ |
2669 |
+@@ -5775,19 +5776,26 @@ static ext4_fsblk_t ext4_mb_new_blocks_simple(handle_t *handle, |
2670 |
+ ext4_get_group_no_and_offset(sb, |
2671 |
+ max(ext4_group_first_block_no(sb, group), goal), |
2672 |
+ NULL, &blkoff); |
2673 |
+- i = mb_find_next_zero_bit(bitmap_bh->b_data, sb->s_blocksize, |
2674 |
++ while (1) { |
2675 |
++ i = mb_find_next_zero_bit(bitmap_bh->b_data, max, |
2676 |
+ blkoff); |
2677 |
++ if (i >= max) |
2678 |
++ break; |
2679 |
++ if (ext4_fc_replay_check_excluded(sb, |
2680 |
++ ext4_group_first_block_no(sb, group) + i)) { |
2681 |
++ blkoff = i + 1; |
2682 |
++ } else |
2683 |
++ break; |
2684 |
++ } |
2685 |
+ brelse(bitmap_bh); |
2686 |
+- if (i >= sb->s_blocksize) |
2687 |
+- continue; |
2688 |
+- if (ext4_fc_replay_check_excluded(sb, |
2689 |
+- ext4_group_first_block_no(sb, group) + i)) |
2690 |
+- continue; |
2691 |
+- break; |
2692 |
++ if (i < max) |
2693 |
++ break; |
2694 |
+ } |
2695 |
+ |
2696 |
+- if (group >= ext4_get_groups_count(sb) && i >= sb->s_blocksize) |
2697 |
++ if (group >= ext4_get_groups_count(sb) || i >= max) { |
2698 |
++ *errp = -ENOSPC; |
2699 |
+ return 0; |
2700 |
++ } |
2701 |
+ |
2702 |
+ block = ext4_group_first_block_no(sb, group) + i; |
2703 |
+ ext4_mb_mark_bb(sb, block, 1, 1); |
2704 |
+diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c |
2705 |
+index 61301affb4c1b..97090ddcfc94d 100644 |
2706 |
+--- a/fs/nfsd/nfs4state.c |
2707 |
++++ b/fs/nfsd/nfs4state.c |
2708 |
+@@ -4112,8 +4112,10 @@ nfsd4_setclientid_confirm(struct svc_rqst *rqstp, |
2709 |
+ status = nfserr_clid_inuse; |
2710 |
+ if (client_has_state(old) |
2711 |
+ && !same_creds(&unconf->cl_cred, |
2712 |
+- &old->cl_cred)) |
2713 |
++ &old->cl_cred)) { |
2714 |
++ old = NULL; |
2715 |
+ goto out; |
2716 |
++ } |
2717 |
+ status = mark_client_expired_locked(old); |
2718 |
+ if (status) { |
2719 |
+ old = NULL; |
2720 |
+diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h |
2721 |
+index 0f18df7fe8749..926f60499c347 100644 |
2722 |
+--- a/include/linux/kvm_host.h |
2723 |
++++ b/include/linux/kvm_host.h |
2724 |
+@@ -15,6 +15,8 @@ |
2725 |
+ #include <linux/minmax.h> |
2726 |
+ #include <linux/mm.h> |
2727 |
+ #include <linux/mmu_notifier.h> |
2728 |
++#include <linux/ftrace.h> |
2729 |
++#include <linux/instrumentation.h> |
2730 |
+ #include <linux/preempt.h> |
2731 |
+ #include <linux/msi.h> |
2732 |
+ #include <linux/slab.h> |
2733 |
+@@ -363,8 +365,11 @@ struct kvm_vcpu { |
2734 |
+ int last_used_slot; |
2735 |
+ }; |
2736 |
+ |
2737 |
+-/* must be called with irqs disabled */ |
2738 |
+-static __always_inline void guest_enter_irqoff(void) |
2739 |
++/* |
2740 |
++ * Start accounting time towards a guest. |
2741 |
++ * Must be called before entering guest context. |
2742 |
++ */ |
2743 |
++static __always_inline void guest_timing_enter_irqoff(void) |
2744 |
+ { |
2745 |
+ /* |
2746 |
+ * This is running in ioctl context so its safe to assume that it's the |
2747 |
+@@ -373,7 +378,18 @@ static __always_inline void guest_enter_irqoff(void) |
2748 |
+ instrumentation_begin(); |
2749 |
+ vtime_account_guest_enter(); |
2750 |
+ instrumentation_end(); |
2751 |
++} |
2752 |
+ |
2753 |
++/* |
2754 |
++ * Enter guest context and enter an RCU extended quiescent state. |
2755 |
++ * |
2756 |
++ * Between guest_context_enter_irqoff() and guest_context_exit_irqoff() it is |
2757 |
++ * unsafe to use any code which may directly or indirectly use RCU, tracing |
2758 |
++ * (including IRQ flag tracing), or lockdep. All code in this period must be |
2759 |
++ * non-instrumentable. |
2760 |
++ */ |
2761 |
++static __always_inline void guest_context_enter_irqoff(void) |
2762 |
++{ |
2763 |
+ /* |
2764 |
+ * KVM does not hold any references to rcu protected data when it |
2765 |
+ * switches CPU into a guest mode. In fact switching to a guest mode |
2766 |
+@@ -389,16 +405,79 @@ static __always_inline void guest_enter_irqoff(void) |
2767 |
+ } |
2768 |
+ } |
2769 |
+ |
2770 |
+-static __always_inline void guest_exit_irqoff(void) |
2771 |
++/* |
2772 |
++ * Deprecated. Architectures should move to guest_timing_enter_irqoff() and |
2773 |
++ * guest_state_enter_irqoff(). |
2774 |
++ */ |
2775 |
++static __always_inline void guest_enter_irqoff(void) |
2776 |
++{ |
2777 |
++ guest_timing_enter_irqoff(); |
2778 |
++ guest_context_enter_irqoff(); |
2779 |
++} |
2780 |
++ |
2781 |
++/** |
2782 |
++ * guest_state_enter_irqoff - Fixup state when entering a guest |
2783 |
++ * |
2784 |
++ * Entry to a guest will enable interrupts, but the kernel state is interrupts |
2785 |
++ * disabled when this is invoked. Also tell RCU about it. |
2786 |
++ * |
2787 |
++ * 1) Trace interrupts on state |
2788 |
++ * 2) Invoke context tracking if enabled to adjust RCU state |
2789 |
++ * 3) Tell lockdep that interrupts are enabled |
2790 |
++ * |
2791 |
++ * Invoked from architecture specific code before entering a guest. |
2792 |
++ * Must be called with interrupts disabled and the caller must be |
2793 |
++ * non-instrumentable. |
2794 |
++ * The caller has to invoke guest_timing_enter_irqoff() before this. |
2795 |
++ * |
2796 |
++ * Note: this is analogous to exit_to_user_mode(). |
2797 |
++ */ |
2798 |
++static __always_inline void guest_state_enter_irqoff(void) |
2799 |
++{ |
2800 |
++ instrumentation_begin(); |
2801 |
++ trace_hardirqs_on_prepare(); |
2802 |
++ lockdep_hardirqs_on_prepare(CALLER_ADDR0); |
2803 |
++ instrumentation_end(); |
2804 |
++ |
2805 |
++ guest_context_enter_irqoff(); |
2806 |
++ lockdep_hardirqs_on(CALLER_ADDR0); |
2807 |
++} |
2808 |
++ |
2809 |
++/* |
2810 |
++ * Exit guest context and exit an RCU extended quiescent state. |
2811 |
++ * |
2812 |
++ * Between guest_context_enter_irqoff() and guest_context_exit_irqoff() it is |
2813 |
++ * unsafe to use any code which may directly or indirectly use RCU, tracing |
2814 |
++ * (including IRQ flag tracing), or lockdep. All code in this period must be |
2815 |
++ * non-instrumentable. |
2816 |
++ */ |
2817 |
++static __always_inline void guest_context_exit_irqoff(void) |
2818 |
+ { |
2819 |
+ context_tracking_guest_exit(); |
2820 |
++} |
2821 |
+ |
2822 |
++/* |
2823 |
++ * Stop accounting time towards a guest. |
2824 |
++ * Must be called after exiting guest context. |
2825 |
++ */ |
2826 |
++static __always_inline void guest_timing_exit_irqoff(void) |
2827 |
++{ |
2828 |
+ instrumentation_begin(); |
2829 |
+ /* Flush the guest cputime we spent on the guest */ |
2830 |
+ vtime_account_guest_exit(); |
2831 |
+ instrumentation_end(); |
2832 |
+ } |
2833 |
+ |
2834 |
++/* |
2835 |
++ * Deprecated. Architectures should move to guest_state_exit_irqoff() and |
2836 |
++ * guest_timing_exit_irqoff(). |
2837 |
++ */ |
2838 |
++static __always_inline void guest_exit_irqoff(void) |
2839 |
++{ |
2840 |
++ guest_context_exit_irqoff(); |
2841 |
++ guest_timing_exit_irqoff(); |
2842 |
++} |
2843 |
++ |
2844 |
+ static inline void guest_exit(void) |
2845 |
+ { |
2846 |
+ unsigned long flags; |
2847 |
+@@ -408,6 +487,33 @@ static inline void guest_exit(void) |
2848 |
+ local_irq_restore(flags); |
2849 |
+ } |
2850 |
+ |
2851 |
++/** |
2852 |
++ * guest_state_exit_irqoff - Establish state when returning from guest mode |
2853 |
++ * |
2854 |
++ * Entry from a guest disables interrupts, but guest mode is traced as |
2855 |
++ * interrupts enabled. Also with NO_HZ_FULL RCU might be idle. |
2856 |
++ * |
2857 |
++ * 1) Tell lockdep that interrupts are disabled |
2858 |
++ * 2) Invoke context tracking if enabled to reactivate RCU |
2859 |
++ * 3) Trace interrupts off state |
2860 |
++ * |
2861 |
++ * Invoked from architecture specific code after exiting a guest. |
2862 |
++ * Must be invoked with interrupts disabled and the caller must be |
2863 |
++ * non-instrumentable. |
2864 |
++ * The caller has to invoke guest_timing_exit_irqoff() after this. |
2865 |
++ * |
2866 |
++ * Note: this is analogous to enter_from_user_mode(). |
2867 |
++ */ |
2868 |
++static __always_inline void guest_state_exit_irqoff(void) |
2869 |
++{ |
2870 |
++ lockdep_hardirqs_off(CALLER_ADDR0); |
2871 |
++ guest_context_exit_irqoff(); |
2872 |
++ |
2873 |
++ instrumentation_begin(); |
2874 |
++ trace_hardirqs_off_finish(); |
2875 |
++ instrumentation_end(); |
2876 |
++} |
2877 |
++ |
2878 |
+ static inline int kvm_vcpu_exiting_guest_mode(struct kvm_vcpu *vcpu) |
2879 |
+ { |
2880 |
+ /* |
2881 |
+diff --git a/include/linux/pgtable.h b/include/linux/pgtable.h |
2882 |
+index e24d2c992b112..d468efcf48f45 100644 |
2883 |
+--- a/include/linux/pgtable.h |
2884 |
++++ b/include/linux/pgtable.h |
2885 |
+@@ -62,6 +62,7 @@ static inline unsigned long pte_index(unsigned long address) |
2886 |
+ { |
2887 |
+ return (address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1); |
2888 |
+ } |
2889 |
++#define pte_index pte_index |
2890 |
+ |
2891 |
+ #ifndef pmd_index |
2892 |
+ static inline unsigned long pmd_index(unsigned long address) |
2893 |
+diff --git a/include/uapi/sound/asound.h b/include/uapi/sound/asound.h |
2894 |
+index 5859ca0a1439b..93e40f91bd49a 100644 |
2895 |
+--- a/include/uapi/sound/asound.h |
2896 |
++++ b/include/uapi/sound/asound.h |
2897 |
+@@ -56,8 +56,10 @@ |
2898 |
+ * * |
2899 |
+ ****************************************************************************/ |
2900 |
+ |
2901 |
++#define AES_IEC958_STATUS_SIZE 24 |
2902 |
++ |
2903 |
+ struct snd_aes_iec958 { |
2904 |
+- unsigned char status[24]; /* AES/IEC958 channel status bits */ |
2905 |
++ unsigned char status[AES_IEC958_STATUS_SIZE]; /* AES/IEC958 channel status bits */ |
2906 |
+ unsigned char subcode[147]; /* AES/IEC958 subcode bits */ |
2907 |
+ unsigned char pad; /* nothing */ |
2908 |
+ unsigned char dig_subframe[4]; /* AES/IEC958 subframe bits */ |
2909 |
+diff --git a/ipc/sem.c b/ipc/sem.c |
2910 |
+index 6693daf4fe112..0dbdb98fdf2d9 100644 |
2911 |
+--- a/ipc/sem.c |
2912 |
++++ b/ipc/sem.c |
2913 |
+@@ -1964,6 +1964,7 @@ static struct sem_undo *find_alloc_undo(struct ipc_namespace *ns, int semid) |
2914 |
+ */ |
2915 |
+ un = lookup_undo(ulp, semid); |
2916 |
+ if (un) { |
2917 |
++ spin_unlock(&ulp->lock); |
2918 |
+ kvfree(new); |
2919 |
+ goto success; |
2920 |
+ } |
2921 |
+@@ -1976,9 +1977,8 @@ static struct sem_undo *find_alloc_undo(struct ipc_namespace *ns, int semid) |
2922 |
+ ipc_assert_locked_object(&sma->sem_perm); |
2923 |
+ list_add(&new->list_id, &sma->list_id); |
2924 |
+ un = new; |
2925 |
+- |
2926 |
+-success: |
2927 |
+ spin_unlock(&ulp->lock); |
2928 |
++success: |
2929 |
+ sem_unlock(sma, -1); |
2930 |
+ out: |
2931 |
+ return un; |
2932 |
+diff --git a/kernel/audit.c b/kernel/audit.c |
2933 |
+index eab7282668ab9..94ded5de91317 100644 |
2934 |
+--- a/kernel/audit.c |
2935 |
++++ b/kernel/audit.c |
2936 |
+@@ -541,20 +541,22 @@ static void kauditd_printk_skb(struct sk_buff *skb) |
2937 |
+ /** |
2938 |
+ * kauditd_rehold_skb - Handle a audit record send failure in the hold queue |
2939 |
+ * @skb: audit record |
2940 |
++ * @error: error code (unused) |
2941 |
+ * |
2942 |
+ * Description: |
2943 |
+ * This should only be used by the kauditd_thread when it fails to flush the |
2944 |
+ * hold queue. |
2945 |
+ */ |
2946 |
+-static void kauditd_rehold_skb(struct sk_buff *skb) |
2947 |
++static void kauditd_rehold_skb(struct sk_buff *skb, __always_unused int error) |
2948 |
+ { |
2949 |
+- /* put the record back in the queue at the same place */ |
2950 |
+- skb_queue_head(&audit_hold_queue, skb); |
2951 |
++ /* put the record back in the queue */ |
2952 |
++ skb_queue_tail(&audit_hold_queue, skb); |
2953 |
+ } |
2954 |
+ |
2955 |
+ /** |
2956 |
+ * kauditd_hold_skb - Queue an audit record, waiting for auditd |
2957 |
+ * @skb: audit record |
2958 |
++ * @error: error code |
2959 |
+ * |
2960 |
+ * Description: |
2961 |
+ * Queue the audit record, waiting for an instance of auditd. When this |
2962 |
+@@ -564,19 +566,31 @@ static void kauditd_rehold_skb(struct sk_buff *skb) |
2963 |
+ * and queue it, if we have room. If we want to hold on to the record, but we |
2964 |
+ * don't have room, record a record lost message. |
2965 |
+ */ |
2966 |
+-static void kauditd_hold_skb(struct sk_buff *skb) |
2967 |
++static void kauditd_hold_skb(struct sk_buff *skb, int error) |
2968 |
+ { |
2969 |
+ /* at this point it is uncertain if we will ever send this to auditd so |
2970 |
+ * try to send the message via printk before we go any further */ |
2971 |
+ kauditd_printk_skb(skb); |
2972 |
+ |
2973 |
+ /* can we just silently drop the message? */ |
2974 |
+- if (!audit_default) { |
2975 |
+- kfree_skb(skb); |
2976 |
+- return; |
2977 |
++ if (!audit_default) |
2978 |
++ goto drop; |
2979 |
++ |
2980 |
++ /* the hold queue is only for when the daemon goes away completely, |
2981 |
++ * not -EAGAIN failures; if we are in a -EAGAIN state requeue the |
2982 |
++ * record on the retry queue unless it's full, in which case drop it |
2983 |
++ */ |
2984 |
++ if (error == -EAGAIN) { |
2985 |
++ if (!audit_backlog_limit || |
2986 |
++ skb_queue_len(&audit_retry_queue) < audit_backlog_limit) { |
2987 |
++ skb_queue_tail(&audit_retry_queue, skb); |
2988 |
++ return; |
2989 |
++ } |
2990 |
++ audit_log_lost("kauditd retry queue overflow"); |
2991 |
++ goto drop; |
2992 |
+ } |
2993 |
+ |
2994 |
+- /* if we have room, queue the message */ |
2995 |
++ /* if we have room in the hold queue, queue the message */ |
2996 |
+ if (!audit_backlog_limit || |
2997 |
+ skb_queue_len(&audit_hold_queue) < audit_backlog_limit) { |
2998 |
+ skb_queue_tail(&audit_hold_queue, skb); |
2999 |
+@@ -585,24 +599,32 @@ static void kauditd_hold_skb(struct sk_buff *skb) |
3000 |
+ |
3001 |
+ /* we have no other options - drop the message */ |
3002 |
+ audit_log_lost("kauditd hold queue overflow"); |
3003 |
++drop: |
3004 |
+ kfree_skb(skb); |
3005 |
+ } |
3006 |
+ |
3007 |
+ /** |
3008 |
+ * kauditd_retry_skb - Queue an audit record, attempt to send again to auditd |
3009 |
+ * @skb: audit record |
3010 |
++ * @error: error code (unused) |
3011 |
+ * |
3012 |
+ * Description: |
3013 |
+ * Not as serious as kauditd_hold_skb() as we still have a connected auditd, |
3014 |
+ * but for some reason we are having problems sending it audit records so |
3015 |
+ * queue the given record and attempt to resend. |
3016 |
+ */ |
3017 |
+-static void kauditd_retry_skb(struct sk_buff *skb) |
3018 |
++static void kauditd_retry_skb(struct sk_buff *skb, __always_unused int error) |
3019 |
+ { |
3020 |
+- /* NOTE: because records should only live in the retry queue for a |
3021 |
+- * short period of time, before either being sent or moved to the hold |
3022 |
+- * queue, we don't currently enforce a limit on this queue */ |
3023 |
+- skb_queue_tail(&audit_retry_queue, skb); |
3024 |
++ if (!audit_backlog_limit || |
3025 |
++ skb_queue_len(&audit_retry_queue) < audit_backlog_limit) { |
3026 |
++ skb_queue_tail(&audit_retry_queue, skb); |
3027 |
++ return; |
3028 |
++ } |
3029 |
++ |
3030 |
++ /* we have to drop the record, send it via printk as a last effort */ |
3031 |
++ kauditd_printk_skb(skb); |
3032 |
++ audit_log_lost("kauditd retry queue overflow"); |
3033 |
++ kfree_skb(skb); |
3034 |
+ } |
3035 |
+ |
3036 |
+ /** |
3037 |
+@@ -640,7 +662,7 @@ static void auditd_reset(const struct auditd_connection *ac) |
3038 |
+ /* flush the retry queue to the hold queue, but don't touch the main |
3039 |
+ * queue since we need to process that normally for multicast */ |
3040 |
+ while ((skb = skb_dequeue(&audit_retry_queue))) |
3041 |
+- kauditd_hold_skb(skb); |
3042 |
++ kauditd_hold_skb(skb, -ECONNREFUSED); |
3043 |
+ } |
3044 |
+ |
3045 |
+ /** |
3046 |
+@@ -714,16 +736,18 @@ static int kauditd_send_queue(struct sock *sk, u32 portid, |
3047 |
+ struct sk_buff_head *queue, |
3048 |
+ unsigned int retry_limit, |
3049 |
+ void (*skb_hook)(struct sk_buff *skb), |
3050 |
+- void (*err_hook)(struct sk_buff *skb)) |
3051 |
++ void (*err_hook)(struct sk_buff *skb, int error)) |
3052 |
+ { |
3053 |
+ int rc = 0; |
3054 |
+- struct sk_buff *skb; |
3055 |
++ struct sk_buff *skb = NULL; |
3056 |
++ struct sk_buff *skb_tail; |
3057 |
+ unsigned int failed = 0; |
3058 |
+ |
3059 |
+ /* NOTE: kauditd_thread takes care of all our locking, we just use |
3060 |
+ * the netlink info passed to us (e.g. sk and portid) */ |
3061 |
+ |
3062 |
+- while ((skb = skb_dequeue(queue))) { |
3063 |
++ skb_tail = skb_peek_tail(queue); |
3064 |
++ while ((skb != skb_tail) && (skb = skb_dequeue(queue))) { |
3065 |
+ /* call the skb_hook for each skb we touch */ |
3066 |
+ if (skb_hook) |
3067 |
+ (*skb_hook)(skb); |
3068 |
+@@ -731,7 +755,7 @@ static int kauditd_send_queue(struct sock *sk, u32 portid, |
3069 |
+ /* can we send to anyone via unicast? */ |
3070 |
+ if (!sk) { |
3071 |
+ if (err_hook) |
3072 |
+- (*err_hook)(skb); |
3073 |
++ (*err_hook)(skb, -ECONNREFUSED); |
3074 |
+ continue; |
3075 |
+ } |
3076 |
+ |
3077 |
+@@ -745,7 +769,7 @@ retry: |
3078 |
+ rc == -ECONNREFUSED || rc == -EPERM) { |
3079 |
+ sk = NULL; |
3080 |
+ if (err_hook) |
3081 |
+- (*err_hook)(skb); |
3082 |
++ (*err_hook)(skb, rc); |
3083 |
+ if (rc == -EAGAIN) |
3084 |
+ rc = 0; |
3085 |
+ /* continue to drain the queue */ |
3086 |
+diff --git a/kernel/bpf/ringbuf.c b/kernel/bpf/ringbuf.c |
3087 |
+index 9e0c10c6892ad..f1c51c45667d3 100644 |
3088 |
+--- a/kernel/bpf/ringbuf.c |
3089 |
++++ b/kernel/bpf/ringbuf.c |
3090 |
+@@ -104,7 +104,7 @@ static struct bpf_ringbuf *bpf_ringbuf_area_alloc(size_t data_sz, int numa_node) |
3091 |
+ } |
3092 |
+ |
3093 |
+ rb = vmap(pages, nr_meta_pages + 2 * nr_data_pages, |
3094 |
+- VM_ALLOC | VM_USERMAP, PAGE_KERNEL); |
3095 |
++ VM_MAP | VM_USERMAP, PAGE_KERNEL); |
3096 |
+ if (rb) { |
3097 |
+ kmemleak_not_leak(pages); |
3098 |
+ rb->pages = pages; |
3099 |
+diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c |
3100 |
+index 1d9d3e4d4cbc0..67eae4a4b724a 100644 |
3101 |
+--- a/kernel/cgroup/cpuset.c |
3102 |
++++ b/kernel/cgroup/cpuset.c |
3103 |
+@@ -1512,10 +1512,15 @@ static void update_sibling_cpumasks(struct cpuset *parent, struct cpuset *cs, |
3104 |
+ struct cpuset *sibling; |
3105 |
+ struct cgroup_subsys_state *pos_css; |
3106 |
+ |
3107 |
++ percpu_rwsem_assert_held(&cpuset_rwsem); |
3108 |
++ |
3109 |
+ /* |
3110 |
+ * Check all its siblings and call update_cpumasks_hier() |
3111 |
+ * if their use_parent_ecpus flag is set in order for them |
3112 |
+ * to use the right effective_cpus value. |
3113 |
++ * |
3114 |
++ * The update_cpumasks_hier() function may sleep. So we have to |
3115 |
++ * release the RCU read lock before calling it. |
3116 |
+ */ |
3117 |
+ rcu_read_lock(); |
3118 |
+ cpuset_for_each_child(sibling, pos_css, parent) { |
3119 |
+@@ -1523,8 +1528,13 @@ static void update_sibling_cpumasks(struct cpuset *parent, struct cpuset *cs, |
3120 |
+ continue; |
3121 |
+ if (!sibling->use_parent_ecpus) |
3122 |
+ continue; |
3123 |
++ if (!css_tryget_online(&sibling->css)) |
3124 |
++ continue; |
3125 |
+ |
3126 |
++ rcu_read_unlock(); |
3127 |
+ update_cpumasks_hier(sibling, tmp); |
3128 |
++ rcu_read_lock(); |
3129 |
++ css_put(&sibling->css); |
3130 |
+ } |
3131 |
+ rcu_read_unlock(); |
3132 |
+ } |
3133 |
+diff --git a/kernel/events/core.c b/kernel/events/core.c |
3134 |
+index c7581e3fb8ab1..69c70767b5dff 100644 |
3135 |
+--- a/kernel/events/core.c |
3136 |
++++ b/kernel/events/core.c |
3137 |
+@@ -3234,6 +3234,15 @@ static int perf_event_modify_breakpoint(struct perf_event *bp, |
3138 |
+ return err; |
3139 |
+ } |
3140 |
+ |
3141 |
++/* |
3142 |
++ * Copy event-type-independent attributes that may be modified. |
3143 |
++ */ |
3144 |
++static void perf_event_modify_copy_attr(struct perf_event_attr *to, |
3145 |
++ const struct perf_event_attr *from) |
3146 |
++{ |
3147 |
++ to->sig_data = from->sig_data; |
3148 |
++} |
3149 |
++ |
3150 |
+ static int perf_event_modify_attr(struct perf_event *event, |
3151 |
+ struct perf_event_attr *attr) |
3152 |
+ { |
3153 |
+@@ -3256,10 +3265,17 @@ static int perf_event_modify_attr(struct perf_event *event, |
3154 |
+ WARN_ON_ONCE(event->ctx->parent_ctx); |
3155 |
+ |
3156 |
+ mutex_lock(&event->child_mutex); |
3157 |
++ /* |
3158 |
++ * Event-type-independent attributes must be copied before event-type |
3159 |
++ * modification, which will validate that final attributes match the |
3160 |
++ * source attributes after all relevant attributes have been copied. |
3161 |
++ */ |
3162 |
++ perf_event_modify_copy_attr(&event->attr, attr); |
3163 |
+ err = func(event, attr); |
3164 |
+ if (err) |
3165 |
+ goto out; |
3166 |
+ list_for_each_entry(child, &event->child_list, child_list) { |
3167 |
++ perf_event_modify_copy_attr(&child->attr, attr); |
3168 |
+ err = func(child, attr); |
3169 |
+ if (err) |
3170 |
+ goto out; |
3171 |
+diff --git a/mm/debug_vm_pgtable.c b/mm/debug_vm_pgtable.c |
3172 |
+index 1403639302e48..718d0d3ad8c4e 100644 |
3173 |
+--- a/mm/debug_vm_pgtable.c |
3174 |
++++ b/mm/debug_vm_pgtable.c |
3175 |
+@@ -171,6 +171,8 @@ static void __init pte_advanced_tests(struct pgtable_debug_args *args) |
3176 |
+ ptep_test_and_clear_young(args->vma, args->vaddr, args->ptep); |
3177 |
+ pte = ptep_get(args->ptep); |
3178 |
+ WARN_ON(pte_young(pte)); |
3179 |
++ |
3180 |
++ ptep_get_and_clear_full(args->mm, args->vaddr, args->ptep, 1); |
3181 |
+ } |
3182 |
+ |
3183 |
+ static void __init pte_savedwrite_tests(struct pgtable_debug_args *args) |
3184 |
+diff --git a/mm/kmemleak.c b/mm/kmemleak.c |
3185 |
+index b57383c17cf60..adbe5aa011848 100644 |
3186 |
+--- a/mm/kmemleak.c |
3187 |
++++ b/mm/kmemleak.c |
3188 |
+@@ -1403,7 +1403,8 @@ static void kmemleak_scan(void) |
3189 |
+ { |
3190 |
+ unsigned long flags; |
3191 |
+ struct kmemleak_object *object; |
3192 |
+- int i; |
3193 |
++ struct zone *zone; |
3194 |
++ int __maybe_unused i; |
3195 |
+ int new_leaks = 0; |
3196 |
+ |
3197 |
+ jiffies_last_scan = jiffies; |
3198 |
+@@ -1443,9 +1444,9 @@ static void kmemleak_scan(void) |
3199 |
+ * Struct page scanning for each node. |
3200 |
+ */ |
3201 |
+ get_online_mems(); |
3202 |
+- for_each_online_node(i) { |
3203 |
+- unsigned long start_pfn = node_start_pfn(i); |
3204 |
+- unsigned long end_pfn = node_end_pfn(i); |
3205 |
++ for_each_populated_zone(zone) { |
3206 |
++ unsigned long start_pfn = zone->zone_start_pfn; |
3207 |
++ unsigned long end_pfn = zone_end_pfn(zone); |
3208 |
+ unsigned long pfn; |
3209 |
+ |
3210 |
+ for (pfn = start_pfn; pfn < end_pfn; pfn++) { |
3211 |
+@@ -1454,8 +1455,8 @@ static void kmemleak_scan(void) |
3212 |
+ if (!page) |
3213 |
+ continue; |
3214 |
+ |
3215 |
+- /* only scan pages belonging to this node */ |
3216 |
+- if (page_to_nid(page) != i) |
3217 |
++ /* only scan pages belonging to this zone */ |
3218 |
++ if (page_zone(page) != zone) |
3219 |
+ continue; |
3220 |
+ /* only scan if page is in use */ |
3221 |
+ if (page_count(page) == 0) |
3222 |
+diff --git a/net/bridge/netfilter/nft_reject_bridge.c b/net/bridge/netfilter/nft_reject_bridge.c |
3223 |
+index eba0efe64d05a..fbf858ddec352 100644 |
3224 |
+--- a/net/bridge/netfilter/nft_reject_bridge.c |
3225 |
++++ b/net/bridge/netfilter/nft_reject_bridge.c |
3226 |
+@@ -49,7 +49,7 @@ static void nft_reject_br_send_v4_tcp_reset(struct net *net, |
3227 |
+ { |
3228 |
+ struct sk_buff *nskb; |
3229 |
+ |
3230 |
+- nskb = nf_reject_skb_v4_tcp_reset(net, oldskb, dev, hook); |
3231 |
++ nskb = nf_reject_skb_v4_tcp_reset(net, oldskb, NULL, hook); |
3232 |
+ if (!nskb) |
3233 |
+ return; |
3234 |
+ |
3235 |
+@@ -65,7 +65,7 @@ static void nft_reject_br_send_v4_unreach(struct net *net, |
3236 |
+ { |
3237 |
+ struct sk_buff *nskb; |
3238 |
+ |
3239 |
+- nskb = nf_reject_skb_v4_unreach(net, oldskb, dev, hook, code); |
3240 |
++ nskb = nf_reject_skb_v4_unreach(net, oldskb, NULL, hook, code); |
3241 |
+ if (!nskb) |
3242 |
+ return; |
3243 |
+ |
3244 |
+@@ -81,7 +81,7 @@ static void nft_reject_br_send_v6_tcp_reset(struct net *net, |
3245 |
+ { |
3246 |
+ struct sk_buff *nskb; |
3247 |
+ |
3248 |
+- nskb = nf_reject_skb_v6_tcp_reset(net, oldskb, dev, hook); |
3249 |
++ nskb = nf_reject_skb_v6_tcp_reset(net, oldskb, NULL, hook); |
3250 |
+ if (!nskb) |
3251 |
+ return; |
3252 |
+ |
3253 |
+@@ -98,7 +98,7 @@ static void nft_reject_br_send_v6_unreach(struct net *net, |
3254 |
+ { |
3255 |
+ struct sk_buff *nskb; |
3256 |
+ |
3257 |
+- nskb = nf_reject_skb_v6_unreach(net, oldskb, dev, hook, code); |
3258 |
++ nskb = nf_reject_skb_v6_unreach(net, oldskb, NULL, hook, code); |
3259 |
+ if (!nskb) |
3260 |
+ return; |
3261 |
+ |
3262 |
+diff --git a/net/ieee802154/nl802154.c b/net/ieee802154/nl802154.c |
3263 |
+index 277124f206e06..e0b072aecf0f3 100644 |
3264 |
+--- a/net/ieee802154/nl802154.c |
3265 |
++++ b/net/ieee802154/nl802154.c |
3266 |
+@@ -1441,7 +1441,7 @@ static int nl802154_send_key(struct sk_buff *msg, u32 cmd, u32 portid, |
3267 |
+ |
3268 |
+ hdr = nl802154hdr_put(msg, portid, seq, flags, cmd); |
3269 |
+ if (!hdr) |
3270 |
+- return -1; |
3271 |
++ return -ENOBUFS; |
3272 |
+ |
3273 |
+ if (nla_put_u32(msg, NL802154_ATTR_IFINDEX, dev->ifindex)) |
3274 |
+ goto nla_put_failure; |
3275 |
+@@ -1634,7 +1634,7 @@ static int nl802154_send_device(struct sk_buff *msg, u32 cmd, u32 portid, |
3276 |
+ |
3277 |
+ hdr = nl802154hdr_put(msg, portid, seq, flags, cmd); |
3278 |
+ if (!hdr) |
3279 |
+- return -1; |
3280 |
++ return -ENOBUFS; |
3281 |
+ |
3282 |
+ if (nla_put_u32(msg, NL802154_ATTR_IFINDEX, dev->ifindex)) |
3283 |
+ goto nla_put_failure; |
3284 |
+@@ -1812,7 +1812,7 @@ static int nl802154_send_devkey(struct sk_buff *msg, u32 cmd, u32 portid, |
3285 |
+ |
3286 |
+ hdr = nl802154hdr_put(msg, portid, seq, flags, cmd); |
3287 |
+ if (!hdr) |
3288 |
+- return -1; |
3289 |
++ return -ENOBUFS; |
3290 |
+ |
3291 |
+ if (nla_put_u32(msg, NL802154_ATTR_IFINDEX, dev->ifindex)) |
3292 |
+ goto nla_put_failure; |
3293 |
+@@ -1988,7 +1988,7 @@ static int nl802154_send_seclevel(struct sk_buff *msg, u32 cmd, u32 portid, |
3294 |
+ |
3295 |
+ hdr = nl802154hdr_put(msg, portid, seq, flags, cmd); |
3296 |
+ if (!hdr) |
3297 |
+- return -1; |
3298 |
++ return -ENOBUFS; |
3299 |
+ |
3300 |
+ if (nla_put_u32(msg, NL802154_ATTR_IFINDEX, dev->ifindex)) |
3301 |
+ goto nla_put_failure; |
3302 |
+diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c |
3303 |
+index d96860053816a..2137b7460deaa 100644 |
3304 |
+--- a/net/mptcp/pm_netlink.c |
3305 |
++++ b/net/mptcp/pm_netlink.c |
3306 |
+@@ -459,6 +459,18 @@ static unsigned int fill_remote_addresses_vec(struct mptcp_sock *msk, bool fullm |
3307 |
+ return i; |
3308 |
+ } |
3309 |
+ |
3310 |
++static struct mptcp_pm_addr_entry * |
3311 |
++__lookup_addr(struct pm_nl_pernet *pernet, struct mptcp_addr_info *info) |
3312 |
++{ |
3313 |
++ struct mptcp_pm_addr_entry *entry; |
3314 |
++ |
3315 |
++ list_for_each_entry(entry, &pernet->local_addr_list, list) { |
3316 |
++ if (addresses_equal(&entry->addr, info, true)) |
3317 |
++ return entry; |
3318 |
++ } |
3319 |
++ return NULL; |
3320 |
++} |
3321 |
++ |
3322 |
+ static void mptcp_pm_create_subflow_or_signal_addr(struct mptcp_sock *msk) |
3323 |
+ { |
3324 |
+ struct sock *sk = (struct sock *)msk; |
3325 |
+@@ -1725,17 +1737,21 @@ static int mptcp_nl_cmd_set_flags(struct sk_buff *skb, struct genl_info *info) |
3326 |
+ if (addr.flags & MPTCP_PM_ADDR_FLAG_BACKUP) |
3327 |
+ bkup = 1; |
3328 |
+ |
3329 |
+- list_for_each_entry(entry, &pernet->local_addr_list, list) { |
3330 |
+- if (addresses_equal(&entry->addr, &addr.addr, true)) { |
3331 |
+- mptcp_nl_addr_backup(net, &entry->addr, bkup); |
3332 |
+- |
3333 |
+- if (bkup) |
3334 |
+- entry->flags |= MPTCP_PM_ADDR_FLAG_BACKUP; |
3335 |
+- else |
3336 |
+- entry->flags &= ~MPTCP_PM_ADDR_FLAG_BACKUP; |
3337 |
+- } |
3338 |
++ spin_lock_bh(&pernet->lock); |
3339 |
++ entry = __lookup_addr(pernet, &addr.addr); |
3340 |
++ if (!entry) { |
3341 |
++ spin_unlock_bh(&pernet->lock); |
3342 |
++ return -EINVAL; |
3343 |
+ } |
3344 |
+ |
3345 |
++ if (bkup) |
3346 |
++ entry->flags |= MPTCP_PM_ADDR_FLAG_BACKUP; |
3347 |
++ else |
3348 |
++ entry->flags &= ~MPTCP_PM_ADDR_FLAG_BACKUP; |
3349 |
++ addr = *entry; |
3350 |
++ spin_unlock_bh(&pernet->lock); |
3351 |
++ |
3352 |
++ mptcp_nl_addr_backup(net, &addr.addr, bkup); |
3353 |
+ return 0; |
3354 |
+ } |
3355 |
+ |
3356 |
+diff --git a/net/smc/af_smc.c b/net/smc/af_smc.c |
3357 |
+index 34608369b426f..96dee4a62385f 100644 |
3358 |
+--- a/net/smc/af_smc.c |
3359 |
++++ b/net/smc/af_smc.c |
3360 |
+@@ -548,17 +548,115 @@ static void smc_stat_fallback(struct smc_sock *smc) |
3361 |
+ mutex_unlock(&net->smc.mutex_fback_rsn); |
3362 |
+ } |
3363 |
+ |
3364 |
++/* must be called under rcu read lock */ |
3365 |
++static void smc_fback_wakeup_waitqueue(struct smc_sock *smc, void *key) |
3366 |
++{ |
3367 |
++ struct socket_wq *wq; |
3368 |
++ __poll_t flags; |
3369 |
++ |
3370 |
++ wq = rcu_dereference(smc->sk.sk_wq); |
3371 |
++ if (!skwq_has_sleeper(wq)) |
3372 |
++ return; |
3373 |
++ |
3374 |
++ /* wake up smc sk->sk_wq */ |
3375 |
++ if (!key) { |
3376 |
++ /* sk_state_change */ |
3377 |
++ wake_up_interruptible_all(&wq->wait); |
3378 |
++ } else { |
3379 |
++ flags = key_to_poll(key); |
3380 |
++ if (flags & (EPOLLIN | EPOLLOUT)) |
3381 |
++ /* sk_data_ready or sk_write_space */ |
3382 |
++ wake_up_interruptible_sync_poll(&wq->wait, flags); |
3383 |
++ else if (flags & EPOLLERR) |
3384 |
++ /* sk_error_report */ |
3385 |
++ wake_up_interruptible_poll(&wq->wait, flags); |
3386 |
++ } |
3387 |
++} |
3388 |
++ |
3389 |
++static int smc_fback_mark_woken(wait_queue_entry_t *wait, |
3390 |
++ unsigned int mode, int sync, void *key) |
3391 |
++{ |
3392 |
++ struct smc_mark_woken *mark = |
3393 |
++ container_of(wait, struct smc_mark_woken, wait_entry); |
3394 |
++ |
3395 |
++ mark->woken = true; |
3396 |
++ mark->key = key; |
3397 |
++ return 0; |
3398 |
++} |
3399 |
++ |
3400 |
++static void smc_fback_forward_wakeup(struct smc_sock *smc, struct sock *clcsk, |
3401 |
++ void (*clcsock_callback)(struct sock *sk)) |
3402 |
++{ |
3403 |
++ struct smc_mark_woken mark = { .woken = false }; |
3404 |
++ struct socket_wq *wq; |
3405 |
++ |
3406 |
++ init_waitqueue_func_entry(&mark.wait_entry, |
3407 |
++ smc_fback_mark_woken); |
3408 |
++ rcu_read_lock(); |
3409 |
++ wq = rcu_dereference(clcsk->sk_wq); |
3410 |
++ if (!wq) |
3411 |
++ goto out; |
3412 |
++ add_wait_queue(sk_sleep(clcsk), &mark.wait_entry); |
3413 |
++ clcsock_callback(clcsk); |
3414 |
++ remove_wait_queue(sk_sleep(clcsk), &mark.wait_entry); |
3415 |
++ |
3416 |
++ if (mark.woken) |
3417 |
++ smc_fback_wakeup_waitqueue(smc, mark.key); |
3418 |
++out: |
3419 |
++ rcu_read_unlock(); |
3420 |
++} |
3421 |
++ |
3422 |
++static void smc_fback_state_change(struct sock *clcsk) |
3423 |
++{ |
3424 |
++ struct smc_sock *smc = |
3425 |
++ smc_clcsock_user_data(clcsk); |
3426 |
++ |
3427 |
++ if (!smc) |
3428 |
++ return; |
3429 |
++ smc_fback_forward_wakeup(smc, clcsk, smc->clcsk_state_change); |
3430 |
++} |
3431 |
++ |
3432 |
++static void smc_fback_data_ready(struct sock *clcsk) |
3433 |
++{ |
3434 |
++ struct smc_sock *smc = |
3435 |
++ smc_clcsock_user_data(clcsk); |
3436 |
++ |
3437 |
++ if (!smc) |
3438 |
++ return; |
3439 |
++ smc_fback_forward_wakeup(smc, clcsk, smc->clcsk_data_ready); |
3440 |
++} |
3441 |
++ |
3442 |
++static void smc_fback_write_space(struct sock *clcsk) |
3443 |
++{ |
3444 |
++ struct smc_sock *smc = |
3445 |
++ smc_clcsock_user_data(clcsk); |
3446 |
++ |
3447 |
++ if (!smc) |
3448 |
++ return; |
3449 |
++ smc_fback_forward_wakeup(smc, clcsk, smc->clcsk_write_space); |
3450 |
++} |
3451 |
++ |
3452 |
++static void smc_fback_error_report(struct sock *clcsk) |
3453 |
++{ |
3454 |
++ struct smc_sock *smc = |
3455 |
++ smc_clcsock_user_data(clcsk); |
3456 |
++ |
3457 |
++ if (!smc) |
3458 |
++ return; |
3459 |
++ smc_fback_forward_wakeup(smc, clcsk, smc->clcsk_error_report); |
3460 |
++} |
3461 |
++ |
3462 |
+ static int smc_switch_to_fallback(struct smc_sock *smc, int reason_code) |
3463 |
+ { |
3464 |
+- wait_queue_head_t *smc_wait = sk_sleep(&smc->sk); |
3465 |
+- wait_queue_head_t *clc_wait; |
3466 |
+- unsigned long flags; |
3467 |
++ struct sock *clcsk; |
3468 |
+ |
3469 |
+ mutex_lock(&smc->clcsock_release_lock); |
3470 |
+ if (!smc->clcsock) { |
3471 |
+ mutex_unlock(&smc->clcsock_release_lock); |
3472 |
+ return -EBADF; |
3473 |
+ } |
3474 |
++ clcsk = smc->clcsock->sk; |
3475 |
++ |
3476 |
+ smc->use_fallback = true; |
3477 |
+ smc->fallback_rsn = reason_code; |
3478 |
+ smc_stat_fallback(smc); |
3479 |
+@@ -568,16 +666,22 @@ static int smc_switch_to_fallback(struct smc_sock *smc, int reason_code) |
3480 |
+ smc->clcsock->wq.fasync_list = |
3481 |
+ smc->sk.sk_socket->wq.fasync_list; |
3482 |
+ |
3483 |
+- /* There may be some entries remaining in |
3484 |
+- * smc socket->wq, which should be removed |
3485 |
+- * to clcsocket->wq during the fallback. |
3486 |
++ /* There might be some wait entries remaining |
3487 |
++ * in smc sk->sk_wq and they should be woken up |
3488 |
++ * as clcsock's wait queue is woken up. |
3489 |
+ */ |
3490 |
+- clc_wait = sk_sleep(smc->clcsock->sk); |
3491 |
+- spin_lock_irqsave(&smc_wait->lock, flags); |
3492 |
+- spin_lock_nested(&clc_wait->lock, SINGLE_DEPTH_NESTING); |
3493 |
+- list_splice_init(&smc_wait->head, &clc_wait->head); |
3494 |
+- spin_unlock(&clc_wait->lock); |
3495 |
+- spin_unlock_irqrestore(&smc_wait->lock, flags); |
3496 |
++ smc->clcsk_state_change = clcsk->sk_state_change; |
3497 |
++ smc->clcsk_data_ready = clcsk->sk_data_ready; |
3498 |
++ smc->clcsk_write_space = clcsk->sk_write_space; |
3499 |
++ smc->clcsk_error_report = clcsk->sk_error_report; |
3500 |
++ |
3501 |
++ clcsk->sk_state_change = smc_fback_state_change; |
3502 |
++ clcsk->sk_data_ready = smc_fback_data_ready; |
3503 |
++ clcsk->sk_write_space = smc_fback_write_space; |
3504 |
++ clcsk->sk_error_report = smc_fback_error_report; |
3505 |
++ |
3506 |
++ smc->clcsock->sk->sk_user_data = |
3507 |
++ (void *)((uintptr_t)smc | SK_USER_DATA_NOCOPY); |
3508 |
+ } |
3509 |
+ mutex_unlock(&smc->clcsock_release_lock); |
3510 |
+ return 0; |
3511 |
+@@ -1909,10 +2013,9 @@ out: |
3512 |
+ |
3513 |
+ static void smc_clcsock_data_ready(struct sock *listen_clcsock) |
3514 |
+ { |
3515 |
+- struct smc_sock *lsmc; |
3516 |
++ struct smc_sock *lsmc = |
3517 |
++ smc_clcsock_user_data(listen_clcsock); |
3518 |
+ |
3519 |
+- lsmc = (struct smc_sock *) |
3520 |
+- ((uintptr_t)listen_clcsock->sk_user_data & ~SK_USER_DATA_NOCOPY); |
3521 |
+ if (!lsmc) |
3522 |
+ return; |
3523 |
+ lsmc->clcsk_data_ready(listen_clcsock); |
3524 |
+diff --git a/net/smc/smc.h b/net/smc/smc.h |
3525 |
+index e6919fe31617b..930544f7b2e2c 100644 |
3526 |
+--- a/net/smc/smc.h |
3527 |
++++ b/net/smc/smc.h |
3528 |
+@@ -129,6 +129,12 @@ enum smc_urg_state { |
3529 |
+ SMC_URG_READ = 3, /* data was already read */ |
3530 |
+ }; |
3531 |
+ |
3532 |
++struct smc_mark_woken { |
3533 |
++ bool woken; |
3534 |
++ void *key; |
3535 |
++ wait_queue_entry_t wait_entry; |
3536 |
++}; |
3537 |
++ |
3538 |
+ struct smc_connection { |
3539 |
+ struct rb_node alert_node; |
3540 |
+ struct smc_link_group *lgr; /* link group of connection */ |
3541 |
+@@ -217,8 +223,14 @@ struct smc_connection { |
3542 |
+ struct smc_sock { /* smc sock container */ |
3543 |
+ struct sock sk; |
3544 |
+ struct socket *clcsock; /* internal tcp socket */ |
3545 |
++ void (*clcsk_state_change)(struct sock *sk); |
3546 |
++ /* original stat_change fct. */ |
3547 |
+ void (*clcsk_data_ready)(struct sock *sk); |
3548 |
+- /* original data_ready fct. **/ |
3549 |
++ /* original data_ready fct. */ |
3550 |
++ void (*clcsk_write_space)(struct sock *sk); |
3551 |
++ /* original write_space fct. */ |
3552 |
++ void (*clcsk_error_report)(struct sock *sk); |
3553 |
++ /* original error_report fct. */ |
3554 |
+ struct smc_connection conn; /* smc connection */ |
3555 |
+ struct smc_sock *listen_smc; /* listen parent */ |
3556 |
+ struct work_struct connect_work; /* handle non-blocking connect*/ |
3557 |
+@@ -253,6 +265,12 @@ static inline struct smc_sock *smc_sk(const struct sock *sk) |
3558 |
+ return (struct smc_sock *)sk; |
3559 |
+ } |
3560 |
+ |
3561 |
++static inline struct smc_sock *smc_clcsock_user_data(struct sock *clcsk) |
3562 |
++{ |
3563 |
++ return (struct smc_sock *) |
3564 |
++ ((uintptr_t)clcsk->sk_user_data & ~SK_USER_DATA_NOCOPY); |
3565 |
++} |
3566 |
++ |
3567 |
+ extern struct workqueue_struct *smc_hs_wq; /* wq for handshake work */ |
3568 |
+ extern struct workqueue_struct *smc_close_wq; /* wq for close work */ |
3569 |
+ |
3570 |
+diff --git a/security/selinux/ss/conditional.c b/security/selinux/ss/conditional.c |
3571 |
+index 2ec6e5cd25d9b..feb206f3acb4a 100644 |
3572 |
+--- a/security/selinux/ss/conditional.c |
3573 |
++++ b/security/selinux/ss/conditional.c |
3574 |
+@@ -152,6 +152,8 @@ static void cond_list_destroy(struct policydb *p) |
3575 |
+ for (i = 0; i < p->cond_list_len; i++) |
3576 |
+ cond_node_destroy(&p->cond_list[i]); |
3577 |
+ kfree(p->cond_list); |
3578 |
++ p->cond_list = NULL; |
3579 |
++ p->cond_list_len = 0; |
3580 |
+ } |
3581 |
+ |
3582 |
+ void cond_policydb_destroy(struct policydb *p) |
3583 |
+@@ -441,7 +443,6 @@ int cond_read_list(struct policydb *p, void *fp) |
3584 |
+ return 0; |
3585 |
+ err: |
3586 |
+ cond_list_destroy(p); |
3587 |
+- p->cond_list = NULL; |
3588 |
+ return rc; |
3589 |
+ } |
3590 |
+ |
3591 |
+diff --git a/sound/pci/hda/hda_auto_parser.c b/sound/pci/hda/hda_auto_parser.c |
3592 |
+index 4a854475a0e60..500d0d474d27b 100644 |
3593 |
+--- a/sound/pci/hda/hda_auto_parser.c |
3594 |
++++ b/sound/pci/hda/hda_auto_parser.c |
3595 |
+@@ -985,7 +985,7 @@ void snd_hda_pick_fixup(struct hda_codec *codec, |
3596 |
+ int id = HDA_FIXUP_ID_NOT_SET; |
3597 |
+ const char *name = NULL; |
3598 |
+ const char *type = NULL; |
3599 |
+- int vendor, device; |
3600 |
++ unsigned int vendor, device; |
3601 |
+ |
3602 |
+ if (codec->fixup_id != HDA_FIXUP_ID_NOT_SET) |
3603 |
+ return; |
3604 |
+diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c |
3605 |
+index 7016b48227bf2..f552785d301e0 100644 |
3606 |
+--- a/sound/pci/hda/hda_codec.c |
3607 |
++++ b/sound/pci/hda/hda_codec.c |
3608 |
+@@ -3000,6 +3000,10 @@ void snd_hda_codec_shutdown(struct hda_codec *codec) |
3609 |
+ { |
3610 |
+ struct hda_pcm *cpcm; |
3611 |
+ |
3612 |
++ /* Skip the shutdown if codec is not registered */ |
3613 |
++ if (!codec->registered) |
3614 |
++ return; |
3615 |
++ |
3616 |
+ list_for_each_entry(cpcm, &codec->pcm_list_head, list) |
3617 |
+ snd_pcm_suspend_all(cpcm->pcm); |
3618 |
+ |
3619 |
+diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c |
3620 |
+index 3bf5e34107038..fc114e5224806 100644 |
3621 |
+--- a/sound/pci/hda/hda_generic.c |
3622 |
++++ b/sound/pci/hda/hda_generic.c |
3623 |
+@@ -91,6 +91,12 @@ static void snd_hda_gen_spec_free(struct hda_gen_spec *spec) |
3624 |
+ free_kctls(spec); |
3625 |
+ snd_array_free(&spec->paths); |
3626 |
+ snd_array_free(&spec->loopback_list); |
3627 |
++#ifdef CONFIG_SND_HDA_GENERIC_LEDS |
3628 |
++ if (spec->led_cdevs[LED_AUDIO_MUTE]) |
3629 |
++ led_classdev_unregister(spec->led_cdevs[LED_AUDIO_MUTE]); |
3630 |
++ if (spec->led_cdevs[LED_AUDIO_MICMUTE]) |
3631 |
++ led_classdev_unregister(spec->led_cdevs[LED_AUDIO_MICMUTE]); |
3632 |
++#endif |
3633 |
+ } |
3634 |
+ |
3635 |
+ /* |
3636 |
+@@ -3922,7 +3928,10 @@ static int create_mute_led_cdev(struct hda_codec *codec, |
3637 |
+ enum led_brightness), |
3638 |
+ bool micmute) |
3639 |
+ { |
3640 |
++ struct hda_gen_spec *spec = codec->spec; |
3641 |
+ struct led_classdev *cdev; |
3642 |
++ int idx = micmute ? LED_AUDIO_MICMUTE : LED_AUDIO_MUTE; |
3643 |
++ int err; |
3644 |
+ |
3645 |
+ cdev = devm_kzalloc(&codec->core.dev, sizeof(*cdev), GFP_KERNEL); |
3646 |
+ if (!cdev) |
3647 |
+@@ -3932,10 +3941,14 @@ static int create_mute_led_cdev(struct hda_codec *codec, |
3648 |
+ cdev->max_brightness = 1; |
3649 |
+ cdev->default_trigger = micmute ? "audio-micmute" : "audio-mute"; |
3650 |
+ cdev->brightness_set_blocking = callback; |
3651 |
+- cdev->brightness = ledtrig_audio_get(micmute ? LED_AUDIO_MICMUTE : LED_AUDIO_MUTE); |
3652 |
++ cdev->brightness = ledtrig_audio_get(idx); |
3653 |
+ cdev->flags = LED_CORE_SUSPENDRESUME; |
3654 |
+ |
3655 |
+- return devm_led_classdev_register(&codec->core.dev, cdev); |
3656 |
++ err = led_classdev_register(&codec->core.dev, cdev); |
3657 |
++ if (err < 0) |
3658 |
++ return err; |
3659 |
++ spec->led_cdevs[idx] = cdev; |
3660 |
++ return 0; |
3661 |
+ } |
3662 |
+ |
3663 |
+ /** |
3664 |
+diff --git a/sound/pci/hda/hda_generic.h b/sound/pci/hda/hda_generic.h |
3665 |
+index c43bd0f0338ea..362ddcaea15b3 100644 |
3666 |
+--- a/sound/pci/hda/hda_generic.h |
3667 |
++++ b/sound/pci/hda/hda_generic.h |
3668 |
+@@ -294,6 +294,9 @@ struct hda_gen_spec { |
3669 |
+ struct hda_jack_callback *cb); |
3670 |
+ void (*mic_autoswitch_hook)(struct hda_codec *codec, |
3671 |
+ struct hda_jack_callback *cb); |
3672 |
++ |
3673 |
++ /* leds */ |
3674 |
++ struct led_classdev *led_cdevs[NUM_AUDIO_LEDS]; |
3675 |
+ }; |
3676 |
+ |
3677 |
+ /* values for add_stereo_mix_input flag */ |
3678 |
+diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c |
3679 |
+index fa80a79e9f966..18f04137f61cf 100644 |
3680 |
+--- a/sound/pci/hda/patch_realtek.c |
3681 |
++++ b/sound/pci/hda/patch_realtek.c |
3682 |
+@@ -97,6 +97,7 @@ struct alc_spec { |
3683 |
+ unsigned int gpio_mic_led_mask; |
3684 |
+ struct alc_coef_led mute_led_coef; |
3685 |
+ struct alc_coef_led mic_led_coef; |
3686 |
++ struct mutex coef_mutex; |
3687 |
+ |
3688 |
+ hda_nid_t headset_mic_pin; |
3689 |
+ hda_nid_t headphone_mic_pin; |
3690 |
+@@ -132,8 +133,8 @@ struct alc_spec { |
3691 |
+ * COEF access helper functions |
3692 |
+ */ |
3693 |
+ |
3694 |
+-static int alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid, |
3695 |
+- unsigned int coef_idx) |
3696 |
++static int __alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid, |
3697 |
++ unsigned int coef_idx) |
3698 |
+ { |
3699 |
+ unsigned int val; |
3700 |
+ |
3701 |
+@@ -142,28 +143,61 @@ static int alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid, |
3702 |
+ return val; |
3703 |
+ } |
3704 |
+ |
3705 |
++static int alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid, |
3706 |
++ unsigned int coef_idx) |
3707 |
++{ |
3708 |
++ struct alc_spec *spec = codec->spec; |
3709 |
++ unsigned int val; |
3710 |
++ |
3711 |
++ mutex_lock(&spec->coef_mutex); |
3712 |
++ val = __alc_read_coefex_idx(codec, nid, coef_idx); |
3713 |
++ mutex_unlock(&spec->coef_mutex); |
3714 |
++ return val; |
3715 |
++} |
3716 |
++ |
3717 |
+ #define alc_read_coef_idx(codec, coef_idx) \ |
3718 |
+ alc_read_coefex_idx(codec, 0x20, coef_idx) |
3719 |
+ |
3720 |
+-static void alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid, |
3721 |
+- unsigned int coef_idx, unsigned int coef_val) |
3722 |
++static void __alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid, |
3723 |
++ unsigned int coef_idx, unsigned int coef_val) |
3724 |
+ { |
3725 |
+ snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx); |
3726 |
+ snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PROC_COEF, coef_val); |
3727 |
+ } |
3728 |
+ |
3729 |
++static void alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid, |
3730 |
++ unsigned int coef_idx, unsigned int coef_val) |
3731 |
++{ |
3732 |
++ struct alc_spec *spec = codec->spec; |
3733 |
++ |
3734 |
++ mutex_lock(&spec->coef_mutex); |
3735 |
++ __alc_write_coefex_idx(codec, nid, coef_idx, coef_val); |
3736 |
++ mutex_unlock(&spec->coef_mutex); |
3737 |
++} |
3738 |
++ |
3739 |
+ #define alc_write_coef_idx(codec, coef_idx, coef_val) \ |
3740 |
+ alc_write_coefex_idx(codec, 0x20, coef_idx, coef_val) |
3741 |
+ |
3742 |
++static void __alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid, |
3743 |
++ unsigned int coef_idx, unsigned int mask, |
3744 |
++ unsigned int bits_set) |
3745 |
++{ |
3746 |
++ unsigned int val = __alc_read_coefex_idx(codec, nid, coef_idx); |
3747 |
++ |
3748 |
++ if (val != -1) |
3749 |
++ __alc_write_coefex_idx(codec, nid, coef_idx, |
3750 |
++ (val & ~mask) | bits_set); |
3751 |
++} |
3752 |
++ |
3753 |
+ static void alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid, |
3754 |
+ unsigned int coef_idx, unsigned int mask, |
3755 |
+ unsigned int bits_set) |
3756 |
+ { |
3757 |
+- unsigned int val = alc_read_coefex_idx(codec, nid, coef_idx); |
3758 |
++ struct alc_spec *spec = codec->spec; |
3759 |
+ |
3760 |
+- if (val != -1) |
3761 |
+- alc_write_coefex_idx(codec, nid, coef_idx, |
3762 |
+- (val & ~mask) | bits_set); |
3763 |
++ mutex_lock(&spec->coef_mutex); |
3764 |
++ __alc_update_coefex_idx(codec, nid, coef_idx, mask, bits_set); |
3765 |
++ mutex_unlock(&spec->coef_mutex); |
3766 |
+ } |
3767 |
+ |
3768 |
+ #define alc_update_coef_idx(codec, coef_idx, mask, bits_set) \ |
3769 |
+@@ -196,13 +230,17 @@ struct coef_fw { |
3770 |
+ static void alc_process_coef_fw(struct hda_codec *codec, |
3771 |
+ const struct coef_fw *fw) |
3772 |
+ { |
3773 |
++ struct alc_spec *spec = codec->spec; |
3774 |
++ |
3775 |
++ mutex_lock(&spec->coef_mutex); |
3776 |
+ for (; fw->nid; fw++) { |
3777 |
+ if (fw->mask == (unsigned short)-1) |
3778 |
+- alc_write_coefex_idx(codec, fw->nid, fw->idx, fw->val); |
3779 |
++ __alc_write_coefex_idx(codec, fw->nid, fw->idx, fw->val); |
3780 |
+ else |
3781 |
+- alc_update_coefex_idx(codec, fw->nid, fw->idx, |
3782 |
+- fw->mask, fw->val); |
3783 |
++ __alc_update_coefex_idx(codec, fw->nid, fw->idx, |
3784 |
++ fw->mask, fw->val); |
3785 |
+ } |
3786 |
++ mutex_unlock(&spec->coef_mutex); |
3787 |
+ } |
3788 |
+ |
3789 |
+ /* |
3790 |
+@@ -1148,6 +1186,7 @@ static int alc_alloc_spec(struct hda_codec *codec, hda_nid_t mixer_nid) |
3791 |
+ codec->spdif_status_reset = 1; |
3792 |
+ codec->forced_resume = 1; |
3793 |
+ codec->patch_ops = alc_patch_ops; |
3794 |
++ mutex_init(&spec->coef_mutex); |
3795 |
+ |
3796 |
+ err = alc_codec_rename_from_preset(codec); |
3797 |
+ if (err < 0) { |
3798 |
+@@ -2120,6 +2159,7 @@ static void alc1220_fixup_gb_x570(struct hda_codec *codec, |
3799 |
+ { |
3800 |
+ static const hda_nid_t conn1[] = { 0x0c }; |
3801 |
+ static const struct coef_fw gb_x570_coefs[] = { |
3802 |
++ WRITE_COEF(0x07, 0x03c0), |
3803 |
+ WRITE_COEF(0x1a, 0x01c1), |
3804 |
+ WRITE_COEF(0x1b, 0x0202), |
3805 |
+ WRITE_COEF(0x43, 0x3005), |
3806 |
+@@ -2546,7 +2586,8 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = { |
3807 |
+ SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", ALC889_FIXUP_FRONT_HP_NO_PRESENCE), |
3808 |
+ SND_PCI_QUIRK(0x1458, 0xa0b8, "Gigabyte AZ370-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS), |
3809 |
+ SND_PCI_QUIRK(0x1458, 0xa0cd, "Gigabyte X570 Aorus Master", ALC1220_FIXUP_GB_X570), |
3810 |
+- SND_PCI_QUIRK(0x1458, 0xa0ce, "Gigabyte X570 Aorus Xtreme", ALC1220_FIXUP_CLEVO_P950), |
3811 |
++ SND_PCI_QUIRK(0x1458, 0xa0ce, "Gigabyte X570 Aorus Xtreme", ALC1220_FIXUP_GB_X570), |
3812 |
++ SND_PCI_QUIRK(0x1458, 0xa0d5, "Gigabyte X570S Aorus Master", ALC1220_FIXUP_GB_X570), |
3813 |
+ SND_PCI_QUIRK(0x1462, 0x11f7, "MSI-GE63", ALC1220_FIXUP_CLEVO_P950), |
3814 |
+ SND_PCI_QUIRK(0x1462, 0x1228, "MSI-GP63", ALC1220_FIXUP_CLEVO_P950), |
3815 |
+ SND_PCI_QUIRK(0x1462, 0x1229, "MSI-GP73", ALC1220_FIXUP_CLEVO_P950), |
3816 |
+@@ -2621,6 +2662,7 @@ static const struct hda_model_fixup alc882_fixup_models[] = { |
3817 |
+ {.id = ALC882_FIXUP_NO_PRIMARY_HP, .name = "no-primary-hp"}, |
3818 |
+ {.id = ALC887_FIXUP_ASUS_BASS, .name = "asus-bass"}, |
3819 |
+ {.id = ALC1220_FIXUP_GB_DUAL_CODECS, .name = "dual-codecs"}, |
3820 |
++ {.id = ALC1220_FIXUP_GB_X570, .name = "gb-x570"}, |
3821 |
+ {.id = ALC1220_FIXUP_CLEVO_P950, .name = "clevo-p950"}, |
3822 |
+ {} |
3823 |
+ }; |
3824 |
+@@ -8815,6 +8857,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { |
3825 |
+ SND_PCI_QUIRK(0x1043, 0x1e51, "ASUS Zephyrus M15", ALC294_FIXUP_ASUS_GU502_PINS), |
3826 |
+ SND_PCI_QUIRK(0x1043, 0x1e8e, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA401), |
3827 |
+ SND_PCI_QUIRK(0x1043, 0x1f11, "ASUS Zephyrus G14", ALC289_FIXUP_ASUS_GA401), |
3828 |
++ SND_PCI_QUIRK(0x1043, 0x16b2, "ASUS GU603", ALC289_FIXUP_ASUS_GA401), |
3829 |
+ SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2), |
3830 |
+ SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC), |
3831 |
+ SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC), |
3832 |
+diff --git a/sound/soc/codecs/cpcap.c b/sound/soc/codecs/cpcap.c |
3833 |
+index 05bbacd0d174d..f1c13f42e1c14 100644 |
3834 |
+--- a/sound/soc/codecs/cpcap.c |
3835 |
++++ b/sound/soc/codecs/cpcap.c |
3836 |
+@@ -1667,6 +1667,8 @@ static int cpcap_codec_probe(struct platform_device *pdev) |
3837 |
+ { |
3838 |
+ struct device_node *codec_node = |
3839 |
+ of_get_child_by_name(pdev->dev.parent->of_node, "audio-codec"); |
3840 |
++ if (!codec_node) |
3841 |
++ return -ENODEV; |
3842 |
+ |
3843 |
+ pdev->dev.of_node = codec_node; |
3844 |
+ |
3845 |
+diff --git a/sound/soc/codecs/hdmi-codec.c b/sound/soc/codecs/hdmi-codec.c |
3846 |
+index b61f980cabdc0..b07607a9ecea4 100644 |
3847 |
+--- a/sound/soc/codecs/hdmi-codec.c |
3848 |
++++ b/sound/soc/codecs/hdmi-codec.c |
3849 |
+@@ -277,7 +277,7 @@ struct hdmi_codec_priv { |
3850 |
+ bool busy; |
3851 |
+ struct snd_soc_jack *jack; |
3852 |
+ unsigned int jack_status; |
3853 |
+- u8 iec_status[5]; |
3854 |
++ u8 iec_status[AES_IEC958_STATUS_SIZE]; |
3855 |
+ }; |
3856 |
+ |
3857 |
+ static const struct snd_soc_dapm_widget hdmi_widgets[] = { |
3858 |
+diff --git a/sound/soc/codecs/lpass-rx-macro.c b/sound/soc/codecs/lpass-rx-macro.c |
3859 |
+index 07894ec5e7a61..1c0409350e869 100644 |
3860 |
+--- a/sound/soc/codecs/lpass-rx-macro.c |
3861 |
++++ b/sound/soc/codecs/lpass-rx-macro.c |
3862 |
+@@ -2688,8 +2688,8 @@ static uint32_t get_iir_band_coeff(struct snd_soc_component *component, |
3863 |
+ int reg, b2_reg; |
3864 |
+ |
3865 |
+ /* Address does not automatically update if reading */ |
3866 |
+- reg = CDC_RX_SIDETONE_IIR0_IIR_COEF_B1_CTL + 16 * iir_idx; |
3867 |
+- b2_reg = CDC_RX_SIDETONE_IIR0_IIR_COEF_B2_CTL + 16 * iir_idx; |
3868 |
++ reg = CDC_RX_SIDETONE_IIR0_IIR_COEF_B1_CTL + 0x80 * iir_idx; |
3869 |
++ b2_reg = CDC_RX_SIDETONE_IIR0_IIR_COEF_B2_CTL + 0x80 * iir_idx; |
3870 |
+ |
3871 |
+ snd_soc_component_write(component, reg, |
3872 |
+ ((band_idx * BAND_MAX + coeff_idx) * |
3873 |
+@@ -2718,7 +2718,7 @@ static uint32_t get_iir_band_coeff(struct snd_soc_component *component, |
3874 |
+ static void set_iir_band_coeff(struct snd_soc_component *component, |
3875 |
+ int iir_idx, int band_idx, uint32_t value) |
3876 |
+ { |
3877 |
+- int reg = CDC_RX_SIDETONE_IIR0_IIR_COEF_B2_CTL + 16 * iir_idx; |
3878 |
++ int reg = CDC_RX_SIDETONE_IIR0_IIR_COEF_B2_CTL + 0x80 * iir_idx; |
3879 |
+ |
3880 |
+ snd_soc_component_write(component, reg, (value & 0xFF)); |
3881 |
+ snd_soc_component_write(component, reg, (value >> 8) & 0xFF); |
3882 |
+@@ -2739,7 +2739,7 @@ static int rx_macro_put_iir_band_audio_mixer( |
3883 |
+ int iir_idx = ctl->iir_idx; |
3884 |
+ int band_idx = ctl->band_idx; |
3885 |
+ u32 coeff[BAND_MAX]; |
3886 |
+- int reg = CDC_RX_SIDETONE_IIR0_IIR_COEF_B1_CTL + 16 * iir_idx; |
3887 |
++ int reg = CDC_RX_SIDETONE_IIR0_IIR_COEF_B1_CTL + 0x80 * iir_idx; |
3888 |
+ |
3889 |
+ memcpy(&coeff[0], ucontrol->value.bytes.data, params->max); |
3890 |
+ |
3891 |
+diff --git a/sound/soc/codecs/max9759.c b/sound/soc/codecs/max9759.c |
3892 |
+index 00e9d4fd1651f..0c261335c8a16 100644 |
3893 |
+--- a/sound/soc/codecs/max9759.c |
3894 |
++++ b/sound/soc/codecs/max9759.c |
3895 |
+@@ -64,7 +64,8 @@ static int speaker_gain_control_put(struct snd_kcontrol *kcontrol, |
3896 |
+ struct snd_soc_component *c = snd_soc_kcontrol_component(kcontrol); |
3897 |
+ struct max9759 *priv = snd_soc_component_get_drvdata(c); |
3898 |
+ |
3899 |
+- if (ucontrol->value.integer.value[0] > 3) |
3900 |
++ if (ucontrol->value.integer.value[0] < 0 || |
3901 |
++ ucontrol->value.integer.value[0] > 3) |
3902 |
+ return -EINVAL; |
3903 |
+ |
3904 |
+ priv->gain = ucontrol->value.integer.value[0]; |
3905 |
+diff --git a/sound/soc/codecs/wcd938x.c b/sound/soc/codecs/wcd938x.c |
3906 |
+index 67151c7770c65..bbc261ab2025b 100644 |
3907 |
+--- a/sound/soc/codecs/wcd938x.c |
3908 |
++++ b/sound/soc/codecs/wcd938x.c |
3909 |
+@@ -1432,14 +1432,10 @@ static int wcd938x_sdw_connect_port(struct wcd938x_sdw_ch_info *ch_info, |
3910 |
+ return 0; |
3911 |
+ } |
3912 |
+ |
3913 |
+-static int wcd938x_connect_port(struct wcd938x_sdw_priv *wcd, u8 ch_id, u8 enable) |
3914 |
++static int wcd938x_connect_port(struct wcd938x_sdw_priv *wcd, u8 port_num, u8 ch_id, u8 enable) |
3915 |
+ { |
3916 |
+- u8 port_num; |
3917 |
+- |
3918 |
+- port_num = wcd->ch_info[ch_id].port_num; |
3919 |
+- |
3920 |
+ return wcd938x_sdw_connect_port(&wcd->ch_info[ch_id], |
3921 |
+- &wcd->port_config[port_num], |
3922 |
++ &wcd->port_config[port_num - 1], |
3923 |
+ enable); |
3924 |
+ } |
3925 |
+ |
3926 |
+@@ -2563,7 +2559,7 @@ static int wcd938x_ear_pa_put_gain(struct snd_kcontrol *kcontrol, |
3927 |
+ WCD938X_EAR_GAIN_MASK, |
3928 |
+ ucontrol->value.integer.value[0]); |
3929 |
+ |
3930 |
+- return 0; |
3931 |
++ return 1; |
3932 |
+ } |
3933 |
+ |
3934 |
+ static int wcd938x_get_compander(struct snd_kcontrol *kcontrol, |
3935 |
+@@ -2593,6 +2589,7 @@ static int wcd938x_set_compander(struct snd_kcontrol *kcontrol, |
3936 |
+ struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); |
3937 |
+ struct wcd938x_sdw_priv *wcd; |
3938 |
+ int value = ucontrol->value.integer.value[0]; |
3939 |
++ int portidx; |
3940 |
+ struct soc_mixer_control *mc; |
3941 |
+ bool hphr; |
3942 |
+ |
3943 |
+@@ -2606,12 +2603,14 @@ static int wcd938x_set_compander(struct snd_kcontrol *kcontrol, |
3944 |
+ else |
3945 |
+ wcd938x->comp1_enable = value; |
3946 |
+ |
3947 |
++ portidx = wcd->ch_info[mc->reg].port_num; |
3948 |
++ |
3949 |
+ if (value) |
3950 |
+- wcd938x_connect_port(wcd, mc->reg, true); |
3951 |
++ wcd938x_connect_port(wcd, portidx, mc->reg, true); |
3952 |
+ else |
3953 |
+- wcd938x_connect_port(wcd, mc->reg, false); |
3954 |
++ wcd938x_connect_port(wcd, portidx, mc->reg, false); |
3955 |
+ |
3956 |
+- return 0; |
3957 |
++ return 1; |
3958 |
+ } |
3959 |
+ |
3960 |
+ static int wcd938x_ldoh_get(struct snd_kcontrol *kcontrol, |
3961 |
+@@ -2882,9 +2881,11 @@ static int wcd938x_get_swr_port(struct snd_kcontrol *kcontrol, |
3962 |
+ struct wcd938x_sdw_priv *wcd; |
3963 |
+ struct soc_mixer_control *mixer = (struct soc_mixer_control *)kcontrol->private_value; |
3964 |
+ int dai_id = mixer->shift; |
3965 |
+- int portidx = mixer->reg; |
3966 |
++ int portidx, ch_idx = mixer->reg; |
3967 |
++ |
3968 |
+ |
3969 |
+ wcd = wcd938x->sdw_priv[dai_id]; |
3970 |
++ portidx = wcd->ch_info[ch_idx].port_num; |
3971 |
+ |
3972 |
+ ucontrol->value.integer.value[0] = wcd->port_enable[portidx]; |
3973 |
+ |
3974 |
+@@ -2899,12 +2900,14 @@ static int wcd938x_set_swr_port(struct snd_kcontrol *kcontrol, |
3975 |
+ struct wcd938x_sdw_priv *wcd; |
3976 |
+ struct soc_mixer_control *mixer = |
3977 |
+ (struct soc_mixer_control *)kcontrol->private_value; |
3978 |
+- int portidx = mixer->reg; |
3979 |
++ int ch_idx = mixer->reg; |
3980 |
++ int portidx; |
3981 |
+ int dai_id = mixer->shift; |
3982 |
+ bool enable; |
3983 |
+ |
3984 |
+ wcd = wcd938x->sdw_priv[dai_id]; |
3985 |
+ |
3986 |
++ portidx = wcd->ch_info[ch_idx].port_num; |
3987 |
+ if (ucontrol->value.integer.value[0]) |
3988 |
+ enable = true; |
3989 |
+ else |
3990 |
+@@ -2912,9 +2915,9 @@ static int wcd938x_set_swr_port(struct snd_kcontrol *kcontrol, |
3991 |
+ |
3992 |
+ wcd->port_enable[portidx] = enable; |
3993 |
+ |
3994 |
+- wcd938x_connect_port(wcd, portidx, enable); |
3995 |
++ wcd938x_connect_port(wcd, portidx, ch_idx, enable); |
3996 |
+ |
3997 |
+- return 0; |
3998 |
++ return 1; |
3999 |
+ |
4000 |
+ } |
4001 |
+ |
4002 |
+diff --git a/sound/soc/fsl/pcm030-audio-fabric.c b/sound/soc/fsl/pcm030-audio-fabric.c |
4003 |
+index af3c3b90c0aca..83b4a22bf15ac 100644 |
4004 |
+--- a/sound/soc/fsl/pcm030-audio-fabric.c |
4005 |
++++ b/sound/soc/fsl/pcm030-audio-fabric.c |
4006 |
+@@ -93,16 +93,21 @@ static int pcm030_fabric_probe(struct platform_device *op) |
4007 |
+ dev_err(&op->dev, "platform_device_alloc() failed\n"); |
4008 |
+ |
4009 |
+ ret = platform_device_add(pdata->codec_device); |
4010 |
+- if (ret) |
4011 |
++ if (ret) { |
4012 |
+ dev_err(&op->dev, "platform_device_add() failed: %d\n", ret); |
4013 |
++ platform_device_put(pdata->codec_device); |
4014 |
++ } |
4015 |
+ |
4016 |
+ ret = snd_soc_register_card(card); |
4017 |
+- if (ret) |
4018 |
++ if (ret) { |
4019 |
+ dev_err(&op->dev, "snd_soc_register_card() failed: %d\n", ret); |
4020 |
++ platform_device_del(pdata->codec_device); |
4021 |
++ platform_device_put(pdata->codec_device); |
4022 |
++ } |
4023 |
+ |
4024 |
+ platform_set_drvdata(op, pdata); |
4025 |
+- |
4026 |
+ return ret; |
4027 |
++ |
4028 |
+ } |
4029 |
+ |
4030 |
+ static int pcm030_fabric_remove(struct platform_device *op) |
4031 |
+diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c |
4032 |
+index a3a7990b5cb66..bc3e24c6a28a8 100644 |
4033 |
+--- a/sound/soc/generic/simple-card.c |
4034 |
++++ b/sound/soc/generic/simple-card.c |
4035 |
+@@ -28,6 +28,30 @@ static const struct snd_soc_ops simple_ops = { |
4036 |
+ .hw_params = asoc_simple_hw_params, |
4037 |
+ }; |
4038 |
+ |
4039 |
++static int asoc_simple_parse_platform(struct device_node *node, |
4040 |
++ struct snd_soc_dai_link_component *dlc) |
4041 |
++{ |
4042 |
++ struct of_phandle_args args; |
4043 |
++ int ret; |
4044 |
++ |
4045 |
++ if (!node) |
4046 |
++ return 0; |
4047 |
++ |
4048 |
++ /* |
4049 |
++ * Get node via "sound-dai = <&phandle port>" |
4050 |
++ * it will be used as xxx_of_node on soc_bind_dai_link() |
4051 |
++ */ |
4052 |
++ ret = of_parse_phandle_with_args(node, DAI, CELL, 0, &args); |
4053 |
++ if (ret) |
4054 |
++ return ret; |
4055 |
++ |
4056 |
++ /* dai_name is not required and may not exist for plat component */ |
4057 |
++ |
4058 |
++ dlc->of_node = args.np; |
4059 |
++ |
4060 |
++ return 0; |
4061 |
++} |
4062 |
++ |
4063 |
+ static int asoc_simple_parse_dai(struct device_node *node, |
4064 |
+ struct snd_soc_dai_link_component *dlc, |
4065 |
+ int *is_single_link) |
4066 |
+@@ -289,7 +313,7 @@ static int simple_dai_link_of(struct asoc_simple_priv *priv, |
4067 |
+ if (ret < 0) |
4068 |
+ goto dai_link_of_err; |
4069 |
+ |
4070 |
+- ret = asoc_simple_parse_dai(plat, platforms, NULL); |
4071 |
++ ret = asoc_simple_parse_platform(plat, platforms); |
4072 |
+ if (ret < 0) |
4073 |
+ goto dai_link_of_err; |
4074 |
+ |
4075 |
+diff --git a/sound/soc/soc-ops.c b/sound/soc/soc-ops.c |
4076 |
+index 08eaa9ddf191e..dc0e7c8d31f37 100644 |
4077 |
+--- a/sound/soc/soc-ops.c |
4078 |
++++ b/sound/soc/soc-ops.c |
4079 |
+@@ -316,13 +316,27 @@ int snd_soc_put_volsw(struct snd_kcontrol *kcontrol, |
4080 |
+ if (sign_bit) |
4081 |
+ mask = BIT(sign_bit + 1) - 1; |
4082 |
+ |
4083 |
+- val = ((ucontrol->value.integer.value[0] + min) & mask); |
4084 |
++ val = ucontrol->value.integer.value[0]; |
4085 |
++ if (mc->platform_max && val > mc->platform_max) |
4086 |
++ return -EINVAL; |
4087 |
++ if (val > max - min) |
4088 |
++ return -EINVAL; |
4089 |
++ if (val < 0) |
4090 |
++ return -EINVAL; |
4091 |
++ val = (val + min) & mask; |
4092 |
+ if (invert) |
4093 |
+ val = max - val; |
4094 |
+ val_mask = mask << shift; |
4095 |
+ val = val << shift; |
4096 |
+ if (snd_soc_volsw_is_stereo(mc)) { |
4097 |
+- val2 = ((ucontrol->value.integer.value[1] + min) & mask); |
4098 |
++ val2 = ucontrol->value.integer.value[1]; |
4099 |
++ if (mc->platform_max && val2 > mc->platform_max) |
4100 |
++ return -EINVAL; |
4101 |
++ if (val2 > max - min) |
4102 |
++ return -EINVAL; |
4103 |
++ if (val2 < 0) |
4104 |
++ return -EINVAL; |
4105 |
++ val2 = (val2 + min) & mask; |
4106 |
+ if (invert) |
4107 |
+ val2 = max - val2; |
4108 |
+ if (reg == reg2) { |
4109 |
+@@ -409,8 +423,15 @@ int snd_soc_put_volsw_sx(struct snd_kcontrol *kcontrol, |
4110 |
+ int err = 0; |
4111 |
+ unsigned int val, val_mask; |
4112 |
+ |
4113 |
++ val = ucontrol->value.integer.value[0]; |
4114 |
++ if (mc->platform_max && val > mc->platform_max) |
4115 |
++ return -EINVAL; |
4116 |
++ if (val > max - min) |
4117 |
++ return -EINVAL; |
4118 |
++ if (val < 0) |
4119 |
++ return -EINVAL; |
4120 |
+ val_mask = mask << shift; |
4121 |
+- val = (ucontrol->value.integer.value[0] + min) & mask; |
4122 |
++ val = (val + min) & mask; |
4123 |
+ val = val << shift; |
4124 |
+ |
4125 |
+ err = snd_soc_component_update_bits(component, reg, val_mask, val); |
4126 |
+@@ -858,6 +879,8 @@ int snd_soc_put_xr_sx(struct snd_kcontrol *kcontrol, |
4127 |
+ long val = ucontrol->value.integer.value[0]; |
4128 |
+ unsigned int i; |
4129 |
+ |
4130 |
++ if (val < mc->min || val > mc->max) |
4131 |
++ return -EINVAL; |
4132 |
+ if (invert) |
4133 |
+ val = max - val; |
4134 |
+ val &= mask; |
4135 |
+diff --git a/sound/soc/xilinx/xlnx_formatter_pcm.c b/sound/soc/xilinx/xlnx_formatter_pcm.c |
4136 |
+index 91afea9d5de67..ce19a6058b279 100644 |
4137 |
+--- a/sound/soc/xilinx/xlnx_formatter_pcm.c |
4138 |
++++ b/sound/soc/xilinx/xlnx_formatter_pcm.c |
4139 |
+@@ -37,6 +37,7 @@ |
4140 |
+ #define XLNX_AUD_XFER_COUNT 0x28 |
4141 |
+ #define XLNX_AUD_CH_STS_START 0x2C |
4142 |
+ #define XLNX_BYTES_PER_CH 0x44 |
4143 |
++#define XLNX_AUD_ALIGN_BYTES 64 |
4144 |
+ |
4145 |
+ #define AUD_STS_IOC_IRQ_MASK BIT(31) |
4146 |
+ #define AUD_STS_CH_STS_MASK BIT(29) |
4147 |
+@@ -368,12 +369,32 @@ static int xlnx_formatter_pcm_open(struct snd_soc_component *component, |
4148 |
+ snd_soc_set_runtime_hwparams(substream, &xlnx_pcm_hardware); |
4149 |
+ runtime->private_data = stream_data; |
4150 |
+ |
4151 |
+- /* Resize the period size divisible by 64 */ |
4152 |
++ /* Resize the period bytes as divisible by 64 */ |
4153 |
+ err = snd_pcm_hw_constraint_step(runtime, 0, |
4154 |
+- SNDRV_PCM_HW_PARAM_PERIOD_BYTES, 64); |
4155 |
++ SNDRV_PCM_HW_PARAM_PERIOD_BYTES, |
4156 |
++ XLNX_AUD_ALIGN_BYTES); |
4157 |
+ if (err) { |
4158 |
+ dev_err(component->dev, |
4159 |
+- "unable to set constraint on period bytes\n"); |
4160 |
++ "Unable to set constraint on period bytes\n"); |
4161 |
++ return err; |
4162 |
++ } |
4163 |
++ |
4164 |
++ /* Resize the buffer bytes as divisible by 64 */ |
4165 |
++ err = snd_pcm_hw_constraint_step(runtime, 0, |
4166 |
++ SNDRV_PCM_HW_PARAM_BUFFER_BYTES, |
4167 |
++ XLNX_AUD_ALIGN_BYTES); |
4168 |
++ if (err) { |
4169 |
++ dev_err(component->dev, |
4170 |
++ "Unable to set constraint on buffer bytes\n"); |
4171 |
++ return err; |
4172 |
++ } |
4173 |
++ |
4174 |
++ /* Set periods as integer multiple */ |
4175 |
++ err = snd_pcm_hw_constraint_integer(runtime, |
4176 |
++ SNDRV_PCM_HW_PARAM_PERIODS); |
4177 |
++ if (err < 0) { |
4178 |
++ dev_err(component->dev, |
4179 |
++ "Unable to set constraint on periods to be integer\n"); |
4180 |
+ return err; |
4181 |
+ } |
4182 |
+ |
4183 |
+diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c |
4184 |
+index 8e030b1c061ab..567514832b0df 100644 |
4185 |
+--- a/sound/usb/mixer.c |
4186 |
++++ b/sound/usb/mixer.c |
4187 |
+@@ -1496,6 +1496,10 @@ error: |
4188 |
+ usb_audio_err(chip, |
4189 |
+ "cannot get connectors status: req = %#x, wValue = %#x, wIndex = %#x, type = %d\n", |
4190 |
+ UAC_GET_CUR, validx, idx, cval->val_type); |
4191 |
++ |
4192 |
++ if (val) |
4193 |
++ *val = 0; |
4194 |
++ |
4195 |
+ return filter_error(cval, ret); |
4196 |
+ } |
4197 |
+ |
4198 |
+diff --git a/sound/usb/quirks-table.h b/sound/usb/quirks-table.h |
4199 |
+index b1522e43173e1..0ea39565e6232 100644 |
4200 |
+--- a/sound/usb/quirks-table.h |
4201 |
++++ b/sound/usb/quirks-table.h |
4202 |
+@@ -84,7 +84,7 @@ |
4203 |
+ * combination. |
4204 |
+ */ |
4205 |
+ { |
4206 |
+- USB_DEVICE(0x041e, 0x4095), |
4207 |
++ USB_AUDIO_DEVICE(0x041e, 0x4095), |
4208 |
+ .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) { |
4209 |
+ .ifnum = QUIRK_ANY_INTERFACE, |
4210 |
+ .type = QUIRK_COMPOSITE, |
4211 |
+diff --git a/tools/bpf/resolve_btfids/Makefile b/tools/bpf/resolve_btfids/Makefile |
4212 |
+index bb9fa8de7e625..af9f9d3534c96 100644 |
4213 |
+--- a/tools/bpf/resolve_btfids/Makefile |
4214 |
++++ b/tools/bpf/resolve_btfids/Makefile |
4215 |
+@@ -9,7 +9,11 @@ ifeq ($(V),1) |
4216 |
+ msg = |
4217 |
+ else |
4218 |
+ Q = @ |
4219 |
+- msg = @printf ' %-8s %s%s\n' "$(1)" "$(notdir $(2))" "$(if $(3), $(3))"; |
4220 |
++ ifeq ($(silent),1) |
4221 |
++ msg = |
4222 |
++ else |
4223 |
++ msg = @printf ' %-8s %s%s\n' "$(1)" "$(notdir $(2))" "$(if $(3), $(3))"; |
4224 |
++ endif |
4225 |
+ MAKEFLAGS=--no-print-directory |
4226 |
+ endif |
4227 |
+ |
4228 |
+diff --git a/tools/include/uapi/sound/asound.h b/tools/include/uapi/sound/asound.h |
4229 |
+index 5859ca0a1439b..93e40f91bd49a 100644 |
4230 |
+--- a/tools/include/uapi/sound/asound.h |
4231 |
++++ b/tools/include/uapi/sound/asound.h |
4232 |
+@@ -56,8 +56,10 @@ |
4233 |
+ * * |
4234 |
+ ****************************************************************************/ |
4235 |
+ |
4236 |
++#define AES_IEC958_STATUS_SIZE 24 |
4237 |
++ |
4238 |
+ struct snd_aes_iec958 { |
4239 |
+- unsigned char status[24]; /* AES/IEC958 channel status bits */ |
4240 |
++ unsigned char status[AES_IEC958_STATUS_SIZE]; /* AES/IEC958 channel status bits */ |
4241 |
+ unsigned char subcode[147]; /* AES/IEC958 subcode bits */ |
4242 |
+ unsigned char pad; /* nothing */ |
4243 |
+ unsigned char dig_subframe[4]; /* AES/IEC958 subframe bits */ |
4244 |
+diff --git a/tools/perf/util/stat-display.c b/tools/perf/util/stat-display.c |
4245 |
+index 588601000f3f9..db00ca6a67deb 100644 |
4246 |
+--- a/tools/perf/util/stat-display.c |
4247 |
++++ b/tools/perf/util/stat-display.c |
4248 |
+@@ -584,15 +584,16 @@ static void collect_all_aliases(struct perf_stat_config *config, struct evsel *c |
4249 |
+ |
4250 |
+ alias = list_prepare_entry(counter, &(evlist->core.entries), core.node); |
4251 |
+ list_for_each_entry_continue (alias, &evlist->core.entries, core.node) { |
4252 |
+- if (strcmp(evsel__name(alias), evsel__name(counter)) || |
4253 |
+- alias->scale != counter->scale || |
4254 |
+- alias->cgrp != counter->cgrp || |
4255 |
+- strcmp(alias->unit, counter->unit) || |
4256 |
+- evsel__is_clock(alias) != evsel__is_clock(counter) || |
4257 |
+- !strcmp(alias->pmu_name, counter->pmu_name)) |
4258 |
+- break; |
4259 |
+- alias->merged_stat = true; |
4260 |
+- cb(config, alias, data, false); |
4261 |
++ /* Merge events with the same name, etc. but on different PMUs. */ |
4262 |
++ if (!strcmp(evsel__name(alias), evsel__name(counter)) && |
4263 |
++ alias->scale == counter->scale && |
4264 |
++ alias->cgrp == counter->cgrp && |
4265 |
++ !strcmp(alias->unit, counter->unit) && |
4266 |
++ evsel__is_clock(alias) == evsel__is_clock(counter) && |
4267 |
++ strcmp(alias->pmu_name, counter->pmu_name)) { |
4268 |
++ alias->merged_stat = true; |
4269 |
++ cb(config, alias, data, false); |
4270 |
++ } |
4271 |
+ } |
4272 |
+ } |
4273 |
+ |
4274 |
+diff --git a/tools/testing/selftests/exec/Makefile b/tools/testing/selftests/exec/Makefile |
4275 |
+index dd61118df66ed..12c5e27d32c16 100644 |
4276 |
+--- a/tools/testing/selftests/exec/Makefile |
4277 |
++++ b/tools/testing/selftests/exec/Makefile |
4278 |
+@@ -5,7 +5,7 @@ CFLAGS += -D_GNU_SOURCE |
4279 |
+ |
4280 |
+ TEST_PROGS := binfmt_script non-regular |
4281 |
+ TEST_GEN_PROGS := execveat load_address_4096 load_address_2097152 load_address_16777216 |
4282 |
+-TEST_GEN_FILES := execveat.symlink execveat.denatured script subdir pipe |
4283 |
++TEST_GEN_FILES := execveat.symlink execveat.denatured script subdir |
4284 |
+ # Makefile is a run-time dependency, since it's accessed by the execveat test |
4285 |
+ TEST_FILES := Makefile |
4286 |
+ |
4287 |
+diff --git a/tools/testing/selftests/futex/Makefile b/tools/testing/selftests/futex/Makefile |
4288 |
+index 12631f0076a10..11e157d7533b8 100644 |
4289 |
+--- a/tools/testing/selftests/futex/Makefile |
4290 |
++++ b/tools/testing/selftests/futex/Makefile |
4291 |
+@@ -11,7 +11,7 @@ all: |
4292 |
+ @for DIR in $(SUBDIRS); do \ |
4293 |
+ BUILD_TARGET=$(OUTPUT)/$$DIR; \ |
4294 |
+ mkdir $$BUILD_TARGET -p; \ |
4295 |
+- make OUTPUT=$$BUILD_TARGET -C $$DIR $@;\ |
4296 |
++ $(MAKE) OUTPUT=$$BUILD_TARGET -C $$DIR $@;\ |
4297 |
+ if [ -e $$DIR/$(TEST_PROGS) ]; then \ |
4298 |
+ rsync -a $$DIR/$(TEST_PROGS) $$BUILD_TARGET/; \ |
4299 |
+ fi \ |
4300 |
+@@ -32,6 +32,6 @@ override define CLEAN |
4301 |
+ @for DIR in $(SUBDIRS); do \ |
4302 |
+ BUILD_TARGET=$(OUTPUT)/$$DIR; \ |
4303 |
+ mkdir $$BUILD_TARGET -p; \ |
4304 |
+- make OUTPUT=$$BUILD_TARGET -C $$DIR $@;\ |
4305 |
++ $(MAKE) OUTPUT=$$BUILD_TARGET -C $$DIR $@;\ |
4306 |
+ done |
4307 |
+ endef |
4308 |
+diff --git a/tools/testing/selftests/netfilter/nft_concat_range.sh b/tools/testing/selftests/netfilter/nft_concat_range.sh |
4309 |
+index 5a4938d6dcf25..9313fa32bef13 100755 |
4310 |
+--- a/tools/testing/selftests/netfilter/nft_concat_range.sh |
4311 |
++++ b/tools/testing/selftests/netfilter/nft_concat_range.sh |
4312 |
+@@ -27,7 +27,7 @@ TYPES="net_port port_net net6_port port_proto net6_port_mac net6_port_mac_proto |
4313 |
+ net_port_mac_proto_net" |
4314 |
+ |
4315 |
+ # Reported bugs, also described by TYPE_ variables below |
4316 |
+-BUGS="flush_remove_add" |
4317 |
++BUGS="flush_remove_add reload" |
4318 |
+ |
4319 |
+ # List of possible paths to pktgen script from kernel tree for performance tests |
4320 |
+ PKTGEN_SCRIPT_PATHS=" |
4321 |
+@@ -337,6 +337,23 @@ TYPE_flush_remove_add=" |
4322 |
+ display Add two elements, flush, re-add |
4323 |
+ " |
4324 |
+ |
4325 |
++TYPE_reload=" |
4326 |
++display net,mac with reload |
4327 |
++type_spec ipv4_addr . ether_addr |
4328 |
++chain_spec ip daddr . ether saddr |
4329 |
++dst addr4 |
4330 |
++src mac |
4331 |
++start 1 |
4332 |
++count 1 |
4333 |
++src_delta 2000 |
4334 |
++tools sendip nc bash |
4335 |
++proto udp |
4336 |
++ |
4337 |
++race_repeat 0 |
4338 |
++ |
4339 |
++perf_duration 0 |
4340 |
++" |
4341 |
++ |
4342 |
+ # Set template for all tests, types and rules are filled in depending on test |
4343 |
+ set_template=' |
4344 |
+ flush ruleset |
4345 |
+@@ -1455,6 +1472,59 @@ test_bug_flush_remove_add() { |
4346 |
+ nft flush ruleset |
4347 |
+ } |
4348 |
+ |
4349 |
++# - add ranged element, check that packets match it |
4350 |
++# - reload the set, check packets still match |
4351 |
++test_bug_reload() { |
4352 |
++ setup veth send_"${proto}" set || return ${KSELFTEST_SKIP} |
4353 |
++ rstart=${start} |
4354 |
++ |
4355 |
++ range_size=1 |
4356 |
++ for i in $(seq "${start}" $((start + count))); do |
4357 |
++ end=$((start + range_size)) |
4358 |
++ |
4359 |
++ # Avoid negative or zero-sized port ranges |
4360 |
++ if [ $((end / 65534)) -gt $((start / 65534)) ]; then |
4361 |
++ start=${end} |
4362 |
++ end=$((end + 1)) |
4363 |
++ fi |
4364 |
++ srcstart=$((start + src_delta)) |
4365 |
++ srcend=$((end + src_delta)) |
4366 |
++ |
4367 |
++ add "$(format)" || return 1 |
4368 |
++ range_size=$((range_size + 1)) |
4369 |
++ start=$((end + range_size)) |
4370 |
++ done |
4371 |
++ |
4372 |
++ # check kernel does allocate pcpu sctrach map |
4373 |
++ # for reload with no elemet add/delete |
4374 |
++ ( echo flush set inet filter test ; |
4375 |
++ nft list set inet filter test ) | nft -f - |
4376 |
++ |
4377 |
++ start=${rstart} |
4378 |
++ range_size=1 |
4379 |
++ |
4380 |
++ for i in $(seq "${start}" $((start + count))); do |
4381 |
++ end=$((start + range_size)) |
4382 |
++ |
4383 |
++ # Avoid negative or zero-sized port ranges |
4384 |
++ if [ $((end / 65534)) -gt $((start / 65534)) ]; then |
4385 |
++ start=${end} |
4386 |
++ end=$((end + 1)) |
4387 |
++ fi |
4388 |
++ srcstart=$((start + src_delta)) |
4389 |
++ srcend=$((end + src_delta)) |
4390 |
++ |
4391 |
++ for j in $(seq ${start} $((range_size / 2 + 1)) ${end}); do |
4392 |
++ send_match "${j}" $((j + src_delta)) || return 1 |
4393 |
++ done |
4394 |
++ |
4395 |
++ range_size=$((range_size + 1)) |
4396 |
++ start=$((end + range_size)) |
4397 |
++ done |
4398 |
++ |
4399 |
++ nft flush ruleset |
4400 |
++} |
4401 |
++ |
4402 |
+ test_reported_issues() { |
4403 |
+ eval test_bug_"${subtest}" |
4404 |
+ } |
4405 |
+diff --git a/tools/testing/selftests/netfilter/nft_nat.sh b/tools/testing/selftests/netfilter/nft_nat.sh |
4406 |
+index da1c1e4b6c86b..781fa2d9ea9d5 100755 |
4407 |
+--- a/tools/testing/selftests/netfilter/nft_nat.sh |
4408 |
++++ b/tools/testing/selftests/netfilter/nft_nat.sh |
4409 |
+@@ -885,6 +885,144 @@ EOF |
4410 |
+ ip netns exec "$ns0" nft delete table $family nat |
4411 |
+ } |
4412 |
+ |
4413 |
++test_stateless_nat_ip() |
4414 |
++{ |
4415 |
++ local lret=0 |
4416 |
++ |
4417 |
++ ip netns exec "$ns0" sysctl net.ipv4.conf.veth0.forwarding=1 > /dev/null |
4418 |
++ ip netns exec "$ns0" sysctl net.ipv4.conf.veth1.forwarding=1 > /dev/null |
4419 |
++ |
4420 |
++ ip netns exec "$ns2" ping -q -c 1 10.0.1.99 > /dev/null # ping ns2->ns1 |
4421 |
++ if [ $? -ne 0 ] ; then |
4422 |
++ echo "ERROR: cannot ping $ns1 from $ns2 before loading stateless rules" |
4423 |
++ return 1 |
4424 |
++ fi |
4425 |
++ |
4426 |
++ip netns exec "$ns0" nft -f /dev/stdin <<EOF |
4427 |
++table ip stateless { |
4428 |
++ map xlate_in { |
4429 |
++ typeof meta iifname . ip saddr . ip daddr : ip daddr |
4430 |
++ elements = { |
4431 |
++ "veth1" . 10.0.2.99 . 10.0.1.99 : 10.0.2.2, |
4432 |
++ } |
4433 |
++ } |
4434 |
++ map xlate_out { |
4435 |
++ typeof meta iifname . ip saddr . ip daddr : ip daddr |
4436 |
++ elements = { |
4437 |
++ "veth0" . 10.0.1.99 . 10.0.2.2 : 10.0.2.99 |
4438 |
++ } |
4439 |
++ } |
4440 |
++ |
4441 |
++ chain prerouting { |
4442 |
++ type filter hook prerouting priority -400; policy accept; |
4443 |
++ ip saddr set meta iifname . ip saddr . ip daddr map @xlate_in |
4444 |
++ ip daddr set meta iifname . ip saddr . ip daddr map @xlate_out |
4445 |
++ } |
4446 |
++} |
4447 |
++EOF |
4448 |
++ if [ $? -ne 0 ]; then |
4449 |
++ echo "SKIP: Could not add ip statless rules" |
4450 |
++ return $ksft_skip |
4451 |
++ fi |
4452 |
++ |
4453 |
++ reset_counters |
4454 |
++ |
4455 |
++ ip netns exec "$ns2" ping -q -c 1 10.0.1.99 > /dev/null # ping ns2->ns1 |
4456 |
++ if [ $? -ne 0 ] ; then |
4457 |
++ echo "ERROR: cannot ping $ns1 from $ns2 with stateless rules" |
4458 |
++ lret=1 |
4459 |
++ fi |
4460 |
++ |
4461 |
++ # ns1 should have seen packets from .2.2, due to stateless rewrite. |
4462 |
++ expect="packets 1 bytes 84" |
4463 |
++ cnt=$(ip netns exec "$ns1" nft list counter inet filter ns0insl | grep -q "$expect") |
4464 |
++ if [ $? -ne 0 ]; then |
4465 |
++ bad_counter "$ns1" ns0insl "$expect" "test_stateless 1" |
4466 |
++ lret=1 |
4467 |
++ fi |
4468 |
++ |
4469 |
++ for dir in "in" "out" ; do |
4470 |
++ cnt=$(ip netns exec "$ns2" nft list counter inet filter ns1${dir} | grep -q "$expect") |
4471 |
++ if [ $? -ne 0 ]; then |
4472 |
++ bad_counter "$ns2" ns1$dir "$expect" "test_stateless 2" |
4473 |
++ lret=1 |
4474 |
++ fi |
4475 |
++ done |
4476 |
++ |
4477 |
++ # ns1 should not have seen packets from ns2, due to masquerade |
4478 |
++ expect="packets 0 bytes 0" |
4479 |
++ for dir in "in" "out" ; do |
4480 |
++ cnt=$(ip netns exec "$ns1" nft list counter inet filter ns2${dir} | grep -q "$expect") |
4481 |
++ if [ $? -ne 0 ]; then |
4482 |
++ bad_counter "$ns1" ns0$dir "$expect" "test_stateless 3" |
4483 |
++ lret=1 |
4484 |
++ fi |
4485 |
++ |
4486 |
++ cnt=$(ip netns exec "$ns0" nft list counter inet filter ns1${dir} | grep -q "$expect") |
4487 |
++ if [ $? -ne 0 ]; then |
4488 |
++ bad_counter "$ns0" ns1$dir "$expect" "test_stateless 4" |
4489 |
++ lret=1 |
4490 |
++ fi |
4491 |
++ done |
4492 |
++ |
4493 |
++ reset_counters |
4494 |
++ |
4495 |
++ socat -h > /dev/null 2>&1 |
4496 |
++ if [ $? -ne 0 ];then |
4497 |
++ echo "SKIP: Could not run stateless nat frag test without socat tool" |
4498 |
++ if [ $lret -eq 0 ]; then |
4499 |
++ return $ksft_skip |
4500 |
++ fi |
4501 |
++ |
4502 |
++ ip netns exec "$ns0" nft delete table ip stateless |
4503 |
++ return $lret |
4504 |
++ fi |
4505 |
++ |
4506 |
++ local tmpfile=$(mktemp) |
4507 |
++ dd if=/dev/urandom of=$tmpfile bs=4096 count=1 2>/dev/null |
4508 |
++ |
4509 |
++ local outfile=$(mktemp) |
4510 |
++ ip netns exec "$ns1" timeout 3 socat -u UDP4-RECV:4233 OPEN:$outfile < /dev/null & |
4511 |
++ sc_r=$! |
4512 |
++ |
4513 |
++ sleep 1 |
4514 |
++ # re-do with large ping -> ip fragmentation |
4515 |
++ ip netns exec "$ns2" timeout 3 socat - UDP4-SENDTO:"10.0.1.99:4233" < "$tmpfile" > /dev/null |
4516 |
++ if [ $? -ne 0 ] ; then |
4517 |
++ echo "ERROR: failed to test udp $ns1 to $ns2 with stateless ip nat" 1>&2 |
4518 |
++ lret=1 |
4519 |
++ fi |
4520 |
++ |
4521 |
++ wait |
4522 |
++ |
4523 |
++ cmp "$tmpfile" "$outfile" |
4524 |
++ if [ $? -ne 0 ]; then |
4525 |
++ ls -l "$tmpfile" "$outfile" |
4526 |
++ echo "ERROR: in and output file mismatch when checking udp with stateless nat" 1>&2 |
4527 |
++ lret=1 |
4528 |
++ fi |
4529 |
++ |
4530 |
++ rm -f "$tmpfile" "$outfile" |
4531 |
++ |
4532 |
++ # ns1 should have seen packets from 2.2, due to stateless rewrite. |
4533 |
++ expect="packets 3 bytes 4164" |
4534 |
++ cnt=$(ip netns exec "$ns1" nft list counter inet filter ns0insl | grep -q "$expect") |
4535 |
++ if [ $? -ne 0 ]; then |
4536 |
++ bad_counter "$ns1" ns0insl "$expect" "test_stateless 5" |
4537 |
++ lret=1 |
4538 |
++ fi |
4539 |
++ |
4540 |
++ ip netns exec "$ns0" nft delete table ip stateless |
4541 |
++ if [ $? -ne 0 ]; then |
4542 |
++ echo "ERROR: Could not delete table ip stateless" 1>&2 |
4543 |
++ lret=1 |
4544 |
++ fi |
4545 |
++ |
4546 |
++ test $lret -eq 0 && echo "PASS: IP statless for $ns2" |
4547 |
++ |
4548 |
++ return $lret |
4549 |
++} |
4550 |
++ |
4551 |
+ # ip netns exec "$ns0" ping -c 1 -q 10.0.$i.99 |
4552 |
+ for i in 0 1 2; do |
4553 |
+ ip netns exec ns$i-$sfx nft -f /dev/stdin <<EOF |
4554 |
+@@ -951,6 +1089,19 @@ table inet filter { |
4555 |
+ EOF |
4556 |
+ done |
4557 |
+ |
4558 |
++# special case for stateless nat check, counter needs to |
4559 |
++# be done before (input) ip defragmentation |
4560 |
++ip netns exec ns1-$sfx nft -f /dev/stdin <<EOF |
4561 |
++table inet filter { |
4562 |
++ counter ns0insl {} |
4563 |
++ |
4564 |
++ chain pre { |
4565 |
++ type filter hook prerouting priority -400; policy accept; |
4566 |
++ ip saddr 10.0.2.2 counter name "ns0insl" |
4567 |
++ } |
4568 |
++} |
4569 |
++EOF |
4570 |
++ |
4571 |
+ sleep 3 |
4572 |
+ # test basic connectivity |
4573 |
+ for i in 1 2; do |
4574 |
+@@ -1005,6 +1156,7 @@ $test_inet_nat && test_redirect inet |
4575 |
+ $test_inet_nat && test_redirect6 inet |
4576 |
+ |
4577 |
+ test_port_shadowing |
4578 |
++test_stateless_nat_ip |
4579 |
+ |
4580 |
+ if [ $ret -ne 0 ];then |
4581 |
+ echo -n "FAIL: " |