Gentoo Archives: gentoo-commits

From: Mike Pagano <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/linux-patches:5.4 commit in: /
Date: Thu, 17 Sep 2020 14:56:45
Message-Id: 1600354590.a7f0d1d977e56d726dbe46f1d3e3a4271afc492d.mpagano@gentoo
1 commit: a7f0d1d977e56d726dbe46f1d3e3a4271afc492d
2 Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
3 AuthorDate: Thu Sep 17 14:56:30 2020 +0000
4 Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
5 CommitDate: Thu Sep 17 14:56:30 2020 +0000
6 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=a7f0d1d9
7
8 Linux patch 5.4.66
9
10 Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org>
11
12 0000_README | 4 +
13 1065_linux-5.4.66.patch | 5268 +++++++++++++++++++++++++++++++++++++++++++++++
14 2 files changed, 5272 insertions(+)
15
16 diff --git a/0000_README b/0000_README
17 index c73366d..b647f4e 100644
18 --- a/0000_README
19 +++ b/0000_README
20 @@ -303,6 +303,10 @@ Patch: 1064_linux-5.4.65.patch
21 From: http://www.kernel.org
22 Desc: Linux 5.4.65
23
24 +Patch: 1065_linux-5.4.66.patch
25 +From: http://www.kernel.org
26 +Desc: Linux 5.4.66
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/1065_linux-5.4.66.patch b/1065_linux-5.4.66.patch
33 new file mode 100644
34 index 0000000..616bb20
35 --- /dev/null
36 +++ b/1065_linux-5.4.66.patch
37 @@ -0,0 +1,5268 @@
38 +diff --git a/Makefile b/Makefile
39 +index 4cb68164b79ee..a3686247e10e9 100644
40 +--- a/Makefile
41 ++++ b/Makefile
42 +@@ -1,7 +1,7 @@
43 + # SPDX-License-Identifier: GPL-2.0
44 + VERSION = 5
45 + PATCHLEVEL = 4
46 +-SUBLEVEL = 65
47 ++SUBLEVEL = 66
48 + EXTRAVERSION =
49 + NAME = Kleptomaniac Octopus
50 +
51 +diff --git a/arch/arc/boot/dts/hsdk.dts b/arch/arc/boot/dts/hsdk.dts
52 +index 9acbeba832c0b..dcaa44e408ace 100644
53 +--- a/arch/arc/boot/dts/hsdk.dts
54 ++++ b/arch/arc/boot/dts/hsdk.dts
55 +@@ -88,6 +88,8 @@
56 +
57 + arcpct: pct {
58 + compatible = "snps,archs-pct";
59 ++ interrupt-parent = <&cpu_intc>;
60 ++ interrupts = <20>;
61 + };
62 +
63 + /* TIMER0 with interrupt for clockevent */
64 +@@ -208,7 +210,7 @@
65 + reg = <0x8000 0x2000>;
66 + interrupts = <10>;
67 + interrupt-names = "macirq";
68 +- phy-mode = "rgmii";
69 ++ phy-mode = "rgmii-id";
70 + snps,pbl = <32>;
71 + snps,multicast-filter-bins = <256>;
72 + clocks = <&gmacclk>;
73 +@@ -226,7 +228,7 @@
74 + #address-cells = <1>;
75 + #size-cells = <0>;
76 + compatible = "snps,dwmac-mdio";
77 +- phy0: ethernet-phy@0 {
78 ++ phy0: ethernet-phy@0 { /* Micrel KSZ9031 */
79 + reg = <0>;
80 + };
81 + };
82 +diff --git a/arch/arc/plat-eznps/include/plat/ctop.h b/arch/arc/plat-eznps/include/plat/ctop.h
83 +index a4a61531c7fb9..77712c5ffe848 100644
84 +--- a/arch/arc/plat-eznps/include/plat/ctop.h
85 ++++ b/arch/arc/plat-eznps/include/plat/ctop.h
86 +@@ -33,7 +33,6 @@
87 + #define CTOP_AUX_DPC (CTOP_AUX_BASE + 0x02C)
88 + #define CTOP_AUX_LPC (CTOP_AUX_BASE + 0x030)
89 + #define CTOP_AUX_EFLAGS (CTOP_AUX_BASE + 0x080)
90 +-#define CTOP_AUX_IACK (CTOP_AUX_BASE + 0x088)
91 + #define CTOP_AUX_GPA1 (CTOP_AUX_BASE + 0x08C)
92 + #define CTOP_AUX_UDMC (CTOP_AUX_BASE + 0x300)
93 +
94 +diff --git a/arch/arm/boot/dts/bcm-hr2.dtsi b/arch/arm/boot/dts/bcm-hr2.dtsi
95 +index e35398cc60a06..dd71ab08136be 100644
96 +--- a/arch/arm/boot/dts/bcm-hr2.dtsi
97 ++++ b/arch/arm/boot/dts/bcm-hr2.dtsi
98 +@@ -217,7 +217,7 @@
99 + };
100 +
101 + qspi: spi@27200 {
102 +- compatible = "brcm,spi-bcm-qspi", "brcm,spi-nsp-qspi";
103 ++ compatible = "brcm,spi-nsp-qspi", "brcm,spi-bcm-qspi";
104 + reg = <0x027200 0x184>,
105 + <0x027000 0x124>,
106 + <0x11c408 0x004>,
107 +diff --git a/arch/arm/boot/dts/bcm-nsp.dtsi b/arch/arm/boot/dts/bcm-nsp.dtsi
108 +index 418e6b97cb2ec..8615d89fa4690 100644
109 +--- a/arch/arm/boot/dts/bcm-nsp.dtsi
110 ++++ b/arch/arm/boot/dts/bcm-nsp.dtsi
111 +@@ -282,7 +282,7 @@
112 + };
113 +
114 + qspi: spi@27200 {
115 +- compatible = "brcm,spi-bcm-qspi", "brcm,spi-nsp-qspi";
116 ++ compatible = "brcm,spi-nsp-qspi", "brcm,spi-bcm-qspi";
117 + reg = <0x027200 0x184>,
118 + <0x027000 0x124>,
119 + <0x11c408 0x004>,
120 +diff --git a/arch/arm/boot/dts/bcm5301x.dtsi b/arch/arm/boot/dts/bcm5301x.dtsi
121 +index 2d9b4dd058307..0016720ce5300 100644
122 +--- a/arch/arm/boot/dts/bcm5301x.dtsi
123 ++++ b/arch/arm/boot/dts/bcm5301x.dtsi
124 +@@ -488,7 +488,7 @@
125 + };
126 +
127 + spi@18029200 {
128 +- compatible = "brcm,spi-bcm-qspi", "brcm,spi-nsp-qspi";
129 ++ compatible = "brcm,spi-nsp-qspi", "brcm,spi-bcm-qspi";
130 + reg = <0x18029200 0x184>,
131 + <0x18029000 0x124>,
132 + <0x1811b408 0x004>,
133 +diff --git a/arch/arm/boot/dts/imx7ulp.dtsi b/arch/arm/boot/dts/imx7ulp.dtsi
134 +index 3dac6898cdc57..0108b63df77d3 100644
135 +--- a/arch/arm/boot/dts/imx7ulp.dtsi
136 ++++ b/arch/arm/boot/dts/imx7ulp.dtsi
137 +@@ -397,7 +397,7 @@
138 + clocks = <&pcc2 IMX7ULP_CLK_RGPIO2P1>,
139 + <&pcc3 IMX7ULP_CLK_PCTLC>;
140 + clock-names = "gpio", "port";
141 +- gpio-ranges = <&iomuxc1 0 0 32>;
142 ++ gpio-ranges = <&iomuxc1 0 0 20>;
143 + };
144 +
145 + gpio_ptd: gpio@40af0000 {
146 +@@ -411,7 +411,7 @@
147 + clocks = <&pcc2 IMX7ULP_CLK_RGPIO2P1>,
148 + <&pcc3 IMX7ULP_CLK_PCTLD>;
149 + clock-names = "gpio", "port";
150 +- gpio-ranges = <&iomuxc1 0 32 32>;
151 ++ gpio-ranges = <&iomuxc1 0 32 12>;
152 + };
153 +
154 + gpio_pte: gpio@40b00000 {
155 +@@ -425,7 +425,7 @@
156 + clocks = <&pcc2 IMX7ULP_CLK_RGPIO2P1>,
157 + <&pcc3 IMX7ULP_CLK_PCTLE>;
158 + clock-names = "gpio", "port";
159 +- gpio-ranges = <&iomuxc1 0 64 32>;
160 ++ gpio-ranges = <&iomuxc1 0 64 16>;
161 + };
162 +
163 + gpio_ptf: gpio@40b10000 {
164 +@@ -439,7 +439,7 @@
165 + clocks = <&pcc2 IMX7ULP_CLK_RGPIO2P1>,
166 + <&pcc3 IMX7ULP_CLK_PCTLF>;
167 + clock-names = "gpio", "port";
168 +- gpio-ranges = <&iomuxc1 0 96 32>;
169 ++ gpio-ranges = <&iomuxc1 0 96 20>;
170 + };
171 + };
172 +
173 +diff --git a/arch/arm/boot/dts/logicpd-som-lv-baseboard.dtsi b/arch/arm/boot/dts/logicpd-som-lv-baseboard.dtsi
174 +index 100396f6c2feb..395e05f10d36c 100644
175 +--- a/arch/arm/boot/dts/logicpd-som-lv-baseboard.dtsi
176 ++++ b/arch/arm/boot/dts/logicpd-som-lv-baseboard.dtsi
177 +@@ -51,6 +51,8 @@
178 +
179 + &mcbsp2 {
180 + status = "okay";
181 ++ pinctrl-names = "default";
182 ++ pinctrl-0 = <&mcbsp2_pins>;
183 + };
184 +
185 + &charger {
186 +@@ -102,35 +104,18 @@
187 + regulator-max-microvolt = <3300000>;
188 + };
189 +
190 +- lcd0: display@0 {
191 +- compatible = "panel-dpi";
192 +- label = "28";
193 +- status = "okay";
194 +- /* default-on; */
195 ++ lcd0: display {
196 ++ /* This isn't the exact LCD, but the timings meet spec */
197 ++ compatible = "logicpd,type28";
198 + pinctrl-names = "default";
199 + pinctrl-0 = <&lcd_enable_pin>;
200 +- enable-gpios = <&gpio5 27 GPIO_ACTIVE_HIGH>; /* gpio155, lcd INI */
201 ++ backlight = <&bl>;
202 ++ enable-gpios = <&gpio5 27 GPIO_ACTIVE_HIGH>;
203 + port {
204 + lcd_in: endpoint {
205 + remote-endpoint = <&dpi_out>;
206 + };
207 + };
208 +-
209 +- panel-timing {
210 +- clock-frequency = <9000000>;
211 +- hactive = <480>;
212 +- vactive = <272>;
213 +- hfront-porch = <3>;
214 +- hback-porch = <2>;
215 +- hsync-len = <42>;
216 +- vback-porch = <3>;
217 +- vfront-porch = <2>;
218 +- vsync-len = <11>;
219 +- hsync-active = <1>;
220 +- vsync-active = <1>;
221 +- de-active = <1>;
222 +- pixelclk-active = <0>;
223 +- };
224 + };
225 +
226 + bl: backlight {
227 +diff --git a/arch/arm/boot/dts/logicpd-torpedo-baseboard.dtsi b/arch/arm/boot/dts/logicpd-torpedo-baseboard.dtsi
228 +index 449cc7616da63..e7a8f8addb6e0 100644
229 +--- a/arch/arm/boot/dts/logicpd-torpedo-baseboard.dtsi
230 ++++ b/arch/arm/boot/dts/logicpd-torpedo-baseboard.dtsi
231 +@@ -80,6 +80,8 @@
232 + };
233 +
234 + &mcbsp2 {
235 ++ pinctrl-names = "default";
236 ++ pinctrl-0 = <&mcbsp2_pins>;
237 + status = "okay";
238 + };
239 +
240 +diff --git a/arch/arm/boot/dts/ls1021a.dtsi b/arch/arm/boot/dts/ls1021a.dtsi
241 +index 5a8e58b663420..c62fcca7b4263 100644
242 +--- a/arch/arm/boot/dts/ls1021a.dtsi
243 ++++ b/arch/arm/boot/dts/ls1021a.dtsi
244 +@@ -181,7 +181,7 @@
245 + #address-cells = <1>;
246 + #size-cells = <0>;
247 + reg = <0x0 0x1550000 0x0 0x10000>,
248 +- <0x0 0x40000000 0x0 0x40000000>;
249 ++ <0x0 0x40000000 0x0 0x20000000>;
250 + reg-names = "QuadSPI", "QuadSPI-memory";
251 + interrupts = <GIC_SPI 131 IRQ_TYPE_LEVEL_HIGH>;
252 + clock-names = "qspi_en", "qspi";
253 +diff --git a/arch/arm/boot/dts/socfpga_arria10.dtsi b/arch/arm/boot/dts/socfpga_arria10.dtsi
254 +index 906bfb580e9e7..f261a33440710 100644
255 +--- a/arch/arm/boot/dts/socfpga_arria10.dtsi
256 ++++ b/arch/arm/boot/dts/socfpga_arria10.dtsi
257 +@@ -819,7 +819,7 @@
258 + timer3: timer3@ffd00100 {
259 + compatible = "snps,dw-apb-timer";
260 + interrupts = <0 118 IRQ_TYPE_LEVEL_HIGH>;
261 +- reg = <0xffd01000 0x100>;
262 ++ reg = <0xffd00100 0x100>;
263 + clocks = <&l4_sys_free_clk>;
264 + clock-names = "timer";
265 + resets = <&rst L4SYSTIMER1_RESET>;
266 +diff --git a/arch/arm/boot/dts/vfxxx.dtsi b/arch/arm/boot/dts/vfxxx.dtsi
267 +index 028e0ec30e0c0..fa248066d9d9b 100644
268 +--- a/arch/arm/boot/dts/vfxxx.dtsi
269 ++++ b/arch/arm/boot/dts/vfxxx.dtsi
270 +@@ -495,7 +495,7 @@
271 + };
272 +
273 + ocotp: ocotp@400a5000 {
274 +- compatible = "fsl,vf610-ocotp";
275 ++ compatible = "fsl,vf610-ocotp", "syscon";
276 + reg = <0x400a5000 0x1000>;
277 + clocks = <&clks VF610_CLK_OCOTP>;
278 + };
279 +diff --git a/arch/arm64/boot/dts/broadcom/northstar2/ns2.dtsi b/arch/arm64/boot/dts/broadcom/northstar2/ns2.dtsi
280 +index 15f7b0ed38369..39802066232e1 100644
281 +--- a/arch/arm64/boot/dts/broadcom/northstar2/ns2.dtsi
282 ++++ b/arch/arm64/boot/dts/broadcom/northstar2/ns2.dtsi
283 +@@ -745,7 +745,7 @@
284 + };
285 +
286 + qspi: spi@66470200 {
287 +- compatible = "brcm,spi-bcm-qspi", "brcm,spi-ns2-qspi";
288 ++ compatible = "brcm,spi-ns2-qspi", "brcm,spi-bcm-qspi";
289 + reg = <0x66470200 0x184>,
290 + <0x66470000 0x124>,
291 + <0x67017408 0x004>,
292 +diff --git a/arch/arm64/boot/dts/freescale/imx8mq.dtsi b/arch/arm64/boot/dts/freescale/imx8mq.dtsi
293 +index 55a3d1c4bdf04..bc8540f879654 100644
294 +--- a/arch/arm64/boot/dts/freescale/imx8mq.dtsi
295 ++++ b/arch/arm64/boot/dts/freescale/imx8mq.dtsi
296 +@@ -349,7 +349,7 @@
297 + tmu: tmu@30260000 {
298 + compatible = "fsl,imx8mq-tmu";
299 + reg = <0x30260000 0x10000>;
300 +- interrupt = <GIC_SPI 49 IRQ_TYPE_LEVEL_HIGH>;
301 ++ interrupts = <GIC_SPI 49 IRQ_TYPE_LEVEL_HIGH>;
302 + clocks = <&clk IMX8MQ_CLK_TMU_ROOT>;
303 + little-endian;
304 + fsl,tmu-range = <0xb0000 0xa0026 0x80048 0x70061>;
305 +diff --git a/arch/arm64/kernel/module-plts.c b/arch/arm64/kernel/module-plts.c
306 +index b182442b87a32..426018ebb7007 100644
307 +--- a/arch/arm64/kernel/module-plts.c
308 ++++ b/arch/arm64/kernel/module-plts.c
309 +@@ -270,8 +270,7 @@ int module_frob_arch_sections(Elf_Ehdr *ehdr, Elf_Shdr *sechdrs,
310 + mod->arch.core.plt_shndx = i;
311 + else if (!strcmp(secstrings + sechdrs[i].sh_name, ".init.plt"))
312 + mod->arch.init.plt_shndx = i;
313 +- else if (IS_ENABLED(CONFIG_DYNAMIC_FTRACE) &&
314 +- !strcmp(secstrings + sechdrs[i].sh_name,
315 ++ else if (!strcmp(secstrings + sechdrs[i].sh_name,
316 + ".text.ftrace_trampoline"))
317 + tramp = sechdrs + i;
318 + else if (sechdrs[i].sh_type == SHT_SYMTAB)
319 +diff --git a/arch/powerpc/configs/pasemi_defconfig b/arch/powerpc/configs/pasemi_defconfig
320 +index 08b7f4cef2434..ddf5e97877e2b 100644
321 +--- a/arch/powerpc/configs/pasemi_defconfig
322 ++++ b/arch/powerpc/configs/pasemi_defconfig
323 +@@ -109,7 +109,6 @@ CONFIG_FB_NVIDIA=y
324 + CONFIG_FB_NVIDIA_I2C=y
325 + CONFIG_FB_RADEON=y
326 + # CONFIG_LCD_CLASS_DEVICE is not set
327 +-CONFIG_VGACON_SOFT_SCROLLBACK=y
328 + CONFIG_LOGO=y
329 + CONFIG_SOUND=y
330 + CONFIG_SND=y
331 +diff --git a/arch/powerpc/configs/ppc6xx_defconfig b/arch/powerpc/configs/ppc6xx_defconfig
332 +index 1372a1a7517ad..682d68f39c2b5 100644
333 +--- a/arch/powerpc/configs/ppc6xx_defconfig
334 ++++ b/arch/powerpc/configs/ppc6xx_defconfig
335 +@@ -777,7 +777,6 @@ CONFIG_FB_TRIDENT=m
336 + CONFIG_FB_SM501=m
337 + CONFIG_FB_IBM_GXT4500=y
338 + CONFIG_LCD_PLATFORM=m
339 +-CONFIG_VGACON_SOFT_SCROLLBACK=y
340 + CONFIG_FRAMEBUFFER_CONSOLE=y
341 + CONFIG_FRAMEBUFFER_CONSOLE_ROTATION=y
342 + CONFIG_LOGO=y
343 +diff --git a/arch/x86/configs/i386_defconfig b/arch/x86/configs/i386_defconfig
344 +index 18806b4fb26a9..088709089e9b8 100644
345 +--- a/arch/x86/configs/i386_defconfig
346 ++++ b/arch/x86/configs/i386_defconfig
347 +@@ -204,7 +204,6 @@ CONFIG_FB_MODE_HELPERS=y
348 + CONFIG_FB_TILEBLITTING=y
349 + CONFIG_FB_EFI=y
350 + # CONFIG_LCD_CLASS_DEVICE is not set
351 +-CONFIG_VGACON_SOFT_SCROLLBACK=y
352 + CONFIG_LOGO=y
353 + # CONFIG_LOGO_LINUX_MONO is not set
354 + # CONFIG_LOGO_LINUX_VGA16 is not set
355 +diff --git a/arch/x86/configs/x86_64_defconfig b/arch/x86/configs/x86_64_defconfig
356 +index 3087c5e351e7e..8092d7baf8b50 100644
357 +--- a/arch/x86/configs/x86_64_defconfig
358 ++++ b/arch/x86/configs/x86_64_defconfig
359 +@@ -200,7 +200,6 @@ CONFIG_FB_MODE_HELPERS=y
360 + CONFIG_FB_TILEBLITTING=y
361 + CONFIG_FB_EFI=y
362 + # CONFIG_LCD_CLASS_DEVICE is not set
363 +-CONFIG_VGACON_SOFT_SCROLLBACK=y
364 + CONFIG_LOGO=y
365 + # CONFIG_LOGO_LINUX_MONO is not set
366 + # CONFIG_LOGO_LINUX_VGA16 is not set
367 +diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
368 +index 3be65495aeb8a..a1e62dda56074 100644
369 +--- a/arch/x86/kvm/vmx/vmx.c
370 ++++ b/arch/x86/kvm/vmx/vmx.c
371 +@@ -5895,6 +5895,7 @@ static int vmx_handle_exit(struct kvm_vcpu *vcpu)
372 + (exit_reason != EXIT_REASON_EXCEPTION_NMI &&
373 + exit_reason != EXIT_REASON_EPT_VIOLATION &&
374 + exit_reason != EXIT_REASON_PML_FULL &&
375 ++ exit_reason != EXIT_REASON_APIC_ACCESS &&
376 + exit_reason != EXIT_REASON_TASK_SWITCH)) {
377 + vcpu->run->exit_reason = KVM_EXIT_INTERNAL_ERROR;
378 + vcpu->run->internal.suberror = KVM_INTERNAL_ERROR_DELIVERY_EV;
379 +diff --git a/block/bio.c b/block/bio.c
380 +index 87505a93bcff6..f07739300dfe3 100644
381 +--- a/block/bio.c
382 ++++ b/block/bio.c
383 +@@ -807,8 +807,10 @@ bool __bio_try_merge_page(struct bio *bio, struct page *page,
384 + struct bio_vec *bv = &bio->bi_io_vec[bio->bi_vcnt - 1];
385 +
386 + if (page_is_mergeable(bv, page, len, off, same_page)) {
387 +- if (bio->bi_iter.bi_size > UINT_MAX - len)
388 ++ if (bio->bi_iter.bi_size > UINT_MAX - len) {
389 ++ *same_page = false;
390 + return false;
391 ++ }
392 + bv->bv_len += len;
393 + bio->bi_iter.bi_size += len;
394 + return true;
395 +diff --git a/drivers/atm/firestream.c b/drivers/atm/firestream.c
396 +index d287837ed7555..5acb459856752 100644
397 +--- a/drivers/atm/firestream.c
398 ++++ b/drivers/atm/firestream.c
399 +@@ -998,6 +998,7 @@ static int fs_open(struct atm_vcc *atm_vcc)
400 + error = make_rate (pcr, r, &tmc0, NULL);
401 + if (error) {
402 + kfree(tc);
403 ++ kfree(vcc);
404 + return error;
405 + }
406 + }
407 +diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
408 +index 274beda31c356..bf2f0373a3b2f 100644
409 +--- a/drivers/block/rbd.c
410 ++++ b/drivers/block/rbd.c
411 +@@ -5280,6 +5280,9 @@ static ssize_t rbd_config_info_show(struct device *dev,
412 + {
413 + struct rbd_device *rbd_dev = dev_to_rbd_dev(dev);
414 +
415 ++ if (!capable(CAP_SYS_ADMIN))
416 ++ return -EPERM;
417 ++
418 + return sprintf(buf, "%s\n", rbd_dev->config_info);
419 + }
420 +
421 +@@ -5391,6 +5394,9 @@ static ssize_t rbd_image_refresh(struct device *dev,
422 + struct rbd_device *rbd_dev = dev_to_rbd_dev(dev);
423 + int ret;
424 +
425 ++ if (!capable(CAP_SYS_ADMIN))
426 ++ return -EPERM;
427 ++
428 + ret = rbd_dev_refresh(rbd_dev);
429 + if (ret)
430 + return ret;
431 +@@ -7059,6 +7065,9 @@ static ssize_t do_rbd_add(struct bus_type *bus,
432 + struct rbd_client *rbdc;
433 + int rc;
434 +
435 ++ if (!capable(CAP_SYS_ADMIN))
436 ++ return -EPERM;
437 ++
438 + if (!try_module_get(THIS_MODULE))
439 + return -ENODEV;
440 +
441 +@@ -7208,6 +7217,9 @@ static ssize_t do_rbd_remove(struct bus_type *bus,
442 + bool force = false;
443 + int ret;
444 +
445 ++ if (!capable(CAP_SYS_ADMIN))
446 ++ return -EPERM;
447 ++
448 + dev_id = -1;
449 + opt_buf[0] = '\0';
450 + sscanf(buf, "%d %5s", &dev_id, opt_buf);
451 +diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
452 +index 927eb3fd23660..b9ca89dc75c7d 100644
453 +--- a/drivers/cpufreq/intel_pstate.c
454 ++++ b/drivers/cpufreq/intel_pstate.c
455 +@@ -762,7 +762,7 @@ static void intel_pstate_get_hwp_max(unsigned int cpu, int *phy_max,
456 +
457 + rdmsrl_on_cpu(cpu, MSR_HWP_CAPABILITIES, &cap);
458 + WRITE_ONCE(all_cpu_data[cpu]->hwp_cap_cached, cap);
459 +- if (global.no_turbo)
460 ++ if (global.no_turbo || global.turbo_disabled)
461 + *current_max = HWP_GUARANTEED_PERF(cap);
462 + else
463 + *current_max = HWP_HIGHEST_PERF(cap);
464 +@@ -2533,9 +2533,15 @@ static int intel_pstate_update_status(const char *buf, size_t size)
465 + {
466 + int ret;
467 +
468 +- if (size == 3 && !strncmp(buf, "off", size))
469 +- return intel_pstate_driver ?
470 +- intel_pstate_unregister_driver() : -EINVAL;
471 ++ if (size == 3 && !strncmp(buf, "off", size)) {
472 ++ if (!intel_pstate_driver)
473 ++ return -EINVAL;
474 ++
475 ++ if (hwp_active)
476 ++ return -EBUSY;
477 ++
478 ++ return intel_pstate_unregister_driver();
479 ++ }
480 +
481 + if (size == 6 && !strncmp(buf, "active", size)) {
482 + if (intel_pstate_driver) {
483 +diff --git a/drivers/dma/acpi-dma.c b/drivers/dma/acpi-dma.c
484 +index 8a05db3343d39..dcbcb712de6e8 100644
485 +--- a/drivers/dma/acpi-dma.c
486 ++++ b/drivers/dma/acpi-dma.c
487 +@@ -135,11 +135,13 @@ static void acpi_dma_parse_csrt(struct acpi_device *adev, struct acpi_dma *adma)
488 + if (ret < 0) {
489 + dev_warn(&adev->dev,
490 + "error in parsing resource group\n");
491 +- return;
492 ++ break;
493 + }
494 +
495 + grp = (struct acpi_csrt_group *)((void *)grp + grp->length);
496 + }
497 ++
498 ++ acpi_put_table((struct acpi_table_header *)csrt);
499 + }
500 +
501 + /**
502 +diff --git a/drivers/dma/dma-jz4780.c b/drivers/dma/dma-jz4780.c
503 +index bf95f1d551c51..0ecb724b394f5 100644
504 +--- a/drivers/dma/dma-jz4780.c
505 ++++ b/drivers/dma/dma-jz4780.c
506 +@@ -885,24 +885,11 @@ static int jz4780_dma_probe(struct platform_device *pdev)
507 + return -EINVAL;
508 + }
509 +
510 +- ret = platform_get_irq(pdev, 0);
511 +- if (ret < 0)
512 +- return ret;
513 +-
514 +- jzdma->irq = ret;
515 +-
516 +- ret = request_irq(jzdma->irq, jz4780_dma_irq_handler, 0, dev_name(dev),
517 +- jzdma);
518 +- if (ret) {
519 +- dev_err(dev, "failed to request IRQ %u!\n", jzdma->irq);
520 +- return ret;
521 +- }
522 +-
523 + jzdma->clk = devm_clk_get(dev, NULL);
524 + if (IS_ERR(jzdma->clk)) {
525 + dev_err(dev, "failed to get clock\n");
526 + ret = PTR_ERR(jzdma->clk);
527 +- goto err_free_irq;
528 ++ return ret;
529 + }
530 +
531 + clk_prepare_enable(jzdma->clk);
532 +@@ -955,10 +942,23 @@ static int jz4780_dma_probe(struct platform_device *pdev)
533 + jzchan->vchan.desc_free = jz4780_dma_desc_free;
534 + }
535 +
536 ++ ret = platform_get_irq(pdev, 0);
537 ++ if (ret < 0)
538 ++ goto err_disable_clk;
539 ++
540 ++ jzdma->irq = ret;
541 ++
542 ++ ret = request_irq(jzdma->irq, jz4780_dma_irq_handler, 0, dev_name(dev),
543 ++ jzdma);
544 ++ if (ret) {
545 ++ dev_err(dev, "failed to request IRQ %u!\n", jzdma->irq);
546 ++ goto err_disable_clk;
547 ++ }
548 ++
549 + ret = dmaenginem_async_device_register(dd);
550 + if (ret) {
551 + dev_err(dev, "failed to register device\n");
552 +- goto err_disable_clk;
553 ++ goto err_free_irq;
554 + }
555 +
556 + /* Register with OF DMA helpers. */
557 +@@ -966,17 +966,17 @@ static int jz4780_dma_probe(struct platform_device *pdev)
558 + jzdma);
559 + if (ret) {
560 + dev_err(dev, "failed to register OF DMA controller\n");
561 +- goto err_disable_clk;
562 ++ goto err_free_irq;
563 + }
564 +
565 + dev_info(dev, "JZ4780 DMA controller initialised\n");
566 + return 0;
567 +
568 +-err_disable_clk:
569 +- clk_disable_unprepare(jzdma->clk);
570 +-
571 + err_free_irq:
572 + free_irq(jzdma->irq, jzdma);
573 ++
574 ++err_disable_clk:
575 ++ clk_disable_unprepare(jzdma->clk);
576 + return ret;
577 + }
578 +
579 +diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c
580 +index e6da53e9c3f46..3a2a1dc9a786a 100644
581 +--- a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c
582 ++++ b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c
583 +@@ -3575,7 +3575,8 @@ static int smu7_read_sensor(struct pp_hwmgr *hwmgr, int idx,
584 + case AMDGPU_PP_SENSOR_GPU_POWER:
585 + return smu7_get_gpu_power(hwmgr, (uint32_t *)value);
586 + case AMDGPU_PP_SENSOR_VDDGFX:
587 +- if ((data->vr_config & 0xff) == 0x2)
588 ++ if ((data->vr_config & VRCONF_VDDGFX_MASK) ==
589 ++ (VR_SVI2_PLANE_2 << VRCONF_VDDGFX_SHIFT))
590 + val_vid = PHM_READ_INDIRECT_FIELD(hwmgr->device,
591 + CGS_IND_REG__SMC, PWR_SVI2_STATUS, PLANE2_VID);
592 + else
593 +diff --git a/drivers/gpu/drm/i915/gvt/cmd_parser.c b/drivers/gpu/drm/i915/gvt/cmd_parser.c
594 +index fc29a3705354c..56cd14cacf5e7 100644
595 +--- a/drivers/gpu/drm/i915/gvt/cmd_parser.c
596 ++++ b/drivers/gpu/drm/i915/gvt/cmd_parser.c
597 +@@ -963,18 +963,6 @@ static int cmd_handler_lri(struct parser_exec_state *s)
598 + int i, ret = 0;
599 + int cmd_len = cmd_length(s);
600 + struct intel_gvt *gvt = s->vgpu->gvt;
601 +- u32 valid_len = CMD_LEN(1);
602 +-
603 +- /*
604 +- * Official intel docs are somewhat sloppy , check the definition of
605 +- * MI_LOAD_REGISTER_IMM.
606 +- */
607 +- #define MAX_VALID_LEN 127
608 +- if ((cmd_len < valid_len) || (cmd_len > MAX_VALID_LEN)) {
609 +- gvt_err("len is not valid: len=%u valid_len=%u\n",
610 +- cmd_len, valid_len);
611 +- return -EFAULT;
612 +- }
613 +
614 + for (i = 1; i < cmd_len; i += 2) {
615 + if (IS_BROADWELL(gvt->dev_priv) && s->ring_id != RCS0) {
616 +diff --git a/drivers/gpu/drm/msm/adreno/a2xx_gpu.c b/drivers/gpu/drm/msm/adreno/a2xx_gpu.c
617 +index 1f83bc18d5008..80f3b1da9fc26 100644
618 +--- a/drivers/gpu/drm/msm/adreno/a2xx_gpu.c
619 ++++ b/drivers/gpu/drm/msm/adreno/a2xx_gpu.c
620 +@@ -164,6 +164,11 @@ static int a2xx_hw_init(struct msm_gpu *gpu)
621 + if (ret)
622 + return ret;
623 +
624 ++ gpu_write(gpu, REG_AXXX_CP_RB_CNTL,
625 ++ MSM_GPU_RB_CNTL_DEFAULT | AXXX_CP_RB_CNTL_NO_UPDATE);
626 ++
627 ++ gpu_write(gpu, REG_AXXX_CP_RB_BASE, lower_32_bits(gpu->rb[0]->iova));
628 ++
629 + /* NOTE: PM4/micro-engine firmware registers look to be the same
630 + * for a2xx and a3xx.. we could possibly push that part down to
631 + * adreno_gpu base class. Or push both PM4 and PFP but
632 +diff --git a/drivers/gpu/drm/msm/adreno/a3xx_gpu.c b/drivers/gpu/drm/msm/adreno/a3xx_gpu.c
633 +index 5f7e98028eaf4..eeba2deeca1e8 100644
634 +--- a/drivers/gpu/drm/msm/adreno/a3xx_gpu.c
635 ++++ b/drivers/gpu/drm/msm/adreno/a3xx_gpu.c
636 +@@ -215,6 +215,16 @@ static int a3xx_hw_init(struct msm_gpu *gpu)
637 + if (ret)
638 + return ret;
639 +
640 ++ /*
641 ++ * Use the default ringbuffer size and block size but disable the RPTR
642 ++ * shadow
643 ++ */
644 ++ gpu_write(gpu, REG_AXXX_CP_RB_CNTL,
645 ++ MSM_GPU_RB_CNTL_DEFAULT | AXXX_CP_RB_CNTL_NO_UPDATE);
646 ++
647 ++ /* Set the ringbuffer address */
648 ++ gpu_write(gpu, REG_AXXX_CP_RB_BASE, lower_32_bits(gpu->rb[0]->iova));
649 ++
650 + /* setup access protection: */
651 + gpu_write(gpu, REG_A3XX_CP_PROTECT_CTRL, 0x00000007);
652 +
653 +diff --git a/drivers/gpu/drm/msm/adreno/a4xx_gpu.c b/drivers/gpu/drm/msm/adreno/a4xx_gpu.c
654 +index ab2b752566d81..05cfa81d4c540 100644
655 +--- a/drivers/gpu/drm/msm/adreno/a4xx_gpu.c
656 ++++ b/drivers/gpu/drm/msm/adreno/a4xx_gpu.c
657 +@@ -265,6 +265,16 @@ static int a4xx_hw_init(struct msm_gpu *gpu)
658 + if (ret)
659 + return ret;
660 +
661 ++ /*
662 ++ * Use the default ringbuffer size and block size but disable the RPTR
663 ++ * shadow
664 ++ */
665 ++ gpu_write(gpu, REG_A4XX_CP_RB_CNTL,
666 ++ MSM_GPU_RB_CNTL_DEFAULT | AXXX_CP_RB_CNTL_NO_UPDATE);
667 ++
668 ++ /* Set the ringbuffer address */
669 ++ gpu_write(gpu, REG_A4XX_CP_RB_BASE, lower_32_bits(gpu->rb[0]->iova));
670 ++
671 + /* Load PM4: */
672 + ptr = (uint32_t *)(adreno_gpu->fw[ADRENO_FW_PM4]->data);
673 + len = adreno_gpu->fw[ADRENO_FW_PM4]->size / 4;
674 +diff --git a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
675 +index 7829247de60e0..24b55103bfe00 100644
676 +--- a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
677 ++++ b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
678 +@@ -677,14 +677,21 @@ static int a5xx_hw_init(struct msm_gpu *gpu)
679 + if (ret)
680 + return ret;
681 +
682 +- a5xx_preempt_hw_init(gpu);
683 +-
684 + a5xx_gpmu_ucode_init(gpu);
685 +
686 + ret = a5xx_ucode_init(gpu);
687 + if (ret)
688 + return ret;
689 +
690 ++ /* Set the ringbuffer address */
691 ++ gpu_write64(gpu, REG_A5XX_CP_RB_BASE, REG_A5XX_CP_RB_BASE_HI,
692 ++ gpu->rb[0]->iova);
693 ++
694 ++ gpu_write(gpu, REG_A5XX_CP_RB_CNTL,
695 ++ MSM_GPU_RB_CNTL_DEFAULT | AXXX_CP_RB_CNTL_NO_UPDATE);
696 ++
697 ++ a5xx_preempt_hw_init(gpu);
698 ++
699 + /* Disable the interrupts through the initial bringup stage */
700 + gpu_write(gpu, REG_A5XX_RBBM_INT_0_MASK, A5XX_INT_MASK);
701 +
702 +@@ -1451,7 +1458,8 @@ struct msm_gpu *a5xx_gpu_init(struct drm_device *dev)
703 +
704 + check_speed_bin(&pdev->dev);
705 +
706 +- ret = adreno_gpu_init(dev, pdev, adreno_gpu, &funcs, 4);
707 ++ /* Restricting nr_rings to 1 to temporarily disable preemption */
708 ++ ret = adreno_gpu_init(dev, pdev, adreno_gpu, &funcs, 1);
709 + if (ret) {
710 + a5xx_destroy(&(a5xx_gpu->base.base));
711 + return ERR_PTR(ret);
712 +diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
713 +index be68d4e6551c2..ab75f0309d4b6 100644
714 +--- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
715 ++++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
716 +@@ -512,6 +512,13 @@ static int a6xx_hw_init(struct msm_gpu *gpu)
717 + if (ret)
718 + goto out;
719 +
720 ++ /* Set the ringbuffer address */
721 ++ gpu_write64(gpu, REG_A6XX_CP_RB_BASE, REG_A6XX_CP_RB_BASE_HI,
722 ++ gpu->rb[0]->iova);
723 ++
724 ++ gpu_write(gpu, REG_A6XX_CP_RB_CNTL,
725 ++ MSM_GPU_RB_CNTL_DEFAULT | AXXX_CP_RB_CNTL_NO_UPDATE);
726 ++
727 + /* Always come up on rb 0 */
728 + a6xx_gpu->cur_ring = gpu->rb[0];
729 +
730 +diff --git a/drivers/gpu/drm/msm/adreno/adreno_gpu.c b/drivers/gpu/drm/msm/adreno/adreno_gpu.c
731 +index 053da39da1cc0..3802ad38c519c 100644
732 +--- a/drivers/gpu/drm/msm/adreno/adreno_gpu.c
733 ++++ b/drivers/gpu/drm/msm/adreno/adreno_gpu.c
734 +@@ -354,26 +354,6 @@ int adreno_hw_init(struct msm_gpu *gpu)
735 + ring->memptrs->rptr = 0;
736 + }
737 +
738 +- /*
739 +- * Setup REG_CP_RB_CNTL. The same value is used across targets (with
740 +- * the excpetion of A430 that disables the RPTR shadow) - the cacluation
741 +- * for the ringbuffer size and block size is moved to msm_gpu.h for the
742 +- * pre-processor to deal with and the A430 variant is ORed in here
743 +- */
744 +- adreno_gpu_write(adreno_gpu, REG_ADRENO_CP_RB_CNTL,
745 +- MSM_GPU_RB_CNTL_DEFAULT |
746 +- (adreno_is_a430(adreno_gpu) ? AXXX_CP_RB_CNTL_NO_UPDATE : 0));
747 +-
748 +- /* Setup ringbuffer address - use ringbuffer[0] for GPU init */
749 +- adreno_gpu_write64(adreno_gpu, REG_ADRENO_CP_RB_BASE,
750 +- REG_ADRENO_CP_RB_BASE_HI, gpu->rb[0]->iova);
751 +-
752 +- if (!adreno_is_a430(adreno_gpu)) {
753 +- adreno_gpu_write64(adreno_gpu, REG_ADRENO_CP_RB_RPTR_ADDR,
754 +- REG_ADRENO_CP_RB_RPTR_ADDR_HI,
755 +- rbmemptr(gpu->rb[0], rptr));
756 +- }
757 +-
758 + return 0;
759 + }
760 +
761 +@@ -381,11 +361,8 @@ int adreno_hw_init(struct msm_gpu *gpu)
762 + static uint32_t get_rptr(struct adreno_gpu *adreno_gpu,
763 + struct msm_ringbuffer *ring)
764 + {
765 +- if (adreno_is_a430(adreno_gpu))
766 +- return ring->memptrs->rptr = adreno_gpu_read(
767 +- adreno_gpu, REG_ADRENO_CP_RB_RPTR);
768 +- else
769 +- return ring->memptrs->rptr;
770 ++ return ring->memptrs->rptr = adreno_gpu_read(
771 ++ adreno_gpu, REG_ADRENO_CP_RB_RPTR);
772 + }
773 +
774 + struct msm_ringbuffer *adreno_active_ring(struct msm_gpu *gpu)
775 +diff --git a/drivers/gpu/drm/msm/msm_ringbuffer.c b/drivers/gpu/drm/msm/msm_ringbuffer.c
776 +index e397c44cc0112..39ecb5a18431e 100644
777 +--- a/drivers/gpu/drm/msm/msm_ringbuffer.c
778 ++++ b/drivers/gpu/drm/msm/msm_ringbuffer.c
779 +@@ -27,7 +27,8 @@ struct msm_ringbuffer *msm_ringbuffer_new(struct msm_gpu *gpu, int id,
780 + ring->id = id;
781 +
782 + ring->start = msm_gem_kernel_new(gpu->dev, MSM_GPU_RINGBUFFER_SZ,
783 +- MSM_BO_WC, gpu->aspace, &ring->bo, &ring->iova);
784 ++ MSM_BO_WC | MSM_BO_GPU_READONLY, gpu->aspace, &ring->bo,
785 ++ &ring->iova);
786 +
787 + if (IS_ERR(ring->start)) {
788 + ret = PTR_ERR(ring->start);
789 +diff --git a/drivers/gpu/drm/sun4i/sun4i_backend.c b/drivers/gpu/drm/sun4i/sun4i_backend.c
790 +index 4e29f4fe4a05e..99f081ccc15de 100644
791 +--- a/drivers/gpu/drm/sun4i/sun4i_backend.c
792 ++++ b/drivers/gpu/drm/sun4i/sun4i_backend.c
793 +@@ -589,8 +589,7 @@ static int sun4i_backend_atomic_check(struct sunxi_engine *engine,
794 +
795 + /* We can't have an alpha plane at the lowest position */
796 + if (!backend->quirks->supports_lowest_plane_alpha &&
797 +- (plane_states[0]->fb->format->has_alpha ||
798 +- (plane_states[0]->alpha != DRM_BLEND_ALPHA_OPAQUE)))
799 ++ (plane_states[0]->alpha != DRM_BLEND_ALPHA_OPAQUE))
800 + return -EINVAL;
801 +
802 + for (i = 1; i < num_planes; i++) {
803 +@@ -986,7 +985,6 @@ static const struct sun4i_backend_quirks sun6i_backend_quirks = {
804 +
805 + static const struct sun4i_backend_quirks sun7i_backend_quirks = {
806 + .needs_output_muxing = true,
807 +- .supports_lowest_plane_alpha = true,
808 + };
809 +
810 + static const struct sun4i_backend_quirks sun8i_a33_backend_quirks = {
811 +diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c
812 +index 0f7eafedfe8f5..ae7ae432aa4ab 100644
813 +--- a/drivers/gpu/drm/sun4i/sun4i_tcon.c
814 ++++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c
815 +@@ -1409,14 +1409,18 @@ static int sun8i_r40_tcon_tv_set_mux(struct sun4i_tcon *tcon,
816 + if (IS_ENABLED(CONFIG_DRM_SUN8I_TCON_TOP) &&
817 + encoder->encoder_type == DRM_MODE_ENCODER_TMDS) {
818 + ret = sun8i_tcon_top_set_hdmi_src(&pdev->dev, id);
819 +- if (ret)
820 ++ if (ret) {
821 ++ put_device(&pdev->dev);
822 + return ret;
823 ++ }
824 + }
825 +
826 + if (IS_ENABLED(CONFIG_DRM_SUN8I_TCON_TOP)) {
827 + ret = sun8i_tcon_top_de_config(&pdev->dev, tcon->id, id);
828 +- if (ret)
829 ++ if (ret) {
830 ++ put_device(&pdev->dev);
831 + return ret;
832 ++ }
833 + }
834 +
835 + return 0;
836 +diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
837 +index 4f944ace665d5..f2b288037b909 100644
838 +--- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
839 ++++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
840 +@@ -867,7 +867,7 @@ static int sun6i_dsi_dcs_write_long(struct sun6i_dsi *dsi,
841 + regmap_write(dsi->regs, SUN6I_DSI_CMD_TX_REG(0),
842 + sun6i_dsi_dcs_build_pkt_hdr(dsi, msg));
843 +
844 +- bounce = kzalloc(msg->tx_len + sizeof(crc), GFP_KERNEL);
845 ++ bounce = kzalloc(ALIGN(msg->tx_len + sizeof(crc), 4), GFP_KERNEL);
846 + if (!bounce)
847 + return -ENOMEM;
848 +
849 +@@ -878,7 +878,7 @@ static int sun6i_dsi_dcs_write_long(struct sun6i_dsi *dsi,
850 + memcpy((u8 *)bounce + msg->tx_len, &crc, sizeof(crc));
851 + len += sizeof(crc);
852 +
853 +- regmap_bulk_write(dsi->regs, SUN6I_DSI_CMD_TX_REG(1), bounce, len);
854 ++ regmap_bulk_write(dsi->regs, SUN6I_DSI_CMD_TX_REG(1), bounce, DIV_ROUND_UP(len, 4));
855 + regmap_write(dsi->regs, SUN6I_DSI_CMD_CTL_REG, len + 4 - 1);
856 + kfree(bounce);
857 +
858 +diff --git a/drivers/gpu/drm/tve200/tve200_display.c b/drivers/gpu/drm/tve200/tve200_display.c
859 +index d733bbc4ac0e5..17ff24d999d18 100644
860 +--- a/drivers/gpu/drm/tve200/tve200_display.c
861 ++++ b/drivers/gpu/drm/tve200/tve200_display.c
862 +@@ -14,6 +14,7 @@
863 + #include <linux/version.h>
864 + #include <linux/dma-buf.h>
865 + #include <linux/of_graph.h>
866 ++#include <linux/delay.h>
867 +
868 + #include <drm/drm_fb_cma_helper.h>
869 + #include <drm/drm_fourcc.h>
870 +@@ -130,9 +131,25 @@ static void tve200_display_enable(struct drm_simple_display_pipe *pipe,
871 + struct drm_connector *connector = priv->connector;
872 + u32 format = fb->format->format;
873 + u32 ctrl1 = 0;
874 ++ int retries;
875 +
876 + clk_prepare_enable(priv->clk);
877 +
878 ++ /* Reset the TVE200 and wait for it to come back online */
879 ++ writel(TVE200_CTRL_4_RESET, priv->regs + TVE200_CTRL_4);
880 ++ for (retries = 0; retries < 5; retries++) {
881 ++ usleep_range(30000, 50000);
882 ++ if (readl(priv->regs + TVE200_CTRL_4) & TVE200_CTRL_4_RESET)
883 ++ continue;
884 ++ else
885 ++ break;
886 ++ }
887 ++ if (retries == 5 &&
888 ++ readl(priv->regs + TVE200_CTRL_4) & TVE200_CTRL_4_RESET) {
889 ++ dev_err(drm->dev, "can't get hardware out of reset\n");
890 ++ return;
891 ++ }
892 ++
893 + /* Function 1 */
894 + ctrl1 |= TVE200_CTRL_CSMODE;
895 + /* Interlace mode for CCIR656: parameterize? */
896 +@@ -230,8 +247,9 @@ static void tve200_display_disable(struct drm_simple_display_pipe *pipe)
897 +
898 + drm_crtc_vblank_off(crtc);
899 +
900 +- /* Disable and Power Down */
901 ++ /* Disable put into reset and Power Down */
902 + writel(0, priv->regs + TVE200_CTRL);
903 ++ writel(TVE200_CTRL_4_RESET, priv->regs + TVE200_CTRL_4);
904 +
905 + clk_disable_unprepare(priv->clk);
906 + }
907 +@@ -279,6 +297,8 @@ static int tve200_display_enable_vblank(struct drm_simple_display_pipe *pipe)
908 + struct drm_device *drm = crtc->dev;
909 + struct tve200_drm_dev_private *priv = drm->dev_private;
910 +
911 ++ /* Clear any IRQs and enable */
912 ++ writel(0xFF, priv->regs + TVE200_INT_CLR);
913 + writel(TVE200_INT_V_STATUS, priv->regs + TVE200_INT_EN);
914 + return 0;
915 + }
916 +diff --git a/drivers/hid/hid-elan.c b/drivers/hid/hid-elan.c
917 +index 45c4f888b7c4e..dae193749d443 100644
918 +--- a/drivers/hid/hid-elan.c
919 ++++ b/drivers/hid/hid-elan.c
920 +@@ -188,6 +188,7 @@ static int elan_input_configured(struct hid_device *hdev, struct hid_input *hi)
921 + ret = input_mt_init_slots(input, ELAN_MAX_FINGERS, INPUT_MT_POINTER);
922 + if (ret) {
923 + hid_err(hdev, "Failed to init elan MT slots: %d\n", ret);
924 ++ input_free_device(input);
925 + return ret;
926 + }
927 +
928 +@@ -198,6 +199,7 @@ static int elan_input_configured(struct hid_device *hdev, struct hid_input *hi)
929 + if (ret) {
930 + hid_err(hdev, "Failed to register elan input device: %d\n",
931 + ret);
932 ++ input_mt_destroy_slots(input);
933 + input_free_device(input);
934 + return ret;
935 + }
936 +diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
937 +index fbc93d8dda5ed..e03a4d794240c 100644
938 +--- a/drivers/hid/hid-ids.h
939 ++++ b/drivers/hid/hid-ids.h
940 +@@ -846,6 +846,7 @@
941 + #define USB_DEVICE_ID_MS_POWER_COVER 0x07da
942 + #define USB_DEVICE_ID_MS_XBOX_ONE_S_CONTROLLER 0x02fd
943 + #define USB_DEVICE_ID_MS_PIXART_MOUSE 0x00cb
944 ++#define USB_DEVICE_ID_8BITDO_SN30_PRO_PLUS 0x02e0
945 +
946 + #define USB_VENDOR_ID_MOJO 0x8282
947 + #define USB_DEVICE_ID_RETRO_ADAPTER 0x3201
948 +@@ -1011,6 +1012,8 @@
949 + #define USB_DEVICE_ID_SAITEK_RAT9 0x0cfa
950 + #define USB_DEVICE_ID_SAITEK_MMO7 0x0cd0
951 + #define USB_DEVICE_ID_SAITEK_X52 0x075c
952 ++#define USB_DEVICE_ID_SAITEK_X52_2 0x0255
953 ++#define USB_DEVICE_ID_SAITEK_X52_PRO 0x0762
954 +
955 + #define USB_VENDOR_ID_SAMSUNG 0x0419
956 + #define USB_DEVICE_ID_SAMSUNG_IR_REMOTE 0x0001
957 +diff --git a/drivers/hid/hid-microsoft.c b/drivers/hid/hid-microsoft.c
958 +index 2d8b589201a4e..8cb1ca1936e42 100644
959 +--- a/drivers/hid/hid-microsoft.c
960 ++++ b/drivers/hid/hid-microsoft.c
961 +@@ -451,6 +451,8 @@ static const struct hid_device_id ms_devices[] = {
962 + .driver_data = MS_SURFACE_DIAL },
963 + { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_XBOX_ONE_S_CONTROLLER),
964 + .driver_data = MS_QUIRK_FF },
965 ++ { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_8BITDO_SN30_PRO_PLUS),
966 ++ .driver_data = MS_QUIRK_FF },
967 + { }
968 + };
969 + MODULE_DEVICE_TABLE(hid, ms_devices);
970 +diff --git a/drivers/hid/hid-quirks.c b/drivers/hid/hid-quirks.c
971 +index 8a739ec50cc00..0440e2f6e8a3c 100644
972 +--- a/drivers/hid/hid-quirks.c
973 ++++ b/drivers/hid/hid-quirks.c
974 +@@ -150,6 +150,8 @@ static const struct hid_device_id hid_quirks[] = {
975 + { HID_USB_DEVICE(USB_VENDOR_ID_RETROUSB, USB_DEVICE_ID_RETROUSB_SNES_RETROPORT), HID_QUIRK_INCREMENT_USAGE_ON_DUPLICATE },
976 + { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_RUMBLEPAD), HID_QUIRK_BADPAD },
977 + { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_X52), HID_QUIRK_INCREMENT_USAGE_ON_DUPLICATE },
978 ++ { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_X52_2), HID_QUIRK_INCREMENT_USAGE_ON_DUPLICATE },
979 ++ { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_X52_PRO), HID_QUIRK_INCREMENT_USAGE_ON_DUPLICATE },
980 + { HID_USB_DEVICE(USB_VENDOR_ID_SEMICO, USB_DEVICE_ID_SEMICO_USB_KEYKOARD2), HID_QUIRK_NO_INIT_REPORTS },
981 + { HID_USB_DEVICE(USB_VENDOR_ID_SEMICO, USB_DEVICE_ID_SEMICO_USB_KEYKOARD), HID_QUIRK_NO_INIT_REPORTS },
982 + { HID_USB_DEVICE(USB_VENDOR_ID_SENNHEISER, USB_DEVICE_ID_SENNHEISER_BTD500USB), HID_QUIRK_NOGET },
983 +diff --git a/drivers/iio/accel/bmc150-accel-core.c b/drivers/iio/accel/bmc150-accel-core.c
984 +index 121b4e89f038c..bcdf25f32e220 100644
985 +--- a/drivers/iio/accel/bmc150-accel-core.c
986 ++++ b/drivers/iio/accel/bmc150-accel-core.c
987 +@@ -189,6 +189,14 @@ struct bmc150_accel_data {
988 + struct mutex mutex;
989 + u8 fifo_mode, watermark;
990 + s16 buffer[8];
991 ++ /*
992 ++ * Ensure there is sufficient space and correct alignment for
993 ++ * the timestamp if enabled
994 ++ */
995 ++ struct {
996 ++ __le16 channels[3];
997 ++ s64 ts __aligned(8);
998 ++ } scan;
999 + u8 bw_bits;
1000 + u32 slope_dur;
1001 + u32 slope_thres;
1002 +@@ -922,15 +930,16 @@ static int __bmc150_accel_fifo_flush(struct iio_dev *indio_dev,
1003 + * now.
1004 + */
1005 + for (i = 0; i < count; i++) {
1006 +- u16 sample[8];
1007 + int j, bit;
1008 +
1009 + j = 0;
1010 + for_each_set_bit(bit, indio_dev->active_scan_mask,
1011 + indio_dev->masklength)
1012 +- memcpy(&sample[j++], &buffer[i * 3 + bit], 2);
1013 ++ memcpy(&data->scan.channels[j++], &buffer[i * 3 + bit],
1014 ++ sizeof(data->scan.channels[0]));
1015 +
1016 +- iio_push_to_buffers_with_timestamp(indio_dev, sample, tstamp);
1017 ++ iio_push_to_buffers_with_timestamp(indio_dev, &data->scan,
1018 ++ tstamp);
1019 +
1020 + tstamp += sample_period;
1021 + }
1022 +diff --git a/drivers/iio/accel/kxsd9.c b/drivers/iio/accel/kxsd9.c
1023 +index 0b876b2dc5bd4..76429e2a6fb8f 100644
1024 +--- a/drivers/iio/accel/kxsd9.c
1025 ++++ b/drivers/iio/accel/kxsd9.c
1026 +@@ -209,14 +209,20 @@ static irqreturn_t kxsd9_trigger_handler(int irq, void *p)
1027 + const struct iio_poll_func *pf = p;
1028 + struct iio_dev *indio_dev = pf->indio_dev;
1029 + struct kxsd9_state *st = iio_priv(indio_dev);
1030 ++ /*
1031 ++ * Ensure correct positioning and alignment of timestamp.
1032 ++ * No need to zero initialize as all elements written.
1033 ++ */
1034 ++ struct {
1035 ++ __be16 chan[4];
1036 ++ s64 ts __aligned(8);
1037 ++ } hw_values;
1038 + int ret;
1039 +- /* 4 * 16bit values AND timestamp */
1040 +- __be16 hw_values[8];
1041 +
1042 + ret = regmap_bulk_read(st->map,
1043 + KXSD9_REG_X,
1044 +- &hw_values,
1045 +- 8);
1046 ++ hw_values.chan,
1047 ++ sizeof(hw_values.chan));
1048 + if (ret) {
1049 + dev_err(st->dev,
1050 + "error reading data\n");
1051 +@@ -224,7 +230,7 @@ static irqreturn_t kxsd9_trigger_handler(int irq, void *p)
1052 + }
1053 +
1054 + iio_push_to_buffers_with_timestamp(indio_dev,
1055 +- hw_values,
1056 ++ &hw_values,
1057 + iio_get_time_ns(indio_dev));
1058 + iio_trigger_notify_done(indio_dev->trig);
1059 +
1060 +diff --git a/drivers/iio/accel/mma7455_core.c b/drivers/iio/accel/mma7455_core.c
1061 +index 8b5a6aff9bf4b..70ec3490bdb85 100644
1062 +--- a/drivers/iio/accel/mma7455_core.c
1063 ++++ b/drivers/iio/accel/mma7455_core.c
1064 +@@ -52,6 +52,14 @@
1065 +
1066 + struct mma7455_data {
1067 + struct regmap *regmap;
1068 ++ /*
1069 ++ * Used to reorganize data. Will ensure correct alignment of
1070 ++ * the timestamp if present
1071 ++ */
1072 ++ struct {
1073 ++ __le16 channels[3];
1074 ++ s64 ts __aligned(8);
1075 ++ } scan;
1076 + };
1077 +
1078 + static int mma7455_drdy(struct mma7455_data *mma7455)
1079 +@@ -82,19 +90,19 @@ static irqreturn_t mma7455_trigger_handler(int irq, void *p)
1080 + struct iio_poll_func *pf = p;
1081 + struct iio_dev *indio_dev = pf->indio_dev;
1082 + struct mma7455_data *mma7455 = iio_priv(indio_dev);
1083 +- u8 buf[16]; /* 3 x 16-bit channels + padding + ts */
1084 + int ret;
1085 +
1086 + ret = mma7455_drdy(mma7455);
1087 + if (ret)
1088 + goto done;
1089 +
1090 +- ret = regmap_bulk_read(mma7455->regmap, MMA7455_REG_XOUTL, buf,
1091 +- sizeof(__le16) * 3);
1092 ++ ret = regmap_bulk_read(mma7455->regmap, MMA7455_REG_XOUTL,
1093 ++ mma7455->scan.channels,
1094 ++ sizeof(mma7455->scan.channels));
1095 + if (ret)
1096 + goto done;
1097 +
1098 +- iio_push_to_buffers_with_timestamp(indio_dev, buf,
1099 ++ iio_push_to_buffers_with_timestamp(indio_dev, &mma7455->scan,
1100 + iio_get_time_ns(indio_dev));
1101 +
1102 + done:
1103 +diff --git a/drivers/iio/accel/mma8452.c b/drivers/iio/accel/mma8452.c
1104 +index 813bca7cfc3ed..85d453b3f5ec1 100644
1105 +--- a/drivers/iio/accel/mma8452.c
1106 ++++ b/drivers/iio/accel/mma8452.c
1107 +@@ -110,6 +110,12 @@ struct mma8452_data {
1108 + int sleep_val;
1109 + struct regulator *vdd_reg;
1110 + struct regulator *vddio_reg;
1111 ++
1112 ++ /* Ensure correct alignment of time stamp when present */
1113 ++ struct {
1114 ++ __be16 channels[3];
1115 ++ s64 ts __aligned(8);
1116 ++ } buffer;
1117 + };
1118 +
1119 + /**
1120 +@@ -1091,14 +1097,13 @@ static irqreturn_t mma8452_trigger_handler(int irq, void *p)
1121 + struct iio_poll_func *pf = p;
1122 + struct iio_dev *indio_dev = pf->indio_dev;
1123 + struct mma8452_data *data = iio_priv(indio_dev);
1124 +- u8 buffer[16]; /* 3 16-bit channels + padding + ts */
1125 + int ret;
1126 +
1127 +- ret = mma8452_read(data, (__be16 *)buffer);
1128 ++ ret = mma8452_read(data, data->buffer.channels);
1129 + if (ret < 0)
1130 + goto done;
1131 +
1132 +- iio_push_to_buffers_with_timestamp(indio_dev, buffer,
1133 ++ iio_push_to_buffers_with_timestamp(indio_dev, &data->buffer,
1134 + iio_get_time_ns(indio_dev));
1135 +
1136 + done:
1137 +diff --git a/drivers/iio/adc/ina2xx-adc.c b/drivers/iio/adc/ina2xx-adc.c
1138 +index bdd7cba6f6b0b..d3e9ec00ef959 100644
1139 +--- a/drivers/iio/adc/ina2xx-adc.c
1140 ++++ b/drivers/iio/adc/ina2xx-adc.c
1141 +@@ -146,6 +146,11 @@ struct ina2xx_chip_info {
1142 + int range_vbus; /* Bus voltage maximum in V */
1143 + int pga_gain_vshunt; /* Shunt voltage PGA gain */
1144 + bool allow_async_readout;
1145 ++ /* data buffer needs space for channel data and timestamp */
1146 ++ struct {
1147 ++ u16 chan[4];
1148 ++ u64 ts __aligned(8);
1149 ++ } scan;
1150 + };
1151 +
1152 + static const struct ina2xx_config ina2xx_config[] = {
1153 +@@ -738,8 +743,6 @@ static int ina2xx_conversion_ready(struct iio_dev *indio_dev)
1154 + static int ina2xx_work_buffer(struct iio_dev *indio_dev)
1155 + {
1156 + struct ina2xx_chip_info *chip = iio_priv(indio_dev);
1157 +- /* data buffer needs space for channel data and timestap */
1158 +- unsigned short data[4 + sizeof(s64)/sizeof(short)];
1159 + int bit, ret, i = 0;
1160 + s64 time;
1161 +
1162 +@@ -758,10 +761,10 @@ static int ina2xx_work_buffer(struct iio_dev *indio_dev)
1163 + if (ret < 0)
1164 + return ret;
1165 +
1166 +- data[i++] = val;
1167 ++ chip->scan.chan[i++] = val;
1168 + }
1169 +
1170 +- iio_push_to_buffers_with_timestamp(indio_dev, data, time);
1171 ++ iio_push_to_buffers_with_timestamp(indio_dev, &chip->scan, time);
1172 +
1173 + return 0;
1174 + };
1175 +diff --git a/drivers/iio/adc/max1118.c b/drivers/iio/adc/max1118.c
1176 +index 3b6f3b9a6c5ba..a1b66f92e1bff 100644
1177 +--- a/drivers/iio/adc/max1118.c
1178 ++++ b/drivers/iio/adc/max1118.c
1179 +@@ -35,6 +35,11 @@ struct max1118 {
1180 + struct spi_device *spi;
1181 + struct mutex lock;
1182 + struct regulator *reg;
1183 ++ /* Ensure natural alignment of buffer elements */
1184 ++ struct {
1185 ++ u8 channels[2];
1186 ++ s64 ts __aligned(8);
1187 ++ } scan;
1188 +
1189 + u8 data ____cacheline_aligned;
1190 + };
1191 +@@ -159,7 +164,6 @@ static irqreturn_t max1118_trigger_handler(int irq, void *p)
1192 + struct iio_poll_func *pf = p;
1193 + struct iio_dev *indio_dev = pf->indio_dev;
1194 + struct max1118 *adc = iio_priv(indio_dev);
1195 +- u8 data[16] = { }; /* 2x 8-bit ADC data + padding + 8 bytes timestamp */
1196 + int scan_index;
1197 + int i = 0;
1198 +
1199 +@@ -177,10 +181,10 @@ static irqreturn_t max1118_trigger_handler(int irq, void *p)
1200 + goto out;
1201 + }
1202 +
1203 +- data[i] = ret;
1204 ++ adc->scan.channels[i] = ret;
1205 + i++;
1206 + }
1207 +- iio_push_to_buffers_with_timestamp(indio_dev, data,
1208 ++ iio_push_to_buffers_with_timestamp(indio_dev, &adc->scan,
1209 + iio_get_time_ns(indio_dev));
1210 + out:
1211 + mutex_unlock(&adc->lock);
1212 +diff --git a/drivers/iio/adc/mcp3422.c b/drivers/iio/adc/mcp3422.c
1213 +index ea24d7c58b127..8ae4cf1351579 100644
1214 +--- a/drivers/iio/adc/mcp3422.c
1215 ++++ b/drivers/iio/adc/mcp3422.c
1216 +@@ -95,16 +95,12 @@ static int mcp3422_update_config(struct mcp3422 *adc, u8 newconfig)
1217 + {
1218 + int ret;
1219 +
1220 +- mutex_lock(&adc->lock);
1221 +-
1222 + ret = i2c_master_send(adc->i2c, &newconfig, 1);
1223 + if (ret > 0) {
1224 + adc->config = newconfig;
1225 + ret = 0;
1226 + }
1227 +
1228 +- mutex_unlock(&adc->lock);
1229 +-
1230 + return ret;
1231 + }
1232 +
1233 +@@ -137,6 +133,8 @@ static int mcp3422_read_channel(struct mcp3422 *adc,
1234 + u8 config;
1235 + u8 req_channel = channel->channel;
1236 +
1237 ++ mutex_lock(&adc->lock);
1238 ++
1239 + if (req_channel != MCP3422_CHANNEL(adc->config)) {
1240 + config = adc->config;
1241 + config &= ~MCP3422_CHANNEL_MASK;
1242 +@@ -144,12 +142,18 @@ static int mcp3422_read_channel(struct mcp3422 *adc,
1243 + config &= ~MCP3422_PGA_MASK;
1244 + config |= MCP3422_PGA_VALUE(adc->pga[req_channel]);
1245 + ret = mcp3422_update_config(adc, config);
1246 +- if (ret < 0)
1247 ++ if (ret < 0) {
1248 ++ mutex_unlock(&adc->lock);
1249 + return ret;
1250 ++ }
1251 + msleep(mcp3422_read_times[MCP3422_SAMPLE_RATE(adc->config)]);
1252 + }
1253 +
1254 +- return mcp3422_read(adc, value, &config);
1255 ++ ret = mcp3422_read(adc, value, &config);
1256 ++
1257 ++ mutex_unlock(&adc->lock);
1258 ++
1259 ++ return ret;
1260 + }
1261 +
1262 + static int mcp3422_read_raw(struct iio_dev *iio,
1263 +diff --git a/drivers/iio/adc/ti-adc081c.c b/drivers/iio/adc/ti-adc081c.c
1264 +index 0235863ff77b0..cc8cbffe2b7b5 100644
1265 +--- a/drivers/iio/adc/ti-adc081c.c
1266 ++++ b/drivers/iio/adc/ti-adc081c.c
1267 +@@ -33,6 +33,12 @@ struct adc081c {
1268 +
1269 + /* 8, 10 or 12 */
1270 + int bits;
1271 ++
1272 ++ /* Ensure natural alignment of buffer elements */
1273 ++ struct {
1274 ++ u16 channel;
1275 ++ s64 ts __aligned(8);
1276 ++ } scan;
1277 + };
1278 +
1279 + #define REG_CONV_RES 0x00
1280 +@@ -128,14 +134,13 @@ static irqreturn_t adc081c_trigger_handler(int irq, void *p)
1281 + struct iio_poll_func *pf = p;
1282 + struct iio_dev *indio_dev = pf->indio_dev;
1283 + struct adc081c *data = iio_priv(indio_dev);
1284 +- u16 buf[8]; /* 2 bytes data + 6 bytes padding + 8 bytes timestamp */
1285 + int ret;
1286 +
1287 + ret = i2c_smbus_read_word_swapped(data->i2c, REG_CONV_RES);
1288 + if (ret < 0)
1289 + goto out;
1290 +- buf[0] = ret;
1291 +- iio_push_to_buffers_with_timestamp(indio_dev, buf,
1292 ++ data->scan.channel = ret;
1293 ++ iio_push_to_buffers_with_timestamp(indio_dev, &data->scan,
1294 + iio_get_time_ns(indio_dev));
1295 + out:
1296 + iio_trigger_notify_done(indio_dev->trig);
1297 +diff --git a/drivers/iio/adc/ti-adc084s021.c b/drivers/iio/adc/ti-adc084s021.c
1298 +index bdedf456ee05d..fc053216d282c 100644
1299 +--- a/drivers/iio/adc/ti-adc084s021.c
1300 ++++ b/drivers/iio/adc/ti-adc084s021.c
1301 +@@ -25,6 +25,11 @@ struct adc084s021 {
1302 + struct spi_transfer spi_trans;
1303 + struct regulator *reg;
1304 + struct mutex lock;
1305 ++ /* Buffer used to align data */
1306 ++ struct {
1307 ++ __be16 channels[4];
1308 ++ s64 ts __aligned(8);
1309 ++ } scan;
1310 + /*
1311 + * DMA (thus cache coherency maintenance) requires the
1312 + * transfer buffers to live in their own cache line.
1313 +@@ -140,14 +145,13 @@ static irqreturn_t adc084s021_buffer_trigger_handler(int irq, void *pollfunc)
1314 + struct iio_poll_func *pf = pollfunc;
1315 + struct iio_dev *indio_dev = pf->indio_dev;
1316 + struct adc084s021 *adc = iio_priv(indio_dev);
1317 +- __be16 data[8] = {0}; /* 4 * 16-bit words of data + 8 bytes timestamp */
1318 +
1319 + mutex_lock(&adc->lock);
1320 +
1321 +- if (adc084s021_adc_conversion(adc, &data) < 0)
1322 ++ if (adc084s021_adc_conversion(adc, adc->scan.channels) < 0)
1323 + dev_err(&adc->spi->dev, "Failed to read data\n");
1324 +
1325 +- iio_push_to_buffers_with_timestamp(indio_dev, data,
1326 ++ iio_push_to_buffers_with_timestamp(indio_dev, &adc->scan,
1327 + iio_get_time_ns(indio_dev));
1328 + mutex_unlock(&adc->lock);
1329 + iio_trigger_notify_done(indio_dev->trig);
1330 +diff --git a/drivers/iio/adc/ti-ads1015.c b/drivers/iio/adc/ti-ads1015.c
1331 +index a550b132cfb73..871690a476610 100644
1332 +--- a/drivers/iio/adc/ti-ads1015.c
1333 ++++ b/drivers/iio/adc/ti-ads1015.c
1334 +@@ -309,6 +309,7 @@ static const struct iio_chan_spec ads1115_channels[] = {
1335 + IIO_CHAN_SOFT_TIMESTAMP(ADS1015_TIMESTAMP),
1336 + };
1337 +
1338 ++#ifdef CONFIG_PM
1339 + static int ads1015_set_power_state(struct ads1015_data *data, bool on)
1340 + {
1341 + int ret;
1342 +@@ -326,6 +327,15 @@ static int ads1015_set_power_state(struct ads1015_data *data, bool on)
1343 + return ret < 0 ? ret : 0;
1344 + }
1345 +
1346 ++#else /* !CONFIG_PM */
1347 ++
1348 ++static int ads1015_set_power_state(struct ads1015_data *data, bool on)
1349 ++{
1350 ++ return 0;
1351 ++}
1352 ++
1353 ++#endif /* !CONFIG_PM */
1354 ++
1355 + static
1356 + int ads1015_get_adc_result(struct ads1015_data *data, int chan, int *val)
1357 + {
1358 +diff --git a/drivers/iio/chemical/ccs811.c b/drivers/iio/chemical/ccs811.c
1359 +index 2ebdfc35bcda6..7bf4e9a16a6ae 100644
1360 +--- a/drivers/iio/chemical/ccs811.c
1361 ++++ b/drivers/iio/chemical/ccs811.c
1362 +@@ -75,6 +75,11 @@ struct ccs811_data {
1363 + struct ccs811_reading buffer;
1364 + struct iio_trigger *drdy_trig;
1365 + bool drdy_trig_on;
1366 ++ /* Ensures correct alignment of timestamp if present */
1367 ++ struct {
1368 ++ s16 channels[2];
1369 ++ s64 ts __aligned(8);
1370 ++ } scan;
1371 + };
1372 +
1373 + static const struct iio_chan_spec ccs811_channels[] = {
1374 +@@ -306,17 +311,17 @@ static irqreturn_t ccs811_trigger_handler(int irq, void *p)
1375 + struct iio_dev *indio_dev = pf->indio_dev;
1376 + struct ccs811_data *data = iio_priv(indio_dev);
1377 + struct i2c_client *client = data->client;
1378 +- s16 buf[8]; /* s16 eCO2 + s16 TVOC + padding + 8 byte timestamp */
1379 + int ret;
1380 +
1381 +- ret = i2c_smbus_read_i2c_block_data(client, CCS811_ALG_RESULT_DATA, 4,
1382 +- (u8 *)&buf);
1383 ++ ret = i2c_smbus_read_i2c_block_data(client, CCS811_ALG_RESULT_DATA,
1384 ++ sizeof(data->scan.channels),
1385 ++ (u8 *)data->scan.channels);
1386 + if (ret != 4) {
1387 + dev_err(&client->dev, "cannot read sensor data\n");
1388 + goto err;
1389 + }
1390 +
1391 +- iio_push_to_buffers_with_timestamp(indio_dev, buf,
1392 ++ iio_push_to_buffers_with_timestamp(indio_dev, &data->scan,
1393 + iio_get_time_ns(indio_dev));
1394 +
1395 + err:
1396 +diff --git a/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c b/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c
1397 +index d2609e6feda4d..b4f394f058636 100644
1398 +--- a/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c
1399 ++++ b/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c
1400 +@@ -57,10 +57,13 @@ static void get_default_min_max_freq(enum motionsensor_type type,
1401 + {
1402 + switch (type) {
1403 + case MOTIONSENSE_TYPE_ACCEL:
1404 +- case MOTIONSENSE_TYPE_GYRO:
1405 + *min_freq = 12500;
1406 + *max_freq = 100000;
1407 + break;
1408 ++ case MOTIONSENSE_TYPE_GYRO:
1409 ++ *min_freq = 25000;
1410 ++ *max_freq = 100000;
1411 ++ break;
1412 + case MOTIONSENSE_TYPE_MAG:
1413 + *min_freq = 5000;
1414 + *max_freq = 25000;
1415 +diff --git a/drivers/iio/light/ltr501.c b/drivers/iio/light/ltr501.c
1416 +index 71f99d2a22c1d..ceddb6a3b61bb 100644
1417 +--- a/drivers/iio/light/ltr501.c
1418 ++++ b/drivers/iio/light/ltr501.c
1419 +@@ -1242,13 +1242,16 @@ static irqreturn_t ltr501_trigger_handler(int irq, void *p)
1420 + struct iio_poll_func *pf = p;
1421 + struct iio_dev *indio_dev = pf->indio_dev;
1422 + struct ltr501_data *data = iio_priv(indio_dev);
1423 +- u16 buf[8];
1424 ++ struct {
1425 ++ u16 channels[3];
1426 ++ s64 ts __aligned(8);
1427 ++ } scan;
1428 + __le16 als_buf[2];
1429 + u8 mask = 0;
1430 + int j = 0;
1431 + int ret, psdata;
1432 +
1433 +- memset(buf, 0, sizeof(buf));
1434 ++ memset(&scan, 0, sizeof(scan));
1435 +
1436 + /* figure out which data needs to be ready */
1437 + if (test_bit(0, indio_dev->active_scan_mask) ||
1438 +@@ -1267,9 +1270,9 @@ static irqreturn_t ltr501_trigger_handler(int irq, void *p)
1439 + if (ret < 0)
1440 + return ret;
1441 + if (test_bit(0, indio_dev->active_scan_mask))
1442 +- buf[j++] = le16_to_cpu(als_buf[1]);
1443 ++ scan.channels[j++] = le16_to_cpu(als_buf[1]);
1444 + if (test_bit(1, indio_dev->active_scan_mask))
1445 +- buf[j++] = le16_to_cpu(als_buf[0]);
1446 ++ scan.channels[j++] = le16_to_cpu(als_buf[0]);
1447 + }
1448 +
1449 + if (mask & LTR501_STATUS_PS_RDY) {
1450 +@@ -1277,10 +1280,10 @@ static irqreturn_t ltr501_trigger_handler(int irq, void *p)
1451 + &psdata, 2);
1452 + if (ret < 0)
1453 + goto done;
1454 +- buf[j++] = psdata & LTR501_PS_DATA_MASK;
1455 ++ scan.channels[j++] = psdata & LTR501_PS_DATA_MASK;
1456 + }
1457 +
1458 +- iio_push_to_buffers_with_timestamp(indio_dev, buf,
1459 ++ iio_push_to_buffers_with_timestamp(indio_dev, &scan,
1460 + iio_get_time_ns(indio_dev));
1461 +
1462 + done:
1463 +diff --git a/drivers/iio/light/max44000.c b/drivers/iio/light/max44000.c
1464 +index d6d8007ba430a..8cc619de2c3ae 100644
1465 +--- a/drivers/iio/light/max44000.c
1466 ++++ b/drivers/iio/light/max44000.c
1467 +@@ -75,6 +75,11 @@
1468 + struct max44000_data {
1469 + struct mutex lock;
1470 + struct regmap *regmap;
1471 ++ /* Ensure naturally aligned timestamp */
1472 ++ struct {
1473 ++ u16 channels[2];
1474 ++ s64 ts __aligned(8);
1475 ++ } scan;
1476 + };
1477 +
1478 + /* Default scale is set to the minimum of 0.03125 or 1 / (1 << 5) lux */
1479 +@@ -488,7 +493,6 @@ static irqreturn_t max44000_trigger_handler(int irq, void *p)
1480 + struct iio_poll_func *pf = p;
1481 + struct iio_dev *indio_dev = pf->indio_dev;
1482 + struct max44000_data *data = iio_priv(indio_dev);
1483 +- u16 buf[8]; /* 2x u16 + padding + 8 bytes timestamp */
1484 + int index = 0;
1485 + unsigned int regval;
1486 + int ret;
1487 +@@ -498,17 +502,17 @@ static irqreturn_t max44000_trigger_handler(int irq, void *p)
1488 + ret = max44000_read_alsval(data);
1489 + if (ret < 0)
1490 + goto out_unlock;
1491 +- buf[index++] = ret;
1492 ++ data->scan.channels[index++] = ret;
1493 + }
1494 + if (test_bit(MAX44000_SCAN_INDEX_PRX, indio_dev->active_scan_mask)) {
1495 + ret = regmap_read(data->regmap, MAX44000_REG_PRX_DATA, &regval);
1496 + if (ret < 0)
1497 + goto out_unlock;
1498 +- buf[index] = regval;
1499 ++ data->scan.channels[index] = regval;
1500 + }
1501 + mutex_unlock(&data->lock);
1502 +
1503 +- iio_push_to_buffers_with_timestamp(indio_dev, buf,
1504 ++ iio_push_to_buffers_with_timestamp(indio_dev, &data->scan,
1505 + iio_get_time_ns(indio_dev));
1506 + iio_trigger_notify_done(indio_dev->trig);
1507 + return IRQ_HANDLED;
1508 +diff --git a/drivers/iio/magnetometer/ak8975.c b/drivers/iio/magnetometer/ak8975.c
1509 +index 893bec5a0312b..82af903a765b2 100644
1510 +--- a/drivers/iio/magnetometer/ak8975.c
1511 ++++ b/drivers/iio/magnetometer/ak8975.c
1512 +@@ -368,6 +368,12 @@ struct ak8975_data {
1513 + struct iio_mount_matrix orientation;
1514 + struct regulator *vdd;
1515 + struct regulator *vid;
1516 ++
1517 ++ /* Ensure natural alignment of timestamp */
1518 ++ struct {
1519 ++ s16 channels[3];
1520 ++ s64 ts __aligned(8);
1521 ++ } scan;
1522 + };
1523 +
1524 + /* Enable attached power regulator if any. */
1525 +@@ -805,7 +811,6 @@ static void ak8975_fill_buffer(struct iio_dev *indio_dev)
1526 + const struct i2c_client *client = data->client;
1527 + const struct ak_def *def = data->def;
1528 + int ret;
1529 +- s16 buff[8]; /* 3 x 16 bits axis values + 1 aligned 64 bits timestamp */
1530 + __le16 fval[3];
1531 +
1532 + mutex_lock(&data->lock);
1533 +@@ -828,12 +833,13 @@ static void ak8975_fill_buffer(struct iio_dev *indio_dev)
1534 + mutex_unlock(&data->lock);
1535 +
1536 + /* Clamp to valid range. */
1537 +- buff[0] = clamp_t(s16, le16_to_cpu(fval[0]), -def->range, def->range);
1538 +- buff[1] = clamp_t(s16, le16_to_cpu(fval[1]), -def->range, def->range);
1539 +- buff[2] = clamp_t(s16, le16_to_cpu(fval[2]), -def->range, def->range);
1540 ++ data->scan.channels[0] = clamp_t(s16, le16_to_cpu(fval[0]), -def->range, def->range);
1541 ++ data->scan.channels[1] = clamp_t(s16, le16_to_cpu(fval[1]), -def->range, def->range);
1542 ++ data->scan.channels[2] = clamp_t(s16, le16_to_cpu(fval[2]), -def->range, def->range);
1543 +
1544 +- iio_push_to_buffers_with_timestamp(indio_dev, buff,
1545 ++ iio_push_to_buffers_with_timestamp(indio_dev, &data->scan,
1546 + iio_get_time_ns(indio_dev));
1547 ++
1548 + return;
1549 +
1550 + unlock:
1551 +diff --git a/drivers/iio/proximity/mb1232.c b/drivers/iio/proximity/mb1232.c
1552 +index 166b3e6d7db89..5254b1fbccfdc 100644
1553 +--- a/drivers/iio/proximity/mb1232.c
1554 ++++ b/drivers/iio/proximity/mb1232.c
1555 +@@ -40,6 +40,11 @@ struct mb1232_data {
1556 + */
1557 + struct completion ranging;
1558 + int irqnr;
1559 ++ /* Ensure correct alignment of data to push to IIO buffer */
1560 ++ struct {
1561 ++ s16 distance;
1562 ++ s64 ts __aligned(8);
1563 ++ } scan;
1564 + };
1565 +
1566 + static irqreturn_t mb1232_handle_irq(int irq, void *dev_id)
1567 +@@ -113,17 +118,13 @@ static irqreturn_t mb1232_trigger_handler(int irq, void *p)
1568 + struct iio_poll_func *pf = p;
1569 + struct iio_dev *indio_dev = pf->indio_dev;
1570 + struct mb1232_data *data = iio_priv(indio_dev);
1571 +- /*
1572 +- * triggered buffer
1573 +- * 16-bit channel + 48-bit padding + 64-bit timestamp
1574 +- */
1575 +- s16 buffer[8] = { 0 };
1576 +
1577 +- buffer[0] = mb1232_read_distance(data);
1578 +- if (buffer[0] < 0)
1579 ++ data->scan.distance = mb1232_read_distance(data);
1580 ++ if (data->scan.distance < 0)
1581 + goto err;
1582 +
1583 +- iio_push_to_buffers_with_timestamp(indio_dev, buffer, pf->timestamp);
1584 ++ iio_push_to_buffers_with_timestamp(indio_dev, &data->scan,
1585 ++ pf->timestamp);
1586 +
1587 + err:
1588 + iio_trigger_notify_done(indio_dev->trig);
1589 +diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c
1590 +index d4815f29cfd24..5d896f6b2b617 100644
1591 +--- a/drivers/infiniband/core/verbs.c
1592 ++++ b/drivers/infiniband/core/verbs.c
1593 +@@ -1749,7 +1749,7 @@ int ib_get_eth_speed(struct ib_device *dev, u8 port_num, u8 *speed, u8 *width)
1594 +
1595 + dev_put(netdev);
1596 +
1597 +- if (!rc) {
1598 ++ if (!rc && lksettings.base.speed != (u32)SPEED_UNKNOWN) {
1599 + netdev_speed = lksettings.base.speed;
1600 + } else {
1601 + netdev_speed = SPEED_1000;
1602 +diff --git a/drivers/infiniband/hw/bnxt_re/ib_verbs.c b/drivers/infiniband/hw/bnxt_re/ib_verbs.c
1603 +index ebc3e3d4a6e2a..3b05c0640338f 100644
1604 +--- a/drivers/infiniband/hw/bnxt_re/ib_verbs.c
1605 ++++ b/drivers/infiniband/hw/bnxt_re/ib_verbs.c
1606 +@@ -2973,6 +2973,19 @@ static void bnxt_re_process_res_rawqp1_wc(struct ib_wc *wc,
1607 + wc->wc_flags |= IB_WC_GRH;
1608 + }
1609 +
1610 ++static bool bnxt_re_check_if_vlan_valid(struct bnxt_re_dev *rdev,
1611 ++ u16 vlan_id)
1612 ++{
1613 ++ /*
1614 ++ * Check if the vlan is configured in the host. If not configured, it
1615 ++ * can be a transparent VLAN. So dont report the vlan id.
1616 ++ */
1617 ++ if (!__vlan_find_dev_deep_rcu(rdev->netdev,
1618 ++ htons(ETH_P_8021Q), vlan_id))
1619 ++ return false;
1620 ++ return true;
1621 ++}
1622 ++
1623 + static bool bnxt_re_is_vlan_pkt(struct bnxt_qplib_cqe *orig_cqe,
1624 + u16 *vid, u8 *sl)
1625 + {
1626 +@@ -3041,9 +3054,11 @@ static void bnxt_re_process_res_shadow_qp_wc(struct bnxt_re_qp *qp,
1627 + wc->src_qp = orig_cqe->src_qp;
1628 + memcpy(wc->smac, orig_cqe->smac, ETH_ALEN);
1629 + if (bnxt_re_is_vlan_pkt(orig_cqe, &vlan_id, &sl)) {
1630 +- wc->vlan_id = vlan_id;
1631 +- wc->sl = sl;
1632 +- wc->wc_flags |= IB_WC_WITH_VLAN;
1633 ++ if (bnxt_re_check_if_vlan_valid(rdev, vlan_id)) {
1634 ++ wc->vlan_id = vlan_id;
1635 ++ wc->sl = sl;
1636 ++ wc->wc_flags |= IB_WC_WITH_VLAN;
1637 ++ }
1638 + }
1639 + wc->port_num = 1;
1640 + wc->vendor_err = orig_cqe->status;
1641 +diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c
1642 +index 61a1b0bdede05..b8274c6fc43e7 100644
1643 +--- a/drivers/infiniband/hw/mlx4/main.c
1644 ++++ b/drivers/infiniband/hw/mlx4/main.c
1645 +@@ -781,7 +781,8 @@ static int eth_link_query_port(struct ib_device *ibdev, u8 port,
1646 + props->ip_gids = true;
1647 + props->gid_tbl_len = mdev->dev->caps.gid_table_len[port];
1648 + props->max_msg_sz = mdev->dev->caps.max_msg_sz;
1649 +- props->pkey_tbl_len = 1;
1650 ++ if (mdev->dev->caps.pkey_table_len[port])
1651 ++ props->pkey_tbl_len = 1;
1652 + props->max_mtu = IB_MTU_4096;
1653 + props->max_vl_num = 2;
1654 + props->state = IB_PORT_DOWN;
1655 +diff --git a/drivers/infiniband/sw/rxe/rxe.c b/drivers/infiniband/sw/rxe/rxe.c
1656 +index a8c11b5e1e943..70c4ea438664d 100644
1657 +--- a/drivers/infiniband/sw/rxe/rxe.c
1658 ++++ b/drivers/infiniband/sw/rxe/rxe.c
1659 +@@ -48,6 +48,8 @@ static void rxe_cleanup_ports(struct rxe_dev *rxe)
1660 +
1661 + }
1662 +
1663 ++bool rxe_initialized;
1664 ++
1665 + /* free resources for a rxe device all objects created for this device must
1666 + * have been destroyed
1667 + */
1668 +@@ -157,9 +159,6 @@ static int rxe_init_ports(struct rxe_dev *rxe)
1669 +
1670 + rxe_init_port_param(port);
1671 +
1672 +- if (!port->attr.pkey_tbl_len || !port->attr.gid_tbl_len)
1673 +- return -EINVAL;
1674 +-
1675 + port->pkey_tbl = kcalloc(port->attr.pkey_tbl_len,
1676 + sizeof(*port->pkey_tbl), GFP_KERNEL);
1677 +
1678 +@@ -358,6 +357,7 @@ static int __init rxe_module_init(void)
1679 + return err;
1680 +
1681 + rdma_link_register(&rxe_link_ops);
1682 ++ rxe_initialized = true;
1683 + pr_info("loaded\n");
1684 + return 0;
1685 + }
1686 +@@ -369,6 +369,7 @@ static void __exit rxe_module_exit(void)
1687 + rxe_net_exit();
1688 + rxe_cache_exit();
1689 +
1690 ++ rxe_initialized = false;
1691 + pr_info("unloaded\n");
1692 + }
1693 +
1694 +diff --git a/drivers/infiniband/sw/rxe/rxe.h b/drivers/infiniband/sw/rxe/rxe.h
1695 +index fb07eed9e4028..cae1b0a24c850 100644
1696 +--- a/drivers/infiniband/sw/rxe/rxe.h
1697 ++++ b/drivers/infiniband/sw/rxe/rxe.h
1698 +@@ -67,6 +67,8 @@
1699 +
1700 + #define RXE_ROCE_V2_SPORT (0xc000)
1701 +
1702 ++extern bool rxe_initialized;
1703 ++
1704 + static inline u32 rxe_crc32(struct rxe_dev *rxe,
1705 + u32 crc, void *next, size_t len)
1706 + {
1707 +diff --git a/drivers/infiniband/sw/rxe/rxe_mr.c b/drivers/infiniband/sw/rxe/rxe_mr.c
1708 +index ea6a819b71675..ffbc50341a55a 100644
1709 +--- a/drivers/infiniband/sw/rxe/rxe_mr.c
1710 ++++ b/drivers/infiniband/sw/rxe/rxe_mr.c
1711 +@@ -207,6 +207,7 @@ int rxe_mem_init_user(struct rxe_pd *pd, u64 start,
1712 + vaddr = page_address(sg_page_iter_page(&sg_iter));
1713 + if (!vaddr) {
1714 + pr_warn("null vaddr\n");
1715 ++ ib_umem_release(umem);
1716 + err = -ENOMEM;
1717 + goto err1;
1718 + }
1719 +diff --git a/drivers/infiniband/sw/rxe/rxe_sysfs.c b/drivers/infiniband/sw/rxe/rxe_sysfs.c
1720 +index ccda5f5a3bc0a..2af31d421bfc3 100644
1721 +--- a/drivers/infiniband/sw/rxe/rxe_sysfs.c
1722 ++++ b/drivers/infiniband/sw/rxe/rxe_sysfs.c
1723 +@@ -61,6 +61,11 @@ static int rxe_param_set_add(const char *val, const struct kernel_param *kp)
1724 + struct net_device *ndev;
1725 + struct rxe_dev *exists;
1726 +
1727 ++ if (!rxe_initialized) {
1728 ++ pr_err("Module parameters are not supported, use rdma link add or rxe_cfg\n");
1729 ++ return -EAGAIN;
1730 ++ }
1731 ++
1732 + len = sanitize_arg(val, intf, sizeof(intf));
1733 + if (!len) {
1734 + pr_err("add: invalid interface name\n");
1735 +diff --git a/drivers/infiniband/sw/rxe/rxe_verbs.c b/drivers/infiniband/sw/rxe/rxe_verbs.c
1736 +index 71358b0b8910c..d1fe57ac87f56 100644
1737 +--- a/drivers/infiniband/sw/rxe/rxe_verbs.c
1738 ++++ b/drivers/infiniband/sw/rxe/rxe_verbs.c
1739 +@@ -1078,7 +1078,7 @@ static ssize_t parent_show(struct device *device,
1740 + struct rxe_dev *rxe =
1741 + rdma_device_to_drv_device(device, struct rxe_dev, ib_dev);
1742 +
1743 +- return snprintf(buf, 16, "%s\n", rxe_parent_name(rxe, 1));
1744 ++ return scnprintf(buf, PAGE_SIZE, "%s\n", rxe_parent_name(rxe, 1));
1745 + }
1746 +
1747 + static DEVICE_ATTR_RO(parent);
1748 +diff --git a/drivers/infiniband/ulp/isert/ib_isert.c b/drivers/infiniband/ulp/isert/ib_isert.c
1749 +index a1a035270cabf..71268d61d2b8a 100644
1750 +--- a/drivers/infiniband/ulp/isert/ib_isert.c
1751 ++++ b/drivers/infiniband/ulp/isert/ib_isert.c
1752 +@@ -182,15 +182,15 @@ isert_alloc_rx_descriptors(struct isert_conn *isert_conn)
1753 + rx_desc = isert_conn->rx_descs;
1754 +
1755 + for (i = 0; i < ISERT_QP_MAX_RECV_DTOS; i++, rx_desc++) {
1756 +- dma_addr = ib_dma_map_single(ib_dev, (void *)rx_desc,
1757 +- ISER_RX_PAYLOAD_SIZE, DMA_FROM_DEVICE);
1758 ++ dma_addr = ib_dma_map_single(ib_dev, rx_desc->buf,
1759 ++ ISER_RX_SIZE, DMA_FROM_DEVICE);
1760 + if (ib_dma_mapping_error(ib_dev, dma_addr))
1761 + goto dma_map_fail;
1762 +
1763 + rx_desc->dma_addr = dma_addr;
1764 +
1765 + rx_sg = &rx_desc->rx_sg;
1766 +- rx_sg->addr = rx_desc->dma_addr;
1767 ++ rx_sg->addr = rx_desc->dma_addr + isert_get_hdr_offset(rx_desc);
1768 + rx_sg->length = ISER_RX_PAYLOAD_SIZE;
1769 + rx_sg->lkey = device->pd->local_dma_lkey;
1770 + rx_desc->rx_cqe.done = isert_recv_done;
1771 +@@ -202,7 +202,7 @@ dma_map_fail:
1772 + rx_desc = isert_conn->rx_descs;
1773 + for (j = 0; j < i; j++, rx_desc++) {
1774 + ib_dma_unmap_single(ib_dev, rx_desc->dma_addr,
1775 +- ISER_RX_PAYLOAD_SIZE, DMA_FROM_DEVICE);
1776 ++ ISER_RX_SIZE, DMA_FROM_DEVICE);
1777 + }
1778 + kfree(isert_conn->rx_descs);
1779 + isert_conn->rx_descs = NULL;
1780 +@@ -223,7 +223,7 @@ isert_free_rx_descriptors(struct isert_conn *isert_conn)
1781 + rx_desc = isert_conn->rx_descs;
1782 + for (i = 0; i < ISERT_QP_MAX_RECV_DTOS; i++, rx_desc++) {
1783 + ib_dma_unmap_single(ib_dev, rx_desc->dma_addr,
1784 +- ISER_RX_PAYLOAD_SIZE, DMA_FROM_DEVICE);
1785 ++ ISER_RX_SIZE, DMA_FROM_DEVICE);
1786 + }
1787 +
1788 + kfree(isert_conn->rx_descs);
1789 +@@ -408,10 +408,9 @@ isert_free_login_buf(struct isert_conn *isert_conn)
1790 + ISER_RX_PAYLOAD_SIZE, DMA_TO_DEVICE);
1791 + kfree(isert_conn->login_rsp_buf);
1792 +
1793 +- ib_dma_unmap_single(ib_dev, isert_conn->login_req_dma,
1794 +- ISER_RX_PAYLOAD_SIZE,
1795 +- DMA_FROM_DEVICE);
1796 +- kfree(isert_conn->login_req_buf);
1797 ++ ib_dma_unmap_single(ib_dev, isert_conn->login_desc->dma_addr,
1798 ++ ISER_RX_SIZE, DMA_FROM_DEVICE);
1799 ++ kfree(isert_conn->login_desc);
1800 + }
1801 +
1802 + static int
1803 +@@ -420,25 +419,25 @@ isert_alloc_login_buf(struct isert_conn *isert_conn,
1804 + {
1805 + int ret;
1806 +
1807 +- isert_conn->login_req_buf = kzalloc(sizeof(*isert_conn->login_req_buf),
1808 ++ isert_conn->login_desc = kzalloc(sizeof(*isert_conn->login_desc),
1809 + GFP_KERNEL);
1810 +- if (!isert_conn->login_req_buf)
1811 ++ if (!isert_conn->login_desc)
1812 + return -ENOMEM;
1813 +
1814 +- isert_conn->login_req_dma = ib_dma_map_single(ib_dev,
1815 +- isert_conn->login_req_buf,
1816 +- ISER_RX_PAYLOAD_SIZE, DMA_FROM_DEVICE);
1817 +- ret = ib_dma_mapping_error(ib_dev, isert_conn->login_req_dma);
1818 ++ isert_conn->login_desc->dma_addr = ib_dma_map_single(ib_dev,
1819 ++ isert_conn->login_desc->buf,
1820 ++ ISER_RX_SIZE, DMA_FROM_DEVICE);
1821 ++ ret = ib_dma_mapping_error(ib_dev, isert_conn->login_desc->dma_addr);
1822 + if (ret) {
1823 +- isert_err("login_req_dma mapping error: %d\n", ret);
1824 +- isert_conn->login_req_dma = 0;
1825 +- goto out_free_login_req_buf;
1826 ++ isert_err("login_desc dma mapping error: %d\n", ret);
1827 ++ isert_conn->login_desc->dma_addr = 0;
1828 ++ goto out_free_login_desc;
1829 + }
1830 +
1831 + isert_conn->login_rsp_buf = kzalloc(ISER_RX_PAYLOAD_SIZE, GFP_KERNEL);
1832 + if (!isert_conn->login_rsp_buf) {
1833 + ret = -ENOMEM;
1834 +- goto out_unmap_login_req_buf;
1835 ++ goto out_unmap_login_desc;
1836 + }
1837 +
1838 + isert_conn->login_rsp_dma = ib_dma_map_single(ib_dev,
1839 +@@ -455,11 +454,11 @@ isert_alloc_login_buf(struct isert_conn *isert_conn,
1840 +
1841 + out_free_login_rsp_buf:
1842 + kfree(isert_conn->login_rsp_buf);
1843 +-out_unmap_login_req_buf:
1844 +- ib_dma_unmap_single(ib_dev, isert_conn->login_req_dma,
1845 +- ISER_RX_PAYLOAD_SIZE, DMA_FROM_DEVICE);
1846 +-out_free_login_req_buf:
1847 +- kfree(isert_conn->login_req_buf);
1848 ++out_unmap_login_desc:
1849 ++ ib_dma_unmap_single(ib_dev, isert_conn->login_desc->dma_addr,
1850 ++ ISER_RX_SIZE, DMA_FROM_DEVICE);
1851 ++out_free_login_desc:
1852 ++ kfree(isert_conn->login_desc);
1853 + return ret;
1854 + }
1855 +
1856 +@@ -578,7 +577,7 @@ isert_connect_release(struct isert_conn *isert_conn)
1857 + ib_destroy_qp(isert_conn->qp);
1858 + }
1859 +
1860 +- if (isert_conn->login_req_buf)
1861 ++ if (isert_conn->login_desc)
1862 + isert_free_login_buf(isert_conn);
1863 +
1864 + isert_device_put(device);
1865 +@@ -964,17 +963,18 @@ isert_login_post_recv(struct isert_conn *isert_conn)
1866 + int ret;
1867 +
1868 + memset(&sge, 0, sizeof(struct ib_sge));
1869 +- sge.addr = isert_conn->login_req_dma;
1870 ++ sge.addr = isert_conn->login_desc->dma_addr +
1871 ++ isert_get_hdr_offset(isert_conn->login_desc);
1872 + sge.length = ISER_RX_PAYLOAD_SIZE;
1873 + sge.lkey = isert_conn->device->pd->local_dma_lkey;
1874 +
1875 + isert_dbg("Setup sge: addr: %llx length: %d 0x%08x\n",
1876 + sge.addr, sge.length, sge.lkey);
1877 +
1878 +- isert_conn->login_req_buf->rx_cqe.done = isert_login_recv_done;
1879 ++ isert_conn->login_desc->rx_cqe.done = isert_login_recv_done;
1880 +
1881 + memset(&rx_wr, 0, sizeof(struct ib_recv_wr));
1882 +- rx_wr.wr_cqe = &isert_conn->login_req_buf->rx_cqe;
1883 ++ rx_wr.wr_cqe = &isert_conn->login_desc->rx_cqe;
1884 + rx_wr.sg_list = &sge;
1885 + rx_wr.num_sge = 1;
1886 +
1887 +@@ -1051,7 +1051,7 @@ post_send:
1888 + static void
1889 + isert_rx_login_req(struct isert_conn *isert_conn)
1890 + {
1891 +- struct iser_rx_desc *rx_desc = isert_conn->login_req_buf;
1892 ++ struct iser_rx_desc *rx_desc = isert_conn->login_desc;
1893 + int rx_buflen = isert_conn->login_req_len;
1894 + struct iscsi_conn *conn = isert_conn->conn;
1895 + struct iscsi_login *login = conn->conn_login;
1896 +@@ -1063,7 +1063,7 @@ isert_rx_login_req(struct isert_conn *isert_conn)
1897 +
1898 + if (login->first_request) {
1899 + struct iscsi_login_req *login_req =
1900 +- (struct iscsi_login_req *)&rx_desc->iscsi_header;
1901 ++ (struct iscsi_login_req *)isert_get_iscsi_hdr(rx_desc);
1902 + /*
1903 + * Setup the initial iscsi_login values from the leading
1904 + * login request PDU.
1905 +@@ -1082,13 +1082,13 @@ isert_rx_login_req(struct isert_conn *isert_conn)
1906 + login->tsih = be16_to_cpu(login_req->tsih);
1907 + }
1908 +
1909 +- memcpy(&login->req[0], (void *)&rx_desc->iscsi_header, ISCSI_HDR_LEN);
1910 ++ memcpy(&login->req[0], isert_get_iscsi_hdr(rx_desc), ISCSI_HDR_LEN);
1911 +
1912 + size = min(rx_buflen, MAX_KEY_VALUE_PAIRS);
1913 + isert_dbg("Using login payload size: %d, rx_buflen: %d "
1914 + "MAX_KEY_VALUE_PAIRS: %d\n", size, rx_buflen,
1915 + MAX_KEY_VALUE_PAIRS);
1916 +- memcpy(login->req_buf, &rx_desc->data[0], size);
1917 ++ memcpy(login->req_buf, isert_get_data(rx_desc), size);
1918 +
1919 + if (login->first_request) {
1920 + complete(&isert_conn->login_comp);
1921 +@@ -1153,14 +1153,15 @@ isert_handle_scsi_cmd(struct isert_conn *isert_conn,
1922 + if (imm_data_len != data_len) {
1923 + sg_nents = max(1UL, DIV_ROUND_UP(imm_data_len, PAGE_SIZE));
1924 + sg_copy_from_buffer(cmd->se_cmd.t_data_sg, sg_nents,
1925 +- &rx_desc->data[0], imm_data_len);
1926 ++ isert_get_data(rx_desc), imm_data_len);
1927 + isert_dbg("Copy Immediate sg_nents: %u imm_data_len: %d\n",
1928 + sg_nents, imm_data_len);
1929 + } else {
1930 + sg_init_table(&isert_cmd->sg, 1);
1931 + cmd->se_cmd.t_data_sg = &isert_cmd->sg;
1932 + cmd->se_cmd.t_data_nents = 1;
1933 +- sg_set_buf(&isert_cmd->sg, &rx_desc->data[0], imm_data_len);
1934 ++ sg_set_buf(&isert_cmd->sg, isert_get_data(rx_desc),
1935 ++ imm_data_len);
1936 + isert_dbg("Transfer Immediate imm_data_len: %d\n",
1937 + imm_data_len);
1938 + }
1939 +@@ -1229,9 +1230,9 @@ isert_handle_iscsi_dataout(struct isert_conn *isert_conn,
1940 + }
1941 + isert_dbg("Copying DataOut: sg_start: %p, sg_off: %u "
1942 + "sg_nents: %u from %p %u\n", sg_start, sg_off,
1943 +- sg_nents, &rx_desc->data[0], unsol_data_len);
1944 ++ sg_nents, isert_get_data(rx_desc), unsol_data_len);
1945 +
1946 +- sg_copy_from_buffer(sg_start, sg_nents, &rx_desc->data[0],
1947 ++ sg_copy_from_buffer(sg_start, sg_nents, isert_get_data(rx_desc),
1948 + unsol_data_len);
1949 +
1950 + rc = iscsit_check_dataout_payload(cmd, hdr, false);
1951 +@@ -1290,7 +1291,7 @@ isert_handle_text_cmd(struct isert_conn *isert_conn, struct isert_cmd *isert_cmd
1952 + }
1953 + cmd->text_in_ptr = text_in;
1954 +
1955 +- memcpy(cmd->text_in_ptr, &rx_desc->data[0], payload_length);
1956 ++ memcpy(cmd->text_in_ptr, isert_get_data(rx_desc), payload_length);
1957 +
1958 + return iscsit_process_text_cmd(conn, cmd, hdr);
1959 + }
1960 +@@ -1300,7 +1301,7 @@ isert_rx_opcode(struct isert_conn *isert_conn, struct iser_rx_desc *rx_desc,
1961 + uint32_t read_stag, uint64_t read_va,
1962 + uint32_t write_stag, uint64_t write_va)
1963 + {
1964 +- struct iscsi_hdr *hdr = &rx_desc->iscsi_header;
1965 ++ struct iscsi_hdr *hdr = isert_get_iscsi_hdr(rx_desc);
1966 + struct iscsi_conn *conn = isert_conn->conn;
1967 + struct iscsi_cmd *cmd;
1968 + struct isert_cmd *isert_cmd;
1969 +@@ -1398,8 +1399,8 @@ isert_recv_done(struct ib_cq *cq, struct ib_wc *wc)
1970 + struct isert_conn *isert_conn = wc->qp->qp_context;
1971 + struct ib_device *ib_dev = isert_conn->cm_id->device;
1972 + struct iser_rx_desc *rx_desc = cqe_to_rx_desc(wc->wr_cqe);
1973 +- struct iscsi_hdr *hdr = &rx_desc->iscsi_header;
1974 +- struct iser_ctrl *iser_ctrl = &rx_desc->iser_header;
1975 ++ struct iscsi_hdr *hdr = isert_get_iscsi_hdr(rx_desc);
1976 ++ struct iser_ctrl *iser_ctrl = isert_get_iser_hdr(rx_desc);
1977 + uint64_t read_va = 0, write_va = 0;
1978 + uint32_t read_stag = 0, write_stag = 0;
1979 +
1980 +@@ -1413,7 +1414,7 @@ isert_recv_done(struct ib_cq *cq, struct ib_wc *wc)
1981 + rx_desc->in_use = true;
1982 +
1983 + ib_dma_sync_single_for_cpu(ib_dev, rx_desc->dma_addr,
1984 +- ISER_RX_PAYLOAD_SIZE, DMA_FROM_DEVICE);
1985 ++ ISER_RX_SIZE, DMA_FROM_DEVICE);
1986 +
1987 + isert_dbg("DMA: 0x%llx, iSCSI opcode: 0x%02x, ITT: 0x%08x, flags: 0x%02x dlen: %d\n",
1988 + rx_desc->dma_addr, hdr->opcode, hdr->itt, hdr->flags,
1989 +@@ -1448,7 +1449,7 @@ isert_recv_done(struct ib_cq *cq, struct ib_wc *wc)
1990 + read_stag, read_va, write_stag, write_va);
1991 +
1992 + ib_dma_sync_single_for_device(ib_dev, rx_desc->dma_addr,
1993 +- ISER_RX_PAYLOAD_SIZE, DMA_FROM_DEVICE);
1994 ++ ISER_RX_SIZE, DMA_FROM_DEVICE);
1995 + }
1996 +
1997 + static void
1998 +@@ -1462,8 +1463,8 @@ isert_login_recv_done(struct ib_cq *cq, struct ib_wc *wc)
1999 + return;
2000 + }
2001 +
2002 +- ib_dma_sync_single_for_cpu(ib_dev, isert_conn->login_req_dma,
2003 +- ISER_RX_PAYLOAD_SIZE, DMA_FROM_DEVICE);
2004 ++ ib_dma_sync_single_for_cpu(ib_dev, isert_conn->login_desc->dma_addr,
2005 ++ ISER_RX_SIZE, DMA_FROM_DEVICE);
2006 +
2007 + isert_conn->login_req_len = wc->byte_len - ISER_HEADERS_LEN;
2008 +
2009 +@@ -1478,8 +1479,8 @@ isert_login_recv_done(struct ib_cq *cq, struct ib_wc *wc)
2010 + complete(&isert_conn->login_req_comp);
2011 + mutex_unlock(&isert_conn->mutex);
2012 +
2013 +- ib_dma_sync_single_for_device(ib_dev, isert_conn->login_req_dma,
2014 +- ISER_RX_PAYLOAD_SIZE, DMA_FROM_DEVICE);
2015 ++ ib_dma_sync_single_for_device(ib_dev, isert_conn->login_desc->dma_addr,
2016 ++ ISER_RX_SIZE, DMA_FROM_DEVICE);
2017 + }
2018 +
2019 + static void
2020 +diff --git a/drivers/infiniband/ulp/isert/ib_isert.h b/drivers/infiniband/ulp/isert/ib_isert.h
2021 +index 3b296bac4f603..d267a6d60d87d 100644
2022 +--- a/drivers/infiniband/ulp/isert/ib_isert.h
2023 ++++ b/drivers/infiniband/ulp/isert/ib_isert.h
2024 +@@ -59,9 +59,11 @@
2025 + ISERT_MAX_TX_MISC_PDUS + \
2026 + ISERT_MAX_RX_MISC_PDUS)
2027 +
2028 +-#define ISER_RX_PAD_SIZE (ISCSI_DEF_MAX_RECV_SEG_LEN + 4096 - \
2029 +- (ISER_RX_PAYLOAD_SIZE + sizeof(u64) + sizeof(struct ib_sge) + \
2030 +- sizeof(struct ib_cqe) + sizeof(bool)))
2031 ++/*
2032 ++ * RX size is default of 8k plus headers, but data needs to align to
2033 ++ * 512 boundary, so use 1024 to have the extra space for alignment.
2034 ++ */
2035 ++#define ISER_RX_SIZE (ISCSI_DEF_MAX_RECV_SEG_LEN + 1024)
2036 +
2037 + #define ISCSI_ISER_SG_TABLESIZE 256
2038 +
2039 +@@ -80,21 +82,41 @@ enum iser_conn_state {
2040 + };
2041 +
2042 + struct iser_rx_desc {
2043 +- struct iser_ctrl iser_header;
2044 +- struct iscsi_hdr iscsi_header;
2045 +- char data[ISCSI_DEF_MAX_RECV_SEG_LEN];
2046 ++ char buf[ISER_RX_SIZE];
2047 + u64 dma_addr;
2048 + struct ib_sge rx_sg;
2049 + struct ib_cqe rx_cqe;
2050 + bool in_use;
2051 +- char pad[ISER_RX_PAD_SIZE];
2052 +-} __packed;
2053 ++};
2054 +
2055 + static inline struct iser_rx_desc *cqe_to_rx_desc(struct ib_cqe *cqe)
2056 + {
2057 + return container_of(cqe, struct iser_rx_desc, rx_cqe);
2058 + }
2059 +
2060 ++static void *isert_get_iser_hdr(struct iser_rx_desc *desc)
2061 ++{
2062 ++ return PTR_ALIGN(desc->buf + ISER_HEADERS_LEN, 512) - ISER_HEADERS_LEN;
2063 ++}
2064 ++
2065 ++static size_t isert_get_hdr_offset(struct iser_rx_desc *desc)
2066 ++{
2067 ++ return isert_get_iser_hdr(desc) - (void *)desc->buf;
2068 ++}
2069 ++
2070 ++static void *isert_get_iscsi_hdr(struct iser_rx_desc *desc)
2071 ++{
2072 ++ return isert_get_iser_hdr(desc) + sizeof(struct iser_ctrl);
2073 ++}
2074 ++
2075 ++static void *isert_get_data(struct iser_rx_desc *desc)
2076 ++{
2077 ++ void *data = isert_get_iser_hdr(desc) + ISER_HEADERS_LEN;
2078 ++
2079 ++ WARN_ON((uintptr_t)data & 511);
2080 ++ return data;
2081 ++}
2082 ++
2083 + struct iser_tx_desc {
2084 + struct iser_ctrl iser_header;
2085 + struct iscsi_hdr iscsi_header;
2086 +@@ -141,9 +163,8 @@ struct isert_conn {
2087 + u32 responder_resources;
2088 + u32 initiator_depth;
2089 + bool pi_support;
2090 +- struct iser_rx_desc *login_req_buf;
2091 ++ struct iser_rx_desc *login_desc;
2092 + char *login_rsp_buf;
2093 +- u64 login_req_dma;
2094 + int login_req_len;
2095 + u64 login_rsp_dma;
2096 + struct iser_rx_desc *rx_descs;
2097 +diff --git a/drivers/iommu/amd_iommu_v2.c b/drivers/iommu/amd_iommu_v2.c
2098 +index d6d85debd01b0..05f3d93cf480c 100644
2099 +--- a/drivers/iommu/amd_iommu_v2.c
2100 ++++ b/drivers/iommu/amd_iommu_v2.c
2101 +@@ -741,6 +741,13 @@ int amd_iommu_init_device(struct pci_dev *pdev, int pasids)
2102 +
2103 + might_sleep();
2104 +
2105 ++ /*
2106 ++ * When memory encryption is active the device is likely not in a
2107 ++ * direct-mapped domain. Forbid using IOMMUv2 functionality for now.
2108 ++ */
2109 ++ if (mem_encrypt_active())
2110 ++ return -ENODEV;
2111 ++
2112 + if (!amd_iommu_v2_supported())
2113 + return -ENODEV;
2114 +
2115 +diff --git a/drivers/mmc/core/sdio_ops.c b/drivers/mmc/core/sdio_ops.c
2116 +index 93d346c01110d..4c229dd2b6e54 100644
2117 +--- a/drivers/mmc/core/sdio_ops.c
2118 ++++ b/drivers/mmc/core/sdio_ops.c
2119 +@@ -121,6 +121,7 @@ int mmc_io_rw_extended(struct mmc_card *card, int write, unsigned fn,
2120 + struct sg_table sgtable;
2121 + unsigned int nents, left_size, i;
2122 + unsigned int seg_size = card->host->max_seg_size;
2123 ++ int err;
2124 +
2125 + WARN_ON(blksz == 0);
2126 +
2127 +@@ -170,28 +171,32 @@ int mmc_io_rw_extended(struct mmc_card *card, int write, unsigned fn,
2128 +
2129 + mmc_set_data_timeout(&data, card);
2130 +
2131 +- mmc_wait_for_req(card->host, &mrq);
2132 ++ mmc_pre_req(card->host, &mrq);
2133 +
2134 +- if (nents > 1)
2135 +- sg_free_table(&sgtable);
2136 ++ mmc_wait_for_req(card->host, &mrq);
2137 +
2138 + if (cmd.error)
2139 +- return cmd.error;
2140 +- if (data.error)
2141 +- return data.error;
2142 +-
2143 +- if (mmc_host_is_spi(card->host)) {
2144 ++ err = cmd.error;
2145 ++ else if (data.error)
2146 ++ err = data.error;
2147 ++ else if (mmc_host_is_spi(card->host))
2148 + /* host driver already reported errors */
2149 +- } else {
2150 +- if (cmd.resp[0] & R5_ERROR)
2151 +- return -EIO;
2152 +- if (cmd.resp[0] & R5_FUNCTION_NUMBER)
2153 +- return -EINVAL;
2154 +- if (cmd.resp[0] & R5_OUT_OF_RANGE)
2155 +- return -ERANGE;
2156 +- }
2157 ++ err = 0;
2158 ++ else if (cmd.resp[0] & R5_ERROR)
2159 ++ err = -EIO;
2160 ++ else if (cmd.resp[0] & R5_FUNCTION_NUMBER)
2161 ++ err = -EINVAL;
2162 ++ else if (cmd.resp[0] & R5_OUT_OF_RANGE)
2163 ++ err = -ERANGE;
2164 ++ else
2165 ++ err = 0;
2166 +
2167 +- return 0;
2168 ++ mmc_post_req(card->host, &mrq, err);
2169 ++
2170 ++ if (nents > 1)
2171 ++ sg_free_table(&sgtable);
2172 ++
2173 ++ return err;
2174 + }
2175 +
2176 + int sdio_reset(struct mmc_host *host)
2177 +diff --git a/drivers/mmc/host/sdhci-acpi.c b/drivers/mmc/host/sdhci-acpi.c
2178 +index 5581a5c86fce3..b2d924c5e82ee 100644
2179 +--- a/drivers/mmc/host/sdhci-acpi.c
2180 ++++ b/drivers/mmc/host/sdhci-acpi.c
2181 +@@ -547,12 +547,18 @@ static int amd_select_drive_strength(struct mmc_card *card,
2182 + return MMC_SET_DRIVER_TYPE_A;
2183 + }
2184 +
2185 +-static void sdhci_acpi_amd_hs400_dll(struct sdhci_host *host)
2186 ++static void sdhci_acpi_amd_hs400_dll(struct sdhci_host *host, bool enable)
2187 + {
2188 ++ struct sdhci_acpi_host *acpi_host = sdhci_priv(host);
2189 ++ struct amd_sdhci_host *amd_host = sdhci_acpi_priv(acpi_host);
2190 ++
2191 + /* AMD Platform requires dll setting */
2192 + sdhci_writel(host, 0x40003210, SDHCI_AMD_RESET_DLL_REGISTER);
2193 + usleep_range(10, 20);
2194 +- sdhci_writel(host, 0x40033210, SDHCI_AMD_RESET_DLL_REGISTER);
2195 ++ if (enable)
2196 ++ sdhci_writel(host, 0x40033210, SDHCI_AMD_RESET_DLL_REGISTER);
2197 ++
2198 ++ amd_host->dll_enabled = enable;
2199 + }
2200 +
2201 + /*
2202 +@@ -592,10 +598,8 @@ static void amd_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
2203 +
2204 + /* DLL is only required for HS400 */
2205 + if (host->timing == MMC_TIMING_MMC_HS400 &&
2206 +- !amd_host->dll_enabled) {
2207 +- sdhci_acpi_amd_hs400_dll(host);
2208 +- amd_host->dll_enabled = true;
2209 +- }
2210 ++ !amd_host->dll_enabled)
2211 ++ sdhci_acpi_amd_hs400_dll(host, true);
2212 + }
2213 + }
2214 +
2215 +@@ -616,10 +620,23 @@ static int amd_sdhci_execute_tuning(struct mmc_host *mmc, u32 opcode)
2216 + return err;
2217 + }
2218 +
2219 ++static void amd_sdhci_reset(struct sdhci_host *host, u8 mask)
2220 ++{
2221 ++ struct sdhci_acpi_host *acpi_host = sdhci_priv(host);
2222 ++ struct amd_sdhci_host *amd_host = sdhci_acpi_priv(acpi_host);
2223 ++
2224 ++ if (mask & SDHCI_RESET_ALL) {
2225 ++ amd_host->tuned_clock = false;
2226 ++ sdhci_acpi_amd_hs400_dll(host, false);
2227 ++ }
2228 ++
2229 ++ sdhci_reset(host, mask);
2230 ++}
2231 ++
2232 + static const struct sdhci_ops sdhci_acpi_ops_amd = {
2233 + .set_clock = sdhci_set_clock,
2234 + .set_bus_width = sdhci_set_bus_width,
2235 +- .reset = sdhci_reset,
2236 ++ .reset = amd_sdhci_reset,
2237 + .set_uhs_signaling = sdhci_set_uhs_signaling,
2238 + };
2239 +
2240 +diff --git a/drivers/mmc/host/sdhci-msm.c b/drivers/mmc/host/sdhci-msm.c
2241 +index 84cffdef264b7..8bed81cf03adc 100644
2242 +--- a/drivers/mmc/host/sdhci-msm.c
2243 ++++ b/drivers/mmc/host/sdhci-msm.c
2244 +@@ -1096,7 +1096,7 @@ static void sdhci_msm_set_cdr(struct sdhci_host *host, bool enable)
2245 + static int sdhci_msm_execute_tuning(struct mmc_host *mmc, u32 opcode)
2246 + {
2247 + struct sdhci_host *host = mmc_priv(mmc);
2248 +- int tuning_seq_cnt = 3;
2249 ++ int tuning_seq_cnt = 10;
2250 + u8 phase, tuned_phases[16], tuned_phase_cnt = 0;
2251 + int rc;
2252 + struct mmc_ios ios = host->mmc->ios;
2253 +@@ -1152,6 +1152,22 @@ retry:
2254 + } while (++phase < ARRAY_SIZE(tuned_phases));
2255 +
2256 + if (tuned_phase_cnt) {
2257 ++ if (tuned_phase_cnt == ARRAY_SIZE(tuned_phases)) {
2258 ++ /*
2259 ++ * All phases valid is _almost_ as bad as no phases
2260 ++ * valid. Probably all phases are not really reliable
2261 ++ * but we didn't detect where the unreliable place is.
2262 ++ * That means we'll essentially be guessing and hoping
2263 ++ * we get a good phase. Better to try a few times.
2264 ++ */
2265 ++ dev_dbg(mmc_dev(mmc), "%s: All phases valid; try again\n",
2266 ++ mmc_hostname(mmc));
2267 ++ if (--tuning_seq_cnt) {
2268 ++ tuned_phase_cnt = 0;
2269 ++ goto retry;
2270 ++ }
2271 ++ }
2272 ++
2273 + rc = msm_find_most_appropriate_phase(host, tuned_phases,
2274 + tuned_phase_cnt);
2275 + if (rc < 0)
2276 +diff --git a/drivers/mmc/host/sdhci-of-esdhc.c b/drivers/mmc/host/sdhci-of-esdhc.c
2277 +index fd1251ec84711..66ad46d0ba88b 100644
2278 +--- a/drivers/mmc/host/sdhci-of-esdhc.c
2279 ++++ b/drivers/mmc/host/sdhci-of-esdhc.c
2280 +@@ -81,6 +81,7 @@ struct sdhci_esdhc {
2281 + bool quirk_tuning_erratum_type2;
2282 + bool quirk_ignore_data_inhibit;
2283 + bool quirk_delay_before_data_reset;
2284 ++ bool quirk_trans_complete_erratum;
2285 + bool in_sw_tuning;
2286 + unsigned int peripheral_clock;
2287 + const struct esdhc_clk_fixup *clk_fixup;
2288 +@@ -1082,10 +1083,11 @@ static void esdhc_set_uhs_signaling(struct sdhci_host *host,
2289 +
2290 + static u32 esdhc_irq(struct sdhci_host *host, u32 intmask)
2291 + {
2292 ++ struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
2293 ++ struct sdhci_esdhc *esdhc = sdhci_pltfm_priv(pltfm_host);
2294 + u32 command;
2295 +
2296 +- if (of_find_compatible_node(NULL, NULL,
2297 +- "fsl,p2020-esdhc")) {
2298 ++ if (esdhc->quirk_trans_complete_erratum) {
2299 + command = SDHCI_GET_CMD(sdhci_readw(host,
2300 + SDHCI_COMMAND));
2301 + if (command == MMC_WRITE_MULTIPLE_BLOCK &&
2302 +@@ -1239,8 +1241,10 @@ static void esdhc_init(struct platform_device *pdev, struct sdhci_host *host)
2303 + esdhc->clk_fixup = match->data;
2304 + np = pdev->dev.of_node;
2305 +
2306 +- if (of_device_is_compatible(np, "fsl,p2020-esdhc"))
2307 ++ if (of_device_is_compatible(np, "fsl,p2020-esdhc")) {
2308 + esdhc->quirk_delay_before_data_reset = true;
2309 ++ esdhc->quirk_trans_complete_erratum = true;
2310 ++ }
2311 +
2312 + clk = of_clk_get(np, 0);
2313 + if (!IS_ERR(clk)) {
2314 +diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
2315 +index a8ce6ca0f5081..92af7204711c8 100644
2316 +--- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
2317 ++++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
2318 +@@ -21,6 +21,7 @@
2319 + #include <net/pkt_cls.h>
2320 + #include <net/tcp.h>
2321 + #include <net/vxlan.h>
2322 ++#include <net/geneve.h>
2323 +
2324 + #include "hnae3.h"
2325 + #include "hns3_enet.h"
2326 +@@ -795,7 +796,7 @@ static int hns3_get_l4_protocol(struct sk_buff *skb, u8 *ol4_proto,
2327 + * and it is udp packet, which has a dest port as the IANA assigned.
2328 + * the hardware is expected to do the checksum offload, but the
2329 + * hardware will not do the checksum offload when udp dest port is
2330 +- * 4789.
2331 ++ * 4789 or 6081.
2332 + */
2333 + static bool hns3_tunnel_csum_bug(struct sk_buff *skb)
2334 + {
2335 +@@ -804,7 +805,8 @@ static bool hns3_tunnel_csum_bug(struct sk_buff *skb)
2336 + l4.hdr = skb_transport_header(skb);
2337 +
2338 + if (!(!skb->encapsulation &&
2339 +- l4.udp->dest == htons(IANA_VXLAN_UDP_PORT)))
2340 ++ (l4.udp->dest == htons(IANA_VXLAN_UDP_PORT) ||
2341 ++ l4.udp->dest == htons(GENEVE_UDP_PORT))))
2342 + return false;
2343 +
2344 + skb_checksum_help(skb);
2345 +diff --git a/drivers/net/wan/hdlc_cisco.c b/drivers/net/wan/hdlc_cisco.c
2346 +index a030f5aa6b951..cc33441af4691 100644
2347 +--- a/drivers/net/wan/hdlc_cisco.c
2348 ++++ b/drivers/net/wan/hdlc_cisco.c
2349 +@@ -370,6 +370,7 @@ static int cisco_ioctl(struct net_device *dev, struct ifreq *ifr)
2350 + memcpy(&state(hdlc)->settings, &new_settings, size);
2351 + spin_lock_init(&state(hdlc)->lock);
2352 + dev->header_ops = &cisco_header_ops;
2353 ++ dev->hard_header_len = sizeof(struct hdlc_header);
2354 + dev->type = ARPHRD_CISCO;
2355 + call_netdevice_notifiers(NETDEV_POST_TYPE_CHANGE, dev);
2356 + netif_dormant_on(dev);
2357 +diff --git a/drivers/net/wan/lapbether.c b/drivers/net/wan/lapbether.c
2358 +index 996eb9c55b39a..2cff914aada55 100644
2359 +--- a/drivers/net/wan/lapbether.c
2360 ++++ b/drivers/net/wan/lapbether.c
2361 +@@ -210,6 +210,8 @@ static void lapbeth_data_transmit(struct net_device *ndev, struct sk_buff *skb)
2362 +
2363 + skb->dev = dev = lapbeth->ethdev;
2364 +
2365 ++ skb_reset_network_header(skb);
2366 ++
2367 + dev_hard_header(skb, dev, ETH_P_DEC, bcast_addr, NULL, 0);
2368 +
2369 + dev_queue_xmit(skb);
2370 +@@ -340,6 +342,7 @@ static int lapbeth_new_device(struct net_device *dev)
2371 + */
2372 + ndev->needed_headroom = -1 + 3 + 2 + dev->hard_header_len
2373 + + dev->needed_headroom;
2374 ++ ndev->needed_tailroom = dev->needed_tailroom;
2375 +
2376 + lapbeth = netdev_priv(ndev);
2377 + lapbeth->axdev = ndev;
2378 +diff --git a/drivers/nfc/st95hf/core.c b/drivers/nfc/st95hf/core.c
2379 +index 9642971e89cea..4578547659839 100644
2380 +--- a/drivers/nfc/st95hf/core.c
2381 ++++ b/drivers/nfc/st95hf/core.c
2382 +@@ -966,7 +966,7 @@ static int st95hf_in_send_cmd(struct nfc_digital_dev *ddev,
2383 + rc = down_killable(&stcontext->exchange_lock);
2384 + if (rc) {
2385 + WARN(1, "Semaphore is not found up in st95hf_in_send_cmd\n");
2386 +- return rc;
2387 ++ goto free_skb_resp;
2388 + }
2389 +
2390 + rc = st95hf_spi_send(&stcontext->spicontext, skb->data,
2391 +diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
2392 +index 3cb017fa3a790..2d2673d360ff2 100644
2393 +--- a/drivers/nvme/host/core.c
2394 ++++ b/drivers/nvme/host/core.c
2395 +@@ -4148,7 +4148,7 @@ void nvme_unfreeze(struct nvme_ctrl *ctrl)
2396 + }
2397 + EXPORT_SYMBOL_GPL(nvme_unfreeze);
2398 +
2399 +-void nvme_wait_freeze_timeout(struct nvme_ctrl *ctrl, long timeout)
2400 ++int nvme_wait_freeze_timeout(struct nvme_ctrl *ctrl, long timeout)
2401 + {
2402 + struct nvme_ns *ns;
2403 +
2404 +@@ -4159,6 +4159,7 @@ void nvme_wait_freeze_timeout(struct nvme_ctrl *ctrl, long timeout)
2405 + break;
2406 + }
2407 + up_read(&ctrl->namespaces_rwsem);
2408 ++ return timeout;
2409 + }
2410 + EXPORT_SYMBOL_GPL(nvme_wait_freeze_timeout);
2411 +
2412 +diff --git a/drivers/nvme/host/fabrics.c b/drivers/nvme/host/fabrics.c
2413 +index 74b8818ac9a1e..3bb71f177dfda 100644
2414 +--- a/drivers/nvme/host/fabrics.c
2415 ++++ b/drivers/nvme/host/fabrics.c
2416 +@@ -565,10 +565,14 @@ bool __nvmf_check_ready(struct nvme_ctrl *ctrl, struct request *rq,
2417 + struct nvme_request *req = nvme_req(rq);
2418 +
2419 + /*
2420 +- * If we are in some state of setup or teardown only allow
2421 +- * internally generated commands.
2422 ++ * currently we have a problem sending passthru commands
2423 ++ * on the admin_q if the controller is not LIVE because we can't
2424 ++ * make sure that they are going out after the admin connect,
2425 ++ * controller enable and/or other commands in the initialization
2426 ++ * sequence. until the controller will be LIVE, fail with
2427 ++ * BLK_STS_RESOURCE so that they will be rescheduled.
2428 + */
2429 +- if (!blk_rq_is_passthrough(rq) || (req->flags & NVME_REQ_USERCMD))
2430 ++ if (rq->q == ctrl->admin_q && (req->flags & NVME_REQ_USERCMD))
2431 + return false;
2432 +
2433 + /*
2434 +@@ -576,9 +580,8 @@ bool __nvmf_check_ready(struct nvme_ctrl *ctrl, struct request *rq,
2435 + * which is require to set the queue live in the appropinquate states.
2436 + */
2437 + switch (ctrl->state) {
2438 +- case NVME_CTRL_NEW:
2439 + case NVME_CTRL_CONNECTING:
2440 +- if (nvme_is_fabrics(req->cmd) &&
2441 ++ if (blk_rq_is_passthrough(rq) && nvme_is_fabrics(req->cmd) &&
2442 + req->cmd->fabrics.fctype == nvme_fabrics_type_connect)
2443 + return true;
2444 + break;
2445 +diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h
2446 +index 056953bd8bd81..2bd9f7c3084f2 100644
2447 +--- a/drivers/nvme/host/nvme.h
2448 ++++ b/drivers/nvme/host/nvme.h
2449 +@@ -485,7 +485,7 @@ void nvme_kill_queues(struct nvme_ctrl *ctrl);
2450 + void nvme_sync_queues(struct nvme_ctrl *ctrl);
2451 + void nvme_unfreeze(struct nvme_ctrl *ctrl);
2452 + void nvme_wait_freeze(struct nvme_ctrl *ctrl);
2453 +-void nvme_wait_freeze_timeout(struct nvme_ctrl *ctrl, long timeout);
2454 ++int nvme_wait_freeze_timeout(struct nvme_ctrl *ctrl, long timeout);
2455 + void nvme_start_freeze(struct nvme_ctrl *ctrl);
2456 +
2457 + #define NVME_QID_ANY -1
2458 +diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
2459 +index 100da11ce98cb..a91433bdf5de4 100644
2460 +--- a/drivers/nvme/host/pci.c
2461 ++++ b/drivers/nvme/host/pci.c
2462 +@@ -1274,8 +1274,8 @@ static enum blk_eh_timer_return nvme_timeout(struct request *req, bool reserved)
2463 + dev_warn_ratelimited(dev->ctrl.device,
2464 + "I/O %d QID %d timeout, disable controller\n",
2465 + req->tag, nvmeq->qid);
2466 +- nvme_dev_disable(dev, true);
2467 + nvme_req(req)->flags |= NVME_REQ_CANCELLED;
2468 ++ nvme_dev_disable(dev, true);
2469 + return BLK_EH_DONE;
2470 + case NVME_CTRL_RESETTING:
2471 + return BLK_EH_RESET_TIMER;
2472 +@@ -1292,10 +1292,10 @@ static enum blk_eh_timer_return nvme_timeout(struct request *req, bool reserved)
2473 + dev_warn(dev->ctrl.device,
2474 + "I/O %d QID %d timeout, reset controller\n",
2475 + req->tag, nvmeq->qid);
2476 ++ nvme_req(req)->flags |= NVME_REQ_CANCELLED;
2477 + nvme_dev_disable(dev, false);
2478 + nvme_reset_ctrl(&dev->ctrl);
2479 +
2480 +- nvme_req(req)->flags |= NVME_REQ_CANCELLED;
2481 + return BLK_EH_DONE;
2482 + }
2483 +
2484 +diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c
2485 +index d0336545e1fe0..f0847f2bb117b 100644
2486 +--- a/drivers/nvme/host/rdma.c
2487 ++++ b/drivers/nvme/host/rdma.c
2488 +@@ -110,6 +110,7 @@ struct nvme_rdma_ctrl {
2489 + struct sockaddr_storage src_addr;
2490 +
2491 + struct nvme_ctrl ctrl;
2492 ++ struct mutex teardown_lock;
2493 + bool use_inline_data;
2494 + u32 io_queues[HCTX_MAX_TYPES];
2495 + };
2496 +@@ -898,7 +899,15 @@ static int nvme_rdma_configure_io_queues(struct nvme_rdma_ctrl *ctrl, bool new)
2497 +
2498 + if (!new) {
2499 + nvme_start_queues(&ctrl->ctrl);
2500 +- nvme_wait_freeze(&ctrl->ctrl);
2501 ++ if (!nvme_wait_freeze_timeout(&ctrl->ctrl, NVME_IO_TIMEOUT)) {
2502 ++ /*
2503 ++ * If we timed out waiting for freeze we are likely to
2504 ++ * be stuck. Fail the controller initialization just
2505 ++ * to be safe.
2506 ++ */
2507 ++ ret = -ENODEV;
2508 ++ goto out_wait_freeze_timed_out;
2509 ++ }
2510 + blk_mq_update_nr_hw_queues(ctrl->ctrl.tagset,
2511 + ctrl->ctrl.queue_count - 1);
2512 + nvme_unfreeze(&ctrl->ctrl);
2513 +@@ -906,6 +915,9 @@ static int nvme_rdma_configure_io_queues(struct nvme_rdma_ctrl *ctrl, bool new)
2514 +
2515 + return 0;
2516 +
2517 ++out_wait_freeze_timed_out:
2518 ++ nvme_stop_queues(&ctrl->ctrl);
2519 ++ nvme_rdma_stop_io_queues(ctrl);
2520 + out_cleanup_connect_q:
2521 + if (new)
2522 + blk_cleanup_queue(ctrl->ctrl.connect_q);
2523 +@@ -920,6 +932,7 @@ out_free_io_queues:
2524 + static void nvme_rdma_teardown_admin_queue(struct nvme_rdma_ctrl *ctrl,
2525 + bool remove)
2526 + {
2527 ++ mutex_lock(&ctrl->teardown_lock);
2528 + blk_mq_quiesce_queue(ctrl->ctrl.admin_q);
2529 + nvme_rdma_stop_queue(&ctrl->queues[0]);
2530 + if (ctrl->ctrl.admin_tagset) {
2531 +@@ -930,11 +943,13 @@ static void nvme_rdma_teardown_admin_queue(struct nvme_rdma_ctrl *ctrl,
2532 + if (remove)
2533 + blk_mq_unquiesce_queue(ctrl->ctrl.admin_q);
2534 + nvme_rdma_destroy_admin_queue(ctrl, remove);
2535 ++ mutex_unlock(&ctrl->teardown_lock);
2536 + }
2537 +
2538 + static void nvme_rdma_teardown_io_queues(struct nvme_rdma_ctrl *ctrl,
2539 + bool remove)
2540 + {
2541 ++ mutex_lock(&ctrl->teardown_lock);
2542 + if (ctrl->ctrl.queue_count > 1) {
2543 + nvme_start_freeze(&ctrl->ctrl);
2544 + nvme_stop_queues(&ctrl->ctrl);
2545 +@@ -948,6 +963,7 @@ static void nvme_rdma_teardown_io_queues(struct nvme_rdma_ctrl *ctrl,
2546 + nvme_start_queues(&ctrl->ctrl);
2547 + nvme_rdma_destroy_io_queues(ctrl, remove);
2548 + }
2549 ++ mutex_unlock(&ctrl->teardown_lock);
2550 + }
2551 +
2552 + static void nvme_rdma_free_ctrl(struct nvme_ctrl *nctrl)
2553 +@@ -1096,6 +1112,7 @@ static void nvme_rdma_error_recovery(struct nvme_rdma_ctrl *ctrl)
2554 + if (!nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_RESETTING))
2555 + return;
2556 +
2557 ++ dev_warn(ctrl->ctrl.device, "starting error recovery\n");
2558 + queue_work(nvme_reset_wq, &ctrl->err_work);
2559 + }
2560 +
2561 +@@ -1699,6 +1716,22 @@ static int nvme_rdma_cm_handler(struct rdma_cm_id *cm_id,
2562 + return 0;
2563 + }
2564 +
2565 ++static void nvme_rdma_complete_timed_out(struct request *rq)
2566 ++{
2567 ++ struct nvme_rdma_request *req = blk_mq_rq_to_pdu(rq);
2568 ++ struct nvme_rdma_queue *queue = req->queue;
2569 ++ struct nvme_rdma_ctrl *ctrl = queue->ctrl;
2570 ++
2571 ++ /* fence other contexts that may complete the command */
2572 ++ mutex_lock(&ctrl->teardown_lock);
2573 ++ nvme_rdma_stop_queue(queue);
2574 ++ if (!blk_mq_request_completed(rq)) {
2575 ++ nvme_req(rq)->status = NVME_SC_HOST_ABORTED_CMD;
2576 ++ blk_mq_complete_request(rq);
2577 ++ }
2578 ++ mutex_unlock(&ctrl->teardown_lock);
2579 ++}
2580 ++
2581 + static enum blk_eh_timer_return
2582 + nvme_rdma_timeout(struct request *rq, bool reserved)
2583 + {
2584 +@@ -1709,29 +1742,29 @@ nvme_rdma_timeout(struct request *rq, bool reserved)
2585 + dev_warn(ctrl->ctrl.device, "I/O %d QID %d timeout\n",
2586 + rq->tag, nvme_rdma_queue_idx(queue));
2587 +
2588 +- /*
2589 +- * Restart the timer if a controller reset is already scheduled. Any
2590 +- * timed out commands would be handled before entering the connecting
2591 +- * state.
2592 +- */
2593 +- if (ctrl->ctrl.state == NVME_CTRL_RESETTING)
2594 +- return BLK_EH_RESET_TIMER;
2595 +-
2596 + if (ctrl->ctrl.state != NVME_CTRL_LIVE) {
2597 + /*
2598 +- * Teardown immediately if controller times out while starting
2599 +- * or we are already started error recovery. all outstanding
2600 +- * requests are completed on shutdown, so we return BLK_EH_DONE.
2601 ++ * If we are resetting, connecting or deleting we should
2602 ++ * complete immediately because we may block controller
2603 ++ * teardown or setup sequence
2604 ++ * - ctrl disable/shutdown fabrics requests
2605 ++ * - connect requests
2606 ++ * - initialization admin requests
2607 ++ * - I/O requests that entered after unquiescing and
2608 ++ * the controller stopped responding
2609 ++ *
2610 ++ * All other requests should be cancelled by the error
2611 ++ * recovery work, so it's fine that we fail it here.
2612 + */
2613 +- flush_work(&ctrl->err_work);
2614 +- nvme_rdma_teardown_io_queues(ctrl, false);
2615 +- nvme_rdma_teardown_admin_queue(ctrl, false);
2616 ++ nvme_rdma_complete_timed_out(rq);
2617 + return BLK_EH_DONE;
2618 + }
2619 +
2620 +- dev_warn(ctrl->ctrl.device, "starting error recovery\n");
2621 ++ /*
2622 ++ * LIVE state should trigger the normal error recovery which will
2623 ++ * handle completing this request.
2624 ++ */
2625 + nvme_rdma_error_recovery(ctrl);
2626 +-
2627 + return BLK_EH_RESET_TIMER;
2628 + }
2629 +
2630 +@@ -1988,6 +2021,7 @@ static struct nvme_ctrl *nvme_rdma_create_ctrl(struct device *dev,
2631 + return ERR_PTR(-ENOMEM);
2632 + ctrl->ctrl.opts = opts;
2633 + INIT_LIST_HEAD(&ctrl->list);
2634 ++ mutex_init(&ctrl->teardown_lock);
2635 +
2636 + if (!(opts->mask & NVMF_OPT_TRSVCID)) {
2637 + opts->trsvcid =
2638 +diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c
2639 +index 0166ff0e4738e..9b81763b44d99 100644
2640 +--- a/drivers/nvme/host/tcp.c
2641 ++++ b/drivers/nvme/host/tcp.c
2642 +@@ -110,6 +110,7 @@ struct nvme_tcp_ctrl {
2643 + struct sockaddr_storage src_addr;
2644 + struct nvme_ctrl ctrl;
2645 +
2646 ++ struct mutex teardown_lock;
2647 + struct work_struct err_work;
2648 + struct delayed_work connect_work;
2649 + struct nvme_tcp_request async_req;
2650 +@@ -420,6 +421,7 @@ static void nvme_tcp_error_recovery(struct nvme_ctrl *ctrl)
2651 + if (!nvme_change_ctrl_state(ctrl, NVME_CTRL_RESETTING))
2652 + return;
2653 +
2654 ++ dev_warn(ctrl->device, "starting error recovery\n");
2655 + queue_work(nvme_reset_wq, &to_tcp_ctrl(ctrl)->err_work);
2656 + }
2657 +
2658 +@@ -1438,7 +1440,6 @@ static void nvme_tcp_stop_queue(struct nvme_ctrl *nctrl, int qid)
2659 +
2660 + if (!test_and_clear_bit(NVME_TCP_Q_LIVE, &queue->flags))
2661 + return;
2662 +-
2663 + __nvme_tcp_stop_queue(queue);
2664 + }
2665 +
2666 +@@ -1692,7 +1693,15 @@ static int nvme_tcp_configure_io_queues(struct nvme_ctrl *ctrl, bool new)
2667 +
2668 + if (!new) {
2669 + nvme_start_queues(ctrl);
2670 +- nvme_wait_freeze(ctrl);
2671 ++ if (!nvme_wait_freeze_timeout(ctrl, NVME_IO_TIMEOUT)) {
2672 ++ /*
2673 ++ * If we timed out waiting for freeze we are likely to
2674 ++ * be stuck. Fail the controller initialization just
2675 ++ * to be safe.
2676 ++ */
2677 ++ ret = -ENODEV;
2678 ++ goto out_wait_freeze_timed_out;
2679 ++ }
2680 + blk_mq_update_nr_hw_queues(ctrl->tagset,
2681 + ctrl->queue_count - 1);
2682 + nvme_unfreeze(ctrl);
2683 +@@ -1700,6 +1709,9 @@ static int nvme_tcp_configure_io_queues(struct nvme_ctrl *ctrl, bool new)
2684 +
2685 + return 0;
2686 +
2687 ++out_wait_freeze_timed_out:
2688 ++ nvme_stop_queues(ctrl);
2689 ++ nvme_tcp_stop_io_queues(ctrl);
2690 + out_cleanup_connect_q:
2691 + if (new)
2692 + blk_cleanup_queue(ctrl->connect_q);
2693 +@@ -1785,6 +1797,7 @@ out_free_queue:
2694 + static void nvme_tcp_teardown_admin_queue(struct nvme_ctrl *ctrl,
2695 + bool remove)
2696 + {
2697 ++ mutex_lock(&to_tcp_ctrl(ctrl)->teardown_lock);
2698 + blk_mq_quiesce_queue(ctrl->admin_q);
2699 + nvme_tcp_stop_queue(ctrl, 0);
2700 + if (ctrl->admin_tagset) {
2701 +@@ -1795,13 +1808,16 @@ static void nvme_tcp_teardown_admin_queue(struct nvme_ctrl *ctrl,
2702 + if (remove)
2703 + blk_mq_unquiesce_queue(ctrl->admin_q);
2704 + nvme_tcp_destroy_admin_queue(ctrl, remove);
2705 ++ mutex_unlock(&to_tcp_ctrl(ctrl)->teardown_lock);
2706 + }
2707 +
2708 + static void nvme_tcp_teardown_io_queues(struct nvme_ctrl *ctrl,
2709 + bool remove)
2710 + {
2711 ++ mutex_lock(&to_tcp_ctrl(ctrl)->teardown_lock);
2712 + if (ctrl->queue_count <= 1)
2713 +- return;
2714 ++ goto out;
2715 ++ blk_mq_quiesce_queue(ctrl->admin_q);
2716 + nvme_start_freeze(ctrl);
2717 + nvme_stop_queues(ctrl);
2718 + nvme_tcp_stop_io_queues(ctrl);
2719 +@@ -1813,6 +1829,8 @@ static void nvme_tcp_teardown_io_queues(struct nvme_ctrl *ctrl,
2720 + if (remove)
2721 + nvme_start_queues(ctrl);
2722 + nvme_tcp_destroy_io_queues(ctrl, remove);
2723 ++out:
2724 ++ mutex_unlock(&to_tcp_ctrl(ctrl)->teardown_lock);
2725 + }
2726 +
2727 + static void nvme_tcp_reconnect_or_remove(struct nvme_ctrl *ctrl)
2728 +@@ -2051,40 +2069,55 @@ static void nvme_tcp_submit_async_event(struct nvme_ctrl *arg)
2729 + nvme_tcp_queue_request(&ctrl->async_req);
2730 + }
2731 +
2732 ++static void nvme_tcp_complete_timed_out(struct request *rq)
2733 ++{
2734 ++ struct nvme_tcp_request *req = blk_mq_rq_to_pdu(rq);
2735 ++ struct nvme_ctrl *ctrl = &req->queue->ctrl->ctrl;
2736 ++
2737 ++ /* fence other contexts that may complete the command */
2738 ++ mutex_lock(&to_tcp_ctrl(ctrl)->teardown_lock);
2739 ++ nvme_tcp_stop_queue(ctrl, nvme_tcp_queue_id(req->queue));
2740 ++ if (!blk_mq_request_completed(rq)) {
2741 ++ nvme_req(rq)->status = NVME_SC_HOST_ABORTED_CMD;
2742 ++ blk_mq_complete_request(rq);
2743 ++ }
2744 ++ mutex_unlock(&to_tcp_ctrl(ctrl)->teardown_lock);
2745 ++}
2746 ++
2747 + static enum blk_eh_timer_return
2748 + nvme_tcp_timeout(struct request *rq, bool reserved)
2749 + {
2750 + struct nvme_tcp_request *req = blk_mq_rq_to_pdu(rq);
2751 +- struct nvme_tcp_ctrl *ctrl = req->queue->ctrl;
2752 ++ struct nvme_ctrl *ctrl = &req->queue->ctrl->ctrl;
2753 + struct nvme_tcp_cmd_pdu *pdu = req->pdu;
2754 +
2755 +- /*
2756 +- * Restart the timer if a controller reset is already scheduled. Any
2757 +- * timed out commands would be handled before entering the connecting
2758 +- * state.
2759 +- */
2760 +- if (ctrl->ctrl.state == NVME_CTRL_RESETTING)
2761 +- return BLK_EH_RESET_TIMER;
2762 +-
2763 +- dev_warn(ctrl->ctrl.device,
2764 ++ dev_warn(ctrl->device,
2765 + "queue %d: timeout request %#x type %d\n",
2766 + nvme_tcp_queue_id(req->queue), rq->tag, pdu->hdr.type);
2767 +
2768 +- if (ctrl->ctrl.state != NVME_CTRL_LIVE) {
2769 ++ if (ctrl->state != NVME_CTRL_LIVE) {
2770 + /*
2771 +- * Teardown immediately if controller times out while starting
2772 +- * or we are already started error recovery. all outstanding
2773 +- * requests are completed on shutdown, so we return BLK_EH_DONE.
2774 ++ * If we are resetting, connecting or deleting we should
2775 ++ * complete immediately because we may block controller
2776 ++ * teardown or setup sequence
2777 ++ * - ctrl disable/shutdown fabrics requests
2778 ++ * - connect requests
2779 ++ * - initialization admin requests
2780 ++ * - I/O requests that entered after unquiescing and
2781 ++ * the controller stopped responding
2782 ++ *
2783 ++ * All other requests should be cancelled by the error
2784 ++ * recovery work, so it's fine that we fail it here.
2785 + */
2786 +- flush_work(&ctrl->err_work);
2787 +- nvme_tcp_teardown_io_queues(&ctrl->ctrl, false);
2788 +- nvme_tcp_teardown_admin_queue(&ctrl->ctrl, false);
2789 ++ nvme_tcp_complete_timed_out(rq);
2790 + return BLK_EH_DONE;
2791 + }
2792 +
2793 +- dev_warn(ctrl->ctrl.device, "starting error recovery\n");
2794 +- nvme_tcp_error_recovery(&ctrl->ctrl);
2795 +-
2796 ++ /*
2797 ++ * LIVE state should trigger the normal error recovery which will
2798 ++ * handle completing this request.
2799 ++ */
2800 ++ nvme_tcp_error_recovery(ctrl);
2801 + return BLK_EH_RESET_TIMER;
2802 + }
2803 +
2804 +@@ -2311,6 +2344,7 @@ static struct nvme_ctrl *nvme_tcp_create_ctrl(struct device *dev,
2805 + nvme_tcp_reconnect_ctrl_work);
2806 + INIT_WORK(&ctrl->err_work, nvme_tcp_error_recovery_work);
2807 + INIT_WORK(&ctrl->ctrl.reset_work, nvme_reset_ctrl_work);
2808 ++ mutex_init(&ctrl->teardown_lock);
2809 +
2810 + if (!(opts->mask & NVMF_OPT_TRSVCID)) {
2811 + opts->trsvcid =
2812 +diff --git a/drivers/nvme/target/tcp.c b/drivers/nvme/target/tcp.c
2813 +index 22014e76d7714..e31823f19a0fa 100644
2814 +--- a/drivers/nvme/target/tcp.c
2815 ++++ b/drivers/nvme/target/tcp.c
2816 +@@ -150,6 +150,11 @@ static void nvmet_tcp_finish_cmd(struct nvmet_tcp_cmd *cmd);
2817 + static inline u16 nvmet_tcp_cmd_tag(struct nvmet_tcp_queue *queue,
2818 + struct nvmet_tcp_cmd *cmd)
2819 + {
2820 ++ if (unlikely(!queue->nr_cmds)) {
2821 ++ /* We didn't allocate cmds yet, send 0xffff */
2822 ++ return USHRT_MAX;
2823 ++ }
2824 ++
2825 + return cmd - queue->cmds;
2826 + }
2827 +
2828 +@@ -847,7 +852,10 @@ static int nvmet_tcp_handle_h2c_data_pdu(struct nvmet_tcp_queue *queue)
2829 + struct nvme_tcp_data_pdu *data = &queue->pdu.data;
2830 + struct nvmet_tcp_cmd *cmd;
2831 +
2832 +- cmd = &queue->cmds[data->ttag];
2833 ++ if (likely(queue->nr_cmds))
2834 ++ cmd = &queue->cmds[data->ttag];
2835 ++ else
2836 ++ cmd = &queue->connect;
2837 +
2838 + if (le32_to_cpu(data->data_offset) != cmd->rbytes_done) {
2839 + pr_err("ttag %u unexpected data offset %u (expected %u)\n",
2840 +diff --git a/drivers/phy/qualcomm/phy-qcom-qmp.c b/drivers/phy/qualcomm/phy-qcom-qmp.c
2841 +index 27dd20a7fe131..5ddbf9a1f328b 100644
2842 +--- a/drivers/phy/qualcomm/phy-qcom-qmp.c
2843 ++++ b/drivers/phy/qualcomm/phy-qcom-qmp.c
2844 +@@ -402,8 +402,8 @@ static const struct qmp_phy_init_tbl ipq8074_pcie_serdes_tbl[] = {
2845 + QMP_PHY_INIT_CFG(QSERDES_COM_BG_TRIM, 0xf),
2846 + QMP_PHY_INIT_CFG(QSERDES_COM_LOCK_CMP_EN, 0x1),
2847 + QMP_PHY_INIT_CFG(QSERDES_COM_VCO_TUNE_MAP, 0x0),
2848 +- QMP_PHY_INIT_CFG(QSERDES_COM_VCO_TUNE_TIMER1, 0x1f),
2849 +- QMP_PHY_INIT_CFG(QSERDES_COM_VCO_TUNE_TIMER2, 0x3f),
2850 ++ QMP_PHY_INIT_CFG(QSERDES_COM_VCO_TUNE_TIMER1, 0xff),
2851 ++ QMP_PHY_INIT_CFG(QSERDES_COM_VCO_TUNE_TIMER2, 0x1f),
2852 + QMP_PHY_INIT_CFG(QSERDES_COM_CMN_CONFIG, 0x6),
2853 + QMP_PHY_INIT_CFG(QSERDES_COM_PLL_IVCO, 0xf),
2854 + QMP_PHY_INIT_CFG(QSERDES_COM_HSCLK_SEL, 0x0),
2855 +@@ -429,7 +429,6 @@ static const struct qmp_phy_init_tbl ipq8074_pcie_serdes_tbl[] = {
2856 + QMP_PHY_INIT_CFG(QSERDES_COM_INTEGLOOP_GAIN1_MODE0, 0x0),
2857 + QMP_PHY_INIT_CFG(QSERDES_COM_INTEGLOOP_GAIN0_MODE0, 0x80),
2858 + QMP_PHY_INIT_CFG(QSERDES_COM_BIAS_EN_CTRL_BY_PSM, 0x1),
2859 +- QMP_PHY_INIT_CFG(QSERDES_COM_VCO_TUNE_CTRL, 0xa),
2860 + QMP_PHY_INIT_CFG(QSERDES_COM_SSC_EN_CENTER, 0x1),
2861 + QMP_PHY_INIT_CFG(QSERDES_COM_SSC_PER1, 0x31),
2862 + QMP_PHY_INIT_CFG(QSERDES_COM_SSC_PER2, 0x1),
2863 +@@ -438,7 +437,6 @@ static const struct qmp_phy_init_tbl ipq8074_pcie_serdes_tbl[] = {
2864 + QMP_PHY_INIT_CFG(QSERDES_COM_SSC_STEP_SIZE1, 0x2f),
2865 + QMP_PHY_INIT_CFG(QSERDES_COM_SSC_STEP_SIZE2, 0x19),
2866 + QMP_PHY_INIT_CFG(QSERDES_COM_CLK_EP_DIV, 0x19),
2867 +- QMP_PHY_INIT_CFG(QSERDES_RX_SIGDET_CNTRL, 0x7),
2868 + };
2869 +
2870 + static const struct qmp_phy_init_tbl ipq8074_pcie_tx_tbl[] = {
2871 +@@ -446,6 +444,8 @@ static const struct qmp_phy_init_tbl ipq8074_pcie_tx_tbl[] = {
2872 + QMP_PHY_INIT_CFG(QSERDES_TX_LANE_MODE, 0x6),
2873 + QMP_PHY_INIT_CFG(QSERDES_TX_RES_CODE_LANE_OFFSET, 0x2),
2874 + QMP_PHY_INIT_CFG(QSERDES_TX_RCV_DETECT_LVL_2, 0x12),
2875 ++ QMP_PHY_INIT_CFG(QSERDES_TX_EMP_POST1_LVL, 0x36),
2876 ++ QMP_PHY_INIT_CFG(QSERDES_TX_SLEW_CNTL, 0x0a),
2877 + };
2878 +
2879 + static const struct qmp_phy_init_tbl ipq8074_pcie_rx_tbl[] = {
2880 +@@ -456,7 +456,6 @@ static const struct qmp_phy_init_tbl ipq8074_pcie_rx_tbl[] = {
2881 + QMP_PHY_INIT_CFG(QSERDES_RX_RX_EQU_ADAPTOR_CNTRL4, 0xdb),
2882 + QMP_PHY_INIT_CFG(QSERDES_RX_UCDR_SO_SATURATION_AND_ENABLE, 0x4b),
2883 + QMP_PHY_INIT_CFG(QSERDES_RX_UCDR_SO_GAIN, 0x4),
2884 +- QMP_PHY_INIT_CFG(QSERDES_RX_UCDR_SO_GAIN_HALF, 0x4),
2885 + };
2886 +
2887 + static const struct qmp_phy_init_tbl ipq8074_pcie_pcs_tbl[] = {
2888 +@@ -1107,6 +1106,9 @@ static const struct qmp_phy_cfg msm8996_usb3phy_cfg = {
2889 + .pwrdn_ctrl = SW_PWRDN,
2890 + };
2891 +
2892 ++static const char * const ipq8074_pciephy_clk_l[] = {
2893 ++ "aux", "cfg_ahb",
2894 ++};
2895 + /* list of resets */
2896 + static const char * const ipq8074_pciephy_reset_l[] = {
2897 + "phy", "common",
2898 +@@ -1124,8 +1126,8 @@ static const struct qmp_phy_cfg ipq8074_pciephy_cfg = {
2899 + .rx_tbl_num = ARRAY_SIZE(ipq8074_pcie_rx_tbl),
2900 + .pcs_tbl = ipq8074_pcie_pcs_tbl,
2901 + .pcs_tbl_num = ARRAY_SIZE(ipq8074_pcie_pcs_tbl),
2902 +- .clk_list = NULL,
2903 +- .num_clks = 0,
2904 ++ .clk_list = ipq8074_pciephy_clk_l,
2905 ++ .num_clks = ARRAY_SIZE(ipq8074_pciephy_clk_l),
2906 + .reset_list = ipq8074_pciephy_reset_l,
2907 + .num_resets = ARRAY_SIZE(ipq8074_pciephy_reset_l),
2908 + .vreg_list = NULL,
2909 +diff --git a/drivers/phy/qualcomm/phy-qcom-qmp.h b/drivers/phy/qualcomm/phy-qcom-qmp.h
2910 +index 335ea5d7ef400..f6b1e6359b8ca 100644
2911 +--- a/drivers/phy/qualcomm/phy-qcom-qmp.h
2912 ++++ b/drivers/phy/qualcomm/phy-qcom-qmp.h
2913 +@@ -77,6 +77,8 @@
2914 + #define QSERDES_COM_CORECLK_DIV_MODE1 0x1bc
2915 +
2916 + /* Only for QMP V2 PHY - TX registers */
2917 ++#define QSERDES_TX_EMP_POST1_LVL 0x018
2918 ++#define QSERDES_TX_SLEW_CNTL 0x040
2919 + #define QSERDES_TX_RES_CODE_LANE_OFFSET 0x054
2920 + #define QSERDES_TX_DEBUG_BUS_SEL 0x064
2921 + #define QSERDES_TX_HIGHZ_TRANSCEIVEREN_BIAS_DRVR_EN 0x068
2922 +diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
2923 +index a17aebe0aa7a7..55fc80de5ef16 100644
2924 +--- a/drivers/regulator/core.c
2925 ++++ b/drivers/regulator/core.c
2926 +@@ -235,8 +235,8 @@ static bool regulator_supply_is_couple(struct regulator_dev *rdev)
2927 + static void regulator_unlock_recursive(struct regulator_dev *rdev,
2928 + unsigned int n_coupled)
2929 + {
2930 +- struct regulator_dev *c_rdev;
2931 +- int i;
2932 ++ struct regulator_dev *c_rdev, *supply_rdev;
2933 ++ int i, supply_n_coupled;
2934 +
2935 + for (i = n_coupled; i > 0; i--) {
2936 + c_rdev = rdev->coupling_desc.coupled_rdevs[i - 1];
2937 +@@ -244,10 +244,13 @@ static void regulator_unlock_recursive(struct regulator_dev *rdev,
2938 + if (!c_rdev)
2939 + continue;
2940 +
2941 +- if (c_rdev->supply && !regulator_supply_is_couple(c_rdev))
2942 +- regulator_unlock_recursive(
2943 +- c_rdev->supply->rdev,
2944 +- c_rdev->coupling_desc.n_coupled);
2945 ++ if (c_rdev->supply && !regulator_supply_is_couple(c_rdev)) {
2946 ++ supply_rdev = c_rdev->supply->rdev;
2947 ++ supply_n_coupled = supply_rdev->coupling_desc.n_coupled;
2948 ++
2949 ++ regulator_unlock_recursive(supply_rdev,
2950 ++ supply_n_coupled);
2951 ++ }
2952 +
2953 + regulator_unlock(c_rdev);
2954 + }
2955 +@@ -1456,7 +1459,7 @@ static int set_consumer_device_supply(struct regulator_dev *rdev,
2956 + const char *consumer_dev_name,
2957 + const char *supply)
2958 + {
2959 +- struct regulator_map *node;
2960 ++ struct regulator_map *node, *new_node;
2961 + int has_dev;
2962 +
2963 + if (supply == NULL)
2964 +@@ -1467,6 +1470,22 @@ static int set_consumer_device_supply(struct regulator_dev *rdev,
2965 + else
2966 + has_dev = 0;
2967 +
2968 ++ new_node = kzalloc(sizeof(struct regulator_map), GFP_KERNEL);
2969 ++ if (new_node == NULL)
2970 ++ return -ENOMEM;
2971 ++
2972 ++ new_node->regulator = rdev;
2973 ++ new_node->supply = supply;
2974 ++
2975 ++ if (has_dev) {
2976 ++ new_node->dev_name = kstrdup(consumer_dev_name, GFP_KERNEL);
2977 ++ if (new_node->dev_name == NULL) {
2978 ++ kfree(new_node);
2979 ++ return -ENOMEM;
2980 ++ }
2981 ++ }
2982 ++
2983 ++ mutex_lock(&regulator_list_mutex);
2984 + list_for_each_entry(node, &regulator_map_list, list) {
2985 + if (node->dev_name && consumer_dev_name) {
2986 + if (strcmp(node->dev_name, consumer_dev_name) != 0)
2987 +@@ -1484,26 +1503,19 @@ static int set_consumer_device_supply(struct regulator_dev *rdev,
2988 + node->regulator->desc->name,
2989 + supply,
2990 + dev_name(&rdev->dev), rdev_get_name(rdev));
2991 +- return -EBUSY;
2992 ++ goto fail;
2993 + }
2994 +
2995 +- node = kzalloc(sizeof(struct regulator_map), GFP_KERNEL);
2996 +- if (node == NULL)
2997 +- return -ENOMEM;
2998 +-
2999 +- node->regulator = rdev;
3000 +- node->supply = supply;
3001 +-
3002 +- if (has_dev) {
3003 +- node->dev_name = kstrdup(consumer_dev_name, GFP_KERNEL);
3004 +- if (node->dev_name == NULL) {
3005 +- kfree(node);
3006 +- return -ENOMEM;
3007 +- }
3008 +- }
3009 ++ list_add(&new_node->list, &regulator_map_list);
3010 ++ mutex_unlock(&regulator_list_mutex);
3011 +
3012 +- list_add(&node->list, &regulator_map_list);
3013 + return 0;
3014 ++
3015 ++fail:
3016 ++ mutex_unlock(&regulator_list_mutex);
3017 ++ kfree(new_node->dev_name);
3018 ++ kfree(new_node);
3019 ++ return -EBUSY;
3020 + }
3021 +
3022 + static void unset_regulator_supplies(struct regulator_dev *rdev)
3023 +@@ -1575,44 +1587,53 @@ static struct regulator *create_regulator(struct regulator_dev *rdev,
3024 + const char *supply_name)
3025 + {
3026 + struct regulator *regulator;
3027 +- char buf[REG_STR_SIZE];
3028 +- int err, size;
3029 ++ int err;
3030 ++
3031 ++ if (dev) {
3032 ++ char buf[REG_STR_SIZE];
3033 ++ int size;
3034 ++
3035 ++ size = snprintf(buf, REG_STR_SIZE, "%s-%s",
3036 ++ dev->kobj.name, supply_name);
3037 ++ if (size >= REG_STR_SIZE)
3038 ++ return NULL;
3039 ++
3040 ++ supply_name = kstrdup(buf, GFP_KERNEL);
3041 ++ if (supply_name == NULL)
3042 ++ return NULL;
3043 ++ } else {
3044 ++ supply_name = kstrdup_const(supply_name, GFP_KERNEL);
3045 ++ if (supply_name == NULL)
3046 ++ return NULL;
3047 ++ }
3048 +
3049 + regulator = kzalloc(sizeof(*regulator), GFP_KERNEL);
3050 +- if (regulator == NULL)
3051 ++ if (regulator == NULL) {
3052 ++ kfree(supply_name);
3053 + return NULL;
3054 ++ }
3055 +
3056 +- regulator_lock(rdev);
3057 + regulator->rdev = rdev;
3058 ++ regulator->supply_name = supply_name;
3059 ++
3060 ++ regulator_lock(rdev);
3061 + list_add(&regulator->list, &rdev->consumer_list);
3062 ++ regulator_unlock(rdev);
3063 +
3064 + if (dev) {
3065 + regulator->dev = dev;
3066 +
3067 + /* Add a link to the device sysfs entry */
3068 +- size = snprintf(buf, REG_STR_SIZE, "%s-%s",
3069 +- dev->kobj.name, supply_name);
3070 +- if (size >= REG_STR_SIZE)
3071 +- goto overflow_err;
3072 +-
3073 +- regulator->supply_name = kstrdup(buf, GFP_KERNEL);
3074 +- if (regulator->supply_name == NULL)
3075 +- goto overflow_err;
3076 +-
3077 + err = sysfs_create_link_nowarn(&rdev->dev.kobj, &dev->kobj,
3078 +- buf);
3079 ++ supply_name);
3080 + if (err) {
3081 + rdev_dbg(rdev, "could not add device link %s err %d\n",
3082 + dev->kobj.name, err);
3083 + /* non-fatal */
3084 + }
3085 +- } else {
3086 +- regulator->supply_name = kstrdup_const(supply_name, GFP_KERNEL);
3087 +- if (regulator->supply_name == NULL)
3088 +- goto overflow_err;
3089 + }
3090 +
3091 +- regulator->debugfs = debugfs_create_dir(regulator->supply_name,
3092 ++ regulator->debugfs = debugfs_create_dir(supply_name,
3093 + rdev->debugfs);
3094 + if (!regulator->debugfs) {
3095 + rdev_dbg(rdev, "Failed to create debugfs directory\n");
3096 +@@ -1637,13 +1658,7 @@ static struct regulator *create_regulator(struct regulator_dev *rdev,
3097 + _regulator_is_enabled(rdev))
3098 + regulator->always_on = true;
3099 +
3100 +- regulator_unlock(rdev);
3101 + return regulator;
3102 +-overflow_err:
3103 +- list_del(&regulator->list);
3104 +- kfree(regulator);
3105 +- regulator_unlock(rdev);
3106 +- return NULL;
3107 + }
3108 +
3109 + static int _regulator_get_enable_time(struct regulator_dev *rdev)
3110 +@@ -2217,10 +2232,13 @@ EXPORT_SYMBOL_GPL(regulator_bulk_unregister_supply_alias);
3111 + static int regulator_ena_gpio_request(struct regulator_dev *rdev,
3112 + const struct regulator_config *config)
3113 + {
3114 +- struct regulator_enable_gpio *pin;
3115 ++ struct regulator_enable_gpio *pin, *new_pin;
3116 + struct gpio_desc *gpiod;
3117 +
3118 + gpiod = config->ena_gpiod;
3119 ++ new_pin = kzalloc(sizeof(*new_pin), GFP_KERNEL);
3120 ++
3121 ++ mutex_lock(&regulator_list_mutex);
3122 +
3123 + list_for_each_entry(pin, &regulator_ena_gpio_list, list) {
3124 + if (pin->gpiod == gpiod) {
3125 +@@ -2229,9 +2247,13 @@ static int regulator_ena_gpio_request(struct regulator_dev *rdev,
3126 + }
3127 + }
3128 +
3129 +- pin = kzalloc(sizeof(struct regulator_enable_gpio), GFP_KERNEL);
3130 +- if (pin == NULL)
3131 ++ if (new_pin == NULL) {
3132 ++ mutex_unlock(&regulator_list_mutex);
3133 + return -ENOMEM;
3134 ++ }
3135 ++
3136 ++ pin = new_pin;
3137 ++ new_pin = NULL;
3138 +
3139 + pin->gpiod = gpiod;
3140 + list_add(&pin->list, &regulator_ena_gpio_list);
3141 +@@ -2239,6 +2261,10 @@ static int regulator_ena_gpio_request(struct regulator_dev *rdev,
3142 + update_ena_gpio_to_rdev:
3143 + pin->request_count++;
3144 + rdev->ena_pin = pin;
3145 ++
3146 ++ mutex_unlock(&regulator_list_mutex);
3147 ++ kfree(new_pin);
3148 ++
3149 + return 0;
3150 + }
3151 +
3152 +@@ -4857,13 +4883,9 @@ static void regulator_resolve_coupling(struct regulator_dev *rdev)
3153 + return;
3154 + }
3155 +
3156 +- regulator_lock(c_rdev);
3157 +-
3158 + c_desc->coupled_rdevs[i] = c_rdev;
3159 + c_desc->n_resolved++;
3160 +
3161 +- regulator_unlock(c_rdev);
3162 +-
3163 + regulator_resolve_coupling(c_rdev);
3164 + }
3165 + }
3166 +@@ -4948,7 +4970,10 @@ static int regulator_init_coupling(struct regulator_dev *rdev)
3167 + if (!of_check_coupling_data(rdev))
3168 + return -EPERM;
3169 +
3170 ++ mutex_lock(&regulator_list_mutex);
3171 + rdev->coupling_desc.coupler = regulator_find_coupler(rdev);
3172 ++ mutex_unlock(&regulator_list_mutex);
3173 ++
3174 + if (IS_ERR(rdev->coupling_desc.coupler)) {
3175 + err = PTR_ERR(rdev->coupling_desc.coupler);
3176 + rdev_err(rdev, "failed to get coupler: %d\n", err);
3177 +@@ -5043,6 +5068,7 @@ regulator_register(const struct regulator_desc *regulator_desc,
3178 + ret = -ENOMEM;
3179 + goto rinse;
3180 + }
3181 ++ device_initialize(&rdev->dev);
3182 +
3183 + /*
3184 + * Duplicate the config so the driver could override it after
3185 +@@ -5050,9 +5076,8 @@ regulator_register(const struct regulator_desc *regulator_desc,
3186 + */
3187 + config = kmemdup(cfg, sizeof(*cfg), GFP_KERNEL);
3188 + if (config == NULL) {
3189 +- kfree(rdev);
3190 + ret = -ENOMEM;
3191 +- goto rinse;
3192 ++ goto clean;
3193 + }
3194 +
3195 + init_data = regulator_of_get_init_data(dev, regulator_desc, config,
3196 +@@ -5064,10 +5089,8 @@ regulator_register(const struct regulator_desc *regulator_desc,
3197 + * from a gpio extender or something else.
3198 + */
3199 + if (PTR_ERR(init_data) == -EPROBE_DEFER) {
3200 +- kfree(config);
3201 +- kfree(rdev);
3202 + ret = -EPROBE_DEFER;
3203 +- goto rinse;
3204 ++ goto clean;
3205 + }
3206 +
3207 + /*
3208 +@@ -5108,9 +5131,7 @@ regulator_register(const struct regulator_desc *regulator_desc,
3209 + }
3210 +
3211 + if (config->ena_gpiod) {
3212 +- mutex_lock(&regulator_list_mutex);
3213 + ret = regulator_ena_gpio_request(rdev, config);
3214 +- mutex_unlock(&regulator_list_mutex);
3215 + if (ret != 0) {
3216 + rdev_err(rdev, "Failed to request enable GPIO: %d\n",
3217 + ret);
3218 +@@ -5122,7 +5143,6 @@ regulator_register(const struct regulator_desc *regulator_desc,
3219 + }
3220 +
3221 + /* register with sysfs */
3222 +- device_initialize(&rdev->dev);
3223 + rdev->dev.class = &regulator_class;
3224 + rdev->dev.parent = dev;
3225 + dev_set_name(&rdev->dev, "regulator.%lu",
3226 +@@ -5150,27 +5170,22 @@ regulator_register(const struct regulator_desc *regulator_desc,
3227 + if (ret < 0)
3228 + goto wash;
3229 +
3230 +- mutex_lock(&regulator_list_mutex);
3231 + ret = regulator_init_coupling(rdev);
3232 +- mutex_unlock(&regulator_list_mutex);
3233 + if (ret < 0)
3234 + goto wash;
3235 +
3236 + /* add consumers devices */
3237 + if (init_data) {
3238 +- mutex_lock(&regulator_list_mutex);
3239 + for (i = 0; i < init_data->num_consumer_supplies; i++) {
3240 + ret = set_consumer_device_supply(rdev,
3241 + init_data->consumer_supplies[i].dev_name,
3242 + init_data->consumer_supplies[i].supply);
3243 + if (ret < 0) {
3244 +- mutex_unlock(&regulator_list_mutex);
3245 + dev_err(dev, "Failed to set supply %s\n",
3246 + init_data->consumer_supplies[i].supply);
3247 + goto unset_supplies;
3248 + }
3249 + }
3250 +- mutex_unlock(&regulator_list_mutex);
3251 + }
3252 +
3253 + if (!rdev->desc->ops->get_voltage &&
3254 +@@ -5205,13 +5220,11 @@ wash:
3255 + mutex_lock(&regulator_list_mutex);
3256 + regulator_ena_gpio_free(rdev);
3257 + mutex_unlock(&regulator_list_mutex);
3258 +- put_device(&rdev->dev);
3259 +- rdev = NULL;
3260 + clean:
3261 + if (dangling_of_gpiod)
3262 + gpiod_put(config->ena_gpiod);
3263 +- kfree(rdev);
3264 + kfree(config);
3265 ++ put_device(&rdev->dev);
3266 + rinse:
3267 + if (dangling_cfg_gpiod)
3268 + gpiod_put(cfg->ena_gpiod);
3269 +diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c
3270 +index e9e00740f7ca6..dd755a56cf521 100644
3271 +--- a/drivers/scsi/libsas/sas_ata.c
3272 ++++ b/drivers/scsi/libsas/sas_ata.c
3273 +@@ -208,7 +208,10 @@ static unsigned int sas_ata_qc_issue(struct ata_queued_cmd *qc)
3274 + task->num_scatter = si;
3275 + }
3276 +
3277 +- task->data_dir = qc->dma_dir;
3278 ++ if (qc->tf.protocol == ATA_PROT_NODATA)
3279 ++ task->data_dir = DMA_NONE;
3280 ++ else
3281 ++ task->data_dir = qc->dma_dir;
3282 + task->scatter = qc->sg;
3283 + task->ata_task.retry_count = 1;
3284 + task->task_state_flags = SAS_TASK_STATE_PENDING;
3285 +diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c
3286 +index 5bcef9769740b..5dcd7b9b72ced 100644
3287 +--- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
3288 ++++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
3289 +@@ -3738,7 +3738,7 @@ int megasas_irqpoll(struct irq_poll *irqpoll, int budget)
3290 + instance = irq_ctx->instance;
3291 +
3292 + if (irq_ctx->irq_line_enable) {
3293 +- disable_irq(irq_ctx->os_irq);
3294 ++ disable_irq_nosync(irq_ctx->os_irq);
3295 + irq_ctx->irq_line_enable = false;
3296 + }
3297 +
3298 +diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c
3299 +index 7fd1d731555f9..b7e44634d0dc2 100644
3300 +--- a/drivers/scsi/mpt3sas/mpt3sas_base.c
3301 ++++ b/drivers/scsi/mpt3sas/mpt3sas_base.c
3302 +@@ -1632,7 +1632,7 @@ _base_irqpoll(struct irq_poll *irqpoll, int budget)
3303 + reply_q = container_of(irqpoll, struct adapter_reply_queue,
3304 + irqpoll);
3305 + if (reply_q->irq_line_enable) {
3306 +- disable_irq(reply_q->os_irq);
3307 ++ disable_irq_nosync(reply_q->os_irq);
3308 + reply_q->irq_line_enable = false;
3309 + }
3310 + num_entries = _base_process_reply_queue(reply_q);
3311 +diff --git a/drivers/soundwire/stream.c b/drivers/soundwire/stream.c
3312 +index e69f94a8c3a86..de7c57e17710a 100644
3313 +--- a/drivers/soundwire/stream.c
3314 ++++ b/drivers/soundwire/stream.c
3315 +@@ -702,6 +702,7 @@ error:
3316 + kfree(wbuf);
3317 + error_1:
3318 + kfree(wr_msg);
3319 ++ bus->defer_msg.msg = NULL;
3320 + return ret;
3321 + }
3322 +
3323 +@@ -825,9 +826,10 @@ static int do_bank_switch(struct sdw_stream_runtime *stream)
3324 + error:
3325 + list_for_each_entry(m_rt, &stream->master_list, stream_node) {
3326 + bus = m_rt->bus;
3327 +-
3328 +- kfree(bus->defer_msg.msg->buf);
3329 +- kfree(bus->defer_msg.msg);
3330 ++ if (bus->defer_msg.msg) {
3331 ++ kfree(bus->defer_msg.msg->buf);
3332 ++ kfree(bus->defer_msg.msg);
3333 ++ }
3334 + }
3335 +
3336 + msg_unlock:
3337 +diff --git a/drivers/spi/spi-stm32.c b/drivers/spi/spi-stm32.c
3338 +index 8146c2d91d307..9d8ceb63f7db1 100644
3339 +--- a/drivers/spi/spi-stm32.c
3340 ++++ b/drivers/spi/spi-stm32.c
3341 +@@ -931,7 +931,11 @@ static irqreturn_t stm32h7_spi_irq_thread(int irq, void *dev_id)
3342 + }
3343 +
3344 + if (sr & STM32H7_SPI_SR_SUSP) {
3345 +- dev_warn(spi->dev, "Communication suspended\n");
3346 ++ static DEFINE_RATELIMIT_STATE(rs,
3347 ++ DEFAULT_RATELIMIT_INTERVAL * 10,
3348 ++ 1);
3349 ++ if (__ratelimit(&rs))
3350 ++ dev_dbg_ratelimited(spi->dev, "Communication suspended\n");
3351 + if (!spi->cur_usedma && (spi->rx_buf && (spi->rx_len > 0)))
3352 + stm32h7_spi_read_rxfifo(spi, false);
3353 + /*
3354 +@@ -2050,7 +2054,7 @@ static int stm32_spi_resume(struct device *dev)
3355 + }
3356 +
3357 + ret = pm_runtime_get_sync(dev);
3358 +- if (ret) {
3359 ++ if (ret < 0) {
3360 + dev_err(dev, "Unable to power device:%d\n", ret);
3361 + return ret;
3362 + }
3363 +diff --git a/drivers/staging/greybus/audio_topology.c b/drivers/staging/greybus/audio_topology.c
3364 +index 4ac30accf226a..cc329b990e165 100644
3365 +--- a/drivers/staging/greybus/audio_topology.c
3366 ++++ b/drivers/staging/greybus/audio_topology.c
3367 +@@ -460,6 +460,15 @@ static int gbcodec_mixer_dapm_ctl_put(struct snd_kcontrol *kcontrol,
3368 + val = ucontrol->value.integer.value[0] & mask;
3369 + connect = !!val;
3370 +
3371 ++ ret = gb_pm_runtime_get_sync(bundle);
3372 ++ if (ret)
3373 ++ return ret;
3374 ++
3375 ++ ret = gb_audio_gb_get_control(module->mgmt_connection, data->ctl_id,
3376 ++ GB_AUDIO_INVALID_INDEX, &gbvalue);
3377 ++ if (ret)
3378 ++ goto exit;
3379 ++
3380 + /* update ucontrol */
3381 + if (gbvalue.value.integer_value[0] != val) {
3382 + for (wi = 0; wi < wlist->num_widgets; wi++) {
3383 +@@ -473,25 +482,17 @@ static int gbcodec_mixer_dapm_ctl_put(struct snd_kcontrol *kcontrol,
3384 + gbvalue.value.integer_value[0] =
3385 + cpu_to_le32(ucontrol->value.integer.value[0]);
3386 +
3387 +- ret = gb_pm_runtime_get_sync(bundle);
3388 +- if (ret)
3389 +- return ret;
3390 +-
3391 + ret = gb_audio_gb_set_control(module->mgmt_connection,
3392 + data->ctl_id,
3393 + GB_AUDIO_INVALID_INDEX, &gbvalue);
3394 +-
3395 +- gb_pm_runtime_put_autosuspend(bundle);
3396 +-
3397 +- if (ret) {
3398 +- dev_err_ratelimited(codec->dev,
3399 +- "%d:Error in %s for %s\n", ret,
3400 +- __func__, kcontrol->id.name);
3401 +- return ret;
3402 +- }
3403 + }
3404 +
3405 +- return 0;
3406 ++exit:
3407 ++ gb_pm_runtime_put_autosuspend(bundle);
3408 ++ if (ret)
3409 ++ dev_err_ratelimited(codec_dev, "%d:Error in %s for %s\n", ret,
3410 ++ __func__, kcontrol->id.name);
3411 ++ return ret;
3412 + }
3413 +
3414 + #define SOC_DAPM_MIXER_GB(xname, kcount, data) \
3415 +diff --git a/drivers/staging/wlan-ng/hfa384x_usb.c b/drivers/staging/wlan-ng/hfa384x_usb.c
3416 +index e29c14e0ed498..ed4ff78dd02aa 100644
3417 +--- a/drivers/staging/wlan-ng/hfa384x_usb.c
3418 ++++ b/drivers/staging/wlan-ng/hfa384x_usb.c
3419 +@@ -526,13 +526,8 @@ static void hfa384x_usb_defer(struct work_struct *data)
3420 + */
3421 + void hfa384x_create(struct hfa384x *hw, struct usb_device *usb)
3422 + {
3423 +- memset(hw, 0, sizeof(*hw));
3424 + hw->usb = usb;
3425 +
3426 +- /* set up the endpoints */
3427 +- hw->endp_in = usb_rcvbulkpipe(usb, 1);
3428 +- hw->endp_out = usb_sndbulkpipe(usb, 2);
3429 +-
3430 + /* Set up the waitq */
3431 + init_waitqueue_head(&hw->cmdq);
3432 +
3433 +diff --git a/drivers/staging/wlan-ng/prism2usb.c b/drivers/staging/wlan-ng/prism2usb.c
3434 +index 8d32b1603d10a..9eee72aff7233 100644
3435 +--- a/drivers/staging/wlan-ng/prism2usb.c
3436 ++++ b/drivers/staging/wlan-ng/prism2usb.c
3437 +@@ -61,23 +61,14 @@ static int prism2sta_probe_usb(struct usb_interface *interface,
3438 + const struct usb_device_id *id)
3439 + {
3440 + struct usb_device *dev;
3441 +- const struct usb_endpoint_descriptor *epd;
3442 +- const struct usb_host_interface *iface_desc = interface->cur_altsetting;
3443 ++ struct usb_endpoint_descriptor *bulk_in, *bulk_out;
3444 ++ struct usb_host_interface *iface_desc = interface->cur_altsetting;
3445 + struct wlandevice *wlandev = NULL;
3446 + struct hfa384x *hw = NULL;
3447 + int result = 0;
3448 +
3449 +- if (iface_desc->desc.bNumEndpoints != 2) {
3450 +- result = -ENODEV;
3451 +- goto failed;
3452 +- }
3453 +-
3454 +- result = -EINVAL;
3455 +- epd = &iface_desc->endpoint[1].desc;
3456 +- if (!usb_endpoint_is_bulk_in(epd))
3457 +- goto failed;
3458 +- epd = &iface_desc->endpoint[2].desc;
3459 +- if (!usb_endpoint_is_bulk_out(epd))
3460 ++ result = usb_find_common_endpoints(iface_desc, &bulk_in, &bulk_out, NULL, NULL);
3461 ++ if (result)
3462 + goto failed;
3463 +
3464 + dev = interface_to_usbdev(interface);
3465 +@@ -96,6 +87,8 @@ static int prism2sta_probe_usb(struct usb_interface *interface,
3466 + }
3467 +
3468 + /* Initialize the hw data */
3469 ++ hw->endp_in = usb_rcvbulkpipe(dev, bulk_in->bEndpointAddress);
3470 ++ hw->endp_out = usb_sndbulkpipe(dev, bulk_out->bEndpointAddress);
3471 + hfa384x_create(hw, dev);
3472 + hw->wlandev = wlandev;
3473 +
3474 +diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c
3475 +index d1ce94c608a9f..bca183369ad8b 100644
3476 +--- a/drivers/target/iscsi/iscsi_target.c
3477 ++++ b/drivers/target/iscsi/iscsi_target.c
3478 +@@ -1386,14 +1386,27 @@ static u32 iscsit_do_crypto_hash_sg(
3479 + sg = cmd->first_data_sg;
3480 + page_off = cmd->first_data_sg_off;
3481 +
3482 ++ if (data_length && page_off) {
3483 ++ struct scatterlist first_sg;
3484 ++ u32 len = min_t(u32, data_length, sg->length - page_off);
3485 ++
3486 ++ sg_init_table(&first_sg, 1);
3487 ++ sg_set_page(&first_sg, sg_page(sg), len, sg->offset + page_off);
3488 ++
3489 ++ ahash_request_set_crypt(hash, &first_sg, NULL, len);
3490 ++ crypto_ahash_update(hash);
3491 ++
3492 ++ data_length -= len;
3493 ++ sg = sg_next(sg);
3494 ++ }
3495 ++
3496 + while (data_length) {
3497 +- u32 cur_len = min_t(u32, data_length, (sg->length - page_off));
3498 ++ u32 cur_len = min_t(u32, data_length, sg->length);
3499 +
3500 + ahash_request_set_crypt(hash, sg, NULL, cur_len);
3501 + crypto_ahash_update(hash);
3502 +
3503 + data_length -= cur_len;
3504 +- page_off = 0;
3505 + /* iscsit_map_iovec has already checked for invalid sg pointers */
3506 + sg = sg_next(sg);
3507 + }
3508 +diff --git a/drivers/target/iscsi/iscsi_target_login.c b/drivers/target/iscsi/iscsi_target_login.c
3509 +index 731ee67fe914b..0cc5ea195273f 100644
3510 +--- a/drivers/target/iscsi/iscsi_target_login.c
3511 ++++ b/drivers/target/iscsi/iscsi_target_login.c
3512 +@@ -1172,7 +1172,7 @@ void iscsit_free_conn(struct iscsi_conn *conn)
3513 + }
3514 +
3515 + void iscsi_target_login_sess_out(struct iscsi_conn *conn,
3516 +- struct iscsi_np *np, bool zero_tsih, bool new_sess)
3517 ++ bool zero_tsih, bool new_sess)
3518 + {
3519 + if (!new_sess)
3520 + goto old_sess_out;
3521 +@@ -1190,7 +1190,6 @@ void iscsi_target_login_sess_out(struct iscsi_conn *conn,
3522 + conn->sess = NULL;
3523 +
3524 + old_sess_out:
3525 +- iscsi_stop_login_thread_timer(np);
3526 + /*
3527 + * If login negotiation fails check if the Time2Retain timer
3528 + * needs to be restarted.
3529 +@@ -1430,8 +1429,9 @@ static int __iscsi_target_login_thread(struct iscsi_np *np)
3530 + new_sess_out:
3531 + new_sess = true;
3532 + old_sess_out:
3533 ++ iscsi_stop_login_thread_timer(np);
3534 + tpg_np = conn->tpg_np;
3535 +- iscsi_target_login_sess_out(conn, np, zero_tsih, new_sess);
3536 ++ iscsi_target_login_sess_out(conn, zero_tsih, new_sess);
3537 + new_sess = false;
3538 +
3539 + if (tpg) {
3540 +diff --git a/drivers/target/iscsi/iscsi_target_login.h b/drivers/target/iscsi/iscsi_target_login.h
3541 +index 3b8e3639ff5d0..fc95e6150253f 100644
3542 +--- a/drivers/target/iscsi/iscsi_target_login.h
3543 ++++ b/drivers/target/iscsi/iscsi_target_login.h
3544 +@@ -22,8 +22,7 @@ extern int iscsit_put_login_tx(struct iscsi_conn *, struct iscsi_login *, u32);
3545 + extern void iscsit_free_conn(struct iscsi_conn *);
3546 + extern int iscsit_start_kthreads(struct iscsi_conn *);
3547 + extern void iscsi_post_login_handler(struct iscsi_np *, struct iscsi_conn *, u8);
3548 +-extern void iscsi_target_login_sess_out(struct iscsi_conn *, struct iscsi_np *,
3549 +- bool, bool);
3550 ++extern void iscsi_target_login_sess_out(struct iscsi_conn *, bool, bool);
3551 + extern int iscsi_target_login_thread(void *);
3552 + extern void iscsi_handle_login_thread_timeout(struct timer_list *t);
3553 +
3554 +diff --git a/drivers/target/iscsi/iscsi_target_nego.c b/drivers/target/iscsi/iscsi_target_nego.c
3555 +index 685d771b51d41..e32d93b927428 100644
3556 +--- a/drivers/target/iscsi/iscsi_target_nego.c
3557 ++++ b/drivers/target/iscsi/iscsi_target_nego.c
3558 +@@ -535,12 +535,11 @@ static bool iscsi_target_sk_check_and_clear(struct iscsi_conn *conn, unsigned in
3559 +
3560 + static void iscsi_target_login_drop(struct iscsi_conn *conn, struct iscsi_login *login)
3561 + {
3562 +- struct iscsi_np *np = login->np;
3563 + bool zero_tsih = login->zero_tsih;
3564 +
3565 + iscsi_remove_failed_auth_entry(conn);
3566 + iscsi_target_nego_release(conn);
3567 +- iscsi_target_login_sess_out(conn, np, zero_tsih, true);
3568 ++ iscsi_target_login_sess_out(conn, zero_tsih, true);
3569 + }
3570 +
3571 + struct conn_timeout {
3572 +diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c
3573 +index a1ac2f0723b0b..041c68ea329f4 100644
3574 +--- a/drivers/usb/core/message.c
3575 ++++ b/drivers/usb/core/message.c
3576 +@@ -1204,6 +1204,34 @@ void usb_disable_interface(struct usb_device *dev, struct usb_interface *intf,
3577 + }
3578 + }
3579 +
3580 ++/*
3581 ++ * usb_disable_device_endpoints -- Disable all endpoints for a device
3582 ++ * @dev: the device whose endpoints are being disabled
3583 ++ * @skip_ep0: 0 to disable endpoint 0, 1 to skip it.
3584 ++ */
3585 ++static void usb_disable_device_endpoints(struct usb_device *dev, int skip_ep0)
3586 ++{
3587 ++ struct usb_hcd *hcd = bus_to_hcd(dev->bus);
3588 ++ int i;
3589 ++
3590 ++ if (hcd->driver->check_bandwidth) {
3591 ++ /* First pass: Cancel URBs, leave endpoint pointers intact. */
3592 ++ for (i = skip_ep0; i < 16; ++i) {
3593 ++ usb_disable_endpoint(dev, i, false);
3594 ++ usb_disable_endpoint(dev, i + USB_DIR_IN, false);
3595 ++ }
3596 ++ /* Remove endpoints from the host controller internal state */
3597 ++ mutex_lock(hcd->bandwidth_mutex);
3598 ++ usb_hcd_alloc_bandwidth(dev, NULL, NULL, NULL);
3599 ++ mutex_unlock(hcd->bandwidth_mutex);
3600 ++ }
3601 ++ /* Second pass: remove endpoint pointers */
3602 ++ for (i = skip_ep0; i < 16; ++i) {
3603 ++ usb_disable_endpoint(dev, i, true);
3604 ++ usb_disable_endpoint(dev, i + USB_DIR_IN, true);
3605 ++ }
3606 ++}
3607 ++
3608 + /**
3609 + * usb_disable_device - Disable all the endpoints for a USB device
3610 + * @dev: the device whose endpoints are being disabled
3611 +@@ -1217,7 +1245,6 @@ void usb_disable_interface(struct usb_device *dev, struct usb_interface *intf,
3612 + void usb_disable_device(struct usb_device *dev, int skip_ep0)
3613 + {
3614 + int i;
3615 +- struct usb_hcd *hcd = bus_to_hcd(dev->bus);
3616 +
3617 + /* getting rid of interfaces will disconnect
3618 + * any drivers bound to them (a key side effect)
3619 +@@ -1263,22 +1290,8 @@ void usb_disable_device(struct usb_device *dev, int skip_ep0)
3620 +
3621 + dev_dbg(&dev->dev, "%s nuking %s URBs\n", __func__,
3622 + skip_ep0 ? "non-ep0" : "all");
3623 +- if (hcd->driver->check_bandwidth) {
3624 +- /* First pass: Cancel URBs, leave endpoint pointers intact. */
3625 +- for (i = skip_ep0; i < 16; ++i) {
3626 +- usb_disable_endpoint(dev, i, false);
3627 +- usb_disable_endpoint(dev, i + USB_DIR_IN, false);
3628 +- }
3629 +- /* Remove endpoints from the host controller internal state */
3630 +- mutex_lock(hcd->bandwidth_mutex);
3631 +- usb_hcd_alloc_bandwidth(dev, NULL, NULL, NULL);
3632 +- mutex_unlock(hcd->bandwidth_mutex);
3633 +- /* Second pass: remove endpoint pointers */
3634 +- }
3635 +- for (i = skip_ep0; i < 16; ++i) {
3636 +- usb_disable_endpoint(dev, i, true);
3637 +- usb_disable_endpoint(dev, i + USB_DIR_IN, true);
3638 +- }
3639 ++
3640 ++ usb_disable_device_endpoints(dev, skip_ep0);
3641 + }
3642 +
3643 + /**
3644 +@@ -1521,6 +1534,9 @@ EXPORT_SYMBOL_GPL(usb_set_interface);
3645 + * The caller must own the device lock.
3646 + *
3647 + * Return: Zero on success, else a negative error code.
3648 ++ *
3649 ++ * If this routine fails the device will probably be in an unusable state
3650 ++ * with endpoints disabled, and interfaces only partially enabled.
3651 + */
3652 + int usb_reset_configuration(struct usb_device *dev)
3653 + {
3654 +@@ -1536,10 +1552,7 @@ int usb_reset_configuration(struct usb_device *dev)
3655 + * calls during probe() are fine
3656 + */
3657 +
3658 +- for (i = 1; i < 16; ++i) {
3659 +- usb_disable_endpoint(dev, i, true);
3660 +- usb_disable_endpoint(dev, i + USB_DIR_IN, true);
3661 +- }
3662 ++ usb_disable_device_endpoints(dev, 1); /* skip ep0*/
3663 +
3664 + config = dev->actconfig;
3665 + retval = 0;
3666 +@@ -1552,34 +1565,10 @@ int usb_reset_configuration(struct usb_device *dev)
3667 + mutex_unlock(hcd->bandwidth_mutex);
3668 + return -ENOMEM;
3669 + }
3670 +- /* Make sure we have enough bandwidth for each alternate setting 0 */
3671 +- for (i = 0; i < config->desc.bNumInterfaces; i++) {
3672 +- struct usb_interface *intf = config->interface[i];
3673 +- struct usb_host_interface *alt;
3674 +
3675 +- alt = usb_altnum_to_altsetting(intf, 0);
3676 +- if (!alt)
3677 +- alt = &intf->altsetting[0];
3678 +- if (alt != intf->cur_altsetting)
3679 +- retval = usb_hcd_alloc_bandwidth(dev, NULL,
3680 +- intf->cur_altsetting, alt);
3681 +- if (retval < 0)
3682 +- break;
3683 +- }
3684 +- /* If not, reinstate the old alternate settings */
3685 ++ /* xHCI adds all endpoints in usb_hcd_alloc_bandwidth */
3686 ++ retval = usb_hcd_alloc_bandwidth(dev, config, NULL, NULL);
3687 + if (retval < 0) {
3688 +-reset_old_alts:
3689 +- for (i--; i >= 0; i--) {
3690 +- struct usb_interface *intf = config->interface[i];
3691 +- struct usb_host_interface *alt;
3692 +-
3693 +- alt = usb_altnum_to_altsetting(intf, 0);
3694 +- if (!alt)
3695 +- alt = &intf->altsetting[0];
3696 +- if (alt != intf->cur_altsetting)
3697 +- usb_hcd_alloc_bandwidth(dev, NULL,
3698 +- alt, intf->cur_altsetting);
3699 +- }
3700 + usb_enable_lpm(dev);
3701 + mutex_unlock(hcd->bandwidth_mutex);
3702 + return retval;
3703 +@@ -1588,8 +1577,12 @@ reset_old_alts:
3704 + USB_REQ_SET_CONFIGURATION, 0,
3705 + config->desc.bConfigurationValue, 0,
3706 + NULL, 0, USB_CTRL_SET_TIMEOUT);
3707 +- if (retval < 0)
3708 +- goto reset_old_alts;
3709 ++ if (retval < 0) {
3710 ++ usb_hcd_alloc_bandwidth(dev, NULL, NULL, NULL);
3711 ++ usb_enable_lpm(dev);
3712 ++ mutex_unlock(hcd->bandwidth_mutex);
3713 ++ return retval;
3714 ++ }
3715 + mutex_unlock(hcd->bandwidth_mutex);
3716 +
3717 + /* re-init hc/hcd interface/endpoint state */
3718 +diff --git a/drivers/usb/core/sysfs.c b/drivers/usb/core/sysfs.c
3719 +index f19694e69f5c3..2f594c88d9058 100644
3720 +--- a/drivers/usb/core/sysfs.c
3721 ++++ b/drivers/usb/core/sysfs.c
3722 +@@ -889,7 +889,11 @@ read_descriptors(struct file *filp, struct kobject *kobj,
3723 + size_t srclen, n;
3724 + int cfgno;
3725 + void *src;
3726 ++ int retval;
3727 +
3728 ++ retval = usb_lock_device_interruptible(udev);
3729 ++ if (retval < 0)
3730 ++ return -EINTR;
3731 + /* The binary attribute begins with the device descriptor.
3732 + * Following that are the raw descriptor entries for all the
3733 + * configurations (config plus subsidiary descriptors).
3734 +@@ -914,6 +918,7 @@ read_descriptors(struct file *filp, struct kobject *kobj,
3735 + off -= srclen;
3736 + }
3737 + }
3738 ++ usb_unlock_device(udev);
3739 + return count - nleft;
3740 + }
3741 +
3742 +diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
3743 +index 33f1cca7eaa61..ae98fe94fe91e 100644
3744 +--- a/drivers/usb/serial/ftdi_sio.c
3745 ++++ b/drivers/usb/serial/ftdi_sio.c
3746 +@@ -713,6 +713,7 @@ static const struct usb_device_id id_table_combined[] = {
3747 + { USB_DEVICE(XSENS_VID, XSENS_AWINDA_STATION_PID) },
3748 + { USB_DEVICE(XSENS_VID, XSENS_CONVERTER_PID) },
3749 + { USB_DEVICE(XSENS_VID, XSENS_MTDEVBOARD_PID) },
3750 ++ { USB_DEVICE(XSENS_VID, XSENS_MTIUSBCONVERTER_PID) },
3751 + { USB_DEVICE(XSENS_VID, XSENS_MTW_PID) },
3752 + { USB_DEVICE(FTDI_VID, FTDI_OMNI1509) },
3753 + { USB_DEVICE(MOBILITY_VID, MOBILITY_USB_SERIAL_PID) },
3754 +diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h
3755 +index e8373528264c3..b5ca17a5967a0 100644
3756 +--- a/drivers/usb/serial/ftdi_sio_ids.h
3757 ++++ b/drivers/usb/serial/ftdi_sio_ids.h
3758 +@@ -160,6 +160,7 @@
3759 + #define XSENS_AWINDA_DONGLE_PID 0x0102
3760 + #define XSENS_MTW_PID 0x0200 /* Xsens MTw */
3761 + #define XSENS_MTDEVBOARD_PID 0x0300 /* Motion Tracker Development Board */
3762 ++#define XSENS_MTIUSBCONVERTER_PID 0x0301 /* MTi USB converter */
3763 + #define XSENS_CONVERTER_PID 0xD00D /* Xsens USB-serial converter */
3764 +
3765 + /* Xsens devices using FTDI VID */
3766 +diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
3767 +index 9b7cee98ea607..f7a6ac05ac57a 100644
3768 +--- a/drivers/usb/serial/option.c
3769 ++++ b/drivers/usb/serial/option.c
3770 +@@ -1094,14 +1094,18 @@ static const struct usb_device_id option_ids[] = {
3771 + { USB_DEVICE(QUALCOMM_VENDOR_ID, UBLOX_PRODUCT_R410M),
3772 + .driver_info = RSVD(1) | RSVD(3) },
3773 + /* Quectel products using Quectel vendor ID */
3774 +- { USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC21),
3775 +- .driver_info = RSVD(4) },
3776 +- { USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC25),
3777 +- .driver_info = RSVD(4) },
3778 +- { USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EG95),
3779 +- .driver_info = RSVD(4) },
3780 +- { USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_BG96),
3781 +- .driver_info = RSVD(4) },
3782 ++ { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC21, 0xff, 0xff, 0xff),
3783 ++ .driver_info = NUMEP2 },
3784 ++ { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC21, 0xff, 0, 0) },
3785 ++ { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC25, 0xff, 0xff, 0xff),
3786 ++ .driver_info = NUMEP2 },
3787 ++ { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC25, 0xff, 0, 0) },
3788 ++ { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EG95, 0xff, 0xff, 0xff),
3789 ++ .driver_info = NUMEP2 },
3790 ++ { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EG95, 0xff, 0, 0) },
3791 ++ { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_BG96, 0xff, 0xff, 0xff),
3792 ++ .driver_info = NUMEP2 },
3793 ++ { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_BG96, 0xff, 0, 0) },
3794 + { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EP06, 0xff, 0xff, 0xff),
3795 + .driver_info = RSVD(1) | RSVD(2) | RSVD(3) | RSVD(4) | NUMEP2 },
3796 + { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EP06, 0xff, 0, 0) },
3797 +@@ -1819,6 +1823,8 @@ static const struct usb_device_id option_ids[] = {
3798 + { USB_DEVICE_INTERFACE_CLASS(0x1e0e, 0x9003, 0xff) }, /* Simcom SIM7500/SIM7600 MBIM mode */
3799 + { USB_DEVICE_INTERFACE_CLASS(0x1e0e, 0x9011, 0xff), /* Simcom SIM7500/SIM7600 RNDIS mode */
3800 + .driver_info = RSVD(7) },
3801 ++ { USB_DEVICE_INTERFACE_CLASS(0x1e0e, 0x9205, 0xff) }, /* Simcom SIM7070/SIM7080/SIM7090 AT+ECM mode */
3802 ++ { USB_DEVICE_INTERFACE_CLASS(0x1e0e, 0x9206, 0xff) }, /* Simcom SIM7070/SIM7080/SIM7090 AT-only mode */
3803 + { USB_DEVICE(ALCATEL_VENDOR_ID, ALCATEL_PRODUCT_X060S_X200),
3804 + .driver_info = NCTRL(0) | NCTRL(1) | RSVD(4) },
3805 + { USB_DEVICE(ALCATEL_VENDOR_ID, ALCATEL_PRODUCT_X220_X500D),
3806 +diff --git a/drivers/usb/typec/ucsi/ucsi_acpi.c b/drivers/usb/typec/ucsi/ucsi_acpi.c
3807 +index a18112a83faed..dda8bd39c9186 100644
3808 +--- a/drivers/usb/typec/ucsi/ucsi_acpi.c
3809 ++++ b/drivers/usb/typec/ucsi/ucsi_acpi.c
3810 +@@ -64,11 +64,15 @@ static void ucsi_acpi_notify(acpi_handle handle, u32 event, void *data)
3811 +
3812 + static int ucsi_acpi_probe(struct platform_device *pdev)
3813 + {
3814 ++ struct acpi_device *adev = ACPI_COMPANION(&pdev->dev);
3815 + struct ucsi_acpi *ua;
3816 + struct resource *res;
3817 + acpi_status status;
3818 + int ret;
3819 +
3820 ++ if (adev->dep_unmet)
3821 ++ return -EPROBE_DEFER;
3822 ++
3823 + ua = devm_kzalloc(&pdev->dev, sizeof(*ua), GFP_KERNEL);
3824 + if (!ua)
3825 + return -ENOMEM;
3826 +diff --git a/drivers/video/console/Kconfig b/drivers/video/console/Kconfig
3827 +index c10e17fb9a9a9..3b432a18b5ab6 100644
3828 +--- a/drivers/video/console/Kconfig
3829 ++++ b/drivers/video/console/Kconfig
3830 +@@ -22,52 +22,6 @@ config VGA_CONSOLE
3831 +
3832 + Say Y.
3833 +
3834 +-config VGACON_SOFT_SCROLLBACK
3835 +- bool "Enable Scrollback Buffer in System RAM"
3836 +- depends on VGA_CONSOLE
3837 +- default n
3838 +- help
3839 +- The scrollback buffer of the standard VGA console is located in
3840 +- the VGA RAM. The size of this RAM is fixed and is quite small.
3841 +- If you require a larger scrollback buffer, this can be placed in
3842 +- System RAM which is dynamically allocated during initialization.
3843 +- Placing the scrollback buffer in System RAM will slightly slow
3844 +- down the console.
3845 +-
3846 +- If you want this feature, say 'Y' here and enter the amount of
3847 +- RAM to allocate for this buffer. If unsure, say 'N'.
3848 +-
3849 +-config VGACON_SOFT_SCROLLBACK_SIZE
3850 +- int "Scrollback Buffer Size (in KB)"
3851 +- depends on VGACON_SOFT_SCROLLBACK
3852 +- range 1 1024
3853 +- default "64"
3854 +- help
3855 +- Enter the amount of System RAM to allocate for scrollback
3856 +- buffers of VGA consoles. Each 64KB will give you approximately
3857 +- 16 80x25 screenfuls of scrollback buffer.
3858 +-
3859 +-config VGACON_SOFT_SCROLLBACK_PERSISTENT_ENABLE_BY_DEFAULT
3860 +- bool "Persistent Scrollback History for each console by default"
3861 +- depends on VGACON_SOFT_SCROLLBACK
3862 +- default n
3863 +- help
3864 +- Say Y here if the scrollback history should persist by default when
3865 +- switching between consoles. Otherwise, the scrollback history will be
3866 +- flushed each time the console is switched. This feature can also be
3867 +- enabled using the boot command line parameter
3868 +- 'vgacon.scrollback_persistent=1'.
3869 +-
3870 +- This feature might break your tool of choice to flush the scrollback
3871 +- buffer, e.g. clear(1) will work fine but Debian's clear_console(1)
3872 +- will be broken, which might cause security issues.
3873 +- You can use the escape sequence \e[3J instead if this feature is
3874 +- activated.
3875 +-
3876 +- Note that a buffer of VGACON_SOFT_SCROLLBACK_SIZE is taken for each
3877 +- created tty device.
3878 +- So if you use a RAM-constrained system, say N here.
3879 +-
3880 + config MDA_CONSOLE
3881 + depends on !M68K && !PARISC && ISA
3882 + tristate "MDA text console (dual-headed)"
3883 +diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c
3884 +index e079b910feb24..55507df335bdd 100644
3885 +--- a/drivers/video/console/vgacon.c
3886 ++++ b/drivers/video/console/vgacon.c
3887 +@@ -165,214 +165,6 @@ static inline void vga_set_mem_top(struct vc_data *c)
3888 + write_vga(12, (c->vc_visible_origin - vga_vram_base) / 2);
3889 + }
3890 +
3891 +-#ifdef CONFIG_VGACON_SOFT_SCROLLBACK
3892 +-/* software scrollback */
3893 +-struct vgacon_scrollback_info {
3894 +- void *data;
3895 +- int tail;
3896 +- int size;
3897 +- int rows;
3898 +- int cnt;
3899 +- int cur;
3900 +- int save;
3901 +- int restore;
3902 +-};
3903 +-
3904 +-static struct vgacon_scrollback_info *vgacon_scrollback_cur;
3905 +-static struct vgacon_scrollback_info vgacon_scrollbacks[MAX_NR_CONSOLES];
3906 +-static bool scrollback_persistent = \
3907 +- IS_ENABLED(CONFIG_VGACON_SOFT_SCROLLBACK_PERSISTENT_ENABLE_BY_DEFAULT);
3908 +-module_param_named(scrollback_persistent, scrollback_persistent, bool, 0000);
3909 +-MODULE_PARM_DESC(scrollback_persistent, "Enable persistent scrollback for all vga consoles");
3910 +-
3911 +-static void vgacon_scrollback_reset(int vc_num, size_t reset_size)
3912 +-{
3913 +- struct vgacon_scrollback_info *scrollback = &vgacon_scrollbacks[vc_num];
3914 +-
3915 +- if (scrollback->data && reset_size > 0)
3916 +- memset(scrollback->data, 0, reset_size);
3917 +-
3918 +- scrollback->cnt = 0;
3919 +- scrollback->tail = 0;
3920 +- scrollback->cur = 0;
3921 +-}
3922 +-
3923 +-static void vgacon_scrollback_init(int vc_num)
3924 +-{
3925 +- int pitch = vga_video_num_columns * 2;
3926 +- size_t size = CONFIG_VGACON_SOFT_SCROLLBACK_SIZE * 1024;
3927 +- int rows = size / pitch;
3928 +- void *data;
3929 +-
3930 +- data = kmalloc_array(CONFIG_VGACON_SOFT_SCROLLBACK_SIZE, 1024,
3931 +- GFP_NOWAIT);
3932 +-
3933 +- vgacon_scrollbacks[vc_num].data = data;
3934 +- vgacon_scrollback_cur = &vgacon_scrollbacks[vc_num];
3935 +-
3936 +- vgacon_scrollback_cur->rows = rows - 1;
3937 +- vgacon_scrollback_cur->size = rows * pitch;
3938 +-
3939 +- vgacon_scrollback_reset(vc_num, size);
3940 +-}
3941 +-
3942 +-static void vgacon_scrollback_switch(int vc_num)
3943 +-{
3944 +- if (!scrollback_persistent)
3945 +- vc_num = 0;
3946 +-
3947 +- if (!vgacon_scrollbacks[vc_num].data) {
3948 +- vgacon_scrollback_init(vc_num);
3949 +- } else {
3950 +- if (scrollback_persistent) {
3951 +- vgacon_scrollback_cur = &vgacon_scrollbacks[vc_num];
3952 +- } else {
3953 +- size_t size = CONFIG_VGACON_SOFT_SCROLLBACK_SIZE * 1024;
3954 +-
3955 +- vgacon_scrollback_reset(vc_num, size);
3956 +- }
3957 +- }
3958 +-}
3959 +-
3960 +-static void vgacon_scrollback_startup(void)
3961 +-{
3962 +- vgacon_scrollback_cur = &vgacon_scrollbacks[0];
3963 +- vgacon_scrollback_init(0);
3964 +-}
3965 +-
3966 +-static void vgacon_scrollback_update(struct vc_data *c, int t, int count)
3967 +-{
3968 +- void *p;
3969 +-
3970 +- if (!vgacon_scrollback_cur->data || !vgacon_scrollback_cur->size ||
3971 +- c->vc_num != fg_console)
3972 +- return;
3973 +-
3974 +- p = (void *) (c->vc_origin + t * c->vc_size_row);
3975 +-
3976 +- while (count--) {
3977 +- if ((vgacon_scrollback_cur->tail + c->vc_size_row) >
3978 +- vgacon_scrollback_cur->size)
3979 +- vgacon_scrollback_cur->tail = 0;
3980 +-
3981 +- scr_memcpyw(vgacon_scrollback_cur->data +
3982 +- vgacon_scrollback_cur->tail,
3983 +- p, c->vc_size_row);
3984 +-
3985 +- vgacon_scrollback_cur->cnt++;
3986 +- p += c->vc_size_row;
3987 +- vgacon_scrollback_cur->tail += c->vc_size_row;
3988 +-
3989 +- if (vgacon_scrollback_cur->tail >= vgacon_scrollback_cur->size)
3990 +- vgacon_scrollback_cur->tail = 0;
3991 +-
3992 +- if (vgacon_scrollback_cur->cnt > vgacon_scrollback_cur->rows)
3993 +- vgacon_scrollback_cur->cnt = vgacon_scrollback_cur->rows;
3994 +-
3995 +- vgacon_scrollback_cur->cur = vgacon_scrollback_cur->cnt;
3996 +- }
3997 +-}
3998 +-
3999 +-static void vgacon_restore_screen(struct vc_data *c)
4000 +-{
4001 +- c->vc_origin = c->vc_visible_origin;
4002 +- vgacon_scrollback_cur->save = 0;
4003 +-
4004 +- if (!vga_is_gfx && !vgacon_scrollback_cur->restore) {
4005 +- scr_memcpyw((u16 *) c->vc_origin, (u16 *) c->vc_screenbuf,
4006 +- c->vc_screenbuf_size > vga_vram_size ?
4007 +- vga_vram_size : c->vc_screenbuf_size);
4008 +- vgacon_scrollback_cur->restore = 1;
4009 +- vgacon_scrollback_cur->cur = vgacon_scrollback_cur->cnt;
4010 +- }
4011 +-}
4012 +-
4013 +-static void vgacon_scrolldelta(struct vc_data *c, int lines)
4014 +-{
4015 +- int start, end, count, soff;
4016 +-
4017 +- if (!lines) {
4018 +- vgacon_restore_screen(c);
4019 +- return;
4020 +- }
4021 +-
4022 +- if (!vgacon_scrollback_cur->data)
4023 +- return;
4024 +-
4025 +- if (!vgacon_scrollback_cur->save) {
4026 +- vgacon_cursor(c, CM_ERASE);
4027 +- vgacon_save_screen(c);
4028 +- c->vc_origin = (unsigned long)c->vc_screenbuf;
4029 +- vgacon_scrollback_cur->save = 1;
4030 +- }
4031 +-
4032 +- vgacon_scrollback_cur->restore = 0;
4033 +- start = vgacon_scrollback_cur->cur + lines;
4034 +- end = start + abs(lines);
4035 +-
4036 +- if (start < 0)
4037 +- start = 0;
4038 +-
4039 +- if (start > vgacon_scrollback_cur->cnt)
4040 +- start = vgacon_scrollback_cur->cnt;
4041 +-
4042 +- if (end < 0)
4043 +- end = 0;
4044 +-
4045 +- if (end > vgacon_scrollback_cur->cnt)
4046 +- end = vgacon_scrollback_cur->cnt;
4047 +-
4048 +- vgacon_scrollback_cur->cur = start;
4049 +- count = end - start;
4050 +- soff = vgacon_scrollback_cur->tail -
4051 +- ((vgacon_scrollback_cur->cnt - end) * c->vc_size_row);
4052 +- soff -= count * c->vc_size_row;
4053 +-
4054 +- if (soff < 0)
4055 +- soff += vgacon_scrollback_cur->size;
4056 +-
4057 +- count = vgacon_scrollback_cur->cnt - start;
4058 +-
4059 +- if (count > c->vc_rows)
4060 +- count = c->vc_rows;
4061 +-
4062 +- if (count) {
4063 +- int copysize;
4064 +-
4065 +- int diff = c->vc_rows - count;
4066 +- void *d = (void *) c->vc_visible_origin;
4067 +- void *s = (void *) c->vc_screenbuf;
4068 +-
4069 +- count *= c->vc_size_row;
4070 +- /* how much memory to end of buffer left? */
4071 +- copysize = min(count, vgacon_scrollback_cur->size - soff);
4072 +- scr_memcpyw(d, vgacon_scrollback_cur->data + soff, copysize);
4073 +- d += copysize;
4074 +- count -= copysize;
4075 +-
4076 +- if (count) {
4077 +- scr_memcpyw(d, vgacon_scrollback_cur->data, count);
4078 +- d += count;
4079 +- }
4080 +-
4081 +- if (diff)
4082 +- scr_memcpyw(d, s, diff * c->vc_size_row);
4083 +- } else
4084 +- vgacon_cursor(c, CM_MOVE);
4085 +-}
4086 +-
4087 +-static void vgacon_flush_scrollback(struct vc_data *c)
4088 +-{
4089 +- size_t size = CONFIG_VGACON_SOFT_SCROLLBACK_SIZE * 1024;
4090 +-
4091 +- vgacon_scrollback_reset(c->vc_num, size);
4092 +-}
4093 +-#else
4094 +-#define vgacon_scrollback_startup(...) do { } while (0)
4095 +-#define vgacon_scrollback_init(...) do { } while (0)
4096 +-#define vgacon_scrollback_update(...) do { } while (0)
4097 +-#define vgacon_scrollback_switch(...) do { } while (0)
4098 +-
4099 + static void vgacon_restore_screen(struct vc_data *c)
4100 + {
4101 + if (c->vc_origin != c->vc_visible_origin)
4102 +@@ -386,11 +178,6 @@ static void vgacon_scrolldelta(struct vc_data *c, int lines)
4103 + vga_set_mem_top(c);
4104 + }
4105 +
4106 +-static void vgacon_flush_scrollback(struct vc_data *c)
4107 +-{
4108 +-}
4109 +-#endif /* CONFIG_VGACON_SOFT_SCROLLBACK */
4110 +-
4111 + static const char *vgacon_startup(void)
4112 + {
4113 + const char *display_desc = NULL;
4114 +@@ -573,10 +360,7 @@ static const char *vgacon_startup(void)
4115 + vgacon_xres = screen_info.orig_video_cols * VGA_FONTWIDTH;
4116 + vgacon_yres = vga_scan_lines;
4117 +
4118 +- if (!vga_init_done) {
4119 +- vgacon_scrollback_startup();
4120 +- vga_init_done = true;
4121 +- }
4122 ++ vga_init_done = true;
4123 +
4124 + return display_desc;
4125 + }
4126 +@@ -867,7 +651,6 @@ static int vgacon_switch(struct vc_data *c)
4127 + vgacon_doresize(c, c->vc_cols, c->vc_rows);
4128 + }
4129 +
4130 +- vgacon_scrollback_switch(c->vc_num);
4131 + return 0; /* Redrawing not needed */
4132 + }
4133 +
4134 +@@ -1384,7 +1167,6 @@ static bool vgacon_scroll(struct vc_data *c, unsigned int t, unsigned int b,
4135 + oldo = c->vc_origin;
4136 + delta = lines * c->vc_size_row;
4137 + if (dir == SM_UP) {
4138 +- vgacon_scrollback_update(c, t, lines);
4139 + if (c->vc_scr_end + delta >= vga_vram_end) {
4140 + scr_memcpyw((u16 *) vga_vram_base,
4141 + (u16 *) (oldo + delta),
4142 +@@ -1448,7 +1230,6 @@ const struct consw vga_con = {
4143 + .con_save_screen = vgacon_save_screen,
4144 + .con_build_attr = vgacon_build_attr,
4145 + .con_invert_region = vgacon_invert_region,
4146 +- .con_flush_scrollback = vgacon_flush_scrollback,
4147 + };
4148 + EXPORT_SYMBOL(vga_con);
4149 +
4150 +diff --git a/drivers/video/fbdev/core/bitblit.c b/drivers/video/fbdev/core/bitblit.c
4151 +index 35ebeeccde4df..436365efae731 100644
4152 +--- a/drivers/video/fbdev/core/bitblit.c
4153 ++++ b/drivers/video/fbdev/core/bitblit.c
4154 +@@ -234,7 +234,7 @@ static void bit_clear_margins(struct vc_data *vc, struct fb_info *info,
4155 + }
4156 +
4157 + static void bit_cursor(struct vc_data *vc, struct fb_info *info, int mode,
4158 +- int softback_lines, int fg, int bg)
4159 ++ int fg, int bg)
4160 + {
4161 + struct fb_cursor cursor;
4162 + struct fbcon_ops *ops = info->fbcon_par;
4163 +@@ -247,15 +247,6 @@ static void bit_cursor(struct vc_data *vc, struct fb_info *info, int mode,
4164 +
4165 + cursor.set = 0;
4166 +
4167 +- if (softback_lines) {
4168 +- if (y + softback_lines >= vc->vc_rows) {
4169 +- mode = CM_ERASE;
4170 +- ops->cursor_flash = 0;
4171 +- return;
4172 +- } else
4173 +- y += softback_lines;
4174 +- }
4175 +-
4176 + c = scr_readw((u16 *) vc->vc_pos);
4177 + attribute = get_attribute(info, c);
4178 + src = vc->vc_font.data + ((c & charmask) * (w * vc->vc_font.height));
4179 +diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
4180 +index 31f00d72f1493..8685d28dfdaaf 100644
4181 +--- a/drivers/video/fbdev/core/fbcon.c
4182 ++++ b/drivers/video/fbdev/core/fbcon.c
4183 +@@ -122,12 +122,6 @@ static int logo_lines;
4184 + /* logo_shown is an index to vc_cons when >= 0; otherwise follows FBCON_LOGO
4185 + enums. */
4186 + static int logo_shown = FBCON_LOGO_CANSHOW;
4187 +-/* Software scrollback */
4188 +-static int fbcon_softback_size = 32768;
4189 +-static unsigned long softback_buf, softback_curr;
4190 +-static unsigned long softback_in;
4191 +-static unsigned long softback_top, softback_end;
4192 +-static int softback_lines;
4193 + /* console mappings */
4194 + static int first_fb_vc;
4195 + static int last_fb_vc = MAX_NR_CONSOLES - 1;
4196 +@@ -167,8 +161,6 @@ static int margin_color;
4197 +
4198 + static const struct consw fb_con;
4199 +
4200 +-#define CM_SOFTBACK (8)
4201 +-
4202 + #define advance_row(p, delta) (unsigned short *)((unsigned long)(p) + (delta) * vc->vc_size_row)
4203 +
4204 + static int fbcon_set_origin(struct vc_data *);
4205 +@@ -373,18 +365,6 @@ static int get_color(struct vc_data *vc, struct fb_info *info,
4206 + return color;
4207 + }
4208 +
4209 +-static void fbcon_update_softback(struct vc_data *vc)
4210 +-{
4211 +- int l = fbcon_softback_size / vc->vc_size_row;
4212 +-
4213 +- if (l > 5)
4214 +- softback_end = softback_buf + l * vc->vc_size_row;
4215 +- else
4216 +- /* Smaller scrollback makes no sense, and 0 would screw
4217 +- the operation totally */
4218 +- softback_top = 0;
4219 +-}
4220 +-
4221 + static void fb_flashcursor(struct work_struct *work)
4222 + {
4223 + struct fb_info *info = container_of(work, struct fb_info, queue);
4224 +@@ -414,7 +394,7 @@ static void fb_flashcursor(struct work_struct *work)
4225 + c = scr_readw((u16 *) vc->vc_pos);
4226 + mode = (!ops->cursor_flash || ops->cursor_state.enable) ?
4227 + CM_ERASE : CM_DRAW;
4228 +- ops->cursor(vc, info, mode, softback_lines, get_color(vc, info, c, 1),
4229 ++ ops->cursor(vc, info, mode, get_color(vc, info, c, 1),
4230 + get_color(vc, info, c, 0));
4231 + console_unlock();
4232 + }
4233 +@@ -471,13 +451,7 @@ static int __init fb_console_setup(char *this_opt)
4234 + }
4235 +
4236 + if (!strncmp(options, "scrollback:", 11)) {
4237 +- options += 11;
4238 +- if (*options) {
4239 +- fbcon_softback_size = simple_strtoul(options, &options, 0);
4240 +- if (*options == 'k' || *options == 'K') {
4241 +- fbcon_softback_size *= 1024;
4242 +- }
4243 +- }
4244 ++ pr_warn("Ignoring scrollback size option\n");
4245 + continue;
4246 + }
4247 +
4248 +@@ -1016,31 +990,6 @@ static const char *fbcon_startup(void)
4249 +
4250 + set_blitting_type(vc, info);
4251 +
4252 +- if (info->fix.type != FB_TYPE_TEXT) {
4253 +- if (fbcon_softback_size) {
4254 +- if (!softback_buf) {
4255 +- softback_buf =
4256 +- (unsigned long)
4257 +- kvmalloc(fbcon_softback_size,
4258 +- GFP_KERNEL);
4259 +- if (!softback_buf) {
4260 +- fbcon_softback_size = 0;
4261 +- softback_top = 0;
4262 +- }
4263 +- }
4264 +- } else {
4265 +- if (softback_buf) {
4266 +- kvfree((void *) softback_buf);
4267 +- softback_buf = 0;
4268 +- softback_top = 0;
4269 +- }
4270 +- }
4271 +- if (softback_buf)
4272 +- softback_in = softback_top = softback_curr =
4273 +- softback_buf;
4274 +- softback_lines = 0;
4275 +- }
4276 +-
4277 + /* Setup default font */
4278 + if (!p->fontdata && !vc->vc_font.data) {
4279 + if (!fontname[0] || !(font = find_font(fontname)))
4280 +@@ -1214,9 +1163,6 @@ static void fbcon_init(struct vc_data *vc, int init)
4281 + if (logo)
4282 + fbcon_prepare_logo(vc, info, cols, rows, new_cols, new_rows);
4283 +
4284 +- if (vc == svc && softback_buf)
4285 +- fbcon_update_softback(vc);
4286 +-
4287 + if (ops->rotate_font && ops->rotate_font(info, vc)) {
4288 + ops->rotate = FB_ROTATE_UR;
4289 + set_blitting_type(vc, info);
4290 +@@ -1379,7 +1325,6 @@ static void fbcon_cursor(struct vc_data *vc, int mode)
4291 + {
4292 + struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
4293 + struct fbcon_ops *ops = info->fbcon_par;
4294 +- int y;
4295 + int c = scr_readw((u16 *) vc->vc_pos);
4296 +
4297 + ops->cur_blink_jiffies = msecs_to_jiffies(vc->vc_cur_blink_ms);
4298 +@@ -1393,16 +1338,8 @@ static void fbcon_cursor(struct vc_data *vc, int mode)
4299 + fbcon_add_cursor_timer(info);
4300 +
4301 + ops->cursor_flash = (mode == CM_ERASE) ? 0 : 1;
4302 +- if (mode & CM_SOFTBACK) {
4303 +- mode &= ~CM_SOFTBACK;
4304 +- y = softback_lines;
4305 +- } else {
4306 +- if (softback_lines)
4307 +- fbcon_set_origin(vc);
4308 +- y = 0;
4309 +- }
4310 +
4311 +- ops->cursor(vc, info, mode, y, get_color(vc, info, c, 1),
4312 ++ ops->cursor(vc, info, mode, get_color(vc, info, c, 1),
4313 + get_color(vc, info, c, 0));
4314 + }
4315 +
4316 +@@ -1473,8 +1410,6 @@ static void fbcon_set_disp(struct fb_info *info, struct fb_var_screeninfo *var,
4317 +
4318 + if (con_is_visible(vc)) {
4319 + update_screen(vc);
4320 +- if (softback_buf)
4321 +- fbcon_update_softback(vc);
4322 + }
4323 + }
4324 +
4325 +@@ -1612,99 +1547,6 @@ static __inline__ void ypan_down_redraw(struct vc_data *vc, int t, int count)
4326 + scrollback_current = 0;
4327 + }
4328 +
4329 +-static void fbcon_redraw_softback(struct vc_data *vc, struct fbcon_display *p,
4330 +- long delta)
4331 +-{
4332 +- int count = vc->vc_rows;
4333 +- unsigned short *d, *s;
4334 +- unsigned long n;
4335 +- int line = 0;
4336 +-
4337 +- d = (u16 *) softback_curr;
4338 +- if (d == (u16 *) softback_in)
4339 +- d = (u16 *) vc->vc_origin;
4340 +- n = softback_curr + delta * vc->vc_size_row;
4341 +- softback_lines -= delta;
4342 +- if (delta < 0) {
4343 +- if (softback_curr < softback_top && n < softback_buf) {
4344 +- n += softback_end - softback_buf;
4345 +- if (n < softback_top) {
4346 +- softback_lines -=
4347 +- (softback_top - n) / vc->vc_size_row;
4348 +- n = softback_top;
4349 +- }
4350 +- } else if (softback_curr >= softback_top
4351 +- && n < softback_top) {
4352 +- softback_lines -=
4353 +- (softback_top - n) / vc->vc_size_row;
4354 +- n = softback_top;
4355 +- }
4356 +- } else {
4357 +- if (softback_curr > softback_in && n >= softback_end) {
4358 +- n += softback_buf - softback_end;
4359 +- if (n > softback_in) {
4360 +- n = softback_in;
4361 +- softback_lines = 0;
4362 +- }
4363 +- } else if (softback_curr <= softback_in && n > softback_in) {
4364 +- n = softback_in;
4365 +- softback_lines = 0;
4366 +- }
4367 +- }
4368 +- if (n == softback_curr)
4369 +- return;
4370 +- softback_curr = n;
4371 +- s = (u16 *) softback_curr;
4372 +- if (s == (u16 *) softback_in)
4373 +- s = (u16 *) vc->vc_origin;
4374 +- while (count--) {
4375 +- unsigned short *start;
4376 +- unsigned short *le;
4377 +- unsigned short c;
4378 +- int x = 0;
4379 +- unsigned short attr = 1;
4380 +-
4381 +- start = s;
4382 +- le = advance_row(s, 1);
4383 +- do {
4384 +- c = scr_readw(s);
4385 +- if (attr != (c & 0xff00)) {
4386 +- attr = c & 0xff00;
4387 +- if (s > start) {
4388 +- fbcon_putcs(vc, start, s - start,
4389 +- line, x);
4390 +- x += s - start;
4391 +- start = s;
4392 +- }
4393 +- }
4394 +- if (c == scr_readw(d)) {
4395 +- if (s > start) {
4396 +- fbcon_putcs(vc, start, s - start,
4397 +- line, x);
4398 +- x += s - start + 1;
4399 +- start = s + 1;
4400 +- } else {
4401 +- x++;
4402 +- start++;
4403 +- }
4404 +- }
4405 +- s++;
4406 +- d++;
4407 +- } while (s < le);
4408 +- if (s > start)
4409 +- fbcon_putcs(vc, start, s - start, line, x);
4410 +- line++;
4411 +- if (d == (u16 *) softback_end)
4412 +- d = (u16 *) softback_buf;
4413 +- if (d == (u16 *) softback_in)
4414 +- d = (u16 *) vc->vc_origin;
4415 +- if (s == (u16 *) softback_end)
4416 +- s = (u16 *) softback_buf;
4417 +- if (s == (u16 *) softback_in)
4418 +- s = (u16 *) vc->vc_origin;
4419 +- }
4420 +-}
4421 +-
4422 + static void fbcon_redraw_move(struct vc_data *vc, struct fbcon_display *p,
4423 + int line, int count, int dy)
4424 + {
4425 +@@ -1844,31 +1686,6 @@ static void fbcon_redraw(struct vc_data *vc, struct fbcon_display *p,
4426 + }
4427 + }
4428 +
4429 +-static inline void fbcon_softback_note(struct vc_data *vc, int t,
4430 +- int count)
4431 +-{
4432 +- unsigned short *p;
4433 +-
4434 +- if (vc->vc_num != fg_console)
4435 +- return;
4436 +- p = (unsigned short *) (vc->vc_origin + t * vc->vc_size_row);
4437 +-
4438 +- while (count) {
4439 +- scr_memcpyw((u16 *) softback_in, p, vc->vc_size_row);
4440 +- count--;
4441 +- p = advance_row(p, 1);
4442 +- softback_in += vc->vc_size_row;
4443 +- if (softback_in == softback_end)
4444 +- softback_in = softback_buf;
4445 +- if (softback_in == softback_top) {
4446 +- softback_top += vc->vc_size_row;
4447 +- if (softback_top == softback_end)
4448 +- softback_top = softback_buf;
4449 +- }
4450 +- }
4451 +- softback_curr = softback_in;
4452 +-}
4453 +-
4454 + static bool fbcon_scroll(struct vc_data *vc, unsigned int t, unsigned int b,
4455 + enum con_scroll dir, unsigned int count)
4456 + {
4457 +@@ -1891,8 +1708,6 @@ static bool fbcon_scroll(struct vc_data *vc, unsigned int t, unsigned int b,
4458 + case SM_UP:
4459 + if (count > vc->vc_rows) /* Maximum realistic size */
4460 + count = vc->vc_rows;
4461 +- if (softback_top)
4462 +- fbcon_softback_note(vc, t, count);
4463 + if (logo_shown >= 0)
4464 + goto redraw_up;
4465 + switch (p->scrollmode) {
4466 +@@ -2263,14 +2078,6 @@ static int fbcon_switch(struct vc_data *vc)
4467 + info = registered_fb[con2fb_map[vc->vc_num]];
4468 + ops = info->fbcon_par;
4469 +
4470 +- if (softback_top) {
4471 +- if (softback_lines)
4472 +- fbcon_set_origin(vc);
4473 +- softback_top = softback_curr = softback_in = softback_buf;
4474 +- softback_lines = 0;
4475 +- fbcon_update_softback(vc);
4476 +- }
4477 +-
4478 + if (logo_shown >= 0) {
4479 + struct vc_data *conp2 = vc_cons[logo_shown].d;
4480 +
4481 +@@ -2593,9 +2400,6 @@ static int fbcon_do_set_font(struct vc_data *vc, int w, int h,
4482 + int cnt;
4483 + char *old_data = NULL;
4484 +
4485 +- if (con_is_visible(vc) && softback_lines)
4486 +- fbcon_set_origin(vc);
4487 +-
4488 + resize = (w != vc->vc_font.width) || (h != vc->vc_font.height);
4489 + if (p->userfont)
4490 + old_data = vc->vc_font.data;
4491 +@@ -2621,8 +2425,6 @@ static int fbcon_do_set_font(struct vc_data *vc, int w, int h,
4492 + cols /= w;
4493 + rows /= h;
4494 + vc_resize(vc, cols, rows);
4495 +- if (con_is_visible(vc) && softback_buf)
4496 +- fbcon_update_softback(vc);
4497 + } else if (con_is_visible(vc)
4498 + && vc->vc_mode == KD_TEXT) {
4499 + fbcon_clear_margins(vc, 0);
4500 +@@ -2781,19 +2583,7 @@ static void fbcon_set_palette(struct vc_data *vc, const unsigned char *table)
4501 +
4502 + static u16 *fbcon_screen_pos(struct vc_data *vc, int offset)
4503 + {
4504 +- unsigned long p;
4505 +- int line;
4506 +-
4507 +- if (vc->vc_num != fg_console || !softback_lines)
4508 +- return (u16 *) (vc->vc_origin + offset);
4509 +- line = offset / vc->vc_size_row;
4510 +- if (line >= softback_lines)
4511 +- return (u16 *) (vc->vc_origin + offset -
4512 +- softback_lines * vc->vc_size_row);
4513 +- p = softback_curr + offset;
4514 +- if (p >= softback_end)
4515 +- p += softback_buf - softback_end;
4516 +- return (u16 *) p;
4517 ++ return (u16 *) (vc->vc_origin + offset);
4518 + }
4519 +
4520 + static unsigned long fbcon_getxy(struct vc_data *vc, unsigned long pos,
4521 +@@ -2807,22 +2597,7 @@ static unsigned long fbcon_getxy(struct vc_data *vc, unsigned long pos,
4522 +
4523 + x = offset % vc->vc_cols;
4524 + y = offset / vc->vc_cols;
4525 +- if (vc->vc_num == fg_console)
4526 +- y += softback_lines;
4527 + ret = pos + (vc->vc_cols - x) * 2;
4528 +- } else if (vc->vc_num == fg_console && softback_lines) {
4529 +- unsigned long offset = pos - softback_curr;
4530 +-
4531 +- if (pos < softback_curr)
4532 +- offset += softback_end - softback_buf;
4533 +- offset /= 2;
4534 +- x = offset % vc->vc_cols;
4535 +- y = offset / vc->vc_cols;
4536 +- ret = pos + (vc->vc_cols - x) * 2;
4537 +- if (ret == softback_end)
4538 +- ret = softback_buf;
4539 +- if (ret == softback_in)
4540 +- ret = vc->vc_origin;
4541 + } else {
4542 + /* Should not happen */
4543 + x = y = 0;
4544 +@@ -2850,106 +2625,11 @@ static void fbcon_invert_region(struct vc_data *vc, u16 * p, int cnt)
4545 + a = ((a) & 0x88ff) | (((a) & 0x7000) >> 4) |
4546 + (((a) & 0x0700) << 4);
4547 + scr_writew(a, p++);
4548 +- if (p == (u16 *) softback_end)
4549 +- p = (u16 *) softback_buf;
4550 +- if (p == (u16 *) softback_in)
4551 +- p = (u16 *) vc->vc_origin;
4552 + }
4553 + }
4554 +
4555 +-static void fbcon_scrolldelta(struct vc_data *vc, int lines)
4556 +-{
4557 +- struct fb_info *info = registered_fb[con2fb_map[fg_console]];
4558 +- struct fbcon_ops *ops = info->fbcon_par;
4559 +- struct fbcon_display *disp = &fb_display[fg_console];
4560 +- int offset, limit, scrollback_old;
4561 +-
4562 +- if (softback_top) {
4563 +- if (vc->vc_num != fg_console)
4564 +- return;
4565 +- if (vc->vc_mode != KD_TEXT || !lines)
4566 +- return;
4567 +- if (logo_shown >= 0) {
4568 +- struct vc_data *conp2 = vc_cons[logo_shown].d;
4569 +-
4570 +- if (conp2->vc_top == logo_lines
4571 +- && conp2->vc_bottom == conp2->vc_rows)
4572 +- conp2->vc_top = 0;
4573 +- if (logo_shown == vc->vc_num) {
4574 +- unsigned long p, q;
4575 +- int i;
4576 +-
4577 +- p = softback_in;
4578 +- q = vc->vc_origin +
4579 +- logo_lines * vc->vc_size_row;
4580 +- for (i = 0; i < logo_lines; i++) {
4581 +- if (p == softback_top)
4582 +- break;
4583 +- if (p == softback_buf)
4584 +- p = softback_end;
4585 +- p -= vc->vc_size_row;
4586 +- q -= vc->vc_size_row;
4587 +- scr_memcpyw((u16 *) q, (u16 *) p,
4588 +- vc->vc_size_row);
4589 +- }
4590 +- softback_in = softback_curr = p;
4591 +- update_region(vc, vc->vc_origin,
4592 +- logo_lines * vc->vc_cols);
4593 +- }
4594 +- logo_shown = FBCON_LOGO_CANSHOW;
4595 +- }
4596 +- fbcon_cursor(vc, CM_ERASE | CM_SOFTBACK);
4597 +- fbcon_redraw_softback(vc, disp, lines);
4598 +- fbcon_cursor(vc, CM_DRAW | CM_SOFTBACK);
4599 +- return;
4600 +- }
4601 +-
4602 +- if (!scrollback_phys_max)
4603 +- return;
4604 +-
4605 +- scrollback_old = scrollback_current;
4606 +- scrollback_current -= lines;
4607 +- if (scrollback_current < 0)
4608 +- scrollback_current = 0;
4609 +- else if (scrollback_current > scrollback_max)
4610 +- scrollback_current = scrollback_max;
4611 +- if (scrollback_current == scrollback_old)
4612 +- return;
4613 +-
4614 +- if (fbcon_is_inactive(vc, info))
4615 +- return;
4616 +-
4617 +- fbcon_cursor(vc, CM_ERASE);
4618 +-
4619 +- offset = disp->yscroll - scrollback_current;
4620 +- limit = disp->vrows;
4621 +- switch (disp->scrollmode) {
4622 +- case SCROLL_WRAP_MOVE:
4623 +- info->var.vmode |= FB_VMODE_YWRAP;
4624 +- break;
4625 +- case SCROLL_PAN_MOVE:
4626 +- case SCROLL_PAN_REDRAW:
4627 +- limit -= vc->vc_rows;
4628 +- info->var.vmode &= ~FB_VMODE_YWRAP;
4629 +- break;
4630 +- }
4631 +- if (offset < 0)
4632 +- offset += limit;
4633 +- else if (offset >= limit)
4634 +- offset -= limit;
4635 +-
4636 +- ops->var.xoffset = 0;
4637 +- ops->var.yoffset = offset * vc->vc_font.height;
4638 +- ops->update_start(info);
4639 +-
4640 +- if (!scrollback_current)
4641 +- fbcon_cursor(vc, CM_DRAW);
4642 +-}
4643 +-
4644 + static int fbcon_set_origin(struct vc_data *vc)
4645 + {
4646 +- if (softback_lines)
4647 +- fbcon_scrolldelta(vc, softback_lines);
4648 + return 0;
4649 + }
4650 +
4651 +@@ -3013,8 +2693,6 @@ static void fbcon_modechanged(struct fb_info *info)
4652 +
4653 + fbcon_set_palette(vc, color_table);
4654 + update_screen(vc);
4655 +- if (softback_buf)
4656 +- fbcon_update_softback(vc);
4657 + }
4658 + }
4659 +
4660 +@@ -3425,7 +3103,6 @@ static const struct consw fb_con = {
4661 + .con_font_default = fbcon_set_def_font,
4662 + .con_font_copy = fbcon_copy_font,
4663 + .con_set_palette = fbcon_set_palette,
4664 +- .con_scrolldelta = fbcon_scrolldelta,
4665 + .con_set_origin = fbcon_set_origin,
4666 + .con_invert_region = fbcon_invert_region,
4667 + .con_screen_pos = fbcon_screen_pos,
4668 +@@ -3660,9 +3337,6 @@ static void fbcon_exit(void)
4669 + }
4670 + #endif
4671 +
4672 +- kvfree((void *)softback_buf);
4673 +- softback_buf = 0UL;
4674 +-
4675 + for_each_registered_fb(i) {
4676 + int pending = 0;
4677 +
4678 +diff --git a/drivers/video/fbdev/core/fbcon.h b/drivers/video/fbdev/core/fbcon.h
4679 +index 20dea853765f5..78bb14c03643e 100644
4680 +--- a/drivers/video/fbdev/core/fbcon.h
4681 ++++ b/drivers/video/fbdev/core/fbcon.h
4682 +@@ -62,7 +62,7 @@ struct fbcon_ops {
4683 + void (*clear_margins)(struct vc_data *vc, struct fb_info *info,
4684 + int color, int bottom_only);
4685 + void (*cursor)(struct vc_data *vc, struct fb_info *info, int mode,
4686 +- int softback_lines, int fg, int bg);
4687 ++ int fg, int bg);
4688 + int (*update_start)(struct fb_info *info);
4689 + int (*rotate_font)(struct fb_info *info, struct vc_data *vc);
4690 + struct fb_var_screeninfo var; /* copy of the current fb_var_screeninfo */
4691 +diff --git a/drivers/video/fbdev/core/fbcon_ccw.c b/drivers/video/fbdev/core/fbcon_ccw.c
4692 +index 78f3a56214782..71ad6967a70ee 100644
4693 +--- a/drivers/video/fbdev/core/fbcon_ccw.c
4694 ++++ b/drivers/video/fbdev/core/fbcon_ccw.c
4695 +@@ -219,7 +219,7 @@ static void ccw_clear_margins(struct vc_data *vc, struct fb_info *info,
4696 + }
4697 +
4698 + static void ccw_cursor(struct vc_data *vc, struct fb_info *info, int mode,
4699 +- int softback_lines, int fg, int bg)
4700 ++ int fg, int bg)
4701 + {
4702 + struct fb_cursor cursor;
4703 + struct fbcon_ops *ops = info->fbcon_par;
4704 +@@ -236,15 +236,6 @@ static void ccw_cursor(struct vc_data *vc, struct fb_info *info, int mode,
4705 +
4706 + cursor.set = 0;
4707 +
4708 +- if (softback_lines) {
4709 +- if (y + softback_lines >= vc->vc_rows) {
4710 +- mode = CM_ERASE;
4711 +- ops->cursor_flash = 0;
4712 +- return;
4713 +- } else
4714 +- y += softback_lines;
4715 +- }
4716 +-
4717 + c = scr_readw((u16 *) vc->vc_pos);
4718 + attribute = get_attribute(info, c);
4719 + src = ops->fontbuffer + ((c & charmask) * (w * vc->vc_font.width));
4720 +diff --git a/drivers/video/fbdev/core/fbcon_cw.c b/drivers/video/fbdev/core/fbcon_cw.c
4721 +index fd098ff17574b..31fe5dd651d44 100644
4722 +--- a/drivers/video/fbdev/core/fbcon_cw.c
4723 ++++ b/drivers/video/fbdev/core/fbcon_cw.c
4724 +@@ -202,7 +202,7 @@ static void cw_clear_margins(struct vc_data *vc, struct fb_info *info,
4725 + }
4726 +
4727 + static void cw_cursor(struct vc_data *vc, struct fb_info *info, int mode,
4728 +- int softback_lines, int fg, int bg)
4729 ++ int fg, int bg)
4730 + {
4731 + struct fb_cursor cursor;
4732 + struct fbcon_ops *ops = info->fbcon_par;
4733 +@@ -219,15 +219,6 @@ static void cw_cursor(struct vc_data *vc, struct fb_info *info, int mode,
4734 +
4735 + cursor.set = 0;
4736 +
4737 +- if (softback_lines) {
4738 +- if (y + softback_lines >= vc->vc_rows) {
4739 +- mode = CM_ERASE;
4740 +- ops->cursor_flash = 0;
4741 +- return;
4742 +- } else
4743 +- y += softback_lines;
4744 +- }
4745 +-
4746 + c = scr_readw((u16 *) vc->vc_pos);
4747 + attribute = get_attribute(info, c);
4748 + src = ops->fontbuffer + ((c & charmask) * (w * vc->vc_font.width));
4749 +diff --git a/drivers/video/fbdev/core/fbcon_ud.c b/drivers/video/fbdev/core/fbcon_ud.c
4750 +index e165a3fad29ad..b2dd1370e39b2 100644
4751 +--- a/drivers/video/fbdev/core/fbcon_ud.c
4752 ++++ b/drivers/video/fbdev/core/fbcon_ud.c
4753 +@@ -249,7 +249,7 @@ static void ud_clear_margins(struct vc_data *vc, struct fb_info *info,
4754 + }
4755 +
4756 + static void ud_cursor(struct vc_data *vc, struct fb_info *info, int mode,
4757 +- int softback_lines, int fg, int bg)
4758 ++ int fg, int bg)
4759 + {
4760 + struct fb_cursor cursor;
4761 + struct fbcon_ops *ops = info->fbcon_par;
4762 +@@ -267,15 +267,6 @@ static void ud_cursor(struct vc_data *vc, struct fb_info *info, int mode,
4763 +
4764 + cursor.set = 0;
4765 +
4766 +- if (softback_lines) {
4767 +- if (y + softback_lines >= vc->vc_rows) {
4768 +- mode = CM_ERASE;
4769 +- ops->cursor_flash = 0;
4770 +- return;
4771 +- } else
4772 +- y += softback_lines;
4773 +- }
4774 +-
4775 + c = scr_readw((u16 *) vc->vc_pos);
4776 + attribute = get_attribute(info, c);
4777 + src = ops->fontbuffer + ((c & charmask) * (w * vc->vc_font.height));
4778 +diff --git a/drivers/video/fbdev/core/tileblit.c b/drivers/video/fbdev/core/tileblit.c
4779 +index 93390312957ff..eb664dbf96f66 100644
4780 +--- a/drivers/video/fbdev/core/tileblit.c
4781 ++++ b/drivers/video/fbdev/core/tileblit.c
4782 +@@ -80,7 +80,7 @@ static void tile_clear_margins(struct vc_data *vc, struct fb_info *info,
4783 + }
4784 +
4785 + static void tile_cursor(struct vc_data *vc, struct fb_info *info, int mode,
4786 +- int softback_lines, int fg, int bg)
4787 ++ int fg, int bg)
4788 + {
4789 + struct fb_tilecursor cursor;
4790 + int use_sw = (vc->vc_cursor_type & 0x10);
4791 +diff --git a/drivers/video/fbdev/vga16fb.c b/drivers/video/fbdev/vga16fb.c
4792 +index 2c6a576ed84c7..4b83109202b1c 100644
4793 +--- a/drivers/video/fbdev/vga16fb.c
4794 ++++ b/drivers/video/fbdev/vga16fb.c
4795 +@@ -1121,7 +1121,7 @@ static void vga_8planes_imageblit(struct fb_info *info, const struct fb_image *i
4796 + char oldop = setop(0);
4797 + char oldsr = setsr(0);
4798 + char oldmask = selectmask();
4799 +- const char *cdat = image->data;
4800 ++ const unsigned char *cdat = image->data;
4801 + u32 dx = image->dx;
4802 + char __iomem *where;
4803 + int y;
4804 +diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
4805 +index 541497036cc24..31c1ed554d26d 100644
4806 +--- a/fs/btrfs/extent-tree.c
4807 ++++ b/fs/btrfs/extent-tree.c
4808 +@@ -402,12 +402,11 @@ int btrfs_get_extent_inline_ref_type(const struct extent_buffer *eb,
4809 + if (type == BTRFS_SHARED_BLOCK_REF_KEY) {
4810 + ASSERT(eb->fs_info);
4811 + /*
4812 +- * Every shared one has parent tree
4813 +- * block, which must be aligned to
4814 +- * nodesize.
4815 ++ * Every shared one has parent tree block,
4816 ++ * which must be aligned to sector size.
4817 + */
4818 + if (offset &&
4819 +- IS_ALIGNED(offset, eb->fs_info->nodesize))
4820 ++ IS_ALIGNED(offset, eb->fs_info->sectorsize))
4821 + return type;
4822 + }
4823 + } else if (is_data == BTRFS_REF_TYPE_DATA) {
4824 +@@ -416,12 +415,11 @@ int btrfs_get_extent_inline_ref_type(const struct extent_buffer *eb,
4825 + if (type == BTRFS_SHARED_DATA_REF_KEY) {
4826 + ASSERT(eb->fs_info);
4827 + /*
4828 +- * Every shared one has parent tree
4829 +- * block, which must be aligned to
4830 +- * nodesize.
4831 ++ * Every shared one has parent tree block,
4832 ++ * which must be aligned to sector size.
4833 + */
4834 + if (offset &&
4835 +- IS_ALIGNED(offset, eb->fs_info->nodesize))
4836 ++ IS_ALIGNED(offset, eb->fs_info->sectorsize))
4837 + return type;
4838 + }
4839 + } else {
4840 +@@ -431,8 +429,9 @@ int btrfs_get_extent_inline_ref_type(const struct extent_buffer *eb,
4841 + }
4842 +
4843 + btrfs_print_leaf((struct extent_buffer *)eb);
4844 +- btrfs_err(eb->fs_info, "eb %llu invalid extent inline ref type %d",
4845 +- eb->start, type);
4846 ++ btrfs_err(eb->fs_info,
4847 ++ "eb %llu iref 0x%lx invalid extent inline ref type %d",
4848 ++ eb->start, (unsigned long)iref, type);
4849 + WARN_ON(1);
4850 +
4851 + return BTRFS_REF_TYPE_INVALID;
4852 +diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
4853 +index 775fd5975191b..63394b450afcc 100644
4854 +--- a/fs/btrfs/ioctl.c
4855 ++++ b/fs/btrfs/ioctl.c
4856 +@@ -2215,7 +2215,8 @@ static noinline int search_ioctl(struct inode *inode,
4857 + key.offset = sk->min_offset;
4858 +
4859 + while (1) {
4860 +- ret = fault_in_pages_writeable(ubuf, *buf_size - sk_offset);
4861 ++ ret = fault_in_pages_writeable(ubuf + sk_offset,
4862 ++ *buf_size - sk_offset);
4863 + if (ret)
4864 + break;
4865 +
4866 +diff --git a/fs/btrfs/print-tree.c b/fs/btrfs/print-tree.c
4867 +index 9cb50577d9823..f4edadf1067f2 100644
4868 +--- a/fs/btrfs/print-tree.c
4869 ++++ b/fs/btrfs/print-tree.c
4870 +@@ -95,9 +95,10 @@ static void print_extent_item(struct extent_buffer *eb, int slot, int type)
4871 + * offset is supposed to be a tree block which
4872 + * must be aligned to nodesize.
4873 + */
4874 +- if (!IS_ALIGNED(offset, eb->fs_info->nodesize))
4875 +- pr_info("\t\t\t(parent %llu is NOT ALIGNED to nodesize %llu)\n",
4876 +- offset, (unsigned long long)eb->fs_info->nodesize);
4877 ++ if (!IS_ALIGNED(offset, eb->fs_info->sectorsize))
4878 ++ pr_info(
4879 ++ "\t\t\t(parent %llu not aligned to sectorsize %u)\n",
4880 ++ offset, eb->fs_info->sectorsize);
4881 + break;
4882 + case BTRFS_EXTENT_DATA_REF_KEY:
4883 + dref = (struct btrfs_extent_data_ref *)(&iref->offset);
4884 +@@ -112,8 +113,9 @@ static void print_extent_item(struct extent_buffer *eb, int slot, int type)
4885 + * must be aligned to nodesize.
4886 + */
4887 + if (!IS_ALIGNED(offset, eb->fs_info->nodesize))
4888 +- pr_info("\t\t\t(parent %llu is NOT ALIGNED to nodesize %llu)\n",
4889 +- offset, (unsigned long long)eb->fs_info->nodesize);
4890 ++ pr_info(
4891 ++ "\t\t\t(parent %llu not aligned to sectorsize %u)\n",
4892 ++ offset, eb->fs_info->sectorsize);
4893 + break;
4894 + default:
4895 + pr_cont("(extent %llu has INVALID ref type %d)\n",
4896 +diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
4897 +index 81be71fb569e1..4ecd6663dfb51 100644
4898 +--- a/fs/btrfs/volumes.c
4899 ++++ b/fs/btrfs/volumes.c
4900 +@@ -4,6 +4,7 @@
4901 + */
4902 +
4903 + #include <linux/sched.h>
4904 ++#include <linux/sched/mm.h>
4905 + #include <linux/bio.h>
4906 + #include <linux/slab.h>
4907 + #include <linux/buffer_head.h>
4908 +@@ -6708,8 +6709,17 @@ static struct btrfs_device *add_missing_dev(struct btrfs_fs_devices *fs_devices,
4909 + u64 devid, u8 *dev_uuid)
4910 + {
4911 + struct btrfs_device *device;
4912 ++ unsigned int nofs_flag;
4913 +
4914 ++ /*
4915 ++ * We call this under the chunk_mutex, so we want to use NOFS for this
4916 ++ * allocation, however we don't want to change btrfs_alloc_device() to
4917 ++ * always do NOFS because we use it in a lot of other GFP_KERNEL safe
4918 ++ * places.
4919 ++ */
4920 ++ nofs_flag = memalloc_nofs_save();
4921 + device = btrfs_alloc_device(NULL, &devid, dev_uuid);
4922 ++ memalloc_nofs_restore(nofs_flag);
4923 + if (IS_ERR(device))
4924 + return device;
4925 +
4926 +diff --git a/fs/debugfs/file.c b/fs/debugfs/file.c
4927 +index b43960794922d..943637298f650 100644
4928 +--- a/fs/debugfs/file.c
4929 ++++ b/fs/debugfs/file.c
4930 +@@ -176,7 +176,7 @@ static int open_proxy_open(struct inode *inode, struct file *filp)
4931 + goto out;
4932 +
4933 + if (!fops_get(real_fops)) {
4934 +-#ifdef MODULE
4935 ++#ifdef CONFIG_MODULES
4936 + if (real_fops->owner &&
4937 + real_fops->owner->state == MODULE_STATE_GOING)
4938 + goto out;
4939 +@@ -311,7 +311,7 @@ static int full_proxy_open(struct inode *inode, struct file *filp)
4940 + goto out;
4941 +
4942 + if (!fops_get(real_fops)) {
4943 +-#ifdef MODULE
4944 ++#ifdef CONFIG_MODULES
4945 + if (real_fops->owner &&
4946 + real_fops->owner->state == MODULE_STATE_GOING)
4947 + goto out;
4948 +diff --git a/fs/xfs/libxfs/xfs_attr_leaf.c b/fs/xfs/libxfs/xfs_attr_leaf.c
4949 +index fe277ee5ec7c4..5472ed3ce6943 100644
4950 +--- a/fs/xfs/libxfs/xfs_attr_leaf.c
4951 ++++ b/fs/xfs/libxfs/xfs_attr_leaf.c
4952 +@@ -583,8 +583,8 @@ xfs_attr_shortform_create(xfs_da_args_t *args)
4953 + ASSERT(ifp->if_flags & XFS_IFINLINE);
4954 + }
4955 + xfs_idata_realloc(dp, sizeof(*hdr), XFS_ATTR_FORK);
4956 +- hdr = (xfs_attr_sf_hdr_t *)ifp->if_u1.if_data;
4957 +- hdr->count = 0;
4958 ++ hdr = (struct xfs_attr_sf_hdr *)ifp->if_u1.if_data;
4959 ++ memset(hdr, 0, sizeof(*hdr));
4960 + hdr->totsize = cpu_to_be16(sizeof(*hdr));
4961 + xfs_trans_log_inode(args->trans, dp, XFS_ILOG_CORE | XFS_ILOG_ADATA);
4962 + }
4963 +diff --git a/fs/xfs/libxfs/xfs_ialloc.c b/fs/xfs/libxfs/xfs_ialloc.c
4964 +index 588d446130944..443cf33f66668 100644
4965 +--- a/fs/xfs/libxfs/xfs_ialloc.c
4966 ++++ b/fs/xfs/libxfs/xfs_ialloc.c
4967 +@@ -679,7 +679,7 @@ xfs_ialloc_ag_alloc(
4968 + args.minalignslop = igeo->cluster_align - 1;
4969 +
4970 + /* Allow space for the inode btree to split. */
4971 +- args.minleft = igeo->inobt_maxlevels - 1;
4972 ++ args.minleft = igeo->inobt_maxlevels;
4973 + if ((error = xfs_alloc_vextent(&args)))
4974 + return error;
4975 +
4976 +@@ -727,7 +727,7 @@ xfs_ialloc_ag_alloc(
4977 + /*
4978 + * Allow space for the inode btree to split.
4979 + */
4980 +- args.minleft = igeo->inobt_maxlevels - 1;
4981 ++ args.minleft = igeo->inobt_maxlevels;
4982 + if ((error = xfs_alloc_vextent(&args)))
4983 + return error;
4984 + }
4985 +diff --git a/fs/xfs/libxfs/xfs_trans_space.h b/fs/xfs/libxfs/xfs_trans_space.h
4986 +index c6df01a2a1585..7ad3659c5d2a9 100644
4987 +--- a/fs/xfs/libxfs/xfs_trans_space.h
4988 ++++ b/fs/xfs/libxfs/xfs_trans_space.h
4989 +@@ -58,7 +58,7 @@
4990 + #define XFS_IALLOC_SPACE_RES(mp) \
4991 + (M_IGEO(mp)->ialloc_blks + \
4992 + ((xfs_sb_version_hasfinobt(&mp->m_sb) ? 2 : 1) * \
4993 +- (M_IGEO(mp)->inobt_maxlevels - 1)))
4994 ++ M_IGEO(mp)->inobt_maxlevels))
4995 +
4996 + /*
4997 + * Space reservation values for various transactions.
4998 +diff --git a/include/linux/netfilter/nf_conntrack_sctp.h b/include/linux/netfilter/nf_conntrack_sctp.h
4999 +index 9a33f171aa822..625f491b95de8 100644
5000 +--- a/include/linux/netfilter/nf_conntrack_sctp.h
5001 ++++ b/include/linux/netfilter/nf_conntrack_sctp.h
5002 +@@ -9,6 +9,8 @@ struct ip_ct_sctp {
5003 + enum sctp_conntrack state;
5004 +
5005 + __be32 vtag[IP_CT_DIR_MAX];
5006 ++ u8 last_dir;
5007 ++ u8 flags;
5008 + };
5009 +
5010 + #endif /* _NF_CONNTRACK_SCTP_H */
5011 +diff --git a/include/soc/nps/common.h b/include/soc/nps/common.h
5012 +index 9b1d43d671a3f..8c18dc6d3fde5 100644
5013 +--- a/include/soc/nps/common.h
5014 ++++ b/include/soc/nps/common.h
5015 +@@ -45,6 +45,12 @@
5016 + #define CTOP_INST_MOV2B_FLIP_R3_B1_B2_INST 0x5B60
5017 + #define CTOP_INST_MOV2B_FLIP_R3_B1_B2_LIMM 0x00010422
5018 +
5019 ++#ifndef AUX_IENABLE
5020 ++#define AUX_IENABLE 0x40c
5021 ++#endif
5022 ++
5023 ++#define CTOP_AUX_IACK (0xFFFFF800 + 0x088)
5024 ++
5025 + #ifndef __ASSEMBLY__
5026 +
5027 + /* In order to increase compilation test coverage */
5028 +diff --git a/kernel/gcov/gcc_4_7.c b/kernel/gcov/gcc_4_7.c
5029 +index ec37563674d62..60c7be5ff5c8c 100644
5030 +--- a/kernel/gcov/gcc_4_7.c
5031 ++++ b/kernel/gcov/gcc_4_7.c
5032 +@@ -19,7 +19,9 @@
5033 + #include <linux/vmalloc.h>
5034 + #include "gcov.h"
5035 +
5036 +-#if (__GNUC__ >= 7)
5037 ++#if (__GNUC__ >= 10)
5038 ++#define GCOV_COUNTERS 8
5039 ++#elif (__GNUC__ >= 7)
5040 + #define GCOV_COUNTERS 9
5041 + #elif (__GNUC__ > 5) || (__GNUC__ == 5 && __GNUC_MINOR__ >= 1)
5042 + #define GCOV_COUNTERS 10
5043 +diff --git a/lib/kobject.c b/lib/kobject.c
5044 +index 386873bdd51c9..0c6d17503a113 100644
5045 +--- a/lib/kobject.c
5046 ++++ b/lib/kobject.c
5047 +@@ -630,8 +630,12 @@ static void __kobject_del(struct kobject *kobj)
5048 + */
5049 + void kobject_del(struct kobject *kobj)
5050 + {
5051 +- struct kobject *parent = kobj->parent;
5052 ++ struct kobject *parent;
5053 ++
5054 ++ if (!kobj)
5055 ++ return;
5056 +
5057 ++ parent = kobj->parent;
5058 + __kobject_del(kobj);
5059 + kobject_put(parent);
5060 + }
5061 +diff --git a/net/netfilter/nf_conntrack_proto_sctp.c b/net/netfilter/nf_conntrack_proto_sctp.c
5062 +index 4f897b14b6069..810cca24b3990 100644
5063 +--- a/net/netfilter/nf_conntrack_proto_sctp.c
5064 ++++ b/net/netfilter/nf_conntrack_proto_sctp.c
5065 +@@ -62,6 +62,8 @@ static const unsigned int sctp_timeouts[SCTP_CONNTRACK_MAX] = {
5066 + [SCTP_CONNTRACK_HEARTBEAT_ACKED] = 210 SECS,
5067 + };
5068 +
5069 ++#define SCTP_FLAG_HEARTBEAT_VTAG_FAILED 1
5070 ++
5071 + #define sNO SCTP_CONNTRACK_NONE
5072 + #define sCL SCTP_CONNTRACK_CLOSED
5073 + #define sCW SCTP_CONNTRACK_COOKIE_WAIT
5074 +@@ -369,6 +371,7 @@ int nf_conntrack_sctp_packet(struct nf_conn *ct,
5075 + u_int32_t offset, count;
5076 + unsigned int *timeouts;
5077 + unsigned long map[256 / sizeof(unsigned long)] = { 0 };
5078 ++ bool ignore = false;
5079 +
5080 + if (sctp_error(skb, dataoff, state))
5081 + return -NF_ACCEPT;
5082 +@@ -427,15 +430,39 @@ int nf_conntrack_sctp_packet(struct nf_conn *ct,
5083 + /* Sec 8.5.1 (D) */
5084 + if (sh->vtag != ct->proto.sctp.vtag[dir])
5085 + goto out_unlock;
5086 +- } else if (sch->type == SCTP_CID_HEARTBEAT ||
5087 +- sch->type == SCTP_CID_HEARTBEAT_ACK) {
5088 ++ } else if (sch->type == SCTP_CID_HEARTBEAT) {
5089 ++ if (ct->proto.sctp.vtag[dir] == 0) {
5090 ++ pr_debug("Setting %d vtag %x for dir %d\n", sch->type, sh->vtag, dir);
5091 ++ ct->proto.sctp.vtag[dir] = sh->vtag;
5092 ++ } else if (sh->vtag != ct->proto.sctp.vtag[dir]) {
5093 ++ if (test_bit(SCTP_CID_DATA, map) || ignore)
5094 ++ goto out_unlock;
5095 ++
5096 ++ ct->proto.sctp.flags |= SCTP_FLAG_HEARTBEAT_VTAG_FAILED;
5097 ++ ct->proto.sctp.last_dir = dir;
5098 ++ ignore = true;
5099 ++ continue;
5100 ++ } else if (ct->proto.sctp.flags & SCTP_FLAG_HEARTBEAT_VTAG_FAILED) {
5101 ++ ct->proto.sctp.flags &= ~SCTP_FLAG_HEARTBEAT_VTAG_FAILED;
5102 ++ }
5103 ++ } else if (sch->type == SCTP_CID_HEARTBEAT_ACK) {
5104 + if (ct->proto.sctp.vtag[dir] == 0) {
5105 + pr_debug("Setting vtag %x for dir %d\n",
5106 + sh->vtag, dir);
5107 + ct->proto.sctp.vtag[dir] = sh->vtag;
5108 + } else if (sh->vtag != ct->proto.sctp.vtag[dir]) {
5109 +- pr_debug("Verification tag check failed\n");
5110 +- goto out_unlock;
5111 ++ if (test_bit(SCTP_CID_DATA, map) || ignore)
5112 ++ goto out_unlock;
5113 ++
5114 ++ if ((ct->proto.sctp.flags & SCTP_FLAG_HEARTBEAT_VTAG_FAILED) == 0 ||
5115 ++ ct->proto.sctp.last_dir == dir)
5116 ++ goto out_unlock;
5117 ++
5118 ++ ct->proto.sctp.flags &= ~SCTP_FLAG_HEARTBEAT_VTAG_FAILED;
5119 ++ ct->proto.sctp.vtag[dir] = sh->vtag;
5120 ++ ct->proto.sctp.vtag[!dir] = 0;
5121 ++ } else if (ct->proto.sctp.flags & SCTP_FLAG_HEARTBEAT_VTAG_FAILED) {
5122 ++ ct->proto.sctp.flags &= ~SCTP_FLAG_HEARTBEAT_VTAG_FAILED;
5123 + }
5124 + }
5125 +
5126 +@@ -470,6 +497,10 @@ int nf_conntrack_sctp_packet(struct nf_conn *ct,
5127 + }
5128 + spin_unlock_bh(&ct->lock);
5129 +
5130 ++ /* allow but do not refresh timeout */
5131 ++ if (ignore)
5132 ++ return NF_ACCEPT;
5133 ++
5134 + timeouts = nf_ct_timeout_lookup(ct);
5135 + if (!timeouts)
5136 + timeouts = nf_sctp_pernet(nf_ct_net(ct))->timeouts;
5137 +diff --git a/net/wireless/util.c b/net/wireless/util.c
5138 +index 8481e9ac33da5..9abafd76ec50e 100644
5139 +--- a/net/wireless/util.c
5140 ++++ b/net/wireless/util.c
5141 +@@ -116,11 +116,13 @@ int ieee80211_frequency_to_channel(int freq)
5142 + return (freq - 2407) / 5;
5143 + else if (freq >= 4910 && freq <= 4980)
5144 + return (freq - 4000) / 5;
5145 +- else if (freq < 5945)
5146 ++ else if (freq < 5925)
5147 + return (freq - 5000) / 5;
5148 ++ else if (freq == 5935)
5149 ++ return 2;
5150 + else if (freq <= 45000) /* DMG band lower limit */
5151 +- /* see 802.11ax D4.1 27.3.22.2 */
5152 +- return (freq - 5940) / 5;
5153 ++ /* see 802.11ax D6.1 27.3.22.2 */
5154 ++ return (freq - 5950) / 5;
5155 + else if (freq >= 58320 && freq <= 70200)
5156 + return (freq - 56160) / 2160;
5157 + else
5158 +diff --git a/sound/hda/hdac_device.c b/sound/hda/hdac_device.c
5159 +index c946fd8beebca..b84e12f4f8046 100644
5160 +--- a/sound/hda/hdac_device.c
5161 ++++ b/sound/hda/hdac_device.c
5162 +@@ -127,6 +127,8 @@ EXPORT_SYMBOL_GPL(snd_hdac_device_init);
5163 + void snd_hdac_device_exit(struct hdac_device *codec)
5164 + {
5165 + pm_runtime_put_noidle(&codec->dev);
5166 ++ /* keep balance of runtime PM child_count in parent device */
5167 ++ pm_runtime_set_suspended(&codec->dev);
5168 + snd_hdac_bus_remove_device(codec->bus, codec);
5169 + kfree(codec->vendor_name);
5170 + kfree(codec->chip_name);
5171 +diff --git a/sound/pci/hda/hda_tegra.c b/sound/pci/hda/hda_tegra.c
5172 +index e5191584638ab..e378cb33c69df 100644
5173 +--- a/sound/pci/hda/hda_tegra.c
5174 ++++ b/sound/pci/hda/hda_tegra.c
5175 +@@ -169,6 +169,10 @@ static int __maybe_unused hda_tegra_runtime_suspend(struct device *dev)
5176 + struct hdac_bus *bus = azx_bus(chip);
5177 +
5178 + if (chip && chip->running) {
5179 ++ /* enable controller wake up event */
5180 ++ azx_writew(chip, WAKEEN, azx_readw(chip, WAKEEN) |
5181 ++ STATESTS_INT_MASK);
5182 ++
5183 + azx_stop_chip(chip);
5184 + synchronize_irq(bus->irq);
5185 + azx_enter_link_reset(chip);
5186 +@@ -191,6 +195,9 @@ static int __maybe_unused hda_tegra_runtime_resume(struct device *dev)
5187 + if (chip && chip->running) {
5188 + hda_tegra_init(hda);
5189 + azx_init_chip(chip, 1);
5190 ++ /* disable controller wake up event*/
5191 ++ azx_writew(chip, WAKEEN, azx_readw(chip, WAKEEN) &
5192 ++ ~STATESTS_INT_MASK);
5193 + }
5194 +
5195 + return 0;
5196 +diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
5197 +index a13bad262598d..51798632d334c 100644
5198 +--- a/sound/pci/hda/patch_hdmi.c
5199 ++++ b/sound/pci/hda/patch_hdmi.c
5200 +@@ -3678,6 +3678,7 @@ static int tegra_hdmi_build_pcms(struct hda_codec *codec)
5201 +
5202 + static int patch_tegra_hdmi(struct hda_codec *codec)
5203 + {
5204 ++ struct hdmi_spec *spec;
5205 + int err;
5206 +
5207 + err = patch_generic_hdmi(codec);
5208 +@@ -3685,6 +3686,10 @@ static int patch_tegra_hdmi(struct hda_codec *codec)
5209 + return err;
5210 +
5211 + codec->patch_ops.build_pcms = tegra_hdmi_build_pcms;
5212 ++ spec = codec->spec;
5213 ++ spec->chmap.ops.chmap_cea_alloc_validate_get_type =
5214 ++ nvhdmi_chmap_cea_alloc_validate_get_type;
5215 ++ spec->chmap.ops.chmap_validate = nvhdmi_chmap_validate;
5216 +
5217 + return 0;
5218 + }
5219 +@@ -4200,6 +4205,7 @@ HDA_CODEC_ENTRY(0x8086280c, "Cannonlake HDMI", patch_i915_glk_hdmi),
5220 + HDA_CODEC_ENTRY(0x8086280d, "Geminilake HDMI", patch_i915_glk_hdmi),
5221 + HDA_CODEC_ENTRY(0x8086280f, "Icelake HDMI", patch_i915_icl_hdmi),
5222 + HDA_CODEC_ENTRY(0x80862812, "Tigerlake HDMI", patch_i915_tgl_hdmi),
5223 ++HDA_CODEC_ENTRY(0x80862816, "Rocketlake HDMI", patch_i915_tgl_hdmi),
5224 + HDA_CODEC_ENTRY(0x8086281a, "Jasperlake HDMI", patch_i915_icl_hdmi),
5225 + HDA_CODEC_ENTRY(0x80862880, "CedarTrail HDMI", patch_generic_hdmi),
5226 + HDA_CODEC_ENTRY(0x80862882, "Valleyview2 HDMI", patch_i915_byt_hdmi),
5227 +diff --git a/tools/testing/selftests/timers/Makefile b/tools/testing/selftests/timers/Makefile
5228 +index 7656c7ce79d90..0e73a16874c4c 100644
5229 +--- a/tools/testing/selftests/timers/Makefile
5230 ++++ b/tools/testing/selftests/timers/Makefile
5231 +@@ -13,6 +13,7 @@ DESTRUCTIVE_TESTS = alarmtimer-suspend valid-adjtimex adjtick change_skew \
5232 +
5233 + TEST_GEN_PROGS_EXTENDED = $(DESTRUCTIVE_TESTS)
5234 +
5235 ++TEST_FILES := settings
5236 +
5237 + include ../lib.mk
5238 +
5239 +diff --git a/tools/testing/selftests/timers/settings b/tools/testing/selftests/timers/settings
5240 +new file mode 100644
5241 +index 0000000000000..e7b9417537fbc
5242 +--- /dev/null
5243 ++++ b/tools/testing/selftests/timers/settings
5244 +@@ -0,0 +1 @@
5245 ++timeout=0
5246 +diff --git a/virt/kvm/arm/mmu.c b/virt/kvm/arm/mmu.c
5247 +index 7501ec8a46004..1e1c4f6a85c7d 100644
5248 +--- a/virt/kvm/arm/mmu.c
5249 ++++ b/virt/kvm/arm/mmu.c
5250 +@@ -1814,7 +1814,12 @@ static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa,
5251 + (fault_status == FSC_PERM &&
5252 + stage2_is_exec(kvm, fault_ipa, vma_pagesize));
5253 +
5254 +- if (vma_pagesize == PUD_SIZE) {
5255 ++ /*
5256 ++ * If PUD_SIZE == PMD_SIZE, there is no real PUD level, and
5257 ++ * all we have is a 2-level page table. Trying to map a PUD in
5258 ++ * this case would be fatally wrong.
5259 ++ */
5260 ++ if (PUD_SIZE != PMD_SIZE && vma_pagesize == PUD_SIZE) {
5261 + pud_t new_pud = kvm_pfn_pud(pfn, mem_type);
5262 +
5263 + new_pud = kvm_pud_mkhuge(new_pud);
5264 +diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
5265 +index 278bdc53047e8..4eed7fd8db939 100644
5266 +--- a/virt/kvm/kvm_main.c
5267 ++++ b/virt/kvm/kvm_main.c
5268 +@@ -4010,7 +4010,7 @@ int kvm_io_bus_register_dev(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr,
5269 + void kvm_io_bus_unregister_dev(struct kvm *kvm, enum kvm_bus bus_idx,
5270 + struct kvm_io_device *dev)
5271 + {
5272 +- int i;
5273 ++ int i, j;
5274 + struct kvm_io_bus *new_bus, *bus;
5275 +
5276 + bus = kvm_get_bus(kvm, bus_idx);
5277 +@@ -4027,17 +4027,20 @@ void kvm_io_bus_unregister_dev(struct kvm *kvm, enum kvm_bus bus_idx,
5278 +
5279 + new_bus = kmalloc(struct_size(bus, range, bus->dev_count - 1),
5280 + GFP_KERNEL_ACCOUNT);
5281 +- if (!new_bus) {
5282 ++ if (new_bus) {
5283 ++ memcpy(new_bus, bus, sizeof(*bus) + i * sizeof(struct kvm_io_range));
5284 ++ new_bus->dev_count--;
5285 ++ memcpy(new_bus->range + i, bus->range + i + 1,
5286 ++ (new_bus->dev_count - i) * sizeof(struct kvm_io_range));
5287 ++ } else {
5288 + pr_err("kvm: failed to shrink bus, removing it completely\n");
5289 +- goto broken;
5290 ++ for (j = 0; j < bus->dev_count; j++) {
5291 ++ if (j == i)
5292 ++ continue;
5293 ++ kvm_iodevice_destructor(bus->range[j].dev);
5294 ++ }
5295 + }
5296 +
5297 +- memcpy(new_bus, bus, sizeof(*bus) + i * sizeof(struct kvm_io_range));
5298 +- new_bus->dev_count--;
5299 +- memcpy(new_bus->range + i, bus->range + i + 1,
5300 +- (new_bus->dev_count - i) * sizeof(struct kvm_io_range));
5301 +-
5302 +-broken:
5303 + rcu_assign_pointer(kvm->buses[bus_idx], new_bus);
5304 + synchronize_srcu_expedited(&kvm->srcu);
5305 + kfree(bus);