1 |
commit: a7ca4775ed7327b81ce2817711f77e28b0bcb732 |
2 |
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Oct 20 13:22:33 2021 +0000 |
4 |
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Oct 20 13:22:33 2021 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=a7ca4775 |
7 |
|
8 |
Linux patch 5.14.14 |
9 |
|
10 |
Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org> |
11 |
|
12 |
0000_README | 4 + |
13 |
1013_linux-5.14.14.patch | 4421 ++++++++++++++++++++++++++++++++++++++++++++++ |
14 |
2 files changed, 4425 insertions(+) |
15 |
|
16 |
diff --git a/0000_README b/0000_README |
17 |
index 31ed9a4..1bea116 100644 |
18 |
--- a/0000_README |
19 |
+++ b/0000_README |
20 |
@@ -99,6 +99,10 @@ Patch: 1012_linux-5.14.13.patch |
21 |
From: http://www.kernel.org |
22 |
Desc: Linux 5.14.13 |
23 |
|
24 |
+Patch: 1013_linux-5.14.14.patch |
25 |
+From: http://www.kernel.org |
26 |
+Desc: Linux 5.14.14 |
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/1013_linux-5.14.14.patch b/1013_linux-5.14.14.patch |
33 |
new file mode 100644 |
34 |
index 0000000..f4e20f8 |
35 |
--- /dev/null |
36 |
+++ b/1013_linux-5.14.14.patch |
37 |
@@ -0,0 +1,4421 @@ |
38 |
+diff --git a/Makefile b/Makefile |
39 |
+index 7bdca9dc0e61b..f05668e1ffaba 100644 |
40 |
+--- a/Makefile |
41 |
++++ b/Makefile |
42 |
+@@ -1,7 +1,7 @@ |
43 |
+ # SPDX-License-Identifier: GPL-2.0 |
44 |
+ VERSION = 5 |
45 |
+ PATCHLEVEL = 14 |
46 |
+-SUBLEVEL = 13 |
47 |
++SUBLEVEL = 14 |
48 |
+ EXTRAVERSION = |
49 |
+ NAME = Opossums on Parade |
50 |
+ |
51 |
+diff --git a/arch/arm/boot/dts/bcm2711-rpi-4-b.dts b/arch/arm/boot/dts/bcm2711-rpi-4-b.dts |
52 |
+index f24bdd0870a52..72ce80fbf2662 100644 |
53 |
+--- a/arch/arm/boot/dts/bcm2711-rpi-4-b.dts |
54 |
++++ b/arch/arm/boot/dts/bcm2711-rpi-4-b.dts |
55 |
+@@ -40,8 +40,8 @@ |
56 |
+ regulator-always-on; |
57 |
+ regulator-settling-time-us = <5000>; |
58 |
+ gpios = <&expgpio 4 GPIO_ACTIVE_HIGH>; |
59 |
+- states = <1800000 0x1 |
60 |
+- 3300000 0x0>; |
61 |
++ states = <1800000 0x1>, |
62 |
++ <3300000 0x0>; |
63 |
+ status = "okay"; |
64 |
+ }; |
65 |
+ |
66 |
+@@ -217,15 +217,16 @@ |
67 |
+ }; |
68 |
+ |
69 |
+ &pcie0 { |
70 |
+- pci@1,0 { |
71 |
++ pci@0,0 { |
72 |
++ device_type = "pci"; |
73 |
+ #address-cells = <3>; |
74 |
+ #size-cells = <2>; |
75 |
+ ranges; |
76 |
+ |
77 |
+ reg = <0 0 0 0 0>; |
78 |
+ |
79 |
+- usb@1,0 { |
80 |
+- reg = <0x10000 0 0 0 0>; |
81 |
++ usb@0,0 { |
82 |
++ reg = <0 0 0 0 0>; |
83 |
+ resets = <&reset RASPBERRYPI_FIRMWARE_RESET_ID_USB>; |
84 |
+ }; |
85 |
+ }; |
86 |
+diff --git a/arch/arm/boot/dts/bcm2711.dtsi b/arch/arm/boot/dts/bcm2711.dtsi |
87 |
+index b8a4096192aa9..3b60297af7f60 100644 |
88 |
+--- a/arch/arm/boot/dts/bcm2711.dtsi |
89 |
++++ b/arch/arm/boot/dts/bcm2711.dtsi |
90 |
+@@ -300,6 +300,14 @@ |
91 |
+ status = "disabled"; |
92 |
+ }; |
93 |
+ |
94 |
++ vec: vec@7ec13000 { |
95 |
++ compatible = "brcm,bcm2711-vec"; |
96 |
++ reg = <0x7ec13000 0x1000>; |
97 |
++ clocks = <&clocks BCM2835_CLOCK_VEC>; |
98 |
++ interrupts = <GIC_SPI 123 IRQ_TYPE_LEVEL_HIGH>; |
99 |
++ status = "disabled"; |
100 |
++ }; |
101 |
++ |
102 |
+ dvp: clock@7ef00000 { |
103 |
+ compatible = "brcm,brcm2711-dvp"; |
104 |
+ reg = <0x7ef00000 0x10>; |
105 |
+@@ -532,8 +540,8 @@ |
106 |
+ compatible = "brcm,genet-mdio-v5"; |
107 |
+ reg = <0xe14 0x8>; |
108 |
+ reg-names = "mdio"; |
109 |
+- #address-cells = <0x0>; |
110 |
+- #size-cells = <0x1>; |
111 |
++ #address-cells = <0x1>; |
112 |
++ #size-cells = <0x0>; |
113 |
+ }; |
114 |
+ }; |
115 |
+ }; |
116 |
+diff --git a/arch/arm/boot/dts/bcm2835-common.dtsi b/arch/arm/boot/dts/bcm2835-common.dtsi |
117 |
+index 4119271c979d6..c25e797b90600 100644 |
118 |
+--- a/arch/arm/boot/dts/bcm2835-common.dtsi |
119 |
++++ b/arch/arm/boot/dts/bcm2835-common.dtsi |
120 |
+@@ -106,6 +106,14 @@ |
121 |
+ status = "okay"; |
122 |
+ }; |
123 |
+ |
124 |
++ vec: vec@7e806000 { |
125 |
++ compatible = "brcm,bcm2835-vec"; |
126 |
++ reg = <0x7e806000 0x1000>; |
127 |
++ clocks = <&clocks BCM2835_CLOCK_VEC>; |
128 |
++ interrupts = <2 27>; |
129 |
++ status = "disabled"; |
130 |
++ }; |
131 |
++ |
132 |
+ pixelvalve@7e807000 { |
133 |
+ compatible = "brcm,bcm2835-pixelvalve2"; |
134 |
+ reg = <0x7e807000 0x100>; |
135 |
+diff --git a/arch/arm/boot/dts/bcm283x.dtsi b/arch/arm/boot/dts/bcm283x.dtsi |
136 |
+index 0f3be55201a5b..a3e06b6809476 100644 |
137 |
+--- a/arch/arm/boot/dts/bcm283x.dtsi |
138 |
++++ b/arch/arm/boot/dts/bcm283x.dtsi |
139 |
+@@ -464,14 +464,6 @@ |
140 |
+ status = "disabled"; |
141 |
+ }; |
142 |
+ |
143 |
+- vec: vec@7e806000 { |
144 |
+- compatible = "brcm,bcm2835-vec"; |
145 |
+- reg = <0x7e806000 0x1000>; |
146 |
+- clocks = <&clocks BCM2835_CLOCK_VEC>; |
147 |
+- interrupts = <2 27>; |
148 |
+- status = "disabled"; |
149 |
+- }; |
150 |
+- |
151 |
+ usb: usb@7e980000 { |
152 |
+ compatible = "brcm,bcm2835-usb"; |
153 |
+ reg = <0x7e980000 0x10000>; |
154 |
+diff --git a/arch/arm64/mm/hugetlbpage.c b/arch/arm64/mm/hugetlbpage.c |
155 |
+index 23505fc353247..a8158c9489666 100644 |
156 |
+--- a/arch/arm64/mm/hugetlbpage.c |
157 |
++++ b/arch/arm64/mm/hugetlbpage.c |
158 |
+@@ -43,7 +43,7 @@ void __init arm64_hugetlb_cma_reserve(void) |
159 |
+ #ifdef CONFIG_ARM64_4K_PAGES |
160 |
+ order = PUD_SHIFT - PAGE_SHIFT; |
161 |
+ #else |
162 |
+- order = CONT_PMD_SHIFT + PMD_SHIFT - PAGE_SHIFT; |
163 |
++ order = CONT_PMD_SHIFT - PAGE_SHIFT; |
164 |
+ #endif |
165 |
+ /* |
166 |
+ * HugeTLB CMA reservation is required for gigantic |
167 |
+diff --git a/arch/csky/kernel/ptrace.c b/arch/csky/kernel/ptrace.c |
168 |
+index 0105ac81b4328..1a5f54e0d2726 100644 |
169 |
+--- a/arch/csky/kernel/ptrace.c |
170 |
++++ b/arch/csky/kernel/ptrace.c |
171 |
+@@ -99,7 +99,8 @@ static int gpr_set(struct task_struct *target, |
172 |
+ if (ret) |
173 |
+ return ret; |
174 |
+ |
175 |
+- regs.sr = task_pt_regs(target)->sr; |
176 |
++ /* BIT(0) of regs.sr is Condition Code/Carry bit */ |
177 |
++ regs.sr = (regs.sr & BIT(0)) | (task_pt_regs(target)->sr & ~BIT(0)); |
178 |
+ #ifdef CONFIG_CPU_HAS_HILO |
179 |
+ regs.dcsr = task_pt_regs(target)->dcsr; |
180 |
+ #endif |
181 |
+diff --git a/arch/csky/kernel/signal.c b/arch/csky/kernel/signal.c |
182 |
+index 312f046d452d8..6ba3969ec175e 100644 |
183 |
+--- a/arch/csky/kernel/signal.c |
184 |
++++ b/arch/csky/kernel/signal.c |
185 |
+@@ -52,10 +52,14 @@ static long restore_sigcontext(struct pt_regs *regs, |
186 |
+ struct sigcontext __user *sc) |
187 |
+ { |
188 |
+ int err = 0; |
189 |
++ unsigned long sr = regs->sr; |
190 |
+ |
191 |
+ /* sc_pt_regs is structured the same as the start of pt_regs */ |
192 |
+ err |= __copy_from_user(regs, &sc->sc_pt_regs, sizeof(struct pt_regs)); |
193 |
+ |
194 |
++ /* BIT(0) of regs->sr is Condition Code/Carry bit */ |
195 |
++ regs->sr = (sr & ~1) | (regs->sr & 1); |
196 |
++ |
197 |
+ /* Restore the floating-point state. */ |
198 |
+ err |= restore_fpu_state(sc); |
199 |
+ |
200 |
+diff --git a/arch/powerpc/sysdev/xive/common.c b/arch/powerpc/sysdev/xive/common.c |
201 |
+index 8183ca343675a..1d2546ac6fbc3 100644 |
202 |
+--- a/arch/powerpc/sysdev/xive/common.c |
203 |
++++ b/arch/powerpc/sysdev/xive/common.c |
204 |
+@@ -961,7 +961,8 @@ static int xive_get_irqchip_state(struct irq_data *data, |
205 |
+ * interrupt to be inactive in that case. |
206 |
+ */ |
207 |
+ *state = (pq != XIVE_ESB_INVALID) && !xd->stale_p && |
208 |
+- (xd->saved_p || !!(pq & XIVE_ESB_VAL_P)); |
209 |
++ (xd->saved_p || (!!(pq & XIVE_ESB_VAL_P) && |
210 |
++ !irqd_irq_disabled(data))); |
211 |
+ return 0; |
212 |
+ default: |
213 |
+ return -EINVAL; |
214 |
+diff --git a/arch/s390/lib/string.c b/arch/s390/lib/string.c |
215 |
+index cfcdf76d6a957..a95ca6df4e5e6 100644 |
216 |
+--- a/arch/s390/lib/string.c |
217 |
++++ b/arch/s390/lib/string.c |
218 |
+@@ -259,14 +259,13 @@ EXPORT_SYMBOL(strcmp); |
219 |
+ #ifdef __HAVE_ARCH_STRRCHR |
220 |
+ char *strrchr(const char *s, int c) |
221 |
+ { |
222 |
+- size_t len = __strend(s) - s; |
223 |
+- |
224 |
+- if (len) |
225 |
+- do { |
226 |
+- if (s[len] == (char) c) |
227 |
+- return (char *) s + len; |
228 |
+- } while (--len > 0); |
229 |
+- return NULL; |
230 |
++ ssize_t len = __strend(s) - s; |
231 |
++ |
232 |
++ do { |
233 |
++ if (s[len] == (char)c) |
234 |
++ return (char *)s + len; |
235 |
++ } while (--len >= 0); |
236 |
++ return NULL; |
237 |
+ } |
238 |
+ EXPORT_SYMBOL(strrchr); |
239 |
+ #endif |
240 |
+diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig |
241 |
+index 51341f2e218de..551eaab376f31 100644 |
242 |
+--- a/arch/x86/Kconfig |
243 |
++++ b/arch/x86/Kconfig |
244 |
+@@ -1520,7 +1520,6 @@ config AMD_MEM_ENCRYPT |
245 |
+ |
246 |
+ config AMD_MEM_ENCRYPT_ACTIVE_BY_DEFAULT |
247 |
+ bool "Activate AMD Secure Memory Encryption (SME) by default" |
248 |
+- default y |
249 |
+ depends on AMD_MEM_ENCRYPT |
250 |
+ help |
251 |
+ Say yes to have system memory encrypted by default if running on |
252 |
+diff --git a/arch/x86/kernel/cpu/resctrl/core.c b/arch/x86/kernel/cpu/resctrl/core.c |
253 |
+index 23001ae03e82b..7afc2d72d8634 100644 |
254 |
+--- a/arch/x86/kernel/cpu/resctrl/core.c |
255 |
++++ b/arch/x86/kernel/cpu/resctrl/core.c |
256 |
+@@ -590,6 +590,8 @@ static void domain_add_cpu(int cpu, struct rdt_resource *r) |
257 |
+ } |
258 |
+ |
259 |
+ if (r->mon_capable && domain_setup_mon_state(r, d)) { |
260 |
++ kfree(d->ctrl_val); |
261 |
++ kfree(d->mbps_val); |
262 |
+ kfree(d); |
263 |
+ return; |
264 |
+ } |
265 |
+diff --git a/arch/x86/kernel/fpu/signal.c b/arch/x86/kernel/fpu/signal.c |
266 |
+index fa17a27390ab0..831b25c5e7058 100644 |
267 |
+--- a/arch/x86/kernel/fpu/signal.c |
268 |
++++ b/arch/x86/kernel/fpu/signal.c |
269 |
+@@ -385,7 +385,7 @@ static int __fpu_restore_sig(void __user *buf, void __user *buf_fx, |
270 |
+ return -EINVAL; |
271 |
+ } else { |
272 |
+ /* Mask invalid bits out for historical reasons (broken hardware). */ |
273 |
+- fpu->state.fxsave.mxcsr &= ~mxcsr_feature_mask; |
274 |
++ fpu->state.fxsave.mxcsr &= mxcsr_feature_mask; |
275 |
+ } |
276 |
+ |
277 |
+ /* Enforce XFEATURE_MASK_FPSSE when XSAVE is enabled */ |
278 |
+diff --git a/drivers/acpi/arm64/gtdt.c b/drivers/acpi/arm64/gtdt.c |
279 |
+index 0a0a982f9c28d..c0e77c1c8e09d 100644 |
280 |
+--- a/drivers/acpi/arm64/gtdt.c |
281 |
++++ b/drivers/acpi/arm64/gtdt.c |
282 |
+@@ -36,7 +36,7 @@ struct acpi_gtdt_descriptor { |
283 |
+ |
284 |
+ static struct acpi_gtdt_descriptor acpi_gtdt_desc __initdata; |
285 |
+ |
286 |
+-static inline void *next_platform_timer(void *platform_timer) |
287 |
++static inline __init void *next_platform_timer(void *platform_timer) |
288 |
+ { |
289 |
+ struct acpi_gtdt_header *gh = platform_timer; |
290 |
+ |
291 |
+diff --git a/drivers/acpi/x86/s2idle.c b/drivers/acpi/x86/s2idle.c |
292 |
+index bd92b549fd5a4..1c48358b43ba3 100644 |
293 |
+--- a/drivers/acpi/x86/s2idle.c |
294 |
++++ b/drivers/acpi/x86/s2idle.c |
295 |
+@@ -371,7 +371,7 @@ static int lps0_device_attach(struct acpi_device *adev, |
296 |
+ return 0; |
297 |
+ |
298 |
+ if (acpi_s2idle_vendor_amd()) { |
299 |
+- /* AMD0004, AMDI0005: |
300 |
++ /* AMD0004, AMD0005, AMDI0005: |
301 |
+ * - Should use rev_id 0x0 |
302 |
+ * - function mask > 0x3: Should use AMD method, but has off by one bug |
303 |
+ * - function mask = 0x3: Should use Microsoft method |
304 |
+@@ -390,6 +390,7 @@ static int lps0_device_attach(struct acpi_device *adev, |
305 |
+ ACPI_LPS0_DSM_UUID_MICROSOFT, 0, |
306 |
+ &lps0_dsm_guid_microsoft); |
307 |
+ if (lps0_dsm_func_mask > 0x3 && (!strcmp(hid, "AMD0004") || |
308 |
++ !strcmp(hid, "AMD0005") || |
309 |
+ !strcmp(hid, "AMDI0005"))) { |
310 |
+ lps0_dsm_func_mask = (lps0_dsm_func_mask << 1) | 0x1; |
311 |
+ acpi_handle_debug(adev->handle, "_DSM UUID %s: Adjusted function mask: 0x%x\n", |
312 |
+diff --git a/drivers/ata/libahci_platform.c b/drivers/ata/libahci_platform.c |
313 |
+index b2f5520882918..0910441321f72 100644 |
314 |
+--- a/drivers/ata/libahci_platform.c |
315 |
++++ b/drivers/ata/libahci_platform.c |
316 |
+@@ -440,10 +440,7 @@ struct ahci_host_priv *ahci_platform_get_resources(struct platform_device *pdev, |
317 |
+ hpriv->phy_regulator = devm_regulator_get(dev, "phy"); |
318 |
+ if (IS_ERR(hpriv->phy_regulator)) { |
319 |
+ rc = PTR_ERR(hpriv->phy_regulator); |
320 |
+- if (rc == -EPROBE_DEFER) |
321 |
+- goto err_out; |
322 |
+- rc = 0; |
323 |
+- hpriv->phy_regulator = NULL; |
324 |
++ goto err_out; |
325 |
+ } |
326 |
+ |
327 |
+ if (flags & AHCI_PLATFORM_GET_RESETS) { |
328 |
+diff --git a/drivers/ata/pata_legacy.c b/drivers/ata/pata_legacy.c |
329 |
+index c3e6592712c4b..0a8bf09a5c19e 100644 |
330 |
+--- a/drivers/ata/pata_legacy.c |
331 |
++++ b/drivers/ata/pata_legacy.c |
332 |
+@@ -352,7 +352,8 @@ static unsigned int pdc_data_xfer_vlb(struct ata_queued_cmd *qc, |
333 |
+ iowrite32_rep(ap->ioaddr.data_addr, buf, buflen >> 2); |
334 |
+ |
335 |
+ if (unlikely(slop)) { |
336 |
+- __le32 pad; |
337 |
++ __le32 pad = 0; |
338 |
++ |
339 |
+ if (rw == READ) { |
340 |
+ pad = cpu_to_le32(ioread32(ap->ioaddr.data_addr)); |
341 |
+ memcpy(buf + buflen - slop, &pad, slop); |
342 |
+@@ -742,7 +743,8 @@ static unsigned int vlb32_data_xfer(struct ata_queued_cmd *qc, |
343 |
+ ioread32_rep(ap->ioaddr.data_addr, buf, buflen >> 2); |
344 |
+ |
345 |
+ if (unlikely(slop)) { |
346 |
+- __le32 pad; |
347 |
++ __le32 pad = 0; |
348 |
++ |
349 |
+ if (rw == WRITE) { |
350 |
+ memcpy(&pad, buf + buflen - slop, slop); |
351 |
+ iowrite32(le32_to_cpu(pad), ap->ioaddr.data_addr); |
352 |
+diff --git a/drivers/base/core.c b/drivers/base/core.c |
353 |
+index 56f54e6eb9874..f150ebebb3068 100644 |
354 |
+--- a/drivers/base/core.c |
355 |
++++ b/drivers/base/core.c |
356 |
+@@ -675,7 +675,8 @@ struct device_link *device_link_add(struct device *consumer, |
357 |
+ { |
358 |
+ struct device_link *link; |
359 |
+ |
360 |
+- if (!consumer || !supplier || flags & ~DL_ADD_VALID_FLAGS || |
361 |
++ if (!consumer || !supplier || consumer == supplier || |
362 |
++ flags & ~DL_ADD_VALID_FLAGS || |
363 |
+ (flags & DL_FLAG_STATELESS && flags & DL_MANAGED_LINK_FLAGS) || |
364 |
+ (flags & DL_FLAG_SYNC_STATE_ONLY && |
365 |
+ (flags & ~DL_FLAG_INFERRED) != DL_FLAG_SYNC_STATE_ONLY) || |
366 |
+diff --git a/drivers/block/rnbd/rnbd-clt-sysfs.c b/drivers/block/rnbd/rnbd-clt-sysfs.c |
367 |
+index 324afdd63a967..102c08ad4dd06 100644 |
368 |
+--- a/drivers/block/rnbd/rnbd-clt-sysfs.c |
369 |
++++ b/drivers/block/rnbd/rnbd-clt-sysfs.c |
370 |
+@@ -71,8 +71,10 @@ static int rnbd_clt_parse_map_options(const char *buf, size_t max_path_cnt, |
371 |
+ int opt_mask = 0; |
372 |
+ int token; |
373 |
+ int ret = -EINVAL; |
374 |
+- int i, dest_port, nr_poll_queues; |
375 |
++ int nr_poll_queues = 0; |
376 |
++ int dest_port = 0; |
377 |
+ int p_cnt = 0; |
378 |
++ int i; |
379 |
+ |
380 |
+ options = kstrdup(buf, GFP_KERNEL); |
381 |
+ if (!options) |
382 |
+diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c |
383 |
+index afb37aac09e88..e870248d5c152 100644 |
384 |
+--- a/drivers/block/virtio_blk.c |
385 |
++++ b/drivers/block/virtio_blk.c |
386 |
+@@ -692,28 +692,6 @@ static const struct blk_mq_ops virtio_mq_ops = { |
387 |
+ static unsigned int virtblk_queue_depth; |
388 |
+ module_param_named(queue_depth, virtblk_queue_depth, uint, 0444); |
389 |
+ |
390 |
+-static int virtblk_validate(struct virtio_device *vdev) |
391 |
+-{ |
392 |
+- u32 blk_size; |
393 |
+- |
394 |
+- if (!vdev->config->get) { |
395 |
+- dev_err(&vdev->dev, "%s failure: config access disabled\n", |
396 |
+- __func__); |
397 |
+- return -EINVAL; |
398 |
+- } |
399 |
+- |
400 |
+- if (!virtio_has_feature(vdev, VIRTIO_BLK_F_BLK_SIZE)) |
401 |
+- return 0; |
402 |
+- |
403 |
+- blk_size = virtio_cread32(vdev, |
404 |
+- offsetof(struct virtio_blk_config, blk_size)); |
405 |
+- |
406 |
+- if (blk_size < SECTOR_SIZE || blk_size > PAGE_SIZE) |
407 |
+- __virtio_clear_bit(vdev, VIRTIO_BLK_F_BLK_SIZE); |
408 |
+- |
409 |
+- return 0; |
410 |
+-} |
411 |
+- |
412 |
+ static int virtblk_probe(struct virtio_device *vdev) |
413 |
+ { |
414 |
+ struct virtio_blk *vblk; |
415 |
+@@ -725,6 +703,12 @@ static int virtblk_probe(struct virtio_device *vdev) |
416 |
+ u8 physical_block_exp, alignment_offset; |
417 |
+ unsigned int queue_depth; |
418 |
+ |
419 |
++ if (!vdev->config->get) { |
420 |
++ dev_err(&vdev->dev, "%s failure: config access disabled\n", |
421 |
++ __func__); |
422 |
++ return -EINVAL; |
423 |
++ } |
424 |
++ |
425 |
+ err = ida_simple_get(&vd_index_ida, 0, minor_to_index(1 << MINORBITS), |
426 |
+ GFP_KERNEL); |
427 |
+ if (err < 0) |
428 |
+@@ -765,7 +749,7 @@ static int virtblk_probe(struct virtio_device *vdev) |
429 |
+ goto out_free_vblk; |
430 |
+ |
431 |
+ /* Default queue sizing is to fill the ring. */ |
432 |
+- if (likely(!virtblk_queue_depth)) { |
433 |
++ if (!virtblk_queue_depth) { |
434 |
+ queue_depth = vblk->vqs[0].vq->num_free; |
435 |
+ /* ... but without indirect descs, we use 2 descs per req */ |
436 |
+ if (!virtio_has_feature(vdev, VIRTIO_RING_F_INDIRECT_DESC)) |
437 |
+@@ -839,14 +823,6 @@ static int virtblk_probe(struct virtio_device *vdev) |
438 |
+ else |
439 |
+ blk_size = queue_logical_block_size(q); |
440 |
+ |
441 |
+- if (unlikely(blk_size < SECTOR_SIZE || blk_size > PAGE_SIZE)) { |
442 |
+- dev_err(&vdev->dev, |
443 |
+- "block size is changed unexpectedly, now is %u\n", |
444 |
+- blk_size); |
445 |
+- err = -EINVAL; |
446 |
+- goto err_cleanup_disk; |
447 |
+- } |
448 |
+- |
449 |
+ /* Use topology information if available */ |
450 |
+ err = virtio_cread_feature(vdev, VIRTIO_BLK_F_TOPOLOGY, |
451 |
+ struct virtio_blk_config, physical_block_exp, |
452 |
+@@ -905,8 +881,6 @@ static int virtblk_probe(struct virtio_device *vdev) |
453 |
+ device_add_disk(&vdev->dev, vblk->disk, virtblk_attr_groups); |
454 |
+ return 0; |
455 |
+ |
456 |
+-err_cleanup_disk: |
457 |
+- blk_cleanup_disk(vblk->disk); |
458 |
+ out_free_tags: |
459 |
+ blk_mq_free_tag_set(&vblk->tag_set); |
460 |
+ out_free_vq: |
461 |
+@@ -1009,7 +983,6 @@ static struct virtio_driver virtio_blk = { |
462 |
+ .driver.name = KBUILD_MODNAME, |
463 |
+ .driver.owner = THIS_MODULE, |
464 |
+ .id_table = id_table, |
465 |
+- .validate = virtblk_validate, |
466 |
+ .probe = virtblk_probe, |
467 |
+ .remove = virtblk_remove, |
468 |
+ .config_changed = virtblk_config_changed, |
469 |
+diff --git a/drivers/bus/simple-pm-bus.c b/drivers/bus/simple-pm-bus.c |
470 |
+index 01a3d0cd08edc..6b8d6257ed8a4 100644 |
471 |
+--- a/drivers/bus/simple-pm-bus.c |
472 |
++++ b/drivers/bus/simple-pm-bus.c |
473 |
+@@ -13,11 +13,36 @@ |
474 |
+ #include <linux/platform_device.h> |
475 |
+ #include <linux/pm_runtime.h> |
476 |
+ |
477 |
+- |
478 |
+ static int simple_pm_bus_probe(struct platform_device *pdev) |
479 |
+ { |
480 |
+- const struct of_dev_auxdata *lookup = dev_get_platdata(&pdev->dev); |
481 |
+- struct device_node *np = pdev->dev.of_node; |
482 |
++ const struct device *dev = &pdev->dev; |
483 |
++ const struct of_dev_auxdata *lookup = dev_get_platdata(dev); |
484 |
++ struct device_node *np = dev->of_node; |
485 |
++ const struct of_device_id *match; |
486 |
++ |
487 |
++ /* |
488 |
++ * Allow user to use driver_override to bind this driver to a |
489 |
++ * transparent bus device which has a different compatible string |
490 |
++ * that's not listed in simple_pm_bus_of_match. We don't want to do any |
491 |
++ * of the simple-pm-bus tasks for these devices, so return early. |
492 |
++ */ |
493 |
++ if (pdev->driver_override) |
494 |
++ return 0; |
495 |
++ |
496 |
++ match = of_match_device(dev->driver->of_match_table, dev); |
497 |
++ /* |
498 |
++ * These are transparent bus devices (not simple-pm-bus matches) that |
499 |
++ * have their child nodes populated automatically. So, don't need to |
500 |
++ * do anything more. We only match with the device if this driver is |
501 |
++ * the most specific match because we don't want to incorrectly bind to |
502 |
++ * a device that has a more specific driver. |
503 |
++ */ |
504 |
++ if (match && match->data) { |
505 |
++ if (of_property_match_string(np, "compatible", match->compatible) == 0) |
506 |
++ return 0; |
507 |
++ else |
508 |
++ return -ENODEV; |
509 |
++ } |
510 |
+ |
511 |
+ dev_dbg(&pdev->dev, "%s\n", __func__); |
512 |
+ |
513 |
+@@ -31,14 +56,25 @@ static int simple_pm_bus_probe(struct platform_device *pdev) |
514 |
+ |
515 |
+ static int simple_pm_bus_remove(struct platform_device *pdev) |
516 |
+ { |
517 |
++ const void *data = of_device_get_match_data(&pdev->dev); |
518 |
++ |
519 |
++ if (pdev->driver_override || data) |
520 |
++ return 0; |
521 |
++ |
522 |
+ dev_dbg(&pdev->dev, "%s\n", __func__); |
523 |
+ |
524 |
+ pm_runtime_disable(&pdev->dev); |
525 |
+ return 0; |
526 |
+ } |
527 |
+ |
528 |
++#define ONLY_BUS ((void *) 1) /* Match if the device is only a bus. */ |
529 |
++ |
530 |
+ static const struct of_device_id simple_pm_bus_of_match[] = { |
531 |
+ { .compatible = "simple-pm-bus", }, |
532 |
++ { .compatible = "simple-bus", .data = ONLY_BUS }, |
533 |
++ { .compatible = "simple-mfd", .data = ONLY_BUS }, |
534 |
++ { .compatible = "isa", .data = ONLY_BUS }, |
535 |
++ { .compatible = "arm,amba-bus", .data = ONLY_BUS }, |
536 |
+ { /* sentinel */ } |
537 |
+ }; |
538 |
+ MODULE_DEVICE_TABLE(of, simple_pm_bus_of_match); |
539 |
+diff --git a/drivers/clk/renesas/renesas-rzg2l-cpg.c b/drivers/clk/renesas/renesas-rzg2l-cpg.c |
540 |
+index f894a210de902..ab6149b2048b5 100644 |
541 |
+--- a/drivers/clk/renesas/renesas-rzg2l-cpg.c |
542 |
++++ b/drivers/clk/renesas/renesas-rzg2l-cpg.c |
543 |
+@@ -398,7 +398,7 @@ static int rzg2l_mod_clock_is_enabled(struct clk_hw *hw) |
544 |
+ |
545 |
+ value = readl(priv->base + CLK_MON_R(clock->off)); |
546 |
+ |
547 |
+- return !(value & bitmask); |
548 |
++ return value & bitmask; |
549 |
+ } |
550 |
+ |
551 |
+ static const struct clk_ops rzg2l_mod_clock_ops = { |
552 |
+diff --git a/drivers/clk/socfpga/clk-agilex.c b/drivers/clk/socfpga/clk-agilex.c |
553 |
+index 242e94c0cf8a3..bf8cd928c2283 100644 |
554 |
+--- a/drivers/clk/socfpga/clk-agilex.c |
555 |
++++ b/drivers/clk/socfpga/clk-agilex.c |
556 |
+@@ -165,13 +165,6 @@ static const struct clk_parent_data mpu_mux[] = { |
557 |
+ .name = "boot_clk", }, |
558 |
+ }; |
559 |
+ |
560 |
+-static const struct clk_parent_data s2f_usr0_mux[] = { |
561 |
+- { .fw_name = "f2s-free-clk", |
562 |
+- .name = "f2s-free-clk", }, |
563 |
+- { .fw_name = "boot_clk", |
564 |
+- .name = "boot_clk", }, |
565 |
+-}; |
566 |
+- |
567 |
+ static const struct clk_parent_data emac_mux[] = { |
568 |
+ { .fw_name = "emaca_free_clk", |
569 |
+ .name = "emaca_free_clk", }, |
570 |
+@@ -312,8 +305,6 @@ static const struct stratix10_gate_clock agilex_gate_clks[] = { |
571 |
+ 4, 0x44, 28, 1, 0, 0, 0}, |
572 |
+ { AGILEX_CS_TIMER_CLK, "cs_timer_clk", NULL, noc_mux, ARRAY_SIZE(noc_mux), 0, 0x24, |
573 |
+ 5, 0, 0, 0, 0x30, 1, 0}, |
574 |
+- { AGILEX_S2F_USER0_CLK, "s2f_user0_clk", NULL, s2f_usr0_mux, ARRAY_SIZE(s2f_usr0_mux), 0, 0x24, |
575 |
+- 6, 0, 0, 0, 0, 0, 0}, |
576 |
+ { AGILEX_EMAC0_CLK, "emac0_clk", NULL, emac_mux, ARRAY_SIZE(emac_mux), 0, 0x7C, |
577 |
+ 0, 0, 0, 0, 0x94, 26, 0}, |
578 |
+ { AGILEX_EMAC1_CLK, "emac1_clk", NULL, emac_mux, ARRAY_SIZE(emac_mux), 0, 0x7C, |
579 |
+diff --git a/drivers/edac/armada_xp_edac.c b/drivers/edac/armada_xp_edac.c |
580 |
+index e3e757513d1bc..b1f46a974b9e0 100644 |
581 |
+--- a/drivers/edac/armada_xp_edac.c |
582 |
++++ b/drivers/edac/armada_xp_edac.c |
583 |
+@@ -178,7 +178,7 @@ static void axp_mc_check(struct mem_ctl_info *mci) |
584 |
+ "details unavailable (multiple errors)"); |
585 |
+ if (cnt_dbe) |
586 |
+ edac_mc_handle_error(HW_EVENT_ERR_UNCORRECTED, mci, |
587 |
+- cnt_sbe, /* error count */ |
588 |
++ cnt_dbe, /* error count */ |
589 |
+ 0, 0, 0, /* pfn, offset, syndrome */ |
590 |
+ -1, -1, -1, /* top, mid, low layer */ |
591 |
+ mci->ctl_name, |
592 |
+diff --git a/drivers/firmware/arm_ffa/bus.c b/drivers/firmware/arm_ffa/bus.c |
593 |
+index 00fe595a5bc89..fca1e311ea6c7 100644 |
594 |
+--- a/drivers/firmware/arm_ffa/bus.c |
595 |
++++ b/drivers/firmware/arm_ffa/bus.c |
596 |
+@@ -49,6 +49,15 @@ static int ffa_device_probe(struct device *dev) |
597 |
+ return ffa_drv->probe(ffa_dev); |
598 |
+ } |
599 |
+ |
600 |
++static int ffa_device_remove(struct device *dev) |
601 |
++{ |
602 |
++ struct ffa_driver *ffa_drv = to_ffa_driver(dev->driver); |
603 |
++ |
604 |
++ ffa_drv->remove(to_ffa_dev(dev)); |
605 |
++ |
606 |
++ return 0; |
607 |
++} |
608 |
++ |
609 |
+ static int ffa_device_uevent(struct device *dev, struct kobj_uevent_env *env) |
610 |
+ { |
611 |
+ struct ffa_device *ffa_dev = to_ffa_dev(dev); |
612 |
+@@ -86,6 +95,7 @@ struct bus_type ffa_bus_type = { |
613 |
+ .name = "arm_ffa", |
614 |
+ .match = ffa_device_match, |
615 |
+ .probe = ffa_device_probe, |
616 |
++ .remove = ffa_device_remove, |
617 |
+ .uevent = ffa_device_uevent, |
618 |
+ .dev_groups = ffa_device_attributes_groups, |
619 |
+ }; |
620 |
+@@ -127,7 +137,7 @@ static void ffa_release_device(struct device *dev) |
621 |
+ |
622 |
+ static int __ffa_devices_unregister(struct device *dev, void *data) |
623 |
+ { |
624 |
+- ffa_release_device(dev); |
625 |
++ device_unregister(dev); |
626 |
+ |
627 |
+ return 0; |
628 |
+ } |
629 |
+diff --git a/drivers/firmware/efi/cper.c b/drivers/firmware/efi/cper.c |
630 |
+index ea7ca74fc1730..232c092c4c970 100644 |
631 |
+--- a/drivers/firmware/efi/cper.c |
632 |
++++ b/drivers/firmware/efi/cper.c |
633 |
+@@ -25,8 +25,6 @@ |
634 |
+ #include <acpi/ghes.h> |
635 |
+ #include <ras/ras_event.h> |
636 |
+ |
637 |
+-static char rcd_decode_str[CPER_REC_LEN]; |
638 |
+- |
639 |
+ /* |
640 |
+ * CPER record ID need to be unique even after reboot, because record |
641 |
+ * ID is used as index for ERST storage, while CPER records from |
642 |
+@@ -313,6 +311,7 @@ const char *cper_mem_err_unpack(struct trace_seq *p, |
643 |
+ struct cper_mem_err_compact *cmem) |
644 |
+ { |
645 |
+ const char *ret = trace_seq_buffer_ptr(p); |
646 |
++ char rcd_decode_str[CPER_REC_LEN]; |
647 |
+ |
648 |
+ if (cper_mem_err_location(cmem, rcd_decode_str)) |
649 |
+ trace_seq_printf(p, "%s", rcd_decode_str); |
650 |
+@@ -327,6 +326,7 @@ static void cper_print_mem(const char *pfx, const struct cper_sec_mem_err *mem, |
651 |
+ int len) |
652 |
+ { |
653 |
+ struct cper_mem_err_compact cmem; |
654 |
++ char rcd_decode_str[CPER_REC_LEN]; |
655 |
+ |
656 |
+ /* Don't trust UEFI 2.1/2.2 structure with bad validation bits */ |
657 |
+ if (len == sizeof(struct cper_sec_mem_err_old) && |
658 |
+diff --git a/drivers/firmware/efi/runtime-wrappers.c b/drivers/firmware/efi/runtime-wrappers.c |
659 |
+index 1410beaef5c30..f3e54f6616f02 100644 |
660 |
+--- a/drivers/firmware/efi/runtime-wrappers.c |
661 |
++++ b/drivers/firmware/efi/runtime-wrappers.c |
662 |
+@@ -414,7 +414,7 @@ static void virt_efi_reset_system(int reset_type, |
663 |
+ unsigned long data_size, |
664 |
+ efi_char16_t *data) |
665 |
+ { |
666 |
+- if (down_interruptible(&efi_runtime_lock)) { |
667 |
++ if (down_trylock(&efi_runtime_lock)) { |
668 |
+ pr_warn("failed to invoke the reset_system() runtime service:\n" |
669 |
+ "could not get exclusive access to the firmware\n"); |
670 |
+ return; |
671 |
+diff --git a/drivers/fpga/ice40-spi.c b/drivers/fpga/ice40-spi.c |
672 |
+index 69dec5af23c36..029d3cdb918d1 100644 |
673 |
+--- a/drivers/fpga/ice40-spi.c |
674 |
++++ b/drivers/fpga/ice40-spi.c |
675 |
+@@ -192,12 +192,19 @@ static const struct of_device_id ice40_fpga_of_match[] = { |
676 |
+ }; |
677 |
+ MODULE_DEVICE_TABLE(of, ice40_fpga_of_match); |
678 |
+ |
679 |
++static const struct spi_device_id ice40_fpga_spi_ids[] = { |
680 |
++ { .name = "ice40-fpga-mgr", }, |
681 |
++ {}, |
682 |
++}; |
683 |
++MODULE_DEVICE_TABLE(spi, ice40_fpga_spi_ids); |
684 |
++ |
685 |
+ static struct spi_driver ice40_fpga_driver = { |
686 |
+ .probe = ice40_fpga_probe, |
687 |
+ .driver = { |
688 |
+ .name = "ice40spi", |
689 |
+ .of_match_table = of_match_ptr(ice40_fpga_of_match), |
690 |
+ }, |
691 |
++ .id_table = ice40_fpga_spi_ids, |
692 |
+ }; |
693 |
+ |
694 |
+ module_spi_driver(ice40_fpga_driver); |
695 |
+diff --git a/drivers/gpio/gpio-74x164.c b/drivers/gpio/gpio-74x164.c |
696 |
+index 05637d5851526..4a55cdf089d62 100644 |
697 |
+--- a/drivers/gpio/gpio-74x164.c |
698 |
++++ b/drivers/gpio/gpio-74x164.c |
699 |
+@@ -174,6 +174,13 @@ static int gen_74x164_remove(struct spi_device *spi) |
700 |
+ return 0; |
701 |
+ } |
702 |
+ |
703 |
++static const struct spi_device_id gen_74x164_spi_ids[] = { |
704 |
++ { .name = "74hc595" }, |
705 |
++ { .name = "74lvc594" }, |
706 |
++ {}, |
707 |
++}; |
708 |
++MODULE_DEVICE_TABLE(spi, gen_74x164_spi_ids); |
709 |
++ |
710 |
+ static const struct of_device_id gen_74x164_dt_ids[] = { |
711 |
+ { .compatible = "fairchild,74hc595" }, |
712 |
+ { .compatible = "nxp,74lvc594" }, |
713 |
+@@ -188,6 +195,7 @@ static struct spi_driver gen_74x164_driver = { |
714 |
+ }, |
715 |
+ .probe = gen_74x164_probe, |
716 |
+ .remove = gen_74x164_remove, |
717 |
++ .id_table = gen_74x164_spi_ids, |
718 |
+ }; |
719 |
+ module_spi_driver(gen_74x164_driver); |
720 |
+ |
721 |
+diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c |
722 |
+index 8ebf369b3ba0f..d2fe76f3f34fd 100644 |
723 |
+--- a/drivers/gpio/gpio-pca953x.c |
724 |
++++ b/drivers/gpio/gpio-pca953x.c |
725 |
+@@ -559,21 +559,21 @@ static int pca953x_gpio_set_pull_up_down(struct pca953x_chip *chip, |
726 |
+ |
727 |
+ mutex_lock(&chip->i2c_lock); |
728 |
+ |
729 |
+- /* Disable pull-up/pull-down */ |
730 |
+- ret = regmap_write_bits(chip->regmap, pull_en_reg, bit, 0); |
731 |
+- if (ret) |
732 |
+- goto exit; |
733 |
+- |
734 |
+ /* Configure pull-up/pull-down */ |
735 |
+ if (config == PIN_CONFIG_BIAS_PULL_UP) |
736 |
+ ret = regmap_write_bits(chip->regmap, pull_sel_reg, bit, bit); |
737 |
+ else if (config == PIN_CONFIG_BIAS_PULL_DOWN) |
738 |
+ ret = regmap_write_bits(chip->regmap, pull_sel_reg, bit, 0); |
739 |
++ else |
740 |
++ ret = 0; |
741 |
+ if (ret) |
742 |
+ goto exit; |
743 |
+ |
744 |
+- /* Enable pull-up/pull-down */ |
745 |
+- ret = regmap_write_bits(chip->regmap, pull_en_reg, bit, bit); |
746 |
++ /* Disable/Enable pull-up/pull-down */ |
747 |
++ if (config == PIN_CONFIG_BIAS_DISABLE) |
748 |
++ ret = regmap_write_bits(chip->regmap, pull_en_reg, bit, 0); |
749 |
++ else |
750 |
++ ret = regmap_write_bits(chip->regmap, pull_en_reg, bit, bit); |
751 |
+ |
752 |
+ exit: |
753 |
+ mutex_unlock(&chip->i2c_lock); |
754 |
+@@ -587,7 +587,9 @@ static int pca953x_gpio_set_config(struct gpio_chip *gc, unsigned int offset, |
755 |
+ |
756 |
+ switch (pinconf_to_config_param(config)) { |
757 |
+ case PIN_CONFIG_BIAS_PULL_UP: |
758 |
++ case PIN_CONFIG_BIAS_PULL_PIN_DEFAULT: |
759 |
+ case PIN_CONFIG_BIAS_PULL_DOWN: |
760 |
++ case PIN_CONFIG_BIAS_DISABLE: |
761 |
+ return pca953x_gpio_set_pull_up_down(chip, offset, config); |
762 |
+ default: |
763 |
+ return -ENOTSUPP; |
764 |
+diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c |
765 |
+index 81d5f25242469..1dfb2efac6c25 100644 |
766 |
+--- a/drivers/gpu/drm/drm_edid.c |
767 |
++++ b/drivers/gpu/drm/drm_edid.c |
768 |
+@@ -1834,11 +1834,20 @@ static void connector_bad_edid(struct drm_connector *connector, |
769 |
+ u8 *edid, int num_blocks) |
770 |
+ { |
771 |
+ int i; |
772 |
+- u8 num_of_ext = edid[0x7e]; |
773 |
++ u8 last_block; |
774 |
++ |
775 |
++ /* |
776 |
++ * 0x7e in the EDID is the number of extension blocks. The EDID |
777 |
++ * is 1 (base block) + num_ext_blocks big. That means we can think |
778 |
++ * of 0x7e in the EDID of the _index_ of the last block in the |
779 |
++ * combined chunk of memory. |
780 |
++ */ |
781 |
++ last_block = edid[0x7e]; |
782 |
+ |
783 |
+ /* Calculate real checksum for the last edid extension block data */ |
784 |
+- connector->real_edid_checksum = |
785 |
+- drm_edid_block_checksum(edid + num_of_ext * EDID_LENGTH); |
786 |
++ if (last_block < num_blocks) |
787 |
++ connector->real_edid_checksum = |
788 |
++ drm_edid_block_checksum(edid + last_block * EDID_LENGTH); |
789 |
+ |
790 |
+ if (connector->bad_edid_counter++ && !drm_debug_enabled(DRM_UT_KMS)) |
791 |
+ return; |
792 |
+diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c |
793 |
+index d77a24507d309..c2257a761e38e 100644 |
794 |
+--- a/drivers/gpu/drm/drm_fb_helper.c |
795 |
++++ b/drivers/gpu/drm/drm_fb_helper.c |
796 |
+@@ -1506,6 +1506,7 @@ static int drm_fb_helper_single_fb_probe(struct drm_fb_helper *fb_helper, |
797 |
+ { |
798 |
+ struct drm_client_dev *client = &fb_helper->client; |
799 |
+ struct drm_device *dev = fb_helper->dev; |
800 |
++ struct drm_mode_config *config = &dev->mode_config; |
801 |
+ int ret = 0; |
802 |
+ int crtc_count = 0; |
803 |
+ struct drm_connector_list_iter conn_iter; |
804 |
+@@ -1663,6 +1664,11 @@ static int drm_fb_helper_single_fb_probe(struct drm_fb_helper *fb_helper, |
805 |
+ /* Handle our overallocation */ |
806 |
+ sizes.surface_height *= drm_fbdev_overalloc; |
807 |
+ sizes.surface_height /= 100; |
808 |
++ if (sizes.surface_height > config->max_height) { |
809 |
++ drm_dbg_kms(dev, "Fbdev over-allocation too large; clamping height to %d\n", |
810 |
++ config->max_height); |
811 |
++ sizes.surface_height = config->max_height; |
812 |
++ } |
813 |
+ |
814 |
+ /* push down into drivers */ |
815 |
+ ret = (*fb_helper->funcs->fb_probe)(fb_helper, &sizes); |
816 |
+diff --git a/drivers/gpu/drm/msm/adreno/a3xx_gpu.c b/drivers/gpu/drm/msm/adreno/a3xx_gpu.c |
817 |
+index 4534633fe7cdb..8fb847c174ff8 100644 |
818 |
+--- a/drivers/gpu/drm/msm/adreno/a3xx_gpu.c |
819 |
++++ b/drivers/gpu/drm/msm/adreno/a3xx_gpu.c |
820 |
+@@ -571,13 +571,14 @@ struct msm_gpu *a3xx_gpu_init(struct drm_device *dev) |
821 |
+ } |
822 |
+ |
823 |
+ icc_path = devm_of_icc_get(&pdev->dev, "gfx-mem"); |
824 |
+- ret = IS_ERR(icc_path); |
825 |
+- if (ret) |
826 |
++ if (IS_ERR(icc_path)) { |
827 |
++ ret = PTR_ERR(icc_path); |
828 |
+ goto fail; |
829 |
++ } |
830 |
+ |
831 |
+ ocmem_icc_path = devm_of_icc_get(&pdev->dev, "ocmem"); |
832 |
+- ret = IS_ERR(ocmem_icc_path); |
833 |
+- if (ret) { |
834 |
++ if (IS_ERR(ocmem_icc_path)) { |
835 |
++ ret = PTR_ERR(ocmem_icc_path); |
836 |
+ /* allow -ENODATA, ocmem icc is optional */ |
837 |
+ if (ret != -ENODATA) |
838 |
+ goto fail; |
839 |
+diff --git a/drivers/gpu/drm/msm/adreno/a4xx_gpu.c b/drivers/gpu/drm/msm/adreno/a4xx_gpu.c |
840 |
+index 82bebb40234de..a96ee79cc5e08 100644 |
841 |
+--- a/drivers/gpu/drm/msm/adreno/a4xx_gpu.c |
842 |
++++ b/drivers/gpu/drm/msm/adreno/a4xx_gpu.c |
843 |
+@@ -699,13 +699,14 @@ struct msm_gpu *a4xx_gpu_init(struct drm_device *dev) |
844 |
+ } |
845 |
+ |
846 |
+ icc_path = devm_of_icc_get(&pdev->dev, "gfx-mem"); |
847 |
+- ret = IS_ERR(icc_path); |
848 |
+- if (ret) |
849 |
++ if (IS_ERR(icc_path)) { |
850 |
++ ret = PTR_ERR(icc_path); |
851 |
+ goto fail; |
852 |
++ } |
853 |
+ |
854 |
+ ocmem_icc_path = devm_of_icc_get(&pdev->dev, "ocmem"); |
855 |
+- ret = IS_ERR(ocmem_icc_path); |
856 |
+- if (ret) { |
857 |
++ if (IS_ERR(ocmem_icc_path)) { |
858 |
++ ret = PTR_ERR(ocmem_icc_path); |
859 |
+ /* allow -ENODATA, ocmem icc is optional */ |
860 |
+ if (ret != -ENODATA) |
861 |
+ goto fail; |
862 |
+diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c |
863 |
+index 183b9f9c1b315..1b3519b821a3f 100644 |
864 |
+--- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c |
865 |
++++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c |
866 |
+@@ -102,7 +102,7 @@ static void a6xx_set_pagetable(struct a6xx_gpu *a6xx_gpu, |
867 |
+ u32 asid; |
868 |
+ u64 memptr = rbmemptr(ring, ttbr0); |
869 |
+ |
870 |
+- if (ctx == a6xx_gpu->cur_ctx) |
871 |
++ if (ctx->seqno == a6xx_gpu->cur_ctx_seqno) |
872 |
+ return; |
873 |
+ |
874 |
+ if (msm_iommu_pagetable_params(ctx->aspace->mmu, &ttbr, &asid)) |
875 |
+@@ -135,7 +135,7 @@ static void a6xx_set_pagetable(struct a6xx_gpu *a6xx_gpu, |
876 |
+ OUT_PKT7(ring, CP_EVENT_WRITE, 1); |
877 |
+ OUT_RING(ring, 0x31); |
878 |
+ |
879 |
+- a6xx_gpu->cur_ctx = ctx; |
880 |
++ a6xx_gpu->cur_ctx_seqno = ctx->seqno; |
881 |
+ } |
882 |
+ |
883 |
+ static void a6xx_submit(struct msm_gpu *gpu, struct msm_gem_submit *submit) |
884 |
+@@ -1053,7 +1053,7 @@ static int a6xx_hw_init(struct msm_gpu *gpu) |
885 |
+ /* Always come up on rb 0 */ |
886 |
+ a6xx_gpu->cur_ring = gpu->rb[0]; |
887 |
+ |
888 |
+- a6xx_gpu->cur_ctx = NULL; |
889 |
++ a6xx_gpu->cur_ctx_seqno = 0; |
890 |
+ |
891 |
+ /* Enable the SQE_to start the CP engine */ |
892 |
+ gpu_write(gpu, REG_A6XX_CP_SQE_CNTL, 1); |
893 |
+diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu.h b/drivers/gpu/drm/msm/adreno/a6xx_gpu.h |
894 |
+index 0bc2d062f54ab..8e5527c881b1e 100644 |
895 |
+--- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.h |
896 |
++++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.h |
897 |
+@@ -19,7 +19,16 @@ struct a6xx_gpu { |
898 |
+ uint64_t sqe_iova; |
899 |
+ |
900 |
+ struct msm_ringbuffer *cur_ring; |
901 |
+- struct msm_file_private *cur_ctx; |
902 |
++ |
903 |
++ /** |
904 |
++ * cur_ctx_seqno: |
905 |
++ * |
906 |
++ * The ctx->seqno value of the context with current pgtables |
907 |
++ * installed. Tracked by seqno rather than pointer value to |
908 |
++ * avoid dangling pointers, and cases where a ctx can be freed |
909 |
++ * and a new one created with the same address. |
910 |
++ */ |
911 |
++ int cur_ctx_seqno; |
912 |
+ |
913 |
+ struct a6xx_gmu gmu; |
914 |
+ |
915 |
+diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c |
916 |
+index f482e0911d039..bb7d066618e64 100644 |
917 |
+--- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c |
918 |
++++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c |
919 |
+@@ -1125,6 +1125,20 @@ static void mdp5_crtc_reset(struct drm_crtc *crtc) |
920 |
+ __drm_atomic_helper_crtc_reset(crtc, &mdp5_cstate->base); |
921 |
+ } |
922 |
+ |
923 |
++static const struct drm_crtc_funcs mdp5_crtc_no_lm_cursor_funcs = { |
924 |
++ .set_config = drm_atomic_helper_set_config, |
925 |
++ .destroy = mdp5_crtc_destroy, |
926 |
++ .page_flip = drm_atomic_helper_page_flip, |
927 |
++ .reset = mdp5_crtc_reset, |
928 |
++ .atomic_duplicate_state = mdp5_crtc_duplicate_state, |
929 |
++ .atomic_destroy_state = mdp5_crtc_destroy_state, |
930 |
++ .atomic_print_state = mdp5_crtc_atomic_print_state, |
931 |
++ .get_vblank_counter = mdp5_crtc_get_vblank_counter, |
932 |
++ .enable_vblank = msm_crtc_enable_vblank, |
933 |
++ .disable_vblank = msm_crtc_disable_vblank, |
934 |
++ .get_vblank_timestamp = drm_crtc_vblank_helper_get_vblank_timestamp, |
935 |
++}; |
936 |
++ |
937 |
+ static const struct drm_crtc_funcs mdp5_crtc_funcs = { |
938 |
+ .set_config = drm_atomic_helper_set_config, |
939 |
+ .destroy = mdp5_crtc_destroy, |
940 |
+@@ -1313,6 +1327,8 @@ struct drm_crtc *mdp5_crtc_init(struct drm_device *dev, |
941 |
+ mdp5_crtc->lm_cursor_enabled = cursor_plane ? false : true; |
942 |
+ |
943 |
+ drm_crtc_init_with_planes(dev, crtc, plane, cursor_plane, |
944 |
++ cursor_plane ? |
945 |
++ &mdp5_crtc_no_lm_cursor_funcs : |
946 |
+ &mdp5_crtc_funcs, NULL); |
947 |
+ |
948 |
+ drm_flip_work_init(&mdp5_crtc->unref_cursor_work, |
949 |
+diff --git a/drivers/gpu/drm/msm/dsi/dsi.c b/drivers/gpu/drm/msm/dsi/dsi.c |
950 |
+index 29d11f1cb79b0..4ccf27f66d025 100644 |
951 |
+--- a/drivers/gpu/drm/msm/dsi/dsi.c |
952 |
++++ b/drivers/gpu/drm/msm/dsi/dsi.c |
953 |
+@@ -208,8 +208,10 @@ int msm_dsi_modeset_init(struct msm_dsi *msm_dsi, struct drm_device *dev, |
954 |
+ goto fail; |
955 |
+ } |
956 |
+ |
957 |
+- if (!msm_dsi_manager_validate_current_config(msm_dsi->id)) |
958 |
++ if (!msm_dsi_manager_validate_current_config(msm_dsi->id)) { |
959 |
++ ret = -EINVAL; |
960 |
+ goto fail; |
961 |
++ } |
962 |
+ |
963 |
+ msm_dsi->encoder = encoder; |
964 |
+ |
965 |
+diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/dsi_host.c |
966 |
+index ed504fe5074f6..52826ba350af7 100644 |
967 |
+--- a/drivers/gpu/drm/msm/dsi/dsi_host.c |
968 |
++++ b/drivers/gpu/drm/msm/dsi/dsi_host.c |
969 |
+@@ -463,7 +463,7 @@ static int dsi_bus_clk_enable(struct msm_dsi_host *msm_host) |
970 |
+ |
971 |
+ return 0; |
972 |
+ err: |
973 |
+- for (; i > 0; i--) |
974 |
++ while (--i >= 0) |
975 |
+ clk_disable_unprepare(msm_host->bus_clks[i]); |
976 |
+ |
977 |
+ return ret; |
978 |
+diff --git a/drivers/gpu/drm/msm/dsi/phy/dsi_phy_14nm.c b/drivers/gpu/drm/msm/dsi/phy/dsi_phy_14nm.c |
979 |
+index bb31230721bdd..3e1101451c8ac 100644 |
980 |
+--- a/drivers/gpu/drm/msm/dsi/phy/dsi_phy_14nm.c |
981 |
++++ b/drivers/gpu/drm/msm/dsi/phy/dsi_phy_14nm.c |
982 |
+@@ -110,14 +110,13 @@ static struct dsi_pll_14nm *pll_14nm_list[DSI_MAX]; |
983 |
+ static bool pll_14nm_poll_for_ready(struct dsi_pll_14nm *pll_14nm, |
984 |
+ u32 nb_tries, u32 timeout_us) |
985 |
+ { |
986 |
+- bool pll_locked = false; |
987 |
++ bool pll_locked = false, pll_ready = false; |
988 |
+ void __iomem *base = pll_14nm->phy->pll_base; |
989 |
+ u32 tries, val; |
990 |
+ |
991 |
+ tries = nb_tries; |
992 |
+ while (tries--) { |
993 |
+- val = dsi_phy_read(base + |
994 |
+- REG_DSI_14nm_PHY_PLL_RESET_SM_READY_STATUS); |
995 |
++ val = dsi_phy_read(base + REG_DSI_14nm_PHY_PLL_RESET_SM_READY_STATUS); |
996 |
+ pll_locked = !!(val & BIT(5)); |
997 |
+ |
998 |
+ if (pll_locked) |
999 |
+@@ -126,23 +125,24 @@ static bool pll_14nm_poll_for_ready(struct dsi_pll_14nm *pll_14nm, |
1000 |
+ udelay(timeout_us); |
1001 |
+ } |
1002 |
+ |
1003 |
+- if (!pll_locked) { |
1004 |
+- tries = nb_tries; |
1005 |
+- while (tries--) { |
1006 |
+- val = dsi_phy_read(base + |
1007 |
+- REG_DSI_14nm_PHY_PLL_RESET_SM_READY_STATUS); |
1008 |
+- pll_locked = !!(val & BIT(0)); |
1009 |
++ if (!pll_locked) |
1010 |
++ goto out; |
1011 |
+ |
1012 |
+- if (pll_locked) |
1013 |
+- break; |
1014 |
++ tries = nb_tries; |
1015 |
++ while (tries--) { |
1016 |
++ val = dsi_phy_read(base + REG_DSI_14nm_PHY_PLL_RESET_SM_READY_STATUS); |
1017 |
++ pll_ready = !!(val & BIT(0)); |
1018 |
+ |
1019 |
+- udelay(timeout_us); |
1020 |
+- } |
1021 |
++ if (pll_ready) |
1022 |
++ break; |
1023 |
++ |
1024 |
++ udelay(timeout_us); |
1025 |
+ } |
1026 |
+ |
1027 |
+- DBG("DSI PLL is %slocked", pll_locked ? "" : "*not* "); |
1028 |
++out: |
1029 |
++ DBG("DSI PLL is %slocked, %sready", pll_locked ? "" : "*not* ", pll_ready ? "" : "*not* "); |
1030 |
+ |
1031 |
+- return pll_locked; |
1032 |
++ return pll_locked && pll_ready; |
1033 |
+ } |
1034 |
+ |
1035 |
+ static void dsi_pll_14nm_config_init(struct dsi_pll_config *pconf) |
1036 |
+diff --git a/drivers/gpu/drm/msm/edp/edp_ctrl.c b/drivers/gpu/drm/msm/edp/edp_ctrl.c |
1037 |
+index 4fb397ee7c842..fe1366b4c49f5 100644 |
1038 |
+--- a/drivers/gpu/drm/msm/edp/edp_ctrl.c |
1039 |
++++ b/drivers/gpu/drm/msm/edp/edp_ctrl.c |
1040 |
+@@ -1116,7 +1116,7 @@ void msm_edp_ctrl_power(struct edp_ctrl *ctrl, bool on) |
1041 |
+ int msm_edp_ctrl_init(struct msm_edp *edp) |
1042 |
+ { |
1043 |
+ struct edp_ctrl *ctrl = NULL; |
1044 |
+- struct device *dev = &edp->pdev->dev; |
1045 |
++ struct device *dev; |
1046 |
+ int ret; |
1047 |
+ |
1048 |
+ if (!edp) { |
1049 |
+@@ -1124,6 +1124,7 @@ int msm_edp_ctrl_init(struct msm_edp *edp) |
1050 |
+ return -EINVAL; |
1051 |
+ } |
1052 |
+ |
1053 |
++ dev = &edp->pdev->dev; |
1054 |
+ ctrl = devm_kzalloc(dev, sizeof(*ctrl), GFP_KERNEL); |
1055 |
+ if (!ctrl) |
1056 |
+ return -ENOMEM; |
1057 |
+diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c |
1058 |
+index 729ab68d02034..bcb24810905fd 100644 |
1059 |
+--- a/drivers/gpu/drm/msm/msm_drv.c |
1060 |
++++ b/drivers/gpu/drm/msm/msm_drv.c |
1061 |
+@@ -566,10 +566,11 @@ static int msm_drm_init(struct device *dev, const struct drm_driver *drv) |
1062 |
+ if (ret) |
1063 |
+ goto err_msm_uninit; |
1064 |
+ |
1065 |
+- ret = msm_disp_snapshot_init(ddev); |
1066 |
+- if (ret) |
1067 |
+- DRM_DEV_ERROR(dev, "msm_disp_snapshot_init failed ret = %d\n", ret); |
1068 |
+- |
1069 |
++ if (kms) { |
1070 |
++ ret = msm_disp_snapshot_init(ddev); |
1071 |
++ if (ret) |
1072 |
++ DRM_DEV_ERROR(dev, "msm_disp_snapshot_init failed ret = %d\n", ret); |
1073 |
++ } |
1074 |
+ drm_mode_config_reset(ddev); |
1075 |
+ |
1076 |
+ #ifdef CONFIG_DRM_FBDEV_EMULATION |
1077 |
+@@ -618,6 +619,7 @@ static void load_gpu(struct drm_device *dev) |
1078 |
+ |
1079 |
+ static int context_init(struct drm_device *dev, struct drm_file *file) |
1080 |
+ { |
1081 |
++ static atomic_t ident = ATOMIC_INIT(0); |
1082 |
+ struct msm_drm_private *priv = dev->dev_private; |
1083 |
+ struct msm_file_private *ctx; |
1084 |
+ |
1085 |
+@@ -631,6 +633,8 @@ static int context_init(struct drm_device *dev, struct drm_file *file) |
1086 |
+ ctx->aspace = msm_gpu_create_private_address_space(priv->gpu, current); |
1087 |
+ file->driver_priv = ctx; |
1088 |
+ |
1089 |
++ ctx->seqno = atomic_inc_return(&ident); |
1090 |
++ |
1091 |
+ return 0; |
1092 |
+ } |
1093 |
+ |
1094 |
+diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h |
1095 |
+index 1a48a709ffb36..183d837dcea32 100644 |
1096 |
+--- a/drivers/gpu/drm/msm/msm_drv.h |
1097 |
++++ b/drivers/gpu/drm/msm/msm_drv.h |
1098 |
+@@ -59,6 +59,7 @@ struct msm_file_private { |
1099 |
+ int queueid; |
1100 |
+ struct msm_gem_address_space *aspace; |
1101 |
+ struct kref ref; |
1102 |
++ int seqno; |
1103 |
+ }; |
1104 |
+ |
1105 |
+ enum msm_mdp_plane_property { |
1106 |
+@@ -535,7 +536,7 @@ static inline int align_pitch(int width, int bpp) |
1107 |
+ static inline unsigned long timeout_to_jiffies(const ktime_t *timeout) |
1108 |
+ { |
1109 |
+ ktime_t now = ktime_get(); |
1110 |
+- unsigned long remaining_jiffies; |
1111 |
++ s64 remaining_jiffies; |
1112 |
+ |
1113 |
+ if (ktime_compare(*timeout, now) < 0) { |
1114 |
+ remaining_jiffies = 0; |
1115 |
+@@ -544,7 +545,7 @@ static inline unsigned long timeout_to_jiffies(const ktime_t *timeout) |
1116 |
+ remaining_jiffies = ktime_divns(rem, NSEC_PER_SEC / HZ); |
1117 |
+ } |
1118 |
+ |
1119 |
+- return remaining_jiffies; |
1120 |
++ return clamp(remaining_jiffies, 0LL, (s64)INT_MAX); |
1121 |
+ } |
1122 |
+ |
1123 |
+ #endif /* __MSM_DRV_H__ */ |
1124 |
+diff --git a/drivers/gpu/drm/msm/msm_gem_submit.c b/drivers/gpu/drm/msm/msm_gem_submit.c |
1125 |
+index 44f84bfd0c0e7..a10b79f9729ef 100644 |
1126 |
+--- a/drivers/gpu/drm/msm/msm_gem_submit.c |
1127 |
++++ b/drivers/gpu/drm/msm/msm_gem_submit.c |
1128 |
+@@ -161,7 +161,8 @@ out: |
1129 |
+ static int submit_lookup_cmds(struct msm_gem_submit *submit, |
1130 |
+ struct drm_msm_gem_submit *args, struct drm_file *file) |
1131 |
+ { |
1132 |
+- unsigned i, sz; |
1133 |
++ unsigned i; |
1134 |
++ size_t sz; |
1135 |
+ int ret = 0; |
1136 |
+ |
1137 |
+ for (i = 0; i < args->nr_cmds; i++) { |
1138 |
+diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/chang84.c b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/chang84.c |
1139 |
+index 353b77d9b3dcf..3492c561f2cfc 100644 |
1140 |
+--- a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/chang84.c |
1141 |
++++ b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/chang84.c |
1142 |
+@@ -82,7 +82,7 @@ g84_fifo_chan_engine_fini(struct nvkm_fifo_chan *base, |
1143 |
+ if (offset < 0) |
1144 |
+ return 0; |
1145 |
+ |
1146 |
+- engn = fifo->base.func->engine_id(&fifo->base, engine); |
1147 |
++ engn = fifo->base.func->engine_id(&fifo->base, engine) - 1; |
1148 |
+ save = nvkm_mask(device, 0x002520, 0x0000003f, 1 << engn); |
1149 |
+ nvkm_wr32(device, 0x0032fc, chan->base.inst->addr >> 12); |
1150 |
+ done = nvkm_msec(device, 2000, |
1151 |
+diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig |
1152 |
+index ef87d92cdf496..a9c8e05355aa6 100644 |
1153 |
+--- a/drivers/gpu/drm/panel/Kconfig |
1154 |
++++ b/drivers/gpu/drm/panel/Kconfig |
1155 |
+@@ -273,6 +273,7 @@ config DRM_PANEL_OLIMEX_LCD_OLINUXINO |
1156 |
+ depends on OF |
1157 |
+ depends on I2C |
1158 |
+ depends on BACKLIGHT_CLASS_DEVICE |
1159 |
++ select CRC32 |
1160 |
+ help |
1161 |
+ The panel is used with different sizes LCDs, from 480x272 to |
1162 |
+ 1280x800, and 24 bit per pixel. |
1163 |
+diff --git a/drivers/iio/accel/fxls8962af-core.c b/drivers/iio/accel/fxls8962af-core.c |
1164 |
+index 0019f1ea7df27..f41db9e0249a7 100644 |
1165 |
+--- a/drivers/iio/accel/fxls8962af-core.c |
1166 |
++++ b/drivers/iio/accel/fxls8962af-core.c |
1167 |
+@@ -738,7 +738,7 @@ static irqreturn_t fxls8962af_interrupt(int irq, void *p) |
1168 |
+ |
1169 |
+ if (reg & FXLS8962AF_INT_STATUS_SRC_BUF) { |
1170 |
+ ret = fxls8962af_fifo_flush(indio_dev); |
1171 |
+- if (ret) |
1172 |
++ if (ret < 0) |
1173 |
+ return IRQ_NONE; |
1174 |
+ |
1175 |
+ return IRQ_HANDLED; |
1176 |
+diff --git a/drivers/iio/adc/ad7192.c b/drivers/iio/adc/ad7192.c |
1177 |
+index ee8ed9481025d..2121a812b0c31 100644 |
1178 |
+--- a/drivers/iio/adc/ad7192.c |
1179 |
++++ b/drivers/iio/adc/ad7192.c |
1180 |
+@@ -293,6 +293,7 @@ static const struct ad_sigma_delta_info ad7192_sigma_delta_info = { |
1181 |
+ .has_registers = true, |
1182 |
+ .addr_shift = 3, |
1183 |
+ .read_mask = BIT(6), |
1184 |
++ .irq_flags = IRQF_TRIGGER_FALLING, |
1185 |
+ }; |
1186 |
+ |
1187 |
+ static const struct ad_sd_calib_data ad7192_calib_arr[8] = { |
1188 |
+diff --git a/drivers/iio/adc/ad7780.c b/drivers/iio/adc/ad7780.c |
1189 |
+index 42bb952f47388..b6e8c8abf6f4c 100644 |
1190 |
+--- a/drivers/iio/adc/ad7780.c |
1191 |
++++ b/drivers/iio/adc/ad7780.c |
1192 |
+@@ -203,7 +203,7 @@ static const struct ad_sigma_delta_info ad7780_sigma_delta_info = { |
1193 |
+ .set_mode = ad7780_set_mode, |
1194 |
+ .postprocess_sample = ad7780_postprocess_sample, |
1195 |
+ .has_registers = false, |
1196 |
+- .irq_flags = IRQF_TRIGGER_LOW, |
1197 |
++ .irq_flags = IRQF_TRIGGER_FALLING, |
1198 |
+ }; |
1199 |
+ |
1200 |
+ #define _AD7780_CHANNEL(_bits, _wordsize, _mask_all) \ |
1201 |
+diff --git a/drivers/iio/adc/ad7793.c b/drivers/iio/adc/ad7793.c |
1202 |
+index ef3e2d3ecb0c6..0e7ab3fb072a9 100644 |
1203 |
+--- a/drivers/iio/adc/ad7793.c |
1204 |
++++ b/drivers/iio/adc/ad7793.c |
1205 |
+@@ -206,7 +206,7 @@ static const struct ad_sigma_delta_info ad7793_sigma_delta_info = { |
1206 |
+ .has_registers = true, |
1207 |
+ .addr_shift = 3, |
1208 |
+ .read_mask = BIT(6), |
1209 |
+- .irq_flags = IRQF_TRIGGER_LOW, |
1210 |
++ .irq_flags = IRQF_TRIGGER_FALLING, |
1211 |
+ }; |
1212 |
+ |
1213 |
+ static const struct ad_sd_calib_data ad7793_calib_arr[6] = { |
1214 |
+diff --git a/drivers/iio/adc/aspeed_adc.c b/drivers/iio/adc/aspeed_adc.c |
1215 |
+index 19efaa41bc344..34ec0c28b2dff 100644 |
1216 |
+--- a/drivers/iio/adc/aspeed_adc.c |
1217 |
++++ b/drivers/iio/adc/aspeed_adc.c |
1218 |
+@@ -183,6 +183,7 @@ static int aspeed_adc_probe(struct platform_device *pdev) |
1219 |
+ |
1220 |
+ data = iio_priv(indio_dev); |
1221 |
+ data->dev = &pdev->dev; |
1222 |
++ platform_set_drvdata(pdev, indio_dev); |
1223 |
+ |
1224 |
+ data->base = devm_platform_ioremap_resource(pdev, 0); |
1225 |
+ if (IS_ERR(data->base)) |
1226 |
+diff --git a/drivers/iio/adc/max1027.c b/drivers/iio/adc/max1027.c |
1227 |
+index 655ab02d03d84..b753658bb41ec 100644 |
1228 |
+--- a/drivers/iio/adc/max1027.c |
1229 |
++++ b/drivers/iio/adc/max1027.c |
1230 |
+@@ -103,7 +103,7 @@ MODULE_DEVICE_TABLE(of, max1027_adc_dt_ids); |
1231 |
+ .sign = 'u', \ |
1232 |
+ .realbits = depth, \ |
1233 |
+ .storagebits = 16, \ |
1234 |
+- .shift = 2, \ |
1235 |
++ .shift = (depth == 10) ? 2 : 0, \ |
1236 |
+ .endianness = IIO_BE, \ |
1237 |
+ }, \ |
1238 |
+ } |
1239 |
+@@ -142,7 +142,6 @@ MODULE_DEVICE_TABLE(of, max1027_adc_dt_ids); |
1240 |
+ MAX1027_V_CHAN(11, depth) |
1241 |
+ |
1242 |
+ #define MAX1X31_CHANNELS(depth) \ |
1243 |
+- MAX1X27_CHANNELS(depth), \ |
1244 |
+ MAX1X29_CHANNELS(depth), \ |
1245 |
+ MAX1027_V_CHAN(12, depth), \ |
1246 |
+ MAX1027_V_CHAN(13, depth), \ |
1247 |
+diff --git a/drivers/iio/adc/mt6577_auxadc.c b/drivers/iio/adc/mt6577_auxadc.c |
1248 |
+index 79c1dd68b9092..d4fccd52ef08b 100644 |
1249 |
+--- a/drivers/iio/adc/mt6577_auxadc.c |
1250 |
++++ b/drivers/iio/adc/mt6577_auxadc.c |
1251 |
+@@ -82,6 +82,10 @@ static const struct iio_chan_spec mt6577_auxadc_iio_channels[] = { |
1252 |
+ MT6577_AUXADC_CHANNEL(15), |
1253 |
+ }; |
1254 |
+ |
1255 |
++/* For Voltage calculation */ |
1256 |
++#define VOLTAGE_FULL_RANGE 1500 /* VA voltage */ |
1257 |
++#define AUXADC_PRECISE 4096 /* 12 bits */ |
1258 |
++ |
1259 |
+ static int mt_auxadc_get_cali_data(int rawdata, bool enable_cali) |
1260 |
+ { |
1261 |
+ return rawdata; |
1262 |
+@@ -191,6 +195,10 @@ static int mt6577_auxadc_read_raw(struct iio_dev *indio_dev, |
1263 |
+ } |
1264 |
+ if (adc_dev->dev_comp->sample_data_cali) |
1265 |
+ *val = mt_auxadc_get_cali_data(*val, true); |
1266 |
++ |
1267 |
++ /* Convert adc raw data to voltage: 0 - 1500 mV */ |
1268 |
++ *val = *val * VOLTAGE_FULL_RANGE / AUXADC_PRECISE; |
1269 |
++ |
1270 |
+ return IIO_VAL_INT; |
1271 |
+ |
1272 |
+ default: |
1273 |
+diff --git a/drivers/iio/adc/ti-adc128s052.c b/drivers/iio/adc/ti-adc128s052.c |
1274 |
+index 3143f35a6509a..83c1ae07b3e9a 100644 |
1275 |
+--- a/drivers/iio/adc/ti-adc128s052.c |
1276 |
++++ b/drivers/iio/adc/ti-adc128s052.c |
1277 |
+@@ -171,7 +171,13 @@ static int adc128_probe(struct spi_device *spi) |
1278 |
+ mutex_init(&adc->lock); |
1279 |
+ |
1280 |
+ ret = iio_device_register(indio_dev); |
1281 |
++ if (ret) |
1282 |
++ goto err_disable_regulator; |
1283 |
+ |
1284 |
++ return 0; |
1285 |
++ |
1286 |
++err_disable_regulator: |
1287 |
++ regulator_disable(adc->reg); |
1288 |
+ return ret; |
1289 |
+ } |
1290 |
+ |
1291 |
+diff --git a/drivers/iio/common/ssp_sensors/ssp_spi.c b/drivers/iio/common/ssp_sensors/ssp_spi.c |
1292 |
+index 4864c38b8d1c2..769bd9280524a 100644 |
1293 |
+--- a/drivers/iio/common/ssp_sensors/ssp_spi.c |
1294 |
++++ b/drivers/iio/common/ssp_sensors/ssp_spi.c |
1295 |
+@@ -137,7 +137,7 @@ static int ssp_print_mcu_debug(char *data_frame, int *data_index, |
1296 |
+ if (length > received_len - *data_index || length <= 0) { |
1297 |
+ ssp_dbg("[SSP]: MSG From MCU-invalid debug length(%d/%d)\n", |
1298 |
+ length, received_len); |
1299 |
+- return length ? length : -EPROTO; |
1300 |
++ return -EPROTO; |
1301 |
+ } |
1302 |
+ |
1303 |
+ ssp_dbg("[SSP]: MSG From MCU - %s\n", &data_frame[*data_index]); |
1304 |
+@@ -273,6 +273,8 @@ static int ssp_parse_dataframe(struct ssp_data *data, char *dataframe, int len) |
1305 |
+ for (idx = 0; idx < len;) { |
1306 |
+ switch (dataframe[idx++]) { |
1307 |
+ case SSP_MSG2AP_INST_BYPASS_DATA: |
1308 |
++ if (idx >= len) |
1309 |
++ return -EPROTO; |
1310 |
+ sd = dataframe[idx++]; |
1311 |
+ if (sd < 0 || sd >= SSP_SENSOR_MAX) { |
1312 |
+ dev_err(SSP_DEV, |
1313 |
+@@ -282,10 +284,13 @@ static int ssp_parse_dataframe(struct ssp_data *data, char *dataframe, int len) |
1314 |
+ |
1315 |
+ if (indio_devs[sd]) { |
1316 |
+ spd = iio_priv(indio_devs[sd]); |
1317 |
+- if (spd->process_data) |
1318 |
++ if (spd->process_data) { |
1319 |
++ if (idx >= len) |
1320 |
++ return -EPROTO; |
1321 |
+ spd->process_data(indio_devs[sd], |
1322 |
+ &dataframe[idx], |
1323 |
+ data->timestamp); |
1324 |
++ } |
1325 |
+ } else { |
1326 |
+ dev_err(SSP_DEV, "no client for frame\n"); |
1327 |
+ } |
1328 |
+@@ -293,6 +298,8 @@ static int ssp_parse_dataframe(struct ssp_data *data, char *dataframe, int len) |
1329 |
+ idx += ssp_offset_map[sd]; |
1330 |
+ break; |
1331 |
+ case SSP_MSG2AP_INST_DEBUG_DATA: |
1332 |
++ if (idx >= len) |
1333 |
++ return -EPROTO; |
1334 |
+ sd = ssp_print_mcu_debug(dataframe, &idx, len); |
1335 |
+ if (sd) { |
1336 |
+ dev_err(SSP_DEV, |
1337 |
+diff --git a/drivers/iio/dac/ti-dac5571.c b/drivers/iio/dac/ti-dac5571.c |
1338 |
+index 2a5ba1b08a1d0..546a4cf6c5ef8 100644 |
1339 |
+--- a/drivers/iio/dac/ti-dac5571.c |
1340 |
++++ b/drivers/iio/dac/ti-dac5571.c |
1341 |
+@@ -350,6 +350,7 @@ static int dac5571_probe(struct i2c_client *client, |
1342 |
+ data->dac5571_pwrdwn = dac5571_pwrdwn_quad; |
1343 |
+ break; |
1344 |
+ default: |
1345 |
++ ret = -EINVAL; |
1346 |
+ goto err; |
1347 |
+ } |
1348 |
+ |
1349 |
+diff --git a/drivers/iio/imu/adis16475.c b/drivers/iio/imu/adis16475.c |
1350 |
+index eb48102f94243..287fff39a927a 100644 |
1351 |
+--- a/drivers/iio/imu/adis16475.c |
1352 |
++++ b/drivers/iio/imu/adis16475.c |
1353 |
+@@ -353,10 +353,11 @@ static int adis16475_set_freq(struct adis16475 *st, const u32 freq) |
1354 |
+ if (dec > st->info->max_dec) |
1355 |
+ dec = st->info->max_dec; |
1356 |
+ |
1357 |
+- ret = adis_write_reg_16(&st->adis, ADIS16475_REG_DEC_RATE, dec); |
1358 |
++ ret = __adis_write_reg_16(&st->adis, ADIS16475_REG_DEC_RATE, dec); |
1359 |
+ if (ret) |
1360 |
+ goto error; |
1361 |
+ |
1362 |
++ adis_dev_unlock(&st->adis); |
1363 |
+ /* |
1364 |
+ * If decimation is used, then gyro and accel data will have meaningful |
1365 |
+ * bits on the LSB registers. This info is used on the trigger handler. |
1366 |
+diff --git a/drivers/iio/imu/adis16480.c b/drivers/iio/imu/adis16480.c |
1367 |
+index a869a6e52a16b..ed129321a14da 100644 |
1368 |
+--- a/drivers/iio/imu/adis16480.c |
1369 |
++++ b/drivers/iio/imu/adis16480.c |
1370 |
+@@ -144,6 +144,7 @@ struct adis16480_chip_info { |
1371 |
+ unsigned int max_dec_rate; |
1372 |
+ const unsigned int *filter_freqs; |
1373 |
+ bool has_pps_clk_mode; |
1374 |
++ bool has_sleep_cnt; |
1375 |
+ const struct adis_data adis_data; |
1376 |
+ }; |
1377 |
+ |
1378 |
+@@ -939,6 +940,7 @@ static const struct adis16480_chip_info adis16480_chip_info[] = { |
1379 |
+ .temp_scale = 5650, /* 5.65 milli degree Celsius */ |
1380 |
+ .int_clk = 2460000, |
1381 |
+ .max_dec_rate = 2048, |
1382 |
++ .has_sleep_cnt = true, |
1383 |
+ .filter_freqs = adis16480_def_filter_freqs, |
1384 |
+ .adis_data = ADIS16480_DATA(16375, &adis16485_timeouts, 0), |
1385 |
+ }, |
1386 |
+@@ -952,6 +954,7 @@ static const struct adis16480_chip_info adis16480_chip_info[] = { |
1387 |
+ .temp_scale = 5650, /* 5.65 milli degree Celsius */ |
1388 |
+ .int_clk = 2460000, |
1389 |
+ .max_dec_rate = 2048, |
1390 |
++ .has_sleep_cnt = true, |
1391 |
+ .filter_freqs = adis16480_def_filter_freqs, |
1392 |
+ .adis_data = ADIS16480_DATA(16480, &adis16480_timeouts, 0), |
1393 |
+ }, |
1394 |
+@@ -965,6 +968,7 @@ static const struct adis16480_chip_info adis16480_chip_info[] = { |
1395 |
+ .temp_scale = 5650, /* 5.65 milli degree Celsius */ |
1396 |
+ .int_clk = 2460000, |
1397 |
+ .max_dec_rate = 2048, |
1398 |
++ .has_sleep_cnt = true, |
1399 |
+ .filter_freqs = adis16480_def_filter_freqs, |
1400 |
+ .adis_data = ADIS16480_DATA(16485, &adis16485_timeouts, 0), |
1401 |
+ }, |
1402 |
+@@ -978,6 +982,7 @@ static const struct adis16480_chip_info adis16480_chip_info[] = { |
1403 |
+ .temp_scale = 5650, /* 5.65 milli degree Celsius */ |
1404 |
+ .int_clk = 2460000, |
1405 |
+ .max_dec_rate = 2048, |
1406 |
++ .has_sleep_cnt = true, |
1407 |
+ .filter_freqs = adis16480_def_filter_freqs, |
1408 |
+ .adis_data = ADIS16480_DATA(16488, &adis16485_timeouts, 0), |
1409 |
+ }, |
1410 |
+@@ -1425,9 +1430,12 @@ static int adis16480_probe(struct spi_device *spi) |
1411 |
+ if (ret) |
1412 |
+ return ret; |
1413 |
+ |
1414 |
+- ret = devm_add_action_or_reset(&spi->dev, adis16480_stop, indio_dev); |
1415 |
+- if (ret) |
1416 |
+- return ret; |
1417 |
++ if (st->chip_info->has_sleep_cnt) { |
1418 |
++ ret = devm_add_action_or_reset(&spi->dev, adis16480_stop, |
1419 |
++ indio_dev); |
1420 |
++ if (ret) |
1421 |
++ return ret; |
1422 |
++ } |
1423 |
+ |
1424 |
+ ret = adis16480_config_irq_pin(spi->dev.of_node, st); |
1425 |
+ if (ret) |
1426 |
+diff --git a/drivers/iio/light/opt3001.c b/drivers/iio/light/opt3001.c |
1427 |
+index 52963da401a78..1880bd5bb2586 100644 |
1428 |
+--- a/drivers/iio/light/opt3001.c |
1429 |
++++ b/drivers/iio/light/opt3001.c |
1430 |
+@@ -276,6 +276,8 @@ static int opt3001_get_lux(struct opt3001 *opt, int *val, int *val2) |
1431 |
+ ret = wait_event_timeout(opt->result_ready_queue, |
1432 |
+ opt->result_ready, |
1433 |
+ msecs_to_jiffies(OPT3001_RESULT_READY_LONG)); |
1434 |
++ if (ret == 0) |
1435 |
++ return -ETIMEDOUT; |
1436 |
+ } else { |
1437 |
+ /* Sleep for result ready time */ |
1438 |
+ timeout = (opt->int_time == OPT3001_INT_TIME_SHORT) ? |
1439 |
+@@ -312,9 +314,7 @@ err: |
1440 |
+ /* Disallow IRQ to access the device while lock is active */ |
1441 |
+ opt->ok_to_ignore_lock = false; |
1442 |
+ |
1443 |
+- if (ret == 0) |
1444 |
+- return -ETIMEDOUT; |
1445 |
+- else if (ret < 0) |
1446 |
++ if (ret < 0) |
1447 |
+ return ret; |
1448 |
+ |
1449 |
+ if (opt->use_irq) { |
1450 |
+diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c |
1451 |
+index 29de8412e4165..4c914f75a9027 100644 |
1452 |
+--- a/drivers/input/joystick/xpad.c |
1453 |
++++ b/drivers/input/joystick/xpad.c |
1454 |
+@@ -334,6 +334,7 @@ static const struct xpad_device { |
1455 |
+ { 0x24c6, 0x5b03, "Thrustmaster Ferrari 458 Racing Wheel", 0, XTYPE_XBOX360 }, |
1456 |
+ { 0x24c6, 0x5d04, "Razer Sabertooth", 0, XTYPE_XBOX360 }, |
1457 |
+ { 0x24c6, 0xfafe, "Rock Candy Gamepad for Xbox 360", 0, XTYPE_XBOX360 }, |
1458 |
++ { 0x3285, 0x0607, "Nacon GC-100", 0, XTYPE_XBOX360 }, |
1459 |
+ { 0x3767, 0x0101, "Fanatec Speedster 3 Forceshock Wheel", 0, XTYPE_XBOX }, |
1460 |
+ { 0xffff, 0xffff, "Chinese-made Xbox Controller", 0, XTYPE_XBOX }, |
1461 |
+ { 0x0000, 0x0000, "Generic X-Box pad", 0, XTYPE_UNKNOWN } |
1462 |
+@@ -451,6 +452,7 @@ static const struct usb_device_id xpad_table[] = { |
1463 |
+ XPAD_XBOXONE_VENDOR(0x24c6), /* PowerA Controllers */ |
1464 |
+ XPAD_XBOXONE_VENDOR(0x2e24), /* Hyperkin Duke X-Box One pad */ |
1465 |
+ XPAD_XBOX360_VENDOR(0x2f24), /* GameSir Controllers */ |
1466 |
++ XPAD_XBOX360_VENDOR(0x3285), /* Nacon GC-100 */ |
1467 |
+ { } |
1468 |
+ }; |
1469 |
+ |
1470 |
+diff --git a/drivers/input/touchscreen/resistive-adc-touch.c b/drivers/input/touchscreen/resistive-adc-touch.c |
1471 |
+index 744544a723b77..6f754a8d30b11 100644 |
1472 |
+--- a/drivers/input/touchscreen/resistive-adc-touch.c |
1473 |
++++ b/drivers/input/touchscreen/resistive-adc-touch.c |
1474 |
+@@ -71,19 +71,22 @@ static int grts_cb(const void *data, void *private) |
1475 |
+ unsigned int z2 = touch_info[st->ch_map[GRTS_CH_Z2]]; |
1476 |
+ unsigned int Rt; |
1477 |
+ |
1478 |
+- Rt = z2; |
1479 |
+- Rt -= z1; |
1480 |
+- Rt *= st->x_plate_ohms; |
1481 |
+- Rt = DIV_ROUND_CLOSEST(Rt, 16); |
1482 |
+- Rt *= x; |
1483 |
+- Rt /= z1; |
1484 |
+- Rt = DIV_ROUND_CLOSEST(Rt, 256); |
1485 |
+- /* |
1486 |
+- * On increased pressure the resistance (Rt) is decreasing |
1487 |
+- * so, convert values to make it looks as real pressure. |
1488 |
+- */ |
1489 |
+- if (Rt < GRTS_DEFAULT_PRESSURE_MAX) |
1490 |
+- press = GRTS_DEFAULT_PRESSURE_MAX - Rt; |
1491 |
++ if (likely(x && z1)) { |
1492 |
++ Rt = z2; |
1493 |
++ Rt -= z1; |
1494 |
++ Rt *= st->x_plate_ohms; |
1495 |
++ Rt = DIV_ROUND_CLOSEST(Rt, 16); |
1496 |
++ Rt *= x; |
1497 |
++ Rt /= z1; |
1498 |
++ Rt = DIV_ROUND_CLOSEST(Rt, 256); |
1499 |
++ /* |
1500 |
++ * On increased pressure the resistance (Rt) is |
1501 |
++ * decreasing so, convert values to make it looks as |
1502 |
++ * real pressure. |
1503 |
++ */ |
1504 |
++ if (Rt < GRTS_DEFAULT_PRESSURE_MAX) |
1505 |
++ press = GRTS_DEFAULT_PRESSURE_MAX - Rt; |
1506 |
++ } |
1507 |
+ } |
1508 |
+ |
1509 |
+ if ((!x && !y) || (st->pressure && (press < st->pressure_min))) { |
1510 |
+diff --git a/drivers/md/dm-rq.c b/drivers/md/dm-rq.c |
1511 |
+index 0dbd48cbdff95..231efbe38c214 100644 |
1512 |
+--- a/drivers/md/dm-rq.c |
1513 |
++++ b/drivers/md/dm-rq.c |
1514 |
+@@ -490,6 +490,14 @@ static blk_status_t dm_mq_queue_rq(struct blk_mq_hw_ctx *hctx, |
1515 |
+ struct mapped_device *md = tio->md; |
1516 |
+ struct dm_target *ti = md->immutable_target; |
1517 |
+ |
1518 |
++ /* |
1519 |
++ * blk-mq's unquiesce may come from outside events, such as |
1520 |
++ * elevator switch, updating nr_requests or others, and request may |
1521 |
++ * come during suspend, so simply ask for blk-mq to requeue it. |
1522 |
++ */ |
1523 |
++ if (unlikely(test_bit(DMF_BLOCK_IO_FOR_SUSPEND, &md->flags))) |
1524 |
++ return BLK_STS_RESOURCE; |
1525 |
++ |
1526 |
+ if (unlikely(!ti)) { |
1527 |
+ int srcu_idx; |
1528 |
+ struct dm_table *map = dm_get_live_table(md, &srcu_idx); |
1529 |
+diff --git a/drivers/md/dm.c b/drivers/md/dm.c |
1530 |
+index 2c5f9e5852117..bb895430981f2 100644 |
1531 |
+--- a/drivers/md/dm.c |
1532 |
++++ b/drivers/md/dm.c |
1533 |
+@@ -492,18 +492,17 @@ static void start_io_acct(struct dm_io *io) |
1534 |
+ false, 0, &io->stats_aux); |
1535 |
+ } |
1536 |
+ |
1537 |
+-static void end_io_acct(struct dm_io *io) |
1538 |
++static void end_io_acct(struct mapped_device *md, struct bio *bio, |
1539 |
++ unsigned long start_time, struct dm_stats_aux *stats_aux) |
1540 |
+ { |
1541 |
+- struct mapped_device *md = io->md; |
1542 |
+- struct bio *bio = io->orig_bio; |
1543 |
+- unsigned long duration = jiffies - io->start_time; |
1544 |
++ unsigned long duration = jiffies - start_time; |
1545 |
+ |
1546 |
+- bio_end_io_acct(bio, io->start_time); |
1547 |
++ bio_end_io_acct(bio, start_time); |
1548 |
+ |
1549 |
+ if (unlikely(dm_stats_used(&md->stats))) |
1550 |
+ dm_stats_account_io(&md->stats, bio_data_dir(bio), |
1551 |
+ bio->bi_iter.bi_sector, bio_sectors(bio), |
1552 |
+- true, duration, &io->stats_aux); |
1553 |
++ true, duration, stats_aux); |
1554 |
+ |
1555 |
+ /* nudge anyone waiting on suspend queue */ |
1556 |
+ if (unlikely(wq_has_sleeper(&md->wait))) |
1557 |
+@@ -786,6 +785,8 @@ void dm_io_dec_pending(struct dm_io *io, blk_status_t error) |
1558 |
+ blk_status_t io_error; |
1559 |
+ struct bio *bio; |
1560 |
+ struct mapped_device *md = io->md; |
1561 |
++ unsigned long start_time = 0; |
1562 |
++ struct dm_stats_aux stats_aux; |
1563 |
+ |
1564 |
+ /* Push-back supersedes any I/O errors */ |
1565 |
+ if (unlikely(error)) { |
1566 |
+@@ -817,8 +818,10 @@ void dm_io_dec_pending(struct dm_io *io, blk_status_t error) |
1567 |
+ } |
1568 |
+ |
1569 |
+ io_error = io->status; |
1570 |
+- end_io_acct(io); |
1571 |
++ start_time = io->start_time; |
1572 |
++ stats_aux = io->stats_aux; |
1573 |
+ free_io(md, io); |
1574 |
++ end_io_acct(md, bio, start_time, &stats_aux); |
1575 |
+ |
1576 |
+ if (io_error == BLK_STS_DM_REQUEUE) |
1577 |
+ return; |
1578 |
+diff --git a/drivers/misc/cb710/sgbuf2.c b/drivers/misc/cb710/sgbuf2.c |
1579 |
+index e5a4ed3701eb8..a798fad5f03c2 100644 |
1580 |
+--- a/drivers/misc/cb710/sgbuf2.c |
1581 |
++++ b/drivers/misc/cb710/sgbuf2.c |
1582 |
+@@ -47,7 +47,7 @@ static inline bool needs_unaligned_copy(const void *ptr) |
1583 |
+ #ifdef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS |
1584 |
+ return false; |
1585 |
+ #else |
1586 |
+- return ((ptr - NULL) & 3) != 0; |
1587 |
++ return ((uintptr_t)ptr & 3) != 0; |
1588 |
+ #endif |
1589 |
+ } |
1590 |
+ |
1591 |
+diff --git a/drivers/misc/eeprom/at25.c b/drivers/misc/eeprom/at25.c |
1592 |
+index 4d09b672ac3c8..632325474233a 100644 |
1593 |
+--- a/drivers/misc/eeprom/at25.c |
1594 |
++++ b/drivers/misc/eeprom/at25.c |
1595 |
+@@ -366,6 +366,13 @@ static const struct of_device_id at25_of_match[] = { |
1596 |
+ }; |
1597 |
+ MODULE_DEVICE_TABLE(of, at25_of_match); |
1598 |
+ |
1599 |
++static const struct spi_device_id at25_spi_ids[] = { |
1600 |
++ { .name = "at25",}, |
1601 |
++ { .name = "fm25",}, |
1602 |
++ { } |
1603 |
++}; |
1604 |
++MODULE_DEVICE_TABLE(spi, at25_spi_ids); |
1605 |
++ |
1606 |
+ static int at25_probe(struct spi_device *spi) |
1607 |
+ { |
1608 |
+ struct at25_data *at25 = NULL; |
1609 |
+@@ -491,6 +498,7 @@ static struct spi_driver at25_driver = { |
1610 |
+ .dev_groups = sernum_groups, |
1611 |
+ }, |
1612 |
+ .probe = at25_probe, |
1613 |
++ .id_table = at25_spi_ids, |
1614 |
+ }; |
1615 |
+ |
1616 |
+ module_spi_driver(at25_driver); |
1617 |
+diff --git a/drivers/misc/eeprom/eeprom_93xx46.c b/drivers/misc/eeprom/eeprom_93xx46.c |
1618 |
+index 29d8971ec558b..1f15399e5cb49 100644 |
1619 |
+--- a/drivers/misc/eeprom/eeprom_93xx46.c |
1620 |
++++ b/drivers/misc/eeprom/eeprom_93xx46.c |
1621 |
+@@ -406,6 +406,23 @@ static const struct of_device_id eeprom_93xx46_of_table[] = { |
1622 |
+ }; |
1623 |
+ MODULE_DEVICE_TABLE(of, eeprom_93xx46_of_table); |
1624 |
+ |
1625 |
++static const struct spi_device_id eeprom_93xx46_spi_ids[] = { |
1626 |
++ { .name = "eeprom-93xx46", |
1627 |
++ .driver_data = (kernel_ulong_t)&at93c46_data, }, |
1628 |
++ { .name = "at93c46", |
1629 |
++ .driver_data = (kernel_ulong_t)&at93c46_data, }, |
1630 |
++ { .name = "at93c46d", |
1631 |
++ .driver_data = (kernel_ulong_t)&atmel_at93c46d_data, }, |
1632 |
++ { .name = "at93c56", |
1633 |
++ .driver_data = (kernel_ulong_t)&at93c56_data, }, |
1634 |
++ { .name = "at93c66", |
1635 |
++ .driver_data = (kernel_ulong_t)&at93c66_data, }, |
1636 |
++ { .name = "93lc46b", |
1637 |
++ .driver_data = (kernel_ulong_t)µchip_93lc46b_data, }, |
1638 |
++ {} |
1639 |
++}; |
1640 |
++MODULE_DEVICE_TABLE(spi, eeprom_93xx46_spi_ids); |
1641 |
++ |
1642 |
+ static int eeprom_93xx46_probe_dt(struct spi_device *spi) |
1643 |
+ { |
1644 |
+ const struct of_device_id *of_id = |
1645 |
+@@ -555,6 +572,7 @@ static struct spi_driver eeprom_93xx46_driver = { |
1646 |
+ }, |
1647 |
+ .probe = eeprom_93xx46_probe, |
1648 |
+ .remove = eeprom_93xx46_remove, |
1649 |
++ .id_table = eeprom_93xx46_spi_ids, |
1650 |
+ }; |
1651 |
+ |
1652 |
+ module_spi_driver(eeprom_93xx46_driver); |
1653 |
+diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c |
1654 |
+index beda610e6b30d..ad6ced4546556 100644 |
1655 |
+--- a/drivers/misc/fastrpc.c |
1656 |
++++ b/drivers/misc/fastrpc.c |
1657 |
+@@ -814,10 +814,12 @@ static int fastrpc_get_args(u32 kernel, struct fastrpc_invoke_ctx *ctx) |
1658 |
+ rpra[i].pv = (u64) ctx->args[i].ptr; |
1659 |
+ pages[i].addr = ctx->maps[i]->phys; |
1660 |
+ |
1661 |
++ mmap_read_lock(current->mm); |
1662 |
+ vma = find_vma(current->mm, ctx->args[i].ptr); |
1663 |
+ if (vma) |
1664 |
+ pages[i].addr += ctx->args[i].ptr - |
1665 |
+ vma->vm_start; |
1666 |
++ mmap_read_unlock(current->mm); |
1667 |
+ |
1668 |
+ pg_start = (ctx->args[i].ptr & PAGE_MASK) >> PAGE_SHIFT; |
1669 |
+ pg_end = ((ctx->args[i].ptr + len - 1) & PAGE_MASK) >> |
1670 |
+diff --git a/drivers/misc/mei/hbm.c b/drivers/misc/mei/hbm.c |
1671 |
+index 99b5c1ecc4441..be41843df75bc 100644 |
1672 |
+--- a/drivers/misc/mei/hbm.c |
1673 |
++++ b/drivers/misc/mei/hbm.c |
1674 |
+@@ -1298,7 +1298,8 @@ int mei_hbm_dispatch(struct mei_device *dev, struct mei_msg_hdr *hdr) |
1675 |
+ |
1676 |
+ if (dev->dev_state != MEI_DEV_INIT_CLIENTS || |
1677 |
+ dev->hbm_state != MEI_HBM_STARTING) { |
1678 |
+- if (dev->dev_state == MEI_DEV_POWER_DOWN) { |
1679 |
++ if (dev->dev_state == MEI_DEV_POWER_DOWN || |
1680 |
++ dev->dev_state == MEI_DEV_POWERING_DOWN) { |
1681 |
+ dev_dbg(dev->dev, "hbm: start: on shutdown, ignoring\n"); |
1682 |
+ return 0; |
1683 |
+ } |
1684 |
+@@ -1381,7 +1382,8 @@ int mei_hbm_dispatch(struct mei_device *dev, struct mei_msg_hdr *hdr) |
1685 |
+ |
1686 |
+ if (dev->dev_state != MEI_DEV_INIT_CLIENTS || |
1687 |
+ dev->hbm_state != MEI_HBM_DR_SETUP) { |
1688 |
+- if (dev->dev_state == MEI_DEV_POWER_DOWN) { |
1689 |
++ if (dev->dev_state == MEI_DEV_POWER_DOWN || |
1690 |
++ dev->dev_state == MEI_DEV_POWERING_DOWN) { |
1691 |
+ dev_dbg(dev->dev, "hbm: dma setup response: on shutdown, ignoring\n"); |
1692 |
+ return 0; |
1693 |
+ } |
1694 |
+@@ -1448,7 +1450,8 @@ int mei_hbm_dispatch(struct mei_device *dev, struct mei_msg_hdr *hdr) |
1695 |
+ |
1696 |
+ if (dev->dev_state != MEI_DEV_INIT_CLIENTS || |
1697 |
+ dev->hbm_state != MEI_HBM_CLIENT_PROPERTIES) { |
1698 |
+- if (dev->dev_state == MEI_DEV_POWER_DOWN) { |
1699 |
++ if (dev->dev_state == MEI_DEV_POWER_DOWN || |
1700 |
++ dev->dev_state == MEI_DEV_POWERING_DOWN) { |
1701 |
+ dev_dbg(dev->dev, "hbm: properties response: on shutdown, ignoring\n"); |
1702 |
+ return 0; |
1703 |
+ } |
1704 |
+@@ -1490,7 +1493,8 @@ int mei_hbm_dispatch(struct mei_device *dev, struct mei_msg_hdr *hdr) |
1705 |
+ |
1706 |
+ if (dev->dev_state != MEI_DEV_INIT_CLIENTS || |
1707 |
+ dev->hbm_state != MEI_HBM_ENUM_CLIENTS) { |
1708 |
+- if (dev->dev_state == MEI_DEV_POWER_DOWN) { |
1709 |
++ if (dev->dev_state == MEI_DEV_POWER_DOWN || |
1710 |
++ dev->dev_state == MEI_DEV_POWERING_DOWN) { |
1711 |
+ dev_dbg(dev->dev, "hbm: enumeration response: on shutdown, ignoring\n"); |
1712 |
+ return 0; |
1713 |
+ } |
1714 |
+diff --git a/drivers/misc/mei/hw-me-regs.h b/drivers/misc/mei/hw-me-regs.h |
1715 |
+index cb34925e10f15..67bb6a25fd0a0 100644 |
1716 |
+--- a/drivers/misc/mei/hw-me-regs.h |
1717 |
++++ b/drivers/misc/mei/hw-me-regs.h |
1718 |
+@@ -92,6 +92,7 @@ |
1719 |
+ #define MEI_DEV_ID_CDF 0x18D3 /* Cedar Fork */ |
1720 |
+ |
1721 |
+ #define MEI_DEV_ID_ICP_LP 0x34E0 /* Ice Lake Point LP */ |
1722 |
++#define MEI_DEV_ID_ICP_N 0x38E0 /* Ice Lake Point N */ |
1723 |
+ |
1724 |
+ #define MEI_DEV_ID_JSP_N 0x4DE0 /* Jasper Lake Point N */ |
1725 |
+ |
1726 |
+diff --git a/drivers/misc/mei/pci-me.c b/drivers/misc/mei/pci-me.c |
1727 |
+index c3393b383e598..3a45aaf002ac8 100644 |
1728 |
+--- a/drivers/misc/mei/pci-me.c |
1729 |
++++ b/drivers/misc/mei/pci-me.c |
1730 |
+@@ -96,6 +96,7 @@ static const struct pci_device_id mei_me_pci_tbl[] = { |
1731 |
+ {MEI_PCI_DEVICE(MEI_DEV_ID_CMP_H_3, MEI_ME_PCH8_ITOUCH_CFG)}, |
1732 |
+ |
1733 |
+ {MEI_PCI_DEVICE(MEI_DEV_ID_ICP_LP, MEI_ME_PCH12_CFG)}, |
1734 |
++ {MEI_PCI_DEVICE(MEI_DEV_ID_ICP_N, MEI_ME_PCH12_CFG)}, |
1735 |
+ |
1736 |
+ {MEI_PCI_DEVICE(MEI_DEV_ID_TGP_LP, MEI_ME_PCH15_CFG)}, |
1737 |
+ {MEI_PCI_DEVICE(MEI_DEV_ID_TGP_H, MEI_ME_PCH15_SPS_CFG)}, |
1738 |
+diff --git a/drivers/mtd/nand/raw/qcom_nandc.c b/drivers/mtd/nand/raw/qcom_nandc.c |
1739 |
+index ef0badea4f415..04e6f7b267064 100644 |
1740 |
+--- a/drivers/mtd/nand/raw/qcom_nandc.c |
1741 |
++++ b/drivers/mtd/nand/raw/qcom_nandc.c |
1742 |
+@@ -1676,13 +1676,17 @@ qcom_nandc_read_cw_raw(struct mtd_info *mtd, struct nand_chip *chip, |
1743 |
+ struct nand_ecc_ctrl *ecc = &chip->ecc; |
1744 |
+ int data_size1, data_size2, oob_size1, oob_size2; |
1745 |
+ int ret, reg_off = FLASH_BUF_ACC, read_loc = 0; |
1746 |
++ int raw_cw = cw; |
1747 |
+ |
1748 |
+ nand_read_page_op(chip, page, 0, NULL, 0); |
1749 |
+ host->use_ecc = false; |
1750 |
+ |
1751 |
++ if (nandc->props->qpic_v2) |
1752 |
++ raw_cw = ecc->steps - 1; |
1753 |
++ |
1754 |
+ clear_bam_transaction(nandc); |
1755 |
+ set_address(host, host->cw_size * cw, page); |
1756 |
+- update_rw_regs(host, 1, true, cw); |
1757 |
++ update_rw_regs(host, 1, true, raw_cw); |
1758 |
+ config_nand_page_read(chip); |
1759 |
+ |
1760 |
+ data_size1 = mtd->writesize - host->cw_size * (ecc->steps - 1); |
1761 |
+@@ -1711,7 +1715,7 @@ qcom_nandc_read_cw_raw(struct mtd_info *mtd, struct nand_chip *chip, |
1762 |
+ nandc_set_read_loc(chip, cw, 3, read_loc, oob_size2, 1); |
1763 |
+ } |
1764 |
+ |
1765 |
+- config_nand_cw_read(chip, false, cw); |
1766 |
++ config_nand_cw_read(chip, false, raw_cw); |
1767 |
+ |
1768 |
+ read_data_dma(nandc, reg_off, data_buf, data_size1, 0); |
1769 |
+ reg_off += data_size1; |
1770 |
+diff --git a/drivers/net/dsa/microchip/ksz_common.c b/drivers/net/dsa/microchip/ksz_common.c |
1771 |
+index 1542bfb8b5e54..7c2968a639eba 100644 |
1772 |
+--- a/drivers/net/dsa/microchip/ksz_common.c |
1773 |
++++ b/drivers/net/dsa/microchip/ksz_common.c |
1774 |
+@@ -449,8 +449,10 @@ EXPORT_SYMBOL(ksz_switch_register); |
1775 |
+ void ksz_switch_remove(struct ksz_device *dev) |
1776 |
+ { |
1777 |
+ /* timer started */ |
1778 |
+- if (dev->mib_read_interval) |
1779 |
++ if (dev->mib_read_interval) { |
1780 |
++ dev->mib_read_interval = 0; |
1781 |
+ cancel_delayed_work_sync(&dev->mib_read); |
1782 |
++ } |
1783 |
+ |
1784 |
+ dev->dev_ops->exit(dev); |
1785 |
+ dsa_unregister_switch(dev->ds); |
1786 |
+diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c |
1787 |
+index 66b4f4a9832a4..f5b2e5e87da43 100644 |
1788 |
+--- a/drivers/net/dsa/mv88e6xxx/chip.c |
1789 |
++++ b/drivers/net/dsa/mv88e6xxx/chip.c |
1790 |
+@@ -749,7 +749,11 @@ static void mv88e6xxx_mac_link_down(struct dsa_switch *ds, int port, |
1791 |
+ ops = chip->info->ops; |
1792 |
+ |
1793 |
+ mv88e6xxx_reg_lock(chip); |
1794 |
+- if ((!mv88e6xxx_port_ppu_updates(chip, port) || |
1795 |
++ /* Internal PHYs propagate their configuration directly to the MAC. |
1796 |
++ * External PHYs depend on whether the PPU is enabled for this port. |
1797 |
++ */ |
1798 |
++ if (((!mv88e6xxx_phy_is_internal(ds, port) && |
1799 |
++ !mv88e6xxx_port_ppu_updates(chip, port)) || |
1800 |
+ mode == MLO_AN_FIXED) && ops->port_sync_link) |
1801 |
+ err = ops->port_sync_link(chip, port, mode, false); |
1802 |
+ mv88e6xxx_reg_unlock(chip); |
1803 |
+@@ -772,7 +776,12 @@ static void mv88e6xxx_mac_link_up(struct dsa_switch *ds, int port, |
1804 |
+ ops = chip->info->ops; |
1805 |
+ |
1806 |
+ mv88e6xxx_reg_lock(chip); |
1807 |
+- if (!mv88e6xxx_port_ppu_updates(chip, port) || mode == MLO_AN_FIXED) { |
1808 |
++ /* Internal PHYs propagate their configuration directly to the MAC. |
1809 |
++ * External PHYs depend on whether the PPU is enabled for this port. |
1810 |
++ */ |
1811 |
++ if ((!mv88e6xxx_phy_is_internal(ds, port) && |
1812 |
++ !mv88e6xxx_port_ppu_updates(chip, port)) || |
1813 |
++ mode == MLO_AN_FIXED) { |
1814 |
+ /* FIXME: for an automedia port, should we force the link |
1815 |
+ * down here - what if the link comes up due to "other" media |
1816 |
+ * while we're bringing the port up, how is the exclusivity |
1817 |
+diff --git a/drivers/net/dsa/ocelot/felix.c b/drivers/net/dsa/ocelot/felix.c |
1818 |
+index a2a15919b9606..0ba3762d5c219 100644 |
1819 |
+--- a/drivers/net/dsa/ocelot/felix.c |
1820 |
++++ b/drivers/net/dsa/ocelot/felix.c |
1821 |
+@@ -271,12 +271,12 @@ static void felix_8021q_cpu_port_deinit(struct ocelot *ocelot, int port) |
1822 |
+ */ |
1823 |
+ static int felix_setup_mmio_filtering(struct felix *felix) |
1824 |
+ { |
1825 |
+- unsigned long user_ports = 0, cpu_ports = 0; |
1826 |
++ unsigned long user_ports = dsa_user_ports(felix->ds); |
1827 |
+ struct ocelot_vcap_filter *redirect_rule; |
1828 |
+ struct ocelot_vcap_filter *tagging_rule; |
1829 |
+ struct ocelot *ocelot = &felix->ocelot; |
1830 |
+ struct dsa_switch *ds = felix->ds; |
1831 |
+- int port, ret; |
1832 |
++ int cpu = -1, port, ret; |
1833 |
+ |
1834 |
+ tagging_rule = kzalloc(sizeof(struct ocelot_vcap_filter), GFP_KERNEL); |
1835 |
+ if (!tagging_rule) |
1836 |
+@@ -289,12 +289,15 @@ static int felix_setup_mmio_filtering(struct felix *felix) |
1837 |
+ } |
1838 |
+ |
1839 |
+ for (port = 0; port < ocelot->num_phys_ports; port++) { |
1840 |
+- if (dsa_is_user_port(ds, port)) |
1841 |
+- user_ports |= BIT(port); |
1842 |
+- if (dsa_is_cpu_port(ds, port)) |
1843 |
+- cpu_ports |= BIT(port); |
1844 |
++ if (dsa_is_cpu_port(ds, port)) { |
1845 |
++ cpu = port; |
1846 |
++ break; |
1847 |
++ } |
1848 |
+ } |
1849 |
+ |
1850 |
++ if (cpu < 0) |
1851 |
++ return -EINVAL; |
1852 |
++ |
1853 |
+ tagging_rule->key_type = OCELOT_VCAP_KEY_ETYPE; |
1854 |
+ *(__be16 *)tagging_rule->key.etype.etype.value = htons(ETH_P_1588); |
1855 |
+ *(__be16 *)tagging_rule->key.etype.etype.mask = htons(0xffff); |
1856 |
+@@ -330,7 +333,7 @@ static int felix_setup_mmio_filtering(struct felix *felix) |
1857 |
+ * the CPU port module |
1858 |
+ */ |
1859 |
+ redirect_rule->action.mask_mode = OCELOT_MASK_MODE_REDIRECT; |
1860 |
+- redirect_rule->action.port_mask = cpu_ports; |
1861 |
++ redirect_rule->action.port_mask = BIT(cpu); |
1862 |
+ } else { |
1863 |
+ /* Trap PTP packets only to the CPU port module (which is |
1864 |
+ * redirected to the NPI port) |
1865 |
+@@ -1241,6 +1244,7 @@ static int felix_setup(struct dsa_switch *ds) |
1866 |
+ * there's no real point in checking for errors. |
1867 |
+ */ |
1868 |
+ felix_set_tag_protocol(ds, port, felix->tag_proto); |
1869 |
++ break; |
1870 |
+ } |
1871 |
+ |
1872 |
+ ds->mtu_enforcement_ingress = true; |
1873 |
+@@ -1277,6 +1281,7 @@ static void felix_teardown(struct dsa_switch *ds) |
1874 |
+ continue; |
1875 |
+ |
1876 |
+ felix_del_tag_protocol(ds, port, felix->tag_proto); |
1877 |
++ break; |
1878 |
+ } |
1879 |
+ |
1880 |
+ ocelot_devlink_sb_unregister(ocelot); |
1881 |
+@@ -1406,8 +1411,12 @@ static void felix_txtstamp(struct dsa_switch *ds, int port, |
1882 |
+ if (!ocelot->ptp) |
1883 |
+ return; |
1884 |
+ |
1885 |
+- if (ocelot_port_txtstamp_request(ocelot, port, skb, &clone)) |
1886 |
++ if (ocelot_port_txtstamp_request(ocelot, port, skb, &clone)) { |
1887 |
++ dev_err_ratelimited(ds->dev, |
1888 |
++ "port %d delivering skb without TX timestamp\n", |
1889 |
++ port); |
1890 |
+ return; |
1891 |
++ } |
1892 |
+ |
1893 |
+ if (clone) |
1894 |
+ OCELOT_SKB_CB(skb)->clone = clone; |
1895 |
+diff --git a/drivers/net/ethernet/Kconfig b/drivers/net/ethernet/Kconfig |
1896 |
+index 1cdff1dca790c..17d3da4605ec0 100644 |
1897 |
+--- a/drivers/net/ethernet/Kconfig |
1898 |
++++ b/drivers/net/ethernet/Kconfig |
1899 |
+@@ -100,6 +100,7 @@ config JME |
1900 |
+ config KORINA |
1901 |
+ tristate "Korina (IDT RC32434) Ethernet support" |
1902 |
+ depends on MIKROTIK_RB532 || COMPILE_TEST |
1903 |
++ select CRC32 |
1904 |
+ select MII |
1905 |
+ help |
1906 |
+ If you have a Mikrotik RouterBoard 500 or IDT RC32434 |
1907 |
+diff --git a/drivers/net/ethernet/arc/Kconfig b/drivers/net/ethernet/arc/Kconfig |
1908 |
+index 37a41773dd435..92a79c4ffa2c7 100644 |
1909 |
+--- a/drivers/net/ethernet/arc/Kconfig |
1910 |
++++ b/drivers/net/ethernet/arc/Kconfig |
1911 |
+@@ -21,6 +21,7 @@ config ARC_EMAC_CORE |
1912 |
+ depends on ARC || ARCH_ROCKCHIP || COMPILE_TEST |
1913 |
+ select MII |
1914 |
+ select PHYLIB |
1915 |
++ select CRC32 |
1916 |
+ |
1917 |
+ config ARC_EMAC |
1918 |
+ tristate "ARC EMAC support" |
1919 |
+diff --git a/drivers/net/ethernet/intel/ice/ice_ptp.c b/drivers/net/ethernet/intel/ice/ice_ptp.c |
1920 |
+index 234bc68e79f96..c2465b9d80567 100644 |
1921 |
+--- a/drivers/net/ethernet/intel/ice/ice_ptp.c |
1922 |
++++ b/drivers/net/ethernet/intel/ice/ice_ptp.c |
1923 |
+@@ -1324,22 +1324,21 @@ ice_ptp_flush_tx_tracker(struct ice_pf *pf, struct ice_ptp_tx *tx) |
1924 |
+ { |
1925 |
+ u8 idx; |
1926 |
+ |
1927 |
+- spin_lock(&tx->lock); |
1928 |
+- |
1929 |
+ for (idx = 0; idx < tx->len; idx++) { |
1930 |
+ u8 phy_idx = idx + tx->quad_offset; |
1931 |
+ |
1932 |
+- /* Clear any potential residual timestamp in the PHY block */ |
1933 |
+- if (!pf->hw.reset_ongoing) |
1934 |
+- ice_clear_phy_tstamp(&pf->hw, tx->quad, phy_idx); |
1935 |
+- |
1936 |
++ spin_lock(&tx->lock); |
1937 |
+ if (tx->tstamps[idx].skb) { |
1938 |
+ dev_kfree_skb_any(tx->tstamps[idx].skb); |
1939 |
+ tx->tstamps[idx].skb = NULL; |
1940 |
+ } |
1941 |
+- } |
1942 |
++ clear_bit(idx, tx->in_use); |
1943 |
++ spin_unlock(&tx->lock); |
1944 |
+ |
1945 |
+- spin_unlock(&tx->lock); |
1946 |
++ /* Clear any potential residual timestamp in the PHY block */ |
1947 |
++ if (!pf->hw.reset_ongoing) |
1948 |
++ ice_clear_phy_tstamp(&pf->hw, tx->quad, phy_idx); |
1949 |
++ } |
1950 |
+ } |
1951 |
+ |
1952 |
+ /** |
1953 |
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/cq.c b/drivers/net/ethernet/mellanox/mlx5/core/cq.c |
1954 |
+index 360e093874d4f..c74600be570ed 100644 |
1955 |
+--- a/drivers/net/ethernet/mellanox/mlx5/core/cq.c |
1956 |
++++ b/drivers/net/ethernet/mellanox/mlx5/core/cq.c |
1957 |
+@@ -154,6 +154,8 @@ int mlx5_core_destroy_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq) |
1958 |
+ u32 in[MLX5_ST_SZ_DW(destroy_cq_in)] = {}; |
1959 |
+ int err; |
1960 |
+ |
1961 |
++ mlx5_debug_cq_remove(dev, cq); |
1962 |
++ |
1963 |
+ mlx5_eq_del_cq(mlx5_get_async_eq(dev), cq); |
1964 |
+ mlx5_eq_del_cq(&cq->eq->core, cq); |
1965 |
+ |
1966 |
+@@ -161,16 +163,13 @@ int mlx5_core_destroy_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq) |
1967 |
+ MLX5_SET(destroy_cq_in, in, cqn, cq->cqn); |
1968 |
+ MLX5_SET(destroy_cq_in, in, uid, cq->uid); |
1969 |
+ err = mlx5_cmd_exec_in(dev, destroy_cq, in); |
1970 |
+- if (err) |
1971 |
+- return err; |
1972 |
+ |
1973 |
+ synchronize_irq(cq->irqn); |
1974 |
+ |
1975 |
+- mlx5_debug_cq_remove(dev, cq); |
1976 |
+ mlx5_cq_put(cq); |
1977 |
+ wait_for_completion(&cq->free); |
1978 |
+ |
1979 |
+- return 0; |
1980 |
++ return err; |
1981 |
+ } |
1982 |
+ EXPORT_SYMBOL(mlx5_core_destroy_cq); |
1983 |
+ |
1984 |
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c |
1985 |
+index 548e8e7fc956e..56fdcd487b9d7 100644 |
1986 |
+--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c |
1987 |
++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c |
1988 |
+@@ -3724,20 +3724,67 @@ static int set_feature_rx_all(struct net_device *netdev, bool enable) |
1989 |
+ return mlx5_set_port_fcs(mdev, !enable); |
1990 |
+ } |
1991 |
+ |
1992 |
++static int mlx5e_set_rx_port_ts(struct mlx5_core_dev *mdev, bool enable) |
1993 |
++{ |
1994 |
++ u32 in[MLX5_ST_SZ_DW(pcmr_reg)] = {}; |
1995 |
++ bool supported, curr_state; |
1996 |
++ int err; |
1997 |
++ |
1998 |
++ if (!MLX5_CAP_GEN(mdev, ports_check)) |
1999 |
++ return 0; |
2000 |
++ |
2001 |
++ err = mlx5_query_ports_check(mdev, in, sizeof(in)); |
2002 |
++ if (err) |
2003 |
++ return err; |
2004 |
++ |
2005 |
++ supported = MLX5_GET(pcmr_reg, in, rx_ts_over_crc_cap); |
2006 |
++ curr_state = MLX5_GET(pcmr_reg, in, rx_ts_over_crc); |
2007 |
++ |
2008 |
++ if (!supported || enable == curr_state) |
2009 |
++ return 0; |
2010 |
++ |
2011 |
++ MLX5_SET(pcmr_reg, in, local_port, 1); |
2012 |
++ MLX5_SET(pcmr_reg, in, rx_ts_over_crc, enable); |
2013 |
++ |
2014 |
++ return mlx5_set_ports_check(mdev, in, sizeof(in)); |
2015 |
++} |
2016 |
++ |
2017 |
+ static int set_feature_rx_fcs(struct net_device *netdev, bool enable) |
2018 |
+ { |
2019 |
+ struct mlx5e_priv *priv = netdev_priv(netdev); |
2020 |
++ struct mlx5e_channels *chs = &priv->channels; |
2021 |
++ struct mlx5_core_dev *mdev = priv->mdev; |
2022 |
+ int err; |
2023 |
+ |
2024 |
+ mutex_lock(&priv->state_lock); |
2025 |
+ |
2026 |
+- priv->channels.params.scatter_fcs_en = enable; |
2027 |
+- err = mlx5e_modify_channels_scatter_fcs(&priv->channels, enable); |
2028 |
+- if (err) |
2029 |
+- priv->channels.params.scatter_fcs_en = !enable; |
2030 |
++ if (enable) { |
2031 |
++ err = mlx5e_set_rx_port_ts(mdev, false); |
2032 |
++ if (err) |
2033 |
++ goto out; |
2034 |
+ |
2035 |
+- mutex_unlock(&priv->state_lock); |
2036 |
++ chs->params.scatter_fcs_en = true; |
2037 |
++ err = mlx5e_modify_channels_scatter_fcs(chs, true); |
2038 |
++ if (err) { |
2039 |
++ chs->params.scatter_fcs_en = false; |
2040 |
++ mlx5e_set_rx_port_ts(mdev, true); |
2041 |
++ } |
2042 |
++ } else { |
2043 |
++ chs->params.scatter_fcs_en = false; |
2044 |
++ err = mlx5e_modify_channels_scatter_fcs(chs, false); |
2045 |
++ if (err) { |
2046 |
++ chs->params.scatter_fcs_en = true; |
2047 |
++ goto out; |
2048 |
++ } |
2049 |
++ err = mlx5e_set_rx_port_ts(mdev, true); |
2050 |
++ if (err) { |
2051 |
++ mlx5_core_warn(mdev, "Failed to set RX port timestamp %d\n", err); |
2052 |
++ err = 0; |
2053 |
++ } |
2054 |
++ } |
2055 |
+ |
2056 |
++out: |
2057 |
++ mutex_unlock(&priv->state_lock); |
2058 |
+ return err; |
2059 |
+ } |
2060 |
+ |
2061 |
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c |
2062 |
+index bec1d344481cd..8b757d790f560 100644 |
2063 |
+--- a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c |
2064 |
++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c |
2065 |
+@@ -611,7 +611,6 @@ static void mlx5e_build_rep_netdev(struct net_device *netdev, |
2066 |
+ netdev->hw_features |= NETIF_F_RXCSUM; |
2067 |
+ |
2068 |
+ netdev->features |= netdev->hw_features; |
2069 |
+- netdev->features |= NETIF_F_VLAN_CHALLENGED; |
2070 |
+ netdev->features |= NETIF_F_NETNS_LOCAL; |
2071 |
+ } |
2072 |
+ |
2073 |
+diff --git a/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c b/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c |
2074 |
+index 0998dcc9cac04..b29824448aa85 100644 |
2075 |
+--- a/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c |
2076 |
++++ b/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c |
2077 |
+@@ -24,16 +24,8 @@ |
2078 |
+ #define MLXSW_THERMAL_ZONE_MAX_NAME 16 |
2079 |
+ #define MLXSW_THERMAL_TEMP_SCORE_MAX GENMASK(31, 0) |
2080 |
+ #define MLXSW_THERMAL_MAX_STATE 10 |
2081 |
++#define MLXSW_THERMAL_MIN_STATE 2 |
2082 |
+ #define MLXSW_THERMAL_MAX_DUTY 255 |
2083 |
+-/* Minimum and maximum fan allowed speed in percent: from 20% to 100%. Values |
2084 |
+- * MLXSW_THERMAL_MAX_STATE + x, where x is between 2 and 10 are used for |
2085 |
+- * setting fan speed dynamic minimum. For example, if value is set to 14 (40%) |
2086 |
+- * cooling levels vector will be set to 4, 4, 4, 4, 4, 5, 6, 7, 8, 9, 10 to |
2087 |
+- * introduce PWM speed in percent: 40, 40, 40, 40, 40, 50, 60. 70, 80, 90, 100. |
2088 |
+- */ |
2089 |
+-#define MLXSW_THERMAL_SPEED_MIN (MLXSW_THERMAL_MAX_STATE + 2) |
2090 |
+-#define MLXSW_THERMAL_SPEED_MAX (MLXSW_THERMAL_MAX_STATE * 2) |
2091 |
+-#define MLXSW_THERMAL_SPEED_MIN_LEVEL 2 /* 20% */ |
2092 |
+ |
2093 |
+ /* External cooling devices, allowed for binding to mlxsw thermal zones. */ |
2094 |
+ static char * const mlxsw_thermal_external_allowed_cdev[] = { |
2095 |
+@@ -646,49 +638,16 @@ static int mlxsw_thermal_set_cur_state(struct thermal_cooling_device *cdev, |
2096 |
+ struct mlxsw_thermal *thermal = cdev->devdata; |
2097 |
+ struct device *dev = thermal->bus_info->dev; |
2098 |
+ char mfsc_pl[MLXSW_REG_MFSC_LEN]; |
2099 |
+- unsigned long cur_state, i; |
2100 |
+ int idx; |
2101 |
+- u8 duty; |
2102 |
+ int err; |
2103 |
+ |
2104 |
++ if (state > MLXSW_THERMAL_MAX_STATE) |
2105 |
++ return -EINVAL; |
2106 |
++ |
2107 |
+ idx = mlxsw_get_cooling_device_idx(thermal, cdev); |
2108 |
+ if (idx < 0) |
2109 |
+ return idx; |
2110 |
+ |
2111 |
+- /* Verify if this request is for changing allowed fan dynamical |
2112 |
+- * minimum. If it is - update cooling levels accordingly and update |
2113 |
+- * state, if current state is below the newly requested minimum state. |
2114 |
+- * For example, if current state is 5, and minimal state is to be |
2115 |
+- * changed from 4 to 6, thermal->cooling_levels[0 to 5] will be changed |
2116 |
+- * all from 4 to 6. And state 5 (thermal->cooling_levels[4]) should be |
2117 |
+- * overwritten. |
2118 |
+- */ |
2119 |
+- if (state >= MLXSW_THERMAL_SPEED_MIN && |
2120 |
+- state <= MLXSW_THERMAL_SPEED_MAX) { |
2121 |
+- state -= MLXSW_THERMAL_MAX_STATE; |
2122 |
+- for (i = 0; i <= MLXSW_THERMAL_MAX_STATE; i++) |
2123 |
+- thermal->cooling_levels[i] = max(state, i); |
2124 |
+- |
2125 |
+- mlxsw_reg_mfsc_pack(mfsc_pl, idx, 0); |
2126 |
+- err = mlxsw_reg_query(thermal->core, MLXSW_REG(mfsc), mfsc_pl); |
2127 |
+- if (err) |
2128 |
+- return err; |
2129 |
+- |
2130 |
+- duty = mlxsw_reg_mfsc_pwm_duty_cycle_get(mfsc_pl); |
2131 |
+- cur_state = mlxsw_duty_to_state(duty); |
2132 |
+- |
2133 |
+- /* If current fan state is lower than requested dynamical |
2134 |
+- * minimum, increase fan speed up to dynamical minimum. |
2135 |
+- */ |
2136 |
+- if (state < cur_state) |
2137 |
+- return 0; |
2138 |
+- |
2139 |
+- state = cur_state; |
2140 |
+- } |
2141 |
+- |
2142 |
+- if (state > MLXSW_THERMAL_MAX_STATE) |
2143 |
+- return -EINVAL; |
2144 |
+- |
2145 |
+ /* Normalize the state to the valid speed range. */ |
2146 |
+ state = thermal->cooling_levels[state]; |
2147 |
+ mlxsw_reg_mfsc_pack(mfsc_pl, idx, mlxsw_state_to_duty(state)); |
2148 |
+@@ -998,8 +957,7 @@ int mlxsw_thermal_init(struct mlxsw_core *core, |
2149 |
+ |
2150 |
+ /* Initialize cooling levels per PWM state. */ |
2151 |
+ for (i = 0; i < MLXSW_THERMAL_MAX_STATE; i++) |
2152 |
+- thermal->cooling_levels[i] = max(MLXSW_THERMAL_SPEED_MIN_LEVEL, |
2153 |
+- i); |
2154 |
++ thermal->cooling_levels[i] = max(MLXSW_THERMAL_MIN_STATE, i); |
2155 |
+ |
2156 |
+ thermal->polling_delay = bus_info->low_frequency ? |
2157 |
+ MLXSW_THERMAL_SLOW_POLL_INT : |
2158 |
+diff --git a/drivers/net/ethernet/microchip/encx24j600-regmap.c b/drivers/net/ethernet/microchip/encx24j600-regmap.c |
2159 |
+index 796e46a539269..81a8ccca7e5e0 100644 |
2160 |
+--- a/drivers/net/ethernet/microchip/encx24j600-regmap.c |
2161 |
++++ b/drivers/net/ethernet/microchip/encx24j600-regmap.c |
2162 |
+@@ -497,13 +497,19 @@ static struct regmap_bus phymap_encx24j600 = { |
2163 |
+ .reg_read = regmap_encx24j600_phy_reg_read, |
2164 |
+ }; |
2165 |
+ |
2166 |
+-void devm_regmap_init_encx24j600(struct device *dev, |
2167 |
+- struct encx24j600_context *ctx) |
2168 |
++int devm_regmap_init_encx24j600(struct device *dev, |
2169 |
++ struct encx24j600_context *ctx) |
2170 |
+ { |
2171 |
+ mutex_init(&ctx->mutex); |
2172 |
+ regcfg.lock_arg = ctx; |
2173 |
+ ctx->regmap = devm_regmap_init(dev, ®map_encx24j600, ctx, ®cfg); |
2174 |
++ if (IS_ERR(ctx->regmap)) |
2175 |
++ return PTR_ERR(ctx->regmap); |
2176 |
+ ctx->phymap = devm_regmap_init(dev, &phymap_encx24j600, ctx, &phycfg); |
2177 |
++ if (IS_ERR(ctx->phymap)) |
2178 |
++ return PTR_ERR(ctx->phymap); |
2179 |
++ |
2180 |
++ return 0; |
2181 |
+ } |
2182 |
+ EXPORT_SYMBOL_GPL(devm_regmap_init_encx24j600); |
2183 |
+ |
2184 |
+diff --git a/drivers/net/ethernet/microchip/encx24j600.c b/drivers/net/ethernet/microchip/encx24j600.c |
2185 |
+index ee921a99e439a..0bc6b3176fbf0 100644 |
2186 |
+--- a/drivers/net/ethernet/microchip/encx24j600.c |
2187 |
++++ b/drivers/net/ethernet/microchip/encx24j600.c |
2188 |
+@@ -1023,10 +1023,13 @@ static int encx24j600_spi_probe(struct spi_device *spi) |
2189 |
+ priv->speed = SPEED_100; |
2190 |
+ |
2191 |
+ priv->ctx.spi = spi; |
2192 |
+- devm_regmap_init_encx24j600(&spi->dev, &priv->ctx); |
2193 |
+ ndev->irq = spi->irq; |
2194 |
+ ndev->netdev_ops = &encx24j600_netdev_ops; |
2195 |
+ |
2196 |
++ ret = devm_regmap_init_encx24j600(&spi->dev, &priv->ctx); |
2197 |
++ if (ret) |
2198 |
++ goto out_free; |
2199 |
++ |
2200 |
+ mutex_init(&priv->lock); |
2201 |
+ |
2202 |
+ /* Reset device and check if it is connected */ |
2203 |
+diff --git a/drivers/net/ethernet/microchip/encx24j600_hw.h b/drivers/net/ethernet/microchip/encx24j600_hw.h |
2204 |
+index fac61a8fbd020..34c5a289898c9 100644 |
2205 |
+--- a/drivers/net/ethernet/microchip/encx24j600_hw.h |
2206 |
++++ b/drivers/net/ethernet/microchip/encx24j600_hw.h |
2207 |
+@@ -15,8 +15,8 @@ struct encx24j600_context { |
2208 |
+ int bank; |
2209 |
+ }; |
2210 |
+ |
2211 |
+-void devm_regmap_init_encx24j600(struct device *dev, |
2212 |
+- struct encx24j600_context *ctx); |
2213 |
++int devm_regmap_init_encx24j600(struct device *dev, |
2214 |
++ struct encx24j600_context *ctx); |
2215 |
+ |
2216 |
+ /* Single-byte instructions */ |
2217 |
+ #define BANK_SELECT(bank) (0xC0 | ((bank & (BANK_MASK >> BANK_SHIFT)) << 1)) |
2218 |
+diff --git a/drivers/net/ethernet/mscc/ocelot.c b/drivers/net/ethernet/mscc/ocelot.c |
2219 |
+index 512dff9551669..acfbe94b52918 100644 |
2220 |
+--- a/drivers/net/ethernet/mscc/ocelot.c |
2221 |
++++ b/drivers/net/ethernet/mscc/ocelot.c |
2222 |
+@@ -536,20 +536,36 @@ void ocelot_port_disable(struct ocelot *ocelot, int port) |
2223 |
+ } |
2224 |
+ EXPORT_SYMBOL(ocelot_port_disable); |
2225 |
+ |
2226 |
+-static void ocelot_port_add_txtstamp_skb(struct ocelot *ocelot, int port, |
2227 |
+- struct sk_buff *clone) |
2228 |
++static int ocelot_port_add_txtstamp_skb(struct ocelot *ocelot, int port, |
2229 |
++ struct sk_buff *clone) |
2230 |
+ { |
2231 |
+ struct ocelot_port *ocelot_port = ocelot->ports[port]; |
2232 |
++ unsigned long flags; |
2233 |
+ |
2234 |
+- spin_lock(&ocelot_port->ts_id_lock); |
2235 |
++ spin_lock_irqsave(&ocelot->ts_id_lock, flags); |
2236 |
++ |
2237 |
++ if (ocelot_port->ptp_skbs_in_flight == OCELOT_MAX_PTP_ID || |
2238 |
++ ocelot->ptp_skbs_in_flight == OCELOT_PTP_FIFO_SIZE) { |
2239 |
++ spin_unlock_irqrestore(&ocelot->ts_id_lock, flags); |
2240 |
++ return -EBUSY; |
2241 |
++ } |
2242 |
+ |
2243 |
+ skb_shinfo(clone)->tx_flags |= SKBTX_IN_PROGRESS; |
2244 |
+ /* Store timestamp ID in OCELOT_SKB_CB(clone)->ts_id */ |
2245 |
+ OCELOT_SKB_CB(clone)->ts_id = ocelot_port->ts_id; |
2246 |
+- ocelot_port->ts_id = (ocelot_port->ts_id + 1) % 4; |
2247 |
++ |
2248 |
++ ocelot_port->ts_id++; |
2249 |
++ if (ocelot_port->ts_id == OCELOT_MAX_PTP_ID) |
2250 |
++ ocelot_port->ts_id = 0; |
2251 |
++ |
2252 |
++ ocelot_port->ptp_skbs_in_flight++; |
2253 |
++ ocelot->ptp_skbs_in_flight++; |
2254 |
++ |
2255 |
+ skb_queue_tail(&ocelot_port->tx_skbs, clone); |
2256 |
+ |
2257 |
+- spin_unlock(&ocelot_port->ts_id_lock); |
2258 |
++ spin_unlock_irqrestore(&ocelot->ts_id_lock, flags); |
2259 |
++ |
2260 |
++ return 0; |
2261 |
+ } |
2262 |
+ |
2263 |
+ u32 ocelot_ptp_rew_op(struct sk_buff *skb) |
2264 |
+@@ -569,16 +585,12 @@ u32 ocelot_ptp_rew_op(struct sk_buff *skb) |
2265 |
+ } |
2266 |
+ EXPORT_SYMBOL(ocelot_ptp_rew_op); |
2267 |
+ |
2268 |
+-static bool ocelot_ptp_is_onestep_sync(struct sk_buff *skb) |
2269 |
++static bool ocelot_ptp_is_onestep_sync(struct sk_buff *skb, |
2270 |
++ unsigned int ptp_class) |
2271 |
+ { |
2272 |
+ struct ptp_header *hdr; |
2273 |
+- unsigned int ptp_class; |
2274 |
+ u8 msgtype, twostep; |
2275 |
+ |
2276 |
+- ptp_class = ptp_classify_raw(skb); |
2277 |
+- if (ptp_class == PTP_CLASS_NONE) |
2278 |
+- return false; |
2279 |
+- |
2280 |
+ hdr = ptp_parse_header(skb, ptp_class); |
2281 |
+ if (!hdr) |
2282 |
+ return false; |
2283 |
+@@ -598,10 +610,20 @@ int ocelot_port_txtstamp_request(struct ocelot *ocelot, int port, |
2284 |
+ { |
2285 |
+ struct ocelot_port *ocelot_port = ocelot->ports[port]; |
2286 |
+ u8 ptp_cmd = ocelot_port->ptp_cmd; |
2287 |
++ unsigned int ptp_class; |
2288 |
++ int err; |
2289 |
++ |
2290 |
++ /* Don't do anything if PTP timestamping not enabled */ |
2291 |
++ if (!ptp_cmd) |
2292 |
++ return 0; |
2293 |
++ |
2294 |
++ ptp_class = ptp_classify_raw(skb); |
2295 |
++ if (ptp_class == PTP_CLASS_NONE) |
2296 |
++ return -EINVAL; |
2297 |
+ |
2298 |
+ /* Store ptp_cmd in OCELOT_SKB_CB(skb)->ptp_cmd */ |
2299 |
+ if (ptp_cmd == IFH_REW_OP_ORIGIN_PTP) { |
2300 |
+- if (ocelot_ptp_is_onestep_sync(skb)) { |
2301 |
++ if (ocelot_ptp_is_onestep_sync(skb, ptp_class)) { |
2302 |
+ OCELOT_SKB_CB(skb)->ptp_cmd = ptp_cmd; |
2303 |
+ return 0; |
2304 |
+ } |
2305 |
+@@ -615,8 +637,12 @@ int ocelot_port_txtstamp_request(struct ocelot *ocelot, int port, |
2306 |
+ if (!(*clone)) |
2307 |
+ return -ENOMEM; |
2308 |
+ |
2309 |
+- ocelot_port_add_txtstamp_skb(ocelot, port, *clone); |
2310 |
++ err = ocelot_port_add_txtstamp_skb(ocelot, port, *clone); |
2311 |
++ if (err) |
2312 |
++ return err; |
2313 |
++ |
2314 |
+ OCELOT_SKB_CB(skb)->ptp_cmd = ptp_cmd; |
2315 |
++ OCELOT_SKB_CB(*clone)->ptp_class = ptp_class; |
2316 |
+ } |
2317 |
+ |
2318 |
+ return 0; |
2319 |
+@@ -650,6 +676,17 @@ static void ocelot_get_hwtimestamp(struct ocelot *ocelot, |
2320 |
+ spin_unlock_irqrestore(&ocelot->ptp_clock_lock, flags); |
2321 |
+ } |
2322 |
+ |
2323 |
++static bool ocelot_validate_ptp_skb(struct sk_buff *clone, u16 seqid) |
2324 |
++{ |
2325 |
++ struct ptp_header *hdr; |
2326 |
++ |
2327 |
++ hdr = ptp_parse_header(clone, OCELOT_SKB_CB(clone)->ptp_class); |
2328 |
++ if (WARN_ON(!hdr)) |
2329 |
++ return false; |
2330 |
++ |
2331 |
++ return seqid == ntohs(hdr->sequence_id); |
2332 |
++} |
2333 |
++ |
2334 |
+ void ocelot_get_txtstamp(struct ocelot *ocelot) |
2335 |
+ { |
2336 |
+ int budget = OCELOT_PTP_QUEUE_SZ; |
2337 |
+@@ -657,10 +694,10 @@ void ocelot_get_txtstamp(struct ocelot *ocelot) |
2338 |
+ while (budget--) { |
2339 |
+ struct sk_buff *skb, *skb_tmp, *skb_match = NULL; |
2340 |
+ struct skb_shared_hwtstamps shhwtstamps; |
2341 |
++ u32 val, id, seqid, txport; |
2342 |
+ struct ocelot_port *port; |
2343 |
+ struct timespec64 ts; |
2344 |
+ unsigned long flags; |
2345 |
+- u32 val, id, txport; |
2346 |
+ |
2347 |
+ val = ocelot_read(ocelot, SYS_PTP_STATUS); |
2348 |
+ |
2349 |
+@@ -673,10 +710,17 @@ void ocelot_get_txtstamp(struct ocelot *ocelot) |
2350 |
+ /* Retrieve the ts ID and Tx port */ |
2351 |
+ id = SYS_PTP_STATUS_PTP_MESS_ID_X(val); |
2352 |
+ txport = SYS_PTP_STATUS_PTP_MESS_TXPORT_X(val); |
2353 |
++ seqid = SYS_PTP_STATUS_PTP_MESS_SEQ_ID(val); |
2354 |
+ |
2355 |
+- /* Retrieve its associated skb */ |
2356 |
+ port = ocelot->ports[txport]; |
2357 |
+ |
2358 |
++ spin_lock(&ocelot->ts_id_lock); |
2359 |
++ port->ptp_skbs_in_flight--; |
2360 |
++ ocelot->ptp_skbs_in_flight--; |
2361 |
++ spin_unlock(&ocelot->ts_id_lock); |
2362 |
++ |
2363 |
++ /* Retrieve its associated skb */ |
2364 |
++try_again: |
2365 |
+ spin_lock_irqsave(&port->tx_skbs.lock, flags); |
2366 |
+ |
2367 |
+ skb_queue_walk_safe(&port->tx_skbs, skb, skb_tmp) { |
2368 |
+@@ -689,12 +733,20 @@ void ocelot_get_txtstamp(struct ocelot *ocelot) |
2369 |
+ |
2370 |
+ spin_unlock_irqrestore(&port->tx_skbs.lock, flags); |
2371 |
+ |
2372 |
++ if (WARN_ON(!skb_match)) |
2373 |
++ continue; |
2374 |
++ |
2375 |
++ if (!ocelot_validate_ptp_skb(skb_match, seqid)) { |
2376 |
++ dev_err_ratelimited(ocelot->dev, |
2377 |
++ "port %d received stale TX timestamp for seqid %d, discarding\n", |
2378 |
++ txport, seqid); |
2379 |
++ dev_kfree_skb_any(skb); |
2380 |
++ goto try_again; |
2381 |
++ } |
2382 |
++ |
2383 |
+ /* Get the h/w timestamp */ |
2384 |
+ ocelot_get_hwtimestamp(ocelot, &ts); |
2385 |
+ |
2386 |
+- if (unlikely(!skb_match)) |
2387 |
+- continue; |
2388 |
+- |
2389 |
+ /* Set the timestamp into the skb */ |
2390 |
+ memset(&shhwtstamps, 0, sizeof(shhwtstamps)); |
2391 |
+ shhwtstamps.hwtstamp = ktime_set(ts.tv_sec, ts.tv_nsec); |
2392 |
+@@ -1915,7 +1967,6 @@ void ocelot_init_port(struct ocelot *ocelot, int port) |
2393 |
+ struct ocelot_port *ocelot_port = ocelot->ports[port]; |
2394 |
+ |
2395 |
+ skb_queue_head_init(&ocelot_port->tx_skbs); |
2396 |
+- spin_lock_init(&ocelot_port->ts_id_lock); |
2397 |
+ |
2398 |
+ /* Basic L2 initialization */ |
2399 |
+ |
2400 |
+@@ -2039,6 +2090,7 @@ int ocelot_init(struct ocelot *ocelot) |
2401 |
+ mutex_init(&ocelot->stats_lock); |
2402 |
+ mutex_init(&ocelot->ptp_lock); |
2403 |
+ spin_lock_init(&ocelot->ptp_clock_lock); |
2404 |
++ spin_lock_init(&ocelot->ts_id_lock); |
2405 |
+ snprintf(queue_name, sizeof(queue_name), "%s-stats", |
2406 |
+ dev_name(ocelot->dev)); |
2407 |
+ ocelot->stats_queue = create_singlethread_workqueue(queue_name); |
2408 |
+diff --git a/drivers/net/ethernet/neterion/s2io.c b/drivers/net/ethernet/neterion/s2io.c |
2409 |
+index 0b017d4f5c085..a988ed360185b 100644 |
2410 |
+--- a/drivers/net/ethernet/neterion/s2io.c |
2411 |
++++ b/drivers/net/ethernet/neterion/s2io.c |
2412 |
+@@ -8566,7 +8566,7 @@ static void s2io_io_resume(struct pci_dev *pdev) |
2413 |
+ return; |
2414 |
+ } |
2415 |
+ |
2416 |
+- if (s2io_set_mac_addr(netdev, netdev->dev_addr) == FAILURE) { |
2417 |
++ if (do_s2io_prog_unicast(netdev, netdev->dev_addr) == FAILURE) { |
2418 |
+ s2io_card_down(sp); |
2419 |
+ pr_err("Can't restore mac addr after reset.\n"); |
2420 |
+ return; |
2421 |
+diff --git a/drivers/net/ethernet/netronome/nfp/flower/main.c b/drivers/net/ethernet/netronome/nfp/flower/main.c |
2422 |
+index c029950a81e20..ac1dcfa1d1790 100644 |
2423 |
+--- a/drivers/net/ethernet/netronome/nfp/flower/main.c |
2424 |
++++ b/drivers/net/ethernet/netronome/nfp/flower/main.c |
2425 |
+@@ -830,10 +830,6 @@ static int nfp_flower_init(struct nfp_app *app) |
2426 |
+ if (err) |
2427 |
+ goto err_cleanup; |
2428 |
+ |
2429 |
+- err = flow_indr_dev_register(nfp_flower_indr_setup_tc_cb, app); |
2430 |
+- if (err) |
2431 |
+- goto err_cleanup; |
2432 |
+- |
2433 |
+ if (app_priv->flower_ext_feats & NFP_FL_FEATS_VF_RLIM) |
2434 |
+ nfp_flower_qos_init(app); |
2435 |
+ |
2436 |
+@@ -942,7 +938,20 @@ static int nfp_flower_start(struct nfp_app *app) |
2437 |
+ return err; |
2438 |
+ } |
2439 |
+ |
2440 |
+- return nfp_tunnel_config_start(app); |
2441 |
++ err = flow_indr_dev_register(nfp_flower_indr_setup_tc_cb, app); |
2442 |
++ if (err) |
2443 |
++ return err; |
2444 |
++ |
2445 |
++ err = nfp_tunnel_config_start(app); |
2446 |
++ if (err) |
2447 |
++ goto err_tunnel_config; |
2448 |
++ |
2449 |
++ return 0; |
2450 |
++ |
2451 |
++err_tunnel_config: |
2452 |
++ flow_indr_dev_unregister(nfp_flower_indr_setup_tc_cb, app, |
2453 |
++ nfp_flower_setup_indr_tc_release); |
2454 |
++ return err; |
2455 |
+ } |
2456 |
+ |
2457 |
+ static void nfp_flower_stop(struct nfp_app *app) |
2458 |
+diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.c b/drivers/net/ethernet/pensando/ionic/ionic_lif.c |
2459 |
+index e795fa63ca12e..14429d2900f2f 100644 |
2460 |
+--- a/drivers/net/ethernet/pensando/ionic/ionic_lif.c |
2461 |
++++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.c |
2462 |
+@@ -1357,6 +1357,10 @@ static int ionic_addr_add(struct net_device *netdev, const u8 *addr) |
2463 |
+ |
2464 |
+ static int ionic_addr_del(struct net_device *netdev, const u8 *addr) |
2465 |
+ { |
2466 |
++ /* Don't delete our own address from the uc list */ |
2467 |
++ if (ether_addr_equal(addr, netdev->dev_addr)) |
2468 |
++ return 0; |
2469 |
++ |
2470 |
+ return ionic_lif_addr(netdev_priv(netdev), addr, DEL_ADDR); |
2471 |
+ } |
2472 |
+ |
2473 |
+diff --git a/drivers/net/ethernet/qlogic/qed/qed_main.c b/drivers/net/ethernet/qlogic/qed/qed_main.c |
2474 |
+index 6bb9ec98a12b5..41bc31e3f9356 100644 |
2475 |
+--- a/drivers/net/ethernet/qlogic/qed/qed_main.c |
2476 |
++++ b/drivers/net/ethernet/qlogic/qed/qed_main.c |
2477 |
+@@ -1295,6 +1295,7 @@ static int qed_slowpath_start(struct qed_dev *cdev, |
2478 |
+ } else { |
2479 |
+ DP_NOTICE(cdev, |
2480 |
+ "Failed to acquire PTT for aRFS\n"); |
2481 |
++ rc = -EINVAL; |
2482 |
+ goto err; |
2483 |
+ } |
2484 |
+ } |
2485 |
+diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac1000_dma.c b/drivers/net/ethernet/stmicro/stmmac/dwmac1000_dma.c |
2486 |
+index 90383abafa66a..f5581db0ba9ba 100644 |
2487 |
+--- a/drivers/net/ethernet/stmicro/stmmac/dwmac1000_dma.c |
2488 |
++++ b/drivers/net/ethernet/stmicro/stmmac/dwmac1000_dma.c |
2489 |
+@@ -218,11 +218,18 @@ static void dwmac1000_dump_dma_regs(void __iomem *ioaddr, u32 *reg_space) |
2490 |
+ readl(ioaddr + DMA_BUS_MODE + i * 4); |
2491 |
+ } |
2492 |
+ |
2493 |
+-static void dwmac1000_get_hw_feature(void __iomem *ioaddr, |
2494 |
+- struct dma_features *dma_cap) |
2495 |
++static int dwmac1000_get_hw_feature(void __iomem *ioaddr, |
2496 |
++ struct dma_features *dma_cap) |
2497 |
+ { |
2498 |
+ u32 hw_cap = readl(ioaddr + DMA_HW_FEATURE); |
2499 |
+ |
2500 |
++ if (!hw_cap) { |
2501 |
++ /* 0x00000000 is the value read on old hardware that does not |
2502 |
++ * implement this register |
2503 |
++ */ |
2504 |
++ return -EOPNOTSUPP; |
2505 |
++ } |
2506 |
++ |
2507 |
+ dma_cap->mbps_10_100 = (hw_cap & DMA_HW_FEAT_MIISEL); |
2508 |
+ dma_cap->mbps_1000 = (hw_cap & DMA_HW_FEAT_GMIISEL) >> 1; |
2509 |
+ dma_cap->half_duplex = (hw_cap & DMA_HW_FEAT_HDSEL) >> 2; |
2510 |
+@@ -252,6 +259,8 @@ static void dwmac1000_get_hw_feature(void __iomem *ioaddr, |
2511 |
+ dma_cap->number_tx_channel = (hw_cap & DMA_HW_FEAT_TXCHCNT) >> 22; |
2512 |
+ /* Alternate (enhanced) DESC mode */ |
2513 |
+ dma_cap->enh_desc = (hw_cap & DMA_HW_FEAT_ENHDESSEL) >> 24; |
2514 |
++ |
2515 |
++ return 0; |
2516 |
+ } |
2517 |
+ |
2518 |
+ static void dwmac1000_rx_watchdog(void __iomem *ioaddr, u32 riwt, |
2519 |
+diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c |
2520 |
+index 5be8e6a631d9b..d99fa028c6468 100644 |
2521 |
+--- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c |
2522 |
++++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c |
2523 |
+@@ -347,8 +347,8 @@ static void dwmac4_dma_tx_chan_op_mode(void __iomem *ioaddr, int mode, |
2524 |
+ writel(mtl_tx_op, ioaddr + MTL_CHAN_TX_OP_MODE(channel)); |
2525 |
+ } |
2526 |
+ |
2527 |
+-static void dwmac4_get_hw_feature(void __iomem *ioaddr, |
2528 |
+- struct dma_features *dma_cap) |
2529 |
++static int dwmac4_get_hw_feature(void __iomem *ioaddr, |
2530 |
++ struct dma_features *dma_cap) |
2531 |
+ { |
2532 |
+ u32 hw_cap = readl(ioaddr + GMAC_HW_FEATURE0); |
2533 |
+ |
2534 |
+@@ -437,6 +437,8 @@ static void dwmac4_get_hw_feature(void __iomem *ioaddr, |
2535 |
+ dma_cap->frpbs = (hw_cap & GMAC_HW_FEAT_FRPBS) >> 11; |
2536 |
+ dma_cap->frpsel = (hw_cap & GMAC_HW_FEAT_FRPSEL) >> 10; |
2537 |
+ dma_cap->dvlan = (hw_cap & GMAC_HW_FEAT_DVLAN) >> 5; |
2538 |
++ |
2539 |
++ return 0; |
2540 |
+ } |
2541 |
+ |
2542 |
+ /* Enable/disable TSO feature and set MSS */ |
2543 |
+diff --git a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c |
2544 |
+index 906e985441a93..5e98355f422b3 100644 |
2545 |
+--- a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c |
2546 |
++++ b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c |
2547 |
+@@ -371,8 +371,8 @@ static int dwxgmac2_dma_interrupt(void __iomem *ioaddr, |
2548 |
+ return ret; |
2549 |
+ } |
2550 |
+ |
2551 |
+-static void dwxgmac2_get_hw_feature(void __iomem *ioaddr, |
2552 |
+- struct dma_features *dma_cap) |
2553 |
++static int dwxgmac2_get_hw_feature(void __iomem *ioaddr, |
2554 |
++ struct dma_features *dma_cap) |
2555 |
+ { |
2556 |
+ u32 hw_cap; |
2557 |
+ |
2558 |
+@@ -445,6 +445,8 @@ static void dwxgmac2_get_hw_feature(void __iomem *ioaddr, |
2559 |
+ dma_cap->frpes = (hw_cap & XGMAC_HWFEAT_FRPES) >> 11; |
2560 |
+ dma_cap->frpbs = (hw_cap & XGMAC_HWFEAT_FRPPB) >> 9; |
2561 |
+ dma_cap->frpsel = (hw_cap & XGMAC_HWFEAT_FRPSEL) >> 3; |
2562 |
++ |
2563 |
++ return 0; |
2564 |
+ } |
2565 |
+ |
2566 |
+ static void dwxgmac2_rx_watchdog(void __iomem *ioaddr, u32 riwt, u32 queue) |
2567 |
+diff --git a/drivers/net/ethernet/stmicro/stmmac/hwif.h b/drivers/net/ethernet/stmicro/stmmac/hwif.h |
2568 |
+index 6dc1c98ebec82..fe2660d5694d7 100644 |
2569 |
+--- a/drivers/net/ethernet/stmicro/stmmac/hwif.h |
2570 |
++++ b/drivers/net/ethernet/stmicro/stmmac/hwif.h |
2571 |
+@@ -203,8 +203,8 @@ struct stmmac_dma_ops { |
2572 |
+ int (*dma_interrupt) (void __iomem *ioaddr, |
2573 |
+ struct stmmac_extra_stats *x, u32 chan, u32 dir); |
2574 |
+ /* If supported then get the optional core features */ |
2575 |
+- void (*get_hw_feature)(void __iomem *ioaddr, |
2576 |
+- struct dma_features *dma_cap); |
2577 |
++ int (*get_hw_feature)(void __iomem *ioaddr, |
2578 |
++ struct dma_features *dma_cap); |
2579 |
+ /* Program the HW RX Watchdog */ |
2580 |
+ void (*rx_watchdog)(void __iomem *ioaddr, u32 riwt, u32 queue); |
2581 |
+ void (*set_tx_ring_len)(void __iomem *ioaddr, u32 len, u32 chan); |
2582 |
+@@ -255,7 +255,7 @@ struct stmmac_dma_ops { |
2583 |
+ #define stmmac_dma_interrupt_status(__priv, __args...) \ |
2584 |
+ stmmac_do_callback(__priv, dma, dma_interrupt, __args) |
2585 |
+ #define stmmac_get_hw_feature(__priv, __args...) \ |
2586 |
+- stmmac_do_void_callback(__priv, dma, get_hw_feature, __args) |
2587 |
++ stmmac_do_callback(__priv, dma, get_hw_feature, __args) |
2588 |
+ #define stmmac_rx_watchdog(__priv, __args...) \ |
2589 |
+ stmmac_do_void_callback(__priv, dma, rx_watchdog, __args) |
2590 |
+ #define stmmac_set_tx_ring_len(__priv, __args...) \ |
2591 |
+diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c |
2592 |
+index 5d5f9a9ee768a..787462310aae3 100644 |
2593 |
+--- a/drivers/net/phy/phy_device.c |
2594 |
++++ b/drivers/net/phy/phy_device.c |
2595 |
+@@ -3112,6 +3112,9 @@ static void phy_shutdown(struct device *dev) |
2596 |
+ { |
2597 |
+ struct phy_device *phydev = to_phy_device(dev); |
2598 |
+ |
2599 |
++ if (phydev->state == PHY_READY || !phydev->attached_dev) |
2600 |
++ return; |
2601 |
++ |
2602 |
+ phy_disable_interrupts(phydev); |
2603 |
+ } |
2604 |
+ |
2605 |
+diff --git a/drivers/net/usb/Kconfig b/drivers/net/usb/Kconfig |
2606 |
+index 4c5d69732a7e1..f87f175033731 100644 |
2607 |
+--- a/drivers/net/usb/Kconfig |
2608 |
++++ b/drivers/net/usb/Kconfig |
2609 |
+@@ -99,6 +99,10 @@ config USB_RTL8150 |
2610 |
+ config USB_RTL8152 |
2611 |
+ tristate "Realtek RTL8152/RTL8153 Based USB Ethernet Adapters" |
2612 |
+ select MII |
2613 |
++ select CRC32 |
2614 |
++ select CRYPTO |
2615 |
++ select CRYPTO_HASH |
2616 |
++ select CRYPTO_SHA256 |
2617 |
+ help |
2618 |
+ This option adds support for Realtek RTL8152 based USB 2.0 |
2619 |
+ 10/100 Ethernet adapters and RTL8153 based USB 3.0 10/100/1000 |
2620 |
+diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c |
2621 |
+index 4f22fbafe964f..1f41619018c16 100644 |
2622 |
+--- a/drivers/nvme/host/pci.c |
2623 |
++++ b/drivers/nvme/host/pci.c |
2624 |
+@@ -1331,7 +1331,7 @@ static enum blk_eh_timer_return nvme_timeout(struct request *req, bool reserved) |
2625 |
+ iod->aborted = 1; |
2626 |
+ |
2627 |
+ cmd.abort.opcode = nvme_admin_abort_cmd; |
2628 |
+- cmd.abort.cid = req->tag; |
2629 |
++ cmd.abort.cid = nvme_cid(req); |
2630 |
+ cmd.abort.sqid = cpu_to_le16(nvmeq->qid); |
2631 |
+ |
2632 |
+ dev_warn(nvmeq->dev->ctrl.device, |
2633 |
+diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c |
2634 |
+index 3d87fadaa160d..8976da38b375a 100644 |
2635 |
+--- a/drivers/nvmem/core.c |
2636 |
++++ b/drivers/nvmem/core.c |
2637 |
+@@ -1383,7 +1383,8 @@ static void nvmem_shift_read_buffer_in_place(struct nvmem_cell *cell, void *buf) |
2638 |
+ *p-- = 0; |
2639 |
+ |
2640 |
+ /* clear msb bits if any leftover in the last byte */ |
2641 |
+- *p &= GENMASK((cell->nbits%BITS_PER_BYTE) - 1, 0); |
2642 |
++ if (cell->nbits % BITS_PER_BYTE) |
2643 |
++ *p &= GENMASK((cell->nbits % BITS_PER_BYTE) - 1, 0); |
2644 |
+ } |
2645 |
+ |
2646 |
+ static int __nvmem_cell_read(struct nvmem_device *nvmem, |
2647 |
+diff --git a/drivers/platform/mellanox/mlxreg-io.c b/drivers/platform/mellanox/mlxreg-io.c |
2648 |
+index 7646708d57e42..a916cd89cbbed 100644 |
2649 |
+--- a/drivers/platform/mellanox/mlxreg-io.c |
2650 |
++++ b/drivers/platform/mellanox/mlxreg-io.c |
2651 |
+@@ -98,7 +98,7 @@ mlxreg_io_get_reg(void *regmap, struct mlxreg_core_data *data, u32 in_val, |
2652 |
+ if (ret) |
2653 |
+ goto access_error; |
2654 |
+ |
2655 |
+- *regval |= rol32(val, regsize * i); |
2656 |
++ *regval |= rol32(val, regsize * i * 8); |
2657 |
+ } |
2658 |
+ } |
2659 |
+ |
2660 |
+@@ -141,7 +141,7 @@ mlxreg_io_attr_store(struct device *dev, struct device_attribute *attr, |
2661 |
+ return -EINVAL; |
2662 |
+ |
2663 |
+ /* Convert buffer to input value. */ |
2664 |
+- ret = kstrtou32(buf, len, &input_val); |
2665 |
++ ret = kstrtou32(buf, 0, &input_val); |
2666 |
+ if (ret) |
2667 |
+ return ret; |
2668 |
+ |
2669 |
+diff --git a/drivers/platform/x86/amd-pmc.c b/drivers/platform/x86/amd-pmc.c |
2670 |
+index d6a7c896ac866..fc95620101e85 100644 |
2671 |
+--- a/drivers/platform/x86/amd-pmc.c |
2672 |
++++ b/drivers/platform/x86/amd-pmc.c |
2673 |
+@@ -476,6 +476,7 @@ static const struct acpi_device_id amd_pmc_acpi_ids[] = { |
2674 |
+ {"AMDI0006", 0}, |
2675 |
+ {"AMDI0007", 0}, |
2676 |
+ {"AMD0004", 0}, |
2677 |
++ {"AMD0005", 0}, |
2678 |
+ { } |
2679 |
+ }; |
2680 |
+ MODULE_DEVICE_TABLE(acpi, amd_pmc_acpi_ids); |
2681 |
+diff --git a/drivers/platform/x86/gigabyte-wmi.c b/drivers/platform/x86/gigabyte-wmi.c |
2682 |
+index d53634c8a6e09..658bab4b79648 100644 |
2683 |
+--- a/drivers/platform/x86/gigabyte-wmi.c |
2684 |
++++ b/drivers/platform/x86/gigabyte-wmi.c |
2685 |
+@@ -141,6 +141,7 @@ static u8 gigabyte_wmi_detect_sensor_usability(struct wmi_device *wdev) |
2686 |
+ |
2687 |
+ static const struct dmi_system_id gigabyte_wmi_known_working_platforms[] = { |
2688 |
+ DMI_EXACT_MATCH_GIGABYTE_BOARD_NAME("B450M S2H V2"), |
2689 |
++ DMI_EXACT_MATCH_GIGABYTE_BOARD_NAME("B550 AORUS ELITE AX V2"), |
2690 |
+ DMI_EXACT_MATCH_GIGABYTE_BOARD_NAME("B550 AORUS ELITE"), |
2691 |
+ DMI_EXACT_MATCH_GIGABYTE_BOARD_NAME("B550 AORUS ELITE V2"), |
2692 |
+ DMI_EXACT_MATCH_GIGABYTE_BOARD_NAME("B550 GAMING X V2"), |
2693 |
+diff --git a/drivers/platform/x86/intel_scu_ipc.c b/drivers/platform/x86/intel_scu_ipc.c |
2694 |
+index 9171a46a9e3fe..25b98b12439f1 100644 |
2695 |
+--- a/drivers/platform/x86/intel_scu_ipc.c |
2696 |
++++ b/drivers/platform/x86/intel_scu_ipc.c |
2697 |
+@@ -232,7 +232,7 @@ static inline u32 ipc_data_readl(struct intel_scu_ipc_dev *scu, u32 offset) |
2698 |
+ /* Wait till scu status is busy */ |
2699 |
+ static inline int busy_loop(struct intel_scu_ipc_dev *scu) |
2700 |
+ { |
2701 |
+- unsigned long end = jiffies + msecs_to_jiffies(IPC_TIMEOUT); |
2702 |
++ unsigned long end = jiffies + IPC_TIMEOUT; |
2703 |
+ |
2704 |
+ do { |
2705 |
+ u32 status; |
2706 |
+diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c |
2707 |
+index 788dcdf25f003..f872cf196c2f3 100644 |
2708 |
+--- a/drivers/spi/spi-atmel.c |
2709 |
++++ b/drivers/spi/spi-atmel.c |
2710 |
+@@ -1301,7 +1301,7 @@ static int atmel_spi_one_transfer(struct spi_master *master, |
2711 |
+ * DMA map early, for performance (empties dcache ASAP) and |
2712 |
+ * better fault reporting. |
2713 |
+ */ |
2714 |
+- if ((!master->cur_msg_mapped) |
2715 |
++ if ((!master->cur_msg->is_dma_mapped) |
2716 |
+ && as->use_pdc) { |
2717 |
+ if (atmel_spi_dma_map_xfer(as, xfer) < 0) |
2718 |
+ return -ENOMEM; |
2719 |
+@@ -1381,7 +1381,7 @@ static int atmel_spi_one_transfer(struct spi_master *master, |
2720 |
+ } |
2721 |
+ } |
2722 |
+ |
2723 |
+- if (!master->cur_msg_mapped |
2724 |
++ if (!master->cur_msg->is_dma_mapped |
2725 |
+ && as->use_pdc) |
2726 |
+ atmel_spi_dma_unmap_xfer(master, xfer); |
2727 |
+ |
2728 |
+diff --git a/drivers/spi/spi-bcm-qspi.c b/drivers/spi/spi-bcm-qspi.c |
2729 |
+index a78e56f566dd8..3043677ba2226 100644 |
2730 |
+--- a/drivers/spi/spi-bcm-qspi.c |
2731 |
++++ b/drivers/spi/spi-bcm-qspi.c |
2732 |
+@@ -1250,10 +1250,14 @@ static void bcm_qspi_hw_init(struct bcm_qspi *qspi) |
2733 |
+ |
2734 |
+ static void bcm_qspi_hw_uninit(struct bcm_qspi *qspi) |
2735 |
+ { |
2736 |
++ u32 status = bcm_qspi_read(qspi, MSPI, MSPI_MSPI_STATUS); |
2737 |
++ |
2738 |
+ bcm_qspi_write(qspi, MSPI, MSPI_SPCR2, 0); |
2739 |
+ if (has_bspi(qspi)) |
2740 |
+ bcm_qspi_write(qspi, MSPI, MSPI_WRITE_LOCK, 0); |
2741 |
+ |
2742 |
++ /* clear interrupt */ |
2743 |
++ bcm_qspi_write(qspi, MSPI, MSPI_MSPI_STATUS, status & ~1); |
2744 |
+ } |
2745 |
+ |
2746 |
+ static const struct spi_controller_mem_ops bcm_qspi_mem_ops = { |
2747 |
+@@ -1397,6 +1401,47 @@ int bcm_qspi_probe(struct platform_device *pdev, |
2748 |
+ if (!qspi->dev_ids) |
2749 |
+ return -ENOMEM; |
2750 |
+ |
2751 |
++ /* |
2752 |
++ * Some SoCs integrate spi controller (e.g., its interrupt bits) |
2753 |
++ * in specific ways |
2754 |
++ */ |
2755 |
++ if (soc_intc) { |
2756 |
++ qspi->soc_intc = soc_intc; |
2757 |
++ soc_intc->bcm_qspi_int_set(soc_intc, MSPI_DONE, true); |
2758 |
++ } else { |
2759 |
++ qspi->soc_intc = NULL; |
2760 |
++ } |
2761 |
++ |
2762 |
++ if (qspi->clk) { |
2763 |
++ ret = clk_prepare_enable(qspi->clk); |
2764 |
++ if (ret) { |
2765 |
++ dev_err(dev, "failed to prepare clock\n"); |
2766 |
++ goto qspi_probe_err; |
2767 |
++ } |
2768 |
++ qspi->base_clk = clk_get_rate(qspi->clk); |
2769 |
++ } else { |
2770 |
++ qspi->base_clk = MSPI_BASE_FREQ; |
2771 |
++ } |
2772 |
++ |
2773 |
++ if (data->has_mspi_rev) { |
2774 |
++ rev = bcm_qspi_read(qspi, MSPI, MSPI_REV); |
2775 |
++ /* some older revs do not have a MSPI_REV register */ |
2776 |
++ if ((rev & 0xff) == 0xff) |
2777 |
++ rev = 0; |
2778 |
++ } |
2779 |
++ |
2780 |
++ qspi->mspi_maj_rev = (rev >> 4) & 0xf; |
2781 |
++ qspi->mspi_min_rev = rev & 0xf; |
2782 |
++ qspi->mspi_spcr3_sysclk = data->has_spcr3_sysclk; |
2783 |
++ |
2784 |
++ qspi->max_speed_hz = qspi->base_clk / (bcm_qspi_spbr_min(qspi) * 2); |
2785 |
++ |
2786 |
++ /* |
2787 |
++ * On SW resets it is possible to have the mask still enabled |
2788 |
++ * Need to disable the mask and clear the status while we init |
2789 |
++ */ |
2790 |
++ bcm_qspi_hw_uninit(qspi); |
2791 |
++ |
2792 |
+ for (val = 0; val < num_irqs; val++) { |
2793 |
+ irq = -1; |
2794 |
+ name = qspi_irq_tab[val].irq_name; |
2795 |
+@@ -1433,38 +1478,6 @@ int bcm_qspi_probe(struct platform_device *pdev, |
2796 |
+ goto qspi_probe_err; |
2797 |
+ } |
2798 |
+ |
2799 |
+- /* |
2800 |
+- * Some SoCs integrate spi controller (e.g., its interrupt bits) |
2801 |
+- * in specific ways |
2802 |
+- */ |
2803 |
+- if (soc_intc) { |
2804 |
+- qspi->soc_intc = soc_intc; |
2805 |
+- soc_intc->bcm_qspi_int_set(soc_intc, MSPI_DONE, true); |
2806 |
+- } else { |
2807 |
+- qspi->soc_intc = NULL; |
2808 |
+- } |
2809 |
+- |
2810 |
+- ret = clk_prepare_enable(qspi->clk); |
2811 |
+- if (ret) { |
2812 |
+- dev_err(dev, "failed to prepare clock\n"); |
2813 |
+- goto qspi_probe_err; |
2814 |
+- } |
2815 |
+- |
2816 |
+- qspi->base_clk = clk_get_rate(qspi->clk); |
2817 |
+- |
2818 |
+- if (data->has_mspi_rev) { |
2819 |
+- rev = bcm_qspi_read(qspi, MSPI, MSPI_REV); |
2820 |
+- /* some older revs do not have a MSPI_REV register */ |
2821 |
+- if ((rev & 0xff) == 0xff) |
2822 |
+- rev = 0; |
2823 |
+- } |
2824 |
+- |
2825 |
+- qspi->mspi_maj_rev = (rev >> 4) & 0xf; |
2826 |
+- qspi->mspi_min_rev = rev & 0xf; |
2827 |
+- qspi->mspi_spcr3_sysclk = data->has_spcr3_sysclk; |
2828 |
+- |
2829 |
+- qspi->max_speed_hz = qspi->base_clk / (bcm_qspi_spbr_min(qspi) * 2); |
2830 |
+- |
2831 |
+ bcm_qspi_hw_init(qspi); |
2832 |
+ init_completion(&qspi->mspi_done); |
2833 |
+ init_completion(&qspi->bspi_done); |
2834 |
+diff --git a/drivers/spi/spidev.c b/drivers/spi/spidev.c |
2835 |
+index 24e9469ea35bb..515466c60f77f 100644 |
2836 |
+--- a/drivers/spi/spidev.c |
2837 |
++++ b/drivers/spi/spidev.c |
2838 |
+@@ -673,6 +673,19 @@ static const struct file_operations spidev_fops = { |
2839 |
+ |
2840 |
+ static struct class *spidev_class; |
2841 |
+ |
2842 |
++static const struct spi_device_id spidev_spi_ids[] = { |
2843 |
++ { .name = "dh2228fv" }, |
2844 |
++ { .name = "ltc2488" }, |
2845 |
++ { .name = "sx1301" }, |
2846 |
++ { .name = "bk4" }, |
2847 |
++ { .name = "dhcom-board" }, |
2848 |
++ { .name = "m53cpld" }, |
2849 |
++ { .name = "spi-petra" }, |
2850 |
++ { .name = "spi-authenta" }, |
2851 |
++ {}, |
2852 |
++}; |
2853 |
++MODULE_DEVICE_TABLE(spi, spidev_spi_ids); |
2854 |
++ |
2855 |
+ #ifdef CONFIG_OF |
2856 |
+ static const struct of_device_id spidev_dt_ids[] = { |
2857 |
+ { .compatible = "rohm,dh2228fv" }, |
2858 |
+@@ -819,6 +832,7 @@ static struct spi_driver spidev_spi_driver = { |
2859 |
+ }, |
2860 |
+ .probe = spidev_probe, |
2861 |
+ .remove = spidev_remove, |
2862 |
++ .id_table = spidev_spi_ids, |
2863 |
+ |
2864 |
+ /* NOTE: suspend/resume methods are not necessary here. |
2865 |
+ * We don't do anything except pass the requests to/from |
2866 |
+diff --git a/drivers/tee/optee/core.c b/drivers/tee/optee/core.c |
2867 |
+index 5ce13b099d7dc..5363ebebfc357 100644 |
2868 |
+--- a/drivers/tee/optee/core.c |
2869 |
++++ b/drivers/tee/optee/core.c |
2870 |
+@@ -585,6 +585,9 @@ static int optee_remove(struct platform_device *pdev) |
2871 |
+ { |
2872 |
+ struct optee *optee = platform_get_drvdata(pdev); |
2873 |
+ |
2874 |
++ /* Unregister OP-TEE specific client devices on TEE bus */ |
2875 |
++ optee_unregister_devices(); |
2876 |
++ |
2877 |
+ /* |
2878 |
+ * Ask OP-TEE to free all cached shared memory objects to decrease |
2879 |
+ * reference counters and also avoid wild pointers in secure world |
2880 |
+diff --git a/drivers/tee/optee/device.c b/drivers/tee/optee/device.c |
2881 |
+index ec1d24693ebaa..128a2d2a50a16 100644 |
2882 |
+--- a/drivers/tee/optee/device.c |
2883 |
++++ b/drivers/tee/optee/device.c |
2884 |
+@@ -53,6 +53,13 @@ static int get_devices(struct tee_context *ctx, u32 session, |
2885 |
+ return 0; |
2886 |
+ } |
2887 |
+ |
2888 |
++static void optee_release_device(struct device *dev) |
2889 |
++{ |
2890 |
++ struct tee_client_device *optee_device = to_tee_client_device(dev); |
2891 |
++ |
2892 |
++ kfree(optee_device); |
2893 |
++} |
2894 |
++ |
2895 |
+ static int optee_register_device(const uuid_t *device_uuid) |
2896 |
+ { |
2897 |
+ struct tee_client_device *optee_device = NULL; |
2898 |
+@@ -63,6 +70,7 @@ static int optee_register_device(const uuid_t *device_uuid) |
2899 |
+ return -ENOMEM; |
2900 |
+ |
2901 |
+ optee_device->dev.bus = &tee_bus_type; |
2902 |
++ optee_device->dev.release = optee_release_device; |
2903 |
+ if (dev_set_name(&optee_device->dev, "optee-ta-%pUb", device_uuid)) { |
2904 |
+ kfree(optee_device); |
2905 |
+ return -ENOMEM; |
2906 |
+@@ -154,3 +162,17 @@ int optee_enumerate_devices(u32 func) |
2907 |
+ { |
2908 |
+ return __optee_enumerate_devices(func); |
2909 |
+ } |
2910 |
++ |
2911 |
++static int __optee_unregister_device(struct device *dev, void *data) |
2912 |
++{ |
2913 |
++ if (!strncmp(dev_name(dev), "optee-ta", strlen("optee-ta"))) |
2914 |
++ device_unregister(dev); |
2915 |
++ |
2916 |
++ return 0; |
2917 |
++} |
2918 |
++ |
2919 |
++void optee_unregister_devices(void) |
2920 |
++{ |
2921 |
++ bus_for_each_dev(&tee_bus_type, NULL, NULL, |
2922 |
++ __optee_unregister_device); |
2923 |
++} |
2924 |
+diff --git a/drivers/tee/optee/optee_private.h b/drivers/tee/optee/optee_private.h |
2925 |
+index dbdd367be1568..f6bb4a763ba94 100644 |
2926 |
+--- a/drivers/tee/optee/optee_private.h |
2927 |
++++ b/drivers/tee/optee/optee_private.h |
2928 |
+@@ -184,6 +184,7 @@ void optee_fill_pages_list(u64 *dst, struct page **pages, int num_pages, |
2929 |
+ #define PTA_CMD_GET_DEVICES 0x0 |
2930 |
+ #define PTA_CMD_GET_DEVICES_SUPP 0x1 |
2931 |
+ int optee_enumerate_devices(u32 func); |
2932 |
++void optee_unregister_devices(void); |
2933 |
+ |
2934 |
+ /* |
2935 |
+ * Small helpers |
2936 |
+diff --git a/drivers/usb/host/xhci-dbgtty.c b/drivers/usb/host/xhci-dbgtty.c |
2937 |
+index bef104511352c..509b597e30edb 100644 |
2938 |
+--- a/drivers/usb/host/xhci-dbgtty.c |
2939 |
++++ b/drivers/usb/host/xhci-dbgtty.c |
2940 |
+@@ -408,40 +408,38 @@ static int xhci_dbc_tty_register_device(struct xhci_dbc *dbc) |
2941 |
+ return -EBUSY; |
2942 |
+ |
2943 |
+ xhci_dbc_tty_init_port(dbc, port); |
2944 |
+- tty_dev = tty_port_register_device(&port->port, |
2945 |
+- dbc_tty_driver, 0, NULL); |
2946 |
+- if (IS_ERR(tty_dev)) { |
2947 |
+- ret = PTR_ERR(tty_dev); |
2948 |
+- goto register_fail; |
2949 |
+- } |
2950 |
+ |
2951 |
+ ret = kfifo_alloc(&port->write_fifo, DBC_WRITE_BUF_SIZE, GFP_KERNEL); |
2952 |
+ if (ret) |
2953 |
+- goto buf_alloc_fail; |
2954 |
++ goto err_exit_port; |
2955 |
+ |
2956 |
+ ret = xhci_dbc_alloc_requests(dbc, BULK_IN, &port->read_pool, |
2957 |
+ dbc_read_complete); |
2958 |
+ if (ret) |
2959 |
+- goto request_fail; |
2960 |
++ goto err_free_fifo; |
2961 |
+ |
2962 |
+ ret = xhci_dbc_alloc_requests(dbc, BULK_OUT, &port->write_pool, |
2963 |
+ dbc_write_complete); |
2964 |
+ if (ret) |
2965 |
+- goto request_fail; |
2966 |
++ goto err_free_requests; |
2967 |
++ |
2968 |
++ tty_dev = tty_port_register_device(&port->port, |
2969 |
++ dbc_tty_driver, 0, NULL); |
2970 |
++ if (IS_ERR(tty_dev)) { |
2971 |
++ ret = PTR_ERR(tty_dev); |
2972 |
++ goto err_free_requests; |
2973 |
++ } |
2974 |
+ |
2975 |
+ port->registered = true; |
2976 |
+ |
2977 |
+ return 0; |
2978 |
+ |
2979 |
+-request_fail: |
2980 |
++err_free_requests: |
2981 |
+ xhci_dbc_free_requests(&port->read_pool); |
2982 |
+ xhci_dbc_free_requests(&port->write_pool); |
2983 |
++err_free_fifo: |
2984 |
+ kfifo_free(&port->write_fifo); |
2985 |
+- |
2986 |
+-buf_alloc_fail: |
2987 |
+- tty_unregister_device(dbc_tty_driver, 0); |
2988 |
+- |
2989 |
+-register_fail: |
2990 |
++err_exit_port: |
2991 |
+ xhci_dbc_tty_exit_port(port); |
2992 |
+ |
2993 |
+ dev_err(dbc->dev, "can't register tty port, err %d\n", ret); |
2994 |
+diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c |
2995 |
+index 1c9a7957c45c5..003c5f0a8760f 100644 |
2996 |
+--- a/drivers/usb/host/xhci-pci.c |
2997 |
++++ b/drivers/usb/host/xhci-pci.c |
2998 |
+@@ -30,6 +30,7 @@ |
2999 |
+ #define PCI_VENDOR_ID_FRESCO_LOGIC 0x1b73 |
3000 |
+ #define PCI_DEVICE_ID_FRESCO_LOGIC_PDK 0x1000 |
3001 |
+ #define PCI_DEVICE_ID_FRESCO_LOGIC_FL1009 0x1009 |
3002 |
++#define PCI_DEVICE_ID_FRESCO_LOGIC_FL1100 0x1100 |
3003 |
+ #define PCI_DEVICE_ID_FRESCO_LOGIC_FL1400 0x1400 |
3004 |
+ |
3005 |
+ #define PCI_VENDOR_ID_ETRON 0x1b6f |
3006 |
+@@ -113,6 +114,7 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) |
3007 |
+ /* Look for vendor-specific quirks */ |
3008 |
+ if (pdev->vendor == PCI_VENDOR_ID_FRESCO_LOGIC && |
3009 |
+ (pdev->device == PCI_DEVICE_ID_FRESCO_LOGIC_PDK || |
3010 |
++ pdev->device == PCI_DEVICE_ID_FRESCO_LOGIC_FL1100 || |
3011 |
+ pdev->device == PCI_DEVICE_ID_FRESCO_LOGIC_FL1400)) { |
3012 |
+ if (pdev->device == PCI_DEVICE_ID_FRESCO_LOGIC_PDK && |
3013 |
+ pdev->revision == 0x0) { |
3014 |
+@@ -279,8 +281,10 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) |
3015 |
+ pdev->device == 0x3432) |
3016 |
+ xhci->quirks |= XHCI_BROKEN_STREAMS; |
3017 |
+ |
3018 |
+- if (pdev->vendor == PCI_VENDOR_ID_VIA && pdev->device == 0x3483) |
3019 |
++ if (pdev->vendor == PCI_VENDOR_ID_VIA && pdev->device == 0x3483) { |
3020 |
+ xhci->quirks |= XHCI_LPM_SUPPORT; |
3021 |
++ xhci->quirks |= XHCI_EP_CTX_BROKEN_DCS; |
3022 |
++ } |
3023 |
+ |
3024 |
+ if (pdev->vendor == PCI_VENDOR_ID_ASMEDIA && |
3025 |
+ pdev->device == PCI_DEVICE_ID_ASMEDIA_1042_XHCI) |
3026 |
+diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c |
3027 |
+index 9017986241f51..8fedf1bf292ba 100644 |
3028 |
+--- a/drivers/usb/host/xhci-ring.c |
3029 |
++++ b/drivers/usb/host/xhci-ring.c |
3030 |
+@@ -366,16 +366,22 @@ static void xhci_handle_stopped_cmd_ring(struct xhci_hcd *xhci, |
3031 |
+ /* Must be called with xhci->lock held, releases and aquires lock back */ |
3032 |
+ static int xhci_abort_cmd_ring(struct xhci_hcd *xhci, unsigned long flags) |
3033 |
+ { |
3034 |
+- u64 temp_64; |
3035 |
++ u32 temp_32; |
3036 |
+ int ret; |
3037 |
+ |
3038 |
+ xhci_dbg(xhci, "Abort command ring\n"); |
3039 |
+ |
3040 |
+ reinit_completion(&xhci->cmd_ring_stop_completion); |
3041 |
+ |
3042 |
+- temp_64 = xhci_read_64(xhci, &xhci->op_regs->cmd_ring); |
3043 |
+- xhci_write_64(xhci, temp_64 | CMD_RING_ABORT, |
3044 |
+- &xhci->op_regs->cmd_ring); |
3045 |
++ /* |
3046 |
++ * The control bits like command stop, abort are located in lower |
3047 |
++ * dword of the command ring control register. Limit the write |
3048 |
++ * to the lower dword to avoid corrupting the command ring pointer |
3049 |
++ * in case if the command ring is stopped by the time upper dword |
3050 |
++ * is written. |
3051 |
++ */ |
3052 |
++ temp_32 = readl(&xhci->op_regs->cmd_ring); |
3053 |
++ writel(temp_32 | CMD_RING_ABORT, &xhci->op_regs->cmd_ring); |
3054 |
+ |
3055 |
+ /* Section 4.6.1.2 of xHCI 1.0 spec says software should also time the |
3056 |
+ * completion of the Command Abort operation. If CRR is not negated in 5 |
3057 |
+@@ -559,8 +565,11 @@ static int xhci_move_dequeue_past_td(struct xhci_hcd *xhci, |
3058 |
+ struct xhci_ring *ep_ring; |
3059 |
+ struct xhci_command *cmd; |
3060 |
+ struct xhci_segment *new_seg; |
3061 |
++ struct xhci_segment *halted_seg = NULL; |
3062 |
+ union xhci_trb *new_deq; |
3063 |
+ int new_cycle; |
3064 |
++ union xhci_trb *halted_trb; |
3065 |
++ int index = 0; |
3066 |
+ dma_addr_t addr; |
3067 |
+ u64 hw_dequeue; |
3068 |
+ bool cycle_found = false; |
3069 |
+@@ -598,7 +607,27 @@ static int xhci_move_dequeue_past_td(struct xhci_hcd *xhci, |
3070 |
+ hw_dequeue = xhci_get_hw_deq(xhci, dev, ep_index, stream_id); |
3071 |
+ new_seg = ep_ring->deq_seg; |
3072 |
+ new_deq = ep_ring->dequeue; |
3073 |
+- new_cycle = hw_dequeue & 0x1; |
3074 |
++ |
3075 |
++ /* |
3076 |
++ * Quirk: xHC write-back of the DCS field in the hardware dequeue |
3077 |
++ * pointer is wrong - use the cycle state of the TRB pointed to by |
3078 |
++ * the dequeue pointer. |
3079 |
++ */ |
3080 |
++ if (xhci->quirks & XHCI_EP_CTX_BROKEN_DCS && |
3081 |
++ !(ep->ep_state & EP_HAS_STREAMS)) |
3082 |
++ halted_seg = trb_in_td(xhci, td->start_seg, |
3083 |
++ td->first_trb, td->last_trb, |
3084 |
++ hw_dequeue & ~0xf, false); |
3085 |
++ if (halted_seg) { |
3086 |
++ index = ((dma_addr_t)(hw_dequeue & ~0xf) - halted_seg->dma) / |
3087 |
++ sizeof(*halted_trb); |
3088 |
++ halted_trb = &halted_seg->trbs[index]; |
3089 |
++ new_cycle = halted_trb->generic.field[3] & 0x1; |
3090 |
++ xhci_dbg(xhci, "Endpoint DCS = %d TRB index = %d cycle = %d\n", |
3091 |
++ (u8)(hw_dequeue & 0x1), index, new_cycle); |
3092 |
++ } else { |
3093 |
++ new_cycle = hw_dequeue & 0x1; |
3094 |
++ } |
3095 |
+ |
3096 |
+ /* |
3097 |
+ * We want to find the pointer, segment and cycle state of the new trb |
3098 |
+diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c |
3099 |
+index 4a1346e3de1b2..cb730683f898f 100644 |
3100 |
+--- a/drivers/usb/host/xhci.c |
3101 |
++++ b/drivers/usb/host/xhci.c |
3102 |
+@@ -3212,10 +3212,13 @@ static void xhci_endpoint_reset(struct usb_hcd *hcd, |
3103 |
+ return; |
3104 |
+ |
3105 |
+ /* Bail out if toggle is already being cleared by a endpoint reset */ |
3106 |
++ spin_lock_irqsave(&xhci->lock, flags); |
3107 |
+ if (ep->ep_state & EP_HARD_CLEAR_TOGGLE) { |
3108 |
+ ep->ep_state &= ~EP_HARD_CLEAR_TOGGLE; |
3109 |
++ spin_unlock_irqrestore(&xhci->lock, flags); |
3110 |
+ return; |
3111 |
+ } |
3112 |
++ spin_unlock_irqrestore(&xhci->lock, flags); |
3113 |
+ /* Only interrupt and bulk ep's use data toggle, USB2 spec 5.5.4-> */ |
3114 |
+ if (usb_endpoint_xfer_control(&host_ep->desc) || |
3115 |
+ usb_endpoint_xfer_isoc(&host_ep->desc)) |
3116 |
+@@ -3301,8 +3304,10 @@ static void xhci_endpoint_reset(struct usb_hcd *hcd, |
3117 |
+ xhci_free_command(xhci, cfg_cmd); |
3118 |
+ cleanup: |
3119 |
+ xhci_free_command(xhci, stop_cmd); |
3120 |
++ spin_lock_irqsave(&xhci->lock, flags); |
3121 |
+ if (ep->ep_state & EP_SOFT_CLEAR_TOGGLE) |
3122 |
+ ep->ep_state &= ~EP_SOFT_CLEAR_TOGGLE; |
3123 |
++ spin_unlock_irqrestore(&xhci->lock, flags); |
3124 |
+ } |
3125 |
+ |
3126 |
+ static int xhci_check_streams_endpoint(struct xhci_hcd *xhci, |
3127 |
+diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h |
3128 |
+index dca6181c33fdb..5a75fe5631238 100644 |
3129 |
+--- a/drivers/usb/host/xhci.h |
3130 |
++++ b/drivers/usb/host/xhci.h |
3131 |
+@@ -1899,6 +1899,7 @@ struct xhci_hcd { |
3132 |
+ #define XHCI_SG_TRB_CACHE_SIZE_QUIRK BIT_ULL(39) |
3133 |
+ #define XHCI_NO_SOFT_RETRY BIT_ULL(40) |
3134 |
+ #define XHCI_BROKEN_D3COLD BIT_ULL(41) |
3135 |
++#define XHCI_EP_CTX_BROKEN_DCS BIT_ULL(42) |
3136 |
+ |
3137 |
+ unsigned int num_active_eps; |
3138 |
+ unsigned int limit_active_eps; |
3139 |
+diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c |
3140 |
+index ce9fc46c92661..b5935834f9d24 100644 |
3141 |
+--- a/drivers/usb/musb/musb_dsps.c |
3142 |
++++ b/drivers/usb/musb/musb_dsps.c |
3143 |
+@@ -899,11 +899,13 @@ static int dsps_probe(struct platform_device *pdev) |
3144 |
+ if (usb_get_dr_mode(&pdev->dev) == USB_DR_MODE_PERIPHERAL) { |
3145 |
+ ret = dsps_setup_optional_vbus_irq(pdev, glue); |
3146 |
+ if (ret) |
3147 |
+- goto err; |
3148 |
++ goto unregister_pdev; |
3149 |
+ } |
3150 |
+ |
3151 |
+ return 0; |
3152 |
+ |
3153 |
++unregister_pdev: |
3154 |
++ platform_device_unregister(glue->musb); |
3155 |
+ err: |
3156 |
+ pm_runtime_disable(&pdev->dev); |
3157 |
+ iounmap(glue->usbss_base); |
3158 |
+diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c |
3159 |
+index 6cfb5d33609fb..a484ff5e4ebf8 100644 |
3160 |
+--- a/drivers/usb/serial/option.c |
3161 |
++++ b/drivers/usb/serial/option.c |
3162 |
+@@ -246,11 +246,13 @@ static void option_instat_callback(struct urb *urb); |
3163 |
+ /* These Quectel products use Quectel's vendor ID */ |
3164 |
+ #define QUECTEL_PRODUCT_EC21 0x0121 |
3165 |
+ #define QUECTEL_PRODUCT_EC25 0x0125 |
3166 |
++#define QUECTEL_PRODUCT_EG91 0x0191 |
3167 |
+ #define QUECTEL_PRODUCT_EG95 0x0195 |
3168 |
+ #define QUECTEL_PRODUCT_BG96 0x0296 |
3169 |
+ #define QUECTEL_PRODUCT_EP06 0x0306 |
3170 |
+ #define QUECTEL_PRODUCT_EM12 0x0512 |
3171 |
+ #define QUECTEL_PRODUCT_RM500Q 0x0800 |
3172 |
++#define QUECTEL_PRODUCT_EC200S_CN 0x6002 |
3173 |
+ #define QUECTEL_PRODUCT_EC200T 0x6026 |
3174 |
+ |
3175 |
+ #define CMOTECH_VENDOR_ID 0x16d8 |
3176 |
+@@ -1111,6 +1113,9 @@ static const struct usb_device_id option_ids[] = { |
3177 |
+ { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC25, 0xff, 0xff, 0xff), |
3178 |
+ .driver_info = NUMEP2 }, |
3179 |
+ { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC25, 0xff, 0, 0) }, |
3180 |
++ { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EG91, 0xff, 0xff, 0xff), |
3181 |
++ .driver_info = NUMEP2 }, |
3182 |
++ { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EG91, 0xff, 0, 0) }, |
3183 |
+ { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EG95, 0xff, 0xff, 0xff), |
3184 |
+ .driver_info = NUMEP2 }, |
3185 |
+ { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EG95, 0xff, 0, 0) }, |
3186 |
+@@ -1128,6 +1133,7 @@ static const struct usb_device_id option_ids[] = { |
3187 |
+ { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_RM500Q, 0xff, 0, 0) }, |
3188 |
+ { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_RM500Q, 0xff, 0xff, 0x10), |
3189 |
+ .driver_info = ZLP }, |
3190 |
++ { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC200S_CN, 0xff, 0, 0) }, |
3191 |
+ { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC200T, 0xff, 0, 0) }, |
3192 |
+ |
3193 |
+ { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6001) }, |
3194 |
+@@ -1227,6 +1233,8 @@ static const struct usb_device_id option_ids[] = { |
3195 |
+ .driver_info = NCTRL(0) | RSVD(1) | RSVD(2) }, |
3196 |
+ { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1203, 0xff), /* Telit LE910Cx (RNDIS) */ |
3197 |
+ .driver_info = NCTRL(2) | RSVD(3) }, |
3198 |
++ { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1204, 0xff), /* Telit LE910Cx (MBIM) */ |
3199 |
++ .driver_info = NCTRL(0) | RSVD(1) }, |
3200 |
+ { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE910_USBCFG4), |
3201 |
+ .driver_info = NCTRL(0) | RSVD(1) | RSVD(2) | RSVD(3) }, |
3202 |
+ { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE920), |
3203 |
+diff --git a/drivers/usb/serial/qcserial.c b/drivers/usb/serial/qcserial.c |
3204 |
+index 83da8236e3c8b..c18bf8164bc2e 100644 |
3205 |
+--- a/drivers/usb/serial/qcserial.c |
3206 |
++++ b/drivers/usb/serial/qcserial.c |
3207 |
+@@ -165,6 +165,7 @@ static const struct usb_device_id id_table[] = { |
3208 |
+ {DEVICE_SWI(0x1199, 0x907b)}, /* Sierra Wireless EM74xx */ |
3209 |
+ {DEVICE_SWI(0x1199, 0x9090)}, /* Sierra Wireless EM7565 QDL */ |
3210 |
+ {DEVICE_SWI(0x1199, 0x9091)}, /* Sierra Wireless EM7565 */ |
3211 |
++ {DEVICE_SWI(0x1199, 0x90d2)}, /* Sierra Wireless EM9191 QDL */ |
3212 |
+ {DEVICE_SWI(0x413c, 0x81a2)}, /* Dell Wireless 5806 Gobi(TM) 4G LTE Mobile Broadband Card */ |
3213 |
+ {DEVICE_SWI(0x413c, 0x81a3)}, /* Dell Wireless 5570 HSPA+ (42Mbps) Mobile Broadband Card */ |
3214 |
+ {DEVICE_SWI(0x413c, 0x81a4)}, /* Dell Wireless 5570e HSPA+ (42Mbps) Mobile Broadband Card */ |
3215 |
+diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c |
3216 |
+index 9479f7f792173..55ec22f4ef901 100644 |
3217 |
+--- a/drivers/vhost/vdpa.c |
3218 |
++++ b/drivers/vhost/vdpa.c |
3219 |
+@@ -316,7 +316,7 @@ static long vhost_vdpa_set_config_call(struct vhost_vdpa *v, u32 __user *argp) |
3220 |
+ struct eventfd_ctx *ctx; |
3221 |
+ |
3222 |
+ cb.callback = vhost_vdpa_config_cb; |
3223 |
+- cb.private = v->vdpa; |
3224 |
++ cb.private = v; |
3225 |
+ if (copy_from_user(&fd, argp, sizeof(fd))) |
3226 |
+ return -EFAULT; |
3227 |
+ |
3228 |
+diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c |
3229 |
+index 49984d2cba246..581871e707eb2 100644 |
3230 |
+--- a/drivers/virtio/virtio.c |
3231 |
++++ b/drivers/virtio/virtio.c |
3232 |
+@@ -238,6 +238,17 @@ static int virtio_dev_probe(struct device *_d) |
3233 |
+ driver_features_legacy = driver_features; |
3234 |
+ } |
3235 |
+ |
3236 |
++ /* |
3237 |
++ * Some devices detect legacy solely via F_VERSION_1. Write |
3238 |
++ * F_VERSION_1 to force LE config space accesses before FEATURES_OK for |
3239 |
++ * these when needed. |
3240 |
++ */ |
3241 |
++ if (drv->validate && !virtio_legacy_is_little_endian() |
3242 |
++ && device_features & BIT_ULL(VIRTIO_F_VERSION_1)) { |
3243 |
++ dev->features = BIT_ULL(VIRTIO_F_VERSION_1); |
3244 |
++ dev->config->finalize_features(dev); |
3245 |
++ } |
3246 |
++ |
3247 |
+ if (device_features & (1ULL << VIRTIO_F_VERSION_1)) |
3248 |
+ dev->features = driver_features & device_features; |
3249 |
+ else |
3250 |
+diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c |
3251 |
+index 268ce58d45697..5fec2706490ca 100644 |
3252 |
+--- a/fs/btrfs/extent-tree.c |
3253 |
++++ b/fs/btrfs/extent-tree.c |
3254 |
+@@ -4859,6 +4859,7 @@ struct extent_buffer *btrfs_alloc_tree_block(struct btrfs_trans_handle *trans, |
3255 |
+ out_free_delayed: |
3256 |
+ btrfs_free_delayed_extent_op(extent_op); |
3257 |
+ out_free_buf: |
3258 |
++ btrfs_tree_unlock(buf); |
3259 |
+ free_extent_buffer(buf); |
3260 |
+ out_free_reserved: |
3261 |
+ btrfs_free_reserved_extent(fs_info, ins.objectid, ins.offset, 0); |
3262 |
+diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c |
3263 |
+index ee34497500e16..ba44039071e5b 100644 |
3264 |
+--- a/fs/btrfs/file.c |
3265 |
++++ b/fs/btrfs/file.c |
3266 |
+@@ -733,8 +733,7 @@ int btrfs_drop_extents(struct btrfs_trans_handle *trans, |
3267 |
+ if (args->start >= inode->disk_i_size && !args->replace_extent) |
3268 |
+ modify_tree = 0; |
3269 |
+ |
3270 |
+- update_refs = (test_bit(BTRFS_ROOT_SHAREABLE, &root->state) || |
3271 |
+- root == fs_info->tree_root); |
3272 |
++ update_refs = (root->root_key.objectid != BTRFS_TREE_LOG_OBJECTID); |
3273 |
+ while (1) { |
3274 |
+ recow = 0; |
3275 |
+ ret = btrfs_lookup_file_extent(trans, root, path, ino, |
3276 |
+@@ -2692,14 +2691,16 @@ int btrfs_replace_file_extents(struct btrfs_inode *inode, |
3277 |
+ drop_args.bytes_found); |
3278 |
+ if (ret != -ENOSPC) { |
3279 |
+ /* |
3280 |
+- * When cloning we want to avoid transaction aborts when |
3281 |
+- * nothing was done and we are attempting to clone parts |
3282 |
+- * of inline extents, in such cases -EOPNOTSUPP is |
3283 |
+- * returned by __btrfs_drop_extents() without having |
3284 |
+- * changed anything in the file. |
3285 |
++ * The only time we don't want to abort is if we are |
3286 |
++ * attempting to clone a partial inline extent, in which |
3287 |
++ * case we'll get EOPNOTSUPP. However if we aren't |
3288 |
++ * clone we need to abort no matter what, because if we |
3289 |
++ * got EOPNOTSUPP via prealloc then we messed up and |
3290 |
++ * need to abort. |
3291 |
+ */ |
3292 |
+- if (extent_info && !extent_info->is_new_extent && |
3293 |
+- ret && ret != -EOPNOTSUPP) |
3294 |
++ if (ret && |
3295 |
++ (ret != -EOPNOTSUPP || |
3296 |
++ (extent_info && extent_info->is_new_extent))) |
3297 |
+ btrfs_abort_transaction(trans, ret); |
3298 |
+ break; |
3299 |
+ } |
3300 |
+diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c |
3301 |
+index 7037e5855d2a8..17f0de5bb8733 100644 |
3302 |
+--- a/fs/btrfs/tree-log.c |
3303 |
++++ b/fs/btrfs/tree-log.c |
3304 |
+@@ -1182,7 +1182,10 @@ next: |
3305 |
+ /* look for a conflicting sequence number */ |
3306 |
+ di = btrfs_lookup_dir_index_item(trans, root, path, btrfs_ino(dir), |
3307 |
+ ref_index, name, namelen, 0); |
3308 |
+- if (di && !IS_ERR(di)) { |
3309 |
++ if (IS_ERR(di)) { |
3310 |
++ if (PTR_ERR(di) != -ENOENT) |
3311 |
++ return PTR_ERR(di); |
3312 |
++ } else if (di) { |
3313 |
+ ret = drop_one_dir_item(trans, root, path, dir, di); |
3314 |
+ if (ret) |
3315 |
+ return ret; |
3316 |
+@@ -1192,7 +1195,9 @@ next: |
3317 |
+ /* look for a conflicting name */ |
3318 |
+ di = btrfs_lookup_dir_item(trans, root, path, btrfs_ino(dir), |
3319 |
+ name, namelen, 0); |
3320 |
+- if (di && !IS_ERR(di)) { |
3321 |
++ if (IS_ERR(di)) { |
3322 |
++ return PTR_ERR(di); |
3323 |
++ } else if (di) { |
3324 |
+ ret = drop_one_dir_item(trans, root, path, dir, di); |
3325 |
+ if (ret) |
3326 |
+ return ret; |
3327 |
+@@ -1936,8 +1941,8 @@ static noinline int replay_one_name(struct btrfs_trans_handle *trans, |
3328 |
+ struct btrfs_key log_key; |
3329 |
+ struct inode *dir; |
3330 |
+ u8 log_type; |
3331 |
+- int exists; |
3332 |
+- int ret = 0; |
3333 |
++ bool exists; |
3334 |
++ int ret; |
3335 |
+ bool update_size = (key->type == BTRFS_DIR_INDEX_KEY); |
3336 |
+ bool name_added = false; |
3337 |
+ |
3338 |
+@@ -1957,12 +1962,12 @@ static noinline int replay_one_name(struct btrfs_trans_handle *trans, |
3339 |
+ name_len); |
3340 |
+ |
3341 |
+ btrfs_dir_item_key_to_cpu(eb, di, &log_key); |
3342 |
+- exists = btrfs_lookup_inode(trans, root, path, &log_key, 0); |
3343 |
+- if (exists == 0) |
3344 |
+- exists = 1; |
3345 |
+- else |
3346 |
+- exists = 0; |
3347 |
++ ret = btrfs_lookup_inode(trans, root, path, &log_key, 0); |
3348 |
+ btrfs_release_path(path); |
3349 |
++ if (ret < 0) |
3350 |
++ goto out; |
3351 |
++ exists = (ret == 0); |
3352 |
++ ret = 0; |
3353 |
+ |
3354 |
+ if (key->type == BTRFS_DIR_ITEM_KEY) { |
3355 |
+ dst_di = btrfs_lookup_dir_item(trans, root, path, key->objectid, |
3356 |
+@@ -1977,7 +1982,14 @@ static noinline int replay_one_name(struct btrfs_trans_handle *trans, |
3357 |
+ ret = -EINVAL; |
3358 |
+ goto out; |
3359 |
+ } |
3360 |
+- if (IS_ERR_OR_NULL(dst_di)) { |
3361 |
++ |
3362 |
++ if (dst_di == ERR_PTR(-ENOENT)) |
3363 |
++ dst_di = NULL; |
3364 |
++ |
3365 |
++ if (IS_ERR(dst_di)) { |
3366 |
++ ret = PTR_ERR(dst_di); |
3367 |
++ goto out; |
3368 |
++ } else if (!dst_di) { |
3369 |
+ /* we need a sequence number to insert, so we only |
3370 |
+ * do inserts for the BTRFS_DIR_INDEX_KEY types |
3371 |
+ */ |
3372 |
+diff --git a/include/linux/mlx5/mlx5_ifc.h b/include/linux/mlx5/mlx5_ifc.h |
3373 |
+index 6bbae0c3bc0b9..681bea6716dde 100644 |
3374 |
+--- a/include/linux/mlx5/mlx5_ifc.h |
3375 |
++++ b/include/linux/mlx5/mlx5_ifc.h |
3376 |
+@@ -9467,16 +9467,22 @@ struct mlx5_ifc_pcmr_reg_bits { |
3377 |
+ u8 reserved_at_0[0x8]; |
3378 |
+ u8 local_port[0x8]; |
3379 |
+ u8 reserved_at_10[0x10]; |
3380 |
++ |
3381 |
+ u8 entropy_force_cap[0x1]; |
3382 |
+ u8 entropy_calc_cap[0x1]; |
3383 |
+ u8 entropy_gre_calc_cap[0x1]; |
3384 |
+- u8 reserved_at_23[0x1b]; |
3385 |
++ u8 reserved_at_23[0xf]; |
3386 |
++ u8 rx_ts_over_crc_cap[0x1]; |
3387 |
++ u8 reserved_at_33[0xb]; |
3388 |
+ u8 fcs_cap[0x1]; |
3389 |
+ u8 reserved_at_3f[0x1]; |
3390 |
++ |
3391 |
+ u8 entropy_force[0x1]; |
3392 |
+ u8 entropy_calc[0x1]; |
3393 |
+ u8 entropy_gre_calc[0x1]; |
3394 |
+- u8 reserved_at_43[0x1b]; |
3395 |
++ u8 reserved_at_43[0xf]; |
3396 |
++ u8 rx_ts_over_crc[0x1]; |
3397 |
++ u8 reserved_at_53[0xb]; |
3398 |
+ u8 fcs_chk[0x1]; |
3399 |
+ u8 reserved_at_5f[0x1]; |
3400 |
+ }; |
3401 |
+diff --git a/include/soc/mscc/ocelot.h b/include/soc/mscc/ocelot.h |
3402 |
+index 2f5ce4d4fdbff..4984093882372 100644 |
3403 |
+--- a/include/soc/mscc/ocelot.h |
3404 |
++++ b/include/soc/mscc/ocelot.h |
3405 |
+@@ -600,10 +600,10 @@ struct ocelot_port { |
3406 |
+ /* The VLAN ID that will be transmitted as untagged, on egress */ |
3407 |
+ struct ocelot_vlan native_vlan; |
3408 |
+ |
3409 |
++ unsigned int ptp_skbs_in_flight; |
3410 |
+ u8 ptp_cmd; |
3411 |
+ struct sk_buff_head tx_skbs; |
3412 |
+ u8 ts_id; |
3413 |
+- spinlock_t ts_id_lock; |
3414 |
+ |
3415 |
+ phy_interface_t phy_mode; |
3416 |
+ |
3417 |
+@@ -677,6 +677,9 @@ struct ocelot { |
3418 |
+ struct ptp_clock *ptp_clock; |
3419 |
+ struct ptp_clock_info ptp_info; |
3420 |
+ struct hwtstamp_config hwtstamp_config; |
3421 |
++ unsigned int ptp_skbs_in_flight; |
3422 |
++ /* Protects the 2-step TX timestamp ID logic */ |
3423 |
++ spinlock_t ts_id_lock; |
3424 |
+ /* Protects the PTP interface state */ |
3425 |
+ struct mutex ptp_lock; |
3426 |
+ /* Protects the PTP clock */ |
3427 |
+@@ -691,6 +694,7 @@ struct ocelot_policer { |
3428 |
+ |
3429 |
+ struct ocelot_skb_cb { |
3430 |
+ struct sk_buff *clone; |
3431 |
++ unsigned int ptp_class; /* valid only for clones */ |
3432 |
+ u8 ptp_cmd; |
3433 |
+ u8 ts_id; |
3434 |
+ }; |
3435 |
+diff --git a/include/soc/mscc/ocelot_ptp.h b/include/soc/mscc/ocelot_ptp.h |
3436 |
+index ded497d72bdbb..f085884b1fa27 100644 |
3437 |
+--- a/include/soc/mscc/ocelot_ptp.h |
3438 |
++++ b/include/soc/mscc/ocelot_ptp.h |
3439 |
+@@ -13,6 +13,9 @@ |
3440 |
+ #include <linux/ptp_clock_kernel.h> |
3441 |
+ #include <soc/mscc/ocelot.h> |
3442 |
+ |
3443 |
++#define OCELOT_MAX_PTP_ID 63 |
3444 |
++#define OCELOT_PTP_FIFO_SIZE 128 |
3445 |
++ |
3446 |
+ #define PTP_PIN_CFG_RSZ 0x20 |
3447 |
+ #define PTP_PIN_TOD_SEC_MSB_RSZ PTP_PIN_CFG_RSZ |
3448 |
+ #define PTP_PIN_TOD_SEC_LSB_RSZ PTP_PIN_CFG_RSZ |
3449 |
+diff --git a/kernel/module.c b/kernel/module.c |
3450 |
+index ed13917ea5f39..d184be24b9eac 100644 |
3451 |
+--- a/kernel/module.c |
3452 |
++++ b/kernel/module.c |
3453 |
+@@ -4484,8 +4484,10 @@ static void cfi_init(struct module *mod) |
3454 |
+ /* Fix init/exit functions to point to the CFI jump table */ |
3455 |
+ if (init) |
3456 |
+ mod->init = *init; |
3457 |
++#ifdef CONFIG_MODULE_UNLOAD |
3458 |
+ if (exit) |
3459 |
+ mod->exit = *exit; |
3460 |
++#endif |
3461 |
+ |
3462 |
+ cfi_module_add(mod, module_addr_min); |
3463 |
+ #endif |
3464 |
+diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c |
3465 |
+index a1adb29ef5c18..f4aa00a58f3c6 100644 |
3466 |
+--- a/kernel/trace/trace.c |
3467 |
++++ b/kernel/trace/trace.c |
3468 |
+@@ -1744,16 +1744,15 @@ void latency_fsnotify(struct trace_array *tr) |
3469 |
+ irq_work_queue(&tr->fsnotify_irqwork); |
3470 |
+ } |
3471 |
+ |
3472 |
+-/* |
3473 |
+- * (defined(CONFIG_TRACER_MAX_TRACE) || defined(CONFIG_HWLAT_TRACER)) && \ |
3474 |
+- * defined(CONFIG_FSNOTIFY) |
3475 |
+- */ |
3476 |
+-#else |
3477 |
++#elif defined(CONFIG_TRACER_MAX_TRACE) || defined(CONFIG_HWLAT_TRACER) \ |
3478 |
++ || defined(CONFIG_OSNOISE_TRACER) |
3479 |
+ |
3480 |
+ #define trace_create_maxlat_file(tr, d_tracer) \ |
3481 |
+ trace_create_file("tracing_max_latency", 0644, d_tracer, \ |
3482 |
+ &tr->max_latency, &tracing_max_lat_fops) |
3483 |
+ |
3484 |
++#else |
3485 |
++#define trace_create_maxlat_file(tr, d_tracer) do { } while (0) |
3486 |
+ #endif |
3487 |
+ |
3488 |
+ #ifdef CONFIG_TRACER_MAX_TRACE |
3489 |
+@@ -9457,9 +9456,7 @@ init_tracer_tracefs(struct trace_array *tr, struct dentry *d_tracer) |
3490 |
+ |
3491 |
+ create_trace_options_dir(tr); |
3492 |
+ |
3493 |
+-#if defined(CONFIG_TRACER_MAX_TRACE) || defined(CONFIG_HWLAT_TRACER) |
3494 |
+ trace_create_maxlat_file(tr, d_tracer); |
3495 |
+-#endif |
3496 |
+ |
3497 |
+ if (ftrace_create_function_files(tr, d_tracer)) |
3498 |
+ MEM_FAIL(1, "Could not allocate function filter files"); |
3499 |
+diff --git a/net/dsa/switch.c b/net/dsa/switch.c |
3500 |
+index 5ece05dfd8f2c..9ef9125713321 100644 |
3501 |
+--- a/net/dsa/switch.c |
3502 |
++++ b/net/dsa/switch.c |
3503 |
+@@ -148,7 +148,7 @@ static int dsa_switch_bridge_leave(struct dsa_switch *ds, |
3504 |
+ if (extack._msg) |
3505 |
+ dev_err(ds->dev, "port %d: %s\n", info->port, |
3506 |
+ extack._msg); |
3507 |
+- if (err && err != EOPNOTSUPP) |
3508 |
++ if (err && err != -EOPNOTSUPP) |
3509 |
+ return err; |
3510 |
+ } |
3511 |
+ return 0; |
3512 |
+diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c |
3513 |
+index 4d2abdd3cd3b1..e7ea062876f7c 100644 |
3514 |
+--- a/net/mptcp/protocol.c |
3515 |
++++ b/net/mptcp/protocol.c |
3516 |
+@@ -515,7 +515,6 @@ static bool mptcp_check_data_fin(struct sock *sk) |
3517 |
+ |
3518 |
+ sk->sk_shutdown |= RCV_SHUTDOWN; |
3519 |
+ smp_mb__before_atomic(); /* SHUTDOWN must be visible first */ |
3520 |
+- set_bit(MPTCP_DATA_READY, &msk->flags); |
3521 |
+ |
3522 |
+ switch (sk->sk_state) { |
3523 |
+ case TCP_ESTABLISHED: |
3524 |
+@@ -730,10 +729,9 @@ void mptcp_data_ready(struct sock *sk, struct sock *ssk) |
3525 |
+ |
3526 |
+ /* Wake-up the reader only for in-sequence data */ |
3527 |
+ mptcp_data_lock(sk); |
3528 |
+- if (move_skbs_to_msk(msk, ssk)) { |
3529 |
+- set_bit(MPTCP_DATA_READY, &msk->flags); |
3530 |
++ if (move_skbs_to_msk(msk, ssk)) |
3531 |
+ sk->sk_data_ready(sk); |
3532 |
+- } |
3533 |
++ |
3534 |
+ mptcp_data_unlock(sk); |
3535 |
+ } |
3536 |
+ |
3537 |
+@@ -838,7 +836,6 @@ static void mptcp_check_for_eof(struct mptcp_sock *msk) |
3538 |
+ sk->sk_shutdown |= RCV_SHUTDOWN; |
3539 |
+ |
3540 |
+ smp_mb__before_atomic(); /* SHUTDOWN must be visible first */ |
3541 |
+- set_bit(MPTCP_DATA_READY, &msk->flags); |
3542 |
+ sk->sk_data_ready(sk); |
3543 |
+ } |
3544 |
+ |
3545 |
+@@ -1701,21 +1698,6 @@ out: |
3546 |
+ return copied ? : ret; |
3547 |
+ } |
3548 |
+ |
3549 |
+-static void mptcp_wait_data(struct sock *sk, long *timeo) |
3550 |
+-{ |
3551 |
+- DEFINE_WAIT_FUNC(wait, woken_wake_function); |
3552 |
+- struct mptcp_sock *msk = mptcp_sk(sk); |
3553 |
+- |
3554 |
+- add_wait_queue(sk_sleep(sk), &wait); |
3555 |
+- sk_set_bit(SOCKWQ_ASYNC_WAITDATA, sk); |
3556 |
+- |
3557 |
+- sk_wait_event(sk, timeo, |
3558 |
+- test_bit(MPTCP_DATA_READY, &msk->flags), &wait); |
3559 |
+- |
3560 |
+- sk_clear_bit(SOCKWQ_ASYNC_WAITDATA, sk); |
3561 |
+- remove_wait_queue(sk_sleep(sk), &wait); |
3562 |
+-} |
3563 |
+- |
3564 |
+ static int __mptcp_recvmsg_mskq(struct mptcp_sock *msk, |
3565 |
+ struct msghdr *msg, |
3566 |
+ size_t len, int flags, |
3567 |
+@@ -2019,19 +2001,7 @@ static int mptcp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, |
3568 |
+ } |
3569 |
+ |
3570 |
+ pr_debug("block timeout %ld", timeo); |
3571 |
+- mptcp_wait_data(sk, &timeo); |
3572 |
+- } |
3573 |
+- |
3574 |
+- if (skb_queue_empty_lockless(&sk->sk_receive_queue) && |
3575 |
+- skb_queue_empty(&msk->receive_queue)) { |
3576 |
+- /* entire backlog drained, clear DATA_READY. */ |
3577 |
+- clear_bit(MPTCP_DATA_READY, &msk->flags); |
3578 |
+- |
3579 |
+- /* .. race-breaker: ssk might have gotten new data |
3580 |
+- * after last __mptcp_move_skbs() returned false. |
3581 |
+- */ |
3582 |
+- if (unlikely(__mptcp_move_skbs(msk))) |
3583 |
+- set_bit(MPTCP_DATA_READY, &msk->flags); |
3584 |
++ sk_wait_data(sk, &timeo, NULL); |
3585 |
+ } |
3586 |
+ |
3587 |
+ out_err: |
3588 |
+@@ -2040,9 +2010,9 @@ out_err: |
3589 |
+ tcp_recv_timestamp(msg, sk, &tss); |
3590 |
+ } |
3591 |
+ |
3592 |
+- pr_debug("msk=%p data_ready=%d rx queue empty=%d copied=%d", |
3593 |
+- msk, test_bit(MPTCP_DATA_READY, &msk->flags), |
3594 |
+- skb_queue_empty_lockless(&sk->sk_receive_queue), copied); |
3595 |
++ pr_debug("msk=%p rx queue empty=%d:%d copied=%d", |
3596 |
++ msk, skb_queue_empty_lockless(&sk->sk_receive_queue), |
3597 |
++ skb_queue_empty(&msk->receive_queue), copied); |
3598 |
+ if (!(flags & MSG_PEEK)) |
3599 |
+ mptcp_rcv_space_adjust(msk, copied); |
3600 |
+ |
3601 |
+@@ -2255,7 +2225,6 @@ static void mptcp_check_fastclose(struct mptcp_sock *msk) |
3602 |
+ inet_sk_state_store(sk, TCP_CLOSE); |
3603 |
+ sk->sk_shutdown = SHUTDOWN_MASK; |
3604 |
+ smp_mb__before_atomic(); /* SHUTDOWN must be visible first */ |
3605 |
+- set_bit(MPTCP_DATA_READY, &msk->flags); |
3606 |
+ set_bit(MPTCP_WORK_CLOSE_SUBFLOW, &msk->flags); |
3607 |
+ |
3608 |
+ mptcp_close_wake_up(sk); |
3609 |
+@@ -3272,8 +3241,14 @@ unlock_fail: |
3610 |
+ |
3611 |
+ static __poll_t mptcp_check_readable(struct mptcp_sock *msk) |
3612 |
+ { |
3613 |
+- return test_bit(MPTCP_DATA_READY, &msk->flags) ? EPOLLIN | EPOLLRDNORM : |
3614 |
+- 0; |
3615 |
++ /* Concurrent splices from sk_receive_queue into receive_queue will |
3616 |
++ * always show at least one non-empty queue when checked in this order. |
3617 |
++ */ |
3618 |
++ if (skb_queue_empty_lockless(&((struct sock *)msk)->sk_receive_queue) && |
3619 |
++ skb_queue_empty_lockless(&msk->receive_queue)) |
3620 |
++ return 0; |
3621 |
++ |
3622 |
++ return EPOLLIN | EPOLLRDNORM; |
3623 |
+ } |
3624 |
+ |
3625 |
+ static __poll_t mptcp_check_writeable(struct mptcp_sock *msk) |
3626 |
+@@ -3308,7 +3283,7 @@ static __poll_t mptcp_poll(struct file *file, struct socket *sock, |
3627 |
+ state = inet_sk_state_load(sk); |
3628 |
+ pr_debug("msk=%p state=%d flags=%lx", msk, state, msk->flags); |
3629 |
+ if (state == TCP_LISTEN) |
3630 |
+- return mptcp_check_readable(msk); |
3631 |
++ return test_bit(MPTCP_DATA_READY, &msk->flags) ? EPOLLIN | EPOLLRDNORM : 0; |
3632 |
+ |
3633 |
+ if (state != TCP_SYN_SENT && state != TCP_SYN_RECV) { |
3634 |
+ mask |= mptcp_check_readable(msk); |
3635 |
+diff --git a/net/nfc/af_nfc.c b/net/nfc/af_nfc.c |
3636 |
+index 4a9e72073564a..581358dcbdf8d 100644 |
3637 |
+--- a/net/nfc/af_nfc.c |
3638 |
++++ b/net/nfc/af_nfc.c |
3639 |
+@@ -60,6 +60,9 @@ int nfc_proto_register(const struct nfc_protocol *nfc_proto) |
3640 |
+ proto_tab[nfc_proto->id] = nfc_proto; |
3641 |
+ write_unlock(&proto_tab_lock); |
3642 |
+ |
3643 |
++ if (rc) |
3644 |
++ proto_unregister(nfc_proto->proto); |
3645 |
++ |
3646 |
+ return rc; |
3647 |
+ } |
3648 |
+ EXPORT_SYMBOL(nfc_proto_register); |
3649 |
+diff --git a/net/nfc/digital_core.c b/net/nfc/digital_core.c |
3650 |
+index 5044c7db577eb..c8fc9fcbb0a72 100644 |
3651 |
+--- a/net/nfc/digital_core.c |
3652 |
++++ b/net/nfc/digital_core.c |
3653 |
+@@ -277,6 +277,7 @@ int digital_tg_configure_hw(struct nfc_digital_dev *ddev, int type, int param) |
3654 |
+ static int digital_tg_listen_mdaa(struct nfc_digital_dev *ddev, u8 rf_tech) |
3655 |
+ { |
3656 |
+ struct digital_tg_mdaa_params *params; |
3657 |
++ int rc; |
3658 |
+ |
3659 |
+ params = kzalloc(sizeof(*params), GFP_KERNEL); |
3660 |
+ if (!params) |
3661 |
+@@ -291,8 +292,12 @@ static int digital_tg_listen_mdaa(struct nfc_digital_dev *ddev, u8 rf_tech) |
3662 |
+ get_random_bytes(params->nfcid2 + 2, NFC_NFCID2_MAXSIZE - 2); |
3663 |
+ params->sc = DIGITAL_SENSF_FELICA_SC; |
3664 |
+ |
3665 |
+- return digital_send_cmd(ddev, DIGITAL_CMD_TG_LISTEN_MDAA, NULL, params, |
3666 |
+- 500, digital_tg_recv_atr_req, NULL); |
3667 |
++ rc = digital_send_cmd(ddev, DIGITAL_CMD_TG_LISTEN_MDAA, NULL, params, |
3668 |
++ 500, digital_tg_recv_atr_req, NULL); |
3669 |
++ if (rc) |
3670 |
++ kfree(params); |
3671 |
++ |
3672 |
++ return rc; |
3673 |
+ } |
3674 |
+ |
3675 |
+ static int digital_tg_listen_md(struct nfc_digital_dev *ddev, u8 rf_tech) |
3676 |
+diff --git a/net/nfc/digital_technology.c b/net/nfc/digital_technology.c |
3677 |
+index 84d2345c75a3f..3adf4589852af 100644 |
3678 |
+--- a/net/nfc/digital_technology.c |
3679 |
++++ b/net/nfc/digital_technology.c |
3680 |
+@@ -465,8 +465,12 @@ static int digital_in_send_sdd_req(struct nfc_digital_dev *ddev, |
3681 |
+ skb_put_u8(skb, sel_cmd); |
3682 |
+ skb_put_u8(skb, DIGITAL_SDD_REQ_SEL_PAR); |
3683 |
+ |
3684 |
+- return digital_in_send_cmd(ddev, skb, 30, digital_in_recv_sdd_res, |
3685 |
+- target); |
3686 |
++ rc = digital_in_send_cmd(ddev, skb, 30, digital_in_recv_sdd_res, |
3687 |
++ target); |
3688 |
++ if (rc) |
3689 |
++ kfree_skb(skb); |
3690 |
++ |
3691 |
++ return rc; |
3692 |
+ } |
3693 |
+ |
3694 |
+ static void digital_in_recv_sens_res(struct nfc_digital_dev *ddev, void *arg, |
3695 |
+diff --git a/net/sched/sch_mqprio.c b/net/sched/sch_mqprio.c |
3696 |
+index 8766ab5b87880..5eb3b1b7ae5e7 100644 |
3697 |
+--- a/net/sched/sch_mqprio.c |
3698 |
++++ b/net/sched/sch_mqprio.c |
3699 |
+@@ -529,22 +529,28 @@ static int mqprio_dump_class_stats(struct Qdisc *sch, unsigned long cl, |
3700 |
+ for (i = tc.offset; i < tc.offset + tc.count; i++) { |
3701 |
+ struct netdev_queue *q = netdev_get_tx_queue(dev, i); |
3702 |
+ struct Qdisc *qdisc = rtnl_dereference(q->qdisc); |
3703 |
+- struct gnet_stats_basic_cpu __percpu *cpu_bstats = NULL; |
3704 |
+- struct gnet_stats_queue __percpu *cpu_qstats = NULL; |
3705 |
+ |
3706 |
+ spin_lock_bh(qdisc_lock(qdisc)); |
3707 |
++ |
3708 |
+ if (qdisc_is_percpu_stats(qdisc)) { |
3709 |
+- cpu_bstats = qdisc->cpu_bstats; |
3710 |
+- cpu_qstats = qdisc->cpu_qstats; |
3711 |
++ qlen = qdisc_qlen_sum(qdisc); |
3712 |
++ |
3713 |
++ __gnet_stats_copy_basic(NULL, &bstats, |
3714 |
++ qdisc->cpu_bstats, |
3715 |
++ &qdisc->bstats); |
3716 |
++ __gnet_stats_copy_queue(&qstats, |
3717 |
++ qdisc->cpu_qstats, |
3718 |
++ &qdisc->qstats, |
3719 |
++ qlen); |
3720 |
++ } else { |
3721 |
++ qlen += qdisc->q.qlen; |
3722 |
++ bstats.bytes += qdisc->bstats.bytes; |
3723 |
++ bstats.packets += qdisc->bstats.packets; |
3724 |
++ qstats.backlog += qdisc->qstats.backlog; |
3725 |
++ qstats.drops += qdisc->qstats.drops; |
3726 |
++ qstats.requeues += qdisc->qstats.requeues; |
3727 |
++ qstats.overlimits += qdisc->qstats.overlimits; |
3728 |
+ } |
3729 |
+- |
3730 |
+- qlen = qdisc_qlen_sum(qdisc); |
3731 |
+- __gnet_stats_copy_basic(NULL, &sch->bstats, |
3732 |
+- cpu_bstats, &qdisc->bstats); |
3733 |
+- __gnet_stats_copy_queue(&sch->qstats, |
3734 |
+- cpu_qstats, |
3735 |
+- &qdisc->qstats, |
3736 |
+- qlen); |
3737 |
+ spin_unlock_bh(qdisc_lock(qdisc)); |
3738 |
+ } |
3739 |
+ |
3740 |
+diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c |
3741 |
+index b8fa8f1a72770..c7503fd649159 100644 |
3742 |
+--- a/net/sctp/sm_make_chunk.c |
3743 |
++++ b/net/sctp/sm_make_chunk.c |
3744 |
+@@ -3697,7 +3697,7 @@ struct sctp_chunk *sctp_make_strreset_req( |
3745 |
+ outlen = (sizeof(outreq) + stream_len) * out; |
3746 |
+ inlen = (sizeof(inreq) + stream_len) * in; |
3747 |
+ |
3748 |
+- retval = sctp_make_reconf(asoc, outlen + inlen); |
3749 |
++ retval = sctp_make_reconf(asoc, SCTP_PAD4(outlen) + SCTP_PAD4(inlen)); |
3750 |
+ if (!retval) |
3751 |
+ return NULL; |
3752 |
+ |
3753 |
+diff --git a/net/smc/smc_cdc.c b/net/smc/smc_cdc.c |
3754 |
+index f23f558054a7c..99acd337ba90d 100644 |
3755 |
+--- a/net/smc/smc_cdc.c |
3756 |
++++ b/net/smc/smc_cdc.c |
3757 |
+@@ -150,9 +150,11 @@ static int smcr_cdc_get_slot_and_msg_send(struct smc_connection *conn) |
3758 |
+ |
3759 |
+ again: |
3760 |
+ link = conn->lnk; |
3761 |
++ if (!smc_wr_tx_link_hold(link)) |
3762 |
++ return -ENOLINK; |
3763 |
+ rc = smc_cdc_get_free_slot(conn, link, &wr_buf, NULL, &pend); |
3764 |
+ if (rc) |
3765 |
+- return rc; |
3766 |
++ goto put_out; |
3767 |
+ |
3768 |
+ spin_lock_bh(&conn->send_lock); |
3769 |
+ if (link != conn->lnk) { |
3770 |
+@@ -160,6 +162,7 @@ again: |
3771 |
+ spin_unlock_bh(&conn->send_lock); |
3772 |
+ smc_wr_tx_put_slot(link, |
3773 |
+ (struct smc_wr_tx_pend_priv *)pend); |
3774 |
++ smc_wr_tx_link_put(link); |
3775 |
+ if (again) |
3776 |
+ return -ENOLINK; |
3777 |
+ again = true; |
3778 |
+@@ -167,6 +170,8 @@ again: |
3779 |
+ } |
3780 |
+ rc = smc_cdc_msg_send(conn, wr_buf, pend); |
3781 |
+ spin_unlock_bh(&conn->send_lock); |
3782 |
++put_out: |
3783 |
++ smc_wr_tx_link_put(link); |
3784 |
+ return rc; |
3785 |
+ } |
3786 |
+ |
3787 |
+diff --git a/net/smc/smc_core.c b/net/smc/smc_core.c |
3788 |
+index 116cfd6fac1ff..fa53b2146d8c0 100644 |
3789 |
+--- a/net/smc/smc_core.c |
3790 |
++++ b/net/smc/smc_core.c |
3791 |
+@@ -949,7 +949,7 @@ struct smc_link *smc_switch_conns(struct smc_link_group *lgr, |
3792 |
+ to_lnk = &lgr->lnk[i]; |
3793 |
+ break; |
3794 |
+ } |
3795 |
+- if (!to_lnk) { |
3796 |
++ if (!to_lnk || !smc_wr_tx_link_hold(to_lnk)) { |
3797 |
+ smc_lgr_terminate_sched(lgr); |
3798 |
+ return NULL; |
3799 |
+ } |
3800 |
+@@ -981,24 +981,26 @@ again: |
3801 |
+ read_unlock_bh(&lgr->conns_lock); |
3802 |
+ /* pre-fetch buffer outside of send_lock, might sleep */ |
3803 |
+ rc = smc_cdc_get_free_slot(conn, to_lnk, &wr_buf, NULL, &pend); |
3804 |
+- if (rc) { |
3805 |
+- smcr_link_down_cond_sched(to_lnk); |
3806 |
+- return NULL; |
3807 |
+- } |
3808 |
++ if (rc) |
3809 |
++ goto err_out; |
3810 |
+ /* avoid race with smcr_tx_sndbuf_nonempty() */ |
3811 |
+ spin_lock_bh(&conn->send_lock); |
3812 |
+ smc_switch_link_and_count(conn, to_lnk); |
3813 |
+ rc = smc_switch_cursor(smc, pend, wr_buf); |
3814 |
+ spin_unlock_bh(&conn->send_lock); |
3815 |
+ sock_put(&smc->sk); |
3816 |
+- if (rc) { |
3817 |
+- smcr_link_down_cond_sched(to_lnk); |
3818 |
+- return NULL; |
3819 |
+- } |
3820 |
++ if (rc) |
3821 |
++ goto err_out; |
3822 |
+ goto again; |
3823 |
+ } |
3824 |
+ read_unlock_bh(&lgr->conns_lock); |
3825 |
++ smc_wr_tx_link_put(to_lnk); |
3826 |
+ return to_lnk; |
3827 |
++ |
3828 |
++err_out: |
3829 |
++ smcr_link_down_cond_sched(to_lnk); |
3830 |
++ smc_wr_tx_link_put(to_lnk); |
3831 |
++ return NULL; |
3832 |
+ } |
3833 |
+ |
3834 |
+ static void smcr_buf_unuse(struct smc_buf_desc *rmb_desc, |
3835 |
+diff --git a/net/smc/smc_llc.c b/net/smc/smc_llc.c |
3836 |
+index 2e7560eba9812..72f4b72eb1753 100644 |
3837 |
+--- a/net/smc/smc_llc.c |
3838 |
++++ b/net/smc/smc_llc.c |
3839 |
+@@ -383,9 +383,11 @@ int smc_llc_send_confirm_link(struct smc_link *link, |
3840 |
+ struct smc_wr_buf *wr_buf; |
3841 |
+ int rc; |
3842 |
+ |
3843 |
++ if (!smc_wr_tx_link_hold(link)) |
3844 |
++ return -ENOLINK; |
3845 |
+ rc = smc_llc_add_pending_send(link, &wr_buf, &pend); |
3846 |
+ if (rc) |
3847 |
+- return rc; |
3848 |
++ goto put_out; |
3849 |
+ confllc = (struct smc_llc_msg_confirm_link *)wr_buf; |
3850 |
+ memset(confllc, 0, sizeof(*confllc)); |
3851 |
+ confllc->hd.common.type = SMC_LLC_CONFIRM_LINK; |
3852 |
+@@ -402,6 +404,8 @@ int smc_llc_send_confirm_link(struct smc_link *link, |
3853 |
+ confllc->max_links = SMC_LLC_ADD_LNK_MAX_LINKS; |
3854 |
+ /* send llc message */ |
3855 |
+ rc = smc_wr_tx_send(link, pend); |
3856 |
++put_out: |
3857 |
++ smc_wr_tx_link_put(link); |
3858 |
+ return rc; |
3859 |
+ } |
3860 |
+ |
3861 |
+@@ -415,9 +419,11 @@ static int smc_llc_send_confirm_rkey(struct smc_link *send_link, |
3862 |
+ struct smc_link *link; |
3863 |
+ int i, rc, rtok_ix; |
3864 |
+ |
3865 |
++ if (!smc_wr_tx_link_hold(send_link)) |
3866 |
++ return -ENOLINK; |
3867 |
+ rc = smc_llc_add_pending_send(send_link, &wr_buf, &pend); |
3868 |
+ if (rc) |
3869 |
+- return rc; |
3870 |
++ goto put_out; |
3871 |
+ rkeyllc = (struct smc_llc_msg_confirm_rkey *)wr_buf; |
3872 |
+ memset(rkeyllc, 0, sizeof(*rkeyllc)); |
3873 |
+ rkeyllc->hd.common.type = SMC_LLC_CONFIRM_RKEY; |
3874 |
+@@ -444,6 +450,8 @@ static int smc_llc_send_confirm_rkey(struct smc_link *send_link, |
3875 |
+ (u64)sg_dma_address(rmb_desc->sgt[send_link->link_idx].sgl)); |
3876 |
+ /* send llc message */ |
3877 |
+ rc = smc_wr_tx_send(send_link, pend); |
3878 |
++put_out: |
3879 |
++ smc_wr_tx_link_put(send_link); |
3880 |
+ return rc; |
3881 |
+ } |
3882 |
+ |
3883 |
+@@ -456,9 +464,11 @@ static int smc_llc_send_delete_rkey(struct smc_link *link, |
3884 |
+ struct smc_wr_buf *wr_buf; |
3885 |
+ int rc; |
3886 |
+ |
3887 |
++ if (!smc_wr_tx_link_hold(link)) |
3888 |
++ return -ENOLINK; |
3889 |
+ rc = smc_llc_add_pending_send(link, &wr_buf, &pend); |
3890 |
+ if (rc) |
3891 |
+- return rc; |
3892 |
++ goto put_out; |
3893 |
+ rkeyllc = (struct smc_llc_msg_delete_rkey *)wr_buf; |
3894 |
+ memset(rkeyllc, 0, sizeof(*rkeyllc)); |
3895 |
+ rkeyllc->hd.common.type = SMC_LLC_DELETE_RKEY; |
3896 |
+@@ -467,6 +477,8 @@ static int smc_llc_send_delete_rkey(struct smc_link *link, |
3897 |
+ rkeyllc->rkey[0] = htonl(rmb_desc->mr_rx[link->link_idx]->rkey); |
3898 |
+ /* send llc message */ |
3899 |
+ rc = smc_wr_tx_send(link, pend); |
3900 |
++put_out: |
3901 |
++ smc_wr_tx_link_put(link); |
3902 |
+ return rc; |
3903 |
+ } |
3904 |
+ |
3905 |
+@@ -480,9 +492,11 @@ int smc_llc_send_add_link(struct smc_link *link, u8 mac[], u8 gid[], |
3906 |
+ struct smc_wr_buf *wr_buf; |
3907 |
+ int rc; |
3908 |
+ |
3909 |
++ if (!smc_wr_tx_link_hold(link)) |
3910 |
++ return -ENOLINK; |
3911 |
+ rc = smc_llc_add_pending_send(link, &wr_buf, &pend); |
3912 |
+ if (rc) |
3913 |
+- return rc; |
3914 |
++ goto put_out; |
3915 |
+ addllc = (struct smc_llc_msg_add_link *)wr_buf; |
3916 |
+ |
3917 |
+ memset(addllc, 0, sizeof(*addllc)); |
3918 |
+@@ -504,6 +518,8 @@ int smc_llc_send_add_link(struct smc_link *link, u8 mac[], u8 gid[], |
3919 |
+ } |
3920 |
+ /* send llc message */ |
3921 |
+ rc = smc_wr_tx_send(link, pend); |
3922 |
++put_out: |
3923 |
++ smc_wr_tx_link_put(link); |
3924 |
+ return rc; |
3925 |
+ } |
3926 |
+ |
3927 |
+@@ -517,9 +533,11 @@ int smc_llc_send_delete_link(struct smc_link *link, u8 link_del_id, |
3928 |
+ struct smc_wr_buf *wr_buf; |
3929 |
+ int rc; |
3930 |
+ |
3931 |
++ if (!smc_wr_tx_link_hold(link)) |
3932 |
++ return -ENOLINK; |
3933 |
+ rc = smc_llc_add_pending_send(link, &wr_buf, &pend); |
3934 |
+ if (rc) |
3935 |
+- return rc; |
3936 |
++ goto put_out; |
3937 |
+ delllc = (struct smc_llc_msg_del_link *)wr_buf; |
3938 |
+ |
3939 |
+ memset(delllc, 0, sizeof(*delllc)); |
3940 |
+@@ -536,6 +554,8 @@ int smc_llc_send_delete_link(struct smc_link *link, u8 link_del_id, |
3941 |
+ delllc->reason = htonl(reason); |
3942 |
+ /* send llc message */ |
3943 |
+ rc = smc_wr_tx_send(link, pend); |
3944 |
++put_out: |
3945 |
++ smc_wr_tx_link_put(link); |
3946 |
+ return rc; |
3947 |
+ } |
3948 |
+ |
3949 |
+@@ -547,9 +567,11 @@ static int smc_llc_send_test_link(struct smc_link *link, u8 user_data[16]) |
3950 |
+ struct smc_wr_buf *wr_buf; |
3951 |
+ int rc; |
3952 |
+ |
3953 |
++ if (!smc_wr_tx_link_hold(link)) |
3954 |
++ return -ENOLINK; |
3955 |
+ rc = smc_llc_add_pending_send(link, &wr_buf, &pend); |
3956 |
+ if (rc) |
3957 |
+- return rc; |
3958 |
++ goto put_out; |
3959 |
+ testllc = (struct smc_llc_msg_test_link *)wr_buf; |
3960 |
+ memset(testllc, 0, sizeof(*testllc)); |
3961 |
+ testllc->hd.common.type = SMC_LLC_TEST_LINK; |
3962 |
+@@ -557,6 +579,8 @@ static int smc_llc_send_test_link(struct smc_link *link, u8 user_data[16]) |
3963 |
+ memcpy(testllc->user_data, user_data, sizeof(testllc->user_data)); |
3964 |
+ /* send llc message */ |
3965 |
+ rc = smc_wr_tx_send(link, pend); |
3966 |
++put_out: |
3967 |
++ smc_wr_tx_link_put(link); |
3968 |
+ return rc; |
3969 |
+ } |
3970 |
+ |
3971 |
+@@ -567,13 +591,16 @@ static int smc_llc_send_message(struct smc_link *link, void *llcbuf) |
3972 |
+ struct smc_wr_buf *wr_buf; |
3973 |
+ int rc; |
3974 |
+ |
3975 |
+- if (!smc_link_usable(link)) |
3976 |
++ if (!smc_wr_tx_link_hold(link)) |
3977 |
+ return -ENOLINK; |
3978 |
+ rc = smc_llc_add_pending_send(link, &wr_buf, &pend); |
3979 |
+ if (rc) |
3980 |
+- return rc; |
3981 |
++ goto put_out; |
3982 |
+ memcpy(wr_buf, llcbuf, sizeof(union smc_llc_msg)); |
3983 |
+- return smc_wr_tx_send(link, pend); |
3984 |
++ rc = smc_wr_tx_send(link, pend); |
3985 |
++put_out: |
3986 |
++ smc_wr_tx_link_put(link); |
3987 |
++ return rc; |
3988 |
+ } |
3989 |
+ |
3990 |
+ /* schedule an llc send on link, may wait for buffers, |
3991 |
+@@ -586,13 +613,16 @@ static int smc_llc_send_message_wait(struct smc_link *link, void *llcbuf) |
3992 |
+ struct smc_wr_buf *wr_buf; |
3993 |
+ int rc; |
3994 |
+ |
3995 |
+- if (!smc_link_usable(link)) |
3996 |
++ if (!smc_wr_tx_link_hold(link)) |
3997 |
+ return -ENOLINK; |
3998 |
+ rc = smc_llc_add_pending_send(link, &wr_buf, &pend); |
3999 |
+ if (rc) |
4000 |
+- return rc; |
4001 |
++ goto put_out; |
4002 |
+ memcpy(wr_buf, llcbuf, sizeof(union smc_llc_msg)); |
4003 |
+- return smc_wr_tx_send_wait(link, pend, SMC_LLC_WAIT_TIME); |
4004 |
++ rc = smc_wr_tx_send_wait(link, pend, SMC_LLC_WAIT_TIME); |
4005 |
++put_out: |
4006 |
++ smc_wr_tx_link_put(link); |
4007 |
++ return rc; |
4008 |
+ } |
4009 |
+ |
4010 |
+ /********************************* receive ***********************************/ |
4011 |
+@@ -672,9 +702,11 @@ static int smc_llc_add_link_cont(struct smc_link *link, |
4012 |
+ struct smc_buf_desc *rmb; |
4013 |
+ u8 n; |
4014 |
+ |
4015 |
++ if (!smc_wr_tx_link_hold(link)) |
4016 |
++ return -ENOLINK; |
4017 |
+ rc = smc_llc_add_pending_send(link, &wr_buf, &pend); |
4018 |
+ if (rc) |
4019 |
+- return rc; |
4020 |
++ goto put_out; |
4021 |
+ addc_llc = (struct smc_llc_msg_add_link_cont *)wr_buf; |
4022 |
+ memset(addc_llc, 0, sizeof(*addc_llc)); |
4023 |
+ |
4024 |
+@@ -706,7 +738,10 @@ static int smc_llc_add_link_cont(struct smc_link *link, |
4025 |
+ addc_llc->hd.length = sizeof(struct smc_llc_msg_add_link_cont); |
4026 |
+ if (lgr->role == SMC_CLNT) |
4027 |
+ addc_llc->hd.flags |= SMC_LLC_FLAG_RESP; |
4028 |
+- return smc_wr_tx_send(link, pend); |
4029 |
++ rc = smc_wr_tx_send(link, pend); |
4030 |
++put_out: |
4031 |
++ smc_wr_tx_link_put(link); |
4032 |
++ return rc; |
4033 |
+ } |
4034 |
+ |
4035 |
+ static int smc_llc_cli_rkey_exchange(struct smc_link *link, |
4036 |
+diff --git a/net/smc/smc_tx.c b/net/smc/smc_tx.c |
4037 |
+index c79361dfcdfb9..738a4a99c8279 100644 |
4038 |
+--- a/net/smc/smc_tx.c |
4039 |
++++ b/net/smc/smc_tx.c |
4040 |
+@@ -496,7 +496,7 @@ static int smc_tx_rdma_writes(struct smc_connection *conn, |
4041 |
+ /* Wakeup sndbuf consumers from any context (IRQ or process) |
4042 |
+ * since there is more data to transmit; usable snd_wnd as max transmit |
4043 |
+ */ |
4044 |
+-static int _smcr_tx_sndbuf_nonempty(struct smc_connection *conn) |
4045 |
++static int smcr_tx_sndbuf_nonempty(struct smc_connection *conn) |
4046 |
+ { |
4047 |
+ struct smc_cdc_producer_flags *pflags = &conn->local_tx_ctrl.prod_flags; |
4048 |
+ struct smc_link *link = conn->lnk; |
4049 |
+@@ -505,8 +505,11 @@ static int _smcr_tx_sndbuf_nonempty(struct smc_connection *conn) |
4050 |
+ struct smc_wr_buf *wr_buf; |
4051 |
+ int rc; |
4052 |
+ |
4053 |
++ if (!link || !smc_wr_tx_link_hold(link)) |
4054 |
++ return -ENOLINK; |
4055 |
+ rc = smc_cdc_get_free_slot(conn, link, &wr_buf, &wr_rdma_buf, &pend); |
4056 |
+ if (rc < 0) { |
4057 |
++ smc_wr_tx_link_put(link); |
4058 |
+ if (rc == -EBUSY) { |
4059 |
+ struct smc_sock *smc = |
4060 |
+ container_of(conn, struct smc_sock, conn); |
4061 |
+@@ -547,22 +550,7 @@ static int _smcr_tx_sndbuf_nonempty(struct smc_connection *conn) |
4062 |
+ |
4063 |
+ out_unlock: |
4064 |
+ spin_unlock_bh(&conn->send_lock); |
4065 |
+- return rc; |
4066 |
+-} |
4067 |
+- |
4068 |
+-static int smcr_tx_sndbuf_nonempty(struct smc_connection *conn) |
4069 |
+-{ |
4070 |
+- struct smc_link *link = conn->lnk; |
4071 |
+- int rc = -ENOLINK; |
4072 |
+- |
4073 |
+- if (!link) |
4074 |
+- return rc; |
4075 |
+- |
4076 |
+- atomic_inc(&link->wr_tx_refcnt); |
4077 |
+- if (smc_link_usable(link)) |
4078 |
+- rc = _smcr_tx_sndbuf_nonempty(conn); |
4079 |
+- if (atomic_dec_and_test(&link->wr_tx_refcnt)) |
4080 |
+- wake_up_all(&link->wr_tx_wait); |
4081 |
++ smc_wr_tx_link_put(link); |
4082 |
+ return rc; |
4083 |
+ } |
4084 |
+ |
4085 |
+diff --git a/net/smc/smc_wr.h b/net/smc/smc_wr.h |
4086 |
+index 423b8709f1c9e..2bc626f230a56 100644 |
4087 |
+--- a/net/smc/smc_wr.h |
4088 |
++++ b/net/smc/smc_wr.h |
4089 |
+@@ -60,6 +60,20 @@ static inline void smc_wr_tx_set_wr_id(atomic_long_t *wr_tx_id, long val) |
4090 |
+ atomic_long_set(wr_tx_id, val); |
4091 |
+ } |
4092 |
+ |
4093 |
++static inline bool smc_wr_tx_link_hold(struct smc_link *link) |
4094 |
++{ |
4095 |
++ if (!smc_link_usable(link)) |
4096 |
++ return false; |
4097 |
++ atomic_inc(&link->wr_tx_refcnt); |
4098 |
++ return true; |
4099 |
++} |
4100 |
++ |
4101 |
++static inline void smc_wr_tx_link_put(struct smc_link *link) |
4102 |
++{ |
4103 |
++ if (atomic_dec_and_test(&link->wr_tx_refcnt)) |
4104 |
++ wake_up_all(&link->wr_tx_wait); |
4105 |
++} |
4106 |
++ |
4107 |
+ static inline void smc_wr_wakeup_tx_wait(struct smc_link *lnk) |
4108 |
+ { |
4109 |
+ wake_up_all(&lnk->wr_tx_wait); |
4110 |
+diff --git a/scripts/recordmcount.pl b/scripts/recordmcount.pl |
4111 |
+index 8f6b13ae46bfc..7d631aaa0ae11 100755 |
4112 |
+--- a/scripts/recordmcount.pl |
4113 |
++++ b/scripts/recordmcount.pl |
4114 |
+@@ -189,7 +189,7 @@ if ($arch =~ /(x86(_64)?)|(i386)/) { |
4115 |
+ $local_regex = "^[0-9a-fA-F]+\\s+t\\s+(\\S+)"; |
4116 |
+ $weak_regex = "^[0-9a-fA-F]+\\s+([wW])\\s+(\\S+)"; |
4117 |
+ $section_regex = "Disassembly of section\\s+(\\S+):"; |
4118 |
+-$function_regex = "^([0-9a-fA-F]+)\\s+<(.*?)>:"; |
4119 |
++$function_regex = "^([0-9a-fA-F]+)\\s+<([^^]*?)>:"; |
4120 |
+ $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\s(mcount|__fentry__)\$"; |
4121 |
+ $section_type = '@progbits'; |
4122 |
+ $mcount_adjust = 0; |
4123 |
+diff --git a/sound/core/pcm_compat.c b/sound/core/pcm_compat.c |
4124 |
+index a59de24695ec9..dfe5a64e19d2e 100644 |
4125 |
+--- a/sound/core/pcm_compat.c |
4126 |
++++ b/sound/core/pcm_compat.c |
4127 |
+@@ -468,6 +468,76 @@ static int snd_pcm_ioctl_sync_ptr_x32(struct snd_pcm_substream *substream, |
4128 |
+ } |
4129 |
+ #endif /* CONFIG_X86_X32 */ |
4130 |
+ |
4131 |
++#ifdef __BIG_ENDIAN |
4132 |
++typedef char __pad_before_u32[4]; |
4133 |
++typedef char __pad_after_u32[0]; |
4134 |
++#else |
4135 |
++typedef char __pad_before_u32[0]; |
4136 |
++typedef char __pad_after_u32[4]; |
4137 |
++#endif |
4138 |
++ |
4139 |
++/* PCM 2.0.15 API definition had a bug in mmap control; it puts the avail_min |
4140 |
++ * at the wrong offset due to a typo in padding type. |
4141 |
++ * The bug hits only 32bit. |
4142 |
++ * A workaround for incorrect read/write is needed only in 32bit compat mode. |
4143 |
++ */ |
4144 |
++struct __snd_pcm_mmap_control64_buggy { |
4145 |
++ __pad_before_u32 __pad1; |
4146 |
++ __u32 appl_ptr; |
4147 |
++ __pad_before_u32 __pad2; /* SiC! here is the bug */ |
4148 |
++ __pad_before_u32 __pad3; |
4149 |
++ __u32 avail_min; |
4150 |
++ __pad_after_uframe __pad4; |
4151 |
++}; |
4152 |
++ |
4153 |
++static int snd_pcm_ioctl_sync_ptr_buggy(struct snd_pcm_substream *substream, |
4154 |
++ struct snd_pcm_sync_ptr __user *_sync_ptr) |
4155 |
++{ |
4156 |
++ struct snd_pcm_runtime *runtime = substream->runtime; |
4157 |
++ struct snd_pcm_sync_ptr sync_ptr; |
4158 |
++ struct __snd_pcm_mmap_control64_buggy *sync_cp; |
4159 |
++ volatile struct snd_pcm_mmap_status *status; |
4160 |
++ volatile struct snd_pcm_mmap_control *control; |
4161 |
++ int err; |
4162 |
++ |
4163 |
++ memset(&sync_ptr, 0, sizeof(sync_ptr)); |
4164 |
++ sync_cp = (struct __snd_pcm_mmap_control64_buggy *)&sync_ptr.c.control; |
4165 |
++ if (get_user(sync_ptr.flags, (unsigned __user *)&(_sync_ptr->flags))) |
4166 |
++ return -EFAULT; |
4167 |
++ if (copy_from_user(sync_cp, &(_sync_ptr->c.control), sizeof(*sync_cp))) |
4168 |
++ return -EFAULT; |
4169 |
++ status = runtime->status; |
4170 |
++ control = runtime->control; |
4171 |
++ if (sync_ptr.flags & SNDRV_PCM_SYNC_PTR_HWSYNC) { |
4172 |
++ err = snd_pcm_hwsync(substream); |
4173 |
++ if (err < 0) |
4174 |
++ return err; |
4175 |
++ } |
4176 |
++ snd_pcm_stream_lock_irq(substream); |
4177 |
++ if (!(sync_ptr.flags & SNDRV_PCM_SYNC_PTR_APPL)) { |
4178 |
++ err = pcm_lib_apply_appl_ptr(substream, sync_cp->appl_ptr); |
4179 |
++ if (err < 0) { |
4180 |
++ snd_pcm_stream_unlock_irq(substream); |
4181 |
++ return err; |
4182 |
++ } |
4183 |
++ } else { |
4184 |
++ sync_cp->appl_ptr = control->appl_ptr; |
4185 |
++ } |
4186 |
++ if (!(sync_ptr.flags & SNDRV_PCM_SYNC_PTR_AVAIL_MIN)) |
4187 |
++ control->avail_min = sync_cp->avail_min; |
4188 |
++ else |
4189 |
++ sync_cp->avail_min = control->avail_min; |
4190 |
++ sync_ptr.s.status.state = status->state; |
4191 |
++ sync_ptr.s.status.hw_ptr = status->hw_ptr; |
4192 |
++ sync_ptr.s.status.tstamp = status->tstamp; |
4193 |
++ sync_ptr.s.status.suspended_state = status->suspended_state; |
4194 |
++ sync_ptr.s.status.audio_tstamp = status->audio_tstamp; |
4195 |
++ snd_pcm_stream_unlock_irq(substream); |
4196 |
++ if (copy_to_user(_sync_ptr, &sync_ptr, sizeof(sync_ptr))) |
4197 |
++ return -EFAULT; |
4198 |
++ return 0; |
4199 |
++} |
4200 |
++ |
4201 |
+ /* |
4202 |
+ */ |
4203 |
+ enum { |
4204 |
+@@ -537,7 +607,7 @@ static long snd_pcm_ioctl_compat(struct file *file, unsigned int cmd, unsigned l |
4205 |
+ if (in_x32_syscall()) |
4206 |
+ return snd_pcm_ioctl_sync_ptr_x32(substream, argp); |
4207 |
+ #endif /* CONFIG_X86_X32 */ |
4208 |
+- return snd_pcm_common_ioctl(file, substream, cmd, argp); |
4209 |
++ return snd_pcm_ioctl_sync_ptr_buggy(substream, argp); |
4210 |
+ case SNDRV_PCM_IOCTL_HW_REFINE32: |
4211 |
+ return snd_pcm_ioctl_hw_params_compat(substream, 1, argp); |
4212 |
+ case SNDRV_PCM_IOCTL_HW_PARAMS32: |
4213 |
+diff --git a/sound/core/seq_device.c b/sound/core/seq_device.c |
4214 |
+index 382275c5b1937..7f3fd8eb016fe 100644 |
4215 |
+--- a/sound/core/seq_device.c |
4216 |
++++ b/sound/core/seq_device.c |
4217 |
+@@ -156,6 +156,8 @@ static int snd_seq_device_dev_free(struct snd_device *device) |
4218 |
+ struct snd_seq_device *dev = device->device_data; |
4219 |
+ |
4220 |
+ cancel_autoload_drivers(); |
4221 |
++ if (dev->private_free) |
4222 |
++ dev->private_free(dev); |
4223 |
+ put_device(&dev->dev); |
4224 |
+ return 0; |
4225 |
+ } |
4226 |
+@@ -183,11 +185,7 @@ static int snd_seq_device_dev_disconnect(struct snd_device *device) |
4227 |
+ |
4228 |
+ static void snd_seq_dev_release(struct device *dev) |
4229 |
+ { |
4230 |
+- struct snd_seq_device *sdev = to_seq_dev(dev); |
4231 |
+- |
4232 |
+- if (sdev->private_free) |
4233 |
+- sdev->private_free(sdev); |
4234 |
+- kfree(sdev); |
4235 |
++ kfree(to_seq_dev(dev)); |
4236 |
+ } |
4237 |
+ |
4238 |
+ /* |
4239 |
+diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c |
4240 |
+index 0b9230a274b0a..8e6ff50f0f94f 100644 |
4241 |
+--- a/sound/pci/hda/patch_realtek.c |
4242 |
++++ b/sound/pci/hda/patch_realtek.c |
4243 |
+@@ -527,6 +527,8 @@ static void alc_shutup_pins(struct hda_codec *codec) |
4244 |
+ struct alc_spec *spec = codec->spec; |
4245 |
+ |
4246 |
+ switch (codec->core.vendor_id) { |
4247 |
++ case 0x10ec0236: |
4248 |
++ case 0x10ec0256: |
4249 |
+ case 0x10ec0283: |
4250 |
+ case 0x10ec0286: |
4251 |
+ case 0x10ec0288: |
4252 |
+@@ -2549,7 +2551,8 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = { |
4253 |
+ SND_PCI_QUIRK(0x1558, 0x67e1, "Clevo PB71[DE][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS), |
4254 |
+ SND_PCI_QUIRK(0x1558, 0x67e5, "Clevo PC70D[PRS](?:-D|-G)?", ALC1220_FIXUP_CLEVO_PB51ED_PINS), |
4255 |
+ SND_PCI_QUIRK(0x1558, 0x70d1, "Clevo PC70[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS), |
4256 |
+- SND_PCI_QUIRK(0x1558, 0x7714, "Clevo X170", ALC1220_FIXUP_CLEVO_PB51ED_PINS), |
4257 |
++ SND_PCI_QUIRK(0x1558, 0x7714, "Clevo X170SM", ALC1220_FIXUP_CLEVO_PB51ED_PINS), |
4258 |
++ SND_PCI_QUIRK(0x1558, 0x7715, "Clevo X170KM-G", ALC1220_FIXUP_CLEVO_PB51ED), |
4259 |
+ SND_PCI_QUIRK(0x1558, 0x9501, "Clevo P950HR", ALC1220_FIXUP_CLEVO_P950), |
4260 |
+ SND_PCI_QUIRK(0x1558, 0x9506, "Clevo P955HQ", ALC1220_FIXUP_CLEVO_P950), |
4261 |
+ SND_PCI_QUIRK(0x1558, 0x950a, "Clevo P955H[PR]", ALC1220_FIXUP_CLEVO_P950), |
4262 |
+@@ -3540,7 +3543,8 @@ static void alc256_shutup(struct hda_codec *codec) |
4263 |
+ /* If disable 3k pulldown control for alc257, the Mic detection will not work correctly |
4264 |
+ * when booting with headset plugged. So skip setting it for the codec alc257 |
4265 |
+ */ |
4266 |
+- if (codec->core.vendor_id != 0x10ec0257) |
4267 |
++ if (spec->codec_variant != ALC269_TYPE_ALC257 && |
4268 |
++ spec->codec_variant != ALC269_TYPE_ALC256) |
4269 |
+ alc_update_coef_idx(codec, 0x46, 0, 3 << 12); |
4270 |
+ |
4271 |
+ if (!spec->no_shutup_pins) |
4272 |
+@@ -6462,6 +6466,24 @@ static void alc287_fixup_legion_15imhg05_speakers(struct hda_codec *codec, |
4273 |
+ /* for alc285_fixup_ideapad_s740_coef() */ |
4274 |
+ #include "ideapad_s740_helper.c" |
4275 |
+ |
4276 |
++static void alc256_fixup_tongfang_reset_persistent_settings(struct hda_codec *codec, |
4277 |
++ const struct hda_fixup *fix, |
4278 |
++ int action) |
4279 |
++{ |
4280 |
++ /* |
4281 |
++ * A certain other OS sets these coeffs to different values. On at least one TongFang |
4282 |
++ * barebone these settings might survive even a cold reboot. So to restore a clean slate the |
4283 |
++ * values are explicitly reset to default here. Without this, the external microphone is |
4284 |
++ * always in a plugged-in state, while the internal microphone is always in an unplugged |
4285 |
++ * state, breaking the ability to use the internal microphone. |
4286 |
++ */ |
4287 |
++ alc_write_coef_idx(codec, 0x24, 0x0000); |
4288 |
++ alc_write_coef_idx(codec, 0x26, 0x0000); |
4289 |
++ alc_write_coef_idx(codec, 0x29, 0x3000); |
4290 |
++ alc_write_coef_idx(codec, 0x37, 0xfe05); |
4291 |
++ alc_write_coef_idx(codec, 0x45, 0x5089); |
4292 |
++} |
4293 |
++ |
4294 |
+ enum { |
4295 |
+ ALC269_FIXUP_GPIO2, |
4296 |
+ ALC269_FIXUP_SONY_VAIO, |
4297 |
+@@ -6676,7 +6698,8 @@ enum { |
4298 |
+ ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS, |
4299 |
+ ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE, |
4300 |
+ ALC287_FIXUP_YOGA7_14ITL_SPEAKERS, |
4301 |
+- ALC287_FIXUP_13S_GEN2_SPEAKERS |
4302 |
++ ALC287_FIXUP_13S_GEN2_SPEAKERS, |
4303 |
++ ALC256_FIXUP_TONGFANG_RESET_PERSISTENT_SETTINGS, |
4304 |
+ }; |
4305 |
+ |
4306 |
+ static const struct hda_fixup alc269_fixups[] = { |
4307 |
+@@ -8357,7 +8380,7 @@ static const struct hda_fixup alc269_fixups[] = { |
4308 |
+ .v.verbs = (const struct hda_verb[]) { |
4309 |
+ { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 }, |
4310 |
+ { 0x20, AC_VERB_SET_PROC_COEF, 0x41 }, |
4311 |
+- { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 }, |
4312 |
++ { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 }, |
4313 |
+ { 0x20, AC_VERB_SET_PROC_COEF, 0x2 }, |
4314 |
+ { 0x20, AC_VERB_SET_PROC_COEF, 0x0 }, |
4315 |
+ { 0x20, AC_VERB_SET_PROC_COEF, 0x0 }, |
4316 |
+@@ -8374,6 +8397,10 @@ static const struct hda_fixup alc269_fixups[] = { |
4317 |
+ .chained = true, |
4318 |
+ .chain_id = ALC269_FIXUP_HEADSET_MODE, |
4319 |
+ }, |
4320 |
++ [ALC256_FIXUP_TONGFANG_RESET_PERSISTENT_SETTINGS] = { |
4321 |
++ .type = HDA_FIXUP_FUNC, |
4322 |
++ .v.func = alc256_fixup_tongfang_reset_persistent_settings, |
4323 |
++ }, |
4324 |
+ }; |
4325 |
+ |
4326 |
+ static const struct snd_pci_quirk alc269_fixup_tbl[] = { |
4327 |
+@@ -8465,6 +8492,9 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { |
4328 |
+ SND_PCI_QUIRK(0x1028, 0x0a30, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC), |
4329 |
+ SND_PCI_QUIRK(0x1028, 0x0a58, "Dell", ALC255_FIXUP_DELL_HEADSET_MIC), |
4330 |
+ SND_PCI_QUIRK(0x1028, 0x0a61, "Dell XPS 15 9510", ALC289_FIXUP_DUAL_SPK), |
4331 |
++ SND_PCI_QUIRK(0x1028, 0x0a62, "Dell Precision 5560", ALC289_FIXUP_DUAL_SPK), |
4332 |
++ SND_PCI_QUIRK(0x1028, 0x0a9d, "Dell Latitude 5430", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE), |
4333 |
++ SND_PCI_QUIRK(0x1028, 0x0a9e, "Dell Latitude 5430", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE), |
4334 |
+ SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), |
4335 |
+ SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), |
4336 |
+ SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2), |
4337 |
+@@ -8802,6 +8832,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { |
4338 |
+ SND_PCI_QUIRK(0x1b7d, 0xa831, "Ordissimo EVE2 ", ALC269VB_FIXUP_ORDISSIMO_EVE2), /* Also known as Malata PC-B1303 */ |
4339 |
+ SND_PCI_QUIRK(0x1c06, 0x2013, "Lemote A1802", ALC269_FIXUP_LEMOTE_A1802), |
4340 |
+ SND_PCI_QUIRK(0x1c06, 0x2015, "Lemote A190X", ALC269_FIXUP_LEMOTE_A190X), |
4341 |
++ SND_PCI_QUIRK(0x1d05, 0x1132, "TongFang PHxTxX1", ALC256_FIXUP_TONGFANG_RESET_PERSISTENT_SETTINGS), |
4342 |
+ SND_PCI_QUIRK(0x1d72, 0x1602, "RedmiBook", ALC255_FIXUP_XIAOMI_HEADSET_MIC), |
4343 |
+ SND_PCI_QUIRK(0x1d72, 0x1701, "XiaomiNotebook Pro", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE), |
4344 |
+ SND_PCI_QUIRK(0x1d72, 0x1901, "RedmiBook 14", ALC256_FIXUP_ASUS_HEADSET_MIC), |
4345 |
+@@ -10179,6 +10210,9 @@ enum { |
4346 |
+ ALC671_FIXUP_HP_HEADSET_MIC2, |
4347 |
+ ALC662_FIXUP_ACER_X2660G_HEADSET_MODE, |
4348 |
+ ALC662_FIXUP_ACER_NITRO_HEADSET_MODE, |
4349 |
++ ALC668_FIXUP_ASUS_NO_HEADSET_MIC, |
4350 |
++ ALC668_FIXUP_HEADSET_MIC, |
4351 |
++ ALC668_FIXUP_MIC_DET_COEF, |
4352 |
+ }; |
4353 |
+ |
4354 |
+ static const struct hda_fixup alc662_fixups[] = { |
4355 |
+@@ -10562,6 +10596,29 @@ static const struct hda_fixup alc662_fixups[] = { |
4356 |
+ .chained = true, |
4357 |
+ .chain_id = ALC662_FIXUP_USI_FUNC |
4358 |
+ }, |
4359 |
++ [ALC668_FIXUP_ASUS_NO_HEADSET_MIC] = { |
4360 |
++ .type = HDA_FIXUP_PINS, |
4361 |
++ .v.pins = (const struct hda_pintbl[]) { |
4362 |
++ { 0x1b, 0x04a1112c }, |
4363 |
++ { } |
4364 |
++ }, |
4365 |
++ .chained = true, |
4366 |
++ .chain_id = ALC668_FIXUP_HEADSET_MIC |
4367 |
++ }, |
4368 |
++ [ALC668_FIXUP_HEADSET_MIC] = { |
4369 |
++ .type = HDA_FIXUP_FUNC, |
4370 |
++ .v.func = alc269_fixup_headset_mic, |
4371 |
++ .chained = true, |
4372 |
++ .chain_id = ALC668_FIXUP_MIC_DET_COEF |
4373 |
++ }, |
4374 |
++ [ALC668_FIXUP_MIC_DET_COEF] = { |
4375 |
++ .type = HDA_FIXUP_VERBS, |
4376 |
++ .v.verbs = (const struct hda_verb[]) { |
4377 |
++ { 0x20, AC_VERB_SET_COEF_INDEX, 0x15 }, |
4378 |
++ { 0x20, AC_VERB_SET_PROC_COEF, 0x0d60 }, |
4379 |
++ {} |
4380 |
++ }, |
4381 |
++ }, |
4382 |
+ }; |
4383 |
+ |
4384 |
+ static const struct snd_pci_quirk alc662_fixup_tbl[] = { |
4385 |
+@@ -10597,6 +10654,7 @@ static const struct snd_pci_quirk alc662_fixup_tbl[] = { |
4386 |
+ SND_PCI_QUIRK(0x1043, 0x15a7, "ASUS UX51VZH", ALC662_FIXUP_BASS_16), |
4387 |
+ SND_PCI_QUIRK(0x1043, 0x177d, "ASUS N551", ALC668_FIXUP_ASUS_Nx51), |
4388 |
+ SND_PCI_QUIRK(0x1043, 0x17bd, "ASUS N751", ALC668_FIXUP_ASUS_Nx51), |
4389 |
++ SND_PCI_QUIRK(0x1043, 0x185d, "ASUS G551JW", ALC668_FIXUP_ASUS_NO_HEADSET_MIC), |
4390 |
+ SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71SL", ALC662_FIXUP_ASUS_MODE8), |
4391 |
+ SND_PCI_QUIRK(0x1043, 0x1b73, "ASUS N55SF", ALC662_FIXUP_BASS_16), |
4392 |
+ SND_PCI_QUIRK(0x1043, 0x1bf3, "ASUS N76VZ", ALC662_FIXUP_BASS_MODE4_CHMAP), |
4393 |
+diff --git a/sound/usb/mixer_scarlett_gen2.c b/sound/usb/mixer_scarlett_gen2.c |
4394 |
+index 3d5848d5481be..53ebabf424722 100644 |
4395 |
+--- a/sound/usb/mixer_scarlett_gen2.c |
4396 |
++++ b/sound/usb/mixer_scarlett_gen2.c |
4397 |
+@@ -2450,6 +2450,8 @@ static int scarlett2_update_monitor_other(struct usb_mixer_interface *mixer) |
4398 |
+ err = scarlett2_usb_get_config(mixer, |
4399 |
+ SCARLETT2_CONFIG_TALKBACK_MAP, |
4400 |
+ 1, &bitmap); |
4401 |
++ if (err < 0) |
4402 |
++ return err; |
4403 |
+ for (i = 0; i < num_mixes; i++, bitmap >>= 1) |
4404 |
+ private->talkback_map[i] = bitmap & 1; |
4405 |
+ } |
4406 |
+diff --git a/sound/usb/quirks-table.h b/sound/usb/quirks-table.h |
4407 |
+index 19bb499c17daa..147b831e1a82d 100644 |
4408 |
+--- a/sound/usb/quirks-table.h |
4409 |
++++ b/sound/usb/quirks-table.h |
4410 |
+@@ -77,6 +77,48 @@ |
4411 |
+ /* E-Mu 0204 USB */ |
4412 |
+ { USB_DEVICE_VENDOR_SPEC(0x041e, 0x3f19) }, |
4413 |
+ |
4414 |
++/* |
4415 |
++ * Creative Technology, Ltd Live! Cam Sync HD [VF0770] |
4416 |
++ * The device advertises 8 formats, but only a rate of 48kHz is honored by the |
4417 |
++ * hardware and 24 bits give chopped audio, so only report the one working |
4418 |
++ * combination. |
4419 |
++ */ |
4420 |
++{ |
4421 |
++ USB_DEVICE(0x041e, 0x4095), |
4422 |
++ .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) { |
4423 |
++ .ifnum = QUIRK_ANY_INTERFACE, |
4424 |
++ .type = QUIRK_COMPOSITE, |
4425 |
++ .data = &(const struct snd_usb_audio_quirk[]) { |
4426 |
++ { |
4427 |
++ .ifnum = 2, |
4428 |
++ .type = QUIRK_AUDIO_STANDARD_MIXER, |
4429 |
++ }, |
4430 |
++ { |
4431 |
++ .ifnum = 3, |
4432 |
++ .type = QUIRK_AUDIO_FIXED_ENDPOINT, |
4433 |
++ .data = &(const struct audioformat) { |
4434 |
++ .formats = SNDRV_PCM_FMTBIT_S16_LE, |
4435 |
++ .channels = 2, |
4436 |
++ .fmt_bits = 16, |
4437 |
++ .iface = 3, |
4438 |
++ .altsetting = 4, |
4439 |
++ .altset_idx = 4, |
4440 |
++ .endpoint = 0x82, |
4441 |
++ .ep_attr = 0x05, |
4442 |
++ .rates = SNDRV_PCM_RATE_48000, |
4443 |
++ .rate_min = 48000, |
4444 |
++ .rate_max = 48000, |
4445 |
++ .nr_rates = 1, |
4446 |
++ .rate_table = (unsigned int[]) { 48000 }, |
4447 |
++ }, |
4448 |
++ }, |
4449 |
++ { |
4450 |
++ .ifnum = -1 |
4451 |
++ }, |
4452 |
++ }, |
4453 |
++ }, |
4454 |
++}, |
4455 |
++ |
4456 |
+ /* |
4457 |
+ * HP Wireless Audio |
4458 |
+ * When not ignored, causes instability issues for some users, forcing them to |