1 |
commit: a1deeea2d61ccb330a0215ea975029c792554206 |
2 |
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Dec 22 14:04:35 2021 +0000 |
4 |
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Dec 22 14:04:35 2021 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=a1deeea2 |
7 |
|
8 |
Linux patch 5.15.11 |
9 |
|
10 |
Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org> |
11 |
|
12 |
0000_README | 4 + |
13 |
1010_linux-5.15.11.patch | 5952 ++++++++++++++++++++++++++++++++++++++++++++++ |
14 |
2 files changed, 5956 insertions(+) |
15 |
|
16 |
diff --git a/0000_README b/0000_README |
17 |
index bce570a9..5388e982 100644 |
18 |
--- a/0000_README |
19 |
+++ b/0000_README |
20 |
@@ -83,6 +83,10 @@ Patch: 1009_linux-5.15.10.patch |
21 |
From: http://www.kernel.org |
22 |
Desc: Linux 5.15.10 |
23 |
|
24 |
+Patch: 1010_linux-5.15.11.patch |
25 |
+From: http://www.kernel.org |
26 |
+Desc: Linux 5.15.11 |
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/1010_linux-5.15.11.patch b/1010_linux-5.15.11.patch |
33 |
new file mode 100644 |
34 |
index 00000000..be3f22a0 |
35 |
--- /dev/null |
36 |
+++ b/1010_linux-5.15.11.patch |
37 |
@@ -0,0 +1,5952 @@ |
38 |
+diff --git a/Documentation/networking/device_drivers/ethernet/intel/ixgbe.rst b/Documentation/networking/device_drivers/ethernet/intel/ixgbe.rst |
39 |
+index f1d5233e5e510..0a233b17c664e 100644 |
40 |
+--- a/Documentation/networking/device_drivers/ethernet/intel/ixgbe.rst |
41 |
++++ b/Documentation/networking/device_drivers/ethernet/intel/ixgbe.rst |
42 |
+@@ -440,6 +440,22 @@ NOTE: For 82599-based network connections, if you are enabling jumbo frames in |
43 |
+ a virtual function (VF), jumbo frames must first be enabled in the physical |
44 |
+ function (PF). The VF MTU setting cannot be larger than the PF MTU. |
45 |
+ |
46 |
++NBASE-T Support |
47 |
++--------------- |
48 |
++The ixgbe driver supports NBASE-T on some devices. However, the advertisement |
49 |
++of NBASE-T speeds is suppressed by default, to accommodate broken network |
50 |
++switches which cannot cope with advertised NBASE-T speeds. Use the ethtool |
51 |
++command to enable advertising NBASE-T speeds on devices which support it:: |
52 |
++ |
53 |
++ ethtool -s eth? advertise 0x1800000001028 |
54 |
++ |
55 |
++On Linux systems with INTERFACES(5), this can be specified as a pre-up command |
56 |
++in /etc/network/interfaces so that the interface is always brought up with |
57 |
++NBASE-T support, e.g.:: |
58 |
++ |
59 |
++ iface eth? inet dhcp |
60 |
++ pre-up ethtool -s eth? advertise 0x1800000001028 || true |
61 |
++ |
62 |
+ Generic Receive Offload, aka GRO |
63 |
+ -------------------------------- |
64 |
+ The driver supports the in-kernel software implementation of GRO. GRO has |
65 |
+diff --git a/Makefile b/Makefile |
66 |
+index d5e266291e5db..37a1144c32df7 100644 |
67 |
+--- a/Makefile |
68 |
++++ b/Makefile |
69 |
+@@ -1,7 +1,7 @@ |
70 |
+ # SPDX-License-Identifier: GPL-2.0 |
71 |
+ VERSION = 5 |
72 |
+ PATCHLEVEL = 15 |
73 |
+-SUBLEVEL = 10 |
74 |
++SUBLEVEL = 11 |
75 |
+ EXTRAVERSION = |
76 |
+ NAME = Trick or Treat |
77 |
+ |
78 |
+diff --git a/arch/arm/boot/dts/imx6ull-pinfunc.h b/arch/arm/boot/dts/imx6ull-pinfunc.h |
79 |
+index eb025a9d47592..7328d4ef8559f 100644 |
80 |
+--- a/arch/arm/boot/dts/imx6ull-pinfunc.h |
81 |
++++ b/arch/arm/boot/dts/imx6ull-pinfunc.h |
82 |
+@@ -82,6 +82,6 @@ |
83 |
+ #define MX6ULL_PAD_CSI_DATA04__ESAI_TX_FS 0x01F4 0x0480 0x0000 0x9 0x0 |
84 |
+ #define MX6ULL_PAD_CSI_DATA05__ESAI_TX_CLK 0x01F8 0x0484 0x0000 0x9 0x0 |
85 |
+ #define MX6ULL_PAD_CSI_DATA06__ESAI_TX5_RX0 0x01FC 0x0488 0x0000 0x9 0x0 |
86 |
+-#define MX6ULL_PAD_CSI_DATA07__ESAI_T0 0x0200 0x048C 0x0000 0x9 0x0 |
87 |
++#define MX6ULL_PAD_CSI_DATA07__ESAI_TX0 0x0200 0x048C 0x0000 0x9 0x0 |
88 |
+ |
89 |
+ #endif /* __DTS_IMX6ULL_PINFUNC_H */ |
90 |
+diff --git a/arch/arm/boot/dts/socfpga_arria10_socdk_qspi.dts b/arch/arm/boot/dts/socfpga_arria10_socdk_qspi.dts |
91 |
+index 2b645642b9352..2a745522404d6 100644 |
92 |
+--- a/arch/arm/boot/dts/socfpga_arria10_socdk_qspi.dts |
93 |
++++ b/arch/arm/boot/dts/socfpga_arria10_socdk_qspi.dts |
94 |
+@@ -12,7 +12,7 @@ |
95 |
+ flash0: n25q00@0 { |
96 |
+ #address-cells = <1>; |
97 |
+ #size-cells = <1>; |
98 |
+- compatible = "n25q00aa"; |
99 |
++ compatible = "micron,mt25qu02g", "jedec,spi-nor"; |
100 |
+ reg = <0>; |
101 |
+ spi-max-frequency = <100000000>; |
102 |
+ |
103 |
+diff --git a/arch/arm/boot/dts/socfpga_arria5_socdk.dts b/arch/arm/boot/dts/socfpga_arria5_socdk.dts |
104 |
+index 90e676e7019f2..1b02d46496a85 100644 |
105 |
+--- a/arch/arm/boot/dts/socfpga_arria5_socdk.dts |
106 |
++++ b/arch/arm/boot/dts/socfpga_arria5_socdk.dts |
107 |
+@@ -119,7 +119,7 @@ |
108 |
+ flash: flash@0 { |
109 |
+ #address-cells = <1>; |
110 |
+ #size-cells = <1>; |
111 |
+- compatible = "n25q256a"; |
112 |
++ compatible = "micron,n25q256a", "jedec,spi-nor"; |
113 |
+ reg = <0>; |
114 |
+ spi-max-frequency = <100000000>; |
115 |
+ |
116 |
+diff --git a/arch/arm/boot/dts/socfpga_cyclone5_socdk.dts b/arch/arm/boot/dts/socfpga_cyclone5_socdk.dts |
117 |
+index 6f138b2b26163..51bb436784e24 100644 |
118 |
+--- a/arch/arm/boot/dts/socfpga_cyclone5_socdk.dts |
119 |
++++ b/arch/arm/boot/dts/socfpga_cyclone5_socdk.dts |
120 |
+@@ -124,7 +124,7 @@ |
121 |
+ flash0: n25q00@0 { |
122 |
+ #address-cells = <1>; |
123 |
+ #size-cells = <1>; |
124 |
+- compatible = "n25q00"; |
125 |
++ compatible = "micron,mt25qu02g", "jedec,spi-nor"; |
126 |
+ reg = <0>; /* chip select */ |
127 |
+ spi-max-frequency = <100000000>; |
128 |
+ |
129 |
+diff --git a/arch/arm/boot/dts/socfpga_cyclone5_sockit.dts b/arch/arm/boot/dts/socfpga_cyclone5_sockit.dts |
130 |
+index c155ff02eb6e0..cae9ddd5ed38b 100644 |
131 |
+--- a/arch/arm/boot/dts/socfpga_cyclone5_sockit.dts |
132 |
++++ b/arch/arm/boot/dts/socfpga_cyclone5_sockit.dts |
133 |
+@@ -169,7 +169,7 @@ |
134 |
+ flash: flash@0 { |
135 |
+ #address-cells = <1>; |
136 |
+ #size-cells = <1>; |
137 |
+- compatible = "n25q00"; |
138 |
++ compatible = "micron,mt25qu02g", "jedec,spi-nor"; |
139 |
+ reg = <0>; |
140 |
+ spi-max-frequency = <100000000>; |
141 |
+ |
142 |
+diff --git a/arch/arm/boot/dts/socfpga_cyclone5_socrates.dts b/arch/arm/boot/dts/socfpga_cyclone5_socrates.dts |
143 |
+index 8d5d3996f6f27..ca18b959e6559 100644 |
144 |
+--- a/arch/arm/boot/dts/socfpga_cyclone5_socrates.dts |
145 |
++++ b/arch/arm/boot/dts/socfpga_cyclone5_socrates.dts |
146 |
+@@ -80,7 +80,7 @@ |
147 |
+ flash: flash@0 { |
148 |
+ #address-cells = <1>; |
149 |
+ #size-cells = <1>; |
150 |
+- compatible = "n25q256a"; |
151 |
++ compatible = "micron,n25q256a", "jedec,spi-nor"; |
152 |
+ reg = <0>; |
153 |
+ spi-max-frequency = <100000000>; |
154 |
+ m25p,fast-read; |
155 |
+diff --git a/arch/arm/boot/dts/socfpga_cyclone5_sodia.dts b/arch/arm/boot/dts/socfpga_cyclone5_sodia.dts |
156 |
+index 99a71757cdf46..3f7aa7bf0863a 100644 |
157 |
+--- a/arch/arm/boot/dts/socfpga_cyclone5_sodia.dts |
158 |
++++ b/arch/arm/boot/dts/socfpga_cyclone5_sodia.dts |
159 |
+@@ -116,7 +116,7 @@ |
160 |
+ flash0: n25q512a@0 { |
161 |
+ #address-cells = <1>; |
162 |
+ #size-cells = <1>; |
163 |
+- compatible = "n25q512a"; |
164 |
++ compatible = "micron,n25q512a", "jedec,spi-nor"; |
165 |
+ reg = <0>; |
166 |
+ spi-max-frequency = <100000000>; |
167 |
+ |
168 |
+diff --git a/arch/arm/boot/dts/socfpga_cyclone5_vining_fpga.dts b/arch/arm/boot/dts/socfpga_cyclone5_vining_fpga.dts |
169 |
+index a060718758b67..25874e1b9c829 100644 |
170 |
+--- a/arch/arm/boot/dts/socfpga_cyclone5_vining_fpga.dts |
171 |
++++ b/arch/arm/boot/dts/socfpga_cyclone5_vining_fpga.dts |
172 |
+@@ -224,7 +224,7 @@ |
173 |
+ n25q128@0 { |
174 |
+ #address-cells = <1>; |
175 |
+ #size-cells = <1>; |
176 |
+- compatible = "n25q128"; |
177 |
++ compatible = "micron,n25q128", "jedec,spi-nor"; |
178 |
+ reg = <0>; /* chip select */ |
179 |
+ spi-max-frequency = <100000000>; |
180 |
+ m25p,fast-read; |
181 |
+@@ -241,7 +241,7 @@ |
182 |
+ n25q00@1 { |
183 |
+ #address-cells = <1>; |
184 |
+ #size-cells = <1>; |
185 |
+- compatible = "n25q00"; |
186 |
++ compatible = "micron,mt25qu02g", "jedec,spi-nor"; |
187 |
+ reg = <1>; /* chip select */ |
188 |
+ spi-max-frequency = <100000000>; |
189 |
+ m25p,fast-read; |
190 |
+diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1088a-ten64.dts b/arch/arm64/boot/dts/freescale/fsl-ls1088a-ten64.dts |
191 |
+index 3063851c2fb91..d3f03dcbb8c38 100644 |
192 |
+--- a/arch/arm64/boot/dts/freescale/fsl-ls1088a-ten64.dts |
193 |
++++ b/arch/arm64/boot/dts/freescale/fsl-ls1088a-ten64.dts |
194 |
+@@ -38,7 +38,6 @@ |
195 |
+ powerdn { |
196 |
+ label = "External Power Down"; |
197 |
+ gpios = <&gpio1 17 GPIO_ACTIVE_LOW>; |
198 |
+- interrupts = <&gpio1 17 IRQ_TYPE_EDGE_FALLING>; |
199 |
+ linux,code = <KEY_POWER>; |
200 |
+ }; |
201 |
+ |
202 |
+@@ -46,7 +45,6 @@ |
203 |
+ admin { |
204 |
+ label = "ADMIN button"; |
205 |
+ gpios = <&gpio3 8 GPIO_ACTIVE_HIGH>; |
206 |
+- interrupts = <&gpio3 8 IRQ_TYPE_EDGE_RISING>; |
207 |
+ linux,code = <KEY_WPS_BUTTON>; |
208 |
+ }; |
209 |
+ }; |
210 |
+diff --git a/arch/arm64/boot/dts/freescale/imx8mq.dtsi b/arch/arm64/boot/dts/freescale/imx8mq.dtsi |
211 |
+index 4066b16126552..2bc57d8f29c7f 100644 |
212 |
+--- a/arch/arm64/boot/dts/freescale/imx8mq.dtsi |
213 |
++++ b/arch/arm64/boot/dts/freescale/imx8mq.dtsi |
214 |
+@@ -524,8 +524,6 @@ |
215 |
+ <&clk IMX8MQ_VIDEO_PLL1>, |
216 |
+ <&clk IMX8MQ_VIDEO_PLL1_OUT>; |
217 |
+ assigned-clock-rates = <0>, <0>, <0>, <594000000>; |
218 |
+- interconnects = <&noc IMX8MQ_ICM_LCDIF &noc IMX8MQ_ICS_DRAM>; |
219 |
+- interconnect-names = "dram"; |
220 |
+ status = "disabled"; |
221 |
+ |
222 |
+ port@0 { |
223 |
+diff --git a/arch/arm64/boot/dts/rockchip/rk3308-roc-cc.dts b/arch/arm64/boot/dts/rockchip/rk3308-roc-cc.dts |
224 |
+index 665b2e69455dd..ea6820902ede0 100644 |
225 |
+--- a/arch/arm64/boot/dts/rockchip/rk3308-roc-cc.dts |
226 |
++++ b/arch/arm64/boot/dts/rockchip/rk3308-roc-cc.dts |
227 |
+@@ -97,7 +97,7 @@ |
228 |
+ regulator-max-microvolt = <3300000>; |
229 |
+ regulator-always-on; |
230 |
+ regulator-boot-on; |
231 |
+- vim-supply = <&vcc_io>; |
232 |
++ vin-supply = <&vcc_io>; |
233 |
+ }; |
234 |
+ |
235 |
+ vdd_core: vdd-core { |
236 |
+diff --git a/arch/arm64/boot/dts/rockchip/rk3399-khadas-edge.dtsi b/arch/arm64/boot/dts/rockchip/rk3399-khadas-edge.dtsi |
237 |
+index d5c7648c841dc..f1fcc6b5b402c 100644 |
238 |
+--- a/arch/arm64/boot/dts/rockchip/rk3399-khadas-edge.dtsi |
239 |
++++ b/arch/arm64/boot/dts/rockchip/rk3399-khadas-edge.dtsi |
240 |
+@@ -705,7 +705,6 @@ |
241 |
+ &sdhci { |
242 |
+ bus-width = <8>; |
243 |
+ mmc-hs400-1_8v; |
244 |
+- mmc-hs400-enhanced-strobe; |
245 |
+ non-removable; |
246 |
+ status = "okay"; |
247 |
+ }; |
248 |
+diff --git a/arch/arm64/boot/dts/rockchip/rk3399-kobol-helios64.dts b/arch/arm64/boot/dts/rockchip/rk3399-kobol-helios64.dts |
249 |
+index 738cfd21df3ef..354f54767bad8 100644 |
250 |
+--- a/arch/arm64/boot/dts/rockchip/rk3399-kobol-helios64.dts |
251 |
++++ b/arch/arm64/boot/dts/rockchip/rk3399-kobol-helios64.dts |
252 |
+@@ -269,6 +269,7 @@ |
253 |
+ clock-output-names = "xin32k", "rk808-clkout2"; |
254 |
+ pinctrl-names = "default"; |
255 |
+ pinctrl-0 = <&pmic_int_l>; |
256 |
++ rockchip,system-power-controller; |
257 |
+ vcc1-supply = <&vcc5v0_sys>; |
258 |
+ vcc2-supply = <&vcc5v0_sys>; |
259 |
+ vcc3-supply = <&vcc5v0_sys>; |
260 |
+diff --git a/arch/arm64/boot/dts/rockchip/rk3399-leez-p710.dts b/arch/arm64/boot/dts/rockchip/rk3399-leez-p710.dts |
261 |
+index 7c93f840bc64f..e890166e7fd43 100644 |
262 |
+--- a/arch/arm64/boot/dts/rockchip/rk3399-leez-p710.dts |
263 |
++++ b/arch/arm64/boot/dts/rockchip/rk3399-leez-p710.dts |
264 |
+@@ -55,7 +55,7 @@ |
265 |
+ regulator-boot-on; |
266 |
+ regulator-min-microvolt = <3300000>; |
267 |
+ regulator-max-microvolt = <3300000>; |
268 |
+- vim-supply = <&vcc3v3_sys>; |
269 |
++ vin-supply = <&vcc3v3_sys>; |
270 |
+ }; |
271 |
+ |
272 |
+ vcc3v3_sys: vcc3v3-sys { |
273 |
+diff --git a/arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4.dtsi b/arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4.dtsi |
274 |
+index b28888ea9262e..100a769165ef9 100644 |
275 |
+--- a/arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4.dtsi |
276 |
++++ b/arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4.dtsi |
277 |
+@@ -457,7 +457,7 @@ |
278 |
+ status = "okay"; |
279 |
+ |
280 |
+ bt656-supply = <&vcc_3v0>; |
281 |
+- audio-supply = <&vcc_3v0>; |
282 |
++ audio-supply = <&vcc1v8_codec>; |
283 |
+ sdmmc-supply = <&vcc_sdio>; |
284 |
+ gpio1830-supply = <&vcc_3v0>; |
285 |
+ }; |
286 |
+diff --git a/arch/arm64/kernel/machine_kexec_file.c b/arch/arm64/kernel/machine_kexec_file.c |
287 |
+index 63634b4d72c15..59c648d518488 100644 |
288 |
+--- a/arch/arm64/kernel/machine_kexec_file.c |
289 |
++++ b/arch/arm64/kernel/machine_kexec_file.c |
290 |
+@@ -149,6 +149,7 @@ int load_other_segments(struct kimage *image, |
291 |
+ initrd_len, cmdline, 0); |
292 |
+ if (!dtb) { |
293 |
+ pr_err("Preparing for new dtb failed\n"); |
294 |
++ ret = -EINVAL; |
295 |
+ goto out_err; |
296 |
+ } |
297 |
+ |
298 |
+diff --git a/arch/powerpc/kernel/module_64.c b/arch/powerpc/kernel/module_64.c |
299 |
+index 6baa676e7cb60..5d77d3f5fbb56 100644 |
300 |
+--- a/arch/powerpc/kernel/module_64.c |
301 |
++++ b/arch/powerpc/kernel/module_64.c |
302 |
+@@ -422,11 +422,17 @@ static inline int create_stub(const Elf64_Shdr *sechdrs, |
303 |
+ const char *name) |
304 |
+ { |
305 |
+ long reladdr; |
306 |
++ func_desc_t desc; |
307 |
++ int i; |
308 |
+ |
309 |
+ if (is_mprofile_ftrace_call(name)) |
310 |
+ return create_ftrace_stub(entry, addr, me); |
311 |
+ |
312 |
+- memcpy(entry->jump, ppc64_stub_insns, sizeof(ppc64_stub_insns)); |
313 |
++ for (i = 0; i < sizeof(ppc64_stub_insns) / sizeof(u32); i++) { |
314 |
++ if (patch_instruction(&entry->jump[i], |
315 |
++ ppc_inst(ppc64_stub_insns[i]))) |
316 |
++ return 0; |
317 |
++ } |
318 |
+ |
319 |
+ /* Stub uses address relative to r2. */ |
320 |
+ reladdr = (unsigned long)entry - my_r2(sechdrs, me); |
321 |
+@@ -437,10 +443,24 @@ static inline int create_stub(const Elf64_Shdr *sechdrs, |
322 |
+ } |
323 |
+ pr_debug("Stub %p get data from reladdr %li\n", entry, reladdr); |
324 |
+ |
325 |
+- entry->jump[0] |= PPC_HA(reladdr); |
326 |
+- entry->jump[1] |= PPC_LO(reladdr); |
327 |
+- entry->funcdata = func_desc(addr); |
328 |
+- entry->magic = STUB_MAGIC; |
329 |
++ if (patch_instruction(&entry->jump[0], |
330 |
++ ppc_inst(entry->jump[0] | PPC_HA(reladdr)))) |
331 |
++ return 0; |
332 |
++ |
333 |
++ if (patch_instruction(&entry->jump[1], |
334 |
++ ppc_inst(entry->jump[1] | PPC_LO(reladdr)))) |
335 |
++ return 0; |
336 |
++ |
337 |
++ // func_desc_t is 8 bytes if ABIv2, else 16 bytes |
338 |
++ desc = func_desc(addr); |
339 |
++ for (i = 0; i < sizeof(func_desc_t) / sizeof(u32); i++) { |
340 |
++ if (patch_instruction(((u32 *)&entry->funcdata) + i, |
341 |
++ ppc_inst(((u32 *)(&desc))[i]))) |
342 |
++ return 0; |
343 |
++ } |
344 |
++ |
345 |
++ if (patch_instruction(&entry->magic, ppc_inst(STUB_MAGIC))) |
346 |
++ return 0; |
347 |
+ |
348 |
+ return 1; |
349 |
+ } |
350 |
+@@ -495,8 +515,11 @@ static int restore_r2(const char *name, u32 *instruction, struct module *me) |
351 |
+ me->name, *instruction, instruction); |
352 |
+ return 0; |
353 |
+ } |
354 |
++ |
355 |
+ /* ld r2,R2_STACK_OFFSET(r1) */ |
356 |
+- *instruction = PPC_INST_LD_TOC; |
357 |
++ if (patch_instruction(instruction, ppc_inst(PPC_INST_LD_TOC))) |
358 |
++ return 0; |
359 |
++ |
360 |
+ return 1; |
361 |
+ } |
362 |
+ |
363 |
+@@ -636,9 +659,12 @@ int apply_relocate_add(Elf64_Shdr *sechdrs, |
364 |
+ } |
365 |
+ |
366 |
+ /* Only replace bits 2 through 26 */ |
367 |
+- *(uint32_t *)location |
368 |
+- = (*(uint32_t *)location & ~0x03fffffc) |
369 |
++ value = (*(uint32_t *)location & ~0x03fffffc) |
370 |
+ | (value & 0x03fffffc); |
371 |
++ |
372 |
++ if (patch_instruction((u32 *)location, ppc_inst(value))) |
373 |
++ return -EFAULT; |
374 |
++ |
375 |
+ break; |
376 |
+ |
377 |
+ case R_PPC64_REL64: |
378 |
+diff --git a/arch/powerpc/platforms/85xx/smp.c b/arch/powerpc/platforms/85xx/smp.c |
379 |
+index 83f4a6389a282..d7081e9af65c7 100644 |
380 |
+--- a/arch/powerpc/platforms/85xx/smp.c |
381 |
++++ b/arch/powerpc/platforms/85xx/smp.c |
382 |
+@@ -220,7 +220,7 @@ static int smp_85xx_start_cpu(int cpu) |
383 |
+ local_irq_save(flags); |
384 |
+ hard_irq_disable(); |
385 |
+ |
386 |
+- if (qoriq_pm_ops) |
387 |
++ if (qoriq_pm_ops && qoriq_pm_ops->cpu_up_prepare) |
388 |
+ qoriq_pm_ops->cpu_up_prepare(cpu); |
389 |
+ |
390 |
+ /* if cpu is not spinning, reset it */ |
391 |
+@@ -292,7 +292,7 @@ static int smp_85xx_kick_cpu(int nr) |
392 |
+ booting_thread_hwid = cpu_thread_in_core(nr); |
393 |
+ primary = cpu_first_thread_sibling(nr); |
394 |
+ |
395 |
+- if (qoriq_pm_ops) |
396 |
++ if (qoriq_pm_ops && qoriq_pm_ops->cpu_up_prepare) |
397 |
+ qoriq_pm_ops->cpu_up_prepare(nr); |
398 |
+ |
399 |
+ /* |
400 |
+diff --git a/arch/riscv/boot/dts/sifive/hifive-unleashed-a00.dts b/arch/riscv/boot/dts/sifive/hifive-unleashed-a00.dts |
401 |
+index 60846e88ae4b1..22f971e971614 100644 |
402 |
+--- a/arch/riscv/boot/dts/sifive/hifive-unleashed-a00.dts |
403 |
++++ b/arch/riscv/boot/dts/sifive/hifive-unleashed-a00.dts |
404 |
+@@ -80,6 +80,7 @@ |
405 |
+ spi-max-frequency = <20000000>; |
406 |
+ voltage-ranges = <3300 3300>; |
407 |
+ disable-wp; |
408 |
++ gpios = <&gpio 11 GPIO_ACTIVE_LOW>; |
409 |
+ }; |
410 |
+ }; |
411 |
+ |
412 |
+diff --git a/arch/riscv/boot/dts/sifive/hifive-unmatched-a00.dts b/arch/riscv/boot/dts/sifive/hifive-unmatched-a00.dts |
413 |
+index 2e4ea84f27e77..b40990210fb50 100644 |
414 |
+--- a/arch/riscv/boot/dts/sifive/hifive-unmatched-a00.dts |
415 |
++++ b/arch/riscv/boot/dts/sifive/hifive-unmatched-a00.dts |
416 |
+@@ -2,6 +2,7 @@ |
417 |
+ /* Copyright (c) 2020 SiFive, Inc */ |
418 |
+ |
419 |
+ #include "fu740-c000.dtsi" |
420 |
++#include <dt-bindings/gpio/gpio.h> |
421 |
+ #include <dt-bindings/interrupt-controller/irq.h> |
422 |
+ |
423 |
+ /* Clock frequency (in Hz) of the PCB crystal for rtcclk */ |
424 |
+@@ -228,6 +229,7 @@ |
425 |
+ spi-max-frequency = <20000000>; |
426 |
+ voltage-ranges = <3300 3300>; |
427 |
+ disable-wp; |
428 |
++ gpios = <&gpio 15 GPIO_ACTIVE_LOW>; |
429 |
+ }; |
430 |
+ }; |
431 |
+ |
432 |
+diff --git a/arch/s390/kernel/irq.c b/arch/s390/kernel/irq.c |
433 |
+index 3a3145c4a3ba4..be5d432b902e0 100644 |
434 |
+--- a/arch/s390/kernel/irq.c |
435 |
++++ b/arch/s390/kernel/irq.c |
436 |
+@@ -138,7 +138,7 @@ void noinstr do_io_irq(struct pt_regs *regs) |
437 |
+ struct pt_regs *old_regs = set_irq_regs(regs); |
438 |
+ int from_idle; |
439 |
+ |
440 |
+- irq_enter(); |
441 |
++ irq_enter_rcu(); |
442 |
+ |
443 |
+ if (user_mode(regs)) |
444 |
+ update_timer_sys(); |
445 |
+@@ -155,7 +155,8 @@ void noinstr do_io_irq(struct pt_regs *regs) |
446 |
+ do_irq_async(regs, IO_INTERRUPT); |
447 |
+ } while (MACHINE_IS_LPAR && irq_pending(regs)); |
448 |
+ |
449 |
+- irq_exit(); |
450 |
++ irq_exit_rcu(); |
451 |
++ |
452 |
+ set_irq_regs(old_regs); |
453 |
+ irqentry_exit(regs, state); |
454 |
+ |
455 |
+@@ -169,7 +170,7 @@ void noinstr do_ext_irq(struct pt_regs *regs) |
456 |
+ struct pt_regs *old_regs = set_irq_regs(regs); |
457 |
+ int from_idle; |
458 |
+ |
459 |
+- irq_enter(); |
460 |
++ irq_enter_rcu(); |
461 |
+ |
462 |
+ if (user_mode(regs)) |
463 |
+ update_timer_sys(); |
464 |
+@@ -184,7 +185,7 @@ void noinstr do_ext_irq(struct pt_regs *regs) |
465 |
+ |
466 |
+ do_irq_async(regs, EXT_INTERRUPT); |
467 |
+ |
468 |
+- irq_exit(); |
469 |
++ irq_exit_rcu(); |
470 |
+ set_irq_regs(old_regs); |
471 |
+ irqentry_exit(regs, state); |
472 |
+ |
473 |
+diff --git a/arch/s390/kernel/machine_kexec_file.c b/arch/s390/kernel/machine_kexec_file.c |
474 |
+index e7435f3a3d2d2..76cd09879eaf4 100644 |
475 |
+--- a/arch/s390/kernel/machine_kexec_file.c |
476 |
++++ b/arch/s390/kernel/machine_kexec_file.c |
477 |
+@@ -277,6 +277,7 @@ int arch_kexec_apply_relocations_add(struct purgatory_info *pi, |
478 |
+ { |
479 |
+ Elf_Rela *relas; |
480 |
+ int i, r_type; |
481 |
++ int ret; |
482 |
+ |
483 |
+ relas = (void *)pi->ehdr + relsec->sh_offset; |
484 |
+ |
485 |
+@@ -311,7 +312,11 @@ int arch_kexec_apply_relocations_add(struct purgatory_info *pi, |
486 |
+ addr = section->sh_addr + relas[i].r_offset; |
487 |
+ |
488 |
+ r_type = ELF64_R_TYPE(relas[i].r_info); |
489 |
+- arch_kexec_do_relocs(r_type, loc, val, addr); |
490 |
++ ret = arch_kexec_do_relocs(r_type, loc, val, addr); |
491 |
++ if (ret) { |
492 |
++ pr_err("Unknown rela relocation: %d\n", r_type); |
493 |
++ return -ENOEXEC; |
494 |
++ } |
495 |
+ } |
496 |
+ return 0; |
497 |
+ } |
498 |
+diff --git a/arch/x86/kvm/ioapic.h b/arch/x86/kvm/ioapic.h |
499 |
+index 27e61ff3ac3e8..f1b2b2a6ff4db 100644 |
500 |
+--- a/arch/x86/kvm/ioapic.h |
501 |
++++ b/arch/x86/kvm/ioapic.h |
502 |
+@@ -81,7 +81,6 @@ struct kvm_ioapic { |
503 |
+ unsigned long irq_states[IOAPIC_NUM_PINS]; |
504 |
+ struct kvm_io_device dev; |
505 |
+ struct kvm *kvm; |
506 |
+- void (*ack_notifier)(void *opaque, int irq); |
507 |
+ spinlock_t lock; |
508 |
+ struct rtc_status rtc_status; |
509 |
+ struct delayed_work eoi_inject; |
510 |
+diff --git a/arch/x86/kvm/irq.h b/arch/x86/kvm/irq.h |
511 |
+index 650642b18d151..c2d7cfe82d004 100644 |
512 |
+--- a/arch/x86/kvm/irq.h |
513 |
++++ b/arch/x86/kvm/irq.h |
514 |
+@@ -56,7 +56,6 @@ struct kvm_pic { |
515 |
+ struct kvm_io_device dev_master; |
516 |
+ struct kvm_io_device dev_slave; |
517 |
+ struct kvm_io_device dev_elcr; |
518 |
+- void (*ack_notifier)(void *opaque, int irq); |
519 |
+ unsigned long irq_states[PIC_NUM_PINS]; |
520 |
+ }; |
521 |
+ |
522 |
+diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c |
523 |
+index dacdf2395f01a..4e212f04268bb 100644 |
524 |
+--- a/arch/x86/kvm/vmx/vmx.c |
525 |
++++ b/arch/x86/kvm/vmx/vmx.c |
526 |
+@@ -7776,10 +7776,10 @@ static __init int hardware_setup(void) |
527 |
+ ple_window_shrink = 0; |
528 |
+ } |
529 |
+ |
530 |
+- if (!cpu_has_vmx_apicv()) { |
531 |
++ if (!cpu_has_vmx_apicv()) |
532 |
+ enable_apicv = 0; |
533 |
++ if (!enable_apicv) |
534 |
+ vmx_x86_ops.sync_pir_to_irr = NULL; |
535 |
+- } |
536 |
+ |
537 |
+ if (cpu_has_vmx_tsc_scaling()) { |
538 |
+ kvm_has_tsc_control = true; |
539 |
+diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c |
540 |
+index eff065ce6f8e8..dea578586fa4e 100644 |
541 |
+--- a/arch/x86/kvm/x86.c |
542 |
++++ b/arch/x86/kvm/x86.c |
543 |
+@@ -1091,6 +1091,18 @@ static void kvm_invalidate_pcid(struct kvm_vcpu *vcpu, unsigned long pcid) |
544 |
+ unsigned long roots_to_free = 0; |
545 |
+ int i; |
546 |
+ |
547 |
++ /* |
548 |
++ * MOV CR3 and INVPCID are usually not intercepted when using TDP, but |
549 |
++ * this is reachable when running EPT=1 and unrestricted_guest=0, and |
550 |
++ * also via the emulator. KVM's TDP page tables are not in the scope of |
551 |
++ * the invalidation, but the guest's TLB entries need to be flushed as |
552 |
++ * the CPU may have cached entries in its TLB for the target PCID. |
553 |
++ */ |
554 |
++ if (unlikely(tdp_enabled)) { |
555 |
++ kvm_make_request(KVM_REQ_TLB_FLUSH_GUEST, vcpu); |
556 |
++ return; |
557 |
++ } |
558 |
++ |
559 |
+ /* |
560 |
+ * If neither the current CR3 nor any of the prev_roots use the given |
561 |
+ * PCID, then nothing needs to be done here because a resync will |
562 |
+@@ -3347,7 +3359,7 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info) |
563 |
+ |
564 |
+ if (!msr_info->host_initiated) |
565 |
+ return 1; |
566 |
+- if (guest_cpuid_has(vcpu, X86_FEATURE_PDCM) && kvm_get_msr_feature(&msr_ent)) |
567 |
++ if (kvm_get_msr_feature(&msr_ent)) |
568 |
+ return 1; |
569 |
+ if (data & ~msr_ent.data) |
570 |
+ return 1; |
571 |
+diff --git a/arch/x86/net/bpf_jit_comp.c b/arch/x86/net/bpf_jit_comp.c |
572 |
+index 9ea57389c554b..d99434dc215c2 100644 |
573 |
+--- a/arch/x86/net/bpf_jit_comp.c |
574 |
++++ b/arch/x86/net/bpf_jit_comp.c |
575 |
+@@ -721,6 +721,20 @@ static void maybe_emit_mod(u8 **pprog, u32 dst_reg, u32 src_reg, bool is64) |
576 |
+ *pprog = prog; |
577 |
+ } |
578 |
+ |
579 |
++/* |
580 |
++ * Similar version of maybe_emit_mod() for a single register |
581 |
++ */ |
582 |
++static void maybe_emit_1mod(u8 **pprog, u32 reg, bool is64) |
583 |
++{ |
584 |
++ u8 *prog = *pprog; |
585 |
++ |
586 |
++ if (is64) |
587 |
++ EMIT1(add_1mod(0x48, reg)); |
588 |
++ else if (is_ereg(reg)) |
589 |
++ EMIT1(add_1mod(0x40, reg)); |
590 |
++ *pprog = prog; |
591 |
++} |
592 |
++ |
593 |
+ /* LDX: dst_reg = *(u8*)(src_reg + off) */ |
594 |
+ static void emit_ldx(u8 **pprog, u32 size, u32 dst_reg, u32 src_reg, int off) |
595 |
+ { |
596 |
+@@ -951,10 +965,8 @@ static int do_jit(struct bpf_prog *bpf_prog, int *addrs, u8 *image, |
597 |
+ /* neg dst */ |
598 |
+ case BPF_ALU | BPF_NEG: |
599 |
+ case BPF_ALU64 | BPF_NEG: |
600 |
+- if (BPF_CLASS(insn->code) == BPF_ALU64) |
601 |
+- EMIT1(add_1mod(0x48, dst_reg)); |
602 |
+- else if (is_ereg(dst_reg)) |
603 |
+- EMIT1(add_1mod(0x40, dst_reg)); |
604 |
++ maybe_emit_1mod(&prog, dst_reg, |
605 |
++ BPF_CLASS(insn->code) == BPF_ALU64); |
606 |
+ EMIT2(0xF7, add_1reg(0xD8, dst_reg)); |
607 |
+ break; |
608 |
+ |
609 |
+@@ -968,10 +980,8 @@ static int do_jit(struct bpf_prog *bpf_prog, int *addrs, u8 *image, |
610 |
+ case BPF_ALU64 | BPF_AND | BPF_K: |
611 |
+ case BPF_ALU64 | BPF_OR | BPF_K: |
612 |
+ case BPF_ALU64 | BPF_XOR | BPF_K: |
613 |
+- if (BPF_CLASS(insn->code) == BPF_ALU64) |
614 |
+- EMIT1(add_1mod(0x48, dst_reg)); |
615 |
+- else if (is_ereg(dst_reg)) |
616 |
+- EMIT1(add_1mod(0x40, dst_reg)); |
617 |
++ maybe_emit_1mod(&prog, dst_reg, |
618 |
++ BPF_CLASS(insn->code) == BPF_ALU64); |
619 |
+ |
620 |
+ /* |
621 |
+ * b3 holds 'normal' opcode, b2 short form only valid |
622 |
+@@ -1112,10 +1122,8 @@ static int do_jit(struct bpf_prog *bpf_prog, int *addrs, u8 *image, |
623 |
+ case BPF_ALU64 | BPF_LSH | BPF_K: |
624 |
+ case BPF_ALU64 | BPF_RSH | BPF_K: |
625 |
+ case BPF_ALU64 | BPF_ARSH | BPF_K: |
626 |
+- if (BPF_CLASS(insn->code) == BPF_ALU64) |
627 |
+- EMIT1(add_1mod(0x48, dst_reg)); |
628 |
+- else if (is_ereg(dst_reg)) |
629 |
+- EMIT1(add_1mod(0x40, dst_reg)); |
630 |
++ maybe_emit_1mod(&prog, dst_reg, |
631 |
++ BPF_CLASS(insn->code) == BPF_ALU64); |
632 |
+ |
633 |
+ b3 = simple_alu_opcodes[BPF_OP(insn->code)]; |
634 |
+ if (imm32 == 1) |
635 |
+@@ -1146,10 +1154,8 @@ static int do_jit(struct bpf_prog *bpf_prog, int *addrs, u8 *image, |
636 |
+ } |
637 |
+ |
638 |
+ /* shl %rax, %cl | shr %rax, %cl | sar %rax, %cl */ |
639 |
+- if (BPF_CLASS(insn->code) == BPF_ALU64) |
640 |
+- EMIT1(add_1mod(0x48, dst_reg)); |
641 |
+- else if (is_ereg(dst_reg)) |
642 |
+- EMIT1(add_1mod(0x40, dst_reg)); |
643 |
++ maybe_emit_1mod(&prog, dst_reg, |
644 |
++ BPF_CLASS(insn->code) == BPF_ALU64); |
645 |
+ |
646 |
+ b3 = simple_alu_opcodes[BPF_OP(insn->code)]; |
647 |
+ EMIT2(0xD3, add_1reg(b3, dst_reg)); |
648 |
+@@ -1274,19 +1280,54 @@ st: if (is_imm8(insn->off)) |
649 |
+ case BPF_LDX | BPF_MEM | BPF_DW: |
650 |
+ case BPF_LDX | BPF_PROBE_MEM | BPF_DW: |
651 |
+ if (BPF_MODE(insn->code) == BPF_PROBE_MEM) { |
652 |
+- /* test src_reg, src_reg */ |
653 |
+- maybe_emit_mod(&prog, src_reg, src_reg, true); /* always 1 byte */ |
654 |
+- EMIT2(0x85, add_2reg(0xC0, src_reg, src_reg)); |
655 |
+- /* jne start_of_ldx */ |
656 |
+- EMIT2(X86_JNE, 0); |
657 |
++ /* Though the verifier prevents negative insn->off in BPF_PROBE_MEM |
658 |
++ * add abs(insn->off) to the limit to make sure that negative |
659 |
++ * offset won't be an issue. |
660 |
++ * insn->off is s16, so it won't affect valid pointers. |
661 |
++ */ |
662 |
++ u64 limit = TASK_SIZE_MAX + PAGE_SIZE + abs(insn->off); |
663 |
++ u8 *end_of_jmp1, *end_of_jmp2; |
664 |
++ |
665 |
++ /* Conservatively check that src_reg + insn->off is a kernel address: |
666 |
++ * 1. src_reg + insn->off >= limit |
667 |
++ * 2. src_reg + insn->off doesn't become small positive. |
668 |
++ * Cannot do src_reg + insn->off >= limit in one branch, |
669 |
++ * since it needs two spare registers, but JIT has only one. |
670 |
++ */ |
671 |
++ |
672 |
++ /* movabsq r11, limit */ |
673 |
++ EMIT2(add_1mod(0x48, AUX_REG), add_1reg(0xB8, AUX_REG)); |
674 |
++ EMIT((u32)limit, 4); |
675 |
++ EMIT(limit >> 32, 4); |
676 |
++ /* cmp src_reg, r11 */ |
677 |
++ maybe_emit_mod(&prog, src_reg, AUX_REG, true); |
678 |
++ EMIT2(0x39, add_2reg(0xC0, src_reg, AUX_REG)); |
679 |
++ /* if unsigned '<' goto end_of_jmp2 */ |
680 |
++ EMIT2(X86_JB, 0); |
681 |
++ end_of_jmp1 = prog; |
682 |
++ |
683 |
++ /* mov r11, src_reg */ |
684 |
++ emit_mov_reg(&prog, true, AUX_REG, src_reg); |
685 |
++ /* add r11, insn->off */ |
686 |
++ maybe_emit_1mod(&prog, AUX_REG, true); |
687 |
++ EMIT2_off32(0x81, add_1reg(0xC0, AUX_REG), insn->off); |
688 |
++ /* jmp if not carry to start_of_ldx |
689 |
++ * Otherwise ERR_PTR(-EINVAL) + 128 will be the user addr |
690 |
++ * that has to be rejected. |
691 |
++ */ |
692 |
++ EMIT2(0x73 /* JNC */, 0); |
693 |
++ end_of_jmp2 = prog; |
694 |
++ |
695 |
+ /* xor dst_reg, dst_reg */ |
696 |
+ emit_mov_imm32(&prog, false, dst_reg, 0); |
697 |
+ /* jmp byte_after_ldx */ |
698 |
+ EMIT2(0xEB, 0); |
699 |
+ |
700 |
+- /* populate jmp_offset for JNE above */ |
701 |
+- temp[4] = prog - temp - 5 /* sizeof(test + jne) */; |
702 |
++ /* populate jmp_offset for JB above to jump to xor dst_reg */ |
703 |
++ end_of_jmp1[-1] = end_of_jmp2 - end_of_jmp1; |
704 |
++ /* populate jmp_offset for JNC above to jump to start_of_ldx */ |
705 |
+ start_of_ldx = prog; |
706 |
++ end_of_jmp2[-1] = start_of_ldx - end_of_jmp2; |
707 |
+ } |
708 |
+ emit_ldx(&prog, BPF_SIZE(insn->code), dst_reg, src_reg, insn->off); |
709 |
+ if (BPF_MODE(insn->code) == BPF_PROBE_MEM) { |
710 |
+@@ -1332,7 +1373,7 @@ st: if (is_imm8(insn->off)) |
711 |
+ * End result: x86 insn "mov rbx, qword ptr [rax+0x14]" |
712 |
+ * of 4 bytes will be ignored and rbx will be zero inited. |
713 |
+ */ |
714 |
+- ex->fixup = (prog - temp) | (reg2pt_regs[dst_reg] << 8); |
715 |
++ ex->fixup = (prog - start_of_ldx) | (reg2pt_regs[dst_reg] << 8); |
716 |
+ } |
717 |
+ break; |
718 |
+ |
719 |
+@@ -1459,10 +1500,8 @@ st: if (is_imm8(insn->off)) |
720 |
+ case BPF_JMP | BPF_JSET | BPF_K: |
721 |
+ case BPF_JMP32 | BPF_JSET | BPF_K: |
722 |
+ /* test dst_reg, imm32 */ |
723 |
+- if (BPF_CLASS(insn->code) == BPF_JMP) |
724 |
+- EMIT1(add_1mod(0x48, dst_reg)); |
725 |
+- else if (is_ereg(dst_reg)) |
726 |
+- EMIT1(add_1mod(0x40, dst_reg)); |
727 |
++ maybe_emit_1mod(&prog, dst_reg, |
728 |
++ BPF_CLASS(insn->code) == BPF_JMP); |
729 |
+ EMIT2_off32(0xF7, add_1reg(0xC0, dst_reg), imm32); |
730 |
+ goto emit_cond_jmp; |
731 |
+ |
732 |
+@@ -1495,10 +1534,8 @@ st: if (is_imm8(insn->off)) |
733 |
+ } |
734 |
+ |
735 |
+ /* cmp dst_reg, imm8/32 */ |
736 |
+- if (BPF_CLASS(insn->code) == BPF_JMP) |
737 |
+- EMIT1(add_1mod(0x48, dst_reg)); |
738 |
+- else if (is_ereg(dst_reg)) |
739 |
+- EMIT1(add_1mod(0x40, dst_reg)); |
740 |
++ maybe_emit_1mod(&prog, dst_reg, |
741 |
++ BPF_CLASS(insn->code) == BPF_JMP); |
742 |
+ |
743 |
+ if (is_imm8(imm32)) |
744 |
+ EMIT3(0x83, add_1reg(0xF8, dst_reg), imm32); |
745 |
+diff --git a/block/blk-iocost.c b/block/blk-iocost.c |
746 |
+index b3880e4ba22a1..eb7b0d6bd11f6 100644 |
747 |
+--- a/block/blk-iocost.c |
748 |
++++ b/block/blk-iocost.c |
749 |
+@@ -2311,7 +2311,14 @@ static void ioc_timer_fn(struct timer_list *timer) |
750 |
+ hwm = current_hweight_max(iocg); |
751 |
+ new_hwi = hweight_after_donation(iocg, old_hwi, hwm, |
752 |
+ usage, &now); |
753 |
+- if (new_hwi < hwm) { |
754 |
++ /* |
755 |
++ * Donation calculation assumes hweight_after_donation |
756 |
++ * to be positive, a condition that a donor w/ hwa < 2 |
757 |
++ * can't meet. Don't bother with donation if hwa is |
758 |
++ * below 2. It's not gonna make a meaningful difference |
759 |
++ * anyway. |
760 |
++ */ |
761 |
++ if (new_hwi < hwm && hwa >= 2) { |
762 |
+ iocg->hweight_donating = hwa; |
763 |
+ iocg->hweight_after_donation = new_hwi; |
764 |
+ list_add(&iocg->surplus_list, &surpluses); |
765 |
+diff --git a/drivers/Makefile b/drivers/Makefile |
766 |
+index be5d40ae14882..a110338c860c7 100644 |
767 |
+--- a/drivers/Makefile |
768 |
++++ b/drivers/Makefile |
769 |
+@@ -41,8 +41,7 @@ obj-$(CONFIG_DMADEVICES) += dma/ |
770 |
+ # SOC specific infrastructure drivers. |
771 |
+ obj-y += soc/ |
772 |
+ |
773 |
+-obj-$(CONFIG_VIRTIO) += virtio/ |
774 |
+-obj-$(CONFIG_VIRTIO_PCI_LIB) += virtio/ |
775 |
++obj-y += virtio/ |
776 |
+ obj-$(CONFIG_VDPA) += vdpa/ |
777 |
+ obj-$(CONFIG_XEN) += xen/ |
778 |
+ |
779 |
+diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c |
780 |
+index 1fb4611f7eeb9..10303611d17b9 100644 |
781 |
+--- a/drivers/ata/libata-scsi.c |
782 |
++++ b/drivers/ata/libata-scsi.c |
783 |
+@@ -2826,8 +2826,19 @@ static unsigned int ata_scsi_pass_thru(struct ata_queued_cmd *qc) |
784 |
+ goto invalid_fld; |
785 |
+ } |
786 |
+ |
787 |
+- if (ata_is_ncq(tf->protocol) && (cdb[2 + cdb_offset] & 0x3) == 0) |
788 |
+- tf->protocol = ATA_PROT_NCQ_NODATA; |
789 |
++ if ((cdb[2 + cdb_offset] & 0x3) == 0) { |
790 |
++ /* |
791 |
++ * When T_LENGTH is zero (No data is transferred), dir should |
792 |
++ * be DMA_NONE. |
793 |
++ */ |
794 |
++ if (scmd->sc_data_direction != DMA_NONE) { |
795 |
++ fp = 2 + cdb_offset; |
796 |
++ goto invalid_fld; |
797 |
++ } |
798 |
++ |
799 |
++ if (ata_is_ncq(tf->protocol)) |
800 |
++ tf->protocol = ATA_PROT_NCQ_NODATA; |
801 |
++ } |
802 |
+ |
803 |
+ /* enable LBA */ |
804 |
+ tf->flags |= ATA_TFLAG_LBA; |
805 |
+diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c |
806 |
+index 72902104f1112..4dbb71230d6e7 100644 |
807 |
+--- a/drivers/block/xen-blkfront.c |
808 |
++++ b/drivers/block/xen-blkfront.c |
809 |
+@@ -1511,9 +1511,12 @@ static irqreturn_t blkif_interrupt(int irq, void *dev_id) |
810 |
+ unsigned long flags; |
811 |
+ struct blkfront_ring_info *rinfo = (struct blkfront_ring_info *)dev_id; |
812 |
+ struct blkfront_info *info = rinfo->dev_info; |
813 |
++ unsigned int eoiflag = XEN_EOI_FLAG_SPURIOUS; |
814 |
+ |
815 |
+- if (unlikely(info->connected != BLKIF_STATE_CONNECTED)) |
816 |
++ if (unlikely(info->connected != BLKIF_STATE_CONNECTED)) { |
817 |
++ xen_irq_lateeoi(irq, XEN_EOI_FLAG_SPURIOUS); |
818 |
+ return IRQ_HANDLED; |
819 |
++ } |
820 |
+ |
821 |
+ spin_lock_irqsave(&rinfo->ring_lock, flags); |
822 |
+ again: |
823 |
+@@ -1529,6 +1532,8 @@ static irqreturn_t blkif_interrupt(int irq, void *dev_id) |
824 |
+ unsigned long id; |
825 |
+ unsigned int op; |
826 |
+ |
827 |
++ eoiflag = 0; |
828 |
++ |
829 |
+ RING_COPY_RESPONSE(&rinfo->ring, i, &bret); |
830 |
+ id = bret.id; |
831 |
+ |
832 |
+@@ -1645,6 +1650,8 @@ static irqreturn_t blkif_interrupt(int irq, void *dev_id) |
833 |
+ |
834 |
+ spin_unlock_irqrestore(&rinfo->ring_lock, flags); |
835 |
+ |
836 |
++ xen_irq_lateeoi(irq, eoiflag); |
837 |
++ |
838 |
+ return IRQ_HANDLED; |
839 |
+ |
840 |
+ err: |
841 |
+@@ -1652,6 +1659,8 @@ static irqreturn_t blkif_interrupt(int irq, void *dev_id) |
842 |
+ |
843 |
+ spin_unlock_irqrestore(&rinfo->ring_lock, flags); |
844 |
+ |
845 |
++ /* No EOI in order to avoid further interrupts. */ |
846 |
++ |
847 |
+ pr_alert("%s disabled for further use\n", info->gd->disk_name); |
848 |
+ return IRQ_HANDLED; |
849 |
+ } |
850 |
+@@ -1691,8 +1700,8 @@ static int setup_blkring(struct xenbus_device *dev, |
851 |
+ if (err) |
852 |
+ goto fail; |
853 |
+ |
854 |
+- err = bind_evtchn_to_irqhandler(rinfo->evtchn, blkif_interrupt, 0, |
855 |
+- "blkif", rinfo); |
856 |
++ err = bind_evtchn_to_irqhandler_lateeoi(rinfo->evtchn, blkif_interrupt, |
857 |
++ 0, "blkif", rinfo); |
858 |
+ if (err <= 0) { |
859 |
+ xenbus_dev_fatal(dev, err, |
860 |
+ "bind_evtchn_to_irqhandler failed"); |
861 |
+diff --git a/drivers/bus/ti-sysc.c b/drivers/bus/ti-sysc.c |
862 |
+index bb377bb13564a..ebf22929ff328 100644 |
863 |
+--- a/drivers/bus/ti-sysc.c |
864 |
++++ b/drivers/bus/ti-sysc.c |
865 |
+@@ -2456,12 +2456,11 @@ static void sysc_reinit_modules(struct sysc_soc_info *soc) |
866 |
+ struct sysc_module *module; |
867 |
+ struct list_head *pos; |
868 |
+ struct sysc *ddata; |
869 |
+- int error = 0; |
870 |
+ |
871 |
+ list_for_each(pos, &sysc_soc->restored_modules) { |
872 |
+ module = list_entry(pos, struct sysc_module, node); |
873 |
+ ddata = module->ddata; |
874 |
+- error = sysc_reinit_module(ddata, ddata->enabled); |
875 |
++ sysc_reinit_module(ddata, ddata->enabled); |
876 |
+ } |
877 |
+ } |
878 |
+ |
879 |
+diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c |
880 |
+index 65508eb89ec99..a277fd4f2f0a6 100644 |
881 |
+--- a/drivers/clk/clk.c |
882 |
++++ b/drivers/clk/clk.c |
883 |
+@@ -3415,6 +3415,14 @@ static int __clk_core_init(struct clk_core *core) |
884 |
+ |
885 |
+ clk_prepare_lock(); |
886 |
+ |
887 |
++ /* |
888 |
++ * Set hw->core after grabbing the prepare_lock to synchronize with |
889 |
++ * callers of clk_core_fill_parent_index() where we treat hw->core |
890 |
++ * being NULL as the clk not being registered yet. This is crucial so |
891 |
++ * that clks aren't parented until their parent is fully registered. |
892 |
++ */ |
893 |
++ core->hw->core = core; |
894 |
++ |
895 |
+ ret = clk_pm_runtime_get(core); |
896 |
+ if (ret) |
897 |
+ goto unlock; |
898 |
+@@ -3579,8 +3587,10 @@ static int __clk_core_init(struct clk_core *core) |
899 |
+ out: |
900 |
+ clk_pm_runtime_put(core); |
901 |
+ unlock: |
902 |
+- if (ret) |
903 |
++ if (ret) { |
904 |
+ hlist_del_init(&core->child_node); |
905 |
++ core->hw->core = NULL; |
906 |
++ } |
907 |
+ |
908 |
+ clk_prepare_unlock(); |
909 |
+ |
910 |
+@@ -3844,7 +3854,6 @@ __clk_register(struct device *dev, struct device_node *np, struct clk_hw *hw) |
911 |
+ core->num_parents = init->num_parents; |
912 |
+ core->min_rate = 0; |
913 |
+ core->max_rate = ULONG_MAX; |
914 |
+- hw->core = core; |
915 |
+ |
916 |
+ ret = clk_core_populate_parent_map(core, init); |
917 |
+ if (ret) |
918 |
+@@ -3862,7 +3871,7 @@ __clk_register(struct device *dev, struct device_node *np, struct clk_hw *hw) |
919 |
+ goto fail_create_clk; |
920 |
+ } |
921 |
+ |
922 |
+- clk_core_link_consumer(hw->core, hw->clk); |
923 |
++ clk_core_link_consumer(core, hw->clk); |
924 |
+ |
925 |
+ ret = __clk_core_init(core); |
926 |
+ if (!ret) |
927 |
+diff --git a/drivers/dma/idxd/irq.c b/drivers/dma/idxd/irq.c |
928 |
+index ca88fa7a328e7..6d6af0dc3c0ec 100644 |
929 |
+--- a/drivers/dma/idxd/irq.c |
930 |
++++ b/drivers/dma/idxd/irq.c |
931 |
+@@ -63,6 +63,9 @@ static int process_misc_interrupts(struct idxd_device *idxd, u32 cause) |
932 |
+ int i; |
933 |
+ bool err = false; |
934 |
+ |
935 |
++ if (cause & IDXD_INTC_HALT_STATE) |
936 |
++ goto halt; |
937 |
++ |
938 |
+ if (cause & IDXD_INTC_ERR) { |
939 |
+ spin_lock(&idxd->dev_lock); |
940 |
+ for (i = 0; i < 4; i++) |
941 |
+@@ -121,6 +124,7 @@ static int process_misc_interrupts(struct idxd_device *idxd, u32 cause) |
942 |
+ if (!err) |
943 |
+ return 0; |
944 |
+ |
945 |
++halt: |
946 |
+ gensts.bits = ioread32(idxd->reg_base + IDXD_GENSTATS_OFFSET); |
947 |
+ if (gensts.state == IDXD_DEVICE_STATE_HALT) { |
948 |
+ idxd->state = IDXD_DEV_HALTED; |
949 |
+@@ -133,9 +137,10 @@ static int process_misc_interrupts(struct idxd_device *idxd, u32 cause) |
950 |
+ INIT_WORK(&idxd->work, idxd_device_reinit); |
951 |
+ queue_work(idxd->wq, &idxd->work); |
952 |
+ } else { |
953 |
+- spin_lock(&idxd->dev_lock); |
954 |
++ idxd->state = IDXD_DEV_HALTED; |
955 |
+ idxd_wqs_quiesce(idxd); |
956 |
+ idxd_wqs_unmap_portal(idxd); |
957 |
++ spin_lock(&idxd->dev_lock); |
958 |
+ idxd_device_clear_state(idxd); |
959 |
+ dev_err(&idxd->pdev->dev, |
960 |
+ "idxd halted, need %s.\n", |
961 |
+diff --git a/drivers/dma/idxd/registers.h b/drivers/dma/idxd/registers.h |
962 |
+index ffc7550a77eeb..97ffb06de9b0d 100644 |
963 |
+--- a/drivers/dma/idxd/registers.h |
964 |
++++ b/drivers/dma/idxd/registers.h |
965 |
+@@ -158,6 +158,7 @@ enum idxd_device_reset_type { |
966 |
+ #define IDXD_INTC_CMD 0x02 |
967 |
+ #define IDXD_INTC_OCCUPY 0x04 |
968 |
+ #define IDXD_INTC_PERFMON_OVFL 0x08 |
969 |
++#define IDXD_INTC_HALT_STATE 0x10 |
970 |
+ |
971 |
+ #define IDXD_CMD_OFFSET 0xa0 |
972 |
+ union idxd_command_reg { |
973 |
+diff --git a/drivers/dma/idxd/submit.c b/drivers/dma/idxd/submit.c |
974 |
+index de76fb4abac24..83452fbbb168b 100644 |
975 |
+--- a/drivers/dma/idxd/submit.c |
976 |
++++ b/drivers/dma/idxd/submit.c |
977 |
+@@ -106,6 +106,7 @@ static void llist_abort_desc(struct idxd_wq *wq, struct idxd_irq_entry *ie, |
978 |
+ { |
979 |
+ struct idxd_desc *d, *t, *found = NULL; |
980 |
+ struct llist_node *head; |
981 |
++ LIST_HEAD(flist); |
982 |
+ |
983 |
+ desc->completion->status = IDXD_COMP_DESC_ABORT; |
984 |
+ /* |
985 |
+@@ -120,7 +121,11 @@ static void llist_abort_desc(struct idxd_wq *wq, struct idxd_irq_entry *ie, |
986 |
+ found = desc; |
987 |
+ continue; |
988 |
+ } |
989 |
+- list_add_tail(&desc->list, &ie->work_list); |
990 |
++ |
991 |
++ if (d->completion->status) |
992 |
++ list_add_tail(&d->list, &flist); |
993 |
++ else |
994 |
++ list_add_tail(&d->list, &ie->work_list); |
995 |
+ } |
996 |
+ } |
997 |
+ |
998 |
+@@ -130,6 +135,17 @@ static void llist_abort_desc(struct idxd_wq *wq, struct idxd_irq_entry *ie, |
999 |
+ |
1000 |
+ if (found) |
1001 |
+ complete_desc(found, IDXD_COMPLETE_ABORT); |
1002 |
++ |
1003 |
++ /* |
1004 |
++ * complete_desc() will return desc to allocator and the desc can be |
1005 |
++ * acquired by a different process and the desc->list can be modified. |
1006 |
++ * Delete desc from list so the list trasversing does not get corrupted |
1007 |
++ * by the other process. |
1008 |
++ */ |
1009 |
++ list_for_each_entry_safe(d, t, &flist, list) { |
1010 |
++ list_del_init(&d->list); |
1011 |
++ complete_desc(d, IDXD_COMPLETE_NORMAL); |
1012 |
++ } |
1013 |
+ } |
1014 |
+ |
1015 |
+ int idxd_submit_desc(struct idxd_wq *wq, struct idxd_desc *desc) |
1016 |
+diff --git a/drivers/dma/st_fdma.c b/drivers/dma/st_fdma.c |
1017 |
+index 962b6e05287b5..d95c421877fb7 100644 |
1018 |
+--- a/drivers/dma/st_fdma.c |
1019 |
++++ b/drivers/dma/st_fdma.c |
1020 |
+@@ -874,4 +874,4 @@ MODULE_LICENSE("GPL v2"); |
1021 |
+ MODULE_DESCRIPTION("STMicroelectronics FDMA engine driver"); |
1022 |
+ MODULE_AUTHOR("Ludovic.barre <Ludovic.barre@××.com>"); |
1023 |
+ MODULE_AUTHOR("Peter Griffin <peter.griffin@××××××.org>"); |
1024 |
+-MODULE_ALIAS("platform: " DRIVER_NAME); |
1025 |
++MODULE_ALIAS("platform:" DRIVER_NAME); |
1026 |
+diff --git a/drivers/firmware/scpi_pm_domain.c b/drivers/firmware/scpi_pm_domain.c |
1027 |
+index 51201600d789b..800673910b511 100644 |
1028 |
+--- a/drivers/firmware/scpi_pm_domain.c |
1029 |
++++ b/drivers/firmware/scpi_pm_domain.c |
1030 |
+@@ -16,7 +16,6 @@ struct scpi_pm_domain { |
1031 |
+ struct generic_pm_domain genpd; |
1032 |
+ struct scpi_ops *ops; |
1033 |
+ u32 domain; |
1034 |
+- char name[30]; |
1035 |
+ }; |
1036 |
+ |
1037 |
+ /* |
1038 |
+@@ -110,8 +109,13 @@ static int scpi_pm_domain_probe(struct platform_device *pdev) |
1039 |
+ |
1040 |
+ scpi_pd->domain = i; |
1041 |
+ scpi_pd->ops = scpi_ops; |
1042 |
+- sprintf(scpi_pd->name, "%pOFn.%d", np, i); |
1043 |
+- scpi_pd->genpd.name = scpi_pd->name; |
1044 |
++ scpi_pd->genpd.name = devm_kasprintf(dev, GFP_KERNEL, |
1045 |
++ "%pOFn.%d", np, i); |
1046 |
++ if (!scpi_pd->genpd.name) { |
1047 |
++ dev_err(dev, "Failed to allocate genpd name:%pOFn.%d\n", |
1048 |
++ np, i); |
1049 |
++ continue; |
1050 |
++ } |
1051 |
+ scpi_pd->genpd.power_off = scpi_pd_power_off; |
1052 |
+ scpi_pd->genpd.power_on = scpi_pd_power_on; |
1053 |
+ |
1054 |
+diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c |
1055 |
+index 55f8dd6e56b48..c39e53a41f13a 100644 |
1056 |
+--- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c |
1057 |
++++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c |
1058 |
+@@ -3061,8 +3061,8 @@ static void gfx_v9_0_init_pg(struct amdgpu_device *adev) |
1059 |
+ AMD_PG_SUPPORT_CP | |
1060 |
+ AMD_PG_SUPPORT_GDS | |
1061 |
+ AMD_PG_SUPPORT_RLC_SMU_HS)) { |
1062 |
+- WREG32(mmRLC_JUMP_TABLE_RESTORE, |
1063 |
+- adev->gfx.rlc.cp_table_gpu_addr >> 8); |
1064 |
++ WREG32_SOC15(GC, 0, mmRLC_JUMP_TABLE_RESTORE, |
1065 |
++ adev->gfx.rlc.cp_table_gpu_addr >> 8); |
1066 |
+ gfx_v9_0_init_gfx_power_gating(adev); |
1067 |
+ } |
1068 |
+ } |
1069 |
+diff --git a/drivers/gpu/drm/amd/amdgpu/gfxhub_v1_0.c b/drivers/gpu/drm/amd/amdgpu/gfxhub_v1_0.c |
1070 |
+index bda1542ef1ddf..f51fd0688eca7 100644 |
1071 |
+--- a/drivers/gpu/drm/amd/amdgpu/gfxhub_v1_0.c |
1072 |
++++ b/drivers/gpu/drm/amd/amdgpu/gfxhub_v1_0.c |
1073 |
+@@ -162,7 +162,6 @@ static void gfxhub_v1_0_init_tlb_regs(struct amdgpu_device *adev) |
1074 |
+ ENABLE_ADVANCED_DRIVER_MODEL, 1); |
1075 |
+ tmp = REG_SET_FIELD(tmp, MC_VM_MX_L1_TLB_CNTL, |
1076 |
+ SYSTEM_APERTURE_UNMAPPED_ACCESS, 0); |
1077 |
+- tmp = REG_SET_FIELD(tmp, MC_VM_MX_L1_TLB_CNTL, ECO_BITS, 0); |
1078 |
+ tmp = REG_SET_FIELD(tmp, MC_VM_MX_L1_TLB_CNTL, |
1079 |
+ MTYPE, MTYPE_UC);/* XXX for emulation. */ |
1080 |
+ tmp = REG_SET_FIELD(tmp, MC_VM_MX_L1_TLB_CNTL, ATC_EN, 1); |
1081 |
+diff --git a/drivers/gpu/drm/amd/amdgpu/gfxhub_v2_0.c b/drivers/gpu/drm/amd/amdgpu/gfxhub_v2_0.c |
1082 |
+index 14c1c1a297dd3..6e0ace2fbfab1 100644 |
1083 |
+--- a/drivers/gpu/drm/amd/amdgpu/gfxhub_v2_0.c |
1084 |
++++ b/drivers/gpu/drm/amd/amdgpu/gfxhub_v2_0.c |
1085 |
+@@ -196,7 +196,6 @@ static void gfxhub_v2_0_init_tlb_regs(struct amdgpu_device *adev) |
1086 |
+ ENABLE_ADVANCED_DRIVER_MODEL, 1); |
1087 |
+ tmp = REG_SET_FIELD(tmp, GCMC_VM_MX_L1_TLB_CNTL, |
1088 |
+ SYSTEM_APERTURE_UNMAPPED_ACCESS, 0); |
1089 |
+- tmp = REG_SET_FIELD(tmp, GCMC_VM_MX_L1_TLB_CNTL, ECO_BITS, 0); |
1090 |
+ tmp = REG_SET_FIELD(tmp, GCMC_VM_MX_L1_TLB_CNTL, |
1091 |
+ MTYPE, MTYPE_UC); /* UC, uncached */ |
1092 |
+ |
1093 |
+diff --git a/drivers/gpu/drm/amd/amdgpu/gfxhub_v2_1.c b/drivers/gpu/drm/amd/amdgpu/gfxhub_v2_1.c |
1094 |
+index 1a374ec0514a5..9328991e8807f 100644 |
1095 |
+--- a/drivers/gpu/drm/amd/amdgpu/gfxhub_v2_1.c |
1096 |
++++ b/drivers/gpu/drm/amd/amdgpu/gfxhub_v2_1.c |
1097 |
+@@ -197,7 +197,6 @@ static void gfxhub_v2_1_init_tlb_regs(struct amdgpu_device *adev) |
1098 |
+ ENABLE_ADVANCED_DRIVER_MODEL, 1); |
1099 |
+ tmp = REG_SET_FIELD(tmp, GCMC_VM_MX_L1_TLB_CNTL, |
1100 |
+ SYSTEM_APERTURE_UNMAPPED_ACCESS, 0); |
1101 |
+- tmp = REG_SET_FIELD(tmp, GCMC_VM_MX_L1_TLB_CNTL, ECO_BITS, 0); |
1102 |
+ tmp = REG_SET_FIELD(tmp, GCMC_VM_MX_L1_TLB_CNTL, |
1103 |
+ MTYPE, MTYPE_UC); /* UC, uncached */ |
1104 |
+ |
1105 |
+diff --git a/drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c b/drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c |
1106 |
+index a99953833820e..b3bede1dc41da 100644 |
1107 |
+--- a/drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c |
1108 |
++++ b/drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c |
1109 |
+@@ -145,7 +145,6 @@ static void mmhub_v1_0_init_tlb_regs(struct amdgpu_device *adev) |
1110 |
+ ENABLE_ADVANCED_DRIVER_MODEL, 1); |
1111 |
+ tmp = REG_SET_FIELD(tmp, MC_VM_MX_L1_TLB_CNTL, |
1112 |
+ SYSTEM_APERTURE_UNMAPPED_ACCESS, 0); |
1113 |
+- tmp = REG_SET_FIELD(tmp, MC_VM_MX_L1_TLB_CNTL, ECO_BITS, 0); |
1114 |
+ tmp = REG_SET_FIELD(tmp, MC_VM_MX_L1_TLB_CNTL, |
1115 |
+ MTYPE, MTYPE_UC);/* XXX for emulation. */ |
1116 |
+ tmp = REG_SET_FIELD(tmp, MC_VM_MX_L1_TLB_CNTL, ATC_EN, 1); |
1117 |
+diff --git a/drivers/gpu/drm/amd/amdgpu/mmhub_v1_7.c b/drivers/gpu/drm/amd/amdgpu/mmhub_v1_7.c |
1118 |
+index f80a14a1b82dc..f5f7181f9af5f 100644 |
1119 |
+--- a/drivers/gpu/drm/amd/amdgpu/mmhub_v1_7.c |
1120 |
++++ b/drivers/gpu/drm/amd/amdgpu/mmhub_v1_7.c |
1121 |
+@@ -165,7 +165,6 @@ static void mmhub_v1_7_init_tlb_regs(struct amdgpu_device *adev) |
1122 |
+ ENABLE_ADVANCED_DRIVER_MODEL, 1); |
1123 |
+ tmp = REG_SET_FIELD(tmp, MC_VM_MX_L1_TLB_CNTL, |
1124 |
+ SYSTEM_APERTURE_UNMAPPED_ACCESS, 0); |
1125 |
+- tmp = REG_SET_FIELD(tmp, MC_VM_MX_L1_TLB_CNTL, ECO_BITS, 0); |
1126 |
+ tmp = REG_SET_FIELD(tmp, MC_VM_MX_L1_TLB_CNTL, |
1127 |
+ MTYPE, MTYPE_UC);/* XXX for emulation. */ |
1128 |
+ tmp = REG_SET_FIELD(tmp, MC_VM_MX_L1_TLB_CNTL, ATC_EN, 1); |
1129 |
+diff --git a/drivers/gpu/drm/amd/amdgpu/mmhub_v2_0.c b/drivers/gpu/drm/amd/amdgpu/mmhub_v2_0.c |
1130 |
+index 7ded6b2f058ef..2e58ed2caa485 100644 |
1131 |
+--- a/drivers/gpu/drm/amd/amdgpu/mmhub_v2_0.c |
1132 |
++++ b/drivers/gpu/drm/amd/amdgpu/mmhub_v2_0.c |
1133 |
+@@ -269,7 +269,6 @@ static void mmhub_v2_0_init_tlb_regs(struct amdgpu_device *adev) |
1134 |
+ ENABLE_ADVANCED_DRIVER_MODEL, 1); |
1135 |
+ tmp = REG_SET_FIELD(tmp, MMMC_VM_MX_L1_TLB_CNTL, |
1136 |
+ SYSTEM_APERTURE_UNMAPPED_ACCESS, 0); |
1137 |
+- tmp = REG_SET_FIELD(tmp, MMMC_VM_MX_L1_TLB_CNTL, ECO_BITS, 0); |
1138 |
+ tmp = REG_SET_FIELD(tmp, MMMC_VM_MX_L1_TLB_CNTL, |
1139 |
+ MTYPE, MTYPE_UC); /* UC, uncached */ |
1140 |
+ |
1141 |
+diff --git a/drivers/gpu/drm/amd/amdgpu/mmhub_v2_3.c b/drivers/gpu/drm/amd/amdgpu/mmhub_v2_3.c |
1142 |
+index 88e457a150e02..c63b6b9349350 100644 |
1143 |
+--- a/drivers/gpu/drm/amd/amdgpu/mmhub_v2_3.c |
1144 |
++++ b/drivers/gpu/drm/amd/amdgpu/mmhub_v2_3.c |
1145 |
+@@ -194,7 +194,6 @@ static void mmhub_v2_3_init_tlb_regs(struct amdgpu_device *adev) |
1146 |
+ ENABLE_ADVANCED_DRIVER_MODEL, 1); |
1147 |
+ tmp = REG_SET_FIELD(tmp, MMMC_VM_MX_L1_TLB_CNTL, |
1148 |
+ SYSTEM_APERTURE_UNMAPPED_ACCESS, 0); |
1149 |
+- tmp = REG_SET_FIELD(tmp, MMMC_VM_MX_L1_TLB_CNTL, ECO_BITS, 0); |
1150 |
+ tmp = REG_SET_FIELD(tmp, MMMC_VM_MX_L1_TLB_CNTL, |
1151 |
+ MTYPE, MTYPE_UC); /* UC, uncached */ |
1152 |
+ |
1153 |
+diff --git a/drivers/gpu/drm/amd/amdgpu/mmhub_v9_4.c b/drivers/gpu/drm/amd/amdgpu/mmhub_v9_4.c |
1154 |
+index c4ef822bbe8c5..ff49eeaf78824 100644 |
1155 |
+--- a/drivers/gpu/drm/amd/amdgpu/mmhub_v9_4.c |
1156 |
++++ b/drivers/gpu/drm/amd/amdgpu/mmhub_v9_4.c |
1157 |
+@@ -189,8 +189,6 @@ static void mmhub_v9_4_init_tlb_regs(struct amdgpu_device *adev, int hubid) |
1158 |
+ ENABLE_ADVANCED_DRIVER_MODEL, 1); |
1159 |
+ tmp = REG_SET_FIELD(tmp, VMSHAREDVC0_MC_VM_MX_L1_TLB_CNTL, |
1160 |
+ SYSTEM_APERTURE_UNMAPPED_ACCESS, 0); |
1161 |
+- tmp = REG_SET_FIELD(tmp, VMSHAREDVC0_MC_VM_MX_L1_TLB_CNTL, |
1162 |
+- ECO_BITS, 0); |
1163 |
+ tmp = REG_SET_FIELD(tmp, VMSHAREDVC0_MC_VM_MX_L1_TLB_CNTL, |
1164 |
+ MTYPE, MTYPE_UC);/* XXX for emulation. */ |
1165 |
+ tmp = REG_SET_FIELD(tmp, VMSHAREDVC0_MC_VM_MX_L1_TLB_CNTL, |
1166 |
+diff --git a/drivers/gpu/drm/amd/display/dc/dcn31/dcn31_init.c b/drivers/gpu/drm/amd/display/dc/dcn31/dcn31_init.c |
1167 |
+index 40011cd3c8ef0..ac8fb202fd5ee 100644 |
1168 |
+--- a/drivers/gpu/drm/amd/display/dc/dcn31/dcn31_init.c |
1169 |
++++ b/drivers/gpu/drm/amd/display/dc/dcn31/dcn31_init.c |
1170 |
+@@ -100,6 +100,7 @@ static const struct hw_sequencer_funcs dcn31_funcs = { |
1171 |
+ .z10_save_init = dcn31_z10_save_init, |
1172 |
+ .is_abm_supported = dcn31_is_abm_supported, |
1173 |
+ .set_disp_pattern_generator = dcn30_set_disp_pattern_generator, |
1174 |
++ .exit_optimized_pwr_state = dcn21_exit_optimized_pwr_state, |
1175 |
+ .update_visual_confirm_color = dcn20_update_visual_confirm_color, |
1176 |
+ }; |
1177 |
+ |
1178 |
+diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu12/smu_v12_0.c b/drivers/gpu/drm/amd/pm/swsmu/smu12/smu_v12_0.c |
1179 |
+index d60b8c5e87157..43028f2cd28b5 100644 |
1180 |
+--- a/drivers/gpu/drm/amd/pm/swsmu/smu12/smu_v12_0.c |
1181 |
++++ b/drivers/gpu/drm/amd/pm/swsmu/smu12/smu_v12_0.c |
1182 |
+@@ -191,6 +191,9 @@ int smu_v12_0_fini_smc_tables(struct smu_context *smu) |
1183 |
+ kfree(smu_table->watermarks_table); |
1184 |
+ smu_table->watermarks_table = NULL; |
1185 |
+ |
1186 |
++ kfree(smu_table->gpu_metrics_table); |
1187 |
++ smu_table->gpu_metrics_table = NULL; |
1188 |
++ |
1189 |
+ return 0; |
1190 |
+ } |
1191 |
+ |
1192 |
+diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c |
1193 |
+index a0e50f23b1dd7..8d4aa16b2ae7c 100644 |
1194 |
+--- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c |
1195 |
++++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c |
1196 |
+@@ -197,6 +197,7 @@ int smu_v13_0_check_fw_status(struct smu_context *smu) |
1197 |
+ |
1198 |
+ int smu_v13_0_check_fw_version(struct smu_context *smu) |
1199 |
+ { |
1200 |
++ struct amdgpu_device *adev = smu->adev; |
1201 |
+ uint32_t if_version = 0xff, smu_version = 0xff; |
1202 |
+ uint16_t smu_major; |
1203 |
+ uint8_t smu_minor, smu_debug; |
1204 |
+@@ -209,6 +210,8 @@ int smu_v13_0_check_fw_version(struct smu_context *smu) |
1205 |
+ smu_major = (smu_version >> 16) & 0xffff; |
1206 |
+ smu_minor = (smu_version >> 8) & 0xff; |
1207 |
+ smu_debug = (smu_version >> 0) & 0xff; |
1208 |
++ if (smu->is_apu) |
1209 |
++ adev->pm.fw_version = smu_version; |
1210 |
+ |
1211 |
+ switch (smu->adev->asic_type) { |
1212 |
+ case CHIP_ALDEBARAN: |
1213 |
+diff --git a/drivers/gpu/drm/ast/ast_mode.c b/drivers/gpu/drm/ast/ast_mode.c |
1214 |
+index 1e30eaeb0e1b3..d5c98f79d58d3 100644 |
1215 |
+--- a/drivers/gpu/drm/ast/ast_mode.c |
1216 |
++++ b/drivers/gpu/drm/ast/ast_mode.c |
1217 |
+@@ -1121,7 +1121,10 @@ static void ast_crtc_reset(struct drm_crtc *crtc) |
1218 |
+ if (crtc->state) |
1219 |
+ crtc->funcs->atomic_destroy_state(crtc, crtc->state); |
1220 |
+ |
1221 |
+- __drm_atomic_helper_crtc_reset(crtc, &ast_state->base); |
1222 |
++ if (ast_state) |
1223 |
++ __drm_atomic_helper_crtc_reset(crtc, &ast_state->base); |
1224 |
++ else |
1225 |
++ __drm_atomic_helper_crtc_reset(crtc, NULL); |
1226 |
+ } |
1227 |
+ |
1228 |
+ static struct drm_crtc_state * |
1229 |
+diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c |
1230 |
+index 8e7a124d6c5a3..22bf690910b25 100644 |
1231 |
+--- a/drivers/gpu/drm/drm_fb_helper.c |
1232 |
++++ b/drivers/gpu/drm/drm_fb_helper.c |
1233 |
+@@ -1743,7 +1743,13 @@ void drm_fb_helper_fill_info(struct fb_info *info, |
1234 |
+ sizes->fb_width, sizes->fb_height); |
1235 |
+ |
1236 |
+ info->par = fb_helper; |
1237 |
+- snprintf(info->fix.id, sizeof(info->fix.id), "%s", |
1238 |
++ /* |
1239 |
++ * The DRM drivers fbdev emulation device name can be confusing if the |
1240 |
++ * driver name also has a "drm" suffix on it. Leading to names such as |
1241 |
++ * "simpledrmdrmfb" in /proc/fb. Unfortunately, it's an uAPI and can't |
1242 |
++ * be changed due user-space tools (e.g: pm-utils) matching against it. |
1243 |
++ */ |
1244 |
++ snprintf(info->fix.id, sizeof(info->fix.id), "%sdrmfb", |
1245 |
+ fb_helper->dev->driver->name); |
1246 |
+ |
1247 |
+ } |
1248 |
+diff --git a/drivers/gpu/drm/i915/display/g4x_hdmi.c b/drivers/gpu/drm/i915/display/g4x_hdmi.c |
1249 |
+index be352e9f0afc1..63baaf6988ade 100644 |
1250 |
+--- a/drivers/gpu/drm/i915/display/g4x_hdmi.c |
1251 |
++++ b/drivers/gpu/drm/i915/display/g4x_hdmi.c |
1252 |
+@@ -584,6 +584,7 @@ void g4x_hdmi_init(struct drm_i915_private *dev_priv, |
1253 |
+ else |
1254 |
+ intel_encoder->enable = g4x_enable_hdmi; |
1255 |
+ } |
1256 |
++ intel_encoder->shutdown = intel_hdmi_encoder_shutdown; |
1257 |
+ |
1258 |
+ intel_encoder->type = INTEL_OUTPUT_HDMI; |
1259 |
+ intel_encoder->power_domain = intel_port_to_power_domain(port); |
1260 |
+diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c b/drivers/gpu/drm/i915/display/intel_ddi.c |
1261 |
+index bd184325d0c75..82e5064b4ce7b 100644 |
1262 |
+--- a/drivers/gpu/drm/i915/display/intel_ddi.c |
1263 |
++++ b/drivers/gpu/drm/i915/display/intel_ddi.c |
1264 |
+@@ -4432,6 +4432,7 @@ static void intel_ddi_encoder_shutdown(struct intel_encoder *encoder) |
1265 |
+ enum phy phy = intel_port_to_phy(i915, encoder->port); |
1266 |
+ |
1267 |
+ intel_dp_encoder_shutdown(encoder); |
1268 |
++ intel_hdmi_encoder_shutdown(encoder); |
1269 |
+ |
1270 |
+ if (!intel_phy_is_tc(i915, phy)) |
1271 |
+ return; |
1272 |
+diff --git a/drivers/gpu/drm/i915/display/intel_dmc.c b/drivers/gpu/drm/i915/display/intel_dmc.c |
1273 |
+index b3c8e1c450efb..73076737add75 100644 |
1274 |
+--- a/drivers/gpu/drm/i915/display/intel_dmc.c |
1275 |
++++ b/drivers/gpu/drm/i915/display/intel_dmc.c |
1276 |
+@@ -606,7 +606,7 @@ static void parse_dmc_fw(struct drm_i915_private *dev_priv, |
1277 |
+ continue; |
1278 |
+ |
1279 |
+ offset = readcount + dmc->dmc_info[id].dmc_offset * 4; |
1280 |
+- if (fw->size - offset < 0) { |
1281 |
++ if (offset > fw->size) { |
1282 |
+ drm_err(&dev_priv->drm, "Reading beyond the fw_size\n"); |
1283 |
+ continue; |
1284 |
+ } |
1285 |
+diff --git a/drivers/gpu/drm/i915/display/intel_hdmi.c b/drivers/gpu/drm/i915/display/intel_hdmi.c |
1286 |
+index b04685bb6439c..c3787512295dd 100644 |
1287 |
+--- a/drivers/gpu/drm/i915/display/intel_hdmi.c |
1288 |
++++ b/drivers/gpu/drm/i915/display/intel_hdmi.c |
1289 |
+@@ -53,21 +53,20 @@ |
1290 |
+ #include "intel_panel.h" |
1291 |
+ #include "intel_snps_phy.h" |
1292 |
+ |
1293 |
+-static struct drm_device *intel_hdmi_to_dev(struct intel_hdmi *intel_hdmi) |
1294 |
++static struct drm_i915_private *intel_hdmi_to_i915(struct intel_hdmi *intel_hdmi) |
1295 |
+ { |
1296 |
+- return hdmi_to_dig_port(intel_hdmi)->base.base.dev; |
1297 |
++ return to_i915(hdmi_to_dig_port(intel_hdmi)->base.base.dev); |
1298 |
+ } |
1299 |
+ |
1300 |
+ static void |
1301 |
+ assert_hdmi_port_disabled(struct intel_hdmi *intel_hdmi) |
1302 |
+ { |
1303 |
+- struct drm_device *dev = intel_hdmi_to_dev(intel_hdmi); |
1304 |
+- struct drm_i915_private *dev_priv = to_i915(dev); |
1305 |
++ struct drm_i915_private *dev_priv = intel_hdmi_to_i915(intel_hdmi); |
1306 |
+ u32 enabled_bits; |
1307 |
+ |
1308 |
+ enabled_bits = HAS_DDI(dev_priv) ? DDI_BUF_CTL_ENABLE : SDVO_ENABLE; |
1309 |
+ |
1310 |
+- drm_WARN(dev, |
1311 |
++ drm_WARN(&dev_priv->drm, |
1312 |
+ intel_de_read(dev_priv, intel_hdmi->hdmi_reg) & enabled_bits, |
1313 |
+ "HDMI port enabled, expecting disabled\n"); |
1314 |
+ } |
1315 |
+@@ -1246,13 +1245,14 @@ static void hsw_set_infoframes(struct intel_encoder *encoder, |
1316 |
+ |
1317 |
+ void intel_dp_dual_mode_set_tmds_output(struct intel_hdmi *hdmi, bool enable) |
1318 |
+ { |
1319 |
+- struct drm_i915_private *dev_priv = to_i915(intel_hdmi_to_dev(hdmi)); |
1320 |
+- struct i2c_adapter *adapter = |
1321 |
+- intel_gmbus_get_adapter(dev_priv, hdmi->ddc_bus); |
1322 |
++ struct drm_i915_private *dev_priv = intel_hdmi_to_i915(hdmi); |
1323 |
++ struct i2c_adapter *adapter; |
1324 |
+ |
1325 |
+ if (hdmi->dp_dual_mode.type < DRM_DP_DUAL_MODE_TYPE2_DVI) |
1326 |
+ return; |
1327 |
+ |
1328 |
++ adapter = intel_gmbus_get_adapter(dev_priv, hdmi->ddc_bus); |
1329 |
++ |
1330 |
+ drm_dbg_kms(&dev_priv->drm, "%s DP dual mode adaptor TMDS output\n", |
1331 |
+ enable ? "Enabling" : "Disabling"); |
1332 |
+ |
1333 |
+@@ -1830,7 +1830,7 @@ hdmi_port_clock_valid(struct intel_hdmi *hdmi, |
1334 |
+ int clock, bool respect_downstream_limits, |
1335 |
+ bool has_hdmi_sink) |
1336 |
+ { |
1337 |
+- struct drm_i915_private *dev_priv = to_i915(intel_hdmi_to_dev(hdmi)); |
1338 |
++ struct drm_i915_private *dev_priv = intel_hdmi_to_i915(hdmi); |
1339 |
+ |
1340 |
+ if (clock < 25000) |
1341 |
+ return MODE_CLOCK_LOW; |
1342 |
+@@ -1946,8 +1946,7 @@ intel_hdmi_mode_valid(struct drm_connector *connector, |
1343 |
+ struct drm_display_mode *mode) |
1344 |
+ { |
1345 |
+ struct intel_hdmi *hdmi = intel_attached_hdmi(to_intel_connector(connector)); |
1346 |
+- struct drm_device *dev = intel_hdmi_to_dev(hdmi); |
1347 |
+- struct drm_i915_private *dev_priv = to_i915(dev); |
1348 |
++ struct drm_i915_private *dev_priv = intel_hdmi_to_i915(hdmi); |
1349 |
+ enum drm_mode_status status; |
1350 |
+ int clock = mode->clock; |
1351 |
+ int max_dotclk = to_i915(connector->dev)->max_dotclk_freq; |
1352 |
+@@ -2260,6 +2259,17 @@ int intel_hdmi_compute_config(struct intel_encoder *encoder, |
1353 |
+ return 0; |
1354 |
+ } |
1355 |
+ |
1356 |
++void intel_hdmi_encoder_shutdown(struct intel_encoder *encoder) |
1357 |
++{ |
1358 |
++ struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(encoder); |
1359 |
++ |
1360 |
++ /* |
1361 |
++ * Give a hand to buggy BIOSen which forget to turn |
1362 |
++ * the TMDS output buffers back on after a reboot. |
1363 |
++ */ |
1364 |
++ intel_dp_dual_mode_set_tmds_output(intel_hdmi, true); |
1365 |
++} |
1366 |
++ |
1367 |
+ static void |
1368 |
+ intel_hdmi_unset_edid(struct drm_connector *connector) |
1369 |
+ { |
1370 |
+diff --git a/drivers/gpu/drm/i915/display/intel_hdmi.h b/drivers/gpu/drm/i915/display/intel_hdmi.h |
1371 |
+index b43a180d007e0..2bf440eb400ab 100644 |
1372 |
+--- a/drivers/gpu/drm/i915/display/intel_hdmi.h |
1373 |
++++ b/drivers/gpu/drm/i915/display/intel_hdmi.h |
1374 |
+@@ -28,6 +28,7 @@ void intel_hdmi_init_connector(struct intel_digital_port *dig_port, |
1375 |
+ int intel_hdmi_compute_config(struct intel_encoder *encoder, |
1376 |
+ struct intel_crtc_state *pipe_config, |
1377 |
+ struct drm_connector_state *conn_state); |
1378 |
++void intel_hdmi_encoder_shutdown(struct intel_encoder *encoder); |
1379 |
+ bool intel_hdmi_handle_sink_scrambling(struct intel_encoder *encoder, |
1380 |
+ struct drm_connector *connector, |
1381 |
+ bool high_tmds_clock_ratio, |
1382 |
+diff --git a/drivers/gpu/drm/tiny/simpledrm.c b/drivers/gpu/drm/tiny/simpledrm.c |
1383 |
+index 481b48bde0473..5a6e89825bc2f 100644 |
1384 |
+--- a/drivers/gpu/drm/tiny/simpledrm.c |
1385 |
++++ b/drivers/gpu/drm/tiny/simpledrm.c |
1386 |
+@@ -458,7 +458,7 @@ static struct drm_display_mode simpledrm_mode(unsigned int width, |
1387 |
+ { |
1388 |
+ struct drm_display_mode mode = { SIMPLEDRM_MODE(width, height) }; |
1389 |
+ |
1390 |
+- mode.clock = 60 /* Hz */ * mode.hdisplay * mode.vdisplay; |
1391 |
++ mode.clock = mode.hdisplay * mode.vdisplay * 60 / 1000 /* kHz */; |
1392 |
+ drm_mode_set_name(&mode); |
1393 |
+ |
1394 |
+ return mode; |
1395 |
+diff --git a/drivers/md/persistent-data/dm-btree-remove.c b/drivers/md/persistent-data/dm-btree-remove.c |
1396 |
+index 70532335c7c7e..cb670f16e98e9 100644 |
1397 |
+--- a/drivers/md/persistent-data/dm-btree-remove.c |
1398 |
++++ b/drivers/md/persistent-data/dm-btree-remove.c |
1399 |
+@@ -423,9 +423,9 @@ static int rebalance_children(struct shadow_spine *s, |
1400 |
+ |
1401 |
+ memcpy(n, dm_block_data(child), |
1402 |
+ dm_bm_block_size(dm_tm_get_bm(info->tm))); |
1403 |
+- dm_tm_unlock(info->tm, child); |
1404 |
+ |
1405 |
+ dm_tm_dec(info->tm, dm_block_location(child)); |
1406 |
++ dm_tm_unlock(info->tm, child); |
1407 |
+ return 0; |
1408 |
+ } |
1409 |
+ |
1410 |
+diff --git a/drivers/media/usb/dvb-usb-v2/mxl111sf.c b/drivers/media/usb/dvb-usb-v2/mxl111sf.c |
1411 |
+index 7865fa0a82957..cd5861a30b6f8 100644 |
1412 |
+--- a/drivers/media/usb/dvb-usb-v2/mxl111sf.c |
1413 |
++++ b/drivers/media/usb/dvb-usb-v2/mxl111sf.c |
1414 |
+@@ -931,8 +931,6 @@ static int mxl111sf_init(struct dvb_usb_device *d) |
1415 |
+ .len = sizeof(eeprom), .buf = eeprom }, |
1416 |
+ }; |
1417 |
+ |
1418 |
+- mutex_init(&state->msg_lock); |
1419 |
+- |
1420 |
+ ret = get_chip_info(state); |
1421 |
+ if (mxl_fail(ret)) |
1422 |
+ pr_err("failed to get chip info during probe"); |
1423 |
+@@ -1074,6 +1072,14 @@ static int mxl111sf_get_stream_config_dvbt(struct dvb_frontend *fe, |
1424 |
+ return 0; |
1425 |
+ } |
1426 |
+ |
1427 |
++static int mxl111sf_probe(struct dvb_usb_device *dev) |
1428 |
++{ |
1429 |
++ struct mxl111sf_state *state = d_to_priv(dev); |
1430 |
++ |
1431 |
++ mutex_init(&state->msg_lock); |
1432 |
++ return 0; |
1433 |
++} |
1434 |
++ |
1435 |
+ static struct dvb_usb_device_properties mxl111sf_props_dvbt = { |
1436 |
+ .driver_name = KBUILD_MODNAME, |
1437 |
+ .owner = THIS_MODULE, |
1438 |
+@@ -1083,6 +1089,7 @@ static struct dvb_usb_device_properties mxl111sf_props_dvbt = { |
1439 |
+ .generic_bulk_ctrl_endpoint = 0x02, |
1440 |
+ .generic_bulk_ctrl_endpoint_response = 0x81, |
1441 |
+ |
1442 |
++ .probe = mxl111sf_probe, |
1443 |
+ .i2c_algo = &mxl111sf_i2c_algo, |
1444 |
+ .frontend_attach = mxl111sf_frontend_attach_dvbt, |
1445 |
+ .tuner_attach = mxl111sf_attach_tuner, |
1446 |
+@@ -1124,6 +1131,7 @@ static struct dvb_usb_device_properties mxl111sf_props_atsc = { |
1447 |
+ .generic_bulk_ctrl_endpoint = 0x02, |
1448 |
+ .generic_bulk_ctrl_endpoint_response = 0x81, |
1449 |
+ |
1450 |
++ .probe = mxl111sf_probe, |
1451 |
+ .i2c_algo = &mxl111sf_i2c_algo, |
1452 |
+ .frontend_attach = mxl111sf_frontend_attach_atsc, |
1453 |
+ .tuner_attach = mxl111sf_attach_tuner, |
1454 |
+@@ -1165,6 +1173,7 @@ static struct dvb_usb_device_properties mxl111sf_props_mh = { |
1455 |
+ .generic_bulk_ctrl_endpoint = 0x02, |
1456 |
+ .generic_bulk_ctrl_endpoint_response = 0x81, |
1457 |
+ |
1458 |
++ .probe = mxl111sf_probe, |
1459 |
+ .i2c_algo = &mxl111sf_i2c_algo, |
1460 |
+ .frontend_attach = mxl111sf_frontend_attach_mh, |
1461 |
+ .tuner_attach = mxl111sf_attach_tuner, |
1462 |
+@@ -1233,6 +1242,7 @@ static struct dvb_usb_device_properties mxl111sf_props_atsc_mh = { |
1463 |
+ .generic_bulk_ctrl_endpoint = 0x02, |
1464 |
+ .generic_bulk_ctrl_endpoint_response = 0x81, |
1465 |
+ |
1466 |
++ .probe = mxl111sf_probe, |
1467 |
+ .i2c_algo = &mxl111sf_i2c_algo, |
1468 |
+ .frontend_attach = mxl111sf_frontend_attach_atsc_mh, |
1469 |
+ .tuner_attach = mxl111sf_attach_tuner, |
1470 |
+@@ -1311,6 +1321,7 @@ static struct dvb_usb_device_properties mxl111sf_props_mercury = { |
1471 |
+ .generic_bulk_ctrl_endpoint = 0x02, |
1472 |
+ .generic_bulk_ctrl_endpoint_response = 0x81, |
1473 |
+ |
1474 |
++ .probe = mxl111sf_probe, |
1475 |
+ .i2c_algo = &mxl111sf_i2c_algo, |
1476 |
+ .frontend_attach = mxl111sf_frontend_attach_mercury, |
1477 |
+ .tuner_attach = mxl111sf_attach_tuner, |
1478 |
+@@ -1381,6 +1392,7 @@ static struct dvb_usb_device_properties mxl111sf_props_mercury_mh = { |
1479 |
+ .generic_bulk_ctrl_endpoint = 0x02, |
1480 |
+ .generic_bulk_ctrl_endpoint_response = 0x81, |
1481 |
+ |
1482 |
++ .probe = mxl111sf_probe, |
1483 |
+ .i2c_algo = &mxl111sf_i2c_algo, |
1484 |
+ .frontend_attach = mxl111sf_frontend_attach_mercury_mh, |
1485 |
+ .tuner_attach = mxl111sf_attach_tuner, |
1486 |
+diff --git a/drivers/net/can/m_can/m_can.c b/drivers/net/can/m_can/m_can.c |
1487 |
+index e330b4c121bf3..c2a8421e7845c 100644 |
1488 |
+--- a/drivers/net/can/m_can/m_can.c |
1489 |
++++ b/drivers/net/can/m_can/m_can.c |
1490 |
+@@ -1494,20 +1494,32 @@ static int m_can_dev_setup(struct m_can_classdev *cdev) |
1491 |
+ case 30: |
1492 |
+ /* CAN_CTRLMODE_FD_NON_ISO is fixed with M_CAN IP v3.0.x */ |
1493 |
+ can_set_static_ctrlmode(dev, CAN_CTRLMODE_FD_NON_ISO); |
1494 |
+- cdev->can.bittiming_const = &m_can_bittiming_const_30X; |
1495 |
+- cdev->can.data_bittiming_const = &m_can_data_bittiming_const_30X; |
1496 |
++ cdev->can.bittiming_const = cdev->bit_timing ? |
1497 |
++ cdev->bit_timing : &m_can_bittiming_const_30X; |
1498 |
++ |
1499 |
++ cdev->can.data_bittiming_const = cdev->data_timing ? |
1500 |
++ cdev->data_timing : |
1501 |
++ &m_can_data_bittiming_const_30X; |
1502 |
+ break; |
1503 |
+ case 31: |
1504 |
+ /* CAN_CTRLMODE_FD_NON_ISO is fixed with M_CAN IP v3.1.x */ |
1505 |
+ can_set_static_ctrlmode(dev, CAN_CTRLMODE_FD_NON_ISO); |
1506 |
+- cdev->can.bittiming_const = &m_can_bittiming_const_31X; |
1507 |
+- cdev->can.data_bittiming_const = &m_can_data_bittiming_const_31X; |
1508 |
++ cdev->can.bittiming_const = cdev->bit_timing ? |
1509 |
++ cdev->bit_timing : &m_can_bittiming_const_31X; |
1510 |
++ |
1511 |
++ cdev->can.data_bittiming_const = cdev->data_timing ? |
1512 |
++ cdev->data_timing : |
1513 |
++ &m_can_data_bittiming_const_31X; |
1514 |
+ break; |
1515 |
+ case 32: |
1516 |
+ case 33: |
1517 |
+ /* Support both MCAN version v3.2.x and v3.3.0 */ |
1518 |
+- cdev->can.bittiming_const = &m_can_bittiming_const_31X; |
1519 |
+- cdev->can.data_bittiming_const = &m_can_data_bittiming_const_31X; |
1520 |
++ cdev->can.bittiming_const = cdev->bit_timing ? |
1521 |
++ cdev->bit_timing : &m_can_bittiming_const_31X; |
1522 |
++ |
1523 |
++ cdev->can.data_bittiming_const = cdev->data_timing ? |
1524 |
++ cdev->data_timing : |
1525 |
++ &m_can_data_bittiming_const_31X; |
1526 |
+ |
1527 |
+ cdev->can.ctrlmode_supported |= |
1528 |
+ (m_can_niso_supported(cdev) ? |
1529 |
+diff --git a/drivers/net/can/m_can/m_can.h b/drivers/net/can/m_can/m_can.h |
1530 |
+index d18b515e6ccc7..2c5d409971686 100644 |
1531 |
+--- a/drivers/net/can/m_can/m_can.h |
1532 |
++++ b/drivers/net/can/m_can/m_can.h |
1533 |
+@@ -85,6 +85,9 @@ struct m_can_classdev { |
1534 |
+ struct sk_buff *tx_skb; |
1535 |
+ struct phy *transceiver; |
1536 |
+ |
1537 |
++ const struct can_bittiming_const *bit_timing; |
1538 |
++ const struct can_bittiming_const *data_timing; |
1539 |
++ |
1540 |
+ struct m_can_ops *ops; |
1541 |
+ |
1542 |
+ int version; |
1543 |
+diff --git a/drivers/net/can/m_can/m_can_pci.c b/drivers/net/can/m_can/m_can_pci.c |
1544 |
+index 8f184a852a0a7..b56a54d6c5a9c 100644 |
1545 |
+--- a/drivers/net/can/m_can/m_can_pci.c |
1546 |
++++ b/drivers/net/can/m_can/m_can_pci.c |
1547 |
+@@ -18,9 +18,14 @@ |
1548 |
+ |
1549 |
+ #define M_CAN_PCI_MMIO_BAR 0 |
1550 |
+ |
1551 |
+-#define M_CAN_CLOCK_FREQ_EHL 200000000 |
1552 |
+ #define CTL_CSR_INT_CTL_OFFSET 0x508 |
1553 |
+ |
1554 |
++struct m_can_pci_config { |
1555 |
++ const struct can_bittiming_const *bit_timing; |
1556 |
++ const struct can_bittiming_const *data_timing; |
1557 |
++ unsigned int clock_freq; |
1558 |
++}; |
1559 |
++ |
1560 |
+ struct m_can_pci_priv { |
1561 |
+ struct m_can_classdev cdev; |
1562 |
+ |
1563 |
+@@ -84,9 +89,40 @@ static struct m_can_ops m_can_pci_ops = { |
1564 |
+ .read_fifo = iomap_read_fifo, |
1565 |
+ }; |
1566 |
+ |
1567 |
++static const struct can_bittiming_const m_can_bittiming_const_ehl = { |
1568 |
++ .name = KBUILD_MODNAME, |
1569 |
++ .tseg1_min = 2, /* Time segment 1 = prop_seg + phase_seg1 */ |
1570 |
++ .tseg1_max = 64, |
1571 |
++ .tseg2_min = 1, /* Time segment 2 = phase_seg2 */ |
1572 |
++ .tseg2_max = 128, |
1573 |
++ .sjw_max = 128, |
1574 |
++ .brp_min = 1, |
1575 |
++ .brp_max = 512, |
1576 |
++ .brp_inc = 1, |
1577 |
++}; |
1578 |
++ |
1579 |
++static const struct can_bittiming_const m_can_data_bittiming_const_ehl = { |
1580 |
++ .name = KBUILD_MODNAME, |
1581 |
++ .tseg1_min = 2, /* Time segment 1 = prop_seg + phase_seg1 */ |
1582 |
++ .tseg1_max = 16, |
1583 |
++ .tseg2_min = 1, /* Time segment 2 = phase_seg2 */ |
1584 |
++ .tseg2_max = 8, |
1585 |
++ .sjw_max = 4, |
1586 |
++ .brp_min = 1, |
1587 |
++ .brp_max = 32, |
1588 |
++ .brp_inc = 1, |
1589 |
++}; |
1590 |
++ |
1591 |
++static const struct m_can_pci_config m_can_pci_ehl = { |
1592 |
++ .bit_timing = &m_can_bittiming_const_ehl, |
1593 |
++ .data_timing = &m_can_data_bittiming_const_ehl, |
1594 |
++ .clock_freq = 200000000, |
1595 |
++}; |
1596 |
++ |
1597 |
+ static int m_can_pci_probe(struct pci_dev *pci, const struct pci_device_id *id) |
1598 |
+ { |
1599 |
+ struct device *dev = &pci->dev; |
1600 |
++ const struct m_can_pci_config *cfg; |
1601 |
+ struct m_can_classdev *mcan_class; |
1602 |
+ struct m_can_pci_priv *priv; |
1603 |
+ void __iomem *base; |
1604 |
+@@ -114,6 +150,8 @@ static int m_can_pci_probe(struct pci_dev *pci, const struct pci_device_id *id) |
1605 |
+ if (!mcan_class) |
1606 |
+ return -ENOMEM; |
1607 |
+ |
1608 |
++ cfg = (const struct m_can_pci_config *)id->driver_data; |
1609 |
++ |
1610 |
+ priv = cdev_to_priv(mcan_class); |
1611 |
+ |
1612 |
+ priv->base = base; |
1613 |
+@@ -125,7 +163,9 @@ static int m_can_pci_probe(struct pci_dev *pci, const struct pci_device_id *id) |
1614 |
+ mcan_class->dev = &pci->dev; |
1615 |
+ mcan_class->net->irq = pci_irq_vector(pci, 0); |
1616 |
+ mcan_class->pm_clock_support = 1; |
1617 |
+- mcan_class->can.clock.freq = id->driver_data; |
1618 |
++ mcan_class->bit_timing = cfg->bit_timing; |
1619 |
++ mcan_class->data_timing = cfg->data_timing; |
1620 |
++ mcan_class->can.clock.freq = cfg->clock_freq; |
1621 |
+ mcan_class->ops = &m_can_pci_ops; |
1622 |
+ |
1623 |
+ pci_set_drvdata(pci, mcan_class); |
1624 |
+@@ -178,8 +218,8 @@ static SIMPLE_DEV_PM_OPS(m_can_pci_pm_ops, |
1625 |
+ m_can_pci_suspend, m_can_pci_resume); |
1626 |
+ |
1627 |
+ static const struct pci_device_id m_can_pci_id_table[] = { |
1628 |
+- { PCI_VDEVICE(INTEL, 0x4bc1), M_CAN_CLOCK_FREQ_EHL, }, |
1629 |
+- { PCI_VDEVICE(INTEL, 0x4bc2), M_CAN_CLOCK_FREQ_EHL, }, |
1630 |
++ { PCI_VDEVICE(INTEL, 0x4bc1), (kernel_ulong_t)&m_can_pci_ehl, }, |
1631 |
++ { PCI_VDEVICE(INTEL, 0x4bc2), (kernel_ulong_t)&m_can_pci_ehl, }, |
1632 |
+ { } /* Terminating Entry */ |
1633 |
+ }; |
1634 |
+ MODULE_DEVICE_TABLE(pci, m_can_pci_id_table); |
1635 |
+diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c |
1636 |
+index a31cc0ab7c625..43d126628610b 100644 |
1637 |
+--- a/drivers/net/dsa/mv88e6xxx/chip.c |
1638 |
++++ b/drivers/net/dsa/mv88e6xxx/chip.c |
1639 |
+@@ -769,6 +769,10 @@ static void mv88e6xxx_mac_link_down(struct dsa_switch *ds, int port, |
1640 |
+ if ((!mv88e6xxx_port_ppu_updates(chip, port) || |
1641 |
+ mode == MLO_AN_FIXED) && ops->port_sync_link) |
1642 |
+ err = ops->port_sync_link(chip, port, mode, false); |
1643 |
++ |
1644 |
++ if (!err && ops->port_set_speed_duplex) |
1645 |
++ err = ops->port_set_speed_duplex(chip, port, SPEED_UNFORCED, |
1646 |
++ DUPLEX_UNFORCED); |
1647 |
+ mv88e6xxx_reg_unlock(chip); |
1648 |
+ |
1649 |
+ if (err) |
1650 |
+diff --git a/drivers/net/dsa/mv88e6xxx/port.c b/drivers/net/dsa/mv88e6xxx/port.c |
1651 |
+index d9817b20ea641..ab41619a809b3 100644 |
1652 |
+--- a/drivers/net/dsa/mv88e6xxx/port.c |
1653 |
++++ b/drivers/net/dsa/mv88e6xxx/port.c |
1654 |
+@@ -283,7 +283,7 @@ static int mv88e6xxx_port_set_speed_duplex(struct mv88e6xxx_chip *chip, |
1655 |
+ if (err) |
1656 |
+ return err; |
1657 |
+ |
1658 |
+- if (speed) |
1659 |
++ if (speed != SPEED_UNFORCED) |
1660 |
+ dev_dbg(chip->dev, "p%d: Speed set to %d Mbps\n", port, speed); |
1661 |
+ else |
1662 |
+ dev_dbg(chip->dev, "p%d: Speed unforced\n", port); |
1663 |
+@@ -516,7 +516,7 @@ int mv88e6393x_port_set_speed_duplex(struct mv88e6xxx_chip *chip, int port, |
1664 |
+ if (err) |
1665 |
+ return err; |
1666 |
+ |
1667 |
+- if (speed) |
1668 |
++ if (speed != SPEED_UNFORCED) |
1669 |
+ dev_dbg(chip->dev, "p%d: Speed set to %d Mbps\n", port, speed); |
1670 |
+ else |
1671 |
+ dev_dbg(chip->dev, "p%d: Speed unforced\n", port); |
1672 |
+diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c |
1673 |
+index 7fa1b695400d7..0877b3d7f88c5 100644 |
1674 |
+--- a/drivers/net/ethernet/broadcom/bcmsysport.c |
1675 |
++++ b/drivers/net/ethernet/broadcom/bcmsysport.c |
1676 |
+@@ -1309,11 +1309,11 @@ static netdev_tx_t bcm_sysport_xmit(struct sk_buff *skb, |
1677 |
+ struct bcm_sysport_priv *priv = netdev_priv(dev); |
1678 |
+ struct device *kdev = &priv->pdev->dev; |
1679 |
+ struct bcm_sysport_tx_ring *ring; |
1680 |
++ unsigned long flags, desc_flags; |
1681 |
+ struct bcm_sysport_cb *cb; |
1682 |
+ struct netdev_queue *txq; |
1683 |
+ u32 len_status, addr_lo; |
1684 |
+ unsigned int skb_len; |
1685 |
+- unsigned long flags; |
1686 |
+ dma_addr_t mapping; |
1687 |
+ u16 queue; |
1688 |
+ int ret; |
1689 |
+@@ -1373,8 +1373,10 @@ static netdev_tx_t bcm_sysport_xmit(struct sk_buff *skb, |
1690 |
+ ring->desc_count--; |
1691 |
+ |
1692 |
+ /* Ports are latched, so write upper address first */ |
1693 |
++ spin_lock_irqsave(&priv->desc_lock, desc_flags); |
1694 |
+ tdma_writel(priv, len_status, TDMA_WRITE_PORT_HI(ring->index)); |
1695 |
+ tdma_writel(priv, addr_lo, TDMA_WRITE_PORT_LO(ring->index)); |
1696 |
++ spin_unlock_irqrestore(&priv->desc_lock, desc_flags); |
1697 |
+ |
1698 |
+ /* Check ring space and update SW control flow */ |
1699 |
+ if (ring->desc_count == 0) |
1700 |
+@@ -2013,6 +2015,7 @@ static int bcm_sysport_open(struct net_device *dev) |
1701 |
+ } |
1702 |
+ |
1703 |
+ /* Initialize both hardware and software ring */ |
1704 |
++ spin_lock_init(&priv->desc_lock); |
1705 |
+ for (i = 0; i < dev->num_tx_queues; i++) { |
1706 |
+ ret = bcm_sysport_init_tx_ring(priv, i); |
1707 |
+ if (ret) { |
1708 |
+diff --git a/drivers/net/ethernet/broadcom/bcmsysport.h b/drivers/net/ethernet/broadcom/bcmsysport.h |
1709 |
+index 984f76e74b43e..16b73bb9acc78 100644 |
1710 |
+--- a/drivers/net/ethernet/broadcom/bcmsysport.h |
1711 |
++++ b/drivers/net/ethernet/broadcom/bcmsysport.h |
1712 |
+@@ -711,6 +711,7 @@ struct bcm_sysport_priv { |
1713 |
+ int wol_irq; |
1714 |
+ |
1715 |
+ /* Transmit rings */ |
1716 |
++ spinlock_t desc_lock; |
1717 |
+ struct bcm_sysport_tx_ring *tx_rings; |
1718 |
+ |
1719 |
+ /* Receive queue */ |
1720 |
+diff --git a/drivers/net/ethernet/hisilicon/hns3/hnae3.h b/drivers/net/ethernet/hisilicon/hns3/hnae3.h |
1721 |
+index d701451596c82..47bba4c62f040 100644 |
1722 |
+--- a/drivers/net/ethernet/hisilicon/hns3/hnae3.h |
1723 |
++++ b/drivers/net/ethernet/hisilicon/hns3/hnae3.h |
1724 |
+@@ -830,6 +830,8 @@ struct hnae3_handle { |
1725 |
+ |
1726 |
+ u8 netdev_flags; |
1727 |
+ struct dentry *hnae3_dbgfs; |
1728 |
++ /* protects concurrent contention between debugfs commands */ |
1729 |
++ struct mutex dbgfs_lock; |
1730 |
+ |
1731 |
+ /* Network interface message level enabled bits */ |
1732 |
+ u32 msg_enable; |
1733 |
+diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c b/drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c |
1734 |
+index e54f96251fea9..3205849bdb95b 100644 |
1735 |
+--- a/drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c |
1736 |
++++ b/drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c |
1737 |
+@@ -1021,6 +1021,7 @@ static ssize_t hns3_dbg_read(struct file *filp, char __user *buffer, |
1738 |
+ if (ret) |
1739 |
+ return ret; |
1740 |
+ |
1741 |
++ mutex_lock(&handle->dbgfs_lock); |
1742 |
+ save_buf = &hns3_dbg_cmd[index].buf; |
1743 |
+ |
1744 |
+ if (!test_bit(HNS3_NIC_STATE_INITED, &priv->state) || |
1745 |
+@@ -1033,15 +1034,15 @@ static ssize_t hns3_dbg_read(struct file *filp, char __user *buffer, |
1746 |
+ read_buf = *save_buf; |
1747 |
+ } else { |
1748 |
+ read_buf = kvzalloc(hns3_dbg_cmd[index].buf_len, GFP_KERNEL); |
1749 |
+- if (!read_buf) |
1750 |
+- return -ENOMEM; |
1751 |
++ if (!read_buf) { |
1752 |
++ ret = -ENOMEM; |
1753 |
++ goto out; |
1754 |
++ } |
1755 |
+ |
1756 |
+ /* save the buffer addr until the last read operation */ |
1757 |
+ *save_buf = read_buf; |
1758 |
+- } |
1759 |
+ |
1760 |
+- /* get data ready for the first time to read */ |
1761 |
+- if (!*ppos) { |
1762 |
++ /* get data ready for the first time to read */ |
1763 |
+ ret = hns3_dbg_read_cmd(dbg_data, hns3_dbg_cmd[index].cmd, |
1764 |
+ read_buf, hns3_dbg_cmd[index].buf_len); |
1765 |
+ if (ret) |
1766 |
+@@ -1050,8 +1051,10 @@ static ssize_t hns3_dbg_read(struct file *filp, char __user *buffer, |
1767 |
+ |
1768 |
+ size = simple_read_from_buffer(buffer, count, ppos, read_buf, |
1769 |
+ strlen(read_buf)); |
1770 |
+- if (size > 0) |
1771 |
++ if (size > 0) { |
1772 |
++ mutex_unlock(&handle->dbgfs_lock); |
1773 |
+ return size; |
1774 |
++ } |
1775 |
+ |
1776 |
+ out: |
1777 |
+ /* free the buffer for the last read operation */ |
1778 |
+@@ -1060,6 +1063,7 @@ out: |
1779 |
+ *save_buf = NULL; |
1780 |
+ } |
1781 |
+ |
1782 |
++ mutex_unlock(&handle->dbgfs_lock); |
1783 |
+ return ret; |
1784 |
+ } |
1785 |
+ |
1786 |
+@@ -1132,6 +1136,8 @@ int hns3_dbg_init(struct hnae3_handle *handle) |
1787 |
+ debugfs_create_dir(hns3_dbg_dentry[i].name, |
1788 |
+ handle->hnae3_dbgfs); |
1789 |
+ |
1790 |
++ mutex_init(&handle->dbgfs_lock); |
1791 |
++ |
1792 |
+ for (i = 0; i < ARRAY_SIZE(hns3_dbg_cmd); i++) { |
1793 |
+ if ((hns3_dbg_cmd[i].cmd == HNAE3_DBG_CMD_TM_NODES && |
1794 |
+ ae_dev->dev_version <= HNAE3_DEVICE_VERSION_V2) || |
1795 |
+@@ -1158,6 +1164,7 @@ int hns3_dbg_init(struct hnae3_handle *handle) |
1796 |
+ return 0; |
1797 |
+ |
1798 |
+ out: |
1799 |
++ mutex_destroy(&handle->dbgfs_lock); |
1800 |
+ debugfs_remove_recursive(handle->hnae3_dbgfs); |
1801 |
+ handle->hnae3_dbgfs = NULL; |
1802 |
+ return ret; |
1803 |
+@@ -1173,6 +1180,7 @@ void hns3_dbg_uninit(struct hnae3_handle *handle) |
1804 |
+ hns3_dbg_cmd[i].buf = NULL; |
1805 |
+ } |
1806 |
+ |
1807 |
++ mutex_destroy(&handle->dbgfs_lock); |
1808 |
+ debugfs_remove_recursive(handle->hnae3_dbgfs); |
1809 |
+ handle->hnae3_dbgfs = NULL; |
1810 |
+ } |
1811 |
+diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_mbx.c b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_mbx.c |
1812 |
+index fdc66fae09601..c5ac6ecf36e10 100644 |
1813 |
+--- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_mbx.c |
1814 |
++++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_mbx.c |
1815 |
+@@ -114,7 +114,8 @@ int hclgevf_send_mbx_msg(struct hclgevf_dev *hdev, |
1816 |
+ |
1817 |
+ memcpy(&req->msg, send_msg, sizeof(struct hclge_vf_to_pf_msg)); |
1818 |
+ |
1819 |
+- trace_hclge_vf_mbx_send(hdev, req); |
1820 |
++ if (test_bit(HCLGEVF_STATE_NIC_REGISTERED, &hdev->state)) |
1821 |
++ trace_hclge_vf_mbx_send(hdev, req); |
1822 |
+ |
1823 |
+ /* synchronous send */ |
1824 |
+ if (need_resp) { |
1825 |
+diff --git a/drivers/net/ethernet/intel/ice/ice_ptp.c b/drivers/net/ethernet/intel/ice/ice_ptp.c |
1826 |
+index d1ef3d48a4b03..ac27a4fe8b94c 100644 |
1827 |
+--- a/drivers/net/ethernet/intel/ice/ice_ptp.c |
1828 |
++++ b/drivers/net/ethernet/intel/ice/ice_ptp.c |
1829 |
+@@ -459,7 +459,7 @@ static int ice_ptp_adjfine(struct ptp_clock_info *info, long scaled_ppm) |
1830 |
+ scaled_ppm = -scaled_ppm; |
1831 |
+ } |
1832 |
+ |
1833 |
+- while ((u64)scaled_ppm > div_u64(U64_MAX, incval)) { |
1834 |
++ while ((u64)scaled_ppm > div64_u64(U64_MAX, incval)) { |
1835 |
+ /* handle overflow by scaling down the scaled_ppm and |
1836 |
+ * the divisor, losing some precision |
1837 |
+ */ |
1838 |
+@@ -1182,19 +1182,16 @@ static void ice_ptp_tx_tstamp_work(struct kthread_work *work) |
1839 |
+ if (err) |
1840 |
+ continue; |
1841 |
+ |
1842 |
+- /* Check if the timestamp is valid */ |
1843 |
+- if (!(raw_tstamp & ICE_PTP_TS_VALID)) |
1844 |
++ /* Check if the timestamp is invalid or stale */ |
1845 |
++ if (!(raw_tstamp & ICE_PTP_TS_VALID) || |
1846 |
++ raw_tstamp == tx->tstamps[idx].cached_tstamp) |
1847 |
+ continue; |
1848 |
+ |
1849 |
+- /* clear the timestamp register, so that it won't show valid |
1850 |
+- * again when re-used. |
1851 |
+- */ |
1852 |
+- ice_clear_phy_tstamp(hw, tx->quad, phy_idx); |
1853 |
+- |
1854 |
+ /* The timestamp is valid, so we'll go ahead and clear this |
1855 |
+ * index and then send the timestamp up to the stack. |
1856 |
+ */ |
1857 |
+ spin_lock(&tx->lock); |
1858 |
++ tx->tstamps[idx].cached_tstamp = raw_tstamp; |
1859 |
+ clear_bit(idx, tx->in_use); |
1860 |
+ skb = tx->tstamps[idx].skb; |
1861 |
+ tx->tstamps[idx].skb = NULL; |
1862 |
+diff --git a/drivers/net/ethernet/intel/ice/ice_ptp.h b/drivers/net/ethernet/intel/ice/ice_ptp.h |
1863 |
+index e1c787bd5b967..8cdd6f7046b73 100644 |
1864 |
+--- a/drivers/net/ethernet/intel/ice/ice_ptp.h |
1865 |
++++ b/drivers/net/ethernet/intel/ice/ice_ptp.h |
1866 |
+@@ -46,15 +46,21 @@ struct ice_perout_channel { |
1867 |
+ * struct ice_tx_tstamp - Tracking for a single Tx timestamp |
1868 |
+ * @skb: pointer to the SKB for this timestamp request |
1869 |
+ * @start: jiffies when the timestamp was first requested |
1870 |
++ * @cached_tstamp: last read timestamp |
1871 |
+ * |
1872 |
+ * This structure tracks a single timestamp request. The SKB pointer is |
1873 |
+ * provided when initiating a request. The start time is used to ensure that |
1874 |
+ * we discard old requests that were not fulfilled within a 2 second time |
1875 |
+ * window. |
1876 |
++ * Timestamp values in the PHY are read only and do not get cleared except at |
1877 |
++ * hardware reset or when a new timestamp value is captured. The cached_tstamp |
1878 |
++ * field is used to detect the case where a new timestamp has not yet been |
1879 |
++ * captured, ensuring that we avoid sending stale timestamp data to the stack. |
1880 |
+ */ |
1881 |
+ struct ice_tx_tstamp { |
1882 |
+ struct sk_buff *skb; |
1883 |
+ unsigned long start; |
1884 |
++ u64 cached_tstamp; |
1885 |
+ }; |
1886 |
+ |
1887 |
+ /** |
1888 |
+diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c |
1889 |
+index 8f30577386b6f..533199d819501 100644 |
1890 |
+--- a/drivers/net/ethernet/intel/igb/igb_main.c |
1891 |
++++ b/drivers/net/ethernet/intel/igb/igb_main.c |
1892 |
+@@ -7641,6 +7641,20 @@ static int igb_set_vf_mac_filter(struct igb_adapter *adapter, const int vf, |
1893 |
+ struct vf_mac_filter *entry = NULL; |
1894 |
+ int ret = 0; |
1895 |
+ |
1896 |
++ if ((vf_data->flags & IGB_VF_FLAG_PF_SET_MAC) && |
1897 |
++ !vf_data->trusted) { |
1898 |
++ dev_warn(&pdev->dev, |
1899 |
++ "VF %d requested MAC filter but is administratively denied\n", |
1900 |
++ vf); |
1901 |
++ return -EINVAL; |
1902 |
++ } |
1903 |
++ if (!is_valid_ether_addr(addr)) { |
1904 |
++ dev_warn(&pdev->dev, |
1905 |
++ "VF %d attempted to set invalid MAC filter\n", |
1906 |
++ vf); |
1907 |
++ return -EINVAL; |
1908 |
++ } |
1909 |
++ |
1910 |
+ switch (info) { |
1911 |
+ case E1000_VF_MAC_FILTER_CLR: |
1912 |
+ /* remove all unicast MAC filters related to the current VF */ |
1913 |
+@@ -7654,20 +7668,6 @@ static int igb_set_vf_mac_filter(struct igb_adapter *adapter, const int vf, |
1914 |
+ } |
1915 |
+ break; |
1916 |
+ case E1000_VF_MAC_FILTER_ADD: |
1917 |
+- if ((vf_data->flags & IGB_VF_FLAG_PF_SET_MAC) && |
1918 |
+- !vf_data->trusted) { |
1919 |
+- dev_warn(&pdev->dev, |
1920 |
+- "VF %d requested MAC filter but is administratively denied\n", |
1921 |
+- vf); |
1922 |
+- return -EINVAL; |
1923 |
+- } |
1924 |
+- if (!is_valid_ether_addr(addr)) { |
1925 |
+- dev_warn(&pdev->dev, |
1926 |
+- "VF %d attempted to set invalid MAC filter\n", |
1927 |
+- vf); |
1928 |
+- return -EINVAL; |
1929 |
+- } |
1930 |
+- |
1931 |
+ /* try to find empty slot in the list */ |
1932 |
+ list_for_each(pos, &adapter->vf_macs.l) { |
1933 |
+ entry = list_entry(pos, struct vf_mac_filter, l); |
1934 |
+diff --git a/drivers/net/ethernet/intel/igbvf/netdev.c b/drivers/net/ethernet/intel/igbvf/netdev.c |
1935 |
+index d32e72d953c8d..d051918dfdff9 100644 |
1936 |
+--- a/drivers/net/ethernet/intel/igbvf/netdev.c |
1937 |
++++ b/drivers/net/ethernet/intel/igbvf/netdev.c |
1938 |
+@@ -2861,6 +2861,7 @@ static int igbvf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) |
1939 |
+ return 0; |
1940 |
+ |
1941 |
+ err_hw_init: |
1942 |
++ netif_napi_del(&adapter->rx_ring->napi); |
1943 |
+ kfree(adapter->tx_ring); |
1944 |
+ kfree(adapter->rx_ring); |
1945 |
+ err_sw_init: |
1946 |
+diff --git a/drivers/net/ethernet/intel/igc/igc_i225.c b/drivers/net/ethernet/intel/igc/igc_i225.c |
1947 |
+index b2ef9fde97b38..b6807e16eea93 100644 |
1948 |
+--- a/drivers/net/ethernet/intel/igc/igc_i225.c |
1949 |
++++ b/drivers/net/ethernet/intel/igc/igc_i225.c |
1950 |
+@@ -636,7 +636,7 @@ s32 igc_set_ltr_i225(struct igc_hw *hw, bool link) |
1951 |
+ ltrv = rd32(IGC_LTRMAXV); |
1952 |
+ if (ltr_max != (ltrv & IGC_LTRMAXV_LTRV_MASK)) { |
1953 |
+ ltrv = IGC_LTRMAXV_LSNP_REQ | ltr_max | |
1954 |
+- (scale_min << IGC_LTRMAXV_SCALE_SHIFT); |
1955 |
++ (scale_max << IGC_LTRMAXV_SCALE_SHIFT); |
1956 |
+ wr32(IGC_LTRMAXV, ltrv); |
1957 |
+ } |
1958 |
+ } |
1959 |
+diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c |
1960 |
+index 13c4782b920a7..750b02bb2fdc2 100644 |
1961 |
+--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c |
1962 |
++++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c |
1963 |
+@@ -5526,6 +5526,10 @@ static int ixgbe_non_sfp_link_config(struct ixgbe_hw *hw) |
1964 |
+ if (!speed && hw->mac.ops.get_link_capabilities) { |
1965 |
+ ret = hw->mac.ops.get_link_capabilities(hw, &speed, |
1966 |
+ &autoneg); |
1967 |
++ /* remove NBASE-T speeds from default autonegotiation |
1968 |
++ * to accommodate broken network switches in the field |
1969 |
++ * which cannot cope with advertised NBASE-T speeds |
1970 |
++ */ |
1971 |
+ speed &= ~(IXGBE_LINK_SPEED_5GB_FULL | |
1972 |
+ IXGBE_LINK_SPEED_2_5GB_FULL); |
1973 |
+ } |
1974 |
+diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c |
1975 |
+index 9724ffb165189..e4b50c7781ffa 100644 |
1976 |
+--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c |
1977 |
++++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c |
1978 |
+@@ -3405,6 +3405,9 @@ static s32 ixgbe_reset_hw_X550em(struct ixgbe_hw *hw) |
1979 |
+ /* flush pending Tx transactions */ |
1980 |
+ ixgbe_clear_tx_pending(hw); |
1981 |
+ |
1982 |
++ /* set MDIO speed before talking to the PHY in case it's the 1st time */ |
1983 |
++ ixgbe_set_mdio_speed(hw); |
1984 |
++ |
1985 |
+ /* PHY ops must be identified and initialized prior to reset */ |
1986 |
+ status = hw->phy.ops.init(hw); |
1987 |
+ if (status == IXGBE_ERR_SFP_NOT_SUPPORTED || |
1988 |
+diff --git a/drivers/net/ethernet/sfc/ef100_nic.c b/drivers/net/ethernet/sfc/ef100_nic.c |
1989 |
+index 518268ce20644..d35cafd422b1c 100644 |
1990 |
+--- a/drivers/net/ethernet/sfc/ef100_nic.c |
1991 |
++++ b/drivers/net/ethernet/sfc/ef100_nic.c |
1992 |
+@@ -609,6 +609,9 @@ static size_t ef100_update_stats(struct efx_nic *efx, |
1993 |
+ ef100_common_stat_mask(mask); |
1994 |
+ ef100_ethtool_stat_mask(mask); |
1995 |
+ |
1996 |
++ if (!mc_stats) |
1997 |
++ return 0; |
1998 |
++ |
1999 |
+ efx_nic_copy_stats(efx, mc_stats); |
2000 |
+ efx_nic_update_stats(ef100_stat_desc, EF100_STAT_COUNT, mask, |
2001 |
+ stats, mc_stats, false); |
2002 |
+diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c |
2003 |
+index 6924a6aacbd53..c469abc91fa1b 100644 |
2004 |
+--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c |
2005 |
++++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c |
2006 |
+@@ -33,6 +33,7 @@ struct rk_gmac_ops { |
2007 |
+ void (*set_rgmii_speed)(struct rk_priv_data *bsp_priv, int speed); |
2008 |
+ void (*set_rmii_speed)(struct rk_priv_data *bsp_priv, int speed); |
2009 |
+ void (*integrated_phy_powerup)(struct rk_priv_data *bsp_priv); |
2010 |
++ bool regs_valid; |
2011 |
+ u32 regs[]; |
2012 |
+ }; |
2013 |
+ |
2014 |
+@@ -1092,6 +1093,7 @@ static const struct rk_gmac_ops rk3568_ops = { |
2015 |
+ .set_to_rmii = rk3568_set_to_rmii, |
2016 |
+ .set_rgmii_speed = rk3568_set_gmac_speed, |
2017 |
+ .set_rmii_speed = rk3568_set_gmac_speed, |
2018 |
++ .regs_valid = true, |
2019 |
+ .regs = { |
2020 |
+ 0xfe2a0000, /* gmac0 */ |
2021 |
+ 0xfe010000, /* gmac1 */ |
2022 |
+@@ -1383,7 +1385,7 @@ static struct rk_priv_data *rk_gmac_setup(struct platform_device *pdev, |
2023 |
+ * to be distinguished. |
2024 |
+ */ |
2025 |
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
2026 |
+- if (res) { |
2027 |
++ if (res && ops->regs_valid) { |
2028 |
+ int i = 0; |
2029 |
+ |
2030 |
+ while (ops->regs[i]) { |
2031 |
+diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h |
2032 |
+index 5f129733aabd2..873b9e3e5da25 100644 |
2033 |
+--- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h |
2034 |
++++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h |
2035 |
+@@ -172,6 +172,19 @@ struct stmmac_flow_entry { |
2036 |
+ int is_l4; |
2037 |
+ }; |
2038 |
+ |
2039 |
++/* Rx Frame Steering */ |
2040 |
++enum stmmac_rfs_type { |
2041 |
++ STMMAC_RFS_T_VLAN, |
2042 |
++ STMMAC_RFS_T_MAX, |
2043 |
++}; |
2044 |
++ |
2045 |
++struct stmmac_rfs_entry { |
2046 |
++ unsigned long cookie; |
2047 |
++ int in_use; |
2048 |
++ int type; |
2049 |
++ int tc; |
2050 |
++}; |
2051 |
++ |
2052 |
+ struct stmmac_priv { |
2053 |
+ /* Frequently used values are kept adjacent for cache effect */ |
2054 |
+ u32 tx_coal_frames[MTL_MAX_TX_QUEUES]; |
2055 |
+@@ -289,6 +302,10 @@ struct stmmac_priv { |
2056 |
+ struct stmmac_tc_entry *tc_entries; |
2057 |
+ unsigned int flow_entries_max; |
2058 |
+ struct stmmac_flow_entry *flow_entries; |
2059 |
++ unsigned int rfs_entries_max[STMMAC_RFS_T_MAX]; |
2060 |
++ unsigned int rfs_entries_cnt[STMMAC_RFS_T_MAX]; |
2061 |
++ unsigned int rfs_entries_total; |
2062 |
++ struct stmmac_rfs_entry *rfs_entries; |
2063 |
+ |
2064 |
+ /* Pulse Per Second output */ |
2065 |
+ struct stmmac_pps_cfg pps[STMMAC_PPS_MAX]; |
2066 |
+diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c |
2067 |
+index 1c4ea0b1b845b..d0a2b289f4603 100644 |
2068 |
+--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c |
2069 |
++++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c |
2070 |
+@@ -232,11 +232,33 @@ static int tc_setup_cls_u32(struct stmmac_priv *priv, |
2071 |
+ } |
2072 |
+ } |
2073 |
+ |
2074 |
++static int tc_rfs_init(struct stmmac_priv *priv) |
2075 |
++{ |
2076 |
++ int i; |
2077 |
++ |
2078 |
++ priv->rfs_entries_max[STMMAC_RFS_T_VLAN] = 8; |
2079 |
++ |
2080 |
++ for (i = 0; i < STMMAC_RFS_T_MAX; i++) |
2081 |
++ priv->rfs_entries_total += priv->rfs_entries_max[i]; |
2082 |
++ |
2083 |
++ priv->rfs_entries = devm_kcalloc(priv->device, |
2084 |
++ priv->rfs_entries_total, |
2085 |
++ sizeof(*priv->rfs_entries), |
2086 |
++ GFP_KERNEL); |
2087 |
++ if (!priv->rfs_entries) |
2088 |
++ return -ENOMEM; |
2089 |
++ |
2090 |
++ dev_info(priv->device, "Enabled RFS Flow TC (entries=%d)\n", |
2091 |
++ priv->rfs_entries_total); |
2092 |
++ |
2093 |
++ return 0; |
2094 |
++} |
2095 |
++ |
2096 |
+ static int tc_init(struct stmmac_priv *priv) |
2097 |
+ { |
2098 |
+ struct dma_features *dma_cap = &priv->dma_cap; |
2099 |
+ unsigned int count; |
2100 |
+- int i; |
2101 |
++ int ret, i; |
2102 |
+ |
2103 |
+ if (dma_cap->l3l4fnum) { |
2104 |
+ priv->flow_entries_max = dma_cap->l3l4fnum; |
2105 |
+@@ -250,10 +272,14 @@ static int tc_init(struct stmmac_priv *priv) |
2106 |
+ for (i = 0; i < priv->flow_entries_max; i++) |
2107 |
+ priv->flow_entries[i].idx = i; |
2108 |
+ |
2109 |
+- dev_info(priv->device, "Enabled Flow TC (entries=%d)\n", |
2110 |
++ dev_info(priv->device, "Enabled L3L4 Flow TC (entries=%d)\n", |
2111 |
+ priv->flow_entries_max); |
2112 |
+ } |
2113 |
+ |
2114 |
++ ret = tc_rfs_init(priv); |
2115 |
++ if (ret) |
2116 |
++ return -ENOMEM; |
2117 |
++ |
2118 |
+ if (!priv->plat->fpe_cfg) { |
2119 |
+ priv->plat->fpe_cfg = devm_kzalloc(priv->device, |
2120 |
+ sizeof(*priv->plat->fpe_cfg), |
2121 |
+@@ -607,16 +633,45 @@ static int tc_del_flow(struct stmmac_priv *priv, |
2122 |
+ return ret; |
2123 |
+ } |
2124 |
+ |
2125 |
++static struct stmmac_rfs_entry *tc_find_rfs(struct stmmac_priv *priv, |
2126 |
++ struct flow_cls_offload *cls, |
2127 |
++ bool get_free) |
2128 |
++{ |
2129 |
++ int i; |
2130 |
++ |
2131 |
++ for (i = 0; i < priv->rfs_entries_total; i++) { |
2132 |
++ struct stmmac_rfs_entry *entry = &priv->rfs_entries[i]; |
2133 |
++ |
2134 |
++ if (entry->cookie == cls->cookie) |
2135 |
++ return entry; |
2136 |
++ if (get_free && entry->in_use == false) |
2137 |
++ return entry; |
2138 |
++ } |
2139 |
++ |
2140 |
++ return NULL; |
2141 |
++} |
2142 |
++ |
2143 |
+ #define VLAN_PRIO_FULL_MASK (0x07) |
2144 |
+ |
2145 |
+ static int tc_add_vlan_flow(struct stmmac_priv *priv, |
2146 |
+ struct flow_cls_offload *cls) |
2147 |
+ { |
2148 |
++ struct stmmac_rfs_entry *entry = tc_find_rfs(priv, cls, false); |
2149 |
+ struct flow_rule *rule = flow_cls_offload_flow_rule(cls); |
2150 |
+ struct flow_dissector *dissector = rule->match.dissector; |
2151 |
+ int tc = tc_classid_to_hwtc(priv->dev, cls->classid); |
2152 |
+ struct flow_match_vlan match; |
2153 |
+ |
2154 |
++ if (!entry) { |
2155 |
++ entry = tc_find_rfs(priv, cls, true); |
2156 |
++ if (!entry) |
2157 |
++ return -ENOENT; |
2158 |
++ } |
2159 |
++ |
2160 |
++ if (priv->rfs_entries_cnt[STMMAC_RFS_T_VLAN] >= |
2161 |
++ priv->rfs_entries_max[STMMAC_RFS_T_VLAN]) |
2162 |
++ return -ENOENT; |
2163 |
++ |
2164 |
+ /* Nothing to do here */ |
2165 |
+ if (!dissector_uses_key(dissector, FLOW_DISSECTOR_KEY_VLAN)) |
2166 |
+ return -EINVAL; |
2167 |
+@@ -638,6 +693,12 @@ static int tc_add_vlan_flow(struct stmmac_priv *priv, |
2168 |
+ |
2169 |
+ prio = BIT(match.key->vlan_priority); |
2170 |
+ stmmac_rx_queue_prio(priv, priv->hw, prio, tc); |
2171 |
++ |
2172 |
++ entry->in_use = true; |
2173 |
++ entry->cookie = cls->cookie; |
2174 |
++ entry->tc = tc; |
2175 |
++ entry->type = STMMAC_RFS_T_VLAN; |
2176 |
++ priv->rfs_entries_cnt[STMMAC_RFS_T_VLAN]++; |
2177 |
+ } |
2178 |
+ |
2179 |
+ return 0; |
2180 |
+@@ -646,20 +707,19 @@ static int tc_add_vlan_flow(struct stmmac_priv *priv, |
2181 |
+ static int tc_del_vlan_flow(struct stmmac_priv *priv, |
2182 |
+ struct flow_cls_offload *cls) |
2183 |
+ { |
2184 |
+- struct flow_rule *rule = flow_cls_offload_flow_rule(cls); |
2185 |
+- struct flow_dissector *dissector = rule->match.dissector; |
2186 |
+- int tc = tc_classid_to_hwtc(priv->dev, cls->classid); |
2187 |
++ struct stmmac_rfs_entry *entry = tc_find_rfs(priv, cls, false); |
2188 |
+ |
2189 |
+- /* Nothing to do here */ |
2190 |
+- if (!dissector_uses_key(dissector, FLOW_DISSECTOR_KEY_VLAN)) |
2191 |
+- return -EINVAL; |
2192 |
++ if (!entry || !entry->in_use || entry->type != STMMAC_RFS_T_VLAN) |
2193 |
++ return -ENOENT; |
2194 |
+ |
2195 |
+- if (tc < 0) { |
2196 |
+- netdev_err(priv->dev, "Invalid traffic class\n"); |
2197 |
+- return -EINVAL; |
2198 |
+- } |
2199 |
++ stmmac_rx_queue_prio(priv, priv->hw, 0, entry->tc); |
2200 |
++ |
2201 |
++ entry->in_use = false; |
2202 |
++ entry->cookie = 0; |
2203 |
++ entry->tc = 0; |
2204 |
++ entry->type = 0; |
2205 |
+ |
2206 |
+- stmmac_rx_queue_prio(priv, priv->hw, 0, tc); |
2207 |
++ priv->rfs_entries_cnt[STMMAC_RFS_T_VLAN]--; |
2208 |
+ |
2209 |
+ return 0; |
2210 |
+ } |
2211 |
+diff --git a/drivers/net/netdevsim/bpf.c b/drivers/net/netdevsim/bpf.c |
2212 |
+index 90aafb56f1409..a438202129323 100644 |
2213 |
+--- a/drivers/net/netdevsim/bpf.c |
2214 |
++++ b/drivers/net/netdevsim/bpf.c |
2215 |
+@@ -514,6 +514,7 @@ nsim_bpf_map_alloc(struct netdevsim *ns, struct bpf_offloaded_map *offmap) |
2216 |
+ goto err_free; |
2217 |
+ key = nmap->entry[i].key; |
2218 |
+ *key = i; |
2219 |
++ memset(nmap->entry[i].value, 0, offmap->map.value_size); |
2220 |
+ } |
2221 |
+ } |
2222 |
+ |
2223 |
+diff --git a/drivers/net/netdevsim/ethtool.c b/drivers/net/netdevsim/ethtool.c |
2224 |
+index b03a0513eb7e7..2e7c1cc16cb93 100644 |
2225 |
+--- a/drivers/net/netdevsim/ethtool.c |
2226 |
++++ b/drivers/net/netdevsim/ethtool.c |
2227 |
+@@ -77,7 +77,10 @@ static int nsim_set_ringparam(struct net_device *dev, |
2228 |
+ { |
2229 |
+ struct netdevsim *ns = netdev_priv(dev); |
2230 |
+ |
2231 |
+- memcpy(&ns->ethtool.ring, ring, sizeof(ns->ethtool.ring)); |
2232 |
++ ns->ethtool.ring.rx_pending = ring->rx_pending; |
2233 |
++ ns->ethtool.ring.rx_jumbo_pending = ring->rx_jumbo_pending; |
2234 |
++ ns->ethtool.ring.rx_mini_pending = ring->rx_mini_pending; |
2235 |
++ ns->ethtool.ring.tx_pending = ring->tx_pending; |
2236 |
+ return 0; |
2237 |
+ } |
2238 |
+ |
2239 |
+diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/tx.c b/drivers/net/wireless/intel/iwlwifi/mvm/tx.c |
2240 |
+index 0a13c2bda2eed..06fbd9ab37dfe 100644 |
2241 |
+--- a/drivers/net/wireless/intel/iwlwifi/mvm/tx.c |
2242 |
++++ b/drivers/net/wireless/intel/iwlwifi/mvm/tx.c |
2243 |
+@@ -268,17 +268,18 @@ static u32 iwl_mvm_get_tx_rate(struct iwl_mvm *mvm, |
2244 |
+ int rate_idx = -1; |
2245 |
+ u8 rate_plcp; |
2246 |
+ u32 rate_flags = 0; |
2247 |
+- struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta); |
2248 |
+ |
2249 |
+ /* info->control is only relevant for non HW rate control */ |
2250 |
+ if (!ieee80211_hw_check(mvm->hw, HAS_RATE_CONTROL)) { |
2251 |
++ struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta); |
2252 |
++ |
2253 |
+ /* HT rate doesn't make sense for a non data frame */ |
2254 |
+ WARN_ONCE(info->control.rates[0].flags & IEEE80211_TX_RC_MCS && |
2255 |
+ !ieee80211_is_data(fc), |
2256 |
+ "Got a HT rate (flags:0x%x/mcs:%d/fc:0x%x/state:%d) for a non data frame\n", |
2257 |
+ info->control.rates[0].flags, |
2258 |
+ info->control.rates[0].idx, |
2259 |
+- le16_to_cpu(fc), mvmsta->sta_state); |
2260 |
++ le16_to_cpu(fc), sta ? mvmsta->sta_state : -1); |
2261 |
+ |
2262 |
+ rate_idx = info->control.rates[0].idx; |
2263 |
+ } |
2264 |
+diff --git a/drivers/net/xen-netback/common.h b/drivers/net/xen-netback/common.h |
2265 |
+index 4a16d6e33c093..d9dea4829c86e 100644 |
2266 |
+--- a/drivers/net/xen-netback/common.h |
2267 |
++++ b/drivers/net/xen-netback/common.h |
2268 |
+@@ -203,6 +203,7 @@ struct xenvif_queue { /* Per-queue data for xenvif */ |
2269 |
+ unsigned int rx_queue_max; |
2270 |
+ unsigned int rx_queue_len; |
2271 |
+ unsigned long last_rx_time; |
2272 |
++ unsigned int rx_slots_needed; |
2273 |
+ bool stalled; |
2274 |
+ |
2275 |
+ struct xenvif_copy_state rx_copy; |
2276 |
+diff --git a/drivers/net/xen-netback/rx.c b/drivers/net/xen-netback/rx.c |
2277 |
+index accc991d153f7..dbac4c03d21a1 100644 |
2278 |
+--- a/drivers/net/xen-netback/rx.c |
2279 |
++++ b/drivers/net/xen-netback/rx.c |
2280 |
+@@ -33,28 +33,36 @@ |
2281 |
+ #include <xen/xen.h> |
2282 |
+ #include <xen/events.h> |
2283 |
+ |
2284 |
+-static bool xenvif_rx_ring_slots_available(struct xenvif_queue *queue) |
2285 |
++/* |
2286 |
++ * Update the needed ring page slots for the first SKB queued. |
2287 |
++ * Note that any call sequence outside the RX thread calling this function |
2288 |
++ * needs to wake up the RX thread via a call of xenvif_kick_thread() |
2289 |
++ * afterwards in order to avoid a race with putting the thread to sleep. |
2290 |
++ */ |
2291 |
++static void xenvif_update_needed_slots(struct xenvif_queue *queue, |
2292 |
++ const struct sk_buff *skb) |
2293 |
+ { |
2294 |
+- RING_IDX prod, cons; |
2295 |
+- struct sk_buff *skb; |
2296 |
+- int needed; |
2297 |
+- unsigned long flags; |
2298 |
+- |
2299 |
+- spin_lock_irqsave(&queue->rx_queue.lock, flags); |
2300 |
++ unsigned int needed = 0; |
2301 |
+ |
2302 |
+- skb = skb_peek(&queue->rx_queue); |
2303 |
+- if (!skb) { |
2304 |
+- spin_unlock_irqrestore(&queue->rx_queue.lock, flags); |
2305 |
+- return false; |
2306 |
++ if (skb) { |
2307 |
++ needed = DIV_ROUND_UP(skb->len, XEN_PAGE_SIZE); |
2308 |
++ if (skb_is_gso(skb)) |
2309 |
++ needed++; |
2310 |
++ if (skb->sw_hash) |
2311 |
++ needed++; |
2312 |
+ } |
2313 |
+ |
2314 |
+- needed = DIV_ROUND_UP(skb->len, XEN_PAGE_SIZE); |
2315 |
+- if (skb_is_gso(skb)) |
2316 |
+- needed++; |
2317 |
+- if (skb->sw_hash) |
2318 |
+- needed++; |
2319 |
++ WRITE_ONCE(queue->rx_slots_needed, needed); |
2320 |
++} |
2321 |
+ |
2322 |
+- spin_unlock_irqrestore(&queue->rx_queue.lock, flags); |
2323 |
++static bool xenvif_rx_ring_slots_available(struct xenvif_queue *queue) |
2324 |
++{ |
2325 |
++ RING_IDX prod, cons; |
2326 |
++ unsigned int needed; |
2327 |
++ |
2328 |
++ needed = READ_ONCE(queue->rx_slots_needed); |
2329 |
++ if (!needed) |
2330 |
++ return false; |
2331 |
+ |
2332 |
+ do { |
2333 |
+ prod = queue->rx.sring->req_prod; |
2334 |
+@@ -80,13 +88,19 @@ void xenvif_rx_queue_tail(struct xenvif_queue *queue, struct sk_buff *skb) |
2335 |
+ |
2336 |
+ spin_lock_irqsave(&queue->rx_queue.lock, flags); |
2337 |
+ |
2338 |
+- __skb_queue_tail(&queue->rx_queue, skb); |
2339 |
+- |
2340 |
+- queue->rx_queue_len += skb->len; |
2341 |
+- if (queue->rx_queue_len > queue->rx_queue_max) { |
2342 |
++ if (queue->rx_queue_len >= queue->rx_queue_max) { |
2343 |
+ struct net_device *dev = queue->vif->dev; |
2344 |
+ |
2345 |
+ netif_tx_stop_queue(netdev_get_tx_queue(dev, queue->id)); |
2346 |
++ kfree_skb(skb); |
2347 |
++ queue->vif->dev->stats.rx_dropped++; |
2348 |
++ } else { |
2349 |
++ if (skb_queue_empty(&queue->rx_queue)) |
2350 |
++ xenvif_update_needed_slots(queue, skb); |
2351 |
++ |
2352 |
++ __skb_queue_tail(&queue->rx_queue, skb); |
2353 |
++ |
2354 |
++ queue->rx_queue_len += skb->len; |
2355 |
+ } |
2356 |
+ |
2357 |
+ spin_unlock_irqrestore(&queue->rx_queue.lock, flags); |
2358 |
+@@ -100,6 +114,8 @@ static struct sk_buff *xenvif_rx_dequeue(struct xenvif_queue *queue) |
2359 |
+ |
2360 |
+ skb = __skb_dequeue(&queue->rx_queue); |
2361 |
+ if (skb) { |
2362 |
++ xenvif_update_needed_slots(queue, skb_peek(&queue->rx_queue)); |
2363 |
++ |
2364 |
+ queue->rx_queue_len -= skb->len; |
2365 |
+ if (queue->rx_queue_len < queue->rx_queue_max) { |
2366 |
+ struct netdev_queue *txq; |
2367 |
+@@ -134,6 +150,7 @@ static void xenvif_rx_queue_drop_expired(struct xenvif_queue *queue) |
2368 |
+ break; |
2369 |
+ xenvif_rx_dequeue(queue); |
2370 |
+ kfree_skb(skb); |
2371 |
++ queue->vif->dev->stats.rx_dropped++; |
2372 |
+ } |
2373 |
+ } |
2374 |
+ |
2375 |
+@@ -487,27 +504,31 @@ void xenvif_rx_action(struct xenvif_queue *queue) |
2376 |
+ xenvif_rx_copy_flush(queue); |
2377 |
+ } |
2378 |
+ |
2379 |
+-static bool xenvif_rx_queue_stalled(struct xenvif_queue *queue) |
2380 |
++static RING_IDX xenvif_rx_queue_slots(const struct xenvif_queue *queue) |
2381 |
+ { |
2382 |
+ RING_IDX prod, cons; |
2383 |
+ |
2384 |
+ prod = queue->rx.sring->req_prod; |
2385 |
+ cons = queue->rx.req_cons; |
2386 |
+ |
2387 |
++ return prod - cons; |
2388 |
++} |
2389 |
++ |
2390 |
++static bool xenvif_rx_queue_stalled(const struct xenvif_queue *queue) |
2391 |
++{ |
2392 |
++ unsigned int needed = READ_ONCE(queue->rx_slots_needed); |
2393 |
++ |
2394 |
+ return !queue->stalled && |
2395 |
+- prod - cons < 1 && |
2396 |
++ xenvif_rx_queue_slots(queue) < needed && |
2397 |
+ time_after(jiffies, |
2398 |
+ queue->last_rx_time + queue->vif->stall_timeout); |
2399 |
+ } |
2400 |
+ |
2401 |
+ static bool xenvif_rx_queue_ready(struct xenvif_queue *queue) |
2402 |
+ { |
2403 |
+- RING_IDX prod, cons; |
2404 |
+- |
2405 |
+- prod = queue->rx.sring->req_prod; |
2406 |
+- cons = queue->rx.req_cons; |
2407 |
++ unsigned int needed = READ_ONCE(queue->rx_slots_needed); |
2408 |
+ |
2409 |
+- return queue->stalled && prod - cons >= 1; |
2410 |
++ return queue->stalled && xenvif_rx_queue_slots(queue) >= needed; |
2411 |
+ } |
2412 |
+ |
2413 |
+ bool xenvif_have_rx_work(struct xenvif_queue *queue, bool test_kthread) |
2414 |
+diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c |
2415 |
+index fc41ba95f81d0..8126e08f11a99 100644 |
2416 |
+--- a/drivers/net/xen-netfront.c |
2417 |
++++ b/drivers/net/xen-netfront.c |
2418 |
+@@ -148,6 +148,9 @@ struct netfront_queue { |
2419 |
+ grant_ref_t gref_rx_head; |
2420 |
+ grant_ref_t grant_rx_ref[NET_RX_RING_SIZE]; |
2421 |
+ |
2422 |
++ unsigned int rx_rsp_unconsumed; |
2423 |
++ spinlock_t rx_cons_lock; |
2424 |
++ |
2425 |
+ struct page_pool *page_pool; |
2426 |
+ struct xdp_rxq_info xdp_rxq; |
2427 |
+ }; |
2428 |
+@@ -376,12 +379,13 @@ static int xennet_open(struct net_device *dev) |
2429 |
+ return 0; |
2430 |
+ } |
2431 |
+ |
2432 |
+-static void xennet_tx_buf_gc(struct netfront_queue *queue) |
2433 |
++static bool xennet_tx_buf_gc(struct netfront_queue *queue) |
2434 |
+ { |
2435 |
+ RING_IDX cons, prod; |
2436 |
+ unsigned short id; |
2437 |
+ struct sk_buff *skb; |
2438 |
+ bool more_to_do; |
2439 |
++ bool work_done = false; |
2440 |
+ const struct device *dev = &queue->info->netdev->dev; |
2441 |
+ |
2442 |
+ BUG_ON(!netif_carrier_ok(queue->info->netdev)); |
2443 |
+@@ -398,6 +402,8 @@ static void xennet_tx_buf_gc(struct netfront_queue *queue) |
2444 |
+ for (cons = queue->tx.rsp_cons; cons != prod; cons++) { |
2445 |
+ struct xen_netif_tx_response txrsp; |
2446 |
+ |
2447 |
++ work_done = true; |
2448 |
++ |
2449 |
+ RING_COPY_RESPONSE(&queue->tx, cons, &txrsp); |
2450 |
+ if (txrsp.status == XEN_NETIF_RSP_NULL) |
2451 |
+ continue; |
2452 |
+@@ -441,11 +447,13 @@ static void xennet_tx_buf_gc(struct netfront_queue *queue) |
2453 |
+ |
2454 |
+ xennet_maybe_wake_tx(queue); |
2455 |
+ |
2456 |
+- return; |
2457 |
++ return work_done; |
2458 |
+ |
2459 |
+ err: |
2460 |
+ queue->info->broken = true; |
2461 |
+ dev_alert(dev, "Disabled for further use\n"); |
2462 |
++ |
2463 |
++ return work_done; |
2464 |
+ } |
2465 |
+ |
2466 |
+ struct xennet_gnttab_make_txreq { |
2467 |
+@@ -834,6 +842,16 @@ static int xennet_close(struct net_device *dev) |
2468 |
+ return 0; |
2469 |
+ } |
2470 |
+ |
2471 |
++static void xennet_set_rx_rsp_cons(struct netfront_queue *queue, RING_IDX val) |
2472 |
++{ |
2473 |
++ unsigned long flags; |
2474 |
++ |
2475 |
++ spin_lock_irqsave(&queue->rx_cons_lock, flags); |
2476 |
++ queue->rx.rsp_cons = val; |
2477 |
++ queue->rx_rsp_unconsumed = RING_HAS_UNCONSUMED_RESPONSES(&queue->rx); |
2478 |
++ spin_unlock_irqrestore(&queue->rx_cons_lock, flags); |
2479 |
++} |
2480 |
++ |
2481 |
+ static void xennet_move_rx_slot(struct netfront_queue *queue, struct sk_buff *skb, |
2482 |
+ grant_ref_t ref) |
2483 |
+ { |
2484 |
+@@ -885,7 +903,7 @@ static int xennet_get_extras(struct netfront_queue *queue, |
2485 |
+ xennet_move_rx_slot(queue, skb, ref); |
2486 |
+ } while (extra.flags & XEN_NETIF_EXTRA_FLAG_MORE); |
2487 |
+ |
2488 |
+- queue->rx.rsp_cons = cons; |
2489 |
++ xennet_set_rx_rsp_cons(queue, cons); |
2490 |
+ return err; |
2491 |
+ } |
2492 |
+ |
2493 |
+@@ -1039,7 +1057,7 @@ next: |
2494 |
+ } |
2495 |
+ |
2496 |
+ if (unlikely(err)) |
2497 |
+- queue->rx.rsp_cons = cons + slots; |
2498 |
++ xennet_set_rx_rsp_cons(queue, cons + slots); |
2499 |
+ |
2500 |
+ return err; |
2501 |
+ } |
2502 |
+@@ -1093,7 +1111,8 @@ static int xennet_fill_frags(struct netfront_queue *queue, |
2503 |
+ __pskb_pull_tail(skb, pull_to - skb_headlen(skb)); |
2504 |
+ } |
2505 |
+ if (unlikely(skb_shinfo(skb)->nr_frags >= MAX_SKB_FRAGS)) { |
2506 |
+- queue->rx.rsp_cons = ++cons + skb_queue_len(list); |
2507 |
++ xennet_set_rx_rsp_cons(queue, |
2508 |
++ ++cons + skb_queue_len(list)); |
2509 |
+ kfree_skb(nskb); |
2510 |
+ return -ENOENT; |
2511 |
+ } |
2512 |
+@@ -1106,7 +1125,7 @@ static int xennet_fill_frags(struct netfront_queue *queue, |
2513 |
+ kfree_skb(nskb); |
2514 |
+ } |
2515 |
+ |
2516 |
+- queue->rx.rsp_cons = cons; |
2517 |
++ xennet_set_rx_rsp_cons(queue, cons); |
2518 |
+ |
2519 |
+ return 0; |
2520 |
+ } |
2521 |
+@@ -1229,7 +1248,9 @@ err: |
2522 |
+ |
2523 |
+ if (unlikely(xennet_set_skb_gso(skb, gso))) { |
2524 |
+ __skb_queue_head(&tmpq, skb); |
2525 |
+- queue->rx.rsp_cons += skb_queue_len(&tmpq); |
2526 |
++ xennet_set_rx_rsp_cons(queue, |
2527 |
++ queue->rx.rsp_cons + |
2528 |
++ skb_queue_len(&tmpq)); |
2529 |
+ goto err; |
2530 |
+ } |
2531 |
+ } |
2532 |
+@@ -1253,7 +1274,8 @@ err: |
2533 |
+ |
2534 |
+ __skb_queue_tail(&rxq, skb); |
2535 |
+ |
2536 |
+- i = ++queue->rx.rsp_cons; |
2537 |
++ i = queue->rx.rsp_cons + 1; |
2538 |
++ xennet_set_rx_rsp_cons(queue, i); |
2539 |
+ work_done++; |
2540 |
+ } |
2541 |
+ if (need_xdp_flush) |
2542 |
+@@ -1417,40 +1439,79 @@ static int xennet_set_features(struct net_device *dev, |
2543 |
+ return 0; |
2544 |
+ } |
2545 |
+ |
2546 |
+-static irqreturn_t xennet_tx_interrupt(int irq, void *dev_id) |
2547 |
++static bool xennet_handle_tx(struct netfront_queue *queue, unsigned int *eoi) |
2548 |
+ { |
2549 |
+- struct netfront_queue *queue = dev_id; |
2550 |
+ unsigned long flags; |
2551 |
+ |
2552 |
+- if (queue->info->broken) |
2553 |
+- return IRQ_HANDLED; |
2554 |
++ if (unlikely(queue->info->broken)) |
2555 |
++ return false; |
2556 |
+ |
2557 |
+ spin_lock_irqsave(&queue->tx_lock, flags); |
2558 |
+- xennet_tx_buf_gc(queue); |
2559 |
++ if (xennet_tx_buf_gc(queue)) |
2560 |
++ *eoi = 0; |
2561 |
+ spin_unlock_irqrestore(&queue->tx_lock, flags); |
2562 |
+ |
2563 |
++ return true; |
2564 |
++} |
2565 |
++ |
2566 |
++static irqreturn_t xennet_tx_interrupt(int irq, void *dev_id) |
2567 |
++{ |
2568 |
++ unsigned int eoiflag = XEN_EOI_FLAG_SPURIOUS; |
2569 |
++ |
2570 |
++ if (likely(xennet_handle_tx(dev_id, &eoiflag))) |
2571 |
++ xen_irq_lateeoi(irq, eoiflag); |
2572 |
++ |
2573 |
+ return IRQ_HANDLED; |
2574 |
+ } |
2575 |
+ |
2576 |
+-static irqreturn_t xennet_rx_interrupt(int irq, void *dev_id) |
2577 |
++static bool xennet_handle_rx(struct netfront_queue *queue, unsigned int *eoi) |
2578 |
+ { |
2579 |
+- struct netfront_queue *queue = dev_id; |
2580 |
+- struct net_device *dev = queue->info->netdev; |
2581 |
++ unsigned int work_queued; |
2582 |
++ unsigned long flags; |
2583 |
+ |
2584 |
+- if (queue->info->broken) |
2585 |
+- return IRQ_HANDLED; |
2586 |
++ if (unlikely(queue->info->broken)) |
2587 |
++ return false; |
2588 |
++ |
2589 |
++ spin_lock_irqsave(&queue->rx_cons_lock, flags); |
2590 |
++ work_queued = RING_HAS_UNCONSUMED_RESPONSES(&queue->rx); |
2591 |
++ if (work_queued > queue->rx_rsp_unconsumed) { |
2592 |
++ queue->rx_rsp_unconsumed = work_queued; |
2593 |
++ *eoi = 0; |
2594 |
++ } else if (unlikely(work_queued < queue->rx_rsp_unconsumed)) { |
2595 |
++ const struct device *dev = &queue->info->netdev->dev; |
2596 |
++ |
2597 |
++ spin_unlock_irqrestore(&queue->rx_cons_lock, flags); |
2598 |
++ dev_alert(dev, "RX producer index going backwards\n"); |
2599 |
++ dev_alert(dev, "Disabled for further use\n"); |
2600 |
++ queue->info->broken = true; |
2601 |
++ return false; |
2602 |
++ } |
2603 |
++ spin_unlock_irqrestore(&queue->rx_cons_lock, flags); |
2604 |
+ |
2605 |
+- if (likely(netif_carrier_ok(dev) && |
2606 |
+- RING_HAS_UNCONSUMED_RESPONSES(&queue->rx))) |
2607 |
++ if (likely(netif_carrier_ok(queue->info->netdev) && work_queued)) |
2608 |
+ napi_schedule(&queue->napi); |
2609 |
+ |
2610 |
++ return true; |
2611 |
++} |
2612 |
++ |
2613 |
++static irqreturn_t xennet_rx_interrupt(int irq, void *dev_id) |
2614 |
++{ |
2615 |
++ unsigned int eoiflag = XEN_EOI_FLAG_SPURIOUS; |
2616 |
++ |
2617 |
++ if (likely(xennet_handle_rx(dev_id, &eoiflag))) |
2618 |
++ xen_irq_lateeoi(irq, eoiflag); |
2619 |
++ |
2620 |
+ return IRQ_HANDLED; |
2621 |
+ } |
2622 |
+ |
2623 |
+ static irqreturn_t xennet_interrupt(int irq, void *dev_id) |
2624 |
+ { |
2625 |
+- xennet_tx_interrupt(irq, dev_id); |
2626 |
+- xennet_rx_interrupt(irq, dev_id); |
2627 |
++ unsigned int eoiflag = XEN_EOI_FLAG_SPURIOUS; |
2628 |
++ |
2629 |
++ if (xennet_handle_tx(dev_id, &eoiflag) && |
2630 |
++ xennet_handle_rx(dev_id, &eoiflag)) |
2631 |
++ xen_irq_lateeoi(irq, eoiflag); |
2632 |
++ |
2633 |
+ return IRQ_HANDLED; |
2634 |
+ } |
2635 |
+ |
2636 |
+@@ -1768,9 +1829,10 @@ static int setup_netfront_single(struct netfront_queue *queue) |
2637 |
+ if (err < 0) |
2638 |
+ goto fail; |
2639 |
+ |
2640 |
+- err = bind_evtchn_to_irqhandler(queue->tx_evtchn, |
2641 |
+- xennet_interrupt, |
2642 |
+- 0, queue->info->netdev->name, queue); |
2643 |
++ err = bind_evtchn_to_irqhandler_lateeoi(queue->tx_evtchn, |
2644 |
++ xennet_interrupt, 0, |
2645 |
++ queue->info->netdev->name, |
2646 |
++ queue); |
2647 |
+ if (err < 0) |
2648 |
+ goto bind_fail; |
2649 |
+ queue->rx_evtchn = queue->tx_evtchn; |
2650 |
+@@ -1798,18 +1860,18 @@ static int setup_netfront_split(struct netfront_queue *queue) |
2651 |
+ |
2652 |
+ snprintf(queue->tx_irq_name, sizeof(queue->tx_irq_name), |
2653 |
+ "%s-tx", queue->name); |
2654 |
+- err = bind_evtchn_to_irqhandler(queue->tx_evtchn, |
2655 |
+- xennet_tx_interrupt, |
2656 |
+- 0, queue->tx_irq_name, queue); |
2657 |
++ err = bind_evtchn_to_irqhandler_lateeoi(queue->tx_evtchn, |
2658 |
++ xennet_tx_interrupt, 0, |
2659 |
++ queue->tx_irq_name, queue); |
2660 |
+ if (err < 0) |
2661 |
+ goto bind_tx_fail; |
2662 |
+ queue->tx_irq = err; |
2663 |
+ |
2664 |
+ snprintf(queue->rx_irq_name, sizeof(queue->rx_irq_name), |
2665 |
+ "%s-rx", queue->name); |
2666 |
+- err = bind_evtchn_to_irqhandler(queue->rx_evtchn, |
2667 |
+- xennet_rx_interrupt, |
2668 |
+- 0, queue->rx_irq_name, queue); |
2669 |
++ err = bind_evtchn_to_irqhandler_lateeoi(queue->rx_evtchn, |
2670 |
++ xennet_rx_interrupt, 0, |
2671 |
++ queue->rx_irq_name, queue); |
2672 |
+ if (err < 0) |
2673 |
+ goto bind_rx_fail; |
2674 |
+ queue->rx_irq = err; |
2675 |
+@@ -1911,6 +1973,7 @@ static int xennet_init_queue(struct netfront_queue *queue) |
2676 |
+ |
2677 |
+ spin_lock_init(&queue->tx_lock); |
2678 |
+ spin_lock_init(&queue->rx_lock); |
2679 |
++ spin_lock_init(&queue->rx_cons_lock); |
2680 |
+ |
2681 |
+ timer_setup(&queue->rx_refill_timer, rx_refill_timeout, 0); |
2682 |
+ |
2683 |
+diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c |
2684 |
+index e2dedfa9072db..e11530cb05699 100644 |
2685 |
+--- a/drivers/pci/msi.c |
2686 |
++++ b/drivers/pci/msi.c |
2687 |
+@@ -721,9 +721,6 @@ static int msix_capability_init(struct pci_dev *dev, struct msix_entry *entries, |
2688 |
+ goto out_disable; |
2689 |
+ } |
2690 |
+ |
2691 |
+- /* Ensure that all table entries are masked. */ |
2692 |
+- msix_mask_all(base, tsize); |
2693 |
+- |
2694 |
+ ret = msix_setup_entries(dev, base, entries, nvec, affd); |
2695 |
+ if (ret) |
2696 |
+ goto out_disable; |
2697 |
+@@ -750,6 +747,16 @@ static int msix_capability_init(struct pci_dev *dev, struct msix_entry *entries, |
2698 |
+ /* Set MSI-X enabled bits and unmask the function */ |
2699 |
+ pci_intx_for_msi(dev, 0); |
2700 |
+ dev->msix_enabled = 1; |
2701 |
++ |
2702 |
++ /* |
2703 |
++ * Ensure that all table entries are masked to prevent |
2704 |
++ * stale entries from firing in a crash kernel. |
2705 |
++ * |
2706 |
++ * Done late to deal with a broken Marvell NVME device |
2707 |
++ * which takes the MSI-X mask bits into account even |
2708 |
++ * when MSI-X is disabled, which prevents MSI delivery. |
2709 |
++ */ |
2710 |
++ msix_mask_all(base, tsize); |
2711 |
+ pci_msix_clear_and_set_ctrl(dev, PCI_MSIX_FLAGS_MASKALL, 0); |
2712 |
+ |
2713 |
+ pcibios_free_irq(dev); |
2714 |
+@@ -776,7 +783,7 @@ out_free: |
2715 |
+ free_msi_irqs(dev); |
2716 |
+ |
2717 |
+ out_disable: |
2718 |
+- pci_msix_clear_and_set_ctrl(dev, PCI_MSIX_FLAGS_ENABLE, 0); |
2719 |
++ pci_msix_clear_and_set_ctrl(dev, PCI_MSIX_FLAGS_MASKALL | PCI_MSIX_FLAGS_ENABLE, 0); |
2720 |
+ |
2721 |
+ return ret; |
2722 |
+ } |
2723 |
+diff --git a/drivers/pinctrl/pinctrl-amd.c b/drivers/pinctrl/pinctrl-amd.c |
2724 |
+index bae9d429b813e..ecab9064a8458 100644 |
2725 |
+--- a/drivers/pinctrl/pinctrl-amd.c |
2726 |
++++ b/drivers/pinctrl/pinctrl-amd.c |
2727 |
+@@ -598,14 +598,14 @@ static struct irq_chip amd_gpio_irqchip = { |
2728 |
+ |
2729 |
+ #define PIN_IRQ_PENDING (BIT(INTERRUPT_STS_OFF) | BIT(WAKE_STS_OFF)) |
2730 |
+ |
2731 |
+-static irqreturn_t amd_gpio_irq_handler(int irq, void *dev_id) |
2732 |
++static bool do_amd_gpio_irq_handler(int irq, void *dev_id) |
2733 |
+ { |
2734 |
+ struct amd_gpio *gpio_dev = dev_id; |
2735 |
+ struct gpio_chip *gc = &gpio_dev->gc; |
2736 |
+- irqreturn_t ret = IRQ_NONE; |
2737 |
+ unsigned int i, irqnr; |
2738 |
+ unsigned long flags; |
2739 |
+ u32 __iomem *regs; |
2740 |
++ bool ret = false; |
2741 |
+ u32 regval; |
2742 |
+ u64 status, mask; |
2743 |
+ |
2744 |
+@@ -627,6 +627,14 @@ static irqreturn_t amd_gpio_irq_handler(int irq, void *dev_id) |
2745 |
+ /* Each status bit covers four pins */ |
2746 |
+ for (i = 0; i < 4; i++) { |
2747 |
+ regval = readl(regs + i); |
2748 |
++ /* caused wake on resume context for shared IRQ */ |
2749 |
++ if (irq < 0 && (regval & BIT(WAKE_STS_OFF))) { |
2750 |
++ dev_dbg(&gpio_dev->pdev->dev, |
2751 |
++ "Waking due to GPIO %d: 0x%x", |
2752 |
++ irqnr + i, regval); |
2753 |
++ return true; |
2754 |
++ } |
2755 |
++ |
2756 |
+ if (!(regval & PIN_IRQ_PENDING) || |
2757 |
+ !(regval & BIT(INTERRUPT_MASK_OFF))) |
2758 |
+ continue; |
2759 |
+@@ -650,9 +658,12 @@ static irqreturn_t amd_gpio_irq_handler(int irq, void *dev_id) |
2760 |
+ } |
2761 |
+ writel(regval, regs + i); |
2762 |
+ raw_spin_unlock_irqrestore(&gpio_dev->lock, flags); |
2763 |
+- ret = IRQ_HANDLED; |
2764 |
++ ret = true; |
2765 |
+ } |
2766 |
+ } |
2767 |
++ /* did not cause wake on resume context for shared IRQ */ |
2768 |
++ if (irq < 0) |
2769 |
++ return false; |
2770 |
+ |
2771 |
+ /* Signal EOI to the GPIO unit */ |
2772 |
+ raw_spin_lock_irqsave(&gpio_dev->lock, flags); |
2773 |
+@@ -664,6 +675,16 @@ static irqreturn_t amd_gpio_irq_handler(int irq, void *dev_id) |
2774 |
+ return ret; |
2775 |
+ } |
2776 |
+ |
2777 |
++static irqreturn_t amd_gpio_irq_handler(int irq, void *dev_id) |
2778 |
++{ |
2779 |
++ return IRQ_RETVAL(do_amd_gpio_irq_handler(irq, dev_id)); |
2780 |
++} |
2781 |
++ |
2782 |
++static bool __maybe_unused amd_gpio_check_wake(void *dev_id) |
2783 |
++{ |
2784 |
++ return do_amd_gpio_irq_handler(-1, dev_id); |
2785 |
++} |
2786 |
++ |
2787 |
+ static int amd_get_groups_count(struct pinctrl_dev *pctldev) |
2788 |
+ { |
2789 |
+ struct amd_gpio *gpio_dev = pinctrl_dev_get_drvdata(pctldev); |
2790 |
+@@ -1033,6 +1054,7 @@ static int amd_gpio_probe(struct platform_device *pdev) |
2791 |
+ goto out2; |
2792 |
+ |
2793 |
+ platform_set_drvdata(pdev, gpio_dev); |
2794 |
++ acpi_register_wakeup_handler(gpio_dev->irq, amd_gpio_check_wake, gpio_dev); |
2795 |
+ |
2796 |
+ dev_dbg(&pdev->dev, "amd gpio driver loaded\n"); |
2797 |
+ return ret; |
2798 |
+@@ -1050,6 +1072,7 @@ static int amd_gpio_remove(struct platform_device *pdev) |
2799 |
+ gpio_dev = platform_get_drvdata(pdev); |
2800 |
+ |
2801 |
+ gpiochip_remove(&gpio_dev->gc); |
2802 |
++ acpi_unregister_wakeup_handler(amd_gpio_check_wake, gpio_dev); |
2803 |
+ |
2804 |
+ return 0; |
2805 |
+ } |
2806 |
+diff --git a/drivers/reset/tegra/reset-bpmp.c b/drivers/reset/tegra/reset-bpmp.c |
2807 |
+index 4c5bba52b1059..24d3395964cc4 100644 |
2808 |
+--- a/drivers/reset/tegra/reset-bpmp.c |
2809 |
++++ b/drivers/reset/tegra/reset-bpmp.c |
2810 |
+@@ -20,7 +20,6 @@ static int tegra_bpmp_reset_common(struct reset_controller_dev *rstc, |
2811 |
+ struct tegra_bpmp *bpmp = to_tegra_bpmp(rstc); |
2812 |
+ struct mrq_reset_request request; |
2813 |
+ struct tegra_bpmp_message msg; |
2814 |
+- int err; |
2815 |
+ |
2816 |
+ memset(&request, 0, sizeof(request)); |
2817 |
+ request.cmd = command; |
2818 |
+@@ -31,13 +30,7 @@ static int tegra_bpmp_reset_common(struct reset_controller_dev *rstc, |
2819 |
+ msg.tx.data = &request; |
2820 |
+ msg.tx.size = sizeof(request); |
2821 |
+ |
2822 |
+- err = tegra_bpmp_transfer(bpmp, &msg); |
2823 |
+- if (err) |
2824 |
+- return err; |
2825 |
+- if (msg.rx.ret) |
2826 |
+- return -EINVAL; |
2827 |
+- |
2828 |
+- return 0; |
2829 |
++ return tegra_bpmp_transfer(bpmp, &msg); |
2830 |
+ } |
2831 |
+ |
2832 |
+ static int tegra_bpmp_reset_module(struct reset_controller_dev *rstc, |
2833 |
+diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c |
2834 |
+index 84d27938a3a60..cfeadd5f61f18 100644 |
2835 |
+--- a/drivers/scsi/scsi_debug.c |
2836 |
++++ b/drivers/scsi/scsi_debug.c |
2837 |
+@@ -1189,7 +1189,7 @@ static int p_fill_from_dev_buffer(struct scsi_cmnd *scp, const void *arr, |
2838 |
+ __func__, off_dst, scsi_bufflen(scp), act_len, |
2839 |
+ scsi_get_resid(scp)); |
2840 |
+ n = scsi_bufflen(scp) - (off_dst + act_len); |
2841 |
+- scsi_set_resid(scp, min_t(int, scsi_get_resid(scp), n)); |
2842 |
++ scsi_set_resid(scp, min_t(u32, scsi_get_resid(scp), n)); |
2843 |
+ return 0; |
2844 |
+ } |
2845 |
+ |
2846 |
+@@ -1562,7 +1562,8 @@ static int resp_inquiry(struct scsi_cmnd *scp, struct sdebug_dev_info *devip) |
2847 |
+ unsigned char pq_pdt; |
2848 |
+ unsigned char *arr; |
2849 |
+ unsigned char *cmd = scp->cmnd; |
2850 |
+- int alloc_len, n, ret; |
2851 |
++ u32 alloc_len, n; |
2852 |
++ int ret; |
2853 |
+ bool have_wlun, is_disk, is_zbc, is_disk_zbc; |
2854 |
+ |
2855 |
+ alloc_len = get_unaligned_be16(cmd + 3); |
2856 |
+@@ -1585,7 +1586,8 @@ static int resp_inquiry(struct scsi_cmnd *scp, struct sdebug_dev_info *devip) |
2857 |
+ kfree(arr); |
2858 |
+ return check_condition_result; |
2859 |
+ } else if (0x1 & cmd[1]) { /* EVPD bit set */ |
2860 |
+- int lu_id_num, port_group_id, target_dev_id, len; |
2861 |
++ int lu_id_num, port_group_id, target_dev_id; |
2862 |
++ u32 len; |
2863 |
+ char lu_id_str[6]; |
2864 |
+ int host_no = devip->sdbg_host->shost->host_no; |
2865 |
+ |
2866 |
+@@ -1676,9 +1678,9 @@ static int resp_inquiry(struct scsi_cmnd *scp, struct sdebug_dev_info *devip) |
2867 |
+ kfree(arr); |
2868 |
+ return check_condition_result; |
2869 |
+ } |
2870 |
+- len = min(get_unaligned_be16(arr + 2) + 4, alloc_len); |
2871 |
++ len = min_t(u32, get_unaligned_be16(arr + 2) + 4, alloc_len); |
2872 |
+ ret = fill_from_dev_buffer(scp, arr, |
2873 |
+- min(len, SDEBUG_MAX_INQ_ARR_SZ)); |
2874 |
++ min_t(u32, len, SDEBUG_MAX_INQ_ARR_SZ)); |
2875 |
+ kfree(arr); |
2876 |
+ return ret; |
2877 |
+ } |
2878 |
+@@ -1714,7 +1716,7 @@ static int resp_inquiry(struct scsi_cmnd *scp, struct sdebug_dev_info *devip) |
2879 |
+ } |
2880 |
+ put_unaligned_be16(0x2100, arr + n); /* SPL-4 no version claimed */ |
2881 |
+ ret = fill_from_dev_buffer(scp, arr, |
2882 |
+- min_t(int, alloc_len, SDEBUG_LONG_INQ_SZ)); |
2883 |
++ min_t(u32, alloc_len, SDEBUG_LONG_INQ_SZ)); |
2884 |
+ kfree(arr); |
2885 |
+ return ret; |
2886 |
+ } |
2887 |
+@@ -1729,8 +1731,8 @@ static int resp_requests(struct scsi_cmnd *scp, |
2888 |
+ unsigned char *cmd = scp->cmnd; |
2889 |
+ unsigned char arr[SCSI_SENSE_BUFFERSIZE]; /* assume >= 18 bytes */ |
2890 |
+ bool dsense = !!(cmd[1] & 1); |
2891 |
+- int alloc_len = cmd[4]; |
2892 |
+- int len = 18; |
2893 |
++ u32 alloc_len = cmd[4]; |
2894 |
++ u32 len = 18; |
2895 |
+ int stopped_state = atomic_read(&devip->stopped); |
2896 |
+ |
2897 |
+ memset(arr, 0, sizeof(arr)); |
2898 |
+@@ -1774,7 +1776,7 @@ static int resp_requests(struct scsi_cmnd *scp, |
2899 |
+ arr[7] = 0xa; |
2900 |
+ } |
2901 |
+ } |
2902 |
+- return fill_from_dev_buffer(scp, arr, min_t(int, len, alloc_len)); |
2903 |
++ return fill_from_dev_buffer(scp, arr, min_t(u32, len, alloc_len)); |
2904 |
+ } |
2905 |
+ |
2906 |
+ static int resp_start_stop(struct scsi_cmnd *scp, struct sdebug_dev_info *devip) |
2907 |
+@@ -2312,7 +2314,8 @@ static int resp_mode_sense(struct scsi_cmnd *scp, |
2908 |
+ { |
2909 |
+ int pcontrol, pcode, subpcode, bd_len; |
2910 |
+ unsigned char dev_spec; |
2911 |
+- int alloc_len, offset, len, target_dev_id; |
2912 |
++ u32 alloc_len, offset, len; |
2913 |
++ int target_dev_id; |
2914 |
+ int target = scp->device->id; |
2915 |
+ unsigned char *ap; |
2916 |
+ unsigned char arr[SDEBUG_MAX_MSENSE_SZ]; |
2917 |
+@@ -2468,7 +2471,7 @@ static int resp_mode_sense(struct scsi_cmnd *scp, |
2918 |
+ arr[0] = offset - 1; |
2919 |
+ else |
2920 |
+ put_unaligned_be16((offset - 2), arr + 0); |
2921 |
+- return fill_from_dev_buffer(scp, arr, min_t(int, alloc_len, offset)); |
2922 |
++ return fill_from_dev_buffer(scp, arr, min_t(u32, alloc_len, offset)); |
2923 |
+ } |
2924 |
+ |
2925 |
+ #define SDEBUG_MAX_MSELECT_SZ 512 |
2926 |
+@@ -2499,11 +2502,11 @@ static int resp_mode_select(struct scsi_cmnd *scp, |
2927 |
+ __func__, param_len, res); |
2928 |
+ md_len = mselect6 ? (arr[0] + 1) : (get_unaligned_be16(arr + 0) + 2); |
2929 |
+ bd_len = mselect6 ? arr[3] : get_unaligned_be16(arr + 6); |
2930 |
+- if (md_len > 2) { |
2931 |
++ off = bd_len + (mselect6 ? 4 : 8); |
2932 |
++ if (md_len > 2 || off >= res) { |
2933 |
+ mk_sense_invalid_fld(scp, SDEB_IN_DATA, 0, -1); |
2934 |
+ return check_condition_result; |
2935 |
+ } |
2936 |
+- off = bd_len + (mselect6 ? 4 : 8); |
2937 |
+ mpage = arr[off] & 0x3f; |
2938 |
+ ps = !!(arr[off] & 0x80); |
2939 |
+ if (ps) { |
2940 |
+@@ -2583,7 +2586,8 @@ static int resp_ie_l_pg(unsigned char *arr) |
2941 |
+ static int resp_log_sense(struct scsi_cmnd *scp, |
2942 |
+ struct sdebug_dev_info *devip) |
2943 |
+ { |
2944 |
+- int ppc, sp, pcode, subpcode, alloc_len, len, n; |
2945 |
++ int ppc, sp, pcode, subpcode; |
2946 |
++ u32 alloc_len, len, n; |
2947 |
+ unsigned char arr[SDEBUG_MAX_LSENSE_SZ]; |
2948 |
+ unsigned char *cmd = scp->cmnd; |
2949 |
+ |
2950 |
+@@ -2653,9 +2657,9 @@ static int resp_log_sense(struct scsi_cmnd *scp, |
2951 |
+ mk_sense_invalid_fld(scp, SDEB_IN_CDB, 3, -1); |
2952 |
+ return check_condition_result; |
2953 |
+ } |
2954 |
+- len = min_t(int, get_unaligned_be16(arr + 2) + 4, alloc_len); |
2955 |
++ len = min_t(u32, get_unaligned_be16(arr + 2) + 4, alloc_len); |
2956 |
+ return fill_from_dev_buffer(scp, arr, |
2957 |
+- min_t(int, len, SDEBUG_MAX_INQ_ARR_SZ)); |
2958 |
++ min_t(u32, len, SDEBUG_MAX_INQ_ARR_SZ)); |
2959 |
+ } |
2960 |
+ |
2961 |
+ static inline bool sdebug_dev_is_zoned(struct sdebug_dev_info *devip) |
2962 |
+@@ -4259,6 +4263,8 @@ static int resp_verify(struct scsi_cmnd *scp, struct sdebug_dev_info *devip) |
2963 |
+ mk_sense_invalid_opcode(scp); |
2964 |
+ return check_condition_result; |
2965 |
+ } |
2966 |
++ if (vnum == 0) |
2967 |
++ return 0; /* not an error */ |
2968 |
+ a_num = is_bytchk3 ? 1 : vnum; |
2969 |
+ /* Treat following check like one for read (i.e. no write) access */ |
2970 |
+ ret = check_device_access_params(scp, lba, a_num, false); |
2971 |
+@@ -4322,6 +4328,8 @@ static int resp_report_zones(struct scsi_cmnd *scp, |
2972 |
+ } |
2973 |
+ zs_lba = get_unaligned_be64(cmd + 2); |
2974 |
+ alloc_len = get_unaligned_be32(cmd + 10); |
2975 |
++ if (alloc_len == 0) |
2976 |
++ return 0; /* not an error */ |
2977 |
+ rep_opts = cmd[14] & 0x3f; |
2978 |
+ partial = cmd[14] & 0x80; |
2979 |
+ |
2980 |
+@@ -4426,7 +4434,7 @@ static int resp_report_zones(struct scsi_cmnd *scp, |
2981 |
+ put_unaligned_be64(sdebug_capacity - 1, arr + 8); |
2982 |
+ |
2983 |
+ rep_len = (unsigned long)desc - (unsigned long)arr; |
2984 |
+- ret = fill_from_dev_buffer(scp, arr, min_t(int, alloc_len, rep_len)); |
2985 |
++ ret = fill_from_dev_buffer(scp, arr, min_t(u32, alloc_len, rep_len)); |
2986 |
+ |
2987 |
+ fini: |
2988 |
+ read_unlock(macc_lckp); |
2989 |
+diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c |
2990 |
+index 55f2e4d6f10b7..31adf25e57b0d 100644 |
2991 |
+--- a/drivers/scsi/ufs/ufshcd.c |
2992 |
++++ b/drivers/scsi/ufs/ufshcd.c |
2993 |
+@@ -8477,7 +8477,7 @@ static int ufshcd_set_dev_pwr_mode(struct ufs_hba *hba, |
2994 |
+ struct scsi_sense_hdr sshdr; |
2995 |
+ struct scsi_device *sdp; |
2996 |
+ unsigned long flags; |
2997 |
+- int ret; |
2998 |
++ int ret, retries; |
2999 |
+ |
3000 |
+ spin_lock_irqsave(hba->host->host_lock, flags); |
3001 |
+ sdp = hba->sdev_ufs_device; |
3002 |
+@@ -8510,8 +8510,14 @@ static int ufshcd_set_dev_pwr_mode(struct ufs_hba *hba, |
3003 |
+ * callbacks hence set the RQF_PM flag so that it doesn't resume the |
3004 |
+ * already suspended childs. |
3005 |
+ */ |
3006 |
+- ret = scsi_execute(sdp, cmd, DMA_NONE, NULL, 0, NULL, &sshdr, |
3007 |
+- START_STOP_TIMEOUT, 0, 0, RQF_PM, NULL); |
3008 |
++ for (retries = 3; retries > 0; --retries) { |
3009 |
++ ret = scsi_execute(sdp, cmd, DMA_NONE, NULL, 0, NULL, &sshdr, |
3010 |
++ START_STOP_TIMEOUT, 0, 0, RQF_PM, NULL); |
3011 |
++ if (!scsi_status_is_check_condition(ret) || |
3012 |
++ !scsi_sense_valid(&sshdr) || |
3013 |
++ sshdr.sense_key != UNIT_ATTENTION) |
3014 |
++ break; |
3015 |
++ } |
3016 |
+ if (ret) { |
3017 |
+ sdev_printk(KERN_WARNING, sdp, |
3018 |
+ "START_STOP failed for power mode: %d, result %x\n", |
3019 |
+diff --git a/drivers/soc/imx/soc-imx.c b/drivers/soc/imx/soc-imx.c |
3020 |
+index ac6d856ba228d..77bc12039c3d4 100644 |
3021 |
+--- a/drivers/soc/imx/soc-imx.c |
3022 |
++++ b/drivers/soc/imx/soc-imx.c |
3023 |
+@@ -36,6 +36,10 @@ static int __init imx_soc_device_init(void) |
3024 |
+ int ret; |
3025 |
+ int i; |
3026 |
+ |
3027 |
++ /* Return early if this is running on devices with different SoCs */ |
3028 |
++ if (!__mxc_cpu_type) |
3029 |
++ return 0; |
3030 |
++ |
3031 |
+ if (of_machine_is_compatible("fsl,ls1021a")) |
3032 |
+ return 0; |
3033 |
+ |
3034 |
+diff --git a/drivers/soc/tegra/fuse/fuse-tegra.c b/drivers/soc/tegra/fuse/fuse-tegra.c |
3035 |
+index f2151815db585..e714ed3b61bc3 100644 |
3036 |
+--- a/drivers/soc/tegra/fuse/fuse-tegra.c |
3037 |
++++ b/drivers/soc/tegra/fuse/fuse-tegra.c |
3038 |
+@@ -320,7 +320,7 @@ static struct platform_driver tegra_fuse_driver = { |
3039 |
+ }; |
3040 |
+ builtin_platform_driver(tegra_fuse_driver); |
3041 |
+ |
3042 |
+-bool __init tegra_fuse_read_spare(unsigned int spare) |
3043 |
++u32 __init tegra_fuse_read_spare(unsigned int spare) |
3044 |
+ { |
3045 |
+ unsigned int offset = fuse->soc->info->spare + spare * 4; |
3046 |
+ |
3047 |
+diff --git a/drivers/soc/tegra/fuse/fuse.h b/drivers/soc/tegra/fuse/fuse.h |
3048 |
+index de58feba04350..ecff0c08e9595 100644 |
3049 |
+--- a/drivers/soc/tegra/fuse/fuse.h |
3050 |
++++ b/drivers/soc/tegra/fuse/fuse.h |
3051 |
+@@ -65,7 +65,7 @@ struct tegra_fuse { |
3052 |
+ void tegra_init_revision(void); |
3053 |
+ void tegra_init_apbmisc(void); |
3054 |
+ |
3055 |
+-bool __init tegra_fuse_read_spare(unsigned int spare); |
3056 |
++u32 __init tegra_fuse_read_spare(unsigned int spare); |
3057 |
+ u32 __init tegra_fuse_read_early(unsigned int offset); |
3058 |
+ |
3059 |
+ u8 tegra_get_major_rev(void); |
3060 |
+diff --git a/drivers/tee/amdtee/core.c b/drivers/tee/amdtee/core.c |
3061 |
+index da6b88e80dc07..297dc62bca298 100644 |
3062 |
+--- a/drivers/tee/amdtee/core.c |
3063 |
++++ b/drivers/tee/amdtee/core.c |
3064 |
+@@ -203,9 +203,8 @@ static int copy_ta_binary(struct tee_context *ctx, void *ptr, void **ta, |
3065 |
+ |
3066 |
+ *ta_size = roundup(fw->size, PAGE_SIZE); |
3067 |
+ *ta = (void *)__get_free_pages(GFP_KERNEL, get_order(*ta_size)); |
3068 |
+- if (IS_ERR(*ta)) { |
3069 |
+- pr_err("%s: get_free_pages failed 0x%llx\n", __func__, |
3070 |
+- (u64)*ta); |
3071 |
++ if (!*ta) { |
3072 |
++ pr_err("%s: get_free_pages failed\n", __func__); |
3073 |
+ rc = -ENOMEM; |
3074 |
+ goto rel_fw; |
3075 |
+ } |
3076 |
+diff --git a/drivers/tty/hvc/hvc_xen.c b/drivers/tty/hvc/hvc_xen.c |
3077 |
+index f0bf01ea069ae..8ee7ce1206925 100644 |
3078 |
+--- a/drivers/tty/hvc/hvc_xen.c |
3079 |
++++ b/drivers/tty/hvc/hvc_xen.c |
3080 |
+@@ -37,6 +37,8 @@ struct xencons_info { |
3081 |
+ struct xenbus_device *xbdev; |
3082 |
+ struct xencons_interface *intf; |
3083 |
+ unsigned int evtchn; |
3084 |
++ XENCONS_RING_IDX out_cons; |
3085 |
++ unsigned int out_cons_same; |
3086 |
+ struct hvc_struct *hvc; |
3087 |
+ int irq; |
3088 |
+ int vtermno; |
3089 |
+@@ -138,6 +140,8 @@ static int domU_read_console(uint32_t vtermno, char *buf, int len) |
3090 |
+ XENCONS_RING_IDX cons, prod; |
3091 |
+ int recv = 0; |
3092 |
+ struct xencons_info *xencons = vtermno_to_xencons(vtermno); |
3093 |
++ unsigned int eoiflag = 0; |
3094 |
++ |
3095 |
+ if (xencons == NULL) |
3096 |
+ return -EINVAL; |
3097 |
+ intf = xencons->intf; |
3098 |
+@@ -157,7 +161,27 @@ static int domU_read_console(uint32_t vtermno, char *buf, int len) |
3099 |
+ mb(); /* read ring before consuming */ |
3100 |
+ intf->in_cons = cons; |
3101 |
+ |
3102 |
+- notify_daemon(xencons); |
3103 |
++ /* |
3104 |
++ * When to mark interrupt having been spurious: |
3105 |
++ * - there was no new data to be read, and |
3106 |
++ * - the backend did not consume some output bytes, and |
3107 |
++ * - the previous round with no read data didn't see consumed bytes |
3108 |
++ * (we might have a race with an interrupt being in flight while |
3109 |
++ * updating xencons->out_cons, so account for that by allowing one |
3110 |
++ * round without any visible reason) |
3111 |
++ */ |
3112 |
++ if (intf->out_cons != xencons->out_cons) { |
3113 |
++ xencons->out_cons = intf->out_cons; |
3114 |
++ xencons->out_cons_same = 0; |
3115 |
++ } |
3116 |
++ if (recv) { |
3117 |
++ notify_daemon(xencons); |
3118 |
++ } else if (xencons->out_cons_same++ > 1) { |
3119 |
++ eoiflag = XEN_EOI_FLAG_SPURIOUS; |
3120 |
++ } |
3121 |
++ |
3122 |
++ xen_irq_lateeoi(xencons->irq, eoiflag); |
3123 |
++ |
3124 |
+ return recv; |
3125 |
+ } |
3126 |
+ |
3127 |
+@@ -386,7 +410,7 @@ static int xencons_connect_backend(struct xenbus_device *dev, |
3128 |
+ if (ret) |
3129 |
+ return ret; |
3130 |
+ info->evtchn = evtchn; |
3131 |
+- irq = bind_evtchn_to_irq(evtchn); |
3132 |
++ irq = bind_interdomain_evtchn_to_irq_lateeoi(dev, evtchn); |
3133 |
+ if (irq < 0) |
3134 |
+ return irq; |
3135 |
+ info->irq = irq; |
3136 |
+@@ -550,7 +574,7 @@ static int __init xen_hvc_init(void) |
3137 |
+ return r; |
3138 |
+ |
3139 |
+ info = vtermno_to_xencons(HVC_COOKIE); |
3140 |
+- info->irq = bind_evtchn_to_irq(info->evtchn); |
3141 |
++ info->irq = bind_evtchn_to_irq_lateeoi(info->evtchn); |
3142 |
+ } |
3143 |
+ if (info->irq < 0) |
3144 |
+ info->irq = 0; /* NO_IRQ */ |
3145 |
+diff --git a/drivers/tty/n_hdlc.c b/drivers/tty/n_hdlc.c |
3146 |
+index 580a37b3fe1b9..166f651fde33a 100644 |
3147 |
+--- a/drivers/tty/n_hdlc.c |
3148 |
++++ b/drivers/tty/n_hdlc.c |
3149 |
+@@ -140,6 +140,8 @@ struct n_hdlc { |
3150 |
+ struct n_hdlc_buf_list rx_buf_list; |
3151 |
+ struct n_hdlc_buf_list tx_free_buf_list; |
3152 |
+ struct n_hdlc_buf_list rx_free_buf_list; |
3153 |
++ struct work_struct write_work; |
3154 |
++ struct tty_struct *tty_for_write_work; |
3155 |
+ }; |
3156 |
+ |
3157 |
+ /* |
3158 |
+@@ -154,6 +156,7 @@ static struct n_hdlc_buf *n_hdlc_buf_get(struct n_hdlc_buf_list *list); |
3159 |
+ /* Local functions */ |
3160 |
+ |
3161 |
+ static struct n_hdlc *n_hdlc_alloc(void); |
3162 |
++static void n_hdlc_tty_write_work(struct work_struct *work); |
3163 |
+ |
3164 |
+ /* max frame size for memory allocations */ |
3165 |
+ static int maxframe = 4096; |
3166 |
+@@ -210,6 +213,8 @@ static void n_hdlc_tty_close(struct tty_struct *tty) |
3167 |
+ wake_up_interruptible(&tty->read_wait); |
3168 |
+ wake_up_interruptible(&tty->write_wait); |
3169 |
+ |
3170 |
++ cancel_work_sync(&n_hdlc->write_work); |
3171 |
++ |
3172 |
+ n_hdlc_free_buf_list(&n_hdlc->rx_free_buf_list); |
3173 |
+ n_hdlc_free_buf_list(&n_hdlc->tx_free_buf_list); |
3174 |
+ n_hdlc_free_buf_list(&n_hdlc->rx_buf_list); |
3175 |
+@@ -241,6 +246,8 @@ static int n_hdlc_tty_open(struct tty_struct *tty) |
3176 |
+ return -ENFILE; |
3177 |
+ } |
3178 |
+ |
3179 |
++ INIT_WORK(&n_hdlc->write_work, n_hdlc_tty_write_work); |
3180 |
++ n_hdlc->tty_for_write_work = tty; |
3181 |
+ tty->disc_data = n_hdlc; |
3182 |
+ tty->receive_room = 65536; |
3183 |
+ |
3184 |
+@@ -334,6 +341,20 @@ check_again: |
3185 |
+ goto check_again; |
3186 |
+ } /* end of n_hdlc_send_frames() */ |
3187 |
+ |
3188 |
++/** |
3189 |
++ * n_hdlc_tty_write_work - Asynchronous callback for transmit wakeup |
3190 |
++ * @work: pointer to work_struct |
3191 |
++ * |
3192 |
++ * Called when low level device driver can accept more send data. |
3193 |
++ */ |
3194 |
++static void n_hdlc_tty_write_work(struct work_struct *work) |
3195 |
++{ |
3196 |
++ struct n_hdlc *n_hdlc = container_of(work, struct n_hdlc, write_work); |
3197 |
++ struct tty_struct *tty = n_hdlc->tty_for_write_work; |
3198 |
++ |
3199 |
++ n_hdlc_send_frames(n_hdlc, tty); |
3200 |
++} /* end of n_hdlc_tty_write_work() */ |
3201 |
++ |
3202 |
+ /** |
3203 |
+ * n_hdlc_tty_wakeup - Callback for transmit wakeup |
3204 |
+ * @tty: pointer to associated tty instance data |
3205 |
+@@ -344,7 +365,7 @@ static void n_hdlc_tty_wakeup(struct tty_struct *tty) |
3206 |
+ { |
3207 |
+ struct n_hdlc *n_hdlc = tty->disc_data; |
3208 |
+ |
3209 |
+- n_hdlc_send_frames(n_hdlc, tty); |
3210 |
++ schedule_work(&n_hdlc->write_work); |
3211 |
+ } /* end of n_hdlc_tty_wakeup() */ |
3212 |
+ |
3213 |
+ /** |
3214 |
+diff --git a/drivers/tty/serial/8250/8250_fintek.c b/drivers/tty/serial/8250/8250_fintek.c |
3215 |
+index 31c9e83ea3cb2..251f0018ae8ca 100644 |
3216 |
+--- a/drivers/tty/serial/8250/8250_fintek.c |
3217 |
++++ b/drivers/tty/serial/8250/8250_fintek.c |
3218 |
+@@ -290,25 +290,6 @@ static void fintek_8250_set_max_fifo(struct fintek_8250 *pdata) |
3219 |
+ } |
3220 |
+ } |
3221 |
+ |
3222 |
+-static void fintek_8250_goto_highspeed(struct uart_8250_port *uart, |
3223 |
+- struct fintek_8250 *pdata) |
3224 |
+-{ |
3225 |
+- sio_write_reg(pdata, LDN, pdata->index); |
3226 |
+- |
3227 |
+- switch (pdata->pid) { |
3228 |
+- case CHIP_ID_F81966: |
3229 |
+- case CHIP_ID_F81866: /* set uart clock for high speed serial mode */ |
3230 |
+- sio_write_mask_reg(pdata, F81866_UART_CLK, |
3231 |
+- F81866_UART_CLK_MASK, |
3232 |
+- F81866_UART_CLK_14_769MHZ); |
3233 |
+- |
3234 |
+- uart->port.uartclk = 921600 * 16; |
3235 |
+- break; |
3236 |
+- default: /* leave clock speed untouched */ |
3237 |
+- break; |
3238 |
+- } |
3239 |
+-} |
3240 |
+- |
3241 |
+ static void fintek_8250_set_termios(struct uart_port *port, |
3242 |
+ struct ktermios *termios, |
3243 |
+ struct ktermios *old) |
3244 |
+@@ -430,7 +411,6 @@ static int probe_setup_port(struct fintek_8250 *pdata, |
3245 |
+ |
3246 |
+ fintek_8250_set_irq_mode(pdata, level_mode); |
3247 |
+ fintek_8250_set_max_fifo(pdata); |
3248 |
+- fintek_8250_goto_highspeed(uart, pdata); |
3249 |
+ |
3250 |
+ fintek_8250_exit_key(addr[i]); |
3251 |
+ |
3252 |
+diff --git a/drivers/usb/cdns3/cdnsp-gadget.c b/drivers/usb/cdns3/cdnsp-gadget.c |
3253 |
+index 27df0c6978978..e85bf768c66da 100644 |
3254 |
+--- a/drivers/usb/cdns3/cdnsp-gadget.c |
3255 |
++++ b/drivers/usb/cdns3/cdnsp-gadget.c |
3256 |
+@@ -1541,15 +1541,27 @@ static int cdnsp_gadget_pullup(struct usb_gadget *gadget, int is_on) |
3257 |
+ { |
3258 |
+ struct cdnsp_device *pdev = gadget_to_cdnsp(gadget); |
3259 |
+ struct cdns *cdns = dev_get_drvdata(pdev->dev); |
3260 |
++ unsigned long flags; |
3261 |
+ |
3262 |
+ trace_cdnsp_pullup(is_on); |
3263 |
+ |
3264 |
++ /* |
3265 |
++ * Disable events handling while controller is being |
3266 |
++ * enabled/disabled. |
3267 |
++ */ |
3268 |
++ disable_irq(cdns->dev_irq); |
3269 |
++ spin_lock_irqsave(&pdev->lock, flags); |
3270 |
++ |
3271 |
+ if (!is_on) { |
3272 |
+ cdnsp_reset_device(pdev); |
3273 |
+ cdns_clear_vbus(cdns); |
3274 |
+ } else { |
3275 |
+ cdns_set_vbus(cdns); |
3276 |
+ } |
3277 |
++ |
3278 |
++ spin_unlock_irqrestore(&pdev->lock, flags); |
3279 |
++ enable_irq(cdns->dev_irq); |
3280 |
++ |
3281 |
+ return 0; |
3282 |
+ } |
3283 |
+ |
3284 |
+diff --git a/drivers/usb/cdns3/cdnsp-ring.c b/drivers/usb/cdns3/cdnsp-ring.c |
3285 |
+index 1b1438457fb04..e45c3d6e1536c 100644 |
3286 |
+--- a/drivers/usb/cdns3/cdnsp-ring.c |
3287 |
++++ b/drivers/usb/cdns3/cdnsp-ring.c |
3288 |
+@@ -1029,6 +1029,8 @@ static void cdnsp_process_ctrl_td(struct cdnsp_device *pdev, |
3289 |
+ return; |
3290 |
+ } |
3291 |
+ |
3292 |
++ *status = 0; |
3293 |
++ |
3294 |
+ cdnsp_finish_td(pdev, td, event, pep, status); |
3295 |
+ } |
3296 |
+ |
3297 |
+@@ -1523,7 +1525,14 @@ irqreturn_t cdnsp_thread_irq_handler(int irq, void *data) |
3298 |
+ spin_lock_irqsave(&pdev->lock, flags); |
3299 |
+ |
3300 |
+ if (pdev->cdnsp_state & (CDNSP_STATE_HALTED | CDNSP_STATE_DYING)) { |
3301 |
+- cdnsp_died(pdev); |
3302 |
++ /* |
3303 |
++ * While removing or stopping driver there may still be deferred |
3304 |
++ * not handled interrupt which should not be treated as error. |
3305 |
++ * Driver should simply ignore it. |
3306 |
++ */ |
3307 |
++ if (pdev->gadget_driver) |
3308 |
++ cdnsp_died(pdev); |
3309 |
++ |
3310 |
+ spin_unlock_irqrestore(&pdev->lock, flags); |
3311 |
+ return IRQ_HANDLED; |
3312 |
+ } |
3313 |
+diff --git a/drivers/usb/cdns3/cdnsp-trace.h b/drivers/usb/cdns3/cdnsp-trace.h |
3314 |
+index 6a2571c6aa9ed..5983dfb996537 100644 |
3315 |
+--- a/drivers/usb/cdns3/cdnsp-trace.h |
3316 |
++++ b/drivers/usb/cdns3/cdnsp-trace.h |
3317 |
+@@ -57,9 +57,9 @@ DECLARE_EVENT_CLASS(cdnsp_log_ep, |
3318 |
+ __entry->first_prime_det = pep->stream_info.first_prime_det; |
3319 |
+ __entry->drbls_count = pep->stream_info.drbls_count; |
3320 |
+ ), |
3321 |
+- TP_printk("%s: SID: %08x ep state: %x stream: enabled: %d num %d " |
3322 |
++ TP_printk("%s: SID: %08x, ep state: %x, stream: enabled: %d num %d " |
3323 |
+ "tds %d, first prime: %d drbls %d", |
3324 |
+- __get_str(name), __entry->state, __entry->stream_id, |
3325 |
++ __get_str(name), __entry->stream_id, __entry->state, |
3326 |
+ __entry->enabled, __entry->num_streams, __entry->td_count, |
3327 |
+ __entry->first_prime_det, __entry->drbls_count) |
3328 |
+ ); |
3329 |
+diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c |
3330 |
+index 9618ba622a2d0..fa66e6e587928 100644 |
3331 |
+--- a/drivers/usb/core/devio.c |
3332 |
++++ b/drivers/usb/core/devio.c |
3333 |
+@@ -32,6 +32,7 @@ |
3334 |
+ #include <linux/usb.h> |
3335 |
+ #include <linux/usbdevice_fs.h> |
3336 |
+ #include <linux/usb/hcd.h> /* for usbcore internals */ |
3337 |
++#include <linux/usb/quirks.h> |
3338 |
+ #include <linux/cdev.h> |
3339 |
+ #include <linux/notifier.h> |
3340 |
+ #include <linux/security.h> |
3341 |
+@@ -1102,14 +1103,55 @@ static int usbdev_release(struct inode *inode, struct file *file) |
3342 |
+ return 0; |
3343 |
+ } |
3344 |
+ |
3345 |
++static void usbfs_blocking_completion(struct urb *urb) |
3346 |
++{ |
3347 |
++ complete((struct completion *) urb->context); |
3348 |
++} |
3349 |
++ |
3350 |
++/* |
3351 |
++ * Much like usb_start_wait_urb, but returns status separately from |
3352 |
++ * actual_length and uses a killable wait. |
3353 |
++ */ |
3354 |
++static int usbfs_start_wait_urb(struct urb *urb, int timeout, |
3355 |
++ unsigned int *actlen) |
3356 |
++{ |
3357 |
++ DECLARE_COMPLETION_ONSTACK(ctx); |
3358 |
++ unsigned long expire; |
3359 |
++ int rc; |
3360 |
++ |
3361 |
++ urb->context = &ctx; |
3362 |
++ urb->complete = usbfs_blocking_completion; |
3363 |
++ *actlen = 0; |
3364 |
++ rc = usb_submit_urb(urb, GFP_KERNEL); |
3365 |
++ if (unlikely(rc)) |
3366 |
++ return rc; |
3367 |
++ |
3368 |
++ expire = (timeout ? msecs_to_jiffies(timeout) : MAX_SCHEDULE_TIMEOUT); |
3369 |
++ rc = wait_for_completion_killable_timeout(&ctx, expire); |
3370 |
++ if (rc <= 0) { |
3371 |
++ usb_kill_urb(urb); |
3372 |
++ *actlen = urb->actual_length; |
3373 |
++ if (urb->status != -ENOENT) |
3374 |
++ ; /* Completed before it was killed */ |
3375 |
++ else if (rc < 0) |
3376 |
++ return -EINTR; |
3377 |
++ else |
3378 |
++ return -ETIMEDOUT; |
3379 |
++ } |
3380 |
++ *actlen = urb->actual_length; |
3381 |
++ return urb->status; |
3382 |
++} |
3383 |
++ |
3384 |
+ static int do_proc_control(struct usb_dev_state *ps, |
3385 |
+ struct usbdevfs_ctrltransfer *ctrl) |
3386 |
+ { |
3387 |
+ struct usb_device *dev = ps->dev; |
3388 |
+ unsigned int tmo; |
3389 |
+ unsigned char *tbuf; |
3390 |
+- unsigned wLength; |
3391 |
++ unsigned int wLength, actlen; |
3392 |
+ int i, pipe, ret; |
3393 |
++ struct urb *urb = NULL; |
3394 |
++ struct usb_ctrlrequest *dr = NULL; |
3395 |
+ |
3396 |
+ ret = check_ctrlrecip(ps, ctrl->bRequestType, ctrl->bRequest, |
3397 |
+ ctrl->wIndex); |
3398 |
+@@ -1122,51 +1164,63 @@ static int do_proc_control(struct usb_dev_state *ps, |
3399 |
+ sizeof(struct usb_ctrlrequest)); |
3400 |
+ if (ret) |
3401 |
+ return ret; |
3402 |
++ |
3403 |
++ ret = -ENOMEM; |
3404 |
+ tbuf = (unsigned char *)__get_free_page(GFP_KERNEL); |
3405 |
+- if (!tbuf) { |
3406 |
+- ret = -ENOMEM; |
3407 |
++ if (!tbuf) |
3408 |
+ goto done; |
3409 |
+- } |
3410 |
++ urb = usb_alloc_urb(0, GFP_NOIO); |
3411 |
++ if (!urb) |
3412 |
++ goto done; |
3413 |
++ dr = kmalloc(sizeof(struct usb_ctrlrequest), GFP_NOIO); |
3414 |
++ if (!dr) |
3415 |
++ goto done; |
3416 |
++ |
3417 |
++ dr->bRequestType = ctrl->bRequestType; |
3418 |
++ dr->bRequest = ctrl->bRequest; |
3419 |
++ dr->wValue = cpu_to_le16(ctrl->wValue); |
3420 |
++ dr->wIndex = cpu_to_le16(ctrl->wIndex); |
3421 |
++ dr->wLength = cpu_to_le16(ctrl->wLength); |
3422 |
++ |
3423 |
+ tmo = ctrl->timeout; |
3424 |
+ snoop(&dev->dev, "control urb: bRequestType=%02x " |
3425 |
+ "bRequest=%02x wValue=%04x " |
3426 |
+ "wIndex=%04x wLength=%04x\n", |
3427 |
+ ctrl->bRequestType, ctrl->bRequest, ctrl->wValue, |
3428 |
+ ctrl->wIndex, ctrl->wLength); |
3429 |
+- if ((ctrl->bRequestType & USB_DIR_IN) && ctrl->wLength) { |
3430 |
++ |
3431 |
++ if ((ctrl->bRequestType & USB_DIR_IN) && wLength) { |
3432 |
+ pipe = usb_rcvctrlpipe(dev, 0); |
3433 |
+- snoop_urb(dev, NULL, pipe, ctrl->wLength, tmo, SUBMIT, NULL, 0); |
3434 |
++ usb_fill_control_urb(urb, dev, pipe, (unsigned char *) dr, tbuf, |
3435 |
++ wLength, NULL, NULL); |
3436 |
++ snoop_urb(dev, NULL, pipe, wLength, tmo, SUBMIT, NULL, 0); |
3437 |
+ |
3438 |
+ usb_unlock_device(dev); |
3439 |
+- i = usb_control_msg(dev, pipe, ctrl->bRequest, |
3440 |
+- ctrl->bRequestType, ctrl->wValue, ctrl->wIndex, |
3441 |
+- tbuf, ctrl->wLength, tmo); |
3442 |
++ i = usbfs_start_wait_urb(urb, tmo, &actlen); |
3443 |
+ usb_lock_device(dev); |
3444 |
+- snoop_urb(dev, NULL, pipe, max(i, 0), min(i, 0), COMPLETE, |
3445 |
+- tbuf, max(i, 0)); |
3446 |
+- if ((i > 0) && ctrl->wLength) { |
3447 |
+- if (copy_to_user(ctrl->data, tbuf, i)) { |
3448 |
++ snoop_urb(dev, NULL, pipe, actlen, i, COMPLETE, tbuf, actlen); |
3449 |
++ if (!i && actlen) { |
3450 |
++ if (copy_to_user(ctrl->data, tbuf, actlen)) { |
3451 |
+ ret = -EFAULT; |
3452 |
+- goto done; |
3453 |
++ goto recv_fault; |
3454 |
+ } |
3455 |
+ } |
3456 |
+ } else { |
3457 |
+- if (ctrl->wLength) { |
3458 |
+- if (copy_from_user(tbuf, ctrl->data, ctrl->wLength)) { |
3459 |
++ if (wLength) { |
3460 |
++ if (copy_from_user(tbuf, ctrl->data, wLength)) { |
3461 |
+ ret = -EFAULT; |
3462 |
+ goto done; |
3463 |
+ } |
3464 |
+ } |
3465 |
+ pipe = usb_sndctrlpipe(dev, 0); |
3466 |
+- snoop_urb(dev, NULL, pipe, ctrl->wLength, tmo, SUBMIT, |
3467 |
+- tbuf, ctrl->wLength); |
3468 |
++ usb_fill_control_urb(urb, dev, pipe, (unsigned char *) dr, tbuf, |
3469 |
++ wLength, NULL, NULL); |
3470 |
++ snoop_urb(dev, NULL, pipe, wLength, tmo, SUBMIT, tbuf, wLength); |
3471 |
+ |
3472 |
+ usb_unlock_device(dev); |
3473 |
+- i = usb_control_msg(dev, pipe, ctrl->bRequest, |
3474 |
+- ctrl->bRequestType, ctrl->wValue, ctrl->wIndex, |
3475 |
+- tbuf, ctrl->wLength, tmo); |
3476 |
++ i = usbfs_start_wait_urb(urb, tmo, &actlen); |
3477 |
+ usb_lock_device(dev); |
3478 |
+- snoop_urb(dev, NULL, pipe, max(i, 0), min(i, 0), COMPLETE, NULL, 0); |
3479 |
++ snoop_urb(dev, NULL, pipe, actlen, i, COMPLETE, NULL, 0); |
3480 |
+ } |
3481 |
+ if (i < 0 && i != -EPIPE) { |
3482 |
+ dev_printk(KERN_DEBUG, &dev->dev, "usbfs: USBDEVFS_CONTROL " |
3483 |
+@@ -1174,8 +1228,15 @@ static int do_proc_control(struct usb_dev_state *ps, |
3484 |
+ current->comm, ctrl->bRequestType, ctrl->bRequest, |
3485 |
+ ctrl->wLength, i); |
3486 |
+ } |
3487 |
+- ret = i; |
3488 |
++ ret = (i < 0 ? i : actlen); |
3489 |
++ |
3490 |
++ recv_fault: |
3491 |
++ /* Linger a bit, prior to the next control message. */ |
3492 |
++ if (dev->quirks & USB_QUIRK_DELAY_CTRL_MSG) |
3493 |
++ msleep(200); |
3494 |
+ done: |
3495 |
++ kfree(dr); |
3496 |
++ usb_free_urb(urb); |
3497 |
+ free_page((unsigned long) tbuf); |
3498 |
+ usbfs_decrease_memory_usage(PAGE_SIZE + sizeof(struct urb) + |
3499 |
+ sizeof(struct usb_ctrlrequest)); |
3500 |
+@@ -1195,10 +1256,11 @@ static int do_proc_bulk(struct usb_dev_state *ps, |
3501 |
+ struct usbdevfs_bulktransfer *bulk) |
3502 |
+ { |
3503 |
+ struct usb_device *dev = ps->dev; |
3504 |
+- unsigned int tmo, len1, pipe; |
3505 |
+- int len2; |
3506 |
++ unsigned int tmo, len1, len2, pipe; |
3507 |
+ unsigned char *tbuf; |
3508 |
+ int i, ret; |
3509 |
++ struct urb *urb = NULL; |
3510 |
++ struct usb_host_endpoint *ep; |
3511 |
+ |
3512 |
+ ret = findintfep(ps->dev, bulk->ep); |
3513 |
+ if (ret < 0) |
3514 |
+@@ -1206,14 +1268,17 @@ static int do_proc_bulk(struct usb_dev_state *ps, |
3515 |
+ ret = checkintf(ps, ret); |
3516 |
+ if (ret) |
3517 |
+ return ret; |
3518 |
++ |
3519 |
++ len1 = bulk->len; |
3520 |
++ if (len1 < 0 || len1 >= (INT_MAX - sizeof(struct urb))) |
3521 |
++ return -EINVAL; |
3522 |
++ |
3523 |
+ if (bulk->ep & USB_DIR_IN) |
3524 |
+ pipe = usb_rcvbulkpipe(dev, bulk->ep & 0x7f); |
3525 |
+ else |
3526 |
+ pipe = usb_sndbulkpipe(dev, bulk->ep & 0x7f); |
3527 |
+- if (!usb_maxpacket(dev, pipe, !(bulk->ep & USB_DIR_IN))) |
3528 |
+- return -EINVAL; |
3529 |
+- len1 = bulk->len; |
3530 |
+- if (len1 >= (INT_MAX - sizeof(struct urb))) |
3531 |
++ ep = usb_pipe_endpoint(dev, pipe); |
3532 |
++ if (!ep || !usb_endpoint_maxp(&ep->desc)) |
3533 |
+ return -EINVAL; |
3534 |
+ ret = usbfs_increase_memory_usage(len1 + sizeof(struct urb)); |
3535 |
+ if (ret) |
3536 |
+@@ -1223,17 +1288,29 @@ static int do_proc_bulk(struct usb_dev_state *ps, |
3537 |
+ * len1 can be almost arbitrarily large. Don't WARN if it's |
3538 |
+ * too big, just fail the request. |
3539 |
+ */ |
3540 |
++ ret = -ENOMEM; |
3541 |
+ tbuf = kmalloc(len1, GFP_KERNEL | __GFP_NOWARN); |
3542 |
+- if (!tbuf) { |
3543 |
+- ret = -ENOMEM; |
3544 |
++ if (!tbuf) |
3545 |
++ goto done; |
3546 |
++ urb = usb_alloc_urb(0, GFP_KERNEL); |
3547 |
++ if (!urb) |
3548 |
+ goto done; |
3549 |
++ |
3550 |
++ if ((ep->desc.bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == |
3551 |
++ USB_ENDPOINT_XFER_INT) { |
3552 |
++ pipe = (pipe & ~(3 << 30)) | (PIPE_INTERRUPT << 30); |
3553 |
++ usb_fill_int_urb(urb, dev, pipe, tbuf, len1, |
3554 |
++ NULL, NULL, ep->desc.bInterval); |
3555 |
++ } else { |
3556 |
++ usb_fill_bulk_urb(urb, dev, pipe, tbuf, len1, NULL, NULL); |
3557 |
+ } |
3558 |
++ |
3559 |
+ tmo = bulk->timeout; |
3560 |
+ if (bulk->ep & 0x80) { |
3561 |
+ snoop_urb(dev, NULL, pipe, len1, tmo, SUBMIT, NULL, 0); |
3562 |
+ |
3563 |
+ usb_unlock_device(dev); |
3564 |
+- i = usb_bulk_msg(dev, pipe, tbuf, len1, &len2, tmo); |
3565 |
++ i = usbfs_start_wait_urb(urb, tmo, &len2); |
3566 |
+ usb_lock_device(dev); |
3567 |
+ snoop_urb(dev, NULL, pipe, len2, i, COMPLETE, tbuf, len2); |
3568 |
+ |
3569 |
+@@ -1253,12 +1330,13 @@ static int do_proc_bulk(struct usb_dev_state *ps, |
3570 |
+ snoop_urb(dev, NULL, pipe, len1, tmo, SUBMIT, tbuf, len1); |
3571 |
+ |
3572 |
+ usb_unlock_device(dev); |
3573 |
+- i = usb_bulk_msg(dev, pipe, tbuf, len1, &len2, tmo); |
3574 |
++ i = usbfs_start_wait_urb(urb, tmo, &len2); |
3575 |
+ usb_lock_device(dev); |
3576 |
+ snoop_urb(dev, NULL, pipe, len2, i, COMPLETE, NULL, 0); |
3577 |
+ } |
3578 |
+ ret = (i < 0 ? i : len2); |
3579 |
+ done: |
3580 |
++ usb_free_urb(urb); |
3581 |
+ kfree(tbuf); |
3582 |
+ usbfs_decrease_memory_usage(len1 + sizeof(struct urb)); |
3583 |
+ return ret; |
3584 |
+diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c |
3585 |
+index 019351c0b52cf..d3c14b5ed4a1f 100644 |
3586 |
+--- a/drivers/usb/core/quirks.c |
3587 |
++++ b/drivers/usb/core/quirks.c |
3588 |
+@@ -434,6 +434,9 @@ static const struct usb_device_id usb_quirk_list[] = { |
3589 |
+ { USB_DEVICE(0x1532, 0x0116), .driver_info = |
3590 |
+ USB_QUIRK_LINEAR_UFRAME_INTR_BINTERVAL }, |
3591 |
+ |
3592 |
++ /* Lenovo USB-C to Ethernet Adapter RTL8153-04 */ |
3593 |
++ { USB_DEVICE(0x17ef, 0x720c), .driver_info = USB_QUIRK_NO_LPM }, |
3594 |
++ |
3595 |
+ /* Lenovo Powered USB-C Travel Hub (4X90S92381, RTL8153 GigE) */ |
3596 |
+ { USB_DEVICE(0x17ef, 0x721e), .driver_info = USB_QUIRK_NO_LPM }, |
3597 |
+ |
3598 |
+diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c |
3599 |
+index c8f18f3ba9e35..c331a5128c2c0 100644 |
3600 |
+--- a/drivers/usb/dwc2/platform.c |
3601 |
++++ b/drivers/usb/dwc2/platform.c |
3602 |
+@@ -575,6 +575,9 @@ static int dwc2_driver_probe(struct platform_device *dev) |
3603 |
+ ggpio |= GGPIO_STM32_OTG_GCCFG_IDEN; |
3604 |
+ ggpio |= GGPIO_STM32_OTG_GCCFG_VBDEN; |
3605 |
+ dwc2_writel(hsotg, ggpio, GGPIO); |
3606 |
++ |
3607 |
++ /* ID/VBUS detection startup time */ |
3608 |
++ usleep_range(5000, 7000); |
3609 |
+ } |
3610 |
+ |
3611 |
+ retval = dwc2_drd_init(hsotg); |
3612 |
+diff --git a/drivers/usb/early/xhci-dbc.c b/drivers/usb/early/xhci-dbc.c |
3613 |
+index be4ecbabdd586..6c0434100e38c 100644 |
3614 |
+--- a/drivers/usb/early/xhci-dbc.c |
3615 |
++++ b/drivers/usb/early/xhci-dbc.c |
3616 |
+@@ -14,7 +14,6 @@ |
3617 |
+ #include <linux/pci_ids.h> |
3618 |
+ #include <linux/memblock.h> |
3619 |
+ #include <linux/io.h> |
3620 |
+-#include <linux/iopoll.h> |
3621 |
+ #include <asm/pci-direct.h> |
3622 |
+ #include <asm/fixmap.h> |
3623 |
+ #include <linux/bcd.h> |
3624 |
+@@ -136,9 +135,17 @@ static int handshake(void __iomem *ptr, u32 mask, u32 done, int wait, int delay) |
3625 |
+ { |
3626 |
+ u32 result; |
3627 |
+ |
3628 |
+- return readl_poll_timeout_atomic(ptr, result, |
3629 |
+- ((result & mask) == done), |
3630 |
+- delay, wait); |
3631 |
++ /* Can not use readl_poll_timeout_atomic() for early boot things */ |
3632 |
++ do { |
3633 |
++ result = readl(ptr); |
3634 |
++ result &= mask; |
3635 |
++ if (result == done) |
3636 |
++ return 0; |
3637 |
++ udelay(delay); |
3638 |
++ wait -= delay; |
3639 |
++ } while (wait > 0); |
3640 |
++ |
3641 |
++ return -ETIMEDOUT; |
3642 |
+ } |
3643 |
+ |
3644 |
+ static void __init xdbc_bios_handoff(void) |
3645 |
+diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c |
3646 |
+index 284eea9f6e4d8..3789c329183ca 100644 |
3647 |
+--- a/drivers/usb/gadget/composite.c |
3648 |
++++ b/drivers/usb/gadget/composite.c |
3649 |
+@@ -1680,14 +1680,14 @@ composite_setup(struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl) |
3650 |
+ u8 endp; |
3651 |
+ |
3652 |
+ if (w_length > USB_COMP_EP0_BUFSIZ) { |
3653 |
+- if (ctrl->bRequestType == USB_DIR_OUT) { |
3654 |
+- goto done; |
3655 |
+- } else { |
3656 |
++ if (ctrl->bRequestType & USB_DIR_IN) { |
3657 |
+ /* Cast away the const, we are going to overwrite on purpose. */ |
3658 |
+ __le16 *temp = (__le16 *)&ctrl->wLength; |
3659 |
+ |
3660 |
+ *temp = cpu_to_le16(USB_COMP_EP0_BUFSIZ); |
3661 |
+ w_length = USB_COMP_EP0_BUFSIZ; |
3662 |
++ } else { |
3663 |
++ goto done; |
3664 |
+ } |
3665 |
+ } |
3666 |
+ |
3667 |
+diff --git a/drivers/usb/gadget/function/u_ether.c b/drivers/usb/gadget/function/u_ether.c |
3668 |
+index 85a3f6d4b5af3..d15a54f6c24b9 100644 |
3669 |
+--- a/drivers/usb/gadget/function/u_ether.c |
3670 |
++++ b/drivers/usb/gadget/function/u_ether.c |
3671 |
+@@ -17,6 +17,7 @@ |
3672 |
+ #include <linux/etherdevice.h> |
3673 |
+ #include <linux/ethtool.h> |
3674 |
+ #include <linux/if_vlan.h> |
3675 |
++#include <linux/etherdevice.h> |
3676 |
+ |
3677 |
+ #include "u_ether.h" |
3678 |
+ |
3679 |
+@@ -861,19 +862,23 @@ int gether_register_netdev(struct net_device *net) |
3680 |
+ { |
3681 |
+ struct eth_dev *dev; |
3682 |
+ struct usb_gadget *g; |
3683 |
+- struct sockaddr sa; |
3684 |
+ int status; |
3685 |
+ |
3686 |
+ if (!net->dev.parent) |
3687 |
+ return -EINVAL; |
3688 |
+ dev = netdev_priv(net); |
3689 |
+ g = dev->gadget; |
3690 |
++ |
3691 |
++ net->addr_assign_type = NET_ADDR_RANDOM; |
3692 |
++ eth_hw_addr_set(net, dev->dev_mac); |
3693 |
++ |
3694 |
+ status = register_netdev(net); |
3695 |
+ if (status < 0) { |
3696 |
+ dev_dbg(&g->dev, "register_netdev failed, %d\n", status); |
3697 |
+ return status; |
3698 |
+ } else { |
3699 |
+ INFO(dev, "HOST MAC %pM\n", dev->host_mac); |
3700 |
++ INFO(dev, "MAC %pM\n", dev->dev_mac); |
3701 |
+ |
3702 |
+ /* two kinds of host-initiated state changes: |
3703 |
+ * - iff DATA transfer is active, carrier is "on" |
3704 |
+@@ -881,15 +886,6 @@ int gether_register_netdev(struct net_device *net) |
3705 |
+ */ |
3706 |
+ netif_carrier_off(net); |
3707 |
+ } |
3708 |
+- sa.sa_family = net->type; |
3709 |
+- memcpy(sa.sa_data, dev->dev_mac, ETH_ALEN); |
3710 |
+- rtnl_lock(); |
3711 |
+- status = dev_set_mac_address(net, &sa, NULL); |
3712 |
+- rtnl_unlock(); |
3713 |
+- if (status) |
3714 |
+- pr_warn("cannot set self ethernet address: %d\n", status); |
3715 |
+- else |
3716 |
+- INFO(dev, "MAC %pM\n", dev->dev_mac); |
3717 |
+ |
3718 |
+ return status; |
3719 |
+ } |
3720 |
+diff --git a/drivers/usb/gadget/legacy/dbgp.c b/drivers/usb/gadget/legacy/dbgp.c |
3721 |
+index 355bc7dab9d5f..6bcbad3825802 100644 |
3722 |
+--- a/drivers/usb/gadget/legacy/dbgp.c |
3723 |
++++ b/drivers/usb/gadget/legacy/dbgp.c |
3724 |
+@@ -346,14 +346,14 @@ static int dbgp_setup(struct usb_gadget *gadget, |
3725 |
+ u16 len = 0; |
3726 |
+ |
3727 |
+ if (length > DBGP_REQ_LEN) { |
3728 |
+- if (ctrl->bRequestType == USB_DIR_OUT) { |
3729 |
+- return err; |
3730 |
+- } else { |
3731 |
++ if (ctrl->bRequestType & USB_DIR_IN) { |
3732 |
+ /* Cast away the const, we are going to overwrite on purpose. */ |
3733 |
+ __le16 *temp = (__le16 *)&ctrl->wLength; |
3734 |
+ |
3735 |
+ *temp = cpu_to_le16(DBGP_REQ_LEN); |
3736 |
+ length = DBGP_REQ_LEN; |
3737 |
++ } else { |
3738 |
++ return err; |
3739 |
+ } |
3740 |
+ } |
3741 |
+ |
3742 |
+diff --git a/drivers/usb/gadget/legacy/inode.c b/drivers/usb/gadget/legacy/inode.c |
3743 |
+index 0a4041552ed19..1b223cba4c2c9 100644 |
3744 |
+--- a/drivers/usb/gadget/legacy/inode.c |
3745 |
++++ b/drivers/usb/gadget/legacy/inode.c |
3746 |
+@@ -1337,14 +1337,14 @@ gadgetfs_setup (struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl) |
3747 |
+ u16 w_length = le16_to_cpu(ctrl->wLength); |
3748 |
+ |
3749 |
+ if (w_length > RBUF_SIZE) { |
3750 |
+- if (ctrl->bRequestType == USB_DIR_OUT) { |
3751 |
+- return value; |
3752 |
+- } else { |
3753 |
++ if (ctrl->bRequestType & USB_DIR_IN) { |
3754 |
+ /* Cast away the const, we are going to overwrite on purpose. */ |
3755 |
+ __le16 *temp = (__le16 *)&ctrl->wLength; |
3756 |
+ |
3757 |
+ *temp = cpu_to_le16(RBUF_SIZE); |
3758 |
+ w_length = RBUF_SIZE; |
3759 |
++ } else { |
3760 |
++ return value; |
3761 |
+ } |
3762 |
+ } |
3763 |
+ |
3764 |
+diff --git a/drivers/usb/host/xhci-mtk-sch.c b/drivers/usb/host/xhci-mtk-sch.c |
3765 |
+index 134f4789bd897..b4c84b3635074 100644 |
3766 |
+--- a/drivers/usb/host/xhci-mtk-sch.c |
3767 |
++++ b/drivers/usb/host/xhci-mtk-sch.c |
3768 |
+@@ -781,7 +781,7 @@ int xhci_mtk_check_bandwidth(struct usb_hcd *hcd, struct usb_device *udev) |
3769 |
+ |
3770 |
+ ret = xhci_check_bandwidth(hcd, udev); |
3771 |
+ if (!ret) |
3772 |
+- INIT_LIST_HEAD(&mtk->bw_ep_chk_list); |
3773 |
++ list_del_init(&mtk->bw_ep_chk_list); |
3774 |
+ |
3775 |
+ return ret; |
3776 |
+ } |
3777 |
+diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c |
3778 |
+index 1d8a4c089a858..8c04a7d73388b 100644 |
3779 |
+--- a/drivers/usb/host/xhci-pci.c |
3780 |
++++ b/drivers/usb/host/xhci-pci.c |
3781 |
+@@ -71,6 +71,8 @@ |
3782 |
+ #define PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_4 0x161e |
3783 |
+ #define PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_5 0x15d6 |
3784 |
+ #define PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_6 0x15d7 |
3785 |
++#define PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_7 0x161c |
3786 |
++#define PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_8 0x161f |
3787 |
+ |
3788 |
+ #define PCI_DEVICE_ID_ASMEDIA_1042_XHCI 0x1042 |
3789 |
+ #define PCI_DEVICE_ID_ASMEDIA_1042A_XHCI 0x1142 |
3790 |
+@@ -330,7 +332,9 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) |
3791 |
+ pdev->device == PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_3 || |
3792 |
+ pdev->device == PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_4 || |
3793 |
+ pdev->device == PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_5 || |
3794 |
+- pdev->device == PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_6)) |
3795 |
++ pdev->device == PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_6 || |
3796 |
++ pdev->device == PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_7 || |
3797 |
++ pdev->device == PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_8)) |
3798 |
+ xhci->quirks |= XHCI_DEFAULT_PM_RUNTIME_ALLOW; |
3799 |
+ |
3800 |
+ if (xhci->quirks & XHCI_RESET_ON_RESUME) |
3801 |
+diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c |
3802 |
+index 189279869a8b0..22e62c01c0aa8 100644 |
3803 |
+--- a/drivers/usb/serial/cp210x.c |
3804 |
++++ b/drivers/usb/serial/cp210x.c |
3805 |
+@@ -1682,6 +1682,8 @@ static int cp2105_gpioconf_init(struct usb_serial *serial) |
3806 |
+ |
3807 |
+ /* 2 banks of GPIO - One for the pins taken from each serial port */ |
3808 |
+ if (intf_num == 0) { |
3809 |
++ priv->gc.ngpio = 2; |
3810 |
++ |
3811 |
+ if (mode.eci == CP210X_PIN_MODE_MODEM) { |
3812 |
+ /* mark all GPIOs of this interface as reserved */ |
3813 |
+ priv->gpio_altfunc = 0xff; |
3814 |
+@@ -1692,8 +1694,9 @@ static int cp2105_gpioconf_init(struct usb_serial *serial) |
3815 |
+ priv->gpio_pushpull = (u8)((le16_to_cpu(config.gpio_mode) & |
3816 |
+ CP210X_ECI_GPIO_MODE_MASK) >> |
3817 |
+ CP210X_ECI_GPIO_MODE_OFFSET); |
3818 |
+- priv->gc.ngpio = 2; |
3819 |
+ } else if (intf_num == 1) { |
3820 |
++ priv->gc.ngpio = 3; |
3821 |
++ |
3822 |
+ if (mode.sci == CP210X_PIN_MODE_MODEM) { |
3823 |
+ /* mark all GPIOs of this interface as reserved */ |
3824 |
+ priv->gpio_altfunc = 0xff; |
3825 |
+@@ -1704,7 +1707,6 @@ static int cp2105_gpioconf_init(struct usb_serial *serial) |
3826 |
+ priv->gpio_pushpull = (u8)((le16_to_cpu(config.gpio_mode) & |
3827 |
+ CP210X_SCI_GPIO_MODE_MASK) >> |
3828 |
+ CP210X_SCI_GPIO_MODE_OFFSET); |
3829 |
+- priv->gc.ngpio = 3; |
3830 |
+ } else { |
3831 |
+ return -ENODEV; |
3832 |
+ } |
3833 |
+diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c |
3834 |
+index 546fce4617a85..42420bfc983c2 100644 |
3835 |
+--- a/drivers/usb/serial/option.c |
3836 |
++++ b/drivers/usb/serial/option.c |
3837 |
+@@ -1219,6 +1219,14 @@ static const struct usb_device_id option_ids[] = { |
3838 |
+ .driver_info = NCTRL(2) | RSVD(3) }, |
3839 |
+ { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1063, 0xff), /* Telit LN920 (ECM) */ |
3840 |
+ .driver_info = NCTRL(0) | RSVD(1) }, |
3841 |
++ { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1070, 0xff), /* Telit FN990 (rmnet) */ |
3842 |
++ .driver_info = NCTRL(0) | RSVD(1) | RSVD(2) }, |
3843 |
++ { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1071, 0xff), /* Telit FN990 (MBIM) */ |
3844 |
++ .driver_info = NCTRL(0) | RSVD(1) }, |
3845 |
++ { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1072, 0xff), /* Telit FN990 (RNDIS) */ |
3846 |
++ .driver_info = NCTRL(2) | RSVD(3) }, |
3847 |
++ { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1073, 0xff), /* Telit FN990 (ECM) */ |
3848 |
++ .driver_info = NCTRL(0) | RSVD(1) }, |
3849 |
+ { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_ME910), |
3850 |
+ .driver_info = NCTRL(0) | RSVD(1) | RSVD(3) }, |
3851 |
+ { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_ME910_DUAL_MODEM), |
3852 |
+diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c |
3853 |
+index 6010b99011261..59d4fa2443f2b 100644 |
3854 |
+--- a/drivers/usb/typec/tcpm/tcpm.c |
3855 |
++++ b/drivers/usb/typec/tcpm/tcpm.c |
3856 |
+@@ -324,6 +324,7 @@ struct tcpm_port { |
3857 |
+ |
3858 |
+ bool attached; |
3859 |
+ bool connected; |
3860 |
++ bool registered; |
3861 |
+ bool pd_supported; |
3862 |
+ enum typec_port_type port_type; |
3863 |
+ |
3864 |
+@@ -6291,7 +6292,8 @@ static enum hrtimer_restart state_machine_timer_handler(struct hrtimer *timer) |
3865 |
+ { |
3866 |
+ struct tcpm_port *port = container_of(timer, struct tcpm_port, state_machine_timer); |
3867 |
+ |
3868 |
+- kthread_queue_work(port->wq, &port->state_machine); |
3869 |
++ if (port->registered) |
3870 |
++ kthread_queue_work(port->wq, &port->state_machine); |
3871 |
+ return HRTIMER_NORESTART; |
3872 |
+ } |
3873 |
+ |
3874 |
+@@ -6299,7 +6301,8 @@ static enum hrtimer_restart vdm_state_machine_timer_handler(struct hrtimer *time |
3875 |
+ { |
3876 |
+ struct tcpm_port *port = container_of(timer, struct tcpm_port, vdm_state_machine_timer); |
3877 |
+ |
3878 |
+- kthread_queue_work(port->wq, &port->vdm_state_machine); |
3879 |
++ if (port->registered) |
3880 |
++ kthread_queue_work(port->wq, &port->vdm_state_machine); |
3881 |
+ return HRTIMER_NORESTART; |
3882 |
+ } |
3883 |
+ |
3884 |
+@@ -6307,7 +6310,8 @@ static enum hrtimer_restart enable_frs_timer_handler(struct hrtimer *timer) |
3885 |
+ { |
3886 |
+ struct tcpm_port *port = container_of(timer, struct tcpm_port, enable_frs_timer); |
3887 |
+ |
3888 |
+- kthread_queue_work(port->wq, &port->enable_frs); |
3889 |
++ if (port->registered) |
3890 |
++ kthread_queue_work(port->wq, &port->enable_frs); |
3891 |
+ return HRTIMER_NORESTART; |
3892 |
+ } |
3893 |
+ |
3894 |
+@@ -6315,7 +6319,8 @@ static enum hrtimer_restart send_discover_timer_handler(struct hrtimer *timer) |
3895 |
+ { |
3896 |
+ struct tcpm_port *port = container_of(timer, struct tcpm_port, send_discover_timer); |
3897 |
+ |
3898 |
+- kthread_queue_work(port->wq, &port->send_discover_work); |
3899 |
++ if (port->registered) |
3900 |
++ kthread_queue_work(port->wq, &port->send_discover_work); |
3901 |
+ return HRTIMER_NORESTART; |
3902 |
+ } |
3903 |
+ |
3904 |
+@@ -6403,6 +6408,7 @@ struct tcpm_port *tcpm_register_port(struct device *dev, struct tcpc_dev *tcpc) |
3905 |
+ typec_port_register_altmodes(port->typec_port, |
3906 |
+ &tcpm_altmode_ops, port, |
3907 |
+ port->port_altmode, ALTMODE_DISCOVERY_MAX); |
3908 |
++ port->registered = true; |
3909 |
+ |
3910 |
+ mutex_lock(&port->lock); |
3911 |
+ tcpm_init(port); |
3912 |
+@@ -6424,6 +6430,9 @@ void tcpm_unregister_port(struct tcpm_port *port) |
3913 |
+ { |
3914 |
+ int i; |
3915 |
+ |
3916 |
++ port->registered = false; |
3917 |
++ kthread_destroy_worker(port->wq); |
3918 |
++ |
3919 |
+ hrtimer_cancel(&port->send_discover_timer); |
3920 |
+ hrtimer_cancel(&port->enable_frs_timer); |
3921 |
+ hrtimer_cancel(&port->vdm_state_machine_timer); |
3922 |
+@@ -6435,7 +6444,6 @@ void tcpm_unregister_port(struct tcpm_port *port) |
3923 |
+ typec_unregister_port(port->typec_port); |
3924 |
+ usb_role_switch_put(port->role_sw); |
3925 |
+ tcpm_debugfs_exit(port); |
3926 |
+- kthread_destroy_worker(port->wq); |
3927 |
+ } |
3928 |
+ EXPORT_SYMBOL_GPL(tcpm_unregister_port); |
3929 |
+ |
3930 |
+diff --git a/drivers/vdpa/vdpa.c b/drivers/vdpa/vdpa.c |
3931 |
+index 1dc121a07a934..12bf3d16a40ff 100644 |
3932 |
+--- a/drivers/vdpa/vdpa.c |
3933 |
++++ b/drivers/vdpa/vdpa.c |
3934 |
+@@ -353,7 +353,8 @@ static int vdpa_mgmtdev_fill(const struct vdpa_mgmt_dev *mdev, struct sk_buff *m |
3935 |
+ goto msg_err; |
3936 |
+ |
3937 |
+ while (mdev->id_table[i].device) { |
3938 |
+- supported_classes |= BIT(mdev->id_table[i].device); |
3939 |
++ if (mdev->id_table[i].device <= 63) |
3940 |
++ supported_classes |= BIT_ULL(mdev->id_table[i].device); |
3941 |
+ i++; |
3942 |
+ } |
3943 |
+ |
3944 |
+diff --git a/drivers/vdpa/vdpa_user/vduse_dev.c b/drivers/vdpa/vdpa_user/vduse_dev.c |
3945 |
+index 841667a896dd0..8c3de5a76282a 100644 |
3946 |
+--- a/drivers/vdpa/vdpa_user/vduse_dev.c |
3947 |
++++ b/drivers/vdpa/vdpa_user/vduse_dev.c |
3948 |
+@@ -655,7 +655,8 @@ static void vduse_vdpa_get_config(struct vdpa_device *vdpa, unsigned int offset, |
3949 |
+ { |
3950 |
+ struct vduse_dev *dev = vdpa_to_vduse(vdpa); |
3951 |
+ |
3952 |
+- if (len > dev->config_size - offset) |
3953 |
++ if (offset > dev->config_size || |
3954 |
++ len > dev->config_size - offset) |
3955 |
+ return; |
3956 |
+ |
3957 |
+ memcpy(buf, dev->config + offset, len); |
3958 |
+@@ -975,7 +976,8 @@ static long vduse_dev_ioctl(struct file *file, unsigned int cmd, |
3959 |
+ break; |
3960 |
+ |
3961 |
+ ret = -EINVAL; |
3962 |
+- if (config.length == 0 || |
3963 |
++ if (config.offset > dev->config_size || |
3964 |
++ config.length == 0 || |
3965 |
+ config.length > dev->config_size - config.offset) |
3966 |
+ break; |
3967 |
+ |
3968 |
+diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c |
3969 |
+index 39039e0461175..d62f05d056b7b 100644 |
3970 |
+--- a/drivers/vhost/vdpa.c |
3971 |
++++ b/drivers/vhost/vdpa.c |
3972 |
+@@ -197,7 +197,7 @@ static int vhost_vdpa_config_validate(struct vhost_vdpa *v, |
3973 |
+ struct vdpa_device *vdpa = v->vdpa; |
3974 |
+ long size = vdpa->config->get_config_size(vdpa); |
3975 |
+ |
3976 |
+- if (c->len == 0) |
3977 |
++ if (c->len == 0 || c->off > size) |
3978 |
+ return -EINVAL; |
3979 |
+ |
3980 |
+ if (c->len > size - c->off) |
3981 |
+diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c |
3982 |
+index d1f47327f6cfe..9919407973cd5 100644 |
3983 |
+--- a/drivers/virtio/virtio_ring.c |
3984 |
++++ b/drivers/virtio/virtio_ring.c |
3985 |
+@@ -268,7 +268,7 @@ size_t virtio_max_dma_size(struct virtio_device *vdev) |
3986 |
+ size_t max_segment_size = SIZE_MAX; |
3987 |
+ |
3988 |
+ if (vring_use_dma_api(vdev)) |
3989 |
+- max_segment_size = dma_max_mapping_size(&vdev->dev); |
3990 |
++ max_segment_size = dma_max_mapping_size(vdev->dev.parent); |
3991 |
+ |
3992 |
+ return max_segment_size; |
3993 |
+ } |
3994 |
+diff --git a/drivers/xen/events/events_base.c b/drivers/xen/events/events_base.c |
3995 |
+index a78704ae36186..46d9295d9a6e4 100644 |
3996 |
+--- a/drivers/xen/events/events_base.c |
3997 |
++++ b/drivers/xen/events/events_base.c |
3998 |
+@@ -1251,6 +1251,12 @@ int bind_evtchn_to_irq(evtchn_port_t evtchn) |
3999 |
+ } |
4000 |
+ EXPORT_SYMBOL_GPL(bind_evtchn_to_irq); |
4001 |
+ |
4002 |
++int bind_evtchn_to_irq_lateeoi(evtchn_port_t evtchn) |
4003 |
++{ |
4004 |
++ return bind_evtchn_to_irq_chip(evtchn, &xen_lateeoi_chip, NULL); |
4005 |
++} |
4006 |
++EXPORT_SYMBOL_GPL(bind_evtchn_to_irq_lateeoi); |
4007 |
++ |
4008 |
+ static int bind_ipi_to_irq(unsigned int ipi, unsigned int cpu) |
4009 |
+ { |
4010 |
+ struct evtchn_bind_ipi bind_ipi; |
4011 |
+diff --git a/fs/afs/file.c b/fs/afs/file.c |
4012 |
+index e6c447ae91f38..b165377179c3c 100644 |
4013 |
+--- a/fs/afs/file.c |
4014 |
++++ b/fs/afs/file.c |
4015 |
+@@ -502,8 +502,9 @@ static void afs_add_open_mmap(struct afs_vnode *vnode) |
4016 |
+ if (atomic_inc_return(&vnode->cb_nr_mmap) == 1) { |
4017 |
+ down_write(&vnode->volume->cell->fs_open_mmaps_lock); |
4018 |
+ |
4019 |
+- list_add_tail(&vnode->cb_mmap_link, |
4020 |
+- &vnode->volume->cell->fs_open_mmaps); |
4021 |
++ if (list_empty(&vnode->cb_mmap_link)) |
4022 |
++ list_add_tail(&vnode->cb_mmap_link, |
4023 |
++ &vnode->volume->cell->fs_open_mmaps); |
4024 |
+ |
4025 |
+ up_write(&vnode->volume->cell->fs_open_mmaps_lock); |
4026 |
+ } |
4027 |
+diff --git a/fs/afs/super.c b/fs/afs/super.c |
4028 |
+index d110def8aa8eb..34c68724c98be 100644 |
4029 |
+--- a/fs/afs/super.c |
4030 |
++++ b/fs/afs/super.c |
4031 |
+@@ -667,6 +667,7 @@ static void afs_i_init_once(void *_vnode) |
4032 |
+ INIT_LIST_HEAD(&vnode->pending_locks); |
4033 |
+ INIT_LIST_HEAD(&vnode->granted_locks); |
4034 |
+ INIT_DELAYED_WORK(&vnode->lock_work, afs_lock_work); |
4035 |
++ INIT_LIST_HEAD(&vnode->cb_mmap_link); |
4036 |
+ seqlock_init(&vnode->cb_lock); |
4037 |
+ } |
4038 |
+ |
4039 |
+diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c |
4040 |
+index c37239c8ac0c6..e1a262120e021 100644 |
4041 |
+--- a/fs/btrfs/disk-io.c |
4042 |
++++ b/fs/btrfs/disk-io.c |
4043 |
+@@ -1731,6 +1731,14 @@ again: |
4044 |
+ } |
4045 |
+ return root; |
4046 |
+ fail: |
4047 |
++ /* |
4048 |
++ * If our caller provided us an anonymous device, then it's his |
4049 |
++ * responsability to free it in case we fail. So we have to set our |
4050 |
++ * root's anon_dev to 0 to avoid a double free, once by btrfs_put_root() |
4051 |
++ * and once again by our caller. |
4052 |
++ */ |
4053 |
++ if (anon_dev) |
4054 |
++ root->anon_dev = 0; |
4055 |
+ btrfs_put_root(root); |
4056 |
+ return ERR_PTR(ret); |
4057 |
+ } |
4058 |
+@@ -3229,12 +3237,12 @@ int __cold open_ctree(struct super_block *sb, struct btrfs_fs_devices *fs_device |
4059 |
+ mapping_set_gfp_mask(fs_info->btree_inode->i_mapping, GFP_NOFS); |
4060 |
+ btrfs_init_btree_inode(fs_info); |
4061 |
+ |
4062 |
+- invalidate_bdev(fs_devices->latest_bdev); |
4063 |
++ invalidate_bdev(fs_devices->latest_dev->bdev); |
4064 |
+ |
4065 |
+ /* |
4066 |
+ * Read super block and check the signature bytes only |
4067 |
+ */ |
4068 |
+- disk_super = btrfs_read_dev_super(fs_devices->latest_bdev); |
4069 |
++ disk_super = btrfs_read_dev_super(fs_devices->latest_dev->bdev); |
4070 |
+ if (IS_ERR(disk_super)) { |
4071 |
+ err = PTR_ERR(disk_super); |
4072 |
+ goto fail_alloc; |
4073 |
+@@ -3466,7 +3474,7 @@ int __cold open_ctree(struct super_block *sb, struct btrfs_fs_devices *fs_device |
4074 |
+ * below in btrfs_init_dev_replace(). |
4075 |
+ */ |
4076 |
+ btrfs_free_extra_devids(fs_devices); |
4077 |
+- if (!fs_devices->latest_bdev) { |
4078 |
++ if (!fs_devices->latest_dev->bdev) { |
4079 |
+ btrfs_err(fs_info, "failed to read devices"); |
4080 |
+ goto fail_tree_roots; |
4081 |
+ } |
4082 |
+diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c |
4083 |
+index beac825edca1b..250fd3c146ac9 100644 |
4084 |
+--- a/fs/btrfs/extent_io.c |
4085 |
++++ b/fs/btrfs/extent_io.c |
4086 |
+@@ -3327,7 +3327,7 @@ static int alloc_new_bio(struct btrfs_inode *inode, |
4087 |
+ if (wbc) { |
4088 |
+ struct block_device *bdev; |
4089 |
+ |
4090 |
+- bdev = fs_info->fs_devices->latest_bdev; |
4091 |
++ bdev = fs_info->fs_devices->latest_dev->bdev; |
4092 |
+ bio_set_dev(bio, bdev); |
4093 |
+ wbc_init_bio(wbc, bio); |
4094 |
+ } |
4095 |
+@@ -6547,6 +6547,14 @@ int read_extent_buffer_pages(struct extent_buffer *eb, int wait, int mirror_num) |
4096 |
+ if (test_bit(EXTENT_BUFFER_UPTODATE, &eb->bflags)) |
4097 |
+ return 0; |
4098 |
+ |
4099 |
++ /* |
4100 |
++ * We could have had EXTENT_BUFFER_UPTODATE cleared by the write |
4101 |
++ * operation, which could potentially still be in flight. In this case |
4102 |
++ * we simply want to return an error. |
4103 |
++ */ |
4104 |
++ if (unlikely(test_bit(EXTENT_BUFFER_WRITE_ERR, &eb->bflags))) |
4105 |
++ return -EIO; |
4106 |
++ |
4107 |
+ if (eb->fs_info->sectorsize < PAGE_SIZE) |
4108 |
+ return read_extent_buffer_subpage(eb, wait, mirror_num); |
4109 |
+ |
4110 |
+diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c |
4111 |
+index 61b4651f008d4..4af74b62e7d97 100644 |
4112 |
+--- a/fs/btrfs/inode.c |
4113 |
++++ b/fs/btrfs/inode.c |
4114 |
+@@ -7967,7 +7967,7 @@ static int btrfs_dio_iomap_begin(struct inode *inode, loff_t start, |
4115 |
+ iomap->type = IOMAP_MAPPED; |
4116 |
+ } |
4117 |
+ iomap->offset = start; |
4118 |
+- iomap->bdev = fs_info->fs_devices->latest_bdev; |
4119 |
++ iomap->bdev = fs_info->fs_devices->latest_dev->bdev; |
4120 |
+ iomap->length = len; |
4121 |
+ |
4122 |
+ if (write && btrfs_use_zone_append(BTRFS_I(inode), em->block_start)) |
4123 |
+diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c |
4124 |
+index 537d90bf5d844..7f91d62c2225a 100644 |
4125 |
+--- a/fs/btrfs/super.c |
4126 |
++++ b/fs/btrfs/super.c |
4127 |
+@@ -1705,7 +1705,7 @@ static struct dentry *btrfs_mount_root(struct file_system_type *fs_type, |
4128 |
+ goto error_close_devices; |
4129 |
+ } |
4130 |
+ |
4131 |
+- bdev = fs_devices->latest_bdev; |
4132 |
++ bdev = fs_devices->latest_dev->bdev; |
4133 |
+ s = sget(fs_type, btrfs_test_super, btrfs_set_super, flags | SB_NOSEC, |
4134 |
+ fs_info); |
4135 |
+ if (IS_ERR(s)) { |
4136 |
+@@ -2463,30 +2463,16 @@ static int btrfs_unfreeze(struct super_block *sb) |
4137 |
+ static int btrfs_show_devname(struct seq_file *m, struct dentry *root) |
4138 |
+ { |
4139 |
+ struct btrfs_fs_info *fs_info = btrfs_sb(root->d_sb); |
4140 |
+- struct btrfs_device *dev, *first_dev = NULL; |
4141 |
+ |
4142 |
+ /* |
4143 |
+- * Lightweight locking of the devices. We should not need |
4144 |
+- * device_list_mutex here as we only read the device data and the list |
4145 |
+- * is protected by RCU. Even if a device is deleted during the list |
4146 |
+- * traversals, we'll get valid data, the freeing callback will wait at |
4147 |
+- * least until the rcu_read_unlock. |
4148 |
++ * There should be always a valid pointer in latest_dev, it may be stale |
4149 |
++ * for a short moment in case it's being deleted but still valid until |
4150 |
++ * the end of RCU grace period. |
4151 |
+ */ |
4152 |
+ rcu_read_lock(); |
4153 |
+- list_for_each_entry_rcu(dev, &fs_info->fs_devices->devices, dev_list) { |
4154 |
+- if (test_bit(BTRFS_DEV_STATE_MISSING, &dev->dev_state)) |
4155 |
+- continue; |
4156 |
+- if (!dev->name) |
4157 |
+- continue; |
4158 |
+- if (!first_dev || dev->devid < first_dev->devid) |
4159 |
+- first_dev = dev; |
4160 |
+- } |
4161 |
+- |
4162 |
+- if (first_dev) |
4163 |
+- seq_escape(m, rcu_str_deref(first_dev->name), " \t\n\\"); |
4164 |
+- else |
4165 |
+- WARN_ON(1); |
4166 |
++ seq_escape(m, rcu_str_deref(fs_info->fs_devices->latest_dev->name), " \t\n\\"); |
4167 |
+ rcu_read_unlock(); |
4168 |
++ |
4169 |
+ return 0; |
4170 |
+ } |
4171 |
+ |
4172 |
+diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c |
4173 |
+index 110e63d6727d0..b79da8917cbfa 100644 |
4174 |
+--- a/fs/btrfs/tree-log.c |
4175 |
++++ b/fs/btrfs/tree-log.c |
4176 |
+@@ -1153,6 +1153,7 @@ again: |
4177 |
+ parent_objectid, victim_name, |
4178 |
+ victim_name_len); |
4179 |
+ if (ret < 0) { |
4180 |
++ kfree(victim_name); |
4181 |
+ return ret; |
4182 |
+ } else if (!ret) { |
4183 |
+ ret = -ENOENT; |
4184 |
+diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c |
4185 |
+index 7bf09ca82137a..c34efdc1ecddb 100644 |
4186 |
+--- a/fs/btrfs/volumes.c |
4187 |
++++ b/fs/btrfs/volumes.c |
4188 |
+@@ -1092,7 +1092,7 @@ void btrfs_free_extra_devids(struct btrfs_fs_devices *fs_devices) |
4189 |
+ list_for_each_entry(seed_dev, &fs_devices->seed_list, seed_list) |
4190 |
+ __btrfs_free_extra_devids(seed_dev, &latest_dev); |
4191 |
+ |
4192 |
+- fs_devices->latest_bdev = latest_dev->bdev; |
4193 |
++ fs_devices->latest_dev = latest_dev; |
4194 |
+ |
4195 |
+ mutex_unlock(&uuid_mutex); |
4196 |
+ } |
4197 |
+@@ -1225,7 +1225,7 @@ static int open_fs_devices(struct btrfs_fs_devices *fs_devices, |
4198 |
+ return -EINVAL; |
4199 |
+ |
4200 |
+ fs_devices->opened = 1; |
4201 |
+- fs_devices->latest_bdev = latest_dev->bdev; |
4202 |
++ fs_devices->latest_dev = latest_dev; |
4203 |
+ fs_devices->total_rw_bytes = 0; |
4204 |
+ fs_devices->chunk_alloc_policy = BTRFS_CHUNK_ALLOC_REGULAR; |
4205 |
+ fs_devices->read_policy = BTRFS_READ_POLICY_PID; |
4206 |
+@@ -1366,8 +1366,10 @@ struct btrfs_device *btrfs_scan_one_device(const char *path, fmode_t flags, |
4207 |
+ |
4208 |
+ bytenr_orig = btrfs_sb_offset(0); |
4209 |
+ ret = btrfs_sb_log_location_bdev(bdev, 0, READ, &bytenr); |
4210 |
+- if (ret) |
4211 |
+- return ERR_PTR(ret); |
4212 |
++ if (ret) { |
4213 |
++ device = ERR_PTR(ret); |
4214 |
++ goto error_bdev_put; |
4215 |
++ } |
4216 |
+ |
4217 |
+ disk_super = btrfs_read_disk_super(bdev, bytenr, bytenr_orig); |
4218 |
+ if (IS_ERR(disk_super)) { |
4219 |
+@@ -1993,7 +1995,7 @@ static struct btrfs_device * btrfs_find_next_active_device( |
4220 |
+ } |
4221 |
+ |
4222 |
+ /* |
4223 |
+- * Helper function to check if the given device is part of s_bdev / latest_bdev |
4224 |
++ * Helper function to check if the given device is part of s_bdev / latest_dev |
4225 |
+ * and replace it with the provided or the next active device, in the context |
4226 |
+ * where this function called, there should be always be another device (or |
4227 |
+ * this_dev) which is active. |
4228 |
+@@ -2012,8 +2014,8 @@ void __cold btrfs_assign_next_active_device(struct btrfs_device *device, |
4229 |
+ (fs_info->sb->s_bdev == device->bdev)) |
4230 |
+ fs_info->sb->s_bdev = next_device->bdev; |
4231 |
+ |
4232 |
+- if (fs_info->fs_devices->latest_bdev == device->bdev) |
4233 |
+- fs_info->fs_devices->latest_bdev = next_device->bdev; |
4234 |
++ if (fs_info->fs_devices->latest_dev->bdev == device->bdev) |
4235 |
++ fs_info->fs_devices->latest_dev = next_device; |
4236 |
+ } |
4237 |
+ |
4238 |
+ /* |
4239 |
+@@ -2312,13 +2314,6 @@ void btrfs_destroy_dev_replace_tgtdev(struct btrfs_device *tgtdev) |
4240 |
+ |
4241 |
+ mutex_unlock(&fs_devices->device_list_mutex); |
4242 |
+ |
4243 |
+- /* |
4244 |
+- * The update_dev_time() with in btrfs_scratch_superblocks() |
4245 |
+- * may lead to a call to btrfs_show_devname() which will try |
4246 |
+- * to hold device_list_mutex. And here this device |
4247 |
+- * is already out of device list, so we don't have to hold |
4248 |
+- * the device_list_mutex lock. |
4249 |
+- */ |
4250 |
+ btrfs_scratch_superblocks(tgtdev->fs_info, tgtdev->bdev, |
4251 |
+ tgtdev->name->str); |
4252 |
+ |
4253 |
+@@ -2634,6 +2629,8 @@ int btrfs_init_new_device(struct btrfs_fs_info *fs_info, const char *device_path |
4254 |
+ btrfs_abort_transaction(trans, ret); |
4255 |
+ goto error_trans; |
4256 |
+ } |
4257 |
++ btrfs_assign_next_active_device(fs_info->fs_devices->latest_dev, |
4258 |
++ device); |
4259 |
+ } |
4260 |
+ |
4261 |
+ device->fs_devices = fs_devices; |
4262 |
+diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h |
4263 |
+index 2183361db614d..4db10d071d67f 100644 |
4264 |
+--- a/fs/btrfs/volumes.h |
4265 |
++++ b/fs/btrfs/volumes.h |
4266 |
+@@ -246,7 +246,11 @@ struct btrfs_fs_devices { |
4267 |
+ /* Highest generation number of seen devices */ |
4268 |
+ u64 latest_generation; |
4269 |
+ |
4270 |
+- struct block_device *latest_bdev; |
4271 |
++ /* |
4272 |
++ * The mount device or a device with highest generation after removal |
4273 |
++ * or replace. |
4274 |
++ */ |
4275 |
++ struct btrfs_device *latest_dev; |
4276 |
+ |
4277 |
+ /* all of the devices in the FS, protected by a mutex |
4278 |
+ * so we can safely walk it to write out the supers without |
4279 |
+diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c |
4280 |
+index 8f537f1d9d1d3..8be4da2e2b826 100644 |
4281 |
+--- a/fs/ceph/caps.c |
4282 |
++++ b/fs/ceph/caps.c |
4283 |
+@@ -4349,7 +4349,7 @@ void ceph_get_fmode(struct ceph_inode_info *ci, int fmode, int count) |
4284 |
+ { |
4285 |
+ struct ceph_mds_client *mdsc = ceph_sb_to_mdsc(ci->vfs_inode.i_sb); |
4286 |
+ int bits = (fmode << 1) | 1; |
4287 |
+- bool is_opened = false; |
4288 |
++ bool already_opened = false; |
4289 |
+ int i; |
4290 |
+ |
4291 |
+ if (count == 1) |
4292 |
+@@ -4357,19 +4357,19 @@ void ceph_get_fmode(struct ceph_inode_info *ci, int fmode, int count) |
4293 |
+ |
4294 |
+ spin_lock(&ci->i_ceph_lock); |
4295 |
+ for (i = 0; i < CEPH_FILE_MODE_BITS; i++) { |
4296 |
+- if (bits & (1 << i)) |
4297 |
+- ci->i_nr_by_mode[i] += count; |
4298 |
+- |
4299 |
+ /* |
4300 |
+- * If any of the mode ref is larger than 1, |
4301 |
++ * If any of the mode ref is larger than 0, |
4302 |
+ * that means it has been already opened by |
4303 |
+ * others. Just skip checking the PIN ref. |
4304 |
+ */ |
4305 |
+- if (i && ci->i_nr_by_mode[i] > 1) |
4306 |
+- is_opened = true; |
4307 |
++ if (i && ci->i_nr_by_mode[i]) |
4308 |
++ already_opened = true; |
4309 |
++ |
4310 |
++ if (bits & (1 << i)) |
4311 |
++ ci->i_nr_by_mode[i] += count; |
4312 |
+ } |
4313 |
+ |
4314 |
+- if (!is_opened) |
4315 |
++ if (!already_opened) |
4316 |
+ percpu_counter_inc(&mdsc->metric.opened_inodes); |
4317 |
+ spin_unlock(&ci->i_ceph_lock); |
4318 |
+ } |
4319 |
+diff --git a/fs/ceph/file.c b/fs/ceph/file.c |
4320 |
+index e61018d9764ee..e873c2ba7a7ff 100644 |
4321 |
+--- a/fs/ceph/file.c |
4322 |
++++ b/fs/ceph/file.c |
4323 |
+@@ -603,13 +603,25 @@ static int ceph_finish_async_create(struct inode *dir, struct dentry *dentry, |
4324 |
+ in.cap.realm = cpu_to_le64(ci->i_snap_realm->ino); |
4325 |
+ in.cap.flags = CEPH_CAP_FLAG_AUTH; |
4326 |
+ in.ctime = in.mtime = in.atime = iinfo.btime; |
4327 |
+- in.mode = cpu_to_le32((u32)mode); |
4328 |
+ in.truncate_seq = cpu_to_le32(1); |
4329 |
+ in.truncate_size = cpu_to_le64(-1ULL); |
4330 |
+ in.xattr_version = cpu_to_le64(1); |
4331 |
+ in.uid = cpu_to_le32(from_kuid(&init_user_ns, current_fsuid())); |
4332 |
+- in.gid = cpu_to_le32(from_kgid(&init_user_ns, dir->i_mode & S_ISGID ? |
4333 |
+- dir->i_gid : current_fsgid())); |
4334 |
++ if (dir->i_mode & S_ISGID) { |
4335 |
++ in.gid = cpu_to_le32(from_kgid(&init_user_ns, dir->i_gid)); |
4336 |
++ |
4337 |
++ /* Directories always inherit the setgid bit. */ |
4338 |
++ if (S_ISDIR(mode)) |
4339 |
++ mode |= S_ISGID; |
4340 |
++ else if ((mode & (S_ISGID | S_IXGRP)) == (S_ISGID | S_IXGRP) && |
4341 |
++ !in_group_p(dir->i_gid) && |
4342 |
++ !capable_wrt_inode_uidgid(&init_user_ns, dir, CAP_FSETID)) |
4343 |
++ mode &= ~S_ISGID; |
4344 |
++ } else { |
4345 |
++ in.gid = cpu_to_le32(from_kgid(&init_user_ns, current_fsgid())); |
4346 |
++ } |
4347 |
++ in.mode = cpu_to_le32((u32)mode); |
4348 |
++ |
4349 |
+ in.nlink = cpu_to_le32(1); |
4350 |
+ in.max_size = cpu_to_le64(lo->stripe_unit); |
4351 |
+ |
4352 |
+diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c |
4353 |
+index d64413adc0fd2..e9409c460acd0 100644 |
4354 |
+--- a/fs/ceph/mds_client.c |
4355 |
++++ b/fs/ceph/mds_client.c |
4356 |
+@@ -3772,7 +3772,7 @@ static int reconnect_caps_cb(struct inode *inode, struct ceph_cap *cap, |
4357 |
+ struct ceph_pagelist *pagelist = recon_state->pagelist; |
4358 |
+ struct dentry *dentry; |
4359 |
+ char *path; |
4360 |
+- int pathlen, err; |
4361 |
++ int pathlen = 0, err; |
4362 |
+ u64 pathbase; |
4363 |
+ u64 snap_follows; |
4364 |
+ |
4365 |
+@@ -3792,7 +3792,6 @@ static int reconnect_caps_cb(struct inode *inode, struct ceph_cap *cap, |
4366 |
+ } |
4367 |
+ } else { |
4368 |
+ path = NULL; |
4369 |
+- pathlen = 0; |
4370 |
+ pathbase = 0; |
4371 |
+ } |
4372 |
+ |
4373 |
+diff --git a/fs/cifs/fs_context.c b/fs/cifs/fs_context.c |
4374 |
+index 0e660d6ade20f..0a2542286552f 100644 |
4375 |
+--- a/fs/cifs/fs_context.c |
4376 |
++++ b/fs/cifs/fs_context.c |
4377 |
+@@ -431,6 +431,42 @@ out: |
4378 |
+ return rc; |
4379 |
+ } |
4380 |
+ |
4381 |
++/* |
4382 |
++ * Remove duplicate path delimiters. Windows is supposed to do that |
4383 |
++ * but there are some bugs that prevent rename from working if there are |
4384 |
++ * multiple delimiters. |
4385 |
++ * |
4386 |
++ * Returns a sanitized duplicate of @path. The caller is responsible for |
4387 |
++ * cleaning up the original. |
4388 |
++ */ |
4389 |
++#define IS_DELIM(c) ((c) == '/' || (c) == '\\') |
4390 |
++static char *sanitize_path(char *path) |
4391 |
++{ |
4392 |
++ char *cursor1 = path, *cursor2 = path; |
4393 |
++ |
4394 |
++ /* skip all prepended delimiters */ |
4395 |
++ while (IS_DELIM(*cursor1)) |
4396 |
++ cursor1++; |
4397 |
++ |
4398 |
++ /* copy the first letter */ |
4399 |
++ *cursor2 = *cursor1; |
4400 |
++ |
4401 |
++ /* copy the remainder... */ |
4402 |
++ while (*(cursor1++)) { |
4403 |
++ /* ... skipping all duplicated delimiters */ |
4404 |
++ if (IS_DELIM(*cursor1) && IS_DELIM(*cursor2)) |
4405 |
++ continue; |
4406 |
++ *(++cursor2) = *cursor1; |
4407 |
++ } |
4408 |
++ |
4409 |
++ /* if the last character is a delimiter, skip it */ |
4410 |
++ if (IS_DELIM(*(cursor2 - 1))) |
4411 |
++ cursor2--; |
4412 |
++ |
4413 |
++ *(cursor2) = '\0'; |
4414 |
++ return kstrdup(path, GFP_KERNEL); |
4415 |
++} |
4416 |
++ |
4417 |
+ /* |
4418 |
+ * Parse a devname into substrings and populate the ctx->UNC and ctx->prepath |
4419 |
+ * fields with the result. Returns 0 on success and an error otherwise |
4420 |
+@@ -490,7 +526,7 @@ smb3_parse_devname(const char *devname, struct smb3_fs_context *ctx) |
4421 |
+ if (!*pos) |
4422 |
+ return 0; |
4423 |
+ |
4424 |
+- ctx->prepath = kstrdup(pos, GFP_KERNEL); |
4425 |
++ ctx->prepath = sanitize_path(pos); |
4426 |
+ if (!ctx->prepath) |
4427 |
+ return -ENOMEM; |
4428 |
+ |
4429 |
+diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c |
4430 |
+index 2798fbe8d0018..80a2181b402b2 100644 |
4431 |
+--- a/fs/fuse/dir.c |
4432 |
++++ b/fs/fuse/dir.c |
4433 |
+@@ -1079,7 +1079,7 @@ int fuse_reverse_inval_entry(struct fuse_conn *fc, u64 parent_nodeid, |
4434 |
+ if (!parent) |
4435 |
+ return -ENOENT; |
4436 |
+ |
4437 |
+- inode_lock(parent); |
4438 |
++ inode_lock_nested(parent, I_MUTEX_PARENT); |
4439 |
+ if (!S_ISDIR(parent->i_mode)) |
4440 |
+ goto unlock; |
4441 |
+ |
4442 |
+diff --git a/fs/io-wq.c b/fs/io-wq.c |
4443 |
+index e8f77903d7757..01d4e3ff3170d 100644 |
4444 |
+--- a/fs/io-wq.c |
4445 |
++++ b/fs/io-wq.c |
4446 |
+@@ -141,6 +141,7 @@ static bool io_acct_cancel_pending_work(struct io_wqe *wqe, |
4447 |
+ struct io_wqe_acct *acct, |
4448 |
+ struct io_cb_cancel_data *match); |
4449 |
+ static void create_worker_cb(struct callback_head *cb); |
4450 |
++static void io_wq_cancel_tw_create(struct io_wq *wq); |
4451 |
+ |
4452 |
+ static bool io_worker_get(struct io_worker *worker) |
4453 |
+ { |
4454 |
+@@ -357,12 +358,22 @@ static bool io_queue_worker_create(struct io_worker *worker, |
4455 |
+ test_and_set_bit_lock(0, &worker->create_state)) |
4456 |
+ goto fail_release; |
4457 |
+ |
4458 |
++ atomic_inc(&wq->worker_refs); |
4459 |
+ init_task_work(&worker->create_work, func); |
4460 |
+ worker->create_index = acct->index; |
4461 |
+ if (!task_work_add(wq->task, &worker->create_work, TWA_SIGNAL)) { |
4462 |
+- clear_bit_unlock(0, &worker->create_state); |
4463 |
++ /* |
4464 |
++ * EXIT may have been set after checking it above, check after |
4465 |
++ * adding the task_work and remove any creation item if it is |
4466 |
++ * now set. wq exit does that too, but we can have added this |
4467 |
++ * work item after we canceled in io_wq_exit_workers(). |
4468 |
++ */ |
4469 |
++ if (test_bit(IO_WQ_BIT_EXIT, &wq->state)) |
4470 |
++ io_wq_cancel_tw_create(wq); |
4471 |
++ io_worker_ref_put(wq); |
4472 |
+ return true; |
4473 |
+ } |
4474 |
++ io_worker_ref_put(wq); |
4475 |
+ clear_bit_unlock(0, &worker->create_state); |
4476 |
+ fail_release: |
4477 |
+ io_worker_release(worker); |
4478 |
+@@ -384,7 +395,9 @@ static void io_wqe_dec_running(struct io_worker *worker) |
4479 |
+ if (atomic_dec_and_test(&acct->nr_running) && io_acct_run_queue(acct)) { |
4480 |
+ atomic_inc(&acct->nr_running); |
4481 |
+ atomic_inc(&wqe->wq->worker_refs); |
4482 |
++ raw_spin_unlock(&wqe->lock); |
4483 |
+ io_queue_worker_create(worker, acct, create_worker_cb); |
4484 |
++ raw_spin_lock(&wqe->lock); |
4485 |
+ } |
4486 |
+ } |
4487 |
+ |
4488 |
+@@ -1195,13 +1208,9 @@ void io_wq_exit_start(struct io_wq *wq) |
4489 |
+ set_bit(IO_WQ_BIT_EXIT, &wq->state); |
4490 |
+ } |
4491 |
+ |
4492 |
+-static void io_wq_exit_workers(struct io_wq *wq) |
4493 |
++static void io_wq_cancel_tw_create(struct io_wq *wq) |
4494 |
+ { |
4495 |
+ struct callback_head *cb; |
4496 |
+- int node; |
4497 |
+- |
4498 |
+- if (!wq->task) |
4499 |
+- return; |
4500 |
+ |
4501 |
+ while ((cb = task_work_cancel_match(wq->task, io_task_work_match, wq)) != NULL) { |
4502 |
+ struct io_worker *worker; |
4503 |
+@@ -1209,6 +1218,16 @@ static void io_wq_exit_workers(struct io_wq *wq) |
4504 |
+ worker = container_of(cb, struct io_worker, create_work); |
4505 |
+ io_worker_cancel_cb(worker); |
4506 |
+ } |
4507 |
++} |
4508 |
++ |
4509 |
++static void io_wq_exit_workers(struct io_wq *wq) |
4510 |
++{ |
4511 |
++ int node; |
4512 |
++ |
4513 |
++ if (!wq->task) |
4514 |
++ return; |
4515 |
++ |
4516 |
++ io_wq_cancel_tw_create(wq); |
4517 |
+ |
4518 |
+ rcu_read_lock(); |
4519 |
+ for_each_node(node) { |
4520 |
+diff --git a/fs/overlayfs/dir.c b/fs/overlayfs/dir.c |
4521 |
+index 93c7c267de934..f18490813170a 100644 |
4522 |
+--- a/fs/overlayfs/dir.c |
4523 |
++++ b/fs/overlayfs/dir.c |
4524 |
+@@ -137,8 +137,7 @@ kill_whiteout: |
4525 |
+ goto out; |
4526 |
+ } |
4527 |
+ |
4528 |
+-static int ovl_mkdir_real(struct inode *dir, struct dentry **newdentry, |
4529 |
+- umode_t mode) |
4530 |
++int ovl_mkdir_real(struct inode *dir, struct dentry **newdentry, umode_t mode) |
4531 |
+ { |
4532 |
+ int err; |
4533 |
+ struct dentry *d, *dentry = *newdentry; |
4534 |
+diff --git a/fs/overlayfs/overlayfs.h b/fs/overlayfs/overlayfs.h |
4535 |
+index 3894f33479552..2cd5741c873b6 100644 |
4536 |
+--- a/fs/overlayfs/overlayfs.h |
4537 |
++++ b/fs/overlayfs/overlayfs.h |
4538 |
+@@ -570,6 +570,7 @@ struct ovl_cattr { |
4539 |
+ |
4540 |
+ #define OVL_CATTR(m) (&(struct ovl_cattr) { .mode = (m) }) |
4541 |
+ |
4542 |
++int ovl_mkdir_real(struct inode *dir, struct dentry **newdentry, umode_t mode); |
4543 |
+ struct dentry *ovl_create_real(struct inode *dir, struct dentry *newdentry, |
4544 |
+ struct ovl_cattr *attr); |
4545 |
+ int ovl_cleanup(struct inode *dir, struct dentry *dentry); |
4546 |
+diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c |
4547 |
+index 178daa5e82c9d..265181c110ae2 100644 |
4548 |
+--- a/fs/overlayfs/super.c |
4549 |
++++ b/fs/overlayfs/super.c |
4550 |
+@@ -787,10 +787,14 @@ retry: |
4551 |
+ goto retry; |
4552 |
+ } |
4553 |
+ |
4554 |
+- work = ovl_create_real(dir, work, OVL_CATTR(attr.ia_mode)); |
4555 |
+- err = PTR_ERR(work); |
4556 |
+- if (IS_ERR(work)) |
4557 |
+- goto out_err; |
4558 |
++ err = ovl_mkdir_real(dir, &work, attr.ia_mode); |
4559 |
++ if (err) |
4560 |
++ goto out_dput; |
4561 |
++ |
4562 |
++ /* Weird filesystem returning with hashed negative (kernfs)? */ |
4563 |
++ err = -EINVAL; |
4564 |
++ if (d_really_is_negative(work)) |
4565 |
++ goto out_dput; |
4566 |
+ |
4567 |
+ /* |
4568 |
+ * Try to remove POSIX ACL xattrs from workdir. We are good if: |
4569 |
+diff --git a/fs/zonefs/super.c b/fs/zonefs/super.c |
4570 |
+index ddc346a9df9ba..807f33553a8eb 100644 |
4571 |
+--- a/fs/zonefs/super.c |
4572 |
++++ b/fs/zonefs/super.c |
4573 |
+@@ -1787,5 +1787,6 @@ static void __exit zonefs_exit(void) |
4574 |
+ MODULE_AUTHOR("Damien Le Moal"); |
4575 |
+ MODULE_DESCRIPTION("Zone file system for zoned block devices"); |
4576 |
+ MODULE_LICENSE("GPL"); |
4577 |
++MODULE_ALIAS_FS("zonefs"); |
4578 |
+ module_init(zonefs_init); |
4579 |
+ module_exit(zonefs_exit); |
4580 |
+diff --git a/include/uapi/linux/mptcp.h b/include/uapi/linux/mptcp.h |
4581 |
+index f66038b9551fa..80c40194e2977 100644 |
4582 |
+--- a/include/uapi/linux/mptcp.h |
4583 |
++++ b/include/uapi/linux/mptcp.h |
4584 |
+@@ -129,19 +129,21 @@ struct mptcp_info { |
4585 |
+ * MPTCP_EVENT_REMOVED: token, rem_id |
4586 |
+ * An address has been lost by the peer. |
4587 |
+ * |
4588 |
+- * MPTCP_EVENT_SUB_ESTABLISHED: token, family, saddr4 | saddr6, |
4589 |
+- * daddr4 | daddr6, sport, dport, backup, |
4590 |
+- * if_idx [, error] |
4591 |
++ * MPTCP_EVENT_SUB_ESTABLISHED: token, family, loc_id, rem_id, |
4592 |
++ * saddr4 | saddr6, daddr4 | daddr6, sport, |
4593 |
++ * dport, backup, if_idx [, error] |
4594 |
+ * A new subflow has been established. 'error' should not be set. |
4595 |
+ * |
4596 |
+- * MPTCP_EVENT_SUB_CLOSED: token, family, saddr4 | saddr6, daddr4 | daddr6, |
4597 |
+- * sport, dport, backup, if_idx [, error] |
4598 |
++ * MPTCP_EVENT_SUB_CLOSED: token, family, loc_id, rem_id, saddr4 | saddr6, |
4599 |
++ * daddr4 | daddr6, sport, dport, backup, if_idx |
4600 |
++ * [, error] |
4601 |
+ * A subflow has been closed. An error (copy of sk_err) could be set if an |
4602 |
+ * error has been detected for this subflow. |
4603 |
+ * |
4604 |
+- * MPTCP_EVENT_SUB_PRIORITY: token, family, saddr4 | saddr6, daddr4 | daddr6, |
4605 |
+- * sport, dport, backup, if_idx [, error] |
4606 |
+- * The priority of a subflow has changed. 'error' should not be set. |
4607 |
++ * MPTCP_EVENT_SUB_PRIORITY: token, family, loc_id, rem_id, saddr4 | saddr6, |
4608 |
++ * daddr4 | daddr6, sport, dport, backup, if_idx |
4609 |
++ * [, error] |
4610 |
++ * The priority of a subflow has changed. 'error' should not be set. |
4611 |
+ */ |
4612 |
+ enum mptcp_event_type { |
4613 |
+ MPTCP_EVENT_UNSPEC = 0, |
4614 |
+diff --git a/include/xen/events.h b/include/xen/events.h |
4615 |
+index c204262d9fc24..344081e71584b 100644 |
4616 |
+--- a/include/xen/events.h |
4617 |
++++ b/include/xen/events.h |
4618 |
+@@ -17,6 +17,7 @@ struct xenbus_device; |
4619 |
+ unsigned xen_evtchn_nr_channels(void); |
4620 |
+ |
4621 |
+ int bind_evtchn_to_irq(evtchn_port_t evtchn); |
4622 |
++int bind_evtchn_to_irq_lateeoi(evtchn_port_t evtchn); |
4623 |
+ int bind_evtchn_to_irqhandler(evtchn_port_t evtchn, |
4624 |
+ irq_handler_t handler, |
4625 |
+ unsigned long irqflags, const char *devname, |
4626 |
+diff --git a/kernel/audit.c b/kernel/audit.c |
4627 |
+index 121d37e700a62..4cebadb5f30db 100644 |
4628 |
+--- a/kernel/audit.c |
4629 |
++++ b/kernel/audit.c |
4630 |
+@@ -718,7 +718,7 @@ static int kauditd_send_queue(struct sock *sk, u32 portid, |
4631 |
+ { |
4632 |
+ int rc = 0; |
4633 |
+ struct sk_buff *skb; |
4634 |
+- static unsigned int failed = 0; |
4635 |
++ unsigned int failed = 0; |
4636 |
+ |
4637 |
+ /* NOTE: kauditd_thread takes care of all our locking, we just use |
4638 |
+ * the netlink info passed to us (e.g. sk and portid) */ |
4639 |
+@@ -735,32 +735,30 @@ static int kauditd_send_queue(struct sock *sk, u32 portid, |
4640 |
+ continue; |
4641 |
+ } |
4642 |
+ |
4643 |
++retry: |
4644 |
+ /* grab an extra skb reference in case of error */ |
4645 |
+ skb_get(skb); |
4646 |
+ rc = netlink_unicast(sk, skb, portid, 0); |
4647 |
+ if (rc < 0) { |
4648 |
+- /* fatal failure for our queue flush attempt? */ |
4649 |
++ /* send failed - try a few times unless fatal error */ |
4650 |
+ if (++failed >= retry_limit || |
4651 |
+ rc == -ECONNREFUSED || rc == -EPERM) { |
4652 |
+- /* yes - error processing for the queue */ |
4653 |
+ sk = NULL; |
4654 |
+ if (err_hook) |
4655 |
+ (*err_hook)(skb); |
4656 |
+- if (!skb_hook) |
4657 |
+- goto out; |
4658 |
+- /* keep processing with the skb_hook */ |
4659 |
++ if (rc == -EAGAIN) |
4660 |
++ rc = 0; |
4661 |
++ /* continue to drain the queue */ |
4662 |
+ continue; |
4663 |
+ } else |
4664 |
+- /* no - requeue to preserve ordering */ |
4665 |
+- skb_queue_head(queue, skb); |
4666 |
++ goto retry; |
4667 |
+ } else { |
4668 |
+- /* it worked - drop the extra reference and continue */ |
4669 |
++ /* skb sent - drop the extra reference and continue */ |
4670 |
+ consume_skb(skb); |
4671 |
+ failed = 0; |
4672 |
+ } |
4673 |
+ } |
4674 |
+ |
4675 |
+-out: |
4676 |
+ return (rc >= 0 ? 0 : rc); |
4677 |
+ } |
4678 |
+ |
4679 |
+@@ -1609,7 +1607,8 @@ static int __net_init audit_net_init(struct net *net) |
4680 |
+ audit_panic("cannot initialize netlink socket in namespace"); |
4681 |
+ return -ENOMEM; |
4682 |
+ } |
4683 |
+- aunet->sk->sk_sndtimeo = MAX_SCHEDULE_TIMEOUT; |
4684 |
++ /* limit the timeout in case auditd is blocked/stopped */ |
4685 |
++ aunet->sk->sk_sndtimeo = HZ / 10; |
4686 |
+ |
4687 |
+ return 0; |
4688 |
+ } |
4689 |
+diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c |
4690 |
+index 8a0b4879790e5..93c3a332e8536 100644 |
4691 |
+--- a/kernel/bpf/verifier.c |
4692 |
++++ b/kernel/bpf/verifier.c |
4693 |
+@@ -1358,22 +1358,28 @@ static void __reg_bound_offset(struct bpf_reg_state *reg) |
4694 |
+ reg->var_off = tnum_or(tnum_clear_subreg(var64_off), var32_off); |
4695 |
+ } |
4696 |
+ |
4697 |
++static bool __reg32_bound_s64(s32 a) |
4698 |
++{ |
4699 |
++ return a >= 0 && a <= S32_MAX; |
4700 |
++} |
4701 |
++ |
4702 |
+ static void __reg_assign_32_into_64(struct bpf_reg_state *reg) |
4703 |
+ { |
4704 |
+ reg->umin_value = reg->u32_min_value; |
4705 |
+ reg->umax_value = reg->u32_max_value; |
4706 |
+- /* Attempt to pull 32-bit signed bounds into 64-bit bounds |
4707 |
+- * but must be positive otherwise set to worse case bounds |
4708 |
+- * and refine later from tnum. |
4709 |
++ |
4710 |
++ /* Attempt to pull 32-bit signed bounds into 64-bit bounds but must |
4711 |
++ * be positive otherwise set to worse case bounds and refine later |
4712 |
++ * from tnum. |
4713 |
+ */ |
4714 |
+- if (reg->s32_min_value >= 0 && reg->s32_max_value >= 0) |
4715 |
+- reg->smax_value = reg->s32_max_value; |
4716 |
+- else |
4717 |
+- reg->smax_value = U32_MAX; |
4718 |
+- if (reg->s32_min_value >= 0) |
4719 |
++ if (__reg32_bound_s64(reg->s32_min_value) && |
4720 |
++ __reg32_bound_s64(reg->s32_max_value)) { |
4721 |
+ reg->smin_value = reg->s32_min_value; |
4722 |
+- else |
4723 |
++ reg->smax_value = reg->s32_max_value; |
4724 |
++ } else { |
4725 |
+ reg->smin_value = 0; |
4726 |
++ reg->smax_value = U32_MAX; |
4727 |
++ } |
4728 |
+ } |
4729 |
+ |
4730 |
+ static void __reg_combine_32_into_64(struct bpf_reg_state *reg) |
4731 |
+@@ -4380,9 +4386,16 @@ static int check_atomic(struct bpf_verifier_env *env, int insn_idx, struct bpf_i |
4732 |
+ |
4733 |
+ if (insn->imm == BPF_CMPXCHG) { |
4734 |
+ /* Check comparison of R0 with memory location */ |
4735 |
+- err = check_reg_arg(env, BPF_REG_0, SRC_OP); |
4736 |
++ const u32 aux_reg = BPF_REG_0; |
4737 |
++ |
4738 |
++ err = check_reg_arg(env, aux_reg, SRC_OP); |
4739 |
+ if (err) |
4740 |
+ return err; |
4741 |
++ |
4742 |
++ if (is_pointer_value(env, aux_reg)) { |
4743 |
++ verbose(env, "R%d leaks addr into mem\n", aux_reg); |
4744 |
++ return -EACCES; |
4745 |
++ } |
4746 |
+ } |
4747 |
+ |
4748 |
+ if (is_pointer_value(env, insn->src_reg)) { |
4749 |
+@@ -4417,13 +4430,19 @@ static int check_atomic(struct bpf_verifier_env *env, int insn_idx, struct bpf_i |
4750 |
+ load_reg = -1; |
4751 |
+ } |
4752 |
+ |
4753 |
+- /* check whether we can read the memory */ |
4754 |
++ /* Check whether we can read the memory, with second call for fetch |
4755 |
++ * case to simulate the register fill. |
4756 |
++ */ |
4757 |
+ err = check_mem_access(env, insn_idx, insn->dst_reg, insn->off, |
4758 |
+- BPF_SIZE(insn->code), BPF_READ, load_reg, true); |
4759 |
++ BPF_SIZE(insn->code), BPF_READ, -1, true); |
4760 |
++ if (!err && load_reg >= 0) |
4761 |
++ err = check_mem_access(env, insn_idx, insn->dst_reg, insn->off, |
4762 |
++ BPF_SIZE(insn->code), BPF_READ, load_reg, |
4763 |
++ true); |
4764 |
+ if (err) |
4765 |
+ return err; |
4766 |
+ |
4767 |
+- /* check whether we can write into the same memory */ |
4768 |
++ /* Check whether we can write into the same memory. */ |
4769 |
+ err = check_mem_access(env, insn_idx, insn->dst_reg, insn->off, |
4770 |
+ BPF_SIZE(insn->code), BPF_WRITE, -1, true); |
4771 |
+ if (err) |
4772 |
+@@ -8114,6 +8133,10 @@ static int check_alu_op(struct bpf_verifier_env *env, struct bpf_insn *insn) |
4773 |
+ insn->dst_reg); |
4774 |
+ } |
4775 |
+ zext_32_to_64(dst_reg); |
4776 |
++ |
4777 |
++ __update_reg_bounds(dst_reg); |
4778 |
++ __reg_deduce_bounds(dst_reg); |
4779 |
++ __reg_bound_offset(dst_reg); |
4780 |
+ } |
4781 |
+ } else { |
4782 |
+ /* case: R = imm |
4783 |
+diff --git a/kernel/locking/rtmutex.c b/kernel/locking/rtmutex.c |
4784 |
+index 6bb116c559b4a..ea5a701ab2408 100644 |
4785 |
+--- a/kernel/locking/rtmutex.c |
4786 |
++++ b/kernel/locking/rtmutex.c |
4787 |
+@@ -1373,7 +1373,7 @@ static bool rtmutex_spin_on_owner(struct rt_mutex_base *lock, |
4788 |
+ * - the VCPU on which owner runs is preempted |
4789 |
+ */ |
4790 |
+ if (!owner->on_cpu || need_resched() || |
4791 |
+- rt_mutex_waiter_is_top_waiter(lock, waiter) || |
4792 |
++ !rt_mutex_waiter_is_top_waiter(lock, waiter) || |
4793 |
+ vcpu_is_preempted(task_cpu(owner))) { |
4794 |
+ res = false; |
4795 |
+ break; |
4796 |
+diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c |
4797 |
+index bdd1dc6de71ab..7ae10fab68b8f 100644 |
4798 |
+--- a/kernel/rcu/tree.c |
4799 |
++++ b/kernel/rcu/tree.c |
4800 |
+@@ -1907,7 +1907,7 @@ static void rcu_gp_fqs(bool first_time) |
4801 |
+ struct rcu_node *rnp = rcu_get_root(); |
4802 |
+ |
4803 |
+ WRITE_ONCE(rcu_state.gp_activity, jiffies); |
4804 |
+- rcu_state.n_force_qs++; |
4805 |
++ WRITE_ONCE(rcu_state.n_force_qs, rcu_state.n_force_qs + 1); |
4806 |
+ if (first_time) { |
4807 |
+ /* Collect dyntick-idle snapshots. */ |
4808 |
+ force_qs_rnp(dyntick_save_progress_counter); |
4809 |
+@@ -2550,7 +2550,7 @@ static void rcu_do_batch(struct rcu_data *rdp) |
4810 |
+ /* Reset ->qlen_last_fqs_check trigger if enough CBs have drained. */ |
4811 |
+ if (count == 0 && rdp->qlen_last_fqs_check != 0) { |
4812 |
+ rdp->qlen_last_fqs_check = 0; |
4813 |
+- rdp->n_force_qs_snap = rcu_state.n_force_qs; |
4814 |
++ rdp->n_force_qs_snap = READ_ONCE(rcu_state.n_force_qs); |
4815 |
+ } else if (count < rdp->qlen_last_fqs_check - qhimark) |
4816 |
+ rdp->qlen_last_fqs_check = count; |
4817 |
+ |
4818 |
+@@ -2898,10 +2898,10 @@ static void __call_rcu_core(struct rcu_data *rdp, struct rcu_head *head, |
4819 |
+ } else { |
4820 |
+ /* Give the grace period a kick. */ |
4821 |
+ rdp->blimit = DEFAULT_MAX_RCU_BLIMIT; |
4822 |
+- if (rcu_state.n_force_qs == rdp->n_force_qs_snap && |
4823 |
++ if (READ_ONCE(rcu_state.n_force_qs) == rdp->n_force_qs_snap && |
4824 |
+ rcu_segcblist_first_pend_cb(&rdp->cblist) != head) |
4825 |
+ rcu_force_quiescent_state(); |
4826 |
+- rdp->n_force_qs_snap = rcu_state.n_force_qs; |
4827 |
++ rdp->n_force_qs_snap = READ_ONCE(rcu_state.n_force_qs); |
4828 |
+ rdp->qlen_last_fqs_check = rcu_segcblist_n_cbs(&rdp->cblist); |
4829 |
+ } |
4830 |
+ } |
4831 |
+@@ -4128,7 +4128,7 @@ int rcutree_prepare_cpu(unsigned int cpu) |
4832 |
+ /* Set up local state, ensuring consistent view of global state. */ |
4833 |
+ raw_spin_lock_irqsave_rcu_node(rnp, flags); |
4834 |
+ rdp->qlen_last_fqs_check = 0; |
4835 |
+- rdp->n_force_qs_snap = rcu_state.n_force_qs; |
4836 |
++ rdp->n_force_qs_snap = READ_ONCE(rcu_state.n_force_qs); |
4837 |
+ rdp->blimit = blimit; |
4838 |
+ rdp->dynticks_nesting = 1; /* CPU not up, no tearing. */ |
4839 |
+ rcu_dynticks_eqs_online(); |
4840 |
+diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c |
4841 |
+index b348749a9fc62..dcdcb85121e40 100644 |
4842 |
+--- a/kernel/time/timekeeping.c |
4843 |
++++ b/kernel/time/timekeeping.c |
4844 |
+@@ -1306,8 +1306,7 @@ int do_settimeofday64(const struct timespec64 *ts) |
4845 |
+ timekeeping_forward_now(tk); |
4846 |
+ |
4847 |
+ xt = tk_xtime(tk); |
4848 |
+- ts_delta.tv_sec = ts->tv_sec - xt.tv_sec; |
4849 |
+- ts_delta.tv_nsec = ts->tv_nsec - xt.tv_nsec; |
4850 |
++ ts_delta = timespec64_sub(*ts, xt); |
4851 |
+ |
4852 |
+ if (timespec64_compare(&tk->wall_to_monotonic, &ts_delta) > 0) { |
4853 |
+ ret = -EINVAL; |
4854 |
+diff --git a/net/core/skbuff.c b/net/core/skbuff.c |
4855 |
+index 38d7dee4bbe9e..f7e003571a356 100644 |
4856 |
+--- a/net/core/skbuff.c |
4857 |
++++ b/net/core/skbuff.c |
4858 |
+@@ -832,7 +832,7 @@ void skb_dump(const char *level, const struct sk_buff *skb, bool full_pkt) |
4859 |
+ ntohs(skb->protocol), skb->pkt_type, skb->skb_iif); |
4860 |
+ |
4861 |
+ if (dev) |
4862 |
+- printk("%sdev name=%s feat=0x%pNF\n", |
4863 |
++ printk("%sdev name=%s feat=%pNF\n", |
4864 |
+ level, dev->name, &dev->features); |
4865 |
+ if (sk) |
4866 |
+ printk("%ssk family=%hu type=%u proto=%u\n", |
4867 |
+diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c |
4868 |
+index ef7897226f08e..ae70e07c52445 100644 |
4869 |
+--- a/net/ipv4/inet_diag.c |
4870 |
++++ b/net/ipv4/inet_diag.c |
4871 |
+@@ -261,6 +261,7 @@ int inet_sk_diag_fill(struct sock *sk, struct inet_connection_sock *icsk, |
4872 |
+ r->idiag_state = sk->sk_state; |
4873 |
+ r->idiag_timer = 0; |
4874 |
+ r->idiag_retrans = 0; |
4875 |
++ r->idiag_expires = 0; |
4876 |
+ |
4877 |
+ if (inet_diag_msg_attrs_fill(sk, skb, r, ext, |
4878 |
+ sk_user_ns(NETLINK_CB(cb->skb).sk), |
4879 |
+@@ -314,9 +315,6 @@ int inet_sk_diag_fill(struct sock *sk, struct inet_connection_sock *icsk, |
4880 |
+ r->idiag_retrans = icsk->icsk_probes_out; |
4881 |
+ r->idiag_expires = |
4882 |
+ jiffies_delta_to_msecs(sk->sk_timer.expires - jiffies); |
4883 |
+- } else { |
4884 |
+- r->idiag_timer = 0; |
4885 |
+- r->idiag_expires = 0; |
4886 |
+ } |
4887 |
+ |
4888 |
+ if ((ext & (1 << (INET_DIAG_INFO - 1))) && handler->idiag_info_size) { |
4889 |
+diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c |
4890 |
+index ef0c7a7c18e23..626cb53aa57ab 100644 |
4891 |
+--- a/net/ipv6/sit.c |
4892 |
++++ b/net/ipv6/sit.c |
4893 |
+@@ -1933,7 +1933,6 @@ static int __net_init sit_init_net(struct net *net) |
4894 |
+ return 0; |
4895 |
+ |
4896 |
+ err_reg_dev: |
4897 |
+- ipip6_dev_free(sitn->fb_tunnel_dev); |
4898 |
+ free_netdev(sitn->fb_tunnel_dev); |
4899 |
+ err_alloc_dev: |
4900 |
+ return err; |
4901 |
+diff --git a/net/mac80211/agg-rx.c b/net/mac80211/agg-rx.c |
4902 |
+index cce28e3b22323..ef729b1e39ea3 100644 |
4903 |
+--- a/net/mac80211/agg-rx.c |
4904 |
++++ b/net/mac80211/agg-rx.c |
4905 |
+@@ -9,7 +9,7 @@ |
4906 |
+ * Copyright 2007, Michael Wu <flamingice@××××××××.net> |
4907 |
+ * Copyright 2007-2010, Intel Corporation |
4908 |
+ * Copyright(c) 2015-2017 Intel Deutschland GmbH |
4909 |
+- * Copyright (C) 2018-2020 Intel Corporation |
4910 |
++ * Copyright (C) 2018-2021 Intel Corporation |
4911 |
+ */ |
4912 |
+ |
4913 |
+ /** |
4914 |
+@@ -191,7 +191,8 @@ static void ieee80211_add_addbaext(struct ieee80211_sub_if_data *sdata, |
4915 |
+ sband = ieee80211_get_sband(sdata); |
4916 |
+ if (!sband) |
4917 |
+ return; |
4918 |
+- he_cap = ieee80211_get_he_iftype_cap(sband, sdata->vif.type); |
4919 |
++ he_cap = ieee80211_get_he_iftype_cap(sband, |
4920 |
++ ieee80211_vif_type_p2p(&sdata->vif)); |
4921 |
+ if (!he_cap) |
4922 |
+ return; |
4923 |
+ |
4924 |
+diff --git a/net/mac80211/agg-tx.c b/net/mac80211/agg-tx.c |
4925 |
+index 430a585875388..74a878f213d3e 100644 |
4926 |
+--- a/net/mac80211/agg-tx.c |
4927 |
++++ b/net/mac80211/agg-tx.c |
4928 |
+@@ -9,7 +9,7 @@ |
4929 |
+ * Copyright 2007, Michael Wu <flamingice@××××××××.net> |
4930 |
+ * Copyright 2007-2010, Intel Corporation |
4931 |
+ * Copyright(c) 2015-2017 Intel Deutschland GmbH |
4932 |
+- * Copyright (C) 2018 - 2020 Intel Corporation |
4933 |
++ * Copyright (C) 2018 - 2021 Intel Corporation |
4934 |
+ */ |
4935 |
+ |
4936 |
+ #include <linux/ieee80211.h> |
4937 |
+@@ -106,7 +106,7 @@ static void ieee80211_send_addba_request(struct ieee80211_sub_if_data *sdata, |
4938 |
+ mgmt->u.action.u.addba_req.start_seq_num = |
4939 |
+ cpu_to_le16(start_seq_num << 4); |
4940 |
+ |
4941 |
+- ieee80211_tx_skb(sdata, skb); |
4942 |
++ ieee80211_tx_skb_tid(sdata, skb, tid); |
4943 |
+ } |
4944 |
+ |
4945 |
+ void ieee80211_send_bar(struct ieee80211_vif *vif, u8 *ra, u16 tid, u16 ssn) |
4946 |
+@@ -213,6 +213,8 @@ ieee80211_agg_start_txq(struct sta_info *sta, int tid, bool enable) |
4947 |
+ struct ieee80211_txq *txq = sta->sta.txq[tid]; |
4948 |
+ struct txq_info *txqi; |
4949 |
+ |
4950 |
++ lockdep_assert_held(&sta->ampdu_mlme.mtx); |
4951 |
++ |
4952 |
+ if (!txq) |
4953 |
+ return; |
4954 |
+ |
4955 |
+@@ -290,7 +292,6 @@ static void ieee80211_remove_tid_tx(struct sta_info *sta, int tid) |
4956 |
+ ieee80211_assign_tid_tx(sta, tid, NULL); |
4957 |
+ |
4958 |
+ ieee80211_agg_splice_finish(sta->sdata, tid); |
4959 |
+- ieee80211_agg_start_txq(sta, tid, false); |
4960 |
+ |
4961 |
+ kfree_rcu(tid_tx, rcu_head); |
4962 |
+ } |
4963 |
+@@ -480,8 +481,7 @@ static void ieee80211_send_addba_with_timeout(struct sta_info *sta, |
4964 |
+ |
4965 |
+ /* send AddBA request */ |
4966 |
+ ieee80211_send_addba_request(sdata, sta->sta.addr, tid, |
4967 |
+- tid_tx->dialog_token, |
4968 |
+- sta->tid_seq[tid] >> 4, |
4969 |
++ tid_tx->dialog_token, tid_tx->ssn, |
4970 |
+ buf_size, tid_tx->timeout); |
4971 |
+ |
4972 |
+ WARN_ON(test_and_set_bit(HT_AGG_STATE_SENT_ADDBA, &tid_tx->state)); |
4973 |
+@@ -523,6 +523,7 @@ void ieee80211_tx_ba_session_handle_start(struct sta_info *sta, int tid) |
4974 |
+ |
4975 |
+ params.ssn = sta->tid_seq[tid] >> 4; |
4976 |
+ ret = drv_ampdu_action(local, sdata, ¶ms); |
4977 |
++ tid_tx->ssn = params.ssn; |
4978 |
+ if (ret == IEEE80211_AMPDU_TX_START_DELAY_ADDBA) { |
4979 |
+ return; |
4980 |
+ } else if (ret == IEEE80211_AMPDU_TX_START_IMMEDIATE) { |
4981 |
+@@ -889,6 +890,7 @@ void ieee80211_stop_tx_ba_cb(struct sta_info *sta, int tid, |
4982 |
+ { |
4983 |
+ struct ieee80211_sub_if_data *sdata = sta->sdata; |
4984 |
+ bool send_delba = false; |
4985 |
++ bool start_txq = false; |
4986 |
+ |
4987 |
+ ht_dbg(sdata, "Stopping Tx BA session for %pM tid %d\n", |
4988 |
+ sta->sta.addr, tid); |
4989 |
+@@ -906,10 +908,14 @@ void ieee80211_stop_tx_ba_cb(struct sta_info *sta, int tid, |
4990 |
+ send_delba = true; |
4991 |
+ |
4992 |
+ ieee80211_remove_tid_tx(sta, tid); |
4993 |
++ start_txq = true; |
4994 |
+ |
4995 |
+ unlock_sta: |
4996 |
+ spin_unlock_bh(&sta->lock); |
4997 |
+ |
4998 |
++ if (start_txq) |
4999 |
++ ieee80211_agg_start_txq(sta, tid, false); |
5000 |
++ |
5001 |
+ if (send_delba) |
5002 |
+ ieee80211_send_delba(sdata, sta->sta.addr, tid, |
5003 |
+ WLAN_BACK_INITIATOR, WLAN_REASON_QSTA_NOT_USE); |
5004 |
+diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h |
5005 |
+index cd3731cbf6c68..c336267f4599c 100644 |
5006 |
+--- a/net/mac80211/driver-ops.h |
5007 |
++++ b/net/mac80211/driver-ops.h |
5008 |
+@@ -1219,8 +1219,11 @@ static inline void drv_wake_tx_queue(struct ieee80211_local *local, |
5009 |
+ { |
5010 |
+ struct ieee80211_sub_if_data *sdata = vif_to_sdata(txq->txq.vif); |
5011 |
+ |
5012 |
+- if (local->in_reconfig) |
5013 |
++ /* In reconfig don't transmit now, but mark for waking later */ |
5014 |
++ if (local->in_reconfig) { |
5015 |
++ set_bit(IEEE80211_TXQ_STOP_NETIF_TX, &txq->flags); |
5016 |
+ return; |
5017 |
++ } |
5018 |
+ |
5019 |
+ if (!check_sdata_in_driver(sdata)) |
5020 |
+ return; |
5021 |
+diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c |
5022 |
+index c0ea3b1aa9e1c..dd42d83dbe33e 100644 |
5023 |
+--- a/net/mac80211/mlme.c |
5024 |
++++ b/net/mac80211/mlme.c |
5025 |
+@@ -2446,11 +2446,18 @@ static void ieee80211_sta_tx_wmm_ac_notify(struct ieee80211_sub_if_data *sdata, |
5026 |
+ u16 tx_time) |
5027 |
+ { |
5028 |
+ struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; |
5029 |
+- u16 tid = ieee80211_get_tid(hdr); |
5030 |
+- int ac = ieee80211_ac_from_tid(tid); |
5031 |
+- struct ieee80211_sta_tx_tspec *tx_tspec = &ifmgd->tx_tspec[ac]; |
5032 |
++ u16 tid; |
5033 |
++ int ac; |
5034 |
++ struct ieee80211_sta_tx_tspec *tx_tspec; |
5035 |
+ unsigned long now = jiffies; |
5036 |
+ |
5037 |
++ if (!ieee80211_is_data_qos(hdr->frame_control)) |
5038 |
++ return; |
5039 |
++ |
5040 |
++ tid = ieee80211_get_tid(hdr); |
5041 |
++ ac = ieee80211_ac_from_tid(tid); |
5042 |
++ tx_tspec = &ifmgd->tx_tspec[ac]; |
5043 |
++ |
5044 |
+ if (likely(!tx_tspec->admitted_time)) |
5045 |
+ return; |
5046 |
+ |
5047 |
+diff --git a/net/mac80211/sta_info.h b/net/mac80211/sta_info.h |
5048 |
+index ba27967820084..e7443fc4669c8 100644 |
5049 |
+--- a/net/mac80211/sta_info.h |
5050 |
++++ b/net/mac80211/sta_info.h |
5051 |
+@@ -199,6 +199,7 @@ struct tid_ampdu_tx { |
5052 |
+ u8 stop_initiator; |
5053 |
+ bool tx_stop; |
5054 |
+ u16 buf_size; |
5055 |
++ u16 ssn; |
5056 |
+ |
5057 |
+ u16 failed_bar_ssn; |
5058 |
+ bool bar_pending; |
5059 |
+diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c |
5060 |
+index 0527bf41a32c7..a499b07fee336 100644 |
5061 |
+--- a/net/mac80211/tx.c |
5062 |
++++ b/net/mac80211/tx.c |
5063 |
+@@ -1821,15 +1821,15 @@ static int invoke_tx_handlers_late(struct ieee80211_tx_data *tx) |
5064 |
+ struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb); |
5065 |
+ ieee80211_tx_result res = TX_CONTINUE; |
5066 |
+ |
5067 |
++ if (!ieee80211_hw_check(&tx->local->hw, HAS_RATE_CONTROL)) |
5068 |
++ CALL_TXH(ieee80211_tx_h_rate_ctrl); |
5069 |
++ |
5070 |
+ if (unlikely(info->flags & IEEE80211_TX_INTFL_RETRANSMISSION)) { |
5071 |
+ __skb_queue_tail(&tx->skbs, tx->skb); |
5072 |
+ tx->skb = NULL; |
5073 |
+ goto txh_done; |
5074 |
+ } |
5075 |
+ |
5076 |
+- if (!ieee80211_hw_check(&tx->local->hw, HAS_RATE_CONTROL)) |
5077 |
+- CALL_TXH(ieee80211_tx_h_rate_ctrl); |
5078 |
+- |
5079 |
+ CALL_TXH(ieee80211_tx_h_michael_mic_add); |
5080 |
+ CALL_TXH(ieee80211_tx_h_sequence); |
5081 |
+ CALL_TXH(ieee80211_tx_h_fragment); |
5082 |
+diff --git a/net/mac80211/util.c b/net/mac80211/util.c |
5083 |
+index 03ea4f929b997..2fe71ed9137b0 100644 |
5084 |
+--- a/net/mac80211/util.c |
5085 |
++++ b/net/mac80211/util.c |
5086 |
+@@ -943,7 +943,12 @@ static void ieee80211_parse_extension_element(u32 *crc, |
5087 |
+ struct ieee802_11_elems *elems) |
5088 |
+ { |
5089 |
+ const void *data = elem->data + 1; |
5090 |
+- u8 len = elem->datalen - 1; |
5091 |
++ u8 len; |
5092 |
++ |
5093 |
++ if (!elem->datalen) |
5094 |
++ return; |
5095 |
++ |
5096 |
++ len = elem->datalen - 1; |
5097 |
+ |
5098 |
+ switch (elem->data[0]) { |
5099 |
+ case WLAN_EID_EXT_HE_MU_EDCA: |
5100 |
+diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c |
5101 |
+index 050eea231528b..b79251a36dcbc 100644 |
5102 |
+--- a/net/mptcp/pm_netlink.c |
5103 |
++++ b/net/mptcp/pm_netlink.c |
5104 |
+@@ -700,6 +700,9 @@ static void mptcp_pm_nl_rm_addr_or_subflow(struct mptcp_sock *msk, |
5105 |
+ |
5106 |
+ msk_owned_by_me(msk); |
5107 |
+ |
5108 |
++ if (sk->sk_state == TCP_LISTEN) |
5109 |
++ return; |
5110 |
++ |
5111 |
+ if (!rm_list->nr) |
5112 |
+ return; |
5113 |
+ |
5114 |
+diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c |
5115 |
+index 421fa62ce5cdf..4c889552cde77 100644 |
5116 |
+--- a/net/mptcp/protocol.c |
5117 |
++++ b/net/mptcp/protocol.c |
5118 |
+@@ -1549,7 +1549,7 @@ void __mptcp_push_pending(struct sock *sk, unsigned int flags) |
5119 |
+ int ret = 0; |
5120 |
+ |
5121 |
+ prev_ssk = ssk; |
5122 |
+- mptcp_flush_join_list(msk); |
5123 |
++ __mptcp_flush_join_list(msk); |
5124 |
+ ssk = mptcp_subflow_get_send(msk); |
5125 |
+ |
5126 |
+ /* First check. If the ssk has changed since |
5127 |
+@@ -2901,7 +2901,7 @@ static struct sock *mptcp_accept(struct sock *sk, int flags, int *err, |
5128 |
+ */ |
5129 |
+ if (WARN_ON_ONCE(!new_mptcp_sock)) { |
5130 |
+ tcp_sk(newsk)->is_mptcp = 0; |
5131 |
+- return newsk; |
5132 |
++ goto out; |
5133 |
+ } |
5134 |
+ |
5135 |
+ /* acquire the 2nd reference for the owning socket */ |
5136 |
+@@ -2913,6 +2913,8 @@ static struct sock *mptcp_accept(struct sock *sk, int flags, int *err, |
5137 |
+ MPTCP_MIB_MPCAPABLEPASSIVEFALLBACK); |
5138 |
+ } |
5139 |
+ |
5140 |
++out: |
5141 |
++ newsk->sk_kern_sock = kern; |
5142 |
+ return newsk; |
5143 |
+ } |
5144 |
+ |
5145 |
+diff --git a/net/mptcp/sockopt.c b/net/mptcp/sockopt.c |
5146 |
+index 8c03afac5ca03..4bb305342fcc7 100644 |
5147 |
+--- a/net/mptcp/sockopt.c |
5148 |
++++ b/net/mptcp/sockopt.c |
5149 |
+@@ -523,7 +523,6 @@ static bool mptcp_supported_sockopt(int level, int optname) |
5150 |
+ case TCP_NODELAY: |
5151 |
+ case TCP_THIN_LINEAR_TIMEOUTS: |
5152 |
+ case TCP_CONGESTION: |
5153 |
+- case TCP_ULP: |
5154 |
+ case TCP_CORK: |
5155 |
+ case TCP_KEEPIDLE: |
5156 |
+ case TCP_KEEPINTVL: |
5157 |
+diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c |
5158 |
+index 2a2bc64f75cfd..1bc7ef49e1487 100644 |
5159 |
+--- a/net/packet/af_packet.c |
5160 |
++++ b/net/packet/af_packet.c |
5161 |
+@@ -4457,9 +4457,10 @@ static int packet_set_ring(struct sock *sk, union tpacket_req_u *req_u, |
5162 |
+ } |
5163 |
+ |
5164 |
+ out_free_pg_vec: |
5165 |
+- bitmap_free(rx_owner_map); |
5166 |
+- if (pg_vec) |
5167 |
++ if (pg_vec) { |
5168 |
++ bitmap_free(rx_owner_map); |
5169 |
+ free_pg_vec(pg_vec, order, req->tp_block_nr); |
5170 |
++ } |
5171 |
+ out: |
5172 |
+ return err; |
5173 |
+ } |
5174 |
+diff --git a/net/rds/connection.c b/net/rds/connection.c |
5175 |
+index a3bc4b54d4910..b4cc699c5fad3 100644 |
5176 |
+--- a/net/rds/connection.c |
5177 |
++++ b/net/rds/connection.c |
5178 |
+@@ -253,6 +253,7 @@ static struct rds_connection *__rds_conn_create(struct net *net, |
5179 |
+ * should end up here, but if it |
5180 |
+ * does, reset/destroy the connection. |
5181 |
+ */ |
5182 |
++ kfree(conn->c_path); |
5183 |
+ kmem_cache_free(rds_conn_slab, conn); |
5184 |
+ conn = ERR_PTR(-EOPNOTSUPP); |
5185 |
+ goto out; |
5186 |
+diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c |
5187 |
+index 2ef8f5a6205a9..e54f0a42270c1 100644 |
5188 |
+--- a/net/sched/cls_api.c |
5189 |
++++ b/net/sched/cls_api.c |
5190 |
+@@ -3687,6 +3687,7 @@ int tc_setup_flow_action(struct flow_action *flow_action, |
5191 |
+ entry->mpls_mangle.ttl = tcf_mpls_ttl(act); |
5192 |
+ break; |
5193 |
+ default: |
5194 |
++ err = -EOPNOTSUPP; |
5195 |
+ goto err_out_locked; |
5196 |
+ } |
5197 |
+ } else if (is_tcf_skbedit_ptype(act)) { |
5198 |
+diff --git a/net/sched/sch_cake.c b/net/sched/sch_cake.c |
5199 |
+index 3c2300d144681..857aaebd49f43 100644 |
5200 |
+--- a/net/sched/sch_cake.c |
5201 |
++++ b/net/sched/sch_cake.c |
5202 |
+@@ -2736,7 +2736,7 @@ static int cake_init(struct Qdisc *sch, struct nlattr *opt, |
5203 |
+ q->tins = kvcalloc(CAKE_MAX_TINS, sizeof(struct cake_tin_data), |
5204 |
+ GFP_KERNEL); |
5205 |
+ if (!q->tins) |
5206 |
+- goto nomem; |
5207 |
++ return -ENOMEM; |
5208 |
+ |
5209 |
+ for (i = 0; i < CAKE_MAX_TINS; i++) { |
5210 |
+ struct cake_tin_data *b = q->tins + i; |
5211 |
+@@ -2766,10 +2766,6 @@ static int cake_init(struct Qdisc *sch, struct nlattr *opt, |
5212 |
+ q->min_netlen = ~0; |
5213 |
+ q->min_adjlen = ~0; |
5214 |
+ return 0; |
5215 |
+- |
5216 |
+-nomem: |
5217 |
+- cake_destroy(sch); |
5218 |
+- return -ENOMEM; |
5219 |
+ } |
5220 |
+ |
5221 |
+ static int cake_dump(struct Qdisc *sch, struct sk_buff *skb) |
5222 |
+diff --git a/net/sched/sch_ets.c b/net/sched/sch_ets.c |
5223 |
+index 92a686807971b..44fa2532a87c0 100644 |
5224 |
+--- a/net/sched/sch_ets.c |
5225 |
++++ b/net/sched/sch_ets.c |
5226 |
+@@ -668,9 +668,9 @@ static int ets_qdisc_change(struct Qdisc *sch, struct nlattr *opt, |
5227 |
+ } |
5228 |
+ } |
5229 |
+ for (i = q->nbands; i < oldbands; i++) { |
5230 |
+- qdisc_tree_flush_backlog(q->classes[i].qdisc); |
5231 |
+- if (i >= q->nstrict) |
5232 |
++ if (i >= q->nstrict && q->classes[i].qdisc->q.qlen) |
5233 |
+ list_del(&q->classes[i].alist); |
5234 |
++ qdisc_tree_flush_backlog(q->classes[i].qdisc); |
5235 |
+ } |
5236 |
+ q->nstrict = nstrict; |
5237 |
+ memcpy(q->prio2band, priomap, sizeof(priomap)); |
5238 |
+diff --git a/net/smc/af_smc.c b/net/smc/af_smc.c |
5239 |
+index 06e4a07bdcdc1..eea6d4a854e90 100644 |
5240 |
+--- a/net/smc/af_smc.c |
5241 |
++++ b/net/smc/af_smc.c |
5242 |
+@@ -193,7 +193,9 @@ static int smc_release(struct socket *sock) |
5243 |
+ /* cleanup for a dangling non-blocking connect */ |
5244 |
+ if (smc->connect_nonblock && sk->sk_state == SMC_INIT) |
5245 |
+ tcp_abort(smc->clcsock->sk, ECONNABORTED); |
5246 |
+- flush_work(&smc->connect_work); |
5247 |
++ |
5248 |
++ if (cancel_work_sync(&smc->connect_work)) |
5249 |
++ sock_put(&smc->sk); /* sock_hold in smc_connect for passive closing */ |
5250 |
+ |
5251 |
+ if (sk->sk_state == SMC_LISTEN) |
5252 |
+ /* smc_close_non_accepted() is called and acquires |
5253 |
+diff --git a/net/vmw_vsock/virtio_transport_common.c b/net/vmw_vsock/virtio_transport_common.c |
5254 |
+index 59ee1be5a6dd3..ec2c2afbf0d06 100644 |
5255 |
+--- a/net/vmw_vsock/virtio_transport_common.c |
5256 |
++++ b/net/vmw_vsock/virtio_transport_common.c |
5257 |
+@@ -1299,7 +1299,8 @@ void virtio_transport_recv_pkt(struct virtio_transport *t, |
5258 |
+ space_available = virtio_transport_space_update(sk, pkt); |
5259 |
+ |
5260 |
+ /* Update CID in case it has changed after a transport reset event */ |
5261 |
+- vsk->local_addr.svm_cid = dst.svm_cid; |
5262 |
++ if (vsk->local_addr.svm_cid != VMADDR_CID_ANY) |
5263 |
++ vsk->local_addr.svm_cid = dst.svm_cid; |
5264 |
+ |
5265 |
+ if (space_available) |
5266 |
+ sk->sk_write_space(sk); |
5267 |
+diff --git a/net/wireless/reg.c b/net/wireless/reg.c |
5268 |
+index df87c7f3a0492..795e86b371bba 100644 |
5269 |
+--- a/net/wireless/reg.c |
5270 |
++++ b/net/wireless/reg.c |
5271 |
+@@ -2338,6 +2338,7 @@ static bool reg_wdev_chan_valid(struct wiphy *wiphy, struct wireless_dev *wdev) |
5272 |
+ struct cfg80211_chan_def chandef = {}; |
5273 |
+ struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); |
5274 |
+ enum nl80211_iftype iftype; |
5275 |
++ bool ret; |
5276 |
+ |
5277 |
+ wdev_lock(wdev); |
5278 |
+ iftype = wdev->iftype; |
5279 |
+@@ -2387,7 +2388,11 @@ static bool reg_wdev_chan_valid(struct wiphy *wiphy, struct wireless_dev *wdev) |
5280 |
+ case NL80211_IFTYPE_AP: |
5281 |
+ case NL80211_IFTYPE_P2P_GO: |
5282 |
+ case NL80211_IFTYPE_ADHOC: |
5283 |
+- return cfg80211_reg_can_beacon_relax(wiphy, &chandef, iftype); |
5284 |
++ wiphy_lock(wiphy); |
5285 |
++ ret = cfg80211_reg_can_beacon_relax(wiphy, &chandef, iftype); |
5286 |
++ wiphy_unlock(wiphy); |
5287 |
++ |
5288 |
++ return ret; |
5289 |
+ case NL80211_IFTYPE_STATION: |
5290 |
+ case NL80211_IFTYPE_P2P_CLIENT: |
5291 |
+ return cfg80211_chandef_usable(wiphy, &chandef, |
5292 |
+diff --git a/scripts/recordmcount.pl b/scripts/recordmcount.pl |
5293 |
+index 7d631aaa0ae11..52a000b057a57 100755 |
5294 |
+--- a/scripts/recordmcount.pl |
5295 |
++++ b/scripts/recordmcount.pl |
5296 |
+@@ -219,7 +219,7 @@ if ($arch eq "x86_64") { |
5297 |
+ |
5298 |
+ } elsif ($arch eq "s390" && $bits == 64) { |
5299 |
+ if ($cc =~ /-DCC_USING_HOTPATCH/) { |
5300 |
+- $mcount_regex = "^\\s*([0-9a-fA-F]+):\\s*c0 04 00 00 00 00\\s*brcl\\s*0,[0-9a-f]+ <([^\+]*)>\$"; |
5301 |
++ $mcount_regex = "^\\s*([0-9a-fA-F]+):\\s*c0 04 00 00 00 00\\s*(bcrl\\s*0,|jgnop\\s*)[0-9a-f]+ <([^\+]*)>\$"; |
5302 |
+ $mcount_adjust = 0; |
5303 |
+ } |
5304 |
+ $alignment = 8; |
5305 |
+diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c |
5306 |
+index c8bf3db90c8ba..51432ea74044e 100644 |
5307 |
+--- a/security/selinux/hooks.c |
5308 |
++++ b/security/selinux/hooks.c |
5309 |
+@@ -611,10 +611,11 @@ static int bad_option(struct superblock_security_struct *sbsec, char flag, |
5310 |
+ return 0; |
5311 |
+ } |
5312 |
+ |
5313 |
+-static int parse_sid(struct super_block *sb, const char *s, u32 *sid) |
5314 |
++static int parse_sid(struct super_block *sb, const char *s, u32 *sid, |
5315 |
++ gfp_t gfp) |
5316 |
+ { |
5317 |
+ int rc = security_context_str_to_sid(&selinux_state, s, |
5318 |
+- sid, GFP_KERNEL); |
5319 |
++ sid, gfp); |
5320 |
+ if (rc) |
5321 |
+ pr_warn("SELinux: security_context_str_to_sid" |
5322 |
+ "(%s) failed for (dev %s, type %s) errno=%d\n", |
5323 |
+@@ -685,7 +686,8 @@ static int selinux_set_mnt_opts(struct super_block *sb, |
5324 |
+ */ |
5325 |
+ if (opts) { |
5326 |
+ if (opts->fscontext) { |
5327 |
+- rc = parse_sid(sb, opts->fscontext, &fscontext_sid); |
5328 |
++ rc = parse_sid(sb, opts->fscontext, &fscontext_sid, |
5329 |
++ GFP_KERNEL); |
5330 |
+ if (rc) |
5331 |
+ goto out; |
5332 |
+ if (bad_option(sbsec, FSCONTEXT_MNT, sbsec->sid, |
5333 |
+@@ -694,7 +696,8 @@ static int selinux_set_mnt_opts(struct super_block *sb, |
5334 |
+ sbsec->flags |= FSCONTEXT_MNT; |
5335 |
+ } |
5336 |
+ if (opts->context) { |
5337 |
+- rc = parse_sid(sb, opts->context, &context_sid); |
5338 |
++ rc = parse_sid(sb, opts->context, &context_sid, |
5339 |
++ GFP_KERNEL); |
5340 |
+ if (rc) |
5341 |
+ goto out; |
5342 |
+ if (bad_option(sbsec, CONTEXT_MNT, sbsec->mntpoint_sid, |
5343 |
+@@ -703,7 +706,8 @@ static int selinux_set_mnt_opts(struct super_block *sb, |
5344 |
+ sbsec->flags |= CONTEXT_MNT; |
5345 |
+ } |
5346 |
+ if (opts->rootcontext) { |
5347 |
+- rc = parse_sid(sb, opts->rootcontext, &rootcontext_sid); |
5348 |
++ rc = parse_sid(sb, opts->rootcontext, &rootcontext_sid, |
5349 |
++ GFP_KERNEL); |
5350 |
+ if (rc) |
5351 |
+ goto out; |
5352 |
+ if (bad_option(sbsec, ROOTCONTEXT_MNT, root_isec->sid, |
5353 |
+@@ -712,7 +716,8 @@ static int selinux_set_mnt_opts(struct super_block *sb, |
5354 |
+ sbsec->flags |= ROOTCONTEXT_MNT; |
5355 |
+ } |
5356 |
+ if (opts->defcontext) { |
5357 |
+- rc = parse_sid(sb, opts->defcontext, &defcontext_sid); |
5358 |
++ rc = parse_sid(sb, opts->defcontext, &defcontext_sid, |
5359 |
++ GFP_KERNEL); |
5360 |
+ if (rc) |
5361 |
+ goto out; |
5362 |
+ if (bad_option(sbsec, DEFCONTEXT_MNT, sbsec->def_sid, |
5363 |
+@@ -2701,14 +2706,14 @@ static int selinux_sb_mnt_opts_compat(struct super_block *sb, void *mnt_opts) |
5364 |
+ return (sbsec->flags & SE_MNTMASK) ? 1 : 0; |
5365 |
+ |
5366 |
+ if (opts->fscontext) { |
5367 |
+- rc = parse_sid(sb, opts->fscontext, &sid); |
5368 |
++ rc = parse_sid(sb, opts->fscontext, &sid, GFP_NOWAIT); |
5369 |
+ if (rc) |
5370 |
+ return 1; |
5371 |
+ if (bad_option(sbsec, FSCONTEXT_MNT, sbsec->sid, sid)) |
5372 |
+ return 1; |
5373 |
+ } |
5374 |
+ if (opts->context) { |
5375 |
+- rc = parse_sid(sb, opts->context, &sid); |
5376 |
++ rc = parse_sid(sb, opts->context, &sid, GFP_NOWAIT); |
5377 |
+ if (rc) |
5378 |
+ return 1; |
5379 |
+ if (bad_option(sbsec, CONTEXT_MNT, sbsec->mntpoint_sid, sid)) |
5380 |
+@@ -2718,14 +2723,14 @@ static int selinux_sb_mnt_opts_compat(struct super_block *sb, void *mnt_opts) |
5381 |
+ struct inode_security_struct *root_isec; |
5382 |
+ |
5383 |
+ root_isec = backing_inode_security(sb->s_root); |
5384 |
+- rc = parse_sid(sb, opts->rootcontext, &sid); |
5385 |
++ rc = parse_sid(sb, opts->rootcontext, &sid, GFP_NOWAIT); |
5386 |
+ if (rc) |
5387 |
+ return 1; |
5388 |
+ if (bad_option(sbsec, ROOTCONTEXT_MNT, root_isec->sid, sid)) |
5389 |
+ return 1; |
5390 |
+ } |
5391 |
+ if (opts->defcontext) { |
5392 |
+- rc = parse_sid(sb, opts->defcontext, &sid); |
5393 |
++ rc = parse_sid(sb, opts->defcontext, &sid, GFP_NOWAIT); |
5394 |
+ if (rc) |
5395 |
+ return 1; |
5396 |
+ if (bad_option(sbsec, DEFCONTEXT_MNT, sbsec->def_sid, sid)) |
5397 |
+@@ -2748,14 +2753,14 @@ static int selinux_sb_remount(struct super_block *sb, void *mnt_opts) |
5398 |
+ return 0; |
5399 |
+ |
5400 |
+ if (opts->fscontext) { |
5401 |
+- rc = parse_sid(sb, opts->fscontext, &sid); |
5402 |
++ rc = parse_sid(sb, opts->fscontext, &sid, GFP_KERNEL); |
5403 |
+ if (rc) |
5404 |
+ return rc; |
5405 |
+ if (bad_option(sbsec, FSCONTEXT_MNT, sbsec->sid, sid)) |
5406 |
+ goto out_bad_option; |
5407 |
+ } |
5408 |
+ if (opts->context) { |
5409 |
+- rc = parse_sid(sb, opts->context, &sid); |
5410 |
++ rc = parse_sid(sb, opts->context, &sid, GFP_KERNEL); |
5411 |
+ if (rc) |
5412 |
+ return rc; |
5413 |
+ if (bad_option(sbsec, CONTEXT_MNT, sbsec->mntpoint_sid, sid)) |
5414 |
+@@ -2764,14 +2769,14 @@ static int selinux_sb_remount(struct super_block *sb, void *mnt_opts) |
5415 |
+ if (opts->rootcontext) { |
5416 |
+ struct inode_security_struct *root_isec; |
5417 |
+ root_isec = backing_inode_security(sb->s_root); |
5418 |
+- rc = parse_sid(sb, opts->rootcontext, &sid); |
5419 |
++ rc = parse_sid(sb, opts->rootcontext, &sid, GFP_KERNEL); |
5420 |
+ if (rc) |
5421 |
+ return rc; |
5422 |
+ if (bad_option(sbsec, ROOTCONTEXT_MNT, root_isec->sid, sid)) |
5423 |
+ goto out_bad_option; |
5424 |
+ } |
5425 |
+ if (opts->defcontext) { |
5426 |
+- rc = parse_sid(sb, opts->defcontext, &sid); |
5427 |
++ rc = parse_sid(sb, opts->defcontext, &sid, GFP_KERNEL); |
5428 |
+ if (rc) |
5429 |
+ return rc; |
5430 |
+ if (bad_option(sbsec, DEFCONTEXT_MNT, sbsec->def_sid, sid)) |
5431 |
+diff --git a/tools/perf/builtin-inject.c b/tools/perf/builtin-inject.c |
5432 |
+index d454f5a7af936..50c2e6892b3e9 100644 |
5433 |
+--- a/tools/perf/builtin-inject.c |
5434 |
++++ b/tools/perf/builtin-inject.c |
5435 |
+@@ -755,12 +755,16 @@ static int parse_vm_time_correlation(const struct option *opt, const char *str, |
5436 |
+ return inject->itrace_synth_opts.vm_tm_corr_args ? 0 : -ENOMEM; |
5437 |
+ } |
5438 |
+ |
5439 |
++static int output_fd(struct perf_inject *inject) |
5440 |
++{ |
5441 |
++ return inject->in_place_update ? -1 : perf_data__fd(&inject->output); |
5442 |
++} |
5443 |
++ |
5444 |
+ static int __cmd_inject(struct perf_inject *inject) |
5445 |
+ { |
5446 |
+ int ret = -EINVAL; |
5447 |
+ struct perf_session *session = inject->session; |
5448 |
+- struct perf_data *data_out = &inject->output; |
5449 |
+- int fd = inject->in_place_update ? -1 : perf_data__fd(data_out); |
5450 |
++ int fd = output_fd(inject); |
5451 |
+ u64 output_data_offset; |
5452 |
+ |
5453 |
+ signal(SIGINT, sig_handler); |
5454 |
+@@ -1006,7 +1010,7 @@ int cmd_inject(int argc, const char **argv) |
5455 |
+ } |
5456 |
+ |
5457 |
+ inject.session = __perf_session__new(&data, repipe, |
5458 |
+- perf_data__fd(&inject.output), |
5459 |
++ output_fd(&inject), |
5460 |
+ &inject.tool); |
5461 |
+ if (IS_ERR(inject.session)) { |
5462 |
+ ret = PTR_ERR(inject.session); |
5463 |
+@@ -1069,7 +1073,8 @@ out_delete: |
5464 |
+ zstd_fini(&(inject.session->zstd_data)); |
5465 |
+ perf_session__delete(inject.session); |
5466 |
+ out_close_output: |
5467 |
+- perf_data__close(&inject.output); |
5468 |
++ if (!inject.in_place_update) |
5469 |
++ perf_data__close(&inject.output); |
5470 |
+ free(inject.itrace_synth_opts.vm_tm_corr_args); |
5471 |
+ return ret; |
5472 |
+ } |
5473 |
+diff --git a/tools/testing/selftests/bpf/prog_tests/btf_skc_cls_ingress.c b/tools/testing/selftests/bpf/prog_tests/btf_skc_cls_ingress.c |
5474 |
+index 762f6a9da8b5e..664ffc0364f4f 100644 |
5475 |
+--- a/tools/testing/selftests/bpf/prog_tests/btf_skc_cls_ingress.c |
5476 |
++++ b/tools/testing/selftests/bpf/prog_tests/btf_skc_cls_ingress.c |
5477 |
+@@ -90,7 +90,7 @@ static void print_err_line(void) |
5478 |
+ |
5479 |
+ static void test_conn(void) |
5480 |
+ { |
5481 |
+- int listen_fd = -1, cli_fd = -1, err; |
5482 |
++ int listen_fd = -1, cli_fd = -1, srv_fd = -1, err; |
5483 |
+ socklen_t addrlen = sizeof(srv_sa6); |
5484 |
+ int srv_port; |
5485 |
+ |
5486 |
+@@ -112,6 +112,10 @@ static void test_conn(void) |
5487 |
+ if (CHECK_FAIL(cli_fd == -1)) |
5488 |
+ goto done; |
5489 |
+ |
5490 |
++ srv_fd = accept(listen_fd, NULL, NULL); |
5491 |
++ if (CHECK_FAIL(srv_fd == -1)) |
5492 |
++ goto done; |
5493 |
++ |
5494 |
+ if (CHECK(skel->bss->listen_tp_sport != srv_port || |
5495 |
+ skel->bss->req_sk_sport != srv_port, |
5496 |
+ "Unexpected sk src port", |
5497 |
+@@ -134,11 +138,13 @@ done: |
5498 |
+ close(listen_fd); |
5499 |
+ if (cli_fd != -1) |
5500 |
+ close(cli_fd); |
5501 |
++ if (srv_fd != -1) |
5502 |
++ close(srv_fd); |
5503 |
+ } |
5504 |
+ |
5505 |
+ static void test_syncookie(void) |
5506 |
+ { |
5507 |
+- int listen_fd = -1, cli_fd = -1, err; |
5508 |
++ int listen_fd = -1, cli_fd = -1, srv_fd = -1, err; |
5509 |
+ socklen_t addrlen = sizeof(srv_sa6); |
5510 |
+ int srv_port; |
5511 |
+ |
5512 |
+@@ -161,6 +167,10 @@ static void test_syncookie(void) |
5513 |
+ if (CHECK_FAIL(cli_fd == -1)) |
5514 |
+ goto done; |
5515 |
+ |
5516 |
++ srv_fd = accept(listen_fd, NULL, NULL); |
5517 |
++ if (CHECK_FAIL(srv_fd == -1)) |
5518 |
++ goto done; |
5519 |
++ |
5520 |
+ if (CHECK(skel->bss->listen_tp_sport != srv_port, |
5521 |
+ "Unexpected tp src port", |
5522 |
+ "listen_tp_sport:%u expected:%u\n", |
5523 |
+@@ -188,6 +198,8 @@ done: |
5524 |
+ close(listen_fd); |
5525 |
+ if (cli_fd != -1) |
5526 |
+ close(cli_fd); |
5527 |
++ if (srv_fd != -1) |
5528 |
++ close(srv_fd); |
5529 |
+ } |
5530 |
+ |
5531 |
+ struct test { |
5532 |
+diff --git a/tools/testing/selftests/bpf/verifier/atomic_cmpxchg.c b/tools/testing/selftests/bpf/verifier/atomic_cmpxchg.c |
5533 |
+index 6e52dfc644153..6fb52d8cfd889 100644 |
5534 |
+--- a/tools/testing/selftests/bpf/verifier/atomic_cmpxchg.c |
5535 |
++++ b/tools/testing/selftests/bpf/verifier/atomic_cmpxchg.c |
5536 |
+@@ -71,6 +71,8 @@ |
5537 |
+ BPF_EXIT_INSN(), |
5538 |
+ }, |
5539 |
+ .result = ACCEPT, |
5540 |
++ .result_unpriv = REJECT, |
5541 |
++ .errstr_unpriv = "R0 leaks addr into mem", |
5542 |
+ }, |
5543 |
+ { |
5544 |
+ "Can't use cmpxchg on uninit src reg", |
5545 |
+@@ -118,4 +120,88 @@ |
5546 |
+ BPF_EXIT_INSN(), |
5547 |
+ }, |
5548 |
+ .result = ACCEPT, |
5549 |
++ .result_unpriv = REJECT, |
5550 |
++ .errstr_unpriv = "R0 leaks addr into mem", |
5551 |
++}, |
5552 |
++{ |
5553 |
++ "Dest pointer in r0 - succeed, check 2", |
5554 |
++ .insns = { |
5555 |
++ /* r0 = &val */ |
5556 |
++ BPF_MOV64_REG(BPF_REG_0, BPF_REG_10), |
5557 |
++ /* val = r0; */ |
5558 |
++ BPF_STX_MEM(BPF_DW, BPF_REG_10, BPF_REG_0, -8), |
5559 |
++ /* r5 = &val */ |
5560 |
++ BPF_MOV64_REG(BPF_REG_5, BPF_REG_10), |
5561 |
++ /* r0 = atomic_cmpxchg(&val, r0, r5); */ |
5562 |
++ BPF_ATOMIC_OP(BPF_DW, BPF_CMPXCHG, BPF_REG_10, BPF_REG_5, -8), |
5563 |
++ /* r1 = *r0 */ |
5564 |
++ BPF_LDX_MEM(BPF_DW, BPF_REG_1, BPF_REG_0, -8), |
5565 |
++ /* exit(0); */ |
5566 |
++ BPF_MOV64_IMM(BPF_REG_0, 0), |
5567 |
++ BPF_EXIT_INSN(), |
5568 |
++ }, |
5569 |
++ .result = ACCEPT, |
5570 |
++ .result_unpriv = REJECT, |
5571 |
++ .errstr_unpriv = "R0 leaks addr into mem", |
5572 |
++}, |
5573 |
++{ |
5574 |
++ "Dest pointer in r0 - succeed, check 3", |
5575 |
++ .insns = { |
5576 |
++ /* r0 = &val */ |
5577 |
++ BPF_MOV64_REG(BPF_REG_0, BPF_REG_10), |
5578 |
++ /* val = r0; */ |
5579 |
++ BPF_STX_MEM(BPF_DW, BPF_REG_10, BPF_REG_0, -8), |
5580 |
++ /* r5 = &val */ |
5581 |
++ BPF_MOV64_REG(BPF_REG_5, BPF_REG_10), |
5582 |
++ /* r0 = atomic_cmpxchg(&val, r0, r5); */ |
5583 |
++ BPF_ATOMIC_OP(BPF_W, BPF_CMPXCHG, BPF_REG_10, BPF_REG_5, -8), |
5584 |
++ /* exit(0); */ |
5585 |
++ BPF_MOV64_IMM(BPF_REG_0, 0), |
5586 |
++ BPF_EXIT_INSN(), |
5587 |
++ }, |
5588 |
++ .result = REJECT, |
5589 |
++ .errstr = "invalid size of register fill", |
5590 |
++ .errstr_unpriv = "R0 leaks addr into mem", |
5591 |
++}, |
5592 |
++{ |
5593 |
++ "Dest pointer in r0 - succeed, check 4", |
5594 |
++ .insns = { |
5595 |
++ /* r0 = &val */ |
5596 |
++ BPF_MOV32_REG(BPF_REG_0, BPF_REG_10), |
5597 |
++ /* val = r0; */ |
5598 |
++ BPF_STX_MEM(BPF_W, BPF_REG_10, BPF_REG_0, -8), |
5599 |
++ /* r5 = &val */ |
5600 |
++ BPF_MOV32_REG(BPF_REG_5, BPF_REG_10), |
5601 |
++ /* r0 = atomic_cmpxchg(&val, r0, r5); */ |
5602 |
++ BPF_ATOMIC_OP(BPF_W, BPF_CMPXCHG, BPF_REG_10, BPF_REG_5, -8), |
5603 |
++ /* r1 = *r10 */ |
5604 |
++ BPF_LDX_MEM(BPF_W, BPF_REG_1, BPF_REG_10, -8), |
5605 |
++ /* exit(0); */ |
5606 |
++ BPF_MOV64_IMM(BPF_REG_0, 0), |
5607 |
++ BPF_EXIT_INSN(), |
5608 |
++ }, |
5609 |
++ .result = ACCEPT, |
5610 |
++ .result_unpriv = REJECT, |
5611 |
++ .errstr_unpriv = "R10 partial copy of pointer", |
5612 |
++}, |
5613 |
++{ |
5614 |
++ "Dest pointer in r0 - succeed, check 5", |
5615 |
++ .insns = { |
5616 |
++ /* r0 = &val */ |
5617 |
++ BPF_MOV32_REG(BPF_REG_0, BPF_REG_10), |
5618 |
++ /* val = r0; */ |
5619 |
++ BPF_STX_MEM(BPF_W, BPF_REG_10, BPF_REG_0, -8), |
5620 |
++ /* r5 = &val */ |
5621 |
++ BPF_MOV32_REG(BPF_REG_5, BPF_REG_10), |
5622 |
++ /* r0 = atomic_cmpxchg(&val, r0, r5); */ |
5623 |
++ BPF_ATOMIC_OP(BPF_W, BPF_CMPXCHG, BPF_REG_10, BPF_REG_5, -8), |
5624 |
++ /* r1 = *r0 */ |
5625 |
++ BPF_LDX_MEM(BPF_W, BPF_REG_1, BPF_REG_0, -8), |
5626 |
++ /* exit(0); */ |
5627 |
++ BPF_MOV64_IMM(BPF_REG_0, 0), |
5628 |
++ BPF_EXIT_INSN(), |
5629 |
++ }, |
5630 |
++ .result = REJECT, |
5631 |
++ .errstr = "R0 invalid mem access", |
5632 |
++ .errstr_unpriv = "R10 partial copy of pointer", |
5633 |
+ }, |
5634 |
+diff --git a/tools/testing/selftests/bpf/verifier/value_ptr_arith.c b/tools/testing/selftests/bpf/verifier/value_ptr_arith.c |
5635 |
+index 2debba4e8a3a8..4d347bc53aa28 100644 |
5636 |
+--- a/tools/testing/selftests/bpf/verifier/value_ptr_arith.c |
5637 |
++++ b/tools/testing/selftests/bpf/verifier/value_ptr_arith.c |
5638 |
+@@ -1077,6 +1077,29 @@ |
5639 |
+ .errstr = "R0 invalid mem access 'inv'", |
5640 |
+ .errstr_unpriv = "R0 pointer -= pointer prohibited", |
5641 |
+ }, |
5642 |
++{ |
5643 |
++ "map access: trying to leak tained dst reg", |
5644 |
++ .insns = { |
5645 |
++ BPF_MOV64_IMM(BPF_REG_0, 0), |
5646 |
++ BPF_ST_MEM(BPF_DW, BPF_REG_10, -8, 0), |
5647 |
++ BPF_MOV64_REG(BPF_REG_2, BPF_REG_10), |
5648 |
++ BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, -8), |
5649 |
++ BPF_LD_MAP_FD(BPF_REG_1, 0), |
5650 |
++ BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0, BPF_FUNC_map_lookup_elem), |
5651 |
++ BPF_JMP_IMM(BPF_JNE, BPF_REG_0, 0, 1), |
5652 |
++ BPF_EXIT_INSN(), |
5653 |
++ BPF_MOV64_REG(BPF_REG_2, BPF_REG_0), |
5654 |
++ BPF_MOV32_IMM(BPF_REG_1, 0xFFFFFFFF), |
5655 |
++ BPF_MOV32_REG(BPF_REG_1, BPF_REG_1), |
5656 |
++ BPF_ALU64_REG(BPF_SUB, BPF_REG_2, BPF_REG_1), |
5657 |
++ BPF_STX_MEM(BPF_DW, BPF_REG_0, BPF_REG_2, 0), |
5658 |
++ BPF_MOV64_IMM(BPF_REG_0, 0), |
5659 |
++ BPF_EXIT_INSN(), |
5660 |
++ }, |
5661 |
++ .fixup_map_array_48b = { 4 }, |
5662 |
++ .result = REJECT, |
5663 |
++ .errstr = "math between map_value pointer and 4294967295 is not allowed", |
5664 |
++}, |
5665 |
+ { |
5666 |
+ "32bit pkt_ptr -= scalar", |
5667 |
+ .insns = { |
5668 |
+diff --git a/tools/testing/selftests/damon/.gitignore b/tools/testing/selftests/damon/.gitignore |
5669 |
+new file mode 100644 |
5670 |
+index 0000000000000..c6c2965a66075 |
5671 |
+--- /dev/null |
5672 |
++++ b/tools/testing/selftests/damon/.gitignore |
5673 |
+@@ -0,0 +1,2 @@ |
5674 |
++# SPDX-License-Identifier: GPL-2.0-only |
5675 |
++huge_count_read_write |
5676 |
+diff --git a/tools/testing/selftests/damon/Makefile b/tools/testing/selftests/damon/Makefile |
5677 |
+index 8a3f2cd9fec0c..f0aa954b5d135 100644 |
5678 |
+--- a/tools/testing/selftests/damon/Makefile |
5679 |
++++ b/tools/testing/selftests/damon/Makefile |
5680 |
+@@ -1,6 +1,8 @@ |
5681 |
+ # SPDX-License-Identifier: GPL-2.0 |
5682 |
+ # Makefile for damon selftests |
5683 |
+ |
5684 |
++TEST_GEN_FILES += huge_count_read_write |
5685 |
++ |
5686 |
+ TEST_FILES = _chk_dependency.sh |
5687 |
+ TEST_PROGS = debugfs_attrs.sh |
5688 |
+ |
5689 |
+diff --git a/tools/testing/selftests/damon/debugfs_attrs.sh b/tools/testing/selftests/damon/debugfs_attrs.sh |
5690 |
+index bfabb19dc0d3d..ecda972e87775 100644 |
5691 |
+--- a/tools/testing/selftests/damon/debugfs_attrs.sh |
5692 |
++++ b/tools/testing/selftests/damon/debugfs_attrs.sh |
5693 |
+@@ -72,4 +72,22 @@ test_write_succ "$file" "" "$orig_content" "empty input" |
5694 |
+ test_content "$file" "$orig_content" "" "empty input written" |
5695 |
+ echo "$orig_content" > "$file" |
5696 |
+ |
5697 |
++# Test huge count read write |
5698 |
++# ========================== |
5699 |
++ |
5700 |
++dmesg -C |
5701 |
++ |
5702 |
++for file in "$DBGFS/"* |
5703 |
++do |
5704 |
++ ./huge_count_read_write "$file" |
5705 |
++done |
5706 |
++ |
5707 |
++if dmesg | grep -q WARNING |
5708 |
++then |
5709 |
++ dmesg |
5710 |
++ exit 1 |
5711 |
++else |
5712 |
++ exit 0 |
5713 |
++fi |
5714 |
++ |
5715 |
+ echo "PASS" |
5716 |
+diff --git a/tools/testing/selftests/damon/huge_count_read_write.c b/tools/testing/selftests/damon/huge_count_read_write.c |
5717 |
+new file mode 100644 |
5718 |
+index 0000000000000..ad7a6b4cf3387 |
5719 |
+--- /dev/null |
5720 |
++++ b/tools/testing/selftests/damon/huge_count_read_write.c |
5721 |
+@@ -0,0 +1,39 @@ |
5722 |
++// SPDX-License-Identifier: GPL-2.0 |
5723 |
++/* |
5724 |
++ * Author: SeongJae Park <sj@××××××.org> |
5725 |
++ */ |
5726 |
++ |
5727 |
++#include <fcntl.h> |
5728 |
++#include <stdlib.h> |
5729 |
++#include <unistd.h> |
5730 |
++#include <stdio.h> |
5731 |
++ |
5732 |
++void write_read_with_huge_count(char *file) |
5733 |
++{ |
5734 |
++ int filedesc = open(file, O_RDWR); |
5735 |
++ char buf[25]; |
5736 |
++ int ret; |
5737 |
++ |
5738 |
++ printf("%s %s\n", __func__, file); |
5739 |
++ if (filedesc < 0) { |
5740 |
++ fprintf(stderr, "failed opening %s\n", file); |
5741 |
++ exit(1); |
5742 |
++ } |
5743 |
++ |
5744 |
++ write(filedesc, "", 0xfffffffful); |
5745 |
++ perror("after write: "); |
5746 |
++ ret = read(filedesc, buf, 0xfffffffful); |
5747 |
++ perror("after read: "); |
5748 |
++ close(filedesc); |
5749 |
++} |
5750 |
++ |
5751 |
++int main(int argc, char *argv[]) |
5752 |
++{ |
5753 |
++ if (argc != 2) { |
5754 |
++ fprintf(stderr, "Usage: %s <file>\n", argv[0]); |
5755 |
++ exit(1); |
5756 |
++ } |
5757 |
++ write_read_with_huge_count(argv[1]); |
5758 |
++ |
5759 |
++ return 0; |
5760 |
++} |
5761 |
+diff --git a/tools/testing/selftests/kvm/kvm_create_max_vcpus.c b/tools/testing/selftests/kvm/kvm_create_max_vcpus.c |
5762 |
+index 0299cd81b8ba2..aa3795cd7bd3d 100644 |
5763 |
+--- a/tools/testing/selftests/kvm/kvm_create_max_vcpus.c |
5764 |
++++ b/tools/testing/selftests/kvm/kvm_create_max_vcpus.c |
5765 |
+@@ -12,6 +12,7 @@ |
5766 |
+ #include <stdio.h> |
5767 |
+ #include <stdlib.h> |
5768 |
+ #include <string.h> |
5769 |
++#include <sys/resource.h> |
5770 |
+ |
5771 |
+ #include "test_util.h" |
5772 |
+ |
5773 |
+@@ -40,10 +41,39 @@ int main(int argc, char *argv[]) |
5774 |
+ { |
5775 |
+ int kvm_max_vcpu_id = kvm_check_cap(KVM_CAP_MAX_VCPU_ID); |
5776 |
+ int kvm_max_vcpus = kvm_check_cap(KVM_CAP_MAX_VCPUS); |
5777 |
++ /* |
5778 |
++ * Number of file descriptors reqired, KVM_CAP_MAX_VCPUS for vCPU fds + |
5779 |
++ * an arbitrary number for everything else. |
5780 |
++ */ |
5781 |
++ int nr_fds_wanted = kvm_max_vcpus + 100; |
5782 |
++ struct rlimit rl; |
5783 |
+ |
5784 |
+ pr_info("KVM_CAP_MAX_VCPU_ID: %d\n", kvm_max_vcpu_id); |
5785 |
+ pr_info("KVM_CAP_MAX_VCPUS: %d\n", kvm_max_vcpus); |
5786 |
+ |
5787 |
++ /* |
5788 |
++ * Check that we're allowed to open nr_fds_wanted file descriptors and |
5789 |
++ * try raising the limits if needed. |
5790 |
++ */ |
5791 |
++ TEST_ASSERT(!getrlimit(RLIMIT_NOFILE, &rl), "getrlimit() failed!"); |
5792 |
++ |
5793 |
++ if (rl.rlim_cur < nr_fds_wanted) { |
5794 |
++ rl.rlim_cur = nr_fds_wanted; |
5795 |
++ if (rl.rlim_max < nr_fds_wanted) { |
5796 |
++ int old_rlim_max = rl.rlim_max; |
5797 |
++ rl.rlim_max = nr_fds_wanted; |
5798 |
++ |
5799 |
++ int r = setrlimit(RLIMIT_NOFILE, &rl); |
5800 |
++ if (r < 0) { |
5801 |
++ printf("RLIMIT_NOFILE hard limit is too low (%d, wanted %d)\n", |
5802 |
++ old_rlim_max, nr_fds_wanted); |
5803 |
++ exit(KSFT_SKIP); |
5804 |
++ } |
5805 |
++ } else { |
5806 |
++ TEST_ASSERT(!setrlimit(RLIMIT_NOFILE, &rl), "setrlimit() failed!"); |
5807 |
++ } |
5808 |
++ } |
5809 |
++ |
5810 |
+ /* |
5811 |
+ * Upstream KVM prior to 4.8 does not support KVM_CAP_MAX_VCPU_ID. |
5812 |
+ * Userspace is supposed to use KVM_CAP_MAX_VCPUS as the maximum ID |
5813 |
+diff --git a/tools/testing/selftests/net/fcnal-test.sh b/tools/testing/selftests/net/fcnal-test.sh |
5814 |
+index 7f5b265fcb905..aec9e784d0b46 100755 |
5815 |
+--- a/tools/testing/selftests/net/fcnal-test.sh |
5816 |
++++ b/tools/testing/selftests/net/fcnal-test.sh |
5817 |
+@@ -455,6 +455,22 @@ cleanup() |
5818 |
+ ip netns del ${NSC} >/dev/null 2>&1 |
5819 |
+ } |
5820 |
+ |
5821 |
++cleanup_vrf_dup() |
5822 |
++{ |
5823 |
++ ip link del ${NSA_DEV2} >/dev/null 2>&1 |
5824 |
++ ip netns pids ${NSC} | xargs kill 2>/dev/null |
5825 |
++ ip netns del ${NSC} >/dev/null 2>&1 |
5826 |
++} |
5827 |
++ |
5828 |
++setup_vrf_dup() |
5829 |
++{ |
5830 |
++ # some VRF tests use ns-C which has the same config as |
5831 |
++ # ns-B but for a device NOT in the VRF |
5832 |
++ create_ns ${NSC} "-" "-" |
5833 |
++ connect_ns ${NSA} ${NSA_DEV2} ${NSA_IP}/24 ${NSA_IP6}/64 \ |
5834 |
++ ${NSC} ${NSC_DEV} ${NSB_IP}/24 ${NSB_IP6}/64 |
5835 |
++} |
5836 |
++ |
5837 |
+ setup() |
5838 |
+ { |
5839 |
+ local with_vrf=${1} |
5840 |
+@@ -484,12 +500,6 @@ setup() |
5841 |
+ |
5842 |
+ ip -netns ${NSB} ro add ${VRF_IP}/32 via ${NSA_IP} dev ${NSB_DEV} |
5843 |
+ ip -netns ${NSB} -6 ro add ${VRF_IP6}/128 via ${NSA_IP6} dev ${NSB_DEV} |
5844 |
+- |
5845 |
+- # some VRF tests use ns-C which has the same config as |
5846 |
+- # ns-B but for a device NOT in the VRF |
5847 |
+- create_ns ${NSC} "-" "-" |
5848 |
+- connect_ns ${NSA} ${NSA_DEV2} ${NSA_IP}/24 ${NSA_IP6}/64 \ |
5849 |
+- ${NSC} ${NSC_DEV} ${NSB_IP}/24 ${NSB_IP6}/64 |
5850 |
+ else |
5851 |
+ ip -netns ${NSA} ro add ${NSB_LO_IP}/32 via ${NSB_IP} dev ${NSA_DEV} |
5852 |
+ ip -netns ${NSA} ro add ${NSB_LO_IP6}/128 via ${NSB_IP6} dev ${NSA_DEV} |
5853 |
+@@ -1240,7 +1250,9 @@ ipv4_tcp_vrf() |
5854 |
+ log_test_addr ${a} $? 1 "Global server, local connection" |
5855 |
+ |
5856 |
+ # run MD5 tests |
5857 |
++ setup_vrf_dup |
5858 |
+ ipv4_tcp_md5 |
5859 |
++ cleanup_vrf_dup |
5860 |
+ |
5861 |
+ # |
5862 |
+ # enable VRF global server |
5863 |
+@@ -1798,8 +1810,9 @@ ipv4_addr_bind_vrf() |
5864 |
+ for a in ${NSA_IP} ${VRF_IP} |
5865 |
+ do |
5866 |
+ log_start |
5867 |
++ show_hint "Socket not bound to VRF, but address is in VRF" |
5868 |
+ run_cmd nettest -s -R -P icmp -l ${a} -b |
5869 |
+- log_test_addr ${a} $? 0 "Raw socket bind to local address" |
5870 |
++ log_test_addr ${a} $? 1 "Raw socket bind to local address" |
5871 |
+ |
5872 |
+ log_start |
5873 |
+ run_cmd nettest -s -R -P icmp -l ${a} -I ${NSA_DEV} -b |
5874 |
+@@ -2191,7 +2204,7 @@ ipv6_ping_vrf() |
5875 |
+ log_start |
5876 |
+ show_hint "Fails since VRF device does not support linklocal or multicast" |
5877 |
+ run_cmd ${ping6} -c1 -w1 ${a} |
5878 |
+- log_test_addr ${a} $? 2 "ping out, VRF bind" |
5879 |
++ log_test_addr ${a} $? 1 "ping out, VRF bind" |
5880 |
+ done |
5881 |
+ |
5882 |
+ for a in ${NSB_IP6} ${NSB_LO_IP6} ${NSB_LINKIP6}%${NSA_DEV} ${MCAST}%${NSA_DEV} |
5883 |
+@@ -2719,7 +2732,9 @@ ipv6_tcp_vrf() |
5884 |
+ log_test_addr ${a} $? 1 "Global server, local connection" |
5885 |
+ |
5886 |
+ # run MD5 tests |
5887 |
++ setup_vrf_dup |
5888 |
+ ipv6_tcp_md5 |
5889 |
++ cleanup_vrf_dup |
5890 |
+ |
5891 |
+ # |
5892 |
+ # enable VRF global server |
5893 |
+@@ -3414,11 +3429,14 @@ ipv6_addr_bind_novrf() |
5894 |
+ run_cmd nettest -6 -s -l ${a} -I ${NSA_DEV} -t1 -b |
5895 |
+ log_test_addr ${a} $? 0 "TCP socket bind to local address after device bind" |
5896 |
+ |
5897 |
++ # Sadly, the kernel allows binding a socket to a device and then |
5898 |
++ # binding to an address not on the device. So this test passes |
5899 |
++ # when it really should not |
5900 |
+ a=${NSA_LO_IP6} |
5901 |
+ log_start |
5902 |
+- show_hint "Should fail with 'Cannot assign requested address'" |
5903 |
++ show_hint "Tecnically should fail since address is not on device but kernel allows" |
5904 |
+ run_cmd nettest -6 -s -l ${a} -I ${NSA_DEV} -t1 -b |
5905 |
+- log_test_addr ${a} $? 1 "TCP socket bind to out of scope local address" |
5906 |
++ log_test_addr ${a} $? 0 "TCP socket bind to out of scope local address" |
5907 |
+ } |
5908 |
+ |
5909 |
+ ipv6_addr_bind_vrf() |
5910 |
+@@ -3459,10 +3477,15 @@ ipv6_addr_bind_vrf() |
5911 |
+ run_cmd nettest -6 -s -l ${a} -I ${NSA_DEV} -t1 -b |
5912 |
+ log_test_addr ${a} $? 0 "TCP socket bind to local address with device bind" |
5913 |
+ |
5914 |
++ # Sadly, the kernel allows binding a socket to a device and then |
5915 |
++ # binding to an address not on the device. The only restriction |
5916 |
++ # is that the address is valid in the L3 domain. So this test |
5917 |
++ # passes when it really should not |
5918 |
+ a=${VRF_IP6} |
5919 |
+ log_start |
5920 |
++ show_hint "Tecnically should fail since address is not on device but kernel allows" |
5921 |
+ run_cmd nettest -6 -s -l ${a} -I ${NSA_DEV} -t1 -b |
5922 |
+- log_test_addr ${a} $? 1 "TCP socket bind to VRF address with device bind" |
5923 |
++ log_test_addr ${a} $? 0 "TCP socket bind to VRF address with device bind" |
5924 |
+ |
5925 |
+ a=${NSA_LO_IP6} |
5926 |
+ log_start |
5927 |
+diff --git a/tools/testing/selftests/net/forwarding/forwarding.config.sample b/tools/testing/selftests/net/forwarding/forwarding.config.sample |
5928 |
+index e5e2fbeca22ec..e51def39fd801 100644 |
5929 |
+--- a/tools/testing/selftests/net/forwarding/forwarding.config.sample |
5930 |
++++ b/tools/testing/selftests/net/forwarding/forwarding.config.sample |
5931 |
+@@ -13,6 +13,8 @@ NETIFS[p5]=veth4 |
5932 |
+ NETIFS[p6]=veth5 |
5933 |
+ NETIFS[p7]=veth6 |
5934 |
+ NETIFS[p8]=veth7 |
5935 |
++NETIFS[p9]=veth8 |
5936 |
++NETIFS[p10]=veth9 |
5937 |
+ |
5938 |
+ # Port that does not have a cable connected. |
5939 |
+ NETIF_NO_CABLE=eth8 |
5940 |
+diff --git a/tools/testing/selftests/net/icmp_redirect.sh b/tools/testing/selftests/net/icmp_redirect.sh |
5941 |
+index ecbf57f264ed9..7b9d6e31b8e7d 100755 |
5942 |
+--- a/tools/testing/selftests/net/icmp_redirect.sh |
5943 |
++++ b/tools/testing/selftests/net/icmp_redirect.sh |
5944 |
+@@ -311,7 +311,7 @@ check_exception() |
5945 |
+ ip -netns h1 ro get ${H1_VRF_ARG} ${H2_N2_IP} | \ |
5946 |
+ grep -E -v 'mtu|redirected' | grep -q "cache" |
5947 |
+ fi |
5948 |
+- log_test $? 0 "IPv4: ${desc}" |
5949 |
++ log_test $? 0 "IPv4: ${desc}" 0 |
5950 |
+ |
5951 |
+ # No PMTU info for test "redirect" and "mtu exception plus redirect" |
5952 |
+ if [ "$with_redirect" = "yes" ] && [ "$desc" != "redirect exception plus mtu" ]; then |
5953 |
+diff --git a/tools/testing/selftests/net/toeplitz.c b/tools/testing/selftests/net/toeplitz.c |
5954 |
+index 710ac956bdb33..c5489341cfb80 100644 |
5955 |
+--- a/tools/testing/selftests/net/toeplitz.c |
5956 |
++++ b/tools/testing/selftests/net/toeplitz.c |
5957 |
+@@ -498,7 +498,7 @@ static void parse_opts(int argc, char **argv) |
5958 |
+ bool have_toeplitz = false; |
5959 |
+ int index, c; |
5960 |
+ |
5961 |
+- while ((c = getopt_long(argc, argv, "46C:d:i:k:r:stT:u:v", long_options, &index)) != -1) { |
5962 |
++ while ((c = getopt_long(argc, argv, "46C:d:i:k:r:stT:uv", long_options, &index)) != -1) { |
5963 |
+ switch (c) { |
5964 |
+ case '4': |
5965 |
+ cfg_family = AF_INET; |
5966 |
+diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c |
5967 |
+index ce1847bc898b2..c6bfd4e15d28a 100644 |
5968 |
+--- a/virt/kvm/kvm_main.c |
5969 |
++++ b/virt/kvm/kvm_main.c |
5970 |
+@@ -3001,7 +3001,8 @@ int kvm_write_guest_offset_cached(struct kvm *kvm, struct gfn_to_hva_cache *ghc, |
5971 |
+ int r; |
5972 |
+ gpa_t gpa = ghc->gpa + offset; |
5973 |
+ |
5974 |
+- BUG_ON(len + offset > ghc->len); |
5975 |
++ if (WARN_ON_ONCE(len + offset > ghc->len)) |
5976 |
++ return -EINVAL; |
5977 |
+ |
5978 |
+ if (slots->generation != ghc->generation) { |
5979 |
+ if (__kvm_gfn_to_hva_cache_init(slots, ghc, ghc->gpa, ghc->len)) |
5980 |
+@@ -3038,7 +3039,8 @@ int kvm_read_guest_offset_cached(struct kvm *kvm, struct gfn_to_hva_cache *ghc, |
5981 |
+ int r; |
5982 |
+ gpa_t gpa = ghc->gpa + offset; |
5983 |
+ |
5984 |
+- BUG_ON(len + offset > ghc->len); |
5985 |
++ if (WARN_ON_ONCE(len + offset > ghc->len)) |
5986 |
++ return -EINVAL; |
5987 |
+ |
5988 |
+ if (slots->generation != ghc->generation) { |
5989 |
+ if (__kvm_gfn_to_hva_cache_init(slots, ghc, ghc->gpa, ghc->len)) |