1 |
commit: aec56589ca906076f1dc545d65c1cebcafaa9775 |
2 |
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
3 |
AuthorDate: Thu Sep 17 14:57:11 2020 +0000 |
4 |
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Sep 17 14:57:11 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=aec56589 |
7 |
|
8 |
Linux patch 5.8.10 |
9 |
|
10 |
Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org> |
11 |
|
12 |
0000_README | 4 + |
13 |
1009_linux-5.8.10.patch | 6953 +++++++++++++++++++++++++++++++++++++++++++++++ |
14 |
2 files changed, 6957 insertions(+) |
15 |
|
16 |
diff --git a/0000_README b/0000_README |
17 |
index 8c02383..f2e8a67 100644 |
18 |
--- a/0000_README |
19 |
+++ b/0000_README |
20 |
@@ -79,6 +79,10 @@ Patch: 1008_linux-5.8.9.patch |
21 |
From: http://www.kernel.org |
22 |
Desc: Linux 5.8.9 |
23 |
|
24 |
+Patch: 1009_linux-5.8.10.patch |
25 |
+From: http://www.kernel.org |
26 |
+Desc: Linux 5.8.10 |
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/1009_linux-5.8.10.patch b/1009_linux-5.8.10.patch |
33 |
new file mode 100644 |
34 |
index 0000000..bc12dd8 |
35 |
--- /dev/null |
36 |
+++ b/1009_linux-5.8.10.patch |
37 |
@@ -0,0 +1,6953 @@ |
38 |
+diff --git a/Documentation/sound/designs/timestamping.rst b/Documentation/sound/designs/timestamping.rst |
39 |
+index 2b0fff5034151..7c7ecf5dbc4bd 100644 |
40 |
+--- a/Documentation/sound/designs/timestamping.rst |
41 |
++++ b/Documentation/sound/designs/timestamping.rst |
42 |
+@@ -143,7 +143,7 @@ timestamp shows when the information is put together by the driver |
43 |
+ before returning from the ``STATUS`` and ``STATUS_EXT`` ioctl. in most cases |
44 |
+ this driver_timestamp will be identical to the regular system tstamp. |
45 |
+ |
46 |
+-Examples of typestamping with HDaudio: |
47 |
++Examples of timestamping with HDAudio: |
48 |
+ |
49 |
+ 1. DMA timestamp, no compensation for DMA+analog delay |
50 |
+ :: |
51 |
+diff --git a/Makefile b/Makefile |
52 |
+index 36eab48d1d4a6..d937530d33427 100644 |
53 |
+--- a/Makefile |
54 |
++++ b/Makefile |
55 |
+@@ -1,7 +1,7 @@ |
56 |
+ # SPDX-License-Identifier: GPL-2.0 |
57 |
+ VERSION = 5 |
58 |
+ PATCHLEVEL = 8 |
59 |
+-SUBLEVEL = 9 |
60 |
++SUBLEVEL = 10 |
61 |
+ EXTRAVERSION = |
62 |
+ NAME = Kleptomaniac Octopus |
63 |
+ |
64 |
+@@ -876,10 +876,6 @@ KBUILD_CFLAGS_KERNEL += -ffunction-sections -fdata-sections |
65 |
+ LDFLAGS_vmlinux += --gc-sections |
66 |
+ endif |
67 |
+ |
68 |
+-ifdef CONFIG_LIVEPATCH |
69 |
+-KBUILD_CFLAGS += $(call cc-option, -flive-patching=inline-clone) |
70 |
+-endif |
71 |
+- |
72 |
+ ifdef CONFIG_SHADOW_CALL_STACK |
73 |
+ CC_FLAGS_SCS := -fsanitize=shadow-call-stack |
74 |
+ KBUILD_CFLAGS += $(CC_FLAGS_SCS) |
75 |
+diff --git a/arch/arc/boot/dts/hsdk.dts b/arch/arc/boot/dts/hsdk.dts |
76 |
+index 9acbeba832c0b..dcaa44e408ace 100644 |
77 |
+--- a/arch/arc/boot/dts/hsdk.dts |
78 |
++++ b/arch/arc/boot/dts/hsdk.dts |
79 |
+@@ -88,6 +88,8 @@ |
80 |
+ |
81 |
+ arcpct: pct { |
82 |
+ compatible = "snps,archs-pct"; |
83 |
++ interrupt-parent = <&cpu_intc>; |
84 |
++ interrupts = <20>; |
85 |
+ }; |
86 |
+ |
87 |
+ /* TIMER0 with interrupt for clockevent */ |
88 |
+@@ -208,7 +210,7 @@ |
89 |
+ reg = <0x8000 0x2000>; |
90 |
+ interrupts = <10>; |
91 |
+ interrupt-names = "macirq"; |
92 |
+- phy-mode = "rgmii"; |
93 |
++ phy-mode = "rgmii-id"; |
94 |
+ snps,pbl = <32>; |
95 |
+ snps,multicast-filter-bins = <256>; |
96 |
+ clocks = <&gmacclk>; |
97 |
+@@ -226,7 +228,7 @@ |
98 |
+ #address-cells = <1>; |
99 |
+ #size-cells = <0>; |
100 |
+ compatible = "snps,dwmac-mdio"; |
101 |
+- phy0: ethernet-phy@0 { |
102 |
++ phy0: ethernet-phy@0 { /* Micrel KSZ9031 */ |
103 |
+ reg = <0>; |
104 |
+ }; |
105 |
+ }; |
106 |
+diff --git a/arch/arc/kernel/troubleshoot.c b/arch/arc/kernel/troubleshoot.c |
107 |
+index 28e8bf04b253f..a331bb5d8319f 100644 |
108 |
+--- a/arch/arc/kernel/troubleshoot.c |
109 |
++++ b/arch/arc/kernel/troubleshoot.c |
110 |
+@@ -18,44 +18,37 @@ |
111 |
+ |
112 |
+ #define ARC_PATH_MAX 256 |
113 |
+ |
114 |
+-/* |
115 |
+- * Common routine to print scratch regs (r0-r12) or callee regs (r13-r25) |
116 |
+- * -Prints 3 regs per line and a CR. |
117 |
+- * -To continue, callee regs right after scratch, special handling of CR |
118 |
+- */ |
119 |
+-static noinline void print_reg_file(long *reg_rev, int start_num) |
120 |
++static noinline void print_regs_scratch(struct pt_regs *regs) |
121 |
+ { |
122 |
+- unsigned int i; |
123 |
+- char buf[512]; |
124 |
+- int n = 0, len = sizeof(buf); |
125 |
+- |
126 |
+- for (i = start_num; i < start_num + 13; i++) { |
127 |
+- n += scnprintf(buf + n, len - n, "r%02u: 0x%08lx\t", |
128 |
+- i, (unsigned long)*reg_rev); |
129 |
+- |
130 |
+- if (((i + 1) % 3) == 0) |
131 |
+- n += scnprintf(buf + n, len - n, "\n"); |
132 |
+- |
133 |
+- /* because pt_regs has regs reversed: r12..r0, r25..r13 */ |
134 |
+- if (is_isa_arcv2() && start_num == 0) |
135 |
+- reg_rev++; |
136 |
+- else |
137 |
+- reg_rev--; |
138 |
+- } |
139 |
+- |
140 |
+- if (start_num != 0) |
141 |
+- n += scnprintf(buf + n, len - n, "\n\n"); |
142 |
++ pr_cont("BTA: 0x%08lx\n SP: 0x%08lx FP: 0x%08lx BLK: %pS\n", |
143 |
++ regs->bta, regs->sp, regs->fp, (void *)regs->blink); |
144 |
++ pr_cont("LPS: 0x%08lx\tLPE: 0x%08lx\tLPC: 0x%08lx\n", |
145 |
++ regs->lp_start, regs->lp_end, regs->lp_count); |
146 |
+ |
147 |
+- /* To continue printing callee regs on same line as scratch regs */ |
148 |
+- if (start_num == 0) |
149 |
+- pr_info("%s", buf); |
150 |
+- else |
151 |
+- pr_cont("%s\n", buf); |
152 |
++ pr_info("r00: 0x%08lx\tr01: 0x%08lx\tr02: 0x%08lx\n" \ |
153 |
++ "r03: 0x%08lx\tr04: 0x%08lx\tr05: 0x%08lx\n" \ |
154 |
++ "r06: 0x%08lx\tr07: 0x%08lx\tr08: 0x%08lx\n" \ |
155 |
++ "r09: 0x%08lx\tr10: 0x%08lx\tr11: 0x%08lx\n" \ |
156 |
++ "r12: 0x%08lx\t", |
157 |
++ regs->r0, regs->r1, regs->r2, |
158 |
++ regs->r3, regs->r4, regs->r5, |
159 |
++ regs->r6, regs->r7, regs->r8, |
160 |
++ regs->r9, regs->r10, regs->r11, |
161 |
++ regs->r12); |
162 |
+ } |
163 |
+ |
164 |
+-static void show_callee_regs(struct callee_regs *cregs) |
165 |
++static void print_regs_callee(struct callee_regs *regs) |
166 |
+ { |
167 |
+- print_reg_file(&(cregs->r13), 13); |
168 |
++ pr_cont("r13: 0x%08lx\tr14: 0x%08lx\n" \ |
169 |
++ "r15: 0x%08lx\tr16: 0x%08lx\tr17: 0x%08lx\n" \ |
170 |
++ "r18: 0x%08lx\tr19: 0x%08lx\tr20: 0x%08lx\n" \ |
171 |
++ "r21: 0x%08lx\tr22: 0x%08lx\tr23: 0x%08lx\n" \ |
172 |
++ "r24: 0x%08lx\tr25: 0x%08lx\n", |
173 |
++ regs->r13, regs->r14, |
174 |
++ regs->r15, regs->r16, regs->r17, |
175 |
++ regs->r18, regs->r19, regs->r20, |
176 |
++ regs->r21, regs->r22, regs->r23, |
177 |
++ regs->r24, regs->r25); |
178 |
+ } |
179 |
+ |
180 |
+ static void print_task_path_n_nm(struct task_struct *tsk) |
181 |
+@@ -175,7 +168,7 @@ static void show_ecr_verbose(struct pt_regs *regs) |
182 |
+ void show_regs(struct pt_regs *regs) |
183 |
+ { |
184 |
+ struct task_struct *tsk = current; |
185 |
+- struct callee_regs *cregs; |
186 |
++ struct callee_regs *cregs = (struct callee_regs *)tsk->thread.callee_reg; |
187 |
+ |
188 |
+ /* |
189 |
+ * generic code calls us with preemption disabled, but some calls |
190 |
+@@ -204,25 +197,15 @@ void show_regs(struct pt_regs *regs) |
191 |
+ STS_BIT(regs, A2), STS_BIT(regs, A1), |
192 |
+ STS_BIT(regs, E2), STS_BIT(regs, E1)); |
193 |
+ #else |
194 |
+- pr_cont(" [%2s%2s%2s%2s]", |
195 |
++ pr_cont(" [%2s%2s%2s%2s] ", |
196 |
+ STS_BIT(regs, IE), |
197 |
+ (regs->status32 & STATUS_U_MASK) ? "U " : "K ", |
198 |
+ STS_BIT(regs, DE), STS_BIT(regs, AE)); |
199 |
+ #endif |
200 |
+- pr_cont(" BTA: 0x%08lx\n SP: 0x%08lx FP: 0x%08lx BLK: %pS\n", |
201 |
+- regs->bta, regs->sp, regs->fp, (void *)regs->blink); |
202 |
+- pr_info("LPS: 0x%08lx\tLPE: 0x%08lx\tLPC: 0x%08lx\n", |
203 |
+- regs->lp_start, regs->lp_end, regs->lp_count); |
204 |
+- |
205 |
+- /* print regs->r0 thru regs->r12 |
206 |
+- * Sequential printing was generating horrible code |
207 |
+- */ |
208 |
+- print_reg_file(&(regs->r0), 0); |
209 |
+ |
210 |
+- /* If Callee regs were saved, display them too */ |
211 |
+- cregs = (struct callee_regs *)current->thread.callee_reg; |
212 |
++ print_regs_scratch(regs); |
213 |
+ if (cregs) |
214 |
+- show_callee_regs(cregs); |
215 |
++ print_regs_callee(cregs); |
216 |
+ |
217 |
+ preempt_disable(); |
218 |
+ } |
219 |
+diff --git a/arch/arc/plat-eznps/include/plat/ctop.h b/arch/arc/plat-eznps/include/plat/ctop.h |
220 |
+index a4a61531c7fb9..77712c5ffe848 100644 |
221 |
+--- a/arch/arc/plat-eznps/include/plat/ctop.h |
222 |
++++ b/arch/arc/plat-eznps/include/plat/ctop.h |
223 |
+@@ -33,7 +33,6 @@ |
224 |
+ #define CTOP_AUX_DPC (CTOP_AUX_BASE + 0x02C) |
225 |
+ #define CTOP_AUX_LPC (CTOP_AUX_BASE + 0x030) |
226 |
+ #define CTOP_AUX_EFLAGS (CTOP_AUX_BASE + 0x080) |
227 |
+-#define CTOP_AUX_IACK (CTOP_AUX_BASE + 0x088) |
228 |
+ #define CTOP_AUX_GPA1 (CTOP_AUX_BASE + 0x08C) |
229 |
+ #define CTOP_AUX_UDMC (CTOP_AUX_BASE + 0x300) |
230 |
+ |
231 |
+diff --git a/arch/arm/boot/dts/bcm-hr2.dtsi b/arch/arm/boot/dts/bcm-hr2.dtsi |
232 |
+index 5e5f5ca3c86f1..bba0e8cd2acbd 100644 |
233 |
+--- a/arch/arm/boot/dts/bcm-hr2.dtsi |
234 |
++++ b/arch/arm/boot/dts/bcm-hr2.dtsi |
235 |
+@@ -217,7 +217,7 @@ |
236 |
+ }; |
237 |
+ |
238 |
+ qspi: spi@27200 { |
239 |
+- compatible = "brcm,spi-bcm-qspi", "brcm,spi-nsp-qspi"; |
240 |
++ compatible = "brcm,spi-nsp-qspi", "brcm,spi-bcm-qspi"; |
241 |
+ reg = <0x027200 0x184>, |
242 |
+ <0x027000 0x124>, |
243 |
+ <0x11c408 0x004>, |
244 |
+diff --git a/arch/arm/boot/dts/bcm-nsp.dtsi b/arch/arm/boot/dts/bcm-nsp.dtsi |
245 |
+index 3175266ede646..465937b79c8e4 100644 |
246 |
+--- a/arch/arm/boot/dts/bcm-nsp.dtsi |
247 |
++++ b/arch/arm/boot/dts/bcm-nsp.dtsi |
248 |
+@@ -284,7 +284,7 @@ |
249 |
+ }; |
250 |
+ |
251 |
+ qspi: spi@27200 { |
252 |
+- compatible = "brcm,spi-bcm-qspi", "brcm,spi-nsp-qspi"; |
253 |
++ compatible = "brcm,spi-nsp-qspi", "brcm,spi-bcm-qspi"; |
254 |
+ reg = <0x027200 0x184>, |
255 |
+ <0x027000 0x124>, |
256 |
+ <0x11c408 0x004>, |
257 |
+diff --git a/arch/arm/boot/dts/bcm5301x.dtsi b/arch/arm/boot/dts/bcm5301x.dtsi |
258 |
+index 2d9b4dd058307..0016720ce5300 100644 |
259 |
+--- a/arch/arm/boot/dts/bcm5301x.dtsi |
260 |
++++ b/arch/arm/boot/dts/bcm5301x.dtsi |
261 |
+@@ -488,7 +488,7 @@ |
262 |
+ }; |
263 |
+ |
264 |
+ spi@18029200 { |
265 |
+- compatible = "brcm,spi-bcm-qspi", "brcm,spi-nsp-qspi"; |
266 |
++ compatible = "brcm,spi-nsp-qspi", "brcm,spi-bcm-qspi"; |
267 |
+ reg = <0x18029200 0x184>, |
268 |
+ <0x18029000 0x124>, |
269 |
+ <0x1811b408 0x004>, |
270 |
+diff --git a/arch/arm/boot/dts/imx6sx-pinfunc.h b/arch/arm/boot/dts/imx6sx-pinfunc.h |
271 |
+index 0b02c7e60c174..f4dc46207954c 100644 |
272 |
+--- a/arch/arm/boot/dts/imx6sx-pinfunc.h |
273 |
++++ b/arch/arm/boot/dts/imx6sx-pinfunc.h |
274 |
+@@ -1026,7 +1026,7 @@ |
275 |
+ #define MX6SX_PAD_QSPI1B_DQS__SIM_M_HADDR_15 0x01B0 0x04F8 0x0000 0x7 0x0 |
276 |
+ #define MX6SX_PAD_QSPI1B_SCLK__QSPI1_B_SCLK 0x01B4 0x04FC 0x0000 0x0 0x0 |
277 |
+ #define MX6SX_PAD_QSPI1B_SCLK__UART3_DCE_RX 0x01B4 0x04FC 0x0840 0x1 0x4 |
278 |
+-#define MX6SX_PAD_QSPI1B_SCLK__UART3_DTE_TX 0x01B4 0x04FC 0x0000 0x0 0x0 |
279 |
++#define MX6SX_PAD_QSPI1B_SCLK__UART3_DTE_TX 0x01B4 0x04FC 0x0000 0x1 0x0 |
280 |
+ #define MX6SX_PAD_QSPI1B_SCLK__ECSPI3_SCLK 0x01B4 0x04FC 0x0730 0x2 0x1 |
281 |
+ #define MX6SX_PAD_QSPI1B_SCLK__ESAI_RX_HF_CLK 0x01B4 0x04FC 0x0780 0x3 0x2 |
282 |
+ #define MX6SX_PAD_QSPI1B_SCLK__CSI1_DATA_16 0x01B4 0x04FC 0x06DC 0x4 0x1 |
283 |
+diff --git a/arch/arm/boot/dts/imx7d-zii-rmu2.dts b/arch/arm/boot/dts/imx7d-zii-rmu2.dts |
284 |
+index e5e20b07f184b..7cb6153fc650b 100644 |
285 |
+--- a/arch/arm/boot/dts/imx7d-zii-rmu2.dts |
286 |
++++ b/arch/arm/boot/dts/imx7d-zii-rmu2.dts |
287 |
+@@ -58,7 +58,7 @@ |
288 |
+ <&clks IMX7D_ENET1_TIME_ROOT_CLK>; |
289 |
+ assigned-clock-parents = <&clks IMX7D_PLL_ENET_MAIN_100M_CLK>; |
290 |
+ assigned-clock-rates = <0>, <100000000>; |
291 |
+- phy-mode = "rgmii"; |
292 |
++ phy-mode = "rgmii-id"; |
293 |
+ phy-handle = <&fec1_phy>; |
294 |
+ status = "okay"; |
295 |
+ |
296 |
+diff --git a/arch/arm/boot/dts/imx7ulp.dtsi b/arch/arm/boot/dts/imx7ulp.dtsi |
297 |
+index f7c4878534c8e..1bff3efe8aafe 100644 |
298 |
+--- a/arch/arm/boot/dts/imx7ulp.dtsi |
299 |
++++ b/arch/arm/boot/dts/imx7ulp.dtsi |
300 |
+@@ -394,7 +394,7 @@ |
301 |
+ clocks = <&pcc2 IMX7ULP_CLK_RGPIO2P1>, |
302 |
+ <&pcc3 IMX7ULP_CLK_PCTLC>; |
303 |
+ clock-names = "gpio", "port"; |
304 |
+- gpio-ranges = <&iomuxc1 0 0 32>; |
305 |
++ gpio-ranges = <&iomuxc1 0 0 20>; |
306 |
+ }; |
307 |
+ |
308 |
+ gpio_ptd: gpio@40af0000 { |
309 |
+@@ -408,7 +408,7 @@ |
310 |
+ clocks = <&pcc2 IMX7ULP_CLK_RGPIO2P1>, |
311 |
+ <&pcc3 IMX7ULP_CLK_PCTLD>; |
312 |
+ clock-names = "gpio", "port"; |
313 |
+- gpio-ranges = <&iomuxc1 0 32 32>; |
314 |
++ gpio-ranges = <&iomuxc1 0 32 12>; |
315 |
+ }; |
316 |
+ |
317 |
+ gpio_pte: gpio@40b00000 { |
318 |
+@@ -422,7 +422,7 @@ |
319 |
+ clocks = <&pcc2 IMX7ULP_CLK_RGPIO2P1>, |
320 |
+ <&pcc3 IMX7ULP_CLK_PCTLE>; |
321 |
+ clock-names = "gpio", "port"; |
322 |
+- gpio-ranges = <&iomuxc1 0 64 32>; |
323 |
++ gpio-ranges = <&iomuxc1 0 64 16>; |
324 |
+ }; |
325 |
+ |
326 |
+ gpio_ptf: gpio@40b10000 { |
327 |
+@@ -436,7 +436,7 @@ |
328 |
+ clocks = <&pcc2 IMX7ULP_CLK_RGPIO2P1>, |
329 |
+ <&pcc3 IMX7ULP_CLK_PCTLF>; |
330 |
+ clock-names = "gpio", "port"; |
331 |
+- gpio-ranges = <&iomuxc1 0 96 32>; |
332 |
++ gpio-ranges = <&iomuxc1 0 96 20>; |
333 |
+ }; |
334 |
+ }; |
335 |
+ |
336 |
+diff --git a/arch/arm/boot/dts/logicpd-som-lv-baseboard.dtsi b/arch/arm/boot/dts/logicpd-som-lv-baseboard.dtsi |
337 |
+index 100396f6c2feb..395e05f10d36c 100644 |
338 |
+--- a/arch/arm/boot/dts/logicpd-som-lv-baseboard.dtsi |
339 |
++++ b/arch/arm/boot/dts/logicpd-som-lv-baseboard.dtsi |
340 |
+@@ -51,6 +51,8 @@ |
341 |
+ |
342 |
+ &mcbsp2 { |
343 |
+ status = "okay"; |
344 |
++ pinctrl-names = "default"; |
345 |
++ pinctrl-0 = <&mcbsp2_pins>; |
346 |
+ }; |
347 |
+ |
348 |
+ &charger { |
349 |
+@@ -102,35 +104,18 @@ |
350 |
+ regulator-max-microvolt = <3300000>; |
351 |
+ }; |
352 |
+ |
353 |
+- lcd0: display@0 { |
354 |
+- compatible = "panel-dpi"; |
355 |
+- label = "28"; |
356 |
+- status = "okay"; |
357 |
+- /* default-on; */ |
358 |
++ lcd0: display { |
359 |
++ /* This isn't the exact LCD, but the timings meet spec */ |
360 |
++ compatible = "logicpd,type28"; |
361 |
+ pinctrl-names = "default"; |
362 |
+ pinctrl-0 = <&lcd_enable_pin>; |
363 |
+- enable-gpios = <&gpio5 27 GPIO_ACTIVE_HIGH>; /* gpio155, lcd INI */ |
364 |
++ backlight = <&bl>; |
365 |
++ enable-gpios = <&gpio5 27 GPIO_ACTIVE_HIGH>; |
366 |
+ port { |
367 |
+ lcd_in: endpoint { |
368 |
+ remote-endpoint = <&dpi_out>; |
369 |
+ }; |
370 |
+ }; |
371 |
+- |
372 |
+- panel-timing { |
373 |
+- clock-frequency = <9000000>; |
374 |
+- hactive = <480>; |
375 |
+- vactive = <272>; |
376 |
+- hfront-porch = <3>; |
377 |
+- hback-porch = <2>; |
378 |
+- hsync-len = <42>; |
379 |
+- vback-porch = <3>; |
380 |
+- vfront-porch = <2>; |
381 |
+- vsync-len = <11>; |
382 |
+- hsync-active = <1>; |
383 |
+- vsync-active = <1>; |
384 |
+- de-active = <1>; |
385 |
+- pixelclk-active = <0>; |
386 |
+- }; |
387 |
+ }; |
388 |
+ |
389 |
+ bl: backlight { |
390 |
+diff --git a/arch/arm/boot/dts/logicpd-torpedo-baseboard.dtsi b/arch/arm/boot/dts/logicpd-torpedo-baseboard.dtsi |
391 |
+index 381f0e82bb706..b0f6613e6d549 100644 |
392 |
+--- a/arch/arm/boot/dts/logicpd-torpedo-baseboard.dtsi |
393 |
++++ b/arch/arm/boot/dts/logicpd-torpedo-baseboard.dtsi |
394 |
+@@ -81,6 +81,8 @@ |
395 |
+ }; |
396 |
+ |
397 |
+ &mcbsp2 { |
398 |
++ pinctrl-names = "default"; |
399 |
++ pinctrl-0 = <&mcbsp2_pins>; |
400 |
+ status = "okay"; |
401 |
+ }; |
402 |
+ |
403 |
+diff --git a/arch/arm/boot/dts/ls1021a.dtsi b/arch/arm/boot/dts/ls1021a.dtsi |
404 |
+index b2ff27af090ec..9435ce527e855 100644 |
405 |
+--- a/arch/arm/boot/dts/ls1021a.dtsi |
406 |
++++ b/arch/arm/boot/dts/ls1021a.dtsi |
407 |
+@@ -181,7 +181,7 @@ |
408 |
+ #address-cells = <1>; |
409 |
+ #size-cells = <0>; |
410 |
+ reg = <0x0 0x1550000 0x0 0x10000>, |
411 |
+- <0x0 0x40000000 0x0 0x40000000>; |
412 |
++ <0x0 0x40000000 0x0 0x20000000>; |
413 |
+ reg-names = "QuadSPI", "QuadSPI-memory"; |
414 |
+ interrupts = <GIC_SPI 131 IRQ_TYPE_LEVEL_HIGH>; |
415 |
+ clock-names = "qspi_en", "qspi"; |
416 |
+diff --git a/arch/arm/boot/dts/omap5.dtsi b/arch/arm/boot/dts/omap5.dtsi |
417 |
+index fb889c5b00c9d..de55ac5e60f39 100644 |
418 |
+--- a/arch/arm/boot/dts/omap5.dtsi |
419 |
++++ b/arch/arm/boot/dts/omap5.dtsi |
420 |
+@@ -463,11 +463,11 @@ |
421 |
+ }; |
422 |
+ }; |
423 |
+ |
424 |
+- target-module@5000 { |
425 |
++ target-module@4000 { |
426 |
+ compatible = "ti,sysc-omap2", "ti,sysc"; |
427 |
+- reg = <0x5000 0x4>, |
428 |
+- <0x5010 0x4>, |
429 |
+- <0x5014 0x4>; |
430 |
++ reg = <0x4000 0x4>, |
431 |
++ <0x4010 0x4>, |
432 |
++ <0x4014 0x4>; |
433 |
+ reg-names = "rev", "sysc", "syss"; |
434 |
+ ti,sysc-sidle = <SYSC_IDLE_FORCE>, |
435 |
+ <SYSC_IDLE_NO>, |
436 |
+@@ -479,7 +479,7 @@ |
437 |
+ ti,syss-mask = <1>; |
438 |
+ #address-cells = <1>; |
439 |
+ #size-cells = <1>; |
440 |
+- ranges = <0 0x5000 0x1000>; |
441 |
++ ranges = <0 0x4000 0x1000>; |
442 |
+ |
443 |
+ dsi1: encoder@0 { |
444 |
+ compatible = "ti,omap5-dsi"; |
445 |
+@@ -489,8 +489,9 @@ |
446 |
+ reg-names = "proto", "phy", "pll"; |
447 |
+ interrupts = <GIC_SPI 53 IRQ_TYPE_LEVEL_HIGH>; |
448 |
+ status = "disabled"; |
449 |
+- clocks = <&dss_clkctrl OMAP5_DSS_CORE_CLKCTRL 8>; |
450 |
+- clock-names = "fck"; |
451 |
++ clocks = <&dss_clkctrl OMAP5_DSS_CORE_CLKCTRL 8>, |
452 |
++ <&dss_clkctrl OMAP5_DSS_CORE_CLKCTRL 10>; |
453 |
++ clock-names = "fck", "sys_clk"; |
454 |
+ }; |
455 |
+ }; |
456 |
+ |
457 |
+@@ -520,8 +521,9 @@ |
458 |
+ reg-names = "proto", "phy", "pll"; |
459 |
+ interrupts = <GIC_SPI 55 IRQ_TYPE_LEVEL_HIGH>; |
460 |
+ status = "disabled"; |
461 |
+- clocks = <&dss_clkctrl OMAP5_DSS_CORE_CLKCTRL 8>; |
462 |
+- clock-names = "fck"; |
463 |
++ clocks = <&dss_clkctrl OMAP5_DSS_CORE_CLKCTRL 8>, |
464 |
++ <&dss_clkctrl OMAP5_DSS_CORE_CLKCTRL 10>; |
465 |
++ clock-names = "fck", "sys_clk"; |
466 |
+ }; |
467 |
+ }; |
468 |
+ |
469 |
+diff --git a/arch/arm/boot/dts/socfpga_arria10.dtsi b/arch/arm/boot/dts/socfpga_arria10.dtsi |
470 |
+index 8f614c4b0e3eb..9c71472c237bd 100644 |
471 |
+--- a/arch/arm/boot/dts/socfpga_arria10.dtsi |
472 |
++++ b/arch/arm/boot/dts/socfpga_arria10.dtsi |
473 |
+@@ -819,7 +819,7 @@ |
474 |
+ timer3: timer3@ffd00100 { |
475 |
+ compatible = "snps,dw-apb-timer"; |
476 |
+ interrupts = <0 118 IRQ_TYPE_LEVEL_HIGH>; |
477 |
+- reg = <0xffd01000 0x100>; |
478 |
++ reg = <0xffd00100 0x100>; |
479 |
+ clocks = <&l4_sys_free_clk>; |
480 |
+ clock-names = "timer"; |
481 |
+ resets = <&rst L4SYSTIMER1_RESET>; |
482 |
+diff --git a/arch/arm/boot/dts/vfxxx.dtsi b/arch/arm/boot/dts/vfxxx.dtsi |
483 |
+index 2d547e7b21ad5..8a14ac34d1313 100644 |
484 |
+--- a/arch/arm/boot/dts/vfxxx.dtsi |
485 |
++++ b/arch/arm/boot/dts/vfxxx.dtsi |
486 |
+@@ -495,7 +495,7 @@ |
487 |
+ }; |
488 |
+ |
489 |
+ ocotp: ocotp@400a5000 { |
490 |
+- compatible = "fsl,vf610-ocotp"; |
491 |
++ compatible = "fsl,vf610-ocotp", "syscon"; |
492 |
+ reg = <0x400a5000 0x1000>; |
493 |
+ clocks = <&clks VF610_CLK_OCOTP>; |
494 |
+ }; |
495 |
+diff --git a/arch/arm/mach-omap2/omap-iommu.c b/arch/arm/mach-omap2/omap-iommu.c |
496 |
+index 54aff33e55e6e..bfa5e1b8dba7f 100644 |
497 |
+--- a/arch/arm/mach-omap2/omap-iommu.c |
498 |
++++ b/arch/arm/mach-omap2/omap-iommu.c |
499 |
+@@ -74,7 +74,7 @@ static struct powerdomain *_get_pwrdm(struct device *dev) |
500 |
+ return pwrdm; |
501 |
+ |
502 |
+ clk = of_clk_get(dev->of_node->parent, 0); |
503 |
+- if (!clk) { |
504 |
++ if (IS_ERR(clk)) { |
505 |
+ dev_err(dev, "no fck found\n"); |
506 |
+ return NULL; |
507 |
+ } |
508 |
+diff --git a/arch/arm64/boot/dts/broadcom/northstar2/ns2.dtsi b/arch/arm64/boot/dts/broadcom/northstar2/ns2.dtsi |
509 |
+index 15f7b0ed38369..39802066232e1 100644 |
510 |
+--- a/arch/arm64/boot/dts/broadcom/northstar2/ns2.dtsi |
511 |
++++ b/arch/arm64/boot/dts/broadcom/northstar2/ns2.dtsi |
512 |
+@@ -745,7 +745,7 @@ |
513 |
+ }; |
514 |
+ |
515 |
+ qspi: spi@66470200 { |
516 |
+- compatible = "brcm,spi-bcm-qspi", "brcm,spi-ns2-qspi"; |
517 |
++ compatible = "brcm,spi-ns2-qspi", "brcm,spi-bcm-qspi"; |
518 |
+ reg = <0x66470200 0x184>, |
519 |
+ <0x66470000 0x124>, |
520 |
+ <0x67017408 0x004>, |
521 |
+diff --git a/arch/arm64/boot/dts/freescale/Makefile b/arch/arm64/boot/dts/freescale/Makefile |
522 |
+index a39f0a1723e02..903c0eb61290d 100644 |
523 |
+--- a/arch/arm64/boot/dts/freescale/Makefile |
524 |
++++ b/arch/arm64/boot/dts/freescale/Makefile |
525 |
+@@ -28,6 +28,7 @@ dtb-$(CONFIG_ARCH_LAYERSCAPE) += fsl-lx2160a-honeycomb.dtb |
526 |
+ dtb-$(CONFIG_ARCH_LAYERSCAPE) += fsl-lx2160a-qds.dtb |
527 |
+ dtb-$(CONFIG_ARCH_LAYERSCAPE) += fsl-lx2160a-rdb.dtb |
528 |
+ |
529 |
++dtb-$(CONFIG_ARCH_MXC) += imx8mm-beacon-kit.dtb |
530 |
+ dtb-$(CONFIG_ARCH_MXC) += imx8mm-evk.dtb |
531 |
+ dtb-$(CONFIG_ARCH_MXC) += imx8mn-evk.dtb |
532 |
+ dtb-$(CONFIG_ARCH_MXC) += imx8mn-ddr4-evk.dtb |
533 |
+diff --git a/arch/arm64/boot/dts/freescale/imx8mp.dtsi b/arch/arm64/boot/dts/freescale/imx8mp.dtsi |
534 |
+index 45e2c0a4e8896..437e2ccf8f866 100644 |
535 |
+--- a/arch/arm64/boot/dts/freescale/imx8mp.dtsi |
536 |
++++ b/arch/arm64/boot/dts/freescale/imx8mp.dtsi |
537 |
+@@ -688,7 +688,7 @@ |
538 |
+ reg = <0x30bd0000 0x10000>; |
539 |
+ interrupts = <GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>; |
540 |
+ clocks = <&clk IMX8MP_CLK_SDMA1_ROOT>, |
541 |
+- <&clk IMX8MP_CLK_SDMA1_ROOT>; |
542 |
++ <&clk IMX8MP_CLK_AHB>; |
543 |
+ clock-names = "ipg", "ahb"; |
544 |
+ #dma-cells = <3>; |
545 |
+ fsl,sdma-ram-script-name = "imx/sdma/sdma-imx7d.bin"; |
546 |
+diff --git a/arch/arm64/boot/dts/freescale/imx8mq.dtsi b/arch/arm64/boot/dts/freescale/imx8mq.dtsi |
547 |
+index 978f8122c0d2c..66ac66856e7e8 100644 |
548 |
+--- a/arch/arm64/boot/dts/freescale/imx8mq.dtsi |
549 |
++++ b/arch/arm64/boot/dts/freescale/imx8mq.dtsi |
550 |
+@@ -420,7 +420,7 @@ |
551 |
+ tmu: tmu@30260000 { |
552 |
+ compatible = "fsl,imx8mq-tmu"; |
553 |
+ reg = <0x30260000 0x10000>; |
554 |
+- interrupt = <GIC_SPI 49 IRQ_TYPE_LEVEL_HIGH>; |
555 |
++ interrupts = <GIC_SPI 49 IRQ_TYPE_LEVEL_HIGH>; |
556 |
+ clocks = <&clk IMX8MQ_CLK_TMU_ROOT>; |
557 |
+ little-endian; |
558 |
+ fsl,tmu-range = <0xb0000 0xa0026 0x80048 0x70061>; |
559 |
+diff --git a/arch/arm64/kernel/module-plts.c b/arch/arm64/kernel/module-plts.c |
560 |
+index 65b08a74aec65..37c0b51a7b7b5 100644 |
561 |
+--- a/arch/arm64/kernel/module-plts.c |
562 |
++++ b/arch/arm64/kernel/module-plts.c |
563 |
+@@ -271,8 +271,7 @@ int module_frob_arch_sections(Elf_Ehdr *ehdr, Elf_Shdr *sechdrs, |
564 |
+ mod->arch.core.plt_shndx = i; |
565 |
+ else if (!strcmp(secstrings + sechdrs[i].sh_name, ".init.plt")) |
566 |
+ mod->arch.init.plt_shndx = i; |
567 |
+- else if (IS_ENABLED(CONFIG_DYNAMIC_FTRACE) && |
568 |
+- !strcmp(secstrings + sechdrs[i].sh_name, |
569 |
++ else if (!strcmp(secstrings + sechdrs[i].sh_name, |
570 |
+ ".text.ftrace_trampoline")) |
571 |
+ tramp = sechdrs + i; |
572 |
+ else if (sechdrs[i].sh_type == SHT_SYMTAB) |
573 |
+diff --git a/arch/arm64/kvm/mmu.c b/arch/arm64/kvm/mmu.c |
574 |
+index bd47f06739d6c..d906350d543dd 100644 |
575 |
+--- a/arch/arm64/kvm/mmu.c |
576 |
++++ b/arch/arm64/kvm/mmu.c |
577 |
+@@ -1873,6 +1873,7 @@ static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa, |
578 |
+ !fault_supports_stage2_huge_mapping(memslot, hva, vma_pagesize)) { |
579 |
+ force_pte = true; |
580 |
+ vma_pagesize = PAGE_SIZE; |
581 |
++ vma_shift = PAGE_SHIFT; |
582 |
+ } |
583 |
+ |
584 |
+ /* |
585 |
+@@ -1967,7 +1968,12 @@ static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa, |
586 |
+ (fault_status == FSC_PERM && |
587 |
+ stage2_is_exec(kvm, fault_ipa, vma_pagesize)); |
588 |
+ |
589 |
+- if (vma_pagesize == PUD_SIZE) { |
590 |
++ /* |
591 |
++ * If PUD_SIZE == PMD_SIZE, there is no real PUD level, and |
592 |
++ * all we have is a 2-level page table. Trying to map a PUD in |
593 |
++ * this case would be fatally wrong. |
594 |
++ */ |
595 |
++ if (PUD_SIZE != PMD_SIZE && vma_pagesize == PUD_SIZE) { |
596 |
+ pud_t new_pud = kvm_pfn_pud(pfn, mem_type); |
597 |
+ |
598 |
+ new_pud = kvm_pud_mkhuge(new_pud); |
599 |
+diff --git a/arch/mips/include/asm/mach-loongson64/cpu-feature-overrides.h b/arch/mips/include/asm/mach-loongson64/cpu-feature-overrides.h |
600 |
+index b6e9c99b85a52..eb181224eb4c4 100644 |
601 |
+--- a/arch/mips/include/asm/mach-loongson64/cpu-feature-overrides.h |
602 |
++++ b/arch/mips/include/asm/mach-loongson64/cpu-feature-overrides.h |
603 |
+@@ -26,7 +26,6 @@ |
604 |
+ #define cpu_has_counter 1 |
605 |
+ #define cpu_has_dc_aliases (PAGE_SIZE < 0x4000) |
606 |
+ #define cpu_has_divec 0 |
607 |
+-#define cpu_has_ejtag 0 |
608 |
+ #define cpu_has_inclusive_pcaches 1 |
609 |
+ #define cpu_has_llsc 1 |
610 |
+ #define cpu_has_mcheck 0 |
611 |
+@@ -42,7 +41,6 @@ |
612 |
+ #define cpu_has_veic 0 |
613 |
+ #define cpu_has_vint 0 |
614 |
+ #define cpu_has_vtag_icache 0 |
615 |
+-#define cpu_has_watch 1 |
616 |
+ #define cpu_has_wsbh 1 |
617 |
+ #define cpu_has_ic_fills_f_dc 1 |
618 |
+ #define cpu_hwrena_impl_bits 0xc0000000 |
619 |
+diff --git a/arch/powerpc/configs/pasemi_defconfig b/arch/powerpc/configs/pasemi_defconfig |
620 |
+index 08b7f4cef2434..ddf5e97877e2b 100644 |
621 |
+--- a/arch/powerpc/configs/pasemi_defconfig |
622 |
++++ b/arch/powerpc/configs/pasemi_defconfig |
623 |
+@@ -109,7 +109,6 @@ CONFIG_FB_NVIDIA=y |
624 |
+ CONFIG_FB_NVIDIA_I2C=y |
625 |
+ CONFIG_FB_RADEON=y |
626 |
+ # CONFIG_LCD_CLASS_DEVICE is not set |
627 |
+-CONFIG_VGACON_SOFT_SCROLLBACK=y |
628 |
+ CONFIG_LOGO=y |
629 |
+ CONFIG_SOUND=y |
630 |
+ CONFIG_SND=y |
631 |
+diff --git a/arch/powerpc/configs/ppc6xx_defconfig b/arch/powerpc/configs/ppc6xx_defconfig |
632 |
+index feb5d47d8d1e0..4cc9039e4deb9 100644 |
633 |
+--- a/arch/powerpc/configs/ppc6xx_defconfig |
634 |
++++ b/arch/powerpc/configs/ppc6xx_defconfig |
635 |
+@@ -772,7 +772,6 @@ CONFIG_FB_TRIDENT=m |
636 |
+ CONFIG_FB_SM501=m |
637 |
+ CONFIG_FB_IBM_GXT4500=y |
638 |
+ CONFIG_LCD_PLATFORM=m |
639 |
+-CONFIG_VGACON_SOFT_SCROLLBACK=y |
640 |
+ CONFIG_FRAMEBUFFER_CONSOLE=y |
641 |
+ CONFIG_FRAMEBUFFER_CONSOLE_ROTATION=y |
642 |
+ CONFIG_LOGO=y |
643 |
+diff --git a/arch/x86/configs/i386_defconfig b/arch/x86/configs/i386_defconfig |
644 |
+index 550904591e94d..62e834793af05 100644 |
645 |
+--- a/arch/x86/configs/i386_defconfig |
646 |
++++ b/arch/x86/configs/i386_defconfig |
647 |
+@@ -202,7 +202,6 @@ CONFIG_FB_MODE_HELPERS=y |
648 |
+ CONFIG_FB_TILEBLITTING=y |
649 |
+ CONFIG_FB_EFI=y |
650 |
+ # CONFIG_LCD_CLASS_DEVICE is not set |
651 |
+-CONFIG_VGACON_SOFT_SCROLLBACK=y |
652 |
+ CONFIG_LOGO=y |
653 |
+ # CONFIG_LOGO_LINUX_MONO is not set |
654 |
+ # CONFIG_LOGO_LINUX_VGA16 is not set |
655 |
+diff --git a/arch/x86/configs/x86_64_defconfig b/arch/x86/configs/x86_64_defconfig |
656 |
+index 6149610090751..075d97ec20d56 100644 |
657 |
+--- a/arch/x86/configs/x86_64_defconfig |
658 |
++++ b/arch/x86/configs/x86_64_defconfig |
659 |
+@@ -197,7 +197,6 @@ CONFIG_FB_MODE_HELPERS=y |
660 |
+ CONFIG_FB_TILEBLITTING=y |
661 |
+ CONFIG_FB_EFI=y |
662 |
+ # CONFIG_LCD_CLASS_DEVICE is not set |
663 |
+-CONFIG_VGACON_SOFT_SCROLLBACK=y |
664 |
+ CONFIG_LOGO=y |
665 |
+ # CONFIG_LOGO_LINUX_MONO is not set |
666 |
+ # CONFIG_LOGO_LINUX_VGA16 is not set |
667 |
+diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c |
668 |
+index 9516a958e7801..1e6724c30cc05 100644 |
669 |
+--- a/arch/x86/kvm/mmu/mmu.c |
670 |
++++ b/arch/x86/kvm/mmu/mmu.c |
671 |
+@@ -2521,7 +2521,7 @@ static struct kvm_mmu_page *kvm_mmu_get_page(struct kvm_vcpu *vcpu, |
672 |
+ } |
673 |
+ |
674 |
+ if (sp->unsync_children) |
675 |
+- kvm_make_request(KVM_REQ_TLB_FLUSH_CURRENT, vcpu); |
676 |
++ kvm_make_request(KVM_REQ_MMU_SYNC, vcpu); |
677 |
+ |
678 |
+ __clear_sp_write_flooding_count(sp); |
679 |
+ trace_kvm_mmu_get_page(sp, false); |
680 |
+diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c |
681 |
+index 11e4df5600183..a5810928b011f 100644 |
682 |
+--- a/arch/x86/kvm/vmx/nested.c |
683 |
++++ b/arch/x86/kvm/vmx/nested.c |
684 |
+@@ -4620,7 +4620,7 @@ void nested_vmx_pmu_entry_exit_ctls_update(struct kvm_vcpu *vcpu) |
685 |
+ vmx->nested.msrs.entry_ctls_high &= |
686 |
+ ~VM_ENTRY_LOAD_IA32_PERF_GLOBAL_CTRL; |
687 |
+ vmx->nested.msrs.exit_ctls_high &= |
688 |
+- ~VM_ENTRY_LOAD_IA32_PERF_GLOBAL_CTRL; |
689 |
++ ~VM_EXIT_LOAD_IA32_PERF_GLOBAL_CTRL; |
690 |
+ } |
691 |
+ } |
692 |
+ |
693 |
+diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c |
694 |
+index eb33c764d1593..b934e99649436 100644 |
695 |
+--- a/arch/x86/kvm/vmx/vmx.c |
696 |
++++ b/arch/x86/kvm/vmx/vmx.c |
697 |
+@@ -6028,6 +6028,7 @@ static int vmx_handle_exit(struct kvm_vcpu *vcpu, fastpath_t exit_fastpath) |
698 |
+ (exit_reason != EXIT_REASON_EXCEPTION_NMI && |
699 |
+ exit_reason != EXIT_REASON_EPT_VIOLATION && |
700 |
+ exit_reason != EXIT_REASON_PML_FULL && |
701 |
++ exit_reason != EXIT_REASON_APIC_ACCESS && |
702 |
+ exit_reason != EXIT_REASON_TASK_SWITCH)) { |
703 |
+ vcpu->run->exit_reason = KVM_EXIT_INTERNAL_ERROR; |
704 |
+ vcpu->run->internal.suberror = KVM_INTERNAL_ERROR_DELIVERY_EV; |
705 |
+diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c |
706 |
+index f7304132d5907..f5481ae588aff 100644 |
707 |
+--- a/arch/x86/kvm/x86.c |
708 |
++++ b/arch/x86/kvm/x86.c |
709 |
+@@ -2696,7 +2696,7 @@ static int kvm_pv_enable_async_pf(struct kvm_vcpu *vcpu, u64 data) |
710 |
+ return 1; |
711 |
+ |
712 |
+ if (!lapic_in_kernel(vcpu)) |
713 |
+- return 1; |
714 |
++ return data ? 1 : 0; |
715 |
+ |
716 |
+ vcpu->arch.apf.msr_en_val = data; |
717 |
+ |
718 |
+diff --git a/block/bio.c b/block/bio.c |
719 |
+index b1883adc8f154..eac129f21d2df 100644 |
720 |
+--- a/block/bio.c |
721 |
++++ b/block/bio.c |
722 |
+@@ -877,8 +877,10 @@ bool __bio_try_merge_page(struct bio *bio, struct page *page, |
723 |
+ struct bio_vec *bv = &bio->bi_io_vec[bio->bi_vcnt - 1]; |
724 |
+ |
725 |
+ if (page_is_mergeable(bv, page, len, off, same_page)) { |
726 |
+- if (bio->bi_iter.bi_size > UINT_MAX - len) |
727 |
++ if (bio->bi_iter.bi_size > UINT_MAX - len) { |
728 |
++ *same_page = false; |
729 |
+ return false; |
730 |
++ } |
731 |
+ bv->bv_len += len; |
732 |
+ bio->bi_iter.bi_size += len; |
733 |
+ return true; |
734 |
+diff --git a/block/partitions/core.c b/block/partitions/core.c |
735 |
+index 534e11285a8d4..b45539764c994 100644 |
736 |
+--- a/block/partitions/core.c |
737 |
++++ b/block/partitions/core.c |
738 |
+@@ -529,7 +529,7 @@ int bdev_del_partition(struct block_device *bdev, int partno) |
739 |
+ |
740 |
+ bdevp = bdget_disk(bdev->bd_disk, partno); |
741 |
+ if (!bdevp) |
742 |
+- return -ENOMEM; |
743 |
++ return -ENXIO; |
744 |
+ |
745 |
+ mutex_lock(&bdevp->bd_mutex); |
746 |
+ mutex_lock_nested(&bdev->bd_mutex, 1); |
747 |
+diff --git a/drivers/atm/firestream.c b/drivers/atm/firestream.c |
748 |
+index cc87004d5e2d6..5f22555933df1 100644 |
749 |
+--- a/drivers/atm/firestream.c |
750 |
++++ b/drivers/atm/firestream.c |
751 |
+@@ -998,6 +998,7 @@ static int fs_open(struct atm_vcc *atm_vcc) |
752 |
+ error = make_rate (pcr, r, &tmc0, NULL); |
753 |
+ if (error) { |
754 |
+ kfree(tc); |
755 |
++ kfree(vcc); |
756 |
+ return error; |
757 |
+ } |
758 |
+ } |
759 |
+diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c |
760 |
+index 4f61e92094614..ae6d7dbbf5d1e 100644 |
761 |
+--- a/drivers/block/rbd.c |
762 |
++++ b/drivers/block/rbd.c |
763 |
+@@ -5120,6 +5120,9 @@ static ssize_t rbd_config_info_show(struct device *dev, |
764 |
+ { |
765 |
+ struct rbd_device *rbd_dev = dev_to_rbd_dev(dev); |
766 |
+ |
767 |
++ if (!capable(CAP_SYS_ADMIN)) |
768 |
++ return -EPERM; |
769 |
++ |
770 |
+ return sprintf(buf, "%s\n", rbd_dev->config_info); |
771 |
+ } |
772 |
+ |
773 |
+@@ -5231,6 +5234,9 @@ static ssize_t rbd_image_refresh(struct device *dev, |
774 |
+ struct rbd_device *rbd_dev = dev_to_rbd_dev(dev); |
775 |
+ int ret; |
776 |
+ |
777 |
++ if (!capable(CAP_SYS_ADMIN)) |
778 |
++ return -EPERM; |
779 |
++ |
780 |
+ ret = rbd_dev_refresh(rbd_dev); |
781 |
+ if (ret) |
782 |
+ return ret; |
783 |
+@@ -7059,6 +7065,9 @@ static ssize_t do_rbd_add(struct bus_type *bus, |
784 |
+ struct rbd_client *rbdc; |
785 |
+ int rc; |
786 |
+ |
787 |
++ if (!capable(CAP_SYS_ADMIN)) |
788 |
++ return -EPERM; |
789 |
++ |
790 |
+ if (!try_module_get(THIS_MODULE)) |
791 |
+ return -ENODEV; |
792 |
+ |
793 |
+@@ -7209,6 +7218,9 @@ static ssize_t do_rbd_remove(struct bus_type *bus, |
794 |
+ bool force = false; |
795 |
+ int ret; |
796 |
+ |
797 |
++ if (!capable(CAP_SYS_ADMIN)) |
798 |
++ return -EPERM; |
799 |
++ |
800 |
+ dev_id = -1; |
801 |
+ opt_buf[0] = '\0'; |
802 |
+ sscanf(buf, "%d %5s", &dev_id, opt_buf); |
803 |
+diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c |
804 |
+index 8c730a47e0537..36a469150ff9c 100644 |
805 |
+--- a/drivers/cpufreq/intel_pstate.c |
806 |
++++ b/drivers/cpufreq/intel_pstate.c |
807 |
+@@ -762,7 +762,7 @@ static void intel_pstate_get_hwp_max(unsigned int cpu, int *phy_max, |
808 |
+ |
809 |
+ rdmsrl_on_cpu(cpu, MSR_HWP_CAPABILITIES, &cap); |
810 |
+ WRITE_ONCE(all_cpu_data[cpu]->hwp_cap_cached, cap); |
811 |
+- if (global.no_turbo) |
812 |
++ if (global.no_turbo || global.turbo_disabled) |
813 |
+ *current_max = HWP_GUARANTEED_PERF(cap); |
814 |
+ else |
815 |
+ *current_max = HWP_HIGHEST_PERF(cap); |
816 |
+@@ -2534,9 +2534,15 @@ static int intel_pstate_update_status(const char *buf, size_t size) |
817 |
+ { |
818 |
+ int ret; |
819 |
+ |
820 |
+- if (size == 3 && !strncmp(buf, "off", size)) |
821 |
+- return intel_pstate_driver ? |
822 |
+- intel_pstate_unregister_driver() : -EINVAL; |
823 |
++ if (size == 3 && !strncmp(buf, "off", size)) { |
824 |
++ if (!intel_pstate_driver) |
825 |
++ return -EINVAL; |
826 |
++ |
827 |
++ if (hwp_active) |
828 |
++ return -EBUSY; |
829 |
++ |
830 |
++ return intel_pstate_unregister_driver(); |
831 |
++ } |
832 |
+ |
833 |
+ if (size == 6 && !strncmp(buf, "active", size)) { |
834 |
+ if (intel_pstate_driver) { |
835 |
+diff --git a/drivers/dma/acpi-dma.c b/drivers/dma/acpi-dma.c |
836 |
+index 8a05db3343d39..dcbcb712de6e8 100644 |
837 |
+--- a/drivers/dma/acpi-dma.c |
838 |
++++ b/drivers/dma/acpi-dma.c |
839 |
+@@ -135,11 +135,13 @@ static void acpi_dma_parse_csrt(struct acpi_device *adev, struct acpi_dma *adma) |
840 |
+ if (ret < 0) { |
841 |
+ dev_warn(&adev->dev, |
842 |
+ "error in parsing resource group\n"); |
843 |
+- return; |
844 |
++ break; |
845 |
+ } |
846 |
+ |
847 |
+ grp = (struct acpi_csrt_group *)((void *)grp + grp->length); |
848 |
+ } |
849 |
++ |
850 |
++ acpi_put_table((struct acpi_table_header *)csrt); |
851 |
+ } |
852 |
+ |
853 |
+ /** |
854 |
+diff --git a/drivers/dma/dma-jz4780.c b/drivers/dma/dma-jz4780.c |
855 |
+index 448f663da89c6..8beed91428bd6 100644 |
856 |
+--- a/drivers/dma/dma-jz4780.c |
857 |
++++ b/drivers/dma/dma-jz4780.c |
858 |
+@@ -879,24 +879,11 @@ static int jz4780_dma_probe(struct platform_device *pdev) |
859 |
+ return -EINVAL; |
860 |
+ } |
861 |
+ |
862 |
+- ret = platform_get_irq(pdev, 0); |
863 |
+- if (ret < 0) |
864 |
+- return ret; |
865 |
+- |
866 |
+- jzdma->irq = ret; |
867 |
+- |
868 |
+- ret = request_irq(jzdma->irq, jz4780_dma_irq_handler, 0, dev_name(dev), |
869 |
+- jzdma); |
870 |
+- if (ret) { |
871 |
+- dev_err(dev, "failed to request IRQ %u!\n", jzdma->irq); |
872 |
+- return ret; |
873 |
+- } |
874 |
+- |
875 |
+ jzdma->clk = devm_clk_get(dev, NULL); |
876 |
+ if (IS_ERR(jzdma->clk)) { |
877 |
+ dev_err(dev, "failed to get clock\n"); |
878 |
+ ret = PTR_ERR(jzdma->clk); |
879 |
+- goto err_free_irq; |
880 |
++ return ret; |
881 |
+ } |
882 |
+ |
883 |
+ clk_prepare_enable(jzdma->clk); |
884 |
+@@ -949,10 +936,23 @@ static int jz4780_dma_probe(struct platform_device *pdev) |
885 |
+ jzchan->vchan.desc_free = jz4780_dma_desc_free; |
886 |
+ } |
887 |
+ |
888 |
++ ret = platform_get_irq(pdev, 0); |
889 |
++ if (ret < 0) |
890 |
++ goto err_disable_clk; |
891 |
++ |
892 |
++ jzdma->irq = ret; |
893 |
++ |
894 |
++ ret = request_irq(jzdma->irq, jz4780_dma_irq_handler, 0, dev_name(dev), |
895 |
++ jzdma); |
896 |
++ if (ret) { |
897 |
++ dev_err(dev, "failed to request IRQ %u!\n", jzdma->irq); |
898 |
++ goto err_disable_clk; |
899 |
++ } |
900 |
++ |
901 |
+ ret = dmaenginem_async_device_register(dd); |
902 |
+ if (ret) { |
903 |
+ dev_err(dev, "failed to register device\n"); |
904 |
+- goto err_disable_clk; |
905 |
++ goto err_free_irq; |
906 |
+ } |
907 |
+ |
908 |
+ /* Register with OF DMA helpers. */ |
909 |
+@@ -960,17 +960,17 @@ static int jz4780_dma_probe(struct platform_device *pdev) |
910 |
+ jzdma); |
911 |
+ if (ret) { |
912 |
+ dev_err(dev, "failed to register OF DMA controller\n"); |
913 |
+- goto err_disable_clk; |
914 |
++ goto err_free_irq; |
915 |
+ } |
916 |
+ |
917 |
+ dev_info(dev, "JZ4780 DMA controller initialised\n"); |
918 |
+ return 0; |
919 |
+ |
920 |
+-err_disable_clk: |
921 |
+- clk_disable_unprepare(jzdma->clk); |
922 |
+- |
923 |
+ err_free_irq: |
924 |
+ free_irq(jzdma->irq, jzdma); |
925 |
++ |
926 |
++err_disable_clk: |
927 |
++ clk_disable_unprepare(jzdma->clk); |
928 |
+ return ret; |
929 |
+ } |
930 |
+ |
931 |
+diff --git a/drivers/firmware/efi/embedded-firmware.c b/drivers/firmware/efi/embedded-firmware.c |
932 |
+index a1b199de9006e..84e32634ed6cd 100644 |
933 |
+--- a/drivers/firmware/efi/embedded-firmware.c |
934 |
++++ b/drivers/firmware/efi/embedded-firmware.c |
935 |
+@@ -16,9 +16,9 @@ |
936 |
+ |
937 |
+ /* Exported for use by lib/test_firmware.c only */ |
938 |
+ LIST_HEAD(efi_embedded_fw_list); |
939 |
+-EXPORT_SYMBOL_GPL(efi_embedded_fw_list); |
940 |
+- |
941 |
+-static bool checked_for_fw; |
942 |
++EXPORT_SYMBOL_NS_GPL(efi_embedded_fw_list, TEST_FIRMWARE); |
943 |
++bool efi_embedded_fw_checked; |
944 |
++EXPORT_SYMBOL_NS_GPL(efi_embedded_fw_checked, TEST_FIRMWARE); |
945 |
+ |
946 |
+ static const struct dmi_system_id * const embedded_fw_table[] = { |
947 |
+ #ifdef CONFIG_TOUCHSCREEN_DMI |
948 |
+@@ -119,14 +119,14 @@ void __init efi_check_for_embedded_firmwares(void) |
949 |
+ } |
950 |
+ } |
951 |
+ |
952 |
+- checked_for_fw = true; |
953 |
++ efi_embedded_fw_checked = true; |
954 |
+ } |
955 |
+ |
956 |
+ int efi_get_embedded_fw(const char *name, const u8 **data, size_t *size) |
957 |
+ { |
958 |
+ struct efi_embedded_fw *iter, *fw = NULL; |
959 |
+ |
960 |
+- if (!checked_for_fw) { |
961 |
++ if (!efi_embedded_fw_checked) { |
962 |
+ pr_warn("Warning %s called while we did not check for embedded fw\n", |
963 |
+ __func__); |
964 |
+ return -ENOENT; |
965 |
+diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c |
966 |
+index 753cb2cf6b77e..3adf9c1dfdbb0 100644 |
967 |
+--- a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c |
968 |
++++ b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c |
969 |
+@@ -3587,7 +3587,8 @@ static int smu7_read_sensor(struct pp_hwmgr *hwmgr, int idx, |
970 |
+ case AMDGPU_PP_SENSOR_GPU_POWER: |
971 |
+ return smu7_get_gpu_power(hwmgr, (uint32_t *)value); |
972 |
+ case AMDGPU_PP_SENSOR_VDDGFX: |
973 |
+- if ((data->vr_config & 0xff) == 0x2) |
974 |
++ if ((data->vr_config & VRCONF_VDDGFX_MASK) == |
975 |
++ (VR_SVI2_PLANE_2 << VRCONF_VDDGFX_SHIFT)) |
976 |
+ val_vid = PHM_READ_INDIRECT_FIELD(hwmgr->device, |
977 |
+ CGS_IND_REG__SMC, PWR_SVI2_STATUS, PLANE2_VID); |
978 |
+ else |
979 |
+diff --git a/drivers/gpu/drm/msm/adreno/a2xx_gpu.c b/drivers/gpu/drm/msm/adreno/a2xx_gpu.c |
980 |
+index 6021f8d9efd1f..48fa49f69d6d0 100644 |
981 |
+--- a/drivers/gpu/drm/msm/adreno/a2xx_gpu.c |
982 |
++++ b/drivers/gpu/drm/msm/adreno/a2xx_gpu.c |
983 |
+@@ -164,6 +164,11 @@ static int a2xx_hw_init(struct msm_gpu *gpu) |
984 |
+ if (ret) |
985 |
+ return ret; |
986 |
+ |
987 |
++ gpu_write(gpu, REG_AXXX_CP_RB_CNTL, |
988 |
++ MSM_GPU_RB_CNTL_DEFAULT | AXXX_CP_RB_CNTL_NO_UPDATE); |
989 |
++ |
990 |
++ gpu_write(gpu, REG_AXXX_CP_RB_BASE, lower_32_bits(gpu->rb[0]->iova)); |
991 |
++ |
992 |
+ /* NOTE: PM4/micro-engine firmware registers look to be the same |
993 |
+ * for a2xx and a3xx.. we could possibly push that part down to |
994 |
+ * adreno_gpu base class. Or push both PM4 and PFP but |
995 |
+diff --git a/drivers/gpu/drm/msm/adreno/a3xx_gpu.c b/drivers/gpu/drm/msm/adreno/a3xx_gpu.c |
996 |
+index 0a5ea9f56cb88..f6471145a7a60 100644 |
997 |
+--- a/drivers/gpu/drm/msm/adreno/a3xx_gpu.c |
998 |
++++ b/drivers/gpu/drm/msm/adreno/a3xx_gpu.c |
999 |
+@@ -211,6 +211,16 @@ static int a3xx_hw_init(struct msm_gpu *gpu) |
1000 |
+ if (ret) |
1001 |
+ return ret; |
1002 |
+ |
1003 |
++ /* |
1004 |
++ * Use the default ringbuffer size and block size but disable the RPTR |
1005 |
++ * shadow |
1006 |
++ */ |
1007 |
++ gpu_write(gpu, REG_AXXX_CP_RB_CNTL, |
1008 |
++ MSM_GPU_RB_CNTL_DEFAULT | AXXX_CP_RB_CNTL_NO_UPDATE); |
1009 |
++ |
1010 |
++ /* Set the ringbuffer address */ |
1011 |
++ gpu_write(gpu, REG_AXXX_CP_RB_BASE, lower_32_bits(gpu->rb[0]->iova)); |
1012 |
++ |
1013 |
+ /* setup access protection: */ |
1014 |
+ gpu_write(gpu, REG_A3XX_CP_PROTECT_CTRL, 0x00000007); |
1015 |
+ |
1016 |
+diff --git a/drivers/gpu/drm/msm/adreno/a4xx_gpu.c b/drivers/gpu/drm/msm/adreno/a4xx_gpu.c |
1017 |
+index b9b26b2bf9c54..9547536006254 100644 |
1018 |
+--- a/drivers/gpu/drm/msm/adreno/a4xx_gpu.c |
1019 |
++++ b/drivers/gpu/drm/msm/adreno/a4xx_gpu.c |
1020 |
+@@ -267,6 +267,16 @@ static int a4xx_hw_init(struct msm_gpu *gpu) |
1021 |
+ if (ret) |
1022 |
+ return ret; |
1023 |
+ |
1024 |
++ /* |
1025 |
++ * Use the default ringbuffer size and block size but disable the RPTR |
1026 |
++ * shadow |
1027 |
++ */ |
1028 |
++ gpu_write(gpu, REG_A4XX_CP_RB_CNTL, |
1029 |
++ MSM_GPU_RB_CNTL_DEFAULT | AXXX_CP_RB_CNTL_NO_UPDATE); |
1030 |
++ |
1031 |
++ /* Set the ringbuffer address */ |
1032 |
++ gpu_write(gpu, REG_A4XX_CP_RB_BASE, lower_32_bits(gpu->rb[0]->iova)); |
1033 |
++ |
1034 |
+ /* Load PM4: */ |
1035 |
+ ptr = (uint32_t *)(adreno_gpu->fw[ADRENO_FW_PM4]->data); |
1036 |
+ len = adreno_gpu->fw[ADRENO_FW_PM4]->size / 4; |
1037 |
+diff --git a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c |
1038 |
+index d95970a73fb4b..1bf0969ce725f 100644 |
1039 |
+--- a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c |
1040 |
++++ b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c |
1041 |
+@@ -702,8 +702,6 @@ static int a5xx_hw_init(struct msm_gpu *gpu) |
1042 |
+ if (ret) |
1043 |
+ return ret; |
1044 |
+ |
1045 |
+- a5xx_preempt_hw_init(gpu); |
1046 |
+- |
1047 |
+ if (!adreno_is_a510(adreno_gpu)) |
1048 |
+ a5xx_gpmu_ucode_init(gpu); |
1049 |
+ |
1050 |
+@@ -711,6 +709,15 @@ static int a5xx_hw_init(struct msm_gpu *gpu) |
1051 |
+ if (ret) |
1052 |
+ return ret; |
1053 |
+ |
1054 |
++ /* Set the ringbuffer address */ |
1055 |
++ gpu_write64(gpu, REG_A5XX_CP_RB_BASE, REG_A5XX_CP_RB_BASE_HI, |
1056 |
++ gpu->rb[0]->iova); |
1057 |
++ |
1058 |
++ gpu_write(gpu, REG_A5XX_CP_RB_CNTL, |
1059 |
++ MSM_GPU_RB_CNTL_DEFAULT | AXXX_CP_RB_CNTL_NO_UPDATE); |
1060 |
++ |
1061 |
++ a5xx_preempt_hw_init(gpu); |
1062 |
++ |
1063 |
+ /* Disable the interrupts through the initial bringup stage */ |
1064 |
+ gpu_write(gpu, REG_A5XX_RBBM_INT_0_MASK, A5XX_INT_MASK); |
1065 |
+ |
1066 |
+@@ -1510,7 +1517,8 @@ struct msm_gpu *a5xx_gpu_init(struct drm_device *dev) |
1067 |
+ |
1068 |
+ check_speed_bin(&pdev->dev); |
1069 |
+ |
1070 |
+- ret = adreno_gpu_init(dev, pdev, adreno_gpu, &funcs, 4); |
1071 |
++ /* Restricting nr_rings to 1 to temporarily disable preemption */ |
1072 |
++ ret = adreno_gpu_init(dev, pdev, adreno_gpu, &funcs, 1); |
1073 |
+ if (ret) { |
1074 |
+ a5xx_destroy(&(a5xx_gpu->base.base)); |
1075 |
+ return ERR_PTR(ret); |
1076 |
+diff --git a/drivers/gpu/drm/msm/adreno/a5xx_gpu.h b/drivers/gpu/drm/msm/adreno/a5xx_gpu.h |
1077 |
+index 54868d4e3958f..1e5b1a15a70f0 100644 |
1078 |
+--- a/drivers/gpu/drm/msm/adreno/a5xx_gpu.h |
1079 |
++++ b/drivers/gpu/drm/msm/adreno/a5xx_gpu.h |
1080 |
+@@ -31,6 +31,7 @@ struct a5xx_gpu { |
1081 |
+ struct msm_ringbuffer *next_ring; |
1082 |
+ |
1083 |
+ struct drm_gem_object *preempt_bo[MSM_GPU_MAX_RINGS]; |
1084 |
++ struct drm_gem_object *preempt_counters_bo[MSM_GPU_MAX_RINGS]; |
1085 |
+ struct a5xx_preempt_record *preempt[MSM_GPU_MAX_RINGS]; |
1086 |
+ uint64_t preempt_iova[MSM_GPU_MAX_RINGS]; |
1087 |
+ |
1088 |
+diff --git a/drivers/gpu/drm/msm/adreno/a5xx_preempt.c b/drivers/gpu/drm/msm/adreno/a5xx_preempt.c |
1089 |
+index 9cf9353a7ff11..9f3fe177b00e9 100644 |
1090 |
+--- a/drivers/gpu/drm/msm/adreno/a5xx_preempt.c |
1091 |
++++ b/drivers/gpu/drm/msm/adreno/a5xx_preempt.c |
1092 |
+@@ -226,19 +226,31 @@ static int preempt_init_ring(struct a5xx_gpu *a5xx_gpu, |
1093 |
+ struct adreno_gpu *adreno_gpu = &a5xx_gpu->base; |
1094 |
+ struct msm_gpu *gpu = &adreno_gpu->base; |
1095 |
+ struct a5xx_preempt_record *ptr; |
1096 |
+- struct drm_gem_object *bo = NULL; |
1097 |
+- u64 iova = 0; |
1098 |
++ void *counters; |
1099 |
++ struct drm_gem_object *bo = NULL, *counters_bo = NULL; |
1100 |
++ u64 iova = 0, counters_iova = 0; |
1101 |
+ |
1102 |
+ ptr = msm_gem_kernel_new(gpu->dev, |
1103 |
+ A5XX_PREEMPT_RECORD_SIZE + A5XX_PREEMPT_COUNTER_SIZE, |
1104 |
+- MSM_BO_UNCACHED, gpu->aspace, &bo, &iova); |
1105 |
++ MSM_BO_UNCACHED | MSM_BO_MAP_PRIV, gpu->aspace, &bo, &iova); |
1106 |
+ |
1107 |
+ if (IS_ERR(ptr)) |
1108 |
+ return PTR_ERR(ptr); |
1109 |
+ |
1110 |
++ /* The buffer to store counters needs to be unprivileged */ |
1111 |
++ counters = msm_gem_kernel_new(gpu->dev, |
1112 |
++ A5XX_PREEMPT_COUNTER_SIZE, |
1113 |
++ MSM_BO_UNCACHED, gpu->aspace, &counters_bo, &counters_iova); |
1114 |
++ if (IS_ERR(counters)) { |
1115 |
++ msm_gem_kernel_put(bo, gpu->aspace, true); |
1116 |
++ return PTR_ERR(counters); |
1117 |
++ } |
1118 |
++ |
1119 |
+ msm_gem_object_set_name(bo, "preempt"); |
1120 |
++ msm_gem_object_set_name(counters_bo, "preempt_counters"); |
1121 |
+ |
1122 |
+ a5xx_gpu->preempt_bo[ring->id] = bo; |
1123 |
++ a5xx_gpu->preempt_counters_bo[ring->id] = counters_bo; |
1124 |
+ a5xx_gpu->preempt_iova[ring->id] = iova; |
1125 |
+ a5xx_gpu->preempt[ring->id] = ptr; |
1126 |
+ |
1127 |
+@@ -249,7 +261,7 @@ static int preempt_init_ring(struct a5xx_gpu *a5xx_gpu, |
1128 |
+ ptr->data = 0; |
1129 |
+ ptr->cntl = MSM_GPU_RB_CNTL_DEFAULT; |
1130 |
+ ptr->rptr_addr = rbmemptr(ring, rptr); |
1131 |
+- ptr->counter = iova + A5XX_PREEMPT_RECORD_SIZE; |
1132 |
++ ptr->counter = counters_iova; |
1133 |
+ |
1134 |
+ return 0; |
1135 |
+ } |
1136 |
+@@ -260,8 +272,11 @@ void a5xx_preempt_fini(struct msm_gpu *gpu) |
1137 |
+ struct a5xx_gpu *a5xx_gpu = to_a5xx_gpu(adreno_gpu); |
1138 |
+ int i; |
1139 |
+ |
1140 |
+- for (i = 0; i < gpu->nr_rings; i++) |
1141 |
++ for (i = 0; i < gpu->nr_rings; i++) { |
1142 |
+ msm_gem_kernel_put(a5xx_gpu->preempt_bo[i], gpu->aspace, true); |
1143 |
++ msm_gem_kernel_put(a5xx_gpu->preempt_counters_bo[i], |
1144 |
++ gpu->aspace, true); |
1145 |
++ } |
1146 |
+ } |
1147 |
+ |
1148 |
+ void a5xx_preempt_init(struct msm_gpu *gpu) |
1149 |
+diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c |
1150 |
+index 7768557cdfb28..b7dc350d96fc8 100644 |
1151 |
+--- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c |
1152 |
++++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c |
1153 |
+@@ -557,6 +557,13 @@ static int a6xx_hw_init(struct msm_gpu *gpu) |
1154 |
+ if (ret) |
1155 |
+ goto out; |
1156 |
+ |
1157 |
++ /* Set the ringbuffer address */ |
1158 |
++ gpu_write64(gpu, REG_A6XX_CP_RB_BASE, REG_A6XX_CP_RB_BASE_HI, |
1159 |
++ gpu->rb[0]->iova); |
1160 |
++ |
1161 |
++ gpu_write(gpu, REG_A6XX_CP_RB_CNTL, |
1162 |
++ MSM_GPU_RB_CNTL_DEFAULT | AXXX_CP_RB_CNTL_NO_UPDATE); |
1163 |
++ |
1164 |
+ /* Always come up on rb 0 */ |
1165 |
+ a6xx_gpu->cur_ring = gpu->rb[0]; |
1166 |
+ |
1167 |
+diff --git a/drivers/gpu/drm/msm/adreno/adreno_gpu.c b/drivers/gpu/drm/msm/adreno/adreno_gpu.c |
1168 |
+index e7b39f3ca33dc..a74ccc5b8220d 100644 |
1169 |
+--- a/drivers/gpu/drm/msm/adreno/adreno_gpu.c |
1170 |
++++ b/drivers/gpu/drm/msm/adreno/adreno_gpu.c |
1171 |
+@@ -400,26 +400,6 @@ int adreno_hw_init(struct msm_gpu *gpu) |
1172 |
+ ring->memptrs->rptr = 0; |
1173 |
+ } |
1174 |
+ |
1175 |
+- /* |
1176 |
+- * Setup REG_CP_RB_CNTL. The same value is used across targets (with |
1177 |
+- * the excpetion of A430 that disables the RPTR shadow) - the cacluation |
1178 |
+- * for the ringbuffer size and block size is moved to msm_gpu.h for the |
1179 |
+- * pre-processor to deal with and the A430 variant is ORed in here |
1180 |
+- */ |
1181 |
+- adreno_gpu_write(adreno_gpu, REG_ADRENO_CP_RB_CNTL, |
1182 |
+- MSM_GPU_RB_CNTL_DEFAULT | |
1183 |
+- (adreno_is_a430(adreno_gpu) ? AXXX_CP_RB_CNTL_NO_UPDATE : 0)); |
1184 |
+- |
1185 |
+- /* Setup ringbuffer address - use ringbuffer[0] for GPU init */ |
1186 |
+- adreno_gpu_write64(adreno_gpu, REG_ADRENO_CP_RB_BASE, |
1187 |
+- REG_ADRENO_CP_RB_BASE_HI, gpu->rb[0]->iova); |
1188 |
+- |
1189 |
+- if (!adreno_is_a430(adreno_gpu)) { |
1190 |
+- adreno_gpu_write64(adreno_gpu, REG_ADRENO_CP_RB_RPTR_ADDR, |
1191 |
+- REG_ADRENO_CP_RB_RPTR_ADDR_HI, |
1192 |
+- rbmemptr(gpu->rb[0], rptr)); |
1193 |
+- } |
1194 |
+- |
1195 |
+ return 0; |
1196 |
+ } |
1197 |
+ |
1198 |
+@@ -427,11 +407,8 @@ int adreno_hw_init(struct msm_gpu *gpu) |
1199 |
+ static uint32_t get_rptr(struct adreno_gpu *adreno_gpu, |
1200 |
+ struct msm_ringbuffer *ring) |
1201 |
+ { |
1202 |
+- if (adreno_is_a430(adreno_gpu)) |
1203 |
+- return ring->memptrs->rptr = adreno_gpu_read( |
1204 |
+- adreno_gpu, REG_ADRENO_CP_RB_RPTR); |
1205 |
+- else |
1206 |
+- return ring->memptrs->rptr; |
1207 |
++ return ring->memptrs->rptr = adreno_gpu_read( |
1208 |
++ adreno_gpu, REG_ADRENO_CP_RB_RPTR); |
1209 |
+ } |
1210 |
+ |
1211 |
+ struct msm_ringbuffer *adreno_active_ring(struct msm_gpu *gpu) |
1212 |
+diff --git a/drivers/gpu/drm/msm/msm_ringbuffer.c b/drivers/gpu/drm/msm/msm_ringbuffer.c |
1213 |
+index e397c44cc0112..39ecb5a18431e 100644 |
1214 |
+--- a/drivers/gpu/drm/msm/msm_ringbuffer.c |
1215 |
++++ b/drivers/gpu/drm/msm/msm_ringbuffer.c |
1216 |
+@@ -27,7 +27,8 @@ struct msm_ringbuffer *msm_ringbuffer_new(struct msm_gpu *gpu, int id, |
1217 |
+ ring->id = id; |
1218 |
+ |
1219 |
+ ring->start = msm_gem_kernel_new(gpu->dev, MSM_GPU_RINGBUFFER_SZ, |
1220 |
+- MSM_BO_WC, gpu->aspace, &ring->bo, &ring->iova); |
1221 |
++ MSM_BO_WC | MSM_BO_GPU_READONLY, gpu->aspace, &ring->bo, |
1222 |
++ &ring->iova); |
1223 |
+ |
1224 |
+ if (IS_ERR(ring->start)) { |
1225 |
+ ret = PTR_ERR(ring->start); |
1226 |
+diff --git a/drivers/gpu/drm/sun4i/sun4i_backend.c b/drivers/gpu/drm/sun4i/sun4i_backend.c |
1227 |
+index 072ea113e6be5..ed5d866178028 100644 |
1228 |
+--- a/drivers/gpu/drm/sun4i/sun4i_backend.c |
1229 |
++++ b/drivers/gpu/drm/sun4i/sun4i_backend.c |
1230 |
+@@ -589,8 +589,7 @@ static int sun4i_backend_atomic_check(struct sunxi_engine *engine, |
1231 |
+ |
1232 |
+ /* We can't have an alpha plane at the lowest position */ |
1233 |
+ if (!backend->quirks->supports_lowest_plane_alpha && |
1234 |
+- (plane_states[0]->fb->format->has_alpha || |
1235 |
+- (plane_states[0]->alpha != DRM_BLEND_ALPHA_OPAQUE))) |
1236 |
++ (plane_states[0]->alpha != DRM_BLEND_ALPHA_OPAQUE)) |
1237 |
+ return -EINVAL; |
1238 |
+ |
1239 |
+ for (i = 1; i < num_planes; i++) { |
1240 |
+@@ -995,7 +994,6 @@ static const struct sun4i_backend_quirks sun6i_backend_quirks = { |
1241 |
+ |
1242 |
+ static const struct sun4i_backend_quirks sun7i_backend_quirks = { |
1243 |
+ .needs_output_muxing = true, |
1244 |
+- .supports_lowest_plane_alpha = true, |
1245 |
+ }; |
1246 |
+ |
1247 |
+ static const struct sun4i_backend_quirks sun8i_a33_backend_quirks = { |
1248 |
+diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c |
1249 |
+index 359b56e43b83c..24d95f058918c 100644 |
1250 |
+--- a/drivers/gpu/drm/sun4i/sun4i_tcon.c |
1251 |
++++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c |
1252 |
+@@ -1433,14 +1433,18 @@ static int sun8i_r40_tcon_tv_set_mux(struct sun4i_tcon *tcon, |
1253 |
+ if (IS_ENABLED(CONFIG_DRM_SUN8I_TCON_TOP) && |
1254 |
+ encoder->encoder_type == DRM_MODE_ENCODER_TMDS) { |
1255 |
+ ret = sun8i_tcon_top_set_hdmi_src(&pdev->dev, id); |
1256 |
+- if (ret) |
1257 |
++ if (ret) { |
1258 |
++ put_device(&pdev->dev); |
1259 |
+ return ret; |
1260 |
++ } |
1261 |
+ } |
1262 |
+ |
1263 |
+ if (IS_ENABLED(CONFIG_DRM_SUN8I_TCON_TOP)) { |
1264 |
+ ret = sun8i_tcon_top_de_config(&pdev->dev, tcon->id, id); |
1265 |
+- if (ret) |
1266 |
++ if (ret) { |
1267 |
++ put_device(&pdev->dev); |
1268 |
+ return ret; |
1269 |
++ } |
1270 |
+ } |
1271 |
+ |
1272 |
+ return 0; |
1273 |
+diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c |
1274 |
+index aa67cb037e9d1..32d4c3f7fc4eb 100644 |
1275 |
+--- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c |
1276 |
++++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c |
1277 |
+@@ -889,7 +889,7 @@ static int sun6i_dsi_dcs_write_long(struct sun6i_dsi *dsi, |
1278 |
+ regmap_write(dsi->regs, SUN6I_DSI_CMD_TX_REG(0), |
1279 |
+ sun6i_dsi_dcs_build_pkt_hdr(dsi, msg)); |
1280 |
+ |
1281 |
+- bounce = kzalloc(msg->tx_len + sizeof(crc), GFP_KERNEL); |
1282 |
++ bounce = kzalloc(ALIGN(msg->tx_len + sizeof(crc), 4), GFP_KERNEL); |
1283 |
+ if (!bounce) |
1284 |
+ return -ENOMEM; |
1285 |
+ |
1286 |
+@@ -900,7 +900,7 @@ static int sun6i_dsi_dcs_write_long(struct sun6i_dsi *dsi, |
1287 |
+ memcpy((u8 *)bounce + msg->tx_len, &crc, sizeof(crc)); |
1288 |
+ len += sizeof(crc); |
1289 |
+ |
1290 |
+- regmap_bulk_write(dsi->regs, SUN6I_DSI_CMD_TX_REG(1), bounce, len); |
1291 |
++ regmap_bulk_write(dsi->regs, SUN6I_DSI_CMD_TX_REG(1), bounce, DIV_ROUND_UP(len, 4)); |
1292 |
+ regmap_write(dsi->regs, SUN6I_DSI_CMD_CTL_REG, len + 4 - 1); |
1293 |
+ kfree(bounce); |
1294 |
+ |
1295 |
+diff --git a/drivers/gpu/drm/sun4i/sun8i_vi_layer.c b/drivers/gpu/drm/sun4i/sun8i_vi_layer.c |
1296 |
+index 22c8c5375d0db..c0147af6a8406 100644 |
1297 |
+--- a/drivers/gpu/drm/sun4i/sun8i_vi_layer.c |
1298 |
++++ b/drivers/gpu/drm/sun4i/sun8i_vi_layer.c |
1299 |
+@@ -211,7 +211,7 @@ static int sun8i_vi_layer_update_coord(struct sun8i_mixer *mixer, int channel, |
1300 |
+ return 0; |
1301 |
+ } |
1302 |
+ |
1303 |
+-static bool sun8i_vi_layer_get_csc_mode(const struct drm_format_info *format) |
1304 |
++static u32 sun8i_vi_layer_get_csc_mode(const struct drm_format_info *format) |
1305 |
+ { |
1306 |
+ if (!format->is_yuv) |
1307 |
+ return SUN8I_CSC_MODE_OFF; |
1308 |
+diff --git a/drivers/gpu/drm/tve200/tve200_display.c b/drivers/gpu/drm/tve200/tve200_display.c |
1309 |
+index d733bbc4ac0e5..17ff24d999d18 100644 |
1310 |
+--- a/drivers/gpu/drm/tve200/tve200_display.c |
1311 |
++++ b/drivers/gpu/drm/tve200/tve200_display.c |
1312 |
+@@ -14,6 +14,7 @@ |
1313 |
+ #include <linux/version.h> |
1314 |
+ #include <linux/dma-buf.h> |
1315 |
+ #include <linux/of_graph.h> |
1316 |
++#include <linux/delay.h> |
1317 |
+ |
1318 |
+ #include <drm/drm_fb_cma_helper.h> |
1319 |
+ #include <drm/drm_fourcc.h> |
1320 |
+@@ -130,9 +131,25 @@ static void tve200_display_enable(struct drm_simple_display_pipe *pipe, |
1321 |
+ struct drm_connector *connector = priv->connector; |
1322 |
+ u32 format = fb->format->format; |
1323 |
+ u32 ctrl1 = 0; |
1324 |
++ int retries; |
1325 |
+ |
1326 |
+ clk_prepare_enable(priv->clk); |
1327 |
+ |
1328 |
++ /* Reset the TVE200 and wait for it to come back online */ |
1329 |
++ writel(TVE200_CTRL_4_RESET, priv->regs + TVE200_CTRL_4); |
1330 |
++ for (retries = 0; retries < 5; retries++) { |
1331 |
++ usleep_range(30000, 50000); |
1332 |
++ if (readl(priv->regs + TVE200_CTRL_4) & TVE200_CTRL_4_RESET) |
1333 |
++ continue; |
1334 |
++ else |
1335 |
++ break; |
1336 |
++ } |
1337 |
++ if (retries == 5 && |
1338 |
++ readl(priv->regs + TVE200_CTRL_4) & TVE200_CTRL_4_RESET) { |
1339 |
++ dev_err(drm->dev, "can't get hardware out of reset\n"); |
1340 |
++ return; |
1341 |
++ } |
1342 |
++ |
1343 |
+ /* Function 1 */ |
1344 |
+ ctrl1 |= TVE200_CTRL_CSMODE; |
1345 |
+ /* Interlace mode for CCIR656: parameterize? */ |
1346 |
+@@ -230,8 +247,9 @@ static void tve200_display_disable(struct drm_simple_display_pipe *pipe) |
1347 |
+ |
1348 |
+ drm_crtc_vblank_off(crtc); |
1349 |
+ |
1350 |
+- /* Disable and Power Down */ |
1351 |
++ /* Disable put into reset and Power Down */ |
1352 |
+ writel(0, priv->regs + TVE200_CTRL); |
1353 |
++ writel(TVE200_CTRL_4_RESET, priv->regs + TVE200_CTRL_4); |
1354 |
+ |
1355 |
+ clk_disable_unprepare(priv->clk); |
1356 |
+ } |
1357 |
+@@ -279,6 +297,8 @@ static int tve200_display_enable_vblank(struct drm_simple_display_pipe *pipe) |
1358 |
+ struct drm_device *drm = crtc->dev; |
1359 |
+ struct tve200_drm_dev_private *priv = drm->dev_private; |
1360 |
+ |
1361 |
++ /* Clear any IRQs and enable */ |
1362 |
++ writel(0xFF, priv->regs + TVE200_INT_CLR); |
1363 |
+ writel(TVE200_INT_V_STATUS, priv->regs + TVE200_INT_EN); |
1364 |
+ return 0; |
1365 |
+ } |
1366 |
+diff --git a/drivers/gpu/drm/virtio/virtgpu_display.c b/drivers/gpu/drm/virtio/virtgpu_display.c |
1367 |
+index cc7fd957a3072..2b8421a35ab94 100644 |
1368 |
+--- a/drivers/gpu/drm/virtio/virtgpu_display.c |
1369 |
++++ b/drivers/gpu/drm/virtio/virtgpu_display.c |
1370 |
+@@ -123,6 +123,17 @@ static int virtio_gpu_crtc_atomic_check(struct drm_crtc *crtc, |
1371 |
+ static void virtio_gpu_crtc_atomic_flush(struct drm_crtc *crtc, |
1372 |
+ struct drm_crtc_state *old_state) |
1373 |
+ { |
1374 |
++ struct virtio_gpu_output *output = drm_crtc_to_virtio_gpu_output(crtc); |
1375 |
++ |
1376 |
++ /* |
1377 |
++ * virtio-gpu can't do modeset and plane update operations |
1378 |
++ * independent from each other. So the actual modeset happens |
1379 |
++ * in the plane update callback, and here we just check |
1380 |
++ * whenever we must force the modeset. |
1381 |
++ */ |
1382 |
++ if (drm_atomic_crtc_needs_modeset(crtc->state)) { |
1383 |
++ output->needs_modeset = true; |
1384 |
++ } |
1385 |
+ } |
1386 |
+ |
1387 |
+ static const struct drm_crtc_helper_funcs virtio_gpu_crtc_helper_funcs = { |
1388 |
+diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.h b/drivers/gpu/drm/virtio/virtgpu_drv.h |
1389 |
+index 9ff9f4ac0522a..4ab1b0ba29253 100644 |
1390 |
+--- a/drivers/gpu/drm/virtio/virtgpu_drv.h |
1391 |
++++ b/drivers/gpu/drm/virtio/virtgpu_drv.h |
1392 |
+@@ -138,6 +138,7 @@ struct virtio_gpu_output { |
1393 |
+ int cur_x; |
1394 |
+ int cur_y; |
1395 |
+ bool enabled; |
1396 |
++ bool needs_modeset; |
1397 |
+ }; |
1398 |
+ #define drm_crtc_to_virtio_gpu_output(x) \ |
1399 |
+ container_of(x, struct virtio_gpu_output, crtc) |
1400 |
+diff --git a/drivers/gpu/drm/virtio/virtgpu_plane.c b/drivers/gpu/drm/virtio/virtgpu_plane.c |
1401 |
+index 52d24179bcecc..65757409d9ed1 100644 |
1402 |
+--- a/drivers/gpu/drm/virtio/virtgpu_plane.c |
1403 |
++++ b/drivers/gpu/drm/virtio/virtgpu_plane.c |
1404 |
+@@ -163,7 +163,9 @@ static void virtio_gpu_primary_plane_update(struct drm_plane *plane, |
1405 |
+ plane->state->src_w != old_state->src_w || |
1406 |
+ plane->state->src_h != old_state->src_h || |
1407 |
+ plane->state->src_x != old_state->src_x || |
1408 |
+- plane->state->src_y != old_state->src_y) { |
1409 |
++ plane->state->src_y != old_state->src_y || |
1410 |
++ output->needs_modeset) { |
1411 |
++ output->needs_modeset = false; |
1412 |
+ DRM_DEBUG("handle 0x%x, crtc %dx%d+%d+%d, src %dx%d+%d+%d\n", |
1413 |
+ bo->hw_res_handle, |
1414 |
+ plane->state->crtc_w, plane->state->crtc_h, |
1415 |
+diff --git a/drivers/hid/hid-elan.c b/drivers/hid/hid-elan.c |
1416 |
+index 45c4f888b7c4e..dae193749d443 100644 |
1417 |
+--- a/drivers/hid/hid-elan.c |
1418 |
++++ b/drivers/hid/hid-elan.c |
1419 |
+@@ -188,6 +188,7 @@ static int elan_input_configured(struct hid_device *hdev, struct hid_input *hi) |
1420 |
+ ret = input_mt_init_slots(input, ELAN_MAX_FINGERS, INPUT_MT_POINTER); |
1421 |
+ if (ret) { |
1422 |
+ hid_err(hdev, "Failed to init elan MT slots: %d\n", ret); |
1423 |
++ input_free_device(input); |
1424 |
+ return ret; |
1425 |
+ } |
1426 |
+ |
1427 |
+@@ -198,6 +199,7 @@ static int elan_input_configured(struct hid_device *hdev, struct hid_input *hi) |
1428 |
+ if (ret) { |
1429 |
+ hid_err(hdev, "Failed to register elan input device: %d\n", |
1430 |
+ ret); |
1431 |
++ input_mt_destroy_slots(input); |
1432 |
+ input_free_device(input); |
1433 |
+ return ret; |
1434 |
+ } |
1435 |
+diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h |
1436 |
+index 6ea3619842d8d..b49ec7dde6457 100644 |
1437 |
+--- a/drivers/hid/hid-ids.h |
1438 |
++++ b/drivers/hid/hid-ids.h |
1439 |
+@@ -849,6 +849,7 @@ |
1440 |
+ #define USB_DEVICE_ID_MS_POWER_COVER 0x07da |
1441 |
+ #define USB_DEVICE_ID_MS_XBOX_ONE_S_CONTROLLER 0x02fd |
1442 |
+ #define USB_DEVICE_ID_MS_PIXART_MOUSE 0x00cb |
1443 |
++#define USB_DEVICE_ID_8BITDO_SN30_PRO_PLUS 0x02e0 |
1444 |
+ |
1445 |
+ #define USB_VENDOR_ID_MOJO 0x8282 |
1446 |
+ #define USB_DEVICE_ID_RETRO_ADAPTER 0x3201 |
1447 |
+@@ -1014,6 +1015,8 @@ |
1448 |
+ #define USB_DEVICE_ID_SAITEK_RAT9 0x0cfa |
1449 |
+ #define USB_DEVICE_ID_SAITEK_MMO7 0x0cd0 |
1450 |
+ #define USB_DEVICE_ID_SAITEK_X52 0x075c |
1451 |
++#define USB_DEVICE_ID_SAITEK_X52_2 0x0255 |
1452 |
++#define USB_DEVICE_ID_SAITEK_X52_PRO 0x0762 |
1453 |
+ |
1454 |
+ #define USB_VENDOR_ID_SAMSUNG 0x0419 |
1455 |
+ #define USB_DEVICE_ID_SAMSUNG_IR_REMOTE 0x0001 |
1456 |
+diff --git a/drivers/hid/hid-microsoft.c b/drivers/hid/hid-microsoft.c |
1457 |
+index 2d8b589201a4e..8cb1ca1936e42 100644 |
1458 |
+--- a/drivers/hid/hid-microsoft.c |
1459 |
++++ b/drivers/hid/hid-microsoft.c |
1460 |
+@@ -451,6 +451,8 @@ static const struct hid_device_id ms_devices[] = { |
1461 |
+ .driver_data = MS_SURFACE_DIAL }, |
1462 |
+ { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_XBOX_ONE_S_CONTROLLER), |
1463 |
+ .driver_data = MS_QUIRK_FF }, |
1464 |
++ { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_8BITDO_SN30_PRO_PLUS), |
1465 |
++ .driver_data = MS_QUIRK_FF }, |
1466 |
+ { } |
1467 |
+ }; |
1468 |
+ MODULE_DEVICE_TABLE(hid, ms_devices); |
1469 |
+diff --git a/drivers/hid/hid-quirks.c b/drivers/hid/hid-quirks.c |
1470 |
+index a65aef6a322fb..7a2be0205dfd1 100644 |
1471 |
+--- a/drivers/hid/hid-quirks.c |
1472 |
++++ b/drivers/hid/hid-quirks.c |
1473 |
+@@ -150,6 +150,8 @@ static const struct hid_device_id hid_quirks[] = { |
1474 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_RETROUSB, USB_DEVICE_ID_RETROUSB_SNES_RETROPORT), HID_QUIRK_INCREMENT_USAGE_ON_DUPLICATE }, |
1475 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_RUMBLEPAD), HID_QUIRK_BADPAD }, |
1476 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_X52), HID_QUIRK_INCREMENT_USAGE_ON_DUPLICATE }, |
1477 |
++ { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_X52_2), HID_QUIRK_INCREMENT_USAGE_ON_DUPLICATE }, |
1478 |
++ { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_X52_PRO), HID_QUIRK_INCREMENT_USAGE_ON_DUPLICATE }, |
1479 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_SEMICO, USB_DEVICE_ID_SEMICO_USB_KEYKOARD2), HID_QUIRK_NO_INIT_REPORTS }, |
1480 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_SEMICO, USB_DEVICE_ID_SEMICO_USB_KEYKOARD), HID_QUIRK_NO_INIT_REPORTS }, |
1481 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_SENNHEISER, USB_DEVICE_ID_SENNHEISER_BTD500USB), HID_QUIRK_NOGET }, |
1482 |
+diff --git a/drivers/i2c/busses/i2c-npcm7xx.c b/drivers/i2c/busses/i2c-npcm7xx.c |
1483 |
+index 75f07138a6fa2..dfcf04e1967f1 100644 |
1484 |
+--- a/drivers/i2c/busses/i2c-npcm7xx.c |
1485 |
++++ b/drivers/i2c/busses/i2c-npcm7xx.c |
1486 |
+@@ -2093,8 +2093,12 @@ static int npcm_i2c_master_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, |
1487 |
+ } |
1488 |
+ } |
1489 |
+ |
1490 |
+- /* Adaptive TimeOut: astimated time in usec + 100% margin */ |
1491 |
+- timeout_usec = (2 * 10000 / bus->bus_freq) * (2 + nread + nwrite); |
1492 |
++ /* |
1493 |
++ * Adaptive TimeOut: estimated time in usec + 100% margin: |
1494 |
++ * 2: double the timeout for clock stretching case |
1495 |
++ * 9: bits per transaction (including the ack/nack) |
1496 |
++ */ |
1497 |
++ timeout_usec = (2 * 9 * USEC_PER_SEC / bus->bus_freq) * (2 + nread + nwrite); |
1498 |
+ timeout = max(msecs_to_jiffies(35), usecs_to_jiffies(timeout_usec)); |
1499 |
+ if (nwrite >= 32 * 1024 || nread >= 32 * 1024) { |
1500 |
+ dev_err(bus->dev, "i2c%d buffer too big\n", bus->num); |
1501 |
+diff --git a/drivers/iio/accel/bmc150-accel-core.c b/drivers/iio/accel/bmc150-accel-core.c |
1502 |
+index 121b4e89f038c..bcdf25f32e220 100644 |
1503 |
+--- a/drivers/iio/accel/bmc150-accel-core.c |
1504 |
++++ b/drivers/iio/accel/bmc150-accel-core.c |
1505 |
+@@ -189,6 +189,14 @@ struct bmc150_accel_data { |
1506 |
+ struct mutex mutex; |
1507 |
+ u8 fifo_mode, watermark; |
1508 |
+ s16 buffer[8]; |
1509 |
++ /* |
1510 |
++ * Ensure there is sufficient space and correct alignment for |
1511 |
++ * the timestamp if enabled |
1512 |
++ */ |
1513 |
++ struct { |
1514 |
++ __le16 channels[3]; |
1515 |
++ s64 ts __aligned(8); |
1516 |
++ } scan; |
1517 |
+ u8 bw_bits; |
1518 |
+ u32 slope_dur; |
1519 |
+ u32 slope_thres; |
1520 |
+@@ -922,15 +930,16 @@ static int __bmc150_accel_fifo_flush(struct iio_dev *indio_dev, |
1521 |
+ * now. |
1522 |
+ */ |
1523 |
+ for (i = 0; i < count; i++) { |
1524 |
+- u16 sample[8]; |
1525 |
+ int j, bit; |
1526 |
+ |
1527 |
+ j = 0; |
1528 |
+ for_each_set_bit(bit, indio_dev->active_scan_mask, |
1529 |
+ indio_dev->masklength) |
1530 |
+- memcpy(&sample[j++], &buffer[i * 3 + bit], 2); |
1531 |
++ memcpy(&data->scan.channels[j++], &buffer[i * 3 + bit], |
1532 |
++ sizeof(data->scan.channels[0])); |
1533 |
+ |
1534 |
+- iio_push_to_buffers_with_timestamp(indio_dev, sample, tstamp); |
1535 |
++ iio_push_to_buffers_with_timestamp(indio_dev, &data->scan, |
1536 |
++ tstamp); |
1537 |
+ |
1538 |
+ tstamp += sample_period; |
1539 |
+ } |
1540 |
+diff --git a/drivers/iio/accel/kxsd9.c b/drivers/iio/accel/kxsd9.c |
1541 |
+index 0b876b2dc5bd4..76429e2a6fb8f 100644 |
1542 |
+--- a/drivers/iio/accel/kxsd9.c |
1543 |
++++ b/drivers/iio/accel/kxsd9.c |
1544 |
+@@ -209,14 +209,20 @@ static irqreturn_t kxsd9_trigger_handler(int irq, void *p) |
1545 |
+ const struct iio_poll_func *pf = p; |
1546 |
+ struct iio_dev *indio_dev = pf->indio_dev; |
1547 |
+ struct kxsd9_state *st = iio_priv(indio_dev); |
1548 |
++ /* |
1549 |
++ * Ensure correct positioning and alignment of timestamp. |
1550 |
++ * No need to zero initialize as all elements written. |
1551 |
++ */ |
1552 |
++ struct { |
1553 |
++ __be16 chan[4]; |
1554 |
++ s64 ts __aligned(8); |
1555 |
++ } hw_values; |
1556 |
+ int ret; |
1557 |
+- /* 4 * 16bit values AND timestamp */ |
1558 |
+- __be16 hw_values[8]; |
1559 |
+ |
1560 |
+ ret = regmap_bulk_read(st->map, |
1561 |
+ KXSD9_REG_X, |
1562 |
+- &hw_values, |
1563 |
+- 8); |
1564 |
++ hw_values.chan, |
1565 |
++ sizeof(hw_values.chan)); |
1566 |
+ if (ret) { |
1567 |
+ dev_err(st->dev, |
1568 |
+ "error reading data\n"); |
1569 |
+@@ -224,7 +230,7 @@ static irqreturn_t kxsd9_trigger_handler(int irq, void *p) |
1570 |
+ } |
1571 |
+ |
1572 |
+ iio_push_to_buffers_with_timestamp(indio_dev, |
1573 |
+- hw_values, |
1574 |
++ &hw_values, |
1575 |
+ iio_get_time_ns(indio_dev)); |
1576 |
+ iio_trigger_notify_done(indio_dev->trig); |
1577 |
+ |
1578 |
+diff --git a/drivers/iio/accel/mma7455_core.c b/drivers/iio/accel/mma7455_core.c |
1579 |
+index 8b5a6aff9bf4b..70ec3490bdb85 100644 |
1580 |
+--- a/drivers/iio/accel/mma7455_core.c |
1581 |
++++ b/drivers/iio/accel/mma7455_core.c |
1582 |
+@@ -52,6 +52,14 @@ |
1583 |
+ |
1584 |
+ struct mma7455_data { |
1585 |
+ struct regmap *regmap; |
1586 |
++ /* |
1587 |
++ * Used to reorganize data. Will ensure correct alignment of |
1588 |
++ * the timestamp if present |
1589 |
++ */ |
1590 |
++ struct { |
1591 |
++ __le16 channels[3]; |
1592 |
++ s64 ts __aligned(8); |
1593 |
++ } scan; |
1594 |
+ }; |
1595 |
+ |
1596 |
+ static int mma7455_drdy(struct mma7455_data *mma7455) |
1597 |
+@@ -82,19 +90,19 @@ static irqreturn_t mma7455_trigger_handler(int irq, void *p) |
1598 |
+ struct iio_poll_func *pf = p; |
1599 |
+ struct iio_dev *indio_dev = pf->indio_dev; |
1600 |
+ struct mma7455_data *mma7455 = iio_priv(indio_dev); |
1601 |
+- u8 buf[16]; /* 3 x 16-bit channels + padding + ts */ |
1602 |
+ int ret; |
1603 |
+ |
1604 |
+ ret = mma7455_drdy(mma7455); |
1605 |
+ if (ret) |
1606 |
+ goto done; |
1607 |
+ |
1608 |
+- ret = regmap_bulk_read(mma7455->regmap, MMA7455_REG_XOUTL, buf, |
1609 |
+- sizeof(__le16) * 3); |
1610 |
++ ret = regmap_bulk_read(mma7455->regmap, MMA7455_REG_XOUTL, |
1611 |
++ mma7455->scan.channels, |
1612 |
++ sizeof(mma7455->scan.channels)); |
1613 |
+ if (ret) |
1614 |
+ goto done; |
1615 |
+ |
1616 |
+- iio_push_to_buffers_with_timestamp(indio_dev, buf, |
1617 |
++ iio_push_to_buffers_with_timestamp(indio_dev, &mma7455->scan, |
1618 |
+ iio_get_time_ns(indio_dev)); |
1619 |
+ |
1620 |
+ done: |
1621 |
+diff --git a/drivers/iio/accel/mma8452.c b/drivers/iio/accel/mma8452.c |
1622 |
+index 813bca7cfc3ed..85d453b3f5ec1 100644 |
1623 |
+--- a/drivers/iio/accel/mma8452.c |
1624 |
++++ b/drivers/iio/accel/mma8452.c |
1625 |
+@@ -110,6 +110,12 @@ struct mma8452_data { |
1626 |
+ int sleep_val; |
1627 |
+ struct regulator *vdd_reg; |
1628 |
+ struct regulator *vddio_reg; |
1629 |
++ |
1630 |
++ /* Ensure correct alignment of time stamp when present */ |
1631 |
++ struct { |
1632 |
++ __be16 channels[3]; |
1633 |
++ s64 ts __aligned(8); |
1634 |
++ } buffer; |
1635 |
+ }; |
1636 |
+ |
1637 |
+ /** |
1638 |
+@@ -1091,14 +1097,13 @@ static irqreturn_t mma8452_trigger_handler(int irq, void *p) |
1639 |
+ struct iio_poll_func *pf = p; |
1640 |
+ struct iio_dev *indio_dev = pf->indio_dev; |
1641 |
+ struct mma8452_data *data = iio_priv(indio_dev); |
1642 |
+- u8 buffer[16]; /* 3 16-bit channels + padding + ts */ |
1643 |
+ int ret; |
1644 |
+ |
1645 |
+- ret = mma8452_read(data, (__be16 *)buffer); |
1646 |
++ ret = mma8452_read(data, data->buffer.channels); |
1647 |
+ if (ret < 0) |
1648 |
+ goto done; |
1649 |
+ |
1650 |
+- iio_push_to_buffers_with_timestamp(indio_dev, buffer, |
1651 |
++ iio_push_to_buffers_with_timestamp(indio_dev, &data->buffer, |
1652 |
+ iio_get_time_ns(indio_dev)); |
1653 |
+ |
1654 |
+ done: |
1655 |
+diff --git a/drivers/iio/adc/ina2xx-adc.c b/drivers/iio/adc/ina2xx-adc.c |
1656 |
+index bdd7cba6f6b0b..d3e9ec00ef959 100644 |
1657 |
+--- a/drivers/iio/adc/ina2xx-adc.c |
1658 |
++++ b/drivers/iio/adc/ina2xx-adc.c |
1659 |
+@@ -146,6 +146,11 @@ struct ina2xx_chip_info { |
1660 |
+ int range_vbus; /* Bus voltage maximum in V */ |
1661 |
+ int pga_gain_vshunt; /* Shunt voltage PGA gain */ |
1662 |
+ bool allow_async_readout; |
1663 |
++ /* data buffer needs space for channel data and timestamp */ |
1664 |
++ struct { |
1665 |
++ u16 chan[4]; |
1666 |
++ u64 ts __aligned(8); |
1667 |
++ } scan; |
1668 |
+ }; |
1669 |
+ |
1670 |
+ static const struct ina2xx_config ina2xx_config[] = { |
1671 |
+@@ -738,8 +743,6 @@ static int ina2xx_conversion_ready(struct iio_dev *indio_dev) |
1672 |
+ static int ina2xx_work_buffer(struct iio_dev *indio_dev) |
1673 |
+ { |
1674 |
+ struct ina2xx_chip_info *chip = iio_priv(indio_dev); |
1675 |
+- /* data buffer needs space for channel data and timestap */ |
1676 |
+- unsigned short data[4 + sizeof(s64)/sizeof(short)]; |
1677 |
+ int bit, ret, i = 0; |
1678 |
+ s64 time; |
1679 |
+ |
1680 |
+@@ -758,10 +761,10 @@ static int ina2xx_work_buffer(struct iio_dev *indio_dev) |
1681 |
+ if (ret < 0) |
1682 |
+ return ret; |
1683 |
+ |
1684 |
+- data[i++] = val; |
1685 |
++ chip->scan.chan[i++] = val; |
1686 |
+ } |
1687 |
+ |
1688 |
+- iio_push_to_buffers_with_timestamp(indio_dev, data, time); |
1689 |
++ iio_push_to_buffers_with_timestamp(indio_dev, &chip->scan, time); |
1690 |
+ |
1691 |
+ return 0; |
1692 |
+ }; |
1693 |
+diff --git a/drivers/iio/adc/max1118.c b/drivers/iio/adc/max1118.c |
1694 |
+index 0c5d7aaf68262..b3d8cba6ce698 100644 |
1695 |
+--- a/drivers/iio/adc/max1118.c |
1696 |
++++ b/drivers/iio/adc/max1118.c |
1697 |
+@@ -35,6 +35,11 @@ struct max1118 { |
1698 |
+ struct spi_device *spi; |
1699 |
+ struct mutex lock; |
1700 |
+ struct regulator *reg; |
1701 |
++ /* Ensure natural alignment of buffer elements */ |
1702 |
++ struct { |
1703 |
++ u8 channels[2]; |
1704 |
++ s64 ts __aligned(8); |
1705 |
++ } scan; |
1706 |
+ |
1707 |
+ u8 data ____cacheline_aligned; |
1708 |
+ }; |
1709 |
+@@ -165,7 +170,6 @@ static irqreturn_t max1118_trigger_handler(int irq, void *p) |
1710 |
+ struct iio_poll_func *pf = p; |
1711 |
+ struct iio_dev *indio_dev = pf->indio_dev; |
1712 |
+ struct max1118 *adc = iio_priv(indio_dev); |
1713 |
+- u8 data[16] = { }; /* 2x 8-bit ADC data + padding + 8 bytes timestamp */ |
1714 |
+ int scan_index; |
1715 |
+ int i = 0; |
1716 |
+ |
1717 |
+@@ -183,10 +187,10 @@ static irqreturn_t max1118_trigger_handler(int irq, void *p) |
1718 |
+ goto out; |
1719 |
+ } |
1720 |
+ |
1721 |
+- data[i] = ret; |
1722 |
++ adc->scan.channels[i] = ret; |
1723 |
+ i++; |
1724 |
+ } |
1725 |
+- iio_push_to_buffers_with_timestamp(indio_dev, data, |
1726 |
++ iio_push_to_buffers_with_timestamp(indio_dev, &adc->scan, |
1727 |
+ iio_get_time_ns(indio_dev)); |
1728 |
+ out: |
1729 |
+ mutex_unlock(&adc->lock); |
1730 |
+diff --git a/drivers/iio/adc/mcp3422.c b/drivers/iio/adc/mcp3422.c |
1731 |
+index d86c0b5d80a3d..f96f0cecbcdef 100644 |
1732 |
+--- a/drivers/iio/adc/mcp3422.c |
1733 |
++++ b/drivers/iio/adc/mcp3422.c |
1734 |
+@@ -96,16 +96,12 @@ static int mcp3422_update_config(struct mcp3422 *adc, u8 newconfig) |
1735 |
+ { |
1736 |
+ int ret; |
1737 |
+ |
1738 |
+- mutex_lock(&adc->lock); |
1739 |
+- |
1740 |
+ ret = i2c_master_send(adc->i2c, &newconfig, 1); |
1741 |
+ if (ret > 0) { |
1742 |
+ adc->config = newconfig; |
1743 |
+ ret = 0; |
1744 |
+ } |
1745 |
+ |
1746 |
+- mutex_unlock(&adc->lock); |
1747 |
+- |
1748 |
+ return ret; |
1749 |
+ } |
1750 |
+ |
1751 |
+@@ -138,6 +134,8 @@ static int mcp3422_read_channel(struct mcp3422 *adc, |
1752 |
+ u8 config; |
1753 |
+ u8 req_channel = channel->channel; |
1754 |
+ |
1755 |
++ mutex_lock(&adc->lock); |
1756 |
++ |
1757 |
+ if (req_channel != MCP3422_CHANNEL(adc->config)) { |
1758 |
+ config = adc->config; |
1759 |
+ config &= ~MCP3422_CHANNEL_MASK; |
1760 |
+@@ -145,12 +143,18 @@ static int mcp3422_read_channel(struct mcp3422 *adc, |
1761 |
+ config &= ~MCP3422_PGA_MASK; |
1762 |
+ config |= MCP3422_PGA_VALUE(adc->pga[req_channel]); |
1763 |
+ ret = mcp3422_update_config(adc, config); |
1764 |
+- if (ret < 0) |
1765 |
++ if (ret < 0) { |
1766 |
++ mutex_unlock(&adc->lock); |
1767 |
+ return ret; |
1768 |
++ } |
1769 |
+ msleep(mcp3422_read_times[MCP3422_SAMPLE_RATE(adc->config)]); |
1770 |
+ } |
1771 |
+ |
1772 |
+- return mcp3422_read(adc, value, &config); |
1773 |
++ ret = mcp3422_read(adc, value, &config); |
1774 |
++ |
1775 |
++ mutex_unlock(&adc->lock); |
1776 |
++ |
1777 |
++ return ret; |
1778 |
+ } |
1779 |
+ |
1780 |
+ static int mcp3422_read_raw(struct iio_dev *iio, |
1781 |
+diff --git a/drivers/iio/adc/ti-adc081c.c b/drivers/iio/adc/ti-adc081c.c |
1782 |
+index 0235863ff77b0..cc8cbffe2b7b5 100644 |
1783 |
+--- a/drivers/iio/adc/ti-adc081c.c |
1784 |
++++ b/drivers/iio/adc/ti-adc081c.c |
1785 |
+@@ -33,6 +33,12 @@ struct adc081c { |
1786 |
+ |
1787 |
+ /* 8, 10 or 12 */ |
1788 |
+ int bits; |
1789 |
++ |
1790 |
++ /* Ensure natural alignment of buffer elements */ |
1791 |
++ struct { |
1792 |
++ u16 channel; |
1793 |
++ s64 ts __aligned(8); |
1794 |
++ } scan; |
1795 |
+ }; |
1796 |
+ |
1797 |
+ #define REG_CONV_RES 0x00 |
1798 |
+@@ -128,14 +134,13 @@ static irqreturn_t adc081c_trigger_handler(int irq, void *p) |
1799 |
+ struct iio_poll_func *pf = p; |
1800 |
+ struct iio_dev *indio_dev = pf->indio_dev; |
1801 |
+ struct adc081c *data = iio_priv(indio_dev); |
1802 |
+- u16 buf[8]; /* 2 bytes data + 6 bytes padding + 8 bytes timestamp */ |
1803 |
+ int ret; |
1804 |
+ |
1805 |
+ ret = i2c_smbus_read_word_swapped(data->i2c, REG_CONV_RES); |
1806 |
+ if (ret < 0) |
1807 |
+ goto out; |
1808 |
+- buf[0] = ret; |
1809 |
+- iio_push_to_buffers_with_timestamp(indio_dev, buf, |
1810 |
++ data->scan.channel = ret; |
1811 |
++ iio_push_to_buffers_with_timestamp(indio_dev, &data->scan, |
1812 |
+ iio_get_time_ns(indio_dev)); |
1813 |
+ out: |
1814 |
+ iio_trigger_notify_done(indio_dev->trig); |
1815 |
+diff --git a/drivers/iio/adc/ti-adc084s021.c b/drivers/iio/adc/ti-adc084s021.c |
1816 |
+index bdedf456ee05d..fc053216d282c 100644 |
1817 |
+--- a/drivers/iio/adc/ti-adc084s021.c |
1818 |
++++ b/drivers/iio/adc/ti-adc084s021.c |
1819 |
+@@ -25,6 +25,11 @@ struct adc084s021 { |
1820 |
+ struct spi_transfer spi_trans; |
1821 |
+ struct regulator *reg; |
1822 |
+ struct mutex lock; |
1823 |
++ /* Buffer used to align data */ |
1824 |
++ struct { |
1825 |
++ __be16 channels[4]; |
1826 |
++ s64 ts __aligned(8); |
1827 |
++ } scan; |
1828 |
+ /* |
1829 |
+ * DMA (thus cache coherency maintenance) requires the |
1830 |
+ * transfer buffers to live in their own cache line. |
1831 |
+@@ -140,14 +145,13 @@ static irqreturn_t adc084s021_buffer_trigger_handler(int irq, void *pollfunc) |
1832 |
+ struct iio_poll_func *pf = pollfunc; |
1833 |
+ struct iio_dev *indio_dev = pf->indio_dev; |
1834 |
+ struct adc084s021 *adc = iio_priv(indio_dev); |
1835 |
+- __be16 data[8] = {0}; /* 4 * 16-bit words of data + 8 bytes timestamp */ |
1836 |
+ |
1837 |
+ mutex_lock(&adc->lock); |
1838 |
+ |
1839 |
+- if (adc084s021_adc_conversion(adc, &data) < 0) |
1840 |
++ if (adc084s021_adc_conversion(adc, adc->scan.channels) < 0) |
1841 |
+ dev_err(&adc->spi->dev, "Failed to read data\n"); |
1842 |
+ |
1843 |
+- iio_push_to_buffers_with_timestamp(indio_dev, data, |
1844 |
++ iio_push_to_buffers_with_timestamp(indio_dev, &adc->scan, |
1845 |
+ iio_get_time_ns(indio_dev)); |
1846 |
+ mutex_unlock(&adc->lock); |
1847 |
+ iio_trigger_notify_done(indio_dev->trig); |
1848 |
+diff --git a/drivers/iio/adc/ti-ads1015.c b/drivers/iio/adc/ti-ads1015.c |
1849 |
+index 5ea4f45d6bade..64fe3b2a6ec6d 100644 |
1850 |
+--- a/drivers/iio/adc/ti-ads1015.c |
1851 |
++++ b/drivers/iio/adc/ti-ads1015.c |
1852 |
+@@ -316,6 +316,7 @@ static const struct iio_chan_spec ads1115_channels[] = { |
1853 |
+ IIO_CHAN_SOFT_TIMESTAMP(ADS1015_TIMESTAMP), |
1854 |
+ }; |
1855 |
+ |
1856 |
++#ifdef CONFIG_PM |
1857 |
+ static int ads1015_set_power_state(struct ads1015_data *data, bool on) |
1858 |
+ { |
1859 |
+ int ret; |
1860 |
+@@ -333,6 +334,15 @@ static int ads1015_set_power_state(struct ads1015_data *data, bool on) |
1861 |
+ return ret < 0 ? ret : 0; |
1862 |
+ } |
1863 |
+ |
1864 |
++#else /* !CONFIG_PM */ |
1865 |
++ |
1866 |
++static int ads1015_set_power_state(struct ads1015_data *data, bool on) |
1867 |
++{ |
1868 |
++ return 0; |
1869 |
++} |
1870 |
++ |
1871 |
++#endif /* !CONFIG_PM */ |
1872 |
++ |
1873 |
+ static |
1874 |
+ int ads1015_get_adc_result(struct ads1015_data *data, int chan, int *val) |
1875 |
+ { |
1876 |
+diff --git a/drivers/iio/chemical/ccs811.c b/drivers/iio/chemical/ccs811.c |
1877 |
+index 3ecd633f9ed32..b2b6009078e10 100644 |
1878 |
+--- a/drivers/iio/chemical/ccs811.c |
1879 |
++++ b/drivers/iio/chemical/ccs811.c |
1880 |
+@@ -78,6 +78,11 @@ struct ccs811_data { |
1881 |
+ struct iio_trigger *drdy_trig; |
1882 |
+ struct gpio_desc *wakeup_gpio; |
1883 |
+ bool drdy_trig_on; |
1884 |
++ /* Ensures correct alignment of timestamp if present */ |
1885 |
++ struct { |
1886 |
++ s16 channels[2]; |
1887 |
++ s64 ts __aligned(8); |
1888 |
++ } scan; |
1889 |
+ }; |
1890 |
+ |
1891 |
+ static const struct iio_chan_spec ccs811_channels[] = { |
1892 |
+@@ -327,17 +332,17 @@ static irqreturn_t ccs811_trigger_handler(int irq, void *p) |
1893 |
+ struct iio_dev *indio_dev = pf->indio_dev; |
1894 |
+ struct ccs811_data *data = iio_priv(indio_dev); |
1895 |
+ struct i2c_client *client = data->client; |
1896 |
+- s16 buf[8]; /* s16 eCO2 + s16 TVOC + padding + 8 byte timestamp */ |
1897 |
+ int ret; |
1898 |
+ |
1899 |
+- ret = i2c_smbus_read_i2c_block_data(client, CCS811_ALG_RESULT_DATA, 4, |
1900 |
+- (u8 *)&buf); |
1901 |
++ ret = i2c_smbus_read_i2c_block_data(client, CCS811_ALG_RESULT_DATA, |
1902 |
++ sizeof(data->scan.channels), |
1903 |
++ (u8 *)data->scan.channels); |
1904 |
+ if (ret != 4) { |
1905 |
+ dev_err(&client->dev, "cannot read sensor data\n"); |
1906 |
+ goto err; |
1907 |
+ } |
1908 |
+ |
1909 |
+- iio_push_to_buffers_with_timestamp(indio_dev, buf, |
1910 |
++ iio_push_to_buffers_with_timestamp(indio_dev, &data->scan, |
1911 |
+ iio_get_time_ns(indio_dev)); |
1912 |
+ |
1913 |
+ err: |
1914 |
+diff --git a/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c b/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c |
1915 |
+index c831915ca7e56..6b6b5987ac753 100644 |
1916 |
+--- a/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c |
1917 |
++++ b/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c |
1918 |
+@@ -72,10 +72,13 @@ static void get_default_min_max_freq(enum motionsensor_type type, |
1919 |
+ |
1920 |
+ switch (type) { |
1921 |
+ case MOTIONSENSE_TYPE_ACCEL: |
1922 |
+- case MOTIONSENSE_TYPE_GYRO: |
1923 |
+ *min_freq = 12500; |
1924 |
+ *max_freq = 100000; |
1925 |
+ break; |
1926 |
++ case MOTIONSENSE_TYPE_GYRO: |
1927 |
++ *min_freq = 25000; |
1928 |
++ *max_freq = 100000; |
1929 |
++ break; |
1930 |
+ case MOTIONSENSE_TYPE_MAG: |
1931 |
+ *min_freq = 5000; |
1932 |
+ *max_freq = 25000; |
1933 |
+diff --git a/drivers/iio/light/ltr501.c b/drivers/iio/light/ltr501.c |
1934 |
+index 5a3fcb127cd20..d10ed80566567 100644 |
1935 |
+--- a/drivers/iio/light/ltr501.c |
1936 |
++++ b/drivers/iio/light/ltr501.c |
1937 |
+@@ -1243,13 +1243,16 @@ static irqreturn_t ltr501_trigger_handler(int irq, void *p) |
1938 |
+ struct iio_poll_func *pf = p; |
1939 |
+ struct iio_dev *indio_dev = pf->indio_dev; |
1940 |
+ struct ltr501_data *data = iio_priv(indio_dev); |
1941 |
+- u16 buf[8]; |
1942 |
++ struct { |
1943 |
++ u16 channels[3]; |
1944 |
++ s64 ts __aligned(8); |
1945 |
++ } scan; |
1946 |
+ __le16 als_buf[2]; |
1947 |
+ u8 mask = 0; |
1948 |
+ int j = 0; |
1949 |
+ int ret, psdata; |
1950 |
+ |
1951 |
+- memset(buf, 0, sizeof(buf)); |
1952 |
++ memset(&scan, 0, sizeof(scan)); |
1953 |
+ |
1954 |
+ /* figure out which data needs to be ready */ |
1955 |
+ if (test_bit(0, indio_dev->active_scan_mask) || |
1956 |
+@@ -1268,9 +1271,9 @@ static irqreturn_t ltr501_trigger_handler(int irq, void *p) |
1957 |
+ if (ret < 0) |
1958 |
+ return ret; |
1959 |
+ if (test_bit(0, indio_dev->active_scan_mask)) |
1960 |
+- buf[j++] = le16_to_cpu(als_buf[1]); |
1961 |
++ scan.channels[j++] = le16_to_cpu(als_buf[1]); |
1962 |
+ if (test_bit(1, indio_dev->active_scan_mask)) |
1963 |
+- buf[j++] = le16_to_cpu(als_buf[0]); |
1964 |
++ scan.channels[j++] = le16_to_cpu(als_buf[0]); |
1965 |
+ } |
1966 |
+ |
1967 |
+ if (mask & LTR501_STATUS_PS_RDY) { |
1968 |
+@@ -1278,10 +1281,10 @@ static irqreturn_t ltr501_trigger_handler(int irq, void *p) |
1969 |
+ &psdata, 2); |
1970 |
+ if (ret < 0) |
1971 |
+ goto done; |
1972 |
+- buf[j++] = psdata & LTR501_PS_DATA_MASK; |
1973 |
++ scan.channels[j++] = psdata & LTR501_PS_DATA_MASK; |
1974 |
+ } |
1975 |
+ |
1976 |
+- iio_push_to_buffers_with_timestamp(indio_dev, buf, |
1977 |
++ iio_push_to_buffers_with_timestamp(indio_dev, &scan, |
1978 |
+ iio_get_time_ns(indio_dev)); |
1979 |
+ |
1980 |
+ done: |
1981 |
+diff --git a/drivers/iio/light/max44000.c b/drivers/iio/light/max44000.c |
1982 |
+index d6d8007ba430a..8cc619de2c3ae 100644 |
1983 |
+--- a/drivers/iio/light/max44000.c |
1984 |
++++ b/drivers/iio/light/max44000.c |
1985 |
+@@ -75,6 +75,11 @@ |
1986 |
+ struct max44000_data { |
1987 |
+ struct mutex lock; |
1988 |
+ struct regmap *regmap; |
1989 |
++ /* Ensure naturally aligned timestamp */ |
1990 |
++ struct { |
1991 |
++ u16 channels[2]; |
1992 |
++ s64 ts __aligned(8); |
1993 |
++ } scan; |
1994 |
+ }; |
1995 |
+ |
1996 |
+ /* Default scale is set to the minimum of 0.03125 or 1 / (1 << 5) lux */ |
1997 |
+@@ -488,7 +493,6 @@ static irqreturn_t max44000_trigger_handler(int irq, void *p) |
1998 |
+ struct iio_poll_func *pf = p; |
1999 |
+ struct iio_dev *indio_dev = pf->indio_dev; |
2000 |
+ struct max44000_data *data = iio_priv(indio_dev); |
2001 |
+- u16 buf[8]; /* 2x u16 + padding + 8 bytes timestamp */ |
2002 |
+ int index = 0; |
2003 |
+ unsigned int regval; |
2004 |
+ int ret; |
2005 |
+@@ -498,17 +502,17 @@ static irqreturn_t max44000_trigger_handler(int irq, void *p) |
2006 |
+ ret = max44000_read_alsval(data); |
2007 |
+ if (ret < 0) |
2008 |
+ goto out_unlock; |
2009 |
+- buf[index++] = ret; |
2010 |
++ data->scan.channels[index++] = ret; |
2011 |
+ } |
2012 |
+ if (test_bit(MAX44000_SCAN_INDEX_PRX, indio_dev->active_scan_mask)) { |
2013 |
+ ret = regmap_read(data->regmap, MAX44000_REG_PRX_DATA, ®val); |
2014 |
+ if (ret < 0) |
2015 |
+ goto out_unlock; |
2016 |
+- buf[index] = regval; |
2017 |
++ data->scan.channels[index] = regval; |
2018 |
+ } |
2019 |
+ mutex_unlock(&data->lock); |
2020 |
+ |
2021 |
+- iio_push_to_buffers_with_timestamp(indio_dev, buf, |
2022 |
++ iio_push_to_buffers_with_timestamp(indio_dev, &data->scan, |
2023 |
+ iio_get_time_ns(indio_dev)); |
2024 |
+ iio_trigger_notify_done(indio_dev->trig); |
2025 |
+ return IRQ_HANDLED; |
2026 |
+diff --git a/drivers/iio/magnetometer/ak8975.c b/drivers/iio/magnetometer/ak8975.c |
2027 |
+index 3c881541ae72f..3fc44ec45f763 100644 |
2028 |
+--- a/drivers/iio/magnetometer/ak8975.c |
2029 |
++++ b/drivers/iio/magnetometer/ak8975.c |
2030 |
+@@ -365,6 +365,12 @@ struct ak8975_data { |
2031 |
+ struct iio_mount_matrix orientation; |
2032 |
+ struct regulator *vdd; |
2033 |
+ struct regulator *vid; |
2034 |
++ |
2035 |
++ /* Ensure natural alignment of timestamp */ |
2036 |
++ struct { |
2037 |
++ s16 channels[3]; |
2038 |
++ s64 ts __aligned(8); |
2039 |
++ } scan; |
2040 |
+ }; |
2041 |
+ |
2042 |
+ /* Enable attached power regulator if any. */ |
2043 |
+@@ -787,7 +793,6 @@ static void ak8975_fill_buffer(struct iio_dev *indio_dev) |
2044 |
+ const struct i2c_client *client = data->client; |
2045 |
+ const struct ak_def *def = data->def; |
2046 |
+ int ret; |
2047 |
+- s16 buff[8]; /* 3 x 16 bits axis values + 1 aligned 64 bits timestamp */ |
2048 |
+ __le16 fval[3]; |
2049 |
+ |
2050 |
+ mutex_lock(&data->lock); |
2051 |
+@@ -810,12 +815,13 @@ static void ak8975_fill_buffer(struct iio_dev *indio_dev) |
2052 |
+ mutex_unlock(&data->lock); |
2053 |
+ |
2054 |
+ /* Clamp to valid range. */ |
2055 |
+- buff[0] = clamp_t(s16, le16_to_cpu(fval[0]), -def->range, def->range); |
2056 |
+- buff[1] = clamp_t(s16, le16_to_cpu(fval[1]), -def->range, def->range); |
2057 |
+- buff[2] = clamp_t(s16, le16_to_cpu(fval[2]), -def->range, def->range); |
2058 |
++ data->scan.channels[0] = clamp_t(s16, le16_to_cpu(fval[0]), -def->range, def->range); |
2059 |
++ data->scan.channels[1] = clamp_t(s16, le16_to_cpu(fval[1]), -def->range, def->range); |
2060 |
++ data->scan.channels[2] = clamp_t(s16, le16_to_cpu(fval[2]), -def->range, def->range); |
2061 |
+ |
2062 |
+- iio_push_to_buffers_with_timestamp(indio_dev, buff, |
2063 |
++ iio_push_to_buffers_with_timestamp(indio_dev, &data->scan, |
2064 |
+ iio_get_time_ns(indio_dev)); |
2065 |
++ |
2066 |
+ return; |
2067 |
+ |
2068 |
+ unlock: |
2069 |
+diff --git a/drivers/iio/proximity/mb1232.c b/drivers/iio/proximity/mb1232.c |
2070 |
+index 166b3e6d7db89..5254b1fbccfdc 100644 |
2071 |
+--- a/drivers/iio/proximity/mb1232.c |
2072 |
++++ b/drivers/iio/proximity/mb1232.c |
2073 |
+@@ -40,6 +40,11 @@ struct mb1232_data { |
2074 |
+ */ |
2075 |
+ struct completion ranging; |
2076 |
+ int irqnr; |
2077 |
++ /* Ensure correct alignment of data to push to IIO buffer */ |
2078 |
++ struct { |
2079 |
++ s16 distance; |
2080 |
++ s64 ts __aligned(8); |
2081 |
++ } scan; |
2082 |
+ }; |
2083 |
+ |
2084 |
+ static irqreturn_t mb1232_handle_irq(int irq, void *dev_id) |
2085 |
+@@ -113,17 +118,13 @@ static irqreturn_t mb1232_trigger_handler(int irq, void *p) |
2086 |
+ struct iio_poll_func *pf = p; |
2087 |
+ struct iio_dev *indio_dev = pf->indio_dev; |
2088 |
+ struct mb1232_data *data = iio_priv(indio_dev); |
2089 |
+- /* |
2090 |
+- * triggered buffer |
2091 |
+- * 16-bit channel + 48-bit padding + 64-bit timestamp |
2092 |
+- */ |
2093 |
+- s16 buffer[8] = { 0 }; |
2094 |
+ |
2095 |
+- buffer[0] = mb1232_read_distance(data); |
2096 |
+- if (buffer[0] < 0) |
2097 |
++ data->scan.distance = mb1232_read_distance(data); |
2098 |
++ if (data->scan.distance < 0) |
2099 |
+ goto err; |
2100 |
+ |
2101 |
+- iio_push_to_buffers_with_timestamp(indio_dev, buffer, pf->timestamp); |
2102 |
++ iio_push_to_buffers_with_timestamp(indio_dev, &data->scan, |
2103 |
++ pf->timestamp); |
2104 |
+ |
2105 |
+ err: |
2106 |
+ iio_trigger_notify_done(indio_dev->trig); |
2107 |
+diff --git a/drivers/infiniband/core/cq.c b/drivers/infiniband/core/cq.c |
2108 |
+index 513825e424bff..a92fc3f90bb5b 100644 |
2109 |
+--- a/drivers/infiniband/core/cq.c |
2110 |
++++ b/drivers/infiniband/core/cq.c |
2111 |
+@@ -379,7 +379,7 @@ static int ib_alloc_cqs(struct ib_device *dev, unsigned int nr_cqes, |
2112 |
+ { |
2113 |
+ LIST_HEAD(tmp_list); |
2114 |
+ unsigned int nr_cqs, i; |
2115 |
+- struct ib_cq *cq; |
2116 |
++ struct ib_cq *cq, *n; |
2117 |
+ int ret; |
2118 |
+ |
2119 |
+ if (poll_ctx > IB_POLL_LAST_POOL_TYPE) { |
2120 |
+@@ -412,7 +412,7 @@ static int ib_alloc_cqs(struct ib_device *dev, unsigned int nr_cqes, |
2121 |
+ return 0; |
2122 |
+ |
2123 |
+ out_free_cqs: |
2124 |
+- list_for_each_entry(cq, &tmp_list, pool_entry) { |
2125 |
++ list_for_each_entry_safe(cq, n, &tmp_list, pool_entry) { |
2126 |
+ cq->shared = false; |
2127 |
+ ib_free_cq(cq); |
2128 |
+ } |
2129 |
+diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c |
2130 |
+index f369f0a19e851..1b0ea945756f0 100644 |
2131 |
+--- a/drivers/infiniband/core/verbs.c |
2132 |
++++ b/drivers/infiniband/core/verbs.c |
2133 |
+@@ -1803,7 +1803,7 @@ int ib_get_eth_speed(struct ib_device *dev, u8 port_num, u8 *speed, u8 *width) |
2134 |
+ |
2135 |
+ dev_put(netdev); |
2136 |
+ |
2137 |
+- if (!rc) { |
2138 |
++ if (!rc && lksettings.base.speed != (u32)SPEED_UNKNOWN) { |
2139 |
+ netdev_speed = lksettings.base.speed; |
2140 |
+ } else { |
2141 |
+ netdev_speed = SPEED_1000; |
2142 |
+diff --git a/drivers/infiniband/hw/bnxt_re/ib_verbs.c b/drivers/infiniband/hw/bnxt_re/ib_verbs.c |
2143 |
+index 8b6ad5cddfce9..cb6e873039df5 100644 |
2144 |
+--- a/drivers/infiniband/hw/bnxt_re/ib_verbs.c |
2145 |
++++ b/drivers/infiniband/hw/bnxt_re/ib_verbs.c |
2146 |
+@@ -752,12 +752,6 @@ static int bnxt_re_destroy_gsi_sqp(struct bnxt_re_qp *qp) |
2147 |
+ gsi_sqp = rdev->gsi_ctx.gsi_sqp; |
2148 |
+ gsi_sah = rdev->gsi_ctx.gsi_sah; |
2149 |
+ |
2150 |
+- /* remove from active qp list */ |
2151 |
+- mutex_lock(&rdev->qp_lock); |
2152 |
+- list_del(&gsi_sqp->list); |
2153 |
+- mutex_unlock(&rdev->qp_lock); |
2154 |
+- atomic_dec(&rdev->qp_count); |
2155 |
+- |
2156 |
+ ibdev_dbg(&rdev->ibdev, "Destroy the shadow AH\n"); |
2157 |
+ bnxt_qplib_destroy_ah(&rdev->qplib_res, |
2158 |
+ &gsi_sah->qplib_ah, |
2159 |
+@@ -772,6 +766,12 @@ static int bnxt_re_destroy_gsi_sqp(struct bnxt_re_qp *qp) |
2160 |
+ } |
2161 |
+ bnxt_qplib_free_qp_res(&rdev->qplib_res, &gsi_sqp->qplib_qp); |
2162 |
+ |
2163 |
++ /* remove from active qp list */ |
2164 |
++ mutex_lock(&rdev->qp_lock); |
2165 |
++ list_del(&gsi_sqp->list); |
2166 |
++ mutex_unlock(&rdev->qp_lock); |
2167 |
++ atomic_dec(&rdev->qp_count); |
2168 |
++ |
2169 |
+ kfree(rdev->gsi_ctx.sqp_tbl); |
2170 |
+ kfree(gsi_sah); |
2171 |
+ kfree(gsi_sqp); |
2172 |
+@@ -792,11 +792,6 @@ int bnxt_re_destroy_qp(struct ib_qp *ib_qp, struct ib_udata *udata) |
2173 |
+ unsigned int flags; |
2174 |
+ int rc; |
2175 |
+ |
2176 |
+- mutex_lock(&rdev->qp_lock); |
2177 |
+- list_del(&qp->list); |
2178 |
+- mutex_unlock(&rdev->qp_lock); |
2179 |
+- atomic_dec(&rdev->qp_count); |
2180 |
+- |
2181 |
+ bnxt_qplib_flush_cqn_wq(&qp->qplib_qp); |
2182 |
+ |
2183 |
+ rc = bnxt_qplib_destroy_qp(&rdev->qplib_res, &qp->qplib_qp); |
2184 |
+@@ -819,6 +814,11 @@ int bnxt_re_destroy_qp(struct ib_qp *ib_qp, struct ib_udata *udata) |
2185 |
+ goto sh_fail; |
2186 |
+ } |
2187 |
+ |
2188 |
++ mutex_lock(&rdev->qp_lock); |
2189 |
++ list_del(&qp->list); |
2190 |
++ mutex_unlock(&rdev->qp_lock); |
2191 |
++ atomic_dec(&rdev->qp_count); |
2192 |
++ |
2193 |
+ ib_umem_release(qp->rumem); |
2194 |
+ ib_umem_release(qp->sumem); |
2195 |
+ |
2196 |
+@@ -3178,6 +3178,19 @@ static void bnxt_re_process_res_rawqp1_wc(struct ib_wc *wc, |
2197 |
+ wc->wc_flags |= IB_WC_GRH; |
2198 |
+ } |
2199 |
+ |
2200 |
++static bool bnxt_re_check_if_vlan_valid(struct bnxt_re_dev *rdev, |
2201 |
++ u16 vlan_id) |
2202 |
++{ |
2203 |
++ /* |
2204 |
++ * Check if the vlan is configured in the host. If not configured, it |
2205 |
++ * can be a transparent VLAN. So dont report the vlan id. |
2206 |
++ */ |
2207 |
++ if (!__vlan_find_dev_deep_rcu(rdev->netdev, |
2208 |
++ htons(ETH_P_8021Q), vlan_id)) |
2209 |
++ return false; |
2210 |
++ return true; |
2211 |
++} |
2212 |
++ |
2213 |
+ static bool bnxt_re_is_vlan_pkt(struct bnxt_qplib_cqe *orig_cqe, |
2214 |
+ u16 *vid, u8 *sl) |
2215 |
+ { |
2216 |
+@@ -3246,9 +3259,11 @@ static void bnxt_re_process_res_shadow_qp_wc(struct bnxt_re_qp *gsi_sqp, |
2217 |
+ wc->src_qp = orig_cqe->src_qp; |
2218 |
+ memcpy(wc->smac, orig_cqe->smac, ETH_ALEN); |
2219 |
+ if (bnxt_re_is_vlan_pkt(orig_cqe, &vlan_id, &sl)) { |
2220 |
+- wc->vlan_id = vlan_id; |
2221 |
+- wc->sl = sl; |
2222 |
+- wc->wc_flags |= IB_WC_WITH_VLAN; |
2223 |
++ if (bnxt_re_check_if_vlan_valid(rdev, vlan_id)) { |
2224 |
++ wc->vlan_id = vlan_id; |
2225 |
++ wc->sl = sl; |
2226 |
++ wc->wc_flags |= IB_WC_WITH_VLAN; |
2227 |
++ } |
2228 |
+ } |
2229 |
+ wc->port_num = 1; |
2230 |
+ wc->vendor_err = orig_cqe->status; |
2231 |
+diff --git a/drivers/infiniband/hw/bnxt_re/main.c b/drivers/infiniband/hw/bnxt_re/main.c |
2232 |
+index 5c41e13496a02..882c4f49d3a87 100644 |
2233 |
+--- a/drivers/infiniband/hw/bnxt_re/main.c |
2234 |
++++ b/drivers/infiniband/hw/bnxt_re/main.c |
2235 |
+@@ -1027,8 +1027,7 @@ static int bnxt_re_alloc_res(struct bnxt_re_dev *rdev) |
2236 |
+ struct bnxt_qplib_nq *nq; |
2237 |
+ |
2238 |
+ nq = &rdev->nq[i]; |
2239 |
+- nq->hwq.max_elements = (qplib_ctx->cq_count + |
2240 |
+- qplib_ctx->srqc_count + 2); |
2241 |
++ nq->hwq.max_elements = BNXT_QPLIB_NQE_MAX_CNT; |
2242 |
+ rc = bnxt_qplib_alloc_nq(&rdev->qplib_res, &rdev->nq[i]); |
2243 |
+ if (rc) { |
2244 |
+ ibdev_err(&rdev->ibdev, "Alloc Failed NQ%d rc:%#x", |
2245 |
+diff --git a/drivers/infiniband/hw/bnxt_re/qplib_fp.c b/drivers/infiniband/hw/bnxt_re/qplib_fp.c |
2246 |
+index c5e29577cd434..4b53f79b91d1d 100644 |
2247 |
+--- a/drivers/infiniband/hw/bnxt_re/qplib_fp.c |
2248 |
++++ b/drivers/infiniband/hw/bnxt_re/qplib_fp.c |
2249 |
+@@ -796,6 +796,7 @@ int bnxt_qplib_create_qp1(struct bnxt_qplib_res *res, struct bnxt_qplib_qp *qp) |
2250 |
+ u16 cmd_flags = 0; |
2251 |
+ u32 qp_flags = 0; |
2252 |
+ u8 pg_sz_lvl; |
2253 |
++ u32 tbl_indx; |
2254 |
+ int rc; |
2255 |
+ |
2256 |
+ RCFW_CMD_PREP(req, CREATE_QP1, cmd_flags); |
2257 |
+@@ -891,8 +892,9 @@ int bnxt_qplib_create_qp1(struct bnxt_qplib_res *res, struct bnxt_qplib_qp *qp) |
2258 |
+ rq->dbinfo.xid = qp->id; |
2259 |
+ rq->dbinfo.db = qp->dpi->dbr; |
2260 |
+ } |
2261 |
+- rcfw->qp_tbl[qp->id].qp_id = qp->id; |
2262 |
+- rcfw->qp_tbl[qp->id].qp_handle = (void *)qp; |
2263 |
++ tbl_indx = map_qp_id_to_tbl_indx(qp->id, rcfw); |
2264 |
++ rcfw->qp_tbl[tbl_indx].qp_id = qp->id; |
2265 |
++ rcfw->qp_tbl[tbl_indx].qp_handle = (void *)qp; |
2266 |
+ |
2267 |
+ return 0; |
2268 |
+ |
2269 |
+@@ -920,10 +922,10 @@ static void bnxt_qplib_init_psn_ptr(struct bnxt_qplib_qp *qp, int size) |
2270 |
+ sq = &qp->sq; |
2271 |
+ hwq = &sq->hwq; |
2272 |
+ |
2273 |
++ /* First psn entry */ |
2274 |
+ fpsne = (u64)bnxt_qplib_get_qe(hwq, hwq->max_elements, &psn_pg); |
2275 |
+ if (!IS_ALIGNED(fpsne, PAGE_SIZE)) |
2276 |
+- indx_pad = ALIGN(fpsne, PAGE_SIZE) / size; |
2277 |
+- |
2278 |
++ indx_pad = (fpsne & ~PAGE_MASK) / size; |
2279 |
+ page = (u64 *)psn_pg; |
2280 |
+ for (indx = 0; indx < hwq->max_elements; indx++) { |
2281 |
+ pg_num = (indx + indx_pad) / (PAGE_SIZE / size); |
2282 |
+@@ -950,6 +952,7 @@ int bnxt_qplib_create_qp(struct bnxt_qplib_res *res, struct bnxt_qplib_qp *qp) |
2283 |
+ u32 qp_flags = 0; |
2284 |
+ u8 pg_sz_lvl; |
2285 |
+ u16 max_rsge; |
2286 |
++ u32 tbl_indx; |
2287 |
+ |
2288 |
+ RCFW_CMD_PREP(req, CREATE_QP, cmd_flags); |
2289 |
+ |
2290 |
+@@ -1118,8 +1121,9 @@ int bnxt_qplib_create_qp(struct bnxt_qplib_res *res, struct bnxt_qplib_qp *qp) |
2291 |
+ rq->dbinfo.xid = qp->id; |
2292 |
+ rq->dbinfo.db = qp->dpi->dbr; |
2293 |
+ } |
2294 |
+- rcfw->qp_tbl[qp->id].qp_id = qp->id; |
2295 |
+- rcfw->qp_tbl[qp->id].qp_handle = (void *)qp; |
2296 |
++ tbl_indx = map_qp_id_to_tbl_indx(qp->id, rcfw); |
2297 |
++ rcfw->qp_tbl[tbl_indx].qp_id = qp->id; |
2298 |
++ rcfw->qp_tbl[tbl_indx].qp_handle = (void *)qp; |
2299 |
+ |
2300 |
+ return 0; |
2301 |
+ |
2302 |
+@@ -1467,10 +1471,12 @@ int bnxt_qplib_destroy_qp(struct bnxt_qplib_res *res, |
2303 |
+ struct cmdq_destroy_qp req; |
2304 |
+ struct creq_destroy_qp_resp resp; |
2305 |
+ u16 cmd_flags = 0; |
2306 |
++ u32 tbl_indx; |
2307 |
+ int rc; |
2308 |
+ |
2309 |
+- rcfw->qp_tbl[qp->id].qp_id = BNXT_QPLIB_QP_ID_INVALID; |
2310 |
+- rcfw->qp_tbl[qp->id].qp_handle = NULL; |
2311 |
++ tbl_indx = map_qp_id_to_tbl_indx(qp->id, rcfw); |
2312 |
++ rcfw->qp_tbl[tbl_indx].qp_id = BNXT_QPLIB_QP_ID_INVALID; |
2313 |
++ rcfw->qp_tbl[tbl_indx].qp_handle = NULL; |
2314 |
+ |
2315 |
+ RCFW_CMD_PREP(req, DESTROY_QP, cmd_flags); |
2316 |
+ |
2317 |
+@@ -1478,8 +1484,8 @@ int bnxt_qplib_destroy_qp(struct bnxt_qplib_res *res, |
2318 |
+ rc = bnxt_qplib_rcfw_send_message(rcfw, (void *)&req, |
2319 |
+ (void *)&resp, NULL, 0); |
2320 |
+ if (rc) { |
2321 |
+- rcfw->qp_tbl[qp->id].qp_id = qp->id; |
2322 |
+- rcfw->qp_tbl[qp->id].qp_handle = qp; |
2323 |
++ rcfw->qp_tbl[tbl_indx].qp_id = qp->id; |
2324 |
++ rcfw->qp_tbl[tbl_indx].qp_handle = qp; |
2325 |
+ return rc; |
2326 |
+ } |
2327 |
+ |
2328 |
+diff --git a/drivers/infiniband/hw/bnxt_re/qplib_rcfw.c b/drivers/infiniband/hw/bnxt_re/qplib_rcfw.c |
2329 |
+index 4e211162acee2..f7736e34ac64c 100644 |
2330 |
+--- a/drivers/infiniband/hw/bnxt_re/qplib_rcfw.c |
2331 |
++++ b/drivers/infiniband/hw/bnxt_re/qplib_rcfw.c |
2332 |
+@@ -307,14 +307,15 @@ static int bnxt_qplib_process_qp_event(struct bnxt_qplib_rcfw *rcfw, |
2333 |
+ __le16 mcookie; |
2334 |
+ u16 cookie; |
2335 |
+ int rc = 0; |
2336 |
+- u32 qp_id; |
2337 |
++ u32 qp_id, tbl_indx; |
2338 |
+ |
2339 |
+ pdev = rcfw->pdev; |
2340 |
+ switch (qp_event->event) { |
2341 |
+ case CREQ_QP_EVENT_EVENT_QP_ERROR_NOTIFICATION: |
2342 |
+ err_event = (struct creq_qp_error_notification *)qp_event; |
2343 |
+ qp_id = le32_to_cpu(err_event->xid); |
2344 |
+- qp = rcfw->qp_tbl[qp_id].qp_handle; |
2345 |
++ tbl_indx = map_qp_id_to_tbl_indx(qp_id, rcfw); |
2346 |
++ qp = rcfw->qp_tbl[tbl_indx].qp_handle; |
2347 |
+ dev_dbg(&pdev->dev, "Received QP error notification\n"); |
2348 |
+ dev_dbg(&pdev->dev, |
2349 |
+ "qpid 0x%x, req_err=0x%x, resp_err=0x%x\n", |
2350 |
+@@ -615,8 +616,9 @@ int bnxt_qplib_alloc_rcfw_channel(struct bnxt_qplib_res *res, |
2351 |
+ |
2352 |
+ cmdq->bmap_size = bmap_size; |
2353 |
+ |
2354 |
+- rcfw->qp_tbl_size = qp_tbl_sz; |
2355 |
+- rcfw->qp_tbl = kcalloc(qp_tbl_sz, sizeof(struct bnxt_qplib_qp_node), |
2356 |
++ /* Allocate one extra to hold the QP1 entries */ |
2357 |
++ rcfw->qp_tbl_size = qp_tbl_sz + 1; |
2358 |
++ rcfw->qp_tbl = kcalloc(rcfw->qp_tbl_size, sizeof(struct bnxt_qplib_qp_node), |
2359 |
+ GFP_KERNEL); |
2360 |
+ if (!rcfw->qp_tbl) |
2361 |
+ goto fail; |
2362 |
+diff --git a/drivers/infiniband/hw/bnxt_re/qplib_rcfw.h b/drivers/infiniband/hw/bnxt_re/qplib_rcfw.h |
2363 |
+index 157387636d004..5f2f0a5a3560f 100644 |
2364 |
+--- a/drivers/infiniband/hw/bnxt_re/qplib_rcfw.h |
2365 |
++++ b/drivers/infiniband/hw/bnxt_re/qplib_rcfw.h |
2366 |
+@@ -216,4 +216,9 @@ int bnxt_qplib_deinit_rcfw(struct bnxt_qplib_rcfw *rcfw); |
2367 |
+ int bnxt_qplib_init_rcfw(struct bnxt_qplib_rcfw *rcfw, |
2368 |
+ struct bnxt_qplib_ctx *ctx, int is_virtfn); |
2369 |
+ void bnxt_qplib_mark_qp_error(void *qp_handle); |
2370 |
++static inline u32 map_qp_id_to_tbl_indx(u32 qid, struct bnxt_qplib_rcfw *rcfw) |
2371 |
++{ |
2372 |
++ /* Last index of the qp_tbl is for QP1 ie. qp_tbl_size - 1*/ |
2373 |
++ return (qid == 1) ? rcfw->qp_tbl_size - 1 : qid % rcfw->qp_tbl_size - 2; |
2374 |
++} |
2375 |
+ #endif /* __BNXT_QPLIB_RCFW_H__ */ |
2376 |
+diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c |
2377 |
+index 816d28854a8e1..5bcf481a9c3c2 100644 |
2378 |
+--- a/drivers/infiniband/hw/mlx4/main.c |
2379 |
++++ b/drivers/infiniband/hw/mlx4/main.c |
2380 |
+@@ -784,7 +784,8 @@ static int eth_link_query_port(struct ib_device *ibdev, u8 port, |
2381 |
+ props->ip_gids = true; |
2382 |
+ props->gid_tbl_len = mdev->dev->caps.gid_table_len[port]; |
2383 |
+ props->max_msg_sz = mdev->dev->caps.max_msg_sz; |
2384 |
+- props->pkey_tbl_len = 1; |
2385 |
++ if (mdev->dev->caps.pkey_table_len[port]) |
2386 |
++ props->pkey_tbl_len = 1; |
2387 |
+ props->max_mtu = IB_MTU_4096; |
2388 |
+ props->max_vl_num = 2; |
2389 |
+ props->state = IB_PORT_DOWN; |
2390 |
+diff --git a/drivers/infiniband/sw/rxe/rxe.c b/drivers/infiniband/sw/rxe/rxe.c |
2391 |
+index 5642eefb4ba1c..d6b1236b114ab 100644 |
2392 |
+--- a/drivers/infiniband/sw/rxe/rxe.c |
2393 |
++++ b/drivers/infiniband/sw/rxe/rxe.c |
2394 |
+@@ -48,6 +48,8 @@ static void rxe_cleanup_ports(struct rxe_dev *rxe) |
2395 |
+ |
2396 |
+ } |
2397 |
+ |
2398 |
++bool rxe_initialized; |
2399 |
++ |
2400 |
+ /* free resources for a rxe device all objects created for this device must |
2401 |
+ * have been destroyed |
2402 |
+ */ |
2403 |
+@@ -147,9 +149,6 @@ static int rxe_init_ports(struct rxe_dev *rxe) |
2404 |
+ |
2405 |
+ rxe_init_port_param(port); |
2406 |
+ |
2407 |
+- if (!port->attr.pkey_tbl_len || !port->attr.gid_tbl_len) |
2408 |
+- return -EINVAL; |
2409 |
+- |
2410 |
+ port->pkey_tbl = kcalloc(port->attr.pkey_tbl_len, |
2411 |
+ sizeof(*port->pkey_tbl), GFP_KERNEL); |
2412 |
+ |
2413 |
+@@ -348,6 +347,7 @@ static int __init rxe_module_init(void) |
2414 |
+ return err; |
2415 |
+ |
2416 |
+ rdma_link_register(&rxe_link_ops); |
2417 |
++ rxe_initialized = true; |
2418 |
+ pr_info("loaded\n"); |
2419 |
+ return 0; |
2420 |
+ } |
2421 |
+@@ -359,6 +359,7 @@ static void __exit rxe_module_exit(void) |
2422 |
+ rxe_net_exit(); |
2423 |
+ rxe_cache_exit(); |
2424 |
+ |
2425 |
++ rxe_initialized = false; |
2426 |
+ pr_info("unloaded\n"); |
2427 |
+ } |
2428 |
+ |
2429 |
+diff --git a/drivers/infiniband/sw/rxe/rxe.h b/drivers/infiniband/sw/rxe/rxe.h |
2430 |
+index fb07eed9e4028..cae1b0a24c850 100644 |
2431 |
+--- a/drivers/infiniband/sw/rxe/rxe.h |
2432 |
++++ b/drivers/infiniband/sw/rxe/rxe.h |
2433 |
+@@ -67,6 +67,8 @@ |
2434 |
+ |
2435 |
+ #define RXE_ROCE_V2_SPORT (0xc000) |
2436 |
+ |
2437 |
++extern bool rxe_initialized; |
2438 |
++ |
2439 |
+ static inline u32 rxe_crc32(struct rxe_dev *rxe, |
2440 |
+ u32 crc, void *next, size_t len) |
2441 |
+ { |
2442 |
+diff --git a/drivers/infiniband/sw/rxe/rxe_mr.c b/drivers/infiniband/sw/rxe/rxe_mr.c |
2443 |
+index e83c7b518bfa2..bfb96a0d071bb 100644 |
2444 |
+--- a/drivers/infiniband/sw/rxe/rxe_mr.c |
2445 |
++++ b/drivers/infiniband/sw/rxe/rxe_mr.c |
2446 |
+@@ -207,6 +207,7 @@ int rxe_mem_init_user(struct rxe_pd *pd, u64 start, |
2447 |
+ vaddr = page_address(sg_page_iter_page(&sg_iter)); |
2448 |
+ if (!vaddr) { |
2449 |
+ pr_warn("null vaddr\n"); |
2450 |
++ ib_umem_release(umem); |
2451 |
+ err = -ENOMEM; |
2452 |
+ goto err1; |
2453 |
+ } |
2454 |
+diff --git a/drivers/infiniband/sw/rxe/rxe_sysfs.c b/drivers/infiniband/sw/rxe/rxe_sysfs.c |
2455 |
+index ccda5f5a3bc0a..2af31d421bfc3 100644 |
2456 |
+--- a/drivers/infiniband/sw/rxe/rxe_sysfs.c |
2457 |
++++ b/drivers/infiniband/sw/rxe/rxe_sysfs.c |
2458 |
+@@ -61,6 +61,11 @@ static int rxe_param_set_add(const char *val, const struct kernel_param *kp) |
2459 |
+ struct net_device *ndev; |
2460 |
+ struct rxe_dev *exists; |
2461 |
+ |
2462 |
++ if (!rxe_initialized) { |
2463 |
++ pr_err("Module parameters are not supported, use rdma link add or rxe_cfg\n"); |
2464 |
++ return -EAGAIN; |
2465 |
++ } |
2466 |
++ |
2467 |
+ len = sanitize_arg(val, intf, sizeof(intf)); |
2468 |
+ if (!len) { |
2469 |
+ pr_err("add: invalid interface name\n"); |
2470 |
+diff --git a/drivers/infiniband/sw/rxe/rxe_verbs.c b/drivers/infiniband/sw/rxe/rxe_verbs.c |
2471 |
+index 84fec5fd798d5..00ba6fb1e6763 100644 |
2472 |
+--- a/drivers/infiniband/sw/rxe/rxe_verbs.c |
2473 |
++++ b/drivers/infiniband/sw/rxe/rxe_verbs.c |
2474 |
+@@ -1083,7 +1083,7 @@ static ssize_t parent_show(struct device *device, |
2475 |
+ struct rxe_dev *rxe = |
2476 |
+ rdma_device_to_drv_device(device, struct rxe_dev, ib_dev); |
2477 |
+ |
2478 |
+- return snprintf(buf, 16, "%s\n", rxe_parent_name(rxe, 1)); |
2479 |
++ return scnprintf(buf, PAGE_SIZE, "%s\n", rxe_parent_name(rxe, 1)); |
2480 |
+ } |
2481 |
+ |
2482 |
+ static DEVICE_ATTR_RO(parent); |
2483 |
+diff --git a/drivers/infiniband/ulp/isert/ib_isert.c b/drivers/infiniband/ulp/isert/ib_isert.c |
2484 |
+index b7df38ee8ae05..49ca8727e3fa3 100644 |
2485 |
+--- a/drivers/infiniband/ulp/isert/ib_isert.c |
2486 |
++++ b/drivers/infiniband/ulp/isert/ib_isert.c |
2487 |
+@@ -183,15 +183,15 @@ isert_alloc_rx_descriptors(struct isert_conn *isert_conn) |
2488 |
+ rx_desc = isert_conn->rx_descs; |
2489 |
+ |
2490 |
+ for (i = 0; i < ISERT_QP_MAX_RECV_DTOS; i++, rx_desc++) { |
2491 |
+- dma_addr = ib_dma_map_single(ib_dev, (void *)rx_desc, |
2492 |
+- ISER_RX_PAYLOAD_SIZE, DMA_FROM_DEVICE); |
2493 |
++ dma_addr = ib_dma_map_single(ib_dev, rx_desc->buf, |
2494 |
++ ISER_RX_SIZE, DMA_FROM_DEVICE); |
2495 |
+ if (ib_dma_mapping_error(ib_dev, dma_addr)) |
2496 |
+ goto dma_map_fail; |
2497 |
+ |
2498 |
+ rx_desc->dma_addr = dma_addr; |
2499 |
+ |
2500 |
+ rx_sg = &rx_desc->rx_sg; |
2501 |
+- rx_sg->addr = rx_desc->dma_addr; |
2502 |
++ rx_sg->addr = rx_desc->dma_addr + isert_get_hdr_offset(rx_desc); |
2503 |
+ rx_sg->length = ISER_RX_PAYLOAD_SIZE; |
2504 |
+ rx_sg->lkey = device->pd->local_dma_lkey; |
2505 |
+ rx_desc->rx_cqe.done = isert_recv_done; |
2506 |
+@@ -203,7 +203,7 @@ dma_map_fail: |
2507 |
+ rx_desc = isert_conn->rx_descs; |
2508 |
+ for (j = 0; j < i; j++, rx_desc++) { |
2509 |
+ ib_dma_unmap_single(ib_dev, rx_desc->dma_addr, |
2510 |
+- ISER_RX_PAYLOAD_SIZE, DMA_FROM_DEVICE); |
2511 |
++ ISER_RX_SIZE, DMA_FROM_DEVICE); |
2512 |
+ } |
2513 |
+ kfree(isert_conn->rx_descs); |
2514 |
+ isert_conn->rx_descs = NULL; |
2515 |
+@@ -224,7 +224,7 @@ isert_free_rx_descriptors(struct isert_conn *isert_conn) |
2516 |
+ rx_desc = isert_conn->rx_descs; |
2517 |
+ for (i = 0; i < ISERT_QP_MAX_RECV_DTOS; i++, rx_desc++) { |
2518 |
+ ib_dma_unmap_single(ib_dev, rx_desc->dma_addr, |
2519 |
+- ISER_RX_PAYLOAD_SIZE, DMA_FROM_DEVICE); |
2520 |
++ ISER_RX_SIZE, DMA_FROM_DEVICE); |
2521 |
+ } |
2522 |
+ |
2523 |
+ kfree(isert_conn->rx_descs); |
2524 |
+@@ -409,10 +409,9 @@ isert_free_login_buf(struct isert_conn *isert_conn) |
2525 |
+ ISER_RX_PAYLOAD_SIZE, DMA_TO_DEVICE); |
2526 |
+ kfree(isert_conn->login_rsp_buf); |
2527 |
+ |
2528 |
+- ib_dma_unmap_single(ib_dev, isert_conn->login_req_dma, |
2529 |
+- ISER_RX_PAYLOAD_SIZE, |
2530 |
+- DMA_FROM_DEVICE); |
2531 |
+- kfree(isert_conn->login_req_buf); |
2532 |
++ ib_dma_unmap_single(ib_dev, isert_conn->login_desc->dma_addr, |
2533 |
++ ISER_RX_SIZE, DMA_FROM_DEVICE); |
2534 |
++ kfree(isert_conn->login_desc); |
2535 |
+ } |
2536 |
+ |
2537 |
+ static int |
2538 |
+@@ -421,25 +420,25 @@ isert_alloc_login_buf(struct isert_conn *isert_conn, |
2539 |
+ { |
2540 |
+ int ret; |
2541 |
+ |
2542 |
+- isert_conn->login_req_buf = kzalloc(sizeof(*isert_conn->login_req_buf), |
2543 |
++ isert_conn->login_desc = kzalloc(sizeof(*isert_conn->login_desc), |
2544 |
+ GFP_KERNEL); |
2545 |
+- if (!isert_conn->login_req_buf) |
2546 |
++ if (!isert_conn->login_desc) |
2547 |
+ return -ENOMEM; |
2548 |
+ |
2549 |
+- isert_conn->login_req_dma = ib_dma_map_single(ib_dev, |
2550 |
+- isert_conn->login_req_buf, |
2551 |
+- ISER_RX_PAYLOAD_SIZE, DMA_FROM_DEVICE); |
2552 |
+- ret = ib_dma_mapping_error(ib_dev, isert_conn->login_req_dma); |
2553 |
++ isert_conn->login_desc->dma_addr = ib_dma_map_single(ib_dev, |
2554 |
++ isert_conn->login_desc->buf, |
2555 |
++ ISER_RX_SIZE, DMA_FROM_DEVICE); |
2556 |
++ ret = ib_dma_mapping_error(ib_dev, isert_conn->login_desc->dma_addr); |
2557 |
+ if (ret) { |
2558 |
+- isert_err("login_req_dma mapping error: %d\n", ret); |
2559 |
+- isert_conn->login_req_dma = 0; |
2560 |
+- goto out_free_login_req_buf; |
2561 |
++ isert_err("login_desc dma mapping error: %d\n", ret); |
2562 |
++ isert_conn->login_desc->dma_addr = 0; |
2563 |
++ goto out_free_login_desc; |
2564 |
+ } |
2565 |
+ |
2566 |
+ isert_conn->login_rsp_buf = kzalloc(ISER_RX_PAYLOAD_SIZE, GFP_KERNEL); |
2567 |
+ if (!isert_conn->login_rsp_buf) { |
2568 |
+ ret = -ENOMEM; |
2569 |
+- goto out_unmap_login_req_buf; |
2570 |
++ goto out_unmap_login_desc; |
2571 |
+ } |
2572 |
+ |
2573 |
+ isert_conn->login_rsp_dma = ib_dma_map_single(ib_dev, |
2574 |
+@@ -456,11 +455,11 @@ isert_alloc_login_buf(struct isert_conn *isert_conn, |
2575 |
+ |
2576 |
+ out_free_login_rsp_buf: |
2577 |
+ kfree(isert_conn->login_rsp_buf); |
2578 |
+-out_unmap_login_req_buf: |
2579 |
+- ib_dma_unmap_single(ib_dev, isert_conn->login_req_dma, |
2580 |
+- ISER_RX_PAYLOAD_SIZE, DMA_FROM_DEVICE); |
2581 |
+-out_free_login_req_buf: |
2582 |
+- kfree(isert_conn->login_req_buf); |
2583 |
++out_unmap_login_desc: |
2584 |
++ ib_dma_unmap_single(ib_dev, isert_conn->login_desc->dma_addr, |
2585 |
++ ISER_RX_SIZE, DMA_FROM_DEVICE); |
2586 |
++out_free_login_desc: |
2587 |
++ kfree(isert_conn->login_desc); |
2588 |
+ return ret; |
2589 |
+ } |
2590 |
+ |
2591 |
+@@ -579,7 +578,7 @@ isert_connect_release(struct isert_conn *isert_conn) |
2592 |
+ ib_destroy_qp(isert_conn->qp); |
2593 |
+ } |
2594 |
+ |
2595 |
+- if (isert_conn->login_req_buf) |
2596 |
++ if (isert_conn->login_desc) |
2597 |
+ isert_free_login_buf(isert_conn); |
2598 |
+ |
2599 |
+ isert_device_put(device); |
2600 |
+@@ -965,17 +964,18 @@ isert_login_post_recv(struct isert_conn *isert_conn) |
2601 |
+ int ret; |
2602 |
+ |
2603 |
+ memset(&sge, 0, sizeof(struct ib_sge)); |
2604 |
+- sge.addr = isert_conn->login_req_dma; |
2605 |
++ sge.addr = isert_conn->login_desc->dma_addr + |
2606 |
++ isert_get_hdr_offset(isert_conn->login_desc); |
2607 |
+ sge.length = ISER_RX_PAYLOAD_SIZE; |
2608 |
+ sge.lkey = isert_conn->device->pd->local_dma_lkey; |
2609 |
+ |
2610 |
+ isert_dbg("Setup sge: addr: %llx length: %d 0x%08x\n", |
2611 |
+ sge.addr, sge.length, sge.lkey); |
2612 |
+ |
2613 |
+- isert_conn->login_req_buf->rx_cqe.done = isert_login_recv_done; |
2614 |
++ isert_conn->login_desc->rx_cqe.done = isert_login_recv_done; |
2615 |
+ |
2616 |
+ memset(&rx_wr, 0, sizeof(struct ib_recv_wr)); |
2617 |
+- rx_wr.wr_cqe = &isert_conn->login_req_buf->rx_cqe; |
2618 |
++ rx_wr.wr_cqe = &isert_conn->login_desc->rx_cqe; |
2619 |
+ rx_wr.sg_list = &sge; |
2620 |
+ rx_wr.num_sge = 1; |
2621 |
+ |
2622 |
+@@ -1052,7 +1052,7 @@ post_send: |
2623 |
+ static void |
2624 |
+ isert_rx_login_req(struct isert_conn *isert_conn) |
2625 |
+ { |
2626 |
+- struct iser_rx_desc *rx_desc = isert_conn->login_req_buf; |
2627 |
++ struct iser_rx_desc *rx_desc = isert_conn->login_desc; |
2628 |
+ int rx_buflen = isert_conn->login_req_len; |
2629 |
+ struct iscsi_conn *conn = isert_conn->conn; |
2630 |
+ struct iscsi_login *login = conn->conn_login; |
2631 |
+@@ -1064,7 +1064,7 @@ isert_rx_login_req(struct isert_conn *isert_conn) |
2632 |
+ |
2633 |
+ if (login->first_request) { |
2634 |
+ struct iscsi_login_req *login_req = |
2635 |
+- (struct iscsi_login_req *)&rx_desc->iscsi_header; |
2636 |
++ (struct iscsi_login_req *)isert_get_iscsi_hdr(rx_desc); |
2637 |
+ /* |
2638 |
+ * Setup the initial iscsi_login values from the leading |
2639 |
+ * login request PDU. |
2640 |
+@@ -1083,13 +1083,13 @@ isert_rx_login_req(struct isert_conn *isert_conn) |
2641 |
+ login->tsih = be16_to_cpu(login_req->tsih); |
2642 |
+ } |
2643 |
+ |
2644 |
+- memcpy(&login->req[0], (void *)&rx_desc->iscsi_header, ISCSI_HDR_LEN); |
2645 |
++ memcpy(&login->req[0], isert_get_iscsi_hdr(rx_desc), ISCSI_HDR_LEN); |
2646 |
+ |
2647 |
+ size = min(rx_buflen, MAX_KEY_VALUE_PAIRS); |
2648 |
+ isert_dbg("Using login payload size: %d, rx_buflen: %d " |
2649 |
+ "MAX_KEY_VALUE_PAIRS: %d\n", size, rx_buflen, |
2650 |
+ MAX_KEY_VALUE_PAIRS); |
2651 |
+- memcpy(login->req_buf, &rx_desc->data[0], size); |
2652 |
++ memcpy(login->req_buf, isert_get_data(rx_desc), size); |
2653 |
+ |
2654 |
+ if (login->first_request) { |
2655 |
+ complete(&isert_conn->login_comp); |
2656 |
+@@ -1154,14 +1154,15 @@ isert_handle_scsi_cmd(struct isert_conn *isert_conn, |
2657 |
+ if (imm_data_len != data_len) { |
2658 |
+ sg_nents = max(1UL, DIV_ROUND_UP(imm_data_len, PAGE_SIZE)); |
2659 |
+ sg_copy_from_buffer(cmd->se_cmd.t_data_sg, sg_nents, |
2660 |
+- &rx_desc->data[0], imm_data_len); |
2661 |
++ isert_get_data(rx_desc), imm_data_len); |
2662 |
+ isert_dbg("Copy Immediate sg_nents: %u imm_data_len: %d\n", |
2663 |
+ sg_nents, imm_data_len); |
2664 |
+ } else { |
2665 |
+ sg_init_table(&isert_cmd->sg, 1); |
2666 |
+ cmd->se_cmd.t_data_sg = &isert_cmd->sg; |
2667 |
+ cmd->se_cmd.t_data_nents = 1; |
2668 |
+- sg_set_buf(&isert_cmd->sg, &rx_desc->data[0], imm_data_len); |
2669 |
++ sg_set_buf(&isert_cmd->sg, isert_get_data(rx_desc), |
2670 |
++ imm_data_len); |
2671 |
+ isert_dbg("Transfer Immediate imm_data_len: %d\n", |
2672 |
+ imm_data_len); |
2673 |
+ } |
2674 |
+@@ -1230,9 +1231,9 @@ isert_handle_iscsi_dataout(struct isert_conn *isert_conn, |
2675 |
+ } |
2676 |
+ isert_dbg("Copying DataOut: sg_start: %p, sg_off: %u " |
2677 |
+ "sg_nents: %u from %p %u\n", sg_start, sg_off, |
2678 |
+- sg_nents, &rx_desc->data[0], unsol_data_len); |
2679 |
++ sg_nents, isert_get_data(rx_desc), unsol_data_len); |
2680 |
+ |
2681 |
+- sg_copy_from_buffer(sg_start, sg_nents, &rx_desc->data[0], |
2682 |
++ sg_copy_from_buffer(sg_start, sg_nents, isert_get_data(rx_desc), |
2683 |
+ unsol_data_len); |
2684 |
+ |
2685 |
+ rc = iscsit_check_dataout_payload(cmd, hdr, false); |
2686 |
+@@ -1291,7 +1292,7 @@ isert_handle_text_cmd(struct isert_conn *isert_conn, struct isert_cmd *isert_cmd |
2687 |
+ } |
2688 |
+ cmd->text_in_ptr = text_in; |
2689 |
+ |
2690 |
+- memcpy(cmd->text_in_ptr, &rx_desc->data[0], payload_length); |
2691 |
++ memcpy(cmd->text_in_ptr, isert_get_data(rx_desc), payload_length); |
2692 |
+ |
2693 |
+ return iscsit_process_text_cmd(conn, cmd, hdr); |
2694 |
+ } |
2695 |
+@@ -1301,7 +1302,7 @@ isert_rx_opcode(struct isert_conn *isert_conn, struct iser_rx_desc *rx_desc, |
2696 |
+ uint32_t read_stag, uint64_t read_va, |
2697 |
+ uint32_t write_stag, uint64_t write_va) |
2698 |
+ { |
2699 |
+- struct iscsi_hdr *hdr = &rx_desc->iscsi_header; |
2700 |
++ struct iscsi_hdr *hdr = isert_get_iscsi_hdr(rx_desc); |
2701 |
+ struct iscsi_conn *conn = isert_conn->conn; |
2702 |
+ struct iscsi_cmd *cmd; |
2703 |
+ struct isert_cmd *isert_cmd; |
2704 |
+@@ -1399,8 +1400,8 @@ isert_recv_done(struct ib_cq *cq, struct ib_wc *wc) |
2705 |
+ struct isert_conn *isert_conn = wc->qp->qp_context; |
2706 |
+ struct ib_device *ib_dev = isert_conn->cm_id->device; |
2707 |
+ struct iser_rx_desc *rx_desc = cqe_to_rx_desc(wc->wr_cqe); |
2708 |
+- struct iscsi_hdr *hdr = &rx_desc->iscsi_header; |
2709 |
+- struct iser_ctrl *iser_ctrl = &rx_desc->iser_header; |
2710 |
++ struct iscsi_hdr *hdr = isert_get_iscsi_hdr(rx_desc); |
2711 |
++ struct iser_ctrl *iser_ctrl = isert_get_iser_hdr(rx_desc); |
2712 |
+ uint64_t read_va = 0, write_va = 0; |
2713 |
+ uint32_t read_stag = 0, write_stag = 0; |
2714 |
+ |
2715 |
+@@ -1414,7 +1415,7 @@ isert_recv_done(struct ib_cq *cq, struct ib_wc *wc) |
2716 |
+ rx_desc->in_use = true; |
2717 |
+ |
2718 |
+ ib_dma_sync_single_for_cpu(ib_dev, rx_desc->dma_addr, |
2719 |
+- ISER_RX_PAYLOAD_SIZE, DMA_FROM_DEVICE); |
2720 |
++ ISER_RX_SIZE, DMA_FROM_DEVICE); |
2721 |
+ |
2722 |
+ isert_dbg("DMA: 0x%llx, iSCSI opcode: 0x%02x, ITT: 0x%08x, flags: 0x%02x dlen: %d\n", |
2723 |
+ rx_desc->dma_addr, hdr->opcode, hdr->itt, hdr->flags, |
2724 |
+@@ -1449,7 +1450,7 @@ isert_recv_done(struct ib_cq *cq, struct ib_wc *wc) |
2725 |
+ read_stag, read_va, write_stag, write_va); |
2726 |
+ |
2727 |
+ ib_dma_sync_single_for_device(ib_dev, rx_desc->dma_addr, |
2728 |
+- ISER_RX_PAYLOAD_SIZE, DMA_FROM_DEVICE); |
2729 |
++ ISER_RX_SIZE, DMA_FROM_DEVICE); |
2730 |
+ } |
2731 |
+ |
2732 |
+ static void |
2733 |
+@@ -1463,8 +1464,8 @@ isert_login_recv_done(struct ib_cq *cq, struct ib_wc *wc) |
2734 |
+ return; |
2735 |
+ } |
2736 |
+ |
2737 |
+- ib_dma_sync_single_for_cpu(ib_dev, isert_conn->login_req_dma, |
2738 |
+- ISER_RX_PAYLOAD_SIZE, DMA_FROM_DEVICE); |
2739 |
++ ib_dma_sync_single_for_cpu(ib_dev, isert_conn->login_desc->dma_addr, |
2740 |
++ ISER_RX_SIZE, DMA_FROM_DEVICE); |
2741 |
+ |
2742 |
+ isert_conn->login_req_len = wc->byte_len - ISER_HEADERS_LEN; |
2743 |
+ |
2744 |
+@@ -1479,8 +1480,8 @@ isert_login_recv_done(struct ib_cq *cq, struct ib_wc *wc) |
2745 |
+ complete(&isert_conn->login_req_comp); |
2746 |
+ mutex_unlock(&isert_conn->mutex); |
2747 |
+ |
2748 |
+- ib_dma_sync_single_for_device(ib_dev, isert_conn->login_req_dma, |
2749 |
+- ISER_RX_PAYLOAD_SIZE, DMA_FROM_DEVICE); |
2750 |
++ ib_dma_sync_single_for_device(ib_dev, isert_conn->login_desc->dma_addr, |
2751 |
++ ISER_RX_SIZE, DMA_FROM_DEVICE); |
2752 |
+ } |
2753 |
+ |
2754 |
+ static void |
2755 |
+diff --git a/drivers/infiniband/ulp/isert/ib_isert.h b/drivers/infiniband/ulp/isert/ib_isert.h |
2756 |
+index 3b296bac4f603..d267a6d60d87d 100644 |
2757 |
+--- a/drivers/infiniband/ulp/isert/ib_isert.h |
2758 |
++++ b/drivers/infiniband/ulp/isert/ib_isert.h |
2759 |
+@@ -59,9 +59,11 @@ |
2760 |
+ ISERT_MAX_TX_MISC_PDUS + \ |
2761 |
+ ISERT_MAX_RX_MISC_PDUS) |
2762 |
+ |
2763 |
+-#define ISER_RX_PAD_SIZE (ISCSI_DEF_MAX_RECV_SEG_LEN + 4096 - \ |
2764 |
+- (ISER_RX_PAYLOAD_SIZE + sizeof(u64) + sizeof(struct ib_sge) + \ |
2765 |
+- sizeof(struct ib_cqe) + sizeof(bool))) |
2766 |
++/* |
2767 |
++ * RX size is default of 8k plus headers, but data needs to align to |
2768 |
++ * 512 boundary, so use 1024 to have the extra space for alignment. |
2769 |
++ */ |
2770 |
++#define ISER_RX_SIZE (ISCSI_DEF_MAX_RECV_SEG_LEN + 1024) |
2771 |
+ |
2772 |
+ #define ISCSI_ISER_SG_TABLESIZE 256 |
2773 |
+ |
2774 |
+@@ -80,21 +82,41 @@ enum iser_conn_state { |
2775 |
+ }; |
2776 |
+ |
2777 |
+ struct iser_rx_desc { |
2778 |
+- struct iser_ctrl iser_header; |
2779 |
+- struct iscsi_hdr iscsi_header; |
2780 |
+- char data[ISCSI_DEF_MAX_RECV_SEG_LEN]; |
2781 |
++ char buf[ISER_RX_SIZE]; |
2782 |
+ u64 dma_addr; |
2783 |
+ struct ib_sge rx_sg; |
2784 |
+ struct ib_cqe rx_cqe; |
2785 |
+ bool in_use; |
2786 |
+- char pad[ISER_RX_PAD_SIZE]; |
2787 |
+-} __packed; |
2788 |
++}; |
2789 |
+ |
2790 |
+ static inline struct iser_rx_desc *cqe_to_rx_desc(struct ib_cqe *cqe) |
2791 |
+ { |
2792 |
+ return container_of(cqe, struct iser_rx_desc, rx_cqe); |
2793 |
+ } |
2794 |
+ |
2795 |
++static void *isert_get_iser_hdr(struct iser_rx_desc *desc) |
2796 |
++{ |
2797 |
++ return PTR_ALIGN(desc->buf + ISER_HEADERS_LEN, 512) - ISER_HEADERS_LEN; |
2798 |
++} |
2799 |
++ |
2800 |
++static size_t isert_get_hdr_offset(struct iser_rx_desc *desc) |
2801 |
++{ |
2802 |
++ return isert_get_iser_hdr(desc) - (void *)desc->buf; |
2803 |
++} |
2804 |
++ |
2805 |
++static void *isert_get_iscsi_hdr(struct iser_rx_desc *desc) |
2806 |
++{ |
2807 |
++ return isert_get_iser_hdr(desc) + sizeof(struct iser_ctrl); |
2808 |
++} |
2809 |
++ |
2810 |
++static void *isert_get_data(struct iser_rx_desc *desc) |
2811 |
++{ |
2812 |
++ void *data = isert_get_iser_hdr(desc) + ISER_HEADERS_LEN; |
2813 |
++ |
2814 |
++ WARN_ON((uintptr_t)data & 511); |
2815 |
++ return data; |
2816 |
++} |
2817 |
++ |
2818 |
+ struct iser_tx_desc { |
2819 |
+ struct iser_ctrl iser_header; |
2820 |
+ struct iscsi_hdr iscsi_header; |
2821 |
+@@ -141,9 +163,8 @@ struct isert_conn { |
2822 |
+ u32 responder_resources; |
2823 |
+ u32 initiator_depth; |
2824 |
+ bool pi_support; |
2825 |
+- struct iser_rx_desc *login_req_buf; |
2826 |
++ struct iser_rx_desc *login_desc; |
2827 |
+ char *login_rsp_buf; |
2828 |
+- u64 login_req_dma; |
2829 |
+ int login_req_len; |
2830 |
+ u64 login_rsp_dma; |
2831 |
+ struct iser_rx_desc *rx_descs; |
2832 |
+diff --git a/drivers/infiniband/ulp/rtrs/rtrs-srv-sysfs.c b/drivers/infiniband/ulp/rtrs/rtrs-srv-sysfs.c |
2833 |
+index 3d7877534bcc9..cf6a2be61695d 100644 |
2834 |
+--- a/drivers/infiniband/ulp/rtrs/rtrs-srv-sysfs.c |
2835 |
++++ b/drivers/infiniband/ulp/rtrs/rtrs-srv-sysfs.c |
2836 |
+@@ -152,13 +152,6 @@ static struct attribute_group rtrs_srv_stats_attr_group = { |
2837 |
+ .attrs = rtrs_srv_stats_attrs, |
2838 |
+ }; |
2839 |
+ |
2840 |
+-static void rtrs_srv_dev_release(struct device *dev) |
2841 |
+-{ |
2842 |
+- struct rtrs_srv *srv = container_of(dev, struct rtrs_srv, dev); |
2843 |
+- |
2844 |
+- kfree(srv); |
2845 |
+-} |
2846 |
+- |
2847 |
+ static int rtrs_srv_create_once_sysfs_root_folders(struct rtrs_srv_sess *sess) |
2848 |
+ { |
2849 |
+ struct rtrs_srv *srv = sess->srv; |
2850 |
+@@ -172,7 +165,6 @@ static int rtrs_srv_create_once_sysfs_root_folders(struct rtrs_srv_sess *sess) |
2851 |
+ goto unlock; |
2852 |
+ } |
2853 |
+ srv->dev.class = rtrs_dev_class; |
2854 |
+- srv->dev.release = rtrs_srv_dev_release; |
2855 |
+ err = dev_set_name(&srv->dev, "%s", sess->s.sessname); |
2856 |
+ if (err) |
2857 |
+ goto unlock; |
2858 |
+@@ -182,16 +174,16 @@ static int rtrs_srv_create_once_sysfs_root_folders(struct rtrs_srv_sess *sess) |
2859 |
+ * sysfs files are created |
2860 |
+ */ |
2861 |
+ dev_set_uevent_suppress(&srv->dev, true); |
2862 |
+- err = device_register(&srv->dev); |
2863 |
++ err = device_add(&srv->dev); |
2864 |
+ if (err) { |
2865 |
+- pr_err("device_register(): %d\n", err); |
2866 |
++ pr_err("device_add(): %d\n", err); |
2867 |
+ goto put; |
2868 |
+ } |
2869 |
+ srv->kobj_paths = kobject_create_and_add("paths", &srv->dev.kobj); |
2870 |
+ if (!srv->kobj_paths) { |
2871 |
+ err = -ENOMEM; |
2872 |
+ pr_err("kobject_create_and_add(): %d\n", err); |
2873 |
+- device_unregister(&srv->dev); |
2874 |
++ device_del(&srv->dev); |
2875 |
+ goto unlock; |
2876 |
+ } |
2877 |
+ dev_set_uevent_suppress(&srv->dev, false); |
2878 |
+@@ -216,7 +208,7 @@ rtrs_srv_destroy_once_sysfs_root_folders(struct rtrs_srv_sess *sess) |
2879 |
+ kobject_del(srv->kobj_paths); |
2880 |
+ kobject_put(srv->kobj_paths); |
2881 |
+ mutex_unlock(&srv->paths_mutex); |
2882 |
+- device_unregister(&srv->dev); |
2883 |
++ device_del(&srv->dev); |
2884 |
+ } else { |
2885 |
+ mutex_unlock(&srv->paths_mutex); |
2886 |
+ } |
2887 |
+diff --git a/drivers/infiniband/ulp/rtrs/rtrs-srv.c b/drivers/infiniband/ulp/rtrs/rtrs-srv.c |
2888 |
+index a219bd1bdbc26..28f6414dfa3dc 100644 |
2889 |
+--- a/drivers/infiniband/ulp/rtrs/rtrs-srv.c |
2890 |
++++ b/drivers/infiniband/ulp/rtrs/rtrs-srv.c |
2891 |
+@@ -1319,6 +1319,13 @@ static int rtrs_srv_get_next_cq_vector(struct rtrs_srv_sess *sess) |
2892 |
+ return sess->cur_cq_vector; |
2893 |
+ } |
2894 |
+ |
2895 |
++static void rtrs_srv_dev_release(struct device *dev) |
2896 |
++{ |
2897 |
++ struct rtrs_srv *srv = container_of(dev, struct rtrs_srv, dev); |
2898 |
++ |
2899 |
++ kfree(srv); |
2900 |
++} |
2901 |
++ |
2902 |
+ static struct rtrs_srv *__alloc_srv(struct rtrs_srv_ctx *ctx, |
2903 |
+ const uuid_t *paths_uuid) |
2904 |
+ { |
2905 |
+@@ -1336,6 +1343,8 @@ static struct rtrs_srv *__alloc_srv(struct rtrs_srv_ctx *ctx, |
2906 |
+ uuid_copy(&srv->paths_uuid, paths_uuid); |
2907 |
+ srv->queue_depth = sess_queue_depth; |
2908 |
+ srv->ctx = ctx; |
2909 |
++ device_initialize(&srv->dev); |
2910 |
++ srv->dev.release = rtrs_srv_dev_release; |
2911 |
+ |
2912 |
+ srv->chunks = kcalloc(srv->queue_depth, sizeof(*srv->chunks), |
2913 |
+ GFP_KERNEL); |
2914 |
+diff --git a/drivers/interconnect/qcom/bcm-voter.c b/drivers/interconnect/qcom/bcm-voter.c |
2915 |
+index 2a11a63e7217a..b360dc34c90c7 100644 |
2916 |
+--- a/drivers/interconnect/qcom/bcm-voter.c |
2917 |
++++ b/drivers/interconnect/qcom/bcm-voter.c |
2918 |
+@@ -52,8 +52,20 @@ static int cmp_vcd(void *priv, struct list_head *a, struct list_head *b) |
2919 |
+ return 1; |
2920 |
+ } |
2921 |
+ |
2922 |
++static u64 bcm_div(u64 num, u32 base) |
2923 |
++{ |
2924 |
++ /* Ensure that small votes aren't lost. */ |
2925 |
++ if (num && num < base) |
2926 |
++ return 1; |
2927 |
++ |
2928 |
++ do_div(num, base); |
2929 |
++ |
2930 |
++ return num; |
2931 |
++} |
2932 |
++ |
2933 |
+ static void bcm_aggregate(struct qcom_icc_bcm *bcm) |
2934 |
+ { |
2935 |
++ struct qcom_icc_node *node; |
2936 |
+ size_t i, bucket; |
2937 |
+ u64 agg_avg[QCOM_ICC_NUM_BUCKETS] = {0}; |
2938 |
+ u64 agg_peak[QCOM_ICC_NUM_BUCKETS] = {0}; |
2939 |
+@@ -61,22 +73,21 @@ static void bcm_aggregate(struct qcom_icc_bcm *bcm) |
2940 |
+ |
2941 |
+ for (bucket = 0; bucket < QCOM_ICC_NUM_BUCKETS; bucket++) { |
2942 |
+ for (i = 0; i < bcm->num_nodes; i++) { |
2943 |
+- temp = bcm->nodes[i]->sum_avg[bucket] * bcm->aux_data.width; |
2944 |
+- do_div(temp, bcm->nodes[i]->buswidth * bcm->nodes[i]->channels); |
2945 |
++ node = bcm->nodes[i]; |
2946 |
++ temp = bcm_div(node->sum_avg[bucket] * bcm->aux_data.width, |
2947 |
++ node->buswidth * node->channels); |
2948 |
+ agg_avg[bucket] = max(agg_avg[bucket], temp); |
2949 |
+ |
2950 |
+- temp = bcm->nodes[i]->max_peak[bucket] * bcm->aux_data.width; |
2951 |
+- do_div(temp, bcm->nodes[i]->buswidth); |
2952 |
++ temp = bcm_div(node->max_peak[bucket] * bcm->aux_data.width, |
2953 |
++ node->buswidth); |
2954 |
+ agg_peak[bucket] = max(agg_peak[bucket], temp); |
2955 |
+ } |
2956 |
+ |
2957 |
+ temp = agg_avg[bucket] * 1000ULL; |
2958 |
+- do_div(temp, bcm->aux_data.unit); |
2959 |
+- bcm->vote_x[bucket] = temp; |
2960 |
++ bcm->vote_x[bucket] = bcm_div(temp, bcm->aux_data.unit); |
2961 |
+ |
2962 |
+ temp = agg_peak[bucket] * 1000ULL; |
2963 |
+- do_div(temp, bcm->aux_data.unit); |
2964 |
+- bcm->vote_y[bucket] = temp; |
2965 |
++ bcm->vote_y[bucket] = bcm_div(temp, bcm->aux_data.unit); |
2966 |
+ } |
2967 |
+ |
2968 |
+ if (bcm->keepalive && bcm->vote_x[QCOM_ICC_BUCKET_AMC] == 0 && |
2969 |
+diff --git a/drivers/iommu/amd/iommu.c b/drivers/iommu/amd/iommu.c |
2970 |
+index 200ee948f6ec1..37c74c842f3a3 100644 |
2971 |
+--- a/drivers/iommu/amd/iommu.c |
2972 |
++++ b/drivers/iommu/amd/iommu.c |
2973 |
+@@ -2650,7 +2650,12 @@ static int amd_iommu_def_domain_type(struct device *dev) |
2974 |
+ if (!dev_data) |
2975 |
+ return 0; |
2976 |
+ |
2977 |
+- if (dev_data->iommu_v2) |
2978 |
++ /* |
2979 |
++ * Do not identity map IOMMUv2 capable devices when memory encryption is |
2980 |
++ * active, because some of those devices (AMD GPUs) don't have the |
2981 |
++ * encryption bit in their DMA-mask and require remapping. |
2982 |
++ */ |
2983 |
++ if (!mem_encrypt_active() && dev_data->iommu_v2) |
2984 |
+ return IOMMU_DOMAIN_IDENTITY; |
2985 |
+ |
2986 |
+ return 0; |
2987 |
+diff --git a/drivers/iommu/amd/iommu_v2.c b/drivers/iommu/amd/iommu_v2.c |
2988 |
+index e4b025c5637c4..5a188cac7a0f1 100644 |
2989 |
+--- a/drivers/iommu/amd/iommu_v2.c |
2990 |
++++ b/drivers/iommu/amd/iommu_v2.c |
2991 |
+@@ -737,6 +737,13 @@ int amd_iommu_init_device(struct pci_dev *pdev, int pasids) |
2992 |
+ |
2993 |
+ might_sleep(); |
2994 |
+ |
2995 |
++ /* |
2996 |
++ * When memory encryption is active the device is likely not in a |
2997 |
++ * direct-mapped domain. Forbid using IOMMUv2 functionality for now. |
2998 |
++ */ |
2999 |
++ if (mem_encrypt_active()) |
3000 |
++ return -ENODEV; |
3001 |
++ |
3002 |
+ if (!amd_iommu_v2_supported()) |
3003 |
+ return -ENODEV; |
3004 |
+ |
3005 |
+diff --git a/drivers/media/rc/gpio-ir-tx.c b/drivers/media/rc/gpio-ir-tx.c |
3006 |
+index f33b443bfa47b..c6cd2e6d8e654 100644 |
3007 |
+--- a/drivers/media/rc/gpio-ir-tx.c |
3008 |
++++ b/drivers/media/rc/gpio-ir-tx.c |
3009 |
+@@ -19,8 +19,6 @@ struct gpio_ir { |
3010 |
+ struct gpio_desc *gpio; |
3011 |
+ unsigned int carrier; |
3012 |
+ unsigned int duty_cycle; |
3013 |
+- /* we need a spinlock to hold the cpu while transmitting */ |
3014 |
+- spinlock_t lock; |
3015 |
+ }; |
3016 |
+ |
3017 |
+ static const struct of_device_id gpio_ir_tx_of_match[] = { |
3018 |
+@@ -53,12 +51,11 @@ static int gpio_ir_tx_set_carrier(struct rc_dev *dev, u32 carrier) |
3019 |
+ static void gpio_ir_tx_unmodulated(struct gpio_ir *gpio_ir, uint *txbuf, |
3020 |
+ uint count) |
3021 |
+ { |
3022 |
+- unsigned long flags; |
3023 |
+ ktime_t edge; |
3024 |
+ s32 delta; |
3025 |
+ int i; |
3026 |
+ |
3027 |
+- spin_lock_irqsave(&gpio_ir->lock, flags); |
3028 |
++ local_irq_disable(); |
3029 |
+ |
3030 |
+ edge = ktime_get(); |
3031 |
+ |
3032 |
+@@ -72,14 +69,11 @@ static void gpio_ir_tx_unmodulated(struct gpio_ir *gpio_ir, uint *txbuf, |
3033 |
+ } |
3034 |
+ |
3035 |
+ gpiod_set_value(gpio_ir->gpio, 0); |
3036 |
+- |
3037 |
+- spin_unlock_irqrestore(&gpio_ir->lock, flags); |
3038 |
+ } |
3039 |
+ |
3040 |
+ static void gpio_ir_tx_modulated(struct gpio_ir *gpio_ir, uint *txbuf, |
3041 |
+ uint count) |
3042 |
+ { |
3043 |
+- unsigned long flags; |
3044 |
+ ktime_t edge; |
3045 |
+ /* |
3046 |
+ * delta should never exceed 0.5 seconds (IR_MAX_DURATION) and on |
3047 |
+@@ -95,7 +89,7 @@ static void gpio_ir_tx_modulated(struct gpio_ir *gpio_ir, uint *txbuf, |
3048 |
+ space = DIV_ROUND_CLOSEST((100 - gpio_ir->duty_cycle) * |
3049 |
+ (NSEC_PER_SEC / 100), gpio_ir->carrier); |
3050 |
+ |
3051 |
+- spin_lock_irqsave(&gpio_ir->lock, flags); |
3052 |
++ local_irq_disable(); |
3053 |
+ |
3054 |
+ edge = ktime_get(); |
3055 |
+ |
3056 |
+@@ -128,19 +122,20 @@ static void gpio_ir_tx_modulated(struct gpio_ir *gpio_ir, uint *txbuf, |
3057 |
+ edge = last; |
3058 |
+ } |
3059 |
+ } |
3060 |
+- |
3061 |
+- spin_unlock_irqrestore(&gpio_ir->lock, flags); |
3062 |
+ } |
3063 |
+ |
3064 |
+ static int gpio_ir_tx(struct rc_dev *dev, unsigned int *txbuf, |
3065 |
+ unsigned int count) |
3066 |
+ { |
3067 |
+ struct gpio_ir *gpio_ir = dev->priv; |
3068 |
++ unsigned long flags; |
3069 |
+ |
3070 |
++ local_irq_save(flags); |
3071 |
+ if (gpio_ir->carrier) |
3072 |
+ gpio_ir_tx_modulated(gpio_ir, txbuf, count); |
3073 |
+ else |
3074 |
+ gpio_ir_tx_unmodulated(gpio_ir, txbuf, count); |
3075 |
++ local_irq_restore(flags); |
3076 |
+ |
3077 |
+ return count; |
3078 |
+ } |
3079 |
+@@ -176,7 +171,6 @@ static int gpio_ir_tx_probe(struct platform_device *pdev) |
3080 |
+ |
3081 |
+ gpio_ir->carrier = 38000; |
3082 |
+ gpio_ir->duty_cycle = 50; |
3083 |
+- spin_lock_init(&gpio_ir->lock); |
3084 |
+ |
3085 |
+ rc = devm_rc_register_device(&pdev->dev, rcdev); |
3086 |
+ if (rc < 0) |
3087 |
+diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c |
3088 |
+index 9ff18d4961ceb..5561075f7a1bb 100644 |
3089 |
+--- a/drivers/misc/eeprom/at24.c |
3090 |
++++ b/drivers/misc/eeprom/at24.c |
3091 |
+@@ -692,10 +692,6 @@ static int at24_probe(struct i2c_client *client) |
3092 |
+ nvmem_config.word_size = 1; |
3093 |
+ nvmem_config.size = byte_len; |
3094 |
+ |
3095 |
+- at24->nvmem = devm_nvmem_register(dev, &nvmem_config); |
3096 |
+- if (IS_ERR(at24->nvmem)) |
3097 |
+- return PTR_ERR(at24->nvmem); |
3098 |
+- |
3099 |
+ i2c_set_clientdata(client, at24); |
3100 |
+ |
3101 |
+ err = regulator_enable(at24->vcc_reg); |
3102 |
+@@ -708,6 +704,13 @@ static int at24_probe(struct i2c_client *client) |
3103 |
+ pm_runtime_set_active(dev); |
3104 |
+ pm_runtime_enable(dev); |
3105 |
+ |
3106 |
++ at24->nvmem = devm_nvmem_register(dev, &nvmem_config); |
3107 |
++ if (IS_ERR(at24->nvmem)) { |
3108 |
++ pm_runtime_disable(dev); |
3109 |
++ regulator_disable(at24->vcc_reg); |
3110 |
++ return PTR_ERR(at24->nvmem); |
3111 |
++ } |
3112 |
++ |
3113 |
+ /* |
3114 |
+ * Perform a one-byte test read to verify that the |
3115 |
+ * chip is functional. |
3116 |
+diff --git a/drivers/mmc/core/sdio_ops.c b/drivers/mmc/core/sdio_ops.c |
3117 |
+index 93d346c01110d..4c229dd2b6e54 100644 |
3118 |
+--- a/drivers/mmc/core/sdio_ops.c |
3119 |
++++ b/drivers/mmc/core/sdio_ops.c |
3120 |
+@@ -121,6 +121,7 @@ int mmc_io_rw_extended(struct mmc_card *card, int write, unsigned fn, |
3121 |
+ struct sg_table sgtable; |
3122 |
+ unsigned int nents, left_size, i; |
3123 |
+ unsigned int seg_size = card->host->max_seg_size; |
3124 |
++ int err; |
3125 |
+ |
3126 |
+ WARN_ON(blksz == 0); |
3127 |
+ |
3128 |
+@@ -170,28 +171,32 @@ int mmc_io_rw_extended(struct mmc_card *card, int write, unsigned fn, |
3129 |
+ |
3130 |
+ mmc_set_data_timeout(&data, card); |
3131 |
+ |
3132 |
+- mmc_wait_for_req(card->host, &mrq); |
3133 |
++ mmc_pre_req(card->host, &mrq); |
3134 |
+ |
3135 |
+- if (nents > 1) |
3136 |
+- sg_free_table(&sgtable); |
3137 |
++ mmc_wait_for_req(card->host, &mrq); |
3138 |
+ |
3139 |
+ if (cmd.error) |
3140 |
+- return cmd.error; |
3141 |
+- if (data.error) |
3142 |
+- return data.error; |
3143 |
+- |
3144 |
+- if (mmc_host_is_spi(card->host)) { |
3145 |
++ err = cmd.error; |
3146 |
++ else if (data.error) |
3147 |
++ err = data.error; |
3148 |
++ else if (mmc_host_is_spi(card->host)) |
3149 |
+ /* host driver already reported errors */ |
3150 |
+- } else { |
3151 |
+- if (cmd.resp[0] & R5_ERROR) |
3152 |
+- return -EIO; |
3153 |
+- if (cmd.resp[0] & R5_FUNCTION_NUMBER) |
3154 |
+- return -EINVAL; |
3155 |
+- if (cmd.resp[0] & R5_OUT_OF_RANGE) |
3156 |
+- return -ERANGE; |
3157 |
+- } |
3158 |
++ err = 0; |
3159 |
++ else if (cmd.resp[0] & R5_ERROR) |
3160 |
++ err = -EIO; |
3161 |
++ else if (cmd.resp[0] & R5_FUNCTION_NUMBER) |
3162 |
++ err = -EINVAL; |
3163 |
++ else if (cmd.resp[0] & R5_OUT_OF_RANGE) |
3164 |
++ err = -ERANGE; |
3165 |
++ else |
3166 |
++ err = 0; |
3167 |
+ |
3168 |
+- return 0; |
3169 |
++ mmc_post_req(card->host, &mrq, err); |
3170 |
++ |
3171 |
++ if (nents > 1) |
3172 |
++ sg_free_table(&sgtable); |
3173 |
++ |
3174 |
++ return err; |
3175 |
+ } |
3176 |
+ |
3177 |
+ int sdio_reset(struct mmc_host *host) |
3178 |
+diff --git a/drivers/mmc/host/sdhci-acpi.c b/drivers/mmc/host/sdhci-acpi.c |
3179 |
+index 2d9f79b50a7fa..841e34aa7caae 100644 |
3180 |
+--- a/drivers/mmc/host/sdhci-acpi.c |
3181 |
++++ b/drivers/mmc/host/sdhci-acpi.c |
3182 |
+@@ -550,12 +550,18 @@ static int amd_select_drive_strength(struct mmc_card *card, |
3183 |
+ return MMC_SET_DRIVER_TYPE_A; |
3184 |
+ } |
3185 |
+ |
3186 |
+-static void sdhci_acpi_amd_hs400_dll(struct sdhci_host *host) |
3187 |
++static void sdhci_acpi_amd_hs400_dll(struct sdhci_host *host, bool enable) |
3188 |
+ { |
3189 |
++ struct sdhci_acpi_host *acpi_host = sdhci_priv(host); |
3190 |
++ struct amd_sdhci_host *amd_host = sdhci_acpi_priv(acpi_host); |
3191 |
++ |
3192 |
+ /* AMD Platform requires dll setting */ |
3193 |
+ sdhci_writel(host, 0x40003210, SDHCI_AMD_RESET_DLL_REGISTER); |
3194 |
+ usleep_range(10, 20); |
3195 |
+- sdhci_writel(host, 0x40033210, SDHCI_AMD_RESET_DLL_REGISTER); |
3196 |
++ if (enable) |
3197 |
++ sdhci_writel(host, 0x40033210, SDHCI_AMD_RESET_DLL_REGISTER); |
3198 |
++ |
3199 |
++ amd_host->dll_enabled = enable; |
3200 |
+ } |
3201 |
+ |
3202 |
+ /* |
3203 |
+@@ -595,10 +601,8 @@ static void amd_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) |
3204 |
+ |
3205 |
+ /* DLL is only required for HS400 */ |
3206 |
+ if (host->timing == MMC_TIMING_MMC_HS400 && |
3207 |
+- !amd_host->dll_enabled) { |
3208 |
+- sdhci_acpi_amd_hs400_dll(host); |
3209 |
+- amd_host->dll_enabled = true; |
3210 |
+- } |
3211 |
++ !amd_host->dll_enabled) |
3212 |
++ sdhci_acpi_amd_hs400_dll(host, true); |
3213 |
+ } |
3214 |
+ } |
3215 |
+ |
3216 |
+@@ -619,10 +623,23 @@ static int amd_sdhci_execute_tuning(struct mmc_host *mmc, u32 opcode) |
3217 |
+ return err; |
3218 |
+ } |
3219 |
+ |
3220 |
++static void amd_sdhci_reset(struct sdhci_host *host, u8 mask) |
3221 |
++{ |
3222 |
++ struct sdhci_acpi_host *acpi_host = sdhci_priv(host); |
3223 |
++ struct amd_sdhci_host *amd_host = sdhci_acpi_priv(acpi_host); |
3224 |
++ |
3225 |
++ if (mask & SDHCI_RESET_ALL) { |
3226 |
++ amd_host->tuned_clock = false; |
3227 |
++ sdhci_acpi_amd_hs400_dll(host, false); |
3228 |
++ } |
3229 |
++ |
3230 |
++ sdhci_reset(host, mask); |
3231 |
++} |
3232 |
++ |
3233 |
+ static const struct sdhci_ops sdhci_acpi_ops_amd = { |
3234 |
+ .set_clock = sdhci_set_clock, |
3235 |
+ .set_bus_width = sdhci_set_bus_width, |
3236 |
+- .reset = sdhci_reset, |
3237 |
++ .reset = amd_sdhci_reset, |
3238 |
+ .set_uhs_signaling = sdhci_set_uhs_signaling, |
3239 |
+ }; |
3240 |
+ |
3241 |
+diff --git a/drivers/mmc/host/sdhci-msm.c b/drivers/mmc/host/sdhci-msm.c |
3242 |
+index c0d58e9fcc333..0450f521c6f9a 100644 |
3243 |
+--- a/drivers/mmc/host/sdhci-msm.c |
3244 |
++++ b/drivers/mmc/host/sdhci-msm.c |
3245 |
+@@ -1158,7 +1158,7 @@ static void sdhci_msm_set_cdr(struct sdhci_host *host, bool enable) |
3246 |
+ static int sdhci_msm_execute_tuning(struct mmc_host *mmc, u32 opcode) |
3247 |
+ { |
3248 |
+ struct sdhci_host *host = mmc_priv(mmc); |
3249 |
+- int tuning_seq_cnt = 3; |
3250 |
++ int tuning_seq_cnt = 10; |
3251 |
+ u8 phase, tuned_phases[16], tuned_phase_cnt = 0; |
3252 |
+ int rc; |
3253 |
+ struct mmc_ios ios = host->mmc->ios; |
3254 |
+@@ -1214,6 +1214,22 @@ retry: |
3255 |
+ } while (++phase < ARRAY_SIZE(tuned_phases)); |
3256 |
+ |
3257 |
+ if (tuned_phase_cnt) { |
3258 |
++ if (tuned_phase_cnt == ARRAY_SIZE(tuned_phases)) { |
3259 |
++ /* |
3260 |
++ * All phases valid is _almost_ as bad as no phases |
3261 |
++ * valid. Probably all phases are not really reliable |
3262 |
++ * but we didn't detect where the unreliable place is. |
3263 |
++ * That means we'll essentially be guessing and hoping |
3264 |
++ * we get a good phase. Better to try a few times. |
3265 |
++ */ |
3266 |
++ dev_dbg(mmc_dev(mmc), "%s: All phases valid; try again\n", |
3267 |
++ mmc_hostname(mmc)); |
3268 |
++ if (--tuning_seq_cnt) { |
3269 |
++ tuned_phase_cnt = 0; |
3270 |
++ goto retry; |
3271 |
++ } |
3272 |
++ } |
3273 |
++ |
3274 |
+ rc = msm_find_most_appropriate_phase(host, tuned_phases, |
3275 |
+ tuned_phase_cnt); |
3276 |
+ if (rc < 0) |
3277 |
+diff --git a/drivers/mmc/host/sdhci-of-esdhc.c b/drivers/mmc/host/sdhci-of-esdhc.c |
3278 |
+index 7c73d243dc6ce..45881b3099567 100644 |
3279 |
+--- a/drivers/mmc/host/sdhci-of-esdhc.c |
3280 |
++++ b/drivers/mmc/host/sdhci-of-esdhc.c |
3281 |
+@@ -81,6 +81,7 @@ struct sdhci_esdhc { |
3282 |
+ bool quirk_tuning_erratum_type2; |
3283 |
+ bool quirk_ignore_data_inhibit; |
3284 |
+ bool quirk_delay_before_data_reset; |
3285 |
++ bool quirk_trans_complete_erratum; |
3286 |
+ bool in_sw_tuning; |
3287 |
+ unsigned int peripheral_clock; |
3288 |
+ const struct esdhc_clk_fixup *clk_fixup; |
3289 |
+@@ -1177,10 +1178,11 @@ static void esdhc_set_uhs_signaling(struct sdhci_host *host, |
3290 |
+ |
3291 |
+ static u32 esdhc_irq(struct sdhci_host *host, u32 intmask) |
3292 |
+ { |
3293 |
++ struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); |
3294 |
++ struct sdhci_esdhc *esdhc = sdhci_pltfm_priv(pltfm_host); |
3295 |
+ u32 command; |
3296 |
+ |
3297 |
+- if (of_find_compatible_node(NULL, NULL, |
3298 |
+- "fsl,p2020-esdhc")) { |
3299 |
++ if (esdhc->quirk_trans_complete_erratum) { |
3300 |
+ command = SDHCI_GET_CMD(sdhci_readw(host, |
3301 |
+ SDHCI_COMMAND)); |
3302 |
+ if (command == MMC_WRITE_MULTIPLE_BLOCK && |
3303 |
+@@ -1334,8 +1336,10 @@ static void esdhc_init(struct platform_device *pdev, struct sdhci_host *host) |
3304 |
+ esdhc->clk_fixup = match->data; |
3305 |
+ np = pdev->dev.of_node; |
3306 |
+ |
3307 |
+- if (of_device_is_compatible(np, "fsl,p2020-esdhc")) |
3308 |
++ if (of_device_is_compatible(np, "fsl,p2020-esdhc")) { |
3309 |
+ esdhc->quirk_delay_before_data_reset = true; |
3310 |
++ esdhc->quirk_trans_complete_erratum = true; |
3311 |
++ } |
3312 |
+ |
3313 |
+ clk = of_clk_get(np, 0); |
3314 |
+ if (!IS_ERR(clk)) { |
3315 |
+diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c |
3316 |
+index 71ed4c54f6d5d..eaadcc7043349 100644 |
3317 |
+--- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c |
3318 |
++++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c |
3319 |
+@@ -20,6 +20,7 @@ |
3320 |
+ #include <net/pkt_cls.h> |
3321 |
+ #include <net/tcp.h> |
3322 |
+ #include <net/vxlan.h> |
3323 |
++#include <net/geneve.h> |
3324 |
+ |
3325 |
+ #include "hnae3.h" |
3326 |
+ #include "hns3_enet.h" |
3327 |
+@@ -780,7 +781,7 @@ static int hns3_get_l4_protocol(struct sk_buff *skb, u8 *ol4_proto, |
3328 |
+ * and it is udp packet, which has a dest port as the IANA assigned. |
3329 |
+ * the hardware is expected to do the checksum offload, but the |
3330 |
+ * hardware will not do the checksum offload when udp dest port is |
3331 |
+- * 4789. |
3332 |
++ * 4789 or 6081. |
3333 |
+ */ |
3334 |
+ static bool hns3_tunnel_csum_bug(struct sk_buff *skb) |
3335 |
+ { |
3336 |
+@@ -789,7 +790,8 @@ static bool hns3_tunnel_csum_bug(struct sk_buff *skb) |
3337 |
+ l4.hdr = skb_transport_header(skb); |
3338 |
+ |
3339 |
+ if (!(!skb->encapsulation && |
3340 |
+- l4.udp->dest == htons(IANA_VXLAN_UDP_PORT))) |
3341 |
++ (l4.udp->dest == htons(IANA_VXLAN_UDP_PORT) || |
3342 |
++ l4.udp->dest == htons(GENEVE_UDP_PORT)))) |
3343 |
+ return false; |
3344 |
+ |
3345 |
+ skb_checksum_help(skb); |
3346 |
+diff --git a/drivers/net/wan/hdlc.c b/drivers/net/wan/hdlc.c |
3347 |
+index 386ed2aa31fd9..9b00708676cf7 100644 |
3348 |
+--- a/drivers/net/wan/hdlc.c |
3349 |
++++ b/drivers/net/wan/hdlc.c |
3350 |
+@@ -229,7 +229,7 @@ static void hdlc_setup_dev(struct net_device *dev) |
3351 |
+ dev->min_mtu = 68; |
3352 |
+ dev->max_mtu = HDLC_MAX_MTU; |
3353 |
+ dev->type = ARPHRD_RAWHDLC; |
3354 |
+- dev->hard_header_len = 16; |
3355 |
++ dev->hard_header_len = 0; |
3356 |
+ dev->needed_headroom = 0; |
3357 |
+ dev->addr_len = 0; |
3358 |
+ dev->header_ops = &hdlc_null_ops; |
3359 |
+diff --git a/drivers/net/wan/hdlc_cisco.c b/drivers/net/wan/hdlc_cisco.c |
3360 |
+index d8cba3625c185..444130655d8ea 100644 |
3361 |
+--- a/drivers/net/wan/hdlc_cisco.c |
3362 |
++++ b/drivers/net/wan/hdlc_cisco.c |
3363 |
+@@ -370,6 +370,7 @@ static int cisco_ioctl(struct net_device *dev, struct ifreq *ifr) |
3364 |
+ memcpy(&state(hdlc)->settings, &new_settings, size); |
3365 |
+ spin_lock_init(&state(hdlc)->lock); |
3366 |
+ dev->header_ops = &cisco_header_ops; |
3367 |
++ dev->hard_header_len = sizeof(struct hdlc_header); |
3368 |
+ dev->type = ARPHRD_CISCO; |
3369 |
+ call_netdevice_notifiers(NETDEV_POST_TYPE_CHANGE, dev); |
3370 |
+ netif_dormant_on(dev); |
3371 |
+diff --git a/drivers/net/wan/lapbether.c b/drivers/net/wan/lapbether.c |
3372 |
+index 1ea15f2123ed5..e61616b0b91c7 100644 |
3373 |
+--- a/drivers/net/wan/lapbether.c |
3374 |
++++ b/drivers/net/wan/lapbether.c |
3375 |
+@@ -210,6 +210,8 @@ static void lapbeth_data_transmit(struct net_device *ndev, struct sk_buff *skb) |
3376 |
+ |
3377 |
+ skb->dev = dev = lapbeth->ethdev; |
3378 |
+ |
3379 |
++ skb_reset_network_header(skb); |
3380 |
++ |
3381 |
+ dev_hard_header(skb, dev, ETH_P_DEC, bcast_addr, NULL, 0); |
3382 |
+ |
3383 |
+ dev_queue_xmit(skb); |
3384 |
+@@ -340,6 +342,7 @@ static int lapbeth_new_device(struct net_device *dev) |
3385 |
+ */ |
3386 |
+ ndev->needed_headroom = -1 + 3 + 2 + dev->hard_header_len |
3387 |
+ + dev->needed_headroom; |
3388 |
++ ndev->needed_tailroom = dev->needed_tailroom; |
3389 |
+ |
3390 |
+ lapbeth = netdev_priv(ndev); |
3391 |
+ lapbeth->axdev = ndev; |
3392 |
+diff --git a/drivers/nfc/st95hf/core.c b/drivers/nfc/st95hf/core.c |
3393 |
+index 9642971e89cea..4578547659839 100644 |
3394 |
+--- a/drivers/nfc/st95hf/core.c |
3395 |
++++ b/drivers/nfc/st95hf/core.c |
3396 |
+@@ -966,7 +966,7 @@ static int st95hf_in_send_cmd(struct nfc_digital_dev *ddev, |
3397 |
+ rc = down_killable(&stcontext->exchange_lock); |
3398 |
+ if (rc) { |
3399 |
+ WARN(1, "Semaphore is not found up in st95hf_in_send_cmd\n"); |
3400 |
+- return rc; |
3401 |
++ goto free_skb_resp; |
3402 |
+ } |
3403 |
+ |
3404 |
+ rc = st95hf_spi_send(&stcontext->spicontext, skb->data, |
3405 |
+diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c |
3406 |
+index fa0039dcacc66..f2556f0ea20dc 100644 |
3407 |
+--- a/drivers/nvme/host/core.c |
3408 |
++++ b/drivers/nvme/host/core.c |
3409 |
+@@ -3324,10 +3324,6 @@ static ssize_t nvme_sysfs_delete(struct device *dev, |
3410 |
+ { |
3411 |
+ struct nvme_ctrl *ctrl = dev_get_drvdata(dev); |
3412 |
+ |
3413 |
+- /* Can't delete non-created controllers */ |
3414 |
+- if (!ctrl->created) |
3415 |
+- return -EBUSY; |
3416 |
+- |
3417 |
+ if (device_remove_file_self(dev, attr)) |
3418 |
+ nvme_delete_ctrl_sync(ctrl); |
3419 |
+ return count; |
3420 |
+@@ -4129,7 +4125,6 @@ void nvme_start_ctrl(struct nvme_ctrl *ctrl) |
3421 |
+ nvme_queue_scan(ctrl); |
3422 |
+ nvme_start_queues(ctrl); |
3423 |
+ } |
3424 |
+- ctrl->created = true; |
3425 |
+ } |
3426 |
+ EXPORT_SYMBOL_GPL(nvme_start_ctrl); |
3427 |
+ |
3428 |
+@@ -4287,7 +4282,7 @@ void nvme_unfreeze(struct nvme_ctrl *ctrl) |
3429 |
+ } |
3430 |
+ EXPORT_SYMBOL_GPL(nvme_unfreeze); |
3431 |
+ |
3432 |
+-void nvme_wait_freeze_timeout(struct nvme_ctrl *ctrl, long timeout) |
3433 |
++int nvme_wait_freeze_timeout(struct nvme_ctrl *ctrl, long timeout) |
3434 |
+ { |
3435 |
+ struct nvme_ns *ns; |
3436 |
+ |
3437 |
+@@ -4298,6 +4293,7 @@ void nvme_wait_freeze_timeout(struct nvme_ctrl *ctrl, long timeout) |
3438 |
+ break; |
3439 |
+ } |
3440 |
+ up_read(&ctrl->namespaces_rwsem); |
3441 |
++ return timeout; |
3442 |
+ } |
3443 |
+ EXPORT_SYMBOL_GPL(nvme_wait_freeze_timeout); |
3444 |
+ |
3445 |
+diff --git a/drivers/nvme/host/fabrics.c b/drivers/nvme/host/fabrics.c |
3446 |
+index 4ec4829d62334..8575724734e02 100644 |
3447 |
+--- a/drivers/nvme/host/fabrics.c |
3448 |
++++ b/drivers/nvme/host/fabrics.c |
3449 |
+@@ -565,10 +565,14 @@ bool __nvmf_check_ready(struct nvme_ctrl *ctrl, struct request *rq, |
3450 |
+ struct nvme_request *req = nvme_req(rq); |
3451 |
+ |
3452 |
+ /* |
3453 |
+- * If we are in some state of setup or teardown only allow |
3454 |
+- * internally generated commands. |
3455 |
++ * currently we have a problem sending passthru commands |
3456 |
++ * on the admin_q if the controller is not LIVE because we can't |
3457 |
++ * make sure that they are going out after the admin connect, |
3458 |
++ * controller enable and/or other commands in the initialization |
3459 |
++ * sequence. until the controller will be LIVE, fail with |
3460 |
++ * BLK_STS_RESOURCE so that they will be rescheduled. |
3461 |
+ */ |
3462 |
+- if (!blk_rq_is_passthrough(rq) || (req->flags & NVME_REQ_USERCMD)) |
3463 |
++ if (rq->q == ctrl->admin_q && (req->flags & NVME_REQ_USERCMD)) |
3464 |
+ return false; |
3465 |
+ |
3466 |
+ /* |
3467 |
+@@ -576,9 +580,8 @@ bool __nvmf_check_ready(struct nvme_ctrl *ctrl, struct request *rq, |
3468 |
+ * which is require to set the queue live in the appropinquate states. |
3469 |
+ */ |
3470 |
+ switch (ctrl->state) { |
3471 |
+- case NVME_CTRL_NEW: |
3472 |
+ case NVME_CTRL_CONNECTING: |
3473 |
+- if (nvme_is_fabrics(req->cmd) && |
3474 |
++ if (blk_rq_is_passthrough(rq) && nvme_is_fabrics(req->cmd) && |
3475 |
+ req->cmd->fabrics.fctype == nvme_fabrics_type_connect) |
3476 |
+ return true; |
3477 |
+ break; |
3478 |
+diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h |
3479 |
+index e268f1d7e1a0f..1db144eb74ff1 100644 |
3480 |
+--- a/drivers/nvme/host/nvme.h |
3481 |
++++ b/drivers/nvme/host/nvme.h |
3482 |
+@@ -271,7 +271,6 @@ struct nvme_ctrl { |
3483 |
+ struct nvme_command ka_cmd; |
3484 |
+ struct work_struct fw_act_work; |
3485 |
+ unsigned long events; |
3486 |
+- bool created; |
3487 |
+ |
3488 |
+ #ifdef CONFIG_NVME_MULTIPATH |
3489 |
+ /* asymmetric namespace access: */ |
3490 |
+@@ -538,7 +537,7 @@ void nvme_kill_queues(struct nvme_ctrl *ctrl); |
3491 |
+ void nvme_sync_queues(struct nvme_ctrl *ctrl); |
3492 |
+ void nvme_unfreeze(struct nvme_ctrl *ctrl); |
3493 |
+ void nvme_wait_freeze(struct nvme_ctrl *ctrl); |
3494 |
+-void nvme_wait_freeze_timeout(struct nvme_ctrl *ctrl, long timeout); |
3495 |
++int nvme_wait_freeze_timeout(struct nvme_ctrl *ctrl, long timeout); |
3496 |
+ void nvme_start_freeze(struct nvme_ctrl *ctrl); |
3497 |
+ |
3498 |
+ #define NVME_QID_ANY -1 |
3499 |
+diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c |
3500 |
+index d4b1ff7471231..69a19fe241063 100644 |
3501 |
+--- a/drivers/nvme/host/pci.c |
3502 |
++++ b/drivers/nvme/host/pci.c |
3503 |
+@@ -1250,8 +1250,8 @@ static enum blk_eh_timer_return nvme_timeout(struct request *req, bool reserved) |
3504 |
+ dev_warn_ratelimited(dev->ctrl.device, |
3505 |
+ "I/O %d QID %d timeout, disable controller\n", |
3506 |
+ req->tag, nvmeq->qid); |
3507 |
+- nvme_dev_disable(dev, true); |
3508 |
+ nvme_req(req)->flags |= NVME_REQ_CANCELLED; |
3509 |
++ nvme_dev_disable(dev, true); |
3510 |
+ return BLK_EH_DONE; |
3511 |
+ case NVME_CTRL_RESETTING: |
3512 |
+ return BLK_EH_RESET_TIMER; |
3513 |
+@@ -1268,10 +1268,10 @@ static enum blk_eh_timer_return nvme_timeout(struct request *req, bool reserved) |
3514 |
+ dev_warn(dev->ctrl.device, |
3515 |
+ "I/O %d QID %d timeout, reset controller\n", |
3516 |
+ req->tag, nvmeq->qid); |
3517 |
++ nvme_req(req)->flags |= NVME_REQ_CANCELLED; |
3518 |
+ nvme_dev_disable(dev, false); |
3519 |
+ nvme_reset_ctrl(&dev->ctrl); |
3520 |
+ |
3521 |
+- nvme_req(req)->flags |= NVME_REQ_CANCELLED; |
3522 |
+ return BLK_EH_DONE; |
3523 |
+ } |
3524 |
+ |
3525 |
+diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c |
3526 |
+index 876859cd14e86..6c07bb55b0f83 100644 |
3527 |
+--- a/drivers/nvme/host/rdma.c |
3528 |
++++ b/drivers/nvme/host/rdma.c |
3529 |
+@@ -121,6 +121,7 @@ struct nvme_rdma_ctrl { |
3530 |
+ struct sockaddr_storage src_addr; |
3531 |
+ |
3532 |
+ struct nvme_ctrl ctrl; |
3533 |
++ struct mutex teardown_lock; |
3534 |
+ bool use_inline_data; |
3535 |
+ u32 io_queues[HCTX_MAX_TYPES]; |
3536 |
+ }; |
3537 |
+@@ -949,7 +950,15 @@ static int nvme_rdma_configure_io_queues(struct nvme_rdma_ctrl *ctrl, bool new) |
3538 |
+ |
3539 |
+ if (!new) { |
3540 |
+ nvme_start_queues(&ctrl->ctrl); |
3541 |
+- nvme_wait_freeze(&ctrl->ctrl); |
3542 |
++ if (!nvme_wait_freeze_timeout(&ctrl->ctrl, NVME_IO_TIMEOUT)) { |
3543 |
++ /* |
3544 |
++ * If we timed out waiting for freeze we are likely to |
3545 |
++ * be stuck. Fail the controller initialization just |
3546 |
++ * to be safe. |
3547 |
++ */ |
3548 |
++ ret = -ENODEV; |
3549 |
++ goto out_wait_freeze_timed_out; |
3550 |
++ } |
3551 |
+ blk_mq_update_nr_hw_queues(ctrl->ctrl.tagset, |
3552 |
+ ctrl->ctrl.queue_count - 1); |
3553 |
+ nvme_unfreeze(&ctrl->ctrl); |
3554 |
+@@ -957,6 +966,9 @@ static int nvme_rdma_configure_io_queues(struct nvme_rdma_ctrl *ctrl, bool new) |
3555 |
+ |
3556 |
+ return 0; |
3557 |
+ |
3558 |
++out_wait_freeze_timed_out: |
3559 |
++ nvme_stop_queues(&ctrl->ctrl); |
3560 |
++ nvme_rdma_stop_io_queues(ctrl); |
3561 |
+ out_cleanup_connect_q: |
3562 |
+ if (new) |
3563 |
+ blk_cleanup_queue(ctrl->ctrl.connect_q); |
3564 |
+@@ -971,6 +983,7 @@ out_free_io_queues: |
3565 |
+ static void nvme_rdma_teardown_admin_queue(struct nvme_rdma_ctrl *ctrl, |
3566 |
+ bool remove) |
3567 |
+ { |
3568 |
++ mutex_lock(&ctrl->teardown_lock); |
3569 |
+ blk_mq_quiesce_queue(ctrl->ctrl.admin_q); |
3570 |
+ nvme_rdma_stop_queue(&ctrl->queues[0]); |
3571 |
+ if (ctrl->ctrl.admin_tagset) { |
3572 |
+@@ -981,11 +994,13 @@ static void nvme_rdma_teardown_admin_queue(struct nvme_rdma_ctrl *ctrl, |
3573 |
+ if (remove) |
3574 |
+ blk_mq_unquiesce_queue(ctrl->ctrl.admin_q); |
3575 |
+ nvme_rdma_destroy_admin_queue(ctrl, remove); |
3576 |
++ mutex_unlock(&ctrl->teardown_lock); |
3577 |
+ } |
3578 |
+ |
3579 |
+ static void nvme_rdma_teardown_io_queues(struct nvme_rdma_ctrl *ctrl, |
3580 |
+ bool remove) |
3581 |
+ { |
3582 |
++ mutex_lock(&ctrl->teardown_lock); |
3583 |
+ if (ctrl->ctrl.queue_count > 1) { |
3584 |
+ nvme_start_freeze(&ctrl->ctrl); |
3585 |
+ nvme_stop_queues(&ctrl->ctrl); |
3586 |
+@@ -999,6 +1014,7 @@ static void nvme_rdma_teardown_io_queues(struct nvme_rdma_ctrl *ctrl, |
3587 |
+ nvme_start_queues(&ctrl->ctrl); |
3588 |
+ nvme_rdma_destroy_io_queues(ctrl, remove); |
3589 |
+ } |
3590 |
++ mutex_unlock(&ctrl->teardown_lock); |
3591 |
+ } |
3592 |
+ |
3593 |
+ static void nvme_rdma_free_ctrl(struct nvme_ctrl *nctrl) |
3594 |
+@@ -1154,6 +1170,7 @@ static void nvme_rdma_error_recovery(struct nvme_rdma_ctrl *ctrl) |
3595 |
+ if (!nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_RESETTING)) |
3596 |
+ return; |
3597 |
+ |
3598 |
++ dev_warn(ctrl->ctrl.device, "starting error recovery\n"); |
3599 |
+ queue_work(nvme_reset_wq, &ctrl->err_work); |
3600 |
+ } |
3601 |
+ |
3602 |
+@@ -1920,6 +1937,22 @@ static int nvme_rdma_cm_handler(struct rdma_cm_id *cm_id, |
3603 |
+ return 0; |
3604 |
+ } |
3605 |
+ |
3606 |
++static void nvme_rdma_complete_timed_out(struct request *rq) |
3607 |
++{ |
3608 |
++ struct nvme_rdma_request *req = blk_mq_rq_to_pdu(rq); |
3609 |
++ struct nvme_rdma_queue *queue = req->queue; |
3610 |
++ struct nvme_rdma_ctrl *ctrl = queue->ctrl; |
3611 |
++ |
3612 |
++ /* fence other contexts that may complete the command */ |
3613 |
++ mutex_lock(&ctrl->teardown_lock); |
3614 |
++ nvme_rdma_stop_queue(queue); |
3615 |
++ if (!blk_mq_request_completed(rq)) { |
3616 |
++ nvme_req(rq)->status = NVME_SC_HOST_ABORTED_CMD; |
3617 |
++ blk_mq_complete_request(rq); |
3618 |
++ } |
3619 |
++ mutex_unlock(&ctrl->teardown_lock); |
3620 |
++} |
3621 |
++ |
3622 |
+ static enum blk_eh_timer_return |
3623 |
+ nvme_rdma_timeout(struct request *rq, bool reserved) |
3624 |
+ { |
3625 |
+@@ -1930,29 +1963,29 @@ nvme_rdma_timeout(struct request *rq, bool reserved) |
3626 |
+ dev_warn(ctrl->ctrl.device, "I/O %d QID %d timeout\n", |
3627 |
+ rq->tag, nvme_rdma_queue_idx(queue)); |
3628 |
+ |
3629 |
+- /* |
3630 |
+- * Restart the timer if a controller reset is already scheduled. Any |
3631 |
+- * timed out commands would be handled before entering the connecting |
3632 |
+- * state. |
3633 |
+- */ |
3634 |
+- if (ctrl->ctrl.state == NVME_CTRL_RESETTING) |
3635 |
+- return BLK_EH_RESET_TIMER; |
3636 |
+- |
3637 |
+ if (ctrl->ctrl.state != NVME_CTRL_LIVE) { |
3638 |
+ /* |
3639 |
+- * Teardown immediately if controller times out while starting |
3640 |
+- * or we are already started error recovery. all outstanding |
3641 |
+- * requests are completed on shutdown, so we return BLK_EH_DONE. |
3642 |
++ * If we are resetting, connecting or deleting we should |
3643 |
++ * complete immediately because we may block controller |
3644 |
++ * teardown or setup sequence |
3645 |
++ * - ctrl disable/shutdown fabrics requests |
3646 |
++ * - connect requests |
3647 |
++ * - initialization admin requests |
3648 |
++ * - I/O requests that entered after unquiescing and |
3649 |
++ * the controller stopped responding |
3650 |
++ * |
3651 |
++ * All other requests should be cancelled by the error |
3652 |
++ * recovery work, so it's fine that we fail it here. |
3653 |
+ */ |
3654 |
+- flush_work(&ctrl->err_work); |
3655 |
+- nvme_rdma_teardown_io_queues(ctrl, false); |
3656 |
+- nvme_rdma_teardown_admin_queue(ctrl, false); |
3657 |
++ nvme_rdma_complete_timed_out(rq); |
3658 |
+ return BLK_EH_DONE; |
3659 |
+ } |
3660 |
+ |
3661 |
+- dev_warn(ctrl->ctrl.device, "starting error recovery\n"); |
3662 |
++ /* |
3663 |
++ * LIVE state should trigger the normal error recovery which will |
3664 |
++ * handle completing this request. |
3665 |
++ */ |
3666 |
+ nvme_rdma_error_recovery(ctrl); |
3667 |
+- |
3668 |
+ return BLK_EH_RESET_TIMER; |
3669 |
+ } |
3670 |
+ |
3671 |
+@@ -2252,6 +2285,7 @@ static struct nvme_ctrl *nvme_rdma_create_ctrl(struct device *dev, |
3672 |
+ return ERR_PTR(-ENOMEM); |
3673 |
+ ctrl->ctrl.opts = opts; |
3674 |
+ INIT_LIST_HEAD(&ctrl->list); |
3675 |
++ mutex_init(&ctrl->teardown_lock); |
3676 |
+ |
3677 |
+ if (!(opts->mask & NVMF_OPT_TRSVCID)) { |
3678 |
+ opts->trsvcid = |
3679 |
+diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c |
3680 |
+index a6d2e3330a584..f1f66bf96cbb9 100644 |
3681 |
+--- a/drivers/nvme/host/tcp.c |
3682 |
++++ b/drivers/nvme/host/tcp.c |
3683 |
+@@ -122,6 +122,7 @@ struct nvme_tcp_ctrl { |
3684 |
+ struct sockaddr_storage src_addr; |
3685 |
+ struct nvme_ctrl ctrl; |
3686 |
+ |
3687 |
++ struct mutex teardown_lock; |
3688 |
+ struct work_struct err_work; |
3689 |
+ struct delayed_work connect_work; |
3690 |
+ struct nvme_tcp_request async_req; |
3691 |
+@@ -447,6 +448,7 @@ static void nvme_tcp_error_recovery(struct nvme_ctrl *ctrl) |
3692 |
+ if (!nvme_change_ctrl_state(ctrl, NVME_CTRL_RESETTING)) |
3693 |
+ return; |
3694 |
+ |
3695 |
++ dev_warn(ctrl->device, "starting error recovery\n"); |
3696 |
+ queue_work(nvme_reset_wq, &to_tcp_ctrl(ctrl)->err_work); |
3697 |
+ } |
3698 |
+ |
3699 |
+@@ -1497,7 +1499,6 @@ static void nvme_tcp_stop_queue(struct nvme_ctrl *nctrl, int qid) |
3700 |
+ |
3701 |
+ if (!test_and_clear_bit(NVME_TCP_Q_LIVE, &queue->flags)) |
3702 |
+ return; |
3703 |
+- |
3704 |
+ __nvme_tcp_stop_queue(queue); |
3705 |
+ } |
3706 |
+ |
3707 |
+@@ -1752,7 +1753,15 @@ static int nvme_tcp_configure_io_queues(struct nvme_ctrl *ctrl, bool new) |
3708 |
+ |
3709 |
+ if (!new) { |
3710 |
+ nvme_start_queues(ctrl); |
3711 |
+- nvme_wait_freeze(ctrl); |
3712 |
++ if (!nvme_wait_freeze_timeout(ctrl, NVME_IO_TIMEOUT)) { |
3713 |
++ /* |
3714 |
++ * If we timed out waiting for freeze we are likely to |
3715 |
++ * be stuck. Fail the controller initialization just |
3716 |
++ * to be safe. |
3717 |
++ */ |
3718 |
++ ret = -ENODEV; |
3719 |
++ goto out_wait_freeze_timed_out; |
3720 |
++ } |
3721 |
+ blk_mq_update_nr_hw_queues(ctrl->tagset, |
3722 |
+ ctrl->queue_count - 1); |
3723 |
+ nvme_unfreeze(ctrl); |
3724 |
+@@ -1760,6 +1769,9 @@ static int nvme_tcp_configure_io_queues(struct nvme_ctrl *ctrl, bool new) |
3725 |
+ |
3726 |
+ return 0; |
3727 |
+ |
3728 |
++out_wait_freeze_timed_out: |
3729 |
++ nvme_stop_queues(ctrl); |
3730 |
++ nvme_tcp_stop_io_queues(ctrl); |
3731 |
+ out_cleanup_connect_q: |
3732 |
+ if (new) |
3733 |
+ blk_cleanup_queue(ctrl->connect_q); |
3734 |
+@@ -1845,6 +1857,7 @@ out_free_queue: |
3735 |
+ static void nvme_tcp_teardown_admin_queue(struct nvme_ctrl *ctrl, |
3736 |
+ bool remove) |
3737 |
+ { |
3738 |
++ mutex_lock(&to_tcp_ctrl(ctrl)->teardown_lock); |
3739 |
+ blk_mq_quiesce_queue(ctrl->admin_q); |
3740 |
+ nvme_tcp_stop_queue(ctrl, 0); |
3741 |
+ if (ctrl->admin_tagset) { |
3742 |
+@@ -1855,13 +1868,16 @@ static void nvme_tcp_teardown_admin_queue(struct nvme_ctrl *ctrl, |
3743 |
+ if (remove) |
3744 |
+ blk_mq_unquiesce_queue(ctrl->admin_q); |
3745 |
+ nvme_tcp_destroy_admin_queue(ctrl, remove); |
3746 |
++ mutex_unlock(&to_tcp_ctrl(ctrl)->teardown_lock); |
3747 |
+ } |
3748 |
+ |
3749 |
+ static void nvme_tcp_teardown_io_queues(struct nvme_ctrl *ctrl, |
3750 |
+ bool remove) |
3751 |
+ { |
3752 |
++ mutex_lock(&to_tcp_ctrl(ctrl)->teardown_lock); |
3753 |
+ if (ctrl->queue_count <= 1) |
3754 |
+- return; |
3755 |
++ goto out; |
3756 |
++ blk_mq_quiesce_queue(ctrl->admin_q); |
3757 |
+ nvme_start_freeze(ctrl); |
3758 |
+ nvme_stop_queues(ctrl); |
3759 |
+ nvme_tcp_stop_io_queues(ctrl); |
3760 |
+@@ -1873,6 +1889,8 @@ static void nvme_tcp_teardown_io_queues(struct nvme_ctrl *ctrl, |
3761 |
+ if (remove) |
3762 |
+ nvme_start_queues(ctrl); |
3763 |
+ nvme_tcp_destroy_io_queues(ctrl, remove); |
3764 |
++out: |
3765 |
++ mutex_unlock(&to_tcp_ctrl(ctrl)->teardown_lock); |
3766 |
+ } |
3767 |
+ |
3768 |
+ static void nvme_tcp_reconnect_or_remove(struct nvme_ctrl *ctrl) |
3769 |
+@@ -2119,40 +2137,55 @@ static void nvme_tcp_submit_async_event(struct nvme_ctrl *arg) |
3770 |
+ nvme_tcp_queue_request(&ctrl->async_req, true); |
3771 |
+ } |
3772 |
+ |
3773 |
++static void nvme_tcp_complete_timed_out(struct request *rq) |
3774 |
++{ |
3775 |
++ struct nvme_tcp_request *req = blk_mq_rq_to_pdu(rq); |
3776 |
++ struct nvme_ctrl *ctrl = &req->queue->ctrl->ctrl; |
3777 |
++ |
3778 |
++ /* fence other contexts that may complete the command */ |
3779 |
++ mutex_lock(&to_tcp_ctrl(ctrl)->teardown_lock); |
3780 |
++ nvme_tcp_stop_queue(ctrl, nvme_tcp_queue_id(req->queue)); |
3781 |
++ if (!blk_mq_request_completed(rq)) { |
3782 |
++ nvme_req(rq)->status = NVME_SC_HOST_ABORTED_CMD; |
3783 |
++ blk_mq_complete_request(rq); |
3784 |
++ } |
3785 |
++ mutex_unlock(&to_tcp_ctrl(ctrl)->teardown_lock); |
3786 |
++} |
3787 |
++ |
3788 |
+ static enum blk_eh_timer_return |
3789 |
+ nvme_tcp_timeout(struct request *rq, bool reserved) |
3790 |
+ { |
3791 |
+ struct nvme_tcp_request *req = blk_mq_rq_to_pdu(rq); |
3792 |
+- struct nvme_tcp_ctrl *ctrl = req->queue->ctrl; |
3793 |
++ struct nvme_ctrl *ctrl = &req->queue->ctrl->ctrl; |
3794 |
+ struct nvme_tcp_cmd_pdu *pdu = req->pdu; |
3795 |
+ |
3796 |
+- /* |
3797 |
+- * Restart the timer if a controller reset is already scheduled. Any |
3798 |
+- * timed out commands would be handled before entering the connecting |
3799 |
+- * state. |
3800 |
+- */ |
3801 |
+- if (ctrl->ctrl.state == NVME_CTRL_RESETTING) |
3802 |
+- return BLK_EH_RESET_TIMER; |
3803 |
+- |
3804 |
+- dev_warn(ctrl->ctrl.device, |
3805 |
++ dev_warn(ctrl->device, |
3806 |
+ "queue %d: timeout request %#x type %d\n", |
3807 |
+ nvme_tcp_queue_id(req->queue), rq->tag, pdu->hdr.type); |
3808 |
+ |
3809 |
+- if (ctrl->ctrl.state != NVME_CTRL_LIVE) { |
3810 |
++ if (ctrl->state != NVME_CTRL_LIVE) { |
3811 |
+ /* |
3812 |
+- * Teardown immediately if controller times out while starting |
3813 |
+- * or we are already started error recovery. all outstanding |
3814 |
+- * requests are completed on shutdown, so we return BLK_EH_DONE. |
3815 |
++ * If we are resetting, connecting or deleting we should |
3816 |
++ * complete immediately because we may block controller |
3817 |
++ * teardown or setup sequence |
3818 |
++ * - ctrl disable/shutdown fabrics requests |
3819 |
++ * - connect requests |
3820 |
++ * - initialization admin requests |
3821 |
++ * - I/O requests that entered after unquiescing and |
3822 |
++ * the controller stopped responding |
3823 |
++ * |
3824 |
++ * All other requests should be cancelled by the error |
3825 |
++ * recovery work, so it's fine that we fail it here. |
3826 |
+ */ |
3827 |
+- flush_work(&ctrl->err_work); |
3828 |
+- nvme_tcp_teardown_io_queues(&ctrl->ctrl, false); |
3829 |
+- nvme_tcp_teardown_admin_queue(&ctrl->ctrl, false); |
3830 |
++ nvme_tcp_complete_timed_out(rq); |
3831 |
+ return BLK_EH_DONE; |
3832 |
+ } |
3833 |
+ |
3834 |
+- dev_warn(ctrl->ctrl.device, "starting error recovery\n"); |
3835 |
+- nvme_tcp_error_recovery(&ctrl->ctrl); |
3836 |
+- |
3837 |
++ /* |
3838 |
++ * LIVE state should trigger the normal error recovery which will |
3839 |
++ * handle completing this request. |
3840 |
++ */ |
3841 |
++ nvme_tcp_error_recovery(ctrl); |
3842 |
+ return BLK_EH_RESET_TIMER; |
3843 |
+ } |
3844 |
+ |
3845 |
+@@ -2384,6 +2417,7 @@ static struct nvme_ctrl *nvme_tcp_create_ctrl(struct device *dev, |
3846 |
+ nvme_tcp_reconnect_ctrl_work); |
3847 |
+ INIT_WORK(&ctrl->err_work, nvme_tcp_error_recovery_work); |
3848 |
+ INIT_WORK(&ctrl->ctrl.reset_work, nvme_reset_ctrl_work); |
3849 |
++ mutex_init(&ctrl->teardown_lock); |
3850 |
+ |
3851 |
+ if (!(opts->mask & NVMF_OPT_TRSVCID)) { |
3852 |
+ opts->trsvcid = |
3853 |
+diff --git a/drivers/nvme/target/tcp.c b/drivers/nvme/target/tcp.c |
3854 |
+index de9217cfd22d7..3d29b773ced27 100644 |
3855 |
+--- a/drivers/nvme/target/tcp.c |
3856 |
++++ b/drivers/nvme/target/tcp.c |
3857 |
+@@ -160,6 +160,11 @@ static void nvmet_tcp_finish_cmd(struct nvmet_tcp_cmd *cmd); |
3858 |
+ static inline u16 nvmet_tcp_cmd_tag(struct nvmet_tcp_queue *queue, |
3859 |
+ struct nvmet_tcp_cmd *cmd) |
3860 |
+ { |
3861 |
++ if (unlikely(!queue->nr_cmds)) { |
3862 |
++ /* We didn't allocate cmds yet, send 0xffff */ |
3863 |
++ return USHRT_MAX; |
3864 |
++ } |
3865 |
++ |
3866 |
+ return cmd - queue->cmds; |
3867 |
+ } |
3868 |
+ |
3869 |
+@@ -872,7 +877,10 @@ static int nvmet_tcp_handle_h2c_data_pdu(struct nvmet_tcp_queue *queue) |
3870 |
+ struct nvme_tcp_data_pdu *data = &queue->pdu.data; |
3871 |
+ struct nvmet_tcp_cmd *cmd; |
3872 |
+ |
3873 |
+- cmd = &queue->cmds[data->ttag]; |
3874 |
++ if (likely(queue->nr_cmds)) |
3875 |
++ cmd = &queue->cmds[data->ttag]; |
3876 |
++ else |
3877 |
++ cmd = &queue->connect; |
3878 |
+ |
3879 |
+ if (le32_to_cpu(data->data_offset) != cmd->rbytes_done) { |
3880 |
+ pr_err("ttag %u unexpected data offset %u (expected %u)\n", |
3881 |
+diff --git a/drivers/phy/qualcomm/phy-qcom-qmp.c b/drivers/phy/qualcomm/phy-qcom-qmp.c |
3882 |
+index e91040af33945..ba277136f52b1 100644 |
3883 |
+--- a/drivers/phy/qualcomm/phy-qcom-qmp.c |
3884 |
++++ b/drivers/phy/qualcomm/phy-qcom-qmp.c |
3885 |
+@@ -504,8 +504,8 @@ static const struct qmp_phy_init_tbl ipq8074_pcie_serdes_tbl[] = { |
3886 |
+ QMP_PHY_INIT_CFG(QSERDES_COM_BG_TRIM, 0xf), |
3887 |
+ QMP_PHY_INIT_CFG(QSERDES_COM_LOCK_CMP_EN, 0x1), |
3888 |
+ QMP_PHY_INIT_CFG(QSERDES_COM_VCO_TUNE_MAP, 0x0), |
3889 |
+- QMP_PHY_INIT_CFG(QSERDES_COM_VCO_TUNE_TIMER1, 0x1f), |
3890 |
+- QMP_PHY_INIT_CFG(QSERDES_COM_VCO_TUNE_TIMER2, 0x3f), |
3891 |
++ QMP_PHY_INIT_CFG(QSERDES_COM_VCO_TUNE_TIMER1, 0xff), |
3892 |
++ QMP_PHY_INIT_CFG(QSERDES_COM_VCO_TUNE_TIMER2, 0x1f), |
3893 |
+ QMP_PHY_INIT_CFG(QSERDES_COM_CMN_CONFIG, 0x6), |
3894 |
+ QMP_PHY_INIT_CFG(QSERDES_COM_PLL_IVCO, 0xf), |
3895 |
+ QMP_PHY_INIT_CFG(QSERDES_COM_HSCLK_SEL, 0x0), |
3896 |
+@@ -531,7 +531,6 @@ static const struct qmp_phy_init_tbl ipq8074_pcie_serdes_tbl[] = { |
3897 |
+ QMP_PHY_INIT_CFG(QSERDES_COM_INTEGLOOP_GAIN1_MODE0, 0x0), |
3898 |
+ QMP_PHY_INIT_CFG(QSERDES_COM_INTEGLOOP_GAIN0_MODE0, 0x80), |
3899 |
+ QMP_PHY_INIT_CFG(QSERDES_COM_BIAS_EN_CTRL_BY_PSM, 0x1), |
3900 |
+- QMP_PHY_INIT_CFG(QSERDES_COM_VCO_TUNE_CTRL, 0xa), |
3901 |
+ QMP_PHY_INIT_CFG(QSERDES_COM_SSC_EN_CENTER, 0x1), |
3902 |
+ QMP_PHY_INIT_CFG(QSERDES_COM_SSC_PER1, 0x31), |
3903 |
+ QMP_PHY_INIT_CFG(QSERDES_COM_SSC_PER2, 0x1), |
3904 |
+@@ -540,7 +539,6 @@ static const struct qmp_phy_init_tbl ipq8074_pcie_serdes_tbl[] = { |
3905 |
+ QMP_PHY_INIT_CFG(QSERDES_COM_SSC_STEP_SIZE1, 0x2f), |
3906 |
+ QMP_PHY_INIT_CFG(QSERDES_COM_SSC_STEP_SIZE2, 0x19), |
3907 |
+ QMP_PHY_INIT_CFG(QSERDES_COM_CLK_EP_DIV, 0x19), |
3908 |
+- QMP_PHY_INIT_CFG(QSERDES_RX_SIGDET_CNTRL, 0x7), |
3909 |
+ }; |
3910 |
+ |
3911 |
+ static const struct qmp_phy_init_tbl ipq8074_pcie_tx_tbl[] = { |
3912 |
+@@ -548,6 +546,8 @@ static const struct qmp_phy_init_tbl ipq8074_pcie_tx_tbl[] = { |
3913 |
+ QMP_PHY_INIT_CFG(QSERDES_TX_LANE_MODE, 0x6), |
3914 |
+ QMP_PHY_INIT_CFG(QSERDES_TX_RES_CODE_LANE_OFFSET, 0x2), |
3915 |
+ QMP_PHY_INIT_CFG(QSERDES_TX_RCV_DETECT_LVL_2, 0x12), |
3916 |
++ QMP_PHY_INIT_CFG(QSERDES_TX_EMP_POST1_LVL, 0x36), |
3917 |
++ QMP_PHY_INIT_CFG(QSERDES_TX_SLEW_CNTL, 0x0a), |
3918 |
+ }; |
3919 |
+ |
3920 |
+ static const struct qmp_phy_init_tbl ipq8074_pcie_rx_tbl[] = { |
3921 |
+@@ -558,7 +558,6 @@ static const struct qmp_phy_init_tbl ipq8074_pcie_rx_tbl[] = { |
3922 |
+ QMP_PHY_INIT_CFG(QSERDES_RX_RX_EQU_ADAPTOR_CNTRL4, 0xdb), |
3923 |
+ QMP_PHY_INIT_CFG(QSERDES_RX_UCDR_SO_SATURATION_AND_ENABLE, 0x4b), |
3924 |
+ QMP_PHY_INIT_CFG(QSERDES_RX_UCDR_SO_GAIN, 0x4), |
3925 |
+- QMP_PHY_INIT_CFG(QSERDES_RX_UCDR_SO_GAIN_HALF, 0x4), |
3926 |
+ }; |
3927 |
+ |
3928 |
+ static const struct qmp_phy_init_tbl ipq8074_pcie_pcs_tbl[] = { |
3929 |
+@@ -1673,6 +1672,9 @@ static const struct qmp_phy_cfg msm8996_usb3phy_cfg = { |
3930 |
+ .pwrdn_ctrl = SW_PWRDN, |
3931 |
+ }; |
3932 |
+ |
3933 |
++static const char * const ipq8074_pciephy_clk_l[] = { |
3934 |
++ "aux", "cfg_ahb", |
3935 |
++}; |
3936 |
+ /* list of resets */ |
3937 |
+ static const char * const ipq8074_pciephy_reset_l[] = { |
3938 |
+ "phy", "common", |
3939 |
+@@ -1690,8 +1692,8 @@ static const struct qmp_phy_cfg ipq8074_pciephy_cfg = { |
3940 |
+ .rx_tbl_num = ARRAY_SIZE(ipq8074_pcie_rx_tbl), |
3941 |
+ .pcs_tbl = ipq8074_pcie_pcs_tbl, |
3942 |
+ .pcs_tbl_num = ARRAY_SIZE(ipq8074_pcie_pcs_tbl), |
3943 |
+- .clk_list = NULL, |
3944 |
+- .num_clks = 0, |
3945 |
++ .clk_list = ipq8074_pciephy_clk_l, |
3946 |
++ .num_clks = ARRAY_SIZE(ipq8074_pciephy_clk_l), |
3947 |
+ .reset_list = ipq8074_pciephy_reset_l, |
3948 |
+ .num_resets = ARRAY_SIZE(ipq8074_pciephy_reset_l), |
3949 |
+ .vreg_list = NULL, |
3950 |
+diff --git a/drivers/phy/qualcomm/phy-qcom-qmp.h b/drivers/phy/qualcomm/phy-qcom-qmp.h |
3951 |
+index 6d017a0c0c8d9..832b3d0984033 100644 |
3952 |
+--- a/drivers/phy/qualcomm/phy-qcom-qmp.h |
3953 |
++++ b/drivers/phy/qualcomm/phy-qcom-qmp.h |
3954 |
+@@ -77,6 +77,8 @@ |
3955 |
+ #define QSERDES_COM_CORECLK_DIV_MODE1 0x1bc |
3956 |
+ |
3957 |
+ /* Only for QMP V2 PHY - TX registers */ |
3958 |
++#define QSERDES_TX_EMP_POST1_LVL 0x018 |
3959 |
++#define QSERDES_TX_SLEW_CNTL 0x040 |
3960 |
+ #define QSERDES_TX_RES_CODE_LANE_OFFSET 0x054 |
3961 |
+ #define QSERDES_TX_DEBUG_BUS_SEL 0x064 |
3962 |
+ #define QSERDES_TX_HIGHZ_TRANSCEIVEREN_BIAS_DRVR_EN 0x068 |
3963 |
+diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c |
3964 |
+index 720f28844795b..be8c709a74883 100644 |
3965 |
+--- a/drivers/regulator/core.c |
3966 |
++++ b/drivers/regulator/core.c |
3967 |
+@@ -235,8 +235,8 @@ static bool regulator_supply_is_couple(struct regulator_dev *rdev) |
3968 |
+ static void regulator_unlock_recursive(struct regulator_dev *rdev, |
3969 |
+ unsigned int n_coupled) |
3970 |
+ { |
3971 |
+- struct regulator_dev *c_rdev; |
3972 |
+- int i; |
3973 |
++ struct regulator_dev *c_rdev, *supply_rdev; |
3974 |
++ int i, supply_n_coupled; |
3975 |
+ |
3976 |
+ for (i = n_coupled; i > 0; i--) { |
3977 |
+ c_rdev = rdev->coupling_desc.coupled_rdevs[i - 1]; |
3978 |
+@@ -244,10 +244,13 @@ static void regulator_unlock_recursive(struct regulator_dev *rdev, |
3979 |
+ if (!c_rdev) |
3980 |
+ continue; |
3981 |
+ |
3982 |
+- if (c_rdev->supply && !regulator_supply_is_couple(c_rdev)) |
3983 |
+- regulator_unlock_recursive( |
3984 |
+- c_rdev->supply->rdev, |
3985 |
+- c_rdev->coupling_desc.n_coupled); |
3986 |
++ if (c_rdev->supply && !regulator_supply_is_couple(c_rdev)) { |
3987 |
++ supply_rdev = c_rdev->supply->rdev; |
3988 |
++ supply_n_coupled = supply_rdev->coupling_desc.n_coupled; |
3989 |
++ |
3990 |
++ regulator_unlock_recursive(supply_rdev, |
3991 |
++ supply_n_coupled); |
3992 |
++ } |
3993 |
+ |
3994 |
+ regulator_unlock(c_rdev); |
3995 |
+ } |
3996 |
+@@ -1460,7 +1463,7 @@ static int set_consumer_device_supply(struct regulator_dev *rdev, |
3997 |
+ const char *consumer_dev_name, |
3998 |
+ const char *supply) |
3999 |
+ { |
4000 |
+- struct regulator_map *node; |
4001 |
++ struct regulator_map *node, *new_node; |
4002 |
+ int has_dev; |
4003 |
+ |
4004 |
+ if (supply == NULL) |
4005 |
+@@ -1471,6 +1474,22 @@ static int set_consumer_device_supply(struct regulator_dev *rdev, |
4006 |
+ else |
4007 |
+ has_dev = 0; |
4008 |
+ |
4009 |
++ new_node = kzalloc(sizeof(struct regulator_map), GFP_KERNEL); |
4010 |
++ if (new_node == NULL) |
4011 |
++ return -ENOMEM; |
4012 |
++ |
4013 |
++ new_node->regulator = rdev; |
4014 |
++ new_node->supply = supply; |
4015 |
++ |
4016 |
++ if (has_dev) { |
4017 |
++ new_node->dev_name = kstrdup(consumer_dev_name, GFP_KERNEL); |
4018 |
++ if (new_node->dev_name == NULL) { |
4019 |
++ kfree(new_node); |
4020 |
++ return -ENOMEM; |
4021 |
++ } |
4022 |
++ } |
4023 |
++ |
4024 |
++ mutex_lock(®ulator_list_mutex); |
4025 |
+ list_for_each_entry(node, ®ulator_map_list, list) { |
4026 |
+ if (node->dev_name && consumer_dev_name) { |
4027 |
+ if (strcmp(node->dev_name, consumer_dev_name) != 0) |
4028 |
+@@ -1488,26 +1507,19 @@ static int set_consumer_device_supply(struct regulator_dev *rdev, |
4029 |
+ node->regulator->desc->name, |
4030 |
+ supply, |
4031 |
+ dev_name(&rdev->dev), rdev_get_name(rdev)); |
4032 |
+- return -EBUSY; |
4033 |
++ goto fail; |
4034 |
+ } |
4035 |
+ |
4036 |
+- node = kzalloc(sizeof(struct regulator_map), GFP_KERNEL); |
4037 |
+- if (node == NULL) |
4038 |
+- return -ENOMEM; |
4039 |
+- |
4040 |
+- node->regulator = rdev; |
4041 |
+- node->supply = supply; |
4042 |
+- |
4043 |
+- if (has_dev) { |
4044 |
+- node->dev_name = kstrdup(consumer_dev_name, GFP_KERNEL); |
4045 |
+- if (node->dev_name == NULL) { |
4046 |
+- kfree(node); |
4047 |
+- return -ENOMEM; |
4048 |
+- } |
4049 |
+- } |
4050 |
++ list_add(&new_node->list, ®ulator_map_list); |
4051 |
++ mutex_unlock(®ulator_list_mutex); |
4052 |
+ |
4053 |
+- list_add(&node->list, ®ulator_map_list); |
4054 |
+ return 0; |
4055 |
++ |
4056 |
++fail: |
4057 |
++ mutex_unlock(®ulator_list_mutex); |
4058 |
++ kfree(new_node->dev_name); |
4059 |
++ kfree(new_node); |
4060 |
++ return -EBUSY; |
4061 |
+ } |
4062 |
+ |
4063 |
+ static void unset_regulator_supplies(struct regulator_dev *rdev) |
4064 |
+@@ -1579,44 +1591,53 @@ static struct regulator *create_regulator(struct regulator_dev *rdev, |
4065 |
+ const char *supply_name) |
4066 |
+ { |
4067 |
+ struct regulator *regulator; |
4068 |
+- char buf[REG_STR_SIZE]; |
4069 |
+- int err, size; |
4070 |
++ int err; |
4071 |
++ |
4072 |
++ if (dev) { |
4073 |
++ char buf[REG_STR_SIZE]; |
4074 |
++ int size; |
4075 |
++ |
4076 |
++ size = snprintf(buf, REG_STR_SIZE, "%s-%s", |
4077 |
++ dev->kobj.name, supply_name); |
4078 |
++ if (size >= REG_STR_SIZE) |
4079 |
++ return NULL; |
4080 |
++ |
4081 |
++ supply_name = kstrdup(buf, GFP_KERNEL); |
4082 |
++ if (supply_name == NULL) |
4083 |
++ return NULL; |
4084 |
++ } else { |
4085 |
++ supply_name = kstrdup_const(supply_name, GFP_KERNEL); |
4086 |
++ if (supply_name == NULL) |
4087 |
++ return NULL; |
4088 |
++ } |
4089 |
+ |
4090 |
+ regulator = kzalloc(sizeof(*regulator), GFP_KERNEL); |
4091 |
+- if (regulator == NULL) |
4092 |
++ if (regulator == NULL) { |
4093 |
++ kfree(supply_name); |
4094 |
+ return NULL; |
4095 |
++ } |
4096 |
+ |
4097 |
+- regulator_lock(rdev); |
4098 |
+ regulator->rdev = rdev; |
4099 |
++ regulator->supply_name = supply_name; |
4100 |
++ |
4101 |
++ regulator_lock(rdev); |
4102 |
+ list_add(®ulator->list, &rdev->consumer_list); |
4103 |
++ regulator_unlock(rdev); |
4104 |
+ |
4105 |
+ if (dev) { |
4106 |
+ regulator->dev = dev; |
4107 |
+ |
4108 |
+ /* Add a link to the device sysfs entry */ |
4109 |
+- size = snprintf(buf, REG_STR_SIZE, "%s-%s", |
4110 |
+- dev->kobj.name, supply_name); |
4111 |
+- if (size >= REG_STR_SIZE) |
4112 |
+- goto overflow_err; |
4113 |
+- |
4114 |
+- regulator->supply_name = kstrdup(buf, GFP_KERNEL); |
4115 |
+- if (regulator->supply_name == NULL) |
4116 |
+- goto overflow_err; |
4117 |
+- |
4118 |
+ err = sysfs_create_link_nowarn(&rdev->dev.kobj, &dev->kobj, |
4119 |
+- buf); |
4120 |
++ supply_name); |
4121 |
+ if (err) { |
4122 |
+ rdev_dbg(rdev, "could not add device link %s err %d\n", |
4123 |
+ dev->kobj.name, err); |
4124 |
+ /* non-fatal */ |
4125 |
+ } |
4126 |
+- } else { |
4127 |
+- regulator->supply_name = kstrdup_const(supply_name, GFP_KERNEL); |
4128 |
+- if (regulator->supply_name == NULL) |
4129 |
+- goto overflow_err; |
4130 |
+ } |
4131 |
+ |
4132 |
+- regulator->debugfs = debugfs_create_dir(regulator->supply_name, |
4133 |
++ regulator->debugfs = debugfs_create_dir(supply_name, |
4134 |
+ rdev->debugfs); |
4135 |
+ if (!regulator->debugfs) { |
4136 |
+ rdev_dbg(rdev, "Failed to create debugfs directory\n"); |
4137 |
+@@ -1641,13 +1662,7 @@ static struct regulator *create_regulator(struct regulator_dev *rdev, |
4138 |
+ _regulator_is_enabled(rdev)) |
4139 |
+ regulator->always_on = true; |
4140 |
+ |
4141 |
+- regulator_unlock(rdev); |
4142 |
+ return regulator; |
4143 |
+-overflow_err: |
4144 |
+- list_del(®ulator->list); |
4145 |
+- kfree(regulator); |
4146 |
+- regulator_unlock(rdev); |
4147 |
+- return NULL; |
4148 |
+ } |
4149 |
+ |
4150 |
+ static int _regulator_get_enable_time(struct regulator_dev *rdev) |
4151 |
+@@ -2222,10 +2237,13 @@ EXPORT_SYMBOL_GPL(regulator_bulk_unregister_supply_alias); |
4152 |
+ static int regulator_ena_gpio_request(struct regulator_dev *rdev, |
4153 |
+ const struct regulator_config *config) |
4154 |
+ { |
4155 |
+- struct regulator_enable_gpio *pin; |
4156 |
++ struct regulator_enable_gpio *pin, *new_pin; |
4157 |
+ struct gpio_desc *gpiod; |
4158 |
+ |
4159 |
+ gpiod = config->ena_gpiod; |
4160 |
++ new_pin = kzalloc(sizeof(*new_pin), GFP_KERNEL); |
4161 |
++ |
4162 |
++ mutex_lock(®ulator_list_mutex); |
4163 |
+ |
4164 |
+ list_for_each_entry(pin, ®ulator_ena_gpio_list, list) { |
4165 |
+ if (pin->gpiod == gpiod) { |
4166 |
+@@ -2234,9 +2252,13 @@ static int regulator_ena_gpio_request(struct regulator_dev *rdev, |
4167 |
+ } |
4168 |
+ } |
4169 |
+ |
4170 |
+- pin = kzalloc(sizeof(struct regulator_enable_gpio), GFP_KERNEL); |
4171 |
+- if (pin == NULL) |
4172 |
++ if (new_pin == NULL) { |
4173 |
++ mutex_unlock(®ulator_list_mutex); |
4174 |
+ return -ENOMEM; |
4175 |
++ } |
4176 |
++ |
4177 |
++ pin = new_pin; |
4178 |
++ new_pin = NULL; |
4179 |
+ |
4180 |
+ pin->gpiod = gpiod; |
4181 |
+ list_add(&pin->list, ®ulator_ena_gpio_list); |
4182 |
+@@ -2244,6 +2266,10 @@ static int regulator_ena_gpio_request(struct regulator_dev *rdev, |
4183 |
+ update_ena_gpio_to_rdev: |
4184 |
+ pin->request_count++; |
4185 |
+ rdev->ena_pin = pin; |
4186 |
++ |
4187 |
++ mutex_unlock(®ulator_list_mutex); |
4188 |
++ kfree(new_pin); |
4189 |
++ |
4190 |
+ return 0; |
4191 |
+ } |
4192 |
+ |
4193 |
+@@ -4880,13 +4906,9 @@ static void regulator_resolve_coupling(struct regulator_dev *rdev) |
4194 |
+ return; |
4195 |
+ } |
4196 |
+ |
4197 |
+- regulator_lock(c_rdev); |
4198 |
+- |
4199 |
+ c_desc->coupled_rdevs[i] = c_rdev; |
4200 |
+ c_desc->n_resolved++; |
4201 |
+ |
4202 |
+- regulator_unlock(c_rdev); |
4203 |
+- |
4204 |
+ regulator_resolve_coupling(c_rdev); |
4205 |
+ } |
4206 |
+ } |
4207 |
+@@ -4971,7 +4993,10 @@ static int regulator_init_coupling(struct regulator_dev *rdev) |
4208 |
+ if (!of_check_coupling_data(rdev)) |
4209 |
+ return -EPERM; |
4210 |
+ |
4211 |
++ mutex_lock(®ulator_list_mutex); |
4212 |
+ rdev->coupling_desc.coupler = regulator_find_coupler(rdev); |
4213 |
++ mutex_unlock(®ulator_list_mutex); |
4214 |
++ |
4215 |
+ if (IS_ERR(rdev->coupling_desc.coupler)) { |
4216 |
+ err = PTR_ERR(rdev->coupling_desc.coupler); |
4217 |
+ rdev_err(rdev, "failed to get coupler: %d\n", err); |
4218 |
+@@ -5072,6 +5097,7 @@ regulator_register(const struct regulator_desc *regulator_desc, |
4219 |
+ ret = -ENOMEM; |
4220 |
+ goto rinse; |
4221 |
+ } |
4222 |
++ device_initialize(&rdev->dev); |
4223 |
+ |
4224 |
+ /* |
4225 |
+ * Duplicate the config so the driver could override it after |
4226 |
+@@ -5079,9 +5105,8 @@ regulator_register(const struct regulator_desc *regulator_desc, |
4227 |
+ */ |
4228 |
+ config = kmemdup(cfg, sizeof(*cfg), GFP_KERNEL); |
4229 |
+ if (config == NULL) { |
4230 |
+- kfree(rdev); |
4231 |
+ ret = -ENOMEM; |
4232 |
+- goto rinse; |
4233 |
++ goto clean; |
4234 |
+ } |
4235 |
+ |
4236 |
+ init_data = regulator_of_get_init_data(dev, regulator_desc, config, |
4237 |
+@@ -5093,10 +5118,8 @@ regulator_register(const struct regulator_desc *regulator_desc, |
4238 |
+ * from a gpio extender or something else. |
4239 |
+ */ |
4240 |
+ if (PTR_ERR(init_data) == -EPROBE_DEFER) { |
4241 |
+- kfree(config); |
4242 |
+- kfree(rdev); |
4243 |
+ ret = -EPROBE_DEFER; |
4244 |
+- goto rinse; |
4245 |
++ goto clean; |
4246 |
+ } |
4247 |
+ |
4248 |
+ /* |
4249 |
+@@ -5137,9 +5160,7 @@ regulator_register(const struct regulator_desc *regulator_desc, |
4250 |
+ } |
4251 |
+ |
4252 |
+ if (config->ena_gpiod) { |
4253 |
+- mutex_lock(®ulator_list_mutex); |
4254 |
+ ret = regulator_ena_gpio_request(rdev, config); |
4255 |
+- mutex_unlock(®ulator_list_mutex); |
4256 |
+ if (ret != 0) { |
4257 |
+ rdev_err(rdev, "Failed to request enable GPIO: %d\n", |
4258 |
+ ret); |
4259 |
+@@ -5151,7 +5172,6 @@ regulator_register(const struct regulator_desc *regulator_desc, |
4260 |
+ } |
4261 |
+ |
4262 |
+ /* register with sysfs */ |
4263 |
+- device_initialize(&rdev->dev); |
4264 |
+ rdev->dev.class = ®ulator_class; |
4265 |
+ rdev->dev.parent = dev; |
4266 |
+ dev_set_name(&rdev->dev, "regulator.%lu", |
4267 |
+@@ -5179,27 +5199,22 @@ regulator_register(const struct regulator_desc *regulator_desc, |
4268 |
+ if (ret < 0) |
4269 |
+ goto wash; |
4270 |
+ |
4271 |
+- mutex_lock(®ulator_list_mutex); |
4272 |
+ ret = regulator_init_coupling(rdev); |
4273 |
+- mutex_unlock(®ulator_list_mutex); |
4274 |
+ if (ret < 0) |
4275 |
+ goto wash; |
4276 |
+ |
4277 |
+ /* add consumers devices */ |
4278 |
+ if (init_data) { |
4279 |
+- mutex_lock(®ulator_list_mutex); |
4280 |
+ for (i = 0; i < init_data->num_consumer_supplies; i++) { |
4281 |
+ ret = set_consumer_device_supply(rdev, |
4282 |
+ init_data->consumer_supplies[i].dev_name, |
4283 |
+ init_data->consumer_supplies[i].supply); |
4284 |
+ if (ret < 0) { |
4285 |
+- mutex_unlock(®ulator_list_mutex); |
4286 |
+ dev_err(dev, "Failed to set supply %s\n", |
4287 |
+ init_data->consumer_supplies[i].supply); |
4288 |
+ goto unset_supplies; |
4289 |
+ } |
4290 |
+ } |
4291 |
+- mutex_unlock(®ulator_list_mutex); |
4292 |
+ } |
4293 |
+ |
4294 |
+ if (!rdev->desc->ops->get_voltage && |
4295 |
+@@ -5234,13 +5249,11 @@ wash: |
4296 |
+ mutex_lock(®ulator_list_mutex); |
4297 |
+ regulator_ena_gpio_free(rdev); |
4298 |
+ mutex_unlock(®ulator_list_mutex); |
4299 |
+- put_device(&rdev->dev); |
4300 |
+- rdev = NULL; |
4301 |
+ clean: |
4302 |
+ if (dangling_of_gpiod) |
4303 |
+ gpiod_put(config->ena_gpiod); |
4304 |
+- kfree(rdev); |
4305 |
+ kfree(config); |
4306 |
++ put_device(&rdev->dev); |
4307 |
+ rinse: |
4308 |
+ if (dangling_cfg_gpiod) |
4309 |
+ gpiod_put(cfg->ena_gpiod); |
4310 |
+diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c |
4311 |
+index 5d716d3887071..6de4bc77fd55c 100644 |
4312 |
+--- a/drivers/scsi/libsas/sas_ata.c |
4313 |
++++ b/drivers/scsi/libsas/sas_ata.c |
4314 |
+@@ -209,7 +209,10 @@ static unsigned int sas_ata_qc_issue(struct ata_queued_cmd *qc) |
4315 |
+ task->num_scatter = si; |
4316 |
+ } |
4317 |
+ |
4318 |
+- task->data_dir = qc->dma_dir; |
4319 |
++ if (qc->tf.protocol == ATA_PROT_NODATA) |
4320 |
++ task->data_dir = DMA_NONE; |
4321 |
++ else |
4322 |
++ task->data_dir = qc->dma_dir; |
4323 |
+ task->scatter = qc->sg; |
4324 |
+ task->ata_task.retry_count = 1; |
4325 |
+ task->task_state_flags = SAS_TASK_STATE_PENDING; |
4326 |
+diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c |
4327 |
+index 6637f84a3d1bc..0dd6cc0ccdf2d 100644 |
4328 |
+--- a/drivers/scsi/lpfc/lpfc_init.c |
4329 |
++++ b/drivers/scsi/lpfc/lpfc_init.c |
4330 |
+@@ -11257,7 +11257,6 @@ lpfc_irq_clear_aff(struct lpfc_hba_eq_hdl *eqhdl) |
4331 |
+ { |
4332 |
+ cpumask_clear(&eqhdl->aff_mask); |
4333 |
+ irq_clear_status_flags(eqhdl->irq, IRQ_NO_BALANCING); |
4334 |
+- irq_set_affinity_hint(eqhdl->irq, &eqhdl->aff_mask); |
4335 |
+ } |
4336 |
+ |
4337 |
+ /** |
4338 |
+diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c |
4339 |
+index fcf03f733e417..1a0e2e4342ad8 100644 |
4340 |
+--- a/drivers/scsi/megaraid/megaraid_sas_fusion.c |
4341 |
++++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c |
4342 |
+@@ -3690,7 +3690,7 @@ int megasas_irqpoll(struct irq_poll *irqpoll, int budget) |
4343 |
+ instance = irq_ctx->instance; |
4344 |
+ |
4345 |
+ if (irq_ctx->irq_line_enable) { |
4346 |
+- disable_irq(irq_ctx->os_irq); |
4347 |
++ disable_irq_nosync(irq_ctx->os_irq); |
4348 |
+ irq_ctx->irq_line_enable = false; |
4349 |
+ } |
4350 |
+ |
4351 |
+diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c |
4352 |
+index 96b78fdc6b8a9..a85c9672c6ea3 100644 |
4353 |
+--- a/drivers/scsi/mpt3sas/mpt3sas_base.c |
4354 |
++++ b/drivers/scsi/mpt3sas/mpt3sas_base.c |
4355 |
+@@ -1732,7 +1732,7 @@ _base_irqpoll(struct irq_poll *irqpoll, int budget) |
4356 |
+ reply_q = container_of(irqpoll, struct adapter_reply_queue, |
4357 |
+ irqpoll); |
4358 |
+ if (reply_q->irq_line_enable) { |
4359 |
+- disable_irq(reply_q->os_irq); |
4360 |
++ disable_irq_nosync(reply_q->os_irq); |
4361 |
+ reply_q->irq_line_enable = false; |
4362 |
+ } |
4363 |
+ num_entries = _base_process_reply_queue(reply_q); |
4364 |
+diff --git a/drivers/scsi/qedf/qedf_main.c b/drivers/scsi/qedf/qedf_main.c |
4365 |
+index 36b1ca2dadbb5..51cfab9d1afdc 100644 |
4366 |
+--- a/drivers/scsi/qedf/qedf_main.c |
4367 |
++++ b/drivers/scsi/qedf/qedf_main.c |
4368 |
+@@ -3843,7 +3843,7 @@ void qedf_stag_change_work(struct work_struct *work) |
4369 |
+ container_of(work, struct qedf_ctx, stag_work.work); |
4370 |
+ |
4371 |
+ if (!qedf) { |
4372 |
+- QEDF_ERR(&qedf->dbg_ctx, "qedf is NULL"); |
4373 |
++ QEDF_ERR(NULL, "qedf is NULL"); |
4374 |
+ return; |
4375 |
+ } |
4376 |
+ QEDF_ERR(&qedf->dbg_ctx, "Performing software context reset.\n"); |
4377 |
+diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h |
4378 |
+index 42dbf90d46510..392312333746f 100644 |
4379 |
+--- a/drivers/scsi/qla2xxx/qla_def.h |
4380 |
++++ b/drivers/scsi/qla2xxx/qla_def.h |
4381 |
+@@ -1605,7 +1605,7 @@ typedef struct { |
4382 |
+ */ |
4383 |
+ uint8_t firmware_options[2]; |
4384 |
+ |
4385 |
+- uint16_t frame_payload_size; |
4386 |
++ __le16 frame_payload_size; |
4387 |
+ __le16 max_iocb_allocation; |
4388 |
+ __le16 execution_throttle; |
4389 |
+ uint8_t retry_count; |
4390 |
+diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c |
4391 |
+index 2436a17f5cd91..2861c636dd651 100644 |
4392 |
+--- a/drivers/scsi/qla2xxx/qla_init.c |
4393 |
++++ b/drivers/scsi/qla2xxx/qla_init.c |
4394 |
+@@ -4603,18 +4603,18 @@ qla2x00_nvram_config(scsi_qla_host_t *vha) |
4395 |
+ nv->firmware_options[1] = BIT_7 | BIT_5; |
4396 |
+ nv->add_firmware_options[0] = BIT_5; |
4397 |
+ nv->add_firmware_options[1] = BIT_5 | BIT_4; |
4398 |
+- nv->frame_payload_size = 2048; |
4399 |
++ nv->frame_payload_size = cpu_to_le16(2048); |
4400 |
+ nv->special_options[1] = BIT_7; |
4401 |
+ } else if (IS_QLA2200(ha)) { |
4402 |
+ nv->firmware_options[0] = BIT_2 | BIT_1; |
4403 |
+ nv->firmware_options[1] = BIT_7 | BIT_5; |
4404 |
+ nv->add_firmware_options[0] = BIT_5; |
4405 |
+ nv->add_firmware_options[1] = BIT_5 | BIT_4; |
4406 |
+- nv->frame_payload_size = 1024; |
4407 |
++ nv->frame_payload_size = cpu_to_le16(1024); |
4408 |
+ } else if (IS_QLA2100(ha)) { |
4409 |
+ nv->firmware_options[0] = BIT_3 | BIT_1; |
4410 |
+ nv->firmware_options[1] = BIT_5; |
4411 |
+- nv->frame_payload_size = 1024; |
4412 |
++ nv->frame_payload_size = cpu_to_le16(1024); |
4413 |
+ } |
4414 |
+ |
4415 |
+ nv->max_iocb_allocation = cpu_to_le16(256); |
4416 |
+diff --git a/drivers/soundwire/stream.c b/drivers/soundwire/stream.c |
4417 |
+index a9a72574b34ab..684761e86d4fc 100644 |
4418 |
+--- a/drivers/soundwire/stream.c |
4419 |
++++ b/drivers/soundwire/stream.c |
4420 |
+@@ -716,6 +716,7 @@ error: |
4421 |
+ kfree(wbuf); |
4422 |
+ error_1: |
4423 |
+ kfree(wr_msg); |
4424 |
++ bus->defer_msg.msg = NULL; |
4425 |
+ return ret; |
4426 |
+ } |
4427 |
+ |
4428 |
+@@ -839,9 +840,10 @@ static int do_bank_switch(struct sdw_stream_runtime *stream) |
4429 |
+ error: |
4430 |
+ list_for_each_entry(m_rt, &stream->master_list, stream_node) { |
4431 |
+ bus = m_rt->bus; |
4432 |
+- |
4433 |
+- kfree(bus->defer_msg.msg->buf); |
4434 |
+- kfree(bus->defer_msg.msg); |
4435 |
++ if (bus->defer_msg.msg) { |
4436 |
++ kfree(bus->defer_msg.msg->buf); |
4437 |
++ kfree(bus->defer_msg.msg); |
4438 |
++ } |
4439 |
+ } |
4440 |
+ |
4441 |
+ msg_unlock: |
4442 |
+diff --git a/drivers/spi/spi-stm32.c b/drivers/spi/spi-stm32.c |
4443 |
+index d4b33b358a31e..3056428b09f31 100644 |
4444 |
+--- a/drivers/spi/spi-stm32.c |
4445 |
++++ b/drivers/spi/spi-stm32.c |
4446 |
+@@ -936,7 +936,11 @@ static irqreturn_t stm32h7_spi_irq_thread(int irq, void *dev_id) |
4447 |
+ } |
4448 |
+ |
4449 |
+ if (sr & STM32H7_SPI_SR_SUSP) { |
4450 |
+- dev_warn(spi->dev, "Communication suspended\n"); |
4451 |
++ static DEFINE_RATELIMIT_STATE(rs, |
4452 |
++ DEFAULT_RATELIMIT_INTERVAL * 10, |
4453 |
++ 1); |
4454 |
++ if (__ratelimit(&rs)) |
4455 |
++ dev_dbg_ratelimited(spi->dev, "Communication suspended\n"); |
4456 |
+ if (!spi->cur_usedma && (spi->rx_buf && (spi->rx_len > 0))) |
4457 |
+ stm32h7_spi_read_rxfifo(spi, false); |
4458 |
+ /* |
4459 |
+@@ -2060,7 +2064,7 @@ static int stm32_spi_resume(struct device *dev) |
4460 |
+ } |
4461 |
+ |
4462 |
+ ret = pm_runtime_get_sync(dev); |
4463 |
+- if (ret) { |
4464 |
++ if (ret < 0) { |
4465 |
+ dev_err(dev, "Unable to power device:%d\n", ret); |
4466 |
+ return ret; |
4467 |
+ } |
4468 |
+diff --git a/drivers/staging/greybus/audio_topology.c b/drivers/staging/greybus/audio_topology.c |
4469 |
+index 4ac30accf226a..cc329b990e165 100644 |
4470 |
+--- a/drivers/staging/greybus/audio_topology.c |
4471 |
++++ b/drivers/staging/greybus/audio_topology.c |
4472 |
+@@ -460,6 +460,15 @@ static int gbcodec_mixer_dapm_ctl_put(struct snd_kcontrol *kcontrol, |
4473 |
+ val = ucontrol->value.integer.value[0] & mask; |
4474 |
+ connect = !!val; |
4475 |
+ |
4476 |
++ ret = gb_pm_runtime_get_sync(bundle); |
4477 |
++ if (ret) |
4478 |
++ return ret; |
4479 |
++ |
4480 |
++ ret = gb_audio_gb_get_control(module->mgmt_connection, data->ctl_id, |
4481 |
++ GB_AUDIO_INVALID_INDEX, &gbvalue); |
4482 |
++ if (ret) |
4483 |
++ goto exit; |
4484 |
++ |
4485 |
+ /* update ucontrol */ |
4486 |
+ if (gbvalue.value.integer_value[0] != val) { |
4487 |
+ for (wi = 0; wi < wlist->num_widgets; wi++) { |
4488 |
+@@ -473,25 +482,17 @@ static int gbcodec_mixer_dapm_ctl_put(struct snd_kcontrol *kcontrol, |
4489 |
+ gbvalue.value.integer_value[0] = |
4490 |
+ cpu_to_le32(ucontrol->value.integer.value[0]); |
4491 |
+ |
4492 |
+- ret = gb_pm_runtime_get_sync(bundle); |
4493 |
+- if (ret) |
4494 |
+- return ret; |
4495 |
+- |
4496 |
+ ret = gb_audio_gb_set_control(module->mgmt_connection, |
4497 |
+ data->ctl_id, |
4498 |
+ GB_AUDIO_INVALID_INDEX, &gbvalue); |
4499 |
+- |
4500 |
+- gb_pm_runtime_put_autosuspend(bundle); |
4501 |
+- |
4502 |
+- if (ret) { |
4503 |
+- dev_err_ratelimited(codec->dev, |
4504 |
+- "%d:Error in %s for %s\n", ret, |
4505 |
+- __func__, kcontrol->id.name); |
4506 |
+- return ret; |
4507 |
+- } |
4508 |
+ } |
4509 |
+ |
4510 |
+- return 0; |
4511 |
++exit: |
4512 |
++ gb_pm_runtime_put_autosuspend(bundle); |
4513 |
++ if (ret) |
4514 |
++ dev_err_ratelimited(codec_dev, "%d:Error in %s for %s\n", ret, |
4515 |
++ __func__, kcontrol->id.name); |
4516 |
++ return ret; |
4517 |
+ } |
4518 |
+ |
4519 |
+ #define SOC_DAPM_MIXER_GB(xname, kcount, data) \ |
4520 |
+diff --git a/drivers/staging/wlan-ng/hfa384x_usb.c b/drivers/staging/wlan-ng/hfa384x_usb.c |
4521 |
+index fa1bf8b069fda..2720f7319a3d0 100644 |
4522 |
+--- a/drivers/staging/wlan-ng/hfa384x_usb.c |
4523 |
++++ b/drivers/staging/wlan-ng/hfa384x_usb.c |
4524 |
+@@ -524,13 +524,8 @@ static void hfa384x_usb_defer(struct work_struct *data) |
4525 |
+ */ |
4526 |
+ void hfa384x_create(struct hfa384x *hw, struct usb_device *usb) |
4527 |
+ { |
4528 |
+- memset(hw, 0, sizeof(*hw)); |
4529 |
+ hw->usb = usb; |
4530 |
+ |
4531 |
+- /* set up the endpoints */ |
4532 |
+- hw->endp_in = usb_rcvbulkpipe(usb, 1); |
4533 |
+- hw->endp_out = usb_sndbulkpipe(usb, 2); |
4534 |
+- |
4535 |
+ /* Set up the waitq */ |
4536 |
+ init_waitqueue_head(&hw->cmdq); |
4537 |
+ |
4538 |
+diff --git a/drivers/staging/wlan-ng/prism2usb.c b/drivers/staging/wlan-ng/prism2usb.c |
4539 |
+index 456603fd26c0b..4b08dc1da4f97 100644 |
4540 |
+--- a/drivers/staging/wlan-ng/prism2usb.c |
4541 |
++++ b/drivers/staging/wlan-ng/prism2usb.c |
4542 |
+@@ -61,23 +61,14 @@ static int prism2sta_probe_usb(struct usb_interface *interface, |
4543 |
+ const struct usb_device_id *id) |
4544 |
+ { |
4545 |
+ struct usb_device *dev; |
4546 |
+- const struct usb_endpoint_descriptor *epd; |
4547 |
+- const struct usb_host_interface *iface_desc = interface->cur_altsetting; |
4548 |
++ struct usb_endpoint_descriptor *bulk_in, *bulk_out; |
4549 |
++ struct usb_host_interface *iface_desc = interface->cur_altsetting; |
4550 |
+ struct wlandevice *wlandev = NULL; |
4551 |
+ struct hfa384x *hw = NULL; |
4552 |
+ int result = 0; |
4553 |
+ |
4554 |
+- if (iface_desc->desc.bNumEndpoints != 2) { |
4555 |
+- result = -ENODEV; |
4556 |
+- goto failed; |
4557 |
+- } |
4558 |
+- |
4559 |
+- result = -EINVAL; |
4560 |
+- epd = &iface_desc->endpoint[1].desc; |
4561 |
+- if (!usb_endpoint_is_bulk_in(epd)) |
4562 |
+- goto failed; |
4563 |
+- epd = &iface_desc->endpoint[2].desc; |
4564 |
+- if (!usb_endpoint_is_bulk_out(epd)) |
4565 |
++ result = usb_find_common_endpoints(iface_desc, &bulk_in, &bulk_out, NULL, NULL); |
4566 |
++ if (result) |
4567 |
+ goto failed; |
4568 |
+ |
4569 |
+ dev = interface_to_usbdev(interface); |
4570 |
+@@ -96,6 +87,8 @@ static int prism2sta_probe_usb(struct usb_interface *interface, |
4571 |
+ } |
4572 |
+ |
4573 |
+ /* Initialize the hw data */ |
4574 |
++ hw->endp_in = usb_rcvbulkpipe(dev, bulk_in->bEndpointAddress); |
4575 |
++ hw->endp_out = usb_sndbulkpipe(dev, bulk_out->bEndpointAddress); |
4576 |
+ hfa384x_create(hw, dev); |
4577 |
+ hw->wlandev = wlandev; |
4578 |
+ |
4579 |
+diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c |
4580 |
+index c9689610e186d..2ec778e97b1be 100644 |
4581 |
+--- a/drivers/target/iscsi/iscsi_target.c |
4582 |
++++ b/drivers/target/iscsi/iscsi_target.c |
4583 |
+@@ -1389,14 +1389,27 @@ static u32 iscsit_do_crypto_hash_sg( |
4584 |
+ sg = cmd->first_data_sg; |
4585 |
+ page_off = cmd->first_data_sg_off; |
4586 |
+ |
4587 |
++ if (data_length && page_off) { |
4588 |
++ struct scatterlist first_sg; |
4589 |
++ u32 len = min_t(u32, data_length, sg->length - page_off); |
4590 |
++ |
4591 |
++ sg_init_table(&first_sg, 1); |
4592 |
++ sg_set_page(&first_sg, sg_page(sg), len, sg->offset + page_off); |
4593 |
++ |
4594 |
++ ahash_request_set_crypt(hash, &first_sg, NULL, len); |
4595 |
++ crypto_ahash_update(hash); |
4596 |
++ |
4597 |
++ data_length -= len; |
4598 |
++ sg = sg_next(sg); |
4599 |
++ } |
4600 |
++ |
4601 |
+ while (data_length) { |
4602 |
+- u32 cur_len = min_t(u32, data_length, (sg->length - page_off)); |
4603 |
++ u32 cur_len = min_t(u32, data_length, sg->length); |
4604 |
+ |
4605 |
+ ahash_request_set_crypt(hash, sg, NULL, cur_len); |
4606 |
+ crypto_ahash_update(hash); |
4607 |
+ |
4608 |
+ data_length -= cur_len; |
4609 |
+- page_off = 0; |
4610 |
+ /* iscsit_map_iovec has already checked for invalid sg pointers */ |
4611 |
+ sg = sg_next(sg); |
4612 |
+ } |
4613 |
+diff --git a/drivers/target/iscsi/iscsi_target_login.c b/drivers/target/iscsi/iscsi_target_login.c |
4614 |
+index 85748e3388582..893d1b406c292 100644 |
4615 |
+--- a/drivers/target/iscsi/iscsi_target_login.c |
4616 |
++++ b/drivers/target/iscsi/iscsi_target_login.c |
4617 |
+@@ -1149,7 +1149,7 @@ void iscsit_free_conn(struct iscsi_conn *conn) |
4618 |
+ } |
4619 |
+ |
4620 |
+ void iscsi_target_login_sess_out(struct iscsi_conn *conn, |
4621 |
+- struct iscsi_np *np, bool zero_tsih, bool new_sess) |
4622 |
++ bool zero_tsih, bool new_sess) |
4623 |
+ { |
4624 |
+ if (!new_sess) |
4625 |
+ goto old_sess_out; |
4626 |
+@@ -1167,7 +1167,6 @@ void iscsi_target_login_sess_out(struct iscsi_conn *conn, |
4627 |
+ conn->sess = NULL; |
4628 |
+ |
4629 |
+ old_sess_out: |
4630 |
+- iscsi_stop_login_thread_timer(np); |
4631 |
+ /* |
4632 |
+ * If login negotiation fails check if the Time2Retain timer |
4633 |
+ * needs to be restarted. |
4634 |
+@@ -1407,8 +1406,9 @@ static int __iscsi_target_login_thread(struct iscsi_np *np) |
4635 |
+ new_sess_out: |
4636 |
+ new_sess = true; |
4637 |
+ old_sess_out: |
4638 |
++ iscsi_stop_login_thread_timer(np); |
4639 |
+ tpg_np = conn->tpg_np; |
4640 |
+- iscsi_target_login_sess_out(conn, np, zero_tsih, new_sess); |
4641 |
++ iscsi_target_login_sess_out(conn, zero_tsih, new_sess); |
4642 |
+ new_sess = false; |
4643 |
+ |
4644 |
+ if (tpg) { |
4645 |
+diff --git a/drivers/target/iscsi/iscsi_target_login.h b/drivers/target/iscsi/iscsi_target_login.h |
4646 |
+index 3b8e3639ff5d0..fc95e6150253f 100644 |
4647 |
+--- a/drivers/target/iscsi/iscsi_target_login.h |
4648 |
++++ b/drivers/target/iscsi/iscsi_target_login.h |
4649 |
+@@ -22,8 +22,7 @@ extern int iscsit_put_login_tx(struct iscsi_conn *, struct iscsi_login *, u32); |
4650 |
+ extern void iscsit_free_conn(struct iscsi_conn *); |
4651 |
+ extern int iscsit_start_kthreads(struct iscsi_conn *); |
4652 |
+ extern void iscsi_post_login_handler(struct iscsi_np *, struct iscsi_conn *, u8); |
4653 |
+-extern void iscsi_target_login_sess_out(struct iscsi_conn *, struct iscsi_np *, |
4654 |
+- bool, bool); |
4655 |
++extern void iscsi_target_login_sess_out(struct iscsi_conn *, bool, bool); |
4656 |
+ extern int iscsi_target_login_thread(void *); |
4657 |
+ extern void iscsi_handle_login_thread_timeout(struct timer_list *t); |
4658 |
+ |
4659 |
+diff --git a/drivers/target/iscsi/iscsi_target_nego.c b/drivers/target/iscsi/iscsi_target_nego.c |
4660 |
+index 685d771b51d41..e32d93b927428 100644 |
4661 |
+--- a/drivers/target/iscsi/iscsi_target_nego.c |
4662 |
++++ b/drivers/target/iscsi/iscsi_target_nego.c |
4663 |
+@@ -535,12 +535,11 @@ static bool iscsi_target_sk_check_and_clear(struct iscsi_conn *conn, unsigned in |
4664 |
+ |
4665 |
+ static void iscsi_target_login_drop(struct iscsi_conn *conn, struct iscsi_login *login) |
4666 |
+ { |
4667 |
+- struct iscsi_np *np = login->np; |
4668 |
+ bool zero_tsih = login->zero_tsih; |
4669 |
+ |
4670 |
+ iscsi_remove_failed_auth_entry(conn); |
4671 |
+ iscsi_target_nego_release(conn); |
4672 |
+- iscsi_target_login_sess_out(conn, np, zero_tsih, true); |
4673 |
++ iscsi_target_login_sess_out(conn, zero_tsih, true); |
4674 |
+ } |
4675 |
+ |
4676 |
+ struct conn_timeout { |
4677 |
+diff --git a/drivers/thunderbolt/switch.c b/drivers/thunderbolt/switch.c |
4678 |
+index d7d60cd9226f7..43df502a36d6b 100644 |
4679 |
+--- a/drivers/thunderbolt/switch.c |
4680 |
++++ b/drivers/thunderbolt/switch.c |
4681 |
+@@ -739,6 +739,7 @@ static int tb_init_port(struct tb_port *port) |
4682 |
+ if (res == -ENODEV) { |
4683 |
+ tb_dbg(port->sw->tb, " Port %d: not implemented\n", |
4684 |
+ port->port); |
4685 |
++ port->disabled = true; |
4686 |
+ return 0; |
4687 |
+ } |
4688 |
+ return res; |
4689 |
+diff --git a/drivers/thunderbolt/tb.h b/drivers/thunderbolt/tb.h |
4690 |
+index 2eb2bcd3cca35..72e48e86c476e 100644 |
4691 |
+--- a/drivers/thunderbolt/tb.h |
4692 |
++++ b/drivers/thunderbolt/tb.h |
4693 |
+@@ -167,7 +167,7 @@ struct tb_switch { |
4694 |
+ * @cap_adap: Offset of the adapter specific capability (%0 if not present) |
4695 |
+ * @cap_usb4: Offset to the USB4 port capability (%0 if not present) |
4696 |
+ * @port: Port number on switch |
4697 |
+- * @disabled: Disabled by eeprom |
4698 |
++ * @disabled: Disabled by eeprom or enabled but not implemented |
4699 |
+ * @bonded: true if the port is bonded (two lanes combined as one) |
4700 |
+ * @dual_link_port: If the switch is connected using two ports, points |
4701 |
+ * to the other port. |
4702 |
+diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c |
4703 |
+index 6197938dcc2d8..ae1de9cc4b094 100644 |
4704 |
+--- a/drivers/usb/core/message.c |
4705 |
++++ b/drivers/usb/core/message.c |
4706 |
+@@ -1205,6 +1205,34 @@ void usb_disable_interface(struct usb_device *dev, struct usb_interface *intf, |
4707 |
+ } |
4708 |
+ } |
4709 |
+ |
4710 |
++/* |
4711 |
++ * usb_disable_device_endpoints -- Disable all endpoints for a device |
4712 |
++ * @dev: the device whose endpoints are being disabled |
4713 |
++ * @skip_ep0: 0 to disable endpoint 0, 1 to skip it. |
4714 |
++ */ |
4715 |
++static void usb_disable_device_endpoints(struct usb_device *dev, int skip_ep0) |
4716 |
++{ |
4717 |
++ struct usb_hcd *hcd = bus_to_hcd(dev->bus); |
4718 |
++ int i; |
4719 |
++ |
4720 |
++ if (hcd->driver->check_bandwidth) { |
4721 |
++ /* First pass: Cancel URBs, leave endpoint pointers intact. */ |
4722 |
++ for (i = skip_ep0; i < 16; ++i) { |
4723 |
++ usb_disable_endpoint(dev, i, false); |
4724 |
++ usb_disable_endpoint(dev, i + USB_DIR_IN, false); |
4725 |
++ } |
4726 |
++ /* Remove endpoints from the host controller internal state */ |
4727 |
++ mutex_lock(hcd->bandwidth_mutex); |
4728 |
++ usb_hcd_alloc_bandwidth(dev, NULL, NULL, NULL); |
4729 |
++ mutex_unlock(hcd->bandwidth_mutex); |
4730 |
++ } |
4731 |
++ /* Second pass: remove endpoint pointers */ |
4732 |
++ for (i = skip_ep0; i < 16; ++i) { |
4733 |
++ usb_disable_endpoint(dev, i, true); |
4734 |
++ usb_disable_endpoint(dev, i + USB_DIR_IN, true); |
4735 |
++ } |
4736 |
++} |
4737 |
++ |
4738 |
+ /** |
4739 |
+ * usb_disable_device - Disable all the endpoints for a USB device |
4740 |
+ * @dev: the device whose endpoints are being disabled |
4741 |
+@@ -1218,7 +1246,6 @@ void usb_disable_interface(struct usb_device *dev, struct usb_interface *intf, |
4742 |
+ void usb_disable_device(struct usb_device *dev, int skip_ep0) |
4743 |
+ { |
4744 |
+ int i; |
4745 |
+- struct usb_hcd *hcd = bus_to_hcd(dev->bus); |
4746 |
+ |
4747 |
+ /* getting rid of interfaces will disconnect |
4748 |
+ * any drivers bound to them (a key side effect) |
4749 |
+@@ -1264,22 +1291,8 @@ void usb_disable_device(struct usb_device *dev, int skip_ep0) |
4750 |
+ |
4751 |
+ dev_dbg(&dev->dev, "%s nuking %s URBs\n", __func__, |
4752 |
+ skip_ep0 ? "non-ep0" : "all"); |
4753 |
+- if (hcd->driver->check_bandwidth) { |
4754 |
+- /* First pass: Cancel URBs, leave endpoint pointers intact. */ |
4755 |
+- for (i = skip_ep0; i < 16; ++i) { |
4756 |
+- usb_disable_endpoint(dev, i, false); |
4757 |
+- usb_disable_endpoint(dev, i + USB_DIR_IN, false); |
4758 |
+- } |
4759 |
+- /* Remove endpoints from the host controller internal state */ |
4760 |
+- mutex_lock(hcd->bandwidth_mutex); |
4761 |
+- usb_hcd_alloc_bandwidth(dev, NULL, NULL, NULL); |
4762 |
+- mutex_unlock(hcd->bandwidth_mutex); |
4763 |
+- /* Second pass: remove endpoint pointers */ |
4764 |
+- } |
4765 |
+- for (i = skip_ep0; i < 16; ++i) { |
4766 |
+- usb_disable_endpoint(dev, i, true); |
4767 |
+- usb_disable_endpoint(dev, i + USB_DIR_IN, true); |
4768 |
+- } |
4769 |
++ |
4770 |
++ usb_disable_device_endpoints(dev, skip_ep0); |
4771 |
+ } |
4772 |
+ |
4773 |
+ /** |
4774 |
+@@ -1522,6 +1535,9 @@ EXPORT_SYMBOL_GPL(usb_set_interface); |
4775 |
+ * The caller must own the device lock. |
4776 |
+ * |
4777 |
+ * Return: Zero on success, else a negative error code. |
4778 |
++ * |
4779 |
++ * If this routine fails the device will probably be in an unusable state |
4780 |
++ * with endpoints disabled, and interfaces only partially enabled. |
4781 |
+ */ |
4782 |
+ int usb_reset_configuration(struct usb_device *dev) |
4783 |
+ { |
4784 |
+@@ -1537,10 +1553,7 @@ int usb_reset_configuration(struct usb_device *dev) |
4785 |
+ * calls during probe() are fine |
4786 |
+ */ |
4787 |
+ |
4788 |
+- for (i = 1; i < 16; ++i) { |
4789 |
+- usb_disable_endpoint(dev, i, true); |
4790 |
+- usb_disable_endpoint(dev, i + USB_DIR_IN, true); |
4791 |
+- } |
4792 |
++ usb_disable_device_endpoints(dev, 1); /* skip ep0*/ |
4793 |
+ |
4794 |
+ config = dev->actconfig; |
4795 |
+ retval = 0; |
4796 |
+@@ -1553,34 +1566,10 @@ int usb_reset_configuration(struct usb_device *dev) |
4797 |
+ mutex_unlock(hcd->bandwidth_mutex); |
4798 |
+ return -ENOMEM; |
4799 |
+ } |
4800 |
+- /* Make sure we have enough bandwidth for each alternate setting 0 */ |
4801 |
+- for (i = 0; i < config->desc.bNumInterfaces; i++) { |
4802 |
+- struct usb_interface *intf = config->interface[i]; |
4803 |
+- struct usb_host_interface *alt; |
4804 |
+ |
4805 |
+- alt = usb_altnum_to_altsetting(intf, 0); |
4806 |
+- if (!alt) |
4807 |
+- alt = &intf->altsetting[0]; |
4808 |
+- if (alt != intf->cur_altsetting) |
4809 |
+- retval = usb_hcd_alloc_bandwidth(dev, NULL, |
4810 |
+- intf->cur_altsetting, alt); |
4811 |
+- if (retval < 0) |
4812 |
+- break; |
4813 |
+- } |
4814 |
+- /* If not, reinstate the old alternate settings */ |
4815 |
++ /* xHCI adds all endpoints in usb_hcd_alloc_bandwidth */ |
4816 |
++ retval = usb_hcd_alloc_bandwidth(dev, config, NULL, NULL); |
4817 |
+ if (retval < 0) { |
4818 |
+-reset_old_alts: |
4819 |
+- for (i--; i >= 0; i--) { |
4820 |
+- struct usb_interface *intf = config->interface[i]; |
4821 |
+- struct usb_host_interface *alt; |
4822 |
+- |
4823 |
+- alt = usb_altnum_to_altsetting(intf, 0); |
4824 |
+- if (!alt) |
4825 |
+- alt = &intf->altsetting[0]; |
4826 |
+- if (alt != intf->cur_altsetting) |
4827 |
+- usb_hcd_alloc_bandwidth(dev, NULL, |
4828 |
+- alt, intf->cur_altsetting); |
4829 |
+- } |
4830 |
+ usb_enable_lpm(dev); |
4831 |
+ mutex_unlock(hcd->bandwidth_mutex); |
4832 |
+ return retval; |
4833 |
+@@ -1589,8 +1578,12 @@ reset_old_alts: |
4834 |
+ USB_REQ_SET_CONFIGURATION, 0, |
4835 |
+ config->desc.bConfigurationValue, 0, |
4836 |
+ NULL, 0, USB_CTRL_SET_TIMEOUT); |
4837 |
+- if (retval < 0) |
4838 |
+- goto reset_old_alts; |
4839 |
++ if (retval < 0) { |
4840 |
++ usb_hcd_alloc_bandwidth(dev, NULL, NULL, NULL); |
4841 |
++ usb_enable_lpm(dev); |
4842 |
++ mutex_unlock(hcd->bandwidth_mutex); |
4843 |
++ return retval; |
4844 |
++ } |
4845 |
+ mutex_unlock(hcd->bandwidth_mutex); |
4846 |
+ |
4847 |
+ /* re-init hc/hcd interface/endpoint state */ |
4848 |
+diff --git a/drivers/usb/core/sysfs.c b/drivers/usb/core/sysfs.c |
4849 |
+index a2ca38e25e0c3..8d134193fa0cf 100644 |
4850 |
+--- a/drivers/usb/core/sysfs.c |
4851 |
++++ b/drivers/usb/core/sysfs.c |
4852 |
+@@ -889,7 +889,11 @@ read_descriptors(struct file *filp, struct kobject *kobj, |
4853 |
+ size_t srclen, n; |
4854 |
+ int cfgno; |
4855 |
+ void *src; |
4856 |
++ int retval; |
4857 |
+ |
4858 |
++ retval = usb_lock_device_interruptible(udev); |
4859 |
++ if (retval < 0) |
4860 |
++ return -EINTR; |
4861 |
+ /* The binary attribute begins with the device descriptor. |
4862 |
+ * Following that are the raw descriptor entries for all the |
4863 |
+ * configurations (config plus subsidiary descriptors). |
4864 |
+@@ -914,6 +918,7 @@ read_descriptors(struct file *filp, struct kobject *kobj, |
4865 |
+ off -= srclen; |
4866 |
+ } |
4867 |
+ } |
4868 |
++ usb_unlock_device(udev); |
4869 |
+ return count - nleft; |
4870 |
+ } |
4871 |
+ |
4872 |
+diff --git a/drivers/usb/dwc3/dwc3-meson-g12a.c b/drivers/usb/dwc3/dwc3-meson-g12a.c |
4873 |
+index 88b75b5a039c9..1f7f4d88ed9d8 100644 |
4874 |
+--- a/drivers/usb/dwc3/dwc3-meson-g12a.c |
4875 |
++++ b/drivers/usb/dwc3/dwc3-meson-g12a.c |
4876 |
+@@ -737,13 +737,13 @@ static int dwc3_meson_g12a_probe(struct platform_device *pdev) |
4877 |
+ goto err_disable_clks; |
4878 |
+ } |
4879 |
+ |
4880 |
+- ret = reset_control_deassert(priv->reset); |
4881 |
++ ret = reset_control_reset(priv->reset); |
4882 |
+ if (ret) |
4883 |
+- goto err_assert_reset; |
4884 |
++ goto err_disable_clks; |
4885 |
+ |
4886 |
+ ret = dwc3_meson_g12a_get_phys(priv); |
4887 |
+ if (ret) |
4888 |
+- goto err_assert_reset; |
4889 |
++ goto err_disable_clks; |
4890 |
+ |
4891 |
+ ret = priv->drvdata->setup_regmaps(priv, base); |
4892 |
+ if (ret) |
4893 |
+@@ -752,7 +752,7 @@ static int dwc3_meson_g12a_probe(struct platform_device *pdev) |
4894 |
+ if (priv->vbus) { |
4895 |
+ ret = regulator_enable(priv->vbus); |
4896 |
+ if (ret) |
4897 |
+- goto err_assert_reset; |
4898 |
++ goto err_disable_clks; |
4899 |
+ } |
4900 |
+ |
4901 |
+ /* Get dr_mode */ |
4902 |
+@@ -765,13 +765,13 @@ static int dwc3_meson_g12a_probe(struct platform_device *pdev) |
4903 |
+ |
4904 |
+ ret = priv->drvdata->usb_init(priv); |
4905 |
+ if (ret) |
4906 |
+- goto err_assert_reset; |
4907 |
++ goto err_disable_clks; |
4908 |
+ |
4909 |
+ /* Init PHYs */ |
4910 |
+ for (i = 0 ; i < PHY_COUNT ; ++i) { |
4911 |
+ ret = phy_init(priv->phys[i]); |
4912 |
+ if (ret) |
4913 |
+- goto err_assert_reset; |
4914 |
++ goto err_disable_clks; |
4915 |
+ } |
4916 |
+ |
4917 |
+ /* Set PHY Power */ |
4918 |
+@@ -809,9 +809,6 @@ err_phys_exit: |
4919 |
+ for (i = 0 ; i < PHY_COUNT ; ++i) |
4920 |
+ phy_exit(priv->phys[i]); |
4921 |
+ |
4922 |
+-err_assert_reset: |
4923 |
+- reset_control_assert(priv->reset); |
4924 |
+- |
4925 |
+ err_disable_clks: |
4926 |
+ clk_bulk_disable_unprepare(priv->drvdata->num_clks, |
4927 |
+ priv->drvdata->clks); |
4928 |
+diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c |
4929 |
+index 33f1cca7eaa61..ae98fe94fe91e 100644 |
4930 |
+--- a/drivers/usb/serial/ftdi_sio.c |
4931 |
++++ b/drivers/usb/serial/ftdi_sio.c |
4932 |
+@@ -713,6 +713,7 @@ static const struct usb_device_id id_table_combined[] = { |
4933 |
+ { USB_DEVICE(XSENS_VID, XSENS_AWINDA_STATION_PID) }, |
4934 |
+ { USB_DEVICE(XSENS_VID, XSENS_CONVERTER_PID) }, |
4935 |
+ { USB_DEVICE(XSENS_VID, XSENS_MTDEVBOARD_PID) }, |
4936 |
++ { USB_DEVICE(XSENS_VID, XSENS_MTIUSBCONVERTER_PID) }, |
4937 |
+ { USB_DEVICE(XSENS_VID, XSENS_MTW_PID) }, |
4938 |
+ { USB_DEVICE(FTDI_VID, FTDI_OMNI1509) }, |
4939 |
+ { USB_DEVICE(MOBILITY_VID, MOBILITY_USB_SERIAL_PID) }, |
4940 |
+diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h |
4941 |
+index e8373528264c3..b5ca17a5967a0 100644 |
4942 |
+--- a/drivers/usb/serial/ftdi_sio_ids.h |
4943 |
++++ b/drivers/usb/serial/ftdi_sio_ids.h |
4944 |
+@@ -160,6 +160,7 @@ |
4945 |
+ #define XSENS_AWINDA_DONGLE_PID 0x0102 |
4946 |
+ #define XSENS_MTW_PID 0x0200 /* Xsens MTw */ |
4947 |
+ #define XSENS_MTDEVBOARD_PID 0x0300 /* Motion Tracker Development Board */ |
4948 |
++#define XSENS_MTIUSBCONVERTER_PID 0x0301 /* MTi USB converter */ |
4949 |
+ #define XSENS_CONVERTER_PID 0xD00D /* Xsens USB-serial converter */ |
4950 |
+ |
4951 |
+ /* Xsens devices using FTDI VID */ |
4952 |
+diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c |
4953 |
+index 9b7cee98ea607..f7a6ac05ac57a 100644 |
4954 |
+--- a/drivers/usb/serial/option.c |
4955 |
++++ b/drivers/usb/serial/option.c |
4956 |
+@@ -1094,14 +1094,18 @@ static const struct usb_device_id option_ids[] = { |
4957 |
+ { USB_DEVICE(QUALCOMM_VENDOR_ID, UBLOX_PRODUCT_R410M), |
4958 |
+ .driver_info = RSVD(1) | RSVD(3) }, |
4959 |
+ /* Quectel products using Quectel vendor ID */ |
4960 |
+- { USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC21), |
4961 |
+- .driver_info = RSVD(4) }, |
4962 |
+- { USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC25), |
4963 |
+- .driver_info = RSVD(4) }, |
4964 |
+- { USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EG95), |
4965 |
+- .driver_info = RSVD(4) }, |
4966 |
+- { USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_BG96), |
4967 |
+- .driver_info = RSVD(4) }, |
4968 |
++ { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC21, 0xff, 0xff, 0xff), |
4969 |
++ .driver_info = NUMEP2 }, |
4970 |
++ { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC21, 0xff, 0, 0) }, |
4971 |
++ { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC25, 0xff, 0xff, 0xff), |
4972 |
++ .driver_info = NUMEP2 }, |
4973 |
++ { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC25, 0xff, 0, 0) }, |
4974 |
++ { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EG95, 0xff, 0xff, 0xff), |
4975 |
++ .driver_info = NUMEP2 }, |
4976 |
++ { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EG95, 0xff, 0, 0) }, |
4977 |
++ { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_BG96, 0xff, 0xff, 0xff), |
4978 |
++ .driver_info = NUMEP2 }, |
4979 |
++ { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_BG96, 0xff, 0, 0) }, |
4980 |
+ { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EP06, 0xff, 0xff, 0xff), |
4981 |
+ .driver_info = RSVD(1) | RSVD(2) | RSVD(3) | RSVD(4) | NUMEP2 }, |
4982 |
+ { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EP06, 0xff, 0, 0) }, |
4983 |
+@@ -1819,6 +1823,8 @@ static const struct usb_device_id option_ids[] = { |
4984 |
+ { USB_DEVICE_INTERFACE_CLASS(0x1e0e, 0x9003, 0xff) }, /* Simcom SIM7500/SIM7600 MBIM mode */ |
4985 |
+ { USB_DEVICE_INTERFACE_CLASS(0x1e0e, 0x9011, 0xff), /* Simcom SIM7500/SIM7600 RNDIS mode */ |
4986 |
+ .driver_info = RSVD(7) }, |
4987 |
++ { USB_DEVICE_INTERFACE_CLASS(0x1e0e, 0x9205, 0xff) }, /* Simcom SIM7070/SIM7080/SIM7090 AT+ECM mode */ |
4988 |
++ { USB_DEVICE_INTERFACE_CLASS(0x1e0e, 0x9206, 0xff) }, /* Simcom SIM7070/SIM7080/SIM7090 AT-only mode */ |
4989 |
+ { USB_DEVICE(ALCATEL_VENDOR_ID, ALCATEL_PRODUCT_X060S_X200), |
4990 |
+ .driver_info = NCTRL(0) | NCTRL(1) | RSVD(4) }, |
4991 |
+ { USB_DEVICE(ALCATEL_VENDOR_ID, ALCATEL_PRODUCT_X220_X500D), |
4992 |
+diff --git a/drivers/usb/typec/mux/intel_pmc_mux.c b/drivers/usb/typec/mux/intel_pmc_mux.c |
4993 |
+index 70ddc9d6d49e4..6a17789208779 100644 |
4994 |
+--- a/drivers/usb/typec/mux/intel_pmc_mux.c |
4995 |
++++ b/drivers/usb/typec/mux/intel_pmc_mux.c |
4996 |
+@@ -56,14 +56,11 @@ enum { |
4997 |
+ |
4998 |
+ #define PMC_USB_ALTMODE_ORI_SHIFT 1 |
4999 |
+ #define PMC_USB_ALTMODE_UFP_SHIFT 3 |
5000 |
+-#define PMC_USB_ALTMODE_ORI_AUX_SHIFT 4 |
5001 |
+-#define PMC_USB_ALTMODE_ORI_HSL_SHIFT 5 |
5002 |
+ |
5003 |
+ /* DP specific Mode Data bits */ |
5004 |
+ #define PMC_USB_ALTMODE_DP_MODE_SHIFT 8 |
5005 |
+ |
5006 |
+ /* TBT specific Mode Data bits */ |
5007 |
+-#define PMC_USB_ALTMODE_HPD_HIGH BIT(14) |
5008 |
+ #define PMC_USB_ALTMODE_TBT_TYPE BIT(17) |
5009 |
+ #define PMC_USB_ALTMODE_CABLE_TYPE BIT(18) |
5010 |
+ #define PMC_USB_ALTMODE_ACTIVE_LINK BIT(20) |
5011 |
+@@ -174,15 +171,9 @@ pmc_usb_mux_dp(struct pmc_usb_port *port, struct typec_mux_state *state) |
5012 |
+ req.mode_data = (port->orientation - 1) << PMC_USB_ALTMODE_ORI_SHIFT; |
5013 |
+ req.mode_data |= (port->role - 1) << PMC_USB_ALTMODE_UFP_SHIFT; |
5014 |
+ |
5015 |
+- req.mode_data |= sbu_orientation(port) << PMC_USB_ALTMODE_ORI_AUX_SHIFT; |
5016 |
+- req.mode_data |= hsl_orientation(port) << PMC_USB_ALTMODE_ORI_HSL_SHIFT; |
5017 |
+- |
5018 |
+ req.mode_data |= (state->mode - TYPEC_STATE_MODAL) << |
5019 |
+ PMC_USB_ALTMODE_DP_MODE_SHIFT; |
5020 |
+ |
5021 |
+- if (data->status & DP_STATUS_HPD_STATE) |
5022 |
+- req.mode_data |= PMC_USB_ALTMODE_HPD_HIGH; |
5023 |
+- |
5024 |
+ ret = pmc_usb_command(port, (void *)&req, sizeof(req)); |
5025 |
+ if (ret) |
5026 |
+ return ret; |
5027 |
+@@ -207,9 +198,6 @@ pmc_usb_mux_tbt(struct pmc_usb_port *port, struct typec_mux_state *state) |
5028 |
+ req.mode_data = (port->orientation - 1) << PMC_USB_ALTMODE_ORI_SHIFT; |
5029 |
+ req.mode_data |= (port->role - 1) << PMC_USB_ALTMODE_UFP_SHIFT; |
5030 |
+ |
5031 |
+- req.mode_data |= sbu_orientation(port) << PMC_USB_ALTMODE_ORI_AUX_SHIFT; |
5032 |
+- req.mode_data |= hsl_orientation(port) << PMC_USB_ALTMODE_ORI_HSL_SHIFT; |
5033 |
+- |
5034 |
+ if (TBT_ADAPTER(data->device_mode) == TBT_ADAPTER_TBT3) |
5035 |
+ req.mode_data |= PMC_USB_ALTMODE_TBT_TYPE; |
5036 |
+ |
5037 |
+@@ -441,6 +429,7 @@ err_remove_ports: |
5038 |
+ for (i = 0; i < pmc->num_ports; i++) { |
5039 |
+ typec_switch_unregister(pmc->port[i].typec_sw); |
5040 |
+ typec_mux_unregister(pmc->port[i].typec_mux); |
5041 |
++ usb_role_switch_unregister(pmc->port[i].usb_sw); |
5042 |
+ } |
5043 |
+ |
5044 |
+ return ret; |
5045 |
+@@ -454,6 +443,7 @@ static int pmc_usb_remove(struct platform_device *pdev) |
5046 |
+ for (i = 0; i < pmc->num_ports; i++) { |
5047 |
+ typec_switch_unregister(pmc->port[i].typec_sw); |
5048 |
+ typec_mux_unregister(pmc->port[i].typec_mux); |
5049 |
++ usb_role_switch_unregister(pmc->port[i].usb_sw); |
5050 |
+ } |
5051 |
+ |
5052 |
+ return 0; |
5053 |
+diff --git a/drivers/usb/typec/ucsi/ucsi_acpi.c b/drivers/usb/typec/ucsi/ucsi_acpi.c |
5054 |
+index 9fc4f338e8700..c0aca2f0f23f0 100644 |
5055 |
+--- a/drivers/usb/typec/ucsi/ucsi_acpi.c |
5056 |
++++ b/drivers/usb/typec/ucsi/ucsi_acpi.c |
5057 |
+@@ -112,11 +112,15 @@ static void ucsi_acpi_notify(acpi_handle handle, u32 event, void *data) |
5058 |
+ |
5059 |
+ static int ucsi_acpi_probe(struct platform_device *pdev) |
5060 |
+ { |
5061 |
++ struct acpi_device *adev = ACPI_COMPANION(&pdev->dev); |
5062 |
+ struct ucsi_acpi *ua; |
5063 |
+ struct resource *res; |
5064 |
+ acpi_status status; |
5065 |
+ int ret; |
5066 |
+ |
5067 |
++ if (adev->dep_unmet) |
5068 |
++ return -EPROBE_DEFER; |
5069 |
++ |
5070 |
+ ua = devm_kzalloc(&pdev->dev, sizeof(*ua), GFP_KERNEL); |
5071 |
+ if (!ua) |
5072 |
+ return -ENOMEM; |
5073 |
+diff --git a/drivers/video/console/Kconfig b/drivers/video/console/Kconfig |
5074 |
+index 5e850cc9f891d..39deb22a41807 100644 |
5075 |
+--- a/drivers/video/console/Kconfig |
5076 |
++++ b/drivers/video/console/Kconfig |
5077 |
+@@ -22,52 +22,6 @@ config VGA_CONSOLE |
5078 |
+ |
5079 |
+ Say Y. |
5080 |
+ |
5081 |
+-config VGACON_SOFT_SCROLLBACK |
5082 |
+- bool "Enable Scrollback Buffer in System RAM" |
5083 |
+- depends on VGA_CONSOLE |
5084 |
+- default n |
5085 |
+- help |
5086 |
+- The scrollback buffer of the standard VGA console is located in |
5087 |
+- the VGA RAM. The size of this RAM is fixed and is quite small. |
5088 |
+- If you require a larger scrollback buffer, this can be placed in |
5089 |
+- System RAM which is dynamically allocated during initialization. |
5090 |
+- Placing the scrollback buffer in System RAM will slightly slow |
5091 |
+- down the console. |
5092 |
+- |
5093 |
+- If you want this feature, say 'Y' here and enter the amount of |
5094 |
+- RAM to allocate for this buffer. If unsure, say 'N'. |
5095 |
+- |
5096 |
+-config VGACON_SOFT_SCROLLBACK_SIZE |
5097 |
+- int "Scrollback Buffer Size (in KB)" |
5098 |
+- depends on VGACON_SOFT_SCROLLBACK |
5099 |
+- range 1 1024 |
5100 |
+- default "64" |
5101 |
+- help |
5102 |
+- Enter the amount of System RAM to allocate for scrollback |
5103 |
+- buffers of VGA consoles. Each 64KB will give you approximately |
5104 |
+- 16 80x25 screenfuls of scrollback buffer. |
5105 |
+- |
5106 |
+-config VGACON_SOFT_SCROLLBACK_PERSISTENT_ENABLE_BY_DEFAULT |
5107 |
+- bool "Persistent Scrollback History for each console by default" |
5108 |
+- depends on VGACON_SOFT_SCROLLBACK |
5109 |
+- default n |
5110 |
+- help |
5111 |
+- Say Y here if the scrollback history should persist by default when |
5112 |
+- switching between consoles. Otherwise, the scrollback history will be |
5113 |
+- flushed each time the console is switched. This feature can also be |
5114 |
+- enabled using the boot command line parameter |
5115 |
+- 'vgacon.scrollback_persistent=1'. |
5116 |
+- |
5117 |
+- This feature might break your tool of choice to flush the scrollback |
5118 |
+- buffer, e.g. clear(1) will work fine but Debian's clear_console(1) |
5119 |
+- will be broken, which might cause security issues. |
5120 |
+- You can use the escape sequence \e[3J instead if this feature is |
5121 |
+- activated. |
5122 |
+- |
5123 |
+- Note that a buffer of VGACON_SOFT_SCROLLBACK_SIZE is taken for each |
5124 |
+- created tty device. |
5125 |
+- So if you use a RAM-constrained system, say N here. |
5126 |
+- |
5127 |
+ config MDA_CONSOLE |
5128 |
+ depends on !M68K && !PARISC && ISA |
5129 |
+ tristate "MDA text console (dual-headed)" |
5130 |
+diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c |
5131 |
+index e9254b3085a3e..6d0418e88ad71 100644 |
5132 |
+--- a/drivers/video/console/vgacon.c |
5133 |
++++ b/drivers/video/console/vgacon.c |
5134 |
+@@ -165,214 +165,6 @@ static inline void vga_set_mem_top(struct vc_data *c) |
5135 |
+ write_vga(12, (c->vc_visible_origin - vga_vram_base) / 2); |
5136 |
+ } |
5137 |
+ |
5138 |
+-#ifdef CONFIG_VGACON_SOFT_SCROLLBACK |
5139 |
+-/* software scrollback */ |
5140 |
+-struct vgacon_scrollback_info { |
5141 |
+- void *data; |
5142 |
+- int tail; |
5143 |
+- int size; |
5144 |
+- int rows; |
5145 |
+- int cnt; |
5146 |
+- int cur; |
5147 |
+- int save; |
5148 |
+- int restore; |
5149 |
+-}; |
5150 |
+- |
5151 |
+-static struct vgacon_scrollback_info *vgacon_scrollback_cur; |
5152 |
+-static struct vgacon_scrollback_info vgacon_scrollbacks[MAX_NR_CONSOLES]; |
5153 |
+-static bool scrollback_persistent = \ |
5154 |
+- IS_ENABLED(CONFIG_VGACON_SOFT_SCROLLBACK_PERSISTENT_ENABLE_BY_DEFAULT); |
5155 |
+-module_param_named(scrollback_persistent, scrollback_persistent, bool, 0000); |
5156 |
+-MODULE_PARM_DESC(scrollback_persistent, "Enable persistent scrollback for all vga consoles"); |
5157 |
+- |
5158 |
+-static void vgacon_scrollback_reset(int vc_num, size_t reset_size) |
5159 |
+-{ |
5160 |
+- struct vgacon_scrollback_info *scrollback = &vgacon_scrollbacks[vc_num]; |
5161 |
+- |
5162 |
+- if (scrollback->data && reset_size > 0) |
5163 |
+- memset(scrollback->data, 0, reset_size); |
5164 |
+- |
5165 |
+- scrollback->cnt = 0; |
5166 |
+- scrollback->tail = 0; |
5167 |
+- scrollback->cur = 0; |
5168 |
+-} |
5169 |
+- |
5170 |
+-static void vgacon_scrollback_init(int vc_num) |
5171 |
+-{ |
5172 |
+- int pitch = vga_video_num_columns * 2; |
5173 |
+- size_t size = CONFIG_VGACON_SOFT_SCROLLBACK_SIZE * 1024; |
5174 |
+- int rows = size / pitch; |
5175 |
+- void *data; |
5176 |
+- |
5177 |
+- data = kmalloc_array(CONFIG_VGACON_SOFT_SCROLLBACK_SIZE, 1024, |
5178 |
+- GFP_NOWAIT); |
5179 |
+- |
5180 |
+- vgacon_scrollbacks[vc_num].data = data; |
5181 |
+- vgacon_scrollback_cur = &vgacon_scrollbacks[vc_num]; |
5182 |
+- |
5183 |
+- vgacon_scrollback_cur->rows = rows - 1; |
5184 |
+- vgacon_scrollback_cur->size = rows * pitch; |
5185 |
+- |
5186 |
+- vgacon_scrollback_reset(vc_num, size); |
5187 |
+-} |
5188 |
+- |
5189 |
+-static void vgacon_scrollback_switch(int vc_num) |
5190 |
+-{ |
5191 |
+- if (!scrollback_persistent) |
5192 |
+- vc_num = 0; |
5193 |
+- |
5194 |
+- if (!vgacon_scrollbacks[vc_num].data) { |
5195 |
+- vgacon_scrollback_init(vc_num); |
5196 |
+- } else { |
5197 |
+- if (scrollback_persistent) { |
5198 |
+- vgacon_scrollback_cur = &vgacon_scrollbacks[vc_num]; |
5199 |
+- } else { |
5200 |
+- size_t size = CONFIG_VGACON_SOFT_SCROLLBACK_SIZE * 1024; |
5201 |
+- |
5202 |
+- vgacon_scrollback_reset(vc_num, size); |
5203 |
+- } |
5204 |
+- } |
5205 |
+-} |
5206 |
+- |
5207 |
+-static void vgacon_scrollback_startup(void) |
5208 |
+-{ |
5209 |
+- vgacon_scrollback_cur = &vgacon_scrollbacks[0]; |
5210 |
+- vgacon_scrollback_init(0); |
5211 |
+-} |
5212 |
+- |
5213 |
+-static void vgacon_scrollback_update(struct vc_data *c, int t, int count) |
5214 |
+-{ |
5215 |
+- void *p; |
5216 |
+- |
5217 |
+- if (!vgacon_scrollback_cur->data || !vgacon_scrollback_cur->size || |
5218 |
+- c->vc_num != fg_console) |
5219 |
+- return; |
5220 |
+- |
5221 |
+- p = (void *) (c->vc_origin + t * c->vc_size_row); |
5222 |
+- |
5223 |
+- while (count--) { |
5224 |
+- if ((vgacon_scrollback_cur->tail + c->vc_size_row) > |
5225 |
+- vgacon_scrollback_cur->size) |
5226 |
+- vgacon_scrollback_cur->tail = 0; |
5227 |
+- |
5228 |
+- scr_memcpyw(vgacon_scrollback_cur->data + |
5229 |
+- vgacon_scrollback_cur->tail, |
5230 |
+- p, c->vc_size_row); |
5231 |
+- |
5232 |
+- vgacon_scrollback_cur->cnt++; |
5233 |
+- p += c->vc_size_row; |
5234 |
+- vgacon_scrollback_cur->tail += c->vc_size_row; |
5235 |
+- |
5236 |
+- if (vgacon_scrollback_cur->tail >= vgacon_scrollback_cur->size) |
5237 |
+- vgacon_scrollback_cur->tail = 0; |
5238 |
+- |
5239 |
+- if (vgacon_scrollback_cur->cnt > vgacon_scrollback_cur->rows) |
5240 |
+- vgacon_scrollback_cur->cnt = vgacon_scrollback_cur->rows; |
5241 |
+- |
5242 |
+- vgacon_scrollback_cur->cur = vgacon_scrollback_cur->cnt; |
5243 |
+- } |
5244 |
+-} |
5245 |
+- |
5246 |
+-static void vgacon_restore_screen(struct vc_data *c) |
5247 |
+-{ |
5248 |
+- c->vc_origin = c->vc_visible_origin; |
5249 |
+- vgacon_scrollback_cur->save = 0; |
5250 |
+- |
5251 |
+- if (!vga_is_gfx && !vgacon_scrollback_cur->restore) { |
5252 |
+- scr_memcpyw((u16 *) c->vc_origin, (u16 *) c->vc_screenbuf, |
5253 |
+- c->vc_screenbuf_size > vga_vram_size ? |
5254 |
+- vga_vram_size : c->vc_screenbuf_size); |
5255 |
+- vgacon_scrollback_cur->restore = 1; |
5256 |
+- vgacon_scrollback_cur->cur = vgacon_scrollback_cur->cnt; |
5257 |
+- } |
5258 |
+-} |
5259 |
+- |
5260 |
+-static void vgacon_scrolldelta(struct vc_data *c, int lines) |
5261 |
+-{ |
5262 |
+- int start, end, count, soff; |
5263 |
+- |
5264 |
+- if (!lines) { |
5265 |
+- vgacon_restore_screen(c); |
5266 |
+- return; |
5267 |
+- } |
5268 |
+- |
5269 |
+- if (!vgacon_scrollback_cur->data) |
5270 |
+- return; |
5271 |
+- |
5272 |
+- if (!vgacon_scrollback_cur->save) { |
5273 |
+- vgacon_cursor(c, CM_ERASE); |
5274 |
+- vgacon_save_screen(c); |
5275 |
+- c->vc_origin = (unsigned long)c->vc_screenbuf; |
5276 |
+- vgacon_scrollback_cur->save = 1; |
5277 |
+- } |
5278 |
+- |
5279 |
+- vgacon_scrollback_cur->restore = 0; |
5280 |
+- start = vgacon_scrollback_cur->cur + lines; |
5281 |
+- end = start + abs(lines); |
5282 |
+- |
5283 |
+- if (start < 0) |
5284 |
+- start = 0; |
5285 |
+- |
5286 |
+- if (start > vgacon_scrollback_cur->cnt) |
5287 |
+- start = vgacon_scrollback_cur->cnt; |
5288 |
+- |
5289 |
+- if (end < 0) |
5290 |
+- end = 0; |
5291 |
+- |
5292 |
+- if (end > vgacon_scrollback_cur->cnt) |
5293 |
+- end = vgacon_scrollback_cur->cnt; |
5294 |
+- |
5295 |
+- vgacon_scrollback_cur->cur = start; |
5296 |
+- count = end - start; |
5297 |
+- soff = vgacon_scrollback_cur->tail - |
5298 |
+- ((vgacon_scrollback_cur->cnt - end) * c->vc_size_row); |
5299 |
+- soff -= count * c->vc_size_row; |
5300 |
+- |
5301 |
+- if (soff < 0) |
5302 |
+- soff += vgacon_scrollback_cur->size; |
5303 |
+- |
5304 |
+- count = vgacon_scrollback_cur->cnt - start; |
5305 |
+- |
5306 |
+- if (count > c->vc_rows) |
5307 |
+- count = c->vc_rows; |
5308 |
+- |
5309 |
+- if (count) { |
5310 |
+- int copysize; |
5311 |
+- |
5312 |
+- int diff = c->vc_rows - count; |
5313 |
+- void *d = (void *) c->vc_visible_origin; |
5314 |
+- void *s = (void *) c->vc_screenbuf; |
5315 |
+- |
5316 |
+- count *= c->vc_size_row; |
5317 |
+- /* how much memory to end of buffer left? */ |
5318 |
+- copysize = min(count, vgacon_scrollback_cur->size - soff); |
5319 |
+- scr_memcpyw(d, vgacon_scrollback_cur->data + soff, copysize); |
5320 |
+- d += copysize; |
5321 |
+- count -= copysize; |
5322 |
+- |
5323 |
+- if (count) { |
5324 |
+- scr_memcpyw(d, vgacon_scrollback_cur->data, count); |
5325 |
+- d += count; |
5326 |
+- } |
5327 |
+- |
5328 |
+- if (diff) |
5329 |
+- scr_memcpyw(d, s, diff * c->vc_size_row); |
5330 |
+- } else |
5331 |
+- vgacon_cursor(c, CM_MOVE); |
5332 |
+-} |
5333 |
+- |
5334 |
+-static void vgacon_flush_scrollback(struct vc_data *c) |
5335 |
+-{ |
5336 |
+- size_t size = CONFIG_VGACON_SOFT_SCROLLBACK_SIZE * 1024; |
5337 |
+- |
5338 |
+- vgacon_scrollback_reset(c->vc_num, size); |
5339 |
+-} |
5340 |
+-#else |
5341 |
+-#define vgacon_scrollback_startup(...) do { } while (0) |
5342 |
+-#define vgacon_scrollback_init(...) do { } while (0) |
5343 |
+-#define vgacon_scrollback_update(...) do { } while (0) |
5344 |
+-#define vgacon_scrollback_switch(...) do { } while (0) |
5345 |
+- |
5346 |
+ static void vgacon_restore_screen(struct vc_data *c) |
5347 |
+ { |
5348 |
+ if (c->vc_origin != c->vc_visible_origin) |
5349 |
+@@ -386,11 +178,6 @@ static void vgacon_scrolldelta(struct vc_data *c, int lines) |
5350 |
+ vga_set_mem_top(c); |
5351 |
+ } |
5352 |
+ |
5353 |
+-static void vgacon_flush_scrollback(struct vc_data *c) |
5354 |
+-{ |
5355 |
+-} |
5356 |
+-#endif /* CONFIG_VGACON_SOFT_SCROLLBACK */ |
5357 |
+- |
5358 |
+ static const char *vgacon_startup(void) |
5359 |
+ { |
5360 |
+ const char *display_desc = NULL; |
5361 |
+@@ -573,10 +360,7 @@ static const char *vgacon_startup(void) |
5362 |
+ vgacon_xres = screen_info.orig_video_cols * VGA_FONTWIDTH; |
5363 |
+ vgacon_yres = vga_scan_lines; |
5364 |
+ |
5365 |
+- if (!vga_init_done) { |
5366 |
+- vgacon_scrollback_startup(); |
5367 |
+- vga_init_done = true; |
5368 |
+- } |
5369 |
++ vga_init_done = true; |
5370 |
+ |
5371 |
+ return display_desc; |
5372 |
+ } |
5373 |
+@@ -867,7 +651,6 @@ static int vgacon_switch(struct vc_data *c) |
5374 |
+ vgacon_doresize(c, c->vc_cols, c->vc_rows); |
5375 |
+ } |
5376 |
+ |
5377 |
+- vgacon_scrollback_switch(c->vc_num); |
5378 |
+ return 0; /* Redrawing not needed */ |
5379 |
+ } |
5380 |
+ |
5381 |
+@@ -1384,7 +1167,6 @@ static bool vgacon_scroll(struct vc_data *c, unsigned int t, unsigned int b, |
5382 |
+ oldo = c->vc_origin; |
5383 |
+ delta = lines * c->vc_size_row; |
5384 |
+ if (dir == SM_UP) { |
5385 |
+- vgacon_scrollback_update(c, t, lines); |
5386 |
+ if (c->vc_scr_end + delta >= vga_vram_end) { |
5387 |
+ scr_memcpyw((u16 *) vga_vram_base, |
5388 |
+ (u16 *) (oldo + delta), |
5389 |
+@@ -1448,7 +1230,6 @@ const struct consw vga_con = { |
5390 |
+ .con_save_screen = vgacon_save_screen, |
5391 |
+ .con_build_attr = vgacon_build_attr, |
5392 |
+ .con_invert_region = vgacon_invert_region, |
5393 |
+- .con_flush_scrollback = vgacon_flush_scrollback, |
5394 |
+ }; |
5395 |
+ EXPORT_SYMBOL(vga_con); |
5396 |
+ |
5397 |
+diff --git a/drivers/video/fbdev/core/bitblit.c b/drivers/video/fbdev/core/bitblit.c |
5398 |
+index 35ebeeccde4df..436365efae731 100644 |
5399 |
+--- a/drivers/video/fbdev/core/bitblit.c |
5400 |
++++ b/drivers/video/fbdev/core/bitblit.c |
5401 |
+@@ -234,7 +234,7 @@ static void bit_clear_margins(struct vc_data *vc, struct fb_info *info, |
5402 |
+ } |
5403 |
+ |
5404 |
+ static void bit_cursor(struct vc_data *vc, struct fb_info *info, int mode, |
5405 |
+- int softback_lines, int fg, int bg) |
5406 |
++ int fg, int bg) |
5407 |
+ { |
5408 |
+ struct fb_cursor cursor; |
5409 |
+ struct fbcon_ops *ops = info->fbcon_par; |
5410 |
+@@ -247,15 +247,6 @@ static void bit_cursor(struct vc_data *vc, struct fb_info *info, int mode, |
5411 |
+ |
5412 |
+ cursor.set = 0; |
5413 |
+ |
5414 |
+- if (softback_lines) { |
5415 |
+- if (y + softback_lines >= vc->vc_rows) { |
5416 |
+- mode = CM_ERASE; |
5417 |
+- ops->cursor_flash = 0; |
5418 |
+- return; |
5419 |
+- } else |
5420 |
+- y += softback_lines; |
5421 |
+- } |
5422 |
+- |
5423 |
+ c = scr_readw((u16 *) vc->vc_pos); |
5424 |
+ attribute = get_attribute(info, c); |
5425 |
+ src = vc->vc_font.data + ((c & charmask) * (w * vc->vc_font.height)); |
5426 |
+diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c |
5427 |
+index fbf10e62bcde9..b36bfe10c712c 100644 |
5428 |
+--- a/drivers/video/fbdev/core/fbcon.c |
5429 |
++++ b/drivers/video/fbdev/core/fbcon.c |
5430 |
+@@ -122,12 +122,6 @@ static int logo_lines; |
5431 |
+ /* logo_shown is an index to vc_cons when >= 0; otherwise follows FBCON_LOGO |
5432 |
+ enums. */ |
5433 |
+ static int logo_shown = FBCON_LOGO_CANSHOW; |
5434 |
+-/* Software scrollback */ |
5435 |
+-static int fbcon_softback_size = 32768; |
5436 |
+-static unsigned long softback_buf, softback_curr; |
5437 |
+-static unsigned long softback_in; |
5438 |
+-static unsigned long softback_top, softback_end; |
5439 |
+-static int softback_lines; |
5440 |
+ /* console mappings */ |
5441 |
+ static int first_fb_vc; |
5442 |
+ static int last_fb_vc = MAX_NR_CONSOLES - 1; |
5443 |
+@@ -167,8 +161,6 @@ static int margin_color; |
5444 |
+ |
5445 |
+ static const struct consw fb_con; |
5446 |
+ |
5447 |
+-#define CM_SOFTBACK (8) |
5448 |
+- |
5449 |
+ #define advance_row(p, delta) (unsigned short *)((unsigned long)(p) + (delta) * vc->vc_size_row) |
5450 |
+ |
5451 |
+ static int fbcon_set_origin(struct vc_data *); |
5452 |
+@@ -373,18 +365,6 @@ static int get_color(struct vc_data *vc, struct fb_info *info, |
5453 |
+ return color; |
5454 |
+ } |
5455 |
+ |
5456 |
+-static void fbcon_update_softback(struct vc_data *vc) |
5457 |
+-{ |
5458 |
+- int l = fbcon_softback_size / vc->vc_size_row; |
5459 |
+- |
5460 |
+- if (l > 5) |
5461 |
+- softback_end = softback_buf + l * vc->vc_size_row; |
5462 |
+- else |
5463 |
+- /* Smaller scrollback makes no sense, and 0 would screw |
5464 |
+- the operation totally */ |
5465 |
+- softback_top = 0; |
5466 |
+-} |
5467 |
+- |
5468 |
+ static void fb_flashcursor(struct work_struct *work) |
5469 |
+ { |
5470 |
+ struct fb_info *info = container_of(work, struct fb_info, queue); |
5471 |
+@@ -414,7 +394,7 @@ static void fb_flashcursor(struct work_struct *work) |
5472 |
+ c = scr_readw((u16 *) vc->vc_pos); |
5473 |
+ mode = (!ops->cursor_flash || ops->cursor_state.enable) ? |
5474 |
+ CM_ERASE : CM_DRAW; |
5475 |
+- ops->cursor(vc, info, mode, softback_lines, get_color(vc, info, c, 1), |
5476 |
++ ops->cursor(vc, info, mode, get_color(vc, info, c, 1), |
5477 |
+ get_color(vc, info, c, 0)); |
5478 |
+ console_unlock(); |
5479 |
+ } |
5480 |
+@@ -471,13 +451,7 @@ static int __init fb_console_setup(char *this_opt) |
5481 |
+ } |
5482 |
+ |
5483 |
+ if (!strncmp(options, "scrollback:", 11)) { |
5484 |
+- options += 11; |
5485 |
+- if (*options) { |
5486 |
+- fbcon_softback_size = simple_strtoul(options, &options, 0); |
5487 |
+- if (*options == 'k' || *options == 'K') { |
5488 |
+- fbcon_softback_size *= 1024; |
5489 |
+- } |
5490 |
+- } |
5491 |
++ pr_warn("Ignoring scrollback size option\n"); |
5492 |
+ continue; |
5493 |
+ } |
5494 |
+ |
5495 |
+@@ -1022,31 +996,6 @@ static const char *fbcon_startup(void) |
5496 |
+ |
5497 |
+ set_blitting_type(vc, info); |
5498 |
+ |
5499 |
+- if (info->fix.type != FB_TYPE_TEXT) { |
5500 |
+- if (fbcon_softback_size) { |
5501 |
+- if (!softback_buf) { |
5502 |
+- softback_buf = |
5503 |
+- (unsigned long) |
5504 |
+- kvmalloc(fbcon_softback_size, |
5505 |
+- GFP_KERNEL); |
5506 |
+- if (!softback_buf) { |
5507 |
+- fbcon_softback_size = 0; |
5508 |
+- softback_top = 0; |
5509 |
+- } |
5510 |
+- } |
5511 |
+- } else { |
5512 |
+- if (softback_buf) { |
5513 |
+- kvfree((void *) softback_buf); |
5514 |
+- softback_buf = 0; |
5515 |
+- softback_top = 0; |
5516 |
+- } |
5517 |
+- } |
5518 |
+- if (softback_buf) |
5519 |
+- softback_in = softback_top = softback_curr = |
5520 |
+- softback_buf; |
5521 |
+- softback_lines = 0; |
5522 |
+- } |
5523 |
+- |
5524 |
+ /* Setup default font */ |
5525 |
+ if (!p->fontdata && !vc->vc_font.data) { |
5526 |
+ if (!fontname[0] || !(font = find_font(fontname))) |
5527 |
+@@ -1220,9 +1169,6 @@ static void fbcon_init(struct vc_data *vc, int init) |
5528 |
+ if (logo) |
5529 |
+ fbcon_prepare_logo(vc, info, cols, rows, new_cols, new_rows); |
5530 |
+ |
5531 |
+- if (vc == svc && softback_buf) |
5532 |
+- fbcon_update_softback(vc); |
5533 |
+- |
5534 |
+ if (ops->rotate_font && ops->rotate_font(info, vc)) { |
5535 |
+ ops->rotate = FB_ROTATE_UR; |
5536 |
+ set_blitting_type(vc, info); |
5537 |
+@@ -1385,7 +1331,6 @@ static void fbcon_cursor(struct vc_data *vc, int mode) |
5538 |
+ { |
5539 |
+ struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; |
5540 |
+ struct fbcon_ops *ops = info->fbcon_par; |
5541 |
+- int y; |
5542 |
+ int c = scr_readw((u16 *) vc->vc_pos); |
5543 |
+ |
5544 |
+ ops->cur_blink_jiffies = msecs_to_jiffies(vc->vc_cur_blink_ms); |
5545 |
+@@ -1399,16 +1344,8 @@ static void fbcon_cursor(struct vc_data *vc, int mode) |
5546 |
+ fbcon_add_cursor_timer(info); |
5547 |
+ |
5548 |
+ ops->cursor_flash = (mode == CM_ERASE) ? 0 : 1; |
5549 |
+- if (mode & CM_SOFTBACK) { |
5550 |
+- mode &= ~CM_SOFTBACK; |
5551 |
+- y = softback_lines; |
5552 |
+- } else { |
5553 |
+- if (softback_lines) |
5554 |
+- fbcon_set_origin(vc); |
5555 |
+- y = 0; |
5556 |
+- } |
5557 |
+ |
5558 |
+- ops->cursor(vc, info, mode, y, get_color(vc, info, c, 1), |
5559 |
++ ops->cursor(vc, info, mode, get_color(vc, info, c, 1), |
5560 |
+ get_color(vc, info, c, 0)); |
5561 |
+ } |
5562 |
+ |
5563 |
+@@ -1479,8 +1416,6 @@ static void fbcon_set_disp(struct fb_info *info, struct fb_var_screeninfo *var, |
5564 |
+ |
5565 |
+ if (con_is_visible(vc)) { |
5566 |
+ update_screen(vc); |
5567 |
+- if (softback_buf) |
5568 |
+- fbcon_update_softback(vc); |
5569 |
+ } |
5570 |
+ } |
5571 |
+ |
5572 |
+@@ -1618,99 +1553,6 @@ static __inline__ void ypan_down_redraw(struct vc_data *vc, int t, int count) |
5573 |
+ scrollback_current = 0; |
5574 |
+ } |
5575 |
+ |
5576 |
+-static void fbcon_redraw_softback(struct vc_data *vc, struct fbcon_display *p, |
5577 |
+- long delta) |
5578 |
+-{ |
5579 |
+- int count = vc->vc_rows; |
5580 |
+- unsigned short *d, *s; |
5581 |
+- unsigned long n; |
5582 |
+- int line = 0; |
5583 |
+- |
5584 |
+- d = (u16 *) softback_curr; |
5585 |
+- if (d == (u16 *) softback_in) |
5586 |
+- d = (u16 *) vc->vc_origin; |
5587 |
+- n = softback_curr + delta * vc->vc_size_row; |
5588 |
+- softback_lines -= delta; |
5589 |
+- if (delta < 0) { |
5590 |
+- if (softback_curr < softback_top && n < softback_buf) { |
5591 |
+- n += softback_end - softback_buf; |
5592 |
+- if (n < softback_top) { |
5593 |
+- softback_lines -= |
5594 |
+- (softback_top - n) / vc->vc_size_row; |
5595 |
+- n = softback_top; |
5596 |
+- } |
5597 |
+- } else if (softback_curr >= softback_top |
5598 |
+- && n < softback_top) { |
5599 |
+- softback_lines -= |
5600 |
+- (softback_top - n) / vc->vc_size_row; |
5601 |
+- n = softback_top; |
5602 |
+- } |
5603 |
+- } else { |
5604 |
+- if (softback_curr > softback_in && n >= softback_end) { |
5605 |
+- n += softback_buf - softback_end; |
5606 |
+- if (n > softback_in) { |
5607 |
+- n = softback_in; |
5608 |
+- softback_lines = 0; |
5609 |
+- } |
5610 |
+- } else if (softback_curr <= softback_in && n > softback_in) { |
5611 |
+- n = softback_in; |
5612 |
+- softback_lines = 0; |
5613 |
+- } |
5614 |
+- } |
5615 |
+- if (n == softback_curr) |
5616 |
+- return; |
5617 |
+- softback_curr = n; |
5618 |
+- s = (u16 *) softback_curr; |
5619 |
+- if (s == (u16 *) softback_in) |
5620 |
+- s = (u16 *) vc->vc_origin; |
5621 |
+- while (count--) { |
5622 |
+- unsigned short *start; |
5623 |
+- unsigned short *le; |
5624 |
+- unsigned short c; |
5625 |
+- int x = 0; |
5626 |
+- unsigned short attr = 1; |
5627 |
+- |
5628 |
+- start = s; |
5629 |
+- le = advance_row(s, 1); |
5630 |
+- do { |
5631 |
+- c = scr_readw(s); |
5632 |
+- if (attr != (c & 0xff00)) { |
5633 |
+- attr = c & 0xff00; |
5634 |
+- if (s > start) { |
5635 |
+- fbcon_putcs(vc, start, s - start, |
5636 |
+- line, x); |
5637 |
+- x += s - start; |
5638 |
+- start = s; |
5639 |
+- } |
5640 |
+- } |
5641 |
+- if (c == scr_readw(d)) { |
5642 |
+- if (s > start) { |
5643 |
+- fbcon_putcs(vc, start, s - start, |
5644 |
+- line, x); |
5645 |
+- x += s - start + 1; |
5646 |
+- start = s + 1; |
5647 |
+- } else { |
5648 |
+- x++; |
5649 |
+- start++; |
5650 |
+- } |
5651 |
+- } |
5652 |
+- s++; |
5653 |
+- d++; |
5654 |
+- } while (s < le); |
5655 |
+- if (s > start) |
5656 |
+- fbcon_putcs(vc, start, s - start, line, x); |
5657 |
+- line++; |
5658 |
+- if (d == (u16 *) softback_end) |
5659 |
+- d = (u16 *) softback_buf; |
5660 |
+- if (d == (u16 *) softback_in) |
5661 |
+- d = (u16 *) vc->vc_origin; |
5662 |
+- if (s == (u16 *) softback_end) |
5663 |
+- s = (u16 *) softback_buf; |
5664 |
+- if (s == (u16 *) softback_in) |
5665 |
+- s = (u16 *) vc->vc_origin; |
5666 |
+- } |
5667 |
+-} |
5668 |
+- |
5669 |
+ static void fbcon_redraw_move(struct vc_data *vc, struct fbcon_display *p, |
5670 |
+ int line, int count, int dy) |
5671 |
+ { |
5672 |
+@@ -1850,31 +1692,6 @@ static void fbcon_redraw(struct vc_data *vc, struct fbcon_display *p, |
5673 |
+ } |
5674 |
+ } |
5675 |
+ |
5676 |
+-static inline void fbcon_softback_note(struct vc_data *vc, int t, |
5677 |
+- int count) |
5678 |
+-{ |
5679 |
+- unsigned short *p; |
5680 |
+- |
5681 |
+- if (vc->vc_num != fg_console) |
5682 |
+- return; |
5683 |
+- p = (unsigned short *) (vc->vc_origin + t * vc->vc_size_row); |
5684 |
+- |
5685 |
+- while (count) { |
5686 |
+- scr_memcpyw((u16 *) softback_in, p, vc->vc_size_row); |
5687 |
+- count--; |
5688 |
+- p = advance_row(p, 1); |
5689 |
+- softback_in += vc->vc_size_row; |
5690 |
+- if (softback_in == softback_end) |
5691 |
+- softback_in = softback_buf; |
5692 |
+- if (softback_in == softback_top) { |
5693 |
+- softback_top += vc->vc_size_row; |
5694 |
+- if (softback_top == softback_end) |
5695 |
+- softback_top = softback_buf; |
5696 |
+- } |
5697 |
+- } |
5698 |
+- softback_curr = softback_in; |
5699 |
+-} |
5700 |
+- |
5701 |
+ static bool fbcon_scroll(struct vc_data *vc, unsigned int t, unsigned int b, |
5702 |
+ enum con_scroll dir, unsigned int count) |
5703 |
+ { |
5704 |
+@@ -1897,8 +1714,6 @@ static bool fbcon_scroll(struct vc_data *vc, unsigned int t, unsigned int b, |
5705 |
+ case SM_UP: |
5706 |
+ if (count > vc->vc_rows) /* Maximum realistic size */ |
5707 |
+ count = vc->vc_rows; |
5708 |
+- if (softback_top) |
5709 |
+- fbcon_softback_note(vc, t, count); |
5710 |
+ if (logo_shown >= 0) |
5711 |
+ goto redraw_up; |
5712 |
+ switch (p->scrollmode) { |
5713 |
+@@ -2269,14 +2084,6 @@ static int fbcon_switch(struct vc_data *vc) |
5714 |
+ info = registered_fb[con2fb_map[vc->vc_num]]; |
5715 |
+ ops = info->fbcon_par; |
5716 |
+ |
5717 |
+- if (softback_top) { |
5718 |
+- if (softback_lines) |
5719 |
+- fbcon_set_origin(vc); |
5720 |
+- softback_top = softback_curr = softback_in = softback_buf; |
5721 |
+- softback_lines = 0; |
5722 |
+- fbcon_update_softback(vc); |
5723 |
+- } |
5724 |
+- |
5725 |
+ if (logo_shown >= 0) { |
5726 |
+ struct vc_data *conp2 = vc_cons[logo_shown].d; |
5727 |
+ |
5728 |
+@@ -2600,9 +2407,6 @@ static int fbcon_do_set_font(struct vc_data *vc, int w, int h, |
5729 |
+ int cnt; |
5730 |
+ char *old_data = NULL; |
5731 |
+ |
5732 |
+- if (con_is_visible(vc) && softback_lines) |
5733 |
+- fbcon_set_origin(vc); |
5734 |
+- |
5735 |
+ resize = (w != vc->vc_font.width) || (h != vc->vc_font.height); |
5736 |
+ if (p->userfont) |
5737 |
+ old_data = vc->vc_font.data; |
5738 |
+@@ -2628,8 +2432,6 @@ static int fbcon_do_set_font(struct vc_data *vc, int w, int h, |
5739 |
+ cols /= w; |
5740 |
+ rows /= h; |
5741 |
+ vc_resize(vc, cols, rows); |
5742 |
+- if (con_is_visible(vc) && softback_buf) |
5743 |
+- fbcon_update_softback(vc); |
5744 |
+ } else if (con_is_visible(vc) |
5745 |
+ && vc->vc_mode == KD_TEXT) { |
5746 |
+ fbcon_clear_margins(vc, 0); |
5747 |
+@@ -2788,19 +2590,7 @@ static void fbcon_set_palette(struct vc_data *vc, const unsigned char *table) |
5748 |
+ |
5749 |
+ static u16 *fbcon_screen_pos(struct vc_data *vc, int offset) |
5750 |
+ { |
5751 |
+- unsigned long p; |
5752 |
+- int line; |
5753 |
+- |
5754 |
+- if (vc->vc_num != fg_console || !softback_lines) |
5755 |
+- return (u16 *) (vc->vc_origin + offset); |
5756 |
+- line = offset / vc->vc_size_row; |
5757 |
+- if (line >= softback_lines) |
5758 |
+- return (u16 *) (vc->vc_origin + offset - |
5759 |
+- softback_lines * vc->vc_size_row); |
5760 |
+- p = softback_curr + offset; |
5761 |
+- if (p >= softback_end) |
5762 |
+- p += softback_buf - softback_end; |
5763 |
+- return (u16 *) p; |
5764 |
++ return (u16 *) (vc->vc_origin + offset); |
5765 |
+ } |
5766 |
+ |
5767 |
+ static unsigned long fbcon_getxy(struct vc_data *vc, unsigned long pos, |
5768 |
+@@ -2814,22 +2604,7 @@ static unsigned long fbcon_getxy(struct vc_data *vc, unsigned long pos, |
5769 |
+ |
5770 |
+ x = offset % vc->vc_cols; |
5771 |
+ y = offset / vc->vc_cols; |
5772 |
+- if (vc->vc_num == fg_console) |
5773 |
+- y += softback_lines; |
5774 |
+ ret = pos + (vc->vc_cols - x) * 2; |
5775 |
+- } else if (vc->vc_num == fg_console && softback_lines) { |
5776 |
+- unsigned long offset = pos - softback_curr; |
5777 |
+- |
5778 |
+- if (pos < softback_curr) |
5779 |
+- offset += softback_end - softback_buf; |
5780 |
+- offset /= 2; |
5781 |
+- x = offset % vc->vc_cols; |
5782 |
+- y = offset / vc->vc_cols; |
5783 |
+- ret = pos + (vc->vc_cols - x) * 2; |
5784 |
+- if (ret == softback_end) |
5785 |
+- ret = softback_buf; |
5786 |
+- if (ret == softback_in) |
5787 |
+- ret = vc->vc_origin; |
5788 |
+ } else { |
5789 |
+ /* Should not happen */ |
5790 |
+ x = y = 0; |
5791 |
+@@ -2857,106 +2632,11 @@ static void fbcon_invert_region(struct vc_data *vc, u16 * p, int cnt) |
5792 |
+ a = ((a) & 0x88ff) | (((a) & 0x7000) >> 4) | |
5793 |
+ (((a) & 0x0700) << 4); |
5794 |
+ scr_writew(a, p++); |
5795 |
+- if (p == (u16 *) softback_end) |
5796 |
+- p = (u16 *) softback_buf; |
5797 |
+- if (p == (u16 *) softback_in) |
5798 |
+- p = (u16 *) vc->vc_origin; |
5799 |
+- } |
5800 |
+-} |
5801 |
+- |
5802 |
+-static void fbcon_scrolldelta(struct vc_data *vc, int lines) |
5803 |
+-{ |
5804 |
+- struct fb_info *info = registered_fb[con2fb_map[fg_console]]; |
5805 |
+- struct fbcon_ops *ops = info->fbcon_par; |
5806 |
+- struct fbcon_display *disp = &fb_display[fg_console]; |
5807 |
+- int offset, limit, scrollback_old; |
5808 |
+- |
5809 |
+- if (softback_top) { |
5810 |
+- if (vc->vc_num != fg_console) |
5811 |
+- return; |
5812 |
+- if (vc->vc_mode != KD_TEXT || !lines) |
5813 |
+- return; |
5814 |
+- if (logo_shown >= 0) { |
5815 |
+- struct vc_data *conp2 = vc_cons[logo_shown].d; |
5816 |
+- |
5817 |
+- if (conp2->vc_top == logo_lines |
5818 |
+- && conp2->vc_bottom == conp2->vc_rows) |
5819 |
+- conp2->vc_top = 0; |
5820 |
+- if (logo_shown == vc->vc_num) { |
5821 |
+- unsigned long p, q; |
5822 |
+- int i; |
5823 |
+- |
5824 |
+- p = softback_in; |
5825 |
+- q = vc->vc_origin + |
5826 |
+- logo_lines * vc->vc_size_row; |
5827 |
+- for (i = 0; i < logo_lines; i++) { |
5828 |
+- if (p == softback_top) |
5829 |
+- break; |
5830 |
+- if (p == softback_buf) |
5831 |
+- p = softback_end; |
5832 |
+- p -= vc->vc_size_row; |
5833 |
+- q -= vc->vc_size_row; |
5834 |
+- scr_memcpyw((u16 *) q, (u16 *) p, |
5835 |
+- vc->vc_size_row); |
5836 |
+- } |
5837 |
+- softback_in = softback_curr = p; |
5838 |
+- update_region(vc, vc->vc_origin, |
5839 |
+- logo_lines * vc->vc_cols); |
5840 |
+- } |
5841 |
+- logo_shown = FBCON_LOGO_CANSHOW; |
5842 |
+- } |
5843 |
+- fbcon_cursor(vc, CM_ERASE | CM_SOFTBACK); |
5844 |
+- fbcon_redraw_softback(vc, disp, lines); |
5845 |
+- fbcon_cursor(vc, CM_DRAW | CM_SOFTBACK); |
5846 |
+- return; |
5847 |
+ } |
5848 |
+- |
5849 |
+- if (!scrollback_phys_max) |
5850 |
+- return; |
5851 |
+- |
5852 |
+- scrollback_old = scrollback_current; |
5853 |
+- scrollback_current -= lines; |
5854 |
+- if (scrollback_current < 0) |
5855 |
+- scrollback_current = 0; |
5856 |
+- else if (scrollback_current > scrollback_max) |
5857 |
+- scrollback_current = scrollback_max; |
5858 |
+- if (scrollback_current == scrollback_old) |
5859 |
+- return; |
5860 |
+- |
5861 |
+- if (fbcon_is_inactive(vc, info)) |
5862 |
+- return; |
5863 |
+- |
5864 |
+- fbcon_cursor(vc, CM_ERASE); |
5865 |
+- |
5866 |
+- offset = disp->yscroll - scrollback_current; |
5867 |
+- limit = disp->vrows; |
5868 |
+- switch (disp->scrollmode) { |
5869 |
+- case SCROLL_WRAP_MOVE: |
5870 |
+- info->var.vmode |= FB_VMODE_YWRAP; |
5871 |
+- break; |
5872 |
+- case SCROLL_PAN_MOVE: |
5873 |
+- case SCROLL_PAN_REDRAW: |
5874 |
+- limit -= vc->vc_rows; |
5875 |
+- info->var.vmode &= ~FB_VMODE_YWRAP; |
5876 |
+- break; |
5877 |
+- } |
5878 |
+- if (offset < 0) |
5879 |
+- offset += limit; |
5880 |
+- else if (offset >= limit) |
5881 |
+- offset -= limit; |
5882 |
+- |
5883 |
+- ops->var.xoffset = 0; |
5884 |
+- ops->var.yoffset = offset * vc->vc_font.height; |
5885 |
+- ops->update_start(info); |
5886 |
+- |
5887 |
+- if (!scrollback_current) |
5888 |
+- fbcon_cursor(vc, CM_DRAW); |
5889 |
+ } |
5890 |
+ |
5891 |
+ static int fbcon_set_origin(struct vc_data *vc) |
5892 |
+ { |
5893 |
+- if (softback_lines) |
5894 |
+- fbcon_scrolldelta(vc, softback_lines); |
5895 |
+ return 0; |
5896 |
+ } |
5897 |
+ |
5898 |
+@@ -3020,8 +2700,6 @@ static void fbcon_modechanged(struct fb_info *info) |
5899 |
+ |
5900 |
+ fbcon_set_palette(vc, color_table); |
5901 |
+ update_screen(vc); |
5902 |
+- if (softback_buf) |
5903 |
+- fbcon_update_softback(vc); |
5904 |
+ } |
5905 |
+ } |
5906 |
+ |
5907 |
+@@ -3432,7 +3110,6 @@ static const struct consw fb_con = { |
5908 |
+ .con_font_default = fbcon_set_def_font, |
5909 |
+ .con_font_copy = fbcon_copy_font, |
5910 |
+ .con_set_palette = fbcon_set_palette, |
5911 |
+- .con_scrolldelta = fbcon_scrolldelta, |
5912 |
+ .con_set_origin = fbcon_set_origin, |
5913 |
+ .con_invert_region = fbcon_invert_region, |
5914 |
+ .con_screen_pos = fbcon_screen_pos, |
5915 |
+@@ -3667,9 +3344,6 @@ static void fbcon_exit(void) |
5916 |
+ } |
5917 |
+ #endif |
5918 |
+ |
5919 |
+- kvfree((void *)softback_buf); |
5920 |
+- softback_buf = 0UL; |
5921 |
+- |
5922 |
+ for_each_registered_fb(i) { |
5923 |
+ int pending = 0; |
5924 |
+ |
5925 |
+diff --git a/drivers/video/fbdev/core/fbcon.h b/drivers/video/fbdev/core/fbcon.h |
5926 |
+index 20dea853765f5..78bb14c03643e 100644 |
5927 |
+--- a/drivers/video/fbdev/core/fbcon.h |
5928 |
++++ b/drivers/video/fbdev/core/fbcon.h |
5929 |
+@@ -62,7 +62,7 @@ struct fbcon_ops { |
5930 |
+ void (*clear_margins)(struct vc_data *vc, struct fb_info *info, |
5931 |
+ int color, int bottom_only); |
5932 |
+ void (*cursor)(struct vc_data *vc, struct fb_info *info, int mode, |
5933 |
+- int softback_lines, int fg, int bg); |
5934 |
++ int fg, int bg); |
5935 |
+ int (*update_start)(struct fb_info *info); |
5936 |
+ int (*rotate_font)(struct fb_info *info, struct vc_data *vc); |
5937 |
+ struct fb_var_screeninfo var; /* copy of the current fb_var_screeninfo */ |
5938 |
+diff --git a/drivers/video/fbdev/core/fbcon_ccw.c b/drivers/video/fbdev/core/fbcon_ccw.c |
5939 |
+index 78f3a56214782..71ad6967a70ee 100644 |
5940 |
+--- a/drivers/video/fbdev/core/fbcon_ccw.c |
5941 |
++++ b/drivers/video/fbdev/core/fbcon_ccw.c |
5942 |
+@@ -219,7 +219,7 @@ static void ccw_clear_margins(struct vc_data *vc, struct fb_info *info, |
5943 |
+ } |
5944 |
+ |
5945 |
+ static void ccw_cursor(struct vc_data *vc, struct fb_info *info, int mode, |
5946 |
+- int softback_lines, int fg, int bg) |
5947 |
++ int fg, int bg) |
5948 |
+ { |
5949 |
+ struct fb_cursor cursor; |
5950 |
+ struct fbcon_ops *ops = info->fbcon_par; |
5951 |
+@@ -236,15 +236,6 @@ static void ccw_cursor(struct vc_data *vc, struct fb_info *info, int mode, |
5952 |
+ |
5953 |
+ cursor.set = 0; |
5954 |
+ |
5955 |
+- if (softback_lines) { |
5956 |
+- if (y + softback_lines >= vc->vc_rows) { |
5957 |
+- mode = CM_ERASE; |
5958 |
+- ops->cursor_flash = 0; |
5959 |
+- return; |
5960 |
+- } else |
5961 |
+- y += softback_lines; |
5962 |
+- } |
5963 |
+- |
5964 |
+ c = scr_readw((u16 *) vc->vc_pos); |
5965 |
+ attribute = get_attribute(info, c); |
5966 |
+ src = ops->fontbuffer + ((c & charmask) * (w * vc->vc_font.width)); |
5967 |
+diff --git a/drivers/video/fbdev/core/fbcon_cw.c b/drivers/video/fbdev/core/fbcon_cw.c |
5968 |
+index fd098ff17574b..31fe5dd651d44 100644 |
5969 |
+--- a/drivers/video/fbdev/core/fbcon_cw.c |
5970 |
++++ b/drivers/video/fbdev/core/fbcon_cw.c |
5971 |
+@@ -202,7 +202,7 @@ static void cw_clear_margins(struct vc_data *vc, struct fb_info *info, |
5972 |
+ } |
5973 |
+ |
5974 |
+ static void cw_cursor(struct vc_data *vc, struct fb_info *info, int mode, |
5975 |
+- int softback_lines, int fg, int bg) |
5976 |
++ int fg, int bg) |
5977 |
+ { |
5978 |
+ struct fb_cursor cursor; |
5979 |
+ struct fbcon_ops *ops = info->fbcon_par; |
5980 |
+@@ -219,15 +219,6 @@ static void cw_cursor(struct vc_data *vc, struct fb_info *info, int mode, |
5981 |
+ |
5982 |
+ cursor.set = 0; |
5983 |
+ |
5984 |
+- if (softback_lines) { |
5985 |
+- if (y + softback_lines >= vc->vc_rows) { |
5986 |
+- mode = CM_ERASE; |
5987 |
+- ops->cursor_flash = 0; |
5988 |
+- return; |
5989 |
+- } else |
5990 |
+- y += softback_lines; |
5991 |
+- } |
5992 |
+- |
5993 |
+ c = scr_readw((u16 *) vc->vc_pos); |
5994 |
+ attribute = get_attribute(info, c); |
5995 |
+ src = ops->fontbuffer + ((c & charmask) * (w * vc->vc_font.width)); |
5996 |
+diff --git a/drivers/video/fbdev/core/fbcon_ud.c b/drivers/video/fbdev/core/fbcon_ud.c |
5997 |
+index e165a3fad29ad..b2dd1370e39b2 100644 |
5998 |
+--- a/drivers/video/fbdev/core/fbcon_ud.c |
5999 |
++++ b/drivers/video/fbdev/core/fbcon_ud.c |
6000 |
+@@ -249,7 +249,7 @@ static void ud_clear_margins(struct vc_data *vc, struct fb_info *info, |
6001 |
+ } |
6002 |
+ |
6003 |
+ static void ud_cursor(struct vc_data *vc, struct fb_info *info, int mode, |
6004 |
+- int softback_lines, int fg, int bg) |
6005 |
++ int fg, int bg) |
6006 |
+ { |
6007 |
+ struct fb_cursor cursor; |
6008 |
+ struct fbcon_ops *ops = info->fbcon_par; |
6009 |
+@@ -267,15 +267,6 @@ static void ud_cursor(struct vc_data *vc, struct fb_info *info, int mode, |
6010 |
+ |
6011 |
+ cursor.set = 0; |
6012 |
+ |
6013 |
+- if (softback_lines) { |
6014 |
+- if (y + softback_lines >= vc->vc_rows) { |
6015 |
+- mode = CM_ERASE; |
6016 |
+- ops->cursor_flash = 0; |
6017 |
+- return; |
6018 |
+- } else |
6019 |
+- y += softback_lines; |
6020 |
+- } |
6021 |
+- |
6022 |
+ c = scr_readw((u16 *) vc->vc_pos); |
6023 |
+ attribute = get_attribute(info, c); |
6024 |
+ src = ops->fontbuffer + ((c & charmask) * (w * vc->vc_font.height)); |
6025 |
+diff --git a/drivers/video/fbdev/core/tileblit.c b/drivers/video/fbdev/core/tileblit.c |
6026 |
+index 93390312957ff..eb664dbf96f66 100644 |
6027 |
+--- a/drivers/video/fbdev/core/tileblit.c |
6028 |
++++ b/drivers/video/fbdev/core/tileblit.c |
6029 |
+@@ -80,7 +80,7 @@ static void tile_clear_margins(struct vc_data *vc, struct fb_info *info, |
6030 |
+ } |
6031 |
+ |
6032 |
+ static void tile_cursor(struct vc_data *vc, struct fb_info *info, int mode, |
6033 |
+- int softback_lines, int fg, int bg) |
6034 |
++ int fg, int bg) |
6035 |
+ { |
6036 |
+ struct fb_tilecursor cursor; |
6037 |
+ int use_sw = (vc->vc_cursor_type & 0x10); |
6038 |
+diff --git a/drivers/video/fbdev/vga16fb.c b/drivers/video/fbdev/vga16fb.c |
6039 |
+index a20eeb8308ffd..578d3541e3d6f 100644 |
6040 |
+--- a/drivers/video/fbdev/vga16fb.c |
6041 |
++++ b/drivers/video/fbdev/vga16fb.c |
6042 |
+@@ -1121,7 +1121,7 @@ static void vga_8planes_imageblit(struct fb_info *info, const struct fb_image *i |
6043 |
+ char oldop = setop(0); |
6044 |
+ char oldsr = setsr(0); |
6045 |
+ char oldmask = selectmask(); |
6046 |
+- const char *cdat = image->data; |
6047 |
++ const unsigned char *cdat = image->data; |
6048 |
+ u32 dx = image->dx; |
6049 |
+ char __iomem *where; |
6050 |
+ int y; |
6051 |
+diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c |
6052 |
+index 983f4d58ae59b..6d3ed9542b6c1 100644 |
6053 |
+--- a/fs/btrfs/disk-io.c |
6054 |
++++ b/fs/btrfs/disk-io.c |
6055 |
+@@ -3446,6 +3446,8 @@ fail_block_groups: |
6056 |
+ btrfs_put_block_group_cache(fs_info); |
6057 |
+ |
6058 |
+ fail_tree_roots: |
6059 |
++ if (fs_info->data_reloc_root) |
6060 |
++ btrfs_drop_and_free_fs_root(fs_info, fs_info->data_reloc_root); |
6061 |
+ free_root_pointers(fs_info, true); |
6062 |
+ invalidate_inode_pages2(fs_info->btree_inode->i_mapping); |
6063 |
+ |
6064 |
+diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c |
6065 |
+index e9eedc053fc52..780b9c9a98fe3 100644 |
6066 |
+--- a/fs/btrfs/extent-tree.c |
6067 |
++++ b/fs/btrfs/extent-tree.c |
6068 |
+@@ -400,12 +400,11 @@ int btrfs_get_extent_inline_ref_type(const struct extent_buffer *eb, |
6069 |
+ if (type == BTRFS_SHARED_BLOCK_REF_KEY) { |
6070 |
+ ASSERT(eb->fs_info); |
6071 |
+ /* |
6072 |
+- * Every shared one has parent tree |
6073 |
+- * block, which must be aligned to |
6074 |
+- * nodesize. |
6075 |
++ * Every shared one has parent tree block, |
6076 |
++ * which must be aligned to sector size. |
6077 |
+ */ |
6078 |
+ if (offset && |
6079 |
+- IS_ALIGNED(offset, eb->fs_info->nodesize)) |
6080 |
++ IS_ALIGNED(offset, eb->fs_info->sectorsize)) |
6081 |
+ return type; |
6082 |
+ } |
6083 |
+ } else if (is_data == BTRFS_REF_TYPE_DATA) { |
6084 |
+@@ -414,12 +413,11 @@ int btrfs_get_extent_inline_ref_type(const struct extent_buffer *eb, |
6085 |
+ if (type == BTRFS_SHARED_DATA_REF_KEY) { |
6086 |
+ ASSERT(eb->fs_info); |
6087 |
+ /* |
6088 |
+- * Every shared one has parent tree |
6089 |
+- * block, which must be aligned to |
6090 |
+- * nodesize. |
6091 |
++ * Every shared one has parent tree block, |
6092 |
++ * which must be aligned to sector size. |
6093 |
+ */ |
6094 |
+ if (offset && |
6095 |
+- IS_ALIGNED(offset, eb->fs_info->nodesize)) |
6096 |
++ IS_ALIGNED(offset, eb->fs_info->sectorsize)) |
6097 |
+ return type; |
6098 |
+ } |
6099 |
+ } else { |
6100 |
+@@ -429,8 +427,9 @@ int btrfs_get_extent_inline_ref_type(const struct extent_buffer *eb, |
6101 |
+ } |
6102 |
+ |
6103 |
+ btrfs_print_leaf((struct extent_buffer *)eb); |
6104 |
+- btrfs_err(eb->fs_info, "eb %llu invalid extent inline ref type %d", |
6105 |
+- eb->start, type); |
6106 |
++ btrfs_err(eb->fs_info, |
6107 |
++ "eb %llu iref 0x%lx invalid extent inline ref type %d", |
6108 |
++ eb->start, (unsigned long)iref, type); |
6109 |
+ WARN_ON(1); |
6110 |
+ |
6111 |
+ return BTRFS_REF_TYPE_INVALID; |
6112 |
+diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c |
6113 |
+index 5cbebf32082ab..2dc7707d4e600 100644 |
6114 |
+--- a/fs/btrfs/ioctl.c |
6115 |
++++ b/fs/btrfs/ioctl.c |
6116 |
+@@ -2193,7 +2193,8 @@ static noinline int search_ioctl(struct inode *inode, |
6117 |
+ key.offset = sk->min_offset; |
6118 |
+ |
6119 |
+ while (1) { |
6120 |
+- ret = fault_in_pages_writeable(ubuf, *buf_size - sk_offset); |
6121 |
++ ret = fault_in_pages_writeable(ubuf + sk_offset, |
6122 |
++ *buf_size - sk_offset); |
6123 |
+ if (ret) |
6124 |
+ break; |
6125 |
+ |
6126 |
+diff --git a/fs/btrfs/print-tree.c b/fs/btrfs/print-tree.c |
6127 |
+index 61f44e78e3c9e..80567c11ec122 100644 |
6128 |
+--- a/fs/btrfs/print-tree.c |
6129 |
++++ b/fs/btrfs/print-tree.c |
6130 |
+@@ -95,9 +95,10 @@ static void print_extent_item(struct extent_buffer *eb, int slot, int type) |
6131 |
+ * offset is supposed to be a tree block which |
6132 |
+ * must be aligned to nodesize. |
6133 |
+ */ |
6134 |
+- if (!IS_ALIGNED(offset, eb->fs_info->nodesize)) |
6135 |
+- pr_info("\t\t\t(parent %llu is NOT ALIGNED to nodesize %llu)\n", |
6136 |
+- offset, (unsigned long long)eb->fs_info->nodesize); |
6137 |
++ if (!IS_ALIGNED(offset, eb->fs_info->sectorsize)) |
6138 |
++ pr_info( |
6139 |
++ "\t\t\t(parent %llu not aligned to sectorsize %u)\n", |
6140 |
++ offset, eb->fs_info->sectorsize); |
6141 |
+ break; |
6142 |
+ case BTRFS_EXTENT_DATA_REF_KEY: |
6143 |
+ dref = (struct btrfs_extent_data_ref *)(&iref->offset); |
6144 |
+@@ -112,8 +113,9 @@ static void print_extent_item(struct extent_buffer *eb, int slot, int type) |
6145 |
+ * must be aligned to nodesize. |
6146 |
+ */ |
6147 |
+ if (!IS_ALIGNED(offset, eb->fs_info->nodesize)) |
6148 |
+- pr_info("\t\t\t(parent %llu is NOT ALIGNED to nodesize %llu)\n", |
6149 |
+- offset, (unsigned long long)eb->fs_info->nodesize); |
6150 |
++ pr_info( |
6151 |
++ "\t\t\t(parent %llu not aligned to sectorsize %u)\n", |
6152 |
++ offset, eb->fs_info->sectorsize); |
6153 |
+ break; |
6154 |
+ default: |
6155 |
+ pr_cont("(extent %llu has INVALID ref type %d)\n", |
6156 |
+diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c |
6157 |
+index 2710f8ddb95fb..b43ebf55b93e1 100644 |
6158 |
+--- a/fs/btrfs/transaction.c |
6159 |
++++ b/fs/btrfs/transaction.c |
6160 |
+@@ -1636,6 +1636,7 @@ static noinline int create_pending_snapshot(struct btrfs_trans_handle *trans, |
6161 |
+ pending->snap = btrfs_get_new_fs_root(fs_info, objectid, pending->anon_dev); |
6162 |
+ if (IS_ERR(pending->snap)) { |
6163 |
+ ret = PTR_ERR(pending->snap); |
6164 |
++ pending->snap = NULL; |
6165 |
+ btrfs_abort_transaction(trans, ret); |
6166 |
+ goto fail; |
6167 |
+ } |
6168 |
+diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c |
6169 |
+index 0e50b885d3fd6..956eb0d6bc584 100644 |
6170 |
+--- a/fs/btrfs/volumes.c |
6171 |
++++ b/fs/btrfs/volumes.c |
6172 |
+@@ -4,6 +4,7 @@ |
6173 |
+ */ |
6174 |
+ |
6175 |
+ #include <linux/sched.h> |
6176 |
++#include <linux/sched/mm.h> |
6177 |
+ #include <linux/bio.h> |
6178 |
+ #include <linux/slab.h> |
6179 |
+ #include <linux/blkdev.h> |
6180 |
+@@ -6500,8 +6501,17 @@ static struct btrfs_device *add_missing_dev(struct btrfs_fs_devices *fs_devices, |
6181 |
+ u64 devid, u8 *dev_uuid) |
6182 |
+ { |
6183 |
+ struct btrfs_device *device; |
6184 |
++ unsigned int nofs_flag; |
6185 |
+ |
6186 |
++ /* |
6187 |
++ * We call this under the chunk_mutex, so we want to use NOFS for this |
6188 |
++ * allocation, however we don't want to change btrfs_alloc_device() to |
6189 |
++ * always do NOFS because we use it in a lot of other GFP_KERNEL safe |
6190 |
++ * places. |
6191 |
++ */ |
6192 |
++ nofs_flag = memalloc_nofs_save(); |
6193 |
+ device = btrfs_alloc_device(NULL, &devid, dev_uuid); |
6194 |
++ memalloc_nofs_restore(nofs_flag); |
6195 |
+ if (IS_ERR(device)) |
6196 |
+ return device; |
6197 |
+ |
6198 |
+diff --git a/fs/debugfs/file.c b/fs/debugfs/file.c |
6199 |
+index ae49a55bda001..1862331f1b48d 100644 |
6200 |
+--- a/fs/debugfs/file.c |
6201 |
++++ b/fs/debugfs/file.c |
6202 |
+@@ -177,7 +177,7 @@ static int open_proxy_open(struct inode *inode, struct file *filp) |
6203 |
+ goto out; |
6204 |
+ |
6205 |
+ if (!fops_get(real_fops)) { |
6206 |
+-#ifdef MODULE |
6207 |
++#ifdef CONFIG_MODULES |
6208 |
+ if (real_fops->owner && |
6209 |
+ real_fops->owner->state == MODULE_STATE_GOING) |
6210 |
+ goto out; |
6211 |
+@@ -312,7 +312,7 @@ static int full_proxy_open(struct inode *inode, struct file *filp) |
6212 |
+ goto out; |
6213 |
+ |
6214 |
+ if (!fops_get(real_fops)) { |
6215 |
+-#ifdef MODULE |
6216 |
++#ifdef CONFIG_MODULES |
6217 |
+ if (real_fops->owner && |
6218 |
+ real_fops->owner->state == MODULE_STATE_GOING) |
6219 |
+ goto out; |
6220 |
+diff --git a/fs/xfs/libxfs/xfs_attr_leaf.c b/fs/xfs/libxfs/xfs_attr_leaf.c |
6221 |
+index 4eb2ecd31b0d2..9bafe50a21240 100644 |
6222 |
+--- a/fs/xfs/libxfs/xfs_attr_leaf.c |
6223 |
++++ b/fs/xfs/libxfs/xfs_attr_leaf.c |
6224 |
+@@ -653,8 +653,8 @@ xfs_attr_shortform_create( |
6225 |
+ ASSERT(ifp->if_flags & XFS_IFINLINE); |
6226 |
+ } |
6227 |
+ xfs_idata_realloc(dp, sizeof(*hdr), XFS_ATTR_FORK); |
6228 |
+- hdr = (xfs_attr_sf_hdr_t *)ifp->if_u1.if_data; |
6229 |
+- hdr->count = 0; |
6230 |
++ hdr = (struct xfs_attr_sf_hdr *)ifp->if_u1.if_data; |
6231 |
++ memset(hdr, 0, sizeof(*hdr)); |
6232 |
+ hdr->totsize = cpu_to_be16(sizeof(*hdr)); |
6233 |
+ xfs_trans_log_inode(args->trans, dp, XFS_ILOG_CORE | XFS_ILOG_ADATA); |
6234 |
+ } |
6235 |
+diff --git a/fs/xfs/libxfs/xfs_ialloc.c b/fs/xfs/libxfs/xfs_ialloc.c |
6236 |
+index 7fcf62b324b0d..8c1a7cc484b65 100644 |
6237 |
+--- a/fs/xfs/libxfs/xfs_ialloc.c |
6238 |
++++ b/fs/xfs/libxfs/xfs_ialloc.c |
6239 |
+@@ -688,7 +688,7 @@ xfs_ialloc_ag_alloc( |
6240 |
+ args.minalignslop = igeo->cluster_align - 1; |
6241 |
+ |
6242 |
+ /* Allow space for the inode btree to split. */ |
6243 |
+- args.minleft = igeo->inobt_maxlevels - 1; |
6244 |
++ args.minleft = igeo->inobt_maxlevels; |
6245 |
+ if ((error = xfs_alloc_vextent(&args))) |
6246 |
+ return error; |
6247 |
+ |
6248 |
+@@ -736,7 +736,7 @@ xfs_ialloc_ag_alloc( |
6249 |
+ /* |
6250 |
+ * Allow space for the inode btree to split. |
6251 |
+ */ |
6252 |
+- args.minleft = igeo->inobt_maxlevels - 1; |
6253 |
++ args.minleft = igeo->inobt_maxlevels; |
6254 |
+ if ((error = xfs_alloc_vextent(&args))) |
6255 |
+ return error; |
6256 |
+ } |
6257 |
+diff --git a/fs/xfs/libxfs/xfs_trans_space.h b/fs/xfs/libxfs/xfs_trans_space.h |
6258 |
+index c6df01a2a1585..7ad3659c5d2a9 100644 |
6259 |
+--- a/fs/xfs/libxfs/xfs_trans_space.h |
6260 |
++++ b/fs/xfs/libxfs/xfs_trans_space.h |
6261 |
+@@ -58,7 +58,7 @@ |
6262 |
+ #define XFS_IALLOC_SPACE_RES(mp) \ |
6263 |
+ (M_IGEO(mp)->ialloc_blks + \ |
6264 |
+ ((xfs_sb_version_hasfinobt(&mp->m_sb) ? 2 : 1) * \ |
6265 |
+- (M_IGEO(mp)->inobt_maxlevels - 1))) |
6266 |
++ M_IGEO(mp)->inobt_maxlevels)) |
6267 |
+ |
6268 |
+ /* |
6269 |
+ * Space reservation values for various transactions. |
6270 |
+diff --git a/include/linux/efi_embedded_fw.h b/include/linux/efi_embedded_fw.h |
6271 |
+index 57eac5241303a..a97a12bb2c9ef 100644 |
6272 |
+--- a/include/linux/efi_embedded_fw.h |
6273 |
++++ b/include/linux/efi_embedded_fw.h |
6274 |
+@@ -8,8 +8,8 @@ |
6275 |
+ #define EFI_EMBEDDED_FW_PREFIX_LEN 8 |
6276 |
+ |
6277 |
+ /* |
6278 |
+- * This struct and efi_embedded_fw_list are private to the efi-embedded fw |
6279 |
+- * implementation they are in this header for use by lib/test_firmware.c only! |
6280 |
++ * This struct is private to the efi-embedded fw implementation. |
6281 |
++ * They are in this header for use by lib/test_firmware.c only! |
6282 |
+ */ |
6283 |
+ struct efi_embedded_fw { |
6284 |
+ struct list_head list; |
6285 |
+@@ -18,8 +18,6 @@ struct efi_embedded_fw { |
6286 |
+ size_t length; |
6287 |
+ }; |
6288 |
+ |
6289 |
+-extern struct list_head efi_embedded_fw_list; |
6290 |
+- |
6291 |
+ /** |
6292 |
+ * struct efi_embedded_fw_desc - This struct is used by the EFI embedded-fw |
6293 |
+ * code to search for embedded firmwares. |
6294 |
+diff --git a/include/linux/netfilter/nf_conntrack_sctp.h b/include/linux/netfilter/nf_conntrack_sctp.h |
6295 |
+index 9a33f171aa822..625f491b95de8 100644 |
6296 |
+--- a/include/linux/netfilter/nf_conntrack_sctp.h |
6297 |
++++ b/include/linux/netfilter/nf_conntrack_sctp.h |
6298 |
+@@ -9,6 +9,8 @@ struct ip_ct_sctp { |
6299 |
+ enum sctp_conntrack state; |
6300 |
+ |
6301 |
+ __be32 vtag[IP_CT_DIR_MAX]; |
6302 |
++ u8 last_dir; |
6303 |
++ u8 flags; |
6304 |
+ }; |
6305 |
+ |
6306 |
+ #endif /* _NF_CONNTRACK_SCTP_H */ |
6307 |
+diff --git a/include/soc/nps/common.h b/include/soc/nps/common.h |
6308 |
+index 9b1d43d671a3f..8c18dc6d3fde5 100644 |
6309 |
+--- a/include/soc/nps/common.h |
6310 |
++++ b/include/soc/nps/common.h |
6311 |
+@@ -45,6 +45,12 @@ |
6312 |
+ #define CTOP_INST_MOV2B_FLIP_R3_B1_B2_INST 0x5B60 |
6313 |
+ #define CTOP_INST_MOV2B_FLIP_R3_B1_B2_LIMM 0x00010422 |
6314 |
+ |
6315 |
++#ifndef AUX_IENABLE |
6316 |
++#define AUX_IENABLE 0x40c |
6317 |
++#endif |
6318 |
++ |
6319 |
++#define CTOP_AUX_IACK (0xFFFFF800 + 0x088) |
6320 |
++ |
6321 |
+ #ifndef __ASSEMBLY__ |
6322 |
+ |
6323 |
+ /* In order to increase compilation test coverage */ |
6324 |
+diff --git a/kernel/gcov/gcc_4_7.c b/kernel/gcov/gcc_4_7.c |
6325 |
+index 908fdf5098c32..53c67c87f141b 100644 |
6326 |
+--- a/kernel/gcov/gcc_4_7.c |
6327 |
++++ b/kernel/gcov/gcc_4_7.c |
6328 |
+@@ -19,7 +19,9 @@ |
6329 |
+ #include <linux/vmalloc.h> |
6330 |
+ #include "gcov.h" |
6331 |
+ |
6332 |
+-#if (__GNUC__ >= 7) |
6333 |
++#if (__GNUC__ >= 10) |
6334 |
++#define GCOV_COUNTERS 8 |
6335 |
++#elif (__GNUC__ >= 7) |
6336 |
+ #define GCOV_COUNTERS 9 |
6337 |
+ #elif (__GNUC__ > 5) || (__GNUC__ == 5 && __GNUC_MINOR__ >= 1) |
6338 |
+ #define GCOV_COUNTERS 10 |
6339 |
+diff --git a/kernel/padata.c b/kernel/padata.c |
6340 |
+index 4373f7adaa40a..3bc90fec0904c 100644 |
6341 |
+--- a/kernel/padata.c |
6342 |
++++ b/kernel/padata.c |
6343 |
+@@ -215,12 +215,13 @@ int padata_do_parallel(struct padata_shell *ps, |
6344 |
+ padata->pd = pd; |
6345 |
+ padata->cb_cpu = *cb_cpu; |
6346 |
+ |
6347 |
+- rcu_read_unlock_bh(); |
6348 |
+- |
6349 |
+ spin_lock(&padata_works_lock); |
6350 |
+ padata->seq_nr = ++pd->seq_nr; |
6351 |
+ pw = padata_work_alloc(); |
6352 |
+ spin_unlock(&padata_works_lock); |
6353 |
++ |
6354 |
++ rcu_read_unlock_bh(); |
6355 |
++ |
6356 |
+ if (pw) { |
6357 |
+ padata_work_init(pw, padata_parallel_worker, padata, 0); |
6358 |
+ queue_work(pinst->parallel_wq, &pw->pw_work); |
6359 |
+diff --git a/kernel/seccomp.c b/kernel/seccomp.c |
6360 |
+index c461ba9925136..54cf84bac3c9b 100644 |
6361 |
+--- a/kernel/seccomp.c |
6362 |
++++ b/kernel/seccomp.c |
6363 |
+@@ -997,13 +997,12 @@ out: |
6364 |
+ } |
6365 |
+ |
6366 |
+ #ifdef CONFIG_SECCOMP_FILTER |
6367 |
+-static int seccomp_notify_release(struct inode *inode, struct file *file) |
6368 |
++static void seccomp_notify_detach(struct seccomp_filter *filter) |
6369 |
+ { |
6370 |
+- struct seccomp_filter *filter = file->private_data; |
6371 |
+ struct seccomp_knotif *knotif; |
6372 |
+ |
6373 |
+ if (!filter) |
6374 |
+- return 0; |
6375 |
++ return; |
6376 |
+ |
6377 |
+ mutex_lock(&filter->notify_lock); |
6378 |
+ |
6379 |
+@@ -1025,6 +1024,13 @@ static int seccomp_notify_release(struct inode *inode, struct file *file) |
6380 |
+ kfree(filter->notif); |
6381 |
+ filter->notif = NULL; |
6382 |
+ mutex_unlock(&filter->notify_lock); |
6383 |
++} |
6384 |
++ |
6385 |
++static int seccomp_notify_release(struct inode *inode, struct file *file) |
6386 |
++{ |
6387 |
++ struct seccomp_filter *filter = file->private_data; |
6388 |
++ |
6389 |
++ seccomp_notify_detach(filter); |
6390 |
+ __put_seccomp_filter(filter); |
6391 |
+ return 0; |
6392 |
+ } |
6393 |
+@@ -1358,6 +1364,7 @@ out_put_fd: |
6394 |
+ listener_f->private_data = NULL; |
6395 |
+ fput(listener_f); |
6396 |
+ put_unused_fd(listener); |
6397 |
++ seccomp_notify_detach(prepared); |
6398 |
+ } else { |
6399 |
+ fd_install(listener, listener_f); |
6400 |
+ ret = listener; |
6401 |
+diff --git a/lib/kobject.c b/lib/kobject.c |
6402 |
+index 3afb939f2a1cc..9dce68c378e61 100644 |
6403 |
+--- a/lib/kobject.c |
6404 |
++++ b/lib/kobject.c |
6405 |
+@@ -637,8 +637,12 @@ static void __kobject_del(struct kobject *kobj) |
6406 |
+ */ |
6407 |
+ void kobject_del(struct kobject *kobj) |
6408 |
+ { |
6409 |
+- struct kobject *parent = kobj->parent; |
6410 |
++ struct kobject *parent; |
6411 |
++ |
6412 |
++ if (!kobj) |
6413 |
++ return; |
6414 |
+ |
6415 |
++ parent = kobj->parent; |
6416 |
+ __kobject_del(kobj); |
6417 |
+ kobject_put(parent); |
6418 |
+ } |
6419 |
+diff --git a/lib/test_firmware.c b/lib/test_firmware.c |
6420 |
+index 9fee2b93a8d18..06c9550577564 100644 |
6421 |
+--- a/lib/test_firmware.c |
6422 |
++++ b/lib/test_firmware.c |
6423 |
+@@ -26,6 +26,8 @@ |
6424 |
+ #include <linux/vmalloc.h> |
6425 |
+ #include <linux/efi_embedded_fw.h> |
6426 |
+ |
6427 |
++MODULE_IMPORT_NS(TEST_FIRMWARE); |
6428 |
++ |
6429 |
+ #define TEST_FIRMWARE_NAME "test-firmware.bin" |
6430 |
+ #define TEST_FIRMWARE_NUM_REQS 4 |
6431 |
+ #define TEST_FIRMWARE_BUF_SIZE SZ_1K |
6432 |
+@@ -489,6 +491,9 @@ out: |
6433 |
+ static DEVICE_ATTR_WO(trigger_request); |
6434 |
+ |
6435 |
+ #ifdef CONFIG_EFI_EMBEDDED_FIRMWARE |
6436 |
++extern struct list_head efi_embedded_fw_list; |
6437 |
++extern bool efi_embedded_fw_checked; |
6438 |
++ |
6439 |
+ static ssize_t trigger_request_platform_store(struct device *dev, |
6440 |
+ struct device_attribute *attr, |
6441 |
+ const char *buf, size_t count) |
6442 |
+@@ -501,6 +506,7 @@ static ssize_t trigger_request_platform_store(struct device *dev, |
6443 |
+ }; |
6444 |
+ struct efi_embedded_fw efi_embedded_fw; |
6445 |
+ const struct firmware *firmware = NULL; |
6446 |
++ bool saved_efi_embedded_fw_checked; |
6447 |
+ char *name; |
6448 |
+ int rc; |
6449 |
+ |
6450 |
+@@ -513,6 +519,8 @@ static ssize_t trigger_request_platform_store(struct device *dev, |
6451 |
+ efi_embedded_fw.data = (void *)test_data; |
6452 |
+ efi_embedded_fw.length = sizeof(test_data); |
6453 |
+ list_add(&efi_embedded_fw.list, &efi_embedded_fw_list); |
6454 |
++ saved_efi_embedded_fw_checked = efi_embedded_fw_checked; |
6455 |
++ efi_embedded_fw_checked = true; |
6456 |
+ |
6457 |
+ pr_info("loading '%s'\n", name); |
6458 |
+ rc = firmware_request_platform(&firmware, name, dev); |
6459 |
+@@ -530,6 +538,7 @@ static ssize_t trigger_request_platform_store(struct device *dev, |
6460 |
+ rc = count; |
6461 |
+ |
6462 |
+ out: |
6463 |
++ efi_embedded_fw_checked = saved_efi_embedded_fw_checked; |
6464 |
+ release_firmware(firmware); |
6465 |
+ list_del(&efi_embedded_fw.list); |
6466 |
+ kfree(name); |
6467 |
+diff --git a/net/mac80211/sta_info.h b/net/mac80211/sta_info.h |
6468 |
+index 49728047dfad6..f66fcce8e6a45 100644 |
6469 |
+--- a/net/mac80211/sta_info.h |
6470 |
++++ b/net/mac80211/sta_info.h |
6471 |
+@@ -522,7 +522,7 @@ struct ieee80211_sta_rx_stats { |
6472 |
+ * @status_stats.retry_failed: # of frames that failed after retry |
6473 |
+ * @status_stats.retry_count: # of retries attempted |
6474 |
+ * @status_stats.lost_packets: # of lost packets |
6475 |
+- * @status_stats.last_tdls_pkt_time: timestamp of last TDLS packet |
6476 |
++ * @status_stats.last_pkt_time: timestamp of last ACKed packet |
6477 |
+ * @status_stats.msdu_retries: # of MSDU retries |
6478 |
+ * @status_stats.msdu_failed: # of failed MSDUs |
6479 |
+ * @status_stats.last_ack: last ack timestamp (jiffies) |
6480 |
+@@ -595,7 +595,7 @@ struct sta_info { |
6481 |
+ unsigned long filtered; |
6482 |
+ unsigned long retry_failed, retry_count; |
6483 |
+ unsigned int lost_packets; |
6484 |
+- unsigned long last_tdls_pkt_time; |
6485 |
++ unsigned long last_pkt_time; |
6486 |
+ u64 msdu_retries[IEEE80211_NUM_TIDS + 1]; |
6487 |
+ u64 msdu_failed[IEEE80211_NUM_TIDS + 1]; |
6488 |
+ unsigned long last_ack; |
6489 |
+diff --git a/net/mac80211/status.c b/net/mac80211/status.c |
6490 |
+index cbc40b358ba26..819c4221c284e 100644 |
6491 |
+--- a/net/mac80211/status.c |
6492 |
++++ b/net/mac80211/status.c |
6493 |
+@@ -755,12 +755,16 @@ static void ieee80211_report_used_skb(struct ieee80211_local *local, |
6494 |
+ * - current throughput (higher value for higher tpt)? |
6495 |
+ */ |
6496 |
+ #define STA_LOST_PKT_THRESHOLD 50 |
6497 |
++#define STA_LOST_PKT_TIME HZ /* 1 sec since last ACK */ |
6498 |
+ #define STA_LOST_TDLS_PKT_THRESHOLD 10 |
6499 |
+ #define STA_LOST_TDLS_PKT_TIME (10*HZ) /* 10secs since last ACK */ |
6500 |
+ |
6501 |
+ static void ieee80211_lost_packet(struct sta_info *sta, |
6502 |
+ struct ieee80211_tx_info *info) |
6503 |
+ { |
6504 |
++ unsigned long pkt_time = STA_LOST_PKT_TIME; |
6505 |
++ unsigned int pkt_thr = STA_LOST_PKT_THRESHOLD; |
6506 |
++ |
6507 |
+ /* If driver relies on its own algorithm for station kickout, skip |
6508 |
+ * mac80211 packet loss mechanism. |
6509 |
+ */ |
6510 |
+@@ -773,21 +777,20 @@ static void ieee80211_lost_packet(struct sta_info *sta, |
6511 |
+ return; |
6512 |
+ |
6513 |
+ sta->status_stats.lost_packets++; |
6514 |
+- if (!sta->sta.tdls && |
6515 |
+- sta->status_stats.lost_packets < STA_LOST_PKT_THRESHOLD) |
6516 |
+- return; |
6517 |
++ if (sta->sta.tdls) { |
6518 |
++ pkt_time = STA_LOST_TDLS_PKT_TIME; |
6519 |
++ pkt_thr = STA_LOST_PKT_THRESHOLD; |
6520 |
++ } |
6521 |
+ |
6522 |
+ /* |
6523 |
+ * If we're in TDLS mode, make sure that all STA_LOST_TDLS_PKT_THRESHOLD |
6524 |
+ * of the last packets were lost, and that no ACK was received in the |
6525 |
+ * last STA_LOST_TDLS_PKT_TIME ms, before triggering the CQM packet-loss |
6526 |
+ * mechanism. |
6527 |
++ * For non-TDLS, use STA_LOST_PKT_THRESHOLD and STA_LOST_PKT_TIME |
6528 |
+ */ |
6529 |
+- if (sta->sta.tdls && |
6530 |
+- (sta->status_stats.lost_packets < STA_LOST_TDLS_PKT_THRESHOLD || |
6531 |
+- time_before(jiffies, |
6532 |
+- sta->status_stats.last_tdls_pkt_time + |
6533 |
+- STA_LOST_TDLS_PKT_TIME))) |
6534 |
++ if (sta->status_stats.lost_packets < pkt_thr || |
6535 |
++ !time_after(jiffies, sta->status_stats.last_pkt_time + pkt_time)) |
6536 |
+ return; |
6537 |
+ |
6538 |
+ cfg80211_cqm_pktloss_notify(sta->sdata->dev, sta->sta.addr, |
6539 |
+@@ -1035,9 +1038,7 @@ static void __ieee80211_tx_status(struct ieee80211_hw *hw, |
6540 |
+ sta->status_stats.lost_packets = 0; |
6541 |
+ |
6542 |
+ /* Track when last TDLS packet was ACKed */ |
6543 |
+- if (test_sta_flag(sta, WLAN_STA_TDLS_PEER_AUTH)) |
6544 |
+- sta->status_stats.last_tdls_pkt_time = |
6545 |
+- jiffies; |
6546 |
++ sta->status_stats.last_pkt_time = jiffies; |
6547 |
+ } else if (noack_success) { |
6548 |
+ /* nothing to do here, do not account as lost */ |
6549 |
+ } else { |
6550 |
+@@ -1170,9 +1171,8 @@ void ieee80211_tx_status_ext(struct ieee80211_hw *hw, |
6551 |
+ if (sta->status_stats.lost_packets) |
6552 |
+ sta->status_stats.lost_packets = 0; |
6553 |
+ |
6554 |
+- /* Track when last TDLS packet was ACKed */ |
6555 |
+- if (test_sta_flag(sta, WLAN_STA_TDLS_PEER_AUTH)) |
6556 |
+- sta->status_stats.last_tdls_pkt_time = jiffies; |
6557 |
++ /* Track when last packet was ACKed */ |
6558 |
++ sta->status_stats.last_pkt_time = jiffies; |
6559 |
+ } else if (test_sta_flag(sta, WLAN_STA_PS_STA)) { |
6560 |
+ return; |
6561 |
+ } else if (noack_success) { |
6562 |
+@@ -1261,8 +1261,7 @@ void ieee80211_tx_status_8023(struct ieee80211_hw *hw, |
6563 |
+ if (sta->status_stats.lost_packets) |
6564 |
+ sta->status_stats.lost_packets = 0; |
6565 |
+ |
6566 |
+- if (test_sta_flag(sta, WLAN_STA_TDLS_PEER_AUTH)) |
6567 |
+- sta->status_stats.last_tdls_pkt_time = jiffies; |
6568 |
++ sta->status_stats.last_pkt_time = jiffies; |
6569 |
+ } else { |
6570 |
+ ieee80211_lost_packet(sta, info); |
6571 |
+ } |
6572 |
+diff --git a/net/netfilter/nf_conntrack_proto_sctp.c b/net/netfilter/nf_conntrack_proto_sctp.c |
6573 |
+index 4f897b14b6069..810cca24b3990 100644 |
6574 |
+--- a/net/netfilter/nf_conntrack_proto_sctp.c |
6575 |
++++ b/net/netfilter/nf_conntrack_proto_sctp.c |
6576 |
+@@ -62,6 +62,8 @@ static const unsigned int sctp_timeouts[SCTP_CONNTRACK_MAX] = { |
6577 |
+ [SCTP_CONNTRACK_HEARTBEAT_ACKED] = 210 SECS, |
6578 |
+ }; |
6579 |
+ |
6580 |
++#define SCTP_FLAG_HEARTBEAT_VTAG_FAILED 1 |
6581 |
++ |
6582 |
+ #define sNO SCTP_CONNTRACK_NONE |
6583 |
+ #define sCL SCTP_CONNTRACK_CLOSED |
6584 |
+ #define sCW SCTP_CONNTRACK_COOKIE_WAIT |
6585 |
+@@ -369,6 +371,7 @@ int nf_conntrack_sctp_packet(struct nf_conn *ct, |
6586 |
+ u_int32_t offset, count; |
6587 |
+ unsigned int *timeouts; |
6588 |
+ unsigned long map[256 / sizeof(unsigned long)] = { 0 }; |
6589 |
++ bool ignore = false; |
6590 |
+ |
6591 |
+ if (sctp_error(skb, dataoff, state)) |
6592 |
+ return -NF_ACCEPT; |
6593 |
+@@ -427,15 +430,39 @@ int nf_conntrack_sctp_packet(struct nf_conn *ct, |
6594 |
+ /* Sec 8.5.1 (D) */ |
6595 |
+ if (sh->vtag != ct->proto.sctp.vtag[dir]) |
6596 |
+ goto out_unlock; |
6597 |
+- } else if (sch->type == SCTP_CID_HEARTBEAT || |
6598 |
+- sch->type == SCTP_CID_HEARTBEAT_ACK) { |
6599 |
++ } else if (sch->type == SCTP_CID_HEARTBEAT) { |
6600 |
++ if (ct->proto.sctp.vtag[dir] == 0) { |
6601 |
++ pr_debug("Setting %d vtag %x for dir %d\n", sch->type, sh->vtag, dir); |
6602 |
++ ct->proto.sctp.vtag[dir] = sh->vtag; |
6603 |
++ } else if (sh->vtag != ct->proto.sctp.vtag[dir]) { |
6604 |
++ if (test_bit(SCTP_CID_DATA, map) || ignore) |
6605 |
++ goto out_unlock; |
6606 |
++ |
6607 |
++ ct->proto.sctp.flags |= SCTP_FLAG_HEARTBEAT_VTAG_FAILED; |
6608 |
++ ct->proto.sctp.last_dir = dir; |
6609 |
++ ignore = true; |
6610 |
++ continue; |
6611 |
++ } else if (ct->proto.sctp.flags & SCTP_FLAG_HEARTBEAT_VTAG_FAILED) { |
6612 |
++ ct->proto.sctp.flags &= ~SCTP_FLAG_HEARTBEAT_VTAG_FAILED; |
6613 |
++ } |
6614 |
++ } else if (sch->type == SCTP_CID_HEARTBEAT_ACK) { |
6615 |
+ if (ct->proto.sctp.vtag[dir] == 0) { |
6616 |
+ pr_debug("Setting vtag %x for dir %d\n", |
6617 |
+ sh->vtag, dir); |
6618 |
+ ct->proto.sctp.vtag[dir] = sh->vtag; |
6619 |
+ } else if (sh->vtag != ct->proto.sctp.vtag[dir]) { |
6620 |
+- pr_debug("Verification tag check failed\n"); |
6621 |
+- goto out_unlock; |
6622 |
++ if (test_bit(SCTP_CID_DATA, map) || ignore) |
6623 |
++ goto out_unlock; |
6624 |
++ |
6625 |
++ if ((ct->proto.sctp.flags & SCTP_FLAG_HEARTBEAT_VTAG_FAILED) == 0 || |
6626 |
++ ct->proto.sctp.last_dir == dir) |
6627 |
++ goto out_unlock; |
6628 |
++ |
6629 |
++ ct->proto.sctp.flags &= ~SCTP_FLAG_HEARTBEAT_VTAG_FAILED; |
6630 |
++ ct->proto.sctp.vtag[dir] = sh->vtag; |
6631 |
++ ct->proto.sctp.vtag[!dir] = 0; |
6632 |
++ } else if (ct->proto.sctp.flags & SCTP_FLAG_HEARTBEAT_VTAG_FAILED) { |
6633 |
++ ct->proto.sctp.flags &= ~SCTP_FLAG_HEARTBEAT_VTAG_FAILED; |
6634 |
+ } |
6635 |
+ } |
6636 |
+ |
6637 |
+@@ -470,6 +497,10 @@ int nf_conntrack_sctp_packet(struct nf_conn *ct, |
6638 |
+ } |
6639 |
+ spin_unlock_bh(&ct->lock); |
6640 |
+ |
6641 |
++ /* allow but do not refresh timeout */ |
6642 |
++ if (ignore) |
6643 |
++ return NF_ACCEPT; |
6644 |
++ |
6645 |
+ timeouts = nf_ct_timeout_lookup(ct); |
6646 |
+ if (!timeouts) |
6647 |
+ timeouts = nf_sctp_pernet(nf_ct_net(ct))->timeouts; |
6648 |
+diff --git a/net/netfilter/nft_set_rbtree.c b/net/netfilter/nft_set_rbtree.c |
6649 |
+index b85ce6f0c0a6f..f317ad80cd6bc 100644 |
6650 |
+--- a/net/netfilter/nft_set_rbtree.c |
6651 |
++++ b/net/netfilter/nft_set_rbtree.c |
6652 |
+@@ -218,11 +218,11 @@ static int __nft_rbtree_insert(const struct net *net, const struct nft_set *set, |
6653 |
+ struct nft_rbtree_elem *new, |
6654 |
+ struct nft_set_ext **ext) |
6655 |
+ { |
6656 |
++ bool overlap = false, dup_end_left = false, dup_end_right = false; |
6657 |
+ struct nft_rbtree *priv = nft_set_priv(set); |
6658 |
+ u8 genmask = nft_genmask_next(net); |
6659 |
+ struct nft_rbtree_elem *rbe; |
6660 |
+ struct rb_node *parent, **p; |
6661 |
+- bool overlap = false; |
6662 |
+ int d; |
6663 |
+ |
6664 |
+ /* Detect overlaps as we descend the tree. Set the flag in these cases: |
6665 |
+@@ -262,6 +262,20 @@ static int __nft_rbtree_insert(const struct net *net, const struct nft_set *set, |
6666 |
+ * |
6667 |
+ * which always happen as last step and imply that no further |
6668 |
+ * overlapping is possible. |
6669 |
++ * |
6670 |
++ * Another special case comes from the fact that start elements matching |
6671 |
++ * an already existing start element are allowed: insertion is not |
6672 |
++ * performed but we return -EEXIST in that case, and the error will be |
6673 |
++ * cleared by the caller if NLM_F_EXCL is not present in the request. |
6674 |
++ * This way, request for insertion of an exact overlap isn't reported as |
6675 |
++ * error to userspace if not desired. |
6676 |
++ * |
6677 |
++ * However, if the existing start matches a pre-existing start, but the |
6678 |
++ * end element doesn't match the corresponding pre-existing end element, |
6679 |
++ * we need to report a partial overlap. This is a local condition that |
6680 |
++ * can be noticed without need for a tracking flag, by checking for a |
6681 |
++ * local duplicated end for a corresponding start, from left and right, |
6682 |
++ * separately. |
6683 |
+ */ |
6684 |
+ |
6685 |
+ parent = NULL; |
6686 |
+@@ -281,19 +295,35 @@ static int __nft_rbtree_insert(const struct net *net, const struct nft_set *set, |
6687 |
+ !nft_set_elem_expired(&rbe->ext) && !*p) |
6688 |
+ overlap = false; |
6689 |
+ } else { |
6690 |
++ if (dup_end_left && !*p) |
6691 |
++ return -ENOTEMPTY; |
6692 |
++ |
6693 |
+ overlap = nft_rbtree_interval_end(rbe) && |
6694 |
+ nft_set_elem_active(&rbe->ext, |
6695 |
+ genmask) && |
6696 |
+ !nft_set_elem_expired(&rbe->ext); |
6697 |
++ |
6698 |
++ if (overlap) { |
6699 |
++ dup_end_right = true; |
6700 |
++ continue; |
6701 |
++ } |
6702 |
+ } |
6703 |
+ } else if (d > 0) { |
6704 |
+ p = &parent->rb_right; |
6705 |
+ |
6706 |
+ if (nft_rbtree_interval_end(new)) { |
6707 |
++ if (dup_end_right && !*p) |
6708 |
++ return -ENOTEMPTY; |
6709 |
++ |
6710 |
+ overlap = nft_rbtree_interval_end(rbe) && |
6711 |
+ nft_set_elem_active(&rbe->ext, |
6712 |
+ genmask) && |
6713 |
+ !nft_set_elem_expired(&rbe->ext); |
6714 |
++ |
6715 |
++ if (overlap) { |
6716 |
++ dup_end_left = true; |
6717 |
++ continue; |
6718 |
++ } |
6719 |
+ } else if (nft_set_elem_active(&rbe->ext, genmask) && |
6720 |
+ !nft_set_elem_expired(&rbe->ext)) { |
6721 |
+ overlap = nft_rbtree_interval_end(rbe); |
6722 |
+@@ -321,6 +351,8 @@ static int __nft_rbtree_insert(const struct net *net, const struct nft_set *set, |
6723 |
+ p = &parent->rb_left; |
6724 |
+ } |
6725 |
+ } |
6726 |
++ |
6727 |
++ dup_end_left = dup_end_right = false; |
6728 |
+ } |
6729 |
+ |
6730 |
+ if (overlap) |
6731 |
+diff --git a/net/wireless/chan.c b/net/wireless/chan.c |
6732 |
+index cddf92c5d09ef..7a7cc4ade2b36 100644 |
6733 |
+--- a/net/wireless/chan.c |
6734 |
++++ b/net/wireless/chan.c |
6735 |
+@@ -10,6 +10,7 @@ |
6736 |
+ */ |
6737 |
+ |
6738 |
+ #include <linux/export.h> |
6739 |
++#include <linux/bitfield.h> |
6740 |
+ #include <net/cfg80211.h> |
6741 |
+ #include "core.h" |
6742 |
+ #include "rdev-ops.h" |
6743 |
+@@ -892,6 +893,7 @@ bool cfg80211_chandef_usable(struct wiphy *wiphy, |
6744 |
+ struct ieee80211_sta_vht_cap *vht_cap; |
6745 |
+ struct ieee80211_edmg *edmg_cap; |
6746 |
+ u32 width, control_freq, cap; |
6747 |
++ bool support_80_80 = false; |
6748 |
+ |
6749 |
+ if (WARN_ON(!cfg80211_chandef_valid(chandef))) |
6750 |
+ return false; |
6751 |
+@@ -944,9 +946,13 @@ bool cfg80211_chandef_usable(struct wiphy *wiphy, |
6752 |
+ return false; |
6753 |
+ break; |
6754 |
+ case NL80211_CHAN_WIDTH_80P80: |
6755 |
+- cap = vht_cap->cap & IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK; |
6756 |
+- if (chandef->chan->band != NL80211_BAND_6GHZ && |
6757 |
+- cap != IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ) |
6758 |
++ cap = vht_cap->cap; |
6759 |
++ support_80_80 = |
6760 |
++ (cap & IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ) || |
6761 |
++ (cap & IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ && |
6762 |
++ cap & IEEE80211_VHT_CAP_EXT_NSS_BW_MASK) || |
6763 |
++ u32_get_bits(cap, IEEE80211_VHT_CAP_EXT_NSS_BW_MASK) > 1; |
6764 |
++ if (chandef->chan->band != NL80211_BAND_6GHZ && !support_80_80) |
6765 |
+ return false; |
6766 |
+ /* fall through */ |
6767 |
+ case NL80211_CHAN_WIDTH_80: |
6768 |
+@@ -966,7 +972,8 @@ bool cfg80211_chandef_usable(struct wiphy *wiphy, |
6769 |
+ return false; |
6770 |
+ cap = vht_cap->cap & IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK; |
6771 |
+ if (cap != IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ && |
6772 |
+- cap != IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ) |
6773 |
++ cap != IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ && |
6774 |
++ !(vht_cap->cap & IEEE80211_VHT_CAP_EXT_NSS_BW_MASK)) |
6775 |
+ return false; |
6776 |
+ break; |
6777 |
+ default: |
6778 |
+diff --git a/net/wireless/util.c b/net/wireless/util.c |
6779 |
+index 4d3b76f94f55e..a72d2ad6ade8b 100644 |
6780 |
+--- a/net/wireless/util.c |
6781 |
++++ b/net/wireless/util.c |
6782 |
+@@ -121,11 +121,13 @@ int ieee80211_freq_khz_to_channel(u32 freq) |
6783 |
+ return (freq - 2407) / 5; |
6784 |
+ else if (freq >= 4910 && freq <= 4980) |
6785 |
+ return (freq - 4000) / 5; |
6786 |
+- else if (freq < 5945) |
6787 |
++ else if (freq < 5925) |
6788 |
+ return (freq - 5000) / 5; |
6789 |
++ else if (freq == 5935) |
6790 |
++ return 2; |
6791 |
+ else if (freq <= 45000) /* DMG band lower limit */ |
6792 |
+- /* see 802.11ax D4.1 27.3.22.2 */ |
6793 |
+- return (freq - 5940) / 5; |
6794 |
++ /* see 802.11ax D6.1 27.3.22.2 */ |
6795 |
++ return (freq - 5950) / 5; |
6796 |
+ else if (freq >= 58320 && freq <= 70200) |
6797 |
+ return (freq - 56160) / 2160; |
6798 |
+ else |
6799 |
+diff --git a/sound/hda/hdac_device.c b/sound/hda/hdac_device.c |
6800 |
+index 333220f0f8afc..3e9e9ac804f62 100644 |
6801 |
+--- a/sound/hda/hdac_device.c |
6802 |
++++ b/sound/hda/hdac_device.c |
6803 |
+@@ -127,6 +127,8 @@ EXPORT_SYMBOL_GPL(snd_hdac_device_init); |
6804 |
+ void snd_hdac_device_exit(struct hdac_device *codec) |
6805 |
+ { |
6806 |
+ pm_runtime_put_noidle(&codec->dev); |
6807 |
++ /* keep balance of runtime PM child_count in parent device */ |
6808 |
++ pm_runtime_set_suspended(&codec->dev); |
6809 |
+ snd_hdac_bus_remove_device(codec->bus, codec); |
6810 |
+ kfree(codec->vendor_name); |
6811 |
+ kfree(codec->chip_name); |
6812 |
+diff --git a/sound/hda/intel-dsp-config.c b/sound/hda/intel-dsp-config.c |
6813 |
+index 99aec73491676..1c5114dedda92 100644 |
6814 |
+--- a/sound/hda/intel-dsp-config.c |
6815 |
++++ b/sound/hda/intel-dsp-config.c |
6816 |
+@@ -54,7 +54,7 @@ static const struct config_entry config_table[] = { |
6817 |
+ #endif |
6818 |
+ /* |
6819 |
+ * Apollolake (Broxton-P) |
6820 |
+- * the legacy HDaudio driver is used except on Up Squared (SOF) and |
6821 |
++ * the legacy HDAudio driver is used except on Up Squared (SOF) and |
6822 |
+ * Chromebooks (SST) |
6823 |
+ */ |
6824 |
+ #if IS_ENABLED(CONFIG_SND_SOC_SOF_APOLLOLAKE) |
6825 |
+@@ -89,7 +89,7 @@ static const struct config_entry config_table[] = { |
6826 |
+ }, |
6827 |
+ #endif |
6828 |
+ /* |
6829 |
+- * Skylake and Kabylake use legacy HDaudio driver except for Google |
6830 |
++ * Skylake and Kabylake use legacy HDAudio driver except for Google |
6831 |
+ * Chromebooks (SST) |
6832 |
+ */ |
6833 |
+ |
6834 |
+@@ -135,7 +135,7 @@ static const struct config_entry config_table[] = { |
6835 |
+ #endif |
6836 |
+ |
6837 |
+ /* |
6838 |
+- * Geminilake uses legacy HDaudio driver except for Google |
6839 |
++ * Geminilake uses legacy HDAudio driver except for Google |
6840 |
+ * Chromebooks |
6841 |
+ */ |
6842 |
+ /* Geminilake */ |
6843 |
+@@ -157,7 +157,7 @@ static const struct config_entry config_table[] = { |
6844 |
+ |
6845 |
+ /* |
6846 |
+ * CoffeeLake, CannonLake, CometLake, IceLake, TigerLake use legacy |
6847 |
+- * HDaudio driver except for Google Chromebooks and when DMICs are |
6848 |
++ * HDAudio driver except for Google Chromebooks and when DMICs are |
6849 |
+ * present. Two cases are required since Coreboot does not expose NHLT |
6850 |
+ * tables. |
6851 |
+ * |
6852 |
+@@ -391,7 +391,7 @@ int snd_intel_dsp_driver_probe(struct pci_dev *pci) |
6853 |
+ if (pci->class == 0x040300) |
6854 |
+ return SND_INTEL_DSP_DRIVER_LEGACY; |
6855 |
+ if (pci->class != 0x040100 && pci->class != 0x040380) { |
6856 |
+- dev_err(&pci->dev, "Unknown PCI class/subclass/prog-if information (0x%06x) found, selecting HDA legacy driver\n", pci->class); |
6857 |
++ dev_err(&pci->dev, "Unknown PCI class/subclass/prog-if information (0x%06x) found, selecting HDAudio legacy driver\n", pci->class); |
6858 |
+ return SND_INTEL_DSP_DRIVER_LEGACY; |
6859 |
+ } |
6860 |
+ |
6861 |
+diff --git a/sound/pci/hda/hda_tegra.c b/sound/pci/hda/hda_tegra.c |
6862 |
+index 0cc5fad1af8a9..ae40ca3f29837 100644 |
6863 |
+--- a/sound/pci/hda/hda_tegra.c |
6864 |
++++ b/sound/pci/hda/hda_tegra.c |
6865 |
+@@ -179,6 +179,10 @@ static int __maybe_unused hda_tegra_runtime_suspend(struct device *dev) |
6866 |
+ struct hda_tegra *hda = container_of(chip, struct hda_tegra, chip); |
6867 |
+ |
6868 |
+ if (chip && chip->running) { |
6869 |
++ /* enable controller wake up event */ |
6870 |
++ azx_writew(chip, WAKEEN, azx_readw(chip, WAKEEN) | |
6871 |
++ STATESTS_INT_MASK); |
6872 |
++ |
6873 |
+ azx_stop_chip(chip); |
6874 |
+ azx_enter_link_reset(chip); |
6875 |
+ } |
6876 |
+@@ -200,6 +204,9 @@ static int __maybe_unused hda_tegra_runtime_resume(struct device *dev) |
6877 |
+ if (chip && chip->running) { |
6878 |
+ hda_tegra_init(hda); |
6879 |
+ azx_init_chip(chip, 1); |
6880 |
++ /* disable controller wake up event*/ |
6881 |
++ azx_writew(chip, WAKEEN, azx_readw(chip, WAKEEN) & |
6882 |
++ ~STATESTS_INT_MASK); |
6883 |
+ } |
6884 |
+ |
6885 |
+ return 0; |
6886 |
+diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c |
6887 |
+index fc22bdc30da3e..419f012b9853c 100644 |
6888 |
+--- a/sound/pci/hda/patch_hdmi.c |
6889 |
++++ b/sound/pci/hda/patch_hdmi.c |
6890 |
+@@ -3671,6 +3671,7 @@ static int tegra_hdmi_build_pcms(struct hda_codec *codec) |
6891 |
+ |
6892 |
+ static int patch_tegra_hdmi(struct hda_codec *codec) |
6893 |
+ { |
6894 |
++ struct hdmi_spec *spec; |
6895 |
+ int err; |
6896 |
+ |
6897 |
+ err = patch_generic_hdmi(codec); |
6898 |
+@@ -3678,6 +3679,10 @@ static int patch_tegra_hdmi(struct hda_codec *codec) |
6899 |
+ return err; |
6900 |
+ |
6901 |
+ codec->patch_ops.build_pcms = tegra_hdmi_build_pcms; |
6902 |
++ spec = codec->spec; |
6903 |
++ spec->chmap.ops.chmap_cea_alloc_validate_get_type = |
6904 |
++ nvhdmi_chmap_cea_alloc_validate_get_type; |
6905 |
++ spec->chmap.ops.chmap_validate = nvhdmi_chmap_validate; |
6906 |
+ |
6907 |
+ return 0; |
6908 |
+ } |
6909 |
+@@ -4200,6 +4205,7 @@ HDA_CODEC_ENTRY(0x8086280c, "Cannonlake HDMI", patch_i915_glk_hdmi), |
6910 |
+ HDA_CODEC_ENTRY(0x8086280d, "Geminilake HDMI", patch_i915_glk_hdmi), |
6911 |
+ HDA_CODEC_ENTRY(0x8086280f, "Icelake HDMI", patch_i915_icl_hdmi), |
6912 |
+ HDA_CODEC_ENTRY(0x80862812, "Tigerlake HDMI", patch_i915_tgl_hdmi), |
6913 |
++HDA_CODEC_ENTRY(0x80862816, "Rocketlake HDMI", patch_i915_tgl_hdmi), |
6914 |
+ HDA_CODEC_ENTRY(0x8086281a, "Jasperlake HDMI", patch_i915_icl_hdmi), |
6915 |
+ HDA_CODEC_ENTRY(0x8086281b, "Elkhartlake HDMI", patch_i915_icl_hdmi), |
6916 |
+ HDA_CODEC_ENTRY(0x80862880, "CedarTrail HDMI", patch_generic_hdmi), |
6917 |
+diff --git a/sound/x86/Kconfig b/sound/x86/Kconfig |
6918 |
+index 77777192f6508..4ffcc5e623c22 100644 |
6919 |
+--- a/sound/x86/Kconfig |
6920 |
++++ b/sound/x86/Kconfig |
6921 |
+@@ -9,7 +9,7 @@ menuconfig SND_X86 |
6922 |
+ if SND_X86 |
6923 |
+ |
6924 |
+ config HDMI_LPE_AUDIO |
6925 |
+- tristate "HDMI audio without HDaudio on Intel Atom platforms" |
6926 |
++ tristate "HDMI audio without HDAudio on Intel Atom platforms" |
6927 |
+ depends on DRM_I915 |
6928 |
+ select SND_PCM |
6929 |
+ help |
6930 |
+diff --git a/tools/testing/selftests/timers/Makefile b/tools/testing/selftests/timers/Makefile |
6931 |
+index 7656c7ce79d90..0e73a16874c4c 100644 |
6932 |
+--- a/tools/testing/selftests/timers/Makefile |
6933 |
++++ b/tools/testing/selftests/timers/Makefile |
6934 |
+@@ -13,6 +13,7 @@ DESTRUCTIVE_TESTS = alarmtimer-suspend valid-adjtimex adjtick change_skew \ |
6935 |
+ |
6936 |
+ TEST_GEN_PROGS_EXTENDED = $(DESTRUCTIVE_TESTS) |
6937 |
+ |
6938 |
++TEST_FILES := settings |
6939 |
+ |
6940 |
+ include ../lib.mk |
6941 |
+ |
6942 |
+diff --git a/tools/testing/selftests/timers/settings b/tools/testing/selftests/timers/settings |
6943 |
+new file mode 100644 |
6944 |
+index 0000000000000..e7b9417537fbc |
6945 |
+--- /dev/null |
6946 |
++++ b/tools/testing/selftests/timers/settings |
6947 |
+@@ -0,0 +1 @@ |
6948 |
++timeout=0 |
6949 |
+diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c |
6950 |
+index 9e925675a8868..49a877918e2f1 100644 |
6951 |
+--- a/virt/kvm/kvm_main.c |
6952 |
++++ b/virt/kvm/kvm_main.c |
6953 |
+@@ -4269,7 +4269,7 @@ int kvm_io_bus_register_dev(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr, |
6954 |
+ void kvm_io_bus_unregister_dev(struct kvm *kvm, enum kvm_bus bus_idx, |
6955 |
+ struct kvm_io_device *dev) |
6956 |
+ { |
6957 |
+- int i; |
6958 |
++ int i, j; |
6959 |
+ struct kvm_io_bus *new_bus, *bus; |
6960 |
+ |
6961 |
+ bus = kvm_get_bus(kvm, bus_idx); |
6962 |
+@@ -4286,17 +4286,20 @@ void kvm_io_bus_unregister_dev(struct kvm *kvm, enum kvm_bus bus_idx, |
6963 |
+ |
6964 |
+ new_bus = kmalloc(struct_size(bus, range, bus->dev_count - 1), |
6965 |
+ GFP_KERNEL_ACCOUNT); |
6966 |
+- if (!new_bus) { |
6967 |
++ if (new_bus) { |
6968 |
++ memcpy(new_bus, bus, sizeof(*bus) + i * sizeof(struct kvm_io_range)); |
6969 |
++ new_bus->dev_count--; |
6970 |
++ memcpy(new_bus->range + i, bus->range + i + 1, |
6971 |
++ (new_bus->dev_count - i) * sizeof(struct kvm_io_range)); |
6972 |
++ } else { |
6973 |
+ pr_err("kvm: failed to shrink bus, removing it completely\n"); |
6974 |
+- goto broken; |
6975 |
++ for (j = 0; j < bus->dev_count; j++) { |
6976 |
++ if (j == i) |
6977 |
++ continue; |
6978 |
++ kvm_iodevice_destructor(bus->range[j].dev); |
6979 |
++ } |
6980 |
+ } |
6981 |
+ |
6982 |
+- memcpy(new_bus, bus, sizeof(*bus) + i * sizeof(struct kvm_io_range)); |
6983 |
+- new_bus->dev_count--; |
6984 |
+- memcpy(new_bus->range + i, bus->range + i + 1, |
6985 |
+- (new_bus->dev_count - i) * sizeof(struct kvm_io_range)); |
6986 |
+- |
6987 |
+-broken: |
6988 |
+ rcu_assign_pointer(kvm->buses[bus_idx], new_bus); |
6989 |
+ synchronize_srcu_expedited(&kvm->srcu); |
6990 |
+ kfree(bus); |