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