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