Contents of /trunk/kernel-alx/patches-4.9/0188-4.9.89-all-fixes.patch
Parent Directory | Revision Log
Revision 3165 -
(show annotations)
(download)
Wed Aug 8 14:17:22 2018 UTC (6 years, 1 month ago) by niro
File size: 236933 byte(s)
Wed Aug 8 14:17:22 2018 UTC (6 years, 1 month ago) by niro
File size: 236933 byte(s)
-linux-4.9.89
1 | diff --git a/Makefile b/Makefile |
2 | index 1512ebceffda..16dca98900e7 100644 |
3 | --- a/Makefile |
4 | +++ b/Makefile |
5 | @@ -1,6 +1,6 @@ |
6 | VERSION = 4 |
7 | PATCHLEVEL = 9 |
8 | -SUBLEVEL = 88 |
9 | +SUBLEVEL = 89 |
10 | EXTRAVERSION = |
11 | NAME = Roaring Lionus |
12 | |
13 | diff --git a/arch/arm/boot/dts/am335x-pepper.dts b/arch/arm/boot/dts/am335x-pepper.dts |
14 | index 30e2f8770aaf..42b62f54e4b7 100644 |
15 | --- a/arch/arm/boot/dts/am335x-pepper.dts |
16 | +++ b/arch/arm/boot/dts/am335x-pepper.dts |
17 | @@ -139,7 +139,7 @@ |
18 | &audio_codec { |
19 | status = "okay"; |
20 | |
21 | - gpio-reset = <&gpio1 16 GPIO_ACTIVE_LOW>; |
22 | + reset-gpios = <&gpio1 16 GPIO_ACTIVE_LOW>; |
23 | AVDD-supply = <&ldo3_reg>; |
24 | IOVDD-supply = <&ldo3_reg>; |
25 | DRVDD-supply = <&ldo3_reg>; |
26 | diff --git a/arch/arm/boot/dts/bcm283x-rpi-smsc9512.dtsi b/arch/arm/boot/dts/bcm283x-rpi-smsc9512.dtsi |
27 | index 12c981e51134..9a0599f711ff 100644 |
28 | --- a/arch/arm/boot/dts/bcm283x-rpi-smsc9512.dtsi |
29 | +++ b/arch/arm/boot/dts/bcm283x-rpi-smsc9512.dtsi |
30 | @@ -1,6 +1,6 @@ |
31 | / { |
32 | aliases { |
33 | - ethernet = ðernet; |
34 | + ethernet0 = ðernet; |
35 | }; |
36 | }; |
37 | |
38 | diff --git a/arch/arm/boot/dts/bcm283x-rpi-smsc9514.dtsi b/arch/arm/boot/dts/bcm283x-rpi-smsc9514.dtsi |
39 | index 3f0a56ebcf1f..dc7ae776db5f 100644 |
40 | --- a/arch/arm/boot/dts/bcm283x-rpi-smsc9514.dtsi |
41 | +++ b/arch/arm/boot/dts/bcm283x-rpi-smsc9514.dtsi |
42 | @@ -1,6 +1,6 @@ |
43 | / { |
44 | aliases { |
45 | - ethernet = ðernet; |
46 | + ethernet0 = ðernet; |
47 | }; |
48 | }; |
49 | |
50 | diff --git a/arch/arm/boot/dts/exynos4412-trats2.dts b/arch/arm/boot/dts/exynos4412-trats2.dts |
51 | index 41ecd6d465a7..75a60633efff 100644 |
52 | --- a/arch/arm/boot/dts/exynos4412-trats2.dts |
53 | +++ b/arch/arm/boot/dts/exynos4412-trats2.dts |
54 | @@ -408,7 +408,7 @@ |
55 | reg = <0>; |
56 | vdd3-supply = <&lcd_vdd3_reg>; |
57 | vci-supply = <&ldo25_reg>; |
58 | - reset-gpios = <&gpy4 5 GPIO_ACTIVE_HIGH>; |
59 | + reset-gpios = <&gpf2 1 GPIO_ACTIVE_HIGH>; |
60 | power-on-delay= <50>; |
61 | reset-delay = <100>; |
62 | init-delay = <100>; |
63 | diff --git a/arch/arm/boot/dts/moxart-uc7112lx.dts b/arch/arm/boot/dts/moxart-uc7112lx.dts |
64 | index 10d088df0c35..4a962a26482d 100644 |
65 | --- a/arch/arm/boot/dts/moxart-uc7112lx.dts |
66 | +++ b/arch/arm/boot/dts/moxart-uc7112lx.dts |
67 | @@ -6,7 +6,7 @@ |
68 | */ |
69 | |
70 | /dts-v1/; |
71 | -/include/ "moxart.dtsi" |
72 | +#include "moxart.dtsi" |
73 | |
74 | / { |
75 | model = "MOXA UC-7112-LX"; |
76 | diff --git a/arch/arm/boot/dts/moxart.dtsi b/arch/arm/boot/dts/moxart.dtsi |
77 | index 1fd27ed65a01..64f2f44235d0 100644 |
78 | --- a/arch/arm/boot/dts/moxart.dtsi |
79 | +++ b/arch/arm/boot/dts/moxart.dtsi |
80 | @@ -6,6 +6,7 @@ |
81 | */ |
82 | |
83 | /include/ "skeleton.dtsi" |
84 | +#include <dt-bindings/interrupt-controller/irq.h> |
85 | |
86 | / { |
87 | compatible = "moxa,moxart"; |
88 | @@ -36,8 +37,8 @@ |
89 | ranges; |
90 | |
91 | intc: interrupt-controller@98800000 { |
92 | - compatible = "moxa,moxart-ic"; |
93 | - reg = <0x98800000 0x38>; |
94 | + compatible = "moxa,moxart-ic", "faraday,ftintc010"; |
95 | + reg = <0x98800000 0x100>; |
96 | interrupt-controller; |
97 | #interrupt-cells = <2>; |
98 | interrupt-mask = <0x00080000>; |
99 | @@ -59,7 +60,7 @@ |
100 | timer: timer@98400000 { |
101 | compatible = "moxa,moxart-timer"; |
102 | reg = <0x98400000 0x42>; |
103 | - interrupts = <19 1>; |
104 | + interrupts = <19 IRQ_TYPE_EDGE_FALLING>; |
105 | clocks = <&clk_apb>; |
106 | }; |
107 | |
108 | @@ -80,7 +81,7 @@ |
109 | dma: dma@90500000 { |
110 | compatible = "moxa,moxart-dma"; |
111 | reg = <0x90500080 0x40>; |
112 | - interrupts = <24 0>; |
113 | + interrupts = <24 IRQ_TYPE_LEVEL_HIGH>; |
114 | #dma-cells = <1>; |
115 | }; |
116 | |
117 | @@ -93,7 +94,7 @@ |
118 | sdhci: sdhci@98e00000 { |
119 | compatible = "moxa,moxart-sdhci"; |
120 | reg = <0x98e00000 0x5C>; |
121 | - interrupts = <5 0>; |
122 | + interrupts = <5 IRQ_TYPE_LEVEL_HIGH>; |
123 | clocks = <&clk_apb>; |
124 | dmas = <&dma 5>, |
125 | <&dma 5>; |
126 | @@ -120,7 +121,7 @@ |
127 | mac0: mac@90900000 { |
128 | compatible = "moxa,moxart-mac"; |
129 | reg = <0x90900000 0x90>; |
130 | - interrupts = <25 0>; |
131 | + interrupts = <25 IRQ_TYPE_LEVEL_HIGH>; |
132 | phy-handle = <ðphy0>; |
133 | phy-mode = "mii"; |
134 | status = "disabled"; |
135 | @@ -129,7 +130,7 @@ |
136 | mac1: mac@92000000 { |
137 | compatible = "moxa,moxart-mac"; |
138 | reg = <0x92000000 0x90>; |
139 | - interrupts = <27 0>; |
140 | + interrupts = <27 IRQ_TYPE_LEVEL_HIGH>; |
141 | phy-handle = <ðphy1>; |
142 | phy-mode = "mii"; |
143 | status = "disabled"; |
144 | @@ -138,7 +139,7 @@ |
145 | uart0: uart@98200000 { |
146 | compatible = "ns16550a"; |
147 | reg = <0x98200000 0x20>; |
148 | - interrupts = <31 8>; |
149 | + interrupts = <31 IRQ_TYPE_LEVEL_HIGH>; |
150 | reg-shift = <2>; |
151 | reg-io-width = <4>; |
152 | clock-frequency = <14745600>; |
153 | diff --git a/arch/arm/boot/dts/omap3-n900.dts b/arch/arm/boot/dts/omap3-n900.dts |
154 | index 4d448f145ed1..6003b29c0fc0 100644 |
155 | --- a/arch/arm/boot/dts/omap3-n900.dts |
156 | +++ b/arch/arm/boot/dts/omap3-n900.dts |
157 | @@ -510,7 +510,7 @@ |
158 | tlv320aic3x: tlv320aic3x@18 { |
159 | compatible = "ti,tlv320aic3x"; |
160 | reg = <0x18>; |
161 | - gpio-reset = <&gpio2 28 GPIO_ACTIVE_HIGH>; /* 60 */ |
162 | + reset-gpios = <&gpio2 28 GPIO_ACTIVE_LOW>; /* 60 */ |
163 | ai3x-gpio-func = < |
164 | 0 /* AIC3X_GPIO1_FUNC_DISABLED */ |
165 | 5 /* AIC3X_GPIO2_FUNC_DIGITAL_MIC_INPUT */ |
166 | @@ -527,7 +527,7 @@ |
167 | tlv320aic3x_aux: tlv320aic3x@19 { |
168 | compatible = "ti,tlv320aic3x"; |
169 | reg = <0x19>; |
170 | - gpio-reset = <&gpio2 28 GPIO_ACTIVE_HIGH>; /* 60 */ |
171 | + reset-gpios = <&gpio2 28 GPIO_ACTIVE_LOW>; /* 60 */ |
172 | |
173 | AVDD-supply = <&vmmc2>; |
174 | DRVDD-supply = <&vmmc2>; |
175 | diff --git a/arch/arm/boot/dts/r7s72100.dtsi b/arch/arm/boot/dts/r7s72100.dtsi |
176 | index fb9ef9ca120e..959e3edf367b 100644 |
177 | --- a/arch/arm/boot/dts/r7s72100.dtsi |
178 | +++ b/arch/arm/boot/dts/r7s72100.dtsi |
179 | @@ -112,7 +112,7 @@ |
180 | #clock-cells = <1>; |
181 | compatible = "renesas,r7s72100-mstp-clocks", "renesas,cpg-mstp-clocks"; |
182 | reg = <0xfcfe0430 4>; |
183 | - clocks = <&p0_clk>; |
184 | + clocks = <&b_clk>; |
185 | clock-indices = <R7S72100_CLK_ETHER>; |
186 | clock-output-names = "ether"; |
187 | }; |
188 | diff --git a/arch/arm/boot/dts/r8a7790.dtsi b/arch/arm/boot/dts/r8a7790.dtsi |
189 | index b6c6410ca384..262a51205aee 100644 |
190 | --- a/arch/arm/boot/dts/r8a7790.dtsi |
191 | +++ b/arch/arm/boot/dts/r8a7790.dtsi |
192 | @@ -1437,8 +1437,11 @@ |
193 | compatible = "renesas,r8a7790-mstp-clocks", "renesas,cpg-mstp-clocks"; |
194 | reg = <0 0xe6150998 0 4>, <0 0xe61509a8 0 4>; |
195 | clocks = <&p_clk>, |
196 | - <&p_clk>, <&p_clk>, <&p_clk>, <&p_clk>, <&p_clk>, |
197 | - <&p_clk>, <&p_clk>, <&p_clk>, <&p_clk>, <&p_clk>, |
198 | + <&mstp10_clks R8A7790_CLK_SSI_ALL>, <&mstp10_clks R8A7790_CLK_SSI_ALL>, |
199 | + <&mstp10_clks R8A7790_CLK_SSI_ALL>, <&mstp10_clks R8A7790_CLK_SSI_ALL>, |
200 | + <&mstp10_clks R8A7790_CLK_SSI_ALL>, <&mstp10_clks R8A7790_CLK_SSI_ALL>, |
201 | + <&mstp10_clks R8A7790_CLK_SSI_ALL>, <&mstp10_clks R8A7790_CLK_SSI_ALL>, |
202 | + <&mstp10_clks R8A7790_CLK_SSI_ALL>, <&mstp10_clks R8A7790_CLK_SSI_ALL>, |
203 | <&p_clk>, |
204 | <&mstp10_clks R8A7790_CLK_SCU_ALL>, <&mstp10_clks R8A7790_CLK_SCU_ALL>, |
205 | <&mstp10_clks R8A7790_CLK_SCU_ALL>, <&mstp10_clks R8A7790_CLK_SCU_ALL>, |
206 | diff --git a/arch/arm/boot/dts/r8a7791-koelsch.dts b/arch/arm/boot/dts/r8a7791-koelsch.dts |
207 | index f8a7d090fd01..12841e9bab98 100644 |
208 | --- a/arch/arm/boot/dts/r8a7791-koelsch.dts |
209 | +++ b/arch/arm/boot/dts/r8a7791-koelsch.dts |
210 | @@ -279,7 +279,7 @@ |
211 | x2_clk: x2-clock { |
212 | compatible = "fixed-clock"; |
213 | #clock-cells = <0>; |
214 | - clock-frequency = <148500000>; |
215 | + clock-frequency = <74250000>; |
216 | }; |
217 | |
218 | x13_clk: x13-clock { |
219 | diff --git a/arch/arm/boot/dts/r8a7791.dtsi b/arch/arm/boot/dts/r8a7791.dtsi |
220 | index 162b55c665a3..59405ebdce01 100644 |
221 | --- a/arch/arm/boot/dts/r8a7791.dtsi |
222 | +++ b/arch/arm/boot/dts/r8a7791.dtsi |
223 | @@ -74,9 +74,8 @@ |
224 | next-level-cache = <&L2_CA15>; |
225 | }; |
226 | |
227 | - L2_CA15: cache-controller@0 { |
228 | + L2_CA15: cache-controller-0 { |
229 | compatible = "cache"; |
230 | - reg = <0>; |
231 | power-domains = <&sysc R8A7791_PD_CA15_SCU>; |
232 | cache-unified; |
233 | cache-level = <2>; |
234 | @@ -1438,8 +1437,11 @@ |
235 | compatible = "renesas,r8a7791-mstp-clocks", "renesas,cpg-mstp-clocks"; |
236 | reg = <0 0xe6150998 0 4>, <0 0xe61509a8 0 4>; |
237 | clocks = <&p_clk>, |
238 | - <&p_clk>, <&p_clk>, <&p_clk>, <&p_clk>, <&p_clk>, |
239 | - <&p_clk>, <&p_clk>, <&p_clk>, <&p_clk>, <&p_clk>, |
240 | + <&mstp10_clks R8A7791_CLK_SSI_ALL>, <&mstp10_clks R8A7791_CLK_SSI_ALL>, |
241 | + <&mstp10_clks R8A7791_CLK_SSI_ALL>, <&mstp10_clks R8A7791_CLK_SSI_ALL>, |
242 | + <&mstp10_clks R8A7791_CLK_SSI_ALL>, <&mstp10_clks R8A7791_CLK_SSI_ALL>, |
243 | + <&mstp10_clks R8A7791_CLK_SSI_ALL>, <&mstp10_clks R8A7791_CLK_SSI_ALL>, |
244 | + <&mstp10_clks R8A7791_CLK_SSI_ALL>, <&mstp10_clks R8A7791_CLK_SSI_ALL>, |
245 | <&p_clk>, |
246 | <&mstp10_clks R8A7791_CLK_SCU_ALL>, <&mstp10_clks R8A7791_CLK_SCU_ALL>, |
247 | <&mstp10_clks R8A7791_CLK_SCU_ALL>, <&mstp10_clks R8A7791_CLK_SCU_ALL>, |
248 | diff --git a/arch/arm/boot/dts/r8a7792.dtsi b/arch/arm/boot/dts/r8a7792.dtsi |
249 | index 713141d38b3e..0b50c6766867 100644 |
250 | --- a/arch/arm/boot/dts/r8a7792.dtsi |
251 | +++ b/arch/arm/boot/dts/r8a7792.dtsi |
252 | @@ -58,9 +58,8 @@ |
253 | next-level-cache = <&L2_CA15>; |
254 | }; |
255 | |
256 | - L2_CA15: cache-controller@0 { |
257 | + L2_CA15: cache-controller-0 { |
258 | compatible = "cache"; |
259 | - reg = <0>; |
260 | cache-unified; |
261 | cache-level = <2>; |
262 | power-domains = <&sysc R8A7792_PD_CA15_SCU>; |
263 | diff --git a/arch/arm/boot/dts/r8a7793.dtsi b/arch/arm/boot/dts/r8a7793.dtsi |
264 | index 8d02aacf2892..e9625cb3bbaa 100644 |
265 | --- a/arch/arm/boot/dts/r8a7793.dtsi |
266 | +++ b/arch/arm/boot/dts/r8a7793.dtsi |
267 | @@ -65,9 +65,8 @@ |
268 | power-domains = <&sysc R8A7793_PD_CA15_CPU1>; |
269 | }; |
270 | |
271 | - L2_CA15: cache-controller@0 { |
272 | + L2_CA15: cache-controller-0 { |
273 | compatible = "cache"; |
274 | - reg = <0>; |
275 | power-domains = <&sysc R8A7793_PD_CA15_SCU>; |
276 | cache-unified; |
277 | cache-level = <2>; |
278 | @@ -1235,8 +1234,11 @@ |
279 | compatible = "renesas,r8a7793-mstp-clocks", "renesas,cpg-mstp-clocks"; |
280 | reg = <0 0xe6150998 0 4>, <0 0xe61509a8 0 4>; |
281 | clocks = <&p_clk>, |
282 | - <&p_clk>, <&p_clk>, <&p_clk>, <&p_clk>, <&p_clk>, |
283 | - <&p_clk>, <&p_clk>, <&p_clk>, <&p_clk>, <&p_clk>, |
284 | + <&mstp10_clks R8A7793_CLK_SSI_ALL>, <&mstp10_clks R8A7793_CLK_SSI_ALL>, |
285 | + <&mstp10_clks R8A7793_CLK_SSI_ALL>, <&mstp10_clks R8A7793_CLK_SSI_ALL>, |
286 | + <&mstp10_clks R8A7793_CLK_SSI_ALL>, <&mstp10_clks R8A7793_CLK_SSI_ALL>, |
287 | + <&mstp10_clks R8A7793_CLK_SSI_ALL>, <&mstp10_clks R8A7793_CLK_SSI_ALL>, |
288 | + <&mstp10_clks R8A7793_CLK_SSI_ALL>, <&mstp10_clks R8A7793_CLK_SSI_ALL>, |
289 | <&p_clk>, |
290 | <&mstp10_clks R8A7793_CLK_SCU_ALL>, <&mstp10_clks R8A7793_CLK_SCU_ALL>, |
291 | <&mstp10_clks R8A7793_CLK_SCU_ALL>, <&mstp10_clks R8A7793_CLK_SCU_ALL>, |
292 | diff --git a/arch/arm/boot/dts/r8a7794-silk.dts b/arch/arm/boot/dts/r8a7794-silk.dts |
293 | index cf880ac06f4b..8874451fb914 100644 |
294 | --- a/arch/arm/boot/dts/r8a7794-silk.dts |
295 | +++ b/arch/arm/boot/dts/r8a7794-silk.dts |
296 | @@ -425,7 +425,7 @@ |
297 | status = "okay"; |
298 | |
299 | clocks = <&mstp7_clks R8A7794_CLK_DU0>, |
300 | - <&mstp7_clks R8A7794_CLK_DU0>, |
301 | + <&mstp7_clks R8A7794_CLK_DU1>, |
302 | <&x2_clk>, <&x3_clk>; |
303 | clock-names = "du.0", "du.1", "dclkin.0", "dclkin.1"; |
304 | |
305 | diff --git a/arch/arm/boot/dts/r8a7794.dtsi b/arch/arm/boot/dts/r8a7794.dtsi |
306 | index 7e860d3737ff..d8f4ca85ed3f 100644 |
307 | --- a/arch/arm/boot/dts/r8a7794.dtsi |
308 | +++ b/arch/arm/boot/dts/r8a7794.dtsi |
309 | @@ -56,9 +56,8 @@ |
310 | next-level-cache = <&L2_CA7>; |
311 | }; |
312 | |
313 | - L2_CA7: cache-controller@0 { |
314 | + L2_CA7: cache-controller-0 { |
315 | compatible = "cache"; |
316 | - reg = <0>; |
317 | power-domains = <&sysc R8A7794_PD_CA7_SCU>; |
318 | cache-unified; |
319 | cache-level = <2>; |
320 | @@ -917,7 +916,7 @@ |
321 | interrupts = <GIC_SPI 256 IRQ_TYPE_LEVEL_HIGH>, |
322 | <GIC_SPI 268 IRQ_TYPE_LEVEL_HIGH>; |
323 | clocks = <&mstp7_clks R8A7794_CLK_DU0>, |
324 | - <&mstp7_clks R8A7794_CLK_DU0>; |
325 | + <&mstp7_clks R8A7794_CLK_DU1>; |
326 | clock-names = "du.0", "du.1"; |
327 | status = "disabled"; |
328 | |
329 | @@ -1262,19 +1261,21 @@ |
330 | clocks = <&mp_clk>, <&hp_clk>, |
331 | <&zs_clk>, <&p_clk>, <&p_clk>, <&zs_clk>, |
332 | <&zs_clk>, <&p_clk>, <&p_clk>, <&p_clk>, <&p_clk>, |
333 | - <&zx_clk>; |
334 | + <&zx_clk>, <&zx_clk>; |
335 | #clock-cells = <1>; |
336 | clock-indices = < |
337 | R8A7794_CLK_EHCI R8A7794_CLK_HSUSB |
338 | R8A7794_CLK_HSCIF2 R8A7794_CLK_SCIF5 |
339 | R8A7794_CLK_SCIF4 R8A7794_CLK_HSCIF1 R8A7794_CLK_HSCIF0 |
340 | R8A7794_CLK_SCIF3 R8A7794_CLK_SCIF2 R8A7794_CLK_SCIF1 |
341 | - R8A7794_CLK_SCIF0 R8A7794_CLK_DU0 |
342 | + R8A7794_CLK_SCIF0 |
343 | + R8A7794_CLK_DU1 R8A7794_CLK_DU0 |
344 | >; |
345 | clock-output-names = |
346 | "ehci", "hsusb", |
347 | "hscif2", "scif5", "scif4", "hscif1", "hscif0", |
348 | - "scif3", "scif2", "scif1", "scif0", "du0"; |
349 | + "scif3", "scif2", "scif1", "scif0", |
350 | + "du1", "du0"; |
351 | }; |
352 | mstp8_clks: mstp8_clks@e6150990 { |
353 | compatible = "renesas,r8a7794-mstp-clocks", "renesas,cpg-mstp-clocks"; |
354 | diff --git a/arch/arm/configs/bcm2835_defconfig b/arch/arm/configs/bcm2835_defconfig |
355 | index 79de828e49ad..e32b0550a338 100644 |
356 | --- a/arch/arm/configs/bcm2835_defconfig |
357 | +++ b/arch/arm/configs/bcm2835_defconfig |
358 | @@ -1,6 +1,5 @@ |
359 | # CONFIG_LOCALVERSION_AUTO is not set |
360 | CONFIG_SYSVIPC=y |
361 | -CONFIG_FHANDLE=y |
362 | CONFIG_NO_HZ=y |
363 | CONFIG_HIGH_RES_TIMERS=y |
364 | CONFIG_BSD_PROCESS_ACCT=y |
365 | @@ -32,6 +31,7 @@ CONFIG_PREEMPT_VOLUNTARY=y |
366 | CONFIG_AEABI=y |
367 | CONFIG_KSM=y |
368 | CONFIG_CLEANCACHE=y |
369 | +CONFIG_CMA=y |
370 | CONFIG_SECCOMP=y |
371 | CONFIG_KEXEC=y |
372 | CONFIG_CRASH_DUMP=y |
373 | @@ -52,6 +52,7 @@ CONFIG_MAC80211=y |
374 | CONFIG_DEVTMPFS=y |
375 | CONFIG_DEVTMPFS_MOUNT=y |
376 | # CONFIG_STANDALONE is not set |
377 | +CONFIG_DMA_CMA=y |
378 | CONFIG_SCSI=y |
379 | CONFIG_BLK_DEV_SD=y |
380 | CONFIG_SCSI_CONSTANTS=y |
381 | @@ -62,7 +63,6 @@ CONFIG_USB_NET_SMSC95XX=y |
382 | CONFIG_ZD1211RW=y |
383 | CONFIG_INPUT_EVDEV=y |
384 | # CONFIG_LEGACY_PTYS is not set |
385 | -# CONFIG_DEVKMEM is not set |
386 | CONFIG_SERIAL_AMBA_PL011=y |
387 | CONFIG_SERIAL_AMBA_PL011_CONSOLE=y |
388 | CONFIG_TTY_PRINTK=y |
389 | diff --git a/arch/arm/mach-bcm/Kconfig b/arch/arm/mach-bcm/Kconfig |
390 | index a0e66d8200c5..403db76e3497 100644 |
391 | --- a/arch/arm/mach-bcm/Kconfig |
392 | +++ b/arch/arm/mach-bcm/Kconfig |
393 | @@ -199,6 +199,7 @@ config ARCH_BRCMSTB |
394 | select BRCMSTB_L2_IRQ |
395 | select BCM7120_L2_IRQ |
396 | select ARCH_DMA_ADDR_T_64BIT if ARM_LPAE |
397 | + select ZONE_DMA if ARM_LPAE |
398 | select SOC_BRCMSTB |
399 | select SOC_BUS |
400 | help |
401 | diff --git a/arch/arm64/boot/dts/renesas/r8a7796.dtsi b/arch/arm64/boot/dts/renesas/r8a7796.dtsi |
402 | index 9217da983525..53d03cb144e4 100644 |
403 | --- a/arch/arm64/boot/dts/renesas/r8a7796.dtsi |
404 | +++ b/arch/arm64/boot/dts/renesas/r8a7796.dtsi |
405 | @@ -36,9 +36,8 @@ |
406 | enable-method = "psci"; |
407 | }; |
408 | |
409 | - L2_CA57: cache-controller@0 { |
410 | + L2_CA57: cache-controller-0 { |
411 | compatible = "cache"; |
412 | - reg = <0>; |
413 | power-domains = <&sysc R8A7796_PD_CA57_SCU>; |
414 | cache-unified; |
415 | cache-level = <2>; |
416 | diff --git a/arch/mips/kernel/mips-r2-to-r6-emul.c b/arch/mips/kernel/mips-r2-to-r6-emul.c |
417 | index d8227f289d7f..9a4aed652736 100644 |
418 | --- a/arch/mips/kernel/mips-r2-to-r6-emul.c |
419 | +++ b/arch/mips/kernel/mips-r2-to-r6-emul.c |
420 | @@ -1096,10 +1096,20 @@ int mipsr2_decoder(struct pt_regs *regs, u32 inst, unsigned long *fcr31) |
421 | } |
422 | break; |
423 | |
424 | - case beql_op: |
425 | - case bnel_op: |
426 | case blezl_op: |
427 | case bgtzl_op: |
428 | + /* |
429 | + * For BLEZL and BGTZL, rt field must be set to 0. If this |
430 | + * is not the case, this may be an encoding of a MIPS R6 |
431 | + * instruction, so return to CPU execution if this occurs |
432 | + */ |
433 | + if (MIPSInst_RT(inst)) { |
434 | + err = SIGILL; |
435 | + break; |
436 | + } |
437 | + /* fall through */ |
438 | + case beql_op: |
439 | + case bnel_op: |
440 | if (delay_slot(regs)) { |
441 | err = SIGILL; |
442 | break; |
443 | @@ -2329,6 +2339,8 @@ static int mipsr2_stats_clear_show(struct seq_file *s, void *unused) |
444 | __this_cpu_write((mipsr2bremustats).bgezl, 0); |
445 | __this_cpu_write((mipsr2bremustats).bltzll, 0); |
446 | __this_cpu_write((mipsr2bremustats).bgezll, 0); |
447 | + __this_cpu_write((mipsr2bremustats).bltzall, 0); |
448 | + __this_cpu_write((mipsr2bremustats).bgezall, 0); |
449 | __this_cpu_write((mipsr2bremustats).bltzal, 0); |
450 | __this_cpu_write((mipsr2bremustats).bgezal, 0); |
451 | __this_cpu_write((mipsr2bremustats).beql, 0); |
452 | diff --git a/arch/mips/net/bpf_jit.c b/arch/mips/net/bpf_jit.c |
453 | index 49a2e2226fee..248603739198 100644 |
454 | --- a/arch/mips/net/bpf_jit.c |
455 | +++ b/arch/mips/net/bpf_jit.c |
456 | @@ -526,7 +526,8 @@ static void save_bpf_jit_regs(struct jit_ctx *ctx, unsigned offset) |
457 | u32 sflags, tmp_flags; |
458 | |
459 | /* Adjust the stack pointer */ |
460 | - emit_stack_offset(-align_sp(offset), ctx); |
461 | + if (offset) |
462 | + emit_stack_offset(-align_sp(offset), ctx); |
463 | |
464 | tmp_flags = sflags = ctx->flags >> SEEN_SREG_SFT; |
465 | /* sflags is essentially a bitmap */ |
466 | @@ -578,7 +579,8 @@ static void restore_bpf_jit_regs(struct jit_ctx *ctx, |
467 | emit_load_stack_reg(r_ra, r_sp, real_off, ctx); |
468 | |
469 | /* Restore the sp and discard the scrach memory */ |
470 | - emit_stack_offset(align_sp(offset), ctx); |
471 | + if (offset) |
472 | + emit_stack_offset(align_sp(offset), ctx); |
473 | } |
474 | |
475 | static unsigned int get_stack_depth(struct jit_ctx *ctx) |
476 | @@ -625,8 +627,14 @@ static void build_prologue(struct jit_ctx *ctx) |
477 | if (ctx->flags & SEEN_X) |
478 | emit_jit_reg_move(r_X, r_zero, ctx); |
479 | |
480 | - /* Do not leak kernel data to userspace */ |
481 | - if (bpf_needs_clear_a(&ctx->skf->insns[0])) |
482 | + /* |
483 | + * Do not leak kernel data to userspace, we only need to clear |
484 | + * r_A if it is ever used. In fact if it is never used, we |
485 | + * will not save/restore it, so clearing it in this case would |
486 | + * corrupt the state of the caller. |
487 | + */ |
488 | + if (bpf_needs_clear_a(&ctx->skf->insns[0]) && |
489 | + (ctx->flags & SEEN_A)) |
490 | emit_jit_reg_move(r_A, r_zero, ctx); |
491 | } |
492 | |
493 | diff --git a/arch/mips/net/bpf_jit_asm.S b/arch/mips/net/bpf_jit_asm.S |
494 | index 5d2e0c8d29c0..88a2075305d1 100644 |
495 | --- a/arch/mips/net/bpf_jit_asm.S |
496 | +++ b/arch/mips/net/bpf_jit_asm.S |
497 | @@ -90,18 +90,14 @@ FEXPORT(sk_load_half_positive) |
498 | is_offset_in_header(2, half) |
499 | /* Offset within header boundaries */ |
500 | PTR_ADDU t1, $r_skb_data, offset |
501 | - .set reorder |
502 | - lh $r_A, 0(t1) |
503 | - .set noreorder |
504 | + lhu $r_A, 0(t1) |
505 | #ifdef CONFIG_CPU_LITTLE_ENDIAN |
506 | # if defined(__mips_isa_rev) && (__mips_isa_rev >= 2) |
507 | - wsbh t0, $r_A |
508 | - seh $r_A, t0 |
509 | + wsbh $r_A, $r_A |
510 | # else |
511 | - sll t0, $r_A, 24 |
512 | - andi t1, $r_A, 0xff00 |
513 | - sra t0, t0, 16 |
514 | - srl t1, t1, 8 |
515 | + sll t0, $r_A, 8 |
516 | + srl t1, $r_A, 8 |
517 | + andi t0, t0, 0xff00 |
518 | or $r_A, t0, t1 |
519 | # endif |
520 | #endif |
521 | @@ -115,7 +111,7 @@ FEXPORT(sk_load_byte_positive) |
522 | is_offset_in_header(1, byte) |
523 | /* Offset within header boundaries */ |
524 | PTR_ADDU t1, $r_skb_data, offset |
525 | - lb $r_A, 0(t1) |
526 | + lbu $r_A, 0(t1) |
527 | jr $r_ra |
528 | move $r_ret, zero |
529 | END(sk_load_byte) |
530 | @@ -139,6 +135,11 @@ FEXPORT(sk_load_byte_positive) |
531 | * (void *to) is returned in r_s0 |
532 | * |
533 | */ |
534 | +#ifdef CONFIG_CPU_LITTLE_ENDIAN |
535 | +#define DS_OFFSET(SIZE) (4 * SZREG) |
536 | +#else |
537 | +#define DS_OFFSET(SIZE) ((4 * SZREG) + (4 - SIZE)) |
538 | +#endif |
539 | #define bpf_slow_path_common(SIZE) \ |
540 | /* Quick check. Are we within reasonable boundaries? */ \ |
541 | LONG_ADDIU $r_s1, $r_skb_len, -SIZE; \ |
542 | @@ -150,7 +151,7 @@ FEXPORT(sk_load_byte_positive) |
543 | PTR_LA t0, skb_copy_bits; \ |
544 | PTR_S $r_ra, (5 * SZREG)($r_sp); \ |
545 | /* Assign low slot to a2 */ \ |
546 | - move a2, $r_sp; \ |
547 | + PTR_ADDIU a2, $r_sp, DS_OFFSET(SIZE); \ |
548 | jalr t0; \ |
549 | /* Reset our destination slot (DS but it's ok) */ \ |
550 | INT_S zero, (4 * SZREG)($r_sp); \ |
551 | diff --git a/arch/parisc/kernel/cache.c b/arch/parisc/kernel/cache.c |
552 | index 025afe5f17a7..8a0822125f8b 100644 |
553 | --- a/arch/parisc/kernel/cache.c |
554 | +++ b/arch/parisc/kernel/cache.c |
555 | @@ -542,7 +542,8 @@ void flush_cache_mm(struct mm_struct *mm) |
556 | rp3440, etc. So, avoid it if the mm isn't too big. */ |
557 | if ((!IS_ENABLED(CONFIG_SMP) || !arch_irqs_disabled()) && |
558 | mm_total_size(mm) >= parisc_cache_flush_threshold) { |
559 | - flush_tlb_all(); |
560 | + if (mm->context) |
561 | + flush_tlb_all(); |
562 | flush_cache_all(); |
563 | return; |
564 | } |
565 | @@ -570,6 +571,8 @@ void flush_cache_mm(struct mm_struct *mm) |
566 | pfn = pte_pfn(*ptep); |
567 | if (!pfn_valid(pfn)) |
568 | continue; |
569 | + if (unlikely(mm->context)) |
570 | + flush_tlb_page(vma, addr); |
571 | __flush_cache_page(vma, addr, PFN_PHYS(pfn)); |
572 | } |
573 | } |
574 | @@ -596,26 +599,46 @@ flush_user_icache_range(unsigned long start, unsigned long end) |
575 | void flush_cache_range(struct vm_area_struct *vma, |
576 | unsigned long start, unsigned long end) |
577 | { |
578 | + pgd_t *pgd; |
579 | + unsigned long addr; |
580 | + |
581 | if ((!IS_ENABLED(CONFIG_SMP) || !arch_irqs_disabled()) && |
582 | end - start >= parisc_cache_flush_threshold) { |
583 | - flush_tlb_range(vma, start, end); |
584 | + if (vma->vm_mm->context) |
585 | + flush_tlb_range(vma, start, end); |
586 | flush_cache_all(); |
587 | return; |
588 | } |
589 | |
590 | - flush_user_dcache_range_asm(start, end); |
591 | - if (vma->vm_flags & VM_EXEC) |
592 | - flush_user_icache_range_asm(start, end); |
593 | - flush_tlb_range(vma, start, end); |
594 | + if (vma->vm_mm->context == mfsp(3)) { |
595 | + flush_user_dcache_range_asm(start, end); |
596 | + if (vma->vm_flags & VM_EXEC) |
597 | + flush_user_icache_range_asm(start, end); |
598 | + flush_tlb_range(vma, start, end); |
599 | + return; |
600 | + } |
601 | + |
602 | + pgd = vma->vm_mm->pgd; |
603 | + for (addr = vma->vm_start; addr < vma->vm_end; addr += PAGE_SIZE) { |
604 | + unsigned long pfn; |
605 | + pte_t *ptep = get_ptep(pgd, addr); |
606 | + if (!ptep) |
607 | + continue; |
608 | + pfn = pte_pfn(*ptep); |
609 | + if (pfn_valid(pfn)) { |
610 | + if (unlikely(vma->vm_mm->context)) |
611 | + flush_tlb_page(vma, addr); |
612 | + __flush_cache_page(vma, addr, PFN_PHYS(pfn)); |
613 | + } |
614 | + } |
615 | } |
616 | |
617 | void |
618 | flush_cache_page(struct vm_area_struct *vma, unsigned long vmaddr, unsigned long pfn) |
619 | { |
620 | - BUG_ON(!vma->vm_mm->context); |
621 | - |
622 | if (pfn_valid(pfn)) { |
623 | - flush_tlb_page(vma, vmaddr); |
624 | + if (likely(vma->vm_mm->context)) |
625 | + flush_tlb_page(vma, vmaddr); |
626 | __flush_cache_page(vma, vmaddr, PFN_PHYS(pfn)); |
627 | } |
628 | } |
629 | diff --git a/arch/powerpc/include/asm/code-patching.h b/arch/powerpc/include/asm/code-patching.h |
630 | index 2015b072422c..b4ab1f497335 100644 |
631 | --- a/arch/powerpc/include/asm/code-patching.h |
632 | +++ b/arch/powerpc/include/asm/code-patching.h |
633 | @@ -30,6 +30,7 @@ int patch_branch(unsigned int *addr, unsigned long target, int flags); |
634 | int patch_instruction(unsigned int *addr, unsigned int instr); |
635 | |
636 | int instr_is_relative_branch(unsigned int instr); |
637 | +int instr_is_relative_link_branch(unsigned int instr); |
638 | int instr_is_branch_to_addr(const unsigned int *instr, unsigned long addr); |
639 | unsigned long branch_target(const unsigned int *instr); |
640 | unsigned int translate_branch(const unsigned int *dest, |
641 | diff --git a/arch/powerpc/kernel/module_64.c b/arch/powerpc/kernel/module_64.c |
642 | index 183368e008cf..99407cf12ad5 100644 |
643 | --- a/arch/powerpc/kernel/module_64.c |
644 | +++ b/arch/powerpc/kernel/module_64.c |
645 | @@ -494,7 +494,17 @@ static bool is_early_mcount_callsite(u32 *instruction) |
646 | restore r2. */ |
647 | static int restore_r2(u32 *instruction, struct module *me) |
648 | { |
649 | - if (is_early_mcount_callsite(instruction - 1)) |
650 | + u32 *prev_insn = instruction - 1; |
651 | + |
652 | + if (is_early_mcount_callsite(prev_insn)) |
653 | + return 1; |
654 | + |
655 | + /* |
656 | + * Make sure the branch isn't a sibling call. Sibling calls aren't |
657 | + * "link" branches and they don't return, so they don't need the r2 |
658 | + * restore afterwards. |
659 | + */ |
660 | + if (!instr_is_relative_link_branch(*prev_insn)) |
661 | return 1; |
662 | |
663 | if (*instruction != PPC_INST_NOP) { |
664 | diff --git a/arch/powerpc/lib/code-patching.c b/arch/powerpc/lib/code-patching.c |
665 | index d5edbeb8eb82..753d591f1b52 100644 |
666 | --- a/arch/powerpc/lib/code-patching.c |
667 | +++ b/arch/powerpc/lib/code-patching.c |
668 | @@ -95,6 +95,11 @@ int instr_is_relative_branch(unsigned int instr) |
669 | return instr_is_branch_iform(instr) || instr_is_branch_bform(instr); |
670 | } |
671 | |
672 | +int instr_is_relative_link_branch(unsigned int instr) |
673 | +{ |
674 | + return instr_is_relative_branch(instr) && (instr & BRANCH_SET_LINK); |
675 | +} |
676 | + |
677 | static unsigned long branch_iform_target(const unsigned int *instr) |
678 | { |
679 | signed long imm; |
680 | diff --git a/arch/powerpc/mm/fault.c b/arch/powerpc/mm/fault.c |
681 | index d0b137d96df1..9376e8e53bfa 100644 |
682 | --- a/arch/powerpc/mm/fault.c |
683 | +++ b/arch/powerpc/mm/fault.c |
684 | @@ -294,7 +294,7 @@ int do_page_fault(struct pt_regs *regs, unsigned long address, |
685 | * can result in fault, which will cause a deadlock when called with |
686 | * mmap_sem held |
687 | */ |
688 | - if (user_mode(regs)) |
689 | + if (!is_exec && user_mode(regs)) |
690 | store_update_sp = store_updates_sp(regs); |
691 | |
692 | if (user_mode(regs)) |
693 | diff --git a/arch/powerpc/mm/hugetlbpage.c b/arch/powerpc/mm/hugetlbpage.c |
694 | index a5d3ecdabc44..035dfb65df4b 100644 |
695 | --- a/arch/powerpc/mm/hugetlbpage.c |
696 | +++ b/arch/powerpc/mm/hugetlbpage.c |
697 | @@ -765,6 +765,24 @@ static int __init add_huge_page_size(unsigned long long size) |
698 | if ((mmu_psize = shift_to_mmu_psize(shift)) < 0) |
699 | return -EINVAL; |
700 | |
701 | +#ifdef CONFIG_PPC_BOOK3S_64 |
702 | + /* |
703 | + * We need to make sure that for different page sizes reported by |
704 | + * firmware we only add hugetlb support for page sizes that can be |
705 | + * supported by linux page table layout. |
706 | + * For now we have |
707 | + * Radix: 2M |
708 | + * Hash: 16M and 16G |
709 | + */ |
710 | + if (radix_enabled()) { |
711 | + if (mmu_psize != MMU_PAGE_2M) |
712 | + return -EINVAL; |
713 | + } else { |
714 | + if (mmu_psize != MMU_PAGE_16M && mmu_psize != MMU_PAGE_16G) |
715 | + return -EINVAL; |
716 | + } |
717 | +#endif |
718 | + |
719 | BUG_ON(mmu_psize_defs[mmu_psize].shift != shift); |
720 | |
721 | /* Return if huge page size has already been setup */ |
722 | diff --git a/arch/powerpc/mm/tlb_nohash.c b/arch/powerpc/mm/tlb_nohash.c |
723 | index 050badc0ebd3..0b50019505a5 100644 |
724 | --- a/arch/powerpc/mm/tlb_nohash.c |
725 | +++ b/arch/powerpc/mm/tlb_nohash.c |
726 | @@ -751,7 +751,7 @@ void setup_initial_memory_limit(phys_addr_t first_memblock_base, |
727 | * avoid going over total available memory just in case... |
728 | */ |
729 | #ifdef CONFIG_PPC_FSL_BOOK3E |
730 | - if (mmu_has_feature(MMU_FTR_TYPE_FSL_E)) { |
731 | + if (early_mmu_has_feature(MMU_FTR_TYPE_FSL_E)) { |
732 | unsigned long linear_sz; |
733 | unsigned int num_cams; |
734 | |
735 | diff --git a/arch/s390/kernel/early.c b/arch/s390/kernel/early.c |
736 | index 29d87444a655..62578989c74d 100644 |
737 | --- a/arch/s390/kernel/early.c |
738 | +++ b/arch/s390/kernel/early.c |
739 | @@ -372,7 +372,7 @@ static int __init topology_setup(char *str) |
740 | |
741 | rc = kstrtobool(str, &enabled); |
742 | if (!rc && !enabled) |
743 | - S390_lowcore.machine_flags &= ~MACHINE_HAS_TOPOLOGY; |
744 | + S390_lowcore.machine_flags &= ~MACHINE_FLAG_TOPOLOGY; |
745 | return rc; |
746 | } |
747 | early_param("topology", topology_setup); |
748 | diff --git a/arch/x86/include/asm/cpufeatures.h b/arch/x86/include/asm/cpufeatures.h |
749 | index ed7a1d2c4235..a2485311164b 100644 |
750 | --- a/arch/x86/include/asm/cpufeatures.h |
751 | +++ b/arch/x86/include/asm/cpufeatures.h |
752 | @@ -302,6 +302,7 @@ |
753 | /* Intel-defined CPU features, CPUID level 0x00000007:0 (EDX), word 18 */ |
754 | #define X86_FEATURE_AVX512_4VNNIW (18*32+ 2) /* AVX-512 Neural Network Instructions */ |
755 | #define X86_FEATURE_AVX512_4FMAPS (18*32+ 3) /* AVX-512 Multiply Accumulation Single precision */ |
756 | +#define X86_FEATURE_PCONFIG (18*32+18) /* Intel PCONFIG */ |
757 | #define X86_FEATURE_SPEC_CTRL (18*32+26) /* "" Speculation Control (IBRS + IBPB) */ |
758 | #define X86_FEATURE_INTEL_STIBP (18*32+27) /* "" Single Thread Indirect Branch Predictors */ |
759 | #define X86_FEATURE_ARCH_CAPABILITIES (18*32+29) /* IA32_ARCH_CAPABILITIES MSR (Intel) */ |
760 | diff --git a/arch/x86/include/asm/nospec-branch.h b/arch/x86/include/asm/nospec-branch.h |
761 | index d0dabeae0505..f928ad9b143f 100644 |
762 | --- a/arch/x86/include/asm/nospec-branch.h |
763 | +++ b/arch/x86/include/asm/nospec-branch.h |
764 | @@ -183,7 +183,10 @@ |
765 | * otherwise we'll run out of registers. We don't care about CET |
766 | * here, anyway. |
767 | */ |
768 | -# define CALL_NOSPEC ALTERNATIVE("call *%[thunk_target]\n", \ |
769 | +# define CALL_NOSPEC \ |
770 | + ALTERNATIVE( \ |
771 | + ANNOTATE_RETPOLINE_SAFE \ |
772 | + "call *%[thunk_target]\n", \ |
773 | " jmp 904f;\n" \ |
774 | " .align 16\n" \ |
775 | "901: call 903f;\n" \ |
776 | diff --git a/arch/x86/include/asm/reboot.h b/arch/x86/include/asm/reboot.h |
777 | index 2cb1cc253d51..fc62ba8dce93 100644 |
778 | --- a/arch/x86/include/asm/reboot.h |
779 | +++ b/arch/x86/include/asm/reboot.h |
780 | @@ -15,6 +15,7 @@ struct machine_ops { |
781 | }; |
782 | |
783 | extern struct machine_ops machine_ops; |
784 | +extern int crashing_cpu; |
785 | |
786 | void native_machine_crash_shutdown(struct pt_regs *regs); |
787 | void native_machine_shutdown(void); |
788 | diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c |
789 | index 768042530af2..8fb1d6522f8e 100644 |
790 | --- a/arch/x86/kernel/cpu/intel.c |
791 | +++ b/arch/x86/kernel/cpu/intel.c |
792 | @@ -64,7 +64,7 @@ void check_mpx_erratum(struct cpuinfo_x86 *c) |
793 | /* |
794 | * Early microcode releases for the Spectre v2 mitigation were broken. |
795 | * Information taken from; |
796 | - * - https://newsroom.intel.com/wp-content/uploads/sites/11/2018/01/microcode-update-guidance.pdf |
797 | + * - https://newsroom.intel.com/wp-content/uploads/sites/11/2018/03/microcode-update-guidance.pdf |
798 | * - https://kb.vmware.com/s/article/52345 |
799 | * - Microcode revisions observed in the wild |
800 | * - Release note from 20180108 microcode release |
801 | @@ -82,7 +82,6 @@ static const struct sku_microcode spectre_bad_microcodes[] = { |
802 | { INTEL_FAM6_KABYLAKE_MOBILE, 0x09, 0x80 }, |
803 | { INTEL_FAM6_SKYLAKE_X, 0x03, 0x0100013e }, |
804 | { INTEL_FAM6_SKYLAKE_X, 0x04, 0x0200003c }, |
805 | - { INTEL_FAM6_SKYLAKE_DESKTOP, 0x03, 0xc2 }, |
806 | { INTEL_FAM6_BROADWELL_CORE, 0x04, 0x28 }, |
807 | { INTEL_FAM6_BROADWELL_GT3E, 0x01, 0x1b }, |
808 | { INTEL_FAM6_BROADWELL_XEON_D, 0x02, 0x14 }, |
809 | diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c |
810 | index 684d9fd191e0..7bbd50fa72ad 100644 |
811 | --- a/arch/x86/kernel/cpu/mcheck/mce.c |
812 | +++ b/arch/x86/kernel/cpu/mcheck/mce.c |
813 | @@ -48,6 +48,7 @@ |
814 | #include <asm/tlbflush.h> |
815 | #include <asm/mce.h> |
816 | #include <asm/msr.h> |
817 | +#include <asm/reboot.h> |
818 | |
819 | #include "mce-internal.h" |
820 | |
821 | @@ -1081,9 +1082,22 @@ void do_machine_check(struct pt_regs *regs, long error_code) |
822 | * on Intel. |
823 | */ |
824 | int lmce = 1; |
825 | + int cpu = smp_processor_id(); |
826 | |
827 | - /* If this CPU is offline, just bail out. */ |
828 | - if (cpu_is_offline(smp_processor_id())) { |
829 | + /* |
830 | + * Cases where we avoid rendezvous handler timeout: |
831 | + * 1) If this CPU is offline. |
832 | + * |
833 | + * 2) If crashing_cpu was set, e.g. we're entering kdump and we need to |
834 | + * skip those CPUs which remain looping in the 1st kernel - see |
835 | + * crash_nmi_callback(). |
836 | + * |
837 | + * Note: there still is a small window between kexec-ing and the new, |
838 | + * kdump kernel establishing a new #MC handler where a broadcasted MCE |
839 | + * might not get handled properly. |
840 | + */ |
841 | + if (cpu_is_offline(cpu) || |
842 | + (crashing_cpu != -1 && crashing_cpu != cpu)) { |
843 | u64 mcgstatus; |
844 | |
845 | mcgstatus = mce_rdmsrl(MSR_IA32_MCG_STATUS); |
846 | @@ -1681,30 +1695,35 @@ static int __mcheck_cpu_ancient_init(struct cpuinfo_x86 *c) |
847 | return 0; |
848 | } |
849 | |
850 | -static void __mcheck_cpu_init_vendor(struct cpuinfo_x86 *c) |
851 | +/* |
852 | + * Init basic CPU features needed for early decoding of MCEs. |
853 | + */ |
854 | +static void __mcheck_cpu_init_early(struct cpuinfo_x86 *c) |
855 | { |
856 | - switch (c->x86_vendor) { |
857 | - case X86_VENDOR_INTEL: |
858 | - mce_intel_feature_init(c); |
859 | - mce_adjust_timer = cmci_intel_adjust_timer; |
860 | - break; |
861 | - |
862 | - case X86_VENDOR_AMD: { |
863 | + if (c->x86_vendor == X86_VENDOR_AMD) { |
864 | mce_flags.overflow_recov = !!cpu_has(c, X86_FEATURE_OVERFLOW_RECOV); |
865 | mce_flags.succor = !!cpu_has(c, X86_FEATURE_SUCCOR); |
866 | mce_flags.smca = !!cpu_has(c, X86_FEATURE_SMCA); |
867 | |
868 | - /* |
869 | - * Install proper ops for Scalable MCA enabled processors |
870 | - */ |
871 | if (mce_flags.smca) { |
872 | msr_ops.ctl = smca_ctl_reg; |
873 | msr_ops.status = smca_status_reg; |
874 | msr_ops.addr = smca_addr_reg; |
875 | msr_ops.misc = smca_misc_reg; |
876 | } |
877 | - mce_amd_feature_init(c); |
878 | + } |
879 | +} |
880 | + |
881 | +static void __mcheck_cpu_init_vendor(struct cpuinfo_x86 *c) |
882 | +{ |
883 | + switch (c->x86_vendor) { |
884 | + case X86_VENDOR_INTEL: |
885 | + mce_intel_feature_init(c); |
886 | + mce_adjust_timer = cmci_intel_adjust_timer; |
887 | + break; |
888 | |
889 | + case X86_VENDOR_AMD: { |
890 | + mce_amd_feature_init(c); |
891 | break; |
892 | } |
893 | |
894 | @@ -1790,6 +1809,7 @@ void mcheck_cpu_init(struct cpuinfo_x86 *c) |
895 | |
896 | machine_check_vector = do_machine_check; |
897 | |
898 | + __mcheck_cpu_init_early(c); |
899 | __mcheck_cpu_init_generic(); |
900 | __mcheck_cpu_init_vendor(c); |
901 | __mcheck_cpu_init_clear_banks(); |
902 | diff --git a/arch/x86/kernel/kprobes/core.c b/arch/x86/kernel/kprobes/core.c |
903 | index b55d07b9d530..b8d3f1b60331 100644 |
904 | --- a/arch/x86/kernel/kprobes/core.c |
905 | +++ b/arch/x86/kernel/kprobes/core.c |
906 | @@ -199,6 +199,8 @@ int can_boost(kprobe_opcode_t *opcodes, void *addr) |
907 | return (opcode != 0x62 && opcode != 0x67); |
908 | case 0x70: |
909 | return 0; /* can't boost conditional jump */ |
910 | + case 0x90: |
911 | + return opcode != 0x9a; /* can't boost call far */ |
912 | case 0xc0: |
913 | /* can't boost software-interruptions */ |
914 | return (0xc1 < opcode && opcode < 0xcc) || opcode == 0xcf; |
915 | @@ -407,6 +409,8 @@ static int arch_copy_kprobe(struct kprobe *p) |
916 | { |
917 | int ret; |
918 | |
919 | + set_memory_rw((unsigned long)p->ainsn.insn & PAGE_MASK, 1); |
920 | + |
921 | /* Copy an instruction with recovering if other optprobe modifies it.*/ |
922 | ret = __copy_instruction(p->ainsn.insn, p->addr); |
923 | if (!ret) |
924 | @@ -421,6 +425,8 @@ static int arch_copy_kprobe(struct kprobe *p) |
925 | else |
926 | p->ainsn.boostable = -1; |
927 | |
928 | + set_memory_ro((unsigned long)p->ainsn.insn & PAGE_MASK, 1); |
929 | + |
930 | /* Check whether the instruction modifies Interrupt Flag or not */ |
931 | p->ainsn.if_modifier = is_IF_modifier(p->ainsn.insn); |
932 | |
933 | diff --git a/arch/x86/kernel/kprobes/opt.c b/arch/x86/kernel/kprobes/opt.c |
934 | index dc20da1c78f0..fa671b90c374 100644 |
935 | --- a/arch/x86/kernel/kprobes/opt.c |
936 | +++ b/arch/x86/kernel/kprobes/opt.c |
937 | @@ -371,6 +371,7 @@ int arch_prepare_optimized_kprobe(struct optimized_kprobe *op, |
938 | } |
939 | |
940 | buf = (u8 *)op->optinsn.insn; |
941 | + set_memory_rw((unsigned long)buf & PAGE_MASK, 1); |
942 | |
943 | /* Copy instructions into the out-of-line buffer */ |
944 | ret = copy_optimized_instructions(buf + TMPL_END_IDX, op->kp.addr); |
945 | @@ -393,6 +394,8 @@ int arch_prepare_optimized_kprobe(struct optimized_kprobe *op, |
946 | synthesize_reljump(buf + TMPL_END_IDX + op->optinsn.size, |
947 | (u8 *)op->kp.addr + op->optinsn.size); |
948 | |
949 | + set_memory_ro((unsigned long)buf & PAGE_MASK, 1); |
950 | + |
951 | flush_icache_range((unsigned long) buf, |
952 | (unsigned long) buf + TMPL_END_IDX + |
953 | op->optinsn.size + RELATIVEJUMP_SIZE); |
954 | diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c |
955 | index ce020a69bba9..03f21dbfaa9d 100644 |
956 | --- a/arch/x86/kernel/reboot.c |
957 | +++ b/arch/x86/kernel/reboot.c |
958 | @@ -769,10 +769,11 @@ void machine_crash_shutdown(struct pt_regs *regs) |
959 | #endif |
960 | |
961 | |
962 | +/* This is the CPU performing the emergency shutdown work. */ |
963 | +int crashing_cpu = -1; |
964 | + |
965 | #if defined(CONFIG_SMP) |
966 | |
967 | -/* This keeps a track of which one is crashing cpu. */ |
968 | -static int crashing_cpu; |
969 | static nmi_shootdown_cb shootdown_callback; |
970 | |
971 | static atomic_t waiting_for_crash_ipi; |
972 | diff --git a/arch/x86/kernel/setup_percpu.c b/arch/x86/kernel/setup_percpu.c |
973 | index 2bbd27f89802..f9da471a7707 100644 |
974 | --- a/arch/x86/kernel/setup_percpu.c |
975 | +++ b/arch/x86/kernel/setup_percpu.c |
976 | @@ -287,4 +287,25 @@ void __init setup_per_cpu_areas(void) |
977 | |
978 | /* Setup cpu initialized, callin, callout masks */ |
979 | setup_cpu_local_masks(); |
980 | + |
981 | +#ifdef CONFIG_X86_32 |
982 | + /* |
983 | + * Sync back kernel address range again. We already did this in |
984 | + * setup_arch(), but percpu data also needs to be available in |
985 | + * the smpboot asm. We can't reliably pick up percpu mappings |
986 | + * using vmalloc_fault(), because exception dispatch needs |
987 | + * percpu data. |
988 | + */ |
989 | + clone_pgd_range(initial_page_table + KERNEL_PGD_BOUNDARY, |
990 | + swapper_pg_dir + KERNEL_PGD_BOUNDARY, |
991 | + KERNEL_PGD_PTRS); |
992 | + |
993 | + /* |
994 | + * sync back low identity map too. It is used for example |
995 | + * in the 32-bit EFI stub. |
996 | + */ |
997 | + clone_pgd_range(initial_page_table, |
998 | + swapper_pg_dir + KERNEL_PGD_BOUNDARY, |
999 | + min(KERNEL_PGD_PTRS, KERNEL_PGD_BOUNDARY)); |
1000 | +#endif |
1001 | } |
1002 | diff --git a/arch/x86/kernel/sys_x86_64.c b/arch/x86/kernel/sys_x86_64.c |
1003 | index 1119414ab419..1d4e7fd3e66d 100644 |
1004 | --- a/arch/x86/kernel/sys_x86_64.c |
1005 | +++ b/arch/x86/kernel/sys_x86_64.c |
1006 | @@ -16,6 +16,7 @@ |
1007 | #include <linux/uaccess.h> |
1008 | #include <linux/elf.h> |
1009 | |
1010 | +#include <asm/compat.h> |
1011 | #include <asm/ia32.h> |
1012 | #include <asm/syscalls.h> |
1013 | |
1014 | @@ -100,7 +101,7 @@ SYSCALL_DEFINE6(mmap, unsigned long, addr, unsigned long, len, |
1015 | static void find_start_end(unsigned long flags, unsigned long *begin, |
1016 | unsigned long *end) |
1017 | { |
1018 | - if (!test_thread_flag(TIF_ADDR32) && (flags & MAP_32BIT)) { |
1019 | + if (!in_compat_syscall() && (flags & MAP_32BIT)) { |
1020 | /* This is usually used needed to map code in small |
1021 | model, so it needs to be in the first 31bit. Limit |
1022 | it to that. This means we need to move the |
1023 | @@ -175,7 +176,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0, |
1024 | return addr; |
1025 | |
1026 | /* for MAP_32BIT mappings we force the legacy mmap base */ |
1027 | - if (!test_thread_flag(TIF_ADDR32) && (flags & MAP_32BIT)) |
1028 | + if (!in_compat_syscall() && (flags & MAP_32BIT)) |
1029 | goto bottomup; |
1030 | |
1031 | /* requesting a specific address */ |
1032 | diff --git a/arch/x86/kernel/vm86_32.c b/arch/x86/kernel/vm86_32.c |
1033 | index 8a1d63591399..961831bf74b1 100644 |
1034 | --- a/arch/x86/kernel/vm86_32.c |
1035 | +++ b/arch/x86/kernel/vm86_32.c |
1036 | @@ -719,7 +719,8 @@ void handle_vm86_fault(struct kernel_vm86_regs *regs, long error_code) |
1037 | return; |
1038 | |
1039 | check_vip: |
1040 | - if (VEFLAGS & X86_EFLAGS_VIP) { |
1041 | + if ((VEFLAGS & (X86_EFLAGS_VIP | X86_EFLAGS_VIF)) == |
1042 | + (X86_EFLAGS_VIP | X86_EFLAGS_VIF)) { |
1043 | save_v86_state(regs, VM86_STI); |
1044 | return; |
1045 | } |
1046 | diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c |
1047 | index 24d2a3ee743f..8c99f2fbae80 100644 |
1048 | --- a/arch/x86/kvm/svm.c |
1049 | +++ b/arch/x86/kvm/svm.c |
1050 | @@ -5449,6 +5449,12 @@ static inline void avic_post_state_restore(struct kvm_vcpu *vcpu) |
1051 | avic_handle_ldr_update(vcpu); |
1052 | } |
1053 | |
1054 | +static void svm_setup_mce(struct kvm_vcpu *vcpu) |
1055 | +{ |
1056 | + /* [63:9] are reserved. */ |
1057 | + vcpu->arch.mcg_cap &= 0x1ff; |
1058 | +} |
1059 | + |
1060 | static struct kvm_x86_ops svm_x86_ops __ro_after_init = { |
1061 | .cpu_has_kvm_support = has_svm, |
1062 | .disabled_by_bios = is_disabled, |
1063 | @@ -5564,6 +5570,7 @@ static struct kvm_x86_ops svm_x86_ops __ro_after_init = { |
1064 | .pmu_ops = &amd_pmu_ops, |
1065 | .deliver_posted_interrupt = svm_deliver_avic_intr, |
1066 | .update_pi_irte = svm_update_pi_irte, |
1067 | + .setup_mce = svm_setup_mce, |
1068 | }; |
1069 | |
1070 | static int __init svm_init(void) |
1071 | diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c |
1072 | index 4b19ec1da22d..3aaaf305420d 100644 |
1073 | --- a/arch/x86/kvm/x86.c |
1074 | +++ b/arch/x86/kvm/x86.c |
1075 | @@ -3070,7 +3070,8 @@ static int kvm_vcpu_ioctl_x86_set_vcpu_events(struct kvm_vcpu *vcpu, |
1076 | return -EINVAL; |
1077 | |
1078 | if (events->exception.injected && |
1079 | - (events->exception.nr > 31 || events->exception.nr == NMI_VECTOR)) |
1080 | + (events->exception.nr > 31 || events->exception.nr == NMI_VECTOR || |
1081 | + is_guest_mode(vcpu))) |
1082 | return -EINVAL; |
1083 | |
1084 | /* INITs are latched while in SMM */ |
1085 | diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c |
1086 | index 74dea7f14c20..ae23c996e3a8 100644 |
1087 | --- a/arch/x86/mm/fault.c |
1088 | +++ b/arch/x86/mm/fault.c |
1089 | @@ -343,7 +343,7 @@ static noinline int vmalloc_fault(unsigned long address) |
1090 | if (!pmd_k) |
1091 | return -1; |
1092 | |
1093 | - if (pmd_huge(*pmd_k)) |
1094 | + if (pmd_large(*pmd_k)) |
1095 | return 0; |
1096 | |
1097 | pte_k = pte_offset_kernel(pmd_k, address); |
1098 | @@ -463,7 +463,7 @@ static noinline int vmalloc_fault(unsigned long address) |
1099 | if (pud_none(*pud) || pud_pfn(*pud) != pud_pfn(*pud_ref)) |
1100 | BUG(); |
1101 | |
1102 | - if (pud_huge(*pud)) |
1103 | + if (pud_large(*pud)) |
1104 | return 0; |
1105 | |
1106 | pmd = pmd_offset(pud, address); |
1107 | @@ -474,7 +474,7 @@ static noinline int vmalloc_fault(unsigned long address) |
1108 | if (pmd_none(*pmd) || pmd_pfn(*pmd) != pmd_pfn(*pmd_ref)) |
1109 | BUG(); |
1110 | |
1111 | - if (pmd_huge(*pmd)) |
1112 | + if (pmd_large(*pmd)) |
1113 | return 0; |
1114 | |
1115 | pte_ref = pte_offset_kernel(pmd_ref, address); |
1116 | diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c |
1117 | index b08ccbb9393a..6cd839c1f507 100644 |
1118 | --- a/block/blk-cgroup.c |
1119 | +++ b/block/blk-cgroup.c |
1120 | @@ -1078,10 +1078,8 @@ int blkcg_init_queue(struct request_queue *q) |
1121 | if (preloaded) |
1122 | radix_tree_preload_end(); |
1123 | |
1124 | - if (IS_ERR(blkg)) { |
1125 | - blkg_free(new_blkg); |
1126 | + if (IS_ERR(blkg)) |
1127 | return PTR_ERR(blkg); |
1128 | - } |
1129 | |
1130 | q->root_blkg = blkg; |
1131 | q->root_rl.blkg = blkg; |
1132 | diff --git a/block/blk-throttle.c b/block/blk-throttle.c |
1133 | index a3ea8260c94c..3a4c9a3c1427 100644 |
1134 | --- a/block/blk-throttle.c |
1135 | +++ b/block/blk-throttle.c |
1136 | @@ -499,6 +499,17 @@ static void throtl_dequeue_tg(struct throtl_grp *tg) |
1137 | static void throtl_schedule_pending_timer(struct throtl_service_queue *sq, |
1138 | unsigned long expires) |
1139 | { |
1140 | + unsigned long max_expire = jiffies + 8 * throtl_slice; |
1141 | + |
1142 | + /* |
1143 | + * Since we are adjusting the throttle limit dynamically, the sleep |
1144 | + * time calculated according to previous limit might be invalid. It's |
1145 | + * possible the cgroup sleep time is very long and no other cgroups |
1146 | + * have IO running so notify the limit changes. Make sure the cgroup |
1147 | + * doesn't sleep too long to avoid the missed notification. |
1148 | + */ |
1149 | + if (time_after(expires, max_expire)) |
1150 | + expires = max_expire; |
1151 | mod_timer(&sq->pending_timer, expires); |
1152 | throtl_log(sq, "schedule timer. delay=%lu jiffies=%lu", |
1153 | expires - jiffies, jiffies); |
1154 | diff --git a/drivers/char/agp/intel-gtt.c b/drivers/char/agp/intel-gtt.c |
1155 | index 0f7d28a98b9a..a7cc5b7be598 100644 |
1156 | --- a/drivers/char/agp/intel-gtt.c |
1157 | +++ b/drivers/char/agp/intel-gtt.c |
1158 | @@ -871,6 +871,8 @@ void intel_gtt_insert_sg_entries(struct sg_table *st, |
1159 | } |
1160 | } |
1161 | wmb(); |
1162 | + if (intel_private.driver->chipset_flush) |
1163 | + intel_private.driver->chipset_flush(); |
1164 | } |
1165 | EXPORT_SYMBOL(intel_gtt_insert_sg_entries); |
1166 | |
1167 | diff --git a/drivers/clk/meson/gxbb.c b/drivers/clk/meson/gxbb.c |
1168 | index 9d9af446bafc..37e05d6e010a 100644 |
1169 | --- a/drivers/clk/meson/gxbb.c |
1170 | +++ b/drivers/clk/meson/gxbb.c |
1171 | @@ -572,7 +572,7 @@ static MESON_GATE(gxbb_pl301, HHI_GCLK_MPEG0, 6); |
1172 | static MESON_GATE(gxbb_periphs, HHI_GCLK_MPEG0, 7); |
1173 | static MESON_GATE(gxbb_spicc, HHI_GCLK_MPEG0, 8); |
1174 | static MESON_GATE(gxbb_i2c, HHI_GCLK_MPEG0, 9); |
1175 | -static MESON_GATE(gxbb_sar_adc, HHI_GCLK_MPEG0, 10); |
1176 | +static MESON_GATE(gxbb_sana, HHI_GCLK_MPEG0, 10); |
1177 | static MESON_GATE(gxbb_smart_card, HHI_GCLK_MPEG0, 11); |
1178 | static MESON_GATE(gxbb_rng0, HHI_GCLK_MPEG0, 12); |
1179 | static MESON_GATE(gxbb_uart0, HHI_GCLK_MPEG0, 13); |
1180 | @@ -623,7 +623,7 @@ static MESON_GATE(gxbb_usb0_ddr_bridge, HHI_GCLK_MPEG2, 9); |
1181 | static MESON_GATE(gxbb_mmc_pclk, HHI_GCLK_MPEG2, 11); |
1182 | static MESON_GATE(gxbb_dvin, HHI_GCLK_MPEG2, 12); |
1183 | static MESON_GATE(gxbb_uart2, HHI_GCLK_MPEG2, 15); |
1184 | -static MESON_GATE(gxbb_sana, HHI_GCLK_MPEG2, 22); |
1185 | +static MESON_GATE(gxbb_sar_adc, HHI_GCLK_MPEG2, 22); |
1186 | static MESON_GATE(gxbb_vpu_intr, HHI_GCLK_MPEG2, 25); |
1187 | static MESON_GATE(gxbb_sec_ahb_ahb3_bridge, HHI_GCLK_MPEG2, 26); |
1188 | static MESON_GATE(gxbb_clk81_a53, HHI_GCLK_MPEG2, 29); |
1189 | diff --git a/drivers/clk/qcom/gcc-msm8916.c b/drivers/clk/qcom/gcc-msm8916.c |
1190 | index 5c4e193164d4..8dd71345b5d0 100644 |
1191 | --- a/drivers/clk/qcom/gcc-msm8916.c |
1192 | +++ b/drivers/clk/qcom/gcc-msm8916.c |
1193 | @@ -1437,6 +1437,7 @@ static const struct freq_tbl ftbl_codec_clk[] = { |
1194 | |
1195 | static struct clk_rcg2 codec_digcodec_clk_src = { |
1196 | .cmd_rcgr = 0x1c09c, |
1197 | + .mnd_width = 8, |
1198 | .hid_width = 5, |
1199 | .parent_map = gcc_xo_gpll1_emclk_sleep_map, |
1200 | .freq_tbl = ftbl_codec_clk, |
1201 | diff --git a/drivers/clk/qcom/mmcc-msm8996.c b/drivers/clk/qcom/mmcc-msm8996.c |
1202 | index ca97e1151797..3b171bef913a 100644 |
1203 | --- a/drivers/clk/qcom/mmcc-msm8996.c |
1204 | +++ b/drivers/clk/qcom/mmcc-msm8996.c |
1205 | @@ -2984,7 +2984,7 @@ static struct gdsc vfe1_gdsc = { |
1206 | .cxcs = (unsigned int []){ 0x36ac }, |
1207 | .cxc_count = 1, |
1208 | .pd = { |
1209 | - .name = "vfe0", |
1210 | + .name = "vfe1", |
1211 | }, |
1212 | .parent = &camss_gdsc.pd, |
1213 | .pwrsts = PWRSTS_OFF_ON, |
1214 | diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c |
1215 | index d1651a50c349..21726a270fc4 100644 |
1216 | --- a/drivers/dma/imx-sdma.c |
1217 | +++ b/drivers/dma/imx-sdma.c |
1218 | @@ -937,6 +937,21 @@ static int sdma_disable_channel(struct dma_chan *chan) |
1219 | return 0; |
1220 | } |
1221 | |
1222 | +static int sdma_disable_channel_with_delay(struct dma_chan *chan) |
1223 | +{ |
1224 | + sdma_disable_channel(chan); |
1225 | + |
1226 | + /* |
1227 | + * According to NXP R&D team a delay of one BD SDMA cost time |
1228 | + * (maximum is 1ms) should be added after disable of the channel |
1229 | + * bit, to ensure SDMA core has really been stopped after SDMA |
1230 | + * clients call .device_terminate_all. |
1231 | + */ |
1232 | + mdelay(1); |
1233 | + |
1234 | + return 0; |
1235 | +} |
1236 | + |
1237 | static void sdma_set_watermarklevel_for_p2p(struct sdma_channel *sdmac) |
1238 | { |
1239 | struct sdma_engine *sdma = sdmac->sdma; |
1240 | @@ -1828,7 +1843,7 @@ static int sdma_probe(struct platform_device *pdev) |
1241 | sdma->dma_device.device_prep_slave_sg = sdma_prep_slave_sg; |
1242 | sdma->dma_device.device_prep_dma_cyclic = sdma_prep_dma_cyclic; |
1243 | sdma->dma_device.device_config = sdma_config; |
1244 | - sdma->dma_device.device_terminate_all = sdma_disable_channel; |
1245 | + sdma->dma_device.device_terminate_all = sdma_disable_channel_with_delay; |
1246 | sdma->dma_device.src_addr_widths = BIT(DMA_SLAVE_BUSWIDTH_4_BYTES); |
1247 | sdma->dma_device.dst_addr_widths = BIT(DMA_SLAVE_BUSWIDTH_4_BYTES); |
1248 | sdma->dma_device.directions = BIT(DMA_DEV_TO_MEM) | BIT(DMA_MEM_TO_DEV); |
1249 | diff --git a/drivers/edac/altera_edac.c b/drivers/edac/altera_edac.c |
1250 | index 58d3e2b39b5b..61262a7a5c3a 100644 |
1251 | --- a/drivers/edac/altera_edac.c |
1252 | +++ b/drivers/edac/altera_edac.c |
1253 | @@ -1020,13 +1020,23 @@ altr_init_a10_ecc_block(struct device_node *np, u32 irq_mask, |
1254 | return ret; |
1255 | } |
1256 | |
1257 | +static int socfpga_is_a10(void) |
1258 | +{ |
1259 | + return of_machine_is_compatible("altr,socfpga-arria10"); |
1260 | +} |
1261 | + |
1262 | static int validate_parent_available(struct device_node *np); |
1263 | static const struct of_device_id altr_edac_a10_device_of_match[]; |
1264 | static int __init __maybe_unused altr_init_a10_ecc_device_type(char *compat) |
1265 | { |
1266 | int irq; |
1267 | - struct device_node *child, *np = of_find_compatible_node(NULL, NULL, |
1268 | - "altr,socfpga-a10-ecc-manager"); |
1269 | + struct device_node *child, *np; |
1270 | + |
1271 | + if (!socfpga_is_a10()) |
1272 | + return -ENODEV; |
1273 | + |
1274 | + np = of_find_compatible_node(NULL, NULL, |
1275 | + "altr,socfpga-a10-ecc-manager"); |
1276 | if (!np) { |
1277 | edac_printk(KERN_ERR, EDAC_DEVICE, "ECC Manager not found\n"); |
1278 | return -ENODEV; |
1279 | @@ -1542,8 +1552,12 @@ static const struct edac_device_prv_data a10_sdmmceccb_data = { |
1280 | static int __init socfpga_init_sdmmc_ecc(void) |
1281 | { |
1282 | int rc = -ENODEV; |
1283 | - struct device_node *child = of_find_compatible_node(NULL, NULL, |
1284 | - "altr,socfpga-sdmmc-ecc"); |
1285 | + struct device_node *child; |
1286 | + |
1287 | + if (!socfpga_is_a10()) |
1288 | + return -ENODEV; |
1289 | + |
1290 | + child = of_find_compatible_node(NULL, NULL, "altr,socfpga-sdmmc-ecc"); |
1291 | if (!child) { |
1292 | edac_printk(KERN_WARNING, EDAC_DEVICE, "SDMMC node not found\n"); |
1293 | return -ENODEV; |
1294 | diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c |
1295 | index c82b04b24bf9..e9311eb7b8d9 100644 |
1296 | --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c |
1297 | +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c |
1298 | @@ -69,25 +69,18 @@ void amdgpu_connector_hotplug(struct drm_connector *connector) |
1299 | /* don't do anything if sink is not display port, i.e., |
1300 | * passive dp->(dvi|hdmi) adaptor |
1301 | */ |
1302 | - if (dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT) { |
1303 | - int saved_dpms = connector->dpms; |
1304 | - /* Only turn off the display if it's physically disconnected */ |
1305 | - if (!amdgpu_display_hpd_sense(adev, amdgpu_connector->hpd.hpd)) { |
1306 | - drm_helper_connector_dpms(connector, DRM_MODE_DPMS_OFF); |
1307 | - } else if (amdgpu_atombios_dp_needs_link_train(amdgpu_connector)) { |
1308 | - /* Don't try to start link training before we |
1309 | - * have the dpcd */ |
1310 | - if (amdgpu_atombios_dp_get_dpcd(amdgpu_connector)) |
1311 | - return; |
1312 | - |
1313 | - /* set it to OFF so that drm_helper_connector_dpms() |
1314 | - * won't return immediately since the current state |
1315 | - * is ON at this point. |
1316 | - */ |
1317 | - connector->dpms = DRM_MODE_DPMS_OFF; |
1318 | - drm_helper_connector_dpms(connector, DRM_MODE_DPMS_ON); |
1319 | - } |
1320 | - connector->dpms = saved_dpms; |
1321 | + if (dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT && |
1322 | + amdgpu_display_hpd_sense(adev, amdgpu_connector->hpd.hpd) && |
1323 | + amdgpu_atombios_dp_needs_link_train(amdgpu_connector)) { |
1324 | + /* Don't start link training before we have the DPCD */ |
1325 | + if (amdgpu_atombios_dp_get_dpcd(amdgpu_connector)) |
1326 | + return; |
1327 | + |
1328 | + /* Turn the connector off and back on immediately, which |
1329 | + * will trigger link training |
1330 | + */ |
1331 | + drm_helper_connector_dpms(connector, DRM_MODE_DPMS_OFF); |
1332 | + drm_helper_connector_dpms(connector, DRM_MODE_DPMS_ON); |
1333 | } |
1334 | } |
1335 | } |
1336 | diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c |
1337 | index 083e2b429872..15a2d8f3725d 100644 |
1338 | --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c |
1339 | +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c |
1340 | @@ -533,6 +533,12 @@ amdgpu_user_framebuffer_create(struct drm_device *dev, |
1341 | return ERR_PTR(-ENOENT); |
1342 | } |
1343 | |
1344 | + /* Handle is imported dma-buf, so cannot be migrated to VRAM for scanout */ |
1345 | + if (obj->import_attach) { |
1346 | + DRM_DEBUG_KMS("Cannot create framebuffer from imported dma_buf\n"); |
1347 | + return ERR_PTR(-EINVAL); |
1348 | + } |
1349 | + |
1350 | amdgpu_fb = kzalloc(sizeof(*amdgpu_fb), GFP_KERNEL); |
1351 | if (amdgpu_fb == NULL) { |
1352 | drm_gem_object_unreference_unlocked(obj); |
1353 | diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c |
1354 | index a7ea9a3b454e..d5e4748e3300 100644 |
1355 | --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c |
1356 | +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c |
1357 | @@ -36,8 +36,6 @@ void amdgpu_gem_object_free(struct drm_gem_object *gobj) |
1358 | struct amdgpu_bo *robj = gem_to_amdgpu_bo(gobj); |
1359 | |
1360 | if (robj) { |
1361 | - if (robj->gem_base.import_attach) |
1362 | - drm_prime_gem_destroy(&robj->gem_base, robj->tbo.sg); |
1363 | amdgpu_mn_unregister(robj); |
1364 | amdgpu_bo_unref(&robj); |
1365 | } |
1366 | diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c |
1367 | index f3efb1c5dae9..5afe72778518 100644 |
1368 | --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c |
1369 | +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c |
1370 | @@ -94,6 +94,8 @@ static void amdgpu_ttm_bo_destroy(struct ttm_buffer_object *tbo) |
1371 | |
1372 | amdgpu_update_memory_usage(bo->adev, &bo->tbo.mem, NULL); |
1373 | |
1374 | + if (bo->gem_base.import_attach) |
1375 | + drm_prime_gem_destroy(&bo->gem_base, bo->tbo.sg); |
1376 | drm_gem_object_release(&bo->gem_base); |
1377 | amdgpu_bo_unref(&bo->parent); |
1378 | if (!list_empty(&bo->shadow_list)) { |
1379 | diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_topology.c b/drivers/gpu/drm/amd/amdkfd/kfd_topology.c |
1380 | index 1e5064749959..8c6e47c5507f 100644 |
1381 | --- a/drivers/gpu/drm/amd/amdkfd/kfd_topology.c |
1382 | +++ b/drivers/gpu/drm/amd/amdkfd/kfd_topology.c |
1383 | @@ -519,11 +519,17 @@ static ssize_t sysprops_show(struct kobject *kobj, struct attribute *attr, |
1384 | return ret; |
1385 | } |
1386 | |
1387 | +static void kfd_topology_kobj_release(struct kobject *kobj) |
1388 | +{ |
1389 | + kfree(kobj); |
1390 | +} |
1391 | + |
1392 | static const struct sysfs_ops sysprops_ops = { |
1393 | .show = sysprops_show, |
1394 | }; |
1395 | |
1396 | static struct kobj_type sysprops_type = { |
1397 | + .release = kfd_topology_kobj_release, |
1398 | .sysfs_ops = &sysprops_ops, |
1399 | }; |
1400 | |
1401 | @@ -559,6 +565,7 @@ static const struct sysfs_ops iolink_ops = { |
1402 | }; |
1403 | |
1404 | static struct kobj_type iolink_type = { |
1405 | + .release = kfd_topology_kobj_release, |
1406 | .sysfs_ops = &iolink_ops, |
1407 | }; |
1408 | |
1409 | @@ -586,6 +593,7 @@ static const struct sysfs_ops mem_ops = { |
1410 | }; |
1411 | |
1412 | static struct kobj_type mem_type = { |
1413 | + .release = kfd_topology_kobj_release, |
1414 | .sysfs_ops = &mem_ops, |
1415 | }; |
1416 | |
1417 | @@ -625,6 +633,7 @@ static const struct sysfs_ops cache_ops = { |
1418 | }; |
1419 | |
1420 | static struct kobj_type cache_type = { |
1421 | + .release = kfd_topology_kobj_release, |
1422 | .sysfs_ops = &cache_ops, |
1423 | }; |
1424 | |
1425 | @@ -747,6 +756,7 @@ static const struct sysfs_ops node_ops = { |
1426 | }; |
1427 | |
1428 | static struct kobj_type node_type = { |
1429 | + .release = kfd_topology_kobj_release, |
1430 | .sysfs_ops = &node_ops, |
1431 | }; |
1432 | |
1433 | diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c |
1434 | index c6b281aa762f..6b31e0474271 100644 |
1435 | --- a/drivers/gpu/drm/drm_edid.c |
1436 | +++ b/drivers/gpu/drm/drm_edid.c |
1437 | @@ -3347,8 +3347,7 @@ EXPORT_SYMBOL(drm_edid_get_monitor_name); |
1438 | * @edid: EDID to parse |
1439 | * |
1440 | * Fill the ELD (EDID-Like Data) buffer for passing to the audio driver. The |
1441 | - * Conn_Type, HDCP and Port_ID ELD fields are left for the graphics driver to |
1442 | - * fill in. |
1443 | + * HDCP and Port_ID ELD fields are left for the graphics driver to fill in. |
1444 | */ |
1445 | void drm_edid_to_eld(struct drm_connector *connector, struct edid *edid) |
1446 | { |
1447 | @@ -3426,6 +3425,12 @@ void drm_edid_to_eld(struct drm_connector *connector, struct edid *edid) |
1448 | } |
1449 | eld[5] |= total_sad_count << 4; |
1450 | |
1451 | + if (connector->connector_type == DRM_MODE_CONNECTOR_DisplayPort || |
1452 | + connector->connector_type == DRM_MODE_CONNECTOR_eDP) |
1453 | + eld[DRM_ELD_SAD_COUNT_CONN_TYPE] |= DRM_ELD_CONN_TYPE_DP; |
1454 | + else |
1455 | + eld[DRM_ELD_SAD_COUNT_CONN_TYPE] |= DRM_ELD_CONN_TYPE_HDMI; |
1456 | + |
1457 | eld[DRM_ELD_BASELINE_ELD_LEN] = |
1458 | DIV_ROUND_UP(drm_eld_calc_baseline_block_size(eld), 4); |
1459 | |
1460 | diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c |
1461 | index 48a6167f5e7b..00c815a7c414 100644 |
1462 | --- a/drivers/gpu/drm/drm_irq.c |
1463 | +++ b/drivers/gpu/drm/drm_irq.c |
1464 | @@ -1202,9 +1202,9 @@ static void drm_vblank_put(struct drm_device *dev, unsigned int pipe) |
1465 | if (atomic_dec_and_test(&vblank->refcount)) { |
1466 | if (drm_vblank_offdelay == 0) |
1467 | return; |
1468 | - else if (dev->vblank_disable_immediate || drm_vblank_offdelay < 0) |
1469 | + else if (drm_vblank_offdelay < 0) |
1470 | vblank_disable_fn((unsigned long)vblank); |
1471 | - else |
1472 | + else if (!dev->vblank_disable_immediate) |
1473 | mod_timer(&vblank->disable_timer, |
1474 | jiffies + ((drm_vblank_offdelay * HZ)/1000)); |
1475 | } |
1476 | @@ -1819,6 +1819,16 @@ bool drm_handle_vblank(struct drm_device *dev, unsigned int pipe) |
1477 | wake_up(&vblank->queue); |
1478 | drm_handle_vblank_events(dev, pipe); |
1479 | |
1480 | + /* With instant-off, we defer disabling the interrupt until after |
1481 | + * we finish processing the following vblank. The disable has to |
1482 | + * be last (after drm_handle_vblank_events) so that the timestamp |
1483 | + * is always accurate. |
1484 | + */ |
1485 | + if (dev->vblank_disable_immediate && |
1486 | + drm_vblank_offdelay > 0 && |
1487 | + !atomic_read(&vblank->refcount)) |
1488 | + vblank_disable_fn((unsigned long)vblank); |
1489 | + |
1490 | spin_unlock_irqrestore(&dev->event_lock, irqflags); |
1491 | |
1492 | return true; |
1493 | diff --git a/drivers/gpu/drm/qxl/qxl_fb.c b/drivers/gpu/drm/qxl/qxl_fb.c |
1494 | index 2cd879a4ae15..cdbb6e625f05 100644 |
1495 | --- a/drivers/gpu/drm/qxl/qxl_fb.c |
1496 | +++ b/drivers/gpu/drm/qxl/qxl_fb.c |
1497 | @@ -387,9 +387,11 @@ static const struct drm_fb_helper_funcs qxl_fb_helper_funcs = { |
1498 | |
1499 | int qxl_fbdev_init(struct qxl_device *qdev) |
1500 | { |
1501 | + int ret = 0; |
1502 | + |
1503 | +#ifdef CONFIG_DRM_FBDEV_EMULATION |
1504 | struct qxl_fbdev *qfbdev; |
1505 | int bpp_sel = 32; /* TODO: parameter from somewhere? */ |
1506 | - int ret; |
1507 | |
1508 | qfbdev = kzalloc(sizeof(struct qxl_fbdev), GFP_KERNEL); |
1509 | if (!qfbdev) |
1510 | @@ -423,6 +425,8 @@ int qxl_fbdev_init(struct qxl_device *qdev) |
1511 | drm_fb_helper_fini(&qfbdev->helper); |
1512 | free: |
1513 | kfree(qfbdev); |
1514 | +#endif |
1515 | + |
1516 | return ret; |
1517 | } |
1518 | |
1519 | @@ -438,6 +442,9 @@ void qxl_fbdev_fini(struct qxl_device *qdev) |
1520 | |
1521 | void qxl_fbdev_set_suspend(struct qxl_device *qdev, int state) |
1522 | { |
1523 | + if (!qdev->mode_info.qfbdev) |
1524 | + return; |
1525 | + |
1526 | drm_fb_helper_set_suspend(&qdev->mode_info.qfbdev->helper, state); |
1527 | } |
1528 | |
1529 | diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c |
1530 | index cdb8cb568c15..ca1caf405832 100644 |
1531 | --- a/drivers/gpu/drm/radeon/radeon_display.c |
1532 | +++ b/drivers/gpu/drm/radeon/radeon_display.c |
1533 | @@ -1352,6 +1352,12 @@ radeon_user_framebuffer_create(struct drm_device *dev, |
1534 | return ERR_PTR(-ENOENT); |
1535 | } |
1536 | |
1537 | + /* Handle is imported dma-buf, so cannot be migrated to VRAM for scanout */ |
1538 | + if (obj->import_attach) { |
1539 | + DRM_DEBUG_KMS("Cannot create framebuffer from imported dma_buf\n"); |
1540 | + return ERR_PTR(-EINVAL); |
1541 | + } |
1542 | + |
1543 | radeon_fb = kzalloc(sizeof(*radeon_fb), GFP_KERNEL); |
1544 | if (radeon_fb == NULL) { |
1545 | drm_gem_object_unreference_unlocked(obj); |
1546 | diff --git a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c |
1547 | index 3322b157106d..1c4d95dea887 100644 |
1548 | --- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c |
1549 | +++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c |
1550 | @@ -512,6 +512,13 @@ static void rcar_du_crtc_disable(struct drm_crtc *crtc) |
1551 | rcar_du_crtc_stop(rcrtc); |
1552 | rcar_du_crtc_put(rcrtc); |
1553 | |
1554 | + spin_lock_irq(&crtc->dev->event_lock); |
1555 | + if (crtc->state->event) { |
1556 | + drm_crtc_send_vblank_event(crtc, crtc->state->event); |
1557 | + crtc->state->event = NULL; |
1558 | + } |
1559 | + spin_unlock_irq(&crtc->dev->event_lock); |
1560 | + |
1561 | rcrtc->outputs = 0; |
1562 | } |
1563 | |
1564 | diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c |
1565 | index c7eba305c488..6e3c4acb16ac 100644 |
1566 | --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c |
1567 | +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c |
1568 | @@ -503,7 +503,7 @@ static int vop_enable(struct drm_crtc *crtc) |
1569 | ret = pm_runtime_get_sync(vop->dev); |
1570 | if (ret < 0) { |
1571 | dev_err(vop->dev, "failed to get pm runtime: %d\n", ret); |
1572 | - goto err_put_pm_runtime; |
1573 | + return ret; |
1574 | } |
1575 | |
1576 | ret = clk_enable(vop->hclk); |
1577 | @@ -1348,10 +1348,16 @@ static int vop_initial(struct vop *vop) |
1578 | return PTR_ERR(vop->dclk); |
1579 | } |
1580 | |
1581 | + ret = pm_runtime_get_sync(vop->dev); |
1582 | + if (ret < 0) { |
1583 | + dev_err(vop->dev, "failed to get pm runtime: %d\n", ret); |
1584 | + return ret; |
1585 | + } |
1586 | + |
1587 | ret = clk_prepare(vop->dclk); |
1588 | if (ret < 0) { |
1589 | dev_err(vop->dev, "failed to prepare dclk\n"); |
1590 | - return ret; |
1591 | + goto err_put_pm_runtime; |
1592 | } |
1593 | |
1594 | /* Enable both the hclk and aclk to setup the vop */ |
1595 | @@ -1411,6 +1417,8 @@ static int vop_initial(struct vop *vop) |
1596 | |
1597 | vop->is_enabled = false; |
1598 | |
1599 | + pm_runtime_put_sync(vop->dev); |
1600 | + |
1601 | return 0; |
1602 | |
1603 | err_disable_aclk: |
1604 | @@ -1419,6 +1427,8 @@ static int vop_initial(struct vop *vop) |
1605 | clk_disable_unprepare(vop->hclk); |
1606 | err_unprepare_dclk: |
1607 | clk_unprepare(vop->dclk); |
1608 | +err_put_pm_runtime: |
1609 | + pm_runtime_put_sync(vop->dev); |
1610 | return ret; |
1611 | } |
1612 | |
1613 | @@ -1519,12 +1529,6 @@ static int vop_bind(struct device *dev, struct device *master, void *data) |
1614 | if (!vop->regsbak) |
1615 | return -ENOMEM; |
1616 | |
1617 | - ret = vop_initial(vop); |
1618 | - if (ret < 0) { |
1619 | - dev_err(&pdev->dev, "cannot initial vop dev - err %d\n", ret); |
1620 | - return ret; |
1621 | - } |
1622 | - |
1623 | irq = platform_get_irq(pdev, 0); |
1624 | if (irq < 0) { |
1625 | dev_err(dev, "cannot find irq for vop\n"); |
1626 | @@ -1551,8 +1555,17 @@ static int vop_bind(struct device *dev, struct device *master, void *data) |
1627 | |
1628 | pm_runtime_enable(&pdev->dev); |
1629 | |
1630 | + ret = vop_initial(vop); |
1631 | + if (ret < 0) { |
1632 | + dev_err(&pdev->dev, "cannot initial vop dev - err %d\n", ret); |
1633 | + goto err_disable_pm_runtime; |
1634 | + } |
1635 | + |
1636 | return 0; |
1637 | |
1638 | +err_disable_pm_runtime: |
1639 | + pm_runtime_disable(&pdev->dev); |
1640 | + vop_destroy_crtc(vop); |
1641 | err_enable_irq: |
1642 | enable_irq(vop->irq); /* To balance out the disable_irq above */ |
1643 | return ret; |
1644 | diff --git a/drivers/gpu/drm/sun4i/sun4i_crtc.c b/drivers/gpu/drm/sun4i/sun4i_crtc.c |
1645 | index 4a192210574f..caba0311c86c 100644 |
1646 | --- a/drivers/gpu/drm/sun4i/sun4i_crtc.c |
1647 | +++ b/drivers/gpu/drm/sun4i/sun4i_crtc.c |
1648 | @@ -19,6 +19,7 @@ |
1649 | #include <linux/clk-provider.h> |
1650 | #include <linux/ioport.h> |
1651 | #include <linux/of_address.h> |
1652 | +#include <linux/of_graph.h> |
1653 | #include <linux/of_irq.h> |
1654 | #include <linux/regmap.h> |
1655 | |
1656 | @@ -136,5 +137,9 @@ struct sun4i_crtc *sun4i_crtc_init(struct drm_device *drm) |
1657 | |
1658 | drm_crtc_helper_add(&scrtc->crtc, &sun4i_crtc_helper_funcs); |
1659 | |
1660 | + /* Set crtc.port to output port node of the tcon */ |
1661 | + scrtc->crtc.port = of_graph_get_port_by_id(drv->tcon->dev->of_node, |
1662 | + 1); |
1663 | + |
1664 | return scrtc; |
1665 | } |
1666 | diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c b/drivers/gpu/drm/sun4i/sun4i_drv.c |
1667 | index 1feec34ca9dd..9e77fc034e0a 100644 |
1668 | --- a/drivers/gpu/drm/sun4i/sun4i_drv.c |
1669 | +++ b/drivers/gpu/drm/sun4i/sun4i_drv.c |
1670 | @@ -145,7 +145,7 @@ static int sun4i_drv_bind(struct device *dev) |
1671 | ret = component_bind_all(drm->dev, drm); |
1672 | if (ret) { |
1673 | dev_err(drm->dev, "Couldn't bind all pipelines components\n"); |
1674 | - goto free_drm; |
1675 | + goto cleanup_mode_config; |
1676 | } |
1677 | |
1678 | /* Create our layers */ |
1679 | @@ -153,7 +153,7 @@ static int sun4i_drv_bind(struct device *dev) |
1680 | if (IS_ERR(drv->layers)) { |
1681 | dev_err(drm->dev, "Couldn't create the planes\n"); |
1682 | ret = PTR_ERR(drv->layers); |
1683 | - goto free_drm; |
1684 | + goto cleanup_mode_config; |
1685 | } |
1686 | |
1687 | /* Create our CRTC */ |
1688 | @@ -161,7 +161,7 @@ static int sun4i_drv_bind(struct device *dev) |
1689 | if (!drv->crtc) { |
1690 | dev_err(drm->dev, "Couldn't create the CRTC\n"); |
1691 | ret = -EINVAL; |
1692 | - goto free_drm; |
1693 | + goto cleanup_mode_config; |
1694 | } |
1695 | drm->irq_enabled = true; |
1696 | |
1697 | @@ -173,7 +173,7 @@ static int sun4i_drv_bind(struct device *dev) |
1698 | if (IS_ERR(drv->fbdev)) { |
1699 | dev_err(drm->dev, "Couldn't create our framebuffer\n"); |
1700 | ret = PTR_ERR(drv->fbdev); |
1701 | - goto free_drm; |
1702 | + goto cleanup_mode_config; |
1703 | } |
1704 | |
1705 | /* Enable connectors polling */ |
1706 | @@ -181,10 +181,16 @@ static int sun4i_drv_bind(struct device *dev) |
1707 | |
1708 | ret = drm_dev_register(drm, 0); |
1709 | if (ret) |
1710 | - goto free_drm; |
1711 | + goto finish_poll; |
1712 | |
1713 | return 0; |
1714 | |
1715 | +finish_poll: |
1716 | + drm_kms_helper_poll_fini(drm); |
1717 | + sun4i_framebuffer_free(drm); |
1718 | +cleanup_mode_config: |
1719 | + drm_mode_config_cleanup(drm); |
1720 | + drm_vblank_cleanup(drm); |
1721 | free_drm: |
1722 | drm_dev_unref(drm); |
1723 | return ret; |
1724 | diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c |
1725 | index c6afb2448655..f2975a1525be 100644 |
1726 | --- a/drivers/gpu/drm/sun4i/sun4i_tcon.c |
1727 | +++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c |
1728 | @@ -336,12 +336,11 @@ static int sun4i_tcon_init_clocks(struct device *dev, |
1729 | } |
1730 | } |
1731 | |
1732 | - return sun4i_dclk_create(dev, tcon); |
1733 | + return 0; |
1734 | } |
1735 | |
1736 | static void sun4i_tcon_free_clocks(struct sun4i_tcon *tcon) |
1737 | { |
1738 | - sun4i_dclk_free(tcon); |
1739 | clk_disable_unprepare(tcon->clk); |
1740 | } |
1741 | |
1742 | @@ -506,22 +505,28 @@ static int sun4i_tcon_bind(struct device *dev, struct device *master, |
1743 | return ret; |
1744 | } |
1745 | |
1746 | + ret = sun4i_tcon_init_clocks(dev, tcon); |
1747 | + if (ret) { |
1748 | + dev_err(dev, "Couldn't init our TCON clocks\n"); |
1749 | + goto err_assert_reset; |
1750 | + } |
1751 | + |
1752 | ret = sun4i_tcon_init_regmap(dev, tcon); |
1753 | if (ret) { |
1754 | dev_err(dev, "Couldn't init our TCON regmap\n"); |
1755 | - goto err_assert_reset; |
1756 | + goto err_free_clocks; |
1757 | } |
1758 | |
1759 | - ret = sun4i_tcon_init_clocks(dev, tcon); |
1760 | + ret = sun4i_dclk_create(dev, tcon); |
1761 | if (ret) { |
1762 | - dev_err(dev, "Couldn't init our TCON clocks\n"); |
1763 | - goto err_assert_reset; |
1764 | + dev_err(dev, "Couldn't create our TCON dot clock\n"); |
1765 | + goto err_free_clocks; |
1766 | } |
1767 | |
1768 | ret = sun4i_tcon_init_irq(dev, tcon); |
1769 | if (ret) { |
1770 | dev_err(dev, "Couldn't init our TCON interrupts\n"); |
1771 | - goto err_free_clocks; |
1772 | + goto err_free_dotclock; |
1773 | } |
1774 | |
1775 | ret = sun4i_rgb_init(drm); |
1776 | @@ -530,6 +535,8 @@ static int sun4i_tcon_bind(struct device *dev, struct device *master, |
1777 | |
1778 | return 0; |
1779 | |
1780 | +err_free_dotclock: |
1781 | + sun4i_dclk_free(tcon); |
1782 | err_free_clocks: |
1783 | sun4i_tcon_free_clocks(tcon); |
1784 | err_assert_reset: |
1785 | @@ -542,6 +549,7 @@ static void sun4i_tcon_unbind(struct device *dev, struct device *master, |
1786 | { |
1787 | struct sun4i_tcon *tcon = dev_get_drvdata(dev); |
1788 | |
1789 | + sun4i_dclk_free(tcon); |
1790 | sun4i_tcon_free_clocks(tcon); |
1791 | } |
1792 | |
1793 | diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c |
1794 | index d09276ec7e90..52a2a1a75682 100644 |
1795 | --- a/drivers/gpu/drm/ttm/ttm_bo.c |
1796 | +++ b/drivers/gpu/drm/ttm/ttm_bo.c |
1797 | @@ -1209,18 +1209,20 @@ int ttm_bo_init(struct ttm_bo_device *bdev, |
1798 | if (likely(!ret)) |
1799 | ret = ttm_bo_validate(bo, placement, interruptible, false); |
1800 | |
1801 | - if (!resv) { |
1802 | + if (!resv) |
1803 | ttm_bo_unreserve(bo); |
1804 | |
1805 | - } else if (!(bo->mem.placement & TTM_PL_FLAG_NO_EVICT)) { |
1806 | + if (unlikely(ret)) { |
1807 | + ttm_bo_unref(&bo); |
1808 | + return ret; |
1809 | + } |
1810 | + |
1811 | + if (resv && !(bo->mem.placement & TTM_PL_FLAG_NO_EVICT)) { |
1812 | spin_lock(&bo->glob->lru_lock); |
1813 | ttm_bo_add_to_lru(bo); |
1814 | spin_unlock(&bo->glob->lru_lock); |
1815 | } |
1816 | |
1817 | - if (unlikely(ret)) |
1818 | - ttm_bo_unref(&bo); |
1819 | - |
1820 | return ret; |
1821 | } |
1822 | EXPORT_SYMBOL(ttm_bo_init); |
1823 | diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c b/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c |
1824 | index d2d93959b119..aec6e9eef489 100644 |
1825 | --- a/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c |
1826 | +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c |
1827 | @@ -433,7 +433,7 @@ static int vmw_fb_kms_detach(struct vmw_fb_par *par, |
1828 | set.y = 0; |
1829 | set.mode = NULL; |
1830 | set.fb = NULL; |
1831 | - set.num_connectors = 1; |
1832 | + set.num_connectors = 0; |
1833 | set.connectors = &par->con; |
1834 | ret = drm_mode_set_config_internal(&set); |
1835 | if (ret) { |
1836 | @@ -821,7 +821,9 @@ int vmw_fb_off(struct vmw_private *vmw_priv) |
1837 | flush_delayed_work(&par->local_work); |
1838 | |
1839 | mutex_lock(&par->bo_mutex); |
1840 | + drm_modeset_lock_all(vmw_priv->dev); |
1841 | (void) vmw_fb_kms_detach(par, true, false); |
1842 | + drm_modeset_unlock_all(vmw_priv->dev); |
1843 | mutex_unlock(&par->bo_mutex); |
1844 | |
1845 | return 0; |
1846 | diff --git a/drivers/hid/hid-elo.c b/drivers/hid/hid-elo.c |
1847 | index 0cd4f7216239..5eea6fe0d7bd 100644 |
1848 | --- a/drivers/hid/hid-elo.c |
1849 | +++ b/drivers/hid/hid-elo.c |
1850 | @@ -42,6 +42,12 @@ static int elo_input_configured(struct hid_device *hdev, |
1851 | { |
1852 | struct input_dev *input = hidinput->input; |
1853 | |
1854 | + /* |
1855 | + * ELO devices have one Button usage in GenDesk field, which makes |
1856 | + * hid-input map it to BTN_LEFT; that confuses userspace, which then |
1857 | + * considers the device to be a mouse/touchpad instead of touchscreen. |
1858 | + */ |
1859 | + clear_bit(BTN_LEFT, input->keybit); |
1860 | set_bit(BTN_TOUCH, input->keybit); |
1861 | set_bit(ABS_PRESSURE, input->absbit); |
1862 | input_set_abs_params(input, ABS_PRESSURE, 0, 256, 0, 0); |
1863 | diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c |
1864 | index fb9ace1cef8b..40233315d5f5 100644 |
1865 | --- a/drivers/hid/hid-input.c |
1866 | +++ b/drivers/hid/hid-input.c |
1867 | @@ -1149,18 +1149,26 @@ void hidinput_hid_event(struct hid_device *hid, struct hid_field *field, struct |
1868 | |
1869 | /* |
1870 | * Ignore out-of-range values as per HID specification, |
1871 | - * section 5.10 and 6.2.25. |
1872 | + * section 5.10 and 6.2.25, when NULL state bit is present. |
1873 | + * When it's not, clamp the value to match Microsoft's input |
1874 | + * driver as mentioned in "Required HID usages for digitizers": |
1875 | + * https://msdn.microsoft.com/en-us/library/windows/hardware/dn672278(v=vs.85).asp |
1876 | * |
1877 | * The logical_minimum < logical_maximum check is done so that we |
1878 | * don't unintentionally discard values sent by devices which |
1879 | * don't specify logical min and max. |
1880 | */ |
1881 | if ((field->flags & HID_MAIN_ITEM_VARIABLE) && |
1882 | - (field->logical_minimum < field->logical_maximum) && |
1883 | - (value < field->logical_minimum || |
1884 | - value > field->logical_maximum)) { |
1885 | - dbg_hid("Ignoring out-of-range value %x\n", value); |
1886 | - return; |
1887 | + (field->logical_minimum < field->logical_maximum)) { |
1888 | + if (field->flags & HID_MAIN_ITEM_NULL_STATE && |
1889 | + (value < field->logical_minimum || |
1890 | + value > field->logical_maximum)) { |
1891 | + dbg_hid("Ignoring out-of-range value %x\n", value); |
1892 | + return; |
1893 | + } |
1894 | + value = clamp(value, |
1895 | + field->logical_minimum, |
1896 | + field->logical_maximum); |
1897 | } |
1898 | |
1899 | /* |
1900 | diff --git a/drivers/hwmon/pmbus/adm1275.c b/drivers/hwmon/pmbus/adm1275.c |
1901 | index 3baa4f4a8c5e..d659a02647d4 100644 |
1902 | --- a/drivers/hwmon/pmbus/adm1275.c |
1903 | +++ b/drivers/hwmon/pmbus/adm1275.c |
1904 | @@ -101,8 +101,8 @@ static const struct coefficients adm1075_coefficients[] = { |
1905 | [0] = { 27169, 0, -1 }, /* voltage */ |
1906 | [1] = { 806, 20475, -1 }, /* current, irange25 */ |
1907 | [2] = { 404, 20475, -1 }, /* current, irange50 */ |
1908 | - [3] = { 0, -1, 8549 }, /* power, irange25 */ |
1909 | - [4] = { 0, -1, 4279 }, /* power, irange50 */ |
1910 | + [3] = { 8549, 0, -1 }, /* power, irange25 */ |
1911 | + [4] = { 4279, 0, -1 }, /* power, irange50 */ |
1912 | }; |
1913 | |
1914 | static const struct coefficients adm1275_coefficients[] = { |
1915 | diff --git a/drivers/hwtracing/coresight/of_coresight.c b/drivers/hwtracing/coresight/of_coresight.c |
1916 | index 629e031b7456..09142e99e915 100644 |
1917 | --- a/drivers/hwtracing/coresight/of_coresight.c |
1918 | +++ b/drivers/hwtracing/coresight/of_coresight.c |
1919 | @@ -149,7 +149,7 @@ struct coresight_platform_data *of_get_coresight_platform_data( |
1920 | continue; |
1921 | |
1922 | /* The local out port number */ |
1923 | - pdata->outports[i] = endpoint.id; |
1924 | + pdata->outports[i] = endpoint.port; |
1925 | |
1926 | /* |
1927 | * Get a handle on the remote port and parent |
1928 | diff --git a/drivers/infiniband/hw/hfi1/chip.c b/drivers/infiniband/hw/hfi1/chip.c |
1929 | index 4682909b021b..3be62ef154d1 100644 |
1930 | --- a/drivers/infiniband/hw/hfi1/chip.c |
1931 | +++ b/drivers/infiniband/hw/hfi1/chip.c |
1932 | @@ -9489,8 +9489,11 @@ static int test_qsfp_read(struct hfi1_pportdata *ppd) |
1933 | int ret; |
1934 | u8 status; |
1935 | |
1936 | - /* report success if not a QSFP */ |
1937 | - if (ppd->port_type != PORT_TYPE_QSFP) |
1938 | + /* |
1939 | + * Report success if not a QSFP or, if it is a QSFP, but the cable is |
1940 | + * not present |
1941 | + */ |
1942 | + if (ppd->port_type != PORT_TYPE_QSFP || !qsfp_mod_present(ppd)) |
1943 | return 0; |
1944 | |
1945 | /* read byte 2, the status byte */ |
1946 | diff --git a/drivers/input/keyboard/qt1070.c b/drivers/input/keyboard/qt1070.c |
1947 | index 5a5778729e37..76bb51309a78 100644 |
1948 | --- a/drivers/input/keyboard/qt1070.c |
1949 | +++ b/drivers/input/keyboard/qt1070.c |
1950 | @@ -274,9 +274,18 @@ static const struct i2c_device_id qt1070_id[] = { |
1951 | }; |
1952 | MODULE_DEVICE_TABLE(i2c, qt1070_id); |
1953 | |
1954 | +#ifdef CONFIG_OF |
1955 | +static const struct of_device_id qt1070_of_match[] = { |
1956 | + { .compatible = "qt1070", }, |
1957 | + { }, |
1958 | +}; |
1959 | +MODULE_DEVICE_TABLE(of, qt1070_of_match); |
1960 | +#endif |
1961 | + |
1962 | static struct i2c_driver qt1070_driver = { |
1963 | .driver = { |
1964 | .name = "qt1070", |
1965 | + .of_match_table = of_match_ptr(qt1070_of_match), |
1966 | .pm = &qt1070_pm_ops, |
1967 | }, |
1968 | .id_table = qt1070_id, |
1969 | diff --git a/drivers/input/touchscreen/tsc2007.c b/drivers/input/touchscreen/tsc2007.c |
1970 | index 5d0cd51c6f41..a4b7b4c3d27b 100644 |
1971 | --- a/drivers/input/touchscreen/tsc2007.c |
1972 | +++ b/drivers/input/touchscreen/tsc2007.c |
1973 | @@ -455,6 +455,14 @@ static int tsc2007_probe(struct i2c_client *client, |
1974 | |
1975 | tsc2007_stop(ts); |
1976 | |
1977 | + /* power down the chip (TSC2007_SETUP does not ACK on I2C) */ |
1978 | + err = tsc2007_xfer(ts, PWRDOWN); |
1979 | + if (err < 0) { |
1980 | + dev_err(&client->dev, |
1981 | + "Failed to setup chip: %d\n", err); |
1982 | + return err; /* usually, chip does not respond */ |
1983 | + } |
1984 | + |
1985 | err = input_register_device(input_dev); |
1986 | if (err) { |
1987 | dev_err(&client->dev, |
1988 | diff --git a/drivers/iommu/iova.c b/drivers/iommu/iova.c |
1989 | index e23001bfcfee..f106fd9782bf 100644 |
1990 | --- a/drivers/iommu/iova.c |
1991 | +++ b/drivers/iommu/iova.c |
1992 | @@ -138,7 +138,7 @@ static int __alloc_and_insert_iova_range(struct iova_domain *iovad, |
1993 | break; /* found a free slot */ |
1994 | } |
1995 | adjust_limit_pfn: |
1996 | - limit_pfn = curr_iova->pfn_lo - 1; |
1997 | + limit_pfn = curr_iova->pfn_lo ? (curr_iova->pfn_lo - 1) : 0; |
1998 | move_left: |
1999 | prev = curr; |
2000 | curr = rb_prev(curr); |
2001 | diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c |
2002 | index acb9d250a905..ac15e5d5d9b2 100644 |
2003 | --- a/drivers/irqchip/irq-gic-v3-its.c |
2004 | +++ b/drivers/irqchip/irq-gic-v3-its.c |
2005 | @@ -684,7 +684,7 @@ static struct irq_chip its_irq_chip = { |
2006 | * This gives us (((1UL << id_bits) - 8192) >> 5) possible allocations. |
2007 | */ |
2008 | #define IRQS_PER_CHUNK_SHIFT 5 |
2009 | -#define IRQS_PER_CHUNK (1 << IRQS_PER_CHUNK_SHIFT) |
2010 | +#define IRQS_PER_CHUNK (1UL << IRQS_PER_CHUNK_SHIFT) |
2011 | |
2012 | static unsigned long *lpi_bitmap; |
2013 | static u32 lpi_chunks; |
2014 | @@ -1320,11 +1320,10 @@ static struct its_device *its_create_device(struct its_node *its, u32 dev_id, |
2015 | |
2016 | dev = kzalloc(sizeof(*dev), GFP_KERNEL); |
2017 | /* |
2018 | - * At least one bit of EventID is being used, hence a minimum |
2019 | - * of two entries. No, the architecture doesn't let you |
2020 | - * express an ITT with a single entry. |
2021 | + * We allocate at least one chunk worth of LPIs bet device, |
2022 | + * and thus that many ITEs. The device may require less though. |
2023 | */ |
2024 | - nr_ites = max(2UL, roundup_pow_of_two(nvecs)); |
2025 | + nr_ites = max(IRQS_PER_CHUNK, roundup_pow_of_two(nvecs)); |
2026 | sz = nr_ites * its->ite_size; |
2027 | sz = max(sz, ITS_ITT_ALIGN) + ITS_ITT_ALIGN - 1; |
2028 | itt = kzalloc(sz, GFP_KERNEL); |
2029 | diff --git a/drivers/leds/leds-pm8058.c b/drivers/leds/leds-pm8058.c |
2030 | index a52674327857..8988ba3b2d65 100644 |
2031 | --- a/drivers/leds/leds-pm8058.c |
2032 | +++ b/drivers/leds/leds-pm8058.c |
2033 | @@ -106,7 +106,7 @@ static int pm8058_led_probe(struct platform_device *pdev) |
2034 | if (!led) |
2035 | return -ENOMEM; |
2036 | |
2037 | - led->ledtype = (u32)of_device_get_match_data(&pdev->dev); |
2038 | + led->ledtype = (u32)(unsigned long)of_device_get_match_data(&pdev->dev); |
2039 | |
2040 | map = dev_get_regmap(pdev->dev.parent, NULL); |
2041 | if (!map) { |
2042 | diff --git a/drivers/md/md.c b/drivers/md/md.c |
2043 | index 27d8bb21e04f..a7bc70334f0e 100644 |
2044 | --- a/drivers/md/md.c |
2045 | +++ b/drivers/md/md.c |
2046 | @@ -4826,8 +4826,10 @@ array_size_store(struct mddev *mddev, const char *buf, size_t len) |
2047 | return err; |
2048 | |
2049 | /* cluster raid doesn't support change array_sectors */ |
2050 | - if (mddev_is_clustered(mddev)) |
2051 | + if (mddev_is_clustered(mddev)) { |
2052 | + mddev_unlock(mddev); |
2053 | return -EINVAL; |
2054 | + } |
2055 | |
2056 | if (strncmp(buf, "default", 7) == 0) { |
2057 | if (mddev->pers) |
2058 | diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c |
2059 | index 475a7a1bcfe0..4493be50fc6a 100644 |
2060 | --- a/drivers/md/raid5.c |
2061 | +++ b/drivers/md/raid5.c |
2062 | @@ -3391,9 +3391,20 @@ static int fetch_block(struct stripe_head *sh, struct stripe_head_state *s, |
2063 | BUG_ON(test_bit(R5_Wantcompute, &dev->flags)); |
2064 | BUG_ON(test_bit(R5_Wantread, &dev->flags)); |
2065 | BUG_ON(sh->batch_head); |
2066 | + |
2067 | + /* |
2068 | + * In the raid6 case if the only non-uptodate disk is P |
2069 | + * then we already trusted P to compute the other failed |
2070 | + * drives. It is safe to compute rather than re-read P. |
2071 | + * In other cases we only compute blocks from failed |
2072 | + * devices, otherwise check/repair might fail to detect |
2073 | + * a real inconsistency. |
2074 | + */ |
2075 | + |
2076 | if ((s->uptodate == disks - 1) && |
2077 | + ((sh->qd_idx >= 0 && sh->pd_idx == disk_idx) || |
2078 | (s->failed && (disk_idx == s->failed_num[0] || |
2079 | - disk_idx == s->failed_num[1]))) { |
2080 | + disk_idx == s->failed_num[1])))) { |
2081 | /* have disk failed, and we're requested to fetch it; |
2082 | * do compute it |
2083 | */ |
2084 | diff --git a/drivers/media/i2c/soc_camera/ov6650.c b/drivers/media/i2c/soc_camera/ov6650.c |
2085 | index 4bf2995e1cb8..8f85910eda5d 100644 |
2086 | --- a/drivers/media/i2c/soc_camera/ov6650.c |
2087 | +++ b/drivers/media/i2c/soc_camera/ov6650.c |
2088 | @@ -1033,7 +1033,7 @@ static int ov6650_probe(struct i2c_client *client, |
2089 | priv->code = MEDIA_BUS_FMT_YUYV8_2X8; |
2090 | priv->colorspace = V4L2_COLORSPACE_JPEG; |
2091 | |
2092 | - priv->clk = v4l2_clk_get(&client->dev, "mclk"); |
2093 | + priv->clk = v4l2_clk_get(&client->dev, NULL); |
2094 | if (IS_ERR(priv->clk)) { |
2095 | ret = PTR_ERR(priv->clk); |
2096 | goto eclkget; |
2097 | diff --git a/drivers/media/pci/solo6x10/solo6x10-v4l2.c b/drivers/media/pci/solo6x10/solo6x10-v4l2.c |
2098 | index b4be47969b6b..e17d6b945c07 100644 |
2099 | --- a/drivers/media/pci/solo6x10/solo6x10-v4l2.c |
2100 | +++ b/drivers/media/pci/solo6x10/solo6x10-v4l2.c |
2101 | @@ -341,6 +341,17 @@ static void solo_stop_streaming(struct vb2_queue *q) |
2102 | struct solo_dev *solo_dev = vb2_get_drv_priv(q); |
2103 | |
2104 | solo_stop_thread(solo_dev); |
2105 | + |
2106 | + spin_lock(&solo_dev->slock); |
2107 | + while (!list_empty(&solo_dev->vidq_active)) { |
2108 | + struct solo_vb2_buf *buf = list_entry( |
2109 | + solo_dev->vidq_active.next, |
2110 | + struct solo_vb2_buf, list); |
2111 | + |
2112 | + list_del(&buf->list); |
2113 | + vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR); |
2114 | + } |
2115 | + spin_unlock(&solo_dev->slock); |
2116 | INIT_LIST_HEAD(&solo_dev->vidq_active); |
2117 | } |
2118 | |
2119 | diff --git a/drivers/media/platform/vsp1/vsp1_drm.c b/drivers/media/platform/vsp1/vsp1_drm.c |
2120 | index cd209dccff1b..8e2aa3f8e52f 100644 |
2121 | --- a/drivers/media/platform/vsp1/vsp1_drm.c |
2122 | +++ b/drivers/media/platform/vsp1/vsp1_drm.c |
2123 | @@ -596,6 +596,7 @@ int vsp1_drm_init(struct vsp1_device *vsp1) |
2124 | pipe->bru = &vsp1->bru->entity; |
2125 | pipe->lif = &vsp1->lif->entity; |
2126 | pipe->output = vsp1->wpf[0]; |
2127 | + pipe->output->pipe = pipe; |
2128 | |
2129 | return 0; |
2130 | } |
2131 | diff --git a/drivers/media/platform/vsp1/vsp1_drv.c b/drivers/media/platform/vsp1/vsp1_drv.c |
2132 | index 57c713a4e1df..4ac1ff482a0b 100644 |
2133 | --- a/drivers/media/platform/vsp1/vsp1_drv.c |
2134 | +++ b/drivers/media/platform/vsp1/vsp1_drv.c |
2135 | @@ -509,7 +509,13 @@ static int __maybe_unused vsp1_pm_suspend(struct device *dev) |
2136 | { |
2137 | struct vsp1_device *vsp1 = dev_get_drvdata(dev); |
2138 | |
2139 | - vsp1_pipelines_suspend(vsp1); |
2140 | + /* |
2141 | + * When used as part of a display pipeline, the VSP is stopped and |
2142 | + * restarted explicitly by the DU. |
2143 | + */ |
2144 | + if (!vsp1->drm) |
2145 | + vsp1_pipelines_suspend(vsp1); |
2146 | + |
2147 | pm_runtime_force_suspend(vsp1->dev); |
2148 | |
2149 | return 0; |
2150 | @@ -520,7 +526,13 @@ static int __maybe_unused vsp1_pm_resume(struct device *dev) |
2151 | struct vsp1_device *vsp1 = dev_get_drvdata(dev); |
2152 | |
2153 | pm_runtime_force_resume(vsp1->dev); |
2154 | - vsp1_pipelines_resume(vsp1); |
2155 | + |
2156 | + /* |
2157 | + * When used as part of a display pipeline, the VSP is stopped and |
2158 | + * restarted explicitly by the DU. |
2159 | + */ |
2160 | + if (!vsp1->drm) |
2161 | + vsp1_pipelines_resume(vsp1); |
2162 | |
2163 | return 0; |
2164 | } |
2165 | diff --git a/drivers/media/platform/vsp1/vsp1_video.c b/drivers/media/platform/vsp1/vsp1_video.c |
2166 | index d351b9c768d2..743aa0febc09 100644 |
2167 | --- a/drivers/media/platform/vsp1/vsp1_video.c |
2168 | +++ b/drivers/media/platform/vsp1/vsp1_video.c |
2169 | @@ -792,6 +792,7 @@ static int vsp1_video_start_streaming(struct vb2_queue *vq, unsigned int count) |
2170 | { |
2171 | struct vsp1_video *video = vb2_get_drv_priv(vq); |
2172 | struct vsp1_pipeline *pipe = video->rwpf->pipe; |
2173 | + bool start_pipeline = false; |
2174 | unsigned long flags; |
2175 | int ret; |
2176 | |
2177 | @@ -802,11 +803,23 @@ static int vsp1_video_start_streaming(struct vb2_queue *vq, unsigned int count) |
2178 | mutex_unlock(&pipe->lock); |
2179 | return ret; |
2180 | } |
2181 | + |
2182 | + start_pipeline = true; |
2183 | } |
2184 | |
2185 | pipe->stream_count++; |
2186 | mutex_unlock(&pipe->lock); |
2187 | |
2188 | + /* |
2189 | + * vsp1_pipeline_ready() is not sufficient to establish that all streams |
2190 | + * are prepared and the pipeline is configured, as multiple streams |
2191 | + * can race through streamon with buffers already queued; Therefore we |
2192 | + * don't even attempt to start the pipeline until the last stream has |
2193 | + * called through here. |
2194 | + */ |
2195 | + if (!start_pipeline) |
2196 | + return 0; |
2197 | + |
2198 | spin_lock_irqsave(&pipe->irqlock, flags); |
2199 | if (vsp1_pipeline_ready(pipe)) |
2200 | vsp1_video_pipeline_run(pipe); |
2201 | diff --git a/drivers/media/usb/cpia2/cpia2_v4l.c b/drivers/media/usb/cpia2/cpia2_v4l.c |
2202 | index 9caea8344547..d793c630f1dd 100644 |
2203 | --- a/drivers/media/usb/cpia2/cpia2_v4l.c |
2204 | +++ b/drivers/media/usb/cpia2/cpia2_v4l.c |
2205 | @@ -812,7 +812,7 @@ static int cpia2_querybuf(struct file *file, void *fh, struct v4l2_buffer *buf) |
2206 | struct camera_data *cam = video_drvdata(file); |
2207 | |
2208 | if(buf->type != V4L2_BUF_TYPE_VIDEO_CAPTURE || |
2209 | - buf->index > cam->num_frames) |
2210 | + buf->index >= cam->num_frames) |
2211 | return -EINVAL; |
2212 | |
2213 | buf->m.offset = cam->buffers[buf->index].data - cam->frame_buffer; |
2214 | @@ -863,7 +863,7 @@ static int cpia2_qbuf(struct file *file, void *fh, struct v4l2_buffer *buf) |
2215 | |
2216 | if(buf->type != V4L2_BUF_TYPE_VIDEO_CAPTURE || |
2217 | buf->memory != V4L2_MEMORY_MMAP || |
2218 | - buf->index > cam->num_frames) |
2219 | + buf->index >= cam->num_frames) |
2220 | return -EINVAL; |
2221 | |
2222 | DBG("QBUF #%d\n", buf->index); |
2223 | diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile |
2224 | index 31983366090a..2bf79ba4a39e 100644 |
2225 | --- a/drivers/misc/Makefile |
2226 | +++ b/drivers/misc/Makefile |
2227 | @@ -61,6 +61,8 @@ lkdtm-$(CONFIG_LKDTM) += lkdtm_perms.o |
2228 | lkdtm-$(CONFIG_LKDTM) += lkdtm_rodata_objcopy.o |
2229 | lkdtm-$(CONFIG_LKDTM) += lkdtm_usercopy.o |
2230 | |
2231 | +KCOV_INSTRUMENT_lkdtm_rodata.o := n |
2232 | + |
2233 | OBJCOPYFLAGS := |
2234 | OBJCOPYFLAGS_lkdtm_rodata_objcopy.o := \ |
2235 | --set-section-flags .text=alloc,readonly \ |
2236 | diff --git a/drivers/misc/enclosure.c b/drivers/misc/enclosure.c |
2237 | index cc91f7b3d90c..eb29113e0bac 100644 |
2238 | --- a/drivers/misc/enclosure.c |
2239 | +++ b/drivers/misc/enclosure.c |
2240 | @@ -148,7 +148,7 @@ enclosure_register(struct device *dev, const char *name, int components, |
2241 | for (i = 0; i < components; i++) { |
2242 | edev->component[i].number = -1; |
2243 | edev->component[i].slot = -1; |
2244 | - edev->component[i].power_status = 1; |
2245 | + edev->component[i].power_status = -1; |
2246 | } |
2247 | |
2248 | mutex_lock(&container_list_lock); |
2249 | @@ -600,6 +600,11 @@ static ssize_t get_component_power_status(struct device *cdev, |
2250 | |
2251 | if (edev->cb->get_power_status) |
2252 | edev->cb->get_power_status(edev, ecomp); |
2253 | + |
2254 | + /* If still uninitialized, the callback failed or does not exist. */ |
2255 | + if (ecomp->power_status == -1) |
2256 | + return (edev->cb->get_power_status) ? -EIO : -ENOTTY; |
2257 | + |
2258 | return snprintf(buf, 40, "%s\n", ecomp->power_status ? "on" : "off"); |
2259 | } |
2260 | |
2261 | diff --git a/drivers/mtd/nand/fsl_ifc_nand.c b/drivers/mtd/nand/fsl_ifc_nand.c |
2262 | index d1570f512f0b..f8f12ccc6471 100644 |
2263 | --- a/drivers/mtd/nand/fsl_ifc_nand.c |
2264 | +++ b/drivers/mtd/nand/fsl_ifc_nand.c |
2265 | @@ -907,6 +907,13 @@ static int fsl_ifc_chip_init(struct fsl_ifc_mtd *priv) |
2266 | if (ctrl->version == FSL_IFC_VERSION_1_1_0) |
2267 | fsl_ifc_sram_init(priv); |
2268 | |
2269 | + /* |
2270 | + * As IFC version 2.0.0 has 16KB of internal SRAM as compared to older |
2271 | + * versions which had 8KB. Hence bufnum mask needs to be updated. |
2272 | + */ |
2273 | + if (ctrl->version >= FSL_IFC_VERSION_2_0_0) |
2274 | + priv->bufnum_mask = (priv->bufnum_mask * 2) + 1; |
2275 | + |
2276 | return 0; |
2277 | } |
2278 | |
2279 | diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c |
2280 | index 21c03086bb7f..a3e86e52640a 100644 |
2281 | --- a/drivers/mtd/nand/nand_base.c |
2282 | +++ b/drivers/mtd/nand/nand_base.c |
2283 | @@ -715,7 +715,8 @@ static void nand_command(struct mtd_info *mtd, unsigned int command, |
2284 | chip->cmd_ctrl(mtd, readcmd, ctrl); |
2285 | ctrl &= ~NAND_CTRL_CHANGE; |
2286 | } |
2287 | - chip->cmd_ctrl(mtd, command, ctrl); |
2288 | + if (command != NAND_CMD_NONE) |
2289 | + chip->cmd_ctrl(mtd, command, ctrl); |
2290 | |
2291 | /* Address cycle, when necessary */ |
2292 | ctrl = NAND_CTRL_ALE | NAND_CTRL_CHANGE; |
2293 | @@ -744,6 +745,7 @@ static void nand_command(struct mtd_info *mtd, unsigned int command, |
2294 | */ |
2295 | switch (command) { |
2296 | |
2297 | + case NAND_CMD_NONE: |
2298 | case NAND_CMD_PAGEPROG: |
2299 | case NAND_CMD_ERASE1: |
2300 | case NAND_CMD_ERASE2: |
2301 | @@ -806,7 +808,9 @@ static void nand_command_lp(struct mtd_info *mtd, unsigned int command, |
2302 | } |
2303 | |
2304 | /* Command latch cycle */ |
2305 | - chip->cmd_ctrl(mtd, command, NAND_NCE | NAND_CLE | NAND_CTRL_CHANGE); |
2306 | + if (command != NAND_CMD_NONE) |
2307 | + chip->cmd_ctrl(mtd, command, |
2308 | + NAND_NCE | NAND_CLE | NAND_CTRL_CHANGE); |
2309 | |
2310 | if (column != -1 || page_addr != -1) { |
2311 | int ctrl = NAND_CTRL_CHANGE | NAND_NCE | NAND_ALE; |
2312 | @@ -842,6 +846,7 @@ static void nand_command_lp(struct mtd_info *mtd, unsigned int command, |
2313 | */ |
2314 | switch (command) { |
2315 | |
2316 | + case NAND_CMD_NONE: |
2317 | case NAND_CMD_CACHEDPROG: |
2318 | case NAND_CMD_PAGEPROG: |
2319 | case NAND_CMD_ERASE1: |
2320 | diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c |
2321 | index 63d61c084815..c3f3096b24ae 100644 |
2322 | --- a/drivers/net/bonding/bond_main.c |
2323 | +++ b/drivers/net/bonding/bond_main.c |
2324 | @@ -371,9 +371,10 @@ int bond_set_carrier(struct bonding *bond) |
2325 | /* Get link speed and duplex from the slave's base driver |
2326 | * using ethtool. If for some reason the call fails or the |
2327 | * values are invalid, set speed and duplex to -1, |
2328 | - * and return. |
2329 | + * and return. Return 1 if speed or duplex settings are |
2330 | + * UNKNOWN; 0 otherwise. |
2331 | */ |
2332 | -static void bond_update_speed_duplex(struct slave *slave) |
2333 | +static int bond_update_speed_duplex(struct slave *slave) |
2334 | { |
2335 | struct net_device *slave_dev = slave->dev; |
2336 | struct ethtool_link_ksettings ecmd; |
2337 | @@ -383,24 +384,27 @@ static void bond_update_speed_duplex(struct slave *slave) |
2338 | slave->duplex = DUPLEX_UNKNOWN; |
2339 | |
2340 | res = __ethtool_get_link_ksettings(slave_dev, &ecmd); |
2341 | - if (res < 0) |
2342 | - return; |
2343 | - |
2344 | - if (ecmd.base.speed == 0 || ecmd.base.speed == ((__u32)-1)) |
2345 | - return; |
2346 | - |
2347 | + if (res < 0) { |
2348 | + slave->link = BOND_LINK_DOWN; |
2349 | + return 1; |
2350 | + } |
2351 | + if (ecmd.base.speed == 0 || ecmd.base.speed == ((__u32)-1)) { |
2352 | + slave->link = BOND_LINK_DOWN; |
2353 | + return 1; |
2354 | + } |
2355 | switch (ecmd.base.duplex) { |
2356 | case DUPLEX_FULL: |
2357 | case DUPLEX_HALF: |
2358 | break; |
2359 | default: |
2360 | - return; |
2361 | + slave->link = BOND_LINK_DOWN; |
2362 | + return 1; |
2363 | } |
2364 | |
2365 | slave->speed = ecmd.base.speed; |
2366 | slave->duplex = ecmd.base.duplex; |
2367 | |
2368 | - return; |
2369 | + return 0; |
2370 | } |
2371 | |
2372 | const char *bond_slave_link_status(s8 link) |
2373 | @@ -3327,12 +3331,17 @@ static void bond_fold_stats(struct rtnl_link_stats64 *_res, |
2374 | for (i = 0; i < sizeof(*_res) / sizeof(u64); i++) { |
2375 | u64 nv = new[i]; |
2376 | u64 ov = old[i]; |
2377 | + s64 delta = nv - ov; |
2378 | |
2379 | /* detects if this particular field is 32bit only */ |
2380 | if (((nv | ov) >> 32) == 0) |
2381 | - res[i] += (u32)nv - (u32)ov; |
2382 | - else |
2383 | - res[i] += nv - ov; |
2384 | + delta = (s64)(s32)((u32)nv - (u32)ov); |
2385 | + |
2386 | + /* filter anomalies, some drivers reset their stats |
2387 | + * at down/up events. |
2388 | + */ |
2389 | + if (delta > 0) |
2390 | + res[i] += delta; |
2391 | } |
2392 | } |
2393 | |
2394 | diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c b/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c |
2395 | index 5390ae89136c..71611bd6384b 100644 |
2396 | --- a/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c |
2397 | +++ b/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c |
2398 | @@ -560,6 +560,7 @@ static void xgene_enet_cle_bypass(struct xgene_enet_pdata *pdata, |
2399 | xgene_enet_rd_csr(pdata, CLE_BYPASS_REG0_0_ADDR, &cb); |
2400 | cb |= CFG_CLE_BYPASS_EN0; |
2401 | CFG_CLE_IP_PROTOCOL0_SET(&cb, 3); |
2402 | + CFG_CLE_IP_HDR_LEN_SET(&cb, 0); |
2403 | xgene_enet_wr_csr(pdata, CLE_BYPASS_REG0_0_ADDR, cb); |
2404 | |
2405 | xgene_enet_rd_csr(pdata, CLE_BYPASS_REG1_0_ADDR, &cb); |
2406 | diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_hw.h b/drivers/net/ethernet/apm/xgene/xgene_enet_hw.h |
2407 | index 06e598c8bc16..c82faf1a88b8 100644 |
2408 | --- a/drivers/net/ethernet/apm/xgene/xgene_enet_hw.h |
2409 | +++ b/drivers/net/ethernet/apm/xgene/xgene_enet_hw.h |
2410 | @@ -163,6 +163,7 @@ enum xgene_enet_rm { |
2411 | #define CFG_RXCLK_MUXSEL0_SET(dst, val) xgene_set_bits(dst, val, 26, 3) |
2412 | |
2413 | #define CFG_CLE_IP_PROTOCOL0_SET(dst, val) xgene_set_bits(dst, val, 16, 2) |
2414 | +#define CFG_CLE_IP_HDR_LEN_SET(dst, val) xgene_set_bits(dst, val, 8, 5) |
2415 | #define CFG_CLE_DSTQID0_SET(dst, val) xgene_set_bits(dst, val, 0, 12) |
2416 | #define CFG_CLE_FPSEL0_SET(dst, val) xgene_set_bits(dst, val, 16, 4) |
2417 | #define CFG_MACMODE_SET(dst, val) xgene_set_bits(dst, val, 18, 2) |
2418 | diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c |
2419 | index 8158d4698734..651f308cdc60 100644 |
2420 | --- a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c |
2421 | +++ b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c |
2422 | @@ -505,14 +505,24 @@ static netdev_tx_t xgene_enet_start_xmit(struct sk_buff *skb, |
2423 | return NETDEV_TX_OK; |
2424 | } |
2425 | |
2426 | -static void xgene_enet_skip_csum(struct sk_buff *skb) |
2427 | +static void xgene_enet_rx_csum(struct sk_buff *skb) |
2428 | { |
2429 | + struct net_device *ndev = skb->dev; |
2430 | struct iphdr *iph = ip_hdr(skb); |
2431 | |
2432 | - if (!ip_is_fragment(iph) || |
2433 | - (iph->protocol != IPPROTO_TCP && iph->protocol != IPPROTO_UDP)) { |
2434 | - skb->ip_summed = CHECKSUM_UNNECESSARY; |
2435 | - } |
2436 | + if (!(ndev->features & NETIF_F_RXCSUM)) |
2437 | + return; |
2438 | + |
2439 | + if (skb->protocol != htons(ETH_P_IP)) |
2440 | + return; |
2441 | + |
2442 | + if (ip_is_fragment(iph)) |
2443 | + return; |
2444 | + |
2445 | + if (iph->protocol != IPPROTO_TCP && iph->protocol != IPPROTO_UDP) |
2446 | + return; |
2447 | + |
2448 | + skb->ip_summed = CHECKSUM_UNNECESSARY; |
2449 | } |
2450 | |
2451 | static int xgene_enet_rx_frame(struct xgene_enet_desc_ring *rx_ring, |
2452 | @@ -537,9 +547,9 @@ static int xgene_enet_rx_frame(struct xgene_enet_desc_ring *rx_ring, |
2453 | buf_pool->rx_skb[skb_index] = NULL; |
2454 | |
2455 | /* checking for error */ |
2456 | - status = (GET_VAL(ELERR, le64_to_cpu(raw_desc->m0)) << LERR_LEN) || |
2457 | + status = (GET_VAL(ELERR, le64_to_cpu(raw_desc->m0)) << LERR_LEN) | |
2458 | GET_VAL(LERR, le64_to_cpu(raw_desc->m0)); |
2459 | - if (unlikely(status > 2)) { |
2460 | + if (unlikely(status)) { |
2461 | dev_kfree_skb_any(skb); |
2462 | xgene_enet_parse_error(rx_ring, netdev_priv(rx_ring->ndev), |
2463 | status); |
2464 | @@ -555,10 +565,7 @@ static int xgene_enet_rx_frame(struct xgene_enet_desc_ring *rx_ring, |
2465 | |
2466 | skb_checksum_none_assert(skb); |
2467 | skb->protocol = eth_type_trans(skb, ndev); |
2468 | - if (likely((ndev->features & NETIF_F_IP_CSUM) && |
2469 | - skb->protocol == htons(ETH_P_IP))) { |
2470 | - xgene_enet_skip_csum(skb); |
2471 | - } |
2472 | + xgene_enet_rx_csum(skb); |
2473 | |
2474 | rx_ring->rx_packets++; |
2475 | rx_ring->rx_bytes += datalen; |
2476 | @@ -1725,7 +1732,7 @@ static int xgene_enet_probe(struct platform_device *pdev) |
2477 | xgene_enet_setup_ops(pdata); |
2478 | |
2479 | if (pdata->phy_mode == PHY_INTERFACE_MODE_XGMII) { |
2480 | - ndev->features |= NETIF_F_TSO; |
2481 | + ndev->features |= NETIF_F_TSO | NETIF_F_RXCSUM; |
2482 | spin_lock_init(&pdata->mss_lock); |
2483 | } |
2484 | ndev->hw_features = ndev->features; |
2485 | diff --git a/drivers/net/ethernet/broadcom/bgmac-bcma.c b/drivers/net/ethernet/broadcom/bgmac-bcma.c |
2486 | index c16ec3a51876..1ee11b600645 100644 |
2487 | --- a/drivers/net/ethernet/broadcom/bgmac-bcma.c |
2488 | +++ b/drivers/net/ethernet/broadcom/bgmac-bcma.c |
2489 | @@ -11,6 +11,7 @@ |
2490 | #include <linux/bcma/bcma.h> |
2491 | #include <linux/brcmphy.h> |
2492 | #include <linux/etherdevice.h> |
2493 | +#include <linux/of_net.h> |
2494 | #include "bgmac.h" |
2495 | |
2496 | static inline bool bgmac_is_bcm4707_family(struct bcma_device *core) |
2497 | @@ -96,7 +97,7 @@ static int bgmac_probe(struct bcma_device *core) |
2498 | struct ssb_sprom *sprom = &core->bus->sprom; |
2499 | struct mii_bus *mii_bus; |
2500 | struct bgmac *bgmac; |
2501 | - u8 *mac; |
2502 | + const u8 *mac = NULL; |
2503 | int err; |
2504 | |
2505 | bgmac = kzalloc(sizeof(*bgmac), GFP_KERNEL); |
2506 | @@ -110,21 +111,27 @@ static int bgmac_probe(struct bcma_device *core) |
2507 | |
2508 | bcma_set_drvdata(core, bgmac); |
2509 | |
2510 | - switch (core->core_unit) { |
2511 | - case 0: |
2512 | - mac = sprom->et0mac; |
2513 | - break; |
2514 | - case 1: |
2515 | - mac = sprom->et1mac; |
2516 | - break; |
2517 | - case 2: |
2518 | - mac = sprom->et2mac; |
2519 | - break; |
2520 | - default: |
2521 | - dev_err(bgmac->dev, "Unsupported core_unit %d\n", |
2522 | - core->core_unit); |
2523 | - err = -ENOTSUPP; |
2524 | - goto err; |
2525 | + if (bgmac->dev->of_node) |
2526 | + mac = of_get_mac_address(bgmac->dev->of_node); |
2527 | + |
2528 | + /* If no MAC address assigned via device tree, check SPROM */ |
2529 | + if (!mac) { |
2530 | + switch (core->core_unit) { |
2531 | + case 0: |
2532 | + mac = sprom->et0mac; |
2533 | + break; |
2534 | + case 1: |
2535 | + mac = sprom->et1mac; |
2536 | + break; |
2537 | + case 2: |
2538 | + mac = sprom->et2mac; |
2539 | + break; |
2540 | + default: |
2541 | + dev_err(bgmac->dev, "Unsupported core_unit %d\n", |
2542 | + core->core_unit); |
2543 | + err = -ENOTSUPP; |
2544 | + goto err; |
2545 | + } |
2546 | } |
2547 | |
2548 | ether_addr_copy(bgmac->mac_addr, mac); |
2549 | diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c |
2550 | index bbb3641eddcb..3aa993bbafd9 100644 |
2551 | --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c |
2552 | +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c |
2553 | @@ -1498,12 +1498,16 @@ static int bnxt_async_event_process(struct bnxt *bp, |
2554 | |
2555 | if (BNXT_VF(bp)) |
2556 | goto async_event_process_exit; |
2557 | - if (data1 & 0x20000) { |
2558 | + |
2559 | + /* print unsupported speed warning in forced speed mode only */ |
2560 | + if (!(link_info->autoneg & BNXT_AUTONEG_SPEED) && |
2561 | + (data1 & 0x20000)) { |
2562 | u16 fw_speed = link_info->force_link_speed; |
2563 | u32 speed = bnxt_fw_to_ethtool_speed(fw_speed); |
2564 | |
2565 | - netdev_warn(bp->dev, "Link speed %d no longer supported\n", |
2566 | - speed); |
2567 | + if (speed != SPEED_UNKNOWN) |
2568 | + netdev_warn(bp->dev, "Link speed %d no longer supported\n", |
2569 | + speed); |
2570 | } |
2571 | set_bit(BNXT_LINK_SPEED_CHNG_SP_EVENT, &bp->sp_event); |
2572 | /* fall thru */ |
2573 | diff --git a/drivers/net/ethernet/cavium/thunder/nicvf_main.c b/drivers/net/ethernet/cavium/thunder/nicvf_main.c |
2574 | index 8a37012c9c89..c75d4ea9342b 100644 |
2575 | --- a/drivers/net/ethernet/cavium/thunder/nicvf_main.c |
2576 | +++ b/drivers/net/ethernet/cavium/thunder/nicvf_main.c |
2577 | @@ -1576,6 +1576,11 @@ static int nicvf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) |
2578 | nic->pdev = pdev; |
2579 | nic->pnicvf = nic; |
2580 | nic->max_queues = qcount; |
2581 | + /* If no of CPUs are too low, there won't be any queues left |
2582 | + * for XDP_TX, hence double it. |
2583 | + */ |
2584 | + if (!nic->t88) |
2585 | + nic->max_queues *= 2; |
2586 | |
2587 | /* MAP VF's configuration registers */ |
2588 | nic->reg_base = pcim_iomap(pdev, PCI_CFG_REG_BAR_NUM, 0); |
2589 | diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/ethernet/faraday/ftgmac100.c |
2590 | index 262587240c86..0437149f5939 100644 |
2591 | --- a/drivers/net/ethernet/faraday/ftgmac100.c |
2592 | +++ b/drivers/net/ethernet/faraday/ftgmac100.c |
2593 | @@ -28,6 +28,7 @@ |
2594 | #include <linux/io.h> |
2595 | #include <linux/module.h> |
2596 | #include <linux/netdevice.h> |
2597 | +#include <linux/of.h> |
2598 | #include <linux/phy.h> |
2599 | #include <linux/platform_device.h> |
2600 | #include <net/ip.h> |
2601 | diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c |
2602 | index 917091871259..dd6e07c748f5 100644 |
2603 | --- a/drivers/net/ethernet/freescale/fec_main.c |
2604 | +++ b/drivers/net/ethernet/freescale/fec_main.c |
2605 | @@ -3209,7 +3209,7 @@ static int fec_enet_init(struct net_device *ndev) |
2606 | } |
2607 | |
2608 | #ifdef CONFIG_OF |
2609 | -static void fec_reset_phy(struct platform_device *pdev) |
2610 | +static int fec_reset_phy(struct platform_device *pdev) |
2611 | { |
2612 | int err, phy_reset; |
2613 | bool active_high = false; |
2614 | @@ -3217,7 +3217,7 @@ static void fec_reset_phy(struct platform_device *pdev) |
2615 | struct device_node *np = pdev->dev.of_node; |
2616 | |
2617 | if (!np) |
2618 | - return; |
2619 | + return 0; |
2620 | |
2621 | of_property_read_u32(np, "phy-reset-duration", &msec); |
2622 | /* A sane reset duration should not be longer than 1s */ |
2623 | @@ -3225,8 +3225,10 @@ static void fec_reset_phy(struct platform_device *pdev) |
2624 | msec = 1; |
2625 | |
2626 | phy_reset = of_get_named_gpio(np, "phy-reset-gpios", 0); |
2627 | - if (!gpio_is_valid(phy_reset)) |
2628 | - return; |
2629 | + if (phy_reset == -EPROBE_DEFER) |
2630 | + return phy_reset; |
2631 | + else if (!gpio_is_valid(phy_reset)) |
2632 | + return 0; |
2633 | |
2634 | active_high = of_property_read_bool(np, "phy-reset-active-high"); |
2635 | |
2636 | @@ -3235,7 +3237,7 @@ static void fec_reset_phy(struct platform_device *pdev) |
2637 | "phy-reset"); |
2638 | if (err) { |
2639 | dev_err(&pdev->dev, "failed to get phy-reset-gpios: %d\n", err); |
2640 | - return; |
2641 | + return err; |
2642 | } |
2643 | |
2644 | if (msec > 20) |
2645 | @@ -3244,14 +3246,17 @@ static void fec_reset_phy(struct platform_device *pdev) |
2646 | usleep_range(msec * 1000, msec * 1000 + 1000); |
2647 | |
2648 | gpio_set_value_cansleep(phy_reset, !active_high); |
2649 | + |
2650 | + return 0; |
2651 | } |
2652 | #else /* CONFIG_OF */ |
2653 | -static void fec_reset_phy(struct platform_device *pdev) |
2654 | +static int fec_reset_phy(struct platform_device *pdev) |
2655 | { |
2656 | /* |
2657 | * In case of platform probe, the reset has been done |
2658 | * by machine code. |
2659 | */ |
2660 | + return 0; |
2661 | } |
2662 | #endif /* CONFIG_OF */ |
2663 | |
2664 | @@ -3422,6 +3427,7 @@ fec_probe(struct platform_device *pdev) |
2665 | if (ret) { |
2666 | dev_err(&pdev->dev, |
2667 | "Failed to enable phy regulator: %d\n", ret); |
2668 | + clk_disable_unprepare(fep->clk_ipg); |
2669 | goto failed_regulator; |
2670 | } |
2671 | } else { |
2672 | @@ -3434,7 +3440,9 @@ fec_probe(struct platform_device *pdev) |
2673 | pm_runtime_set_active(&pdev->dev); |
2674 | pm_runtime_enable(&pdev->dev); |
2675 | |
2676 | - fec_reset_phy(pdev); |
2677 | + ret = fec_reset_phy(pdev); |
2678 | + if (ret) |
2679 | + goto failed_reset; |
2680 | |
2681 | if (fep->bufdesc_ex) |
2682 | fec_ptp_init(pdev); |
2683 | @@ -3495,8 +3503,10 @@ fec_probe(struct platform_device *pdev) |
2684 | fec_ptp_stop(pdev); |
2685 | if (fep->reg_phy) |
2686 | regulator_disable(fep->reg_phy); |
2687 | +failed_reset: |
2688 | + pm_runtime_put(&pdev->dev); |
2689 | + pm_runtime_disable(&pdev->dev); |
2690 | failed_regulator: |
2691 | - clk_disable_unprepare(fep->clk_ipg); |
2692 | failed_clk_ipg: |
2693 | fec_enet_clk_enable(ndev, false); |
2694 | failed_clk: |
2695 | diff --git a/drivers/net/ethernet/hisilicon/hns/hns_ae_adapt.c b/drivers/net/ethernet/hisilicon/hns/hns_ae_adapt.c |
2696 | index 2d0cb609adc3..b7c8433a7a37 100644 |
2697 | --- a/drivers/net/ethernet/hisilicon/hns/hns_ae_adapt.c |
2698 | +++ b/drivers/net/ethernet/hisilicon/hns/hns_ae_adapt.c |
2699 | @@ -773,8 +773,9 @@ static int hns_ae_get_rss(struct hnae_handle *handle, u32 *indir, u8 *key, |
2700 | memcpy(key, ppe_cb->rss_key, HNS_PPEV2_RSS_KEY_SIZE); |
2701 | |
2702 | /* update the current hash->queue mappings from the shadow RSS table */ |
2703 | - memcpy(indir, ppe_cb->rss_indir_table, |
2704 | - HNS_PPEV2_RSS_IND_TBL_SIZE * sizeof(*indir)); |
2705 | + if (indir) |
2706 | + memcpy(indir, ppe_cb->rss_indir_table, |
2707 | + HNS_PPEV2_RSS_IND_TBL_SIZE * sizeof(*indir)); |
2708 | |
2709 | return 0; |
2710 | } |
2711 | @@ -785,15 +786,19 @@ static int hns_ae_set_rss(struct hnae_handle *handle, const u32 *indir, |
2712 | struct hns_ppe_cb *ppe_cb = hns_get_ppe_cb(handle); |
2713 | |
2714 | /* set the RSS Hash Key if specififed by the user */ |
2715 | - if (key) |
2716 | - hns_ppe_set_rss_key(ppe_cb, (u32 *)key); |
2717 | + if (key) { |
2718 | + memcpy(ppe_cb->rss_key, key, HNS_PPEV2_RSS_KEY_SIZE); |
2719 | + hns_ppe_set_rss_key(ppe_cb, ppe_cb->rss_key); |
2720 | + } |
2721 | |
2722 | - /* update the shadow RSS table with user specified qids */ |
2723 | - memcpy(ppe_cb->rss_indir_table, indir, |
2724 | - HNS_PPEV2_RSS_IND_TBL_SIZE * sizeof(*indir)); |
2725 | + if (indir) { |
2726 | + /* update the shadow RSS table with user specified qids */ |
2727 | + memcpy(ppe_cb->rss_indir_table, indir, |
2728 | + HNS_PPEV2_RSS_IND_TBL_SIZE * sizeof(*indir)); |
2729 | |
2730 | - /* now update the hardware */ |
2731 | - hns_ppe_set_indir_table(ppe_cb, ppe_cb->rss_indir_table); |
2732 | + /* now update the hardware */ |
2733 | + hns_ppe_set_indir_table(ppe_cb, ppe_cb->rss_indir_table); |
2734 | + } |
2735 | |
2736 | return 0; |
2737 | } |
2738 | diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_gmac.c b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_gmac.c |
2739 | index 1e1eb92998fb..02a03bccde7b 100644 |
2740 | --- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_gmac.c |
2741 | +++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_gmac.c |
2742 | @@ -86,12 +86,11 @@ static void hns_gmac_disable(void *mac_drv, enum mac_commom_mode mode) |
2743 | dsaf_set_dev_bit(drv, GMAC_PORT_EN_REG, GMAC_PORT_RX_EN_B, 0); |
2744 | } |
2745 | |
2746 | -/** |
2747 | -*hns_gmac_get_en - get port enable |
2748 | -*@mac_drv:mac device |
2749 | -*@rx:rx enable |
2750 | -*@tx:tx enable |
2751 | -*/ |
2752 | +/* hns_gmac_get_en - get port enable |
2753 | + * @mac_drv:mac device |
2754 | + * @rx:rx enable |
2755 | + * @tx:tx enable |
2756 | + */ |
2757 | static void hns_gmac_get_en(void *mac_drv, u32 *rx, u32 *tx) |
2758 | { |
2759 | struct mac_driver *drv = (struct mac_driver *)mac_drv; |
2760 | diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.h b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.h |
2761 | index c494fc52be74..62a12991ce9a 100644 |
2762 | --- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.h |
2763 | +++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.h |
2764 | @@ -70,7 +70,7 @@ enum dsaf_roce_qos_sl { |
2765 | }; |
2766 | |
2767 | #define DSAF_STATS_READ(p, offset) (*((u64 *)((u8 *)(p) + (offset)))) |
2768 | -#define HNS_DSAF_IS_DEBUG(dev) (dev->dsaf_mode == DSAF_MODE_DISABLE_SP) |
2769 | +#define HNS_DSAF_IS_DEBUG(dev) ((dev)->dsaf_mode == DSAF_MODE_DISABLE_SP) |
2770 | |
2771 | enum hal_dsaf_mode { |
2772 | HRD_DSAF_NO_DSAF_MODE = 0x0, |
2773 | diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_rcb.c b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_rcb.c |
2774 | index f0ed80d6ef9c..f3be9ac47bfb 100644 |
2775 | --- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_rcb.c |
2776 | +++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_rcb.c |
2777 | @@ -430,7 +430,6 @@ static void hns_rcb_ring_pair_get_cfg(struct ring_pair_cb *ring_pair_cb) |
2778 | static int hns_rcb_get_port_in_comm( |
2779 | struct rcb_common_cb *rcb_common, int ring_idx) |
2780 | { |
2781 | - |
2782 | return ring_idx / (rcb_common->max_q_per_vf * rcb_common->max_vfn); |
2783 | } |
2784 | |
2785 | diff --git a/drivers/net/ethernet/hisilicon/hns/hns_enet.c b/drivers/net/ethernet/hisilicon/hns/hns_enet.c |
2786 | index c06845b7b666..a79e0a1100aa 100644 |
2787 | --- a/drivers/net/ethernet/hisilicon/hns/hns_enet.c |
2788 | +++ b/drivers/net/ethernet/hisilicon/hns/hns_enet.c |
2789 | @@ -511,7 +511,8 @@ static void hns_nic_reuse_page(struct sk_buff *skb, int i, |
2790 | int last_offset; |
2791 | bool twobufs; |
2792 | |
2793 | - twobufs = ((PAGE_SIZE < 8192) && hnae_buf_size(ring) == HNS_BUFFER_SIZE_2048); |
2794 | + twobufs = ((PAGE_SIZE < 8192) && |
2795 | + hnae_buf_size(ring) == HNS_BUFFER_SIZE_2048); |
2796 | |
2797 | desc = &ring->desc[ring->next_to_clean]; |
2798 | size = le16_to_cpu(desc->rx.size); |
2799 | @@ -1700,7 +1701,7 @@ static void hns_nic_reset_subtask(struct hns_nic_priv *priv) |
2800 | static void hns_nic_service_event_complete(struct hns_nic_priv *priv) |
2801 | { |
2802 | WARN_ON(!test_bit(NIC_STATE_SERVICE_SCHED, &priv->state)); |
2803 | - |
2804 | + /* make sure to commit the things */ |
2805 | smp_mb__before_atomic(); |
2806 | clear_bit(NIC_STATE_SERVICE_SCHED, &priv->state); |
2807 | } |
2808 | diff --git a/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c b/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c |
2809 | index 87d5c94b2810..86a496d71995 100644 |
2810 | --- a/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c |
2811 | +++ b/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c |
2812 | @@ -1252,12 +1252,10 @@ hns_set_rss(struct net_device *netdev, const u32 *indir, const u8 *key, |
2813 | |
2814 | ops = priv->ae_handle->dev->ops; |
2815 | |
2816 | - /* currently hfunc can only be Toeplitz hash */ |
2817 | - if (key || |
2818 | - (hfunc != ETH_RSS_HASH_NO_CHANGE && hfunc != ETH_RSS_HASH_TOP)) |
2819 | + if (hfunc != ETH_RSS_HASH_NO_CHANGE && hfunc != ETH_RSS_HASH_TOP) { |
2820 | + netdev_err(netdev, "Invalid hfunc!\n"); |
2821 | return -EOPNOTSUPP; |
2822 | - if (!indir) |
2823 | - return 0; |
2824 | + } |
2825 | |
2826 | return ops->set_rss(priv->ae_handle, indir, key, hfunc); |
2827 | } |
2828 | diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c b/drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c |
2829 | index 5241e0873397..7041d83d48bf 100644 |
2830 | --- a/drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c |
2831 | +++ b/drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c |
2832 | @@ -942,7 +942,7 @@ static void fm10k_self_test(struct net_device *dev, |
2833 | |
2834 | memset(data, 0, sizeof(*data) * FM10K_TEST_LEN); |
2835 | |
2836 | - if (FM10K_REMOVED(hw)) { |
2837 | + if (FM10K_REMOVED(hw->hw_addr)) { |
2838 | netif_err(interface, drv, dev, |
2839 | "Interface removed - test blocked\n"); |
2840 | eth_test->flags |= ETH_TEST_FL_FAILED; |
2841 | diff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c |
2842 | index 92bc8846f1ba..f4569461dcb8 100644 |
2843 | --- a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c |
2844 | +++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c |
2845 | @@ -1135,6 +1135,11 @@ static int i40e_get_eeprom_len(struct net_device *netdev) |
2846 | struct i40e_hw *hw = &np->vsi->back->hw; |
2847 | u32 val; |
2848 | |
2849 | +#define X722_EEPROM_SCOPE_LIMIT 0x5B9FFF |
2850 | + if (hw->mac.type == I40E_MAC_X722) { |
2851 | + val = X722_EEPROM_SCOPE_LIMIT + 1; |
2852 | + return val; |
2853 | + } |
2854 | val = (rd32(hw, I40E_GLPCI_LBARCTRL) |
2855 | & I40E_GLPCI_LBARCTRL_FL_SIZE_MASK) |
2856 | >> I40E_GLPCI_LBARCTRL_FL_SIZE_SHIFT; |
2857 | diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c |
2858 | index becffd15c092..57c7456a5751 100644 |
2859 | --- a/drivers/net/ethernet/intel/i40e/i40e_main.c |
2860 | +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c |
2861 | @@ -11142,10 +11142,12 @@ static int i40e_probe(struct pci_dev *pdev, const struct pci_device_id *ent) |
2862 | round_jiffies(jiffies + pf->service_timer_period)); |
2863 | |
2864 | /* add this PF to client device list and launch a client service task */ |
2865 | - err = i40e_lan_add_device(pf); |
2866 | - if (err) |
2867 | - dev_info(&pdev->dev, "Failed to add PF to client API service list: %d\n", |
2868 | - err); |
2869 | + if (pf->flags & I40E_FLAG_IWARP_ENABLED) { |
2870 | + err = i40e_lan_add_device(pf); |
2871 | + if (err) |
2872 | + dev_info(&pdev->dev, "Failed to add PF to client API service list: %d\n", |
2873 | + err); |
2874 | + } |
2875 | |
2876 | #ifdef I40E_FCOE |
2877 | /* create FCoE interface */ |
2878 | @@ -11323,10 +11325,11 @@ static void i40e_remove(struct pci_dev *pdev) |
2879 | i40e_vsi_release(pf->vsi[pf->lan_vsi]); |
2880 | |
2881 | /* remove attached clients */ |
2882 | - ret_code = i40e_lan_del_device(pf); |
2883 | - if (ret_code) { |
2884 | - dev_warn(&pdev->dev, "Failed to delete client device: %d\n", |
2885 | - ret_code); |
2886 | + if (pf->flags & I40E_FLAG_IWARP_ENABLED) { |
2887 | + ret_code = i40e_lan_del_device(pf); |
2888 | + if (ret_code) |
2889 | + dev_warn(&pdev->dev, "Failed to delete client device: %d\n", |
2890 | + ret_code); |
2891 | } |
2892 | |
2893 | /* shutdown and destroy the HMC */ |
2894 | diff --git a/drivers/net/ethernet/intel/i40e/i40e_nvm.c b/drivers/net/ethernet/intel/i40e/i40e_nvm.c |
2895 | index 954efe3118db..abe290bfc638 100644 |
2896 | --- a/drivers/net/ethernet/intel/i40e/i40e_nvm.c |
2897 | +++ b/drivers/net/ethernet/intel/i40e/i40e_nvm.c |
2898 | @@ -292,14 +292,14 @@ i40e_status i40e_read_nvm_word(struct i40e_hw *hw, u16 offset, |
2899 | { |
2900 | enum i40e_status_code ret_code = 0; |
2901 | |
2902 | - if (hw->flags & I40E_HW_FLAG_AQ_SRCTL_ACCESS_ENABLE) { |
2903 | - ret_code = i40e_acquire_nvm(hw, I40E_RESOURCE_READ); |
2904 | - if (!ret_code) { |
2905 | + ret_code = i40e_acquire_nvm(hw, I40E_RESOURCE_READ); |
2906 | + if (!ret_code) { |
2907 | + if (hw->flags & I40E_HW_FLAG_AQ_SRCTL_ACCESS_ENABLE) { |
2908 | ret_code = i40e_read_nvm_word_aq(hw, offset, data); |
2909 | - i40e_release_nvm(hw); |
2910 | + } else { |
2911 | + ret_code = i40e_read_nvm_word_srctl(hw, offset, data); |
2912 | } |
2913 | - } else { |
2914 | - ret_code = i40e_read_nvm_word_srctl(hw, offset, data); |
2915 | + i40e_release_nvm(hw); |
2916 | } |
2917 | return ret_code; |
2918 | } |
2919 | diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c |
2920 | index 28b640fa2e35..2e12ccf73dba 100644 |
2921 | --- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c |
2922 | +++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c |
2923 | @@ -1820,6 +1820,7 @@ static int i40e_clean_rx_irq(struct i40e_ring *rx_ring, int budget) |
2924 | */ |
2925 | if (unlikely(i40e_test_staterr(rx_desc, BIT(I40E_RXD_QW1_ERROR_SHIFT)))) { |
2926 | dev_kfree_skb_any(skb); |
2927 | + skb = NULL; |
2928 | continue; |
2929 | } |
2930 | |
2931 | diff --git a/drivers/net/ethernet/intel/i40evf/i40e_txrx.c b/drivers/net/ethernet/intel/i40evf/i40e_txrx.c |
2932 | index 90ebc5ac16fd..7bfed441c466 100644 |
2933 | --- a/drivers/net/ethernet/intel/i40evf/i40e_txrx.c |
2934 | +++ b/drivers/net/ethernet/intel/i40evf/i40e_txrx.c |
2935 | @@ -1262,6 +1262,7 @@ static int i40e_clean_rx_irq(struct i40e_ring *rx_ring, int budget) |
2936 | */ |
2937 | if (unlikely(i40e_test_staterr(rx_desc, BIT(I40E_RXD_QW1_ERROR_SHIFT)))) { |
2938 | dev_kfree_skb_any(skb); |
2939 | + skb = NULL; |
2940 | continue; |
2941 | } |
2942 | |
2943 | diff --git a/drivers/net/ethernet/qlogic/qed/qed_cxt.c b/drivers/net/ethernet/qlogic/qed/qed_cxt.c |
2944 | index ed014bdbbabd..457e30427535 100644 |
2945 | --- a/drivers/net/ethernet/qlogic/qed/qed_cxt.c |
2946 | +++ b/drivers/net/ethernet/qlogic/qed/qed_cxt.c |
2947 | @@ -271,16 +271,34 @@ struct qed_tm_iids { |
2948 | u32 per_vf_tids; |
2949 | }; |
2950 | |
2951 | -static void qed_cxt_tm_iids(struct qed_cxt_mngr *p_mngr, |
2952 | +static void qed_cxt_tm_iids(struct qed_hwfn *p_hwfn, |
2953 | + struct qed_cxt_mngr *p_mngr, |
2954 | struct qed_tm_iids *iids) |
2955 | { |
2956 | - u32 i, j; |
2957 | - |
2958 | - for (i = 0; i < MAX_CONN_TYPES; i++) { |
2959 | + bool tm_vf_required = false; |
2960 | + bool tm_required = false; |
2961 | + int i, j; |
2962 | + |
2963 | + /* Timers is a special case -> we don't count how many cids require |
2964 | + * timers but what's the max cid that will be used by the timer block. |
2965 | + * therefore we traverse in reverse order, and once we hit a protocol |
2966 | + * that requires the timers memory, we'll sum all the protocols up |
2967 | + * to that one. |
2968 | + */ |
2969 | + for (i = MAX_CONN_TYPES - 1; i >= 0; i--) { |
2970 | struct qed_conn_type_cfg *p_cfg = &p_mngr->conn_cfg[i]; |
2971 | |
2972 | - if (tm_cid_proto(i)) { |
2973 | + if (tm_cid_proto(i) || tm_required) { |
2974 | + if (p_cfg->cid_count) |
2975 | + tm_required = true; |
2976 | + |
2977 | iids->pf_cids += p_cfg->cid_count; |
2978 | + } |
2979 | + |
2980 | + if (tm_cid_proto(i) || tm_vf_required) { |
2981 | + if (p_cfg->cids_per_vf) |
2982 | + tm_vf_required = true; |
2983 | + |
2984 | iids->per_vf_cids += p_cfg->cids_per_vf; |
2985 | } |
2986 | } |
2987 | @@ -696,7 +714,7 @@ int qed_cxt_cfg_ilt_compute(struct qed_hwfn *p_hwfn) |
2988 | |
2989 | /* TM PF */ |
2990 | p_cli = &p_mngr->clients[ILT_CLI_TM]; |
2991 | - qed_cxt_tm_iids(p_mngr, &tm_iids); |
2992 | + qed_cxt_tm_iids(p_hwfn, p_mngr, &tm_iids); |
2993 | total = tm_iids.pf_cids + tm_iids.pf_tids_total; |
2994 | if (total) { |
2995 | p_blk = &p_cli->pf_blks[0]; |
2996 | @@ -1591,7 +1609,7 @@ static void qed_tm_init_pf(struct qed_hwfn *p_hwfn) |
2997 | u8 i; |
2998 | |
2999 | memset(&tm_iids, 0, sizeof(tm_iids)); |
3000 | - qed_cxt_tm_iids(p_mngr, &tm_iids); |
3001 | + qed_cxt_tm_iids(p_hwfn, p_mngr, &tm_iids); |
3002 | |
3003 | /* @@@TBD No pre-scan for now */ |
3004 | |
3005 | diff --git a/drivers/net/ethernet/qlogic/qed/qed_main.c b/drivers/net/ethernet/qlogic/qed/qed_main.c |
3006 | index 333c7442e48a..dba3fbe4800e 100644 |
3007 | --- a/drivers/net/ethernet/qlogic/qed/qed_main.c |
3008 | +++ b/drivers/net/ethernet/qlogic/qed/qed_main.c |
3009 | @@ -711,7 +711,8 @@ static int qed_slowpath_setup_int(struct qed_dev *cdev, |
3010 | cdev->int_params.fp_msix_cnt = cdev->int_params.out.num_vectors - |
3011 | cdev->num_hwfns; |
3012 | |
3013 | - if (!IS_ENABLED(CONFIG_QED_RDMA)) |
3014 | + if (!IS_ENABLED(CONFIG_QED_RDMA) || |
3015 | + QED_LEADING_HWFN(cdev)->hw_info.personality != QED_PCI_ETH_ROCE) |
3016 | return 0; |
3017 | |
3018 | for_each_hwfn(cdev, i) |
3019 | diff --git a/drivers/net/ethernet/qlogic/qed/qed_sriov.c b/drivers/net/ethernet/qlogic/qed/qed_sriov.c |
3020 | index d2d6621fe0e5..48bc5c151336 100644 |
3021 | --- a/drivers/net/ethernet/qlogic/qed/qed_sriov.c |
3022 | +++ b/drivers/net/ethernet/qlogic/qed/qed_sriov.c |
3023 | @@ -3573,6 +3573,7 @@ static int qed_get_vf_config(struct qed_dev *cdev, |
3024 | |
3025 | void qed_inform_vf_link_state(struct qed_hwfn *hwfn) |
3026 | { |
3027 | + struct qed_hwfn *lead_hwfn = QED_LEADING_HWFN(hwfn->cdev); |
3028 | struct qed_mcp_link_capabilities caps; |
3029 | struct qed_mcp_link_params params; |
3030 | struct qed_mcp_link_state link; |
3031 | @@ -3589,9 +3590,15 @@ void qed_inform_vf_link_state(struct qed_hwfn *hwfn) |
3032 | if (!vf_info) |
3033 | continue; |
3034 | |
3035 | - memcpy(¶ms, qed_mcp_get_link_params(hwfn), sizeof(params)); |
3036 | - memcpy(&link, qed_mcp_get_link_state(hwfn), sizeof(link)); |
3037 | - memcpy(&caps, qed_mcp_get_link_capabilities(hwfn), |
3038 | + /* Only hwfn0 is actually interested in the link speed. |
3039 | + * But since only it would receive an MFW indication of link, |
3040 | + * need to take configuration from it - otherwise things like |
3041 | + * rate limiting for hwfn1 VF would not work. |
3042 | + */ |
3043 | + memcpy(¶ms, qed_mcp_get_link_params(lead_hwfn), |
3044 | + sizeof(params)); |
3045 | + memcpy(&link, qed_mcp_get_link_state(lead_hwfn), sizeof(link)); |
3046 | + memcpy(&caps, qed_mcp_get_link_capabilities(lead_hwfn), |
3047 | sizeof(caps)); |
3048 | |
3049 | /* Modify link according to the VF's configured link state */ |
3050 | diff --git a/drivers/net/ieee802154/adf7242.c b/drivers/net/ieee802154/adf7242.c |
3051 | index f355df7cf84a..1b980f12663a 100644 |
3052 | --- a/drivers/net/ieee802154/adf7242.c |
3053 | +++ b/drivers/net/ieee802154/adf7242.c |
3054 | @@ -888,7 +888,7 @@ static struct ieee802154_ops adf7242_ops = { |
3055 | .set_cca_ed_level = adf7242_set_cca_ed_level, |
3056 | }; |
3057 | |
3058 | -static void adf7242_debug(u8 irq1) |
3059 | +static void adf7242_debug(struct adf7242_local *lp, u8 irq1) |
3060 | { |
3061 | #ifdef DEBUG |
3062 | u8 stat; |
3063 | @@ -932,7 +932,7 @@ static irqreturn_t adf7242_isr(int irq, void *data) |
3064 | dev_err(&lp->spi->dev, "%s :ERROR IRQ1 = 0x%X\n", |
3065 | __func__, irq1); |
3066 | |
3067 | - adf7242_debug(irq1); |
3068 | + adf7242_debug(lp, irq1); |
3069 | |
3070 | xmit = test_bit(FLAG_XMIT, &lp->flags); |
3071 | |
3072 | diff --git a/drivers/net/ipvlan/ipvlan_core.c b/drivers/net/ipvlan/ipvlan_core.c |
3073 | index 627eb825eb74..c747ab652665 100644 |
3074 | --- a/drivers/net/ipvlan/ipvlan_core.c |
3075 | +++ b/drivers/net/ipvlan/ipvlan_core.c |
3076 | @@ -299,6 +299,10 @@ static int ipvlan_rcv_frame(struct ipvl_addr *addr, struct sk_buff **pskb, |
3077 | if (dev_forward_skb(ipvlan->dev, skb) == NET_RX_SUCCESS) |
3078 | success = true; |
3079 | } else { |
3080 | + if (!ether_addr_equal_64bits(eth_hdr(skb)->h_dest, |
3081 | + ipvlan->phy_dev->dev_addr)) |
3082 | + skb->pkt_type = PACKET_OTHERHOST; |
3083 | + |
3084 | ret = RX_HANDLER_ANOTHER; |
3085 | success = true; |
3086 | } |
3087 | diff --git a/drivers/net/phy/mdio-xgene.c b/drivers/net/phy/mdio-xgene.c |
3088 | index 8eb077b677f6..39be3b82608f 100644 |
3089 | --- a/drivers/net/phy/mdio-xgene.c |
3090 | +++ b/drivers/net/phy/mdio-xgene.c |
3091 | @@ -232,7 +232,7 @@ static int xgene_xfi_mdio_write(struct mii_bus *bus, int phy_id, |
3092 | |
3093 | val = SET_VAL(HSTPHYADX, phy_id) | SET_VAL(HSTREGADX, reg) | |
3094 | SET_VAL(HSTMIIMWRDAT, data); |
3095 | - xgene_enet_wr_mdio_csr(addr, MIIM_FIELD_ADDR, data); |
3096 | + xgene_enet_wr_mdio_csr(addr, MIIM_FIELD_ADDR, val); |
3097 | |
3098 | val = HSTLDCMD | SET_VAL(HSTMIIMCMD, MIIM_CMD_LEGACY_WRITE); |
3099 | xgene_enet_wr_mdio_csr(addr, MIIM_COMMAND_ADDR, val); |
3100 | diff --git a/drivers/net/veth.c b/drivers/net/veth.c |
3101 | index fbc853e64531..ee7460ee3d05 100644 |
3102 | --- a/drivers/net/veth.c |
3103 | +++ b/drivers/net/veth.c |
3104 | @@ -425,6 +425,9 @@ static int veth_newlink(struct net *src_net, struct net_device *dev, |
3105 | if (ifmp && (dev->ifindex != 0)) |
3106 | peer->ifindex = ifmp->ifi_index; |
3107 | |
3108 | + peer->gso_max_size = dev->gso_max_size; |
3109 | + peer->gso_max_segs = dev->gso_max_segs; |
3110 | + |
3111 | err = register_netdevice(peer); |
3112 | put_net(net); |
3113 | net = NULL; |
3114 | diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c |
3115 | index 983e941bdf29..50570d779b01 100644 |
3116 | --- a/drivers/net/vxlan.c |
3117 | +++ b/drivers/net/vxlan.c |
3118 | @@ -2912,6 +2912,11 @@ static int vxlan_dev_configure(struct net *src_net, struct net_device *dev, |
3119 | return -EINVAL; |
3120 | } |
3121 | |
3122 | + if (lowerdev) { |
3123 | + dev->gso_max_size = lowerdev->gso_max_size; |
3124 | + dev->gso_max_segs = lowerdev->gso_max_segs; |
3125 | + } |
3126 | + |
3127 | if (conf->mtu) { |
3128 | err = __vxlan_change_mtu(dev, lowerdev, dst, conf->mtu, false); |
3129 | if (err) |
3130 | diff --git a/drivers/net/wireless/ath/ath10k/ce.c b/drivers/net/wireless/ath/ath10k/ce.c |
3131 | index 0b4d79659884..041ef3be87b9 100644 |
3132 | --- a/drivers/net/wireless/ath/ath10k/ce.c |
3133 | +++ b/drivers/net/wireless/ath/ath10k/ce.c |
3134 | @@ -1059,7 +1059,7 @@ int ath10k_ce_alloc_pipe(struct ath10k *ar, int ce_id, |
3135 | */ |
3136 | BUILD_BUG_ON(2 * TARGET_NUM_MSDU_DESC > |
3137 | (CE_HTT_H2T_MSG_SRC_NENTRIES - 1)); |
3138 | - BUILD_BUG_ON(2 * TARGET_10X_NUM_MSDU_DESC > |
3139 | + BUILD_BUG_ON(2 * TARGET_10_4_NUM_MSDU_DESC_PFC > |
3140 | (CE_HTT_H2T_MSG_SRC_NENTRIES - 1)); |
3141 | BUILD_BUG_ON(2 * TARGET_TLV_NUM_MSDU_DESC > |
3142 | (CE_HTT_H2T_MSG_SRC_NENTRIES - 1)); |
3143 | diff --git a/drivers/net/wireless/ath/ath10k/debug.c b/drivers/net/wireless/ath/ath10k/debug.c |
3144 | index 82a4c67f3672..6aa2b93497dd 100644 |
3145 | --- a/drivers/net/wireless/ath/ath10k/debug.c |
3146 | +++ b/drivers/net/wireless/ath/ath10k/debug.c |
3147 | @@ -1942,6 +1942,15 @@ static ssize_t ath10k_write_simulate_radar(struct file *file, |
3148 | size_t count, loff_t *ppos) |
3149 | { |
3150 | struct ath10k *ar = file->private_data; |
3151 | + struct ath10k_vif *arvif; |
3152 | + |
3153 | + /* Just check for for the first vif alone, as all the vifs will be |
3154 | + * sharing the same channel and if the channel is disabled, all the |
3155 | + * vifs will share the same 'is_started' state. |
3156 | + */ |
3157 | + arvif = list_first_entry(&ar->arvifs, typeof(*arvif), list); |
3158 | + if (!arvif->is_started) |
3159 | + return -EINVAL; |
3160 | |
3161 | ieee80211_radar_detected(ar->hw); |
3162 | |
3163 | diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c |
3164 | index 17ab8efdac35..1e6e63dbd61c 100644 |
3165 | --- a/drivers/net/wireless/ath/ath10k/mac.c |
3166 | +++ b/drivers/net/wireless/ath/ath10k/mac.c |
3167 | @@ -6054,6 +6054,16 @@ static int ath10k_sta_state(struct ieee80211_hw *hw, |
3168 | "mac vdev %d peer delete %pM sta %pK (sta gone)\n", |
3169 | arvif->vdev_id, sta->addr, sta); |
3170 | |
3171 | + if (sta->tdls) { |
3172 | + ret = ath10k_mac_tdls_peer_update(ar, arvif->vdev_id, |
3173 | + sta, |
3174 | + WMI_TDLS_PEER_STATE_TEARDOWN); |
3175 | + if (ret) |
3176 | + ath10k_warn(ar, "failed to update tdls peer state for %pM state %d: %i\n", |
3177 | + sta->addr, |
3178 | + WMI_TDLS_PEER_STATE_TEARDOWN, ret); |
3179 | + } |
3180 | + |
3181 | ret = ath10k_peer_delete(ar, arvif->vdev_id, sta->addr); |
3182 | if (ret) |
3183 | ath10k_warn(ar, "failed to delete peer %pM for vdev %d: %i\n", |
3184 | @@ -7070,7 +7080,7 @@ ath10k_mac_update_rx_channel(struct ath10k *ar, |
3185 | lockdep_assert_held(&ar->data_lock); |
3186 | |
3187 | WARN_ON(ctx && vifs); |
3188 | - WARN_ON(vifs && n_vifs != 1); |
3189 | + WARN_ON(vifs && !n_vifs); |
3190 | |
3191 | /* FIXME: Sort of an optimization and a workaround. Peers and vifs are |
3192 | * on a linked list now. Doing a lookup peer -> vif -> chanctx for each |
3193 | diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c |
3194 | index 54df425bb0fc..e518b640aad0 100644 |
3195 | --- a/drivers/net/wireless/ath/ath10k/wmi.c |
3196 | +++ b/drivers/net/wireless/ath/ath10k/wmi.c |
3197 | @@ -3638,6 +3638,11 @@ static void ath10k_dfs_radar_report(struct ath10k *ar, |
3198 | |
3199 | spin_lock_bh(&ar->data_lock); |
3200 | ch = ar->rx_channel; |
3201 | + |
3202 | + /* fetch target operating channel during channel change */ |
3203 | + if (!ch) |
3204 | + ch = ar->tgt_oper_chan; |
3205 | + |
3206 | spin_unlock_bh(&ar->data_lock); |
3207 | |
3208 | if (!ch) { |
3209 | diff --git a/drivers/net/wireless/ath/ath10k/wmi.h b/drivers/net/wireless/ath/ath10k/wmi.h |
3210 | index 1b243c899bef..9b8562ff6698 100644 |
3211 | --- a/drivers/net/wireless/ath/ath10k/wmi.h |
3212 | +++ b/drivers/net/wireless/ath/ath10k/wmi.h |
3213 | @@ -5017,7 +5017,8 @@ enum wmi_10_4_vdev_param { |
3214 | #define WMI_VDEV_PARAM_TXBF_MU_TX_BFER BIT(3) |
3215 | |
3216 | #define WMI_TXBF_STS_CAP_OFFSET_LSB 4 |
3217 | -#define WMI_TXBF_STS_CAP_OFFSET_MASK 0xf0 |
3218 | +#define WMI_TXBF_STS_CAP_OFFSET_MASK 0x70 |
3219 | +#define WMI_TXBF_CONF_IMPLICIT_BF BIT(7) |
3220 | #define WMI_BF_SOUND_DIM_OFFSET_LSB 8 |
3221 | #define WMI_BF_SOUND_DIM_OFFSET_MASK 0xf00 |
3222 | |
3223 | diff --git a/drivers/net/wireless/ath/wil6210/main.c b/drivers/net/wireless/ath/wil6210/main.c |
3224 | index 24b07a0ce6f7..f8bce58d48cc 100644 |
3225 | --- a/drivers/net/wireless/ath/wil6210/main.c |
3226 | +++ b/drivers/net/wireless/ath/wil6210/main.c |
3227 | @@ -129,9 +129,15 @@ void wil_memcpy_fromio_32(void *dst, const volatile void __iomem *src, |
3228 | u32 *d = dst; |
3229 | const volatile u32 __iomem *s = src; |
3230 | |
3231 | - /* size_t is unsigned, if (count%4 != 0) it will wrap */ |
3232 | - for (count += 4; count > 4; count -= 4) |
3233 | + for (; count >= 4; count -= 4) |
3234 | *d++ = __raw_readl(s++); |
3235 | + |
3236 | + if (unlikely(count)) { |
3237 | + /* count can be 1..3 */ |
3238 | + u32 tmp = __raw_readl(s); |
3239 | + |
3240 | + memcpy(d, &tmp, count); |
3241 | + } |
3242 | } |
3243 | |
3244 | void wil_memcpy_fromio_halp_vote(struct wil6210_priv *wil, void *dst, |
3245 | @@ -148,8 +154,16 @@ void wil_memcpy_toio_32(volatile void __iomem *dst, const void *src, |
3246 | volatile u32 __iomem *d = dst; |
3247 | const u32 *s = src; |
3248 | |
3249 | - for (count += 4; count > 4; count -= 4) |
3250 | + for (; count >= 4; count -= 4) |
3251 | __raw_writel(*s++, d++); |
3252 | + |
3253 | + if (unlikely(count)) { |
3254 | + /* count can be 1..3 */ |
3255 | + u32 tmp = 0; |
3256 | + |
3257 | + memcpy(&tmp, s, count); |
3258 | + __raw_writel(tmp, d); |
3259 | + } |
3260 | } |
3261 | |
3262 | void wil_memcpy_toio_halp_vote(struct wil6210_priv *wil, |
3263 | diff --git a/drivers/net/wireless/ath/wil6210/wmi.c b/drivers/net/wireless/ath/wil6210/wmi.c |
3264 | index fae4f1285d08..94a356bbb6b9 100644 |
3265 | --- a/drivers/net/wireless/ath/wil6210/wmi.c |
3266 | +++ b/drivers/net/wireless/ath/wil6210/wmi.c |
3267 | @@ -501,16 +501,16 @@ static void wmi_evt_connect(struct wil6210_priv *wil, int id, void *d, int len) |
3268 | assoc_resp_ielen = 0; |
3269 | } |
3270 | |
3271 | - mutex_lock(&wil->mutex); |
3272 | if (test_bit(wil_status_resetting, wil->status) || |
3273 | !test_bit(wil_status_fwready, wil->status)) { |
3274 | wil_err(wil, "status_resetting, cancel connect event, CID %d\n", |
3275 | evt->cid); |
3276 | - mutex_unlock(&wil->mutex); |
3277 | /* no need for cleanup, wil_reset will do that */ |
3278 | return; |
3279 | } |
3280 | |
3281 | + mutex_lock(&wil->mutex); |
3282 | + |
3283 | if ((wdev->iftype == NL80211_IFTYPE_STATION) || |
3284 | (wdev->iftype == NL80211_IFTYPE_P2P_CLIENT)) { |
3285 | if (!test_bit(wil_status_fwconnecting, wil->status)) { |
3286 | @@ -608,6 +608,13 @@ static void wmi_evt_disconnect(struct wil6210_priv *wil, int id, |
3287 | |
3288 | wil->sinfo_gen++; |
3289 | |
3290 | + if (test_bit(wil_status_resetting, wil->status) || |
3291 | + !test_bit(wil_status_fwready, wil->status)) { |
3292 | + wil_err(wil, "status_resetting, cancel disconnect event\n"); |
3293 | + /* no need for cleanup, wil_reset will do that */ |
3294 | + return; |
3295 | + } |
3296 | + |
3297 | mutex_lock(&wil->mutex); |
3298 | wil6210_disconnect(wil, evt->bssid, reason_code, true); |
3299 | mutex_unlock(&wil->mutex); |
3300 | diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rs.c b/drivers/net/wireless/intel/iwlwifi/mvm/rs.c |
3301 | index 227c5ed9cbe6..0aea476ebf50 100644 |
3302 | --- a/drivers/net/wireless/intel/iwlwifi/mvm/rs.c |
3303 | +++ b/drivers/net/wireless/intel/iwlwifi/mvm/rs.c |
3304 | @@ -1867,12 +1867,10 @@ static int rs_switch_to_column(struct iwl_mvm *mvm, |
3305 | struct rs_rate *rate = &search_tbl->rate; |
3306 | const struct rs_tx_column *column = &rs_tx_columns[col_id]; |
3307 | const struct rs_tx_column *curr_column = &rs_tx_columns[tbl->column]; |
3308 | - u32 sz = (sizeof(struct iwl_scale_tbl_info) - |
3309 | - (sizeof(struct iwl_rate_scale_data) * IWL_RATE_COUNT)); |
3310 | unsigned long rate_mask = 0; |
3311 | u32 rate_idx = 0; |
3312 | |
3313 | - memcpy(search_tbl, tbl, sz); |
3314 | + memcpy(search_tbl, tbl, offsetof(struct iwl_scale_tbl_info, win)); |
3315 | |
3316 | rate->sgi = column->sgi; |
3317 | rate->ant = column->ant; |
3318 | diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rx.c b/drivers/net/wireless/intel/iwlwifi/mvm/rx.c |
3319 | index 0e60e38b2acf..b78e60eb600f 100644 |
3320 | --- a/drivers/net/wireless/intel/iwlwifi/mvm/rx.c |
3321 | +++ b/drivers/net/wireless/intel/iwlwifi/mvm/rx.c |
3322 | @@ -104,7 +104,20 @@ static void iwl_mvm_pass_packet_to_mac80211(struct iwl_mvm *mvm, |
3323 | u8 crypt_len, |
3324 | struct iwl_rx_cmd_buffer *rxb) |
3325 | { |
3326 | - unsigned int hdrlen, fraglen; |
3327 | + unsigned int hdrlen = ieee80211_hdrlen(hdr->frame_control); |
3328 | + unsigned int fraglen; |
3329 | + |
3330 | + /* |
3331 | + * The 'hdrlen' (plus the 8 bytes for the SNAP and the crypt_len, |
3332 | + * but those are all multiples of 4 long) all goes away, but we |
3333 | + * want the *end* of it, which is going to be the start of the IP |
3334 | + * header, to be aligned when it gets pulled in. |
3335 | + * The beginning of the skb->data is aligned on at least a 4-byte |
3336 | + * boundary after allocation. Everything here is aligned at least |
3337 | + * on a 2-byte boundary so we can just take hdrlen & 3 and pad by |
3338 | + * the result. |
3339 | + */ |
3340 | + skb_reserve(skb, hdrlen & 3); |
3341 | |
3342 | /* If frame is small enough to fit in skb->head, pull it completely. |
3343 | * If not, only pull ieee80211_hdr (including crypto if present, and |
3344 | @@ -118,8 +131,7 @@ static void iwl_mvm_pass_packet_to_mac80211(struct iwl_mvm *mvm, |
3345 | * If the latter changes (there are efforts in the standards group |
3346 | * to do so) we should revisit this and ieee80211_data_to_8023(). |
3347 | */ |
3348 | - hdrlen = (len <= skb_tailroom(skb)) ? len : |
3349 | - sizeof(*hdr) + crypt_len + 8; |
3350 | + hdrlen = (len <= skb_tailroom(skb)) ? len : hdrlen + crypt_len + 8; |
3351 | |
3352 | memcpy(skb_put(skb, hdrlen), hdr, hdrlen); |
3353 | fraglen = len - hdrlen; |
3354 | diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c |
3355 | index 61e85eac706a..4182c3775a72 100644 |
3356 | --- a/drivers/net/wireless/mac80211_hwsim.c |
3357 | +++ b/drivers/net/wireless/mac80211_hwsim.c |
3358 | @@ -552,8 +552,6 @@ struct mac80211_hwsim_data { |
3359 | /* wmediumd portid responsible for netgroup of this radio */ |
3360 | u32 wmediumd; |
3361 | |
3362 | - int power_level; |
3363 | - |
3364 | /* difference between this hw's clock and the real clock, in usecs */ |
3365 | s64 tsf_offset; |
3366 | s64 bcn_delta; |
3367 | @@ -730,16 +728,21 @@ static int hwsim_fops_ps_write(void *dat, u64 val) |
3368 | val != PS_MANUAL_POLL) |
3369 | return -EINVAL; |
3370 | |
3371 | - old_ps = data->ps; |
3372 | - data->ps = val; |
3373 | - |
3374 | - local_bh_disable(); |
3375 | if (val == PS_MANUAL_POLL) { |
3376 | + if (data->ps != PS_ENABLED) |
3377 | + return -EINVAL; |
3378 | + local_bh_disable(); |
3379 | ieee80211_iterate_active_interfaces_atomic( |
3380 | data->hw, IEEE80211_IFACE_ITER_NORMAL, |
3381 | hwsim_send_ps_poll, data); |
3382 | - data->ps_poll_pending = true; |
3383 | - } else if (old_ps == PS_DISABLED && val != PS_DISABLED) { |
3384 | + local_bh_enable(); |
3385 | + return 0; |
3386 | + } |
3387 | + old_ps = data->ps; |
3388 | + data->ps = val; |
3389 | + |
3390 | + local_bh_disable(); |
3391 | + if (old_ps == PS_DISABLED && val != PS_DISABLED) { |
3392 | ieee80211_iterate_active_interfaces_atomic( |
3393 | data->hw, IEEE80211_IFACE_ITER_NORMAL, |
3394 | hwsim_send_nullfunc_ps, data); |
3395 | @@ -1208,7 +1211,9 @@ static bool mac80211_hwsim_tx_frame_no_nl(struct ieee80211_hw *hw, |
3396 | if (info->control.rates[0].flags & IEEE80211_TX_RC_SHORT_GI) |
3397 | rx_status.flag |= RX_FLAG_SHORT_GI; |
3398 | /* TODO: simulate real signal strength (and optional packet loss) */ |
3399 | - rx_status.signal = data->power_level - 50; |
3400 | + rx_status.signal = -50; |
3401 | + if (info->control.vif) |
3402 | + rx_status.signal += info->control.vif->bss_conf.txpower; |
3403 | |
3404 | if (data->ps != PS_DISABLED) |
3405 | hdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_PM); |
3406 | @@ -1607,7 +1612,6 @@ static int mac80211_hwsim_config(struct ieee80211_hw *hw, u32 changed) |
3407 | |
3408 | WARN_ON(data->channel && data->use_chanctx); |
3409 | |
3410 | - data->power_level = conf->power_level; |
3411 | if (!data->started || !data->beacon_int) |
3412 | tasklet_hrtimer_cancel(&data->beacon_timer); |
3413 | else if (!hrtimer_is_queued(&data->beacon_timer.timer)) { |
3414 | @@ -2212,7 +2216,6 @@ static const char mac80211_hwsim_gstrings_stats[][ETH_GSTRING_LEN] = { |
3415 | "d_tx_failed", |
3416 | "d_ps_mode", |
3417 | "d_group", |
3418 | - "d_tx_power", |
3419 | }; |
3420 | |
3421 | #define MAC80211_HWSIM_SSTATS_LEN ARRAY_SIZE(mac80211_hwsim_gstrings_stats) |
3422 | @@ -2249,7 +2252,6 @@ static void mac80211_hwsim_get_et_stats(struct ieee80211_hw *hw, |
3423 | data[i++] = ar->tx_failed; |
3424 | data[i++] = ar->ps; |
3425 | data[i++] = ar->group; |
3426 | - data[i++] = ar->power_level; |
3427 | |
3428 | WARN_ON(i != MAC80211_HWSIM_SSTATS_LEN); |
3429 | } |
3430 | diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c |
3431 | index 8677a53ef725..48d51be11f9b 100644 |
3432 | --- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c |
3433 | +++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c |
3434 | @@ -1109,6 +1109,12 @@ mwifiex_cfg80211_change_virtual_intf(struct wiphy *wiphy, |
3435 | struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); |
3436 | enum nl80211_iftype curr_iftype = dev->ieee80211_ptr->iftype; |
3437 | |
3438 | + if (priv->scan_request) { |
3439 | + mwifiex_dbg(priv->adapter, ERROR, |
3440 | + "change virtual interface: scan in process\n"); |
3441 | + return -EBUSY; |
3442 | + } |
3443 | + |
3444 | switch (curr_iftype) { |
3445 | case NL80211_IFTYPE_ADHOC: |
3446 | switch (type) { |
3447 | diff --git a/drivers/net/wireless/marvell/mwifiex/sdio.c b/drivers/net/wireless/marvell/mwifiex/sdio.c |
3448 | index 8d601dcf2948..486b8c75cd1f 100644 |
3449 | --- a/drivers/net/wireless/marvell/mwifiex/sdio.c |
3450 | +++ b/drivers/net/wireless/marvell/mwifiex/sdio.c |
3451 | @@ -1458,7 +1458,7 @@ static int mwifiex_sdio_card_to_host_mp_aggr(struct mwifiex_adapter *adapter, |
3452 | } |
3453 | |
3454 | if (card->mpa_rx.pkt_cnt == 1) |
3455 | - mport = adapter->ioport + port; |
3456 | + mport = adapter->ioport + card->mpa_rx.start_port; |
3457 | |
3458 | if (mwifiex_read_data_sync(adapter, card->mpa_rx.buf, |
3459 | card->mpa_rx.buf_len, mport, 1)) |
3460 | @@ -1891,7 +1891,7 @@ static int mwifiex_host_to_card_mp_aggr(struct mwifiex_adapter *adapter, |
3461 | } |
3462 | |
3463 | if (card->mpa_tx.pkt_cnt == 1) |
3464 | - mport = adapter->ioport + port; |
3465 | + mport = adapter->ioport + card->mpa_tx.start_port; |
3466 | |
3467 | ret = mwifiex_write_data_to_card(adapter, card->mpa_tx.buf, |
3468 | card->mpa_tx.buf_len, mport); |
3469 | diff --git a/drivers/net/wireless/zydas/zd1211rw/zd_usb.c b/drivers/net/wireless/zydas/zd1211rw/zd_usb.c |
3470 | index c5effd6c6be9..01ca1d57b3d9 100644 |
3471 | --- a/drivers/net/wireless/zydas/zd1211rw/zd_usb.c |
3472 | +++ b/drivers/net/wireless/zydas/zd1211rw/zd_usb.c |
3473 | @@ -1278,6 +1278,9 @@ static int eject_installer(struct usb_interface *intf) |
3474 | u8 bulk_out_ep; |
3475 | int r; |
3476 | |
3477 | + if (iface_desc->desc.bNumEndpoints < 2) |
3478 | + return -ENODEV; |
3479 | + |
3480 | /* Find bulk out endpoint */ |
3481 | for (r = 1; r >= 0; r--) { |
3482 | endpoint = &iface_desc->endpoint[r].desc; |
3483 | diff --git a/drivers/nfc/nfcmrvl/fw_dnld.c b/drivers/nfc/nfcmrvl/fw_dnld.c |
3484 | index af62c4c854f3..b4f31dad40d6 100644 |
3485 | --- a/drivers/nfc/nfcmrvl/fw_dnld.c |
3486 | +++ b/drivers/nfc/nfcmrvl/fw_dnld.c |
3487 | @@ -17,7 +17,7 @@ |
3488 | */ |
3489 | |
3490 | #include <linux/module.h> |
3491 | -#include <linux/unaligned/access_ok.h> |
3492 | +#include <asm/unaligned.h> |
3493 | #include <linux/firmware.h> |
3494 | #include <linux/nfc.h> |
3495 | #include <net/nfc/nci.h> |
3496 | diff --git a/drivers/nfc/nfcmrvl/spi.c b/drivers/nfc/nfcmrvl/spi.c |
3497 | index a7faa0bcc01e..fc8e78a29d77 100644 |
3498 | --- a/drivers/nfc/nfcmrvl/spi.c |
3499 | +++ b/drivers/nfc/nfcmrvl/spi.c |
3500 | @@ -96,10 +96,9 @@ static int nfcmrvl_spi_nci_send(struct nfcmrvl_private *priv, |
3501 | /* Send the SPI packet */ |
3502 | err = nci_spi_send(drv_data->nci_spi, &drv_data->handshake_completion, |
3503 | skb); |
3504 | - if (err != 0) { |
3505 | + if (err) |
3506 | nfc_err(priv->dev, "spi_send failed %d", err); |
3507 | - kfree_skb(skb); |
3508 | - } |
3509 | + |
3510 | return err; |
3511 | } |
3512 | |
3513 | diff --git a/drivers/nfc/pn533/i2c.c b/drivers/nfc/pn533/i2c.c |
3514 | index 1dc89248e58e..11d78b43cf76 100644 |
3515 | --- a/drivers/nfc/pn533/i2c.c |
3516 | +++ b/drivers/nfc/pn533/i2c.c |
3517 | @@ -242,10 +242,10 @@ static int pn533_i2c_remove(struct i2c_client *client) |
3518 | |
3519 | dev_dbg(&client->dev, "%s\n", __func__); |
3520 | |
3521 | - pn533_unregister_device(phy->priv); |
3522 | - |
3523 | free_irq(client->irq, phy); |
3524 | |
3525 | + pn533_unregister_device(phy->priv); |
3526 | + |
3527 | return 0; |
3528 | } |
3529 | |
3530 | diff --git a/drivers/of/device.c b/drivers/of/device.c |
3531 | index f7a970120055..3cda60c036f9 100644 |
3532 | --- a/drivers/of/device.c |
3533 | +++ b/drivers/of/device.c |
3534 | @@ -223,7 +223,7 @@ ssize_t of_device_get_modalias(struct device *dev, char *str, ssize_t len) |
3535 | str[i] = '_'; |
3536 | } |
3537 | |
3538 | - return tsize; |
3539 | + return repend; |
3540 | } |
3541 | EXPORT_SYMBOL_GPL(of_device_get_modalias); |
3542 | |
3543 | diff --git a/drivers/pci/host/pci-hyperv.c b/drivers/pci/host/pci-hyperv.c |
3544 | index dafb4cdb2b7f..d392a55ec0a9 100644 |
3545 | --- a/drivers/pci/host/pci-hyperv.c |
3546 | +++ b/drivers/pci/host/pci-hyperv.c |
3547 | @@ -351,6 +351,7 @@ enum hv_pcibus_state { |
3548 | hv_pcibus_init = 0, |
3549 | hv_pcibus_probed, |
3550 | hv_pcibus_installed, |
3551 | + hv_pcibus_removed, |
3552 | hv_pcibus_maximum |
3553 | }; |
3554 | |
3555 | @@ -1205,9 +1206,11 @@ static int create_root_hv_pci_bus(struct hv_pcibus_device *hbus) |
3556 | hbus->pci_bus->msi = &hbus->msi_chip; |
3557 | hbus->pci_bus->msi->dev = &hbus->hdev->device; |
3558 | |
3559 | + pci_lock_rescan_remove(); |
3560 | pci_scan_child_bus(hbus->pci_bus); |
3561 | pci_bus_assign_resources(hbus->pci_bus); |
3562 | pci_bus_add_devices(hbus->pci_bus); |
3563 | + pci_unlock_rescan_remove(); |
3564 | hbus->state = hv_pcibus_installed; |
3565 | return 0; |
3566 | } |
3567 | @@ -1489,13 +1492,24 @@ static void pci_devices_present_work(struct work_struct *work) |
3568 | put_pcichild(hpdev, hv_pcidev_ref_initial); |
3569 | } |
3570 | |
3571 | - /* Tell the core to rescan bus because there may have been changes. */ |
3572 | - if (hbus->state == hv_pcibus_installed) { |
3573 | + switch(hbus->state) { |
3574 | + case hv_pcibus_installed: |
3575 | + /* |
3576 | + * Tell the core to rescan bus |
3577 | + * because there may have been changes. |
3578 | + */ |
3579 | pci_lock_rescan_remove(); |
3580 | pci_scan_child_bus(hbus->pci_bus); |
3581 | pci_unlock_rescan_remove(); |
3582 | - } else { |
3583 | + break; |
3584 | + |
3585 | + case hv_pcibus_init: |
3586 | + case hv_pcibus_probed: |
3587 | survey_child_resources(hbus); |
3588 | + break; |
3589 | + |
3590 | + default: |
3591 | + break; |
3592 | } |
3593 | |
3594 | up(&hbus->enum_sem); |
3595 | @@ -1585,8 +1599,10 @@ static void hv_eject_device_work(struct work_struct *work) |
3596 | pdev = pci_get_domain_bus_and_slot(hpdev->hbus->sysdata.domain, 0, |
3597 | wslot); |
3598 | if (pdev) { |
3599 | + pci_lock_rescan_remove(); |
3600 | pci_stop_and_remove_bus_device(pdev); |
3601 | pci_dev_put(pdev); |
3602 | + pci_unlock_rescan_remove(); |
3603 | } |
3604 | |
3605 | memset(&ctxt, 0, sizeof(ctxt)); |
3606 | @@ -2170,6 +2186,7 @@ static int hv_pci_probe(struct hv_device *hdev, |
3607 | hbus = kzalloc(sizeof(*hbus), GFP_KERNEL); |
3608 | if (!hbus) |
3609 | return -ENOMEM; |
3610 | + hbus->state = hv_pcibus_init; |
3611 | |
3612 | /* |
3613 | * The PCI bus "domain" is what is called "segment" in ACPI and |
3614 | @@ -2312,6 +2329,7 @@ static int hv_pci_remove(struct hv_device *hdev) |
3615 | pci_stop_root_bus(hbus->pci_bus); |
3616 | pci_remove_root_bus(hbus->pci_bus); |
3617 | pci_unlock_rescan_remove(); |
3618 | + hbus->state = hv_pcibus_removed; |
3619 | } |
3620 | |
3621 | ret = hv_send_resources_released(hdev); |
3622 | diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c |
3623 | index 802997e2ddcc..d81ad841dc0c 100644 |
3624 | --- a/drivers/pci/pci-driver.c |
3625 | +++ b/drivers/pci/pci-driver.c |
3626 | @@ -463,8 +463,6 @@ static void pci_device_shutdown(struct device *dev) |
3627 | |
3628 | if (drv && drv->shutdown) |
3629 | drv->shutdown(pci_dev); |
3630 | - pci_msi_shutdown(pci_dev); |
3631 | - pci_msix_shutdown(pci_dev); |
3632 | |
3633 | /* |
3634 | * If this is a kexec reboot, turn off Bus Master bit on the |
3635 | diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c |
3636 | index 0c9edc9d7c44..4c9fb8b323e8 100644 |
3637 | --- a/drivers/pci/quirks.c |
3638 | +++ b/drivers/pci/quirks.c |
3639 | @@ -4104,6 +4104,9 @@ static int pci_quirk_cavium_acs(struct pci_dev *dev, u16 acs_flags) |
3640 | */ |
3641 | acs_flags &= ~(PCI_ACS_RR | PCI_ACS_CR | PCI_ACS_SV | PCI_ACS_UF); |
3642 | |
3643 | + if (!((dev->device >= 0xa000) && (dev->device <= 0xa0ff))) |
3644 | + return -ENOTTY; |
3645 | + |
3646 | return acs_flags ? 0 : 1; |
3647 | } |
3648 | |
3649 | diff --git a/drivers/perf/arm_pmu.c b/drivers/perf/arm_pmu.c |
3650 | index b37b57294566..af82edc7fa5c 100644 |
3651 | --- a/drivers/perf/arm_pmu.c |
3652 | +++ b/drivers/perf/arm_pmu.c |
3653 | @@ -322,10 +322,16 @@ validate_group(struct perf_event *event) |
3654 | return 0; |
3655 | } |
3656 | |
3657 | +static struct arm_pmu_platdata *armpmu_get_platdata(struct arm_pmu *armpmu) |
3658 | +{ |
3659 | + struct platform_device *pdev = armpmu->plat_device; |
3660 | + |
3661 | + return pdev ? dev_get_platdata(&pdev->dev) : NULL; |
3662 | +} |
3663 | + |
3664 | static irqreturn_t armpmu_dispatch_irq(int irq, void *dev) |
3665 | { |
3666 | struct arm_pmu *armpmu; |
3667 | - struct platform_device *plat_device; |
3668 | struct arm_pmu_platdata *plat; |
3669 | int ret; |
3670 | u64 start_clock, finish_clock; |
3671 | @@ -337,8 +343,8 @@ static irqreturn_t armpmu_dispatch_irq(int irq, void *dev) |
3672 | * dereference. |
3673 | */ |
3674 | armpmu = *(void **)dev; |
3675 | - plat_device = armpmu->plat_device; |
3676 | - plat = dev_get_platdata(&plat_device->dev); |
3677 | + |
3678 | + plat = armpmu_get_platdata(armpmu); |
3679 | |
3680 | start_clock = sched_clock(); |
3681 | if (plat && plat->handle_irq) |
3682 | diff --git a/drivers/power/supply/ab8500_charger.c b/drivers/power/supply/ab8500_charger.c |
3683 | index 5cee9aa87aa3..48a11fd86a7f 100644 |
3684 | --- a/drivers/power/supply/ab8500_charger.c |
3685 | +++ b/drivers/power/supply/ab8500_charger.c |
3686 | @@ -3218,11 +3218,13 @@ static int ab8500_charger_init_hw_registers(struct ab8500_charger *di) |
3687 | } |
3688 | |
3689 | /* Enable backup battery charging */ |
3690 | - abx500_mask_and_set_register_interruptible(di->dev, |
3691 | + ret = abx500_mask_and_set_register_interruptible(di->dev, |
3692 | AB8500_RTC, AB8500_RTC_CTRL_REG, |
3693 | RTC_BUP_CH_ENA, RTC_BUP_CH_ENA); |
3694 | - if (ret < 0) |
3695 | + if (ret < 0) { |
3696 | dev_err(di->dev, "%s mask and set failed\n", __func__); |
3697 | + goto out; |
3698 | + } |
3699 | |
3700 | if (is_ab8540(di->parent)) { |
3701 | ret = abx500_mask_and_set_register_interruptible(di->dev, |
3702 | diff --git a/drivers/pwm/pwm-stmpe.c b/drivers/pwm/pwm-stmpe.c |
3703 | index e464582a390a..3439f1e902cb 100644 |
3704 | --- a/drivers/pwm/pwm-stmpe.c |
3705 | +++ b/drivers/pwm/pwm-stmpe.c |
3706 | @@ -145,7 +145,7 @@ static int stmpe_24xx_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm, |
3707 | break; |
3708 | |
3709 | case 2: |
3710 | - offset = STMPE24XX_PWMIC1; |
3711 | + offset = STMPE24XX_PWMIC2; |
3712 | break; |
3713 | |
3714 | default: |
3715 | diff --git a/drivers/pwm/pwm-tegra.c b/drivers/pwm/pwm-tegra.c |
3716 | index e4647840cd6e..7e8906d6ab7a 100644 |
3717 | --- a/drivers/pwm/pwm-tegra.c |
3718 | +++ b/drivers/pwm/pwm-tegra.c |
3719 | @@ -76,6 +76,7 @@ static int tegra_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm, |
3720 | struct tegra_pwm_chip *pc = to_tegra_pwm_chip(chip); |
3721 | unsigned long long c = duty_ns; |
3722 | unsigned long rate, hz; |
3723 | + unsigned long long ns100 = NSEC_PER_SEC; |
3724 | u32 val = 0; |
3725 | int err; |
3726 | |
3727 | @@ -95,9 +96,11 @@ static int tegra_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm, |
3728 | * cycles at the PWM clock rate will take period_ns nanoseconds. |
3729 | */ |
3730 | rate = clk_get_rate(pc->clk) >> PWM_DUTY_WIDTH; |
3731 | - hz = NSEC_PER_SEC / period_ns; |
3732 | |
3733 | - rate = (rate + (hz / 2)) / hz; |
3734 | + /* Consider precision in PWM_SCALE_WIDTH rate calculation */ |
3735 | + ns100 *= 100; |
3736 | + hz = DIV_ROUND_CLOSEST_ULL(ns100, period_ns); |
3737 | + rate = DIV_ROUND_CLOSEST(rate * 100, hz); |
3738 | |
3739 | /* |
3740 | * Since the actual PWM divider is the register's frequency divider |
3741 | diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c |
3742 | index 9403245503de..178fcda12cec 100644 |
3743 | --- a/drivers/regulator/core.c |
3744 | +++ b/drivers/regulator/core.c |
3745 | @@ -2465,7 +2465,7 @@ static int _regulator_list_voltage(struct regulator *regulator, |
3746 | ret = ops->list_voltage(rdev, selector); |
3747 | if (lock) |
3748 | mutex_unlock(&rdev->mutex); |
3749 | - } else if (rdev->supply) { |
3750 | + } else if (rdev->is_switch && rdev->supply) { |
3751 | ret = _regulator_list_voltage(rdev->supply, selector, lock); |
3752 | } else { |
3753 | return -EINVAL; |
3754 | @@ -2523,7 +2523,7 @@ int regulator_count_voltages(struct regulator *regulator) |
3755 | if (rdev->desc->n_voltages) |
3756 | return rdev->desc->n_voltages; |
3757 | |
3758 | - if (!rdev->supply) |
3759 | + if (!rdev->is_switch || !rdev->supply) |
3760 | return -EINVAL; |
3761 | |
3762 | return regulator_count_voltages(rdev->supply); |
3763 | @@ -4049,6 +4049,11 @@ regulator_register(const struct regulator_desc *regulator_desc, |
3764 | mutex_unlock(®ulator_list_mutex); |
3765 | } |
3766 | |
3767 | + if (!rdev->desc->ops->get_voltage && |
3768 | + !rdev->desc->ops->list_voltage && |
3769 | + !rdev->desc->fixed_uV) |
3770 | + rdev->is_switch = true; |
3771 | + |
3772 | ret = device_register(&rdev->dev); |
3773 | if (ret != 0) { |
3774 | put_device(&rdev->dev); |
3775 | diff --git a/drivers/scsi/be2iscsi/be_cmds.c b/drivers/scsi/be2iscsi/be_cmds.c |
3776 | index be65da2988fb..838edbba8aec 100644 |
3777 | --- a/drivers/scsi/be2iscsi/be_cmds.c |
3778 | +++ b/drivers/scsi/be2iscsi/be_cmds.c |
3779 | @@ -246,6 +246,12 @@ int beiscsi_mccq_compl_wait(struct beiscsi_hba *phba, |
3780 | { |
3781 | int rc = 0; |
3782 | |
3783 | + if (!tag || tag > MAX_MCC_CMD) { |
3784 | + __beiscsi_log(phba, KERN_ERR, |
3785 | + "BC_%d : invalid tag %u\n", tag); |
3786 | + return -EINVAL; |
3787 | + } |
3788 | + |
3789 | if (beiscsi_hba_in_error(phba)) { |
3790 | clear_bit(MCC_TAG_STATE_RUNNING, |
3791 | &phba->ctrl.ptag_state[tag].tag_state); |
3792 | diff --git a/drivers/scsi/fnic/fnic_scsi.c b/drivers/scsi/fnic/fnic_scsi.c |
3793 | index 44dd372aa7d3..c056b8111ad2 100644 |
3794 | --- a/drivers/scsi/fnic/fnic_scsi.c |
3795 | +++ b/drivers/scsi/fnic/fnic_scsi.c |
3796 | @@ -1127,12 +1127,6 @@ static void fnic_fcpio_itmf_cmpl_handler(struct fnic *fnic, |
3797 | else |
3798 | CMD_ABTS_STATUS(sc) = hdr_status; |
3799 | |
3800 | - atomic64_dec(&fnic_stats->io_stats.active_ios); |
3801 | - if (atomic64_read(&fnic->io_cmpl_skip)) |
3802 | - atomic64_dec(&fnic->io_cmpl_skip); |
3803 | - else |
3804 | - atomic64_inc(&fnic_stats->io_stats.io_completions); |
3805 | - |
3806 | if (!(CMD_FLAGS(sc) & (FNIC_IO_ABORTED | FNIC_IO_DONE))) |
3807 | atomic64_inc(&misc_stats->no_icmnd_itmf_cmpls); |
3808 | |
3809 | @@ -1173,6 +1167,11 @@ static void fnic_fcpio_itmf_cmpl_handler(struct fnic *fnic, |
3810 | (((u64)CMD_FLAGS(sc) << 32) | |
3811 | CMD_STATE(sc))); |
3812 | sc->scsi_done(sc); |
3813 | + atomic64_dec(&fnic_stats->io_stats.active_ios); |
3814 | + if (atomic64_read(&fnic->io_cmpl_skip)) |
3815 | + atomic64_dec(&fnic->io_cmpl_skip); |
3816 | + else |
3817 | + atomic64_inc(&fnic_stats->io_stats.io_completions); |
3818 | } |
3819 | } |
3820 | |
3821 | @@ -1962,6 +1961,11 @@ int fnic_abort_cmd(struct scsi_cmnd *sc) |
3822 | /* Call SCSI completion function to complete the IO */ |
3823 | sc->result = (DID_ABORT << 16); |
3824 | sc->scsi_done(sc); |
3825 | + atomic64_dec(&fnic_stats->io_stats.active_ios); |
3826 | + if (atomic64_read(&fnic->io_cmpl_skip)) |
3827 | + atomic64_dec(&fnic->io_cmpl_skip); |
3828 | + else |
3829 | + atomic64_inc(&fnic_stats->io_stats.io_completions); |
3830 | } |
3831 | |
3832 | fnic_abort_cmd_end: |
3833 | diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c |
3834 | index 532474109624..c5bc41d97f84 100644 |
3835 | --- a/drivers/scsi/ipr.c |
3836 | +++ b/drivers/scsi/ipr.c |
3837 | @@ -836,8 +836,10 @@ static void ipr_sata_eh_done(struct ipr_cmnd *ipr_cmd) |
3838 | |
3839 | qc->err_mask |= AC_ERR_OTHER; |
3840 | sata_port->ioasa.status |= ATA_BUSY; |
3841 | - list_add_tail(&ipr_cmd->queue, &ipr_cmd->hrrq->hrrq_free_q); |
3842 | ata_qc_complete(qc); |
3843 | + if (ipr_cmd->eh_comp) |
3844 | + complete(ipr_cmd->eh_comp); |
3845 | + list_add_tail(&ipr_cmd->queue, &ipr_cmd->hrrq->hrrq_free_q); |
3846 | } |
3847 | |
3848 | /** |
3849 | @@ -5947,8 +5949,10 @@ static void ipr_erp_done(struct ipr_cmnd *ipr_cmd) |
3850 | res->in_erp = 0; |
3851 | } |
3852 | scsi_dma_unmap(ipr_cmd->scsi_cmd); |
3853 | - list_add_tail(&ipr_cmd->queue, &ipr_cmd->hrrq->hrrq_free_q); |
3854 | scsi_cmd->scsi_done(scsi_cmd); |
3855 | + if (ipr_cmd->eh_comp) |
3856 | + complete(ipr_cmd->eh_comp); |
3857 | + list_add_tail(&ipr_cmd->queue, &ipr_cmd->hrrq->hrrq_free_q); |
3858 | } |
3859 | |
3860 | /** |
3861 | @@ -6338,8 +6342,10 @@ static void ipr_erp_start(struct ipr_ioa_cfg *ioa_cfg, |
3862 | } |
3863 | |
3864 | scsi_dma_unmap(ipr_cmd->scsi_cmd); |
3865 | - list_add_tail(&ipr_cmd->queue, &ipr_cmd->hrrq->hrrq_free_q); |
3866 | scsi_cmd->scsi_done(scsi_cmd); |
3867 | + if (ipr_cmd->eh_comp) |
3868 | + complete(ipr_cmd->eh_comp); |
3869 | + list_add_tail(&ipr_cmd->queue, &ipr_cmd->hrrq->hrrq_free_q); |
3870 | } |
3871 | |
3872 | /** |
3873 | @@ -6365,8 +6371,10 @@ static void ipr_scsi_done(struct ipr_cmnd *ipr_cmd) |
3874 | scsi_dma_unmap(scsi_cmd); |
3875 | |
3876 | spin_lock_irqsave(ipr_cmd->hrrq->lock, lock_flags); |
3877 | - list_add_tail(&ipr_cmd->queue, &ipr_cmd->hrrq->hrrq_free_q); |
3878 | scsi_cmd->scsi_done(scsi_cmd); |
3879 | + if (ipr_cmd->eh_comp) |
3880 | + complete(ipr_cmd->eh_comp); |
3881 | + list_add_tail(&ipr_cmd->queue, &ipr_cmd->hrrq->hrrq_free_q); |
3882 | spin_unlock_irqrestore(ipr_cmd->hrrq->lock, lock_flags); |
3883 | } else { |
3884 | spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags); |
3885 | diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c |
3886 | index 94630d4738e6..baccd116f864 100644 |
3887 | --- a/drivers/scsi/qla2xxx/qla_os.c |
3888 | +++ b/drivers/scsi/qla2xxx/qla_os.c |
3889 | @@ -1443,7 +1443,7 @@ qla2x00_loop_reset(scsi_qla_host_t *vha) |
3890 | void |
3891 | qla2x00_abort_all_cmds(scsi_qla_host_t *vha, int res) |
3892 | { |
3893 | - int que, cnt; |
3894 | + int que, cnt, status; |
3895 | unsigned long flags; |
3896 | srb_t *sp; |
3897 | struct qla_hw_data *ha = vha->hw; |
3898 | @@ -1473,8 +1473,12 @@ qla2x00_abort_all_cmds(scsi_qla_host_t *vha, int res) |
3899 | */ |
3900 | sp_get(sp); |
3901 | spin_unlock_irqrestore(&ha->hardware_lock, flags); |
3902 | - qla2xxx_eh_abort(GET_CMD_SP(sp)); |
3903 | + status = qla2xxx_eh_abort(GET_CMD_SP(sp)); |
3904 | spin_lock_irqsave(&ha->hardware_lock, flags); |
3905 | + /* Get rid of extra reference if immediate exit |
3906 | + * from ql2xxx_eh_abort */ |
3907 | + if (status == FAILED && (qla2x00_isp_reg_stat(ha))) |
3908 | + atomic_dec(&sp->ref_count); |
3909 | } |
3910 | req->outstanding_cmds[cnt] = NULL; |
3911 | sp->done(vha, sp, res); |
3912 | diff --git a/drivers/scsi/scsi_devinfo.c b/drivers/scsi/scsi_devinfo.c |
3913 | index 26e6b05d05fc..43d4b30cbf65 100644 |
3914 | --- a/drivers/scsi/scsi_devinfo.c |
3915 | +++ b/drivers/scsi/scsi_devinfo.c |
3916 | @@ -180,7 +180,7 @@ static struct { |
3917 | {"HITACHI", "6586-", "*", BLIST_SPARSELUN | BLIST_LARGELUN}, |
3918 | {"HITACHI", "6588-", "*", BLIST_SPARSELUN | BLIST_LARGELUN}, |
3919 | {"HP", "A6189A", NULL, BLIST_SPARSELUN | BLIST_LARGELUN}, /* HP VA7400 */ |
3920 | - {"HP", "OPEN-", "*", BLIST_REPORTLUN2}, /* HP XP Arrays */ |
3921 | + {"HP", "OPEN-", "*", BLIST_REPORTLUN2 | BLIST_TRY_VPD_PAGES}, /* HP XP Arrays */ |
3922 | {"HP", "NetRAID-4M", NULL, BLIST_FORCELUN}, |
3923 | {"HP", "HSV100", NULL, BLIST_REPORTLUN2 | BLIST_NOSTARTONADD}, |
3924 | {"HP", "C1557A", NULL, BLIST_FORCELUN}, |
3925 | @@ -596,17 +596,12 @@ int scsi_get_device_flags_keyed(struct scsi_device *sdev, |
3926 | int key) |
3927 | { |
3928 | struct scsi_dev_info_list *devinfo; |
3929 | - int err; |
3930 | |
3931 | devinfo = scsi_dev_info_list_find(vendor, model, key); |
3932 | if (!IS_ERR(devinfo)) |
3933 | return devinfo->flags; |
3934 | |
3935 | - err = PTR_ERR(devinfo); |
3936 | - if (err != -ENOENT) |
3937 | - return err; |
3938 | - |
3939 | - /* nothing found, return nothing */ |
3940 | + /* key or device not found: return nothing */ |
3941 | if (key != SCSI_DEVINFO_GLOBAL) |
3942 | return 0; |
3943 | |
3944 | diff --git a/drivers/scsi/scsi_dh.c b/drivers/scsi/scsi_dh.c |
3945 | index 84addee05be6..a5e30e9449ef 100644 |
3946 | --- a/drivers/scsi/scsi_dh.c |
3947 | +++ b/drivers/scsi/scsi_dh.c |
3948 | @@ -56,10 +56,13 @@ static const struct scsi_dh_blist scsi_dh_blist[] = { |
3949 | {"IBM", "1815", "rdac", }, |
3950 | {"IBM", "1818", "rdac", }, |
3951 | {"IBM", "3526", "rdac", }, |
3952 | + {"IBM", "3542", "rdac", }, |
3953 | + {"IBM", "3552", "rdac", }, |
3954 | {"SGI", "TP9", "rdac", }, |
3955 | {"SGI", "IS", "rdac", }, |
3956 | - {"STK", "OPENstorage D280", "rdac", }, |
3957 | + {"STK", "OPENstorage", "rdac", }, |
3958 | {"STK", "FLEXLINE 380", "rdac", }, |
3959 | + {"STK", "BladeCtlr", "rdac", }, |
3960 | {"SUN", "CSM", "rdac", }, |
3961 | {"SUN", "LCSM100", "rdac", }, |
3962 | {"SUN", "STK6580_6780", "rdac", }, |
3963 | diff --git a/drivers/scsi/ses.c b/drivers/scsi/ses.c |
3964 | index 50adabbb5808..69046d342bc5 100644 |
3965 | --- a/drivers/scsi/ses.c |
3966 | +++ b/drivers/scsi/ses.c |
3967 | @@ -548,7 +548,6 @@ static void ses_enclosure_data_process(struct enclosure_device *edev, |
3968 | ecomp = &edev->component[components++]; |
3969 | |
3970 | if (!IS_ERR(ecomp)) { |
3971 | - ses_get_power_status(edev, ecomp); |
3972 | if (addl_desc_ptr) |
3973 | ses_process_descriptor( |
3974 | ecomp, |
3975 | @@ -579,13 +578,16 @@ static void ses_enclosure_data_process(struct enclosure_device *edev, |
3976 | } |
3977 | |
3978 | static void ses_match_to_enclosure(struct enclosure_device *edev, |
3979 | - struct scsi_device *sdev) |
3980 | + struct scsi_device *sdev, |
3981 | + int refresh) |
3982 | { |
3983 | + struct scsi_device *edev_sdev = to_scsi_device(edev->edev.parent); |
3984 | struct efd efd = { |
3985 | .addr = 0, |
3986 | }; |
3987 | |
3988 | - ses_enclosure_data_process(edev, to_scsi_device(edev->edev.parent), 0); |
3989 | + if (refresh) |
3990 | + ses_enclosure_data_process(edev, edev_sdev, 0); |
3991 | |
3992 | if (scsi_is_sas_rphy(sdev->sdev_target->dev.parent)) |
3993 | efd.addr = sas_get_address(sdev); |
3994 | @@ -616,7 +618,7 @@ static int ses_intf_add(struct device *cdev, |
3995 | struct enclosure_device *prev = NULL; |
3996 | |
3997 | while ((edev = enclosure_find(&sdev->host->shost_gendev, prev)) != NULL) { |
3998 | - ses_match_to_enclosure(edev, sdev); |
3999 | + ses_match_to_enclosure(edev, sdev, 1); |
4000 | prev = edev; |
4001 | } |
4002 | return -ENODEV; |
4003 | @@ -728,7 +730,7 @@ static int ses_intf_add(struct device *cdev, |
4004 | shost_for_each_device(tmp_sdev, sdev->host) { |
4005 | if (tmp_sdev->lun != 0 || scsi_device_enclosure(tmp_sdev)) |
4006 | continue; |
4007 | - ses_match_to_enclosure(edev, tmp_sdev); |
4008 | + ses_match_to_enclosure(edev, tmp_sdev, 0); |
4009 | } |
4010 | |
4011 | return 0; |
4012 | diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c |
4013 | index cd9537ddc19f..7592ac8514d2 100644 |
4014 | --- a/drivers/scsi/sg.c |
4015 | +++ b/drivers/scsi/sg.c |
4016 | @@ -524,6 +524,7 @@ sg_read(struct file *filp, char __user *buf, size_t count, loff_t * ppos) |
4017 | } else |
4018 | count = (old_hdr->result == 0) ? 0 : -EIO; |
4019 | sg_finish_rem_req(srp); |
4020 | + sg_remove_request(sfp, srp); |
4021 | retval = count; |
4022 | free_old_hdr: |
4023 | kfree(old_hdr); |
4024 | @@ -564,6 +565,7 @@ sg_new_read(Sg_fd * sfp, char __user *buf, size_t count, Sg_request * srp) |
4025 | } |
4026 | err_out: |
4027 | err2 = sg_finish_rem_req(srp); |
4028 | + sg_remove_request(sfp, srp); |
4029 | return err ? : err2 ? : count; |
4030 | } |
4031 | |
4032 | @@ -663,18 +665,14 @@ sg_write(struct file *filp, const char __user *buf, size_t count, loff_t * ppos) |
4033 | * is a non-zero input_size, so emit a warning. |
4034 | */ |
4035 | if (hp->dxfer_direction == SG_DXFER_TO_FROM_DEV) { |
4036 | - static char cmd[TASK_COMM_LEN]; |
4037 | - if (strcmp(current->comm, cmd)) { |
4038 | - printk_ratelimited(KERN_WARNING |
4039 | - "sg_write: data in/out %d/%d bytes " |
4040 | - "for SCSI command 0x%x-- guessing " |
4041 | - "data in;\n program %s not setting " |
4042 | - "count and/or reply_len properly\n", |
4043 | - old_hdr.reply_len - (int)SZ_SG_HEADER, |
4044 | - input_size, (unsigned int) cmnd[0], |
4045 | - current->comm); |
4046 | - strcpy(cmd, current->comm); |
4047 | - } |
4048 | + printk_ratelimited(KERN_WARNING |
4049 | + "sg_write: data in/out %d/%d bytes " |
4050 | + "for SCSI command 0x%x-- guessing " |
4051 | + "data in;\n program %s not setting " |
4052 | + "count and/or reply_len properly\n", |
4053 | + old_hdr.reply_len - (int)SZ_SG_HEADER, |
4054 | + input_size, (unsigned int) cmnd[0], |
4055 | + current->comm); |
4056 | } |
4057 | k = sg_common_write(sfp, srp, cmnd, sfp->timeout, blocking); |
4058 | return (k < 0) ? k : count; |
4059 | @@ -773,11 +771,15 @@ sg_common_write(Sg_fd * sfp, Sg_request * srp, |
4060 | "sg_common_write: scsi opcode=0x%02x, cmd_size=%d\n", |
4061 | (int) cmnd[0], (int) hp->cmd_len)); |
4062 | |
4063 | + if (hp->dxfer_len >= SZ_256M) |
4064 | + return -EINVAL; |
4065 | + |
4066 | k = sg_start_req(srp, cmnd); |
4067 | if (k) { |
4068 | SCSI_LOG_TIMEOUT(1, sg_printk(KERN_INFO, sfp->parentdp, |
4069 | "sg_common_write: start_req err=%d\n", k)); |
4070 | sg_finish_rem_req(srp); |
4071 | + sg_remove_request(sfp, srp); |
4072 | return k; /* probably out of space --> ENOMEM */ |
4073 | } |
4074 | if (atomic_read(&sdp->detaching)) { |
4075 | @@ -790,6 +792,7 @@ sg_common_write(Sg_fd * sfp, Sg_request * srp, |
4076 | } |
4077 | |
4078 | sg_finish_rem_req(srp); |
4079 | + sg_remove_request(sfp, srp); |
4080 | return -ENODEV; |
4081 | } |
4082 | |
4083 | @@ -1280,6 +1283,7 @@ sg_rq_end_io_usercontext(struct work_struct *work) |
4084 | struct sg_fd *sfp = srp->parentfp; |
4085 | |
4086 | sg_finish_rem_req(srp); |
4087 | + sg_remove_request(sfp, srp); |
4088 | kref_put(&sfp->f_ref, sg_remove_sfp); |
4089 | } |
4090 | |
4091 | @@ -1824,8 +1828,6 @@ sg_finish_rem_req(Sg_request *srp) |
4092 | else |
4093 | sg_remove_scat(sfp, req_schp); |
4094 | |
4095 | - sg_remove_request(sfp, srp); |
4096 | - |
4097 | return ret; |
4098 | } |
4099 | |
4100 | @@ -2172,12 +2174,17 @@ sg_remove_sfp_usercontext(struct work_struct *work) |
4101 | struct sg_fd *sfp = container_of(work, struct sg_fd, ew.work); |
4102 | struct sg_device *sdp = sfp->parentdp; |
4103 | Sg_request *srp; |
4104 | + unsigned long iflags; |
4105 | |
4106 | /* Cleanup any responses which were never read(). */ |
4107 | + write_lock_irqsave(&sfp->rq_list_lock, iflags); |
4108 | while (!list_empty(&sfp->rq_list)) { |
4109 | srp = list_first_entry(&sfp->rq_list, Sg_request, entry); |
4110 | sg_finish_rem_req(srp); |
4111 | + list_del(&srp->entry); |
4112 | + srp->parentfp = NULL; |
4113 | } |
4114 | + write_unlock_irqrestore(&sfp->rq_list_lock, iflags); |
4115 | |
4116 | if (sfp->reserve.bufflen > 0) { |
4117 | SCSI_LOG_TIMEOUT(6, sg_printk(KERN_INFO, sdp, |
4118 | diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c |
4119 | index d5157b2222ce..a47cf638460a 100644 |
4120 | --- a/drivers/spi/spi-omap2-mcspi.c |
4121 | +++ b/drivers/spi/spi-omap2-mcspi.c |
4122 | @@ -454,6 +454,8 @@ omap2_mcspi_rx_dma(struct spi_device *spi, struct spi_transfer *xfer, |
4123 | int elements = 0; |
4124 | int word_len, element_count; |
4125 | struct omap2_mcspi_cs *cs = spi->controller_state; |
4126 | + void __iomem *chstat_reg = cs->base + OMAP2_MCSPI_CHSTAT0; |
4127 | + |
4128 | mcspi = spi_master_get_devdata(spi->master); |
4129 | mcspi_dma = &mcspi->dma_channels[spi->chip_select]; |
4130 | count = xfer->len; |
4131 | @@ -549,8 +551,8 @@ omap2_mcspi_rx_dma(struct spi_device *spi, struct spi_transfer *xfer, |
4132 | if (l & OMAP2_MCSPI_CHCONF_TURBO) { |
4133 | elements--; |
4134 | |
4135 | - if (likely(mcspi_read_cs_reg(spi, OMAP2_MCSPI_CHSTAT0) |
4136 | - & OMAP2_MCSPI_CHSTAT_RXS)) { |
4137 | + if (!mcspi_wait_for_reg_bit(chstat_reg, |
4138 | + OMAP2_MCSPI_CHSTAT_RXS)) { |
4139 | u32 w; |
4140 | |
4141 | w = mcspi_read_cs_reg(spi, OMAP2_MCSPI_RX0); |
4142 | @@ -568,8 +570,7 @@ omap2_mcspi_rx_dma(struct spi_device *spi, struct spi_transfer *xfer, |
4143 | return count; |
4144 | } |
4145 | } |
4146 | - if (likely(mcspi_read_cs_reg(spi, OMAP2_MCSPI_CHSTAT0) |
4147 | - & OMAP2_MCSPI_CHSTAT_RXS)) { |
4148 | + if (!mcspi_wait_for_reg_bit(chstat_reg, OMAP2_MCSPI_CHSTAT_RXS)) { |
4149 | u32 w; |
4150 | |
4151 | w = mcspi_read_cs_reg(spi, OMAP2_MCSPI_RX0); |
4152 | diff --git a/drivers/spi/spi-sun6i.c b/drivers/spi/spi-sun6i.c |
4153 | index 9918a57a6a6e..7e7da97982aa 100644 |
4154 | --- a/drivers/spi/spi-sun6i.c |
4155 | +++ b/drivers/spi/spi-sun6i.c |
4156 | @@ -464,7 +464,7 @@ static int sun6i_spi_probe(struct platform_device *pdev) |
4157 | |
4158 | static int sun6i_spi_remove(struct platform_device *pdev) |
4159 | { |
4160 | - pm_runtime_disable(&pdev->dev); |
4161 | + pm_runtime_force_suspend(&pdev->dev); |
4162 | |
4163 | return 0; |
4164 | } |
4165 | diff --git a/drivers/staging/speakup/kobjects.c b/drivers/staging/speakup/kobjects.c |
4166 | index e744aa9730ff..dea018cba094 100644 |
4167 | --- a/drivers/staging/speakup/kobjects.c |
4168 | +++ b/drivers/staging/speakup/kobjects.c |
4169 | @@ -834,7 +834,9 @@ static ssize_t message_show(struct kobject *kobj, |
4170 | struct msg_group_t *group = spk_find_msg_group(attr->attr.name); |
4171 | unsigned long flags; |
4172 | |
4173 | - BUG_ON(!group); |
4174 | + if (WARN_ON(!group)) |
4175 | + return -EINVAL; |
4176 | + |
4177 | spin_lock_irqsave(&speakup_info.spinlock, flags); |
4178 | retval = message_show_helper(buf, group->start, group->end); |
4179 | spin_unlock_irqrestore(&speakup_info.spinlock, flags); |
4180 | @@ -846,7 +848,9 @@ static ssize_t message_store(struct kobject *kobj, struct kobj_attribute *attr, |
4181 | { |
4182 | struct msg_group_t *group = spk_find_msg_group(attr->attr.name); |
4183 | |
4184 | - BUG_ON(!group); |
4185 | + if (WARN_ON(!group)) |
4186 | + return -EINVAL; |
4187 | + |
4188 | return message_store_helper(buf, count, group); |
4189 | } |
4190 | |
4191 | diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c |
4192 | index 6ab7443eabde..6326375b76ab 100644 |
4193 | --- a/drivers/staging/wilc1000/host_interface.c |
4194 | +++ b/drivers/staging/wilc1000/host_interface.c |
4195 | @@ -1930,6 +1930,8 @@ static s32 Handle_Get_InActiveTime(struct wilc_vif *vif, |
4196 | wid.type = WID_STR; |
4197 | wid.size = ETH_ALEN; |
4198 | wid.val = kmalloc(wid.size, GFP_KERNEL); |
4199 | + if (!wid.val) |
4200 | + return -ENOMEM; |
4201 | |
4202 | stamac = wid.val; |
4203 | memcpy(stamac, strHostIfStaInactiveT->mac, ETH_ALEN); |
4204 | diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c |
4205 | index e2c33b9528d8..b42d7f1c9089 100644 |
4206 | --- a/drivers/tty/serial/amba-pl011.c |
4207 | +++ b/drivers/tty/serial/amba-pl011.c |
4208 | @@ -1302,14 +1302,15 @@ static void pl011_stop_tx(struct uart_port *port) |
4209 | pl011_dma_tx_stop(uap); |
4210 | } |
4211 | |
4212 | -static void pl011_tx_chars(struct uart_amba_port *uap, bool from_irq); |
4213 | +static bool pl011_tx_chars(struct uart_amba_port *uap, bool from_irq); |
4214 | |
4215 | /* Start TX with programmed I/O only (no DMA) */ |
4216 | static void pl011_start_tx_pio(struct uart_amba_port *uap) |
4217 | { |
4218 | - uap->im |= UART011_TXIM; |
4219 | - pl011_write(uap->im, uap, REG_IMSC); |
4220 | - pl011_tx_chars(uap, false); |
4221 | + if (pl011_tx_chars(uap, false)) { |
4222 | + uap->im |= UART011_TXIM; |
4223 | + pl011_write(uap->im, uap, REG_IMSC); |
4224 | + } |
4225 | } |
4226 | |
4227 | static void pl011_start_tx(struct uart_port *port) |
4228 | @@ -1389,25 +1390,26 @@ static bool pl011_tx_char(struct uart_amba_port *uap, unsigned char c, |
4229 | return true; |
4230 | } |
4231 | |
4232 | -static void pl011_tx_chars(struct uart_amba_port *uap, bool from_irq) |
4233 | +/* Returns true if tx interrupts have to be (kept) enabled */ |
4234 | +static bool pl011_tx_chars(struct uart_amba_port *uap, bool from_irq) |
4235 | { |
4236 | struct circ_buf *xmit = &uap->port.state->xmit; |
4237 | int count = uap->fifosize >> 1; |
4238 | |
4239 | if (uap->port.x_char) { |
4240 | if (!pl011_tx_char(uap, uap->port.x_char, from_irq)) |
4241 | - return; |
4242 | + return true; |
4243 | uap->port.x_char = 0; |
4244 | --count; |
4245 | } |
4246 | if (uart_circ_empty(xmit) || uart_tx_stopped(&uap->port)) { |
4247 | pl011_stop_tx(&uap->port); |
4248 | - return; |
4249 | + return false; |
4250 | } |
4251 | |
4252 | /* If we are using DMA mode, try to send some characters. */ |
4253 | if (pl011_dma_tx_irq(uap)) |
4254 | - return; |
4255 | + return true; |
4256 | |
4257 | do { |
4258 | if (likely(from_irq) && count-- == 0) |
4259 | @@ -1422,8 +1424,11 @@ static void pl011_tx_chars(struct uart_amba_port *uap, bool from_irq) |
4260 | if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) |
4261 | uart_write_wakeup(&uap->port); |
4262 | |
4263 | - if (uart_circ_empty(xmit)) |
4264 | + if (uart_circ_empty(xmit)) { |
4265 | pl011_stop_tx(&uap->port); |
4266 | + return false; |
4267 | + } |
4268 | + return true; |
4269 | } |
4270 | |
4271 | static void pl011_modem_status(struct uart_amba_port *uap) |
4272 | diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c |
4273 | index 521a6e450755..f575a33974fa 100644 |
4274 | --- a/drivers/tty/serial/imx.c |
4275 | +++ b/drivers/tty/serial/imx.c |
4276 | @@ -1316,19 +1316,10 @@ static int imx_startup(struct uart_port *port) |
4277 | if (!is_imx1_uart(sport)) { |
4278 | temp = readl(sport->port.membase + UCR3); |
4279 | |
4280 | - /* |
4281 | - * The effect of RI and DCD differs depending on the UFCR_DCEDTE |
4282 | - * bit. In DCE mode they control the outputs, in DTE mode they |
4283 | - * enable the respective irqs. At least the DCD irq cannot be |
4284 | - * cleared on i.MX25 at least, so it's not usable and must be |
4285 | - * disabled. I don't have test hardware to check if RI has the |
4286 | - * same problem but I consider this likely so it's disabled for |
4287 | - * now, too. |
4288 | - */ |
4289 | - temp |= IMX21_UCR3_RXDMUXSEL | UCR3_ADNIMP | |
4290 | - UCR3_DTRDEN | UCR3_RI | UCR3_DCD; |
4291 | + temp |= UCR3_DTRDEN | UCR3_RI | UCR3_DCD; |
4292 | |
4293 | if (sport->dte_mode) |
4294 | + /* disable broken interrupts */ |
4295 | temp &= ~(UCR3_RI | UCR3_DCD); |
4296 | |
4297 | writel(temp, sport->port.membase + UCR3); |
4298 | @@ -1583,8 +1574,6 @@ imx_set_termios(struct uart_port *port, struct ktermios *termios, |
4299 | |
4300 | ufcr = readl(sport->port.membase + UFCR); |
4301 | ufcr = (ufcr & (~UFCR_RFDIV)) | UFCR_RFDIV_REG(div); |
4302 | - if (sport->dte_mode) |
4303 | - ufcr |= UFCR_DCEDTE; |
4304 | writel(ufcr, sport->port.membase + UFCR); |
4305 | |
4306 | writel(num, sport->port.membase + UBIR); |
4307 | @@ -2149,6 +2138,27 @@ static int serial_imx_probe(struct platform_device *pdev) |
4308 | UCR1_TXMPTYEN | UCR1_RTSDEN); |
4309 | writel_relaxed(reg, sport->port.membase + UCR1); |
4310 | |
4311 | + if (!is_imx1_uart(sport) && sport->dte_mode) { |
4312 | + /* |
4313 | + * The DCEDTE bit changes the direction of DSR, DCD, DTR and RI |
4314 | + * and influences if UCR3_RI and UCR3_DCD changes the level of RI |
4315 | + * and DCD (when they are outputs) or enables the respective |
4316 | + * irqs. So set this bit early, i.e. before requesting irqs. |
4317 | + */ |
4318 | + writel(UFCR_DCEDTE, sport->port.membase + UFCR); |
4319 | + |
4320 | + /* |
4321 | + * Disable UCR3_RI and UCR3_DCD irqs. They are also not |
4322 | + * enabled later because they cannot be cleared |
4323 | + * (confirmed on i.MX25) which makes them unusable. |
4324 | + */ |
4325 | + writel(IMX21_UCR3_RXDMUXSEL | UCR3_ADNIMP | UCR3_DSR, |
4326 | + sport->port.membase + UCR3); |
4327 | + |
4328 | + } else { |
4329 | + writel(0, sport->port.membase + UFCR); |
4330 | + } |
4331 | + |
4332 | clk_disable_unprepare(sport->clk_ipg); |
4333 | |
4334 | /* |
4335 | diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c |
4336 | index df5a06578005..dfc0566bb155 100644 |
4337 | --- a/drivers/usb/dwc2/hcd.c |
4338 | +++ b/drivers/usb/dwc2/hcd.c |
4339 | @@ -3220,6 +3220,7 @@ static void dwc2_conn_id_status_change(struct work_struct *work) |
4340 | dwc2_core_init(hsotg, false); |
4341 | dwc2_enable_global_interrupts(hsotg); |
4342 | spin_lock_irqsave(&hsotg->lock, flags); |
4343 | + dwc2_hsotg_disconnect(hsotg); |
4344 | dwc2_hsotg_core_init_disconnected(hsotg, false); |
4345 | spin_unlock_irqrestore(&hsotg->lock, flags); |
4346 | dwc2_hsotg_core_connect(hsotg); |
4347 | diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c |
4348 | index fea446900cad..a0c2b8b6edd0 100644 |
4349 | --- a/drivers/usb/dwc3/core.c |
4350 | +++ b/drivers/usb/dwc3/core.c |
4351 | @@ -463,6 +463,12 @@ static int dwc3_phy_setup(struct dwc3 *dwc) |
4352 | |
4353 | reg = dwc3_readl(dwc->regs, DWC3_GUSB3PIPECTL(0)); |
4354 | |
4355 | + /* |
4356 | + * Make sure UX_EXIT_PX is cleared as that causes issues with some |
4357 | + * PHYs. Also, this bit is not supposed to be used in normal operation. |
4358 | + */ |
4359 | + reg &= ~DWC3_GUSB3PIPECTL_UX_EXIT_PX; |
4360 | + |
4361 | /* |
4362 | * Above 1.94a, it is recommended to set DWC3_GUSB3PIPECTL_SUSPHY |
4363 | * to '0' during coreConsultant configuration. So default value |
4364 | diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h |
4365 | index 884c43714456..94d6a3e2ad97 100644 |
4366 | --- a/drivers/usb/dwc3/core.h |
4367 | +++ b/drivers/usb/dwc3/core.h |
4368 | @@ -159,13 +159,15 @@ |
4369 | #define DWC3_GDBGFIFOSPACE_TYPE(n) (((n) << 5) & 0x1e0) |
4370 | #define DWC3_GDBGFIFOSPACE_SPACE_AVAILABLE(n) (((n) >> 16) & 0xffff) |
4371 | |
4372 | -#define DWC3_TXFIFOQ 1 |
4373 | -#define DWC3_RXFIFOQ 3 |
4374 | -#define DWC3_TXREQQ 5 |
4375 | -#define DWC3_RXREQQ 7 |
4376 | -#define DWC3_RXINFOQ 9 |
4377 | -#define DWC3_DESCFETCHQ 13 |
4378 | -#define DWC3_EVENTQ 15 |
4379 | +#define DWC3_TXFIFOQ 0 |
4380 | +#define DWC3_RXFIFOQ 1 |
4381 | +#define DWC3_TXREQQ 2 |
4382 | +#define DWC3_RXREQQ 3 |
4383 | +#define DWC3_RXINFOQ 4 |
4384 | +#define DWC3_PSTATQ 5 |
4385 | +#define DWC3_DESCFETCHQ 6 |
4386 | +#define DWC3_EVENTQ 7 |
4387 | +#define DWC3_AUXEVENTQ 8 |
4388 | |
4389 | /* Global RX Threshold Configuration Register */ |
4390 | #define DWC3_GRXTHRCFG_MAXRXBURSTSIZE(n) (((n) & 0x1f) << 19) |
4391 | @@ -223,6 +225,7 @@ |
4392 | #define DWC3_GUSB3PIPECTL_PHYSOFTRST (1 << 31) |
4393 | #define DWC3_GUSB3PIPECTL_U2SSINP3OK (1 << 29) |
4394 | #define DWC3_GUSB3PIPECTL_DISRXDETINP3 (1 << 28) |
4395 | +#define DWC3_GUSB3PIPECTL_UX_EXIT_PX (1 << 27) |
4396 | #define DWC3_GUSB3PIPECTL_REQP1P2P3 (1 << 24) |
4397 | #define DWC3_GUSB3PIPECTL_DEP1P2P3(n) ((n) << 19) |
4398 | #define DWC3_GUSB3PIPECTL_DEP1P2P3_MASK DWC3_GUSB3PIPECTL_DEP1P2P3(7) |
4399 | diff --git a/drivers/usb/gadget/udc/bdc/bdc_core.c b/drivers/usb/gadget/udc/bdc/bdc_core.c |
4400 | index ccb9c213cc9f..e9bd8d4abca0 100644 |
4401 | --- a/drivers/usb/gadget/udc/bdc/bdc_core.c |
4402 | +++ b/drivers/usb/gadget/udc/bdc/bdc_core.c |
4403 | @@ -475,7 +475,7 @@ static int bdc_probe(struct platform_device *pdev) |
4404 | bdc->dev = dev; |
4405 | dev_dbg(bdc->dev, "bdc->regs: %p irq=%d\n", bdc->regs, bdc->irq); |
4406 | |
4407 | - temp = bdc_readl(bdc->regs, BDC_BDCSC); |
4408 | + temp = bdc_readl(bdc->regs, BDC_BDCCAP1); |
4409 | if ((temp & BDC_P64) && |
4410 | !dma_set_mask_and_coherent(dev, DMA_BIT_MASK(64))) { |
4411 | dev_dbg(bdc->dev, "Using 64-bit address\n"); |
4412 | diff --git a/drivers/usb/gadget/udc/bdc/bdc_pci.c b/drivers/usb/gadget/udc/bdc/bdc_pci.c |
4413 | index 02968842b359..708e36f530d8 100644 |
4414 | --- a/drivers/usb/gadget/udc/bdc/bdc_pci.c |
4415 | +++ b/drivers/usb/gadget/udc/bdc/bdc_pci.c |
4416 | @@ -82,6 +82,7 @@ static int bdc_pci_probe(struct pci_dev *pci, const struct pci_device_id *id) |
4417 | if (ret) { |
4418 | dev_err(&pci->dev, |
4419 | "couldn't add resources to bdc device\n"); |
4420 | + platform_device_put(bdc); |
4421 | return ret; |
4422 | } |
4423 | |
4424 | diff --git a/drivers/usb/gadget/udc/dummy_hcd.c b/drivers/usb/gadget/udc/dummy_hcd.c |
4425 | index b62a3de65075..ff4d6cac7ac0 100644 |
4426 | --- a/drivers/usb/gadget/udc/dummy_hcd.c |
4427 | +++ b/drivers/usb/gadget/udc/dummy_hcd.c |
4428 | @@ -2103,16 +2103,13 @@ static int dummy_hub_control( |
4429 | } |
4430 | break; |
4431 | case USB_PORT_FEAT_POWER: |
4432 | - if (hcd->speed == HCD_USB3) { |
4433 | - if (dum_hcd->port_status & USB_PORT_STAT_POWER) |
4434 | - dev_dbg(dummy_dev(dum_hcd), |
4435 | - "power-off\n"); |
4436 | - } else |
4437 | - if (dum_hcd->port_status & |
4438 | - USB_SS_PORT_STAT_POWER) |
4439 | - dev_dbg(dummy_dev(dum_hcd), |
4440 | - "power-off\n"); |
4441 | - /* FALLS THROUGH */ |
4442 | + dev_dbg(dummy_dev(dum_hcd), "power-off\n"); |
4443 | + if (hcd->speed == HCD_USB3) |
4444 | + dum_hcd->port_status &= ~USB_SS_PORT_STAT_POWER; |
4445 | + else |
4446 | + dum_hcd->port_status &= ~USB_PORT_STAT_POWER; |
4447 | + set_link_state(dum_hcd); |
4448 | + break; |
4449 | default: |
4450 | dum_hcd->port_status &= ~(1 << wValue); |
4451 | set_link_state(dum_hcd); |
4452 | @@ -2283,14 +2280,13 @@ static int dummy_hub_control( |
4453 | if ((dum_hcd->port_status & |
4454 | USB_SS_PORT_STAT_POWER) != 0) { |
4455 | dum_hcd->port_status |= (1 << wValue); |
4456 | - set_link_state(dum_hcd); |
4457 | } |
4458 | } else |
4459 | if ((dum_hcd->port_status & |
4460 | USB_PORT_STAT_POWER) != 0) { |
4461 | dum_hcd->port_status |= (1 << wValue); |
4462 | - set_link_state(dum_hcd); |
4463 | } |
4464 | + set_link_state(dum_hcd); |
4465 | } |
4466 | break; |
4467 | case GetPortErrorCount: |
4468 | diff --git a/drivers/usb/misc/lvstest.c b/drivers/usb/misc/lvstest.c |
4469 | index d3d124753266..bd6e06ef88ac 100644 |
4470 | --- a/drivers/usb/misc/lvstest.c |
4471 | +++ b/drivers/usb/misc/lvstest.c |
4472 | @@ -433,6 +433,7 @@ static void lvs_rh_disconnect(struct usb_interface *intf) |
4473 | struct lvs_rh *lvs = usb_get_intfdata(intf); |
4474 | |
4475 | sysfs_remove_group(&intf->dev.kobj, &lvs_attr_group); |
4476 | + usb_poison_urb(lvs->urb); /* used in scheduled work */ |
4477 | flush_work(&lvs->rh_work); |
4478 | usb_free_urb(lvs->urb); |
4479 | } |
4480 | diff --git a/drivers/vfio/vfio_iommu_spapr_tce.c b/drivers/vfio/vfio_iommu_spapr_tce.c |
4481 | index 59b3f62a2d64..70c748a5fbcc 100644 |
4482 | --- a/drivers/vfio/vfio_iommu_spapr_tce.c |
4483 | +++ b/drivers/vfio/vfio_iommu_spapr_tce.c |
4484 | @@ -195,6 +195,11 @@ static long tce_iommu_register_pages(struct tce_container *container, |
4485 | return ret; |
4486 | |
4487 | tcemem = kzalloc(sizeof(*tcemem), GFP_KERNEL); |
4488 | + if (!tcemem) { |
4489 | + mm_iommu_put(container->mm, mem); |
4490 | + return -ENOMEM; |
4491 | + } |
4492 | + |
4493 | tcemem->mem = mem; |
4494 | list_add(&tcemem->next, &container->prereg_list); |
4495 | |
4496 | @@ -1332,8 +1337,16 @@ static int tce_iommu_attach_group(void *iommu_data, |
4497 | |
4498 | if (!table_group->ops || !table_group->ops->take_ownership || |
4499 | !table_group->ops->release_ownership) { |
4500 | + if (container->v2) { |
4501 | + ret = -EPERM; |
4502 | + goto unlock_exit; |
4503 | + } |
4504 | ret = tce_iommu_take_ownership(container, table_group); |
4505 | } else { |
4506 | + if (!container->v2) { |
4507 | + ret = -EPERM; |
4508 | + goto unlock_exit; |
4509 | + } |
4510 | ret = tce_iommu_take_ownership_ddw(container, table_group); |
4511 | if (!tce_groups_attached(container) && !container->tables[0]) |
4512 | container->def_window_pending = true; |
4513 | diff --git a/drivers/video/fbdev/amba-clcd.c b/drivers/video/fbdev/amba-clcd.c |
4514 | index ec2671d98abc..89880b70cc28 100644 |
4515 | --- a/drivers/video/fbdev/amba-clcd.c |
4516 | +++ b/drivers/video/fbdev/amba-clcd.c |
4517 | @@ -892,8 +892,8 @@ static int clcdfb_of_dma_setup(struct clcd_fb *fb) |
4518 | if (err) |
4519 | return err; |
4520 | |
4521 | - framesize = fb->panel->mode.xres * fb->panel->mode.yres * |
4522 | - fb->panel->bpp / 8; |
4523 | + framesize = PAGE_ALIGN(fb->panel->mode.xres * fb->panel->mode.yres * |
4524 | + fb->panel->bpp / 8); |
4525 | fb->fb.screen_base = dma_alloc_coherent(&fb->dev->dev, framesize, |
4526 | &dma, GFP_KERNEL); |
4527 | if (!fb->fb.screen_base) |
4528 | diff --git a/drivers/video/fbdev/omap2/omapfb/dss/dss.c b/drivers/video/fbdev/omap2/omapfb/dss/dss.c |
4529 | index 47d7f69ad9ad..48c6500c24e1 100644 |
4530 | --- a/drivers/video/fbdev/omap2/omapfb/dss/dss.c |
4531 | +++ b/drivers/video/fbdev/omap2/omapfb/dss/dss.c |
4532 | @@ -941,11 +941,13 @@ static int dss_init_features(struct platform_device *pdev) |
4533 | return 0; |
4534 | } |
4535 | |
4536 | +static void dss_uninit_ports(struct platform_device *pdev); |
4537 | + |
4538 | static int dss_init_ports(struct platform_device *pdev) |
4539 | { |
4540 | struct device_node *parent = pdev->dev.of_node; |
4541 | struct device_node *port; |
4542 | - int r; |
4543 | + int r, ret = 0; |
4544 | |
4545 | if (parent == NULL) |
4546 | return 0; |
4547 | @@ -972,17 +974,21 @@ static int dss_init_ports(struct platform_device *pdev) |
4548 | |
4549 | switch (port_type) { |
4550 | case OMAP_DISPLAY_TYPE_DPI: |
4551 | - dpi_init_port(pdev, port); |
4552 | + ret = dpi_init_port(pdev, port); |
4553 | break; |
4554 | case OMAP_DISPLAY_TYPE_SDI: |
4555 | - sdi_init_port(pdev, port); |
4556 | + ret = sdi_init_port(pdev, port); |
4557 | break; |
4558 | default: |
4559 | break; |
4560 | } |
4561 | - } while ((port = omapdss_of_get_next_port(parent, port)) != NULL); |
4562 | + } while (!ret && |
4563 | + (port = omapdss_of_get_next_port(parent, port)) != NULL); |
4564 | |
4565 | - return 0; |
4566 | + if (ret) |
4567 | + dss_uninit_ports(pdev); |
4568 | + |
4569 | + return ret; |
4570 | } |
4571 | |
4572 | static void dss_uninit_ports(struct platform_device *pdev) |
4573 | diff --git a/drivers/video/hdmi.c b/drivers/video/hdmi.c |
4574 | index 162689227a23..b73520aaf697 100644 |
4575 | --- a/drivers/video/hdmi.c |
4576 | +++ b/drivers/video/hdmi.c |
4577 | @@ -321,6 +321,17 @@ int hdmi_vendor_infoframe_init(struct hdmi_vendor_infoframe *frame) |
4578 | } |
4579 | EXPORT_SYMBOL(hdmi_vendor_infoframe_init); |
4580 | |
4581 | +static int hdmi_vendor_infoframe_length(const struct hdmi_vendor_infoframe *frame) |
4582 | +{ |
4583 | + /* for side by side (half) we also need to provide 3D_Ext_Data */ |
4584 | + if (frame->s3d_struct >= HDMI_3D_STRUCTURE_SIDE_BY_SIDE_HALF) |
4585 | + return 6; |
4586 | + else if (frame->vic != 0 || frame->s3d_struct != HDMI_3D_STRUCTURE_INVALID) |
4587 | + return 5; |
4588 | + else |
4589 | + return 4; |
4590 | +} |
4591 | + |
4592 | /** |
4593 | * hdmi_vendor_infoframe_pack() - write a HDMI vendor infoframe to binary buffer |
4594 | * @frame: HDMI infoframe |
4595 | @@ -341,19 +352,11 @@ ssize_t hdmi_vendor_infoframe_pack(struct hdmi_vendor_infoframe *frame, |
4596 | u8 *ptr = buffer; |
4597 | size_t length; |
4598 | |
4599 | - /* empty info frame */ |
4600 | - if (frame->vic == 0 && frame->s3d_struct == HDMI_3D_STRUCTURE_INVALID) |
4601 | - return -EINVAL; |
4602 | - |
4603 | /* only one of those can be supplied */ |
4604 | if (frame->vic != 0 && frame->s3d_struct != HDMI_3D_STRUCTURE_INVALID) |
4605 | return -EINVAL; |
4606 | |
4607 | - /* for side by side (half) we also need to provide 3D_Ext_Data */ |
4608 | - if (frame->s3d_struct >= HDMI_3D_STRUCTURE_SIDE_BY_SIDE_HALF) |
4609 | - frame->length = 6; |
4610 | - else |
4611 | - frame->length = 5; |
4612 | + frame->length = hdmi_vendor_infoframe_length(frame); |
4613 | |
4614 | length = HDMI_INFOFRAME_HEADER_SIZE + frame->length; |
4615 | |
4616 | @@ -372,14 +375,16 @@ ssize_t hdmi_vendor_infoframe_pack(struct hdmi_vendor_infoframe *frame, |
4617 | ptr[5] = 0x0c; |
4618 | ptr[6] = 0x00; |
4619 | |
4620 | - if (frame->vic) { |
4621 | - ptr[7] = 0x1 << 5; /* video format */ |
4622 | - ptr[8] = frame->vic; |
4623 | - } else { |
4624 | + if (frame->s3d_struct != HDMI_3D_STRUCTURE_INVALID) { |
4625 | ptr[7] = 0x2 << 5; /* video format */ |
4626 | ptr[8] = (frame->s3d_struct & 0xf) << 4; |
4627 | if (frame->s3d_struct >= HDMI_3D_STRUCTURE_SIDE_BY_SIDE_HALF) |
4628 | ptr[9] = (frame->s3d_ext_data & 0xf) << 4; |
4629 | + } else if (frame->vic) { |
4630 | + ptr[7] = 0x1 << 5; /* video format */ |
4631 | + ptr[8] = frame->vic; |
4632 | + } else { |
4633 | + ptr[7] = 0x0 << 5; /* video format */ |
4634 | } |
4635 | |
4636 | hdmi_infoframe_set_checksum(buffer, length); |
4637 | @@ -1161,7 +1166,7 @@ hdmi_vendor_any_infoframe_unpack(union hdmi_vendor_any_infoframe *frame, |
4638 | |
4639 | if (ptr[0] != HDMI_INFOFRAME_TYPE_VENDOR || |
4640 | ptr[1] != 1 || |
4641 | - (ptr[2] != 5 && ptr[2] != 6)) |
4642 | + (ptr[2] != 4 && ptr[2] != 5 && ptr[2] != 6)) |
4643 | return -EINVAL; |
4644 | |
4645 | length = ptr[2]; |
4646 | @@ -1189,16 +1194,22 @@ hdmi_vendor_any_infoframe_unpack(union hdmi_vendor_any_infoframe *frame, |
4647 | |
4648 | hvf->length = length; |
4649 | |
4650 | - if (hdmi_video_format == 0x1) { |
4651 | - hvf->vic = ptr[4]; |
4652 | - } else if (hdmi_video_format == 0x2) { |
4653 | + if (hdmi_video_format == 0x2) { |
4654 | + if (length != 5 && length != 6) |
4655 | + return -EINVAL; |
4656 | hvf->s3d_struct = ptr[4] >> 4; |
4657 | if (hvf->s3d_struct >= HDMI_3D_STRUCTURE_SIDE_BY_SIDE_HALF) { |
4658 | - if (length == 6) |
4659 | - hvf->s3d_ext_data = ptr[5] >> 4; |
4660 | - else |
4661 | + if (length != 6) |
4662 | return -EINVAL; |
4663 | + hvf->s3d_ext_data = ptr[5] >> 4; |
4664 | } |
4665 | + } else if (hdmi_video_format == 0x1) { |
4666 | + if (length != 5) |
4667 | + return -EINVAL; |
4668 | + hvf->vic = ptr[4]; |
4669 | + } else { |
4670 | + if (length != 4) |
4671 | + return -EINVAL; |
4672 | } |
4673 | |
4674 | return 0; |
4675 | diff --git a/fs/aio.c b/fs/aio.c |
4676 | index 0fcb49ad67d4..0606f033cd9b 100644 |
4677 | --- a/fs/aio.c |
4678 | +++ b/fs/aio.c |
4679 | @@ -68,9 +68,9 @@ struct aio_ring { |
4680 | #define AIO_RING_PAGES 8 |
4681 | |
4682 | struct kioctx_table { |
4683 | - struct rcu_head rcu; |
4684 | - unsigned nr; |
4685 | - struct kioctx *table[]; |
4686 | + struct rcu_head rcu; |
4687 | + unsigned nr; |
4688 | + struct kioctx __rcu *table[]; |
4689 | }; |
4690 | |
4691 | struct kioctx_cpu { |
4692 | @@ -115,7 +115,8 @@ struct kioctx { |
4693 | struct page **ring_pages; |
4694 | long nr_pages; |
4695 | |
4696 | - struct work_struct free_work; |
4697 | + struct rcu_head free_rcu; |
4698 | + struct work_struct free_work; /* see free_ioctx() */ |
4699 | |
4700 | /* |
4701 | * signals when all in-flight requests are done |
4702 | @@ -329,7 +330,7 @@ static int aio_ring_mremap(struct vm_area_struct *vma) |
4703 | for (i = 0; i < table->nr; i++) { |
4704 | struct kioctx *ctx; |
4705 | |
4706 | - ctx = table->table[i]; |
4707 | + ctx = rcu_dereference(table->table[i]); |
4708 | if (ctx && ctx->aio_ring_file == file) { |
4709 | if (!atomic_read(&ctx->dead)) { |
4710 | ctx->user_id = ctx->mmap_base = vma->vm_start; |
4711 | @@ -581,6 +582,12 @@ static int kiocb_cancel(struct aio_kiocb *kiocb) |
4712 | return cancel(&kiocb->common); |
4713 | } |
4714 | |
4715 | +/* |
4716 | + * free_ioctx() should be RCU delayed to synchronize against the RCU |
4717 | + * protected lookup_ioctx() and also needs process context to call |
4718 | + * aio_free_ring(), so the double bouncing through kioctx->free_rcu and |
4719 | + * ->free_work. |
4720 | + */ |
4721 | static void free_ioctx(struct work_struct *work) |
4722 | { |
4723 | struct kioctx *ctx = container_of(work, struct kioctx, free_work); |
4724 | @@ -594,6 +601,14 @@ static void free_ioctx(struct work_struct *work) |
4725 | kmem_cache_free(kioctx_cachep, ctx); |
4726 | } |
4727 | |
4728 | +static void free_ioctx_rcufn(struct rcu_head *head) |
4729 | +{ |
4730 | + struct kioctx *ctx = container_of(head, struct kioctx, free_rcu); |
4731 | + |
4732 | + INIT_WORK(&ctx->free_work, free_ioctx); |
4733 | + schedule_work(&ctx->free_work); |
4734 | +} |
4735 | + |
4736 | static void free_ioctx_reqs(struct percpu_ref *ref) |
4737 | { |
4738 | struct kioctx *ctx = container_of(ref, struct kioctx, reqs); |
4739 | @@ -602,8 +617,8 @@ static void free_ioctx_reqs(struct percpu_ref *ref) |
4740 | if (ctx->rq_wait && atomic_dec_and_test(&ctx->rq_wait->count)) |
4741 | complete(&ctx->rq_wait->comp); |
4742 | |
4743 | - INIT_WORK(&ctx->free_work, free_ioctx); |
4744 | - schedule_work(&ctx->free_work); |
4745 | + /* Synchronize against RCU protected table->table[] dereferences */ |
4746 | + call_rcu(&ctx->free_rcu, free_ioctx_rcufn); |
4747 | } |
4748 | |
4749 | /* |
4750 | @@ -644,9 +659,9 @@ static int ioctx_add_table(struct kioctx *ctx, struct mm_struct *mm) |
4751 | while (1) { |
4752 | if (table) |
4753 | for (i = 0; i < table->nr; i++) |
4754 | - if (!table->table[i]) { |
4755 | + if (!rcu_access_pointer(table->table[i])) { |
4756 | ctx->id = i; |
4757 | - table->table[i] = ctx; |
4758 | + rcu_assign_pointer(table->table[i], ctx); |
4759 | spin_unlock(&mm->ioctx_lock); |
4760 | |
4761 | /* While kioctx setup is in progress, |
4762 | @@ -821,11 +836,11 @@ static int kill_ioctx(struct mm_struct *mm, struct kioctx *ctx, |
4763 | } |
4764 | |
4765 | table = rcu_dereference_raw(mm->ioctx_table); |
4766 | - WARN_ON(ctx != table->table[ctx->id]); |
4767 | - table->table[ctx->id] = NULL; |
4768 | + WARN_ON(ctx != rcu_access_pointer(table->table[ctx->id])); |
4769 | + RCU_INIT_POINTER(table->table[ctx->id], NULL); |
4770 | spin_unlock(&mm->ioctx_lock); |
4771 | |
4772 | - /* percpu_ref_kill() will do the necessary call_rcu() */ |
4773 | + /* free_ioctx_reqs() will do the necessary RCU synchronization */ |
4774 | wake_up_all(&ctx->wait); |
4775 | |
4776 | /* |
4777 | @@ -867,7 +882,8 @@ void exit_aio(struct mm_struct *mm) |
4778 | |
4779 | skipped = 0; |
4780 | for (i = 0; i < table->nr; ++i) { |
4781 | - struct kioctx *ctx = table->table[i]; |
4782 | + struct kioctx *ctx = |
4783 | + rcu_dereference_protected(table->table[i], true); |
4784 | |
4785 | if (!ctx) { |
4786 | skipped++; |
4787 | @@ -1056,7 +1072,7 @@ static struct kioctx *lookup_ioctx(unsigned long ctx_id) |
4788 | if (!table || id >= table->nr) |
4789 | goto out; |
4790 | |
4791 | - ctx = table->table[id]; |
4792 | + ctx = rcu_dereference(table->table[id]); |
4793 | if (ctx && ctx->user_id == ctx_id) { |
4794 | percpu_ref_get(&ctx->users); |
4795 | ret = ctx; |
4796 | diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c |
4797 | index 06a77e47957d..5900508ca6ed 100644 |
4798 | --- a/fs/btrfs/volumes.c |
4799 | +++ b/fs/btrfs/volumes.c |
4800 | @@ -583,6 +583,7 @@ void btrfs_free_stale_device(struct btrfs_device *cur_dev) |
4801 | btrfs_sysfs_remove_fsid(fs_devs); |
4802 | list_del(&fs_devs->list); |
4803 | free_fs_devices(fs_devs); |
4804 | + break; |
4805 | } else { |
4806 | fs_devs->num_devices--; |
4807 | list_del(&dev->dev_list); |
4808 | @@ -4748,10 +4749,13 @@ static int __btrfs_alloc_chunk(struct btrfs_trans_handle *trans, |
4809 | if (devs_max && ndevs > devs_max) |
4810 | ndevs = devs_max; |
4811 | /* |
4812 | - * the primary goal is to maximize the number of stripes, so use as many |
4813 | - * devices as possible, even if the stripes are not maximum sized. |
4814 | + * The primary goal is to maximize the number of stripes, so use as |
4815 | + * many devices as possible, even if the stripes are not maximum sized. |
4816 | + * |
4817 | + * The DUP profile stores more than one stripe per device, the |
4818 | + * max_avail is the total size so we have to adjust. |
4819 | */ |
4820 | - stripe_size = devices_info[ndevs-1].max_avail; |
4821 | + stripe_size = div_u64(devices_info[ndevs - 1].max_avail, dev_stripes); |
4822 | num_stripes = ndevs * dev_stripes; |
4823 | |
4824 | /* |
4825 | @@ -4791,8 +4795,6 @@ static int __btrfs_alloc_chunk(struct btrfs_trans_handle *trans, |
4826 | stripe_size = devices_info[ndevs-1].max_avail; |
4827 | } |
4828 | |
4829 | - stripe_size = div_u64(stripe_size, dev_stripes); |
4830 | - |
4831 | /* align to BTRFS_STRIPE_LEN */ |
4832 | stripe_size = div_u64(stripe_size, raid_stripe_len); |
4833 | stripe_size *= raid_stripe_len; |
4834 | diff --git a/fs/dcache.c b/fs/dcache.c |
4835 | index 67957f5b325c..c0c7fa8224ba 100644 |
4836 | --- a/fs/dcache.c |
4837 | +++ b/fs/dcache.c |
4838 | @@ -637,11 +637,16 @@ static inline struct dentry *lock_parent(struct dentry *dentry) |
4839 | spin_unlock(&parent->d_lock); |
4840 | goto again; |
4841 | } |
4842 | - rcu_read_unlock(); |
4843 | - if (parent != dentry) |
4844 | + if (parent != dentry) { |
4845 | spin_lock_nested(&dentry->d_lock, DENTRY_D_LOCK_NESTED); |
4846 | - else |
4847 | + if (unlikely(dentry->d_lockref.count < 0)) { |
4848 | + spin_unlock(&parent->d_lock); |
4849 | + parent = NULL; |
4850 | + } |
4851 | + } else { |
4852 | parent = NULL; |
4853 | + } |
4854 | + rcu_read_unlock(); |
4855 | return parent; |
4856 | } |
4857 | |
4858 | diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c |
4859 | index 34a69e7ed90b..17ab23f64bba 100644 |
4860 | --- a/fs/f2fs/gc.c |
4861 | +++ b/fs/f2fs/gc.c |
4862 | @@ -538,8 +538,10 @@ static bool is_alive(struct f2fs_sb_info *sbi, struct f2fs_summary *sum, |
4863 | get_node_info(sbi, nid, dni); |
4864 | |
4865 | if (sum->version != dni->version) { |
4866 | - f2fs_put_page(node_page, 1); |
4867 | - return false; |
4868 | + f2fs_msg(sbi->sb, KERN_WARNING, |
4869 | + "%s: valid data with mismatched node version.", |
4870 | + __func__); |
4871 | + set_sbi_flag(sbi, SBI_NEED_FSCK); |
4872 | } |
4873 | |
4874 | *nofs = ofs_of_node(node_page); |
4875 | diff --git a/fs/namei.c b/fs/namei.c |
4876 | index 6cfb45f262aa..891670e0956b 100644 |
4877 | --- a/fs/namei.c |
4878 | +++ b/fs/namei.c |
4879 | @@ -578,9 +578,10 @@ static int __nd_alloc_stack(struct nameidata *nd) |
4880 | static bool path_connected(const struct path *path) |
4881 | { |
4882 | struct vfsmount *mnt = path->mnt; |
4883 | + struct super_block *sb = mnt->mnt_sb; |
4884 | |
4885 | - /* Only bind mounts can have disconnected paths */ |
4886 | - if (mnt->mnt_root == mnt->mnt_sb->s_root) |
4887 | + /* Bind mounts and multi-root filesystems can have disconnected paths */ |
4888 | + if (!(sb->s_iflags & SB_I_MULTIROOT) && (mnt->mnt_root == sb->s_root)) |
4889 | return true; |
4890 | |
4891 | return is_subdir(path->dentry, mnt->mnt_root); |
4892 | @@ -1121,9 +1122,6 @@ static int follow_automount(struct path *path, struct nameidata *nd, |
4893 | path->dentry->d_inode) |
4894 | return -EISDIR; |
4895 | |
4896 | - if (path->dentry->d_sb->s_user_ns != &init_user_ns) |
4897 | - return -EACCES; |
4898 | - |
4899 | nd->total_link_count++; |
4900 | if (nd->total_link_count >= 40) |
4901 | return -ELOOP; |
4902 | diff --git a/fs/nfs/super.c b/fs/nfs/super.c |
4903 | index 51bf1f9ab287..2fdb8f5a7b69 100644 |
4904 | --- a/fs/nfs/super.c |
4905 | +++ b/fs/nfs/super.c |
4906 | @@ -2613,6 +2613,8 @@ struct dentry *nfs_fs_mount_common(struct nfs_server *server, |
4907 | /* initial superblock/root creation */ |
4908 | mount_info->fill_super(s, mount_info); |
4909 | nfs_get_cache_cookie(s, mount_info->parsed, mount_info->cloned); |
4910 | + if (!(server->flags & NFS_MOUNT_UNSHARED)) |
4911 | + s->s_iflags |= SB_I_MULTIROOT; |
4912 | } |
4913 | |
4914 | mntroot = nfs_get_root(s, mount_info->mntfh, dev_name); |
4915 | diff --git a/fs/reiserfs/journal.c b/fs/reiserfs/journal.c |
4916 | index bc2dde2423c2..76108185854e 100644 |
4917 | --- a/fs/reiserfs/journal.c |
4918 | +++ b/fs/reiserfs/journal.c |
4919 | @@ -1959,7 +1959,7 @@ static int do_journal_release(struct reiserfs_transaction_handle *th, |
4920 | * will be requeued because superblock is being shutdown and doesn't |
4921 | * have MS_ACTIVE set. |
4922 | */ |
4923 | - cancel_delayed_work_sync(&REISERFS_SB(sb)->old_work); |
4924 | + reiserfs_cancel_old_flush(sb); |
4925 | /* wait for all commits to finish */ |
4926 | cancel_delayed_work_sync(&SB_JOURNAL(sb)->j_work); |
4927 | |
4928 | diff --git a/fs/reiserfs/reiserfs.h b/fs/reiserfs/reiserfs.h |
4929 | index 5dcf3ab83886..6ca00471afbf 100644 |
4930 | --- a/fs/reiserfs/reiserfs.h |
4931 | +++ b/fs/reiserfs/reiserfs.h |
4932 | @@ -2948,6 +2948,7 @@ int reiserfs_allocate_list_bitmaps(struct super_block *s, |
4933 | struct reiserfs_list_bitmap *, unsigned int); |
4934 | |
4935 | void reiserfs_schedule_old_flush(struct super_block *s); |
4936 | +void reiserfs_cancel_old_flush(struct super_block *s); |
4937 | void add_save_link(struct reiserfs_transaction_handle *th, |
4938 | struct inode *inode, int truncate); |
4939 | int remove_save_link(struct inode *inode, int truncate); |
4940 | diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c |
4941 | index e101d70d2327..dec6c93044fa 100644 |
4942 | --- a/fs/reiserfs/super.c |
4943 | +++ b/fs/reiserfs/super.c |
4944 | @@ -90,7 +90,9 @@ static void flush_old_commits(struct work_struct *work) |
4945 | s = sbi->s_journal->j_work_sb; |
4946 | |
4947 | spin_lock(&sbi->old_work_lock); |
4948 | - sbi->work_queued = 0; |
4949 | + /* Avoid clobbering the cancel state... */ |
4950 | + if (sbi->work_queued == 1) |
4951 | + sbi->work_queued = 0; |
4952 | spin_unlock(&sbi->old_work_lock); |
4953 | |
4954 | reiserfs_sync_fs(s, 1); |
4955 | @@ -117,21 +119,22 @@ void reiserfs_schedule_old_flush(struct super_block *s) |
4956 | spin_unlock(&sbi->old_work_lock); |
4957 | } |
4958 | |
4959 | -static void cancel_old_flush(struct super_block *s) |
4960 | +void reiserfs_cancel_old_flush(struct super_block *s) |
4961 | { |
4962 | struct reiserfs_sb_info *sbi = REISERFS_SB(s); |
4963 | |
4964 | - cancel_delayed_work_sync(&REISERFS_SB(s)->old_work); |
4965 | spin_lock(&sbi->old_work_lock); |
4966 | - sbi->work_queued = 0; |
4967 | + /* Make sure no new flushes will be queued */ |
4968 | + sbi->work_queued = 2; |
4969 | spin_unlock(&sbi->old_work_lock); |
4970 | + cancel_delayed_work_sync(&REISERFS_SB(s)->old_work); |
4971 | } |
4972 | |
4973 | static int reiserfs_freeze(struct super_block *s) |
4974 | { |
4975 | struct reiserfs_transaction_handle th; |
4976 | |
4977 | - cancel_old_flush(s); |
4978 | + reiserfs_cancel_old_flush(s); |
4979 | |
4980 | reiserfs_write_lock(s); |
4981 | if (!(s->s_flags & MS_RDONLY)) { |
4982 | @@ -152,7 +155,13 @@ static int reiserfs_freeze(struct super_block *s) |
4983 | |
4984 | static int reiserfs_unfreeze(struct super_block *s) |
4985 | { |
4986 | + struct reiserfs_sb_info *sbi = REISERFS_SB(s); |
4987 | + |
4988 | reiserfs_allow_writes(s); |
4989 | + spin_lock(&sbi->old_work_lock); |
4990 | + /* Allow old_work to run again */ |
4991 | + sbi->work_queued = 0; |
4992 | + spin_unlock(&sbi->old_work_lock); |
4993 | return 0; |
4994 | } |
4995 | |
4996 | @@ -2194,7 +2203,7 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent) |
4997 | if (sbi->commit_wq) |
4998 | destroy_workqueue(sbi->commit_wq); |
4999 | |
5000 | - cancel_delayed_work_sync(&REISERFS_SB(s)->old_work); |
5001 | + reiserfs_cancel_old_flush(s); |
5002 | |
5003 | reiserfs_free_bitmap_cache(s); |
5004 | if (SB_BUFFER_WITH_SB(s)) |
5005 | diff --git a/include/dt-bindings/clock/r8a7794-clock.h b/include/dt-bindings/clock/r8a7794-clock.h |
5006 | index 88e64846cf37..cdeafd9cab07 100644 |
5007 | --- a/include/dt-bindings/clock/r8a7794-clock.h |
5008 | +++ b/include/dt-bindings/clock/r8a7794-clock.h |
5009 | @@ -81,6 +81,7 @@ |
5010 | #define R8A7794_CLK_SCIF2 19 |
5011 | #define R8A7794_CLK_SCIF1 20 |
5012 | #define R8A7794_CLK_SCIF0 21 |
5013 | +#define R8A7794_CLK_DU1 23 |
5014 | #define R8A7794_CLK_DU0 24 |
5015 | |
5016 | /* MSTP8 */ |
5017 | diff --git a/include/linux/fs.h b/include/linux/fs.h |
5018 | index 18552189560b..e9867aff53d8 100644 |
5019 | --- a/include/linux/fs.h |
5020 | +++ b/include/linux/fs.h |
5021 | @@ -1319,6 +1319,7 @@ struct mm_struct; |
5022 | #define SB_I_CGROUPWB 0x00000001 /* cgroup-aware writeback enabled */ |
5023 | #define SB_I_NOEXEC 0x00000002 /* Ignore executables on this fs */ |
5024 | #define SB_I_NODEV 0x00000004 /* Ignore devices on this fs */ |
5025 | +#define SB_I_MULTIROOT 0x00000008 /* Multiple roots to the dentry tree */ |
5026 | |
5027 | /* sb->s_iflags to limit user namespace mounts */ |
5028 | #define SB_I_USERNS_VISIBLE 0x00000010 /* fstype already mounted */ |
5029 | diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h |
5030 | index 7dbe9148b2f8..35f4c4d9c405 100644 |
5031 | --- a/include/linux/pagemap.h |
5032 | +++ b/include/linux/pagemap.h |
5033 | @@ -148,7 +148,7 @@ static inline int page_cache_get_speculative(struct page *page) |
5034 | |
5035 | #ifdef CONFIG_TINY_RCU |
5036 | # ifdef CONFIG_PREEMPT_COUNT |
5037 | - VM_BUG_ON(!in_atomic()); |
5038 | + VM_BUG_ON(!in_atomic() && !irqs_disabled()); |
5039 | # endif |
5040 | /* |
5041 | * Preempt must be disabled here - we rely on rcu_read_lock doing |
5042 | @@ -186,7 +186,7 @@ static inline int page_cache_add_speculative(struct page *page, int count) |
5043 | |
5044 | #if !defined(CONFIG_SMP) && defined(CONFIG_TREE_RCU) |
5045 | # ifdef CONFIG_PREEMPT_COUNT |
5046 | - VM_BUG_ON(!in_atomic()); |
5047 | + VM_BUG_ON(!in_atomic() && !irqs_disabled()); |
5048 | # endif |
5049 | VM_BUG_ON_PAGE(page_count(page) == 0, page); |
5050 | page_ref_add(page, count); |
5051 | diff --git a/include/linux/platform_data/isl9305.h b/include/linux/platform_data/isl9305.h |
5052 | index 1419133fa69e..4ac1a070af0a 100644 |
5053 | --- a/include/linux/platform_data/isl9305.h |
5054 | +++ b/include/linux/platform_data/isl9305.h |
5055 | @@ -24,7 +24,7 @@ |
5056 | struct regulator_init_data; |
5057 | |
5058 | struct isl9305_pdata { |
5059 | - struct regulator_init_data *init_data[ISL9305_MAX_REGULATOR]; |
5060 | + struct regulator_init_data *init_data[ISL9305_MAX_REGULATOR + 1]; |
5061 | }; |
5062 | |
5063 | #endif |
5064 | diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h |
5065 | index 37b532410528..3c3786df044c 100644 |
5066 | --- a/include/linux/regulator/driver.h |
5067 | +++ b/include/linux/regulator/driver.h |
5068 | @@ -425,6 +425,8 @@ struct regulator_dev { |
5069 | struct regulator_enable_gpio *ena_pin; |
5070 | unsigned int ena_gpio_state:1; |
5071 | |
5072 | + unsigned int is_switch:1; |
5073 | + |
5074 | /* time when this regulator was disabled last time */ |
5075 | unsigned long last_off_jiffy; |
5076 | }; |
5077 | diff --git a/include/net/tcp.h b/include/net/tcp.h |
5078 | index caf35e062639..18f029bcb8c7 100644 |
5079 | --- a/include/net/tcp.h |
5080 | +++ b/include/net/tcp.h |
5081 | @@ -1265,9 +1265,11 @@ void tcp_select_initial_window(int __space, __u32 mss, __u32 *rcv_wnd, |
5082 | |
5083 | static inline int tcp_win_from_space(int space) |
5084 | { |
5085 | - return sysctl_tcp_adv_win_scale<=0 ? |
5086 | - (space>>(-sysctl_tcp_adv_win_scale)) : |
5087 | - space - (space>>sysctl_tcp_adv_win_scale); |
5088 | + int tcp_adv_win_scale = sysctl_tcp_adv_win_scale; |
5089 | + |
5090 | + return tcp_adv_win_scale <= 0 ? |
5091 | + (space>>(-tcp_adv_win_scale)) : |
5092 | + space - (space>>tcp_adv_win_scale); |
5093 | } |
5094 | |
5095 | /* Note: caller must be prepared to deal with negative returns */ |
5096 | diff --git a/include/uapi/linux/eventpoll.h b/include/uapi/linux/eventpoll.h |
5097 | index bc96b14dfb2c..f4d5c998cc2b 100644 |
5098 | --- a/include/uapi/linux/eventpoll.h |
5099 | +++ b/include/uapi/linux/eventpoll.h |
5100 | @@ -40,7 +40,7 @@ |
5101 | #define EPOLLRDHUP 0x00002000 |
5102 | |
5103 | /* Set exclusive wakeup mode for the target file descriptor */ |
5104 | -#define EPOLLEXCLUSIVE (1 << 28) |
5105 | +#define EPOLLEXCLUSIVE (1U << 28) |
5106 | |
5107 | /* |
5108 | * Request the handling of system wakeup events so as to prevent system suspends |
5109 | @@ -52,13 +52,13 @@ |
5110 | * |
5111 | * Requires CAP_BLOCK_SUSPEND |
5112 | */ |
5113 | -#define EPOLLWAKEUP (1 << 29) |
5114 | +#define EPOLLWAKEUP (1U << 29) |
5115 | |
5116 | /* Set the One Shot behaviour for the target file descriptor */ |
5117 | -#define EPOLLONESHOT (1 << 30) |
5118 | +#define EPOLLONESHOT (1U << 30) |
5119 | |
5120 | /* Set the Edge Triggered behaviour for the target file descriptor */ |
5121 | -#define EPOLLET (1 << 31) |
5122 | +#define EPOLLET (1U << 31) |
5123 | |
5124 | /* |
5125 | * On x86-64 make the 64bit structure have the same alignment as the |
5126 | diff --git a/kernel/locking/locktorture.c b/kernel/locking/locktorture.c |
5127 | index d3de04b12f8c..babc67cfed69 100644 |
5128 | --- a/kernel/locking/locktorture.c |
5129 | +++ b/kernel/locking/locktorture.c |
5130 | @@ -641,8 +641,7 @@ static void __torture_print_stats(char *page, |
5131 | { |
5132 | bool fail = 0; |
5133 | int i, n_stress; |
5134 | - long max = 0; |
5135 | - long min = statp[0].n_lock_acquired; |
5136 | + long max = 0, min = statp ? statp[0].n_lock_acquired : 0; |
5137 | long long sum = 0; |
5138 | |
5139 | n_stress = write ? cxt.nrealwriters_stress : cxt.nrealreaders_stress; |
5140 | @@ -749,7 +748,7 @@ static void lock_torture_cleanup(void) |
5141 | * such, only perform the underlying torture-specific cleanups, |
5142 | * and avoid anything related to locktorture. |
5143 | */ |
5144 | - if (!cxt.lwsa) |
5145 | + if (!cxt.lwsa && !cxt.lrsa) |
5146 | goto end; |
5147 | |
5148 | if (writer_tasks) { |
5149 | @@ -823,6 +822,13 @@ static int __init lock_torture_init(void) |
5150 | firsterr = -EINVAL; |
5151 | goto unwind; |
5152 | } |
5153 | + |
5154 | + if (nwriters_stress == 0 && nreaders_stress == 0) { |
5155 | + pr_alert("lock-torture: must run at least one locking thread\n"); |
5156 | + firsterr = -EINVAL; |
5157 | + goto unwind; |
5158 | + } |
5159 | + |
5160 | if (cxt.cur_ops->init) |
5161 | cxt.cur_ops->init(); |
5162 | |
5163 | @@ -846,17 +852,19 @@ static int __init lock_torture_init(void) |
5164 | #endif |
5165 | |
5166 | /* Initialize the statistics so that each run gets its own numbers. */ |
5167 | + if (nwriters_stress) { |
5168 | + lock_is_write_held = 0; |
5169 | + cxt.lwsa = kmalloc(sizeof(*cxt.lwsa) * cxt.nrealwriters_stress, GFP_KERNEL); |
5170 | + if (cxt.lwsa == NULL) { |
5171 | + VERBOSE_TOROUT_STRING("cxt.lwsa: Out of memory"); |
5172 | + firsterr = -ENOMEM; |
5173 | + goto unwind; |
5174 | + } |
5175 | |
5176 | - lock_is_write_held = 0; |
5177 | - cxt.lwsa = kmalloc(sizeof(*cxt.lwsa) * cxt.nrealwriters_stress, GFP_KERNEL); |
5178 | - if (cxt.lwsa == NULL) { |
5179 | - VERBOSE_TOROUT_STRING("cxt.lwsa: Out of memory"); |
5180 | - firsterr = -ENOMEM; |
5181 | - goto unwind; |
5182 | - } |
5183 | - for (i = 0; i < cxt.nrealwriters_stress; i++) { |
5184 | - cxt.lwsa[i].n_lock_fail = 0; |
5185 | - cxt.lwsa[i].n_lock_acquired = 0; |
5186 | + for (i = 0; i < cxt.nrealwriters_stress; i++) { |
5187 | + cxt.lwsa[i].n_lock_fail = 0; |
5188 | + cxt.lwsa[i].n_lock_acquired = 0; |
5189 | + } |
5190 | } |
5191 | |
5192 | if (cxt.cur_ops->readlock) { |
5193 | @@ -873,19 +881,21 @@ static int __init lock_torture_init(void) |
5194 | cxt.nrealreaders_stress = cxt.nrealwriters_stress; |
5195 | } |
5196 | |
5197 | - lock_is_read_held = 0; |
5198 | - cxt.lrsa = kmalloc(sizeof(*cxt.lrsa) * cxt.nrealreaders_stress, GFP_KERNEL); |
5199 | - if (cxt.lrsa == NULL) { |
5200 | - VERBOSE_TOROUT_STRING("cxt.lrsa: Out of memory"); |
5201 | - firsterr = -ENOMEM; |
5202 | - kfree(cxt.lwsa); |
5203 | - cxt.lwsa = NULL; |
5204 | - goto unwind; |
5205 | - } |
5206 | - |
5207 | - for (i = 0; i < cxt.nrealreaders_stress; i++) { |
5208 | - cxt.lrsa[i].n_lock_fail = 0; |
5209 | - cxt.lrsa[i].n_lock_acquired = 0; |
5210 | + if (nreaders_stress) { |
5211 | + lock_is_read_held = 0; |
5212 | + cxt.lrsa = kmalloc(sizeof(*cxt.lrsa) * cxt.nrealreaders_stress, GFP_KERNEL); |
5213 | + if (cxt.lrsa == NULL) { |
5214 | + VERBOSE_TOROUT_STRING("cxt.lrsa: Out of memory"); |
5215 | + firsterr = -ENOMEM; |
5216 | + kfree(cxt.lwsa); |
5217 | + cxt.lwsa = NULL; |
5218 | + goto unwind; |
5219 | + } |
5220 | + |
5221 | + for (i = 0; i < cxt.nrealreaders_stress; i++) { |
5222 | + cxt.lrsa[i].n_lock_fail = 0; |
5223 | + cxt.lrsa[i].n_lock_acquired = 0; |
5224 | + } |
5225 | } |
5226 | } |
5227 | |
5228 | @@ -915,12 +925,14 @@ static int __init lock_torture_init(void) |
5229 | goto unwind; |
5230 | } |
5231 | |
5232 | - writer_tasks = kzalloc(cxt.nrealwriters_stress * sizeof(writer_tasks[0]), |
5233 | - GFP_KERNEL); |
5234 | - if (writer_tasks == NULL) { |
5235 | - VERBOSE_TOROUT_ERRSTRING("writer_tasks: Out of memory"); |
5236 | - firsterr = -ENOMEM; |
5237 | - goto unwind; |
5238 | + if (nwriters_stress) { |
5239 | + writer_tasks = kzalloc(cxt.nrealwriters_stress * sizeof(writer_tasks[0]), |
5240 | + GFP_KERNEL); |
5241 | + if (writer_tasks == NULL) { |
5242 | + VERBOSE_TOROUT_ERRSTRING("writer_tasks: Out of memory"); |
5243 | + firsterr = -ENOMEM; |
5244 | + goto unwind; |
5245 | + } |
5246 | } |
5247 | |
5248 | if (cxt.cur_ops->readlock) { |
5249 | diff --git a/kernel/locking/rtmutex.c b/kernel/locking/rtmutex.c |
5250 | index 2c49d76f96c3..196cc460e38d 100644 |
5251 | --- a/kernel/locking/rtmutex.c |
5252 | +++ b/kernel/locking/rtmutex.c |
5253 | @@ -236,8 +236,7 @@ rt_mutex_waiter_less(struct rt_mutex_waiter *left, |
5254 | * then right waiter has a dl_prio() too. |
5255 | */ |
5256 | if (dl_prio(left->prio)) |
5257 | - return dl_time_before(left->task->dl.deadline, |
5258 | - right->task->dl.deadline); |
5259 | + return dl_time_before(left->deadline, right->deadline); |
5260 | |
5261 | return 0; |
5262 | } |
5263 | @@ -704,7 +703,26 @@ static int rt_mutex_adjust_prio_chain(struct task_struct *task, |
5264 | |
5265 | /* [7] Requeue the waiter in the lock waiter tree. */ |
5266 | rt_mutex_dequeue(lock, waiter); |
5267 | + |
5268 | + /* |
5269 | + * Update the waiter prio fields now that we're dequeued. |
5270 | + * |
5271 | + * These values can have changed through either: |
5272 | + * |
5273 | + * sys_sched_set_scheduler() / sys_sched_setattr() |
5274 | + * |
5275 | + * or |
5276 | + * |
5277 | + * DL CBS enforcement advancing the effective deadline. |
5278 | + * |
5279 | + * Even though pi_waiters also uses these fields, and that tree is only |
5280 | + * updated in [11], we can do this here, since we hold [L], which |
5281 | + * serializes all pi_waiters access and rb_erase() does not care about |
5282 | + * the values of the node being removed. |
5283 | + */ |
5284 | waiter->prio = task->prio; |
5285 | + waiter->deadline = task->dl.deadline; |
5286 | + |
5287 | rt_mutex_enqueue(lock, waiter); |
5288 | |
5289 | /* [8] Release the task */ |
5290 | @@ -831,6 +849,8 @@ static int rt_mutex_adjust_prio_chain(struct task_struct *task, |
5291 | static int try_to_take_rt_mutex(struct rt_mutex *lock, struct task_struct *task, |
5292 | struct rt_mutex_waiter *waiter) |
5293 | { |
5294 | + lockdep_assert_held(&lock->wait_lock); |
5295 | + |
5296 | /* |
5297 | * Before testing whether we can acquire @lock, we set the |
5298 | * RT_MUTEX_HAS_WAITERS bit in @lock->owner. This forces all |
5299 | @@ -958,6 +978,8 @@ static int task_blocks_on_rt_mutex(struct rt_mutex *lock, |
5300 | struct rt_mutex *next_lock; |
5301 | int chain_walk = 0, res; |
5302 | |
5303 | + lockdep_assert_held(&lock->wait_lock); |
5304 | + |
5305 | /* |
5306 | * Early deadlock detection. We really don't want the task to |
5307 | * enqueue on itself just to untangle the mess later. It's not |
5308 | @@ -975,6 +997,7 @@ static int task_blocks_on_rt_mutex(struct rt_mutex *lock, |
5309 | waiter->task = task; |
5310 | waiter->lock = lock; |
5311 | waiter->prio = task->prio; |
5312 | + waiter->deadline = task->dl.deadline; |
5313 | |
5314 | /* Get the top priority waiter on the lock */ |
5315 | if (rt_mutex_has_waiters(lock)) |
5316 | @@ -1080,6 +1103,8 @@ static void remove_waiter(struct rt_mutex *lock, |
5317 | struct task_struct *owner = rt_mutex_owner(lock); |
5318 | struct rt_mutex *next_lock; |
5319 | |
5320 | + lockdep_assert_held(&lock->wait_lock); |
5321 | + |
5322 | raw_spin_lock(¤t->pi_lock); |
5323 | rt_mutex_dequeue(lock, waiter); |
5324 | current->pi_blocked_on = NULL; |
5325 | diff --git a/kernel/locking/rtmutex_common.h b/kernel/locking/rtmutex_common.h |
5326 | index e317e1cbb3eb..50848b460851 100644 |
5327 | --- a/kernel/locking/rtmutex_common.h |
5328 | +++ b/kernel/locking/rtmutex_common.h |
5329 | @@ -33,6 +33,7 @@ struct rt_mutex_waiter { |
5330 | struct rt_mutex *deadlock_lock; |
5331 | #endif |
5332 | int prio; |
5333 | + u64 deadline; |
5334 | }; |
5335 | |
5336 | /* |
5337 | diff --git a/kernel/printk/braille.c b/kernel/printk/braille.c |
5338 | index d5760c42f042..61d41ca41844 100644 |
5339 | --- a/kernel/printk/braille.c |
5340 | +++ b/kernel/printk/braille.c |
5341 | @@ -2,12 +2,13 @@ |
5342 | |
5343 | #include <linux/kernel.h> |
5344 | #include <linux/console.h> |
5345 | +#include <linux/errno.h> |
5346 | #include <linux/string.h> |
5347 | |
5348 | #include "console_cmdline.h" |
5349 | #include "braille.h" |
5350 | |
5351 | -char *_braille_console_setup(char **str, char **brl_options) |
5352 | +int _braille_console_setup(char **str, char **brl_options) |
5353 | { |
5354 | if (!strncmp(*str, "brl,", 4)) { |
5355 | *brl_options = ""; |
5356 | @@ -15,14 +16,14 @@ char *_braille_console_setup(char **str, char **brl_options) |
5357 | } else if (!strncmp(*str, "brl=", 4)) { |
5358 | *brl_options = *str + 4; |
5359 | *str = strchr(*brl_options, ','); |
5360 | - if (!*str) |
5361 | + if (!*str) { |
5362 | pr_err("need port name after brl=\n"); |
5363 | - else |
5364 | - *((*str)++) = 0; |
5365 | - } else |
5366 | - return NULL; |
5367 | + return -EINVAL; |
5368 | + } |
5369 | + *((*str)++) = 0; |
5370 | + } |
5371 | |
5372 | - return *str; |
5373 | + return 0; |
5374 | } |
5375 | |
5376 | int |
5377 | diff --git a/kernel/printk/braille.h b/kernel/printk/braille.h |
5378 | index 769d771145c8..749a6756843a 100644 |
5379 | --- a/kernel/printk/braille.h |
5380 | +++ b/kernel/printk/braille.h |
5381 | @@ -9,7 +9,14 @@ braille_set_options(struct console_cmdline *c, char *brl_options) |
5382 | c->brl_options = brl_options; |
5383 | } |
5384 | |
5385 | -char * |
5386 | +/* |
5387 | + * Setup console according to braille options. |
5388 | + * Return -EINVAL on syntax error, 0 on success (or no braille option was |
5389 | + * actually given). |
5390 | + * Modifies str to point to the serial options |
5391 | + * Sets brl_options to the parsed braille options. |
5392 | + */ |
5393 | +int |
5394 | _braille_console_setup(char **str, char **brl_options); |
5395 | |
5396 | int |
5397 | @@ -25,10 +32,10 @@ braille_set_options(struct console_cmdline *c, char *brl_options) |
5398 | { |
5399 | } |
5400 | |
5401 | -static inline char * |
5402 | +static inline int |
5403 | _braille_console_setup(char **str, char **brl_options) |
5404 | { |
5405 | - return NULL; |
5406 | + return 0; |
5407 | } |
5408 | |
5409 | static inline int |
5410 | diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c |
5411 | index 9c5b231684d0..ab6855a4218b 100644 |
5412 | --- a/kernel/printk/printk.c |
5413 | +++ b/kernel/printk/printk.c |
5414 | @@ -2342,7 +2342,7 @@ void console_unlock(void) |
5415 | } |
5416 | |
5417 | /* |
5418 | - * Console drivers are called under logbuf_lock, so |
5419 | + * Console drivers are called with interrupts disabled, so |
5420 | * @console_may_schedule should be cleared before; however, we may |
5421 | * end up dumping a lot of lines, for example, if called from |
5422 | * console registration path, and should invoke cond_resched() |
5423 | @@ -2350,11 +2350,15 @@ void console_unlock(void) |
5424 | * scheduling stall on a slow console leading to RCU stall and |
5425 | * softlockup warnings which exacerbate the issue with more |
5426 | * messages practically incapacitating the system. |
5427 | + * |
5428 | + * console_trylock() is not able to detect the preemptive |
5429 | + * context reliably. Therefore the value must be stored before |
5430 | + * and cleared after the the "again" goto label. |
5431 | */ |
5432 | do_cond_resched = console_may_schedule; |
5433 | +again: |
5434 | console_may_schedule = 0; |
5435 | |
5436 | -again: |
5437 | /* |
5438 | * We released the console_sem lock, so we need to recheck if |
5439 | * cpu is online and (if not) is there at least one CON_ANYTIME |
5440 | diff --git a/kernel/sched/core.c b/kernel/sched/core.c |
5441 | index bce3a7ad4253..291ea6fa7ee6 100644 |
5442 | --- a/kernel/sched/core.c |
5443 | +++ b/kernel/sched/core.c |
5444 | @@ -508,7 +508,8 @@ void resched_cpu(int cpu) |
5445 | unsigned long flags; |
5446 | |
5447 | raw_spin_lock_irqsave(&rq->lock, flags); |
5448 | - resched_curr(rq); |
5449 | + if (cpu_online(cpu) || cpu == smp_processor_id()) |
5450 | + resched_curr(rq); |
5451 | raw_spin_unlock_irqrestore(&rq->lock, flags); |
5452 | } |
5453 | |
5454 | diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c |
5455 | index f6d68ddfa2f3..c7b0d2e7a9aa 100644 |
5456 | --- a/kernel/sched/rt.c |
5457 | +++ b/kernel/sched/rt.c |
5458 | @@ -2206,7 +2206,7 @@ static void switched_to_rt(struct rq *rq, struct task_struct *p) |
5459 | if (tsk_nr_cpus_allowed(p) > 1 && rq->rt.overloaded) |
5460 | queue_push_tasks(rq); |
5461 | #endif /* CONFIG_SMP */ |
5462 | - if (p->prio < rq->curr->prio) |
5463 | + if (p->prio < rq->curr->prio && cpu_online(cpu_of(rq))) |
5464 | resched_curr(rq); |
5465 | } |
5466 | } |
5467 | diff --git a/kernel/time/sched_clock.c b/kernel/time/sched_clock.c |
5468 | index a26036d37a38..382b159d8592 100644 |
5469 | --- a/kernel/time/sched_clock.c |
5470 | +++ b/kernel/time/sched_clock.c |
5471 | @@ -205,6 +205,11 @@ sched_clock_register(u64 (*read)(void), int bits, unsigned long rate) |
5472 | |
5473 | update_clock_read_data(&rd); |
5474 | |
5475 | + if (sched_clock_timer.function != NULL) { |
5476 | + /* update timeout for clock wrap */ |
5477 | + hrtimer_start(&sched_clock_timer, cd.wrap_kt, HRTIMER_MODE_REL); |
5478 | + } |
5479 | + |
5480 | r = rate; |
5481 | if (r >= 4000000) { |
5482 | r /= 1000000; |
5483 | diff --git a/kernel/time/timer_list.c b/kernel/time/timer_list.c |
5484 | index ba7d8b288bb3..ef4f16e81283 100644 |
5485 | --- a/kernel/time/timer_list.c |
5486 | +++ b/kernel/time/timer_list.c |
5487 | @@ -16,6 +16,7 @@ |
5488 | #include <linux/sched.h> |
5489 | #include <linux/seq_file.h> |
5490 | #include <linux/kallsyms.h> |
5491 | +#include <linux/nmi.h> |
5492 | |
5493 | #include <asm/uaccess.h> |
5494 | |
5495 | @@ -96,6 +97,9 @@ print_active_timers(struct seq_file *m, struct hrtimer_clock_base *base, |
5496 | |
5497 | next_one: |
5498 | i = 0; |
5499 | + |
5500 | + touch_nmi_watchdog(); |
5501 | + |
5502 | raw_spin_lock_irqsave(&base->cpu_base->lock, flags); |
5503 | |
5504 | curr = timerqueue_getnext(&base->active); |
5505 | @@ -207,6 +211,8 @@ print_tickdevice(struct seq_file *m, struct tick_device *td, int cpu) |
5506 | { |
5507 | struct clock_event_device *dev = td->evtdev; |
5508 | |
5509 | + touch_nmi_watchdog(); |
5510 | + |
5511 | SEQ_printf(m, "Tick Device: mode: %d\n", td->mode); |
5512 | if (cpu < 0) |
5513 | SEQ_printf(m, "Broadcast device\n"); |
5514 | diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c |
5515 | index fbfacd51aa34..767144128b95 100644 |
5516 | --- a/net/8021q/vlan_dev.c |
5517 | +++ b/net/8021q/vlan_dev.c |
5518 | @@ -562,8 +562,7 @@ static int vlan_dev_init(struct net_device *dev) |
5519 | NETIF_F_HIGHDMA | NETIF_F_SCTP_CRC | |
5520 | NETIF_F_ALL_FCOE; |
5521 | |
5522 | - dev->features |= real_dev->vlan_features | NETIF_F_LLTX | |
5523 | - NETIF_F_GSO_SOFTWARE; |
5524 | + dev->features |= dev->hw_features | NETIF_F_LLTX; |
5525 | dev->gso_max_size = real_dev->gso_max_size; |
5526 | dev->gso_max_segs = real_dev->gso_max_segs; |
5527 | if (dev->features & NETIF_F_VLAN_FEATURES) |
5528 | diff --git a/net/batman-adv/bridge_loop_avoidance.c b/net/batman-adv/bridge_loop_avoidance.c |
5529 | index e7f690b571ea..5419b1214abd 100644 |
5530 | --- a/net/batman-adv/bridge_loop_avoidance.c |
5531 | +++ b/net/batman-adv/bridge_loop_avoidance.c |
5532 | @@ -1964,10 +1964,22 @@ bool batadv_bla_tx(struct batadv_priv *bat_priv, struct sk_buff *skb, |
5533 | /* if yes, the client has roamed and we have |
5534 | * to unclaim it. |
5535 | */ |
5536 | - batadv_handle_unclaim(bat_priv, primary_if, |
5537 | - primary_if->net_dev->dev_addr, |
5538 | - ethhdr->h_source, vid); |
5539 | - goto allow; |
5540 | + if (batadv_has_timed_out(claim->lasttime, 100)) { |
5541 | + /* only unclaim if the last claim entry is |
5542 | + * older than 100 ms to make sure we really |
5543 | + * have a roaming client here. |
5544 | + */ |
5545 | + batadv_dbg(BATADV_DBG_BLA, bat_priv, "bla_tx(): Roaming client %pM detected. Unclaim it.\n", |
5546 | + ethhdr->h_source); |
5547 | + batadv_handle_unclaim(bat_priv, primary_if, |
5548 | + primary_if->net_dev->dev_addr, |
5549 | + ethhdr->h_source, vid); |
5550 | + goto allow; |
5551 | + } else { |
5552 | + batadv_dbg(BATADV_DBG_BLA, bat_priv, "bla_tx(): Race for claim %pM detected. Drop packet.\n", |
5553 | + ethhdr->h_source); |
5554 | + goto handled; |
5555 | + } |
5556 | } |
5557 | |
5558 | /* check if it is a multicast/broadcast frame */ |
5559 | diff --git a/net/bluetooth/6lowpan.c b/net/bluetooth/6lowpan.c |
5560 | index 1904a93f47d5..de7b82ece499 100644 |
5561 | --- a/net/bluetooth/6lowpan.c |
5562 | +++ b/net/bluetooth/6lowpan.c |
5563 | @@ -755,7 +755,8 @@ static void set_ip_addr_bits(u8 addr_type, u8 *addr) |
5564 | } |
5565 | |
5566 | static struct l2cap_chan *add_peer_chan(struct l2cap_chan *chan, |
5567 | - struct lowpan_btle_dev *dev) |
5568 | + struct lowpan_btle_dev *dev, |
5569 | + bool new_netdev) |
5570 | { |
5571 | struct lowpan_peer *peer; |
5572 | |
5573 | @@ -786,7 +787,8 @@ static struct l2cap_chan *add_peer_chan(struct l2cap_chan *chan, |
5574 | spin_unlock(&devices_lock); |
5575 | |
5576 | /* Notifying peers about us needs to be done without locks held */ |
5577 | - INIT_DELAYED_WORK(&dev->notify_peers, do_notify_peers); |
5578 | + if (new_netdev) |
5579 | + INIT_DELAYED_WORK(&dev->notify_peers, do_notify_peers); |
5580 | schedule_delayed_work(&dev->notify_peers, msecs_to_jiffies(100)); |
5581 | |
5582 | return peer->chan; |
5583 | @@ -843,6 +845,7 @@ static int setup_netdev(struct l2cap_chan *chan, struct lowpan_btle_dev **dev) |
5584 | static inline void chan_ready_cb(struct l2cap_chan *chan) |
5585 | { |
5586 | struct lowpan_btle_dev *dev; |
5587 | + bool new_netdev = false; |
5588 | |
5589 | dev = lookup_dev(chan->conn); |
5590 | |
5591 | @@ -853,12 +856,13 @@ static inline void chan_ready_cb(struct l2cap_chan *chan) |
5592 | l2cap_chan_del(chan, -ENOENT); |
5593 | return; |
5594 | } |
5595 | + new_netdev = true; |
5596 | } |
5597 | |
5598 | if (!try_module_get(THIS_MODULE)) |
5599 | return; |
5600 | |
5601 | - add_peer_chan(chan, dev); |
5602 | + add_peer_chan(chan, dev, new_netdev); |
5603 | ifup(dev->netdev); |
5604 | } |
5605 | |
5606 | diff --git a/net/bluetooth/af_bluetooth.c b/net/bluetooth/af_bluetooth.c |
5607 | index 1aff2da9bc74..5d3698170004 100644 |
5608 | --- a/net/bluetooth/af_bluetooth.c |
5609 | +++ b/net/bluetooth/af_bluetooth.c |
5610 | @@ -163,6 +163,9 @@ void bt_accept_enqueue(struct sock *parent, struct sock *sk) |
5611 | } |
5612 | EXPORT_SYMBOL(bt_accept_enqueue); |
5613 | |
5614 | +/* Calling function must hold the sk lock. |
5615 | + * bt_sk(sk)->parent must be non-NULL meaning sk is in the parent list. |
5616 | + */ |
5617 | void bt_accept_unlink(struct sock *sk) |
5618 | { |
5619 | BT_DBG("sk %p state %d", sk, sk->sk_state); |
5620 | @@ -181,11 +184,32 @@ struct sock *bt_accept_dequeue(struct sock *parent, struct socket *newsock) |
5621 | |
5622 | BT_DBG("parent %p", parent); |
5623 | |
5624 | +restart: |
5625 | list_for_each_entry_safe(s, n, &bt_sk(parent)->accept_q, accept_q) { |
5626 | sk = (struct sock *)s; |
5627 | |
5628 | + /* Prevent early freeing of sk due to unlink and sock_kill */ |
5629 | + sock_hold(sk); |
5630 | lock_sock(sk); |
5631 | |
5632 | + /* Check sk has not already been unlinked via |
5633 | + * bt_accept_unlink() due to serialisation caused by sk locking |
5634 | + */ |
5635 | + if (!bt_sk(sk)->parent) { |
5636 | + BT_DBG("sk %p, already unlinked", sk); |
5637 | + release_sock(sk); |
5638 | + sock_put(sk); |
5639 | + |
5640 | + /* Restart the loop as sk is no longer in the list |
5641 | + * and also avoid a potential infinite loop because |
5642 | + * list_for_each_entry_safe() is not thread safe. |
5643 | + */ |
5644 | + goto restart; |
5645 | + } |
5646 | + |
5647 | + /* sk is safely in the parent list so reduce reference count */ |
5648 | + sock_put(sk); |
5649 | + |
5650 | /* FIXME: Is this check still needed */ |
5651 | if (sk->sk_state == BT_CLOSED) { |
5652 | bt_accept_unlink(sk); |
5653 | diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c |
5654 | index a7aa54f45e19..fa7d757fef95 100644 |
5655 | --- a/net/mac80211/iface.c |
5656 | +++ b/net/mac80211/iface.c |
5657 | @@ -1520,7 +1520,7 @@ static void ieee80211_setup_sdata(struct ieee80211_sub_if_data *sdata, |
5658 | break; |
5659 | case NL80211_IFTYPE_UNSPECIFIED: |
5660 | case NUM_NL80211_IFTYPES: |
5661 | - BUG(); |
5662 | + WARN_ON(1); |
5663 | break; |
5664 | } |
5665 | |
5666 | diff --git a/net/sched/act_csum.c b/net/sched/act_csum.c |
5667 | index e0defcef376d..24a0c66394a0 100644 |
5668 | --- a/net/sched/act_csum.c |
5669 | +++ b/net/sched/act_csum.c |
5670 | @@ -180,6 +180,9 @@ static int tcf_csum_ipv4_tcp(struct sk_buff *skb, unsigned int ihl, |
5671 | struct tcphdr *tcph; |
5672 | const struct iphdr *iph; |
5673 | |
5674 | + if (skb_is_gso(skb) && skb_shinfo(skb)->gso_type & SKB_GSO_TCPV4) |
5675 | + return 1; |
5676 | + |
5677 | tcph = tcf_csum_skb_nextlayer(skb, ihl, ipl, sizeof(*tcph)); |
5678 | if (tcph == NULL) |
5679 | return 0; |
5680 | @@ -201,6 +204,9 @@ static int tcf_csum_ipv6_tcp(struct sk_buff *skb, unsigned int ihl, |
5681 | struct tcphdr *tcph; |
5682 | const struct ipv6hdr *ip6h; |
5683 | |
5684 | + if (skb_is_gso(skb) && skb_shinfo(skb)->gso_type & SKB_GSO_TCPV6) |
5685 | + return 1; |
5686 | + |
5687 | tcph = tcf_csum_skb_nextlayer(skb, ihl, ipl, sizeof(*tcph)); |
5688 | if (tcph == NULL) |
5689 | return 0; |
5690 | @@ -224,6 +230,9 @@ static int tcf_csum_ipv4_udp(struct sk_buff *skb, unsigned int ihl, |
5691 | const struct iphdr *iph; |
5692 | u16 ul; |
5693 | |
5694 | + if (skb_is_gso(skb) && skb_shinfo(skb)->gso_type & SKB_GSO_UDP) |
5695 | + return 1; |
5696 | + |
5697 | /* |
5698 | * Support both UDP and UDPLITE checksum algorithms, Don't use |
5699 | * udph->len to get the real length without any protocol check, |
5700 | @@ -277,6 +286,9 @@ static int tcf_csum_ipv6_udp(struct sk_buff *skb, unsigned int ihl, |
5701 | const struct ipv6hdr *ip6h; |
5702 | u16 ul; |
5703 | |
5704 | + if (skb_is_gso(skb) && skb_shinfo(skb)->gso_type & SKB_GSO_UDP) |
5705 | + return 1; |
5706 | + |
5707 | /* |
5708 | * Support both UDP and UDPLITE checksum algorithms, Don't use |
5709 | * udph->len to get the real length without any protocol check, |
5710 | diff --git a/net/sched/sch_netem.c b/net/sched/sch_netem.c |
5711 | index 9f7b380cf0a3..c73d58872cf8 100644 |
5712 | --- a/net/sched/sch_netem.c |
5713 | +++ b/net/sched/sch_netem.c |
5714 | @@ -462,7 +462,7 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch, |
5715 | /* If a delay is expected, orphan the skb. (orphaning usually takes |
5716 | * place at TX completion time, so _before_ the link transit delay) |
5717 | */ |
5718 | - if (q->latency || q->jitter) |
5719 | + if (q->latency || q->jitter || q->rate) |
5720 | skb_orphan_partial(skb); |
5721 | |
5722 | /* |
5723 | @@ -530,21 +530,31 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch, |
5724 | now = psched_get_time(); |
5725 | |
5726 | if (q->rate) { |
5727 | - struct sk_buff *last; |
5728 | + struct netem_skb_cb *last = NULL; |
5729 | + |
5730 | + if (sch->q.tail) |
5731 | + last = netem_skb_cb(sch->q.tail); |
5732 | + if (q->t_root.rb_node) { |
5733 | + struct sk_buff *t_skb; |
5734 | + struct netem_skb_cb *t_last; |
5735 | + |
5736 | + t_skb = netem_rb_to_skb(rb_last(&q->t_root)); |
5737 | + t_last = netem_skb_cb(t_skb); |
5738 | + if (!last || |
5739 | + t_last->time_to_send > last->time_to_send) { |
5740 | + last = t_last; |
5741 | + } |
5742 | + } |
5743 | |
5744 | - if (sch->q.qlen) |
5745 | - last = sch->q.tail; |
5746 | - else |
5747 | - last = netem_rb_to_skb(rb_last(&q->t_root)); |
5748 | if (last) { |
5749 | /* |
5750 | * Last packet in queue is reference point (now), |
5751 | * calculate this time bonus and subtract |
5752 | * from delay. |
5753 | */ |
5754 | - delay -= netem_skb_cb(last)->time_to_send - now; |
5755 | + delay -= last->time_to_send - now; |
5756 | delay = max_t(psched_tdiff_t, 0, delay); |
5757 | - now = netem_skb_cb(last)->time_to_send; |
5758 | + now = last->time_to_send; |
5759 | } |
5760 | |
5761 | delay += packet_len_2_sched_time(qdisc_pkt_len(skb), q); |
5762 | diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c |
5763 | index 5e89b7461f99..5b8fa6832687 100644 |
5764 | --- a/net/xfrm/xfrm_policy.c |
5765 | +++ b/net/xfrm/xfrm_policy.c |
5766 | @@ -1346,7 +1346,7 @@ EXPORT_SYMBOL(xfrm_policy_delete); |
5767 | |
5768 | int xfrm_sk_policy_insert(struct sock *sk, int dir, struct xfrm_policy *pol) |
5769 | { |
5770 | - struct net *net = xp_net(pol); |
5771 | + struct net *net = sock_net(sk); |
5772 | struct xfrm_policy *old_pol; |
5773 | |
5774 | #ifdef CONFIG_XFRM_SUB_POLICY |
5775 | diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c |
5776 | index 419bf5d463bd..13e0611a9085 100644 |
5777 | --- a/net/xfrm/xfrm_state.c |
5778 | +++ b/net/xfrm/xfrm_state.c |
5779 | @@ -1883,6 +1883,13 @@ int xfrm_user_policy(struct sock *sk, int optname, u8 __user *optval, int optlen |
5780 | struct xfrm_mgr *km; |
5781 | struct xfrm_policy *pol = NULL; |
5782 | |
5783 | + if (!optval && !optlen) { |
5784 | + xfrm_sk_policy_insert(sk, XFRM_POLICY_IN, NULL); |
5785 | + xfrm_sk_policy_insert(sk, XFRM_POLICY_OUT, NULL); |
5786 | + __sk_dst_reset(sk); |
5787 | + return 0; |
5788 | + } |
5789 | + |
5790 | if (optlen <= 0 || optlen > PAGE_SIZE) |
5791 | return -EMSGSIZE; |
5792 | |
5793 | diff --git a/security/apparmor/lsm.c b/security/apparmor/lsm.c |
5794 | index 7d3a98b2d55a..02cc952b86aa 100644 |
5795 | --- a/security/apparmor/lsm.c |
5796 | +++ b/security/apparmor/lsm.c |
5797 | @@ -707,7 +707,7 @@ module_param_named(logsyscall, aa_g_logsyscall, aabool, S_IRUSR | S_IWUSR); |
5798 | |
5799 | /* Maximum pathname length before accesses will start getting rejected */ |
5800 | unsigned int aa_g_path_max = 2 * PATH_MAX; |
5801 | -module_param_named(path_max, aa_g_path_max, aauint, S_IRUSR | S_IWUSR); |
5802 | +module_param_named(path_max, aa_g_path_max, aauint, S_IRUSR); |
5803 | |
5804 | /* Determines how paranoid loading of policy is and how much verification |
5805 | * on the loaded policy is done. |
5806 | diff --git a/security/integrity/ima/ima_appraise.c b/security/integrity/ima/ima_appraise.c |
5807 | index 6830d2427e47..7bf8b005a178 100644 |
5808 | --- a/security/integrity/ima/ima_appraise.c |
5809 | +++ b/security/integrity/ima/ima_appraise.c |
5810 | @@ -207,7 +207,8 @@ int ima_appraise_measurement(enum ima_hooks func, |
5811 | if (opened & FILE_CREATED) |
5812 | iint->flags |= IMA_NEW_FILE; |
5813 | if ((iint->flags & IMA_NEW_FILE) && |
5814 | - !(iint->flags & IMA_DIGSIG_REQUIRED)) |
5815 | + (!(iint->flags & IMA_DIGSIG_REQUIRED) || |
5816 | + (inode->i_size == 0))) |
5817 | status = INTEGRITY_PASS; |
5818 | goto out; |
5819 | } |
5820 | diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c |
5821 | index c2da45ae5b2a..b8278f3af9da 100644 |
5822 | --- a/security/selinux/hooks.c |
5823 | +++ b/security/selinux/hooks.c |
5824 | @@ -4328,10 +4328,18 @@ static int selinux_socket_bind(struct socket *sock, struct sockaddr *address, in |
5825 | u32 sid, node_perm; |
5826 | |
5827 | if (family == PF_INET) { |
5828 | + if (addrlen < sizeof(struct sockaddr_in)) { |
5829 | + err = -EINVAL; |
5830 | + goto out; |
5831 | + } |
5832 | addr4 = (struct sockaddr_in *)address; |
5833 | snum = ntohs(addr4->sin_port); |
5834 | addrp = (char *)&addr4->sin_addr.s_addr; |
5835 | } else { |
5836 | + if (addrlen < SIN6_LEN_RFC2133) { |
5837 | + err = -EINVAL; |
5838 | + goto out; |
5839 | + } |
5840 | addr6 = (struct sockaddr_in6 *)address; |
5841 | snum = ntohs(addr6->sin6_port); |
5842 | addrp = (char *)&addr6->sin6_addr.s6_addr; |
5843 | diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c |
5844 | index 3321348fd86b..3e7c3573871d 100644 |
5845 | --- a/sound/core/oss/pcm_oss.c |
5846 | +++ b/sound/core/oss/pcm_oss.c |
5847 | @@ -1814,10 +1814,9 @@ static int snd_pcm_oss_get_formats(struct snd_pcm_oss_file *pcm_oss_file) |
5848 | return -ENOMEM; |
5849 | _snd_pcm_hw_params_any(params); |
5850 | err = snd_pcm_hw_refine(substream, params); |
5851 | - format_mask = *hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT); |
5852 | - kfree(params); |
5853 | if (err < 0) |
5854 | - return err; |
5855 | + goto error; |
5856 | + format_mask = *hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT); |
5857 | for (fmt = 0; fmt < 32; ++fmt) { |
5858 | if (snd_mask_test(&format_mask, fmt)) { |
5859 | int f = snd_pcm_oss_format_to(fmt); |
5860 | @@ -1825,7 +1824,10 @@ static int snd_pcm_oss_get_formats(struct snd_pcm_oss_file *pcm_oss_file) |
5861 | formats |= f; |
5862 | } |
5863 | } |
5864 | - return formats; |
5865 | + |
5866 | + error: |
5867 | + kfree(params); |
5868 | + return err < 0 ? err : formats; |
5869 | } |
5870 | |
5871 | static int snd_pcm_oss_set_format(struct snd_pcm_oss_file *pcm_oss_file, int format) |
5872 | diff --git a/sound/core/seq/seq_clientmgr.c b/sound/core/seq/seq_clientmgr.c |
5873 | index 799ad3e1d24b..ecd1c5fc8db8 100644 |
5874 | --- a/sound/core/seq/seq_clientmgr.c |
5875 | +++ b/sound/core/seq/seq_clientmgr.c |
5876 | @@ -255,12 +255,12 @@ static int seq_free_client1(struct snd_seq_client *client) |
5877 | |
5878 | if (!client) |
5879 | return 0; |
5880 | - snd_seq_delete_all_ports(client); |
5881 | - snd_seq_queue_client_leave(client->number); |
5882 | spin_lock_irqsave(&clients_lock, flags); |
5883 | clienttablock[client->number] = 1; |
5884 | clienttab[client->number] = NULL; |
5885 | spin_unlock_irqrestore(&clients_lock, flags); |
5886 | + snd_seq_delete_all_ports(client); |
5887 | + snd_seq_queue_client_leave(client->number); |
5888 | snd_use_lock_sync(&client->use_lock); |
5889 | snd_seq_queue_client_termination(client->number); |
5890 | if (client->pool) |
5891 | diff --git a/sound/core/seq/seq_prioq.c b/sound/core/seq/seq_prioq.c |
5892 | index bc1c8488fc2a..2bc6759e4adc 100644 |
5893 | --- a/sound/core/seq/seq_prioq.c |
5894 | +++ b/sound/core/seq/seq_prioq.c |
5895 | @@ -87,7 +87,7 @@ void snd_seq_prioq_delete(struct snd_seq_prioq **fifo) |
5896 | if (f->cells > 0) { |
5897 | /* drain prioQ */ |
5898 | while (f->cells > 0) |
5899 | - snd_seq_cell_free(snd_seq_prioq_cell_out(f)); |
5900 | + snd_seq_cell_free(snd_seq_prioq_cell_out(f, NULL)); |
5901 | } |
5902 | |
5903 | kfree(f); |
5904 | @@ -214,8 +214,18 @@ int snd_seq_prioq_cell_in(struct snd_seq_prioq * f, |
5905 | return 0; |
5906 | } |
5907 | |
5908 | +/* return 1 if the current time >= event timestamp */ |
5909 | +static int event_is_ready(struct snd_seq_event *ev, void *current_time) |
5910 | +{ |
5911 | + if ((ev->flags & SNDRV_SEQ_TIME_STAMP_MASK) == SNDRV_SEQ_TIME_STAMP_TICK) |
5912 | + return snd_seq_compare_tick_time(current_time, &ev->time.tick); |
5913 | + else |
5914 | + return snd_seq_compare_real_time(current_time, &ev->time.time); |
5915 | +} |
5916 | + |
5917 | /* dequeue cell from prioq */ |
5918 | -struct snd_seq_event_cell *snd_seq_prioq_cell_out(struct snd_seq_prioq *f) |
5919 | +struct snd_seq_event_cell *snd_seq_prioq_cell_out(struct snd_seq_prioq *f, |
5920 | + void *current_time) |
5921 | { |
5922 | struct snd_seq_event_cell *cell; |
5923 | unsigned long flags; |
5924 | @@ -227,6 +237,8 @@ struct snd_seq_event_cell *snd_seq_prioq_cell_out(struct snd_seq_prioq *f) |
5925 | spin_lock_irqsave(&f->lock, flags); |
5926 | |
5927 | cell = f->head; |
5928 | + if (cell && current_time && !event_is_ready(&cell->event, current_time)) |
5929 | + cell = NULL; |
5930 | if (cell) { |
5931 | f->head = cell->next; |
5932 | |
5933 | @@ -252,18 +264,6 @@ int snd_seq_prioq_avail(struct snd_seq_prioq * f) |
5934 | return f->cells; |
5935 | } |
5936 | |
5937 | - |
5938 | -/* peek at cell at the head of the prioq */ |
5939 | -struct snd_seq_event_cell *snd_seq_prioq_cell_peek(struct snd_seq_prioq * f) |
5940 | -{ |
5941 | - if (f == NULL) { |
5942 | - pr_debug("ALSA: seq: snd_seq_prioq_cell_in() called with NULL prioq\n"); |
5943 | - return NULL; |
5944 | - } |
5945 | - return f->head; |
5946 | -} |
5947 | - |
5948 | - |
5949 | static inline int prioq_match(struct snd_seq_event_cell *cell, |
5950 | int client, int timestamp) |
5951 | { |
5952 | diff --git a/sound/core/seq/seq_prioq.h b/sound/core/seq/seq_prioq.h |
5953 | index d38bb78d9345..2c315ca10fc4 100644 |
5954 | --- a/sound/core/seq/seq_prioq.h |
5955 | +++ b/sound/core/seq/seq_prioq.h |
5956 | @@ -44,14 +44,12 @@ void snd_seq_prioq_delete(struct snd_seq_prioq **fifo); |
5957 | int snd_seq_prioq_cell_in(struct snd_seq_prioq *f, struct snd_seq_event_cell *cell); |
5958 | |
5959 | /* dequeue cell from prioq */ |
5960 | -struct snd_seq_event_cell *snd_seq_prioq_cell_out(struct snd_seq_prioq *f); |
5961 | +struct snd_seq_event_cell *snd_seq_prioq_cell_out(struct snd_seq_prioq *f, |
5962 | + void *current_time); |
5963 | |
5964 | /* return number of events available in prioq */ |
5965 | int snd_seq_prioq_avail(struct snd_seq_prioq *f); |
5966 | |
5967 | -/* peek at cell at the head of the prioq */ |
5968 | -struct snd_seq_event_cell *snd_seq_prioq_cell_peek(struct snd_seq_prioq *f); |
5969 | - |
5970 | /* client left queue */ |
5971 | void snd_seq_prioq_leave(struct snd_seq_prioq *f, int client, int timestamp); |
5972 | |
5973 | diff --git a/sound/core/seq/seq_queue.c b/sound/core/seq/seq_queue.c |
5974 | index 79e0c5604ef8..1a6dc4ff44a6 100644 |
5975 | --- a/sound/core/seq/seq_queue.c |
5976 | +++ b/sound/core/seq/seq_queue.c |
5977 | @@ -277,30 +277,20 @@ void snd_seq_check_queue(struct snd_seq_queue *q, int atomic, int hop) |
5978 | |
5979 | __again: |
5980 | /* Process tick queue... */ |
5981 | - while ((cell = snd_seq_prioq_cell_peek(q->tickq)) != NULL) { |
5982 | - if (snd_seq_compare_tick_time(&q->timer->tick.cur_tick, |
5983 | - &cell->event.time.tick)) { |
5984 | - cell = snd_seq_prioq_cell_out(q->tickq); |
5985 | - if (cell) |
5986 | - snd_seq_dispatch_event(cell, atomic, hop); |
5987 | - } else { |
5988 | - /* event remains in the queue */ |
5989 | + for (;;) { |
5990 | + cell = snd_seq_prioq_cell_out(q->tickq, |
5991 | + &q->timer->tick.cur_tick); |
5992 | + if (!cell) |
5993 | break; |
5994 | - } |
5995 | + snd_seq_dispatch_event(cell, atomic, hop); |
5996 | } |
5997 | |
5998 | - |
5999 | /* Process time queue... */ |
6000 | - while ((cell = snd_seq_prioq_cell_peek(q->timeq)) != NULL) { |
6001 | - if (snd_seq_compare_real_time(&q->timer->cur_time, |
6002 | - &cell->event.time.time)) { |
6003 | - cell = snd_seq_prioq_cell_out(q->timeq); |
6004 | - if (cell) |
6005 | - snd_seq_dispatch_event(cell, atomic, hop); |
6006 | - } else { |
6007 | - /* event remains in the queue */ |
6008 | + for (;;) { |
6009 | + cell = snd_seq_prioq_cell_out(q->timeq, &q->timer->cur_time); |
6010 | + if (!cell) |
6011 | break; |
6012 | - } |
6013 | + snd_seq_dispatch_event(cell, atomic, hop); |
6014 | } |
6015 | |
6016 | /* free lock */ |
6017 | diff --git a/sound/firewire/amdtp-stream.c b/sound/firewire/amdtp-stream.c |
6018 | index 9741757436be..d0ad61f563e2 100644 |
6019 | --- a/sound/firewire/amdtp-stream.c |
6020 | +++ b/sound/firewire/amdtp-stream.c |
6021 | @@ -471,8 +471,9 @@ static int handle_in_packet(struct amdtp_stream *s, |
6022 | * This module supports 'Two-quadlet CIP header with SYT field'. |
6023 | * For convenience, also check FMT field is AM824 or not. |
6024 | */ |
6025 | - if (((cip_header[0] & CIP_EOH_MASK) == CIP_EOH) || |
6026 | - ((cip_header[1] & CIP_EOH_MASK) != CIP_EOH)) { |
6027 | + if ((((cip_header[0] & CIP_EOH_MASK) == CIP_EOH) || |
6028 | + ((cip_header[1] & CIP_EOH_MASK) != CIP_EOH)) && |
6029 | + (!(s->flags & CIP_HEADER_WITHOUT_EOH))) { |
6030 | dev_info_ratelimited(&s->unit->device, |
6031 | "Invalid CIP header for AMDTP: %08X:%08X\n", |
6032 | cip_header[0], cip_header[1]); |
6033 | diff --git a/sound/firewire/amdtp-stream.h b/sound/firewire/amdtp-stream.h |
6034 | index f7c054bc9d92..8136bd20c8b1 100644 |
6035 | --- a/sound/firewire/amdtp-stream.h |
6036 | +++ b/sound/firewire/amdtp-stream.h |
6037 | @@ -29,6 +29,8 @@ |
6038 | * @CIP_JUMBO_PAYLOAD: Only for in-stream. The number of data blocks in an |
6039 | * packet is larger than IEC 61883-6 defines. Current implementation |
6040 | * allows 5 times as large as IEC 61883-6 defines. |
6041 | + * @CIP_HEADER_WITHOUT_EOH: Only for in-stream. CIP Header doesn't include |
6042 | + * valid EOH. |
6043 | */ |
6044 | enum cip_flags { |
6045 | CIP_NONBLOCKING = 0x00, |
6046 | @@ -39,6 +41,7 @@ enum cip_flags { |
6047 | CIP_SKIP_DBC_ZERO_CHECK = 0x10, |
6048 | CIP_EMPTY_HAS_WRONG_DBC = 0x20, |
6049 | CIP_JUMBO_PAYLOAD = 0x40, |
6050 | + CIP_HEADER_WITHOUT_EOH = 0x80, |
6051 | }; |
6052 | |
6053 | /** |
6054 | diff --git a/sound/firewire/digi00x/amdtp-dot.c b/sound/firewire/digi00x/amdtp-dot.c |
6055 | index b3cffd01a19f..a4688545339c 100644 |
6056 | --- a/sound/firewire/digi00x/amdtp-dot.c |
6057 | +++ b/sound/firewire/digi00x/amdtp-dot.c |
6058 | @@ -28,6 +28,9 @@ |
6059 | */ |
6060 | #define MAX_MIDI_RX_BLOCKS 8 |
6061 | |
6062 | +/* 3 = MAX(DOT_MIDI_IN_PORTS, DOT_MIDI_OUT_PORTS) + 1. */ |
6063 | +#define MAX_MIDI_PORTS 3 |
6064 | + |
6065 | /* |
6066 | * The double-oh-three algorithm was discovered by Robin Gareus and Damien |
6067 | * Zammit in 2012, with reverse-engineering for Digi 003 Rack. |
6068 | @@ -42,10 +45,8 @@ struct amdtp_dot { |
6069 | unsigned int pcm_channels; |
6070 | struct dot_state state; |
6071 | |
6072 | - unsigned int midi_ports; |
6073 | - /* 2 = MAX(DOT_MIDI_IN_PORTS, DOT_MIDI_OUT_PORTS) */ |
6074 | - struct snd_rawmidi_substream *midi[2]; |
6075 | - int midi_fifo_used[2]; |
6076 | + struct snd_rawmidi_substream *midi[MAX_MIDI_PORTS]; |
6077 | + int midi_fifo_used[MAX_MIDI_PORTS]; |
6078 | int midi_fifo_limit; |
6079 | |
6080 | void (*transfer_samples)(struct amdtp_stream *s, |
6081 | @@ -124,8 +125,8 @@ int amdtp_dot_set_parameters(struct amdtp_stream *s, unsigned int rate, |
6082 | return -EBUSY; |
6083 | |
6084 | /* |
6085 | - * A first data channel is for MIDI conformant data channel, the rest is |
6086 | - * Multi Bit Linear Audio data channel. |
6087 | + * A first data channel is for MIDI messages, the rest is Multi Bit |
6088 | + * Linear Audio data channel. |
6089 | */ |
6090 | err = amdtp_stream_set_parameters(s, rate, pcm_channels + 1); |
6091 | if (err < 0) |
6092 | @@ -135,11 +136,6 @@ int amdtp_dot_set_parameters(struct amdtp_stream *s, unsigned int rate, |
6093 | |
6094 | p->pcm_channels = pcm_channels; |
6095 | |
6096 | - if (s->direction == AMDTP_IN_STREAM) |
6097 | - p->midi_ports = DOT_MIDI_IN_PORTS; |
6098 | - else |
6099 | - p->midi_ports = DOT_MIDI_OUT_PORTS; |
6100 | - |
6101 | /* |
6102 | * We do not know the actual MIDI FIFO size of most devices. Just |
6103 | * assume two bytes, i.e., one byte can be received over the bus while |
6104 | @@ -281,13 +277,25 @@ static void write_midi_messages(struct amdtp_stream *s, __be32 *buffer, |
6105 | b = (u8 *)&buffer[0]; |
6106 | |
6107 | len = 0; |
6108 | - if (port < p->midi_ports && |
6109 | + if (port < MAX_MIDI_PORTS && |
6110 | midi_ratelimit_per_packet(s, port) && |
6111 | p->midi[port] != NULL) |
6112 | len = snd_rawmidi_transmit(p->midi[port], b + 1, 2); |
6113 | |
6114 | if (len > 0) { |
6115 | - b[3] = (0x10 << port) | len; |
6116 | + /* |
6117 | + * Upper 4 bits of LSB represent port number. |
6118 | + * - 0000b: physical MIDI port 1. |
6119 | + * - 0010b: physical MIDI port 2. |
6120 | + * - 1110b: console MIDI port. |
6121 | + */ |
6122 | + if (port == 2) |
6123 | + b[3] = 0xe0; |
6124 | + else if (port == 1) |
6125 | + b[3] = 0x20; |
6126 | + else |
6127 | + b[3] = 0x00; |
6128 | + b[3] |= len; |
6129 | midi_use_bytes(s, port, len); |
6130 | } else { |
6131 | b[1] = 0; |
6132 | @@ -309,11 +317,22 @@ static void read_midi_messages(struct amdtp_stream *s, __be32 *buffer, |
6133 | |
6134 | for (f = 0; f < data_blocks; f++) { |
6135 | b = (u8 *)&buffer[0]; |
6136 | - port = b[3] >> 4; |
6137 | - len = b[3] & 0x0f; |
6138 | |
6139 | - if (port < p->midi_ports && p->midi[port] && len > 0) |
6140 | - snd_rawmidi_receive(p->midi[port], b + 1, len); |
6141 | + len = b[3] & 0x0f; |
6142 | + if (len > 0) { |
6143 | + /* |
6144 | + * Upper 4 bits of LSB represent port number. |
6145 | + * - 0000b: physical MIDI port 1. Use port 0. |
6146 | + * - 1110b: console MIDI port. Use port 2. |
6147 | + */ |
6148 | + if (b[3] >> 4 > 0) |
6149 | + port = 2; |
6150 | + else |
6151 | + port = 0; |
6152 | + |
6153 | + if (port < MAX_MIDI_PORTS && p->midi[port]) |
6154 | + snd_rawmidi_receive(p->midi[port], b + 1, len); |
6155 | + } |
6156 | |
6157 | buffer += s->data_block_quadlets; |
6158 | } |
6159 | @@ -364,7 +383,7 @@ void amdtp_dot_midi_trigger(struct amdtp_stream *s, unsigned int port, |
6160 | { |
6161 | struct amdtp_dot *p = s->protocol; |
6162 | |
6163 | - if (port < p->midi_ports) |
6164 | + if (port < MAX_MIDI_PORTS) |
6165 | ACCESS_ONCE(p->midi[port]) = midi; |
6166 | } |
6167 | |
6168 | diff --git a/sound/firewire/digi00x/digi00x.c b/sound/firewire/digi00x/digi00x.c |
6169 | index cc4776c6ded3..1f5e1d23f31a 100644 |
6170 | --- a/sound/firewire/digi00x/digi00x.c |
6171 | +++ b/sound/firewire/digi00x/digi00x.c |
6172 | @@ -13,7 +13,8 @@ MODULE_AUTHOR("Takashi Sakamoto <o-takashi@sakamocchi.jp>"); |
6173 | MODULE_LICENSE("GPL v2"); |
6174 | |
6175 | #define VENDOR_DIGIDESIGN 0x00a07e |
6176 | -#define MODEL_DIGI00X 0x000002 |
6177 | +#define MODEL_CONSOLE 0x000001 |
6178 | +#define MODEL_RACK 0x000002 |
6179 | |
6180 | static int name_card(struct snd_dg00x *dg00x) |
6181 | { |
6182 | @@ -129,6 +130,8 @@ static int snd_dg00x_probe(struct fw_unit *unit, |
6183 | spin_lock_init(&dg00x->lock); |
6184 | init_waitqueue_head(&dg00x->hwdep_wait); |
6185 | |
6186 | + dg00x->is_console = entry->model_id == MODEL_CONSOLE; |
6187 | + |
6188 | /* Allocate and register this sound card later. */ |
6189 | INIT_DEFERRABLE_WORK(&dg00x->dwork, do_registration); |
6190 | snd_fw_schedule_registration(unit, &dg00x->dwork); |
6191 | @@ -183,7 +186,13 @@ static const struct ieee1394_device_id snd_dg00x_id_table[] = { |
6192 | .match_flags = IEEE1394_MATCH_VENDOR_ID | |
6193 | IEEE1394_MATCH_MODEL_ID, |
6194 | .vendor_id = VENDOR_DIGIDESIGN, |
6195 | - .model_id = MODEL_DIGI00X, |
6196 | + .model_id = MODEL_CONSOLE, |
6197 | + }, |
6198 | + { |
6199 | + .match_flags = IEEE1394_MATCH_VENDOR_ID | |
6200 | + IEEE1394_MATCH_MODEL_ID, |
6201 | + .vendor_id = VENDOR_DIGIDESIGN, |
6202 | + .model_id = MODEL_RACK, |
6203 | }, |
6204 | {} |
6205 | }; |
6206 | diff --git a/sound/firewire/digi00x/digi00x.h b/sound/firewire/digi00x/digi00x.h |
6207 | index 2cd465c0caae..43bcb0ce69c0 100644 |
6208 | --- a/sound/firewire/digi00x/digi00x.h |
6209 | +++ b/sound/firewire/digi00x/digi00x.h |
6210 | @@ -60,6 +60,7 @@ struct snd_dg00x { |
6211 | /* For asynchronous MIDI controls. */ |
6212 | struct snd_rawmidi_substream *in_control; |
6213 | struct snd_fw_async_midi_port out_control; |
6214 | + bool is_console; |
6215 | }; |
6216 | |
6217 | #define DG00X_ADDR_BASE 0xffffe0000000ull |
6218 | diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c |
6219 | index ceb162a9dcfd..733b3423baa2 100644 |
6220 | --- a/sound/pci/hda/hda_intel.c |
6221 | +++ b/sound/pci/hda/hda_intel.c |
6222 | @@ -180,11 +180,15 @@ static const struct kernel_param_ops param_ops_xint = { |
6223 | }; |
6224 | #define param_check_xint param_check_int |
6225 | |
6226 | -static int power_save = -1; |
6227 | +static int power_save = CONFIG_SND_HDA_POWER_SAVE_DEFAULT; |
6228 | module_param(power_save, xint, 0644); |
6229 | MODULE_PARM_DESC(power_save, "Automatic power-saving timeout " |
6230 | "(in second, 0 = disable)."); |
6231 | |
6232 | +static bool pm_blacklist = true; |
6233 | +module_param(pm_blacklist, bool, 0644); |
6234 | +MODULE_PARM_DESC(pm_blacklist, "Enable power-management blacklist"); |
6235 | + |
6236 | /* reset the HD-audio controller in power save mode. |
6237 | * this may give more power-saving, but will take longer time to |
6238 | * wake up. |
6239 | @@ -369,8 +373,10 @@ enum { |
6240 | #define IS_KBL_LP(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0x9d71) |
6241 | #define IS_KBL_H(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0xa2f0) |
6242 | #define IS_BXT(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0x5a98) |
6243 | +#define IS_GLK(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0x3198) |
6244 | #define IS_SKL_PLUS(pci) (IS_SKL(pci) || IS_SKL_LP(pci) || IS_BXT(pci)) || \ |
6245 | - IS_KBL(pci) || IS_KBL_LP(pci) || IS_KBL_H(pci) |
6246 | + IS_KBL(pci) || IS_KBL_LP(pci) || IS_KBL_H(pci) || \ |
6247 | + IS_GLK(pci) |
6248 | |
6249 | static char *driver_short_names[] = { |
6250 | [AZX_DRIVER_ICH] = "HDA Intel", |
6251 | @@ -2151,10 +2157,9 @@ static int azx_probe_continue(struct azx *chip) |
6252 | |
6253 | val = power_save; |
6254 | #ifdef CONFIG_PM |
6255 | - if (val == -1) { |
6256 | + if (pm_blacklist) { |
6257 | const struct snd_pci_quirk *q; |
6258 | |
6259 | - val = CONFIG_SND_HDA_POWER_SAVE_DEFAULT; |
6260 | q = snd_pci_quirk_lookup(chip->pci, power_save_blacklist); |
6261 | if (q && val) { |
6262 | dev_info(chip->card->dev, "device %04x:%04x is on the power_save blacklist, forcing power_save to 0\n", |
6263 | diff --git a/sound/soc/codecs/rt5677.c b/sound/soc/codecs/rt5677.c |
6264 | index abc802a5a479..65ac4518ad06 100644 |
6265 | --- a/sound/soc/codecs/rt5677.c |
6266 | +++ b/sound/soc/codecs/rt5677.c |
6267 | @@ -5035,6 +5035,12 @@ static const struct i2c_device_id rt5677_i2c_id[] = { |
6268 | }; |
6269 | MODULE_DEVICE_TABLE(i2c, rt5677_i2c_id); |
6270 | |
6271 | +static const struct of_device_id rt5677_of_match[] = { |
6272 | + { .compatible = "realtek,rt5677", }, |
6273 | + { } |
6274 | +}; |
6275 | +MODULE_DEVICE_TABLE(of, rt5677_of_match); |
6276 | + |
6277 | static const struct acpi_gpio_params plug_det_gpio = { RT5677_GPIO_PLUG_DET, 0, false }; |
6278 | static const struct acpi_gpio_params mic_present_gpio = { RT5677_GPIO_MIC_PRESENT_L, 0, false }; |
6279 | static const struct acpi_gpio_params headphone_enable_gpio = { RT5677_GPIO_HP_AMP_SHDN_L, 0, false }; |
6280 | @@ -5294,6 +5300,7 @@ static int rt5677_i2c_remove(struct i2c_client *i2c) |
6281 | static struct i2c_driver rt5677_i2c_driver = { |
6282 | .driver = { |
6283 | .name = "rt5677", |
6284 | + .of_match_table = rt5677_of_match, |
6285 | }, |
6286 | .probe = rt5677_i2c_probe, |
6287 | .remove = rt5677_i2c_remove, |
6288 | diff --git a/sound/soc/nuc900/nuc900-ac97.c b/sound/soc/nuc900/nuc900-ac97.c |
6289 | index b6615affe571..fde974d52bb2 100644 |
6290 | --- a/sound/soc/nuc900/nuc900-ac97.c |
6291 | +++ b/sound/soc/nuc900/nuc900-ac97.c |
6292 | @@ -67,7 +67,7 @@ static unsigned short nuc900_ac97_read(struct snd_ac97 *ac97, |
6293 | |
6294 | /* polling the AC_R_FINISH */ |
6295 | while (!(AUDIO_READ(nuc900_audio->mmio + ACTL_ACCON) & AC_R_FINISH) |
6296 | - && timeout--) |
6297 | + && --timeout) |
6298 | mdelay(1); |
6299 | |
6300 | if (!timeout) { |
6301 | @@ -121,7 +121,7 @@ static void nuc900_ac97_write(struct snd_ac97 *ac97, unsigned short reg, |
6302 | |
6303 | /* polling the AC_W_FINISH */ |
6304 | while ((AUDIO_READ(nuc900_audio->mmio + ACTL_ACCON) & AC_W_FINISH) |
6305 | - && timeout--) |
6306 | + && --timeout) |
6307 | mdelay(1); |
6308 | |
6309 | if (!timeout) |
6310 | diff --git a/sound/soc/sh/rcar/ssi.c b/sound/soc/sh/rcar/ssi.c |
6311 | index a9a43acce30e..fefa6ad5de8b 100644 |
6312 | --- a/sound/soc/sh/rcar/ssi.c |
6313 | +++ b/sound/soc/sh/rcar/ssi.c |
6314 | @@ -232,6 +232,15 @@ static int rsnd_ssi_master_clk_start(struct rsnd_mod *mod, |
6315 | */ |
6316 | for (j = 0; j < ARRAY_SIZE(ssi_clk_mul_table); j++) { |
6317 | |
6318 | + /* |
6319 | + * It will set SSIWSR.CONT here, but SSICR.CKDV = 000 |
6320 | + * with it is not allowed. (SSIWSR.WS_MODE with |
6321 | + * SSICR.CKDV = 000 is not allowed either). |
6322 | + * Skip it. See SSICR.CKDV |
6323 | + */ |
6324 | + if (j == 0) |
6325 | + continue; |
6326 | + |
6327 | /* |
6328 | * this driver is assuming that |
6329 | * system word is 32bit x chan |
6330 | diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c |
6331 | index f87996b0cb29..9a250c71840e 100644 |
6332 | --- a/tools/perf/builtin-probe.c |
6333 | +++ b/tools/perf/builtin-probe.c |
6334 | @@ -442,9 +442,9 @@ static int perf_del_probe_events(struct strfilter *filter) |
6335 | } |
6336 | |
6337 | if (ret == -ENOENT && ret2 == -ENOENT) |
6338 | - pr_debug("\"%s\" does not hit any event.\n", str); |
6339 | - /* Note that this is silently ignored */ |
6340 | - ret = 0; |
6341 | + pr_warning("\"%s\" does not hit any event.\n", str); |
6342 | + else |
6343 | + ret = 0; |
6344 | |
6345 | error: |
6346 | if (kfd >= 0) |
6347 | diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c |
6348 | index 688dea7cb08f..5b60ec669e73 100644 |
6349 | --- a/tools/perf/builtin-stat.c |
6350 | +++ b/tools/perf/builtin-stat.c |
6351 | @@ -146,6 +146,7 @@ static aggr_get_id_t aggr_get_id; |
6352 | static bool append_file; |
6353 | static const char *output_name; |
6354 | static int output_fd; |
6355 | +static int print_free_counters_hint; |
6356 | |
6357 | struct perf_stat { |
6358 | bool record; |
6359 | @@ -310,8 +311,12 @@ static int read_counter(struct perf_evsel *counter) |
6360 | struct perf_counts_values *count; |
6361 | |
6362 | count = perf_counts(counter->counts, cpu, thread); |
6363 | - if (perf_evsel__read(counter, cpu, thread, count)) |
6364 | + if (perf_evsel__read(counter, cpu, thread, count)) { |
6365 | + counter->counts->scaled = -1; |
6366 | + perf_counts(counter->counts, cpu, thread)->ena = 0; |
6367 | + perf_counts(counter->counts, cpu, thread)->run = 0; |
6368 | return -1; |
6369 | + } |
6370 | |
6371 | if (STAT_RECORD) { |
6372 | if (perf_evsel__write_stat_event(counter, cpu, thread, count)) { |
6373 | @@ -336,12 +341,14 @@ static int read_counter(struct perf_evsel *counter) |
6374 | static void read_counters(void) |
6375 | { |
6376 | struct perf_evsel *counter; |
6377 | + int ret; |
6378 | |
6379 | evlist__for_each_entry(evsel_list, counter) { |
6380 | - if (read_counter(counter)) |
6381 | + ret = read_counter(counter); |
6382 | + if (ret) |
6383 | pr_debug("failed to read counter %s\n", counter->name); |
6384 | |
6385 | - if (perf_stat_process_counter(&stat_config, counter)) |
6386 | + if (ret == 0 && perf_stat_process_counter(&stat_config, counter)) |
6387 | pr_warning("failed to process counter %s\n", counter->name); |
6388 | } |
6389 | } |
6390 | @@ -1109,6 +1116,9 @@ static void printout(int id, int nr, struct perf_evsel *counter, double uval, |
6391 | counter->supported ? CNTR_NOT_COUNTED : CNTR_NOT_SUPPORTED, |
6392 | csv_sep); |
6393 | |
6394 | + if (counter->supported) |
6395 | + print_free_counters_hint = 1; |
6396 | + |
6397 | fprintf(stat_config.output, "%-*s%s", |
6398 | csv_output ? 0 : unit_width, |
6399 | counter->unit, csv_sep); |
6400 | @@ -1477,6 +1487,13 @@ static void print_footer(void) |
6401 | avg_stats(&walltime_nsecs_stats)); |
6402 | } |
6403 | fprintf(output, "\n\n"); |
6404 | + |
6405 | + if (print_free_counters_hint) |
6406 | + fprintf(output, |
6407 | +"Some events weren't counted. Try disabling the NMI watchdog:\n" |
6408 | +" echo 0 > /proc/sys/kernel/nmi_watchdog\n" |
6409 | +" perf stat ...\n" |
6410 | +" echo 1 > /proc/sys/kernel/nmi_watchdog\n"); |
6411 | } |
6412 | |
6413 | static void print_counters(struct timespec *ts, int argc, const char **argv) |
6414 | diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c |
6415 | index 21f8a81797a0..4c596ba310cb 100644 |
6416 | --- a/tools/perf/builtin-trace.c |
6417 | +++ b/tools/perf/builtin-trace.c |
6418 | @@ -822,12 +822,21 @@ struct syscall { |
6419 | void **arg_parm; |
6420 | }; |
6421 | |
6422 | -static size_t fprintf_duration(unsigned long t, FILE *fp) |
6423 | +/* |
6424 | + * We need to have this 'calculated' boolean because in some cases we really |
6425 | + * don't know what is the duration of a syscall, for instance, when we start |
6426 | + * a session and some threads are waiting for a syscall to finish, say 'poll', |
6427 | + * in which case all we can do is to print "( ? ) for duration and for the |
6428 | + * start timestamp. |
6429 | + */ |
6430 | +static size_t fprintf_duration(unsigned long t, bool calculated, FILE *fp) |
6431 | { |
6432 | double duration = (double)t / NSEC_PER_MSEC; |
6433 | size_t printed = fprintf(fp, "("); |
6434 | |
6435 | - if (duration >= 1.0) |
6436 | + if (!calculated) |
6437 | + printed += fprintf(fp, " ? "); |
6438 | + else if (duration >= 1.0) |
6439 | printed += color_fprintf(fp, PERF_COLOR_RED, "%6.3f ms", duration); |
6440 | else if (duration >= 0.01) |
6441 | printed += color_fprintf(fp, PERF_COLOR_YELLOW, "%6.3f ms", duration); |
6442 | @@ -1030,13 +1039,27 @@ static bool trace__filter_duration(struct trace *trace, double t) |
6443 | return t < (trace->duration_filter * NSEC_PER_MSEC); |
6444 | } |
6445 | |
6446 | -static size_t trace__fprintf_tstamp(struct trace *trace, u64 tstamp, FILE *fp) |
6447 | +static size_t __trace__fprintf_tstamp(struct trace *trace, u64 tstamp, FILE *fp) |
6448 | { |
6449 | double ts = (double)(tstamp - trace->base_time) / NSEC_PER_MSEC; |
6450 | |
6451 | return fprintf(fp, "%10.3f ", ts); |
6452 | } |
6453 | |
6454 | +/* |
6455 | + * We're handling tstamp=0 as an undefined tstamp, i.e. like when we are |
6456 | + * using ttrace->entry_time for a thread that receives a sys_exit without |
6457 | + * first having received a sys_enter ("poll" issued before tracing session |
6458 | + * starts, lost sys_enter exit due to ring buffer overflow). |
6459 | + */ |
6460 | +static size_t trace__fprintf_tstamp(struct trace *trace, u64 tstamp, FILE *fp) |
6461 | +{ |
6462 | + if (tstamp > 0) |
6463 | + return __trace__fprintf_tstamp(trace, tstamp, fp); |
6464 | + |
6465 | + return fprintf(fp, " ? "); |
6466 | +} |
6467 | + |
6468 | static bool done = false; |
6469 | static bool interrupted = false; |
6470 | |
6471 | @@ -1047,10 +1070,10 @@ static void sig_handler(int sig) |
6472 | } |
6473 | |
6474 | static size_t trace__fprintf_entry_head(struct trace *trace, struct thread *thread, |
6475 | - u64 duration, u64 tstamp, FILE *fp) |
6476 | + u64 duration, bool duration_calculated, u64 tstamp, FILE *fp) |
6477 | { |
6478 | size_t printed = trace__fprintf_tstamp(trace, tstamp, fp); |
6479 | - printed += fprintf_duration(duration, fp); |
6480 | + printed += fprintf_duration(duration, duration_calculated, fp); |
6481 | |
6482 | if (trace->multiple_threads) { |
6483 | if (trace->show_comm) |
6484 | @@ -1452,7 +1475,7 @@ static int trace__printf_interrupted_entry(struct trace *trace, struct perf_samp |
6485 | |
6486 | duration = sample->time - ttrace->entry_time; |
6487 | |
6488 | - printed = trace__fprintf_entry_head(trace, trace->current, duration, ttrace->entry_time, trace->output); |
6489 | + printed = trace__fprintf_entry_head(trace, trace->current, duration, true, ttrace->entry_time, trace->output); |
6490 | printed += fprintf(trace->output, "%-70s) ...\n", ttrace->entry_str); |
6491 | ttrace->entry_pending = false; |
6492 | |
6493 | @@ -1499,7 +1522,7 @@ static int trace__sys_enter(struct trace *trace, struct perf_evsel *evsel, |
6494 | |
6495 | if (sc->is_exit) { |
6496 | if (!(trace->duration_filter || trace->summary_only || trace->min_stack)) { |
6497 | - trace__fprintf_entry_head(trace, thread, 1, ttrace->entry_time, trace->output); |
6498 | + trace__fprintf_entry_head(trace, thread, 0, false, ttrace->entry_time, trace->output); |
6499 | fprintf(trace->output, "%-70s)\n", ttrace->entry_str); |
6500 | } |
6501 | } else { |
6502 | @@ -1547,6 +1570,7 @@ static int trace__sys_exit(struct trace *trace, struct perf_evsel *evsel, |
6503 | { |
6504 | long ret; |
6505 | u64 duration = 0; |
6506 | + bool duration_calculated = false; |
6507 | struct thread *thread; |
6508 | int id = perf_evsel__sc_tp_uint(evsel, id, sample), err = -1, callchain_ret = 0; |
6509 | struct syscall *sc = trace__syscall_info(trace, evsel, id); |
6510 | @@ -1577,6 +1601,7 @@ static int trace__sys_exit(struct trace *trace, struct perf_evsel *evsel, |
6511 | duration = sample->time - ttrace->entry_time; |
6512 | if (trace__filter_duration(trace, duration)) |
6513 | goto out; |
6514 | + duration_calculated = true; |
6515 | } else if (trace->duration_filter) |
6516 | goto out; |
6517 | |
6518 | @@ -1592,7 +1617,7 @@ static int trace__sys_exit(struct trace *trace, struct perf_evsel *evsel, |
6519 | if (trace->summary_only) |
6520 | goto out; |
6521 | |
6522 | - trace__fprintf_entry_head(trace, thread, duration, ttrace->entry_time, trace->output); |
6523 | + trace__fprintf_entry_head(trace, thread, duration, duration_calculated, ttrace->entry_time, trace->output); |
6524 | |
6525 | if (ttrace->entry_pending) { |
6526 | fprintf(trace->output, "%-70s", ttrace->entry_str); |
6527 | @@ -1855,7 +1880,7 @@ static int trace__pgfault(struct trace *trace, |
6528 | thread__find_addr_location(thread, sample->cpumode, MAP__FUNCTION, |
6529 | sample->ip, &al); |
6530 | |
6531 | - trace__fprintf_entry_head(trace, thread, 0, sample->time, trace->output); |
6532 | + trace__fprintf_entry_head(trace, thread, 0, true, sample->time, trace->output); |
6533 | |
6534 | fprintf(trace->output, "%sfault [", |
6535 | evsel->attr.config == PERF_COUNT_SW_PAGE_FAULTS_MAJ ? |
6536 | diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c |
6537 | index 430d039d0079..a38227eb5450 100644 |
6538 | --- a/tools/perf/util/annotate.c |
6539 | +++ b/tools/perf/util/annotate.c |
6540 | @@ -1250,6 +1250,7 @@ static int dso__disassemble_filename(struct dso *dso, char *filename, size_t fil |
6541 | { |
6542 | char linkname[PATH_MAX]; |
6543 | char *build_id_filename; |
6544 | + char *build_id_path = NULL; |
6545 | |
6546 | if (dso->symtab_type == DSO_BINARY_TYPE__KALLSYMS && |
6547 | !dso__is_kcore(dso)) |
6548 | @@ -1265,8 +1266,14 @@ static int dso__disassemble_filename(struct dso *dso, char *filename, size_t fil |
6549 | goto fallback; |
6550 | } |
6551 | |
6552 | + build_id_path = strdup(filename); |
6553 | + if (!build_id_path) |
6554 | + return -1; |
6555 | + |
6556 | + dirname(build_id_path); |
6557 | + |
6558 | if (dso__is_kcore(dso) || |
6559 | - readlink(filename, linkname, sizeof(linkname)) < 0 || |
6560 | + readlink(build_id_path, linkname, sizeof(linkname)) < 0 || |
6561 | strstr(linkname, DSO__NAME_KALLSYMS) || |
6562 | access(filename, R_OK)) { |
6563 | fallback: |
6564 | @@ -1278,6 +1285,7 @@ static int dso__disassemble_filename(struct dso *dso, char *filename, size_t fil |
6565 | __symbol__join_symfs(filename, filename_size, dso->long_name); |
6566 | } |
6567 | |
6568 | + free(build_id_path); |
6569 | return 0; |
6570 | } |
6571 | |
6572 | diff --git a/tools/perf/util/build-id.c b/tools/perf/util/build-id.c |
6573 | index e528c40739cc..993ef2762508 100644 |
6574 | --- a/tools/perf/util/build-id.c |
6575 | +++ b/tools/perf/util/build-id.c |
6576 | @@ -182,13 +182,17 @@ char *build_id_cache__origname(const char *sbuild_id) |
6577 | char buf[PATH_MAX]; |
6578 | char *ret = NULL, *p; |
6579 | size_t offs = 5; /* == strlen("../..") */ |
6580 | + ssize_t len; |
6581 | |
6582 | linkname = build_id_cache__linkname(sbuild_id, NULL, 0); |
6583 | if (!linkname) |
6584 | return NULL; |
6585 | |
6586 | - if (readlink(linkname, buf, PATH_MAX) < 0) |
6587 | + len = readlink(linkname, buf, sizeof(buf) - 1); |
6588 | + if (len <= 0) |
6589 | goto out; |
6590 | + buf[len] = '\0'; |
6591 | + |
6592 | /* The link should be "../..<origpath>/<sbuild_id>" */ |
6593 | p = strrchr(buf, '/'); /* Cut off the "/<sbuild_id>" */ |
6594 | if (p && (p > buf + offs)) { |
6595 | diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c |
6596 | index 8ab0d7da956b..663192395780 100644 |
6597 | --- a/tools/perf/util/event.c |
6598 | +++ b/tools/perf/util/event.c |
6599 | @@ -255,8 +255,8 @@ int perf_event__synthesize_mmap_events(struct perf_tool *tool, |
6600 | if (machine__is_default_guest(machine)) |
6601 | return 0; |
6602 | |
6603 | - snprintf(filename, sizeof(filename), "%s/proc/%d/maps", |
6604 | - machine->root_dir, pid); |
6605 | + snprintf(filename, sizeof(filename), "%s/proc/%d/task/%d/maps", |
6606 | + machine->root_dir, pid, pid); |
6607 | |
6608 | fp = fopen(filename, "r"); |
6609 | if (fp == NULL) { |
6610 | diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c |
6611 | index 8bc271141d9d..bce80f866dd0 100644 |
6612 | --- a/tools/perf/util/evsel.c |
6613 | +++ b/tools/perf/util/evsel.c |
6614 | @@ -1221,7 +1221,7 @@ int perf_evsel__read(struct perf_evsel *evsel, int cpu, int thread, |
6615 | if (FD(evsel, cpu, thread) < 0) |
6616 | return -EINVAL; |
6617 | |
6618 | - if (readn(FD(evsel, cpu, thread), count, sizeof(*count)) < 0) |
6619 | + if (readn(FD(evsel, cpu, thread), count, sizeof(*count)) <= 0) |
6620 | return -errno; |
6621 | |
6622 | return 0; |
6623 | @@ -1239,7 +1239,7 @@ int __perf_evsel__read_on_cpu(struct perf_evsel *evsel, |
6624 | if (evsel->counts == NULL && perf_evsel__alloc_counts(evsel, cpu + 1, thread + 1) < 0) |
6625 | return -ENOMEM; |
6626 | |
6627 | - if (readn(FD(evsel, cpu, thread), &count, nv * sizeof(u64)) < 0) |
6628 | + if (readn(FD(evsel, cpu, thread), &count, nv * sizeof(u64)) <= 0) |
6629 | return -errno; |
6630 | |
6631 | perf_evsel__compute_deltas(evsel, cpu, thread, &count); |
6632 | @@ -2400,11 +2400,17 @@ int perf_evsel__open_strerror(struct perf_evsel *evsel, struct target *target, |
6633 | int err, char *msg, size_t size) |
6634 | { |
6635 | char sbuf[STRERR_BUFSIZE]; |
6636 | + int printed = 0; |
6637 | |
6638 | switch (err) { |
6639 | case EPERM: |
6640 | case EACCES: |
6641 | - return scnprintf(msg, size, |
6642 | + if (err == EPERM) |
6643 | + printed = scnprintf(msg, size, |
6644 | + "No permission to enable %s event.\n\n", |
6645 | + perf_evsel__name(evsel)); |
6646 | + |
6647 | + return scnprintf(msg + printed, size - printed, |
6648 | "You may not have permission to collect %sstats.\n\n" |
6649 | "Consider tweaking /proc/sys/kernel/perf_event_paranoid,\n" |
6650 | "which controls use of the performance events system by\n" |
6651 | diff --git a/tools/perf/util/ordered-events.c b/tools/perf/util/ordered-events.c |
6652 | index fe84df1875aa..e70e935b1841 100644 |
6653 | --- a/tools/perf/util/ordered-events.c |
6654 | +++ b/tools/perf/util/ordered-events.c |
6655 | @@ -79,7 +79,7 @@ static union perf_event *dup_event(struct ordered_events *oe, |
6656 | |
6657 | static void free_dup_event(struct ordered_events *oe, union perf_event *event) |
6658 | { |
6659 | - if (oe->copy_on_queue) { |
6660 | + if (event && oe->copy_on_queue) { |
6661 | oe->cur_alloc_size -= event->header.size; |
6662 | free(event); |
6663 | } |
6664 | @@ -150,6 +150,7 @@ void ordered_events__delete(struct ordered_events *oe, struct ordered_event *eve |
6665 | list_move(&event->list, &oe->cache); |
6666 | oe->nr_events--; |
6667 | free_dup_event(oe, event->event); |
6668 | + event->event = NULL; |
6669 | } |
6670 | |
6671 | int ordered_events__queue(struct ordered_events *oe, union perf_event *event, |
6672 | diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c |
6673 | index 6a6f44dd594b..4d2e22f8bd94 100644 |
6674 | --- a/tools/perf/util/probe-event.c |
6675 | +++ b/tools/perf/util/probe-event.c |
6676 | @@ -3060,7 +3060,7 @@ concat_probe_trace_events(struct probe_trace_event **tevs, int *ntevs, |
6677 | struct probe_trace_event *new_tevs; |
6678 | int ret = 0; |
6679 | |
6680 | - if (ntevs == 0) { |
6681 | + if (*ntevs == 0) { |
6682 | *tevs = *tevs2; |
6683 | *ntevs = ntevs2; |
6684 | *tevs2 = NULL; |
6685 | diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c |
6686 | index 5d61242a6e64..7e0573e55a35 100644 |
6687 | --- a/tools/perf/util/session.c |
6688 | +++ b/tools/perf/util/session.c |
6689 | @@ -139,8 +139,14 @@ struct perf_session *perf_session__new(struct perf_data_file *file, |
6690 | if (perf_session__open(session) < 0) |
6691 | goto out_close; |
6692 | |
6693 | - perf_session__set_id_hdr_size(session); |
6694 | - perf_session__set_comm_exec(session); |
6695 | + /* |
6696 | + * set session attributes that are present in perf.data |
6697 | + * but not in pipe-mode. |
6698 | + */ |
6699 | + if (!file->is_pipe) { |
6700 | + perf_session__set_id_hdr_size(session); |
6701 | + perf_session__set_comm_exec(session); |
6702 | + } |
6703 | } |
6704 | } else { |
6705 | session->machines.host.env = &perf_env; |
6706 | @@ -155,7 +161,11 @@ struct perf_session *perf_session__new(struct perf_data_file *file, |
6707 | pr_warning("Cannot read kernel map\n"); |
6708 | } |
6709 | |
6710 | - if (tool && tool->ordering_requires_timestamps && |
6711 | + /* |
6712 | + * In pipe-mode, evlist is empty until PERF_RECORD_HEADER_ATTR is |
6713 | + * processed, so perf_evlist__sample_id_all is not meaningful here. |
6714 | + */ |
6715 | + if ((!file || !file->is_pipe) && tool && tool->ordering_requires_timestamps && |
6716 | tool->ordered_events && !perf_evlist__sample_id_all(session->evlist)) { |
6717 | dump_printf("WARNING: No sample_id_all support, falling back to unordered processing\n"); |
6718 | tool->ordered_events = false; |
6719 | @@ -1628,6 +1638,7 @@ static int __perf_session__process_pipe_events(struct perf_session *session) |
6720 | buf = malloc(cur_size); |
6721 | if (!buf) |
6722 | return -errno; |
6723 | + ordered_events__set_copy_on_queue(oe, true); |
6724 | more: |
6725 | event = buf; |
6726 | err = readn(fd, event, sizeof(struct perf_event_header)); |
6727 | diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c |
6728 | index 452e15a10dd2..031e64ce7156 100644 |
6729 | --- a/tools/perf/util/sort.c |
6730 | +++ b/tools/perf/util/sort.c |
6731 | @@ -846,6 +846,9 @@ static int hist_entry__mispredict_snprintf(struct hist_entry *he, char *bf, |
6732 | static int64_t |
6733 | sort__cycles_cmp(struct hist_entry *left, struct hist_entry *right) |
6734 | { |
6735 | + if (!left->branch_info || !right->branch_info) |
6736 | + return cmp_null(left->branch_info, right->branch_info); |
6737 | + |
6738 | return left->branch_info->flags.cycles - |
6739 | right->branch_info->flags.cycles; |
6740 | } |
6741 | @@ -853,6 +856,8 @@ sort__cycles_cmp(struct hist_entry *left, struct hist_entry *right) |
6742 | static int hist_entry__cycles_snprintf(struct hist_entry *he, char *bf, |
6743 | size_t size, unsigned int width) |
6744 | { |
6745 | + if (!he->branch_info) |
6746 | + return scnprintf(bf, size, "%-.*s", width, "N/A"); |
6747 | if (he->branch_info->flags.cycles == 0) |
6748 | return repsep_snprintf(bf, size, "%-*s", width, "-"); |
6749 | return repsep_snprintf(bf, size, "%-*hd", width, |
6750 | diff --git a/tools/testing/selftests/firmware/fw_filesystem.sh b/tools/testing/selftests/firmware/fw_filesystem.sh |
6751 | index d8ac9ba67688..17e16fcaa0cc 100755 |
6752 | --- a/tools/testing/selftests/firmware/fw_filesystem.sh |
6753 | +++ b/tools/testing/selftests/firmware/fw_filesystem.sh |
6754 | @@ -28,7 +28,10 @@ test_finish() |
6755 | if [ "$HAS_FW_LOADER_USER_HELPER" = "yes" ]; then |
6756 | echo "$OLD_TIMEOUT" >/sys/class/firmware/timeout |
6757 | fi |
6758 | - echo -n "$OLD_PATH" >/sys/module/firmware_class/parameters/path |
6759 | + if [ "$OLD_FWPATH" = "" ]; then |
6760 | + OLD_FWPATH=" " |
6761 | + fi |
6762 | + echo -n "$OLD_FWPATH" >/sys/module/firmware_class/parameters/path |
6763 | rm -f "$FW" |
6764 | rmdir "$FWPATH" |
6765 | } |
6766 | diff --git a/tools/testing/selftests/rcutorture/bin/configinit.sh b/tools/testing/selftests/rcutorture/bin/configinit.sh |
6767 | index 3f81a1095206..50a6371b2b2e 100755 |
6768 | --- a/tools/testing/selftests/rcutorture/bin/configinit.sh |
6769 | +++ b/tools/testing/selftests/rcutorture/bin/configinit.sh |
6770 | @@ -51,7 +51,7 @@ then |
6771 | mkdir $builddir |
6772 | fi |
6773 | else |
6774 | - echo Bad build directory: \"$builddir\" |
6775 | + echo Bad build directory: \"$buildloc\" |
6776 | exit 2 |
6777 | fi |
6778 | fi |
6779 | diff --git a/tools/testing/selftests/x86/entry_from_vm86.c b/tools/testing/selftests/x86/entry_from_vm86.c |
6780 | index d075ea0e5ca1..ade443a88421 100644 |
6781 | --- a/tools/testing/selftests/x86/entry_from_vm86.c |
6782 | +++ b/tools/testing/selftests/x86/entry_from_vm86.c |
6783 | @@ -95,6 +95,31 @@ asm ( |
6784 | "int3\n\t" |
6785 | "vmcode_int80:\n\t" |
6786 | "int $0x80\n\t" |
6787 | + "vmcode_popf_hlt:\n\t" |
6788 | + "push %ax\n\t" |
6789 | + "popf\n\t" |
6790 | + "hlt\n\t" |
6791 | + "vmcode_umip:\n\t" |
6792 | + /* addressing via displacements */ |
6793 | + "smsw (2052)\n\t" |
6794 | + "sidt (2054)\n\t" |
6795 | + "sgdt (2060)\n\t" |
6796 | + /* addressing via registers */ |
6797 | + "mov $2066, %bx\n\t" |
6798 | + "smsw (%bx)\n\t" |
6799 | + "mov $2068, %bx\n\t" |
6800 | + "sidt (%bx)\n\t" |
6801 | + "mov $2074, %bx\n\t" |
6802 | + "sgdt (%bx)\n\t" |
6803 | + /* register operands, only for smsw */ |
6804 | + "smsw %ax\n\t" |
6805 | + "mov %ax, (2080)\n\t" |
6806 | + "int3\n\t" |
6807 | + "vmcode_umip_str:\n\t" |
6808 | + "str %eax\n\t" |
6809 | + "vmcode_umip_sldt:\n\t" |
6810 | + "sldt %eax\n\t" |
6811 | + "int3\n\t" |
6812 | ".size vmcode, . - vmcode\n\t" |
6813 | "end_vmcode:\n\t" |
6814 | ".code32\n\t" |
6815 | @@ -103,7 +128,8 @@ asm ( |
6816 | |
6817 | extern unsigned char vmcode[], end_vmcode[]; |
6818 | extern unsigned char vmcode_bound[], vmcode_sysenter[], vmcode_syscall[], |
6819 | - vmcode_sti[], vmcode_int3[], vmcode_int80[]; |
6820 | + vmcode_sti[], vmcode_int3[], vmcode_int80[], vmcode_popf_hlt[], |
6821 | + vmcode_umip[], vmcode_umip_str[], vmcode_umip_sldt[]; |
6822 | |
6823 | /* Returns false if the test was skipped. */ |
6824 | static bool do_test(struct vm86plus_struct *v86, unsigned long eip, |
6825 | @@ -153,13 +179,75 @@ static bool do_test(struct vm86plus_struct *v86, unsigned long eip, |
6826 | (VM86_TYPE(ret) == rettype && VM86_ARG(ret) == retarg)) { |
6827 | printf("[OK]\tReturned correctly\n"); |
6828 | } else { |
6829 | - printf("[FAIL]\tIncorrect return reason\n"); |
6830 | + printf("[FAIL]\tIncorrect return reason (started at eip = 0x%lx, ended at eip = 0x%lx)\n", eip, v86->regs.eip); |
6831 | nerrs++; |
6832 | } |
6833 | |
6834 | return true; |
6835 | } |
6836 | |
6837 | +void do_umip_tests(struct vm86plus_struct *vm86, unsigned char *test_mem) |
6838 | +{ |
6839 | + struct table_desc { |
6840 | + unsigned short limit; |
6841 | + unsigned long base; |
6842 | + } __attribute__((packed)); |
6843 | + |
6844 | + /* Initialize variables with arbitrary values */ |
6845 | + struct table_desc gdt1 = { .base = 0x3c3c3c3c, .limit = 0x9999 }; |
6846 | + struct table_desc gdt2 = { .base = 0x1a1a1a1a, .limit = 0xaeae }; |
6847 | + struct table_desc idt1 = { .base = 0x7b7b7b7b, .limit = 0xf1f1 }; |
6848 | + struct table_desc idt2 = { .base = 0x89898989, .limit = 0x1313 }; |
6849 | + unsigned short msw1 = 0x1414, msw2 = 0x2525, msw3 = 3737; |
6850 | + |
6851 | + /* UMIP -- exit with INT3 unless kernel emulation did not trap #GP */ |
6852 | + do_test(vm86, vmcode_umip - vmcode, VM86_TRAP, 3, "UMIP tests"); |
6853 | + |
6854 | + /* Results from displacement-only addressing */ |
6855 | + msw1 = *(unsigned short *)(test_mem + 2052); |
6856 | + memcpy(&idt1, test_mem + 2054, sizeof(idt1)); |
6857 | + memcpy(&gdt1, test_mem + 2060, sizeof(gdt1)); |
6858 | + |
6859 | + /* Results from register-indirect addressing */ |
6860 | + msw2 = *(unsigned short *)(test_mem + 2066); |
6861 | + memcpy(&idt2, test_mem + 2068, sizeof(idt2)); |
6862 | + memcpy(&gdt2, test_mem + 2074, sizeof(gdt2)); |
6863 | + |
6864 | + /* Results when using register operands */ |
6865 | + msw3 = *(unsigned short *)(test_mem + 2080); |
6866 | + |
6867 | + printf("[INFO]\tResult from SMSW:[0x%04x]\n", msw1); |
6868 | + printf("[INFO]\tResult from SIDT: limit[0x%04x]base[0x%08lx]\n", |
6869 | + idt1.limit, idt1.base); |
6870 | + printf("[INFO]\tResult from SGDT: limit[0x%04x]base[0x%08lx]\n", |
6871 | + gdt1.limit, gdt1.base); |
6872 | + |
6873 | + if (msw1 != msw2 || msw1 != msw3) |
6874 | + printf("[FAIL]\tAll the results of SMSW should be the same.\n"); |
6875 | + else |
6876 | + printf("[PASS]\tAll the results from SMSW are identical.\n"); |
6877 | + |
6878 | + if (memcmp(&gdt1, &gdt2, sizeof(gdt1))) |
6879 | + printf("[FAIL]\tAll the results of SGDT should be the same.\n"); |
6880 | + else |
6881 | + printf("[PASS]\tAll the results from SGDT are identical.\n"); |
6882 | + |
6883 | + if (memcmp(&idt1, &idt2, sizeof(idt1))) |
6884 | + printf("[FAIL]\tAll the results of SIDT should be the same.\n"); |
6885 | + else |
6886 | + printf("[PASS]\tAll the results from SIDT are identical.\n"); |
6887 | + |
6888 | + sethandler(SIGILL, sighandler, 0); |
6889 | + do_test(vm86, vmcode_umip_str - vmcode, VM86_SIGNAL, 0, |
6890 | + "STR instruction"); |
6891 | + clearhandler(SIGILL); |
6892 | + |
6893 | + sethandler(SIGILL, sighandler, 0); |
6894 | + do_test(vm86, vmcode_umip_sldt - vmcode, VM86_SIGNAL, 0, |
6895 | + "SLDT instruction"); |
6896 | + clearhandler(SIGILL); |
6897 | +} |
6898 | + |
6899 | int main(void) |
6900 | { |
6901 | struct vm86plus_struct v86; |
6902 | @@ -180,6 +268,9 @@ int main(void) |
6903 | v86.regs.ds = load_addr / 16; |
6904 | v86.regs.es = load_addr / 16; |
6905 | |
6906 | + /* Use the end of the page as our stack. */ |
6907 | + v86.regs.esp = 4096; |
6908 | + |
6909 | assert((v86.regs.cs & 3) == 0); /* Looks like RPL = 0 */ |
6910 | |
6911 | /* #BR -- should deliver SIG??? */ |
6912 | @@ -211,6 +302,23 @@ int main(void) |
6913 | v86.regs.eflags &= ~X86_EFLAGS_IF; |
6914 | do_test(&v86, vmcode_sti - vmcode, VM86_STI, 0, "STI with VIP set"); |
6915 | |
6916 | + /* POPF with VIP set but IF clear: should not trap */ |
6917 | + v86.regs.eflags = X86_EFLAGS_VIP; |
6918 | + v86.regs.eax = 0; |
6919 | + do_test(&v86, vmcode_popf_hlt - vmcode, VM86_UNKNOWN, 0, "POPF with VIP set and IF clear"); |
6920 | + |
6921 | + /* POPF with VIP set and IF set: should trap */ |
6922 | + v86.regs.eflags = X86_EFLAGS_VIP; |
6923 | + v86.regs.eax = X86_EFLAGS_IF; |
6924 | + do_test(&v86, vmcode_popf_hlt - vmcode, VM86_STI, 0, "POPF with VIP and IF set"); |
6925 | + |
6926 | + /* POPF with VIP clear and IF set: should not trap */ |
6927 | + v86.regs.eflags = 0; |
6928 | + v86.regs.eax = X86_EFLAGS_IF; |
6929 | + do_test(&v86, vmcode_popf_hlt - vmcode, VM86_UNKNOWN, 0, "POPF with VIP clear and IF set"); |
6930 | + |
6931 | + v86.regs.eflags = 0; |
6932 | + |
6933 | /* INT3 -- should cause #BP */ |
6934 | do_test(&v86, vmcode_int3 - vmcode, VM86_TRAP, 3, "INT3"); |
6935 | |
6936 | @@ -218,6 +326,9 @@ int main(void) |
6937 | v86.regs.eax = (unsigned int)-1; |
6938 | do_test(&v86, vmcode_int80 - vmcode, VM86_INTx, 0x80, "int80"); |
6939 | |
6940 | + /* UMIP -- should exit with INTx 0x80 unless UMIP was not disabled */ |
6941 | + do_umip_tests(&v86, addr); |
6942 | + |
6943 | /* Execute a null pointer */ |
6944 | v86.regs.cs = 0; |
6945 | v86.regs.ss = 0; |
6946 | @@ -231,7 +342,7 @@ int main(void) |
6947 | clearhandler(SIGSEGV); |
6948 | |
6949 | /* Make sure nothing explodes if we fork. */ |
6950 | - if (fork() > 0) |
6951 | + if (fork() == 0) |
6952 | return 0; |
6953 | |
6954 | return (nerrs == 0 ? 0 : 1); |
6955 | diff --git a/tools/usb/usbip/src/usbipd.c b/tools/usb/usbip/src/usbipd.c |
6956 | index a0972dea9e6c..193556507957 100644 |
6957 | --- a/tools/usb/usbip/src/usbipd.c |
6958 | +++ b/tools/usb/usbip/src/usbipd.c |
6959 | @@ -463,7 +463,7 @@ static void set_signal(void) |
6960 | sigaction(SIGTERM, &act, NULL); |
6961 | sigaction(SIGINT, &act, NULL); |
6962 | act.sa_handler = SIG_IGN; |
6963 | - sigaction(SIGCLD, &act, NULL); |
6964 | + sigaction(SIGCHLD, &act, NULL); |
6965 | } |
6966 | |
6967 | static const char *pid_file; |