Contents of /trunk/kernel-magellan/patches-4.20/0107-4.20.8-all-fixes.patch
Parent Directory | Revision Log
Revision 3284 -
(show annotations)
(download)
Mon Mar 4 10:35:54 2019 UTC (5 years, 6 months ago) by niro
File size: 390422 byte(s)
Mon Mar 4 10:35:54 2019 UTC (5 years, 6 months ago) by niro
File size: 390422 byte(s)
linux-4.20.8
1 | diff --git a/Makefile b/Makefile |
2 | index efc46cce5919..d7d190781010 100644 |
3 | --- a/Makefile |
4 | +++ b/Makefile |
5 | @@ -1,7 +1,7 @@ |
6 | # SPDX-License-Identifier: GPL-2.0 |
7 | VERSION = 4 |
8 | PATCHLEVEL = 20 |
9 | -SUBLEVEL = 7 |
10 | +SUBLEVEL = 8 |
11 | EXTRAVERSION = |
12 | NAME = Shy Crocodile |
13 | |
14 | diff --git a/arch/arm/boot/dts/aspeed-bmc-arm-centriq2400-rep.dts b/arch/arm/boot/dts/aspeed-bmc-arm-centriq2400-rep.dts |
15 | index df1227613d48..c2ece0b91885 100644 |
16 | --- a/arch/arm/boot/dts/aspeed-bmc-arm-centriq2400-rep.dts |
17 | +++ b/arch/arm/boot/dts/aspeed-bmc-arm-centriq2400-rep.dts |
18 | @@ -13,7 +13,7 @@ |
19 | bootargs = "console=ttyS4,115200 earlyprintk"; |
20 | }; |
21 | |
22 | - memory { |
23 | + memory@80000000 { |
24 | reg = <0x80000000 0x40000000>; |
25 | }; |
26 | |
27 | diff --git a/arch/arm/boot/dts/aspeed-bmc-intel-s2600wf.dts b/arch/arm/boot/dts/aspeed-bmc-intel-s2600wf.dts |
28 | index 7a291de02543..22dade6393d0 100644 |
29 | --- a/arch/arm/boot/dts/aspeed-bmc-intel-s2600wf.dts |
30 | +++ b/arch/arm/boot/dts/aspeed-bmc-intel-s2600wf.dts |
31 | @@ -13,7 +13,7 @@ |
32 | bootargs = "earlyprintk"; |
33 | }; |
34 | |
35 | - memory { |
36 | + memory@80000000 { |
37 | reg = <0x80000000 0x20000000>; |
38 | }; |
39 | |
40 | diff --git a/arch/arm/boot/dts/aspeed-bmc-opp-lanyang.dts b/arch/arm/boot/dts/aspeed-bmc-opp-lanyang.dts |
41 | index d598b6391362..024e52a6cd0f 100644 |
42 | --- a/arch/arm/boot/dts/aspeed-bmc-opp-lanyang.dts |
43 | +++ b/arch/arm/boot/dts/aspeed-bmc-opp-lanyang.dts |
44 | @@ -14,7 +14,7 @@ |
45 | bootargs = "console=ttyS4,115200 earlyprintk"; |
46 | }; |
47 | |
48 | - memory { |
49 | + memory@80000000 { |
50 | reg = <0x80000000 0x40000000>; |
51 | }; |
52 | |
53 | @@ -322,4 +322,3 @@ |
54 | &adc { |
55 | status = "okay"; |
56 | }; |
57 | - |
58 | diff --git a/arch/arm/boot/dts/aspeed-bmc-portwell-neptune.dts b/arch/arm/boot/dts/aspeed-bmc-portwell-neptune.dts |
59 | index 43ed13963d35..33d704541de6 100644 |
60 | --- a/arch/arm/boot/dts/aspeed-bmc-portwell-neptune.dts |
61 | +++ b/arch/arm/boot/dts/aspeed-bmc-portwell-neptune.dts |
62 | @@ -17,7 +17,7 @@ |
63 | bootargs = "console=ttyS4,115200 earlyprintk"; |
64 | }; |
65 | |
66 | - memory { |
67 | + memory@80000000 { |
68 | reg = <0x80000000 0x20000000>; |
69 | }; |
70 | |
71 | diff --git a/arch/arm/boot/dts/gemini-dlink-dir-685.dts b/arch/arm/boot/dts/gemini-dlink-dir-685.dts |
72 | index 6f258b50eb44..502a361d1fe9 100644 |
73 | --- a/arch/arm/boot/dts/gemini-dlink-dir-685.dts |
74 | +++ b/arch/arm/boot/dts/gemini-dlink-dir-685.dts |
75 | @@ -274,20 +274,16 @@ |
76 | read-only; |
77 | }; |
78 | /* |
79 | - * Between the boot loader and the rootfs is the kernel |
80 | - * in a custom Storlink format flashed from the boot |
81 | - * menu. The rootfs is in squashfs format. |
82 | + * This firmware image contains the kernel catenated |
83 | + * with the squashfs root filesystem. For some reason |
84 | + * this is called "upgrade" on the vendor system. |
85 | */ |
86 | - partition@1800c0 { |
87 | - label = "rootfs"; |
88 | - reg = <0x001800c0 0x01dbff40>; |
89 | - read-only; |
90 | - }; |
91 | - partition@1f40000 { |
92 | + partition@40000 { |
93 | label = "upgrade"; |
94 | - reg = <0x01f40000 0x00040000>; |
95 | + reg = <0x00040000 0x01f40000>; |
96 | read-only; |
97 | }; |
98 | + /* RGDB, Residental Gateway Database? */ |
99 | partition@1f80000 { |
100 | label = "rgdb"; |
101 | reg = <0x01f80000 0x00040000>; |
102 | diff --git a/arch/arm/boot/dts/imx51-zii-rdu1.dts b/arch/arm/boot/dts/imx51-zii-rdu1.dts |
103 | index 69d753cac89a..44985f61c0ba 100644 |
104 | --- a/arch/arm/boot/dts/imx51-zii-rdu1.dts |
105 | +++ b/arch/arm/boot/dts/imx51-zii-rdu1.dts |
106 | @@ -477,6 +477,15 @@ |
107 | }; |
108 | |
109 | &gpio1 { |
110 | + gpio-line-names = "", "", "", "", |
111 | + "", "", "", "", |
112 | + "", "hp-amp-shutdown-b", "", "", |
113 | + "", "", "", "", |
114 | + "", "", "", "", |
115 | + "", "", "", "", |
116 | + "", "", "", "", |
117 | + "", "", "", ""; |
118 | + |
119 | unused-sd3-wp-gpio { |
120 | /* |
121 | * See pinctrl_esdhc1 below for more details on this |
122 | @@ -495,9 +504,6 @@ |
123 | hpa1: amp@60 { |
124 | compatible = "ti,tpa6130a2"; |
125 | reg = <0x60>; |
126 | - pinctrl-names = "default"; |
127 | - pinctrl-0 = <&pinctrl_ampgpio>; |
128 | - power-gpio = <&gpio1 9 GPIO_ACTIVE_HIGH>; |
129 | Vdd-supply = <®_3p3v>; |
130 | }; |
131 | |
132 | @@ -671,7 +677,10 @@ |
133 | }; |
134 | |
135 | &iomuxc { |
136 | - pinctrl_ampgpio: ampgpiogrp { |
137 | + pinctrl-names = "default"; |
138 | + pinctrl-0 = <&pinctrl_hog>; |
139 | + |
140 | + pinctrl_hog: hoggrp { |
141 | fsl,pins = < |
142 | MX51_PAD_GPIO1_9__GPIO1_9 0x5e |
143 | >; |
144 | diff --git a/arch/arm/boot/dts/mmp2.dtsi b/arch/arm/boot/dts/mmp2.dtsi |
145 | index 766bbb8495b6..47e5b63339d1 100644 |
146 | --- a/arch/arm/boot/dts/mmp2.dtsi |
147 | +++ b/arch/arm/boot/dts/mmp2.dtsi |
148 | @@ -220,12 +220,15 @@ |
149 | status = "disabled"; |
150 | }; |
151 | |
152 | - twsi2: i2c@d4025000 { |
153 | + twsi2: i2c@d4031000 { |
154 | compatible = "mrvl,mmp-twsi"; |
155 | - reg = <0xd4025000 0x1000>; |
156 | - interrupts = <58>; |
157 | + reg = <0xd4031000 0x1000>; |
158 | + interrupt-parent = <&intcmux17>; |
159 | + interrupts = <0>; |
160 | clocks = <&soc_clocks MMP2_CLK_TWSI1>; |
161 | resets = <&soc_clocks MMP2_CLK_TWSI1>; |
162 | + #address-cells = <1>; |
163 | + #size-cells = <0>; |
164 | status = "disabled"; |
165 | }; |
166 | |
167 | diff --git a/arch/arm/boot/dts/omap4-sdp.dts b/arch/arm/boot/dts/omap4-sdp.dts |
168 | index 490726b52216..9dc7ec7655cb 100644 |
169 | --- a/arch/arm/boot/dts/omap4-sdp.dts |
170 | +++ b/arch/arm/boot/dts/omap4-sdp.dts |
171 | @@ -33,6 +33,7 @@ |
172 | gpio = <&gpio2 16 GPIO_ACTIVE_HIGH>; /* gpio line 48 */ |
173 | enable-active-high; |
174 | regulator-boot-on; |
175 | + startup-delay-us = <25000>; |
176 | }; |
177 | |
178 | vbat: fixedregulator-vbat { |
179 | diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c |
180 | index 12a6172263c0..3bf82232b1be 100644 |
181 | --- a/arch/arm/kernel/smp.c |
182 | +++ b/arch/arm/kernel/smp.c |
183 | @@ -724,6 +724,21 @@ void smp_send_stop(void) |
184 | pr_warn("SMP: failed to stop secondary CPUs\n"); |
185 | } |
186 | |
187 | +/* In case panic() and panic() called at the same time on CPU1 and CPU2, |
188 | + * and CPU 1 calls panic_smp_self_stop() before crash_smp_send_stop() |
189 | + * CPU1 can't receive the ipi irqs from CPU2, CPU1 will be always online, |
190 | + * kdump fails. So split out the panic_smp_self_stop() and add |
191 | + * set_cpu_online(smp_processor_id(), false). |
192 | + */ |
193 | +void panic_smp_self_stop(void) |
194 | +{ |
195 | + pr_debug("CPU %u will stop doing anything useful since another CPU has paniced\n", |
196 | + smp_processor_id()); |
197 | + set_cpu_online(smp_processor_id(), false); |
198 | + while (1) |
199 | + cpu_relax(); |
200 | +} |
201 | + |
202 | /* |
203 | * not supported here |
204 | */ |
205 | diff --git a/arch/arm/mach-omap1/board-ams-delta.c b/arch/arm/mach-omap1/board-ams-delta.c |
206 | index 17886744dbe6..55bf73710a59 100644 |
207 | --- a/arch/arm/mach-omap1/board-ams-delta.c |
208 | +++ b/arch/arm/mach-omap1/board-ams-delta.c |
209 | @@ -247,8 +247,8 @@ static struct platform_device latch2_gpio_device = { |
210 | #define LATCH2_PIN_SCARD_CMDVCC 11 |
211 | #define LATCH2_PIN_MODEM_NRESET 12 |
212 | #define LATCH2_PIN_MODEM_CODEC 13 |
213 | -#define LATCH2_PIN_HOOKFLASH1 14 |
214 | -#define LATCH2_PIN_HOOKFLASH2 15 |
215 | +#define LATCH2_PIN_AUDIO_MUTE 14 |
216 | +#define LATCH2_PIN_HOOKFLASH 15 |
217 | |
218 | static struct regulator_consumer_supply modem_nreset_consumers[] = { |
219 | REGULATOR_SUPPLY("RESET#", "serial8250.1"), |
220 | @@ -588,6 +588,8 @@ static int gpiochip_match_by_label(struct gpio_chip *chip, void *data) |
221 | static struct gpiod_hog ams_delta_gpio_hogs[] = { |
222 | GPIO_HOG(LATCH2_LABEL, LATCH2_PIN_KEYBRD_DATAOUT, "keybrd_dataout", |
223 | GPIO_ACTIVE_HIGH, GPIOD_OUT_LOW), |
224 | + GPIO_HOG(LATCH2_LABEL, LATCH2_PIN_AUDIO_MUTE, "audio_mute", |
225 | + GPIO_ACTIVE_HIGH, GPIOD_OUT_LOW), |
226 | {}, |
227 | }; |
228 | |
229 | diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c |
230 | index 083dcd9942ce..921c9aaee63f 100644 |
231 | --- a/arch/arm/mach-omap2/omap_hwmod.c |
232 | +++ b/arch/arm/mach-omap2/omap_hwmod.c |
233 | @@ -2413,7 +2413,7 @@ static int __init _init(struct omap_hwmod *oh, void *data) |
234 | * a stub; implementing this properly requires iclk autoidle usecounting in |
235 | * the clock code. No return value. |
236 | */ |
237 | -static void __init _setup_iclk_autoidle(struct omap_hwmod *oh) |
238 | +static void _setup_iclk_autoidle(struct omap_hwmod *oh) |
239 | { |
240 | struct omap_hwmod_ocp_if *os; |
241 | |
242 | @@ -2444,7 +2444,7 @@ static void __init _setup_iclk_autoidle(struct omap_hwmod *oh) |
243 | * reset. Returns 0 upon success or a negative error code upon |
244 | * failure. |
245 | */ |
246 | -static int __init _setup_reset(struct omap_hwmod *oh) |
247 | +static int _setup_reset(struct omap_hwmod *oh) |
248 | { |
249 | int r; |
250 | |
251 | @@ -2505,7 +2505,7 @@ static int __init _setup_reset(struct omap_hwmod *oh) |
252 | * |
253 | * No return value. |
254 | */ |
255 | -static void __init _setup_postsetup(struct omap_hwmod *oh) |
256 | +static void _setup_postsetup(struct omap_hwmod *oh) |
257 | { |
258 | u8 postsetup_state; |
259 | |
260 | diff --git a/arch/arm/mach-pxa/cm-x300.c b/arch/arm/mach-pxa/cm-x300.c |
261 | index c5c0ab8ac9f9..024c1fbcc55a 100644 |
262 | --- a/arch/arm/mach-pxa/cm-x300.c |
263 | +++ b/arch/arm/mach-pxa/cm-x300.c |
264 | @@ -558,7 +558,7 @@ static struct pxa3xx_u2d_platform_data cm_x300_u2d_platform_data = { |
265 | .exit = cm_x300_u2d_exit, |
266 | }; |
267 | |
268 | -static void cm_x300_init_u2d(void) |
269 | +static void __init cm_x300_init_u2d(void) |
270 | { |
271 | pxa3xx_set_u2d_info(&cm_x300_u2d_platform_data); |
272 | } |
273 | diff --git a/arch/arm/mach-pxa/littleton.c b/arch/arm/mach-pxa/littleton.c |
274 | index 9e132b3e48c6..9960ea158829 100644 |
275 | --- a/arch/arm/mach-pxa/littleton.c |
276 | +++ b/arch/arm/mach-pxa/littleton.c |
277 | @@ -184,7 +184,7 @@ static struct pxafb_mach_info littleton_lcd_info = { |
278 | .lcd_conn = LCD_COLOR_TFT_16BPP, |
279 | }; |
280 | |
281 | -static void littleton_init_lcd(void) |
282 | +static void __init littleton_init_lcd(void) |
283 | { |
284 | pxa_set_fb_info(NULL, &littleton_lcd_info); |
285 | } |
286 | diff --git a/arch/arm/mach-pxa/zeus.c b/arch/arm/mach-pxa/zeus.c |
287 | index d53ea12fc766..54a32f0433a2 100644 |
288 | --- a/arch/arm/mach-pxa/zeus.c |
289 | +++ b/arch/arm/mach-pxa/zeus.c |
290 | @@ -576,7 +576,7 @@ static struct pxaohci_platform_data zeus_ohci_platform_data = { |
291 | .flags = ENABLE_PORT_ALL | POWER_SENSE_LOW, |
292 | }; |
293 | |
294 | -static void zeus_register_ohci(void) |
295 | +static void __init zeus_register_ohci(void) |
296 | { |
297 | /* Port 2 is shared between host and client interface. */ |
298 | UP2OCR = UP2OCR_HXOE | UP2OCR_HXS | UP2OCR_DMPDE | UP2OCR_DPPDE; |
299 | diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-orangepi-win.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-orangepi-win.dts |
300 | index b0c64f75792c..8974b5a1d3b1 100644 |
301 | --- a/arch/arm64/boot/dts/allwinner/sun50i-a64-orangepi-win.dts |
302 | +++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-orangepi-win.dts |
303 | @@ -188,6 +188,7 @@ |
304 | reg = <0x3a3>; |
305 | interrupt-parent = <&r_intc>; |
306 | interrupts = <0 IRQ_TYPE_LEVEL_LOW>; |
307 | + x-powers,drive-vbus-en; /* set N_VBUSEN as output pin */ |
308 | }; |
309 | }; |
310 | |
311 | diff --git a/arch/arm64/boot/dts/amlogic/meson-axg.dtsi b/arch/arm64/boot/dts/amlogic/meson-axg.dtsi |
312 | index df017dbd2e57..b1a42e99cb67 100644 |
313 | --- a/arch/arm64/boot/dts/amlogic/meson-axg.dtsi |
314 | +++ b/arch/arm64/boot/dts/amlogic/meson-axg.dtsi |
315 | @@ -143,7 +143,7 @@ |
316 | compatible = "amlogic,meson-axg-dwmac", "snps,dwmac"; |
317 | reg = <0x0 0xff3f0000 0x0 0x10000 |
318 | 0x0 0xff634540 0x0 0x8>; |
319 | - interrupts = <GIC_SPI 8 IRQ_TYPE_EDGE_RISING>; |
320 | + interrupts = <GIC_SPI 8 IRQ_TYPE_LEVEL_HIGH>; |
321 | interrupt-names = "macirq"; |
322 | clocks = <&clkc CLKID_ETH>, |
323 | <&clkc CLKID_FCLK_DIV2>, |
324 | diff --git a/arch/arm64/boot/dts/amlogic/meson-gx.dtsi b/arch/arm64/boot/dts/amlogic/meson-gx.dtsi |
325 | index f1e5cdbade5e..58e6bcaac1d8 100644 |
326 | --- a/arch/arm64/boot/dts/amlogic/meson-gx.dtsi |
327 | +++ b/arch/arm64/boot/dts/amlogic/meson-gx.dtsi |
328 | @@ -462,7 +462,7 @@ |
329 | compatible = "amlogic,meson-gx-dwmac", "amlogic,meson-gxbb-dwmac", "snps,dwmac"; |
330 | reg = <0x0 0xc9410000 0x0 0x10000 |
331 | 0x0 0xc8834540 0x0 0x4>; |
332 | - interrupts = <GIC_SPI 8 IRQ_TYPE_EDGE_RISING>; |
333 | + interrupts = <GIC_SPI 8 IRQ_TYPE_LEVEL_HIGH>; |
334 | interrupt-names = "macirq"; |
335 | status = "disabled"; |
336 | }; |
337 | diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts |
338 | index 54954b314a45..f8d1cedbe600 100644 |
339 | --- a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts |
340 | +++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts |
341 | @@ -143,7 +143,6 @@ |
342 | interrupt-parent = <&gpio_intc>; |
343 | /* MAC_INTR on GPIOZ_15 */ |
344 | interrupts = <29 IRQ_TYPE_LEVEL_LOW>; |
345 | - eee-broken-1000t; |
346 | }; |
347 | }; |
348 | }; |
349 | diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek.dtsi |
350 | index 70325b273bd2..ec09bb5792b7 100644 |
351 | --- a/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek.dtsi |
352 | +++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek.dtsi |
353 | @@ -142,7 +142,6 @@ |
354 | eth_phy0: ethernet-phy@0 { |
355 | /* Realtek RTL8211F (0x001cc916) */ |
356 | reg = <0>; |
357 | - eee-broken-1000t; |
358 | }; |
359 | }; |
360 | }; |
361 | diff --git a/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dts b/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dts |
362 | index 1d35f5406b5e..5bd4d69914bd 100644 |
363 | --- a/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dts |
364 | +++ b/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dts |
365 | @@ -97,7 +97,7 @@ |
366 | vcc3v3_pcie: vcc3v3-pcie-regulator { |
367 | compatible = "regulator-fixed"; |
368 | enable-active-high; |
369 | - gpio = <&gpio1 RK_PC1 GPIO_ACTIVE_HIGH>; |
370 | + gpio = <&gpio1 RK_PD0 GPIO_ACTIVE_HIGH>; |
371 | pinctrl-names = "default"; |
372 | pinctrl-0 = <&pcie_pwr_en>; |
373 | regulator-name = "vcc3v3_pcie"; |
374 | @@ -293,12 +293,12 @@ |
375 | }; |
376 | }; |
377 | |
378 | - vcc2v8_dvp: LDO_REG2 { |
379 | - regulator-name = "vcc2v8_dvp"; |
380 | + vcc3v0_touch: LDO_REG2 { |
381 | + regulator-name = "vcc3v0_touch"; |
382 | regulator-always-on; |
383 | regulator-boot-on; |
384 | - regulator-min-microvolt = <2800000>; |
385 | - regulator-max-microvolt = <2800000>; |
386 | + regulator-min-microvolt = <3000000>; |
387 | + regulator-max-microvolt = <3000000>; |
388 | regulator-state-mem { |
389 | regulator-off-in-suspend; |
390 | }; |
391 | @@ -397,7 +397,9 @@ |
392 | vdd_cpu_b: regulator@40 { |
393 | compatible = "silergy,syr827"; |
394 | reg = <0x40>; |
395 | - fcs,suspend-voltage-selector = <0>; |
396 | + fcs,suspend-voltage-selector = <1>; |
397 | + pinctrl-names = "default"; |
398 | + pinctrl-0 = <&vsel1_gpio>; |
399 | regulator-name = "vdd_cpu_b"; |
400 | regulator-min-microvolt = <712500>; |
401 | regulator-max-microvolt = <1500000>; |
402 | @@ -415,6 +417,8 @@ |
403 | compatible = "silergy,syr828"; |
404 | reg = <0x41>; |
405 | fcs,suspend-voltage-selector = <1>; |
406 | + pinctrl-names = "default"; |
407 | + pinctrl-0 = <&vsel2_gpio>; |
408 | regulator-name = "vdd_gpu"; |
409 | regulator-min-microvolt = <712500>; |
410 | regulator-max-microvolt = <1500000>; |
411 | @@ -519,7 +523,7 @@ |
412 | |
413 | pcie { |
414 | pcie_pwr_en: pcie-pwr-en { |
415 | - rockchip,pins = <1 RK_PC1 RK_FUNC_GPIO &pcfg_pull_none>; |
416 | + rockchip,pins = <1 RK_PD0 RK_FUNC_GPIO &pcfg_pull_none>; |
417 | }; |
418 | }; |
419 | |
420 | @@ -529,7 +533,7 @@ |
421 | }; |
422 | |
423 | vsel1_gpio: vsel1-gpio { |
424 | - rockchip,pins = <1 RK_PC2 RK_FUNC_GPIO &pcfg_pull_down>; |
425 | + rockchip,pins = <1 RK_PC1 RK_FUNC_GPIO &pcfg_pull_down>; |
426 | }; |
427 | |
428 | vsel2_gpio: vsel2-gpio { |
429 | diff --git a/arch/arm64/include/asm/io.h b/arch/arm64/include/asm/io.h |
430 | index 9f8b915af3a7..ee723835c1f4 100644 |
431 | --- a/arch/arm64/include/asm/io.h |
432 | +++ b/arch/arm64/include/asm/io.h |
433 | @@ -104,7 +104,23 @@ static inline u64 __raw_readq(const volatile void __iomem *addr) |
434 | } |
435 | |
436 | /* IO barriers */ |
437 | -#define __iormb() rmb() |
438 | +#define __iormb(v) \ |
439 | +({ \ |
440 | + unsigned long tmp; \ |
441 | + \ |
442 | + rmb(); \ |
443 | + \ |
444 | + /* \ |
445 | + * Create a dummy control dependency from the IO read to any \ |
446 | + * later instructions. This ensures that a subsequent call to \ |
447 | + * udelay() will be ordered due to the ISB in get_cycles(). \ |
448 | + */ \ |
449 | + asm volatile("eor %0, %1, %1\n" \ |
450 | + "cbnz %0, ." \ |
451 | + : "=r" (tmp) : "r" ((unsigned long)(v)) \ |
452 | + : "memory"); \ |
453 | +}) |
454 | + |
455 | #define __iowmb() wmb() |
456 | |
457 | #define mmiowb() do { } while (0) |
458 | @@ -129,10 +145,10 @@ static inline u64 __raw_readq(const volatile void __iomem *addr) |
459 | * following Normal memory access. Writes are ordered relative to any prior |
460 | * Normal memory access. |
461 | */ |
462 | -#define readb(c) ({ u8 __v = readb_relaxed(c); __iormb(); __v; }) |
463 | -#define readw(c) ({ u16 __v = readw_relaxed(c); __iormb(); __v; }) |
464 | -#define readl(c) ({ u32 __v = readl_relaxed(c); __iormb(); __v; }) |
465 | -#define readq(c) ({ u64 __v = readq_relaxed(c); __iormb(); __v; }) |
466 | +#define readb(c) ({ u8 __v = readb_relaxed(c); __iormb(__v); __v; }) |
467 | +#define readw(c) ({ u16 __v = readw_relaxed(c); __iormb(__v); __v; }) |
468 | +#define readl(c) ({ u32 __v = readl_relaxed(c); __iormb(__v); __v; }) |
469 | +#define readq(c) ({ u64 __v = readq_relaxed(c); __iormb(__v); __v; }) |
470 | |
471 | #define writeb(v,c) ({ __iowmb(); writeb_relaxed((v),(c)); }) |
472 | #define writew(v,c) ({ __iowmb(); writew_relaxed((v),(c)); }) |
473 | @@ -183,9 +199,9 @@ extern void __iomem *ioremap_cache(phys_addr_t phys_addr, size_t size); |
474 | /* |
475 | * io{read,write}{16,32,64}be() macros |
476 | */ |
477 | -#define ioread16be(p) ({ __u16 __v = be16_to_cpu((__force __be16)__raw_readw(p)); __iormb(); __v; }) |
478 | -#define ioread32be(p) ({ __u32 __v = be32_to_cpu((__force __be32)__raw_readl(p)); __iormb(); __v; }) |
479 | -#define ioread64be(p) ({ __u64 __v = be64_to_cpu((__force __be64)__raw_readq(p)); __iormb(); __v; }) |
480 | +#define ioread16be(p) ({ __u16 __v = be16_to_cpu((__force __be16)__raw_readw(p)); __iormb(__v); __v; }) |
481 | +#define ioread32be(p) ({ __u32 __v = be32_to_cpu((__force __be32)__raw_readl(p)); __iormb(__v); __v; }) |
482 | +#define ioread64be(p) ({ __u64 __v = be64_to_cpu((__force __be64)__raw_readq(p)); __iormb(__v); __v; }) |
483 | |
484 | #define iowrite16be(v,p) ({ __iowmb(); __raw_writew((__force __u16)cpu_to_be16(v), p); }) |
485 | #define iowrite32be(v,p) ({ __iowmb(); __raw_writel((__force __u32)cpu_to_be32(v), p); }) |
486 | diff --git a/arch/arm64/include/uapi/asm/ptrace.h b/arch/arm64/include/uapi/asm/ptrace.h |
487 | index a36227fdb084..65ef8b0fdb0e 100644 |
488 | --- a/arch/arm64/include/uapi/asm/ptrace.h |
489 | +++ b/arch/arm64/include/uapi/asm/ptrace.h |
490 | @@ -131,7 +131,7 @@ struct user_sve_header { |
491 | |
492 | /* Offset from the start of struct user_sve_header to the register data */ |
493 | #define SVE_PT_REGS_OFFSET \ |
494 | - ((sizeof(struct sve_context) + (SVE_VQ_BYTES - 1)) \ |
495 | + ((sizeof(struct user_sve_header) + (SVE_VQ_BYTES - 1)) \ |
496 | / SVE_VQ_BYTES * SVE_VQ_BYTES) |
497 | |
498 | /* |
499 | diff --git a/arch/arm64/kernel/entry-ftrace.S b/arch/arm64/kernel/entry-ftrace.S |
500 | index 1175f5827ae1..295951f3172e 100644 |
501 | --- a/arch/arm64/kernel/entry-ftrace.S |
502 | +++ b/arch/arm64/kernel/entry-ftrace.S |
503 | @@ -79,7 +79,6 @@ |
504 | .macro mcount_get_lr reg |
505 | ldr \reg, [x29] |
506 | ldr \reg, [\reg, #8] |
507 | - mcount_adjust_addr \reg, \reg |
508 | .endm |
509 | |
510 | .macro mcount_get_lr_addr reg |
511 | diff --git a/arch/mips/boot/dts/img/boston.dts b/arch/mips/boot/dts/img/boston.dts |
512 | index 65af3f6ba81c..84328afa3a55 100644 |
513 | --- a/arch/mips/boot/dts/img/boston.dts |
514 | +++ b/arch/mips/boot/dts/img/boston.dts |
515 | @@ -141,6 +141,12 @@ |
516 | #size-cells = <2>; |
517 | #interrupt-cells = <1>; |
518 | |
519 | + eg20t_phub@2,0,0 { |
520 | + compatible = "pci8086,8801"; |
521 | + reg = <0x00020000 0 0 0 0>; |
522 | + intel,eg20t-prefetch = <0>; |
523 | + }; |
524 | + |
525 | eg20t_mac@2,0,1 { |
526 | compatible = "pci8086,8802"; |
527 | reg = <0x00020100 0 0 0 0>; |
528 | diff --git a/arch/mips/include/asm/mach-jz4740/jz4740_mmc.h b/arch/mips/include/asm/mach-jz4740/jz4740_mmc.h |
529 | index e9cc62cfac99..ff50aeb1a933 100644 |
530 | --- a/arch/mips/include/asm/mach-jz4740/jz4740_mmc.h |
531 | +++ b/arch/mips/include/asm/mach-jz4740/jz4740_mmc.h |
532 | @@ -4,8 +4,6 @@ |
533 | |
534 | struct jz4740_mmc_platform_data { |
535 | int gpio_power; |
536 | - int gpio_card_detect; |
537 | - int gpio_read_only; |
538 | unsigned card_detect_active_low:1; |
539 | unsigned read_only_active_low:1; |
540 | unsigned power_active_low:1; |
541 | diff --git a/arch/mips/include/uapi/asm/inst.h b/arch/mips/include/uapi/asm/inst.h |
542 | index c05dcf5ab414..273ef58f4d43 100644 |
543 | --- a/arch/mips/include/uapi/asm/inst.h |
544 | +++ b/arch/mips/include/uapi/asm/inst.h |
545 | @@ -369,8 +369,8 @@ enum mm_32a_minor_op { |
546 | mm_ext_op = 0x02c, |
547 | mm_pool32axf_op = 0x03c, |
548 | mm_srl32_op = 0x040, |
549 | + mm_srlv32_op = 0x050, |
550 | mm_sra_op = 0x080, |
551 | - mm_srlv32_op = 0x090, |
552 | mm_rotr_op = 0x0c0, |
553 | mm_lwxs_op = 0x118, |
554 | mm_addu32_op = 0x150, |
555 | diff --git a/arch/mips/jz4740/board-qi_lb60.c b/arch/mips/jz4740/board-qi_lb60.c |
556 | index af0c8ace0141..705593d40d12 100644 |
557 | --- a/arch/mips/jz4740/board-qi_lb60.c |
558 | +++ b/arch/mips/jz4740/board-qi_lb60.c |
559 | @@ -43,7 +43,6 @@ |
560 | #include "clock.h" |
561 | |
562 | /* GPIOs */ |
563 | -#define QI_LB60_GPIO_SD_CD JZ_GPIO_PORTD(0) |
564 | #define QI_LB60_GPIO_SD_VCC_EN_N JZ_GPIO_PORTD(2) |
565 | |
566 | #define QI_LB60_GPIO_KEYOUT(x) (JZ_GPIO_PORTC(10) + (x)) |
567 | @@ -386,12 +385,18 @@ static struct platform_device qi_lb60_gpio_keys = { |
568 | }; |
569 | |
570 | static struct jz4740_mmc_platform_data qi_lb60_mmc_pdata = { |
571 | - .gpio_card_detect = QI_LB60_GPIO_SD_CD, |
572 | - .gpio_read_only = -1, |
573 | .gpio_power = QI_LB60_GPIO_SD_VCC_EN_N, |
574 | .power_active_low = 1, |
575 | }; |
576 | |
577 | +static struct gpiod_lookup_table qi_lb60_mmc_gpio_table = { |
578 | + .dev_id = "jz4740-mmc.0", |
579 | + .table = { |
580 | + GPIO_LOOKUP("GPIOD", 0, "cd", GPIO_ACTIVE_HIGH), |
581 | + { }, |
582 | + }, |
583 | +}; |
584 | + |
585 | /* beeper */ |
586 | static struct pwm_lookup qi_lb60_pwm_lookup[] = { |
587 | PWM_LOOKUP("jz4740-pwm", 4, "pwm-beeper", NULL, 0, |
588 | @@ -500,6 +505,7 @@ static int __init qi_lb60_init_platform_devices(void) |
589 | gpiod_add_lookup_table(&qi_lb60_audio_gpio_table); |
590 | gpiod_add_lookup_table(&qi_lb60_nand_gpio_table); |
591 | gpiod_add_lookup_table(&qi_lb60_spigpio_gpio_table); |
592 | + gpiod_add_lookup_table(&qi_lb60_mmc_gpio_table); |
593 | |
594 | spi_register_board_info(qi_lb60_spi_board_info, |
595 | ARRAY_SIZE(qi_lb60_spi_board_info)); |
596 | diff --git a/arch/mips/ralink/Kconfig b/arch/mips/ralink/Kconfig |
597 | index 1f9cb0e3c79a..613d61763433 100644 |
598 | --- a/arch/mips/ralink/Kconfig |
599 | +++ b/arch/mips/ralink/Kconfig |
600 | @@ -38,6 +38,7 @@ choice |
601 | |
602 | config SOC_MT7620 |
603 | bool "MT7620/8" |
604 | + select CPU_MIPSR2_IRQ_VI |
605 | select HW_HAS_PCI |
606 | |
607 | config SOC_MT7621 |
608 | diff --git a/arch/nds32/mm/Makefile b/arch/nds32/mm/Makefile |
609 | index 6b6855852223..7c5c15ad854a 100644 |
610 | --- a/arch/nds32/mm/Makefile |
611 | +++ b/arch/nds32/mm/Makefile |
612 | @@ -4,4 +4,8 @@ obj-y := extable.o tlb.o \ |
613 | |
614 | obj-$(CONFIG_ALIGNMENT_TRAP) += alignment.o |
615 | obj-$(CONFIG_HIGHMEM) += highmem.o |
616 | -CFLAGS_proc-n13.o += -fomit-frame-pointer |
617 | + |
618 | +ifdef CONFIG_FUNCTION_TRACER |
619 | +CFLAGS_REMOVE_proc.o = $(CC_FLAGS_FTRACE) |
620 | +endif |
621 | +CFLAGS_proc.o += -fomit-frame-pointer |
622 | diff --git a/arch/powerpc/include/asm/fadump.h b/arch/powerpc/include/asm/fadump.h |
623 | index 1e7a33592e29..15bc07a31c46 100644 |
624 | --- a/arch/powerpc/include/asm/fadump.h |
625 | +++ b/arch/powerpc/include/asm/fadump.h |
626 | @@ -200,7 +200,7 @@ struct fad_crash_memory_ranges { |
627 | unsigned long long size; |
628 | }; |
629 | |
630 | -extern int is_fadump_boot_memory_area(u64 addr, ulong size); |
631 | +extern int is_fadump_memory_area(u64 addr, ulong size); |
632 | extern int early_init_dt_scan_fw_dump(unsigned long node, |
633 | const char *uname, int depth, void *data); |
634 | extern int fadump_reserve_mem(void); |
635 | diff --git a/arch/powerpc/include/asm/uaccess.h b/arch/powerpc/include/asm/uaccess.h |
636 | index 15bea9a0f260..ebc0b916dcf9 100644 |
637 | --- a/arch/powerpc/include/asm/uaccess.h |
638 | +++ b/arch/powerpc/include/asm/uaccess.h |
639 | @@ -63,7 +63,7 @@ static inline int __access_ok(unsigned long addr, unsigned long size, |
640 | #endif |
641 | |
642 | #define access_ok(type, addr, size) \ |
643 | - (__chk_user_ptr(addr), \ |
644 | + (__chk_user_ptr(addr), (void)(type), \ |
645 | __access_ok((__force unsigned long)(addr), (size), get_fs())) |
646 | |
647 | /* |
648 | diff --git a/arch/powerpc/kernel/fadump.c b/arch/powerpc/kernel/fadump.c |
649 | index 761b28b1427d..7fd9b3e1fa39 100644 |
650 | --- a/arch/powerpc/kernel/fadump.c |
651 | +++ b/arch/powerpc/kernel/fadump.c |
652 | @@ -118,13 +118,19 @@ int __init early_init_dt_scan_fw_dump(unsigned long node, |
653 | |
654 | /* |
655 | * If fadump is registered, check if the memory provided |
656 | - * falls within boot memory area. |
657 | + * falls within boot memory area and reserved memory area. |
658 | */ |
659 | -int is_fadump_boot_memory_area(u64 addr, ulong size) |
660 | +int is_fadump_memory_area(u64 addr, ulong size) |
661 | { |
662 | + u64 d_start = fw_dump.reserve_dump_area_start; |
663 | + u64 d_end = d_start + fw_dump.reserve_dump_area_size; |
664 | + |
665 | if (!fw_dump.dump_registered) |
666 | return 0; |
667 | |
668 | + if (((addr + size) > d_start) && (addr <= d_end)) |
669 | + return 1; |
670 | + |
671 | return (addr + size) > RMA_START && addr <= fw_dump.boot_memory_size; |
672 | } |
673 | |
674 | diff --git a/arch/powerpc/kernel/vmlinux.lds.S b/arch/powerpc/kernel/vmlinux.lds.S |
675 | index 434581bcd5b4..1148c3c60c3b 100644 |
676 | --- a/arch/powerpc/kernel/vmlinux.lds.S |
677 | +++ b/arch/powerpc/kernel/vmlinux.lds.S |
678 | @@ -308,6 +308,10 @@ SECTIONS |
679 | #ifdef CONFIG_PPC32 |
680 | .data : AT(ADDR(.data) - LOAD_OFFSET) { |
681 | DATA_DATA |
682 | +#ifdef CONFIG_UBSAN |
683 | + *(.data..Lubsan_data*) |
684 | + *(.data..Lubsan_type*) |
685 | +#endif |
686 | *(.data.rel*) |
687 | *(SDATA_MAIN) |
688 | *(.sdata2) |
689 | diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c |
690 | index 2869a299c4ed..75e2e471442f 100644 |
691 | --- a/arch/powerpc/kvm/powerpc.c |
692 | +++ b/arch/powerpc/kvm/powerpc.c |
693 | @@ -543,8 +543,11 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext) |
694 | #ifdef CONFIG_PPC_BOOK3S_64 |
695 | case KVM_CAP_SPAPR_TCE: |
696 | case KVM_CAP_SPAPR_TCE_64: |
697 | - /* fallthrough */ |
698 | + r = 1; |
699 | + break; |
700 | case KVM_CAP_SPAPR_TCE_VFIO: |
701 | + r = !!cpu_has_feature(CPU_FTR_HVMODE); |
702 | + break; |
703 | case KVM_CAP_PPC_RTAS: |
704 | case KVM_CAP_PPC_FIXUP_HCALL: |
705 | case KVM_CAP_PPC_ENABLE_HCALL: |
706 | diff --git a/arch/powerpc/mm/fault.c b/arch/powerpc/mm/fault.c |
707 | index 1697e903bbf2..50e5c790d11e 100644 |
708 | --- a/arch/powerpc/mm/fault.c |
709 | +++ b/arch/powerpc/mm/fault.c |
710 | @@ -226,7 +226,9 @@ static int mm_fault_error(struct pt_regs *regs, unsigned long addr, |
711 | static bool bad_kernel_fault(bool is_exec, unsigned long error_code, |
712 | unsigned long address) |
713 | { |
714 | - if (is_exec && (error_code & (DSISR_NOEXEC_OR_G | DSISR_KEYFAULT))) { |
715 | + /* NX faults set DSISR_PROTFAULT on the 8xx, DSISR_NOEXEC_OR_G on others */ |
716 | + if (is_exec && (error_code & (DSISR_NOEXEC_OR_G | DSISR_KEYFAULT | |
717 | + DSISR_PROTFAULT))) { |
718 | printk_ratelimited(KERN_CRIT "kernel tried to execute" |
719 | " exec-protected page (%lx) -" |
720 | "exploit attempt? (uid: %d)\n", |
721 | diff --git a/arch/powerpc/perf/isa207-common.c b/arch/powerpc/perf/isa207-common.c |
722 | index 177de814286f..6a2f65d3d088 100644 |
723 | --- a/arch/powerpc/perf/isa207-common.c |
724 | +++ b/arch/powerpc/perf/isa207-common.c |
725 | @@ -226,8 +226,13 @@ void isa207_get_mem_weight(u64 *weight) |
726 | u64 mmcra = mfspr(SPRN_MMCRA); |
727 | u64 exp = MMCRA_THR_CTR_EXP(mmcra); |
728 | u64 mantissa = MMCRA_THR_CTR_MANT(mmcra); |
729 | + u64 sier = mfspr(SPRN_SIER); |
730 | + u64 val = (sier & ISA207_SIER_TYPE_MASK) >> ISA207_SIER_TYPE_SHIFT; |
731 | |
732 | - *weight = mantissa << (2 * exp); |
733 | + if (val == 0 || val == 7) |
734 | + *weight = 0; |
735 | + else |
736 | + *weight = mantissa << (2 * exp); |
737 | } |
738 | |
739 | int isa207_get_constraint(u64 event, unsigned long *maskp, unsigned long *valp) |
740 | diff --git a/arch/powerpc/platforms/powernv/pci-ioda-tce.c b/arch/powerpc/platforms/powernv/pci-ioda-tce.c |
741 | index fe9691040f54..7639b2168755 100644 |
742 | --- a/arch/powerpc/platforms/powernv/pci-ioda-tce.c |
743 | +++ b/arch/powerpc/platforms/powernv/pci-ioda-tce.c |
744 | @@ -299,7 +299,7 @@ long pnv_pci_ioda2_table_alloc_pages(int nid, __u64 bus_offset, |
745 | if (alloc_userspace_copy) { |
746 | offset = 0; |
747 | uas = pnv_pci_ioda2_table_do_alloc_pages(nid, level_shift, |
748 | - levels, tce_table_size, &offset, |
749 | + tmplevels, tce_table_size, &offset, |
750 | &total_allocated_uas); |
751 | if (!uas) |
752 | goto free_tces_exit; |
753 | diff --git a/arch/powerpc/platforms/pseries/dlpar.c b/arch/powerpc/platforms/pseries/dlpar.c |
754 | index 7625546caefd..17958043e7f7 100644 |
755 | --- a/arch/powerpc/platforms/pseries/dlpar.c |
756 | +++ b/arch/powerpc/platforms/pseries/dlpar.c |
757 | @@ -270,6 +270,8 @@ int dlpar_detach_node(struct device_node *dn) |
758 | if (rc) |
759 | return rc; |
760 | |
761 | + of_node_put(dn); |
762 | + |
763 | return 0; |
764 | } |
765 | |
766 | diff --git a/arch/powerpc/platforms/pseries/hotplug-memory.c b/arch/powerpc/platforms/pseries/hotplug-memory.c |
767 | index 2a983b5a52e1..2318ab29d5dd 100644 |
768 | --- a/arch/powerpc/platforms/pseries/hotplug-memory.c |
769 | +++ b/arch/powerpc/platforms/pseries/hotplug-memory.c |
770 | @@ -355,8 +355,11 @@ static bool lmb_is_removable(struct drmem_lmb *lmb) |
771 | phys_addr = lmb->base_addr; |
772 | |
773 | #ifdef CONFIG_FA_DUMP |
774 | - /* Don't hot-remove memory that falls in fadump boot memory area */ |
775 | - if (is_fadump_boot_memory_area(phys_addr, block_sz)) |
776 | + /* |
777 | + * Don't hot-remove memory that falls in fadump boot memory area |
778 | + * and memory that is reserved for capturing old kernel memory. |
779 | + */ |
780 | + if (is_fadump_memory_area(phys_addr, block_sz)) |
781 | return false; |
782 | #endif |
783 | |
784 | diff --git a/arch/s390/include/uapi/asm/zcrypt.h b/arch/s390/include/uapi/asm/zcrypt.h |
785 | index 42c81a95e97b..494c34c50716 100644 |
786 | --- a/arch/s390/include/uapi/asm/zcrypt.h |
787 | +++ b/arch/s390/include/uapi/asm/zcrypt.h |
788 | @@ -150,8 +150,8 @@ struct ica_xcRB { |
789 | * @cprb_len: CPRB header length [0x0020] |
790 | * @cprb_ver_id: CPRB version id. [0x04] |
791 | * @pad_000: Alignment pad bytes |
792 | - * @flags: Admin cmd [0x80] or functional cmd [0x00] |
793 | - * @func_id: Function id / subtype [0x5434] |
794 | + * @flags: Admin bit [0x80], Special bit [0x20] |
795 | + * @func_id: Function id / subtype [0x5434] "T4" |
796 | * @source_id: Source id [originator id] |
797 | * @target_id: Target id [usage/ctrl domain id] |
798 | * @ret_code: Return code |
799 | diff --git a/arch/sh/boards/mach-kfr2r09/setup.c b/arch/sh/boards/mach-kfr2r09/setup.c |
800 | index e59c577ed871..c70bc7809dda 100644 |
801 | --- a/arch/sh/boards/mach-kfr2r09/setup.c |
802 | +++ b/arch/sh/boards/mach-kfr2r09/setup.c |
803 | @@ -25,7 +25,6 @@ |
804 | #include <linux/memblock.h> |
805 | #include <linux/mfd/tmio.h> |
806 | #include <linux/mmc/host.h> |
807 | -#include <linux/mtd/onenand.h> |
808 | #include <linux/mtd/physmap.h> |
809 | #include <linux/platform_data/lv5207lp.h> |
810 | #include <linux/platform_device.h> |
811 | diff --git a/arch/um/include/asm/pgtable.h b/arch/um/include/asm/pgtable.h |
812 | index 7485398d0737..9c04562310b3 100644 |
813 | --- a/arch/um/include/asm/pgtable.h |
814 | +++ b/arch/um/include/asm/pgtable.h |
815 | @@ -197,12 +197,17 @@ static inline pte_t pte_mkold(pte_t pte) |
816 | |
817 | static inline pte_t pte_wrprotect(pte_t pte) |
818 | { |
819 | - pte_clear_bits(pte, _PAGE_RW); |
820 | + if (likely(pte_get_bits(pte, _PAGE_RW))) |
821 | + pte_clear_bits(pte, _PAGE_RW); |
822 | + else |
823 | + return pte; |
824 | return(pte_mknewprot(pte)); |
825 | } |
826 | |
827 | static inline pte_t pte_mkread(pte_t pte) |
828 | { |
829 | + if (unlikely(pte_get_bits(pte, _PAGE_USER))) |
830 | + return pte; |
831 | pte_set_bits(pte, _PAGE_USER); |
832 | return(pte_mknewprot(pte)); |
833 | } |
834 | @@ -221,6 +226,8 @@ static inline pte_t pte_mkyoung(pte_t pte) |
835 | |
836 | static inline pte_t pte_mkwrite(pte_t pte) |
837 | { |
838 | + if (unlikely(pte_get_bits(pte, _PAGE_RW))) |
839 | + return pte; |
840 | pte_set_bits(pte, _PAGE_RW); |
841 | return(pte_mknewprot(pte)); |
842 | } |
843 | diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c |
844 | index ecc3e34ca955..90b6718ff861 100644 |
845 | --- a/arch/x86/events/intel/core.c |
846 | +++ b/arch/x86/events/intel/core.c |
847 | @@ -3558,6 +3558,14 @@ static void free_excl_cntrs(int cpu) |
848 | } |
849 | |
850 | static void intel_pmu_cpu_dying(int cpu) |
851 | +{ |
852 | + fini_debug_store_on_cpu(cpu); |
853 | + |
854 | + if (x86_pmu.counter_freezing) |
855 | + disable_counter_freeze(); |
856 | +} |
857 | + |
858 | +static void intel_pmu_cpu_dead(int cpu) |
859 | { |
860 | struct cpu_hw_events *cpuc = &per_cpu(cpu_hw_events, cpu); |
861 | struct intel_shared_regs *pc; |
862 | @@ -3570,11 +3578,6 @@ static void intel_pmu_cpu_dying(int cpu) |
863 | } |
864 | |
865 | free_excl_cntrs(cpu); |
866 | - |
867 | - fini_debug_store_on_cpu(cpu); |
868 | - |
869 | - if (x86_pmu.counter_freezing) |
870 | - disable_counter_freeze(); |
871 | } |
872 | |
873 | static void intel_pmu_sched_task(struct perf_event_context *ctx, |
874 | @@ -3663,6 +3666,7 @@ static __initconst const struct x86_pmu core_pmu = { |
875 | .cpu_prepare = intel_pmu_cpu_prepare, |
876 | .cpu_starting = intel_pmu_cpu_starting, |
877 | .cpu_dying = intel_pmu_cpu_dying, |
878 | + .cpu_dead = intel_pmu_cpu_dead, |
879 | }; |
880 | |
881 | static struct attribute *intel_pmu_attrs[]; |
882 | @@ -3703,6 +3707,8 @@ static __initconst const struct x86_pmu intel_pmu = { |
883 | .cpu_prepare = intel_pmu_cpu_prepare, |
884 | .cpu_starting = intel_pmu_cpu_starting, |
885 | .cpu_dying = intel_pmu_cpu_dying, |
886 | + .cpu_dead = intel_pmu_cpu_dead, |
887 | + |
888 | .guest_get_msrs = intel_guest_get_msrs, |
889 | .sched_task = intel_pmu_sched_task, |
890 | }; |
891 | diff --git a/arch/x86/events/intel/uncore_snbep.c b/arch/x86/events/intel/uncore_snbep.c |
892 | index c07bee31abe8..b10e04387f38 100644 |
893 | --- a/arch/x86/events/intel/uncore_snbep.c |
894 | +++ b/arch/x86/events/intel/uncore_snbep.c |
895 | @@ -1222,6 +1222,8 @@ static struct pci_driver snbep_uncore_pci_driver = { |
896 | .id_table = snbep_uncore_pci_ids, |
897 | }; |
898 | |
899 | +#define NODE_ID_MASK 0x7 |
900 | + |
901 | /* |
902 | * build pci bus to socket mapping |
903 | */ |
904 | @@ -1243,7 +1245,7 @@ static int snbep_pci2phy_map_init(int devid, int nodeid_loc, int idmap_loc, bool |
905 | err = pci_read_config_dword(ubox_dev, nodeid_loc, &config); |
906 | if (err) |
907 | break; |
908 | - nodeid = config; |
909 | + nodeid = config & NODE_ID_MASK; |
910 | /* get the Node ID mapping */ |
911 | err = pci_read_config_dword(ubox_dev, idmap_loc, &config); |
912 | if (err) |
913 | diff --git a/arch/x86/include/asm/fpu/internal.h b/arch/x86/include/asm/fpu/internal.h |
914 | index 69dcdf195b61..fa2c93cb42a2 100644 |
915 | --- a/arch/x86/include/asm/fpu/internal.h |
916 | +++ b/arch/x86/include/asm/fpu/internal.h |
917 | @@ -106,6 +106,9 @@ extern void fpstate_sanitize_xstate(struct fpu *fpu); |
918 | #define user_insn(insn, output, input...) \ |
919 | ({ \ |
920 | int err; \ |
921 | + \ |
922 | + might_fault(); \ |
923 | + \ |
924 | asm volatile(ASM_STAC "\n" \ |
925 | "1:" #insn "\n\t" \ |
926 | "2: " ASM_CLAC "\n" \ |
927 | diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c |
928 | index 7b135796813f..d8b0b0e7be32 100644 |
929 | --- a/arch/x86/kernel/cpu/bugs.c |
930 | +++ b/arch/x86/kernel/cpu/bugs.c |
931 | @@ -69,7 +69,7 @@ void __init check_bugs(void) |
932 | * identify_boot_cpu() initialized SMT support information, let the |
933 | * core code know. |
934 | */ |
935 | - cpu_smt_check_topology_early(); |
936 | + cpu_smt_check_topology(); |
937 | |
938 | if (!IS_ENABLED(CONFIG_SMP)) { |
939 | pr_info("CPU: "); |
940 | diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c |
941 | index 36d2696c9563..84089c2342c0 100644 |
942 | --- a/arch/x86/kernel/cpu/mcheck/mce.c |
943 | +++ b/arch/x86/kernel/cpu/mcheck/mce.c |
944 | @@ -786,6 +786,7 @@ static int mce_no_way_out(struct mce *m, char **msg, unsigned long *validp, |
945 | quirk_no_way_out(i, m, regs); |
946 | |
947 | if (mce_severity(m, mca_cfg.tolerant, &tmp, true) >= MCE_PANIC_SEVERITY) { |
948 | + m->bank = i; |
949 | mce_read_aux(m, i); |
950 | *msg = tmp; |
951 | return 1; |
952 | diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c |
953 | index 101f53ccf571..11641d9e7f6f 100644 |
954 | --- a/arch/x86/kvm/svm.c |
955 | +++ b/arch/x86/kvm/svm.c |
956 | @@ -5836,6 +5836,13 @@ static bool svm_cpu_has_accelerated_tpr(void) |
957 | |
958 | static bool svm_has_emulated_msr(int index) |
959 | { |
960 | + switch (index) { |
961 | + case MSR_IA32_MCG_EXT_CTL: |
962 | + return false; |
963 | + default: |
964 | + break; |
965 | + } |
966 | + |
967 | return true; |
968 | } |
969 | |
970 | diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c |
971 | index 5a2c87552122..4ce6595e454c 100644 |
972 | --- a/arch/x86/kvm/vmx.c |
973 | +++ b/arch/x86/kvm/vmx.c |
974 | @@ -28,6 +28,7 @@ |
975 | #include <linux/mm.h> |
976 | #include <linux/highmem.h> |
977 | #include <linux/sched.h> |
978 | +#include <linux/sched/smt.h> |
979 | #include <linux/moduleparam.h> |
980 | #include <linux/mod_devicetable.h> |
981 | #include <linux/trace_events.h> |
982 | @@ -8509,6 +8510,7 @@ static void free_nested(struct kvm_vcpu *vcpu) |
983 | if (!vmx->nested.vmxon && !vmx->nested.smm.vmxon) |
984 | return; |
985 | |
986 | + hrtimer_cancel(&vmx->nested.preemption_timer); |
987 | vmx->nested.vmxon = false; |
988 | vmx->nested.smm.vmxon = false; |
989 | free_vpid(vmx->nested.vpid02); |
990 | @@ -11642,7 +11644,7 @@ static int vmx_vm_init(struct kvm *kvm) |
991 | * Warn upon starting the first VM in a potentially |
992 | * insecure environment. |
993 | */ |
994 | - if (cpu_smt_control == CPU_SMT_ENABLED) |
995 | + if (sched_smt_active()) |
996 | pr_warn_once(L1TF_MSG_SMT); |
997 | if (l1tf_vmx_mitigation == VMENTER_L1D_FLUSH_NEVER) |
998 | pr_warn_once(L1TF_MSG_L1D); |
999 | diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c |
1000 | index 4247cb230bd3..6d69503ca43e 100644 |
1001 | --- a/arch/x86/kvm/x86.c |
1002 | +++ b/arch/x86/kvm/x86.c |
1003 | @@ -5041,6 +5041,13 @@ int kvm_read_guest_virt(struct kvm_vcpu *vcpu, |
1004 | { |
1005 | u32 access = (kvm_x86_ops->get_cpl(vcpu) == 3) ? PFERR_USER_MASK : 0; |
1006 | |
1007 | + /* |
1008 | + * FIXME: this should call handle_emulation_failure if X86EMUL_IO_NEEDED |
1009 | + * is returned, but our callers are not ready for that and they blindly |
1010 | + * call kvm_inject_page_fault. Ensure that they at least do not leak |
1011 | + * uninitialized kernel stack memory into cr2 and error code. |
1012 | + */ |
1013 | + memset(exception, 0, sizeof(*exception)); |
1014 | return kvm_read_guest_virt_helper(addr, val, bytes, vcpu, access, |
1015 | exception); |
1016 | } |
1017 | diff --git a/arch/x86/pci/broadcom_bus.c b/arch/x86/pci/broadcom_bus.c |
1018 | index 526536c81ddc..ca1e8e6dccc8 100644 |
1019 | --- a/arch/x86/pci/broadcom_bus.c |
1020 | +++ b/arch/x86/pci/broadcom_bus.c |
1021 | @@ -50,8 +50,8 @@ static void __init cnb20le_res(u8 bus, u8 slot, u8 func) |
1022 | word1 = read_pci_config_16(bus, slot, func, 0xc0); |
1023 | word2 = read_pci_config_16(bus, slot, func, 0xc2); |
1024 | if (word1 != word2) { |
1025 | - res.start = (word1 << 16) | 0x0000; |
1026 | - res.end = (word2 << 16) | 0xffff; |
1027 | + res.start = ((resource_size_t) word1 << 16) | 0x0000; |
1028 | + res.end = ((resource_size_t) word2 << 16) | 0xffff; |
1029 | res.flags = IORESOURCE_MEM; |
1030 | update_res(info, res.start, res.end, res.flags, 0); |
1031 | } |
1032 | diff --git a/arch/xtensa/boot/dts/xtfpga.dtsi b/arch/xtensa/boot/dts/xtfpga.dtsi |
1033 | index 1090528825ec..e46ae07bab05 100644 |
1034 | --- a/arch/xtensa/boot/dts/xtfpga.dtsi |
1035 | +++ b/arch/xtensa/boot/dts/xtfpga.dtsi |
1036 | @@ -103,7 +103,7 @@ |
1037 | }; |
1038 | }; |
1039 | |
1040 | - spi0: spi-master@0d0a0000 { |
1041 | + spi0: spi@0d0a0000 { |
1042 | compatible = "cdns,xtfpga-spi"; |
1043 | #address-cells = <1>; |
1044 | #size-cells = <0>; |
1045 | diff --git a/crypto/Kconfig b/crypto/Kconfig |
1046 | index 05c91eb10ca1..4f24acac3d48 100644 |
1047 | --- a/crypto/Kconfig |
1048 | +++ b/crypto/Kconfig |
1049 | @@ -1006,7 +1006,8 @@ config CRYPTO_AES_TI |
1050 | 8 for decryption), this implementation only uses just two S-boxes of |
1051 | 256 bytes each, and attempts to eliminate data dependent latencies by |
1052 | prefetching the entire table into the cache at the start of each |
1053 | - block. |
1054 | + block. Interrupts are also disabled to avoid races where cachelines |
1055 | + are evicted when the CPU is interrupted to do something else. |
1056 | |
1057 | config CRYPTO_AES_586 |
1058 | tristate "AES cipher algorithms (i586)" |
1059 | diff --git a/crypto/aes_ti.c b/crypto/aes_ti.c |
1060 | index 03023b2290e8..1ff9785b30f5 100644 |
1061 | --- a/crypto/aes_ti.c |
1062 | +++ b/crypto/aes_ti.c |
1063 | @@ -269,6 +269,7 @@ static void aesti_encrypt(struct crypto_tfm *tfm, u8 *out, const u8 *in) |
1064 | const u32 *rkp = ctx->key_enc + 4; |
1065 | int rounds = 6 + ctx->key_length / 4; |
1066 | u32 st0[4], st1[4]; |
1067 | + unsigned long flags; |
1068 | int round; |
1069 | |
1070 | st0[0] = ctx->key_enc[0] ^ get_unaligned_le32(in); |
1071 | @@ -276,6 +277,12 @@ static void aesti_encrypt(struct crypto_tfm *tfm, u8 *out, const u8 *in) |
1072 | st0[2] = ctx->key_enc[2] ^ get_unaligned_le32(in + 8); |
1073 | st0[3] = ctx->key_enc[3] ^ get_unaligned_le32(in + 12); |
1074 | |
1075 | + /* |
1076 | + * Temporarily disable interrupts to avoid races where cachelines are |
1077 | + * evicted when the CPU is interrupted to do something else. |
1078 | + */ |
1079 | + local_irq_save(flags); |
1080 | + |
1081 | st0[0] ^= __aesti_sbox[ 0] ^ __aesti_sbox[128]; |
1082 | st0[1] ^= __aesti_sbox[32] ^ __aesti_sbox[160]; |
1083 | st0[2] ^= __aesti_sbox[64] ^ __aesti_sbox[192]; |
1084 | @@ -300,6 +307,8 @@ static void aesti_encrypt(struct crypto_tfm *tfm, u8 *out, const u8 *in) |
1085 | put_unaligned_le32(subshift(st1, 1) ^ rkp[5], out + 4); |
1086 | put_unaligned_le32(subshift(st1, 2) ^ rkp[6], out + 8); |
1087 | put_unaligned_le32(subshift(st1, 3) ^ rkp[7], out + 12); |
1088 | + |
1089 | + local_irq_restore(flags); |
1090 | } |
1091 | |
1092 | static void aesti_decrypt(struct crypto_tfm *tfm, u8 *out, const u8 *in) |
1093 | @@ -308,6 +317,7 @@ static void aesti_decrypt(struct crypto_tfm *tfm, u8 *out, const u8 *in) |
1094 | const u32 *rkp = ctx->key_dec + 4; |
1095 | int rounds = 6 + ctx->key_length / 4; |
1096 | u32 st0[4], st1[4]; |
1097 | + unsigned long flags; |
1098 | int round; |
1099 | |
1100 | st0[0] = ctx->key_dec[0] ^ get_unaligned_le32(in); |
1101 | @@ -315,6 +325,12 @@ static void aesti_decrypt(struct crypto_tfm *tfm, u8 *out, const u8 *in) |
1102 | st0[2] = ctx->key_dec[2] ^ get_unaligned_le32(in + 8); |
1103 | st0[3] = ctx->key_dec[3] ^ get_unaligned_le32(in + 12); |
1104 | |
1105 | + /* |
1106 | + * Temporarily disable interrupts to avoid races where cachelines are |
1107 | + * evicted when the CPU is interrupted to do something else. |
1108 | + */ |
1109 | + local_irq_save(flags); |
1110 | + |
1111 | st0[0] ^= __aesti_inv_sbox[ 0] ^ __aesti_inv_sbox[128]; |
1112 | st0[1] ^= __aesti_inv_sbox[32] ^ __aesti_inv_sbox[160]; |
1113 | st0[2] ^= __aesti_inv_sbox[64] ^ __aesti_inv_sbox[192]; |
1114 | @@ -339,6 +355,8 @@ static void aesti_decrypt(struct crypto_tfm *tfm, u8 *out, const u8 *in) |
1115 | put_unaligned_le32(inv_subshift(st1, 1) ^ rkp[5], out + 4); |
1116 | put_unaligned_le32(inv_subshift(st1, 2) ^ rkp[6], out + 8); |
1117 | put_unaligned_le32(inv_subshift(st1, 3) ^ rkp[7], out + 12); |
1118 | + |
1119 | + local_irq_restore(flags); |
1120 | } |
1121 | |
1122 | static struct crypto_alg aes_alg = { |
1123 | diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c |
1124 | index 02c6fd9caff7..f008ba7c9ced 100644 |
1125 | --- a/drivers/acpi/apei/ghes.c |
1126 | +++ b/drivers/acpi/apei/ghes.c |
1127 | @@ -691,6 +691,8 @@ static void __ghes_panic(struct ghes *ghes) |
1128 | { |
1129 | __ghes_print_estatus(KERN_EMERG, ghes->generic, ghes->estatus); |
1130 | |
1131 | + ghes_clear_estatus(ghes); |
1132 | + |
1133 | /* reboot to log the error! */ |
1134 | if (!panic_timeout) |
1135 | panic_timeout = ghes_panic_timeout; |
1136 | diff --git a/drivers/acpi/spcr.c b/drivers/acpi/spcr.c |
1137 | index 9d52743080a4..c336784d0bcb 100644 |
1138 | --- a/drivers/acpi/spcr.c |
1139 | +++ b/drivers/acpi/spcr.c |
1140 | @@ -148,6 +148,13 @@ int __init acpi_parse_spcr(bool enable_earlycon, bool enable_console) |
1141 | } |
1142 | |
1143 | switch (table->baud_rate) { |
1144 | + case 0: |
1145 | + /* |
1146 | + * SPCR 1.04 defines 0 as a preconfigured state of UART. |
1147 | + * Assume firmware or bootloader configures console correctly. |
1148 | + */ |
1149 | + baud_rate = 0; |
1150 | + break; |
1151 | case 3: |
1152 | baud_rate = 9600; |
1153 | break; |
1154 | @@ -196,6 +203,10 @@ int __init acpi_parse_spcr(bool enable_earlycon, bool enable_console) |
1155 | * UART so don't attempt to change to the baud rate state |
1156 | * in the table because driver cannot calculate the dividers |
1157 | */ |
1158 | + baud_rate = 0; |
1159 | + } |
1160 | + |
1161 | + if (!baud_rate) { |
1162 | snprintf(opts, sizeof(opts), "%s,%s,0x%llx", uart, iotype, |
1163 | table->serial_port.address); |
1164 | } else { |
1165 | diff --git a/drivers/ata/sata_rcar.c b/drivers/ata/sata_rcar.c |
1166 | index 4b1ff5bc256a..59b2317acea9 100644 |
1167 | --- a/drivers/ata/sata_rcar.c |
1168 | +++ b/drivers/ata/sata_rcar.c |
1169 | @@ -891,7 +891,9 @@ static int sata_rcar_probe(struct platform_device *pdev) |
1170 | int ret = 0; |
1171 | |
1172 | irq = platform_get_irq(pdev, 0); |
1173 | - if (irq <= 0) |
1174 | + if (irq < 0) |
1175 | + return irq; |
1176 | + if (!irq) |
1177 | return -EINVAL; |
1178 | |
1179 | priv = devm_kzalloc(dev, sizeof(struct sata_rcar_priv), GFP_KERNEL); |
1180 | diff --git a/drivers/base/bus.c b/drivers/base/bus.c |
1181 | index 585e2e1c9c8f..e06a57936cc9 100644 |
1182 | --- a/drivers/base/bus.c |
1183 | +++ b/drivers/base/bus.c |
1184 | @@ -614,8 +614,10 @@ static void remove_probe_files(struct bus_type *bus) |
1185 | static ssize_t uevent_store(struct device_driver *drv, const char *buf, |
1186 | size_t count) |
1187 | { |
1188 | - kobject_synth_uevent(&drv->p->kobj, buf, count); |
1189 | - return count; |
1190 | + int rc; |
1191 | + |
1192 | + rc = kobject_synth_uevent(&drv->p->kobj, buf, count); |
1193 | + return rc ? rc : count; |
1194 | } |
1195 | static DRIVER_ATTR_WO(uevent); |
1196 | |
1197 | @@ -831,8 +833,10 @@ static void klist_devices_put(struct klist_node *n) |
1198 | static ssize_t bus_uevent_store(struct bus_type *bus, |
1199 | const char *buf, size_t count) |
1200 | { |
1201 | - kobject_synth_uevent(&bus->p->subsys.kobj, buf, count); |
1202 | - return count; |
1203 | + int rc; |
1204 | + |
1205 | + rc = kobject_synth_uevent(&bus->p->subsys.kobj, buf, count); |
1206 | + return rc ? rc : count; |
1207 | } |
1208 | static BUS_ATTR(uevent, S_IWUSR, NULL, bus_uevent_store); |
1209 | |
1210 | diff --git a/drivers/base/cacheinfo.c b/drivers/base/cacheinfo.c |
1211 | index cf78fa6d470d..a7359535caf5 100644 |
1212 | --- a/drivers/base/cacheinfo.c |
1213 | +++ b/drivers/base/cacheinfo.c |
1214 | @@ -79,8 +79,7 @@ static void cache_size(struct cacheinfo *this_leaf, struct device_node *np) |
1215 | ct_idx = get_cacheinfo_idx(this_leaf->type); |
1216 | propname = cache_type_info[ct_idx].size_prop; |
1217 | |
1218 | - if (of_property_read_u32(np, propname, &this_leaf->size)) |
1219 | - this_leaf->size = 0; |
1220 | + of_property_read_u32(np, propname, &this_leaf->size); |
1221 | } |
1222 | |
1223 | /* not cache_line_size() because that's a macro in include/linux/cache.h */ |
1224 | @@ -114,8 +113,7 @@ static void cache_nr_sets(struct cacheinfo *this_leaf, struct device_node *np) |
1225 | ct_idx = get_cacheinfo_idx(this_leaf->type); |
1226 | propname = cache_type_info[ct_idx].nr_sets_prop; |
1227 | |
1228 | - if (of_property_read_u32(np, propname, &this_leaf->number_of_sets)) |
1229 | - this_leaf->number_of_sets = 0; |
1230 | + of_property_read_u32(np, propname, &this_leaf->number_of_sets); |
1231 | } |
1232 | |
1233 | static void cache_associativity(struct cacheinfo *this_leaf) |
1234 | diff --git a/drivers/base/core.c b/drivers/base/core.c |
1235 | index 04bbcd779e11..92e2c32c2227 100644 |
1236 | --- a/drivers/base/core.c |
1237 | +++ b/drivers/base/core.c |
1238 | @@ -1067,8 +1067,14 @@ out: |
1239 | static ssize_t uevent_store(struct device *dev, struct device_attribute *attr, |
1240 | const char *buf, size_t count) |
1241 | { |
1242 | - if (kobject_synth_uevent(&dev->kobj, buf, count)) |
1243 | + int rc; |
1244 | + |
1245 | + rc = kobject_synth_uevent(&dev->kobj, buf, count); |
1246 | + |
1247 | + if (rc) { |
1248 | dev_err(dev, "uevent: failed to send synthetic uevent\n"); |
1249 | + return rc; |
1250 | + } |
1251 | |
1252 | return count; |
1253 | } |
1254 | diff --git a/drivers/base/dd.c b/drivers/base/dd.c |
1255 | index dbba123e058d..9d6604b50d75 100644 |
1256 | --- a/drivers/base/dd.c |
1257 | +++ b/drivers/base/dd.c |
1258 | @@ -928,9 +928,6 @@ static void __device_release_driver(struct device *dev, struct device *parent) |
1259 | |
1260 | drv = dev->driver; |
1261 | if (drv) { |
1262 | - if (driver_allows_async_probing(drv)) |
1263 | - async_synchronize_full(); |
1264 | - |
1265 | while (device_links_busy(dev)) { |
1266 | device_unlock(dev); |
1267 | if (parent && dev->bus->need_parent_lock) |
1268 | @@ -1036,6 +1033,9 @@ void driver_detach(struct device_driver *drv) |
1269 | struct device_private *dev_prv; |
1270 | struct device *dev; |
1271 | |
1272 | + if (driver_allows_async_probing(drv)) |
1273 | + async_synchronize_full(); |
1274 | + |
1275 | for (;;) { |
1276 | spin_lock(&drv->p->klist_devices.k_lock); |
1277 | if (list_empty(&drv->p->klist_devices.k_list)) { |
1278 | diff --git a/drivers/block/drbd/drbd_nl.c b/drivers/block/drbd/drbd_nl.c |
1279 | index d15703b1ffe8..714503173150 100644 |
1280 | --- a/drivers/block/drbd/drbd_nl.c |
1281 | +++ b/drivers/block/drbd/drbd_nl.c |
1282 | @@ -668,14 +668,15 @@ drbd_set_role(struct drbd_device *const device, enum drbd_role new_role, int for |
1283 | if (rv == SS_TWO_PRIMARIES) { |
1284 | /* Maybe the peer is detected as dead very soon... |
1285 | retry at most once more in this case. */ |
1286 | - int timeo; |
1287 | - rcu_read_lock(); |
1288 | - nc = rcu_dereference(connection->net_conf); |
1289 | - timeo = nc ? (nc->ping_timeo + 1) * HZ / 10 : 1; |
1290 | - rcu_read_unlock(); |
1291 | - schedule_timeout_interruptible(timeo); |
1292 | - if (try < max_tries) |
1293 | + if (try < max_tries) { |
1294 | + int timeo; |
1295 | try = max_tries - 1; |
1296 | + rcu_read_lock(); |
1297 | + nc = rcu_dereference(connection->net_conf); |
1298 | + timeo = nc ? (nc->ping_timeo + 1) * HZ / 10 : 1; |
1299 | + rcu_read_unlock(); |
1300 | + schedule_timeout_interruptible(timeo); |
1301 | + } |
1302 | continue; |
1303 | } |
1304 | if (rv < SS_SUCCESS) { |
1305 | diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c |
1306 | index 61c392752fe4..e3da52b524d3 100644 |
1307 | --- a/drivers/block/drbd/drbd_receiver.c |
1308 | +++ b/drivers/block/drbd/drbd_receiver.c |
1309 | @@ -3364,7 +3364,7 @@ static enum drbd_conns drbd_sync_handshake(struct drbd_peer_device *peer_device, |
1310 | enum drbd_conns rv = C_MASK; |
1311 | enum drbd_disk_state mydisk; |
1312 | struct net_conf *nc; |
1313 | - int hg, rule_nr, rr_conflict, tentative; |
1314 | + int hg, rule_nr, rr_conflict, tentative, always_asbp; |
1315 | |
1316 | mydisk = device->state.disk; |
1317 | if (mydisk == D_NEGOTIATING) |
1318 | @@ -3415,8 +3415,12 @@ static enum drbd_conns drbd_sync_handshake(struct drbd_peer_device *peer_device, |
1319 | |
1320 | rcu_read_lock(); |
1321 | nc = rcu_dereference(peer_device->connection->net_conf); |
1322 | + always_asbp = nc->always_asbp; |
1323 | + rr_conflict = nc->rr_conflict; |
1324 | + tentative = nc->tentative; |
1325 | + rcu_read_unlock(); |
1326 | |
1327 | - if (hg == 100 || (hg == -100 && nc->always_asbp)) { |
1328 | + if (hg == 100 || (hg == -100 && always_asbp)) { |
1329 | int pcount = (device->state.role == R_PRIMARY) |
1330 | + (peer_role == R_PRIMARY); |
1331 | int forced = (hg == -100); |
1332 | @@ -3455,9 +3459,6 @@ static enum drbd_conns drbd_sync_handshake(struct drbd_peer_device *peer_device, |
1333 | "Sync from %s node\n", |
1334 | (hg < 0) ? "peer" : "this"); |
1335 | } |
1336 | - rr_conflict = nc->rr_conflict; |
1337 | - tentative = nc->tentative; |
1338 | - rcu_read_unlock(); |
1339 | |
1340 | if (hg == -100) { |
1341 | /* FIXME this log message is not correct if we end up here |
1342 | @@ -4142,7 +4143,7 @@ static int receive_uuids(struct drbd_connection *connection, struct packet_info |
1343 | kfree(device->p_uuid); |
1344 | device->p_uuid = p_uuid; |
1345 | |
1346 | - if (device->state.conn < C_CONNECTED && |
1347 | + if ((device->state.conn < C_CONNECTED || device->state.pdsk == D_DISKLESS) && |
1348 | device->state.disk < D_INCONSISTENT && |
1349 | device->state.role == R_PRIMARY && |
1350 | (device->ed_uuid & ~((u64)1)) != (p_uuid[UI_CURRENT] & ~((u64)1))) { |
1351 | diff --git a/drivers/block/sunvdc.c b/drivers/block/sunvdc.c |
1352 | index b54fa6726303..6b7b0d8a2acb 100644 |
1353 | --- a/drivers/block/sunvdc.c |
1354 | +++ b/drivers/block/sunvdc.c |
1355 | @@ -45,6 +45,8 @@ MODULE_VERSION(DRV_MODULE_VERSION); |
1356 | #define WAITING_FOR_GEN_CMD 0x04 |
1357 | #define WAITING_FOR_ANY -1 |
1358 | |
1359 | +#define VDC_MAX_RETRIES 10 |
1360 | + |
1361 | static struct workqueue_struct *sunvdc_wq; |
1362 | |
1363 | struct vdc_req_entry { |
1364 | @@ -431,6 +433,7 @@ static int __vdc_tx_trigger(struct vdc_port *port) |
1365 | .end_idx = dr->prod, |
1366 | }; |
1367 | int err, delay; |
1368 | + int retries = 0; |
1369 | |
1370 | hdr.seq = dr->snd_nxt; |
1371 | delay = 1; |
1372 | @@ -443,6 +446,8 @@ static int __vdc_tx_trigger(struct vdc_port *port) |
1373 | udelay(delay); |
1374 | if ((delay <<= 1) > 128) |
1375 | delay = 128; |
1376 | + if (retries++ > VDC_MAX_RETRIES) |
1377 | + break; |
1378 | } while (err == -EAGAIN); |
1379 | |
1380 | if (err == -ENOTCONN) |
1381 | diff --git a/drivers/block/swim3.c b/drivers/block/swim3.c |
1382 | index c1c676a33e4a..1046459f172b 100644 |
1383 | --- a/drivers/block/swim3.c |
1384 | +++ b/drivers/block/swim3.c |
1385 | @@ -995,7 +995,11 @@ static void floppy_release(struct gendisk *disk, fmode_t mode) |
1386 | struct swim3 __iomem *sw = fs->swim3; |
1387 | |
1388 | mutex_lock(&swim3_mutex); |
1389 | - if (fs->ref_count > 0 && --fs->ref_count == 0) { |
1390 | + if (fs->ref_count > 0) |
1391 | + --fs->ref_count; |
1392 | + else if (fs->ref_count == -1) |
1393 | + fs->ref_count = 0; |
1394 | + if (fs->ref_count == 0) { |
1395 | swim3_action(fs, MOTOR_OFF); |
1396 | out_8(&sw->control_bic, 0xff); |
1397 | swim3_select(fs, RELAX); |
1398 | @@ -1087,8 +1091,6 @@ static int swim3_add_device(struct macio_dev *mdev, int index) |
1399 | struct floppy_state *fs = &floppy_states[index]; |
1400 | int rc = -EBUSY; |
1401 | |
1402 | - /* Do this first for message macros */ |
1403 | - memset(fs, 0, sizeof(*fs)); |
1404 | fs->mdev = mdev; |
1405 | fs->index = index; |
1406 | |
1407 | @@ -1188,14 +1190,15 @@ static int swim3_attach(struct macio_dev *mdev, |
1408 | return rc; |
1409 | } |
1410 | |
1411 | - fs = &floppy_states[floppy_count]; |
1412 | - |
1413 | disk = alloc_disk(1); |
1414 | if (disk == NULL) { |
1415 | rc = -ENOMEM; |
1416 | goto out_unregister; |
1417 | } |
1418 | |
1419 | + fs = &floppy_states[floppy_count]; |
1420 | + memset(fs, 0, sizeof(*fs)); |
1421 | + |
1422 | disk->queue = blk_mq_init_sq_queue(&fs->tag_set, &swim3_mq_ops, 2, |
1423 | BLK_MQ_F_SHOULD_MERGE); |
1424 | if (IS_ERR(disk->queue)) { |
1425 | diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c |
1426 | index 8e6a0db6555f..d1459cc1159f 100644 |
1427 | --- a/drivers/block/zram/zram_drv.c |
1428 | +++ b/drivers/block/zram/zram_drv.c |
1429 | @@ -53,6 +53,11 @@ static size_t huge_class_size; |
1430 | |
1431 | static void zram_free_page(struct zram *zram, size_t index); |
1432 | |
1433 | +static int zram_slot_trylock(struct zram *zram, u32 index) |
1434 | +{ |
1435 | + return bit_spin_trylock(ZRAM_LOCK, &zram->table[index].value); |
1436 | +} |
1437 | + |
1438 | static void zram_slot_lock(struct zram *zram, u32 index) |
1439 | { |
1440 | bit_spin_lock(ZRAM_LOCK, &zram->table[index].value); |
1441 | @@ -401,7 +406,6 @@ static ssize_t backing_dev_store(struct device *dev, |
1442 | goto out; |
1443 | |
1444 | reset_bdev(zram); |
1445 | - spin_lock_init(&zram->bitmap_lock); |
1446 | |
1447 | zram->old_block_size = old_block_size; |
1448 | zram->bdev = bdev; |
1449 | @@ -445,29 +449,24 @@ out: |
1450 | |
1451 | static unsigned long get_entry_bdev(struct zram *zram) |
1452 | { |
1453 | - unsigned long entry; |
1454 | - |
1455 | - spin_lock(&zram->bitmap_lock); |
1456 | + unsigned long blk_idx = 1; |
1457 | +retry: |
1458 | /* skip 0 bit to confuse zram.handle = 0 */ |
1459 | - entry = find_next_zero_bit(zram->bitmap, zram->nr_pages, 1); |
1460 | - if (entry == zram->nr_pages) { |
1461 | - spin_unlock(&zram->bitmap_lock); |
1462 | + blk_idx = find_next_zero_bit(zram->bitmap, zram->nr_pages, blk_idx); |
1463 | + if (blk_idx == zram->nr_pages) |
1464 | return 0; |
1465 | - } |
1466 | |
1467 | - set_bit(entry, zram->bitmap); |
1468 | - spin_unlock(&zram->bitmap_lock); |
1469 | + if (test_and_set_bit(blk_idx, zram->bitmap)) |
1470 | + goto retry; |
1471 | |
1472 | - return entry; |
1473 | + return blk_idx; |
1474 | } |
1475 | |
1476 | static void put_entry_bdev(struct zram *zram, unsigned long entry) |
1477 | { |
1478 | int was_set; |
1479 | |
1480 | - spin_lock(&zram->bitmap_lock); |
1481 | was_set = test_and_clear_bit(entry, zram->bitmap); |
1482 | - spin_unlock(&zram->bitmap_lock); |
1483 | WARN_ON_ONCE(!was_set); |
1484 | } |
1485 | |
1486 | @@ -888,9 +887,10 @@ static ssize_t debug_stat_show(struct device *dev, |
1487 | |
1488 | down_read(&zram->init_lock); |
1489 | ret = scnprintf(buf, PAGE_SIZE, |
1490 | - "version: %d\n%8llu\n", |
1491 | + "version: %d\n%8llu %8llu\n", |
1492 | version, |
1493 | - (u64)atomic64_read(&zram->stats.writestall)); |
1494 | + (u64)atomic64_read(&zram->stats.writestall), |
1495 | + (u64)atomic64_read(&zram->stats.miss_free)); |
1496 | up_read(&zram->init_lock); |
1497 | |
1498 | return ret; |
1499 | @@ -1402,10 +1402,14 @@ static void zram_slot_free_notify(struct block_device *bdev, |
1500 | |
1501 | zram = bdev->bd_disk->private_data; |
1502 | |
1503 | - zram_slot_lock(zram, index); |
1504 | + atomic64_inc(&zram->stats.notify_free); |
1505 | + if (!zram_slot_trylock(zram, index)) { |
1506 | + atomic64_inc(&zram->stats.miss_free); |
1507 | + return; |
1508 | + } |
1509 | + |
1510 | zram_free_page(zram, index); |
1511 | zram_slot_unlock(zram, index); |
1512 | - atomic64_inc(&zram->stats.notify_free); |
1513 | } |
1514 | |
1515 | static int zram_rw_page(struct block_device *bdev, sector_t sector, |
1516 | diff --git a/drivers/block/zram/zram_drv.h b/drivers/block/zram/zram_drv.h |
1517 | index 72c8584b6dff..d1095dfdffa8 100644 |
1518 | --- a/drivers/block/zram/zram_drv.h |
1519 | +++ b/drivers/block/zram/zram_drv.h |
1520 | @@ -79,6 +79,7 @@ struct zram_stats { |
1521 | atomic64_t pages_stored; /* no. of pages currently stored */ |
1522 | atomic_long_t max_used_pages; /* no. of maximum pages stored */ |
1523 | atomic64_t writestall; /* no. of write slow paths */ |
1524 | + atomic64_t miss_free; /* no. of missed free */ |
1525 | }; |
1526 | |
1527 | struct zram { |
1528 | @@ -110,7 +111,6 @@ struct zram { |
1529 | unsigned int old_block_size; |
1530 | unsigned long *bitmap; |
1531 | unsigned long nr_pages; |
1532 | - spinlock_t bitmap_lock; |
1533 | #endif |
1534 | #ifdef CONFIG_ZRAM_MEMORY_TRACKING |
1535 | struct dentry *debugfs_dir; |
1536 | diff --git a/drivers/bluetooth/hci_bcm.c b/drivers/bluetooth/hci_bcm.c |
1537 | index ddbd8c6a0ceb..800132369134 100644 |
1538 | --- a/drivers/bluetooth/hci_bcm.c |
1539 | +++ b/drivers/bluetooth/hci_bcm.c |
1540 | @@ -907,6 +907,10 @@ static int bcm_get_resources(struct bcm_device *dev) |
1541 | |
1542 | dev->clk = devm_clk_get(dev->dev, NULL); |
1543 | |
1544 | + /* Handle deferred probing */ |
1545 | + if (dev->clk == ERR_PTR(-EPROBE_DEFER)) |
1546 | + return PTR_ERR(dev->clk); |
1547 | + |
1548 | dev->device_wakeup = devm_gpiod_get_optional(dev->dev, "device-wakeup", |
1549 | GPIOD_OUT_LOW); |
1550 | if (IS_ERR(dev->device_wakeup)) |
1551 | diff --git a/drivers/cdrom/gdrom.c b/drivers/cdrom/gdrom.c |
1552 | index a5b8afe3609c..f8b7345fe1cb 100644 |
1553 | --- a/drivers/cdrom/gdrom.c |
1554 | +++ b/drivers/cdrom/gdrom.c |
1555 | @@ -873,6 +873,7 @@ static void __exit exit_gdrom(void) |
1556 | platform_device_unregister(pd); |
1557 | platform_driver_unregister(&gdrom_driver); |
1558 | kfree(gd.toc); |
1559 | + kfree(gd.cd_info); |
1560 | } |
1561 | |
1562 | module_init(init_gdrom); |
1563 | diff --git a/drivers/clk/imgtec/clk-boston.c b/drivers/clk/imgtec/clk-boston.c |
1564 | index 15af423cc0c9..f5d54a64d33c 100644 |
1565 | --- a/drivers/clk/imgtec/clk-boston.c |
1566 | +++ b/drivers/clk/imgtec/clk-boston.c |
1567 | @@ -73,27 +73,32 @@ static void __init clk_boston_setup(struct device_node *np) |
1568 | hw = clk_hw_register_fixed_rate(NULL, "input", NULL, 0, in_freq); |
1569 | if (IS_ERR(hw)) { |
1570 | pr_err("failed to register input clock: %ld\n", PTR_ERR(hw)); |
1571 | - return; |
1572 | + goto error; |
1573 | } |
1574 | onecell->hws[BOSTON_CLK_INPUT] = hw; |
1575 | |
1576 | hw = clk_hw_register_fixed_rate(NULL, "sys", "input", 0, sys_freq); |
1577 | if (IS_ERR(hw)) { |
1578 | pr_err("failed to register sys clock: %ld\n", PTR_ERR(hw)); |
1579 | - return; |
1580 | + goto error; |
1581 | } |
1582 | onecell->hws[BOSTON_CLK_SYS] = hw; |
1583 | |
1584 | hw = clk_hw_register_fixed_rate(NULL, "cpu", "input", 0, cpu_freq); |
1585 | if (IS_ERR(hw)) { |
1586 | pr_err("failed to register cpu clock: %ld\n", PTR_ERR(hw)); |
1587 | - return; |
1588 | + goto error; |
1589 | } |
1590 | onecell->hws[BOSTON_CLK_CPU] = hw; |
1591 | |
1592 | err = of_clk_add_hw_provider(np, of_clk_hw_onecell_get, onecell); |
1593 | if (err) |
1594 | pr_err("failed to add DT provider: %d\n", err); |
1595 | + |
1596 | + return; |
1597 | + |
1598 | +error: |
1599 | + kfree(onecell); |
1600 | } |
1601 | |
1602 | /* |
1603 | diff --git a/drivers/clk/imx/clk-imx6sl.c b/drivers/clk/imx/clk-imx6sl.c |
1604 | index 6fcfbbd907a5..e13d8814cfa4 100644 |
1605 | --- a/drivers/clk/imx/clk-imx6sl.c |
1606 | +++ b/drivers/clk/imx/clk-imx6sl.c |
1607 | @@ -17,6 +17,8 @@ |
1608 | |
1609 | #include "clk.h" |
1610 | |
1611 | +#define CCDR 0x4 |
1612 | +#define BM_CCM_CCDR_MMDC_CH0_MASK (1 << 17) |
1613 | #define CCSR 0xc |
1614 | #define BM_CCSR_PLL1_SW_CLK_SEL (1 << 2) |
1615 | #define CACRR 0x10 |
1616 | @@ -411,6 +413,10 @@ static void __init imx6sl_clocks_init(struct device_node *ccm_node) |
1617 | clks[IMX6SL_CLK_USDHC3] = imx_clk_gate2("usdhc3", "usdhc3_podf", base + 0x80, 6); |
1618 | clks[IMX6SL_CLK_USDHC4] = imx_clk_gate2("usdhc4", "usdhc4_podf", base + 0x80, 8); |
1619 | |
1620 | + /* Ensure the MMDC CH0 handshake is bypassed */ |
1621 | + writel_relaxed(readl_relaxed(base + CCDR) | |
1622 | + BM_CCM_CCDR_MMDC_CH0_MASK, base + CCDR); |
1623 | + |
1624 | imx_check_clocks(clks, ARRAY_SIZE(clks)); |
1625 | |
1626 | clk_data.clks = clks; |
1627 | diff --git a/drivers/clk/meson/meson8b.c b/drivers/clk/meson/meson8b.c |
1628 | index 1d39273d7a04..a3a826419c16 100644 |
1629 | --- a/drivers/clk/meson/meson8b.c |
1630 | +++ b/drivers/clk/meson/meson8b.c |
1631 | @@ -599,7 +599,7 @@ static struct clk_regmap meson8b_cpu_scale_div = { |
1632 | .data = &(struct clk_regmap_div_data){ |
1633 | .offset = HHI_SYS_CPU_CLK_CNTL1, |
1634 | .shift = 20, |
1635 | - .width = 9, |
1636 | + .width = 10, |
1637 | .table = cpu_scale_table, |
1638 | .flags = CLK_DIVIDER_ALLOW_ZERO, |
1639 | }, |
1640 | @@ -612,20 +612,27 @@ static struct clk_regmap meson8b_cpu_scale_div = { |
1641 | }, |
1642 | }; |
1643 | |
1644 | +static u32 mux_table_cpu_scale_out_sel[] = { 0, 1, 3 }; |
1645 | static struct clk_regmap meson8b_cpu_scale_out_sel = { |
1646 | .data = &(struct clk_regmap_mux_data){ |
1647 | .offset = HHI_SYS_CPU_CLK_CNTL0, |
1648 | .mask = 0x3, |
1649 | .shift = 2, |
1650 | + .table = mux_table_cpu_scale_out_sel, |
1651 | }, |
1652 | .hw.init = &(struct clk_init_data){ |
1653 | .name = "cpu_scale_out_sel", |
1654 | .ops = &clk_regmap_mux_ro_ops, |
1655 | + /* |
1656 | + * NOTE: We are skipping the parent with value 0x2 (which is |
1657 | + * "cpu_div3") because it results in a duty cycle of 33% which |
1658 | + * makes the system unstable and can result in a lockup of the |
1659 | + * whole system. |
1660 | + */ |
1661 | .parent_names = (const char *[]) { "cpu_in_sel", |
1662 | "cpu_div2", |
1663 | - "cpu_div3", |
1664 | "cpu_scale_div" }, |
1665 | - .num_parents = 4, |
1666 | + .num_parents = 3, |
1667 | .flags = CLK_SET_RATE_PARENT, |
1668 | }, |
1669 | }; |
1670 | @@ -643,7 +650,8 @@ static struct clk_regmap meson8b_cpu_clk = { |
1671 | "cpu_scale_out_sel" }, |
1672 | .num_parents = 2, |
1673 | .flags = (CLK_SET_RATE_PARENT | |
1674 | - CLK_SET_RATE_NO_REPARENT), |
1675 | + CLK_SET_RATE_NO_REPARENT | |
1676 | + CLK_IS_CRITICAL), |
1677 | }, |
1678 | }; |
1679 | |
1680 | diff --git a/drivers/clk/qcom/gcc-msm8998.c b/drivers/clk/qcom/gcc-msm8998.c |
1681 | index 9f0ae403d5f5..cb714c3e2924 100644 |
1682 | --- a/drivers/clk/qcom/gcc-msm8998.c |
1683 | +++ b/drivers/clk/qcom/gcc-msm8998.c |
1684 | @@ -2042,6 +2042,12 @@ static struct clk_branch gcc_mmss_noc_cfg_ahb_clk = { |
1685 | .hw.init = &(struct clk_init_data){ |
1686 | .name = "gcc_mmss_noc_cfg_ahb_clk", |
1687 | .ops = &clk_branch2_ops, |
1688 | + /* |
1689 | + * Any access to mmss depends on this clock. |
1690 | + * Gating this clock has been shown to crash the system |
1691 | + * when mmssnoc_axi_rpm_clk is inited in rpmcc. |
1692 | + */ |
1693 | + .flags = CLK_IS_CRITICAL, |
1694 | }, |
1695 | }, |
1696 | }; |
1697 | diff --git a/drivers/clk/sunxi-ng/ccu-sun50i-h6.c b/drivers/clk/sunxi-ng/ccu-sun50i-h6.c |
1698 | index 2193e1495086..19ff09f610e4 100644 |
1699 | --- a/drivers/clk/sunxi-ng/ccu-sun50i-h6.c |
1700 | +++ b/drivers/clk/sunxi-ng/ccu-sun50i-h6.c |
1701 | @@ -120,6 +120,8 @@ static struct ccu_nm pll_video0_clk = { |
1702 | .n = _SUNXI_CCU_MULT_MIN(8, 8, 12), |
1703 | .m = _SUNXI_CCU_DIV(1, 1), /* input divider */ |
1704 | .fixed_post_div = 4, |
1705 | + .min_rate = 288000000, |
1706 | + .max_rate = 2400000000UL, |
1707 | .common = { |
1708 | .reg = 0x040, |
1709 | .features = CCU_FEATURE_FIXED_POSTDIV, |
1710 | @@ -136,6 +138,8 @@ static struct ccu_nm pll_video1_clk = { |
1711 | .n = _SUNXI_CCU_MULT_MIN(8, 8, 12), |
1712 | .m = _SUNXI_CCU_DIV(1, 1), /* input divider */ |
1713 | .fixed_post_div = 4, |
1714 | + .min_rate = 288000000, |
1715 | + .max_rate = 2400000000UL, |
1716 | .common = { |
1717 | .reg = 0x048, |
1718 | .features = CCU_FEATURE_FIXED_POSTDIV, |
1719 | diff --git a/drivers/clk/sunxi-ng/ccu-sun8i-a33.c b/drivers/clk/sunxi-ng/ccu-sun8i-a33.c |
1720 | index 13eb5b23c5e7..c40d572a7602 100644 |
1721 | --- a/drivers/clk/sunxi-ng/ccu-sun8i-a33.c |
1722 | +++ b/drivers/clk/sunxi-ng/ccu-sun8i-a33.c |
1723 | @@ -366,10 +366,10 @@ static SUNXI_CCU_MP_WITH_MUX_GATE(spi1_clk, "spi1", mod0_default_parents, 0x0a4, |
1724 | static const char * const i2s_parents[] = { "pll-audio-8x", "pll-audio-4x", |
1725 | "pll-audio-2x", "pll-audio" }; |
1726 | static SUNXI_CCU_MUX_WITH_GATE(i2s0_clk, "i2s0", i2s_parents, |
1727 | - 0x0b0, 16, 2, BIT(31), 0); |
1728 | + 0x0b0, 16, 2, BIT(31), CLK_SET_RATE_PARENT); |
1729 | |
1730 | static SUNXI_CCU_MUX_WITH_GATE(i2s1_clk, "i2s1", i2s_parents, |
1731 | - 0x0b4, 16, 2, BIT(31), 0); |
1732 | + 0x0b4, 16, 2, BIT(31), CLK_SET_RATE_PARENT); |
1733 | |
1734 | /* TODO: the parent for most of the USB clocks is not known */ |
1735 | static SUNXI_CCU_GATE(usb_phy0_clk, "usb-phy0", "osc24M", |
1736 | @@ -446,7 +446,7 @@ static SUNXI_CCU_M_WITH_GATE(ve_clk, "ve", "pll-ve", |
1737 | static SUNXI_CCU_GATE(ac_dig_clk, "ac-dig", "pll-audio", |
1738 | 0x140, BIT(31), CLK_SET_RATE_PARENT); |
1739 | static SUNXI_CCU_GATE(ac_dig_4x_clk, "ac-dig-4x", "pll-audio-4x", |
1740 | - 0x140, BIT(30), 0); |
1741 | + 0x140, BIT(30), CLK_SET_RATE_PARENT); |
1742 | static SUNXI_CCU_GATE(avs_clk, "avs", "osc24M", |
1743 | 0x144, BIT(31), 0); |
1744 | |
1745 | diff --git a/drivers/cpuidle/cpuidle-big_little.c b/drivers/cpuidle/cpuidle-big_little.c |
1746 | index db2ede565f1a..b44476a1b7ad 100644 |
1747 | --- a/drivers/cpuidle/cpuidle-big_little.c |
1748 | +++ b/drivers/cpuidle/cpuidle-big_little.c |
1749 | @@ -167,6 +167,7 @@ static int __init bl_idle_init(void) |
1750 | { |
1751 | int ret; |
1752 | struct device_node *root = of_find_node_by_path("/"); |
1753 | + const struct of_device_id *match_id; |
1754 | |
1755 | if (!root) |
1756 | return -ENODEV; |
1757 | @@ -174,7 +175,11 @@ static int __init bl_idle_init(void) |
1758 | /* |
1759 | * Initialize the driver just for a compliant set of machines |
1760 | */ |
1761 | - if (!of_match_node(compatible_machine_match, root)) |
1762 | + match_id = of_match_node(compatible_machine_match, root); |
1763 | + |
1764 | + of_node_put(root); |
1765 | + |
1766 | + if (!match_id) |
1767 | return -ENODEV; |
1768 | |
1769 | if (!mcpm_is_available()) |
1770 | diff --git a/drivers/crypto/ux500/cryp/cryp_core.c b/drivers/crypto/ux500/cryp/cryp_core.c |
1771 | index d2663a4e1f5e..a92a66b1ff46 100644 |
1772 | --- a/drivers/crypto/ux500/cryp/cryp_core.c |
1773 | +++ b/drivers/crypto/ux500/cryp/cryp_core.c |
1774 | @@ -556,7 +556,7 @@ static int cryp_set_dma_transfer(struct cryp_ctx *ctx, |
1775 | desc = dmaengine_prep_slave_sg(channel, |
1776 | ctx->device->dma.sg_src, |
1777 | ctx->device->dma.sg_src_len, |
1778 | - direction, DMA_CTRL_ACK); |
1779 | + DMA_MEM_TO_DEV, DMA_CTRL_ACK); |
1780 | break; |
1781 | |
1782 | case DMA_FROM_DEVICE: |
1783 | @@ -580,7 +580,7 @@ static int cryp_set_dma_transfer(struct cryp_ctx *ctx, |
1784 | desc = dmaengine_prep_slave_sg(channel, |
1785 | ctx->device->dma.sg_dst, |
1786 | ctx->device->dma.sg_dst_len, |
1787 | - direction, |
1788 | + DMA_DEV_TO_MEM, |
1789 | DMA_CTRL_ACK | |
1790 | DMA_PREP_INTERRUPT); |
1791 | |
1792 | diff --git a/drivers/crypto/ux500/hash/hash_core.c b/drivers/crypto/ux500/hash/hash_core.c |
1793 | index 633321a8dd03..a0bb8a6eec3f 100644 |
1794 | --- a/drivers/crypto/ux500/hash/hash_core.c |
1795 | +++ b/drivers/crypto/ux500/hash/hash_core.c |
1796 | @@ -166,7 +166,7 @@ static int hash_set_dma_transfer(struct hash_ctx *ctx, struct scatterlist *sg, |
1797 | __func__); |
1798 | desc = dmaengine_prep_slave_sg(channel, |
1799 | ctx->device->dma.sg, ctx->device->dma.sg_len, |
1800 | - direction, DMA_CTRL_ACK | DMA_PREP_INTERRUPT); |
1801 | + DMA_MEM_TO_DEV, DMA_CTRL_ACK | DMA_PREP_INTERRUPT); |
1802 | if (!desc) { |
1803 | dev_err(ctx->device->dev, |
1804 | "%s: dmaengine_prep_slave_sg() failed!\n", __func__); |
1805 | diff --git a/drivers/dma/bcm2835-dma.c b/drivers/dma/bcm2835-dma.c |
1806 | index cad55ab80d41..15795175160a 100644 |
1807 | --- a/drivers/dma/bcm2835-dma.c |
1808 | +++ b/drivers/dma/bcm2835-dma.c |
1809 | @@ -415,38 +415,32 @@ static void bcm2835_dma_fill_cb_chain_with_sg( |
1810 | } |
1811 | } |
1812 | |
1813 | -static int bcm2835_dma_abort(void __iomem *chan_base) |
1814 | +static int bcm2835_dma_abort(struct bcm2835_chan *c) |
1815 | { |
1816 | - unsigned long cs; |
1817 | + void __iomem *chan_base = c->chan_base; |
1818 | long int timeout = 10000; |
1819 | |
1820 | - cs = readl(chan_base + BCM2835_DMA_CS); |
1821 | - if (!(cs & BCM2835_DMA_ACTIVE)) |
1822 | + /* |
1823 | + * A zero control block address means the channel is idle. |
1824 | + * (The ACTIVE flag in the CS register is not a reliable indicator.) |
1825 | + */ |
1826 | + if (!readl(chan_base + BCM2835_DMA_ADDR)) |
1827 | return 0; |
1828 | |
1829 | /* Write 0 to the active bit - Pause the DMA */ |
1830 | writel(0, chan_base + BCM2835_DMA_CS); |
1831 | |
1832 | /* Wait for any current AXI transfer to complete */ |
1833 | - while ((cs & BCM2835_DMA_ISPAUSED) && --timeout) { |
1834 | + while ((readl(chan_base + BCM2835_DMA_CS) & |
1835 | + BCM2835_DMA_WAITING_FOR_WRITES) && --timeout) |
1836 | cpu_relax(); |
1837 | - cs = readl(chan_base + BCM2835_DMA_CS); |
1838 | - } |
1839 | |
1840 | - /* We'll un-pause when we set of our next DMA */ |
1841 | + /* Peripheral might be stuck and fail to signal AXI write responses */ |
1842 | if (!timeout) |
1843 | - return -ETIMEDOUT; |
1844 | - |
1845 | - if (!(cs & BCM2835_DMA_ACTIVE)) |
1846 | - return 0; |
1847 | - |
1848 | - /* Terminate the control block chain */ |
1849 | - writel(0, chan_base + BCM2835_DMA_NEXTCB); |
1850 | - |
1851 | - /* Abort the whole DMA */ |
1852 | - writel(BCM2835_DMA_ABORT | BCM2835_DMA_ACTIVE, |
1853 | - chan_base + BCM2835_DMA_CS); |
1854 | + dev_err(c->vc.chan.device->dev, |
1855 | + "failed to complete outstanding writes\n"); |
1856 | |
1857 | + writel(BCM2835_DMA_RESET, chan_base + BCM2835_DMA_CS); |
1858 | return 0; |
1859 | } |
1860 | |
1861 | @@ -485,8 +479,15 @@ static irqreturn_t bcm2835_dma_callback(int irq, void *data) |
1862 | |
1863 | spin_lock_irqsave(&c->vc.lock, flags); |
1864 | |
1865 | - /* Acknowledge interrupt */ |
1866 | - writel(BCM2835_DMA_INT, c->chan_base + BCM2835_DMA_CS); |
1867 | + /* |
1868 | + * Clear the INT flag to receive further interrupts. Keep the channel |
1869 | + * active in case the descriptor is cyclic or in case the client has |
1870 | + * already terminated the descriptor and issued a new one. (May happen |
1871 | + * if this IRQ handler is threaded.) If the channel is finished, it |
1872 | + * will remain idle despite the ACTIVE flag being set. |
1873 | + */ |
1874 | + writel(BCM2835_DMA_INT | BCM2835_DMA_ACTIVE, |
1875 | + c->chan_base + BCM2835_DMA_CS); |
1876 | |
1877 | d = c->desc; |
1878 | |
1879 | @@ -494,11 +495,7 @@ static irqreturn_t bcm2835_dma_callback(int irq, void *data) |
1880 | if (d->cyclic) { |
1881 | /* call the cyclic callback */ |
1882 | vchan_cyclic_callback(&d->vd); |
1883 | - |
1884 | - /* Keep the DMA engine running */ |
1885 | - writel(BCM2835_DMA_ACTIVE, |
1886 | - c->chan_base + BCM2835_DMA_CS); |
1887 | - } else { |
1888 | + } else if (!readl(c->chan_base + BCM2835_DMA_ADDR)) { |
1889 | vchan_cookie_complete(&c->desc->vd); |
1890 | bcm2835_dma_start_desc(c); |
1891 | } |
1892 | @@ -788,7 +785,6 @@ static int bcm2835_dma_terminate_all(struct dma_chan *chan) |
1893 | struct bcm2835_chan *c = to_bcm2835_dma_chan(chan); |
1894 | struct bcm2835_dmadev *d = to_bcm2835_dma_dev(c->vc.chan.device); |
1895 | unsigned long flags; |
1896 | - int timeout = 10000; |
1897 | LIST_HEAD(head); |
1898 | |
1899 | spin_lock_irqsave(&c->vc.lock, flags); |
1900 | @@ -798,27 +794,11 @@ static int bcm2835_dma_terminate_all(struct dma_chan *chan) |
1901 | list_del_init(&c->node); |
1902 | spin_unlock(&d->lock); |
1903 | |
1904 | - /* |
1905 | - * Stop DMA activity: we assume the callback will not be called |
1906 | - * after bcm_dma_abort() returns (even if it does, it will see |
1907 | - * c->desc is NULL and exit.) |
1908 | - */ |
1909 | + /* stop DMA activity */ |
1910 | if (c->desc) { |
1911 | vchan_terminate_vdesc(&c->desc->vd); |
1912 | c->desc = NULL; |
1913 | - bcm2835_dma_abort(c->chan_base); |
1914 | - |
1915 | - /* Wait for stopping */ |
1916 | - while (--timeout) { |
1917 | - if (!(readl(c->chan_base + BCM2835_DMA_CS) & |
1918 | - BCM2835_DMA_ACTIVE)) |
1919 | - break; |
1920 | - |
1921 | - cpu_relax(); |
1922 | - } |
1923 | - |
1924 | - if (!timeout) |
1925 | - dev_err(d->ddev.dev, "DMA transfer could not be terminated\n"); |
1926 | + bcm2835_dma_abort(c); |
1927 | } |
1928 | |
1929 | vchan_get_all_descriptors(&c->vc, &head); |
1930 | diff --git a/drivers/dma/imx-dma.c b/drivers/dma/imx-dma.c |
1931 | index c2fff3f6c9ca..4a09af3cd546 100644 |
1932 | --- a/drivers/dma/imx-dma.c |
1933 | +++ b/drivers/dma/imx-dma.c |
1934 | @@ -618,7 +618,7 @@ static void imxdma_tasklet(unsigned long data) |
1935 | { |
1936 | struct imxdma_channel *imxdmac = (void *)data; |
1937 | struct imxdma_engine *imxdma = imxdmac->imxdma; |
1938 | - struct imxdma_desc *desc; |
1939 | + struct imxdma_desc *desc, *next_desc; |
1940 | unsigned long flags; |
1941 | |
1942 | spin_lock_irqsave(&imxdma->lock, flags); |
1943 | @@ -648,10 +648,10 @@ static void imxdma_tasklet(unsigned long data) |
1944 | list_move_tail(imxdmac->ld_active.next, &imxdmac->ld_free); |
1945 | |
1946 | if (!list_empty(&imxdmac->ld_queue)) { |
1947 | - desc = list_first_entry(&imxdmac->ld_queue, struct imxdma_desc, |
1948 | - node); |
1949 | + next_desc = list_first_entry(&imxdmac->ld_queue, |
1950 | + struct imxdma_desc, node); |
1951 | list_move_tail(imxdmac->ld_queue.next, &imxdmac->ld_active); |
1952 | - if (imxdma_xfer_desc(desc) < 0) |
1953 | + if (imxdma_xfer_desc(next_desc) < 0) |
1954 | dev_warn(imxdma->dev, "%s: channel: %d couldn't xfer desc\n", |
1955 | __func__, imxdmac->channel); |
1956 | } |
1957 | diff --git a/drivers/dma/sprd-dma.c b/drivers/dma/sprd-dma.c |
1958 | index 38d4e4f07c66..f7da9ab31b7c 100644 |
1959 | --- a/drivers/dma/sprd-dma.c |
1960 | +++ b/drivers/dma/sprd-dma.c |
1961 | @@ -450,7 +450,7 @@ static irqreturn_t dma_irq_handle(int irq, void *dev_id) |
1962 | struct sprd_dma_desc *sdesc; |
1963 | enum sprd_dma_req_mode req_type; |
1964 | enum sprd_dma_int_type int_type; |
1965 | - bool trans_done = false; |
1966 | + bool trans_done = false, cyclic = false; |
1967 | u32 i; |
1968 | |
1969 | while (irq_status) { |
1970 | @@ -465,13 +465,19 @@ static irqreturn_t dma_irq_handle(int irq, void *dev_id) |
1971 | |
1972 | sdesc = schan->cur_desc; |
1973 | |
1974 | - /* Check if the dma request descriptor is done. */ |
1975 | - trans_done = sprd_dma_check_trans_done(sdesc, int_type, |
1976 | - req_type); |
1977 | - if (trans_done == true) { |
1978 | - vchan_cookie_complete(&sdesc->vd); |
1979 | - schan->cur_desc = NULL; |
1980 | - sprd_dma_start(schan); |
1981 | + /* cyclic mode schedule callback */ |
1982 | + cyclic = schan->linklist.phy_addr ? true : false; |
1983 | + if (cyclic == true) { |
1984 | + vchan_cyclic_callback(&sdesc->vd); |
1985 | + } else { |
1986 | + /* Check if the dma request descriptor is done. */ |
1987 | + trans_done = sprd_dma_check_trans_done(sdesc, int_type, |
1988 | + req_type); |
1989 | + if (trans_done == true) { |
1990 | + vchan_cookie_complete(&sdesc->vd); |
1991 | + schan->cur_desc = NULL; |
1992 | + sprd_dma_start(schan); |
1993 | + } |
1994 | } |
1995 | spin_unlock(&schan->vc.lock); |
1996 | } |
1997 | @@ -674,9 +680,6 @@ static int sprd_dma_fill_desc(struct dma_chan *chan, |
1998 | |
1999 | /* link-list configuration */ |
2000 | if (schan->linklist.phy_addr) { |
2001 | - if (sg_index == sglen - 1) |
2002 | - hw->frg_len |= SPRD_DMA_LLIST_END; |
2003 | - |
2004 | hw->cfg |= SPRD_DMA_LINKLIST_EN; |
2005 | |
2006 | /* link-list index */ |
2007 | diff --git a/drivers/dma/xilinx/zynqmp_dma.c b/drivers/dma/xilinx/zynqmp_dma.c |
2008 | index c74a88b65039..73de6a6179fc 100644 |
2009 | --- a/drivers/dma/xilinx/zynqmp_dma.c |
2010 | +++ b/drivers/dma/xilinx/zynqmp_dma.c |
2011 | @@ -163,7 +163,7 @@ struct zynqmp_dma_desc_ll { |
2012 | u32 ctrl; |
2013 | u64 nxtdscraddr; |
2014 | u64 rsvd; |
2015 | -}; __aligned(64) |
2016 | +}; |
2017 | |
2018 | /** |
2019 | * struct zynqmp_dma_desc_sw - Per Transaction structure |
2020 | diff --git a/drivers/firmware/efi/vars.c b/drivers/firmware/efi/vars.c |
2021 | index 9336ffdf6e2c..fceaafd67ec6 100644 |
2022 | --- a/drivers/firmware/efi/vars.c |
2023 | +++ b/drivers/firmware/efi/vars.c |
2024 | @@ -318,7 +318,12 @@ EXPORT_SYMBOL_GPL(efivar_variable_is_removable); |
2025 | static efi_status_t |
2026 | check_var_size(u32 attributes, unsigned long size) |
2027 | { |
2028 | - const struct efivar_operations *fops = __efivars->ops; |
2029 | + const struct efivar_operations *fops; |
2030 | + |
2031 | + if (!__efivars) |
2032 | + return EFI_UNSUPPORTED; |
2033 | + |
2034 | + fops = __efivars->ops; |
2035 | |
2036 | if (!fops->query_variable_store) |
2037 | return EFI_UNSUPPORTED; |
2038 | @@ -329,7 +334,12 @@ check_var_size(u32 attributes, unsigned long size) |
2039 | static efi_status_t |
2040 | check_var_size_nonblocking(u32 attributes, unsigned long size) |
2041 | { |
2042 | - const struct efivar_operations *fops = __efivars->ops; |
2043 | + const struct efivar_operations *fops; |
2044 | + |
2045 | + if (!__efivars) |
2046 | + return EFI_UNSUPPORTED; |
2047 | + |
2048 | + fops = __efivars->ops; |
2049 | |
2050 | if (!fops->query_variable_store) |
2051 | return EFI_UNSUPPORTED; |
2052 | @@ -429,13 +439,18 @@ static void dup_variable_bug(efi_char16_t *str16, efi_guid_t *vendor_guid, |
2053 | int efivar_init(int (*func)(efi_char16_t *, efi_guid_t, unsigned long, void *), |
2054 | void *data, bool duplicates, struct list_head *head) |
2055 | { |
2056 | - const struct efivar_operations *ops = __efivars->ops; |
2057 | + const struct efivar_operations *ops; |
2058 | unsigned long variable_name_size = 1024; |
2059 | efi_char16_t *variable_name; |
2060 | efi_status_t status; |
2061 | efi_guid_t vendor_guid; |
2062 | int err = 0; |
2063 | |
2064 | + if (!__efivars) |
2065 | + return -EFAULT; |
2066 | + |
2067 | + ops = __efivars->ops; |
2068 | + |
2069 | variable_name = kzalloc(variable_name_size, GFP_KERNEL); |
2070 | if (!variable_name) { |
2071 | printk(KERN_ERR "efivars: Memory allocation failed.\n"); |
2072 | @@ -583,12 +598,14 @@ static void efivar_entry_list_del_unlock(struct efivar_entry *entry) |
2073 | */ |
2074 | int __efivar_entry_delete(struct efivar_entry *entry) |
2075 | { |
2076 | - const struct efivar_operations *ops = __efivars->ops; |
2077 | efi_status_t status; |
2078 | |
2079 | - status = ops->set_variable(entry->var.VariableName, |
2080 | - &entry->var.VendorGuid, |
2081 | - 0, 0, NULL); |
2082 | + if (!__efivars) |
2083 | + return -EINVAL; |
2084 | + |
2085 | + status = __efivars->ops->set_variable(entry->var.VariableName, |
2086 | + &entry->var.VendorGuid, |
2087 | + 0, 0, NULL); |
2088 | |
2089 | return efi_status_to_err(status); |
2090 | } |
2091 | @@ -607,12 +624,17 @@ EXPORT_SYMBOL_GPL(__efivar_entry_delete); |
2092 | */ |
2093 | int efivar_entry_delete(struct efivar_entry *entry) |
2094 | { |
2095 | - const struct efivar_operations *ops = __efivars->ops; |
2096 | + const struct efivar_operations *ops; |
2097 | efi_status_t status; |
2098 | |
2099 | if (down_interruptible(&efivars_lock)) |
2100 | return -EINTR; |
2101 | |
2102 | + if (!__efivars) { |
2103 | + up(&efivars_lock); |
2104 | + return -EINVAL; |
2105 | + } |
2106 | + ops = __efivars->ops; |
2107 | status = ops->set_variable(entry->var.VariableName, |
2108 | &entry->var.VendorGuid, |
2109 | 0, 0, NULL); |
2110 | @@ -650,13 +672,19 @@ EXPORT_SYMBOL_GPL(efivar_entry_delete); |
2111 | int efivar_entry_set(struct efivar_entry *entry, u32 attributes, |
2112 | unsigned long size, void *data, struct list_head *head) |
2113 | { |
2114 | - const struct efivar_operations *ops = __efivars->ops; |
2115 | + const struct efivar_operations *ops; |
2116 | efi_status_t status; |
2117 | efi_char16_t *name = entry->var.VariableName; |
2118 | efi_guid_t vendor = entry->var.VendorGuid; |
2119 | |
2120 | if (down_interruptible(&efivars_lock)) |
2121 | return -EINTR; |
2122 | + |
2123 | + if (!__efivars) { |
2124 | + up(&efivars_lock); |
2125 | + return -EINVAL; |
2126 | + } |
2127 | + ops = __efivars->ops; |
2128 | if (head && efivar_entry_find(name, vendor, head, false)) { |
2129 | up(&efivars_lock); |
2130 | return -EEXIST; |
2131 | @@ -687,12 +715,17 @@ static int |
2132 | efivar_entry_set_nonblocking(efi_char16_t *name, efi_guid_t vendor, |
2133 | u32 attributes, unsigned long size, void *data) |
2134 | { |
2135 | - const struct efivar_operations *ops = __efivars->ops; |
2136 | + const struct efivar_operations *ops; |
2137 | efi_status_t status; |
2138 | |
2139 | if (down_trylock(&efivars_lock)) |
2140 | return -EBUSY; |
2141 | |
2142 | + if (!__efivars) { |
2143 | + up(&efivars_lock); |
2144 | + return -EINVAL; |
2145 | + } |
2146 | + |
2147 | status = check_var_size_nonblocking(attributes, |
2148 | size + ucs2_strsize(name, 1024)); |
2149 | if (status != EFI_SUCCESS) { |
2150 | @@ -700,6 +733,7 @@ efivar_entry_set_nonblocking(efi_char16_t *name, efi_guid_t vendor, |
2151 | return -ENOSPC; |
2152 | } |
2153 | |
2154 | + ops = __efivars->ops; |
2155 | status = ops->set_variable_nonblocking(name, &vendor, attributes, |
2156 | size, data); |
2157 | |
2158 | @@ -727,9 +761,13 @@ efivar_entry_set_nonblocking(efi_char16_t *name, efi_guid_t vendor, |
2159 | int efivar_entry_set_safe(efi_char16_t *name, efi_guid_t vendor, u32 attributes, |
2160 | bool block, unsigned long size, void *data) |
2161 | { |
2162 | - const struct efivar_operations *ops = __efivars->ops; |
2163 | + const struct efivar_operations *ops; |
2164 | efi_status_t status; |
2165 | |
2166 | + if (!__efivars) |
2167 | + return -EINVAL; |
2168 | + |
2169 | + ops = __efivars->ops; |
2170 | if (!ops->query_variable_store) |
2171 | return -ENOSYS; |
2172 | |
2173 | @@ -829,13 +867,18 @@ EXPORT_SYMBOL_GPL(efivar_entry_find); |
2174 | */ |
2175 | int efivar_entry_size(struct efivar_entry *entry, unsigned long *size) |
2176 | { |
2177 | - const struct efivar_operations *ops = __efivars->ops; |
2178 | + const struct efivar_operations *ops; |
2179 | efi_status_t status; |
2180 | |
2181 | *size = 0; |
2182 | |
2183 | if (down_interruptible(&efivars_lock)) |
2184 | return -EINTR; |
2185 | + if (!__efivars) { |
2186 | + up(&efivars_lock); |
2187 | + return -EINVAL; |
2188 | + } |
2189 | + ops = __efivars->ops; |
2190 | status = ops->get_variable(entry->var.VariableName, |
2191 | &entry->var.VendorGuid, NULL, size, NULL); |
2192 | up(&efivars_lock); |
2193 | @@ -861,12 +904,14 @@ EXPORT_SYMBOL_GPL(efivar_entry_size); |
2194 | int __efivar_entry_get(struct efivar_entry *entry, u32 *attributes, |
2195 | unsigned long *size, void *data) |
2196 | { |
2197 | - const struct efivar_operations *ops = __efivars->ops; |
2198 | efi_status_t status; |
2199 | |
2200 | - status = ops->get_variable(entry->var.VariableName, |
2201 | - &entry->var.VendorGuid, |
2202 | - attributes, size, data); |
2203 | + if (!__efivars) |
2204 | + return -EINVAL; |
2205 | + |
2206 | + status = __efivars->ops->get_variable(entry->var.VariableName, |
2207 | + &entry->var.VendorGuid, |
2208 | + attributes, size, data); |
2209 | |
2210 | return efi_status_to_err(status); |
2211 | } |
2212 | @@ -882,14 +927,19 @@ EXPORT_SYMBOL_GPL(__efivar_entry_get); |
2213 | int efivar_entry_get(struct efivar_entry *entry, u32 *attributes, |
2214 | unsigned long *size, void *data) |
2215 | { |
2216 | - const struct efivar_operations *ops = __efivars->ops; |
2217 | efi_status_t status; |
2218 | |
2219 | if (down_interruptible(&efivars_lock)) |
2220 | return -EINTR; |
2221 | - status = ops->get_variable(entry->var.VariableName, |
2222 | - &entry->var.VendorGuid, |
2223 | - attributes, size, data); |
2224 | + |
2225 | + if (!__efivars) { |
2226 | + up(&efivars_lock); |
2227 | + return -EINVAL; |
2228 | + } |
2229 | + |
2230 | + status = __efivars->ops->get_variable(entry->var.VariableName, |
2231 | + &entry->var.VendorGuid, |
2232 | + attributes, size, data); |
2233 | up(&efivars_lock); |
2234 | |
2235 | return efi_status_to_err(status); |
2236 | @@ -921,7 +971,7 @@ EXPORT_SYMBOL_GPL(efivar_entry_get); |
2237 | int efivar_entry_set_get_size(struct efivar_entry *entry, u32 attributes, |
2238 | unsigned long *size, void *data, bool *set) |
2239 | { |
2240 | - const struct efivar_operations *ops = __efivars->ops; |
2241 | + const struct efivar_operations *ops; |
2242 | efi_char16_t *name = entry->var.VariableName; |
2243 | efi_guid_t *vendor = &entry->var.VendorGuid; |
2244 | efi_status_t status; |
2245 | @@ -940,6 +990,11 @@ int efivar_entry_set_get_size(struct efivar_entry *entry, u32 attributes, |
2246 | if (down_interruptible(&efivars_lock)) |
2247 | return -EINTR; |
2248 | |
2249 | + if (!__efivars) { |
2250 | + err = -EINVAL; |
2251 | + goto out; |
2252 | + } |
2253 | + |
2254 | /* |
2255 | * Ensure that the available space hasn't shrunk below the safe level |
2256 | */ |
2257 | @@ -956,6 +1011,8 @@ int efivar_entry_set_get_size(struct efivar_entry *entry, u32 attributes, |
2258 | } |
2259 | } |
2260 | |
2261 | + ops = __efivars->ops; |
2262 | + |
2263 | status = ops->set_variable(name, vendor, attributes, *size, data); |
2264 | if (status != EFI_SUCCESS) { |
2265 | err = efi_status_to_err(status); |
2266 | diff --git a/drivers/fpga/altera-cvp.c b/drivers/fpga/altera-cvp.c |
2267 | index d9fa7d4bf11f..35c3aa5792e2 100644 |
2268 | --- a/drivers/fpga/altera-cvp.c |
2269 | +++ b/drivers/fpga/altera-cvp.c |
2270 | @@ -403,6 +403,7 @@ static int altera_cvp_probe(struct pci_dev *pdev, |
2271 | struct altera_cvp_conf *conf; |
2272 | struct fpga_manager *mgr; |
2273 | u16 cmd, val; |
2274 | + u32 regval; |
2275 | int ret; |
2276 | |
2277 | /* |
2278 | @@ -416,6 +417,14 @@ static int altera_cvp_probe(struct pci_dev *pdev, |
2279 | return -ENODEV; |
2280 | } |
2281 | |
2282 | + pci_read_config_dword(pdev, VSE_CVP_STATUS, ®val); |
2283 | + if (!(regval & VSE_CVP_STATUS_CVP_EN)) { |
2284 | + dev_err(&pdev->dev, |
2285 | + "CVP is disabled for this device: CVP_STATUS Reg 0x%x\n", |
2286 | + regval); |
2287 | + return -ENODEV; |
2288 | + } |
2289 | + |
2290 | conf = devm_kzalloc(&pdev->dev, sizeof(*conf), GFP_KERNEL); |
2291 | if (!conf) |
2292 | return -ENOMEM; |
2293 | @@ -469,7 +478,8 @@ static int altera_cvp_probe(struct pci_dev *pdev, |
2294 | return 0; |
2295 | |
2296 | err_unmap: |
2297 | - pci_iounmap(pdev, conf->map); |
2298 | + if (conf->map) |
2299 | + pci_iounmap(pdev, conf->map); |
2300 | pci_release_region(pdev, CVP_BAR); |
2301 | err_disable: |
2302 | cmd &= ~PCI_COMMAND_MEMORY; |
2303 | @@ -484,7 +494,8 @@ static void altera_cvp_remove(struct pci_dev *pdev) |
2304 | u16 cmd; |
2305 | |
2306 | fpga_mgr_unregister(mgr); |
2307 | - pci_iounmap(pdev, conf->map); |
2308 | + if (conf->map) |
2309 | + pci_iounmap(pdev, conf->map); |
2310 | pci_release_region(pdev, CVP_BAR); |
2311 | pci_read_config_word(pdev, PCI_COMMAND, &cmd); |
2312 | cmd &= ~PCI_COMMAND_MEMORY; |
2313 | diff --git a/drivers/gpio/gpio-mt7621.c b/drivers/gpio/gpio-mt7621.c |
2314 | index d72af6f6cdbd..00e954f22bc9 100644 |
2315 | --- a/drivers/gpio/gpio-mt7621.c |
2316 | +++ b/drivers/gpio/gpio-mt7621.c |
2317 | @@ -244,6 +244,8 @@ mediatek_gpio_bank_probe(struct device *dev, |
2318 | rg->chip.of_xlate = mediatek_gpio_xlate; |
2319 | rg->chip.label = devm_kasprintf(dev, GFP_KERNEL, "%s-bank%d", |
2320 | dev_name(dev), bank); |
2321 | + if (!rg->chip.label) |
2322 | + return -ENOMEM; |
2323 | |
2324 | ret = devm_gpiochip_add_data(dev, &rg->chip, mtk); |
2325 | if (ret < 0) { |
2326 | @@ -295,6 +297,7 @@ mediatek_gpio_probe(struct platform_device *pdev) |
2327 | struct device_node *np = dev->of_node; |
2328 | struct mtk *mtk; |
2329 | int i; |
2330 | + int ret; |
2331 | |
2332 | mtk = devm_kzalloc(dev, sizeof(*mtk), GFP_KERNEL); |
2333 | if (!mtk) |
2334 | @@ -309,8 +312,11 @@ mediatek_gpio_probe(struct platform_device *pdev) |
2335 | platform_set_drvdata(pdev, mtk); |
2336 | mediatek_gpio_irq_chip.name = dev_name(dev); |
2337 | |
2338 | - for (i = 0; i < MTK_BANK_CNT; i++) |
2339 | - mediatek_gpio_bank_probe(dev, np, i); |
2340 | + for (i = 0; i < MTK_BANK_CNT; i++) { |
2341 | + ret = mediatek_gpio_bank_probe(dev, np, i); |
2342 | + if (ret) |
2343 | + return ret; |
2344 | + } |
2345 | |
2346 | return 0; |
2347 | } |
2348 | diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c |
2349 | index 76913e23cf3a..bd44be115cdd 100644 |
2350 | --- a/drivers/gpio/gpiolib.c |
2351 | +++ b/drivers/gpio/gpiolib.c |
2352 | @@ -2306,6 +2306,12 @@ static int gpiod_request_commit(struct gpio_desc *desc, const char *label) |
2353 | unsigned long flags; |
2354 | unsigned offset; |
2355 | |
2356 | + if (label) { |
2357 | + label = kstrdup_const(label, GFP_KERNEL); |
2358 | + if (!label) |
2359 | + return -ENOMEM; |
2360 | + } |
2361 | + |
2362 | spin_lock_irqsave(&gpio_lock, flags); |
2363 | |
2364 | /* NOTE: gpio_request() can be called in early boot, |
2365 | @@ -2316,6 +2322,7 @@ static int gpiod_request_commit(struct gpio_desc *desc, const char *label) |
2366 | desc_set_label(desc, label ? : "?"); |
2367 | status = 0; |
2368 | } else { |
2369 | + kfree_const(label); |
2370 | status = -EBUSY; |
2371 | goto done; |
2372 | } |
2373 | @@ -2332,6 +2339,7 @@ static int gpiod_request_commit(struct gpio_desc *desc, const char *label) |
2374 | |
2375 | if (status < 0) { |
2376 | desc_set_label(desc, NULL); |
2377 | + kfree_const(label); |
2378 | clear_bit(FLAG_REQUESTED, &desc->flags); |
2379 | goto done; |
2380 | } |
2381 | @@ -2427,6 +2435,7 @@ static bool gpiod_free_commit(struct gpio_desc *desc) |
2382 | chip->free(chip, gpio_chip_hwgpio(desc)); |
2383 | spin_lock_irqsave(&gpio_lock, flags); |
2384 | } |
2385 | + kfree_const(desc->label); |
2386 | desc_set_label(desc, NULL); |
2387 | clear_bit(FLAG_ACTIVE_LOW, &desc->flags); |
2388 | clear_bit(FLAG_REQUESTED, &desc->flags); |
2389 | @@ -3382,11 +3391,19 @@ EXPORT_SYMBOL_GPL(gpiod_cansleep); |
2390 | * @desc: gpio to set the consumer name on |
2391 | * @name: the new consumer name |
2392 | */ |
2393 | -void gpiod_set_consumer_name(struct gpio_desc *desc, const char *name) |
2394 | +int gpiod_set_consumer_name(struct gpio_desc *desc, const char *name) |
2395 | { |
2396 | - VALIDATE_DESC_VOID(desc); |
2397 | - /* Just overwrite whatever the previous name was */ |
2398 | - desc->label = name; |
2399 | + VALIDATE_DESC(desc); |
2400 | + if (name) { |
2401 | + name = kstrdup_const(name, GFP_KERNEL); |
2402 | + if (!name) |
2403 | + return -ENOMEM; |
2404 | + } |
2405 | + |
2406 | + kfree_const(desc->label); |
2407 | + desc_set_label(desc, name); |
2408 | + |
2409 | + return 0; |
2410 | } |
2411 | EXPORT_SYMBOL_GPL(gpiod_set_consumer_name); |
2412 | |
2413 | diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |
2414 | index 3118ae0e7a87..315a245aedc2 100644 |
2415 | --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |
2416 | +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |
2417 | @@ -5333,6 +5333,12 @@ enum surface_update_type dm_determine_update_type_for_commit(struct dc *dc, stru |
2418 | struct dc_stream_update stream_update; |
2419 | enum surface_update_type update_type = UPDATE_TYPE_FAST; |
2420 | |
2421 | + if (!updates || !surface) { |
2422 | + DRM_ERROR("Plane or surface update failed to allocate"); |
2423 | + /* Set type to FULL to avoid crashing in DC*/ |
2424 | + update_type = UPDATE_TYPE_FULL; |
2425 | + goto ret; |
2426 | + } |
2427 | |
2428 | for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) { |
2429 | new_dm_crtc_state = to_dm_crtc_state(new_crtc_state); |
2430 | diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link.c b/drivers/gpu/drm/amd/display/dc/core/dc_link.c |
2431 | index 5141c1401889..8b69913b6943 100644 |
2432 | --- a/drivers/gpu/drm/amd/display/dc/core/dc_link.c |
2433 | +++ b/drivers/gpu/drm/amd/display/dc/core/dc_link.c |
2434 | @@ -208,6 +208,9 @@ bool dc_link_detect_sink(struct dc_link *link, enum dc_connection_type *type) |
2435 | return true; |
2436 | } |
2437 | |
2438 | + if (link->connector_signal == SIGNAL_TYPE_EDP) |
2439 | + link->dc->hwss.edp_wait_for_hpd_ready(link, true); |
2440 | + |
2441 | /* todo: may need to lock gpio access */ |
2442 | hpd_pin = get_hpd_gpio(link->ctx->dc_bios, link->link_id, link->ctx->gpio_service); |
2443 | if (hpd_pin == NULL) |
2444 | @@ -332,7 +335,7 @@ bool dc_link_is_dp_sink_present(struct dc_link *link) |
2445 | { |
2446 | enum gpio_result gpio_result; |
2447 | uint32_t clock_pin = 0; |
2448 | - |
2449 | + uint8_t retry = 0; |
2450 | struct ddc *ddc; |
2451 | |
2452 | enum connector_id connector_id = |
2453 | @@ -361,11 +364,22 @@ bool dc_link_is_dp_sink_present(struct dc_link *link) |
2454 | return present; |
2455 | } |
2456 | |
2457 | - /* Read GPIO: DP sink is present if both clock and data pins are zero */ |
2458 | - /* [anaumov] in DAL2, there was no check for GPIO failure */ |
2459 | - |
2460 | - gpio_result = dal_gpio_get_value(ddc->pin_clock, &clock_pin); |
2461 | - ASSERT(gpio_result == GPIO_RESULT_OK); |
2462 | + /* |
2463 | + * Read GPIO: DP sink is present if both clock and data pins are zero |
2464 | + * |
2465 | + * [W/A] plug-unplug DP cable, sometimes customer board has |
2466 | + * one short pulse on clk_pin(1V, < 1ms). DP will be config to HDMI/DVI |
2467 | + * then monitor can't br light up. Add retry 3 times |
2468 | + * But in real passive dongle, it need additional 3ms to detect |
2469 | + */ |
2470 | + do { |
2471 | + gpio_result = dal_gpio_get_value(ddc->pin_clock, &clock_pin); |
2472 | + ASSERT(gpio_result == GPIO_RESULT_OK); |
2473 | + if (clock_pin) |
2474 | + udelay(1000); |
2475 | + else |
2476 | + break; |
2477 | + } while (retry++ < 3); |
2478 | |
2479 | present = (gpio_result == GPIO_RESULT_OK) && !clock_pin; |
2480 | |
2481 | diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c b/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c |
2482 | index d91df5ef0cb3..d33a5ebe990b 100644 |
2483 | --- a/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c |
2484 | +++ b/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c |
2485 | @@ -2240,7 +2240,8 @@ static void get_active_converter_info( |
2486 | translate_dpcd_max_bpc( |
2487 | hdmi_color_caps.bits.MAX_BITS_PER_COLOR_COMPONENT); |
2488 | |
2489 | - link->dpcd_caps.dongle_caps.extendedCapValid = true; |
2490 | + if (link->dpcd_caps.dongle_caps.dp_hdmi_max_pixel_clk != 0) |
2491 | + link->dpcd_caps.dongle_caps.extendedCapValid = true; |
2492 | } |
2493 | |
2494 | break; |
2495 | diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c b/drivers/gpu/drm/amd/display/dc/core/dc_resource.c |
2496 | index b6fe29b9fb65..8bd8f34b979c 100644 |
2497 | --- a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c |
2498 | +++ b/drivers/gpu/drm/amd/display/dc/core/dc_resource.c |
2499 | @@ -2002,6 +2002,8 @@ enum dc_status resource_map_pool_resources( |
2500 | } |
2501 | */ |
2502 | |
2503 | + calculate_phy_pix_clks(stream); |
2504 | + |
2505 | /* acquire new resources */ |
2506 | pipe_idx = acquire_first_free_pipe(&context->res_ctx, pool, stream); |
2507 | |
2508 | diff --git a/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c b/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c |
2509 | index a6bcb90e8419..4443a916a0fb 100644 |
2510 | --- a/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c |
2511 | +++ b/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c |
2512 | @@ -1268,10 +1268,19 @@ static void program_scaler(const struct dc *dc, |
2513 | pipe_ctx->plane_res.scl_data.lb_params.depth, |
2514 | &pipe_ctx->stream->bit_depth_params); |
2515 | |
2516 | - if (pipe_ctx->stream_res.tg->funcs->set_overscan_blank_color) |
2517 | + if (pipe_ctx->stream_res.tg->funcs->set_overscan_blank_color) { |
2518 | + /* |
2519 | + * The way 420 is packed, 2 channels carry Y component, 1 channel |
2520 | + * alternate between Cb and Cr, so both channels need the pixel |
2521 | + * value for Y |
2522 | + */ |
2523 | + if (pipe_ctx->stream->timing.pixel_encoding == PIXEL_ENCODING_YCBCR420) |
2524 | + color.color_r_cr = color.color_g_y; |
2525 | + |
2526 | pipe_ctx->stream_res.tg->funcs->set_overscan_blank_color( |
2527 | pipe_ctx->stream_res.tg, |
2528 | &color); |
2529 | + } |
2530 | |
2531 | pipe_ctx->plane_res.xfm->funcs->transform_set_scaler(pipe_ctx->plane_res.xfm, |
2532 | &pipe_ctx->plane_res.scl_data); |
2533 | diff --git a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c |
2534 | index 193184affefb..220ba828748d 100644 |
2535 | --- a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c |
2536 | +++ b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c |
2537 | @@ -1226,7 +1226,8 @@ static bool dcn10_set_input_transfer_func(struct pipe_ctx *pipe_ctx, |
2538 | tf = plane_state->in_transfer_func; |
2539 | |
2540 | if (plane_state->gamma_correction && |
2541 | - !plane_state->gamma_correction->is_identity |
2542 | + !dpp_base->ctx->dc->debug.always_use_regamma |
2543 | + && !plane_state->gamma_correction->is_identity |
2544 | && dce_use_lut(plane_state->format)) |
2545 | dpp_base->funcs->dpp_program_input_lut(dpp_base, plane_state->gamma_correction); |
2546 | |
2547 | @@ -2164,6 +2165,15 @@ static void dcn10_blank_pixel_data( |
2548 | color_space = stream->output_color_space; |
2549 | color_space_to_black_color(dc, color_space, &black_color); |
2550 | |
2551 | + /* |
2552 | + * The way 420 is packed, 2 channels carry Y component, 1 channel |
2553 | + * alternate between Cb and Cr, so both channels need the pixel |
2554 | + * value for Y |
2555 | + */ |
2556 | + if (stream->timing.pixel_encoding == PIXEL_ENCODING_YCBCR420) |
2557 | + black_color.color_r_cr = black_color.color_g_y; |
2558 | + |
2559 | + |
2560 | if (stream_res->tg->funcs->set_blank_color) |
2561 | stream_res->tg->funcs->set_blank_color( |
2562 | stream_res->tg, |
2563 | diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c b/drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c |
2564 | index a1e0ac9ae248..90c1215c6f5e 100644 |
2565 | --- a/drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c |
2566 | +++ b/drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c |
2567 | @@ -1529,8 +1529,21 @@ static int polaris10_populate_clock_stretcher_data_table(struct pp_hwmgr *hwmgr) |
2568 | efuse = efuse >> 24; |
2569 | |
2570 | if (hwmgr->chip_id == CHIP_POLARIS10) { |
2571 | - min = 1000; |
2572 | - max = 2300; |
2573 | + if (hwmgr->is_kicker) { |
2574 | + min = 1200; |
2575 | + max = 2500; |
2576 | + } else { |
2577 | + min = 1000; |
2578 | + max = 2300; |
2579 | + } |
2580 | + } else if (hwmgr->chip_id == CHIP_POLARIS11) { |
2581 | + if (hwmgr->is_kicker) { |
2582 | + min = 900; |
2583 | + max = 2100; |
2584 | + } else { |
2585 | + min = 1100; |
2586 | + max = 2100; |
2587 | + } |
2588 | } else { |
2589 | min = 1100; |
2590 | max = 2100; |
2591 | diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c |
2592 | index b4e292a56046..df86c2ebfc12 100644 |
2593 | --- a/drivers/gpu/drm/drm_atomic_helper.c |
2594 | +++ b/drivers/gpu/drm/drm_atomic_helper.c |
2595 | @@ -3212,7 +3212,7 @@ EXPORT_SYMBOL(drm_atomic_helper_suspend); |
2596 | int drm_atomic_helper_commit_duplicated_state(struct drm_atomic_state *state, |
2597 | struct drm_modeset_acquire_ctx *ctx) |
2598 | { |
2599 | - int i; |
2600 | + int i, ret; |
2601 | struct drm_plane *plane; |
2602 | struct drm_plane_state *new_plane_state; |
2603 | struct drm_connector *connector; |
2604 | @@ -3231,7 +3231,11 @@ int drm_atomic_helper_commit_duplicated_state(struct drm_atomic_state *state, |
2605 | for_each_new_connector_in_state(state, connector, new_conn_state, i) |
2606 | state->connectors[i].old_state = connector->state; |
2607 | |
2608 | - return drm_atomic_commit(state); |
2609 | + ret = drm_atomic_commit(state); |
2610 | + |
2611 | + state->acquire_ctx = NULL; |
2612 | + |
2613 | + return ret; |
2614 | } |
2615 | EXPORT_SYMBOL(drm_atomic_helper_commit_duplicated_state); |
2616 | |
2617 | diff --git a/drivers/gpu/drm/drm_bufs.c b/drivers/gpu/drm/drm_bufs.c |
2618 | index 7412acaf3cde..d7d10cabb9bb 100644 |
2619 | --- a/drivers/gpu/drm/drm_bufs.c |
2620 | +++ b/drivers/gpu/drm/drm_bufs.c |
2621 | @@ -36,6 +36,8 @@ |
2622 | #include <drm/drmP.h> |
2623 | #include "drm_legacy.h" |
2624 | |
2625 | +#include <linux/nospec.h> |
2626 | + |
2627 | static struct drm_map_list *drm_find_matching_map(struct drm_device *dev, |
2628 | struct drm_local_map *map) |
2629 | { |
2630 | @@ -1417,6 +1419,7 @@ int drm_legacy_freebufs(struct drm_device *dev, void *data, |
2631 | idx, dma->buf_count - 1); |
2632 | return -EINVAL; |
2633 | } |
2634 | + idx = array_index_nospec(idx, dma->buf_count); |
2635 | buf = dma->buflist[idx]; |
2636 | if (buf->file_priv != file_priv) { |
2637 | DRM_ERROR("Process %d freeing buffer not owned\n", |
2638 | diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c |
2639 | index 84de385a9f62..60f146f02b77 100644 |
2640 | --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c |
2641 | +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c |
2642 | @@ -331,7 +331,7 @@ static void dpu_encoder_phys_vid_vblank_irq(void *arg, int irq_idx) |
2643 | if (hw_ctl && hw_ctl->ops.get_flush_register) |
2644 | flush_register = hw_ctl->ops.get_flush_register(hw_ctl); |
2645 | |
2646 | - if (flush_register == 0) |
2647 | + if (!(flush_register & hw_ctl->ops.get_pending_flush(hw_ctl))) |
2648 | new_cnt = atomic_add_unless(&phys_enc->pending_kickoff_cnt, |
2649 | -1, 0); |
2650 | spin_unlock_irqrestore(phys_enc->enc_spinlock, lock_flags); |
2651 | diff --git a/drivers/gpu/drm/msm/dsi/pll/dsi_pll_10nm.c b/drivers/gpu/drm/msm/dsi/pll/dsi_pll_10nm.c |
2652 | index 41bec570c518..31205625c734 100644 |
2653 | --- a/drivers/gpu/drm/msm/dsi/pll/dsi_pll_10nm.c |
2654 | +++ b/drivers/gpu/drm/msm/dsi/pll/dsi_pll_10nm.c |
2655 | @@ -17,7 +17,7 @@ |
2656 | * | | |
2657 | * | | |
2658 | * +---------+ | +----------+ | +----+ |
2659 | - * dsi0vco_clk ---| out_div |--o--| divl_3_0 |--o--| /8 |-- dsi0pllbyte |
2660 | + * dsi0vco_clk ---| out_div |--o--| divl_3_0 |--o--| /8 |-- dsi0_phy_pll_out_byteclk |
2661 | * +---------+ | +----------+ | +----+ |
2662 | * | | |
2663 | * | | dsi0_pll_by_2_bit_clk |
2664 | @@ -25,7 +25,7 @@ |
2665 | * | | +----+ | |\ dsi0_pclk_mux |
2666 | * | |--| /2 |--o--| \ | |
2667 | * | | +----+ | \ | +---------+ |
2668 | - * | --------------| |--o--| div_7_4 |-- dsi0pll |
2669 | + * | --------------| |--o--| div_7_4 |-- dsi0_phy_pll_out_dsiclk |
2670 | * |------------------------------| / +---------+ |
2671 | * | +-----+ | / |
2672 | * -----------| /4? |--o----------|/ |
2673 | @@ -690,7 +690,7 @@ static int pll_10nm_register(struct dsi_pll_10nm *pll_10nm) |
2674 | |
2675 | hws[num++] = hw; |
2676 | |
2677 | - snprintf(clk_name, 32, "dsi%dpllbyte", pll_10nm->id); |
2678 | + snprintf(clk_name, 32, "dsi%d_phy_pll_out_byteclk", pll_10nm->id); |
2679 | snprintf(parent, 32, "dsi%d_pll_bit_clk", pll_10nm->id); |
2680 | |
2681 | /* DSI Byte clock = VCO_CLK / OUT_DIV / BIT_DIV / 8 */ |
2682 | @@ -739,7 +739,7 @@ static int pll_10nm_register(struct dsi_pll_10nm *pll_10nm) |
2683 | |
2684 | hws[num++] = hw; |
2685 | |
2686 | - snprintf(clk_name, 32, "dsi%dpll", pll_10nm->id); |
2687 | + snprintf(clk_name, 32, "dsi%d_phy_pll_out_dsiclk", pll_10nm->id); |
2688 | snprintf(parent, 32, "dsi%d_pclk_mux", pll_10nm->id); |
2689 | |
2690 | /* PIX CLK DIV : DIV_CTRL_7_4*/ |
2691 | diff --git a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c |
2692 | index 17741843cf51..40a9afe818a8 100644 |
2693 | --- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c |
2694 | +++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c |
2695 | @@ -226,9 +226,6 @@ static void rcar_du_crtc_set_display_timing(struct rcar_du_crtc *rcrtc) |
2696 | * system clock, and have no internal clock divider. |
2697 | */ |
2698 | |
2699 | - if (WARN_ON(!rcrtc->extclock)) |
2700 | - return; |
2701 | - |
2702 | /* |
2703 | * The H3 ES1.x exhibits dot clock duty cycle stability issues. |
2704 | * We can work around them by configuring the DPLL to twice the |
2705 | @@ -1113,9 +1110,16 @@ int rcar_du_crtc_create(struct rcar_du_group *rgrp, unsigned int swindex, |
2706 | clk = devm_clk_get(rcdu->dev, clk_name); |
2707 | if (!IS_ERR(clk)) { |
2708 | rcrtc->extclock = clk; |
2709 | - } else if (PTR_ERR(rcrtc->clock) == -EPROBE_DEFER) { |
2710 | - dev_info(rcdu->dev, "can't get external clock %u\n", hwindex); |
2711 | + } else if (PTR_ERR(clk) == -EPROBE_DEFER) { |
2712 | return -EPROBE_DEFER; |
2713 | + } else if (rcdu->info->dpll_mask & BIT(hwindex)) { |
2714 | + /* |
2715 | + * DU channels that have a display PLL can't use the internal |
2716 | + * system clock and thus require an external clock. |
2717 | + */ |
2718 | + ret = PTR_ERR(clk); |
2719 | + dev_err(rcdu->dev, "can't get dclkin.%u: %d\n", hwindex, ret); |
2720 | + return ret; |
2721 | } |
2722 | |
2723 | init_waitqueue_head(&rcrtc->flip_wait); |
2724 | diff --git a/drivers/gpu/drm/rockchip/cdn-dp-reg.c b/drivers/gpu/drm/rockchip/cdn-dp-reg.c |
2725 | index 3105965fc260..5a485489a1e2 100644 |
2726 | --- a/drivers/gpu/drm/rockchip/cdn-dp-reg.c |
2727 | +++ b/drivers/gpu/drm/rockchip/cdn-dp-reg.c |
2728 | @@ -147,7 +147,7 @@ static int cdn_dp_mailbox_validate_receive(struct cdn_dp_device *dp, |
2729 | } |
2730 | |
2731 | static int cdn_dp_mailbox_read_receive(struct cdn_dp_device *dp, |
2732 | - u8 *buff, u8 buff_size) |
2733 | + u8 *buff, u16 buff_size) |
2734 | { |
2735 | u32 i; |
2736 | int ret; |
2737 | diff --git a/drivers/gpu/drm/sun4i/sun8i_tcon_top.c b/drivers/gpu/drm/sun4i/sun8i_tcon_top.c |
2738 | index 3040a79f298f..37158548b447 100644 |
2739 | --- a/drivers/gpu/drm/sun4i/sun8i_tcon_top.c |
2740 | +++ b/drivers/gpu/drm/sun4i/sun8i_tcon_top.c |
2741 | @@ -167,6 +167,13 @@ static int sun8i_tcon_top_bind(struct device *dev, struct device *master, |
2742 | goto err_assert_reset; |
2743 | } |
2744 | |
2745 | + /* |
2746 | + * At least on H6, some registers have some bits set by default |
2747 | + * which may cause issues. Clear them here. |
2748 | + */ |
2749 | + writel(0, regs + TCON_TOP_PORT_SEL_REG); |
2750 | + writel(0, regs + TCON_TOP_GATE_SRC_REG); |
2751 | + |
2752 | /* |
2753 | * TCON TOP has two muxes, which select parent clock for each TCON TV |
2754 | * channel clock. Parent could be either TCON TV or TVE clock. For now |
2755 | diff --git a/drivers/gpu/drm/v3d/v3d_bo.c b/drivers/gpu/drm/v3d/v3d_bo.c |
2756 | index 54d96518a131..a08766d39eab 100644 |
2757 | --- a/drivers/gpu/drm/v3d/v3d_bo.c |
2758 | +++ b/drivers/gpu/drm/v3d/v3d_bo.c |
2759 | @@ -293,6 +293,7 @@ v3d_prime_import_sg_table(struct drm_device *dev, |
2760 | bo->resv = attach->dmabuf->resv; |
2761 | |
2762 | bo->sgt = sgt; |
2763 | + obj->import_attach = attach; |
2764 | v3d_bo_get_pages(bo); |
2765 | |
2766 | v3d_mmu_insert_ptes(bo); |
2767 | diff --git a/drivers/gpu/drm/v3d/v3d_drv.h b/drivers/gpu/drm/v3d/v3d_drv.h |
2768 | index e6fed696ad86..cbe5be0c47eb 100644 |
2769 | --- a/drivers/gpu/drm/v3d/v3d_drv.h |
2770 | +++ b/drivers/gpu/drm/v3d/v3d_drv.h |
2771 | @@ -198,6 +198,11 @@ struct v3d_exec_info { |
2772 | */ |
2773 | struct dma_fence *bin_done_fence; |
2774 | |
2775 | + /* Fence for when the scheduler considers the render to be |
2776 | + * done, for when the BOs reservations should be complete. |
2777 | + */ |
2778 | + struct dma_fence *render_done_fence; |
2779 | + |
2780 | struct kref refcount; |
2781 | |
2782 | /* This is the array of BOs that were looked up at the start of exec. */ |
2783 | diff --git a/drivers/gpu/drm/v3d/v3d_gem.c b/drivers/gpu/drm/v3d/v3d_gem.c |
2784 | index 70c54774400b..2814c72cb090 100644 |
2785 | --- a/drivers/gpu/drm/v3d/v3d_gem.c |
2786 | +++ b/drivers/gpu/drm/v3d/v3d_gem.c |
2787 | @@ -209,7 +209,7 @@ v3d_flush_caches(struct v3d_dev *v3d) |
2788 | static void |
2789 | v3d_attach_object_fences(struct v3d_exec_info *exec) |
2790 | { |
2791 | - struct dma_fence *out_fence = &exec->render.base.s_fence->finished; |
2792 | + struct dma_fence *out_fence = exec->render_done_fence; |
2793 | struct v3d_bo *bo; |
2794 | int i; |
2795 | |
2796 | @@ -409,6 +409,7 @@ v3d_exec_cleanup(struct kref *ref) |
2797 | dma_fence_put(exec->render.done_fence); |
2798 | |
2799 | dma_fence_put(exec->bin_done_fence); |
2800 | + dma_fence_put(exec->render_done_fence); |
2801 | |
2802 | for (i = 0; i < exec->bo_count; i++) |
2803 | drm_gem_object_put_unlocked(&exec->bo[i]->base); |
2804 | @@ -572,6 +573,9 @@ v3d_submit_cl_ioctl(struct drm_device *dev, void *data, |
2805 | if (ret) |
2806 | goto fail_unreserve; |
2807 | |
2808 | + exec->render_done_fence = |
2809 | + dma_fence_get(&exec->render.base.s_fence->finished); |
2810 | + |
2811 | kref_get(&exec->refcount); /* put by scheduler job completion */ |
2812 | drm_sched_entity_push_job(&exec->render.base, |
2813 | &v3d_priv->sched_entity[V3D_RENDER]); |
2814 | @@ -585,7 +589,7 @@ v3d_submit_cl_ioctl(struct drm_device *dev, void *data, |
2815 | sync_out = drm_syncobj_find(file_priv, args->out_sync); |
2816 | if (sync_out) { |
2817 | drm_syncobj_replace_fence(sync_out, 0, |
2818 | - &exec->render.base.s_fence->finished); |
2819 | + exec->render_done_fence); |
2820 | drm_syncobj_put(sync_out); |
2821 | } |
2822 | |
2823 | diff --git a/drivers/gpu/drm/vc4/vc4_plane.c b/drivers/gpu/drm/vc4/vc4_plane.c |
2824 | index ae6254b0b1ae..ed8b0fc170ee 100644 |
2825 | --- a/drivers/gpu/drm/vc4/vc4_plane.c |
2826 | +++ b/drivers/gpu/drm/vc4/vc4_plane.c |
2827 | @@ -314,12 +314,14 @@ static int vc4_plane_setup_clipping_and_scaling(struct drm_plane_state *state) |
2828 | vc4_get_scaling_mode(vc4_state->src_h[1], |
2829 | vc4_state->crtc_h); |
2830 | |
2831 | - /* YUV conversion requires that horizontal scaling be enabled, |
2832 | - * even on a plane that's otherwise 1:1. Looks like only PPF |
2833 | - * works in that case, so let's pick that one. |
2834 | + /* YUV conversion requires that horizontal scaling be enabled |
2835 | + * on the UV plane even if vc4_get_scaling_mode() returned |
2836 | + * VC4_SCALING_NONE (which can happen when the down-scaling |
2837 | + * ratio is 0.5). Let's force it to VC4_SCALING_PPF in this |
2838 | + * case. |
2839 | */ |
2840 | - if (vc4_state->is_unity) |
2841 | - vc4_state->x_scaling[0] = VC4_SCALING_PPF; |
2842 | + if (vc4_state->x_scaling[1] == VC4_SCALING_NONE) |
2843 | + vc4_state->x_scaling[1] = VC4_SCALING_PPF; |
2844 | } else { |
2845 | vc4_state->is_yuv = false; |
2846 | vc4_state->x_scaling[1] = VC4_SCALING_NONE; |
2847 | diff --git a/drivers/gpu/drm/vgem/vgem_drv.c b/drivers/gpu/drm/vgem/vgem_drv.c |
2848 | index ec6af8b920da..f1f7ab9dcdbf 100644 |
2849 | --- a/drivers/gpu/drm/vgem/vgem_drv.c |
2850 | +++ b/drivers/gpu/drm/vgem/vgem_drv.c |
2851 | @@ -471,31 +471,31 @@ static int __init vgem_init(void) |
2852 | if (!vgem_device) |
2853 | return -ENOMEM; |
2854 | |
2855 | - ret = drm_dev_init(&vgem_device->drm, &vgem_driver, NULL); |
2856 | - if (ret) |
2857 | - goto out_free; |
2858 | - |
2859 | vgem_device->platform = |
2860 | platform_device_register_simple("vgem", -1, NULL, 0); |
2861 | if (IS_ERR(vgem_device->platform)) { |
2862 | ret = PTR_ERR(vgem_device->platform); |
2863 | - goto out_fini; |
2864 | + goto out_free; |
2865 | } |
2866 | |
2867 | dma_coerce_mask_and_coherent(&vgem_device->platform->dev, |
2868 | DMA_BIT_MASK(64)); |
2869 | + ret = drm_dev_init(&vgem_device->drm, &vgem_driver, |
2870 | + &vgem_device->platform->dev); |
2871 | + if (ret) |
2872 | + goto out_unregister; |
2873 | |
2874 | /* Final step: expose the device/driver to userspace */ |
2875 | ret = drm_dev_register(&vgem_device->drm, 0); |
2876 | if (ret) |
2877 | - goto out_unregister; |
2878 | + goto out_fini; |
2879 | |
2880 | return 0; |
2881 | |
2882 | -out_unregister: |
2883 | - platform_device_unregister(vgem_device->platform); |
2884 | out_fini: |
2885 | drm_dev_fini(&vgem_device->drm); |
2886 | +out_unregister: |
2887 | + platform_device_unregister(vgem_device->platform); |
2888 | out_free: |
2889 | kfree(vgem_device); |
2890 | return ret; |
2891 | diff --git a/drivers/gpu/ipu-v3/ipu-image-convert.c b/drivers/gpu/ipu-v3/ipu-image-convert.c |
2892 | index f4081962784c..91653adc41cc 100644 |
2893 | --- a/drivers/gpu/ipu-v3/ipu-image-convert.c |
2894 | +++ b/drivers/gpu/ipu-v3/ipu-image-convert.c |
2895 | @@ -1524,7 +1524,7 @@ unlock: |
2896 | EXPORT_SYMBOL_GPL(ipu_image_convert_queue); |
2897 | |
2898 | /* Abort any active or pending conversions for this context */ |
2899 | -void ipu_image_convert_abort(struct ipu_image_convert_ctx *ctx) |
2900 | +static void __ipu_image_convert_abort(struct ipu_image_convert_ctx *ctx) |
2901 | { |
2902 | struct ipu_image_convert_chan *chan = ctx->chan; |
2903 | struct ipu_image_convert_priv *priv = chan->priv; |
2904 | @@ -1551,7 +1551,7 @@ void ipu_image_convert_abort(struct ipu_image_convert_ctx *ctx) |
2905 | |
2906 | need_abort = (run_count || active_run); |
2907 | |
2908 | - ctx->aborting = need_abort; |
2909 | + ctx->aborting = true; |
2910 | |
2911 | spin_unlock_irqrestore(&chan->irqlock, flags); |
2912 | |
2913 | @@ -1572,7 +1572,11 @@ void ipu_image_convert_abort(struct ipu_image_convert_ctx *ctx) |
2914 | dev_warn(priv->ipu->dev, "%s: timeout\n", __func__); |
2915 | force_abort(ctx); |
2916 | } |
2917 | +} |
2918 | |
2919 | +void ipu_image_convert_abort(struct ipu_image_convert_ctx *ctx) |
2920 | +{ |
2921 | + __ipu_image_convert_abort(ctx); |
2922 | ctx->aborting = false; |
2923 | } |
2924 | EXPORT_SYMBOL_GPL(ipu_image_convert_abort); |
2925 | @@ -1586,7 +1590,7 @@ void ipu_image_convert_unprepare(struct ipu_image_convert_ctx *ctx) |
2926 | bool put_res; |
2927 | |
2928 | /* make sure no runs are hanging around */ |
2929 | - ipu_image_convert_abort(ctx); |
2930 | + __ipu_image_convert_abort(ctx); |
2931 | |
2932 | dev_dbg(priv->ipu->dev, "%s: task %u: removing ctx %p\n", __func__, |
2933 | chan->ic_task, ctx); |
2934 | diff --git a/drivers/hid/hid-debug.c b/drivers/hid/hid-debug.c |
2935 | index b48100236df8..ebc9ffde41e9 100644 |
2936 | --- a/drivers/hid/hid-debug.c |
2937 | +++ b/drivers/hid/hid-debug.c |
2938 | @@ -30,6 +30,7 @@ |
2939 | |
2940 | #include <linux/debugfs.h> |
2941 | #include <linux/seq_file.h> |
2942 | +#include <linux/kfifo.h> |
2943 | #include <linux/sched/signal.h> |
2944 | #include <linux/export.h> |
2945 | #include <linux/slab.h> |
2946 | @@ -661,17 +662,12 @@ EXPORT_SYMBOL_GPL(hid_dump_device); |
2947 | /* enqueue string to 'events' ring buffer */ |
2948 | void hid_debug_event(struct hid_device *hdev, char *buf) |
2949 | { |
2950 | - unsigned i; |
2951 | struct hid_debug_list *list; |
2952 | unsigned long flags; |
2953 | |
2954 | spin_lock_irqsave(&hdev->debug_list_lock, flags); |
2955 | - list_for_each_entry(list, &hdev->debug_list, node) { |
2956 | - for (i = 0; buf[i]; i++) |
2957 | - list->hid_debug_buf[(list->tail + i) % HID_DEBUG_BUFSIZE] = |
2958 | - buf[i]; |
2959 | - list->tail = (list->tail + i) % HID_DEBUG_BUFSIZE; |
2960 | - } |
2961 | + list_for_each_entry(list, &hdev->debug_list, node) |
2962 | + kfifo_in(&list->hid_debug_fifo, buf, strlen(buf)); |
2963 | spin_unlock_irqrestore(&hdev->debug_list_lock, flags); |
2964 | |
2965 | wake_up_interruptible(&hdev->debug_wait); |
2966 | @@ -722,8 +718,7 @@ void hid_dump_input(struct hid_device *hdev, struct hid_usage *usage, __s32 valu |
2967 | hid_debug_event(hdev, buf); |
2968 | |
2969 | kfree(buf); |
2970 | - wake_up_interruptible(&hdev->debug_wait); |
2971 | - |
2972 | + wake_up_interruptible(&hdev->debug_wait); |
2973 | } |
2974 | EXPORT_SYMBOL_GPL(hid_dump_input); |
2975 | |
2976 | @@ -1088,8 +1083,8 @@ static int hid_debug_events_open(struct inode *inode, struct file *file) |
2977 | goto out; |
2978 | } |
2979 | |
2980 | - if (!(list->hid_debug_buf = kzalloc(HID_DEBUG_BUFSIZE, GFP_KERNEL))) { |
2981 | - err = -ENOMEM; |
2982 | + err = kfifo_alloc(&list->hid_debug_fifo, HID_DEBUG_FIFOSIZE, GFP_KERNEL); |
2983 | + if (err) { |
2984 | kfree(list); |
2985 | goto out; |
2986 | } |
2987 | @@ -1109,77 +1104,57 @@ static ssize_t hid_debug_events_read(struct file *file, char __user *buffer, |
2988 | size_t count, loff_t *ppos) |
2989 | { |
2990 | struct hid_debug_list *list = file->private_data; |
2991 | - int ret = 0, len; |
2992 | + int ret = 0, copied; |
2993 | DECLARE_WAITQUEUE(wait, current); |
2994 | |
2995 | mutex_lock(&list->read_mutex); |
2996 | - while (ret == 0) { |
2997 | - if (list->head == list->tail) { |
2998 | - add_wait_queue(&list->hdev->debug_wait, &wait); |
2999 | - set_current_state(TASK_INTERRUPTIBLE); |
3000 | - |
3001 | - while (list->head == list->tail) { |
3002 | - if (file->f_flags & O_NONBLOCK) { |
3003 | - ret = -EAGAIN; |
3004 | - break; |
3005 | - } |
3006 | - if (signal_pending(current)) { |
3007 | - ret = -ERESTARTSYS; |
3008 | - break; |
3009 | - } |
3010 | + if (kfifo_is_empty(&list->hid_debug_fifo)) { |
3011 | + add_wait_queue(&list->hdev->debug_wait, &wait); |
3012 | + set_current_state(TASK_INTERRUPTIBLE); |
3013 | + |
3014 | + while (kfifo_is_empty(&list->hid_debug_fifo)) { |
3015 | + if (file->f_flags & O_NONBLOCK) { |
3016 | + ret = -EAGAIN; |
3017 | + break; |
3018 | + } |
3019 | |
3020 | - if (!list->hdev || !list->hdev->debug) { |
3021 | - ret = -EIO; |
3022 | - set_current_state(TASK_RUNNING); |
3023 | - goto out; |
3024 | - } |
3025 | + if (signal_pending(current)) { |
3026 | + ret = -ERESTARTSYS; |
3027 | + break; |
3028 | + } |
3029 | |
3030 | - /* allow O_NONBLOCK from other threads */ |
3031 | - mutex_unlock(&list->read_mutex); |
3032 | - schedule(); |
3033 | - mutex_lock(&list->read_mutex); |
3034 | - set_current_state(TASK_INTERRUPTIBLE); |
3035 | + /* if list->hdev is NULL we cannot remove_wait_queue(). |
3036 | + * if list->hdev->debug is 0 then hid_debug_unregister() |
3037 | + * was already called and list->hdev is being destroyed. |
3038 | + * if we add remove_wait_queue() here we can hit a race. |
3039 | + */ |
3040 | + if (!list->hdev || !list->hdev->debug) { |
3041 | + ret = -EIO; |
3042 | + set_current_state(TASK_RUNNING); |
3043 | + goto out; |
3044 | } |
3045 | |
3046 | - set_current_state(TASK_RUNNING); |
3047 | - remove_wait_queue(&list->hdev->debug_wait, &wait); |
3048 | + /* allow O_NONBLOCK from other threads */ |
3049 | + mutex_unlock(&list->read_mutex); |
3050 | + schedule(); |
3051 | + mutex_lock(&list->read_mutex); |
3052 | + set_current_state(TASK_INTERRUPTIBLE); |
3053 | } |
3054 | |
3055 | - if (ret) |
3056 | - goto out; |
3057 | + __set_current_state(TASK_RUNNING); |
3058 | + remove_wait_queue(&list->hdev->debug_wait, &wait); |
3059 | |
3060 | - /* pass the ringbuffer contents to userspace */ |
3061 | -copy_rest: |
3062 | - if (list->tail == list->head) |
3063 | + if (ret) |
3064 | goto out; |
3065 | - if (list->tail > list->head) { |
3066 | - len = list->tail - list->head; |
3067 | - if (len > count) |
3068 | - len = count; |
3069 | - |
3070 | - if (copy_to_user(buffer + ret, &list->hid_debug_buf[list->head], len)) { |
3071 | - ret = -EFAULT; |
3072 | - goto out; |
3073 | - } |
3074 | - ret += len; |
3075 | - list->head += len; |
3076 | - } else { |
3077 | - len = HID_DEBUG_BUFSIZE - list->head; |
3078 | - if (len > count) |
3079 | - len = count; |
3080 | - |
3081 | - if (copy_to_user(buffer, &list->hid_debug_buf[list->head], len)) { |
3082 | - ret = -EFAULT; |
3083 | - goto out; |
3084 | - } |
3085 | - list->head = 0; |
3086 | - ret += len; |
3087 | - count -= len; |
3088 | - if (count > 0) |
3089 | - goto copy_rest; |
3090 | - } |
3091 | - |
3092 | } |
3093 | + |
3094 | + /* pass the fifo content to userspace, locking is not needed with only |
3095 | + * one concurrent reader and one concurrent writer |
3096 | + */ |
3097 | + ret = kfifo_to_user(&list->hid_debug_fifo, buffer, count, &copied); |
3098 | + if (ret) |
3099 | + goto out; |
3100 | + ret = copied; |
3101 | out: |
3102 | mutex_unlock(&list->read_mutex); |
3103 | return ret; |
3104 | @@ -1190,7 +1165,7 @@ static __poll_t hid_debug_events_poll(struct file *file, poll_table *wait) |
3105 | struct hid_debug_list *list = file->private_data; |
3106 | |
3107 | poll_wait(file, &list->hdev->debug_wait, wait); |
3108 | - if (list->head != list->tail) |
3109 | + if (!kfifo_is_empty(&list->hid_debug_fifo)) |
3110 | return EPOLLIN | EPOLLRDNORM; |
3111 | if (!list->hdev->debug) |
3112 | return EPOLLERR | EPOLLHUP; |
3113 | @@ -1205,7 +1180,7 @@ static int hid_debug_events_release(struct inode *inode, struct file *file) |
3114 | spin_lock_irqsave(&list->hdev->debug_list_lock, flags); |
3115 | list_del(&list->node); |
3116 | spin_unlock_irqrestore(&list->hdev->debug_list_lock, flags); |
3117 | - kfree(list->hid_debug_buf); |
3118 | + kfifo_free(&list->hid_debug_fifo); |
3119 | kfree(list); |
3120 | |
3121 | return 0; |
3122 | @@ -1256,4 +1231,3 @@ void hid_debug_exit(void) |
3123 | { |
3124 | debugfs_remove_recursive(hid_debug_root); |
3125 | } |
3126 | - |
3127 | diff --git a/drivers/hid/hid-lenovo.c b/drivers/hid/hid-lenovo.c |
3128 | index 643b6eb54442..eacc76d2ab96 100644 |
3129 | --- a/drivers/hid/hid-lenovo.c |
3130 | +++ b/drivers/hid/hid-lenovo.c |
3131 | @@ -743,7 +743,9 @@ static int lenovo_probe_tpkbd(struct hid_device *hdev) |
3132 | data_pointer->led_mute.brightness_get = lenovo_led_brightness_get_tpkbd; |
3133 | data_pointer->led_mute.brightness_set = lenovo_led_brightness_set_tpkbd; |
3134 | data_pointer->led_mute.dev = dev; |
3135 | - led_classdev_register(dev, &data_pointer->led_mute); |
3136 | + ret = led_classdev_register(dev, &data_pointer->led_mute); |
3137 | + if (ret < 0) |
3138 | + goto err; |
3139 | |
3140 | data_pointer->led_micmute.name = name_micmute; |
3141 | data_pointer->led_micmute.brightness_get = |
3142 | @@ -751,7 +753,11 @@ static int lenovo_probe_tpkbd(struct hid_device *hdev) |
3143 | data_pointer->led_micmute.brightness_set = |
3144 | lenovo_led_brightness_set_tpkbd; |
3145 | data_pointer->led_micmute.dev = dev; |
3146 | - led_classdev_register(dev, &data_pointer->led_micmute); |
3147 | + ret = led_classdev_register(dev, &data_pointer->led_micmute); |
3148 | + if (ret < 0) { |
3149 | + led_classdev_unregister(&data_pointer->led_mute); |
3150 | + goto err; |
3151 | + } |
3152 | |
3153 | lenovo_features_set_tpkbd(hdev); |
3154 | |
3155 | diff --git a/drivers/hwmon/lm80.c b/drivers/hwmon/lm80.c |
3156 | index 08e3945a6fbf..0e30fa00204c 100644 |
3157 | --- a/drivers/hwmon/lm80.c |
3158 | +++ b/drivers/hwmon/lm80.c |
3159 | @@ -360,9 +360,11 @@ static ssize_t set_fan_div(struct device *dev, struct device_attribute *attr, |
3160 | struct i2c_client *client = data->client; |
3161 | unsigned long min, val; |
3162 | u8 reg; |
3163 | - int err = kstrtoul(buf, 10, &val); |
3164 | - if (err < 0) |
3165 | - return err; |
3166 | + int rv; |
3167 | + |
3168 | + rv = kstrtoul(buf, 10, &val); |
3169 | + if (rv < 0) |
3170 | + return rv; |
3171 | |
3172 | /* Save fan_min */ |
3173 | mutex_lock(&data->update_lock); |
3174 | @@ -390,8 +392,11 @@ static ssize_t set_fan_div(struct device *dev, struct device_attribute *attr, |
3175 | return -EINVAL; |
3176 | } |
3177 | |
3178 | - reg = (lm80_read_value(client, LM80_REG_FANDIV) & |
3179 | - ~(3 << (2 * (nr + 1)))) | (data->fan_div[nr] << (2 * (nr + 1))); |
3180 | + rv = lm80_read_value(client, LM80_REG_FANDIV); |
3181 | + if (rv < 0) |
3182 | + return rv; |
3183 | + reg = (rv & ~(3 << (2 * (nr + 1)))) |
3184 | + | (data->fan_div[nr] << (2 * (nr + 1))); |
3185 | lm80_write_value(client, LM80_REG_FANDIV, reg); |
3186 | |
3187 | /* Restore fan_min */ |
3188 | @@ -623,6 +628,7 @@ static int lm80_probe(struct i2c_client *client, |
3189 | struct device *dev = &client->dev; |
3190 | struct device *hwmon_dev; |
3191 | struct lm80_data *data; |
3192 | + int rv; |
3193 | |
3194 | data = devm_kzalloc(dev, sizeof(struct lm80_data), GFP_KERNEL); |
3195 | if (!data) |
3196 | @@ -635,8 +641,14 @@ static int lm80_probe(struct i2c_client *client, |
3197 | lm80_init_client(client); |
3198 | |
3199 | /* A few vars need to be filled upon startup */ |
3200 | - data->fan[f_min][0] = lm80_read_value(client, LM80_REG_FAN_MIN(1)); |
3201 | - data->fan[f_min][1] = lm80_read_value(client, LM80_REG_FAN_MIN(2)); |
3202 | + rv = lm80_read_value(client, LM80_REG_FAN_MIN(1)); |
3203 | + if (rv < 0) |
3204 | + return rv; |
3205 | + data->fan[f_min][0] = rv; |
3206 | + rv = lm80_read_value(client, LM80_REG_FAN_MIN(2)); |
3207 | + if (rv < 0) |
3208 | + return rv; |
3209 | + data->fan[f_min][1] = rv; |
3210 | |
3211 | hwmon_dev = devm_hwmon_device_register_with_groups(dev, client->name, |
3212 | data, lm80_groups); |
3213 | diff --git a/drivers/i2c/busses/i2c-axxia.c b/drivers/i2c/busses/i2c-axxia.c |
3214 | index 51d34959709b..fb5bac079e83 100644 |
3215 | --- a/drivers/i2c/busses/i2c-axxia.c |
3216 | +++ b/drivers/i2c/busses/i2c-axxia.c |
3217 | @@ -296,22 +296,7 @@ static irqreturn_t axxia_i2c_isr(int irq, void *_dev) |
3218 | i2c_int_disable(idev, MST_STATUS_TFL); |
3219 | } |
3220 | |
3221 | - if (status & MST_STATUS_SCC) { |
3222 | - /* Stop completed */ |
3223 | - i2c_int_disable(idev, ~MST_STATUS_TSS); |
3224 | - complete(&idev->msg_complete); |
3225 | - } else if (status & MST_STATUS_SNS) { |
3226 | - /* Transfer done */ |
3227 | - i2c_int_disable(idev, ~MST_STATUS_TSS); |
3228 | - if (i2c_m_rd(idev->msg) && idev->msg_xfrd < idev->msg->len) |
3229 | - axxia_i2c_empty_rx_fifo(idev); |
3230 | - complete(&idev->msg_complete); |
3231 | - } else if (status & MST_STATUS_TSS) { |
3232 | - /* Transfer timeout */ |
3233 | - idev->msg_err = -ETIMEDOUT; |
3234 | - i2c_int_disable(idev, ~MST_STATUS_TSS); |
3235 | - complete(&idev->msg_complete); |
3236 | - } else if (unlikely(status & MST_STATUS_ERR)) { |
3237 | + if (unlikely(status & MST_STATUS_ERR)) { |
3238 | /* Transfer error */ |
3239 | i2c_int_disable(idev, ~0); |
3240 | if (status & MST_STATUS_AL) |
3241 | @@ -328,6 +313,21 @@ static irqreturn_t axxia_i2c_isr(int irq, void *_dev) |
3242 | readl(idev->base + MST_TX_BYTES_XFRD), |
3243 | readl(idev->base + MST_TX_XFER)); |
3244 | complete(&idev->msg_complete); |
3245 | + } else if (status & MST_STATUS_SCC) { |
3246 | + /* Stop completed */ |
3247 | + i2c_int_disable(idev, ~MST_STATUS_TSS); |
3248 | + complete(&idev->msg_complete); |
3249 | + } else if (status & MST_STATUS_SNS) { |
3250 | + /* Transfer done */ |
3251 | + i2c_int_disable(idev, ~MST_STATUS_TSS); |
3252 | + if (i2c_m_rd(idev->msg) && idev->msg_xfrd < idev->msg->len) |
3253 | + axxia_i2c_empty_rx_fifo(idev); |
3254 | + complete(&idev->msg_complete); |
3255 | + } else if (status & MST_STATUS_TSS) { |
3256 | + /* Transfer timeout */ |
3257 | + idev->msg_err = -ETIMEDOUT; |
3258 | + i2c_int_disable(idev, ~MST_STATUS_TSS); |
3259 | + complete(&idev->msg_complete); |
3260 | } |
3261 | |
3262 | out: |
3263 | diff --git a/drivers/i2c/busses/i2c-sh_mobile.c b/drivers/i2c/busses/i2c-sh_mobile.c |
3264 | index a7a7a9c3bc7c..a64f2ff3cb49 100644 |
3265 | --- a/drivers/i2c/busses/i2c-sh_mobile.c |
3266 | +++ b/drivers/i2c/busses/i2c-sh_mobile.c |
3267 | @@ -800,6 +800,7 @@ static const struct sh_mobile_dt_config r8a7740_dt_config = { |
3268 | static const struct of_device_id sh_mobile_i2c_dt_ids[] = { |
3269 | { .compatible = "renesas,iic-r8a73a4", .data = &fast_clock_dt_config }, |
3270 | { .compatible = "renesas,iic-r8a7740", .data = &r8a7740_dt_config }, |
3271 | + { .compatible = "renesas,iic-r8a774c0", .data = &fast_clock_dt_config }, |
3272 | { .compatible = "renesas,iic-r8a7790", .data = &v2_freq_calc_dt_config }, |
3273 | { .compatible = "renesas,iic-r8a7791", .data = &fast_clock_dt_config }, |
3274 | { .compatible = "renesas,iic-r8a7792", .data = &fast_clock_dt_config }, |
3275 | @@ -808,6 +809,7 @@ static const struct of_device_id sh_mobile_i2c_dt_ids[] = { |
3276 | { .compatible = "renesas,rcar-gen2-iic", .data = &fast_clock_dt_config }, |
3277 | { .compatible = "renesas,iic-r8a7795", .data = &fast_clock_dt_config }, |
3278 | { .compatible = "renesas,rcar-gen3-iic", .data = &fast_clock_dt_config }, |
3279 | + { .compatible = "renesas,iic-r8a77990", .data = &fast_clock_dt_config }, |
3280 | { .compatible = "renesas,iic-sh73a0", .data = &fast_clock_dt_config }, |
3281 | { .compatible = "renesas,rmobile-iic", .data = &default_dt_config }, |
3282 | {}, |
3283 | diff --git a/drivers/iio/accel/kxcjk-1013.c b/drivers/iio/accel/kxcjk-1013.c |
3284 | index af53a1084ee5..471caa5323e4 100644 |
3285 | --- a/drivers/iio/accel/kxcjk-1013.c |
3286 | +++ b/drivers/iio/accel/kxcjk-1013.c |
3287 | @@ -1490,6 +1490,7 @@ static const struct acpi_device_id kx_acpi_match[] = { |
3288 | {"KXCJ1008", KXCJ91008}, |
3289 | {"KXCJ9000", KXCJ91008}, |
3290 | {"KIOX000A", KXCJ91008}, |
3291 | + {"KIOX010A", KXCJ91008}, /* KXCJ91008 inside the display of a 2-in-1 */ |
3292 | {"KXTJ1009", KXTJ21009}, |
3293 | {"SMO8500", KXCJ91008}, |
3294 | { }, |
3295 | diff --git a/drivers/iio/adc/meson_saradc.c b/drivers/iio/adc/meson_saradc.c |
3296 | index 028ccd218f82..ba4b42429a2a 100644 |
3297 | --- a/drivers/iio/adc/meson_saradc.c |
3298 | +++ b/drivers/iio/adc/meson_saradc.c |
3299 | @@ -587,8 +587,11 @@ static int meson_sar_adc_clk_init(struct iio_dev *indio_dev, |
3300 | struct clk_init_data init; |
3301 | const char *clk_parents[1]; |
3302 | |
3303 | - init.name = devm_kasprintf(&indio_dev->dev, GFP_KERNEL, "%pOF#adc_div", |
3304 | - indio_dev->dev.of_node); |
3305 | + init.name = devm_kasprintf(&indio_dev->dev, GFP_KERNEL, "%s#adc_div", |
3306 | + dev_name(indio_dev->dev.parent)); |
3307 | + if (!init.name) |
3308 | + return -ENOMEM; |
3309 | + |
3310 | init.flags = 0; |
3311 | init.ops = &clk_divider_ops; |
3312 | clk_parents[0] = __clk_get_name(priv->clkin); |
3313 | @@ -606,8 +609,11 @@ static int meson_sar_adc_clk_init(struct iio_dev *indio_dev, |
3314 | if (WARN_ON(IS_ERR(priv->adc_div_clk))) |
3315 | return PTR_ERR(priv->adc_div_clk); |
3316 | |
3317 | - init.name = devm_kasprintf(&indio_dev->dev, GFP_KERNEL, "%pOF#adc_en", |
3318 | - indio_dev->dev.of_node); |
3319 | + init.name = devm_kasprintf(&indio_dev->dev, GFP_KERNEL, "%s#adc_en", |
3320 | + dev_name(indio_dev->dev.parent)); |
3321 | + if (!init.name) |
3322 | + return -ENOMEM; |
3323 | + |
3324 | init.flags = CLK_SET_RATE_PARENT; |
3325 | init.ops = &clk_gate_ops; |
3326 | clk_parents[0] = __clk_get_name(priv->adc_div_clk); |
3327 | diff --git a/drivers/infiniband/core/core_priv.h b/drivers/infiniband/core/core_priv.h |
3328 | index bb9007a0cca7..d97d39a7537c 100644 |
3329 | --- a/drivers/infiniband/core/core_priv.h |
3330 | +++ b/drivers/infiniband/core/core_priv.h |
3331 | @@ -296,6 +296,7 @@ static inline int ib_mad_enforce_security(struct ib_mad_agent_private *map, |
3332 | #endif |
3333 | |
3334 | struct ib_device *ib_device_get_by_index(u32 ifindex); |
3335 | +void ib_device_put(struct ib_device *device); |
3336 | /* RDMA device netlink */ |
3337 | void nldev_init(void); |
3338 | void nldev_exit(void); |
3339 | diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c |
3340 | index 87eb4f2cdd7d..0027b0d79b09 100644 |
3341 | --- a/drivers/infiniband/core/device.c |
3342 | +++ b/drivers/infiniband/core/device.c |
3343 | @@ -145,7 +145,8 @@ static struct ib_device *__ib_device_get_by_index(u32 index) |
3344 | } |
3345 | |
3346 | /* |
3347 | - * Caller is responsible to return refrerence count by calling put_device() |
3348 | + * Caller must perform ib_device_put() to return the device reference count |
3349 | + * when ib_device_get_by_index() returns valid device pointer. |
3350 | */ |
3351 | struct ib_device *ib_device_get_by_index(u32 index) |
3352 | { |
3353 | @@ -153,13 +154,21 @@ struct ib_device *ib_device_get_by_index(u32 index) |
3354 | |
3355 | down_read(&lists_rwsem); |
3356 | device = __ib_device_get_by_index(index); |
3357 | - if (device) |
3358 | - get_device(&device->dev); |
3359 | - |
3360 | + if (device) { |
3361 | + /* Do not return a device if unregistration has started. */ |
3362 | + if (!refcount_inc_not_zero(&device->refcount)) |
3363 | + device = NULL; |
3364 | + } |
3365 | up_read(&lists_rwsem); |
3366 | return device; |
3367 | } |
3368 | |
3369 | +void ib_device_put(struct ib_device *device) |
3370 | +{ |
3371 | + if (refcount_dec_and_test(&device->refcount)) |
3372 | + complete(&device->unreg_completion); |
3373 | +} |
3374 | + |
3375 | static struct ib_device *__ib_device_get_by_name(const char *name) |
3376 | { |
3377 | struct ib_device *device; |
3378 | @@ -293,6 +302,8 @@ struct ib_device *ib_alloc_device(size_t size) |
3379 | rwlock_init(&device->client_data_lock); |
3380 | INIT_LIST_HEAD(&device->client_data_list); |
3381 | INIT_LIST_HEAD(&device->port_list); |
3382 | + refcount_set(&device->refcount, 1); |
3383 | + init_completion(&device->unreg_completion); |
3384 | |
3385 | return device; |
3386 | } |
3387 | @@ -641,6 +652,13 @@ void ib_unregister_device(struct ib_device *device) |
3388 | struct ib_client_data *context, *tmp; |
3389 | unsigned long flags; |
3390 | |
3391 | + /* |
3392 | + * Wait for all netlink command callers to finish working on the |
3393 | + * device. |
3394 | + */ |
3395 | + ib_device_put(device); |
3396 | + wait_for_completion(&device->unreg_completion); |
3397 | + |
3398 | mutex_lock(&device_mutex); |
3399 | |
3400 | down_write(&lists_rwsem); |
3401 | diff --git a/drivers/infiniband/core/nldev.c b/drivers/infiniband/core/nldev.c |
3402 | index ff6468e7fe79..77a0f1e1576f 100644 |
3403 | --- a/drivers/infiniband/core/nldev.c |
3404 | +++ b/drivers/infiniband/core/nldev.c |
3405 | @@ -632,13 +632,13 @@ static int nldev_get_doit(struct sk_buff *skb, struct nlmsghdr *nlh, |
3406 | |
3407 | nlmsg_end(msg, nlh); |
3408 | |
3409 | - put_device(&device->dev); |
3410 | + ib_device_put(device); |
3411 | return rdma_nl_unicast(msg, NETLINK_CB(skb).portid); |
3412 | |
3413 | err_free: |
3414 | nlmsg_free(msg); |
3415 | err: |
3416 | - put_device(&device->dev); |
3417 | + ib_device_put(device); |
3418 | return err; |
3419 | } |
3420 | |
3421 | @@ -668,7 +668,7 @@ static int nldev_set_doit(struct sk_buff *skb, struct nlmsghdr *nlh, |
3422 | err = ib_device_rename(device, name); |
3423 | } |
3424 | |
3425 | - put_device(&device->dev); |
3426 | + ib_device_put(device); |
3427 | return err; |
3428 | } |
3429 | |
3430 | @@ -752,14 +752,14 @@ static int nldev_port_get_doit(struct sk_buff *skb, struct nlmsghdr *nlh, |
3431 | goto err_free; |
3432 | |
3433 | nlmsg_end(msg, nlh); |
3434 | - put_device(&device->dev); |
3435 | + ib_device_put(device); |
3436 | |
3437 | return rdma_nl_unicast(msg, NETLINK_CB(skb).portid); |
3438 | |
3439 | err_free: |
3440 | nlmsg_free(msg); |
3441 | err: |
3442 | - put_device(&device->dev); |
3443 | + ib_device_put(device); |
3444 | return err; |
3445 | } |
3446 | |
3447 | @@ -816,7 +816,7 @@ static int nldev_port_get_dumpit(struct sk_buff *skb, |
3448 | } |
3449 | |
3450 | out: |
3451 | - put_device(&device->dev); |
3452 | + ib_device_put(device); |
3453 | cb->args[0] = idx; |
3454 | return skb->len; |
3455 | } |
3456 | @@ -855,13 +855,13 @@ static int nldev_res_get_doit(struct sk_buff *skb, struct nlmsghdr *nlh, |
3457 | goto err_free; |
3458 | |
3459 | nlmsg_end(msg, nlh); |
3460 | - put_device(&device->dev); |
3461 | + ib_device_put(device); |
3462 | return rdma_nl_unicast(msg, NETLINK_CB(skb).portid); |
3463 | |
3464 | err_free: |
3465 | nlmsg_free(msg); |
3466 | err: |
3467 | - put_device(&device->dev); |
3468 | + ib_device_put(device); |
3469 | return ret; |
3470 | } |
3471 | |
3472 | @@ -1054,7 +1054,7 @@ next: idx++; |
3473 | if (!filled) |
3474 | goto err; |
3475 | |
3476 | - put_device(&device->dev); |
3477 | + ib_device_put(device); |
3478 | return skb->len; |
3479 | |
3480 | res_err: |
3481 | @@ -1065,7 +1065,7 @@ err: |
3482 | nlmsg_cancel(skb, nlh); |
3483 | |
3484 | err_index: |
3485 | - put_device(&device->dev); |
3486 | + ib_device_put(device); |
3487 | return ret; |
3488 | } |
3489 | |
3490 | diff --git a/drivers/infiniband/hw/hfi1/rc.c b/drivers/infiniband/hw/hfi1/rc.c |
3491 | index 188aa4f686a0..ea3aac264df9 100644 |
3492 | --- a/drivers/infiniband/hw/hfi1/rc.c |
3493 | +++ b/drivers/infiniband/hw/hfi1/rc.c |
3494 | @@ -1157,6 +1157,7 @@ void hfi1_rc_send_complete(struct rvt_qp *qp, struct hfi1_opa_header *opah) |
3495 | if (cmp_psn(wqe->lpsn, qp->s_sending_psn) >= 0 && |
3496 | cmp_psn(qp->s_sending_psn, qp->s_sending_hpsn) <= 0) |
3497 | break; |
3498 | + rvt_qp_wqe_unreserve(qp, wqe); |
3499 | s_last = qp->s_last; |
3500 | trace_hfi1_qp_send_completion(qp, wqe, s_last); |
3501 | if (++s_last >= qp->s_size) |
3502 | @@ -1209,6 +1210,7 @@ static struct rvt_swqe *do_rc_completion(struct rvt_qp *qp, |
3503 | u32 s_last; |
3504 | |
3505 | rvt_put_swqe(wqe); |
3506 | + rvt_qp_wqe_unreserve(qp, wqe); |
3507 | s_last = qp->s_last; |
3508 | trace_hfi1_qp_send_completion(qp, wqe, s_last); |
3509 | if (++s_last >= qp->s_size) |
3510 | diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c |
3511 | index 1167ff0416cf..325f3bad118b 100644 |
3512 | --- a/drivers/iommu/amd_iommu.c |
3513 | +++ b/drivers/iommu/amd_iommu.c |
3514 | @@ -438,7 +438,14 @@ static int iommu_init_device(struct device *dev) |
3515 | |
3516 | dev_data->alias = get_alias(dev); |
3517 | |
3518 | - if (dev_is_pci(dev) && pci_iommuv2_capable(to_pci_dev(dev))) { |
3519 | + /* |
3520 | + * By default we use passthrough mode for IOMMUv2 capable device. |
3521 | + * But if amd_iommu=force_isolation is set (e.g. to debug DMA to |
3522 | + * invalid address), we ignore the capability for the device so |
3523 | + * it'll be forced to go into translation mode. |
3524 | + */ |
3525 | + if ((iommu_pass_through || !amd_iommu_force_isolation) && |
3526 | + dev_is_pci(dev) && pci_iommuv2_capable(to_pci_dev(dev))) { |
3527 | struct amd_iommu *iommu; |
3528 | |
3529 | iommu = amd_iommu_rlookup_table[dev_data->devid]; |
3530 | diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c |
3531 | index 71eda422c926..11f528e727a1 100644 |
3532 | --- a/drivers/iommu/arm-smmu-v3.c |
3533 | +++ b/drivers/iommu/arm-smmu-v3.c |
3534 | @@ -576,7 +576,11 @@ struct arm_smmu_device { |
3535 | |
3536 | struct arm_smmu_strtab_cfg strtab_cfg; |
3537 | |
3538 | - u32 sync_count; |
3539 | + /* Hi16xx adds an extra 32 bits of goodness to its MSI payload */ |
3540 | + union { |
3541 | + u32 sync_count; |
3542 | + u64 padding; |
3543 | + }; |
3544 | |
3545 | /* IOMMU core code handle */ |
3546 | struct iommu_device iommu; |
3547 | @@ -675,7 +679,13 @@ static void queue_inc_cons(struct arm_smmu_queue *q) |
3548 | u32 cons = (Q_WRP(q, q->cons) | Q_IDX(q, q->cons)) + 1; |
3549 | |
3550 | q->cons = Q_OVF(q, q->cons) | Q_WRP(q, cons) | Q_IDX(q, cons); |
3551 | - writel(q->cons, q->cons_reg); |
3552 | + |
3553 | + /* |
3554 | + * Ensure that all CPU accesses (reads and writes) to the queue |
3555 | + * are complete before we update the cons pointer. |
3556 | + */ |
3557 | + mb(); |
3558 | + writel_relaxed(q->cons, q->cons_reg); |
3559 | } |
3560 | |
3561 | static int queue_sync_prod(struct arm_smmu_queue *q) |
3562 | diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c |
3563 | index 5a28ae892504..e23aa7f6c4ad 100644 |
3564 | --- a/drivers/iommu/arm-smmu.c |
3565 | +++ b/drivers/iommu/arm-smmu.c |
3566 | @@ -119,6 +119,7 @@ enum arm_smmu_implementation { |
3567 | GENERIC_SMMU, |
3568 | ARM_MMU500, |
3569 | CAVIUM_SMMUV2, |
3570 | + QCOM_SMMUV2, |
3571 | }; |
3572 | |
3573 | struct arm_smmu_s2cr { |
3574 | @@ -1954,6 +1955,7 @@ ARM_SMMU_MATCH_DATA(smmu_generic_v2, ARM_SMMU_V2, GENERIC_SMMU); |
3575 | ARM_SMMU_MATCH_DATA(arm_mmu401, ARM_SMMU_V1_64K, GENERIC_SMMU); |
3576 | ARM_SMMU_MATCH_DATA(arm_mmu500, ARM_SMMU_V2, ARM_MMU500); |
3577 | ARM_SMMU_MATCH_DATA(cavium_smmuv2, ARM_SMMU_V2, CAVIUM_SMMUV2); |
3578 | +ARM_SMMU_MATCH_DATA(qcom_smmuv2, ARM_SMMU_V2, QCOM_SMMUV2); |
3579 | |
3580 | static const struct of_device_id arm_smmu_of_match[] = { |
3581 | { .compatible = "arm,smmu-v1", .data = &smmu_generic_v1 }, |
3582 | @@ -1962,6 +1964,7 @@ static const struct of_device_id arm_smmu_of_match[] = { |
3583 | { .compatible = "arm,mmu-401", .data = &arm_mmu401 }, |
3584 | { .compatible = "arm,mmu-500", .data = &arm_mmu500 }, |
3585 | { .compatible = "cavium,smmu-v2", .data = &cavium_smmuv2 }, |
3586 | + { .compatible = "qcom,smmu-v2", .data = &qcom_smmuv2 }, |
3587 | { }, |
3588 | }; |
3589 | MODULE_DEVICE_TABLE(of, arm_smmu_of_match); |
3590 | diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c |
3591 | index 7f2a45445b00..350f999d205b 100644 |
3592 | --- a/drivers/irqchip/irq-gic-v3-its.c |
3593 | +++ b/drivers/irqchip/irq-gic-v3-its.c |
3594 | @@ -97,9 +97,14 @@ struct its_device; |
3595 | * The ITS structure - contains most of the infrastructure, with the |
3596 | * top-level MSI domain, the command queue, the collections, and the |
3597 | * list of devices writing to it. |
3598 | + * |
3599 | + * dev_alloc_lock has to be taken for device allocations, while the |
3600 | + * spinlock must be taken to parse data structures such as the device |
3601 | + * list. |
3602 | */ |
3603 | struct its_node { |
3604 | raw_spinlock_t lock; |
3605 | + struct mutex dev_alloc_lock; |
3606 | struct list_head entry; |
3607 | void __iomem *base; |
3608 | phys_addr_t phys_base; |
3609 | @@ -156,6 +161,7 @@ struct its_device { |
3610 | void *itt; |
3611 | u32 nr_ites; |
3612 | u32 device_id; |
3613 | + bool shared; |
3614 | }; |
3615 | |
3616 | static struct { |
3617 | @@ -2422,6 +2428,7 @@ static int its_msi_prepare(struct irq_domain *domain, struct device *dev, |
3618 | struct its_device *its_dev; |
3619 | struct msi_domain_info *msi_info; |
3620 | u32 dev_id; |
3621 | + int err = 0; |
3622 | |
3623 | /* |
3624 | * We ignore "dev" entierely, and rely on the dev_id that has |
3625 | @@ -2444,6 +2451,7 @@ static int its_msi_prepare(struct irq_domain *domain, struct device *dev, |
3626 | return -EINVAL; |
3627 | } |
3628 | |
3629 | + mutex_lock(&its->dev_alloc_lock); |
3630 | its_dev = its_find_device(its, dev_id); |
3631 | if (its_dev) { |
3632 | /* |
3633 | @@ -2451,18 +2459,22 @@ static int its_msi_prepare(struct irq_domain *domain, struct device *dev, |
3634 | * another alias (PCI bridge of some sort). No need to |
3635 | * create the device. |
3636 | */ |
3637 | + its_dev->shared = true; |
3638 | pr_debug("Reusing ITT for devID %x\n", dev_id); |
3639 | goto out; |
3640 | } |
3641 | |
3642 | its_dev = its_create_device(its, dev_id, nvec, true); |
3643 | - if (!its_dev) |
3644 | - return -ENOMEM; |
3645 | + if (!its_dev) { |
3646 | + err = -ENOMEM; |
3647 | + goto out; |
3648 | + } |
3649 | |
3650 | pr_debug("ITT %d entries, %d bits\n", nvec, ilog2(nvec)); |
3651 | out: |
3652 | + mutex_unlock(&its->dev_alloc_lock); |
3653 | info->scratchpad[0].ptr = its_dev; |
3654 | - return 0; |
3655 | + return err; |
3656 | } |
3657 | |
3658 | static struct msi_domain_ops its_msi_domain_ops = { |
3659 | @@ -2566,6 +2578,7 @@ static void its_irq_domain_free(struct irq_domain *domain, unsigned int virq, |
3660 | { |
3661 | struct irq_data *d = irq_domain_get_irq_data(domain, virq); |
3662 | struct its_device *its_dev = irq_data_get_irq_chip_data(d); |
3663 | + struct its_node *its = its_dev->its; |
3664 | int i; |
3665 | |
3666 | for (i = 0; i < nr_irqs; i++) { |
3667 | @@ -2580,8 +2593,14 @@ static void its_irq_domain_free(struct irq_domain *domain, unsigned int virq, |
3668 | irq_domain_reset_irq_data(data); |
3669 | } |
3670 | |
3671 | - /* If all interrupts have been freed, start mopping the floor */ |
3672 | - if (bitmap_empty(its_dev->event_map.lpi_map, |
3673 | + mutex_lock(&its->dev_alloc_lock); |
3674 | + |
3675 | + /* |
3676 | + * If all interrupts have been freed, start mopping the |
3677 | + * floor. This is conditionned on the device not being shared. |
3678 | + */ |
3679 | + if (!its_dev->shared && |
3680 | + bitmap_empty(its_dev->event_map.lpi_map, |
3681 | its_dev->event_map.nr_lpis)) { |
3682 | its_lpi_free(its_dev->event_map.lpi_map, |
3683 | its_dev->event_map.lpi_base, |
3684 | @@ -2593,6 +2612,8 @@ static void its_irq_domain_free(struct irq_domain *domain, unsigned int virq, |
3685 | its_free_device(its_dev); |
3686 | } |
3687 | |
3688 | + mutex_unlock(&its->dev_alloc_lock); |
3689 | + |
3690 | irq_domain_free_irqs_parent(domain, virq, nr_irqs); |
3691 | } |
3692 | |
3693 | @@ -3517,6 +3538,7 @@ static int __init its_probe_one(struct resource *res, |
3694 | } |
3695 | |
3696 | raw_spin_lock_init(&its->lock); |
3697 | + mutex_init(&its->dev_alloc_lock); |
3698 | INIT_LIST_HEAD(&its->entry); |
3699 | INIT_LIST_HEAD(&its->its_device_list); |
3700 | typer = gic_read_typer(its_base + GITS_TYPER); |
3701 | diff --git a/drivers/isdn/hisax/hfc_pci.c b/drivers/isdn/hisax/hfc_pci.c |
3702 | index ea0e4c6de3fb..0109e0e8bcb6 100644 |
3703 | --- a/drivers/isdn/hisax/hfc_pci.c |
3704 | +++ b/drivers/isdn/hisax/hfc_pci.c |
3705 | @@ -1170,11 +1170,13 @@ HFCPCI_l1hw(struct PStack *st, int pr, void *arg) |
3706 | if (cs->debug & L1_DEB_LAPD) |
3707 | debugl1(cs, "-> PH_REQUEST_PULL"); |
3708 | #endif |
3709 | + spin_lock_irqsave(&cs->lock, flags); |
3710 | if (!cs->tx_skb) { |
3711 | test_and_clear_bit(FLG_L1_PULL_REQ, &st->l1.Flags); |
3712 | st->l1.l1l2(st, PH_PULL | CONFIRM, NULL); |
3713 | } else |
3714 | test_and_set_bit(FLG_L1_PULL_REQ, &st->l1.Flags); |
3715 | + spin_unlock_irqrestore(&cs->lock, flags); |
3716 | break; |
3717 | case (HW_RESET | REQUEST): |
3718 | spin_lock_irqsave(&cs->lock, flags); |
3719 | diff --git a/drivers/lightnvm/core.c b/drivers/lightnvm/core.c |
3720 | index efb976a863d2..73ab3cf26868 100644 |
3721 | --- a/drivers/lightnvm/core.c |
3722 | +++ b/drivers/lightnvm/core.c |
3723 | @@ -974,7 +974,7 @@ static int nvm_get_bb_meta(struct nvm_dev *dev, sector_t slba, |
3724 | struct ppa_addr ppa; |
3725 | u8 *blks; |
3726 | int ch, lun, nr_blks; |
3727 | - int ret; |
3728 | + int ret = 0; |
3729 | |
3730 | ppa.ppa = slba; |
3731 | ppa = dev_to_generic_addr(dev, ppa); |
3732 | diff --git a/drivers/lightnvm/pblk-core.c b/drivers/lightnvm/pblk-core.c |
3733 | index 6944aac43b01..247112e1db94 100644 |
3734 | --- a/drivers/lightnvm/pblk-core.c |
3735 | +++ b/drivers/lightnvm/pblk-core.c |
3736 | @@ -1295,15 +1295,22 @@ int pblk_line_recov_alloc(struct pblk *pblk, struct pblk_line *line) |
3737 | |
3738 | ret = pblk_line_alloc_bitmaps(pblk, line); |
3739 | if (ret) |
3740 | - return ret; |
3741 | + goto fail; |
3742 | |
3743 | if (!pblk_line_init_bb(pblk, line, 0)) { |
3744 | - list_add(&line->list, &l_mg->free_list); |
3745 | - return -EINTR; |
3746 | + ret = -EINTR; |
3747 | + goto fail; |
3748 | } |
3749 | |
3750 | pblk_rl_free_lines_dec(&pblk->rl, line, true); |
3751 | return 0; |
3752 | + |
3753 | +fail: |
3754 | + spin_lock(&l_mg->free_lock); |
3755 | + list_add(&line->list, &l_mg->free_list); |
3756 | + spin_unlock(&l_mg->free_lock); |
3757 | + |
3758 | + return ret; |
3759 | } |
3760 | |
3761 | void pblk_line_recov_close(struct pblk *pblk, struct pblk_line *line) |
3762 | diff --git a/drivers/lightnvm/pblk-write.c b/drivers/lightnvm/pblk-write.c |
3763 | index fa8726493b39..3ddd16f47106 100644 |
3764 | --- a/drivers/lightnvm/pblk-write.c |
3765 | +++ b/drivers/lightnvm/pblk-write.c |
3766 | @@ -148,9 +148,11 @@ static void pblk_prepare_resubmit(struct pblk *pblk, unsigned int sentry, |
3767 | w_ctx = &entry->w_ctx; |
3768 | |
3769 | /* Check if the lba has been overwritten */ |
3770 | - ppa_l2p = pblk_trans_map_get(pblk, w_ctx->lba); |
3771 | - if (!pblk_ppa_comp(ppa_l2p, entry->cacheline)) |
3772 | - w_ctx->lba = ADDR_EMPTY; |
3773 | + if (w_ctx->lba != ADDR_EMPTY) { |
3774 | + ppa_l2p = pblk_trans_map_get(pblk, w_ctx->lba); |
3775 | + if (!pblk_ppa_comp(ppa_l2p, entry->cacheline)) |
3776 | + w_ctx->lba = ADDR_EMPTY; |
3777 | + } |
3778 | |
3779 | /* Mark up the entry as submittable again */ |
3780 | flags = READ_ONCE(w_ctx->flags); |
3781 | diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c |
3782 | index b98e746e7fc4..12cf8a04e839 100644 |
3783 | --- a/drivers/md/raid10.c |
3784 | +++ b/drivers/md/raid10.c |
3785 | @@ -1209,7 +1209,9 @@ static void raid10_read_request(struct mddev *mddev, struct bio *bio, |
3786 | struct bio *split = bio_split(bio, max_sectors, |
3787 | gfp, &conf->bio_split); |
3788 | bio_chain(split, bio); |
3789 | + allow_barrier(conf); |
3790 | generic_make_request(bio); |
3791 | + wait_barrier(conf); |
3792 | bio = split; |
3793 | r10_bio->master_bio = bio; |
3794 | r10_bio->sectors = max_sectors; |
3795 | @@ -1514,7 +1516,9 @@ retry_write: |
3796 | struct bio *split = bio_split(bio, r10_bio->sectors, |
3797 | GFP_NOIO, &conf->bio_split); |
3798 | bio_chain(split, bio); |
3799 | + allow_barrier(conf); |
3800 | generic_make_request(bio); |
3801 | + wait_barrier(conf); |
3802 | bio = split; |
3803 | r10_bio->master_bio = bio; |
3804 | } |
3805 | diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig |
3806 | index 704af210e270..421e2fd2481d 100644 |
3807 | --- a/drivers/media/i2c/Kconfig |
3808 | +++ b/drivers/media/i2c/Kconfig |
3809 | @@ -61,6 +61,7 @@ config VIDEO_TDA1997X |
3810 | depends on VIDEO_V4L2 && I2C && VIDEO_V4L2_SUBDEV_API |
3811 | depends on SND_SOC |
3812 | select SND_PCM |
3813 | + select HDMI |
3814 | ---help--- |
3815 | V4L2 subdevice driver for the NXP TDA1997x HDMI receivers. |
3816 | |
3817 | @@ -610,6 +611,7 @@ config VIDEO_IMX274 |
3818 | tristate "Sony IMX274 sensor support" |
3819 | depends on I2C && VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API |
3820 | depends on MEDIA_CAMERA_SUPPORT |
3821 | + select REGMAP_I2C |
3822 | ---help--- |
3823 | This is a V4L2 sensor driver for the Sony IMX274 |
3824 | CMOS image sensor. |
3825 | diff --git a/drivers/media/i2c/ad9389b.c b/drivers/media/i2c/ad9389b.c |
3826 | index 5b008b0002c0..aa8b04cfed0f 100644 |
3827 | --- a/drivers/media/i2c/ad9389b.c |
3828 | +++ b/drivers/media/i2c/ad9389b.c |
3829 | @@ -578,7 +578,7 @@ static const struct v4l2_dv_timings_cap ad9389b_timings_cap = { |
3830 | .type = V4L2_DV_BT_656_1120, |
3831 | /* keep this initialization for compatibility with GCC < 4.4.6 */ |
3832 | .reserved = { 0 }, |
3833 | - V4L2_INIT_BT_TIMINGS(0, 1920, 0, 1200, 25000000, 170000000, |
3834 | + V4L2_INIT_BT_TIMINGS(640, 1920, 350, 1200, 25000000, 170000000, |
3835 | V4L2_DV_BT_STD_CEA861 | V4L2_DV_BT_STD_DMT | |
3836 | V4L2_DV_BT_STD_GTF | V4L2_DV_BT_STD_CVT, |
3837 | V4L2_DV_BT_CAP_PROGRESSIVE | V4L2_DV_BT_CAP_REDUCED_BLANKING | |
3838 | diff --git a/drivers/media/i2c/adv7511.c b/drivers/media/i2c/adv7511.c |
3839 | index f3899cc84e27..88349b5053cc 100644 |
3840 | --- a/drivers/media/i2c/adv7511.c |
3841 | +++ b/drivers/media/i2c/adv7511.c |
3842 | @@ -130,7 +130,7 @@ static const struct v4l2_dv_timings_cap adv7511_timings_cap = { |
3843 | .type = V4L2_DV_BT_656_1120, |
3844 | /* keep this initialization for compatibility with GCC < 4.4.6 */ |
3845 | .reserved = { 0 }, |
3846 | - V4L2_INIT_BT_TIMINGS(0, ADV7511_MAX_WIDTH, 0, ADV7511_MAX_HEIGHT, |
3847 | + V4L2_INIT_BT_TIMINGS(640, ADV7511_MAX_WIDTH, 350, ADV7511_MAX_HEIGHT, |
3848 | ADV7511_MIN_PIXELCLOCK, ADV7511_MAX_PIXELCLOCK, |
3849 | V4L2_DV_BT_STD_CEA861 | V4L2_DV_BT_STD_DMT | |
3850 | V4L2_DV_BT_STD_GTF | V4L2_DV_BT_STD_CVT, |
3851 | diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c |
3852 | index 9eb7c70a7712..ff28f5692986 100644 |
3853 | --- a/drivers/media/i2c/adv7604.c |
3854 | +++ b/drivers/media/i2c/adv7604.c |
3855 | @@ -766,7 +766,7 @@ static const struct v4l2_dv_timings_cap adv7604_timings_cap_analog = { |
3856 | .type = V4L2_DV_BT_656_1120, |
3857 | /* keep this initialization for compatibility with GCC < 4.4.6 */ |
3858 | .reserved = { 0 }, |
3859 | - V4L2_INIT_BT_TIMINGS(0, 1920, 0, 1200, 25000000, 170000000, |
3860 | + V4L2_INIT_BT_TIMINGS(640, 1920, 350, 1200, 25000000, 170000000, |
3861 | V4L2_DV_BT_STD_CEA861 | V4L2_DV_BT_STD_DMT | |
3862 | V4L2_DV_BT_STD_GTF | V4L2_DV_BT_STD_CVT, |
3863 | V4L2_DV_BT_CAP_PROGRESSIVE | V4L2_DV_BT_CAP_REDUCED_BLANKING | |
3864 | @@ -777,7 +777,7 @@ static const struct v4l2_dv_timings_cap adv76xx_timings_cap_digital = { |
3865 | .type = V4L2_DV_BT_656_1120, |
3866 | /* keep this initialization for compatibility with GCC < 4.4.6 */ |
3867 | .reserved = { 0 }, |
3868 | - V4L2_INIT_BT_TIMINGS(0, 1920, 0, 1200, 25000000, 225000000, |
3869 | + V4L2_INIT_BT_TIMINGS(640, 1920, 350, 1200, 25000000, 225000000, |
3870 | V4L2_DV_BT_STD_CEA861 | V4L2_DV_BT_STD_DMT | |
3871 | V4L2_DV_BT_STD_GTF | V4L2_DV_BT_STD_CVT, |
3872 | V4L2_DV_BT_CAP_PROGRESSIVE | V4L2_DV_BT_CAP_REDUCED_BLANKING | |
3873 | diff --git a/drivers/media/i2c/adv7842.c b/drivers/media/i2c/adv7842.c |
3874 | index 4721d49dcf0f..5305c3ad80e6 100644 |
3875 | --- a/drivers/media/i2c/adv7842.c |
3876 | +++ b/drivers/media/i2c/adv7842.c |
3877 | @@ -663,7 +663,7 @@ static const struct v4l2_dv_timings_cap adv7842_timings_cap_analog = { |
3878 | .type = V4L2_DV_BT_656_1120, |
3879 | /* keep this initialization for compatibility with GCC < 4.4.6 */ |
3880 | .reserved = { 0 }, |
3881 | - V4L2_INIT_BT_TIMINGS(0, 1920, 0, 1200, 25000000, 170000000, |
3882 | + V4L2_INIT_BT_TIMINGS(640, 1920, 350, 1200, 25000000, 170000000, |
3883 | V4L2_DV_BT_STD_CEA861 | V4L2_DV_BT_STD_DMT | |
3884 | V4L2_DV_BT_STD_GTF | V4L2_DV_BT_STD_CVT, |
3885 | V4L2_DV_BT_CAP_PROGRESSIVE | V4L2_DV_BT_CAP_REDUCED_BLANKING | |
3886 | @@ -674,7 +674,7 @@ static const struct v4l2_dv_timings_cap adv7842_timings_cap_digital = { |
3887 | .type = V4L2_DV_BT_656_1120, |
3888 | /* keep this initialization for compatibility with GCC < 4.4.6 */ |
3889 | .reserved = { 0 }, |
3890 | - V4L2_INIT_BT_TIMINGS(0, 1920, 0, 1200, 25000000, 225000000, |
3891 | + V4L2_INIT_BT_TIMINGS(640, 1920, 350, 1200, 25000000, 225000000, |
3892 | V4L2_DV_BT_STD_CEA861 | V4L2_DV_BT_STD_DMT | |
3893 | V4L2_DV_BT_STD_GTF | V4L2_DV_BT_STD_CVT, |
3894 | V4L2_DV_BT_CAP_PROGRESSIVE | V4L2_DV_BT_CAP_REDUCED_BLANKING | |
3895 | diff --git a/drivers/media/i2c/tc358743.c b/drivers/media/i2c/tc358743.c |
3896 | index 41d470d9ca94..00dc930e049f 100644 |
3897 | --- a/drivers/media/i2c/tc358743.c |
3898 | +++ b/drivers/media/i2c/tc358743.c |
3899 | @@ -59,7 +59,7 @@ static const struct v4l2_dv_timings_cap tc358743_timings_cap = { |
3900 | /* keep this initialization for compatibility with GCC < 4.4.6 */ |
3901 | .reserved = { 0 }, |
3902 | /* Pixel clock from REF_01 p. 20. Min/max height/width are unknown */ |
3903 | - V4L2_INIT_BT_TIMINGS(1, 10000, 1, 10000, 0, 165000000, |
3904 | + V4L2_INIT_BT_TIMINGS(640, 1920, 350, 1200, 13000000, 165000000, |
3905 | V4L2_DV_BT_STD_CEA861 | V4L2_DV_BT_STD_DMT | |
3906 | V4L2_DV_BT_STD_GTF | V4L2_DV_BT_STD_CVT, |
3907 | V4L2_DV_BT_CAP_PROGRESSIVE | |
3908 | diff --git a/drivers/media/i2c/ths8200.c b/drivers/media/i2c/ths8200.c |
3909 | index 498ad2368cbc..f5ee28058ea2 100644 |
3910 | --- a/drivers/media/i2c/ths8200.c |
3911 | +++ b/drivers/media/i2c/ths8200.c |
3912 | @@ -49,7 +49,7 @@ static const struct v4l2_dv_timings_cap ths8200_timings_cap = { |
3913 | .type = V4L2_DV_BT_656_1120, |
3914 | /* keep this initialization for compatibility with GCC < 4.4.6 */ |
3915 | .reserved = { 0 }, |
3916 | - V4L2_INIT_BT_TIMINGS(0, 1920, 0, 1080, 25000000, 148500000, |
3917 | + V4L2_INIT_BT_TIMINGS(640, 1920, 350, 1080, 25000000, 148500000, |
3918 | V4L2_DV_BT_STD_CEA861, V4L2_DV_BT_CAP_PROGRESSIVE) |
3919 | }; |
3920 | |
3921 | diff --git a/drivers/media/i2c/video-i2c.c b/drivers/media/i2c/video-i2c.c |
3922 | index 4d49af86c15e..ec0758dca2fc 100644 |
3923 | --- a/drivers/media/i2c/video-i2c.c |
3924 | +++ b/drivers/media/i2c/video-i2c.c |
3925 | @@ -510,7 +510,12 @@ static const struct v4l2_ioctl_ops video_i2c_ioctl_ops = { |
3926 | |
3927 | static void video_i2c_release(struct video_device *vdev) |
3928 | { |
3929 | - kfree(video_get_drvdata(vdev)); |
3930 | + struct video_i2c_data *data = video_get_drvdata(vdev); |
3931 | + |
3932 | + v4l2_device_unregister(&data->v4l2_dev); |
3933 | + mutex_destroy(&data->lock); |
3934 | + mutex_destroy(&data->queue_lock); |
3935 | + kfree(data); |
3936 | } |
3937 | |
3938 | static int video_i2c_probe(struct i2c_client *client, |
3939 | @@ -608,10 +613,6 @@ static int video_i2c_remove(struct i2c_client *client) |
3940 | struct video_i2c_data *data = i2c_get_clientdata(client); |
3941 | |
3942 | video_unregister_device(&data->vdev); |
3943 | - v4l2_device_unregister(&data->v4l2_dev); |
3944 | - |
3945 | - mutex_destroy(&data->lock); |
3946 | - mutex_destroy(&data->queue_lock); |
3947 | |
3948 | return 0; |
3949 | } |
3950 | diff --git a/drivers/media/platform/coda/coda-bit.c b/drivers/media/platform/coda/coda-bit.c |
3951 | index d26c2d85a009..d20d3df5778b 100644 |
3952 | --- a/drivers/media/platform/coda/coda-bit.c |
3953 | +++ b/drivers/media/platform/coda/coda-bit.c |
3954 | @@ -991,16 +991,15 @@ static int coda_start_encoding(struct coda_ctx *ctx) |
3955 | else |
3956 | coda_write(dev, CODA_STD_H264, |
3957 | CODA_CMD_ENC_SEQ_COD_STD); |
3958 | - if (ctx->params.h264_deblk_enabled) { |
3959 | - value = ((ctx->params.h264_deblk_alpha & |
3960 | - CODA_264PARAM_DEBLKFILTEROFFSETALPHA_MASK) << |
3961 | - CODA_264PARAM_DEBLKFILTEROFFSETALPHA_OFFSET) | |
3962 | - ((ctx->params.h264_deblk_beta & |
3963 | - CODA_264PARAM_DEBLKFILTEROFFSETBETA_MASK) << |
3964 | - CODA_264PARAM_DEBLKFILTEROFFSETBETA_OFFSET); |
3965 | - } else { |
3966 | - value = 1 << CODA_264PARAM_DISABLEDEBLK_OFFSET; |
3967 | - } |
3968 | + value = ((ctx->params.h264_disable_deblocking_filter_idc & |
3969 | + CODA_264PARAM_DISABLEDEBLK_MASK) << |
3970 | + CODA_264PARAM_DISABLEDEBLK_OFFSET) | |
3971 | + ((ctx->params.h264_slice_alpha_c0_offset_div2 & |
3972 | + CODA_264PARAM_DEBLKFILTEROFFSETALPHA_MASK) << |
3973 | + CODA_264PARAM_DEBLKFILTEROFFSETALPHA_OFFSET) | |
3974 | + ((ctx->params.h264_slice_beta_offset_div2 & |
3975 | + CODA_264PARAM_DEBLKFILTEROFFSETBETA_MASK) << |
3976 | + CODA_264PARAM_DEBLKFILTEROFFSETBETA_OFFSET); |
3977 | coda_write(dev, value, CODA_CMD_ENC_SEQ_264_PARA); |
3978 | break; |
3979 | case V4L2_PIX_FMT_JPEG: |
3980 | diff --git a/drivers/media/platform/coda/coda-common.c b/drivers/media/platform/coda/coda-common.c |
3981 | index 2848ea5f464d..d0b36d6eb86e 100644 |
3982 | --- a/drivers/media/platform/coda/coda-common.c |
3983 | +++ b/drivers/media/platform/coda/coda-common.c |
3984 | @@ -1792,14 +1792,13 @@ static int coda_s_ctrl(struct v4l2_ctrl *ctrl) |
3985 | ctx->params.h264_max_qp = ctrl->val; |
3986 | break; |
3987 | case V4L2_CID_MPEG_VIDEO_H264_LOOP_FILTER_ALPHA: |
3988 | - ctx->params.h264_deblk_alpha = ctrl->val; |
3989 | + ctx->params.h264_slice_alpha_c0_offset_div2 = ctrl->val; |
3990 | break; |
3991 | case V4L2_CID_MPEG_VIDEO_H264_LOOP_FILTER_BETA: |
3992 | - ctx->params.h264_deblk_beta = ctrl->val; |
3993 | + ctx->params.h264_slice_beta_offset_div2 = ctrl->val; |
3994 | break; |
3995 | case V4L2_CID_MPEG_VIDEO_H264_LOOP_FILTER_MODE: |
3996 | - ctx->params.h264_deblk_enabled = (ctrl->val == |
3997 | - V4L2_MPEG_VIDEO_H264_LOOP_FILTER_MODE_ENABLED); |
3998 | + ctx->params.h264_disable_deblocking_filter_idc = ctrl->val; |
3999 | break; |
4000 | case V4L2_CID_MPEG_VIDEO_H264_PROFILE: |
4001 | /* TODO: switch between baseline and constrained baseline */ |
4002 | @@ -1881,13 +1880,13 @@ static void coda_encode_ctrls(struct coda_ctx *ctx) |
4003 | v4l2_ctrl_new_std(&ctx->ctrls, &coda_ctrl_ops, |
4004 | V4L2_CID_MPEG_VIDEO_H264_MAX_QP, 0, 51, 1, 51); |
4005 | v4l2_ctrl_new_std(&ctx->ctrls, &coda_ctrl_ops, |
4006 | - V4L2_CID_MPEG_VIDEO_H264_LOOP_FILTER_ALPHA, 0, 15, 1, 0); |
4007 | + V4L2_CID_MPEG_VIDEO_H264_LOOP_FILTER_ALPHA, -6, 6, 1, 0); |
4008 | v4l2_ctrl_new_std(&ctx->ctrls, &coda_ctrl_ops, |
4009 | - V4L2_CID_MPEG_VIDEO_H264_LOOP_FILTER_BETA, 0, 15, 1, 0); |
4010 | + V4L2_CID_MPEG_VIDEO_H264_LOOP_FILTER_BETA, -6, 6, 1, 0); |
4011 | v4l2_ctrl_new_std_menu(&ctx->ctrls, &coda_ctrl_ops, |
4012 | V4L2_CID_MPEG_VIDEO_H264_LOOP_FILTER_MODE, |
4013 | - V4L2_MPEG_VIDEO_H264_LOOP_FILTER_MODE_DISABLED, 0x0, |
4014 | - V4L2_MPEG_VIDEO_H264_LOOP_FILTER_MODE_ENABLED); |
4015 | + V4L2_MPEG_VIDEO_H264_LOOP_FILTER_MODE_DISABLED_AT_SLICE_BOUNDARY, |
4016 | + 0x0, V4L2_MPEG_VIDEO_H264_LOOP_FILTER_MODE_ENABLED); |
4017 | v4l2_ctrl_new_std_menu(&ctx->ctrls, &coda_ctrl_ops, |
4018 | V4L2_CID_MPEG_VIDEO_H264_PROFILE, |
4019 | V4L2_MPEG_VIDEO_H264_PROFILE_BASELINE, 0x0, |
4020 | diff --git a/drivers/media/platform/coda/coda.h b/drivers/media/platform/coda/coda.h |
4021 | index 19ac0b9dc6eb..2469ca1dc598 100644 |
4022 | --- a/drivers/media/platform/coda/coda.h |
4023 | +++ b/drivers/media/platform/coda/coda.h |
4024 | @@ -115,9 +115,9 @@ struct coda_params { |
4025 | u8 h264_inter_qp; |
4026 | u8 h264_min_qp; |
4027 | u8 h264_max_qp; |
4028 | - u8 h264_deblk_enabled; |
4029 | - u8 h264_deblk_alpha; |
4030 | - u8 h264_deblk_beta; |
4031 | + u8 h264_disable_deblocking_filter_idc; |
4032 | + s8 h264_slice_alpha_c0_offset_div2; |
4033 | + s8 h264_slice_beta_offset_div2; |
4034 | u8 h264_profile_idc; |
4035 | u8 h264_level_idc; |
4036 | u8 mpeg4_intra_qp; |
4037 | diff --git a/drivers/media/platform/coda/coda_regs.h b/drivers/media/platform/coda/coda_regs.h |
4038 | index 5e7b00a97671..e675e38f3475 100644 |
4039 | --- a/drivers/media/platform/coda/coda_regs.h |
4040 | +++ b/drivers/media/platform/coda/coda_regs.h |
4041 | @@ -292,7 +292,7 @@ |
4042 | #define CODA_264PARAM_DEBLKFILTEROFFSETALPHA_OFFSET 8 |
4043 | #define CODA_264PARAM_DEBLKFILTEROFFSETALPHA_MASK 0x0f |
4044 | #define CODA_264PARAM_DISABLEDEBLK_OFFSET 6 |
4045 | -#define CODA_264PARAM_DISABLEDEBLK_MASK 0x01 |
4046 | +#define CODA_264PARAM_DISABLEDEBLK_MASK 0x03 |
4047 | #define CODA_264PARAM_CONSTRAINEDINTRAPREDFLAG_OFFSET 5 |
4048 | #define CODA_264PARAM_CONSTRAINEDINTRAPREDFLAG_MASK 0x01 |
4049 | #define CODA_264PARAM_CHROMAQPOFFSET_OFFSET 0 |
4050 | diff --git a/drivers/media/platform/davinci/vpbe.c b/drivers/media/platform/davinci/vpbe.c |
4051 | index 18c035ef84cf..df1ae6b5c854 100644 |
4052 | --- a/drivers/media/platform/davinci/vpbe.c |
4053 | +++ b/drivers/media/platform/davinci/vpbe.c |
4054 | @@ -740,7 +740,7 @@ static int vpbe_initialize(struct device *dev, struct vpbe_device *vpbe_dev) |
4055 | if (ret) { |
4056 | v4l2_err(&vpbe_dev->v4l2_dev, "Failed to set default output %s", |
4057 | def_output); |
4058 | - return ret; |
4059 | + goto fail_kfree_amp; |
4060 | } |
4061 | |
4062 | printk(KERN_NOTICE "Setting default mode to %s\n", def_mode); |
4063 | @@ -748,12 +748,15 @@ static int vpbe_initialize(struct device *dev, struct vpbe_device *vpbe_dev) |
4064 | if (ret) { |
4065 | v4l2_err(&vpbe_dev->v4l2_dev, "Failed to set default mode %s", |
4066 | def_mode); |
4067 | - return ret; |
4068 | + goto fail_kfree_amp; |
4069 | } |
4070 | vpbe_dev->initialized = 1; |
4071 | /* TBD handling of bootargs for default output and mode */ |
4072 | return 0; |
4073 | |
4074 | +fail_kfree_amp: |
4075 | + mutex_lock(&vpbe_dev->lock); |
4076 | + kfree(vpbe_dev->amp); |
4077 | fail_kfree_encoders: |
4078 | kfree(vpbe_dev->encoders); |
4079 | fail_dev_unregister: |
4080 | diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_pm.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_pm.c |
4081 | index 3e73e9db781f..7c025045ea90 100644 |
4082 | --- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_pm.c |
4083 | +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_pm.c |
4084 | @@ -41,25 +41,27 @@ int mtk_vcodec_init_enc_pm(struct mtk_vcodec_dev *mtkdev) |
4085 | node = of_parse_phandle(dev->of_node, "mediatek,larb", 0); |
4086 | if (!node) { |
4087 | mtk_v4l2_err("no mediatek,larb found"); |
4088 | - return -1; |
4089 | + return -ENODEV; |
4090 | } |
4091 | pdev = of_find_device_by_node(node); |
4092 | + of_node_put(node); |
4093 | if (!pdev) { |
4094 | mtk_v4l2_err("no mediatek,larb device found"); |
4095 | - return -1; |
4096 | + return -ENODEV; |
4097 | } |
4098 | pm->larbvenc = &pdev->dev; |
4099 | |
4100 | node = of_parse_phandle(dev->of_node, "mediatek,larb", 1); |
4101 | if (!node) { |
4102 | mtk_v4l2_err("no mediatek,larb found"); |
4103 | - return -1; |
4104 | + return -ENODEV; |
4105 | } |
4106 | |
4107 | pdev = of_find_device_by_node(node); |
4108 | + of_node_put(node); |
4109 | if (!pdev) { |
4110 | mtk_v4l2_err("no mediatek,larb device found"); |
4111 | - return -1; |
4112 | + return -ENODEV; |
4113 | } |
4114 | |
4115 | pm->larbvenclt = &pdev->dev; |
4116 | diff --git a/drivers/media/platform/vivid/vivid-core.c b/drivers/media/platform/vivid/vivid-core.c |
4117 | index 626e2b24a403..ec1b1a8ea775 100644 |
4118 | --- a/drivers/media/platform/vivid/vivid-core.c |
4119 | +++ b/drivers/media/platform/vivid/vivid-core.c |
4120 | @@ -669,6 +669,8 @@ static int vivid_create_instance(struct platform_device *pdev, int inst) |
4121 | |
4122 | /* Initialize media device */ |
4123 | strlcpy(dev->mdev.model, VIVID_MODULE_NAME, sizeof(dev->mdev.model)); |
4124 | + snprintf(dev->mdev.bus_info, sizeof(dev->mdev.bus_info), |
4125 | + "platform:%s-%03d", VIVID_MODULE_NAME, inst); |
4126 | dev->mdev.dev = &pdev->dev; |
4127 | media_device_init(&dev->mdev); |
4128 | dev->mdev.ops = &vivid_media_ops; |
4129 | diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c |
4130 | index 877978dbd409..66a174979b3c 100644 |
4131 | --- a/drivers/media/rc/rc-main.c |
4132 | +++ b/drivers/media/rc/rc-main.c |
4133 | @@ -1952,6 +1952,8 @@ void rc_unregister_device(struct rc_dev *dev) |
4134 | rc_free_rx_device(dev); |
4135 | |
4136 | mutex_lock(&dev->lock); |
4137 | + if (dev->users && dev->close) |
4138 | + dev->close(dev); |
4139 | dev->registered = false; |
4140 | mutex_unlock(&dev->lock); |
4141 | |
4142 | diff --git a/drivers/media/v4l2-core/v4l2-device.c b/drivers/media/v4l2-core/v4l2-device.c |
4143 | index df0ac38c4050..e0ddb9a52bd1 100644 |
4144 | --- a/drivers/media/v4l2-core/v4l2-device.c |
4145 | +++ b/drivers/media/v4l2-core/v4l2-device.c |
4146 | @@ -247,6 +247,7 @@ int v4l2_device_register_subdev_nodes(struct v4l2_device *v4l2_dev) |
4147 | |
4148 | video_set_drvdata(vdev, sd); |
4149 | strscpy(vdev->name, sd->name, sizeof(vdev->name)); |
4150 | + vdev->dev_parent = sd->dev; |
4151 | vdev->v4l2_dev = v4l2_dev; |
4152 | vdev->fops = &v4l2_subdev_fops; |
4153 | vdev->release = v4l2_device_release_subdev_node; |
4154 | diff --git a/drivers/memstick/core/memstick.c b/drivers/memstick/core/memstick.c |
4155 | index 76382c858c35..1246d69ba187 100644 |
4156 | --- a/drivers/memstick/core/memstick.c |
4157 | +++ b/drivers/memstick/core/memstick.c |
4158 | @@ -18,6 +18,7 @@ |
4159 | #include <linux/delay.h> |
4160 | #include <linux/slab.h> |
4161 | #include <linux/module.h> |
4162 | +#include <linux/pm_runtime.h> |
4163 | |
4164 | #define DRIVER_NAME "memstick" |
4165 | |
4166 | @@ -436,6 +437,7 @@ static void memstick_check(struct work_struct *work) |
4167 | struct memstick_dev *card; |
4168 | |
4169 | dev_dbg(&host->dev, "memstick_check started\n"); |
4170 | + pm_runtime_get_noresume(host->dev.parent); |
4171 | mutex_lock(&host->lock); |
4172 | if (!host->card) { |
4173 | if (memstick_power_on(host)) |
4174 | @@ -479,6 +481,7 @@ out_power_off: |
4175 | host->set_param(host, MEMSTICK_POWER, MEMSTICK_POWER_OFF); |
4176 | |
4177 | mutex_unlock(&host->lock); |
4178 | + pm_runtime_put(host->dev.parent); |
4179 | dev_dbg(&host->dev, "memstick_check finished\n"); |
4180 | } |
4181 | |
4182 | diff --git a/drivers/mmc/host/bcm2835.c b/drivers/mmc/host/bcm2835.c |
4183 | index 0d3b7473bc21..5301302fb531 100644 |
4184 | --- a/drivers/mmc/host/bcm2835.c |
4185 | +++ b/drivers/mmc/host/bcm2835.c |
4186 | @@ -286,6 +286,7 @@ static void bcm2835_reset(struct mmc_host *mmc) |
4187 | |
4188 | if (host->dma_chan) |
4189 | dmaengine_terminate_sync(host->dma_chan); |
4190 | + host->dma_chan = NULL; |
4191 | bcm2835_reset_internal(host); |
4192 | } |
4193 | |
4194 | @@ -772,6 +773,8 @@ static void bcm2835_finish_command(struct bcm2835_host *host) |
4195 | |
4196 | if (!(sdhsts & SDHSTS_CRC7_ERROR) || |
4197 | (host->cmd->opcode != MMC_SEND_OP_COND)) { |
4198 | + u32 edm, fsm; |
4199 | + |
4200 | if (sdhsts & SDHSTS_CMD_TIME_OUT) { |
4201 | host->cmd->error = -ETIMEDOUT; |
4202 | } else { |
4203 | @@ -780,6 +783,13 @@ static void bcm2835_finish_command(struct bcm2835_host *host) |
4204 | bcm2835_dumpregs(host); |
4205 | host->cmd->error = -EILSEQ; |
4206 | } |
4207 | + edm = readl(host->ioaddr + SDEDM); |
4208 | + fsm = edm & SDEDM_FSM_MASK; |
4209 | + if (fsm == SDEDM_FSM_READWAIT || |
4210 | + fsm == SDEDM_FSM_WRITESTART1) |
4211 | + /* Kick the FSM out of its wait */ |
4212 | + writel(edm | SDEDM_FORCE_DATA_MODE, |
4213 | + host->ioaddr + SDEDM); |
4214 | bcm2835_finish_request(host); |
4215 | return; |
4216 | } |
4217 | @@ -837,6 +847,8 @@ static void bcm2835_timeout(struct work_struct *work) |
4218 | dev_err(dev, "timeout waiting for hardware interrupt.\n"); |
4219 | bcm2835_dumpregs(host); |
4220 | |
4221 | + bcm2835_reset(host->mmc); |
4222 | + |
4223 | if (host->data) { |
4224 | host->data->error = -ETIMEDOUT; |
4225 | bcm2835_finish_data(host); |
4226 | diff --git a/drivers/mmc/host/jz4740_mmc.c b/drivers/mmc/host/jz4740_mmc.c |
4227 | index 0c1efd5100b7..44ea452add8e 100644 |
4228 | --- a/drivers/mmc/host/jz4740_mmc.c |
4229 | +++ b/drivers/mmc/host/jz4740_mmc.c |
4230 | @@ -983,17 +983,17 @@ static int jz4740_mmc_request_gpios(struct mmc_host *mmc, |
4231 | if (!pdata->read_only_active_low) |
4232 | mmc->caps2 |= MMC_CAP2_RO_ACTIVE_HIGH; |
4233 | |
4234 | - if (gpio_is_valid(pdata->gpio_card_detect)) { |
4235 | - ret = mmc_gpio_request_cd(mmc, pdata->gpio_card_detect, 0); |
4236 | - if (ret) |
4237 | - return ret; |
4238 | - } |
4239 | + /* |
4240 | + * Get optional card detect and write protect GPIOs, |
4241 | + * only back out on probe deferral. |
4242 | + */ |
4243 | + ret = mmc_gpiod_request_cd(mmc, "cd", 0, false, 0, NULL); |
4244 | + if (ret == -EPROBE_DEFER) |
4245 | + return ret; |
4246 | |
4247 | - if (gpio_is_valid(pdata->gpio_read_only)) { |
4248 | - ret = mmc_gpio_request_ro(mmc, pdata->gpio_read_only); |
4249 | - if (ret) |
4250 | - return ret; |
4251 | - } |
4252 | + ret = mmc_gpiod_request_ro(mmc, "wp", 0, false, 0, NULL); |
4253 | + if (ret == -EPROBE_DEFER) |
4254 | + return ret; |
4255 | |
4256 | return jz4740_mmc_request_gpio(&pdev->dev, pdata->gpio_power, |
4257 | "MMC read only", true, pdata->power_active_low); |
4258 | diff --git a/drivers/mmc/host/meson-mx-sdio.c b/drivers/mmc/host/meson-mx-sdio.c |
4259 | index abe253c262a2..ec980bda071c 100644 |
4260 | --- a/drivers/mmc/host/meson-mx-sdio.c |
4261 | +++ b/drivers/mmc/host/meson-mx-sdio.c |
4262 | @@ -596,6 +596,9 @@ static int meson_mx_mmc_register_clks(struct meson_mx_mmc_host *host) |
4263 | init.name = devm_kasprintf(host->controller_dev, GFP_KERNEL, |
4264 | "%s#fixed_factor", |
4265 | dev_name(host->controller_dev)); |
4266 | + if (!init.name) |
4267 | + return -ENOMEM; |
4268 | + |
4269 | init.ops = &clk_fixed_factor_ops; |
4270 | init.flags = 0; |
4271 | init.parent_names = &clk_fixed_factor_parent; |
4272 | @@ -612,6 +615,9 @@ static int meson_mx_mmc_register_clks(struct meson_mx_mmc_host *host) |
4273 | clk_div_parent = __clk_get_name(host->fixed_factor_clk); |
4274 | init.name = devm_kasprintf(host->controller_dev, GFP_KERNEL, |
4275 | "%s#div", dev_name(host->controller_dev)); |
4276 | + if (!init.name) |
4277 | + return -ENOMEM; |
4278 | + |
4279 | init.ops = &clk_divider_ops; |
4280 | init.flags = CLK_SET_RATE_PARENT; |
4281 | init.parent_names = &clk_div_parent; |
4282 | diff --git a/drivers/mmc/host/sdhci-of-esdhc.c b/drivers/mmc/host/sdhci-of-esdhc.c |
4283 | index 86fc9f022002..d111bf62acd9 100644 |
4284 | --- a/drivers/mmc/host/sdhci-of-esdhc.c |
4285 | +++ b/drivers/mmc/host/sdhci-of-esdhc.c |
4286 | @@ -528,8 +528,12 @@ static void esdhc_clock_enable(struct sdhci_host *host, bool enable) |
4287 | /* Wait max 20 ms */ |
4288 | timeout = ktime_add_ms(ktime_get(), 20); |
4289 | val = ESDHC_CLOCK_STABLE; |
4290 | - while (!(sdhci_readl(host, ESDHC_PRSSTAT) & val)) { |
4291 | - if (ktime_after(ktime_get(), timeout)) { |
4292 | + while (1) { |
4293 | + bool timedout = ktime_after(ktime_get(), timeout); |
4294 | + |
4295 | + if (sdhci_readl(host, ESDHC_PRSSTAT) & val) |
4296 | + break; |
4297 | + if (timedout) { |
4298 | pr_err("%s: Internal clock never stabilised.\n", |
4299 | mmc_hostname(host->mmc)); |
4300 | break; |
4301 | @@ -594,8 +598,12 @@ static void esdhc_of_set_clock(struct sdhci_host *host, unsigned int clock) |
4302 | |
4303 | /* Wait max 20 ms */ |
4304 | timeout = ktime_add_ms(ktime_get(), 20); |
4305 | - while (!(sdhci_readl(host, ESDHC_PRSSTAT) & ESDHC_CLOCK_STABLE)) { |
4306 | - if (ktime_after(ktime_get(), timeout)) { |
4307 | + while (1) { |
4308 | + bool timedout = ktime_after(ktime_get(), timeout); |
4309 | + |
4310 | + if (sdhci_readl(host, ESDHC_PRSSTAT) & ESDHC_CLOCK_STABLE) |
4311 | + break; |
4312 | + if (timedout) { |
4313 | pr_err("%s: Internal clock never stabilised.\n", |
4314 | mmc_hostname(host->mmc)); |
4315 | return; |
4316 | diff --git a/drivers/mmc/host/sdhci-omap.c b/drivers/mmc/host/sdhci-omap.c |
4317 | index d264391616f9..d02f5cf76b3d 100644 |
4318 | --- a/drivers/mmc/host/sdhci-omap.c |
4319 | +++ b/drivers/mmc/host/sdhci-omap.c |
4320 | @@ -220,8 +220,12 @@ static void sdhci_omap_conf_bus_power(struct sdhci_omap_host *omap_host, |
4321 | |
4322 | /* wait 1ms */ |
4323 | timeout = ktime_add_ms(ktime_get(), SDHCI_OMAP_TIMEOUT); |
4324 | - while (!(sdhci_omap_readl(omap_host, SDHCI_OMAP_HCTL) & HCTL_SDBP)) { |
4325 | - if (WARN_ON(ktime_after(ktime_get(), timeout))) |
4326 | + while (1) { |
4327 | + bool timedout = ktime_after(ktime_get(), timeout); |
4328 | + |
4329 | + if (sdhci_omap_readl(omap_host, SDHCI_OMAP_HCTL) & HCTL_SDBP) |
4330 | + break; |
4331 | + if (WARN_ON(timedout)) |
4332 | return; |
4333 | usleep_range(5, 10); |
4334 | } |
4335 | @@ -653,8 +657,12 @@ static void sdhci_omap_init_74_clocks(struct sdhci_host *host, u8 power_mode) |
4336 | |
4337 | /* wait 1ms */ |
4338 | timeout = ktime_add_ms(ktime_get(), SDHCI_OMAP_TIMEOUT); |
4339 | - while (!(sdhci_omap_readl(omap_host, SDHCI_OMAP_STAT) & INT_CC_EN)) { |
4340 | - if (WARN_ON(ktime_after(ktime_get(), timeout))) |
4341 | + while (1) { |
4342 | + bool timedout = ktime_after(ktime_get(), timeout); |
4343 | + |
4344 | + if (sdhci_omap_readl(omap_host, SDHCI_OMAP_STAT) & INT_CC_EN) |
4345 | + break; |
4346 | + if (WARN_ON(timedout)) |
4347 | return; |
4348 | usleep_range(5, 10); |
4349 | } |
4350 | diff --git a/drivers/mmc/host/sdhci-xenon-phy.c b/drivers/mmc/host/sdhci-xenon-phy.c |
4351 | index 5956e90380e8..5b5eb53a63d2 100644 |
4352 | --- a/drivers/mmc/host/sdhci-xenon-phy.c |
4353 | +++ b/drivers/mmc/host/sdhci-xenon-phy.c |
4354 | @@ -357,9 +357,13 @@ static int xenon_emmc_phy_enable_dll(struct sdhci_host *host) |
4355 | |
4356 | /* Wait max 32 ms */ |
4357 | timeout = ktime_add_ms(ktime_get(), 32); |
4358 | - while (!(sdhci_readw(host, XENON_SLOT_EXT_PRESENT_STATE) & |
4359 | - XENON_DLL_LOCK_STATE)) { |
4360 | - if (ktime_after(ktime_get(), timeout)) { |
4361 | + while (1) { |
4362 | + bool timedout = ktime_after(ktime_get(), timeout); |
4363 | + |
4364 | + if (sdhci_readw(host, XENON_SLOT_EXT_PRESENT_STATE) & |
4365 | + XENON_DLL_LOCK_STATE) |
4366 | + break; |
4367 | + if (timedout) { |
4368 | dev_err(mmc_dev(host->mmc), "Wait for DLL Lock time-out\n"); |
4369 | return -ETIMEDOUT; |
4370 | } |
4371 | diff --git a/drivers/mmc/host/sdhci-xenon.c b/drivers/mmc/host/sdhci-xenon.c |
4372 | index 4d0791f6ec23..a0b5089b3274 100644 |
4373 | --- a/drivers/mmc/host/sdhci-xenon.c |
4374 | +++ b/drivers/mmc/host/sdhci-xenon.c |
4375 | @@ -34,9 +34,13 @@ static int xenon_enable_internal_clk(struct sdhci_host *host) |
4376 | sdhci_writel(host, reg, SDHCI_CLOCK_CONTROL); |
4377 | /* Wait max 20 ms */ |
4378 | timeout = ktime_add_ms(ktime_get(), 20); |
4379 | - while (!((reg = sdhci_readw(host, SDHCI_CLOCK_CONTROL)) |
4380 | - & SDHCI_CLOCK_INT_STABLE)) { |
4381 | - if (ktime_after(ktime_get(), timeout)) { |
4382 | + while (1) { |
4383 | + bool timedout = ktime_after(ktime_get(), timeout); |
4384 | + |
4385 | + reg = sdhci_readw(host, SDHCI_CLOCK_CONTROL); |
4386 | + if (reg & SDHCI_CLOCK_INT_STABLE) |
4387 | + break; |
4388 | + if (timedout) { |
4389 | dev_err(mmc_dev(host->mmc), "Internal clock never stabilised.\n"); |
4390 | return -ETIMEDOUT; |
4391 | } |
4392 | diff --git a/drivers/net/dsa/b53/b53_srab.c b/drivers/net/dsa/b53/b53_srab.c |
4393 | index 90f514252987..d9c56a779c08 100644 |
4394 | --- a/drivers/net/dsa/b53/b53_srab.c |
4395 | +++ b/drivers/net/dsa/b53/b53_srab.c |
4396 | @@ -511,9 +511,6 @@ static void b53_srab_prepare_irq(struct platform_device *pdev) |
4397 | /* Clear all pending interrupts */ |
4398 | writel(0xffffffff, priv->regs + B53_SRAB_INTR); |
4399 | |
4400 | - if (dev->pdata && dev->pdata->chip_id != BCM58XX_DEVICE_ID) |
4401 | - return; |
4402 | - |
4403 | for (i = 0; i < B53_N_PORTS; i++) { |
4404 | port = &priv->port_intrs[i]; |
4405 | |
4406 | diff --git a/drivers/net/dsa/mv88e6xxx/global1_atu.c b/drivers/net/dsa/mv88e6xxx/global1_atu.c |
4407 | index 5200e4bdce93..ea243840ee0f 100644 |
4408 | --- a/drivers/net/dsa/mv88e6xxx/global1_atu.c |
4409 | +++ b/drivers/net/dsa/mv88e6xxx/global1_atu.c |
4410 | @@ -314,6 +314,7 @@ static irqreturn_t mv88e6xxx_g1_atu_prob_irq_thread_fn(int irq, void *dev_id) |
4411 | { |
4412 | struct mv88e6xxx_chip *chip = dev_id; |
4413 | struct mv88e6xxx_atu_entry entry; |
4414 | + int spid; |
4415 | int err; |
4416 | u16 val; |
4417 | |
4418 | @@ -336,6 +337,8 @@ static irqreturn_t mv88e6xxx_g1_atu_prob_irq_thread_fn(int irq, void *dev_id) |
4419 | if (err) |
4420 | goto out; |
4421 | |
4422 | + spid = entry.state; |
4423 | + |
4424 | if (val & MV88E6XXX_G1_ATU_OP_AGE_OUT_VIOLATION) { |
4425 | dev_err_ratelimited(chip->dev, |
4426 | "ATU age out violation for %pM\n", |
4427 | @@ -344,23 +347,23 @@ static irqreturn_t mv88e6xxx_g1_atu_prob_irq_thread_fn(int irq, void *dev_id) |
4428 | |
4429 | if (val & MV88E6XXX_G1_ATU_OP_MEMBER_VIOLATION) { |
4430 | dev_err_ratelimited(chip->dev, |
4431 | - "ATU member violation for %pM portvec %x\n", |
4432 | - entry.mac, entry.portvec); |
4433 | - chip->ports[entry.portvec].atu_member_violation++; |
4434 | + "ATU member violation for %pM portvec %x spid %d\n", |
4435 | + entry.mac, entry.portvec, spid); |
4436 | + chip->ports[spid].atu_member_violation++; |
4437 | } |
4438 | |
4439 | if (val & MV88E6XXX_G1_ATU_OP_MISS_VIOLATION) { |
4440 | dev_err_ratelimited(chip->dev, |
4441 | - "ATU miss violation for %pM portvec %x\n", |
4442 | - entry.mac, entry.portvec); |
4443 | - chip->ports[entry.portvec].atu_miss_violation++; |
4444 | + "ATU miss violation for %pM portvec %x spid %d\n", |
4445 | + entry.mac, entry.portvec, spid); |
4446 | + chip->ports[spid].atu_miss_violation++; |
4447 | } |
4448 | |
4449 | if (val & MV88E6XXX_G1_ATU_OP_FULL_VIOLATION) { |
4450 | dev_err_ratelimited(chip->dev, |
4451 | - "ATU full violation for %pM portvec %x\n", |
4452 | - entry.mac, entry.portvec); |
4453 | - chip->ports[entry.portvec].atu_full_violation++; |
4454 | + "ATU full violation for %pM portvec %x spid %d\n", |
4455 | + entry.mac, entry.portvec, spid); |
4456 | + chip->ports[spid].atu_full_violation++; |
4457 | } |
4458 | mutex_unlock(&chip->reg_lock); |
4459 | |
4460 | diff --git a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c |
4461 | index 7def1cb8ab9d..22cbf8dc6fa9 100644 |
4462 | --- a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c |
4463 | +++ b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c |
4464 | @@ -263,6 +263,8 @@ int hw_atl_utils_soft_reset(struct aq_hw_s *self) |
4465 | AQ_HW_WAIT_FOR((aq_hw_read_reg(self, HW_ATL_MPI_STATE_ADR) & |
4466 | HW_ATL_MPI_STATE_MSK) == MPI_DEINIT, |
4467 | 10, 1000U); |
4468 | + if (err) |
4469 | + return err; |
4470 | } |
4471 | |
4472 | if (self->rbl_enabled) |
4473 | diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c |
4474 | index 0e2d99c737e3..baa109040b40 100644 |
4475 | --- a/drivers/net/ethernet/broadcom/bcmsysport.c |
4476 | +++ b/drivers/net/ethernet/broadcom/bcmsysport.c |
4477 | @@ -520,7 +520,6 @@ static void bcm_sysport_get_wol(struct net_device *dev, |
4478 | struct ethtool_wolinfo *wol) |
4479 | { |
4480 | struct bcm_sysport_priv *priv = netdev_priv(dev); |
4481 | - u32 reg; |
4482 | |
4483 | wol->supported = WAKE_MAGIC | WAKE_MAGICSECURE | WAKE_FILTER; |
4484 | wol->wolopts = priv->wolopts; |
4485 | @@ -528,11 +527,7 @@ static void bcm_sysport_get_wol(struct net_device *dev, |
4486 | if (!(priv->wolopts & WAKE_MAGICSECURE)) |
4487 | return; |
4488 | |
4489 | - /* Return the programmed SecureOn password */ |
4490 | - reg = umac_readl(priv, UMAC_PSW_MS); |
4491 | - put_unaligned_be16(reg, &wol->sopass[0]); |
4492 | - reg = umac_readl(priv, UMAC_PSW_LS); |
4493 | - put_unaligned_be32(reg, &wol->sopass[2]); |
4494 | + memcpy(wol->sopass, priv->sopass, sizeof(priv->sopass)); |
4495 | } |
4496 | |
4497 | static int bcm_sysport_set_wol(struct net_device *dev, |
4498 | @@ -548,13 +543,8 @@ static int bcm_sysport_set_wol(struct net_device *dev, |
4499 | if (wol->wolopts & ~supported) |
4500 | return -EINVAL; |
4501 | |
4502 | - /* Program the SecureOn password */ |
4503 | - if (wol->wolopts & WAKE_MAGICSECURE) { |
4504 | - umac_writel(priv, get_unaligned_be16(&wol->sopass[0]), |
4505 | - UMAC_PSW_MS); |
4506 | - umac_writel(priv, get_unaligned_be32(&wol->sopass[2]), |
4507 | - UMAC_PSW_LS); |
4508 | - } |
4509 | + if (wol->wolopts & WAKE_MAGICSECURE) |
4510 | + memcpy(priv->sopass, wol->sopass, sizeof(priv->sopass)); |
4511 | |
4512 | /* Flag the device and relevant IRQ as wakeup capable */ |
4513 | if (wol->wolopts) { |
4514 | @@ -2592,13 +2582,18 @@ static int bcm_sysport_suspend_to_wol(struct bcm_sysport_priv *priv) |
4515 | unsigned int index, i = 0; |
4516 | u32 reg; |
4517 | |
4518 | - /* Password has already been programmed */ |
4519 | reg = umac_readl(priv, UMAC_MPD_CTRL); |
4520 | if (priv->wolopts & (WAKE_MAGIC | WAKE_MAGICSECURE)) |
4521 | reg |= MPD_EN; |
4522 | reg &= ~PSW_EN; |
4523 | - if (priv->wolopts & WAKE_MAGICSECURE) |
4524 | + if (priv->wolopts & WAKE_MAGICSECURE) { |
4525 | + /* Program the SecureOn password */ |
4526 | + umac_writel(priv, get_unaligned_be16(&priv->sopass[0]), |
4527 | + UMAC_PSW_MS); |
4528 | + umac_writel(priv, get_unaligned_be32(&priv->sopass[2]), |
4529 | + UMAC_PSW_LS); |
4530 | reg |= PSW_EN; |
4531 | + } |
4532 | umac_writel(priv, reg, UMAC_MPD_CTRL); |
4533 | |
4534 | if (priv->wolopts & WAKE_FILTER) { |
4535 | diff --git a/drivers/net/ethernet/broadcom/bcmsysport.h b/drivers/net/ethernet/broadcom/bcmsysport.h |
4536 | index a7a230884a87..930ab8de3f45 100644 |
4537 | --- a/drivers/net/ethernet/broadcom/bcmsysport.h |
4538 | +++ b/drivers/net/ethernet/broadcom/bcmsysport.h |
4539 | @@ -12,6 +12,7 @@ |
4540 | #define __BCM_SYSPORT_H |
4541 | |
4542 | #include <linux/bitmap.h> |
4543 | +#include <linux/ethtool.h> |
4544 | #include <linux/if_vlan.h> |
4545 | #include <linux/net_dim.h> |
4546 | |
4547 | @@ -778,6 +779,7 @@ struct bcm_sysport_priv { |
4548 | unsigned int crc_fwd:1; |
4549 | u16 rev; |
4550 | u32 wolopts; |
4551 | + u8 sopass[SOPASS_MAX]; |
4552 | unsigned int wol_irq_disabled:1; |
4553 | |
4554 | /* MIB related fields */ |
4555 | diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c |
4556 | index 5d21c14853ac..090207817ad8 100644 |
4557 | --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c |
4558 | +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c |
4559 | @@ -4903,12 +4903,18 @@ static int bnxt_hwrm_ring_alloc(struct bnxt *bp) |
4560 | struct bnxt_cp_ring_info *cpr = &bnapi->cp_ring; |
4561 | struct bnxt_ring_struct *ring = &cpr->cp_ring_struct; |
4562 | u32 map_idx = ring->map_idx; |
4563 | + unsigned int vector; |
4564 | |
4565 | + vector = bp->irq_tbl[map_idx].vector; |
4566 | + disable_irq_nosync(vector); |
4567 | rc = hwrm_ring_alloc_send_msg(bp, ring, type, map_idx); |
4568 | - if (rc) |
4569 | + if (rc) { |
4570 | + enable_irq(vector); |
4571 | goto err_out; |
4572 | + } |
4573 | bnxt_set_db(bp, &cpr->cp_db, type, map_idx, ring->fw_ring_id); |
4574 | bnxt_db_nq(bp, &cpr->cp_db, cpr->cp_raw_cons); |
4575 | + enable_irq(vector); |
4576 | bp->grp_info[i].cp_fw_ring_id = ring->fw_ring_id; |
4577 | |
4578 | if (!i) { |
4579 | @@ -7203,23 +7209,26 @@ static void bnxt_clear_int_mode(struct bnxt *bp) |
4580 | int bnxt_reserve_rings(struct bnxt *bp) |
4581 | { |
4582 | int tcs = netdev_get_num_tc(bp->dev); |
4583 | + bool reinit_irq = false; |
4584 | int rc; |
4585 | |
4586 | if (!bnxt_need_reserve_rings(bp)) |
4587 | return 0; |
4588 | |
4589 | - rc = __bnxt_reserve_rings(bp); |
4590 | - if (rc) { |
4591 | - netdev_err(bp->dev, "ring reservation failure rc: %d\n", rc); |
4592 | - return rc; |
4593 | - } |
4594 | if (BNXT_NEW_RM(bp) && (bnxt_get_num_msix(bp) != bp->total_irqs)) { |
4595 | bnxt_ulp_irq_stop(bp); |
4596 | bnxt_clear_int_mode(bp); |
4597 | - rc = bnxt_init_int_mode(bp); |
4598 | + reinit_irq = true; |
4599 | + } |
4600 | + rc = __bnxt_reserve_rings(bp); |
4601 | + if (reinit_irq) { |
4602 | + if (!rc) |
4603 | + rc = bnxt_init_int_mode(bp); |
4604 | bnxt_ulp_irq_restart(bp, rc); |
4605 | - if (rc) |
4606 | - return rc; |
4607 | + } |
4608 | + if (rc) { |
4609 | + netdev_err(bp->dev, "ring reservation/IRQ init failure rc: %d\n", rc); |
4610 | + return rc; |
4611 | } |
4612 | if (tcs && (bp->tx_nr_rings_per_tc * tcs != bp->tx_nr_rings)) { |
4613 | netdev_err(bp->dev, "tx ring reservation failure\n"); |
4614 | diff --git a/drivers/net/ethernet/cisco/enic/enic_main.c b/drivers/net/ethernet/cisco/enic/enic_main.c |
4615 | index 60641e202534..9a7f70db20c7 100644 |
4616 | --- a/drivers/net/ethernet/cisco/enic/enic_main.c |
4617 | +++ b/drivers/net/ethernet/cisco/enic/enic_main.c |
4618 | @@ -1434,7 +1434,8 @@ static void enic_rq_indicate_buf(struct vnic_rq *rq, |
4619 | * csum is correct or is zero. |
4620 | */ |
4621 | if ((netdev->features & NETIF_F_RXCSUM) && !csum_not_calc && |
4622 | - tcp_udp_csum_ok && ipv4_csum_ok && outer_csum_ok) { |
4623 | + tcp_udp_csum_ok && outer_csum_ok && |
4624 | + (ipv4_csum_ok || ipv6)) { |
4625 | skb->ip_summed = CHECKSUM_UNNECESSARY; |
4626 | skb->csum_level = encap; |
4627 | } |
4628 | diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-ptp.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-ptp.c |
4629 | index 84b942b1eccc..9b150db3b510 100644 |
4630 | --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-ptp.c |
4631 | +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-ptp.c |
4632 | @@ -140,7 +140,10 @@ static int dpaa2_ptp_probe(struct fsl_mc_device *mc_dev) |
4633 | |
4634 | err = fsl_mc_portal_allocate(mc_dev, 0, &mc_dev->mc_io); |
4635 | if (err) { |
4636 | - dev_err(dev, "fsl_mc_portal_allocate err %d\n", err); |
4637 | + if (err == -ENXIO) |
4638 | + err = -EPROBE_DEFER; |
4639 | + else |
4640 | + dev_err(dev, "fsl_mc_portal_allocate err %d\n", err); |
4641 | goto err_exit; |
4642 | } |
4643 | |
4644 | diff --git a/drivers/net/ethernet/freescale/fman/fman_memac.c b/drivers/net/ethernet/freescale/fman/fman_memac.c |
4645 | index bc6eb30aa20f..41c6fa200e74 100644 |
4646 | --- a/drivers/net/ethernet/freescale/fman/fman_memac.c |
4647 | +++ b/drivers/net/ethernet/freescale/fman/fman_memac.c |
4648 | @@ -928,7 +928,7 @@ int memac_add_hash_mac_address(struct fman_mac *memac, enet_addr_t *eth_addr) |
4649 | hash = get_mac_addr_hash_code(addr) & HASH_CTRL_ADDR_MASK; |
4650 | |
4651 | /* Create element to be added to the driver hash table */ |
4652 | - hash_entry = kmalloc(sizeof(*hash_entry), GFP_KERNEL); |
4653 | + hash_entry = kmalloc(sizeof(*hash_entry), GFP_ATOMIC); |
4654 | if (!hash_entry) |
4655 | return -ENOMEM; |
4656 | hash_entry->addr = addr; |
4657 | diff --git a/drivers/net/ethernet/freescale/fman/fman_tgec.c b/drivers/net/ethernet/freescale/fman/fman_tgec.c |
4658 | index 40705938eecc..f75b9c11b2d2 100644 |
4659 | --- a/drivers/net/ethernet/freescale/fman/fman_tgec.c |
4660 | +++ b/drivers/net/ethernet/freescale/fman/fman_tgec.c |
4661 | @@ -553,7 +553,7 @@ int tgec_add_hash_mac_address(struct fman_mac *tgec, enet_addr_t *eth_addr) |
4662 | hash = (crc >> TGEC_HASH_MCAST_SHIFT) & TGEC_HASH_ADR_MSK; |
4663 | |
4664 | /* Create element to be added to the driver hash table */ |
4665 | - hash_entry = kmalloc(sizeof(*hash_entry), GFP_KERNEL); |
4666 | + hash_entry = kmalloc(sizeof(*hash_entry), GFP_ATOMIC); |
4667 | if (!hash_entry) |
4668 | return -ENOMEM; |
4669 | hash_entry->addr = addr; |
4670 | diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c |
4671 | index 20fcf0d1c2ce..d424d5bc0507 100644 |
4672 | --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c |
4673 | +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c |
4674 | @@ -2332,9 +2332,16 @@ static bool hns3_parse_vlan_tag(struct hns3_enet_ring *ring, |
4675 | static void hns3_set_rx_skb_rss_type(struct hns3_enet_ring *ring, |
4676 | struct sk_buff *skb) |
4677 | { |
4678 | - struct hns3_desc *desc = &ring->desc[ring->next_to_clean]; |
4679 | struct hnae3_handle *handle = ring->tqp->handle; |
4680 | enum pkt_hash_types rss_type; |
4681 | + struct hns3_desc *desc; |
4682 | + int last_bd; |
4683 | + |
4684 | + /* When driver handle the rss type, ring->next_to_clean indicates the |
4685 | + * first descriptor of next packet, need -1 here. |
4686 | + */ |
4687 | + last_bd = (ring->next_to_clean - 1 + ring->desc_num) % ring->desc_num; |
4688 | + desc = &ring->desc[last_bd]; |
4689 | |
4690 | if (le32_to_cpu(desc->rx.rss_hash)) |
4691 | rss_type = handle->kinfo.rss_type; |
4692 | @@ -2783,9 +2790,10 @@ err_free_chain: |
4693 | cur_chain = head->next; |
4694 | while (cur_chain) { |
4695 | chain = cur_chain->next; |
4696 | - devm_kfree(&pdev->dev, chain); |
4697 | + devm_kfree(&pdev->dev, cur_chain); |
4698 | cur_chain = chain; |
4699 | } |
4700 | + head->next = NULL; |
4701 | |
4702 | return -ENOMEM; |
4703 | } |
4704 | @@ -2876,7 +2884,7 @@ static int hns3_nic_init_vector_data(struct hns3_nic_priv *priv) |
4705 | ret = hns3_get_vector_ring_chain(tqp_vector, |
4706 | &vector_ring_chain); |
4707 | if (ret) |
4708 | - return ret; |
4709 | + goto map_ring_fail; |
4710 | |
4711 | ret = h->ae_algo->ops->map_ring_to_vector(h, |
4712 | tqp_vector->vector_irq, &vector_ring_chain); |
4713 | @@ -2901,6 +2909,8 @@ map_ring_fail: |
4714 | |
4715 | static int hns3_nic_alloc_vector_data(struct hns3_nic_priv *priv) |
4716 | { |
4717 | +#define HNS3_VECTOR_PF_MAX_NUM 64 |
4718 | + |
4719 | struct hnae3_handle *h = priv->ae_handle; |
4720 | struct hns3_enet_tqp_vector *tqp_vector; |
4721 | struct hnae3_vector_info *vector; |
4722 | @@ -2913,6 +2923,8 @@ static int hns3_nic_alloc_vector_data(struct hns3_nic_priv *priv) |
4723 | /* RSS size, cpu online and vector_num should be the same */ |
4724 | /* Should consider 2p/4p later */ |
4725 | vector_num = min_t(u16, num_online_cpus(), tqp_num); |
4726 | + vector_num = min_t(u16, vector_num, HNS3_VECTOR_PF_MAX_NUM); |
4727 | + |
4728 | vector = devm_kcalloc(&pdev->dev, vector_num, sizeof(*vector), |
4729 | GFP_KERNEL); |
4730 | if (!vector) |
4731 | @@ -2970,12 +2982,12 @@ static int hns3_nic_uninit_vector_data(struct hns3_nic_priv *priv) |
4732 | |
4733 | hns3_free_vector_ring_chain(tqp_vector, &vector_ring_chain); |
4734 | |
4735 | - if (priv->tqp_vector[i].irq_init_flag == HNS3_VECTOR_INITED) { |
4736 | - (void)irq_set_affinity_hint( |
4737 | - priv->tqp_vector[i].vector_irq, |
4738 | - NULL); |
4739 | - free_irq(priv->tqp_vector[i].vector_irq, |
4740 | - &priv->tqp_vector[i]); |
4741 | + if (tqp_vector->irq_init_flag == HNS3_VECTOR_INITED) { |
4742 | + irq_set_affinity_notifier(tqp_vector->vector_irq, |
4743 | + NULL); |
4744 | + irq_set_affinity_hint(tqp_vector->vector_irq, NULL); |
4745 | + free_irq(tqp_vector->vector_irq, tqp_vector); |
4746 | + tqp_vector->irq_init_flag = HNS3_VECTOR_NOT_INITED; |
4747 | } |
4748 | |
4749 | priv->ring_data[i].ring->irq_init_flag = HNS3_VECTOR_NOT_INITED; |
4750 | diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c |
4751 | index ffdd96020860..a7895aefe291 100644 |
4752 | --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c |
4753 | +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c |
4754 | @@ -4339,6 +4339,10 @@ static int hclge_restore_fd_entries(struct hnae3_handle *handle) |
4755 | if (!hnae3_dev_fd_supported(hdev)) |
4756 | return -EOPNOTSUPP; |
4757 | |
4758 | + /* if fd is disabled, should not restore it when reset */ |
4759 | + if (!hdev->fd_cfg.fd_en) |
4760 | + return 0; |
4761 | + |
4762 | hlist_for_each_entry_safe(rule, node, &hdev->fd_rule_list, rule_node) { |
4763 | ret = hclge_config_action(hdev, HCLGE_FD_STAGE_1, rule); |
4764 | if (!ret) |
4765 | diff --git a/drivers/net/ethernet/intel/i40e/i40e.h b/drivers/net/ethernet/intel/i40e/i40e.h |
4766 | index 876cac317e79..8245ff12fd64 100644 |
4767 | --- a/drivers/net/ethernet/intel/i40e/i40e.h |
4768 | +++ b/drivers/net/ethernet/intel/i40e/i40e.h |
4769 | @@ -122,6 +122,7 @@ enum i40e_state_t { |
4770 | __I40E_MDD_EVENT_PENDING, |
4771 | __I40E_VFLR_EVENT_PENDING, |
4772 | __I40E_RESET_RECOVERY_PENDING, |
4773 | + __I40E_TIMEOUT_RECOVERY_PENDING, |
4774 | __I40E_MISC_IRQ_REQUESTED, |
4775 | __I40E_RESET_INTR_RECEIVED, |
4776 | __I40E_REINIT_REQUESTED, |
4777 | diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c |
4778 | index 0e5dc74b4ef2..f97c3d5ab884 100644 |
4779 | --- a/drivers/net/ethernet/intel/i40e/i40e_main.c |
4780 | +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c |
4781 | @@ -338,6 +338,10 @@ static void i40e_tx_timeout(struct net_device *netdev) |
4782 | (pf->tx_timeout_last_recovery + netdev->watchdog_timeo))) |
4783 | return; /* don't do any new action before the next timeout */ |
4784 | |
4785 | + /* don't kick off another recovery if one is already pending */ |
4786 | + if (test_and_set_bit(__I40E_TIMEOUT_RECOVERY_PENDING, pf->state)) |
4787 | + return; |
4788 | + |
4789 | if (tx_ring) { |
4790 | head = i40e_get_head(tx_ring); |
4791 | /* Read interrupt register */ |
4792 | @@ -9632,6 +9636,7 @@ end_core_reset: |
4793 | clear_bit(__I40E_RESET_FAILED, pf->state); |
4794 | clear_recovery: |
4795 | clear_bit(__I40E_RESET_RECOVERY_PENDING, pf->state); |
4796 | + clear_bit(__I40E_TIMEOUT_RECOVERY_PENDING, pf->state); |
4797 | } |
4798 | |
4799 | /** |
4800 | @@ -12334,6 +12339,9 @@ static int i40e_config_netdev(struct i40e_vsi *vsi) |
4801 | ether_addr_copy(netdev->dev_addr, mac_addr); |
4802 | ether_addr_copy(netdev->perm_addr, mac_addr); |
4803 | |
4804 | + /* i40iw_net_event() reads 16 bytes from neigh->primary_key */ |
4805 | + netdev->neigh_priv_len = sizeof(u32) * 4; |
4806 | + |
4807 | netdev->priv_flags |= IFF_UNICAST_FLT; |
4808 | netdev->priv_flags |= IFF_SUPP_NOFCS; |
4809 | /* Setup netdev TC information */ |
4810 | diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c |
4811 | index ac5698ed0b11..c41e8ada23d1 100644 |
4812 | --- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c |
4813 | +++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c |
4814 | @@ -1112,7 +1112,8 @@ static i40e_status i40e_config_vf_promiscuous_mode(struct i40e_vf *vf, |
4815 | if (!i40e_vc_isvalid_vsi_id(vf, vsi_id) || !vsi) |
4816 | return I40E_ERR_PARAM; |
4817 | |
4818 | - if (!test_bit(I40E_VIRTCHNL_VF_CAP_PRIVILEGE, &vf->vf_caps)) { |
4819 | + if (!test_bit(I40E_VIRTCHNL_VF_CAP_PRIVILEGE, &vf->vf_caps) && |
4820 | + (allmulti || alluni)) { |
4821 | dev_err(&pf->pdev->dev, |
4822 | "Unprivileged VF %d is attempting to configure promiscuous mode\n", |
4823 | vf->vf_id); |
4824 | diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c |
4825 | index 333312a1d595..945000449279 100644 |
4826 | --- a/drivers/net/ethernet/intel/ice/ice_main.c |
4827 | +++ b/drivers/net/ethernet/intel/ice/ice_main.c |
4828 | @@ -2563,8 +2563,12 @@ static void ice_napi_enable_all(struct ice_vsi *vsi) |
4829 | if (!vsi->netdev) |
4830 | return; |
4831 | |
4832 | - for (q_idx = 0; q_idx < vsi->num_q_vectors; q_idx++) |
4833 | - napi_enable(&vsi->q_vectors[q_idx]->napi); |
4834 | + for (q_idx = 0; q_idx < vsi->num_q_vectors; q_idx++) { |
4835 | + struct ice_q_vector *q_vector = vsi->q_vectors[q_idx]; |
4836 | + |
4837 | + if (q_vector->rx.ring || q_vector->tx.ring) |
4838 | + napi_enable(&q_vector->napi); |
4839 | + } |
4840 | } |
4841 | |
4842 | /** |
4843 | @@ -2931,8 +2935,12 @@ static void ice_napi_disable_all(struct ice_vsi *vsi) |
4844 | if (!vsi->netdev) |
4845 | return; |
4846 | |
4847 | - for (q_idx = 0; q_idx < vsi->num_q_vectors; q_idx++) |
4848 | - napi_disable(&vsi->q_vectors[q_idx]->napi); |
4849 | + for (q_idx = 0; q_idx < vsi->num_q_vectors; q_idx++) { |
4850 | + struct ice_q_vector *q_vector = vsi->q_vectors[q_idx]; |
4851 | + |
4852 | + if (q_vector->rx.ring || q_vector->tx.ring) |
4853 | + napi_disable(&q_vector->napi); |
4854 | + } |
4855 | } |
4856 | |
4857 | /** |
4858 | diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c |
4859 | index 5df88ad8ac81..93f150784cfc 100644 |
4860 | --- a/drivers/net/ethernet/intel/igb/igb_main.c |
4861 | +++ b/drivers/net/ethernet/intel/igb/igb_main.c |
4862 | @@ -8770,9 +8770,11 @@ static int __igb_shutdown(struct pci_dev *pdev, bool *enable_wake, |
4863 | rtnl_unlock(); |
4864 | |
4865 | #ifdef CONFIG_PM |
4866 | - retval = pci_save_state(pdev); |
4867 | - if (retval) |
4868 | - return retval; |
4869 | + if (!runtime) { |
4870 | + retval = pci_save_state(pdev); |
4871 | + if (retval) |
4872 | + return retval; |
4873 | + } |
4874 | #endif |
4875 | |
4876 | status = rd32(E1000_STATUS); |
4877 | diff --git a/drivers/net/ethernet/marvell/skge.c b/drivers/net/ethernet/marvell/skge.c |
4878 | index 9c08c3650c02..15dea48e0195 100644 |
4879 | --- a/drivers/net/ethernet/marvell/skge.c |
4880 | +++ b/drivers/net/ethernet/marvell/skge.c |
4881 | @@ -152,8 +152,10 @@ static void skge_get_regs(struct net_device *dev, struct ethtool_regs *regs, |
4882 | memset(p, 0, regs->len); |
4883 | memcpy_fromio(p, io, B3_RAM_ADDR); |
4884 | |
4885 | - memcpy_fromio(p + B3_RI_WTO_R1, io + B3_RI_WTO_R1, |
4886 | - regs->len - B3_RI_WTO_R1); |
4887 | + if (regs->len > B3_RI_WTO_R1) { |
4888 | + memcpy_fromio(p + B3_RI_WTO_R1, io + B3_RI_WTO_R1, |
4889 | + regs->len - B3_RI_WTO_R1); |
4890 | + } |
4891 | } |
4892 | |
4893 | /* Wake on Lan only supported on Yukon chips with rev 1 or above */ |
4894 | diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c |
4895 | index b70cb6fd164c..9577d0657839 100644 |
4896 | --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c |
4897 | +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c |
4898 | @@ -1771,7 +1771,7 @@ static void mlx5e_close_cq(struct mlx5e_cq *cq) |
4899 | |
4900 | static int mlx5e_get_cpu(struct mlx5e_priv *priv, int ix) |
4901 | { |
4902 | - return cpumask_first(priv->mdev->priv.irq_info[ix].mask); |
4903 | + return cpumask_first(priv->mdev->priv.irq_info[ix + MLX5_EQ_VEC_COMP_BASE].mask); |
4904 | } |
4905 | |
4906 | static int mlx5e_open_tx_cqs(struct mlx5e_channel *c, |
4907 | diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c |
4908 | index 0b5ef6d4e815..7185f0dd58eb 100644 |
4909 | --- a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c |
4910 | +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c |
4911 | @@ -732,6 +732,8 @@ static u8 get_ip_proto(struct sk_buff *skb, int network_depth, __be16 proto) |
4912 | ((struct ipv6hdr *)ip_p)->nexthdr; |
4913 | } |
4914 | |
4915 | +#define short_frame(size) ((size) <= ETH_ZLEN + ETH_FCS_LEN) |
4916 | + |
4917 | static inline void mlx5e_handle_csum(struct net_device *netdev, |
4918 | struct mlx5_cqe64 *cqe, |
4919 | struct mlx5e_rq *rq, |
4920 | @@ -754,6 +756,17 @@ static inline void mlx5e_handle_csum(struct net_device *netdev, |
4921 | if (unlikely(test_bit(MLX5E_RQ_STATE_NO_CSUM_COMPLETE, &rq->state))) |
4922 | goto csum_unnecessary; |
4923 | |
4924 | + /* CQE csum doesn't cover padding octets in short ethernet |
4925 | + * frames. And the pad field is appended prior to calculating |
4926 | + * and appending the FCS field. |
4927 | + * |
4928 | + * Detecting these padded frames requires to verify and parse |
4929 | + * IP headers, so we simply force all those small frames to be |
4930 | + * CHECKSUM_UNNECESSARY even if they are not padded. |
4931 | + */ |
4932 | + if (short_frame(skb->len)) |
4933 | + goto csum_unnecessary; |
4934 | + |
4935 | if (likely(is_last_ethertype_ip(skb, &network_depth, &proto))) { |
4936 | if (unlikely(get_ip_proto(skb, network_depth, proto) == IPPROTO_SCTP)) |
4937 | goto csum_unnecessary; |
4938 | diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c |
4939 | index 9dabe9d4b279..4e0151918db1 100644 |
4940 | --- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c |
4941 | +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c |
4942 | @@ -2133,6 +2133,7 @@ static bool csum_offload_supported(struct mlx5e_priv *priv, |
4943 | |
4944 | static bool modify_header_match_supported(struct mlx5_flow_spec *spec, |
4945 | struct tcf_exts *exts, |
4946 | + u32 match_actions, |
4947 | struct netlink_ext_ack *extack) |
4948 | { |
4949 | const struct tc_action *a; |
4950 | @@ -2143,7 +2144,11 @@ static bool modify_header_match_supported(struct mlx5_flow_spec *spec, |
4951 | u16 ethertype; |
4952 | int nkeys, i; |
4953 | |
4954 | - headers_v = MLX5_ADDR_OF(fte_match_param, spec->match_value, outer_headers); |
4955 | + if (match_actions & MLX5_FLOW_CONTEXT_ACTION_DECAP) |
4956 | + headers_v = MLX5_ADDR_OF(fte_match_param, spec->match_value, inner_headers); |
4957 | + else |
4958 | + headers_v = MLX5_ADDR_OF(fte_match_param, spec->match_value, outer_headers); |
4959 | + |
4960 | ethertype = MLX5_GET(fte_match_set_lyr_2_4, headers_v, ethertype); |
4961 | |
4962 | /* for non-IP we only re-write MACs, so we're okay */ |
4963 | @@ -2200,7 +2205,7 @@ static bool actions_match_supported(struct mlx5e_priv *priv, |
4964 | |
4965 | if (actions & MLX5_FLOW_CONTEXT_ACTION_MOD_HDR) |
4966 | return modify_header_match_supported(&parse_attr->spec, exts, |
4967 | - extack); |
4968 | + actions, extack); |
4969 | |
4970 | return true; |
4971 | } |
4972 | diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c b/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c |
4973 | index 0d90b1b4a3d3..2d6168ee99e8 100644 |
4974 | --- a/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c |
4975 | +++ b/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c |
4976 | @@ -511,14 +511,14 @@ void mlx5_init_clock(struct mlx5_core_dev *mdev) |
4977 | ktime_to_ns(ktime_get_real())); |
4978 | |
4979 | /* Calculate period in seconds to call the overflow watchdog - to make |
4980 | - * sure counter is checked at least once every wrap around. |
4981 | + * sure counter is checked at least twice every wrap around. |
4982 | * The period is calculated as the minimum between max HW cycles count |
4983 | * (The clock source mask) and max amount of cycles that can be |
4984 | * multiplied by clock multiplier where the result doesn't exceed |
4985 | * 64bits. |
4986 | */ |
4987 | overflow_cycles = div64_u64(~0ULL >> 1, clock->cycles.mult); |
4988 | - overflow_cycles = min(overflow_cycles, clock->cycles.mask >> 1); |
4989 | + overflow_cycles = min(overflow_cycles, div_u64(clock->cycles.mask, 3)); |
4990 | |
4991 | ns = cyclecounter_cyc2ns(&clock->cycles, overflow_cycles, |
4992 | frac, &frac); |
4993 | diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/ethernet/mellanox/mlx5/core/main.c |
4994 | index 28132c7dc05f..d5cea0a36e6a 100644 |
4995 | --- a/drivers/net/ethernet/mellanox/mlx5/core/main.c |
4996 | +++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c |
4997 | @@ -640,18 +640,19 @@ u64 mlx5_read_internal_timer(struct mlx5_core_dev *dev) |
4998 | static int mlx5_irq_set_affinity_hint(struct mlx5_core_dev *mdev, int i) |
4999 | { |
5000 | struct mlx5_priv *priv = &mdev->priv; |
5001 | - int irq = pci_irq_vector(mdev->pdev, MLX5_EQ_VEC_COMP_BASE + i); |
5002 | + int vecidx = MLX5_EQ_VEC_COMP_BASE + i; |
5003 | + int irq = pci_irq_vector(mdev->pdev, vecidx); |
5004 | |
5005 | - if (!zalloc_cpumask_var(&priv->irq_info[i].mask, GFP_KERNEL)) { |
5006 | + if (!zalloc_cpumask_var(&priv->irq_info[vecidx].mask, GFP_KERNEL)) { |
5007 | mlx5_core_warn(mdev, "zalloc_cpumask_var failed"); |
5008 | return -ENOMEM; |
5009 | } |
5010 | |
5011 | cpumask_set_cpu(cpumask_local_spread(i, priv->numa_node), |
5012 | - priv->irq_info[i].mask); |
5013 | + priv->irq_info[vecidx].mask); |
5014 | |
5015 | if (IS_ENABLED(CONFIG_SMP) && |
5016 | - irq_set_affinity_hint(irq, priv->irq_info[i].mask)) |
5017 | + irq_set_affinity_hint(irq, priv->irq_info[vecidx].mask)) |
5018 | mlx5_core_warn(mdev, "irq_set_affinity_hint failed, irq 0x%.4x", irq); |
5019 | |
5020 | return 0; |
5021 | @@ -659,11 +660,12 @@ static int mlx5_irq_set_affinity_hint(struct mlx5_core_dev *mdev, int i) |
5022 | |
5023 | static void mlx5_irq_clear_affinity_hint(struct mlx5_core_dev *mdev, int i) |
5024 | { |
5025 | + int vecidx = MLX5_EQ_VEC_COMP_BASE + i; |
5026 | struct mlx5_priv *priv = &mdev->priv; |
5027 | - int irq = pci_irq_vector(mdev->pdev, MLX5_EQ_VEC_COMP_BASE + i); |
5028 | + int irq = pci_irq_vector(mdev->pdev, vecidx); |
5029 | |
5030 | irq_set_affinity_hint(irq, NULL); |
5031 | - free_cpumask_var(priv->irq_info[i].mask); |
5032 | + free_cpumask_var(priv->irq_info[vecidx].mask); |
5033 | } |
5034 | |
5035 | static int mlx5_irq_set_affinity_hints(struct mlx5_core_dev *mdev) |
5036 | diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c |
5037 | index 124aee09e953..8f1180fff955 100644 |
5038 | --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c |
5039 | +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c |
5040 | @@ -4298,6 +4298,25 @@ void mlxsw_sp_port_dev_put(struct mlxsw_sp_port *mlxsw_sp_port) |
5041 | dev_put(mlxsw_sp_port->dev); |
5042 | } |
5043 | |
5044 | +static void |
5045 | +mlxsw_sp_port_lag_uppers_cleanup(struct mlxsw_sp_port *mlxsw_sp_port, |
5046 | + struct net_device *lag_dev) |
5047 | +{ |
5048 | + struct net_device *br_dev = netdev_master_upper_dev_get(lag_dev); |
5049 | + struct net_device *upper_dev; |
5050 | + struct list_head *iter; |
5051 | + |
5052 | + if (netif_is_bridge_port(lag_dev)) |
5053 | + mlxsw_sp_port_bridge_leave(mlxsw_sp_port, lag_dev, br_dev); |
5054 | + |
5055 | + netdev_for_each_upper_dev_rcu(lag_dev, upper_dev, iter) { |
5056 | + if (!netif_is_bridge_port(upper_dev)) |
5057 | + continue; |
5058 | + br_dev = netdev_master_upper_dev_get(upper_dev); |
5059 | + mlxsw_sp_port_bridge_leave(mlxsw_sp_port, upper_dev, br_dev); |
5060 | + } |
5061 | +} |
5062 | + |
5063 | static int mlxsw_sp_lag_create(struct mlxsw_sp *mlxsw_sp, u16 lag_id) |
5064 | { |
5065 | char sldr_pl[MLXSW_REG_SLDR_LEN]; |
5066 | @@ -4490,6 +4509,10 @@ static void mlxsw_sp_port_lag_leave(struct mlxsw_sp_port *mlxsw_sp_port, |
5067 | |
5068 | /* Any VLANs configured on the port are no longer valid */ |
5069 | mlxsw_sp_port_vlan_flush(mlxsw_sp_port); |
5070 | + /* Make the LAG and its directly linked uppers leave bridges they |
5071 | + * are memeber in |
5072 | + */ |
5073 | + mlxsw_sp_port_lag_uppers_cleanup(mlxsw_sp_port, lag_dev); |
5074 | |
5075 | if (lag->ref_count == 1) |
5076 | mlxsw_sp_lag_destroy(mlxsw_sp, lag_id); |
5077 | diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_tcam.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_tcam.c |
5078 | index e171513bb32a..30931a2c025b 100644 |
5079 | --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_tcam.c |
5080 | +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_tcam.c |
5081 | @@ -95,8 +95,9 @@ int mlxsw_sp_acl_tcam_priority_get(struct mlxsw_sp *mlxsw_sp, |
5082 | if (!MLXSW_CORE_RES_VALID(mlxsw_sp->core, KVD_SIZE)) |
5083 | return -EIO; |
5084 | |
5085 | - max_priority = MLXSW_CORE_RES_GET(mlxsw_sp->core, KVD_SIZE); |
5086 | - if (rulei->priority > max_priority) |
5087 | + /* Priority range is 1..cap_kvd_size-1. */ |
5088 | + max_priority = MLXSW_CORE_RES_GET(mlxsw_sp->core, KVD_SIZE) - 1; |
5089 | + if (rulei->priority >= max_priority) |
5090 | return -EINVAL; |
5091 | |
5092 | /* Unlike in TC, in HW, higher number means higher priority. */ |
5093 | diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c |
5094 | index 69f556ddb934..c514af438fc2 100644 |
5095 | --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c |
5096 | +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c |
5097 | @@ -292,30 +292,6 @@ mlxsw_sp_bridge_port_destroy(struct mlxsw_sp_bridge_port *bridge_port) |
5098 | kfree(bridge_port); |
5099 | } |
5100 | |
5101 | -static bool |
5102 | -mlxsw_sp_bridge_port_should_destroy(const struct mlxsw_sp_bridge_port * |
5103 | - bridge_port) |
5104 | -{ |
5105 | - struct net_device *dev = bridge_port->dev; |
5106 | - struct mlxsw_sp *mlxsw_sp; |
5107 | - |
5108 | - if (is_vlan_dev(dev)) |
5109 | - mlxsw_sp = mlxsw_sp_lower_get(vlan_dev_real_dev(dev)); |
5110 | - else |
5111 | - mlxsw_sp = mlxsw_sp_lower_get(dev); |
5112 | - |
5113 | - /* In case ports were pulled from out of a bridged LAG, then |
5114 | - * it's possible the reference count isn't zero, yet the bridge |
5115 | - * port should be destroyed, as it's no longer an upper of ours. |
5116 | - */ |
5117 | - if (!mlxsw_sp && list_empty(&bridge_port->vlans_list)) |
5118 | - return true; |
5119 | - else if (bridge_port->ref_count == 0) |
5120 | - return true; |
5121 | - else |
5122 | - return false; |
5123 | -} |
5124 | - |
5125 | static struct mlxsw_sp_bridge_port * |
5126 | mlxsw_sp_bridge_port_get(struct mlxsw_sp_bridge *bridge, |
5127 | struct net_device *brport_dev) |
5128 | @@ -353,8 +329,7 @@ static void mlxsw_sp_bridge_port_put(struct mlxsw_sp_bridge *bridge, |
5129 | { |
5130 | struct mlxsw_sp_bridge_device *bridge_device; |
5131 | |
5132 | - bridge_port->ref_count--; |
5133 | - if (!mlxsw_sp_bridge_port_should_destroy(bridge_port)) |
5134 | + if (--bridge_port->ref_count != 0) |
5135 | return; |
5136 | bridge_device = bridge_port->bridge_device; |
5137 | mlxsw_sp_bridge_port_destroy(bridge_port); |
5138 | diff --git a/drivers/net/ethernet/sun/niu.c b/drivers/net/ethernet/sun/niu.c |
5139 | index 9319d84bf49f..d84501441edd 100644 |
5140 | --- a/drivers/net/ethernet/sun/niu.c |
5141 | +++ b/drivers/net/ethernet/sun/niu.c |
5142 | @@ -8100,6 +8100,8 @@ static int niu_pci_vpd_scan_props(struct niu *np, u32 start, u32 end) |
5143 | start += 3; |
5144 | |
5145 | prop_len = niu_pci_eeprom_read(np, start + 4); |
5146 | + if (prop_len < 0) |
5147 | + return prop_len; |
5148 | err = niu_pci_vpd_get_propname(np, start + 5, namebuf, 64); |
5149 | if (err < 0) |
5150 | return err; |
5151 | @@ -8144,8 +8146,12 @@ static int niu_pci_vpd_scan_props(struct niu *np, u32 start, u32 end) |
5152 | netif_printk(np, probe, KERN_DEBUG, np->dev, |
5153 | "VPD_SCAN: Reading in property [%s] len[%d]\n", |
5154 | namebuf, prop_len); |
5155 | - for (i = 0; i < prop_len; i++) |
5156 | - *prop_buf++ = niu_pci_eeprom_read(np, off + i); |
5157 | + for (i = 0; i < prop_len; i++) { |
5158 | + err = niu_pci_eeprom_read(np, off + i); |
5159 | + if (err >= 0) |
5160 | + *prop_buf = err; |
5161 | + ++prop_buf; |
5162 | + } |
5163 | } |
5164 | |
5165 | start += len; |
5166 | diff --git a/drivers/net/phy/dp83640.c b/drivers/net/phy/dp83640.c |
5167 | index edd4d44a386d..d3b36936f81e 100644 |
5168 | --- a/drivers/net/phy/dp83640.c |
5169 | +++ b/drivers/net/phy/dp83640.c |
5170 | @@ -898,14 +898,14 @@ static void decode_txts(struct dp83640_private *dp83640, |
5171 | struct phy_txts *phy_txts) |
5172 | { |
5173 | struct skb_shared_hwtstamps shhwtstamps; |
5174 | + struct dp83640_skb_info *skb_info; |
5175 | struct sk_buff *skb; |
5176 | - u64 ns; |
5177 | u8 overflow; |
5178 | + u64 ns; |
5179 | |
5180 | /* We must already have the skb that triggered this. */ |
5181 | - |
5182 | +again: |
5183 | skb = skb_dequeue(&dp83640->tx_queue); |
5184 | - |
5185 | if (!skb) { |
5186 | pr_debug("have timestamp but tx_queue empty\n"); |
5187 | return; |
5188 | @@ -920,6 +920,11 @@ static void decode_txts(struct dp83640_private *dp83640, |
5189 | } |
5190 | return; |
5191 | } |
5192 | + skb_info = (struct dp83640_skb_info *)skb->cb; |
5193 | + if (time_after(jiffies, skb_info->tmo)) { |
5194 | + kfree_skb(skb); |
5195 | + goto again; |
5196 | + } |
5197 | |
5198 | ns = phy2txts(phy_txts); |
5199 | memset(&shhwtstamps, 0, sizeof(shhwtstamps)); |
5200 | @@ -1472,6 +1477,7 @@ static bool dp83640_rxtstamp(struct phy_device *phydev, |
5201 | static void dp83640_txtstamp(struct phy_device *phydev, |
5202 | struct sk_buff *skb, int type) |
5203 | { |
5204 | + struct dp83640_skb_info *skb_info = (struct dp83640_skb_info *)skb->cb; |
5205 | struct dp83640_private *dp83640 = phydev->priv; |
5206 | |
5207 | switch (dp83640->hwts_tx_en) { |
5208 | @@ -1484,6 +1490,7 @@ static void dp83640_txtstamp(struct phy_device *phydev, |
5209 | /* fall through */ |
5210 | case HWTSTAMP_TX_ON: |
5211 | skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS; |
5212 | + skb_info->tmo = jiffies + SKB_TIMESTAMP_TIMEOUT; |
5213 | skb_queue_tail(&dp83640->tx_queue, skb); |
5214 | break; |
5215 | |
5216 | diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c |
5217 | index f46da6262abe..f5290adb49f0 100644 |
5218 | --- a/drivers/net/phy/marvell.c |
5219 | +++ b/drivers/net/phy/marvell.c |
5220 | @@ -847,8 +847,6 @@ static int m88e1510_config_init(struct phy_device *phydev) |
5221 | |
5222 | /* SGMII-to-Copper mode initialization */ |
5223 | if (phydev->interface == PHY_INTERFACE_MODE_SGMII) { |
5224 | - u32 pause; |
5225 | - |
5226 | /* Select page 18 */ |
5227 | err = marvell_set_page(phydev, 18); |
5228 | if (err < 0) |
5229 | @@ -871,16 +869,6 @@ static int m88e1510_config_init(struct phy_device *phydev) |
5230 | err = marvell_set_page(phydev, MII_MARVELL_COPPER_PAGE); |
5231 | if (err < 0) |
5232 | return err; |
5233 | - |
5234 | - /* There appears to be a bug in the 88e1512 when used in |
5235 | - * SGMII to copper mode, where the AN advertisement register |
5236 | - * clears the pause bits each time a negotiation occurs. |
5237 | - * This means we can never be truely sure what was advertised, |
5238 | - * so disable Pause support. |
5239 | - */ |
5240 | - pause = SUPPORTED_Pause | SUPPORTED_Asym_Pause; |
5241 | - phydev->supported &= ~pause; |
5242 | - phydev->advertising &= ~pause; |
5243 | } |
5244 | |
5245 | return m88e1318_config_init(phydev); |
5246 | diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c |
5247 | index f2d01cb6f958..6e971628bb50 100644 |
5248 | --- a/drivers/net/usb/smsc95xx.c |
5249 | +++ b/drivers/net/usb/smsc95xx.c |
5250 | @@ -1295,6 +1295,7 @@ static int smsc95xx_bind(struct usbnet *dev, struct usb_interface *intf) |
5251 | dev->net->features |= NETIF_F_RXCSUM; |
5252 | |
5253 | dev->net->hw_features = NETIF_F_IP_CSUM | NETIF_F_RXCSUM; |
5254 | + set_bit(EVENT_NO_IP_ALIGN, &dev->flags); |
5255 | |
5256 | smsc95xx_init_mac_address(dev); |
5257 | |
5258 | diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c |
5259 | index da500c77c5b9..f6a69b56f3e3 100644 |
5260 | --- a/drivers/net/virtio_net.c |
5261 | +++ b/drivers/net/virtio_net.c |
5262 | @@ -502,6 +502,8 @@ static int virtnet_xdp_xmit(struct net_device *dev, |
5263 | struct bpf_prog *xdp_prog; |
5264 | struct send_queue *sq; |
5265 | unsigned int len; |
5266 | + int packets = 0; |
5267 | + int bytes = 0; |
5268 | int drops = 0; |
5269 | int kicks = 0; |
5270 | int ret, err; |
5271 | @@ -525,10 +527,18 @@ static int virtnet_xdp_xmit(struct net_device *dev, |
5272 | |
5273 | /* Free up any pending old buffers before queueing new ones. */ |
5274 | while ((ptr = virtqueue_get_buf(sq->vq, &len)) != NULL) { |
5275 | - if (likely(is_xdp_frame(ptr))) |
5276 | - xdp_return_frame(ptr_to_xdp(ptr)); |
5277 | - else |
5278 | - napi_consume_skb(ptr, false); |
5279 | + if (likely(is_xdp_frame(ptr))) { |
5280 | + struct xdp_frame *frame = ptr_to_xdp(ptr); |
5281 | + |
5282 | + bytes += frame->len; |
5283 | + xdp_return_frame(frame); |
5284 | + } else { |
5285 | + struct sk_buff *skb = ptr; |
5286 | + |
5287 | + bytes += skb->len; |
5288 | + napi_consume_skb(skb, false); |
5289 | + } |
5290 | + packets++; |
5291 | } |
5292 | |
5293 | for (i = 0; i < n; i++) { |
5294 | @@ -548,6 +558,8 @@ static int virtnet_xdp_xmit(struct net_device *dev, |
5295 | } |
5296 | out: |
5297 | u64_stats_update_begin(&sq->stats.syncp); |
5298 | + sq->stats.bytes += bytes; |
5299 | + sq->stats.packets += packets; |
5300 | sq->stats.xdp_tx += n; |
5301 | sq->stats.xdp_tx_drops += drops; |
5302 | sq->stats.kicks += kicks; |
5303 | diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c |
5304 | index d210b0ed59be..59fdda67f89f 100644 |
5305 | --- a/drivers/net/wireless/ath/ath10k/core.c |
5306 | +++ b/drivers/net/wireless/ath/ath10k/core.c |
5307 | @@ -561,6 +561,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { |
5308 | .hw_ops = &wcn3990_ops, |
5309 | .decap_align_bytes = 1, |
5310 | .num_peers = TARGET_HL_10_TLV_NUM_PEERS, |
5311 | + .n_cipher_suites = 8, |
5312 | .ast_skid_limit = TARGET_HL_10_TLV_AST_SKID_LIMIT, |
5313 | .num_wds_entries = TARGET_HL_10_TLV_NUM_WDS_ENTRIES, |
5314 | .target_64bit = true, |
5315 | diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c |
5316 | index 7e49342bae38..400495858e4e 100644 |
5317 | --- a/drivers/net/wireless/ath/ath10k/mac.c |
5318 | +++ b/drivers/net/wireless/ath/ath10k/mac.c |
5319 | @@ -6293,13 +6293,6 @@ static int ath10k_sta_state(struct ieee80211_hw *hw, |
5320 | ar->num_stations + 1, ar->max_num_stations, |
5321 | ar->num_peers + 1, ar->max_num_peers); |
5322 | |
5323 | - if (ath10k_debug_is_extd_tx_stats_enabled(ar)) { |
5324 | - arsta->tx_stats = kzalloc(sizeof(*arsta->tx_stats), |
5325 | - GFP_KERNEL); |
5326 | - if (!arsta->tx_stats) |
5327 | - goto exit; |
5328 | - } |
5329 | - |
5330 | num_tdls_stations = ath10k_mac_tdls_vif_stations_count(hw, vif); |
5331 | num_tdls_vifs = ath10k_mac_tdls_vifs_count(hw); |
5332 | |
5333 | @@ -6321,12 +6314,22 @@ static int ath10k_sta_state(struct ieee80211_hw *hw, |
5334 | goto exit; |
5335 | } |
5336 | |
5337 | + if (ath10k_debug_is_extd_tx_stats_enabled(ar)) { |
5338 | + arsta->tx_stats = kzalloc(sizeof(*arsta->tx_stats), |
5339 | + GFP_KERNEL); |
5340 | + if (!arsta->tx_stats) { |
5341 | + ret = -ENOMEM; |
5342 | + goto exit; |
5343 | + } |
5344 | + } |
5345 | + |
5346 | ret = ath10k_peer_create(ar, vif, sta, arvif->vdev_id, |
5347 | sta->addr, peer_type); |
5348 | if (ret) { |
5349 | ath10k_warn(ar, "failed to add peer %pM for vdev %d when adding a new sta: %i\n", |
5350 | sta->addr, arvif->vdev_id, ret); |
5351 | ath10k_mac_dec_num_stations(arvif, sta); |
5352 | + kfree(arsta->tx_stats); |
5353 | goto exit; |
5354 | } |
5355 | |
5356 | @@ -6339,6 +6342,7 @@ static int ath10k_sta_state(struct ieee80211_hw *hw, |
5357 | spin_unlock_bh(&ar->data_lock); |
5358 | ath10k_peer_delete(ar, arvif->vdev_id, sta->addr); |
5359 | ath10k_mac_dec_num_stations(arvif, sta); |
5360 | + kfree(arsta->tx_stats); |
5361 | ret = -ENOENT; |
5362 | goto exit; |
5363 | } |
5364 | @@ -6359,6 +6363,7 @@ static int ath10k_sta_state(struct ieee80211_hw *hw, |
5365 | ath10k_peer_delete(ar, arvif->vdev_id, |
5366 | sta->addr); |
5367 | ath10k_mac_dec_num_stations(arvif, sta); |
5368 | + kfree(arsta->tx_stats); |
5369 | goto exit; |
5370 | } |
5371 | |
5372 | @@ -6370,6 +6375,7 @@ static int ath10k_sta_state(struct ieee80211_hw *hw, |
5373 | sta->addr, arvif->vdev_id, ret); |
5374 | ath10k_peer_delete(ar, arvif->vdev_id, sta->addr); |
5375 | ath10k_mac_dec_num_stations(arvif, sta); |
5376 | + kfree(arsta->tx_stats); |
5377 | |
5378 | if (num_tdls_stations != 0) |
5379 | goto exit; |
5380 | @@ -6385,9 +6391,6 @@ static int ath10k_sta_state(struct ieee80211_hw *hw, |
5381 | "mac vdev %d peer delete %pM sta %pK (sta gone)\n", |
5382 | arvif->vdev_id, sta->addr, sta); |
5383 | |
5384 | - if (ath10k_debug_is_extd_tx_stats_enabled(ar)) |
5385 | - kfree(arsta->tx_stats); |
5386 | - |
5387 | if (sta->tdls) { |
5388 | ret = ath10k_mac_tdls_peer_update(ar, arvif->vdev_id, |
5389 | sta, |
5390 | @@ -6427,6 +6430,11 @@ static int ath10k_sta_state(struct ieee80211_hw *hw, |
5391 | } |
5392 | spin_unlock_bh(&ar->data_lock); |
5393 | |
5394 | + if (ath10k_debug_is_extd_tx_stats_enabled(ar)) { |
5395 | + kfree(arsta->tx_stats); |
5396 | + arsta->tx_stats = NULL; |
5397 | + } |
5398 | + |
5399 | for (i = 0; i < ARRAY_SIZE(sta->txq); i++) |
5400 | ath10k_mac_txq_unref(ar, sta->txq[i]); |
5401 | |
5402 | diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h b/drivers/net/wireless/ath/ath9k/ath9k.h |
5403 | index 21ba20981a80..0fca44e91a71 100644 |
5404 | --- a/drivers/net/wireless/ath/ath9k/ath9k.h |
5405 | +++ b/drivers/net/wireless/ath/ath9k/ath9k.h |
5406 | @@ -272,7 +272,7 @@ struct ath_node { |
5407 | #endif |
5408 | u8 key_idx[4]; |
5409 | |
5410 | - u32 ackto; |
5411 | + int ackto; |
5412 | struct list_head list; |
5413 | }; |
5414 | |
5415 | diff --git a/drivers/net/wireless/ath/ath9k/dynack.c b/drivers/net/wireless/ath/ath9k/dynack.c |
5416 | index 7334c9b09e82..6e236a485431 100644 |
5417 | --- a/drivers/net/wireless/ath/ath9k/dynack.c |
5418 | +++ b/drivers/net/wireless/ath/ath9k/dynack.c |
5419 | @@ -29,9 +29,13 @@ |
5420 | * ath_dynack_ewma - EWMA (Exponentially Weighted Moving Average) calculation |
5421 | * |
5422 | */ |
5423 | -static inline u32 ath_dynack_ewma(u32 old, u32 new) |
5424 | +static inline int ath_dynack_ewma(int old, int new) |
5425 | { |
5426 | - return (new * (EWMA_DIV - EWMA_LEVEL) + old * EWMA_LEVEL) / EWMA_DIV; |
5427 | + if (old > 0) |
5428 | + return (new * (EWMA_DIV - EWMA_LEVEL) + |
5429 | + old * EWMA_LEVEL) / EWMA_DIV; |
5430 | + else |
5431 | + return new; |
5432 | } |
5433 | |
5434 | /** |
5435 | @@ -82,10 +86,10 @@ static inline bool ath_dynack_bssidmask(struct ath_hw *ah, const u8 *mac) |
5436 | */ |
5437 | static void ath_dynack_compute_ackto(struct ath_hw *ah) |
5438 | { |
5439 | - struct ath_node *an; |
5440 | - u32 to = 0; |
5441 | - struct ath_dynack *da = &ah->dynack; |
5442 | struct ath_common *common = ath9k_hw_common(ah); |
5443 | + struct ath_dynack *da = &ah->dynack; |
5444 | + struct ath_node *an; |
5445 | + int to = 0; |
5446 | |
5447 | list_for_each_entry(an, &da->nodes, list) |
5448 | if (an->ackto > to) |
5449 | @@ -144,7 +148,8 @@ static void ath_dynack_compute_to(struct ath_hw *ah) |
5450 | an->ackto = ath_dynack_ewma(an->ackto, |
5451 | ackto); |
5452 | ath_dbg(ath9k_hw_common(ah), DYNACK, |
5453 | - "%pM to %u\n", dst, an->ackto); |
5454 | + "%pM to %d [%u]\n", dst, |
5455 | + an->ackto, ackto); |
5456 | if (time_is_before_jiffies(da->lto)) { |
5457 | ath_dynack_compute_ackto(ah); |
5458 | da->lto = jiffies + COMPUTE_TO; |
5459 | @@ -166,10 +171,12 @@ static void ath_dynack_compute_to(struct ath_hw *ah) |
5460 | * @ah: ath hw |
5461 | * @skb: socket buffer |
5462 | * @ts: tx status info |
5463 | + * @sta: station pointer |
5464 | * |
5465 | */ |
5466 | void ath_dynack_sample_tx_ts(struct ath_hw *ah, struct sk_buff *skb, |
5467 | - struct ath_tx_status *ts) |
5468 | + struct ath_tx_status *ts, |
5469 | + struct ieee80211_sta *sta) |
5470 | { |
5471 | u8 ridx; |
5472 | struct ieee80211_hdr *hdr; |
5473 | @@ -177,7 +184,7 @@ void ath_dynack_sample_tx_ts(struct ath_hw *ah, struct sk_buff *skb, |
5474 | struct ath_common *common = ath9k_hw_common(ah); |
5475 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); |
5476 | |
5477 | - if ((info->flags & IEEE80211_TX_CTL_NO_ACK) || !da->enabled) |
5478 | + if (!da->enabled || (info->flags & IEEE80211_TX_CTL_NO_ACK)) |
5479 | return; |
5480 | |
5481 | spin_lock_bh(&da->qlock); |
5482 | @@ -187,11 +194,19 @@ void ath_dynack_sample_tx_ts(struct ath_hw *ah, struct sk_buff *skb, |
5483 | /* late ACK */ |
5484 | if (ts->ts_status & ATH9K_TXERR_XRETRY) { |
5485 | if (ieee80211_is_assoc_req(hdr->frame_control) || |
5486 | - ieee80211_is_assoc_resp(hdr->frame_control)) { |
5487 | + ieee80211_is_assoc_resp(hdr->frame_control) || |
5488 | + ieee80211_is_auth(hdr->frame_control)) { |
5489 | ath_dbg(common, DYNACK, "late ack\n"); |
5490 | + |
5491 | ath9k_hw_setslottime(ah, (LATEACK_TO - 3) / 2); |
5492 | ath9k_hw_set_ack_timeout(ah, LATEACK_TO); |
5493 | ath9k_hw_set_cts_timeout(ah, LATEACK_TO); |
5494 | + if (sta) { |
5495 | + struct ath_node *an; |
5496 | + |
5497 | + an = (struct ath_node *)sta->drv_priv; |
5498 | + an->ackto = -1; |
5499 | + } |
5500 | da->lto = jiffies + LATEACK_DELAY; |
5501 | } |
5502 | |
5503 | @@ -251,7 +266,7 @@ void ath_dynack_sample_ack_ts(struct ath_hw *ah, struct sk_buff *skb, |
5504 | struct ath_common *common = ath9k_hw_common(ah); |
5505 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; |
5506 | |
5507 | - if (!ath_dynack_bssidmask(ah, hdr->addr1) || !da->enabled) |
5508 | + if (!da->enabled || !ath_dynack_bssidmask(ah, hdr->addr1)) |
5509 | return; |
5510 | |
5511 | spin_lock_bh(&da->qlock); |
5512 | diff --git a/drivers/net/wireless/ath/ath9k/dynack.h b/drivers/net/wireless/ath/ath9k/dynack.h |
5513 | index 6d7bef976742..cf60224d40df 100644 |
5514 | --- a/drivers/net/wireless/ath/ath9k/dynack.h |
5515 | +++ b/drivers/net/wireless/ath/ath9k/dynack.h |
5516 | @@ -86,7 +86,8 @@ void ath_dynack_node_deinit(struct ath_hw *ah, struct ath_node *an); |
5517 | void ath_dynack_init(struct ath_hw *ah); |
5518 | void ath_dynack_sample_ack_ts(struct ath_hw *ah, struct sk_buff *skb, u32 ts); |
5519 | void ath_dynack_sample_tx_ts(struct ath_hw *ah, struct sk_buff *skb, |
5520 | - struct ath_tx_status *ts); |
5521 | + struct ath_tx_status *ts, |
5522 | + struct ieee80211_sta *sta); |
5523 | #else |
5524 | static inline void ath_dynack_init(struct ath_hw *ah) {} |
5525 | static inline void ath_dynack_node_init(struct ath_hw *ah, |
5526 | @@ -97,7 +98,8 @@ static inline void ath_dynack_sample_ack_ts(struct ath_hw *ah, |
5527 | struct sk_buff *skb, u32 ts) {} |
5528 | static inline void ath_dynack_sample_tx_ts(struct ath_hw *ah, |
5529 | struct sk_buff *skb, |
5530 | - struct ath_tx_status *ts) {} |
5531 | + struct ath_tx_status *ts, |
5532 | + struct ieee80211_sta *sta) {} |
5533 | #endif |
5534 | |
5535 | #endif /* DYNACK_H */ |
5536 | diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c |
5537 | index 25b3fc82d4ac..f448d5716639 100644 |
5538 | --- a/drivers/net/wireless/ath/ath9k/xmit.c |
5539 | +++ b/drivers/net/wireless/ath/ath9k/xmit.c |
5540 | @@ -629,7 +629,7 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq, |
5541 | if (bf == bf->bf_lastbf) |
5542 | ath_dynack_sample_tx_ts(sc->sc_ah, |
5543 | bf->bf_mpdu, |
5544 | - ts); |
5545 | + ts, sta); |
5546 | } |
5547 | |
5548 | ath_tx_complete_buf(sc, bf, txq, &bf_head, sta, ts, |
5549 | @@ -773,7 +773,8 @@ static void ath_tx_process_buffer(struct ath_softc *sc, struct ath_txq *txq, |
5550 | memcpy(info->control.rates, bf->rates, |
5551 | sizeof(info->control.rates)); |
5552 | ath_tx_rc_status(sc, bf, ts, 1, txok ? 0 : 1, txok); |
5553 | - ath_dynack_sample_tx_ts(sc->sc_ah, bf->bf_mpdu, ts); |
5554 | + ath_dynack_sample_tx_ts(sc->sc_ah, bf->bf_mpdu, ts, |
5555 | + sta); |
5556 | } |
5557 | ath_tx_complete_buf(sc, bf, txq, bf_head, sta, ts, txok); |
5558 | } else |
5559 | diff --git a/drivers/net/wireless/ath/wil6210/main.c b/drivers/net/wireless/ath/wil6210/main.c |
5560 | index 398900a1c29e..c54b008996ee 100644 |
5561 | --- a/drivers/net/wireless/ath/wil6210/main.c |
5562 | +++ b/drivers/net/wireless/ath/wil6210/main.c |
5563 | @@ -998,10 +998,13 @@ static int wil_target_reset(struct wil6210_priv *wil, int no_flash) |
5564 | |
5565 | wil_dbg_misc(wil, "Resetting \"%s\"...\n", wil->hw_name); |
5566 | |
5567 | - /* Clear MAC link up */ |
5568 | - wil_s(wil, RGF_HP_CTRL, BIT(15)); |
5569 | - wil_s(wil, RGF_USER_CLKS_CTL_SW_RST_MASK_0, BIT_HPAL_PERST_FROM_PAD); |
5570 | - wil_s(wil, RGF_USER_CLKS_CTL_SW_RST_MASK_0, BIT_CAR_PERST_RST); |
5571 | + if (wil->hw_version < HW_VER_TALYN) { |
5572 | + /* Clear MAC link up */ |
5573 | + wil_s(wil, RGF_HP_CTRL, BIT(15)); |
5574 | + wil_s(wil, RGF_USER_CLKS_CTL_SW_RST_MASK_0, |
5575 | + BIT_HPAL_PERST_FROM_PAD); |
5576 | + wil_s(wil, RGF_USER_CLKS_CTL_SW_RST_MASK_0, BIT_CAR_PERST_RST); |
5577 | + } |
5578 | |
5579 | wil_halt_cpu(wil); |
5580 | |
5581 | diff --git a/drivers/net/wireless/ath/wil6210/txrx.c b/drivers/net/wireless/ath/wil6210/txrx.c |
5582 | index cc5f263cc965..005c4ba9e823 100644 |
5583 | --- a/drivers/net/wireless/ath/wil6210/txrx.c |
5584 | +++ b/drivers/net/wireless/ath/wil6210/txrx.c |
5585 | @@ -1403,6 +1403,8 @@ found: |
5586 | wil_dbg_txrx(wil, "BCAST DUP -> ring %d\n", i); |
5587 | wil_set_da_for_vring(wil, skb2, i); |
5588 | wil_tx_ring(wil, vif, v2, skb2); |
5589 | + /* successful call to wil_tx_ring takes skb2 ref */ |
5590 | + dev_kfree_skb_any(skb2); |
5591 | } else { |
5592 | wil_err(wil, "skb_copy failed\n"); |
5593 | } |
5594 | diff --git a/drivers/net/wireless/intel/iwlwifi/fw/api/mac.h b/drivers/net/wireless/intel/iwlwifi/fw/api/mac.h |
5595 | index 1dd23f846fb9..f3ccd7948340 100644 |
5596 | --- a/drivers/net/wireless/intel/iwlwifi/fw/api/mac.h |
5597 | +++ b/drivers/net/wireless/intel/iwlwifi/fw/api/mac.h |
5598 | @@ -442,7 +442,7 @@ struct iwl_he_backoff_conf { |
5599 | * Support for Nss x BW (or RU) matrix: |
5600 | * (0=SISO, 1=MIMO2) x (0-20MHz, 1-40MHz, 2-80MHz, 3-160MHz) |
5601 | * Each entry contains 2 QAM thresholds for 8us and 16us: |
5602 | - * 0=BPSK, 1=QPSK, 2=16QAM, 3=64QAM, 4=256QAM, 5=1024QAM, 6/7=RES |
5603 | + * 0=BPSK, 1=QPSK, 2=16QAM, 3=64QAM, 4=256QAM, 5=1024QAM, 6=RES, 7=NONE |
5604 | * i.e. QAM_th1 < QAM_th2 such if TX uses QAM_tx: |
5605 | * QAM_tx < QAM_th1 --> PPE=0us |
5606 | * QAM_th1 <= QAM_tx < QAM_th2 --> PPE=8us |
5607 | diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c |
5608 | index 00f831d88366..5a42c617c54c 100644 |
5609 | --- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c |
5610 | +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c |
5611 | @@ -2005,7 +2005,13 @@ static void iwl_mvm_cfg_he_sta(struct iwl_mvm *mvm, |
5612 | if (sta->he_cap.he_cap_elem.mac_cap_info[4] & IEEE80211_HE_MAC_CAP4_BQR) |
5613 | sta_ctxt_cmd.htc_flags |= cpu_to_le32(IWL_HE_HTC_BQR_SUPP); |
5614 | |
5615 | - /* If PPE Thresholds exist, parse them into a FW-familiar format */ |
5616 | + /* |
5617 | + * Initialize the PPE thresholds to "None" (7), as described in Table |
5618 | + * 9-262ac of 80211.ax/D3.0. |
5619 | + */ |
5620 | + memset(&sta_ctxt_cmd.pkt_ext, 7, sizeof(sta_ctxt_cmd.pkt_ext)); |
5621 | + |
5622 | + /* If PPE Thresholds exist, parse them into a FW-familiar format. */ |
5623 | if (sta->he_cap.he_cap_elem.phy_cap_info[6] & |
5624 | IEEE80211_HE_PHY_CAP6_PPE_THRESHOLD_PRESENT) { |
5625 | u8 nss = (sta->he_cap.ppe_thres[0] & |
5626 | diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rs-fw.c b/drivers/net/wireless/intel/iwlwifi/mvm/rs-fw.c |
5627 | index 7a98e1a1dc40..dabbc04853ac 100644 |
5628 | --- a/drivers/net/wireless/intel/iwlwifi/mvm/rs-fw.c |
5629 | +++ b/drivers/net/wireless/intel/iwlwifi/mvm/rs-fw.c |
5630 | @@ -98,8 +98,12 @@ static u8 rs_fw_sgi_cw_support(struct ieee80211_sta *sta) |
5631 | { |
5632 | struct ieee80211_sta_ht_cap *ht_cap = &sta->ht_cap; |
5633 | struct ieee80211_sta_vht_cap *vht_cap = &sta->vht_cap; |
5634 | + struct ieee80211_sta_he_cap *he_cap = &sta->he_cap; |
5635 | u8 supp = 0; |
5636 | |
5637 | + if (he_cap && he_cap->has_he) |
5638 | + return 0; |
5639 | + |
5640 | if (ht_cap->cap & IEEE80211_HT_CAP_SGI_20) |
5641 | supp |= BIT(IWL_TLC_MNG_CH_WIDTH_20MHZ); |
5642 | if (ht_cap->cap & IEEE80211_HT_CAP_SGI_40) |
5643 | diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2/pci_dfs.c b/drivers/net/wireless/mediatek/mt76/mt76x2/pci_dfs.c |
5644 | index b56febae8945..764528c9f48a 100644 |
5645 | --- a/drivers/net/wireless/mediatek/mt76/mt76x2/pci_dfs.c |
5646 | +++ b/drivers/net/wireless/mediatek/mt76/mt76x2/pci_dfs.c |
5647 | @@ -800,7 +800,7 @@ static void mt76x2_dfs_set_bbp_params(struct mt76x02_dev *dev) |
5648 | |
5649 | /* enable detection*/ |
5650 | mt76_wr(dev, MT_BBP(DFS, 0), MT_DFS_CH_EN << 16); |
5651 | - mt76_wr(dev, 0x212c, 0x0c350001); |
5652 | + mt76_wr(dev, MT_BBP(IBI, 11), 0x0c350001); |
5653 | } |
5654 | |
5655 | void mt76x2_dfs_adjust_agc(struct mt76x02_dev *dev) |
5656 | @@ -843,7 +843,11 @@ void mt76x2_dfs_init_params(struct mt76x02_dev *dev) |
5657 | mt76_wr(dev, MT_BBP(DFS, 0), 0); |
5658 | /* clear detector status */ |
5659 | mt76_wr(dev, MT_BBP(DFS, 1), 0xf); |
5660 | - mt76_wr(dev, 0x212c, 0); |
5661 | + if (mt76_chip(&dev->mt76) == 0x7610 || |
5662 | + mt76_chip(&dev->mt76) == 0x7630) |
5663 | + mt76_wr(dev, MT_BBP(IBI, 11), 0xfde8081); |
5664 | + else |
5665 | + mt76_wr(dev, MT_BBP(IBI, 11), 0); |
5666 | |
5667 | mt76x02_irq_disable(dev, MT_INT_GPTIMER); |
5668 | mt76_rmw_field(dev, MT_INT_TIMER_EN, |
5669 | diff --git a/drivers/net/wireless/st/cw1200/scan.c b/drivers/net/wireless/st/cw1200/scan.c |
5670 | index 67213f11acbd..0a9eac93dd01 100644 |
5671 | --- a/drivers/net/wireless/st/cw1200/scan.c |
5672 | +++ b/drivers/net/wireless/st/cw1200/scan.c |
5673 | @@ -78,6 +78,10 @@ int cw1200_hw_scan(struct ieee80211_hw *hw, |
5674 | if (req->n_ssids > WSM_SCAN_MAX_NUM_OF_SSIDS) |
5675 | return -EINVAL; |
5676 | |
5677 | + /* will be unlocked in cw1200_scan_work() */ |
5678 | + down(&priv->scan.lock); |
5679 | + mutex_lock(&priv->conf_mutex); |
5680 | + |
5681 | frame.skb = ieee80211_probereq_get(hw, priv->vif->addr, NULL, 0, |
5682 | req->ie_len); |
5683 | if (!frame.skb) |
5684 | @@ -86,19 +90,15 @@ int cw1200_hw_scan(struct ieee80211_hw *hw, |
5685 | if (req->ie_len) |
5686 | skb_put_data(frame.skb, req->ie, req->ie_len); |
5687 | |
5688 | - /* will be unlocked in cw1200_scan_work() */ |
5689 | - down(&priv->scan.lock); |
5690 | - mutex_lock(&priv->conf_mutex); |
5691 | - |
5692 | ret = wsm_set_template_frame(priv, &frame); |
5693 | if (!ret) { |
5694 | /* Host want to be the probe responder. */ |
5695 | ret = wsm_set_probe_responder(priv, true); |
5696 | } |
5697 | if (ret) { |
5698 | + dev_kfree_skb(frame.skb); |
5699 | mutex_unlock(&priv->conf_mutex); |
5700 | up(&priv->scan.lock); |
5701 | - dev_kfree_skb(frame.skb); |
5702 | return ret; |
5703 | } |
5704 | |
5705 | @@ -120,10 +120,9 @@ int cw1200_hw_scan(struct ieee80211_hw *hw, |
5706 | ++priv->scan.n_ssids; |
5707 | } |
5708 | |
5709 | - mutex_unlock(&priv->conf_mutex); |
5710 | - |
5711 | if (frame.skb) |
5712 | dev_kfree_skb(frame.skb); |
5713 | + mutex_unlock(&priv->conf_mutex); |
5714 | queue_work(priv->workqueue, &priv->scan.work); |
5715 | return 0; |
5716 | } |
5717 | diff --git a/drivers/nvme/host/lightnvm.c b/drivers/nvme/host/lightnvm.c |
5718 | index a4f3b263cd6c..d64805dc8efb 100644 |
5719 | --- a/drivers/nvme/host/lightnvm.c |
5720 | +++ b/drivers/nvme/host/lightnvm.c |
5721 | @@ -577,7 +577,8 @@ static int nvme_nvm_get_chk_meta(struct nvm_dev *ndev, |
5722 | struct ppa_addr ppa; |
5723 | size_t left = nchks * sizeof(struct nvme_nvm_chk_meta); |
5724 | size_t log_pos, offset, len; |
5725 | - int ret, i, max_len; |
5726 | + int i, max_len; |
5727 | + int ret = 0; |
5728 | |
5729 | /* |
5730 | * limit requests to maximum 256K to avoid issuing arbitrary large |
5731 | diff --git a/drivers/opp/core.c b/drivers/opp/core.c |
5732 | index 9280f51f1ce6..82baed4b80d4 100644 |
5733 | --- a/drivers/opp/core.c |
5734 | +++ b/drivers/opp/core.c |
5735 | @@ -196,12 +196,12 @@ unsigned long dev_pm_opp_get_max_volt_latency(struct device *dev) |
5736 | if (IS_ERR(opp_table)) |
5737 | return 0; |
5738 | |
5739 | - count = opp_table->regulator_count; |
5740 | - |
5741 | /* Regulator may not be required for the device */ |
5742 | - if (!count) |
5743 | + if (!opp_table->regulators) |
5744 | goto put_opp_table; |
5745 | |
5746 | + count = opp_table->regulator_count; |
5747 | + |
5748 | uV = kmalloc_array(count, sizeof(*uV), GFP_KERNEL); |
5749 | if (!uV) |
5750 | goto put_opp_table; |
5751 | @@ -1102,6 +1102,9 @@ static bool _opp_supported_by_regulators(struct dev_pm_opp *opp, |
5752 | struct regulator *reg; |
5753 | int i; |
5754 | |
5755 | + if (!opp_table->regulators) |
5756 | + return true; |
5757 | + |
5758 | for (i = 0; i < opp_table->regulator_count; i++) { |
5759 | reg = opp_table->regulators[i]; |
5760 | |
5761 | @@ -1386,7 +1389,7 @@ static int _allocate_set_opp_data(struct opp_table *opp_table) |
5762 | struct dev_pm_set_opp_data *data; |
5763 | int len, count = opp_table->regulator_count; |
5764 | |
5765 | - if (WARN_ON(!count)) |
5766 | + if (WARN_ON(!opp_table->regulators)) |
5767 | return -EINVAL; |
5768 | |
5769 | /* space for set_opp_data */ |
5770 | diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c |
5771 | index 88af6bff945f..6b54528b5f0c 100644 |
5772 | --- a/drivers/pci/controller/dwc/pci-imx6.c |
5773 | +++ b/drivers/pci/controller/dwc/pci-imx6.c |
5774 | @@ -67,6 +67,7 @@ struct imx6_pcie { |
5775 | #define PHY_PLL_LOCK_WAIT_USLEEP_MAX 200 |
5776 | |
5777 | /* PCIe Root Complex registers (memory-mapped) */ |
5778 | +#define PCIE_RC_IMX6_MSI_CAP 0x50 |
5779 | #define PCIE_RC_LCR 0x7c |
5780 | #define PCIE_RC_LCR_MAX_LINK_SPEEDS_GEN1 0x1 |
5781 | #define PCIE_RC_LCR_MAX_LINK_SPEEDS_GEN2 0x2 |
5782 | @@ -840,6 +841,7 @@ static int imx6_pcie_probe(struct platform_device *pdev) |
5783 | struct resource *dbi_base; |
5784 | struct device_node *node = dev->of_node; |
5785 | int ret; |
5786 | + u16 val; |
5787 | |
5788 | imx6_pcie = devm_kzalloc(dev, sizeof(*imx6_pcie), GFP_KERNEL); |
5789 | if (!imx6_pcie) |
5790 | @@ -981,6 +983,14 @@ static int imx6_pcie_probe(struct platform_device *pdev) |
5791 | if (ret < 0) |
5792 | return ret; |
5793 | |
5794 | + if (pci_msi_enabled()) { |
5795 | + val = dw_pcie_readw_dbi(pci, PCIE_RC_IMX6_MSI_CAP + |
5796 | + PCI_MSI_FLAGS); |
5797 | + val |= PCI_MSI_FLAGS_ENABLE; |
5798 | + dw_pcie_writew_dbi(pci, PCIE_RC_IMX6_MSI_CAP + PCI_MSI_FLAGS, |
5799 | + val); |
5800 | + } |
5801 | + |
5802 | return 0; |
5803 | } |
5804 | |
5805 | diff --git a/drivers/pci/switch/switchtec.c b/drivers/pci/switch/switchtec.c |
5806 | index 54a8b30dda38..37d0c15c9eeb 100644 |
5807 | --- a/drivers/pci/switch/switchtec.c |
5808 | +++ b/drivers/pci/switch/switchtec.c |
5809 | @@ -800,6 +800,7 @@ static int ioctl_event_ctl(struct switchtec_dev *stdev, |
5810 | { |
5811 | int ret; |
5812 | int nr_idxs; |
5813 | + unsigned int event_flags; |
5814 | struct switchtec_ioctl_event_ctl ctl; |
5815 | |
5816 | if (copy_from_user(&ctl, uctl, sizeof(ctl))) |
5817 | @@ -821,7 +822,9 @@ static int ioctl_event_ctl(struct switchtec_dev *stdev, |
5818 | else |
5819 | return -EINVAL; |
5820 | |
5821 | + event_flags = ctl.flags; |
5822 | for (ctl.index = 0; ctl.index < nr_idxs; ctl.index++) { |
5823 | + ctl.flags = event_flags; |
5824 | ret = event_ctl(stdev, &ctl); |
5825 | if (ret < 0) |
5826 | return ret; |
5827 | diff --git a/drivers/perf/arm_spe_pmu.c b/drivers/perf/arm_spe_pmu.c |
5828 | index 54ec278d2fc4..e1a77b2de78a 100644 |
5829 | --- a/drivers/perf/arm_spe_pmu.c |
5830 | +++ b/drivers/perf/arm_spe_pmu.c |
5831 | @@ -927,6 +927,11 @@ static int arm_spe_pmu_perf_init(struct arm_spe_pmu *spe_pmu) |
5832 | |
5833 | idx = atomic_inc_return(&pmu_idx); |
5834 | name = devm_kasprintf(dev, GFP_KERNEL, "%s_%d", PMUNAME, idx); |
5835 | + if (!name) { |
5836 | + dev_err(dev, "failed to allocate name for pmu %d\n", idx); |
5837 | + return -ENOMEM; |
5838 | + } |
5839 | + |
5840 | return perf_pmu_register(&spe_pmu->pmu, name, -1); |
5841 | } |
5842 | |
5843 | diff --git a/drivers/phy/allwinner/phy-sun4i-usb.c b/drivers/phy/allwinner/phy-sun4i-usb.c |
5844 | index d4dcd39b8d76..881078ff73f6 100644 |
5845 | --- a/drivers/phy/allwinner/phy-sun4i-usb.c |
5846 | +++ b/drivers/phy/allwinner/phy-sun4i-usb.c |
5847 | @@ -126,6 +126,7 @@ struct sun4i_usb_phy_cfg { |
5848 | bool dedicated_clocks; |
5849 | bool enable_pmu_unk1; |
5850 | bool phy0_dual_route; |
5851 | + int missing_phys; |
5852 | }; |
5853 | |
5854 | struct sun4i_usb_phy_data { |
5855 | @@ -646,6 +647,9 @@ static struct phy *sun4i_usb_phy_xlate(struct device *dev, |
5856 | if (args->args[0] >= data->cfg->num_phys) |
5857 | return ERR_PTR(-ENODEV); |
5858 | |
5859 | + if (data->cfg->missing_phys & BIT(args->args[0])) |
5860 | + return ERR_PTR(-ENODEV); |
5861 | + |
5862 | return data->phys[args->args[0]].phy; |
5863 | } |
5864 | |
5865 | @@ -741,6 +745,9 @@ static int sun4i_usb_phy_probe(struct platform_device *pdev) |
5866 | struct sun4i_usb_phy *phy = data->phys + i; |
5867 | char name[16]; |
5868 | |
5869 | + if (data->cfg->missing_phys & BIT(i)) |
5870 | + continue; |
5871 | + |
5872 | snprintf(name, sizeof(name), "usb%d_vbus", i); |
5873 | phy->vbus = devm_regulator_get_optional(dev, name); |
5874 | if (IS_ERR(phy->vbus)) { |
5875 | diff --git a/drivers/pinctrl/bcm/pinctrl-bcm2835.c b/drivers/pinctrl/bcm/pinctrl-bcm2835.c |
5876 | index fa530913a2c8..08925d24180b 100644 |
5877 | --- a/drivers/pinctrl/bcm/pinctrl-bcm2835.c |
5878 | +++ b/drivers/pinctrl/bcm/pinctrl-bcm2835.c |
5879 | @@ -90,7 +90,7 @@ struct bcm2835_pinctrl { |
5880 | struct gpio_chip gpio_chip; |
5881 | struct pinctrl_gpio_range gpio_range; |
5882 | |
5883 | - spinlock_t irq_lock[BCM2835_NUM_BANKS]; |
5884 | + raw_spinlock_t irq_lock[BCM2835_NUM_BANKS]; |
5885 | }; |
5886 | |
5887 | /* pins are just named GPIO0..GPIO53 */ |
5888 | @@ -461,10 +461,10 @@ static void bcm2835_gpio_irq_enable(struct irq_data *data) |
5889 | unsigned bank = GPIO_REG_OFFSET(gpio); |
5890 | unsigned long flags; |
5891 | |
5892 | - spin_lock_irqsave(&pc->irq_lock[bank], flags); |
5893 | + raw_spin_lock_irqsave(&pc->irq_lock[bank], flags); |
5894 | set_bit(offset, &pc->enabled_irq_map[bank]); |
5895 | bcm2835_gpio_irq_config(pc, gpio, true); |
5896 | - spin_unlock_irqrestore(&pc->irq_lock[bank], flags); |
5897 | + raw_spin_unlock_irqrestore(&pc->irq_lock[bank], flags); |
5898 | } |
5899 | |
5900 | static void bcm2835_gpio_irq_disable(struct irq_data *data) |
5901 | @@ -476,12 +476,12 @@ static void bcm2835_gpio_irq_disable(struct irq_data *data) |
5902 | unsigned bank = GPIO_REG_OFFSET(gpio); |
5903 | unsigned long flags; |
5904 | |
5905 | - spin_lock_irqsave(&pc->irq_lock[bank], flags); |
5906 | + raw_spin_lock_irqsave(&pc->irq_lock[bank], flags); |
5907 | bcm2835_gpio_irq_config(pc, gpio, false); |
5908 | /* Clear events that were latched prior to clearing event sources */ |
5909 | bcm2835_gpio_set_bit(pc, GPEDS0, gpio); |
5910 | clear_bit(offset, &pc->enabled_irq_map[bank]); |
5911 | - spin_unlock_irqrestore(&pc->irq_lock[bank], flags); |
5912 | + raw_spin_unlock_irqrestore(&pc->irq_lock[bank], flags); |
5913 | } |
5914 | |
5915 | static int __bcm2835_gpio_irq_set_type_disabled(struct bcm2835_pinctrl *pc, |
5916 | @@ -584,7 +584,7 @@ static int bcm2835_gpio_irq_set_type(struct irq_data *data, unsigned int type) |
5917 | unsigned long flags; |
5918 | int ret; |
5919 | |
5920 | - spin_lock_irqsave(&pc->irq_lock[bank], flags); |
5921 | + raw_spin_lock_irqsave(&pc->irq_lock[bank], flags); |
5922 | |
5923 | if (test_bit(offset, &pc->enabled_irq_map[bank])) |
5924 | ret = __bcm2835_gpio_irq_set_type_enabled(pc, gpio, type); |
5925 | @@ -596,7 +596,7 @@ static int bcm2835_gpio_irq_set_type(struct irq_data *data, unsigned int type) |
5926 | else |
5927 | irq_set_handler_locked(data, handle_level_irq); |
5928 | |
5929 | - spin_unlock_irqrestore(&pc->irq_lock[bank], flags); |
5930 | + raw_spin_unlock_irqrestore(&pc->irq_lock[bank], flags); |
5931 | |
5932 | return ret; |
5933 | } |
5934 | @@ -1047,7 +1047,7 @@ static int bcm2835_pinctrl_probe(struct platform_device *pdev) |
5935 | for_each_set_bit(offset, &events, 32) |
5936 | bcm2835_gpio_wr(pc, GPEDS0 + i * 4, BIT(offset)); |
5937 | |
5938 | - spin_lock_init(&pc->irq_lock[i]); |
5939 | + raw_spin_lock_init(&pc->irq_lock[i]); |
5940 | } |
5941 | |
5942 | err = gpiochip_add_data(&pc->gpio_chip, pc); |
5943 | diff --git a/drivers/pinctrl/meson/pinctrl-meson8.c b/drivers/pinctrl/meson/pinctrl-meson8.c |
5944 | index 86466173114d..e482672e833a 100644 |
5945 | --- a/drivers/pinctrl/meson/pinctrl-meson8.c |
5946 | +++ b/drivers/pinctrl/meson/pinctrl-meson8.c |
5947 | @@ -807,7 +807,9 @@ static const char * const gpio_groups[] = { |
5948 | "BOOT_5", "BOOT_6", "BOOT_7", "BOOT_8", "BOOT_9", |
5949 | "BOOT_10", "BOOT_11", "BOOT_12", "BOOT_13", "BOOT_14", |
5950 | "BOOT_15", "BOOT_16", "BOOT_17", "BOOT_18", |
5951 | +}; |
5952 | |
5953 | +static const char * const gpio_aobus_groups[] = { |
5954 | "GPIOAO_0", "GPIOAO_1", "GPIOAO_2", "GPIOAO_3", |
5955 | "GPIOAO_4", "GPIOAO_5", "GPIOAO_6", "GPIOAO_7", |
5956 | "GPIOAO_8", "GPIOAO_9", "GPIOAO_10", "GPIOAO_11", |
5957 | @@ -1030,6 +1032,7 @@ static struct meson_pmx_func meson8_cbus_functions[] = { |
5958 | }; |
5959 | |
5960 | static struct meson_pmx_func meson8_aobus_functions[] = { |
5961 | + FUNCTION(gpio_aobus), |
5962 | FUNCTION(uart_ao), |
5963 | FUNCTION(remote), |
5964 | FUNCTION(i2c_slave_ao), |
5965 | diff --git a/drivers/pinctrl/meson/pinctrl-meson8b.c b/drivers/pinctrl/meson/pinctrl-meson8b.c |
5966 | index 647ad15d5c3c..91cffc051055 100644 |
5967 | --- a/drivers/pinctrl/meson/pinctrl-meson8b.c |
5968 | +++ b/drivers/pinctrl/meson/pinctrl-meson8b.c |
5969 | @@ -646,16 +646,18 @@ static const char * const gpio_groups[] = { |
5970 | "BOOT_10", "BOOT_11", "BOOT_12", "BOOT_13", "BOOT_14", |
5971 | "BOOT_15", "BOOT_16", "BOOT_17", "BOOT_18", |
5972 | |
5973 | - "GPIOAO_0", "GPIOAO_1", "GPIOAO_2", "GPIOAO_3", |
5974 | - "GPIOAO_4", "GPIOAO_5", "GPIOAO_6", "GPIOAO_7", |
5975 | - "GPIOAO_8", "GPIOAO_9", "GPIOAO_10", "GPIOAO_11", |
5976 | - "GPIOAO_12", "GPIOAO_13", "GPIO_BSD_EN", "GPIO_TEST_N", |
5977 | - |
5978 | "DIF_0_P", "DIF_0_N", "DIF_1_P", "DIF_1_N", |
5979 | "DIF_2_P", "DIF_2_N", "DIF_3_P", "DIF_3_N", |
5980 | "DIF_4_P", "DIF_4_N" |
5981 | }; |
5982 | |
5983 | +static const char * const gpio_aobus_groups[] = { |
5984 | + "GPIOAO_0", "GPIOAO_1", "GPIOAO_2", "GPIOAO_3", |
5985 | + "GPIOAO_4", "GPIOAO_5", "GPIOAO_6", "GPIOAO_7", |
5986 | + "GPIOAO_8", "GPIOAO_9", "GPIOAO_10", "GPIOAO_11", |
5987 | + "GPIOAO_12", "GPIOAO_13", "GPIO_BSD_EN", "GPIO_TEST_N" |
5988 | +}; |
5989 | + |
5990 | static const char * const sd_a_groups[] = { |
5991 | "sd_d0_a", "sd_d1_a", "sd_d2_a", "sd_d3_a", "sd_clk_a", |
5992 | "sd_cmd_a" |
5993 | @@ -871,6 +873,7 @@ static struct meson_pmx_func meson8b_cbus_functions[] = { |
5994 | }; |
5995 | |
5996 | static struct meson_pmx_func meson8b_aobus_functions[] = { |
5997 | + FUNCTION(gpio_aobus), |
5998 | FUNCTION(uart_ao), |
5999 | FUNCTION(uart_ao_b), |
6000 | FUNCTION(i2c_slave_ao), |
6001 | diff --git a/drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c b/drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c |
6002 | index 7ad50d9268aa..3bda620d18bb 100644 |
6003 | --- a/drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c |
6004 | +++ b/drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c |
6005 | @@ -1932,6 +1932,9 @@ static int npcm7xx_gpio_of(struct npcm7xx_pinctrl *pctrl) |
6006 | pctrl->gpio_bank[id].gc.label = |
6007 | devm_kasprintf(pctrl->dev, GFP_KERNEL, "%pOF", |
6008 | np); |
6009 | + if (pctrl->gpio_bank[id].gc.label == NULL) |
6010 | + return -ENOMEM; |
6011 | + |
6012 | pctrl->gpio_bank[id].gc.dbg_show = npcmgpio_dbg_show; |
6013 | pctrl->gpio_bank[id].direction_input = |
6014 | pctrl->gpio_bank[id].gc.direction_input; |
6015 | diff --git a/drivers/pinctrl/pinctrl-rza1.c b/drivers/pinctrl/pinctrl-rza1.c |
6016 | index 14eb576c04a2..9cfe9d0520ac 100644 |
6017 | --- a/drivers/pinctrl/pinctrl-rza1.c |
6018 | +++ b/drivers/pinctrl/pinctrl-rza1.c |
6019 | @@ -1225,6 +1225,9 @@ static int rza1_parse_gpiochip(struct rza1_pinctrl *rza1_pctl, |
6020 | chip->base = -1; |
6021 | chip->label = devm_kasprintf(rza1_pctl->dev, GFP_KERNEL, "%pOFn", |
6022 | np); |
6023 | + if (!chip->label) |
6024 | + return -ENOMEM; |
6025 | + |
6026 | chip->ngpio = of_args.args[2]; |
6027 | chip->of_node = np; |
6028 | chip->parent = rza1_pctl->dev; |
6029 | @@ -1326,6 +1329,8 @@ static int rza1_pinctrl_register(struct rza1_pinctrl *rza1_pctl) |
6030 | pins[i].number = i; |
6031 | pins[i].name = devm_kasprintf(rza1_pctl->dev, GFP_KERNEL, |
6032 | "P%u-%u", port, pin); |
6033 | + if (!pins[i].name) |
6034 | + return -ENOMEM; |
6035 | |
6036 | if (i % RZA1_PINS_PER_PORT == 0) { |
6037 | /* |
6038 | diff --git a/drivers/pinctrl/pinctrl-sx150x.c b/drivers/pinctrl/pinctrl-sx150x.c |
6039 | index cbf58a10113d..4d87d75b9c6e 100644 |
6040 | --- a/drivers/pinctrl/pinctrl-sx150x.c |
6041 | +++ b/drivers/pinctrl/pinctrl-sx150x.c |
6042 | @@ -1166,7 +1166,6 @@ static int sx150x_probe(struct i2c_client *client, |
6043 | } |
6044 | |
6045 | /* Register GPIO controller */ |
6046 | - pctl->gpio.label = devm_kstrdup(dev, client->name, GFP_KERNEL); |
6047 | pctl->gpio.base = -1; |
6048 | pctl->gpio.ngpio = pctl->data->npins; |
6049 | pctl->gpio.get_direction = sx150x_gpio_get_direction; |
6050 | @@ -1180,6 +1179,10 @@ static int sx150x_probe(struct i2c_client *client, |
6051 | pctl->gpio.of_node = dev->of_node; |
6052 | #endif |
6053 | pctl->gpio.can_sleep = true; |
6054 | + pctl->gpio.label = devm_kstrdup(dev, client->name, GFP_KERNEL); |
6055 | + if (!pctl->gpio.label) |
6056 | + return -ENOMEM; |
6057 | + |
6058 | /* |
6059 | * Setting multiple pins is not safe when all pins are not |
6060 | * handled by the same regmap register. The oscio pin (present |
6061 | @@ -1200,13 +1203,15 @@ static int sx150x_probe(struct i2c_client *client, |
6062 | |
6063 | /* Add Interrupt support if an irq is specified */ |
6064 | if (client->irq > 0) { |
6065 | - pctl->irq_chip.name = devm_kstrdup(dev, client->name, |
6066 | - GFP_KERNEL); |
6067 | pctl->irq_chip.irq_mask = sx150x_irq_mask; |
6068 | pctl->irq_chip.irq_unmask = sx150x_irq_unmask; |
6069 | pctl->irq_chip.irq_set_type = sx150x_irq_set_type; |
6070 | pctl->irq_chip.irq_bus_lock = sx150x_irq_bus_lock; |
6071 | pctl->irq_chip.irq_bus_sync_unlock = sx150x_irq_bus_sync_unlock; |
6072 | + pctl->irq_chip.name = devm_kstrdup(dev, client->name, |
6073 | + GFP_KERNEL); |
6074 | + if (!pctl->irq_chip.name) |
6075 | + return -ENOMEM; |
6076 | |
6077 | pctl->irq.masked = ~0; |
6078 | pctl->irq.sense = 0; |
6079 | diff --git a/drivers/platform/chrome/cros_ec_proto.c b/drivers/platform/chrome/cros_ec_proto.c |
6080 | index b6fd4838f60f..e5d5b1adb5a9 100644 |
6081 | --- a/drivers/platform/chrome/cros_ec_proto.c |
6082 | +++ b/drivers/platform/chrome/cros_ec_proto.c |
6083 | @@ -575,6 +575,7 @@ static int get_keyboard_state_event(struct cros_ec_device *ec_dev) |
6084 | |
6085 | int cros_ec_get_next_event(struct cros_ec_device *ec_dev, bool *wake_event) |
6086 | { |
6087 | + u8 event_type; |
6088 | u32 host_event; |
6089 | int ret; |
6090 | |
6091 | @@ -594,11 +595,22 @@ int cros_ec_get_next_event(struct cros_ec_device *ec_dev, bool *wake_event) |
6092 | return ret; |
6093 | |
6094 | if (wake_event) { |
6095 | + event_type = ec_dev->event_data.event_type; |
6096 | host_event = cros_ec_get_host_event(ec_dev); |
6097 | |
6098 | - /* Consider non-host_event as wake event */ |
6099 | - *wake_event = !host_event || |
6100 | - !!(host_event & ec_dev->host_event_wake_mask); |
6101 | + /* |
6102 | + * Sensor events need to be parsed by the sensor sub-device. |
6103 | + * Defer them, and don't report the wakeup here. |
6104 | + */ |
6105 | + if (event_type == EC_MKBP_EVENT_SENSOR_FIFO) |
6106 | + *wake_event = false; |
6107 | + /* Masked host-events should not count as wake events. */ |
6108 | + else if (host_event && |
6109 | + !(host_event & ec_dev->host_event_wake_mask)) |
6110 | + *wake_event = false; |
6111 | + /* Consider all other events as wake events. */ |
6112 | + else |
6113 | + *wake_event = true; |
6114 | } |
6115 | |
6116 | return ret; |
6117 | diff --git a/drivers/platform/x86/intel_atomisp2_pm.c b/drivers/platform/x86/intel_atomisp2_pm.c |
6118 | index 9371603a0ac9..2a8c7a4cea35 100644 |
6119 | --- a/drivers/platform/x86/intel_atomisp2_pm.c |
6120 | +++ b/drivers/platform/x86/intel_atomisp2_pm.c |
6121 | @@ -33,46 +33,45 @@ |
6122 | #define ISPSSPM0_IUNIT_POWER_ON 0x0 |
6123 | #define ISPSSPM0_IUNIT_POWER_OFF 0x3 |
6124 | |
6125 | -static int isp_probe(struct pci_dev *dev, const struct pci_device_id *id) |
6126 | +static int isp_set_power(struct pci_dev *dev, bool enable) |
6127 | { |
6128 | unsigned long timeout; |
6129 | - u32 val; |
6130 | - |
6131 | - pci_write_config_dword(dev, PCI_INTERRUPT_CTRL, 0); |
6132 | - |
6133 | - /* |
6134 | - * MRFLD IUNIT DPHY is located in an always-power-on island |
6135 | - * MRFLD HW design need all CSI ports are disabled before |
6136 | - * powering down the IUNIT. |
6137 | - */ |
6138 | - pci_read_config_dword(dev, PCI_CSI_CONTROL, &val); |
6139 | - val |= PCI_CSI_CONTROL_PORTS_OFF_MASK; |
6140 | - pci_write_config_dword(dev, PCI_CSI_CONTROL, val); |
6141 | + u32 val = enable ? ISPSSPM0_IUNIT_POWER_ON : |
6142 | + ISPSSPM0_IUNIT_POWER_OFF; |
6143 | |
6144 | - /* Write 0x3 to ISPSSPM0 bit[1:0] to power off the IUNIT */ |
6145 | + /* Write to ISPSSPM0 bit[1:0] to power on/off the IUNIT */ |
6146 | iosf_mbi_modify(BT_MBI_UNIT_PMC, MBI_REG_READ, ISPSSPM0, |
6147 | - ISPSSPM0_IUNIT_POWER_OFF, ISPSSPM0_ISPSSC_MASK); |
6148 | + val, ISPSSPM0_ISPSSC_MASK); |
6149 | |
6150 | /* |
6151 | * There should be no IUNIT access while power-down is |
6152 | * in progress HW sighting: 4567865 |
6153 | * Wait up to 50 ms for the IUNIT to shut down. |
6154 | + * And we do the same for power on. |
6155 | */ |
6156 | timeout = jiffies + msecs_to_jiffies(50); |
6157 | while (1) { |
6158 | - /* Wait until ISPSSPM0 bit[25:24] shows 0x3 */ |
6159 | - iosf_mbi_read(BT_MBI_UNIT_PMC, MBI_REG_READ, ISPSSPM0, &val); |
6160 | - val = (val & ISPSSPM0_ISPSSS_MASK) >> ISPSSPM0_ISPSSS_OFFSET; |
6161 | - if (val == ISPSSPM0_IUNIT_POWER_OFF) |
6162 | + u32 tmp; |
6163 | + |
6164 | + /* Wait until ISPSSPM0 bit[25:24] shows the right value */ |
6165 | + iosf_mbi_read(BT_MBI_UNIT_PMC, MBI_REG_READ, ISPSSPM0, &tmp); |
6166 | + tmp = (tmp & ISPSSPM0_ISPSSS_MASK) >> ISPSSPM0_ISPSSS_OFFSET; |
6167 | + if (tmp == val) |
6168 | break; |
6169 | |
6170 | if (time_after(jiffies, timeout)) { |
6171 | - dev_err(&dev->dev, "IUNIT power-off timeout.\n"); |
6172 | + dev_err(&dev->dev, "IUNIT power-%s timeout.\n", |
6173 | + enable ? "on" : "off"); |
6174 | return -EBUSY; |
6175 | } |
6176 | usleep_range(1000, 2000); |
6177 | } |
6178 | |
6179 | + return 0; |
6180 | +} |
6181 | + |
6182 | +static int isp_probe(struct pci_dev *dev, const struct pci_device_id *id) |
6183 | +{ |
6184 | pm_runtime_allow(&dev->dev); |
6185 | pm_runtime_put_sync_suspend(&dev->dev); |
6186 | |
6187 | @@ -87,11 +86,40 @@ static void isp_remove(struct pci_dev *dev) |
6188 | |
6189 | static int isp_pci_suspend(struct device *dev) |
6190 | { |
6191 | + struct pci_dev *pdev = to_pci_dev(dev); |
6192 | + u32 val; |
6193 | + |
6194 | + pci_write_config_dword(pdev, PCI_INTERRUPT_CTRL, 0); |
6195 | + |
6196 | + /* |
6197 | + * MRFLD IUNIT DPHY is located in an always-power-on island |
6198 | + * MRFLD HW design need all CSI ports are disabled before |
6199 | + * powering down the IUNIT. |
6200 | + */ |
6201 | + pci_read_config_dword(pdev, PCI_CSI_CONTROL, &val); |
6202 | + val |= PCI_CSI_CONTROL_PORTS_OFF_MASK; |
6203 | + pci_write_config_dword(pdev, PCI_CSI_CONTROL, val); |
6204 | + |
6205 | + /* |
6206 | + * We lose config space access when punit power gates |
6207 | + * the ISP. Can't use pci_set_power_state() because |
6208 | + * pmcsr won't actually change when we write to it. |
6209 | + */ |
6210 | + pci_save_state(pdev); |
6211 | + pdev->current_state = PCI_D3cold; |
6212 | + isp_set_power(pdev, false); |
6213 | + |
6214 | return 0; |
6215 | } |
6216 | |
6217 | static int isp_pci_resume(struct device *dev) |
6218 | { |
6219 | + struct pci_dev *pdev = to_pci_dev(dev); |
6220 | + |
6221 | + isp_set_power(pdev, true); |
6222 | + pdev->current_state = PCI_D0; |
6223 | + pci_restore_state(pdev); |
6224 | + |
6225 | return 0; |
6226 | } |
6227 | |
6228 | diff --git a/drivers/platform/x86/mlx-platform.c b/drivers/platform/x86/mlx-platform.c |
6229 | index c2c3a1a19879..14f88bfabd5d 100644 |
6230 | --- a/drivers/platform/x86/mlx-platform.c |
6231 | +++ b/drivers/platform/x86/mlx-platform.c |
6232 | @@ -83,12 +83,12 @@ |
6233 | #define MLXPLAT_CPLD_LPC_REG_TACHO4_OFFSET 0xe7 |
6234 | #define MLXPLAT_CPLD_LPC_REG_TACHO5_OFFSET 0xe8 |
6235 | #define MLXPLAT_CPLD_LPC_REG_TACHO6_OFFSET 0xe9 |
6236 | -#define MLXPLAT_CPLD_LPC_REG_TACHO7_OFFSET 0xea |
6237 | -#define MLXPLAT_CPLD_LPC_REG_TACHO8_OFFSET 0xeb |
6238 | -#define MLXPLAT_CPLD_LPC_REG_TACHO9_OFFSET 0xec |
6239 | -#define MLXPLAT_CPLD_LPC_REG_TACHO10_OFFSET 0xed |
6240 | -#define MLXPLAT_CPLD_LPC_REG_TACHO11_OFFSET 0xee |
6241 | -#define MLXPLAT_CPLD_LPC_REG_TACHO12_OFFSET 0xef |
6242 | +#define MLXPLAT_CPLD_LPC_REG_TACHO7_OFFSET 0xeb |
6243 | +#define MLXPLAT_CPLD_LPC_REG_TACHO8_OFFSET 0xec |
6244 | +#define MLXPLAT_CPLD_LPC_REG_TACHO9_OFFSET 0xed |
6245 | +#define MLXPLAT_CPLD_LPC_REG_TACHO10_OFFSET 0xee |
6246 | +#define MLXPLAT_CPLD_LPC_REG_TACHO11_OFFSET 0xef |
6247 | +#define MLXPLAT_CPLD_LPC_REG_TACHO12_OFFSET 0xf0 |
6248 | #define MLXPLAT_CPLD_LPC_IO_RANGE 0x100 |
6249 | #define MLXPLAT_CPLD_LPC_I2C_CH1_OFF 0xdb |
6250 | #define MLXPLAT_CPLD_LPC_I2C_CH2_OFF 0xda |
6251 | diff --git a/drivers/ptp/ptp_chardev.c b/drivers/ptp/ptp_chardev.c |
6252 | index 2012551d93e0..796eeffdf93b 100644 |
6253 | --- a/drivers/ptp/ptp_chardev.c |
6254 | +++ b/drivers/ptp/ptp_chardev.c |
6255 | @@ -228,7 +228,9 @@ long ptp_ioctl(struct posix_clock *pc, unsigned int cmd, unsigned long arg) |
6256 | pct->sec = ts.tv_sec; |
6257 | pct->nsec = ts.tv_nsec; |
6258 | pct++; |
6259 | - ptp->info->gettime64(ptp->info, &ts); |
6260 | + err = ptp->info->gettime64(ptp->info, &ts); |
6261 | + if (err) |
6262 | + goto out; |
6263 | pct->sec = ts.tv_sec; |
6264 | pct->nsec = ts.tv_nsec; |
6265 | pct++; |
6266 | @@ -281,6 +283,7 @@ long ptp_ioctl(struct posix_clock *pc, unsigned int cmd, unsigned long arg) |
6267 | break; |
6268 | } |
6269 | |
6270 | +out: |
6271 | kfree(sysoff); |
6272 | return err; |
6273 | } |
6274 | diff --git a/drivers/ptp/ptp_clock.c b/drivers/ptp/ptp_clock.c |
6275 | index 5419a89d300e..9b8aa6718ee7 100644 |
6276 | --- a/drivers/ptp/ptp_clock.c |
6277 | +++ b/drivers/ptp/ptp_clock.c |
6278 | @@ -249,8 +249,10 @@ struct ptp_clock *ptp_clock_register(struct ptp_clock_info *info, |
6279 | ptp->dev = device_create_with_groups(ptp_class, parent, ptp->devid, |
6280 | ptp, ptp->pin_attr_groups, |
6281 | "ptp%d", ptp->index); |
6282 | - if (IS_ERR(ptp->dev)) |
6283 | + if (IS_ERR(ptp->dev)) { |
6284 | + err = PTR_ERR(ptp->dev); |
6285 | goto no_device; |
6286 | + } |
6287 | |
6288 | /* Register a new PPS source. */ |
6289 | if (info->pps) { |
6290 | @@ -261,6 +263,7 @@ struct ptp_clock *ptp_clock_register(struct ptp_clock_info *info, |
6291 | pps.owner = info->owner; |
6292 | ptp->pps_source = pps_register_source(&pps, PTP_PPS_DEFAULTS); |
6293 | if (!ptp->pps_source) { |
6294 | + err = -EINVAL; |
6295 | pr_err("failed to register pps source\n"); |
6296 | goto no_pps; |
6297 | } |
6298 | diff --git a/drivers/s390/crypto/zcrypt_error.h b/drivers/s390/crypto/zcrypt_error.h |
6299 | index 240b27f3f5f6..f34ee41cbed8 100644 |
6300 | --- a/drivers/s390/crypto/zcrypt_error.h |
6301 | +++ b/drivers/s390/crypto/zcrypt_error.h |
6302 | @@ -51,6 +51,7 @@ struct error_hdr { |
6303 | #define REP82_ERROR_FORMAT_FIELD 0x29 |
6304 | #define REP82_ERROR_INVALID_COMMAND 0x30 |
6305 | #define REP82_ERROR_MALFORMED_MSG 0x40 |
6306 | +#define REP82_ERROR_INVALID_SPECIAL_CMD 0x41 |
6307 | #define REP82_ERROR_INVALID_DOMAIN_PRECHECK 0x42 |
6308 | #define REP82_ERROR_RESERVED_FIELDO 0x50 /* old value */ |
6309 | #define REP82_ERROR_WORD_ALIGNMENT 0x60 |
6310 | @@ -89,6 +90,7 @@ static inline int convert_error(struct zcrypt_queue *zq, |
6311 | case REP88_ERROR_MESSAGE_MALFORMD: |
6312 | case REP82_ERROR_INVALID_DOMAIN_PRECHECK: |
6313 | case REP82_ERROR_INVALID_DOMAIN_PENDING: |
6314 | + case REP82_ERROR_INVALID_SPECIAL_CMD: |
6315 | // REP88_ERROR_INVALID_KEY // '82' CEX2A |
6316 | // REP88_ERROR_OPERAND // '84' CEX2A |
6317 | // REP88_ERROR_OPERAND_EVEN_MOD // '85' CEX2A |
6318 | diff --git a/drivers/s390/net/qeth_core.h b/drivers/s390/net/qeth_core.h |
6319 | index 04e294d1d16d..99af1a0a3314 100644 |
6320 | --- a/drivers/s390/net/qeth_core.h |
6321 | +++ b/drivers/s390/net/qeth_core.h |
6322 | @@ -665,7 +665,6 @@ struct qeth_card_blkt { |
6323 | |
6324 | #define QETH_BROADCAST_WITH_ECHO 0x01 |
6325 | #define QETH_BROADCAST_WITHOUT_ECHO 0x02 |
6326 | -#define QETH_LAYER2_MAC_READ 0x01 |
6327 | #define QETH_LAYER2_MAC_REGISTERED 0x02 |
6328 | struct qeth_card_info { |
6329 | unsigned short unit_addr2; |
6330 | diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c |
6331 | index 254065271867..0c9a5250dd93 100644 |
6332 | --- a/drivers/s390/net/qeth_core_main.c |
6333 | +++ b/drivers/s390/net/qeth_core_main.c |
6334 | @@ -4235,16 +4235,18 @@ static int qeth_setadpparms_change_macaddr_cb(struct qeth_card *card, |
6335 | struct qeth_reply *reply, unsigned long data) |
6336 | { |
6337 | struct qeth_ipa_cmd *cmd = (struct qeth_ipa_cmd *) data; |
6338 | + struct qeth_ipacmd_setadpparms *adp_cmd; |
6339 | |
6340 | QETH_CARD_TEXT(card, 4, "chgmaccb"); |
6341 | if (qeth_setadpparms_inspect_rc(cmd)) |
6342 | return 0; |
6343 | |
6344 | - if (IS_LAYER3(card) || !(card->info.mac_bits & QETH_LAYER2_MAC_READ)) { |
6345 | - ether_addr_copy(card->dev->dev_addr, |
6346 | - cmd->data.setadapterparms.data.change_addr.addr); |
6347 | - card->info.mac_bits |= QETH_LAYER2_MAC_READ; |
6348 | - } |
6349 | + adp_cmd = &cmd->data.setadapterparms; |
6350 | + if (IS_LAYER2(card) && IS_OSD(card) && !IS_VM_NIC(card) && |
6351 | + !(adp_cmd->hdr.flags & QETH_SETADP_FLAGS_VIRTUAL_MAC)) |
6352 | + return 0; |
6353 | + |
6354 | + ether_addr_copy(card->dev->dev_addr, adp_cmd->data.change_addr.addr); |
6355 | return 0; |
6356 | } |
6357 | |
6358 | diff --git a/drivers/s390/net/qeth_core_mpc.h b/drivers/s390/net/qeth_core_mpc.h |
6359 | index 3e54be201b27..10cc487c16d6 100644 |
6360 | --- a/drivers/s390/net/qeth_core_mpc.h |
6361 | +++ b/drivers/s390/net/qeth_core_mpc.h |
6362 | @@ -80,7 +80,9 @@ enum qeth_card_types { |
6363 | }; |
6364 | |
6365 | #define IS_IQD(card) ((card)->info.type == QETH_CARD_TYPE_IQD) |
6366 | +#define IS_OSD(card) ((card)->info.type == QETH_CARD_TYPE_OSD) |
6367 | #define IS_OSN(card) ((card)->info.type == QETH_CARD_TYPE_OSN) |
6368 | +#define IS_VM_NIC(card) ((card)->info.guestlan) |
6369 | |
6370 | #define QETH_MPC_DIFINFO_LEN_INDICATES_LINK_TYPE 0x18 |
6371 | /* only the first two bytes are looked at in qeth_get_cardname_short */ |
6372 | @@ -529,17 +531,20 @@ struct qeth_query_switch_attributes { |
6373 | __u8 reserved3[8]; |
6374 | }; |
6375 | |
6376 | +#define QETH_SETADP_FLAGS_VIRTUAL_MAC 0x80 /* for CHANGE_ADDR_READ_MAC */ |
6377 | + |
6378 | struct qeth_ipacmd_setadpparms_hdr { |
6379 | - __u32 supp_hw_cmds; |
6380 | - __u32 reserved1; |
6381 | - __u16 cmdlength; |
6382 | - __u16 reserved2; |
6383 | - __u32 command_code; |
6384 | - __u16 return_code; |
6385 | - __u8 used_total; |
6386 | - __u8 seq_no; |
6387 | - __u32 reserved3; |
6388 | -} __attribute__ ((packed)); |
6389 | + u32 supp_hw_cmds; |
6390 | + u32 reserved1; |
6391 | + u16 cmdlength; |
6392 | + u16 reserved2; |
6393 | + u32 command_code; |
6394 | + u16 return_code; |
6395 | + u8 used_total; |
6396 | + u8 seq_no; |
6397 | + u8 flags; |
6398 | + u8 reserved3[3]; |
6399 | +}; |
6400 | |
6401 | struct qeth_ipacmd_setadpparms { |
6402 | struct qeth_ipacmd_setadpparms_hdr hdr; |
6403 | diff --git a/drivers/s390/net/qeth_l2_main.c b/drivers/s390/net/qeth_l2_main.c |
6404 | index 2914a1a69f83..8d3601891c62 100644 |
6405 | --- a/drivers/s390/net/qeth_l2_main.c |
6406 | +++ b/drivers/s390/net/qeth_l2_main.c |
6407 | @@ -461,12 +461,9 @@ static int qeth_l2_request_initial_mac(struct qeth_card *card) |
6408 | /* fall back to alternative mechanism: */ |
6409 | } |
6410 | |
6411 | - if (card->info.type == QETH_CARD_TYPE_IQD || |
6412 | - card->info.type == QETH_CARD_TYPE_OSM || |
6413 | - card->info.type == QETH_CARD_TYPE_OSX || |
6414 | - card->info.guestlan) { |
6415 | + if (!IS_OSN(card)) { |
6416 | rc = qeth_setadpparms_change_macaddr(card); |
6417 | - if (!rc) |
6418 | + if (!rc && is_valid_ether_addr(card->dev->dev_addr)) |
6419 | goto out; |
6420 | QETH_DBF_MESSAGE(2, "READ_MAC Assist failed on device %x: %#x\n", |
6421 | CARD_DEVID(card), rc); |
6422 | @@ -917,7 +914,8 @@ static int qeth_l2_setup_netdev(struct qeth_card *card, bool carrier_ok) |
6423 | PAGE_SIZE * (QDIO_MAX_ELEMENTS_PER_BUFFER - 1)); |
6424 | } |
6425 | |
6426 | - qeth_l2_request_initial_mac(card); |
6427 | + if (!is_valid_ether_addr(card->dev->dev_addr)) |
6428 | + qeth_l2_request_initial_mac(card); |
6429 | netif_napi_add(card->dev, &card->napi, qeth_poll, QETH_NAPI_WEIGHT); |
6430 | rc = register_netdev(card->dev); |
6431 | if (!rc && carrier_ok) |
6432 | diff --git a/drivers/scsi/aic94xx/aic94xx_init.c b/drivers/scsi/aic94xx/aic94xx_init.c |
6433 | index 41c4d8abdd4a..38e768057129 100644 |
6434 | --- a/drivers/scsi/aic94xx/aic94xx_init.c |
6435 | +++ b/drivers/scsi/aic94xx/aic94xx_init.c |
6436 | @@ -281,7 +281,7 @@ static ssize_t asd_show_dev_rev(struct device *dev, |
6437 | return snprintf(buf, PAGE_SIZE, "%s\n", |
6438 | asd_dev_rev[asd_ha->revision_id]); |
6439 | } |
6440 | -static DEVICE_ATTR(revision, S_IRUGO, asd_show_dev_rev, NULL); |
6441 | +static DEVICE_ATTR(aic_revision, S_IRUGO, asd_show_dev_rev, NULL); |
6442 | |
6443 | static ssize_t asd_show_dev_bios_build(struct device *dev, |
6444 | struct device_attribute *attr,char *buf) |
6445 | @@ -478,7 +478,7 @@ static int asd_create_dev_attrs(struct asd_ha_struct *asd_ha) |
6446 | { |
6447 | int err; |
6448 | |
6449 | - err = device_create_file(&asd_ha->pcidev->dev, &dev_attr_revision); |
6450 | + err = device_create_file(&asd_ha->pcidev->dev, &dev_attr_aic_revision); |
6451 | if (err) |
6452 | return err; |
6453 | |
6454 | @@ -500,13 +500,13 @@ err_update_bios: |
6455 | err_biosb: |
6456 | device_remove_file(&asd_ha->pcidev->dev, &dev_attr_bios_build); |
6457 | err_rev: |
6458 | - device_remove_file(&asd_ha->pcidev->dev, &dev_attr_revision); |
6459 | + device_remove_file(&asd_ha->pcidev->dev, &dev_attr_aic_revision); |
6460 | return err; |
6461 | } |
6462 | |
6463 | static void asd_remove_dev_attrs(struct asd_ha_struct *asd_ha) |
6464 | { |
6465 | - device_remove_file(&asd_ha->pcidev->dev, &dev_attr_revision); |
6466 | + device_remove_file(&asd_ha->pcidev->dev, &dev_attr_aic_revision); |
6467 | device_remove_file(&asd_ha->pcidev->dev, &dev_attr_bios_build); |
6468 | device_remove_file(&asd_ha->pcidev->dev, &dev_attr_pcba_sn); |
6469 | device_remove_file(&asd_ha->pcidev->dev, &dev_attr_update_bios); |
6470 | diff --git a/drivers/scsi/cxgbi/cxgb4i/Kconfig b/drivers/scsi/cxgbi/cxgb4i/Kconfig |
6471 | index 594f593c8821..f36b76e8e12c 100644 |
6472 | --- a/drivers/scsi/cxgbi/cxgb4i/Kconfig |
6473 | +++ b/drivers/scsi/cxgbi/cxgb4i/Kconfig |
6474 | @@ -1,8 +1,8 @@ |
6475 | config SCSI_CXGB4_ISCSI |
6476 | tristate "Chelsio T4 iSCSI support" |
6477 | depends on PCI && INET && (IPV6 || IPV6=n) |
6478 | - select NETDEVICES |
6479 | - select ETHERNET |
6480 | + depends on THERMAL || !THERMAL |
6481 | + depends on ETHERNET |
6482 | select NET_VENDOR_CHELSIO |
6483 | select CHELSIO_T4 |
6484 | select CHELSIO_LIB |
6485 | diff --git a/drivers/scsi/cxlflash/main.c b/drivers/scsi/cxlflash/main.c |
6486 | index 6637116529aa..f987c40c47a1 100644 |
6487 | --- a/drivers/scsi/cxlflash/main.c |
6488 | +++ b/drivers/scsi/cxlflash/main.c |
6489 | @@ -3694,6 +3694,7 @@ static int cxlflash_probe(struct pci_dev *pdev, |
6490 | host->max_cmd_len = CXLFLASH_MAX_CDB_LEN; |
6491 | |
6492 | cfg = shost_priv(host); |
6493 | + cfg->state = STATE_PROBING; |
6494 | cfg->host = host; |
6495 | rc = alloc_mem(cfg); |
6496 | if (rc) { |
6497 | @@ -3782,6 +3783,7 @@ out: |
6498 | return rc; |
6499 | |
6500 | out_remove: |
6501 | + cfg->state = STATE_PROBED; |
6502 | cxlflash_remove(pdev); |
6503 | goto out; |
6504 | } |
6505 | diff --git a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c |
6506 | index a369450a1fa7..c3e0be90e19f 100644 |
6507 | --- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c |
6508 | +++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c |
6509 | @@ -494,7 +494,7 @@ static void init_reg_v3_hw(struct hisi_hba *hisi_hba) |
6510 | hisi_sas_phy_write32(hisi_hba, i, PHYCTRL_OOB_RESTART_MSK, 0x1); |
6511 | hisi_sas_phy_write32(hisi_hba, i, STP_LINK_TIMER, 0x7f7a120); |
6512 | hisi_sas_phy_write32(hisi_hba, i, CON_CFG_DRIVER, 0x2a0a01); |
6513 | - |
6514 | + hisi_sas_phy_write32(hisi_hba, i, SAS_SSP_CON_TIMER_CFG, 0x32); |
6515 | /* used for 12G negotiate */ |
6516 | hisi_sas_phy_write32(hisi_hba, i, COARSETUNE_TIME, 0x1e); |
6517 | hisi_sas_phy_write32(hisi_hba, i, AIP_LIMIT, 0x2ffff); |
6518 | diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c |
6519 | index f1c1faa74b46..c2dae02f193e 100644 |
6520 | --- a/drivers/scsi/lpfc/lpfc_els.c |
6521 | +++ b/drivers/scsi/lpfc/lpfc_els.c |
6522 | @@ -242,6 +242,8 @@ lpfc_prep_els_iocb(struct lpfc_vport *vport, uint8_t expectRsp, |
6523 | icmd->ulpCommand = CMD_ELS_REQUEST64_CR; |
6524 | if (elscmd == ELS_CMD_FLOGI) |
6525 | icmd->ulpTimeout = FF_DEF_RATOV * 2; |
6526 | + else if (elscmd == ELS_CMD_LOGO) |
6527 | + icmd->ulpTimeout = phba->fc_ratov; |
6528 | else |
6529 | icmd->ulpTimeout = phba->fc_ratov * 2; |
6530 | } else { |
6531 | @@ -2682,16 +2684,15 @@ lpfc_cmpl_els_logo(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, |
6532 | goto out; |
6533 | } |
6534 | |
6535 | + /* The LOGO will not be retried on failure. A LOGO was |
6536 | + * issued to the remote rport and a ACC or RJT or no Answer are |
6537 | + * all acceptable. Note the failure and move forward with |
6538 | + * discovery. The PLOGI will retry. |
6539 | + */ |
6540 | if (irsp->ulpStatus) { |
6541 | - /* Check for retry */ |
6542 | - if (lpfc_els_retry(phba, cmdiocb, rspiocb)) { |
6543 | - /* ELS command is being retried */ |
6544 | - skip_recovery = 1; |
6545 | - goto out; |
6546 | - } |
6547 | /* LOGO failed */ |
6548 | lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS, |
6549 | - "2756 LOGO failure DID:%06X Status:x%x/x%x\n", |
6550 | + "2756 LOGO failure, No Retry DID:%06X Status:x%x/x%x\n", |
6551 | ndlp->nlp_DID, irsp->ulpStatus, |
6552 | irsp->un.ulpWord[4]); |
6553 | /* Do not call DSM for lpfc_els_abort'ed ELS cmds */ |
6554 | @@ -2737,7 +2738,8 @@ out: |
6555 | * For any other port type, the rpi is unregistered as an implicit |
6556 | * LOGO. |
6557 | */ |
6558 | - if ((ndlp->nlp_type & NLP_FCP_TARGET) && (skip_recovery == 0)) { |
6559 | + if (ndlp->nlp_type & (NLP_FCP_TARGET | NLP_NVME_TARGET) && |
6560 | + skip_recovery == 0) { |
6561 | lpfc_cancel_retry_delay_tmo(vport, ndlp); |
6562 | spin_lock_irqsave(shost->host_lock, flags); |
6563 | ndlp->nlp_flag |= NLP_NPR_2B_DISC; |
6564 | @@ -2770,6 +2772,8 @@ out: |
6565 | * will be stored into the context1 field of the IOCB for the completion |
6566 | * callback function to the LOGO ELS command. |
6567 | * |
6568 | + * Callers of this routine are expected to unregister the RPI first |
6569 | + * |
6570 | * Return code |
6571 | * 0 - successfully issued logo |
6572 | * 1 - failed to issue logo |
6573 | @@ -2811,22 +2815,6 @@ lpfc_issue_els_logo(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, |
6574 | "Issue LOGO: did:x%x", |
6575 | ndlp->nlp_DID, 0, 0); |
6576 | |
6577 | - /* |
6578 | - * If we are issuing a LOGO, we may try to recover the remote NPort |
6579 | - * by issuing a PLOGI later. Even though we issue ELS cmds by the |
6580 | - * VPI, if we have a valid RPI, and that RPI gets unreg'ed while |
6581 | - * that ELS command is in-flight, the HBA returns a IOERR_INVALID_RPI |
6582 | - * for that ELS cmd. To avoid this situation, lets get rid of the |
6583 | - * RPI right now, before any ELS cmds are sent. |
6584 | - */ |
6585 | - spin_lock_irq(shost->host_lock); |
6586 | - ndlp->nlp_flag |= NLP_ISSUE_LOGO; |
6587 | - spin_unlock_irq(shost->host_lock); |
6588 | - if (lpfc_unreg_rpi(vport, ndlp)) { |
6589 | - lpfc_els_free_iocb(phba, elsiocb); |
6590 | - return 0; |
6591 | - } |
6592 | - |
6593 | phba->fc_stat.elsXmitLOGO++; |
6594 | elsiocb->iocb_cmpl = lpfc_cmpl_els_logo; |
6595 | spin_lock_irq(shost->host_lock); |
6596 | @@ -2834,7 +2822,6 @@ lpfc_issue_els_logo(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, |
6597 | ndlp->nlp_flag &= ~NLP_ISSUE_LOGO; |
6598 | spin_unlock_irq(shost->host_lock); |
6599 | rc = lpfc_sli_issue_iocb(phba, LPFC_ELS_RING, elsiocb, 0); |
6600 | - |
6601 | if (rc == IOCB_ERROR) { |
6602 | spin_lock_irq(shost->host_lock); |
6603 | ndlp->nlp_flag &= ~NLP_LOGO_SND; |
6604 | @@ -2842,6 +2829,11 @@ lpfc_issue_els_logo(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, |
6605 | lpfc_els_free_iocb(phba, elsiocb); |
6606 | return 1; |
6607 | } |
6608 | + |
6609 | + spin_lock_irq(shost->host_lock); |
6610 | + ndlp->nlp_prev_state = ndlp->nlp_state; |
6611 | + spin_unlock_irq(shost->host_lock); |
6612 | + lpfc_nlp_set_state(vport, ndlp, NLP_STE_LOGO_ISSUE); |
6613 | return 0; |
6614 | } |
6615 | |
6616 | @@ -5701,6 +5693,9 @@ error: |
6617 | stat = (struct ls_rjt *)(pcmd + sizeof(uint32_t)); |
6618 | stat->un.b.lsRjtRsnCode = LSRJT_UNABLE_TPC; |
6619 | |
6620 | + if (shdr_add_status == ADD_STATUS_OPERATION_ALREADY_ACTIVE) |
6621 | + stat->un.b.lsRjtRsnCodeExp = LSEXP_CMD_IN_PROGRESS; |
6622 | + |
6623 | elsiocb->iocb_cmpl = lpfc_cmpl_els_rsp; |
6624 | phba->fc_stat.elsXmitLSRJT++; |
6625 | rc = lpfc_sli_issue_iocb(phba, LPFC_ELS_RING, elsiocb, 0); |
6626 | @@ -9505,7 +9500,8 @@ lpfc_sli_abts_recover_port(struct lpfc_vport *vport, |
6627 | "rport in state 0x%x\n", ndlp->nlp_state); |
6628 | return; |
6629 | } |
6630 | - lpfc_printf_log(phba, KERN_INFO, LOG_SLI, |
6631 | + lpfc_printf_log(phba, KERN_ERR, |
6632 | + LOG_ELS | LOG_FCP_ERROR | LOG_NVME_IOERR, |
6633 | "3094 Start rport recovery on shost id 0x%x " |
6634 | "fc_id 0x%06x vpi 0x%x rpi 0x%x state 0x%x " |
6635 | "flags 0x%x\n", |
6636 | @@ -9518,8 +9514,8 @@ lpfc_sli_abts_recover_port(struct lpfc_vport *vport, |
6637 | */ |
6638 | spin_lock_irqsave(shost->host_lock, flags); |
6639 | ndlp->nlp_fcp_info &= ~NLP_FCP_2_DEVICE; |
6640 | + ndlp->nlp_flag |= NLP_ISSUE_LOGO; |
6641 | spin_unlock_irqrestore(shost->host_lock, flags); |
6642 | - lpfc_issue_els_logo(vport, ndlp, 0); |
6643 | - lpfc_nlp_set_state(vport, ndlp, NLP_STE_LOGO_ISSUE); |
6644 | + lpfc_unreg_rpi(vport, ndlp); |
6645 | } |
6646 | |
6647 | diff --git a/drivers/scsi/lpfc/lpfc_nportdisc.c b/drivers/scsi/lpfc/lpfc_nportdisc.c |
6648 | index 269808e8480f..394ffbe9cb6d 100644 |
6649 | --- a/drivers/scsi/lpfc/lpfc_nportdisc.c |
6650 | +++ b/drivers/scsi/lpfc/lpfc_nportdisc.c |
6651 | @@ -836,7 +836,9 @@ lpfc_disc_set_adisc(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp) |
6652 | struct Scsi_Host *shost = lpfc_shost_from_vport(vport); |
6653 | |
6654 | if (!(ndlp->nlp_flag & NLP_RPI_REGISTERED)) { |
6655 | + spin_lock_irq(shost->host_lock); |
6656 | ndlp->nlp_flag &= ~NLP_NPR_ADISC; |
6657 | + spin_unlock_irq(shost->host_lock); |
6658 | return 0; |
6659 | } |
6660 | |
6661 | @@ -851,7 +853,10 @@ lpfc_disc_set_adisc(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp) |
6662 | return 1; |
6663 | } |
6664 | } |
6665 | + |
6666 | + spin_lock_irq(shost->host_lock); |
6667 | ndlp->nlp_flag &= ~NLP_NPR_ADISC; |
6668 | + spin_unlock_irq(shost->host_lock); |
6669 | lpfc_unreg_rpi(vport, ndlp); |
6670 | return 0; |
6671 | } |
6672 | diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c |
6673 | index 03c52847ed07..adac18ba84d4 100644 |
6674 | --- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c |
6675 | +++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c |
6676 | @@ -9641,6 +9641,7 @@ static void scsih_remove(struct pci_dev *pdev) |
6677 | |
6678 | /* release all the volumes */ |
6679 | _scsih_ir_shutdown(ioc); |
6680 | + sas_remove_host(shost); |
6681 | list_for_each_entry_safe(raid_device, next, &ioc->raid_device_list, |
6682 | list) { |
6683 | if (raid_device->starget) { |
6684 | @@ -9682,7 +9683,6 @@ static void scsih_remove(struct pci_dev *pdev) |
6685 | ioc->sas_hba.num_phys = 0; |
6686 | } |
6687 | |
6688 | - sas_remove_host(shost); |
6689 | mpt3sas_base_detach(ioc); |
6690 | spin_lock(&gioc_lock); |
6691 | list_del(&ioc->list); |
6692 | diff --git a/drivers/scsi/mpt3sas/mpt3sas_transport.c b/drivers/scsi/mpt3sas/mpt3sas_transport.c |
6693 | index 6a8a3c09b4b1..8338b4db0e31 100644 |
6694 | --- a/drivers/scsi/mpt3sas/mpt3sas_transport.c |
6695 | +++ b/drivers/scsi/mpt3sas/mpt3sas_transport.c |
6696 | @@ -821,10 +821,13 @@ mpt3sas_transport_port_remove(struct MPT3SAS_ADAPTER *ioc, u64 sas_address, |
6697 | mpt3sas_port->remote_identify.sas_address, |
6698 | mpt3sas_phy->phy_id); |
6699 | mpt3sas_phy->phy_belongs_to_port = 0; |
6700 | - sas_port_delete_phy(mpt3sas_port->port, mpt3sas_phy->phy); |
6701 | + if (!ioc->remove_host) |
6702 | + sas_port_delete_phy(mpt3sas_port->port, |
6703 | + mpt3sas_phy->phy); |
6704 | list_del(&mpt3sas_phy->port_siblings); |
6705 | } |
6706 | - sas_port_delete(mpt3sas_port->port); |
6707 | + if (!ioc->remove_host) |
6708 | + sas_port_delete(mpt3sas_port->port); |
6709 | kfree(mpt3sas_port); |
6710 | } |
6711 | |
6712 | diff --git a/drivers/scsi/sd_zbc.c b/drivers/scsi/sd_zbc.c |
6713 | index e06c48c866e4..3f81bab48ac2 100644 |
6714 | --- a/drivers/scsi/sd_zbc.c |
6715 | +++ b/drivers/scsi/sd_zbc.c |
6716 | @@ -462,12 +462,16 @@ int sd_zbc_read_zones(struct scsi_disk *sdkp, unsigned char *buf) |
6717 | sdkp->device->use_10_for_rw = 0; |
6718 | |
6719 | /* |
6720 | - * If something changed, revalidate the disk zone bitmaps once we have |
6721 | - * the capacity, that is on the second revalidate execution during disk |
6722 | - * scan and always during normal revalidate. |
6723 | + * Revalidate the disk zone bitmaps once the block device capacity is |
6724 | + * set on the second revalidate execution during disk scan and if |
6725 | + * something changed when executing a normal revalidate. |
6726 | */ |
6727 | - if (sdkp->first_scan) |
6728 | + if (sdkp->first_scan) { |
6729 | + sdkp->zone_blocks = zone_blocks; |
6730 | + sdkp->nr_zones = nr_zones; |
6731 | return 0; |
6732 | + } |
6733 | + |
6734 | if (sdkp->zone_blocks != zone_blocks || |
6735 | sdkp->nr_zones != nr_zones || |
6736 | disk->queue->nr_zones != nr_zones) { |
6737 | diff --git a/drivers/scsi/smartpqi/smartpqi_init.c b/drivers/scsi/smartpqi/smartpqi_init.c |
6738 | index 6f4cb3be97aa..489e5cbbcbba 100644 |
6739 | --- a/drivers/scsi/smartpqi/smartpqi_init.c |
6740 | +++ b/drivers/scsi/smartpqi/smartpqi_init.c |
6741 | @@ -640,6 +640,7 @@ struct bmic_host_wellness_driver_version { |
6742 | u8 driver_version_tag[2]; |
6743 | __le16 driver_version_length; |
6744 | char driver_version[32]; |
6745 | + u8 dont_write_tag[2]; |
6746 | u8 end_tag[2]; |
6747 | }; |
6748 | |
6749 | @@ -669,6 +670,8 @@ static int pqi_write_driver_version_to_host_wellness( |
6750 | strncpy(buffer->driver_version, "Linux " DRIVER_VERSION, |
6751 | sizeof(buffer->driver_version) - 1); |
6752 | buffer->driver_version[sizeof(buffer->driver_version) - 1] = '\0'; |
6753 | + buffer->dont_write_tag[0] = 'D'; |
6754 | + buffer->dont_write_tag[1] = 'W'; |
6755 | buffer->end_tag[0] = 'Z'; |
6756 | buffer->end_tag[1] = 'Z'; |
6757 | |
6758 | @@ -1165,6 +1168,9 @@ static void pqi_get_volume_status(struct pqi_ctrl_info *ctrl_info, |
6759 | if (rc) |
6760 | goto out; |
6761 | |
6762 | + if (vpd->page_code != CISS_VPD_LV_STATUS) |
6763 | + goto out; |
6764 | + |
6765 | page_length = offsetof(struct ciss_vpd_logical_volume_status, |
6766 | volume_status) + vpd->page_length; |
6767 | if (page_length < sizeof(*vpd)) |
6768 | diff --git a/drivers/scsi/smartpqi/smartpqi_sis.c b/drivers/scsi/smartpqi/smartpqi_sis.c |
6769 | index ea91658c7060..9d3043df22af 100644 |
6770 | --- a/drivers/scsi/smartpqi/smartpqi_sis.c |
6771 | +++ b/drivers/scsi/smartpqi/smartpqi_sis.c |
6772 | @@ -59,7 +59,7 @@ |
6773 | |
6774 | #define SIS_CTRL_KERNEL_UP 0x80 |
6775 | #define SIS_CTRL_KERNEL_PANIC 0x100 |
6776 | -#define SIS_CTRL_READY_TIMEOUT_SECS 30 |
6777 | +#define SIS_CTRL_READY_TIMEOUT_SECS 180 |
6778 | #define SIS_CTRL_READY_RESUME_TIMEOUT_SECS 90 |
6779 | #define SIS_CTRL_READY_POLL_INTERVAL_MSECS 10 |
6780 | |
6781 | diff --git a/drivers/soc/bcm/brcmstb/common.c b/drivers/soc/bcm/brcmstb/common.c |
6782 | index 14185451901d..bf9123f727e8 100644 |
6783 | --- a/drivers/soc/bcm/brcmstb/common.c |
6784 | +++ b/drivers/soc/bcm/brcmstb/common.c |
6785 | @@ -31,13 +31,17 @@ static const struct of_device_id brcmstb_machine_match[] = { |
6786 | |
6787 | bool soc_is_brcmstb(void) |
6788 | { |
6789 | + const struct of_device_id *match; |
6790 | struct device_node *root; |
6791 | |
6792 | root = of_find_node_by_path("/"); |
6793 | if (!root) |
6794 | return false; |
6795 | |
6796 | - return of_match_node(brcmstb_machine_match, root) != NULL; |
6797 | + match = of_match_node(brcmstb_machine_match, root); |
6798 | + of_node_put(root); |
6799 | + |
6800 | + return match != NULL; |
6801 | } |
6802 | |
6803 | u32 brcmstb_get_family_id(void) |
6804 | diff --git a/drivers/soc/tegra/common.c b/drivers/soc/tegra/common.c |
6805 | index cd8f41351add..7bfb154d6fa5 100644 |
6806 | --- a/drivers/soc/tegra/common.c |
6807 | +++ b/drivers/soc/tegra/common.c |
6808 | @@ -22,11 +22,15 @@ static const struct of_device_id tegra_machine_match[] = { |
6809 | |
6810 | bool soc_is_tegra(void) |
6811 | { |
6812 | + const struct of_device_id *match; |
6813 | struct device_node *root; |
6814 | |
6815 | root = of_find_node_by_path("/"); |
6816 | if (!root) |
6817 | return false; |
6818 | |
6819 | - return of_match_node(tegra_machine_match, root) != NULL; |
6820 | + match = of_match_node(tegra_machine_match, root); |
6821 | + of_node_put(root); |
6822 | + |
6823 | + return match != NULL; |
6824 | } |
6825 | diff --git a/drivers/spi/spi-at91-usart.c b/drivers/spi/spi-at91-usart.c |
6826 | index a924657642fa..08bcbd1f9aa2 100644 |
6827 | --- a/drivers/spi/spi-at91-usart.c |
6828 | +++ b/drivers/spi/spi-at91-usart.c |
6829 | @@ -12,6 +12,7 @@ |
6830 | #include <linux/kernel.h> |
6831 | #include <linux/module.h> |
6832 | #include <linux/of_gpio.h> |
6833 | +#include <linux/pinctrl/consumer.h> |
6834 | #include <linux/platform_device.h> |
6835 | |
6836 | #include <linux/spi/spi.h> |
6837 | diff --git a/drivers/staging/erofs/internal.h b/drivers/staging/erofs/internal.h |
6838 | index 57575c7f5635..3ac4599bbe01 100644 |
6839 | --- a/drivers/staging/erofs/internal.h |
6840 | +++ b/drivers/staging/erofs/internal.h |
6841 | @@ -39,7 +39,7 @@ |
6842 | #define debugln(x, ...) ((void)0) |
6843 | |
6844 | #define dbg_might_sleep() ((void)0) |
6845 | -#define DBG_BUGON(...) ((void)0) |
6846 | +#define DBG_BUGON(x) ((void)(x)) |
6847 | #endif |
6848 | |
6849 | enum { |
6850 | @@ -250,6 +250,7 @@ repeat: |
6851 | } |
6852 | |
6853 | #define __erofs_workgroup_get(grp) atomic_inc(&(grp)->refcount) |
6854 | +#define __erofs_workgroup_put(grp) atomic_dec(&(grp)->refcount) |
6855 | |
6856 | extern int erofs_workgroup_put(struct erofs_workgroup *grp); |
6857 | |
6858 | diff --git a/drivers/staging/erofs/utils.c b/drivers/staging/erofs/utils.c |
6859 | index ea8a962e5c95..d2e3ace91046 100644 |
6860 | --- a/drivers/staging/erofs/utils.c |
6861 | +++ b/drivers/staging/erofs/utils.c |
6862 | @@ -83,12 +83,21 @@ int erofs_register_workgroup(struct super_block *sb, |
6863 | |
6864 | grp = xa_tag_pointer(grp, tag); |
6865 | |
6866 | - err = radix_tree_insert(&sbi->workstn_tree, |
6867 | - grp->index, grp); |
6868 | + /* |
6869 | + * Bump up reference count before making this workgroup |
6870 | + * visible to other users in order to avoid potential UAF |
6871 | + * without serialized by erofs_workstn_lock. |
6872 | + */ |
6873 | + __erofs_workgroup_get(grp); |
6874 | |
6875 | - if (!err) { |
6876 | - __erofs_workgroup_get(grp); |
6877 | - } |
6878 | + err = radix_tree_insert(&sbi->workstn_tree, |
6879 | + grp->index, grp); |
6880 | + if (unlikely(err)) |
6881 | + /* |
6882 | + * it's safe to decrease since the workgroup isn't visible |
6883 | + * and refcount >= 2 (cannot be freezed). |
6884 | + */ |
6885 | + __erofs_workgroup_put(grp); |
6886 | |
6887 | erofs_workstn_unlock(sbi); |
6888 | radix_tree_preload_end(); |
6889 | @@ -97,19 +106,94 @@ int erofs_register_workgroup(struct super_block *sb, |
6890 | |
6891 | extern void erofs_workgroup_free_rcu(struct erofs_workgroup *grp); |
6892 | |
6893 | +static void __erofs_workgroup_free(struct erofs_workgroup *grp) |
6894 | +{ |
6895 | + atomic_long_dec(&erofs_global_shrink_cnt); |
6896 | + erofs_workgroup_free_rcu(grp); |
6897 | +} |
6898 | + |
6899 | int erofs_workgroup_put(struct erofs_workgroup *grp) |
6900 | { |
6901 | int count = atomic_dec_return(&grp->refcount); |
6902 | |
6903 | if (count == 1) |
6904 | atomic_long_inc(&erofs_global_shrink_cnt); |
6905 | - else if (!count) { |
6906 | - atomic_long_dec(&erofs_global_shrink_cnt); |
6907 | - erofs_workgroup_free_rcu(grp); |
6908 | - } |
6909 | + else if (!count) |
6910 | + __erofs_workgroup_free(grp); |
6911 | return count; |
6912 | } |
6913 | |
6914 | +#ifdef EROFS_FS_HAS_MANAGED_CACHE |
6915 | +/* for cache-managed case, customized reclaim paths exist */ |
6916 | +static void erofs_workgroup_unfreeze_final(struct erofs_workgroup *grp) |
6917 | +{ |
6918 | + erofs_workgroup_unfreeze(grp, 0); |
6919 | + __erofs_workgroup_free(grp); |
6920 | +} |
6921 | + |
6922 | +bool erofs_try_to_release_workgroup(struct erofs_sb_info *sbi, |
6923 | + struct erofs_workgroup *grp, |
6924 | + bool cleanup) |
6925 | +{ |
6926 | + /* |
6927 | + * for managed cache enabled, the refcount of workgroups |
6928 | + * themselves could be < 0 (freezed). So there is no guarantee |
6929 | + * that all refcount > 0 if managed cache is enabled. |
6930 | + */ |
6931 | + if (!erofs_workgroup_try_to_freeze(grp, 1)) |
6932 | + return false; |
6933 | + |
6934 | + /* |
6935 | + * note that all cached pages should be unlinked |
6936 | + * before delete it from the radix tree. |
6937 | + * Otherwise some cached pages of an orphan old workgroup |
6938 | + * could be still linked after the new one is available. |
6939 | + */ |
6940 | + if (erofs_try_to_free_all_cached_pages(sbi, grp)) { |
6941 | + erofs_workgroup_unfreeze(grp, 1); |
6942 | + return false; |
6943 | + } |
6944 | + |
6945 | + /* |
6946 | + * it is impossible to fail after the workgroup is freezed, |
6947 | + * however in order to avoid some race conditions, add a |
6948 | + * DBG_BUGON to observe this in advance. |
6949 | + */ |
6950 | + DBG_BUGON(xa_untag_pointer(radix_tree_delete(&sbi->workstn_tree, |
6951 | + grp->index)) != grp); |
6952 | + |
6953 | + /* |
6954 | + * if managed cache is enable, the last refcount |
6955 | + * should indicate the related workstation. |
6956 | + */ |
6957 | + erofs_workgroup_unfreeze_final(grp); |
6958 | + return true; |
6959 | +} |
6960 | + |
6961 | +#else |
6962 | +/* for nocache case, no customized reclaim path at all */ |
6963 | +bool erofs_try_to_release_workgroup(struct erofs_sb_info *sbi, |
6964 | + struct erofs_workgroup *grp, |
6965 | + bool cleanup) |
6966 | +{ |
6967 | + int cnt = atomic_read(&grp->refcount); |
6968 | + |
6969 | + DBG_BUGON(cnt <= 0); |
6970 | + DBG_BUGON(cleanup && cnt != 1); |
6971 | + |
6972 | + if (cnt > 1) |
6973 | + return false; |
6974 | + |
6975 | + DBG_BUGON(xa_untag_pointer(radix_tree_delete(&sbi->workstn_tree, |
6976 | + grp->index)) != grp); |
6977 | + |
6978 | + /* (rarely) could be grabbed again when freeing */ |
6979 | + erofs_workgroup_put(grp); |
6980 | + return true; |
6981 | +} |
6982 | + |
6983 | +#endif |
6984 | + |
6985 | unsigned long erofs_shrink_workstation(struct erofs_sb_info *sbi, |
6986 | unsigned long nr_shrink, |
6987 | bool cleanup) |
6988 | @@ -126,42 +210,14 @@ repeat: |
6989 | batch, first_index, PAGEVEC_SIZE); |
6990 | |
6991 | for (i = 0; i < found; ++i) { |
6992 | - int cnt; |
6993 | struct erofs_workgroup *grp = xa_untag_pointer(batch[i]); |
6994 | |
6995 | first_index = grp->index + 1; |
6996 | |
6997 | - cnt = atomic_read(&grp->refcount); |
6998 | - BUG_ON(cnt <= 0); |
6999 | - |
7000 | - if (cleanup) |
7001 | - BUG_ON(cnt != 1); |
7002 | - |
7003 | -#ifndef EROFS_FS_HAS_MANAGED_CACHE |
7004 | - else if (cnt > 1) |
7005 | -#else |
7006 | - if (!erofs_workgroup_try_to_freeze(grp, 1)) |
7007 | -#endif |
7008 | + /* try to shrink each valid workgroup */ |
7009 | + if (!erofs_try_to_release_workgroup(sbi, grp, cleanup)) |
7010 | continue; |
7011 | |
7012 | - if (xa_untag_pointer(radix_tree_delete(&sbi->workstn_tree, |
7013 | - grp->index)) != grp) { |
7014 | -#ifdef EROFS_FS_HAS_MANAGED_CACHE |
7015 | -skip: |
7016 | - erofs_workgroup_unfreeze(grp, 1); |
7017 | -#endif |
7018 | - continue; |
7019 | - } |
7020 | - |
7021 | -#ifdef EROFS_FS_HAS_MANAGED_CACHE |
7022 | - if (erofs_try_to_free_all_cached_pages(sbi, grp)) |
7023 | - goto skip; |
7024 | - |
7025 | - erofs_workgroup_unfreeze(grp, 1); |
7026 | -#endif |
7027 | - /* (rarely) grabbed again when freeing */ |
7028 | - erofs_workgroup_put(grp); |
7029 | - |
7030 | ++freed; |
7031 | if (unlikely(!--nr_shrink)) |
7032 | break; |
7033 | diff --git a/drivers/staging/iio/adc/ad7280a.c b/drivers/staging/iio/adc/ad7280a.c |
7034 | index 58420dcb406d..cbeb52485a31 100644 |
7035 | --- a/drivers/staging/iio/adc/ad7280a.c |
7036 | +++ b/drivers/staging/iio/adc/ad7280a.c |
7037 | @@ -256,7 +256,9 @@ static int ad7280_read(struct ad7280_state *st, unsigned int devaddr, |
7038 | if (ret) |
7039 | return ret; |
7040 | |
7041 | - __ad7280_read32(st, &tmp); |
7042 | + ret = __ad7280_read32(st, &tmp); |
7043 | + if (ret) |
7044 | + return ret; |
7045 | |
7046 | if (ad7280_check_crc(st, tmp)) |
7047 | return -EIO; |
7048 | @@ -294,7 +296,9 @@ static int ad7280_read_channel(struct ad7280_state *st, unsigned int devaddr, |
7049 | |
7050 | ad7280_delay(st); |
7051 | |
7052 | - __ad7280_read32(st, &tmp); |
7053 | + ret = __ad7280_read32(st, &tmp); |
7054 | + if (ret) |
7055 | + return ret; |
7056 | |
7057 | if (ad7280_check_crc(st, tmp)) |
7058 | return -EIO; |
7059 | @@ -327,7 +331,9 @@ static int ad7280_read_all_channels(struct ad7280_state *st, unsigned int cnt, |
7060 | ad7280_delay(st); |
7061 | |
7062 | for (i = 0; i < cnt; i++) { |
7063 | - __ad7280_read32(st, &tmp); |
7064 | + ret = __ad7280_read32(st, &tmp); |
7065 | + if (ret) |
7066 | + return ret; |
7067 | |
7068 | if (ad7280_check_crc(st, tmp)) |
7069 | return -EIO; |
7070 | @@ -370,7 +376,10 @@ static int ad7280_chain_setup(struct ad7280_state *st) |
7071 | return ret; |
7072 | |
7073 | for (n = 0; n <= AD7280A_MAX_CHAIN; n++) { |
7074 | - __ad7280_read32(st, &val); |
7075 | + ret = __ad7280_read32(st, &val); |
7076 | + if (ret) |
7077 | + return ret; |
7078 | + |
7079 | if (val == 0) |
7080 | return n - 1; |
7081 | |
7082 | diff --git a/drivers/staging/iio/adc/ad7780.c b/drivers/staging/iio/adc/ad7780.c |
7083 | index b67412db0318..c7cb05cedbbc 100644 |
7084 | --- a/drivers/staging/iio/adc/ad7780.c |
7085 | +++ b/drivers/staging/iio/adc/ad7780.c |
7086 | @@ -87,12 +87,16 @@ static int ad7780_read_raw(struct iio_dev *indio_dev, |
7087 | long m) |
7088 | { |
7089 | struct ad7780_state *st = iio_priv(indio_dev); |
7090 | + int voltage_uv; |
7091 | |
7092 | switch (m) { |
7093 | case IIO_CHAN_INFO_RAW: |
7094 | return ad_sigma_delta_single_conversion(indio_dev, chan, val); |
7095 | case IIO_CHAN_INFO_SCALE: |
7096 | - *val = st->int_vref_mv * st->gain; |
7097 | + voltage_uv = regulator_get_voltage(st->reg); |
7098 | + if (voltage_uv < 0) |
7099 | + return voltage_uv; |
7100 | + *val = (voltage_uv / 1000) * st->gain; |
7101 | *val2 = chan->scan_type.realbits - 1; |
7102 | return IIO_VAL_FRACTIONAL_LOG2; |
7103 | case IIO_CHAN_INFO_OFFSET: |
7104 | diff --git a/drivers/staging/iio/resolver/ad2s90.c b/drivers/staging/iio/resolver/ad2s90.c |
7105 | index 59586947a936..51cda9151412 100644 |
7106 | --- a/drivers/staging/iio/resolver/ad2s90.c |
7107 | +++ b/drivers/staging/iio/resolver/ad2s90.c |
7108 | @@ -85,7 +85,12 @@ static int ad2s90_probe(struct spi_device *spi) |
7109 | /* need 600ns between CS and the first falling edge of SCLK */ |
7110 | spi->max_speed_hz = 830000; |
7111 | spi->mode = SPI_MODE_3; |
7112 | - spi_setup(spi); |
7113 | + ret = spi_setup(spi); |
7114 | + |
7115 | + if (ret < 0) { |
7116 | + dev_err(&spi->dev, "spi_setup failed!\n"); |
7117 | + return ret; |
7118 | + } |
7119 | |
7120 | return 0; |
7121 | } |
7122 | diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c |
7123 | index c85a805a1243..a497ec197872 100644 |
7124 | --- a/drivers/staging/pi433/pi433_if.c |
7125 | +++ b/drivers/staging/pi433/pi433_if.c |
7126 | @@ -1255,6 +1255,10 @@ static int pi433_probe(struct spi_device *spi) |
7127 | |
7128 | /* create cdev */ |
7129 | device->cdev = cdev_alloc(); |
7130 | + if (!device->cdev) { |
7131 | + dev_dbg(device->dev, "allocation of cdev failed"); |
7132 | + goto cdev_failed; |
7133 | + } |
7134 | device->cdev->owner = THIS_MODULE; |
7135 | cdev_init(device->cdev, &pi433_fops); |
7136 | retval = cdev_add(device->cdev, device->devt, 1); |
7137 | diff --git a/drivers/staging/speakup/spk_ttyio.c b/drivers/staging/speakup/spk_ttyio.c |
7138 | index 979e3ae249c1..033be0ad03e7 100644 |
7139 | --- a/drivers/staging/speakup/spk_ttyio.c |
7140 | +++ b/drivers/staging/speakup/spk_ttyio.c |
7141 | @@ -265,7 +265,8 @@ static void spk_ttyio_send_xchar(char ch) |
7142 | return; |
7143 | } |
7144 | |
7145 | - speakup_tty->ops->send_xchar(speakup_tty, ch); |
7146 | + if (speakup_tty->ops->send_xchar) |
7147 | + speakup_tty->ops->send_xchar(speakup_tty, ch); |
7148 | mutex_unlock(&speakup_tty_mutex); |
7149 | } |
7150 | |
7151 | @@ -277,7 +278,8 @@ static void spk_ttyio_tiocmset(unsigned int set, unsigned int clear) |
7152 | return; |
7153 | } |
7154 | |
7155 | - speakup_tty->ops->tiocmset(speakup_tty, set, clear); |
7156 | + if (speakup_tty->ops->tiocmset) |
7157 | + speakup_tty->ops->tiocmset(speakup_tty, set, clear); |
7158 | mutex_unlock(&speakup_tty_mutex); |
7159 | } |
7160 | |
7161 | diff --git a/drivers/tee/optee/supp.c b/drivers/tee/optee/supp.c |
7162 | index df35fc01fd3e..43626e15703a 100644 |
7163 | --- a/drivers/tee/optee/supp.c |
7164 | +++ b/drivers/tee/optee/supp.c |
7165 | @@ -19,7 +19,7 @@ |
7166 | struct optee_supp_req { |
7167 | struct list_head link; |
7168 | |
7169 | - bool busy; |
7170 | + bool in_queue; |
7171 | u32 func; |
7172 | u32 ret; |
7173 | size_t num_params; |
7174 | @@ -54,7 +54,6 @@ void optee_supp_release(struct optee_supp *supp) |
7175 | |
7176 | /* Abort all request retrieved by supplicant */ |
7177 | idr_for_each_entry(&supp->idr, req, id) { |
7178 | - req->busy = false; |
7179 | idr_remove(&supp->idr, id); |
7180 | req->ret = TEEC_ERROR_COMMUNICATION; |
7181 | complete(&req->c); |
7182 | @@ -63,6 +62,7 @@ void optee_supp_release(struct optee_supp *supp) |
7183 | /* Abort all queued requests */ |
7184 | list_for_each_entry_safe(req, req_tmp, &supp->reqs, link) { |
7185 | list_del(&req->link); |
7186 | + req->in_queue = false; |
7187 | req->ret = TEEC_ERROR_COMMUNICATION; |
7188 | complete(&req->c); |
7189 | } |
7190 | @@ -103,6 +103,7 @@ u32 optee_supp_thrd_req(struct tee_context *ctx, u32 func, size_t num_params, |
7191 | /* Insert the request in the request list */ |
7192 | mutex_lock(&supp->mutex); |
7193 | list_add_tail(&req->link, &supp->reqs); |
7194 | + req->in_queue = true; |
7195 | mutex_unlock(&supp->mutex); |
7196 | |
7197 | /* Tell an eventual waiter there's a new request */ |
7198 | @@ -130,9 +131,10 @@ u32 optee_supp_thrd_req(struct tee_context *ctx, u32 func, size_t num_params, |
7199 | * will serve all requests in a timely manner and |
7200 | * interrupting then wouldn't make sense. |
7201 | */ |
7202 | - interruptable = !req->busy; |
7203 | - if (!req->busy) |
7204 | + if (req->in_queue) { |
7205 | list_del(&req->link); |
7206 | + req->in_queue = false; |
7207 | + } |
7208 | } |
7209 | mutex_unlock(&supp->mutex); |
7210 | |
7211 | @@ -176,7 +178,7 @@ static struct optee_supp_req *supp_pop_entry(struct optee_supp *supp, |
7212 | return ERR_PTR(-ENOMEM); |
7213 | |
7214 | list_del(&req->link); |
7215 | - req->busy = true; |
7216 | + req->in_queue = false; |
7217 | |
7218 | return req; |
7219 | } |
7220 | @@ -318,7 +320,6 @@ static struct optee_supp_req *supp_pop_req(struct optee_supp *supp, |
7221 | if ((num_params - nm) != req->num_params) |
7222 | return ERR_PTR(-EINVAL); |
7223 | |
7224 | - req->busy = false; |
7225 | idr_remove(&supp->idr, id); |
7226 | supp->req_id = -1; |
7227 | *num_meta = nm; |
7228 | diff --git a/drivers/thermal/broadcom/bcm2835_thermal.c b/drivers/thermal/broadcom/bcm2835_thermal.c |
7229 | index b9d90f0ed504..720760cd493f 100644 |
7230 | --- a/drivers/thermal/broadcom/bcm2835_thermal.c |
7231 | +++ b/drivers/thermal/broadcom/bcm2835_thermal.c |
7232 | @@ -18,6 +18,8 @@ |
7233 | #include <linux/platform_device.h> |
7234 | #include <linux/thermal.h> |
7235 | |
7236 | +#include "../thermal_hwmon.h" |
7237 | + |
7238 | #define BCM2835_TS_TSENSCTL 0x00 |
7239 | #define BCM2835_TS_TSENSSTAT 0x04 |
7240 | |
7241 | @@ -266,6 +268,15 @@ static int bcm2835_thermal_probe(struct platform_device *pdev) |
7242 | |
7243 | platform_set_drvdata(pdev, tz); |
7244 | |
7245 | + /* |
7246 | + * Thermal_zone doesn't enable hwmon as default, |
7247 | + * enable it here |
7248 | + */ |
7249 | + tz->tzp->no_hwmon = false; |
7250 | + err = thermal_add_hwmon_sysfs(tz); |
7251 | + if (err) |
7252 | + goto err_tz; |
7253 | + |
7254 | bcm2835_thermal_debugfs(pdev); |
7255 | |
7256 | return 0; |
7257 | diff --git a/drivers/thermal/qcom/tsens-common.c b/drivers/thermal/qcom/tsens-common.c |
7258 | index 3be4be2e0465..78652cac7f3d 100644 |
7259 | --- a/drivers/thermal/qcom/tsens-common.c |
7260 | +++ b/drivers/thermal/qcom/tsens-common.c |
7261 | @@ -114,6 +114,14 @@ int get_temp_common(struct tsens_device *tmdev, int id, int *temp) |
7262 | } |
7263 | |
7264 | static const struct regmap_config tsens_config = { |
7265 | + .name = "tm", |
7266 | + .reg_bits = 32, |
7267 | + .val_bits = 32, |
7268 | + .reg_stride = 4, |
7269 | +}; |
7270 | + |
7271 | +static const struct regmap_config tsens_srot_config = { |
7272 | + .name = "srot", |
7273 | .reg_bits = 32, |
7274 | .val_bits = 32, |
7275 | .reg_stride = 4, |
7276 | @@ -139,8 +147,8 @@ int __init init_common(struct tsens_device *tmdev) |
7277 | if (IS_ERR(srot_base)) |
7278 | return PTR_ERR(srot_base); |
7279 | |
7280 | - tmdev->srot_map = devm_regmap_init_mmio(tmdev->dev, |
7281 | - srot_base, &tsens_config); |
7282 | + tmdev->srot_map = devm_regmap_init_mmio(tmdev->dev, srot_base, |
7283 | + &tsens_srot_config); |
7284 | if (IS_ERR(tmdev->srot_map)) |
7285 | return PTR_ERR(tmdev->srot_map); |
7286 | |
7287 | diff --git a/drivers/thermal/thermal-generic-adc.c b/drivers/thermal/thermal-generic-adc.c |
7288 | index bf1c628d4a7a..e22fc60ad36d 100644 |
7289 | --- a/drivers/thermal/thermal-generic-adc.c |
7290 | +++ b/drivers/thermal/thermal-generic-adc.c |
7291 | @@ -26,7 +26,7 @@ struct gadc_thermal_info { |
7292 | |
7293 | static int gadc_thermal_adc_to_temp(struct gadc_thermal_info *gti, int val) |
7294 | { |
7295 | - int temp, adc_hi, adc_lo; |
7296 | + int temp, temp_hi, temp_lo, adc_hi, adc_lo; |
7297 | int i; |
7298 | |
7299 | for (i = 0; i < gti->nlookup_table; i++) { |
7300 | @@ -36,13 +36,17 @@ static int gadc_thermal_adc_to_temp(struct gadc_thermal_info *gti, int val) |
7301 | |
7302 | if (i == 0) { |
7303 | temp = gti->lookup_table[0]; |
7304 | - } else if (i >= (gti->nlookup_table - 1)) { |
7305 | + } else if (i >= gti->nlookup_table) { |
7306 | temp = gti->lookup_table[2 * (gti->nlookup_table - 1)]; |
7307 | } else { |
7308 | adc_hi = gti->lookup_table[2 * i - 1]; |
7309 | adc_lo = gti->lookup_table[2 * i + 1]; |
7310 | - temp = gti->lookup_table[2 * i]; |
7311 | - temp -= ((val - adc_lo) * 1000) / (adc_hi - adc_lo); |
7312 | + |
7313 | + temp_hi = gti->lookup_table[2 * i - 2]; |
7314 | + temp_lo = gti->lookup_table[2 * i]; |
7315 | + |
7316 | + temp = temp_hi + mult_frac(temp_lo - temp_hi, val - adc_hi, |
7317 | + adc_lo - adc_hi); |
7318 | } |
7319 | |
7320 | return temp; |
7321 | diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c |
7322 | index d6ebc1cf6aa9..3a014cd8daf0 100644 |
7323 | --- a/drivers/thermal/thermal_core.c |
7324 | +++ b/drivers/thermal/thermal_core.c |
7325 | @@ -453,16 +453,20 @@ static void update_temperature(struct thermal_zone_device *tz) |
7326 | tz->last_temperature, tz->temperature); |
7327 | } |
7328 | |
7329 | -static void thermal_zone_device_reset(struct thermal_zone_device *tz) |
7330 | +static void thermal_zone_device_init(struct thermal_zone_device *tz) |
7331 | { |
7332 | struct thermal_instance *pos; |
7333 | - |
7334 | tz->temperature = THERMAL_TEMP_INVALID; |
7335 | - tz->passive = 0; |
7336 | list_for_each_entry(pos, &tz->thermal_instances, tz_node) |
7337 | pos->initialized = false; |
7338 | } |
7339 | |
7340 | +static void thermal_zone_device_reset(struct thermal_zone_device *tz) |
7341 | +{ |
7342 | + tz->passive = 0; |
7343 | + thermal_zone_device_init(tz); |
7344 | +} |
7345 | + |
7346 | void thermal_zone_device_update(struct thermal_zone_device *tz, |
7347 | enum thermal_notify_event event) |
7348 | { |
7349 | @@ -1504,7 +1508,7 @@ static int thermal_pm_notify(struct notifier_block *nb, |
7350 | case PM_POST_SUSPEND: |
7351 | atomic_set(&in_suspend, 0); |
7352 | list_for_each_entry(tz, &thermal_tz_list, node) { |
7353 | - thermal_zone_device_reset(tz); |
7354 | + thermal_zone_device_init(tz); |
7355 | thermal_zone_device_update(tz, |
7356 | THERMAL_EVENT_UNSPECIFIED); |
7357 | } |
7358 | diff --git a/drivers/thermal/thermal_hwmon.h b/drivers/thermal/thermal_hwmon.h |
7359 | index 019f6f88224e..a160b9d62dd0 100644 |
7360 | --- a/drivers/thermal/thermal_hwmon.h |
7361 | +++ b/drivers/thermal/thermal_hwmon.h |
7362 | @@ -19,13 +19,13 @@ |
7363 | int thermal_add_hwmon_sysfs(struct thermal_zone_device *tz); |
7364 | void thermal_remove_hwmon_sysfs(struct thermal_zone_device *tz); |
7365 | #else |
7366 | -static int |
7367 | +static inline int |
7368 | thermal_add_hwmon_sysfs(struct thermal_zone_device *tz) |
7369 | { |
7370 | return 0; |
7371 | } |
7372 | |
7373 | -static void |
7374 | +static inline void |
7375 | thermal_remove_hwmon_sysfs(struct thermal_zone_device *tz) |
7376 | { |
7377 | } |
7378 | diff --git a/drivers/thermal/thermal_sysfs.c b/drivers/thermal/thermal_sysfs.c |
7379 | index 2241ceae7d7f..aa99edb4dff7 100644 |
7380 | --- a/drivers/thermal/thermal_sysfs.c |
7381 | +++ b/drivers/thermal/thermal_sysfs.c |
7382 | @@ -712,11 +712,14 @@ cur_state_store(struct device *dev, struct device_attribute *attr, |
7383 | if ((long)state < 0) |
7384 | return -EINVAL; |
7385 | |
7386 | + mutex_lock(&cdev->lock); |
7387 | + |
7388 | result = cdev->ops->set_cur_state(cdev, state); |
7389 | - if (result) |
7390 | - return result; |
7391 | - thermal_cooling_device_stats_update(cdev, state); |
7392 | - return count; |
7393 | + if (!result) |
7394 | + thermal_cooling_device_stats_update(cdev, state); |
7395 | + |
7396 | + mutex_unlock(&cdev->lock); |
7397 | + return result ? result : count; |
7398 | } |
7399 | |
7400 | static struct device_attribute |
7401 | diff --git a/drivers/tty/serial/8250/8250_pci.c b/drivers/tty/serial/8250/8250_pci.c |
7402 | index f80a300b5d68..48bd694a5fa1 100644 |
7403 | --- a/drivers/tty/serial/8250/8250_pci.c |
7404 | +++ b/drivers/tty/serial/8250/8250_pci.c |
7405 | @@ -3420,6 +3420,11 @@ static int |
7406 | serial_pci_guess_board(struct pci_dev *dev, struct pciserial_board *board) |
7407 | { |
7408 | int num_iomem, num_port, first_port = -1, i; |
7409 | + int rc; |
7410 | + |
7411 | + rc = serial_pci_is_class_communication(dev); |
7412 | + if (rc) |
7413 | + return rc; |
7414 | |
7415 | /* |
7416 | * Should we try to make guesses for multiport serial devices later? |
7417 | @@ -3647,10 +3652,6 @@ pciserial_init_one(struct pci_dev *dev, const struct pci_device_id *ent) |
7418 | |
7419 | board = &pci_boards[ent->driver_data]; |
7420 | |
7421 | - rc = serial_pci_is_class_communication(dev); |
7422 | - if (rc) |
7423 | - return rc; |
7424 | - |
7425 | rc = serial_pci_is_blacklisted(dev); |
7426 | if (rc) |
7427 | return rc; |
7428 | diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c |
7429 | index 00c220e4f43c..086642ea4b26 100644 |
7430 | --- a/drivers/tty/serial/fsl_lpuart.c |
7431 | +++ b/drivers/tty/serial/fsl_lpuart.c |
7432 | @@ -1479,6 +1479,8 @@ lpuart_set_termios(struct uart_port *port, struct ktermios *termios, |
7433 | else |
7434 | cr1 &= ~UARTCR1_PT; |
7435 | } |
7436 | + } else { |
7437 | + cr1 &= ~UARTCR1_PE; |
7438 | } |
7439 | |
7440 | /* ask the core to calculate the divisor */ |
7441 | @@ -1690,6 +1692,8 @@ lpuart32_set_termios(struct uart_port *port, struct ktermios *termios, |
7442 | else |
7443 | ctrl &= ~UARTCTRL_PT; |
7444 | } |
7445 | + } else { |
7446 | + ctrl &= ~UARTCTRL_PE; |
7447 | } |
7448 | |
7449 | /* ask the core to calculate the divisor */ |
7450 | diff --git a/drivers/tty/serial/samsung.c b/drivers/tty/serial/samsung.c |
7451 | index da1bd4bba8a9..2a49b6d876b8 100644 |
7452 | --- a/drivers/tty/serial/samsung.c |
7453 | +++ b/drivers/tty/serial/samsung.c |
7454 | @@ -1365,11 +1365,14 @@ static void s3c24xx_serial_set_termios(struct uart_port *port, |
7455 | wr_regl(port, S3C2410_ULCON, ulcon); |
7456 | wr_regl(port, S3C2410_UBRDIV, quot); |
7457 | |
7458 | + port->status &= ~UPSTAT_AUTOCTS; |
7459 | + |
7460 | umcon = rd_regl(port, S3C2410_UMCON); |
7461 | if (termios->c_cflag & CRTSCTS) { |
7462 | umcon |= S3C2410_UMCOM_AFC; |
7463 | /* Disable RTS when RX FIFO contains 63 bytes */ |
7464 | umcon &= ~S3C2412_UMCON_AFC_8; |
7465 | + port->status = UPSTAT_AUTOCTS; |
7466 | } else { |
7467 | umcon &= ~S3C2410_UMCOM_AFC; |
7468 | } |
7469 | diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c |
7470 | index 5c01bb6d1c24..556f50aa1b58 100644 |
7471 | --- a/drivers/tty/serial/serial_core.c |
7472 | +++ b/drivers/tty/serial/serial_core.c |
7473 | @@ -130,6 +130,9 @@ static void uart_start(struct tty_struct *tty) |
7474 | struct uart_port *port; |
7475 | unsigned long flags; |
7476 | |
7477 | + if (!state) |
7478 | + return; |
7479 | + |
7480 | port = uart_port_lock(state, flags); |
7481 | __uart_start(tty); |
7482 | uart_port_unlock(port, flags); |
7483 | @@ -727,6 +730,9 @@ static void uart_unthrottle(struct tty_struct *tty) |
7484 | upstat_t mask = UPSTAT_SYNC_FIFO; |
7485 | struct uart_port *port; |
7486 | |
7487 | + if (!state) |
7488 | + return; |
7489 | + |
7490 | port = uart_port_ref(state); |
7491 | if (!port) |
7492 | return; |
7493 | diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c |
7494 | index cc56cb3b3eca..014944a41613 100644 |
7495 | --- a/drivers/tty/serial/sh-sci.c |
7496 | +++ b/drivers/tty/serial/sh-sci.c |
7497 | @@ -1331,7 +1331,7 @@ static void sci_tx_dma_release(struct sci_port *s) |
7498 | dma_release_channel(chan); |
7499 | } |
7500 | |
7501 | -static void sci_submit_rx(struct sci_port *s) |
7502 | +static int sci_submit_rx(struct sci_port *s, bool port_lock_held) |
7503 | { |
7504 | struct dma_chan *chan = s->chan_rx; |
7505 | struct uart_port *port = &s->port; |
7506 | @@ -1359,19 +1359,22 @@ static void sci_submit_rx(struct sci_port *s) |
7507 | s->active_rx = s->cookie_rx[0]; |
7508 | |
7509 | dma_async_issue_pending(chan); |
7510 | - return; |
7511 | + return 0; |
7512 | |
7513 | fail: |
7514 | + /* Switch to PIO */ |
7515 | + if (!port_lock_held) |
7516 | + spin_lock_irqsave(&port->lock, flags); |
7517 | if (i) |
7518 | dmaengine_terminate_async(chan); |
7519 | for (i = 0; i < 2; i++) |
7520 | s->cookie_rx[i] = -EINVAL; |
7521 | s->active_rx = -EINVAL; |
7522 | - /* Switch to PIO */ |
7523 | - spin_lock_irqsave(&port->lock, flags); |
7524 | s->chan_rx = NULL; |
7525 | sci_start_rx(port); |
7526 | - spin_unlock_irqrestore(&port->lock, flags); |
7527 | + if (!port_lock_held) |
7528 | + spin_unlock_irqrestore(&port->lock, flags); |
7529 | + return -EAGAIN; |
7530 | } |
7531 | |
7532 | static void work_fn_tx(struct work_struct *work) |
7533 | @@ -1491,7 +1494,7 @@ static enum hrtimer_restart rx_timer_fn(struct hrtimer *t) |
7534 | } |
7535 | |
7536 | if (port->type == PORT_SCIFA || port->type == PORT_SCIFB) |
7537 | - sci_submit_rx(s); |
7538 | + sci_submit_rx(s, true); |
7539 | |
7540 | /* Direct new serial port interrupts back to CPU */ |
7541 | scr = serial_port_in(port, SCSCR); |
7542 | @@ -1617,7 +1620,7 @@ static void sci_request_dma(struct uart_port *port) |
7543 | s->chan_rx_saved = s->chan_rx = chan; |
7544 | |
7545 | if (port->type == PORT_SCIFA || port->type == PORT_SCIFB) |
7546 | - sci_submit_rx(s); |
7547 | + sci_submit_rx(s, false); |
7548 | } |
7549 | } |
7550 | |
7551 | @@ -1666,8 +1669,10 @@ static irqreturn_t sci_rx_interrupt(int irq, void *ptr) |
7552 | disable_irq_nosync(irq); |
7553 | scr |= SCSCR_RDRQE; |
7554 | } else { |
7555 | + if (sci_submit_rx(s, false) < 0) |
7556 | + goto handle_pio; |
7557 | + |
7558 | scr &= ~SCSCR_RIE; |
7559 | - sci_submit_rx(s); |
7560 | } |
7561 | serial_port_out(port, SCSCR, scr); |
7562 | /* Clear current interrupt */ |
7563 | @@ -1679,6 +1684,8 @@ static irqreturn_t sci_rx_interrupt(int irq, void *ptr) |
7564 | |
7565 | return IRQ_HANDLED; |
7566 | } |
7567 | + |
7568 | +handle_pio: |
7569 | #endif |
7570 | |
7571 | if (s->rx_trigger > 1 && s->rx_fifo_timeout > 0) { |
7572 | @@ -1914,7 +1921,7 @@ out_nomem: |
7573 | |
7574 | static void sci_free_irq(struct sci_port *port) |
7575 | { |
7576 | - int i; |
7577 | + int i, j; |
7578 | |
7579 | /* |
7580 | * Intentionally in reverse order so we iterate over the muxed |
7581 | @@ -1930,6 +1937,13 @@ static void sci_free_irq(struct sci_port *port) |
7582 | if (unlikely(irq < 0)) |
7583 | continue; |
7584 | |
7585 | + /* Check if already freed (irq was muxed) */ |
7586 | + for (j = 0; j < i; j++) |
7587 | + if (port->irqs[j] == irq) |
7588 | + j = i + 1; |
7589 | + if (j > i) |
7590 | + continue; |
7591 | + |
7592 | free_irq(port->irqs[i], port); |
7593 | kfree(port->irqstr[i]); |
7594 | |
7595 | diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c |
7596 | index f76b2e0aba9d..1d1e61e980f3 100644 |
7597 | --- a/drivers/usb/core/hub.c |
7598 | +++ b/drivers/usb/core/hub.c |
7599 | @@ -1112,6 +1112,16 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type) |
7600 | USB_PORT_FEAT_ENABLE); |
7601 | } |
7602 | |
7603 | + /* |
7604 | + * Add debounce if USB3 link is in polling/link training state. |
7605 | + * Link will automatically transition to Enabled state after |
7606 | + * link training completes. |
7607 | + */ |
7608 | + if (hub_is_superspeed(hdev) && |
7609 | + ((portstatus & USB_PORT_STAT_LINK_STATE) == |
7610 | + USB_SS_PORT_LS_POLLING)) |
7611 | + need_debounce_delay = true; |
7612 | + |
7613 | /* Clear status-change flags; we'll debounce later */ |
7614 | if (portchange & USB_PORT_STAT_C_CONNECTION) { |
7615 | need_debounce_delay = true; |
7616 | diff --git a/drivers/usb/dwc2/params.c b/drivers/usb/dwc2/params.c |
7617 | index 38c813b1d203..24ff5f21cb25 100644 |
7618 | --- a/drivers/usb/dwc2/params.c |
7619 | +++ b/drivers/usb/dwc2/params.c |
7620 | @@ -71,6 +71,13 @@ static void dwc2_set_his_params(struct dwc2_hsotg *hsotg) |
7621 | p->power_down = false; |
7622 | } |
7623 | |
7624 | +static void dwc2_set_s3c6400_params(struct dwc2_hsotg *hsotg) |
7625 | +{ |
7626 | + struct dwc2_core_params *p = &hsotg->params; |
7627 | + |
7628 | + p->power_down = 0; |
7629 | +} |
7630 | + |
7631 | static void dwc2_set_rk_params(struct dwc2_hsotg *hsotg) |
7632 | { |
7633 | struct dwc2_core_params *p = &hsotg->params; |
7634 | @@ -152,7 +159,8 @@ const struct of_device_id dwc2_of_match_table[] = { |
7635 | { .compatible = "lantiq,arx100-usb", .data = dwc2_set_ltq_params }, |
7636 | { .compatible = "lantiq,xrx200-usb", .data = dwc2_set_ltq_params }, |
7637 | { .compatible = "snps,dwc2" }, |
7638 | - { .compatible = "samsung,s3c6400-hsotg" }, |
7639 | + { .compatible = "samsung,s3c6400-hsotg", |
7640 | + .data = dwc2_set_s3c6400_params }, |
7641 | { .compatible = "amlogic,meson8-usb", |
7642 | .data = dwc2_set_amlogic_params }, |
7643 | { .compatible = "amlogic,meson8b-usb", |
7644 | diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c |
7645 | index 2a4ea9a1b1e3..5a5b37e0a140 100644 |
7646 | --- a/drivers/usb/dwc3/gadget.c |
7647 | +++ b/drivers/usb/dwc3/gadget.c |
7648 | @@ -921,8 +921,6 @@ static void __dwc3_prepare_one_trb(struct dwc3_ep *dep, struct dwc3_trb *trb, |
7649 | struct usb_gadget *gadget = &dwc->gadget; |
7650 | enum usb_device_speed speed = gadget->speed; |
7651 | |
7652 | - dwc3_ep_inc_enq(dep); |
7653 | - |
7654 | trb->size = DWC3_TRB_SIZE_LENGTH(length); |
7655 | trb->bpl = lower_32_bits(dma); |
7656 | trb->bph = upper_32_bits(dma); |
7657 | @@ -992,16 +990,20 @@ static void __dwc3_prepare_one_trb(struct dwc3_ep *dep, struct dwc3_trb *trb, |
7658 | usb_endpoint_type(dep->endpoint.desc)); |
7659 | } |
7660 | |
7661 | - /* always enable Continue on Short Packet */ |
7662 | + /* |
7663 | + * Enable Continue on Short Packet |
7664 | + * when endpoint is not a stream capable |
7665 | + */ |
7666 | if (usb_endpoint_dir_out(dep->endpoint.desc)) { |
7667 | - trb->ctrl |= DWC3_TRB_CTRL_CSP; |
7668 | + if (!dep->stream_capable) |
7669 | + trb->ctrl |= DWC3_TRB_CTRL_CSP; |
7670 | |
7671 | if (short_not_ok) |
7672 | trb->ctrl |= DWC3_TRB_CTRL_ISP_IMI; |
7673 | } |
7674 | |
7675 | if ((!no_interrupt && !chain) || |
7676 | - (dwc3_calc_trbs_left(dep) == 0)) |
7677 | + (dwc3_calc_trbs_left(dep) == 1)) |
7678 | trb->ctrl |= DWC3_TRB_CTRL_IOC; |
7679 | |
7680 | if (chain) |
7681 | @@ -1012,6 +1014,8 @@ static void __dwc3_prepare_one_trb(struct dwc3_ep *dep, struct dwc3_trb *trb, |
7682 | |
7683 | trb->ctrl |= DWC3_TRB_CTRL_HWO; |
7684 | |
7685 | + dwc3_ep_inc_enq(dep); |
7686 | + |
7687 | trace_dwc3_prepare_trb(dep, trb); |
7688 | } |
7689 | |
7690 | @@ -1115,7 +1119,7 @@ static void dwc3_prepare_one_trb_linear(struct dwc3_ep *dep, |
7691 | unsigned int maxp = usb_endpoint_maxp(dep->endpoint.desc); |
7692 | unsigned int rem = length % maxp; |
7693 | |
7694 | - if (rem && usb_endpoint_dir_out(dep->endpoint.desc)) { |
7695 | + if ((!length || rem) && usb_endpoint_dir_out(dep->endpoint.desc)) { |
7696 | struct dwc3 *dwc = dep->dwc; |
7697 | struct dwc3_trb *trb; |
7698 | |
7699 | diff --git a/drivers/usb/dwc3/trace.h b/drivers/usb/dwc3/trace.h |
7700 | index f22714cce070..f27c5cbe285c 100644 |
7701 | --- a/drivers/usb/dwc3/trace.h |
7702 | +++ b/drivers/usb/dwc3/trace.h |
7703 | @@ -251,9 +251,11 @@ DECLARE_EVENT_CLASS(dwc3_log_trb, |
7704 | s = "2x "; |
7705 | break; |
7706 | case 3: |
7707 | + default: |
7708 | s = "3x "; |
7709 | break; |
7710 | } |
7711 | + break; |
7712 | default: |
7713 | s = ""; |
7714 | } s; }), |
7715 | diff --git a/drivers/usb/gadget/udc/net2272.c b/drivers/usb/gadget/udc/net2272.c |
7716 | index 660878a19505..b77f3126580e 100644 |
7717 | --- a/drivers/usb/gadget/udc/net2272.c |
7718 | +++ b/drivers/usb/gadget/udc/net2272.c |
7719 | @@ -2083,7 +2083,7 @@ static irqreturn_t net2272_irq(int irq, void *_dev) |
7720 | #if defined(PLX_PCI_RDK2) |
7721 | /* see if PCI int for us by checking irqstat */ |
7722 | intcsr = readl(dev->rdk2.fpga_base_addr + RDK2_IRQSTAT); |
7723 | - if (!intcsr & (1 << NET2272_PCI_IRQ)) { |
7724 | + if (!(intcsr & (1 << NET2272_PCI_IRQ))) { |
7725 | spin_unlock(&dev->lock); |
7726 | return IRQ_NONE; |
7727 | } |
7728 | diff --git a/drivers/usb/mtu3/mtu3_core.c b/drivers/usb/mtu3/mtu3_core.c |
7729 | index ae70b9bfd797..860693520132 100644 |
7730 | --- a/drivers/usb/mtu3/mtu3_core.c |
7731 | +++ b/drivers/usb/mtu3/mtu3_core.c |
7732 | @@ -578,8 +578,10 @@ static void mtu3_regs_init(struct mtu3 *mtu) |
7733 | if (mtu->is_u3_ip) { |
7734 | /* disable LGO_U1/U2 by default */ |
7735 | mtu3_clrbits(mbase, U3D_LINK_POWER_CONTROL, |
7736 | - SW_U1_ACCEPT_ENABLE | SW_U2_ACCEPT_ENABLE | |
7737 | SW_U1_REQUEST_ENABLE | SW_U2_REQUEST_ENABLE); |
7738 | + /* enable accept LGO_U1/U2 link command from host */ |
7739 | + mtu3_setbits(mbase, U3D_LINK_POWER_CONTROL, |
7740 | + SW_U1_ACCEPT_ENABLE | SW_U2_ACCEPT_ENABLE); |
7741 | /* device responses to u3_exit from host automatically */ |
7742 | mtu3_clrbits(mbase, U3D_LTSSM_CTRL, SOFT_U3_EXIT_EN); |
7743 | /* automatically build U2 link when U3 detect fail */ |
7744 | diff --git a/drivers/usb/mtu3/mtu3_gadget_ep0.c b/drivers/usb/mtu3/mtu3_gadget_ep0.c |
7745 | index 25216e79cd6e..3c464d8ae023 100644 |
7746 | --- a/drivers/usb/mtu3/mtu3_gadget_ep0.c |
7747 | +++ b/drivers/usb/mtu3/mtu3_gadget_ep0.c |
7748 | @@ -336,9 +336,9 @@ static int ep0_handle_feature_dev(struct mtu3 *mtu, |
7749 | |
7750 | lpc = mtu3_readl(mbase, U3D_LINK_POWER_CONTROL); |
7751 | if (set) |
7752 | - lpc |= SW_U1_ACCEPT_ENABLE; |
7753 | + lpc |= SW_U1_REQUEST_ENABLE; |
7754 | else |
7755 | - lpc &= ~SW_U1_ACCEPT_ENABLE; |
7756 | + lpc &= ~SW_U1_REQUEST_ENABLE; |
7757 | mtu3_writel(mbase, U3D_LINK_POWER_CONTROL, lpc); |
7758 | |
7759 | mtu->u1_enable = !!set; |
7760 | @@ -351,9 +351,9 @@ static int ep0_handle_feature_dev(struct mtu3 *mtu, |
7761 | |
7762 | lpc = mtu3_readl(mbase, U3D_LINK_POWER_CONTROL); |
7763 | if (set) |
7764 | - lpc |= SW_U2_ACCEPT_ENABLE; |
7765 | + lpc |= SW_U2_REQUEST_ENABLE; |
7766 | else |
7767 | - lpc &= ~SW_U2_ACCEPT_ENABLE; |
7768 | + lpc &= ~SW_U2_REQUEST_ENABLE; |
7769 | mtu3_writel(mbase, U3D_LINK_POWER_CONTROL, lpc); |
7770 | |
7771 | mtu->u2_enable = !!set; |
7772 | diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c |
7773 | index 23a0df79ef21..403eb97915f8 100644 |
7774 | --- a/drivers/usb/musb/musb_dsps.c |
7775 | +++ b/drivers/usb/musb/musb_dsps.c |
7776 | @@ -181,9 +181,11 @@ static void dsps_musb_enable(struct musb *musb) |
7777 | |
7778 | musb_writel(reg_base, wrp->epintr_set, epmask); |
7779 | musb_writel(reg_base, wrp->coreintr_set, coremask); |
7780 | - /* start polling for ID change in dual-role idle mode */ |
7781 | - if (musb->xceiv->otg->state == OTG_STATE_B_IDLE && |
7782 | - musb->port_mode == MUSB_OTG) |
7783 | + /* |
7784 | + * start polling for runtime PM active and idle, |
7785 | + * and for ID change in dual-role idle mode. |
7786 | + */ |
7787 | + if (musb->xceiv->otg->state == OTG_STATE_B_IDLE) |
7788 | dsps_mod_timer(glue, -1); |
7789 | } |
7790 | |
7791 | @@ -227,8 +229,13 @@ static int dsps_check_status(struct musb *musb, void *unused) |
7792 | |
7793 | switch (musb->xceiv->otg->state) { |
7794 | case OTG_STATE_A_WAIT_VRISE: |
7795 | - dsps_mod_timer_optional(glue); |
7796 | - break; |
7797 | + if (musb->port_mode == MUSB_HOST) { |
7798 | + musb->xceiv->otg->state = OTG_STATE_A_WAIT_BCON; |
7799 | + dsps_mod_timer_optional(glue); |
7800 | + break; |
7801 | + } |
7802 | + /* fall through */ |
7803 | + |
7804 | case OTG_STATE_A_WAIT_BCON: |
7805 | /* keep VBUS on for host-only mode */ |
7806 | if (musb->port_mode == MUSB_HOST) { |
7807 | @@ -249,6 +256,10 @@ static int dsps_check_status(struct musb *musb, void *unused) |
7808 | musb->xceiv->otg->state = OTG_STATE_A_IDLE; |
7809 | MUSB_HST_MODE(musb); |
7810 | } |
7811 | + |
7812 | + if (musb->port_mode == MUSB_PERIPHERAL) |
7813 | + skip_session = 1; |
7814 | + |
7815 | if (!(devctl & MUSB_DEVCTL_SESSION) && !skip_session) |
7816 | musb_writeb(mregs, MUSB_DEVCTL, |
7817 | MUSB_DEVCTL_SESSION); |
7818 | diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c |
7819 | index eae8b1b1b45b..ffe462a657b1 100644 |
7820 | --- a/drivers/usb/musb/musb_gadget.c |
7821 | +++ b/drivers/usb/musb/musb_gadget.c |
7822 | @@ -452,13 +452,10 @@ void musb_g_tx(struct musb *musb, u8 epnum) |
7823 | } |
7824 | |
7825 | if (request) { |
7826 | - u8 is_dma = 0; |
7827 | - bool short_packet = false; |
7828 | |
7829 | trace_musb_req_tx(req); |
7830 | |
7831 | if (dma && (csr & MUSB_TXCSR_DMAENAB)) { |
7832 | - is_dma = 1; |
7833 | csr |= MUSB_TXCSR_P_WZC_BITS; |
7834 | csr &= ~(MUSB_TXCSR_DMAENAB | MUSB_TXCSR_P_UNDERRUN | |
7835 | MUSB_TXCSR_TXPKTRDY | MUSB_TXCSR_AUTOSET); |
7836 | @@ -476,16 +473,8 @@ void musb_g_tx(struct musb *musb, u8 epnum) |
7837 | */ |
7838 | if ((request->zero && request->length) |
7839 | && (request->length % musb_ep->packet_sz == 0) |
7840 | - && (request->actual == request->length)) |
7841 | - short_packet = true; |
7842 | + && (request->actual == request->length)) { |
7843 | |
7844 | - if ((musb_dma_inventra(musb) || musb_dma_ux500(musb)) && |
7845 | - (is_dma && (!dma->desired_mode || |
7846 | - (request->actual & |
7847 | - (musb_ep->packet_sz - 1))))) |
7848 | - short_packet = true; |
7849 | - |
7850 | - if (short_packet) { |
7851 | /* |
7852 | * On DMA completion, FIFO may not be |
7853 | * available yet... |
7854 | diff --git a/drivers/usb/musb/musbhsdma.c b/drivers/usb/musb/musbhsdma.c |
7855 | index a688f7f87829..5fc6825745f2 100644 |
7856 | --- a/drivers/usb/musb/musbhsdma.c |
7857 | +++ b/drivers/usb/musb/musbhsdma.c |
7858 | @@ -346,12 +346,10 @@ static irqreturn_t dma_controller_irq(int irq, void *private_data) |
7859 | channel->status = MUSB_DMA_STATUS_FREE; |
7860 | |
7861 | /* completed */ |
7862 | - if ((devctl & MUSB_DEVCTL_HM) |
7863 | - && (musb_channel->transmit) |
7864 | - && ((channel->desired_mode == 0) |
7865 | - || (channel->actual_len & |
7866 | - (musb_channel->max_packet_sz - 1))) |
7867 | - ) { |
7868 | + if (musb_channel->transmit && |
7869 | + (!channel->desired_mode || |
7870 | + (channel->actual_len % |
7871 | + musb_channel->max_packet_sz))) { |
7872 | u8 epnum = musb_channel->epnum; |
7873 | int offset = musb->io.ep_offset(epnum, |
7874 | MUSB_TXCSR); |
7875 | @@ -363,11 +361,14 @@ static irqreturn_t dma_controller_irq(int irq, void *private_data) |
7876 | */ |
7877 | musb_ep_select(mbase, epnum); |
7878 | txcsr = musb_readw(mbase, offset); |
7879 | - txcsr &= ~(MUSB_TXCSR_DMAENAB |
7880 | + if (channel->desired_mode == 1) { |
7881 | + txcsr &= ~(MUSB_TXCSR_DMAENAB |
7882 | | MUSB_TXCSR_AUTOSET); |
7883 | - musb_writew(mbase, offset, txcsr); |
7884 | - /* Send out the packet */ |
7885 | - txcsr &= ~MUSB_TXCSR_DMAMODE; |
7886 | + musb_writew(mbase, offset, txcsr); |
7887 | + /* Send out the packet */ |
7888 | + txcsr &= ~MUSB_TXCSR_DMAMODE; |
7889 | + txcsr |= MUSB_TXCSR_DMAENAB; |
7890 | + } |
7891 | txcsr |= MUSB_TXCSR_TXPKTRDY; |
7892 | musb_writew(mbase, offset, txcsr); |
7893 | } |
7894 | diff --git a/drivers/usb/phy/phy-am335x.c b/drivers/usb/phy/phy-am335x.c |
7895 | index 27bdb7222527..f5f0568d8533 100644 |
7896 | --- a/drivers/usb/phy/phy-am335x.c |
7897 | +++ b/drivers/usb/phy/phy-am335x.c |
7898 | @@ -61,9 +61,6 @@ static int am335x_phy_probe(struct platform_device *pdev) |
7899 | if (ret) |
7900 | return ret; |
7901 | |
7902 | - ret = usb_add_phy_dev(&am_phy->usb_phy_gen.phy); |
7903 | - if (ret) |
7904 | - return ret; |
7905 | am_phy->usb_phy_gen.phy.init = am335x_init; |
7906 | am_phy->usb_phy_gen.phy.shutdown = am335x_shutdown; |
7907 | |
7908 | @@ -82,7 +79,7 @@ static int am335x_phy_probe(struct platform_device *pdev) |
7909 | device_set_wakeup_enable(dev, false); |
7910 | phy_ctrl_power(am_phy->phy_ctrl, am_phy->id, am_phy->dr_mode, false); |
7911 | |
7912 | - return 0; |
7913 | + return usb_add_phy_dev(&am_phy->usb_phy_gen.phy); |
7914 | } |
7915 | |
7916 | static int am335x_phy_remove(struct platform_device *pdev) |
7917 | diff --git a/drivers/usb/renesas_usbhs/common.c b/drivers/usb/renesas_usbhs/common.c |
7918 | index a3e1290d682d..1de333be9353 100644 |
7919 | --- a/drivers/usb/renesas_usbhs/common.c |
7920 | +++ b/drivers/usb/renesas_usbhs/common.c |
7921 | @@ -539,6 +539,10 @@ static int usbhsc_drvcllbck_notify_hotplug(struct platform_device *pdev) |
7922 | * platform functions |
7923 | */ |
7924 | static const struct of_device_id usbhs_of_match[] = { |
7925 | + { |
7926 | + .compatible = "renesas,usbhs-r8a774c0", |
7927 | + .data = (void *)USBHS_TYPE_RCAR_GEN3_WITH_PLL, |
7928 | + }, |
7929 | { |
7930 | .compatible = "renesas,usbhs-r8a7790", |
7931 | .data = (void *)USBHS_TYPE_RCAR_GEN2, |
7932 | diff --git a/drivers/video/fbdev/clps711x-fb.c b/drivers/video/fbdev/clps711x-fb.c |
7933 | index ff561073ee4e..42f909618f04 100644 |
7934 | --- a/drivers/video/fbdev/clps711x-fb.c |
7935 | +++ b/drivers/video/fbdev/clps711x-fb.c |
7936 | @@ -287,14 +287,17 @@ static int clps711x_fb_probe(struct platform_device *pdev) |
7937 | } |
7938 | |
7939 | ret = of_get_fb_videomode(disp, &cfb->mode, OF_USE_NATIVE_MODE); |
7940 | - if (ret) |
7941 | + if (ret) { |
7942 | + of_node_put(disp); |
7943 | goto out_fb_release; |
7944 | + } |
7945 | |
7946 | of_property_read_u32(disp, "ac-prescale", &cfb->ac_prescale); |
7947 | cfb->cmap_invert = of_property_read_bool(disp, "cmap-invert"); |
7948 | |
7949 | ret = of_property_read_u32(disp, "bits-per-pixel", |
7950 | &info->var.bits_per_pixel); |
7951 | + of_node_put(disp); |
7952 | if (ret) |
7953 | goto out_fb_release; |
7954 | |
7955 | diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c |
7956 | index 8958ccc8b1ac..8976190b6c1f 100644 |
7957 | --- a/drivers/video/fbdev/core/fbcon.c |
7958 | +++ b/drivers/video/fbdev/core/fbcon.c |
7959 | @@ -3064,7 +3064,7 @@ static int fbcon_fb_unbind(int idx) |
7960 | for (i = first_fb_vc; i <= last_fb_vc; i++) { |
7961 | if (con2fb_map[i] != idx && |
7962 | con2fb_map[i] != -1) { |
7963 | - new_idx = i; |
7964 | + new_idx = con2fb_map[i]; |
7965 | break; |
7966 | } |
7967 | } |
7968 | diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c |
7969 | index 861bf8081619..7dd6924feaa8 100644 |
7970 | --- a/drivers/video/fbdev/core/fbmem.c |
7971 | +++ b/drivers/video/fbdev/core/fbmem.c |
7972 | @@ -436,7 +436,9 @@ static void fb_do_show_logo(struct fb_info *info, struct fb_image *image, |
7973 | image->dx += image->width + 8; |
7974 | } |
7975 | } else if (rotate == FB_ROTATE_UD) { |
7976 | - for (x = 0; x < num; x++) { |
7977 | + u32 dx = image->dx; |
7978 | + |
7979 | + for (x = 0; x < num && image->dx <= dx; x++) { |
7980 | info->fbops->fb_imageblit(info, image); |
7981 | image->dx -= image->width + 8; |
7982 | } |
7983 | @@ -448,7 +450,9 @@ static void fb_do_show_logo(struct fb_info *info, struct fb_image *image, |
7984 | image->dy += image->height + 8; |
7985 | } |
7986 | } else if (rotate == FB_ROTATE_CCW) { |
7987 | - for (x = 0; x < num; x++) { |
7988 | + u32 dy = image->dy; |
7989 | + |
7990 | + for (x = 0; x < num && image->dy <= dy; x++) { |
7991 | info->fbops->fb_imageblit(info, image); |
7992 | image->dy -= image->height + 8; |
7993 | } |
7994 | diff --git a/drivers/virt/vboxguest/vboxguest_core.c b/drivers/virt/vboxguest/vboxguest_core.c |
7995 | index 3093655c7b92..1475ed5ffcde 100644 |
7996 | --- a/drivers/virt/vboxguest/vboxguest_core.c |
7997 | +++ b/drivers/virt/vboxguest/vboxguest_core.c |
7998 | @@ -1312,7 +1312,7 @@ static int vbg_ioctl_hgcm_call(struct vbg_dev *gdev, |
7999 | return -EINVAL; |
8000 | } |
8001 | |
8002 | - if (f32bit) |
8003 | + if (IS_ENABLED(CONFIG_COMPAT) && f32bit) |
8004 | ret = vbg_hgcm_call32(gdev, client_id, |
8005 | call->function, call->timeout_ms, |
8006 | VBG_IOCTL_HGCM_CALL_PARMS32(call), |
8007 | diff --git a/drivers/watchdog/renesas_wdt.c b/drivers/watchdog/renesas_wdt.c |
8008 | index 0d74c3e48979..55c9eb6c6e51 100644 |
8009 | --- a/drivers/watchdog/renesas_wdt.c |
8010 | +++ b/drivers/watchdog/renesas_wdt.c |
8011 | @@ -74,12 +74,17 @@ static int rwdt_init_timeout(struct watchdog_device *wdev) |
8012 | static int rwdt_start(struct watchdog_device *wdev) |
8013 | { |
8014 | struct rwdt_priv *priv = watchdog_get_drvdata(wdev); |
8015 | + u8 val; |
8016 | |
8017 | pm_runtime_get_sync(wdev->parent); |
8018 | |
8019 | - rwdt_write(priv, 0, RWTCSRB); |
8020 | - rwdt_write(priv, priv->cks, RWTCSRA); |
8021 | + /* Stop the timer before we modify any register */ |
8022 | + val = readb_relaxed(priv->base + RWTCSRA) & ~RWTCSRA_TME; |
8023 | + rwdt_write(priv, val, RWTCSRA); |
8024 | + |
8025 | rwdt_init_timeout(wdev); |
8026 | + rwdt_write(priv, priv->cks, RWTCSRA); |
8027 | + rwdt_write(priv, 0, RWTCSRB); |
8028 | |
8029 | while (readb_relaxed(priv->base + RWTCSRA) & RWTCSRA_WRFLG) |
8030 | cpu_relax(); |
8031 | diff --git a/fs/binfmt_script.c b/fs/binfmt_script.c |
8032 | index 7cde3f46ad26..d0078cbb718b 100644 |
8033 | --- a/fs/binfmt_script.c |
8034 | +++ b/fs/binfmt_script.c |
8035 | @@ -42,10 +42,14 @@ static int load_script(struct linux_binprm *bprm) |
8036 | fput(bprm->file); |
8037 | bprm->file = NULL; |
8038 | |
8039 | - bprm->buf[BINPRM_BUF_SIZE - 1] = '\0'; |
8040 | - if ((cp = strchr(bprm->buf, '\n')) == NULL) |
8041 | - cp = bprm->buf+BINPRM_BUF_SIZE-1; |
8042 | + for (cp = bprm->buf+2;; cp++) { |
8043 | + if (cp >= bprm->buf + BINPRM_BUF_SIZE) |
8044 | + return -ENOEXEC; |
8045 | + if (!*cp || (*cp == '\n')) |
8046 | + break; |
8047 | + } |
8048 | *cp = '\0'; |
8049 | + |
8050 | while (cp > bprm->buf) { |
8051 | cp--; |
8052 | if ((*cp == ' ') || (*cp == '\t')) |
8053 | diff --git a/fs/btrfs/btrfs_inode.h b/fs/btrfs/btrfs_inode.h |
8054 | index a0e230b31a88..20288b49718f 100644 |
8055 | --- a/fs/btrfs/btrfs_inode.h |
8056 | +++ b/fs/btrfs/btrfs_inode.h |
8057 | @@ -29,6 +29,7 @@ enum { |
8058 | BTRFS_INODE_IN_DELALLOC_LIST, |
8059 | BTRFS_INODE_READDIO_NEED_LOCK, |
8060 | BTRFS_INODE_HAS_PROPS, |
8061 | + BTRFS_INODE_SNAPSHOT_FLUSH, |
8062 | }; |
8063 | |
8064 | /* in memory btrfs inode */ |
8065 | diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h |
8066 | index 68f322f600a0..131e90aad941 100644 |
8067 | --- a/fs/btrfs/ctree.h |
8068 | +++ b/fs/btrfs/ctree.h |
8069 | @@ -3141,7 +3141,7 @@ int btrfs_truncate_inode_items(struct btrfs_trans_handle *trans, |
8070 | struct inode *inode, u64 new_size, |
8071 | u32 min_type); |
8072 | |
8073 | -int btrfs_start_delalloc_inodes(struct btrfs_root *root); |
8074 | +int btrfs_start_delalloc_snapshot(struct btrfs_root *root); |
8075 | int btrfs_start_delalloc_roots(struct btrfs_fs_info *fs_info, int nr); |
8076 | int btrfs_set_extent_delalloc(struct inode *inode, u64 start, u64 end, |
8077 | unsigned int extra_bits, |
8078 | diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c |
8079 | index d228f706ff3e..c8e886caacd7 100644 |
8080 | --- a/fs/btrfs/extent_io.c |
8081 | +++ b/fs/btrfs/extent_io.c |
8082 | @@ -3934,12 +3934,25 @@ static int extent_write_cache_pages(struct address_space *mapping, |
8083 | range_whole = 1; |
8084 | scanned = 1; |
8085 | } |
8086 | - if (wbc->sync_mode == WB_SYNC_ALL) |
8087 | + |
8088 | + /* |
8089 | + * We do the tagged writepage as long as the snapshot flush bit is set |
8090 | + * and we are the first one who do the filemap_flush() on this inode. |
8091 | + * |
8092 | + * The nr_to_write == LONG_MAX is needed to make sure other flushers do |
8093 | + * not race in and drop the bit. |
8094 | + */ |
8095 | + if (range_whole && wbc->nr_to_write == LONG_MAX && |
8096 | + test_and_clear_bit(BTRFS_INODE_SNAPSHOT_FLUSH, |
8097 | + &BTRFS_I(inode)->runtime_flags)) |
8098 | + wbc->tagged_writepages = 1; |
8099 | + |
8100 | + if (wbc->sync_mode == WB_SYNC_ALL || wbc->tagged_writepages) |
8101 | tag = PAGECACHE_TAG_TOWRITE; |
8102 | else |
8103 | tag = PAGECACHE_TAG_DIRTY; |
8104 | retry: |
8105 | - if (wbc->sync_mode == WB_SYNC_ALL) |
8106 | + if (wbc->sync_mode == WB_SYNC_ALL || wbc->tagged_writepages) |
8107 | tag_pages_for_writeback(mapping, index, end); |
8108 | done_index = index; |
8109 | while (!done && !nr_to_write_done && (index <= end) && |
8110 | diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c |
8111 | index 561bffcb56a0..965a64bde6fd 100644 |
8112 | --- a/fs/btrfs/inode.c |
8113 | +++ b/fs/btrfs/inode.c |
8114 | @@ -9988,7 +9988,7 @@ static struct btrfs_delalloc_work *btrfs_alloc_delalloc_work(struct inode *inode |
8115 | * some fairly slow code that needs optimization. This walks the list |
8116 | * of all the inodes with pending delalloc and forces them to disk. |
8117 | */ |
8118 | -static int start_delalloc_inodes(struct btrfs_root *root, int nr) |
8119 | +static int start_delalloc_inodes(struct btrfs_root *root, int nr, bool snapshot) |
8120 | { |
8121 | struct btrfs_inode *binode; |
8122 | struct inode *inode; |
8123 | @@ -10016,6 +10016,9 @@ static int start_delalloc_inodes(struct btrfs_root *root, int nr) |
8124 | } |
8125 | spin_unlock(&root->delalloc_lock); |
8126 | |
8127 | + if (snapshot) |
8128 | + set_bit(BTRFS_INODE_SNAPSHOT_FLUSH, |
8129 | + &binode->runtime_flags); |
8130 | work = btrfs_alloc_delalloc_work(inode); |
8131 | if (!work) { |
8132 | iput(inode); |
8133 | @@ -10049,7 +10052,7 @@ out: |
8134 | return ret; |
8135 | } |
8136 | |
8137 | -int btrfs_start_delalloc_inodes(struct btrfs_root *root) |
8138 | +int btrfs_start_delalloc_snapshot(struct btrfs_root *root) |
8139 | { |
8140 | struct btrfs_fs_info *fs_info = root->fs_info; |
8141 | int ret; |
8142 | @@ -10057,7 +10060,7 @@ int btrfs_start_delalloc_inodes(struct btrfs_root *root) |
8143 | if (test_bit(BTRFS_FS_STATE_ERROR, &fs_info->fs_state)) |
8144 | return -EROFS; |
8145 | |
8146 | - ret = start_delalloc_inodes(root, -1); |
8147 | + ret = start_delalloc_inodes(root, -1, true); |
8148 | if (ret > 0) |
8149 | ret = 0; |
8150 | return ret; |
8151 | @@ -10086,7 +10089,7 @@ int btrfs_start_delalloc_roots(struct btrfs_fs_info *fs_info, int nr) |
8152 | &fs_info->delalloc_roots); |
8153 | spin_unlock(&fs_info->delalloc_root_lock); |
8154 | |
8155 | - ret = start_delalloc_inodes(root, nr); |
8156 | + ret = start_delalloc_inodes(root, nr, false); |
8157 | btrfs_put_fs_root(root); |
8158 | if (ret < 0) |
8159 | goto out; |
8160 | diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c |
8161 | index 802a628e9f7d..87f4f0f65dbb 100644 |
8162 | --- a/fs/btrfs/ioctl.c |
8163 | +++ b/fs/btrfs/ioctl.c |
8164 | @@ -777,7 +777,7 @@ static int create_snapshot(struct btrfs_root *root, struct inode *dir, |
8165 | wait_event(root->subv_writers->wait, |
8166 | percpu_counter_sum(&root->subv_writers->counter) == 0); |
8167 | |
8168 | - ret = btrfs_start_delalloc_inodes(root); |
8169 | + ret = btrfs_start_delalloc_snapshot(root); |
8170 | if (ret) |
8171 | goto dec_and_free; |
8172 | |
8173 | diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c |
8174 | index ea5fa9df9405..6f09f6032db3 100644 |
8175 | --- a/fs/btrfs/volumes.c |
8176 | +++ b/fs/btrfs/volumes.c |
8177 | @@ -850,6 +850,35 @@ static noinline struct btrfs_device *device_list_add(const char *path, |
8178 | return ERR_PTR(-EEXIST); |
8179 | } |
8180 | |
8181 | + /* |
8182 | + * We are going to replace the device path for a given devid, |
8183 | + * make sure it's the same device if the device is mounted |
8184 | + */ |
8185 | + if (device->bdev) { |
8186 | + struct block_device *path_bdev; |
8187 | + |
8188 | + path_bdev = lookup_bdev(path); |
8189 | + if (IS_ERR(path_bdev)) { |
8190 | + mutex_unlock(&fs_devices->device_list_mutex); |
8191 | + return ERR_CAST(path_bdev); |
8192 | + } |
8193 | + |
8194 | + if (device->bdev != path_bdev) { |
8195 | + bdput(path_bdev); |
8196 | + mutex_unlock(&fs_devices->device_list_mutex); |
8197 | + btrfs_warn_in_rcu(device->fs_info, |
8198 | + "duplicate device fsid:devid for %pU:%llu old:%s new:%s", |
8199 | + disk_super->fsid, devid, |
8200 | + rcu_str_deref(device->name), path); |
8201 | + return ERR_PTR(-EEXIST); |
8202 | + } |
8203 | + bdput(path_bdev); |
8204 | + btrfs_info_in_rcu(device->fs_info, |
8205 | + "device fsid %pU devid %llu moved old:%s new:%s", |
8206 | + disk_super->fsid, devid, |
8207 | + rcu_str_deref(device->name), path); |
8208 | + } |
8209 | + |
8210 | name = rcu_string_strdup(path, GFP_NOFS); |
8211 | if (!name) { |
8212 | mutex_unlock(&fs_devices->device_list_mutex); |
8213 | diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c |
8214 | index e169e1a5fd35..3925a7bfc74d 100644 |
8215 | --- a/fs/cifs/readdir.c |
8216 | +++ b/fs/cifs/readdir.c |
8217 | @@ -655,7 +655,14 @@ find_cifs_entry(const unsigned int xid, struct cifs_tcon *tcon, loff_t pos, |
8218 | /* scan and find it */ |
8219 | int i; |
8220 | char *cur_ent; |
8221 | - char *end_of_smb = cfile->srch_inf.ntwrk_buf_start + |
8222 | + char *end_of_smb; |
8223 | + |
8224 | + if (cfile->srch_inf.ntwrk_buf_start == NULL) { |
8225 | + cifs_dbg(VFS, "ntwrk_buf_start is NULL during readdir\n"); |
8226 | + return -EIO; |
8227 | + } |
8228 | + |
8229 | + end_of_smb = cfile->srch_inf.ntwrk_buf_start + |
8230 | server->ops->calc_smb_size( |
8231 | cfile->srch_inf.ntwrk_buf_start, |
8232 | server); |
8233 | diff --git a/fs/dlm/ast.c b/fs/dlm/ast.c |
8234 | index 562fa8c3edff..47ee66d70109 100644 |
8235 | --- a/fs/dlm/ast.c |
8236 | +++ b/fs/dlm/ast.c |
8237 | @@ -292,6 +292,8 @@ void dlm_callback_suspend(struct dlm_ls *ls) |
8238 | flush_workqueue(ls->ls_callback_wq); |
8239 | } |
8240 | |
8241 | +#define MAX_CB_QUEUE 25 |
8242 | + |
8243 | void dlm_callback_resume(struct dlm_ls *ls) |
8244 | { |
8245 | struct dlm_lkb *lkb, *safe; |
8246 | @@ -302,15 +304,23 @@ void dlm_callback_resume(struct dlm_ls *ls) |
8247 | if (!ls->ls_callback_wq) |
8248 | return; |
8249 | |
8250 | +more: |
8251 | mutex_lock(&ls->ls_cb_mutex); |
8252 | list_for_each_entry_safe(lkb, safe, &ls->ls_cb_delay, lkb_cb_list) { |
8253 | list_del_init(&lkb->lkb_cb_list); |
8254 | queue_work(ls->ls_callback_wq, &lkb->lkb_cb_work); |
8255 | count++; |
8256 | + if (count == MAX_CB_QUEUE) |
8257 | + break; |
8258 | } |
8259 | mutex_unlock(&ls->ls_cb_mutex); |
8260 | |
8261 | if (count) |
8262 | log_rinfo(ls, "dlm_callback_resume %d", count); |
8263 | + if (count == MAX_CB_QUEUE) { |
8264 | + count = 0; |
8265 | + cond_resched(); |
8266 | + goto more; |
8267 | + } |
8268 | } |
8269 | |
8270 | diff --git a/fs/eventpoll.c b/fs/eventpoll.c |
8271 | index 42bbe6824b4b..58f48ea0db23 100644 |
8272 | --- a/fs/eventpoll.c |
8273 | +++ b/fs/eventpoll.c |
8274 | @@ -1154,7 +1154,7 @@ static int ep_poll_callback(wait_queue_entry_t *wait, unsigned mode, int sync, v |
8275 | * semantics). All the events that happen during that period of time are |
8276 | * chained in ep->ovflist and requeued later on. |
8277 | */ |
8278 | - if (unlikely(ep->ovflist != EP_UNACTIVE_PTR)) { |
8279 | + if (ep->ovflist != EP_UNACTIVE_PTR) { |
8280 | if (epi->next == EP_UNACTIVE_PTR) { |
8281 | epi->next = ep->ovflist; |
8282 | ep->ovflist = epi; |
8283 | diff --git a/fs/f2fs/acl.c b/fs/f2fs/acl.c |
8284 | index fa707cdd4120..22f0d17cde43 100644 |
8285 | --- a/fs/f2fs/acl.c |
8286 | +++ b/fs/f2fs/acl.c |
8287 | @@ -352,12 +352,14 @@ static int f2fs_acl_create(struct inode *dir, umode_t *mode, |
8288 | return PTR_ERR(p); |
8289 | |
8290 | clone = f2fs_acl_clone(p, GFP_NOFS); |
8291 | - if (!clone) |
8292 | - goto no_mem; |
8293 | + if (!clone) { |
8294 | + ret = -ENOMEM; |
8295 | + goto release_acl; |
8296 | + } |
8297 | |
8298 | ret = f2fs_acl_create_masq(clone, mode); |
8299 | if (ret < 0) |
8300 | - goto no_mem_clone; |
8301 | + goto release_clone; |
8302 | |
8303 | if (ret == 0) |
8304 | posix_acl_release(clone); |
8305 | @@ -371,11 +373,11 @@ static int f2fs_acl_create(struct inode *dir, umode_t *mode, |
8306 | |
8307 | return 0; |
8308 | |
8309 | -no_mem_clone: |
8310 | +release_clone: |
8311 | posix_acl_release(clone); |
8312 | -no_mem: |
8313 | +release_acl: |
8314 | posix_acl_release(p); |
8315 | - return -ENOMEM; |
8316 | + return ret; |
8317 | } |
8318 | |
8319 | int f2fs_init_acl(struct inode *inode, struct inode *dir, struct page *ipage, |
8320 | diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c |
8321 | index 9c28ea439e0b..e5719fcac47d 100644 |
8322 | --- a/fs/f2fs/checkpoint.c |
8323 | +++ b/fs/f2fs/checkpoint.c |
8324 | @@ -1290,11 +1290,12 @@ static void commit_checkpoint(struct f2fs_sb_info *sbi, |
8325 | struct page *page = f2fs_grab_meta_page(sbi, blk_addr); |
8326 | int err; |
8327 | |
8328 | - memcpy(page_address(page), src, PAGE_SIZE); |
8329 | - set_page_dirty(page); |
8330 | - |
8331 | f2fs_wait_on_page_writeback(page, META, true); |
8332 | f2fs_bug_on(sbi, PageWriteback(page)); |
8333 | + |
8334 | + memcpy(page_address(page), src, PAGE_SIZE); |
8335 | + |
8336 | + set_page_dirty(page); |
8337 | if (unlikely(!clear_page_dirty_for_io(page))) |
8338 | f2fs_bug_on(sbi, 1); |
8339 | |
8340 | diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c |
8341 | index 17049b030b6c..e90ca6aa3a00 100644 |
8342 | --- a/fs/f2fs/data.c |
8343 | +++ b/fs/f2fs/data.c |
8344 | @@ -2326,6 +2326,7 @@ static int prepare_write_begin(struct f2fs_sb_info *sbi, |
8345 | bool locked = false; |
8346 | struct extent_info ei = {0,0,0}; |
8347 | int err = 0; |
8348 | + int flag; |
8349 | |
8350 | /* |
8351 | * we already allocated all the blocks, so we don't need to get |
8352 | @@ -2335,9 +2336,15 @@ static int prepare_write_begin(struct f2fs_sb_info *sbi, |
8353 | !is_inode_flag_set(inode, FI_NO_PREALLOC)) |
8354 | return 0; |
8355 | |
8356 | + /* f2fs_lock_op avoids race between write CP and convert_inline_page */ |
8357 | + if (f2fs_has_inline_data(inode) && pos + len > MAX_INLINE_DATA(inode)) |
8358 | + flag = F2FS_GET_BLOCK_DEFAULT; |
8359 | + else |
8360 | + flag = F2FS_GET_BLOCK_PRE_AIO; |
8361 | + |
8362 | if (f2fs_has_inline_data(inode) || |
8363 | (pos & PAGE_MASK) >= i_size_read(inode)) { |
8364 | - __do_map_lock(sbi, F2FS_GET_BLOCK_PRE_AIO, true); |
8365 | + __do_map_lock(sbi, flag, true); |
8366 | locked = true; |
8367 | } |
8368 | restart: |
8369 | @@ -2375,6 +2382,7 @@ restart: |
8370 | f2fs_put_dnode(&dn); |
8371 | __do_map_lock(sbi, F2FS_GET_BLOCK_PRE_AIO, |
8372 | true); |
8373 | + WARN_ON(flag != F2FS_GET_BLOCK_PRE_AIO); |
8374 | locked = true; |
8375 | goto restart; |
8376 | } |
8377 | @@ -2388,7 +2396,7 @@ out: |
8378 | f2fs_put_dnode(&dn); |
8379 | unlock_out: |
8380 | if (locked) |
8381 | - __do_map_lock(sbi, F2FS_GET_BLOCK_PRE_AIO, false); |
8382 | + __do_map_lock(sbi, flag, false); |
8383 | return err; |
8384 | } |
8385 | |
8386 | diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h |
8387 | index 1e031971a466..689c10ad57fe 100644 |
8388 | --- a/fs/f2fs/f2fs.h |
8389 | +++ b/fs/f2fs/f2fs.h |
8390 | @@ -2672,10 +2672,19 @@ static inline bool is_dot_dotdot(const struct qstr *str) |
8391 | |
8392 | static inline bool f2fs_may_extent_tree(struct inode *inode) |
8393 | { |
8394 | - if (!test_opt(F2FS_I_SB(inode), EXTENT_CACHE) || |
8395 | + struct f2fs_sb_info *sbi = F2FS_I_SB(inode); |
8396 | + |
8397 | + if (!test_opt(sbi, EXTENT_CACHE) || |
8398 | is_inode_flag_set(inode, FI_NO_EXTENT)) |
8399 | return false; |
8400 | |
8401 | + /* |
8402 | + * for recovered files during mount do not create extents |
8403 | + * if shrinker is not registered. |
8404 | + */ |
8405 | + if (list_empty(&sbi->s_list)) |
8406 | + return false; |
8407 | + |
8408 | return S_ISREG(inode->i_mode); |
8409 | } |
8410 | |
8411 | diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c |
8412 | index 88b124677189..9eaf07fd8b4c 100644 |
8413 | --- a/fs/f2fs/file.c |
8414 | +++ b/fs/f2fs/file.c |
8415 | @@ -216,6 +216,9 @@ static int f2fs_do_sync_file(struct file *file, loff_t start, loff_t end, |
8416 | |
8417 | trace_f2fs_sync_file_enter(inode); |
8418 | |
8419 | + if (S_ISDIR(inode->i_mode)) |
8420 | + goto go_write; |
8421 | + |
8422 | /* if fdatasync is triggered, let's do in-place-update */ |
8423 | if (datasync || get_dirty_pages(inode) <= SM_I(sbi)->min_fsync_blocks) |
8424 | set_inode_flag(inode, FI_NEED_IPU); |
8425 | diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c |
8426 | index a07241fb8537..74f72dccab57 100644 |
8427 | --- a/fs/f2fs/gc.c |
8428 | +++ b/fs/f2fs/gc.c |
8429 | @@ -658,6 +658,14 @@ got_it: |
8430 | fio.page = page; |
8431 | fio.new_blkaddr = fio.old_blkaddr = dn.data_blkaddr; |
8432 | |
8433 | + /* |
8434 | + * don't cache encrypted data into meta inode until previous dirty |
8435 | + * data were writebacked to avoid racing between GC and flush. |
8436 | + */ |
8437 | + f2fs_wait_on_page_writeback(page, DATA, true); |
8438 | + |
8439 | + f2fs_wait_on_block_writeback(inode, dn.data_blkaddr); |
8440 | + |
8441 | fio.encrypted_page = f2fs_pagecache_get_page(META_MAPPING(sbi), |
8442 | dn.data_blkaddr, |
8443 | FGP_LOCK | FGP_CREAT, GFP_NOFS); |
8444 | @@ -745,6 +753,8 @@ static int move_data_block(struct inode *inode, block_t bidx, |
8445 | */ |
8446 | f2fs_wait_on_page_writeback(page, DATA, true); |
8447 | |
8448 | + f2fs_wait_on_block_writeback(inode, dn.data_blkaddr); |
8449 | + |
8450 | err = f2fs_get_node_info(fio.sbi, dn.nid, &ni); |
8451 | if (err) |
8452 | goto put_out; |
8453 | @@ -802,8 +812,8 @@ static int move_data_block(struct inode *inode, block_t bidx, |
8454 | } |
8455 | |
8456 | write_page: |
8457 | - set_page_dirty(fio.encrypted_page); |
8458 | f2fs_wait_on_page_writeback(fio.encrypted_page, DATA, true); |
8459 | + set_page_dirty(fio.encrypted_page); |
8460 | if (clear_page_dirty_for_io(fio.encrypted_page)) |
8461 | dec_page_count(fio.sbi, F2FS_DIRTY_META); |
8462 | |
8463 | @@ -897,8 +907,9 @@ static int move_data_page(struct inode *inode, block_t bidx, int gc_type, |
8464 | bool is_dirty = PageDirty(page); |
8465 | |
8466 | retry: |
8467 | - set_page_dirty(page); |
8468 | f2fs_wait_on_page_writeback(page, DATA, true); |
8469 | + |
8470 | + set_page_dirty(page); |
8471 | if (clear_page_dirty_for_io(page)) { |
8472 | inode_dec_dirty_pages(inode); |
8473 | f2fs_remove_dirty_inode(inode); |
8474 | diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c |
8475 | index 88be946dedd4..33fb3f8aeafa 100644 |
8476 | --- a/fs/f2fs/node.c |
8477 | +++ b/fs/f2fs/node.c |
8478 | @@ -1598,10 +1598,11 @@ int f2fs_move_node_page(struct page *node_page, int gc_type) |
8479 | .for_reclaim = 0, |
8480 | }; |
8481 | |
8482 | - set_page_dirty(node_page); |
8483 | f2fs_wait_on_page_writeback(node_page, NODE, true); |
8484 | - |
8485 | f2fs_bug_on(F2FS_P_SB(node_page), PageWriteback(node_page)); |
8486 | + |
8487 | + set_page_dirty(node_page); |
8488 | + |
8489 | if (!clear_page_dirty_for_io(node_page)) { |
8490 | err = -EAGAIN; |
8491 | goto out_page; |
8492 | diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c |
8493 | index 6edcf8391dd3..8f3578c5230e 100644 |
8494 | --- a/fs/f2fs/segment.c |
8495 | +++ b/fs/f2fs/segment.c |
8496 | @@ -387,8 +387,9 @@ static int __f2fs_commit_inmem_pages(struct inode *inode) |
8497 | if (page->mapping == inode->i_mapping) { |
8498 | trace_f2fs_commit_inmem_page(page, INMEM); |
8499 | |
8500 | - set_page_dirty(page); |
8501 | f2fs_wait_on_page_writeback(page, DATA, true); |
8502 | + |
8503 | + set_page_dirty(page); |
8504 | if (clear_page_dirty_for_io(page)) { |
8505 | inode_dec_dirty_pages(inode); |
8506 | f2fs_remove_dirty_inode(inode); |
8507 | diff --git a/fs/f2fs/shrinker.c b/fs/f2fs/shrinker.c |
8508 | index 9e13db994fdf..a467aca29cfe 100644 |
8509 | --- a/fs/f2fs/shrinker.c |
8510 | +++ b/fs/f2fs/shrinker.c |
8511 | @@ -135,6 +135,6 @@ void f2fs_leave_shrinker(struct f2fs_sb_info *sbi) |
8512 | f2fs_shrink_extent_tree(sbi, __count_extent_cache(sbi)); |
8513 | |
8514 | spin_lock(&f2fs_list_lock); |
8515 | - list_del(&sbi->s_list); |
8516 | + list_del_init(&sbi->s_list); |
8517 | spin_unlock(&f2fs_list_lock); |
8518 | } |
8519 | diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c |
8520 | index 855a622fb052..a239472f405a 100644 |
8521 | --- a/fs/f2fs/super.c |
8522 | +++ b/fs/f2fs/super.c |
8523 | @@ -1058,9 +1058,6 @@ static void f2fs_put_super(struct super_block *sb) |
8524 | f2fs_write_checkpoint(sbi, &cpc); |
8525 | } |
8526 | |
8527 | - /* f2fs_write_checkpoint can update stat informaion */ |
8528 | - f2fs_destroy_stats(sbi); |
8529 | - |
8530 | /* |
8531 | * normally superblock is clean, so we need to release this. |
8532 | * In addition, EIO will skip do checkpoint, we need this as well. |
8533 | @@ -1080,6 +1077,12 @@ static void f2fs_put_super(struct super_block *sb) |
8534 | iput(sbi->node_inode); |
8535 | iput(sbi->meta_inode); |
8536 | |
8537 | + /* |
8538 | + * iput() can update stat information, if f2fs_write_checkpoint() |
8539 | + * above failed with error. |
8540 | + */ |
8541 | + f2fs_destroy_stats(sbi); |
8542 | + |
8543 | /* destroy f2fs internal modules */ |
8544 | f2fs_destroy_node_manager(sbi); |
8545 | f2fs_destroy_segment_manager(sbi); |
8546 | @@ -3256,30 +3259,30 @@ try_onemore: |
8547 | |
8548 | f2fs_build_gc_manager(sbi); |
8549 | |
8550 | + err = f2fs_build_stats(sbi); |
8551 | + if (err) |
8552 | + goto free_nm; |
8553 | + |
8554 | /* get an inode for node space */ |
8555 | sbi->node_inode = f2fs_iget(sb, F2FS_NODE_INO(sbi)); |
8556 | if (IS_ERR(sbi->node_inode)) { |
8557 | f2fs_msg(sb, KERN_ERR, "Failed to read node inode"); |
8558 | err = PTR_ERR(sbi->node_inode); |
8559 | - goto free_nm; |
8560 | + goto free_stats; |
8561 | } |
8562 | |
8563 | - err = f2fs_build_stats(sbi); |
8564 | - if (err) |
8565 | - goto free_node_inode; |
8566 | - |
8567 | /* read root inode and dentry */ |
8568 | root = f2fs_iget(sb, F2FS_ROOT_INO(sbi)); |
8569 | if (IS_ERR(root)) { |
8570 | f2fs_msg(sb, KERN_ERR, "Failed to read root inode"); |
8571 | err = PTR_ERR(root); |
8572 | - goto free_stats; |
8573 | + goto free_node_inode; |
8574 | } |
8575 | if (!S_ISDIR(root->i_mode) || !root->i_blocks || |
8576 | !root->i_size || !root->i_nlink) { |
8577 | iput(root); |
8578 | err = -EINVAL; |
8579 | - goto free_stats; |
8580 | + goto free_node_inode; |
8581 | } |
8582 | |
8583 | sb->s_root = d_make_root(root); /* allocate root dentry */ |
8584 | @@ -3403,12 +3406,12 @@ free_meta: |
8585 | free_root_inode: |
8586 | dput(sb->s_root); |
8587 | sb->s_root = NULL; |
8588 | -free_stats: |
8589 | - f2fs_destroy_stats(sbi); |
8590 | free_node_inode: |
8591 | f2fs_release_ino_entry(sbi, true); |
8592 | truncate_inode_pages_final(NODE_MAPPING(sbi)); |
8593 | iput(sbi->node_inode); |
8594 | +free_stats: |
8595 | + f2fs_destroy_stats(sbi); |
8596 | free_nm: |
8597 | f2fs_destroy_node_manager(sbi); |
8598 | free_sm: |
8599 | diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c |
8600 | index a5e516a40e7a..809c0f2f9942 100644 |
8601 | --- a/fs/fuse/dev.c |
8602 | +++ b/fs/fuse/dev.c |
8603 | @@ -1742,7 +1742,6 @@ static int fuse_retrieve(struct fuse_conn *fc, struct inode *inode, |
8604 | req->in.h.nodeid = outarg->nodeid; |
8605 | req->in.numargs = 2; |
8606 | req->in.argpages = 1; |
8607 | - req->page_descs[0].offset = offset; |
8608 | req->end = fuse_retrieve_end; |
8609 | |
8610 | index = outarg->offset >> PAGE_SHIFT; |
8611 | @@ -1757,6 +1756,7 @@ static int fuse_retrieve(struct fuse_conn *fc, struct inode *inode, |
8612 | |
8613 | this_num = min_t(unsigned, num, PAGE_SIZE - offset); |
8614 | req->pages[req->num_pages] = page; |
8615 | + req->page_descs[req->num_pages].offset = offset; |
8616 | req->page_descs[req->num_pages].length = this_num; |
8617 | req->num_pages++; |
8618 | |
8619 | @@ -2077,8 +2077,10 @@ static ssize_t fuse_dev_splice_write(struct pipe_inode_info *pipe, |
8620 | |
8621 | ret = fuse_dev_do_write(fud, &cs, len); |
8622 | |
8623 | + pipe_lock(pipe); |
8624 | for (idx = 0; idx < nbuf; idx++) |
8625 | pipe_buf_release(pipe, &bufs[idx]); |
8626 | + pipe_unlock(pipe); |
8627 | |
8628 | out: |
8629 | kvfree(bufs); |
8630 | diff --git a/fs/fuse/file.c b/fs/fuse/file.c |
8631 | index ffaffe18352a..a59c16bd90ac 100644 |
8632 | --- a/fs/fuse/file.c |
8633 | +++ b/fs/fuse/file.c |
8634 | @@ -1782,7 +1782,7 @@ static bool fuse_writepage_in_flight(struct fuse_req *new_req, |
8635 | spin_unlock(&fc->lock); |
8636 | |
8637 | dec_wb_stat(&bdi->wb, WB_WRITEBACK); |
8638 | - dec_node_page_state(page, NR_WRITEBACK_TEMP); |
8639 | + dec_node_page_state(new_req->pages[0], NR_WRITEBACK_TEMP); |
8640 | wb_writeout_inc(&bdi->wb); |
8641 | fuse_writepage_free(fc, new_req); |
8642 | fuse_request_free(new_req); |
8643 | diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c |
8644 | index 568abed20eb2..a7f922a67c69 100644 |
8645 | --- a/fs/fuse/inode.c |
8646 | +++ b/fs/fuse/inode.c |
8647 | @@ -628,6 +628,7 @@ void fuse_conn_init(struct fuse_conn *fc, struct user_namespace *user_ns) |
8648 | get_random_bytes(&fc->scramble_key, sizeof(fc->scramble_key)); |
8649 | fc->pid_ns = get_pid_ns(task_active_pid_ns(current)); |
8650 | fc->user_ns = get_user_ns(user_ns); |
8651 | + fc->max_pages = FUSE_DEFAULT_MAX_PAGES_PER_REQ; |
8652 | } |
8653 | EXPORT_SYMBOL_GPL(fuse_conn_init); |
8654 | |
8655 | @@ -1162,7 +1163,6 @@ static int fuse_fill_super(struct super_block *sb, void *data, int silent) |
8656 | fc->user_id = d.user_id; |
8657 | fc->group_id = d.group_id; |
8658 | fc->max_read = max_t(unsigned, 4096, d.max_read); |
8659 | - fc->max_pages = FUSE_DEFAULT_MAX_PAGES_PER_REQ; |
8660 | |
8661 | /* Used by get_root_inode() */ |
8662 | sb->s_fs_info = fc; |
8663 | diff --git a/fs/nfs/super.c b/fs/nfs/super.c |
8664 | index ac4b2f005778..5ef2c71348bd 100644 |
8665 | --- a/fs/nfs/super.c |
8666 | +++ b/fs/nfs/super.c |
8667 | @@ -2409,8 +2409,7 @@ static int nfs_compare_mount_options(const struct super_block *s, const struct n |
8668 | goto Ebusy; |
8669 | if (a->acdirmax != b->acdirmax) |
8670 | goto Ebusy; |
8671 | - if (b->auth_info.flavor_len > 0 && |
8672 | - clnt_a->cl_auth->au_flavor != clnt_b->cl_auth->au_flavor) |
8673 | + if (clnt_a->cl_auth->au_flavor != clnt_b->cl_auth->au_flavor) |
8674 | goto Ebusy; |
8675 | return 1; |
8676 | Ebusy: |
8677 | diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c |
8678 | index 6384c9b94898..b33f9785b756 100644 |
8679 | --- a/fs/nfsd/nfsctl.c |
8680 | +++ b/fs/nfsd/nfsctl.c |
8681 | @@ -1126,6 +1126,8 @@ static ssize_t write_v4_end_grace(struct file *file, char *buf, size_t size) |
8682 | case 'Y': |
8683 | case 'y': |
8684 | case '1': |
8685 | + if (nn->nfsd_serv) |
8686 | + return -EBUSY; |
8687 | nfsd4_end_grace(nn); |
8688 | break; |
8689 | default: |
8690 | diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c |
8691 | index eb67098117b4..6f424e3a3981 100644 |
8692 | --- a/fs/nfsd/vfs.c |
8693 | +++ b/fs/nfsd/vfs.c |
8694 | @@ -544,9 +544,11 @@ __be32 nfsd4_clone_file_range(struct file *src, u64 src_pos, struct file *dst, |
8695 | loff_t cloned; |
8696 | |
8697 | cloned = vfs_clone_file_range(src, src_pos, dst, dst_pos, count, 0); |
8698 | + if (cloned < 0) |
8699 | + return nfserrno(cloned); |
8700 | if (count && cloned != count) |
8701 | - cloned = -EINVAL; |
8702 | - return nfserrno(cloned < 0 ? cloned : 0); |
8703 | + return nfserrno(-EINVAL); |
8704 | + return 0; |
8705 | } |
8706 | |
8707 | ssize_t nfsd_copy_file_range(struct file *src, u64 src_pos, struct file *dst, |
8708 | diff --git a/fs/ocfs2/Makefile b/fs/ocfs2/Makefile |
8709 | index 99ee093182cb..cc9b32b9db7c 100644 |
8710 | --- a/fs/ocfs2/Makefile |
8711 | +++ b/fs/ocfs2/Makefile |
8712 | @@ -1,5 +1,5 @@ |
8713 | # SPDX-License-Identifier: GPL-2.0 |
8714 | -ccflags-y := -Ifs/ocfs2 |
8715 | +ccflags-y := -I$(src) |
8716 | |
8717 | obj-$(CONFIG_OCFS2_FS) += \ |
8718 | ocfs2.o \ |
8719 | diff --git a/fs/ocfs2/buffer_head_io.c b/fs/ocfs2/buffer_head_io.c |
8720 | index 4ebbd57cbf84..f9b84f7a3e4b 100644 |
8721 | --- a/fs/ocfs2/buffer_head_io.c |
8722 | +++ b/fs/ocfs2/buffer_head_io.c |
8723 | @@ -161,7 +161,6 @@ int ocfs2_read_blocks_sync(struct ocfs2_super *osb, u64 block, |
8724 | #endif |
8725 | } |
8726 | |
8727 | - clear_buffer_uptodate(bh); |
8728 | get_bh(bh); /* for end_buffer_read_sync() */ |
8729 | bh->b_end_io = end_buffer_read_sync; |
8730 | submit_bh(REQ_OP_READ, 0, bh); |
8731 | @@ -341,7 +340,6 @@ int ocfs2_read_blocks(struct ocfs2_caching_info *ci, u64 block, int nr, |
8732 | continue; |
8733 | } |
8734 | |
8735 | - clear_buffer_uptodate(bh); |
8736 | get_bh(bh); /* for end_buffer_read_sync() */ |
8737 | if (validate) |
8738 | set_buffer_needs_validate(bh); |
8739 | diff --git a/fs/ocfs2/dlm/Makefile b/fs/ocfs2/dlm/Makefile |
8740 | index bd1aab1f49a4..ef2854422a6e 100644 |
8741 | --- a/fs/ocfs2/dlm/Makefile |
8742 | +++ b/fs/ocfs2/dlm/Makefile |
8743 | @@ -1,4 +1,4 @@ |
8744 | -ccflags-y := -Ifs/ocfs2 |
8745 | +ccflags-y := -I$(src)/.. |
8746 | |
8747 | obj-$(CONFIG_OCFS2_FS_O2CB) += ocfs2_dlm.o |
8748 | |
8749 | diff --git a/fs/ocfs2/dlmfs/Makefile b/fs/ocfs2/dlmfs/Makefile |
8750 | index eed3db8c5b49..33431a0296a3 100644 |
8751 | --- a/fs/ocfs2/dlmfs/Makefile |
8752 | +++ b/fs/ocfs2/dlmfs/Makefile |
8753 | @@ -1,4 +1,4 @@ |
8754 | -ccflags-y := -Ifs/ocfs2 |
8755 | +ccflags-y := -I$(src)/.. |
8756 | |
8757 | obj-$(CONFIG_OCFS2_FS) += ocfs2_dlmfs.o |
8758 | |
8759 | diff --git a/fs/udf/inode.c b/fs/udf/inode.c |
8760 | index 5df554a9f9c9..ae796e10f68b 100644 |
8761 | --- a/fs/udf/inode.c |
8762 | +++ b/fs/udf/inode.c |
8763 | @@ -1357,6 +1357,12 @@ reread: |
8764 | |
8765 | iinfo->i_alloc_type = le16_to_cpu(fe->icbTag.flags) & |
8766 | ICBTAG_FLAG_AD_MASK; |
8767 | + if (iinfo->i_alloc_type != ICBTAG_FLAG_AD_SHORT && |
8768 | + iinfo->i_alloc_type != ICBTAG_FLAG_AD_LONG && |
8769 | + iinfo->i_alloc_type != ICBTAG_FLAG_AD_IN_ICB) { |
8770 | + ret = -EIO; |
8771 | + goto out; |
8772 | + } |
8773 | iinfo->i_unique = 0; |
8774 | iinfo->i_lenEAttr = 0; |
8775 | iinfo->i_lenExtents = 0; |
8776 | diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c |
8777 | index 338b9d9984e0..d9048bcea49c 100644 |
8778 | --- a/fs/xfs/xfs_aops.c |
8779 | +++ b/fs/xfs/xfs_aops.c |
8780 | @@ -449,6 +449,7 @@ xfs_map_blocks( |
8781 | } |
8782 | |
8783 | wpc->imap = imap; |
8784 | + xfs_trim_extent_eof(&wpc->imap, ip); |
8785 | trace_xfs_map_blocks_found(ip, offset, count, wpc->io_type, &imap); |
8786 | return 0; |
8787 | allocate_blocks: |
8788 | @@ -459,6 +460,7 @@ allocate_blocks: |
8789 | ASSERT(whichfork == XFS_COW_FORK || cow_fsb == NULLFILEOFF || |
8790 | imap.br_startoff + imap.br_blockcount <= cow_fsb); |
8791 | wpc->imap = imap; |
8792 | + xfs_trim_extent_eof(&wpc->imap, ip); |
8793 | trace_xfs_map_blocks_alloc(ip, offset, count, wpc->io_type, &imap); |
8794 | return 0; |
8795 | } |
8796 | diff --git a/include/linux/cpu.h b/include/linux/cpu.h |
8797 | index 218df7f4d3e1..5041357d0297 100644 |
8798 | --- a/include/linux/cpu.h |
8799 | +++ b/include/linux/cpu.h |
8800 | @@ -180,12 +180,10 @@ enum cpuhp_smt_control { |
8801 | #if defined(CONFIG_SMP) && defined(CONFIG_HOTPLUG_SMT) |
8802 | extern enum cpuhp_smt_control cpu_smt_control; |
8803 | extern void cpu_smt_disable(bool force); |
8804 | -extern void cpu_smt_check_topology_early(void); |
8805 | extern void cpu_smt_check_topology(void); |
8806 | #else |
8807 | # define cpu_smt_control (CPU_SMT_ENABLED) |
8808 | static inline void cpu_smt_disable(bool force) { } |
8809 | -static inline void cpu_smt_check_topology_early(void) { } |
8810 | static inline void cpu_smt_check_topology(void) { } |
8811 | #endif |
8812 | |
8813 | diff --git a/include/linux/genl_magic_struct.h b/include/linux/genl_magic_struct.h |
8814 | index 5972e4969197..eeae59d3ceb7 100644 |
8815 | --- a/include/linux/genl_magic_struct.h |
8816 | +++ b/include/linux/genl_magic_struct.h |
8817 | @@ -191,6 +191,7 @@ static inline void ct_assert_unique_operations(void) |
8818 | { |
8819 | switch (0) { |
8820 | #include GENL_MAGIC_INCLUDE_FILE |
8821 | + case 0: |
8822 | ; |
8823 | } |
8824 | } |
8825 | @@ -209,6 +210,7 @@ static inline void ct_assert_unique_top_level_attributes(void) |
8826 | { |
8827 | switch (0) { |
8828 | #include GENL_MAGIC_INCLUDE_FILE |
8829 | + case 0: |
8830 | ; |
8831 | } |
8832 | } |
8833 | @@ -218,7 +220,8 @@ static inline void ct_assert_unique_top_level_attributes(void) |
8834 | static inline void ct_assert_unique_ ## s_name ## _attributes(void) \ |
8835 | { \ |
8836 | switch (0) { \ |
8837 | - s_fields \ |
8838 | + s_fields \ |
8839 | + case 0: \ |
8840 | ; \ |
8841 | } \ |
8842 | } |
8843 | diff --git a/include/linux/gpio/consumer.h b/include/linux/gpio/consumer.h |
8844 | index f2f887795d43..ed070512b40e 100644 |
8845 | --- a/include/linux/gpio/consumer.h |
8846 | +++ b/include/linux/gpio/consumer.h |
8847 | @@ -162,7 +162,7 @@ int gpiod_is_active_low(const struct gpio_desc *desc); |
8848 | int gpiod_cansleep(const struct gpio_desc *desc); |
8849 | |
8850 | int gpiod_to_irq(const struct gpio_desc *desc); |
8851 | -void gpiod_set_consumer_name(struct gpio_desc *desc, const char *name); |
8852 | +int gpiod_set_consumer_name(struct gpio_desc *desc, const char *name); |
8853 | |
8854 | /* Convert between the old gpio_ and new gpiod_ interfaces */ |
8855 | struct gpio_desc *gpio_to_desc(unsigned gpio); |
8856 | @@ -495,10 +495,12 @@ static inline int gpiod_to_irq(const struct gpio_desc *desc) |
8857 | return -EINVAL; |
8858 | } |
8859 | |
8860 | -static inline void gpiod_set_consumer_name(struct gpio_desc *desc, const char *name) |
8861 | +static inline int gpiod_set_consumer_name(struct gpio_desc *desc, |
8862 | + const char *name) |
8863 | { |
8864 | /* GPIO can never have been requested */ |
8865 | WARN_ON(1); |
8866 | + return -EINVAL; |
8867 | } |
8868 | |
8869 | static inline struct gpio_desc *gpio_to_desc(unsigned gpio) |
8870 | diff --git a/include/linux/hid-debug.h b/include/linux/hid-debug.h |
8871 | index 8663f216c563..2d6100edf204 100644 |
8872 | --- a/include/linux/hid-debug.h |
8873 | +++ b/include/linux/hid-debug.h |
8874 | @@ -24,7 +24,10 @@ |
8875 | |
8876 | #ifdef CONFIG_DEBUG_FS |
8877 | |
8878 | +#include <linux/kfifo.h> |
8879 | + |
8880 | #define HID_DEBUG_BUFSIZE 512 |
8881 | +#define HID_DEBUG_FIFOSIZE 512 |
8882 | |
8883 | void hid_dump_input(struct hid_device *, struct hid_usage *, __s32); |
8884 | void hid_dump_report(struct hid_device *, int , u8 *, int); |
8885 | @@ -37,11 +40,8 @@ void hid_debug_init(void); |
8886 | void hid_debug_exit(void); |
8887 | void hid_debug_event(struct hid_device *, char *); |
8888 | |
8889 | - |
8890 | struct hid_debug_list { |
8891 | - char *hid_debug_buf; |
8892 | - int head; |
8893 | - int tail; |
8894 | + DECLARE_KFIFO_PTR(hid_debug_fifo, char); |
8895 | struct fasync_struct *fasync; |
8896 | struct hid_device *hdev; |
8897 | struct list_head node; |
8898 | @@ -64,4 +64,3 @@ struct hid_debug_list { |
8899 | #endif |
8900 | |
8901 | #endif |
8902 | - |
8903 | diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h |
8904 | index c926698040e0..a03d5e264e5e 100644 |
8905 | --- a/include/linux/kvm_host.h |
8906 | +++ b/include/linux/kvm_host.h |
8907 | @@ -694,7 +694,8 @@ int kvm_write_guest(struct kvm *kvm, gpa_t gpa, const void *data, |
8908 | int kvm_write_guest_cached(struct kvm *kvm, struct gfn_to_hva_cache *ghc, |
8909 | void *data, unsigned long len); |
8910 | int kvm_write_guest_offset_cached(struct kvm *kvm, struct gfn_to_hva_cache *ghc, |
8911 | - void *data, int offset, unsigned long len); |
8912 | + void *data, unsigned int offset, |
8913 | + unsigned long len); |
8914 | int kvm_gfn_to_hva_cache_init(struct kvm *kvm, struct gfn_to_hva_cache *ghc, |
8915 | gpa_t gpa, unsigned long len); |
8916 | int kvm_clear_guest_page(struct kvm *kvm, gfn_t gfn, int offset, int len); |
8917 | diff --git a/include/linux/mlx5/driver.h b/include/linux/mlx5/driver.h |
8918 | index aa5963b5d38e..7d4ed995b4ce 100644 |
8919 | --- a/include/linux/mlx5/driver.h |
8920 | +++ b/include/linux/mlx5/driver.h |
8921 | @@ -1309,7 +1309,7 @@ enum { |
8922 | static inline const struct cpumask * |
8923 | mlx5_get_vector_affinity_hint(struct mlx5_core_dev *dev, int vector) |
8924 | { |
8925 | - return dev->priv.irq_info[vector].mask; |
8926 | + return dev->priv.irq_info[vector + MLX5_EQ_VEC_COMP_BASE].mask; |
8927 | } |
8928 | |
8929 | #endif /* MLX5_DRIVER_H */ |
8930 | diff --git a/include/linux/skmsg.h b/include/linux/skmsg.h |
8931 | index 2a11e9d91dfa..36bd85863081 100644 |
8932 | --- a/include/linux/skmsg.h |
8933 | +++ b/include/linux/skmsg.h |
8934 | @@ -416,6 +416,14 @@ static inline void sk_psock_put(struct sock *sk, struct sk_psock *psock) |
8935 | sk_psock_drop(sk, psock); |
8936 | } |
8937 | |
8938 | +static inline void sk_psock_data_ready(struct sock *sk, struct sk_psock *psock) |
8939 | +{ |
8940 | + if (psock->parser.enabled) |
8941 | + psock->parser.saved_data_ready(sk); |
8942 | + else |
8943 | + sk->sk_data_ready(sk); |
8944 | +} |
8945 | + |
8946 | static inline void psock_set_prog(struct bpf_prog **pprog, |
8947 | struct bpf_prog *prog) |
8948 | { |
8949 | diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h |
8950 | index 9c0c2132a2d6..64626b32107b 100644 |
8951 | --- a/include/rdma/ib_verbs.h |
8952 | +++ b/include/rdma/ib_verbs.h |
8953 | @@ -56,7 +56,7 @@ |
8954 | #include <linux/string.h> |
8955 | #include <linux/slab.h> |
8956 | #include <linux/netdevice.h> |
8957 | - |
8958 | +#include <linux/refcount.h> |
8959 | #include <linux/if_link.h> |
8960 | #include <linux/atomic.h> |
8961 | #include <linux/mmu_notifier.h> |
8962 | @@ -2605,6 +2605,12 @@ struct ib_device { |
8963 | |
8964 | const struct uverbs_object_tree_def *const *driver_specs; |
8965 | enum rdma_driver_id driver_id; |
8966 | + /* |
8967 | + * Provides synchronization between device unregistration and netlink |
8968 | + * commands on a device. To be used only by core. |
8969 | + */ |
8970 | + refcount_t refcount; |
8971 | + struct completion unreg_completion; |
8972 | }; |
8973 | |
8974 | struct ib_client { |
8975 | diff --git a/include/sound/compress_driver.h b/include/sound/compress_driver.h |
8976 | index ea8c93bbb0e0..e87f2d5b3cc6 100644 |
8977 | --- a/include/sound/compress_driver.h |
8978 | +++ b/include/sound/compress_driver.h |
8979 | @@ -171,7 +171,11 @@ static inline void snd_compr_drain_notify(struct snd_compr_stream *stream) |
8980 | if (snd_BUG_ON(!stream)) |
8981 | return; |
8982 | |
8983 | - stream->runtime->state = SNDRV_PCM_STATE_SETUP; |
8984 | + if (stream->direction == SND_COMPRESS_PLAYBACK) |
8985 | + stream->runtime->state = SNDRV_PCM_STATE_SETUP; |
8986 | + else |
8987 | + stream->runtime->state = SNDRV_PCM_STATE_PREPARED; |
8988 | + |
8989 | wake_up(&stream->runtime->sleep); |
8990 | } |
8991 | |
8992 | diff --git a/include/sound/hda_codec.h b/include/sound/hda_codec.h |
8993 | index 0d98bb9068b1..acacc1900265 100644 |
8994 | --- a/include/sound/hda_codec.h |
8995 | +++ b/include/sound/hda_codec.h |
8996 | @@ -68,6 +68,7 @@ struct hda_bus { |
8997 | unsigned int response_reset:1; /* controller was reset */ |
8998 | unsigned int in_reset:1; /* during reset operation */ |
8999 | unsigned int no_response_fallback:1; /* don't fallback at RIRB error */ |
9000 | + unsigned int bus_probing :1; /* during probing process */ |
9001 | |
9002 | int primary_dig_out_type; /* primary digital out PCM type */ |
9003 | unsigned int mixer_assigned; /* codec addr for mixer name */ |
9004 | diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c |
9005 | index 1f84977fab47..498c6bcf992a 100644 |
9006 | --- a/kernel/cgroup/cgroup.c |
9007 | +++ b/kernel/cgroup/cgroup.c |
9008 | @@ -1744,7 +1744,7 @@ static int parse_cgroup_root_flags(char *data, unsigned int *root_flags) |
9009 | |
9010 | *root_flags = 0; |
9011 | |
9012 | - if (!data) |
9013 | + if (!data || *data == '\0') |
9014 | return 0; |
9015 | |
9016 | while ((token = strsep(&data, ",")) != NULL) { |
9017 | diff --git a/kernel/cpu.c b/kernel/cpu.c |
9018 | index 91d5c38eb7e5..f3b25d945727 100644 |
9019 | --- a/kernel/cpu.c |
9020 | +++ b/kernel/cpu.c |
9021 | @@ -376,9 +376,6 @@ void __weak arch_smt_update(void) { } |
9022 | |
9023 | #ifdef CONFIG_HOTPLUG_SMT |
9024 | enum cpuhp_smt_control cpu_smt_control __read_mostly = CPU_SMT_ENABLED; |
9025 | -EXPORT_SYMBOL_GPL(cpu_smt_control); |
9026 | - |
9027 | -static bool cpu_smt_available __read_mostly; |
9028 | |
9029 | void __init cpu_smt_disable(bool force) |
9030 | { |
9031 | @@ -397,25 +394,11 @@ void __init cpu_smt_disable(bool force) |
9032 | |
9033 | /* |
9034 | * The decision whether SMT is supported can only be done after the full |
9035 | - * CPU identification. Called from architecture code before non boot CPUs |
9036 | - * are brought up. |
9037 | - */ |
9038 | -void __init cpu_smt_check_topology_early(void) |
9039 | -{ |
9040 | - if (!topology_smt_supported()) |
9041 | - cpu_smt_control = CPU_SMT_NOT_SUPPORTED; |
9042 | -} |
9043 | - |
9044 | -/* |
9045 | - * If SMT was disabled by BIOS, detect it here, after the CPUs have been |
9046 | - * brought online. This ensures the smt/l1tf sysfs entries are consistent |
9047 | - * with reality. cpu_smt_available is set to true during the bringup of non |
9048 | - * boot CPUs when a SMT sibling is detected. Note, this may overwrite |
9049 | - * cpu_smt_control's previous setting. |
9050 | + * CPU identification. Called from architecture code. |
9051 | */ |
9052 | void __init cpu_smt_check_topology(void) |
9053 | { |
9054 | - if (!cpu_smt_available) |
9055 | + if (!topology_smt_supported()) |
9056 | cpu_smt_control = CPU_SMT_NOT_SUPPORTED; |
9057 | } |
9058 | |
9059 | @@ -428,18 +411,10 @@ early_param("nosmt", smt_cmdline_disable); |
9060 | |
9061 | static inline bool cpu_smt_allowed(unsigned int cpu) |
9062 | { |
9063 | - if (topology_is_primary_thread(cpu)) |
9064 | + if (cpu_smt_control == CPU_SMT_ENABLED) |
9065 | return true; |
9066 | |
9067 | - /* |
9068 | - * If the CPU is not a 'primary' thread and the booted_once bit is |
9069 | - * set then the processor has SMT support. Store this information |
9070 | - * for the late check of SMT support in cpu_smt_check_topology(). |
9071 | - */ |
9072 | - if (per_cpu(cpuhp_state, cpu).booted_once) |
9073 | - cpu_smt_available = true; |
9074 | - |
9075 | - if (cpu_smt_control == CPU_SMT_ENABLED) |
9076 | + if (topology_is_primary_thread(cpu)) |
9077 | return true; |
9078 | |
9079 | /* |
9080 | diff --git a/kernel/debug/debug_core.c b/kernel/debug/debug_core.c |
9081 | index 65c0f1363788..94aa9ae0007a 100644 |
9082 | --- a/kernel/debug/debug_core.c |
9083 | +++ b/kernel/debug/debug_core.c |
9084 | @@ -535,6 +535,8 @@ return_normal: |
9085 | arch_kgdb_ops.correct_hw_break(); |
9086 | if (trace_on) |
9087 | tracing_on(); |
9088 | + kgdb_info[cpu].debuggerinfo = NULL; |
9089 | + kgdb_info[cpu].task = NULL; |
9090 | kgdb_info[cpu].exception_state &= |
9091 | ~(DCPU_WANT_MASTER | DCPU_IS_SLAVE); |
9092 | kgdb_info[cpu].enter_kgdb--; |
9093 | @@ -667,6 +669,8 @@ kgdb_restore: |
9094 | if (trace_on) |
9095 | tracing_on(); |
9096 | |
9097 | + kgdb_info[cpu].debuggerinfo = NULL; |
9098 | + kgdb_info[cpu].task = NULL; |
9099 | kgdb_info[cpu].exception_state &= |
9100 | ~(DCPU_WANT_MASTER | DCPU_IS_SLAVE); |
9101 | kgdb_info[cpu].enter_kgdb--; |
9102 | diff --git a/kernel/debug/kdb/kdb_bt.c b/kernel/debug/kdb/kdb_bt.c |
9103 | index 7921ae4fca8d..7e2379aa0a1e 100644 |
9104 | --- a/kernel/debug/kdb/kdb_bt.c |
9105 | +++ b/kernel/debug/kdb/kdb_bt.c |
9106 | @@ -186,7 +186,16 @@ kdb_bt(int argc, const char **argv) |
9107 | kdb_printf("btc: cpu status: "); |
9108 | kdb_parse("cpu\n"); |
9109 | for_each_online_cpu(cpu) { |
9110 | - sprintf(buf, "btt 0x%px\n", KDB_TSK(cpu)); |
9111 | + void *kdb_tsk = KDB_TSK(cpu); |
9112 | + |
9113 | + /* If a CPU failed to round up we could be here */ |
9114 | + if (!kdb_tsk) { |
9115 | + kdb_printf("WARNING: no task for cpu %ld\n", |
9116 | + cpu); |
9117 | + continue; |
9118 | + } |
9119 | + |
9120 | + sprintf(buf, "btt 0x%px\n", kdb_tsk); |
9121 | kdb_parse(buf); |
9122 | touch_nmi_watchdog(); |
9123 | } |
9124 | diff --git a/kernel/debug/kdb/kdb_debugger.c b/kernel/debug/kdb/kdb_debugger.c |
9125 | index 15e1a7af5dd0..53a0df6e4d92 100644 |
9126 | --- a/kernel/debug/kdb/kdb_debugger.c |
9127 | +++ b/kernel/debug/kdb/kdb_debugger.c |
9128 | @@ -118,13 +118,6 @@ int kdb_stub(struct kgdb_state *ks) |
9129 | kdb_bp_remove(); |
9130 | KDB_STATE_CLEAR(DOING_SS); |
9131 | KDB_STATE_SET(PAGER); |
9132 | - /* zero out any offline cpu data */ |
9133 | - for_each_present_cpu(i) { |
9134 | - if (!cpu_online(i)) { |
9135 | - kgdb_info[i].debuggerinfo = NULL; |
9136 | - kgdb_info[i].task = NULL; |
9137 | - } |
9138 | - } |
9139 | if (ks->err_code == DIE_OOPS || reason == KDB_REASON_OOPS) { |
9140 | ks->pass_exception = 1; |
9141 | KDB_FLAG_SET(CATASTROPHIC); |
9142 | diff --git a/kernel/events/ring_buffer.c b/kernel/events/ring_buffer.c |
9143 | index 4a9937076331..309ef5a64af5 100644 |
9144 | --- a/kernel/events/ring_buffer.c |
9145 | +++ b/kernel/events/ring_buffer.c |
9146 | @@ -734,6 +734,9 @@ struct ring_buffer *rb_alloc(int nr_pages, long watermark, int cpu, int flags) |
9147 | size = sizeof(struct ring_buffer); |
9148 | size += nr_pages * sizeof(void *); |
9149 | |
9150 | + if (order_base_2(size) >= MAX_ORDER) |
9151 | + goto fail; |
9152 | + |
9153 | rb = kzalloc(size, GFP_KERNEL); |
9154 | if (!rb) |
9155 | goto fail; |
9156 | diff --git a/kernel/futex.c b/kernel/futex.c |
9157 | index 5cc8083a4c89..4d1b7db04e10 100644 |
9158 | --- a/kernel/futex.c |
9159 | +++ b/kernel/futex.c |
9160 | @@ -2850,35 +2850,39 @@ retry_private: |
9161 | * and BUG when futex_unlock_pi() interleaves with this. |
9162 | * |
9163 | * Therefore acquire wait_lock while holding hb->lock, but drop the |
9164 | - * latter before calling rt_mutex_start_proxy_lock(). This still fully |
9165 | - * serializes against futex_unlock_pi() as that does the exact same |
9166 | - * lock handoff sequence. |
9167 | + * latter before calling __rt_mutex_start_proxy_lock(). This |
9168 | + * interleaves with futex_unlock_pi() -- which does a similar lock |
9169 | + * handoff -- such that the latter can observe the futex_q::pi_state |
9170 | + * before __rt_mutex_start_proxy_lock() is done. |
9171 | */ |
9172 | raw_spin_lock_irq(&q.pi_state->pi_mutex.wait_lock); |
9173 | spin_unlock(q.lock_ptr); |
9174 | + /* |
9175 | + * __rt_mutex_start_proxy_lock() unconditionally enqueues the @rt_waiter |
9176 | + * such that futex_unlock_pi() is guaranteed to observe the waiter when |
9177 | + * it sees the futex_q::pi_state. |
9178 | + */ |
9179 | ret = __rt_mutex_start_proxy_lock(&q.pi_state->pi_mutex, &rt_waiter, current); |
9180 | raw_spin_unlock_irq(&q.pi_state->pi_mutex.wait_lock); |
9181 | |
9182 | if (ret) { |
9183 | if (ret == 1) |
9184 | ret = 0; |
9185 | - |
9186 | - spin_lock(q.lock_ptr); |
9187 | - goto no_block; |
9188 | + goto cleanup; |
9189 | } |
9190 | |
9191 | - |
9192 | if (unlikely(to)) |
9193 | hrtimer_start_expires(&to->timer, HRTIMER_MODE_ABS); |
9194 | |
9195 | ret = rt_mutex_wait_proxy_lock(&q.pi_state->pi_mutex, to, &rt_waiter); |
9196 | |
9197 | +cleanup: |
9198 | spin_lock(q.lock_ptr); |
9199 | /* |
9200 | - * If we failed to acquire the lock (signal/timeout), we must |
9201 | + * If we failed to acquire the lock (deadlock/signal/timeout), we must |
9202 | * first acquire the hb->lock before removing the lock from the |
9203 | - * rt_mutex waitqueue, such that we can keep the hb and rt_mutex |
9204 | - * wait lists consistent. |
9205 | + * rt_mutex waitqueue, such that we can keep the hb and rt_mutex wait |
9206 | + * lists consistent. |
9207 | * |
9208 | * In particular; it is important that futex_unlock_pi() can not |
9209 | * observe this inconsistency. |
9210 | @@ -3002,6 +3006,10 @@ retry: |
9211 | * there is no point where we hold neither; and therefore |
9212 | * wake_futex_pi() must observe a state consistent with what we |
9213 | * observed. |
9214 | + * |
9215 | + * In particular; this forces __rt_mutex_start_proxy() to |
9216 | + * complete such that we're guaranteed to observe the |
9217 | + * rt_waiter. Also see the WARN in wake_futex_pi(). |
9218 | */ |
9219 | raw_spin_lock_irq(&pi_state->pi_mutex.wait_lock); |
9220 | spin_unlock(&hb->lock); |
9221 | diff --git a/kernel/hung_task.c b/kernel/hung_task.c |
9222 | index cb8e3e8ac7b9..4a9191617076 100644 |
9223 | --- a/kernel/hung_task.c |
9224 | +++ b/kernel/hung_task.c |
9225 | @@ -34,7 +34,7 @@ int __read_mostly sysctl_hung_task_check_count = PID_MAX_LIMIT; |
9226 | * is disabled during the critical section. It also controls the size of |
9227 | * the RCU grace period. So it needs to be upper-bound. |
9228 | */ |
9229 | -#define HUNG_TASK_BATCHING 1024 |
9230 | +#define HUNG_TASK_LOCK_BREAK (HZ / 10) |
9231 | |
9232 | /* |
9233 | * Zero means infinite timeout - no checking done: |
9234 | @@ -112,8 +112,11 @@ static void check_hung_task(struct task_struct *t, unsigned long timeout) |
9235 | |
9236 | trace_sched_process_hang(t); |
9237 | |
9238 | - if (!sysctl_hung_task_warnings && !sysctl_hung_task_panic) |
9239 | - return; |
9240 | + if (sysctl_hung_task_panic) { |
9241 | + console_verbose(); |
9242 | + hung_task_show_lock = true; |
9243 | + hung_task_call_panic = true; |
9244 | + } |
9245 | |
9246 | /* |
9247 | * Ok, the task did not get scheduled for more than 2 minutes, |
9248 | @@ -135,11 +138,6 @@ static void check_hung_task(struct task_struct *t, unsigned long timeout) |
9249 | } |
9250 | |
9251 | touch_nmi_watchdog(); |
9252 | - |
9253 | - if (sysctl_hung_task_panic) { |
9254 | - hung_task_show_lock = true; |
9255 | - hung_task_call_panic = true; |
9256 | - } |
9257 | } |
9258 | |
9259 | /* |
9260 | @@ -173,7 +171,7 @@ static bool rcu_lock_break(struct task_struct *g, struct task_struct *t) |
9261 | static void check_hung_uninterruptible_tasks(unsigned long timeout) |
9262 | { |
9263 | int max_count = sysctl_hung_task_check_count; |
9264 | - int batch_count = HUNG_TASK_BATCHING; |
9265 | + unsigned long last_break = jiffies; |
9266 | struct task_struct *g, *t; |
9267 | |
9268 | /* |
9269 | @@ -188,10 +186,10 @@ static void check_hung_uninterruptible_tasks(unsigned long timeout) |
9270 | for_each_process_thread(g, t) { |
9271 | if (!max_count--) |
9272 | goto unlock; |
9273 | - if (!--batch_count) { |
9274 | - batch_count = HUNG_TASK_BATCHING; |
9275 | + if (time_after(jiffies, last_break + HUNG_TASK_LOCK_BREAK)) { |
9276 | if (!rcu_lock_break(g, t)) |
9277 | goto unlock; |
9278 | + last_break = jiffies; |
9279 | } |
9280 | /* use "==" to skip the TASK_KILLABLE tasks waiting on NFS */ |
9281 | if (t->state == TASK_UNINTERRUPTIBLE) |
9282 | diff --git a/kernel/irq/affinity.c b/kernel/irq/affinity.c |
9283 | index f4f29b9d90ee..e12cdf637c71 100644 |
9284 | --- a/kernel/irq/affinity.c |
9285 | +++ b/kernel/irq/affinity.c |
9286 | @@ -117,12 +117,11 @@ static int irq_build_affinity_masks(const struct irq_affinity *affd, |
9287 | */ |
9288 | if (numvecs <= nodes) { |
9289 | for_each_node_mask(n, nodemsk) { |
9290 | - cpumask_copy(masks + curvec, node_to_cpumask[n]); |
9291 | - if (++done == numvecs) |
9292 | - break; |
9293 | + cpumask_or(masks + curvec, masks + curvec, node_to_cpumask[n]); |
9294 | if (++curvec == last_affv) |
9295 | curvec = affd->pre_vectors; |
9296 | } |
9297 | + done = numvecs; |
9298 | goto out; |
9299 | } |
9300 | |
9301 | diff --git a/kernel/kcov.c b/kernel/kcov.c |
9302 | index 97959d7b77e2..c2277dbdbfb1 100644 |
9303 | --- a/kernel/kcov.c |
9304 | +++ b/kernel/kcov.c |
9305 | @@ -112,7 +112,7 @@ void notrace __sanitizer_cov_trace_pc(void) |
9306 | EXPORT_SYMBOL(__sanitizer_cov_trace_pc); |
9307 | |
9308 | #ifdef CONFIG_KCOV_ENABLE_COMPARISONS |
9309 | -static void write_comp_data(u64 type, u64 arg1, u64 arg2, u64 ip) |
9310 | +static void notrace write_comp_data(u64 type, u64 arg1, u64 arg2, u64 ip) |
9311 | { |
9312 | struct task_struct *t; |
9313 | u64 *area; |
9314 | diff --git a/kernel/locking/rtmutex.c b/kernel/locking/rtmutex.c |
9315 | index 581edcc63c26..978d63a8261c 100644 |
9316 | --- a/kernel/locking/rtmutex.c |
9317 | +++ b/kernel/locking/rtmutex.c |
9318 | @@ -1726,12 +1726,33 @@ void rt_mutex_proxy_unlock(struct rt_mutex *lock, |
9319 | rt_mutex_set_owner(lock, NULL); |
9320 | } |
9321 | |
9322 | +/** |
9323 | + * __rt_mutex_start_proxy_lock() - Start lock acquisition for another task |
9324 | + * @lock: the rt_mutex to take |
9325 | + * @waiter: the pre-initialized rt_mutex_waiter |
9326 | + * @task: the task to prepare |
9327 | + * |
9328 | + * Starts the rt_mutex acquire; it enqueues the @waiter and does deadlock |
9329 | + * detection. It does not wait, see rt_mutex_wait_proxy_lock() for that. |
9330 | + * |
9331 | + * NOTE: does _NOT_ remove the @waiter on failure; must either call |
9332 | + * rt_mutex_wait_proxy_lock() or rt_mutex_cleanup_proxy_lock() after this. |
9333 | + * |
9334 | + * Returns: |
9335 | + * 0 - task blocked on lock |
9336 | + * 1 - acquired the lock for task, caller should wake it up |
9337 | + * <0 - error |
9338 | + * |
9339 | + * Special API call for PI-futex support. |
9340 | + */ |
9341 | int __rt_mutex_start_proxy_lock(struct rt_mutex *lock, |
9342 | struct rt_mutex_waiter *waiter, |
9343 | struct task_struct *task) |
9344 | { |
9345 | int ret; |
9346 | |
9347 | + lockdep_assert_held(&lock->wait_lock); |
9348 | + |
9349 | if (try_to_take_rt_mutex(lock, task, NULL)) |
9350 | return 1; |
9351 | |
9352 | @@ -1749,9 +1770,6 @@ int __rt_mutex_start_proxy_lock(struct rt_mutex *lock, |
9353 | ret = 0; |
9354 | } |
9355 | |
9356 | - if (unlikely(ret)) |
9357 | - remove_waiter(lock, waiter); |
9358 | - |
9359 | debug_rt_mutex_print_deadlock(waiter); |
9360 | |
9361 | return ret; |
9362 | @@ -1763,12 +1781,18 @@ int __rt_mutex_start_proxy_lock(struct rt_mutex *lock, |
9363 | * @waiter: the pre-initialized rt_mutex_waiter |
9364 | * @task: the task to prepare |
9365 | * |
9366 | + * Starts the rt_mutex acquire; it enqueues the @waiter and does deadlock |
9367 | + * detection. It does not wait, see rt_mutex_wait_proxy_lock() for that. |
9368 | + * |
9369 | + * NOTE: unlike __rt_mutex_start_proxy_lock this _DOES_ remove the @waiter |
9370 | + * on failure. |
9371 | + * |
9372 | * Returns: |
9373 | * 0 - task blocked on lock |
9374 | * 1 - acquired the lock for task, caller should wake it up |
9375 | * <0 - error |
9376 | * |
9377 | - * Special API call for FUTEX_REQUEUE_PI support. |
9378 | + * Special API call for PI-futex support. |
9379 | */ |
9380 | int rt_mutex_start_proxy_lock(struct rt_mutex *lock, |
9381 | struct rt_mutex_waiter *waiter, |
9382 | @@ -1778,6 +1802,8 @@ int rt_mutex_start_proxy_lock(struct rt_mutex *lock, |
9383 | |
9384 | raw_spin_lock_irq(&lock->wait_lock); |
9385 | ret = __rt_mutex_start_proxy_lock(lock, waiter, task); |
9386 | + if (unlikely(ret)) |
9387 | + remove_waiter(lock, waiter); |
9388 | raw_spin_unlock_irq(&lock->wait_lock); |
9389 | |
9390 | return ret; |
9391 | @@ -1845,7 +1871,8 @@ int rt_mutex_wait_proxy_lock(struct rt_mutex *lock, |
9392 | * @lock: the rt_mutex we were woken on |
9393 | * @waiter: the pre-initialized rt_mutex_waiter |
9394 | * |
9395 | - * Attempt to clean up after a failed rt_mutex_wait_proxy_lock(). |
9396 | + * Attempt to clean up after a failed __rt_mutex_start_proxy_lock() or |
9397 | + * rt_mutex_wait_proxy_lock(). |
9398 | * |
9399 | * Unless we acquired the lock; we're still enqueued on the wait-list and can |
9400 | * in fact still be granted ownership until we're removed. Therefore we can |
9401 | diff --git a/kernel/module.c b/kernel/module.c |
9402 | index 49a405891587..0812a7f80fa7 100644 |
9403 | --- a/kernel/module.c |
9404 | +++ b/kernel/module.c |
9405 | @@ -1207,8 +1207,10 @@ static ssize_t store_uevent(struct module_attribute *mattr, |
9406 | struct module_kobject *mk, |
9407 | const char *buffer, size_t count) |
9408 | { |
9409 | - kobject_synth_uevent(&mk->kobj, buffer, count); |
9410 | - return count; |
9411 | + int rc; |
9412 | + |
9413 | + rc = kobject_synth_uevent(&mk->kobj, buffer, count); |
9414 | + return rc ? rc : count; |
9415 | } |
9416 | |
9417 | struct module_attribute module_uevent = |
9418 | diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c |
9419 | index e8f191ba3fe5..852c60a69e36 100644 |
9420 | --- a/kernel/sched/fair.c |
9421 | +++ b/kernel/sched/fair.c |
9422 | @@ -5934,6 +5934,7 @@ static inline int find_idlest_cpu(struct sched_domain *sd, struct task_struct *p |
9423 | |
9424 | #ifdef CONFIG_SCHED_SMT |
9425 | DEFINE_STATIC_KEY_FALSE(sched_smt_present); |
9426 | +EXPORT_SYMBOL_GPL(sched_smt_present); |
9427 | |
9428 | static inline void set_idle_cores(int cpu, int val) |
9429 | { |
9430 | diff --git a/kernel/smp.c b/kernel/smp.c |
9431 | index 163c451af42e..f4cf1b0bb3b8 100644 |
9432 | --- a/kernel/smp.c |
9433 | +++ b/kernel/smp.c |
9434 | @@ -584,8 +584,6 @@ void __init smp_init(void) |
9435 | num_nodes, (num_nodes > 1 ? "s" : ""), |
9436 | num_cpus, (num_cpus > 1 ? "s" : "")); |
9437 | |
9438 | - /* Final decision about SMT support */ |
9439 | - cpu_smt_check_topology(); |
9440 | /* Any cleanup work */ |
9441 | smp_cpus_done(setup_max_cpus); |
9442 | } |
9443 | diff --git a/kernel/sysctl.c b/kernel/sysctl.c |
9444 | index 5fc724e4e454..9ee261fce89e 100644 |
9445 | --- a/kernel/sysctl.c |
9446 | +++ b/kernel/sysctl.c |
9447 | @@ -2779,6 +2779,8 @@ static int __do_proc_doulongvec_minmax(void *data, struct ctl_table *table, int |
9448 | bool neg; |
9449 | |
9450 | left -= proc_skip_spaces(&p); |
9451 | + if (!left) |
9452 | + break; |
9453 | |
9454 | err = proc_get_long(&p, &left, &val, &neg, |
9455 | proc_wspace_sep, |
9456 | diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c |
9457 | index 2d110c948805..6c9493495538 100644 |
9458 | --- a/kernel/time/timekeeping.c |
9459 | +++ b/kernel/time/timekeeping.c |
9460 | @@ -50,7 +50,9 @@ enum timekeeping_adv_mode { |
9461 | static struct { |
9462 | seqcount_t seq; |
9463 | struct timekeeper timekeeper; |
9464 | -} tk_core ____cacheline_aligned; |
9465 | +} tk_core ____cacheline_aligned = { |
9466 | + .seq = SEQCNT_ZERO(tk_core.seq), |
9467 | +}; |
9468 | |
9469 | static DEFINE_RAW_SPINLOCK(timekeeper_lock); |
9470 | static struct timekeeper shadow_timekeeper; |
9471 | diff --git a/lib/seq_buf.c b/lib/seq_buf.c |
9472 | index 11f2ae0f9099..6aabb609dd87 100644 |
9473 | --- a/lib/seq_buf.c |
9474 | +++ b/lib/seq_buf.c |
9475 | @@ -144,9 +144,13 @@ int seq_buf_puts(struct seq_buf *s, const char *str) |
9476 | |
9477 | WARN_ON(s->size == 0); |
9478 | |
9479 | + /* Add 1 to len for the trailing null byte which must be there */ |
9480 | + len += 1; |
9481 | + |
9482 | if (seq_buf_can_fit(s, len)) { |
9483 | memcpy(s->buffer + s->len, str, len); |
9484 | - s->len += len; |
9485 | + /* Don't count the trailing null byte against the capacity */ |
9486 | + s->len += len - 1; |
9487 | return 0; |
9488 | } |
9489 | seq_buf_set_overflow(s); |
9490 | diff --git a/lib/test_rhashtable.c b/lib/test_rhashtable.c |
9491 | index 82ac39ce5310..aecc0996628f 100644 |
9492 | --- a/lib/test_rhashtable.c |
9493 | +++ b/lib/test_rhashtable.c |
9494 | @@ -541,38 +541,45 @@ static unsigned int __init print_ht(struct rhltable *rhlt) |
9495 | static int __init test_insert_dup(struct test_obj_rhl *rhl_test_objects, |
9496 | int cnt, bool slow) |
9497 | { |
9498 | - struct rhltable rhlt; |
9499 | + struct rhltable *rhlt; |
9500 | unsigned int i, ret; |
9501 | const char *key; |
9502 | int err = 0; |
9503 | |
9504 | - err = rhltable_init(&rhlt, &test_rht_params_dup); |
9505 | - if (WARN_ON(err)) |
9506 | + rhlt = kmalloc(sizeof(*rhlt), GFP_KERNEL); |
9507 | + if (WARN_ON(!rhlt)) |
9508 | + return -EINVAL; |
9509 | + |
9510 | + err = rhltable_init(rhlt, &test_rht_params_dup); |
9511 | + if (WARN_ON(err)) { |
9512 | + kfree(rhlt); |
9513 | return err; |
9514 | + } |
9515 | |
9516 | for (i = 0; i < cnt; i++) { |
9517 | rhl_test_objects[i].value.tid = i; |
9518 | - key = rht_obj(&rhlt.ht, &rhl_test_objects[i].list_node.rhead); |
9519 | + key = rht_obj(&rhlt->ht, &rhl_test_objects[i].list_node.rhead); |
9520 | key += test_rht_params_dup.key_offset; |
9521 | |
9522 | if (slow) { |
9523 | - err = PTR_ERR(rhashtable_insert_slow(&rhlt.ht, key, |
9524 | + err = PTR_ERR(rhashtable_insert_slow(&rhlt->ht, key, |
9525 | &rhl_test_objects[i].list_node.rhead)); |
9526 | if (err == -EAGAIN) |
9527 | err = 0; |
9528 | } else |
9529 | - err = rhltable_insert(&rhlt, |
9530 | + err = rhltable_insert(rhlt, |
9531 | &rhl_test_objects[i].list_node, |
9532 | test_rht_params_dup); |
9533 | if (WARN(err, "error %d on element %d/%d (%s)\n", err, i, cnt, slow? "slow" : "fast")) |
9534 | goto skip_print; |
9535 | } |
9536 | |
9537 | - ret = print_ht(&rhlt); |
9538 | + ret = print_ht(rhlt); |
9539 | WARN(ret != cnt, "missing rhltable elements (%d != %d, %s)\n", ret, cnt, slow? "slow" : "fast"); |
9540 | |
9541 | skip_print: |
9542 | - rhltable_destroy(&rhlt); |
9543 | + rhltable_destroy(rhlt); |
9544 | + kfree(rhlt); |
9545 | |
9546 | return 0; |
9547 | } |
9548 | diff --git a/mm/page_alloc.c b/mm/page_alloc.c |
9549 | index 995d1079f958..a29043ea9212 100644 |
9550 | --- a/mm/page_alloc.c |
9551 | +++ b/mm/page_alloc.c |
9552 | @@ -294,6 +294,32 @@ EXPORT_SYMBOL(nr_online_nodes); |
9553 | int page_group_by_mobility_disabled __read_mostly; |
9554 | |
9555 | #ifdef CONFIG_DEFERRED_STRUCT_PAGE_INIT |
9556 | +/* |
9557 | + * During boot we initialize deferred pages on-demand, as needed, but once |
9558 | + * page_alloc_init_late() has finished, the deferred pages are all initialized, |
9559 | + * and we can permanently disable that path. |
9560 | + */ |
9561 | +static DEFINE_STATIC_KEY_TRUE(deferred_pages); |
9562 | + |
9563 | +/* |
9564 | + * Calling kasan_free_pages() only after deferred memory initialization |
9565 | + * has completed. Poisoning pages during deferred memory init will greatly |
9566 | + * lengthen the process and cause problem in large memory systems as the |
9567 | + * deferred pages initialization is done with interrupt disabled. |
9568 | + * |
9569 | + * Assuming that there will be no reference to those newly initialized |
9570 | + * pages before they are ever allocated, this should have no effect on |
9571 | + * KASAN memory tracking as the poison will be properly inserted at page |
9572 | + * allocation time. The only corner case is when pages are allocated by |
9573 | + * on-demand allocation and then freed again before the deferred pages |
9574 | + * initialization is done, but this is not likely to happen. |
9575 | + */ |
9576 | +static inline void kasan_free_nondeferred_pages(struct page *page, int order) |
9577 | +{ |
9578 | + if (!static_branch_unlikely(&deferred_pages)) |
9579 | + kasan_free_pages(page, order); |
9580 | +} |
9581 | + |
9582 | /* Returns true if the struct page for the pfn is uninitialised */ |
9583 | static inline bool __meminit early_page_uninitialised(unsigned long pfn) |
9584 | { |
9585 | @@ -335,6 +361,8 @@ defer_init(int nid, unsigned long pfn, unsigned long end_pfn) |
9586 | return false; |
9587 | } |
9588 | #else |
9589 | +#define kasan_free_nondeferred_pages(p, o) kasan_free_pages(p, o) |
9590 | + |
9591 | static inline bool early_page_uninitialised(unsigned long pfn) |
9592 | { |
9593 | return false; |
9594 | @@ -1037,7 +1065,7 @@ static __always_inline bool free_pages_prepare(struct page *page, |
9595 | arch_free_page(page, order); |
9596 | kernel_poison_pages(page, 1 << order, 0); |
9597 | kernel_map_pages(page, 1 << order, 0); |
9598 | - kasan_free_pages(page, order); |
9599 | + kasan_free_nondeferred_pages(page, order); |
9600 | |
9601 | return true; |
9602 | } |
9603 | @@ -1605,13 +1633,6 @@ static int __init deferred_init_memmap(void *data) |
9604 | return 0; |
9605 | } |
9606 | |
9607 | -/* |
9608 | - * During boot we initialize deferred pages on-demand, as needed, but once |
9609 | - * page_alloc_init_late() has finished, the deferred pages are all initialized, |
9610 | - * and we can permanently disable that path. |
9611 | - */ |
9612 | -static DEFINE_STATIC_KEY_TRUE(deferred_pages); |
9613 | - |
9614 | /* |
9615 | * If this zone has deferred pages, try to grow it by initializing enough |
9616 | * deferred pages to satisfy the allocation specified by order, rounded up to |
9617 | diff --git a/mm/percpu-km.c b/mm/percpu-km.c |
9618 | index 38de70ab1a0d..0f643dc2dc65 100644 |
9619 | --- a/mm/percpu-km.c |
9620 | +++ b/mm/percpu-km.c |
9621 | @@ -50,6 +50,7 @@ static struct pcpu_chunk *pcpu_create_chunk(gfp_t gfp) |
9622 | const int nr_pages = pcpu_group_sizes[0] >> PAGE_SHIFT; |
9623 | struct pcpu_chunk *chunk; |
9624 | struct page *pages; |
9625 | + unsigned long flags; |
9626 | int i; |
9627 | |
9628 | chunk = pcpu_alloc_chunk(gfp); |
9629 | @@ -68,9 +69,9 @@ static struct pcpu_chunk *pcpu_create_chunk(gfp_t gfp) |
9630 | chunk->data = pages; |
9631 | chunk->base_addr = page_address(pages) - pcpu_group_offsets[0]; |
9632 | |
9633 | - spin_lock_irq(&pcpu_lock); |
9634 | + spin_lock_irqsave(&pcpu_lock, flags); |
9635 | pcpu_chunk_populated(chunk, 0, nr_pages, false); |
9636 | - spin_unlock_irq(&pcpu_lock); |
9637 | + spin_unlock_irqrestore(&pcpu_lock, flags); |
9638 | |
9639 | pcpu_stats_chunk_alloc(); |
9640 | trace_percpu_create_chunk(chunk->base_addr); |
9641 | diff --git a/net/core/skmsg.c b/net/core/skmsg.c |
9642 | index b7dbb3c976cd..54d854807630 100644 |
9643 | --- a/net/core/skmsg.c |
9644 | +++ b/net/core/skmsg.c |
9645 | @@ -406,7 +406,7 @@ static int sk_psock_skb_ingress(struct sk_psock *psock, struct sk_buff *skb) |
9646 | msg->skb = skb; |
9647 | |
9648 | sk_psock_queue_msg(psock, msg); |
9649 | - sk->sk_data_ready(sk); |
9650 | + sk_psock_data_ready(sk, psock); |
9651 | return copied; |
9652 | } |
9653 | |
9654 | @@ -575,6 +575,7 @@ void sk_psock_drop(struct sock *sk, struct sk_psock *psock) |
9655 | { |
9656 | rcu_assign_sk_user_data(sk, NULL); |
9657 | sk_psock_cork_free(psock); |
9658 | + sk_psock_zap_ingress(psock); |
9659 | sk_psock_restore_proto(sk, psock); |
9660 | |
9661 | write_lock_bh(&sk->sk_callback_lock); |
9662 | @@ -738,7 +739,7 @@ static int sk_psock_strp_parse(struct strparser *strp, struct sk_buff *skb) |
9663 | } |
9664 | |
9665 | /* Called with socket lock held. */ |
9666 | -static void sk_psock_data_ready(struct sock *sk) |
9667 | +static void sk_psock_strp_data_ready(struct sock *sk) |
9668 | { |
9669 | struct sk_psock *psock; |
9670 | |
9671 | @@ -786,7 +787,7 @@ void sk_psock_start_strp(struct sock *sk, struct sk_psock *psock) |
9672 | return; |
9673 | |
9674 | parser->saved_data_ready = sk->sk_data_ready; |
9675 | - sk->sk_data_ready = sk_psock_data_ready; |
9676 | + sk->sk_data_ready = sk_psock_strp_data_ready; |
9677 | sk->sk_write_space = sk_psock_write_space; |
9678 | parser->enabled = true; |
9679 | } |
9680 | diff --git a/net/dccp/ccid.h b/net/dccp/ccid.h |
9681 | index 6eb837a47b5c..baaaeb2b2c42 100644 |
9682 | --- a/net/dccp/ccid.h |
9683 | +++ b/net/dccp/ccid.h |
9684 | @@ -202,7 +202,7 @@ static inline void ccid_hc_tx_packet_recv(struct ccid *ccid, struct sock *sk, |
9685 | static inline int ccid_hc_tx_parse_options(struct ccid *ccid, struct sock *sk, |
9686 | u8 pkt, u8 opt, u8 *val, u8 len) |
9687 | { |
9688 | - if (ccid->ccid_ops->ccid_hc_tx_parse_options == NULL) |
9689 | + if (!ccid || !ccid->ccid_ops->ccid_hc_tx_parse_options) |
9690 | return 0; |
9691 | return ccid->ccid_ops->ccid_hc_tx_parse_options(sk, pkt, opt, val, len); |
9692 | } |
9693 | @@ -214,7 +214,7 @@ static inline int ccid_hc_tx_parse_options(struct ccid *ccid, struct sock *sk, |
9694 | static inline int ccid_hc_rx_parse_options(struct ccid *ccid, struct sock *sk, |
9695 | u8 pkt, u8 opt, u8 *val, u8 len) |
9696 | { |
9697 | - if (ccid->ccid_ops->ccid_hc_rx_parse_options == NULL) |
9698 | + if (!ccid || !ccid->ccid_ops->ccid_hc_rx_parse_options) |
9699 | return 0; |
9700 | return ccid->ccid_ops->ccid_hc_rx_parse_options(sk, pkt, opt, val, len); |
9701 | } |
9702 | diff --git a/net/dsa/master.c b/net/dsa/master.c |
9703 | index 5e8c9bef78bd..dbfdda5fe8ed 100644 |
9704 | --- a/net/dsa/master.c |
9705 | +++ b/net/dsa/master.c |
9706 | @@ -179,6 +179,8 @@ static const struct attribute_group dsa_group = { |
9707 | .attrs = dsa_slave_attrs, |
9708 | }; |
9709 | |
9710 | +static struct lock_class_key dsa_master_addr_list_lock_key; |
9711 | + |
9712 | int dsa_master_setup(struct net_device *dev, struct dsa_port *cpu_dp) |
9713 | { |
9714 | int ret; |
9715 | @@ -190,6 +192,8 @@ int dsa_master_setup(struct net_device *dev, struct dsa_port *cpu_dp) |
9716 | wmb(); |
9717 | |
9718 | dev->dsa_ptr = cpu_dp; |
9719 | + lockdep_set_class(&dev->addr_list_lock, |
9720 | + &dsa_master_addr_list_lock_key); |
9721 | |
9722 | ret = dsa_master_ethtool_setup(dev); |
9723 | if (ret) |
9724 | diff --git a/net/dsa/slave.c b/net/dsa/slave.c |
9725 | index aec78f5aca72..a3ddc225f103 100644 |
9726 | --- a/net/dsa/slave.c |
9727 | +++ b/net/dsa/slave.c |
9728 | @@ -140,11 +140,14 @@ static int dsa_slave_close(struct net_device *dev) |
9729 | static void dsa_slave_change_rx_flags(struct net_device *dev, int change) |
9730 | { |
9731 | struct net_device *master = dsa_slave_to_master(dev); |
9732 | - |
9733 | - if (change & IFF_ALLMULTI) |
9734 | - dev_set_allmulti(master, dev->flags & IFF_ALLMULTI ? 1 : -1); |
9735 | - if (change & IFF_PROMISC) |
9736 | - dev_set_promiscuity(master, dev->flags & IFF_PROMISC ? 1 : -1); |
9737 | + if (dev->flags & IFF_UP) { |
9738 | + if (change & IFF_ALLMULTI) |
9739 | + dev_set_allmulti(master, |
9740 | + dev->flags & IFF_ALLMULTI ? 1 : -1); |
9741 | + if (change & IFF_PROMISC) |
9742 | + dev_set_promiscuity(master, |
9743 | + dev->flags & IFF_PROMISC ? 1 : -1); |
9744 | + } |
9745 | } |
9746 | |
9747 | static void dsa_slave_set_rx_mode(struct net_device *dev) |
9748 | @@ -639,7 +642,7 @@ static int dsa_slave_set_eee(struct net_device *dev, struct ethtool_eee *e) |
9749 | int ret; |
9750 | |
9751 | /* Port's PHY and MAC both need to be EEE capable */ |
9752 | - if (!dev->phydev && !dp->pl) |
9753 | + if (!dev->phydev || !dp->pl) |
9754 | return -ENODEV; |
9755 | |
9756 | if (!ds->ops->set_mac_eee) |
9757 | @@ -659,7 +662,7 @@ static int dsa_slave_get_eee(struct net_device *dev, struct ethtool_eee *e) |
9758 | int ret; |
9759 | |
9760 | /* Port's PHY and MAC both need to be EEE capable */ |
9761 | - if (!dev->phydev && !dp->pl) |
9762 | + if (!dev->phydev || !dp->pl) |
9763 | return -ENODEV; |
9764 | |
9765 | if (!ds->ops->get_mac_eee) |
9766 | diff --git a/net/ipv4/tcp_bpf.c b/net/ipv4/tcp_bpf.c |
9767 | index 3b45fe530f91..2d6bd7a59b2c 100644 |
9768 | --- a/net/ipv4/tcp_bpf.c |
9769 | +++ b/net/ipv4/tcp_bpf.c |
9770 | @@ -198,7 +198,7 @@ static int bpf_tcp_ingress(struct sock *sk, struct sk_psock *psock, |
9771 | msg->sg.start = i; |
9772 | msg->sg.size -= apply_bytes; |
9773 | sk_psock_queue_msg(psock, tmp); |
9774 | - sk->sk_data_ready(sk); |
9775 | + sk_psock_data_ready(sk, psock); |
9776 | } else { |
9777 | sk_msg_free(sk, tmp); |
9778 | kfree(tmp); |
9779 | diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c |
9780 | index 03e6b7a2bc53..f5c213001b05 100644 |
9781 | --- a/net/ipv6/tcp_ipv6.c |
9782 | +++ b/net/ipv6/tcp_ipv6.c |
9783 | @@ -734,6 +734,7 @@ static void tcp_v6_init_req(struct request_sock *req, |
9784 | const struct sock *sk_listener, |
9785 | struct sk_buff *skb) |
9786 | { |
9787 | + bool l3_slave = ipv6_l3mdev_skb(TCP_SKB_CB(skb)->header.h6.flags); |
9788 | struct inet_request_sock *ireq = inet_rsk(req); |
9789 | const struct ipv6_pinfo *np = inet6_sk(sk_listener); |
9790 | |
9791 | @@ -741,7 +742,7 @@ static void tcp_v6_init_req(struct request_sock *req, |
9792 | ireq->ir_v6_loc_addr = ipv6_hdr(skb)->daddr; |
9793 | |
9794 | /* So that link locals have meaning */ |
9795 | - if (!sk_listener->sk_bound_dev_if && |
9796 | + if ((!sk_listener->sk_bound_dev_if || l3_slave) && |
9797 | ipv6_addr_type(&ireq->ir_v6_rmt_addr) & IPV6_ADDR_LINKLOCAL) |
9798 | ireq->ir_iif = tcp_v6_iif(skb); |
9799 | |
9800 | diff --git a/net/ipv6/xfrm6_tunnel.c b/net/ipv6/xfrm6_tunnel.c |
9801 | index 4a46df8441c9..f5b4febeaa25 100644 |
9802 | --- a/net/ipv6/xfrm6_tunnel.c |
9803 | +++ b/net/ipv6/xfrm6_tunnel.c |
9804 | @@ -144,6 +144,9 @@ static u32 __xfrm6_tunnel_alloc_spi(struct net *net, xfrm_address_t *saddr) |
9805 | index = __xfrm6_tunnel_spi_check(net, spi); |
9806 | if (index >= 0) |
9807 | goto alloc_spi; |
9808 | + |
9809 | + if (spi == XFRM6_TUNNEL_SPI_MAX) |
9810 | + break; |
9811 | } |
9812 | for (spi = XFRM6_TUNNEL_SPI_MIN; spi < xfrm6_tn->spi; spi++) { |
9813 | index = __xfrm6_tunnel_spi_check(net, spi); |
9814 | diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c |
9815 | index 428f7ad5f9b5..85c365fc7a0c 100644 |
9816 | --- a/net/mac80211/rx.c |
9817 | +++ b/net/mac80211/rx.c |
9818 | @@ -143,6 +143,9 @@ ieee80211_rx_radiotap_hdrlen(struct ieee80211_local *local, |
9819 | /* allocate extra bitmaps */ |
9820 | if (status->chains) |
9821 | len += 4 * hweight8(status->chains); |
9822 | + /* vendor presence bitmap */ |
9823 | + if (status->flag & RX_FLAG_RADIOTAP_VENDOR_DATA) |
9824 | + len += 4; |
9825 | |
9826 | if (ieee80211_have_rx_timestamp(status)) { |
9827 | len = ALIGN(len, 8); |
9828 | @@ -207,8 +210,6 @@ ieee80211_rx_radiotap_hdrlen(struct ieee80211_local *local, |
9829 | if (status->flag & RX_FLAG_RADIOTAP_VENDOR_DATA) { |
9830 | struct ieee80211_vendor_radiotap *rtap = (void *)skb->data; |
9831 | |
9832 | - /* vendor presence bitmap */ |
9833 | - len += 4; |
9834 | /* alignment for fixed 6-byte vendor data header */ |
9835 | len = ALIGN(len, 2); |
9836 | /* vendor data header */ |
9837 | @@ -753,6 +754,7 @@ ieee80211_rx_monitor(struct ieee80211_local *local, struct sk_buff *origskb, |
9838 | struct ieee80211_sub_if_data *monitor_sdata = |
9839 | rcu_dereference(local->monitor_sdata); |
9840 | bool only_monitor = false; |
9841 | + unsigned int min_head_len; |
9842 | |
9843 | if (status->flag & RX_FLAG_RADIOTAP_HE) |
9844 | rtap_space += sizeof(struct ieee80211_radiotap_he); |
9845 | @@ -766,6 +768,8 @@ ieee80211_rx_monitor(struct ieee80211_local *local, struct sk_buff *origskb, |
9846 | rtap_space += sizeof(*rtap) + rtap->len + rtap->pad; |
9847 | } |
9848 | |
9849 | + min_head_len = rtap_space; |
9850 | + |
9851 | /* |
9852 | * First, we may need to make a copy of the skb because |
9853 | * (1) we need to modify it for radiotap (if not present), and |
9854 | @@ -775,18 +779,23 @@ ieee80211_rx_monitor(struct ieee80211_local *local, struct sk_buff *origskb, |
9855 | * the SKB because it has a bad FCS/PLCP checksum. |
9856 | */ |
9857 | |
9858 | - if (ieee80211_hw_check(&local->hw, RX_INCLUDES_FCS)) { |
9859 | - if (unlikely(origskb->len <= FCS_LEN)) { |
9860 | - /* driver bug */ |
9861 | - WARN_ON(1); |
9862 | - dev_kfree_skb(origskb); |
9863 | - return NULL; |
9864 | + if (!(status->flag & RX_FLAG_NO_PSDU)) { |
9865 | + if (ieee80211_hw_check(&local->hw, RX_INCLUDES_FCS)) { |
9866 | + if (unlikely(origskb->len <= FCS_LEN + rtap_space)) { |
9867 | + /* driver bug */ |
9868 | + WARN_ON(1); |
9869 | + dev_kfree_skb(origskb); |
9870 | + return NULL; |
9871 | + } |
9872 | + present_fcs_len = FCS_LEN; |
9873 | } |
9874 | - present_fcs_len = FCS_LEN; |
9875 | + |
9876 | + /* also consider the hdr->frame_control */ |
9877 | + min_head_len += 2; |
9878 | } |
9879 | |
9880 | - /* ensure hdr->frame_control and vendor radiotap data are in skb head */ |
9881 | - if (!pskb_may_pull(origskb, 2 + rtap_space)) { |
9882 | + /* ensure that the expected data elements are in skb head */ |
9883 | + if (!pskb_may_pull(origskb, min_head_len)) { |
9884 | dev_kfree_skb(origskb); |
9885 | return NULL; |
9886 | } |
9887 | diff --git a/net/mac80211/util.c b/net/mac80211/util.c |
9888 | index bec424316ea4..dddfff7cf44f 100644 |
9889 | --- a/net/mac80211/util.c |
9890 | +++ b/net/mac80211/util.c |
9891 | @@ -299,16 +299,16 @@ out: |
9892 | spin_unlock_bh(&fq->lock); |
9893 | } |
9894 | |
9895 | -void ieee80211_wake_txqs(unsigned long data) |
9896 | +static void |
9897 | +__releases(&local->queue_stop_reason_lock) |
9898 | +__acquires(&local->queue_stop_reason_lock) |
9899 | +_ieee80211_wake_txqs(struct ieee80211_local *local, unsigned long *flags) |
9900 | { |
9901 | - struct ieee80211_local *local = (struct ieee80211_local *)data; |
9902 | struct ieee80211_sub_if_data *sdata; |
9903 | int n_acs = IEEE80211_NUM_ACS; |
9904 | - unsigned long flags; |
9905 | int i; |
9906 | |
9907 | rcu_read_lock(); |
9908 | - spin_lock_irqsave(&local->queue_stop_reason_lock, flags); |
9909 | |
9910 | if (local->hw.queues < IEEE80211_NUM_ACS) |
9911 | n_acs = 1; |
9912 | @@ -317,7 +317,7 @@ void ieee80211_wake_txqs(unsigned long data) |
9913 | if (local->queue_stop_reasons[i]) |
9914 | continue; |
9915 | |
9916 | - spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); |
9917 | + spin_unlock_irqrestore(&local->queue_stop_reason_lock, *flags); |
9918 | list_for_each_entry_rcu(sdata, &local->interfaces, list) { |
9919 | int ac; |
9920 | |
9921 | @@ -329,13 +329,22 @@ void ieee80211_wake_txqs(unsigned long data) |
9922 | __ieee80211_wake_txqs(sdata, ac); |
9923 | } |
9924 | } |
9925 | - spin_lock_irqsave(&local->queue_stop_reason_lock, flags); |
9926 | + spin_lock_irqsave(&local->queue_stop_reason_lock, *flags); |
9927 | } |
9928 | |
9929 | - spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); |
9930 | rcu_read_unlock(); |
9931 | } |
9932 | |
9933 | +void ieee80211_wake_txqs(unsigned long data) |
9934 | +{ |
9935 | + struct ieee80211_local *local = (struct ieee80211_local *)data; |
9936 | + unsigned long flags; |
9937 | + |
9938 | + spin_lock_irqsave(&local->queue_stop_reason_lock, flags); |
9939 | + _ieee80211_wake_txqs(local, &flags); |
9940 | + spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); |
9941 | +} |
9942 | + |
9943 | void ieee80211_propagate_queue_wake(struct ieee80211_local *local, int queue) |
9944 | { |
9945 | struct ieee80211_sub_if_data *sdata; |
9946 | @@ -371,7 +380,8 @@ void ieee80211_propagate_queue_wake(struct ieee80211_local *local, int queue) |
9947 | |
9948 | static void __ieee80211_wake_queue(struct ieee80211_hw *hw, int queue, |
9949 | enum queue_stop_reason reason, |
9950 | - bool refcounted) |
9951 | + bool refcounted, |
9952 | + unsigned long *flags) |
9953 | { |
9954 | struct ieee80211_local *local = hw_to_local(hw); |
9955 | |
9956 | @@ -405,8 +415,19 @@ static void __ieee80211_wake_queue(struct ieee80211_hw *hw, int queue, |
9957 | } else |
9958 | tasklet_schedule(&local->tx_pending_tasklet); |
9959 | |
9960 | - if (local->ops->wake_tx_queue) |
9961 | - tasklet_schedule(&local->wake_txqs_tasklet); |
9962 | + /* |
9963 | + * Calling _ieee80211_wake_txqs here can be a problem because it may |
9964 | + * release queue_stop_reason_lock which has been taken by |
9965 | + * __ieee80211_wake_queue's caller. It is certainly not very nice to |
9966 | + * release someone's lock, but it is fine because all the callers of |
9967 | + * __ieee80211_wake_queue call it right before releasing the lock. |
9968 | + */ |
9969 | + if (local->ops->wake_tx_queue) { |
9970 | + if (reason == IEEE80211_QUEUE_STOP_REASON_DRIVER) |
9971 | + tasklet_schedule(&local->wake_txqs_tasklet); |
9972 | + else |
9973 | + _ieee80211_wake_txqs(local, flags); |
9974 | + } |
9975 | } |
9976 | |
9977 | void ieee80211_wake_queue_by_reason(struct ieee80211_hw *hw, int queue, |
9978 | @@ -417,7 +438,7 @@ void ieee80211_wake_queue_by_reason(struct ieee80211_hw *hw, int queue, |
9979 | unsigned long flags; |
9980 | |
9981 | spin_lock_irqsave(&local->queue_stop_reason_lock, flags); |
9982 | - __ieee80211_wake_queue(hw, queue, reason, refcounted); |
9983 | + __ieee80211_wake_queue(hw, queue, reason, refcounted, &flags); |
9984 | spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); |
9985 | } |
9986 | |
9987 | @@ -514,7 +535,7 @@ void ieee80211_add_pending_skb(struct ieee80211_local *local, |
9988 | false); |
9989 | __skb_queue_tail(&local->pending[queue], skb); |
9990 | __ieee80211_wake_queue(hw, queue, IEEE80211_QUEUE_STOP_REASON_SKB_ADD, |
9991 | - false); |
9992 | + false, &flags); |
9993 | spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); |
9994 | } |
9995 | |
9996 | @@ -547,7 +568,7 @@ void ieee80211_add_pending_skbs(struct ieee80211_local *local, |
9997 | for (i = 0; i < hw->queues; i++) |
9998 | __ieee80211_wake_queue(hw, i, |
9999 | IEEE80211_QUEUE_STOP_REASON_SKB_ADD, |
10000 | - false); |
10001 | + false, &flags); |
10002 | spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); |
10003 | } |
10004 | |
10005 | @@ -605,7 +626,7 @@ void ieee80211_wake_queues_by_reason(struct ieee80211_hw *hw, |
10006 | spin_lock_irqsave(&local->queue_stop_reason_lock, flags); |
10007 | |
10008 | for_each_set_bit(i, &queues, hw->queues) |
10009 | - __ieee80211_wake_queue(hw, i, reason, refcounted); |
10010 | + __ieee80211_wake_queue(hw, i, reason, refcounted, &flags); |
10011 | |
10012 | spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); |
10013 | } |
10014 | diff --git a/net/rds/bind.c b/net/rds/bind.c |
10015 | index 762d2c6788a3..17c9d9f0c848 100644 |
10016 | --- a/net/rds/bind.c |
10017 | +++ b/net/rds/bind.c |
10018 | @@ -78,10 +78,10 @@ struct rds_sock *rds_find_bound(const struct in6_addr *addr, __be16 port, |
10019 | __rds_create_bind_key(key, addr, port, scope_id); |
10020 | rcu_read_lock(); |
10021 | rs = rhashtable_lookup(&bind_hash_table, key, ht_parms); |
10022 | - if (rs && !sock_flag(rds_rs_to_sk(rs), SOCK_DEAD)) |
10023 | - rds_sock_addref(rs); |
10024 | - else |
10025 | + if (rs && (sock_flag(rds_rs_to_sk(rs), SOCK_DEAD) || |
10026 | + !refcount_inc_not_zero(&rds_rs_to_sk(rs)->sk_refcnt))) |
10027 | rs = NULL; |
10028 | + |
10029 | rcu_read_unlock(); |
10030 | |
10031 | rdsdebug("returning rs %p for %pI6c:%u\n", rs, addr, |
10032 | diff --git a/net/rxrpc/recvmsg.c b/net/rxrpc/recvmsg.c |
10033 | index eaf19ebaa964..3f7bb11f3290 100644 |
10034 | --- a/net/rxrpc/recvmsg.c |
10035 | +++ b/net/rxrpc/recvmsg.c |
10036 | @@ -596,6 +596,7 @@ error_requeue_call: |
10037 | } |
10038 | error_no_call: |
10039 | release_sock(&rx->sk); |
10040 | +error_trace: |
10041 | trace_rxrpc_recvmsg(call, rxrpc_recvmsg_return, 0, 0, 0, ret); |
10042 | return ret; |
10043 | |
10044 | @@ -604,7 +605,7 @@ wait_interrupted: |
10045 | wait_error: |
10046 | finish_wait(sk_sleep(&rx->sk), &wait); |
10047 | call = NULL; |
10048 | - goto error_no_call; |
10049 | + goto error_trace; |
10050 | } |
10051 | |
10052 | /** |
10053 | diff --git a/net/sched/cls_flower.c b/net/sched/cls_flower.c |
10054 | index 45bc2b72dc1c..2f64e3538127 100644 |
10055 | --- a/net/sched/cls_flower.c |
10056 | +++ b/net/sched/cls_flower.c |
10057 | @@ -1257,7 +1257,7 @@ static int fl_change(struct net *net, struct sk_buff *in_skb, |
10058 | if (!tc_skip_hw(fnew->flags)) { |
10059 | err = fl_hw_replace_filter(tp, fnew, extack); |
10060 | if (err) |
10061 | - goto errout_mask; |
10062 | + goto errout_mask_ht; |
10063 | } |
10064 | |
10065 | if (!tc_in_hw(fnew->flags)) |
10066 | @@ -1287,6 +1287,10 @@ static int fl_change(struct net *net, struct sk_buff *in_skb, |
10067 | kfree(mask); |
10068 | return 0; |
10069 | |
10070 | +errout_mask_ht: |
10071 | + rhashtable_remove_fast(&fnew->mask->ht, &fnew->ht_node, |
10072 | + fnew->mask->filter_ht_params); |
10073 | + |
10074 | errout_mask: |
10075 | fl_mask_put(head, fnew->mask, false); |
10076 | |
10077 | diff --git a/net/sctp/socket.c b/net/sctp/socket.c |
10078 | index b8cebd5a87e5..b7a534f6d7c2 100644 |
10079 | --- a/net/sctp/socket.c |
10080 | +++ b/net/sctp/socket.c |
10081 | @@ -2027,7 +2027,7 @@ static int sctp_sendmsg(struct sock *sk, struct msghdr *msg, size_t msg_len) |
10082 | struct sctp_endpoint *ep = sctp_sk(sk)->ep; |
10083 | struct sctp_transport *transport = NULL; |
10084 | struct sctp_sndrcvinfo _sinfo, *sinfo; |
10085 | - struct sctp_association *asoc; |
10086 | + struct sctp_association *asoc, *tmp; |
10087 | struct sctp_cmsgs cmsgs; |
10088 | union sctp_addr *daddr; |
10089 | bool new = false; |
10090 | @@ -2053,7 +2053,7 @@ static int sctp_sendmsg(struct sock *sk, struct msghdr *msg, size_t msg_len) |
10091 | |
10092 | /* SCTP_SENDALL process */ |
10093 | if ((sflags & SCTP_SENDALL) && sctp_style(sk, UDP)) { |
10094 | - list_for_each_entry(asoc, &ep->asocs, asocs) { |
10095 | + list_for_each_entry_safe(asoc, tmp, &ep->asocs, asocs) { |
10096 | err = sctp_sendmsg_check_sflags(asoc, sflags, msg, |
10097 | msg_len); |
10098 | if (err == 0) |
10099 | diff --git a/net/sctp/stream.c b/net/sctp/stream.c |
10100 | index 80e0ae5534ec..f24633114dfd 100644 |
10101 | --- a/net/sctp/stream.c |
10102 | +++ b/net/sctp/stream.c |
10103 | @@ -84,6 +84,19 @@ static void fa_zero(struct flex_array *fa, size_t index, size_t count) |
10104 | } |
10105 | } |
10106 | |
10107 | +static size_t fa_index(struct flex_array *fa, void *elem, size_t count) |
10108 | +{ |
10109 | + size_t index = 0; |
10110 | + |
10111 | + while (count--) { |
10112 | + if (elem == flex_array_get(fa, index)) |
10113 | + break; |
10114 | + index++; |
10115 | + } |
10116 | + |
10117 | + return index; |
10118 | +} |
10119 | + |
10120 | /* Migrates chunks from stream queues to new stream queues if needed, |
10121 | * but not across associations. Also, removes those chunks to streams |
10122 | * higher than the new max. |
10123 | @@ -147,6 +160,13 @@ static int sctp_stream_alloc_out(struct sctp_stream *stream, __u16 outcnt, |
10124 | |
10125 | if (stream->out) { |
10126 | fa_copy(out, stream->out, 0, min(outcnt, stream->outcnt)); |
10127 | + if (stream->out_curr) { |
10128 | + size_t index = fa_index(stream->out, stream->out_curr, |
10129 | + stream->outcnt); |
10130 | + |
10131 | + BUG_ON(index == stream->outcnt); |
10132 | + stream->out_curr = flex_array_get(out, index); |
10133 | + } |
10134 | fa_free(stream->out); |
10135 | } |
10136 | |
10137 | diff --git a/net/sunrpc/xprtrdma/backchannel.c b/net/sunrpc/xprtrdma/backchannel.c |
10138 | index e5b367a3e517..88fde80b9347 100644 |
10139 | --- a/net/sunrpc/xprtrdma/backchannel.c |
10140 | +++ b/net/sunrpc/xprtrdma/backchannel.c |
10141 | @@ -193,14 +193,15 @@ static int rpcrdma_bc_marshal_reply(struct rpc_rqst *rqst) |
10142 | */ |
10143 | int xprt_rdma_bc_send_reply(struct rpc_rqst *rqst) |
10144 | { |
10145 | - struct rpcrdma_xprt *r_xprt = rpcx_to_rdmax(rqst->rq_xprt); |
10146 | + struct rpc_xprt *xprt = rqst->rq_xprt; |
10147 | + struct rpcrdma_xprt *r_xprt = rpcx_to_rdmax(xprt); |
10148 | struct rpcrdma_req *req = rpcr_to_rdmar(rqst); |
10149 | int rc; |
10150 | |
10151 | - if (!xprt_connected(rqst->rq_xprt)) |
10152 | - goto drop_connection; |
10153 | + if (!xprt_connected(xprt)) |
10154 | + return -ENOTCONN; |
10155 | |
10156 | - if (!xprt_request_get_cong(rqst->rq_xprt, rqst)) |
10157 | + if (!xprt_request_get_cong(xprt, rqst)) |
10158 | return -EBADSLT; |
10159 | |
10160 | rc = rpcrdma_bc_marshal_reply(rqst); |
10161 | @@ -216,7 +217,7 @@ failed_marshal: |
10162 | if (rc != -ENOTCONN) |
10163 | return rc; |
10164 | drop_connection: |
10165 | - xprt_disconnect_done(rqst->rq_xprt); |
10166 | + xprt_rdma_close(xprt); |
10167 | return -ENOTCONN; |
10168 | } |
10169 | |
10170 | @@ -339,7 +340,7 @@ void rpcrdma_bc_receive_call(struct rpcrdma_xprt *r_xprt, |
10171 | |
10172 | out_overflow: |
10173 | pr_warn("RPC/RDMA backchannel overflow\n"); |
10174 | - xprt_disconnect_done(xprt); |
10175 | + xprt_force_disconnect(xprt); |
10176 | /* This receive buffer gets reposted automatically |
10177 | * when the connection is re-established. |
10178 | */ |
10179 | diff --git a/net/sunrpc/xprtrdma/svc_rdma_backchannel.c b/net/sunrpc/xprtrdma/svc_rdma_backchannel.c |
10180 | index f3c147d70286..b908f2ca08fd 100644 |
10181 | --- a/net/sunrpc/xprtrdma/svc_rdma_backchannel.c |
10182 | +++ b/net/sunrpc/xprtrdma/svc_rdma_backchannel.c |
10183 | @@ -200,11 +200,10 @@ rpcrdma_bc_send_request(struct svcxprt_rdma *rdma, struct rpc_rqst *rqst) |
10184 | svc_rdma_send_ctxt_put(rdma, ctxt); |
10185 | goto drop_connection; |
10186 | } |
10187 | - return rc; |
10188 | + return 0; |
10189 | |
10190 | drop_connection: |
10191 | dprintk("svcrdma: failed to send bc call\n"); |
10192 | - xprt_disconnect_done(xprt); |
10193 | return -ENOTCONN; |
10194 | } |
10195 | |
10196 | @@ -225,8 +224,11 @@ xprt_rdma_bc_send_request(struct rpc_rqst *rqst) |
10197 | |
10198 | ret = -ENOTCONN; |
10199 | rdma = container_of(sxprt, struct svcxprt_rdma, sc_xprt); |
10200 | - if (!test_bit(XPT_DEAD, &sxprt->xpt_flags)) |
10201 | + if (!test_bit(XPT_DEAD, &sxprt->xpt_flags)) { |
10202 | ret = rpcrdma_bc_send_request(rdma, rqst); |
10203 | + if (ret == -ENOTCONN) |
10204 | + svc_close_xprt(sxprt); |
10205 | + } |
10206 | |
10207 | mutex_unlock(&sxprt->xpt_mutex); |
10208 | |
10209 | diff --git a/net/sunrpc/xprtrdma/transport.c b/net/sunrpc/xprtrdma/transport.c |
10210 | index ae2a83828953..e7683d3b1e6c 100644 |
10211 | --- a/net/sunrpc/xprtrdma/transport.c |
10212 | +++ b/net/sunrpc/xprtrdma/transport.c |
10213 | @@ -437,8 +437,7 @@ out1: |
10214 | * Caller holds @xprt's send lock to prevent activity on this |
10215 | * transport while the connection is torn down. |
10216 | */ |
10217 | -static void |
10218 | -xprt_rdma_close(struct rpc_xprt *xprt) |
10219 | +void xprt_rdma_close(struct rpc_xprt *xprt) |
10220 | { |
10221 | struct rpcrdma_xprt *r_xprt = rpcx_to_rdmax(xprt); |
10222 | struct rpcrdma_ep *ep = &r_xprt->rx_ep; |
10223 | @@ -449,13 +448,13 @@ xprt_rdma_close(struct rpc_xprt *xprt) |
10224 | if (test_and_clear_bit(RPCRDMA_IAF_REMOVING, &ia->ri_flags)) { |
10225 | xprt_clear_connected(xprt); |
10226 | rpcrdma_ia_remove(ia); |
10227 | - return; |
10228 | + goto out; |
10229 | } |
10230 | + |
10231 | if (ep->rep_connected == -ENODEV) |
10232 | return; |
10233 | if (ep->rep_connected > 0) |
10234 | xprt->reestablish_timeout = 0; |
10235 | - xprt_disconnect_done(xprt); |
10236 | rpcrdma_ep_disconnect(ep, ia); |
10237 | |
10238 | /* Prepare @xprt for the next connection by reinitializing |
10239 | @@ -463,6 +462,10 @@ xprt_rdma_close(struct rpc_xprt *xprt) |
10240 | */ |
10241 | r_xprt->rx_buf.rb_credits = 1; |
10242 | xprt->cwnd = RPC_CWNDSHIFT; |
10243 | + |
10244 | +out: |
10245 | + ++xprt->connect_cookie; |
10246 | + xprt_disconnect_done(xprt); |
10247 | } |
10248 | |
10249 | /** |
10250 | @@ -713,7 +716,7 @@ xprt_rdma_send_request(struct rpc_rqst *rqst) |
10251 | #endif /* CONFIG_SUNRPC_BACKCHANNEL */ |
10252 | |
10253 | if (!xprt_connected(xprt)) |
10254 | - goto drop_connection; |
10255 | + return -ENOTCONN; |
10256 | |
10257 | if (!xprt_request_get_cong(xprt, rqst)) |
10258 | return -EBADSLT; |
10259 | @@ -745,8 +748,8 @@ failed_marshal: |
10260 | if (rc != -ENOTCONN) |
10261 | return rc; |
10262 | drop_connection: |
10263 | - xprt_disconnect_done(xprt); |
10264 | - return -ENOTCONN; /* implies disconnect */ |
10265 | + xprt_rdma_close(xprt); |
10266 | + return -ENOTCONN; |
10267 | } |
10268 | |
10269 | void xprt_rdma_print_stats(struct rpc_xprt *xprt, struct seq_file *seq) |
10270 | diff --git a/net/sunrpc/xprtrdma/verbs.c b/net/sunrpc/xprtrdma/verbs.c |
10271 | index b9bc7f9f6bb9..919fddec0197 100644 |
10272 | --- a/net/sunrpc/xprtrdma/verbs.c |
10273 | +++ b/net/sunrpc/xprtrdma/verbs.c |
10274 | @@ -316,7 +316,6 @@ rpcrdma_cm_event_handler(struct rdma_cm_id *id, struct rdma_cm_event *event) |
10275 | ep->rep_connected = -EAGAIN; |
10276 | goto disconnected; |
10277 | case RDMA_CM_EVENT_DISCONNECTED: |
10278 | - ++xprt->connect_cookie; |
10279 | ep->rep_connected = -ECONNABORTED; |
10280 | disconnected: |
10281 | xprt_force_disconnect(xprt); |
10282 | diff --git a/net/sunrpc/xprtrdma/xprt_rdma.h b/net/sunrpc/xprtrdma/xprt_rdma.h |
10283 | index a13ccb643ce0..0af75b1405f8 100644 |
10284 | --- a/net/sunrpc/xprtrdma/xprt_rdma.h |
10285 | +++ b/net/sunrpc/xprtrdma/xprt_rdma.h |
10286 | @@ -653,6 +653,7 @@ static inline void rpcrdma_set_xdrlen(struct xdr_buf *xdr, size_t len) |
10287 | extern unsigned int xprt_rdma_max_inline_read; |
10288 | void xprt_rdma_format_addresses(struct rpc_xprt *xprt, struct sockaddr *sap); |
10289 | void xprt_rdma_free_addresses(struct rpc_xprt *xprt); |
10290 | +void xprt_rdma_close(struct rpc_xprt *xprt); |
10291 | void xprt_rdma_print_stats(struct rpc_xprt *xprt, struct seq_file *seq); |
10292 | int xprt_rdma_init(void); |
10293 | void xprt_rdma_cleanup(void); |
10294 | diff --git a/net/tipc/node.c b/net/tipc/node.c |
10295 | index 488019766433..32556f480a60 100644 |
10296 | --- a/net/tipc/node.c |
10297 | +++ b/net/tipc/node.c |
10298 | @@ -624,6 +624,12 @@ static void tipc_node_timeout(struct timer_list *t) |
10299 | |
10300 | __skb_queue_head_init(&xmitq); |
10301 | |
10302 | + /* Initial node interval to value larger (10 seconds), then it will be |
10303 | + * recalculated with link lowest tolerance |
10304 | + */ |
10305 | + tipc_node_read_lock(n); |
10306 | + n->keepalive_intv = 10000; |
10307 | + tipc_node_read_unlock(n); |
10308 | for (bearer_id = 0; remains && (bearer_id < MAX_BEARERS); bearer_id++) { |
10309 | tipc_node_read_lock(n); |
10310 | le = &n->links[bearer_id]; |
10311 | diff --git a/samples/livepatch/livepatch-shadow-fix1.c b/samples/livepatch/livepatch-shadow-fix1.c |
10312 | index 49b13553eaae..e8f1bd6b29b1 100644 |
10313 | --- a/samples/livepatch/livepatch-shadow-fix1.c |
10314 | +++ b/samples/livepatch/livepatch-shadow-fix1.c |
10315 | @@ -89,6 +89,11 @@ struct dummy *livepatch_fix1_dummy_alloc(void) |
10316 | * pointer to handle resource release. |
10317 | */ |
10318 | leak = kzalloc(sizeof(int), GFP_KERNEL); |
10319 | + if (!leak) { |
10320 | + kfree(d); |
10321 | + return NULL; |
10322 | + } |
10323 | + |
10324 | klp_shadow_alloc(d, SV_LEAK, sizeof(leak), GFP_KERNEL, |
10325 | shadow_leak_ctor, leak); |
10326 | |
10327 | diff --git a/samples/livepatch/livepatch-shadow-mod.c b/samples/livepatch/livepatch-shadow-mod.c |
10328 | index 4c54b250332d..4aa8a88d3cd6 100644 |
10329 | --- a/samples/livepatch/livepatch-shadow-mod.c |
10330 | +++ b/samples/livepatch/livepatch-shadow-mod.c |
10331 | @@ -118,6 +118,10 @@ noinline struct dummy *dummy_alloc(void) |
10332 | |
10333 | /* Oops, forgot to save leak! */ |
10334 | leak = kzalloc(sizeof(int), GFP_KERNEL); |
10335 | + if (!leak) { |
10336 | + kfree(d); |
10337 | + return NULL; |
10338 | + } |
10339 | |
10340 | pr_info("%s: dummy @ %p, expires @ %lx\n", |
10341 | __func__, d, d->jiffies_expire); |
10342 | diff --git a/scripts/decode_stacktrace.sh b/scripts/decode_stacktrace.sh |
10343 | index 64220e36ce3b..98a7d63a723e 100755 |
10344 | --- a/scripts/decode_stacktrace.sh |
10345 | +++ b/scripts/decode_stacktrace.sh |
10346 | @@ -78,7 +78,7 @@ parse_symbol() { |
10347 | fi |
10348 | |
10349 | # Strip out the base of the path |
10350 | - code=${code//$basepath/""} |
10351 | + code=${code//^$basepath/""} |
10352 | |
10353 | # In the case of inlines, move everything to same line |
10354 | code=${code//$'\n'/' '} |
10355 | diff --git a/scripts/gdb/linux/proc.py b/scripts/gdb/linux/proc.py |
10356 | index 086d27223c0c..0aebd7565b03 100644 |
10357 | --- a/scripts/gdb/linux/proc.py |
10358 | +++ b/scripts/gdb/linux/proc.py |
10359 | @@ -41,7 +41,7 @@ class LxVersion(gdb.Command): |
10360 | |
10361 | def invoke(self, arg, from_tty): |
10362 | # linux_banner should contain a newline |
10363 | - gdb.write(gdb.parse_and_eval("linux_banner").string()) |
10364 | + gdb.write(gdb.parse_and_eval("(char *)linux_banner").string()) |
10365 | |
10366 | LxVersion() |
10367 | |
10368 | diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c |
10369 | index 5a5b3780456f..5a77efd39b3f 100644 |
10370 | --- a/scripts/mod/modpost.c |
10371 | +++ b/scripts/mod/modpost.c |
10372 | @@ -1204,6 +1204,30 @@ static int secref_whitelist(const struct sectioncheck *mismatch, |
10373 | return 1; |
10374 | } |
10375 | |
10376 | +static inline int is_arm_mapping_symbol(const char *str) |
10377 | +{ |
10378 | + return str[0] == '$' && strchr("axtd", str[1]) |
10379 | + && (str[2] == '\0' || str[2] == '.'); |
10380 | +} |
10381 | + |
10382 | +/* |
10383 | + * If there's no name there, ignore it; likewise, ignore it if it's |
10384 | + * one of the magic symbols emitted used by current ARM tools. |
10385 | + * |
10386 | + * Otherwise if find_symbols_between() returns those symbols, they'll |
10387 | + * fail the whitelist tests and cause lots of false alarms ... fixable |
10388 | + * only by merging __exit and __init sections into __text, bloating |
10389 | + * the kernel (which is especially evil on embedded platforms). |
10390 | + */ |
10391 | +static inline int is_valid_name(struct elf_info *elf, Elf_Sym *sym) |
10392 | +{ |
10393 | + const char *name = elf->strtab + sym->st_name; |
10394 | + |
10395 | + if (!name || !strlen(name)) |
10396 | + return 0; |
10397 | + return !is_arm_mapping_symbol(name); |
10398 | +} |
10399 | + |
10400 | /** |
10401 | * Find symbol based on relocation record info. |
10402 | * In some cases the symbol supplied is a valid symbol so |
10403 | @@ -1229,6 +1253,8 @@ static Elf_Sym *find_elf_symbol(struct elf_info *elf, Elf64_Sword addr, |
10404 | continue; |
10405 | if (ELF_ST_TYPE(sym->st_info) == STT_SECTION) |
10406 | continue; |
10407 | + if (!is_valid_name(elf, sym)) |
10408 | + continue; |
10409 | if (sym->st_value == addr) |
10410 | return sym; |
10411 | /* Find a symbol nearby - addr are maybe negative */ |
10412 | @@ -1247,30 +1273,6 @@ static Elf_Sym *find_elf_symbol(struct elf_info *elf, Elf64_Sword addr, |
10413 | return NULL; |
10414 | } |
10415 | |
10416 | -static inline int is_arm_mapping_symbol(const char *str) |
10417 | -{ |
10418 | - return str[0] == '$' && strchr("axtd", str[1]) |
10419 | - && (str[2] == '\0' || str[2] == '.'); |
10420 | -} |
10421 | - |
10422 | -/* |
10423 | - * If there's no name there, ignore it; likewise, ignore it if it's |
10424 | - * one of the magic symbols emitted used by current ARM tools. |
10425 | - * |
10426 | - * Otherwise if find_symbols_between() returns those symbols, they'll |
10427 | - * fail the whitelist tests and cause lots of false alarms ... fixable |
10428 | - * only by merging __exit and __init sections into __text, bloating |
10429 | - * the kernel (which is especially evil on embedded platforms). |
10430 | - */ |
10431 | -static inline int is_valid_name(struct elf_info *elf, Elf_Sym *sym) |
10432 | -{ |
10433 | - const char *name = elf->strtab + sym->st_name; |
10434 | - |
10435 | - if (!name || !strlen(name)) |
10436 | - return 0; |
10437 | - return !is_arm_mapping_symbol(name); |
10438 | -} |
10439 | - |
10440 | /* |
10441 | * Find symbols before or equal addr and after addr - in the section sec. |
10442 | * If we find two symbols with equal offset prefer one with a valid name. |
10443 | diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c |
10444 | index 81fb4c1631e9..cd720c06b78c 100644 |
10445 | --- a/security/smack/smack_lsm.c |
10446 | +++ b/security/smack/smack_lsm.c |
10447 | @@ -4333,6 +4333,12 @@ static int smack_key_permission(key_ref_t key_ref, |
10448 | int request = 0; |
10449 | int rc; |
10450 | |
10451 | + /* |
10452 | + * Validate requested permissions |
10453 | + */ |
10454 | + if (perm & ~KEY_NEED_ALL) |
10455 | + return -EINVAL; |
10456 | + |
10457 | keyp = key_ref_to_ptr(key_ref); |
10458 | if (keyp == NULL) |
10459 | return -EINVAL; |
10460 | @@ -4356,10 +4362,10 @@ static int smack_key_permission(key_ref_t key_ref, |
10461 | ad.a.u.key_struct.key = keyp->serial; |
10462 | ad.a.u.key_struct.key_desc = keyp->description; |
10463 | #endif |
10464 | - if (perm & KEY_NEED_READ) |
10465 | - request = MAY_READ; |
10466 | + if (perm & (KEY_NEED_READ | KEY_NEED_SEARCH | KEY_NEED_VIEW)) |
10467 | + request |= MAY_READ; |
10468 | if (perm & (KEY_NEED_WRITE | KEY_NEED_LINK | KEY_NEED_SETATTR)) |
10469 | - request = MAY_WRITE; |
10470 | + request |= MAY_WRITE; |
10471 | rc = smk_access(tkp, keyp->security, request, &ad); |
10472 | rc = smk_bu_note("key access", tkp, keyp->security, request, rc); |
10473 | return rc; |
10474 | diff --git a/sound/pci/hda/hda_bind.c b/sound/pci/hda/hda_bind.c |
10475 | index 9174f1b3a987..1ec706ced75c 100644 |
10476 | --- a/sound/pci/hda/hda_bind.c |
10477 | +++ b/sound/pci/hda/hda_bind.c |
10478 | @@ -115,7 +115,8 @@ static int hda_codec_driver_probe(struct device *dev) |
10479 | err = snd_hda_codec_build_controls(codec); |
10480 | if (err < 0) |
10481 | goto error_module; |
10482 | - if (codec->card->registered) { |
10483 | + /* only register after the bus probe finished; otherwise it's racy */ |
10484 | + if (!codec->bus->bus_probing && codec->card->registered) { |
10485 | err = snd_card_register(codec->card); |
10486 | if (err < 0) |
10487 | goto error_module; |
10488 | diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c |
10489 | index 76f03abd15ab..356fda583847 100644 |
10490 | --- a/sound/pci/hda/hda_intel.c |
10491 | +++ b/sound/pci/hda/hda_intel.c |
10492 | @@ -2228,6 +2228,7 @@ static int azx_probe_continue(struct azx *chip) |
10493 | int dev = chip->dev_index; |
10494 | int err; |
10495 | |
10496 | + to_hda_bus(bus)->bus_probing = 1; |
10497 | hda->probe_continued = 1; |
10498 | |
10499 | /* bind with i915 if needed */ |
10500 | @@ -2323,6 +2324,7 @@ i915_power_fail: |
10501 | if (err < 0) |
10502 | hda->init_failed = 1; |
10503 | complete_all(&hda->probe_wait); |
10504 | + to_hda_bus(bus)->bus_probing = 0; |
10505 | return err; |
10506 | } |
10507 | |
10508 | diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c |
10509 | index 0bfd78b7e0ca..c1042df5e346 100644 |
10510 | --- a/sound/pci/hda/patch_realtek.c |
10511 | +++ b/sound/pci/hda/patch_realtek.c |
10512 | @@ -515,6 +515,15 @@ static void alc_auto_init_amp(struct hda_codec *codec, int type) |
10513 | } |
10514 | } |
10515 | |
10516 | +/* get a primary headphone pin if available */ |
10517 | +static hda_nid_t alc_get_hp_pin(struct alc_spec *spec) |
10518 | +{ |
10519 | + if (spec->gen.autocfg.hp_pins[0]) |
10520 | + return spec->gen.autocfg.hp_pins[0]; |
10521 | + if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT) |
10522 | + return spec->gen.autocfg.line_out_pins[0]; |
10523 | + return 0; |
10524 | +} |
10525 | |
10526 | /* |
10527 | * Realtek SSID verification |
10528 | @@ -725,9 +734,7 @@ do_sku: |
10529 | * 15 : 1 --> enable the function "Mute internal speaker |
10530 | * when the external headphone out jack is plugged" |
10531 | */ |
10532 | - if (!spec->gen.autocfg.hp_pins[0] && |
10533 | - !(spec->gen.autocfg.line_out_pins[0] && |
10534 | - spec->gen.autocfg.line_out_type == AUTO_PIN_HP_OUT)) { |
10535 | + if (!alc_get_hp_pin(spec)) { |
10536 | hda_nid_t nid; |
10537 | tmp = (ass >> 11) & 0x3; /* HP to chassis */ |
10538 | nid = ports[tmp]; |
10539 | @@ -2959,7 +2966,7 @@ static void alc282_restore_default_value(struct hda_codec *codec) |
10540 | static void alc282_init(struct hda_codec *codec) |
10541 | { |
10542 | struct alc_spec *spec = codec->spec; |
10543 | - hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0]; |
10544 | + hda_nid_t hp_pin = alc_get_hp_pin(spec); |
10545 | bool hp_pin_sense; |
10546 | int coef78; |
10547 | |
10548 | @@ -2996,7 +3003,7 @@ static void alc282_init(struct hda_codec *codec) |
10549 | static void alc282_shutup(struct hda_codec *codec) |
10550 | { |
10551 | struct alc_spec *spec = codec->spec; |
10552 | - hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0]; |
10553 | + hda_nid_t hp_pin = alc_get_hp_pin(spec); |
10554 | bool hp_pin_sense; |
10555 | int coef78; |
10556 | |
10557 | @@ -3074,14 +3081,9 @@ static void alc283_restore_default_value(struct hda_codec *codec) |
10558 | static void alc283_init(struct hda_codec *codec) |
10559 | { |
10560 | struct alc_spec *spec = codec->spec; |
10561 | - hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0]; |
10562 | + hda_nid_t hp_pin = alc_get_hp_pin(spec); |
10563 | bool hp_pin_sense; |
10564 | |
10565 | - if (!spec->gen.autocfg.hp_outs) { |
10566 | - if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT) |
10567 | - hp_pin = spec->gen.autocfg.line_out_pins[0]; |
10568 | - } |
10569 | - |
10570 | alc283_restore_default_value(codec); |
10571 | |
10572 | if (!hp_pin) |
10573 | @@ -3115,14 +3117,9 @@ static void alc283_init(struct hda_codec *codec) |
10574 | static void alc283_shutup(struct hda_codec *codec) |
10575 | { |
10576 | struct alc_spec *spec = codec->spec; |
10577 | - hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0]; |
10578 | + hda_nid_t hp_pin = alc_get_hp_pin(spec); |
10579 | bool hp_pin_sense; |
10580 | |
10581 | - if (!spec->gen.autocfg.hp_outs) { |
10582 | - if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT) |
10583 | - hp_pin = spec->gen.autocfg.line_out_pins[0]; |
10584 | - } |
10585 | - |
10586 | if (!hp_pin) { |
10587 | alc269_shutup(codec); |
10588 | return; |
10589 | @@ -3156,7 +3153,7 @@ static void alc283_shutup(struct hda_codec *codec) |
10590 | static void alc256_init(struct hda_codec *codec) |
10591 | { |
10592 | struct alc_spec *spec = codec->spec; |
10593 | - hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0]; |
10594 | + hda_nid_t hp_pin = alc_get_hp_pin(spec); |
10595 | bool hp_pin_sense; |
10596 | |
10597 | if (!hp_pin) |
10598 | @@ -3192,7 +3189,7 @@ static void alc256_init(struct hda_codec *codec) |
10599 | static void alc256_shutup(struct hda_codec *codec) |
10600 | { |
10601 | struct alc_spec *spec = codec->spec; |
10602 | - hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0]; |
10603 | + hda_nid_t hp_pin = alc_get_hp_pin(spec); |
10604 | bool hp_pin_sense; |
10605 | |
10606 | if (!hp_pin) { |
10607 | @@ -3228,7 +3225,7 @@ static void alc256_shutup(struct hda_codec *codec) |
10608 | static void alc225_init(struct hda_codec *codec) |
10609 | { |
10610 | struct alc_spec *spec = codec->spec; |
10611 | - hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0]; |
10612 | + hda_nid_t hp_pin = alc_get_hp_pin(spec); |
10613 | bool hp1_pin_sense, hp2_pin_sense; |
10614 | |
10615 | if (!hp_pin) |
10616 | @@ -3271,7 +3268,7 @@ static void alc225_init(struct hda_codec *codec) |
10617 | static void alc225_shutup(struct hda_codec *codec) |
10618 | { |
10619 | struct alc_spec *spec = codec->spec; |
10620 | - hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0]; |
10621 | + hda_nid_t hp_pin = alc_get_hp_pin(spec); |
10622 | bool hp1_pin_sense, hp2_pin_sense; |
10623 | |
10624 | if (!hp_pin) { |
10625 | @@ -3315,7 +3312,7 @@ static void alc225_shutup(struct hda_codec *codec) |
10626 | static void alc_default_init(struct hda_codec *codec) |
10627 | { |
10628 | struct alc_spec *spec = codec->spec; |
10629 | - hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0]; |
10630 | + hda_nid_t hp_pin = alc_get_hp_pin(spec); |
10631 | bool hp_pin_sense; |
10632 | |
10633 | if (!hp_pin) |
10634 | @@ -3344,7 +3341,7 @@ static void alc_default_init(struct hda_codec *codec) |
10635 | static void alc_default_shutup(struct hda_codec *codec) |
10636 | { |
10637 | struct alc_spec *spec = codec->spec; |
10638 | - hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0]; |
10639 | + hda_nid_t hp_pin = alc_get_hp_pin(spec); |
10640 | bool hp_pin_sense; |
10641 | |
10642 | if (!hp_pin) { |
10643 | @@ -3376,7 +3373,7 @@ static void alc_default_shutup(struct hda_codec *codec) |
10644 | static void alc294_hp_init(struct hda_codec *codec) |
10645 | { |
10646 | struct alc_spec *spec = codec->spec; |
10647 | - hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0]; |
10648 | + hda_nid_t hp_pin = alc_get_hp_pin(spec); |
10649 | int i, val; |
10650 | |
10651 | if (!hp_pin) |
10652 | @@ -4780,7 +4777,7 @@ static void alc_update_headset_mode(struct hda_codec *codec) |
10653 | struct alc_spec *spec = codec->spec; |
10654 | |
10655 | hda_nid_t mux_pin = spec->gen.imux_pins[spec->gen.cur_mux[0]]; |
10656 | - hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0]; |
10657 | + hda_nid_t hp_pin = alc_get_hp_pin(spec); |
10658 | |
10659 | int new_headset_mode; |
10660 | |
10661 | @@ -5059,7 +5056,7 @@ static void alc_fixup_tpt470_dock(struct hda_codec *codec, |
10662 | static void alc_shutup_dell_xps13(struct hda_codec *codec) |
10663 | { |
10664 | struct alc_spec *spec = codec->spec; |
10665 | - int hp_pin = spec->gen.autocfg.hp_pins[0]; |
10666 | + int hp_pin = alc_get_hp_pin(spec); |
10667 | |
10668 | /* Prevent pop noises when headphones are plugged in */ |
10669 | snd_hda_codec_write(codec, hp_pin, 0, |
10670 | @@ -5152,7 +5149,7 @@ static void alc271_hp_gate_mic_jack(struct hda_codec *codec, |
10671 | |
10672 | if (action == HDA_FIXUP_ACT_PROBE) { |
10673 | int mic_pin = find_ext_mic_pin(codec); |
10674 | - int hp_pin = spec->gen.autocfg.hp_pins[0]; |
10675 | + int hp_pin = alc_get_hp_pin(spec); |
10676 | |
10677 | if (snd_BUG_ON(!mic_pin || !hp_pin)) |
10678 | return; |
10679 | @@ -5575,6 +5572,7 @@ enum { |
10680 | ALC294_FIXUP_ASUS_MIC, |
10681 | ALC294_FIXUP_ASUS_HEADSET_MIC, |
10682 | ALC294_FIXUP_ASUS_SPK, |
10683 | + ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE, |
10684 | }; |
10685 | |
10686 | static const struct hda_fixup alc269_fixups[] = { |
10687 | @@ -6499,6 +6497,15 @@ static const struct hda_fixup alc269_fixups[] = { |
10688 | .chained = true, |
10689 | .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC |
10690 | }, |
10691 | + [ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE] = { |
10692 | + .type = HDA_FIXUP_PINS, |
10693 | + .v.pins = (const struct hda_pintbl[]) { |
10694 | + { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */ |
10695 | + { } |
10696 | + }, |
10697 | + .chained = true, |
10698 | + .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC |
10699 | + }, |
10700 | }; |
10701 | |
10702 | static const struct snd_pci_quirk alc269_fixup_tbl[] = { |
10703 | @@ -6677,6 +6684,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { |
10704 | SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_HEADSET_MIC), |
10705 | SND_PCI_QUIRK(0x1462, 0xb120, "MSI Cubi MS-B120", ALC283_FIXUP_HEADSET_MIC), |
10706 | SND_PCI_QUIRK(0x1462, 0xb171, "Cubi N 8GL (MS-B171)", ALC283_FIXUP_HEADSET_MIC), |
10707 | + SND_PCI_QUIRK(0x1558, 0x1325, "System76 Darter Pro (darp5)", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), |
10708 | SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC233_FIXUP_LENOVO_MULTI_CODECS), |
10709 | SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE), |
10710 | SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE), |
10711 | diff --git a/sound/soc/fsl/Kconfig b/sound/soc/fsl/Kconfig |
10712 | index 6ec19fb4a934..2e75b5bc5f1d 100644 |
10713 | --- a/sound/soc/fsl/Kconfig |
10714 | +++ b/sound/soc/fsl/Kconfig |
10715 | @@ -221,7 +221,7 @@ config SND_SOC_PHYCORE_AC97 |
10716 | |
10717 | config SND_SOC_EUKREA_TLV320 |
10718 | tristate "Eukrea TLV320" |
10719 | - depends on ARCH_MXC && I2C |
10720 | + depends on ARCH_MXC && !ARM64 && I2C |
10721 | select SND_SOC_TLV320AIC23_I2C |
10722 | select SND_SOC_IMX_AUDMUX |
10723 | select SND_SOC_IMX_SSI |
10724 | diff --git a/sound/soc/intel/atom/sst/sst_loader.c b/sound/soc/intel/atom/sst/sst_loader.c |
10725 | index 27413ebae956..b8c456753f01 100644 |
10726 | --- a/sound/soc/intel/atom/sst/sst_loader.c |
10727 | +++ b/sound/soc/intel/atom/sst/sst_loader.c |
10728 | @@ -354,14 +354,14 @@ static int sst_request_fw(struct intel_sst_drv *sst) |
10729 | const struct firmware *fw; |
10730 | |
10731 | retval = request_firmware(&fw, sst->firmware_name, sst->dev); |
10732 | - if (fw == NULL) { |
10733 | - dev_err(sst->dev, "fw is returning as null\n"); |
10734 | - return -EINVAL; |
10735 | - } |
10736 | if (retval) { |
10737 | dev_err(sst->dev, "request fw failed %d\n", retval); |
10738 | return retval; |
10739 | } |
10740 | + if (fw == NULL) { |
10741 | + dev_err(sst->dev, "fw is returning as null\n"); |
10742 | + return -EINVAL; |
10743 | + } |
10744 | mutex_lock(&sst->sst_lock); |
10745 | retval = sst_cache_and_parse_fw(sst, fw); |
10746 | mutex_unlock(&sst->sst_lock); |
10747 | diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c |
10748 | index 7e93686a430a..d71e01954975 100644 |
10749 | --- a/sound/usb/quirks.c |
10750 | +++ b/sound/usb/quirks.c |
10751 | @@ -1448,6 +1448,7 @@ u64 snd_usb_interface_dsd_format_quirks(struct snd_usb_audio *chip, |
10752 | case 0x20b1: /* XMOS based devices */ |
10753 | case 0x152a: /* Thesycon devices */ |
10754 | case 0x25ce: /* Mytek devices */ |
10755 | + case 0x2ab6: /* T+A devices */ |
10756 | if (fp->dsd_raw) |
10757 | return SNDRV_PCM_FMTBIT_DSD_U32_BE; |
10758 | break; |
10759 | diff --git a/tools/bpf/bpftool/common.c b/tools/bpf/bpftool/common.c |
10760 | index 70fd48d79f61..05d715e6b128 100644 |
10761 | --- a/tools/bpf/bpftool/common.c |
10762 | +++ b/tools/bpf/bpftool/common.c |
10763 | @@ -58,7 +58,7 @@ |
10764 | #define BPF_FS_MAGIC 0xcafe4a11 |
10765 | #endif |
10766 | |
10767 | -void p_err(const char *fmt, ...) |
10768 | +void __printf(1, 2) p_err(const char *fmt, ...) |
10769 | { |
10770 | va_list ap; |
10771 | |
10772 | @@ -76,7 +76,7 @@ void p_err(const char *fmt, ...) |
10773 | va_end(ap); |
10774 | } |
10775 | |
10776 | -void p_info(const char *fmt, ...) |
10777 | +void __printf(1, 2) p_info(const char *fmt, ...) |
10778 | { |
10779 | va_list ap; |
10780 | |
10781 | diff --git a/tools/bpf/bpftool/json_writer.c b/tools/bpf/bpftool/json_writer.c |
10782 | index c6eef76322ae..4e4149421d07 100644 |
10783 | --- a/tools/bpf/bpftool/json_writer.c |
10784 | +++ b/tools/bpf/bpftool/json_writer.c |
10785 | @@ -19,6 +19,7 @@ |
10786 | #include <malloc.h> |
10787 | #include <inttypes.h> |
10788 | #include <stdint.h> |
10789 | +#include <linux/compiler.h> |
10790 | |
10791 | #include "json_writer.h" |
10792 | |
10793 | @@ -156,7 +157,8 @@ void jsonw_name(json_writer_t *self, const char *name) |
10794 | putc(' ', self->out); |
10795 | } |
10796 | |
10797 | -void jsonw_vprintf_enquote(json_writer_t *self, const char *fmt, va_list ap) |
10798 | +void __printf(2, 0) |
10799 | +jsonw_vprintf_enquote(json_writer_t *self, const char *fmt, va_list ap) |
10800 | { |
10801 | jsonw_eor(self); |
10802 | putc('"', self->out); |
10803 | @@ -164,7 +166,7 @@ void jsonw_vprintf_enquote(json_writer_t *self, const char *fmt, va_list ap) |
10804 | putc('"', self->out); |
10805 | } |
10806 | |
10807 | -void jsonw_printf(json_writer_t *self, const char *fmt, ...) |
10808 | +void __printf(2, 3) jsonw_printf(json_writer_t *self, const char *fmt, ...) |
10809 | { |
10810 | va_list ap; |
10811 | |
10812 | diff --git a/tools/bpf/bpftool/map.c b/tools/bpf/bpftool/map.c |
10813 | index 7bf38f0e152e..9988d5c126b6 100644 |
10814 | --- a/tools/bpf/bpftool/map.c |
10815 | +++ b/tools/bpf/bpftool/map.c |
10816 | @@ -383,7 +383,10 @@ static void print_entry_plain(struct bpf_map_info *info, unsigned char *key, |
10817 | printf(single_line ? " " : "\n"); |
10818 | |
10819 | printf("value:%c", break_names ? '\n' : ' '); |
10820 | - fprint_hex(stdout, value, info->value_size, " "); |
10821 | + if (value) |
10822 | + fprint_hex(stdout, value, info->value_size, " "); |
10823 | + else |
10824 | + printf("<no entry>"); |
10825 | |
10826 | printf("\n"); |
10827 | } else { |
10828 | @@ -398,8 +401,11 @@ static void print_entry_plain(struct bpf_map_info *info, unsigned char *key, |
10829 | for (i = 0; i < n; i++) { |
10830 | printf("value (CPU %02d):%c", |
10831 | i, info->value_size > 16 ? '\n' : ' '); |
10832 | - fprint_hex(stdout, value + i * step, |
10833 | - info->value_size, " "); |
10834 | + if (value) |
10835 | + fprint_hex(stdout, value + i * step, |
10836 | + info->value_size, " "); |
10837 | + else |
10838 | + printf("<no entry>"); |
10839 | printf("\n"); |
10840 | } |
10841 | } |
10842 | @@ -731,7 +737,11 @@ static int dump_map_elem(int fd, void *key, void *value, |
10843 | jsonw_string_field(json_wtr, "error", strerror(lookup_errno)); |
10844 | jsonw_end_object(json_wtr); |
10845 | } else { |
10846 | - print_entry_error(map_info, key, strerror(lookup_errno)); |
10847 | + if (errno == ENOENT) |
10848 | + print_entry_plain(map_info, key, NULL); |
10849 | + else |
10850 | + print_entry_error(map_info, key, |
10851 | + strerror(lookup_errno)); |
10852 | } |
10853 | |
10854 | return 0; |
10855 | diff --git a/tools/bpf/bpftool/prog.c b/tools/bpf/bpftool/prog.c |
10856 | index ccee180dfb76..69b01a6158bd 100644 |
10857 | --- a/tools/bpf/bpftool/prog.c |
10858 | +++ b/tools/bpf/bpftool/prog.c |
10859 | @@ -84,7 +84,7 @@ static const char * const attach_type_strings[] = { |
10860 | [__MAX_BPF_ATTACH_TYPE] = NULL, |
10861 | }; |
10862 | |
10863 | -enum bpf_attach_type parse_attach_type(const char *str) |
10864 | +static enum bpf_attach_type parse_attach_type(const char *str) |
10865 | { |
10866 | enum bpf_attach_type type; |
10867 | |
10868 | @@ -713,7 +713,7 @@ struct map_replace { |
10869 | char *name; |
10870 | }; |
10871 | |
10872 | -int map_replace_compar(const void *p1, const void *p2) |
10873 | +static int map_replace_compar(const void *p1, const void *p2) |
10874 | { |
10875 | const struct map_replace *a = p1, *b = p2; |
10876 | |
10877 | diff --git a/tools/bpf/bpftool/xlated_dumper.c b/tools/bpf/bpftool/xlated_dumper.c |
10878 | index 3284759df98a..98083e4dc0f9 100644 |
10879 | --- a/tools/bpf/bpftool/xlated_dumper.c |
10880 | +++ b/tools/bpf/bpftool/xlated_dumper.c |
10881 | @@ -114,7 +114,7 @@ struct kernel_sym *kernel_syms_search(struct dump_data *dd, |
10882 | sizeof(*dd->sym_mapping), kernel_syms_cmp) : NULL; |
10883 | } |
10884 | |
10885 | -static void print_insn(void *private_data, const char *fmt, ...) |
10886 | +static void __printf(2, 3) print_insn(void *private_data, const char *fmt, ...) |
10887 | { |
10888 | va_list args; |
10889 | |
10890 | @@ -123,7 +123,7 @@ static void print_insn(void *private_data, const char *fmt, ...) |
10891 | va_end(args); |
10892 | } |
10893 | |
10894 | -static void |
10895 | +static void __printf(2, 3) |
10896 | print_insn_for_graph(void *private_data, const char *fmt, ...) |
10897 | { |
10898 | char buf[64], *p; |
10899 | @@ -154,7 +154,8 @@ print_insn_for_graph(void *private_data, const char *fmt, ...) |
10900 | printf("%s", buf); |
10901 | } |
10902 | |
10903 | -static void print_insn_json(void *private_data, const char *fmt, ...) |
10904 | +static void __printf(2, 3) |
10905 | +print_insn_json(void *private_data, const char *fmt, ...) |
10906 | { |
10907 | unsigned int l = strlen(fmt); |
10908 | char chomped_fmt[l]; |
10909 | diff --git a/tools/build/Makefile.feature b/tools/build/Makefile.feature |
10910 | index d74bb9414d7c..81dda411e9d3 100644 |
10911 | --- a/tools/build/Makefile.feature |
10912 | +++ b/tools/build/Makefile.feature |
10913 | @@ -80,8 +80,8 @@ FEATURE_TESTS_EXTRA := \ |
10914 | cplus-demangle \ |
10915 | hello \ |
10916 | libbabeltrace \ |
10917 | - liberty \ |
10918 | - liberty-z \ |
10919 | + libbfd-liberty \ |
10920 | + libbfd-liberty-z \ |
10921 | libunwind-debug-frame \ |
10922 | libunwind-debug-frame-arm \ |
10923 | libunwind-debug-frame-aarch64 \ |
10924 | diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile |
10925 | index 304b984f11b9..912b82d4b70a 100644 |
10926 | --- a/tools/build/feature/Makefile |
10927 | +++ b/tools/build/feature/Makefile |
10928 | @@ -16,8 +16,8 @@ FILES= \ |
10929 | test-libbfd.bin \ |
10930 | test-disassembler-four-args.bin \ |
10931 | test-reallocarray.bin \ |
10932 | - test-liberty.bin \ |
10933 | - test-liberty-z.bin \ |
10934 | + test-libbfd-liberty.bin \ |
10935 | + test-libbfd-liberty-z.bin \ |
10936 | test-cplus-demangle.bin \ |
10937 | test-libelf.bin \ |
10938 | test-libelf-getphdrnum.bin \ |
10939 | @@ -204,7 +204,7 @@ $(OUTPUT)test-libpython-version.bin: |
10940 | $(BUILD) |
10941 | |
10942 | $(OUTPUT)test-libbfd.bin: |
10943 | - $(BUILD) -DPACKAGE='"perf"' -lbfd -lz -liberty -ldl |
10944 | + $(BUILD) -DPACKAGE='"perf"' -lbfd -ldl |
10945 | |
10946 | $(OUTPUT)test-disassembler-four-args.bin: |
10947 | $(BUILD) -DPACKAGE='"perf"' -lbfd -lopcodes |
10948 | @@ -212,10 +212,10 @@ $(OUTPUT)test-disassembler-four-args.bin: |
10949 | $(OUTPUT)test-reallocarray.bin: |
10950 | $(BUILD) |
10951 | |
10952 | -$(OUTPUT)test-liberty.bin: |
10953 | +$(OUTPUT)test-libbfd-liberty.bin: |
10954 | $(CC) $(CFLAGS) -Wall -Werror -o $@ test-libbfd.c -DPACKAGE='"perf"' $(LDFLAGS) -lbfd -ldl -liberty |
10955 | |
10956 | -$(OUTPUT)test-liberty-z.bin: |
10957 | +$(OUTPUT)test-libbfd-liberty-z.bin: |
10958 | $(CC) $(CFLAGS) -Wall -Werror -o $@ test-libbfd.c -DPACKAGE='"perf"' $(LDFLAGS) -lbfd -ldl -liberty -lz |
10959 | |
10960 | $(OUTPUT)test-cplus-demangle.bin: |
10961 | diff --git a/tools/hv/hv_kvp_daemon.c b/tools/hv/hv_kvp_daemon.c |
10962 | index bbb2a8ef367c..d7e06fe0270e 100644 |
10963 | --- a/tools/hv/hv_kvp_daemon.c |
10964 | +++ b/tools/hv/hv_kvp_daemon.c |
10965 | @@ -1178,6 +1178,7 @@ static int kvp_set_ip_info(char *if_name, struct hv_kvp_ipaddr_value *new_val) |
10966 | FILE *file; |
10967 | char cmd[PATH_MAX]; |
10968 | char *mac_addr; |
10969 | + int str_len; |
10970 | |
10971 | /* |
10972 | * Set the configuration for the specified interface with |
10973 | @@ -1301,8 +1302,18 @@ static int kvp_set_ip_info(char *if_name, struct hv_kvp_ipaddr_value *new_val) |
10974 | * invoke the external script to do its magic. |
10975 | */ |
10976 | |
10977 | - snprintf(cmd, sizeof(cmd), KVP_SCRIPTS_PATH "%s %s", |
10978 | - "hv_set_ifconfig", if_file); |
10979 | + str_len = snprintf(cmd, sizeof(cmd), KVP_SCRIPTS_PATH "%s %s", |
10980 | + "hv_set_ifconfig", if_file); |
10981 | + /* |
10982 | + * This is a little overcautious, but it's necessary to suppress some |
10983 | + * false warnings from gcc 8.0.1. |
10984 | + */ |
10985 | + if (str_len <= 0 || (unsigned int)str_len >= sizeof(cmd)) { |
10986 | + syslog(LOG_ERR, "Cmd '%s' (len=%d) may be too long", |
10987 | + cmd, str_len); |
10988 | + return HV_E_FAIL; |
10989 | + } |
10990 | + |
10991 | if (system(cmd)) { |
10992 | syslog(LOG_ERR, "Failed to execute cmd '%s'; error: %d %s", |
10993 | cmd, errno, strerror(errno)); |
10994 | diff --git a/tools/lib/bpf/bpf.c b/tools/lib/bpf/bpf.c |
10995 | index 03f9bcc4ef50..961e1b9fc592 100644 |
10996 | --- a/tools/lib/bpf/bpf.c |
10997 | +++ b/tools/lib/bpf/bpf.c |
10998 | @@ -69,6 +69,7 @@ int bpf_create_map_xattr(const struct bpf_create_map_attr *create_attr) |
10999 | { |
11000 | __u32 name_len = create_attr->name ? strlen(create_attr->name) : 0; |
11001 | union bpf_attr attr; |
11002 | + int ret; |
11003 | |
11004 | memset(&attr, '\0', sizeof(attr)); |
11005 | |
11006 | @@ -86,7 +87,15 @@ int bpf_create_map_xattr(const struct bpf_create_map_attr *create_attr) |
11007 | attr.map_ifindex = create_attr->map_ifindex; |
11008 | attr.inner_map_fd = create_attr->inner_map_fd; |
11009 | |
11010 | - return sys_bpf(BPF_MAP_CREATE, &attr, sizeof(attr)); |
11011 | + ret = sys_bpf(BPF_MAP_CREATE, &attr, sizeof(attr)); |
11012 | + if (ret < 0 && errno == EINVAL && create_attr->name) { |
11013 | + /* Retry the same syscall, but without the name. |
11014 | + * Pre v4.14 kernels don't support map names. |
11015 | + */ |
11016 | + memset(attr.map_name, 0, sizeof(attr.map_name)); |
11017 | + return sys_bpf(BPF_MAP_CREATE, &attr, sizeof(attr)); |
11018 | + } |
11019 | + return ret; |
11020 | } |
11021 | |
11022 | int bpf_create_map_node(enum bpf_map_type map_type, const char *name, |
11023 | diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config |
11024 | index acbb657f7ce2..a0f366c7a318 100644 |
11025 | --- a/tools/perf/Makefile.config |
11026 | +++ b/tools/perf/Makefile.config |
11027 | @@ -693,18 +693,20 @@ endif |
11028 | |
11029 | ifeq ($(feature-libbfd), 1) |
11030 | EXTLIBS += -lbfd |
11031 | +else |
11032 | + # we are on a system that requires -liberty and (maybe) -lz |
11033 | + # to link against -lbfd; test each case individually here |
11034 | |
11035 | # call all detections now so we get correct |
11036 | # status in VF output |
11037 | - $(call feature_check,liberty) |
11038 | - $(call feature_check,liberty-z) |
11039 | - $(call feature_check,cplus-demangle) |
11040 | + $(call feature_check,libbfd-liberty) |
11041 | + $(call feature_check,libbfd-liberty-z) |
11042 | |
11043 | - ifeq ($(feature-liberty), 1) |
11044 | - EXTLIBS += -liberty |
11045 | + ifeq ($(feature-libbfd-liberty), 1) |
11046 | + EXTLIBS += -lbfd -liberty |
11047 | else |
11048 | - ifeq ($(feature-liberty-z), 1) |
11049 | - EXTLIBS += -liberty -lz |
11050 | + ifeq ($(feature-libbfd-liberty-z), 1) |
11051 | + EXTLIBS += -lbfd -liberty -lz |
11052 | endif |
11053 | endif |
11054 | endif |
11055 | @@ -714,24 +716,24 @@ ifdef NO_DEMANGLE |
11056 | else |
11057 | ifdef HAVE_CPLUS_DEMANGLE_SUPPORT |
11058 | EXTLIBS += -liberty |
11059 | - CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT |
11060 | else |
11061 | - ifneq ($(feature-libbfd), 1) |
11062 | - ifneq ($(feature-liberty), 1) |
11063 | - ifneq ($(feature-liberty-z), 1) |
11064 | - # we dont have neither HAVE_CPLUS_DEMANGLE_SUPPORT |
11065 | - # or any of 'bfd iberty z' trinity |
11066 | - ifeq ($(feature-cplus-demangle), 1) |
11067 | - EXTLIBS += -liberty |
11068 | - CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT |
11069 | - else |
11070 | - msg := $(warning No bfd.h/libbfd found, please install binutils-dev[el]/zlib-static/libiberty-dev to gain symbol demangling) |
11071 | - CFLAGS += -DNO_DEMANGLE |
11072 | - endif |
11073 | - endif |
11074 | + ifeq ($(filter -liberty,$(EXTLIBS)),) |
11075 | + $(call feature_check,cplus-demangle) |
11076 | + |
11077 | + # we dont have neither HAVE_CPLUS_DEMANGLE_SUPPORT |
11078 | + # or any of 'bfd iberty z' trinity |
11079 | + ifeq ($(feature-cplus-demangle), 1) |
11080 | + EXTLIBS += -liberty |
11081 | + else |
11082 | + msg := $(warning No bfd.h/libbfd found, please install binutils-dev[el]/zlib-static/libiberty-dev to gain symbol demangling) |
11083 | + CFLAGS += -DNO_DEMANGLE |
11084 | endif |
11085 | endif |
11086 | endif |
11087 | + |
11088 | + ifneq ($(filter -liberty,$(EXTLIBS)),) |
11089 | + CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT |
11090 | + endif |
11091 | endif |
11092 | |
11093 | ifneq ($(filter -lbfd,$(EXTLIBS)),) |
11094 | diff --git a/tools/perf/arch/x86/util/kvm-stat.c b/tools/perf/arch/x86/util/kvm-stat.c |
11095 | index b32409a0e546..081353d7b095 100644 |
11096 | --- a/tools/perf/arch/x86/util/kvm-stat.c |
11097 | +++ b/tools/perf/arch/x86/util/kvm-stat.c |
11098 | @@ -156,7 +156,7 @@ int cpu_isa_init(struct perf_kvm_stat *kvm, const char *cpuid) |
11099 | if (strstr(cpuid, "Intel")) { |
11100 | kvm->exit_reasons = vmx_exit_reasons; |
11101 | kvm->exit_reasons_isa = "VMX"; |
11102 | - } else if (strstr(cpuid, "AMD")) { |
11103 | + } else if (strstr(cpuid, "AMD") || strstr(cpuid, "Hygon")) { |
11104 | kvm->exit_reasons = svm_exit_reasons; |
11105 | kvm->exit_reasons_isa = "SVM"; |
11106 | } else |
11107 | diff --git a/tools/perf/tests/attr.py b/tools/perf/tests/attr.py |
11108 | index ff9b60b99f52..44090a9a19f3 100644 |
11109 | --- a/tools/perf/tests/attr.py |
11110 | +++ b/tools/perf/tests/attr.py |
11111 | @@ -116,7 +116,7 @@ class Event(dict): |
11112 | if not self.has_key(t) or not other.has_key(t): |
11113 | continue |
11114 | if not data_equal(self[t], other[t]): |
11115 | - log.warning("expected %s=%s, got %s" % (t, self[t], other[t])) |
11116 | + log.warning("expected %s=%s, got %s" % (t, self[t], other[t])) |
11117 | |
11118 | # Test file description needs to have following sections: |
11119 | # [config] |
11120 | diff --git a/tools/perf/tests/evsel-tp-sched.c b/tools/perf/tests/evsel-tp-sched.c |
11121 | index 5f8501c68da4..5cbba70bcdd0 100644 |
11122 | --- a/tools/perf/tests/evsel-tp-sched.c |
11123 | +++ b/tools/perf/tests/evsel-tp-sched.c |
11124 | @@ -17,7 +17,7 @@ static int perf_evsel__test_field(struct perf_evsel *evsel, const char *name, |
11125 | return -1; |
11126 | } |
11127 | |
11128 | - is_signed = !!(field->flags | TEP_FIELD_IS_SIGNED); |
11129 | + is_signed = !!(field->flags & TEP_FIELD_IS_SIGNED); |
11130 | if (should_be_signed && !is_signed) { |
11131 | pr_debug("%s: \"%s\" signedness(%d) is wrong, should be %d\n", |
11132 | evsel->name, name, is_signed, should_be_signed); |
11133 | diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c |
11134 | index bbed90e5d9bb..cee717a3794f 100644 |
11135 | --- a/tools/perf/util/dso.c |
11136 | +++ b/tools/perf/util/dso.c |
11137 | @@ -295,7 +295,7 @@ static int decompress_kmodule(struct dso *dso, const char *name, |
11138 | unlink(tmpbuf); |
11139 | |
11140 | if (pathname && (fd >= 0)) |
11141 | - strncpy(pathname, tmpbuf, len); |
11142 | + strlcpy(pathname, tmpbuf, len); |
11143 | |
11144 | return fd; |
11145 | } |
11146 | diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c |
11147 | index 4fd45be95a43..05f40bb51a88 100644 |
11148 | --- a/tools/perf/util/header.c |
11149 | +++ b/tools/perf/util/header.c |
11150 | @@ -2659,6 +2659,7 @@ int perf_header__fprintf_info(struct perf_session *session, FILE *fp, bool full) |
11151 | struct perf_header *header = &session->header; |
11152 | int fd = perf_data__fd(session->data); |
11153 | struct stat st; |
11154 | + time_t stctime; |
11155 | int ret, bit; |
11156 | |
11157 | hd.fp = fp; |
11158 | @@ -2668,7 +2669,8 @@ int perf_header__fprintf_info(struct perf_session *session, FILE *fp, bool full) |
11159 | if (ret == -1) |
11160 | return -1; |
11161 | |
11162 | - fprintf(fp, "# captured on : %s", ctime(&st.st_ctime)); |
11163 | + stctime = st.st_ctime; |
11164 | + fprintf(fp, "# captured on : %s", ctime(&stctime)); |
11165 | |
11166 | fprintf(fp, "# header version : %u\n", header->version); |
11167 | fprintf(fp, "# data offset : %" PRIu64 "\n", header->data_offset); |
11168 | @@ -3544,7 +3546,7 @@ perf_event__synthesize_event_update_unit(struct perf_tool *tool, |
11169 | if (ev == NULL) |
11170 | return -ENOMEM; |
11171 | |
11172 | - strncpy(ev->data, evsel->unit, size); |
11173 | + strlcpy(ev->data, evsel->unit, size + 1); |
11174 | err = process(tool, (union perf_event *)ev, NULL, NULL); |
11175 | free(ev); |
11176 | return err; |
11177 | diff --git a/tools/perf/util/probe-file.c b/tools/perf/util/probe-file.c |
11178 | index aac7817d9e14..0b1195cad0e5 100644 |
11179 | --- a/tools/perf/util/probe-file.c |
11180 | +++ b/tools/perf/util/probe-file.c |
11181 | @@ -424,7 +424,7 @@ static int probe_cache__open(struct probe_cache *pcache, const char *target, |
11182 | |
11183 | if (target && build_id_cache__cached(target)) { |
11184 | /* This is a cached buildid */ |
11185 | - strncpy(sbuildid, target, SBUILD_ID_SIZE); |
11186 | + strlcpy(sbuildid, target, SBUILD_ID_SIZE); |
11187 | dir_name = build_id_cache__linkname(sbuildid, NULL, 0); |
11188 | goto found; |
11189 | } |
11190 | diff --git a/tools/perf/util/python.c b/tools/perf/util/python.c |
11191 | index 50150dfc0cdf..4dd8fd05a260 100644 |
11192 | --- a/tools/perf/util/python.c |
11193 | +++ b/tools/perf/util/python.c |
11194 | @@ -939,7 +939,8 @@ static PyObject *pyrf_evlist__get_pollfd(struct pyrf_evlist *pevlist, |
11195 | |
11196 | file = PyFile_FromFile(fp, "perf", "r", NULL); |
11197 | #else |
11198 | - file = PyFile_FromFd(evlist->pollfd.entries[i].fd, "perf", "r", -1, NULL, NULL, NULL, 1); |
11199 | + file = PyFile_FromFd(evlist->pollfd.entries[i].fd, "perf", "r", -1, |
11200 | + NULL, NULL, NULL, 0); |
11201 | #endif |
11202 | if (file == NULL) |
11203 | goto free_list; |
11204 | diff --git a/tools/perf/util/s390-cpumsf.c b/tools/perf/util/s390-cpumsf.c |
11205 | index a2eeebbfb25f..68b2570304ec 100644 |
11206 | --- a/tools/perf/util/s390-cpumsf.c |
11207 | +++ b/tools/perf/util/s390-cpumsf.c |
11208 | @@ -506,7 +506,7 @@ static int s390_cpumsf_samples(struct s390_cpumsf_queue *sfq, u64 *ts) |
11209 | aux_ts = get_trailer_time(buf); |
11210 | if (!aux_ts) { |
11211 | pr_err("[%#08" PRIx64 "] Invalid AUX trailer entry TOD clock base\n", |
11212 | - sfq->buffer->data_offset); |
11213 | + (s64)sfq->buffer->data_offset); |
11214 | aux_ts = ~0ULL; |
11215 | goto out; |
11216 | } |
11217 | diff --git a/tools/perf/util/stat-display.c b/tools/perf/util/stat-display.c |
11218 | index e7b4c44ebb62..665ee374fc01 100644 |
11219 | --- a/tools/perf/util/stat-display.c |
11220 | +++ b/tools/perf/util/stat-display.c |
11221 | @@ -59,6 +59,15 @@ static void print_noise(struct perf_stat_config *config, |
11222 | print_noise_pct(config, stddev_stats(&ps->res_stats[0]), avg); |
11223 | } |
11224 | |
11225 | +static void print_cgroup(struct perf_stat_config *config, struct perf_evsel *evsel) |
11226 | +{ |
11227 | + if (nr_cgroups) { |
11228 | + const char *cgrp_name = evsel->cgrp ? evsel->cgrp->name : ""; |
11229 | + fprintf(config->output, "%s%s", config->csv_sep, cgrp_name); |
11230 | + } |
11231 | +} |
11232 | + |
11233 | + |
11234 | static void aggr_printout(struct perf_stat_config *config, |
11235 | struct perf_evsel *evsel, int id, int nr) |
11236 | { |
11237 | @@ -336,8 +345,7 @@ static void abs_printout(struct perf_stat_config *config, |
11238 | |
11239 | fprintf(output, "%-*s", config->csv_output ? 0 : 25, perf_evsel__name(evsel)); |
11240 | |
11241 | - if (evsel->cgrp) |
11242 | - fprintf(output, "%s%s", config->csv_sep, evsel->cgrp->name); |
11243 | + print_cgroup(config, evsel); |
11244 | } |
11245 | |
11246 | static bool is_mixed_hw_group(struct perf_evsel *counter) |
11247 | @@ -431,9 +439,7 @@ static void printout(struct perf_stat_config *config, int id, int nr, |
11248 | config->csv_output ? 0 : -25, |
11249 | perf_evsel__name(counter)); |
11250 | |
11251 | - if (counter->cgrp) |
11252 | - fprintf(config->output, "%s%s", |
11253 | - config->csv_sep, counter->cgrp->name); |
11254 | + print_cgroup(config, counter); |
11255 | |
11256 | if (!config->csv_output) |
11257 | pm(config, &os, NULL, NULL, "", 0); |
11258 | diff --git a/tools/power/x86/intel_pstate_tracer/intel_pstate_tracer.py b/tools/power/x86/intel_pstate_tracer/intel_pstate_tracer.py |
11259 | index 84e2b648e622..2fa3c5757bcb 100755 |
11260 | --- a/tools/power/x86/intel_pstate_tracer/intel_pstate_tracer.py |
11261 | +++ b/tools/power/x86/intel_pstate_tracer/intel_pstate_tracer.py |
11262 | @@ -585,9 +585,9 @@ current_max_cpu = 0 |
11263 | |
11264 | read_trace_data(filename) |
11265 | |
11266 | -clear_trace_file() |
11267 | -# Free the memory |
11268 | if interval: |
11269 | + clear_trace_file() |
11270 | + # Free the memory |
11271 | free_trace_buffer() |
11272 | |
11273 | if graph_data_present == False: |
11274 | diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile |
11275 | index f0017c831e57..a43a07a09a98 100644 |
11276 | --- a/tools/testing/selftests/Makefile |
11277 | +++ b/tools/testing/selftests/Makefile |
11278 | @@ -6,6 +6,7 @@ TARGETS += capabilities |
11279 | TARGETS += cgroup |
11280 | TARGETS += cpufreq |
11281 | TARGETS += cpu-hotplug |
11282 | +TARGETS += drivers/dma-buf |
11283 | TARGETS += efivarfs |
11284 | TARGETS += exec |
11285 | TARGETS += filesystems |
11286 | diff --git a/tools/testing/selftests/bpf/test_progs.c b/tools/testing/selftests/bpf/test_progs.c |
11287 | index 2d3c04f45530..6ac7232b0fde 100644 |
11288 | --- a/tools/testing/selftests/bpf/test_progs.c |
11289 | +++ b/tools/testing/selftests/bpf/test_progs.c |
11290 | @@ -51,10 +51,10 @@ static struct { |
11291 | struct iphdr iph; |
11292 | struct tcphdr tcp; |
11293 | } __packed pkt_v4 = { |
11294 | - .eth.h_proto = bpf_htons(ETH_P_IP), |
11295 | + .eth.h_proto = __bpf_constant_htons(ETH_P_IP), |
11296 | .iph.ihl = 5, |
11297 | .iph.protocol = 6, |
11298 | - .iph.tot_len = bpf_htons(MAGIC_BYTES), |
11299 | + .iph.tot_len = __bpf_constant_htons(MAGIC_BYTES), |
11300 | .tcp.urg_ptr = 123, |
11301 | }; |
11302 | |
11303 | @@ -64,9 +64,9 @@ static struct { |
11304 | struct ipv6hdr iph; |
11305 | struct tcphdr tcp; |
11306 | } __packed pkt_v6 = { |
11307 | - .eth.h_proto = bpf_htons(ETH_P_IPV6), |
11308 | + .eth.h_proto = __bpf_constant_htons(ETH_P_IPV6), |
11309 | .iph.nexthdr = 6, |
11310 | - .iph.payload_len = bpf_htons(MAGIC_BYTES), |
11311 | + .iph.payload_len = __bpf_constant_htons(MAGIC_BYTES), |
11312 | .tcp.urg_ptr = 123, |
11313 | }; |
11314 | |
11315 | diff --git a/tools/testing/selftests/drivers/dma-buf/Makefile b/tools/testing/selftests/drivers/dma-buf/Makefile |
11316 | index 4154c3d7aa58..f22c3f7cf612 100644 |
11317 | --- a/tools/testing/selftests/drivers/dma-buf/Makefile |
11318 | +++ b/tools/testing/selftests/drivers/dma-buf/Makefile |
11319 | @@ -2,4 +2,6 @@ CFLAGS += -I../../../../../usr/include/ |
11320 | |
11321 | TEST_GEN_PROGS := udmabuf |
11322 | |
11323 | +top_srcdir ?=../../../../.. |
11324 | + |
11325 | include ../../lib.mk |
11326 | diff --git a/tools/testing/selftests/drivers/dma-buf/udmabuf.c b/tools/testing/selftests/drivers/dma-buf/udmabuf.c |
11327 | index 376b1d6730bd..4de902ea14d8 100644 |
11328 | --- a/tools/testing/selftests/drivers/dma-buf/udmabuf.c |
11329 | +++ b/tools/testing/selftests/drivers/dma-buf/udmabuf.c |
11330 | @@ -4,7 +4,7 @@ |
11331 | #include <unistd.h> |
11332 | #include <string.h> |
11333 | #include <errno.h> |
11334 | -#include <fcntl.h> |
11335 | +#include <linux/fcntl.h> |
11336 | #include <malloc.h> |
11337 | |
11338 | #include <sys/ioctl.h> |
11339 | @@ -33,12 +33,19 @@ int main(int argc, char *argv[]) |
11340 | exit(77); |
11341 | } |
11342 | |
11343 | - memfd = memfd_create("udmabuf-test", MFD_CLOEXEC); |
11344 | + memfd = memfd_create("udmabuf-test", MFD_ALLOW_SEALING); |
11345 | if (memfd < 0) { |
11346 | printf("%s: [skip,no-memfd]\n", TEST_PREFIX); |
11347 | exit(77); |
11348 | } |
11349 | |
11350 | + ret = fcntl(memfd, F_ADD_SEALS, F_SEAL_SHRINK); |
11351 | + if (ret < 0) { |
11352 | + printf("%s: [skip,fcntl-add-seals]\n", TEST_PREFIX); |
11353 | + exit(77); |
11354 | + } |
11355 | + |
11356 | + |
11357 | size = getpagesize() * NUM_PAGES; |
11358 | ret = ftruncate(memfd, size); |
11359 | if (ret == -1) { |
11360 | diff --git a/tools/testing/selftests/kvm/x86_64/evmcs_test.c b/tools/testing/selftests/kvm/x86_64/evmcs_test.c |
11361 | index 92c2cfd1b182..ea3c73e8f4f6 100644 |
11362 | --- a/tools/testing/selftests/kvm/x86_64/evmcs_test.c |
11363 | +++ b/tools/testing/selftests/kvm/x86_64/evmcs_test.c |
11364 | @@ -113,8 +113,8 @@ int main(int argc, char *argv[]) |
11365 | for (stage = 1;; stage++) { |
11366 | _vcpu_run(vm, VCPU_ID); |
11367 | TEST_ASSERT(run->exit_reason == KVM_EXIT_IO, |
11368 | - "Unexpected exit reason: %u (%s),\n", |
11369 | - run->exit_reason, |
11370 | + "Stage %d: unexpected exit reason: %u (%s),\n", |
11371 | + stage, run->exit_reason, |
11372 | exit_reason_str(run->exit_reason)); |
11373 | |
11374 | memset(®s1, 0, sizeof(regs1)); |
11375 | diff --git a/tools/testing/selftests/kvm/x86_64/state_test.c b/tools/testing/selftests/kvm/x86_64/state_test.c |
11376 | index 03da41f0f736..4b3f556265f1 100644 |
11377 | --- a/tools/testing/selftests/kvm/x86_64/state_test.c |
11378 | +++ b/tools/testing/selftests/kvm/x86_64/state_test.c |
11379 | @@ -152,8 +152,8 @@ int main(int argc, char *argv[]) |
11380 | for (stage = 1;; stage++) { |
11381 | _vcpu_run(vm, VCPU_ID); |
11382 | TEST_ASSERT(run->exit_reason == KVM_EXIT_IO, |
11383 | - "Unexpected exit reason: %u (%s),\n", |
11384 | - run->exit_reason, |
11385 | + "Stage %d: unexpected exit reason: %u (%s),\n", |
11386 | + stage, run->exit_reason, |
11387 | exit_reason_str(run->exit_reason)); |
11388 | |
11389 | memset(®s1, 0, sizeof(regs1)); |
11390 | diff --git a/virt/kvm/arm/mmio.c b/virt/kvm/arm/mmio.c |
11391 | index dac7ceb1a677..08443a15e6be 100644 |
11392 | --- a/virt/kvm/arm/mmio.c |
11393 | +++ b/virt/kvm/arm/mmio.c |
11394 | @@ -117,6 +117,12 @@ int kvm_handle_mmio_return(struct kvm_vcpu *vcpu, struct kvm_run *run) |
11395 | vcpu_set_reg(vcpu, vcpu->arch.mmio_decode.rt, data); |
11396 | } |
11397 | |
11398 | + /* |
11399 | + * The MMIO instruction is emulated and should not be re-executed |
11400 | + * in the guest. |
11401 | + */ |
11402 | + kvm_skip_instr(vcpu, kvm_vcpu_trap_il_is32bit(vcpu)); |
11403 | + |
11404 | return 0; |
11405 | } |
11406 | |
11407 | @@ -144,11 +150,6 @@ static int decode_hsr(struct kvm_vcpu *vcpu, bool *is_write, int *len) |
11408 | vcpu->arch.mmio_decode.sign_extend = sign_extend; |
11409 | vcpu->arch.mmio_decode.rt = rt; |
11410 | |
11411 | - /* |
11412 | - * The MMIO instruction is emulated and should not be re-executed |
11413 | - * in the guest. |
11414 | - */ |
11415 | - kvm_skip_instr(vcpu, kvm_vcpu_trap_il_is32bit(vcpu)); |
11416 | return 0; |
11417 | } |
11418 | |
11419 | diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c |
11420 | index 2679e476b6c3..9fa05ed53944 100644 |
11421 | --- a/virt/kvm/kvm_main.c |
11422 | +++ b/virt/kvm/kvm_main.c |
11423 | @@ -1965,7 +1965,8 @@ int kvm_gfn_to_hva_cache_init(struct kvm *kvm, struct gfn_to_hva_cache *ghc, |
11424 | EXPORT_SYMBOL_GPL(kvm_gfn_to_hva_cache_init); |
11425 | |
11426 | int kvm_write_guest_offset_cached(struct kvm *kvm, struct gfn_to_hva_cache *ghc, |
11427 | - void *data, int offset, unsigned long len) |
11428 | + void *data, unsigned int offset, |
11429 | + unsigned long len) |
11430 | { |
11431 | struct kvm_memslots *slots = kvm_memslots(kvm); |
11432 | int r; |
11433 | @@ -2918,8 +2919,10 @@ static int kvm_ioctl_create_device(struct kvm *kvm, |
11434 | if (ops->init) |
11435 | ops->init(dev); |
11436 | |
11437 | + kvm_get_kvm(kvm); |
11438 | ret = anon_inode_getfd(ops->name, &kvm_device_fops, dev, O_RDWR | O_CLOEXEC); |
11439 | if (ret < 0) { |
11440 | + kvm_put_kvm(kvm); |
11441 | mutex_lock(&kvm->lock); |
11442 | list_del(&dev->vm_node); |
11443 | mutex_unlock(&kvm->lock); |
11444 | @@ -2927,7 +2930,6 @@ static int kvm_ioctl_create_device(struct kvm *kvm, |
11445 | return ret; |
11446 | } |
11447 | |
11448 | - kvm_get_kvm(kvm); |
11449 | cd->fd = ret; |
11450 | return 0; |
11451 | } |