Gentoo Archives: gentoo-commits

From: Mike Pagano <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/linux-patches:4.20 commit in: /
Date: Wed, 20 Feb 2019 11:20:34
Message-Id: 1550661602.101885640cae489e3732b5d3f803620a1c092c4a.mpagano@gentoo
1 commit: 101885640cae489e3732b5d3f803620a1c092c4a
2 Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
3 AuthorDate: Wed Feb 20 11:20:02 2019 +0000
4 Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
5 CommitDate: Wed Feb 20 11:20:02 2019 +0000
6 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=10188564
7
8 proj/linux-patches: Linux patch 4.20.11
9
10 Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org>
11
12 0000_README | 4 +
13 1010_linux-4.20.11.patch | 3570 ++++++++++++++++++++++++++++++++++++++++++++++
14 2 files changed, 3574 insertions(+)
15
16 diff --git a/0000_README b/0000_README
17 index 35bccfa..068574e 100644
18 --- a/0000_README
19 +++ b/0000_README
20 @@ -83,6 +83,10 @@ Patch: 1009_linux-4.20.10.patch
21 From: http://www.kernel.org
22 Desc: Linux 4.20.10
23
24 +Patch: 1010_linux-4.20.11.patch
25 +From: http://www.kernel.org
26 +Desc: Linux 4.20.11
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/1010_linux-4.20.11.patch b/1010_linux-4.20.11.patch
33 new file mode 100644
34 index 0000000..5b451cc
35 --- /dev/null
36 +++ b/1010_linux-4.20.11.patch
37 @@ -0,0 +1,3570 @@
38 +diff --git a/Documentation/devicetree/bindings/eeprom/at24.txt b/Documentation/devicetree/bindings/eeprom/at24.txt
39 +index aededdbc262b..f9a7c984274c 100644
40 +--- a/Documentation/devicetree/bindings/eeprom/at24.txt
41 ++++ b/Documentation/devicetree/bindings/eeprom/at24.txt
42 +@@ -27,6 +27,7 @@ Required properties:
43 + "atmel,24c256",
44 + "atmel,24c512",
45 + "atmel,24c1024",
46 ++ "atmel,24c2048",
47 +
48 + If <manufacturer> is not "atmel", then a fallback must be used
49 + with the same <model> and "atmel" as manufacturer.
50 +diff --git a/Makefile b/Makefile
51 +index 6f7a8172de44..193cfe3a3d70 100644
52 +--- a/Makefile
53 ++++ b/Makefile
54 +@@ -1,7 +1,7 @@
55 + # SPDX-License-Identifier: GPL-2.0
56 + VERSION = 4
57 + PATCHLEVEL = 20
58 +-SUBLEVEL = 10
59 ++SUBLEVEL = 11
60 + EXTRAVERSION =
61 + NAME = Shy Crocodile
62 +
63 +diff --git a/arch/alpha/include/asm/irq.h b/arch/alpha/include/asm/irq.h
64 +index 4d17cacd1462..432402c8e47f 100644
65 +--- a/arch/alpha/include/asm/irq.h
66 ++++ b/arch/alpha/include/asm/irq.h
67 +@@ -56,15 +56,15 @@
68 +
69 + #elif defined(CONFIG_ALPHA_DP264) || \
70 + defined(CONFIG_ALPHA_LYNX) || \
71 +- defined(CONFIG_ALPHA_SHARK) || \
72 +- defined(CONFIG_ALPHA_EIGER)
73 ++ defined(CONFIG_ALPHA_SHARK)
74 + # define NR_IRQS 64
75 +
76 + #elif defined(CONFIG_ALPHA_TITAN)
77 + #define NR_IRQS 80
78 +
79 + #elif defined(CONFIG_ALPHA_RAWHIDE) || \
80 +- defined(CONFIG_ALPHA_TAKARA)
81 ++ defined(CONFIG_ALPHA_TAKARA) || \
82 ++ defined(CONFIG_ALPHA_EIGER)
83 + # define NR_IRQS 128
84 +
85 + #elif defined(CONFIG_ALPHA_WILDFIRE)
86 +diff --git a/arch/alpha/mm/fault.c b/arch/alpha/mm/fault.c
87 +index d73dc473fbb9..188fc9256baf 100644
88 +--- a/arch/alpha/mm/fault.c
89 ++++ b/arch/alpha/mm/fault.c
90 +@@ -78,7 +78,7 @@ __load_new_mm_context(struct mm_struct *next_mm)
91 + /* Macro for exception fixup code to access integer registers. */
92 + #define dpf_reg(r) \
93 + (((unsigned long *)regs)[(r) <= 8 ? (r) : (r) <= 15 ? (r)-16 : \
94 +- (r) <= 18 ? (r)+8 : (r)-10])
95 ++ (r) <= 18 ? (r)+10 : (r)-10])
96 +
97 + asmlinkage void
98 + do_page_fault(unsigned long address, unsigned long mmcsr,
99 +diff --git a/arch/arm/boot/dts/da850-evm.dts b/arch/arm/boot/dts/da850-evm.dts
100 +index a3c9b346721d..f04bc3e15332 100644
101 +--- a/arch/arm/boot/dts/da850-evm.dts
102 ++++ b/arch/arm/boot/dts/da850-evm.dts
103 +@@ -94,6 +94,28 @@
104 + regulator-boot-on;
105 + };
106 +
107 ++ baseboard_3v3: fixedregulator-3v3 {
108 ++ /* TPS73701DCQ */
109 ++ compatible = "regulator-fixed";
110 ++ regulator-name = "baseboard_3v3";
111 ++ regulator-min-microvolt = <3300000>;
112 ++ regulator-max-microvolt = <3300000>;
113 ++ vin-supply = <&vbat>;
114 ++ regulator-always-on;
115 ++ regulator-boot-on;
116 ++ };
117 ++
118 ++ baseboard_1v8: fixedregulator-1v8 {
119 ++ /* TPS73701DCQ */
120 ++ compatible = "regulator-fixed";
121 ++ regulator-name = "baseboard_1v8";
122 ++ regulator-min-microvolt = <1800000>;
123 ++ regulator-max-microvolt = <1800000>;
124 ++ vin-supply = <&vbat>;
125 ++ regulator-always-on;
126 ++ regulator-boot-on;
127 ++ };
128 ++
129 + backlight_lcd: backlight-regulator {
130 + compatible = "regulator-fixed";
131 + regulator-name = "lcd_backlight_pwr";
132 +@@ -105,7 +127,7 @@
133 +
134 + sound {
135 + compatible = "simple-audio-card";
136 +- simple-audio-card,name = "DA850/OMAP-L138 EVM";
137 ++ simple-audio-card,name = "DA850-OMAPL138 EVM";
138 + simple-audio-card,widgets =
139 + "Line", "Line In",
140 + "Line", "Line Out";
141 +@@ -210,10 +232,9 @@
142 +
143 + /* Regulators */
144 + IOVDD-supply = <&vdcdc2_reg>;
145 +- /* Derived from VBAT: Baseboard 3.3V / 1.8V */
146 +- AVDD-supply = <&vbat>;
147 +- DRVDD-supply = <&vbat>;
148 +- DVDD-supply = <&vbat>;
149 ++ AVDD-supply = <&baseboard_3v3>;
150 ++ DRVDD-supply = <&baseboard_3v3>;
151 ++ DVDD-supply = <&baseboard_1v8>;
152 + };
153 + tca6416: gpio@20 {
154 + compatible = "ti,tca6416";
155 +diff --git a/arch/arm/boot/dts/da850-lcdk.dts b/arch/arm/boot/dts/da850-lcdk.dts
156 +index 0177e3ed20fe..3a2fa6e035a3 100644
157 +--- a/arch/arm/boot/dts/da850-lcdk.dts
158 ++++ b/arch/arm/boot/dts/da850-lcdk.dts
159 +@@ -39,9 +39,39 @@
160 + };
161 + };
162 +
163 ++ vcc_5vd: fixedregulator-vcc_5vd {
164 ++ compatible = "regulator-fixed";
165 ++ regulator-name = "vcc_5vd";
166 ++ regulator-min-microvolt = <5000000>;
167 ++ regulator-max-microvolt = <5000000>;
168 ++ regulator-boot-on;
169 ++ };
170 ++
171 ++ vcc_3v3d: fixedregulator-vcc_3v3d {
172 ++ /* TPS650250 - VDCDC1 */
173 ++ compatible = "regulator-fixed";
174 ++ regulator-name = "vcc_3v3d";
175 ++ regulator-min-microvolt = <3300000>;
176 ++ regulator-max-microvolt = <3300000>;
177 ++ vin-supply = <&vcc_5vd>;
178 ++ regulator-always-on;
179 ++ regulator-boot-on;
180 ++ };
181 ++
182 ++ vcc_1v8d: fixedregulator-vcc_1v8d {
183 ++ /* TPS650250 - VDCDC2 */
184 ++ compatible = "regulator-fixed";
185 ++ regulator-name = "vcc_1v8d";
186 ++ regulator-min-microvolt = <1800000>;
187 ++ regulator-max-microvolt = <1800000>;
188 ++ vin-supply = <&vcc_5vd>;
189 ++ regulator-always-on;
190 ++ regulator-boot-on;
191 ++ };
192 ++
193 + sound {
194 + compatible = "simple-audio-card";
195 +- simple-audio-card,name = "DA850/OMAP-L138 LCDK";
196 ++ simple-audio-card,name = "DA850-OMAPL138 LCDK";
197 + simple-audio-card,widgets =
198 + "Line", "Line In",
199 + "Line", "Line Out";
200 +@@ -221,6 +251,12 @@
201 + compatible = "ti,tlv320aic3106";
202 + reg = <0x18>;
203 + status = "okay";
204 ++
205 ++ /* Regulators */
206 ++ IOVDD-supply = <&vcc_3v3d>;
207 ++ AVDD-supply = <&vcc_3v3d>;
208 ++ DRVDD-supply = <&vcc_3v3d>;
209 ++ DVDD-supply = <&vcc_1v8d>;
210 + };
211 + };
212 +
213 +diff --git a/arch/arm/boot/dts/kirkwood-dnskw.dtsi b/arch/arm/boot/dts/kirkwood-dnskw.dtsi
214 +index cbaf06f2f78e..eb917462b219 100644
215 +--- a/arch/arm/boot/dts/kirkwood-dnskw.dtsi
216 ++++ b/arch/arm/boot/dts/kirkwood-dnskw.dtsi
217 +@@ -36,8 +36,8 @@
218 + compatible = "gpio-fan";
219 + pinctrl-0 = <&pmx_fan_high_speed &pmx_fan_low_speed>;
220 + pinctrl-names = "default";
221 +- gpios = <&gpio1 14 GPIO_ACTIVE_LOW
222 +- &gpio1 13 GPIO_ACTIVE_LOW>;
223 ++ gpios = <&gpio1 14 GPIO_ACTIVE_HIGH
224 ++ &gpio1 13 GPIO_ACTIVE_HIGH>;
225 + gpio-fan,speed-map = <0 0
226 + 3000 1
227 + 6000 2>;
228 +diff --git a/arch/arm/boot/dts/omap5-board-common.dtsi b/arch/arm/boot/dts/omap5-board-common.dtsi
229 +index bf7ca00f4c21..c2dc4199b4ec 100644
230 +--- a/arch/arm/boot/dts/omap5-board-common.dtsi
231 ++++ b/arch/arm/boot/dts/omap5-board-common.dtsi
232 +@@ -317,7 +317,8 @@
233 +
234 + palmas_sys_nirq_pins: pinmux_palmas_sys_nirq_pins {
235 + pinctrl-single,pins = <
236 +- OMAP5_IOPAD(0x068, PIN_INPUT_PULLUP | MUX_MODE0) /* sys_nirq1 */
237 ++ /* sys_nirq1 is pulled down as the SoC is inverting it for GIC */
238 ++ OMAP5_IOPAD(0x068, PIN_INPUT_PULLUP | MUX_MODE0)
239 + >;
240 + };
241 +
242 +@@ -385,7 +386,8 @@
243 +
244 + palmas: palmas@48 {
245 + compatible = "ti,palmas";
246 +- interrupts = <GIC_SPI 7 IRQ_TYPE_NONE>; /* IRQ_SYS_1N */
247 ++ /* sys_nirq/ext_sys_irq pins get inverted at mpuss wakeupgen */
248 ++ interrupts = <GIC_SPI 7 IRQ_TYPE_LEVEL_LOW>;
249 + reg = <0x48>;
250 + interrupt-controller;
251 + #interrupt-cells = <2>;
252 +@@ -651,7 +653,8 @@
253 + pinctrl-names = "default";
254 + pinctrl-0 = <&twl6040_pins>;
255 +
256 +- interrupts = <GIC_SPI 119 IRQ_TYPE_NONE>; /* IRQ_SYS_2N cascaded to gic */
257 ++ /* sys_nirq/ext_sys_irq pins get inverted at mpuss wakeupgen */
258 ++ interrupts = <GIC_SPI 119 IRQ_TYPE_LEVEL_LOW>;
259 +
260 + /* audpwron gpio defined in the board specific dts */
261 +
262 +diff --git a/arch/arm/boot/dts/omap5-cm-t54.dts b/arch/arm/boot/dts/omap5-cm-t54.dts
263 +index 5e21fb430a65..e78d3718f145 100644
264 +--- a/arch/arm/boot/dts/omap5-cm-t54.dts
265 ++++ b/arch/arm/boot/dts/omap5-cm-t54.dts
266 +@@ -181,6 +181,13 @@
267 + OMAP5_IOPAD(0x0042, PIN_INPUT_PULLDOWN | MUX_MODE6) /* llib_wakereqin.gpio1_wk15 */
268 + >;
269 + };
270 ++
271 ++ palmas_sys_nirq_pins: pinmux_palmas_sys_nirq_pins {
272 ++ pinctrl-single,pins = <
273 ++ /* sys_nirq1 is pulled down as the SoC is inverting it for GIC */
274 ++ OMAP5_IOPAD(0x068, PIN_INPUT_PULLUP | MUX_MODE0)
275 ++ >;
276 ++ };
277 + };
278 +
279 + &omap5_pmx_core {
280 +@@ -414,8 +421,11 @@
281 +
282 + palmas: palmas@48 {
283 + compatible = "ti,palmas";
284 +- interrupts = <GIC_SPI 7 IRQ_TYPE_NONE>; /* IRQ_SYS_1N */
285 + reg = <0x48>;
286 ++ pinctrl-0 = <&palmas_sys_nirq_pins>;
287 ++ pinctrl-names = "default";
288 ++ /* sys_nirq/ext_sys_irq pins get inverted at mpuss wakeupgen */
289 ++ interrupts = <GIC_SPI 7 IRQ_TYPE_LEVEL_LOW>;
290 + interrupt-controller;
291 + #interrupt-cells = <2>;
292 + ti,system-power-controller;
293 +diff --git a/arch/arm/mach-integrator/impd1.c b/arch/arm/mach-integrator/impd1.c
294 +index a109f6482413..0f916c245a2e 100644
295 +--- a/arch/arm/mach-integrator/impd1.c
296 ++++ b/arch/arm/mach-integrator/impd1.c
297 +@@ -393,7 +393,11 @@ static int __ref impd1_probe(struct lm_device *dev)
298 + sizeof(*lookup) + 3 * sizeof(struct gpiod_lookup),
299 + GFP_KERNEL);
300 + chipname = devm_kstrdup(&dev->dev, devname, GFP_KERNEL);
301 +- mmciname = kasprintf(GFP_KERNEL, "lm%x:00700", dev->id);
302 ++ mmciname = devm_kasprintf(&dev->dev, GFP_KERNEL,
303 ++ "lm%x:00700", dev->id);
304 ++ if (!lookup || !chipname || !mmciname)
305 ++ return -ENOMEM;
306 ++
307 + lookup->dev_id = mmciname;
308 + /*
309 + * Offsets on GPIO block 1:
310 +diff --git a/arch/arm/mach-omap2/omap-wakeupgen.c b/arch/arm/mach-omap2/omap-wakeupgen.c
311 +index fc5fb776a710..17558be4bf0a 100644
312 +--- a/arch/arm/mach-omap2/omap-wakeupgen.c
313 ++++ b/arch/arm/mach-omap2/omap-wakeupgen.c
314 +@@ -50,6 +50,9 @@
315 + #define OMAP4_NR_BANKS 4
316 + #define OMAP4_NR_IRQS 128
317 +
318 ++#define SYS_NIRQ1_EXT_SYS_IRQ_1 7
319 ++#define SYS_NIRQ2_EXT_SYS_IRQ_2 119
320 ++
321 + static void __iomem *wakeupgen_base;
322 + static void __iomem *sar_base;
323 + static DEFINE_RAW_SPINLOCK(wakeupgen_lock);
324 +@@ -153,6 +156,37 @@ static void wakeupgen_unmask(struct irq_data *d)
325 + irq_chip_unmask_parent(d);
326 + }
327 +
328 ++/*
329 ++ * The sys_nirq pins bypass peripheral modules and are wired directly
330 ++ * to MPUSS wakeupgen. They get automatically inverted for GIC.
331 ++ */
332 ++static int wakeupgen_irq_set_type(struct irq_data *d, unsigned int type)
333 ++{
334 ++ bool inverted = false;
335 ++
336 ++ switch (type) {
337 ++ case IRQ_TYPE_LEVEL_LOW:
338 ++ type &= ~IRQ_TYPE_LEVEL_MASK;
339 ++ type |= IRQ_TYPE_LEVEL_HIGH;
340 ++ inverted = true;
341 ++ break;
342 ++ case IRQ_TYPE_EDGE_FALLING:
343 ++ type &= ~IRQ_TYPE_EDGE_BOTH;
344 ++ type |= IRQ_TYPE_EDGE_RISING;
345 ++ inverted = true;
346 ++ break;
347 ++ default:
348 ++ break;
349 ++ }
350 ++
351 ++ if (inverted && d->hwirq != SYS_NIRQ1_EXT_SYS_IRQ_1 &&
352 ++ d->hwirq != SYS_NIRQ2_EXT_SYS_IRQ_2)
353 ++ pr_warn("wakeupgen: irq%li polarity inverted in dts\n",
354 ++ d->hwirq);
355 ++
356 ++ return irq_chip_set_type_parent(d, type);
357 ++}
358 ++
359 + #ifdef CONFIG_HOTPLUG_CPU
360 + static DEFINE_PER_CPU(u32 [MAX_NR_REG_BANKS], irqmasks);
361 +
362 +@@ -446,7 +480,7 @@ static struct irq_chip wakeupgen_chip = {
363 + .irq_mask = wakeupgen_mask,
364 + .irq_unmask = wakeupgen_unmask,
365 + .irq_retrigger = irq_chip_retrigger_hierarchy,
366 +- .irq_set_type = irq_chip_set_type_parent,
367 ++ .irq_set_type = wakeupgen_irq_set_type,
368 + .flags = IRQCHIP_SKIP_SET_WAKE | IRQCHIP_MASK_ON_SUSPEND,
369 + #ifdef CONFIG_SMP
370 + .irq_set_affinity = irq_chip_set_affinity_parent,
371 +diff --git a/arch/arm64/boot/dts/rockchip/rk3328-rock64.dts b/arch/arm64/boot/dts/rockchip/rk3328-rock64.dts
372 +index dc20145dd393..c6509a02480d 100644
373 +--- a/arch/arm64/boot/dts/rockchip/rk3328-rock64.dts
374 ++++ b/arch/arm64/boot/dts/rockchip/rk3328-rock64.dts
375 +@@ -40,6 +40,7 @@
376 + pinctrl-0 = <&usb30_host_drv>;
377 + regulator-name = "vcc_host_5v";
378 + regulator-always-on;
379 ++ regulator-boot-on;
380 + vin-supply = <&vcc_sys>;
381 + };
382 +
383 +@@ -51,6 +52,7 @@
384 + pinctrl-0 = <&usb20_host_drv>;
385 + regulator-name = "vcc_host1_5v";
386 + regulator-always-on;
387 ++ regulator-boot-on;
388 + vin-supply = <&vcc_sys>;
389 + };
390 +
391 +diff --git a/arch/csky/include/asm/io.h b/arch/csky/include/asm/io.h
392 +index ecae6b358f95..c1dfa9c10e36 100644
393 +--- a/arch/csky/include/asm/io.h
394 ++++ b/arch/csky/include/asm/io.h
395 +@@ -15,6 +15,31 @@ extern void iounmap(void *addr);
396 + extern int remap_area_pages(unsigned long address, phys_addr_t phys_addr,
397 + size_t size, unsigned long flags);
398 +
399 ++/*
400 ++ * I/O memory access primitives. Reads are ordered relative to any
401 ++ * following Normal memory access. Writes are ordered relative to any prior
402 ++ * Normal memory access.
403 ++ *
404 ++ * For CACHEV1 (807, 810), store instruction could fast retire, so we need
405 ++ * another mb() to prevent st fast retire.
406 ++ *
407 ++ * For CACHEV2 (860), store instruction with PAGE_ATTR_NO_BUFFERABLE won't
408 ++ * fast retire.
409 ++ */
410 ++#define readb(c) ({ u8 __v = readb_relaxed(c); rmb(); __v; })
411 ++#define readw(c) ({ u16 __v = readw_relaxed(c); rmb(); __v; })
412 ++#define readl(c) ({ u32 __v = readl_relaxed(c); rmb(); __v; })
413 ++
414 ++#ifdef CONFIG_CPU_HAS_CACHEV2
415 ++#define writeb(v,c) ({ wmb(); writeb_relaxed((v),(c)); })
416 ++#define writew(v,c) ({ wmb(); writew_relaxed((v),(c)); })
417 ++#define writel(v,c) ({ wmb(); writel_relaxed((v),(c)); })
418 ++#else
419 ++#define writeb(v,c) ({ wmb(); writeb_relaxed((v),(c)); mb(); })
420 ++#define writew(v,c) ({ wmb(); writew_relaxed((v),(c)); mb(); })
421 ++#define writel(v,c) ({ wmb(); writel_relaxed((v),(c)); mb(); })
422 ++#endif
423 ++
424 + #define ioremap_nocache(phy, sz) ioremap(phy, sz)
425 + #define ioremap_wc ioremap_nocache
426 + #define ioremap_wt ioremap_nocache
427 +diff --git a/arch/csky/kernel/module.c b/arch/csky/kernel/module.c
428 +index 65abab0c7a47..b5ad7d9de18c 100644
429 +--- a/arch/csky/kernel/module.c
430 ++++ b/arch/csky/kernel/module.c
431 +@@ -12,7 +12,7 @@
432 + #include <linux/spinlock.h>
433 + #include <asm/pgtable.h>
434 +
435 +-#if defined(__CSKYABIV2__)
436 ++#ifdef CONFIG_CPU_CK810
437 + #define IS_BSR32(hi16, lo16) (((hi16) & 0xFC00) == 0xE000)
438 + #define IS_JSRI32(hi16, lo16) ((hi16) == 0xEAE0)
439 +
440 +@@ -25,6 +25,26 @@
441 + *(uint16_t *)(addr) = 0xE8Fa; \
442 + *((uint16_t *)(addr) + 1) = 0x0000; \
443 + } while (0)
444 ++
445 ++static void jsri_2_lrw_jsr(uint32_t *location)
446 ++{
447 ++ uint16_t *location_tmp = (uint16_t *)location;
448 ++
449 ++ if (IS_BSR32(*location_tmp, *(location_tmp + 1)))
450 ++ return;
451 ++
452 ++ if (IS_JSRI32(*location_tmp, *(location_tmp + 1))) {
453 ++ /* jsri 0x... --> lrw r26, 0x... */
454 ++ CHANGE_JSRI_TO_LRW(location);
455 ++ /* lsli r0, r0 --> jsr r26 */
456 ++ SET_JSR32_R26(location + 1);
457 ++ }
458 ++}
459 ++#else
460 ++static void inline jsri_2_lrw_jsr(uint32_t *location)
461 ++{
462 ++ return;
463 ++}
464 + #endif
465 +
466 + int apply_relocate_add(Elf32_Shdr *sechdrs, const char *strtab,
467 +@@ -35,9 +55,6 @@ int apply_relocate_add(Elf32_Shdr *sechdrs, const char *strtab,
468 + Elf32_Sym *sym;
469 + uint32_t *location;
470 + short *temp;
471 +-#if defined(__CSKYABIV2__)
472 +- uint16_t *location_tmp;
473 +-#endif
474 +
475 + for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rel); i++) {
476 + /* This is where to make the change */
477 +@@ -59,18 +76,7 @@ int apply_relocate_add(Elf32_Shdr *sechdrs, const char *strtab,
478 + case R_CSKY_PCRELJSR_IMM11BY2:
479 + break;
480 + case R_CSKY_PCRELJSR_IMM26BY2:
481 +-#if defined(__CSKYABIV2__)
482 +- location_tmp = (uint16_t *)location;
483 +- if (IS_BSR32(*location_tmp, *(location_tmp + 1)))
484 +- break;
485 +-
486 +- if (IS_JSRI32(*location_tmp, *(location_tmp + 1))) {
487 +- /* jsri 0x... --> lrw r26, 0x... */
488 +- CHANGE_JSRI_TO_LRW(location);
489 +- /* lsli r0, r0 --> jsr r26 */
490 +- SET_JSR32_R26(location + 1);
491 +- }
492 +-#endif
493 ++ jsri_2_lrw_jsr(location);
494 + break;
495 + case R_CSKY_ADDR_HI16:
496 + temp = ((short *)location) + 1;
497 +diff --git a/arch/powerpc/include/asm/book3s/64/pgtable.h b/arch/powerpc/include/asm/book3s/64/pgtable.h
498 +index db706ffc4ca9..5ff63d53b31c 100644
499 +--- a/arch/powerpc/include/asm/book3s/64/pgtable.h
500 ++++ b/arch/powerpc/include/asm/book3s/64/pgtable.h
501 +@@ -904,7 +904,7 @@ static inline int pud_none(pud_t pud)
502 +
503 + static inline int pud_present(pud_t pud)
504 + {
505 +- return (pud_raw(pud) & cpu_to_be64(_PAGE_PRESENT));
506 ++ return !!(pud_raw(pud) & cpu_to_be64(_PAGE_PRESENT));
507 + }
508 +
509 + extern struct page *pud_page(pud_t pud);
510 +@@ -951,7 +951,7 @@ static inline int pgd_none(pgd_t pgd)
511 +
512 + static inline int pgd_present(pgd_t pgd)
513 + {
514 +- return (pgd_raw(pgd) & cpu_to_be64(_PAGE_PRESENT));
515 ++ return !!(pgd_raw(pgd) & cpu_to_be64(_PAGE_PRESENT));
516 + }
517 +
518 + static inline pte_t pgd_pte(pgd_t pgd)
519 +diff --git a/arch/riscv/include/asm/pgtable-bits.h b/arch/riscv/include/asm/pgtable-bits.h
520 +index 2fa2942be221..470755cb7558 100644
521 +--- a/arch/riscv/include/asm/pgtable-bits.h
522 ++++ b/arch/riscv/include/asm/pgtable-bits.h
523 +@@ -35,6 +35,12 @@
524 + #define _PAGE_SPECIAL _PAGE_SOFT
525 + #define _PAGE_TABLE _PAGE_PRESENT
526 +
527 ++/*
528 ++ * _PAGE_PROT_NONE is set on not-present pages (and ignored by the hardware) to
529 ++ * distinguish them from swapped out pages
530 ++ */
531 ++#define _PAGE_PROT_NONE _PAGE_READ
532 ++
533 + #define _PAGE_PFN_SHIFT 10
534 +
535 + /* Set of bits to preserve across pte_modify() */
536 +diff --git a/arch/riscv/include/asm/pgtable.h b/arch/riscv/include/asm/pgtable.h
537 +index 16301966d65b..a8179a8c1491 100644
538 +--- a/arch/riscv/include/asm/pgtable.h
539 ++++ b/arch/riscv/include/asm/pgtable.h
540 +@@ -44,7 +44,7 @@
541 + /* Page protection bits */
542 + #define _PAGE_BASE (_PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_USER)
543 +
544 +-#define PAGE_NONE __pgprot(0)
545 ++#define PAGE_NONE __pgprot(_PAGE_PROT_NONE)
546 + #define PAGE_READ __pgprot(_PAGE_BASE | _PAGE_READ)
547 + #define PAGE_WRITE __pgprot(_PAGE_BASE | _PAGE_READ | _PAGE_WRITE)
548 + #define PAGE_EXEC __pgprot(_PAGE_BASE | _PAGE_EXEC)
549 +@@ -98,7 +98,7 @@ extern unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)];
550 +
551 + static inline int pmd_present(pmd_t pmd)
552 + {
553 +- return (pmd_val(pmd) & _PAGE_PRESENT);
554 ++ return (pmd_val(pmd) & (_PAGE_PRESENT | _PAGE_PROT_NONE));
555 + }
556 +
557 + static inline int pmd_none(pmd_t pmd)
558 +@@ -178,7 +178,7 @@ static inline pte_t *pte_offset_kernel(pmd_t *pmd, unsigned long addr)
559 +
560 + static inline int pte_present(pte_t pte)
561 + {
562 +- return (pte_val(pte) & _PAGE_PRESENT);
563 ++ return (pte_val(pte) & (_PAGE_PRESENT | _PAGE_PROT_NONE));
564 + }
565 +
566 + static inline int pte_none(pte_t pte)
567 +@@ -380,7 +380,7 @@ static inline int ptep_clear_flush_young(struct vm_area_struct *vma,
568 + *
569 + * Format of swap PTE:
570 + * bit 0: _PAGE_PRESENT (zero)
571 +- * bit 1: reserved for future use (zero)
572 ++ * bit 1: _PAGE_PROT_NONE (zero)
573 + * bits 2 to 6: swap type
574 + * bits 7 to XLEN-1: swap offset
575 + */
576 +diff --git a/arch/riscv/kernel/ptrace.c b/arch/riscv/kernel/ptrace.c
577 +index 60f1e02eed36..6c898d540d9d 100644
578 +--- a/arch/riscv/kernel/ptrace.c
579 ++++ b/arch/riscv/kernel/ptrace.c
580 +@@ -172,6 +172,6 @@ void do_syscall_trace_exit(struct pt_regs *regs)
581 +
582 + #ifdef CONFIG_HAVE_SYSCALL_TRACEPOINTS
583 + if (test_thread_flag(TIF_SYSCALL_TRACEPOINT))
584 +- trace_sys_exit(regs, regs->regs[0]);
585 ++ trace_sys_exit(regs, regs_return_value(regs));
586 + #endif
587 + }
588 +diff --git a/arch/s390/kernel/swsusp.S b/arch/s390/kernel/swsusp.S
589 +index 537f97fde37f..b6796e616812 100644
590 +--- a/arch/s390/kernel/swsusp.S
591 ++++ b/arch/s390/kernel/swsusp.S
592 +@@ -30,10 +30,10 @@
593 + .section .text
594 + ENTRY(swsusp_arch_suspend)
595 + lg %r1,__LC_NODAT_STACK
596 +- aghi %r1,-STACK_FRAME_OVERHEAD
597 + stmg %r6,%r15,__SF_GPRS(%r1)
598 ++ aghi %r1,-STACK_FRAME_OVERHEAD
599 + stg %r15,__SF_BACKCHAIN(%r1)
600 +- lgr %r1,%r15
601 ++ lgr %r15,%r1
602 +
603 + /* Store FPU registers */
604 + brasl %r14,save_fpu_regs
605 +diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c
606 +index 374a19712e20..b684f0294f35 100644
607 +--- a/arch/x86/events/core.c
608 ++++ b/arch/x86/events/core.c
609 +@@ -2278,6 +2278,19 @@ void perf_check_microcode(void)
610 + x86_pmu.check_microcode();
611 + }
612 +
613 ++static int x86_pmu_check_period(struct perf_event *event, u64 value)
614 ++{
615 ++ if (x86_pmu.check_period && x86_pmu.check_period(event, value))
616 ++ return -EINVAL;
617 ++
618 ++ if (value && x86_pmu.limit_period) {
619 ++ if (x86_pmu.limit_period(event, value) > value)
620 ++ return -EINVAL;
621 ++ }
622 ++
623 ++ return 0;
624 ++}
625 ++
626 + static struct pmu pmu = {
627 + .pmu_enable = x86_pmu_enable,
628 + .pmu_disable = x86_pmu_disable,
629 +@@ -2302,6 +2315,7 @@ static struct pmu pmu = {
630 + .event_idx = x86_pmu_event_idx,
631 + .sched_task = x86_pmu_sched_task,
632 + .task_ctx_size = sizeof(struct x86_perf_task_context),
633 ++ .check_period = x86_pmu_check_period,
634 + };
635 +
636 + void arch_perf_update_userpage(struct perf_event *event,
637 +diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c
638 +index 90b6718ff861..ede20c44cc69 100644
639 +--- a/arch/x86/events/intel/core.c
640 ++++ b/arch/x86/events/intel/core.c
641 +@@ -3587,6 +3587,11 @@ static void intel_pmu_sched_task(struct perf_event_context *ctx,
642 + intel_pmu_lbr_sched_task(ctx, sched_in);
643 + }
644 +
645 ++static int intel_pmu_check_period(struct perf_event *event, u64 value)
646 ++{
647 ++ return intel_pmu_has_bts_period(event, value) ? -EINVAL : 0;
648 ++}
649 ++
650 + PMU_FORMAT_ATTR(offcore_rsp, "config1:0-63");
651 +
652 + PMU_FORMAT_ATTR(ldlat, "config1:0-15");
653 +@@ -3667,6 +3672,8 @@ static __initconst const struct x86_pmu core_pmu = {
654 + .cpu_starting = intel_pmu_cpu_starting,
655 + .cpu_dying = intel_pmu_cpu_dying,
656 + .cpu_dead = intel_pmu_cpu_dead,
657 ++
658 ++ .check_period = intel_pmu_check_period,
659 + };
660 +
661 + static struct attribute *intel_pmu_attrs[];
662 +@@ -3711,6 +3718,8 @@ static __initconst const struct x86_pmu intel_pmu = {
663 +
664 + .guest_get_msrs = intel_guest_get_msrs,
665 + .sched_task = intel_pmu_sched_task,
666 ++
667 ++ .check_period = intel_pmu_check_period,
668 + };
669 +
670 + static __init void intel_clovertown_quirk(void)
671 +diff --git a/arch/x86/events/perf_event.h b/arch/x86/events/perf_event.h
672 +index 78d7b7031bfc..d46fd6754d92 100644
673 +--- a/arch/x86/events/perf_event.h
674 ++++ b/arch/x86/events/perf_event.h
675 +@@ -646,6 +646,11 @@ struct x86_pmu {
676 + * Intel host/guest support (KVM)
677 + */
678 + struct perf_guest_switch_msr *(*guest_get_msrs)(int *nr);
679 ++
680 ++ /*
681 ++ * Check period value for PERF_EVENT_IOC_PERIOD ioctl.
682 ++ */
683 ++ int (*check_period) (struct perf_event *event, u64 period);
684 + };
685 +
686 + struct x86_perf_task_context {
687 +@@ -857,7 +862,7 @@ static inline int amd_pmu_init(void)
688 +
689 + #ifdef CONFIG_CPU_SUP_INTEL
690 +
691 +-static inline bool intel_pmu_has_bts(struct perf_event *event)
692 ++static inline bool intel_pmu_has_bts_period(struct perf_event *event, u64 period)
693 + {
694 + struct hw_perf_event *hwc = &event->hw;
695 + unsigned int hw_event, bts_event;
696 +@@ -868,7 +873,14 @@ static inline bool intel_pmu_has_bts(struct perf_event *event)
697 + hw_event = hwc->config & INTEL_ARCH_EVENT_MASK;
698 + bts_event = x86_pmu.event_map(PERF_COUNT_HW_BRANCH_INSTRUCTIONS);
699 +
700 +- return hw_event == bts_event && hwc->sample_period == 1;
701 ++ return hw_event == bts_event && period == 1;
702 ++}
703 ++
704 ++static inline bool intel_pmu_has_bts(struct perf_event *event)
705 ++{
706 ++ struct hw_perf_event *hwc = &event->hw;
707 ++
708 ++ return intel_pmu_has_bts_period(event, hwc->sample_period);
709 + }
710 +
711 + int intel_pmu_save_and_restart(struct perf_event *event);
712 +diff --git a/arch/x86/ia32/ia32_aout.c b/arch/x86/ia32/ia32_aout.c
713 +index 8e02b30cf08e..3ebd77770f98 100644
714 +--- a/arch/x86/ia32/ia32_aout.c
715 ++++ b/arch/x86/ia32/ia32_aout.c
716 +@@ -51,7 +51,7 @@ static unsigned long get_dr(int n)
717 + /*
718 + * fill in the user structure for a core dump..
719 + */
720 +-static void dump_thread32(struct pt_regs *regs, struct user32 *dump)
721 ++static void fill_dump(struct pt_regs *regs, struct user32 *dump)
722 + {
723 + u32 fs, gs;
724 + memset(dump, 0, sizeof(*dump));
725 +@@ -157,10 +157,12 @@ static int aout_core_dump(struct coredump_params *cprm)
726 + fs = get_fs();
727 + set_fs(KERNEL_DS);
728 + has_dumped = 1;
729 ++
730 ++ fill_dump(cprm->regs, &dump);
731 ++
732 + strncpy(dump.u_comm, current->comm, sizeof(current->comm));
733 + dump.u_ar0 = offsetof(struct user32, regs);
734 + dump.signal = cprm->siginfo->si_signo;
735 +- dump_thread32(cprm->regs, &dump);
736 +
737 + /*
738 + * If the size of the dump file exceeds the rlimit, then see
739 +diff --git a/arch/x86/include/asm/uv/bios.h b/arch/x86/include/asm/uv/bios.h
740 +index e652a7cc6186..3f697a9e3f59 100644
741 +--- a/arch/x86/include/asm/uv/bios.h
742 ++++ b/arch/x86/include/asm/uv/bios.h
743 +@@ -48,7 +48,8 @@ enum {
744 + BIOS_STATUS_SUCCESS = 0,
745 + BIOS_STATUS_UNIMPLEMENTED = -ENOSYS,
746 + BIOS_STATUS_EINVAL = -EINVAL,
747 +- BIOS_STATUS_UNAVAIL = -EBUSY
748 ++ BIOS_STATUS_UNAVAIL = -EBUSY,
749 ++ BIOS_STATUS_ABORT = -EINTR,
750 + };
751 +
752 + /* Address map parameters */
753 +@@ -167,4 +168,9 @@ extern long system_serial_number;
754 +
755 + extern struct kobject *sgi_uv_kobj; /* /sys/firmware/sgi_uv */
756 +
757 ++/*
758 ++ * EFI runtime lock; cf. firmware/efi/runtime-wrappers.c for details
759 ++ */
760 ++extern struct semaphore __efi_uv_runtime_lock;
761 ++
762 + #endif /* _ASM_X86_UV_BIOS_H */
763 +diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
764 +index 11641d9e7f6f..13baba9d1cc1 100644
765 +--- a/arch/x86/kvm/svm.c
766 ++++ b/arch/x86/kvm/svm.c
767 +@@ -6255,6 +6255,9 @@ static int sev_guest_init(struct kvm *kvm, struct kvm_sev_cmd *argp)
768 + int asid, ret;
769 +
770 + ret = -EBUSY;
771 ++ if (unlikely(sev->active))
772 ++ return ret;
773 ++
774 + asid = sev_asid_new();
775 + if (asid < 0)
776 + return ret;
777 +diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
778 +index 4ce6595e454c..bbd0520867a8 100644
779 +--- a/arch/x86/kvm/vmx.c
780 ++++ b/arch/x86/kvm/vmx.c
781 +@@ -2779,7 +2779,8 @@ static void add_atomic_switch_msr(struct vcpu_vmx *vmx, unsigned msr,
782 + if (!entry_only)
783 + j = find_msr(&m->host, msr);
784 +
785 +- if (i == NR_AUTOLOAD_MSRS || j == NR_AUTOLOAD_MSRS) {
786 ++ if ((i < 0 && m->guest.nr == NR_AUTOLOAD_MSRS) ||
787 ++ (j < 0 && m->host.nr == NR_AUTOLOAD_MSRS)) {
788 + printk_once(KERN_WARNING "Not enough msr switch entries. "
789 + "Can't add msr %x\n", msr);
790 + return;
791 +@@ -3620,9 +3621,11 @@ static void nested_vmx_setup_ctls_msrs(struct nested_vmx_msrs *msrs, bool apicv)
792 + * secondary cpu-based controls. Do not include those that
793 + * depend on CPUID bits, they are added later by vmx_cpuid_update.
794 + */
795 +- rdmsr(MSR_IA32_VMX_PROCBASED_CTLS2,
796 +- msrs->secondary_ctls_low,
797 +- msrs->secondary_ctls_high);
798 ++ if (msrs->procbased_ctls_high & CPU_BASED_ACTIVATE_SECONDARY_CONTROLS)
799 ++ rdmsr(MSR_IA32_VMX_PROCBASED_CTLS2,
800 ++ msrs->secondary_ctls_low,
801 ++ msrs->secondary_ctls_high);
802 ++
803 + msrs->secondary_ctls_low = 0;
804 + msrs->secondary_ctls_high &=
805 + SECONDARY_EXEC_DESC |
806 +diff --git a/arch/x86/platform/uv/bios_uv.c b/arch/x86/platform/uv/bios_uv.c
807 +index 4a6a5a26c582..eb33432f2f24 100644
808 +--- a/arch/x86/platform/uv/bios_uv.c
809 ++++ b/arch/x86/platform/uv/bios_uv.c
810 +@@ -29,7 +29,8 @@
811 +
812 + struct uv_systab *uv_systab;
813 +
814 +-s64 uv_bios_call(enum uv_bios_cmd which, u64 a1, u64 a2, u64 a3, u64 a4, u64 a5)
815 ++static s64 __uv_bios_call(enum uv_bios_cmd which, u64 a1, u64 a2, u64 a3,
816 ++ u64 a4, u64 a5)
817 + {
818 + struct uv_systab *tab = uv_systab;
819 + s64 ret;
820 +@@ -51,6 +52,19 @@ s64 uv_bios_call(enum uv_bios_cmd which, u64 a1, u64 a2, u64 a3, u64 a4, u64 a5)
821 +
822 + return ret;
823 + }
824 ++
825 ++s64 uv_bios_call(enum uv_bios_cmd which, u64 a1, u64 a2, u64 a3, u64 a4, u64 a5)
826 ++{
827 ++ s64 ret;
828 ++
829 ++ if (down_interruptible(&__efi_uv_runtime_lock))
830 ++ return BIOS_STATUS_ABORT;
831 ++
832 ++ ret = __uv_bios_call(which, a1, a2, a3, a4, a5);
833 ++ up(&__efi_uv_runtime_lock);
834 ++
835 ++ return ret;
836 ++}
837 + EXPORT_SYMBOL_GPL(uv_bios_call);
838 +
839 + s64 uv_bios_call_irqsave(enum uv_bios_cmd which, u64 a1, u64 a2, u64 a3,
840 +@@ -59,10 +73,15 @@ s64 uv_bios_call_irqsave(enum uv_bios_cmd which, u64 a1, u64 a2, u64 a3,
841 + unsigned long bios_flags;
842 + s64 ret;
843 +
844 ++ if (down_interruptible(&__efi_uv_runtime_lock))
845 ++ return BIOS_STATUS_ABORT;
846 ++
847 + local_irq_save(bios_flags);
848 +- ret = uv_bios_call(which, a1, a2, a3, a4, a5);
849 ++ ret = __uv_bios_call(which, a1, a2, a3, a4, a5);
850 + local_irq_restore(bios_flags);
851 +
852 ++ up(&__efi_uv_runtime_lock);
853 ++
854 + return ret;
855 + }
856 +
857 +diff --git a/block/blk-flush.c b/block/blk-flush.c
858 +index 8b44b86779da..87fc49daa2b4 100644
859 +--- a/block/blk-flush.c
860 ++++ b/block/blk-flush.c
861 +@@ -424,7 +424,7 @@ static void mq_flush_data_end_io(struct request *rq, blk_status_t error)
862 + blk_flush_complete_seq(rq, fq, REQ_FSEQ_DATA, error);
863 + spin_unlock_irqrestore(&fq->mq_flush_lock, flags);
864 +
865 +- blk_mq_run_hw_queue(hctx, true);
866 ++ blk_mq_sched_restart(hctx);
867 + }
868 +
869 + /**
870 +diff --git a/drivers/acpi/numa.c b/drivers/acpi/numa.c
871 +index 274699463b4f..7bbbf8256a41 100644
872 +--- a/drivers/acpi/numa.c
873 ++++ b/drivers/acpi/numa.c
874 +@@ -146,9 +146,9 @@ acpi_table_print_srat_entry(struct acpi_subtable_header *header)
875 + {
876 + struct acpi_srat_mem_affinity *p =
877 + (struct acpi_srat_mem_affinity *)header;
878 +- pr_debug("SRAT Memory (0x%lx length 0x%lx) in proximity domain %d %s%s%s\n",
879 +- (unsigned long)p->base_address,
880 +- (unsigned long)p->length,
881 ++ pr_debug("SRAT Memory (0x%llx length 0x%llx) in proximity domain %d %s%s%s\n",
882 ++ (unsigned long long)p->base_address,
883 ++ (unsigned long long)p->length,
884 + p->proximity_domain,
885 + (p->flags & ACPI_SRAT_MEM_ENABLED) ?
886 + "enabled" : "disabled",
887 +diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
888 +index 7aa3dcad2175..df34a12a388f 100644
889 +--- a/drivers/cpufreq/cpufreq.c
890 ++++ b/drivers/cpufreq/cpufreq.c
891 +@@ -1530,17 +1530,16 @@ static unsigned int __cpufreq_get(struct cpufreq_policy *policy)
892 + {
893 + unsigned int ret_freq = 0;
894 +
895 +- if (!cpufreq_driver->get)
896 ++ if (unlikely(policy_is_inactive(policy)) || !cpufreq_driver->get)
897 + return ret_freq;
898 +
899 + ret_freq = cpufreq_driver->get(policy->cpu);
900 +
901 + /*
902 +- * Updating inactive policies is invalid, so avoid doing that. Also
903 +- * if fast frequency switching is used with the given policy, the check
904 ++ * If fast frequency switching is used with the given policy, the check
905 + * against policy->cur is pointless, so skip it in that case too.
906 + */
907 +- if (unlikely(policy_is_inactive(policy)) || policy->fast_switch_enabled)
908 ++ if (policy->fast_switch_enabled)
909 + return ret_freq;
910 +
911 + if (ret_freq && policy->cur &&
912 +@@ -1569,10 +1568,7 @@ unsigned int cpufreq_get(unsigned int cpu)
913 +
914 + if (policy) {
915 + down_read(&policy->rwsem);
916 +-
917 +- if (!policy_is_inactive(policy))
918 +- ret_freq = __cpufreq_get(policy);
919 +-
920 ++ ret_freq = __cpufreq_get(policy);
921 + up_read(&policy->rwsem);
922 +
923 + cpufreq_cpu_put(policy);
924 +diff --git a/drivers/crypto/ccree/cc_driver.c b/drivers/crypto/ccree/cc_driver.c
925 +index 1ff229c2aeab..186a2536fb8b 100644
926 +--- a/drivers/crypto/ccree/cc_driver.c
927 ++++ b/drivers/crypto/ccree/cc_driver.c
928 +@@ -364,7 +364,7 @@ static int init_cc_resources(struct platform_device *plat_dev)
929 + rc = cc_ivgen_init(new_drvdata);
930 + if (rc) {
931 + dev_err(dev, "cc_ivgen_init failed\n");
932 +- goto post_power_mgr_err;
933 ++ goto post_buf_mgr_err;
934 + }
935 +
936 + /* Allocate crypto algs */
937 +@@ -387,6 +387,9 @@ static int init_cc_resources(struct platform_device *plat_dev)
938 + goto post_hash_err;
939 + }
940 +
941 ++ /* All set, we can allow autosuspend */
942 ++ cc_pm_go(new_drvdata);
943 ++
944 + /* If we got here and FIPS mode is enabled
945 + * it means all FIPS test passed, so let TEE
946 + * know we're good.
947 +@@ -401,8 +404,6 @@ post_cipher_err:
948 + cc_cipher_free(new_drvdata);
949 + post_ivgen_err:
950 + cc_ivgen_fini(new_drvdata);
951 +-post_power_mgr_err:
952 +- cc_pm_fini(new_drvdata);
953 + post_buf_mgr_err:
954 + cc_buffer_mgr_fini(new_drvdata);
955 + post_req_mgr_err:
956 +diff --git a/drivers/crypto/ccree/cc_pm.c b/drivers/crypto/ccree/cc_pm.c
957 +index d990f472e89f..6ff7e75ad90e 100644
958 +--- a/drivers/crypto/ccree/cc_pm.c
959 ++++ b/drivers/crypto/ccree/cc_pm.c
960 +@@ -100,20 +100,19 @@ int cc_pm_put_suspend(struct device *dev)
961 +
962 + int cc_pm_init(struct cc_drvdata *drvdata)
963 + {
964 +- int rc = 0;
965 + struct device *dev = drvdata_to_dev(drvdata);
966 +
967 + /* must be before the enabling to avoid resdundent suspending */
968 + pm_runtime_set_autosuspend_delay(dev, CC_SUSPEND_TIMEOUT);
969 + pm_runtime_use_autosuspend(dev);
970 + /* activate the PM module */
971 +- rc = pm_runtime_set_active(dev);
972 +- if (rc)
973 +- return rc;
974 +- /* enable the PM module*/
975 +- pm_runtime_enable(dev);
976 ++ return pm_runtime_set_active(dev);
977 ++}
978 +
979 +- return rc;
980 ++/* enable the PM module*/
981 ++void cc_pm_go(struct cc_drvdata *drvdata)
982 ++{
983 ++ pm_runtime_enable(drvdata_to_dev(drvdata));
984 + }
985 +
986 + void cc_pm_fini(struct cc_drvdata *drvdata)
987 +diff --git a/drivers/crypto/ccree/cc_pm.h b/drivers/crypto/ccree/cc_pm.h
988 +index 020a5403c58b..f62624357020 100644
989 +--- a/drivers/crypto/ccree/cc_pm.h
990 ++++ b/drivers/crypto/ccree/cc_pm.h
991 +@@ -16,6 +16,7 @@
992 + extern const struct dev_pm_ops ccree_pm;
993 +
994 + int cc_pm_init(struct cc_drvdata *drvdata);
995 ++void cc_pm_go(struct cc_drvdata *drvdata);
996 + void cc_pm_fini(struct cc_drvdata *drvdata);
997 + int cc_pm_suspend(struct device *dev);
998 + int cc_pm_resume(struct device *dev);
999 +@@ -29,6 +30,8 @@ static inline int cc_pm_init(struct cc_drvdata *drvdata)
1000 + return 0;
1001 + }
1002 +
1003 ++static void cc_pm_go(struct cc_drvdata *drvdata) {}
1004 ++
1005 + static inline void cc_pm_fini(struct cc_drvdata *drvdata) {}
1006 +
1007 + static inline int cc_pm_suspend(struct device *dev)
1008 +diff --git a/drivers/firmware/efi/runtime-wrappers.c b/drivers/firmware/efi/runtime-wrappers.c
1009 +index 8903b9ccfc2b..e2abfdb5cee6 100644
1010 +--- a/drivers/firmware/efi/runtime-wrappers.c
1011 ++++ b/drivers/firmware/efi/runtime-wrappers.c
1012 +@@ -146,6 +146,13 @@ void efi_call_virt_check_flags(unsigned long flags, const char *call)
1013 + */
1014 + static DEFINE_SEMAPHORE(efi_runtime_lock);
1015 +
1016 ++/*
1017 ++ * Expose the EFI runtime lock to the UV platform
1018 ++ */
1019 ++#ifdef CONFIG_X86_UV
1020 ++extern struct semaphore __efi_uv_runtime_lock __alias(efi_runtime_lock);
1021 ++#endif
1022 ++
1023 + /*
1024 + * Calls the appropriate efi_runtime_service() with the appropriate
1025 + * arguments.
1026 +diff --git a/drivers/gpio/gpio-mxc.c b/drivers/gpio/gpio-mxc.c
1027 +index 995cf0b9e0b1..2d1dfa1e0745 100644
1028 +--- a/drivers/gpio/gpio-mxc.c
1029 ++++ b/drivers/gpio/gpio-mxc.c
1030 +@@ -17,6 +17,7 @@
1031 + #include <linux/irqchip/chained_irq.h>
1032 + #include <linux/platform_device.h>
1033 + #include <linux/slab.h>
1034 ++#include <linux/syscore_ops.h>
1035 + #include <linux/gpio/driver.h>
1036 + #include <linux/of.h>
1037 + #include <linux/of_device.h>
1038 +@@ -550,33 +551,38 @@ static void mxc_gpio_restore_regs(struct mxc_gpio_port *port)
1039 + writel(port->gpio_saved_reg.dr, port->base + GPIO_DR);
1040 + }
1041 +
1042 +-static int __maybe_unused mxc_gpio_noirq_suspend(struct device *dev)
1043 ++static int mxc_gpio_syscore_suspend(void)
1044 + {
1045 +- struct platform_device *pdev = to_platform_device(dev);
1046 +- struct mxc_gpio_port *port = platform_get_drvdata(pdev);
1047 ++ struct mxc_gpio_port *port;
1048 +
1049 +- mxc_gpio_save_regs(port);
1050 +- clk_disable_unprepare(port->clk);
1051 ++ /* walk through all ports */
1052 ++ list_for_each_entry(port, &mxc_gpio_ports, node) {
1053 ++ mxc_gpio_save_regs(port);
1054 ++ clk_disable_unprepare(port->clk);
1055 ++ }
1056 +
1057 + return 0;
1058 + }
1059 +
1060 +-static int __maybe_unused mxc_gpio_noirq_resume(struct device *dev)
1061 ++static void mxc_gpio_syscore_resume(void)
1062 + {
1063 +- struct platform_device *pdev = to_platform_device(dev);
1064 +- struct mxc_gpio_port *port = platform_get_drvdata(pdev);
1065 ++ struct mxc_gpio_port *port;
1066 + int ret;
1067 +
1068 +- ret = clk_prepare_enable(port->clk);
1069 +- if (ret)
1070 +- return ret;
1071 +- mxc_gpio_restore_regs(port);
1072 +-
1073 +- return 0;
1074 ++ /* walk through all ports */
1075 ++ list_for_each_entry(port, &mxc_gpio_ports, node) {
1076 ++ ret = clk_prepare_enable(port->clk);
1077 ++ if (ret) {
1078 ++ pr_err("mxc: failed to enable gpio clock %d\n", ret);
1079 ++ return;
1080 ++ }
1081 ++ mxc_gpio_restore_regs(port);
1082 ++ }
1083 + }
1084 +
1085 +-static const struct dev_pm_ops mxc_gpio_dev_pm_ops = {
1086 +- SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(mxc_gpio_noirq_suspend, mxc_gpio_noirq_resume)
1087 ++static struct syscore_ops mxc_gpio_syscore_ops = {
1088 ++ .suspend = mxc_gpio_syscore_suspend,
1089 ++ .resume = mxc_gpio_syscore_resume,
1090 + };
1091 +
1092 + static struct platform_driver mxc_gpio_driver = {
1093 +@@ -584,7 +590,6 @@ static struct platform_driver mxc_gpio_driver = {
1094 + .name = "gpio-mxc",
1095 + .of_match_table = mxc_gpio_dt_ids,
1096 + .suppress_bind_attrs = true,
1097 +- .pm = &mxc_gpio_dev_pm_ops,
1098 + },
1099 + .probe = mxc_gpio_probe,
1100 + .id_table = mxc_gpio_devtype,
1101 +@@ -592,6 +597,8 @@ static struct platform_driver mxc_gpio_driver = {
1102 +
1103 + static int __init gpio_mxc_init(void)
1104 + {
1105 ++ register_syscore_ops(&mxc_gpio_syscore_ops);
1106 ++
1107 + return platform_driver_register(&mxc_gpio_driver);
1108 + }
1109 + subsys_initcall(gpio_mxc_init);
1110 +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
1111 +index 30bc345d6fdf..8547fdaf8273 100644
1112 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
1113 ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
1114 +@@ -1684,8 +1684,10 @@ static int amdgpu_device_ip_init(struct amdgpu_device *adev)
1115 + amdgpu_xgmi_add_device(adev);
1116 + amdgpu_amdkfd_device_init(adev);
1117 +
1118 +- if (amdgpu_sriov_vf(adev))
1119 ++ if (amdgpu_sriov_vf(adev)) {
1120 ++ amdgpu_virt_init_data_exchange(adev);
1121 + amdgpu_virt_release_full_gpu(adev, true);
1122 ++ }
1123 +
1124 + return 0;
1125 + }
1126 +@@ -2597,9 +2599,6 @@ fence_driver_init:
1127 + goto failed;
1128 + }
1129 +
1130 +- if (amdgpu_sriov_vf(adev))
1131 +- amdgpu_virt_init_data_exchange(adev);
1132 +-
1133 + amdgpu_fbdev_init(adev);
1134 +
1135 + r = amdgpu_pm_sysfs_init(adev);
1136 +@@ -3271,6 +3270,7 @@ static int amdgpu_device_reset_sriov(struct amdgpu_device *adev,
1137 + r = amdgpu_ib_ring_tests(adev);
1138 +
1139 + error:
1140 ++ amdgpu_virt_init_data_exchange(adev);
1141 + amdgpu_virt_release_full_gpu(adev, true);
1142 + if (!r && adev->virt.gim_feature & AMDGIM_FEATURE_GIM_FLR_VRAMLOST) {
1143 + atomic_inc(&adev->vram_lost_counter);
1144 +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
1145 +index 0877ff9a9594..8c9abaa7601a 100644
1146 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
1147 ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
1148 +@@ -850,9 +850,6 @@ static void amdgpu_vm_bo_param(struct amdgpu_device *adev, struct amdgpu_vm *vm,
1149 + bp->size = amdgpu_vm_bo_size(adev, level);
1150 + bp->byte_align = AMDGPU_GPU_PAGE_SIZE;
1151 + bp->domain = AMDGPU_GEM_DOMAIN_VRAM;
1152 +- if (bp->size <= PAGE_SIZE && adev->asic_type >= CHIP_VEGA10 &&
1153 +- adev->flags & AMD_IS_APU)
1154 +- bp->domain |= AMDGPU_GEM_DOMAIN_GTT;
1155 + bp->domain = amdgpu_bo_get_preferred_pin_domain(adev, bp->domain);
1156 + bp->flags = AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS |
1157 + AMDGPU_GEM_CREATE_CPU_GTT_USWC;
1158 +diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
1159 +index 21363b2b2ee5..88ed064b3585 100644
1160 +--- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
1161 ++++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
1162 +@@ -112,7 +112,10 @@ static const struct soc15_reg_golden golden_settings_gc_9_0[] =
1163 + SOC15_REG_GOLDEN_VALUE(GC, 0, mmTCP_CHAN_STEER_HI, 0xffffffff, 0x4a2c0e68),
1164 + SOC15_REG_GOLDEN_VALUE(GC, 0, mmTCP_CHAN_STEER_LO, 0xffffffff, 0xb5d3f197),
1165 + SOC15_REG_GOLDEN_VALUE(GC, 0, mmVGT_CACHE_INVALIDATION, 0x3fff3af3, 0x19200000),
1166 +- SOC15_REG_GOLDEN_VALUE(GC, 0, mmVGT_GS_MAX_WAVE_ID, 0x00000fff, 0x000003ff)
1167 ++ SOC15_REG_GOLDEN_VALUE(GC, 0, mmVGT_GS_MAX_WAVE_ID, 0x00000fff, 0x000003ff),
1168 ++ SOC15_REG_GOLDEN_VALUE(GC, 0, mmCP_MEC1_F32_INT_DIS, 0x00000000, 0x00000800),
1169 ++ SOC15_REG_GOLDEN_VALUE(GC, 0, mmCP_MEC2_F32_INT_DIS, 0x00000000, 0x00000800),
1170 ++ SOC15_REG_GOLDEN_VALUE(GC, 0, mmCP_DEBUG, 0x00000000, 0x00008000)
1171 + };
1172 +
1173 + static const struct soc15_reg_golden golden_settings_gc_9_0_vg10[] =
1174 +@@ -134,10 +137,7 @@ static const struct soc15_reg_golden golden_settings_gc_9_0_vg10[] =
1175 + SOC15_REG_GOLDEN_VALUE(GC, 0, mmRMI_UTCL1_CNTL2, 0x00030000, 0x00020000),
1176 + SOC15_REG_GOLDEN_VALUE(GC, 0, mmSPI_CONFIG_CNTL_1, 0x0000000f, 0x01000107),
1177 + SOC15_REG_GOLDEN_VALUE(GC, 0, mmTD_CNTL, 0x00001800, 0x00000800),
1178 +- SOC15_REG_GOLDEN_VALUE(GC, 0, mmWD_UTCL1_CNTL, 0x08000000, 0x08000080),
1179 +- SOC15_REG_GOLDEN_VALUE(GC, 0, mmCP_MEC1_F32_INT_DIS, 0x00000000, 0x00000800),
1180 +- SOC15_REG_GOLDEN_VALUE(GC, 0, mmCP_MEC2_F32_INT_DIS, 0x00000000, 0x00000800),
1181 +- SOC15_REG_GOLDEN_VALUE(GC, 0, mmCP_DEBUG, 0x00000000, 0x00008000)
1182 ++ SOC15_REG_GOLDEN_VALUE(GC, 0, mmWD_UTCL1_CNTL, 0x08000000, 0x08000080)
1183 + };
1184 +
1185 + static const struct soc15_reg_golden golden_settings_gc_9_0_vg20[] =
1186 +diff --git a/drivers/gpu/drm/amd/amdgpu/mxgpu_ai.c b/drivers/gpu/drm/amd/amdgpu/mxgpu_ai.c
1187 +index 8cbb4655896a..b11a1c17a7f2 100644
1188 +--- a/drivers/gpu/drm/amd/amdgpu/mxgpu_ai.c
1189 ++++ b/drivers/gpu/drm/amd/amdgpu/mxgpu_ai.c
1190 +@@ -174,7 +174,7 @@ static int xgpu_ai_send_access_requests(struct amdgpu_device *adev,
1191 + return r;
1192 + }
1193 + /* Retrieve checksum from mailbox2 */
1194 +- if (req == IDH_REQ_GPU_INIT_ACCESS) {
1195 ++ if (req == IDH_REQ_GPU_INIT_ACCESS || req == IDH_REQ_GPU_RESET_ACCESS) {
1196 + adev->virt.fw_reserve.checksum_key =
1197 + RREG32_NO_KIQ(SOC15_REG_OFFSET(NBIO, 0,
1198 + mmBIF_BX_PF0_MAILBOX_MSGBUF_RCV_DW2));
1199 +diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c b/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
1200 +index 7a8c9172d30a..86d5dc5f8887 100644
1201 +--- a/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
1202 ++++ b/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
1203 +@@ -73,7 +73,6 @@ static const struct soc15_reg_golden golden_settings_sdma_4[] = {
1204 + SOC15_REG_GOLDEN_VALUE(SDMA0, 0, mmSDMA0_RLC1_RB_WPTR_POLL_CNTL, 0x0000fff0, 0x00403000),
1205 + SOC15_REG_GOLDEN_VALUE(SDMA0, 0, mmSDMA0_UTCL1_PAGE, 0x000003ff, 0x000003c0),
1206 + SOC15_REG_GOLDEN_VALUE(SDMA0, 0, mmSDMA0_UTCL1_WATERMK, 0xfc000000, 0x00000000),
1207 +- SOC15_REG_GOLDEN_VALUE(SDMA1, 0, mmSDMA1_CHICKEN_BITS, 0xfe931f07, 0x02831f07),
1208 + SOC15_REG_GOLDEN_VALUE(SDMA1, 0, mmSDMA1_CLK_CTRL, 0xffffffff, 0x3f000100),
1209 + SOC15_REG_GOLDEN_VALUE(SDMA1, 0, mmSDMA1_GFX_IB_CNTL, 0x800f0100, 0x00000100),
1210 + SOC15_REG_GOLDEN_VALUE(SDMA1, 0, mmSDMA1_GFX_RB_WPTR_POLL_CNTL, 0x0000fff0, 0x00403000),
1211 +@@ -91,6 +90,7 @@ static const struct soc15_reg_golden golden_settings_sdma_4[] = {
1212 + static const struct soc15_reg_golden golden_settings_sdma_vg10[] = {
1213 + SOC15_REG_GOLDEN_VALUE(SDMA0, 0, mmSDMA0_GB_ADDR_CONFIG, 0x0018773f, 0x00104002),
1214 + SOC15_REG_GOLDEN_VALUE(SDMA0, 0, mmSDMA0_GB_ADDR_CONFIG_READ, 0x0018773f, 0x00104002),
1215 ++ SOC15_REG_GOLDEN_VALUE(SDMA1, 0, mmSDMA1_CHICKEN_BITS, 0xfe931f07, 0x02831d07),
1216 + SOC15_REG_GOLDEN_VALUE(SDMA1, 0, mmSDMA1_GB_ADDR_CONFIG, 0x0018773f, 0x00104002),
1217 + SOC15_REG_GOLDEN_VALUE(SDMA1, 0, mmSDMA1_GB_ADDR_CONFIG_READ, 0x0018773f, 0x00104002)
1218 + };
1219 +@@ -98,6 +98,7 @@ static const struct soc15_reg_golden golden_settings_sdma_vg10[] = {
1220 + static const struct soc15_reg_golden golden_settings_sdma_vg12[] = {
1221 + SOC15_REG_GOLDEN_VALUE(SDMA0, 0, mmSDMA0_GB_ADDR_CONFIG, 0x0018773f, 0x00104001),
1222 + SOC15_REG_GOLDEN_VALUE(SDMA0, 0, mmSDMA0_GB_ADDR_CONFIG_READ, 0x0018773f, 0x00104001),
1223 ++ SOC15_REG_GOLDEN_VALUE(SDMA1, 0, mmSDMA1_CHICKEN_BITS, 0xfe931f07, 0x02831d07),
1224 + SOC15_REG_GOLDEN_VALUE(SDMA1, 0, mmSDMA1_GB_ADDR_CONFIG, 0x0018773f, 0x00104001),
1225 + SOC15_REG_GOLDEN_VALUE(SDMA1, 0, mmSDMA1_GB_ADDR_CONFIG_READ, 0x0018773f, 0x00104001)
1226 + };
1227 +diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c
1228 +index 3b7fce5d7258..b9e19b0eb905 100644
1229 +--- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c
1230 ++++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c
1231 +@@ -2244,6 +2244,13 @@ static int vega20_force_clock_level(struct pp_hwmgr *hwmgr,
1232 + soft_min_level = mask ? (ffs(mask) - 1) : 0;
1233 + soft_max_level = mask ? (fls(mask) - 1) : 0;
1234 +
1235 ++ if (soft_max_level >= data->dpm_table.gfx_table.count) {
1236 ++ pr_err("Clock level specified %d is over max allowed %d\n",
1237 ++ soft_max_level,
1238 ++ data->dpm_table.gfx_table.count - 1);
1239 ++ return -EINVAL;
1240 ++ }
1241 ++
1242 + data->dpm_table.gfx_table.dpm_state.soft_min_level =
1243 + data->dpm_table.gfx_table.dpm_levels[soft_min_level].value;
1244 + data->dpm_table.gfx_table.dpm_state.soft_max_level =
1245 +@@ -2264,6 +2271,13 @@ static int vega20_force_clock_level(struct pp_hwmgr *hwmgr,
1246 + soft_min_level = mask ? (ffs(mask) - 1) : 0;
1247 + soft_max_level = mask ? (fls(mask) - 1) : 0;
1248 +
1249 ++ if (soft_max_level >= data->dpm_table.mem_table.count) {
1250 ++ pr_err("Clock level specified %d is over max allowed %d\n",
1251 ++ soft_max_level,
1252 ++ data->dpm_table.mem_table.count - 1);
1253 ++ return -EINVAL;
1254 ++ }
1255 ++
1256 + data->dpm_table.mem_table.dpm_state.soft_min_level =
1257 + data->dpm_table.mem_table.dpm_levels[soft_min_level].value;
1258 + data->dpm_table.mem_table.dpm_state.soft_max_level =
1259 +diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc358767.c
1260 +index 8e28e738cb52..391547358756 100644
1261 +--- a/drivers/gpu/drm/bridge/tc358767.c
1262 ++++ b/drivers/gpu/drm/bridge/tc358767.c
1263 +@@ -98,6 +98,8 @@
1264 + #define DP0_STARTVAL 0x064c
1265 + #define DP0_ACTIVEVAL 0x0650
1266 + #define DP0_SYNCVAL 0x0654
1267 ++#define SYNCVAL_HS_POL_ACTIVE_LOW (1 << 15)
1268 ++#define SYNCVAL_VS_POL_ACTIVE_LOW (1 << 31)
1269 + #define DP0_MISC 0x0658
1270 + #define TU_SIZE_RECOMMENDED (63) /* LSCLK cycles per TU */
1271 + #define BPC_6 (0 << 5)
1272 +@@ -142,6 +144,8 @@
1273 + #define DP0_LTLOOPCTRL 0x06d8
1274 + #define DP0_SNKLTCTRL 0x06e4
1275 +
1276 ++#define DP1_SRCCTRL 0x07a0
1277 ++
1278 + /* PHY */
1279 + #define DP_PHY_CTRL 0x0800
1280 + #define DP_PHY_RST BIT(28) /* DP PHY Global Soft Reset */
1281 +@@ -150,6 +154,7 @@
1282 + #define PHY_M1_RST BIT(12) /* Reset PHY1 Main Channel */
1283 + #define PHY_RDY BIT(16) /* PHY Main Channels Ready */
1284 + #define PHY_M0_RST BIT(8) /* Reset PHY0 Main Channel */
1285 ++#define PHY_2LANE BIT(2) /* PHY Enable 2 lanes */
1286 + #define PHY_A0_EN BIT(1) /* PHY Aux Channel0 Enable */
1287 + #define PHY_M0_EN BIT(0) /* PHY Main Channel0 Enable */
1288 +
1289 +@@ -540,6 +545,7 @@ static int tc_aux_link_setup(struct tc_data *tc)
1290 + unsigned long rate;
1291 + u32 value;
1292 + int ret;
1293 ++ u32 dp_phy_ctrl;
1294 +
1295 + rate = clk_get_rate(tc->refclk);
1296 + switch (rate) {
1297 +@@ -564,7 +570,10 @@ static int tc_aux_link_setup(struct tc_data *tc)
1298 + value |= SYSCLK_SEL_LSCLK | LSCLK_DIV_2;
1299 + tc_write(SYS_PLLPARAM, value);
1300 +
1301 +- tc_write(DP_PHY_CTRL, BGREN | PWR_SW_EN | BIT(2) | PHY_A0_EN);
1302 ++ dp_phy_ctrl = BGREN | PWR_SW_EN | PHY_A0_EN;
1303 ++ if (tc->link.base.num_lanes == 2)
1304 ++ dp_phy_ctrl |= PHY_2LANE;
1305 ++ tc_write(DP_PHY_CTRL, dp_phy_ctrl);
1306 +
1307 + /*
1308 + * Initially PLLs are in bypass. Force PLL parameter update,
1309 +@@ -719,7 +728,9 @@ static int tc_set_video_mode(struct tc_data *tc, struct drm_display_mode *mode)
1310 +
1311 + tc_write(DP0_ACTIVEVAL, (mode->vdisplay << 16) | (mode->hdisplay));
1312 +
1313 +- tc_write(DP0_SYNCVAL, (vsync_len << 16) | (hsync_len << 0));
1314 ++ tc_write(DP0_SYNCVAL, (vsync_len << 16) | (hsync_len << 0) |
1315 ++ ((mode->flags & DRM_MODE_FLAG_NHSYNC) ? SYNCVAL_HS_POL_ACTIVE_LOW : 0) |
1316 ++ ((mode->flags & DRM_MODE_FLAG_NVSYNC) ? SYNCVAL_VS_POL_ACTIVE_LOW : 0));
1317 +
1318 + tc_write(DPIPXLFMT, VS_POL_ACTIVE_LOW | HS_POL_ACTIVE_LOW |
1319 + DE_POL_ACTIVE_HIGH | SUB_CFG_TYPE_CONFIG1 | DPI_BPP_RGB888);
1320 +@@ -829,12 +840,11 @@ static int tc_main_link_setup(struct tc_data *tc)
1321 + if (!tc->mode)
1322 + return -EINVAL;
1323 +
1324 +- /* from excel file - DP0_SrcCtrl */
1325 +- tc_write(DP0_SRCCTRL, DP0_SRCCTRL_SCRMBLDIS | DP0_SRCCTRL_EN810B |
1326 +- DP0_SRCCTRL_LANESKEW | DP0_SRCCTRL_LANES_2 |
1327 +- DP0_SRCCTRL_BW27 | DP0_SRCCTRL_AUTOCORRECT);
1328 +- /* from excel file - DP1_SrcCtrl */
1329 +- tc_write(0x07a0, 0x00003083);
1330 ++ tc_write(DP0_SRCCTRL, tc_srcctrl(tc));
1331 ++ /* SSCG and BW27 on DP1 must be set to the same as on DP0 */
1332 ++ tc_write(DP1_SRCCTRL,
1333 ++ (tc->link.spread ? DP0_SRCCTRL_SSCG : 0) |
1334 ++ ((tc->link.base.rate != 162000) ? DP0_SRCCTRL_BW27 : 0));
1335 +
1336 + rate = clk_get_rate(tc->refclk);
1337 + switch (rate) {
1338 +@@ -855,8 +865,11 @@ static int tc_main_link_setup(struct tc_data *tc)
1339 + }
1340 + value |= SYSCLK_SEL_LSCLK | LSCLK_DIV_2;
1341 + tc_write(SYS_PLLPARAM, value);
1342 ++
1343 + /* Setup Main Link */
1344 +- dp_phy_ctrl = BGREN | PWR_SW_EN | BIT(2) | PHY_A0_EN | PHY_M0_EN;
1345 ++ dp_phy_ctrl = BGREN | PWR_SW_EN | PHY_A0_EN | PHY_M0_EN;
1346 ++ if (tc->link.base.num_lanes == 2)
1347 ++ dp_phy_ctrl |= PHY_2LANE;
1348 + tc_write(DP_PHY_CTRL, dp_phy_ctrl);
1349 + msleep(100);
1350 +
1351 +@@ -1105,10 +1118,20 @@ static bool tc_bridge_mode_fixup(struct drm_bridge *bridge,
1352 + static enum drm_mode_status tc_connector_mode_valid(struct drm_connector *connector,
1353 + struct drm_display_mode *mode)
1354 + {
1355 ++ struct tc_data *tc = connector_to_tc(connector);
1356 ++ u32 req, avail;
1357 ++ u32 bits_per_pixel = 24;
1358 ++
1359 + /* DPI interface clock limitation: upto 154 MHz */
1360 + if (mode->clock > 154000)
1361 + return MODE_CLOCK_HIGH;
1362 +
1363 ++ req = mode->clock * bits_per_pixel / 8;
1364 ++ avail = tc->link.base.num_lanes * tc->link.base.rate;
1365 ++
1366 ++ if (req > avail)
1367 ++ return MODE_BAD;
1368 ++
1369 + return MODE_OK;
1370 + }
1371 +
1372 +@@ -1195,6 +1218,10 @@ static int tc_bridge_attach(struct drm_bridge *bridge)
1373 +
1374 + drm_display_info_set_bus_formats(&tc->connector.display_info,
1375 + &bus_format, 1);
1376 ++ tc->connector.display_info.bus_flags =
1377 ++ DRM_BUS_FLAG_DE_HIGH |
1378 ++ DRM_BUS_FLAG_PIXDATA_NEGEDGE |
1379 ++ DRM_BUS_FLAG_SYNC_NEGEDGE;
1380 + drm_connector_attach_encoder(&tc->connector, tc->bridge.encoder);
1381 +
1382 + return 0;
1383 +diff --git a/drivers/gpu/drm/drm_lease.c b/drivers/gpu/drm/drm_lease.c
1384 +index c61680ad962d..6e59789e3316 100644
1385 +--- a/drivers/gpu/drm/drm_lease.c
1386 ++++ b/drivers/gpu/drm/drm_lease.c
1387 +@@ -521,7 +521,8 @@ int drm_mode_create_lease_ioctl(struct drm_device *dev,
1388 +
1389 + object_count = cl->object_count;
1390 +
1391 +- object_ids = memdup_user(u64_to_user_ptr(cl->object_ids), object_count * sizeof(__u32));
1392 ++ object_ids = memdup_user(u64_to_user_ptr(cl->object_ids),
1393 ++ array_size(object_count, sizeof(__u32)));
1394 + if (IS_ERR(object_ids))
1395 + return PTR_ERR(object_ids);
1396 +
1397 +diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
1398 +index 6ae9a6080cc8..296f9c0fe19b 100644
1399 +--- a/drivers/gpu/drm/i915/i915_gem.c
1400 ++++ b/drivers/gpu/drm/i915/i915_gem.c
1401 +@@ -1826,6 +1826,16 @@ i915_gem_sw_finish_ioctl(struct drm_device *dev, void *data,
1402 + return 0;
1403 + }
1404 +
1405 ++static inline bool
1406 ++__vma_matches(struct vm_area_struct *vma, struct file *filp,
1407 ++ unsigned long addr, unsigned long size)
1408 ++{
1409 ++ if (vma->vm_file != filp)
1410 ++ return false;
1411 ++
1412 ++ return vma->vm_start == addr && (vma->vm_end - vma->vm_start) == size;
1413 ++}
1414 ++
1415 + /**
1416 + * i915_gem_mmap_ioctl - Maps the contents of an object, returning the address
1417 + * it is mapped to.
1418 +@@ -1884,7 +1894,7 @@ i915_gem_mmap_ioctl(struct drm_device *dev, void *data,
1419 + return -EINTR;
1420 + }
1421 + vma = find_vma(mm, addr);
1422 +- if (vma)
1423 ++ if (vma && __vma_matches(vma, obj->base.filp, addr, args->size))
1424 + vma->vm_page_prot =
1425 + pgprot_writecombine(vm_get_page_prot(vma->vm_flags));
1426 + else
1427 +diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
1428 +index db6fa1d0cbda..f35139b3ebc5 100644
1429 +--- a/drivers/gpu/drm/i915/intel_drv.h
1430 ++++ b/drivers/gpu/drm/i915/intel_drv.h
1431 +@@ -209,6 +209,16 @@ struct intel_fbdev {
1432 + unsigned long vma_flags;
1433 + async_cookie_t cookie;
1434 + int preferred_bpp;
1435 ++
1436 ++ /* Whether or not fbdev hpd processing is temporarily suspended */
1437 ++ bool hpd_suspended : 1;
1438 ++ /* Set when a hotplug was received while HPD processing was
1439 ++ * suspended
1440 ++ */
1441 ++ bool hpd_waiting : 1;
1442 ++
1443 ++ /* Protects hpd_suspended */
1444 ++ struct mutex hpd_lock;
1445 + };
1446 +
1447 + struct intel_encoder {
1448 +diff --git a/drivers/gpu/drm/i915/intel_fbdev.c b/drivers/gpu/drm/i915/intel_fbdev.c
1449 +index f99332972b7a..9e2e998b198f 100644
1450 +--- a/drivers/gpu/drm/i915/intel_fbdev.c
1451 ++++ b/drivers/gpu/drm/i915/intel_fbdev.c
1452 +@@ -679,6 +679,7 @@ int intel_fbdev_init(struct drm_device *dev)
1453 + if (ifbdev == NULL)
1454 + return -ENOMEM;
1455 +
1456 ++ mutex_init(&ifbdev->hpd_lock);
1457 + drm_fb_helper_prepare(dev, &ifbdev->helper, &intel_fb_helper_funcs);
1458 +
1459 + if (!intel_fbdev_init_bios(dev, ifbdev))
1460 +@@ -752,6 +753,26 @@ void intel_fbdev_fini(struct drm_i915_private *dev_priv)
1461 + intel_fbdev_destroy(ifbdev);
1462 + }
1463 +
1464 ++/* Suspends/resumes fbdev processing of incoming HPD events. When resuming HPD
1465 ++ * processing, fbdev will perform a full connector reprobe if a hotplug event
1466 ++ * was received while HPD was suspended.
1467 ++ */
1468 ++static void intel_fbdev_hpd_set_suspend(struct intel_fbdev *ifbdev, int state)
1469 ++{
1470 ++ bool send_hpd = false;
1471 ++
1472 ++ mutex_lock(&ifbdev->hpd_lock);
1473 ++ ifbdev->hpd_suspended = state == FBINFO_STATE_SUSPENDED;
1474 ++ send_hpd = !ifbdev->hpd_suspended && ifbdev->hpd_waiting;
1475 ++ ifbdev->hpd_waiting = false;
1476 ++ mutex_unlock(&ifbdev->hpd_lock);
1477 ++
1478 ++ if (send_hpd) {
1479 ++ DRM_DEBUG_KMS("Handling delayed fbcon HPD event\n");
1480 ++ drm_fb_helper_hotplug_event(&ifbdev->helper);
1481 ++ }
1482 ++}
1483 ++
1484 + void intel_fbdev_set_suspend(struct drm_device *dev, int state, bool synchronous)
1485 + {
1486 + struct drm_i915_private *dev_priv = to_i915(dev);
1487 +@@ -773,6 +794,7 @@ void intel_fbdev_set_suspend(struct drm_device *dev, int state, bool synchronous
1488 + */
1489 + if (state != FBINFO_STATE_RUNNING)
1490 + flush_work(&dev_priv->fbdev_suspend_work);
1491 ++
1492 + console_lock();
1493 + } else {
1494 + /*
1495 +@@ -800,17 +822,26 @@ void intel_fbdev_set_suspend(struct drm_device *dev, int state, bool synchronous
1496 +
1497 + drm_fb_helper_set_suspend(&ifbdev->helper, state);
1498 + console_unlock();
1499 ++
1500 ++ intel_fbdev_hpd_set_suspend(ifbdev, state);
1501 + }
1502 +
1503 + void intel_fbdev_output_poll_changed(struct drm_device *dev)
1504 + {
1505 + struct intel_fbdev *ifbdev = to_i915(dev)->fbdev;
1506 ++ bool send_hpd;
1507 +
1508 + if (!ifbdev)
1509 + return;
1510 +
1511 + intel_fbdev_sync(ifbdev);
1512 +- if (ifbdev->vma || ifbdev->helper.deferred_setup)
1513 ++
1514 ++ mutex_lock(&ifbdev->hpd_lock);
1515 ++ send_hpd = !ifbdev->hpd_suspended;
1516 ++ ifbdev->hpd_waiting = true;
1517 ++ mutex_unlock(&ifbdev->hpd_lock);
1518 ++
1519 ++ if (send_hpd && (ifbdev->vma || ifbdev->helper.deferred_setup))
1520 + drm_fb_helper_hotplug_event(&ifbdev->helper);
1521 + }
1522 +
1523 +diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/falcon.c b/drivers/gpu/drm/nouveau/nvkm/engine/falcon.c
1524 +index 816ccaedfc73..8675613e142b 100644
1525 +--- a/drivers/gpu/drm/nouveau/nvkm/engine/falcon.c
1526 ++++ b/drivers/gpu/drm/nouveau/nvkm/engine/falcon.c
1527 +@@ -22,6 +22,7 @@
1528 + #include <engine/falcon.h>
1529 +
1530 + #include <core/gpuobj.h>
1531 ++#include <subdev/mc.h>
1532 + #include <subdev/timer.h>
1533 + #include <engine/fifo.h>
1534 +
1535 +@@ -107,8 +108,10 @@ nvkm_falcon_fini(struct nvkm_engine *engine, bool suspend)
1536 + }
1537 + }
1538 +
1539 +- nvkm_mask(device, base + 0x048, 0x00000003, 0x00000000);
1540 +- nvkm_wr32(device, base + 0x014, 0xffffffff);
1541 ++ if (nvkm_mc_enabled(device, engine->subdev.index)) {
1542 ++ nvkm_mask(device, base + 0x048, 0x00000003, 0x00000000);
1543 ++ nvkm_wr32(device, base + 0x014, 0xffffffff);
1544 ++ }
1545 + return 0;
1546 + }
1547 +
1548 +diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/therm/base.c b/drivers/gpu/drm/nouveau/nvkm/subdev/therm/base.c
1549 +index 3695cde669f8..07914e36939e 100644
1550 +--- a/drivers/gpu/drm/nouveau/nvkm/subdev/therm/base.c
1551 ++++ b/drivers/gpu/drm/nouveau/nvkm/subdev/therm/base.c
1552 +@@ -132,11 +132,12 @@ nvkm_therm_update(struct nvkm_therm *therm, int mode)
1553 + duty = nvkm_therm_update_linear(therm);
1554 + break;
1555 + case NVBIOS_THERM_FAN_OTHER:
1556 +- if (therm->cstate)
1557 ++ if (therm->cstate) {
1558 + duty = therm->cstate;
1559 +- else
1560 ++ poll = false;
1561 ++ } else {
1562 + duty = nvkm_therm_update_linear_fallback(therm);
1563 +- poll = false;
1564 ++ }
1565 + break;
1566 + }
1567 + immd = false;
1568 +diff --git a/drivers/gpu/drm/scheduler/sched_entity.c b/drivers/gpu/drm/scheduler/sched_entity.c
1569 +index 3e22a54a99c2..2c02f5b03db8 100644
1570 +--- a/drivers/gpu/drm/scheduler/sched_entity.c
1571 ++++ b/drivers/gpu/drm/scheduler/sched_entity.c
1572 +@@ -434,13 +434,10 @@ struct drm_sched_job *drm_sched_entity_pop_job(struct drm_sched_entity *entity)
1573 +
1574 + while ((entity->dependency =
1575 + sched->ops->dependency(sched_job, entity))) {
1576 ++ trace_drm_sched_job_wait_dep(sched_job, entity->dependency);
1577 +
1578 +- if (drm_sched_entity_add_dependency_cb(entity)) {
1579 +-
1580 +- trace_drm_sched_job_wait_dep(sched_job,
1581 +- entity->dependency);
1582 ++ if (drm_sched_entity_add_dependency_cb(entity))
1583 + return NULL;
1584 +- }
1585 + }
1586 +
1587 + /* skip jobs from entity that marked guilty */
1588 +diff --git a/drivers/gpu/drm/vkms/vkms_crc.c b/drivers/gpu/drm/vkms/vkms_crc.c
1589 +index 9d9e8146db90..d7b409a3c0f8 100644
1590 +--- a/drivers/gpu/drm/vkms/vkms_crc.c
1591 ++++ b/drivers/gpu/drm/vkms/vkms_crc.c
1592 +@@ -1,4 +1,5 @@
1593 +-// SPDX-License-Identifier: GPL-2.0
1594 ++// SPDX-License-Identifier: GPL-2.0+
1595 ++
1596 + #include "vkms_drv.h"
1597 + #include <linux/crc32.h>
1598 + #include <drm/drm_atomic.h>
1599 +diff --git a/drivers/gpu/drm/vkms/vkms_crtc.c b/drivers/gpu/drm/vkms/vkms_crtc.c
1600 +index 177bbcb38306..eb56ee893761 100644
1601 +--- a/drivers/gpu/drm/vkms/vkms_crtc.c
1602 ++++ b/drivers/gpu/drm/vkms/vkms_crtc.c
1603 +@@ -1,10 +1,4 @@
1604 +-// SPDX-License-Identifier: GPL-2.0
1605 +-/*
1606 +- * This program is free software; you can redistribute it and/or modify
1607 +- * it under the terms of the GNU General Public License as published by
1608 +- * the Free Software Foundation; either version 2 of the License, or
1609 +- * (at your option) any later version.
1610 +- */
1611 ++// SPDX-License-Identifier: GPL-2.0+
1612 +
1613 + #include "vkms_drv.h"
1614 + #include <drm/drm_atomic_helper.h>
1615 +diff --git a/drivers/gpu/drm/vkms/vkms_drv.c b/drivers/gpu/drm/vkms/vkms_drv.c
1616 +index 07cfde1b4132..8048b2486b0e 100644
1617 +--- a/drivers/gpu/drm/vkms/vkms_drv.c
1618 ++++ b/drivers/gpu/drm/vkms/vkms_drv.c
1619 +@@ -1,9 +1,4 @@
1620 +-/*
1621 +- * This program is free software; you can redistribute it and/or modify
1622 +- * it under the terms of the GNU General Public License as published by
1623 +- * the Free Software Foundation; either version 2 of the License, or
1624 +- * (at your option) any later version.
1625 +- */
1626 ++// SPDX-License-Identifier: GPL-2.0+
1627 +
1628 + /**
1629 + * DOC: vkms (Virtual Kernel Modesetting)
1630 +diff --git a/drivers/gpu/drm/vkms/vkms_drv.h b/drivers/gpu/drm/vkms/vkms_drv.h
1631 +index 1c93990693e3..5adbc6fca41b 100644
1632 +--- a/drivers/gpu/drm/vkms/vkms_drv.h
1633 ++++ b/drivers/gpu/drm/vkms/vkms_drv.h
1634 +@@ -1,3 +1,5 @@
1635 ++/* SPDX-License-Identifier: GPL-2.0+ */
1636 ++
1637 + #ifndef _VKMS_DRV_H_
1638 + #define _VKMS_DRV_H_
1639 +
1640 +diff --git a/drivers/gpu/drm/vkms/vkms_gem.c b/drivers/gpu/drm/vkms/vkms_gem.c
1641 +index d04e988b4cbe..8310b96d4a9c 100644
1642 +--- a/drivers/gpu/drm/vkms/vkms_gem.c
1643 ++++ b/drivers/gpu/drm/vkms/vkms_gem.c
1644 +@@ -1,10 +1,4 @@
1645 +-// SPDX-License-Identifier: GPL-2.0
1646 +-/*
1647 +- * This program is free software; you can redistribute it and/or modify
1648 +- * it under the terms of the GNU General Public License as published by
1649 +- * the Free Software Foundation; either version 2 of the License, or
1650 +- * (at your option) any later version.
1651 +- */
1652 ++// SPDX-License-Identifier: GPL-2.0+
1653 +
1654 + #include <linux/shmem_fs.h>
1655 +
1656 +diff --git a/drivers/gpu/drm/vkms/vkms_output.c b/drivers/gpu/drm/vkms/vkms_output.c
1657 +index 271a0eb9042c..4173e4f48334 100644
1658 +--- a/drivers/gpu/drm/vkms/vkms_output.c
1659 ++++ b/drivers/gpu/drm/vkms/vkms_output.c
1660 +@@ -1,10 +1,4 @@
1661 +-// SPDX-License-Identifier: GPL-2.0
1662 +-/*
1663 +- * This program is free software; you can redistribute it and/or modify
1664 +- * it under the terms of the GNU General Public License as published by
1665 +- * the Free Software Foundation; either version 2 of the License, or
1666 +- * (at your option) any later version.
1667 +- */
1668 ++// SPDX-License-Identifier: GPL-2.0+
1669 +
1670 + #include "vkms_drv.h"
1671 + #include <drm/drm_crtc_helper.h>
1672 +diff --git a/drivers/gpu/drm/vkms/vkms_plane.c b/drivers/gpu/drm/vkms/vkms_plane.c
1673 +index e3bcea4b4891..8ffc1dad6485 100644
1674 +--- a/drivers/gpu/drm/vkms/vkms_plane.c
1675 ++++ b/drivers/gpu/drm/vkms/vkms_plane.c
1676 +@@ -1,10 +1,4 @@
1677 +-// SPDX-License-Identifier: GPL-2.0
1678 +-/*
1679 +- * This program is free software; you can redistribute it and/or modify
1680 +- * it under the terms of the GNU General Public License as published by
1681 +- * the Free Software Foundation; either version 2 of the License, or
1682 +- * (at your option) any later version.
1683 +- */
1684 ++// SPDX-License-Identifier: GPL-2.0+
1685 +
1686 + #include "vkms_drv.h"
1687 + #include <drm/drm_plane_helper.h>
1688 +diff --git a/drivers/input/misc/bma150.c b/drivers/input/misc/bma150.c
1689 +index 1efcfdf9f8a8..dd9dd4e40827 100644
1690 +--- a/drivers/input/misc/bma150.c
1691 ++++ b/drivers/input/misc/bma150.c
1692 +@@ -481,13 +481,14 @@ static int bma150_register_input_device(struct bma150_data *bma150)
1693 + idev->close = bma150_irq_close;
1694 + input_set_drvdata(idev, bma150);
1695 +
1696 ++ bma150->input = idev;
1697 ++
1698 + error = input_register_device(idev);
1699 + if (error) {
1700 + input_free_device(idev);
1701 + return error;
1702 + }
1703 +
1704 +- bma150->input = idev;
1705 + return 0;
1706 + }
1707 +
1708 +@@ -510,15 +511,15 @@ static int bma150_register_polled_device(struct bma150_data *bma150)
1709 +
1710 + bma150_init_input_device(bma150, ipoll_dev->input);
1711 +
1712 ++ bma150->input_polled = ipoll_dev;
1713 ++ bma150->input = ipoll_dev->input;
1714 ++
1715 + error = input_register_polled_device(ipoll_dev);
1716 + if (error) {
1717 + input_free_polled_device(ipoll_dev);
1718 + return error;
1719 + }
1720 +
1721 +- bma150->input_polled = ipoll_dev;
1722 +- bma150->input = ipoll_dev->input;
1723 +-
1724 + return 0;
1725 + }
1726 +
1727 +diff --git a/drivers/input/mouse/elan_i2c_core.c b/drivers/input/mouse/elan_i2c_core.c
1728 +index f322a1768fbb..225ae6980182 100644
1729 +--- a/drivers/input/mouse/elan_i2c_core.c
1730 ++++ b/drivers/input/mouse/elan_i2c_core.c
1731 +@@ -1336,7 +1336,6 @@ MODULE_DEVICE_TABLE(i2c, elan_id);
1732 + static const struct acpi_device_id elan_acpi_id[] = {
1733 + { "ELAN0000", 0 },
1734 + { "ELAN0100", 0 },
1735 +- { "ELAN0501", 0 },
1736 + { "ELAN0600", 0 },
1737 + { "ELAN0602", 0 },
1738 + { "ELAN0605", 0 },
1739 +@@ -1346,6 +1345,7 @@ static const struct acpi_device_id elan_acpi_id[] = {
1740 + { "ELAN060C", 0 },
1741 + { "ELAN0611", 0 },
1742 + { "ELAN0612", 0 },
1743 ++ { "ELAN0617", 0 },
1744 + { "ELAN0618", 0 },
1745 + { "ELAN061C", 0 },
1746 + { "ELAN061D", 0 },
1747 +diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c
1748 +index 9fe075c137dc..a7f8b1614559 100644
1749 +--- a/drivers/input/mouse/elantech.c
1750 ++++ b/drivers/input/mouse/elantech.c
1751 +@@ -1119,6 +1119,8 @@ static int elantech_get_resolution_v4(struct psmouse *psmouse,
1752 + * Asus UX31 0x361f00 20, 15, 0e clickpad
1753 + * Asus UX32VD 0x361f02 00, 15, 0e clickpad
1754 + * Avatar AVIU-145A2 0x361f00 ? clickpad
1755 ++ * Fujitsu CELSIUS H760 0x570f02 40, 14, 0c 3 hw buttons (**)
1756 ++ * Fujitsu CELSIUS H780 0x5d0f02 41, 16, 0d 3 hw buttons (**)
1757 + * Fujitsu LIFEBOOK E544 0x470f00 d0, 12, 09 2 hw buttons
1758 + * Fujitsu LIFEBOOK E546 0x470f00 50, 12, 09 2 hw buttons
1759 + * Fujitsu LIFEBOOK E547 0x470f00 50, 12, 09 2 hw buttons
1760 +@@ -1171,6 +1173,13 @@ static const struct dmi_system_id elantech_dmi_has_middle_button[] = {
1761 + DMI_MATCH(DMI_PRODUCT_NAME, "CELSIUS H760"),
1762 + },
1763 + },
1764 ++ {
1765 ++ /* Fujitsu H780 also has a middle button */
1766 ++ .matches = {
1767 ++ DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
1768 ++ DMI_MATCH(DMI_PRODUCT_NAME, "CELSIUS H780"),
1769 ++ },
1770 ++ },
1771 + #endif
1772 + { }
1773 + };
1774 +diff --git a/drivers/irqchip/irq-csky-apb-intc.c b/drivers/irqchip/irq-csky-apb-intc.c
1775 +index 2543baba8b1f..5a2ec43b7ddd 100644
1776 +--- a/drivers/irqchip/irq-csky-apb-intc.c
1777 ++++ b/drivers/irqchip/irq-csky-apb-intc.c
1778 +@@ -95,7 +95,7 @@ static inline void setup_irq_channel(u32 magic, void __iomem *reg_addr)
1779 +
1780 + /* Setup 64 channel slots */
1781 + for (i = 0; i < INTC_IRQS; i += 4)
1782 +- writel_relaxed(build_channel_val(i, magic), reg_addr + i);
1783 ++ writel(build_channel_val(i, magic), reg_addr + i);
1784 + }
1785 +
1786 + static int __init
1787 +@@ -135,16 +135,10 @@ ck_intc_init_comm(struct device_node *node, struct device_node *parent)
1788 + static inline bool handle_irq_perbit(struct pt_regs *regs, u32 hwirq,
1789 + u32 irq_base)
1790 + {
1791 +- u32 irq;
1792 +-
1793 + if (hwirq == 0)
1794 + return 0;
1795 +
1796 +- while (hwirq) {
1797 +- irq = __ffs(hwirq);
1798 +- hwirq &= ~BIT(irq);
1799 +- handle_domain_irq(root_domain, irq_base + irq, regs);
1800 +- }
1801 ++ handle_domain_irq(root_domain, irq_base + __fls(hwirq), regs);
1802 +
1803 + return 1;
1804 + }
1805 +@@ -154,12 +148,16 @@ static void gx_irq_handler(struct pt_regs *regs)
1806 + {
1807 + bool ret;
1808 +
1809 +- do {
1810 +- ret = handle_irq_perbit(regs,
1811 +- readl_relaxed(reg_base + GX_INTC_PEN31_00), 0);
1812 +- ret |= handle_irq_perbit(regs,
1813 +- readl_relaxed(reg_base + GX_INTC_PEN63_32), 32);
1814 +- } while (ret);
1815 ++retry:
1816 ++ ret = handle_irq_perbit(regs,
1817 ++ readl(reg_base + GX_INTC_PEN63_32), 32);
1818 ++ if (ret)
1819 ++ goto retry;
1820 ++
1821 ++ ret = handle_irq_perbit(regs,
1822 ++ readl(reg_base + GX_INTC_PEN31_00), 0);
1823 ++ if (ret)
1824 ++ goto retry;
1825 + }
1826 +
1827 + static int __init
1828 +@@ -174,14 +172,14 @@ gx_intc_init(struct device_node *node, struct device_node *parent)
1829 + /*
1830 + * Initial enable reg to disable all interrupts
1831 + */
1832 +- writel_relaxed(0x0, reg_base + GX_INTC_NEN31_00);
1833 +- writel_relaxed(0x0, reg_base + GX_INTC_NEN63_32);
1834 ++ writel(0x0, reg_base + GX_INTC_NEN31_00);
1835 ++ writel(0x0, reg_base + GX_INTC_NEN63_32);
1836 +
1837 + /*
1838 + * Initial mask reg with all unmasked, because we only use enalbe reg
1839 + */
1840 +- writel_relaxed(0x0, reg_base + GX_INTC_NMASK31_00);
1841 +- writel_relaxed(0x0, reg_base + GX_INTC_NMASK63_32);
1842 ++ writel(0x0, reg_base + GX_INTC_NMASK31_00);
1843 ++ writel(0x0, reg_base + GX_INTC_NMASK63_32);
1844 +
1845 + setup_irq_channel(0x03020100, reg_base + GX_INTC_SOURCE);
1846 +
1847 +@@ -204,20 +202,29 @@ static void ck_irq_handler(struct pt_regs *regs)
1848 + void __iomem *reg_pen_lo = reg_base + CK_INTC_PEN31_00;
1849 + void __iomem *reg_pen_hi = reg_base + CK_INTC_PEN63_32;
1850 +
1851 +- do {
1852 +- /* handle 0 - 31 irqs */
1853 +- ret = handle_irq_perbit(regs, readl_relaxed(reg_pen_lo), 0);
1854 +- ret |= handle_irq_perbit(regs, readl_relaxed(reg_pen_hi), 32);
1855 ++retry:
1856 ++ /* handle 0 - 63 irqs */
1857 ++ ret = handle_irq_perbit(regs, readl(reg_pen_hi), 32);
1858 ++ if (ret)
1859 ++ goto retry;
1860 +
1861 +- if (nr_irq == INTC_IRQS)
1862 +- continue;
1863 ++ ret = handle_irq_perbit(regs, readl(reg_pen_lo), 0);
1864 ++ if (ret)
1865 ++ goto retry;
1866 ++
1867 ++ if (nr_irq == INTC_IRQS)
1868 ++ return;
1869 +
1870 +- /* handle 64 - 127 irqs */
1871 +- ret |= handle_irq_perbit(regs,
1872 +- readl_relaxed(reg_pen_lo + CK_INTC_DUAL_BASE), 64);
1873 +- ret |= handle_irq_perbit(regs,
1874 +- readl_relaxed(reg_pen_hi + CK_INTC_DUAL_BASE), 96);
1875 +- } while (ret);
1876 ++ /* handle 64 - 127 irqs */
1877 ++ ret = handle_irq_perbit(regs,
1878 ++ readl(reg_pen_hi + CK_INTC_DUAL_BASE), 96);
1879 ++ if (ret)
1880 ++ goto retry;
1881 ++
1882 ++ ret = handle_irq_perbit(regs,
1883 ++ readl(reg_pen_lo + CK_INTC_DUAL_BASE), 64);
1884 ++ if (ret)
1885 ++ goto retry;
1886 + }
1887 +
1888 + static int __init
1889 +@@ -230,11 +237,11 @@ ck_intc_init(struct device_node *node, struct device_node *parent)
1890 + return ret;
1891 +
1892 + /* Initial enable reg to disable all interrupts */
1893 +- writel_relaxed(0, reg_base + CK_INTC_NEN31_00);
1894 +- writel_relaxed(0, reg_base + CK_INTC_NEN63_32);
1895 ++ writel(0, reg_base + CK_INTC_NEN31_00);
1896 ++ writel(0, reg_base + CK_INTC_NEN63_32);
1897 +
1898 + /* Enable irq intc */
1899 +- writel_relaxed(BIT(31), reg_base + CK_INTC_ICR);
1900 ++ writel(BIT(31), reg_base + CK_INTC_ICR);
1901 +
1902 + ck_set_gc(node, reg_base, CK_INTC_NEN31_00, 0);
1903 + ck_set_gc(node, reg_base, CK_INTC_NEN63_32, 32);
1904 +@@ -260,8 +267,8 @@ ck_dual_intc_init(struct device_node *node, struct device_node *parent)
1905 + return ret;
1906 +
1907 + /* Initial enable reg to disable all interrupts */
1908 +- writel_relaxed(0, reg_base + CK_INTC_NEN31_00 + CK_INTC_DUAL_BASE);
1909 +- writel_relaxed(0, reg_base + CK_INTC_NEN63_32 + CK_INTC_DUAL_BASE);
1910 ++ writel(0, reg_base + CK_INTC_NEN31_00 + CK_INTC_DUAL_BASE);
1911 ++ writel(0, reg_base + CK_INTC_NEN63_32 + CK_INTC_DUAL_BASE);
1912 +
1913 + ck_set_gc(node, reg_base + CK_INTC_DUAL_BASE, CK_INTC_NEN31_00, 64);
1914 + ck_set_gc(node, reg_base + CK_INTC_DUAL_BASE, CK_INTC_NEN63_32, 96);
1915 +diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c
1916 +index 1ef828575fae..9fc5423f83c1 100644
1917 +--- a/drivers/md/dm-crypt.c
1918 ++++ b/drivers/md/dm-crypt.c
1919 +@@ -932,7 +932,7 @@ static int dm_crypt_integrity_io_alloc(struct dm_crypt_io *io, struct bio *bio)
1920 + if (IS_ERR(bip))
1921 + return PTR_ERR(bip);
1922 +
1923 +- tag_len = io->cc->on_disk_tag_size * bio_sectors(bio);
1924 ++ tag_len = io->cc->on_disk_tag_size * (bio_sectors(bio) >> io->cc->sector_shift);
1925 +
1926 + bip->bip_iter.bi_size = tag_len;
1927 + bip->bip_iter.bi_sector = io->cc->start + io->sector;
1928 +diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c
1929 +index ca8af21bf644..e83b63608262 100644
1930 +--- a/drivers/md/dm-thin.c
1931 ++++ b/drivers/md/dm-thin.c
1932 +@@ -257,6 +257,7 @@ struct pool {
1933 +
1934 + spinlock_t lock;
1935 + struct bio_list deferred_flush_bios;
1936 ++ struct bio_list deferred_flush_completions;
1937 + struct list_head prepared_mappings;
1938 + struct list_head prepared_discards;
1939 + struct list_head prepared_discards_pt2;
1940 +@@ -956,6 +957,39 @@ static void process_prepared_mapping_fail(struct dm_thin_new_mapping *m)
1941 + mempool_free(m, &m->tc->pool->mapping_pool);
1942 + }
1943 +
1944 ++static void complete_overwrite_bio(struct thin_c *tc, struct bio *bio)
1945 ++{
1946 ++ struct pool *pool = tc->pool;
1947 ++ unsigned long flags;
1948 ++
1949 ++ /*
1950 ++ * If the bio has the REQ_FUA flag set we must commit the metadata
1951 ++ * before signaling its completion.
1952 ++ */
1953 ++ if (!bio_triggers_commit(tc, bio)) {
1954 ++ bio_endio(bio);
1955 ++ return;
1956 ++ }
1957 ++
1958 ++ /*
1959 ++ * Complete bio with an error if earlier I/O caused changes to the
1960 ++ * metadata that can't be committed, e.g, due to I/O errors on the
1961 ++ * metadata device.
1962 ++ */
1963 ++ if (dm_thin_aborted_changes(tc->td)) {
1964 ++ bio_io_error(bio);
1965 ++ return;
1966 ++ }
1967 ++
1968 ++ /*
1969 ++ * Batch together any bios that trigger commits and then issue a
1970 ++ * single commit for them in process_deferred_bios().
1971 ++ */
1972 ++ spin_lock_irqsave(&pool->lock, flags);
1973 ++ bio_list_add(&pool->deferred_flush_completions, bio);
1974 ++ spin_unlock_irqrestore(&pool->lock, flags);
1975 ++}
1976 ++
1977 + static void process_prepared_mapping(struct dm_thin_new_mapping *m)
1978 + {
1979 + struct thin_c *tc = m->tc;
1980 +@@ -988,7 +1022,7 @@ static void process_prepared_mapping(struct dm_thin_new_mapping *m)
1981 + */
1982 + if (bio) {
1983 + inc_remap_and_issue_cell(tc, m->cell, m->data_block);
1984 +- bio_endio(bio);
1985 ++ complete_overwrite_bio(tc, bio);
1986 + } else {
1987 + inc_all_io_entry(tc->pool, m->cell->holder);
1988 + remap_and_issue(tc, m->cell->holder, m->data_block);
1989 +@@ -2317,7 +2351,7 @@ static void process_deferred_bios(struct pool *pool)
1990 + {
1991 + unsigned long flags;
1992 + struct bio *bio;
1993 +- struct bio_list bios;
1994 ++ struct bio_list bios, bio_completions;
1995 + struct thin_c *tc;
1996 +
1997 + tc = get_first_thin(pool);
1998 +@@ -2328,26 +2362,36 @@ static void process_deferred_bios(struct pool *pool)
1999 + }
2000 +
2001 + /*
2002 +- * If there are any deferred flush bios, we must commit
2003 +- * the metadata before issuing them.
2004 ++ * If there are any deferred flush bios, we must commit the metadata
2005 ++ * before issuing them or signaling their completion.
2006 + */
2007 + bio_list_init(&bios);
2008 ++ bio_list_init(&bio_completions);
2009 ++
2010 + spin_lock_irqsave(&pool->lock, flags);
2011 + bio_list_merge(&bios, &pool->deferred_flush_bios);
2012 + bio_list_init(&pool->deferred_flush_bios);
2013 ++
2014 ++ bio_list_merge(&bio_completions, &pool->deferred_flush_completions);
2015 ++ bio_list_init(&pool->deferred_flush_completions);
2016 + spin_unlock_irqrestore(&pool->lock, flags);
2017 +
2018 +- if (bio_list_empty(&bios) &&
2019 ++ if (bio_list_empty(&bios) && bio_list_empty(&bio_completions) &&
2020 + !(dm_pool_changed_this_transaction(pool->pmd) && need_commit_due_to_time(pool)))
2021 + return;
2022 +
2023 + if (commit(pool)) {
2024 ++ bio_list_merge(&bios, &bio_completions);
2025 ++
2026 + while ((bio = bio_list_pop(&bios)))
2027 + bio_io_error(bio);
2028 + return;
2029 + }
2030 + pool->last_commit_jiffies = jiffies;
2031 +
2032 ++ while ((bio = bio_list_pop(&bio_completions)))
2033 ++ bio_endio(bio);
2034 ++
2035 + while ((bio = bio_list_pop(&bios)))
2036 + generic_make_request(bio);
2037 + }
2038 +@@ -2954,6 +2998,7 @@ static struct pool *pool_create(struct mapped_device *pool_md,
2039 + INIT_DELAYED_WORK(&pool->no_space_timeout, do_no_space_timeout);
2040 + spin_lock_init(&pool->lock);
2041 + bio_list_init(&pool->deferred_flush_bios);
2042 ++ bio_list_init(&pool->deferred_flush_completions);
2043 + INIT_LIST_HEAD(&pool->prepared_mappings);
2044 + INIT_LIST_HEAD(&pool->prepared_discards);
2045 + INIT_LIST_HEAD(&pool->prepared_discards_pt2);
2046 +diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
2047 +index 1d54109071cc..fa47249fa3e4 100644
2048 +--- a/drivers/md/raid1.c
2049 ++++ b/drivers/md/raid1.c
2050 +@@ -1863,6 +1863,20 @@ static void end_sync_read(struct bio *bio)
2051 + reschedule_retry(r1_bio);
2052 + }
2053 +
2054 ++static void abort_sync_write(struct mddev *mddev, struct r1bio *r1_bio)
2055 ++{
2056 ++ sector_t sync_blocks = 0;
2057 ++ sector_t s = r1_bio->sector;
2058 ++ long sectors_to_go = r1_bio->sectors;
2059 ++
2060 ++ /* make sure these bits don't get cleared. */
2061 ++ do {
2062 ++ md_bitmap_end_sync(mddev->bitmap, s, &sync_blocks, 1);
2063 ++ s += sync_blocks;
2064 ++ sectors_to_go -= sync_blocks;
2065 ++ } while (sectors_to_go > 0);
2066 ++}
2067 ++
2068 + static void end_sync_write(struct bio *bio)
2069 + {
2070 + int uptodate = !bio->bi_status;
2071 +@@ -1874,15 +1888,7 @@ static void end_sync_write(struct bio *bio)
2072 + struct md_rdev *rdev = conf->mirrors[find_bio_disk(r1_bio, bio)].rdev;
2073 +
2074 + if (!uptodate) {
2075 +- sector_t sync_blocks = 0;
2076 +- sector_t s = r1_bio->sector;
2077 +- long sectors_to_go = r1_bio->sectors;
2078 +- /* make sure these bits doesn't get cleared. */
2079 +- do {
2080 +- md_bitmap_end_sync(mddev->bitmap, s, &sync_blocks, 1);
2081 +- s += sync_blocks;
2082 +- sectors_to_go -= sync_blocks;
2083 +- } while (sectors_to_go > 0);
2084 ++ abort_sync_write(mddev, r1_bio);
2085 + set_bit(WriteErrorSeen, &rdev->flags);
2086 + if (!test_and_set_bit(WantReplacement, &rdev->flags))
2087 + set_bit(MD_RECOVERY_NEEDED, &
2088 +@@ -2172,8 +2178,10 @@ static void sync_request_write(struct mddev *mddev, struct r1bio *r1_bio)
2089 + (i == r1_bio->read_disk ||
2090 + !test_bit(MD_RECOVERY_SYNC, &mddev->recovery))))
2091 + continue;
2092 +- if (test_bit(Faulty, &conf->mirrors[i].rdev->flags))
2093 ++ if (test_bit(Faulty, &conf->mirrors[i].rdev->flags)) {
2094 ++ abort_sync_write(mddev, r1_bio);
2095 + continue;
2096 ++ }
2097 +
2098 + bio_set_op_attrs(wbio, REQ_OP_WRITE, 0);
2099 + if (test_bit(FailFast, &conf->mirrors[i].rdev->flags))
2100 +diff --git a/drivers/misc/eeprom/Kconfig b/drivers/misc/eeprom/Kconfig
2101 +index fe7a1d27a017..a846faefa210 100644
2102 +--- a/drivers/misc/eeprom/Kconfig
2103 ++++ b/drivers/misc/eeprom/Kconfig
2104 +@@ -13,7 +13,7 @@ config EEPROM_AT24
2105 + ones like at24c64, 24lc02 or fm24c04:
2106 +
2107 + 24c00, 24c01, 24c02, spd (readonly 24c02), 24c04, 24c08,
2108 +- 24c16, 24c32, 24c64, 24c128, 24c256, 24c512, 24c1024
2109 ++ 24c16, 24c32, 24c64, 24c128, 24c256, 24c512, 24c1024, 24c2048
2110 +
2111 + Unless you like data loss puzzles, always be sure that any chip
2112 + you configure as a 24c32 (32 kbit) or larger is NOT really a
2113 +diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c
2114 +index 636ed7149793..ddfcf4ade7bf 100644
2115 +--- a/drivers/misc/eeprom/at24.c
2116 ++++ b/drivers/misc/eeprom/at24.c
2117 +@@ -156,6 +156,7 @@ AT24_CHIP_DATA(at24_data_24c128, 131072 / 8, AT24_FLAG_ADDR16);
2118 + AT24_CHIP_DATA(at24_data_24c256, 262144 / 8, AT24_FLAG_ADDR16);
2119 + AT24_CHIP_DATA(at24_data_24c512, 524288 / 8, AT24_FLAG_ADDR16);
2120 + AT24_CHIP_DATA(at24_data_24c1024, 1048576 / 8, AT24_FLAG_ADDR16);
2121 ++AT24_CHIP_DATA(at24_data_24c2048, 2097152 / 8, AT24_FLAG_ADDR16);
2122 + /* identical to 24c08 ? */
2123 + AT24_CHIP_DATA(at24_data_INT3499, 8192 / 8, 0);
2124 +
2125 +@@ -182,6 +183,7 @@ static const struct i2c_device_id at24_ids[] = {
2126 + { "24c256", (kernel_ulong_t)&at24_data_24c256 },
2127 + { "24c512", (kernel_ulong_t)&at24_data_24c512 },
2128 + { "24c1024", (kernel_ulong_t)&at24_data_24c1024 },
2129 ++ { "24c2048", (kernel_ulong_t)&at24_data_24c2048 },
2130 + { "at24", 0 },
2131 + { /* END OF LIST */ }
2132 + };
2133 +@@ -210,6 +212,7 @@ static const struct of_device_id at24_of_match[] = {
2134 + { .compatible = "atmel,24c256", .data = &at24_data_24c256 },
2135 + { .compatible = "atmel,24c512", .data = &at24_data_24c512 },
2136 + { .compatible = "atmel,24c1024", .data = &at24_data_24c1024 },
2137 ++ { .compatible = "atmel,24c2048", .data = &at24_data_24c2048 },
2138 + { /* END OF LIST */ },
2139 + };
2140 + MODULE_DEVICE_TABLE(of, at24_of_match);
2141 +diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c
2142 +index 111934838da2..4f1912a1e071 100644
2143 +--- a/drivers/mmc/core/block.c
2144 ++++ b/drivers/mmc/core/block.c
2145 +@@ -2114,7 +2114,7 @@ static void mmc_blk_mq_req_done(struct mmc_request *mrq)
2146 + if (waiting)
2147 + wake_up(&mq->wait);
2148 + else
2149 +- kblockd_schedule_work(&mq->complete_work);
2150 ++ queue_work(mq->card->complete_wq, &mq->complete_work);
2151 +
2152 + return;
2153 + }
2154 +@@ -2928,6 +2928,13 @@ static int mmc_blk_probe(struct mmc_card *card)
2155 +
2156 + mmc_fixup_device(card, mmc_blk_fixups);
2157 +
2158 ++ card->complete_wq = alloc_workqueue("mmc_complete",
2159 ++ WQ_MEM_RECLAIM | WQ_HIGHPRI, 0);
2160 ++ if (unlikely(!card->complete_wq)) {
2161 ++ pr_err("Failed to create mmc completion workqueue");
2162 ++ return -ENOMEM;
2163 ++ }
2164 ++
2165 + md = mmc_blk_alloc(card);
2166 + if (IS_ERR(md))
2167 + return PTR_ERR(md);
2168 +@@ -2991,6 +2998,7 @@ static void mmc_blk_remove(struct mmc_card *card)
2169 + pm_runtime_put_noidle(&card->dev);
2170 + mmc_blk_remove_req(md);
2171 + dev_set_drvdata(&card->dev, NULL);
2172 ++ destroy_workqueue(card->complete_wq);
2173 + }
2174 +
2175 + static int _mmc_blk_suspend(struct mmc_card *card)
2176 +diff --git a/drivers/mmc/host/sunxi-mmc.c b/drivers/mmc/host/sunxi-mmc.c
2177 +index 279e326e397e..70fadc976795 100644
2178 +--- a/drivers/mmc/host/sunxi-mmc.c
2179 ++++ b/drivers/mmc/host/sunxi-mmc.c
2180 +@@ -1399,13 +1399,37 @@ static int sunxi_mmc_probe(struct platform_device *pdev)
2181 + mmc->caps |= MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED |
2182 + MMC_CAP_ERASE | MMC_CAP_SDIO_IRQ;
2183 +
2184 +- if (host->cfg->clk_delays || host->use_new_timings)
2185 ++ /*
2186 ++ * Some H5 devices do not have signal traces precise enough to
2187 ++ * use HS DDR mode for their eMMC chips.
2188 ++ *
2189 ++ * We still enable HS DDR modes for all the other controller
2190 ++ * variants that support them.
2191 ++ */
2192 ++ if ((host->cfg->clk_delays || host->use_new_timings) &&
2193 ++ !of_device_is_compatible(pdev->dev.of_node,
2194 ++ "allwinner,sun50i-h5-emmc"))
2195 + mmc->caps |= MMC_CAP_1_8V_DDR | MMC_CAP_3_3V_DDR;
2196 +
2197 + ret = mmc_of_parse(mmc);
2198 + if (ret)
2199 + goto error_free_dma;
2200 +
2201 ++ /*
2202 ++ * If we don't support delay chains in the SoC, we can't use any
2203 ++ * of the higher speed modes. Mask them out in case the device
2204 ++ * tree specifies the properties for them, which gets added to
2205 ++ * the caps by mmc_of_parse() above.
2206 ++ */
2207 ++ if (!(host->cfg->clk_delays || host->use_new_timings)) {
2208 ++ mmc->caps &= ~(MMC_CAP_3_3V_DDR | MMC_CAP_1_8V_DDR |
2209 ++ MMC_CAP_1_2V_DDR | MMC_CAP_UHS);
2210 ++ mmc->caps2 &= ~MMC_CAP2_HS200;
2211 ++ }
2212 ++
2213 ++ /* TODO: This driver doesn't support HS400 mode yet */
2214 ++ mmc->caps2 &= ~MMC_CAP2_HS400;
2215 ++
2216 + ret = sunxi_mmc_init_host(host);
2217 + if (ret)
2218 + goto error_free_dma;
2219 +diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
2220 +index 962012135b62..5f9a5ef93969 100644
2221 +--- a/drivers/nvme/host/core.c
2222 ++++ b/drivers/nvme/host/core.c
2223 +@@ -2084,18 +2084,20 @@ static void nvme_init_subnqn(struct nvme_subsystem *subsys, struct nvme_ctrl *ct
2224 + size_t nqnlen;
2225 + int off;
2226 +
2227 +- nqnlen = strnlen(id->subnqn, NVMF_NQN_SIZE);
2228 +- if (nqnlen > 0 && nqnlen < NVMF_NQN_SIZE) {
2229 +- strlcpy(subsys->subnqn, id->subnqn, NVMF_NQN_SIZE);
2230 +- return;
2231 +- }
2232 ++ if(!(ctrl->quirks & NVME_QUIRK_IGNORE_DEV_SUBNQN)) {
2233 ++ nqnlen = strnlen(id->subnqn, NVMF_NQN_SIZE);
2234 ++ if (nqnlen > 0 && nqnlen < NVMF_NQN_SIZE) {
2235 ++ strlcpy(subsys->subnqn, id->subnqn, NVMF_NQN_SIZE);
2236 ++ return;
2237 ++ }
2238 +
2239 +- if (ctrl->vs >= NVME_VS(1, 2, 1))
2240 +- dev_warn(ctrl->device, "missing or invalid SUBNQN field.\n");
2241 ++ if (ctrl->vs >= NVME_VS(1, 2, 1))
2242 ++ dev_warn(ctrl->device, "missing or invalid SUBNQN field.\n");
2243 ++ }
2244 +
2245 + /* Generate a "fake" NQN per Figure 254 in NVMe 1.3 + ECN 001 */
2246 + off = snprintf(subsys->subnqn, NVMF_NQN_SIZE,
2247 +- "nqn.2014.08.org.nvmexpress:%4x%4x",
2248 ++ "nqn.2014.08.org.nvmexpress:%04x%04x",
2249 + le16_to_cpu(id->vid), le16_to_cpu(id->ssvid));
2250 + memcpy(subsys->subnqn + off, id->sn, sizeof(id->sn));
2251 + off += sizeof(id->sn);
2252 +diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c
2253 +index 9901afd804ce..2b1d1f066efa 100644
2254 +--- a/drivers/nvme/host/multipath.c
2255 ++++ b/drivers/nvme/host/multipath.c
2256 +@@ -586,6 +586,7 @@ int nvme_mpath_init(struct nvme_ctrl *ctrl, struct nvme_id_ctrl *id)
2257 + return 0;
2258 + out_free_ana_log_buf:
2259 + kfree(ctrl->ana_log_buf);
2260 ++ ctrl->ana_log_buf = NULL;
2261 + out:
2262 + return error;
2263 + }
2264 +@@ -593,5 +594,6 @@ out:
2265 + void nvme_mpath_uninit(struct nvme_ctrl *ctrl)
2266 + {
2267 + kfree(ctrl->ana_log_buf);
2268 ++ ctrl->ana_log_buf = NULL;
2269 + }
2270 +
2271 +diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h
2272 +index 081cbdcce880..6ffa99a10a60 100644
2273 +--- a/drivers/nvme/host/nvme.h
2274 ++++ b/drivers/nvme/host/nvme.h
2275 +@@ -90,6 +90,11 @@ enum nvme_quirks {
2276 + * Set MEDIUM priority on SQ creation
2277 + */
2278 + NVME_QUIRK_MEDIUM_PRIO_SQ = (1 << 7),
2279 ++
2280 ++ /*
2281 ++ * Ignore device provided subnqn.
2282 ++ */
2283 ++ NVME_QUIRK_IGNORE_DEV_SUBNQN = (1 << 8),
2284 + };
2285 +
2286 + /*
2287 +diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
2288 +index c33bb201b884..c0d01048ce4d 100644
2289 +--- a/drivers/nvme/host/pci.c
2290 ++++ b/drivers/nvme/host/pci.c
2291 +@@ -913,9 +913,11 @@ static void nvme_complete_cqes(struct nvme_queue *nvmeq, u16 start, u16 end)
2292 +
2293 + static inline void nvme_update_cq_head(struct nvme_queue *nvmeq)
2294 + {
2295 +- if (++nvmeq->cq_head == nvmeq->q_depth) {
2296 ++ if (nvmeq->cq_head == nvmeq->q_depth - 1) {
2297 + nvmeq->cq_head = 0;
2298 + nvmeq->cq_phase = !nvmeq->cq_phase;
2299 ++ } else {
2300 ++ nvmeq->cq_head++;
2301 + }
2302 + }
2303 +
2304 +@@ -1748,8 +1750,9 @@ static void nvme_free_host_mem(struct nvme_dev *dev)
2305 + struct nvme_host_mem_buf_desc *desc = &dev->host_mem_descs[i];
2306 + size_t size = le32_to_cpu(desc->size) * dev->ctrl.page_size;
2307 +
2308 +- dma_free_coherent(dev->dev, size, dev->host_mem_desc_bufs[i],
2309 +- le64_to_cpu(desc->addr));
2310 ++ dma_free_attrs(dev->dev, size, dev->host_mem_desc_bufs[i],
2311 ++ le64_to_cpu(desc->addr),
2312 ++ DMA_ATTR_NO_KERNEL_MAPPING | DMA_ATTR_NO_WARN);
2313 + }
2314 +
2315 + kfree(dev->host_mem_desc_bufs);
2316 +@@ -1815,8 +1818,9 @@ out_free_bufs:
2317 + while (--i >= 0) {
2318 + size_t size = le32_to_cpu(descs[i].size) * dev->ctrl.page_size;
2319 +
2320 +- dma_free_coherent(dev->dev, size, bufs[i],
2321 +- le64_to_cpu(descs[i].addr));
2322 ++ dma_free_attrs(dev->dev, size, bufs[i],
2323 ++ le64_to_cpu(descs[i].addr),
2324 ++ DMA_ATTR_NO_KERNEL_MAPPING | DMA_ATTR_NO_WARN);
2325 + }
2326 +
2327 + kfree(bufs);
2328 +@@ -2696,6 +2700,8 @@ static const struct pci_device_id nvme_id_table[] = {
2329 + { PCI_VDEVICE(INTEL, 0xf1a5), /* Intel 600P/P3100 */
2330 + .driver_data = NVME_QUIRK_NO_DEEPEST_PS |
2331 + NVME_QUIRK_MEDIUM_PRIO_SQ },
2332 ++ { PCI_VDEVICE(INTEL, 0xf1a6), /* Intel 760p/Pro 7600p */
2333 ++ .driver_data = NVME_QUIRK_IGNORE_DEV_SUBNQN, },
2334 + { PCI_VDEVICE(INTEL, 0x5845), /* Qemu emulated controller */
2335 + .driver_data = NVME_QUIRK_IDENTIFY_CNS, },
2336 + { PCI_DEVICE(0x1bb1, 0x0100), /* Seagate Nytro Flash Storage */
2337 +diff --git a/drivers/s390/crypto/ap_bus.c b/drivers/s390/crypto/ap_bus.c
2338 +index 9f5a201c4c87..02b52cacde33 100644
2339 +--- a/drivers/s390/crypto/ap_bus.c
2340 ++++ b/drivers/s390/crypto/ap_bus.c
2341 +@@ -248,7 +248,8 @@ static inline int ap_test_config(unsigned int *field, unsigned int nr)
2342 + static inline int ap_test_config_card_id(unsigned int id)
2343 + {
2344 + if (!ap_configuration) /* QCI not supported */
2345 +- return 1;
2346 ++ /* only ids 0...3F may be probed */
2347 ++ return id < 0x40 ? 1 : 0;
2348 + return ap_test_config(ap_configuration->apm, id);
2349 + }
2350 +
2351 +diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
2352 +index ba4b8b3ce8cf..c0e21433b1d8 100644
2353 +--- a/drivers/scsi/sd.c
2354 ++++ b/drivers/scsi/sd.c
2355 +@@ -2960,9 +2960,6 @@ static void sd_read_block_characteristics(struct scsi_disk *sdkp)
2356 + if (rot == 1) {
2357 + blk_queue_flag_set(QUEUE_FLAG_NONROT, q);
2358 + blk_queue_flag_clear(QUEUE_FLAG_ADD_RANDOM, q);
2359 +- } else {
2360 +- blk_queue_flag_clear(QUEUE_FLAG_NONROT, q);
2361 +- blk_queue_flag_set(QUEUE_FLAG_ADD_RANDOM, q);
2362 + }
2363 +
2364 + if (sdkp->device->type == TYPE_ZBC) {
2365 +@@ -3099,6 +3096,15 @@ static int sd_revalidate_disk(struct gendisk *disk)
2366 + if (sdkp->media_present) {
2367 + sd_read_capacity(sdkp, buffer);
2368 +
2369 ++ /*
2370 ++ * set the default to rotational. All non-rotational devices
2371 ++ * support the block characteristics VPD page, which will
2372 ++ * cause this to be updated correctly and any device which
2373 ++ * doesn't support it should be treated as rotational.
2374 ++ */
2375 ++ blk_queue_flag_clear(QUEUE_FLAG_NONROT, q);
2376 ++ blk_queue_flag_set(QUEUE_FLAG_ADD_RANDOM, q);
2377 ++
2378 + if (scsi_device_supports_vpd(sdp)) {
2379 + sd_read_block_provisioning(sdkp);
2380 + sd_read_block_limits(sdkp);
2381 +diff --git a/drivers/soc/renesas/r8a774c0-sysc.c b/drivers/soc/renesas/r8a774c0-sysc.c
2382 +index e1ac4c0f6640..11050e17ea81 100644
2383 +--- a/drivers/soc/renesas/r8a774c0-sysc.c
2384 ++++ b/drivers/soc/renesas/r8a774c0-sysc.c
2385 +@@ -28,19 +28,6 @@ static struct rcar_sysc_area r8a774c0_areas[] __initdata = {
2386 + { "3dg-b", 0x100, 1, R8A774C0_PD_3DG_B, R8A774C0_PD_3DG_A },
2387 + };
2388 +
2389 +-static void __init rcar_sysc_fix_parent(struct rcar_sysc_area *areas,
2390 +- unsigned int num_areas, u8 id,
2391 +- int new_parent)
2392 +-{
2393 +- unsigned int i;
2394 +-
2395 +- for (i = 0; i < num_areas; i++)
2396 +- if (areas[i].isr_bit == id) {
2397 +- areas[i].parent = new_parent;
2398 +- return;
2399 +- }
2400 +-}
2401 +-
2402 + /* Fixups for RZ/G2E ES1.0 revision */
2403 + static const struct soc_device_attribute r8a774c0[] __initconst = {
2404 + { .soc_id = "r8a774c0", .revision = "ES1.0" },
2405 +@@ -50,12 +37,10 @@ static const struct soc_device_attribute r8a774c0[] __initconst = {
2406 + static int __init r8a774c0_sysc_init(void)
2407 + {
2408 + if (soc_device_match(r8a774c0)) {
2409 +- rcar_sysc_fix_parent(r8a774c0_areas,
2410 +- ARRAY_SIZE(r8a774c0_areas),
2411 +- R8A774C0_PD_3DG_A, R8A774C0_PD_3DG_B);
2412 +- rcar_sysc_fix_parent(r8a774c0_areas,
2413 +- ARRAY_SIZE(r8a774c0_areas),
2414 +- R8A774C0_PD_3DG_B, R8A774C0_PD_ALWAYS_ON);
2415 ++ /* Fix incorrect 3DG hierarchy */
2416 ++ swap(r8a774c0_areas[6], r8a774c0_areas[7]);
2417 ++ r8a774c0_areas[6].parent = R8A774C0_PD_ALWAYS_ON;
2418 ++ r8a774c0_areas[7].parent = R8A774C0_PD_3DG_B;
2419 + }
2420 +
2421 + return 0;
2422 +diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
2423 +index 38ab0fca49e1..373639199291 100644
2424 +--- a/fs/cifs/cifsglob.h
2425 ++++ b/fs/cifs/cifsglob.h
2426 +@@ -1426,6 +1426,7 @@ struct mid_q_entry {
2427 + int mid_state; /* wish this were enum but can not pass to wait_event */
2428 + unsigned int mid_flags;
2429 + __le16 command; /* smb command code */
2430 ++ unsigned int optype; /* operation type */
2431 + bool large_buf:1; /* if valid response, is pointer to large buf */
2432 + bool multiRsp:1; /* multiple trans2 responses for one request */
2433 + bool multiEnd:1; /* both received */
2434 +@@ -1562,6 +1563,25 @@ static inline void free_dfs_info_array(struct dfs_info3_param *param,
2435 + kfree(param);
2436 + }
2437 +
2438 ++static inline bool is_interrupt_error(int error)
2439 ++{
2440 ++ switch (error) {
2441 ++ case -EINTR:
2442 ++ case -ERESTARTSYS:
2443 ++ case -ERESTARTNOHAND:
2444 ++ case -ERESTARTNOINTR:
2445 ++ return true;
2446 ++ }
2447 ++ return false;
2448 ++}
2449 ++
2450 ++static inline bool is_retryable_error(int error)
2451 ++{
2452 ++ if (is_interrupt_error(error) || error == -EAGAIN)
2453 ++ return true;
2454 ++ return false;
2455 ++}
2456 ++
2457 + #define MID_FREE 0
2458 + #define MID_REQUEST_ALLOCATED 1
2459 + #define MID_REQUEST_SUBMITTED 2
2460 +diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
2461 +index fce610f6cd24..327a101f7894 100644
2462 +--- a/fs/cifs/cifssmb.c
2463 ++++ b/fs/cifs/cifssmb.c
2464 +@@ -2043,7 +2043,7 @@ cifs_writev_requeue(struct cifs_writedata *wdata)
2465 +
2466 + for (j = 0; j < nr_pages; j++) {
2467 + unlock_page(wdata2->pages[j]);
2468 +- if (rc != 0 && rc != -EAGAIN) {
2469 ++ if (rc != 0 && !is_retryable_error(rc)) {
2470 + SetPageError(wdata2->pages[j]);
2471 + end_page_writeback(wdata2->pages[j]);
2472 + put_page(wdata2->pages[j]);
2473 +@@ -2052,7 +2052,7 @@ cifs_writev_requeue(struct cifs_writedata *wdata)
2474 +
2475 + if (rc) {
2476 + kref_put(&wdata2->refcount, cifs_writedata_release);
2477 +- if (rc == -EAGAIN)
2478 ++ if (is_retryable_error(rc))
2479 + continue;
2480 + break;
2481 + }
2482 +@@ -2061,7 +2061,8 @@ cifs_writev_requeue(struct cifs_writedata *wdata)
2483 + i += nr_pages;
2484 + } while (i < wdata->nr_pages);
2485 +
2486 +- mapping_set_error(inode->i_mapping, rc);
2487 ++ if (rc != 0 && !is_retryable_error(rc))
2488 ++ mapping_set_error(inode->i_mapping, rc);
2489 + kref_put(&wdata->refcount, cifs_writedata_release);
2490 + }
2491 +
2492 +diff --git a/fs/cifs/file.c b/fs/cifs/file.c
2493 +index 8431854b129f..c13effbaadba 100644
2494 +--- a/fs/cifs/file.c
2495 ++++ b/fs/cifs/file.c
2496 +@@ -732,7 +732,8 @@ reopen_success:
2497 +
2498 + if (can_flush) {
2499 + rc = filemap_write_and_wait(inode->i_mapping);
2500 +- mapping_set_error(inode->i_mapping, rc);
2501 ++ if (!is_interrupt_error(rc))
2502 ++ mapping_set_error(inode->i_mapping, rc);
2503 +
2504 + if (tcon->unix_ext)
2505 + rc = cifs_get_inode_info_unix(&inode, full_path,
2506 +@@ -1139,6 +1140,10 @@ cifs_push_mandatory_locks(struct cifsFileInfo *cfile)
2507 + return -EINVAL;
2508 + }
2509 +
2510 ++ BUILD_BUG_ON(sizeof(struct smb_hdr) + sizeof(LOCKING_ANDX_RANGE) >
2511 ++ PAGE_SIZE);
2512 ++ max_buf = min_t(unsigned int, max_buf - sizeof(struct smb_hdr),
2513 ++ PAGE_SIZE);
2514 + max_num = (max_buf - sizeof(struct smb_hdr)) /
2515 + sizeof(LOCKING_ANDX_RANGE);
2516 + buf = kcalloc(max_num, sizeof(LOCKING_ANDX_RANGE), GFP_KERNEL);
2517 +@@ -1477,6 +1482,10 @@ cifs_unlock_range(struct cifsFileInfo *cfile, struct file_lock *flock,
2518 + if (max_buf < (sizeof(struct smb_hdr) + sizeof(LOCKING_ANDX_RANGE)))
2519 + return -EINVAL;
2520 +
2521 ++ BUILD_BUG_ON(sizeof(struct smb_hdr) + sizeof(LOCKING_ANDX_RANGE) >
2522 ++ PAGE_SIZE);
2523 ++ max_buf = min_t(unsigned int, max_buf - sizeof(struct smb_hdr),
2524 ++ PAGE_SIZE);
2525 + max_num = (max_buf - sizeof(struct smb_hdr)) /
2526 + sizeof(LOCKING_ANDX_RANGE);
2527 + buf = kcalloc(max_num, sizeof(LOCKING_ANDX_RANGE), GFP_KERNEL);
2528 +@@ -2109,6 +2118,7 @@ static int cifs_writepages(struct address_space *mapping,
2529 + pgoff_t end, index;
2530 + struct cifs_writedata *wdata;
2531 + int rc = 0;
2532 ++ int saved_rc = 0;
2533 + unsigned int xid;
2534 +
2535 + /*
2536 +@@ -2137,8 +2147,10 @@ retry:
2537 +
2538 + rc = server->ops->wait_mtu_credits(server, cifs_sb->wsize,
2539 + &wsize, &credits);
2540 +- if (rc)
2541 ++ if (rc != 0) {
2542 ++ done = true;
2543 + break;
2544 ++ }
2545 +
2546 + tofind = min((wsize / PAGE_SIZE) - 1, end - index) + 1;
2547 +
2548 +@@ -2146,6 +2158,7 @@ retry:
2549 + &found_pages);
2550 + if (!wdata) {
2551 + rc = -ENOMEM;
2552 ++ done = true;
2553 + add_credits_and_wake_if(server, credits, 0);
2554 + break;
2555 + }
2556 +@@ -2174,7 +2187,7 @@ retry:
2557 + if (rc != 0) {
2558 + add_credits_and_wake_if(server, wdata->credits, 0);
2559 + for (i = 0; i < nr_pages; ++i) {
2560 +- if (rc == -EAGAIN)
2561 ++ if (is_retryable_error(rc))
2562 + redirty_page_for_writepage(wbc,
2563 + wdata->pages[i]);
2564 + else
2565 +@@ -2182,7 +2195,7 @@ retry:
2566 + end_page_writeback(wdata->pages[i]);
2567 + put_page(wdata->pages[i]);
2568 + }
2569 +- if (rc != -EAGAIN)
2570 ++ if (!is_retryable_error(rc))
2571 + mapping_set_error(mapping, rc);
2572 + }
2573 + kref_put(&wdata->refcount, cifs_writedata_release);
2574 +@@ -2192,6 +2205,15 @@ retry:
2575 + continue;
2576 + }
2577 +
2578 ++ /* Return immediately if we received a signal during writing */
2579 ++ if (is_interrupt_error(rc)) {
2580 ++ done = true;
2581 ++ break;
2582 ++ }
2583 ++
2584 ++ if (rc != 0 && saved_rc == 0)
2585 ++ saved_rc = rc;
2586 ++
2587 + wbc->nr_to_write -= nr_pages;
2588 + if (wbc->nr_to_write <= 0)
2589 + done = true;
2590 +@@ -2209,6 +2231,9 @@ retry:
2591 + goto retry;
2592 + }
2593 +
2594 ++ if (saved_rc != 0)
2595 ++ rc = saved_rc;
2596 ++
2597 + if (wbc->range_cyclic || (range_whole && wbc->nr_to_write > 0))
2598 + mapping->writeback_index = index;
2599 +
2600 +@@ -2241,8 +2266,8 @@ cifs_writepage_locked(struct page *page, struct writeback_control *wbc)
2601 + set_page_writeback(page);
2602 + retry_write:
2603 + rc = cifs_partialpagewrite(page, 0, PAGE_SIZE);
2604 +- if (rc == -EAGAIN) {
2605 +- if (wbc->sync_mode == WB_SYNC_ALL)
2606 ++ if (is_retryable_error(rc)) {
2607 ++ if (wbc->sync_mode == WB_SYNC_ALL && rc == -EAGAIN)
2608 + goto retry_write;
2609 + redirty_page_for_writepage(wbc, page);
2610 + } else if (rc != 0) {
2611 +diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
2612 +index a81a9df997c1..84d51ca91ef7 100644
2613 +--- a/fs/cifs/inode.c
2614 ++++ b/fs/cifs/inode.c
2615 +@@ -2261,6 +2261,11 @@ cifs_setattr_unix(struct dentry *direntry, struct iattr *attrs)
2616 + * the flush returns error?
2617 + */
2618 + rc = filemap_write_and_wait(inode->i_mapping);
2619 ++ if (is_interrupt_error(rc)) {
2620 ++ rc = -ERESTARTSYS;
2621 ++ goto out;
2622 ++ }
2623 ++
2624 + mapping_set_error(inode->i_mapping, rc);
2625 + rc = 0;
2626 +
2627 +@@ -2404,6 +2409,11 @@ cifs_setattr_nounix(struct dentry *direntry, struct iattr *attrs)
2628 + * the flush returns error?
2629 + */
2630 + rc = filemap_write_and_wait(inode->i_mapping);
2631 ++ if (is_interrupt_error(rc)) {
2632 ++ rc = -ERESTARTSYS;
2633 ++ goto cifs_setattr_exit;
2634 ++ }
2635 ++
2636 + mapping_set_error(inode->i_mapping, rc);
2637 + rc = 0;
2638 +
2639 +diff --git a/fs/cifs/smb2file.c b/fs/cifs/smb2file.c
2640 +index 2fc3d31967ee..b204e84b87fb 100644
2641 +--- a/fs/cifs/smb2file.c
2642 ++++ b/fs/cifs/smb2file.c
2643 +@@ -128,6 +128,8 @@ smb2_unlock_range(struct cifsFileInfo *cfile, struct file_lock *flock,
2644 + if (max_buf < sizeof(struct smb2_lock_element))
2645 + return -EINVAL;
2646 +
2647 ++ BUILD_BUG_ON(sizeof(struct smb2_lock_element) > PAGE_SIZE);
2648 ++ max_buf = min_t(unsigned int, max_buf, PAGE_SIZE);
2649 + max_num = max_buf / sizeof(struct smb2_lock_element);
2650 + buf = kcalloc(max_num, sizeof(struct smb2_lock_element), GFP_KERNEL);
2651 + if (!buf)
2652 +@@ -264,6 +266,8 @@ smb2_push_mandatory_locks(struct cifsFileInfo *cfile)
2653 + return -EINVAL;
2654 + }
2655 +
2656 ++ BUILD_BUG_ON(sizeof(struct smb2_lock_element) > PAGE_SIZE);
2657 ++ max_buf = min_t(unsigned int, max_buf, PAGE_SIZE);
2658 + max_num = max_buf / sizeof(struct smb2_lock_element);
2659 + buf = kcalloc(max_num, sizeof(struct smb2_lock_element), GFP_KERNEL);
2660 + if (!buf) {
2661 +diff --git a/fs/cifs/smb2inode.c b/fs/cifs/smb2inode.c
2662 +index a8999f930b22..057d2034209f 100644
2663 +--- a/fs/cifs/smb2inode.c
2664 ++++ b/fs/cifs/smb2inode.c
2665 +@@ -294,6 +294,8 @@ smb2_query_path_info(const unsigned int xid, struct cifs_tcon *tcon,
2666 + int rc;
2667 + struct smb2_file_all_info *smb2_data;
2668 + __u32 create_options = 0;
2669 ++ struct cifs_fid fid;
2670 ++ bool no_cached_open = tcon->nohandlecache;
2671 +
2672 + *adjust_tz = false;
2673 + *symlink = false;
2674 +@@ -302,6 +304,21 @@ smb2_query_path_info(const unsigned int xid, struct cifs_tcon *tcon,
2675 + GFP_KERNEL);
2676 + if (smb2_data == NULL)
2677 + return -ENOMEM;
2678 ++
2679 ++ /* If it is a root and its handle is cached then use it */
2680 ++ if (!strlen(full_path) && !no_cached_open) {
2681 ++ rc = open_shroot(xid, tcon, &fid);
2682 ++ if (rc)
2683 ++ goto out;
2684 ++ rc = SMB2_query_info(xid, tcon, fid.persistent_fid,
2685 ++ fid.volatile_fid, smb2_data);
2686 ++ close_shroot(&tcon->crfid);
2687 ++ if (rc)
2688 ++ goto out;
2689 ++ move_smb2_info_to_cifs(data, smb2_data);
2690 ++ goto out;
2691 ++ }
2692 ++
2693 + if (backup_cred(cifs_sb))
2694 + create_options |= CREATE_OPEN_BACKUP_INTENT;
2695 +
2696 +diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
2697 +index d7dd7d38fad6..aa71e620f3cd 100644
2698 +--- a/fs/cifs/smb2ops.c
2699 ++++ b/fs/cifs/smb2ops.c
2700 +@@ -154,7 +154,11 @@ smb2_get_credits(struct mid_q_entry *mid)
2701 + {
2702 + struct smb2_sync_hdr *shdr = (struct smb2_sync_hdr *)mid->resp_buf;
2703 +
2704 +- return le16_to_cpu(shdr->CreditRequest);
2705 ++ if (mid->mid_state == MID_RESPONSE_RECEIVED
2706 ++ || mid->mid_state == MID_RESPONSE_MALFORMED)
2707 ++ return le16_to_cpu(shdr->CreditRequest);
2708 ++
2709 ++ return 0;
2710 + }
2711 +
2712 + static int
2713 +diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
2714 +index c393ac255af7..28712080add9 100644
2715 +--- a/fs/cifs/smb2pdu.c
2716 ++++ b/fs/cifs/smb2pdu.c
2717 +@@ -2826,9 +2826,10 @@ smb2_echo_callback(struct mid_q_entry *mid)
2718 + {
2719 + struct TCP_Server_Info *server = mid->callback_data;
2720 + struct smb2_echo_rsp *rsp = (struct smb2_echo_rsp *)mid->resp_buf;
2721 +- unsigned int credits_received = 1;
2722 ++ unsigned int credits_received = 0;
2723 +
2724 +- if (mid->mid_state == MID_RESPONSE_RECEIVED)
2725 ++ if (mid->mid_state == MID_RESPONSE_RECEIVED
2726 ++ || mid->mid_state == MID_RESPONSE_MALFORMED)
2727 + credits_received = le16_to_cpu(rsp->sync_hdr.CreditRequest);
2728 +
2729 + DeleteMidQEntry(mid);
2730 +@@ -3085,7 +3086,7 @@ smb2_readv_callback(struct mid_q_entry *mid)
2731 + struct TCP_Server_Info *server = tcon->ses->server;
2732 + struct smb2_sync_hdr *shdr =
2733 + (struct smb2_sync_hdr *)rdata->iov[0].iov_base;
2734 +- unsigned int credits_received = 1;
2735 ++ unsigned int credits_received = 0;
2736 + struct smb_rqst rqst = { .rq_iov = rdata->iov,
2737 + .rq_nvec = 2,
2738 + .rq_pages = rdata->pages,
2739 +@@ -3124,6 +3125,9 @@ smb2_readv_callback(struct mid_q_entry *mid)
2740 + task_io_account_read(rdata->got_bytes);
2741 + cifs_stats_bytes_read(tcon, rdata->got_bytes);
2742 + break;
2743 ++ case MID_RESPONSE_MALFORMED:
2744 ++ credits_received = le16_to_cpu(shdr->CreditRequest);
2745 ++ /* fall through */
2746 + default:
2747 + if (rdata->result != -ENODATA)
2748 + rdata->result = -EIO;
2749 +@@ -3317,7 +3321,7 @@ smb2_writev_callback(struct mid_q_entry *mid)
2750 + struct cifs_tcon *tcon = tlink_tcon(wdata->cfile->tlink);
2751 + unsigned int written;
2752 + struct smb2_write_rsp *rsp = (struct smb2_write_rsp *)mid->resp_buf;
2753 +- unsigned int credits_received = 1;
2754 ++ unsigned int credits_received = 0;
2755 +
2756 + switch (mid->mid_state) {
2757 + case MID_RESPONSE_RECEIVED:
2758 +@@ -3345,6 +3349,9 @@ smb2_writev_callback(struct mid_q_entry *mid)
2759 + case MID_RETRY_NEEDED:
2760 + wdata->result = -EAGAIN;
2761 + break;
2762 ++ case MID_RESPONSE_MALFORMED:
2763 ++ credits_received = le16_to_cpu(rsp->sync_hdr.CreditRequest);
2764 ++ /* fall through */
2765 + default:
2766 + wdata->result = -EIO;
2767 + break;
2768 +diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c
2769 +index d51064c1ba42..6f937e826910 100644
2770 +--- a/fs/cifs/transport.c
2771 ++++ b/fs/cifs/transport.c
2772 +@@ -781,8 +781,25 @@ cifs_setup_request(struct cifs_ses *ses, struct smb_rqst *rqst)
2773 + }
2774 +
2775 + static void
2776 +-cifs_noop_callback(struct mid_q_entry *mid)
2777 ++cifs_compound_callback(struct mid_q_entry *mid)
2778 + {
2779 ++ struct TCP_Server_Info *server = mid->server;
2780 ++
2781 ++ add_credits(server, server->ops->get_credits(mid), mid->optype);
2782 ++}
2783 ++
2784 ++static void
2785 ++cifs_compound_last_callback(struct mid_q_entry *mid)
2786 ++{
2787 ++ cifs_compound_callback(mid);
2788 ++ cifs_wake_up_task(mid);
2789 ++}
2790 ++
2791 ++static void
2792 ++cifs_cancelled_callback(struct mid_q_entry *mid)
2793 ++{
2794 ++ cifs_compound_callback(mid);
2795 ++ DeleteMidQEntry(mid);
2796 + }
2797 +
2798 + int
2799 +@@ -860,12 +877,16 @@ compound_send_recv(const unsigned int xid, struct cifs_ses *ses,
2800 + }
2801 +
2802 + midQ[i]->mid_state = MID_REQUEST_SUBMITTED;
2803 ++ midQ[i]->optype = optype;
2804 + /*
2805 +- * We don't invoke the callback compounds unless it is the last
2806 +- * request.
2807 ++ * Invoke callback for every part of the compound chain
2808 ++ * to calculate credits properly. Wake up this thread only when
2809 ++ * the last element is received.
2810 + */
2811 + if (i < num_rqst - 1)
2812 +- midQ[i]->callback = cifs_noop_callback;
2813 ++ midQ[i]->callback = cifs_compound_callback;
2814 ++ else
2815 ++ midQ[i]->callback = cifs_compound_last_callback;
2816 + }
2817 + cifs_in_send_inc(ses->server);
2818 + rc = smb_send_rqst(ses->server, num_rqst, rqst, flags);
2819 +@@ -879,8 +900,20 @@ compound_send_recv(const unsigned int xid, struct cifs_ses *ses,
2820 +
2821 + mutex_unlock(&ses->server->srv_mutex);
2822 +
2823 +- if (rc < 0)
2824 ++ if (rc < 0) {
2825 ++ /* Sending failed for some reason - return credits back */
2826 ++ for (i = 0; i < num_rqst; i++)
2827 ++ add_credits(ses->server, credits[i], optype);
2828 + goto out;
2829 ++ }
2830 ++
2831 ++ /*
2832 ++ * At this point the request is passed to the network stack - we assume
2833 ++ * that any credits taken from the server structure on the client have
2834 ++ * been spent and we can't return them back. Once we receive responses
2835 ++ * we will collect credits granted by the server in the mid callbacks
2836 ++ * and add those credits to the server structure.
2837 ++ */
2838 +
2839 + /*
2840 + * Compounding is never used during session establish.
2841 +@@ -894,25 +927,25 @@ compound_send_recv(const unsigned int xid, struct cifs_ses *ses,
2842 +
2843 + for (i = 0; i < num_rqst; i++) {
2844 + rc = wait_for_response(ses->server, midQ[i]);
2845 +- if (rc != 0) {
2846 ++ if (rc != 0)
2847 ++ break;
2848 ++ }
2849 ++ if (rc != 0) {
2850 ++ for (; i < num_rqst; i++) {
2851 + cifs_dbg(VFS, "Cancelling wait for mid %llu cmd: %d\n",
2852 + midQ[i]->mid, le16_to_cpu(midQ[i]->command));
2853 + send_cancel(ses->server, &rqst[i], midQ[i]);
2854 + spin_lock(&GlobalMid_Lock);
2855 + if (midQ[i]->mid_state == MID_REQUEST_SUBMITTED) {
2856 + midQ[i]->mid_flags |= MID_WAIT_CANCELLED;
2857 +- midQ[i]->callback = DeleteMidQEntry;
2858 ++ midQ[i]->callback = cifs_cancelled_callback;
2859 + cancelled_mid[i] = true;
2860 ++ credits[i] = 0;
2861 + }
2862 + spin_unlock(&GlobalMid_Lock);
2863 + }
2864 + }
2865 +
2866 +- for (i = 0; i < num_rqst; i++)
2867 +- if (!cancelled_mid[i] && midQ[i]->resp_buf
2868 +- && (midQ[i]->mid_state == MID_RESPONSE_RECEIVED))
2869 +- credits[i] = ses->server->ops->get_credits(midQ[i]);
2870 +-
2871 + for (i = 0; i < num_rqst; i++) {
2872 + if (rc < 0)
2873 + goto out;
2874 +@@ -971,7 +1004,6 @@ out:
2875 + for (i = 0; i < num_rqst; i++) {
2876 + if (!cancelled_mid[i])
2877 + cifs_delete_mid(midQ[i]);
2878 +- add_credits(ses->server, credits[i], optype);
2879 + }
2880 +
2881 + return rc;
2882 +diff --git a/fs/inode.c b/fs/inode.c
2883 +index 35d2108d567c..9e198f00b64c 100644
2884 +--- a/fs/inode.c
2885 ++++ b/fs/inode.c
2886 +@@ -730,11 +730,8 @@ static enum lru_status inode_lru_isolate(struct list_head *item,
2887 + return LRU_REMOVED;
2888 + }
2889 +
2890 +- /*
2891 +- * Recently referenced inodes and inodes with many attached pages
2892 +- * get one more pass.
2893 +- */
2894 +- if (inode->i_state & I_REFERENCED || inode->i_data.nrpages > 1) {
2895 ++ /* recently referenced inodes get one more pass */
2896 ++ if (inode->i_state & I_REFERENCED) {
2897 + inode->i_state &= ~I_REFERENCED;
2898 + spin_unlock(&inode->i_lock);
2899 + return LRU_ROTATE;
2900 +diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
2901 +index b33f9785b756..72a7681f4046 100644
2902 +--- a/fs/nfsd/nfsctl.c
2903 ++++ b/fs/nfsd/nfsctl.c
2904 +@@ -1239,8 +1239,8 @@ static __net_init int nfsd_init_net(struct net *net)
2905 + retval = nfsd_idmap_init(net);
2906 + if (retval)
2907 + goto out_idmap_error;
2908 +- nn->nfsd4_lease = 45; /* default lease time */
2909 +- nn->nfsd4_grace = 45;
2910 ++ nn->nfsd4_lease = 90; /* default lease time */
2911 ++ nn->nfsd4_grace = 90;
2912 + nn->somebody_reclaimed = false;
2913 + nn->clverifier_counter = prandom_u32();
2914 + nn->clientid_counter = prandom_u32();
2915 +diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
2916 +index 47c3764c469b..7bcf5714ca24 100644
2917 +--- a/fs/proc/task_mmu.c
2918 ++++ b/fs/proc/task_mmu.c
2919 +@@ -423,7 +423,7 @@ struct mem_size_stats {
2920 + };
2921 +
2922 + static void smaps_account(struct mem_size_stats *mss, struct page *page,
2923 +- bool compound, bool young, bool dirty)
2924 ++ bool compound, bool young, bool dirty, bool locked)
2925 + {
2926 + int i, nr = compound ? 1 << compound_order(page) : 1;
2927 + unsigned long size = nr * PAGE_SIZE;
2928 +@@ -450,24 +450,31 @@ static void smaps_account(struct mem_size_stats *mss, struct page *page,
2929 + else
2930 + mss->private_clean += size;
2931 + mss->pss += (u64)size << PSS_SHIFT;
2932 ++ if (locked)
2933 ++ mss->pss_locked += (u64)size << PSS_SHIFT;
2934 + return;
2935 + }
2936 +
2937 + for (i = 0; i < nr; i++, page++) {
2938 + int mapcount = page_mapcount(page);
2939 ++ unsigned long pss = (PAGE_SIZE << PSS_SHIFT);
2940 +
2941 + if (mapcount >= 2) {
2942 + if (dirty || PageDirty(page))
2943 + mss->shared_dirty += PAGE_SIZE;
2944 + else
2945 + mss->shared_clean += PAGE_SIZE;
2946 +- mss->pss += (PAGE_SIZE << PSS_SHIFT) / mapcount;
2947 ++ mss->pss += pss / mapcount;
2948 ++ if (locked)
2949 ++ mss->pss_locked += pss / mapcount;
2950 + } else {
2951 + if (dirty || PageDirty(page))
2952 + mss->private_dirty += PAGE_SIZE;
2953 + else
2954 + mss->private_clean += PAGE_SIZE;
2955 +- mss->pss += PAGE_SIZE << PSS_SHIFT;
2956 ++ mss->pss += pss;
2957 ++ if (locked)
2958 ++ mss->pss_locked += pss;
2959 + }
2960 + }
2961 + }
2962 +@@ -490,6 +497,7 @@ static void smaps_pte_entry(pte_t *pte, unsigned long addr,
2963 + {
2964 + struct mem_size_stats *mss = walk->private;
2965 + struct vm_area_struct *vma = walk->vma;
2966 ++ bool locked = !!(vma->vm_flags & VM_LOCKED);
2967 + struct page *page = NULL;
2968 +
2969 + if (pte_present(*pte)) {
2970 +@@ -532,7 +540,7 @@ static void smaps_pte_entry(pte_t *pte, unsigned long addr,
2971 + if (!page)
2972 + return;
2973 +
2974 +- smaps_account(mss, page, false, pte_young(*pte), pte_dirty(*pte));
2975 ++ smaps_account(mss, page, false, pte_young(*pte), pte_dirty(*pte), locked);
2976 + }
2977 +
2978 + #ifdef CONFIG_TRANSPARENT_HUGEPAGE
2979 +@@ -541,6 +549,7 @@ static void smaps_pmd_entry(pmd_t *pmd, unsigned long addr,
2980 + {
2981 + struct mem_size_stats *mss = walk->private;
2982 + struct vm_area_struct *vma = walk->vma;
2983 ++ bool locked = !!(vma->vm_flags & VM_LOCKED);
2984 + struct page *page;
2985 +
2986 + /* FOLL_DUMP will return -EFAULT on huge zero page */
2987 +@@ -555,7 +564,7 @@ static void smaps_pmd_entry(pmd_t *pmd, unsigned long addr,
2988 + /* pass */;
2989 + else
2990 + VM_BUG_ON_PAGE(1, page);
2991 +- smaps_account(mss, page, true, pmd_young(*pmd), pmd_dirty(*pmd));
2992 ++ smaps_account(mss, page, true, pmd_young(*pmd), pmd_dirty(*pmd), locked);
2993 + }
2994 + #else
2995 + static void smaps_pmd_entry(pmd_t *pmd, unsigned long addr,
2996 +@@ -737,11 +746,8 @@ static void smap_gather_stats(struct vm_area_struct *vma,
2997 + }
2998 + }
2999 + #endif
3000 +-
3001 + /* mmap_sem is held in m_start */
3002 + walk_page_vma(vma, &smaps_walk);
3003 +- if (vma->vm_flags & VM_LOCKED)
3004 +- mss->pss_locked += mss->pss;
3005 + }
3006 +
3007 + #define SEQ_PUT_DEC(str, val) \
3008 +diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
3009 +index de7377815b6b..8ef330027b13 100644
3010 +--- a/include/linux/mmc/card.h
3011 ++++ b/include/linux/mmc/card.h
3012 +@@ -308,6 +308,7 @@ struct mmc_card {
3013 + unsigned int nr_parts;
3014 +
3015 + unsigned int bouncesz; /* Bounce buffer size */
3016 ++ struct workqueue_struct *complete_wq; /* Private workqueue */
3017 + };
3018 +
3019 + static inline bool mmc_large_sector(struct mmc_card *card)
3020 +diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
3021 +index 53c500f0ca79..c2876e740514 100644
3022 +--- a/include/linux/perf_event.h
3023 ++++ b/include/linux/perf_event.h
3024 +@@ -447,6 +447,11 @@ struct pmu {
3025 + * Filter events for PMU-specific reasons.
3026 + */
3027 + int (*filter_match) (struct perf_event *event); /* optional */
3028 ++
3029 ++ /*
3030 ++ * Check period value for PERF_EVENT_IOC_PERIOD ioctl.
3031 ++ */
3032 ++ int (*check_period) (struct perf_event *event, u64 value); /* optional */
3033 + };
3034 +
3035 + enum perf_addr_filter_action_t {
3036 +diff --git a/kernel/events/core.c b/kernel/events/core.c
3037 +index 84530ab358c3..699bc25d6204 100644
3038 +--- a/kernel/events/core.c
3039 ++++ b/kernel/events/core.c
3040 +@@ -4963,6 +4963,11 @@ static void __perf_event_period(struct perf_event *event,
3041 + }
3042 + }
3043 +
3044 ++static int perf_event_check_period(struct perf_event *event, u64 value)
3045 ++{
3046 ++ return event->pmu->check_period(event, value);
3047 ++}
3048 ++
3049 + static int perf_event_period(struct perf_event *event, u64 __user *arg)
3050 + {
3051 + u64 value;
3052 +@@ -4979,6 +4984,9 @@ static int perf_event_period(struct perf_event *event, u64 __user *arg)
3053 + if (event->attr.freq && value > sysctl_perf_event_sample_rate)
3054 + return -EINVAL;
3055 +
3056 ++ if (perf_event_check_period(event, value))
3057 ++ return -EINVAL;
3058 ++
3059 + event_function_call(event, __perf_event_period, &value);
3060 +
3061 + return 0;
3062 +@@ -9391,6 +9399,11 @@ static int perf_pmu_nop_int(struct pmu *pmu)
3063 + return 0;
3064 + }
3065 +
3066 ++static int perf_event_nop_int(struct perf_event *event, u64 value)
3067 ++{
3068 ++ return 0;
3069 ++}
3070 ++
3071 + static DEFINE_PER_CPU(unsigned int, nop_txn_flags);
3072 +
3073 + static void perf_pmu_start_txn(struct pmu *pmu, unsigned int flags)
3074 +@@ -9691,6 +9704,9 @@ got_cpu_context:
3075 + pmu->pmu_disable = perf_pmu_nop_void;
3076 + }
3077 +
3078 ++ if (!pmu->check_period)
3079 ++ pmu->check_period = perf_event_nop_int;
3080 ++
3081 + if (!pmu->event_idx)
3082 + pmu->event_idx = perf_event_idx_default;
3083 +
3084 +diff --git a/kernel/events/ring_buffer.c b/kernel/events/ring_buffer.c
3085 +index 309ef5a64af5..5ab4fe3b1dcc 100644
3086 +--- a/kernel/events/ring_buffer.c
3087 ++++ b/kernel/events/ring_buffer.c
3088 +@@ -734,7 +734,7 @@ struct ring_buffer *rb_alloc(int nr_pages, long watermark, int cpu, int flags)
3089 + size = sizeof(struct ring_buffer);
3090 + size += nr_pages * sizeof(void *);
3091 +
3092 +- if (order_base_2(size) >= MAX_ORDER)
3093 ++ if (order_base_2(size) >= PAGE_SHIFT+MAX_ORDER)
3094 + goto fail;
3095 +
3096 + rb = kzalloc(size, GFP_KERNEL);
3097 +diff --git a/kernel/signal.c b/kernel/signal.c
3098 +index cf4cf68c3ea8..ac969af3e9a0 100644
3099 +--- a/kernel/signal.c
3100 ++++ b/kernel/signal.c
3101 +@@ -2436,9 +2436,12 @@ relock:
3102 + }
3103 +
3104 + /* Has this task already been marked for death? */
3105 +- ksig->info.si_signo = signr = SIGKILL;
3106 +- if (signal_group_exit(signal))
3107 ++ if (signal_group_exit(signal)) {
3108 ++ ksig->info.si_signo = signr = SIGKILL;
3109 ++ sigdelset(&current->pending.signal, SIGKILL);
3110 ++ recalc_sigpending();
3111 + goto fatal;
3112 ++ }
3113 +
3114 + for (;;) {
3115 + struct k_sigaction *ka;
3116 +diff --git a/kernel/trace/trace_probe_tmpl.h b/kernel/trace/trace_probe_tmpl.h
3117 +index 5c56afc17cf8..4737bb8c07a3 100644
3118 +--- a/kernel/trace/trace_probe_tmpl.h
3119 ++++ b/kernel/trace/trace_probe_tmpl.h
3120 +@@ -180,10 +180,12 @@ store_trace_args(void *data, struct trace_probe *tp, struct pt_regs *regs,
3121 + if (unlikely(arg->dynamic))
3122 + *dl = make_data_loc(maxlen, dyndata - base);
3123 + ret = process_fetch_insn(arg->code, regs, dl, base);
3124 +- if (unlikely(ret < 0 && arg->dynamic))
3125 ++ if (unlikely(ret < 0 && arg->dynamic)) {
3126 + *dl = make_data_loc(0, dyndata - base);
3127 +- else
3128 ++ } else {
3129 + dyndata += ret;
3130 ++ maxlen -= ret;
3131 ++ }
3132 + }
3133 + }
3134 +
3135 +diff --git a/mm/vmscan.c b/mm/vmscan.c
3136 +index 62ac0c488624..8e377bbac3a6 100644
3137 +--- a/mm/vmscan.c
3138 ++++ b/mm/vmscan.c
3139 +@@ -487,16 +487,6 @@ static unsigned long do_shrink_slab(struct shrink_control *shrinkctl,
3140 + delta = freeable / 2;
3141 + }
3142 +
3143 +- /*
3144 +- * Make sure we apply some minimal pressure on default priority
3145 +- * even on small cgroups. Stale objects are not only consuming memory
3146 +- * by themselves, but can also hold a reference to a dying cgroup,
3147 +- * preventing it from being reclaimed. A dying cgroup with all
3148 +- * corresponding structures like per-cpu stats and kmem caches
3149 +- * can be really big, so it may lead to a significant waste of memory.
3150 +- */
3151 +- delta = max_t(unsigned long long, delta, min(freeable, batch_size));
3152 +-
3153 + total_scan += delta;
3154 + if (total_scan < 0) {
3155 + pr_err("shrink_slab: %pF negative objects to delete nr=%ld\n",
3156 +diff --git a/net/sunrpc/auth_gss/gss_krb5_seqnum.c b/net/sunrpc/auth_gss/gss_krb5_seqnum.c
3157 +index fb6656295204..507105127095 100644
3158 +--- a/net/sunrpc/auth_gss/gss_krb5_seqnum.c
3159 ++++ b/net/sunrpc/auth_gss/gss_krb5_seqnum.c
3160 +@@ -44,7 +44,7 @@ krb5_make_rc4_seq_num(struct krb5_ctx *kctx, int direction, s32 seqnum,
3161 + unsigned char *cksum, unsigned char *buf)
3162 + {
3163 + struct crypto_sync_skcipher *cipher;
3164 +- unsigned char plain[8];
3165 ++ unsigned char *plain;
3166 + s32 code;
3167 +
3168 + dprintk("RPC: %s:\n", __func__);
3169 +@@ -52,6 +52,10 @@ krb5_make_rc4_seq_num(struct krb5_ctx *kctx, int direction, s32 seqnum,
3170 + if (IS_ERR(cipher))
3171 + return PTR_ERR(cipher);
3172 +
3173 ++ plain = kmalloc(8, GFP_NOFS);
3174 ++ if (!plain)
3175 ++ return -ENOMEM;
3176 ++
3177 + plain[0] = (unsigned char) ((seqnum >> 24) & 0xff);
3178 + plain[1] = (unsigned char) ((seqnum >> 16) & 0xff);
3179 + plain[2] = (unsigned char) ((seqnum >> 8) & 0xff);
3180 +@@ -67,6 +71,7 @@ krb5_make_rc4_seq_num(struct krb5_ctx *kctx, int direction, s32 seqnum,
3181 +
3182 + code = krb5_encrypt(cipher, cksum, plain, buf, 8);
3183 + out:
3184 ++ kfree(plain);
3185 + crypto_free_sync_skcipher(cipher);
3186 + return code;
3187 + }
3188 +@@ -77,12 +82,17 @@ krb5_make_seq_num(struct krb5_ctx *kctx,
3189 + u32 seqnum,
3190 + unsigned char *cksum, unsigned char *buf)
3191 + {
3192 +- unsigned char plain[8];
3193 ++ unsigned char *plain;
3194 ++ s32 code;
3195 +
3196 + if (kctx->enctype == ENCTYPE_ARCFOUR_HMAC)
3197 + return krb5_make_rc4_seq_num(kctx, direction, seqnum,
3198 + cksum, buf);
3199 +
3200 ++ plain = kmalloc(8, GFP_NOFS);
3201 ++ if (!plain)
3202 ++ return -ENOMEM;
3203 ++
3204 + plain[0] = (unsigned char) (seqnum & 0xff);
3205 + plain[1] = (unsigned char) ((seqnum >> 8) & 0xff);
3206 + plain[2] = (unsigned char) ((seqnum >> 16) & 0xff);
3207 +@@ -93,7 +103,9 @@ krb5_make_seq_num(struct krb5_ctx *kctx,
3208 + plain[6] = direction;
3209 + plain[7] = direction;
3210 +
3211 +- return krb5_encrypt(key, cksum, plain, buf, 8);
3212 ++ code = krb5_encrypt(key, cksum, plain, buf, 8);
3213 ++ kfree(plain);
3214 ++ return code;
3215 + }
3216 +
3217 + static s32
3218 +@@ -101,7 +113,7 @@ krb5_get_rc4_seq_num(struct krb5_ctx *kctx, unsigned char *cksum,
3219 + unsigned char *buf, int *direction, s32 *seqnum)
3220 + {
3221 + struct crypto_sync_skcipher *cipher;
3222 +- unsigned char plain[8];
3223 ++ unsigned char *plain;
3224 + s32 code;
3225 +
3226 + dprintk("RPC: %s:\n", __func__);
3227 +@@ -113,20 +125,28 @@ krb5_get_rc4_seq_num(struct krb5_ctx *kctx, unsigned char *cksum,
3228 + if (code)
3229 + goto out;
3230 +
3231 ++ plain = kmalloc(8, GFP_NOFS);
3232 ++ if (!plain) {
3233 ++ code = -ENOMEM;
3234 ++ goto out;
3235 ++ }
3236 ++
3237 + code = krb5_decrypt(cipher, cksum, buf, plain, 8);
3238 + if (code)
3239 +- goto out;
3240 ++ goto out_plain;
3241 +
3242 + if ((plain[4] != plain[5]) || (plain[4] != plain[6])
3243 + || (plain[4] != plain[7])) {
3244 + code = (s32)KG_BAD_SEQ;
3245 +- goto out;
3246 ++ goto out_plain;
3247 + }
3248 +
3249 + *direction = plain[4];
3250 +
3251 + *seqnum = ((plain[0] << 24) | (plain[1] << 16) |
3252 + (plain[2] << 8) | (plain[3]));
3253 ++out_plain:
3254 ++ kfree(plain);
3255 + out:
3256 + crypto_free_sync_skcipher(cipher);
3257 + return code;
3258 +@@ -139,7 +159,7 @@ krb5_get_seq_num(struct krb5_ctx *kctx,
3259 + int *direction, u32 *seqnum)
3260 + {
3261 + s32 code;
3262 +- unsigned char plain[8];
3263 ++ unsigned char *plain;
3264 + struct crypto_sync_skcipher *key = kctx->seq;
3265 +
3266 + dprintk("RPC: krb5_get_seq_num:\n");
3267 +@@ -147,18 +167,25 @@ krb5_get_seq_num(struct krb5_ctx *kctx,
3268 + if (kctx->enctype == ENCTYPE_ARCFOUR_HMAC)
3269 + return krb5_get_rc4_seq_num(kctx, cksum, buf,
3270 + direction, seqnum);
3271 ++ plain = kmalloc(8, GFP_NOFS);
3272 ++ if (!plain)
3273 ++ return -ENOMEM;
3274 +
3275 + if ((code = krb5_decrypt(key, cksum, buf, plain, 8)))
3276 +- return code;
3277 ++ goto out;
3278 +
3279 + if ((plain[4] != plain[5]) || (plain[4] != plain[6]) ||
3280 +- (plain[4] != plain[7]))
3281 +- return (s32)KG_BAD_SEQ;
3282 ++ (plain[4] != plain[7])) {
3283 ++ code = (s32)KG_BAD_SEQ;
3284 ++ goto out;
3285 ++ }
3286 +
3287 + *direction = plain[4];
3288 +
3289 + *seqnum = ((plain[0]) |
3290 + (plain[1] << 8) | (plain[2] << 16) | (plain[3] << 24));
3291 +
3292 +- return 0;
3293 ++out:
3294 ++ kfree(plain);
3295 ++ return code;
3296 + }
3297 +diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c
3298 +index 6c99fa8ac5fa..6c0b30391ba9 100644
3299 +--- a/sound/core/pcm_lib.c
3300 ++++ b/sound/core/pcm_lib.c
3301 +@@ -2112,13 +2112,6 @@ int pcm_lib_apply_appl_ptr(struct snd_pcm_substream *substream,
3302 + return 0;
3303 + }
3304 +
3305 +-/* allow waiting for a capture stream that hasn't been started */
3306 +-#if IS_ENABLED(CONFIG_SND_PCM_OSS)
3307 +-#define wait_capture_start(substream) ((substream)->oss.oss)
3308 +-#else
3309 +-#define wait_capture_start(substream) false
3310 +-#endif
3311 +-
3312 + /* the common loop for read/write data */
3313 + snd_pcm_sframes_t __snd_pcm_lib_xfer(struct snd_pcm_substream *substream,
3314 + void *data, bool interleaved,
3315 +@@ -2184,16 +2177,11 @@ snd_pcm_sframes_t __snd_pcm_lib_xfer(struct snd_pcm_substream *substream,
3316 + snd_pcm_update_hw_ptr(substream);
3317 +
3318 + if (!is_playback &&
3319 +- runtime->status->state == SNDRV_PCM_STATE_PREPARED) {
3320 +- if (size >= runtime->start_threshold) {
3321 +- err = snd_pcm_start(substream);
3322 +- if (err < 0)
3323 +- goto _end_unlock;
3324 +- } else if (!wait_capture_start(substream)) {
3325 +- /* nothing to do */
3326 +- err = 0;
3327 ++ runtime->status->state == SNDRV_PCM_STATE_PREPARED &&
3328 ++ size >= runtime->start_threshold) {
3329 ++ err = snd_pcm_start(substream);
3330 ++ if (err < 0)
3331 + goto _end_unlock;
3332 +- }
3333 + }
3334 +
3335 + avail = snd_pcm_avail(substream);
3336 +diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
3337 +index 152f54137082..a4ee7656d9ee 100644
3338 +--- a/sound/pci/hda/patch_conexant.c
3339 ++++ b/sound/pci/hda/patch_conexant.c
3340 +@@ -924,6 +924,7 @@ static const struct snd_pci_quirk cxt5066_fixups[] = {
3341 + SND_PCI_QUIRK(0x103c, 0x807C, "HP EliteBook 820 G3", CXT_FIXUP_HP_DOCK),
3342 + SND_PCI_QUIRK(0x103c, 0x80FD, "HP ProBook 640 G2", CXT_FIXUP_HP_DOCK),
3343 + SND_PCI_QUIRK(0x103c, 0x828c, "HP EliteBook 840 G4", CXT_FIXUP_HP_DOCK),
3344 ++ SND_PCI_QUIRK(0x103c, 0x83b2, "HP EliteBook 840 G5", CXT_FIXUP_HP_DOCK),
3345 + SND_PCI_QUIRK(0x103c, 0x83b3, "HP EliteBook 830 G5", CXT_FIXUP_HP_DOCK),
3346 + SND_PCI_QUIRK(0x103c, 0x83d3, "HP ProBook 640 G4", CXT_FIXUP_HP_DOCK),
3347 + SND_PCI_QUIRK(0x103c, 0x8174, "HP Spectre x360", CXT_FIXUP_HP_SPECTRE),
3348 +diff --git a/sound/soc/codecs/hdmi-codec.c b/sound/soc/codecs/hdmi-codec.c
3349 +index d00734d31e04..e5b6769b9797 100644
3350 +--- a/sound/soc/codecs/hdmi-codec.c
3351 ++++ b/sound/soc/codecs/hdmi-codec.c
3352 +@@ -795,6 +795,8 @@ static int hdmi_codec_probe(struct platform_device *pdev)
3353 + if (hcd->spdif)
3354 + hcp->daidrv[i] = hdmi_spdif_dai;
3355 +
3356 ++ dev_set_drvdata(dev, hcp);
3357 ++
3358 + ret = devm_snd_soc_register_component(dev, &hdmi_driver, hcp->daidrv,
3359 + dai_count);
3360 + if (ret) {
3361 +@@ -802,8 +804,6 @@ static int hdmi_codec_probe(struct platform_device *pdev)
3362 + __func__, ret);
3363 + return ret;
3364 + }
3365 +-
3366 +- dev_set_drvdata(dev, hcp);
3367 + return 0;
3368 + }
3369 +
3370 +diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c
3371 +index 382847154227..db114f3977e0 100644
3372 +--- a/sound/usb/pcm.c
3373 ++++ b/sound/usb/pcm.c
3374 +@@ -314,6 +314,9 @@ static int search_roland_implicit_fb(struct usb_device *dev, int ifnum,
3375 + return 0;
3376 + }
3377 +
3378 ++/* Setup an implicit feedback endpoint from a quirk. Returns 0 if no quirk
3379 ++ * applies. Returns 1 if a quirk was found.
3380 ++ */
3381 + static int set_sync_ep_implicit_fb_quirk(struct snd_usb_substream *subs,
3382 + struct usb_device *dev,
3383 + struct usb_interface_descriptor *altsd,
3384 +@@ -384,7 +387,7 @@ add_sync_ep:
3385 +
3386 + subs->data_endpoint->sync_master = subs->sync_endpoint;
3387 +
3388 +- return 0;
3389 ++ return 1;
3390 + }
3391 +
3392 + static int set_sync_endpoint(struct snd_usb_substream *subs,
3393 +@@ -423,6 +426,10 @@ static int set_sync_endpoint(struct snd_usb_substream *subs,
3394 + if (err < 0)
3395 + return err;
3396 +
3397 ++ /* endpoint set by quirk */
3398 ++ if (err > 0)
3399 ++ return 0;
3400 ++
3401 + if (altsd->bNumEndpoints < 2)
3402 + return 0;
3403 +
3404 +diff --git a/tools/arch/riscv/include/uapi/asm/bitsperlong.h b/tools/arch/riscv/include/uapi/asm/bitsperlong.h
3405 +new file mode 100644
3406 +index 000000000000..0b3cb52fd29d
3407 +--- /dev/null
3408 ++++ b/tools/arch/riscv/include/uapi/asm/bitsperlong.h
3409 +@@ -0,0 +1,25 @@
3410 ++/*
3411 ++ * Copyright (C) 2012 ARM Ltd.
3412 ++ * Copyright (C) 2015 Regents of the University of California
3413 ++ *
3414 ++ * This program is free software; you can redistribute it and/or modify
3415 ++ * it under the terms of the GNU General Public License version 2 as
3416 ++ * published by the Free Software Foundation.
3417 ++ *
3418 ++ * This program is distributed in the hope that it will be useful,
3419 ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
3420 ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3421 ++ * GNU General Public License for more details.
3422 ++ *
3423 ++ * You should have received a copy of the GNU General Public License
3424 ++ * along with this program. If not, see <http://www.gnu.org/licenses/>.
3425 ++ */
3426 ++
3427 ++#ifndef _UAPI_ASM_RISCV_BITSPERLONG_H
3428 ++#define _UAPI_ASM_RISCV_BITSPERLONG_H
3429 ++
3430 ++#define __BITS_PER_LONG (__SIZEOF_POINTER__ * 8)
3431 ++
3432 ++#include <asm-generic/bitsperlong.h>
3433 ++
3434 ++#endif /* _UAPI_ASM_RISCV_BITSPERLONG_H */
3435 +diff --git a/tools/include/uapi/asm/bitsperlong.h b/tools/include/uapi/asm/bitsperlong.h
3436 +index 8dd6aefdafa4..57aaeaf8e192 100644
3437 +--- a/tools/include/uapi/asm/bitsperlong.h
3438 ++++ b/tools/include/uapi/asm/bitsperlong.h
3439 +@@ -13,6 +13,10 @@
3440 + #include "../../arch/mips/include/uapi/asm/bitsperlong.h"
3441 + #elif defined(__ia64__)
3442 + #include "../../arch/ia64/include/uapi/asm/bitsperlong.h"
3443 ++#elif defined(__riscv)
3444 ++#include "../../arch/riscv/include/uapi/asm/bitsperlong.h"
3445 ++#elif defined(__alpha__)
3446 ++#include "../../arch/alpha/include/uapi/asm/bitsperlong.h"
3447 + #else
3448 + #include <asm-generic/bitsperlong.h>
3449 + #endif
3450 +diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
3451 +index 1410d66192f7..63a3afc7f32b 100644
3452 +--- a/tools/perf/builtin-stat.c
3453 ++++ b/tools/perf/builtin-stat.c
3454 +@@ -561,7 +561,8 @@ try_again:
3455 + break;
3456 + }
3457 + }
3458 +- wait4(child_pid, &status, 0, &stat_config.ru_data);
3459 ++ if (child_pid != -1)
3460 ++ wait4(child_pid, &status, 0, &stat_config.ru_data);
3461 +
3462 + if (workload_exec_errno) {
3463 + const char *emsg = str_error_r(workload_exec_errno, msg, sizeof(msg));
3464 +diff --git a/tools/perf/tests/shell/lib/probe_vfs_getname.sh b/tools/perf/tests/shell/lib/probe_vfs_getname.sh
3465 +index 1c16e56cd93e..7cb99b433888 100644
3466 +--- a/tools/perf/tests/shell/lib/probe_vfs_getname.sh
3467 ++++ b/tools/perf/tests/shell/lib/probe_vfs_getname.sh
3468 +@@ -13,7 +13,8 @@ add_probe_vfs_getname() {
3469 + local verbose=$1
3470 + if [ $had_vfs_getname -eq 1 ] ; then
3471 + line=$(perf probe -L getname_flags 2>&1 | egrep 'result.*=.*filename;' | sed -r 's/[[:space:]]+([[:digit:]]+)[[:space:]]+result->uptr.*/\1/')
3472 +- perf probe $verbose "vfs_getname=getname_flags:${line} pathname=result->name:string"
3473 ++ perf probe -q "vfs_getname=getname_flags:${line} pathname=result->name:string" || \
3474 ++ perf probe $verbose "vfs_getname=getname_flags:${line} pathname=filename:string"
3475 + fi
3476 + }
3477 +
3478 +diff --git a/tools/perf/util/callchain.c b/tools/perf/util/callchain.c
3479 +index 32ef7bdca1cf..dc2212e12184 100644
3480 +--- a/tools/perf/util/callchain.c
3481 ++++ b/tools/perf/util/callchain.c
3482 +@@ -766,6 +766,7 @@ static enum match_result match_chain(struct callchain_cursor_node *node,
3483 + cnode->cycles_count += node->branch_flags.cycles;
3484 + cnode->iter_count += node->nr_loop_iter;
3485 + cnode->iter_cycles += node->iter_cycles;
3486 ++ cnode->from_count++;
3487 + }
3488 + }
3489 +
3490 +@@ -1345,10 +1346,10 @@ static int branch_to_str(char *bf, int bfsize,
3491 + static int branch_from_str(char *bf, int bfsize,
3492 + u64 branch_count,
3493 + u64 cycles_count, u64 iter_count,
3494 +- u64 iter_cycles)
3495 ++ u64 iter_cycles, u64 from_count)
3496 + {
3497 + int printed = 0, i = 0;
3498 +- u64 cycles;
3499 ++ u64 cycles, v = 0;
3500 +
3501 + cycles = cycles_count / branch_count;
3502 + if (cycles) {
3503 +@@ -1357,14 +1358,16 @@ static int branch_from_str(char *bf, int bfsize,
3504 + bf + printed, bfsize - printed);
3505 + }
3506 +
3507 +- if (iter_count) {
3508 +- printed += count_pri64_printf(i++, "iter",
3509 +- iter_count,
3510 +- bf + printed, bfsize - printed);
3511 ++ if (iter_count && from_count) {
3512 ++ v = iter_count / from_count;
3513 ++ if (v) {
3514 ++ printed += count_pri64_printf(i++, "iter",
3515 ++ v, bf + printed, bfsize - printed);
3516 +
3517 +- printed += count_pri64_printf(i++, "avg_cycles",
3518 +- iter_cycles / iter_count,
3519 +- bf + printed, bfsize - printed);
3520 ++ printed += count_pri64_printf(i++, "avg_cycles",
3521 ++ iter_cycles / iter_count,
3522 ++ bf + printed, bfsize - printed);
3523 ++ }
3524 + }
3525 +
3526 + if (i)
3527 +@@ -1377,6 +1380,7 @@ static int counts_str_build(char *bf, int bfsize,
3528 + u64 branch_count, u64 predicted_count,
3529 + u64 abort_count, u64 cycles_count,
3530 + u64 iter_count, u64 iter_cycles,
3531 ++ u64 from_count,
3532 + struct branch_type_stat *brtype_stat)
3533 + {
3534 + int printed;
3535 +@@ -1389,7 +1393,8 @@ static int counts_str_build(char *bf, int bfsize,
3536 + predicted_count, abort_count, brtype_stat);
3537 + } else {
3538 + printed = branch_from_str(bf, bfsize, branch_count,
3539 +- cycles_count, iter_count, iter_cycles);
3540 ++ cycles_count, iter_count, iter_cycles,
3541 ++ from_count);
3542 + }
3543 +
3544 + if (!printed)
3545 +@@ -1402,13 +1407,14 @@ static int callchain_counts_printf(FILE *fp, char *bf, int bfsize,
3546 + u64 branch_count, u64 predicted_count,
3547 + u64 abort_count, u64 cycles_count,
3548 + u64 iter_count, u64 iter_cycles,
3549 ++ u64 from_count,
3550 + struct branch_type_stat *brtype_stat)
3551 + {
3552 + char str[256];
3553 +
3554 + counts_str_build(str, sizeof(str), branch_count,
3555 + predicted_count, abort_count, cycles_count,
3556 +- iter_count, iter_cycles, brtype_stat);
3557 ++ iter_count, iter_cycles, from_count, brtype_stat);
3558 +
3559 + if (fp)
3560 + return fprintf(fp, "%s", str);
3561 +@@ -1422,6 +1428,7 @@ int callchain_list_counts__printf_value(struct callchain_list *clist,
3562 + u64 branch_count, predicted_count;
3563 + u64 abort_count, cycles_count;
3564 + u64 iter_count, iter_cycles;
3565 ++ u64 from_count;
3566 +
3567 + branch_count = clist->branch_count;
3568 + predicted_count = clist->predicted_count;
3569 +@@ -1429,11 +1436,12 @@ int callchain_list_counts__printf_value(struct callchain_list *clist,
3570 + cycles_count = clist->cycles_count;
3571 + iter_count = clist->iter_count;
3572 + iter_cycles = clist->iter_cycles;
3573 ++ from_count = clist->from_count;
3574 +
3575 + return callchain_counts_printf(fp, bf, bfsize, branch_count,
3576 + predicted_count, abort_count,
3577 + cycles_count, iter_count, iter_cycles,
3578 +- &clist->brtype_stat);
3579 ++ from_count, &clist->brtype_stat);
3580 + }
3581 +
3582 + static void free_callchain_node(struct callchain_node *node)
3583 +diff --git a/tools/perf/util/callchain.h b/tools/perf/util/callchain.h
3584 +index 154560b1eb65..99d38ac019b8 100644
3585 +--- a/tools/perf/util/callchain.h
3586 ++++ b/tools/perf/util/callchain.h
3587 +@@ -118,6 +118,7 @@ struct callchain_list {
3588 + bool has_children;
3589 + };
3590 + u64 branch_count;
3591 ++ u64 from_count;
3592 + u64 predicted_count;
3593 + u64 abort_count;
3594 + u64 cycles_count;
3595 +diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
3596 +index 9397e3f2444d..ea228dd0a187 100644
3597 +--- a/tools/perf/util/machine.c
3598 ++++ b/tools/perf/util/machine.c
3599 +@@ -2005,7 +2005,7 @@ static void save_iterations(struct iterations *iter,
3600 + {
3601 + int i;
3602 +
3603 +- iter->nr_loop_iter = nr;
3604 ++ iter->nr_loop_iter++;
3605 + iter->cycles = 0;
3606 +
3607 + for (i = 0; i < nr; i++)