1 |
commit: 77ac4ddfeee00a9bc434886268f66c421d281d82 |
2 |
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
3 |
AuthorDate: Thu Apr 23 11:56:06 2020 +0000 |
4 |
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Apr 23 11:56:06 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=77ac4ddf |
7 |
|
8 |
Linux patch 5.6.7 |
9 |
|
10 |
Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org> |
11 |
|
12 |
0000_README | 4 + |
13 |
1006_linux-5.6.7.patch | 6688 ++++++++++++++++++++++++++++++++++++++++++++++++ |
14 |
2 files changed, 6692 insertions(+) |
15 |
|
16 |
diff --git a/0000_README b/0000_README |
17 |
index 073a921..8000cff 100644 |
18 |
--- a/0000_README |
19 |
+++ b/0000_README |
20 |
@@ -67,6 +67,10 @@ Patch: 1005_linux-5.6.6.patch |
21 |
From: http://www.kernel.org |
22 |
Desc: Linux 5.6.6 |
23 |
|
24 |
+Patch: 1006_linux-5.6.7.patch |
25 |
+From: http://www.kernel.org |
26 |
+Desc: Linux 5.6.7 |
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/1006_linux-5.6.7.patch b/1006_linux-5.6.7.patch |
33 |
new file mode 100644 |
34 |
index 0000000..4c0dfa8 |
35 |
--- /dev/null |
36 |
+++ b/1006_linux-5.6.7.patch |
37 |
@@ -0,0 +1,6688 @@ |
38 |
+diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt |
39 |
+index c07815d230bc..6ba631cc5a56 100644 |
40 |
+--- a/Documentation/admin-guide/kernel-parameters.txt |
41 |
++++ b/Documentation/admin-guide/kernel-parameters.txt |
42 |
+@@ -2795,7 +2795,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/Documentation/devicetree/bindings/thermal/qcom-tsens.yaml b/Documentation/devicetree/bindings/thermal/qcom-tsens.yaml |
65 |
+index eef13b9446a8..a4df53228122 100644 |
66 |
+--- a/Documentation/devicetree/bindings/thermal/qcom-tsens.yaml |
67 |
++++ b/Documentation/devicetree/bindings/thermal/qcom-tsens.yaml |
68 |
+@@ -53,13 +53,12 @@ properties: |
69 |
+ description: |
70 |
+ Reference to an nvmem node for the calibration data |
71 |
+ |
72 |
+- nvmem-cells-names: |
73 |
++ nvmem-cell-names: |
74 |
+ minItems: 1 |
75 |
+ maxItems: 2 |
76 |
+ items: |
77 |
+- - enum: |
78 |
+- - caldata |
79 |
+- - calsel |
80 |
++ - const: calib |
81 |
++ - const: calib_sel |
82 |
+ |
83 |
+ "#qcom,sensors": |
84 |
+ allOf: |
85 |
+@@ -125,7 +124,7 @@ examples: |
86 |
+ <0x4a8000 0x1000>; /* SROT */ |
87 |
+ |
88 |
+ nvmem-cells = <&tsens_caldata>, <&tsens_calsel>; |
89 |
+- nvmem-cell-names = "caldata", "calsel"; |
90 |
++ nvmem-cell-names = "calib", "calib_sel"; |
91 |
+ |
92 |
+ interrupts = <GIC_SPI 184 IRQ_TYPE_LEVEL_HIGH>; |
93 |
+ interrupt-names = "uplow"; |
94 |
+diff --git a/Makefile b/Makefile |
95 |
+index af76c00de7f6..b64df959e5d7 100644 |
96 |
+--- a/Makefile |
97 |
++++ b/Makefile |
98 |
+@@ -1,7 +1,7 @@ |
99 |
+ # SPDX-License-Identifier: GPL-2.0 |
100 |
+ VERSION = 5 |
101 |
+ PATCHLEVEL = 6 |
102 |
+-SUBLEVEL = 6 |
103 |
++SUBLEVEL = 7 |
104 |
+ EXTRAVERSION = |
105 |
+ NAME = Kleptomaniac Octopus |
106 |
+ |
107 |
+diff --git a/arch/arm/boot/dts/imx6qdl.dtsi b/arch/arm/boot/dts/imx6qdl.dtsi |
108 |
+index e6b4b8525f98..bc488df31511 100644 |
109 |
+--- a/arch/arm/boot/dts/imx6qdl.dtsi |
110 |
++++ b/arch/arm/boot/dts/imx6qdl.dtsi |
111 |
+@@ -1039,9 +1039,8 @@ |
112 |
+ compatible = "fsl,imx6q-fec"; |
113 |
+ reg = <0x02188000 0x4000>; |
114 |
+ interrupt-names = "int0", "pps"; |
115 |
+- interrupts-extended = |
116 |
+- <&intc 0 118 IRQ_TYPE_LEVEL_HIGH>, |
117 |
+- <&intc 0 119 IRQ_TYPE_LEVEL_HIGH>; |
118 |
++ interrupts = <0 118 IRQ_TYPE_LEVEL_HIGH>, |
119 |
++ <0 119 IRQ_TYPE_LEVEL_HIGH>; |
120 |
+ clocks = <&clks IMX6QDL_CLK_ENET>, |
121 |
+ <&clks IMX6QDL_CLK_ENET>, |
122 |
+ <&clks IMX6QDL_CLK_ENET_REF>; |
123 |
+diff --git a/arch/arm/boot/dts/imx6qp.dtsi b/arch/arm/boot/dts/imx6qp.dtsi |
124 |
+index 5f51f8e5c1fa..d91f92f944c5 100644 |
125 |
+--- a/arch/arm/boot/dts/imx6qp.dtsi |
126 |
++++ b/arch/arm/boot/dts/imx6qp.dtsi |
127 |
+@@ -77,7 +77,6 @@ |
128 |
+ }; |
129 |
+ |
130 |
+ &fec { |
131 |
+- /delete-property/interrupts-extended; |
132 |
+ interrupts = <0 118 IRQ_TYPE_LEVEL_HIGH>, |
133 |
+ <0 119 IRQ_TYPE_LEVEL_HIGH>; |
134 |
+ }; |
135 |
+diff --git a/arch/arm/boot/dts/rk3188-bqedison2qc.dts b/arch/arm/boot/dts/rk3188-bqedison2qc.dts |
136 |
+index ad1afd403052..66a0ff196eb1 100644 |
137 |
+--- a/arch/arm/boot/dts/rk3188-bqedison2qc.dts |
138 |
++++ b/arch/arm/boot/dts/rk3188-bqedison2qc.dts |
139 |
+@@ -58,20 +58,25 @@ |
140 |
+ |
141 |
+ lvds-encoder { |
142 |
+ compatible = "ti,sn75lvds83", "lvds-encoder"; |
143 |
+- #address-cells = <1>; |
144 |
+- #size-cells = <0>; |
145 |
+ |
146 |
+- port@0 { |
147 |
+- reg = <0>; |
148 |
+- lvds_in_vop0: endpoint { |
149 |
+- remote-endpoint = <&vop0_out_lvds>; |
150 |
++ ports { |
151 |
++ #address-cells = <1>; |
152 |
++ #size-cells = <0>; |
153 |
++ |
154 |
++ port@0 { |
155 |
++ reg = <0>; |
156 |
++ |
157 |
++ lvds_in_vop0: endpoint { |
158 |
++ remote-endpoint = <&vop0_out_lvds>; |
159 |
++ }; |
160 |
+ }; |
161 |
+- }; |
162 |
+ |
163 |
+- port@1 { |
164 |
+- reg = <1>; |
165 |
+- lvds_out_panel: endpoint { |
166 |
+- remote-endpoint = <&panel_in_lvds>; |
167 |
++ port@1 { |
168 |
++ reg = <1>; |
169 |
++ |
170 |
++ lvds_out_panel: endpoint { |
171 |
++ remote-endpoint = <&panel_in_lvds>; |
172 |
++ }; |
173 |
+ }; |
174 |
+ }; |
175 |
+ }; |
176 |
+@@ -465,7 +470,7 @@ |
177 |
+ non-removable; |
178 |
+ pinctrl-names = "default"; |
179 |
+ pinctrl-0 = <&sd1_clk>, <&sd1_cmd>, <&sd1_bus4>; |
180 |
+- vmmcq-supply = <&vccio_wl>; |
181 |
++ vqmmc-supply = <&vccio_wl>; |
182 |
+ #address-cells = <1>; |
183 |
+ #size-cells = <0>; |
184 |
+ status = "okay"; |
185 |
+diff --git a/arch/arm/boot/dts/sun8i-a83t.dtsi b/arch/arm/boot/dts/sun8i-a83t.dtsi |
186 |
+index e7b9bef1be6b..bd1287eca253 100644 |
187 |
+--- a/arch/arm/boot/dts/sun8i-a83t.dtsi |
188 |
++++ b/arch/arm/boot/dts/sun8i-a83t.dtsi |
189 |
+@@ -314,7 +314,7 @@ |
190 |
+ |
191 |
+ display_clocks: clock@1000000 { |
192 |
+ compatible = "allwinner,sun8i-a83t-de2-clk"; |
193 |
+- reg = <0x01000000 0x100000>; |
194 |
++ reg = <0x01000000 0x10000>; |
195 |
+ clocks = <&ccu CLK_BUS_DE>, |
196 |
+ <&ccu CLK_PLL_DE>; |
197 |
+ clock-names = "bus", |
198 |
+diff --git a/arch/arm/boot/dts/sun8i-r40.dtsi b/arch/arm/boot/dts/sun8i-r40.dtsi |
199 |
+index a9d5d6ddbd71..a3867491bb46 100644 |
200 |
+--- a/arch/arm/boot/dts/sun8i-r40.dtsi |
201 |
++++ b/arch/arm/boot/dts/sun8i-r40.dtsi |
202 |
+@@ -119,7 +119,7 @@ |
203 |
+ display_clocks: clock@1000000 { |
204 |
+ compatible = "allwinner,sun8i-r40-de2-clk", |
205 |
+ "allwinner,sun8i-h3-de2-clk"; |
206 |
+- reg = <0x01000000 0x100000>; |
207 |
++ reg = <0x01000000 0x10000>; |
208 |
+ clocks = <&ccu CLK_BUS_DE>, |
209 |
+ <&ccu CLK_DE>; |
210 |
+ clock-names = "bus", |
211 |
+diff --git a/arch/arm/boot/dts/sun8i-v3s.dtsi b/arch/arm/boot/dts/sun8i-v3s.dtsi |
212 |
+index 81ea50838cd5..e5312869c0d2 100644 |
213 |
+--- a/arch/arm/boot/dts/sun8i-v3s.dtsi |
214 |
++++ b/arch/arm/boot/dts/sun8i-v3s.dtsi |
215 |
+@@ -105,7 +105,7 @@ |
216 |
+ |
217 |
+ display_clocks: clock@1000000 { |
218 |
+ compatible = "allwinner,sun8i-v3s-de2-clk"; |
219 |
+- reg = <0x01000000 0x100000>; |
220 |
++ reg = <0x01000000 0x10000>; |
221 |
+ clocks = <&ccu CLK_BUS_DE>, |
222 |
+ <&ccu CLK_DE>; |
223 |
+ clock-names = "bus", |
224 |
+diff --git a/arch/arm/boot/dts/sunxi-h3-h5.dtsi b/arch/arm/boot/dts/sunxi-h3-h5.dtsi |
225 |
+index 5e9c3060aa08..799f32bafd80 100644 |
226 |
+--- a/arch/arm/boot/dts/sunxi-h3-h5.dtsi |
227 |
++++ b/arch/arm/boot/dts/sunxi-h3-h5.dtsi |
228 |
+@@ -114,7 +114,7 @@ |
229 |
+ |
230 |
+ display_clocks: clock@1000000 { |
231 |
+ /* compatible is in per SoC .dtsi file */ |
232 |
+- reg = <0x01000000 0x100000>; |
233 |
++ reg = <0x01000000 0x10000>; |
234 |
+ clocks = <&ccu CLK_BUS_DE>, |
235 |
+ <&ccu CLK_DE>; |
236 |
+ clock-names = "bus", |
237 |
+diff --git a/arch/arm/net/bpf_jit_32.c b/arch/arm/net/bpf_jit_32.c |
238 |
+index cc29869d12a3..bf85d6db4931 100644 |
239 |
+--- a/arch/arm/net/bpf_jit_32.c |
240 |
++++ b/arch/arm/net/bpf_jit_32.c |
241 |
+@@ -929,7 +929,11 @@ static inline void emit_a32_rsh_i64(const s8 dst[], |
242 |
+ rd = arm_bpf_get_reg64(dst, tmp, ctx); |
243 |
+ |
244 |
+ /* Do LSR operation */ |
245 |
+- if (val < 32) { |
246 |
++ if (val == 0) { |
247 |
++ /* An immediate value of 0 encodes a shift amount of 32 |
248 |
++ * for LSR. To shift by 0, don't do anything. |
249 |
++ */ |
250 |
++ } else if (val < 32) { |
251 |
+ emit(ARM_MOV_SI(tmp2[1], rd[1], SRTYPE_LSR, val), ctx); |
252 |
+ emit(ARM_ORR_SI(rd[1], tmp2[1], rd[0], SRTYPE_ASL, 32 - val), ctx); |
253 |
+ emit(ARM_MOV_SI(rd[0], rd[0], SRTYPE_LSR, val), ctx); |
254 |
+@@ -955,7 +959,11 @@ static inline void emit_a32_arsh_i64(const s8 dst[], |
255 |
+ rd = arm_bpf_get_reg64(dst, tmp, ctx); |
256 |
+ |
257 |
+ /* Do ARSH operation */ |
258 |
+- if (val < 32) { |
259 |
++ if (val == 0) { |
260 |
++ /* An immediate value of 0 encodes a shift amount of 32 |
261 |
++ * for ASR. To shift by 0, don't do anything. |
262 |
++ */ |
263 |
++ } else if (val < 32) { |
264 |
+ emit(ARM_MOV_SI(tmp2[1], rd[1], SRTYPE_LSR, val), ctx); |
265 |
+ emit(ARM_ORR_SI(rd[1], tmp2[1], rd[0], SRTYPE_ASL, 32 - val), ctx); |
266 |
+ emit(ARM_MOV_SI(rd[0], rd[0], SRTYPE_ASR, val), ctx); |
267 |
+@@ -992,21 +1000,35 @@ static inline void emit_a32_mul_r64(const s8 dst[], const s8 src[], |
268 |
+ arm_bpf_put_reg32(dst_hi, rd[0], ctx); |
269 |
+ } |
270 |
+ |
271 |
++static bool is_ldst_imm(s16 off, const u8 size) |
272 |
++{ |
273 |
++ s16 off_max = 0; |
274 |
++ |
275 |
++ switch (size) { |
276 |
++ case BPF_B: |
277 |
++ case BPF_W: |
278 |
++ off_max = 0xfff; |
279 |
++ break; |
280 |
++ case BPF_H: |
281 |
++ off_max = 0xff; |
282 |
++ break; |
283 |
++ case BPF_DW: |
284 |
++ /* Need to make sure off+4 does not overflow. */ |
285 |
++ off_max = 0xfff - 4; |
286 |
++ break; |
287 |
++ } |
288 |
++ return -off_max <= off && off <= off_max; |
289 |
++} |
290 |
++ |
291 |
+ /* *(size *)(dst + off) = src */ |
292 |
+ static inline void emit_str_r(const s8 dst, const s8 src[], |
293 |
+- s32 off, struct jit_ctx *ctx, const u8 sz){ |
294 |
++ s16 off, struct jit_ctx *ctx, const u8 sz){ |
295 |
+ const s8 *tmp = bpf2a32[TMP_REG_1]; |
296 |
+- s32 off_max; |
297 |
+ s8 rd; |
298 |
+ |
299 |
+ rd = arm_bpf_get_reg32(dst, tmp[1], ctx); |
300 |
+ |
301 |
+- if (sz == BPF_H) |
302 |
+- off_max = 0xff; |
303 |
+- else |
304 |
+- off_max = 0xfff; |
305 |
+- |
306 |
+- if (off < 0 || off > off_max) { |
307 |
++ if (!is_ldst_imm(off, sz)) { |
308 |
+ emit_a32_mov_i(tmp[0], off, ctx); |
309 |
+ emit(ARM_ADD_R(tmp[0], tmp[0], rd), ctx); |
310 |
+ rd = tmp[0]; |
311 |
+@@ -1035,18 +1057,12 @@ static inline void emit_str_r(const s8 dst, const s8 src[], |
312 |
+ |
313 |
+ /* dst = *(size*)(src + off) */ |
314 |
+ static inline void emit_ldx_r(const s8 dst[], const s8 src, |
315 |
+- s32 off, struct jit_ctx *ctx, const u8 sz){ |
316 |
++ s16 off, struct jit_ctx *ctx, const u8 sz){ |
317 |
+ const s8 *tmp = bpf2a32[TMP_REG_1]; |
318 |
+ const s8 *rd = is_stacked(dst_lo) ? tmp : dst; |
319 |
+ s8 rm = src; |
320 |
+- s32 off_max; |
321 |
+- |
322 |
+- if (sz == BPF_H) |
323 |
+- off_max = 0xff; |
324 |
+- else |
325 |
+- off_max = 0xfff; |
326 |
+ |
327 |
+- if (off < 0 || off > off_max) { |
328 |
++ if (!is_ldst_imm(off, sz)) { |
329 |
+ emit_a32_mov_i(tmp[0], off, ctx); |
330 |
+ emit(ARM_ADD_R(tmp[0], tmp[0], src), ctx); |
331 |
+ rm = tmp[0]; |
332 |
+diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi |
333 |
+index 862b47dc9dc9..baa6f08dc108 100644 |
334 |
+--- a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi |
335 |
++++ b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi |
336 |
+@@ -264,7 +264,7 @@ |
337 |
+ |
338 |
+ display_clocks: clock@0 { |
339 |
+ compatible = "allwinner,sun50i-a64-de2-clk"; |
340 |
+- reg = <0x0 0x100000>; |
341 |
++ reg = <0x0 0x10000>; |
342 |
+ clocks = <&ccu CLK_BUS_DE>, |
343 |
+ <&ccu CLK_DE>; |
344 |
+ clock-names = "bus", |
345 |
+diff --git a/arch/arm64/boot/dts/marvell/armada-3720-espressobin.dtsi b/arch/arm64/boot/dts/marvell/armada-3720-espressobin.dtsi |
346 |
+index 53b8ac55a7f3..e5262dab28f5 100644 |
347 |
+--- a/arch/arm64/boot/dts/marvell/armada-3720-espressobin.dtsi |
348 |
++++ b/arch/arm64/boot/dts/marvell/armada-3720-espressobin.dtsi |
349 |
+@@ -13,6 +13,12 @@ |
350 |
+ #include "armada-372x.dtsi" |
351 |
+ |
352 |
+ / { |
353 |
++ aliases { |
354 |
++ ethernet0 = ð0; |
355 |
++ serial0 = &uart0; |
356 |
++ serial1 = &uart1; |
357 |
++ }; |
358 |
++ |
359 |
+ chosen { |
360 |
+ stdout-path = "serial0:115200n8"; |
361 |
+ }; |
362 |
+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 |
363 |
+index a211a046b2f2..b90d78a5724b 100644 |
364 |
+--- a/arch/arm64/boot/dts/marvell/armada-8040-clearfog-gt-8k.dts |
365 |
++++ b/arch/arm64/boot/dts/marvell/armada-8040-clearfog-gt-8k.dts |
366 |
+@@ -367,6 +367,7 @@ |
367 |
+ pinctrl-0 = <&cp0_copper_eth_phy_reset>; |
368 |
+ reset-gpios = <&cp0_gpio2 11 GPIO_ACTIVE_LOW>; |
369 |
+ reset-assert-us = <10000>; |
370 |
++ reset-deassert-us = <10000>; |
371 |
+ }; |
372 |
+ |
373 |
+ switch0: switch0@4 { |
374 |
+diff --git a/arch/arm64/boot/dts/marvell/armada-ap807-quad.dtsi b/arch/arm64/boot/dts/marvell/armada-ap807-quad.dtsi |
375 |
+index 840466e143b4..68782f161f12 100644 |
376 |
+--- a/arch/arm64/boot/dts/marvell/armada-ap807-quad.dtsi |
377 |
++++ b/arch/arm64/boot/dts/marvell/armada-ap807-quad.dtsi |
378 |
+@@ -17,7 +17,7 @@ |
379 |
+ |
380 |
+ cpu0: cpu@0 { |
381 |
+ device_type = "cpu"; |
382 |
+- compatible = "arm,cortex-a72", "arm,armv8"; |
383 |
++ compatible = "arm,cortex-a72"; |
384 |
+ reg = <0x000>; |
385 |
+ enable-method = "psci"; |
386 |
+ #cooling-cells = <2>; |
387 |
+@@ -32,7 +32,7 @@ |
388 |
+ }; |
389 |
+ cpu1: cpu@1 { |
390 |
+ device_type = "cpu"; |
391 |
+- compatible = "arm,cortex-a72", "arm,armv8"; |
392 |
++ compatible = "arm,cortex-a72"; |
393 |
+ reg = <0x001>; |
394 |
+ enable-method = "psci"; |
395 |
+ #cooling-cells = <2>; |
396 |
+@@ -47,7 +47,7 @@ |
397 |
+ }; |
398 |
+ cpu2: cpu@100 { |
399 |
+ device_type = "cpu"; |
400 |
+- compatible = "arm,cortex-a72", "arm,armv8"; |
401 |
++ compatible = "arm,cortex-a72"; |
402 |
+ reg = <0x100>; |
403 |
+ enable-method = "psci"; |
404 |
+ #cooling-cells = <2>; |
405 |
+@@ -62,7 +62,7 @@ |
406 |
+ }; |
407 |
+ cpu3: cpu@101 { |
408 |
+ device_type = "cpu"; |
409 |
+- compatible = "arm,cortex-a72", "arm,armv8"; |
410 |
++ compatible = "arm,cortex-a72"; |
411 |
+ reg = <0x101>; |
412 |
+ enable-method = "psci"; |
413 |
+ #cooling-cells = <2>; |
414 |
+diff --git a/arch/arm64/boot/dts/nvidia/tegra194.dtsi b/arch/arm64/boot/dts/nvidia/tegra194.dtsi |
415 |
+index ccac43be12ac..a8f024662e60 100644 |
416 |
+--- a/arch/arm64/boot/dts/nvidia/tegra194.dtsi |
417 |
++++ b/arch/arm64/boot/dts/nvidia/tegra194.dtsi |
418 |
+@@ -1208,7 +1208,7 @@ |
419 |
+ }; |
420 |
+ |
421 |
+ pcie@14100000 { |
422 |
+- compatible = "nvidia,tegra194-pcie", "snps,dw-pcie"; |
423 |
++ compatible = "nvidia,tegra194-pcie"; |
424 |
+ power-domains = <&bpmp TEGRA194_POWER_DOMAIN_PCIEX1A>; |
425 |
+ reg = <0x00 0x14100000 0x0 0x00020000 /* appl registers (128K) */ |
426 |
+ 0x00 0x30000000 0x0 0x00040000 /* configuration space (256K) */ |
427 |
+@@ -1253,7 +1253,7 @@ |
428 |
+ }; |
429 |
+ |
430 |
+ pcie@14120000 { |
431 |
+- compatible = "nvidia,tegra194-pcie", "snps,dw-pcie"; |
432 |
++ compatible = "nvidia,tegra194-pcie"; |
433 |
+ power-domains = <&bpmp TEGRA194_POWER_DOMAIN_PCIEX1A>; |
434 |
+ reg = <0x00 0x14120000 0x0 0x00020000 /* appl registers (128K) */ |
435 |
+ 0x00 0x32000000 0x0 0x00040000 /* configuration space (256K) */ |
436 |
+@@ -1298,7 +1298,7 @@ |
437 |
+ }; |
438 |
+ |
439 |
+ pcie@14140000 { |
440 |
+- compatible = "nvidia,tegra194-pcie", "snps,dw-pcie"; |
441 |
++ compatible = "nvidia,tegra194-pcie"; |
442 |
+ power-domains = <&bpmp TEGRA194_POWER_DOMAIN_PCIEX1A>; |
443 |
+ reg = <0x00 0x14140000 0x0 0x00020000 /* appl registers (128K) */ |
444 |
+ 0x00 0x34000000 0x0 0x00040000 /* configuration space (256K) */ |
445 |
+@@ -1343,7 +1343,7 @@ |
446 |
+ }; |
447 |
+ |
448 |
+ pcie@14160000 { |
449 |
+- compatible = "nvidia,tegra194-pcie", "snps,dw-pcie"; |
450 |
++ compatible = "nvidia,tegra194-pcie"; |
451 |
+ power-domains = <&bpmp TEGRA194_POWER_DOMAIN_PCIEX4A>; |
452 |
+ reg = <0x00 0x14160000 0x0 0x00020000 /* appl registers (128K) */ |
453 |
+ 0x00 0x36000000 0x0 0x00040000 /* configuration space (256K) */ |
454 |
+@@ -1388,7 +1388,7 @@ |
455 |
+ }; |
456 |
+ |
457 |
+ pcie@14180000 { |
458 |
+- compatible = "nvidia,tegra194-pcie", "snps,dw-pcie"; |
459 |
++ compatible = "nvidia,tegra194-pcie"; |
460 |
+ power-domains = <&bpmp TEGRA194_POWER_DOMAIN_PCIEX8B>; |
461 |
+ reg = <0x00 0x14180000 0x0 0x00020000 /* appl registers (128K) */ |
462 |
+ 0x00 0x38000000 0x0 0x00040000 /* configuration space (256K) */ |
463 |
+@@ -1433,7 +1433,7 @@ |
464 |
+ }; |
465 |
+ |
466 |
+ pcie@141a0000 { |
467 |
+- compatible = "nvidia,tegra194-pcie", "snps,dw-pcie"; |
468 |
++ compatible = "nvidia,tegra194-pcie"; |
469 |
+ power-domains = <&bpmp TEGRA194_POWER_DOMAIN_PCIEX8A>; |
470 |
+ reg = <0x00 0x141a0000 0x0 0x00020000 /* appl registers (128K) */ |
471 |
+ 0x00 0x3a000000 0x0 0x00040000 /* configuration space (256K) */ |
472 |
+@@ -1481,6 +1481,105 @@ |
473 |
+ 0x82000000 0x0 0x40000000 0x1f 0x40000000 0x0 0xc0000000>; /* non-prefetchable memory (3GB) */ |
474 |
+ }; |
475 |
+ |
476 |
++ pcie_ep@14160000 { |
477 |
++ compatible = "nvidia,tegra194-pcie-ep", "snps,dw-pcie-ep"; |
478 |
++ power-domains = <&bpmp TEGRA194_POWER_DOMAIN_PCIEX4A>; |
479 |
++ reg = <0x00 0x14160000 0x0 0x00020000 /* appl registers (128K) */ |
480 |
++ 0x00 0x36040000 0x0 0x00040000 /* iATU_DMA reg space (256K) */ |
481 |
++ 0x00 0x36080000 0x0 0x00040000 /* DBI reg space (256K) */ |
482 |
++ 0x14 0x00000000 0x4 0x00000000>; /* Address Space (16G) */ |
483 |
++ reg-names = "appl", "atu_dma", "dbi", "addr_space"; |
484 |
++ |
485 |
++ status = "disabled"; |
486 |
++ |
487 |
++ num-lanes = <4>; |
488 |
++ num-ib-windows = <2>; |
489 |
++ num-ob-windows = <8>; |
490 |
++ |
491 |
++ clocks = <&bpmp TEGRA194_CLK_PEX0_CORE_4>; |
492 |
++ clock-names = "core"; |
493 |
++ |
494 |
++ resets = <&bpmp TEGRA194_RESET_PEX0_CORE_4_APB>, |
495 |
++ <&bpmp TEGRA194_RESET_PEX0_CORE_4>; |
496 |
++ reset-names = "apb", "core"; |
497 |
++ |
498 |
++ interrupts = <GIC_SPI 51 IRQ_TYPE_LEVEL_HIGH>; /* controller interrupt */ |
499 |
++ interrupt-names = "intr"; |
500 |
++ |
501 |
++ nvidia,bpmp = <&bpmp 4>; |
502 |
++ |
503 |
++ nvidia,aspm-cmrt-us = <60>; |
504 |
++ nvidia,aspm-pwr-on-t-us = <20>; |
505 |
++ nvidia,aspm-l0s-entrance-latency-us = <3>; |
506 |
++ }; |
507 |
++ |
508 |
++ pcie_ep@14180000 { |
509 |
++ compatible = "nvidia,tegra194-pcie-ep", "snps,dw-pcie-ep"; |
510 |
++ power-domains = <&bpmp TEGRA194_POWER_DOMAIN_PCIEX8B>; |
511 |
++ reg = <0x00 0x14180000 0x0 0x00020000 /* appl registers (128K) */ |
512 |
++ 0x00 0x38040000 0x0 0x00040000 /* iATU_DMA reg space (256K) */ |
513 |
++ 0x00 0x38080000 0x0 0x00040000 /* DBI reg space (256K) */ |
514 |
++ 0x18 0x00000000 0x4 0x00000000>; /* Address Space (16G) */ |
515 |
++ reg-names = "appl", "atu_dma", "dbi", "addr_space"; |
516 |
++ |
517 |
++ status = "disabled"; |
518 |
++ |
519 |
++ num-lanes = <8>; |
520 |
++ num-ib-windows = <2>; |
521 |
++ num-ob-windows = <8>; |
522 |
++ |
523 |
++ clocks = <&bpmp TEGRA194_CLK_PEX0_CORE_0>; |
524 |
++ clock-names = "core"; |
525 |
++ |
526 |
++ resets = <&bpmp TEGRA194_RESET_PEX0_CORE_0_APB>, |
527 |
++ <&bpmp TEGRA194_RESET_PEX0_CORE_0>; |
528 |
++ reset-names = "apb", "core"; |
529 |
++ |
530 |
++ interrupts = <GIC_SPI 72 IRQ_TYPE_LEVEL_HIGH>; /* controller interrupt */ |
531 |
++ interrupt-names = "intr"; |
532 |
++ |
533 |
++ nvidia,bpmp = <&bpmp 0>; |
534 |
++ |
535 |
++ nvidia,aspm-cmrt-us = <60>; |
536 |
++ nvidia,aspm-pwr-on-t-us = <20>; |
537 |
++ nvidia,aspm-l0s-entrance-latency-us = <3>; |
538 |
++ }; |
539 |
++ |
540 |
++ pcie_ep@141a0000 { |
541 |
++ compatible = "nvidia,tegra194-pcie-ep", "snps,dw-pcie-ep"; |
542 |
++ power-domains = <&bpmp TEGRA194_POWER_DOMAIN_PCIEX8A>; |
543 |
++ reg = <0x00 0x141a0000 0x0 0x00020000 /* appl registers (128K) */ |
544 |
++ 0x00 0x3a040000 0x0 0x00040000 /* iATU_DMA reg space (256K) */ |
545 |
++ 0x00 0x3a080000 0x0 0x00040000 /* DBI reg space (256K) */ |
546 |
++ 0x1c 0x00000000 0x4 0x00000000>; /* Address Space (16G) */ |
547 |
++ reg-names = "appl", "atu_dma", "dbi", "addr_space"; |
548 |
++ |
549 |
++ status = "disabled"; |
550 |
++ |
551 |
++ num-lanes = <8>; |
552 |
++ num-ib-windows = <2>; |
553 |
++ num-ob-windows = <8>; |
554 |
++ |
555 |
++ pinctrl-names = "default"; |
556 |
++ pinctrl-0 = <&clkreq_c5_bi_dir_state>; |
557 |
++ |
558 |
++ clocks = <&bpmp TEGRA194_CLK_PEX1_CORE_5>; |
559 |
++ clock-names = "core"; |
560 |
++ |
561 |
++ resets = <&bpmp TEGRA194_RESET_PEX1_CORE_5_APB>, |
562 |
++ <&bpmp TEGRA194_RESET_PEX1_CORE_5>; |
563 |
++ reset-names = "apb", "core"; |
564 |
++ |
565 |
++ interrupts = <GIC_SPI 53 IRQ_TYPE_LEVEL_HIGH>; /* controller interrupt */ |
566 |
++ interrupt-names = "intr"; |
567 |
++ |
568 |
++ nvidia,bpmp = <&bpmp 5>; |
569 |
++ |
570 |
++ nvidia,aspm-cmrt-us = <60>; |
571 |
++ nvidia,aspm-pwr-on-t-us = <20>; |
572 |
++ nvidia,aspm-l0s-entrance-latency-us = <3>; |
573 |
++ }; |
574 |
++ |
575 |
+ sysram@40000000 { |
576 |
+ compatible = "nvidia,tegra194-sysram", "mmio-sram"; |
577 |
+ reg = <0x0 0x40000000 0x0 0x50000>; |
578 |
+diff --git a/arch/csky/abiv1/inc/abi/entry.h b/arch/csky/abiv1/inc/abi/entry.h |
579 |
+index f35a9f3315ee..5056ebb902d1 100644 |
580 |
+--- a/arch/csky/abiv1/inc/abi/entry.h |
581 |
++++ b/arch/csky/abiv1/inc/abi/entry.h |
582 |
+@@ -172,10 +172,7 @@ |
583 |
+ addi r6, 0xe |
584 |
+ cpwcr r6, cpcr30 |
585 |
+ |
586 |
+- lsri r6, 28 |
587 |
+- addi r6, 2 |
588 |
+- lsli r6, 28 |
589 |
+- addi r6, 0xe |
590 |
++ movi r6, 0 |
591 |
+ cpwcr r6, cpcr31 |
592 |
+ .endm |
593 |
+ |
594 |
+diff --git a/arch/csky/abiv2/fpu.c b/arch/csky/abiv2/fpu.c |
595 |
+index 86d187d4e5af..5acc5c2e544e 100644 |
596 |
+--- a/arch/csky/abiv2/fpu.c |
597 |
++++ b/arch/csky/abiv2/fpu.c |
598 |
+@@ -10,11 +10,6 @@ |
599 |
+ #define MTCR_DIST 0xC0006420 |
600 |
+ #define MFCR_DIST 0xC0006020 |
601 |
+ |
602 |
+-void __init init_fpu(void) |
603 |
+-{ |
604 |
+- mtcr("cr<1, 2>", 0); |
605 |
+-} |
606 |
+- |
607 |
+ /* |
608 |
+ * fpu_libc_helper() is to help libc to excute: |
609 |
+ * - mfcr %a, cr<1, 2> |
610 |
+diff --git a/arch/csky/abiv2/inc/abi/entry.h b/arch/csky/abiv2/inc/abi/entry.h |
611 |
+index 94a7a58765df..111973c6c713 100644 |
612 |
+--- a/arch/csky/abiv2/inc/abi/entry.h |
613 |
++++ b/arch/csky/abiv2/inc/abi/entry.h |
614 |
+@@ -230,11 +230,8 @@ |
615 |
+ addi r6, 0x1ce |
616 |
+ mtcr r6, cr<30, 15> /* Set MSA0 */ |
617 |
+ |
618 |
+- lsri r6, 28 |
619 |
+- addi r6, 2 |
620 |
+- lsli r6, 28 |
621 |
+- addi r6, 0x1ce |
622 |
+- mtcr r6, cr<31, 15> /* Set MSA1 */ |
623 |
++ movi r6, 0 |
624 |
++ mtcr r6, cr<31, 15> /* Clr MSA1 */ |
625 |
+ |
626 |
+ /* enable MMU */ |
627 |
+ mfcr r6, cr18 |
628 |
+diff --git a/arch/csky/abiv2/inc/abi/fpu.h b/arch/csky/abiv2/inc/abi/fpu.h |
629 |
+index 22ca3cf2794a..09e2700a3693 100644 |
630 |
+--- a/arch/csky/abiv2/inc/abi/fpu.h |
631 |
++++ b/arch/csky/abiv2/inc/abi/fpu.h |
632 |
+@@ -9,7 +9,8 @@ |
633 |
+ |
634 |
+ int fpu_libc_helper(struct pt_regs *regs); |
635 |
+ void fpu_fpe(struct pt_regs *regs); |
636 |
+-void __init init_fpu(void); |
637 |
++ |
638 |
++static inline void init_fpu(void) { mtcr("cr<1, 2>", 0); } |
639 |
+ |
640 |
+ void save_to_user_fp(struct user_fp *user_fp); |
641 |
+ void restore_from_user_fp(struct user_fp *user_fp); |
642 |
+diff --git a/arch/csky/include/asm/processor.h b/arch/csky/include/asm/processor.h |
643 |
+index 21e0bd5293dd..c6bcd7f7c720 100644 |
644 |
+--- a/arch/csky/include/asm/processor.h |
645 |
++++ b/arch/csky/include/asm/processor.h |
646 |
+@@ -43,6 +43,7 @@ extern struct cpuinfo_csky cpu_data[]; |
647 |
+ struct thread_struct { |
648 |
+ unsigned long ksp; /* kernel stack pointer */ |
649 |
+ unsigned long sr; /* saved status register */ |
650 |
++ unsigned long trap_no; /* saved status register */ |
651 |
+ |
652 |
+ /* FPU regs */ |
653 |
+ struct user_fp __aligned(16) user_fp; |
654 |
+diff --git a/arch/csky/kernel/head.S b/arch/csky/kernel/head.S |
655 |
+index 61989f9241c0..17ed9d250480 100644 |
656 |
+--- a/arch/csky/kernel/head.S |
657 |
++++ b/arch/csky/kernel/head.S |
658 |
+@@ -21,6 +21,11 @@ END(_start) |
659 |
+ ENTRY(_start_smp_secondary) |
660 |
+ SETUP_MMU |
661 |
+ |
662 |
++ /* copy msa1 from CPU0 */ |
663 |
++ lrw r6, secondary_msa1 |
664 |
++ ld.w r6, (r6, 0) |
665 |
++ mtcr r6, cr<31, 15> |
666 |
++ |
667 |
+ /* set stack point */ |
668 |
+ lrw r6, secondary_stack |
669 |
+ ld.w r6, (r6, 0) |
670 |
+diff --git a/arch/csky/kernel/setup.c b/arch/csky/kernel/setup.c |
671 |
+index 3821e55742f4..819a9a7bf786 100644 |
672 |
+--- a/arch/csky/kernel/setup.c |
673 |
++++ b/arch/csky/kernel/setup.c |
674 |
+@@ -24,26 +24,9 @@ struct screen_info screen_info = { |
675 |
+ }; |
676 |
+ #endif |
677 |
+ |
678 |
+-phys_addr_t __init_memblock memblock_end_of_REG0(void) |
679 |
+-{ |
680 |
+- return (memblock.memory.regions[0].base + |
681 |
+- memblock.memory.regions[0].size); |
682 |
+-} |
683 |
+- |
684 |
+-phys_addr_t __init_memblock memblock_start_of_REG1(void) |
685 |
+-{ |
686 |
+- return memblock.memory.regions[1].base; |
687 |
+-} |
688 |
+- |
689 |
+-size_t __init_memblock memblock_size_of_REG1(void) |
690 |
+-{ |
691 |
+- return memblock.memory.regions[1].size; |
692 |
+-} |
693 |
+- |
694 |
+ static void __init csky_memblock_init(void) |
695 |
+ { |
696 |
+ unsigned long zone_size[MAX_NR_ZONES]; |
697 |
+- unsigned long zhole_size[MAX_NR_ZONES]; |
698 |
+ signed long size; |
699 |
+ |
700 |
+ memblock_reserve(__pa(_stext), _end - _stext); |
701 |
+@@ -54,54 +37,36 @@ static void __init csky_memblock_init(void) |
702 |
+ memblock_dump_all(); |
703 |
+ |
704 |
+ memset(zone_size, 0, sizeof(zone_size)); |
705 |
+- memset(zhole_size, 0, sizeof(zhole_size)); |
706 |
+ |
707 |
+ min_low_pfn = PFN_UP(memblock_start_of_DRAM()); |
708 |
+- max_pfn = PFN_DOWN(memblock_end_of_DRAM()); |
709 |
+- |
710 |
+- max_low_pfn = PFN_UP(memblock_end_of_REG0()); |
711 |
+- if (max_low_pfn == 0) |
712 |
+- max_low_pfn = max_pfn; |
713 |
++ max_low_pfn = max_pfn = PFN_DOWN(memblock_end_of_DRAM()); |
714 |
+ |
715 |
+ size = max_pfn - min_low_pfn; |
716 |
+ |
717 |
+- if (memblock.memory.cnt > 1) { |
718 |
+- zone_size[ZONE_NORMAL] = |
719 |
+- PFN_DOWN(memblock_start_of_REG1()) - min_low_pfn; |
720 |
+- zhole_size[ZONE_NORMAL] = |
721 |
+- PFN_DOWN(memblock_start_of_REG1()) - max_low_pfn; |
722 |
++ if (size <= PFN_DOWN(SSEG_SIZE - PHYS_OFFSET_OFFSET)) |
723 |
++ zone_size[ZONE_NORMAL] = size; |
724 |
++ else if (size < PFN_DOWN(LOWMEM_LIMIT - PHYS_OFFSET_OFFSET)) { |
725 |
++ zone_size[ZONE_NORMAL] = |
726 |
++ PFN_DOWN(SSEG_SIZE - PHYS_OFFSET_OFFSET); |
727 |
++ max_low_pfn = min_low_pfn + zone_size[ZONE_NORMAL]; |
728 |
+ } else { |
729 |
+- if (size <= PFN_DOWN(LOWMEM_LIMIT - PHYS_OFFSET_OFFSET)) |
730 |
+- zone_size[ZONE_NORMAL] = max_pfn - min_low_pfn; |
731 |
+- else { |
732 |
+- zone_size[ZONE_NORMAL] = |
733 |
++ zone_size[ZONE_NORMAL] = |
734 |
+ PFN_DOWN(LOWMEM_LIMIT - PHYS_OFFSET_OFFSET); |
735 |
+- max_low_pfn = min_low_pfn + zone_size[ZONE_NORMAL]; |
736 |
+- } |
737 |
++ max_low_pfn = min_low_pfn + zone_size[ZONE_NORMAL]; |
738 |
++ write_mmu_msa1(read_mmu_msa0() + SSEG_SIZE); |
739 |
+ } |
740 |
+ |
741 |
+ #ifdef CONFIG_HIGHMEM |
742 |
+- size = 0; |
743 |
+- if (memblock.memory.cnt > 1) { |
744 |
+- size = PFN_DOWN(memblock_size_of_REG1()); |
745 |
+- highstart_pfn = PFN_DOWN(memblock_start_of_REG1()); |
746 |
+- } else { |
747 |
+- size = max_pfn - min_low_pfn - |
748 |
+- PFN_DOWN(LOWMEM_LIMIT - PHYS_OFFSET_OFFSET); |
749 |
+- highstart_pfn = min_low_pfn + |
750 |
+- PFN_DOWN(LOWMEM_LIMIT - PHYS_OFFSET_OFFSET); |
751 |
+- } |
752 |
+- |
753 |
+- if (size > 0) |
754 |
+- zone_size[ZONE_HIGHMEM] = size; |
755 |
++ zone_size[ZONE_HIGHMEM] = max_pfn - max_low_pfn; |
756 |
+ |
757 |
+- highend_pfn = max_pfn; |
758 |
++ highstart_pfn = max_low_pfn; |
759 |
++ highend_pfn = max_pfn; |
760 |
+ #endif |
761 |
+ memblock_set_current_limit(PFN_PHYS(max_low_pfn)); |
762 |
+ |
763 |
+ dma_contiguous_reserve(0); |
764 |
+ |
765 |
+- free_area_init_node(0, zone_size, min_low_pfn, zhole_size); |
766 |
++ free_area_init_node(0, zone_size, min_low_pfn, NULL); |
767 |
+ } |
768 |
+ |
769 |
+ void __init setup_arch(char **cmdline_p) |
770 |
+diff --git a/arch/csky/kernel/smp.c b/arch/csky/kernel/smp.c |
771 |
+index 0bb0954d5570..b5c5bc3afeb5 100644 |
772 |
+--- a/arch/csky/kernel/smp.c |
773 |
++++ b/arch/csky/kernel/smp.c |
774 |
+@@ -22,6 +22,9 @@ |
775 |
+ #include <asm/sections.h> |
776 |
+ #include <asm/mmu_context.h> |
777 |
+ #include <asm/pgalloc.h> |
778 |
++#ifdef CONFIG_CPU_HAS_FPU |
779 |
++#include <abi/fpu.h> |
780 |
++#endif |
781 |
+ |
782 |
+ struct ipi_data_struct { |
783 |
+ unsigned long bits ____cacheline_aligned; |
784 |
+@@ -156,6 +159,8 @@ volatile unsigned int secondary_hint; |
785 |
+ volatile unsigned int secondary_ccr; |
786 |
+ volatile unsigned int secondary_stack; |
787 |
+ |
788 |
++unsigned long secondary_msa1; |
789 |
++ |
790 |
+ int __cpu_up(unsigned int cpu, struct task_struct *tidle) |
791 |
+ { |
792 |
+ unsigned long mask = 1 << cpu; |
793 |
+@@ -164,6 +169,7 @@ int __cpu_up(unsigned int cpu, struct task_struct *tidle) |
794 |
+ (unsigned int) task_stack_page(tidle) + THREAD_SIZE - 8; |
795 |
+ secondary_hint = mfcr("cr31"); |
796 |
+ secondary_ccr = mfcr("cr18"); |
797 |
++ secondary_msa1 = read_mmu_msa1(); |
798 |
+ |
799 |
+ /* |
800 |
+ * Because other CPUs are in reset status, we must flush data |
801 |
+diff --git a/arch/csky/kernel/traps.c b/arch/csky/kernel/traps.c |
802 |
+index b057480e7463..63715cb90ee9 100644 |
803 |
+--- a/arch/csky/kernel/traps.c |
804 |
++++ b/arch/csky/kernel/traps.c |
805 |
+@@ -115,8 +115,9 @@ asmlinkage void trap_c(struct pt_regs *regs) |
806 |
+ int sig; |
807 |
+ unsigned long vector; |
808 |
+ siginfo_t info; |
809 |
++ struct task_struct *tsk = current; |
810 |
+ |
811 |
+- vector = (mfcr("psr") >> 16) & 0xff; |
812 |
++ vector = (regs->sr >> 16) & 0xff; |
813 |
+ |
814 |
+ switch (vector) { |
815 |
+ case VEC_ZERODIV: |
816 |
+@@ -129,6 +130,7 @@ asmlinkage void trap_c(struct pt_regs *regs) |
817 |
+ sig = SIGTRAP; |
818 |
+ break; |
819 |
+ case VEC_ILLEGAL: |
820 |
++ tsk->thread.trap_no = vector; |
821 |
+ die_if_kernel("Kernel mode ILLEGAL", regs, vector); |
822 |
+ #ifndef CONFIG_CPU_NO_USER_BKPT |
823 |
+ if (*(uint16_t *)instruction_pointer(regs) != USR_BKPT) |
824 |
+@@ -146,16 +148,20 @@ asmlinkage void trap_c(struct pt_regs *regs) |
825 |
+ sig = SIGTRAP; |
826 |
+ break; |
827 |
+ case VEC_ACCESS: |
828 |
++ tsk->thread.trap_no = vector; |
829 |
+ return buserr(regs); |
830 |
+ #ifdef CONFIG_CPU_NEED_SOFTALIGN |
831 |
+ case VEC_ALIGN: |
832 |
++ tsk->thread.trap_no = vector; |
833 |
+ return csky_alignment(regs); |
834 |
+ #endif |
835 |
+ #ifdef CONFIG_CPU_HAS_FPU |
836 |
+ case VEC_FPE: |
837 |
++ tsk->thread.trap_no = vector; |
838 |
+ die_if_kernel("Kernel mode FPE", regs, vector); |
839 |
+ return fpu_fpe(regs); |
840 |
+ case VEC_PRIV: |
841 |
++ tsk->thread.trap_no = vector; |
842 |
+ die_if_kernel("Kernel mode PRIV", regs, vector); |
843 |
+ if (fpu_libc_helper(regs)) |
844 |
+ return; |
845 |
+@@ -164,5 +170,8 @@ asmlinkage void trap_c(struct pt_regs *regs) |
846 |
+ sig = SIGSEGV; |
847 |
+ break; |
848 |
+ } |
849 |
++ |
850 |
++ tsk->thread.trap_no = vector; |
851 |
++ |
852 |
+ send_sig(sig, current, 0); |
853 |
+ } |
854 |
+diff --git a/arch/csky/mm/fault.c b/arch/csky/mm/fault.c |
855 |
+index f76618b630f9..562c7f708749 100644 |
856 |
+--- a/arch/csky/mm/fault.c |
857 |
++++ b/arch/csky/mm/fault.c |
858 |
+@@ -179,11 +179,14 @@ bad_area: |
859 |
+ bad_area_nosemaphore: |
860 |
+ /* User mode accesses just cause a SIGSEGV */ |
861 |
+ if (user_mode(regs)) { |
862 |
++ tsk->thread.trap_no = (regs->sr >> 16) & 0xff; |
863 |
+ force_sig_fault(SIGSEGV, si_code, (void __user *)address); |
864 |
+ return; |
865 |
+ } |
866 |
+ |
867 |
+ no_context: |
868 |
++ tsk->thread.trap_no = (regs->sr >> 16) & 0xff; |
869 |
++ |
870 |
+ /* Are we prepared to handle this kernel fault? */ |
871 |
+ if (fixup_exception(regs)) |
872 |
+ return; |
873 |
+@@ -198,6 +201,8 @@ no_context: |
874 |
+ die_if_kernel("Oops", regs, write); |
875 |
+ |
876 |
+ out_of_memory: |
877 |
++ tsk->thread.trap_no = (regs->sr >> 16) & 0xff; |
878 |
++ |
879 |
+ /* |
880 |
+ * We ran out of memory, call the OOM killer, and return the userspace |
881 |
+ * (which will retry the fault, or kill us if we got oom-killed). |
882 |
+@@ -206,6 +211,8 @@ out_of_memory: |
883 |
+ return; |
884 |
+ |
885 |
+ do_sigbus: |
886 |
++ tsk->thread.trap_no = (regs->sr >> 16) & 0xff; |
887 |
++ |
888 |
+ up_read(&mm->mmap_sem); |
889 |
+ |
890 |
+ /* Kernel mode? Handle exceptions or die */ |
891 |
+diff --git a/arch/mips/boot/dts/ingenic/ci20.dts b/arch/mips/boot/dts/ingenic/ci20.dts |
892 |
+index c340f947baa0..fc4e64200c3d 100644 |
893 |
+--- a/arch/mips/boot/dts/ingenic/ci20.dts |
894 |
++++ b/arch/mips/boot/dts/ingenic/ci20.dts |
895 |
+@@ -62,6 +62,11 @@ |
896 |
+ enable-active-high; |
897 |
+ }; |
898 |
+ |
899 |
++ ir: ir { |
900 |
++ compatible = "gpio-ir-receiver"; |
901 |
++ gpios = <&gpe 3 GPIO_ACTIVE_LOW>; |
902 |
++ }; |
903 |
++ |
904 |
+ wlan0_power: fixedregulator@1 { |
905 |
+ compatible = "regulator-fixed"; |
906 |
+ regulator-name = "wlan0_power"; |
907 |
+diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c |
908 |
+index 577345382b23..673f13b87db1 100644 |
909 |
+--- a/arch/powerpc/kernel/prom_init.c |
910 |
++++ b/arch/powerpc/kernel/prom_init.c |
911 |
+@@ -1773,6 +1773,9 @@ static void __init prom_rtas_os_term(char *str) |
912 |
+ if (token == 0) |
913 |
+ prom_panic("Could not get token for ibm,os-term\n"); |
914 |
+ os_term_args.token = cpu_to_be32(token); |
915 |
++ os_term_args.nargs = cpu_to_be32(1); |
916 |
++ os_term_args.nret = cpu_to_be32(1); |
917 |
++ os_term_args.args[0] = cpu_to_be32(__pa(str)); |
918 |
+ prom_rtas_hcall((uint64_t)&os_term_args); |
919 |
+ } |
920 |
+ #endif /* CONFIG_PPC_SVM */ |
921 |
+diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c |
922 |
+index 2cefd071b848..c0c43a733830 100644 |
923 |
+--- a/arch/powerpc/kvm/book3s_hv.c |
924 |
++++ b/arch/powerpc/kvm/book3s_hv.c |
925 |
+@@ -3616,6 +3616,7 @@ int kvmhv_p9_guest_entry(struct kvm_vcpu *vcpu, u64 time_limit, |
926 |
+ if (trap == BOOK3S_INTERRUPT_SYSCALL && !vcpu->arch.nested && |
927 |
+ kvmppc_get_gpr(vcpu, 3) == H_CEDE) { |
928 |
+ kvmppc_nested_cede(vcpu); |
929 |
++ kvmppc_set_gpr(vcpu, 3, 0); |
930 |
+ trap = 0; |
931 |
+ } |
932 |
+ } else { |
933 |
+diff --git a/arch/powerpc/platforms/maple/setup.c b/arch/powerpc/platforms/maple/setup.c |
934 |
+index 6f019df37916..15b2c6eb506d 100644 |
935 |
+--- a/arch/powerpc/platforms/maple/setup.c |
936 |
++++ b/arch/powerpc/platforms/maple/setup.c |
937 |
+@@ -291,23 +291,6 @@ static int __init maple_probe(void) |
938 |
+ return 1; |
939 |
+ } |
940 |
+ |
941 |
+-define_machine(maple) { |
942 |
+- .name = "Maple", |
943 |
+- .probe = maple_probe, |
944 |
+- .setup_arch = maple_setup_arch, |
945 |
+- .init_IRQ = maple_init_IRQ, |
946 |
+- .pci_irq_fixup = maple_pci_irq_fixup, |
947 |
+- .pci_get_legacy_ide_irq = maple_pci_get_legacy_ide_irq, |
948 |
+- .restart = maple_restart, |
949 |
+- .halt = maple_halt, |
950 |
+- .get_boot_time = maple_get_boot_time, |
951 |
+- .set_rtc_time = maple_set_rtc_time, |
952 |
+- .get_rtc_time = maple_get_rtc_time, |
953 |
+- .calibrate_decr = generic_calibrate_decr, |
954 |
+- .progress = maple_progress, |
955 |
+- .power_save = power4_idle, |
956 |
+-}; |
957 |
+- |
958 |
+ #ifdef CONFIG_EDAC |
959 |
+ /* |
960 |
+ * Register a platform device for CPC925 memory controller on |
961 |
+@@ -364,3 +347,20 @@ static int __init maple_cpc925_edac_setup(void) |
962 |
+ } |
963 |
+ machine_device_initcall(maple, maple_cpc925_edac_setup); |
964 |
+ #endif |
965 |
++ |
966 |
++define_machine(maple) { |
967 |
++ .name = "Maple", |
968 |
++ .probe = maple_probe, |
969 |
++ .setup_arch = maple_setup_arch, |
970 |
++ .init_IRQ = maple_init_IRQ, |
971 |
++ .pci_irq_fixup = maple_pci_irq_fixup, |
972 |
++ .pci_get_legacy_ide_irq = maple_pci_get_legacy_ide_irq, |
973 |
++ .restart = maple_restart, |
974 |
++ .halt = maple_halt, |
975 |
++ .get_boot_time = maple_get_boot_time, |
976 |
++ .set_rtc_time = maple_set_rtc_time, |
977 |
++ .get_rtc_time = maple_get_rtc_time, |
978 |
++ .calibrate_decr = generic_calibrate_decr, |
979 |
++ .progress = maple_progress, |
980 |
++ .power_save = power4_idle, |
981 |
++}; |
982 |
+diff --git a/arch/s390/crypto/aes_s390.c b/arch/s390/crypto/aes_s390.c |
983 |
+index 1c23d84a9097..73044634d342 100644 |
984 |
+--- a/arch/s390/crypto/aes_s390.c |
985 |
++++ b/arch/s390/crypto/aes_s390.c |
986 |
+@@ -342,6 +342,7 @@ static int cbc_aes_crypt(struct skcipher_request *req, unsigned long modifier) |
987 |
+ memcpy(walk.iv, param.iv, AES_BLOCK_SIZE); |
988 |
+ ret = skcipher_walk_done(&walk, nbytes - n); |
989 |
+ } |
990 |
++ memzero_explicit(¶m, sizeof(param)); |
991 |
+ return ret; |
992 |
+ } |
993 |
+ |
994 |
+@@ -470,6 +471,8 @@ static int xts_aes_crypt(struct skcipher_request *req, unsigned long modifier) |
995 |
+ walk.dst.virt.addr, walk.src.virt.addr, n); |
996 |
+ ret = skcipher_walk_done(&walk, nbytes - n); |
997 |
+ } |
998 |
++ memzero_explicit(&pcc_param, sizeof(pcc_param)); |
999 |
++ memzero_explicit(&xts_param, sizeof(xts_param)); |
1000 |
+ return ret; |
1001 |
+ } |
1002 |
+ |
1003 |
+diff --git a/arch/s390/kernel/perf_cpum_sf.c b/arch/s390/kernel/perf_cpum_sf.c |
1004 |
+index b095b1c78987..05b908b3a6b3 100644 |
1005 |
+--- a/arch/s390/kernel/perf_cpum_sf.c |
1006 |
++++ b/arch/s390/kernel/perf_cpum_sf.c |
1007 |
+@@ -1576,6 +1576,7 @@ static void hw_collect_aux(struct cpu_hw_sf *cpuhw) |
1008 |
+ unsigned long range = 0, size; |
1009 |
+ unsigned long long overflow = 0; |
1010 |
+ struct perf_output_handle *handle = &cpuhw->handle; |
1011 |
++ unsigned long num_sdb; |
1012 |
+ |
1013 |
+ aux = perf_get_aux(handle); |
1014 |
+ if (WARN_ON_ONCE(!aux)) |
1015 |
+@@ -1587,13 +1588,14 @@ static void hw_collect_aux(struct cpu_hw_sf *cpuhw) |
1016 |
+ size >> PAGE_SHIFT); |
1017 |
+ perf_aux_output_end(handle, size); |
1018 |
+ |
1019 |
++ num_sdb = aux->sfb.num_sdb; |
1020 |
+ while (!done) { |
1021 |
+ /* Get an output handle */ |
1022 |
+ aux = perf_aux_output_begin(handle, cpuhw->event); |
1023 |
+ if (handle->size == 0) { |
1024 |
+ pr_err("The AUX buffer with %lu pages for the " |
1025 |
+ "diagnostic-sampling mode is full\n", |
1026 |
+- aux->sfb.num_sdb); |
1027 |
++ num_sdb); |
1028 |
+ debug_sprintf_event(sfdbg, 1, |
1029 |
+ "%s: AUX buffer used up\n", |
1030 |
+ __func__); |
1031 |
+diff --git a/arch/s390/kernel/processor.c b/arch/s390/kernel/processor.c |
1032 |
+index 6ebc2117c66c..91b9b3f73de6 100644 |
1033 |
+--- a/arch/s390/kernel/processor.c |
1034 |
++++ b/arch/s390/kernel/processor.c |
1035 |
+@@ -165,8 +165,9 @@ static void show_cpu_mhz(struct seq_file *m, unsigned long n) |
1036 |
+ static int show_cpuinfo(struct seq_file *m, void *v) |
1037 |
+ { |
1038 |
+ unsigned long n = (unsigned long) v - 1; |
1039 |
++ unsigned long first = cpumask_first(cpu_online_mask); |
1040 |
+ |
1041 |
+- if (!n) |
1042 |
++ if (n == first) |
1043 |
+ show_cpu_summary(m, v); |
1044 |
+ if (!machine_has_cpu_mhz) |
1045 |
+ return 0; |
1046 |
+@@ -179,6 +180,8 @@ static inline void *c_update(loff_t *pos) |
1047 |
+ { |
1048 |
+ if (*pos) |
1049 |
+ *pos = cpumask_next(*pos - 1, cpu_online_mask); |
1050 |
++ else |
1051 |
++ *pos = cpumask_first(cpu_online_mask); |
1052 |
+ return *pos < nr_cpu_ids ? (void *)*pos + 1 : NULL; |
1053 |
+ } |
1054 |
+ |
1055 |
+diff --git a/arch/s390/mm/gmap.c b/arch/s390/mm/gmap.c |
1056 |
+index 9d9ab77d02dd..364e3a89c096 100644 |
1057 |
+--- a/arch/s390/mm/gmap.c |
1058 |
++++ b/arch/s390/mm/gmap.c |
1059 |
+@@ -1844,6 +1844,7 @@ int gmap_shadow_r3t(struct gmap *sg, unsigned long saddr, unsigned long r3t, |
1060 |
+ goto out_free; |
1061 |
+ } else if (*table & _REGION_ENTRY_ORIGIN) { |
1062 |
+ rc = -EAGAIN; /* Race with shadow */ |
1063 |
++ goto out_free; |
1064 |
+ } |
1065 |
+ crst_table_init(s_r3t, _REGION3_ENTRY_EMPTY); |
1066 |
+ /* mark as invalid as long as the parent table is not protected */ |
1067 |
+diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c |
1068 |
+index 247f95da057b..eca45ad2166c 100644 |
1069 |
+--- a/arch/um/drivers/ubd_kern.c |
1070 |
++++ b/arch/um/drivers/ubd_kern.c |
1071 |
+@@ -1607,7 +1607,9 @@ int io_thread(void *arg) |
1072 |
+ written = 0; |
1073 |
+ |
1074 |
+ do { |
1075 |
+- res = os_write_file(kernel_fd, ((char *) io_req_buffer) + written, n); |
1076 |
++ res = os_write_file(kernel_fd, |
1077 |
++ ((char *) io_req_buffer) + written, |
1078 |
++ n - written); |
1079 |
+ if (res >= 0) { |
1080 |
+ written += res; |
1081 |
+ } |
1082 |
+diff --git a/arch/um/os-Linux/file.c b/arch/um/os-Linux/file.c |
1083 |
+index fbda10535dab..5c819f89b8c2 100644 |
1084 |
+--- a/arch/um/os-Linux/file.c |
1085 |
++++ b/arch/um/os-Linux/file.c |
1086 |
+@@ -8,6 +8,7 @@ |
1087 |
+ #include <errno.h> |
1088 |
+ #include <fcntl.h> |
1089 |
+ #include <signal.h> |
1090 |
++#include <linux/falloc.h> |
1091 |
+ #include <sys/ioctl.h> |
1092 |
+ #include <sys/mount.h> |
1093 |
+ #include <sys/socket.h> |
1094 |
+diff --git a/arch/x86/hyperv/hv_init.c b/arch/x86/hyperv/hv_init.c |
1095 |
+index b0da5320bcff..624f5d9b0f79 100644 |
1096 |
+--- a/arch/x86/hyperv/hv_init.c |
1097 |
++++ b/arch/x86/hyperv/hv_init.c |
1098 |
+@@ -20,6 +20,7 @@ |
1099 |
+ #include <linux/mm.h> |
1100 |
+ #include <linux/hyperv.h> |
1101 |
+ #include <linux/slab.h> |
1102 |
++#include <linux/kernel.h> |
1103 |
+ #include <linux/cpuhotplug.h> |
1104 |
+ #include <linux/syscore_ops.h> |
1105 |
+ #include <clocksource/hyperv_timer.h> |
1106 |
+@@ -419,11 +420,14 @@ void hyperv_cleanup(void) |
1107 |
+ } |
1108 |
+ EXPORT_SYMBOL_GPL(hyperv_cleanup); |
1109 |
+ |
1110 |
+-void hyperv_report_panic(struct pt_regs *regs, long err) |
1111 |
++void hyperv_report_panic(struct pt_regs *regs, long err, bool in_die) |
1112 |
+ { |
1113 |
+ static bool panic_reported; |
1114 |
+ u64 guest_id; |
1115 |
+ |
1116 |
++ if (in_die && !panic_on_oops) |
1117 |
++ return; |
1118 |
++ |
1119 |
+ /* |
1120 |
+ * We prefer to report panic on 'die' chain as we have proper |
1121 |
+ * registers to report, but if we miss it (e.g. on BUG()) we need |
1122 |
+diff --git a/arch/x86/kernel/acpi/cstate.c b/arch/x86/kernel/acpi/cstate.c |
1123 |
+index caf2edccbad2..49ae4e1ac9cd 100644 |
1124 |
+--- a/arch/x86/kernel/acpi/cstate.c |
1125 |
++++ b/arch/x86/kernel/acpi/cstate.c |
1126 |
+@@ -161,7 +161,8 @@ int acpi_processor_ffh_cstate_probe(unsigned int cpu, |
1127 |
+ |
1128 |
+ /* Make sure we are running on right CPU */ |
1129 |
+ |
1130 |
+- retval = work_on_cpu(cpu, acpi_processor_ffh_cstate_probe_cpu, cx); |
1131 |
++ retval = call_on_cpu(cpu, acpi_processor_ffh_cstate_probe_cpu, cx, |
1132 |
++ false); |
1133 |
+ if (retval == 0) { |
1134 |
+ /* Use the hint in CST */ |
1135 |
+ percpu_entry->states[cx->index].eax = cx->address; |
1136 |
+diff --git a/arch/x86/kernel/cpu/mshyperv.c b/arch/x86/kernel/cpu/mshyperv.c |
1137 |
+index caa032ce3fe3..5e296a7e6036 100644 |
1138 |
+--- a/arch/x86/kernel/cpu/mshyperv.c |
1139 |
++++ b/arch/x86/kernel/cpu/mshyperv.c |
1140 |
+@@ -263,6 +263,16 @@ static void __init ms_hyperv_init_platform(void) |
1141 |
+ cpuid_eax(HYPERV_CPUID_NESTED_FEATURES); |
1142 |
+ } |
1143 |
+ |
1144 |
++ /* |
1145 |
++ * Hyper-V expects to get crash register data or kmsg when |
1146 |
++ * crash enlightment is available and system crashes. Set |
1147 |
++ * crash_kexec_post_notifiers to be true to make sure that |
1148 |
++ * calling crash enlightment interface before running kdump |
1149 |
++ * kernel. |
1150 |
++ */ |
1151 |
++ if (ms_hyperv.misc_features & HV_FEATURE_GUEST_CRASH_MSR_AVAILABLE) |
1152 |
++ crash_kexec_post_notifiers = true; |
1153 |
++ |
1154 |
+ #ifdef CONFIG_X86_LOCAL_APIC |
1155 |
+ if (ms_hyperv.features & HV_X64_ACCESS_FREQUENCY_MSRS && |
1156 |
+ ms_hyperv.misc_features & HV_FEATURE_FREQUENCY_MSRS_AVAILABLE) { |
1157 |
+diff --git a/arch/x86/xen/xen-head.S b/arch/x86/xen/xen-head.S |
1158 |
+index 1d0cee3163e4..1e900676722b 100644 |
1159 |
+--- a/arch/x86/xen/xen-head.S |
1160 |
++++ b/arch/x86/xen/xen-head.S |
1161 |
+@@ -35,7 +35,11 @@ SYM_CODE_START(startup_xen) |
1162 |
+ rep __ASM_SIZE(stos) |
1163 |
+ |
1164 |
+ mov %_ASM_SI, xen_start_info |
1165 |
+- mov $init_thread_union+THREAD_SIZE, %_ASM_SP |
1166 |
++#ifdef CONFIG_X86_64 |
1167 |
++ mov initial_stack(%rip), %rsp |
1168 |
++#else |
1169 |
++ mov initial_stack, %esp |
1170 |
++#endif |
1171 |
+ |
1172 |
+ #ifdef CONFIG_X86_64 |
1173 |
+ /* Set up %gs. |
1174 |
+@@ -51,7 +55,7 @@ SYM_CODE_START(startup_xen) |
1175 |
+ wrmsr |
1176 |
+ #endif |
1177 |
+ |
1178 |
+- jmp xen_start_kernel |
1179 |
++ call xen_start_kernel |
1180 |
+ SYM_CODE_END(startup_xen) |
1181 |
+ __FINIT |
1182 |
+ #endif |
1183 |
+diff --git a/block/bfq-cgroup.c b/block/bfq-cgroup.c |
1184 |
+index 9d963ed518d1..68882b9b8f11 100644 |
1185 |
+--- a/block/bfq-cgroup.c |
1186 |
++++ b/block/bfq-cgroup.c |
1187 |
+@@ -714,10 +714,7 @@ static struct bfq_group *__bfq_bic_change_cgroup(struct bfq_data *bfqd, |
1188 |
+ |
1189 |
+ if (entity->sched_data != &bfqg->sched_data) { |
1190 |
+ bic_set_bfqq(bic, NULL, 0); |
1191 |
+- bfq_log_bfqq(bfqd, async_bfqq, |
1192 |
+- "bic_change_group: %p %d", |
1193 |
+- async_bfqq, async_bfqq->ref); |
1194 |
+- bfq_put_queue(async_bfqq); |
1195 |
++ bfq_release_process_ref(bfqd, async_bfqq); |
1196 |
+ } |
1197 |
+ } |
1198 |
+ |
1199 |
+@@ -818,39 +815,53 @@ static void bfq_flush_idle_tree(struct bfq_service_tree *st) |
1200 |
+ /** |
1201 |
+ * bfq_reparent_leaf_entity - move leaf entity to the root_group. |
1202 |
+ * @bfqd: the device data structure with the root group. |
1203 |
+- * @entity: the entity to move. |
1204 |
++ * @entity: the entity to move, if entity is a leaf; or the parent entity |
1205 |
++ * of an active leaf entity to move, if entity is not a leaf. |
1206 |
+ */ |
1207 |
+ static void bfq_reparent_leaf_entity(struct bfq_data *bfqd, |
1208 |
+- struct bfq_entity *entity) |
1209 |
++ struct bfq_entity *entity, |
1210 |
++ int ioprio_class) |
1211 |
+ { |
1212 |
+- struct bfq_queue *bfqq = bfq_entity_to_bfqq(entity); |
1213 |
++ struct bfq_queue *bfqq; |
1214 |
++ struct bfq_entity *child_entity = entity; |
1215 |
++ |
1216 |
++ while (child_entity->my_sched_data) { /* leaf not reached yet */ |
1217 |
++ struct bfq_sched_data *child_sd = child_entity->my_sched_data; |
1218 |
++ struct bfq_service_tree *child_st = child_sd->service_tree + |
1219 |
++ ioprio_class; |
1220 |
++ struct rb_root *child_active = &child_st->active; |
1221 |
++ |
1222 |
++ child_entity = bfq_entity_of(rb_first(child_active)); |
1223 |
++ |
1224 |
++ if (!child_entity) |
1225 |
++ child_entity = child_sd->in_service_entity; |
1226 |
++ } |
1227 |
+ |
1228 |
++ bfqq = bfq_entity_to_bfqq(child_entity); |
1229 |
+ bfq_bfqq_move(bfqd, bfqq, bfqd->root_group); |
1230 |
+ } |
1231 |
+ |
1232 |
+ /** |
1233 |
+- * bfq_reparent_active_entities - move to the root group all active |
1234 |
+- * entities. |
1235 |
++ * bfq_reparent_active_queues - move to the root group all active queues. |
1236 |
+ * @bfqd: the device data structure with the root group. |
1237 |
+ * @bfqg: the group to move from. |
1238 |
+- * @st: the service tree with the entities. |
1239 |
++ * @st: the service tree to start the search from. |
1240 |
+ */ |
1241 |
+-static void bfq_reparent_active_entities(struct bfq_data *bfqd, |
1242 |
+- struct bfq_group *bfqg, |
1243 |
+- struct bfq_service_tree *st) |
1244 |
++static void bfq_reparent_active_queues(struct bfq_data *bfqd, |
1245 |
++ struct bfq_group *bfqg, |
1246 |
++ struct bfq_service_tree *st, |
1247 |
++ int ioprio_class) |
1248 |
+ { |
1249 |
+ struct rb_root *active = &st->active; |
1250 |
+- struct bfq_entity *entity = NULL; |
1251 |
+- |
1252 |
+- if (!RB_EMPTY_ROOT(&st->active)) |
1253 |
+- entity = bfq_entity_of(rb_first(active)); |
1254 |
++ struct bfq_entity *entity; |
1255 |
+ |
1256 |
+- for (; entity ; entity = bfq_entity_of(rb_first(active))) |
1257 |
+- bfq_reparent_leaf_entity(bfqd, entity); |
1258 |
++ while ((entity = bfq_entity_of(rb_first(active)))) |
1259 |
++ bfq_reparent_leaf_entity(bfqd, entity, ioprio_class); |
1260 |
+ |
1261 |
+ if (bfqg->sched_data.in_service_entity) |
1262 |
+ bfq_reparent_leaf_entity(bfqd, |
1263 |
+- bfqg->sched_data.in_service_entity); |
1264 |
++ bfqg->sched_data.in_service_entity, |
1265 |
++ ioprio_class); |
1266 |
+ } |
1267 |
+ |
1268 |
+ /** |
1269 |
+@@ -882,13 +893,6 @@ static void bfq_pd_offline(struct blkg_policy_data *pd) |
1270 |
+ for (i = 0; i < BFQ_IOPRIO_CLASSES; i++) { |
1271 |
+ st = bfqg->sched_data.service_tree + i; |
1272 |
+ |
1273 |
+- /* |
1274 |
+- * The idle tree may still contain bfq_queues belonging |
1275 |
+- * to exited task because they never migrated to a different |
1276 |
+- * cgroup from the one being destroyed now. |
1277 |
+- */ |
1278 |
+- bfq_flush_idle_tree(st); |
1279 |
+- |
1280 |
+ /* |
1281 |
+ * It may happen that some queues are still active |
1282 |
+ * (busy) upon group destruction (if the corresponding |
1283 |
+@@ -901,7 +905,20 @@ static void bfq_pd_offline(struct blkg_policy_data *pd) |
1284 |
+ * There is no need to put the sync queues, as the |
1285 |
+ * scheduler has taken no reference. |
1286 |
+ */ |
1287 |
+- bfq_reparent_active_entities(bfqd, bfqg, st); |
1288 |
++ bfq_reparent_active_queues(bfqd, bfqg, st, i); |
1289 |
++ |
1290 |
++ /* |
1291 |
++ * The idle tree may still contain bfq_queues |
1292 |
++ * belonging to exited task because they never |
1293 |
++ * migrated to a different cgroup from the one being |
1294 |
++ * destroyed now. In addition, even |
1295 |
++ * bfq_reparent_active_queues() may happen to add some |
1296 |
++ * entities to the idle tree. It happens if, in some |
1297 |
++ * of the calls to bfq_bfqq_move() performed by |
1298 |
++ * bfq_reparent_active_queues(), the queue to move is |
1299 |
++ * empty and gets expired. |
1300 |
++ */ |
1301 |
++ bfq_flush_idle_tree(st); |
1302 |
+ } |
1303 |
+ |
1304 |
+ __bfq_deactivate_entity(entity, false); |
1305 |
+diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c |
1306 |
+index 4a44c7f19435..78ba57efd16b 100644 |
1307 |
+--- a/block/bfq-iosched.c |
1308 |
++++ b/block/bfq-iosched.c |
1309 |
+@@ -2716,8 +2716,6 @@ static void bfq_bfqq_save_state(struct bfq_queue *bfqq) |
1310 |
+ } |
1311 |
+ } |
1312 |
+ |
1313 |
+- |
1314 |
+-static |
1315 |
+ void bfq_release_process_ref(struct bfq_data *bfqd, struct bfq_queue *bfqq) |
1316 |
+ { |
1317 |
+ /* |
1318 |
+diff --git a/block/bfq-iosched.h b/block/bfq-iosched.h |
1319 |
+index d1233af9c684..cd224aaf9f52 100644 |
1320 |
+--- a/block/bfq-iosched.h |
1321 |
++++ b/block/bfq-iosched.h |
1322 |
+@@ -955,6 +955,7 @@ void bfq_bfqq_expire(struct bfq_data *bfqd, struct bfq_queue *bfqq, |
1323 |
+ bool compensate, enum bfqq_expiration reason); |
1324 |
+ void bfq_put_queue(struct bfq_queue *bfqq); |
1325 |
+ void bfq_end_wr_async_queues(struct bfq_data *bfqd, struct bfq_group *bfqg); |
1326 |
++void bfq_release_process_ref(struct bfq_data *bfqd, struct bfq_queue *bfqq); |
1327 |
+ void bfq_schedule_dispatch(struct bfq_data *bfqd); |
1328 |
+ void bfq_put_async_queues(struct bfq_data *bfqd, struct bfq_group *bfqg); |
1329 |
+ |
1330 |
+diff --git a/drivers/acpi/acpica/acnamesp.h b/drivers/acpi/acpica/acnamesp.h |
1331 |
+index e618ddfab2fd..40f6a3c33a15 100644 |
1332 |
+--- a/drivers/acpi/acpica/acnamesp.h |
1333 |
++++ b/drivers/acpi/acpica/acnamesp.h |
1334 |
+@@ -256,6 +256,8 @@ u32 |
1335 |
+ acpi_ns_build_normalized_path(struct acpi_namespace_node *node, |
1336 |
+ char *full_path, u32 path_size, u8 no_trailing); |
1337 |
+ |
1338 |
++void acpi_ns_normalize_pathname(char *original_path); |
1339 |
++ |
1340 |
+ char *acpi_ns_get_normalized_pathname(struct acpi_namespace_node *node, |
1341 |
+ u8 no_trailing); |
1342 |
+ |
1343 |
+diff --git a/drivers/acpi/acpica/dbinput.c b/drivers/acpi/acpica/dbinput.c |
1344 |
+index aa71f65395d2..ee6a1b77af3f 100644 |
1345 |
+--- a/drivers/acpi/acpica/dbinput.c |
1346 |
++++ b/drivers/acpi/acpica/dbinput.c |
1347 |
+@@ -468,16 +468,14 @@ char *acpi_db_get_next_token(char *string, |
1348 |
+ return (NULL); |
1349 |
+ } |
1350 |
+ |
1351 |
+- /* Remove any spaces at the beginning */ |
1352 |
++ /* Remove any spaces at the beginning, ignore blank lines */ |
1353 |
+ |
1354 |
+- if (*string == ' ') { |
1355 |
+- while (*string && (*string == ' ')) { |
1356 |
+- string++; |
1357 |
+- } |
1358 |
++ while (*string && isspace(*string)) { |
1359 |
++ string++; |
1360 |
++ } |
1361 |
+ |
1362 |
+- if (!(*string)) { |
1363 |
+- return (NULL); |
1364 |
+- } |
1365 |
++ if (!(*string)) { |
1366 |
++ return (NULL); |
1367 |
+ } |
1368 |
+ |
1369 |
+ switch (*string) { |
1370 |
+@@ -570,7 +568,7 @@ char *acpi_db_get_next_token(char *string, |
1371 |
+ |
1372 |
+ /* Find end of token */ |
1373 |
+ |
1374 |
+- while (*string && (*string != ' ')) { |
1375 |
++ while (*string && !isspace(*string)) { |
1376 |
+ string++; |
1377 |
+ } |
1378 |
+ break; |
1379 |
+diff --git a/drivers/acpi/acpica/dswexec.c b/drivers/acpi/acpica/dswexec.c |
1380 |
+index 5e81a1ae44cf..1d4f8c81028c 100644 |
1381 |
+--- a/drivers/acpi/acpica/dswexec.c |
1382 |
++++ b/drivers/acpi/acpica/dswexec.c |
1383 |
+@@ -16,6 +16,9 @@ |
1384 |
+ #include "acinterp.h" |
1385 |
+ #include "acnamesp.h" |
1386 |
+ #include "acdebug.h" |
1387 |
++#ifdef ACPI_EXEC_APP |
1388 |
++#include "aecommon.h" |
1389 |
++#endif |
1390 |
+ |
1391 |
+ #define _COMPONENT ACPI_DISPATCHER |
1392 |
+ ACPI_MODULE_NAME("dswexec") |
1393 |
+@@ -329,6 +332,10 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) |
1394 |
+ u32 op_class; |
1395 |
+ union acpi_parse_object *next_op; |
1396 |
+ union acpi_parse_object *first_arg; |
1397 |
++#ifdef ACPI_EXEC_APP |
1398 |
++ char *namepath; |
1399 |
++ union acpi_operand_object *obj_desc; |
1400 |
++#endif |
1401 |
+ |
1402 |
+ ACPI_FUNCTION_TRACE_PTR(ds_exec_end_op, walk_state); |
1403 |
+ |
1404 |
+@@ -537,6 +544,32 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) |
1405 |
+ |
1406 |
+ status = |
1407 |
+ acpi_ds_eval_buffer_field_operands(walk_state, op); |
1408 |
++ if (ACPI_FAILURE(status)) { |
1409 |
++ break; |
1410 |
++ } |
1411 |
++#ifdef ACPI_EXEC_APP |
1412 |
++ /* |
1413 |
++ * acpi_exec support for namespace initialization file (initialize |
1414 |
++ * buffer_fields in this code.) |
1415 |
++ */ |
1416 |
++ namepath = |
1417 |
++ acpi_ns_get_external_pathname(op->common.node); |
1418 |
++ status = ae_lookup_init_file_entry(namepath, &obj_desc); |
1419 |
++ if (ACPI_SUCCESS(status)) { |
1420 |
++ status = |
1421 |
++ acpi_ex_write_data_to_field(obj_desc, |
1422 |
++ op->common. |
1423 |
++ node->object, |
1424 |
++ NULL); |
1425 |
++ if ACPI_FAILURE |
1426 |
++ (status) { |
1427 |
++ ACPI_EXCEPTION((AE_INFO, status, |
1428 |
++ "While writing to buffer field")); |
1429 |
++ } |
1430 |
++ } |
1431 |
++ ACPI_FREE(namepath); |
1432 |
++ status = AE_OK; |
1433 |
++#endif |
1434 |
+ break; |
1435 |
+ |
1436 |
+ case AML_TYPE_CREATE_OBJECT: |
1437 |
+diff --git a/drivers/acpi/acpica/dswload.c b/drivers/acpi/acpica/dswload.c |
1438 |
+index 697974e37edf..27069325b6de 100644 |
1439 |
+--- a/drivers/acpi/acpica/dswload.c |
1440 |
++++ b/drivers/acpi/acpica/dswload.c |
1441 |
+@@ -14,7 +14,6 @@ |
1442 |
+ #include "acdispat.h" |
1443 |
+ #include "acinterp.h" |
1444 |
+ #include "acnamesp.h" |
1445 |
+- |
1446 |
+ #ifdef ACPI_ASL_COMPILER |
1447 |
+ #include "acdisasm.h" |
1448 |
+ #endif |
1449 |
+@@ -399,7 +398,6 @@ acpi_status acpi_ds_load1_end_op(struct acpi_walk_state *walk_state) |
1450 |
+ union acpi_parse_object *op; |
1451 |
+ acpi_object_type object_type; |
1452 |
+ acpi_status status = AE_OK; |
1453 |
+- |
1454 |
+ #ifdef ACPI_ASL_COMPILER |
1455 |
+ u8 param_count; |
1456 |
+ #endif |
1457 |
+diff --git a/drivers/acpi/acpica/dswload2.c b/drivers/acpi/acpica/dswload2.c |
1458 |
+index b31457ca926c..edadbe146506 100644 |
1459 |
+--- a/drivers/acpi/acpica/dswload2.c |
1460 |
++++ b/drivers/acpi/acpica/dswload2.c |
1461 |
+@@ -15,6 +15,9 @@ |
1462 |
+ #include "acinterp.h" |
1463 |
+ #include "acnamesp.h" |
1464 |
+ #include "acevents.h" |
1465 |
++#ifdef ACPI_EXEC_APP |
1466 |
++#include "aecommon.h" |
1467 |
++#endif |
1468 |
+ |
1469 |
+ #define _COMPONENT ACPI_DISPATCHER |
1470 |
+ ACPI_MODULE_NAME("dswload2") |
1471 |
+@@ -373,6 +376,10 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state) |
1472 |
+ struct acpi_namespace_node *new_node; |
1473 |
+ u32 i; |
1474 |
+ u8 region_space; |
1475 |
++#ifdef ACPI_EXEC_APP |
1476 |
++ union acpi_operand_object *obj_desc; |
1477 |
++ char *namepath; |
1478 |
++#endif |
1479 |
+ |
1480 |
+ ACPI_FUNCTION_TRACE(ds_load2_end_op); |
1481 |
+ |
1482 |
+@@ -466,6 +473,11 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state) |
1483 |
+ * be evaluated later during the execution phase |
1484 |
+ */ |
1485 |
+ status = acpi_ds_create_buffer_field(op, walk_state); |
1486 |
++ if (ACPI_FAILURE(status)) { |
1487 |
++ ACPI_EXCEPTION((AE_INFO, status, |
1488 |
++ "CreateBufferField failure")); |
1489 |
++ goto cleanup; |
1490 |
++ } |
1491 |
+ break; |
1492 |
+ |
1493 |
+ case AML_TYPE_NAMED_FIELD: |
1494 |
+@@ -604,6 +616,29 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state) |
1495 |
+ case AML_NAME_OP: |
1496 |
+ |
1497 |
+ status = acpi_ds_create_node(walk_state, node, op); |
1498 |
++ if (ACPI_FAILURE(status)) { |
1499 |
++ goto cleanup; |
1500 |
++ } |
1501 |
++#ifdef ACPI_EXEC_APP |
1502 |
++ /* |
1503 |
++ * acpi_exec support for namespace initialization file (initialize |
1504 |
++ * Name opcodes in this code.) |
1505 |
++ */ |
1506 |
++ namepath = acpi_ns_get_external_pathname(node); |
1507 |
++ status = ae_lookup_init_file_entry(namepath, &obj_desc); |
1508 |
++ if (ACPI_SUCCESS(status)) { |
1509 |
++ |
1510 |
++ /* Detach any existing object, attach new object */ |
1511 |
++ |
1512 |
++ if (node->object) { |
1513 |
++ acpi_ns_detach_object(node); |
1514 |
++ } |
1515 |
++ acpi_ns_attach_object(node, obj_desc, |
1516 |
++ obj_desc->common.type); |
1517 |
++ } |
1518 |
++ ACPI_FREE(namepath); |
1519 |
++ status = AE_OK; |
1520 |
++#endif |
1521 |
+ break; |
1522 |
+ |
1523 |
+ case AML_METHOD_OP: |
1524 |
+diff --git a/drivers/acpi/acpica/nsnames.c b/drivers/acpi/acpica/nsnames.c |
1525 |
+index 370bbc867745..c717fff7d9b5 100644 |
1526 |
+--- a/drivers/acpi/acpica/nsnames.c |
1527 |
++++ b/drivers/acpi/acpica/nsnames.c |
1528 |
+@@ -13,9 +13,6 @@ |
1529 |
+ #define _COMPONENT ACPI_NAMESPACE |
1530 |
+ ACPI_MODULE_NAME("nsnames") |
1531 |
+ |
1532 |
+-/* Local Prototypes */ |
1533 |
+-static void acpi_ns_normalize_pathname(char *original_path); |
1534 |
+- |
1535 |
+ /******************************************************************************* |
1536 |
+ * |
1537 |
+ * FUNCTION: acpi_ns_get_external_pathname |
1538 |
+@@ -30,7 +27,6 @@ static void acpi_ns_normalize_pathname(char *original_path); |
1539 |
+ * for error and debug statements. |
1540 |
+ * |
1541 |
+ ******************************************************************************/ |
1542 |
+- |
1543 |
+ char *acpi_ns_get_external_pathname(struct acpi_namespace_node *node) |
1544 |
+ { |
1545 |
+ char *name_buffer; |
1546 |
+@@ -411,7 +407,7 @@ cleanup: |
1547 |
+ * |
1548 |
+ ******************************************************************************/ |
1549 |
+ |
1550 |
+-static void acpi_ns_normalize_pathname(char *original_path) |
1551 |
++void acpi_ns_normalize_pathname(char *original_path) |
1552 |
+ { |
1553 |
+ char *input_path = original_path; |
1554 |
+ char *new_path_buffer; |
1555 |
+diff --git a/drivers/acpi/acpica/utdelete.c b/drivers/acpi/acpica/utdelete.c |
1556 |
+index eee263cb7beb..c365faf4e6cd 100644 |
1557 |
+--- a/drivers/acpi/acpica/utdelete.c |
1558 |
++++ b/drivers/acpi/acpica/utdelete.c |
1559 |
+@@ -452,13 +452,13 @@ acpi_ut_update_ref_count(union acpi_operand_object *object, u32 action) |
1560 |
+ * |
1561 |
+ * FUNCTION: acpi_ut_update_object_reference |
1562 |
+ * |
1563 |
+- * PARAMETERS: object - Increment ref count for this object |
1564 |
+- * and all sub-objects |
1565 |
++ * PARAMETERS: object - Increment or decrement the ref count for |
1566 |
++ * this object and all sub-objects |
1567 |
+ * action - Either REF_INCREMENT or REF_DECREMENT |
1568 |
+ * |
1569 |
+ * RETURN: Status |
1570 |
+ * |
1571 |
+- * DESCRIPTION: Increment the object reference count |
1572 |
++ * DESCRIPTION: Increment or decrement the object reference count |
1573 |
+ * |
1574 |
+ * Object references are incremented when: |
1575 |
+ * 1) An object is attached to a Node (namespace object) |
1576 |
+@@ -492,7 +492,7 @@ acpi_ut_update_object_reference(union acpi_operand_object *object, u16 action) |
1577 |
+ } |
1578 |
+ |
1579 |
+ /* |
1580 |
+- * All sub-objects must have their reference count incremented |
1581 |
++ * All sub-objects must have their reference count updated |
1582 |
+ * also. Different object types have different subobjects. |
1583 |
+ */ |
1584 |
+ switch (object->common.type) { |
1585 |
+@@ -559,6 +559,7 @@ acpi_ut_update_object_reference(union acpi_operand_object *object, u16 action) |
1586 |
+ break; |
1587 |
+ } |
1588 |
+ } |
1589 |
++ |
1590 |
+ next_object = NULL; |
1591 |
+ break; |
1592 |
+ |
1593 |
+diff --git a/drivers/acpi/device_pm.c b/drivers/acpi/device_pm.c |
1594 |
+index b64c62bfcea5..b2263ec67b43 100644 |
1595 |
+--- a/drivers/acpi/device_pm.c |
1596 |
++++ b/drivers/acpi/device_pm.c |
1597 |
+@@ -1321,8 +1321,8 @@ int acpi_dev_pm_attach(struct device *dev, bool power_on) |
1598 |
+ */ |
1599 |
+ static const struct acpi_device_id special_pm_ids[] = { |
1600 |
+ {"PNP0C0B", }, /* Generic ACPI fan */ |
1601 |
+- {"INT1044", }, /* Fan for Tiger Lake generation */ |
1602 |
+ {"INT3404", }, /* Fan */ |
1603 |
++ {"INTC1044", }, /* Fan for Tiger Lake generation */ |
1604 |
+ {} |
1605 |
+ }; |
1606 |
+ struct acpi_device *adev = ACPI_COMPANION(dev); |
1607 |
+diff --git a/drivers/acpi/dptf/dptf_power.c b/drivers/acpi/dptf/dptf_power.c |
1608 |
+index 387f27ef3368..e4e8b75d39f0 100644 |
1609 |
+--- a/drivers/acpi/dptf/dptf_power.c |
1610 |
++++ b/drivers/acpi/dptf/dptf_power.c |
1611 |
+@@ -97,8 +97,8 @@ static int dptf_power_remove(struct platform_device *pdev) |
1612 |
+ } |
1613 |
+ |
1614 |
+ static const struct acpi_device_id int3407_device_ids[] = { |
1615 |
+- {"INT1047", 0}, |
1616 |
+ {"INT3407", 0}, |
1617 |
++ {"INTC1047", 0}, |
1618 |
+ {"", 0}, |
1619 |
+ }; |
1620 |
+ MODULE_DEVICE_TABLE(acpi, int3407_device_ids); |
1621 |
+diff --git a/drivers/acpi/dptf/int340x_thermal.c b/drivers/acpi/dptf/int340x_thermal.c |
1622 |
+index 1ec7b6900662..bc71a6a60334 100644 |
1623 |
+--- a/drivers/acpi/dptf/int340x_thermal.c |
1624 |
++++ b/drivers/acpi/dptf/int340x_thermal.c |
1625 |
+@@ -13,10 +13,6 @@ |
1626 |
+ |
1627 |
+ #define INT3401_DEVICE 0X01 |
1628 |
+ static const struct acpi_device_id int340x_thermal_device_ids[] = { |
1629 |
+- {"INT1040"}, |
1630 |
+- {"INT1043"}, |
1631 |
+- {"INT1044"}, |
1632 |
+- {"INT1047"}, |
1633 |
+ {"INT3400"}, |
1634 |
+ {"INT3401", INT3401_DEVICE}, |
1635 |
+ {"INT3402"}, |
1636 |
+@@ -28,6 +24,10 @@ static const struct acpi_device_id int340x_thermal_device_ids[] = { |
1637 |
+ {"INT3409"}, |
1638 |
+ {"INT340A"}, |
1639 |
+ {"INT340B"}, |
1640 |
++ {"INTC1040"}, |
1641 |
++ {"INTC1043"}, |
1642 |
++ {"INTC1044"}, |
1643 |
++ {"INTC1047"}, |
1644 |
+ {""}, |
1645 |
+ }; |
1646 |
+ |
1647 |
+diff --git a/drivers/acpi/processor_throttling.c b/drivers/acpi/processor_throttling.c |
1648 |
+index 532a1ae3595a..a0bd56ece3ff 100644 |
1649 |
+--- a/drivers/acpi/processor_throttling.c |
1650 |
++++ b/drivers/acpi/processor_throttling.c |
1651 |
+@@ -897,13 +897,6 @@ static long __acpi_processor_get_throttling(void *data) |
1652 |
+ return pr->throttling.acpi_processor_get_throttling(pr); |
1653 |
+ } |
1654 |
+ |
1655 |
+-static int call_on_cpu(int cpu, long (*fn)(void *), void *arg, bool direct) |
1656 |
+-{ |
1657 |
+- if (direct || (is_percpu_thread() && cpu == smp_processor_id())) |
1658 |
+- return fn(arg); |
1659 |
+- return work_on_cpu(cpu, fn, arg); |
1660 |
+-} |
1661 |
+- |
1662 |
+ static int acpi_processor_get_throttling(struct acpi_processor *pr) |
1663 |
+ { |
1664 |
+ if (!pr) |
1665 |
+diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c |
1666 |
+index 6343402c09e6..27b80df49ba2 100644 |
1667 |
+--- a/drivers/block/rbd.c |
1668 |
++++ b/drivers/block/rbd.c |
1669 |
+@@ -4554,6 +4554,10 @@ static void cancel_tasks_sync(struct rbd_device *rbd_dev) |
1670 |
+ cancel_work_sync(&rbd_dev->unlock_work); |
1671 |
+ } |
1672 |
+ |
1673 |
++/* |
1674 |
++ * header_rwsem must not be held to avoid a deadlock with |
1675 |
++ * rbd_dev_refresh() when flushing notifies. |
1676 |
++ */ |
1677 |
+ static void rbd_unregister_watch(struct rbd_device *rbd_dev) |
1678 |
+ { |
1679 |
+ cancel_tasks_sync(rbd_dev); |
1680 |
+@@ -6951,9 +6955,10 @@ static void rbd_print_dne(struct rbd_device *rbd_dev, bool is_snap) |
1681 |
+ |
1682 |
+ static void rbd_dev_image_release(struct rbd_device *rbd_dev) |
1683 |
+ { |
1684 |
+- rbd_dev_unprobe(rbd_dev); |
1685 |
+- if (rbd_dev->opts) |
1686 |
++ if (!rbd_is_ro(rbd_dev)) |
1687 |
+ rbd_unregister_watch(rbd_dev); |
1688 |
++ |
1689 |
++ rbd_dev_unprobe(rbd_dev); |
1690 |
+ rbd_dev->image_format = 0; |
1691 |
+ kfree(rbd_dev->spec->image_id); |
1692 |
+ rbd_dev->spec->image_id = NULL; |
1693 |
+@@ -6964,6 +6969,9 @@ static void rbd_dev_image_release(struct rbd_device *rbd_dev) |
1694 |
+ * device. If this image is the one being mapped (i.e., not a |
1695 |
+ * parent), initiate a watch on its header object before using that |
1696 |
+ * object to get detailed information about the rbd image. |
1697 |
++ * |
1698 |
++ * On success, returns with header_rwsem held for write if called |
1699 |
++ * with @depth == 0. |
1700 |
+ */ |
1701 |
+ static int rbd_dev_image_probe(struct rbd_device *rbd_dev, int depth) |
1702 |
+ { |
1703 |
+@@ -6993,11 +7001,14 @@ static int rbd_dev_image_probe(struct rbd_device *rbd_dev, int depth) |
1704 |
+ } |
1705 |
+ } |
1706 |
+ |
1707 |
++ if (!depth) |
1708 |
++ down_write(&rbd_dev->header_rwsem); |
1709 |
++ |
1710 |
+ ret = rbd_dev_header_info(rbd_dev); |
1711 |
+ if (ret) { |
1712 |
+ if (ret == -ENOENT && !need_watch) |
1713 |
+ rbd_print_dne(rbd_dev, false); |
1714 |
+- goto err_out_watch; |
1715 |
++ goto err_out_probe; |
1716 |
+ } |
1717 |
+ |
1718 |
+ /* |
1719 |
+@@ -7042,10 +7053,11 @@ static int rbd_dev_image_probe(struct rbd_device *rbd_dev, int depth) |
1720 |
+ return 0; |
1721 |
+ |
1722 |
+ err_out_probe: |
1723 |
+- rbd_dev_unprobe(rbd_dev); |
1724 |
+-err_out_watch: |
1725 |
++ if (!depth) |
1726 |
++ up_write(&rbd_dev->header_rwsem); |
1727 |
+ if (need_watch) |
1728 |
+ rbd_unregister_watch(rbd_dev); |
1729 |
++ rbd_dev_unprobe(rbd_dev); |
1730 |
+ err_out_format: |
1731 |
+ rbd_dev->image_format = 0; |
1732 |
+ kfree(rbd_dev->spec->image_id); |
1733 |
+@@ -7107,12 +7119,9 @@ static ssize_t do_rbd_add(struct bus_type *bus, |
1734 |
+ goto err_out_rbd_dev; |
1735 |
+ } |
1736 |
+ |
1737 |
+- down_write(&rbd_dev->header_rwsem); |
1738 |
+ rc = rbd_dev_image_probe(rbd_dev, 0); |
1739 |
+- if (rc < 0) { |
1740 |
+- up_write(&rbd_dev->header_rwsem); |
1741 |
++ if (rc < 0) |
1742 |
+ goto err_out_rbd_dev; |
1743 |
+- } |
1744 |
+ |
1745 |
+ if (rbd_dev->opts->alloc_size > rbd_dev->layout.object_size) { |
1746 |
+ rbd_warn(rbd_dev, "alloc_size adjusted to %u", |
1747 |
+diff --git a/drivers/clk/at91/clk-usb.c b/drivers/clk/at91/clk-usb.c |
1748 |
+index bda92980e015..c0895c993cce 100644 |
1749 |
+--- a/drivers/clk/at91/clk-usb.c |
1750 |
++++ b/drivers/clk/at91/clk-usb.c |
1751 |
+@@ -75,6 +75,9 @@ static int at91sam9x5_clk_usb_determine_rate(struct clk_hw *hw, |
1752 |
+ tmp_parent_rate = req->rate * div; |
1753 |
+ tmp_parent_rate = clk_hw_round_rate(parent, |
1754 |
+ tmp_parent_rate); |
1755 |
++ if (!tmp_parent_rate) |
1756 |
++ continue; |
1757 |
++ |
1758 |
+ tmp_rate = DIV_ROUND_CLOSEST(tmp_parent_rate, div); |
1759 |
+ if (tmp_rate < req->rate) |
1760 |
+ tmp_diff = req->rate - tmp_rate; |
1761 |
+diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c |
1762 |
+index 95adf6c6db3d..305544b68b8a 100644 |
1763 |
+--- a/drivers/clk/clk.c |
1764 |
++++ b/drivers/clk/clk.c |
1765 |
+@@ -2660,12 +2660,14 @@ static int clk_core_get_phase(struct clk_core *core) |
1766 |
+ { |
1767 |
+ int ret; |
1768 |
+ |
1769 |
+- clk_prepare_lock(); |
1770 |
++ lockdep_assert_held(&prepare_lock); |
1771 |
++ if (!core->ops->get_phase) |
1772 |
++ return 0; |
1773 |
++ |
1774 |
+ /* Always try to update cached phase if possible */ |
1775 |
+- if (core->ops->get_phase) |
1776 |
+- core->phase = core->ops->get_phase(core->hw); |
1777 |
+- ret = core->phase; |
1778 |
+- clk_prepare_unlock(); |
1779 |
++ ret = core->ops->get_phase(core->hw); |
1780 |
++ if (ret >= 0) |
1781 |
++ core->phase = ret; |
1782 |
+ |
1783 |
+ return ret; |
1784 |
+ } |
1785 |
+@@ -2679,10 +2681,16 @@ static int clk_core_get_phase(struct clk_core *core) |
1786 |
+ */ |
1787 |
+ int clk_get_phase(struct clk *clk) |
1788 |
+ { |
1789 |
++ int ret; |
1790 |
++ |
1791 |
+ if (!clk) |
1792 |
+ return 0; |
1793 |
+ |
1794 |
+- return clk_core_get_phase(clk->core); |
1795 |
++ clk_prepare_lock(); |
1796 |
++ ret = clk_core_get_phase(clk->core); |
1797 |
++ clk_prepare_unlock(); |
1798 |
++ |
1799 |
++ return ret; |
1800 |
+ } |
1801 |
+ EXPORT_SYMBOL_GPL(clk_get_phase); |
1802 |
+ |
1803 |
+@@ -2896,13 +2904,21 @@ static struct hlist_head *orphan_list[] = { |
1804 |
+ static void clk_summary_show_one(struct seq_file *s, struct clk_core *c, |
1805 |
+ int level) |
1806 |
+ { |
1807 |
+- seq_printf(s, "%*s%-*s %7d %8d %8d %11lu %10lu %5d %6d\n", |
1808 |
++ int phase; |
1809 |
++ |
1810 |
++ seq_printf(s, "%*s%-*s %7d %8d %8d %11lu %10lu ", |
1811 |
+ level * 3 + 1, "", |
1812 |
+ 30 - level * 3, c->name, |
1813 |
+ c->enable_count, c->prepare_count, c->protect_count, |
1814 |
+- clk_core_get_rate(c), clk_core_get_accuracy(c), |
1815 |
+- clk_core_get_phase(c), |
1816 |
+- clk_core_get_scaled_duty_cycle(c, 100000)); |
1817 |
++ clk_core_get_rate(c), clk_core_get_accuracy(c)); |
1818 |
++ |
1819 |
++ phase = clk_core_get_phase(c); |
1820 |
++ if (phase >= 0) |
1821 |
++ seq_printf(s, "%5d", phase); |
1822 |
++ else |
1823 |
++ seq_puts(s, "-----"); |
1824 |
++ |
1825 |
++ seq_printf(s, " %6d\n", clk_core_get_scaled_duty_cycle(c, 100000)); |
1826 |
+ } |
1827 |
+ |
1828 |
+ static void clk_summary_show_subtree(struct seq_file *s, struct clk_core *c, |
1829 |
+@@ -2939,6 +2955,7 @@ DEFINE_SHOW_ATTRIBUTE(clk_summary); |
1830 |
+ |
1831 |
+ static void clk_dump_one(struct seq_file *s, struct clk_core *c, int level) |
1832 |
+ { |
1833 |
++ int phase; |
1834 |
+ unsigned long min_rate, max_rate; |
1835 |
+ |
1836 |
+ clk_core_get_boundaries(c, &min_rate, &max_rate); |
1837 |
+@@ -2952,7 +2969,9 @@ static void clk_dump_one(struct seq_file *s, struct clk_core *c, int level) |
1838 |
+ seq_printf(s, "\"min_rate\": %lu,", min_rate); |
1839 |
+ seq_printf(s, "\"max_rate\": %lu,", max_rate); |
1840 |
+ seq_printf(s, "\"accuracy\": %lu,", clk_core_get_accuracy(c)); |
1841 |
+- seq_printf(s, "\"phase\": %d,", clk_core_get_phase(c)); |
1842 |
++ phase = clk_core_get_phase(c); |
1843 |
++ if (phase >= 0) |
1844 |
++ seq_printf(s, "\"phase\": %d,", phase); |
1845 |
+ seq_printf(s, "\"duty_cycle\": %u", |
1846 |
+ clk_core_get_scaled_duty_cycle(c, 100000)); |
1847 |
+ } |
1848 |
+@@ -3434,14 +3453,11 @@ static int __clk_core_init(struct clk_core *core) |
1849 |
+ core->accuracy = 0; |
1850 |
+ |
1851 |
+ /* |
1852 |
+- * Set clk's phase. |
1853 |
++ * Set clk's phase by clk_core_get_phase() caching the phase. |
1854 |
+ * Since a phase is by definition relative to its parent, just |
1855 |
+ * query the current clock phase, or just assume it's in phase. |
1856 |
+ */ |
1857 |
+- if (core->ops->get_phase) |
1858 |
+- core->phase = core->ops->get_phase(core->hw); |
1859 |
+- else |
1860 |
+- core->phase = 0; |
1861 |
++ clk_core_get_phase(core); |
1862 |
+ |
1863 |
+ /* |
1864 |
+ * Set clk's duty cycle. |
1865 |
+diff --git a/drivers/clk/imx/clk-pll14xx.c b/drivers/clk/imx/clk-pll14xx.c |
1866 |
+index 5b0519a81a7a..37e311e1d058 100644 |
1867 |
+--- a/drivers/clk/imx/clk-pll14xx.c |
1868 |
++++ b/drivers/clk/imx/clk-pll14xx.c |
1869 |
+@@ -55,8 +55,10 @@ static const struct imx_pll14xx_rate_table imx_pll1416x_tbl[] = { |
1870 |
+ }; |
1871 |
+ |
1872 |
+ static const struct imx_pll14xx_rate_table imx_pll1443x_tbl[] = { |
1873 |
++ PLL_1443X_RATE(1039500000U, 173, 2, 1, 16384), |
1874 |
+ PLL_1443X_RATE(650000000U, 325, 3, 2, 0), |
1875 |
+ PLL_1443X_RATE(594000000U, 198, 2, 2, 0), |
1876 |
++ PLL_1443X_RATE(519750000U, 173, 2, 2, 16384), |
1877 |
+ PLL_1443X_RATE(393216000U, 262, 2, 3, 9437), |
1878 |
+ PLL_1443X_RATE(361267200U, 361, 3, 3, 17511), |
1879 |
+ }; |
1880 |
+diff --git a/drivers/clk/tegra/clk-tegra-pmc.c b/drivers/clk/tegra/clk-tegra-pmc.c |
1881 |
+index bec3e008335f..5e044ba1ae36 100644 |
1882 |
+--- a/drivers/clk/tegra/clk-tegra-pmc.c |
1883 |
++++ b/drivers/clk/tegra/clk-tegra-pmc.c |
1884 |
+@@ -49,16 +49,16 @@ struct pmc_clk_init_data { |
1885 |
+ |
1886 |
+ static DEFINE_SPINLOCK(clk_out_lock); |
1887 |
+ |
1888 |
+-static const char *clk_out1_parents[] = { "clk_m", "clk_m_div2", |
1889 |
+- "clk_m_div4", "extern1", |
1890 |
++static const char *clk_out1_parents[] = { "osc", "osc_div2", |
1891 |
++ "osc_div4", "extern1", |
1892 |
+ }; |
1893 |
+ |
1894 |
+-static const char *clk_out2_parents[] = { "clk_m", "clk_m_div2", |
1895 |
+- "clk_m_div4", "extern2", |
1896 |
++static const char *clk_out2_parents[] = { "osc", "osc_div2", |
1897 |
++ "osc_div4", "extern2", |
1898 |
+ }; |
1899 |
+ |
1900 |
+-static const char *clk_out3_parents[] = { "clk_m", "clk_m_div2", |
1901 |
+- "clk_m_div4", "extern3", |
1902 |
++static const char *clk_out3_parents[] = { "osc", "osc_div2", |
1903 |
++ "osc_div4", "extern3", |
1904 |
+ }; |
1905 |
+ |
1906 |
+ static struct pmc_clk_init_data pmc_clks[] = { |
1907 |
+diff --git a/drivers/crypto/qce/dma.c b/drivers/crypto/qce/dma.c |
1908 |
+index 7da893dc00e7..46db5bf366b4 100644 |
1909 |
+--- a/drivers/crypto/qce/dma.c |
1910 |
++++ b/drivers/crypto/qce/dma.c |
1911 |
+@@ -48,9 +48,10 @@ void qce_dma_release(struct qce_dma_data *dma) |
1912 |
+ |
1913 |
+ struct scatterlist * |
1914 |
+ qce_sgtable_add(struct sg_table *sgt, struct scatterlist *new_sgl, |
1915 |
+- int max_ents) |
1916 |
++ unsigned int max_len) |
1917 |
+ { |
1918 |
+ struct scatterlist *sg = sgt->sgl, *sg_last = NULL; |
1919 |
++ unsigned int new_len; |
1920 |
+ |
1921 |
+ while (sg) { |
1922 |
+ if (!sg_page(sg)) |
1923 |
+@@ -61,13 +62,13 @@ qce_sgtable_add(struct sg_table *sgt, struct scatterlist *new_sgl, |
1924 |
+ if (!sg) |
1925 |
+ return ERR_PTR(-EINVAL); |
1926 |
+ |
1927 |
+- while (new_sgl && sg && max_ents) { |
1928 |
+- sg_set_page(sg, sg_page(new_sgl), new_sgl->length, |
1929 |
+- new_sgl->offset); |
1930 |
++ while (new_sgl && sg && max_len) { |
1931 |
++ new_len = new_sgl->length > max_len ? max_len : new_sgl->length; |
1932 |
++ sg_set_page(sg, sg_page(new_sgl), new_len, new_sgl->offset); |
1933 |
+ sg_last = sg; |
1934 |
+ sg = sg_next(sg); |
1935 |
+ new_sgl = sg_next(new_sgl); |
1936 |
+- max_ents--; |
1937 |
++ max_len -= new_len; |
1938 |
+ } |
1939 |
+ |
1940 |
+ return sg_last; |
1941 |
+diff --git a/drivers/crypto/qce/dma.h b/drivers/crypto/qce/dma.h |
1942 |
+index ed25a0d9829e..786402169360 100644 |
1943 |
+--- a/drivers/crypto/qce/dma.h |
1944 |
++++ b/drivers/crypto/qce/dma.h |
1945 |
+@@ -43,6 +43,6 @@ void qce_dma_issue_pending(struct qce_dma_data *dma); |
1946 |
+ int qce_dma_terminate_all(struct qce_dma_data *dma); |
1947 |
+ struct scatterlist * |
1948 |
+ qce_sgtable_add(struct sg_table *sgt, struct scatterlist *sg_add, |
1949 |
+- int max_ents); |
1950 |
++ unsigned int max_len); |
1951 |
+ |
1952 |
+ #endif /* _DMA_H_ */ |
1953 |
+diff --git a/drivers/crypto/qce/skcipher.c b/drivers/crypto/qce/skcipher.c |
1954 |
+index 4217b745f124..63ae75809cb7 100644 |
1955 |
+--- a/drivers/crypto/qce/skcipher.c |
1956 |
++++ b/drivers/crypto/qce/skcipher.c |
1957 |
+@@ -97,13 +97,14 @@ qce_skcipher_async_req_handle(struct crypto_async_request *async_req) |
1958 |
+ |
1959 |
+ sg_init_one(&rctx->result_sg, qce->dma.result_buf, QCE_RESULT_BUF_SZ); |
1960 |
+ |
1961 |
+- sg = qce_sgtable_add(&rctx->dst_tbl, req->dst, rctx->dst_nents - 1); |
1962 |
++ sg = qce_sgtable_add(&rctx->dst_tbl, req->dst, req->cryptlen); |
1963 |
+ if (IS_ERR(sg)) { |
1964 |
+ ret = PTR_ERR(sg); |
1965 |
+ goto error_free; |
1966 |
+ } |
1967 |
+ |
1968 |
+- sg = qce_sgtable_add(&rctx->dst_tbl, &rctx->result_sg, 1); |
1969 |
++ sg = qce_sgtable_add(&rctx->dst_tbl, &rctx->result_sg, |
1970 |
++ QCE_RESULT_BUF_SZ); |
1971 |
+ if (IS_ERR(sg)) { |
1972 |
+ ret = PTR_ERR(sg); |
1973 |
+ goto error_free; |
1974 |
+diff --git a/drivers/dma/idxd/device.c b/drivers/dma/idxd/device.c |
1975 |
+index ada69e722f84..f6f49f0f6fae 100644 |
1976 |
+--- a/drivers/dma/idxd/device.c |
1977 |
++++ b/drivers/dma/idxd/device.c |
1978 |
+@@ -584,11 +584,11 @@ static void idxd_group_flags_setup(struct idxd_device *idxd) |
1979 |
+ struct idxd_group *group = &idxd->groups[i]; |
1980 |
+ |
1981 |
+ if (group->tc_a == -1) |
1982 |
+- group->grpcfg.flags.tc_a = 0; |
1983 |
++ group->tc_a = group->grpcfg.flags.tc_a = 0; |
1984 |
+ else |
1985 |
+ group->grpcfg.flags.tc_a = group->tc_a; |
1986 |
+ if (group->tc_b == -1) |
1987 |
+- group->grpcfg.flags.tc_b = 1; |
1988 |
++ group->tc_b = group->grpcfg.flags.tc_b = 1; |
1989 |
+ else |
1990 |
+ group->grpcfg.flags.tc_b = group->tc_b; |
1991 |
+ group->grpcfg.flags.use_token_limit = group->use_token_limit; |
1992 |
+diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device.c b/drivers/gpu/drm/amd/amdkfd/kfd_device.c |
1993 |
+index 2a9e40131735..0d70cb2248fe 100644 |
1994 |
+--- a/drivers/gpu/drm/amd/amdkfd/kfd_device.c |
1995 |
++++ b/drivers/gpu/drm/amd/amdkfd/kfd_device.c |
1996 |
+@@ -1104,9 +1104,9 @@ kfd_gtt_out: |
1997 |
+ return 0; |
1998 |
+ |
1999 |
+ kfd_gtt_no_free_chunk: |
2000 |
+- pr_debug("Allocation failed with mem_obj = %p\n", mem_obj); |
2001 |
++ pr_debug("Allocation failed with mem_obj = %p\n", *mem_obj); |
2002 |
+ mutex_unlock(&kfd->gtt_sa_lock); |
2003 |
+- kfree(mem_obj); |
2004 |
++ kfree(*mem_obj); |
2005 |
+ return -ENOMEM; |
2006 |
+ } |
2007 |
+ |
2008 |
+diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_hdcp.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_hdcp.c |
2009 |
+index 0acd3409dd6c..3abeff7722e3 100644 |
2010 |
+--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_hdcp.c |
2011 |
++++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_hdcp.c |
2012 |
+@@ -113,10 +113,13 @@ void hdcp_update_display(struct hdcp_workqueue *hdcp_work, |
2013 |
+ |
2014 |
+ if (enable_encryption) { |
2015 |
+ display->adjust.disable = 0; |
2016 |
+- if (content_type == DRM_MODE_HDCP_CONTENT_TYPE0) |
2017 |
++ if (content_type == DRM_MODE_HDCP_CONTENT_TYPE0) { |
2018 |
++ hdcp_w->link.adjust.hdcp1.disable = 0; |
2019 |
+ hdcp_w->link.adjust.hdcp2.force_type = MOD_HDCP_FORCE_TYPE_0; |
2020 |
+- else if (content_type == DRM_MODE_HDCP_CONTENT_TYPE1) |
2021 |
++ } else if (content_type == DRM_MODE_HDCP_CONTENT_TYPE1) { |
2022 |
++ hdcp_w->link.adjust.hdcp1.disable = 1; |
2023 |
+ hdcp_w->link.adjust.hdcp2.force_type = MOD_HDCP_FORCE_TYPE_1; |
2024 |
++ } |
2025 |
+ |
2026 |
+ schedule_delayed_work(&hdcp_w->property_validate_dwork, |
2027 |
+ msecs_to_jiffies(DRM_HDCP_CHECK_PERIOD_MS)); |
2028 |
+@@ -334,6 +337,7 @@ static void update_config(void *handle, struct cp_psp_stream_config *config) |
2029 |
+ link->dp.rev = aconnector->dc_link->dpcd_caps.dpcd_rev.raw; |
2030 |
+ display->adjust.disable = 1; |
2031 |
+ link->adjust.auth_delay = 2; |
2032 |
++ link->adjust.hdcp1.disable = 0; |
2033 |
+ |
2034 |
+ hdcp_update_display(hdcp_work, link_index, aconnector, DRM_MODE_HDCP_CONTENT_TYPE0, false); |
2035 |
+ } |
2036 |
+diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c |
2037 |
+index b65ae817eabf..2d4c899e1f8b 100644 |
2038 |
+--- a/drivers/gpu/drm/nouveau/nouveau_drm.c |
2039 |
++++ b/drivers/gpu/drm/nouveau/nouveau_drm.c |
2040 |
+@@ -618,6 +618,64 @@ nouveau_drm_device_fini(struct drm_device *dev) |
2041 |
+ kfree(drm); |
2042 |
+ } |
2043 |
+ |
2044 |
++/* |
2045 |
++ * On some Intel PCIe bridge controllers doing a |
2046 |
++ * D0 -> D3hot -> D3cold -> D0 sequence causes Nvidia GPUs to not reappear. |
2047 |
++ * Skipping the intermediate D3hot step seems to make it work again. This is |
2048 |
++ * probably caused by not meeting the expectation the involved AML code has |
2049 |
++ * when the GPU is put into D3hot state before invoking it. |
2050 |
++ * |
2051 |
++ * This leads to various manifestations of this issue: |
2052 |
++ * - AML code execution to power on the GPU hits an infinite loop (as the |
2053 |
++ * code waits on device memory to change). |
2054 |
++ * - kernel crashes, as all PCI reads return -1, which most code isn't able |
2055 |
++ * to handle well enough. |
2056 |
++ * |
2057 |
++ * In all cases dmesg will contain at least one line like this: |
2058 |
++ * 'nouveau 0000:01:00.0: Refused to change power state, currently in D3' |
2059 |
++ * followed by a lot of nouveau timeouts. |
2060 |
++ * |
2061 |
++ * In the \_SB.PCI0.PEG0.PG00._OFF code deeper down writes bit 0x80 to the not |
2062 |
++ * documented PCI config space register 0x248 of the Intel PCIe bridge |
2063 |
++ * controller (0x1901) in order to change the state of the PCIe link between |
2064 |
++ * the PCIe port and the GPU. There are alternative code paths using other |
2065 |
++ * registers, which seem to work fine (executed pre Windows 8): |
2066 |
++ * - 0xbc bit 0x20 (publicly available documentation claims 'reserved') |
2067 |
++ * - 0xb0 bit 0x10 (link disable) |
2068 |
++ * Changing the conditions inside the firmware by poking into the relevant |
2069 |
++ * addresses does resolve the issue, but it seemed to be ACPI private memory |
2070 |
++ * and not any device accessible memory at all, so there is no portable way of |
2071 |
++ * changing the conditions. |
2072 |
++ * On a XPS 9560 that means bits [0,3] on \CPEX need to be cleared. |
2073 |
++ * |
2074 |
++ * The only systems where this behavior can be seen are hybrid graphics laptops |
2075 |
++ * with a secondary Nvidia Maxwell, Pascal or Turing GPU. It's unclear whether |
2076 |
++ * this issue only occurs in combination with listed Intel PCIe bridge |
2077 |
++ * controllers and the mentioned GPUs or other devices as well. |
2078 |
++ * |
2079 |
++ * documentation on the PCIe bridge controller can be found in the |
2080 |
++ * "7th Generation Intel® Processor Families for H Platforms Datasheet Volume 2" |
2081 |
++ * Section "12 PCI Express* Controller (x16) Registers" |
2082 |
++ */ |
2083 |
++ |
2084 |
++static void quirk_broken_nv_runpm(struct pci_dev *pdev) |
2085 |
++{ |
2086 |
++ struct drm_device *dev = pci_get_drvdata(pdev); |
2087 |
++ struct nouveau_drm *drm = nouveau_drm(dev); |
2088 |
++ struct pci_dev *bridge = pci_upstream_bridge(pdev); |
2089 |
++ |
2090 |
++ if (!bridge || bridge->vendor != PCI_VENDOR_ID_INTEL) |
2091 |
++ return; |
2092 |
++ |
2093 |
++ switch (bridge->device) { |
2094 |
++ case 0x1901: |
2095 |
++ drm->old_pm_cap = pdev->pm_cap; |
2096 |
++ pdev->pm_cap = 0; |
2097 |
++ NV_INFO(drm, "Disabling PCI power management to avoid bug\n"); |
2098 |
++ break; |
2099 |
++ } |
2100 |
++} |
2101 |
++ |
2102 |
+ static int nouveau_drm_probe(struct pci_dev *pdev, |
2103 |
+ const struct pci_device_id *pent) |
2104 |
+ { |
2105 |
+@@ -699,6 +757,7 @@ static int nouveau_drm_probe(struct pci_dev *pdev, |
2106 |
+ if (ret) |
2107 |
+ goto fail_drm_dev_init; |
2108 |
+ |
2109 |
++ quirk_broken_nv_runpm(pdev); |
2110 |
+ return 0; |
2111 |
+ |
2112 |
+ fail_drm_dev_init: |
2113 |
+@@ -734,7 +793,11 @@ static void |
2114 |
+ nouveau_drm_remove(struct pci_dev *pdev) |
2115 |
+ { |
2116 |
+ struct drm_device *dev = pci_get_drvdata(pdev); |
2117 |
++ struct nouveau_drm *drm = nouveau_drm(dev); |
2118 |
+ |
2119 |
++ /* revert our workaround */ |
2120 |
++ if (drm->old_pm_cap) |
2121 |
++ pdev->pm_cap = drm->old_pm_cap; |
2122 |
+ nouveau_drm_device_remove(dev); |
2123 |
+ pci_disable_device(pdev); |
2124 |
+ } |
2125 |
+diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.h b/drivers/gpu/drm/nouveau/nouveau_drv.h |
2126 |
+index c2c332fbde97..2a6519737800 100644 |
2127 |
+--- a/drivers/gpu/drm/nouveau/nouveau_drv.h |
2128 |
++++ b/drivers/gpu/drm/nouveau/nouveau_drv.h |
2129 |
+@@ -140,6 +140,8 @@ struct nouveau_drm { |
2130 |
+ |
2131 |
+ struct list_head clients; |
2132 |
+ |
2133 |
++ u8 old_pm_cap; |
2134 |
++ |
2135 |
+ struct { |
2136 |
+ struct agp_bridge_data *bridge; |
2137 |
+ u32 base; |
2138 |
+diff --git a/drivers/gpu/drm/nouveau/nouveau_svm.c b/drivers/gpu/drm/nouveau/nouveau_svm.c |
2139 |
+index df9bf1fd1bc0..c567526b75b8 100644 |
2140 |
+--- a/drivers/gpu/drm/nouveau/nouveau_svm.c |
2141 |
++++ b/drivers/gpu/drm/nouveau/nouveau_svm.c |
2142 |
+@@ -171,6 +171,11 @@ nouveau_svmm_bind(struct drm_device *dev, void *data, |
2143 |
+ mm = get_task_mm(current); |
2144 |
+ down_read(&mm->mmap_sem); |
2145 |
+ |
2146 |
++ if (!cli->svm.svmm) { |
2147 |
++ up_read(&mm->mmap_sem); |
2148 |
++ return -EINVAL; |
2149 |
++ } |
2150 |
++ |
2151 |
+ for (addr = args->va_start, end = args->va_start + size; addr < end;) { |
2152 |
+ struct vm_area_struct *vma; |
2153 |
+ unsigned long next; |
2154 |
+@@ -179,6 +184,7 @@ nouveau_svmm_bind(struct drm_device *dev, void *data, |
2155 |
+ if (!vma) |
2156 |
+ break; |
2157 |
+ |
2158 |
++ addr = max(addr, vma->vm_start); |
2159 |
+ next = min(vma->vm_end, end); |
2160 |
+ /* This is a best effort so we ignore errors */ |
2161 |
+ nouveau_dmem_migrate_vma(cli->drm, vma, addr, next); |
2162 |
+diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.c b/drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.c |
2163 |
+index dd8f85b8b3a7..f2f5636efac4 100644 |
2164 |
+--- a/drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.c |
2165 |
++++ b/drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.c |
2166 |
+@@ -1981,8 +1981,34 @@ gf100_gr_init_(struct nvkm_gr *base) |
2167 |
+ { |
2168 |
+ struct gf100_gr *gr = gf100_gr(base); |
2169 |
+ struct nvkm_subdev *subdev = &base->engine.subdev; |
2170 |
++ struct nvkm_device *device = subdev->device; |
2171 |
++ bool reset = device->chipset == 0x137 || device->chipset == 0x138; |
2172 |
+ u32 ret; |
2173 |
+ |
2174 |
++ /* On certain GP107/GP108 boards, we trigger a weird issue where |
2175 |
++ * GR will stop responding to PRI accesses after we've asked the |
2176 |
++ * SEC2 RTOS to boot the GR falcons. This happens with far more |
2177 |
++ * frequency when cold-booting a board (ie. returning from D3). |
2178 |
++ * |
2179 |
++ * The root cause for this is not known and has proven difficult |
2180 |
++ * to isolate, with many avenues being dead-ends. |
2181 |
++ * |
2182 |
++ * A workaround was discovered by Karol, whereby putting GR into |
2183 |
++ * reset for an extended period right before initialisation |
2184 |
++ * prevents the problem from occuring. |
2185 |
++ * |
2186 |
++ * XXX: As RM does not require any such workaround, this is more |
2187 |
++ * of a hack than a true fix. |
2188 |
++ */ |
2189 |
++ reset = nvkm_boolopt(device->cfgopt, "NvGrResetWar", reset); |
2190 |
++ if (reset) { |
2191 |
++ nvkm_mask(device, 0x000200, 0x00001000, 0x00000000); |
2192 |
++ nvkm_rd32(device, 0x000200); |
2193 |
++ msleep(50); |
2194 |
++ nvkm_mask(device, 0x000200, 0x00001000, 0x00001000); |
2195 |
++ nvkm_rd32(device, 0x000200); |
2196 |
++ } |
2197 |
++ |
2198 |
+ nvkm_pmu_pgob(gr->base.engine.subdev.device->pmu, false); |
2199 |
+ |
2200 |
+ ret = nvkm_falcon_get(&gr->fecs.falcon, subdev); |
2201 |
+diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c |
2202 |
+index 5df596fb0280..fe420ca454e0 100644 |
2203 |
+--- a/drivers/gpu/drm/ttm/ttm_bo.c |
2204 |
++++ b/drivers/gpu/drm/ttm/ttm_bo.c |
2205 |
+@@ -498,8 +498,10 @@ static void ttm_bo_cleanup_refs_or_queue(struct ttm_buffer_object *bo) |
2206 |
+ |
2207 |
+ dma_resv_unlock(bo->base.resv); |
2208 |
+ } |
2209 |
+- if (bo->base.resv != &bo->base._resv) |
2210 |
++ if (bo->base.resv != &bo->base._resv) { |
2211 |
++ ttm_bo_flush_all_fences(bo); |
2212 |
+ dma_resv_unlock(&bo->base._resv); |
2213 |
++ } |
2214 |
+ |
2215 |
+ error: |
2216 |
+ kref_get(&bo->list_kref); |
2217 |
+diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c |
2218 |
+index cea18dc15f77..340719238753 100644 |
2219 |
+--- a/drivers/gpu/drm/vc4/vc4_hdmi.c |
2220 |
++++ b/drivers/gpu/drm/vc4/vc4_hdmi.c |
2221 |
+@@ -681,11 +681,23 @@ static enum drm_mode_status |
2222 |
+ vc4_hdmi_encoder_mode_valid(struct drm_encoder *crtc, |
2223 |
+ const struct drm_display_mode *mode) |
2224 |
+ { |
2225 |
+- /* HSM clock must be 108% of the pixel clock. Additionally, |
2226 |
+- * the AXI clock needs to be at least 25% of pixel clock, but |
2227 |
+- * HSM ends up being the limiting factor. |
2228 |
++ /* |
2229 |
++ * As stated in RPi's vc4 firmware "HDMI state machine (HSM) clock must |
2230 |
++ * be faster than pixel clock, infinitesimally faster, tested in |
2231 |
++ * simulation. Otherwise, exact value is unimportant for HDMI |
2232 |
++ * operation." This conflicts with bcm2835's vc4 documentation, which |
2233 |
++ * states HSM's clock has to be at least 108% of the pixel clock. |
2234 |
++ * |
2235 |
++ * Real life tests reveal that vc4's firmware statement holds up, and |
2236 |
++ * users are able to use pixel clocks closer to HSM's, namely for |
2237 |
++ * 1920x1200@60Hz. So it was decided to have leave a 1% margin between |
2238 |
++ * both clocks. Which, for RPi0-3 implies a maximum pixel clock of |
2239 |
++ * 162MHz. |
2240 |
++ * |
2241 |
++ * Additionally, the AXI clock needs to be at least 25% of |
2242 |
++ * pixel clock, but HSM ends up being the limiting factor. |
2243 |
+ */ |
2244 |
+- if (mode->clock > HSM_CLOCK_FREQ / (1000 * 108 / 100)) |
2245 |
++ if (mode->clock > HSM_CLOCK_FREQ / (1000 * 101 / 100)) |
2246 |
+ return MODE_CLOCK_HIGH; |
2247 |
+ |
2248 |
+ return MODE_OK; |
2249 |
+diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c |
2250 |
+index 0370364169c4..501c43c5851d 100644 |
2251 |
+--- a/drivers/hv/channel_mgmt.c |
2252 |
++++ b/drivers/hv/channel_mgmt.c |
2253 |
+@@ -839,6 +839,9 @@ void vmbus_initiate_unload(bool crash) |
2254 |
+ { |
2255 |
+ struct vmbus_channel_message_header hdr; |
2256 |
+ |
2257 |
++ if (xchg(&vmbus_connection.conn_state, DISCONNECTED) == DISCONNECTED) |
2258 |
++ return; |
2259 |
++ |
2260 |
+ /* Pre-Win2012R2 hosts don't support reconnect */ |
2261 |
+ if (vmbus_proto_version < VERSION_WIN8_1) |
2262 |
+ return; |
2263 |
+diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c |
2264 |
+index 029378c27421..a68bce4d0ddb 100644 |
2265 |
+--- a/drivers/hv/vmbus_drv.c |
2266 |
++++ b/drivers/hv/vmbus_drv.c |
2267 |
+@@ -31,6 +31,7 @@ |
2268 |
+ #include <linux/kdebug.h> |
2269 |
+ #include <linux/efi.h> |
2270 |
+ #include <linux/random.h> |
2271 |
++#include <linux/kernel.h> |
2272 |
+ #include <linux/syscore_ops.h> |
2273 |
+ #include <clocksource/hyperv_timer.h> |
2274 |
+ #include "hyperv_vmbus.h" |
2275 |
+@@ -48,14 +49,35 @@ static int hyperv_cpuhp_online; |
2276 |
+ |
2277 |
+ static void *hv_panic_page; |
2278 |
+ |
2279 |
++/* |
2280 |
++ * Boolean to control whether to report panic messages over Hyper-V. |
2281 |
++ * |
2282 |
++ * It can be set via /proc/sys/kernel/hyperv/record_panic_msg |
2283 |
++ */ |
2284 |
++static int sysctl_record_panic_msg = 1; |
2285 |
++ |
2286 |
++static int hyperv_report_reg(void) |
2287 |
++{ |
2288 |
++ return !sysctl_record_panic_msg || !hv_panic_page; |
2289 |
++} |
2290 |
++ |
2291 |
+ static int hyperv_panic_event(struct notifier_block *nb, unsigned long val, |
2292 |
+ void *args) |
2293 |
+ { |
2294 |
+ struct pt_regs *regs; |
2295 |
+ |
2296 |
+- regs = current_pt_regs(); |
2297 |
++ vmbus_initiate_unload(true); |
2298 |
+ |
2299 |
+- hyperv_report_panic(regs, val); |
2300 |
++ /* |
2301 |
++ * Hyper-V should be notified only once about a panic. If we will be |
2302 |
++ * doing hyperv_report_panic_msg() later with kmsg data, don't do |
2303 |
++ * the notification here. |
2304 |
++ */ |
2305 |
++ if (ms_hyperv.misc_features & HV_FEATURE_GUEST_CRASH_MSR_AVAILABLE |
2306 |
++ && hyperv_report_reg()) { |
2307 |
++ regs = current_pt_regs(); |
2308 |
++ hyperv_report_panic(regs, val, false); |
2309 |
++ } |
2310 |
+ return NOTIFY_DONE; |
2311 |
+ } |
2312 |
+ |
2313 |
+@@ -65,7 +87,13 @@ static int hyperv_die_event(struct notifier_block *nb, unsigned long val, |
2314 |
+ struct die_args *die = (struct die_args *)args; |
2315 |
+ struct pt_regs *regs = die->regs; |
2316 |
+ |
2317 |
+- hyperv_report_panic(regs, val); |
2318 |
++ /* |
2319 |
++ * Hyper-V should be notified only once about a panic. If we will be |
2320 |
++ * doing hyperv_report_panic_msg() later with kmsg data, don't do |
2321 |
++ * the notification here. |
2322 |
++ */ |
2323 |
++ if (hyperv_report_reg()) |
2324 |
++ hyperv_report_panic(regs, val, true); |
2325 |
+ return NOTIFY_DONE; |
2326 |
+ } |
2327 |
+ |
2328 |
+@@ -1252,13 +1280,6 @@ static void vmbus_isr(void) |
2329 |
+ add_interrupt_randomness(HYPERVISOR_CALLBACK_VECTOR, 0); |
2330 |
+ } |
2331 |
+ |
2332 |
+-/* |
2333 |
+- * Boolean to control whether to report panic messages over Hyper-V. |
2334 |
+- * |
2335 |
+- * It can be set via /proc/sys/kernel/hyperv/record_panic_msg |
2336 |
+- */ |
2337 |
+-static int sysctl_record_panic_msg = 1; |
2338 |
+- |
2339 |
+ /* |
2340 |
+ * Callback from kmsg_dump. Grab as much as possible from the end of the kmsg |
2341 |
+ * buffer and call into Hyper-V to transfer the data. |
2342 |
+@@ -1382,19 +1403,29 @@ static int vmbus_bus_init(void) |
2343 |
+ hv_panic_page = (void *)hv_alloc_hyperv_zeroed_page(); |
2344 |
+ if (hv_panic_page) { |
2345 |
+ ret = kmsg_dump_register(&hv_kmsg_dumper); |
2346 |
+- if (ret) |
2347 |
++ if (ret) { |
2348 |
+ pr_err("Hyper-V: kmsg dump register " |
2349 |
+ "error 0x%x\n", ret); |
2350 |
++ hv_free_hyperv_page( |
2351 |
++ (unsigned long)hv_panic_page); |
2352 |
++ hv_panic_page = NULL; |
2353 |
++ } |
2354 |
+ } else |
2355 |
+ pr_err("Hyper-V: panic message page memory " |
2356 |
+ "allocation failed"); |
2357 |
+ } |
2358 |
+ |
2359 |
+ register_die_notifier(&hyperv_die_block); |
2360 |
+- atomic_notifier_chain_register(&panic_notifier_list, |
2361 |
+- &hyperv_panic_block); |
2362 |
+ } |
2363 |
+ |
2364 |
++ /* |
2365 |
++ * Always register the panic notifier because we need to unload |
2366 |
++ * the VMbus channel connection to prevent any VMbus |
2367 |
++ * activity after the VM panics. |
2368 |
++ */ |
2369 |
++ atomic_notifier_chain_register(&panic_notifier_list, |
2370 |
++ &hyperv_panic_block); |
2371 |
++ |
2372 |
+ vmbus_request_offers(); |
2373 |
+ |
2374 |
+ return 0; |
2375 |
+@@ -1407,7 +1438,6 @@ err_alloc: |
2376 |
+ hv_remove_vmbus_irq(); |
2377 |
+ |
2378 |
+ bus_unregister(&hv_bus); |
2379 |
+- hv_free_hyperv_page((unsigned long)hv_panic_page); |
2380 |
+ unregister_sysctl_table(hv_ctl_table_hdr); |
2381 |
+ hv_ctl_table_hdr = NULL; |
2382 |
+ return ret; |
2383 |
+@@ -2204,8 +2234,6 @@ static int vmbus_bus_suspend(struct device *dev) |
2384 |
+ |
2385 |
+ vmbus_initiate_unload(false); |
2386 |
+ |
2387 |
+- vmbus_connection.conn_state = DISCONNECTED; |
2388 |
+- |
2389 |
+ /* Reset the event for the next resume. */ |
2390 |
+ reinit_completion(&vmbus_connection.ready_for_resume_event); |
2391 |
+ |
2392 |
+@@ -2289,7 +2317,6 @@ static void hv_kexec_handler(void) |
2393 |
+ { |
2394 |
+ hv_stimer_global_cleanup(); |
2395 |
+ vmbus_initiate_unload(false); |
2396 |
+- vmbus_connection.conn_state = DISCONNECTED; |
2397 |
+ /* Make sure conn_state is set as hv_synic_cleanup checks for it */ |
2398 |
+ mb(); |
2399 |
+ cpuhp_remove_state(hyperv_cpuhp_online); |
2400 |
+@@ -2306,7 +2333,6 @@ static void hv_crash_handler(struct pt_regs *regs) |
2401 |
+ * doing the cleanup for current CPU only. This should be sufficient |
2402 |
+ * for kdump. |
2403 |
+ */ |
2404 |
+- vmbus_connection.conn_state = DISCONNECTED; |
2405 |
+ cpu = smp_processor_id(); |
2406 |
+ hv_stimer_cleanup(cpu); |
2407 |
+ hv_synic_disable_regs(cpu); |
2408 |
+diff --git a/drivers/iio/common/st_sensors/st_sensors_core.c b/drivers/iio/common/st_sensors/st_sensors_core.c |
2409 |
+index e051edbc43c1..0e35ff06f9af 100644 |
2410 |
+--- a/drivers/iio/common/st_sensors/st_sensors_core.c |
2411 |
++++ b/drivers/iio/common/st_sensors/st_sensors_core.c |
2412 |
+@@ -328,6 +328,8 @@ static struct st_sensors_platform_data *st_sensors_dev_probe(struct device *dev, |
2413 |
+ return NULL; |
2414 |
+ |
2415 |
+ pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); |
2416 |
++ if (!pdata) |
2417 |
++ return ERR_PTR(-ENOMEM); |
2418 |
+ if (!device_property_read_u32(dev, "st,drdy-int-pin", &val) && (val <= 2)) |
2419 |
+ pdata->drdy_int_pin = (u8) val; |
2420 |
+ else |
2421 |
+@@ -371,6 +373,8 @@ int st_sensors_init_sensor(struct iio_dev *indio_dev, |
2422 |
+ |
2423 |
+ /* If OF/DT pdata exists, it will take precedence of anything else */ |
2424 |
+ of_pdata = st_sensors_dev_probe(indio_dev->dev.parent, pdata); |
2425 |
++ if (IS_ERR(of_pdata)) |
2426 |
++ return PTR_ERR(of_pdata); |
2427 |
+ if (of_pdata) |
2428 |
+ pdata = of_pdata; |
2429 |
+ |
2430 |
+diff --git a/drivers/iio/light/si1133.c b/drivers/iio/light/si1133.c |
2431 |
+index 015a21f0c2ef..9174ab928880 100644 |
2432 |
+--- a/drivers/iio/light/si1133.c |
2433 |
++++ b/drivers/iio/light/si1133.c |
2434 |
+@@ -102,6 +102,9 @@ |
2435 |
+ #define SI1133_INPUT_FRACTION_LOW 15 |
2436 |
+ #define SI1133_LUX_OUTPUT_FRACTION 12 |
2437 |
+ #define SI1133_LUX_BUFFER_SIZE 9 |
2438 |
++#define SI1133_MEASURE_BUFFER_SIZE 3 |
2439 |
++ |
2440 |
++#define SI1133_SIGN_BIT_INDEX 23 |
2441 |
+ |
2442 |
+ static const int si1133_scale_available[] = { |
2443 |
+ 1, 2, 4, 8, 16, 32, 64, 128}; |
2444 |
+@@ -234,13 +237,13 @@ static const struct si1133_lux_coeff lux_coeff = { |
2445 |
+ } |
2446 |
+ }; |
2447 |
+ |
2448 |
+-static int si1133_calculate_polynomial_inner(u32 input, u8 fraction, u16 mag, |
2449 |
++static int si1133_calculate_polynomial_inner(s32 input, u8 fraction, u16 mag, |
2450 |
+ s8 shift) |
2451 |
+ { |
2452 |
+ return ((input << fraction) / mag) << shift; |
2453 |
+ } |
2454 |
+ |
2455 |
+-static int si1133_calculate_output(u32 x, u32 y, u8 x_order, u8 y_order, |
2456 |
++static int si1133_calculate_output(s32 x, s32 y, u8 x_order, u8 y_order, |
2457 |
+ u8 input_fraction, s8 sign, |
2458 |
+ const struct si1133_coeff *coeffs) |
2459 |
+ { |
2460 |
+@@ -276,7 +279,7 @@ static int si1133_calculate_output(u32 x, u32 y, u8 x_order, u8 y_order, |
2461 |
+ * The algorithm is from: |
2462 |
+ * https://siliconlabs.github.io/Gecko_SDK_Doc/efm32zg/html/si1133_8c_source.html#l00716 |
2463 |
+ */ |
2464 |
+-static int si1133_calc_polynomial(u32 x, u32 y, u8 input_fraction, u8 num_coeff, |
2465 |
++static int si1133_calc_polynomial(s32 x, s32 y, u8 input_fraction, u8 num_coeff, |
2466 |
+ const struct si1133_coeff *coeffs) |
2467 |
+ { |
2468 |
+ u8 x_order, y_order; |
2469 |
+@@ -614,7 +617,7 @@ static int si1133_measure(struct si1133_data *data, |
2470 |
+ { |
2471 |
+ int err; |
2472 |
+ |
2473 |
+- __be16 resp; |
2474 |
++ u8 buffer[SI1133_MEASURE_BUFFER_SIZE]; |
2475 |
+ |
2476 |
+ err = si1133_set_adcmux(data, 0, chan->channel); |
2477 |
+ if (err) |
2478 |
+@@ -625,12 +628,13 @@ static int si1133_measure(struct si1133_data *data, |
2479 |
+ if (err) |
2480 |
+ return err; |
2481 |
+ |
2482 |
+- err = si1133_bulk_read(data, SI1133_REG_HOSTOUT(0), sizeof(resp), |
2483 |
+- (u8 *)&resp); |
2484 |
++ err = si1133_bulk_read(data, SI1133_REG_HOSTOUT(0), sizeof(buffer), |
2485 |
++ buffer); |
2486 |
+ if (err) |
2487 |
+ return err; |
2488 |
+ |
2489 |
+- *val = be16_to_cpu(resp); |
2490 |
++ *val = sign_extend32((buffer[0] << 16) | (buffer[1] << 8) | buffer[2], |
2491 |
++ SI1133_SIGN_BIT_INDEX); |
2492 |
+ |
2493 |
+ return err; |
2494 |
+ } |
2495 |
+@@ -704,9 +708,9 @@ static int si1133_get_lux(struct si1133_data *data, int *val) |
2496 |
+ { |
2497 |
+ int err; |
2498 |
+ int lux; |
2499 |
+- u32 high_vis; |
2500 |
+- u32 low_vis; |
2501 |
+- u32 ir; |
2502 |
++ s32 high_vis; |
2503 |
++ s32 low_vis; |
2504 |
++ s32 ir; |
2505 |
+ u8 buffer[SI1133_LUX_BUFFER_SIZE]; |
2506 |
+ |
2507 |
+ /* Activate lux channels */ |
2508 |
+@@ -719,9 +723,16 @@ static int si1133_get_lux(struct si1133_data *data, int *val) |
2509 |
+ if (err) |
2510 |
+ return err; |
2511 |
+ |
2512 |
+- high_vis = (buffer[0] << 16) | (buffer[1] << 8) | buffer[2]; |
2513 |
+- low_vis = (buffer[3] << 16) | (buffer[4] << 8) | buffer[5]; |
2514 |
+- ir = (buffer[6] << 16) | (buffer[7] << 8) | buffer[8]; |
2515 |
++ high_vis = |
2516 |
++ sign_extend32((buffer[0] << 16) | (buffer[1] << 8) | buffer[2], |
2517 |
++ SI1133_SIGN_BIT_INDEX); |
2518 |
++ |
2519 |
++ low_vis = |
2520 |
++ sign_extend32((buffer[3] << 16) | (buffer[4] << 8) | buffer[5], |
2521 |
++ SI1133_SIGN_BIT_INDEX); |
2522 |
++ |
2523 |
++ ir = sign_extend32((buffer[6] << 16) | (buffer[7] << 8) | buffer[8], |
2524 |
++ SI1133_SIGN_BIT_INDEX); |
2525 |
+ |
2526 |
+ if (high_vis > SI1133_ADC_THRESHOLD || ir > SI1133_ADC_THRESHOLD) |
2527 |
+ lux = si1133_calc_polynomial(high_vis, ir, |
2528 |
+diff --git a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig |
2529 |
+index d2fade984999..25149544d57c 100644 |
2530 |
+--- a/drivers/iommu/Kconfig |
2531 |
++++ b/drivers/iommu/Kconfig |
2532 |
+@@ -188,6 +188,7 @@ config INTEL_IOMMU |
2533 |
+ select NEED_DMA_MAP_STATE |
2534 |
+ select DMAR_TABLE |
2535 |
+ select SWIOTLB |
2536 |
++ select IOASID |
2537 |
+ help |
2538 |
+ DMA remapping (DMAR) devices support enables independent address |
2539 |
+ translations for Direct Memory Access (DMA) from devices. |
2540 |
+diff --git a/drivers/iommu/amd_iommu_types.h b/drivers/iommu/amd_iommu_types.h |
2541 |
+index f8d01d6b00da..ca8c4522045b 100644 |
2542 |
+--- a/drivers/iommu/amd_iommu_types.h |
2543 |
++++ b/drivers/iommu/amd_iommu_types.h |
2544 |
+@@ -348,7 +348,7 @@ |
2545 |
+ |
2546 |
+ #define DTE_GCR3_VAL_A(x) (((x) >> 12) & 0x00007ULL) |
2547 |
+ #define DTE_GCR3_VAL_B(x) (((x) >> 15) & 0x0ffffULL) |
2548 |
+-#define DTE_GCR3_VAL_C(x) (((x) >> 31) & 0xfffffULL) |
2549 |
++#define DTE_GCR3_VAL_C(x) (((x) >> 31) & 0x1fffffULL) |
2550 |
+ |
2551 |
+ #define DTE_GCR3_INDEX_A 0 |
2552 |
+ #define DTE_GCR3_INDEX_B 1 |
2553 |
+diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c |
2554 |
+index 4be549478691..ef0a5246700e 100644 |
2555 |
+--- a/drivers/iommu/intel-iommu.c |
2556 |
++++ b/drivers/iommu/intel-iommu.c |
2557 |
+@@ -4501,7 +4501,8 @@ static struct dmar_atsr_unit *dmar_find_atsr(struct acpi_dmar_atsr *atsr) |
2558 |
+ struct dmar_atsr_unit *atsru; |
2559 |
+ struct acpi_dmar_atsr *tmp; |
2560 |
+ |
2561 |
+- list_for_each_entry_rcu(atsru, &dmar_atsr_units, list) { |
2562 |
++ list_for_each_entry_rcu(atsru, &dmar_atsr_units, list, |
2563 |
++ dmar_rcu_check()) { |
2564 |
+ tmp = (struct acpi_dmar_atsr *)atsru->hdr; |
2565 |
+ if (atsr->segment != tmp->segment) |
2566 |
+ continue; |
2567 |
+diff --git a/drivers/iommu/intel-svm.c b/drivers/iommu/intel-svm.c |
2568 |
+index d7f2a5358900..2998418f0a38 100644 |
2569 |
+--- a/drivers/iommu/intel-svm.c |
2570 |
++++ b/drivers/iommu/intel-svm.c |
2571 |
+@@ -531,7 +531,7 @@ struct page_req_dsc { |
2572 |
+ u64 priv_data[2]; |
2573 |
+ }; |
2574 |
+ |
2575 |
+-#define PRQ_RING_MASK ((0x1000 << PRQ_ORDER) - 0x10) |
2576 |
++#define PRQ_RING_MASK ((0x1000 << PRQ_ORDER) - 0x20) |
2577 |
+ |
2578 |
+ static bool access_error(struct vm_area_struct *vma, struct page_req_dsc *req) |
2579 |
+ { |
2580 |
+@@ -611,14 +611,15 @@ static irqreturn_t prq_event_thread(int irq, void *d) |
2581 |
+ * any faults on kernel addresses. */ |
2582 |
+ if (!svm->mm) |
2583 |
+ goto bad_req; |
2584 |
+- /* If the mm is already defunct, don't handle faults. */ |
2585 |
+- if (!mmget_not_zero(svm->mm)) |
2586 |
+- goto bad_req; |
2587 |
+ |
2588 |
+ /* If address is not canonical, return invalid response */ |
2589 |
+ if (!is_canonical_address(address)) |
2590 |
+ goto bad_req; |
2591 |
+ |
2592 |
++ /* If the mm is already defunct, don't handle faults. */ |
2593 |
++ if (!mmget_not_zero(svm->mm)) |
2594 |
++ goto bad_req; |
2595 |
++ |
2596 |
+ down_read(&svm->mm->mmap_sem); |
2597 |
+ vma = find_extend_vma(svm->mm, address); |
2598 |
+ if (!vma || address < vma->vm_start) |
2599 |
+diff --git a/drivers/iommu/virtio-iommu.c b/drivers/iommu/virtio-iommu.c |
2600 |
+index cce329d71fba..5eed75cd121f 100644 |
2601 |
+--- a/drivers/iommu/virtio-iommu.c |
2602 |
++++ b/drivers/iommu/virtio-iommu.c |
2603 |
+@@ -613,18 +613,20 @@ static int viommu_domain_finalise(struct viommu_dev *viommu, |
2604 |
+ int ret; |
2605 |
+ struct viommu_domain *vdomain = to_viommu_domain(domain); |
2606 |
+ |
2607 |
+- vdomain->viommu = viommu; |
2608 |
+- vdomain->map_flags = viommu->map_flags; |
2609 |
++ ret = ida_alloc_range(&viommu->domain_ids, viommu->first_domain, |
2610 |
++ viommu->last_domain, GFP_KERNEL); |
2611 |
++ if (ret < 0) |
2612 |
++ return ret; |
2613 |
++ |
2614 |
++ vdomain->id = (unsigned int)ret; |
2615 |
+ |
2616 |
+ domain->pgsize_bitmap = viommu->pgsize_bitmap; |
2617 |
+ domain->geometry = viommu->geometry; |
2618 |
+ |
2619 |
+- ret = ida_alloc_range(&viommu->domain_ids, viommu->first_domain, |
2620 |
+- viommu->last_domain, GFP_KERNEL); |
2621 |
+- if (ret >= 0) |
2622 |
+- vdomain->id = (unsigned int)ret; |
2623 |
++ vdomain->map_flags = viommu->map_flags; |
2624 |
++ vdomain->viommu = viommu; |
2625 |
+ |
2626 |
+- return ret > 0 ? 0 : ret; |
2627 |
++ return 0; |
2628 |
+ } |
2629 |
+ |
2630 |
+ static void viommu_domain_free(struct iommu_domain *domain) |
2631 |
+diff --git a/drivers/irqchip/irq-mbigen.c b/drivers/irqchip/irq-mbigen.c |
2632 |
+index 6b566bba263b..ff7627b57772 100644 |
2633 |
+--- a/drivers/irqchip/irq-mbigen.c |
2634 |
++++ b/drivers/irqchip/irq-mbigen.c |
2635 |
+@@ -220,10 +220,16 @@ static int mbigen_irq_domain_alloc(struct irq_domain *domain, |
2636 |
+ return 0; |
2637 |
+ } |
2638 |
+ |
2639 |
++static void mbigen_irq_domain_free(struct irq_domain *domain, unsigned int virq, |
2640 |
++ unsigned int nr_irqs) |
2641 |
++{ |
2642 |
++ platform_msi_domain_free(domain, virq, nr_irqs); |
2643 |
++} |
2644 |
++ |
2645 |
+ static const struct irq_domain_ops mbigen_domain_ops = { |
2646 |
+ .translate = mbigen_domain_translate, |
2647 |
+ .alloc = mbigen_irq_domain_alloc, |
2648 |
+- .free = irq_domain_free_irqs_common, |
2649 |
++ .free = mbigen_irq_domain_free, |
2650 |
+ }; |
2651 |
+ |
2652 |
+ static int mbigen_of_create_domain(struct platform_device *pdev, |
2653 |
+diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c |
2654 |
+index 1fc40e8af75e..3363a6551a70 100644 |
2655 |
+--- a/drivers/leds/led-class.c |
2656 |
++++ b/drivers/leds/led-class.c |
2657 |
+@@ -376,7 +376,7 @@ int led_classdev_register_ext(struct device *parent, |
2658 |
+ |
2659 |
+ if (ret) |
2660 |
+ dev_warn(parent, "Led %s renamed to %s due to name collision", |
2661 |
+- led_cdev->name, dev_name(led_cdev->dev)); |
2662 |
++ proposed_name, dev_name(led_cdev->dev)); |
2663 |
+ |
2664 |
+ if (led_cdev->flags & LED_BRIGHT_HW_CHANGED) { |
2665 |
+ ret = led_add_brightness_hw_changed(led_cdev); |
2666 |
+diff --git a/drivers/memory/tegra/tegra124-emc.c b/drivers/memory/tegra/tegra124-emc.c |
2667 |
+index 21f05240682b..33b8216bac30 100644 |
2668 |
+--- a/drivers/memory/tegra/tegra124-emc.c |
2669 |
++++ b/drivers/memory/tegra/tegra124-emc.c |
2670 |
+@@ -1158,6 +1158,11 @@ static void emc_debugfs_init(struct device *dev, struct tegra_emc *emc) |
2671 |
+ emc->debugfs.max_rate = emc->timings[i].rate; |
2672 |
+ } |
2673 |
+ |
2674 |
++ if (!emc->num_timings) { |
2675 |
++ emc->debugfs.min_rate = clk_get_rate(emc->clk); |
2676 |
++ emc->debugfs.max_rate = emc->debugfs.min_rate; |
2677 |
++ } |
2678 |
++ |
2679 |
+ err = clk_set_rate_range(emc->clk, emc->debugfs.min_rate, |
2680 |
+ emc->debugfs.max_rate); |
2681 |
+ if (err < 0) { |
2682 |
+diff --git a/drivers/memory/tegra/tegra20-emc.c b/drivers/memory/tegra/tegra20-emc.c |
2683 |
+index 8ae474d9bfb9..b16715e9515d 100644 |
2684 |
+--- a/drivers/memory/tegra/tegra20-emc.c |
2685 |
++++ b/drivers/memory/tegra/tegra20-emc.c |
2686 |
+@@ -628,6 +628,11 @@ static void tegra_emc_debugfs_init(struct tegra_emc *emc) |
2687 |
+ emc->debugfs.max_rate = emc->timings[i].rate; |
2688 |
+ } |
2689 |
+ |
2690 |
++ if (!emc->num_timings) { |
2691 |
++ emc->debugfs.min_rate = clk_get_rate(emc->clk); |
2692 |
++ emc->debugfs.max_rate = emc->debugfs.min_rate; |
2693 |
++ } |
2694 |
++ |
2695 |
+ err = clk_set_rate_range(emc->clk, emc->debugfs.min_rate, |
2696 |
+ emc->debugfs.max_rate); |
2697 |
+ if (err < 0) { |
2698 |
+diff --git a/drivers/memory/tegra/tegra30-emc.c b/drivers/memory/tegra/tegra30-emc.c |
2699 |
+index e3efd9529506..b42bdb667e85 100644 |
2700 |
+--- a/drivers/memory/tegra/tegra30-emc.c |
2701 |
++++ b/drivers/memory/tegra/tegra30-emc.c |
2702 |
+@@ -1256,6 +1256,11 @@ static void tegra_emc_debugfs_init(struct tegra_emc *emc) |
2703 |
+ emc->debugfs.max_rate = emc->timings[i].rate; |
2704 |
+ } |
2705 |
+ |
2706 |
++ if (!emc->num_timings) { |
2707 |
++ emc->debugfs.min_rate = clk_get_rate(emc->clk); |
2708 |
++ emc->debugfs.max_rate = emc->debugfs.min_rate; |
2709 |
++ } |
2710 |
++ |
2711 |
+ err = clk_set_rate_range(emc->clk, emc->debugfs.min_rate, |
2712 |
+ emc->debugfs.max_rate); |
2713 |
+ if (err < 0) { |
2714 |
+diff --git a/drivers/mfd/cros_ec_dev.c b/drivers/mfd/cros_ec_dev.c |
2715 |
+index 39e611695053..32c2b912b58b 100644 |
2716 |
+--- a/drivers/mfd/cros_ec_dev.c |
2717 |
++++ b/drivers/mfd/cros_ec_dev.c |
2718 |
+@@ -211,7 +211,7 @@ static int ec_device_probe(struct platform_device *pdev) |
2719 |
+ * explicitly added on platforms that don't have the PD notifier ACPI |
2720 |
+ * device entry defined. |
2721 |
+ */ |
2722 |
+- if (IS_ENABLED(CONFIG_OF)) { |
2723 |
++ if (IS_ENABLED(CONFIG_OF) && ec->ec_dev->dev->of_node) { |
2724 |
+ if (cros_ec_check_features(ec, EC_FEATURE_USB_PD)) { |
2725 |
+ retval = mfd_add_hotplug_devices(ec->dev, |
2726 |
+ cros_usbpd_notify_cells, |
2727 |
+diff --git a/drivers/mtd/devices/phram.c b/drivers/mtd/devices/phram.c |
2728 |
+index 931e5c2481b5..b50ec7ecd10c 100644 |
2729 |
+--- a/drivers/mtd/devices/phram.c |
2730 |
++++ b/drivers/mtd/devices/phram.c |
2731 |
+@@ -243,22 +243,25 @@ static int phram_setup(const char *val) |
2732 |
+ |
2733 |
+ ret = parse_num64(&start, token[1]); |
2734 |
+ if (ret) { |
2735 |
+- kfree(name); |
2736 |
+ parse_err("illegal start address\n"); |
2737 |
++ goto error; |
2738 |
+ } |
2739 |
+ |
2740 |
+ ret = parse_num64(&len, token[2]); |
2741 |
+ if (ret) { |
2742 |
+- kfree(name); |
2743 |
+ parse_err("illegal device length\n"); |
2744 |
++ goto error; |
2745 |
+ } |
2746 |
+ |
2747 |
+ ret = register_device(name, start, len); |
2748 |
+- if (!ret) |
2749 |
+- pr_info("%s device: %#llx at %#llx\n", name, len, start); |
2750 |
+- else |
2751 |
+- kfree(name); |
2752 |
++ if (ret) |
2753 |
++ goto error; |
2754 |
++ |
2755 |
++ pr_info("%s device: %#llx at %#llx\n", name, len, start); |
2756 |
++ return 0; |
2757 |
+ |
2758 |
++error: |
2759 |
++ kfree(name); |
2760 |
+ return ret; |
2761 |
+ } |
2762 |
+ |
2763 |
+diff --git a/drivers/mtd/lpddr/lpddr_cmds.c b/drivers/mtd/lpddr/lpddr_cmds.c |
2764 |
+index 1efc643c9871..9341a8a592e8 100644 |
2765 |
+--- a/drivers/mtd/lpddr/lpddr_cmds.c |
2766 |
++++ b/drivers/mtd/lpddr/lpddr_cmds.c |
2767 |
+@@ -68,7 +68,6 @@ struct mtd_info *lpddr_cmdset(struct map_info *map) |
2768 |
+ shared = kmalloc_array(lpddr->numchips, sizeof(struct flchip_shared), |
2769 |
+ GFP_KERNEL); |
2770 |
+ if (!shared) { |
2771 |
+- kfree(lpddr); |
2772 |
+ kfree(mtd); |
2773 |
+ return NULL; |
2774 |
+ } |
2775 |
+diff --git a/drivers/mtd/nand/raw/nand_base.c b/drivers/mtd/nand/raw/nand_base.c |
2776 |
+index f64e3b6605c6..47c63968fa45 100644 |
2777 |
+--- a/drivers/mtd/nand/raw/nand_base.c |
2778 |
++++ b/drivers/mtd/nand/raw/nand_base.c |
2779 |
+@@ -5907,6 +5907,8 @@ void nand_cleanup(struct nand_chip *chip) |
2780 |
+ chip->ecc.algo == NAND_ECC_BCH) |
2781 |
+ nand_bch_free((struct nand_bch_control *)chip->ecc.priv); |
2782 |
+ |
2783 |
++ nanddev_cleanup(&chip->base); |
2784 |
++ |
2785 |
+ /* Free bad block table memory */ |
2786 |
+ kfree(chip->bbt); |
2787 |
+ kfree(chip->data_buf); |
2788 |
+diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c |
2789 |
+index 5750c45019d8..8dda51bbdd11 100644 |
2790 |
+--- a/drivers/mtd/nand/spi/core.c |
2791 |
++++ b/drivers/mtd/nand/spi/core.c |
2792 |
+@@ -609,6 +609,7 @@ static int spinand_markbad(struct nand_device *nand, const struct nand_pos *pos) |
2793 |
+ .ooboffs = 0, |
2794 |
+ .ooblen = sizeof(marker), |
2795 |
+ .oobbuf.out = marker, |
2796 |
++ .mode = MTD_OPS_RAW, |
2797 |
+ }; |
2798 |
+ int ret; |
2799 |
+ |
2800 |
+diff --git a/drivers/net/dsa/bcm_sf2_cfp.c b/drivers/net/dsa/bcm_sf2_cfp.c |
2801 |
+index 1962c8330daa..f9785027c096 100644 |
2802 |
+--- a/drivers/net/dsa/bcm_sf2_cfp.c |
2803 |
++++ b/drivers/net/dsa/bcm_sf2_cfp.c |
2804 |
+@@ -882,17 +882,14 @@ static int bcm_sf2_cfp_rule_set(struct dsa_switch *ds, int port, |
2805 |
+ fs->m_ext.data[1])) |
2806 |
+ return -EINVAL; |
2807 |
+ |
2808 |
+- if (fs->location != RX_CLS_LOC_ANY && fs->location >= CFP_NUM_RULES) |
2809 |
++ if (fs->location != RX_CLS_LOC_ANY && |
2810 |
++ fs->location > bcm_sf2_cfp_rule_size(priv)) |
2811 |
+ return -EINVAL; |
2812 |
+ |
2813 |
+ if (fs->location != RX_CLS_LOC_ANY && |
2814 |
+ test_bit(fs->location, priv->cfp.used)) |
2815 |
+ return -EBUSY; |
2816 |
+ |
2817 |
+- if (fs->location != RX_CLS_LOC_ANY && |
2818 |
+- fs->location > bcm_sf2_cfp_rule_size(priv)) |
2819 |
+- return -EINVAL; |
2820 |
+- |
2821 |
+ ret = bcm_sf2_cfp_rule_cmp(priv, port, fs); |
2822 |
+ if (ret == 0) |
2823 |
+ return -EEXIST; |
2824 |
+@@ -973,7 +970,7 @@ static int bcm_sf2_cfp_rule_del(struct bcm_sf2_priv *priv, int port, u32 loc) |
2825 |
+ struct cfp_rule *rule; |
2826 |
+ int ret; |
2827 |
+ |
2828 |
+- if (loc >= CFP_NUM_RULES) |
2829 |
++ if (loc > bcm_sf2_cfp_rule_size(priv)) |
2830 |
+ return -EINVAL; |
2831 |
+ |
2832 |
+ /* Refuse deleting unused rules, and those that are not unique since |
2833 |
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c |
2834 |
+index d2cfa247abc8..9710cdecb63a 100644 |
2835 |
+--- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c |
2836 |
++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c |
2837 |
+@@ -1535,6 +1535,10 @@ static int mlx5e_set_fecparam(struct net_device *netdev, |
2838 |
+ int mode; |
2839 |
+ int err; |
2840 |
+ |
2841 |
++ if (bitmap_weight((unsigned long *)&fecparam->fec, |
2842 |
++ ETHTOOL_FEC_BASER_BIT + 1) > 1) |
2843 |
++ return -EOPNOTSUPP; |
2844 |
++ |
2845 |
+ for (mode = 0; mode < ARRAY_SIZE(pplm_fec_2_ethtool); mode++) { |
2846 |
+ if (!(pplm_fec_2_ethtool[mode] & fecparam->fec)) |
2847 |
+ continue; |
2848 |
+diff --git a/drivers/net/macsec.c b/drivers/net/macsec.c |
2849 |
+index 061aada4748a..9b4ae5c36da6 100644 |
2850 |
+--- a/drivers/net/macsec.c |
2851 |
++++ b/drivers/net/macsec.c |
2852 |
+@@ -2398,6 +2398,9 @@ static int macsec_upd_offload(struct sk_buff *skb, struct genl_info *info) |
2853 |
+ return PTR_ERR(dev); |
2854 |
+ macsec = macsec_priv(dev); |
2855 |
+ |
2856 |
++ if (!tb_offload[MACSEC_OFFLOAD_ATTR_TYPE]) |
2857 |
++ return -EINVAL; |
2858 |
++ |
2859 |
+ offload = nla_get_u8(tb_offload[MACSEC_OFFLOAD_ATTR_TYPE]); |
2860 |
+ if (macsec->offload == offload) |
2861 |
+ return 0; |
2862 |
+diff --git a/drivers/nvdimm/bus.c b/drivers/nvdimm/bus.c |
2863 |
+index a8b515968569..09087c38fabd 100644 |
2864 |
+--- a/drivers/nvdimm/bus.c |
2865 |
++++ b/drivers/nvdimm/bus.c |
2866 |
+@@ -1042,8 +1042,10 @@ static int __nd_ioctl(struct nvdimm_bus *nvdimm_bus, struct nvdimm *nvdimm, |
2867 |
+ return -EFAULT; |
2868 |
+ } |
2869 |
+ |
2870 |
+- if (!desc || (desc->out_num + desc->in_num == 0) || |
2871 |
+- !test_bit(cmd, &cmd_mask)) |
2872 |
++ if (!desc || |
2873 |
++ (desc->out_num + desc->in_num == 0) || |
2874 |
++ cmd > ND_CMD_CALL || |
2875 |
++ !test_bit(cmd, &cmd_mask)) |
2876 |
+ return -ENOTTY; |
2877 |
+ |
2878 |
+ /* fail write commands (when read-only) */ |
2879 |
+diff --git a/drivers/of/overlay.c b/drivers/of/overlay.c |
2880 |
+index c9219fddf44b..50bbe0edf538 100644 |
2881 |
+--- a/drivers/of/overlay.c |
2882 |
++++ b/drivers/of/overlay.c |
2883 |
+@@ -261,6 +261,8 @@ static struct property *dup_and_fixup_symbol_prop( |
2884 |
+ |
2885 |
+ of_property_set_flag(new_prop, OF_DYNAMIC); |
2886 |
+ |
2887 |
++ kfree(target_path); |
2888 |
++ |
2889 |
+ return new_prop; |
2890 |
+ |
2891 |
+ err_free_new_prop: |
2892 |
+diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c |
2893 |
+index 68b87587b2ef..7199aaafd304 100644 |
2894 |
+--- a/drivers/of/unittest.c |
2895 |
++++ b/drivers/of/unittest.c |
2896 |
+@@ -777,6 +777,10 @@ static void __init of_unittest_changeset(void) |
2897 |
+ unittest(!of_changeset_revert(&chgset), "revert failed\n"); |
2898 |
+ |
2899 |
+ of_changeset_destroy(&chgset); |
2900 |
++ |
2901 |
++ of_node_put(n1); |
2902 |
++ of_node_put(n2); |
2903 |
++ of_node_put(n21); |
2904 |
+ #endif |
2905 |
+ } |
2906 |
+ |
2907 |
+@@ -1151,10 +1155,13 @@ static void __init of_unittest_platform_populate(void) |
2908 |
+ |
2909 |
+ of_platform_populate(np, match, NULL, &test_bus->dev); |
2910 |
+ for_each_child_of_node(np, child) { |
2911 |
+- for_each_child_of_node(child, grandchild) |
2912 |
+- unittest(of_find_device_by_node(grandchild), |
2913 |
++ for_each_child_of_node(child, grandchild) { |
2914 |
++ pdev = of_find_device_by_node(grandchild); |
2915 |
++ unittest(pdev, |
2916 |
+ "Could not create device for node '%pOFn'\n", |
2917 |
+ grandchild); |
2918 |
++ of_dev_put(pdev); |
2919 |
++ } |
2920 |
+ } |
2921 |
+ |
2922 |
+ of_platform_depopulate(&test_bus->dev); |
2923 |
+@@ -2564,8 +2571,11 @@ static __init void of_unittest_overlay_high_level(void) |
2924 |
+ goto err_unlock; |
2925 |
+ } |
2926 |
+ if (__of_add_property(of_symbols, new_prop)) { |
2927 |
++ kfree(new_prop->name); |
2928 |
++ kfree(new_prop->value); |
2929 |
++ kfree(new_prop); |
2930 |
+ /* "name" auto-generated by unflatten */ |
2931 |
+- if (!strcmp(new_prop->name, "name")) |
2932 |
++ if (!strcmp(prop->name, "name")) |
2933 |
+ continue; |
2934 |
+ unittest(0, "duplicate property '%s' in overlay_base node __symbols__", |
2935 |
+ prop->name); |
2936 |
+diff --git a/drivers/phy/socionext/phy-uniphier-usb3ss.c b/drivers/phy/socionext/phy-uniphier-usb3ss.c |
2937 |
+index ec231e40ef2a..a7577e316baf 100644 |
2938 |
+--- a/drivers/phy/socionext/phy-uniphier-usb3ss.c |
2939 |
++++ b/drivers/phy/socionext/phy-uniphier-usb3ss.c |
2940 |
+@@ -314,6 +314,10 @@ static const struct of_device_id uniphier_u3ssphy_match[] = { |
2941 |
+ .compatible = "socionext,uniphier-pro4-usb3-ssphy", |
2942 |
+ .data = &uniphier_pro4_data, |
2943 |
+ }, |
2944 |
++ { |
2945 |
++ .compatible = "socionext,uniphier-pro5-usb3-ssphy", |
2946 |
++ .data = &uniphier_pro4_data, |
2947 |
++ }, |
2948 |
+ { |
2949 |
+ .compatible = "socionext,uniphier-pxs2-usb3-ssphy", |
2950 |
+ .data = &uniphier_pxs2_data, |
2951 |
+diff --git a/drivers/platform/chrome/cros_ec.c b/drivers/platform/chrome/cros_ec.c |
2952 |
+index 6fc8f2c3ac51..7ee43b2e0654 100644 |
2953 |
+--- a/drivers/platform/chrome/cros_ec.c |
2954 |
++++ b/drivers/platform/chrome/cros_ec.c |
2955 |
+@@ -138,6 +138,24 @@ static int cros_ec_sleep_event(struct cros_ec_device *ec_dev, u8 sleep_event) |
2956 |
+ return ret; |
2957 |
+ } |
2958 |
+ |
2959 |
++static int cros_ec_ready_event(struct notifier_block *nb, |
2960 |
++ unsigned long queued_during_suspend, |
2961 |
++ void *_notify) |
2962 |
++{ |
2963 |
++ struct cros_ec_device *ec_dev = container_of(nb, struct cros_ec_device, |
2964 |
++ notifier_ready); |
2965 |
++ u32 host_event = cros_ec_get_host_event(ec_dev); |
2966 |
++ |
2967 |
++ if (host_event & EC_HOST_EVENT_MASK(EC_HOST_EVENT_INTERFACE_READY)) { |
2968 |
++ mutex_lock(&ec_dev->lock); |
2969 |
++ cros_ec_query_all(ec_dev); |
2970 |
++ mutex_unlock(&ec_dev->lock); |
2971 |
++ return NOTIFY_OK; |
2972 |
++ } |
2973 |
++ |
2974 |
++ return NOTIFY_DONE; |
2975 |
++} |
2976 |
++ |
2977 |
+ /** |
2978 |
+ * cros_ec_register() - Register a new ChromeOS EC, using the provided info. |
2979 |
+ * @ec_dev: Device to register. |
2980 |
+@@ -237,6 +255,18 @@ int cros_ec_register(struct cros_ec_device *ec_dev) |
2981 |
+ dev_dbg(ec_dev->dev, "Error %d clearing sleep event to ec", |
2982 |
+ err); |
2983 |
+ |
2984 |
++ if (ec_dev->mkbp_event_supported) { |
2985 |
++ /* |
2986 |
++ * Register the notifier for EC_HOST_EVENT_INTERFACE_READY |
2987 |
++ * event. |
2988 |
++ */ |
2989 |
++ ec_dev->notifier_ready.notifier_call = cros_ec_ready_event; |
2990 |
++ err = blocking_notifier_chain_register(&ec_dev->event_notifier, |
2991 |
++ &ec_dev->notifier_ready); |
2992 |
++ if (err) |
2993 |
++ return err; |
2994 |
++ } |
2995 |
++ |
2996 |
+ dev_info(dev, "Chrome EC device registered\n"); |
2997 |
+ |
2998 |
+ return 0; |
2999 |
+diff --git a/drivers/platform/x86/intel-hid.c b/drivers/platform/x86/intel-hid.c |
3000 |
+index 43d590250228..9c0e6e0fabdf 100644 |
3001 |
+--- a/drivers/platform/x86/intel-hid.c |
3002 |
++++ b/drivers/platform/x86/intel-hid.c |
3003 |
+@@ -19,8 +19,8 @@ MODULE_LICENSE("GPL"); |
3004 |
+ MODULE_AUTHOR("Alex Hung"); |
3005 |
+ |
3006 |
+ static const struct acpi_device_id intel_hid_ids[] = { |
3007 |
+- {"INT1051", 0}, |
3008 |
+ {"INT33D5", 0}, |
3009 |
++ {"INTC1051", 0}, |
3010 |
+ {"", 0}, |
3011 |
+ }; |
3012 |
+ |
3013 |
+diff --git a/drivers/power/supply/axp288_fuel_gauge.c b/drivers/power/supply/axp288_fuel_gauge.c |
3014 |
+index e1bc4e6e6f30..f40fa0e63b6e 100644 |
3015 |
+--- a/drivers/power/supply/axp288_fuel_gauge.c |
3016 |
++++ b/drivers/power/supply/axp288_fuel_gauge.c |
3017 |
+@@ -706,14 +706,14 @@ static const struct dmi_system_id axp288_fuel_gauge_blacklist[] = { |
3018 |
+ { |
3019 |
+ /* Intel Cherry Trail Compute Stick, Windows version */ |
3020 |
+ .matches = { |
3021 |
+- DMI_MATCH(DMI_SYS_VENDOR, "Intel Corporation"), |
3022 |
++ DMI_MATCH(DMI_SYS_VENDOR, "Intel"), |
3023 |
+ DMI_MATCH(DMI_PRODUCT_NAME, "STK1AW32SC"), |
3024 |
+ }, |
3025 |
+ }, |
3026 |
+ { |
3027 |
+ /* Intel Cherry Trail Compute Stick, version without an OS */ |
3028 |
+ .matches = { |
3029 |
+- DMI_MATCH(DMI_SYS_VENDOR, "Intel Corporation"), |
3030 |
++ DMI_MATCH(DMI_SYS_VENDOR, "Intel"), |
3031 |
+ DMI_MATCH(DMI_PRODUCT_NAME, "STK1A32SC"), |
3032 |
+ }, |
3033 |
+ }, |
3034 |
+diff --git a/drivers/power/supply/bq27xxx_battery.c b/drivers/power/supply/bq27xxx_battery.c |
3035 |
+index 195c18c2f426..664e50103eaa 100644 |
3036 |
+--- a/drivers/power/supply/bq27xxx_battery.c |
3037 |
++++ b/drivers/power/supply/bq27xxx_battery.c |
3038 |
+@@ -1885,7 +1885,10 @@ int bq27xxx_battery_setup(struct bq27xxx_device_info *di) |
3039 |
+ |
3040 |
+ di->bat = power_supply_register_no_ws(di->dev, psy_desc, &psy_cfg); |
3041 |
+ if (IS_ERR(di->bat)) { |
3042 |
+- dev_err(di->dev, "failed to register battery\n"); |
3043 |
++ if (PTR_ERR(di->bat) == -EPROBE_DEFER) |
3044 |
++ dev_dbg(di->dev, "failed to register battery, deferring probe\n"); |
3045 |
++ else |
3046 |
++ dev_err(di->dev, "failed to register battery\n"); |
3047 |
+ return PTR_ERR(di->bat); |
3048 |
+ } |
3049 |
+ |
3050 |
+diff --git a/drivers/rtc/rtc-88pm860x.c b/drivers/rtc/rtc-88pm860x.c |
3051 |
+index 4743b16a8d84..1526402e126b 100644 |
3052 |
+--- a/drivers/rtc/rtc-88pm860x.c |
3053 |
++++ b/drivers/rtc/rtc-88pm860x.c |
3054 |
+@@ -336,6 +336,10 @@ static int pm860x_rtc_probe(struct platform_device *pdev) |
3055 |
+ info->dev = &pdev->dev; |
3056 |
+ dev_set_drvdata(&pdev->dev, info); |
3057 |
+ |
3058 |
++ info->rtc_dev = devm_rtc_allocate_device(&pdev->dev); |
3059 |
++ if (IS_ERR(info->rtc_dev)) |
3060 |
++ return PTR_ERR(info->rtc_dev); |
3061 |
++ |
3062 |
+ ret = devm_request_threaded_irq(&pdev->dev, info->irq, NULL, |
3063 |
+ rtc_update_handler, IRQF_ONESHOT, "rtc", |
3064 |
+ info); |
3065 |
+@@ -377,13 +381,11 @@ static int pm860x_rtc_probe(struct platform_device *pdev) |
3066 |
+ } |
3067 |
+ } |
3068 |
+ |
3069 |
+- info->rtc_dev = devm_rtc_device_register(&pdev->dev, "88pm860x-rtc", |
3070 |
+- &pm860x_rtc_ops, THIS_MODULE); |
3071 |
+- ret = PTR_ERR(info->rtc_dev); |
3072 |
+- if (IS_ERR(info->rtc_dev)) { |
3073 |
+- dev_err(&pdev->dev, "Failed to register RTC device: %d\n", ret); |
3074 |
++ info->rtc_dev->ops = &pm860x_rtc_ops; |
3075 |
++ |
3076 |
++ ret = rtc_register_device(info->rtc_dev); |
3077 |
++ if (ret) |
3078 |
+ return ret; |
3079 |
+- } |
3080 |
+ |
3081 |
+ /* |
3082 |
+ * enable internal XO instead of internal 3.25MHz clock since it can |
3083 |
+diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c |
3084 |
+index 4e6af592f018..9c0ee192f0f9 100644 |
3085 |
+--- a/drivers/scsi/sg.c |
3086 |
++++ b/drivers/scsi/sg.c |
3087 |
+@@ -793,8 +793,10 @@ sg_common_write(Sg_fd * sfp, Sg_request * srp, |
3088 |
+ "sg_common_write: scsi opcode=0x%02x, cmd_size=%d\n", |
3089 |
+ (int) cmnd[0], (int) hp->cmd_len)); |
3090 |
+ |
3091 |
+- if (hp->dxfer_len >= SZ_256M) |
3092 |
++ if (hp->dxfer_len >= SZ_256M) { |
3093 |
++ sg_remove_request(sfp, srp); |
3094 |
+ return -EINVAL; |
3095 |
++ } |
3096 |
+ |
3097 |
+ k = sg_start_req(srp, cmnd); |
3098 |
+ if (k) { |
3099 |
+diff --git a/drivers/soc/imx/gpc.c b/drivers/soc/imx/gpc.c |
3100 |
+index 98b9d9a902ae..90a8b2c0676f 100644 |
3101 |
+--- a/drivers/soc/imx/gpc.c |
3102 |
++++ b/drivers/soc/imx/gpc.c |
3103 |
+@@ -87,8 +87,8 @@ static int imx6_pm_domain_power_off(struct generic_pm_domain *genpd) |
3104 |
+ static int imx6_pm_domain_power_on(struct generic_pm_domain *genpd) |
3105 |
+ { |
3106 |
+ struct imx_pm_domain *pd = to_imx_pm_domain(genpd); |
3107 |
+- int i, ret, sw, sw2iso; |
3108 |
+- u32 val; |
3109 |
++ int i, ret; |
3110 |
++ u32 val, req; |
3111 |
+ |
3112 |
+ if (pd->supply) { |
3113 |
+ ret = regulator_enable(pd->supply); |
3114 |
+@@ -107,17 +107,18 @@ static int imx6_pm_domain_power_on(struct generic_pm_domain *genpd) |
3115 |
+ regmap_update_bits(pd->regmap, pd->reg_offs + GPC_PGC_CTRL_OFFS, |
3116 |
+ 0x1, 0x1); |
3117 |
+ |
3118 |
+- /* Read ISO and ISO2SW power up delays */ |
3119 |
+- regmap_read(pd->regmap, pd->reg_offs + GPC_PGC_PUPSCR_OFFS, &val); |
3120 |
+- sw = val & 0x3f; |
3121 |
+- sw2iso = (val >> 8) & 0x3f; |
3122 |
+- |
3123 |
+ /* Request GPC to power up domain */ |
3124 |
+- val = BIT(pd->cntr_pdn_bit + 1); |
3125 |
+- regmap_update_bits(pd->regmap, GPC_CNTR, val, val); |
3126 |
++ req = BIT(pd->cntr_pdn_bit + 1); |
3127 |
++ regmap_update_bits(pd->regmap, GPC_CNTR, req, req); |
3128 |
+ |
3129 |
+- /* Wait ISO + ISO2SW IPG clock cycles */ |
3130 |
+- udelay(DIV_ROUND_UP(sw + sw2iso, pd->ipg_rate_mhz)); |
3131 |
++ /* Wait for the PGC to handle the request */ |
3132 |
++ ret = regmap_read_poll_timeout(pd->regmap, GPC_CNTR, val, !(val & req), |
3133 |
++ 1, 50); |
3134 |
++ if (ret) |
3135 |
++ pr_err("powerup request on domain %s timed out\n", genpd->name); |
3136 |
++ |
3137 |
++ /* Wait for reset to propagate through peripherals */ |
3138 |
++ usleep_range(5, 10); |
3139 |
+ |
3140 |
+ /* Disable reset clocks for all devices in the domain */ |
3141 |
+ for (i = 0; i < pd->num_clks; i++) |
3142 |
+@@ -343,6 +344,7 @@ static const struct regmap_config imx_gpc_regmap_config = { |
3143 |
+ .rd_table = &access_table, |
3144 |
+ .wr_table = &access_table, |
3145 |
+ .max_register = 0x2ac, |
3146 |
++ .fast_io = true, |
3147 |
+ }; |
3148 |
+ |
3149 |
+ static struct generic_pm_domain *imx_gpc_onecell_domains[] = { |
3150 |
+diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig |
3151 |
+index 5a05db5438d6..5a0df0e54ce3 100644 |
3152 |
+--- a/drivers/thermal/Kconfig |
3153 |
++++ b/drivers/thermal/Kconfig |
3154 |
+@@ -265,6 +265,7 @@ config QORIQ_THERMAL |
3155 |
+ tristate "QorIQ Thermal Monitoring Unit" |
3156 |
+ depends on THERMAL_OF |
3157 |
+ depends on HAS_IOMEM |
3158 |
++ select REGMAP_MMIO |
3159 |
+ help |
3160 |
+ Support for Thermal Monitoring Unit (TMU) found on QorIQ platforms. |
3161 |
+ It supports one critical trip point and one passive trip point. The |
3162 |
+diff --git a/drivers/thermal/cpufreq_cooling.c b/drivers/thermal/cpufreq_cooling.c |
3163 |
+index fe83d7a210d4..af55ac08e1bd 100644 |
3164 |
+--- a/drivers/thermal/cpufreq_cooling.c |
3165 |
++++ b/drivers/thermal/cpufreq_cooling.c |
3166 |
+@@ -431,6 +431,7 @@ static int cpufreq_set_cur_state(struct thermal_cooling_device *cdev, |
3167 |
+ unsigned long state) |
3168 |
+ { |
3169 |
+ struct cpufreq_cooling_device *cpufreq_cdev = cdev->devdata; |
3170 |
++ int ret; |
3171 |
+ |
3172 |
+ /* Request state should be less than max_level */ |
3173 |
+ if (WARN_ON(state > cpufreq_cdev->max_level)) |
3174 |
+@@ -442,8 +443,9 @@ static int cpufreq_set_cur_state(struct thermal_cooling_device *cdev, |
3175 |
+ |
3176 |
+ cpufreq_cdev->cpufreq_state = state; |
3177 |
+ |
3178 |
+- return freq_qos_update_request(&cpufreq_cdev->qos_req, |
3179 |
+- get_state_freq(cpufreq_cdev, state)); |
3180 |
++ ret = freq_qos_update_request(&cpufreq_cdev->qos_req, |
3181 |
++ get_state_freq(cpufreq_cdev, state)); |
3182 |
++ return ret < 0 ? ret : 0; |
3183 |
+ } |
3184 |
+ |
3185 |
+ /* Bind cpufreq callbacks to thermal cooling device ops */ |
3186 |
+diff --git a/drivers/thermal/qcom/tsens-common.c b/drivers/thermal/qcom/tsens-common.c |
3187 |
+index c8d57ee0a5bb..2cc276cdfcdb 100644 |
3188 |
+--- a/drivers/thermal/qcom/tsens-common.c |
3189 |
++++ b/drivers/thermal/qcom/tsens-common.c |
3190 |
+@@ -602,7 +602,7 @@ int __init init_common(struct tsens_priv *priv) |
3191 |
+ /* DT with separate SROT and TM address space */ |
3192 |
+ priv->tm_offset = 0; |
3193 |
+ res = platform_get_resource(op, IORESOURCE_MEM, 1); |
3194 |
+- srot_base = devm_ioremap_resource(&op->dev, res); |
3195 |
++ srot_base = devm_ioremap_resource(dev, res); |
3196 |
+ if (IS_ERR(srot_base)) { |
3197 |
+ ret = PTR_ERR(srot_base); |
3198 |
+ goto err_put_device; |
3199 |
+@@ -620,7 +620,7 @@ int __init init_common(struct tsens_priv *priv) |
3200 |
+ } |
3201 |
+ |
3202 |
+ res = platform_get_resource(op, IORESOURCE_MEM, 0); |
3203 |
+- tm_base = devm_ioremap_resource(&op->dev, res); |
3204 |
++ tm_base = devm_ioremap_resource(dev, res); |
3205 |
+ if (IS_ERR(tm_base)) { |
3206 |
+ ret = PTR_ERR(tm_base); |
3207 |
+ goto err_put_device; |
3208 |
+@@ -687,8 +687,6 @@ int __init init_common(struct tsens_priv *priv) |
3209 |
+ tsens_enable_irq(priv); |
3210 |
+ tsens_debug_init(op); |
3211 |
+ |
3212 |
+- return 0; |
3213 |
+- |
3214 |
+ err_put_device: |
3215 |
+ put_device(&op->dev); |
3216 |
+ return ret; |
3217 |
+diff --git a/drivers/tty/ehv_bytechan.c b/drivers/tty/ehv_bytechan.c |
3218 |
+index 769e0a5d1dfc..3c6dd06ec5fb 100644 |
3219 |
+--- a/drivers/tty/ehv_bytechan.c |
3220 |
++++ b/drivers/tty/ehv_bytechan.c |
3221 |
+@@ -136,6 +136,21 @@ static int find_console_handle(void) |
3222 |
+ return 1; |
3223 |
+ } |
3224 |
+ |
3225 |
++static unsigned int local_ev_byte_channel_send(unsigned int handle, |
3226 |
++ unsigned int *count, |
3227 |
++ const char *p) |
3228 |
++{ |
3229 |
++ char buffer[EV_BYTE_CHANNEL_MAX_BYTES]; |
3230 |
++ unsigned int c = *count; |
3231 |
++ |
3232 |
++ if (c < sizeof(buffer)) { |
3233 |
++ memcpy(buffer, p, c); |
3234 |
++ memset(&buffer[c], 0, sizeof(buffer) - c); |
3235 |
++ p = buffer; |
3236 |
++ } |
3237 |
++ return ev_byte_channel_send(handle, count, p); |
3238 |
++} |
3239 |
++ |
3240 |
+ /*************************** EARLY CONSOLE DRIVER ***************************/ |
3241 |
+ |
3242 |
+ #ifdef CONFIG_PPC_EARLY_DEBUG_EHV_BC |
3243 |
+@@ -154,7 +169,7 @@ static void byte_channel_spin_send(const char data) |
3244 |
+ |
3245 |
+ do { |
3246 |
+ count = 1; |
3247 |
+- ret = ev_byte_channel_send(CONFIG_PPC_EARLY_DEBUG_EHV_BC_HANDLE, |
3248 |
++ ret = local_ev_byte_channel_send(CONFIG_PPC_EARLY_DEBUG_EHV_BC_HANDLE, |
3249 |
+ &count, &data); |
3250 |
+ } while (ret == EV_EAGAIN); |
3251 |
+ } |
3252 |
+@@ -221,7 +236,7 @@ static int ehv_bc_console_byte_channel_send(unsigned int handle, const char *s, |
3253 |
+ while (count) { |
3254 |
+ len = min_t(unsigned int, count, EV_BYTE_CHANNEL_MAX_BYTES); |
3255 |
+ do { |
3256 |
+- ret = ev_byte_channel_send(handle, &len, s); |
3257 |
++ ret = local_ev_byte_channel_send(handle, &len, s); |
3258 |
+ } while (ret == EV_EAGAIN); |
3259 |
+ count -= len; |
3260 |
+ s += len; |
3261 |
+@@ -401,7 +416,7 @@ static void ehv_bc_tx_dequeue(struct ehv_bc_data *bc) |
3262 |
+ CIRC_CNT_TO_END(bc->head, bc->tail, BUF_SIZE), |
3263 |
+ EV_BYTE_CHANNEL_MAX_BYTES); |
3264 |
+ |
3265 |
+- ret = ev_byte_channel_send(bc->handle, &len, bc->buf + bc->tail); |
3266 |
++ ret = local_ev_byte_channel_send(bc->handle, &len, bc->buf + bc->tail); |
3267 |
+ |
3268 |
+ /* 'len' is valid only if the return code is 0 or EV_EAGAIN */ |
3269 |
+ if (!ret || (ret == EV_EAGAIN)) |
3270 |
+diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c |
3271 |
+index d04554959ea7..30e73ec4ad5c 100644 |
3272 |
+--- a/drivers/video/fbdev/core/fbmem.c |
3273 |
++++ b/drivers/video/fbdev/core/fbmem.c |
3274 |
+@@ -663,20 +663,20 @@ int fb_prepare_logo(struct fb_info *info, int rotate) |
3275 |
+ fb_logo.depth = 1; |
3276 |
+ |
3277 |
+ |
3278 |
+- if (fb_logo.depth > 4 && depth > 4) { |
3279 |
+- switch (info->fix.visual) { |
3280 |
+- case FB_VISUAL_TRUECOLOR: |
3281 |
+- fb_logo.needs_truepalette = 1; |
3282 |
+- break; |
3283 |
+- case FB_VISUAL_DIRECTCOLOR: |
3284 |
+- fb_logo.needs_directpalette = 1; |
3285 |
+- fb_logo.needs_cmapreset = 1; |
3286 |
+- break; |
3287 |
+- case FB_VISUAL_PSEUDOCOLOR: |
3288 |
+- fb_logo.needs_cmapreset = 1; |
3289 |
+- break; |
3290 |
+- } |
3291 |
+- } |
3292 |
++ if (fb_logo.depth > 4 && depth > 4) { |
3293 |
++ switch (info->fix.visual) { |
3294 |
++ case FB_VISUAL_TRUECOLOR: |
3295 |
++ fb_logo.needs_truepalette = 1; |
3296 |
++ break; |
3297 |
++ case FB_VISUAL_DIRECTCOLOR: |
3298 |
++ fb_logo.needs_directpalette = 1; |
3299 |
++ fb_logo.needs_cmapreset = 1; |
3300 |
++ break; |
3301 |
++ case FB_VISUAL_PSEUDOCOLOR: |
3302 |
++ fb_logo.needs_cmapreset = 1; |
3303 |
++ break; |
3304 |
++ } |
3305 |
++ } |
3306 |
+ |
3307 |
+ height = fb_logo.logo->height; |
3308 |
+ if (fb_center_logo) |
3309 |
+@@ -1065,19 +1065,19 @@ fb_blank(struct fb_info *info, int blank) |
3310 |
+ struct fb_event event; |
3311 |
+ int ret = -EINVAL; |
3312 |
+ |
3313 |
+- if (blank > FB_BLANK_POWERDOWN) |
3314 |
+- blank = FB_BLANK_POWERDOWN; |
3315 |
++ if (blank > FB_BLANK_POWERDOWN) |
3316 |
++ blank = FB_BLANK_POWERDOWN; |
3317 |
+ |
3318 |
+ event.info = info; |
3319 |
+ event.data = ␣ |
3320 |
+ |
3321 |
+ if (info->fbops->fb_blank) |
3322 |
+- ret = info->fbops->fb_blank(blank, info); |
3323 |
++ ret = info->fbops->fb_blank(blank, info); |
3324 |
+ |
3325 |
+ if (!ret) |
3326 |
+ fb_notifier_call_chain(FB_EVENT_BLANK, &event); |
3327 |
+ |
3328 |
+- return ret; |
3329 |
++ return ret; |
3330 |
+ } |
3331 |
+ EXPORT_SYMBOL(fb_blank); |
3332 |
+ |
3333 |
+@@ -1115,7 +1115,7 @@ static long do_fb_ioctl(struct fb_info *info, unsigned int cmd, |
3334 |
+ break; |
3335 |
+ case FBIOGET_FSCREENINFO: |
3336 |
+ lock_fb_info(info); |
3337 |
+- fix = info->fix; |
3338 |
++ memcpy(&fix, &info->fix, sizeof(fix)); |
3339 |
+ if (info->flags & FBINFO_HIDE_SMEM_START) |
3340 |
+ fix.smem_start = 0; |
3341 |
+ unlock_fb_info(info); |
3342 |
+diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c |
3343 |
+index 341458fd95ca..44375a22307b 100644 |
3344 |
+--- a/drivers/virtio/virtio_balloon.c |
3345 |
++++ b/drivers/virtio/virtio_balloon.c |
3346 |
+@@ -14,6 +14,7 @@ |
3347 |
+ #include <linux/slab.h> |
3348 |
+ #include <linux/module.h> |
3349 |
+ #include <linux/balloon_compaction.h> |
3350 |
++#include <linux/oom.h> |
3351 |
+ #include <linux/wait.h> |
3352 |
+ #include <linux/mm.h> |
3353 |
+ #include <linux/mount.h> |
3354 |
+@@ -27,7 +28,9 @@ |
3355 |
+ */ |
3356 |
+ #define VIRTIO_BALLOON_PAGES_PER_PAGE (unsigned)(PAGE_SIZE >> VIRTIO_BALLOON_PFN_SHIFT) |
3357 |
+ #define VIRTIO_BALLOON_ARRAY_PFNS_MAX 256 |
3358 |
+-#define VIRTBALLOON_OOM_NOTIFY_PRIORITY 80 |
3359 |
++/* Maximum number of (4k) pages to deflate on OOM notifications. */ |
3360 |
++#define VIRTIO_BALLOON_OOM_NR_PAGES 256 |
3361 |
++#define VIRTIO_BALLOON_OOM_NOTIFY_PRIORITY 80 |
3362 |
+ |
3363 |
+ #define VIRTIO_BALLOON_FREE_PAGE_ALLOC_FLAG (__GFP_NORETRY | __GFP_NOWARN | \ |
3364 |
+ __GFP_NOMEMALLOC) |
3365 |
+@@ -112,8 +115,11 @@ struct virtio_balloon { |
3366 |
+ /* Memory statistics */ |
3367 |
+ struct virtio_balloon_stat stats[VIRTIO_BALLOON_S_NR]; |
3368 |
+ |
3369 |
+- /* To register a shrinker to shrink memory upon memory pressure */ |
3370 |
++ /* Shrinker to return free pages - VIRTIO_BALLOON_F_FREE_PAGE_HINT */ |
3371 |
+ struct shrinker shrinker; |
3372 |
++ |
3373 |
++ /* OOM notifier to deflate on OOM - VIRTIO_BALLOON_F_DEFLATE_ON_OOM */ |
3374 |
++ struct notifier_block oom_nb; |
3375 |
+ }; |
3376 |
+ |
3377 |
+ static struct virtio_device_id id_table[] = { |
3378 |
+@@ -788,50 +794,13 @@ static unsigned long shrink_free_pages(struct virtio_balloon *vb, |
3379 |
+ return blocks_freed * VIRTIO_BALLOON_HINT_BLOCK_PAGES; |
3380 |
+ } |
3381 |
+ |
3382 |
+-static unsigned long leak_balloon_pages(struct virtio_balloon *vb, |
3383 |
+- unsigned long pages_to_free) |
3384 |
+-{ |
3385 |
+- return leak_balloon(vb, pages_to_free * VIRTIO_BALLOON_PAGES_PER_PAGE) / |
3386 |
+- VIRTIO_BALLOON_PAGES_PER_PAGE; |
3387 |
+-} |
3388 |
+- |
3389 |
+-static unsigned long shrink_balloon_pages(struct virtio_balloon *vb, |
3390 |
+- unsigned long pages_to_free) |
3391 |
+-{ |
3392 |
+- unsigned long pages_freed = 0; |
3393 |
+- |
3394 |
+- /* |
3395 |
+- * One invocation of leak_balloon can deflate at most |
3396 |
+- * VIRTIO_BALLOON_ARRAY_PFNS_MAX balloon pages, so we call it |
3397 |
+- * multiple times to deflate pages till reaching pages_to_free. |
3398 |
+- */ |
3399 |
+- while (vb->num_pages && pages_freed < pages_to_free) |
3400 |
+- pages_freed += leak_balloon_pages(vb, |
3401 |
+- pages_to_free - pages_freed); |
3402 |
+- |
3403 |
+- update_balloon_size(vb); |
3404 |
+- |
3405 |
+- return pages_freed; |
3406 |
+-} |
3407 |
+- |
3408 |
+ static unsigned long virtio_balloon_shrinker_scan(struct shrinker *shrinker, |
3409 |
+ struct shrink_control *sc) |
3410 |
+ { |
3411 |
+- unsigned long pages_to_free, pages_freed = 0; |
3412 |
+ struct virtio_balloon *vb = container_of(shrinker, |
3413 |
+ struct virtio_balloon, shrinker); |
3414 |
+ |
3415 |
+- pages_to_free = sc->nr_to_scan; |
3416 |
+- |
3417 |
+- if (virtio_has_feature(vb->vdev, VIRTIO_BALLOON_F_FREE_PAGE_HINT)) |
3418 |
+- pages_freed = shrink_free_pages(vb, pages_to_free); |
3419 |
+- |
3420 |
+- if (pages_freed >= pages_to_free) |
3421 |
+- return pages_freed; |
3422 |
+- |
3423 |
+- pages_freed += shrink_balloon_pages(vb, pages_to_free - pages_freed); |
3424 |
+- |
3425 |
+- return pages_freed; |
3426 |
++ return shrink_free_pages(vb, sc->nr_to_scan); |
3427 |
+ } |
3428 |
+ |
3429 |
+ static unsigned long virtio_balloon_shrinker_count(struct shrinker *shrinker, |
3430 |
+@@ -839,26 +808,22 @@ static unsigned long virtio_balloon_shrinker_count(struct shrinker *shrinker, |
3431 |
+ { |
3432 |
+ struct virtio_balloon *vb = container_of(shrinker, |
3433 |
+ struct virtio_balloon, shrinker); |
3434 |
+- unsigned long count; |
3435 |
+- |
3436 |
+- count = vb->num_pages / VIRTIO_BALLOON_PAGES_PER_PAGE; |
3437 |
+- count += vb->num_free_page_blocks * VIRTIO_BALLOON_HINT_BLOCK_PAGES; |
3438 |
+ |
3439 |
+- return count; |
3440 |
++ return vb->num_free_page_blocks * VIRTIO_BALLOON_HINT_BLOCK_PAGES; |
3441 |
+ } |
3442 |
+ |
3443 |
+-static void virtio_balloon_unregister_shrinker(struct virtio_balloon *vb) |
3444 |
++static int virtio_balloon_oom_notify(struct notifier_block *nb, |
3445 |
++ unsigned long dummy, void *parm) |
3446 |
+ { |
3447 |
+- unregister_shrinker(&vb->shrinker); |
3448 |
+-} |
3449 |
++ struct virtio_balloon *vb = container_of(nb, |
3450 |
++ struct virtio_balloon, oom_nb); |
3451 |
++ unsigned long *freed = parm; |
3452 |
+ |
3453 |
+-static int virtio_balloon_register_shrinker(struct virtio_balloon *vb) |
3454 |
+-{ |
3455 |
+- vb->shrinker.scan_objects = virtio_balloon_shrinker_scan; |
3456 |
+- vb->shrinker.count_objects = virtio_balloon_shrinker_count; |
3457 |
+- vb->shrinker.seeks = DEFAULT_SEEKS; |
3458 |
++ *freed += leak_balloon(vb, VIRTIO_BALLOON_OOM_NR_PAGES) / |
3459 |
++ VIRTIO_BALLOON_PAGES_PER_PAGE; |
3460 |
++ update_balloon_size(vb); |
3461 |
+ |
3462 |
+- return register_shrinker(&vb->shrinker); |
3463 |
++ return NOTIFY_OK; |
3464 |
+ } |
3465 |
+ |
3466 |
+ static int virtballoon_probe(struct virtio_device *vdev) |
3467 |
+@@ -935,22 +900,35 @@ static int virtballoon_probe(struct virtio_device *vdev) |
3468 |
+ virtio_cwrite(vb->vdev, struct virtio_balloon_config, |
3469 |
+ poison_val, &poison_val); |
3470 |
+ } |
3471 |
+- } |
3472 |
+- /* |
3473 |
+- * We continue to use VIRTIO_BALLOON_F_DEFLATE_ON_OOM to decide if a |
3474 |
+- * shrinker needs to be registered to relieve memory pressure. |
3475 |
+- */ |
3476 |
+- if (virtio_has_feature(vb->vdev, VIRTIO_BALLOON_F_DEFLATE_ON_OOM)) { |
3477 |
+- err = virtio_balloon_register_shrinker(vb); |
3478 |
++ |
3479 |
++ /* |
3480 |
++ * We're allowed to reuse any free pages, even if they are |
3481 |
++ * still to be processed by the host. |
3482 |
++ */ |
3483 |
++ vb->shrinker.scan_objects = virtio_balloon_shrinker_scan; |
3484 |
++ vb->shrinker.count_objects = virtio_balloon_shrinker_count; |
3485 |
++ vb->shrinker.seeks = DEFAULT_SEEKS; |
3486 |
++ err = register_shrinker(&vb->shrinker); |
3487 |
+ if (err) |
3488 |
+ goto out_del_balloon_wq; |
3489 |
+ } |
3490 |
++ if (virtio_has_feature(vdev, VIRTIO_BALLOON_F_DEFLATE_ON_OOM)) { |
3491 |
++ vb->oom_nb.notifier_call = virtio_balloon_oom_notify; |
3492 |
++ vb->oom_nb.priority = VIRTIO_BALLOON_OOM_NOTIFY_PRIORITY; |
3493 |
++ err = register_oom_notifier(&vb->oom_nb); |
3494 |
++ if (err < 0) |
3495 |
++ goto out_unregister_shrinker; |
3496 |
++ } |
3497 |
++ |
3498 |
+ virtio_device_ready(vdev); |
3499 |
+ |
3500 |
+ if (towards_target(vb)) |
3501 |
+ virtballoon_changed(vdev); |
3502 |
+ return 0; |
3503 |
+ |
3504 |
++out_unregister_shrinker: |
3505 |
++ if (virtio_has_feature(vdev, VIRTIO_BALLOON_F_FREE_PAGE_HINT)) |
3506 |
++ unregister_shrinker(&vb->shrinker); |
3507 |
+ out_del_balloon_wq: |
3508 |
+ if (virtio_has_feature(vdev, VIRTIO_BALLOON_F_FREE_PAGE_HINT)) |
3509 |
+ destroy_workqueue(vb->balloon_wq); |
3510 |
+@@ -989,8 +967,11 @@ static void virtballoon_remove(struct virtio_device *vdev) |
3511 |
+ { |
3512 |
+ struct virtio_balloon *vb = vdev->priv; |
3513 |
+ |
3514 |
+- if (virtio_has_feature(vb->vdev, VIRTIO_BALLOON_F_DEFLATE_ON_OOM)) |
3515 |
+- virtio_balloon_unregister_shrinker(vb); |
3516 |
++ if (virtio_has_feature(vdev, VIRTIO_BALLOON_F_DEFLATE_ON_OOM)) |
3517 |
++ unregister_oom_notifier(&vb->oom_nb); |
3518 |
++ if (virtio_has_feature(vdev, VIRTIO_BALLOON_F_FREE_PAGE_HINT)) |
3519 |
++ unregister_shrinker(&vb->shrinker); |
3520 |
++ |
3521 |
+ spin_lock_irq(&vb->stop_update_lock); |
3522 |
+ vb->stop_update = true; |
3523 |
+ spin_unlock_irq(&vb->stop_update_lock); |
3524 |
+diff --git a/drivers/watchdog/sp805_wdt.c b/drivers/watchdog/sp805_wdt.c |
3525 |
+index 53e04926a7b2..190d26e2e75f 100644 |
3526 |
+--- a/drivers/watchdog/sp805_wdt.c |
3527 |
++++ b/drivers/watchdog/sp805_wdt.c |
3528 |
+@@ -137,10 +137,14 @@ wdt_restart(struct watchdog_device *wdd, unsigned long mode, void *cmd) |
3529 |
+ { |
3530 |
+ struct sp805_wdt *wdt = watchdog_get_drvdata(wdd); |
3531 |
+ |
3532 |
++ writel_relaxed(UNLOCK, wdt->base + WDTLOCK); |
3533 |
+ writel_relaxed(0, wdt->base + WDTCONTROL); |
3534 |
+ writel_relaxed(0, wdt->base + WDTLOAD); |
3535 |
+ writel_relaxed(INT_ENABLE | RESET_ENABLE, wdt->base + WDTCONTROL); |
3536 |
+ |
3537 |
++ /* Flush posted writes. */ |
3538 |
++ readl_relaxed(wdt->base + WDTLOCK); |
3539 |
++ |
3540 |
+ return 0; |
3541 |
+ } |
3542 |
+ |
3543 |
+diff --git a/fs/afs/dir.c b/fs/afs/dir.c |
3544 |
+index 5c794f4b051a..d1e1caa23c8b 100644 |
3545 |
+--- a/fs/afs/dir.c |
3546 |
++++ b/fs/afs/dir.c |
3547 |
+@@ -1032,7 +1032,7 @@ static int afs_d_revalidate(struct dentry *dentry, unsigned int flags) |
3548 |
+ struct dentry *parent; |
3549 |
+ struct inode *inode; |
3550 |
+ struct key *key; |
3551 |
+- afs_dataversion_t dir_version; |
3552 |
++ afs_dataversion_t dir_version, invalid_before; |
3553 |
+ long de_version; |
3554 |
+ int ret; |
3555 |
+ |
3556 |
+@@ -1084,8 +1084,8 @@ static int afs_d_revalidate(struct dentry *dentry, unsigned int flags) |
3557 |
+ if (de_version == (long)dir_version) |
3558 |
+ goto out_valid_noupdate; |
3559 |
+ |
3560 |
+- dir_version = dir->invalid_before; |
3561 |
+- if (de_version - (long)dir_version >= 0) |
3562 |
++ invalid_before = dir->invalid_before; |
3563 |
++ if (de_version - (long)invalid_before >= 0) |
3564 |
+ goto out_valid; |
3565 |
+ |
3566 |
+ _debug("dir modified"); |
3567 |
+@@ -1275,6 +1275,7 @@ static int afs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) |
3568 |
+ struct afs_fs_cursor fc; |
3569 |
+ struct afs_vnode *dvnode = AFS_FS_I(dir); |
3570 |
+ struct key *key; |
3571 |
++ afs_dataversion_t data_version; |
3572 |
+ int ret; |
3573 |
+ |
3574 |
+ mode |= S_IFDIR; |
3575 |
+@@ -1295,7 +1296,7 @@ static int afs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) |
3576 |
+ |
3577 |
+ ret = -ERESTARTSYS; |
3578 |
+ if (afs_begin_vnode_operation(&fc, dvnode, key, true)) { |
3579 |
+- afs_dataversion_t data_version = dvnode->status.data_version + 1; |
3580 |
++ data_version = dvnode->status.data_version + 1; |
3581 |
+ |
3582 |
+ while (afs_select_fileserver(&fc)) { |
3583 |
+ fc.cb_break = afs_calc_vnode_cb_break(dvnode); |
3584 |
+@@ -1316,10 +1317,14 @@ static int afs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) |
3585 |
+ goto error_key; |
3586 |
+ } |
3587 |
+ |
3588 |
+- if (ret == 0 && |
3589 |
+- test_bit(AFS_VNODE_DIR_VALID, &dvnode->flags)) |
3590 |
+- afs_edit_dir_add(dvnode, &dentry->d_name, &iget_data.fid, |
3591 |
+- afs_edit_dir_for_create); |
3592 |
++ if (ret == 0) { |
3593 |
++ down_write(&dvnode->validate_lock); |
3594 |
++ if (test_bit(AFS_VNODE_DIR_VALID, &dvnode->flags) && |
3595 |
++ dvnode->status.data_version == data_version) |
3596 |
++ afs_edit_dir_add(dvnode, &dentry->d_name, &iget_data.fid, |
3597 |
++ afs_edit_dir_for_create); |
3598 |
++ up_write(&dvnode->validate_lock); |
3599 |
++ } |
3600 |
+ |
3601 |
+ key_put(key); |
3602 |
+ kfree(scb); |
3603 |
+@@ -1360,6 +1365,7 @@ static int afs_rmdir(struct inode *dir, struct dentry *dentry) |
3604 |
+ struct afs_fs_cursor fc; |
3605 |
+ struct afs_vnode *dvnode = AFS_FS_I(dir), *vnode = NULL; |
3606 |
+ struct key *key; |
3607 |
++ afs_dataversion_t data_version; |
3608 |
+ int ret; |
3609 |
+ |
3610 |
+ _enter("{%llx:%llu},{%pd}", |
3611 |
+@@ -1391,7 +1397,7 @@ static int afs_rmdir(struct inode *dir, struct dentry *dentry) |
3612 |
+ |
3613 |
+ ret = -ERESTARTSYS; |
3614 |
+ if (afs_begin_vnode_operation(&fc, dvnode, key, true)) { |
3615 |
+- afs_dataversion_t data_version = dvnode->status.data_version + 1; |
3616 |
++ data_version = dvnode->status.data_version + 1; |
3617 |
+ |
3618 |
+ while (afs_select_fileserver(&fc)) { |
3619 |
+ fc.cb_break = afs_calc_vnode_cb_break(dvnode); |
3620 |
+@@ -1404,9 +1410,12 @@ static int afs_rmdir(struct inode *dir, struct dentry *dentry) |
3621 |
+ ret = afs_end_vnode_operation(&fc); |
3622 |
+ if (ret == 0) { |
3623 |
+ afs_dir_remove_subdir(dentry); |
3624 |
+- if (test_bit(AFS_VNODE_DIR_VALID, &dvnode->flags)) |
3625 |
++ down_write(&dvnode->validate_lock); |
3626 |
++ if (test_bit(AFS_VNODE_DIR_VALID, &dvnode->flags) && |
3627 |
++ dvnode->status.data_version == data_version) |
3628 |
+ afs_edit_dir_remove(dvnode, &dentry->d_name, |
3629 |
+ afs_edit_dir_for_rmdir); |
3630 |
++ up_write(&dvnode->validate_lock); |
3631 |
+ } |
3632 |
+ } |
3633 |
+ |
3634 |
+@@ -1544,10 +1553,15 @@ static int afs_unlink(struct inode *dir, struct dentry *dentry) |
3635 |
+ ret = afs_end_vnode_operation(&fc); |
3636 |
+ if (ret == 0 && !(scb[1].have_status || scb[1].have_error)) |
3637 |
+ ret = afs_dir_remove_link(dvnode, dentry, key); |
3638 |
+- if (ret == 0 && |
3639 |
+- test_bit(AFS_VNODE_DIR_VALID, &dvnode->flags)) |
3640 |
+- afs_edit_dir_remove(dvnode, &dentry->d_name, |
3641 |
+- afs_edit_dir_for_unlink); |
3642 |
++ |
3643 |
++ if (ret == 0) { |
3644 |
++ down_write(&dvnode->validate_lock); |
3645 |
++ if (test_bit(AFS_VNODE_DIR_VALID, &dvnode->flags) && |
3646 |
++ dvnode->status.data_version == data_version) |
3647 |
++ afs_edit_dir_remove(dvnode, &dentry->d_name, |
3648 |
++ afs_edit_dir_for_unlink); |
3649 |
++ up_write(&dvnode->validate_lock); |
3650 |
++ } |
3651 |
+ } |
3652 |
+ |
3653 |
+ if (need_rehash && ret < 0 && ret != -ENOENT) |
3654 |
+@@ -1573,6 +1587,7 @@ static int afs_create(struct inode *dir, struct dentry *dentry, umode_t mode, |
3655 |
+ struct afs_status_cb *scb; |
3656 |
+ struct afs_vnode *dvnode = AFS_FS_I(dir); |
3657 |
+ struct key *key; |
3658 |
++ afs_dataversion_t data_version; |
3659 |
+ int ret; |
3660 |
+ |
3661 |
+ mode |= S_IFREG; |
3662 |
+@@ -1597,7 +1612,7 @@ static int afs_create(struct inode *dir, struct dentry *dentry, umode_t mode, |
3663 |
+ |
3664 |
+ ret = -ERESTARTSYS; |
3665 |
+ if (afs_begin_vnode_operation(&fc, dvnode, key, true)) { |
3666 |
+- afs_dataversion_t data_version = dvnode->status.data_version + 1; |
3667 |
++ data_version = dvnode->status.data_version + 1; |
3668 |
+ |
3669 |
+ while (afs_select_fileserver(&fc)) { |
3670 |
+ fc.cb_break = afs_calc_vnode_cb_break(dvnode); |
3671 |
+@@ -1618,9 +1633,12 @@ static int afs_create(struct inode *dir, struct dentry *dentry, umode_t mode, |
3672 |
+ goto error_key; |
3673 |
+ } |
3674 |
+ |
3675 |
+- if (test_bit(AFS_VNODE_DIR_VALID, &dvnode->flags)) |
3676 |
++ down_write(&dvnode->validate_lock); |
3677 |
++ if (test_bit(AFS_VNODE_DIR_VALID, &dvnode->flags) && |
3678 |
++ dvnode->status.data_version == data_version) |
3679 |
+ afs_edit_dir_add(dvnode, &dentry->d_name, &iget_data.fid, |
3680 |
+ afs_edit_dir_for_create); |
3681 |
++ up_write(&dvnode->validate_lock); |
3682 |
+ |
3683 |
+ kfree(scb); |
3684 |
+ key_put(key); |
3685 |
+@@ -1648,6 +1666,7 @@ static int afs_link(struct dentry *from, struct inode *dir, |
3686 |
+ struct afs_vnode *dvnode = AFS_FS_I(dir); |
3687 |
+ struct afs_vnode *vnode = AFS_FS_I(d_inode(from)); |
3688 |
+ struct key *key; |
3689 |
++ afs_dataversion_t data_version; |
3690 |
+ int ret; |
3691 |
+ |
3692 |
+ _enter("{%llx:%llu},{%llx:%llu},{%pd}", |
3693 |
+@@ -1672,7 +1691,7 @@ static int afs_link(struct dentry *from, struct inode *dir, |
3694 |
+ |
3695 |
+ ret = -ERESTARTSYS; |
3696 |
+ if (afs_begin_vnode_operation(&fc, dvnode, key, true)) { |
3697 |
+- afs_dataversion_t data_version = dvnode->status.data_version + 1; |
3698 |
++ data_version = dvnode->status.data_version + 1; |
3699 |
+ |
3700 |
+ if (mutex_lock_interruptible_nested(&vnode->io_lock, 1) < 0) { |
3701 |
+ afs_end_vnode_operation(&fc); |
3702 |
+@@ -1702,9 +1721,12 @@ static int afs_link(struct dentry *from, struct inode *dir, |
3703 |
+ goto error_key; |
3704 |
+ } |
3705 |
+ |
3706 |
+- if (test_bit(AFS_VNODE_DIR_VALID, &dvnode->flags)) |
3707 |
++ down_write(&dvnode->validate_lock); |
3708 |
++ if (test_bit(AFS_VNODE_DIR_VALID, &dvnode->flags) && |
3709 |
++ dvnode->status.data_version == data_version) |
3710 |
+ afs_edit_dir_add(dvnode, &dentry->d_name, &vnode->fid, |
3711 |
+ afs_edit_dir_for_link); |
3712 |
++ up_write(&dvnode->validate_lock); |
3713 |
+ |
3714 |
+ key_put(key); |
3715 |
+ kfree(scb); |
3716 |
+@@ -1732,6 +1754,7 @@ static int afs_symlink(struct inode *dir, struct dentry *dentry, |
3717 |
+ struct afs_status_cb *scb; |
3718 |
+ struct afs_vnode *dvnode = AFS_FS_I(dir); |
3719 |
+ struct key *key; |
3720 |
++ afs_dataversion_t data_version; |
3721 |
+ int ret; |
3722 |
+ |
3723 |
+ _enter("{%llx:%llu},{%pd},%s", |
3724 |
+@@ -1759,7 +1782,7 @@ static int afs_symlink(struct inode *dir, struct dentry *dentry, |
3725 |
+ |
3726 |
+ ret = -ERESTARTSYS; |
3727 |
+ if (afs_begin_vnode_operation(&fc, dvnode, key, true)) { |
3728 |
+- afs_dataversion_t data_version = dvnode->status.data_version + 1; |
3729 |
++ data_version = dvnode->status.data_version + 1; |
3730 |
+ |
3731 |
+ while (afs_select_fileserver(&fc)) { |
3732 |
+ fc.cb_break = afs_calc_vnode_cb_break(dvnode); |
3733 |
+@@ -1780,9 +1803,12 @@ static int afs_symlink(struct inode *dir, struct dentry *dentry, |
3734 |
+ goto error_key; |
3735 |
+ } |
3736 |
+ |
3737 |
+- if (test_bit(AFS_VNODE_DIR_VALID, &dvnode->flags)) |
3738 |
++ down_write(&dvnode->validate_lock); |
3739 |
++ if (test_bit(AFS_VNODE_DIR_VALID, &dvnode->flags) && |
3740 |
++ dvnode->status.data_version == data_version) |
3741 |
+ afs_edit_dir_add(dvnode, &dentry->d_name, &iget_data.fid, |
3742 |
+ afs_edit_dir_for_symlink); |
3743 |
++ up_write(&dvnode->validate_lock); |
3744 |
+ |
3745 |
+ key_put(key); |
3746 |
+ kfree(scb); |
3747 |
+@@ -1812,6 +1838,8 @@ static int afs_rename(struct inode *old_dir, struct dentry *old_dentry, |
3748 |
+ struct dentry *tmp = NULL, *rehash = NULL; |
3749 |
+ struct inode *new_inode; |
3750 |
+ struct key *key; |
3751 |
++ afs_dataversion_t orig_data_version; |
3752 |
++ afs_dataversion_t new_data_version; |
3753 |
+ bool new_negative = d_is_negative(new_dentry); |
3754 |
+ int ret; |
3755 |
+ |
3756 |
+@@ -1890,10 +1918,6 @@ static int afs_rename(struct inode *old_dir, struct dentry *old_dentry, |
3757 |
+ |
3758 |
+ ret = -ERESTARTSYS; |
3759 |
+ if (afs_begin_vnode_operation(&fc, orig_dvnode, key, true)) { |
3760 |
+- afs_dataversion_t orig_data_version; |
3761 |
+- afs_dataversion_t new_data_version; |
3762 |
+- struct afs_status_cb *new_scb = &scb[1]; |
3763 |
+- |
3764 |
+ orig_data_version = orig_dvnode->status.data_version + 1; |
3765 |
+ |
3766 |
+ if (orig_dvnode != new_dvnode) { |
3767 |
+@@ -1904,7 +1928,6 @@ static int afs_rename(struct inode *old_dir, struct dentry *old_dentry, |
3768 |
+ new_data_version = new_dvnode->status.data_version + 1; |
3769 |
+ } else { |
3770 |
+ new_data_version = orig_data_version; |
3771 |
+- new_scb = &scb[0]; |
3772 |
+ } |
3773 |
+ |
3774 |
+ while (afs_select_fileserver(&fc)) { |
3775 |
+@@ -1912,7 +1935,7 @@ static int afs_rename(struct inode *old_dir, struct dentry *old_dentry, |
3776 |
+ fc.cb_break_2 = afs_calc_vnode_cb_break(new_dvnode); |
3777 |
+ afs_fs_rename(&fc, old_dentry->d_name.name, |
3778 |
+ new_dvnode, new_dentry->d_name.name, |
3779 |
+- &scb[0], new_scb); |
3780 |
++ &scb[0], &scb[1]); |
3781 |
+ } |
3782 |
+ |
3783 |
+ afs_vnode_commit_status(&fc, orig_dvnode, fc.cb_break, |
3784 |
+@@ -1930,18 +1953,25 @@ static int afs_rename(struct inode *old_dir, struct dentry *old_dentry, |
3785 |
+ if (ret == 0) { |
3786 |
+ if (rehash) |
3787 |
+ d_rehash(rehash); |
3788 |
+- if (test_bit(AFS_VNODE_DIR_VALID, &orig_dvnode->flags)) |
3789 |
+- afs_edit_dir_remove(orig_dvnode, &old_dentry->d_name, |
3790 |
+- afs_edit_dir_for_rename_0); |
3791 |
++ down_write(&orig_dvnode->validate_lock); |
3792 |
++ if (test_bit(AFS_VNODE_DIR_VALID, &orig_dvnode->flags) && |
3793 |
++ orig_dvnode->status.data_version == orig_data_version) |
3794 |
++ afs_edit_dir_remove(orig_dvnode, &old_dentry->d_name, |
3795 |
++ afs_edit_dir_for_rename_0); |
3796 |
++ if (orig_dvnode != new_dvnode) { |
3797 |
++ up_write(&orig_dvnode->validate_lock); |
3798 |
+ |
3799 |
+- if (!new_negative && |
3800 |
+- test_bit(AFS_VNODE_DIR_VALID, &new_dvnode->flags)) |
3801 |
+- afs_edit_dir_remove(new_dvnode, &new_dentry->d_name, |
3802 |
+- afs_edit_dir_for_rename_1); |
3803 |
++ down_write(&new_dvnode->validate_lock); |
3804 |
++ } |
3805 |
++ if (test_bit(AFS_VNODE_DIR_VALID, &new_dvnode->flags) && |
3806 |
++ orig_dvnode->status.data_version == new_data_version) { |
3807 |
++ if (!new_negative) |
3808 |
++ afs_edit_dir_remove(new_dvnode, &new_dentry->d_name, |
3809 |
++ afs_edit_dir_for_rename_1); |
3810 |
+ |
3811 |
+- if (test_bit(AFS_VNODE_DIR_VALID, &new_dvnode->flags)) |
3812 |
+ afs_edit_dir_add(new_dvnode, &new_dentry->d_name, |
3813 |
+ &vnode->fid, afs_edit_dir_for_rename_2); |
3814 |
++ } |
3815 |
+ |
3816 |
+ new_inode = d_inode(new_dentry); |
3817 |
+ if (new_inode) { |
3818 |
+@@ -1957,14 +1987,10 @@ static int afs_rename(struct inode *old_dir, struct dentry *old_dentry, |
3819 |
+ * Note that if we ever implement RENAME_EXCHANGE, we'll have |
3820 |
+ * to update both dentries with opposing dir versions. |
3821 |
+ */ |
3822 |
+- if (new_dvnode != orig_dvnode) { |
3823 |
+- afs_update_dentry_version(&fc, old_dentry, &scb[1]); |
3824 |
+- afs_update_dentry_version(&fc, new_dentry, &scb[1]); |
3825 |
+- } else { |
3826 |
+- afs_update_dentry_version(&fc, old_dentry, &scb[0]); |
3827 |
+- afs_update_dentry_version(&fc, new_dentry, &scb[0]); |
3828 |
+- } |
3829 |
++ afs_update_dentry_version(&fc, old_dentry, &scb[1]); |
3830 |
++ afs_update_dentry_version(&fc, new_dentry, &scb[1]); |
3831 |
+ d_move(old_dentry, new_dentry); |
3832 |
++ up_write(&new_dvnode->validate_lock); |
3833 |
+ goto error_tmp; |
3834 |
+ } |
3835 |
+ |
3836 |
+diff --git a/fs/afs/dir_silly.c b/fs/afs/dir_silly.c |
3837 |
+index 361088a5edb9..d94e2b7cddff 100644 |
3838 |
+--- a/fs/afs/dir_silly.c |
3839 |
++++ b/fs/afs/dir_silly.c |
3840 |
+@@ -21,6 +21,7 @@ static int afs_do_silly_rename(struct afs_vnode *dvnode, struct afs_vnode *vnode |
3841 |
+ { |
3842 |
+ struct afs_fs_cursor fc; |
3843 |
+ struct afs_status_cb *scb; |
3844 |
++ afs_dataversion_t dir_data_version; |
3845 |
+ int ret = -ERESTARTSYS; |
3846 |
+ |
3847 |
+ _enter("%pd,%pd", old, new); |
3848 |
+@@ -31,7 +32,7 @@ static int afs_do_silly_rename(struct afs_vnode *dvnode, struct afs_vnode *vnode |
3849 |
+ |
3850 |
+ trace_afs_silly_rename(vnode, false); |
3851 |
+ if (afs_begin_vnode_operation(&fc, dvnode, key, true)) { |
3852 |
+- afs_dataversion_t dir_data_version = dvnode->status.data_version + 1; |
3853 |
++ dir_data_version = dvnode->status.data_version + 1; |
3854 |
+ |
3855 |
+ while (afs_select_fileserver(&fc)) { |
3856 |
+ fc.cb_break = afs_calc_vnode_cb_break(dvnode); |
3857 |
+@@ -54,12 +55,15 @@ static int afs_do_silly_rename(struct afs_vnode *dvnode, struct afs_vnode *vnode |
3858 |
+ dvnode->silly_key = key_get(key); |
3859 |
+ } |
3860 |
+ |
3861 |
+- if (test_bit(AFS_VNODE_DIR_VALID, &dvnode->flags)) |
3862 |
++ down_write(&dvnode->validate_lock); |
3863 |
++ if (test_bit(AFS_VNODE_DIR_VALID, &dvnode->flags) && |
3864 |
++ dvnode->status.data_version == dir_data_version) { |
3865 |
+ afs_edit_dir_remove(dvnode, &old->d_name, |
3866 |
+ afs_edit_dir_for_silly_0); |
3867 |
+- if (test_bit(AFS_VNODE_DIR_VALID, &dvnode->flags)) |
3868 |
+ afs_edit_dir_add(dvnode, &new->d_name, |
3869 |
+ &vnode->fid, afs_edit_dir_for_silly_1); |
3870 |
++ } |
3871 |
++ up_write(&dvnode->validate_lock); |
3872 |
+ } |
3873 |
+ |
3874 |
+ kfree(scb); |
3875 |
+@@ -181,10 +185,14 @@ static int afs_do_silly_unlink(struct afs_vnode *dvnode, struct afs_vnode *vnode |
3876 |
+ clear_bit(AFS_VNODE_CB_PROMISED, &vnode->flags); |
3877 |
+ } |
3878 |
+ } |
3879 |
+- if (ret == 0 && |
3880 |
+- test_bit(AFS_VNODE_DIR_VALID, &dvnode->flags)) |
3881 |
+- afs_edit_dir_remove(dvnode, &dentry->d_name, |
3882 |
+- afs_edit_dir_for_unlink); |
3883 |
++ if (ret == 0) { |
3884 |
++ down_write(&dvnode->validate_lock); |
3885 |
++ if (test_bit(AFS_VNODE_DIR_VALID, &dvnode->flags) && |
3886 |
++ dvnode->status.data_version == dir_data_version) |
3887 |
++ afs_edit_dir_remove(dvnode, &dentry->d_name, |
3888 |
++ afs_edit_dir_for_unlink); |
3889 |
++ up_write(&dvnode->validate_lock); |
3890 |
++ } |
3891 |
+ } |
3892 |
+ |
3893 |
+ kfree(scb); |
3894 |
+diff --git a/fs/afs/fsclient.c b/fs/afs/fsclient.c |
3895 |
+index 1f9c5d8e6fe5..68fc46634346 100644 |
3896 |
+--- a/fs/afs/fsclient.c |
3897 |
++++ b/fs/afs/fsclient.c |
3898 |
+@@ -65,6 +65,7 @@ static int xdr_decode_AFSFetchStatus(const __be32 **_bp, |
3899 |
+ bool inline_error = (call->operation_ID == afs_FS_InlineBulkStatus); |
3900 |
+ u64 data_version, size; |
3901 |
+ u32 type, abort_code; |
3902 |
++ int ret; |
3903 |
+ |
3904 |
+ abort_code = ntohl(xdr->abort_code); |
3905 |
+ |
3906 |
+@@ -78,7 +79,7 @@ static int xdr_decode_AFSFetchStatus(const __be32 **_bp, |
3907 |
+ */ |
3908 |
+ status->abort_code = abort_code; |
3909 |
+ scb->have_error = true; |
3910 |
+- return 0; |
3911 |
++ goto good; |
3912 |
+ } |
3913 |
+ |
3914 |
+ pr_warn("Unknown AFSFetchStatus version %u\n", ntohl(xdr->if_version)); |
3915 |
+@@ -87,7 +88,8 @@ static int xdr_decode_AFSFetchStatus(const __be32 **_bp, |
3916 |
+ |
3917 |
+ if (abort_code != 0 && inline_error) { |
3918 |
+ status->abort_code = abort_code; |
3919 |
+- return 0; |
3920 |
++ scb->have_error = true; |
3921 |
++ goto good; |
3922 |
+ } |
3923 |
+ |
3924 |
+ type = ntohl(xdr->type); |
3925 |
+@@ -123,13 +125,16 @@ static int xdr_decode_AFSFetchStatus(const __be32 **_bp, |
3926 |
+ data_version |= (u64)ntohl(xdr->data_version_hi) << 32; |
3927 |
+ status->data_version = data_version; |
3928 |
+ scb->have_status = true; |
3929 |
+- |
3930 |
++good: |
3931 |
++ ret = 0; |
3932 |
++advance: |
3933 |
+ *_bp = (const void *)*_bp + sizeof(*xdr); |
3934 |
+- return 0; |
3935 |
++ return ret; |
3936 |
+ |
3937 |
+ bad: |
3938 |
+ xdr_dump_bad(*_bp); |
3939 |
+- return afs_protocol_error(call, -EBADMSG, afs_eproto_bad_status); |
3940 |
++ ret = afs_protocol_error(call, -EBADMSG, afs_eproto_bad_status); |
3941 |
++ goto advance; |
3942 |
+ } |
3943 |
+ |
3944 |
+ static time64_t xdr_decode_expiry(struct afs_call *call, u32 expiry) |
3945 |
+@@ -981,16 +986,16 @@ static int afs_deliver_fs_rename(struct afs_call *call) |
3946 |
+ if (ret < 0) |
3947 |
+ return ret; |
3948 |
+ |
3949 |
+- /* unmarshall the reply once we've received all of it */ |
3950 |
++ /* If the two dirs are the same, we have two copies of the same status |
3951 |
++ * report, so we just decode it twice. |
3952 |
++ */ |
3953 |
+ bp = call->buffer; |
3954 |
+ ret = xdr_decode_AFSFetchStatus(&bp, call, call->out_dir_scb); |
3955 |
+ if (ret < 0) |
3956 |
+ return ret; |
3957 |
+- if (call->out_dir_scb != call->out_scb) { |
3958 |
+- ret = xdr_decode_AFSFetchStatus(&bp, call, call->out_scb); |
3959 |
+- if (ret < 0) |
3960 |
+- return ret; |
3961 |
+- } |
3962 |
++ ret = xdr_decode_AFSFetchStatus(&bp, call, call->out_scb); |
3963 |
++ if (ret < 0) |
3964 |
++ return ret; |
3965 |
+ xdr_decode_AFSVolSync(&bp, call->out_volsync); |
3966 |
+ |
3967 |
+ _leave(" = 0 [done]"); |
3968 |
+diff --git a/fs/afs/yfsclient.c b/fs/afs/yfsclient.c |
3969 |
+index a26126ac7bf1..83b6d67325f6 100644 |
3970 |
+--- a/fs/afs/yfsclient.c |
3971 |
++++ b/fs/afs/yfsclient.c |
3972 |
+@@ -186,13 +186,14 @@ static int xdr_decode_YFSFetchStatus(const __be32 **_bp, |
3973 |
+ const struct yfs_xdr_YFSFetchStatus *xdr = (const void *)*_bp; |
3974 |
+ struct afs_file_status *status = &scb->status; |
3975 |
+ u32 type; |
3976 |
++ int ret; |
3977 |
+ |
3978 |
+ status->abort_code = ntohl(xdr->abort_code); |
3979 |
+ if (status->abort_code != 0) { |
3980 |
+ if (status->abort_code == VNOVNODE) |
3981 |
+ status->nlink = 0; |
3982 |
+ scb->have_error = true; |
3983 |
+- return 0; |
3984 |
++ goto good; |
3985 |
+ } |
3986 |
+ |
3987 |
+ type = ntohl(xdr->type); |
3988 |
+@@ -220,13 +221,16 @@ static int xdr_decode_YFSFetchStatus(const __be32 **_bp, |
3989 |
+ status->size = xdr_to_u64(xdr->size); |
3990 |
+ status->data_version = xdr_to_u64(xdr->data_version); |
3991 |
+ scb->have_status = true; |
3992 |
+- |
3993 |
++good: |
3994 |
++ ret = 0; |
3995 |
++advance: |
3996 |
+ *_bp += xdr_size(xdr); |
3997 |
+- return 0; |
3998 |
++ return ret; |
3999 |
+ |
4000 |
+ bad: |
4001 |
+ xdr_dump_bad(*_bp); |
4002 |
+- return afs_protocol_error(call, -EBADMSG, afs_eproto_bad_status); |
4003 |
++ ret = afs_protocol_error(call, -EBADMSG, afs_eproto_bad_status); |
4004 |
++ goto advance; |
4005 |
+ } |
4006 |
+ |
4007 |
+ /* |
4008 |
+@@ -1153,11 +1157,9 @@ static int yfs_deliver_fs_rename(struct afs_call *call) |
4009 |
+ ret = xdr_decode_YFSFetchStatus(&bp, call, call->out_dir_scb); |
4010 |
+ if (ret < 0) |
4011 |
+ return ret; |
4012 |
+- if (call->out_dir_scb != call->out_scb) { |
4013 |
+- ret = xdr_decode_YFSFetchStatus(&bp, call, call->out_scb); |
4014 |
+- if (ret < 0) |
4015 |
+- return ret; |
4016 |
+- } |
4017 |
++ ret = xdr_decode_YFSFetchStatus(&bp, call, call->out_scb); |
4018 |
++ if (ret < 0) |
4019 |
++ return ret; |
4020 |
+ |
4021 |
+ xdr_decode_YFSVolSync(&bp, call->out_volsync); |
4022 |
+ _leave(" = 0 [done]"); |
4023 |
+diff --git a/fs/block_dev.c b/fs/block_dev.c |
4024 |
+index 69bf2fb6f7cd..84fe0162ff13 100644 |
4025 |
+--- a/fs/block_dev.c |
4026 |
++++ b/fs/block_dev.c |
4027 |
+@@ -34,6 +34,7 @@ |
4028 |
+ #include <linux/task_io_accounting_ops.h> |
4029 |
+ #include <linux/falloc.h> |
4030 |
+ #include <linux/uaccess.h> |
4031 |
++#include <linux/suspend.h> |
4032 |
+ #include "internal.h" |
4033 |
+ |
4034 |
+ struct bdev_inode { |
4035 |
+@@ -2001,7 +2002,8 @@ ssize_t blkdev_write_iter(struct kiocb *iocb, struct iov_iter *from) |
4036 |
+ if (bdev_read_only(I_BDEV(bd_inode))) |
4037 |
+ return -EPERM; |
4038 |
+ |
4039 |
+- if (IS_SWAPFILE(bd_inode)) |
4040 |
++ /* uswsusp needs write permission to the swap */ |
4041 |
++ if (IS_SWAPFILE(bd_inode) && !hibernation_available()) |
4042 |
+ return -ETXTBSY; |
4043 |
+ |
4044 |
+ if (!iov_iter_count(from)) |
4045 |
+diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c |
4046 |
+index 7f09147872dc..c9a3bbc8c6af 100644 |
4047 |
+--- a/fs/btrfs/block-group.c |
4048 |
++++ b/fs/btrfs/block-group.c |
4049 |
+@@ -1987,6 +1987,7 @@ int btrfs_read_block_groups(struct btrfs_fs_info *info) |
4050 |
+ btrfs_release_path(path); |
4051 |
+ } |
4052 |
+ |
4053 |
++ rcu_read_lock(); |
4054 |
+ list_for_each_entry_rcu(space_info, &info->space_info, list) { |
4055 |
+ if (!(btrfs_get_alloc_profile(info, space_info->flags) & |
4056 |
+ (BTRFS_BLOCK_GROUP_RAID10 | |
4057 |
+@@ -2007,6 +2008,7 @@ int btrfs_read_block_groups(struct btrfs_fs_info *info) |
4058 |
+ list) |
4059 |
+ inc_block_group_ro(cache, 1); |
4060 |
+ } |
4061 |
++ rcu_read_unlock(); |
4062 |
+ |
4063 |
+ btrfs_init_global_block_rsv(info); |
4064 |
+ ret = check_chunk_block_group_mappings(info); |
4065 |
+diff --git a/fs/buffer.c b/fs/buffer.c |
4066 |
+index b8d28370cfd7..a50d928af641 100644 |
4067 |
+--- a/fs/buffer.c |
4068 |
++++ b/fs/buffer.c |
4069 |
+@@ -1377,6 +1377,17 @@ void __breadahead(struct block_device *bdev, sector_t block, unsigned size) |
4070 |
+ } |
4071 |
+ EXPORT_SYMBOL(__breadahead); |
4072 |
+ |
4073 |
++void __breadahead_gfp(struct block_device *bdev, sector_t block, unsigned size, |
4074 |
++ gfp_t gfp) |
4075 |
++{ |
4076 |
++ struct buffer_head *bh = __getblk_gfp(bdev, block, size, gfp); |
4077 |
++ if (likely(bh)) { |
4078 |
++ ll_rw_block(REQ_OP_READ, REQ_RAHEAD, 1, &bh); |
4079 |
++ brelse(bh); |
4080 |
++ } |
4081 |
++} |
4082 |
++EXPORT_SYMBOL(__breadahead_gfp); |
4083 |
++ |
4084 |
+ /** |
4085 |
+ * __bread_gfp() - reads a specified block and returns the bh |
4086 |
+ * @bdev: the block_device to read from |
4087 |
+diff --git a/fs/ceph/file.c b/fs/ceph/file.c |
4088 |
+index 5a478cd06e11..7f8c4e308301 100644 |
4089 |
+--- a/fs/ceph/file.c |
4090 |
++++ b/fs/ceph/file.c |
4091 |
+@@ -1944,6 +1944,71 @@ static int is_file_size_ok(struct inode *src_inode, struct inode *dst_inode, |
4092 |
+ return 0; |
4093 |
+ } |
4094 |
+ |
4095 |
++static ssize_t ceph_do_objects_copy(struct ceph_inode_info *src_ci, u64 *src_off, |
4096 |
++ struct ceph_inode_info *dst_ci, u64 *dst_off, |
4097 |
++ struct ceph_fs_client *fsc, |
4098 |
++ size_t len, unsigned int flags) |
4099 |
++{ |
4100 |
++ struct ceph_object_locator src_oloc, dst_oloc; |
4101 |
++ struct ceph_object_id src_oid, dst_oid; |
4102 |
++ size_t bytes = 0; |
4103 |
++ u64 src_objnum, src_objoff, dst_objnum, dst_objoff; |
4104 |
++ u32 src_objlen, dst_objlen; |
4105 |
++ u32 object_size = src_ci->i_layout.object_size; |
4106 |
++ int ret; |
4107 |
++ |
4108 |
++ src_oloc.pool = src_ci->i_layout.pool_id; |
4109 |
++ src_oloc.pool_ns = ceph_try_get_string(src_ci->i_layout.pool_ns); |
4110 |
++ dst_oloc.pool = dst_ci->i_layout.pool_id; |
4111 |
++ dst_oloc.pool_ns = ceph_try_get_string(dst_ci->i_layout.pool_ns); |
4112 |
++ |
4113 |
++ while (len >= object_size) { |
4114 |
++ ceph_calc_file_object_mapping(&src_ci->i_layout, *src_off, |
4115 |
++ object_size, &src_objnum, |
4116 |
++ &src_objoff, &src_objlen); |
4117 |
++ ceph_calc_file_object_mapping(&dst_ci->i_layout, *dst_off, |
4118 |
++ object_size, &dst_objnum, |
4119 |
++ &dst_objoff, &dst_objlen); |
4120 |
++ ceph_oid_init(&src_oid); |
4121 |
++ ceph_oid_printf(&src_oid, "%llx.%08llx", |
4122 |
++ src_ci->i_vino.ino, src_objnum); |
4123 |
++ ceph_oid_init(&dst_oid); |
4124 |
++ ceph_oid_printf(&dst_oid, "%llx.%08llx", |
4125 |
++ dst_ci->i_vino.ino, dst_objnum); |
4126 |
++ /* Do an object remote copy */ |
4127 |
++ ret = ceph_osdc_copy_from(&fsc->client->osdc, |
4128 |
++ src_ci->i_vino.snap, 0, |
4129 |
++ &src_oid, &src_oloc, |
4130 |
++ CEPH_OSD_OP_FLAG_FADVISE_SEQUENTIAL | |
4131 |
++ CEPH_OSD_OP_FLAG_FADVISE_NOCACHE, |
4132 |
++ &dst_oid, &dst_oloc, |
4133 |
++ CEPH_OSD_OP_FLAG_FADVISE_SEQUENTIAL | |
4134 |
++ CEPH_OSD_OP_FLAG_FADVISE_DONTNEED, |
4135 |
++ dst_ci->i_truncate_seq, |
4136 |
++ dst_ci->i_truncate_size, |
4137 |
++ CEPH_OSD_COPY_FROM_FLAG_TRUNCATE_SEQ); |
4138 |
++ if (ret) { |
4139 |
++ if (ret == -EOPNOTSUPP) { |
4140 |
++ fsc->have_copy_from2 = false; |
4141 |
++ pr_notice("OSDs don't support copy-from2; disabling copy offload\n"); |
4142 |
++ } |
4143 |
++ dout("ceph_osdc_copy_from returned %d\n", ret); |
4144 |
++ if (!bytes) |
4145 |
++ bytes = ret; |
4146 |
++ goto out; |
4147 |
++ } |
4148 |
++ len -= object_size; |
4149 |
++ bytes += object_size; |
4150 |
++ *src_off += object_size; |
4151 |
++ *dst_off += object_size; |
4152 |
++ } |
4153 |
++ |
4154 |
++out: |
4155 |
++ ceph_oloc_destroy(&src_oloc); |
4156 |
++ ceph_oloc_destroy(&dst_oloc); |
4157 |
++ return bytes; |
4158 |
++} |
4159 |
++ |
4160 |
+ static ssize_t __ceph_copy_file_range(struct file *src_file, loff_t src_off, |
4161 |
+ struct file *dst_file, loff_t dst_off, |
4162 |
+ size_t len, unsigned int flags) |
4163 |
+@@ -1954,14 +2019,11 @@ static ssize_t __ceph_copy_file_range(struct file *src_file, loff_t src_off, |
4164 |
+ struct ceph_inode_info *dst_ci = ceph_inode(dst_inode); |
4165 |
+ struct ceph_cap_flush *prealloc_cf; |
4166 |
+ struct ceph_fs_client *src_fsc = ceph_inode_to_client(src_inode); |
4167 |
+- struct ceph_object_locator src_oloc, dst_oloc; |
4168 |
+- struct ceph_object_id src_oid, dst_oid; |
4169 |
+- loff_t endoff = 0, size; |
4170 |
+- ssize_t ret = -EIO; |
4171 |
++ loff_t size; |
4172 |
++ ssize_t ret = -EIO, bytes; |
4173 |
+ u64 src_objnum, dst_objnum, src_objoff, dst_objoff; |
4174 |
+- u32 src_objlen, dst_objlen, object_size; |
4175 |
++ u32 src_objlen, dst_objlen; |
4176 |
+ int src_got = 0, dst_got = 0, err, dirty; |
4177 |
+- bool do_final_copy = false; |
4178 |
+ |
4179 |
+ if (src_inode->i_sb != dst_inode->i_sb) { |
4180 |
+ struct ceph_fs_client *dst_fsc = ceph_inode_to_client(dst_inode); |
4181 |
+@@ -2039,22 +2101,14 @@ static ssize_t __ceph_copy_file_range(struct file *src_file, loff_t src_off, |
4182 |
+ if (ret < 0) |
4183 |
+ goto out_caps; |
4184 |
+ |
4185 |
+- size = i_size_read(dst_inode); |
4186 |
+- endoff = dst_off + len; |
4187 |
+- |
4188 |
+ /* Drop dst file cached pages */ |
4189 |
+ ret = invalidate_inode_pages2_range(dst_inode->i_mapping, |
4190 |
+ dst_off >> PAGE_SHIFT, |
4191 |
+- endoff >> PAGE_SHIFT); |
4192 |
++ (dst_off + len) >> PAGE_SHIFT); |
4193 |
+ if (ret < 0) { |
4194 |
+ dout("Failed to invalidate inode pages (%zd)\n", ret); |
4195 |
+ ret = 0; /* XXX */ |
4196 |
+ } |
4197 |
+- src_oloc.pool = src_ci->i_layout.pool_id; |
4198 |
+- src_oloc.pool_ns = ceph_try_get_string(src_ci->i_layout.pool_ns); |
4199 |
+- dst_oloc.pool = dst_ci->i_layout.pool_id; |
4200 |
+- dst_oloc.pool_ns = ceph_try_get_string(dst_ci->i_layout.pool_ns); |
4201 |
+- |
4202 |
+ ceph_calc_file_object_mapping(&src_ci->i_layout, src_off, |
4203 |
+ src_ci->i_layout.object_size, |
4204 |
+ &src_objnum, &src_objoff, &src_objlen); |
4205 |
+@@ -2073,6 +2127,8 @@ static ssize_t __ceph_copy_file_range(struct file *src_file, loff_t src_off, |
4206 |
+ * starting at the src_off |
4207 |
+ */ |
4208 |
+ if (src_objoff) { |
4209 |
++ dout("Initial partial copy of %u bytes\n", src_objlen); |
4210 |
++ |
4211 |
+ /* |
4212 |
+ * we need to temporarily drop all caps as we'll be calling |
4213 |
+ * {read,write}_iter, which will get caps again. |
4214 |
+@@ -2080,8 +2136,9 @@ static ssize_t __ceph_copy_file_range(struct file *src_file, loff_t src_off, |
4215 |
+ put_rd_wr_caps(src_ci, src_got, dst_ci, dst_got); |
4216 |
+ ret = do_splice_direct(src_file, &src_off, dst_file, |
4217 |
+ &dst_off, src_objlen, flags); |
4218 |
+- if (ret < 0) { |
4219 |
+- dout("do_splice_direct returned %d\n", err); |
4220 |
++ /* Abort on short copies or on error */ |
4221 |
++ if (ret < src_objlen) { |
4222 |
++ dout("Failed partial copy (%zd)\n", ret); |
4223 |
+ goto out; |
4224 |
+ } |
4225 |
+ len -= ret; |
4226 |
+@@ -2094,62 +2151,29 @@ static ssize_t __ceph_copy_file_range(struct file *src_file, loff_t src_off, |
4227 |
+ if (err < 0) |
4228 |
+ goto out_caps; |
4229 |
+ } |
4230 |
+- object_size = src_ci->i_layout.object_size; |
4231 |
+- while (len >= object_size) { |
4232 |
+- ceph_calc_file_object_mapping(&src_ci->i_layout, src_off, |
4233 |
+- object_size, &src_objnum, |
4234 |
+- &src_objoff, &src_objlen); |
4235 |
+- ceph_calc_file_object_mapping(&dst_ci->i_layout, dst_off, |
4236 |
+- object_size, &dst_objnum, |
4237 |
+- &dst_objoff, &dst_objlen); |
4238 |
+- ceph_oid_init(&src_oid); |
4239 |
+- ceph_oid_printf(&src_oid, "%llx.%08llx", |
4240 |
+- src_ci->i_vino.ino, src_objnum); |
4241 |
+- ceph_oid_init(&dst_oid); |
4242 |
+- ceph_oid_printf(&dst_oid, "%llx.%08llx", |
4243 |
+- dst_ci->i_vino.ino, dst_objnum); |
4244 |
+- /* Do an object remote copy */ |
4245 |
+- err = ceph_osdc_copy_from( |
4246 |
+- &src_fsc->client->osdc, |
4247 |
+- src_ci->i_vino.snap, 0, |
4248 |
+- &src_oid, &src_oloc, |
4249 |
+- CEPH_OSD_OP_FLAG_FADVISE_SEQUENTIAL | |
4250 |
+- CEPH_OSD_OP_FLAG_FADVISE_NOCACHE, |
4251 |
+- &dst_oid, &dst_oloc, |
4252 |
+- CEPH_OSD_OP_FLAG_FADVISE_SEQUENTIAL | |
4253 |
+- CEPH_OSD_OP_FLAG_FADVISE_DONTNEED, |
4254 |
+- dst_ci->i_truncate_seq, dst_ci->i_truncate_size, |
4255 |
+- CEPH_OSD_COPY_FROM_FLAG_TRUNCATE_SEQ); |
4256 |
+- if (err) { |
4257 |
+- if (err == -EOPNOTSUPP) { |
4258 |
+- src_fsc->have_copy_from2 = false; |
4259 |
+- pr_notice("OSDs don't support copy-from2; disabling copy offload\n"); |
4260 |
+- } |
4261 |
+- dout("ceph_osdc_copy_from returned %d\n", err); |
4262 |
+- if (!ret) |
4263 |
+- ret = err; |
4264 |
+- goto out_caps; |
4265 |
+- } |
4266 |
+- len -= object_size; |
4267 |
+- src_off += object_size; |
4268 |
+- dst_off += object_size; |
4269 |
+- ret += object_size; |
4270 |
+- } |
4271 |
+ |
4272 |
+- if (len) |
4273 |
+- /* We still need one final local copy */ |
4274 |
+- do_final_copy = true; |
4275 |
++ size = i_size_read(dst_inode); |
4276 |
++ bytes = ceph_do_objects_copy(src_ci, &src_off, dst_ci, &dst_off, |
4277 |
++ src_fsc, len, flags); |
4278 |
++ if (bytes <= 0) { |
4279 |
++ if (!ret) |
4280 |
++ ret = bytes; |
4281 |
++ goto out_caps; |
4282 |
++ } |
4283 |
++ dout("Copied %zu bytes out of %zu\n", bytes, len); |
4284 |
++ len -= bytes; |
4285 |
++ ret += bytes; |
4286 |
+ |
4287 |
+ file_update_time(dst_file); |
4288 |
+ inode_inc_iversion_raw(dst_inode); |
4289 |
+ |
4290 |
+- if (endoff > size) { |
4291 |
++ if (dst_off > size) { |
4292 |
+ int caps_flags = 0; |
4293 |
+ |
4294 |
+ /* Let the MDS know about dst file size change */ |
4295 |
+- if (ceph_quota_is_max_bytes_approaching(dst_inode, endoff)) |
4296 |
++ if (ceph_quota_is_max_bytes_approaching(dst_inode, dst_off)) |
4297 |
+ caps_flags |= CHECK_CAPS_NODELAY; |
4298 |
+- if (ceph_inode_set_size(dst_inode, endoff)) |
4299 |
++ if (ceph_inode_set_size(dst_inode, dst_off)) |
4300 |
+ caps_flags |= CHECK_CAPS_AUTHONLY; |
4301 |
+ if (caps_flags) |
4302 |
+ ceph_check_caps(dst_ci, caps_flags, NULL); |
4303 |
+@@ -2165,15 +2189,18 @@ static ssize_t __ceph_copy_file_range(struct file *src_file, loff_t src_off, |
4304 |
+ out_caps: |
4305 |
+ put_rd_wr_caps(src_ci, src_got, dst_ci, dst_got); |
4306 |
+ |
4307 |
+- if (do_final_copy) { |
4308 |
+- err = do_splice_direct(src_file, &src_off, dst_file, |
4309 |
+- &dst_off, len, flags); |
4310 |
+- if (err < 0) { |
4311 |
+- dout("do_splice_direct returned %d\n", err); |
4312 |
+- goto out; |
4313 |
+- } |
4314 |
+- len -= err; |
4315 |
+- ret += err; |
4316 |
++ /* |
4317 |
++ * Do the final manual copy if we still have some bytes left, unless |
4318 |
++ * there were errors in remote object copies (len >= object_size). |
4319 |
++ */ |
4320 |
++ if (len && (len < src_ci->i_layout.object_size)) { |
4321 |
++ dout("Final partial copy of %zu bytes\n", len); |
4322 |
++ bytes = do_splice_direct(src_file, &src_off, dst_file, |
4323 |
++ &dst_off, len, flags); |
4324 |
++ if (bytes > 0) |
4325 |
++ ret += bytes; |
4326 |
++ else |
4327 |
++ dout("Failed partial copy (%zd)\n", bytes); |
4328 |
+ } |
4329 |
+ |
4330 |
+ out: |
4331 |
+diff --git a/fs/cifs/smb2misc.c b/fs/cifs/smb2misc.c |
4332 |
+index 0511aaf451d4..497afb0b9960 100644 |
4333 |
+--- a/fs/cifs/smb2misc.c |
4334 |
++++ b/fs/cifs/smb2misc.c |
4335 |
+@@ -766,6 +766,20 @@ smb2_handle_cancelled_close(struct cifs_tcon *tcon, __u64 persistent_fid, |
4336 |
+ |
4337 |
+ cifs_dbg(FYI, "%s: tc_count=%d\n", __func__, tcon->tc_count); |
4338 |
+ spin_lock(&cifs_tcp_ses_lock); |
4339 |
++ if (tcon->tc_count <= 0) { |
4340 |
++ struct TCP_Server_Info *server = NULL; |
4341 |
++ |
4342 |
++ WARN_ONCE(tcon->tc_count < 0, "tcon refcount is negative"); |
4343 |
++ spin_unlock(&cifs_tcp_ses_lock); |
4344 |
++ |
4345 |
++ if (tcon->ses) |
4346 |
++ server = tcon->ses->server; |
4347 |
++ |
4348 |
++ cifs_server_dbg(FYI, "tid=%u: tcon is closing, skipping async close retry of fid %llu %llu\n", |
4349 |
++ tcon->tid, persistent_fid, volatile_fid); |
4350 |
++ |
4351 |
++ return 0; |
4352 |
++ } |
4353 |
+ tcon->tc_count++; |
4354 |
+ spin_unlock(&cifs_tcp_ses_lock); |
4355 |
+ |
4356 |
+diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c |
4357 |
+index cb3ee916f527..c97570eb2c18 100644 |
4358 |
+--- a/fs/cifs/transport.c |
4359 |
++++ b/fs/cifs/transport.c |
4360 |
+@@ -466,7 +466,7 @@ smb_send_rqst(struct TCP_Server_Info *server, int num_rqst, |
4361 |
+ struct smb_rqst *rqst, int flags) |
4362 |
+ { |
4363 |
+ struct kvec iov; |
4364 |
+- struct smb2_transform_hdr tr_hdr; |
4365 |
++ struct smb2_transform_hdr *tr_hdr; |
4366 |
+ struct smb_rqst cur_rqst[MAX_COMPOUND]; |
4367 |
+ int rc; |
4368 |
+ |
4369 |
+@@ -476,28 +476,34 @@ smb_send_rqst(struct TCP_Server_Info *server, int num_rqst, |
4370 |
+ if (num_rqst > MAX_COMPOUND - 1) |
4371 |
+ return -ENOMEM; |
4372 |
+ |
4373 |
+- memset(&cur_rqst[0], 0, sizeof(cur_rqst)); |
4374 |
+- memset(&iov, 0, sizeof(iov)); |
4375 |
+- memset(&tr_hdr, 0, sizeof(tr_hdr)); |
4376 |
+- |
4377 |
+- iov.iov_base = &tr_hdr; |
4378 |
+- iov.iov_len = sizeof(tr_hdr); |
4379 |
+- cur_rqst[0].rq_iov = &iov; |
4380 |
+- cur_rqst[0].rq_nvec = 1; |
4381 |
+- |
4382 |
+ if (!server->ops->init_transform_rq) { |
4383 |
+ cifs_server_dbg(VFS, "Encryption requested but transform " |
4384 |
+ "callback is missing\n"); |
4385 |
+ return -EIO; |
4386 |
+ } |
4387 |
+ |
4388 |
++ tr_hdr = kmalloc(sizeof(*tr_hdr), GFP_NOFS); |
4389 |
++ if (!tr_hdr) |
4390 |
++ return -ENOMEM; |
4391 |
++ |
4392 |
++ memset(&cur_rqst[0], 0, sizeof(cur_rqst)); |
4393 |
++ memset(&iov, 0, sizeof(iov)); |
4394 |
++ memset(tr_hdr, 0, sizeof(*tr_hdr)); |
4395 |
++ |
4396 |
++ iov.iov_base = tr_hdr; |
4397 |
++ iov.iov_len = sizeof(*tr_hdr); |
4398 |
++ cur_rqst[0].rq_iov = &iov; |
4399 |
++ cur_rqst[0].rq_nvec = 1; |
4400 |
++ |
4401 |
+ rc = server->ops->init_transform_rq(server, num_rqst + 1, |
4402 |
+ &cur_rqst[0], rqst); |
4403 |
+ if (rc) |
4404 |
+- return rc; |
4405 |
++ goto out; |
4406 |
+ |
4407 |
+ rc = __smb_send_rqst(server, num_rqst + 1, &cur_rqst[0]); |
4408 |
+ smb3_free_compound_rqst(num_rqst, &cur_rqst[1]); |
4409 |
++out: |
4410 |
++ kfree(tr_hdr); |
4411 |
+ return rc; |
4412 |
+ } |
4413 |
+ |
4414 |
+diff --git a/fs/ext2/xattr.c b/fs/ext2/xattr.c |
4415 |
+index 0456bc990b5e..62acbe27d8bf 100644 |
4416 |
+--- a/fs/ext2/xattr.c |
4417 |
++++ b/fs/ext2/xattr.c |
4418 |
+@@ -56,6 +56,7 @@ |
4419 |
+ |
4420 |
+ #include <linux/buffer_head.h> |
4421 |
+ #include <linux/init.h> |
4422 |
++#include <linux/printk.h> |
4423 |
+ #include <linux/slab.h> |
4424 |
+ #include <linux/mbcache.h> |
4425 |
+ #include <linux/quotaops.h> |
4426 |
+@@ -84,8 +85,8 @@ |
4427 |
+ printk("\n"); \ |
4428 |
+ } while (0) |
4429 |
+ #else |
4430 |
+-# define ea_idebug(f...) |
4431 |
+-# define ea_bdebug(f...) |
4432 |
++# define ea_idebug(inode, f...) no_printk(f) |
4433 |
++# define ea_bdebug(bh, f...) no_printk(f) |
4434 |
+ #endif |
4435 |
+ |
4436 |
+ static int ext2_xattr_set2(struct inode *, struct buffer_head *, |
4437 |
+@@ -864,8 +865,7 @@ ext2_xattr_cache_insert(struct mb_cache *cache, struct buffer_head *bh) |
4438 |
+ true); |
4439 |
+ if (error) { |
4440 |
+ if (error == -EBUSY) { |
4441 |
+- ea_bdebug(bh, "already in cache (%d cache entries)", |
4442 |
+- atomic_read(&ext2_xattr_cache->c_entry_count)); |
4443 |
++ ea_bdebug(bh, "already in cache"); |
4444 |
+ error = 0; |
4445 |
+ } |
4446 |
+ } else |
4447 |
+diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c |
4448 |
+index c5d05564cd29..37f65ad0d823 100644 |
4449 |
+--- a/fs/ext4/inode.c |
4450 |
++++ b/fs/ext4/inode.c |
4451 |
+@@ -4348,7 +4348,7 @@ make_io: |
4452 |
+ if (end > table) |
4453 |
+ end = table; |
4454 |
+ while (b <= end) |
4455 |
+- sb_breadahead(sb, b++); |
4456 |
++ sb_breadahead_unmovable(sb, b++); |
4457 |
+ } |
4458 |
+ |
4459 |
+ /* |
4460 |
+diff --git a/fs/ext4/super.c b/fs/ext4/super.c |
4461 |
+index 4f0444f3cda3..16da3b3481a4 100644 |
4462 |
+--- a/fs/ext4/super.c |
4463 |
++++ b/fs/ext4/super.c |
4464 |
+@@ -372,7 +372,8 @@ static void save_error_info(struct super_block *sb, const char *func, |
4465 |
+ unsigned int line) |
4466 |
+ { |
4467 |
+ __save_error_info(sb, func, line); |
4468 |
+- ext4_commit_super(sb, 1); |
4469 |
++ if (!bdev_read_only(sb->s_bdev)) |
4470 |
++ ext4_commit_super(sb, 1); |
4471 |
+ } |
4472 |
+ |
4473 |
+ /* |
4474 |
+@@ -4331,7 +4332,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) |
4475 |
+ /* Pre-read the descriptors into the buffer cache */ |
4476 |
+ for (i = 0; i < db_count; i++) { |
4477 |
+ block = descriptor_loc(sb, logical_sb_block, i); |
4478 |
+- sb_breadahead(sb, block); |
4479 |
++ sb_breadahead_unmovable(sb, block); |
4480 |
+ } |
4481 |
+ |
4482 |
+ for (i = 0; i < db_count; i++) { |
4483 |
+diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c |
4484 |
+index 44e84ac5c941..79aaf06004f6 100644 |
4485 |
+--- a/fs/f2fs/checkpoint.c |
4486 |
++++ b/fs/f2fs/checkpoint.c |
4487 |
+@@ -1250,20 +1250,20 @@ static void unblock_operations(struct f2fs_sb_info *sbi) |
4488 |
+ f2fs_unlock_all(sbi); |
4489 |
+ } |
4490 |
+ |
4491 |
+-void f2fs_wait_on_all_pages_writeback(struct f2fs_sb_info *sbi) |
4492 |
++void f2fs_wait_on_all_pages(struct f2fs_sb_info *sbi, int type) |
4493 |
+ { |
4494 |
+ DEFINE_WAIT(wait); |
4495 |
+ |
4496 |
+ for (;;) { |
4497 |
+ prepare_to_wait(&sbi->cp_wait, &wait, TASK_UNINTERRUPTIBLE); |
4498 |
+ |
4499 |
+- if (!get_pages(sbi, F2FS_WB_CP_DATA)) |
4500 |
++ if (!get_pages(sbi, type)) |
4501 |
+ break; |
4502 |
+ |
4503 |
+ if (unlikely(f2fs_cp_error(sbi))) |
4504 |
+ break; |
4505 |
+ |
4506 |
+- io_schedule_timeout(5*HZ); |
4507 |
++ io_schedule_timeout(HZ/50); |
4508 |
+ } |
4509 |
+ finish_wait(&sbi->cp_wait, &wait); |
4510 |
+ } |
4511 |
+@@ -1301,10 +1301,14 @@ static void update_ckpt_flags(struct f2fs_sb_info *sbi, struct cp_control *cpc) |
4512 |
+ else |
4513 |
+ __clear_ckpt_flags(ckpt, CP_ORPHAN_PRESENT_FLAG); |
4514 |
+ |
4515 |
+- if (is_sbi_flag_set(sbi, SBI_NEED_FSCK) || |
4516 |
+- is_sbi_flag_set(sbi, SBI_IS_RESIZEFS)) |
4517 |
++ if (is_sbi_flag_set(sbi, SBI_NEED_FSCK)) |
4518 |
+ __set_ckpt_flags(ckpt, CP_FSCK_FLAG); |
4519 |
+ |
4520 |
++ if (is_sbi_flag_set(sbi, SBI_IS_RESIZEFS)) |
4521 |
++ __set_ckpt_flags(ckpt, CP_RESIZEFS_FLAG); |
4522 |
++ else |
4523 |
++ __clear_ckpt_flags(ckpt, CP_RESIZEFS_FLAG); |
4524 |
++ |
4525 |
+ if (is_sbi_flag_set(sbi, SBI_CP_DISABLED)) |
4526 |
+ __set_ckpt_flags(ckpt, CP_DISABLED_FLAG); |
4527 |
+ else |
4528 |
+@@ -1384,8 +1388,6 @@ static int do_checkpoint(struct f2fs_sb_info *sbi, struct cp_control *cpc) |
4529 |
+ |
4530 |
+ /* Flush all the NAT/SIT pages */ |
4531 |
+ f2fs_sync_meta_pages(sbi, META, LONG_MAX, FS_CP_META_IO); |
4532 |
+- f2fs_bug_on(sbi, get_pages(sbi, F2FS_DIRTY_META) && |
4533 |
+- !f2fs_cp_error(sbi)); |
4534 |
+ |
4535 |
+ /* |
4536 |
+ * modify checkpoint |
4537 |
+@@ -1493,11 +1495,11 @@ static int do_checkpoint(struct f2fs_sb_info *sbi, struct cp_control *cpc) |
4538 |
+ |
4539 |
+ /* Here, we have one bio having CP pack except cp pack 2 page */ |
4540 |
+ f2fs_sync_meta_pages(sbi, META, LONG_MAX, FS_CP_META_IO); |
4541 |
+- f2fs_bug_on(sbi, get_pages(sbi, F2FS_DIRTY_META) && |
4542 |
+- !f2fs_cp_error(sbi)); |
4543 |
++ /* Wait for all dirty meta pages to be submitted for IO */ |
4544 |
++ f2fs_wait_on_all_pages(sbi, F2FS_DIRTY_META); |
4545 |
+ |
4546 |
+ /* wait for previous submitted meta pages writeback */ |
4547 |
+- f2fs_wait_on_all_pages_writeback(sbi); |
4548 |
++ f2fs_wait_on_all_pages(sbi, F2FS_WB_CP_DATA); |
4549 |
+ |
4550 |
+ /* flush all device cache */ |
4551 |
+ err = f2fs_flush_device_cache(sbi); |
4552 |
+@@ -1506,7 +1508,7 @@ static int do_checkpoint(struct f2fs_sb_info *sbi, struct cp_control *cpc) |
4553 |
+ |
4554 |
+ /* barrier and flush checkpoint cp pack 2 page if it can */ |
4555 |
+ commit_checkpoint(sbi, ckpt, start_blk); |
4556 |
+- f2fs_wait_on_all_pages_writeback(sbi); |
4557 |
++ f2fs_wait_on_all_pages(sbi, F2FS_WB_CP_DATA); |
4558 |
+ |
4559 |
+ /* |
4560 |
+ * invalidate intermediate page cache borrowed from meta inode which are |
4561 |
+diff --git a/fs/f2fs/compress.c b/fs/f2fs/compress.c |
4562 |
+index d8a64be90a50..837e14b7ef52 100644 |
4563 |
+--- a/fs/f2fs/compress.c |
4564 |
++++ b/fs/f2fs/compress.c |
4565 |
+@@ -385,16 +385,22 @@ static int f2fs_compress_pages(struct compress_ctx *cc) |
4566 |
+ for (i = 0; i < COMPRESS_DATA_RESERVED_SIZE; i++) |
4567 |
+ cc->cbuf->reserved[i] = cpu_to_le32(0); |
4568 |
+ |
4569 |
++ nr_cpages = DIV_ROUND_UP(cc->clen + COMPRESS_HEADER_SIZE, PAGE_SIZE); |
4570 |
++ |
4571 |
++ /* zero out any unused part of the last page */ |
4572 |
++ memset(&cc->cbuf->cdata[cc->clen], 0, |
4573 |
++ (nr_cpages * PAGE_SIZE) - (cc->clen + COMPRESS_HEADER_SIZE)); |
4574 |
++ |
4575 |
+ vunmap(cc->cbuf); |
4576 |
+ vunmap(cc->rbuf); |
4577 |
+ |
4578 |
+- nr_cpages = DIV_ROUND_UP(cc->clen + COMPRESS_HEADER_SIZE, PAGE_SIZE); |
4579 |
+- |
4580 |
+ for (i = nr_cpages; i < cc->nr_cpages; i++) { |
4581 |
+ f2fs_put_compressed_page(cc->cpages[i]); |
4582 |
+ cc->cpages[i] = NULL; |
4583 |
+ } |
4584 |
+ |
4585 |
++ cops->destroy_compress_ctx(cc); |
4586 |
++ |
4587 |
+ cc->nr_cpages = nr_cpages; |
4588 |
+ |
4589 |
+ trace_f2fs_compress_pages_end(cc->inode, cc->cluster_idx, |
4590 |
+@@ -474,6 +480,8 @@ out_vunmap_cbuf: |
4591 |
+ out_vunmap_rbuf: |
4592 |
+ vunmap(dic->rbuf); |
4593 |
+ out_free_dic: |
4594 |
++ if (verity) |
4595 |
++ refcount_add(dic->nr_cpages - 1, &dic->ref); |
4596 |
+ if (!verity) |
4597 |
+ f2fs_decompress_end_io(dic->rpages, dic->cluster_size, |
4598 |
+ ret, false); |
4599 |
+@@ -532,8 +540,7 @@ static bool __cluster_may_compress(struct compress_ctx *cc) |
4600 |
+ return true; |
4601 |
+ } |
4602 |
+ |
4603 |
+-/* return # of compressed block addresses */ |
4604 |
+-static int f2fs_compressed_blocks(struct compress_ctx *cc) |
4605 |
++static int __f2fs_cluster_blocks(struct compress_ctx *cc, bool compr) |
4606 |
+ { |
4607 |
+ struct dnode_of_data dn; |
4608 |
+ int ret; |
4609 |
+@@ -556,8 +563,13 @@ static int f2fs_compressed_blocks(struct compress_ctx *cc) |
4610 |
+ |
4611 |
+ blkaddr = datablock_addr(dn.inode, |
4612 |
+ dn.node_page, dn.ofs_in_node + i); |
4613 |
+- if (blkaddr != NULL_ADDR) |
4614 |
+- ret++; |
4615 |
++ if (compr) { |
4616 |
++ if (__is_valid_data_blkaddr(blkaddr)) |
4617 |
++ ret++; |
4618 |
++ } else { |
4619 |
++ if (blkaddr != NULL_ADDR) |
4620 |
++ ret++; |
4621 |
++ } |
4622 |
+ } |
4623 |
+ } |
4624 |
+ fail: |
4625 |
+@@ -565,6 +577,18 @@ fail: |
4626 |
+ return ret; |
4627 |
+ } |
4628 |
+ |
4629 |
++/* return # of compressed blocks in compressed cluster */ |
4630 |
++static int f2fs_compressed_blocks(struct compress_ctx *cc) |
4631 |
++{ |
4632 |
++ return __f2fs_cluster_blocks(cc, true); |
4633 |
++} |
4634 |
++ |
4635 |
++/* return # of valid blocks in compressed cluster */ |
4636 |
++static int f2fs_cluster_blocks(struct compress_ctx *cc, bool compr) |
4637 |
++{ |
4638 |
++ return __f2fs_cluster_blocks(cc, false); |
4639 |
++} |
4640 |
++ |
4641 |
+ int f2fs_is_compressed_cluster(struct inode *inode, pgoff_t index) |
4642 |
+ { |
4643 |
+ struct compress_ctx cc = { |
4644 |
+@@ -574,7 +598,7 @@ int f2fs_is_compressed_cluster(struct inode *inode, pgoff_t index) |
4645 |
+ .cluster_idx = index >> F2FS_I(inode)->i_log_cluster_size, |
4646 |
+ }; |
4647 |
+ |
4648 |
+- return f2fs_compressed_blocks(&cc); |
4649 |
++ return f2fs_cluster_blocks(&cc, false); |
4650 |
+ } |
4651 |
+ |
4652 |
+ static bool cluster_may_compress(struct compress_ctx *cc) |
4653 |
+@@ -623,7 +647,7 @@ static int prepare_compress_overwrite(struct compress_ctx *cc, |
4654 |
+ bool prealloc; |
4655 |
+ |
4656 |
+ retry: |
4657 |
+- ret = f2fs_compressed_blocks(cc); |
4658 |
++ ret = f2fs_cluster_blocks(cc, false); |
4659 |
+ if (ret <= 0) |
4660 |
+ return ret; |
4661 |
+ |
4662 |
+@@ -772,7 +796,6 @@ static int f2fs_write_compressed_pages(struct compress_ctx *cc, |
4663 |
+ .encrypted_page = NULL, |
4664 |
+ .compressed_page = NULL, |
4665 |
+ .submitted = false, |
4666 |
+- .need_lock = LOCK_RETRY, |
4667 |
+ .io_type = io_type, |
4668 |
+ .io_wbc = wbc, |
4669 |
+ .encrypted = f2fs_encrypted_file(cc->inode), |
4670 |
+@@ -785,9 +808,10 @@ static int f2fs_write_compressed_pages(struct compress_ctx *cc, |
4671 |
+ loff_t psize; |
4672 |
+ int i, err; |
4673 |
+ |
4674 |
+- set_new_dnode(&dn, cc->inode, NULL, NULL, 0); |
4675 |
++ if (!f2fs_trylock_op(sbi)) |
4676 |
++ return -EAGAIN; |
4677 |
+ |
4678 |
+- f2fs_lock_op(sbi); |
4679 |
++ set_new_dnode(&dn, cc->inode, NULL, NULL, 0); |
4680 |
+ |
4681 |
+ err = f2fs_get_dnode_of_data(&dn, start_idx, LOOKUP_NODE); |
4682 |
+ if (err) |
4683 |
+@@ -845,7 +869,7 @@ static int f2fs_write_compressed_pages(struct compress_ctx *cc, |
4684 |
+ |
4685 |
+ blkaddr = datablock_addr(dn.inode, dn.node_page, |
4686 |
+ dn.ofs_in_node); |
4687 |
+- fio.page = cic->rpages[i]; |
4688 |
++ fio.page = cc->rpages[i]; |
4689 |
+ fio.old_blkaddr = blkaddr; |
4690 |
+ |
4691 |
+ /* cluster header */ |
4692 |
+@@ -984,6 +1008,15 @@ retry_write: |
4693 |
+ unlock_page(cc->rpages[i]); |
4694 |
+ ret = 0; |
4695 |
+ } else if (ret == -EAGAIN) { |
4696 |
++ /* |
4697 |
++ * for quota file, just redirty left pages to |
4698 |
++ * avoid deadlock caused by cluster update race |
4699 |
++ * from foreground operation. |
4700 |
++ */ |
4701 |
++ if (IS_NOQUOTA(cc->inode)) { |
4702 |
++ err = 0; |
4703 |
++ goto out_err; |
4704 |
++ } |
4705 |
+ ret = 0; |
4706 |
+ cond_resched(); |
4707 |
+ congestion_wait(BLK_RW_ASYNC, HZ/50); |
4708 |
+@@ -992,16 +1025,12 @@ retry_write: |
4709 |
+ goto retry_write; |
4710 |
+ } |
4711 |
+ err = ret; |
4712 |
+- goto out_fail; |
4713 |
++ goto out_err; |
4714 |
+ } |
4715 |
+ |
4716 |
+ *submitted += _submitted; |
4717 |
+ } |
4718 |
+ return 0; |
4719 |
+- |
4720 |
+-out_fail: |
4721 |
+- /* TODO: revoke partially updated block addresses */ |
4722 |
+- BUG_ON(compr_blocks); |
4723 |
+ out_err: |
4724 |
+ for (++i; i < cc->cluster_size; i++) { |
4725 |
+ if (!cc->rpages[i]) |
4726 |
+diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c |
4727 |
+index b27b72107911..34990866cfe9 100644 |
4728 |
+--- a/fs/f2fs/data.c |
4729 |
++++ b/fs/f2fs/data.c |
4730 |
+@@ -191,12 +191,37 @@ static void f2fs_verify_pages(struct page **rpages, unsigned int cluster_size) |
4731 |
+ |
4732 |
+ static void f2fs_verify_bio(struct bio *bio) |
4733 |
+ { |
4734 |
+- struct page *page = bio_first_page_all(bio); |
4735 |
+- struct decompress_io_ctx *dic = |
4736 |
+- (struct decompress_io_ctx *)page_private(page); |
4737 |
++ struct bio_vec *bv; |
4738 |
++ struct bvec_iter_all iter_all; |
4739 |
++ |
4740 |
++ bio_for_each_segment_all(bv, bio, iter_all) { |
4741 |
++ struct page *page = bv->bv_page; |
4742 |
++ struct decompress_io_ctx *dic; |
4743 |
++ |
4744 |
++ dic = (struct decompress_io_ctx *)page_private(page); |
4745 |
++ |
4746 |
++ if (dic) { |
4747 |
++ if (refcount_dec_not_one(&dic->ref)) |
4748 |
++ continue; |
4749 |
++ f2fs_verify_pages(dic->rpages, |
4750 |
++ dic->cluster_size); |
4751 |
++ f2fs_free_dic(dic); |
4752 |
++ continue; |
4753 |
++ } |
4754 |
++ |
4755 |
++ if (bio->bi_status || PageError(page)) |
4756 |
++ goto clear_uptodate; |
4757 |
+ |
4758 |
+- f2fs_verify_pages(dic->rpages, dic->cluster_size); |
4759 |
+- f2fs_free_dic(dic); |
4760 |
++ if (fsverity_verify_page(page)) { |
4761 |
++ SetPageUptodate(page); |
4762 |
++ goto unlock; |
4763 |
++ } |
4764 |
++clear_uptodate: |
4765 |
++ ClearPageUptodate(page); |
4766 |
++ ClearPageError(page); |
4767 |
++unlock: |
4768 |
++ unlock_page(page); |
4769 |
++ } |
4770 |
+ } |
4771 |
+ #endif |
4772 |
+ |
4773 |
+diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h |
4774 |
+index 5355be6b6755..71801a1709f0 100644 |
4775 |
+--- a/fs/f2fs/f2fs.h |
4776 |
++++ b/fs/f2fs/f2fs.h |
4777 |
+@@ -100,6 +100,7 @@ extern const char *f2fs_fault_name[FAULT_MAX]; |
4778 |
+ #define F2FS_MOUNT_INLINE_XATTR_SIZE 0x00800000 |
4779 |
+ #define F2FS_MOUNT_RESERVE_ROOT 0x01000000 |
4780 |
+ #define F2FS_MOUNT_DISABLE_CHECKPOINT 0x02000000 |
4781 |
++#define F2FS_MOUNT_NORECOVERY 0x04000000 |
4782 |
+ |
4783 |
+ #define F2FS_OPTION(sbi) ((sbi)->mount_opt) |
4784 |
+ #define clear_opt(sbi, option) (F2FS_OPTION(sbi).opt &= ~F2FS_MOUNT_##option) |
4785 |
+@@ -675,6 +676,44 @@ enum { |
4786 |
+ MAX_GC_FAILURE |
4787 |
+ }; |
4788 |
+ |
4789 |
++/* used for f2fs_inode_info->flags */ |
4790 |
++enum { |
4791 |
++ FI_NEW_INODE, /* indicate newly allocated inode */ |
4792 |
++ FI_DIRTY_INODE, /* indicate inode is dirty or not */ |
4793 |
++ FI_AUTO_RECOVER, /* indicate inode is recoverable */ |
4794 |
++ FI_DIRTY_DIR, /* indicate directory has dirty pages */ |
4795 |
++ FI_INC_LINK, /* need to increment i_nlink */ |
4796 |
++ FI_ACL_MODE, /* indicate acl mode */ |
4797 |
++ FI_NO_ALLOC, /* should not allocate any blocks */ |
4798 |
++ FI_FREE_NID, /* free allocated nide */ |
4799 |
++ FI_NO_EXTENT, /* not to use the extent cache */ |
4800 |
++ FI_INLINE_XATTR, /* used for inline xattr */ |
4801 |
++ FI_INLINE_DATA, /* used for inline data*/ |
4802 |
++ FI_INLINE_DENTRY, /* used for inline dentry */ |
4803 |
++ FI_APPEND_WRITE, /* inode has appended data */ |
4804 |
++ FI_UPDATE_WRITE, /* inode has in-place-update data */ |
4805 |
++ FI_NEED_IPU, /* used for ipu per file */ |
4806 |
++ FI_ATOMIC_FILE, /* indicate atomic file */ |
4807 |
++ FI_ATOMIC_COMMIT, /* indicate the state of atomical committing */ |
4808 |
++ FI_VOLATILE_FILE, /* indicate volatile file */ |
4809 |
++ FI_FIRST_BLOCK_WRITTEN, /* indicate #0 data block was written */ |
4810 |
++ FI_DROP_CACHE, /* drop dirty page cache */ |
4811 |
++ FI_DATA_EXIST, /* indicate data exists */ |
4812 |
++ FI_INLINE_DOTS, /* indicate inline dot dentries */ |
4813 |
++ FI_DO_DEFRAG, /* indicate defragment is running */ |
4814 |
++ FI_DIRTY_FILE, /* indicate regular/symlink has dirty pages */ |
4815 |
++ FI_NO_PREALLOC, /* indicate skipped preallocated blocks */ |
4816 |
++ FI_HOT_DATA, /* indicate file is hot */ |
4817 |
++ FI_EXTRA_ATTR, /* indicate file has extra attribute */ |
4818 |
++ FI_PROJ_INHERIT, /* indicate file inherits projectid */ |
4819 |
++ FI_PIN_FILE, /* indicate file should not be gced */ |
4820 |
++ FI_ATOMIC_REVOKE_REQUEST, /* request to drop atomic data */ |
4821 |
++ FI_VERITY_IN_PROGRESS, /* building fs-verity Merkle tree */ |
4822 |
++ FI_COMPRESSED_FILE, /* indicate file's data can be compressed */ |
4823 |
++ FI_MMAP_FILE, /* indicate file was mmapped */ |
4824 |
++ FI_MAX, /* max flag, never be used */ |
4825 |
++}; |
4826 |
++ |
4827 |
+ struct f2fs_inode_info { |
4828 |
+ struct inode vfs_inode; /* serve a vfs inode */ |
4829 |
+ unsigned long i_flags; /* keep an inode flags for ioctl */ |
4830 |
+@@ -687,7 +726,7 @@ struct f2fs_inode_info { |
4831 |
+ umode_t i_acl_mode; /* keep file acl mode temporarily */ |
4832 |
+ |
4833 |
+ /* Use below internally in f2fs*/ |
4834 |
+- unsigned long flags; /* use to pass per-file flags */ |
4835 |
++ unsigned long flags[BITS_TO_LONGS(FI_MAX)]; /* use to pass per-file flags */ |
4836 |
+ struct rw_semaphore i_sem; /* protect fi info */ |
4837 |
+ atomic_t dirty_pages; /* # of dirty pages */ |
4838 |
+ f2fs_hash_t chash; /* hash value of given file name */ |
4839 |
+@@ -2497,43 +2536,6 @@ static inline __u32 f2fs_mask_flags(umode_t mode, __u32 flags) |
4840 |
+ return flags & F2FS_OTHER_FLMASK; |
4841 |
+ } |
4842 |
+ |
4843 |
+-/* used for f2fs_inode_info->flags */ |
4844 |
+-enum { |
4845 |
+- FI_NEW_INODE, /* indicate newly allocated inode */ |
4846 |
+- FI_DIRTY_INODE, /* indicate inode is dirty or not */ |
4847 |
+- FI_AUTO_RECOVER, /* indicate inode is recoverable */ |
4848 |
+- FI_DIRTY_DIR, /* indicate directory has dirty pages */ |
4849 |
+- FI_INC_LINK, /* need to increment i_nlink */ |
4850 |
+- FI_ACL_MODE, /* indicate acl mode */ |
4851 |
+- FI_NO_ALLOC, /* should not allocate any blocks */ |
4852 |
+- FI_FREE_NID, /* free allocated nide */ |
4853 |
+- FI_NO_EXTENT, /* not to use the extent cache */ |
4854 |
+- FI_INLINE_XATTR, /* used for inline xattr */ |
4855 |
+- FI_INLINE_DATA, /* used for inline data*/ |
4856 |
+- FI_INLINE_DENTRY, /* used for inline dentry */ |
4857 |
+- FI_APPEND_WRITE, /* inode has appended data */ |
4858 |
+- FI_UPDATE_WRITE, /* inode has in-place-update data */ |
4859 |
+- FI_NEED_IPU, /* used for ipu per file */ |
4860 |
+- FI_ATOMIC_FILE, /* indicate atomic file */ |
4861 |
+- FI_ATOMIC_COMMIT, /* indicate the state of atomical committing */ |
4862 |
+- FI_VOLATILE_FILE, /* indicate volatile file */ |
4863 |
+- FI_FIRST_BLOCK_WRITTEN, /* indicate #0 data block was written */ |
4864 |
+- FI_DROP_CACHE, /* drop dirty page cache */ |
4865 |
+- FI_DATA_EXIST, /* indicate data exists */ |
4866 |
+- FI_INLINE_DOTS, /* indicate inline dot dentries */ |
4867 |
+- FI_DO_DEFRAG, /* indicate defragment is running */ |
4868 |
+- FI_DIRTY_FILE, /* indicate regular/symlink has dirty pages */ |
4869 |
+- FI_NO_PREALLOC, /* indicate skipped preallocated blocks */ |
4870 |
+- FI_HOT_DATA, /* indicate file is hot */ |
4871 |
+- FI_EXTRA_ATTR, /* indicate file has extra attribute */ |
4872 |
+- FI_PROJ_INHERIT, /* indicate file inherits projectid */ |
4873 |
+- FI_PIN_FILE, /* indicate file should not be gced */ |
4874 |
+- FI_ATOMIC_REVOKE_REQUEST, /* request to drop atomic data */ |
4875 |
+- FI_VERITY_IN_PROGRESS, /* building fs-verity Merkle tree */ |
4876 |
+- FI_COMPRESSED_FILE, /* indicate file's data can be compressed */ |
4877 |
+- FI_MMAP_FILE, /* indicate file was mmapped */ |
4878 |
+-}; |
4879 |
+- |
4880 |
+ static inline void __mark_inode_dirty_flag(struct inode *inode, |
4881 |
+ int flag, bool set) |
4882 |
+ { |
4883 |
+@@ -2555,20 +2557,18 @@ static inline void __mark_inode_dirty_flag(struct inode *inode, |
4884 |
+ |
4885 |
+ static inline void set_inode_flag(struct inode *inode, int flag) |
4886 |
+ { |
4887 |
+- if (!test_bit(flag, &F2FS_I(inode)->flags)) |
4888 |
+- set_bit(flag, &F2FS_I(inode)->flags); |
4889 |
++ test_and_set_bit(flag, F2FS_I(inode)->flags); |
4890 |
+ __mark_inode_dirty_flag(inode, flag, true); |
4891 |
+ } |
4892 |
+ |
4893 |
+ static inline int is_inode_flag_set(struct inode *inode, int flag) |
4894 |
+ { |
4895 |
+- return test_bit(flag, &F2FS_I(inode)->flags); |
4896 |
++ return test_bit(flag, F2FS_I(inode)->flags); |
4897 |
+ } |
4898 |
+ |
4899 |
+ static inline void clear_inode_flag(struct inode *inode, int flag) |
4900 |
+ { |
4901 |
+- if (test_bit(flag, &F2FS_I(inode)->flags)) |
4902 |
+- clear_bit(flag, &F2FS_I(inode)->flags); |
4903 |
++ test_and_clear_bit(flag, F2FS_I(inode)->flags); |
4904 |
+ __mark_inode_dirty_flag(inode, flag, false); |
4905 |
+ } |
4906 |
+ |
4907 |
+@@ -2659,19 +2659,19 @@ static inline void get_inline_info(struct inode *inode, struct f2fs_inode *ri) |
4908 |
+ struct f2fs_inode_info *fi = F2FS_I(inode); |
4909 |
+ |
4910 |
+ if (ri->i_inline & F2FS_INLINE_XATTR) |
4911 |
+- set_bit(FI_INLINE_XATTR, &fi->flags); |
4912 |
++ set_bit(FI_INLINE_XATTR, fi->flags); |
4913 |
+ if (ri->i_inline & F2FS_INLINE_DATA) |
4914 |
+- set_bit(FI_INLINE_DATA, &fi->flags); |
4915 |
++ set_bit(FI_INLINE_DATA, fi->flags); |
4916 |
+ if (ri->i_inline & F2FS_INLINE_DENTRY) |
4917 |
+- set_bit(FI_INLINE_DENTRY, &fi->flags); |
4918 |
++ set_bit(FI_INLINE_DENTRY, fi->flags); |
4919 |
+ if (ri->i_inline & F2FS_DATA_EXIST) |
4920 |
+- set_bit(FI_DATA_EXIST, &fi->flags); |
4921 |
++ set_bit(FI_DATA_EXIST, fi->flags); |
4922 |
+ if (ri->i_inline & F2FS_INLINE_DOTS) |
4923 |
+- set_bit(FI_INLINE_DOTS, &fi->flags); |
4924 |
++ set_bit(FI_INLINE_DOTS, fi->flags); |
4925 |
+ if (ri->i_inline & F2FS_EXTRA_ATTR) |
4926 |
+- set_bit(FI_EXTRA_ATTR, &fi->flags); |
4927 |
++ set_bit(FI_EXTRA_ATTR, fi->flags); |
4928 |
+ if (ri->i_inline & F2FS_PIN_FILE) |
4929 |
+- set_bit(FI_PIN_FILE, &fi->flags); |
4930 |
++ set_bit(FI_PIN_FILE, fi->flags); |
4931 |
+ } |
4932 |
+ |
4933 |
+ static inline void set_raw_inline(struct inode *inode, struct f2fs_inode *ri) |
4934 |
+@@ -3308,7 +3308,7 @@ int f2fs_get_valid_checkpoint(struct f2fs_sb_info *sbi); |
4935 |
+ void f2fs_update_dirty_page(struct inode *inode, struct page *page); |
4936 |
+ void f2fs_remove_dirty_inode(struct inode *inode); |
4937 |
+ int f2fs_sync_dirty_inodes(struct f2fs_sb_info *sbi, enum inode_type type); |
4938 |
+-void f2fs_wait_on_all_pages_writeback(struct f2fs_sb_info *sbi); |
4939 |
++void f2fs_wait_on_all_pages(struct f2fs_sb_info *sbi, int type); |
4940 |
+ int f2fs_write_checkpoint(struct f2fs_sb_info *sbi, struct cp_control *cpc); |
4941 |
+ void f2fs_init_ino_entry_info(struct f2fs_sb_info *sbi); |
4942 |
+ int __init f2fs_create_checkpoint_caches(void); |
4943 |
+diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c |
4944 |
+index 0d4da644df3b..a41c633ac6cf 100644 |
4945 |
+--- a/fs/f2fs/file.c |
4946 |
++++ b/fs/f2fs/file.c |
4947 |
+@@ -1787,12 +1787,15 @@ static int f2fs_file_flush(struct file *file, fl_owner_t id) |
4948 |
+ static int f2fs_setflags_common(struct inode *inode, u32 iflags, u32 mask) |
4949 |
+ { |
4950 |
+ struct f2fs_inode_info *fi = F2FS_I(inode); |
4951 |
++ u32 masked_flags = fi->i_flags & mask; |
4952 |
++ |
4953 |
++ f2fs_bug_on(F2FS_I_SB(inode), (iflags & ~mask)); |
4954 |
+ |
4955 |
+ /* Is it quota file? Do not allow user to mess with it */ |
4956 |
+ if (IS_NOQUOTA(inode)) |
4957 |
+ return -EPERM; |
4958 |
+ |
4959 |
+- if ((iflags ^ fi->i_flags) & F2FS_CASEFOLD_FL) { |
4960 |
++ if ((iflags ^ masked_flags) & F2FS_CASEFOLD_FL) { |
4961 |
+ if (!f2fs_sb_has_casefold(F2FS_I_SB(inode))) |
4962 |
+ return -EOPNOTSUPP; |
4963 |
+ if (!f2fs_empty_dir(inode)) |
4964 |
+@@ -1806,9 +1809,9 @@ static int f2fs_setflags_common(struct inode *inode, u32 iflags, u32 mask) |
4965 |
+ return -EINVAL; |
4966 |
+ } |
4967 |
+ |
4968 |
+- if ((iflags ^ fi->i_flags) & F2FS_COMPR_FL) { |
4969 |
++ if ((iflags ^ masked_flags) & F2FS_COMPR_FL) { |
4970 |
+ if (S_ISREG(inode->i_mode) && |
4971 |
+- (fi->i_flags & F2FS_COMPR_FL || i_size_read(inode) || |
4972 |
++ (masked_flags & F2FS_COMPR_FL || i_size_read(inode) || |
4973 |
+ F2FS_HAS_BLOCKS(inode))) |
4974 |
+ return -EINVAL; |
4975 |
+ if (iflags & F2FS_NOCOMP_FL) |
4976 |
+@@ -1825,8 +1828,8 @@ static int f2fs_setflags_common(struct inode *inode, u32 iflags, u32 mask) |
4977 |
+ set_compress_context(inode); |
4978 |
+ } |
4979 |
+ } |
4980 |
+- if ((iflags ^ fi->i_flags) & F2FS_NOCOMP_FL) { |
4981 |
+- if (fi->i_flags & F2FS_COMPR_FL) |
4982 |
++ if ((iflags ^ masked_flags) & F2FS_NOCOMP_FL) { |
4983 |
++ if (masked_flags & F2FS_COMPR_FL) |
4984 |
+ return -EINVAL; |
4985 |
+ } |
4986 |
+ |
4987 |
+diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c |
4988 |
+index db8725d473b5..3cced15efebc 100644 |
4989 |
+--- a/fs/f2fs/gc.c |
4990 |
++++ b/fs/f2fs/gc.c |
4991 |
+@@ -1018,8 +1018,8 @@ next_step: |
4992 |
+ * race condition along with SSR block allocation. |
4993 |
+ */ |
4994 |
+ if ((gc_type == BG_GC && has_not_enough_free_secs(sbi, 0, 0)) || |
4995 |
+- get_valid_blocks(sbi, segno, false) == |
4996 |
+- sbi->blocks_per_seg) |
4997 |
++ get_valid_blocks(sbi, segno, true) == |
4998 |
++ BLKS_PER_SEC(sbi)) |
4999 |
+ return submitted; |
5000 |
+ |
5001 |
+ if (check_valid_map(sbi, segno, off) == 0) |
5002 |
+@@ -1434,12 +1434,19 @@ static int free_segment_range(struct f2fs_sb_info *sbi, unsigned int start, |
5003 |
+ static void update_sb_metadata(struct f2fs_sb_info *sbi, int secs) |
5004 |
+ { |
5005 |
+ struct f2fs_super_block *raw_sb = F2FS_RAW_SUPER(sbi); |
5006 |
+- int section_count = le32_to_cpu(raw_sb->section_count); |
5007 |
+- int segment_count = le32_to_cpu(raw_sb->segment_count); |
5008 |
+- int segment_count_main = le32_to_cpu(raw_sb->segment_count_main); |
5009 |
+- long long block_count = le64_to_cpu(raw_sb->block_count); |
5010 |
++ int section_count; |
5011 |
++ int segment_count; |
5012 |
++ int segment_count_main; |
5013 |
++ long long block_count; |
5014 |
+ int segs = secs * sbi->segs_per_sec; |
5015 |
+ |
5016 |
++ down_write(&sbi->sb_lock); |
5017 |
++ |
5018 |
++ section_count = le32_to_cpu(raw_sb->section_count); |
5019 |
++ segment_count = le32_to_cpu(raw_sb->segment_count); |
5020 |
++ segment_count_main = le32_to_cpu(raw_sb->segment_count_main); |
5021 |
++ block_count = le64_to_cpu(raw_sb->block_count); |
5022 |
++ |
5023 |
+ raw_sb->section_count = cpu_to_le32(section_count + secs); |
5024 |
+ raw_sb->segment_count = cpu_to_le32(segment_count + segs); |
5025 |
+ raw_sb->segment_count_main = cpu_to_le32(segment_count_main + segs); |
5026 |
+@@ -1453,6 +1460,8 @@ static void update_sb_metadata(struct f2fs_sb_info *sbi, int secs) |
5027 |
+ raw_sb->devs[last_dev].total_segments = |
5028 |
+ cpu_to_le32(dev_segs + segs); |
5029 |
+ } |
5030 |
++ |
5031 |
++ up_write(&sbi->sb_lock); |
5032 |
+ } |
5033 |
+ |
5034 |
+ static void update_fs_metadata(struct f2fs_sb_info *sbi, int secs) |
5035 |
+@@ -1570,11 +1579,17 @@ int f2fs_resize_fs(struct f2fs_sb_info *sbi, __u64 block_count) |
5036 |
+ goto out; |
5037 |
+ } |
5038 |
+ |
5039 |
++ mutex_lock(&sbi->cp_mutex); |
5040 |
+ update_fs_metadata(sbi, -secs); |
5041 |
+ clear_sbi_flag(sbi, SBI_IS_RESIZEFS); |
5042 |
++ set_sbi_flag(sbi, SBI_IS_DIRTY); |
5043 |
++ mutex_unlock(&sbi->cp_mutex); |
5044 |
++ |
5045 |
+ err = f2fs_sync_fs(sbi->sb, 1); |
5046 |
+ if (err) { |
5047 |
++ mutex_lock(&sbi->cp_mutex); |
5048 |
+ update_fs_metadata(sbi, secs); |
5049 |
++ mutex_unlock(&sbi->cp_mutex); |
5050 |
+ update_sb_metadata(sbi, secs); |
5051 |
+ f2fs_commit_super(sbi, false); |
5052 |
+ } |
5053 |
+diff --git a/fs/f2fs/inode.c b/fs/f2fs/inode.c |
5054 |
+index 78c3f1d70f1d..901e9f4ce12b 100644 |
5055 |
+--- a/fs/f2fs/inode.c |
5056 |
++++ b/fs/f2fs/inode.c |
5057 |
+@@ -345,7 +345,7 @@ static int do_read_inode(struct inode *inode) |
5058 |
+ fi->i_flags = le32_to_cpu(ri->i_flags); |
5059 |
+ if (S_ISREG(inode->i_mode)) |
5060 |
+ fi->i_flags &= ~F2FS_PROJINHERIT_FL; |
5061 |
+- fi->flags = 0; |
5062 |
++ bitmap_zero(fi->flags, FI_MAX); |
5063 |
+ fi->i_advise = ri->i_advise; |
5064 |
+ fi->i_pino = le32_to_cpu(ri->i_pino); |
5065 |
+ fi->i_dir_level = ri->i_dir_level; |
5066 |
+diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c |
5067 |
+index 9d02cdcdbb07..e58c4c628834 100644 |
5068 |
+--- a/fs/f2fs/node.c |
5069 |
++++ b/fs/f2fs/node.c |
5070 |
+@@ -1562,15 +1562,16 @@ static int __write_node_page(struct page *page, bool atomic, bool *submitted, |
5071 |
+ if (atomic && !test_opt(sbi, NOBARRIER)) |
5072 |
+ fio.op_flags |= REQ_PREFLUSH | REQ_FUA; |
5073 |
+ |
5074 |
+- set_page_writeback(page); |
5075 |
+- ClearPageError(page); |
5076 |
+- |
5077 |
++ /* should add to global list before clearing PAGECACHE status */ |
5078 |
+ if (f2fs_in_warm_node_list(sbi, page)) { |
5079 |
+ seq = f2fs_add_fsync_node_entry(sbi, page); |
5080 |
+ if (seq_id) |
5081 |
+ *seq_id = seq; |
5082 |
+ } |
5083 |
+ |
5084 |
++ set_page_writeback(page); |
5085 |
++ ClearPageError(page); |
5086 |
++ |
5087 |
+ fio.old_blkaddr = ni.blk_addr; |
5088 |
+ f2fs_do_write_node_page(nid, &fio); |
5089 |
+ set_node_addr(sbi, &ni, fio.new_blkaddr, is_fsync_dnode(page)); |
5090 |
+diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c |
5091 |
+index 65a7a432dfee..8deb0a260d92 100644 |
5092 |
+--- a/fs/f2fs/super.c |
5093 |
++++ b/fs/f2fs/super.c |
5094 |
+@@ -446,7 +446,7 @@ static int parse_options(struct super_block *sb, char *options) |
5095 |
+ break; |
5096 |
+ case Opt_norecovery: |
5097 |
+ /* this option mounts f2fs with ro */ |
5098 |
+- set_opt(sbi, DISABLE_ROLL_FORWARD); |
5099 |
++ set_opt(sbi, NORECOVERY); |
5100 |
+ if (!f2fs_readonly(sb)) |
5101 |
+ return -EINVAL; |
5102 |
+ break; |
5103 |
+@@ -1172,7 +1172,7 @@ static void f2fs_put_super(struct super_block *sb) |
5104 |
+ /* our cp_error case, we can wait for any writeback page */ |
5105 |
+ f2fs_flush_merged_writes(sbi); |
5106 |
+ |
5107 |
+- f2fs_wait_on_all_pages_writeback(sbi); |
5108 |
++ f2fs_wait_on_all_pages(sbi, F2FS_WB_CP_DATA); |
5109 |
+ |
5110 |
+ f2fs_bug_on(sbi, sbi->fsync_node_num); |
5111 |
+ |
5112 |
+@@ -1446,6 +1446,8 @@ static int f2fs_show_options(struct seq_file *seq, struct dentry *root) |
5113 |
+ } |
5114 |
+ if (test_opt(sbi, DISABLE_ROLL_FORWARD)) |
5115 |
+ seq_puts(seq, ",disable_roll_forward"); |
5116 |
++ if (test_opt(sbi, NORECOVERY)) |
5117 |
++ seq_puts(seq, ",norecovery"); |
5118 |
+ if (test_opt(sbi, DISCARD)) |
5119 |
+ seq_puts(seq, ",discard"); |
5120 |
+ else |
5121 |
+@@ -1927,6 +1929,7 @@ static ssize_t f2fs_quota_write(struct super_block *sb, int type, |
5122 |
+ int offset = off & (sb->s_blocksize - 1); |
5123 |
+ size_t towrite = len; |
5124 |
+ struct page *page; |
5125 |
++ void *fsdata = NULL; |
5126 |
+ char *kaddr; |
5127 |
+ int err = 0; |
5128 |
+ int tocopy; |
5129 |
+@@ -1936,7 +1939,7 @@ static ssize_t f2fs_quota_write(struct super_block *sb, int type, |
5130 |
+ towrite); |
5131 |
+ retry: |
5132 |
+ err = a_ops->write_begin(NULL, mapping, off, tocopy, 0, |
5133 |
+- &page, NULL); |
5134 |
++ &page, &fsdata); |
5135 |
+ if (unlikely(err)) { |
5136 |
+ if (err == -ENOMEM) { |
5137 |
+ congestion_wait(BLK_RW_ASYNC, HZ/50); |
5138 |
+@@ -1952,7 +1955,7 @@ retry: |
5139 |
+ flush_dcache_page(page); |
5140 |
+ |
5141 |
+ a_ops->write_end(NULL, mapping, off, tocopy, tocopy, |
5142 |
+- page, NULL); |
5143 |
++ page, fsdata); |
5144 |
+ offset = 0; |
5145 |
+ towrite -= tocopy; |
5146 |
+ off += tocopy; |
5147 |
+@@ -3598,7 +3601,8 @@ try_onemore: |
5148 |
+ goto reset_checkpoint; |
5149 |
+ |
5150 |
+ /* recover fsynced data */ |
5151 |
+- if (!test_opt(sbi, DISABLE_ROLL_FORWARD)) { |
5152 |
++ if (!test_opt(sbi, DISABLE_ROLL_FORWARD) && |
5153 |
++ !test_opt(sbi, NORECOVERY)) { |
5154 |
+ /* |
5155 |
+ * mount should be failed, when device has readonly mode, and |
5156 |
+ * previous checkpoint was not done by clean system shutdown. |
5157 |
+diff --git a/fs/gfs2/log.c b/fs/gfs2/log.c |
5158 |
+index 08dd6a430234..60d911e293e6 100644 |
5159 |
+--- a/fs/gfs2/log.c |
5160 |
++++ b/fs/gfs2/log.c |
5161 |
+@@ -104,16 +104,22 @@ __acquires(&sdp->sd_ail_lock) |
5162 |
+ gfs2_assert(sdp, bd->bd_tr == tr); |
5163 |
+ |
5164 |
+ if (!buffer_busy(bh)) { |
5165 |
+- if (!buffer_uptodate(bh) && |
5166 |
+- !test_and_set_bit(SDF_AIL1_IO_ERROR, |
5167 |
++ if (buffer_uptodate(bh)) { |
5168 |
++ list_move(&bd->bd_ail_st_list, |
5169 |
++ &tr->tr_ail2_list); |
5170 |
++ continue; |
5171 |
++ } |
5172 |
++ if (!test_and_set_bit(SDF_AIL1_IO_ERROR, |
5173 |
+ &sdp->sd_flags)) { |
5174 |
+ gfs2_io_error_bh(sdp, bh); |
5175 |
+ *withdraw = true; |
5176 |
+ } |
5177 |
+- list_move(&bd->bd_ail_st_list, &tr->tr_ail2_list); |
5178 |
+- continue; |
5179 |
+ } |
5180 |
+ |
5181 |
++ if (gfs2_withdrawn(sdp)) { |
5182 |
++ gfs2_remove_from_ail(bd); |
5183 |
++ continue; |
5184 |
++ } |
5185 |
+ if (!buffer_dirty(bh)) |
5186 |
+ continue; |
5187 |
+ if (gl == bd->bd_gl) |
5188 |
+@@ -862,6 +868,8 @@ void gfs2_log_flush(struct gfs2_sbd *sdp, struct gfs2_glock *gl, u32 flags) |
5189 |
+ if (gfs2_ail1_empty(sdp)) |
5190 |
+ break; |
5191 |
+ } |
5192 |
++ if (gfs2_withdrawn(sdp)) |
5193 |
++ goto out; |
5194 |
+ atomic_dec(&sdp->sd_log_blks_free); /* Adjust for unreserved buffer */ |
5195 |
+ trace_gfs2_log_blocks(sdp, -1); |
5196 |
+ log_write_header(sdp, flags); |
5197 |
+@@ -874,6 +882,7 @@ void gfs2_log_flush(struct gfs2_sbd *sdp, struct gfs2_glock *gl, u32 flags) |
5198 |
+ atomic_set(&sdp->sd_freeze_state, SFS_FROZEN); |
5199 |
+ } |
5200 |
+ |
5201 |
++out: |
5202 |
+ trace_gfs2_log_flush(sdp, 0, flags); |
5203 |
+ up_write(&sdp->sd_log_flush_lock); |
5204 |
+ |
5205 |
+diff --git a/fs/nfs/callback_proc.c b/fs/nfs/callback_proc.c |
5206 |
+index cd4c6bc81cae..40d31024b72d 100644 |
5207 |
+--- a/fs/nfs/callback_proc.c |
5208 |
++++ b/fs/nfs/callback_proc.c |
5209 |
+@@ -128,6 +128,8 @@ static struct inode *nfs_layout_find_inode_by_stateid(struct nfs_client *clp, |
5210 |
+ |
5211 |
+ list_for_each_entry_rcu(server, &clp->cl_superblocks, client_link) { |
5212 |
+ list_for_each_entry(lo, &server->layouts, plh_layouts) { |
5213 |
++ if (!pnfs_layout_is_valid(lo)) |
5214 |
++ continue; |
5215 |
+ if (stateid != NULL && |
5216 |
+ !nfs4_stateid_match_other(stateid, &lo->plh_stateid)) |
5217 |
+ continue; |
5218 |
+diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c |
5219 |
+index b768a0b42e82..ade2435551c8 100644 |
5220 |
+--- a/fs/nfs/direct.c |
5221 |
++++ b/fs/nfs/direct.c |
5222 |
+@@ -571,6 +571,7 @@ ssize_t nfs_file_direct_read(struct kiocb *iocb, struct iov_iter *iter) |
5223 |
+ l_ctx = nfs_get_lock_context(dreq->ctx); |
5224 |
+ if (IS_ERR(l_ctx)) { |
5225 |
+ result = PTR_ERR(l_ctx); |
5226 |
++ nfs_direct_req_release(dreq); |
5227 |
+ goto out_release; |
5228 |
+ } |
5229 |
+ dreq->l_ctx = l_ctx; |
5230 |
+@@ -990,6 +991,7 @@ ssize_t nfs_file_direct_write(struct kiocb *iocb, struct iov_iter *iter) |
5231 |
+ l_ctx = nfs_get_lock_context(dreq->ctx); |
5232 |
+ if (IS_ERR(l_ctx)) { |
5233 |
+ result = PTR_ERR(l_ctx); |
5234 |
++ nfs_direct_req_release(dreq); |
5235 |
+ goto out_release; |
5236 |
+ } |
5237 |
+ dreq->l_ctx = l_ctx; |
5238 |
+diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c |
5239 |
+index 11bf15800ac9..a10fb87c6ac3 100644 |
5240 |
+--- a/fs/nfs/inode.c |
5241 |
++++ b/fs/nfs/inode.c |
5242 |
+@@ -959,16 +959,16 @@ struct nfs_open_context *alloc_nfs_open_context(struct dentry *dentry, |
5243 |
+ struct file *filp) |
5244 |
+ { |
5245 |
+ struct nfs_open_context *ctx; |
5246 |
+- const struct cred *cred = get_current_cred(); |
5247 |
+ |
5248 |
+ ctx = kmalloc(sizeof(*ctx), GFP_KERNEL); |
5249 |
+- if (!ctx) { |
5250 |
+- put_cred(cred); |
5251 |
++ if (!ctx) |
5252 |
+ return ERR_PTR(-ENOMEM); |
5253 |
+- } |
5254 |
+ nfs_sb_active(dentry->d_sb); |
5255 |
+ ctx->dentry = dget(dentry); |
5256 |
+- ctx->cred = cred; |
5257 |
++ if (filp) |
5258 |
++ ctx->cred = get_cred(filp->f_cred); |
5259 |
++ else |
5260 |
++ ctx->cred = get_current_cred(); |
5261 |
+ ctx->ll_cred = NULL; |
5262 |
+ ctx->state = NULL; |
5263 |
+ ctx->mode = f_mode; |
5264 |
+diff --git a/fs/nfs/nfs4file.c b/fs/nfs/nfs4file.c |
5265 |
+index 1297919e0fce..8e5d6223ddd3 100644 |
5266 |
+--- a/fs/nfs/nfs4file.c |
5267 |
++++ b/fs/nfs/nfs4file.c |
5268 |
+@@ -252,6 +252,9 @@ static loff_t nfs42_remap_file_range(struct file *src_file, loff_t src_off, |
5269 |
+ if (remap_flags & ~REMAP_FILE_ADVISORY) |
5270 |
+ return -EINVAL; |
5271 |
+ |
5272 |
++ if (IS_SWAPFILE(dst_inode) || IS_SWAPFILE(src_inode)) |
5273 |
++ return -ETXTBSY; |
5274 |
++ |
5275 |
+ /* check alignment w.r.t. clone_blksize */ |
5276 |
+ ret = -EINVAL; |
5277 |
+ if (bs) { |
5278 |
+diff --git a/fs/nfs/nfsroot.c b/fs/nfs/nfsroot.c |
5279 |
+index effaa4247b91..8d3278805602 100644 |
5280 |
+--- a/fs/nfs/nfsroot.c |
5281 |
++++ b/fs/nfs/nfsroot.c |
5282 |
+@@ -88,7 +88,7 @@ |
5283 |
+ #define NFS_ROOT "/tftpboot/%s" |
5284 |
+ |
5285 |
+ /* Default NFSROOT mount options. */ |
5286 |
+-#define NFS_DEF_OPTIONS "vers=2,udp,rsize=4096,wsize=4096" |
5287 |
++#define NFS_DEF_OPTIONS "vers=2,tcp,rsize=4096,wsize=4096" |
5288 |
+ |
5289 |
+ /* Parameters passed from the kernel command line */ |
5290 |
+ static char nfs_root_parms[NFS_MAXPATHLEN + 1] __initdata = ""; |
5291 |
+diff --git a/fs/nfs/pagelist.c b/fs/nfs/pagelist.c |
5292 |
+index 8b7c525dbbf7..b736912098ee 100644 |
5293 |
+--- a/fs/nfs/pagelist.c |
5294 |
++++ b/fs/nfs/pagelist.c |
5295 |
+@@ -886,15 +886,6 @@ static void nfs_pageio_setup_mirroring(struct nfs_pageio_descriptor *pgio, |
5296 |
+ pgio->pg_mirror_count = mirror_count; |
5297 |
+ } |
5298 |
+ |
5299 |
+-/* |
5300 |
+- * nfs_pageio_stop_mirroring - stop using mirroring (set mirror count to 1) |
5301 |
+- */ |
5302 |
+-void nfs_pageio_stop_mirroring(struct nfs_pageio_descriptor *pgio) |
5303 |
+-{ |
5304 |
+- pgio->pg_mirror_count = 1; |
5305 |
+- pgio->pg_mirror_idx = 0; |
5306 |
+-} |
5307 |
+- |
5308 |
+ static void nfs_pageio_cleanup_mirroring(struct nfs_pageio_descriptor *pgio) |
5309 |
+ { |
5310 |
+ pgio->pg_mirror_count = 1; |
5311 |
+@@ -1320,6 +1311,14 @@ void nfs_pageio_cond_complete(struct nfs_pageio_descriptor *desc, pgoff_t index) |
5312 |
+ } |
5313 |
+ } |
5314 |
+ |
5315 |
++/* |
5316 |
++ * nfs_pageio_stop_mirroring - stop using mirroring (set mirror count to 1) |
5317 |
++ */ |
5318 |
++void nfs_pageio_stop_mirroring(struct nfs_pageio_descriptor *pgio) |
5319 |
++{ |
5320 |
++ nfs_pageio_complete(pgio); |
5321 |
++} |
5322 |
++ |
5323 |
+ int __init nfs_init_nfspagecache(void) |
5324 |
+ { |
5325 |
+ nfs_page_cachep = kmem_cache_create("nfs_page", |
5326 |
+diff --git a/fs/xfs/libxfs/xfs_alloc.c b/fs/xfs/libxfs/xfs_alloc.c |
5327 |
+index d8053bc96c4d..5a130409f173 100644 |
5328 |
+--- a/fs/xfs/libxfs/xfs_alloc.c |
5329 |
++++ b/fs/xfs/libxfs/xfs_alloc.c |
5330 |
+@@ -1515,7 +1515,7 @@ xfs_alloc_ag_vextent_lastblock( |
5331 |
+ * maxlen, go to the start of this block, and skip all those smaller |
5332 |
+ * than minlen. |
5333 |
+ */ |
5334 |
+- if (len || args->alignment > 1) { |
5335 |
++ if (*len || args->alignment > 1) { |
5336 |
+ acur->cnt->bc_ptrs[0] = 1; |
5337 |
+ do { |
5338 |
+ error = xfs_alloc_get_rec(acur->cnt, bno, len, &i); |
5339 |
+diff --git a/fs/xfs/xfs_attr_inactive.c b/fs/xfs/xfs_attr_inactive.c |
5340 |
+index bbfa6ba84dcd..fe8f60b59ec4 100644 |
5341 |
+--- a/fs/xfs/xfs_attr_inactive.c |
5342 |
++++ b/fs/xfs/xfs_attr_inactive.c |
5343 |
+@@ -145,8 +145,8 @@ xfs_attr3_node_inactive( |
5344 |
+ * Since this code is recursive (gasp!) we must protect ourselves. |
5345 |
+ */ |
5346 |
+ if (level > XFS_DA_NODE_MAXDEPTH) { |
5347 |
+- xfs_trans_brelse(*trans, bp); /* no locks for later trans */ |
5348 |
+ xfs_buf_corruption_error(bp); |
5349 |
++ xfs_trans_brelse(*trans, bp); /* no locks for later trans */ |
5350 |
+ return -EFSCORRUPTED; |
5351 |
+ } |
5352 |
+ |
5353 |
+diff --git a/fs/xfs/xfs_dir2_readdir.c b/fs/xfs/xfs_dir2_readdir.c |
5354 |
+index 0d3b640cf1cc..871ec22c9aee 100644 |
5355 |
+--- a/fs/xfs/xfs_dir2_readdir.c |
5356 |
++++ b/fs/xfs/xfs_dir2_readdir.c |
5357 |
+@@ -147,7 +147,7 @@ xfs_dir2_block_getdents( |
5358 |
+ xfs_off_t cook; |
5359 |
+ struct xfs_da_geometry *geo = args->geo; |
5360 |
+ int lock_mode; |
5361 |
+- unsigned int offset; |
5362 |
++ unsigned int offset, next_offset; |
5363 |
+ unsigned int end; |
5364 |
+ |
5365 |
+ /* |
5366 |
+@@ -173,9 +173,10 @@ xfs_dir2_block_getdents( |
5367 |
+ * Loop over the data portion of the block. |
5368 |
+ * Each object is a real entry (dep) or an unused one (dup). |
5369 |
+ */ |
5370 |
+- offset = geo->data_entry_offset; |
5371 |
+ end = xfs_dir3_data_end_offset(geo, bp->b_addr); |
5372 |
+- while (offset < end) { |
5373 |
++ for (offset = geo->data_entry_offset; |
5374 |
++ offset < end; |
5375 |
++ offset = next_offset) { |
5376 |
+ struct xfs_dir2_data_unused *dup = bp->b_addr + offset; |
5377 |
+ struct xfs_dir2_data_entry *dep = bp->b_addr + offset; |
5378 |
+ uint8_t filetype; |
5379 |
+@@ -184,14 +185,15 @@ xfs_dir2_block_getdents( |
5380 |
+ * Unused, skip it. |
5381 |
+ */ |
5382 |
+ if (be16_to_cpu(dup->freetag) == XFS_DIR2_DATA_FREE_TAG) { |
5383 |
+- offset += be16_to_cpu(dup->length); |
5384 |
++ next_offset = offset + be16_to_cpu(dup->length); |
5385 |
+ continue; |
5386 |
+ } |
5387 |
+ |
5388 |
+ /* |
5389 |
+ * Bump pointer for the next iteration. |
5390 |
+ */ |
5391 |
+- offset += xfs_dir2_data_entsize(dp->i_mount, dep->namelen); |
5392 |
++ next_offset = offset + |
5393 |
++ xfs_dir2_data_entsize(dp->i_mount, dep->namelen); |
5394 |
+ |
5395 |
+ /* |
5396 |
+ * The entry is before the desired starting point, skip it. |
5397 |
+diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c |
5398 |
+index f6006d94a581..796ff37d5bb5 100644 |
5399 |
+--- a/fs/xfs/xfs_log.c |
5400 |
++++ b/fs/xfs/xfs_log.c |
5401 |
+@@ -605,18 +605,23 @@ xfs_log_release_iclog( |
5402 |
+ struct xlog *log = mp->m_log; |
5403 |
+ bool sync; |
5404 |
+ |
5405 |
+- if (iclog->ic_state == XLOG_STATE_IOERROR) { |
5406 |
+- xfs_force_shutdown(mp, SHUTDOWN_LOG_IO_ERROR); |
5407 |
+- return -EIO; |
5408 |
+- } |
5409 |
++ if (iclog->ic_state == XLOG_STATE_IOERROR) |
5410 |
++ goto error; |
5411 |
+ |
5412 |
+ if (atomic_dec_and_lock(&iclog->ic_refcnt, &log->l_icloglock)) { |
5413 |
++ if (iclog->ic_state == XLOG_STATE_IOERROR) { |
5414 |
++ spin_unlock(&log->l_icloglock); |
5415 |
++ goto error; |
5416 |
++ } |
5417 |
+ sync = __xlog_state_release_iclog(log, iclog); |
5418 |
+ spin_unlock(&log->l_icloglock); |
5419 |
+ if (sync) |
5420 |
+ xlog_sync(log, iclog); |
5421 |
+ } |
5422 |
+ return 0; |
5423 |
++error: |
5424 |
++ xfs_force_shutdown(mp, SHUTDOWN_LOG_IO_ERROR); |
5425 |
++ return -EIO; |
5426 |
+ } |
5427 |
+ |
5428 |
+ /* |
5429 |
+diff --git a/include/acpi/processor.h b/include/acpi/processor.h |
5430 |
+index 47805172e73d..683e124ad517 100644 |
5431 |
+--- a/include/acpi/processor.h |
5432 |
++++ b/include/acpi/processor.h |
5433 |
+@@ -297,6 +297,14 @@ static inline void acpi_processor_ffh_cstate_enter(struct acpi_processor_cx |
5434 |
+ } |
5435 |
+ #endif |
5436 |
+ |
5437 |
++static inline int call_on_cpu(int cpu, long (*fn)(void *), void *arg, |
5438 |
++ bool direct) |
5439 |
++{ |
5440 |
++ if (direct || (is_percpu_thread() && cpu == smp_processor_id())) |
5441 |
++ return fn(arg); |
5442 |
++ return work_on_cpu(cpu, fn, arg); |
5443 |
++} |
5444 |
++ |
5445 |
+ /* in processor_perflib.c */ |
5446 |
+ |
5447 |
+ #ifdef CONFIG_CPU_FREQ |
5448 |
+diff --git a/include/asm-generic/mshyperv.h b/include/asm-generic/mshyperv.h |
5449 |
+index b3f1082cc435..1c4fd950f091 100644 |
5450 |
+--- a/include/asm-generic/mshyperv.h |
5451 |
++++ b/include/asm-generic/mshyperv.h |
5452 |
+@@ -163,7 +163,7 @@ static inline int cpumask_to_vpset(struct hv_vpset *vpset, |
5453 |
+ return nr_bank; |
5454 |
+ } |
5455 |
+ |
5456 |
+-void hyperv_report_panic(struct pt_regs *regs, long err); |
5457 |
++void hyperv_report_panic(struct pt_regs *regs, long err, bool in_die); |
5458 |
+ void hyperv_report_panic_msg(phys_addr_t pa, size_t size); |
5459 |
+ bool hv_is_hyperv_initialized(void); |
5460 |
+ bool hv_is_hibernation_supported(void); |
5461 |
+diff --git a/include/keys/big_key-type.h b/include/keys/big_key-type.h |
5462 |
+index f6a7ba4dccd4..3fee04f81439 100644 |
5463 |
+--- a/include/keys/big_key-type.h |
5464 |
++++ b/include/keys/big_key-type.h |
5465 |
+@@ -17,6 +17,6 @@ extern void big_key_free_preparse(struct key_preparsed_payload *prep); |
5466 |
+ extern void big_key_revoke(struct key *key); |
5467 |
+ extern void big_key_destroy(struct key *key); |
5468 |
+ extern void big_key_describe(const struct key *big_key, struct seq_file *m); |
5469 |
+-extern long big_key_read(const struct key *key, char __user *buffer, size_t buflen); |
5470 |
++extern long big_key_read(const struct key *key, char *buffer, size_t buflen); |
5471 |
+ |
5472 |
+ #endif /* _KEYS_BIG_KEY_TYPE_H */ |
5473 |
+diff --git a/include/keys/user-type.h b/include/keys/user-type.h |
5474 |
+index d5e73266a81a..be61fcddc02a 100644 |
5475 |
+--- a/include/keys/user-type.h |
5476 |
++++ b/include/keys/user-type.h |
5477 |
+@@ -41,8 +41,7 @@ extern int user_update(struct key *key, struct key_preparsed_payload *prep); |
5478 |
+ extern void user_revoke(struct key *key); |
5479 |
+ extern void user_destroy(struct key *key); |
5480 |
+ extern void user_describe(const struct key *user, struct seq_file *m); |
5481 |
+-extern long user_read(const struct key *key, |
5482 |
+- char __user *buffer, size_t buflen); |
5483 |
++extern long user_read(const struct key *key, char *buffer, size_t buflen); |
5484 |
+ |
5485 |
+ static inline const struct user_key_payload *user_key_payload_rcu(const struct key *key) |
5486 |
+ { |
5487 |
+diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h |
5488 |
+index 7b73ef7f902d..b56cc825f64d 100644 |
5489 |
+--- a/include/linux/buffer_head.h |
5490 |
++++ b/include/linux/buffer_head.h |
5491 |
+@@ -189,6 +189,8 @@ struct buffer_head *__getblk_gfp(struct block_device *bdev, sector_t block, |
5492 |
+ void __brelse(struct buffer_head *); |
5493 |
+ void __bforget(struct buffer_head *); |
5494 |
+ void __breadahead(struct block_device *, sector_t block, unsigned int size); |
5495 |
++void __breadahead_gfp(struct block_device *, sector_t block, unsigned int size, |
5496 |
++ gfp_t gfp); |
5497 |
+ struct buffer_head *__bread_gfp(struct block_device *, |
5498 |
+ sector_t block, unsigned size, gfp_t gfp); |
5499 |
+ void invalidate_bh_lrus(void); |
5500 |
+@@ -319,6 +321,12 @@ sb_breadahead(struct super_block *sb, sector_t block) |
5501 |
+ __breadahead(sb->s_bdev, block, sb->s_blocksize); |
5502 |
+ } |
5503 |
+ |
5504 |
++static inline void |
5505 |
++sb_breadahead_unmovable(struct super_block *sb, sector_t block) |
5506 |
++{ |
5507 |
++ __breadahead_gfp(sb->s_bdev, block, sb->s_blocksize, 0); |
5508 |
++} |
5509 |
++ |
5510 |
+ static inline struct buffer_head * |
5511 |
+ sb_getblk(struct super_block *sb, sector_t block) |
5512 |
+ { |
5513 |
+diff --git a/include/linux/compiler.h b/include/linux/compiler.h |
5514 |
+index 5e88e7e33abe..034b0a644efc 100644 |
5515 |
+--- a/include/linux/compiler.h |
5516 |
++++ b/include/linux/compiler.h |
5517 |
+@@ -347,7 +347,7 @@ static inline void *offset_to_ptr(const int *off) |
5518 |
+ * compiler has support to do so. |
5519 |
+ */ |
5520 |
+ #define compiletime_assert(condition, msg) \ |
5521 |
+- _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__) |
5522 |
++ _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) |
5523 |
+ |
5524 |
+ #define compiletime_assert_atomic_type(t) \ |
5525 |
+ compiletime_assert(__native_word(t), \ |
5526 |
+diff --git a/include/linux/f2fs_fs.h b/include/linux/f2fs_fs.h |
5527 |
+index ac3f4888b3df..3c383ddd92dd 100644 |
5528 |
+--- a/include/linux/f2fs_fs.h |
5529 |
++++ b/include/linux/f2fs_fs.h |
5530 |
+@@ -125,6 +125,7 @@ struct f2fs_super_block { |
5531 |
+ /* |
5532 |
+ * For checkpoint |
5533 |
+ */ |
5534 |
++#define CP_RESIZEFS_FLAG 0x00004000 |
5535 |
+ #define CP_DISABLED_QUICK_FLAG 0x00002000 |
5536 |
+ #define CP_DISABLED_FLAG 0x00001000 |
5537 |
+ #define CP_QUOTA_NEED_FSCK_FLAG 0x00000800 |
5538 |
+diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h |
5539 |
+index 1e897e4168ac..dafb3d70ff81 100644 |
5540 |
+--- a/include/linux/hugetlb.h |
5541 |
++++ b/include/linux/hugetlb.h |
5542 |
+@@ -390,7 +390,10 @@ static inline bool is_file_hugepages(struct file *file) |
5543 |
+ return is_file_shm_hugepages(file); |
5544 |
+ } |
5545 |
+ |
5546 |
+- |
5547 |
++static inline struct hstate *hstate_inode(struct inode *i) |
5548 |
++{ |
5549 |
++ return HUGETLBFS_SB(i->i_sb)->hstate; |
5550 |
++} |
5551 |
+ #else /* !CONFIG_HUGETLBFS */ |
5552 |
+ |
5553 |
+ #define is_file_hugepages(file) false |
5554 |
+@@ -402,6 +405,10 @@ hugetlb_file_setup(const char *name, size_t size, vm_flags_t acctflag, |
5555 |
+ return ERR_PTR(-ENOSYS); |
5556 |
+ } |
5557 |
+ |
5558 |
++static inline struct hstate *hstate_inode(struct inode *i) |
5559 |
++{ |
5560 |
++ return NULL; |
5561 |
++} |
5562 |
+ #endif /* !CONFIG_HUGETLBFS */ |
5563 |
+ |
5564 |
+ #ifdef HAVE_ARCH_HUGETLB_UNMAPPED_AREA |
5565 |
+@@ -472,11 +479,6 @@ extern unsigned int default_hstate_idx; |
5566 |
+ |
5567 |
+ #define default_hstate (hstates[default_hstate_idx]) |
5568 |
+ |
5569 |
+-static inline struct hstate *hstate_inode(struct inode *i) |
5570 |
+-{ |
5571 |
+- return HUGETLBFS_SB(i->i_sb)->hstate; |
5572 |
+-} |
5573 |
+- |
5574 |
+ static inline struct hstate *hstate_file(struct file *f) |
5575 |
+ { |
5576 |
+ return hstate_inode(file_inode(f)); |
5577 |
+@@ -729,11 +731,6 @@ static inline struct hstate *hstate_vma(struct vm_area_struct *vma) |
5578 |
+ return NULL; |
5579 |
+ } |
5580 |
+ |
5581 |
+-static inline struct hstate *hstate_inode(struct inode *i) |
5582 |
+-{ |
5583 |
+- return NULL; |
5584 |
+-} |
5585 |
+- |
5586 |
+ static inline struct hstate *page_hstate(struct page *page) |
5587 |
+ { |
5588 |
+ return NULL; |
5589 |
+diff --git a/include/linux/key-type.h b/include/linux/key-type.h |
5590 |
+index 4ded94bcf274..2ab2d6d6aeab 100644 |
5591 |
+--- a/include/linux/key-type.h |
5592 |
++++ b/include/linux/key-type.h |
5593 |
+@@ -127,7 +127,7 @@ struct key_type { |
5594 |
+ * much is copied into the buffer |
5595 |
+ * - shouldn't do the copy if the buffer is NULL |
5596 |
+ */ |
5597 |
+- long (*read)(const struct key *key, char __user *buffer, size_t buflen); |
5598 |
++ long (*read)(const struct key *key, char *buffer, size_t buflen); |
5599 |
+ |
5600 |
+ /* handle request_key() for this type instead of invoking |
5601 |
+ * /sbin/request-key (optional) |
5602 |
+diff --git a/include/linux/percpu_counter.h b/include/linux/percpu_counter.h |
5603 |
+index 4f052496cdfd..0a4f54dd4737 100644 |
5604 |
+--- a/include/linux/percpu_counter.h |
5605 |
++++ b/include/linux/percpu_counter.h |
5606 |
+@@ -78,9 +78,9 @@ static inline s64 percpu_counter_read(struct percpu_counter *fbc) |
5607 |
+ */ |
5608 |
+ static inline s64 percpu_counter_read_positive(struct percpu_counter *fbc) |
5609 |
+ { |
5610 |
+- s64 ret = fbc->count; |
5611 |
++ /* Prevent reloads of fbc->count */ |
5612 |
++ s64 ret = READ_ONCE(fbc->count); |
5613 |
+ |
5614 |
+- barrier(); /* Prevent reloads of fbc->count */ |
5615 |
+ if (ret >= 0) |
5616 |
+ return ret; |
5617 |
+ return 0; |
5618 |
+diff --git a/include/linux/platform_data/cros_ec_proto.h b/include/linux/platform_data/cros_ec_proto.h |
5619 |
+index ba5914770191..383243326676 100644 |
5620 |
+--- a/include/linux/platform_data/cros_ec_proto.h |
5621 |
++++ b/include/linux/platform_data/cros_ec_proto.h |
5622 |
+@@ -125,6 +125,9 @@ struct cros_ec_command { |
5623 |
+ * @host_event_wake_mask: Mask of host events that cause wake from suspend. |
5624 |
+ * @last_event_time: exact time from the hard irq when we got notified of |
5625 |
+ * a new event. |
5626 |
++ * @notifier_ready: The notifier_block to let the kernel re-query EC |
5627 |
++ * communication protocol when the EC sends |
5628 |
++ * EC_HOST_EVENT_INTERFACE_READY. |
5629 |
+ * @ec: The platform_device used by the mfd driver to interface with the |
5630 |
+ * main EC. |
5631 |
+ * @pd: The platform_device used by the mfd driver to interface with the |
5632 |
+@@ -166,6 +169,7 @@ struct cros_ec_device { |
5633 |
+ u32 host_event_wake_mask; |
5634 |
+ u32 last_resume_result; |
5635 |
+ ktime_t last_event_time; |
5636 |
++ struct notifier_block notifier_ready; |
5637 |
+ |
5638 |
+ /* The platform devices used by the mfd driver */ |
5639 |
+ struct platform_device *ec; |
5640 |
+diff --git a/include/linux/swapops.h b/include/linux/swapops.h |
5641 |
+index 877fd239b6ff..3208a520d0be 100644 |
5642 |
+--- a/include/linux/swapops.h |
5643 |
++++ b/include/linux/swapops.h |
5644 |
+@@ -348,7 +348,8 @@ static inline void num_poisoned_pages_inc(void) |
5645 |
+ } |
5646 |
+ #endif |
5647 |
+ |
5648 |
+-#if defined(CONFIG_MEMORY_FAILURE) || defined(CONFIG_MIGRATION) |
5649 |
++#if defined(CONFIG_MEMORY_FAILURE) || defined(CONFIG_MIGRATION) || \ |
5650 |
++ defined(CONFIG_DEVICE_PRIVATE) |
5651 |
+ static inline int non_swap_entry(swp_entry_t entry) |
5652 |
+ { |
5653 |
+ return swp_type(entry) >= MAX_SWAPFILES; |
5654 |
+diff --git a/include/trace/bpf_probe.h b/include/trace/bpf_probe.h |
5655 |
+index b04c29270973..1ce3be63add1 100644 |
5656 |
+--- a/include/trace/bpf_probe.h |
5657 |
++++ b/include/trace/bpf_probe.h |
5658 |
+@@ -75,13 +75,17 @@ static inline void bpf_test_probe_##call(void) \ |
5659 |
+ check_trace_callback_type_##call(__bpf_trace_##template); \ |
5660 |
+ } \ |
5661 |
+ typedef void (*btf_trace_##call)(void *__data, proto); \ |
5662 |
+-static struct bpf_raw_event_map __used \ |
5663 |
+- __attribute__((section("__bpf_raw_tp_map"))) \ |
5664 |
+-__bpf_trace_tp_map_##call = { \ |
5665 |
+- .tp = &__tracepoint_##call, \ |
5666 |
+- .bpf_func = (void *)(btf_trace_##call)__bpf_trace_##template, \ |
5667 |
+- .num_args = COUNT_ARGS(args), \ |
5668 |
+- .writable_size = size, \ |
5669 |
++static union { \ |
5670 |
++ struct bpf_raw_event_map event; \ |
5671 |
++ btf_trace_##call handler; \ |
5672 |
++} __bpf_trace_tp_map_##call __used \ |
5673 |
++__attribute__((section("__bpf_raw_tp_map"))) = { \ |
5674 |
++ .event = { \ |
5675 |
++ .tp = &__tracepoint_##call, \ |
5676 |
++ .bpf_func = __bpf_trace_##template, \ |
5677 |
++ .num_args = COUNT_ARGS(args), \ |
5678 |
++ .writable_size = size, \ |
5679 |
++ }, \ |
5680 |
+ }; |
5681 |
+ |
5682 |
+ #define FIRST(x, ...) x |
5683 |
+diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c |
5684 |
+index 966b7b34cde0..3b92aea18ae7 100644 |
5685 |
+--- a/kernel/bpf/syscall.c |
5686 |
++++ b/kernel/bpf/syscall.c |
5687 |
+@@ -592,9 +592,7 @@ static void bpf_map_mmap_open(struct vm_area_struct *vma) |
5688 |
+ { |
5689 |
+ struct bpf_map *map = vma->vm_file->private_data; |
5690 |
+ |
5691 |
+- bpf_map_inc_with_uref(map); |
5692 |
+- |
5693 |
+- if (vma->vm_flags & VM_WRITE) { |
5694 |
++ if (vma->vm_flags & VM_MAYWRITE) { |
5695 |
+ mutex_lock(&map->freeze_mutex); |
5696 |
+ map->writecnt++; |
5697 |
+ mutex_unlock(&map->freeze_mutex); |
5698 |
+@@ -606,13 +604,11 @@ static void bpf_map_mmap_close(struct vm_area_struct *vma) |
5699 |
+ { |
5700 |
+ struct bpf_map *map = vma->vm_file->private_data; |
5701 |
+ |
5702 |
+- if (vma->vm_flags & VM_WRITE) { |
5703 |
++ if (vma->vm_flags & VM_MAYWRITE) { |
5704 |
+ mutex_lock(&map->freeze_mutex); |
5705 |
+ map->writecnt--; |
5706 |
+ mutex_unlock(&map->freeze_mutex); |
5707 |
+ } |
5708 |
+- |
5709 |
+- bpf_map_put_with_uref(map); |
5710 |
+ } |
5711 |
+ |
5712 |
+ static const struct vm_operations_struct bpf_map_default_vmops = { |
5713 |
+@@ -641,14 +637,16 @@ static int bpf_map_mmap(struct file *filp, struct vm_area_struct *vma) |
5714 |
+ /* set default open/close callbacks */ |
5715 |
+ vma->vm_ops = &bpf_map_default_vmops; |
5716 |
+ vma->vm_private_data = map; |
5717 |
++ vma->vm_flags &= ~VM_MAYEXEC; |
5718 |
++ if (!(vma->vm_flags & VM_WRITE)) |
5719 |
++ /* disallow re-mapping with PROT_WRITE */ |
5720 |
++ vma->vm_flags &= ~VM_MAYWRITE; |
5721 |
+ |
5722 |
+ err = map->ops->map_mmap(map, vma); |
5723 |
+ if (err) |
5724 |
+ goto out; |
5725 |
+ |
5726 |
+- bpf_map_inc_with_uref(map); |
5727 |
+- |
5728 |
+- if (vma->vm_flags & VM_WRITE) |
5729 |
++ if (vma->vm_flags & VM_MAYWRITE) |
5730 |
+ map->writecnt++; |
5731 |
+ out: |
5732 |
+ mutex_unlock(&map->freeze_mutex); |
5733 |
+diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c |
5734 |
+index 595b39eee642..e5d12c54b552 100644 |
5735 |
+--- a/kernel/bpf/verifier.c |
5736 |
++++ b/kernel/bpf/verifier.c |
5737 |
+@@ -227,8 +227,7 @@ struct bpf_call_arg_meta { |
5738 |
+ bool pkt_access; |
5739 |
+ int regno; |
5740 |
+ int access_size; |
5741 |
+- s64 msize_smax_value; |
5742 |
+- u64 msize_umax_value; |
5743 |
++ u64 msize_max_value; |
5744 |
+ int ref_obj_id; |
5745 |
+ int func_id; |
5746 |
+ u32 btf_id; |
5747 |
+@@ -3568,8 +3567,7 @@ static int check_func_arg(struct bpf_verifier_env *env, u32 regno, |
5748 |
+ /* remember the mem_size which may be used later |
5749 |
+ * to refine return values. |
5750 |
+ */ |
5751 |
+- meta->msize_smax_value = reg->smax_value; |
5752 |
+- meta->msize_umax_value = reg->umax_value; |
5753 |
++ meta->msize_max_value = reg->umax_value; |
5754 |
+ |
5755 |
+ /* The register is SCALAR_VALUE; the access check |
5756 |
+ * happens using its boundaries. |
5757 |
+@@ -4095,21 +4093,44 @@ static int prepare_func_exit(struct bpf_verifier_env *env, int *insn_idx) |
5758 |
+ return 0; |
5759 |
+ } |
5760 |
+ |
5761 |
+-static void do_refine_retval_range(struct bpf_reg_state *regs, int ret_type, |
5762 |
+- int func_id, |
5763 |
+- struct bpf_call_arg_meta *meta) |
5764 |
++static int do_refine_retval_range(struct bpf_verifier_env *env, |
5765 |
++ struct bpf_reg_state *regs, int ret_type, |
5766 |
++ int func_id, struct bpf_call_arg_meta *meta) |
5767 |
+ { |
5768 |
+ struct bpf_reg_state *ret_reg = ®s[BPF_REG_0]; |
5769 |
++ struct bpf_reg_state tmp_reg = *ret_reg; |
5770 |
++ bool ret; |
5771 |
+ |
5772 |
+ if (ret_type != RET_INTEGER || |
5773 |
+ (func_id != BPF_FUNC_get_stack && |
5774 |
+ func_id != BPF_FUNC_probe_read_str)) |
5775 |
+- return; |
5776 |
++ return 0; |
5777 |
++ |
5778 |
++ /* Error case where ret is in interval [S32MIN, -1]. */ |
5779 |
++ ret_reg->smin_value = S32_MIN; |
5780 |
++ ret_reg->smax_value = -1; |
5781 |
+ |
5782 |
+- ret_reg->smax_value = meta->msize_smax_value; |
5783 |
+- ret_reg->umax_value = meta->msize_umax_value; |
5784 |
+ __reg_deduce_bounds(ret_reg); |
5785 |
+ __reg_bound_offset(ret_reg); |
5786 |
++ __update_reg_bounds(ret_reg); |
5787 |
++ |
5788 |
++ ret = push_stack(env, env->insn_idx + 1, env->insn_idx, false); |
5789 |
++ if (!ret) |
5790 |
++ return -EFAULT; |
5791 |
++ |
5792 |
++ *ret_reg = tmp_reg; |
5793 |
++ |
5794 |
++ /* Success case where ret is in range [0, msize_max_value]. */ |
5795 |
++ ret_reg->smin_value = 0; |
5796 |
++ ret_reg->smax_value = meta->msize_max_value; |
5797 |
++ ret_reg->umin_value = ret_reg->smin_value; |
5798 |
++ ret_reg->umax_value = ret_reg->smax_value; |
5799 |
++ |
5800 |
++ __reg_deduce_bounds(ret_reg); |
5801 |
++ __reg_bound_offset(ret_reg); |
5802 |
++ __update_reg_bounds(ret_reg); |
5803 |
++ |
5804 |
++ return 0; |
5805 |
+ } |
5806 |
+ |
5807 |
+ static int |
5808 |
+@@ -4377,7 +4398,9 @@ static int check_helper_call(struct bpf_verifier_env *env, int func_id, int insn |
5809 |
+ regs[BPF_REG_0].ref_obj_id = id; |
5810 |
+ } |
5811 |
+ |
5812 |
+- do_refine_retval_range(regs, fn->ret_type, func_id, &meta); |
5813 |
++ err = do_refine_retval_range(env, regs, fn->ret_type, func_id, &meta); |
5814 |
++ if (err) |
5815 |
++ return err; |
5816 |
+ |
5817 |
+ err = check_map_func_compatibility(env, meta.map_ptr, func_id); |
5818 |
+ if (err) |
5819 |
+diff --git a/kernel/dma/coherent.c b/kernel/dma/coherent.c |
5820 |
+index 551b0eb7028a..2a0c4985f38e 100644 |
5821 |
+--- a/kernel/dma/coherent.c |
5822 |
++++ b/kernel/dma/coherent.c |
5823 |
+@@ -134,7 +134,7 @@ static void *__dma_alloc_from_coherent(struct device *dev, |
5824 |
+ |
5825 |
+ spin_lock_irqsave(&mem->spinlock, flags); |
5826 |
+ |
5827 |
+- if (unlikely(size > (mem->size << PAGE_SHIFT))) |
5828 |
++ if (unlikely(size > ((dma_addr_t)mem->size << PAGE_SHIFT))) |
5829 |
+ goto err; |
5830 |
+ |
5831 |
+ pageno = bitmap_find_free_region(mem->bitmap, mem->size, order); |
5832 |
+@@ -144,8 +144,9 @@ static void *__dma_alloc_from_coherent(struct device *dev, |
5833 |
+ /* |
5834 |
+ * Memory was found in the coherent area. |
5835 |
+ */ |
5836 |
+- *dma_handle = dma_get_device_base(dev, mem) + (pageno << PAGE_SHIFT); |
5837 |
+- ret = mem->virt_base + (pageno << PAGE_SHIFT); |
5838 |
++ *dma_handle = dma_get_device_base(dev, mem) + |
5839 |
++ ((dma_addr_t)pageno << PAGE_SHIFT); |
5840 |
++ ret = mem->virt_base + ((dma_addr_t)pageno << PAGE_SHIFT); |
5841 |
+ spin_unlock_irqrestore(&mem->spinlock, flags); |
5842 |
+ memset(ret, 0, size); |
5843 |
+ return ret; |
5844 |
+@@ -194,7 +195,7 @@ static int __dma_release_from_coherent(struct dma_coherent_mem *mem, |
5845 |
+ int order, void *vaddr) |
5846 |
+ { |
5847 |
+ if (mem && vaddr >= mem->virt_base && vaddr < |
5848 |
+- (mem->virt_base + (mem->size << PAGE_SHIFT))) { |
5849 |
++ (mem->virt_base + ((dma_addr_t)mem->size << PAGE_SHIFT))) { |
5850 |
+ int page = (vaddr - mem->virt_base) >> PAGE_SHIFT; |
5851 |
+ unsigned long flags; |
5852 |
+ |
5853 |
+@@ -238,10 +239,10 @@ static int __dma_mmap_from_coherent(struct dma_coherent_mem *mem, |
5854 |
+ struct vm_area_struct *vma, void *vaddr, size_t size, int *ret) |
5855 |
+ { |
5856 |
+ if (mem && vaddr >= mem->virt_base && vaddr + size <= |
5857 |
+- (mem->virt_base + (mem->size << PAGE_SHIFT))) { |
5858 |
++ (mem->virt_base + ((dma_addr_t)mem->size << PAGE_SHIFT))) { |
5859 |
+ unsigned long off = vma->vm_pgoff; |
5860 |
+ int start = (vaddr - mem->virt_base) >> PAGE_SHIFT; |
5861 |
+- int user_count = vma_pages(vma); |
5862 |
++ unsigned long user_count = vma_pages(vma); |
5863 |
+ int count = PAGE_ALIGN(size) >> PAGE_SHIFT; |
5864 |
+ |
5865 |
+ *ret = -ENXIO; |
5866 |
+diff --git a/kernel/dma/debug.c b/kernel/dma/debug.c |
5867 |
+index 2031ed1ad7fa..9e1777c81f55 100644 |
5868 |
+--- a/kernel/dma/debug.c |
5869 |
++++ b/kernel/dma/debug.c |
5870 |
+@@ -137,9 +137,12 @@ static const char *const maperr2str[] = { |
5871 |
+ [MAP_ERR_CHECKED] = "dma map error checked", |
5872 |
+ }; |
5873 |
+ |
5874 |
+-static const char *type2name[5] = { "single", "page", |
5875 |
+- "scather-gather", "coherent", |
5876 |
+- "resource" }; |
5877 |
++static const char *type2name[] = { |
5878 |
++ [dma_debug_single] = "single", |
5879 |
++ [dma_debug_sg] = "scather-gather", |
5880 |
++ [dma_debug_coherent] = "coherent", |
5881 |
++ [dma_debug_resource] = "resource", |
5882 |
++}; |
5883 |
+ |
5884 |
+ static const char *dir2name[4] = { "DMA_BIDIRECTIONAL", "DMA_TO_DEVICE", |
5885 |
+ "DMA_FROM_DEVICE", "DMA_NONE" }; |
5886 |
+diff --git a/kernel/locking/locktorture.c b/kernel/locking/locktorture.c |
5887 |
+index 99475a66c94f..687c1d83dc20 100644 |
5888 |
+--- a/kernel/locking/locktorture.c |
5889 |
++++ b/kernel/locking/locktorture.c |
5890 |
+@@ -696,10 +696,10 @@ static void __torture_print_stats(char *page, |
5891 |
+ if (statp[i].n_lock_fail) |
5892 |
+ fail = true; |
5893 |
+ sum += statp[i].n_lock_acquired; |
5894 |
+- if (max < statp[i].n_lock_fail) |
5895 |
+- max = statp[i].n_lock_fail; |
5896 |
+- if (min > statp[i].n_lock_fail) |
5897 |
+- min = statp[i].n_lock_fail; |
5898 |
++ if (max < statp[i].n_lock_acquired) |
5899 |
++ max = statp[i].n_lock_acquired; |
5900 |
++ if (min > statp[i].n_lock_acquired) |
5901 |
++ min = statp[i].n_lock_acquired; |
5902 |
+ } |
5903 |
+ page += sprintf(page, |
5904 |
+ "%s: Total: %lld Max/Min: %ld/%ld %s Fail: %d %s\n", |
5905 |
+diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug |
5906 |
+index 69def4a9df00..ab9af2e052ca 100644 |
5907 |
+--- a/lib/Kconfig.debug |
5908 |
++++ b/lib/Kconfig.debug |
5909 |
+@@ -241,6 +241,8 @@ config DEBUG_INFO_DWARF4 |
5910 |
+ config DEBUG_INFO_BTF |
5911 |
+ bool "Generate BTF typeinfo" |
5912 |
+ depends on DEBUG_INFO |
5913 |
++ depends on !DEBUG_INFO_SPLIT && !DEBUG_INFO_REDUCED |
5914 |
++ depends on !GCC_PLUGIN_RANDSTRUCT || COMPILE_TEST |
5915 |
+ help |
5916 |
+ Generate deduplicated BTF type information from DWARF debug info. |
5917 |
+ Turning this on expects presence of pahole tool, which will convert |
5918 |
+diff --git a/net/dns_resolver/dns_key.c b/net/dns_resolver/dns_key.c |
5919 |
+index 3e1a90669006..ad53eb31d40f 100644 |
5920 |
+--- a/net/dns_resolver/dns_key.c |
5921 |
++++ b/net/dns_resolver/dns_key.c |
5922 |
+@@ -302,7 +302,7 @@ static void dns_resolver_describe(const struct key *key, struct seq_file *m) |
5923 |
+ * - the key's semaphore is read-locked |
5924 |
+ */ |
5925 |
+ static long dns_resolver_read(const struct key *key, |
5926 |
+- char __user *buffer, size_t buflen) |
5927 |
++ char *buffer, size_t buflen) |
5928 |
+ { |
5929 |
+ int err = PTR_ERR(key->payload.data[dns_key_error]); |
5930 |
+ |
5931 |
+diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c |
5932 |
+index d11f1a74d43c..68ec31c4ae65 100644 |
5933 |
+--- a/net/netfilter/nf_tables_api.c |
5934 |
++++ b/net/netfilter/nf_tables_api.c |
5935 |
+@@ -3950,7 +3950,7 @@ static int nf_tables_newset(struct net *net, struct sock *nlsk, |
5936 |
+ NFT_SET_INTERVAL | NFT_SET_TIMEOUT | |
5937 |
+ NFT_SET_MAP | NFT_SET_EVAL | |
5938 |
+ NFT_SET_OBJECT)) |
5939 |
+- return -EINVAL; |
5940 |
++ return -EOPNOTSUPP; |
5941 |
+ /* Only one of these operations is supported */ |
5942 |
+ if ((flags & (NFT_SET_MAP | NFT_SET_OBJECT)) == |
5943 |
+ (NFT_SET_MAP | NFT_SET_OBJECT)) |
5944 |
+@@ -3988,7 +3988,7 @@ static int nf_tables_newset(struct net *net, struct sock *nlsk, |
5945 |
+ objtype = ntohl(nla_get_be32(nla[NFTA_SET_OBJ_TYPE])); |
5946 |
+ if (objtype == NFT_OBJECT_UNSPEC || |
5947 |
+ objtype > NFT_OBJECT_MAX) |
5948 |
+- return -EINVAL; |
5949 |
++ return -EOPNOTSUPP; |
5950 |
+ } else if (flags & NFT_SET_OBJECT) |
5951 |
+ return -EINVAL; |
5952 |
+ else |
5953 |
+diff --git a/net/netfilter/nft_set_rbtree.c b/net/netfilter/nft_set_rbtree.c |
5954 |
+index 8617fc16a1ed..46d976969ca3 100644 |
5955 |
+--- a/net/netfilter/nft_set_rbtree.c |
5956 |
++++ b/net/netfilter/nft_set_rbtree.c |
5957 |
+@@ -218,27 +218,26 @@ static int __nft_rbtree_insert(const struct net *net, const struct nft_set *set, |
5958 |
+ |
5959 |
+ /* Detect overlaps as we descend the tree. Set the flag in these cases: |
5960 |
+ * |
5961 |
+- * a1. |__ _ _? >|__ _ _ (insert start after existing start) |
5962 |
+- * a2. _ _ __>| ?_ _ __| (insert end before existing end) |
5963 |
+- * a3. _ _ ___| ?_ _ _>| (insert end after existing end) |
5964 |
+- * a4. >|__ _ _ _ _ __| (insert start before existing end) |
5965 |
++ * a1. _ _ __>| ?_ _ __| (insert end before existing end) |
5966 |
++ * a2. _ _ ___| ?_ _ _>| (insert end after existing end) |
5967 |
++ * a3. _ _ ___? >|_ _ __| (insert start before existing end) |
5968 |
+ * |
5969 |
+ * and clear it later on, as we eventually reach the points indicated by |
5970 |
+ * '?' above, in the cases described below. We'll always meet these |
5971 |
+ * later, locally, due to tree ordering, and overlaps for the intervals |
5972 |
+ * that are the closest together are always evaluated last. |
5973 |
+ * |
5974 |
+- * b1. |__ _ _! >|__ _ _ (insert start after existing end) |
5975 |
+- * b2. _ _ __>| !_ _ __| (insert end before existing start) |
5976 |
+- * b3. !_____>| (insert end after existing start) |
5977 |
++ * b1. _ _ __>| !_ _ __| (insert end before existing start) |
5978 |
++ * b2. _ _ ___| !_ _ _>| (insert end after existing start) |
5979 |
++ * b3. _ _ ___! >|_ _ __| (insert start after existing end) |
5980 |
+ * |
5981 |
+- * Case a4. resolves to b1.: |
5982 |
++ * Case a3. resolves to b3.: |
5983 |
+ * - if the inserted start element is the leftmost, because the '0' |
5984 |
+ * element in the tree serves as end element |
5985 |
+ * - otherwise, if an existing end is found. Note that end elements are |
5986 |
+ * always inserted after corresponding start elements. |
5987 |
+ * |
5988 |
+- * For a new, rightmost pair of elements, we'll hit cases b1. and b3., |
5989 |
++ * For a new, rightmost pair of elements, we'll hit cases b3. and b2., |
5990 |
+ * in that order. |
5991 |
+ * |
5992 |
+ * The flag is also cleared in two special cases: |
5993 |
+@@ -262,9 +261,9 @@ static int __nft_rbtree_insert(const struct net *net, const struct nft_set *set, |
5994 |
+ p = &parent->rb_left; |
5995 |
+ |
5996 |
+ if (nft_rbtree_interval_start(new)) { |
5997 |
+- overlap = nft_rbtree_interval_start(rbe) && |
5998 |
+- nft_set_elem_active(&rbe->ext, |
5999 |
+- genmask); |
6000 |
++ if (nft_rbtree_interval_end(rbe) && |
6001 |
++ nft_set_elem_active(&rbe->ext, genmask)) |
6002 |
++ overlap = false; |
6003 |
+ } else { |
6004 |
+ overlap = nft_rbtree_interval_end(rbe) && |
6005 |
+ nft_set_elem_active(&rbe->ext, |
6006 |
+diff --git a/net/rxrpc/key.c b/net/rxrpc/key.c |
6007 |
+index 6c3f35fac42d..0c98313dd7a8 100644 |
6008 |
+--- a/net/rxrpc/key.c |
6009 |
++++ b/net/rxrpc/key.c |
6010 |
+@@ -31,7 +31,7 @@ static void rxrpc_free_preparse_s(struct key_preparsed_payload *); |
6011 |
+ static void rxrpc_destroy(struct key *); |
6012 |
+ static void rxrpc_destroy_s(struct key *); |
6013 |
+ static void rxrpc_describe(const struct key *, struct seq_file *); |
6014 |
+-static long rxrpc_read(const struct key *, char __user *, size_t); |
6015 |
++static long rxrpc_read(const struct key *, char *, size_t); |
6016 |
+ |
6017 |
+ /* |
6018 |
+ * rxrpc defined keys take an arbitrary string as the description and an |
6019 |
+@@ -1042,12 +1042,12 @@ EXPORT_SYMBOL(rxrpc_get_null_key); |
6020 |
+ * - this returns the result in XDR form |
6021 |
+ */ |
6022 |
+ static long rxrpc_read(const struct key *key, |
6023 |
+- char __user *buffer, size_t buflen) |
6024 |
++ char *buffer, size_t buflen) |
6025 |
+ { |
6026 |
+ const struct rxrpc_key_token *token; |
6027 |
+ const struct krb5_principal *princ; |
6028 |
+ size_t size; |
6029 |
+- __be32 __user *xdr, *oldxdr; |
6030 |
++ __be32 *xdr, *oldxdr; |
6031 |
+ u32 cnlen, toksize, ntoks, tok, zero; |
6032 |
+ u16 toksizes[AFSTOKEN_MAX]; |
6033 |
+ int loop; |
6034 |
+@@ -1124,30 +1124,25 @@ static long rxrpc_read(const struct key *key, |
6035 |
+ if (!buffer || buflen < size) |
6036 |
+ return size; |
6037 |
+ |
6038 |
+- xdr = (__be32 __user *) buffer; |
6039 |
++ xdr = (__be32 *)buffer; |
6040 |
+ zero = 0; |
6041 |
+ #define ENCODE(x) \ |
6042 |
+ do { \ |
6043 |
+- __be32 y = htonl(x); \ |
6044 |
+- if (put_user(y, xdr++) < 0) \ |
6045 |
+- goto fault; \ |
6046 |
++ *xdr++ = htonl(x); \ |
6047 |
+ } while(0) |
6048 |
+ #define ENCODE_DATA(l, s) \ |
6049 |
+ do { \ |
6050 |
+ u32 _l = (l); \ |
6051 |
+ ENCODE(l); \ |
6052 |
+- if (copy_to_user(xdr, (s), _l) != 0) \ |
6053 |
+- goto fault; \ |
6054 |
+- if (_l & 3 && \ |
6055 |
+- copy_to_user((u8 __user *)xdr + _l, &zero, 4 - (_l & 3)) != 0) \ |
6056 |
+- goto fault; \ |
6057 |
++ memcpy(xdr, (s), _l); \ |
6058 |
++ if (_l & 3) \ |
6059 |
++ memcpy((u8 *)xdr + _l, &zero, 4 - (_l & 3)); \ |
6060 |
+ xdr += (_l + 3) >> 2; \ |
6061 |
+ } while(0) |
6062 |
+ #define ENCODE64(x) \ |
6063 |
+ do { \ |
6064 |
+ __be64 y = cpu_to_be64(x); \ |
6065 |
+- if (copy_to_user(xdr, &y, 8) != 0) \ |
6066 |
+- goto fault; \ |
6067 |
++ memcpy(xdr, &y, 8); \ |
6068 |
+ xdr += 8 >> 2; \ |
6069 |
+ } while(0) |
6070 |
+ #define ENCODE_STR(s) \ |
6071 |
+@@ -1238,8 +1233,4 @@ static long rxrpc_read(const struct key *key, |
6072 |
+ ASSERTCMP((char __user *) xdr - buffer, ==, size); |
6073 |
+ _leave(" = %zu", size); |
6074 |
+ return size; |
6075 |
+- |
6076 |
+-fault: |
6077 |
+- _leave(" = -EFAULT"); |
6078 |
+- return -EFAULT; |
6079 |
+ } |
6080 |
+diff --git a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c |
6081 |
+index 24ca861815b1..2dc740acb3bf 100644 |
6082 |
+--- a/net/sunrpc/auth_gss/auth_gss.c |
6083 |
++++ b/net/sunrpc/auth_gss/auth_gss.c |
6084 |
+@@ -20,6 +20,7 @@ |
6085 |
+ #include <linux/sunrpc/clnt.h> |
6086 |
+ #include <linux/sunrpc/auth.h> |
6087 |
+ #include <linux/sunrpc/auth_gss.h> |
6088 |
++#include <linux/sunrpc/gss_krb5.h> |
6089 |
+ #include <linux/sunrpc/svcauth_gss.h> |
6090 |
+ #include <linux/sunrpc/gss_err.h> |
6091 |
+ #include <linux/workqueue.h> |
6092 |
+@@ -1050,7 +1051,7 @@ gss_create_new(const struct rpc_auth_create_args *args, struct rpc_clnt *clnt) |
6093 |
+ goto err_put_mech; |
6094 |
+ auth = &gss_auth->rpc_auth; |
6095 |
+ auth->au_cslack = GSS_CRED_SLACK >> 2; |
6096 |
+- auth->au_rslack = GSS_VERF_SLACK >> 2; |
6097 |
++ auth->au_rslack = GSS_KRB5_MAX_SLACK_NEEDED >> 2; |
6098 |
+ auth->au_verfsize = GSS_VERF_SLACK >> 2; |
6099 |
+ auth->au_ralign = GSS_VERF_SLACK >> 2; |
6100 |
+ auth->au_flags = 0; |
6101 |
+@@ -1934,35 +1935,69 @@ gss_unwrap_resp_auth(struct rpc_cred *cred) |
6102 |
+ return 0; |
6103 |
+ } |
6104 |
+ |
6105 |
++/* |
6106 |
++ * RFC 2203, Section 5.3.2.2 |
6107 |
++ * |
6108 |
++ * struct rpc_gss_integ_data { |
6109 |
++ * opaque databody_integ<>; |
6110 |
++ * opaque checksum<>; |
6111 |
++ * }; |
6112 |
++ * |
6113 |
++ * struct rpc_gss_data_t { |
6114 |
++ * unsigned int seq_num; |
6115 |
++ * proc_req_arg_t arg; |
6116 |
++ * }; |
6117 |
++ */ |
6118 |
+ static int |
6119 |
+ gss_unwrap_resp_integ(struct rpc_task *task, struct rpc_cred *cred, |
6120 |
+ struct gss_cl_ctx *ctx, struct rpc_rqst *rqstp, |
6121 |
+ struct xdr_stream *xdr) |
6122 |
+ { |
6123 |
+- struct xdr_buf integ_buf, *rcv_buf = &rqstp->rq_rcv_buf; |
6124 |
+- u32 data_offset, mic_offset, integ_len, maj_stat; |
6125 |
++ struct xdr_buf gss_data, *rcv_buf = &rqstp->rq_rcv_buf; |
6126 |
+ struct rpc_auth *auth = cred->cr_auth; |
6127 |
++ u32 len, offset, seqno, maj_stat; |
6128 |
+ struct xdr_netobj mic; |
6129 |
+- __be32 *p; |
6130 |
++ int ret; |
6131 |
+ |
6132 |
+- p = xdr_inline_decode(xdr, 2 * sizeof(*p)); |
6133 |
+- if (unlikely(!p)) |
6134 |
++ ret = -EIO; |
6135 |
++ mic.data = NULL; |
6136 |
++ |
6137 |
++ /* opaque databody_integ<>; */ |
6138 |
++ if (xdr_stream_decode_u32(xdr, &len)) |
6139 |
+ goto unwrap_failed; |
6140 |
+- integ_len = be32_to_cpup(p++); |
6141 |
+- if (integ_len & 3) |
6142 |
++ if (len & 3) |
6143 |
+ goto unwrap_failed; |
6144 |
+- data_offset = (u8 *)(p) - (u8 *)rcv_buf->head[0].iov_base; |
6145 |
+- mic_offset = integ_len + data_offset; |
6146 |
+- if (mic_offset > rcv_buf->len) |
6147 |
++ offset = rcv_buf->len - xdr_stream_remaining(xdr); |
6148 |
++ if (xdr_stream_decode_u32(xdr, &seqno)) |
6149 |
+ goto unwrap_failed; |
6150 |
+- if (be32_to_cpup(p) != rqstp->rq_seqno) |
6151 |
++ if (seqno != rqstp->rq_seqno) |
6152 |
+ goto bad_seqno; |
6153 |
++ if (xdr_buf_subsegment(rcv_buf, &gss_data, offset, len)) |
6154 |
++ goto unwrap_failed; |
6155 |
+ |
6156 |
+- if (xdr_buf_subsegment(rcv_buf, &integ_buf, data_offset, integ_len)) |
6157 |
++ /* |
6158 |
++ * The xdr_stream now points to the beginning of the |
6159 |
++ * upper layer payload, to be passed below to |
6160 |
++ * rpcauth_unwrap_resp_decode(). The checksum, which |
6161 |
++ * follows the upper layer payload in @rcv_buf, is |
6162 |
++ * located and parsed without updating the xdr_stream. |
6163 |
++ */ |
6164 |
++ |
6165 |
++ /* opaque checksum<>; */ |
6166 |
++ offset += len; |
6167 |
++ if (xdr_decode_word(rcv_buf, offset, &len)) |
6168 |
++ goto unwrap_failed; |
6169 |
++ offset += sizeof(__be32); |
6170 |
++ if (offset + len > rcv_buf->len) |
6171 |
+ goto unwrap_failed; |
6172 |
+- if (xdr_buf_read_mic(rcv_buf, &mic, mic_offset)) |
6173 |
++ mic.len = len; |
6174 |
++ mic.data = kmalloc(len, GFP_NOFS); |
6175 |
++ if (!mic.data) |
6176 |
++ goto unwrap_failed; |
6177 |
++ if (read_bytes_from_xdr_buf(rcv_buf, offset, mic.data, mic.len)) |
6178 |
+ goto unwrap_failed; |
6179 |
+- maj_stat = gss_verify_mic(ctx->gc_gss_ctx, &integ_buf, &mic); |
6180 |
++ |
6181 |
++ maj_stat = gss_verify_mic(ctx->gc_gss_ctx, &gss_data, &mic); |
6182 |
+ if (maj_stat == GSS_S_CONTEXT_EXPIRED) |
6183 |
+ clear_bit(RPCAUTH_CRED_UPTODATE, &cred->cr_flags); |
6184 |
+ if (maj_stat != GSS_S_COMPLETE) |
6185 |
+@@ -1970,16 +2005,21 @@ gss_unwrap_resp_integ(struct rpc_task *task, struct rpc_cred *cred, |
6186 |
+ |
6187 |
+ auth->au_rslack = auth->au_verfsize + 2 + 1 + XDR_QUADLEN(mic.len); |
6188 |
+ auth->au_ralign = auth->au_verfsize + 2; |
6189 |
+- return 0; |
6190 |
++ ret = 0; |
6191 |
++ |
6192 |
++out: |
6193 |
++ kfree(mic.data); |
6194 |
++ return ret; |
6195 |
++ |
6196 |
+ unwrap_failed: |
6197 |
+ trace_rpcgss_unwrap_failed(task); |
6198 |
+- return -EIO; |
6199 |
++ goto out; |
6200 |
+ bad_seqno: |
6201 |
+- trace_rpcgss_bad_seqno(task, rqstp->rq_seqno, be32_to_cpup(p)); |
6202 |
+- return -EIO; |
6203 |
++ trace_rpcgss_bad_seqno(task, rqstp->rq_seqno, seqno); |
6204 |
++ goto out; |
6205 |
+ bad_mic: |
6206 |
+ trace_rpcgss_verify_mic(task, maj_stat); |
6207 |
+- return -EIO; |
6208 |
++ goto out; |
6209 |
+ } |
6210 |
+ |
6211 |
+ static int |
6212 |
+diff --git a/net/xdp/xdp_umem.c b/net/xdp/xdp_umem.c |
6213 |
+index fa7bb5e060d0..ed7a6060f73c 100644 |
6214 |
+--- a/net/xdp/xdp_umem.c |
6215 |
++++ b/net/xdp/xdp_umem.c |
6216 |
+@@ -343,7 +343,7 @@ static int xdp_umem_reg(struct xdp_umem *umem, struct xdp_umem_reg *mr) |
6217 |
+ u32 chunk_size = mr->chunk_size, headroom = mr->headroom; |
6218 |
+ unsigned int chunks, chunks_per_page; |
6219 |
+ u64 addr = mr->addr, size = mr->len; |
6220 |
+- int size_chk, err; |
6221 |
++ int err; |
6222 |
+ |
6223 |
+ if (chunk_size < XDP_UMEM_MIN_CHUNK_SIZE || chunk_size > PAGE_SIZE) { |
6224 |
+ /* Strictly speaking we could support this, if: |
6225 |
+@@ -382,8 +382,7 @@ static int xdp_umem_reg(struct xdp_umem *umem, struct xdp_umem_reg *mr) |
6226 |
+ return -EINVAL; |
6227 |
+ } |
6228 |
+ |
6229 |
+- size_chk = chunk_size - headroom - XDP_PACKET_HEADROOM; |
6230 |
+- if (size_chk < 0) |
6231 |
++ if (headroom >= chunk_size - XDP_PACKET_HEADROOM) |
6232 |
+ return -EINVAL; |
6233 |
+ |
6234 |
+ umem->address = (unsigned long)addr; |
6235 |
+diff --git a/net/xdp/xsk.c b/net/xdp/xsk.c |
6236 |
+index 356f90e4522b..c350108aa38d 100644 |
6237 |
+--- a/net/xdp/xsk.c |
6238 |
++++ b/net/xdp/xsk.c |
6239 |
+@@ -131,8 +131,9 @@ static void __xsk_rcv_memcpy(struct xdp_umem *umem, u64 addr, void *from_buf, |
6240 |
+ u64 page_start = addr & ~(PAGE_SIZE - 1); |
6241 |
+ u64 first_len = PAGE_SIZE - (addr - page_start); |
6242 |
+ |
6243 |
+- memcpy(to_buf, from_buf, first_len + metalen); |
6244 |
+- memcpy(next_pg_addr, from_buf + first_len, len - first_len); |
6245 |
++ memcpy(to_buf, from_buf, first_len); |
6246 |
++ memcpy(next_pg_addr, from_buf + first_len, |
6247 |
++ len + metalen - first_len); |
6248 |
+ |
6249 |
+ return; |
6250 |
+ } |
6251 |
+diff --git a/security/keys/big_key.c b/security/keys/big_key.c |
6252 |
+index 001abe530a0d..82008f900930 100644 |
6253 |
+--- a/security/keys/big_key.c |
6254 |
++++ b/security/keys/big_key.c |
6255 |
+@@ -352,7 +352,7 @@ void big_key_describe(const struct key *key, struct seq_file *m) |
6256 |
+ * read the key data |
6257 |
+ * - the key's semaphore is read-locked |
6258 |
+ */ |
6259 |
+-long big_key_read(const struct key *key, char __user *buffer, size_t buflen) |
6260 |
++long big_key_read(const struct key *key, char *buffer, size_t buflen) |
6261 |
+ { |
6262 |
+ size_t datalen = (size_t)key->payload.data[big_key_len]; |
6263 |
+ long ret; |
6264 |
+@@ -391,9 +391,8 @@ long big_key_read(const struct key *key, char __user *buffer, size_t buflen) |
6265 |
+ |
6266 |
+ ret = datalen; |
6267 |
+ |
6268 |
+- /* copy decrypted data to user */ |
6269 |
+- if (copy_to_user(buffer, buf->virt, datalen) != 0) |
6270 |
+- ret = -EFAULT; |
6271 |
++ /* copy out decrypted data */ |
6272 |
++ memcpy(buffer, buf->virt, datalen); |
6273 |
+ |
6274 |
+ err_fput: |
6275 |
+ fput(file); |
6276 |
+@@ -401,9 +400,7 @@ error: |
6277 |
+ big_key_free_buffer(buf); |
6278 |
+ } else { |
6279 |
+ ret = datalen; |
6280 |
+- if (copy_to_user(buffer, key->payload.data[big_key_data], |
6281 |
+- datalen) != 0) |
6282 |
+- ret = -EFAULT; |
6283 |
++ memcpy(buffer, key->payload.data[big_key_data], datalen); |
6284 |
+ } |
6285 |
+ |
6286 |
+ return ret; |
6287 |
+diff --git a/security/keys/encrypted-keys/encrypted.c b/security/keys/encrypted-keys/encrypted.c |
6288 |
+index 60720f58cbe0..f6797ba44bf7 100644 |
6289 |
+--- a/security/keys/encrypted-keys/encrypted.c |
6290 |
++++ b/security/keys/encrypted-keys/encrypted.c |
6291 |
+@@ -902,14 +902,14 @@ out: |
6292 |
+ } |
6293 |
+ |
6294 |
+ /* |
6295 |
+- * encrypted_read - format and copy the encrypted data to userspace |
6296 |
++ * encrypted_read - format and copy out the encrypted data |
6297 |
+ * |
6298 |
+ * The resulting datablob format is: |
6299 |
+ * <master-key name> <decrypted data length> <encrypted iv> <encrypted data> |
6300 |
+ * |
6301 |
+ * On success, return to userspace the encrypted key datablob size. |
6302 |
+ */ |
6303 |
+-static long encrypted_read(const struct key *key, char __user *buffer, |
6304 |
++static long encrypted_read(const struct key *key, char *buffer, |
6305 |
+ size_t buflen) |
6306 |
+ { |
6307 |
+ struct encrypted_key_payload *epayload; |
6308 |
+@@ -957,8 +957,7 @@ static long encrypted_read(const struct key *key, char __user *buffer, |
6309 |
+ key_put(mkey); |
6310 |
+ memzero_explicit(derived_key, sizeof(derived_key)); |
6311 |
+ |
6312 |
+- if (copy_to_user(buffer, ascii_buf, asciiblob_len) != 0) |
6313 |
+- ret = -EFAULT; |
6314 |
++ memcpy(buffer, ascii_buf, asciiblob_len); |
6315 |
+ kzfree(ascii_buf); |
6316 |
+ |
6317 |
+ return asciiblob_len; |
6318 |
+diff --git a/security/keys/keyctl.c b/security/keys/keyctl.c |
6319 |
+index d1a3dea58dee..106e16f9006b 100644 |
6320 |
+--- a/security/keys/keyctl.c |
6321 |
++++ b/security/keys/keyctl.c |
6322 |
+@@ -797,6 +797,21 @@ error: |
6323 |
+ return ret; |
6324 |
+ } |
6325 |
+ |
6326 |
++/* |
6327 |
++ * Call the read method |
6328 |
++ */ |
6329 |
++static long __keyctl_read_key(struct key *key, char *buffer, size_t buflen) |
6330 |
++{ |
6331 |
++ long ret; |
6332 |
++ |
6333 |
++ down_read(&key->sem); |
6334 |
++ ret = key_validate(key); |
6335 |
++ if (ret == 0) |
6336 |
++ ret = key->type->read(key, buffer, buflen); |
6337 |
++ up_read(&key->sem); |
6338 |
++ return ret; |
6339 |
++} |
6340 |
++ |
6341 |
+ /* |
6342 |
+ * Read a key's payload. |
6343 |
+ * |
6344 |
+@@ -812,26 +827,27 @@ long keyctl_read_key(key_serial_t keyid, char __user *buffer, size_t buflen) |
6345 |
+ struct key *key; |
6346 |
+ key_ref_t key_ref; |
6347 |
+ long ret; |
6348 |
++ char *key_data; |
6349 |
+ |
6350 |
+ /* find the key first */ |
6351 |
+ key_ref = lookup_user_key(keyid, 0, 0); |
6352 |
+ if (IS_ERR(key_ref)) { |
6353 |
+ ret = -ENOKEY; |
6354 |
+- goto error; |
6355 |
++ goto out; |
6356 |
+ } |
6357 |
+ |
6358 |
+ key = key_ref_to_ptr(key_ref); |
6359 |
+ |
6360 |
+ ret = key_read_state(key); |
6361 |
+ if (ret < 0) |
6362 |
+- goto error2; /* Negatively instantiated */ |
6363 |
++ goto key_put_out; /* Negatively instantiated */ |
6364 |
+ |
6365 |
+ /* see if we can read it directly */ |
6366 |
+ ret = key_permission(key_ref, KEY_NEED_READ); |
6367 |
+ if (ret == 0) |
6368 |
+ goto can_read_key; |
6369 |
+ if (ret != -EACCES) |
6370 |
+- goto error2; |
6371 |
++ goto key_put_out; |
6372 |
+ |
6373 |
+ /* we can't; see if it's searchable from this process's keyrings |
6374 |
+ * - we automatically take account of the fact that it may be |
6375 |
+@@ -839,26 +855,51 @@ long keyctl_read_key(key_serial_t keyid, char __user *buffer, size_t buflen) |
6376 |
+ */ |
6377 |
+ if (!is_key_possessed(key_ref)) { |
6378 |
+ ret = -EACCES; |
6379 |
+- goto error2; |
6380 |
++ goto key_put_out; |
6381 |
+ } |
6382 |
+ |
6383 |
+ /* the key is probably readable - now try to read it */ |
6384 |
+ can_read_key: |
6385 |
+- ret = -EOPNOTSUPP; |
6386 |
+- if (key->type->read) { |
6387 |
+- /* Read the data with the semaphore held (since we might sleep) |
6388 |
+- * to protect against the key being updated or revoked. |
6389 |
+- */ |
6390 |
+- down_read(&key->sem); |
6391 |
+- ret = key_validate(key); |
6392 |
+- if (ret == 0) |
6393 |
+- ret = key->type->read(key, buffer, buflen); |
6394 |
+- up_read(&key->sem); |
6395 |
++ if (!key->type->read) { |
6396 |
++ ret = -EOPNOTSUPP; |
6397 |
++ goto key_put_out; |
6398 |
+ } |
6399 |
+ |
6400 |
+-error2: |
6401 |
++ if (!buffer || !buflen) { |
6402 |
++ /* Get the key length from the read method */ |
6403 |
++ ret = __keyctl_read_key(key, NULL, 0); |
6404 |
++ goto key_put_out; |
6405 |
++ } |
6406 |
++ |
6407 |
++ /* |
6408 |
++ * Read the data with the semaphore held (since we might sleep) |
6409 |
++ * to protect against the key being updated or revoked. |
6410 |
++ * |
6411 |
++ * Allocating a temporary buffer to hold the keys before |
6412 |
++ * transferring them to user buffer to avoid potential |
6413 |
++ * deadlock involving page fault and mmap_sem. |
6414 |
++ */ |
6415 |
++ key_data = kmalloc(buflen, GFP_KERNEL); |
6416 |
++ |
6417 |
++ if (!key_data) { |
6418 |
++ ret = -ENOMEM; |
6419 |
++ goto key_put_out; |
6420 |
++ } |
6421 |
++ ret = __keyctl_read_key(key, key_data, buflen); |
6422 |
++ |
6423 |
++ /* |
6424 |
++ * Read methods will just return the required length without |
6425 |
++ * any copying if the provided length isn't large enough. |
6426 |
++ */ |
6427 |
++ if (ret > 0 && ret <= buflen) { |
6428 |
++ if (copy_to_user(buffer, key_data, ret)) |
6429 |
++ ret = -EFAULT; |
6430 |
++ } |
6431 |
++ kzfree(key_data); |
6432 |
++ |
6433 |
++key_put_out: |
6434 |
+ key_put(key); |
6435 |
+-error: |
6436 |
++out: |
6437 |
+ return ret; |
6438 |
+ } |
6439 |
+ |
6440 |
+diff --git a/security/keys/keyring.c b/security/keys/keyring.c |
6441 |
+index febf36c6ddc5..5ca620d31cd3 100644 |
6442 |
+--- a/security/keys/keyring.c |
6443 |
++++ b/security/keys/keyring.c |
6444 |
+@@ -459,7 +459,6 @@ static int keyring_read_iterator(const void *object, void *data) |
6445 |
+ { |
6446 |
+ struct keyring_read_iterator_context *ctx = data; |
6447 |
+ const struct key *key = keyring_ptr_to_key(object); |
6448 |
+- int ret; |
6449 |
+ |
6450 |
+ kenter("{%s,%d},,{%zu/%zu}", |
6451 |
+ key->type->name, key->serial, ctx->count, ctx->buflen); |
6452 |
+@@ -467,10 +466,7 @@ static int keyring_read_iterator(const void *object, void *data) |
6453 |
+ if (ctx->count >= ctx->buflen) |
6454 |
+ return 1; |
6455 |
+ |
6456 |
+- ret = put_user(key->serial, ctx->buffer); |
6457 |
+- if (ret < 0) |
6458 |
+- return ret; |
6459 |
+- ctx->buffer++; |
6460 |
++ *ctx->buffer++ = key->serial; |
6461 |
+ ctx->count += sizeof(key->serial); |
6462 |
+ return 0; |
6463 |
+ } |
6464 |
+diff --git a/security/keys/request_key_auth.c b/security/keys/request_key_auth.c |
6465 |
+index ecba39c93fd9..41e9735006d0 100644 |
6466 |
+--- a/security/keys/request_key_auth.c |
6467 |
++++ b/security/keys/request_key_auth.c |
6468 |
+@@ -22,7 +22,7 @@ static int request_key_auth_instantiate(struct key *, |
6469 |
+ static void request_key_auth_describe(const struct key *, struct seq_file *); |
6470 |
+ static void request_key_auth_revoke(struct key *); |
6471 |
+ static void request_key_auth_destroy(struct key *); |
6472 |
+-static long request_key_auth_read(const struct key *, char __user *, size_t); |
6473 |
++static long request_key_auth_read(const struct key *, char *, size_t); |
6474 |
+ |
6475 |
+ /* |
6476 |
+ * The request-key authorisation key type definition. |
6477 |
+@@ -80,7 +80,7 @@ static void request_key_auth_describe(const struct key *key, |
6478 |
+ * - the key's semaphore is read-locked |
6479 |
+ */ |
6480 |
+ static long request_key_auth_read(const struct key *key, |
6481 |
+- char __user *buffer, size_t buflen) |
6482 |
++ char *buffer, size_t buflen) |
6483 |
+ { |
6484 |
+ struct request_key_auth *rka = dereference_key_locked(key); |
6485 |
+ size_t datalen; |
6486 |
+@@ -97,8 +97,7 @@ static long request_key_auth_read(const struct key *key, |
6487 |
+ if (buflen > datalen) |
6488 |
+ buflen = datalen; |
6489 |
+ |
6490 |
+- if (copy_to_user(buffer, rka->callout_info, buflen) != 0) |
6491 |
+- ret = -EFAULT; |
6492 |
++ memcpy(buffer, rka->callout_info, buflen); |
6493 |
+ } |
6494 |
+ |
6495 |
+ return ret; |
6496 |
+diff --git a/security/keys/trusted-keys/trusted_tpm1.c b/security/keys/trusted-keys/trusted_tpm1.c |
6497 |
+index d2c5ec1e040b..8001ab07e63b 100644 |
6498 |
+--- a/security/keys/trusted-keys/trusted_tpm1.c |
6499 |
++++ b/security/keys/trusted-keys/trusted_tpm1.c |
6500 |
+@@ -1130,11 +1130,10 @@ out: |
6501 |
+ * trusted_read - copy the sealed blob data to userspace in hex. |
6502 |
+ * On success, return to userspace the trusted key datablob size. |
6503 |
+ */ |
6504 |
+-static long trusted_read(const struct key *key, char __user *buffer, |
6505 |
++static long trusted_read(const struct key *key, char *buffer, |
6506 |
+ size_t buflen) |
6507 |
+ { |
6508 |
+ const struct trusted_key_payload *p; |
6509 |
+- char *ascii_buf; |
6510 |
+ char *bufp; |
6511 |
+ int i; |
6512 |
+ |
6513 |
+@@ -1143,18 +1142,9 @@ static long trusted_read(const struct key *key, char __user *buffer, |
6514 |
+ return -EINVAL; |
6515 |
+ |
6516 |
+ if (buffer && buflen >= 2 * p->blob_len) { |
6517 |
+- ascii_buf = kmalloc_array(2, p->blob_len, GFP_KERNEL); |
6518 |
+- if (!ascii_buf) |
6519 |
+- return -ENOMEM; |
6520 |
+- |
6521 |
+- bufp = ascii_buf; |
6522 |
++ bufp = buffer; |
6523 |
+ for (i = 0; i < p->blob_len; i++) |
6524 |
+ bufp = hex_byte_pack(bufp, p->blob[i]); |
6525 |
+- if (copy_to_user(buffer, ascii_buf, 2 * p->blob_len) != 0) { |
6526 |
+- kzfree(ascii_buf); |
6527 |
+- return -EFAULT; |
6528 |
+- } |
6529 |
+- kzfree(ascii_buf); |
6530 |
+ } |
6531 |
+ return 2 * p->blob_len; |
6532 |
+ } |
6533 |
+diff --git a/security/keys/user_defined.c b/security/keys/user_defined.c |
6534 |
+index 6f12de4ce549..07d4287e9084 100644 |
6535 |
+--- a/security/keys/user_defined.c |
6536 |
++++ b/security/keys/user_defined.c |
6537 |
+@@ -168,7 +168,7 @@ EXPORT_SYMBOL_GPL(user_describe); |
6538 |
+ * read the key data |
6539 |
+ * - the key's semaphore is read-locked |
6540 |
+ */ |
6541 |
+-long user_read(const struct key *key, char __user *buffer, size_t buflen) |
6542 |
++long user_read(const struct key *key, char *buffer, size_t buflen) |
6543 |
+ { |
6544 |
+ const struct user_key_payload *upayload; |
6545 |
+ long ret; |
6546 |
+@@ -181,8 +181,7 @@ long user_read(const struct key *key, char __user *buffer, size_t buflen) |
6547 |
+ if (buflen > upayload->datalen) |
6548 |
+ buflen = upayload->datalen; |
6549 |
+ |
6550 |
+- if (copy_to_user(buffer, upayload->data, buflen) != 0) |
6551 |
+- ret = -EFAULT; |
6552 |
++ memcpy(buffer, upayload->data, buflen); |
6553 |
+ } |
6554 |
+ |
6555 |
+ return ret; |
6556 |
+diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c |
6557 |
+index bd093593f8fb..f41d8b7864c1 100644 |
6558 |
+--- a/sound/pci/hda/hda_intel.c |
6559 |
++++ b/sound/pci/hda/hda_intel.c |
6560 |
+@@ -1071,6 +1071,8 @@ static int azx_freeze_noirq(struct device *dev) |
6561 |
+ struct azx *chip = card->private_data; |
6562 |
+ struct pci_dev *pci = to_pci_dev(dev); |
6563 |
+ |
6564 |
++ if (!azx_is_pm_ready(card)) |
6565 |
++ return 0; |
6566 |
+ if (chip->driver_type == AZX_DRIVER_SKL) |
6567 |
+ pci_set_power_state(pci, PCI_D3hot); |
6568 |
+ |
6569 |
+@@ -1083,6 +1085,8 @@ static int azx_thaw_noirq(struct device *dev) |
6570 |
+ struct azx *chip = card->private_data; |
6571 |
+ struct pci_dev *pci = to_pci_dev(dev); |
6572 |
+ |
6573 |
++ if (!azx_is_pm_ready(card)) |
6574 |
++ return 0; |
6575 |
+ if (chip->driver_type == AZX_DRIVER_SKL) |
6576 |
+ pci_set_power_state(pci, PCI_D0); |
6577 |
+ |
6578 |
+@@ -2027,24 +2031,15 @@ static void azx_firmware_cb(const struct firmware *fw, void *context) |
6579 |
+ { |
6580 |
+ struct snd_card *card = context; |
6581 |
+ struct azx *chip = card->private_data; |
6582 |
+- struct pci_dev *pci = chip->pci; |
6583 |
+ |
6584 |
+- if (!fw) { |
6585 |
+- dev_err(card->dev, "Cannot load firmware, aborting\n"); |
6586 |
+- goto error; |
6587 |
+- } |
6588 |
+- |
6589 |
+- chip->fw = fw; |
6590 |
++ if (fw) |
6591 |
++ chip->fw = fw; |
6592 |
++ else |
6593 |
++ dev_err(card->dev, "Cannot load firmware, continue without patching\n"); |
6594 |
+ if (!chip->disabled) { |
6595 |
+ /* continue probing */ |
6596 |
+- if (azx_probe_continue(chip)) |
6597 |
+- goto error; |
6598 |
++ azx_probe_continue(chip); |
6599 |
+ } |
6600 |
+- return; /* OK */ |
6601 |
+- |
6602 |
+- error: |
6603 |
+- snd_card_free(card); |
6604 |
+- pci_set_drvdata(pci, NULL); |
6605 |
+ } |
6606 |
+ #endif |
6607 |
+ |
6608 |
+diff --git a/tools/lib/bpf/netlink.c b/tools/lib/bpf/netlink.c |
6609 |
+index 431bd25c6cdb..6d47345a310b 100644 |
6610 |
+--- a/tools/lib/bpf/netlink.c |
6611 |
++++ b/tools/lib/bpf/netlink.c |
6612 |
+@@ -289,7 +289,7 @@ int bpf_get_link_xdp_info(int ifindex, struct xdp_link_info *info, |
6613 |
+ |
6614 |
+ static __u32 get_xdp_id(struct xdp_link_info *info, __u32 flags) |
6615 |
+ { |
6616 |
+- if (info->attach_mode != XDP_ATTACHED_MULTI) |
6617 |
++ if (info->attach_mode != XDP_ATTACHED_MULTI && !flags) |
6618 |
+ return info->prog_id; |
6619 |
+ if (flags & XDP_FLAGS_DRV_MODE) |
6620 |
+ return info->drv_prog_id; |
6621 |
+diff --git a/tools/objtool/check.c b/tools/objtool/check.c |
6622 |
+index 4768d91c6d68..2b765bbbef92 100644 |
6623 |
+--- a/tools/objtool/check.c |
6624 |
++++ b/tools/objtool/check.c |
6625 |
+@@ -1011,10 +1011,7 @@ static struct rela *find_jump_table(struct objtool_file *file, |
6626 |
+ * it. |
6627 |
+ */ |
6628 |
+ for (; |
6629 |
+- &insn->list != &file->insn_list && |
6630 |
+- insn->sec == func->sec && |
6631 |
+- insn->offset >= func->offset; |
6632 |
+- |
6633 |
++ &insn->list != &file->insn_list && insn->func && insn->func->pfunc == func; |
6634 |
+ insn = insn->first_jump_src ?: list_prev_entry(insn, list)) { |
6635 |
+ |
6636 |
+ if (insn != orig_insn && insn->type == INSN_JUMP_DYNAMIC) |
6637 |
+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 |
6638 |
+index eba9a970703b..925722217edf 100644 |
6639 |
+--- a/tools/testing/selftests/bpf/prog_tests/get_stack_raw_tp.c |
6640 |
++++ b/tools/testing/selftests/bpf/prog_tests/get_stack_raw_tp.c |
6641 |
+@@ -82,6 +82,7 @@ static void get_stack_print_output(void *ctx, int cpu, void *data, __u32 size) |
6642 |
+ void test_get_stack_raw_tp(void) |
6643 |
+ { |
6644 |
+ const char *file = "./test_get_stack_rawtp.o"; |
6645 |
++ const char *file_err = "./test_get_stack_rawtp_err.o"; |
6646 |
+ const char *prog_name = "raw_tracepoint/sys_enter"; |
6647 |
+ int i, err, prog_fd, exp_cnt = MAX_CNT_RAWTP; |
6648 |
+ struct perf_buffer_opts pb_opts = {}; |
6649 |
+@@ -93,6 +94,10 @@ void test_get_stack_raw_tp(void) |
6650 |
+ struct bpf_map *map; |
6651 |
+ cpu_set_t cpu_set; |
6652 |
+ |
6653 |
++ err = bpf_prog_load(file_err, BPF_PROG_TYPE_RAW_TRACEPOINT, &obj, &prog_fd); |
6654 |
++ if (CHECK(err >= 0, "prog_load raw tp", "err %d errno %d\n", err, errno)) |
6655 |
++ return; |
6656 |
++ |
6657 |
+ err = bpf_prog_load(file, BPF_PROG_TYPE_RAW_TRACEPOINT, &obj, &prog_fd); |
6658 |
+ if (CHECK(err, "prog_load raw tp", "err %d errno %d\n", err, errno)) |
6659 |
+ return; |
6660 |
+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 |
6661 |
+new file mode 100644 |
6662 |
+index 000000000000..8941a41c2a55 |
6663 |
+--- /dev/null |
6664 |
++++ b/tools/testing/selftests/bpf/progs/test_get_stack_rawtp_err.c |
6665 |
+@@ -0,0 +1,26 @@ |
6666 |
++// SPDX-License-Identifier: GPL-2.0 |
6667 |
++ |
6668 |
++#include <linux/bpf.h> |
6669 |
++#include <bpf/bpf_helpers.h> |
6670 |
++ |
6671 |
++#define MAX_STACK_RAWTP 10 |
6672 |
++ |
6673 |
++SEC("raw_tracepoint/sys_enter") |
6674 |
++int bpf_prog2(void *ctx) |
6675 |
++{ |
6676 |
++ __u64 stack[MAX_STACK_RAWTP]; |
6677 |
++ int error; |
6678 |
++ |
6679 |
++ /* set all the flags which should return -EINVAL */ |
6680 |
++ error = bpf_get_stack(ctx, stack, 0, -1); |
6681 |
++ if (error < 0) |
6682 |
++ goto loop; |
6683 |
++ |
6684 |
++ return error; |
6685 |
++loop: |
6686 |
++ while (1) { |
6687 |
++ error++; |
6688 |
++ } |
6689 |
++} |
6690 |
++ |
6691 |
++char _license[] SEC("license") = "GPL"; |
6692 |
+diff --git a/tools/testing/selftests/bpf/verifier/bpf_get_stack.c b/tools/testing/selftests/bpf/verifier/bpf_get_stack.c |
6693 |
+index f24d50f09dbe..371926771db5 100644 |
6694 |
+--- a/tools/testing/selftests/bpf/verifier/bpf_get_stack.c |
6695 |
++++ b/tools/testing/selftests/bpf/verifier/bpf_get_stack.c |
6696 |
+@@ -9,17 +9,17 @@ |
6697 |
+ BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0, BPF_FUNC_map_lookup_elem), |
6698 |
+ BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, 0, 28), |
6699 |
+ BPF_MOV64_REG(BPF_REG_7, BPF_REG_0), |
6700 |
+- BPF_MOV64_IMM(BPF_REG_9, sizeof(struct test_val)), |
6701 |
++ BPF_MOV64_IMM(BPF_REG_9, sizeof(struct test_val)/2), |
6702 |
+ BPF_MOV64_REG(BPF_REG_1, BPF_REG_6), |
6703 |
+ BPF_MOV64_REG(BPF_REG_2, BPF_REG_7), |
6704 |
+- BPF_MOV64_IMM(BPF_REG_3, sizeof(struct test_val)), |
6705 |
++ BPF_MOV64_IMM(BPF_REG_3, sizeof(struct test_val)/2), |
6706 |
+ BPF_MOV64_IMM(BPF_REG_4, 256), |
6707 |
+ BPF_EMIT_CALL(BPF_FUNC_get_stack), |
6708 |
+ BPF_MOV64_IMM(BPF_REG_1, 0), |
6709 |
+ BPF_MOV64_REG(BPF_REG_8, BPF_REG_0), |
6710 |
+ BPF_ALU64_IMM(BPF_LSH, BPF_REG_8, 32), |
6711 |
+ BPF_ALU64_IMM(BPF_ARSH, BPF_REG_8, 32), |
6712 |
+- BPF_JMP_REG(BPF_JSLT, BPF_REG_1, BPF_REG_8, 16), |
6713 |
++ BPF_JMP_REG(BPF_JSLT, BPF_REG_8, BPF_REG_1, 16), |
6714 |
+ BPF_ALU64_REG(BPF_SUB, BPF_REG_9, BPF_REG_8), |
6715 |
+ BPF_MOV64_REG(BPF_REG_2, BPF_REG_7), |
6716 |
+ BPF_ALU64_REG(BPF_ADD, BPF_REG_2, BPF_REG_8), |
6717 |
+@@ -29,7 +29,7 @@ |
6718 |
+ BPF_MOV64_REG(BPF_REG_3, BPF_REG_2), |
6719 |
+ BPF_ALU64_REG(BPF_ADD, BPF_REG_3, BPF_REG_1), |
6720 |
+ BPF_MOV64_REG(BPF_REG_1, BPF_REG_7), |
6721 |
+- BPF_MOV64_IMM(BPF_REG_5, sizeof(struct test_val)), |
6722 |
++ BPF_MOV64_IMM(BPF_REG_5, sizeof(struct test_val)/2), |
6723 |
+ BPF_ALU64_REG(BPF_ADD, BPF_REG_1, BPF_REG_5), |
6724 |
+ BPF_JMP_REG(BPF_JGE, BPF_REG_3, BPF_REG_1, 4), |
6725 |
+ BPF_MOV64_REG(BPF_REG_1, BPF_REG_6), |