Gentoo Archives: gentoo-commits

From: Mike Pagano <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/linux-patches:5.13 commit in: /
Date: Wed, 15 Sep 2021 11:59:22
Message-Id: 1631707141.28c88a1f45d165a39d82b198849358c4823da767.mpagano@gentoo
1 commit: 28c88a1f45d165a39d82b198849358c4823da767
2 Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
3 AuthorDate: Wed Sep 15 11:59:01 2021 +0000
4 Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
5 CommitDate: Wed Sep 15 11:59:01 2021 +0000
6 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=28c88a1f
7
8 Linux patch 5.13.17
9
10 Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org>
11
12 0000_README | 4 +
13 1016_linux-5.13.17.patch | 11676 +++++++++++++++++++++++++++++++++++++++++++++
14 2 files changed, 11680 insertions(+)
15
16 diff --git a/0000_README b/0000_README
17 index 640800f..ab01fc2 100644
18 --- a/0000_README
19 +++ b/0000_README
20 @@ -107,6 +107,10 @@ Patch: 1015_linux-5.13.16.patch
21 From: http://www.kernel.org
22 Desc: Linux 5.13.16
23
24 +Patch: 1016_linux-5.13.17.patch
25 +From: http://www.kernel.org
26 +Desc: Linux 5.13.17
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/1016_linux-5.13.17.patch b/1016_linux-5.13.17.patch
33 new file mode 100644
34 index 0000000..6561764
35 --- /dev/null
36 +++ b/1016_linux-5.13.17.patch
37 @@ -0,0 +1,11676 @@
38 +diff --git a/Documentation/fault-injection/provoke-crashes.rst b/Documentation/fault-injection/provoke-crashes.rst
39 +index a20ba5d939320..18de17354206a 100644
40 +--- a/Documentation/fault-injection/provoke-crashes.rst
41 ++++ b/Documentation/fault-injection/provoke-crashes.rst
42 +@@ -29,7 +29,7 @@ recur_count
43 + cpoint_name
44 + Where in the kernel to trigger the action. It can be
45 + one of INT_HARDWARE_ENTRY, INT_HW_IRQ_EN, INT_TASKLET_ENTRY,
46 +- FS_DEVRW, MEM_SWAPOUT, TIMERADD, SCSI_DISPATCH_CMD,
47 ++ FS_DEVRW, MEM_SWAPOUT, TIMERADD, SCSI_QUEUE_RQ,
48 + IDE_CORE_CP, or DIRECT
49 +
50 + cpoint_type
51 +diff --git a/Makefile b/Makefile
52 +index cbb2f35baedbc..c79a2c70a22ba 100644
53 +--- a/Makefile
54 ++++ b/Makefile
55 +@@ -1,7 +1,7 @@
56 + # SPDX-License-Identifier: GPL-2.0
57 + VERSION = 5
58 + PATCHLEVEL = 13
59 +-SUBLEVEL = 16
60 ++SUBLEVEL = 17
61 + EXTRAVERSION =
62 + NAME = Opossums on Parade
63 +
64 +diff --git a/arch/arm/boot/dts/aspeed-g6-pinctrl.dtsi b/arch/arm/boot/dts/aspeed-g6-pinctrl.dtsi
65 +index 7028e21bdd980..910eacc8ad3bd 100644
66 +--- a/arch/arm/boot/dts/aspeed-g6-pinctrl.dtsi
67 ++++ b/arch/arm/boot/dts/aspeed-g6-pinctrl.dtsi
68 +@@ -208,12 +208,12 @@
69 + };
70 +
71 + pinctrl_hvi3c3_default: hvi3c3_default {
72 +- function = "HVI3C3";
73 ++ function = "I3C3";
74 + groups = "HVI3C3";
75 + };
76 +
77 + pinctrl_hvi3c4_default: hvi3c4_default {
78 +- function = "HVI3C4";
79 ++ function = "I3C4";
80 + groups = "HVI3C4";
81 + };
82 +
83 +diff --git a/arch/arm/boot/dts/at91-sam9x60ek.dts b/arch/arm/boot/dts/at91-sam9x60ek.dts
84 +index edca66c232c15..ebbc9b23aef1c 100644
85 +--- a/arch/arm/boot/dts/at91-sam9x60ek.dts
86 ++++ b/arch/arm/boot/dts/at91-sam9x60ek.dts
87 +@@ -92,6 +92,8 @@
88 +
89 + leds {
90 + compatible = "gpio-leds";
91 ++ pinctrl-names = "default";
92 ++ pinctrl-0 = <&pinctrl_gpio_leds>;
93 + status = "okay"; /* Conflict with pwm0. */
94 +
95 + red {
96 +@@ -537,6 +539,10 @@
97 + AT91_PIOA 19 AT91_PERIPH_A (AT91_PINCTRL_PULL_UP | AT91_PINCTRL_DRIVE_STRENGTH_HI) /* PA19 DAT2 periph A with pullup */
98 + AT91_PIOA 20 AT91_PERIPH_A (AT91_PINCTRL_PULL_UP | AT91_PINCTRL_DRIVE_STRENGTH_HI)>; /* PA20 DAT3 periph A with pullup */
99 + };
100 ++ pinctrl_sdmmc0_cd: sdmmc0_cd {
101 ++ atmel,pins =
102 ++ <AT91_PIOA 23 AT91_PERIPH_GPIO AT91_PINCTRL_NONE>;
103 ++ };
104 + };
105 +
106 + sdmmc1 {
107 +@@ -569,6 +575,14 @@
108 + AT91_PIOD 16 AT91_PERIPH_GPIO AT91_PINCTRL_NONE>;
109 + };
110 + };
111 ++
112 ++ leds {
113 ++ pinctrl_gpio_leds: gpio_leds {
114 ++ atmel,pins = <AT91_PIOB 11 AT91_PERIPH_GPIO AT91_PINCTRL_NONE
115 ++ AT91_PIOB 12 AT91_PERIPH_GPIO AT91_PINCTRL_NONE
116 ++ AT91_PIOB 13 AT91_PERIPH_GPIO AT91_PINCTRL_NONE>;
117 ++ };
118 ++ };
119 + }; /* pinctrl */
120 +
121 + &pwm0 {
122 +@@ -580,7 +594,7 @@
123 + &sdmmc0 {
124 + bus-width = <4>;
125 + pinctrl-names = "default";
126 +- pinctrl-0 = <&pinctrl_sdmmc0_default>;
127 ++ pinctrl-0 = <&pinctrl_sdmmc0_default &pinctrl_sdmmc0_cd>;
128 + status = "okay";
129 + cd-gpios = <&pioA 23 GPIO_ACTIVE_LOW>;
130 + disable-wp;
131 +diff --git a/arch/arm/boot/dts/at91-sama5d3_xplained.dts b/arch/arm/boot/dts/at91-sama5d3_xplained.dts
132 +index 9c55a921263bd..cc55d1684322b 100644
133 +--- a/arch/arm/boot/dts/at91-sama5d3_xplained.dts
134 ++++ b/arch/arm/boot/dts/at91-sama5d3_xplained.dts
135 +@@ -57,6 +57,8 @@
136 + };
137 +
138 + spi0: spi@f0004000 {
139 ++ pinctrl-names = "default";
140 ++ pinctrl-0 = <&pinctrl_spi0_cs>;
141 + cs-gpios = <&pioD 13 0>, <0>, <0>, <&pioD 16 0>;
142 + status = "okay";
143 + };
144 +@@ -169,6 +171,8 @@
145 + };
146 +
147 + spi1: spi@f8008000 {
148 ++ pinctrl-names = "default";
149 ++ pinctrl-0 = <&pinctrl_spi1_cs>;
150 + cs-gpios = <&pioC 25 0>;
151 + status = "okay";
152 + };
153 +@@ -248,6 +252,26 @@
154 + <AT91_PIOE 3 AT91_PERIPH_GPIO AT91_PINCTRL_NONE
155 + AT91_PIOE 4 AT91_PERIPH_GPIO AT91_PINCTRL_NONE>;
156 + };
157 ++
158 ++ pinctrl_gpio_leds: gpio_leds_default {
159 ++ atmel,pins =
160 ++ <AT91_PIOE 23 AT91_PERIPH_GPIO AT91_PINCTRL_NONE
161 ++ AT91_PIOE 24 AT91_PERIPH_GPIO AT91_PINCTRL_NONE>;
162 ++ };
163 ++
164 ++ pinctrl_spi0_cs: spi0_cs_default {
165 ++ atmel,pins =
166 ++ <AT91_PIOD 13 AT91_PERIPH_GPIO AT91_PINCTRL_NONE
167 ++ AT91_PIOD 16 AT91_PERIPH_GPIO AT91_PINCTRL_NONE>;
168 ++ };
169 ++
170 ++ pinctrl_spi1_cs: spi1_cs_default {
171 ++ atmel,pins = <AT91_PIOC 25 AT91_PERIPH_GPIO AT91_PINCTRL_NONE>;
172 ++ };
173 ++
174 ++ pinctrl_vcc_mmc0_reg_gpio: vcc_mmc0_reg_gpio_default {
175 ++ atmel,pins = <AT91_PIOE 2 AT91_PERIPH_GPIO AT91_PINCTRL_NONE>;
176 ++ };
177 + };
178 + };
179 + };
180 +@@ -339,6 +363,8 @@
181 +
182 + vcc_mmc0_reg: fixedregulator_mmc0 {
183 + compatible = "regulator-fixed";
184 ++ pinctrl-names = "default";
185 ++ pinctrl-0 = <&pinctrl_vcc_mmc0_reg_gpio>;
186 + gpio = <&pioE 2 GPIO_ACTIVE_LOW>;
187 + regulator-name = "mmc0-card-supply";
188 + regulator-min-microvolt = <3300000>;
189 +@@ -362,6 +388,9 @@
190 +
191 + leds {
192 + compatible = "gpio-leds";
193 ++ pinctrl-names = "default";
194 ++ pinctrl-0 = <&pinctrl_gpio_leds>;
195 ++ status = "okay";
196 +
197 + d2 {
198 + label = "d2";
199 +diff --git a/arch/arm/boot/dts/at91-sama5d4_xplained.dts b/arch/arm/boot/dts/at91-sama5d4_xplained.dts
200 +index 0b3ad1b580b83..e42dae06b5826 100644
201 +--- a/arch/arm/boot/dts/at91-sama5d4_xplained.dts
202 ++++ b/arch/arm/boot/dts/at91-sama5d4_xplained.dts
203 +@@ -90,6 +90,8 @@
204 + };
205 +
206 + spi1: spi@fc018000 {
207 ++ pinctrl-names = "default";
208 ++ pinctrl-0 = <&pinctrl_spi0_cs>;
209 + cs-gpios = <&pioB 21 0>;
210 + status = "okay";
211 + };
212 +@@ -147,6 +149,19 @@
213 + atmel,pins =
214 + <AT91_PIOE 1 AT91_PERIPH_GPIO AT91_PINCTRL_PULL_UP_DEGLITCH>;
215 + };
216 ++ pinctrl_spi0_cs: spi0_cs_default {
217 ++ atmel,pins =
218 ++ <AT91_PIOB 21 AT91_PERIPH_GPIO AT91_PINCTRL_NONE>;
219 ++ };
220 ++ pinctrl_gpio_leds: gpio_leds_default {
221 ++ atmel,pins =
222 ++ <AT91_PIOD 30 AT91_PERIPH_GPIO AT91_PINCTRL_NONE
223 ++ AT91_PIOE 15 AT91_PERIPH_GPIO AT91_PINCTRL_NONE>;
224 ++ };
225 ++ pinctrl_vcc_mmc1_reg: vcc_mmc1_reg {
226 ++ atmel,pins =
227 ++ <AT91_PIOE 4 AT91_PERIPH_GPIO AT91_PINCTRL_NONE>;
228 ++ };
229 + };
230 + };
231 + };
232 +@@ -252,6 +267,8 @@
233 +
234 + leds {
235 + compatible = "gpio-leds";
236 ++ pinctrl-names = "default";
237 ++ pinctrl-0 = <&pinctrl_gpio_leds>;
238 + status = "okay";
239 +
240 + d8 {
241 +@@ -278,6 +295,8 @@
242 +
243 + vcc_mmc1_reg: fixedregulator_mmc1 {
244 + compatible = "regulator-fixed";
245 ++ pinctrl-names = "default";
246 ++ pinctrl-0 = <&pinctrl_vcc_mmc1_reg>;
247 + gpio = <&pioE 4 GPIO_ACTIVE_LOW>;
248 + regulator-name = "VDD MCI1";
249 + regulator-min-microvolt = <3300000>;
250 +diff --git a/arch/arm/boot/dts/meson8.dtsi b/arch/arm/boot/dts/meson8.dtsi
251 +index 157a950a55d38..686c7b7c79d55 100644
252 +--- a/arch/arm/boot/dts/meson8.dtsi
253 ++++ b/arch/arm/boot/dts/meson8.dtsi
254 +@@ -304,8 +304,13 @@
255 + "pp2", "ppmmu2", "pp4", "ppmmu4",
256 + "pp5", "ppmmu5", "pp6", "ppmmu6";
257 + resets = <&reset RESET_MALI>;
258 ++
259 + clocks = <&clkc CLKID_CLK81>, <&clkc CLKID_MALI>;
260 + clock-names = "bus", "core";
261 ++
262 ++ assigned-clocks = <&clkc CLKID_MALI>;
263 ++ assigned-clock-rates = <318750000>;
264 ++
265 + operating-points-v2 = <&gpu_opp_table>;
266 + #cooling-cells = <2>; /* min followed by max */
267 + };
268 +diff --git a/arch/arm/boot/dts/meson8b-ec100.dts b/arch/arm/boot/dts/meson8b-ec100.dts
269 +index 8e48ccc6b634e..7e8ddc6f1252b 100644
270 +--- a/arch/arm/boot/dts/meson8b-ec100.dts
271 ++++ b/arch/arm/boot/dts/meson8b-ec100.dts
272 +@@ -148,7 +148,7 @@
273 + regulator-min-microvolt = <860000>;
274 + regulator-max-microvolt = <1140000>;
275 +
276 +- vin-supply = <&vcc_5v>;
277 ++ pwm-supply = <&vcc_5v>;
278 +
279 + pwms = <&pwm_cd 0 1148 0>;
280 + pwm-dutycycle-range = <100 0>;
281 +@@ -232,7 +232,7 @@
282 + regulator-min-microvolt = <860000>;
283 + regulator-max-microvolt = <1140000>;
284 +
285 +- vin-supply = <&vcc_5v>;
286 ++ pwm-supply = <&vcc_5v>;
287 +
288 + pwms = <&pwm_cd 1 1148 0>;
289 + pwm-dutycycle-range = <100 0>;
290 +diff --git a/arch/arm/boot/dts/meson8b-mxq.dts b/arch/arm/boot/dts/meson8b-mxq.dts
291 +index f3937d55472d4..7adedd3258c33 100644
292 +--- a/arch/arm/boot/dts/meson8b-mxq.dts
293 ++++ b/arch/arm/boot/dts/meson8b-mxq.dts
294 +@@ -34,6 +34,8 @@
295 + regulator-min-microvolt = <860000>;
296 + regulator-max-microvolt = <1140000>;
297 +
298 ++ pwm-supply = <&vcc_5v>;
299 ++
300 + pwms = <&pwm_cd 0 1148 0>;
301 + pwm-dutycycle-range = <100 0>;
302 +
303 +@@ -79,7 +81,7 @@
304 + regulator-min-microvolt = <860000>;
305 + regulator-max-microvolt = <1140000>;
306 +
307 +- vin-supply = <&vcc_5v>;
308 ++ pwm-supply = <&vcc_5v>;
309 +
310 + pwms = <&pwm_cd 1 1148 0>;
311 + pwm-dutycycle-range = <100 0>;
312 +diff --git a/arch/arm/boot/dts/meson8b-odroidc1.dts b/arch/arm/boot/dts/meson8b-odroidc1.dts
313 +index c440ef94e0820..04356bc639faf 100644
314 +--- a/arch/arm/boot/dts/meson8b-odroidc1.dts
315 ++++ b/arch/arm/boot/dts/meson8b-odroidc1.dts
316 +@@ -131,7 +131,7 @@
317 + regulator-min-microvolt = <860000>;
318 + regulator-max-microvolt = <1140000>;
319 +
320 +- vin-supply = <&p5v0>;
321 ++ pwm-supply = <&p5v0>;
322 +
323 + pwms = <&pwm_cd 0 12218 0>;
324 + pwm-dutycycle-range = <91 0>;
325 +@@ -163,7 +163,7 @@
326 + regulator-min-microvolt = <860000>;
327 + regulator-max-microvolt = <1140000>;
328 +
329 +- vin-supply = <&p5v0>;
330 ++ pwm-supply = <&p5v0>;
331 +
332 + pwms = <&pwm_cd 1 12218 0>;
333 + pwm-dutycycle-range = <91 0>;
334 +diff --git a/arch/arm64/boot/dts/exynos/exynos7.dtsi b/arch/arm64/boot/dts/exynos/exynos7.dtsi
335 +index 10244e59d56dd..56a0bb7eb0e69 100644
336 +--- a/arch/arm64/boot/dts/exynos/exynos7.dtsi
337 ++++ b/arch/arm64/boot/dts/exynos/exynos7.dtsi
338 +@@ -102,7 +102,7 @@
339 + #address-cells = <0>;
340 + interrupt-controller;
341 + reg = <0x11001000 0x1000>,
342 +- <0x11002000 0x1000>,
343 ++ <0x11002000 0x2000>,
344 + <0x11004000 0x2000>,
345 + <0x11006000 0x2000>;
346 + };
347 +diff --git a/arch/arm64/boot/dts/marvell/armada-3720-turris-mox.dts b/arch/arm64/boot/dts/marvell/armada-3720-turris-mox.dts
348 +index a05b1ab2dd12c..04da07ae44208 100644
349 +--- a/arch/arm64/boot/dts/marvell/armada-3720-turris-mox.dts
350 ++++ b/arch/arm64/boot/dts/marvell/armada-3720-turris-mox.dts
351 +@@ -135,6 +135,23 @@
352 + pinctrl-0 = <&pcie_reset_pins &pcie_clkreq_pins>;
353 + status = "okay";
354 + reset-gpios = <&gpiosb 3 GPIO_ACTIVE_LOW>;
355 ++ /*
356 ++ * U-Boot port for Turris Mox has a bug which always expects that "ranges" DT property
357 ++ * contains exactly 2 ranges with 3 (child) address cells, 2 (parent) address cells and
358 ++ * 2 size cells and also expects that the second range starts at 16 MB offset. If these
359 ++ * conditions are not met then U-Boot crashes during loading kernel DTB file. PCIe address
360 ++ * space is 128 MB long, so the best split between MEM and IO is to use fixed 16 MB window
361 ++ * for IO and the rest 112 MB (64+32+16) for MEM, despite that maximal IO size is just 64 kB.
362 ++ * This bug is not present in U-Boot ports for other Armada 3700 devices and is fixed in
363 ++ * U-Boot version 2021.07. See relevant U-Boot commits (the last one contains fix):
364 ++ * https://source.denx.de/u-boot/u-boot/-/commit/cb2ddb291ee6fcbddd6d8f4ff49089dfe580f5d7
365 ++ * https://source.denx.de/u-boot/u-boot/-/commit/c64ac3b3185aeb3846297ad7391fc6df8ecd73bf
366 ++ * https://source.denx.de/u-boot/u-boot/-/commit/4a82fca8e330157081fc132a591ebd99ba02ee33
367 ++ */
368 ++ #address-cells = <3>;
369 ++ #size-cells = <2>;
370 ++ ranges = <0x81000000 0 0xe8000000 0 0xe8000000 0 0x01000000 /* Port 0 IO */
371 ++ 0x82000000 0 0xe9000000 0 0xe9000000 0 0x07000000>; /* Port 0 MEM */
372 +
373 + /* enabled by U-Boot if PCIe module is present */
374 + status = "disabled";
375 +diff --git a/arch/arm64/boot/dts/marvell/armada-37xx.dtsi b/arch/arm64/boot/dts/marvell/armada-37xx.dtsi
376 +index 5db81a416cd65..9acc5d2b5a002 100644
377 +--- a/arch/arm64/boot/dts/marvell/armada-37xx.dtsi
378 ++++ b/arch/arm64/boot/dts/marvell/armada-37xx.dtsi
379 +@@ -489,8 +489,15 @@
380 + #interrupt-cells = <1>;
381 + msi-parent = <&pcie0>;
382 + msi-controller;
383 +- ranges = <0x82000000 0 0xe8000000 0 0xe8000000 0 0x1000000 /* Port 0 MEM */
384 +- 0x81000000 0 0xe9000000 0 0xe9000000 0 0x10000>; /* Port 0 IO*/
385 ++ /*
386 ++ * The 128 MiB address range [0xe8000000-0xf0000000] is
387 ++ * dedicated for PCIe and can be assigned to 8 windows
388 ++ * with size a power of two. Use one 64 KiB window for
389 ++ * IO at the end and the remaining seven windows
390 ++ * (totaling 127 MiB) for MEM.
391 ++ */
392 ++ ranges = <0x82000000 0 0xe8000000 0 0xe8000000 0 0x07f00000 /* Port 0 MEM */
393 ++ 0x81000000 0 0xefff0000 0 0xefff0000 0 0x00010000>; /* Port 0 IO */
394 + interrupt-map-mask = <0 0 0 7>;
395 + interrupt-map = <0 0 0 1 &pcie_intc 0>,
396 + <0 0 0 2 &pcie_intc 1>,
397 +diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz.dtsi b/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz.dtsi
398 +index 3eb8550da1fc5..3fa1ad1d0f02c 100644
399 +--- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz.dtsi
400 ++++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz.dtsi
401 +@@ -23,7 +23,7 @@ ap_h1_spi: &spi0 {};
402 + adau7002: audio-codec-1 {
403 + compatible = "adi,adau7002";
404 + IOVDD-supply = <&pp1800_l15a>;
405 +- wakeup-delay-ms = <15>;
406 ++ wakeup-delay-ms = <80>;
407 + #sound-dai-cells = <0>;
408 + };
409 + };
410 +diff --git a/arch/arm64/boot/dts/qcom/sm8250.dtsi b/arch/arm64/boot/dts/qcom/sm8250.dtsi
411 +index 09b5523965579..1316bea3eab52 100644
412 +--- a/arch/arm64/boot/dts/qcom/sm8250.dtsi
413 ++++ b/arch/arm64/boot/dts/qcom/sm8250.dtsi
414 +@@ -2123,7 +2123,7 @@
415 + <&gcc GCC_USB3_PHY_SEC_BCR>;
416 + reset-names = "phy", "common";
417 +
418 +- usb_2_ssphy: lane@88eb200 {
419 ++ usb_2_ssphy: lanes@88eb200 {
420 + reg = <0 0x088eb200 0 0x200>,
421 + <0 0x088eb400 0 0x200>,
422 + <0 0x088eb800 0 0x800>;
423 +diff --git a/arch/arm64/boot/dts/renesas/hihope-rzg2-ex.dtsi b/arch/arm64/boot/dts/renesas/hihope-rzg2-ex.dtsi
424 +index 202c4fc88bd51..dde3a07bc417c 100644
425 +--- a/arch/arm64/boot/dts/renesas/hihope-rzg2-ex.dtsi
426 ++++ b/arch/arm64/boot/dts/renesas/hihope-rzg2-ex.dtsi
427 +@@ -20,6 +20,7 @@
428 + pinctrl-names = "default";
429 + phy-handle = <&phy0>;
430 + tx-internal-delay-ps = <2000>;
431 ++ rx-internal-delay-ps = <1800>;
432 + status = "okay";
433 +
434 + phy0: ethernet-phy@0 {
435 +diff --git a/arch/arm64/boot/dts/renesas/r8a77995-draak.dts b/arch/arm64/boot/dts/renesas/r8a77995-draak.dts
436 +index 6783c3ad08567..57784341f39d7 100644
437 +--- a/arch/arm64/boot/dts/renesas/r8a77995-draak.dts
438 ++++ b/arch/arm64/boot/dts/renesas/r8a77995-draak.dts
439 +@@ -277,10 +277,6 @@
440 + interrupt-parent = <&gpio1>;
441 + interrupts = <28 IRQ_TYPE_LEVEL_LOW>;
442 +
443 +- /* Depends on LVDS */
444 +- max-clock = <135000000>;
445 +- min-vrefresh = <50>;
446 +-
447 + adi,input-depth = <8>;
448 + adi,input-colorspace = "rgb";
449 + adi,input-clock = "1x";
450 +diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c
451 +index facf4d41d32a2..3ed09e7f81f03 100644
452 +--- a/arch/arm64/kvm/arm.c
453 ++++ b/arch/arm64/kvm/arm.c
454 +@@ -15,6 +15,7 @@
455 + #include <linux/fs.h>
456 + #include <linux/mman.h>
457 + #include <linux/sched.h>
458 ++#include <linux/kmemleak.h>
459 + #include <linux/kvm.h>
460 + #include <linux/kvm_irqfd.h>
461 + #include <linux/irqbypass.h>
462 +@@ -1957,6 +1958,12 @@ static int finalize_hyp_mode(void)
463 + if (ret)
464 + return ret;
465 +
466 ++ /*
467 ++ * Exclude HYP BSS from kmemleak so that it doesn't get peeked
468 ++ * at, which would end badly once the section is inaccessible.
469 ++ * None of other sections should ever be introspected.
470 ++ */
471 ++ kmemleak_free_part(__hyp_bss_start, __hyp_bss_end - __hyp_bss_start);
472 + ret = pkvm_mark_hyp_section(__hyp_bss);
473 + if (ret)
474 + return ret;
475 +diff --git a/arch/m68k/Kconfig.cpu b/arch/m68k/Kconfig.cpu
476 +index f4d23977d2a5a..1127d64b6c1dc 100644
477 +--- a/arch/m68k/Kconfig.cpu
478 ++++ b/arch/m68k/Kconfig.cpu
479 +@@ -26,6 +26,7 @@ config COLDFIRE
480 + bool "Coldfire CPU family support"
481 + select ARCH_HAVE_CUSTOM_GPIO_H
482 + select CPU_HAS_NO_BITFIELDS
483 ++ select CPU_HAS_NO_CAS
484 + select CPU_HAS_NO_MULDIV64
485 + select GENERIC_CSUM
486 + select GPIOLIB
487 +@@ -39,6 +40,7 @@ config M68000
488 + bool
489 + depends on !MMU
490 + select CPU_HAS_NO_BITFIELDS
491 ++ select CPU_HAS_NO_CAS
492 + select CPU_HAS_NO_MULDIV64
493 + select CPU_HAS_NO_UNALIGNED
494 + select GENERIC_CSUM
495 +@@ -54,6 +56,7 @@ config M68000
496 + config MCPU32
497 + bool
498 + select CPU_HAS_NO_BITFIELDS
499 ++ select CPU_HAS_NO_CAS
500 + select CPU_HAS_NO_UNALIGNED
501 + select CPU_NO_EFFICIENT_FFS
502 + help
503 +@@ -383,7 +386,7 @@ config ADVANCED
504 +
505 + config RMW_INSNS
506 + bool "Use read-modify-write instructions"
507 +- depends on ADVANCED
508 ++ depends on ADVANCED && !CPU_HAS_NO_CAS
509 + help
510 + This allows to use certain instructions that work with indivisible
511 + read-modify-write bus cycles. While this is faster than the
512 +@@ -459,6 +462,9 @@ config NODES_SHIFT
513 + config CPU_HAS_NO_BITFIELDS
514 + bool
515 +
516 ++config CPU_HAS_NO_CAS
517 ++ bool
518 ++
519 + config CPU_HAS_NO_MULDIV64
520 + bool
521 +
522 +diff --git a/arch/m68k/coldfire/clk.c b/arch/m68k/coldfire/clk.c
523 +index 076a9caa9557b..c895a189c5ae3 100644
524 +--- a/arch/m68k/coldfire/clk.c
525 ++++ b/arch/m68k/coldfire/clk.c
526 +@@ -92,7 +92,7 @@ int clk_enable(struct clk *clk)
527 + unsigned long flags;
528 +
529 + if (!clk)
530 +- return -EINVAL;
531 ++ return 0;
532 +
533 + spin_lock_irqsave(&clk_lock, flags);
534 + if ((clk->enabled++ == 0) && clk->clk_ops)
535 +diff --git a/arch/m68k/emu/nfeth.c b/arch/m68k/emu/nfeth.c
536 +index d2875e32abfca..79e55421cfb18 100644
537 +--- a/arch/m68k/emu/nfeth.c
538 ++++ b/arch/m68k/emu/nfeth.c
539 +@@ -254,8 +254,8 @@ static void __exit nfeth_cleanup(void)
540 +
541 + for (i = 0; i < MAX_UNIT; i++) {
542 + if (nfeth_dev[i]) {
543 +- unregister_netdev(nfeth_dev[0]);
544 +- free_netdev(nfeth_dev[0]);
545 ++ unregister_netdev(nfeth_dev[i]);
546 ++ free_netdev(nfeth_dev[i]);
547 + }
548 + }
549 + free_irq(nfEtherIRQ, nfeth_interrupt);
550 +diff --git a/arch/s390/include/asm/kvm_host.h b/arch/s390/include/asm/kvm_host.h
551 +index 8925f3969478f..5445ae106077f 100644
552 +--- a/arch/s390/include/asm/kvm_host.h
553 ++++ b/arch/s390/include/asm/kvm_host.h
554 +@@ -962,6 +962,7 @@ struct kvm_arch{
555 + atomic64_t cmma_dirty_pages;
556 + /* subset of available cpu features enabled by user space */
557 + DECLARE_BITMAP(cpu_feat, KVM_S390_VM_CPU_FEAT_NR_BITS);
558 ++ /* indexed by vcpu_idx */
559 + DECLARE_BITMAP(idle_mask, KVM_MAX_VCPUS);
560 + struct kvm_s390_gisa_interrupt gisa_int;
561 + struct kvm_s390_pv pv;
562 +diff --git a/arch/s390/kernel/debug.c b/arch/s390/kernel/debug.c
563 +index bb958d32bd813..a142671c449b1 100644
564 +--- a/arch/s390/kernel/debug.c
565 ++++ b/arch/s390/kernel/debug.c
566 +@@ -24,6 +24,7 @@
567 + #include <linux/export.h>
568 + #include <linux/init.h>
569 + #include <linux/fs.h>
570 ++#include <linux/minmax.h>
571 + #include <linux/debugfs.h>
572 +
573 + #include <asm/debug.h>
574 +@@ -92,6 +93,8 @@ static int debug_hex_ascii_format_fn(debug_info_t *id, struct debug_view *view,
575 + char *out_buf, const char *in_buf);
576 + static int debug_sprintf_format_fn(debug_info_t *id, struct debug_view *view,
577 + char *out_buf, debug_sprintf_entry_t *curr_event);
578 ++static void debug_areas_swap(debug_info_t *a, debug_info_t *b);
579 ++static void debug_events_append(debug_info_t *dest, debug_info_t *src);
580 +
581 + /* globals */
582 +
583 +@@ -311,24 +314,6 @@ static debug_info_t *debug_info_create(const char *name, int pages_per_area,
584 + goto out;
585 +
586 + rc->mode = mode & ~S_IFMT;
587 +-
588 +- /* create root directory */
589 +- rc->debugfs_root_entry = debugfs_create_dir(rc->name,
590 +- debug_debugfs_root_entry);
591 +-
592 +- /* append new element to linked list */
593 +- if (!debug_area_first) {
594 +- /* first element in list */
595 +- debug_area_first = rc;
596 +- rc->prev = NULL;
597 +- } else {
598 +- /* append element to end of list */
599 +- debug_area_last->next = rc;
600 +- rc->prev = debug_area_last;
601 +- }
602 +- debug_area_last = rc;
603 +- rc->next = NULL;
604 +-
605 + refcount_set(&rc->ref_count, 1);
606 + out:
607 + return rc;
608 +@@ -388,27 +373,10 @@ static void debug_info_get(debug_info_t *db_info)
609 + */
610 + static void debug_info_put(debug_info_t *db_info)
611 + {
612 +- int i;
613 +-
614 + if (!db_info)
615 + return;
616 +- if (refcount_dec_and_test(&db_info->ref_count)) {
617 +- for (i = 0; i < DEBUG_MAX_VIEWS; i++) {
618 +- if (!db_info->views[i])
619 +- continue;
620 +- debugfs_remove(db_info->debugfs_entries[i]);
621 +- }
622 +- debugfs_remove(db_info->debugfs_root_entry);
623 +- if (db_info == debug_area_first)
624 +- debug_area_first = db_info->next;
625 +- if (db_info == debug_area_last)
626 +- debug_area_last = db_info->prev;
627 +- if (db_info->prev)
628 +- db_info->prev->next = db_info->next;
629 +- if (db_info->next)
630 +- db_info->next->prev = db_info->prev;
631 ++ if (refcount_dec_and_test(&db_info->ref_count))
632 + debug_info_free(db_info);
633 +- }
634 + }
635 +
636 + /*
637 +@@ -632,6 +600,31 @@ static int debug_close(struct inode *inode, struct file *file)
638 + return 0; /* success */
639 + }
640 +
641 ++/* Create debugfs entries and add to internal list. */
642 ++static void _debug_register(debug_info_t *id)
643 ++{
644 ++ /* create root directory */
645 ++ id->debugfs_root_entry = debugfs_create_dir(id->name,
646 ++ debug_debugfs_root_entry);
647 ++
648 ++ /* append new element to linked list */
649 ++ if (!debug_area_first) {
650 ++ /* first element in list */
651 ++ debug_area_first = id;
652 ++ id->prev = NULL;
653 ++ } else {
654 ++ /* append element to end of list */
655 ++ debug_area_last->next = id;
656 ++ id->prev = debug_area_last;
657 ++ }
658 ++ debug_area_last = id;
659 ++ id->next = NULL;
660 ++
661 ++ debug_register_view(id, &debug_level_view);
662 ++ debug_register_view(id, &debug_flush_view);
663 ++ debug_register_view(id, &debug_pages_view);
664 ++}
665 ++
666 + /**
667 + * debug_register_mode() - creates and initializes debug area.
668 + *
669 +@@ -661,19 +654,16 @@ debug_info_t *debug_register_mode(const char *name, int pages_per_area,
670 + if ((uid != 0) || (gid != 0))
671 + pr_warn("Root becomes the owner of all s390dbf files in sysfs\n");
672 + BUG_ON(!initialized);
673 +- mutex_lock(&debug_mutex);
674 +
675 + /* create new debug_info */
676 + rc = debug_info_create(name, pages_per_area, nr_areas, buf_size, mode);
677 +- if (!rc)
678 +- goto out;
679 +- debug_register_view(rc, &debug_level_view);
680 +- debug_register_view(rc, &debug_flush_view);
681 +- debug_register_view(rc, &debug_pages_view);
682 +-out:
683 +- if (!rc)
684 ++ if (rc) {
685 ++ mutex_lock(&debug_mutex);
686 ++ _debug_register(rc);
687 ++ mutex_unlock(&debug_mutex);
688 ++ } else {
689 + pr_err("Registering debug feature %s failed\n", name);
690 +- mutex_unlock(&debug_mutex);
691 ++ }
692 + return rc;
693 + }
694 + EXPORT_SYMBOL(debug_register_mode);
695 +@@ -702,6 +692,27 @@ debug_info_t *debug_register(const char *name, int pages_per_area,
696 + }
697 + EXPORT_SYMBOL(debug_register);
698 +
699 ++/* Remove debugfs entries and remove from internal list. */
700 ++static void _debug_unregister(debug_info_t *id)
701 ++{
702 ++ int i;
703 ++
704 ++ for (i = 0; i < DEBUG_MAX_VIEWS; i++) {
705 ++ if (!id->views[i])
706 ++ continue;
707 ++ debugfs_remove(id->debugfs_entries[i]);
708 ++ }
709 ++ debugfs_remove(id->debugfs_root_entry);
710 ++ if (id == debug_area_first)
711 ++ debug_area_first = id->next;
712 ++ if (id == debug_area_last)
713 ++ debug_area_last = id->prev;
714 ++ if (id->prev)
715 ++ id->prev->next = id->next;
716 ++ if (id->next)
717 ++ id->next->prev = id->prev;
718 ++}
719 ++
720 + /**
721 + * debug_unregister() - give back debug area.
722 + *
723 +@@ -715,8 +726,10 @@ void debug_unregister(debug_info_t *id)
724 + if (!id)
725 + return;
726 + mutex_lock(&debug_mutex);
727 +- debug_info_put(id);
728 ++ _debug_unregister(id);
729 + mutex_unlock(&debug_mutex);
730 ++
731 ++ debug_info_put(id);
732 + }
733 + EXPORT_SYMBOL(debug_unregister);
734 +
735 +@@ -726,35 +739,28 @@ EXPORT_SYMBOL(debug_unregister);
736 + */
737 + static int debug_set_size(debug_info_t *id, int nr_areas, int pages_per_area)
738 + {
739 +- debug_entry_t ***new_areas;
740 ++ debug_info_t *new_id;
741 + unsigned long flags;
742 +- int rc = 0;
743 +
744 + if (!id || (nr_areas <= 0) || (pages_per_area < 0))
745 + return -EINVAL;
746 +- if (pages_per_area > 0) {
747 +- new_areas = debug_areas_alloc(pages_per_area, nr_areas);
748 +- if (!new_areas) {
749 +- pr_info("Allocating memory for %i pages failed\n",
750 +- pages_per_area);
751 +- rc = -ENOMEM;
752 +- goto out;
753 +- }
754 +- } else {
755 +- new_areas = NULL;
756 ++
757 ++ new_id = debug_info_alloc("", pages_per_area, nr_areas, id->buf_size,
758 ++ id->level, ALL_AREAS);
759 ++ if (!new_id) {
760 ++ pr_info("Allocating memory for %i pages failed\n",
761 ++ pages_per_area);
762 ++ return -ENOMEM;
763 + }
764 ++
765 + spin_lock_irqsave(&id->lock, flags);
766 +- debug_areas_free(id);
767 +- id->areas = new_areas;
768 +- id->nr_areas = nr_areas;
769 +- id->pages_per_area = pages_per_area;
770 +- id->active_area = 0;
771 +- memset(id->active_entries, 0, sizeof(int)*id->nr_areas);
772 +- memset(id->active_pages, 0, sizeof(int)*id->nr_areas);
773 ++ debug_events_append(new_id, id);
774 ++ debug_areas_swap(new_id, id);
775 ++ debug_info_free(new_id);
776 + spin_unlock_irqrestore(&id->lock, flags);
777 + pr_info("%s: set new size (%i pages)\n", id->name, pages_per_area);
778 +-out:
779 +- return rc;
780 ++
781 ++ return 0;
782 + }
783 +
784 + /**
785 +@@ -821,6 +827,42 @@ static inline debug_entry_t *get_active_entry(debug_info_t *id)
786 + id->active_entries[id->active_area]);
787 + }
788 +
789 ++/* Swap debug areas of a and b. */
790 ++static void debug_areas_swap(debug_info_t *a, debug_info_t *b)
791 ++{
792 ++ swap(a->nr_areas, b->nr_areas);
793 ++ swap(a->pages_per_area, b->pages_per_area);
794 ++ swap(a->areas, b->areas);
795 ++ swap(a->active_area, b->active_area);
796 ++ swap(a->active_pages, b->active_pages);
797 ++ swap(a->active_entries, b->active_entries);
798 ++}
799 ++
800 ++/* Append all debug events in active area from source to destination log. */
801 ++static void debug_events_append(debug_info_t *dest, debug_info_t *src)
802 ++{
803 ++ debug_entry_t *from, *to, *last;
804 ++
805 ++ if (!src->areas || !dest->areas)
806 ++ return;
807 ++
808 ++ /* Loop over all entries in src, starting with oldest. */
809 ++ from = get_active_entry(src);
810 ++ last = from;
811 ++ do {
812 ++ if (from->clock != 0LL) {
813 ++ to = get_active_entry(dest);
814 ++ memset(to, 0, dest->entry_size);
815 ++ memcpy(to, from, min(src->entry_size,
816 ++ dest->entry_size));
817 ++ proceed_active_entry(dest);
818 ++ }
819 ++
820 ++ proceed_active_entry(src);
821 ++ from = get_active_entry(src);
822 ++ } while (from != last);
823 ++}
824 ++
825 + /*
826 + * debug_finish_entry:
827 + * - set timestamp, caller address, cpu number etc.
828 +diff --git a/arch/s390/kvm/interrupt.c b/arch/s390/kvm/interrupt.c
829 +index d548d60caed25..16256e17a544a 100644
830 +--- a/arch/s390/kvm/interrupt.c
831 ++++ b/arch/s390/kvm/interrupt.c
832 +@@ -419,13 +419,13 @@ static unsigned long deliverable_irqs(struct kvm_vcpu *vcpu)
833 + static void __set_cpu_idle(struct kvm_vcpu *vcpu)
834 + {
835 + kvm_s390_set_cpuflags(vcpu, CPUSTAT_WAIT);
836 +- set_bit(vcpu->vcpu_id, vcpu->kvm->arch.idle_mask);
837 ++ set_bit(kvm_vcpu_get_idx(vcpu), vcpu->kvm->arch.idle_mask);
838 + }
839 +
840 + static void __unset_cpu_idle(struct kvm_vcpu *vcpu)
841 + {
842 + kvm_s390_clear_cpuflags(vcpu, CPUSTAT_WAIT);
843 +- clear_bit(vcpu->vcpu_id, vcpu->kvm->arch.idle_mask);
844 ++ clear_bit(kvm_vcpu_get_idx(vcpu), vcpu->kvm->arch.idle_mask);
845 + }
846 +
847 + static void __reset_intercept_indicators(struct kvm_vcpu *vcpu)
848 +@@ -3050,18 +3050,18 @@ int kvm_s390_get_irq_state(struct kvm_vcpu *vcpu, __u8 __user *buf, int len)
849 +
850 + static void __airqs_kick_single_vcpu(struct kvm *kvm, u8 deliverable_mask)
851 + {
852 +- int vcpu_id, online_vcpus = atomic_read(&kvm->online_vcpus);
853 ++ int vcpu_idx, online_vcpus = atomic_read(&kvm->online_vcpus);
854 + struct kvm_s390_gisa_interrupt *gi = &kvm->arch.gisa_int;
855 + struct kvm_vcpu *vcpu;
856 +
857 +- for_each_set_bit(vcpu_id, kvm->arch.idle_mask, online_vcpus) {
858 +- vcpu = kvm_get_vcpu(kvm, vcpu_id);
859 ++ for_each_set_bit(vcpu_idx, kvm->arch.idle_mask, online_vcpus) {
860 ++ vcpu = kvm_get_vcpu(kvm, vcpu_idx);
861 + if (psw_ioint_disabled(vcpu))
862 + continue;
863 + deliverable_mask &= (u8)(vcpu->arch.sie_block->gcr[6] >> 24);
864 + if (deliverable_mask) {
865 + /* lately kicked but not yet running */
866 +- if (test_and_set_bit(vcpu_id, gi->kicked_mask))
867 ++ if (test_and_set_bit(vcpu_idx, gi->kicked_mask))
868 + return;
869 + kvm_s390_vcpu_wakeup(vcpu);
870 + return;
871 +diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
872 +index 876fc1f7282a0..32173fffad3f1 100644
873 +--- a/arch/s390/kvm/kvm-s390.c
874 ++++ b/arch/s390/kvm/kvm-s390.c
875 +@@ -4020,7 +4020,7 @@ static int vcpu_pre_run(struct kvm_vcpu *vcpu)
876 + kvm_s390_patch_guest_per_regs(vcpu);
877 + }
878 +
879 +- clear_bit(vcpu->vcpu_id, vcpu->kvm->arch.gisa_int.kicked_mask);
880 ++ clear_bit(kvm_vcpu_get_idx(vcpu), vcpu->kvm->arch.gisa_int.kicked_mask);
881 +
882 + vcpu->arch.sie_block->icptcode = 0;
883 + cpuflags = atomic_read(&vcpu->arch.sie_block->cpuflags);
884 +diff --git a/arch/s390/kvm/kvm-s390.h b/arch/s390/kvm/kvm-s390.h
885 +index 9fad25109b0dd..ecd741ee3276e 100644
886 +--- a/arch/s390/kvm/kvm-s390.h
887 ++++ b/arch/s390/kvm/kvm-s390.h
888 +@@ -79,7 +79,7 @@ static inline int is_vcpu_stopped(struct kvm_vcpu *vcpu)
889 +
890 + static inline int is_vcpu_idle(struct kvm_vcpu *vcpu)
891 + {
892 +- return test_bit(vcpu->vcpu_id, vcpu->kvm->arch.idle_mask);
893 ++ return test_bit(kvm_vcpu_get_idx(vcpu), vcpu->kvm->arch.idle_mask);
894 + }
895 +
896 + static inline int kvm_is_ucontrol(struct kvm *kvm)
897 +diff --git a/arch/s390/mm/kasan_init.c b/arch/s390/mm/kasan_init.c
898 +index db4d303aaaa9a..d7fcfe97d168d 100644
899 +--- a/arch/s390/mm/kasan_init.c
900 ++++ b/arch/s390/mm/kasan_init.c
901 +@@ -108,6 +108,9 @@ static void __init kasan_early_pgtable_populate(unsigned long address,
902 + sgt_prot &= ~_SEGMENT_ENTRY_NOEXEC;
903 + }
904 +
905 ++ /*
906 ++ * The first 1MB of 1:1 mapping is mapped with 4KB pages
907 ++ */
908 + while (address < end) {
909 + pg_dir = pgd_offset_k(address);
910 + if (pgd_none(*pg_dir)) {
911 +@@ -158,30 +161,26 @@ static void __init kasan_early_pgtable_populate(unsigned long address,
912 +
913 + pm_dir = pmd_offset(pu_dir, address);
914 + if (pmd_none(*pm_dir)) {
915 +- if (mode == POPULATE_ZERO_SHADOW &&
916 +- IS_ALIGNED(address, PMD_SIZE) &&
917 ++ if (IS_ALIGNED(address, PMD_SIZE) &&
918 + end - address >= PMD_SIZE) {
919 +- pmd_populate(&init_mm, pm_dir,
920 +- kasan_early_shadow_pte);
921 +- address = (address + PMD_SIZE) & PMD_MASK;
922 +- continue;
923 +- }
924 +- /* the first megabyte of 1:1 is mapped with 4k pages */
925 +- if (has_edat && address && end - address >= PMD_SIZE &&
926 +- mode != POPULATE_ZERO_SHADOW) {
927 +- void *page;
928 +-
929 +- if (mode == POPULATE_ONE2ONE) {
930 +- page = (void *)address;
931 +- } else {
932 +- page = kasan_early_alloc_segment();
933 +- memset(page, 0, _SEGMENT_SIZE);
934 ++ if (mode == POPULATE_ZERO_SHADOW) {
935 ++ pmd_populate(&init_mm, pm_dir, kasan_early_shadow_pte);
936 ++ address = (address + PMD_SIZE) & PMD_MASK;
937 ++ continue;
938 ++ } else if (has_edat && address) {
939 ++ void *page;
940 ++
941 ++ if (mode == POPULATE_ONE2ONE) {
942 ++ page = (void *)address;
943 ++ } else {
944 ++ page = kasan_early_alloc_segment();
945 ++ memset(page, 0, _SEGMENT_SIZE);
946 ++ }
947 ++ pmd_val(*pm_dir) = __pa(page) | sgt_prot;
948 ++ address = (address + PMD_SIZE) & PMD_MASK;
949 ++ continue;
950 + }
951 +- pmd_val(*pm_dir) = __pa(page) | sgt_prot;
952 +- address = (address + PMD_SIZE) & PMD_MASK;
953 +- continue;
954 + }
955 +-
956 + pt_dir = kasan_early_pte_alloc();
957 + pmd_populate(&init_mm, pm_dir, pt_dir);
958 + } else if (pmd_large(*pm_dir)) {
959 +diff --git a/arch/s390/pci/pci.c b/arch/s390/pci/pci.c
960 +index 8fcb7ecb7225a..77cd965cffefa 100644
961 +--- a/arch/s390/pci/pci.c
962 ++++ b/arch/s390/pci/pci.c
963 +@@ -661,9 +661,10 @@ int zpci_enable_device(struct zpci_dev *zdev)
964 + {
965 + int rc;
966 +
967 +- rc = clp_enable_fh(zdev, ZPCI_NR_DMA_SPACES);
968 +- if (rc)
969 ++ if (clp_enable_fh(zdev, ZPCI_NR_DMA_SPACES)) {
970 ++ rc = -EIO;
971 + goto out;
972 ++ }
973 +
974 + rc = zpci_dma_init_device(zdev);
975 + if (rc)
976 +@@ -684,7 +685,7 @@ int zpci_disable_device(struct zpci_dev *zdev)
977 + * The zPCI function may already be disabled by the platform, this is
978 + * detected in clp_disable_fh() which becomes a no-op.
979 + */
980 +- return clp_disable_fh(zdev);
981 ++ return clp_disable_fh(zdev) ? -EIO : 0;
982 + }
983 +
984 + /**
985 +diff --git a/arch/s390/pci/pci_clp.c b/arch/s390/pci/pci_clp.c
986 +index d3331596ddbe1..0a0e8b8293bef 100644
987 +--- a/arch/s390/pci/pci_clp.c
988 ++++ b/arch/s390/pci/pci_clp.c
989 +@@ -213,15 +213,19 @@ out:
990 + }
991 +
992 + static int clp_refresh_fh(u32 fid);
993 +-/*
994 +- * Enable/Disable a given PCI function and update its function handle if
995 +- * necessary
996 ++/**
997 ++ * clp_set_pci_fn() - Execute a command on a PCI function
998 ++ * @zdev: Function that will be affected
999 ++ * @nr_dma_as: DMA address space number
1000 ++ * @command: The command code to execute
1001 ++ *
1002 ++ * Returns: 0 on success, < 0 for Linux errors (e.g. -ENOMEM), and
1003 ++ * > 0 for non-success platform responses
1004 + */
1005 + static int clp_set_pci_fn(struct zpci_dev *zdev, u8 nr_dma_as, u8 command)
1006 + {
1007 + struct clp_req_rsp_set_pci *rrb;
1008 + int rc, retries = 100;
1009 +- u32 fid = zdev->fid;
1010 +
1011 + rrb = clp_alloc_block(GFP_KERNEL);
1012 + if (!rrb)
1013 +@@ -245,17 +249,16 @@ static int clp_set_pci_fn(struct zpci_dev *zdev, u8 nr_dma_as, u8 command)
1014 + }
1015 + } while (rrb->response.hdr.rsp == CLP_RC_SETPCIFN_BUSY);
1016 +
1017 +- if (rc || rrb->response.hdr.rsp != CLP_RC_OK) {
1018 +- zpci_err("Set PCI FN:\n");
1019 +- zpci_err_clp(rrb->response.hdr.rsp, rc);
1020 +- }
1021 +-
1022 + if (!rc && rrb->response.hdr.rsp == CLP_RC_OK) {
1023 + zdev->fh = rrb->response.fh;
1024 +- } else if (!rc && rrb->response.hdr.rsp == CLP_RC_SETPCIFN_ALRDY &&
1025 +- rrb->response.fh == 0) {
1026 ++ } else if (!rc && rrb->response.hdr.rsp == CLP_RC_SETPCIFN_ALRDY) {
1027 + /* Function is already in desired state - update handle */
1028 +- rc = clp_refresh_fh(fid);
1029 ++ rc = clp_refresh_fh(zdev->fid);
1030 ++ } else {
1031 ++ zpci_err("Set PCI FN:\n");
1032 ++ zpci_err_clp(rrb->response.hdr.rsp, rc);
1033 ++ if (!rc)
1034 ++ rc = rrb->response.hdr.rsp;
1035 + }
1036 + clp_free_block(rrb);
1037 + return rc;
1038 +@@ -301,17 +304,13 @@ int clp_enable_fh(struct zpci_dev *zdev, u8 nr_dma_as)
1039 +
1040 + rc = clp_set_pci_fn(zdev, nr_dma_as, CLP_SET_ENABLE_PCI_FN);
1041 + zpci_dbg(3, "ena fid:%x, fh:%x, rc:%d\n", zdev->fid, zdev->fh, rc);
1042 +- if (rc)
1043 +- goto out;
1044 +-
1045 +- if (zpci_use_mio(zdev)) {
1046 ++ if (!rc && zpci_use_mio(zdev)) {
1047 + rc = clp_set_pci_fn(zdev, nr_dma_as, CLP_SET_ENABLE_MIO);
1048 + zpci_dbg(3, "ena mio fid:%x, fh:%x, rc:%d\n",
1049 + zdev->fid, zdev->fh, rc);
1050 + if (rc)
1051 + clp_disable_fh(zdev);
1052 + }
1053 +-out:
1054 + return rc;
1055 + }
1056 +
1057 +diff --git a/arch/x86/boot/compressed/efi_thunk_64.S b/arch/x86/boot/compressed/efi_thunk_64.S
1058 +index 95a223b3e56a2..8bb92e9f4e973 100644
1059 +--- a/arch/x86/boot/compressed/efi_thunk_64.S
1060 ++++ b/arch/x86/boot/compressed/efi_thunk_64.S
1061 +@@ -5,9 +5,8 @@
1062 + * Early support for invoking 32-bit EFI services from a 64-bit kernel.
1063 + *
1064 + * Because this thunking occurs before ExitBootServices() we have to
1065 +- * restore the firmware's 32-bit GDT before we make EFI service calls,
1066 +- * since the firmware's 32-bit IDT is still currently installed and it
1067 +- * needs to be able to service interrupts.
1068 ++ * restore the firmware's 32-bit GDT and IDT before we make EFI service
1069 ++ * calls.
1070 + *
1071 + * On the plus side, we don't have to worry about mangling 64-bit
1072 + * addresses into 32-bits because we're executing with an identity
1073 +@@ -39,7 +38,7 @@ SYM_FUNC_START(__efi64_thunk)
1074 + /*
1075 + * Convert x86-64 ABI params to i386 ABI
1076 + */
1077 +- subq $32, %rsp
1078 ++ subq $64, %rsp
1079 + movl %esi, 0x0(%rsp)
1080 + movl %edx, 0x4(%rsp)
1081 + movl %ecx, 0x8(%rsp)
1082 +@@ -49,14 +48,19 @@ SYM_FUNC_START(__efi64_thunk)
1083 + leaq 0x14(%rsp), %rbx
1084 + sgdt (%rbx)
1085 +
1086 ++ addq $16, %rbx
1087 ++ sidt (%rbx)
1088 ++
1089 + /*
1090 +- * Switch to gdt with 32-bit segments. This is the firmware GDT
1091 +- * that was installed when the kernel started executing. This
1092 +- * pointer was saved at the EFI stub entry point in head_64.S.
1093 ++ * Switch to IDT and GDT with 32-bit segments. This is the firmware GDT
1094 ++ * and IDT that was installed when the kernel started executing. The
1095 ++ * pointers were saved at the EFI stub entry point in head_64.S.
1096 + *
1097 + * Pass the saved DS selector to the 32-bit code, and use far return to
1098 + * restore the saved CS selector.
1099 + */
1100 ++ leaq efi32_boot_idt(%rip), %rax
1101 ++ lidt (%rax)
1102 + leaq efi32_boot_gdt(%rip), %rax
1103 + lgdt (%rax)
1104 +
1105 +@@ -67,7 +71,7 @@ SYM_FUNC_START(__efi64_thunk)
1106 + pushq %rax
1107 + lretq
1108 +
1109 +-1: addq $32, %rsp
1110 ++1: addq $64, %rsp
1111 + movq %rdi, %rax
1112 +
1113 + pop %rbx
1114 +@@ -128,10 +132,13 @@ SYM_FUNC_START_LOCAL(efi_enter32)
1115 +
1116 + /*
1117 + * Some firmware will return with interrupts enabled. Be sure to
1118 +- * disable them before we switch GDTs.
1119 ++ * disable them before we switch GDTs and IDTs.
1120 + */
1121 + cli
1122 +
1123 ++ lidtl (%ebx)
1124 ++ subl $16, %ebx
1125 ++
1126 + lgdtl (%ebx)
1127 +
1128 + movl %cr4, %eax
1129 +@@ -166,6 +173,11 @@ SYM_DATA_START(efi32_boot_gdt)
1130 + .quad 0
1131 + SYM_DATA_END(efi32_boot_gdt)
1132 +
1133 ++SYM_DATA_START(efi32_boot_idt)
1134 ++ .word 0
1135 ++ .quad 0
1136 ++SYM_DATA_END(efi32_boot_idt)
1137 ++
1138 + SYM_DATA_START(efi32_boot_cs)
1139 + .word 0
1140 + SYM_DATA_END(efi32_boot_cs)
1141 +diff --git a/arch/x86/boot/compressed/head_64.S b/arch/x86/boot/compressed/head_64.S
1142 +index a2347ded77ea2..572c535cf45bc 100644
1143 +--- a/arch/x86/boot/compressed/head_64.S
1144 ++++ b/arch/x86/boot/compressed/head_64.S
1145 +@@ -319,6 +319,9 @@ SYM_INNER_LABEL(efi32_pe_stub_entry, SYM_L_LOCAL)
1146 + movw %cs, rva(efi32_boot_cs)(%ebp)
1147 + movw %ds, rva(efi32_boot_ds)(%ebp)
1148 +
1149 ++ /* Store firmware IDT descriptor */
1150 ++ sidtl rva(efi32_boot_idt)(%ebp)
1151 ++
1152 + /* Disable paging */
1153 + movl %cr0, %eax
1154 + btrl $X86_CR0_PG_BIT, %eax
1155 +diff --git a/arch/x86/crypto/aesni-intel_glue.c b/arch/x86/crypto/aesni-intel_glue.c
1156 +index 2144e54a6c892..388643ca2177e 100644
1157 +--- a/arch/x86/crypto/aesni-intel_glue.c
1158 ++++ b/arch/x86/crypto/aesni-intel_glue.c
1159 +@@ -849,6 +849,8 @@ static int xts_crypt(struct skcipher_request *req, bool encrypt)
1160 + return -EINVAL;
1161 +
1162 + err = skcipher_walk_virt(&walk, req, false);
1163 ++ if (err)
1164 ++ return err;
1165 +
1166 + if (unlikely(tail > 0 && walk.nbytes < walk.total)) {
1167 + int blocks = DIV_ROUND_UP(req->cryptlen, AES_BLOCK_SIZE) - 2;
1168 +@@ -862,7 +864,10 @@ static int xts_crypt(struct skcipher_request *req, bool encrypt)
1169 + skcipher_request_set_crypt(&subreq, req->src, req->dst,
1170 + blocks * AES_BLOCK_SIZE, req->iv);
1171 + req = &subreq;
1172 ++
1173 + err = skcipher_walk_virt(&walk, req, false);
1174 ++ if (err)
1175 ++ return err;
1176 + } else {
1177 + tail = 0;
1178 + }
1179 +diff --git a/arch/x86/events/amd/ibs.c b/arch/x86/events/amd/ibs.c
1180 +index 921f47b9bb247..ccc9ee1971e89 100644
1181 +--- a/arch/x86/events/amd/ibs.c
1182 ++++ b/arch/x86/events/amd/ibs.c
1183 +@@ -571,6 +571,7 @@ static struct perf_ibs perf_ibs_op = {
1184 + .start = perf_ibs_start,
1185 + .stop = perf_ibs_stop,
1186 + .read = perf_ibs_read,
1187 ++ .capabilities = PERF_PMU_CAP_NO_EXCLUDE,
1188 + },
1189 + .msr = MSR_AMD64_IBSOPCTL,
1190 + .config_mask = IBS_OP_CONFIG_MASK,
1191 +diff --git a/arch/x86/include/asm/mce.h b/arch/x86/include/asm/mce.h
1192 +index ddfb3cad8dff2..2a8319fad0b75 100644
1193 +--- a/arch/x86/include/asm/mce.h
1194 ++++ b/arch/x86/include/asm/mce.h
1195 +@@ -265,6 +265,7 @@ enum mcp_flags {
1196 + MCP_TIMESTAMP = BIT(0), /* log time stamp */
1197 + MCP_UC = BIT(1), /* log uncorrected errors */
1198 + MCP_DONTLOG = BIT(2), /* only clear, don't log */
1199 ++ MCP_QUEUE_LOG = BIT(3), /* only queue to genpool */
1200 + };
1201 + bool machine_check_poll(enum mcp_flags flags, mce_banks_t *b);
1202 +
1203 +diff --git a/arch/x86/kernel/cpu/mce/core.c b/arch/x86/kernel/cpu/mce/core.c
1204 +index bf7fe87a7e884..01ff4014b7f67 100644
1205 +--- a/arch/x86/kernel/cpu/mce/core.c
1206 ++++ b/arch/x86/kernel/cpu/mce/core.c
1207 +@@ -817,7 +817,10 @@ log_it:
1208 + if (mca_cfg.dont_log_ce && !mce_usable_address(&m))
1209 + goto clear_it;
1210 +
1211 +- mce_log(&m);
1212 ++ if (flags & MCP_QUEUE_LOG)
1213 ++ mce_gen_pool_add(&m);
1214 ++ else
1215 ++ mce_log(&m);
1216 +
1217 + clear_it:
1218 + /*
1219 +@@ -1630,10 +1633,12 @@ static void __mcheck_cpu_init_generic(void)
1220 + m_fl = MCP_DONTLOG;
1221 +
1222 + /*
1223 +- * Log the machine checks left over from the previous reset.
1224 ++ * Log the machine checks left over from the previous reset. Log them
1225 ++ * only, do not start processing them. That will happen in mcheck_late_init()
1226 ++ * when all consumers have been registered on the notifier chain.
1227 + */
1228 + bitmap_fill(all_banks, MAX_NR_BANKS);
1229 +- machine_check_poll(MCP_UC | m_fl, &all_banks);
1230 ++ machine_check_poll(MCP_UC | MCP_QUEUE_LOG | m_fl, &all_banks);
1231 +
1232 + cr4_set_bits(X86_CR4_MCE);
1233 +
1234 +diff --git a/arch/x86/kernel/cpu/resctrl/monitor.c b/arch/x86/kernel/cpu/resctrl/monitor.c
1235 +index 57e4bb695ff96..8caf871b796f2 100644
1236 +--- a/arch/x86/kernel/cpu/resctrl/monitor.c
1237 ++++ b/arch/x86/kernel/cpu/resctrl/monitor.c
1238 +@@ -304,6 +304,12 @@ static u64 __mon_event_count(u32 rmid, struct rmid_read *rr)
1239 + case QOS_L3_MBM_LOCAL_EVENT_ID:
1240 + m = &rr->d->mbm_local[rmid];
1241 + break;
1242 ++ default:
1243 ++ /*
1244 ++ * Code would never reach here because an invalid
1245 ++ * event id would fail the __rmid_read.
1246 ++ */
1247 ++ return RMID_VAL_ERROR;
1248 + }
1249 +
1250 + if (rr->first) {
1251 +diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c
1252 +index 9d3783800c8ce..9d76c33683649 100644
1253 +--- a/arch/x86/kvm/mmu/mmu.c
1254 ++++ b/arch/x86/kvm/mmu/mmu.c
1255 +@@ -257,12 +257,6 @@ static bool check_mmio_spte(struct kvm_vcpu *vcpu, u64 spte)
1256 + static gpa_t translate_gpa(struct kvm_vcpu *vcpu, gpa_t gpa, u32 access,
1257 + struct x86_exception *exception)
1258 + {
1259 +- /* Check if guest physical address doesn't exceed guest maximum */
1260 +- if (kvm_vcpu_is_illegal_gpa(vcpu, gpa)) {
1261 +- exception->error_code |= PFERR_RSVD_MASK;
1262 +- return UNMAPPED_GVA;
1263 +- }
1264 +-
1265 + return gpa;
1266 + }
1267 +
1268 +@@ -2760,6 +2754,7 @@ int kvm_mmu_max_mapping_level(struct kvm *kvm,
1269 + kvm_pfn_t pfn, int max_level)
1270 + {
1271 + struct kvm_lpage_info *linfo;
1272 ++ int host_level;
1273 +
1274 + max_level = min(max_level, max_huge_page_level);
1275 + for ( ; max_level > PG_LEVEL_4K; max_level--) {
1276 +@@ -2771,7 +2766,8 @@ int kvm_mmu_max_mapping_level(struct kvm *kvm,
1277 + if (max_level == PG_LEVEL_4K)
1278 + return PG_LEVEL_4K;
1279 +
1280 +- return host_pfn_mapping_level(kvm, gfn, pfn, slot);
1281 ++ host_level = host_pfn_mapping_level(kvm, gfn, pfn, slot);
1282 ++ return min(host_level, max_level);
1283 + }
1284 +
1285 + int kvm_mmu_hugepage_adjust(struct kvm_vcpu *vcpu, gfn_t gfn,
1286 +@@ -2795,17 +2791,12 @@ int kvm_mmu_hugepage_adjust(struct kvm_vcpu *vcpu, gfn_t gfn,
1287 + if (!slot)
1288 + return PG_LEVEL_4K;
1289 +
1290 +- level = kvm_mmu_max_mapping_level(vcpu->kvm, slot, gfn, pfn, max_level);
1291 +- if (level == PG_LEVEL_4K)
1292 +- return level;
1293 +-
1294 +- *req_level = level = min(level, max_level);
1295 +-
1296 + /*
1297 + * Enforce the iTLB multihit workaround after capturing the requested
1298 + * level, which will be used to do precise, accurate accounting.
1299 + */
1300 +- if (huge_page_disallowed)
1301 ++ *req_level = level = kvm_mmu_max_mapping_level(vcpu->kvm, slot, gfn, pfn, max_level);
1302 ++ if (level == PG_LEVEL_4K || huge_page_disallowed)
1303 + return PG_LEVEL_4K;
1304 +
1305 + /*
1306 +diff --git a/arch/x86/kvm/mmu/tdp_mmu.c b/arch/x86/kvm/mmu/tdp_mmu.c
1307 +index 41ef3ed5349f1..3c225bc0c0826 100644
1308 +--- a/arch/x86/kvm/mmu/tdp_mmu.c
1309 ++++ b/arch/x86/kvm/mmu/tdp_mmu.c
1310 +@@ -410,6 +410,7 @@ static void __handle_changed_spte(struct kvm *kvm, int as_id, gfn_t gfn,
1311 + bool was_leaf = was_present && is_last_spte(old_spte, level);
1312 + bool is_leaf = is_present && is_last_spte(new_spte, level);
1313 + bool pfn_changed = spte_to_pfn(old_spte) != spte_to_pfn(new_spte);
1314 ++ bool was_large, is_large;
1315 +
1316 + WARN_ON(level > PT64_ROOT_MAX_LEVEL);
1317 + WARN_ON(level < PG_LEVEL_4K);
1318 +@@ -443,13 +444,6 @@ static void __handle_changed_spte(struct kvm *kvm, int as_id, gfn_t gfn,
1319 +
1320 + trace_kvm_tdp_mmu_spte_changed(as_id, gfn, level, old_spte, new_spte);
1321 +
1322 +- if (is_large_pte(old_spte) != is_large_pte(new_spte)) {
1323 +- if (is_large_pte(old_spte))
1324 +- atomic64_sub(1, (atomic64_t*)&kvm->stat.lpages);
1325 +- else
1326 +- atomic64_add(1, (atomic64_t*)&kvm->stat.lpages);
1327 +- }
1328 +-
1329 + /*
1330 + * The only times a SPTE should be changed from a non-present to
1331 + * non-present state is when an MMIO entry is installed/modified/
1332 +@@ -475,6 +469,18 @@ static void __handle_changed_spte(struct kvm *kvm, int as_id, gfn_t gfn,
1333 + return;
1334 + }
1335 +
1336 ++ /*
1337 ++ * Update large page stats if a large page is being zapped, created, or
1338 ++ * is replacing an existing shadow page.
1339 ++ */
1340 ++ was_large = was_leaf && is_large_pte(old_spte);
1341 ++ is_large = is_leaf && is_large_pte(new_spte);
1342 ++ if (was_large != is_large) {
1343 ++ if (was_large)
1344 ++ atomic64_sub(1, (atomic64_t *)&kvm->stat.lpages);
1345 ++ else
1346 ++ atomic64_add(1, (atomic64_t *)&kvm->stat.lpages);
1347 ++ }
1348 +
1349 + if (was_leaf && is_dirty_spte(old_spte) &&
1350 + (!is_present || !is_dirty_spte(new_spte) || pfn_changed))
1351 +diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c
1352 +index df3b7e5644169..1d47f2dbe3e99 100644
1353 +--- a/arch/x86/kvm/vmx/nested.c
1354 ++++ b/arch/x86/kvm/vmx/nested.c
1355 +@@ -2226,12 +2226,11 @@ static void prepare_vmcs02_early(struct vcpu_vmx *vmx, struct vmcs12 *vmcs12)
1356 + ~PIN_BASED_VMX_PREEMPTION_TIMER);
1357 +
1358 + /* Posted interrupts setting is only taken from vmcs12. */
1359 +- if (nested_cpu_has_posted_intr(vmcs12)) {
1360 ++ vmx->nested.pi_pending = false;
1361 ++ if (nested_cpu_has_posted_intr(vmcs12))
1362 + vmx->nested.posted_intr_nv = vmcs12->posted_intr_nv;
1363 +- vmx->nested.pi_pending = false;
1364 +- } else {
1365 ++ else
1366 + exec_control &= ~PIN_BASED_POSTED_INTR;
1367 +- }
1368 + pin_controls_set(vmx, exec_control);
1369 +
1370 + /*
1371 +diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
1372 +index dcd4f43c23de5..6af7d0b0c154b 100644
1373 +--- a/arch/x86/kvm/vmx/vmx.c
1374 ++++ b/arch/x86/kvm/vmx/vmx.c
1375 +@@ -6452,6 +6452,9 @@ static void vmx_handle_exit_irqoff(struct kvm_vcpu *vcpu)
1376 + {
1377 + struct vcpu_vmx *vmx = to_vmx(vcpu);
1378 +
1379 ++ if (vmx->emulation_required)
1380 ++ return;
1381 ++
1382 + if (vmx->exit_reason.basic == EXIT_REASON_EXTERNAL_INTERRUPT)
1383 + handle_external_interrupt_irqoff(vcpu);
1384 + else if (vmx->exit_reason.basic == EXIT_REASON_EXCEPTION_NMI)
1385 +diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
1386 +index 1e11198f89934..93e851041c9c0 100644
1387 +--- a/arch/x86/kvm/x86.c
1388 ++++ b/arch/x86/kvm/x86.c
1389 +@@ -3223,6 +3223,10 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
1390 + if (!msr_info->host_initiated) {
1391 + s64 adj = data - vcpu->arch.ia32_tsc_adjust_msr;
1392 + adjust_tsc_offset_guest(vcpu, adj);
1393 ++ /* Before back to guest, tsc_timestamp must be adjusted
1394 ++ * as well, otherwise guest's percpu pvclock time could jump.
1395 ++ */
1396 ++ kvm_make_request(KVM_REQ_CLOCK_UPDATE, vcpu);
1397 + }
1398 + vcpu->arch.ia32_tsc_adjust_msr = data;
1399 + }
1400 +diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c
1401 +index eccbe2aed7c3f..4df33cc08eee0 100644
1402 +--- a/block/bfq-iosched.c
1403 ++++ b/block/bfq-iosched.c
1404 +@@ -2333,6 +2333,9 @@ static int bfq_request_merge(struct request_queue *q, struct request **req,
1405 + __rq = bfq_find_rq_fmerge(bfqd, bio, q);
1406 + if (__rq && elv_bio_merge_ok(__rq, bio)) {
1407 + *req = __rq;
1408 ++
1409 ++ if (blk_discard_mergable(__rq))
1410 ++ return ELEVATOR_DISCARD_MERGE;
1411 + return ELEVATOR_FRONT_MERGE;
1412 + }
1413 +
1414 +diff --git a/block/bio.c b/block/bio.c
1415 +index 1fab762e079be..d95e3456ba0c5 100644
1416 +--- a/block/bio.c
1417 ++++ b/block/bio.c
1418 +@@ -979,6 +979,14 @@ static int bio_iov_bvec_set_append(struct bio *bio, struct iov_iter *iter)
1419 + return 0;
1420 + }
1421 +
1422 ++static void bio_put_pages(struct page **pages, size_t size, size_t off)
1423 ++{
1424 ++ size_t i, nr = DIV_ROUND_UP(size + (off & ~PAGE_MASK), PAGE_SIZE);
1425 ++
1426 ++ for (i = 0; i < nr; i++)
1427 ++ put_page(pages[i]);
1428 ++}
1429 ++
1430 + #define PAGE_PTRS_PER_BVEC (sizeof(struct bio_vec) / sizeof(struct page *))
1431 +
1432 + /**
1433 +@@ -1023,8 +1031,10 @@ static int __bio_iov_iter_get_pages(struct bio *bio, struct iov_iter *iter)
1434 + if (same_page)
1435 + put_page(page);
1436 + } else {
1437 +- if (WARN_ON_ONCE(bio_full(bio, len)))
1438 +- return -EINVAL;
1439 ++ if (WARN_ON_ONCE(bio_full(bio, len))) {
1440 ++ bio_put_pages(pages + i, left, offset);
1441 ++ return -EINVAL;
1442 ++ }
1443 + __bio_add_page(bio, page, len, offset);
1444 + }
1445 + offset = 0;
1446 +@@ -1069,6 +1079,7 @@ static int __bio_iov_append_get_pages(struct bio *bio, struct iov_iter *iter)
1447 + len = min_t(size_t, PAGE_SIZE - offset, left);
1448 + if (bio_add_hw_page(q, bio, page, len, offset,
1449 + max_append_sectors, &same_page) != len) {
1450 ++ bio_put_pages(pages + i, left, offset);
1451 + ret = -EINVAL;
1452 + break;
1453 + }
1454 +diff --git a/block/blk-crypto.c b/block/blk-crypto.c
1455 +index c5bdaafffa29f..103c2e2d50d67 100644
1456 +--- a/block/blk-crypto.c
1457 ++++ b/block/blk-crypto.c
1458 +@@ -332,7 +332,7 @@ int blk_crypto_init_key(struct blk_crypto_key *blk_key, const u8 *raw_key,
1459 + if (mode->keysize == 0)
1460 + return -EINVAL;
1461 +
1462 +- if (dun_bytes == 0 || dun_bytes > BLK_CRYPTO_MAX_IV_SIZE)
1463 ++ if (dun_bytes == 0 || dun_bytes > mode->ivsize)
1464 + return -EINVAL;
1465 +
1466 + if (!is_power_of_2(data_unit_size))
1467 +diff --git a/block/blk-merge.c b/block/blk-merge.c
1468 +index bcdff1879c346..526953525e35e 100644
1469 +--- a/block/blk-merge.c
1470 ++++ b/block/blk-merge.c
1471 +@@ -348,6 +348,8 @@ void __blk_queue_split(struct bio **bio, unsigned int *nr_segs)
1472 + trace_block_split(split, (*bio)->bi_iter.bi_sector);
1473 + submit_bio_noacct(*bio);
1474 + *bio = split;
1475 ++
1476 ++ blk_throtl_charge_bio_split(*bio);
1477 + }
1478 + }
1479 +
1480 +@@ -705,22 +707,6 @@ static void blk_account_io_merge_request(struct request *req)
1481 + }
1482 + }
1483 +
1484 +-/*
1485 +- * Two cases of handling DISCARD merge:
1486 +- * If max_discard_segments > 1, the driver takes every bio
1487 +- * as a range and send them to controller together. The ranges
1488 +- * needn't to be contiguous.
1489 +- * Otherwise, the bios/requests will be handled as same as
1490 +- * others which should be contiguous.
1491 +- */
1492 +-static inline bool blk_discard_mergable(struct request *req)
1493 +-{
1494 +- if (req_op(req) == REQ_OP_DISCARD &&
1495 +- queue_max_discard_segments(req->q) > 1)
1496 +- return true;
1497 +- return false;
1498 +-}
1499 +-
1500 + static enum elv_merge blk_try_req_merge(struct request *req,
1501 + struct request *next)
1502 + {
1503 +diff --git a/block/blk-throttle.c b/block/blk-throttle.c
1504 +index b1b22d863bdf8..55c49015e5333 100644
1505 +--- a/block/blk-throttle.c
1506 ++++ b/block/blk-throttle.c
1507 +@@ -178,6 +178,9 @@ struct throtl_grp {
1508 + unsigned int bad_bio_cnt; /* bios exceeding latency threshold */
1509 + unsigned long bio_cnt_reset_time;
1510 +
1511 ++ atomic_t io_split_cnt[2];
1512 ++ atomic_t last_io_split_cnt[2];
1513 ++
1514 + struct blkg_rwstat stat_bytes;
1515 + struct blkg_rwstat stat_ios;
1516 + };
1517 +@@ -777,6 +780,8 @@ static inline void throtl_start_new_slice_with_credit(struct throtl_grp *tg,
1518 + tg->bytes_disp[rw] = 0;
1519 + tg->io_disp[rw] = 0;
1520 +
1521 ++ atomic_set(&tg->io_split_cnt[rw], 0);
1522 ++
1523 + /*
1524 + * Previous slice has expired. We must have trimmed it after last
1525 + * bio dispatch. That means since start of last slice, we never used
1526 +@@ -799,6 +804,9 @@ static inline void throtl_start_new_slice(struct throtl_grp *tg, bool rw)
1527 + tg->io_disp[rw] = 0;
1528 + tg->slice_start[rw] = jiffies;
1529 + tg->slice_end[rw] = jiffies + tg->td->throtl_slice;
1530 ++
1531 ++ atomic_set(&tg->io_split_cnt[rw], 0);
1532 ++
1533 + throtl_log(&tg->service_queue,
1534 + "[%c] new slice start=%lu end=%lu jiffies=%lu",
1535 + rw == READ ? 'R' : 'W', tg->slice_start[rw],
1536 +@@ -1031,6 +1039,9 @@ static bool tg_may_dispatch(struct throtl_grp *tg, struct bio *bio,
1537 + jiffies + tg->td->throtl_slice);
1538 + }
1539 +
1540 ++ if (iops_limit != UINT_MAX)
1541 ++ tg->io_disp[rw] += atomic_xchg(&tg->io_split_cnt[rw], 0);
1542 ++
1543 + if (tg_with_in_bps_limit(tg, bio, bps_limit, &bps_wait) &&
1544 + tg_with_in_iops_limit(tg, bio, iops_limit, &iops_wait)) {
1545 + if (wait)
1546 +@@ -2052,12 +2063,14 @@ static void throtl_downgrade_check(struct throtl_grp *tg)
1547 + }
1548 +
1549 + if (tg->iops[READ][LIMIT_LOW]) {
1550 ++ tg->last_io_disp[READ] += atomic_xchg(&tg->last_io_split_cnt[READ], 0);
1551 + iops = tg->last_io_disp[READ] * HZ / elapsed_time;
1552 + if (iops >= tg->iops[READ][LIMIT_LOW])
1553 + tg->last_low_overflow_time[READ] = now;
1554 + }
1555 +
1556 + if (tg->iops[WRITE][LIMIT_LOW]) {
1557 ++ tg->last_io_disp[WRITE] += atomic_xchg(&tg->last_io_split_cnt[WRITE], 0);
1558 + iops = tg->last_io_disp[WRITE] * HZ / elapsed_time;
1559 + if (iops >= tg->iops[WRITE][LIMIT_LOW])
1560 + tg->last_low_overflow_time[WRITE] = now;
1561 +@@ -2176,6 +2189,25 @@ static inline void throtl_update_latency_buckets(struct throtl_data *td)
1562 + }
1563 + #endif
1564 +
1565 ++void blk_throtl_charge_bio_split(struct bio *bio)
1566 ++{
1567 ++ struct blkcg_gq *blkg = bio->bi_blkg;
1568 ++ struct throtl_grp *parent = blkg_to_tg(blkg);
1569 ++ struct throtl_service_queue *parent_sq;
1570 ++ bool rw = bio_data_dir(bio);
1571 ++
1572 ++ do {
1573 ++ if (!parent->has_rules[rw])
1574 ++ break;
1575 ++
1576 ++ atomic_inc(&parent->io_split_cnt[rw]);
1577 ++ atomic_inc(&parent->last_io_split_cnt[rw]);
1578 ++
1579 ++ parent_sq = parent->service_queue.parent_sq;
1580 ++ parent = sq_to_tg(parent_sq);
1581 ++ } while (parent);
1582 ++}
1583 ++
1584 + bool blk_throtl_bio(struct bio *bio)
1585 + {
1586 + struct request_queue *q = bio->bi_bdev->bd_disk->queue;
1587 +diff --git a/block/blk.h b/block/blk.h
1588 +index 54d48987c21b2..40b00d18bdb25 100644
1589 +--- a/block/blk.h
1590 ++++ b/block/blk.h
1591 +@@ -290,11 +290,13 @@ int create_task_io_context(struct task_struct *task, gfp_t gfp_mask, int node);
1592 + extern int blk_throtl_init(struct request_queue *q);
1593 + extern void blk_throtl_exit(struct request_queue *q);
1594 + extern void blk_throtl_register_queue(struct request_queue *q);
1595 ++extern void blk_throtl_charge_bio_split(struct bio *bio);
1596 + bool blk_throtl_bio(struct bio *bio);
1597 + #else /* CONFIG_BLK_DEV_THROTTLING */
1598 + static inline int blk_throtl_init(struct request_queue *q) { return 0; }
1599 + static inline void blk_throtl_exit(struct request_queue *q) { }
1600 + static inline void blk_throtl_register_queue(struct request_queue *q) { }
1601 ++static inline void blk_throtl_charge_bio_split(struct bio *bio) { }
1602 + static inline bool blk_throtl_bio(struct bio *bio) { return false; }
1603 + #endif /* CONFIG_BLK_DEV_THROTTLING */
1604 + #ifdef CONFIG_BLK_DEV_THROTTLING_LOW
1605 +diff --git a/block/elevator.c b/block/elevator.c
1606 +index 440699c281193..73e0591acfd4b 100644
1607 +--- a/block/elevator.c
1608 ++++ b/block/elevator.c
1609 +@@ -336,6 +336,9 @@ enum elv_merge elv_merge(struct request_queue *q, struct request **req,
1610 + __rq = elv_rqhash_find(q, bio->bi_iter.bi_sector);
1611 + if (__rq && elv_bio_merge_ok(__rq, bio)) {
1612 + *req = __rq;
1613 ++
1614 ++ if (blk_discard_mergable(__rq))
1615 ++ return ELEVATOR_DISCARD_MERGE;
1616 + return ELEVATOR_BACK_MERGE;
1617 + }
1618 +
1619 +diff --git a/block/mq-deadline.c b/block/mq-deadline.c
1620 +index 8eea2cbf2bf4a..8dca7255d04cf 100644
1621 +--- a/block/mq-deadline.c
1622 ++++ b/block/mq-deadline.c
1623 +@@ -454,6 +454,8 @@ static int dd_request_merge(struct request_queue *q, struct request **rq,
1624 +
1625 + if (elv_bio_merge_ok(__rq, bio)) {
1626 + *rq = __rq;
1627 ++ if (blk_discard_mergable(__rq))
1628 ++ return ELEVATOR_DISCARD_MERGE;
1629 + return ELEVATOR_FRONT_MERGE;
1630 + }
1631 + }
1632 +diff --git a/certs/Makefile b/certs/Makefile
1633 +index 359239a0ee9e3..f9344e52ecdae 100644
1634 +--- a/certs/Makefile
1635 ++++ b/certs/Makefile
1636 +@@ -57,11 +57,19 @@ endif
1637 + redirect_openssl = 2>&1
1638 + quiet_redirect_openssl = 2>&1
1639 + silent_redirect_openssl = 2>/dev/null
1640 ++openssl_available = $(shell openssl help 2>/dev/null && echo yes)
1641 +
1642 + # We do it this way rather than having a boolean option for enabling an
1643 + # external private key, because 'make randconfig' might enable such a
1644 + # boolean option and we unfortunately can't make it depend on !RANDCONFIG.
1645 + ifeq ($(CONFIG_MODULE_SIG_KEY),"certs/signing_key.pem")
1646 ++
1647 ++ifeq ($(openssl_available),yes)
1648 ++X509TEXT=$(shell openssl x509 -in "certs/signing_key.pem" -text 2>/dev/null)
1649 ++
1650 ++$(if $(findstring rsaEncryption,$(X509TEXT)),,$(shell rm -f "certs/signing_key.pem"))
1651 ++endif
1652 ++
1653 + $(obj)/signing_key.pem: $(obj)/x509.genkey
1654 + @$(kecho) "###"
1655 + @$(kecho) "### Now generating an X.509 key pair to be used for signing modules."
1656 +diff --git a/crypto/Makefile b/crypto/Makefile
1657 +index 10526d4559b80..c633f15a04813 100644
1658 +--- a/crypto/Makefile
1659 ++++ b/crypto/Makefile
1660 +@@ -74,7 +74,6 @@ obj-$(CONFIG_CRYPTO_NULL2) += crypto_null.o
1661 + obj-$(CONFIG_CRYPTO_MD4) += md4.o
1662 + obj-$(CONFIG_CRYPTO_MD5) += md5.o
1663 + obj-$(CONFIG_CRYPTO_RMD160) += rmd160.o
1664 +-obj-$(CONFIG_CRYPTO_RMD320) += rmd320.o
1665 + obj-$(CONFIG_CRYPTO_SHA1) += sha1_generic.o
1666 + obj-$(CONFIG_CRYPTO_SHA256) += sha256_generic.o
1667 + obj-$(CONFIG_CRYPTO_SHA512) += sha512_generic.o
1668 +diff --git a/crypto/ecc.h b/crypto/ecc.h
1669 +index a006132646a43..1350e8eb6ac23 100644
1670 +--- a/crypto/ecc.h
1671 ++++ b/crypto/ecc.h
1672 +@@ -27,6 +27,7 @@
1673 + #define _CRYPTO_ECC_H
1674 +
1675 + #include <crypto/ecc_curve.h>
1676 ++#include <asm/unaligned.h>
1677 +
1678 + /* One digit is u64 qword. */
1679 + #define ECC_CURVE_NIST_P192_DIGITS 3
1680 +@@ -46,13 +47,13 @@
1681 + * @out: Output array
1682 + * @ndigits: Number of digits to copy
1683 + */
1684 +-static inline void ecc_swap_digits(const u64 *in, u64 *out, unsigned int ndigits)
1685 ++static inline void ecc_swap_digits(const void *in, u64 *out, unsigned int ndigits)
1686 + {
1687 + const __be64 *src = (__force __be64 *)in;
1688 + int i;
1689 +
1690 + for (i = 0; i < ndigits; i++)
1691 +- out[i] = be64_to_cpu(src[ndigits - 1 - i]);
1692 ++ out[i] = get_unaligned_be64(&src[ndigits - 1 - i]);
1693 + }
1694 +
1695 + /**
1696 +diff --git a/crypto/tcrypt.c b/crypto/tcrypt.c
1697 +index 6b7c158dc5087..f9c00875bc0e4 100644
1698 +--- a/crypto/tcrypt.c
1699 ++++ b/crypto/tcrypt.c
1700 +@@ -290,6 +290,11 @@ static void test_mb_aead_speed(const char *algo, int enc, int secs,
1701 + }
1702 +
1703 + ret = crypto_aead_setauthsize(tfm, authsize);
1704 ++ if (ret) {
1705 ++ pr_err("alg: aead: Failed to setauthsize for %s: %d\n", algo,
1706 ++ ret);
1707 ++ goto out_free_tfm;
1708 ++ }
1709 +
1710 + for (i = 0; i < num_mb; ++i)
1711 + if (testmgr_alloc_buf(data[i].xbuf)) {
1712 +@@ -315,7 +320,7 @@ static void test_mb_aead_speed(const char *algo, int enc, int secs,
1713 + for (i = 0; i < num_mb; ++i) {
1714 + data[i].req = aead_request_alloc(tfm, GFP_KERNEL);
1715 + if (!data[i].req) {
1716 +- pr_err("alg: skcipher: Failed to allocate request for %s\n",
1717 ++ pr_err("alg: aead: Failed to allocate request for %s\n",
1718 + algo);
1719 + while (i--)
1720 + aead_request_free(data[i].req);
1721 +@@ -567,13 +572,19 @@ static void test_aead_speed(const char *algo, int enc, unsigned int secs,
1722 + sgout = &sg[9];
1723 +
1724 + tfm = crypto_alloc_aead(algo, 0, 0);
1725 +-
1726 + if (IS_ERR(tfm)) {
1727 + pr_err("alg: aead: Failed to load transform for %s: %ld\n", algo,
1728 + PTR_ERR(tfm));
1729 + goto out_notfm;
1730 + }
1731 +
1732 ++ ret = crypto_aead_setauthsize(tfm, authsize);
1733 ++ if (ret) {
1734 ++ pr_err("alg: aead: Failed to setauthsize for %s: %d\n", algo,
1735 ++ ret);
1736 ++ goto out_noreq;
1737 ++ }
1738 ++
1739 + crypto_init_wait(&wait);
1740 + printk(KERN_INFO "\ntesting speed of %s (%s) %s\n", algo,
1741 + get_driver_name(crypto_aead, tfm), e);
1742 +@@ -611,8 +622,13 @@ static void test_aead_speed(const char *algo, int enc, unsigned int secs,
1743 + break;
1744 + }
1745 + }
1746 ++
1747 + ret = crypto_aead_setkey(tfm, key, *keysize);
1748 +- ret = crypto_aead_setauthsize(tfm, authsize);
1749 ++ if (ret) {
1750 ++ pr_err("setkey() failed flags=%x: %d\n",
1751 ++ crypto_aead_get_flags(tfm), ret);
1752 ++ goto out;
1753 ++ }
1754 +
1755 + iv_len = crypto_aead_ivsize(tfm);
1756 + if (iv_len)
1757 +@@ -622,15 +638,8 @@ static void test_aead_speed(const char *algo, int enc, unsigned int secs,
1758 + printk(KERN_INFO "test %u (%d bit key, %d byte blocks): ",
1759 + i, *keysize * 8, bs);
1760 +
1761 +-
1762 + memset(tvmem[0], 0xff, PAGE_SIZE);
1763 +
1764 +- if (ret) {
1765 +- pr_err("setkey() failed flags=%x\n",
1766 +- crypto_aead_get_flags(tfm));
1767 +- goto out;
1768 +- }
1769 +-
1770 + sg_init_aead(sg, xbuf, bs + (enc ? 0 : authsize),
1771 + assoc, aad_size);
1772 +
1773 +diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
1774 +index 61c762961ca8e..44f434acfce08 100644
1775 +--- a/drivers/ata/libata-core.c
1776 ++++ b/drivers/ata/libata-core.c
1777 +@@ -5573,7 +5573,7 @@ int ata_host_start(struct ata_host *host)
1778 + have_stop = 1;
1779 + }
1780 +
1781 +- if (host->ops->host_stop)
1782 ++ if (host->ops && host->ops->host_stop)
1783 + have_stop = 1;
1784 +
1785 + if (have_stop) {
1786 +diff --git a/drivers/auxdisplay/hd44780.c b/drivers/auxdisplay/hd44780.c
1787 +index 2e5e7c9939334..8b2a0eb3f32a4 100644
1788 +--- a/drivers/auxdisplay/hd44780.c
1789 ++++ b/drivers/auxdisplay/hd44780.c
1790 +@@ -323,8 +323,8 @@ static int hd44780_remove(struct platform_device *pdev)
1791 + {
1792 + struct charlcd *lcd = platform_get_drvdata(pdev);
1793 +
1794 +- kfree(lcd->drvdata);
1795 + charlcd_unregister(lcd);
1796 ++ kfree(lcd->drvdata);
1797 +
1798 + kfree(lcd);
1799 + return 0;
1800 +diff --git a/drivers/base/dd.c b/drivers/base/dd.c
1801 +index 592b3955abe22..a421da0c9c012 100644
1802 +--- a/drivers/base/dd.c
1803 ++++ b/drivers/base/dd.c
1804 +@@ -560,7 +560,8 @@ re_probe:
1805 + goto probe_failed;
1806 + }
1807 +
1808 +- if (driver_sysfs_add(dev)) {
1809 ++ ret = driver_sysfs_add(dev);
1810 ++ if (ret) {
1811 + pr_err("%s: driver_sysfs_add(%s) failed\n",
1812 + __func__, dev_name(dev));
1813 + goto probe_failed;
1814 +@@ -582,15 +583,18 @@ re_probe:
1815 + goto probe_failed;
1816 + }
1817 +
1818 +- if (device_add_groups(dev, drv->dev_groups)) {
1819 ++ ret = device_add_groups(dev, drv->dev_groups);
1820 ++ if (ret) {
1821 + dev_err(dev, "device_add_groups() failed\n");
1822 + goto dev_groups_failed;
1823 + }
1824 +
1825 +- if (dev_has_sync_state(dev) &&
1826 +- device_create_file(dev, &dev_attr_state_synced)) {
1827 +- dev_err(dev, "state_synced sysfs add failed\n");
1828 +- goto dev_sysfs_state_synced_failed;
1829 ++ if (dev_has_sync_state(dev)) {
1830 ++ ret = device_create_file(dev, &dev_attr_state_synced);
1831 ++ if (ret) {
1832 ++ dev_err(dev, "state_synced sysfs add failed\n");
1833 ++ goto dev_sysfs_state_synced_failed;
1834 ++ }
1835 + }
1836 +
1837 + if (test_remove) {
1838 +diff --git a/drivers/base/firmware_loader/main.c b/drivers/base/firmware_loader/main.c
1839 +index 68c549d712304..bdbedc6660a87 100644
1840 +--- a/drivers/base/firmware_loader/main.c
1841 ++++ b/drivers/base/firmware_loader/main.c
1842 +@@ -165,7 +165,7 @@ static inline int fw_state_wait(struct fw_priv *fw_priv)
1843 + return __fw_state_wait_common(fw_priv, MAX_SCHEDULE_TIMEOUT);
1844 + }
1845 +
1846 +-static int fw_cache_piggyback_on_request(const char *name);
1847 ++static void fw_cache_piggyback_on_request(struct fw_priv *fw_priv);
1848 +
1849 + static struct fw_priv *__allocate_fw_priv(const char *fw_name,
1850 + struct firmware_cache *fwc,
1851 +@@ -707,10 +707,8 @@ int assign_fw(struct firmware *fw, struct device *device)
1852 + * on request firmware.
1853 + */
1854 + if (!(fw_priv->opt_flags & FW_OPT_NOCACHE) &&
1855 +- fw_priv->fwc->state == FW_LOADER_START_CACHE) {
1856 +- if (fw_cache_piggyback_on_request(fw_priv->fw_name))
1857 +- kref_get(&fw_priv->ref);
1858 +- }
1859 ++ fw_priv->fwc->state == FW_LOADER_START_CACHE)
1860 ++ fw_cache_piggyback_on_request(fw_priv);
1861 +
1862 + /* pass the pages buffer to driver at the last minute */
1863 + fw_set_page_data(fw_priv, fw);
1864 +@@ -1259,11 +1257,11 @@ static int __fw_entry_found(const char *name)
1865 + return 0;
1866 + }
1867 +
1868 +-static int fw_cache_piggyback_on_request(const char *name)
1869 ++static void fw_cache_piggyback_on_request(struct fw_priv *fw_priv)
1870 + {
1871 +- struct firmware_cache *fwc = &fw_cache;
1872 ++ const char *name = fw_priv->fw_name;
1873 ++ struct firmware_cache *fwc = fw_priv->fwc;
1874 + struct fw_cache_entry *fce;
1875 +- int ret = 0;
1876 +
1877 + spin_lock(&fwc->name_lock);
1878 + if (__fw_entry_found(name))
1879 +@@ -1271,13 +1269,12 @@ static int fw_cache_piggyback_on_request(const char *name)
1880 +
1881 + fce = alloc_fw_cache_entry(name);
1882 + if (fce) {
1883 +- ret = 1;
1884 + list_add(&fce->list, &fwc->fw_names);
1885 ++ kref_get(&fw_priv->ref);
1886 + pr_debug("%s: fw: %s\n", __func__, name);
1887 + }
1888 + found:
1889 + spin_unlock(&fwc->name_lock);
1890 +- return ret;
1891 + }
1892 +
1893 + static void free_fw_cache_entry(struct fw_cache_entry *fce)
1894 +@@ -1508,9 +1505,8 @@ static inline void unregister_fw_pm_ops(void)
1895 + unregister_pm_notifier(&fw_cache.pm_notify);
1896 + }
1897 + #else
1898 +-static int fw_cache_piggyback_on_request(const char *name)
1899 ++static void fw_cache_piggyback_on_request(struct fw_priv *fw_priv)
1900 + {
1901 +- return 0;
1902 + }
1903 + static inline int register_fw_pm_ops(void)
1904 + {
1905 +diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
1906 +index 297e95be25b3b..cf1dca0cde2c1 100644
1907 +--- a/drivers/base/regmap/regmap.c
1908 ++++ b/drivers/base/regmap/regmap.c
1909 +@@ -1652,7 +1652,7 @@ static int _regmap_raw_write_impl(struct regmap *map, unsigned int reg,
1910 + if (ret) {
1911 + dev_err(map->dev,
1912 + "Error in caching of register: %x ret: %d\n",
1913 +- reg + i, ret);
1914 ++ reg + regmap_get_offset(map, i), ret);
1915 + return ret;
1916 + }
1917 + }
1918 +diff --git a/drivers/bcma/main.c b/drivers/bcma/main.c
1919 +index 6535614a7dc13..1df2b5801c3bc 100644
1920 +--- a/drivers/bcma/main.c
1921 ++++ b/drivers/bcma/main.c
1922 +@@ -236,6 +236,7 @@ EXPORT_SYMBOL(bcma_core_irq);
1923 +
1924 + void bcma_prepare_core(struct bcma_bus *bus, struct bcma_device *core)
1925 + {
1926 ++ device_initialize(&core->dev);
1927 + core->dev.release = bcma_release_core_dev;
1928 + core->dev.bus = &bcma_bus_type;
1929 + dev_set_name(&core->dev, "bcma%d:%d", bus->num, core->core_index);
1930 +@@ -277,11 +278,10 @@ static void bcma_register_core(struct bcma_bus *bus, struct bcma_device *core)
1931 + {
1932 + int err;
1933 +
1934 +- err = device_register(&core->dev);
1935 ++ err = device_add(&core->dev);
1936 + if (err) {
1937 + bcma_err(bus, "Could not register dev for core 0x%03X\n",
1938 + core->id.id);
1939 +- put_device(&core->dev);
1940 + return;
1941 + }
1942 + core->dev_registered = true;
1943 +@@ -372,7 +372,7 @@ void bcma_unregister_cores(struct bcma_bus *bus)
1944 + /* Now noone uses internally-handled cores, we can free them */
1945 + list_for_each_entry_safe(core, tmp, &bus->cores, list) {
1946 + list_del(&core->list);
1947 +- kfree(core);
1948 ++ put_device(&core->dev);
1949 + }
1950 + }
1951 +
1952 +diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
1953 +index 1061894a55df2..4acf5c6cb80d2 100644
1954 +--- a/drivers/block/nbd.c
1955 ++++ b/drivers/block/nbd.c
1956 +@@ -1369,6 +1369,7 @@ static int __nbd_ioctl(struct block_device *bdev, struct nbd_device *nbd,
1957 + unsigned int cmd, unsigned long arg)
1958 + {
1959 + struct nbd_config *config = nbd->config;
1960 ++ loff_t bytesize;
1961 +
1962 + switch (cmd) {
1963 + case NBD_DISCONNECT:
1964 +@@ -1383,8 +1384,9 @@ static int __nbd_ioctl(struct block_device *bdev, struct nbd_device *nbd,
1965 + case NBD_SET_SIZE:
1966 + return nbd_set_size(nbd, arg, config->blksize);
1967 + case NBD_SET_SIZE_BLOCKS:
1968 +- return nbd_set_size(nbd, arg * config->blksize,
1969 +- config->blksize);
1970 ++ if (check_mul_overflow((loff_t)arg, config->blksize, &bytesize))
1971 ++ return -EINVAL;
1972 ++ return nbd_set_size(nbd, bytesize, config->blksize);
1973 + case NBD_SET_TIMEOUT:
1974 + nbd_set_cmd_timeout(nbd, arg);
1975 + return 0;
1976 +@@ -1715,7 +1717,17 @@ static int nbd_dev_add(int index)
1977 + refcount_set(&nbd->refs, 1);
1978 + INIT_LIST_HEAD(&nbd->list);
1979 + disk->major = NBD_MAJOR;
1980 ++
1981 ++ /* Too big first_minor can cause duplicate creation of
1982 ++ * sysfs files/links, since first_minor will be truncated to
1983 ++ * byte in __device_add_disk().
1984 ++ */
1985 + disk->first_minor = index << part_shift;
1986 ++ if (disk->first_minor > 0xff) {
1987 ++ err = -EINVAL;
1988 ++ goto out_free_idr;
1989 ++ }
1990 ++
1991 + disk->fops = &nbd_fops;
1992 + disk->private_data = nbd;
1993 + sprintf(disk->disk_name, "nbd%d", index);
1994 +diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
1995 +index 9122f9cc97cbe..ae0cf5e715842 100644
1996 +--- a/drivers/bluetooth/btusb.c
1997 ++++ b/drivers/bluetooth/btusb.c
1998 +@@ -2912,10 +2912,11 @@ static int btusb_setup_intel_new(struct hci_dev *hdev)
1999 + /* Read the Intel supported features and if new exception formats
2000 + * supported, need to load the additional DDC config to enable.
2001 + */
2002 +- btintel_read_debug_features(hdev, &features);
2003 +-
2004 +- /* Set DDC mask for available debug features */
2005 +- btintel_set_debug_features(hdev, &features);
2006 ++ err = btintel_read_debug_features(hdev, &features);
2007 ++ if (!err) {
2008 ++ /* Set DDC mask for available debug features */
2009 ++ btintel_set_debug_features(hdev, &features);
2010 ++ }
2011 +
2012 + /* Read the Intel version information after loading the FW */
2013 + err = btintel_read_version(hdev, &ver);
2014 +@@ -3008,10 +3009,11 @@ static int btusb_setup_intel_newgen(struct hci_dev *hdev)
2015 + /* Read the Intel supported features and if new exception formats
2016 + * supported, need to load the additional DDC config to enable.
2017 + */
2018 +- btintel_read_debug_features(hdev, &features);
2019 +-
2020 +- /* Set DDC mask for available debug features */
2021 +- btintel_set_debug_features(hdev, &features);
2022 ++ err = btintel_read_debug_features(hdev, &features);
2023 ++ if (!err) {
2024 ++ /* Set DDC mask for available debug features */
2025 ++ btintel_set_debug_features(hdev, &features);
2026 ++ }
2027 +
2028 + /* Read the Intel version information after loading the FW */
2029 + err = btintel_read_version_tlv(hdev, &version);
2030 +diff --git a/drivers/char/tpm/Kconfig b/drivers/char/tpm/Kconfig
2031 +index 4308f9ca7a43d..d6ba644f6b00a 100644
2032 +--- a/drivers/char/tpm/Kconfig
2033 ++++ b/drivers/char/tpm/Kconfig
2034 +@@ -89,7 +89,6 @@ config TCG_TIS_SYNQUACER
2035 + config TCG_TIS_I2C_CR50
2036 + tristate "TPM Interface Specification 2.0 Interface (I2C - CR50)"
2037 + depends on I2C
2038 +- select TCG_CR50
2039 + help
2040 + This is a driver for the Google cr50 I2C TPM interface which is a
2041 + custom microcontroller and requires a custom i2c protocol interface
2042 +diff --git a/drivers/char/tpm/tpm_ibmvtpm.c b/drivers/char/tpm/tpm_ibmvtpm.c
2043 +index 903604769de99..3af4c07a9342f 100644
2044 +--- a/drivers/char/tpm/tpm_ibmvtpm.c
2045 ++++ b/drivers/char/tpm/tpm_ibmvtpm.c
2046 +@@ -106,17 +106,12 @@ static int tpm_ibmvtpm_recv(struct tpm_chip *chip, u8 *buf, size_t count)
2047 + {
2048 + struct ibmvtpm_dev *ibmvtpm = dev_get_drvdata(&chip->dev);
2049 + u16 len;
2050 +- int sig;
2051 +
2052 + if (!ibmvtpm->rtce_buf) {
2053 + dev_err(ibmvtpm->dev, "ibmvtpm device is not ready\n");
2054 + return 0;
2055 + }
2056 +
2057 +- sig = wait_event_interruptible(ibmvtpm->wq, !ibmvtpm->tpm_processing_cmd);
2058 +- if (sig)
2059 +- return -EINTR;
2060 +-
2061 + len = ibmvtpm->res_len;
2062 +
2063 + if (count < len) {
2064 +@@ -237,7 +232,7 @@ static int tpm_ibmvtpm_send(struct tpm_chip *chip, u8 *buf, size_t count)
2065 + * set the processing flag before the Hcall, since we may get the
2066 + * result (interrupt) before even being able to check rc.
2067 + */
2068 +- ibmvtpm->tpm_processing_cmd = true;
2069 ++ ibmvtpm->tpm_processing_cmd = 1;
2070 +
2071 + again:
2072 + rc = ibmvtpm_send_crq(ibmvtpm->vdev,
2073 +@@ -255,7 +250,7 @@ again:
2074 + goto again;
2075 + }
2076 + dev_err(ibmvtpm->dev, "tpm_ibmvtpm_send failed rc=%d\n", rc);
2077 +- ibmvtpm->tpm_processing_cmd = false;
2078 ++ ibmvtpm->tpm_processing_cmd = 0;
2079 + }
2080 +
2081 + spin_unlock(&ibmvtpm->rtce_lock);
2082 +@@ -269,7 +264,9 @@ static void tpm_ibmvtpm_cancel(struct tpm_chip *chip)
2083 +
2084 + static u8 tpm_ibmvtpm_status(struct tpm_chip *chip)
2085 + {
2086 +- return 0;
2087 ++ struct ibmvtpm_dev *ibmvtpm = dev_get_drvdata(&chip->dev);
2088 ++
2089 ++ return ibmvtpm->tpm_processing_cmd;
2090 + }
2091 +
2092 + /**
2093 +@@ -457,7 +454,7 @@ static const struct tpm_class_ops tpm_ibmvtpm = {
2094 + .send = tpm_ibmvtpm_send,
2095 + .cancel = tpm_ibmvtpm_cancel,
2096 + .status = tpm_ibmvtpm_status,
2097 +- .req_complete_mask = 0,
2098 ++ .req_complete_mask = 1,
2099 + .req_complete_val = 0,
2100 + .req_canceled = tpm_ibmvtpm_req_canceled,
2101 + };
2102 +@@ -550,7 +547,7 @@ static void ibmvtpm_crq_process(struct ibmvtpm_crq *crq,
2103 + case VTPM_TPM_COMMAND_RES:
2104 + /* len of the data in rtce buffer */
2105 + ibmvtpm->res_len = be16_to_cpu(crq->len);
2106 +- ibmvtpm->tpm_processing_cmd = false;
2107 ++ ibmvtpm->tpm_processing_cmd = 0;
2108 + wake_up_interruptible(&ibmvtpm->wq);
2109 + return;
2110 + default:
2111 +@@ -688,8 +685,15 @@ static int tpm_ibmvtpm_probe(struct vio_dev *vio_dev,
2112 + goto init_irq_cleanup;
2113 + }
2114 +
2115 +- if (!strcmp(id->compat, "IBM,vtpm20")) {
2116 ++
2117 ++ if (!strcmp(id->compat, "IBM,vtpm20"))
2118 + chip->flags |= TPM_CHIP_FLAG_TPM2;
2119 ++
2120 ++ rc = tpm_get_timeouts(chip);
2121 ++ if (rc)
2122 ++ goto init_irq_cleanup;
2123 ++
2124 ++ if (chip->flags & TPM_CHIP_FLAG_TPM2) {
2125 + rc = tpm2_get_cc_attrs_tbl(chip);
2126 + if (rc)
2127 + goto init_irq_cleanup;
2128 +diff --git a/drivers/char/tpm/tpm_ibmvtpm.h b/drivers/char/tpm/tpm_ibmvtpm.h
2129 +index b92aa7d3e93e7..51198b137461e 100644
2130 +--- a/drivers/char/tpm/tpm_ibmvtpm.h
2131 ++++ b/drivers/char/tpm/tpm_ibmvtpm.h
2132 +@@ -41,7 +41,7 @@ struct ibmvtpm_dev {
2133 + wait_queue_head_t wq;
2134 + u16 res_len;
2135 + u32 vtpm_version;
2136 +- bool tpm_processing_cmd;
2137 ++ u8 tpm_processing_cmd;
2138 + };
2139 +
2140 + #define CRQ_RES_BUF_SIZE PAGE_SIZE
2141 +diff --git a/drivers/clk/mvebu/kirkwood.c b/drivers/clk/mvebu/kirkwood.c
2142 +index 47680237d0beb..8bc893df47364 100644
2143 +--- a/drivers/clk/mvebu/kirkwood.c
2144 ++++ b/drivers/clk/mvebu/kirkwood.c
2145 +@@ -265,6 +265,7 @@ static const char *powersave_parents[] = {
2146 + static const struct clk_muxing_soc_desc kirkwood_mux_desc[] __initconst = {
2147 + { "powersave", powersave_parents, ARRAY_SIZE(powersave_parents),
2148 + 11, 1, 0 },
2149 ++ { }
2150 + };
2151 +
2152 + static struct clk *clk_muxing_get_src(
2153 +diff --git a/drivers/clocksource/sh_cmt.c b/drivers/clocksource/sh_cmt.c
2154 +index d7ed99f0001f8..dd0956ad969c1 100644
2155 +--- a/drivers/clocksource/sh_cmt.c
2156 ++++ b/drivers/clocksource/sh_cmt.c
2157 +@@ -579,7 +579,8 @@ static int sh_cmt_start(struct sh_cmt_channel *ch, unsigned long flag)
2158 + ch->flags |= flag;
2159 +
2160 + /* setup timeout if no clockevent */
2161 +- if ((flag == FLAG_CLOCKSOURCE) && (!(ch->flags & FLAG_CLOCKEVENT)))
2162 ++ if (ch->cmt->num_channels == 1 &&
2163 ++ flag == FLAG_CLOCKSOURCE && (!(ch->flags & FLAG_CLOCKEVENT)))
2164 + __sh_cmt_set_next(ch, ch->max_match_value);
2165 + out:
2166 + raw_spin_unlock_irqrestore(&ch->lock, flags);
2167 +@@ -621,20 +622,25 @@ static struct sh_cmt_channel *cs_to_sh_cmt(struct clocksource *cs)
2168 + static u64 sh_cmt_clocksource_read(struct clocksource *cs)
2169 + {
2170 + struct sh_cmt_channel *ch = cs_to_sh_cmt(cs);
2171 +- unsigned long flags;
2172 + u32 has_wrapped;
2173 +- u64 value;
2174 +- u32 raw;
2175 +
2176 +- raw_spin_lock_irqsave(&ch->lock, flags);
2177 +- value = ch->total_cycles;
2178 +- raw = sh_cmt_get_counter(ch, &has_wrapped);
2179 ++ if (ch->cmt->num_channels == 1) {
2180 ++ unsigned long flags;
2181 ++ u64 value;
2182 ++ u32 raw;
2183 +
2184 +- if (unlikely(has_wrapped))
2185 +- raw += ch->match_value + 1;
2186 +- raw_spin_unlock_irqrestore(&ch->lock, flags);
2187 ++ raw_spin_lock_irqsave(&ch->lock, flags);
2188 ++ value = ch->total_cycles;
2189 ++ raw = sh_cmt_get_counter(ch, &has_wrapped);
2190 ++
2191 ++ if (unlikely(has_wrapped))
2192 ++ raw += ch->match_value + 1;
2193 ++ raw_spin_unlock_irqrestore(&ch->lock, flags);
2194 ++
2195 ++ return value + raw;
2196 ++ }
2197 +
2198 +- return value + raw;
2199 ++ return sh_cmt_get_counter(ch, &has_wrapped);
2200 + }
2201 +
2202 + static int sh_cmt_clocksource_enable(struct clocksource *cs)
2203 +@@ -697,7 +703,7 @@ static int sh_cmt_register_clocksource(struct sh_cmt_channel *ch,
2204 + cs->disable = sh_cmt_clocksource_disable;
2205 + cs->suspend = sh_cmt_clocksource_suspend;
2206 + cs->resume = sh_cmt_clocksource_resume;
2207 +- cs->mask = CLOCKSOURCE_MASK(sizeof(u64) * 8);
2208 ++ cs->mask = CLOCKSOURCE_MASK(ch->cmt->info->width);
2209 + cs->flags = CLOCK_SOURCE_IS_CONTINUOUS;
2210 +
2211 + dev_info(&ch->cmt->pdev->dev, "ch%u: used as clock source\n",
2212 +diff --git a/drivers/counter/104-quad-8.c b/drivers/counter/104-quad-8.c
2213 +index 9691f8612be87..8de776f3b142a 100644
2214 +--- a/drivers/counter/104-quad-8.c
2215 ++++ b/drivers/counter/104-quad-8.c
2216 +@@ -715,12 +715,13 @@ static ssize_t quad8_count_ceiling_write(struct counter_device *counter,
2217 + case 1:
2218 + case 3:
2219 + quad8_preset_register_set(priv, count->id, ceiling);
2220 +- break;
2221 ++ mutex_unlock(&priv->lock);
2222 ++ return len;
2223 + }
2224 +
2225 + mutex_unlock(&priv->lock);
2226 +
2227 +- return len;
2228 ++ return -EINVAL;
2229 + }
2230 +
2231 + static ssize_t quad8_count_preset_enable_read(struct counter_device *counter,
2232 +diff --git a/drivers/crypto/hisilicon/sec2/sec.h b/drivers/crypto/hisilicon/sec2/sec.h
2233 +index dfdce2f21e658..1aeb53f28eddb 100644
2234 +--- a/drivers/crypto/hisilicon/sec2/sec.h
2235 ++++ b/drivers/crypto/hisilicon/sec2/sec.h
2236 +@@ -140,11 +140,6 @@ struct sec_ctx {
2237 + struct device *dev;
2238 + };
2239 +
2240 +-enum sec_endian {
2241 +- SEC_LE = 0,
2242 +- SEC_32BE,
2243 +- SEC_64BE
2244 +-};
2245 +
2246 + enum sec_debug_file_index {
2247 + SEC_CLEAR_ENABLE,
2248 +diff --git a/drivers/crypto/hisilicon/sec2/sec_main.c b/drivers/crypto/hisilicon/sec2/sec_main.c
2249 +index 6f0062d4408c3..0305e656b4778 100644
2250 +--- a/drivers/crypto/hisilicon/sec2/sec_main.c
2251 ++++ b/drivers/crypto/hisilicon/sec2/sec_main.c
2252 +@@ -304,31 +304,20 @@ static const struct pci_device_id sec_dev_ids[] = {
2253 + };
2254 + MODULE_DEVICE_TABLE(pci, sec_dev_ids);
2255 +
2256 +-static u8 sec_get_endian(struct hisi_qm *qm)
2257 ++static void sec_set_endian(struct hisi_qm *qm)
2258 + {
2259 + u32 reg;
2260 +
2261 +- /*
2262 +- * As for VF, it is a wrong way to get endian setting by
2263 +- * reading a register of the engine
2264 +- */
2265 +- if (qm->pdev->is_virtfn) {
2266 +- dev_err_ratelimited(&qm->pdev->dev,
2267 +- "cannot access a register in VF!\n");
2268 +- return SEC_LE;
2269 +- }
2270 + reg = readl_relaxed(qm->io_base + SEC_CONTROL_REG);
2271 +- /* BD little endian mode */
2272 +- if (!(reg & BIT(0)))
2273 +- return SEC_LE;
2274 ++ reg &= ~(BIT(1) | BIT(0));
2275 ++ if (!IS_ENABLED(CONFIG_64BIT))
2276 ++ reg |= BIT(1);
2277 +
2278 +- /* BD 32-bits big endian mode */
2279 +- else if (!(reg & BIT(1)))
2280 +- return SEC_32BE;
2281 +
2282 +- /* BD 64-bits big endian mode */
2283 +- else
2284 +- return SEC_64BE;
2285 ++ if (!IS_ENABLED(CONFIG_CPU_LITTLE_ENDIAN))
2286 ++ reg |= BIT(0);
2287 ++
2288 ++ writel_relaxed(reg, qm->io_base + SEC_CONTROL_REG);
2289 + }
2290 +
2291 + static int sec_engine_init(struct hisi_qm *qm)
2292 +@@ -382,9 +371,7 @@ static int sec_engine_init(struct hisi_qm *qm)
2293 + qm->io_base + SEC_BD_ERR_CHK_EN_REG3);
2294 +
2295 + /* config endian */
2296 +- reg = readl_relaxed(qm->io_base + SEC_CONTROL_REG);
2297 +- reg |= sec_get_endian(qm);
2298 +- writel_relaxed(reg, qm->io_base + SEC_CONTROL_REG);
2299 ++ sec_set_endian(qm);
2300 +
2301 + return 0;
2302 + }
2303 +@@ -921,7 +908,8 @@ static int sec_probe(struct pci_dev *pdev, const struct pci_device_id *id)
2304 + return 0;
2305 +
2306 + err_alg_unregister:
2307 +- hisi_qm_alg_unregister(qm, &sec_devices);
2308 ++ if (qm->qp_num >= ctx_q_num)
2309 ++ hisi_qm_alg_unregister(qm, &sec_devices);
2310 + err_qm_stop:
2311 + sec_debugfs_exit(qm);
2312 + hisi_qm_stop(qm, QM_NORMAL);
2313 +diff --git a/drivers/crypto/mxs-dcp.c b/drivers/crypto/mxs-dcp.c
2314 +index d6a7784d29888..f397cc5bf1021 100644
2315 +--- a/drivers/crypto/mxs-dcp.c
2316 ++++ b/drivers/crypto/mxs-dcp.c
2317 +@@ -170,15 +170,19 @@ static struct dcp *global_sdcp;
2318 +
2319 + static int mxs_dcp_start_dma(struct dcp_async_ctx *actx)
2320 + {
2321 ++ int dma_err;
2322 + struct dcp *sdcp = global_sdcp;
2323 + const int chan = actx->chan;
2324 + uint32_t stat;
2325 + unsigned long ret;
2326 + struct dcp_dma_desc *desc = &sdcp->coh->desc[actx->chan];
2327 +-
2328 + dma_addr_t desc_phys = dma_map_single(sdcp->dev, desc, sizeof(*desc),
2329 + DMA_TO_DEVICE);
2330 +
2331 ++ dma_err = dma_mapping_error(sdcp->dev, desc_phys);
2332 ++ if (dma_err)
2333 ++ return dma_err;
2334 ++
2335 + reinit_completion(&sdcp->completion[chan]);
2336 +
2337 + /* Clear status register. */
2338 +@@ -216,18 +220,29 @@ static int mxs_dcp_start_dma(struct dcp_async_ctx *actx)
2339 + static int mxs_dcp_run_aes(struct dcp_async_ctx *actx,
2340 + struct skcipher_request *req, int init)
2341 + {
2342 ++ dma_addr_t key_phys, src_phys, dst_phys;
2343 + struct dcp *sdcp = global_sdcp;
2344 + struct dcp_dma_desc *desc = &sdcp->coh->desc[actx->chan];
2345 + struct dcp_aes_req_ctx *rctx = skcipher_request_ctx(req);
2346 + int ret;
2347 +
2348 +- dma_addr_t key_phys = dma_map_single(sdcp->dev, sdcp->coh->aes_key,
2349 +- 2 * AES_KEYSIZE_128,
2350 +- DMA_TO_DEVICE);
2351 +- dma_addr_t src_phys = dma_map_single(sdcp->dev, sdcp->coh->aes_in_buf,
2352 +- DCP_BUF_SZ, DMA_TO_DEVICE);
2353 +- dma_addr_t dst_phys = dma_map_single(sdcp->dev, sdcp->coh->aes_out_buf,
2354 +- DCP_BUF_SZ, DMA_FROM_DEVICE);
2355 ++ key_phys = dma_map_single(sdcp->dev, sdcp->coh->aes_key,
2356 ++ 2 * AES_KEYSIZE_128, DMA_TO_DEVICE);
2357 ++ ret = dma_mapping_error(sdcp->dev, key_phys);
2358 ++ if (ret)
2359 ++ return ret;
2360 ++
2361 ++ src_phys = dma_map_single(sdcp->dev, sdcp->coh->aes_in_buf,
2362 ++ DCP_BUF_SZ, DMA_TO_DEVICE);
2363 ++ ret = dma_mapping_error(sdcp->dev, src_phys);
2364 ++ if (ret)
2365 ++ goto err_src;
2366 ++
2367 ++ dst_phys = dma_map_single(sdcp->dev, sdcp->coh->aes_out_buf,
2368 ++ DCP_BUF_SZ, DMA_FROM_DEVICE);
2369 ++ ret = dma_mapping_error(sdcp->dev, dst_phys);
2370 ++ if (ret)
2371 ++ goto err_dst;
2372 +
2373 + if (actx->fill % AES_BLOCK_SIZE) {
2374 + dev_err(sdcp->dev, "Invalid block size!\n");
2375 +@@ -265,10 +280,12 @@ static int mxs_dcp_run_aes(struct dcp_async_ctx *actx,
2376 + ret = mxs_dcp_start_dma(actx);
2377 +
2378 + aes_done_run:
2379 ++ dma_unmap_single(sdcp->dev, dst_phys, DCP_BUF_SZ, DMA_FROM_DEVICE);
2380 ++err_dst:
2381 ++ dma_unmap_single(sdcp->dev, src_phys, DCP_BUF_SZ, DMA_TO_DEVICE);
2382 ++err_src:
2383 + dma_unmap_single(sdcp->dev, key_phys, 2 * AES_KEYSIZE_128,
2384 + DMA_TO_DEVICE);
2385 +- dma_unmap_single(sdcp->dev, src_phys, DCP_BUF_SZ, DMA_TO_DEVICE);
2386 +- dma_unmap_single(sdcp->dev, dst_phys, DCP_BUF_SZ, DMA_FROM_DEVICE);
2387 +
2388 + return ret;
2389 + }
2390 +@@ -557,6 +574,10 @@ static int mxs_dcp_run_sha(struct ahash_request *req)
2391 + dma_addr_t buf_phys = dma_map_single(sdcp->dev, sdcp->coh->sha_in_buf,
2392 + DCP_BUF_SZ, DMA_TO_DEVICE);
2393 +
2394 ++ ret = dma_mapping_error(sdcp->dev, buf_phys);
2395 ++ if (ret)
2396 ++ return ret;
2397 ++
2398 + /* Fill in the DMA descriptor. */
2399 + desc->control0 = MXS_DCP_CONTROL0_DECR_SEMAPHORE |
2400 + MXS_DCP_CONTROL0_INTERRUPT |
2401 +@@ -589,6 +610,10 @@ static int mxs_dcp_run_sha(struct ahash_request *req)
2402 + if (rctx->fini) {
2403 + digest_phys = dma_map_single(sdcp->dev, sdcp->coh->sha_out_buf,
2404 + DCP_SHA_PAY_SZ, DMA_FROM_DEVICE);
2405 ++ ret = dma_mapping_error(sdcp->dev, digest_phys);
2406 ++ if (ret)
2407 ++ goto done_run;
2408 ++
2409 + desc->control0 |= MXS_DCP_CONTROL0_HASH_TERM;
2410 + desc->payload = digest_phys;
2411 + }
2412 +diff --git a/drivers/crypto/omap-aes.c b/drivers/crypto/omap-aes.c
2413 +index 0dd4c6b157de9..9b968ac4ee7b6 100644
2414 +--- a/drivers/crypto/omap-aes.c
2415 ++++ b/drivers/crypto/omap-aes.c
2416 +@@ -1175,9 +1175,9 @@ static int omap_aes_probe(struct platform_device *pdev)
2417 + spin_lock_init(&dd->lock);
2418 +
2419 + INIT_LIST_HEAD(&dd->list);
2420 +- spin_lock(&list_lock);
2421 ++ spin_lock_bh(&list_lock);
2422 + list_add_tail(&dd->list, &dev_list);
2423 +- spin_unlock(&list_lock);
2424 ++ spin_unlock_bh(&list_lock);
2425 +
2426 + /* Initialize crypto engine */
2427 + dd->engine = crypto_engine_alloc_init(dev, 1);
2428 +@@ -1264,9 +1264,9 @@ static int omap_aes_remove(struct platform_device *pdev)
2429 + if (!dd)
2430 + return -ENODEV;
2431 +
2432 +- spin_lock(&list_lock);
2433 ++ spin_lock_bh(&list_lock);
2434 + list_del(&dd->list);
2435 +- spin_unlock(&list_lock);
2436 ++ spin_unlock_bh(&list_lock);
2437 +
2438 + for (i = dd->pdata->algs_info_size - 1; i >= 0; i--)
2439 + for (j = dd->pdata->algs_info[i].registered - 1; j >= 0; j--) {
2440 +diff --git a/drivers/crypto/omap-des.c b/drivers/crypto/omap-des.c
2441 +index c9d38bcfd1c77..7fdf38e07adf8 100644
2442 +--- a/drivers/crypto/omap-des.c
2443 ++++ b/drivers/crypto/omap-des.c
2444 +@@ -1035,9 +1035,9 @@ static int omap_des_probe(struct platform_device *pdev)
2445 +
2446 +
2447 + INIT_LIST_HEAD(&dd->list);
2448 +- spin_lock(&list_lock);
2449 ++ spin_lock_bh(&list_lock);
2450 + list_add_tail(&dd->list, &dev_list);
2451 +- spin_unlock(&list_lock);
2452 ++ spin_unlock_bh(&list_lock);
2453 +
2454 + /* Initialize des crypto engine */
2455 + dd->engine = crypto_engine_alloc_init(dev, 1);
2456 +@@ -1096,9 +1096,9 @@ static int omap_des_remove(struct platform_device *pdev)
2457 + if (!dd)
2458 + return -ENODEV;
2459 +
2460 +- spin_lock(&list_lock);
2461 ++ spin_lock_bh(&list_lock);
2462 + list_del(&dd->list);
2463 +- spin_unlock(&list_lock);
2464 ++ spin_unlock_bh(&list_lock);
2465 +
2466 + for (i = dd->pdata->algs_info_size - 1; i >= 0; i--)
2467 + for (j = dd->pdata->algs_info[i].registered - 1; j >= 0; j--)
2468 +diff --git a/drivers/crypto/omap-sham.c b/drivers/crypto/omap-sham.c
2469 +index dd53ad9987b0d..63beea7cdba5e 100644
2470 +--- a/drivers/crypto/omap-sham.c
2471 ++++ b/drivers/crypto/omap-sham.c
2472 +@@ -1736,7 +1736,7 @@ static void omap_sham_done_task(unsigned long data)
2473 + if (test_and_clear_bit(FLAGS_OUTPUT_READY, &dd->flags))
2474 + goto finish;
2475 + } else if (test_bit(FLAGS_DMA_READY, &dd->flags)) {
2476 +- if (test_and_clear_bit(FLAGS_DMA_ACTIVE, &dd->flags)) {
2477 ++ if (test_bit(FLAGS_DMA_ACTIVE, &dd->flags)) {
2478 + omap_sham_update_dma_stop(dd);
2479 + if (dd->err) {
2480 + err = dd->err;
2481 +@@ -2144,9 +2144,9 @@ static int omap_sham_probe(struct platform_device *pdev)
2482 + (rev & dd->pdata->major_mask) >> dd->pdata->major_shift,
2483 + (rev & dd->pdata->minor_mask) >> dd->pdata->minor_shift);
2484 +
2485 +- spin_lock(&sham.lock);
2486 ++ spin_lock_bh(&sham.lock);
2487 + list_add_tail(&dd->list, &sham.dev_list);
2488 +- spin_unlock(&sham.lock);
2489 ++ spin_unlock_bh(&sham.lock);
2490 +
2491 + dd->engine = crypto_engine_alloc_init(dev, 1);
2492 + if (!dd->engine) {
2493 +@@ -2194,9 +2194,9 @@ err_algs:
2494 + err_engine_start:
2495 + crypto_engine_exit(dd->engine);
2496 + err_engine:
2497 +- spin_lock(&sham.lock);
2498 ++ spin_lock_bh(&sham.lock);
2499 + list_del(&dd->list);
2500 +- spin_unlock(&sham.lock);
2501 ++ spin_unlock_bh(&sham.lock);
2502 + err_pm:
2503 + pm_runtime_disable(dev);
2504 + if (!dd->polling_mode)
2505 +@@ -2215,9 +2215,9 @@ static int omap_sham_remove(struct platform_device *pdev)
2506 + dd = platform_get_drvdata(pdev);
2507 + if (!dd)
2508 + return -ENODEV;
2509 +- spin_lock(&sham.lock);
2510 ++ spin_lock_bh(&sham.lock);
2511 + list_del(&dd->list);
2512 +- spin_unlock(&sham.lock);
2513 ++ spin_unlock_bh(&sham.lock);
2514 + for (i = dd->pdata->algs_info_size - 1; i >= 0; i--)
2515 + for (j = dd->pdata->algs_info[i].registered - 1; j >= 0; j--) {
2516 + crypto_unregister_ahash(
2517 +diff --git a/drivers/crypto/qat/qat_c3xxxvf/adf_c3xxxvf_hw_data.c b/drivers/crypto/qat/qat_c3xxxvf/adf_c3xxxvf_hw_data.c
2518 +index 15f6b9bdfb221..ddf42fb326251 100644
2519 +--- a/drivers/crypto/qat/qat_c3xxxvf/adf_c3xxxvf_hw_data.c
2520 ++++ b/drivers/crypto/qat/qat_c3xxxvf/adf_c3xxxvf_hw_data.c
2521 +@@ -81,10 +81,10 @@ void adf_init_hw_data_c3xxxiov(struct adf_hw_device_data *hw_data)
2522 + hw_data->enable_error_correction = adf_vf_void_noop;
2523 + hw_data->init_admin_comms = adf_vf_int_noop;
2524 + hw_data->exit_admin_comms = adf_vf_void_noop;
2525 +- hw_data->send_admin_init = adf_vf2pf_init;
2526 ++ hw_data->send_admin_init = adf_vf2pf_notify_init;
2527 + hw_data->init_arb = adf_vf_int_noop;
2528 + hw_data->exit_arb = adf_vf_void_noop;
2529 +- hw_data->disable_iov = adf_vf2pf_shutdown;
2530 ++ hw_data->disable_iov = adf_vf2pf_notify_shutdown;
2531 + hw_data->get_accel_mask = get_accel_mask;
2532 + hw_data->get_ae_mask = get_ae_mask;
2533 + hw_data->get_num_accels = get_num_accels;
2534 +diff --git a/drivers/crypto/qat/qat_c62xvf/adf_c62xvf_hw_data.c b/drivers/crypto/qat/qat_c62xvf/adf_c62xvf_hw_data.c
2535 +index d231583428c91..7e202ef925231 100644
2536 +--- a/drivers/crypto/qat/qat_c62xvf/adf_c62xvf_hw_data.c
2537 ++++ b/drivers/crypto/qat/qat_c62xvf/adf_c62xvf_hw_data.c
2538 +@@ -81,10 +81,10 @@ void adf_init_hw_data_c62xiov(struct adf_hw_device_data *hw_data)
2539 + hw_data->enable_error_correction = adf_vf_void_noop;
2540 + hw_data->init_admin_comms = adf_vf_int_noop;
2541 + hw_data->exit_admin_comms = adf_vf_void_noop;
2542 +- hw_data->send_admin_init = adf_vf2pf_init;
2543 ++ hw_data->send_admin_init = adf_vf2pf_notify_init;
2544 + hw_data->init_arb = adf_vf_int_noop;
2545 + hw_data->exit_arb = adf_vf_void_noop;
2546 +- hw_data->disable_iov = adf_vf2pf_shutdown;
2547 ++ hw_data->disable_iov = adf_vf2pf_notify_shutdown;
2548 + hw_data->get_accel_mask = get_accel_mask;
2549 + hw_data->get_ae_mask = get_ae_mask;
2550 + hw_data->get_num_accels = get_num_accels;
2551 +diff --git a/drivers/crypto/qat/qat_common/adf_common_drv.h b/drivers/crypto/qat/qat_common/adf_common_drv.h
2552 +index c61476553728d..dd4a811b7e89f 100644
2553 +--- a/drivers/crypto/qat/qat_common/adf_common_drv.h
2554 ++++ b/drivers/crypto/qat/qa