1 |
commit: 13568bf792eaa9e12b7f422ba262d44c4fc5d664 |
2 |
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
3 |
AuthorDate: Thu Apr 23 11:55:22 2020 +0000 |
4 |
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Apr 23 11:55:22 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=13568bf7 |
7 |
|
8 |
Linux patch 5.4.35 |
9 |
|
10 |
Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org> |
11 |
|
12 |
0000_README | 4 + |
13 |
1034_linux-5.4.35.patch | 4855 +++++++++++++++++++++++++++++++++++++++++++++++ |
14 |
2 files changed, 4859 insertions(+) |
15 |
|
16 |
diff --git a/0000_README b/0000_README |
17 |
index 88370b8..20358ff 100644 |
18 |
--- a/0000_README |
19 |
+++ b/0000_README |
20 |
@@ -179,6 +179,10 @@ Patch: 1033_linux-5.4.34.patch |
21 |
From: http://www.kernel.org |
22 |
Desc: Linux 5.4.34 |
23 |
|
24 |
+Patch: 1034_linux-5.4.35.patch |
25 |
+From: http://www.kernel.org |
26 |
+Desc: Linux 5.4.35 |
27 |
+ |
28 |
Patch: 1500_XATTR_USER_PREFIX.patch |
29 |
From: https://bugs.gentoo.org/show_bug.cgi?id=470644 |
30 |
Desc: Support for namespace user.pax.* on tmpfs. |
31 |
|
32 |
diff --git a/1034_linux-5.4.35.patch b/1034_linux-5.4.35.patch |
33 |
new file mode 100644 |
34 |
index 0000000..8d3f9ef |
35 |
--- /dev/null |
36 |
+++ b/1034_linux-5.4.35.patch |
37 |
@@ -0,0 +1,4855 @@ |
38 |
+diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt |
39 |
+index b5c933fa971f..94fa4a8de2ca 100644 |
40 |
+--- a/Documentation/admin-guide/kernel-parameters.txt |
41 |
++++ b/Documentation/admin-guide/kernel-parameters.txt |
42 |
+@@ -2741,7 +2741,7 @@ |
43 |
+ <name>,<region-number>[,<base>,<size>,<buswidth>,<altbuswidth>] |
44 |
+ |
45 |
+ mtdparts= [MTD] |
46 |
+- See drivers/mtd/cmdlinepart.c. |
47 |
++ See drivers/mtd/parsers/cmdlinepart.c |
48 |
+ |
49 |
+ multitce=off [PPC] This parameter disables the use of the pSeries |
50 |
+ firmware feature for updating multiple TCE entries |
51 |
+diff --git a/Documentation/devicetree/bindings/pci/nvidia,tegra194-pcie.txt b/Documentation/devicetree/bindings/pci/nvidia,tegra194-pcie.txt |
52 |
+index b739f92da58e..1f90eb39870b 100644 |
53 |
+--- a/Documentation/devicetree/bindings/pci/nvidia,tegra194-pcie.txt |
54 |
++++ b/Documentation/devicetree/bindings/pci/nvidia,tegra194-pcie.txt |
55 |
+@@ -118,7 +118,7 @@ Tegra194: |
56 |
+ -------- |
57 |
+ |
58 |
+ pcie@14180000 { |
59 |
+- compatible = "nvidia,tegra194-pcie", "snps,dw-pcie"; |
60 |
++ compatible = "nvidia,tegra194-pcie"; |
61 |
+ power-domains = <&bpmp TEGRA194_POWER_DOMAIN_PCIEX8B>; |
62 |
+ reg = <0x00 0x14180000 0x0 0x00020000 /* appl registers (128K) */ |
63 |
+ 0x00 0x38000000 0x0 0x00040000 /* configuration space (256K) */ |
64 |
+diff --git a/Makefile b/Makefile |
65 |
+index fdbc51db822a..6055a94aa4ce 100644 |
66 |
+--- a/Makefile |
67 |
++++ b/Makefile |
68 |
+@@ -1,7 +1,7 @@ |
69 |
+ # SPDX-License-Identifier: GPL-2.0 |
70 |
+ VERSION = 5 |
71 |
+ PATCHLEVEL = 4 |
72 |
+-SUBLEVEL = 34 |
73 |
++SUBLEVEL = 35 |
74 |
+ EXTRAVERSION = |
75 |
+ NAME = Kleptomaniac Octopus |
76 |
+ |
77 |
+diff --git a/arch/arm/boot/dts/imx6qdl.dtsi b/arch/arm/boot/dts/imx6qdl.dtsi |
78 |
+index e6b4b8525f98..bc488df31511 100644 |
79 |
+--- a/arch/arm/boot/dts/imx6qdl.dtsi |
80 |
++++ b/arch/arm/boot/dts/imx6qdl.dtsi |
81 |
+@@ -1039,9 +1039,8 @@ |
82 |
+ compatible = "fsl,imx6q-fec"; |
83 |
+ reg = <0x02188000 0x4000>; |
84 |
+ interrupt-names = "int0", "pps"; |
85 |
+- interrupts-extended = |
86 |
+- <&intc 0 118 IRQ_TYPE_LEVEL_HIGH>, |
87 |
+- <&intc 0 119 IRQ_TYPE_LEVEL_HIGH>; |
88 |
++ interrupts = <0 118 IRQ_TYPE_LEVEL_HIGH>, |
89 |
++ <0 119 IRQ_TYPE_LEVEL_HIGH>; |
90 |
+ clocks = <&clks IMX6QDL_CLK_ENET>, |
91 |
+ <&clks IMX6QDL_CLK_ENET>, |
92 |
+ <&clks IMX6QDL_CLK_ENET_REF>; |
93 |
+diff --git a/arch/arm/boot/dts/imx6qp.dtsi b/arch/arm/boot/dts/imx6qp.dtsi |
94 |
+index 5f51f8e5c1fa..d91f92f944c5 100644 |
95 |
+--- a/arch/arm/boot/dts/imx6qp.dtsi |
96 |
++++ b/arch/arm/boot/dts/imx6qp.dtsi |
97 |
+@@ -77,7 +77,6 @@ |
98 |
+ }; |
99 |
+ |
100 |
+ &fec { |
101 |
+- /delete-property/interrupts-extended; |
102 |
+ interrupts = <0 118 IRQ_TYPE_LEVEL_HIGH>, |
103 |
+ <0 119 IRQ_TYPE_LEVEL_HIGH>; |
104 |
+ }; |
105 |
+diff --git a/arch/arm/boot/dts/rk3188-bqedison2qc.dts b/arch/arm/boot/dts/rk3188-bqedison2qc.dts |
106 |
+index ad1afd403052..66a0ff196eb1 100644 |
107 |
+--- a/arch/arm/boot/dts/rk3188-bqedison2qc.dts |
108 |
++++ b/arch/arm/boot/dts/rk3188-bqedison2qc.dts |
109 |
+@@ -58,20 +58,25 @@ |
110 |
+ |
111 |
+ lvds-encoder { |
112 |
+ compatible = "ti,sn75lvds83", "lvds-encoder"; |
113 |
+- #address-cells = <1>; |
114 |
+- #size-cells = <0>; |
115 |
+ |
116 |
+- port@0 { |
117 |
+- reg = <0>; |
118 |
+- lvds_in_vop0: endpoint { |
119 |
+- remote-endpoint = <&vop0_out_lvds>; |
120 |
++ ports { |
121 |
++ #address-cells = <1>; |
122 |
++ #size-cells = <0>; |
123 |
++ |
124 |
++ port@0 { |
125 |
++ reg = <0>; |
126 |
++ |
127 |
++ lvds_in_vop0: endpoint { |
128 |
++ remote-endpoint = <&vop0_out_lvds>; |
129 |
++ }; |
130 |
+ }; |
131 |
+- }; |
132 |
+ |
133 |
+- port@1 { |
134 |
+- reg = <1>; |
135 |
+- lvds_out_panel: endpoint { |
136 |
+- remote-endpoint = <&panel_in_lvds>; |
137 |
++ port@1 { |
138 |
++ reg = <1>; |
139 |
++ |
140 |
++ lvds_out_panel: endpoint { |
141 |
++ remote-endpoint = <&panel_in_lvds>; |
142 |
++ }; |
143 |
+ }; |
144 |
+ }; |
145 |
+ }; |
146 |
+@@ -465,7 +470,7 @@ |
147 |
+ non-removable; |
148 |
+ pinctrl-names = "default"; |
149 |
+ pinctrl-0 = <&sd1_clk>, <&sd1_cmd>, <&sd1_bus4>; |
150 |
+- vmmcq-supply = <&vccio_wl>; |
151 |
++ vqmmc-supply = <&vccio_wl>; |
152 |
+ #address-cells = <1>; |
153 |
+ #size-cells = <0>; |
154 |
+ status = "okay"; |
155 |
+diff --git a/arch/arm/boot/dts/sun8i-a83t.dtsi b/arch/arm/boot/dts/sun8i-a83t.dtsi |
156 |
+index 74bb053cf23c..4e485e45fbc5 100644 |
157 |
+--- a/arch/arm/boot/dts/sun8i-a83t.dtsi |
158 |
++++ b/arch/arm/boot/dts/sun8i-a83t.dtsi |
159 |
+@@ -313,7 +313,7 @@ |
160 |
+ |
161 |
+ display_clocks: clock@1000000 { |
162 |
+ compatible = "allwinner,sun8i-a83t-de2-clk"; |
163 |
+- reg = <0x01000000 0x100000>; |
164 |
++ reg = <0x01000000 0x10000>; |
165 |
+ clocks = <&ccu CLK_BUS_DE>, |
166 |
+ <&ccu CLK_PLL_DE>; |
167 |
+ clock-names = "bus", |
168 |
+diff --git a/arch/arm/boot/dts/sun8i-r40.dtsi b/arch/arm/boot/dts/sun8i-r40.dtsi |
169 |
+index 80f4dc34df34..339402601990 100644 |
170 |
+--- a/arch/arm/boot/dts/sun8i-r40.dtsi |
171 |
++++ b/arch/arm/boot/dts/sun8i-r40.dtsi |
172 |
+@@ -118,7 +118,7 @@ |
173 |
+ display_clocks: clock@1000000 { |
174 |
+ compatible = "allwinner,sun8i-r40-de2-clk", |
175 |
+ "allwinner,sun8i-h3-de2-clk"; |
176 |
+- reg = <0x01000000 0x100000>; |
177 |
++ reg = <0x01000000 0x10000>; |
178 |
+ clocks = <&ccu CLK_BUS_DE>, |
179 |
+ <&ccu CLK_DE>; |
180 |
+ clock-names = "bus", |
181 |
+diff --git a/arch/arm/boot/dts/sun8i-v3s.dtsi b/arch/arm/boot/dts/sun8i-v3s.dtsi |
182 |
+index 23ba56df38f7..2abcba35d27e 100644 |
183 |
+--- a/arch/arm/boot/dts/sun8i-v3s.dtsi |
184 |
++++ b/arch/arm/boot/dts/sun8i-v3s.dtsi |
185 |
+@@ -105,7 +105,7 @@ |
186 |
+ |
187 |
+ display_clocks: clock@1000000 { |
188 |
+ compatible = "allwinner,sun8i-v3s-de2-clk"; |
189 |
+- reg = <0x01000000 0x100000>; |
190 |
++ reg = <0x01000000 0x10000>; |
191 |
+ clocks = <&ccu CLK_BUS_DE>, |
192 |
+ <&ccu CLK_DE>; |
193 |
+ clock-names = "bus", |
194 |
+diff --git a/arch/arm/boot/dts/sunxi-h3-h5.dtsi b/arch/arm/boot/dts/sunxi-h3-h5.dtsi |
195 |
+index 107eeafad20a..b3141c964c3a 100644 |
196 |
+--- a/arch/arm/boot/dts/sunxi-h3-h5.dtsi |
197 |
++++ b/arch/arm/boot/dts/sunxi-h3-h5.dtsi |
198 |
+@@ -113,7 +113,7 @@ |
199 |
+ |
200 |
+ display_clocks: clock@1000000 { |
201 |
+ /* compatible is in per SoC .dtsi file */ |
202 |
+- reg = <0x01000000 0x100000>; |
203 |
++ reg = <0x01000000 0x10000>; |
204 |
+ clocks = <&ccu CLK_BUS_DE>, |
205 |
+ <&ccu CLK_DE>; |
206 |
+ clock-names = "bus", |
207 |
+diff --git a/arch/arm/net/bpf_jit_32.c b/arch/arm/net/bpf_jit_32.c |
208 |
+index 97dc386e3cb8..7216653424fd 100644 |
209 |
+--- a/arch/arm/net/bpf_jit_32.c |
210 |
++++ b/arch/arm/net/bpf_jit_32.c |
211 |
+@@ -929,7 +929,11 @@ static inline void emit_a32_rsh_i64(const s8 dst[], |
212 |
+ rd = arm_bpf_get_reg64(dst, tmp, ctx); |
213 |
+ |
214 |
+ /* Do LSR operation */ |
215 |
+- if (val < 32) { |
216 |
++ if (val == 0) { |
217 |
++ /* An immediate value of 0 encodes a shift amount of 32 |
218 |
++ * for LSR. To shift by 0, don't do anything. |
219 |
++ */ |
220 |
++ } else if (val < 32) { |
221 |
+ emit(ARM_MOV_SI(tmp2[1], rd[1], SRTYPE_LSR, val), ctx); |
222 |
+ emit(ARM_ORR_SI(rd[1], tmp2[1], rd[0], SRTYPE_ASL, 32 - val), ctx); |
223 |
+ emit(ARM_MOV_SI(rd[0], rd[0], SRTYPE_LSR, val), ctx); |
224 |
+@@ -955,7 +959,11 @@ static inline void emit_a32_arsh_i64(const s8 dst[], |
225 |
+ rd = arm_bpf_get_reg64(dst, tmp, ctx); |
226 |
+ |
227 |
+ /* Do ARSH operation */ |
228 |
+- if (val < 32) { |
229 |
++ if (val == 0) { |
230 |
++ /* An immediate value of 0 encodes a shift amount of 32 |
231 |
++ * for ASR. To shift by 0, don't do anything. |
232 |
++ */ |
233 |
++ } else if (val < 32) { |
234 |
+ emit(ARM_MOV_SI(tmp2[1], rd[1], SRTYPE_LSR, val), ctx); |
235 |
+ emit(ARM_ORR_SI(rd[1], tmp2[1], rd[0], SRTYPE_ASL, 32 - val), ctx); |
236 |
+ emit(ARM_MOV_SI(rd[0], rd[0], SRTYPE_ASR, val), ctx); |
237 |
+@@ -992,21 +1000,35 @@ static inline void emit_a32_mul_r64(const s8 dst[], const s8 src[], |
238 |
+ arm_bpf_put_reg32(dst_hi, rd[0], ctx); |
239 |
+ } |
240 |
+ |
241 |
++static bool is_ldst_imm(s16 off, const u8 size) |
242 |
++{ |
243 |
++ s16 off_max = 0; |
244 |
++ |
245 |
++ switch (size) { |
246 |
++ case BPF_B: |
247 |
++ case BPF_W: |
248 |
++ off_max = 0xfff; |
249 |
++ break; |
250 |
++ case BPF_H: |
251 |
++ off_max = 0xff; |
252 |
++ break; |
253 |
++ case BPF_DW: |
254 |
++ /* Need to make sure off+4 does not overflow. */ |
255 |
++ off_max = 0xfff - 4; |
256 |
++ break; |
257 |
++ } |
258 |
++ return -off_max <= off && off <= off_max; |
259 |
++} |
260 |
++ |
261 |
+ /* *(size *)(dst + off) = src */ |
262 |
+ static inline void emit_str_r(const s8 dst, const s8 src[], |
263 |
+- s32 off, struct jit_ctx *ctx, const u8 sz){ |
264 |
++ s16 off, struct jit_ctx *ctx, const u8 sz){ |
265 |
+ const s8 *tmp = bpf2a32[TMP_REG_1]; |
266 |
+- s32 off_max; |
267 |
+ s8 rd; |
268 |
+ |
269 |
+ rd = arm_bpf_get_reg32(dst, tmp[1], ctx); |
270 |
+ |
271 |
+- if (sz == BPF_H) |
272 |
+- off_max = 0xff; |
273 |
+- else |
274 |
+- off_max = 0xfff; |
275 |
+- |
276 |
+- if (off < 0 || off > off_max) { |
277 |
++ if (!is_ldst_imm(off, sz)) { |
278 |
+ emit_a32_mov_i(tmp[0], off, ctx); |
279 |
+ emit(ARM_ADD_R(tmp[0], tmp[0], rd), ctx); |
280 |
+ rd = tmp[0]; |
281 |
+@@ -1035,18 +1057,12 @@ static inline void emit_str_r(const s8 dst, const s8 src[], |
282 |
+ |
283 |
+ /* dst = *(size*)(src + off) */ |
284 |
+ static inline void emit_ldx_r(const s8 dst[], const s8 src, |
285 |
+- s32 off, struct jit_ctx *ctx, const u8 sz){ |
286 |
++ s16 off, struct jit_ctx *ctx, const u8 sz){ |
287 |
+ const s8 *tmp = bpf2a32[TMP_REG_1]; |
288 |
+ const s8 *rd = is_stacked(dst_lo) ? tmp : dst; |
289 |
+ s8 rm = src; |
290 |
+- s32 off_max; |
291 |
+- |
292 |
+- if (sz == BPF_H) |
293 |
+- off_max = 0xff; |
294 |
+- else |
295 |
+- off_max = 0xfff; |
296 |
+ |
297 |
+- if (off < 0 || off > off_max) { |
298 |
++ if (!is_ldst_imm(off, sz)) { |
299 |
+ emit_a32_mov_i(tmp[0], off, ctx); |
300 |
+ emit(ARM_ADD_R(tmp[0], tmp[0], src), ctx); |
301 |
+ rm = tmp[0]; |
302 |
+diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi |
303 |
+index ba41c1b85887..367699c8c902 100644 |
304 |
+--- a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi |
305 |
++++ b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi |
306 |
+@@ -227,7 +227,7 @@ |
307 |
+ |
308 |
+ display_clocks: clock@0 { |
309 |
+ compatible = "allwinner,sun50i-a64-de2-clk"; |
310 |
+- reg = <0x0 0x100000>; |
311 |
++ reg = <0x0 0x10000>; |
312 |
+ clocks = <&ccu CLK_BUS_DE>, |
313 |
+ <&ccu CLK_DE>; |
314 |
+ clock-names = "bus", |
315 |
+diff --git a/arch/arm64/boot/dts/marvell/armada-8040-clearfog-gt-8k.dts b/arch/arm64/boot/dts/marvell/armada-8040-clearfog-gt-8k.dts |
316 |
+index a211a046b2f2..b90d78a5724b 100644 |
317 |
+--- a/arch/arm64/boot/dts/marvell/armada-8040-clearfog-gt-8k.dts |
318 |
++++ b/arch/arm64/boot/dts/marvell/armada-8040-clearfog-gt-8k.dts |
319 |
+@@ -367,6 +367,7 @@ |
320 |
+ pinctrl-0 = <&cp0_copper_eth_phy_reset>; |
321 |
+ reset-gpios = <&cp0_gpio2 11 GPIO_ACTIVE_LOW>; |
322 |
+ reset-assert-us = <10000>; |
323 |
++ reset-deassert-us = <10000>; |
324 |
+ }; |
325 |
+ |
326 |
+ switch0: switch0@4 { |
327 |
+diff --git a/arch/arm64/boot/dts/nvidia/tegra194.dtsi b/arch/arm64/boot/dts/nvidia/tegra194.dtsi |
328 |
+index 3c0cf54f0aab..457b815d57f4 100644 |
329 |
+--- a/arch/arm64/boot/dts/nvidia/tegra194.dtsi |
330 |
++++ b/arch/arm64/boot/dts/nvidia/tegra194.dtsi |
331 |
+@@ -1151,7 +1151,7 @@ |
332 |
+ }; |
333 |
+ |
334 |
+ pcie@14100000 { |
335 |
+- compatible = "nvidia,tegra194-pcie", "snps,dw-pcie"; |
336 |
++ compatible = "nvidia,tegra194-pcie"; |
337 |
+ power-domains = <&bpmp TEGRA194_POWER_DOMAIN_PCIEX1A>; |
338 |
+ reg = <0x00 0x14100000 0x0 0x00020000 /* appl registers (128K) */ |
339 |
+ 0x00 0x30000000 0x0 0x00040000 /* configuration space (256K) */ |
340 |
+@@ -1197,7 +1197,7 @@ |
341 |
+ }; |
342 |
+ |
343 |
+ pcie@14120000 { |
344 |
+- compatible = "nvidia,tegra194-pcie", "snps,dw-pcie"; |
345 |
++ compatible = "nvidia,tegra194-pcie"; |
346 |
+ power-domains = <&bpmp TEGRA194_POWER_DOMAIN_PCIEX1A>; |
347 |
+ reg = <0x00 0x14120000 0x0 0x00020000 /* appl registers (128K) */ |
348 |
+ 0x00 0x32000000 0x0 0x00040000 /* configuration space (256K) */ |
349 |
+@@ -1243,7 +1243,7 @@ |
350 |
+ }; |
351 |
+ |
352 |
+ pcie@14140000 { |
353 |
+- compatible = "nvidia,tegra194-pcie", "snps,dw-pcie"; |
354 |
++ compatible = "nvidia,tegra194-pcie"; |
355 |
+ power-domains = <&bpmp TEGRA194_POWER_DOMAIN_PCIEX1A>; |
356 |
+ reg = <0x00 0x14140000 0x0 0x00020000 /* appl registers (128K) */ |
357 |
+ 0x00 0x34000000 0x0 0x00040000 /* configuration space (256K) */ |
358 |
+@@ -1289,7 +1289,7 @@ |
359 |
+ }; |
360 |
+ |
361 |
+ pcie@14160000 { |
362 |
+- compatible = "nvidia,tegra194-pcie", "snps,dw-pcie"; |
363 |
++ compatible = "nvidia,tegra194-pcie"; |
364 |
+ power-domains = <&bpmp TEGRA194_POWER_DOMAIN_PCIEX4A>; |
365 |
+ reg = <0x00 0x14160000 0x0 0x00020000 /* appl registers (128K) */ |
366 |
+ 0x00 0x36000000 0x0 0x00040000 /* configuration space (256K) */ |
367 |
+@@ -1335,7 +1335,7 @@ |
368 |
+ }; |
369 |
+ |
370 |
+ pcie@14180000 { |
371 |
+- compatible = "nvidia,tegra194-pcie", "snps,dw-pcie"; |
372 |
++ compatible = "nvidia,tegra194-pcie"; |
373 |
+ power-domains = <&bpmp TEGRA194_POWER_DOMAIN_PCIEX8B>; |
374 |
+ reg = <0x00 0x14180000 0x0 0x00020000 /* appl registers (128K) */ |
375 |
+ 0x00 0x38000000 0x0 0x00040000 /* configuration space (256K) */ |
376 |
+@@ -1381,7 +1381,7 @@ |
377 |
+ }; |
378 |
+ |
379 |
+ pcie@141a0000 { |
380 |
+- compatible = "nvidia,tegra194-pcie", "snps,dw-pcie"; |
381 |
++ compatible = "nvidia,tegra194-pcie"; |
382 |
+ power-domains = <&bpmp TEGRA194_POWER_DOMAIN_PCIEX8A>; |
383 |
+ reg = <0x00 0x141a0000 0x0 0x00020000 /* appl registers (128K) */ |
384 |
+ 0x00 0x3a000000 0x0 0x00040000 /* configuration space (256K) */ |
385 |
+@@ -1430,6 +1430,105 @@ |
386 |
+ 0x82000000 0x0 0x40000000 0x1f 0x40000000 0x0 0xc0000000>; /* non-prefetchable memory (3GB) */ |
387 |
+ }; |
388 |
+ |
389 |
++ pcie_ep@14160000 { |
390 |
++ compatible = "nvidia,tegra194-pcie-ep", "snps,dw-pcie-ep"; |
391 |
++ power-domains = <&bpmp TEGRA194_POWER_DOMAIN_PCIEX4A>; |
392 |
++ reg = <0x00 0x14160000 0x0 0x00020000 /* appl registers (128K) */ |
393 |
++ 0x00 0x36040000 0x0 0x00040000 /* iATU_DMA reg space (256K) */ |
394 |
++ 0x00 0x36080000 0x0 0x00040000 /* DBI reg space (256K) */ |
395 |
++ 0x14 0x00000000 0x4 0x00000000>; /* Address Space (16G) */ |
396 |
++ reg-names = "appl", "atu_dma", "dbi", "addr_space"; |
397 |
++ |
398 |
++ status = "disabled"; |
399 |
++ |
400 |
++ num-lanes = <4>; |
401 |
++ num-ib-windows = <2>; |
402 |
++ num-ob-windows = <8>; |
403 |
++ |
404 |
++ clocks = <&bpmp TEGRA194_CLK_PEX0_CORE_4>; |
405 |
++ clock-names = "core"; |
406 |
++ |
407 |
++ resets = <&bpmp TEGRA194_RESET_PEX0_CORE_4_APB>, |
408 |
++ <&bpmp TEGRA194_RESET_PEX0_CORE_4>; |
409 |
++ reset-names = "apb", "core"; |
410 |
++ |
411 |
++ interrupts = <GIC_SPI 51 IRQ_TYPE_LEVEL_HIGH>; /* controller interrupt */ |
412 |
++ interrupt-names = "intr"; |
413 |
++ |
414 |
++ nvidia,bpmp = <&bpmp 4>; |
415 |
++ |
416 |
++ nvidia,aspm-cmrt-us = <60>; |
417 |
++ nvidia,aspm-pwr-on-t-us = <20>; |
418 |
++ nvidia,aspm-l0s-entrance-latency-us = <3>; |
419 |
++ }; |
420 |
++ |
421 |
++ pcie_ep@14180000 { |
422 |
++ compatible = "nvidia,tegra194-pcie-ep", "snps,dw-pcie-ep"; |
423 |
++ power-domains = <&bpmp TEGRA194_POWER_DOMAIN_PCIEX8B>; |
424 |
++ reg = <0x00 0x14180000 0x0 0x00020000 /* appl registers (128K) */ |
425 |
++ 0x00 0x38040000 0x0 0x00040000 /* iATU_DMA reg space (256K) */ |
426 |
++ 0x00 0x38080000 0x0 0x00040000 /* DBI reg space (256K) */ |
427 |
++ 0x18 0x00000000 0x4 0x00000000>; /* Address Space (16G) */ |
428 |
++ reg-names = "appl", "atu_dma", "dbi", "addr_space"; |
429 |
++ |
430 |
++ status = "disabled"; |
431 |
++ |
432 |
++ num-lanes = <8>; |
433 |
++ num-ib-windows = <2>; |
434 |
++ num-ob-windows = <8>; |
435 |
++ |
436 |
++ clocks = <&bpmp TEGRA194_CLK_PEX0_CORE_0>; |
437 |
++ clock-names = "core"; |
438 |
++ |
439 |
++ resets = <&bpmp TEGRA194_RESET_PEX0_CORE_0_APB>, |
440 |
++ <&bpmp TEGRA194_RESET_PEX0_CORE_0>; |
441 |
++ reset-names = "apb", "core"; |
442 |
++ |
443 |
++ interrupts = <GIC_SPI 72 IRQ_TYPE_LEVEL_HIGH>; /* controller interrupt */ |
444 |
++ interrupt-names = "intr"; |
445 |
++ |
446 |
++ nvidia,bpmp = <&bpmp 0>; |
447 |
++ |
448 |
++ nvidia,aspm-cmrt-us = <60>; |
449 |
++ nvidia,aspm-pwr-on-t-us = <20>; |
450 |
++ nvidia,aspm-l0s-entrance-latency-us = <3>; |
451 |
++ }; |
452 |
++ |
453 |
++ pcie_ep@141a0000 { |
454 |
++ compatible = "nvidia,tegra194-pcie-ep", "snps,dw-pcie-ep"; |
455 |
++ power-domains = <&bpmp TEGRA194_POWER_DOMAIN_PCIEX8A>; |
456 |
++ reg = <0x00 0x141a0000 0x0 0x00020000 /* appl registers (128K) */ |
457 |
++ 0x00 0x3a040000 0x0 0x00040000 /* iATU_DMA reg space (256K) */ |
458 |
++ 0x00 0x3a080000 0x0 0x00040000 /* DBI reg space (256K) */ |
459 |
++ 0x1c 0x00000000 0x4 0x00000000>; /* Address Space (16G) */ |
460 |
++ reg-names = "appl", "atu_dma", "dbi", "addr_space"; |
461 |
++ |
462 |
++ status = "disabled"; |
463 |
++ |
464 |
++ num-lanes = <8>; |
465 |
++ num-ib-windows = <2>; |
466 |
++ num-ob-windows = <8>; |
467 |
++ |
468 |
++ pinctrl-names = "default"; |
469 |
++ pinctrl-0 = <&clkreq_c5_bi_dir_state>; |
470 |
++ |
471 |
++ clocks = <&bpmp TEGRA194_CLK_PEX1_CORE_5>; |
472 |
++ clock-names = "core"; |
473 |
++ |
474 |
++ resets = <&bpmp TEGRA194_RESET_PEX1_CORE_5_APB>, |
475 |
++ <&bpmp TEGRA194_RESET_PEX1_CORE_5>; |
476 |
++ reset-names = "apb", "core"; |
477 |
++ |
478 |
++ interrupts = <GIC_SPI 53 IRQ_TYPE_LEVEL_HIGH>; /* controller interrupt */ |
479 |
++ interrupt-names = "intr"; |
480 |
++ |
481 |
++ nvidia,bpmp = <&bpmp 5>; |
482 |
++ |
483 |
++ nvidia,aspm-cmrt-us = <60>; |
484 |
++ nvidia,aspm-pwr-on-t-us = <20>; |
485 |
++ nvidia,aspm-l0s-entrance-latency-us = <3>; |
486 |
++ }; |
487 |
++ |
488 |
+ sysram@40000000 { |
489 |
+ compatible = "nvidia,tegra194-sysram", "mmio-sram"; |
490 |
+ reg = <0x0 0x40000000 0x0 0x50000>; |
491 |
+diff --git a/arch/csky/abiv1/inc/abi/entry.h b/arch/csky/abiv1/inc/abi/entry.h |
492 |
+index f35a9f3315ee..5056ebb902d1 100644 |
493 |
+--- a/arch/csky/abiv1/inc/abi/entry.h |
494 |
++++ b/arch/csky/abiv1/inc/abi/entry.h |
495 |
+@@ -172,10 +172,7 @@ |
496 |
+ addi r6, 0xe |
497 |
+ cpwcr r6, cpcr30 |
498 |
+ |
499 |
+- lsri r6, 28 |
500 |
+- addi r6, 2 |
501 |
+- lsli r6, 28 |
502 |
+- addi r6, 0xe |
503 |
++ movi r6, 0 |
504 |
+ cpwcr r6, cpcr31 |
505 |
+ .endm |
506 |
+ |
507 |
+diff --git a/arch/csky/abiv2/fpu.c b/arch/csky/abiv2/fpu.c |
508 |
+index 86d187d4e5af..5acc5c2e544e 100644 |
509 |
+--- a/arch/csky/abiv2/fpu.c |
510 |
++++ b/arch/csky/abiv2/fpu.c |
511 |
+@@ -10,11 +10,6 @@ |
512 |
+ #define MTCR_DIST 0xC0006420 |
513 |
+ #define MFCR_DIST 0xC0006020 |
514 |
+ |
515 |
+-void __init init_fpu(void) |
516 |
+-{ |
517 |
+- mtcr("cr<1, 2>", 0); |
518 |
+-} |
519 |
+- |
520 |
+ /* |
521 |
+ * fpu_libc_helper() is to help libc to excute: |
522 |
+ * - mfcr %a, cr<1, 2> |
523 |
+diff --git a/arch/csky/abiv2/inc/abi/entry.h b/arch/csky/abiv2/inc/abi/entry.h |
524 |
+index 94a7a58765df..111973c6c713 100644 |
525 |
+--- a/arch/csky/abiv2/inc/abi/entry.h |
526 |
++++ b/arch/csky/abiv2/inc/abi/entry.h |
527 |
+@@ -230,11 +230,8 @@ |
528 |
+ addi r6, 0x1ce |
529 |
+ mtcr r6, cr<30, 15> /* Set MSA0 */ |
530 |
+ |
531 |
+- lsri r6, 28 |
532 |
+- addi r6, 2 |
533 |
+- lsli r6, 28 |
534 |
+- addi r6, 0x1ce |
535 |
+- mtcr r6, cr<31, 15> /* Set MSA1 */ |
536 |
++ movi r6, 0 |
537 |
++ mtcr r6, cr<31, 15> /* Clr MSA1 */ |
538 |
+ |
539 |
+ /* enable MMU */ |
540 |
+ mfcr r6, cr18 |
541 |
+diff --git a/arch/csky/abiv2/inc/abi/fpu.h b/arch/csky/abiv2/inc/abi/fpu.h |
542 |
+index 22ca3cf2794a..09e2700a3693 100644 |
543 |
+--- a/arch/csky/abiv2/inc/abi/fpu.h |
544 |
++++ b/arch/csky/abiv2/inc/abi/fpu.h |
545 |
+@@ -9,7 +9,8 @@ |
546 |
+ |
547 |
+ int fpu_libc_helper(struct pt_regs *regs); |
548 |
+ void fpu_fpe(struct pt_regs *regs); |
549 |
+-void __init init_fpu(void); |
550 |
++ |
551 |
++static inline void init_fpu(void) { mtcr("cr<1, 2>", 0); } |
552 |
+ |
553 |
+ void save_to_user_fp(struct user_fp *user_fp); |
554 |
+ void restore_from_user_fp(struct user_fp *user_fp); |
555 |
+diff --git a/arch/csky/include/asm/processor.h b/arch/csky/include/asm/processor.h |
556 |
+index 21e0bd5293dd..c6bcd7f7c720 100644 |
557 |
+--- a/arch/csky/include/asm/processor.h |
558 |
++++ b/arch/csky/include/asm/processor.h |
559 |
+@@ -43,6 +43,7 @@ extern struct cpuinfo_csky cpu_data[]; |
560 |
+ struct thread_struct { |
561 |
+ unsigned long ksp; /* kernel stack pointer */ |
562 |
+ unsigned long sr; /* saved status register */ |
563 |
++ unsigned long trap_no; /* saved status register */ |
564 |
+ |
565 |
+ /* FPU regs */ |
566 |
+ struct user_fp __aligned(16) user_fp; |
567 |
+diff --git a/arch/csky/kernel/head.S b/arch/csky/kernel/head.S |
568 |
+index 61989f9241c0..17ed9d250480 100644 |
569 |
+--- a/arch/csky/kernel/head.S |
570 |
++++ b/arch/csky/kernel/head.S |
571 |
+@@ -21,6 +21,11 @@ END(_start) |
572 |
+ ENTRY(_start_smp_secondary) |
573 |
+ SETUP_MMU |
574 |
+ |
575 |
++ /* copy msa1 from CPU0 */ |
576 |
++ lrw r6, secondary_msa1 |
577 |
++ ld.w r6, (r6, 0) |
578 |
++ mtcr r6, cr<31, 15> |
579 |
++ |
580 |
+ /* set stack point */ |
581 |
+ lrw r6, secondary_stack |
582 |
+ ld.w r6, (r6, 0) |
583 |
+diff --git a/arch/csky/kernel/setup.c b/arch/csky/kernel/setup.c |
584 |
+index 23ee604aafdb..2c1e253abb74 100644 |
585 |
+--- a/arch/csky/kernel/setup.c |
586 |
++++ b/arch/csky/kernel/setup.c |
587 |
+@@ -24,26 +24,9 @@ struct screen_info screen_info = { |
588 |
+ }; |
589 |
+ #endif |
590 |
+ |
591 |
+-phys_addr_t __init_memblock memblock_end_of_REG0(void) |
592 |
+-{ |
593 |
+- return (memblock.memory.regions[0].base + |
594 |
+- memblock.memory.regions[0].size); |
595 |
+-} |
596 |
+- |
597 |
+-phys_addr_t __init_memblock memblock_start_of_REG1(void) |
598 |
+-{ |
599 |
+- return memblock.memory.regions[1].base; |
600 |
+-} |
601 |
+- |
602 |
+-size_t __init_memblock memblock_size_of_REG1(void) |
603 |
+-{ |
604 |
+- return memblock.memory.regions[1].size; |
605 |
+-} |
606 |
+- |
607 |
+ static void __init csky_memblock_init(void) |
608 |
+ { |
609 |
+ unsigned long zone_size[MAX_NR_ZONES]; |
610 |
+- unsigned long zhole_size[MAX_NR_ZONES]; |
611 |
+ signed long size; |
612 |
+ |
613 |
+ memblock_reserve(__pa(_stext), _end - _stext); |
614 |
+@@ -57,54 +40,36 @@ static void __init csky_memblock_init(void) |
615 |
+ memblock_dump_all(); |
616 |
+ |
617 |
+ memset(zone_size, 0, sizeof(zone_size)); |
618 |
+- memset(zhole_size, 0, sizeof(zhole_size)); |
619 |
+ |
620 |
+ min_low_pfn = PFN_UP(memblock_start_of_DRAM()); |
621 |
+- max_pfn = PFN_DOWN(memblock_end_of_DRAM()); |
622 |
+- |
623 |
+- max_low_pfn = PFN_UP(memblock_end_of_REG0()); |
624 |
+- if (max_low_pfn == 0) |
625 |
+- max_low_pfn = max_pfn; |
626 |
++ max_low_pfn = max_pfn = PFN_DOWN(memblock_end_of_DRAM()); |
627 |
+ |
628 |
+ size = max_pfn - min_low_pfn; |
629 |
+ |
630 |
+- if (memblock.memory.cnt > 1) { |
631 |
+- zone_size[ZONE_NORMAL] = |
632 |
+- PFN_DOWN(memblock_start_of_REG1()) - min_low_pfn; |
633 |
+- zhole_size[ZONE_NORMAL] = |
634 |
+- PFN_DOWN(memblock_start_of_REG1()) - max_low_pfn; |
635 |
++ if (size <= PFN_DOWN(SSEG_SIZE - PHYS_OFFSET_OFFSET)) |
636 |
++ zone_size[ZONE_NORMAL] = size; |
637 |
++ else if (size < PFN_DOWN(LOWMEM_LIMIT - PHYS_OFFSET_OFFSET)) { |
638 |
++ zone_size[ZONE_NORMAL] = |
639 |
++ PFN_DOWN(SSEG_SIZE - PHYS_OFFSET_OFFSET); |
640 |
++ max_low_pfn = min_low_pfn + zone_size[ZONE_NORMAL]; |
641 |
+ } else { |
642 |
+- if (size <= PFN_DOWN(LOWMEM_LIMIT - PHYS_OFFSET_OFFSET)) |
643 |
+- zone_size[ZONE_NORMAL] = max_pfn - min_low_pfn; |
644 |
+- else { |
645 |
+- zone_size[ZONE_NORMAL] = |
646 |
++ zone_size[ZONE_NORMAL] = |
647 |
+ PFN_DOWN(LOWMEM_LIMIT - PHYS_OFFSET_OFFSET); |
648 |
+- max_low_pfn = min_low_pfn + zone_size[ZONE_NORMAL]; |
649 |
+- } |
650 |
++ max_low_pfn = min_low_pfn + zone_size[ZONE_NORMAL]; |
651 |
++ write_mmu_msa1(read_mmu_msa0() + SSEG_SIZE); |
652 |
+ } |
653 |
+ |
654 |
+ #ifdef CONFIG_HIGHMEM |
655 |
+- size = 0; |
656 |
+- if (memblock.memory.cnt > 1) { |
657 |
+- size = PFN_DOWN(memblock_size_of_REG1()); |
658 |
+- highstart_pfn = PFN_DOWN(memblock_start_of_REG1()); |
659 |
+- } else { |
660 |
+- size = max_pfn - min_low_pfn - |
661 |
+- PFN_DOWN(LOWMEM_LIMIT - PHYS_OFFSET_OFFSET); |
662 |
+- highstart_pfn = min_low_pfn + |
663 |
+- PFN_DOWN(LOWMEM_LIMIT - PHYS_OFFSET_OFFSET); |
664 |
+- } |
665 |
+- |
666 |
+- if (size > 0) |
667 |
+- zone_size[ZONE_HIGHMEM] = size; |
668 |
++ zone_size[ZONE_HIGHMEM] = max_pfn - max_low_pfn; |
669 |
+ |
670 |
+- highend_pfn = max_pfn; |
671 |
++ highstart_pfn = max_low_pfn; |
672 |
++ highend_pfn = max_pfn; |
673 |
+ #endif |
674 |
+ memblock_set_current_limit(PFN_PHYS(max_low_pfn)); |
675 |
+ |
676 |
+ dma_contiguous_reserve(0); |
677 |
+ |
678 |
+- free_area_init_node(0, zone_size, min_low_pfn, zhole_size); |
679 |
++ free_area_init_node(0, zone_size, min_low_pfn, NULL); |
680 |
+ } |
681 |
+ |
682 |
+ void __init setup_arch(char **cmdline_p) |
683 |
+diff --git a/arch/csky/kernel/smp.c b/arch/csky/kernel/smp.c |
684 |
+index 0bb0954d5570..b5c5bc3afeb5 100644 |
685 |
+--- a/arch/csky/kernel/smp.c |
686 |
++++ b/arch/csky/kernel/smp.c |
687 |
+@@ -22,6 +22,9 @@ |
688 |
+ #include <asm/sections.h> |
689 |
+ #include <asm/mmu_context.h> |
690 |
+ #include <asm/pgalloc.h> |
691 |
++#ifdef CONFIG_CPU_HAS_FPU |
692 |
++#include <abi/fpu.h> |
693 |
++#endif |
694 |
+ |
695 |
+ struct ipi_data_struct { |
696 |
+ unsigned long bits ____cacheline_aligned; |
697 |
+@@ -156,6 +159,8 @@ volatile unsigned int secondary_hint; |
698 |
+ volatile unsigned int secondary_ccr; |
699 |
+ volatile unsigned int secondary_stack; |
700 |
+ |
701 |
++unsigned long secondary_msa1; |
702 |
++ |
703 |
+ int __cpu_up(unsigned int cpu, struct task_struct *tidle) |
704 |
+ { |
705 |
+ unsigned long mask = 1 << cpu; |
706 |
+@@ -164,6 +169,7 @@ int __cpu_up(unsigned int cpu, struct task_struct *tidle) |
707 |
+ (unsigned int) task_stack_page(tidle) + THREAD_SIZE - 8; |
708 |
+ secondary_hint = mfcr("cr31"); |
709 |
+ secondary_ccr = mfcr("cr18"); |
710 |
++ secondary_msa1 = read_mmu_msa1(); |
711 |
+ |
712 |
+ /* |
713 |
+ * Because other CPUs are in reset status, we must flush data |
714 |
+diff --git a/arch/csky/kernel/traps.c b/arch/csky/kernel/traps.c |
715 |
+index b057480e7463..63715cb90ee9 100644 |
716 |
+--- a/arch/csky/kernel/traps.c |
717 |
++++ b/arch/csky/kernel/traps.c |
718 |
+@@ -115,8 +115,9 @@ asmlinkage void trap_c(struct pt_regs *regs) |
719 |
+ int sig; |
720 |
+ unsigned long vector; |
721 |
+ siginfo_t info; |
722 |
++ struct task_struct *tsk = current; |
723 |
+ |
724 |
+- vector = (mfcr("psr") >> 16) & 0xff; |
725 |
++ vector = (regs->sr >> 16) & 0xff; |
726 |
+ |
727 |
+ switch (vector) { |
728 |
+ case VEC_ZERODIV: |
729 |
+@@ -129,6 +130,7 @@ asmlinkage void trap_c(struct pt_regs *regs) |
730 |
+ sig = SIGTRAP; |
731 |
+ break; |
732 |
+ case VEC_ILLEGAL: |
733 |
++ tsk->thread.trap_no = vector; |
734 |
+ die_if_kernel("Kernel mode ILLEGAL", regs, vector); |
735 |
+ #ifndef CONFIG_CPU_NO_USER_BKPT |
736 |
+ if (*(uint16_t *)instruction_pointer(regs) != USR_BKPT) |
737 |
+@@ -146,16 +148,20 @@ asmlinkage void trap_c(struct pt_regs *regs) |
738 |
+ sig = SIGTRAP; |
739 |
+ break; |
740 |
+ case VEC_ACCESS: |
741 |
++ tsk->thread.trap_no = vector; |
742 |
+ return buserr(regs); |
743 |
+ #ifdef CONFIG_CPU_NEED_SOFTALIGN |
744 |
+ case VEC_ALIGN: |
745 |
++ tsk->thread.trap_no = vector; |
746 |
+ return csky_alignment(regs); |
747 |
+ #endif |
748 |
+ #ifdef CONFIG_CPU_HAS_FPU |
749 |
+ case VEC_FPE: |
750 |
++ tsk->thread.trap_no = vector; |
751 |
+ die_if_kernel("Kernel mode FPE", regs, vector); |
752 |
+ return fpu_fpe(regs); |
753 |
+ case VEC_PRIV: |
754 |
++ tsk->thread.trap_no = vector; |
755 |
+ die_if_kernel("Kernel mode PRIV", regs, vector); |
756 |
+ if (fpu_libc_helper(regs)) |
757 |
+ return; |
758 |
+@@ -164,5 +170,8 @@ asmlinkage void trap_c(struct pt_regs *regs) |
759 |
+ sig = SIGSEGV; |
760 |
+ break; |
761 |
+ } |
762 |
++ |
763 |
++ tsk->thread.trap_no = vector; |
764 |
++ |
765 |
+ send_sig(sig, current, 0); |
766 |
+ } |
767 |
+diff --git a/arch/csky/mm/fault.c b/arch/csky/mm/fault.c |
768 |
+index f76618b630f9..562c7f708749 100644 |
769 |
+--- a/arch/csky/mm/fault.c |
770 |
++++ b/arch/csky/mm/fault.c |
771 |
+@@ -179,11 +179,14 @@ bad_area: |
772 |
+ bad_area_nosemaphore: |
773 |
+ /* User mode accesses just cause a SIGSEGV */ |
774 |
+ if (user_mode(regs)) { |
775 |
++ tsk->thread.trap_no = (regs->sr >> 16) & 0xff; |
776 |
+ force_sig_fault(SIGSEGV, si_code, (void __user *)address); |
777 |
+ return; |
778 |
+ } |
779 |
+ |
780 |
+ no_context: |
781 |
++ tsk->thread.trap_no = (regs->sr >> 16) & 0xff; |
782 |
++ |
783 |
+ /* Are we prepared to handle this kernel fault? */ |
784 |
+ if (fixup_exception(regs)) |
785 |
+ return; |
786 |
+@@ -198,6 +201,8 @@ no_context: |
787 |
+ die_if_kernel("Oops", regs, write); |
788 |
+ |
789 |
+ out_of_memory: |
790 |
++ tsk->thread.trap_no = (regs->sr >> 16) & 0xff; |
791 |
++ |
792 |
+ /* |
793 |
+ * We ran out of memory, call the OOM killer, and return the userspace |
794 |
+ * (which will retry the fault, or kill us if we got oom-killed). |
795 |
+@@ -206,6 +211,8 @@ out_of_memory: |
796 |
+ return; |
797 |
+ |
798 |
+ do_sigbus: |
799 |
++ tsk->thread.trap_no = (regs->sr >> 16) & 0xff; |
800 |
++ |
801 |
+ up_read(&mm->mmap_sem); |
802 |
+ |
803 |
+ /* Kernel mode? Handle exceptions or die */ |
804 |
+diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c |
805 |
+index eba9d4ee4baf..689664cd4e79 100644 |
806 |
+--- a/arch/powerpc/kernel/prom_init.c |
807 |
++++ b/arch/powerpc/kernel/prom_init.c |
808 |
+@@ -1761,6 +1761,9 @@ static void __init prom_rtas_os_term(char *str) |
809 |
+ if (token == 0) |
810 |
+ prom_panic("Could not get token for ibm,os-term\n"); |
811 |
+ os_term_args.token = cpu_to_be32(token); |
812 |
++ os_term_args.nargs = cpu_to_be32(1); |
813 |
++ os_term_args.nret = cpu_to_be32(1); |
814 |
++ os_term_args.args[0] = cpu_to_be32(__pa(str)); |
815 |
+ prom_rtas_hcall((uint64_t)&os_term_args); |
816 |
+ } |
817 |
+ #endif /* CONFIG_PPC_SVM */ |
818 |
+diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c |
819 |
+index 36abbe3c346d..e2183fed947d 100644 |
820 |
+--- a/arch/powerpc/kvm/book3s_hv.c |
821 |
++++ b/arch/powerpc/kvm/book3s_hv.c |
822 |
+@@ -3623,6 +3623,7 @@ int kvmhv_p9_guest_entry(struct kvm_vcpu *vcpu, u64 time_limit, |
823 |
+ if (trap == BOOK3S_INTERRUPT_SYSCALL && !vcpu->arch.nested && |
824 |
+ kvmppc_get_gpr(vcpu, 3) == H_CEDE) { |
825 |
+ kvmppc_nested_cede(vcpu); |
826 |
++ kvmppc_set_gpr(vcpu, 3, 0); |
827 |
+ trap = 0; |
828 |
+ } |
829 |
+ } else { |
830 |
+diff --git a/arch/powerpc/platforms/maple/setup.c b/arch/powerpc/platforms/maple/setup.c |
831 |
+index 9cd6f3e1000b..09a0594350b6 100644 |
832 |
+--- a/arch/powerpc/platforms/maple/setup.c |
833 |
++++ b/arch/powerpc/platforms/maple/setup.c |
834 |
+@@ -294,23 +294,6 @@ static int __init maple_probe(void) |
835 |
+ return 1; |
836 |
+ } |
837 |
+ |
838 |
+-define_machine(maple) { |
839 |
+- .name = "Maple", |
840 |
+- .probe = maple_probe, |
841 |
+- .setup_arch = maple_setup_arch, |
842 |
+- .init_IRQ = maple_init_IRQ, |
843 |
+- .pci_irq_fixup = maple_pci_irq_fixup, |
844 |
+- .pci_get_legacy_ide_irq = maple_pci_get_legacy_ide_irq, |
845 |
+- .restart = maple_restart, |
846 |
+- .halt = maple_halt, |
847 |
+- .get_boot_time = maple_get_boot_time, |
848 |
+- .set_rtc_time = maple_set_rtc_time, |
849 |
+- .get_rtc_time = maple_get_rtc_time, |
850 |
+- .calibrate_decr = generic_calibrate_decr, |
851 |
+- .progress = maple_progress, |
852 |
+- .power_save = power4_idle, |
853 |
+-}; |
854 |
+- |
855 |
+ #ifdef CONFIG_EDAC |
856 |
+ /* |
857 |
+ * Register a platform device for CPC925 memory controller on |
858 |
+@@ -367,3 +350,20 @@ static int __init maple_cpc925_edac_setup(void) |
859 |
+ } |
860 |
+ machine_device_initcall(maple, maple_cpc925_edac_setup); |
861 |
+ #endif |
862 |
++ |
863 |
++define_machine(maple) { |
864 |
++ .name = "Maple", |
865 |
++ .probe = maple_probe, |
866 |
++ .setup_arch = maple_setup_arch, |
867 |
++ .init_IRQ = maple_init_IRQ, |
868 |
++ .pci_irq_fixup = maple_pci_irq_fixup, |
869 |
++ .pci_get_legacy_ide_irq = maple_pci_get_legacy_ide_irq, |
870 |
++ .restart = maple_restart, |
871 |
++ .halt = maple_halt, |
872 |
++ .get_boot_time = maple_get_boot_time, |
873 |
++ .set_rtc_time = maple_set_rtc_time, |
874 |
++ .get_rtc_time = maple_get_rtc_time, |
875 |
++ .calibrate_decr = generic_calibrate_decr, |
876 |
++ .progress = maple_progress, |
877 |
++ .power_save = power4_idle, |
878 |
++}; |
879 |
+diff --git a/arch/s390/kernel/perf_cpum_sf.c b/arch/s390/kernel/perf_cpum_sf.c |
880 |
+index fdb8083e7870..229e1e2f8253 100644 |
881 |
+--- a/arch/s390/kernel/perf_cpum_sf.c |
882 |
++++ b/arch/s390/kernel/perf_cpum_sf.c |
883 |
+@@ -1589,6 +1589,7 @@ static void hw_collect_aux(struct cpu_hw_sf *cpuhw) |
884 |
+ perf_aux_output_end(handle, size); |
885 |
+ num_sdb = aux->sfb.num_sdb; |
886 |
+ |
887 |
++ num_sdb = aux->sfb.num_sdb; |
888 |
+ while (!done) { |
889 |
+ /* Get an output handle */ |
890 |
+ aux = perf_aux_output_begin(handle, cpuhw->event); |
891 |
+diff --git a/arch/s390/kernel/processor.c b/arch/s390/kernel/processor.c |
892 |
+index 6ebc2117c66c..91b9b3f73de6 100644 |
893 |
+--- a/arch/s390/kernel/processor.c |
894 |
++++ b/arch/s390/kernel/processor.c |
895 |
+@@ -165,8 +165,9 @@ static void show_cpu_mhz(struct seq_file *m, unsigned long n) |
896 |
+ static int show_cpuinfo(struct seq_file *m, void *v) |
897 |
+ { |
898 |
+ unsigned long n = (unsigned long) v - 1; |
899 |
++ unsigned long first = cpumask_first(cpu_online_mask); |
900 |
+ |
901 |
+- if (!n) |
902 |
++ if (n == first) |
903 |
+ show_cpu_summary(m, v); |
904 |
+ if (!machine_has_cpu_mhz) |
905 |
+ return 0; |
906 |
+@@ -179,6 +180,8 @@ static inline void *c_update(loff_t *pos) |
907 |
+ { |
908 |
+ if (*pos) |
909 |
+ *pos = cpumask_next(*pos - 1, cpu_online_mask); |
910 |
++ else |
911 |
++ *pos = cpumask_first(cpu_online_mask); |
912 |
+ return *pos < nr_cpu_ids ? (void *)*pos + 1 : NULL; |
913 |
+ } |
914 |
+ |
915 |
+diff --git a/arch/s390/mm/gmap.c b/arch/s390/mm/gmap.c |
916 |
+index 9d9ab77d02dd..364e3a89c096 100644 |
917 |
+--- a/arch/s390/mm/gmap.c |
918 |
++++ b/arch/s390/mm/gmap.c |
919 |
+@@ -1844,6 +1844,7 @@ int gmap_shadow_r3t(struct gmap *sg, unsigned long saddr, unsigned long r3t, |
920 |
+ goto out_free; |
921 |
+ } else if (*table & _REGION_ENTRY_ORIGIN) { |
922 |
+ rc = -EAGAIN; /* Race with shadow */ |
923 |
++ goto out_free; |
924 |
+ } |
925 |
+ crst_table_init(s_r3t, _REGION3_ENTRY_EMPTY); |
926 |
+ /* mark as invalid as long as the parent table is not protected */ |
927 |
+diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c |
928 |
+index 6627d7c30f37..0f5d0a699a49 100644 |
929 |
+--- a/arch/um/drivers/ubd_kern.c |
930 |
++++ b/arch/um/drivers/ubd_kern.c |
931 |
+@@ -1606,7 +1606,9 @@ int io_thread(void *arg) |
932 |
+ written = 0; |
933 |
+ |
934 |
+ do { |
935 |
+- res = os_write_file(kernel_fd, ((char *) io_req_buffer) + written, n); |
936 |
++ res = os_write_file(kernel_fd, |
937 |
++ ((char *) io_req_buffer) + written, |
938 |
++ n - written); |
939 |
+ if (res >= 0) { |
940 |
+ written += res; |
941 |
+ } |
942 |
+diff --git a/arch/um/os-Linux/file.c b/arch/um/os-Linux/file.c |
943 |
+index 5133e3afb96f..3996937e2c0d 100644 |
944 |
+--- a/arch/um/os-Linux/file.c |
945 |
++++ b/arch/um/os-Linux/file.c |
946 |
+@@ -8,6 +8,7 @@ |
947 |
+ #include <errno.h> |
948 |
+ #include <fcntl.h> |
949 |
+ #include <signal.h> |
950 |
++#include <linux/falloc.h> |
951 |
+ #include <sys/ioctl.h> |
952 |
+ #include <sys/mount.h> |
953 |
+ #include <sys/socket.h> |
954 |
+diff --git a/arch/x86/hyperv/hv_init.c b/arch/x86/hyperv/hv_init.c |
955 |
+index 2db3972c0e0f..79583bac9ac4 100644 |
956 |
+--- a/arch/x86/hyperv/hv_init.c |
957 |
++++ b/arch/x86/hyperv/hv_init.c |
958 |
+@@ -19,6 +19,7 @@ |
959 |
+ #include <linux/mm.h> |
960 |
+ #include <linux/hyperv.h> |
961 |
+ #include <linux/slab.h> |
962 |
++#include <linux/kernel.h> |
963 |
+ #include <linux/cpuhotplug.h> |
964 |
+ #include <clocksource/hyperv_timer.h> |
965 |
+ |
966 |
+@@ -354,11 +355,14 @@ void hyperv_cleanup(void) |
967 |
+ } |
968 |
+ EXPORT_SYMBOL_GPL(hyperv_cleanup); |
969 |
+ |
970 |
+-void hyperv_report_panic(struct pt_regs *regs, long err) |
971 |
++void hyperv_report_panic(struct pt_regs *regs, long err, bool in_die) |
972 |
+ { |
973 |
+ static bool panic_reported; |
974 |
+ u64 guest_id; |
975 |
+ |
976 |
++ if (in_die && !panic_on_oops) |
977 |
++ return; |
978 |
++ |
979 |
+ /* |
980 |
+ * We prefer to report panic on 'die' chain as we have proper |
981 |
+ * registers to report, but if we miss it (e.g. on BUG()) we need |
982 |
+diff --git a/arch/x86/kernel/acpi/cstate.c b/arch/x86/kernel/acpi/cstate.c |
983 |
+index caf2edccbad2..49ae4e1ac9cd 100644 |
984 |
+--- a/arch/x86/kernel/acpi/cstate.c |
985 |
++++ b/arch/x86/kernel/acpi/cstate.c |
986 |
+@@ -161,7 +161,8 @@ int acpi_processor_ffh_cstate_probe(unsigned int cpu, |
987 |
+ |
988 |
+ /* Make sure we are running on right CPU */ |
989 |
+ |
990 |
+- retval = work_on_cpu(cpu, acpi_processor_ffh_cstate_probe_cpu, cx); |
991 |
++ retval = call_on_cpu(cpu, acpi_processor_ffh_cstate_probe_cpu, cx, |
992 |
++ false); |
993 |
+ if (retval == 0) { |
994 |
+ /* Use the hint in CST */ |
995 |
+ percpu_entry->states[cx->index].eax = cx->address; |
996 |
+diff --git a/arch/x86/kernel/cpu/mshyperv.c b/arch/x86/kernel/cpu/mshyperv.c |
997 |
+index c656d92cd708..fc8814faae62 100644 |
998 |
+--- a/arch/x86/kernel/cpu/mshyperv.c |
999 |
++++ b/arch/x86/kernel/cpu/mshyperv.c |
1000 |
+@@ -263,6 +263,16 @@ static void __init ms_hyperv_init_platform(void) |
1001 |
+ cpuid_eax(HYPERV_CPUID_NESTED_FEATURES); |
1002 |
+ } |
1003 |
+ |
1004 |
++ /* |
1005 |
++ * Hyper-V expects to get crash register data or kmsg when |
1006 |
++ * crash enlightment is available and system crashes. Set |
1007 |
++ * crash_kexec_post_notifiers to be true to make sure that |
1008 |
++ * calling crash enlightment interface before running kdump |
1009 |
++ * kernel. |
1010 |
++ */ |
1011 |
++ if (ms_hyperv.misc_features & HV_FEATURE_GUEST_CRASH_MSR_AVAILABLE) |
1012 |
++ crash_kexec_post_notifiers = true; |
1013 |
++ |
1014 |
+ #ifdef CONFIG_X86_LOCAL_APIC |
1015 |
+ if (ms_hyperv.features & HV_X64_ACCESS_FREQUENCY_MSRS && |
1016 |
+ ms_hyperv.misc_features & HV_FEATURE_FREQUENCY_MSRS_AVAILABLE) { |
1017 |
+diff --git a/block/bfq-cgroup.c b/block/bfq-cgroup.c |
1018 |
+index 5611769e1569..12b707a4e52f 100644 |
1019 |
+--- a/block/bfq-cgroup.c |
1020 |
++++ b/block/bfq-cgroup.c |
1021 |
+@@ -697,10 +697,7 @@ static struct bfq_group *__bfq_bic_change_cgroup(struct bfq_data *bfqd, |
1022 |
+ |
1023 |
+ if (entity->sched_data != &bfqg->sched_data) { |
1024 |
+ bic_set_bfqq(bic, NULL, 0); |
1025 |
+- bfq_log_bfqq(bfqd, async_bfqq, |
1026 |
+- "bic_change_group: %p %d", |
1027 |
+- async_bfqq, async_bfqq->ref); |
1028 |
+- bfq_put_queue(async_bfqq); |
1029 |
++ bfq_release_process_ref(bfqd, async_bfqq); |
1030 |
+ } |
1031 |
+ } |
1032 |
+ |
1033 |
+@@ -801,39 +798,53 @@ static void bfq_flush_idle_tree(struct bfq_service_tree *st) |
1034 |
+ /** |
1035 |
+ * bfq_reparent_leaf_entity - move leaf entity to the root_group. |
1036 |
+ * @bfqd: the device data structure with the root group. |
1037 |
+- * @entity: the entity to move. |
1038 |
++ * @entity: the entity to move, if entity is a leaf; or the parent entity |
1039 |
++ * of an active leaf entity to move, if entity is not a leaf. |
1040 |
+ */ |
1041 |
+ static void bfq_reparent_leaf_entity(struct bfq_data *bfqd, |
1042 |
+- struct bfq_entity *entity) |
1043 |
++ struct bfq_entity *entity, |
1044 |
++ int ioprio_class) |
1045 |
+ { |
1046 |
+- struct bfq_queue *bfqq = bfq_entity_to_bfqq(entity); |
1047 |
++ struct bfq_queue *bfqq; |
1048 |
++ struct bfq_entity *child_entity = entity; |
1049 |
++ |
1050 |
++ while (child_entity->my_sched_data) { /* leaf not reached yet */ |
1051 |
++ struct bfq_sched_data *child_sd = child_entity->my_sched_data; |
1052 |
++ struct bfq_service_tree *child_st = child_sd->service_tree + |
1053 |
++ ioprio_class; |
1054 |
++ struct rb_root *child_active = &child_st->active; |
1055 |
++ |
1056 |
++ child_entity = bfq_entity_of(rb_first(child_active)); |
1057 |
++ |
1058 |
++ if (!child_entity) |
1059 |
++ child_entity = child_sd->in_service_entity; |
1060 |
++ } |
1061 |
+ |
1062 |
++ bfqq = bfq_entity_to_bfqq(child_entity); |
1063 |
+ bfq_bfqq_move(bfqd, bfqq, bfqd->root_group); |
1064 |
+ } |
1065 |
+ |
1066 |
+ /** |
1067 |
+- * bfq_reparent_active_entities - move to the root group all active |
1068 |
+- * entities. |
1069 |
++ * bfq_reparent_active_queues - move to the root group all active queues. |
1070 |
+ * @bfqd: the device data structure with the root group. |
1071 |
+ * @bfqg: the group to move from. |
1072 |
+- * @st: the service tree with the entities. |
1073 |
++ * @st: the service tree to start the search from. |
1074 |
+ */ |
1075 |
+-static void bfq_reparent_active_entities(struct bfq_data *bfqd, |
1076 |
+- struct bfq_group *bfqg, |
1077 |
+- struct bfq_service_tree *st) |
1078 |
++static void bfq_reparent_active_queues(struct bfq_data *bfqd, |
1079 |
++ struct bfq_group *bfqg, |
1080 |
++ struct bfq_service_tree *st, |
1081 |
++ int ioprio_class) |
1082 |
+ { |
1083 |
+ struct rb_root *active = &st->active; |
1084 |
+- struct bfq_entity *entity = NULL; |
1085 |
+- |
1086 |
+- if (!RB_EMPTY_ROOT(&st->active)) |
1087 |
+- entity = bfq_entity_of(rb_first(active)); |
1088 |
++ struct bfq_entity *entity; |
1089 |
+ |
1090 |
+- for (; entity ; entity = bfq_entity_of(rb_first(active))) |
1091 |
+- bfq_reparent_leaf_entity(bfqd, entity); |
1092 |
++ while ((entity = bfq_entity_of(rb_first(active)))) |
1093 |
++ bfq_reparent_leaf_entity(bfqd, entity, ioprio_class); |
1094 |
+ |
1095 |
+ if (bfqg->sched_data.in_service_entity) |
1096 |
+ bfq_reparent_leaf_entity(bfqd, |
1097 |
+- bfqg->sched_data.in_service_entity); |
1098 |
++ bfqg->sched_data.in_service_entity, |
1099 |
++ ioprio_class); |
1100 |
+ } |
1101 |
+ |
1102 |
+ /** |
1103 |
+@@ -865,13 +876,6 @@ static void bfq_pd_offline(struct blkg_policy_data *pd) |
1104 |
+ for (i = 0; i < BFQ_IOPRIO_CLASSES; i++) { |
1105 |
+ st = bfqg->sched_data.service_tree + i; |
1106 |
+ |
1107 |
+- /* |
1108 |
+- * The idle tree may still contain bfq_queues belonging |
1109 |
+- * to exited task because they never migrated to a different |
1110 |
+- * cgroup from the one being destroyed now. |
1111 |
+- */ |
1112 |
+- bfq_flush_idle_tree(st); |
1113 |
+- |
1114 |
+ /* |
1115 |
+ * It may happen that some queues are still active |
1116 |
+ * (busy) upon group destruction (if the corresponding |
1117 |
+@@ -884,7 +888,20 @@ static void bfq_pd_offline(struct blkg_policy_data *pd) |
1118 |
+ * There is no need to put the sync queues, as the |
1119 |
+ * scheduler has taken no reference. |
1120 |
+ */ |
1121 |
+- bfq_reparent_active_entities(bfqd, bfqg, st); |
1122 |
++ bfq_reparent_active_queues(bfqd, bfqg, st, i); |
1123 |
++ |
1124 |
++ /* |
1125 |
++ * The idle tree may still contain bfq_queues |
1126 |
++ * belonging to exited task because they never |
1127 |
++ * migrated to a different cgroup from the one being |
1128 |
++ * destroyed now. In addition, even |
1129 |
++ * bfq_reparent_active_queues() may happen to add some |
1130 |
++ * entities to the idle tree. It happens if, in some |
1131 |
++ * of the calls to bfq_bfqq_move() performed by |
1132 |
++ * bfq_reparent_active_queues(), the queue to move is |
1133 |
++ * empty and gets expired. |
1134 |
++ */ |
1135 |
++ bfq_flush_idle_tree(st); |
1136 |
+ } |
1137 |
+ |
1138 |
+ __bfq_deactivate_entity(entity, false); |
1139 |
+diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c |
1140 |
+index 5a825f9f1ea0..88497bff1135 100644 |
1141 |
+--- a/block/bfq-iosched.c |
1142 |
++++ b/block/bfq-iosched.c |
1143 |
+@@ -2717,8 +2717,6 @@ static void bfq_bfqq_save_state(struct bfq_queue *bfqq) |
1144 |
+ } |
1145 |
+ } |
1146 |
+ |
1147 |
+- |
1148 |
+-static |
1149 |
+ void bfq_release_process_ref(struct bfq_data *bfqd, struct bfq_queue *bfqq) |
1150 |
+ { |
1151 |
+ /* |
1152 |
+diff --git a/block/bfq-iosched.h b/block/bfq-iosched.h |
1153 |
+index 1553a4e8f7ad..c0232975075d 100644 |
1154 |
+--- a/block/bfq-iosched.h |
1155 |
++++ b/block/bfq-iosched.h |
1156 |
+@@ -950,6 +950,7 @@ void bfq_bfqq_expire(struct bfq_data *bfqd, struct bfq_queue *bfqq, |
1157 |
+ bool compensate, enum bfqq_expiration reason); |
1158 |
+ void bfq_put_queue(struct bfq_queue *bfqq); |
1159 |
+ void bfq_end_wr_async_queues(struct bfq_data *bfqd, struct bfq_group *bfqg); |
1160 |
++void bfq_release_process_ref(struct bfq_data *bfqd, struct bfq_queue *bfqq); |
1161 |
+ void bfq_schedule_dispatch(struct bfq_data *bfqd); |
1162 |
+ void bfq_put_async_queues(struct bfq_data *bfqd, struct bfq_group *bfqg); |
1163 |
+ |
1164 |
+diff --git a/drivers/acpi/acpica/acnamesp.h b/drivers/acpi/acpica/acnamesp.h |
1165 |
+index 7da1864798a0..ecaa28733dc6 100644 |
1166 |
+--- a/drivers/acpi/acpica/acnamesp.h |
1167 |
++++ b/drivers/acpi/acpica/acnamesp.h |
1168 |
+@@ -256,6 +256,8 @@ u32 |
1169 |
+ acpi_ns_build_normalized_path(struct acpi_namespace_node *node, |
1170 |
+ char *full_path, u32 path_size, u8 no_trailing); |
1171 |
+ |
1172 |
++void acpi_ns_normalize_pathname(char *original_path); |
1173 |
++ |
1174 |
+ char *acpi_ns_get_normalized_pathname(struct acpi_namespace_node *node, |
1175 |
+ u8 no_trailing); |
1176 |
+ |
1177 |
+diff --git a/drivers/acpi/acpica/dbinput.c b/drivers/acpi/acpica/dbinput.c |
1178 |
+index 55a7e10998d8..1ef053585bbb 100644 |
1179 |
+--- a/drivers/acpi/acpica/dbinput.c |
1180 |
++++ b/drivers/acpi/acpica/dbinput.c |
1181 |
+@@ -464,16 +464,14 @@ char *acpi_db_get_next_token(char *string, |
1182 |
+ return (NULL); |
1183 |
+ } |
1184 |
+ |
1185 |
+- /* Remove any spaces at the beginning */ |
1186 |
++ /* Remove any spaces at the beginning, ignore blank lines */ |
1187 |
+ |
1188 |
+- if (*string == ' ') { |
1189 |
+- while (*string && (*string == ' ')) { |
1190 |
+- string++; |
1191 |
+- } |
1192 |
++ while (*string && isspace(*string)) { |
1193 |
++ string++; |
1194 |
++ } |
1195 |
+ |
1196 |
+- if (!(*string)) { |
1197 |
+- return (NULL); |
1198 |
+- } |
1199 |
++ if (!(*string)) { |
1200 |
++ return (NULL); |
1201 |
+ } |
1202 |
+ |
1203 |
+ switch (*string) { |
1204 |
+@@ -551,7 +549,7 @@ char *acpi_db_get_next_token(char *string, |
1205 |
+ |
1206 |
+ /* Find end of token */ |
1207 |
+ |
1208 |
+- while (*string && (*string != ' ')) { |
1209 |
++ while (*string && !isspace(*string)) { |
1210 |
+ string++; |
1211 |
+ } |
1212 |
+ break; |
1213 |
+diff --git a/drivers/acpi/acpica/dswexec.c b/drivers/acpi/acpica/dswexec.c |
1214 |
+index d75aae304595..a68237b97c4c 100644 |
1215 |
+--- a/drivers/acpi/acpica/dswexec.c |
1216 |
++++ b/drivers/acpi/acpica/dswexec.c |
1217 |
+@@ -16,6 +16,9 @@ |
1218 |
+ #include "acinterp.h" |
1219 |
+ #include "acnamesp.h" |
1220 |
+ #include "acdebug.h" |
1221 |
++#ifdef ACPI_EXEC_APP |
1222 |
++#include "aecommon.h" |
1223 |
++#endif |
1224 |
+ |
1225 |
+ #define _COMPONENT ACPI_DISPATCHER |
1226 |
+ ACPI_MODULE_NAME("dswexec") |
1227 |
+@@ -329,6 +332,10 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) |
1228 |
+ u32 op_class; |
1229 |
+ union acpi_parse_object *next_op; |
1230 |
+ union acpi_parse_object *first_arg; |
1231 |
++#ifdef ACPI_EXEC_APP |
1232 |
++ char *namepath; |
1233 |
++ union acpi_operand_object *obj_desc; |
1234 |
++#endif |
1235 |
+ |
1236 |
+ ACPI_FUNCTION_TRACE_PTR(ds_exec_end_op, walk_state); |
1237 |
+ |
1238 |
+@@ -537,6 +544,32 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) |
1239 |
+ |
1240 |
+ status = |
1241 |
+ acpi_ds_eval_buffer_field_operands(walk_state, op); |
1242 |
++ if (ACPI_FAILURE(status)) { |
1243 |
++ break; |
1244 |
++ } |
1245 |
++#ifdef ACPI_EXEC_APP |
1246 |
++ /* |
1247 |
++ * acpi_exec support for namespace initialization file (initialize |
1248 |
++ * buffer_fields in this code.) |
1249 |
++ */ |
1250 |
++ namepath = |
1251 |
++ acpi_ns_get_external_pathname(op->common.node); |
1252 |
++ status = ae_lookup_init_file_entry(namepath, &obj_desc); |
1253 |
++ if (ACPI_SUCCESS(status)) { |
1254 |
++ status = |
1255 |
++ acpi_ex_write_data_to_field(obj_desc, |
1256 |
++ op->common. |
1257 |
++ node->object, |
1258 |
++ NULL); |
1259 |
++ if ACPI_FAILURE |
1260 |
++ (status) { |
1261 |
++ ACPI_EXCEPTION((AE_INFO, status, |
1262 |
++ "While writing to buffer field")); |
1263 |
++ } |
1264 |
++ } |
1265 |
++ ACPI_FREE(namepath); |
1266 |
++ status = AE_OK; |
1267 |
++#endif |
1268 |
+ break; |
1269 |
+ |
1270 |
+ case AML_TYPE_CREATE_OBJECT: |
1271 |
+diff --git a/drivers/acpi/acpica/dswload.c b/drivers/acpi/acpica/dswload.c |
1272 |
+index 4bcf15bf03de..6cf93fae4d07 100644 |
1273 |
+--- a/drivers/acpi/acpica/dswload.c |
1274 |
++++ b/drivers/acpi/acpica/dswload.c |
1275 |
+@@ -14,7 +14,6 @@ |
1276 |
+ #include "acdispat.h" |
1277 |
+ #include "acinterp.h" |
1278 |
+ #include "acnamesp.h" |
1279 |
+- |
1280 |
+ #ifdef ACPI_ASL_COMPILER |
1281 |
+ #include "acdisasm.h" |
1282 |
+ #endif |
1283 |
+@@ -399,7 +398,6 @@ acpi_status acpi_ds_load1_end_op(struct acpi_walk_state *walk_state) |
1284 |
+ union acpi_parse_object *op; |
1285 |
+ acpi_object_type object_type; |
1286 |
+ acpi_status status = AE_OK; |
1287 |
+- |
1288 |
+ #ifdef ACPI_ASL_COMPILER |
1289 |
+ u8 param_count; |
1290 |
+ #endif |
1291 |
+diff --git a/drivers/acpi/acpica/dswload2.c b/drivers/acpi/acpica/dswload2.c |
1292 |
+index 935a8e2623e4..15d92bf15f0b 100644 |
1293 |
+--- a/drivers/acpi/acpica/dswload2.c |
1294 |
++++ b/drivers/acpi/acpica/dswload2.c |
1295 |
+@@ -15,6 +15,9 @@ |
1296 |
+ #include "acinterp.h" |
1297 |
+ #include "acnamesp.h" |
1298 |
+ #include "acevents.h" |
1299 |
++#ifdef ACPI_EXEC_APP |
1300 |
++#include "aecommon.h" |
1301 |
++#endif |
1302 |
+ |
1303 |
+ #define _COMPONENT ACPI_DISPATCHER |
1304 |
+ ACPI_MODULE_NAME("dswload2") |
1305 |
+@@ -373,6 +376,10 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state) |
1306 |
+ struct acpi_namespace_node *new_node; |
1307 |
+ u32 i; |
1308 |
+ u8 region_space; |
1309 |
++#ifdef ACPI_EXEC_APP |
1310 |
++ union acpi_operand_object *obj_desc; |
1311 |
++ char *namepath; |
1312 |
++#endif |
1313 |
+ |
1314 |
+ ACPI_FUNCTION_TRACE(ds_load2_end_op); |
1315 |
+ |
1316 |
+@@ -466,6 +473,11 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state) |
1317 |
+ * be evaluated later during the execution phase |
1318 |
+ */ |
1319 |
+ status = acpi_ds_create_buffer_field(op, walk_state); |
1320 |
++ if (ACPI_FAILURE(status)) { |
1321 |
++ ACPI_EXCEPTION((AE_INFO, status, |
1322 |
++ "CreateBufferField failure")); |
1323 |
++ goto cleanup; |
1324 |
++ } |
1325 |
+ break; |
1326 |
+ |
1327 |
+ case AML_TYPE_NAMED_FIELD: |
1328 |
+@@ -604,6 +616,29 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state) |
1329 |
+ case AML_NAME_OP: |
1330 |
+ |
1331 |
+ status = acpi_ds_create_node(walk_state, node, op); |
1332 |
++ if (ACPI_FAILURE(status)) { |
1333 |
++ goto cleanup; |
1334 |
++ } |
1335 |
++#ifdef ACPI_EXEC_APP |
1336 |
++ /* |
1337 |
++ * acpi_exec support for namespace initialization file (initialize |
1338 |
++ * Name opcodes in this code.) |
1339 |
++ */ |
1340 |
++ namepath = acpi_ns_get_external_pathname(node); |
1341 |
++ status = ae_lookup_init_file_entry(namepath, &obj_desc); |
1342 |
++ if (ACPI_SUCCESS(status)) { |
1343 |
++ |
1344 |
++ /* Detach any existing object, attach new object */ |
1345 |
++ |
1346 |
++ if (node->object) { |
1347 |
++ acpi_ns_detach_object(node); |
1348 |
++ } |
1349 |
++ acpi_ns_attach_object(node, obj_desc, |
1350 |
++ obj_desc->common.type); |
1351 |
++ } |
1352 |
++ ACPI_FREE(namepath); |
1353 |
++ status = AE_OK; |
1354 |
++#endif |
1355 |
+ break; |
1356 |
+ |
1357 |
+ case AML_METHOD_OP: |
1358 |
+diff --git a/drivers/acpi/acpica/nsnames.c b/drivers/acpi/acpica/nsnames.c |
1359 |
+index 370bbc867745..c717fff7d9b5 100644 |
1360 |
+--- a/drivers/acpi/acpica/nsnames.c |
1361 |
++++ b/drivers/acpi/acpica/nsnames.c |
1362 |
+@@ -13,9 +13,6 @@ |
1363 |
+ #define _COMPONENT ACPI_NAMESPACE |
1364 |
+ ACPI_MODULE_NAME("nsnames") |
1365 |
+ |
1366 |
+-/* Local Prototypes */ |
1367 |
+-static void acpi_ns_normalize_pathname(char *original_path); |
1368 |
+- |
1369 |
+ /******************************************************************************* |
1370 |
+ * |
1371 |
+ * FUNCTION: acpi_ns_get_external_pathname |
1372 |
+@@ -30,7 +27,6 @@ static void acpi_ns_normalize_pathname(char *original_path); |
1373 |
+ * for error and debug statements. |
1374 |
+ * |
1375 |
+ ******************************************************************************/ |
1376 |
+- |
1377 |
+ char *acpi_ns_get_external_pathname(struct acpi_namespace_node *node) |
1378 |
+ { |
1379 |
+ char *name_buffer; |
1380 |
+@@ -411,7 +407,7 @@ cleanup: |
1381 |
+ * |
1382 |
+ ******************************************************************************/ |
1383 |
+ |
1384 |
+-static void acpi_ns_normalize_pathname(char *original_path) |
1385 |
++void acpi_ns_normalize_pathname(char *original_path) |
1386 |
+ { |
1387 |
+ char *input_path = original_path; |
1388 |
+ char *new_path_buffer; |
1389 |
+diff --git a/drivers/acpi/acpica/utdelete.c b/drivers/acpi/acpica/utdelete.c |
1390 |
+index eee263cb7beb..c365faf4e6cd 100644 |
1391 |
+--- a/drivers/acpi/acpica/utdelete.c |
1392 |
++++ b/drivers/acpi/acpica/utdelete.c |
1393 |
+@@ -452,13 +452,13 @@ acpi_ut_update_ref_count(union acpi_operand_object *object, u32 action) |
1394 |
+ * |
1395 |
+ * FUNCTION: acpi_ut_update_object_reference |
1396 |
+ * |
1397 |
+- * PARAMETERS: object - Increment ref count for this object |
1398 |
+- * and all sub-objects |
1399 |
++ * PARAMETERS: object - Increment or decrement the ref count for |
1400 |
++ * this object and all sub-objects |
1401 |
+ * action - Either REF_INCREMENT or REF_DECREMENT |
1402 |
+ * |
1403 |
+ * RETURN: Status |
1404 |
+ * |
1405 |
+- * DESCRIPTION: Increment the object reference count |
1406 |
++ * DESCRIPTION: Increment or decrement the object reference count |
1407 |
+ * |
1408 |
+ * Object references are incremented when: |
1409 |
+ * 1) An object is attached to a Node (namespace object) |
1410 |
+@@ -492,7 +492,7 @@ acpi_ut_update_object_reference(union acpi_operand_object *object, u16 action) |
1411 |
+ } |
1412 |
+ |
1413 |
+ /* |
1414 |
+- * All sub-objects must have their reference count incremented |
1415 |
++ * All sub-objects must have their reference count updated |
1416 |
+ * also. Different object types have different subobjects. |
1417 |
+ */ |
1418 |
+ switch (object->common.type) { |
1419 |
+@@ -559,6 +559,7 @@ acpi_ut_update_object_reference(union acpi_operand_object *object, u16 action) |
1420 |
+ break; |
1421 |
+ } |
1422 |
+ } |
1423 |
++ |
1424 |
+ next_object = NULL; |
1425 |
+ break; |
1426 |
+ |
1427 |
+diff --git a/drivers/acpi/processor_throttling.c b/drivers/acpi/processor_throttling.c |
1428 |
+index 532a1ae3595a..a0bd56ece3ff 100644 |
1429 |
+--- a/drivers/acpi/processor_throttling.c |
1430 |
++++ b/drivers/acpi/processor_throttling.c |
1431 |
+@@ -897,13 +897,6 @@ static long __acpi_processor_get_throttling(void *data) |
1432 |
+ return pr->throttling.acpi_processor_get_throttling(pr); |
1433 |
+ } |
1434 |
+ |
1435 |
+-static int call_on_cpu(int cpu, long (*fn)(void *), void *arg, bool direct) |
1436 |
+-{ |
1437 |
+- if (direct || (is_percpu_thread() && cpu == smp_processor_id())) |
1438 |
+- return fn(arg); |
1439 |
+- return work_on_cpu(cpu, fn, arg); |
1440 |
+-} |
1441 |
+- |
1442 |
+ static int acpi_processor_get_throttling(struct acpi_processor *pr) |
1443 |
+ { |
1444 |
+ if (!pr) |
1445 |
+diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c |
1446 |
+index a67315786db4..274beda31c35 100644 |
1447 |
+--- a/drivers/block/rbd.c |
1448 |
++++ b/drivers/block/rbd.c |
1449 |
+@@ -4636,6 +4636,10 @@ static void cancel_tasks_sync(struct rbd_device *rbd_dev) |
1450 |
+ cancel_work_sync(&rbd_dev->unlock_work); |
1451 |
+ } |
1452 |
+ |
1453 |
++/* |
1454 |
++ * header_rwsem must not be held to avoid a deadlock with |
1455 |
++ * rbd_dev_refresh() when flushing notifies. |
1456 |
++ */ |
1457 |
+ static void rbd_unregister_watch(struct rbd_device *rbd_dev) |
1458 |
+ { |
1459 |
+ cancel_tasks_sync(rbd_dev); |
1460 |
+@@ -6929,9 +6933,10 @@ static int rbd_dev_header_name(struct rbd_device *rbd_dev) |
1461 |
+ |
1462 |
+ static void rbd_dev_image_release(struct rbd_device *rbd_dev) |
1463 |
+ { |
1464 |
+- rbd_dev_unprobe(rbd_dev); |
1465 |
+ if (rbd_dev->opts) |
1466 |
+ rbd_unregister_watch(rbd_dev); |
1467 |
++ |
1468 |
++ rbd_dev_unprobe(rbd_dev); |
1469 |
+ rbd_dev->image_format = 0; |
1470 |
+ kfree(rbd_dev->spec->image_id); |
1471 |
+ rbd_dev->spec->image_id = NULL; |
1472 |
+@@ -6942,6 +6947,9 @@ static void rbd_dev_image_release(struct rbd_device *rbd_dev) |
1473 |
+ * device. If this image is the one being mapped (i.e., not a |
1474 |
+ * parent), initiate a watch on its header object before using that |
1475 |
+ * object to get detailed information about the rbd image. |
1476 |
++ * |
1477 |
++ * On success, returns with header_rwsem held for write if called |
1478 |
++ * with @depth == 0. |
1479 |
+ */ |
1480 |
+ static int rbd_dev_image_probe(struct rbd_device *rbd_dev, int depth) |
1481 |
+ { |
1482 |
+@@ -6974,9 +6982,12 @@ static int rbd_dev_image_probe(struct rbd_device *rbd_dev, int depth) |
1483 |
+ } |
1484 |
+ } |
1485 |
+ |
1486 |
++ if (!depth) |
1487 |
++ down_write(&rbd_dev->header_rwsem); |
1488 |
++ |
1489 |
+ ret = rbd_dev_header_info(rbd_dev); |
1490 |
+ if (ret) |
1491 |
+- goto err_out_watch; |
1492 |
++ goto err_out_probe; |
1493 |
+ |
1494 |
+ /* |
1495 |
+ * If this image is the one being mapped, we have pool name and |
1496 |
+@@ -7025,10 +7036,11 @@ static int rbd_dev_image_probe(struct rbd_device *rbd_dev, int depth) |
1497 |
+ return 0; |
1498 |
+ |
1499 |
+ err_out_probe: |
1500 |
+- rbd_dev_unprobe(rbd_dev); |
1501 |
+-err_out_watch: |
1502 |
++ if (!depth) |
1503 |
++ up_write(&rbd_dev->header_rwsem); |
1504 |
+ if (!depth) |
1505 |
+ rbd_unregister_watch(rbd_dev); |
1506 |
++ rbd_dev_unprobe(rbd_dev); |
1507 |
+ err_out_format: |
1508 |
+ rbd_dev->image_format = 0; |
1509 |
+ kfree(rbd_dev->spec->image_id); |
1510 |
+@@ -7085,12 +7097,9 @@ static ssize_t do_rbd_add(struct bus_type *bus, |
1511 |
+ goto err_out_rbd_dev; |
1512 |
+ } |
1513 |
+ |
1514 |
+- down_write(&rbd_dev->header_rwsem); |
1515 |
+ rc = rbd_dev_image_probe(rbd_dev, 0); |
1516 |
+- if (rc < 0) { |
1517 |
+- up_write(&rbd_dev->header_rwsem); |
1518 |
++ if (rc < 0) |
1519 |
+ goto err_out_rbd_dev; |
1520 |
+- } |
1521 |
+ |
1522 |
+ /* If we are mapping a snapshot it must be marked read-only */ |
1523 |
+ if (rbd_dev->spec->snap_id != CEPH_NOSNAP) |
1524 |
+diff --git a/drivers/clk/at91/clk-usb.c b/drivers/clk/at91/clk-usb.c |
1525 |
+index bda92980e015..c0895c993cce 100644 |
1526 |
+--- a/drivers/clk/at91/clk-usb.c |
1527 |
++++ b/drivers/clk/at91/clk-usb.c |
1528 |
+@@ -75,6 +75,9 @@ static int at91sam9x5_clk_usb_determine_rate(struct clk_hw *hw, |
1529 |
+ tmp_parent_rate = req->rate * div; |
1530 |
+ tmp_parent_rate = clk_hw_round_rate(parent, |
1531 |
+ tmp_parent_rate); |
1532 |
++ if (!tmp_parent_rate) |
1533 |
++ continue; |
1534 |
++ |
1535 |
+ tmp_rate = DIV_ROUND_CLOSEST(tmp_parent_rate, div); |
1536 |
+ if (tmp_rate < req->rate) |
1537 |
+ tmp_diff = req->rate - tmp_rate; |
1538 |
+diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c |
1539 |
+index 62d0fc486d3a..80b029713722 100644 |
1540 |
+--- a/drivers/clk/clk.c |
1541 |
++++ b/drivers/clk/clk.c |
1542 |
+@@ -2642,12 +2642,14 @@ static int clk_core_get_phase(struct clk_core *core) |
1543 |
+ { |
1544 |
+ int ret; |
1545 |
+ |
1546 |
+- clk_prepare_lock(); |
1547 |
++ lockdep_assert_held(&prepare_lock); |
1548 |
++ if (!core->ops->get_phase) |
1549 |
++ return 0; |
1550 |
++ |
1551 |
+ /* Always try to update cached phase if possible */ |
1552 |
+- if (core->ops->get_phase) |
1553 |
+- core->phase = core->ops->get_phase(core->hw); |
1554 |
+- ret = core->phase; |
1555 |
+- clk_prepare_unlock(); |
1556 |
++ ret = core->ops->get_phase(core->hw); |
1557 |
++ if (ret >= 0) |
1558 |
++ core->phase = ret; |
1559 |
+ |
1560 |
+ return ret; |
1561 |
+ } |
1562 |
+@@ -2661,10 +2663,16 @@ static int clk_core_get_phase(struct clk_core *core) |
1563 |
+ */ |
1564 |
+ int clk_get_phase(struct clk *clk) |
1565 |
+ { |
1566 |
++ int ret; |
1567 |
++ |
1568 |
+ if (!clk) |
1569 |
+ return 0; |
1570 |
+ |
1571 |
+- return clk_core_get_phase(clk->core); |
1572 |
++ clk_prepare_lock(); |
1573 |
++ ret = clk_core_get_phase(clk->core); |
1574 |
++ clk_prepare_unlock(); |
1575 |
++ |
1576 |
++ return ret; |
1577 |
+ } |
1578 |
+ EXPORT_SYMBOL_GPL(clk_get_phase); |
1579 |
+ |
1580 |
+@@ -2878,13 +2886,21 @@ static struct hlist_head *orphan_list[] = { |
1581 |
+ static void clk_summary_show_one(struct seq_file *s, struct clk_core *c, |
1582 |
+ int level) |
1583 |
+ { |
1584 |
+- seq_printf(s, "%*s%-*s %7d %8d %8d %11lu %10lu %5d %6d\n", |
1585 |
++ int phase; |
1586 |
++ |
1587 |
++ seq_printf(s, "%*s%-*s %7d %8d %8d %11lu %10lu ", |
1588 |
+ level * 3 + 1, "", |
1589 |
+ 30 - level * 3, c->name, |
1590 |
+ c->enable_count, c->prepare_count, c->protect_count, |
1591 |
+- clk_core_get_rate(c), clk_core_get_accuracy(c), |
1592 |
+- clk_core_get_phase(c), |
1593 |
+- clk_core_get_scaled_duty_cycle(c, 100000)); |
1594 |
++ clk_core_get_rate(c), clk_core_get_accuracy(c)); |
1595 |
++ |
1596 |
++ phase = clk_core_get_phase(c); |
1597 |
++ if (phase >= 0) |
1598 |
++ seq_printf(s, "%5d", phase); |
1599 |
++ else |
1600 |
++ seq_puts(s, "-----"); |
1601 |
++ |
1602 |
++ seq_printf(s, " %6d\n", clk_core_get_scaled_duty_cycle(c, 100000)); |
1603 |
+ } |
1604 |
+ |
1605 |
+ static void clk_summary_show_subtree(struct seq_file *s, struct clk_core *c, |
1606 |
+@@ -2921,6 +2937,7 @@ DEFINE_SHOW_ATTRIBUTE(clk_summary); |
1607 |
+ |
1608 |
+ static void clk_dump_one(struct seq_file *s, struct clk_core *c, int level) |
1609 |
+ { |
1610 |
++ int phase; |
1611 |
+ unsigned long min_rate, max_rate; |
1612 |
+ |
1613 |
+ clk_core_get_boundaries(c, &min_rate, &max_rate); |
1614 |
+@@ -2934,7 +2951,9 @@ static void clk_dump_one(struct seq_file *s, struct clk_core *c, int level) |
1615 |
+ seq_printf(s, "\"min_rate\": %lu,", min_rate); |
1616 |
+ seq_printf(s, "\"max_rate\": %lu,", max_rate); |
1617 |
+ seq_printf(s, "\"accuracy\": %lu,", clk_core_get_accuracy(c)); |
1618 |
+- seq_printf(s, "\"phase\": %d,", clk_core_get_phase(c)); |
1619 |
++ phase = clk_core_get_phase(c); |
1620 |
++ if (phase >= 0) |
1621 |
++ seq_printf(s, "\"phase\": %d,", phase); |
1622 |
+ seq_printf(s, "\"duty_cycle\": %u", |
1623 |
+ clk_core_get_scaled_duty_cycle(c, 100000)); |
1624 |
+ } |
1625 |
+@@ -3375,14 +3394,11 @@ static int __clk_core_init(struct clk_core *core) |
1626 |
+ core->accuracy = 0; |
1627 |
+ |
1628 |
+ /* |
1629 |
+- * Set clk's phase. |
1630 |
++ * Set clk's phase by clk_core_get_phase() caching the phase. |
1631 |
+ * Since a phase is by definition relative to its parent, just |
1632 |
+ * query the current clock phase, or just assume it's in phase. |
1633 |
+ */ |
1634 |
+- if (core->ops->get_phase) |
1635 |
+- core->phase = core->ops->get_phase(core->hw); |
1636 |
+- else |
1637 |
+- core->phase = 0; |
1638 |
++ clk_core_get_phase(core); |
1639 |
+ |
1640 |
+ /* |
1641 |
+ * Set clk's duty cycle. |
1642 |
+diff --git a/drivers/clk/tegra/clk-tegra-pmc.c b/drivers/clk/tegra/clk-tegra-pmc.c |
1643 |
+index bec3e008335f..5e044ba1ae36 100644 |
1644 |
+--- a/drivers/clk/tegra/clk-tegra-pmc.c |
1645 |
++++ b/drivers/clk/tegra/clk-tegra-pmc.c |
1646 |
+@@ -49,16 +49,16 @@ struct pmc_clk_init_data { |
1647 |
+ |
1648 |
+ static DEFINE_SPINLOCK(clk_out_lock); |
1649 |
+ |
1650 |
+-static const char *clk_out1_parents[] = { "clk_m", "clk_m_div2", |
1651 |
+- "clk_m_div4", "extern1", |
1652 |
++static const char *clk_out1_parents[] = { "osc", "osc_div2", |
1653 |
++ "osc_div4", "extern1", |
1654 |
+ }; |
1655 |
+ |
1656 |
+-static const char *clk_out2_parents[] = { "clk_m", "clk_m_div2", |
1657 |
+- "clk_m_div4", "extern2", |
1658 |
++static const char *clk_out2_parents[] = { "osc", "osc_div2", |
1659 |
++ "osc_div4", "extern2", |
1660 |
+ }; |
1661 |
+ |
1662 |
+-static const char *clk_out3_parents[] = { "clk_m", "clk_m_div2", |
1663 |
+- "clk_m_div4", "extern3", |
1664 |
++static const char *clk_out3_parents[] = { "osc", "osc_div2", |
1665 |
++ "osc_div4", "extern3", |
1666 |
+ }; |
1667 |
+ |
1668 |
+ static struct pmc_clk_init_data pmc_clks[] = { |
1669 |
+diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device.c b/drivers/gpu/drm/amd/amdkfd/kfd_device.c |
1670 |
+index 0dc1084b5e82..ad9483b9eea3 100644 |
1671 |
+--- a/drivers/gpu/drm/amd/amdkfd/kfd_device.c |
1672 |
++++ b/drivers/gpu/drm/amd/amdkfd/kfd_device.c |
1673 |
+@@ -1112,9 +1112,9 @@ kfd_gtt_out: |
1674 |
+ return 0; |
1675 |
+ |
1676 |
+ kfd_gtt_no_free_chunk: |
1677 |
+- pr_debug("Allocation failed with mem_obj = %p\n", mem_obj); |
1678 |
++ pr_debug("Allocation failed with mem_obj = %p\n", *mem_obj); |
1679 |
+ mutex_unlock(&kfd->gtt_sa_lock); |
1680 |
+- kfree(mem_obj); |
1681 |
++ kfree(*mem_obj); |
1682 |
+ return -ENOMEM; |
1683 |
+ } |
1684 |
+ |
1685 |
+diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c |
1686 |
+index 2cd83849600f..b1beed40e746 100644 |
1687 |
+--- a/drivers/gpu/drm/nouveau/nouveau_drm.c |
1688 |
++++ b/drivers/gpu/drm/nouveau/nouveau_drm.c |
1689 |
+@@ -618,6 +618,64 @@ nouveau_drm_device_fini(struct drm_device *dev) |
1690 |
+ kfree(drm); |
1691 |
+ } |
1692 |
+ |
1693 |
++/* |
1694 |
++ * On some Intel PCIe bridge controllers doing a |
1695 |
++ * D0 -> D3hot -> D3cold -> D0 sequence causes Nvidia GPUs to not reappear. |
1696 |
++ * Skipping the intermediate D3hot step seems to make it work again. This is |
1697 |
++ * probably caused by not meeting the expectation the involved AML code has |
1698 |
++ * when the GPU is put into D3hot state before invoking it. |
1699 |
++ * |
1700 |
++ * This leads to various manifestations of this issue: |
1701 |
++ * - AML code execution to power on the GPU hits an infinite loop (as the |
1702 |
++ * code waits on device memory to change). |
1703 |
++ * - kernel crashes, as all PCI reads return -1, which most code isn't able |
1704 |
++ * to handle well enough. |
1705 |
++ * |
1706 |
++ * In all cases dmesg will contain at least one line like this: |
1707 |
++ * 'nouveau 0000:01:00.0: Refused to change power state, currently in D3' |
1708 |
++ * followed by a lot of nouveau timeouts. |
1709 |
++ * |
1710 |
++ * In the \_SB.PCI0.PEG0.PG00._OFF code deeper down writes bit 0x80 to the not |
1711 |
++ * documented PCI config space register 0x248 of the Intel PCIe bridge |
1712 |
++ * controller (0x1901) in order to change the state of the PCIe link between |
1713 |
++ * the PCIe port and the GPU. There are alternative code paths using other |
1714 |
++ * registers, which seem to work fine (executed pre Windows 8): |
1715 |
++ * - 0xbc bit 0x20 (publicly available documentation claims 'reserved') |
1716 |
++ * - 0xb0 bit 0x10 (link disable) |
1717 |
++ * Changing the conditions inside the firmware by poking into the relevant |
1718 |
++ * addresses does resolve the issue, but it seemed to be ACPI private memory |
1719 |
++ * and not any device accessible memory at all, so there is no portable way of |
1720 |
++ * changing the conditions. |
1721 |
++ * On a XPS 9560 that means bits [0,3] on \CPEX need to be cleared. |
1722 |
++ * |
1723 |
++ * The only systems where this behavior can be seen are hybrid graphics laptops |
1724 |
++ * with a secondary Nvidia Maxwell, Pascal or Turing GPU. It's unclear whether |
1725 |
++ * this issue only occurs in combination with listed Intel PCIe bridge |
1726 |
++ * controllers and the mentioned GPUs or other devices as well. |
1727 |
++ * |
1728 |
++ * documentation on the PCIe bridge controller can be found in the |
1729 |
++ * "7th Generation Intel® Processor Families for H Platforms Datasheet Volume 2" |
1730 |
++ * Section "12 PCI Express* Controller (x16) Registers" |
1731 |
++ */ |
1732 |
++ |
1733 |
++static void quirk_broken_nv_runpm(struct pci_dev *pdev) |
1734 |
++{ |
1735 |
++ struct drm_device *dev = pci_get_drvdata(pdev); |
1736 |
++ struct nouveau_drm *drm = nouveau_drm(dev); |
1737 |
++ struct pci_dev *bridge = pci_upstream_bridge(pdev); |
1738 |
++ |
1739 |
++ if (!bridge || bridge->vendor != PCI_VENDOR_ID_INTEL) |
1740 |
++ return; |
1741 |
++ |
1742 |
++ switch (bridge->device) { |
1743 |
++ case 0x1901: |
1744 |
++ drm->old_pm_cap = pdev->pm_cap; |
1745 |
++ pdev->pm_cap = 0; |
1746 |
++ NV_INFO(drm, "Disabling PCI power management to avoid bug\n"); |
1747 |
++ break; |
1748 |
++ } |
1749 |
++} |
1750 |
++ |
1751 |
+ static int nouveau_drm_probe(struct pci_dev *pdev, |
1752 |
+ const struct pci_device_id *pent) |
1753 |
+ { |
1754 |
+@@ -699,6 +757,7 @@ static int nouveau_drm_probe(struct pci_dev *pdev, |
1755 |
+ if (ret) |
1756 |
+ goto fail_drm_dev_init; |
1757 |
+ |
1758 |
++ quirk_broken_nv_runpm(pdev); |
1759 |
+ return 0; |
1760 |
+ |
1761 |
+ fail_drm_dev_init: |
1762 |
+@@ -736,7 +795,11 @@ static void |
1763 |
+ nouveau_drm_remove(struct pci_dev *pdev) |
1764 |
+ { |
1765 |
+ struct drm_device *dev = pci_get_drvdata(pdev); |
1766 |
++ struct nouveau_drm *drm = nouveau_drm(dev); |
1767 |
+ |
1768 |
++ /* revert our workaround */ |
1769 |
++ if (drm->old_pm_cap) |
1770 |
++ pdev->pm_cap = drm->old_pm_cap; |
1771 |
+ nouveau_drm_device_remove(dev); |
1772 |
+ } |
1773 |
+ |
1774 |
+diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.h b/drivers/gpu/drm/nouveau/nouveau_drv.h |
1775 |
+index 70f34cacc552..8104e3806499 100644 |
1776 |
+--- a/drivers/gpu/drm/nouveau/nouveau_drv.h |
1777 |
++++ b/drivers/gpu/drm/nouveau/nouveau_drv.h |
1778 |
+@@ -138,6 +138,8 @@ struct nouveau_drm { |
1779 |
+ |
1780 |
+ struct list_head clients; |
1781 |
+ |
1782 |
++ u8 old_pm_cap; |
1783 |
++ |
1784 |
+ struct { |
1785 |
+ struct agp_bridge_data *bridge; |
1786 |
+ u32 base; |
1787 |
+diff --git a/drivers/gpu/drm/nouveau/nouveau_svm.c b/drivers/gpu/drm/nouveau/nouveau_svm.c |
1788 |
+index 668d4bd0c118..824654742a60 100644 |
1789 |
+--- a/drivers/gpu/drm/nouveau/nouveau_svm.c |
1790 |
++++ b/drivers/gpu/drm/nouveau/nouveau_svm.c |
1791 |
+@@ -173,6 +173,11 @@ nouveau_svmm_bind(struct drm_device *dev, void *data, |
1792 |
+ mm = get_task_mm(current); |
1793 |
+ down_read(&mm->mmap_sem); |
1794 |
+ |
1795 |
++ if (!cli->svm.svmm) { |
1796 |
++ up_read(&mm->mmap_sem); |
1797 |
++ return -EINVAL; |
1798 |
++ } |
1799 |
++ |
1800 |
+ for (addr = args->va_start, end = args->va_start + size; addr < end;) { |
1801 |
+ struct vm_area_struct *vma; |
1802 |
+ unsigned long next; |
1803 |
+@@ -181,6 +186,7 @@ nouveau_svmm_bind(struct drm_device *dev, void *data, |
1804 |
+ if (!vma) |
1805 |
+ break; |
1806 |
+ |
1807 |
++ addr = max(addr, vma->vm_start); |
1808 |
+ next = min(vma->vm_end, end); |
1809 |
+ /* This is a best effort so we ignore errors */ |
1810 |
+ nouveau_dmem_migrate_vma(cli->drm, vma, addr, next); |
1811 |
+diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.c b/drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.c |
1812 |
+index c578deb5867a..c71606a45d1d 100644 |
1813 |
+--- a/drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.c |
1814 |
++++ b/drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.c |
1815 |
+@@ -1988,8 +1988,34 @@ gf100_gr_init_(struct nvkm_gr *base) |
1816 |
+ { |
1817 |
+ struct gf100_gr *gr = gf100_gr(base); |
1818 |
+ struct nvkm_subdev *subdev = &base->engine.subdev; |
1819 |
++ struct nvkm_device *device = subdev->device; |
1820 |
++ bool reset = device->chipset == 0x137 || device->chipset == 0x138; |
1821 |
+ u32 ret; |
1822 |
+ |
1823 |
++ /* On certain GP107/GP108 boards, we trigger a weird issue where |
1824 |
++ * GR will stop responding to PRI accesses after we've asked the |
1825 |
++ * SEC2 RTOS to boot the GR falcons. This happens with far more |
1826 |
++ * frequency when cold-booting a board (ie. returning from D3). |
1827 |
++ * |
1828 |
++ * The root cause for this is not known and has proven difficult |
1829 |
++ * to isolate, with many avenues being dead-ends. |
1830 |
++ * |
1831 |
++ * A workaround was discovered by Karol, whereby putting GR into |
1832 |
++ * reset for an extended period right before initialisation |
1833 |
++ * prevents the problem from occuring. |
1834 |
++ * |
1835 |
++ * XXX: As RM does not require any such workaround, this is more |
1836 |
++ * of a hack than a true fix. |
1837 |
++ */ |
1838 |
++ reset = nvkm_boolopt(device->cfgopt, "NvGrResetWar", reset); |
1839 |
++ if (reset) { |
1840 |
++ nvkm_mask(device, 0x000200, 0x00001000, 0x00000000); |
1841 |
++ nvkm_rd32(device, 0x000200); |
1842 |
++ msleep(50); |
1843 |
++ nvkm_mask(device, 0x000200, 0x00001000, 0x00001000); |
1844 |
++ nvkm_rd32(device, 0x000200); |
1845 |
++ } |
1846 |
++ |
1847 |
+ nvkm_pmu_pgob(gr->base.engine.subdev.device->pmu, false); |
1848 |
+ |
1849 |
+ ret = nvkm_falcon_get(gr->fecs.falcon, subdev); |
1850 |
+diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c |
1851 |
+index f07803699809..abf165b2f64f 100644 |
1852 |
+--- a/drivers/gpu/drm/ttm/ttm_bo.c |
1853 |
++++ b/drivers/gpu/drm/ttm/ttm_bo.c |
1854 |
+@@ -517,8 +517,10 @@ static void ttm_bo_cleanup_refs_or_queue(struct ttm_buffer_object *bo) |
1855 |
+ |
1856 |
+ dma_resv_unlock(bo->base.resv); |
1857 |
+ } |
1858 |
+- if (bo->base.resv != &bo->base._resv) |
1859 |
++ if (bo->base.resv != &bo->base._resv) { |
1860 |
++ ttm_bo_flush_all_fences(bo); |
1861 |
+ dma_resv_unlock(&bo->base._resv); |
1862 |
++ } |
1863 |
+ |
1864 |
+ error: |
1865 |
+ kref_get(&bo->list_kref); |
1866 |
+diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c |
1867 |
+index 0853b980bcb3..d5f5ba410524 100644 |
1868 |
+--- a/drivers/gpu/drm/vc4/vc4_hdmi.c |
1869 |
++++ b/drivers/gpu/drm/vc4/vc4_hdmi.c |
1870 |
+@@ -681,11 +681,23 @@ static enum drm_mode_status |
1871 |
+ vc4_hdmi_encoder_mode_valid(struct drm_encoder *crtc, |
1872 |
+ const struct drm_display_mode *mode) |
1873 |
+ { |
1874 |
+- /* HSM clock must be 108% of the pixel clock. Additionally, |
1875 |
+- * the AXI clock needs to be at least 25% of pixel clock, but |
1876 |
+- * HSM ends up being the limiting factor. |
1877 |
++ /* |
1878 |
++ * As stated in RPi's vc4 firmware "HDMI state machine (HSM) clock must |
1879 |
++ * be faster than pixel clock, infinitesimally faster, tested in |
1880 |
++ * simulation. Otherwise, exact value is unimportant for HDMI |
1881 |
++ * operation." This conflicts with bcm2835's vc4 documentation, which |
1882 |
++ * states HSM's clock has to be at least 108% of the pixel clock. |
1883 |
++ * |
1884 |
++ * Real life tests reveal that vc4's firmware statement holds up, and |
1885 |
++ * users are able to use pixel clocks closer to HSM's, namely for |
1886 |
++ * 1920x1200@60Hz. So it was decided to have leave a 1% margin between |
1887 |
++ * both clocks. Which, for RPi0-3 implies a maximum pixel clock of |
1888 |
++ * 162MHz. |
1889 |
++ * |
1890 |
++ * Additionally, the AXI clock needs to be at least 25% of |
1891 |
++ * pixel clock, but HSM ends up being the limiting factor. |
1892 |
+ */ |
1893 |
+- if (mode->clock > HSM_CLOCK_FREQ / (1000 * 108 / 100)) |
1894 |
++ if (mode->clock > HSM_CLOCK_FREQ / (1000 * 101 / 100)) |
1895 |
+ return MODE_CLOCK_HIGH; |
1896 |
+ |
1897 |
+ return MODE_OK; |
1898 |
+diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c |
1899 |
+index 8eb167540b4f..c8296d5e74c3 100644 |
1900 |
+--- a/drivers/hv/channel_mgmt.c |
1901 |
++++ b/drivers/hv/channel_mgmt.c |
1902 |
+@@ -839,6 +839,9 @@ void vmbus_initiate_unload(bool crash) |
1903 |
+ { |
1904 |
+ struct vmbus_channel_message_header hdr; |
1905 |
+ |
1906 |
++ if (xchg(&vmbus_connection.conn_state, DISCONNECTED) == DISCONNECTED) |
1907 |
++ return; |
1908 |
++ |
1909 |
+ /* Pre-Win2012R2 hosts don't support reconnect */ |
1910 |
+ if (vmbus_proto_version < VERSION_WIN8_1) |
1911 |
+ return; |
1912 |
+diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c |
1913 |
+index 05ead1735c6e..40f6b73dae94 100644 |
1914 |
+--- a/drivers/hv/vmbus_drv.c |
1915 |
++++ b/drivers/hv/vmbus_drv.c |
1916 |
+@@ -31,6 +31,7 @@ |
1917 |
+ #include <linux/kdebug.h> |
1918 |
+ #include <linux/efi.h> |
1919 |
+ #include <linux/random.h> |
1920 |
++#include <linux/kernel.h> |
1921 |
+ #include <linux/syscore_ops.h> |
1922 |
+ #include <clocksource/hyperv_timer.h> |
1923 |
+ #include "hyperv_vmbus.h" |
1924 |
+@@ -48,14 +49,35 @@ static int hyperv_cpuhp_online; |
1925 |
+ |
1926 |
+ static void *hv_panic_page; |
1927 |
+ |
1928 |
++/* |
1929 |
++ * Boolean to control whether to report panic messages over Hyper-V. |
1930 |
++ * |
1931 |
++ * It can be set via /proc/sys/kernel/hyperv/record_panic_msg |
1932 |
++ */ |
1933 |
++static int sysctl_record_panic_msg = 1; |
1934 |
++ |
1935 |
++static int hyperv_report_reg(void) |
1936 |
++{ |
1937 |
++ return !sysctl_record_panic_msg || !hv_panic_page; |
1938 |
++} |
1939 |
++ |
1940 |
+ static int hyperv_panic_event(struct notifier_block *nb, unsigned long val, |
1941 |
+ void *args) |
1942 |
+ { |
1943 |
+ struct pt_regs *regs; |
1944 |
+ |
1945 |
+- regs = current_pt_regs(); |
1946 |
++ vmbus_initiate_unload(true); |
1947 |
+ |
1948 |
+- hyperv_report_panic(regs, val); |
1949 |
++ /* |
1950 |
++ * Hyper-V should be notified only once about a panic. If we will be |
1951 |
++ * doing hyperv_report_panic_msg() later with kmsg data, don't do |
1952 |
++ * the notification here. |
1953 |
++ */ |
1954 |
++ if (ms_hyperv.misc_features & HV_FEATURE_GUEST_CRASH_MSR_AVAILABLE |
1955 |
++ && hyperv_report_reg()) { |
1956 |
++ regs = current_pt_regs(); |
1957 |
++ hyperv_report_panic(regs, val, false); |
1958 |
++ } |
1959 |
+ return NOTIFY_DONE; |
1960 |
+ } |
1961 |
+ |
1962 |
+@@ -65,7 +87,13 @@ static int hyperv_die_event(struct notifier_block *nb, unsigned long val, |
1963 |
+ struct die_args *die = (struct die_args *)args; |
1964 |
+ struct pt_regs *regs = die->regs; |
1965 |
+ |
1966 |
+- hyperv_report_panic(regs, val); |
1967 |
++ /* |
1968 |
++ * Hyper-V should be notified only once about a panic. If we will be |
1969 |
++ * doing hyperv_report_panic_msg() later with kmsg data, don't do |
1970 |
++ * the notification here. |
1971 |
++ */ |
1972 |
++ if (hyperv_report_reg()) |
1973 |
++ hyperv_report_panic(regs, val, true); |
1974 |
+ return NOTIFY_DONE; |
1975 |
+ } |
1976 |
+ |
1977 |
+@@ -1246,13 +1274,6 @@ static void vmbus_isr(void) |
1978 |
+ add_interrupt_randomness(HYPERVISOR_CALLBACK_VECTOR, 0); |
1979 |
+ } |
1980 |
+ |
1981 |
+-/* |
1982 |
+- * Boolean to control whether to report panic messages over Hyper-V. |
1983 |
+- * |
1984 |
+- * It can be set via /proc/sys/kernel/hyperv/record_panic_msg |
1985 |
+- */ |
1986 |
+-static int sysctl_record_panic_msg = 1; |
1987 |
+- |
1988 |
+ /* |
1989 |
+ * Callback from kmsg_dump. Grab as much as possible from the end of the kmsg |
1990 |
+ * buffer and call into Hyper-V to transfer the data. |
1991 |
+@@ -1380,19 +1401,29 @@ static int vmbus_bus_init(void) |
1992 |
+ hv_panic_page = (void *)get_zeroed_page(GFP_KERNEL); |
1993 |
+ if (hv_panic_page) { |
1994 |
+ ret = kmsg_dump_register(&hv_kmsg_dumper); |
1995 |
+- if (ret) |
1996 |
++ if (ret) { |
1997 |
+ pr_err("Hyper-V: kmsg dump register " |
1998 |
+ "error 0x%x\n", ret); |
1999 |
++ hv_free_hyperv_page( |
2000 |
++ (unsigned long)hv_panic_page); |
2001 |
++ hv_panic_page = NULL; |
2002 |
++ } |
2003 |
+ } else |
2004 |
+ pr_err("Hyper-V: panic message page memory " |
2005 |
+ "allocation failed"); |
2006 |
+ } |
2007 |
+ |
2008 |
+ register_die_notifier(&hyperv_die_block); |
2009 |
+- atomic_notifier_chain_register(&panic_notifier_list, |
2010 |
+- &hyperv_panic_block); |
2011 |
+ } |
2012 |
+ |
2013 |
++ /* |
2014 |
++ * Always register the panic notifier because we need to unload |
2015 |
++ * the VMbus channel connection to prevent any VMbus |
2016 |
++ * activity after the VM panics. |
2017 |
++ */ |
2018 |
++ atomic_notifier_chain_register(&panic_notifier_list, |
2019 |
++ &hyperv_panic_block); |
2020 |
++ |
2021 |
+ vmbus_request_offers(); |
2022 |
+ |
2023 |
+ return 0; |
2024 |
+@@ -1406,7 +1437,6 @@ err_alloc: |
2025 |
+ hv_remove_vmbus_irq(); |
2026 |
+ |
2027 |
+ bus_unregister(&hv_bus); |
2028 |
+- free_page((unsigned long)hv_panic_page); |
2029 |
+ unregister_sysctl_table(hv_ctl_table_hdr); |
2030 |
+ hv_ctl_table_hdr = NULL; |
2031 |
+ return ret; |
2032 |
+@@ -2202,8 +2232,6 @@ static int vmbus_bus_suspend(struct device *dev) |
2033 |
+ |
2034 |
+ vmbus_initiate_unload(false); |
2035 |
+ |
2036 |
+- vmbus_connection.conn_state = DISCONNECTED; |
2037 |
+- |
2038 |
+ /* Reset the event for the next resume. */ |
2039 |
+ reinit_completion(&vmbus_connection.ready_for_resume_event); |
2040 |
+ |
2041 |
+@@ -2288,7 +2316,6 @@ static void hv_kexec_handler(void) |
2042 |
+ { |
2043 |
+ hv_stimer_global_cleanup(); |
2044 |
+ vmbus_initiate_unload(false); |
2045 |
+- vmbus_connection.conn_state = DISCONNECTED; |
2046 |
+ /* Make sure conn_state is set as hv_synic_cleanup checks for it */ |
2047 |
+ mb(); |
2048 |
+ cpuhp_remove_state(hyperv_cpuhp_online); |
2049 |
+@@ -2305,7 +2332,6 @@ static void hv_crash_handler(struct pt_regs *regs) |
2050 |
+ * doing the cleanup for current CPU only. This should be sufficient |
2051 |
+ * for kdump. |
2052 |
+ */ |
2053 |
+- vmbus_connection.conn_state = DISCONNECTED; |
2054 |
+ cpu = smp_processor_id(); |
2055 |
+ hv_stimer_cleanup(cpu); |
2056 |
+ hv_synic_disable_regs(cpu); |
2057 |
+diff --git a/drivers/iio/light/si1133.c b/drivers/iio/light/si1133.c |
2058 |
+index 015a21f0c2ef..9174ab928880 100644 |
2059 |
+--- a/drivers/iio/light/si1133.c |
2060 |
++++ b/drivers/iio/light/si1133.c |
2061 |
+@@ -102,6 +102,9 @@ |
2062 |
+ #define SI1133_INPUT_FRACTION_LOW 15 |
2063 |
+ #define SI1133_LUX_OUTPUT_FRACTION 12 |
2064 |
+ #define SI1133_LUX_BUFFER_SIZE 9 |
2065 |
++#define SI1133_MEASURE_BUFFER_SIZE 3 |
2066 |
++ |
2067 |
++#define SI1133_SIGN_BIT_INDEX 23 |
2068 |
+ |
2069 |
+ static const int si1133_scale_available[] = { |
2070 |
+ 1, 2, 4, 8, 16, 32, 64, 128}; |
2071 |
+@@ -234,13 +237,13 @@ static const struct si1133_lux_coeff lux_coeff = { |
2072 |
+ } |
2073 |
+ }; |
2074 |
+ |
2075 |
+-static int si1133_calculate_polynomial_inner(u32 input, u8 fraction, u16 mag, |
2076 |
++static int si1133_calculate_polynomial_inner(s32 input, u8 fraction, u16 mag, |
2077 |
+ s8 shift) |
2078 |
+ { |
2079 |
+ return ((input << fraction) / mag) << shift; |
2080 |
+ } |
2081 |
+ |
2082 |
+-static int si1133_calculate_output(u32 x, u32 y, u8 x_order, u8 y_order, |
2083 |
++static int si1133_calculate_output(s32 x, s32 y, u8 x_order, u8 y_order, |
2084 |
+ u8 input_fraction, s8 sign, |
2085 |
+ const struct si1133_coeff *coeffs) |
2086 |
+ { |
2087 |
+@@ -276,7 +279,7 @@ static int si1133_calculate_output(u32 x, u32 y, u8 x_order, u8 y_order, |
2088 |
+ * The algorithm is from: |
2089 |
+ * https://siliconlabs.github.io/Gecko_SDK_Doc/efm32zg/html/si1133_8c_source.html#l00716 |
2090 |
+ */ |
2091 |
+-static int si1133_calc_polynomial(u32 x, u32 y, u8 input_fraction, u8 num_coeff, |
2092 |
++static int si1133_calc_polynomial(s32 x, s32 y, u8 input_fraction, u8 num_coeff, |
2093 |
+ const struct si1133_coeff *coeffs) |
2094 |
+ { |
2095 |
+ u8 x_order, y_order; |
2096 |
+@@ -614,7 +617,7 @@ static int si1133_measure(struct si1133_data *data, |
2097 |
+ { |
2098 |
+ int err; |
2099 |
+ |
2100 |
+- __be16 resp; |
2101 |
++ u8 buffer[SI1133_MEASURE_BUFFER_SIZE]; |
2102 |
+ |
2103 |
+ err = si1133_set_adcmux(data, 0, chan->channel); |
2104 |
+ if (err) |
2105 |
+@@ -625,12 +628,13 @@ static int si1133_measure(struct si1133_data *data, |
2106 |
+ if (err) |
2107 |
+ return err; |
2108 |
+ |
2109 |
+- err = si1133_bulk_read(data, SI1133_REG_HOSTOUT(0), sizeof(resp), |
2110 |
+- (u8 *)&resp); |
2111 |
++ err = si1133_bulk_read(data, SI1133_REG_HOSTOUT(0), sizeof(buffer), |
2112 |
++ buffer); |
2113 |
+ if (err) |
2114 |
+ return err; |
2115 |
+ |
2116 |
+- *val = be16_to_cpu(resp); |
2117 |
++ *val = sign_extend32((buffer[0] << 16) | (buffer[1] << 8) | buffer[2], |
2118 |
++ SI1133_SIGN_BIT_INDEX); |
2119 |
+ |
2120 |
+ return err; |
2121 |
+ } |
2122 |
+@@ -704,9 +708,9 @@ static int si1133_get_lux(struct si1133_data *data, int *val) |
2123 |
+ { |
2124 |
+ int err; |
2125 |
+ int lux; |
2126 |
+- u32 high_vis; |
2127 |
+- u32 low_vis; |
2128 |
+- u32 ir; |
2129 |
++ s32 high_vis; |
2130 |
++ s32 low_vis; |
2131 |
++ s32 ir; |
2132 |
+ u8 buffer[SI1133_LUX_BUFFER_SIZE]; |
2133 |
+ |
2134 |
+ /* Activate lux channels */ |
2135 |
+@@ -719,9 +723,16 @@ static int si1133_get_lux(struct si1133_data *data, int *val) |
2136 |
+ if (err) |
2137 |
+ return err; |
2138 |
+ |
2139 |
+- high_vis = (buffer[0] << 16) | (buffer[1] << 8) | buffer[2]; |
2140 |
+- low_vis = (buffer[3] << 16) | (buffer[4] << 8) | buffer[5]; |
2141 |
+- ir = (buffer[6] << 16) | (buffer[7] << 8) | buffer[8]; |
2142 |
++ high_vis = |
2143 |
++ sign_extend32((buffer[0] << 16) | (buffer[1] << 8) | buffer[2], |
2144 |
++ SI1133_SIGN_BIT_INDEX); |
2145 |
++ |
2146 |
++ low_vis = |
2147 |
++ sign_extend32((buffer[3] << 16) | (buffer[4] << 8) | buffer[5], |
2148 |
++ SI1133_SIGN_BIT_INDEX); |
2149 |
++ |
2150 |
++ ir = sign_extend32((buffer[6] << 16) | (buffer[7] << 8) | buffer[8], |
2151 |
++ SI1133_SIGN_BIT_INDEX); |
2152 |
+ |
2153 |
+ if (high_vis > SI1133_ADC_THRESHOLD || ir > SI1133_ADC_THRESHOLD) |
2154 |
+ lux = si1133_calc_polynomial(high_vis, ir, |
2155 |
+diff --git a/drivers/iommu/amd_iommu_types.h b/drivers/iommu/amd_iommu_types.h |
2156 |
+index daeabd98c60e..0679896b9e2e 100644 |
2157 |
+--- a/drivers/iommu/amd_iommu_types.h |
2158 |
++++ b/drivers/iommu/amd_iommu_types.h |
2159 |
+@@ -348,7 +348,7 @@ |
2160 |
+ |
2161 |
+ #define DTE_GCR3_VAL_A(x) (((x) >> 12) & 0x00007ULL) |
2162 |
+ #define DTE_GCR3_VAL_B(x) (((x) >> 15) & 0x0ffffULL) |
2163 |
+-#define DTE_GCR3_VAL_C(x) (((x) >> 31) & 0xfffffULL) |
2164 |
++#define DTE_GCR3_VAL_C(x) (((x) >> 31) & 0x1fffffULL) |
2165 |
+ |
2166 |
+ #define DTE_GCR3_INDEX_A 0 |
2167 |
+ #define DTE_GCR3_INDEX_B 1 |
2168 |
+diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c |
2169 |
+index 0d922eeae357..773ac2b0d606 100644 |
2170 |
+--- a/drivers/iommu/intel-iommu.c |
2171 |
++++ b/drivers/iommu/intel-iommu.c |
2172 |
+@@ -4335,7 +4335,8 @@ static struct dmar_atsr_unit *dmar_find_atsr(struct acpi_dmar_atsr *atsr) |
2173 |
+ struct dmar_atsr_unit *atsru; |
2174 |
+ struct acpi_dmar_atsr *tmp; |
2175 |
+ |
2176 |
+- list_for_each_entry_rcu(atsru, &dmar_atsr_units, list) { |
2177 |
++ list_for_each_entry_rcu(atsru, &dmar_atsr_units, list, |
2178 |
++ dmar_rcu_check()) { |
2179 |
+ tmp = (struct acpi_dmar_atsr *)atsru->hdr; |
2180 |
+ if (atsr->segment != tmp->segment) |
2181 |
+ continue; |
2182 |
+diff --git a/drivers/iommu/intel-svm.c b/drivers/iommu/intel-svm.c |
2183 |
+index 518d0b2d12af..1d3816cd65d5 100644 |
2184 |
+--- a/drivers/iommu/intel-svm.c |
2185 |
++++ b/drivers/iommu/intel-svm.c |
2186 |
+@@ -502,7 +502,7 @@ struct page_req_dsc { |
2187 |
+ u64 priv_data[2]; |
2188 |
+ }; |
2189 |
+ |
2190 |
+-#define PRQ_RING_MASK ((0x1000 << PRQ_ORDER) - 0x10) |
2191 |
++#define PRQ_RING_MASK ((0x1000 << PRQ_ORDER) - 0x20) |
2192 |
+ |
2193 |
+ static bool access_error(struct vm_area_struct *vma, struct page_req_dsc *req) |
2194 |
+ { |
2195 |
+@@ -583,14 +583,15 @@ static irqreturn_t prq_event_thread(int irq, void *d) |
2196 |
+ * any faults on kernel addresses. */ |
2197 |
+ if (!svm->mm) |
2198 |
+ goto bad_req; |
2199 |
+- /* If the mm is already defunct, don't handle faults. */ |
2200 |
+- if (!mmget_not_zero(svm->mm)) |
2201 |
+- goto bad_req; |
2202 |
+ |
2203 |
+ /* If address is not canonical, return invalid response */ |
2204 |
+ if (!is_canonical_address(address)) |
2205 |
+ goto bad_req; |
2206 |
+ |
2207 |
++ /* If the mm is already defunct, don't handle faults. */ |
2208 |
++ if (!mmget_not_zero(svm->mm)) |
2209 |
++ goto bad_req; |
2210 |
++ |
2211 |
+ down_read(&svm->mm->mmap_sem); |
2212 |
+ vma = find_extend_vma(svm->mm, address); |
2213 |
+ if (!vma || address < vma->vm_start) |
2214 |
+diff --git a/drivers/iommu/virtio-iommu.c b/drivers/iommu/virtio-iommu.c |
2215 |
+index 3ea9d7682999..6c340a4f4fd2 100644 |
2216 |
+--- a/drivers/iommu/virtio-iommu.c |
2217 |
++++ b/drivers/iommu/virtio-iommu.c |
2218 |
+@@ -614,18 +614,20 @@ static int viommu_domain_finalise(struct viommu_dev *viommu, |
2219 |
+ int ret; |
2220 |
+ struct viommu_domain *vdomain = to_viommu_domain(domain); |
2221 |
+ |
2222 |
+- vdomain->viommu = viommu; |
2223 |
+- vdomain->map_flags = viommu->map_flags; |
2224 |
++ ret = ida_alloc_range(&viommu->domain_ids, viommu->first_domain, |
2225 |
++ viommu->last_domain, GFP_KERNEL); |
2226 |
++ if (ret < 0) |
2227 |
++ return ret; |
2228 |
++ |
2229 |
++ vdomain->id = (unsigned int)ret; |
2230 |
+ |
2231 |
+ domain->pgsize_bitmap = viommu->pgsize_bitmap; |
2232 |
+ domain->geometry = viommu->geometry; |
2233 |
+ |
2234 |
+- ret = ida_alloc_range(&viommu->domain_ids, viommu->first_domain, |
2235 |
+- viommu->last_domain, GFP_KERNEL); |
2236 |
+- if (ret >= 0) |
2237 |
+- vdomain->id = (unsigned int)ret; |
2238 |
++ vdomain->map_flags = viommu->map_flags; |
2239 |
++ vdomain->viommu = viommu; |
2240 |
+ |
2241 |
+- return ret > 0 ? 0 : ret; |
2242 |
++ return 0; |
2243 |
+ } |
2244 |
+ |
2245 |
+ static void viommu_domain_free(struct iommu_domain *domain) |
2246 |
+diff --git a/drivers/irqchip/irq-mbigen.c b/drivers/irqchip/irq-mbigen.c |
2247 |
+index 6b566bba263b..ff7627b57772 100644 |
2248 |
+--- a/drivers/irqchip/irq-mbigen.c |
2249 |
++++ b/drivers/irqchip/irq-mbigen.c |
2250 |
+@@ -220,10 +220,16 @@ static int mbigen_irq_domain_alloc(struct irq_domain *domain, |
2251 |
+ return 0; |
2252 |
+ } |
2253 |
+ |
2254 |
++static void mbigen_irq_domain_free(struct irq_domain *domain, unsigned int virq, |
2255 |
++ unsigned int nr_irqs) |
2256 |
++{ |
2257 |
++ platform_msi_domain_free(domain, virq, nr_irqs); |
2258 |
++} |
2259 |
++ |
2260 |
+ static const struct irq_domain_ops mbigen_domain_ops = { |
2261 |
+ .translate = mbigen_domain_translate, |
2262 |
+ .alloc = mbigen_irq_domain_alloc, |
2263 |
+- .free = irq_domain_free_irqs_common, |
2264 |
++ .free = mbigen_irq_domain_free, |
2265 |
+ }; |
2266 |
+ |
2267 |
+ static int mbigen_of_create_domain(struct platform_device *pdev, |
2268 |
+diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c |
2269 |
+index 647b1263c579..d3e83c33783e 100644 |
2270 |
+--- a/drivers/leds/led-class.c |
2271 |
++++ b/drivers/leds/led-class.c |
2272 |
+@@ -281,7 +281,7 @@ int led_classdev_register_ext(struct device *parent, |
2273 |
+ |
2274 |
+ if (ret) |
2275 |
+ dev_warn(parent, "Led %s renamed to %s due to name collision", |
2276 |
+- led_cdev->name, dev_name(led_cdev->dev)); |
2277 |
++ proposed_name, dev_name(led_cdev->dev)); |
2278 |
+ |
2279 |
+ if (led_cdev->flags & LED_BRIGHT_HW_CHANGED) { |
2280 |
+ ret = led_add_brightness_hw_changed(led_cdev); |
2281 |
+diff --git a/drivers/mtd/devices/phram.c b/drivers/mtd/devices/phram.c |
2282 |
+index 931e5c2481b5..b50ec7ecd10c 100644 |
2283 |
+--- a/drivers/mtd/devices/phram.c |
2284 |
++++ b/drivers/mtd/devices/phram.c |
2285 |
+@@ -243,22 +243,25 @@ static int phram_setup(const char *val) |
2286 |
+ |
2287 |
+ ret = parse_num64(&start, token[1]); |
2288 |
+ if (ret) { |
2289 |
+- kfree(name); |
2290 |
+ parse_err("illegal start address\n"); |
2291 |
++ goto error; |
2292 |
+ } |
2293 |
+ |
2294 |
+ ret = parse_num64(&len, token[2]); |
2295 |
+ if (ret) { |
2296 |
+- kfree(name); |
2297 |
+ parse_err("illegal device length\n"); |
2298 |
++ goto error; |
2299 |
+ } |
2300 |
+ |
2301 |
+ ret = register_device(name, start, len); |
2302 |
+- if (!ret) |
2303 |
+- pr_info("%s device: %#llx at %#llx\n", name, len, start); |
2304 |
+- else |
2305 |
+- kfree(name); |
2306 |
++ if (ret) |
2307 |
++ goto error; |
2308 |
++ |
2309 |
++ pr_info("%s device: %#llx at %#llx\n", name, len, start); |
2310 |
++ return 0; |
2311 |
+ |
2312 |
++error: |
2313 |
++ kfree(name); |
2314 |
+ return ret; |
2315 |
+ } |
2316 |
+ |
2317 |
+diff --git a/drivers/mtd/lpddr/lpddr_cmds.c b/drivers/mtd/lpddr/lpddr_cmds.c |
2318 |
+index 1efc643c9871..9341a8a592e8 100644 |
2319 |
+--- a/drivers/mtd/lpddr/lpddr_cmds.c |
2320 |
++++ b/drivers/mtd/lpddr/lpddr_cmds.c |
2321 |
+@@ -68,7 +68,6 @@ struct mtd_info *lpddr_cmdset(struct map_info *map) |
2322 |
+ shared = kmalloc_array(lpddr->numchips, sizeof(struct flchip_shared), |
2323 |
+ GFP_KERNEL); |
2324 |
+ if (!shared) { |
2325 |
+- kfree(lpddr); |
2326 |
+ kfree(mtd); |
2327 |
+ return NULL; |
2328 |
+ } |
2329 |
+diff --git a/drivers/mtd/nand/raw/nand_base.c b/drivers/mtd/nand/raw/nand_base.c |
2330 |
+index f64e3b6605c6..47c63968fa45 100644 |
2331 |
+--- a/drivers/mtd/nand/raw/nand_base.c |
2332 |
++++ b/drivers/mtd/nand/raw/nand_base.c |
2333 |
+@@ -5907,6 +5907,8 @@ void nand_cleanup(struct nand_chip *chip) |
2334 |
+ chip->ecc.algo == NAND_ECC_BCH) |
2335 |
+ nand_bch_free((struct nand_bch_control *)chip->ecc.priv); |
2336 |
+ |
2337 |
++ nanddev_cleanup(&chip->base); |
2338 |
++ |
2339 |
+ /* Free bad block table memory */ |
2340 |
+ kfree(chip->bbt); |
2341 |
+ kfree(chip->data_buf); |
2342 |
+diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c |
2343 |
+index 5750c45019d8..8dda51bbdd11 100644 |
2344 |
+--- a/drivers/mtd/nand/spi/core.c |
2345 |
++++ b/drivers/mtd/nand/spi/core.c |
2346 |
+@@ -609,6 +609,7 @@ static int spinand_markbad(struct nand_device *nand, const struct nand_pos *pos) |
2347 |
+ .ooboffs = 0, |
2348 |
+ .ooblen = sizeof(marker), |
2349 |
+ .oobbuf.out = marker, |
2350 |
++ .mode = MTD_OPS_RAW, |
2351 |
+ }; |
2352 |
+ int ret; |
2353 |
+ |
2354 |
+diff --git a/drivers/net/dsa/bcm_sf2_cfp.c b/drivers/net/dsa/bcm_sf2_cfp.c |
2355 |
+index 471837cf0b21..e15d18bb981e 100644 |
2356 |
+--- a/drivers/net/dsa/bcm_sf2_cfp.c |
2357 |
++++ b/drivers/net/dsa/bcm_sf2_cfp.c |
2358 |
+@@ -882,17 +882,14 @@ static int bcm_sf2_cfp_rule_set(struct dsa_switch *ds, int port, |
2359 |
+ fs->m_ext.data[1])) |
2360 |
+ return -EINVAL; |
2361 |
+ |
2362 |
+- if (fs->location != RX_CLS_LOC_ANY && fs->location >= CFP_NUM_RULES) |
2363 |
++ if (fs->location != RX_CLS_LOC_ANY && |
2364 |
++ fs->location > bcm_sf2_cfp_rule_size(priv)) |
2365 |
+ return -EINVAL; |
2366 |
+ |
2367 |
+ if (fs->location != RX_CLS_LOC_ANY && |
2368 |
+ test_bit(fs->location, priv->cfp.used)) |
2369 |
+ return -EBUSY; |
2370 |
+ |
2371 |
+- if (fs->location != RX_CLS_LOC_ANY && |
2372 |
+- fs->location > bcm_sf2_cfp_rule_size(priv)) |
2373 |
+- return -EINVAL; |
2374 |
+- |
2375 |
+ ret = bcm_sf2_cfp_rule_cmp(priv, port, fs); |
2376 |
+ if (ret == 0) |
2377 |
+ return -EEXIST; |
2378 |
+@@ -973,7 +970,7 @@ static int bcm_sf2_cfp_rule_del(struct bcm_sf2_priv *priv, int port, u32 loc) |
2379 |
+ struct cfp_rule *rule; |
2380 |
+ int ret; |
2381 |
+ |
2382 |
+- if (loc >= CFP_NUM_RULES) |
2383 |
++ if (loc > bcm_sf2_cfp_rule_size(priv)) |
2384 |
+ return -EINVAL; |
2385 |
+ |
2386 |
+ /* Refuse deleting unused rules, and those that are not unique since |
2387 |
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c |
2388 |
+index 304ddce6b087..39ee32518b10 100644 |
2389 |
+--- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c |
2390 |
++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c |
2391 |
+@@ -1548,6 +1548,10 @@ static int mlx5e_set_fecparam(struct net_device *netdev, |
2392 |
+ int mode; |
2393 |
+ int err; |
2394 |
+ |
2395 |
++ if (bitmap_weight((unsigned long *)&fecparam->fec, |
2396 |
++ ETHTOOL_FEC_BASER_BIT + 1) > 1) |
2397 |
++ return -EOPNOTSUPP; |
2398 |
++ |
2399 |
+ for (mode = 0; mode < ARRAY_SIZE(pplm_fec_2_ethtool); mode++) { |
2400 |
+ if (!(pplm_fec_2_ethtool[mode] & fecparam->fec)) |
2401 |
+ continue; |
2402 |
+diff --git a/drivers/nvdimm/bus.c b/drivers/nvdimm/bus.c |
2403 |
+index d47412dcdf38..5e5c6aafc070 100644 |
2404 |
+--- a/drivers/nvdimm/bus.c |
2405 |
++++ b/drivers/nvdimm/bus.c |
2406 |
+@@ -1010,8 +1010,10 @@ static int __nd_ioctl(struct nvdimm_bus *nvdimm_bus, struct nvdimm *nvdimm, |
2407 |
+ return -EFAULT; |
2408 |
+ } |
2409 |
+ |
2410 |
+- if (!desc || (desc->out_num + desc->in_num == 0) || |
2411 |
+- !test_bit(cmd, &cmd_mask)) |
2412 |
++ if (!desc || |
2413 |
++ (desc->out_num + desc->in_num == 0) || |
2414 |
++ cmd > ND_CMD_CALL || |
2415 |
++ !test_bit(cmd, &cmd_mask)) |
2416 |
+ return -ENOTTY; |
2417 |
+ |
2418 |
+ /* fail write commands (when read-only) */ |
2419 |
+diff --git a/drivers/of/overlay.c b/drivers/of/overlay.c |
2420 |
+index 9617b7df7c4d..1688f576ee8a 100644 |
2421 |
+--- a/drivers/of/overlay.c |
2422 |
++++ b/drivers/of/overlay.c |
2423 |
+@@ -261,6 +261,8 @@ static struct property *dup_and_fixup_symbol_prop( |
2424 |
+ |
2425 |
+ of_property_set_flag(new_prop, OF_DYNAMIC); |
2426 |
+ |
2427 |
++ kfree(target_path); |
2428 |
++ |
2429 |
+ return new_prop; |
2430 |
+ |
2431 |
+ err_free_new_prop: |
2432 |
+diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c |
2433 |
+index ca7823eef2b4..5707c309a754 100644 |
2434 |
+--- a/drivers/of/unittest.c |
2435 |
++++ b/drivers/of/unittest.c |
2436 |
+@@ -776,6 +776,10 @@ static void __init of_unittest_changeset(void) |
2437 |
+ unittest(!of_changeset_revert(&chgset), "revert failed\n"); |
2438 |
+ |
2439 |
+ of_changeset_destroy(&chgset); |
2440 |
++ |
2441 |
++ of_node_put(n1); |
2442 |
++ of_node_put(n2); |
2443 |
++ of_node_put(n21); |
2444 |
+ #endif |
2445 |
+ } |
2446 |
+ |
2447 |
+@@ -1061,10 +1065,13 @@ static void __init of_unittest_platform_populate(void) |
2448 |
+ |
2449 |
+ of_platform_populate(np, match, NULL, &test_bus->dev); |
2450 |
+ for_each_child_of_node(np, child) { |
2451 |
+- for_each_child_of_node(child, grandchild) |
2452 |
+- unittest(of_find_device_by_node(grandchild), |
2453 |
++ for_each_child_of_node(child, grandchild) { |
2454 |
++ pdev = of_find_device_by_node(grandchild); |
2455 |
++ unittest(pdev, |
2456 |
+ "Could not create device for node '%pOFn'\n", |
2457 |
+ grandchild); |
2458 |
++ of_dev_put(pdev); |
2459 |
++ } |
2460 |
+ } |
2461 |
+ |
2462 |
+ of_platform_depopulate(&test_bus->dev); |
2463 |
+@@ -2474,8 +2481,11 @@ static __init void of_unittest_overlay_high_level(void) |
2464 |
+ goto err_unlock; |
2465 |
+ } |
2466 |
+ if (__of_add_property(of_symbols, new_prop)) { |
2467 |
++ kfree(new_prop->name); |
2468 |
++ kfree(new_prop->value); |
2469 |
++ kfree(new_prop); |
2470 |
+ /* "name" auto-generated by unflatten */ |
2471 |
+- if (!strcmp(new_prop->name, "name")) |
2472 |
++ if (!strcmp(prop->name, "name")) |
2473 |
+ continue; |
2474 |
+ unittest(0, "duplicate property '%s' in overlay_base node __symbols__", |
2475 |
+ prop->name); |
2476 |
+diff --git a/drivers/phy/socionext/phy-uniphier-usb3ss.c b/drivers/phy/socionext/phy-uniphier-usb3ss.c |
2477 |
+index ec231e40ef2a..a7577e316baf 100644 |
2478 |
+--- a/drivers/phy/socionext/phy-uniphier-usb3ss.c |
2479 |
++++ b/drivers/phy/socionext/phy-uniphier-usb3ss.c |
2480 |
+@@ -314,6 +314,10 @@ static const struct of_device_id uniphier_u3ssphy_match[] = { |
2481 |
+ .compatible = "socionext,uniphier-pro4-usb3-ssphy", |
2482 |
+ .data = &uniphier_pro4_data, |
2483 |
+ }, |
2484 |
++ { |
2485 |
++ .compatible = "socionext,uniphier-pro5-usb3-ssphy", |
2486 |
++ .data = &uniphier_pro4_data, |
2487 |
++ }, |
2488 |
+ { |
2489 |
+ .compatible = "socionext,uniphier-pxs2-usb3-ssphy", |
2490 |
+ .data = &uniphier_pxs2_data, |
2491 |
+diff --git a/drivers/power/supply/axp288_fuel_gauge.c b/drivers/power/supply/axp288_fuel_gauge.c |
2492 |
+index e1bc4e6e6f30..f40fa0e63b6e 100644 |
2493 |
+--- a/drivers/power/supply/axp288_fuel_gauge.c |
2494 |
++++ b/drivers/power/supply/axp288_fuel_gauge.c |
2495 |
+@@ -706,14 +706,14 @@ static const struct dmi_system_id axp288_fuel_gauge_blacklist[] = { |
2496 |
+ { |
2497 |
+ /* Intel Cherry Trail Compute Stick, Windows version */ |
2498 |
+ .matches = { |
2499 |
+- DMI_MATCH(DMI_SYS_VENDOR, "Intel Corporation"), |
2500 |
++ DMI_MATCH(DMI_SYS_VENDOR, "Intel"), |
2501 |
+ DMI_MATCH(DMI_PRODUCT_NAME, "STK1AW32SC"), |
2502 |
+ }, |
2503 |
+ }, |
2504 |
+ { |
2505 |
+ /* Intel Cherry Trail Compute Stick, version without an OS */ |
2506 |
+ .matches = { |
2507 |
+- DMI_MATCH(DMI_SYS_VENDOR, "Intel Corporation"), |
2508 |
++ DMI_MATCH(DMI_SYS_VENDOR, "Intel"), |
2509 |
+ DMI_MATCH(DMI_PRODUCT_NAME, "STK1A32SC"), |
2510 |
+ }, |
2511 |
+ }, |
2512 |
+diff --git a/drivers/power/supply/bq27xxx_battery.c b/drivers/power/supply/bq27xxx_battery.c |
2513 |
+index 195c18c2f426..664e50103eaa 100644 |
2514 |
+--- a/drivers/power/supply/bq27xxx_battery.c |
2515 |
++++ b/drivers/power/supply/bq27xxx_battery.c |
2516 |
+@@ -1885,7 +1885,10 @@ int bq27xxx_battery_setup(struct bq27xxx_device_info *di) |
2517 |
+ |
2518 |
+ di->bat = power_supply_register_no_ws(di->dev, psy_desc, &psy_cfg); |
2519 |
+ if (IS_ERR(di->bat)) { |
2520 |
+- dev_err(di->dev, "failed to register battery\n"); |
2521 |
++ if (PTR_ERR(di->bat) == -EPROBE_DEFER) |
2522 |
++ dev_dbg(di->dev, "failed to register battery, deferring probe\n"); |
2523 |
++ else |
2524 |
++ dev_err(di->dev, "failed to register battery\n"); |
2525 |
+ return PTR_ERR(di->bat); |
2526 |
+ } |
2527 |
+ |
2528 |
+diff --git a/drivers/rtc/rtc-88pm860x.c b/drivers/rtc/rtc-88pm860x.c |
2529 |
+index 4743b16a8d84..1526402e126b 100644 |
2530 |
+--- a/drivers/rtc/rtc-88pm860x.c |
2531 |
++++ b/drivers/rtc/rtc-88pm860x.c |
2532 |
+@@ -336,6 +336,10 @@ static int pm860x_rtc_probe(struct platform_device *pdev) |
2533 |
+ info->dev = &pdev->dev; |
2534 |
+ dev_set_drvdata(&pdev->dev, info); |
2535 |
+ |
2536 |
++ info->rtc_dev = devm_rtc_allocate_device(&pdev->dev); |
2537 |
++ if (IS_ERR(info->rtc_dev)) |
2538 |
++ return PTR_ERR(info->rtc_dev); |
2539 |
++ |
2540 |
+ ret = devm_request_threaded_irq(&pdev->dev, info->irq, NULL, |
2541 |
+ rtc_update_handler, IRQF_ONESHOT, "rtc", |
2542 |
+ info); |
2543 |
+@@ -377,13 +381,11 @@ static int pm860x_rtc_probe(struct platform_device *pdev) |
2544 |
+ } |
2545 |
+ } |
2546 |
+ |
2547 |
+- info->rtc_dev = devm_rtc_device_register(&pdev->dev, "88pm860x-rtc", |
2548 |
+- &pm860x_rtc_ops, THIS_MODULE); |
2549 |
+- ret = PTR_ERR(info->rtc_dev); |
2550 |
+- if (IS_ERR(info->rtc_dev)) { |
2551 |
+- dev_err(&pdev->dev, "Failed to register RTC device: %d\n", ret); |
2552 |
++ info->rtc_dev->ops = &pm860x_rtc_ops; |
2553 |
++ |
2554 |
++ ret = rtc_register_device(info->rtc_dev); |
2555 |
++ if (ret) |
2556 |
+ return ret; |
2557 |
+- } |
2558 |
+ |
2559 |
+ /* |
2560 |
+ * enable internal XO instead of internal 3.25MHz clock since it can |
2561 |
+diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c |
2562 |
+index cce757506383..94af30f768f7 100644 |
2563 |
+--- a/drivers/scsi/sg.c |
2564 |
++++ b/drivers/scsi/sg.c |
2565 |
+@@ -803,8 +803,10 @@ sg_common_write(Sg_fd * sfp, Sg_request * srp, |
2566 |
+ "sg_common_write: scsi opcode=0x%02x, cmd_size=%d\n", |
2567 |
+ (int) cmnd[0], (int) hp->cmd_len)); |
2568 |
+ |
2569 |
+- if (hp->dxfer_len >= SZ_256M) |
2570 |
++ if (hp->dxfer_len >= SZ_256M) { |
2571 |
++ sg_remove_request(sfp, srp); |
2572 |
+ return -EINVAL; |
2573 |
++ } |
2574 |
+ |
2575 |
+ k = sg_start_req(srp, cmnd); |
2576 |
+ if (k) { |
2577 |
+diff --git a/drivers/soc/imx/gpc.c b/drivers/soc/imx/gpc.c |
2578 |
+index 98b9d9a902ae..90a8b2c0676f 100644 |
2579 |
+--- a/drivers/soc/imx/gpc.c |
2580 |
++++ b/drivers/soc/imx/gpc.c |
2581 |
+@@ -87,8 +87,8 @@ static int imx6_pm_domain_power_off(struct generic_pm_domain *genpd) |
2582 |
+ static int imx6_pm_domain_power_on(struct generic_pm_domain *genpd) |
2583 |
+ { |
2584 |
+ struct imx_pm_domain *pd = to_imx_pm_domain(genpd); |
2585 |
+- int i, ret, sw, sw2iso; |
2586 |
+- u32 val; |
2587 |
++ int i, ret; |
2588 |
++ u32 val, req; |
2589 |
+ |
2590 |
+ if (pd->supply) { |
2591 |
+ ret = regulator_enable(pd->supply); |
2592 |
+@@ -107,17 +107,18 @@ static int imx6_pm_domain_power_on(struct generic_pm_domain *genpd) |
2593 |
+ regmap_update_bits(pd->regmap, pd->reg_offs + GPC_PGC_CTRL_OFFS, |
2594 |
+ 0x1, 0x1); |
2595 |
+ |
2596 |
+- /* Read ISO and ISO2SW power up delays */ |
2597 |
+- regmap_read(pd->regmap, pd->reg_offs + GPC_PGC_PUPSCR_OFFS, &val); |
2598 |
+- sw = val & 0x3f; |
2599 |
+- sw2iso = (val >> 8) & 0x3f; |
2600 |
+- |
2601 |
+ /* Request GPC to power up domain */ |
2602 |
+- val = BIT(pd->cntr_pdn_bit + 1); |
2603 |
+- regmap_update_bits(pd->regmap, GPC_CNTR, val, val); |
2604 |
++ req = BIT(pd->cntr_pdn_bit + 1); |
2605 |
++ regmap_update_bits(pd->regmap, GPC_CNTR, req, req); |
2606 |
+ |
2607 |
+- /* Wait ISO + ISO2SW IPG clock cycles */ |
2608 |
+- udelay(DIV_ROUND_UP(sw + sw2iso, pd->ipg_rate_mhz)); |
2609 |
++ /* Wait for the PGC to handle the request */ |
2610 |
++ ret = regmap_read_poll_timeout(pd->regmap, GPC_CNTR, val, !(val & req), |
2611 |
++ 1, 50); |
2612 |
++ if (ret) |
2613 |
++ pr_err("powerup request on domain %s timed out\n", genpd->name); |
2614 |
++ |
2615 |
++ /* Wait for reset to propagate through peripherals */ |
2616 |
++ usleep_range(5, 10); |
2617 |
+ |
2618 |
+ /* Disable reset clocks for all devices in the domain */ |
2619 |
+ for (i = 0; i < pd->num_clks; i++) |
2620 |
+@@ -343,6 +344,7 @@ static const struct regmap_config imx_gpc_regmap_config = { |
2621 |
+ .rd_table = &access_table, |
2622 |
+ .wr_table = &access_table, |
2623 |
+ .max_register = 0x2ac, |
2624 |
++ .fast_io = true, |
2625 |
+ }; |
2626 |
+ |
2627 |
+ static struct generic_pm_domain *imx_gpc_onecell_domains[] = { |
2628 |
+diff --git a/drivers/tty/ehv_bytechan.c b/drivers/tty/ehv_bytechan.c |
2629 |
+index 769e0a5d1dfc..3c6dd06ec5fb 100644 |
2630 |
+--- a/drivers/tty/ehv_bytechan.c |
2631 |
++++ b/drivers/tty/ehv_bytechan.c |
2632 |
+@@ -136,6 +136,21 @@ static int find_console_handle(void) |
2633 |
+ return 1; |
2634 |
+ } |
2635 |
+ |
2636 |
++static unsigned int local_ev_byte_channel_send(unsigned int handle, |
2637 |
++ unsigned int *count, |
2638 |
++ const char *p) |
2639 |
++{ |
2640 |
++ char buffer[EV_BYTE_CHANNEL_MAX_BYTES]; |
2641 |
++ unsigned int c = *count; |
2642 |
++ |
2643 |
++ if (c < sizeof(buffer)) { |
2644 |
++ memcpy(buffer, p, c); |
2645 |
++ memset(&buffer[c], 0, sizeof(buffer) - c); |
2646 |
++ p = buffer; |
2647 |
++ } |
2648 |
++ return ev_byte_channel_send(handle, count, p); |
2649 |
++} |
2650 |
++ |
2651 |
+ /*************************** EARLY CONSOLE DRIVER ***************************/ |
2652 |
+ |
2653 |
+ #ifdef CONFIG_PPC_EARLY_DEBUG_EHV_BC |
2654 |
+@@ -154,7 +169,7 @@ static void byte_channel_spin_send(const char data) |
2655 |
+ |
2656 |
+ do { |
2657 |
+ count = 1; |
2658 |
+- ret = ev_byte_channel_send(CONFIG_PPC_EARLY_DEBUG_EHV_BC_HANDLE, |
2659 |
++ ret = local_ev_byte_channel_send(CONFIG_PPC_EARLY_DEBUG_EHV_BC_HANDLE, |
2660 |
+ &count, &data); |
2661 |
+ } while (ret == EV_EAGAIN); |
2662 |
+ } |
2663 |
+@@ -221,7 +236,7 @@ static int ehv_bc_console_byte_channel_send(unsigned int handle, const char *s, |
2664 |
+ while (count) { |
2665 |
+ len = min_t(unsigned int, count, EV_BYTE_CHANNEL_MAX_BYTES); |
2666 |
+ do { |
2667 |
+- ret = ev_byte_channel_send(handle, &len, s); |
2668 |
++ ret = local_ev_byte_channel_send(handle, &len, s); |
2669 |
+ } while (ret == EV_EAGAIN); |
2670 |
+ count -= len; |
2671 |
+ s += len; |
2672 |
+@@ -401,7 +416,7 @@ static void ehv_bc_tx_dequeue(struct ehv_bc_data *bc) |
2673 |
+ CIRC_CNT_TO_END(bc->head, bc->tail, BUF_SIZE), |
2674 |
+ EV_BYTE_CHANNEL_MAX_BYTES); |
2675 |
+ |
2676 |
+- ret = ev_byte_channel_send(bc->handle, &len, bc->buf + bc->tail); |
2677 |
++ ret = local_ev_byte_channel_send(bc->handle, &len, bc->buf + bc->tail); |
2678 |
+ |
2679 |
+ /* 'len' is valid only if the return code is 0 or EV_EAGAIN */ |
2680 |
+ if (!ret || (ret == EV_EAGAIN)) |
2681 |
+diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c |
2682 |
+index e6a1c805064f..e72738371ecb 100644 |
2683 |
+--- a/drivers/video/fbdev/core/fbmem.c |
2684 |
++++ b/drivers/video/fbdev/core/fbmem.c |
2685 |
+@@ -662,20 +662,20 @@ int fb_prepare_logo(struct fb_info *info, int rotate) |
2686 |
+ fb_logo.depth = 1; |
2687 |
+ |
2688 |
+ |
2689 |
+- if (fb_logo.depth > 4 && depth > 4) { |
2690 |
+- switch (info->fix.visual) { |
2691 |
+- case FB_VISUAL_TRUECOLOR: |
2692 |
+- fb_logo.needs_truepalette = 1; |
2693 |
+- break; |
2694 |
+- case FB_VISUAL_DIRECTCOLOR: |
2695 |
+- fb_logo.needs_directpalette = 1; |
2696 |
+- fb_logo.needs_cmapreset = 1; |
2697 |
+- break; |
2698 |
+- case FB_VISUAL_PSEUDOCOLOR: |
2699 |
+- fb_logo.needs_cmapreset = 1; |
2700 |
+- break; |
2701 |
+- } |
2702 |
+- } |
2703 |
++ if (fb_logo.depth > 4 && depth > 4) { |
2704 |
++ switch (info->fix.visual) { |
2705 |
++ case FB_VISUAL_TRUECOLOR: |
2706 |
++ fb_logo.needs_truepalette = 1; |
2707 |
++ break; |
2708 |
++ case FB_VISUAL_DIRECTCOLOR: |
2709 |
++ fb_logo.needs_directpalette = 1; |
2710 |
++ fb_logo.needs_cmapreset = 1; |
2711 |
++ break; |
2712 |
++ case FB_VISUAL_PSEUDOCOLOR: |
2713 |
++ fb_logo.needs_cmapreset = 1; |
2714 |
++ break; |
2715 |
++ } |
2716 |
++ } |
2717 |
+ |
2718 |
+ height = fb_logo.logo->height; |
2719 |
+ if (fb_center_logo) |
2720 |
+@@ -1060,19 +1060,19 @@ fb_blank(struct fb_info *info, int blank) |
2721 |
+ struct fb_event event; |
2722 |
+ int ret = -EINVAL; |
2723 |
+ |
2724 |
+- if (blank > FB_BLANK_POWERDOWN) |
2725 |
+- blank = FB_BLANK_POWERDOWN; |
2726 |
++ if (blank > FB_BLANK_POWERDOWN) |
2727 |
++ blank = FB_BLANK_POWERDOWN; |
2728 |
+ |
2729 |
+ event.info = info; |
2730 |
+ event.data = ␣ |
2731 |
+ |
2732 |
+ if (info->fbops->fb_blank) |
2733 |
+- ret = info->fbops->fb_blank(blank, info); |
2734 |
++ ret = info->fbops->fb_blank(blank, info); |
2735 |
+ |
2736 |
+ if (!ret) |
2737 |
+ fb_notifier_call_chain(FB_EVENT_BLANK, &event); |
2738 |
+ |
2739 |
+- return ret; |
2740 |
++ return ret; |
2741 |
+ } |
2742 |
+ EXPORT_SYMBOL(fb_blank); |
2743 |
+ |
2744 |
+@@ -1110,7 +1110,7 @@ static long do_fb_ioctl(struct fb_info *info, unsigned int cmd, |
2745 |
+ break; |
2746 |
+ case FBIOGET_FSCREENINFO: |
2747 |
+ lock_fb_info(info); |
2748 |
+- fix = info->fix; |
2749 |
++ memcpy(&fix, &info->fix, sizeof(fix)); |
2750 |
+ if (info->flags & FBINFO_HIDE_SMEM_START) |
2751 |
+ fix.smem_start = 0; |
2752 |
+ unlock_fb_info(info); |
2753 |
+diff --git a/drivers/watchdog/sp805_wdt.c b/drivers/watchdog/sp805_wdt.c |
2754 |
+index 53e04926a7b2..190d26e2e75f 100644 |
2755 |
+--- a/drivers/watchdog/sp805_wdt.c |
2756 |
++++ b/drivers/watchdog/sp805_wdt.c |
2757 |
+@@ -137,10 +137,14 @@ wdt_restart(struct watchdog_device *wdd, unsigned long mode, void *cmd) |
2758 |
+ { |
2759 |
+ struct sp805_wdt *wdt = watchdog_get_drvdata(wdd); |
2760 |
+ |
2761 |
++ writel_relaxed(UNLOCK, wdt->base + WDTLOCK); |
2762 |
+ writel_relaxed(0, wdt->base + WDTCONTROL); |
2763 |
+ writel_relaxed(0, wdt->base + WDTLOAD); |
2764 |
+ writel_relaxed(INT_ENABLE | RESET_ENABLE, wdt->base + WDTCONTROL); |
2765 |
+ |
2766 |
++ /* Flush posted writes. */ |
2767 |
++ readl_relaxed(wdt->base + WDTLOCK); |
2768 |
++ |
2769 |
+ return 0; |
2770 |
+ } |
2771 |
+ |
2772 |
+diff --git a/fs/afs/dir.c b/fs/afs/dir.c |
2773 |
+index 5c794f4b051a..d1e1caa23c8b 100644 |
2774 |
+--- a/fs/afs/dir.c |
2775 |
++++ b/fs/afs/dir.c |
2776 |
+@@ -1032,7 +1032,7 @@ static int afs_d_revalidate(struct dentry *dentry, unsigned int flags) |
2777 |
+ struct dentry *parent; |
2778 |
+ struct inode *inode; |
2779 |
+ struct key *key; |
2780 |
+- afs_dataversion_t dir_version; |
2781 |
++ afs_dataversion_t dir_version, invalid_before; |
2782 |
+ long de_version; |
2783 |
+ int ret; |
2784 |
+ |
2785 |
+@@ -1084,8 +1084,8 @@ static int afs_d_revalidate(struct dentry *dentry, unsigned int flags) |
2786 |
+ if (de_version == (long)dir_version) |
2787 |
+ goto out_valid_noupdate; |
2788 |
+ |
2789 |
+- dir_version = dir->invalid_before; |
2790 |
+- if (de_version - (long)dir_version >= 0) |
2791 |
++ invalid_before = dir->invalid_before; |
2792 |
++ if (de_version - (long)invalid_before >= 0) |
2793 |
+ goto out_valid; |
2794 |
+ |
2795 |
+ _debug("dir modified"); |
2796 |
+@@ -1275,6 +1275,7 @@ static int afs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) |
2797 |
+ struct afs_fs_cursor fc; |
2798 |
+ struct afs_vnode *dvnode = AFS_FS_I(dir); |
2799 |
+ struct key *key; |
2800 |
++ afs_dataversion_t data_version; |
2801 |
+ int ret; |
2802 |
+ |
2803 |
+ mode |= S_IFDIR; |
2804 |
+@@ -1295,7 +1296,7 @@ static int afs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) |
2805 |
+ |
2806 |
+ ret = -ERESTARTSYS; |
2807 |
+ if (afs_begin_vnode_operation(&fc, dvnode, key, true)) { |
2808 |
+- afs_dataversion_t data_version = dvnode->status.data_version + 1; |
2809 |
++ data_version = dvnode->status.data_version + 1; |
2810 |
+ |
2811 |
+ while (afs_select_fileserver(&fc)) { |
2812 |
+ fc.cb_break = afs_calc_vnode_cb_break(dvnode); |
2813 |
+@@ -1316,10 +1317,14 @@ static int afs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) |
2814 |
+ goto error_key; |
2815 |
+ } |
2816 |
+ |
2817 |
+- if (ret == 0 && |
2818 |
+- test_bit(AFS_VNODE_DIR_VALID, &dvnode->flags)) |
2819 |
+- afs_edit_dir_add(dvnode, &dentry->d_name, &iget_data.fid, |
2820 |
+- afs_edit_dir_for_create); |
2821 |
++ if (ret == 0) { |
2822 |
++ down_write(&dvnode->validate_lock); |
2823 |
++ if (test_bit(AFS_VNODE_DIR_VALID, &dvnode->flags) && |
2824 |
++ dvnode->status.data_version == data_version) |
2825 |
++ afs_edit_dir_add(dvnode, &dentry->d_name, &iget_data.fid, |
2826 |
++ afs_edit_dir_for_create); |
2827 |
++ up_write(&dvnode->validate_lock); |
2828 |
++ } |
2829 |
+ |
2830 |
+ key_put(key); |
2831 |
+ kfree(scb); |
2832 |
+@@ -1360,6 +1365,7 @@ static int afs_rmdir(struct inode *dir, struct dentry *dentry) |
2833 |
+ struct afs_fs_cursor fc; |
2834 |
+ struct afs_vnode *dvnode = AFS_FS_I(dir), *vnode = NULL; |
2835 |
+ struct key *key; |
2836 |
++ afs_dataversion_t data_version; |
2837 |
+ int ret; |
2838 |
+ |
2839 |
+ _enter("{%llx:%llu},{%pd}", |
2840 |
+@@ -1391,7 +1397,7 @@ static int afs_rmdir(struct inode *dir, struct dentry *dentry) |
2841 |
+ |
2842 |
+ ret = -ERESTARTSYS; |
2843 |
+ if (afs_begin_vnode_operation(&fc, dvnode, key, true)) { |
2844 |
+- afs_dataversion_t data_version = dvnode->status.data_version + 1; |
2845 |
++ data_version = dvnode->status.data_version + 1; |
2846 |
+ |
2847 |
+ while (afs_select_fileserver(&fc)) { |
2848 |
+ fc.cb_break = afs_calc_vnode_cb_break(dvnode); |
2849 |
+@@ -1404,9 +1410,12 @@ static int afs_rmdir(struct inode *dir, struct dentry *dentry) |
2850 |
+ ret = afs_end_vnode_operation(&fc); |
2851 |
+ if (ret == 0) { |
2852 |
+ afs_dir_remove_subdir(dentry); |
2853 |
+- if (test_bit(AFS_VNODE_DIR_VALID, &dvnode->flags)) |
2854 |
++ down_write(&dvnode->validate_lock); |
2855 |
++ if (test_bit(AFS_VNODE_DIR_VALID, &dvnode->flags) && |
2856 |
++ dvnode->status.data_version == data_version) |
2857 |
+ afs_edit_dir_remove(dvnode, &dentry->d_name, |
2858 |
+ afs_edit_dir_for_rmdir); |
2859 |
++ up_write(&dvnode->validate_lock); |
2860 |
+ } |
2861 |
+ } |
2862 |
+ |
2863 |
+@@ -1544,10 +1553,15 @@ static int afs_unlink(struct inode *dir, struct dentry *dentry) |
2864 |
+ ret = afs_end_vnode_operation(&fc); |
2865 |
+ if (ret == 0 && !(scb[1].have_status || scb[1].have_error)) |
2866 |
+ ret = afs_dir_remove_link(dvnode, dentry, key); |
2867 |
+- if (ret == 0 && |
2868 |
+- test_bit(AFS_VNODE_DIR_VALID, &dvnode->flags)) |
2869 |
+- afs_edit_dir_remove(dvnode, &dentry->d_name, |
2870 |
+- afs_edit_dir_for_unlink); |
2871 |
++ |
2872 |
++ if (ret == 0) { |
2873 |
++ down_write(&dvnode->validate_lock); |
2874 |
++ if (test_bit(AFS_VNODE_DIR_VALID, &dvnode->flags) && |
2875 |
++ dvnode->status.data_version == data_version) |
2876 |
++ afs_edit_dir_remove(dvnode, &dentry->d_name, |
2877 |
++ afs_edit_dir_for_unlink); |
2878 |
++ up_write(&dvnode->validate_lock); |
2879 |
++ } |
2880 |
+ } |
2881 |
+ |
2882 |
+ if (need_rehash && ret < 0 && ret != -ENOENT) |
2883 |
+@@ -1573,6 +1587,7 @@ static int afs_create(struct inode *dir, struct dentry *dentry, umode_t mode, |
2884 |
+ struct afs_status_cb *scb; |
2885 |
+ struct afs_vnode *dvnode = AFS_FS_I(dir); |
2886 |
+ struct key *key; |
2887 |
++ afs_dataversion_t data_version; |
2888 |
+ int ret; |
2889 |
+ |
2890 |
+ mode |= S_IFREG; |
2891 |
+@@ -1597,7 +1612,7 @@ static int afs_create(struct inode *dir, struct dentry *dentry, umode_t mode, |
2892 |
+ |
2893 |
+ ret = -ERESTARTSYS; |
2894 |
+ if (afs_begin_vnode_operation(&fc, dvnode, key, true)) { |
2895 |
+- afs_dataversion_t data_version = dvnode->status.data_version + 1; |
2896 |
++ data_version = dvnode->status.data_version + 1; |
2897 |
+ |
2898 |
+ while (afs_select_fileserver(&fc)) { |
2899 |
+ fc.cb_break = afs_calc_vnode_cb_break(dvnode); |
2900 |
+@@ -1618,9 +1633,12 @@ static int afs_create(struct inode *dir, struct dentry *dentry, umode_t mode, |
2901 |
+ goto error_key; |
2902 |
+ } |
2903 |
+ |
2904 |
+- if (test_bit(AFS_VNODE_DIR_VALID, &dvnode->flags)) |
2905 |
++ down_write(&dvnode->validate_lock); |
2906 |
++ if (test_bit(AFS_VNODE_DIR_VALID, &dvnode->flags) && |
2907 |
++ dvnode->status.data_version == data_version) |
2908 |
+ afs_edit_dir_add(dvnode, &dentry->d_name, &iget_data.fid, |
2909 |
+ afs_edit_dir_for_create); |
2910 |
++ up_write(&dvnode->validate_lock); |
2911 |
+ |
2912 |
+ kfree(scb); |
2913 |
+ key_put(key); |
2914 |
+@@ -1648,6 +1666,7 @@ static int afs_link(struct dentry *from, struct inode *dir, |
2915 |
+ struct afs_vnode *dvnode = AFS_FS_I(dir); |
2916 |
+ struct afs_vnode *vnode = AFS_FS_I(d_inode(from)); |
2917 |
+ struct key *key; |
2918 |
++ afs_dataversion_t data_version; |
2919 |
+ int ret; |
2920 |
+ |
2921 |
+ _enter("{%llx:%llu},{%llx:%llu},{%pd}", |
2922 |
+@@ -1672,7 +1691,7 @@ static int afs_link(struct dentry *from, struct inode *dir, |
2923 |
+ |
2924 |
+ ret = -ERESTARTSYS; |
2925 |
+ if (afs_begin_vnode_operation(&fc, dvnode, key, true)) { |
2926 |
+- afs_dataversion_t data_version = dvnode->status.data_version + 1; |
2927 |
++ data_version = dvnode->status.data_version + 1; |
2928 |
+ |
2929 |
+ if (mutex_lock_interruptible_nested(&vnode->io_lock, 1) < 0) { |
2930 |
+ afs_end_vnode_operation(&fc); |
2931 |
+@@ -1702,9 +1721,12 @@ static int afs_link(struct dentry *from, struct inode *dir, |
2932 |
+ goto error_key; |
2933 |
+ } |
2934 |
+ |
2935 |
+- if (test_bit(AFS_VNODE_DIR_VALID, &dvnode->flags)) |
2936 |
++ down_write(&dvnode->validate_lock); |
2937 |
++ if (test_bit(AFS_VNODE_DIR_VALID, &dvnode->flags) && |
2938 |
++ dvnode->status.data_version == data_version) |
2939 |
+ afs_edit_dir_add(dvnode, &dentry->d_name, &vnode->fid, |
2940 |
+ afs_edit_dir_for_link); |
2941 |
++ up_write(&dvnode->validate_lock); |
2942 |
+ |
2943 |
+ key_put(key); |
2944 |
+ kfree(scb); |
2945 |
+@@ -1732,6 +1754,7 @@ static int afs_symlink(struct inode *dir, struct dentry *dentry, |
2946 |
+ struct afs_status_cb *scb; |
2947 |
+ struct afs_vnode *dvnode = AFS_FS_I(dir); |
2948 |
+ struct key *key; |
2949 |
++ afs_dataversion_t data_version; |
2950 |
+ int ret; |
2951 |
+ |
2952 |
+ _enter("{%llx:%llu},{%pd},%s", |
2953 |
+@@ -1759,7 +1782,7 @@ static int afs_symlink(struct inode *dir, struct dentry *dentry, |
2954 |
+ |
2955 |
+ ret = -ERESTARTSYS; |
2956 |
+ if (afs_begin_vnode_operation(&fc, dvnode, key, true)) { |
2957 |
+- afs_dataversion_t data_version = dvnode->status.data_version + 1; |
2958 |
++ data_version = dvnode->status.data_version + 1; |
2959 |
+ |
2960 |
+ while (afs_select_fileserver(&fc)) { |
2961 |
+ fc.cb_break = afs_calc_vnode_cb_break(dvnode); |
2962 |
+@@ -1780,9 +1803,12 @@ static int afs_symlink(struct inode *dir, struct dentry *dentry, |
2963 |
+ goto error_key; |
2964 |
+ } |
2965 |
+ |
2966 |
+- if (test_bit(AFS_VNODE_DIR_VALID, &dvnode->flags)) |
2967 |
++ down_write(&dvnode->validate_lock); |
2968 |
++ if (test_bit(AFS_VNODE_DIR_VALID, &dvnode->flags) && |
2969 |
++ dvnode->status.data_version == data_version) |
2970 |
+ afs_edit_dir_add(dvnode, &dentry->d_name, &iget_data.fid, |
2971 |
+ afs_edit_dir_for_symlink); |
2972 |
++ up_write(&dvnode->validate_lock); |
2973 |
+ |
2974 |
+ key_put(key); |
2975 |
+ kfree(scb); |
2976 |
+@@ -1812,6 +1838,8 @@ static int afs_rename(struct inode *old_dir, struct dentry *old_dentry, |
2977 |
+ struct dentry *tmp = NULL, *rehash = NULL; |
2978 |
+ struct inode *new_inode; |
2979 |
+ struct key *key; |
2980 |
++ afs_dataversion_t orig_data_version; |
2981 |
++ afs_dataversion_t new_data_version; |
2982 |
+ bool new_negative = d_is_negative(new_dentry); |
2983 |
+ int ret; |
2984 |
+ |
2985 |
+@@ -1890,10 +1918,6 @@ static int afs_rename(struct inode *old_dir, struct dentry *old_dentry, |
2986 |
+ |
2987 |
+ ret = -ERESTARTSYS; |
2988 |
+ if (afs_begin_vnode_operation(&fc, orig_dvnode, key, true)) { |
2989 |
+- afs_dataversion_t orig_data_version; |
2990 |
+- afs_dataversion_t new_data_version; |
2991 |
+- struct afs_status_cb *new_scb = &scb[1]; |
2992 |
+- |
2993 |
+ orig_data_version = orig_dvnode->status.data_version + 1; |
2994 |
+ |
2995 |
+ if (orig_dvnode != new_dvnode) { |
2996 |
+@@ -1904,7 +1928,6 @@ static int afs_rename(struct inode *old_dir, struct dentry *old_dentry, |
2997 |
+ new_data_version = new_dvnode->status.data_version + 1; |
2998 |
+ } else { |
2999 |
+ new_data_version = orig_data_version; |
3000 |
+- new_scb = &scb[0]; |
3001 |
+ } |
3002 |
+ |
3003 |
+ while (afs_select_fileserver(&fc)) { |
3004 |
+@@ -1912,7 +1935,7 @@ static int afs_rename(struct inode *old_dir, struct dentry *old_dentry, |
3005 |
+ fc.cb_break_2 = afs_calc_vnode_cb_break(new_dvnode); |
3006 |
+ afs_fs_rename(&fc, old_dentry->d_name.name, |
3007 |
+ new_dvnode, new_dentry->d_name.name, |
3008 |
+- &scb[0], new_scb); |
3009 |
++ &scb[0], &scb[1]); |
3010 |
+ } |
3011 |
+ |
3012 |
+ afs_vnode_commit_status(&fc, orig_dvnode, fc.cb_break, |
3013 |
+@@ -1930,18 +1953,25 @@ static int afs_rename(struct inode *old_dir, struct dentry *old_dentry, |
3014 |
+ if (ret == 0) { |
3015 |
+ if (rehash) |
3016 |
+ d_rehash(rehash); |
3017 |
+- if (test_bit(AFS_VNODE_DIR_VALID, &orig_dvnode->flags)) |
3018 |
+- afs_edit_dir_remove(orig_dvnode, &old_dentry->d_name, |
3019 |
+- afs_edit_dir_for_rename_0); |
3020 |
++ down_write(&orig_dvnode->validate_lock); |
3021 |
++ if (test_bit(AFS_VNODE_DIR_VALID, &orig_dvnode->flags) && |
3022 |
++ orig_dvnode->status.data_version == orig_data_version) |
3023 |
++ afs_edit_dir_remove(orig_dvnode, &old_dentry->d_name, |
3024 |
++ afs_edit_dir_for_rename_0); |
3025 |
++ if (orig_dvnode != new_dvnode) { |
3026 |
++ up_write(&orig_dvnode->validate_lock); |
3027 |
+ |
3028 |
+- if (!new_negative && |
3029 |
+- test_bit(AFS_VNODE_DIR_VALID, &new_dvnode->flags)) |
3030 |
+- afs_edit_dir_remove(new_dvnode, &new_dentry->d_name, |
3031 |
+- afs_edit_dir_for_rename_1); |
3032 |
++ down_write(&new_dvnode->validate_lock); |
3033 |
++ } |
3034 |
++ if (test_bit(AFS_VNODE_DIR_VALID, &new_dvnode->flags) && |
3035 |
++ orig_dvnode->status.data_version == new_data_version) { |
3036 |
++ if (!new_negative) |
3037 |
++ afs_edit_dir_remove(new_dvnode, &new_dentry->d_name, |
3038 |
++ afs_edit_dir_for_rename_1); |
3039 |
+ |
3040 |
+- if (test_bit(AFS_VNODE_DIR_VALID, &new_dvnode->flags)) |
3041 |
+ afs_edit_dir_add(new_dvnode, &new_dentry->d_name, |
3042 |
+ &vnode->fid, afs_edit_dir_for_rename_2); |
3043 |
++ } |
3044 |
+ |
3045 |
+ new_inode = d_inode(new_dentry); |
3046 |
+ if (new_inode) { |
3047 |
+@@ -1957,14 +1987,10 @@ static int afs_rename(struct inode *old_dir, struct dentry *old_dentry, |
3048 |
+ * Note that if we ever implement RENAME_EXCHANGE, we'll have |
3049 |
+ * to update both dentries with opposing dir versions. |
3050 |
+ */ |
3051 |
+- if (new_dvnode != orig_dvnode) { |
3052 |
+- afs_update_dentry_version(&fc, old_dentry, &scb[1]); |
3053 |
+- afs_update_dentry_version(&fc, new_dentry, &scb[1]); |
3054 |
+- } else { |
3055 |
+- afs_update_dentry_version(&fc, old_dentry, &scb[0]); |
3056 |
+- afs_update_dentry_version(&fc, new_dentry, &scb[0]); |
3057 |
+- } |
3058 |
++ afs_update_dentry_version(&fc, old_dentry, &scb[1]); |
3059 |
++ afs_update_dentry_version(&fc, new_dentry, &scb[1]); |
3060 |
+ d_move(old_dentry, new_dentry); |
3061 |
++ up_write(&new_dvnode->validate_lock); |
3062 |
+ goto error_tmp; |
3063 |
+ } |
3064 |
+ |
3065 |
+diff --git a/fs/afs/dir_silly.c b/fs/afs/dir_silly.c |
3066 |
+index 361088a5edb9..d94e2b7cddff 100644 |
3067 |
+--- a/fs/afs/dir_silly.c |
3068 |
++++ b/fs/afs/dir_silly.c |
3069 |
+@@ -21,6 +21,7 @@ static int afs_do_silly_rename(struct afs_vnode *dvnode, struct afs_vnode *vnode |
3070 |
+ { |
3071 |
+ struct afs_fs_cursor fc; |
3072 |
+ struct afs_status_cb *scb; |
3073 |
++ afs_dataversion_t dir_data_version; |
3074 |
+ int ret = -ERESTARTSYS; |
3075 |
+ |
3076 |
+ _enter("%pd,%pd", old, new); |
3077 |
+@@ -31,7 +32,7 @@ static int afs_do_silly_rename(struct afs_vnode *dvnode, struct afs_vnode *vnode |
3078 |
+ |
3079 |
+ trace_afs_silly_rename(vnode, false); |
3080 |
+ if (afs_begin_vnode_operation(&fc, dvnode, key, true)) { |
3081 |
+- afs_dataversion_t dir_data_version = dvnode->status.data_version + 1; |
3082 |
++ dir_data_version = dvnode->status.data_version + 1; |
3083 |
+ |
3084 |
+ while (afs_select_fileserver(&fc)) { |
3085 |
+ fc.cb_break = afs_calc_vnode_cb_break(dvnode); |
3086 |
+@@ -54,12 +55,15 @@ static int afs_do_silly_rename(struct afs_vnode *dvnode, struct afs_vnode *vnode |
3087 |
+ dvnode->silly_key = key_get(key); |
3088 |
+ } |
3089 |
+ |
3090 |
+- if (test_bit(AFS_VNODE_DIR_VALID, &dvnode->flags)) |
3091 |
++ down_write(&dvnode->validate_lock); |
3092 |
++ if (test_bit(AFS_VNODE_DIR_VALID, &dvnode->flags) && |
3093 |
++ dvnode->status.data_version == dir_data_version) { |
3094 |
+ afs_edit_dir_remove(dvnode, &old->d_name, |
3095 |
+ afs_edit_dir_for_silly_0); |
3096 |
+- if (test_bit(AFS_VNODE_DIR_VALID, &dvnode->flags)) |
3097 |
+ afs_edit_dir_add(dvnode, &new->d_name, |
3098 |
+ &vnode->fid, afs_edit_dir_for_silly_1); |
3099 |
++ } |
3100 |
++ up_write(&dvnode->validate_lock); |
3101 |
+ } |
3102 |
+ |
3103 |
+ kfree(scb); |
3104 |
+@@ -181,10 +185,14 @@ static int afs_do_silly_unlink(struct afs_vnode *dvnode, struct afs_vnode *vnode |
3105 |
+ clear_bit(AFS_VNODE_CB_PROMISED, &vnode->flags); |
3106 |
+ } |
3107 |
+ } |
3108 |
+- if (ret == 0 && |
3109 |
+- test_bit(AFS_VNODE_DIR_VALID, &dvnode->flags)) |
3110 |
+- afs_edit_dir_remove(dvnode, &dentry->d_name, |
3111 |
+- afs_edit_dir_for_unlink); |
3112 |
++ if (ret == 0) { |
3113 |
++ down_write(&dvnode->validate_lock); |
3114 |
++ if (test_bit(AFS_VNODE_DIR_VALID, &dvnode->flags) && |
3115 |
++ dvnode->status.data_version == dir_data_version) |
3116 |
++ afs_edit_dir_remove(dvnode, &dentry->d_name, |
3117 |
++ afs_edit_dir_for_unlink); |
3118 |
++ up_write(&dvnode->validate_lock); |
3119 |
++ } |
3120 |
+ } |
3121 |
+ |
3122 |
+ kfree(scb); |
3123 |
+diff --git a/fs/afs/fsclient.c b/fs/afs/fsclient.c |
3124 |
+index 6f84231f11a5..6805a469d13c 100644 |
3125 |
+--- a/fs/afs/fsclient.c |
3126 |
++++ b/fs/afs/fsclient.c |
3127 |
+@@ -65,6 +65,7 @@ static int xdr_decode_AFSFetchStatus(const __be32 **_bp, |
3128 |
+ bool inline_error = (call->operation_ID == afs_FS_InlineBulkStatus); |
3129 |
+ u64 data_version, size; |
3130 |
+ u32 type, abort_code; |
3131 |
++ int ret; |
3132 |
+ |
3133 |
+ abort_code = ntohl(xdr->abort_code); |
3134 |
+ |
3135 |
+@@ -78,7 +79,7 @@ static int xdr_decode_AFSFetchStatus(const __be32 **_bp, |
3136 |
+ */ |
3137 |
+ status->abort_code = abort_code; |
3138 |
+ scb->have_error = true; |
3139 |
+- return 0; |
3140 |
++ goto good; |
3141 |
+ } |
3142 |
+ |
3143 |
+ pr_warn("Unknown AFSFetchStatus version %u\n", ntohl(xdr->if_version)); |
3144 |
+@@ -87,7 +88,8 @@ static int xdr_decode_AFSFetchStatus(const __be32 **_bp, |
3145 |
+ |
3146 |
+ if (abort_code != 0 && inline_error) { |
3147 |
+ status->abort_code = abort_code; |
3148 |
+- return 0; |
3149 |
++ scb->have_error = true; |
3150 |
++ goto good; |
3151 |
+ } |
3152 |
+ |
3153 |
+ type = ntohl(xdr->type); |
3154 |
+@@ -123,13 +125,16 @@ static int xdr_decode_AFSFetchStatus(const __be32 **_bp, |
3155 |
+ data_version |= (u64)ntohl(xdr->data_version_hi) << 32; |
3156 |
+ status->data_version = data_version; |
3157 |
+ scb->have_status = true; |
3158 |
+- |
3159 |
++good: |
3160 |
++ ret = 0; |
3161 |
++advance: |
3162 |
+ *_bp = (const void *)*_bp + sizeof(*xdr); |
3163 |
+- return 0; |
3164 |
++ return ret; |
3165 |
+ |
3166 |
+ bad: |
3167 |
+ xdr_dump_bad(*_bp); |
3168 |
+- return afs_protocol_error(call, -EBADMSG, afs_eproto_bad_status); |
3169 |
++ ret = afs_protocol_error(call, -EBADMSG, afs_eproto_bad_status); |
3170 |
++ goto advance; |
3171 |
+ } |
3172 |
+ |
3173 |
+ static time64_t xdr_decode_expiry(struct afs_call *call, u32 expiry) |
3174 |
+@@ -983,16 +988,16 @@ static int afs_deliver_fs_rename(struct afs_call *call) |
3175 |
+ if (ret < 0) |
3176 |
+ return ret; |
3177 |
+ |
3178 |
+- /* unmarshall the reply once we've received all of it */ |
3179 |
++ /* If the two dirs are the same, we have two copies of the same status |
3180 |
++ * report, so we just decode it twice. |
3181 |
++ */ |
3182 |
+ bp = call->buffer; |
3183 |
+ ret = xdr_decode_AFSFetchStatus(&bp, call, call->out_dir_scb); |
3184 |
+ if (ret < 0) |
3185 |
+ return ret; |
3186 |
+- if (call->out_dir_scb != call->out_scb) { |
3187 |
+- ret = xdr_decode_AFSFetchStatus(&bp, call, call->out_scb); |
3188 |
+- if (ret < 0) |
3189 |
+- return ret; |
3190 |
+- } |
3191 |
++ ret = xdr_decode_AFSFetchStatus(&bp, call, call->out_scb); |
3192 |
++ if (ret < 0) |
3193 |
++ return ret; |
3194 |
+ xdr_decode_AFSVolSync(&bp, call->out_volsync); |
3195 |
+ |
3196 |
+ _leave(" = 0 [done]"); |
3197 |
+diff --git a/fs/afs/yfsclient.c b/fs/afs/yfsclient.c |
3198 |
+index 3ee7abf4b2d0..31b236c6b1f7 100644 |
3199 |
+--- a/fs/afs/yfsclient.c |
3200 |
++++ b/fs/afs/yfsclient.c |
3201 |
+@@ -186,13 +186,14 @@ static int xdr_decode_YFSFetchStatus(const __be32 **_bp, |
3202 |
+ const struct yfs_xdr_YFSFetchStatus *xdr = (const void *)*_bp; |
3203 |
+ struct afs_file_status *status = &scb->status; |
3204 |
+ u32 type; |
3205 |
++ int ret; |
3206 |
+ |
3207 |
+ status->abort_code = ntohl(xdr->abort_code); |
3208 |
+ if (status->abort_code != 0) { |
3209 |
+ if (status->abort_code == VNOVNODE) |
3210 |
+ status->nlink = 0; |
3211 |
+ scb->have_error = true; |
3212 |
+- return 0; |
3213 |
++ goto good; |
3214 |
+ } |
3215 |
+ |
3216 |
+ type = ntohl(xdr->type); |
3217 |
+@@ -220,13 +221,16 @@ static int xdr_decode_YFSFetchStatus(const __be32 **_bp, |
3218 |
+ status->size = xdr_to_u64(xdr->size); |
3219 |
+ status->data_version = xdr_to_u64(xdr->data_version); |
3220 |
+ scb->have_status = true; |
3221 |
+- |
3222 |
++good: |
3223 |
++ ret = 0; |
3224 |
++advance: |
3225 |
+ *_bp += xdr_size(xdr); |
3226 |
+- return 0; |
3227 |
++ return ret; |
3228 |
+ |
3229 |
+ bad: |
3230 |
+ xdr_dump_bad(*_bp); |
3231 |
+- return afs_protocol_error(call, -EBADMSG, afs_eproto_bad_status); |
3232 |
++ ret = afs_protocol_error(call, -EBADMSG, afs_eproto_bad_status); |
3233 |
++ goto advance; |
3234 |
+ } |
3235 |
+ |
3236 |
+ /* |
3237 |
+@@ -1154,11 +1158,9 @@ static int yfs_deliver_fs_rename(struct afs_call *call) |
3238 |
+ ret = xdr_decode_YFSFetchStatus(&bp, call, call->out_dir_scb); |
3239 |
+ if (ret < 0) |
3240 |
+ return ret; |
3241 |
+- if (call->out_dir_scb != call->out_scb) { |
3242 |
+- ret = xdr_decode_YFSFetchStatus(&bp, call, call->out_scb); |
3243 |
+- if (ret < 0) |
3244 |
+- return ret; |
3245 |
+- } |
3246 |
++ ret = xdr_decode_YFSFetchStatus(&bp, call, call->out_scb); |
3247 |
++ if (ret < 0) |
3248 |
++ return ret; |
3249 |
+ |
3250 |
+ xdr_decode_YFSVolSync(&bp, call->out_volsync); |
3251 |
+ _leave(" = 0 [done]"); |
3252 |
+diff --git a/fs/block_dev.c b/fs/block_dev.c |
3253 |
+index d612468ee66b..34644ce4b502 100644 |
3254 |
+--- a/fs/block_dev.c |
3255 |
++++ b/fs/block_dev.c |
3256 |
+@@ -34,6 +34,7 @@ |
3257 |
+ #include <linux/task_io_accounting_ops.h> |
3258 |
+ #include <linux/falloc.h> |
3259 |
+ #include <linux/uaccess.h> |
3260 |
++#include <linux/suspend.h> |
3261 |
+ #include "internal.h" |
3262 |
+ |
3263 |
+ struct bdev_inode { |
3264 |
+@@ -1975,7 +1976,8 @@ ssize_t blkdev_write_iter(struct kiocb *iocb, struct iov_iter *from) |
3265 |
+ if (bdev_read_only(I_BDEV(bd_inode))) |
3266 |
+ return -EPERM; |
3267 |
+ |
3268 |
+- if (IS_SWAPFILE(bd_inode)) |
3269 |
++ /* uswsusp needs write permission to the swap */ |
3270 |
++ if (IS_SWAPFILE(bd_inode) && !hibernation_available()) |
3271 |
+ return -ETXTBSY; |
3272 |
+ |
3273 |
+ if (!iov_iter_count(from)) |
3274 |
+diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c |
3275 |
+index 7dcfa7d7632a..95330f40f998 100644 |
3276 |
+--- a/fs/btrfs/block-group.c |
3277 |
++++ b/fs/btrfs/block-group.c |
3278 |
+@@ -1829,6 +1829,7 @@ int btrfs_read_block_groups(struct btrfs_fs_info *info) |
3279 |
+ } |
3280 |
+ } |
3281 |
+ |
3282 |
++ rcu_read_lock(); |
3283 |
+ list_for_each_entry_rcu(space_info, &info->space_info, list) { |
3284 |
+ if (!(btrfs_get_alloc_profile(info, space_info->flags) & |
3285 |
+ (BTRFS_BLOCK_GROUP_RAID10 | |
3286 |
+@@ -1849,6 +1850,7 @@ int btrfs_read_block_groups(struct btrfs_fs_info *info) |
3287 |
+ list) |
3288 |
+ inc_block_group_ro(cache, 1); |
3289 |
+ } |
3290 |
++ rcu_read_unlock(); |
3291 |
+ |
3292 |
+ btrfs_init_global_block_rsv(info); |
3293 |
+ ret = check_chunk_block_group_mappings(info); |
3294 |
+diff --git a/fs/buffer.c b/fs/buffer.c |
3295 |
+index 91ceca52d14f..79c9562434a8 100644 |
3296 |
+--- a/fs/buffer.c |
3297 |
++++ b/fs/buffer.c |
3298 |
+@@ -1337,6 +1337,17 @@ void __breadahead(struct block_device *bdev, sector_t block, unsigned size) |
3299 |
+ } |
3300 |
+ EXPORT_SYMBOL(__breadahead); |
3301 |
+ |
3302 |
++void __breadahead_gfp(struct block_device *bdev, sector_t block, unsigned size, |
3303 |
++ gfp_t gfp) |
3304 |
++{ |
3305 |
++ struct buffer_head *bh = __getblk_gfp(bdev, block, size, gfp); |
3306 |
++ if (likely(bh)) { |
3307 |
++ ll_rw_block(REQ_OP_READ, REQ_RAHEAD, 1, &bh); |
3308 |
++ brelse(bh); |
3309 |
++ } |
3310 |
++} |
3311 |
++EXPORT_SYMBOL(__breadahead_gfp); |
3312 |
++ |
3313 |
+ /** |
3314 |
+ * __bread_gfp() - reads a specified block and returns the bh |
3315 |
+ * @bdev: the block_device to read from |
3316 |
+diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c |
3317 |
+index e67a43fd037c..fe1552cc8a0a 100644 |
3318 |
+--- a/fs/cifs/transport.c |
3319 |
++++ b/fs/cifs/transport.c |
3320 |
+@@ -466,7 +466,7 @@ smb_send_rqst(struct TCP_Server_Info *server, int num_rqst, |
3321 |
+ struct smb_rqst *rqst, int flags) |
3322 |
+ { |
3323 |
+ struct kvec iov; |
3324 |
+- struct smb2_transform_hdr tr_hdr; |
3325 |
++ struct smb2_transform_hdr *tr_hdr; |
3326 |
+ struct smb_rqst cur_rqst[MAX_COMPOUND]; |
3327 |
+ int rc; |
3328 |
+ |
3329 |
+@@ -476,28 +476,34 @@ smb_send_rqst(struct TCP_Server_Info *server, int num_rqst, |
3330 |
+ if (num_rqst > MAX_COMPOUND - 1) |
3331 |
+ return -ENOMEM; |
3332 |
+ |
3333 |
+- memset(&cur_rqst[0], 0, sizeof(cur_rqst)); |
3334 |
+- memset(&iov, 0, sizeof(iov)); |
3335 |
+- memset(&tr_hdr, 0, sizeof(tr_hdr)); |
3336 |
+- |
3337 |
+- iov.iov_base = &tr_hdr; |
3338 |
+- iov.iov_len = sizeof(tr_hdr); |
3339 |
+- cur_rqst[0].rq_iov = &iov; |
3340 |
+- cur_rqst[0].rq_nvec = 1; |
3341 |
+- |
3342 |
+ if (!server->ops->init_transform_rq) { |
3343 |
+ cifs_server_dbg(VFS, "Encryption requested but transform " |
3344 |
+ "callback is missing\n"); |
3345 |
+ return -EIO; |
3346 |
+ } |
3347 |
+ |
3348 |
++ tr_hdr = kmalloc(sizeof(*tr_hdr), GFP_NOFS); |
3349 |
++ if (!tr_hdr) |
3350 |
++ return -ENOMEM; |
3351 |
++ |
3352 |
++ memset(&cur_rqst[0], 0, sizeof(cur_rqst)); |
3353 |
++ memset(&iov, 0, sizeof(iov)); |
3354 |
++ memset(tr_hdr, 0, sizeof(*tr_hdr)); |
3355 |
++ |
3356 |
++ iov.iov_base = tr_hdr; |
3357 |
++ iov.iov_len = sizeof(*tr_hdr); |
3358 |
++ cur_rqst[0].rq_iov = &iov; |
3359 |
++ cur_rqst[0].rq_nvec = 1; |
3360 |
++ |
3361 |
+ rc = server->ops->init_transform_rq(server, num_rqst + 1, |
3362 |
+ &cur_rqst[0], rqst); |
3363 |
+ if (rc) |
3364 |
+- return rc; |
3365 |
++ goto out; |
3366 |
+ |
3367 |
+ rc = __smb_send_rqst(server, num_rqst + 1, &cur_rqst[0]); |
3368 |
+ smb3_free_compound_rqst(num_rqst, &cur_rqst[1]); |
3369 |
++out: |
3370 |
++ kfree(tr_hdr); |
3371 |
+ return rc; |
3372 |
+ } |
3373 |
+ |
3374 |
+diff --git a/fs/ext2/xattr.c b/fs/ext2/xattr.c |
3375 |
+index 0456bc990b5e..62acbe27d8bf 100644 |
3376 |
+--- a/fs/ext2/xattr.c |
3377 |
++++ b/fs/ext2/xattr.c |
3378 |
+@@ -56,6 +56,7 @@ |
3379 |
+ |
3380 |
+ #include <linux/buffer_head.h> |
3381 |
+ #include <linux/init.h> |
3382 |
++#include <linux/printk.h> |
3383 |
+ #include <linux/slab.h> |
3384 |
+ #include <linux/mbcache.h> |
3385 |
+ #include <linux/quotaops.h> |
3386 |
+@@ -84,8 +85,8 @@ |
3387 |
+ printk("\n"); \ |
3388 |
+ } while (0) |
3389 |
+ #else |
3390 |
+-# define ea_idebug(f...) |
3391 |
+-# define ea_bdebug(f...) |
3392 |
++# define ea_idebug(inode, f...) no_printk(f) |
3393 |
++# define ea_bdebug(bh, f...) no_printk(f) |
3394 |
+ #endif |
3395 |
+ |
3396 |
+ static int ext2_xattr_set2(struct inode *, struct buffer_head *, |
3397 |
+@@ -864,8 +865,7 @@ ext2_xattr_cache_insert(struct mb_cache *cache, struct buffer_head *bh) |
3398 |
+ true); |
3399 |
+ if (error) { |
3400 |
+ if (error == -EBUSY) { |
3401 |
+- ea_bdebug(bh, "already in cache (%d cache entries)", |
3402 |
+- atomic_read(&ext2_xattr_cache->c_entry_count)); |
3403 |
++ ea_bdebug(bh, "already in cache"); |
3404 |
+ error = 0; |
3405 |
+ } |
3406 |
+ } else |
3407 |
+diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c |
3408 |
+index d2edd6e9072f..b9473fcc110f 100644 |
3409 |
+--- a/fs/ext4/inode.c |
3410 |
++++ b/fs/ext4/inode.c |
3411 |
+@@ -4680,7 +4680,7 @@ make_io: |
3412 |
+ if (end > table) |
3413 |
+ end = table; |
3414 |
+ while (b <= end) |
3415 |
+- sb_breadahead(sb, b++); |
3416 |
++ sb_breadahead_unmovable(sb, b++); |
3417 |
+ } |
3418 |
+ |
3419 |
+ /* |
3420 |
+diff --git a/fs/ext4/super.c b/fs/ext4/super.c |
3421 |
+index a1eca6d30643..53d4c67a20df 100644 |
3422 |
+--- a/fs/ext4/super.c |
3423 |
++++ b/fs/ext4/super.c |
3424 |
+@@ -389,7 +389,8 @@ static void save_error_info(struct super_block *sb, const char *func, |
3425 |
+ unsigned int line) |
3426 |
+ { |
3427 |
+ __save_error_info(sb, func, line); |
3428 |
+- ext4_commit_super(sb, 1); |
3429 |
++ if (!bdev_read_only(sb->s_bdev)) |
3430 |
++ ext4_commit_super(sb, 1); |
3431 |
+ } |
3432 |
+ |
3433 |
+ /* |
3434 |
+@@ -4283,7 +4284,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) |
3435 |
+ /* Pre-read the descriptors into the buffer cache */ |
3436 |
+ for (i = 0; i < db_count; i++) { |
3437 |
+ block = descriptor_loc(sb, logical_sb_block, i); |
3438 |
+- sb_breadahead(sb, block); |
3439 |
++ sb_breadahead_unmovable(sb, block); |
3440 |
+ } |
3441 |
+ |
3442 |
+ for (i = 0; i < db_count; i++) { |
3443 |
+diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c |
3444 |
+index a0eef95b9e0e..a28ffecc0f95 100644 |
3445 |
+--- a/fs/f2fs/checkpoint.c |
3446 |
++++ b/fs/f2fs/checkpoint.c |
3447 |
+@@ -1250,20 +1250,20 @@ static void unblock_operations(struct f2fs_sb_info *sbi) |
3448 |
+ f2fs_unlock_all(sbi); |
3449 |
+ } |
3450 |
+ |
3451 |
+-void f2fs_wait_on_all_pages_writeback(struct f2fs_sb_info *sbi) |
3452 |
++void f2fs_wait_on_all_pages(struct f2fs_sb_info *sbi, int type) |
3453 |
+ { |
3454 |
+ DEFINE_WAIT(wait); |
3455 |
+ |
3456 |
+ for (;;) { |
3457 |
+ prepare_to_wait(&sbi->cp_wait, &wait, TASK_UNINTERRUPTIBLE); |
3458 |
+ |
3459 |
+- if (!get_pages(sbi, F2FS_WB_CP_DATA)) |
3460 |
++ if (!get_pages(sbi, type)) |
3461 |
+ break; |
3462 |
+ |
3463 |
+ if (unlikely(f2fs_cp_error(sbi))) |
3464 |
+ break; |
3465 |
+ |
3466 |
+- io_schedule_timeout(5*HZ); |
3467 |
++ io_schedule_timeout(HZ/50); |
3468 |
+ } |
3469 |
+ finish_wait(&sbi->cp_wait, &wait); |
3470 |
+ } |
3471 |
+@@ -1301,10 +1301,14 @@ static void update_ckpt_flags(struct f2fs_sb_info *sbi, struct cp_control *cpc) |
3472 |
+ else |
3473 |
+ __clear_ckpt_flags(ckpt, CP_ORPHAN_PRESENT_FLAG); |
3474 |
+ |
3475 |
+- if (is_sbi_flag_set(sbi, SBI_NEED_FSCK) || |
3476 |
+- is_sbi_flag_set(sbi, SBI_IS_RESIZEFS)) |
3477 |
++ if (is_sbi_flag_set(sbi, SBI_NEED_FSCK)) |
3478 |
+ __set_ckpt_flags(ckpt, CP_FSCK_FLAG); |
3479 |
+ |
3480 |
++ if (is_sbi_flag_set(sbi, SBI_IS_RESIZEFS)) |
3481 |
++ __set_ckpt_flags(ckpt, CP_RESIZEFS_FLAG); |
3482 |
++ else |
3483 |
++ __clear_ckpt_flags(ckpt, CP_RESIZEFS_FLAG); |
3484 |
++ |
3485 |
+ if (is_sbi_flag_set(sbi, SBI_CP_DISABLED)) |
3486 |
+ __set_ckpt_flags(ckpt, CP_DISABLED_FLAG); |
3487 |
+ else |
3488 |
+@@ -1384,8 +1388,6 @@ static int do_checkpoint(struct f2fs_sb_info *sbi, struct cp_control *cpc) |
3489 |
+ |
3490 |
+ /* Flush all the NAT/SIT pages */ |
3491 |
+ f2fs_sync_meta_pages(sbi, META, LONG_MAX, FS_CP_META_IO); |
3492 |
+- f2fs_bug_on(sbi, get_pages(sbi, F2FS_DIRTY_META) && |
3493 |
+- !f2fs_cp_error(sbi)); |
3494 |
+ |
3495 |
+ /* |
3496 |
+ * modify checkpoint |
3497 |
+@@ -1493,11 +1495,11 @@ static int do_checkpoint(struct f2fs_sb_info *sbi, struct cp_control *cpc) |
3498 |
+ |
3499 |
+ /* Here, we have one bio having CP pack except cp pack 2 page */ |
3500 |
+ f2fs_sync_meta_pages(sbi, META, LONG_MAX, FS_CP_META_IO); |
3501 |
+- f2fs_bug_on(sbi, get_pages(sbi, F2FS_DIRTY_META) && |
3502 |
+- !f2fs_cp_error(sbi)); |
3503 |
++ /* Wait for all dirty meta pages to be submitted for IO */ |
3504 |
++ f2fs_wait_on_all_pages(sbi, F2FS_DIRTY_META); |
3505 |
+ |
3506 |
+ /* wait for previous submitted meta pages writeback */ |
3507 |
+- f2fs_wait_on_all_pages_writeback(sbi); |
3508 |
++ f2fs_wait_on_all_pages(sbi, F2FS_WB_CP_DATA); |
3509 |
+ |
3510 |
+ /* flush all device cache */ |
3511 |
+ err = f2fs_flush_device_cache(sbi); |
3512 |
+@@ -1506,7 +1508,7 @@ static int do_checkpoint(struct f2fs_sb_info *sbi, struct cp_control *cpc) |
3513 |
+ |
3514 |
+ /* barrier and flush checkpoint cp pack 2 page if it can */ |
3515 |
+ commit_checkpoint(sbi, ckpt, start_blk); |
3516 |
+- f2fs_wait_on_all_pages_writeback(sbi); |
3517 |
++ f2fs_wait_on_all_pages(sbi, F2FS_WB_CP_DATA); |
3518 |
+ |
3519 |
+ /* |
3520 |
+ * invalidate intermediate page cache borrowed from meta inode |
3521 |
+diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h |
3522 |
+index 9046432b87c2..3edde3d6d089 100644 |
3523 |
+--- a/fs/f2fs/f2fs.h |
3524 |
++++ b/fs/f2fs/f2fs.h |
3525 |
+@@ -100,6 +100,7 @@ extern const char *f2fs_fault_name[FAULT_MAX]; |
3526 |
+ #define F2FS_MOUNT_INLINE_XATTR_SIZE 0x00800000 |
3527 |
+ #define F2FS_MOUNT_RESERVE_ROOT 0x01000000 |
3528 |
+ #define F2FS_MOUNT_DISABLE_CHECKPOINT 0x02000000 |
3529 |
++#define F2FS_MOUNT_NORECOVERY 0x04000000 |
3530 |
+ |
3531 |
+ #define F2FS_OPTION(sbi) ((sbi)->mount_opt) |
3532 |
+ #define clear_opt(sbi, option) (F2FS_OPTION(sbi).opt &= ~F2FS_MOUNT_##option) |
3533 |
+@@ -3185,7 +3186,7 @@ int f2fs_get_valid_checkpoint(struct f2fs_sb_info *sbi); |
3534 |
+ void f2fs_update_dirty_page(struct inode *inode, struct page *page); |
3535 |
+ void f2fs_remove_dirty_inode(struct inode *inode); |
3536 |
+ int f2fs_sync_dirty_inodes(struct f2fs_sb_info *sbi, enum inode_type type); |
3537 |
+-void f2fs_wait_on_all_pages_writeback(struct f2fs_sb_info *sbi); |
3538 |
++void f2fs_wait_on_all_pages(struct f2fs_sb_info *sbi, int type); |
3539 |
+ int f2fs_write_checkpoint(struct f2fs_sb_info *sbi, struct cp_control *cpc); |
3540 |
+ void f2fs_init_ino_entry_info(struct f2fs_sb_info *sbi); |
3541 |
+ int __init f2fs_create_checkpoint_caches(void); |
3542 |
+diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c |
3543 |
+index 5877bd729689..e611d768efde 100644 |
3544 |
+--- a/fs/f2fs/gc.c |
3545 |
++++ b/fs/f2fs/gc.c |
3546 |
+@@ -1532,11 +1532,17 @@ int f2fs_resize_fs(struct f2fs_sb_info *sbi, __u64 block_count) |
3547 |
+ goto out; |
3548 |
+ } |
3549 |
+ |
3550 |
++ mutex_lock(&sbi->cp_mutex); |
3551 |
+ update_fs_metadata(sbi, -secs); |
3552 |
+ clear_sbi_flag(sbi, SBI_IS_RESIZEFS); |
3553 |
++ set_sbi_flag(sbi, SBI_IS_DIRTY); |
3554 |
++ mutex_unlock(&sbi->cp_mutex); |
3555 |
++ |
3556 |
+ err = f2fs_sync_fs(sbi->sb, 1); |
3557 |
+ if (err) { |
3558 |
++ mutex_lock(&sbi->cp_mutex); |
3559 |
+ update_fs_metadata(sbi, secs); |
3560 |
++ mutex_unlock(&sbi->cp_mutex); |
3561 |
+ update_sb_metadata(sbi, secs); |
3562 |
+ f2fs_commit_super(sbi, false); |
3563 |
+ } |
3564 |
+diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c |
3565 |
+index 8b66bc4c004b..f14401a77d60 100644 |
3566 |
+--- a/fs/f2fs/node.c |
3567 |
++++ b/fs/f2fs/node.c |
3568 |
+@@ -1562,15 +1562,16 @@ static int __write_node_page(struct page *page, bool atomic, bool *submitted, |
3569 |
+ if (atomic && !test_opt(sbi, NOBARRIER)) |
3570 |
+ fio.op_flags |= REQ_PREFLUSH | REQ_FUA; |
3571 |
+ |
3572 |
+- set_page_writeback(page); |
3573 |
+- ClearPageError(page); |
3574 |
+- |
3575 |
++ /* should add to global list before clearing PAGECACHE status */ |
3576 |
+ if (f2fs_in_warm_node_list(sbi, page)) { |
3577 |
+ seq = f2fs_add_fsync_node_entry(sbi, page); |
3578 |
+ if (seq_id) |
3579 |
+ *seq_id = seq; |
3580 |
+ } |
3581 |
+ |
3582 |
++ set_page_writeback(page); |
3583 |
++ ClearPageError(page); |
3584 |
++ |
3585 |
+ fio.old_blkaddr = ni.blk_addr; |
3586 |
+ f2fs_do_write_node_page(nid, &fio); |
3587 |
+ set_node_addr(sbi, &ni, fio.new_blkaddr, is_fsync_dnode(page)); |
3588 |
+diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c |
3589 |
+index ea8dbf1458c9..5e1d4d9243a9 100644 |
3590 |
+--- a/fs/f2fs/super.c |
3591 |
++++ b/fs/f2fs/super.c |
3592 |
+@@ -439,7 +439,7 @@ static int parse_options(struct super_block *sb, char *options) |
3593 |
+ break; |
3594 |
+ case Opt_norecovery: |
3595 |
+ /* this option mounts f2fs with ro */ |
3596 |
+- set_opt(sbi, DISABLE_ROLL_FORWARD); |
3597 |
++ set_opt(sbi, NORECOVERY); |
3598 |
+ if (!f2fs_readonly(sb)) |
3599 |
+ return -EINVAL; |
3600 |
+ break; |
3601 |
+@@ -1105,7 +1105,7 @@ static void f2fs_put_super(struct super_block *sb) |
3602 |
+ /* our cp_error case, we can wait for any writeback page */ |
3603 |
+ f2fs_flush_merged_writes(sbi); |
3604 |
+ |
3605 |
+- f2fs_wait_on_all_pages_writeback(sbi); |
3606 |
++ f2fs_wait_on_all_pages(sbi, F2FS_WB_CP_DATA); |
3607 |
+ |
3608 |
+ f2fs_bug_on(sbi, sbi->fsync_node_num); |
3609 |
+ |
3610 |
+@@ -1348,6 +1348,8 @@ static int f2fs_show_options(struct seq_file *seq, struct dentry *root) |
3611 |
+ } |
3612 |
+ if (test_opt(sbi, DISABLE_ROLL_FORWARD)) |
3613 |
+ seq_puts(seq, ",disable_roll_forward"); |
3614 |
++ if (test_opt(sbi, NORECOVERY)) |
3615 |
++ seq_puts(seq, ",norecovery"); |
3616 |
+ if (test_opt(sbi, DISCARD)) |
3617 |
+ seq_puts(seq, ",discard"); |
3618 |
+ else |
3619 |
+@@ -1824,6 +1826,7 @@ static ssize_t f2fs_quota_write(struct super_block *sb, int type, |
3620 |
+ int offset = off & (sb->s_blocksize - 1); |
3621 |
+ size_t towrite = len; |
3622 |
+ struct page *page; |
3623 |
++ void *fsdata = NULL; |
3624 |
+ char *kaddr; |
3625 |
+ int err = 0; |
3626 |
+ int tocopy; |
3627 |
+@@ -1833,7 +1836,7 @@ static ssize_t f2fs_quota_write(struct super_block *sb, int type, |
3628 |
+ towrite); |
3629 |
+ retry: |
3630 |
+ err = a_ops->write_begin(NULL, mapping, off, tocopy, 0, |
3631 |
+- &page, NULL); |
3632 |
++ &page, &fsdata); |
3633 |
+ if (unlikely(err)) { |
3634 |
+ if (err == -ENOMEM) { |
3635 |
+ congestion_wait(BLK_RW_ASYNC, HZ/50); |
3636 |
+@@ -1849,7 +1852,7 @@ retry: |
3637 |
+ flush_dcache_page(page); |
3638 |
+ |
3639 |
+ a_ops->write_end(NULL, mapping, off, tocopy, tocopy, |
3640 |
+- page, NULL); |
3641 |
++ page, fsdata); |
3642 |
+ offset = 0; |
3643 |
+ towrite -= tocopy; |
3644 |
+ off += tocopy; |
3645 |
+@@ -3488,7 +3491,8 @@ try_onemore: |
3646 |
+ goto reset_checkpoint; |
3647 |
+ |
3648 |
+ /* recover fsynced data */ |
3649 |
+- if (!test_opt(sbi, DISABLE_ROLL_FORWARD)) { |
3650 |
++ if (!test_opt(sbi, DISABLE_ROLL_FORWARD) && |
3651 |
++ !test_opt(sbi, NORECOVERY)) { |
3652 |
+ /* |
3653 |
+ * mount should be failed, when device has readonly mode, and |
3654 |
+ * previous checkpoint was not done by clean system shutdown. |
3655 |
+diff --git a/fs/nfs/callback_proc.c b/fs/nfs/callback_proc.c |
3656 |
+index f39924ba050b..fc775b0b5194 100644 |
3657 |
+--- a/fs/nfs/callback_proc.c |
3658 |
++++ b/fs/nfs/callback_proc.c |
3659 |
+@@ -130,6 +130,8 @@ static struct inode *nfs_layout_find_inode_by_stateid(struct nfs_client *clp, |
3660 |
+ |
3661 |
+ list_for_each_entry_rcu(server, &clp->cl_superblocks, client_link) { |
3662 |
+ list_for_each_entry(lo, &server->layouts, plh_layouts) { |
3663 |
++ if (!pnfs_layout_is_valid(lo)) |
3664 |
++ continue; |
3665 |
+ if (stateid != NULL && |
3666 |
+ !nfs4_stateid_match_other(stateid, &lo->plh_stateid)) |
3667 |
+ continue; |
3668 |
+diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c |
3669 |
+index 29f00da8a0b7..6b0bf4ebd812 100644 |
3670 |
+--- a/fs/nfs/direct.c |
3671 |
++++ b/fs/nfs/direct.c |
3672 |
+@@ -571,6 +571,7 @@ ssize_t nfs_file_direct_read(struct kiocb *iocb, struct iov_iter *iter) |
3673 |
+ l_ctx = nfs_get_lock_context(dreq->ctx); |
3674 |
+ if (IS_ERR(l_ctx)) { |
3675 |
+ result = PTR_ERR(l_ctx); |
3676 |
++ nfs_direct_req_release(dreq); |
3677 |
+ goto out_release; |
3678 |
+ } |
3679 |
+ dreq->l_ctx = l_ctx; |
3680 |
+@@ -989,6 +990,7 @@ ssize_t nfs_file_direct_write(struct kiocb *iocb, struct iov_iter *iter) |
3681 |
+ l_ctx = nfs_get_lock_context(dreq->ctx); |
3682 |
+ if (IS_ERR(l_ctx)) { |
3683 |
+ result = PTR_ERR(l_ctx); |
3684 |
++ nfs_direct_req_release(dreq); |
3685 |
+ goto out_release; |
3686 |
+ } |
3687 |
+ dreq->l_ctx = l_ctx; |
3688 |
+diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c |
3689 |
+index 2a03bfeec10a..3802c88e8372 100644 |
3690 |
+--- a/fs/nfs/inode.c |
3691 |
++++ b/fs/nfs/inode.c |
3692 |
+@@ -959,16 +959,16 @@ struct nfs_open_context *alloc_nfs_open_context(struct dentry *dentry, |
3693 |
+ struct file *filp) |
3694 |
+ { |
3695 |
+ struct nfs_open_context *ctx; |
3696 |
+- const struct cred *cred = get_current_cred(); |
3697 |
+ |
3698 |
+ ctx = kmalloc(sizeof(*ctx), GFP_KERNEL); |
3699 |
+- if (!ctx) { |
3700 |
+- put_cred(cred); |
3701 |
++ if (!ctx) |
3702 |
+ return ERR_PTR(-ENOMEM); |
3703 |
+- } |
3704 |
+ nfs_sb_active(dentry->d_sb); |
3705 |
+ ctx->dentry = dget(dentry); |
3706 |
+- ctx->cred = cred; |
3707 |
++ if (filp) |
3708 |
++ ctx->cred = get_cred(filp->f_cred); |
3709 |
++ else |
3710 |
++ ctx->cred = get_current_cred(); |
3711 |
+ ctx->ll_cred = NULL; |
3712 |
+ ctx->state = NULL; |
3713 |
+ ctx->mode = f_mode; |
3714 |
+diff --git a/fs/nfs/nfs4file.c b/fs/nfs/nfs4file.c |
3715 |
+index 54f1c1f626fc..fb55c04cdc6b 100644 |
3716 |
+--- a/fs/nfs/nfs4file.c |
3717 |
++++ b/fs/nfs/nfs4file.c |
3718 |
+@@ -210,6 +210,9 @@ static loff_t nfs42_remap_file_range(struct file *src_file, loff_t src_off, |
3719 |
+ if (remap_flags & ~REMAP_FILE_ADVISORY) |
3720 |
+ return -EINVAL; |
3721 |
+ |
3722 |
++ if (IS_SWAPFILE(dst_inode) || IS_SWAPFILE(src_inode)) |
3723 |
++ return -ETXTBSY; |
3724 |
++ |
3725 |
+ /* check alignment w.r.t. clone_blksize */ |
3726 |
+ ret = -EINVAL; |
3727 |
+ if (bs) { |
3728 |
+diff --git a/fs/nfs/pagelist.c b/fs/nfs/pagelist.c |
3729 |
+index 8b7c525dbbf7..b736912098ee 100644 |
3730 |
+--- a/fs/nfs/pagelist.c |
3731 |
++++ b/fs/nfs/pagelist.c |
3732 |
+@@ -886,15 +886,6 @@ static void nfs_pageio_setup_mirroring(struct nfs_pageio_descriptor *pgio, |
3733 |
+ pgio->pg_mirror_count = mirror_count; |
3734 |
+ } |
3735 |
+ |
3736 |
+-/* |
3737 |
+- * nfs_pageio_stop_mirroring - stop using mirroring (set mirror count to 1) |
3738 |
+- */ |
3739 |
+-void nfs_pageio_stop_mirroring(struct nfs_pageio_descriptor *pgio) |
3740 |
+-{ |
3741 |
+- pgio->pg_mirror_count = 1; |
3742 |
+- pgio->pg_mirror_idx = 0; |
3743 |
+-} |
3744 |
+- |
3745 |
+ static void nfs_pageio_cleanup_mirroring(struct nfs_pageio_descriptor *pgio) |
3746 |
+ { |
3747 |
+ pgio->pg_mirror_count = 1; |
3748 |
+@@ -1320,6 +1311,14 @@ void nfs_pageio_cond_complete(struct nfs_pageio_descriptor *desc, pgoff_t index) |
3749 |
+ } |
3750 |
+ } |
3751 |
+ |
3752 |
++/* |
3753 |
++ * nfs_pageio_stop_mirroring - stop using mirroring (set mirror count to 1) |
3754 |
++ */ |
3755 |
++void nfs_pageio_stop_mirroring(struct nfs_pageio_descriptor *pgio) |
3756 |
++{ |
3757 |
++ nfs_pageio_complete(pgio); |
3758 |
++} |
3759 |
++ |
3760 |
+ int __init nfs_init_nfspagecache(void) |
3761 |
+ { |
3762 |
+ nfs_page_cachep = kmem_cache_create("nfs_page", |
3763 |
+diff --git a/include/acpi/processor.h b/include/acpi/processor.h |
3764 |
+index 47805172e73d..683e124ad517 100644 |
3765 |
+--- a/include/acpi/processor.h |
3766 |
++++ b/include/acpi/processor.h |
3767 |
+@@ -297,6 +297,14 @@ static inline void acpi_processor_ffh_cstate_enter(struct acpi_processor_cx |
3768 |
+ } |
3769 |
+ #endif |
3770 |
+ |
3771 |
++static inline int call_on_cpu(int cpu, long (*fn)(void *), void *arg, |
3772 |
++ bool direct) |
3773 |
++{ |
3774 |
++ if (direct || (is_percpu_thread() && cpu == smp_processor_id())) |
3775 |
++ return fn(arg); |
3776 |
++ return work_on_cpu(cpu, fn, arg); |
3777 |
++} |
3778 |
++ |
3779 |
+ /* in processor_perflib.c */ |
3780 |
+ |
3781 |
+ #ifdef CONFIG_CPU_FREQ |
3782 |
+diff --git a/include/asm-generic/mshyperv.h b/include/asm-generic/mshyperv.h |
3783 |
+index 18d8e2d8210f..53759d2b9c26 100644 |
3784 |
+--- a/include/asm-generic/mshyperv.h |
3785 |
++++ b/include/asm-generic/mshyperv.h |
3786 |
+@@ -163,7 +163,7 @@ static inline int cpumask_to_vpset(struct hv_vpset *vpset, |
3787 |
+ return nr_bank; |
3788 |
+ } |
3789 |
+ |
3790 |
+-void hyperv_report_panic(struct pt_regs *regs, long err); |
3791 |
++void hyperv_report_panic(struct pt_regs *regs, long err, bool in_die); |
3792 |
+ void hyperv_report_panic_msg(phys_addr_t pa, size_t size); |
3793 |
+ bool hv_is_hyperv_initialized(void); |
3794 |
+ void hyperv_cleanup(void); |
3795 |
+diff --git a/include/keys/big_key-type.h b/include/keys/big_key-type.h |
3796 |
+index f6a7ba4dccd4..3fee04f81439 100644 |
3797 |
+--- a/include/keys/big_key-type.h |
3798 |
++++ b/include/keys/big_key-type.h |
3799 |
+@@ -17,6 +17,6 @@ extern void big_key_free_preparse(struct key_preparsed_payload *prep); |
3800 |
+ extern void big_key_revoke(struct key *key); |
3801 |
+ extern void big_key_destroy(struct key *key); |
3802 |
+ extern void big_key_describe(const struct key *big_key, struct seq_file *m); |
3803 |
+-extern long big_key_read(const struct key *key, char __user *buffer, size_t buflen); |
3804 |
++extern long big_key_read(const struct key *key, char *buffer, size_t buflen); |
3805 |
+ |
3806 |
+ #endif /* _KEYS_BIG_KEY_TYPE_H */ |
3807 |
+diff --git a/include/keys/user-type.h b/include/keys/user-type.h |
3808 |
+index d5e73266a81a..be61fcddc02a 100644 |
3809 |
+--- a/include/keys/user-type.h |
3810 |
++++ b/include/keys/user-type.h |
3811 |
+@@ -41,8 +41,7 @@ extern int user_update(struct key *key, struct key_preparsed_payload *prep); |
3812 |
+ extern void user_revoke(struct key *key); |
3813 |
+ extern void user_destroy(struct key *key); |
3814 |
+ extern void user_describe(const struct key *user, struct seq_file *m); |
3815 |
+-extern long user_read(const struct key *key, |
3816 |
+- char __user *buffer, size_t buflen); |
3817 |
++extern long user_read(const struct key *key, char *buffer, size_t buflen); |
3818 |
+ |
3819 |
+ static inline const struct user_key_payload *user_key_payload_rcu(const struct key *key) |
3820 |
+ { |
3821 |
+diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h |
3822 |
+index 7b73ef7f902d..b56cc825f64d 100644 |
3823 |
+--- a/include/linux/buffer_head.h |
3824 |
++++ b/include/linux/buffer_head.h |
3825 |
+@@ -189,6 +189,8 @@ struct buffer_head *__getblk_gfp(struct block_device *bdev, sector_t block, |
3826 |
+ void __brelse(struct buffer_head *); |
3827 |
+ void __bforget(struct buffer_head *); |
3828 |
+ void __breadahead(struct block_device *, sector_t block, unsigned int size); |
3829 |
++void __breadahead_gfp(struct block_device *, sector_t block, unsigned int size, |
3830 |
++ gfp_t gfp); |
3831 |
+ struct buffer_head *__bread_gfp(struct block_device *, |
3832 |
+ sector_t block, unsigned size, gfp_t gfp); |
3833 |
+ void invalidate_bh_lrus(void); |
3834 |
+@@ -319,6 +321,12 @@ sb_breadahead(struct super_block *sb, sector_t block) |
3835 |
+ __breadahead(sb->s_bdev, block, sb->s_blocksize); |
3836 |
+ } |
3837 |
+ |
3838 |
++static inline void |
3839 |
++sb_breadahead_unmovable(struct super_block *sb, sector_t block) |
3840 |
++{ |
3841 |
++ __breadahead_gfp(sb->s_bdev, block, sb->s_blocksize, 0); |
3842 |
++} |
3843 |
++ |
3844 |
+ static inline struct buffer_head * |
3845 |
+ sb_getblk(struct super_block *sb, sector_t block) |
3846 |
+ { |
3847 |
+diff --git a/include/linux/compiler.h b/include/linux/compiler.h |
3848 |
+index 5e88e7e33abe..034b0a644efc 100644 |
3849 |
+--- a/include/linux/compiler.h |
3850 |
++++ b/include/linux/compiler.h |
3851 |
+@@ -347,7 +347,7 @@ static inline void *offset_to_ptr(const int *off) |
3852 |
+ * compiler has support to do so. |
3853 |
+ */ |
3854 |
+ #define compiletime_assert(condition, msg) \ |
3855 |
+- _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__) |
3856 |
++ _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) |
3857 |
+ |
3858 |
+ #define compiletime_assert_atomic_type(t) \ |
3859 |
+ compiletime_assert(__native_word(t), \ |
3860 |
+diff --git a/include/linux/f2fs_fs.h b/include/linux/f2fs_fs.h |
3861 |
+index 284738996028..6bb6f718a102 100644 |
3862 |
+--- a/include/linux/f2fs_fs.h |
3863 |
++++ b/include/linux/f2fs_fs.h |
3864 |
+@@ -124,6 +124,7 @@ struct f2fs_super_block { |
3865 |
+ /* |
3866 |
+ * For checkpoint |
3867 |
+ */ |
3868 |
++#define CP_RESIZEFS_FLAG 0x00004000 |
3869 |
+ #define CP_DISABLED_QUICK_FLAG 0x00002000 |
3870 |
+ #define CP_DISABLED_FLAG 0x00001000 |
3871 |
+ #define CP_QUOTA_NEED_FSCK_FLAG 0x00000800 |
3872 |
+diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h |
3873 |
+index 53fc34f930d0..8a03f392f368 100644 |
3874 |
+--- a/include/linux/hugetlb.h |
3875 |
++++ b/include/linux/hugetlb.h |
3876 |
+@@ -298,7 +298,10 @@ static inline bool is_file_hugepages(struct file *file) |
3877 |
+ return is_file_shm_hugepages(file); |
3878 |
+ } |
3879 |
+ |
3880 |
+- |
3881 |
++static inline struct hstate *hstate_inode(struct inode *i) |
3882 |
++{ |
3883 |
++ return HUGETLBFS_SB(i->i_sb)->hstate; |
3884 |
++} |
3885 |
+ #else /* !CONFIG_HUGETLBFS */ |
3886 |
+ |
3887 |
+ #define is_file_hugepages(file) false |
3888 |
+@@ -310,6 +313,10 @@ hugetlb_file_setup(const char *name, size_t size, vm_flags_t acctflag, |
3889 |
+ return ERR_PTR(-ENOSYS); |
3890 |
+ } |
3891 |
+ |
3892 |
++static inline struct hstate *hstate_inode(struct inode *i) |
3893 |
++{ |
3894 |
++ return NULL; |
3895 |
++} |
3896 |
+ #endif /* !CONFIG_HUGETLBFS */ |
3897 |
+ |
3898 |
+ #ifdef HAVE_ARCH_HUGETLB_UNMAPPED_AREA |
3899 |
+@@ -379,11 +386,6 @@ extern unsigned int default_hstate_idx; |
3900 |
+ |
3901 |
+ #define default_hstate (hstates[default_hstate_idx]) |
3902 |
+ |
3903 |
+-static inline struct hstate *hstate_inode(struct inode *i) |
3904 |
+-{ |
3905 |
+- return HUGETLBFS_SB(i->i_sb)->hstate; |
3906 |
+-} |
3907 |
+- |
3908 |
+ static inline struct hstate *hstate_file(struct file *f) |
3909 |
+ { |
3910 |
+ return hstate_inode(file_inode(f)); |
3911 |
+@@ -636,11 +638,6 @@ static inline struct hstate *hstate_vma(struct vm_area_struct *vma) |
3912 |
+ return NULL; |
3913 |
+ } |
3914 |
+ |
3915 |
+-static inline struct hstate *hstate_inode(struct inode *i) |
3916 |
+-{ |
3917 |
+- return NULL; |
3918 |
+-} |
3919 |
+- |
3920 |
+ static inline struct hstate *page_hstate(struct page *page) |
3921 |
+ { |
3922 |
+ return NULL; |
3923 |
+diff --git a/include/linux/key-type.h b/include/linux/key-type.h |
3924 |
+index 4ded94bcf274..2ab2d6d6aeab 100644 |
3925 |
+--- a/include/linux/key-type.h |
3926 |
++++ b/include/linux/key-type.h |
3927 |
+@@ -127,7 +127,7 @@ struct key_type { |
3928 |
+ * much is copied into the buffer |
3929 |
+ * - shouldn't do the copy if the buffer is NULL |
3930 |
+ */ |
3931 |
+- long (*read)(const struct key *key, char __user *buffer, size_t buflen); |
3932 |
++ long (*read)(const struct key *key, char *buffer, size_t buflen); |
3933 |
+ |
3934 |
+ /* handle request_key() for this type instead of invoking |
3935 |
+ * /sbin/request-key (optional) |
3936 |
+diff --git a/include/linux/percpu_counter.h b/include/linux/percpu_counter.h |
3937 |
+index 4f052496cdfd..0a4f54dd4737 100644 |
3938 |
+--- a/include/linux/percpu_counter.h |
3939 |
++++ b/include/linux/percpu_counter.h |
3940 |
+@@ -78,9 +78,9 @@ static inline s64 percpu_counter_read(struct percpu_counter *fbc) |
3941 |
+ */ |
3942 |
+ static inline s64 percpu_counter_read_positive(struct percpu_counter *fbc) |
3943 |
+ { |
3944 |
+- s64 ret = fbc->count; |
3945 |
++ /* Prevent reloads of fbc->count */ |
3946 |
++ s64 ret = READ_ONCE(fbc->count); |
3947 |
+ |
3948 |
+- barrier(); /* Prevent reloads of fbc->count */ |
3949 |
+ if (ret >= 0) |
3950 |
+ return ret; |
3951 |
+ return 0; |
3952 |
+diff --git a/include/linux/swapops.h b/include/linux/swapops.h |
3953 |
+index 877fd239b6ff..3208a520d0be 100644 |
3954 |
+--- a/include/linux/swapops.h |
3955 |
++++ b/include/linux/swapops.h |
3956 |
+@@ -348,7 +348,8 @@ static inline void num_poisoned_pages_inc(void) |
3957 |
+ } |
3958 |
+ #endif |
3959 |
+ |
3960 |
+-#if defined(CONFIG_MEMORY_FAILURE) || defined(CONFIG_MIGRATION) |
3961 |
++#if defined(CONFIG_MEMORY_FAILURE) || defined(CONFIG_MIGRATION) || \ |
3962 |
++ defined(CONFIG_DEVICE_PRIVATE) |
3963 |
+ static inline int non_swap_entry(swp_entry_t entry) |
3964 |
+ { |
3965 |
+ return swp_type(entry) >= MAX_SWAPFILES; |
3966 |
+diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c |
3967 |
+index 013780ef0bd7..e1a65303cfd7 100644 |
3968 |
+--- a/kernel/bpf/verifier.c |
3969 |
++++ b/kernel/bpf/verifier.c |
3970 |
+@@ -201,8 +201,7 @@ struct bpf_call_arg_meta { |
3971 |
+ bool pkt_access; |
3972 |
+ int regno; |
3973 |
+ int access_size; |
3974 |
+- s64 msize_smax_value; |
3975 |
+- u64 msize_umax_value; |
3976 |
++ u64 msize_max_value; |
3977 |
+ int ref_obj_id; |
3978 |
+ int func_id; |
3979 |
+ }; |
3980 |
+@@ -3377,8 +3376,7 @@ static int check_func_arg(struct bpf_verifier_env *env, u32 regno, |
3981 |
+ /* remember the mem_size which may be used later |
3982 |
+ * to refine return values. |
3983 |
+ */ |
3984 |
+- meta->msize_smax_value = reg->smax_value; |
3985 |
+- meta->msize_umax_value = reg->umax_value; |
3986 |
++ meta->msize_max_value = reg->umax_value; |
3987 |
+ |
3988 |
+ /* The register is SCALAR_VALUE; the access check |
3989 |
+ * happens using its boundaries. |
3990 |
+@@ -3866,21 +3864,44 @@ static int prepare_func_exit(struct bpf_verifier_env *env, int *insn_idx) |
3991 |
+ return 0; |
3992 |
+ } |
3993 |
+ |
3994 |
+-static void do_refine_retval_range(struct bpf_reg_state *regs, int ret_type, |
3995 |
+- int func_id, |
3996 |
+- struct bpf_call_arg_meta *meta) |
3997 |
++static int do_refine_retval_range(struct bpf_verifier_env *env, |
3998 |
++ struct bpf_reg_state *regs, int ret_type, |
3999 |
++ int func_id, struct bpf_call_arg_meta *meta) |
4000 |
+ { |
4001 |
+ struct bpf_reg_state *ret_reg = ®s[BPF_REG_0]; |
4002 |
++ struct bpf_reg_state tmp_reg = *ret_reg; |
4003 |
++ bool ret; |
4004 |
+ |
4005 |
+ if (ret_type != RET_INTEGER || |
4006 |
+ (func_id != BPF_FUNC_get_stack && |
4007 |
+ func_id != BPF_FUNC_probe_read_str)) |
4008 |
+- return; |
4009 |
++ return 0; |
4010 |
++ |
4011 |
++ /* Error case where ret is in interval [S32MIN, -1]. */ |
4012 |
++ ret_reg->smin_value = S32_MIN; |
4013 |
++ ret_reg->smax_value = -1; |
4014 |
++ |
4015 |
++ __reg_deduce_bounds(ret_reg); |
4016 |
++ __reg_bound_offset(ret_reg); |
4017 |
++ __update_reg_bounds(ret_reg); |
4018 |
++ |
4019 |
++ ret = push_stack(env, env->insn_idx + 1, env->insn_idx, false); |
4020 |
++ if (!ret) |
4021 |
++ return -EFAULT; |
4022 |
++ |
4023 |
++ *ret_reg = tmp_reg; |
4024 |
++ |
4025 |
++ /* Success case where ret is in range [0, msize_max_value]. */ |
4026 |
++ ret_reg->smin_value = 0; |
4027 |
++ ret_reg->smax_value = meta->msize_max_value; |
4028 |
++ ret_reg->umin_value = ret_reg->smin_value; |
4029 |
++ ret_reg->umax_value = ret_reg->smax_value; |
4030 |
+ |
4031 |
+- ret_reg->smax_value = meta->msize_smax_value; |
4032 |
+- ret_reg->umax_value = meta->msize_umax_value; |
4033 |
+ __reg_deduce_bounds(ret_reg); |
4034 |
+ __reg_bound_offset(ret_reg); |
4035 |
++ __update_reg_bounds(ret_reg); |
4036 |
++ |
4037 |
++ return 0; |
4038 |
+ } |
4039 |
+ |
4040 |
+ static int |
4041 |
+@@ -4112,7 +4133,9 @@ static int check_helper_call(struct bpf_verifier_env *env, int func_id, int insn |
4042 |
+ regs[BPF_REG_0].ref_obj_id = id; |
4043 |
+ } |
4044 |
+ |
4045 |
+- do_refine_retval_range(regs, fn->ret_type, func_id, &meta); |
4046 |
++ err = do_refine_retval_range(env, regs, fn->ret_type, func_id, &meta); |
4047 |
++ if (err) |
4048 |
++ return err; |
4049 |
+ |
4050 |
+ err = check_map_func_compatibility(env, meta.map_ptr, func_id); |
4051 |
+ if (err) |
4052 |
+diff --git a/kernel/dma/coherent.c b/kernel/dma/coherent.c |
4053 |
+index 551b0eb7028a..2a0c4985f38e 100644 |
4054 |
+--- a/kernel/dma/coherent.c |
4055 |
++++ b/kernel/dma/coherent.c |
4056 |
+@@ -134,7 +134,7 @@ static void *__dma_alloc_from_coherent(struct device *dev, |
4057 |
+ |
4058 |
+ spin_lock_irqsave(&mem->spinlock, flags); |
4059 |
+ |
4060 |
+- if (unlikely(size > (mem->size << PAGE_SHIFT))) |
4061 |
++ if (unlikely(size > ((dma_addr_t)mem->size << PAGE_SHIFT))) |
4062 |
+ goto err; |
4063 |
+ |
4064 |
+ pageno = bitmap_find_free_region(mem->bitmap, mem->size, order); |
4065 |
+@@ -144,8 +144,9 @@ static void *__dma_alloc_from_coherent(struct device *dev, |
4066 |
+ /* |
4067 |
+ * Memory was found in the coherent area. |
4068 |
+ */ |
4069 |
+- *dma_handle = dma_get_device_base(dev, mem) + (pageno << PAGE_SHIFT); |
4070 |
+- ret = mem->virt_base + (pageno << PAGE_SHIFT); |
4071 |
++ *dma_handle = dma_get_device_base(dev, mem) + |
4072 |
++ ((dma_addr_t)pageno << PAGE_SHIFT); |
4073 |
++ ret = mem->virt_base + ((dma_addr_t)pageno << PAGE_SHIFT); |
4074 |
+ spin_unlock_irqrestore(&mem->spinlock, flags); |
4075 |
+ memset(ret, 0, size); |
4076 |
+ return ret; |
4077 |
+@@ -194,7 +195,7 @@ static int __dma_release_from_coherent(struct dma_coherent_mem *mem, |
4078 |
+ int order, void *vaddr) |
4079 |
+ { |
4080 |
+ if (mem && vaddr >= mem->virt_base && vaddr < |
4081 |
+- (mem->virt_base + (mem->size << PAGE_SHIFT))) { |
4082 |
++ (mem->virt_base + ((dma_addr_t)mem->size << PAGE_SHIFT))) { |
4083 |
+ int page = (vaddr - mem->virt_base) >> PAGE_SHIFT; |
4084 |
+ unsigned long flags; |
4085 |
+ |
4086 |
+@@ -238,10 +239,10 @@ static int __dma_mmap_from_coherent(struct dma_coherent_mem *mem, |
4087 |
+ struct vm_area_struct *vma, void *vaddr, size_t size, int *ret) |
4088 |
+ { |
4089 |
+ if (mem && vaddr >= mem->virt_base && vaddr + size <= |
4090 |
+- (mem->virt_base + (mem->size << PAGE_SHIFT))) { |
4091 |
++ (mem->virt_base + ((dma_addr_t)mem->size << PAGE_SHIFT))) { |
4092 |
+ unsigned long off = vma->vm_pgoff; |
4093 |
+ int start = (vaddr - mem->virt_base) >> PAGE_SHIFT; |
4094 |
+- int user_count = vma_pages(vma); |
4095 |
++ unsigned long user_count = vma_pages(vma); |
4096 |
+ int count = PAGE_ALIGN(size) >> PAGE_SHIFT; |
4097 |
+ |
4098 |
+ *ret = -ENXIO; |
4099 |
+diff --git a/kernel/dma/debug.c b/kernel/dma/debug.c |
4100 |
+index 4ad74f5987ea..cb6425e52bf7 100644 |
4101 |
+--- a/kernel/dma/debug.c |
4102 |
++++ b/kernel/dma/debug.c |
4103 |
+@@ -137,9 +137,12 @@ static const char *const maperr2str[] = { |
4104 |
+ [MAP_ERR_CHECKED] = "dma map error checked", |
4105 |
+ }; |
4106 |
+ |
4107 |
+-static const char *type2name[5] = { "single", "page", |
4108 |
+- "scather-gather", "coherent", |
4109 |
+- "resource" }; |
4110 |
++static const char *type2name[] = { |
4111 |
++ [dma_debug_single] = "single", |
4112 |
++ [dma_debug_sg] = "scather-gather", |
4113 |
++ [dma_debug_coherent] = "coherent", |
4114 |
++ [dma_debug_resource] = "resource", |
4115 |
++}; |
4116 |
+ |
4117 |
+ static const char *dir2name[4] = { "DMA_BIDIRECTIONAL", "DMA_TO_DEVICE", |
4118 |
+ "DMA_FROM_DEVICE", "DMA_NONE" }; |
4119 |
+diff --git a/kernel/locking/locktorture.c b/kernel/locking/locktorture.c |
4120 |
+index c513031cd7e3..e09562818bb7 100644 |
4121 |
+--- a/kernel/locking/locktorture.c |
4122 |
++++ b/kernel/locking/locktorture.c |
4123 |
+@@ -697,10 +697,10 @@ static void __torture_print_stats(char *page, |
4124 |
+ if (statp[i].n_lock_fail) |
4125 |
+ fail = true; |
4126 |
+ sum += statp[i].n_lock_acquired; |
4127 |
+- if (max < statp[i].n_lock_fail) |
4128 |
+- max = statp[i].n_lock_fail; |
4129 |
+- if (min > statp[i].n_lock_fail) |
4130 |
+- min = statp[i].n_lock_fail; |
4131 |
++ if (max < statp[i].n_lock_acquired) |
4132 |
++ max = statp[i].n_lock_acquired; |
4133 |
++ if (min > statp[i].n_lock_acquired) |
4134 |
++ min = statp[i].n_lock_acquired; |
4135 |
+ } |
4136 |
+ page += sprintf(page, |
4137 |
+ "%s: Total: %lld Max/Min: %ld/%ld %s Fail: %d %s\n", |
4138 |
+diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug |
4139 |
+index f61d834e02fe..6118d99117da 100644 |
4140 |
+--- a/lib/Kconfig.debug |
4141 |
++++ b/lib/Kconfig.debug |
4142 |
+@@ -223,6 +223,8 @@ config DEBUG_INFO_DWARF4 |
4143 |
+ config DEBUG_INFO_BTF |
4144 |
+ bool "Generate BTF typeinfo" |
4145 |
+ depends on DEBUG_INFO |
4146 |
++ depends on !DEBUG_INFO_SPLIT && !DEBUG_INFO_REDUCED |
4147 |
++ depends on !GCC_PLUGIN_RANDSTRUCT || COMPILE_TEST |
4148 |
+ help |
4149 |
+ Generate deduplicated BTF type information from DWARF debug info. |
4150 |
+ Turning this on expects presence of pahole tool, which will convert |
4151 |
+diff --git a/net/dns_resolver/dns_key.c b/net/dns_resolver/dns_key.c |
4152 |
+index 3e1a90669006..ad53eb31d40f 100644 |
4153 |
+--- a/net/dns_resolver/dns_key.c |
4154 |
++++ b/net/dns_resolver/dns_key.c |
4155 |
+@@ -302,7 +302,7 @@ static void dns_resolver_describe(const struct key *key, struct seq_file *m) |
4156 |
+ * - the key's semaphore is read-locked |
4157 |
+ */ |
4158 |
+ static long dns_resolver_read(const struct key *key, |
4159 |
+- char __user *buffer, size_t buflen) |
4160 |
++ char *buffer, size_t buflen) |
4161 |
+ { |
4162 |
+ int err = PTR_ERR(key->payload.data[dns_key_error]); |
4163 |
+ |
4164 |
+diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c |
4165 |
+index 068daff41f6e..f7129232c825 100644 |
4166 |
+--- a/net/netfilter/nf_tables_api.c |
4167 |
++++ b/net/netfilter/nf_tables_api.c |
4168 |
+@@ -3598,7 +3598,7 @@ static int nf_tables_newset(struct net *net, struct sock *nlsk, |
4169 |
+ NFT_SET_INTERVAL | NFT_SET_TIMEOUT | |
4170 |
+ NFT_SET_MAP | NFT_SET_EVAL | |
4171 |
+ NFT_SET_OBJECT)) |
4172 |
+- return -EINVAL; |
4173 |
++ return -EOPNOTSUPP; |
4174 |
+ /* Only one of these operations is supported */ |
4175 |
+ if ((flags & (NFT_SET_MAP | NFT_SET_OBJECT)) == |
4176 |
+ (NFT_SET_MAP | NFT_SET_OBJECT)) |
4177 |
+@@ -3636,7 +3636,7 @@ static int nf_tables_newset(struct net *net, struct sock *nlsk, |
4178 |
+ objtype = ntohl(nla_get_be32(nla[NFTA_SET_OBJ_TYPE])); |
4179 |
+ if (objtype == NFT_OBJECT_UNSPEC || |
4180 |
+ objtype > NFT_OBJECT_MAX) |
4181 |
+- return -EINVAL; |
4182 |
++ return -EOPNOTSUPP; |
4183 |
+ } else if (flags & NFT_SET_OBJECT) |
4184 |
+ return -EINVAL; |
4185 |
+ else |
4186 |
+diff --git a/net/rxrpc/key.c b/net/rxrpc/key.c |
4187 |
+index 6c3f35fac42d..0c98313dd7a8 100644 |
4188 |
+--- a/net/rxrpc/key.c |
4189 |
++++ b/net/rxrpc/key.c |
4190 |
+@@ -31,7 +31,7 @@ static void rxrpc_free_preparse_s(struct key_preparsed_payload *); |
4191 |
+ static void rxrpc_destroy(struct key *); |
4192 |
+ static void rxrpc_destroy_s(struct key *); |
4193 |
+ static void rxrpc_describe(const struct key *, struct seq_file *); |
4194 |
+-static long rxrpc_read(const struct key *, char __user *, size_t); |
4195 |
++static long rxrpc_read(const struct key *, char *, size_t); |
4196 |
+ |
4197 |
+ /* |
4198 |
+ * rxrpc defined keys take an arbitrary string as the description and an |
4199 |
+@@ -1042,12 +1042,12 @@ EXPORT_SYMBOL(rxrpc_get_null_key); |
4200 |
+ * - this returns the result in XDR form |
4201 |
+ */ |
4202 |
+ static long rxrpc_read(const struct key *key, |
4203 |
+- char __user *buffer, size_t buflen) |
4204 |
++ char *buffer, size_t buflen) |
4205 |
+ { |
4206 |
+ const struct rxrpc_key_token *token; |
4207 |
+ const struct krb5_principal *princ; |
4208 |
+ size_t size; |
4209 |
+- __be32 __user *xdr, *oldxdr; |
4210 |
++ __be32 *xdr, *oldxdr; |
4211 |
+ u32 cnlen, toksize, ntoks, tok, zero; |
4212 |
+ u16 toksizes[AFSTOKEN_MAX]; |
4213 |
+ int loop; |
4214 |
+@@ -1124,30 +1124,25 @@ static long rxrpc_read(const struct key *key, |
4215 |
+ if (!buffer || buflen < size) |
4216 |
+ return size; |
4217 |
+ |
4218 |
+- xdr = (__be32 __user *) buffer; |
4219 |
++ xdr = (__be32 *)buffer; |
4220 |
+ zero = 0; |
4221 |
+ #define ENCODE(x) \ |
4222 |
+ do { \ |
4223 |
+- __be32 y = htonl(x); \ |
4224 |
+- if (put_user(y, xdr++) < 0) \ |
4225 |
+- goto fault; \ |
4226 |
++ *xdr++ = htonl(x); \ |
4227 |
+ } while(0) |
4228 |
+ #define ENCODE_DATA(l, s) \ |
4229 |
+ do { \ |
4230 |
+ u32 _l = (l); \ |
4231 |
+ ENCODE(l); \ |
4232 |
+- if (copy_to_user(xdr, (s), _l) != 0) \ |
4233 |
+- goto fault; \ |
4234 |
+- if (_l & 3 && \ |
4235 |
+- copy_to_user((u8 __user *)xdr + _l, &zero, 4 - (_l & 3)) != 0) \ |
4236 |
+- goto fault; \ |
4237 |
++ memcpy(xdr, (s), _l); \ |
4238 |
++ if (_l & 3) \ |
4239 |
++ memcpy((u8 *)xdr + _l, &zero, 4 - (_l & 3)); \ |
4240 |
+ xdr += (_l + 3) >> 2; \ |
4241 |
+ } while(0) |
4242 |
+ #define ENCODE64(x) \ |
4243 |
+ do { \ |
4244 |
+ __be64 y = cpu_to_be64(x); \ |
4245 |
+- if (copy_to_user(xdr, &y, 8) != 0) \ |
4246 |
+- goto fault; \ |
4247 |
++ memcpy(xdr, &y, 8); \ |
4248 |
+ xdr += 8 >> 2; \ |
4249 |
+ } while(0) |
4250 |
+ #define ENCODE_STR(s) \ |
4251 |
+@@ -1238,8 +1233,4 @@ static long rxrpc_read(const struct key *key, |
4252 |
+ ASSERTCMP((char __user *) xdr - buffer, ==, size); |
4253 |
+ _leave(" = %zu", size); |
4254 |
+ return size; |
4255 |
+- |
4256 |
+-fault: |
4257 |
+- _leave(" = -EFAULT"); |
4258 |
+- return -EFAULT; |
4259 |
+ } |
4260 |
+diff --git a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c |
4261 |
+index d75fddca44c9..ff5fcb3e1208 100644 |
4262 |
+--- a/net/sunrpc/auth_gss/auth_gss.c |
4263 |
++++ b/net/sunrpc/auth_gss/auth_gss.c |
4264 |
+@@ -20,6 +20,7 @@ |
4265 |
+ #include <linux/sunrpc/clnt.h> |
4266 |
+ #include <linux/sunrpc/auth.h> |
4267 |
+ #include <linux/sunrpc/auth_gss.h> |
4268 |
++#include <linux/sunrpc/gss_krb5.h> |
4269 |
+ #include <linux/sunrpc/svcauth_gss.h> |
4270 |
+ #include <linux/sunrpc/gss_err.h> |
4271 |
+ #include <linux/workqueue.h> |
4272 |
+@@ -1050,7 +1051,7 @@ gss_create_new(const struct rpc_auth_create_args *args, struct rpc_clnt *clnt) |
4273 |
+ goto err_put_mech; |
4274 |
+ auth = &gss_auth->rpc_auth; |
4275 |
+ auth->au_cslack = GSS_CRED_SLACK >> 2; |
4276 |
+- auth->au_rslack = GSS_VERF_SLACK >> 2; |
4277 |
++ auth->au_rslack = GSS_KRB5_MAX_SLACK_NEEDED >> 2; |
4278 |
+ auth->au_verfsize = GSS_VERF_SLACK >> 2; |
4279 |
+ auth->au_ralign = GSS_VERF_SLACK >> 2; |
4280 |
+ auth->au_flags = 0; |
4281 |
+@@ -1934,35 +1935,69 @@ gss_unwrap_resp_auth(struct rpc_cred *cred) |
4282 |
+ return 0; |
4283 |
+ } |
4284 |
+ |
4285 |
++/* |
4286 |
++ * RFC 2203, Section 5.3.2.2 |
4287 |
++ * |
4288 |
++ * struct rpc_gss_integ_data { |
4289 |
++ * opaque databody_integ<>; |
4290 |
++ * opaque checksum<>; |
4291 |
++ * }; |
4292 |
++ * |
4293 |
++ * struct rpc_gss_data_t { |
4294 |
++ * unsigned int seq_num; |
4295 |
++ * proc_req_arg_t arg; |
4296 |
++ * }; |
4297 |
++ */ |
4298 |
+ static int |
4299 |
+ gss_unwrap_resp_integ(struct rpc_task *task, struct rpc_cred *cred, |
4300 |
+ struct gss_cl_ctx *ctx, struct rpc_rqst *rqstp, |
4301 |
+ struct xdr_stream *xdr) |
4302 |
+ { |
4303 |
+- struct xdr_buf integ_buf, *rcv_buf = &rqstp->rq_rcv_buf; |
4304 |
+- u32 data_offset, mic_offset, integ_len, maj_stat; |
4305 |
++ struct xdr_buf gss_data, *rcv_buf = &rqstp->rq_rcv_buf; |
4306 |
+ struct rpc_auth *auth = cred->cr_auth; |
4307 |
++ u32 len, offset, seqno, maj_stat; |
4308 |
+ struct xdr_netobj mic; |
4309 |
+- __be32 *p; |
4310 |
++ int ret; |
4311 |
+ |
4312 |
+- p = xdr_inline_decode(xdr, 2 * sizeof(*p)); |
4313 |
+- if (unlikely(!p)) |
4314 |
++ ret = -EIO; |
4315 |
++ mic.data = NULL; |
4316 |
++ |
4317 |
++ /* opaque databody_integ<>; */ |
4318 |
++ if (xdr_stream_decode_u32(xdr, &len)) |
4319 |
+ goto unwrap_failed; |
4320 |
+- integ_len = be32_to_cpup(p++); |
4321 |
+- if (integ_len & 3) |
4322 |
++ if (len & 3) |
4323 |
+ goto unwrap_failed; |
4324 |
+- data_offset = (u8 *)(p) - (u8 *)rcv_buf->head[0].iov_base; |
4325 |
+- mic_offset = integ_len + data_offset; |
4326 |
+- if (mic_offset > rcv_buf->len) |
4327 |
++ offset = rcv_buf->len - xdr_stream_remaining(xdr); |
4328 |
++ if (xdr_stream_decode_u32(xdr, &seqno)) |
4329 |
+ goto unwrap_failed; |
4330 |
+- if (be32_to_cpup(p) != rqstp->rq_seqno) |
4331 |
++ if (seqno != rqstp->rq_seqno) |
4332 |
+ goto bad_seqno; |
4333 |
++ if (xdr_buf_subsegment(rcv_buf, &gss_data, offset, len)) |
4334 |
++ goto unwrap_failed; |
4335 |
+ |
4336 |
+- if (xdr_buf_subsegment(rcv_buf, &integ_buf, data_offset, integ_len)) |
4337 |
++ /* |
4338 |
++ * The xdr_stream now points to the beginning of the |
4339 |
++ * upper layer payload, to be passed below to |
4340 |
++ * rpcauth_unwrap_resp_decode(). The checksum, which |
4341 |
++ * follows the upper layer payload in @rcv_buf, is |
4342 |
++ * located and parsed without updating the xdr_stream. |
4343 |
++ */ |
4344 |
++ |
4345 |
++ /* opaque checksum<>; */ |
4346 |
++ offset += len; |
4347 |
++ if (xdr_decode_word(rcv_buf, offset, &len)) |
4348 |
++ goto unwrap_failed; |
4349 |
++ offset += sizeof(__be32); |
4350 |
++ if (offset + len > rcv_buf->len) |
4351 |
+ goto unwrap_failed; |
4352 |
+- if (xdr_buf_read_mic(rcv_buf, &mic, mic_offset)) |
4353 |
++ mic.len = len; |
4354 |
++ mic.data = kmalloc(len, GFP_NOFS); |
4355 |
++ if (!mic.data) |
4356 |
++ goto unwrap_failed; |
4357 |
++ if (read_bytes_from_xdr_buf(rcv_buf, offset, mic.data, mic.len)) |
4358 |
+ goto unwrap_failed; |
4359 |
+- maj_stat = gss_verify_mic(ctx->gc_gss_ctx, &integ_buf, &mic); |
4360 |
++ |
4361 |
++ maj_stat = gss_verify_mic(ctx->gc_gss_ctx, &gss_data, &mic); |
4362 |
+ if (maj_stat == GSS_S_CONTEXT_EXPIRED) |
4363 |
+ clear_bit(RPCAUTH_CRED_UPTODATE, &cred->cr_flags); |
4364 |
+ if (maj_stat != GSS_S_COMPLETE) |
4365 |
+@@ -1970,16 +2005,21 @@ gss_unwrap_resp_integ(struct rpc_task *task, struct rpc_cred *cred, |
4366 |
+ |
4367 |
+ auth->au_rslack = auth->au_verfsize + 2 + 1 + XDR_QUADLEN(mic.len); |
4368 |
+ auth->au_ralign = auth->au_verfsize + 2; |
4369 |
+- return 0; |
4370 |
++ ret = 0; |
4371 |
++ |
4372 |
++out: |
4373 |
++ kfree(mic.data); |
4374 |
++ return ret; |
4375 |
++ |
4376 |
+ unwrap_failed: |
4377 |
+ trace_rpcgss_unwrap_failed(task); |
4378 |
+- return -EIO; |
4379 |
++ goto out; |
4380 |
+ bad_seqno: |
4381 |
+- trace_rpcgss_bad_seqno(task, rqstp->rq_seqno, be32_to_cpup(p)); |
4382 |
+- return -EIO; |
4383 |
++ trace_rpcgss_bad_seqno(task, rqstp->rq_seqno, seqno); |
4384 |
++ goto out; |
4385 |
+ bad_mic: |
4386 |
+ trace_rpcgss_verify_mic(task, maj_stat); |
4387 |
+- return -EIO; |
4388 |
++ goto out; |
4389 |
+ } |
4390 |
+ |
4391 |
+ static int |
4392 |
+diff --git a/net/xdp/xdp_umem.c b/net/xdp/xdp_umem.c |
4393 |
+index 3049af269fbf..c5dba371a765 100644 |
4394 |
+--- a/net/xdp/xdp_umem.c |
4395 |
++++ b/net/xdp/xdp_umem.c |
4396 |
+@@ -343,7 +343,7 @@ static int xdp_umem_reg(struct xdp_umem *umem, struct xdp_umem_reg *mr) |
4397 |
+ u32 chunk_size = mr->chunk_size, headroom = mr->headroom; |
4398 |
+ unsigned int chunks, chunks_per_page; |
4399 |
+ u64 addr = mr->addr, size = mr->len; |
4400 |
+- int size_chk, err; |
4401 |
++ int err; |
4402 |
+ |
4403 |
+ if (chunk_size < XDP_UMEM_MIN_CHUNK_SIZE || chunk_size > PAGE_SIZE) { |
4404 |
+ /* Strictly speaking we could support this, if: |
4405 |
+@@ -382,8 +382,7 @@ static int xdp_umem_reg(struct xdp_umem *umem, struct xdp_umem_reg *mr) |
4406 |
+ return -EINVAL; |
4407 |
+ } |
4408 |
+ |
4409 |
+- size_chk = chunk_size - headroom - XDP_PACKET_HEADROOM; |
4410 |
+- if (size_chk < 0) |
4411 |
++ if (headroom >= chunk_size - XDP_PACKET_HEADROOM) |
4412 |
+ return -EINVAL; |
4413 |
+ |
4414 |
+ umem->address = (unsigned long)addr; |
4415 |
+diff --git a/net/xdp/xsk.c b/net/xdp/xsk.c |
4416 |
+index d426fc01c529..7181a30666b4 100644 |
4417 |
+--- a/net/xdp/xsk.c |
4418 |
++++ b/net/xdp/xsk.c |
4419 |
+@@ -129,8 +129,9 @@ static void __xsk_rcv_memcpy(struct xdp_umem *umem, u64 addr, void *from_buf, |
4420 |
+ u64 page_start = addr & ~(PAGE_SIZE - 1); |
4421 |
+ u64 first_len = PAGE_SIZE - (addr - page_start); |
4422 |
+ |
4423 |
+- memcpy(to_buf, from_buf, first_len + metalen); |
4424 |
+- memcpy(next_pg_addr, from_buf + first_len, len - first_len); |
4425 |
++ memcpy(to_buf, from_buf, first_len); |
4426 |
++ memcpy(next_pg_addr, from_buf + first_len, |
4427 |
++ len + metalen - first_len); |
4428 |
+ |
4429 |
+ return; |
4430 |
+ } |
4431 |
+diff --git a/security/keys/big_key.c b/security/keys/big_key.c |
4432 |
+index 001abe530a0d..82008f900930 100644 |
4433 |
+--- a/security/keys/big_key.c |
4434 |
++++ b/security/keys/big_key.c |
4435 |
+@@ -352,7 +352,7 @@ void big_key_describe(const struct key *key, struct seq_file *m) |
4436 |
+ * read the key data |
4437 |
+ * - the key's semaphore is read-locked |
4438 |
+ */ |
4439 |
+-long big_key_read(const struct key *key, char __user *buffer, size_t buflen) |
4440 |
++long big_key_read(const struct key *key, char *buffer, size_t buflen) |
4441 |
+ { |
4442 |
+ size_t datalen = (size_t)key->payload.data[big_key_len]; |
4443 |
+ long ret; |
4444 |
+@@ -391,9 +391,8 @@ long big_key_read(const struct key *key, char __user *buffer, size_t buflen) |
4445 |
+ |
4446 |
+ ret = datalen; |
4447 |
+ |
4448 |
+- /* copy decrypted data to user */ |
4449 |
+- if (copy_to_user(buffer, buf->virt, datalen) != 0) |
4450 |
+- ret = -EFAULT; |
4451 |
++ /* copy out decrypted data */ |
4452 |
++ memcpy(buffer, buf->virt, datalen); |
4453 |
+ |
4454 |
+ err_fput: |
4455 |
+ fput(file); |
4456 |
+@@ -401,9 +400,7 @@ error: |
4457 |
+ big_key_free_buffer(buf); |
4458 |
+ } else { |
4459 |
+ ret = datalen; |
4460 |
+- if (copy_to_user(buffer, key->payload.data[big_key_data], |
4461 |
+- datalen) != 0) |
4462 |
+- ret = -EFAULT; |
4463 |
++ memcpy(buffer, key->payload.data[big_key_data], datalen); |
4464 |
+ } |
4465 |
+ |
4466 |
+ return ret; |
4467 |
+diff --git a/security/keys/encrypted-keys/encrypted.c b/security/keys/encrypted-keys/encrypted.c |
4468 |
+index 60720f58cbe0..f6797ba44bf7 100644 |
4469 |
+--- a/security/keys/encrypted-keys/encrypted.c |
4470 |
++++ b/security/keys/encrypted-keys/encrypted.c |
4471 |
+@@ -902,14 +902,14 @@ out: |
4472 |
+ } |
4473 |
+ |
4474 |
+ /* |
4475 |
+- * encrypted_read - format and copy the encrypted data to userspace |
4476 |
++ * encrypted_read - format and copy out the encrypted data |
4477 |
+ * |
4478 |
+ * The resulting datablob format is: |
4479 |
+ * <master-key name> <decrypted data length> <encrypted iv> <encrypted data> |
4480 |
+ * |
4481 |
+ * On success, return to userspace the encrypted key datablob size. |
4482 |
+ */ |
4483 |
+-static long encrypted_read(const struct key *key, char __user *buffer, |
4484 |
++static long encrypted_read(const struct key *key, char *buffer, |
4485 |
+ size_t buflen) |
4486 |
+ { |
4487 |
+ struct encrypted_key_payload *epayload; |
4488 |
+@@ -957,8 +957,7 @@ static long encrypted_read(const struct key *key, char __user *buffer, |
4489 |
+ key_put(mkey); |
4490 |
+ memzero_explicit(derived_key, sizeof(derived_key)); |
4491 |
+ |
4492 |
+- if (copy_to_user(buffer, ascii_buf, asciiblob_len) != 0) |
4493 |
+- ret = -EFAULT; |
4494 |
++ memcpy(buffer, ascii_buf, asciiblob_len); |
4495 |
+ kzfree(ascii_buf); |
4496 |
+ |
4497 |
+ return asciiblob_len; |
4498 |
+diff --git a/security/keys/keyctl.c b/security/keys/keyctl.c |
4499 |
+index d1a3dea58dee..106e16f9006b 100644 |
4500 |
+--- a/security/keys/keyctl.c |
4501 |
++++ b/security/keys/keyctl.c |
4502 |
+@@ -797,6 +797,21 @@ error: |
4503 |
+ return ret; |
4504 |
+ } |
4505 |
+ |
4506 |
++/* |
4507 |
++ * Call the read method |
4508 |
++ */ |
4509 |
++static long __keyctl_read_key(struct key *key, char *buffer, size_t buflen) |
4510 |
++{ |
4511 |
++ long ret; |
4512 |
++ |
4513 |
++ down_read(&key->sem); |
4514 |
++ ret = key_validate(key); |
4515 |
++ if (ret == 0) |
4516 |
++ ret = key->type->read(key, buffer, buflen); |
4517 |
++ up_read(&key->sem); |
4518 |
++ return ret; |
4519 |
++} |
4520 |
++ |
4521 |
+ /* |
4522 |
+ * Read a key's payload. |
4523 |
+ * |
4524 |
+@@ -812,26 +827,27 @@ long keyctl_read_key(key_serial_t keyid, char __user *buffer, size_t buflen) |
4525 |
+ struct key *key; |
4526 |
+ key_ref_t key_ref; |
4527 |
+ long ret; |
4528 |
++ char *key_data; |
4529 |
+ |
4530 |
+ /* find the key first */ |
4531 |
+ key_ref = lookup_user_key(keyid, 0, 0); |
4532 |
+ if (IS_ERR(key_ref)) { |
4533 |
+ ret = -ENOKEY; |
4534 |
+- goto error; |
4535 |
++ goto out; |
4536 |
+ } |
4537 |
+ |
4538 |
+ key = key_ref_to_ptr(key_ref); |
4539 |
+ |
4540 |
+ ret = key_read_state(key); |
4541 |
+ if (ret < 0) |
4542 |
+- goto error2; /* Negatively instantiated */ |
4543 |
++ goto key_put_out; /* Negatively instantiated */ |
4544 |
+ |
4545 |
+ /* see if we can read it directly */ |
4546 |
+ ret = key_permission(key_ref, KEY_NEED_READ); |
4547 |
+ if (ret == 0) |
4548 |
+ goto can_read_key; |
4549 |
+ if (ret != -EACCES) |
4550 |
+- goto error2; |
4551 |
++ goto key_put_out; |
4552 |
+ |
4553 |
+ /* we can't; see if it's searchable from this process's keyrings |
4554 |
+ * - we automatically take account of the fact that it may be |
4555 |
+@@ -839,26 +855,51 @@ long keyctl_read_key(key_serial_t keyid, char __user *buffer, size_t buflen) |
4556 |
+ */ |
4557 |
+ if (!is_key_possessed(key_ref)) { |
4558 |
+ ret = -EACCES; |
4559 |
+- goto error2; |
4560 |
++ goto key_put_out; |
4561 |
+ } |
4562 |
+ |
4563 |
+ /* the key is probably readable - now try to read it */ |
4564 |
+ can_read_key: |
4565 |
+- ret = -EOPNOTSUPP; |
4566 |
+- if (key->type->read) { |
4567 |
+- /* Read the data with the semaphore held (since we might sleep) |
4568 |
+- * to protect against the key being updated or revoked. |
4569 |
+- */ |
4570 |
+- down_read(&key->sem); |
4571 |
+- ret = key_validate(key); |
4572 |
+- if (ret == 0) |
4573 |
+- ret = key->type->read(key, buffer, buflen); |
4574 |
+- up_read(&key->sem); |
4575 |
++ if (!key->type->read) { |
4576 |
++ ret = -EOPNOTSUPP; |
4577 |
++ goto key_put_out; |
4578 |
+ } |
4579 |
+ |
4580 |
+-error2: |
4581 |
++ if (!buffer || !buflen) { |
4582 |
++ /* Get the key length from the read method */ |
4583 |
++ ret = __keyctl_read_key(key, NULL, 0); |
4584 |
++ goto key_put_out; |
4585 |
++ } |
4586 |
++ |
4587 |
++ /* |
4588 |
++ * Read the data with the semaphore held (since we might sleep) |
4589 |
++ * to protect against the key being updated or revoked. |
4590 |
++ * |
4591 |
++ * Allocating a temporary buffer to hold the keys before |
4592 |
++ * transferring them to user buffer to avoid potential |
4593 |
++ * deadlock involving page fault and mmap_sem. |
4594 |
++ */ |
4595 |
++ key_data = kmalloc(buflen, GFP_KERNEL); |
4596 |
++ |
4597 |
++ if (!key_data) { |
4598 |
++ ret = -ENOMEM; |
4599 |
++ goto key_put_out; |
4600 |
++ } |
4601 |
++ ret = __keyctl_read_key(key, key_data, buflen); |
4602 |
++ |
4603 |
++ /* |
4604 |
++ * Read methods will just return the required length without |
4605 |
++ * any copying if the provided length isn't large enough. |
4606 |
++ */ |
4607 |
++ if (ret > 0 && ret <= buflen) { |
4608 |
++ if (copy_to_user(buffer, key_data, ret)) |
4609 |
++ ret = -EFAULT; |
4610 |
++ } |
4611 |
++ kzfree(key_data); |
4612 |
++ |
4613 |
++key_put_out: |
4614 |
+ key_put(key); |
4615 |
+-error: |
4616 |
++out: |
4617 |
+ return ret; |
4618 |
+ } |
4619 |
+ |
4620 |
+diff --git a/security/keys/keyring.c b/security/keys/keyring.c |
4621 |
+index febf36c6ddc5..5ca620d31cd3 100644 |
4622 |
+--- a/security/keys/keyring.c |
4623 |
++++ b/security/keys/keyring.c |
4624 |
+@@ -459,7 +459,6 @@ static int keyring_read_iterator(const void *object, void *data) |
4625 |
+ { |
4626 |
+ struct keyring_read_iterator_context *ctx = data; |
4627 |
+ const struct key *key = keyring_ptr_to_key(object); |
4628 |
+- int ret; |
4629 |
+ |
4630 |
+ kenter("{%s,%d},,{%zu/%zu}", |
4631 |
+ key->type->name, key->serial, ctx->count, ctx->buflen); |
4632 |
+@@ -467,10 +466,7 @@ static int keyring_read_iterator(const void *object, void *data) |
4633 |
+ if (ctx->count >= ctx->buflen) |
4634 |
+ return 1; |
4635 |
+ |
4636 |
+- ret = put_user(key->serial, ctx->buffer); |
4637 |
+- if (ret < 0) |
4638 |
+- return ret; |
4639 |
+- ctx->buffer++; |
4640 |
++ *ctx->buffer++ = key->serial; |
4641 |
+ ctx->count += sizeof(key->serial); |
4642 |
+ return 0; |
4643 |
+ } |
4644 |
+diff --git a/security/keys/request_key_auth.c b/security/keys/request_key_auth.c |
4645 |
+index ecba39c93fd9..41e9735006d0 100644 |
4646 |
+--- a/security/keys/request_key_auth.c |
4647 |
++++ b/security/keys/request_key_auth.c |
4648 |
+@@ -22,7 +22,7 @@ static int request_key_auth_instantiate(struct key *, |
4649 |
+ static void request_key_auth_describe(const struct key *, struct seq_file *); |
4650 |
+ static void request_key_auth_revoke(struct key *); |
4651 |
+ static void request_key_auth_destroy(struct key *); |
4652 |
+-static long request_key_auth_read(const struct key *, char __user *, size_t); |
4653 |
++static long request_key_auth_read(const struct key *, char *, size_t); |
4654 |
+ |
4655 |
+ /* |
4656 |
+ * The request-key authorisation key type definition. |
4657 |
+@@ -80,7 +80,7 @@ static void request_key_auth_describe(const struct key *key, |
4658 |
+ * - the key's semaphore is read-locked |
4659 |
+ */ |
4660 |
+ static long request_key_auth_read(const struct key *key, |
4661 |
+- char __user *buffer, size_t buflen) |
4662 |
++ char *buffer, size_t buflen) |
4663 |
+ { |
4664 |
+ struct request_key_auth *rka = dereference_key_locked(key); |
4665 |
+ size_t datalen; |
4666 |
+@@ -97,8 +97,7 @@ static long request_key_auth_read(const struct key *key, |
4667 |
+ if (buflen > datalen) |
4668 |
+ buflen = datalen; |
4669 |
+ |
4670 |
+- if (copy_to_user(buffer, rka->callout_info, buflen) != 0) |
4671 |
+- ret = -EFAULT; |
4672 |
++ memcpy(buffer, rka->callout_info, buflen); |
4673 |
+ } |
4674 |
+ |
4675 |
+ return ret; |
4676 |
+diff --git a/security/keys/trusted.c b/security/keys/trusted.c |
4677 |
+index 1fbd77816610..36afc29aecc3 100644 |
4678 |
+--- a/security/keys/trusted.c |
4679 |
++++ b/security/keys/trusted.c |
4680 |
+@@ -1144,11 +1144,10 @@ out: |
4681 |
+ * trusted_read - copy the sealed blob data to userspace in hex. |
4682 |
+ * On success, return to userspace the trusted key datablob size. |
4683 |
+ */ |
4684 |
+-static long trusted_read(const struct key *key, char __user *buffer, |
4685 |
++static long trusted_read(const struct key *key, char *buffer, |
4686 |
+ size_t buflen) |
4687 |
+ { |
4688 |
+ const struct trusted_key_payload *p; |
4689 |
+- char *ascii_buf; |
4690 |
+ char *bufp; |
4691 |
+ int i; |
4692 |
+ |
4693 |
+@@ -1157,18 +1156,9 @@ static long trusted_read(const struct key *key, char __user *buffer, |
4694 |
+ return -EINVAL; |
4695 |
+ |
4696 |
+ if (buffer && buflen >= 2 * p->blob_len) { |
4697 |
+- ascii_buf = kmalloc_array(2, p->blob_len, GFP_KERNEL); |
4698 |
+- if (!ascii_buf) |
4699 |
+- return -ENOMEM; |
4700 |
+- |
4701 |
+- bufp = ascii_buf; |
4702 |
++ bufp = buffer; |
4703 |
+ for (i = 0; i < p->blob_len; i++) |
4704 |
+ bufp = hex_byte_pack(bufp, p->blob[i]); |
4705 |
+- if (copy_to_user(buffer, ascii_buf, 2 * p->blob_len) != 0) { |
4706 |
+- kzfree(ascii_buf); |
4707 |
+- return -EFAULT; |
4708 |
+- } |
4709 |
+- kzfree(ascii_buf); |
4710 |
+ } |
4711 |
+ return 2 * p->blob_len; |
4712 |
+ } |
4713 |
+diff --git a/security/keys/user_defined.c b/security/keys/user_defined.c |
4714 |
+index 6f12de4ce549..07d4287e9084 100644 |
4715 |
+--- a/security/keys/user_defined.c |
4716 |
++++ b/security/keys/user_defined.c |
4717 |
+@@ -168,7 +168,7 @@ EXPORT_SYMBOL_GPL(user_describe); |
4718 |
+ * read the key data |
4719 |
+ * - the key's semaphore is read-locked |
4720 |
+ */ |
4721 |
+-long user_read(const struct key *key, char __user *buffer, size_t buflen) |
4722 |
++long user_read(const struct key *key, char *buffer, size_t buflen) |
4723 |
+ { |
4724 |
+ const struct user_key_payload *upayload; |
4725 |
+ long ret; |
4726 |
+@@ -181,8 +181,7 @@ long user_read(const struct key *key, char __user *buffer, size_t buflen) |
4727 |
+ if (buflen > upayload->datalen) |
4728 |
+ buflen = upayload->datalen; |
4729 |
+ |
4730 |
+- if (copy_to_user(buffer, upayload->data, buflen) != 0) |
4731 |
+- ret = -EFAULT; |
4732 |
++ memcpy(buffer, upayload->data, buflen); |
4733 |
+ } |
4734 |
+ |
4735 |
+ return ret; |
4736 |
+diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c |
4737 |
+index 1db9d0579c72..72bbfeddea24 100644 |
4738 |
+--- a/sound/pci/hda/hda_intel.c |
4739 |
++++ b/sound/pci/hda/hda_intel.c |
4740 |
+@@ -1068,6 +1068,8 @@ static int azx_freeze_noirq(struct device *dev) |
4741 |
+ struct azx *chip = card->private_data; |
4742 |
+ struct pci_dev *pci = to_pci_dev(dev); |
4743 |
+ |
4744 |
++ if (!azx_is_pm_ready(card)) |
4745 |
++ return 0; |
4746 |
+ if (chip->driver_type == AZX_DRIVER_SKL) |
4747 |
+ pci_set_power_state(pci, PCI_D3hot); |
4748 |
+ |
4749 |
+@@ -1080,6 +1082,8 @@ static int azx_thaw_noirq(struct device *dev) |
4750 |
+ struct azx *chip = card->private_data; |
4751 |
+ struct pci_dev *pci = to_pci_dev(dev); |
4752 |
+ |
4753 |
++ if (!azx_is_pm_ready(card)) |
4754 |
++ return 0; |
4755 |
+ if (chip->driver_type == AZX_DRIVER_SKL) |
4756 |
+ pci_set_power_state(pci, PCI_D0); |
4757 |
+ |
4758 |
+@@ -1976,24 +1980,15 @@ static void azx_firmware_cb(const struct firmware *fw, void *context) |
4759 |
+ { |
4760 |
+ struct snd_card *card = context; |
4761 |
+ struct azx *chip = card->private_data; |
4762 |
+- struct pci_dev *pci = chip->pci; |
4763 |
+ |
4764 |
+- if (!fw) { |
4765 |
+- dev_err(card->dev, "Cannot load firmware, aborting\n"); |
4766 |
+- goto error; |
4767 |
+- } |
4768 |
+- |
4769 |
+- chip->fw = fw; |
4770 |
++ if (fw) |
4771 |
++ chip->fw = fw; |
4772 |
++ else |
4773 |
++ dev_err(card->dev, "Cannot load firmware, continue without patching\n"); |
4774 |
+ if (!chip->disabled) { |
4775 |
+ /* continue probing */ |
4776 |
+- if (azx_probe_continue(chip)) |
4777 |
+- goto error; |
4778 |
++ azx_probe_continue(chip); |
4779 |
+ } |
4780 |
+- return; /* OK */ |
4781 |
+- |
4782 |
+- error: |
4783 |
+- snd_card_free(card); |
4784 |
+- pci_set_drvdata(pci, NULL); |
4785 |
+ } |
4786 |
+ #endif |
4787 |
+ |
4788 |
+diff --git a/tools/objtool/check.c b/tools/objtool/check.c |
4789 |
+index f53d3c515cdc..9fa4e1a46ca9 100644 |
4790 |
+--- a/tools/objtool/check.c |
4791 |
++++ b/tools/objtool/check.c |
4792 |
+@@ -1010,10 +1010,7 @@ static struct rela *find_jump_table(struct objtool_file *file, |
4793 |
+ * it. |
4794 |
+ */ |
4795 |
+ for (; |
4796 |
+- &insn->list != &file->insn_list && |
4797 |
+- insn->sec == func->sec && |
4798 |
+- insn->offset >= func->offset; |
4799 |
+- |
4800 |
++ &insn->list != &file->insn_list && insn->func && insn->func->pfunc == func; |
4801 |
+ insn = insn->first_jump_src ?: list_prev_entry(insn, list)) { |
4802 |
+ |
4803 |
+ if (insn != orig_insn && insn->type == INSN_JUMP_DYNAMIC) |
4804 |
+diff --git a/tools/testing/selftests/bpf/prog_tests/get_stack_raw_tp.c b/tools/testing/selftests/bpf/prog_tests/get_stack_raw_tp.c |
4805 |
+index eba9a970703b..925722217edf 100644 |
4806 |
+--- a/tools/testing/selftests/bpf/prog_tests/get_stack_raw_tp.c |
4807 |
++++ b/tools/testing/selftests/bpf/prog_tests/get_stack_raw_tp.c |
4808 |
+@@ -82,6 +82,7 @@ static void get_stack_print_output(void *ctx, int cpu, void *data, __u32 size) |
4809 |
+ void test_get_stack_raw_tp(void) |
4810 |
+ { |
4811 |
+ const char *file = "./test_get_stack_rawtp.o"; |
4812 |
++ const char *file_err = "./test_get_stack_rawtp_err.o"; |
4813 |
+ const char *prog_name = "raw_tracepoint/sys_enter"; |
4814 |
+ int i, err, prog_fd, exp_cnt = MAX_CNT_RAWTP; |
4815 |
+ struct perf_buffer_opts pb_opts = {}; |
4816 |
+@@ -93,6 +94,10 @@ void test_get_stack_raw_tp(void) |
4817 |
+ struct bpf_map *map; |
4818 |
+ cpu_set_t cpu_set; |
4819 |
+ |
4820 |
++ err = bpf_prog_load(file_err, BPF_PROG_TYPE_RAW_TRACEPOINT, &obj, &prog_fd); |
4821 |
++ if (CHECK(err >= 0, "prog_load raw tp", "err %d errno %d\n", err, errno)) |
4822 |
++ return; |
4823 |
++ |
4824 |
+ err = bpf_prog_load(file, BPF_PROG_TYPE_RAW_TRACEPOINT, &obj, &prog_fd); |
4825 |
+ if (CHECK(err, "prog_load raw tp", "err %d errno %d\n", err, errno)) |
4826 |
+ return; |
4827 |
+diff --git a/tools/testing/selftests/bpf/progs/test_get_stack_rawtp_err.c b/tools/testing/selftests/bpf/progs/test_get_stack_rawtp_err.c |
4828 |
+new file mode 100644 |
4829 |
+index 000000000000..8941a41c2a55 |
4830 |
+--- /dev/null |
4831 |
++++ b/tools/testing/selftests/bpf/progs/test_get_stack_rawtp_err.c |
4832 |
+@@ -0,0 +1,26 @@ |
4833 |
++// SPDX-License-Identifier: GPL-2.0 |
4834 |
++ |
4835 |
++#include <linux/bpf.h> |
4836 |
++#include <bpf/bpf_helpers.h> |
4837 |
++ |
4838 |
++#define MAX_STACK_RAWTP 10 |
4839 |
++ |
4840 |
++SEC("raw_tracepoint/sys_enter") |
4841 |
++int bpf_prog2(void *ctx) |
4842 |
++{ |
4843 |
++ __u64 stack[MAX_STACK_RAWTP]; |
4844 |
++ int error; |
4845 |
++ |
4846 |
++ /* set all the flags which should return -EINVAL */ |
4847 |
++ error = bpf_get_stack(ctx, stack, 0, -1); |
4848 |
++ if (error < 0) |
4849 |
++ goto loop; |
4850 |
++ |
4851 |
++ return error; |
4852 |
++loop: |
4853 |
++ while (1) { |
4854 |
++ error++; |
4855 |
++ } |
4856 |
++} |
4857 |
++ |
4858 |
++char _license[] SEC("license") = "GPL"; |
4859 |
+diff --git a/tools/testing/selftests/bpf/verifier/bpf_get_stack.c b/tools/testing/selftests/bpf/verifier/bpf_get_stack.c |
4860 |
+index f24d50f09dbe..371926771db5 100644 |
4861 |
+--- a/tools/testing/selftests/bpf/verifier/bpf_get_stack.c |
4862 |
++++ b/tools/testing/selftests/bpf/verifier/bpf_get_stack.c |
4863 |
+@@ -9,17 +9,17 @@ |
4864 |
+ BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0, BPF_FUNC_map_lookup_elem), |
4865 |
+ BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, 0, 28), |
4866 |
+ BPF_MOV64_REG(BPF_REG_7, BPF_REG_0), |
4867 |
+- BPF_MOV64_IMM(BPF_REG_9, sizeof(struct test_val)), |
4868 |
++ BPF_MOV64_IMM(BPF_REG_9, sizeof(struct test_val)/2), |
4869 |
+ BPF_MOV64_REG(BPF_REG_1, BPF_REG_6), |
4870 |
+ BPF_MOV64_REG(BPF_REG_2, BPF_REG_7), |
4871 |
+- BPF_MOV64_IMM(BPF_REG_3, sizeof(struct test_val)), |
4872 |
++ BPF_MOV64_IMM(BPF_REG_3, sizeof(struct test_val)/2), |
4873 |
+ BPF_MOV64_IMM(BPF_REG_4, 256), |
4874 |
+ BPF_EMIT_CALL(BPF_FUNC_get_stack), |
4875 |
+ BPF_MOV64_IMM(BPF_REG_1, 0), |
4876 |
+ BPF_MOV64_REG(BPF_REG_8, BPF_REG_0), |
4877 |
+ BPF_ALU64_IMM(BPF_LSH, BPF_REG_8, 32), |
4878 |
+ BPF_ALU64_IMM(BPF_ARSH, BPF_REG_8, 32), |
4879 |
+- BPF_JMP_REG(BPF_JSLT, BPF_REG_1, BPF_REG_8, 16), |
4880 |
++ BPF_JMP_REG(BPF_JSLT, BPF_REG_8, BPF_REG_1, 16), |
4881 |
+ BPF_ALU64_REG(BPF_SUB, BPF_REG_9, BPF_REG_8), |
4882 |
+ BPF_MOV64_REG(BPF_REG_2, BPF_REG_7), |
4883 |
+ BPF_ALU64_REG(BPF_ADD, BPF_REG_2, BPF_REG_8), |
4884 |
+@@ -29,7 +29,7 @@ |
4885 |
+ BPF_MOV64_REG(BPF_REG_3, BPF_REG_2), |
4886 |
+ BPF_ALU64_REG(BPF_ADD, BPF_REG_3, BPF_REG_1), |
4887 |
+ BPF_MOV64_REG(BPF_REG_1, BPF_REG_7), |
4888 |
+- BPF_MOV64_IMM(BPF_REG_5, sizeof(struct test_val)), |
4889 |
++ BPF_MOV64_IMM(BPF_REG_5, sizeof(struct test_val)/2), |
4890 |
+ BPF_ALU64_REG(BPF_ADD, BPF_REG_1, BPF_REG_5), |
4891 |
+ BPF_JMP_REG(BPF_JGE, BPF_REG_3, BPF_REG_1, 4), |
4892 |
+ BPF_MOV64_REG(BPF_REG_1, BPF_REG_6), |