1 |
commit: 9357e267eea9e76458572750473116becb53c079 |
2 |
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Feb 20 11:18:41 2019 +0000 |
4 |
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Feb 20 11:18:41 2019 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=9357e267 |
7 |
|
8 |
proj/linux-patches: Linux patch 4.19.24 |
9 |
|
10 |
Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org> |
11 |
|
12 |
0000_README | 4 + |
13 |
1023_linux-4.19.24.patch | 3179 ++++++++++++++++++++++++++++++++++++++++++++++ |
14 |
2 files changed, 3183 insertions(+) |
15 |
|
16 |
diff --git a/0000_README b/0000_README |
17 |
index bec430b..62f98e4 100644 |
18 |
--- a/0000_README |
19 |
+++ b/0000_README |
20 |
@@ -135,6 +135,10 @@ Patch: 1022_linux-4.19.23.patch |
21 |
From: http://www.kernel.org |
22 |
Desc: Linux 4.19.23 |
23 |
|
24 |
+Patch: 1023_linux-4.19.24.patch |
25 |
+From: http://www.kernel.org |
26 |
+Desc: Linux 4.19.24 |
27 |
+ |
28 |
Patch: 1500_XATTR_USER_PREFIX.patch |
29 |
From: https://bugs.gentoo.org/show_bug.cgi?id=470644 |
30 |
Desc: Support for namespace user.pax.* on tmpfs. |
31 |
|
32 |
diff --git a/1023_linux-4.19.24.patch b/1023_linux-4.19.24.patch |
33 |
new file mode 100644 |
34 |
index 0000000..9580fbc |
35 |
--- /dev/null |
36 |
+++ b/1023_linux-4.19.24.patch |
37 |
@@ -0,0 +1,3179 @@ |
38 |
+diff --git a/Documentation/devicetree/bindings/eeprom/at24.txt b/Documentation/devicetree/bindings/eeprom/at24.txt |
39 |
+index aededdbc262b..f9a7c984274c 100644 |
40 |
+--- a/Documentation/devicetree/bindings/eeprom/at24.txt |
41 |
++++ b/Documentation/devicetree/bindings/eeprom/at24.txt |
42 |
+@@ -27,6 +27,7 @@ Required properties: |
43 |
+ "atmel,24c256", |
44 |
+ "atmel,24c512", |
45 |
+ "atmel,24c1024", |
46 |
++ "atmel,24c2048", |
47 |
+ |
48 |
+ If <manufacturer> is not "atmel", then a fallback must be used |
49 |
+ with the same <model> and "atmel" as manufacturer. |
50 |
+diff --git a/Makefile b/Makefile |
51 |
+index 3dcf3f2363c1..370ad0d34076 100644 |
52 |
+--- a/Makefile |
53 |
++++ b/Makefile |
54 |
+@@ -1,7 +1,7 @@ |
55 |
+ # SPDX-License-Identifier: GPL-2.0 |
56 |
+ VERSION = 4 |
57 |
+ PATCHLEVEL = 19 |
58 |
+-SUBLEVEL = 23 |
59 |
++SUBLEVEL = 24 |
60 |
+ EXTRAVERSION = |
61 |
+ NAME = "People's Front" |
62 |
+ |
63 |
+diff --git a/arch/alpha/include/asm/irq.h b/arch/alpha/include/asm/irq.h |
64 |
+index 4d17cacd1462..432402c8e47f 100644 |
65 |
+--- a/arch/alpha/include/asm/irq.h |
66 |
++++ b/arch/alpha/include/asm/irq.h |
67 |
+@@ -56,15 +56,15 @@ |
68 |
+ |
69 |
+ #elif defined(CONFIG_ALPHA_DP264) || \ |
70 |
+ defined(CONFIG_ALPHA_LYNX) || \ |
71 |
+- defined(CONFIG_ALPHA_SHARK) || \ |
72 |
+- defined(CONFIG_ALPHA_EIGER) |
73 |
++ defined(CONFIG_ALPHA_SHARK) |
74 |
+ # define NR_IRQS 64 |
75 |
+ |
76 |
+ #elif defined(CONFIG_ALPHA_TITAN) |
77 |
+ #define NR_IRQS 80 |
78 |
+ |
79 |
+ #elif defined(CONFIG_ALPHA_RAWHIDE) || \ |
80 |
+- defined(CONFIG_ALPHA_TAKARA) |
81 |
++ defined(CONFIG_ALPHA_TAKARA) || \ |
82 |
++ defined(CONFIG_ALPHA_EIGER) |
83 |
+ # define NR_IRQS 128 |
84 |
+ |
85 |
+ #elif defined(CONFIG_ALPHA_WILDFIRE) |
86 |
+diff --git a/arch/alpha/mm/fault.c b/arch/alpha/mm/fault.c |
87 |
+index d73dc473fbb9..188fc9256baf 100644 |
88 |
+--- a/arch/alpha/mm/fault.c |
89 |
++++ b/arch/alpha/mm/fault.c |
90 |
+@@ -78,7 +78,7 @@ __load_new_mm_context(struct mm_struct *next_mm) |
91 |
+ /* Macro for exception fixup code to access integer registers. */ |
92 |
+ #define dpf_reg(r) \ |
93 |
+ (((unsigned long *)regs)[(r) <= 8 ? (r) : (r) <= 15 ? (r)-16 : \ |
94 |
+- (r) <= 18 ? (r)+8 : (r)-10]) |
95 |
++ (r) <= 18 ? (r)+10 : (r)-10]) |
96 |
+ |
97 |
+ asmlinkage void |
98 |
+ do_page_fault(unsigned long address, unsigned long mmcsr, |
99 |
+diff --git a/arch/arm/boot/dts/da850-evm.dts b/arch/arm/boot/dts/da850-evm.dts |
100 |
+index f9b757905845..016616cc036c 100644 |
101 |
+--- a/arch/arm/boot/dts/da850-evm.dts |
102 |
++++ b/arch/arm/boot/dts/da850-evm.dts |
103 |
+@@ -94,6 +94,28 @@ |
104 |
+ regulator-boot-on; |
105 |
+ }; |
106 |
+ |
107 |
++ baseboard_3v3: fixedregulator-3v3 { |
108 |
++ /* TPS73701DCQ */ |
109 |
++ compatible = "regulator-fixed"; |
110 |
++ regulator-name = "baseboard_3v3"; |
111 |
++ regulator-min-microvolt = <3300000>; |
112 |
++ regulator-max-microvolt = <3300000>; |
113 |
++ vin-supply = <&vbat>; |
114 |
++ regulator-always-on; |
115 |
++ regulator-boot-on; |
116 |
++ }; |
117 |
++ |
118 |
++ baseboard_1v8: fixedregulator-1v8 { |
119 |
++ /* TPS73701DCQ */ |
120 |
++ compatible = "regulator-fixed"; |
121 |
++ regulator-name = "baseboard_1v8"; |
122 |
++ regulator-min-microvolt = <1800000>; |
123 |
++ regulator-max-microvolt = <1800000>; |
124 |
++ vin-supply = <&vbat>; |
125 |
++ regulator-always-on; |
126 |
++ regulator-boot-on; |
127 |
++ }; |
128 |
++ |
129 |
+ backlight_lcd: backlight-regulator { |
130 |
+ compatible = "regulator-fixed"; |
131 |
+ regulator-name = "lcd_backlight_pwr"; |
132 |
+@@ -105,7 +127,7 @@ |
133 |
+ |
134 |
+ sound { |
135 |
+ compatible = "simple-audio-card"; |
136 |
+- simple-audio-card,name = "DA850/OMAP-L138 EVM"; |
137 |
++ simple-audio-card,name = "DA850-OMAPL138 EVM"; |
138 |
+ simple-audio-card,widgets = |
139 |
+ "Line", "Line In", |
140 |
+ "Line", "Line Out"; |
141 |
+@@ -210,10 +232,9 @@ |
142 |
+ |
143 |
+ /* Regulators */ |
144 |
+ IOVDD-supply = <&vdcdc2_reg>; |
145 |
+- /* Derived from VBAT: Baseboard 3.3V / 1.8V */ |
146 |
+- AVDD-supply = <&vbat>; |
147 |
+- DRVDD-supply = <&vbat>; |
148 |
+- DVDD-supply = <&vbat>; |
149 |
++ AVDD-supply = <&baseboard_3v3>; |
150 |
++ DRVDD-supply = <&baseboard_3v3>; |
151 |
++ DVDD-supply = <&baseboard_1v8>; |
152 |
+ }; |
153 |
+ tca6416: gpio@20 { |
154 |
+ compatible = "ti,tca6416"; |
155 |
+diff --git a/arch/arm/boot/dts/da850-lcdk.dts b/arch/arm/boot/dts/da850-lcdk.dts |
156 |
+index 0177e3ed20fe..3a2fa6e035a3 100644 |
157 |
+--- a/arch/arm/boot/dts/da850-lcdk.dts |
158 |
++++ b/arch/arm/boot/dts/da850-lcdk.dts |
159 |
+@@ -39,9 +39,39 @@ |
160 |
+ }; |
161 |
+ }; |
162 |
+ |
163 |
++ vcc_5vd: fixedregulator-vcc_5vd { |
164 |
++ compatible = "regulator-fixed"; |
165 |
++ regulator-name = "vcc_5vd"; |
166 |
++ regulator-min-microvolt = <5000000>; |
167 |
++ regulator-max-microvolt = <5000000>; |
168 |
++ regulator-boot-on; |
169 |
++ }; |
170 |
++ |
171 |
++ vcc_3v3d: fixedregulator-vcc_3v3d { |
172 |
++ /* TPS650250 - VDCDC1 */ |
173 |
++ compatible = "regulator-fixed"; |
174 |
++ regulator-name = "vcc_3v3d"; |
175 |
++ regulator-min-microvolt = <3300000>; |
176 |
++ regulator-max-microvolt = <3300000>; |
177 |
++ vin-supply = <&vcc_5vd>; |
178 |
++ regulator-always-on; |
179 |
++ regulator-boot-on; |
180 |
++ }; |
181 |
++ |
182 |
++ vcc_1v8d: fixedregulator-vcc_1v8d { |
183 |
++ /* TPS650250 - VDCDC2 */ |
184 |
++ compatible = "regulator-fixed"; |
185 |
++ regulator-name = "vcc_1v8d"; |
186 |
++ regulator-min-microvolt = <1800000>; |
187 |
++ regulator-max-microvolt = <1800000>; |
188 |
++ vin-supply = <&vcc_5vd>; |
189 |
++ regulator-always-on; |
190 |
++ regulator-boot-on; |
191 |
++ }; |
192 |
++ |
193 |
+ sound { |
194 |
+ compatible = "simple-audio-card"; |
195 |
+- simple-audio-card,name = "DA850/OMAP-L138 LCDK"; |
196 |
++ simple-audio-card,name = "DA850-OMAPL138 LCDK"; |
197 |
+ simple-audio-card,widgets = |
198 |
+ "Line", "Line In", |
199 |
+ "Line", "Line Out"; |
200 |
+@@ -221,6 +251,12 @@ |
201 |
+ compatible = "ti,tlv320aic3106"; |
202 |
+ reg = <0x18>; |
203 |
+ status = "okay"; |
204 |
++ |
205 |
++ /* Regulators */ |
206 |
++ IOVDD-supply = <&vcc_3v3d>; |
207 |
++ AVDD-supply = <&vcc_3v3d>; |
208 |
++ DRVDD-supply = <&vcc_3v3d>; |
209 |
++ DVDD-supply = <&vcc_1v8d>; |
210 |
+ }; |
211 |
+ }; |
212 |
+ |
213 |
+diff --git a/arch/arm/boot/dts/kirkwood-dnskw.dtsi b/arch/arm/boot/dts/kirkwood-dnskw.dtsi |
214 |
+index cbaf06f2f78e..eb917462b219 100644 |
215 |
+--- a/arch/arm/boot/dts/kirkwood-dnskw.dtsi |
216 |
++++ b/arch/arm/boot/dts/kirkwood-dnskw.dtsi |
217 |
+@@ -36,8 +36,8 @@ |
218 |
+ compatible = "gpio-fan"; |
219 |
+ pinctrl-0 = <&pmx_fan_high_speed &pmx_fan_low_speed>; |
220 |
+ pinctrl-names = "default"; |
221 |
+- gpios = <&gpio1 14 GPIO_ACTIVE_LOW |
222 |
+- &gpio1 13 GPIO_ACTIVE_LOW>; |
223 |
++ gpios = <&gpio1 14 GPIO_ACTIVE_HIGH |
224 |
++ &gpio1 13 GPIO_ACTIVE_HIGH>; |
225 |
+ gpio-fan,speed-map = <0 0 |
226 |
+ 3000 1 |
227 |
+ 6000 2>; |
228 |
+diff --git a/arch/arm/boot/dts/omap5-board-common.dtsi b/arch/arm/boot/dts/omap5-board-common.dtsi |
229 |
+index ab6f640b282b..8b8db9d8e912 100644 |
230 |
+--- a/arch/arm/boot/dts/omap5-board-common.dtsi |
231 |
++++ b/arch/arm/boot/dts/omap5-board-common.dtsi |
232 |
+@@ -317,7 +317,8 @@ |
233 |
+ |
234 |
+ palmas_sys_nirq_pins: pinmux_palmas_sys_nirq_pins { |
235 |
+ pinctrl-single,pins = < |
236 |
+- OMAP5_IOPAD(0x068, PIN_INPUT_PULLUP | MUX_MODE0) /* sys_nirq1 */ |
237 |
++ /* sys_nirq1 is pulled down as the SoC is inverting it for GIC */ |
238 |
++ OMAP5_IOPAD(0x068, PIN_INPUT_PULLUP | MUX_MODE0) |
239 |
+ >; |
240 |
+ }; |
241 |
+ |
242 |
+@@ -385,7 +386,8 @@ |
243 |
+ |
244 |
+ palmas: palmas@48 { |
245 |
+ compatible = "ti,palmas"; |
246 |
+- interrupts = <GIC_SPI 7 IRQ_TYPE_NONE>; /* IRQ_SYS_1N */ |
247 |
++ /* sys_nirq/ext_sys_irq pins get inverted at mpuss wakeupgen */ |
248 |
++ interrupts = <GIC_SPI 7 IRQ_TYPE_LEVEL_LOW>; |
249 |
+ reg = <0x48>; |
250 |
+ interrupt-controller; |
251 |
+ #interrupt-cells = <2>; |
252 |
+@@ -651,7 +653,8 @@ |
253 |
+ pinctrl-names = "default"; |
254 |
+ pinctrl-0 = <&twl6040_pins>; |
255 |
+ |
256 |
+- interrupts = <GIC_SPI 119 IRQ_TYPE_NONE>; /* IRQ_SYS_2N cascaded to gic */ |
257 |
++ /* sys_nirq/ext_sys_irq pins get inverted at mpuss wakeupgen */ |
258 |
++ interrupts = <GIC_SPI 119 IRQ_TYPE_LEVEL_LOW>; |
259 |
+ |
260 |
+ /* audpwron gpio defined in the board specific dts */ |
261 |
+ |
262 |
+diff --git a/arch/arm/boot/dts/omap5-cm-t54.dts b/arch/arm/boot/dts/omap5-cm-t54.dts |
263 |
+index 5e21fb430a65..e78d3718f145 100644 |
264 |
+--- a/arch/arm/boot/dts/omap5-cm-t54.dts |
265 |
++++ b/arch/arm/boot/dts/omap5-cm-t54.dts |
266 |
+@@ -181,6 +181,13 @@ |
267 |
+ OMAP5_IOPAD(0x0042, PIN_INPUT_PULLDOWN | MUX_MODE6) /* llib_wakereqin.gpio1_wk15 */ |
268 |
+ >; |
269 |
+ }; |
270 |
++ |
271 |
++ palmas_sys_nirq_pins: pinmux_palmas_sys_nirq_pins { |
272 |
++ pinctrl-single,pins = < |
273 |
++ /* sys_nirq1 is pulled down as the SoC is inverting it for GIC */ |
274 |
++ OMAP5_IOPAD(0x068, PIN_INPUT_PULLUP | MUX_MODE0) |
275 |
++ >; |
276 |
++ }; |
277 |
+ }; |
278 |
+ |
279 |
+ &omap5_pmx_core { |
280 |
+@@ -414,8 +421,11 @@ |
281 |
+ |
282 |
+ palmas: palmas@48 { |
283 |
+ compatible = "ti,palmas"; |
284 |
+- interrupts = <GIC_SPI 7 IRQ_TYPE_NONE>; /* IRQ_SYS_1N */ |
285 |
+ reg = <0x48>; |
286 |
++ pinctrl-0 = <&palmas_sys_nirq_pins>; |
287 |
++ pinctrl-names = "default"; |
288 |
++ /* sys_nirq/ext_sys_irq pins get inverted at mpuss wakeupgen */ |
289 |
++ interrupts = <GIC_SPI 7 IRQ_TYPE_LEVEL_LOW>; |
290 |
+ interrupt-controller; |
291 |
+ #interrupt-cells = <2>; |
292 |
+ ti,system-power-controller; |
293 |
+diff --git a/arch/arm/include/asm/assembler.h b/arch/arm/include/asm/assembler.h |
294 |
+index b17ee03d280b..88286dd483ff 100644 |
295 |
+--- a/arch/arm/include/asm/assembler.h |
296 |
++++ b/arch/arm/include/asm/assembler.h |
297 |
+@@ -467,6 +467,17 @@ THUMB( orr \reg , \reg , #PSR_T_BIT ) |
298 |
+ #endif |
299 |
+ .endm |
300 |
+ |
301 |
++ .macro uaccess_mask_range_ptr, addr:req, size:req, limit:req, tmp:req |
302 |
++#ifdef CONFIG_CPU_SPECTRE |
303 |
++ sub \tmp, \limit, #1 |
304 |
++ subs \tmp, \tmp, \addr @ tmp = limit - 1 - addr |
305 |
++ addhs \tmp, \tmp, #1 @ if (tmp >= 0) { |
306 |
++ subhss \tmp, \tmp, \size @ tmp = limit - (addr + size) } |
307 |
++ movlo \addr, #0 @ if (tmp < 0) addr = NULL |
308 |
++ csdb |
309 |
++#endif |
310 |
++ .endm |
311 |
++ |
312 |
+ .macro uaccess_disable, tmp, isb=1 |
313 |
+ #ifdef CONFIG_CPU_SW_DOMAIN_PAN |
314 |
+ /* |
315 |
+diff --git a/arch/arm/include/asm/cputype.h b/arch/arm/include/asm/cputype.h |
316 |
+index 0d289240b6ca..775cac3c02bb 100644 |
317 |
+--- a/arch/arm/include/asm/cputype.h |
318 |
++++ b/arch/arm/include/asm/cputype.h |
319 |
+@@ -111,6 +111,7 @@ |
320 |
+ #include <linux/kernel.h> |
321 |
+ |
322 |
+ extern unsigned int processor_id; |
323 |
++struct proc_info_list *lookup_processor(u32 midr); |
324 |
+ |
325 |
+ #ifdef CONFIG_CPU_CP15 |
326 |
+ #define read_cpuid(reg) \ |
327 |
+diff --git a/arch/arm/include/asm/proc-fns.h b/arch/arm/include/asm/proc-fns.h |
328 |
+index e25f4392e1b2..e1b6f280ab08 100644 |
329 |
+--- a/arch/arm/include/asm/proc-fns.h |
330 |
++++ b/arch/arm/include/asm/proc-fns.h |
331 |
+@@ -23,7 +23,7 @@ struct mm_struct; |
332 |
+ /* |
333 |
+ * Don't change this structure - ASM code relies on it. |
334 |
+ */ |
335 |
+-extern struct processor { |
336 |
++struct processor { |
337 |
+ /* MISC |
338 |
+ * get data abort address/flags |
339 |
+ */ |
340 |
+@@ -79,9 +79,13 @@ extern struct processor { |
341 |
+ unsigned int suspend_size; |
342 |
+ void (*do_suspend)(void *); |
343 |
+ void (*do_resume)(void *); |
344 |
+-} processor; |
345 |
++}; |
346 |
+ |
347 |
+ #ifndef MULTI_CPU |
348 |
++static inline void init_proc_vtable(const struct processor *p) |
349 |
++{ |
350 |
++} |
351 |
++ |
352 |
+ extern void cpu_proc_init(void); |
353 |
+ extern void cpu_proc_fin(void); |
354 |
+ extern int cpu_do_idle(void); |
355 |
+@@ -98,17 +102,50 @@ extern void cpu_reset(unsigned long addr, bool hvc) __attribute__((noreturn)); |
356 |
+ extern void cpu_do_suspend(void *); |
357 |
+ extern void cpu_do_resume(void *); |
358 |
+ #else |
359 |
+-#define cpu_proc_init processor._proc_init |
360 |
+-#define cpu_proc_fin processor._proc_fin |
361 |
+-#define cpu_reset processor.reset |
362 |
+-#define cpu_do_idle processor._do_idle |
363 |
+-#define cpu_dcache_clean_area processor.dcache_clean_area |
364 |
+-#define cpu_set_pte_ext processor.set_pte_ext |
365 |
+-#define cpu_do_switch_mm processor.switch_mm |
366 |
+ |
367 |
+-/* These three are private to arch/arm/kernel/suspend.c */ |
368 |
+-#define cpu_do_suspend processor.do_suspend |
369 |
+-#define cpu_do_resume processor.do_resume |
370 |
++extern struct processor processor; |
371 |
++#if defined(CONFIG_BIG_LITTLE) && defined(CONFIG_HARDEN_BRANCH_PREDICTOR) |
372 |
++#include <linux/smp.h> |
373 |
++/* |
374 |
++ * This can't be a per-cpu variable because we need to access it before |
375 |
++ * per-cpu has been initialised. We have a couple of functions that are |
376 |
++ * called in a pre-emptible context, and so can't use smp_processor_id() |
377 |
++ * there, hence PROC_TABLE(). We insist in init_proc_vtable() that the |
378 |
++ * function pointers for these are identical across all CPUs. |
379 |
++ */ |
380 |
++extern struct processor *cpu_vtable[]; |
381 |
++#define PROC_VTABLE(f) cpu_vtable[smp_processor_id()]->f |
382 |
++#define PROC_TABLE(f) cpu_vtable[0]->f |
383 |
++static inline void init_proc_vtable(const struct processor *p) |
384 |
++{ |
385 |
++ unsigned int cpu = smp_processor_id(); |
386 |
++ *cpu_vtable[cpu] = *p; |
387 |
++ WARN_ON_ONCE(cpu_vtable[cpu]->dcache_clean_area != |
388 |
++ cpu_vtable[0]->dcache_clean_area); |
389 |
++ WARN_ON_ONCE(cpu_vtable[cpu]->set_pte_ext != |
390 |
++ cpu_vtable[0]->set_pte_ext); |
391 |
++} |
392 |
++#else |
393 |
++#define PROC_VTABLE(f) processor.f |
394 |
++#define PROC_TABLE(f) processor.f |
395 |
++static inline void init_proc_vtable(const struct processor *p) |
396 |
++{ |
397 |
++ processor = *p; |
398 |
++} |
399 |
++#endif |
400 |
++ |
401 |
++#define cpu_proc_init PROC_VTABLE(_proc_init) |
402 |
++#define cpu_check_bugs PROC_VTABLE(check_bugs) |
403 |
++#define cpu_proc_fin PROC_VTABLE(_proc_fin) |
404 |
++#define cpu_reset PROC_VTABLE(reset) |
405 |
++#define cpu_do_idle PROC_VTABLE(_do_idle) |
406 |
++#define cpu_dcache_clean_area PROC_TABLE(dcache_clean_area) |
407 |
++#define cpu_set_pte_ext PROC_TABLE(set_pte_ext) |
408 |
++#define cpu_do_switch_mm PROC_VTABLE(switch_mm) |
409 |
++ |
410 |
++/* These two are private to arch/arm/kernel/suspend.c */ |
411 |
++#define cpu_do_suspend PROC_VTABLE(do_suspend) |
412 |
++#define cpu_do_resume PROC_VTABLE(do_resume) |
413 |
+ #endif |
414 |
+ |
415 |
+ extern void cpu_resume(void); |
416 |
+diff --git a/arch/arm/include/asm/thread_info.h b/arch/arm/include/asm/thread_info.h |
417 |
+index 9b37b6ab27fe..8f55dc520a3e 100644 |
418 |
+--- a/arch/arm/include/asm/thread_info.h |
419 |
++++ b/arch/arm/include/asm/thread_info.h |
420 |
+@@ -121,8 +121,8 @@ extern void vfp_flush_hwstate(struct thread_info *); |
421 |
+ struct user_vfp; |
422 |
+ struct user_vfp_exc; |
423 |
+ |
424 |
+-extern int vfp_preserve_user_clear_hwstate(struct user_vfp __user *, |
425 |
+- struct user_vfp_exc __user *); |
426 |
++extern int vfp_preserve_user_clear_hwstate(struct user_vfp *, |
427 |
++ struct user_vfp_exc *); |
428 |
+ extern int vfp_restore_user_hwstate(struct user_vfp *, |
429 |
+ struct user_vfp_exc *); |
430 |
+ #endif |
431 |
+diff --git a/arch/arm/include/asm/uaccess.h b/arch/arm/include/asm/uaccess.h |
432 |
+index 5451e1f05a19..c136eef8f690 100644 |
433 |
+--- a/arch/arm/include/asm/uaccess.h |
434 |
++++ b/arch/arm/include/asm/uaccess.h |
435 |
+@@ -69,6 +69,14 @@ extern int __put_user_bad(void); |
436 |
+ static inline void set_fs(mm_segment_t fs) |
437 |
+ { |
438 |
+ current_thread_info()->addr_limit = fs; |
439 |
++ |
440 |
++ /* |
441 |
++ * Prevent a mispredicted conditional call to set_fs from forwarding |
442 |
++ * the wrong address limit to access_ok under speculation. |
443 |
++ */ |
444 |
++ dsb(nsh); |
445 |
++ isb(); |
446 |
++ |
447 |
+ modify_domain(DOMAIN_KERNEL, fs ? DOMAIN_CLIENT : DOMAIN_MANAGER); |
448 |
+ } |
449 |
+ |
450 |
+@@ -91,6 +99,32 @@ static inline void set_fs(mm_segment_t fs) |
451 |
+ #define __inttype(x) \ |
452 |
+ __typeof__(__builtin_choose_expr(sizeof(x) > sizeof(0UL), 0ULL, 0UL)) |
453 |
+ |
454 |
++/* |
455 |
++ * Sanitise a uaccess pointer such that it becomes NULL if addr+size |
456 |
++ * is above the current addr_limit. |
457 |
++ */ |
458 |
++#define uaccess_mask_range_ptr(ptr, size) \ |
459 |
++ ((__typeof__(ptr))__uaccess_mask_range_ptr(ptr, size)) |
460 |
++static inline void __user *__uaccess_mask_range_ptr(const void __user *ptr, |
461 |
++ size_t size) |
462 |
++{ |
463 |
++ void __user *safe_ptr = (void __user *)ptr; |
464 |
++ unsigned long tmp; |
465 |
++ |
466 |
++ asm volatile( |
467 |
++ " sub %1, %3, #1\n" |
468 |
++ " subs %1, %1, %0\n" |
469 |
++ " addhs %1, %1, #1\n" |
470 |
++ " subhss %1, %1, %2\n" |
471 |
++ " movlo %0, #0\n" |
472 |
++ : "+r" (safe_ptr), "=&r" (tmp) |
473 |
++ : "r" (size), "r" (current_thread_info()->addr_limit) |
474 |
++ : "cc"); |
475 |
++ |
476 |
++ csdb(); |
477 |
++ return safe_ptr; |
478 |
++} |
479 |
++ |
480 |
+ /* |
481 |
+ * Single-value transfer routines. They automatically use the right |
482 |
+ * size if we just have the right pointer type. Note that the functions |
483 |
+@@ -362,6 +396,14 @@ do { \ |
484 |
+ __pu_err; \ |
485 |
+ }) |
486 |
+ |
487 |
++#ifdef CONFIG_CPU_SPECTRE |
488 |
++/* |
489 |
++ * When mitigating Spectre variant 1.1, all accessors need to include |
490 |
++ * verification of the address space. |
491 |
++ */ |
492 |
++#define __put_user(x, ptr) put_user(x, ptr) |
493 |
++ |
494 |
++#else |
495 |
+ #define __put_user(x, ptr) \ |
496 |
+ ({ \ |
497 |
+ long __pu_err = 0; \ |
498 |
+@@ -369,12 +411,6 @@ do { \ |
499 |
+ __pu_err; \ |
500 |
+ }) |
501 |
+ |
502 |
+-#define __put_user_error(x, ptr, err) \ |
503 |
+-({ \ |
504 |
+- __put_user_switch((x), (ptr), (err), __put_user_nocheck); \ |
505 |
+- (void) 0; \ |
506 |
+-}) |
507 |
+- |
508 |
+ #define __put_user_nocheck(x, __pu_ptr, __err, __size) \ |
509 |
+ do { \ |
510 |
+ unsigned long __pu_addr = (unsigned long)__pu_ptr; \ |
511 |
+@@ -454,6 +490,7 @@ do { \ |
512 |
+ : "r" (x), "i" (-EFAULT) \ |
513 |
+ : "cc") |
514 |
+ |
515 |
++#endif /* !CONFIG_CPU_SPECTRE */ |
516 |
+ |
517 |
+ #ifdef CONFIG_MMU |
518 |
+ extern unsigned long __must_check |
519 |
+diff --git a/arch/arm/kernel/bugs.c b/arch/arm/kernel/bugs.c |
520 |
+index 7be511310191..d41d3598e5e5 100644 |
521 |
+--- a/arch/arm/kernel/bugs.c |
522 |
++++ b/arch/arm/kernel/bugs.c |
523 |
+@@ -6,8 +6,8 @@ |
524 |
+ void check_other_bugs(void) |
525 |
+ { |
526 |
+ #ifdef MULTI_CPU |
527 |
+- if (processor.check_bugs) |
528 |
+- processor.check_bugs(); |
529 |
++ if (cpu_check_bugs) |
530 |
++ cpu_check_bugs(); |
531 |
+ #endif |
532 |
+ } |
533 |
+ |
534 |
+diff --git a/arch/arm/kernel/head-common.S b/arch/arm/kernel/head-common.S |
535 |
+index 6e0375e7db05..997b02302c31 100644 |
536 |
+--- a/arch/arm/kernel/head-common.S |
537 |
++++ b/arch/arm/kernel/head-common.S |
538 |
+@@ -145,6 +145,9 @@ __mmap_switched_data: |
539 |
+ #endif |
540 |
+ .size __mmap_switched_data, . - __mmap_switched_data |
541 |
+ |
542 |
++ __FINIT |
543 |
++ .text |
544 |
++ |
545 |
+ /* |
546 |
+ * This provides a C-API version of __lookup_processor_type |
547 |
+ */ |
548 |
+@@ -156,9 +159,6 @@ ENTRY(lookup_processor_type) |
549 |
+ ldmfd sp!, {r4 - r6, r9, pc} |
550 |
+ ENDPROC(lookup_processor_type) |
551 |
+ |
552 |
+- __FINIT |
553 |
+- .text |
554 |
+- |
555 |
+ /* |
556 |
+ * Read processor ID register (CP#15, CR0), and look up in the linker-built |
557 |
+ * supported processor list. Note that we can't use the absolute addresses |
558 |
+diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c |
559 |
+index 4c249cb261f3..7bbaa293a38c 100644 |
560 |
+--- a/arch/arm/kernel/setup.c |
561 |
++++ b/arch/arm/kernel/setup.c |
562 |
+@@ -115,6 +115,11 @@ EXPORT_SYMBOL(elf_hwcap2); |
563 |
+ |
564 |
+ #ifdef MULTI_CPU |
565 |
+ struct processor processor __ro_after_init; |
566 |
++#if defined(CONFIG_BIG_LITTLE) && defined(CONFIG_HARDEN_BRANCH_PREDICTOR) |
567 |
++struct processor *cpu_vtable[NR_CPUS] = { |
568 |
++ [0] = &processor, |
569 |
++}; |
570 |
++#endif |
571 |
+ #endif |
572 |
+ #ifdef MULTI_TLB |
573 |
+ struct cpu_tlb_fns cpu_tlb __ro_after_init; |
574 |
+@@ -667,28 +672,33 @@ static void __init smp_build_mpidr_hash(void) |
575 |
+ } |
576 |
+ #endif |
577 |
+ |
578 |
+-static void __init setup_processor(void) |
579 |
++/* |
580 |
++ * locate processor in the list of supported processor types. The linker |
581 |
++ * builds this table for us from the entries in arch/arm/mm/proc-*.S |
582 |
++ */ |
583 |
++struct proc_info_list *lookup_processor(u32 midr) |
584 |
+ { |
585 |
+- struct proc_info_list *list; |
586 |
++ struct proc_info_list *list = lookup_processor_type(midr); |
587 |
+ |
588 |
+- /* |
589 |
+- * locate processor in the list of supported processor |
590 |
+- * types. The linker builds this table for us from the |
591 |
+- * entries in arch/arm/mm/proc-*.S |
592 |
+- */ |
593 |
+- list = lookup_processor_type(read_cpuid_id()); |
594 |
+ if (!list) { |
595 |
+- pr_err("CPU configuration botched (ID %08x), unable to continue.\n", |
596 |
+- read_cpuid_id()); |
597 |
+- while (1); |
598 |
++ pr_err("CPU%u: configuration botched (ID %08x), CPU halted\n", |
599 |
++ smp_processor_id(), midr); |
600 |
++ while (1) |
601 |
++ /* can't use cpu_relax() here as it may require MMU setup */; |
602 |
+ } |
603 |
+ |
604 |
++ return list; |
605 |
++} |
606 |
++ |
607 |
++static void __init setup_processor(void) |
608 |
++{ |
609 |
++ unsigned int midr = read_cpuid_id(); |
610 |
++ struct proc_info_list *list = lookup_processor(midr); |
611 |
++ |
612 |
+ cpu_name = list->cpu_name; |
613 |
+ __cpu_architecture = __get_cpu_architecture(); |
614 |
+ |
615 |
+-#ifdef MULTI_CPU |
616 |
+- processor = *list->proc; |
617 |
+-#endif |
618 |
++ init_proc_vtable(list->proc); |
619 |
+ #ifdef MULTI_TLB |
620 |
+ cpu_tlb = *list->tlb; |
621 |
+ #endif |
622 |
+@@ -700,7 +710,7 @@ static void __init setup_processor(void) |
623 |
+ #endif |
624 |
+ |
625 |
+ pr_info("CPU: %s [%08x] revision %d (ARMv%s), cr=%08lx\n", |
626 |
+- cpu_name, read_cpuid_id(), read_cpuid_id() & 15, |
627 |
++ list->cpu_name, midr, midr & 15, |
628 |
+ proc_arch[cpu_architecture()], get_cr()); |
629 |
+ |
630 |
+ snprintf(init_utsname()->machine, __NEW_UTS_LEN + 1, "%s%c", |
631 |
+diff --git a/arch/arm/kernel/signal.c b/arch/arm/kernel/signal.c |
632 |
+index b8f766cf3a90..b908382b69ff 100644 |
633 |
+--- a/arch/arm/kernel/signal.c |
634 |
++++ b/arch/arm/kernel/signal.c |
635 |
+@@ -77,8 +77,6 @@ static int preserve_iwmmxt_context(struct iwmmxt_sigframe __user *frame) |
636 |
+ kframe->magic = IWMMXT_MAGIC; |
637 |
+ kframe->size = IWMMXT_STORAGE_SIZE; |
638 |
+ iwmmxt_task_copy(current_thread_info(), &kframe->storage); |
639 |
+- |
640 |
+- err = __copy_to_user(frame, kframe, sizeof(*frame)); |
641 |
+ } else { |
642 |
+ /* |
643 |
+ * For bug-compatibility with older kernels, some space |
644 |
+@@ -86,10 +84,14 @@ static int preserve_iwmmxt_context(struct iwmmxt_sigframe __user *frame) |
645 |
+ * Set the magic and size appropriately so that properly |
646 |
+ * written userspace can skip it reliably: |
647 |
+ */ |
648 |
+- __put_user_error(DUMMY_MAGIC, &frame->magic, err); |
649 |
+- __put_user_error(IWMMXT_STORAGE_SIZE, &frame->size, err); |
650 |
++ *kframe = (struct iwmmxt_sigframe) { |
651 |
++ .magic = DUMMY_MAGIC, |
652 |
++ .size = IWMMXT_STORAGE_SIZE, |
653 |
++ }; |
654 |
+ } |
655 |
+ |
656 |
++ err = __copy_to_user(frame, kframe, sizeof(*kframe)); |
657 |
++ |
658 |
+ return err; |
659 |
+ } |
660 |
+ |
661 |
+@@ -135,17 +137,18 @@ static int restore_iwmmxt_context(char __user **auxp) |
662 |
+ |
663 |
+ static int preserve_vfp_context(struct vfp_sigframe __user *frame) |
664 |
+ { |
665 |
+- const unsigned long magic = VFP_MAGIC; |
666 |
+- const unsigned long size = VFP_STORAGE_SIZE; |
667 |
++ struct vfp_sigframe kframe; |
668 |
+ int err = 0; |
669 |
+ |
670 |
+- __put_user_error(magic, &frame->magic, err); |
671 |
+- __put_user_error(size, &frame->size, err); |
672 |
++ memset(&kframe, 0, sizeof(kframe)); |
673 |
++ kframe.magic = VFP_MAGIC; |
674 |
++ kframe.size = VFP_STORAGE_SIZE; |
675 |
+ |
676 |
++ err = vfp_preserve_user_clear_hwstate(&kframe.ufp, &kframe.ufp_exc); |
677 |
+ if (err) |
678 |
+- return -EFAULT; |
679 |
++ return err; |
680 |
+ |
681 |
+- return vfp_preserve_user_clear_hwstate(&frame->ufp, &frame->ufp_exc); |
682 |
++ return __copy_to_user(frame, &kframe, sizeof(kframe)); |
683 |
+ } |
684 |
+ |
685 |
+ static int restore_vfp_context(char __user **auxp) |
686 |
+@@ -288,30 +291,35 @@ static int |
687 |
+ setup_sigframe(struct sigframe __user *sf, struct pt_regs *regs, sigset_t *set) |
688 |
+ { |
689 |
+ struct aux_sigframe __user *aux; |
690 |
++ struct sigcontext context; |
691 |
+ int err = 0; |
692 |
+ |
693 |
+- __put_user_error(regs->ARM_r0, &sf->uc.uc_mcontext.arm_r0, err); |
694 |
+- __put_user_error(regs->ARM_r1, &sf->uc.uc_mcontext.arm_r1, err); |
695 |
+- __put_user_error(regs->ARM_r2, &sf->uc.uc_mcontext.arm_r2, err); |
696 |
+- __put_user_error(regs->ARM_r3, &sf->uc.uc_mcontext.arm_r3, err); |
697 |
+- __put_user_error(regs->ARM_r4, &sf->uc.uc_mcontext.arm_r4, err); |
698 |
+- __put_user_error(regs->ARM_r5, &sf->uc.uc_mcontext.arm_r5, err); |
699 |
+- __put_user_error(regs->ARM_r6, &sf->uc.uc_mcontext.arm_r6, err); |
700 |
+- __put_user_error(regs->ARM_r7, &sf->uc.uc_mcontext.arm_r7, err); |
701 |
+- __put_user_error(regs->ARM_r8, &sf->uc.uc_mcontext.arm_r8, err); |
702 |
+- __put_user_error(regs->ARM_r9, &sf->uc.uc_mcontext.arm_r9, err); |
703 |
+- __put_user_error(regs->ARM_r10, &sf->uc.uc_mcontext.arm_r10, err); |
704 |
+- __put_user_error(regs->ARM_fp, &sf->uc.uc_mcontext.arm_fp, err); |
705 |
+- __put_user_error(regs->ARM_ip, &sf->uc.uc_mcontext.arm_ip, err); |
706 |
+- __put_user_error(regs->ARM_sp, &sf->uc.uc_mcontext.arm_sp, err); |
707 |
+- __put_user_error(regs->ARM_lr, &sf->uc.uc_mcontext.arm_lr, err); |
708 |
+- __put_user_error(regs->ARM_pc, &sf->uc.uc_mcontext.arm_pc, err); |
709 |
+- __put_user_error(regs->ARM_cpsr, &sf->uc.uc_mcontext.arm_cpsr, err); |
710 |
+- |
711 |
+- __put_user_error(current->thread.trap_no, &sf->uc.uc_mcontext.trap_no, err); |
712 |
+- __put_user_error(current->thread.error_code, &sf->uc.uc_mcontext.error_code, err); |
713 |
+- __put_user_error(current->thread.address, &sf->uc.uc_mcontext.fault_address, err); |
714 |
+- __put_user_error(set->sig[0], &sf->uc.uc_mcontext.oldmask, err); |
715 |
++ context = (struct sigcontext) { |
716 |
++ .arm_r0 = regs->ARM_r0, |
717 |
++ .arm_r1 = regs->ARM_r1, |
718 |
++ .arm_r2 = regs->ARM_r2, |
719 |
++ .arm_r3 = regs->ARM_r3, |
720 |
++ .arm_r4 = regs->ARM_r4, |
721 |
++ .arm_r5 = regs->ARM_r5, |
722 |
++ .arm_r6 = regs->ARM_r6, |
723 |
++ .arm_r7 = regs->ARM_r7, |
724 |
++ .arm_r8 = regs->ARM_r8, |
725 |
++ .arm_r9 = regs->ARM_r9, |
726 |
++ .arm_r10 = regs->ARM_r10, |
727 |
++ .arm_fp = regs->ARM_fp, |
728 |
++ .arm_ip = regs->ARM_ip, |
729 |
++ .arm_sp = regs->ARM_sp, |
730 |
++ .arm_lr = regs->ARM_lr, |
731 |
++ .arm_pc = regs->ARM_pc, |
732 |
++ .arm_cpsr = regs->ARM_cpsr, |
733 |
++ |
734 |
++ .trap_no = current->thread.trap_no, |
735 |
++ .error_code = current->thread.error_code, |
736 |
++ .fault_address = current->thread.address, |
737 |
++ .oldmask = set->sig[0], |
738 |
++ }; |
739 |
++ |
740 |
++ err |= __copy_to_user(&sf->uc.uc_mcontext, &context, sizeof(context)); |
741 |
+ |
742 |
+ err |= __copy_to_user(&sf->uc.uc_sigmask, set, sizeof(*set)); |
743 |
+ |
744 |
+@@ -328,7 +336,7 @@ setup_sigframe(struct sigframe __user *sf, struct pt_regs *regs, sigset_t *set) |
745 |
+ if (err == 0) |
746 |
+ err |= preserve_vfp_context(&aux->vfp); |
747 |
+ #endif |
748 |
+- __put_user_error(0, &aux->end_magic, err); |
749 |
++ err |= __put_user(0, &aux->end_magic); |
750 |
+ |
751 |
+ return err; |
752 |
+ } |
753 |
+@@ -491,7 +499,7 @@ setup_frame(struct ksignal *ksig, sigset_t *set, struct pt_regs *regs) |
754 |
+ /* |
755 |
+ * Set uc.uc_flags to a value which sc.trap_no would never have. |
756 |
+ */ |
757 |
+- __put_user_error(0x5ac3c35a, &frame->uc.uc_flags, err); |
758 |
++ err = __put_user(0x5ac3c35a, &frame->uc.uc_flags); |
759 |
+ |
760 |
+ err |= setup_sigframe(frame, regs, set); |
761 |
+ if (err == 0) |
762 |
+@@ -511,8 +519,8 @@ setup_rt_frame(struct ksignal *ksig, sigset_t *set, struct pt_regs *regs) |
763 |
+ |
764 |
+ err |= copy_siginfo_to_user(&frame->info, &ksig->info); |
765 |
+ |
766 |
+- __put_user_error(0, &frame->sig.uc.uc_flags, err); |
767 |
+- __put_user_error(NULL, &frame->sig.uc.uc_link, err); |
768 |
++ err |= __put_user(0, &frame->sig.uc.uc_flags); |
769 |
++ err |= __put_user(NULL, &frame->sig.uc.uc_link); |
770 |
+ |
771 |
+ err |= __save_altstack(&frame->sig.uc.uc_stack, regs->ARM_sp); |
772 |
+ err |= setup_sigframe(&frame->sig, regs, set); |
773 |
+diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c |
774 |
+index f574a5e0d589..3bf82232b1be 100644 |
775 |
+--- a/arch/arm/kernel/smp.c |
776 |
++++ b/arch/arm/kernel/smp.c |
777 |
+@@ -42,6 +42,7 @@ |
778 |
+ #include <asm/mmu_context.h> |
779 |
+ #include <asm/pgtable.h> |
780 |
+ #include <asm/pgalloc.h> |
781 |
++#include <asm/procinfo.h> |
782 |
+ #include <asm/processor.h> |
783 |
+ #include <asm/sections.h> |
784 |
+ #include <asm/tlbflush.h> |
785 |
+@@ -102,6 +103,30 @@ static unsigned long get_arch_pgd(pgd_t *pgd) |
786 |
+ #endif |
787 |
+ } |
788 |
+ |
789 |
++#if defined(CONFIG_BIG_LITTLE) && defined(CONFIG_HARDEN_BRANCH_PREDICTOR) |
790 |
++static int secondary_biglittle_prepare(unsigned int cpu) |
791 |
++{ |
792 |
++ if (!cpu_vtable[cpu]) |
793 |
++ cpu_vtable[cpu] = kzalloc(sizeof(*cpu_vtable[cpu]), GFP_KERNEL); |
794 |
++ |
795 |
++ return cpu_vtable[cpu] ? 0 : -ENOMEM; |
796 |
++} |
797 |
++ |
798 |
++static void secondary_biglittle_init(void) |
799 |
++{ |
800 |
++ init_proc_vtable(lookup_processor(read_cpuid_id())->proc); |
801 |
++} |
802 |
++#else |
803 |
++static int secondary_biglittle_prepare(unsigned int cpu) |
804 |
++{ |
805 |
++ return 0; |
806 |
++} |
807 |
++ |
808 |
++static void secondary_biglittle_init(void) |
809 |
++{ |
810 |
++} |
811 |
++#endif |
812 |
++ |
813 |
+ int __cpu_up(unsigned int cpu, struct task_struct *idle) |
814 |
+ { |
815 |
+ int ret; |
816 |
+@@ -109,6 +134,10 @@ int __cpu_up(unsigned int cpu, struct task_struct *idle) |
817 |
+ if (!smp_ops.smp_boot_secondary) |
818 |
+ return -ENOSYS; |
819 |
+ |
820 |
++ ret = secondary_biglittle_prepare(cpu); |
821 |
++ if (ret) |
822 |
++ return ret; |
823 |
++ |
824 |
+ /* |
825 |
+ * We need to tell the secondary core where to find |
826 |
+ * its stack and the page tables. |
827 |
+@@ -359,6 +388,8 @@ asmlinkage void secondary_start_kernel(void) |
828 |
+ struct mm_struct *mm = &init_mm; |
829 |
+ unsigned int cpu; |
830 |
+ |
831 |
++ secondary_biglittle_init(); |
832 |
++ |
833 |
+ /* |
834 |
+ * The identity mapping is uncached (strongly ordered), so |
835 |
+ * switch away from it before attempting any exclusive accesses. |
836 |
+diff --git a/arch/arm/kernel/sys_oabi-compat.c b/arch/arm/kernel/sys_oabi-compat.c |
837 |
+index f0dd4b6ebb63..40da0872170f 100644 |
838 |
+--- a/arch/arm/kernel/sys_oabi-compat.c |
839 |
++++ b/arch/arm/kernel/sys_oabi-compat.c |
840 |
+@@ -277,6 +277,7 @@ asmlinkage long sys_oabi_epoll_wait(int epfd, |
841 |
+ int maxevents, int timeout) |
842 |
+ { |
843 |
+ struct epoll_event *kbuf; |
844 |
++ struct oabi_epoll_event e; |
845 |
+ mm_segment_t fs; |
846 |
+ long ret, err, i; |
847 |
+ |
848 |
+@@ -295,8 +296,11 @@ asmlinkage long sys_oabi_epoll_wait(int epfd, |
849 |
+ set_fs(fs); |
850 |
+ err = 0; |
851 |
+ for (i = 0; i < ret; i++) { |
852 |
+- __put_user_error(kbuf[i].events, &events->events, err); |
853 |
+- __put_user_error(kbuf[i].data, &events->data, err); |
854 |
++ e.events = kbuf[i].events; |
855 |
++ e.data = kbuf[i].data; |
856 |
++ err = __copy_to_user(events, &e, sizeof(e)); |
857 |
++ if (err) |
858 |
++ break; |
859 |
+ events++; |
860 |
+ } |
861 |
+ kfree(kbuf); |
862 |
+diff --git a/arch/arm/lib/copy_from_user.S b/arch/arm/lib/copy_from_user.S |
863 |
+index a826df3d3814..6709a8d33963 100644 |
864 |
+--- a/arch/arm/lib/copy_from_user.S |
865 |
++++ b/arch/arm/lib/copy_from_user.S |
866 |
+@@ -93,11 +93,7 @@ ENTRY(arm_copy_from_user) |
867 |
+ #ifdef CONFIG_CPU_SPECTRE |
868 |
+ get_thread_info r3 |
869 |
+ ldr r3, [r3, #TI_ADDR_LIMIT] |
870 |
+- adds ip, r1, r2 @ ip=addr+size |
871 |
+- sub r3, r3, #1 @ addr_limit - 1 |
872 |
+- cmpcc ip, r3 @ if (addr+size > addr_limit - 1) |
873 |
+- movcs r1, #0 @ addr = NULL |
874 |
+- csdb |
875 |
++ uaccess_mask_range_ptr r1, r2, r3, ip |
876 |
+ #endif |
877 |
+ |
878 |
+ #include "copy_template.S" |
879 |
+diff --git a/arch/arm/lib/copy_to_user.S b/arch/arm/lib/copy_to_user.S |
880 |
+index caf5019d8161..970abe521197 100644 |
881 |
+--- a/arch/arm/lib/copy_to_user.S |
882 |
++++ b/arch/arm/lib/copy_to_user.S |
883 |
+@@ -94,6 +94,11 @@ |
884 |
+ |
885 |
+ ENTRY(__copy_to_user_std) |
886 |
+ WEAK(arm_copy_to_user) |
887 |
++#ifdef CONFIG_CPU_SPECTRE |
888 |
++ get_thread_info r3 |
889 |
++ ldr r3, [r3, #TI_ADDR_LIMIT] |
890 |
++ uaccess_mask_range_ptr r0, r2, r3, ip |
891 |
++#endif |
892 |
+ |
893 |
+ #include "copy_template.S" |
894 |
+ |
895 |
+@@ -108,4 +113,3 @@ ENDPROC(__copy_to_user_std) |
896 |
+ rsb r0, r0, r2 |
897 |
+ copy_abort_end |
898 |
+ .popsection |
899 |
+- |
900 |
+diff --git a/arch/arm/lib/uaccess_with_memcpy.c b/arch/arm/lib/uaccess_with_memcpy.c |
901 |
+index 9b4ed1728616..73dc7360cbdd 100644 |
902 |
+--- a/arch/arm/lib/uaccess_with_memcpy.c |
903 |
++++ b/arch/arm/lib/uaccess_with_memcpy.c |
904 |
+@@ -152,7 +152,8 @@ arm_copy_to_user(void __user *to, const void *from, unsigned long n) |
905 |
+ n = __copy_to_user_std(to, from, n); |
906 |
+ uaccess_restore(ua_flags); |
907 |
+ } else { |
908 |
+- n = __copy_to_user_memcpy(to, from, n); |
909 |
++ n = __copy_to_user_memcpy(uaccess_mask_range_ptr(to, n), |
910 |
++ from, n); |
911 |
+ } |
912 |
+ return n; |
913 |
+ } |
914 |
+diff --git a/arch/arm/mach-integrator/impd1.c b/arch/arm/mach-integrator/impd1.c |
915 |
+index a109f6482413..0f916c245a2e 100644 |
916 |
+--- a/arch/arm/mach-integrator/impd1.c |
917 |
++++ b/arch/arm/mach-integrator/impd1.c |
918 |
+@@ -393,7 +393,11 @@ static int __ref impd1_probe(struct lm_device *dev) |
919 |
+ sizeof(*lookup) + 3 * sizeof(struct gpiod_lookup), |
920 |
+ GFP_KERNEL); |
921 |
+ chipname = devm_kstrdup(&dev->dev, devname, GFP_KERNEL); |
922 |
+- mmciname = kasprintf(GFP_KERNEL, "lm%x:00700", dev->id); |
923 |
++ mmciname = devm_kasprintf(&dev->dev, GFP_KERNEL, |
924 |
++ "lm%x:00700", dev->id); |
925 |
++ if (!lookup || !chipname || !mmciname) |
926 |
++ return -ENOMEM; |
927 |
++ |
928 |
+ lookup->dev_id = mmciname; |
929 |
+ /* |
930 |
+ * Offsets on GPIO block 1: |
931 |
+diff --git a/arch/arm/mach-omap2/omap-wakeupgen.c b/arch/arm/mach-omap2/omap-wakeupgen.c |
932 |
+index fc5fb776a710..17558be4bf0a 100644 |
933 |
+--- a/arch/arm/mach-omap2/omap-wakeupgen.c |
934 |
++++ b/arch/arm/mach-omap2/omap-wakeupgen.c |
935 |
+@@ -50,6 +50,9 @@ |
936 |
+ #define OMAP4_NR_BANKS 4 |
937 |
+ #define OMAP4_NR_IRQS 128 |
938 |
+ |
939 |
++#define SYS_NIRQ1_EXT_SYS_IRQ_1 7 |
940 |
++#define SYS_NIRQ2_EXT_SYS_IRQ_2 119 |
941 |
++ |
942 |
+ static void __iomem *wakeupgen_base; |
943 |
+ static void __iomem *sar_base; |
944 |
+ static DEFINE_RAW_SPINLOCK(wakeupgen_lock); |
945 |
+@@ -153,6 +156,37 @@ static void wakeupgen_unmask(struct irq_data *d) |
946 |
+ irq_chip_unmask_parent(d); |
947 |
+ } |
948 |
+ |
949 |
++/* |
950 |
++ * The sys_nirq pins bypass peripheral modules and are wired directly |
951 |
++ * to MPUSS wakeupgen. They get automatically inverted for GIC. |
952 |
++ */ |
953 |
++static int wakeupgen_irq_set_type(struct irq_data *d, unsigned int type) |
954 |
++{ |
955 |
++ bool inverted = false; |
956 |
++ |
957 |
++ switch (type) { |
958 |
++ case IRQ_TYPE_LEVEL_LOW: |
959 |
++ type &= ~IRQ_TYPE_LEVEL_MASK; |
960 |
++ type |= IRQ_TYPE_LEVEL_HIGH; |
961 |
++ inverted = true; |
962 |
++ break; |
963 |
++ case IRQ_TYPE_EDGE_FALLING: |
964 |
++ type &= ~IRQ_TYPE_EDGE_BOTH; |
965 |
++ type |= IRQ_TYPE_EDGE_RISING; |
966 |
++ inverted = true; |
967 |
++ break; |
968 |
++ default: |
969 |
++ break; |
970 |
++ } |
971 |
++ |
972 |
++ if (inverted && d->hwirq != SYS_NIRQ1_EXT_SYS_IRQ_1 && |
973 |
++ d->hwirq != SYS_NIRQ2_EXT_SYS_IRQ_2) |
974 |
++ pr_warn("wakeupgen: irq%li polarity inverted in dts\n", |
975 |
++ d->hwirq); |
976 |
++ |
977 |
++ return irq_chip_set_type_parent(d, type); |
978 |
++} |
979 |
++ |
980 |
+ #ifdef CONFIG_HOTPLUG_CPU |
981 |
+ static DEFINE_PER_CPU(u32 [MAX_NR_REG_BANKS], irqmasks); |
982 |
+ |
983 |
+@@ -446,7 +480,7 @@ static struct irq_chip wakeupgen_chip = { |
984 |
+ .irq_mask = wakeupgen_mask, |
985 |
+ .irq_unmask = wakeupgen_unmask, |
986 |
+ .irq_retrigger = irq_chip_retrigger_hierarchy, |
987 |
+- .irq_set_type = irq_chip_set_type_parent, |
988 |
++ .irq_set_type = wakeupgen_irq_set_type, |
989 |
+ .flags = IRQCHIP_SKIP_SET_WAKE | IRQCHIP_MASK_ON_SUSPEND, |
990 |
+ #ifdef CONFIG_SMP |
991 |
+ .irq_set_affinity = irq_chip_set_affinity_parent, |
992 |
+diff --git a/arch/arm/mm/proc-macros.S b/arch/arm/mm/proc-macros.S |
993 |
+index 81d0efb055c6..5461d589a1e2 100644 |
994 |
+--- a/arch/arm/mm/proc-macros.S |
995 |
++++ b/arch/arm/mm/proc-macros.S |
996 |
+@@ -274,6 +274,13 @@ |
997 |
+ .endm |
998 |
+ |
999 |
+ .macro define_processor_functions name:req, dabort:req, pabort:req, nommu=0, suspend=0, bugs=0 |
1000 |
++/* |
1001 |
++ * If we are building for big.Little with branch predictor hardening, |
1002 |
++ * we need the processor function tables to remain available after boot. |
1003 |
++ */ |
1004 |
++#if defined(CONFIG_BIG_LITTLE) && defined(CONFIG_HARDEN_BRANCH_PREDICTOR) |
1005 |
++ .section ".rodata" |
1006 |
++#endif |
1007 |
+ .type \name\()_processor_functions, #object |
1008 |
+ .align 2 |
1009 |
+ ENTRY(\name\()_processor_functions) |
1010 |
+@@ -309,6 +316,9 @@ ENTRY(\name\()_processor_functions) |
1011 |
+ .endif |
1012 |
+ |
1013 |
+ .size \name\()_processor_functions, . - \name\()_processor_functions |
1014 |
++#if defined(CONFIG_BIG_LITTLE) && defined(CONFIG_HARDEN_BRANCH_PREDICTOR) |
1015 |
++ .previous |
1016 |
++#endif |
1017 |
+ .endm |
1018 |
+ |
1019 |
+ .macro define_cache_functions name:req |
1020 |
+diff --git a/arch/arm/mm/proc-v7-bugs.c b/arch/arm/mm/proc-v7-bugs.c |
1021 |
+index 5544b82a2e7a..9a07916af8dd 100644 |
1022 |
+--- a/arch/arm/mm/proc-v7-bugs.c |
1023 |
++++ b/arch/arm/mm/proc-v7-bugs.c |
1024 |
+@@ -52,8 +52,6 @@ static void cpu_v7_spectre_init(void) |
1025 |
+ case ARM_CPU_PART_CORTEX_A17: |
1026 |
+ case ARM_CPU_PART_CORTEX_A73: |
1027 |
+ case ARM_CPU_PART_CORTEX_A75: |
1028 |
+- if (processor.switch_mm != cpu_v7_bpiall_switch_mm) |
1029 |
+- goto bl_error; |
1030 |
+ per_cpu(harden_branch_predictor_fn, cpu) = |
1031 |
+ harden_branch_predictor_bpiall; |
1032 |
+ spectre_v2_method = "BPIALL"; |
1033 |
+@@ -61,8 +59,6 @@ static void cpu_v7_spectre_init(void) |
1034 |
+ |
1035 |
+ case ARM_CPU_PART_CORTEX_A15: |
1036 |
+ case ARM_CPU_PART_BRAHMA_B15: |
1037 |
+- if (processor.switch_mm != cpu_v7_iciallu_switch_mm) |
1038 |
+- goto bl_error; |
1039 |
+ per_cpu(harden_branch_predictor_fn, cpu) = |
1040 |
+ harden_branch_predictor_iciallu; |
1041 |
+ spectre_v2_method = "ICIALLU"; |
1042 |
+@@ -88,11 +84,9 @@ static void cpu_v7_spectre_init(void) |
1043 |
+ ARM_SMCCC_ARCH_WORKAROUND_1, &res); |
1044 |
+ if ((int)res.a0 != 0) |
1045 |
+ break; |
1046 |
+- if (processor.switch_mm != cpu_v7_hvc_switch_mm && cpu) |
1047 |
+- goto bl_error; |
1048 |
+ per_cpu(harden_branch_predictor_fn, cpu) = |
1049 |
+ call_hvc_arch_workaround_1; |
1050 |
+- processor.switch_mm = cpu_v7_hvc_switch_mm; |
1051 |
++ cpu_do_switch_mm = cpu_v7_hvc_switch_mm; |
1052 |
+ spectre_v2_method = "hypervisor"; |
1053 |
+ break; |
1054 |
+ |
1055 |
+@@ -101,11 +95,9 @@ static void cpu_v7_spectre_init(void) |
1056 |
+ ARM_SMCCC_ARCH_WORKAROUND_1, &res); |
1057 |
+ if ((int)res.a0 != 0) |
1058 |
+ break; |
1059 |
+- if (processor.switch_mm != cpu_v7_smc_switch_mm && cpu) |
1060 |
+- goto bl_error; |
1061 |
+ per_cpu(harden_branch_predictor_fn, cpu) = |
1062 |
+ call_smc_arch_workaround_1; |
1063 |
+- processor.switch_mm = cpu_v7_smc_switch_mm; |
1064 |
++ cpu_do_switch_mm = cpu_v7_smc_switch_mm; |
1065 |
+ spectre_v2_method = "firmware"; |
1066 |
+ break; |
1067 |
+ |
1068 |
+@@ -119,11 +111,6 @@ static void cpu_v7_spectre_init(void) |
1069 |
+ if (spectre_v2_method) |
1070 |
+ pr_info("CPU%u: Spectre v2: using %s workaround\n", |
1071 |
+ smp_processor_id(), spectre_v2_method); |
1072 |
+- return; |
1073 |
+- |
1074 |
+-bl_error: |
1075 |
+- pr_err("CPU%u: Spectre v2: incorrect context switching function, system vulnerable\n", |
1076 |
+- cpu); |
1077 |
+ } |
1078 |
+ #else |
1079 |
+ static void cpu_v7_spectre_init(void) |
1080 |
+diff --git a/arch/arm/vfp/vfpmodule.c b/arch/arm/vfp/vfpmodule.c |
1081 |
+index dc7e6b50ef67..66c5e693428a 100644 |
1082 |
+--- a/arch/arm/vfp/vfpmodule.c |
1083 |
++++ b/arch/arm/vfp/vfpmodule.c |
1084 |
+@@ -553,12 +553,11 @@ void vfp_flush_hwstate(struct thread_info *thread) |
1085 |
+ * Save the current VFP state into the provided structures and prepare |
1086 |
+ * for entry into a new function (signal handler). |
1087 |
+ */ |
1088 |
+-int vfp_preserve_user_clear_hwstate(struct user_vfp __user *ufp, |
1089 |
+- struct user_vfp_exc __user *ufp_exc) |
1090 |
++int vfp_preserve_user_clear_hwstate(struct user_vfp *ufp, |
1091 |
++ struct user_vfp_exc *ufp_exc) |
1092 |
+ { |
1093 |
+ struct thread_info *thread = current_thread_info(); |
1094 |
+ struct vfp_hard_struct *hwstate = &thread->vfpstate.hard; |
1095 |
+- int err = 0; |
1096 |
+ |
1097 |
+ /* Ensure that the saved hwstate is up-to-date. */ |
1098 |
+ vfp_sync_hwstate(thread); |
1099 |
+@@ -567,22 +566,19 @@ int vfp_preserve_user_clear_hwstate(struct user_vfp __user *ufp, |
1100 |
+ * Copy the floating point registers. There can be unused |
1101 |
+ * registers see asm/hwcap.h for details. |
1102 |
+ */ |
1103 |
+- err |= __copy_to_user(&ufp->fpregs, &hwstate->fpregs, |
1104 |
+- sizeof(hwstate->fpregs)); |
1105 |
++ memcpy(&ufp->fpregs, &hwstate->fpregs, sizeof(hwstate->fpregs)); |
1106 |
++ |
1107 |
+ /* |
1108 |
+ * Copy the status and control register. |
1109 |
+ */ |
1110 |
+- __put_user_error(hwstate->fpscr, &ufp->fpscr, err); |
1111 |
++ ufp->fpscr = hwstate->fpscr; |
1112 |
+ |
1113 |
+ /* |
1114 |
+ * Copy the exception registers. |
1115 |
+ */ |
1116 |
+- __put_user_error(hwstate->fpexc, &ufp_exc->fpexc, err); |
1117 |
+- __put_user_error(hwstate->fpinst, &ufp_exc->fpinst, err); |
1118 |
+- __put_user_error(hwstate->fpinst2, &ufp_exc->fpinst2, err); |
1119 |
+- |
1120 |
+- if (err) |
1121 |
+- return -EFAULT; |
1122 |
++ ufp_exc->fpexc = hwstate->fpexc; |
1123 |
++ ufp_exc->fpinst = hwstate->fpinst; |
1124 |
++ ufp_exc->fpinst2 = hwstate->fpinst2; |
1125 |
+ |
1126 |
+ /* Ensure that VFP is disabled. */ |
1127 |
+ vfp_flush_hwstate(thread); |
1128 |
+diff --git a/arch/riscv/include/asm/pgtable-bits.h b/arch/riscv/include/asm/pgtable-bits.h |
1129 |
+index 2fa2942be221..470755cb7558 100644 |
1130 |
+--- a/arch/riscv/include/asm/pgtable-bits.h |
1131 |
++++ b/arch/riscv/include/asm/pgtable-bits.h |
1132 |
+@@ -35,6 +35,12 @@ |
1133 |
+ #define _PAGE_SPECIAL _PAGE_SOFT |
1134 |
+ #define _PAGE_TABLE _PAGE_PRESENT |
1135 |
+ |
1136 |
++/* |
1137 |
++ * _PAGE_PROT_NONE is set on not-present pages (and ignored by the hardware) to |
1138 |
++ * distinguish them from swapped out pages |
1139 |
++ */ |
1140 |
++#define _PAGE_PROT_NONE _PAGE_READ |
1141 |
++ |
1142 |
+ #define _PAGE_PFN_SHIFT 10 |
1143 |
+ |
1144 |
+ /* Set of bits to preserve across pte_modify() */ |
1145 |
+diff --git a/arch/riscv/include/asm/pgtable.h b/arch/riscv/include/asm/pgtable.h |
1146 |
+index 16301966d65b..a8179a8c1491 100644 |
1147 |
+--- a/arch/riscv/include/asm/pgtable.h |
1148 |
++++ b/arch/riscv/include/asm/pgtable.h |
1149 |
+@@ -44,7 +44,7 @@ |
1150 |
+ /* Page protection bits */ |
1151 |
+ #define _PAGE_BASE (_PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_USER) |
1152 |
+ |
1153 |
+-#define PAGE_NONE __pgprot(0) |
1154 |
++#define PAGE_NONE __pgprot(_PAGE_PROT_NONE) |
1155 |
+ #define PAGE_READ __pgprot(_PAGE_BASE | _PAGE_READ) |
1156 |
+ #define PAGE_WRITE __pgprot(_PAGE_BASE | _PAGE_READ | _PAGE_WRITE) |
1157 |
+ #define PAGE_EXEC __pgprot(_PAGE_BASE | _PAGE_EXEC) |
1158 |
+@@ -98,7 +98,7 @@ extern unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)]; |
1159 |
+ |
1160 |
+ static inline int pmd_present(pmd_t pmd) |
1161 |
+ { |
1162 |
+- return (pmd_val(pmd) & _PAGE_PRESENT); |
1163 |
++ return (pmd_val(pmd) & (_PAGE_PRESENT | _PAGE_PROT_NONE)); |
1164 |
+ } |
1165 |
+ |
1166 |
+ static inline int pmd_none(pmd_t pmd) |
1167 |
+@@ -178,7 +178,7 @@ static inline pte_t *pte_offset_kernel(pmd_t *pmd, unsigned long addr) |
1168 |
+ |
1169 |
+ static inline int pte_present(pte_t pte) |
1170 |
+ { |
1171 |
+- return (pte_val(pte) & _PAGE_PRESENT); |
1172 |
++ return (pte_val(pte) & (_PAGE_PRESENT | _PAGE_PROT_NONE)); |
1173 |
+ } |
1174 |
+ |
1175 |
+ static inline int pte_none(pte_t pte) |
1176 |
+@@ -380,7 +380,7 @@ static inline int ptep_clear_flush_young(struct vm_area_struct *vma, |
1177 |
+ * |
1178 |
+ * Format of swap PTE: |
1179 |
+ * bit 0: _PAGE_PRESENT (zero) |
1180 |
+- * bit 1: reserved for future use (zero) |
1181 |
++ * bit 1: _PAGE_PROT_NONE (zero) |
1182 |
+ * bits 2 to 6: swap type |
1183 |
+ * bits 7 to XLEN-1: swap offset |
1184 |
+ */ |
1185 |
+diff --git a/arch/riscv/kernel/ptrace.c b/arch/riscv/kernel/ptrace.c |
1186 |
+index 9f82a7e34c64..9db7d0076375 100644 |
1187 |
+--- a/arch/riscv/kernel/ptrace.c |
1188 |
++++ b/arch/riscv/kernel/ptrace.c |
1189 |
+@@ -120,6 +120,6 @@ void do_syscall_trace_exit(struct pt_regs *regs) |
1190 |
+ |
1191 |
+ #ifdef CONFIG_HAVE_SYSCALL_TRACEPOINTS |
1192 |
+ if (test_thread_flag(TIF_SYSCALL_TRACEPOINT)) |
1193 |
+- trace_sys_exit(regs, regs->regs[0]); |
1194 |
++ trace_sys_exit(regs, regs_return_value(regs)); |
1195 |
+ #endif |
1196 |
+ } |
1197 |
+diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c |
1198 |
+index c8d08da5b308..c04a8813cff9 100644 |
1199 |
+--- a/arch/x86/events/core.c |
1200 |
++++ b/arch/x86/events/core.c |
1201 |
+@@ -2253,6 +2253,19 @@ void perf_check_microcode(void) |
1202 |
+ x86_pmu.check_microcode(); |
1203 |
+ } |
1204 |
+ |
1205 |
++static int x86_pmu_check_period(struct perf_event *event, u64 value) |
1206 |
++{ |
1207 |
++ if (x86_pmu.check_period && x86_pmu.check_period(event, value)) |
1208 |
++ return -EINVAL; |
1209 |
++ |
1210 |
++ if (value && x86_pmu.limit_period) { |
1211 |
++ if (x86_pmu.limit_period(event, value) > value) |
1212 |
++ return -EINVAL; |
1213 |
++ } |
1214 |
++ |
1215 |
++ return 0; |
1216 |
++} |
1217 |
++ |
1218 |
+ static struct pmu pmu = { |
1219 |
+ .pmu_enable = x86_pmu_enable, |
1220 |
+ .pmu_disable = x86_pmu_disable, |
1221 |
+@@ -2277,6 +2290,7 @@ static struct pmu pmu = { |
1222 |
+ .event_idx = x86_pmu_event_idx, |
1223 |
+ .sched_task = x86_pmu_sched_task, |
1224 |
+ .task_ctx_size = sizeof(struct x86_perf_task_context), |
1225 |
++ .check_period = x86_pmu_check_period, |
1226 |
+ }; |
1227 |
+ |
1228 |
+ void arch_perf_update_userpage(struct perf_event *event, |
1229 |
+diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c |
1230 |
+index d0b186264941..fbd7551a8d44 100644 |
1231 |
+--- a/arch/x86/events/intel/core.c |
1232 |
++++ b/arch/x86/events/intel/core.c |
1233 |
+@@ -3465,6 +3465,11 @@ static void intel_pmu_sched_task(struct perf_event_context *ctx, |
1234 |
+ intel_pmu_lbr_sched_task(ctx, sched_in); |
1235 |
+ } |
1236 |
+ |
1237 |
++static int intel_pmu_check_period(struct perf_event *event, u64 value) |
1238 |
++{ |
1239 |
++ return intel_pmu_has_bts_period(event, value) ? -EINVAL : 0; |
1240 |
++} |
1241 |
++ |
1242 |
+ PMU_FORMAT_ATTR(offcore_rsp, "config1:0-63"); |
1243 |
+ |
1244 |
+ PMU_FORMAT_ATTR(ldlat, "config1:0-15"); |
1245 |
+@@ -3545,6 +3550,8 @@ static __initconst const struct x86_pmu core_pmu = { |
1246 |
+ .cpu_starting = intel_pmu_cpu_starting, |
1247 |
+ .cpu_dying = intel_pmu_cpu_dying, |
1248 |
+ .cpu_dead = intel_pmu_cpu_dead, |
1249 |
++ |
1250 |
++ .check_period = intel_pmu_check_period, |
1251 |
+ }; |
1252 |
+ |
1253 |
+ static struct attribute *intel_pmu_attrs[]; |
1254 |
+@@ -3589,6 +3596,8 @@ static __initconst const struct x86_pmu intel_pmu = { |
1255 |
+ |
1256 |
+ .guest_get_msrs = intel_guest_get_msrs, |
1257 |
+ .sched_task = intel_pmu_sched_task, |
1258 |
++ |
1259 |
++ .check_period = intel_pmu_check_period, |
1260 |
+ }; |
1261 |
+ |
1262 |
+ static __init void intel_clovertown_quirk(void) |
1263 |
+diff --git a/arch/x86/events/perf_event.h b/arch/x86/events/perf_event.h |
1264 |
+index c5ad9cc61f4b..0ee3a441ad79 100644 |
1265 |
+--- a/arch/x86/events/perf_event.h |
1266 |
++++ b/arch/x86/events/perf_event.h |
1267 |
+@@ -644,6 +644,11 @@ struct x86_pmu { |
1268 |
+ * Intel host/guest support (KVM) |
1269 |
+ */ |
1270 |
+ struct perf_guest_switch_msr *(*guest_get_msrs)(int *nr); |
1271 |
++ |
1272 |
++ /* |
1273 |
++ * Check period value for PERF_EVENT_IOC_PERIOD ioctl. |
1274 |
++ */ |
1275 |
++ int (*check_period) (struct perf_event *event, u64 period); |
1276 |
+ }; |
1277 |
+ |
1278 |
+ struct x86_perf_task_context { |
1279 |
+@@ -855,7 +860,7 @@ static inline int amd_pmu_init(void) |
1280 |
+ |
1281 |
+ #ifdef CONFIG_CPU_SUP_INTEL |
1282 |
+ |
1283 |
+-static inline bool intel_pmu_has_bts(struct perf_event *event) |
1284 |
++static inline bool intel_pmu_has_bts_period(struct perf_event *event, u64 period) |
1285 |
+ { |
1286 |
+ struct hw_perf_event *hwc = &event->hw; |
1287 |
+ unsigned int hw_event, bts_event; |
1288 |
+@@ -866,7 +871,14 @@ static inline bool intel_pmu_has_bts(struct perf_event *event) |
1289 |
+ hw_event = hwc->config & INTEL_ARCH_EVENT_MASK; |
1290 |
+ bts_event = x86_pmu.event_map(PERF_COUNT_HW_BRANCH_INSTRUCTIONS); |
1291 |
+ |
1292 |
+- return hw_event == bts_event && hwc->sample_period == 1; |
1293 |
++ return hw_event == bts_event && period == 1; |
1294 |
++} |
1295 |
++ |
1296 |
++static inline bool intel_pmu_has_bts(struct perf_event *event) |
1297 |
++{ |
1298 |
++ struct hw_perf_event *hwc = &event->hw; |
1299 |
++ |
1300 |
++ return intel_pmu_has_bts_period(event, hwc->sample_period); |
1301 |
+ } |
1302 |
+ |
1303 |
+ int intel_pmu_save_and_restart(struct perf_event *event); |
1304 |
+diff --git a/arch/x86/ia32/ia32_aout.c b/arch/x86/ia32/ia32_aout.c |
1305 |
+index 8e02b30cf08e..3ebd77770f98 100644 |
1306 |
+--- a/arch/x86/ia32/ia32_aout.c |
1307 |
++++ b/arch/x86/ia32/ia32_aout.c |
1308 |
+@@ -51,7 +51,7 @@ static unsigned long get_dr(int n) |
1309 |
+ /* |
1310 |
+ * fill in the user structure for a core dump.. |
1311 |
+ */ |
1312 |
+-static void dump_thread32(struct pt_regs *regs, struct user32 *dump) |
1313 |
++static void fill_dump(struct pt_regs *regs, struct user32 *dump) |
1314 |
+ { |
1315 |
+ u32 fs, gs; |
1316 |
+ memset(dump, 0, sizeof(*dump)); |
1317 |
+@@ -157,10 +157,12 @@ static int aout_core_dump(struct coredump_params *cprm) |
1318 |
+ fs = get_fs(); |
1319 |
+ set_fs(KERNEL_DS); |
1320 |
+ has_dumped = 1; |
1321 |
++ |
1322 |
++ fill_dump(cprm->regs, &dump); |
1323 |
++ |
1324 |
+ strncpy(dump.u_comm, current->comm, sizeof(current->comm)); |
1325 |
+ dump.u_ar0 = offsetof(struct user32, regs); |
1326 |
+ dump.signal = cprm->siginfo->si_signo; |
1327 |
+- dump_thread32(cprm->regs, &dump); |
1328 |
+ |
1329 |
+ /* |
1330 |
+ * If the size of the dump file exceeds the rlimit, then see |
1331 |
+diff --git a/arch/x86/include/asm/uv/bios.h b/arch/x86/include/asm/uv/bios.h |
1332 |
+index e652a7cc6186..3f697a9e3f59 100644 |
1333 |
+--- a/arch/x86/include/asm/uv/bios.h |
1334 |
++++ b/arch/x86/include/asm/uv/bios.h |
1335 |
+@@ -48,7 +48,8 @@ enum { |
1336 |
+ BIOS_STATUS_SUCCESS = 0, |
1337 |
+ BIOS_STATUS_UNIMPLEMENTED = -ENOSYS, |
1338 |
+ BIOS_STATUS_EINVAL = -EINVAL, |
1339 |
+- BIOS_STATUS_UNAVAIL = -EBUSY |
1340 |
++ BIOS_STATUS_UNAVAIL = -EBUSY, |
1341 |
++ BIOS_STATUS_ABORT = -EINTR, |
1342 |
+ }; |
1343 |
+ |
1344 |
+ /* Address map parameters */ |
1345 |
+@@ -167,4 +168,9 @@ extern long system_serial_number; |
1346 |
+ |
1347 |
+ extern struct kobject *sgi_uv_kobj; /* /sys/firmware/sgi_uv */ |
1348 |
+ |
1349 |
++/* |
1350 |
++ * EFI runtime lock; cf. firmware/efi/runtime-wrappers.c for details |
1351 |
++ */ |
1352 |
++extern struct semaphore __efi_uv_runtime_lock; |
1353 |
++ |
1354 |
+ #endif /* _ASM_X86_UV_BIOS_H */ |
1355 |
+diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c |
1356 |
+index 02ac8fa0cd6d..ee8f8d70b98a 100644 |
1357 |
+--- a/arch/x86/kvm/svm.c |
1358 |
++++ b/arch/x86/kvm/svm.c |
1359 |
+@@ -6256,6 +6256,9 @@ static int sev_guest_init(struct kvm *kvm, struct kvm_sev_cmd *argp) |
1360 |
+ int asid, ret; |
1361 |
+ |
1362 |
+ ret = -EBUSY; |
1363 |
++ if (unlikely(sev->active)) |
1364 |
++ return ret; |
1365 |
++ |
1366 |
+ asid = sev_asid_new(); |
1367 |
+ if (asid < 0) |
1368 |
+ return ret; |
1369 |
+diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c |
1370 |
+index 0b2e13dd517b..f6da5c37d2e8 100644 |
1371 |
+--- a/arch/x86/kvm/vmx.c |
1372 |
++++ b/arch/x86/kvm/vmx.c |
1373 |
+@@ -2757,7 +2757,8 @@ static void add_atomic_switch_msr(struct vcpu_vmx *vmx, unsigned msr, |
1374 |
+ if (!entry_only) |
1375 |
+ j = find_msr(&m->host, msr); |
1376 |
+ |
1377 |
+- if (i == NR_AUTOLOAD_MSRS || j == NR_AUTOLOAD_MSRS) { |
1378 |
++ if ((i < 0 && m->guest.nr == NR_AUTOLOAD_MSRS) || |
1379 |
++ (j < 0 && m->host.nr == NR_AUTOLOAD_MSRS)) { |
1380 |
+ printk_once(KERN_WARNING "Not enough msr switch entries. " |
1381 |
+ "Can't add msr %x\n", msr); |
1382 |
+ return; |
1383 |
+@@ -3601,9 +3602,11 @@ static void nested_vmx_setup_ctls_msrs(struct nested_vmx_msrs *msrs, bool apicv) |
1384 |
+ * secondary cpu-based controls. Do not include those that |
1385 |
+ * depend on CPUID bits, they are added later by vmx_cpuid_update. |
1386 |
+ */ |
1387 |
+- rdmsr(MSR_IA32_VMX_PROCBASED_CTLS2, |
1388 |
+- msrs->secondary_ctls_low, |
1389 |
+- msrs->secondary_ctls_high); |
1390 |
++ if (msrs->procbased_ctls_high & CPU_BASED_ACTIVATE_SECONDARY_CONTROLS) |
1391 |
++ rdmsr(MSR_IA32_VMX_PROCBASED_CTLS2, |
1392 |
++ msrs->secondary_ctls_low, |
1393 |
++ msrs->secondary_ctls_high); |
1394 |
++ |
1395 |
+ msrs->secondary_ctls_low = 0; |
1396 |
+ msrs->secondary_ctls_high &= |
1397 |
+ SECONDARY_EXEC_DESC | |
1398 |
+diff --git a/arch/x86/platform/uv/bios_uv.c b/arch/x86/platform/uv/bios_uv.c |
1399 |
+index 4a6a5a26c582..eb33432f2f24 100644 |
1400 |
+--- a/arch/x86/platform/uv/bios_uv.c |
1401 |
++++ b/arch/x86/platform/uv/bios_uv.c |
1402 |
+@@ -29,7 +29,8 @@ |
1403 |
+ |
1404 |
+ struct uv_systab *uv_systab; |
1405 |
+ |
1406 |
+-s64 uv_bios_call(enum uv_bios_cmd which, u64 a1, u64 a2, u64 a3, u64 a4, u64 a5) |
1407 |
++static s64 __uv_bios_call(enum uv_bios_cmd which, u64 a1, u64 a2, u64 a3, |
1408 |
++ u64 a4, u64 a5) |
1409 |
+ { |
1410 |
+ struct uv_systab *tab = uv_systab; |
1411 |
+ s64 ret; |
1412 |
+@@ -51,6 +52,19 @@ s64 uv_bios_call(enum uv_bios_cmd which, u64 a1, u64 a2, u64 a3, u64 a4, u64 a5) |
1413 |
+ |
1414 |
+ return ret; |
1415 |
+ } |
1416 |
++ |
1417 |
++s64 uv_bios_call(enum uv_bios_cmd which, u64 a1, u64 a2, u64 a3, u64 a4, u64 a5) |
1418 |
++{ |
1419 |
++ s64 ret; |
1420 |
++ |
1421 |
++ if (down_interruptible(&__efi_uv_runtime_lock)) |
1422 |
++ return BIOS_STATUS_ABORT; |
1423 |
++ |
1424 |
++ ret = __uv_bios_call(which, a1, a2, a3, a4, a5); |
1425 |
++ up(&__efi_uv_runtime_lock); |
1426 |
++ |
1427 |
++ return ret; |
1428 |
++} |
1429 |
+ EXPORT_SYMBOL_GPL(uv_bios_call); |
1430 |
+ |
1431 |
+ s64 uv_bios_call_irqsave(enum uv_bios_cmd which, u64 a1, u64 a2, u64 a3, |
1432 |
+@@ -59,10 +73,15 @@ s64 uv_bios_call_irqsave(enum uv_bios_cmd which, u64 a1, u64 a2, u64 a3, |
1433 |
+ unsigned long bios_flags; |
1434 |
+ s64 ret; |
1435 |
+ |
1436 |
++ if (down_interruptible(&__efi_uv_runtime_lock)) |
1437 |
++ return BIOS_STATUS_ABORT; |
1438 |
++ |
1439 |
+ local_irq_save(bios_flags); |
1440 |
+- ret = uv_bios_call(which, a1, a2, a3, a4, a5); |
1441 |
++ ret = __uv_bios_call(which, a1, a2, a3, a4, a5); |
1442 |
+ local_irq_restore(bios_flags); |
1443 |
+ |
1444 |
++ up(&__efi_uv_runtime_lock); |
1445 |
++ |
1446 |
+ return ret; |
1447 |
+ } |
1448 |
+ |
1449 |
+diff --git a/block/blk-flush.c b/block/blk-flush.c |
1450 |
+index ce41f666de3e..76487948a27f 100644 |
1451 |
+--- a/block/blk-flush.c |
1452 |
++++ b/block/blk-flush.c |
1453 |
+@@ -424,7 +424,7 @@ static void mq_flush_data_end_io(struct request *rq, blk_status_t error) |
1454 |
+ blk_flush_complete_seq(rq, fq, REQ_FSEQ_DATA, error); |
1455 |
+ spin_unlock_irqrestore(&fq->mq_flush_lock, flags); |
1456 |
+ |
1457 |
+- blk_mq_run_hw_queue(hctx, true); |
1458 |
++ blk_mq_sched_restart(hctx); |
1459 |
+ } |
1460 |
+ |
1461 |
+ /** |
1462 |
+diff --git a/drivers/acpi/numa.c b/drivers/acpi/numa.c |
1463 |
+index 85167603b9c9..0da58f0bf7e5 100644 |
1464 |
+--- a/drivers/acpi/numa.c |
1465 |
++++ b/drivers/acpi/numa.c |
1466 |
+@@ -147,9 +147,9 @@ acpi_table_print_srat_entry(struct acpi_subtable_header *header) |
1467 |
+ { |
1468 |
+ struct acpi_srat_mem_affinity *p = |
1469 |
+ (struct acpi_srat_mem_affinity *)header; |
1470 |
+- pr_debug("SRAT Memory (0x%lx length 0x%lx) in proximity domain %d %s%s%s\n", |
1471 |
+- (unsigned long)p->base_address, |
1472 |
+- (unsigned long)p->length, |
1473 |
++ pr_debug("SRAT Memory (0x%llx length 0x%llx) in proximity domain %d %s%s%s\n", |
1474 |
++ (unsigned long long)p->base_address, |
1475 |
++ (unsigned long long)p->length, |
1476 |
+ p->proximity_domain, |
1477 |
+ (p->flags & ACPI_SRAT_MEM_ENABLED) ? |
1478 |
+ "enabled" : "disabled", |
1479 |
+diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c |
1480 |
+index f53fb41efb7b..b100260b6ed2 100644 |
1481 |
+--- a/drivers/cpufreq/cpufreq.c |
1482 |
++++ b/drivers/cpufreq/cpufreq.c |
1483 |
+@@ -1530,17 +1530,16 @@ static unsigned int __cpufreq_get(struct cpufreq_policy *policy) |
1484 |
+ { |
1485 |
+ unsigned int ret_freq = 0; |
1486 |
+ |
1487 |
+- if (!cpufreq_driver->get) |
1488 |
++ if (unlikely(policy_is_inactive(policy)) || !cpufreq_driver->get) |
1489 |
+ return ret_freq; |
1490 |
+ |
1491 |
+ ret_freq = cpufreq_driver->get(policy->cpu); |
1492 |
+ |
1493 |
+ /* |
1494 |
+- * Updating inactive policies is invalid, so avoid doing that. Also |
1495 |
+- * if fast frequency switching is used with the given policy, the check |
1496 |
++ * If fast frequency switching is used with the given policy, the check |
1497 |
+ * against policy->cur is pointless, so skip it in that case too. |
1498 |
+ */ |
1499 |
+- if (unlikely(policy_is_inactive(policy)) || policy->fast_switch_enabled) |
1500 |
++ if (policy->fast_switch_enabled) |
1501 |
+ return ret_freq; |
1502 |
+ |
1503 |
+ if (ret_freq && policy->cur && |
1504 |
+@@ -1569,10 +1568,7 @@ unsigned int cpufreq_get(unsigned int cpu) |
1505 |
+ |
1506 |
+ if (policy) { |
1507 |
+ down_read(&policy->rwsem); |
1508 |
+- |
1509 |
+- if (!policy_is_inactive(policy)) |
1510 |
+- ret_freq = __cpufreq_get(policy); |
1511 |
+- |
1512 |
++ ret_freq = __cpufreq_get(policy); |
1513 |
+ up_read(&policy->rwsem); |
1514 |
+ |
1515 |
+ cpufreq_cpu_put(policy); |
1516 |
+diff --git a/drivers/firmware/efi/runtime-wrappers.c b/drivers/firmware/efi/runtime-wrappers.c |
1517 |
+index aa66cbf23512..b0aeffd4e269 100644 |
1518 |
+--- a/drivers/firmware/efi/runtime-wrappers.c |
1519 |
++++ b/drivers/firmware/efi/runtime-wrappers.c |
1520 |
+@@ -172,6 +172,13 @@ void efi_call_virt_check_flags(unsigned long flags, const char *call) |
1521 |
+ */ |
1522 |
+ static DEFINE_SEMAPHORE(efi_runtime_lock); |
1523 |
+ |
1524 |
++/* |
1525 |
++ * Expose the EFI runtime lock to the UV platform |
1526 |
++ */ |
1527 |
++#ifdef CONFIG_X86_UV |
1528 |
++extern struct semaphore __efi_uv_runtime_lock __alias(efi_runtime_lock); |
1529 |
++#endif |
1530 |
++ |
1531 |
+ /* |
1532 |
+ * Calls the appropriate efi_runtime_service() with the appropriate |
1533 |
+ * arguments. |
1534 |
+diff --git a/drivers/gpio/gpio-mxc.c b/drivers/gpio/gpio-mxc.c |
1535 |
+index 995cf0b9e0b1..2d1dfa1e0745 100644 |
1536 |
+--- a/drivers/gpio/gpio-mxc.c |
1537 |
++++ b/drivers/gpio/gpio-mxc.c |
1538 |
+@@ -17,6 +17,7 @@ |
1539 |
+ #include <linux/irqchip/chained_irq.h> |
1540 |
+ #include <linux/platform_device.h> |
1541 |
+ #include <linux/slab.h> |
1542 |
++#include <linux/syscore_ops.h> |
1543 |
+ #include <linux/gpio/driver.h> |
1544 |
+ #include <linux/of.h> |
1545 |
+ #include <linux/of_device.h> |
1546 |
+@@ -550,33 +551,38 @@ static void mxc_gpio_restore_regs(struct mxc_gpio_port *port) |
1547 |
+ writel(port->gpio_saved_reg.dr, port->base + GPIO_DR); |
1548 |
+ } |
1549 |
+ |
1550 |
+-static int __maybe_unused mxc_gpio_noirq_suspend(struct device *dev) |
1551 |
++static int mxc_gpio_syscore_suspend(void) |
1552 |
+ { |
1553 |
+- struct platform_device *pdev = to_platform_device(dev); |
1554 |
+- struct mxc_gpio_port *port = platform_get_drvdata(pdev); |
1555 |
++ struct mxc_gpio_port *port; |
1556 |
+ |
1557 |
+- mxc_gpio_save_regs(port); |
1558 |
+- clk_disable_unprepare(port->clk); |
1559 |
++ /* walk through all ports */ |
1560 |
++ list_for_each_entry(port, &mxc_gpio_ports, node) { |
1561 |
++ mxc_gpio_save_regs(port); |
1562 |
++ clk_disable_unprepare(port->clk); |
1563 |
++ } |
1564 |
+ |
1565 |
+ return 0; |
1566 |
+ } |
1567 |
+ |
1568 |
+-static int __maybe_unused mxc_gpio_noirq_resume(struct device *dev) |
1569 |
++static void mxc_gpio_syscore_resume(void) |
1570 |
+ { |
1571 |
+- struct platform_device *pdev = to_platform_device(dev); |
1572 |
+- struct mxc_gpio_port *port = platform_get_drvdata(pdev); |
1573 |
++ struct mxc_gpio_port *port; |
1574 |
+ int ret; |
1575 |
+ |
1576 |
+- ret = clk_prepare_enable(port->clk); |
1577 |
+- if (ret) |
1578 |
+- return ret; |
1579 |
+- mxc_gpio_restore_regs(port); |
1580 |
+- |
1581 |
+- return 0; |
1582 |
++ /* walk through all ports */ |
1583 |
++ list_for_each_entry(port, &mxc_gpio_ports, node) { |
1584 |
++ ret = clk_prepare_enable(port->clk); |
1585 |
++ if (ret) { |
1586 |
++ pr_err("mxc: failed to enable gpio clock %d\n", ret); |
1587 |
++ return; |
1588 |
++ } |
1589 |
++ mxc_gpio_restore_regs(port); |
1590 |
++ } |
1591 |
+ } |
1592 |
+ |
1593 |
+-static const struct dev_pm_ops mxc_gpio_dev_pm_ops = { |
1594 |
+- SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(mxc_gpio_noirq_suspend, mxc_gpio_noirq_resume) |
1595 |
++static struct syscore_ops mxc_gpio_syscore_ops = { |
1596 |
++ .suspend = mxc_gpio_syscore_suspend, |
1597 |
++ .resume = mxc_gpio_syscore_resume, |
1598 |
+ }; |
1599 |
+ |
1600 |
+ static struct platform_driver mxc_gpio_driver = { |
1601 |
+@@ -584,7 +590,6 @@ static struct platform_driver mxc_gpio_driver = { |
1602 |
+ .name = "gpio-mxc", |
1603 |
+ .of_match_table = mxc_gpio_dt_ids, |
1604 |
+ .suppress_bind_attrs = true, |
1605 |
+- .pm = &mxc_gpio_dev_pm_ops, |
1606 |
+ }, |
1607 |
+ .probe = mxc_gpio_probe, |
1608 |
+ .id_table = mxc_gpio_devtype, |
1609 |
+@@ -592,6 +597,8 @@ static struct platform_driver mxc_gpio_driver = { |
1610 |
+ |
1611 |
+ static int __init gpio_mxc_init(void) |
1612 |
+ { |
1613 |
++ register_syscore_ops(&mxc_gpio_syscore_ops); |
1614 |
++ |
1615 |
+ return platform_driver_register(&mxc_gpio_driver); |
1616 |
+ } |
1617 |
+ subsys_initcall(gpio_mxc_init); |
1618 |
+diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c |
1619 |
+index 39bf2ce548c6..7f6af421d3e9 100644 |
1620 |
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c |
1621 |
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c |
1622 |
+@@ -1653,8 +1653,10 @@ static int amdgpu_device_ip_init(struct amdgpu_device *adev) |
1623 |
+ |
1624 |
+ amdgpu_amdkfd_device_init(adev); |
1625 |
+ |
1626 |
+- if (amdgpu_sriov_vf(adev)) |
1627 |
++ if (amdgpu_sriov_vf(adev)) { |
1628 |
++ amdgpu_virt_init_data_exchange(adev); |
1629 |
+ amdgpu_virt_release_full_gpu(adev, true); |
1630 |
++ } |
1631 |
+ |
1632 |
+ return 0; |
1633 |
+ } |
1634 |
+@@ -2555,9 +2557,6 @@ fence_driver_init: |
1635 |
+ goto failed; |
1636 |
+ } |
1637 |
+ |
1638 |
+- if (amdgpu_sriov_vf(adev)) |
1639 |
+- amdgpu_virt_init_data_exchange(adev); |
1640 |
+- |
1641 |
+ amdgpu_fbdev_init(adev); |
1642 |
+ |
1643 |
+ r = amdgpu_pm_sysfs_init(adev); |
1644 |
+@@ -3269,6 +3268,7 @@ static int amdgpu_device_reset_sriov(struct amdgpu_device *adev, |
1645 |
+ r = amdgpu_ib_ring_tests(adev); |
1646 |
+ |
1647 |
+ error: |
1648 |
++ amdgpu_virt_init_data_exchange(adev); |
1649 |
+ amdgpu_virt_release_full_gpu(adev, true); |
1650 |
+ if (!r && adev->virt.gim_feature & AMDGIM_FEATURE_GIM_FLR_VRAMLOST) { |
1651 |
+ atomic_inc(&adev->vram_lost_counter); |
1652 |
+diff --git a/drivers/gpu/drm/amd/amdgpu/mxgpu_ai.c b/drivers/gpu/drm/amd/amdgpu/mxgpu_ai.c |
1653 |
+index 078f70faedcb..d06332be59d3 100644 |
1654 |
+--- a/drivers/gpu/drm/amd/amdgpu/mxgpu_ai.c |
1655 |
++++ b/drivers/gpu/drm/amd/amdgpu/mxgpu_ai.c |
1656 |
+@@ -174,7 +174,7 @@ static int xgpu_ai_send_access_requests(struct amdgpu_device *adev, |
1657 |
+ return r; |
1658 |
+ } |
1659 |
+ /* Retrieve checksum from mailbox2 */ |
1660 |
+- if (req == IDH_REQ_GPU_INIT_ACCESS) { |
1661 |
++ if (req == IDH_REQ_GPU_INIT_ACCESS || req == IDH_REQ_GPU_RESET_ACCESS) { |
1662 |
+ adev->virt.fw_reserve.checksum_key = |
1663 |
+ RREG32_NO_KIQ(SOC15_REG_OFFSET(NBIO, 0, |
1664 |
+ mmBIF_BX_PF0_MAILBOX_MSGBUF_RCV_DW2)); |
1665 |
+diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c b/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c |
1666 |
+index 7c3b634d8d5f..de5a689e1925 100644 |
1667 |
+--- a/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c |
1668 |
++++ b/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c |
1669 |
+@@ -71,7 +71,6 @@ static const struct soc15_reg_golden golden_settings_sdma_4[] = { |
1670 |
+ SOC15_REG_GOLDEN_VALUE(SDMA0, 0, mmSDMA0_RLC1_RB_WPTR_POLL_CNTL, 0x0000fff0, 0x00403000), |
1671 |
+ SOC15_REG_GOLDEN_VALUE(SDMA0, 0, mmSDMA0_UTCL1_PAGE, 0x000003ff, 0x000003c0), |
1672 |
+ SOC15_REG_GOLDEN_VALUE(SDMA0, 0, mmSDMA0_UTCL1_WATERMK, 0xfc000000, 0x00000000), |
1673 |
+- SOC15_REG_GOLDEN_VALUE(SDMA1, 0, mmSDMA1_CHICKEN_BITS, 0xfe931f07, 0x02831f07), |
1674 |
+ SOC15_REG_GOLDEN_VALUE(SDMA1, 0, mmSDMA1_CLK_CTRL, 0xffffffff, 0x3f000100), |
1675 |
+ SOC15_REG_GOLDEN_VALUE(SDMA1, 0, mmSDMA1_GFX_IB_CNTL, 0x800f0100, 0x00000100), |
1676 |
+ SOC15_REG_GOLDEN_VALUE(SDMA1, 0, mmSDMA1_GFX_RB_WPTR_POLL_CNTL, 0x0000fff0, 0x00403000), |
1677 |
+@@ -89,6 +88,7 @@ static const struct soc15_reg_golden golden_settings_sdma_4[] = { |
1678 |
+ static const struct soc15_reg_golden golden_settings_sdma_vg10[] = { |
1679 |
+ SOC15_REG_GOLDEN_VALUE(SDMA0, 0, mmSDMA0_GB_ADDR_CONFIG, 0x0018773f, 0x00104002), |
1680 |
+ SOC15_REG_GOLDEN_VALUE(SDMA0, 0, mmSDMA0_GB_ADDR_CONFIG_READ, 0x0018773f, 0x00104002), |
1681 |
++ SOC15_REG_GOLDEN_VALUE(SDMA1, 0, mmSDMA1_CHICKEN_BITS, 0xfe931f07, 0x02831d07), |
1682 |
+ SOC15_REG_GOLDEN_VALUE(SDMA1, 0, mmSDMA1_GB_ADDR_CONFIG, 0x0018773f, 0x00104002), |
1683 |
+ SOC15_REG_GOLDEN_VALUE(SDMA1, 0, mmSDMA1_GB_ADDR_CONFIG_READ, 0x0018773f, 0x00104002) |
1684 |
+ }; |
1685 |
+@@ -96,6 +96,7 @@ static const struct soc15_reg_golden golden_settings_sdma_vg10[] = { |
1686 |
+ static const struct soc15_reg_golden golden_settings_sdma_vg12[] = { |
1687 |
+ SOC15_REG_GOLDEN_VALUE(SDMA0, 0, mmSDMA0_GB_ADDR_CONFIG, 0x0018773f, 0x00104001), |
1688 |
+ SOC15_REG_GOLDEN_VALUE(SDMA0, 0, mmSDMA0_GB_ADDR_CONFIG_READ, 0x0018773f, 0x00104001), |
1689 |
++ SOC15_REG_GOLDEN_VALUE(SDMA1, 0, mmSDMA1_CHICKEN_BITS, 0xfe931f07, 0x02831d07), |
1690 |
+ SOC15_REG_GOLDEN_VALUE(SDMA1, 0, mmSDMA1_GB_ADDR_CONFIG, 0x0018773f, 0x00104001), |
1691 |
+ SOC15_REG_GOLDEN_VALUE(SDMA1, 0, mmSDMA1_GB_ADDR_CONFIG_READ, 0x0018773f, 0x00104001) |
1692 |
+ }; |
1693 |
+diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc358767.c |
1694 |
+index 8e28e738cb52..391547358756 100644 |
1695 |
+--- a/drivers/gpu/drm/bridge/tc358767.c |
1696 |
++++ b/drivers/gpu/drm/bridge/tc358767.c |
1697 |
+@@ -98,6 +98,8 @@ |
1698 |
+ #define DP0_STARTVAL 0x064c |
1699 |
+ #define DP0_ACTIVEVAL 0x0650 |
1700 |
+ #define DP0_SYNCVAL 0x0654 |
1701 |
++#define SYNCVAL_HS_POL_ACTIVE_LOW (1 << 15) |
1702 |
++#define SYNCVAL_VS_POL_ACTIVE_LOW (1 << 31) |
1703 |
+ #define DP0_MISC 0x0658 |
1704 |
+ #define TU_SIZE_RECOMMENDED (63) /* LSCLK cycles per TU */ |
1705 |
+ #define BPC_6 (0 << 5) |
1706 |
+@@ -142,6 +144,8 @@ |
1707 |
+ #define DP0_LTLOOPCTRL 0x06d8 |
1708 |
+ #define DP0_SNKLTCTRL 0x06e4 |
1709 |
+ |
1710 |
++#define DP1_SRCCTRL 0x07a0 |
1711 |
++ |
1712 |
+ /* PHY */ |
1713 |
+ #define DP_PHY_CTRL 0x0800 |
1714 |
+ #define DP_PHY_RST BIT(28) /* DP PHY Global Soft Reset */ |
1715 |
+@@ -150,6 +154,7 @@ |
1716 |
+ #define PHY_M1_RST BIT(12) /* Reset PHY1 Main Channel */ |
1717 |
+ #define PHY_RDY BIT(16) /* PHY Main Channels Ready */ |
1718 |
+ #define PHY_M0_RST BIT(8) /* Reset PHY0 Main Channel */ |
1719 |
++#define PHY_2LANE BIT(2) /* PHY Enable 2 lanes */ |
1720 |
+ #define PHY_A0_EN BIT(1) /* PHY Aux Channel0 Enable */ |
1721 |
+ #define PHY_M0_EN BIT(0) /* PHY Main Channel0 Enable */ |
1722 |
+ |
1723 |
+@@ -540,6 +545,7 @@ static int tc_aux_link_setup(struct tc_data *tc) |
1724 |
+ unsigned long rate; |
1725 |
+ u32 value; |
1726 |
+ int ret; |
1727 |
++ u32 dp_phy_ctrl; |
1728 |
+ |
1729 |
+ rate = clk_get_rate(tc->refclk); |
1730 |
+ switch (rate) { |
1731 |
+@@ -564,7 +570,10 @@ static int tc_aux_link_setup(struct tc_data *tc) |
1732 |
+ value |= SYSCLK_SEL_LSCLK | LSCLK_DIV_2; |
1733 |
+ tc_write(SYS_PLLPARAM, value); |
1734 |
+ |
1735 |
+- tc_write(DP_PHY_CTRL, BGREN | PWR_SW_EN | BIT(2) | PHY_A0_EN); |
1736 |
++ dp_phy_ctrl = BGREN | PWR_SW_EN | PHY_A0_EN; |
1737 |
++ if (tc->link.base.num_lanes == 2) |
1738 |
++ dp_phy_ctrl |= PHY_2LANE; |
1739 |
++ tc_write(DP_PHY_CTRL, dp_phy_ctrl); |
1740 |
+ |
1741 |
+ /* |
1742 |
+ * Initially PLLs are in bypass. Force PLL parameter update, |
1743 |
+@@ -719,7 +728,9 @@ static int tc_set_video_mode(struct tc_data *tc, struct drm_display_mode *mode) |
1744 |
+ |
1745 |
+ tc_write(DP0_ACTIVEVAL, (mode->vdisplay << 16) | (mode->hdisplay)); |
1746 |
+ |
1747 |
+- tc_write(DP0_SYNCVAL, (vsync_len << 16) | (hsync_len << 0)); |
1748 |
++ tc_write(DP0_SYNCVAL, (vsync_len << 16) | (hsync_len << 0) | |
1749 |
++ ((mode->flags & DRM_MODE_FLAG_NHSYNC) ? SYNCVAL_HS_POL_ACTIVE_LOW : 0) | |
1750 |
++ ((mode->flags & DRM_MODE_FLAG_NVSYNC) ? SYNCVAL_VS_POL_ACTIVE_LOW : 0)); |
1751 |
+ |
1752 |
+ tc_write(DPIPXLFMT, VS_POL_ACTIVE_LOW | HS_POL_ACTIVE_LOW | |
1753 |
+ DE_POL_ACTIVE_HIGH | SUB_CFG_TYPE_CONFIG1 | DPI_BPP_RGB888); |
1754 |
+@@ -829,12 +840,11 @@ static int tc_main_link_setup(struct tc_data *tc) |
1755 |
+ if (!tc->mode) |
1756 |
+ return -EINVAL; |
1757 |
+ |
1758 |
+- /* from excel file - DP0_SrcCtrl */ |
1759 |
+- tc_write(DP0_SRCCTRL, DP0_SRCCTRL_SCRMBLDIS | DP0_SRCCTRL_EN810B | |
1760 |
+- DP0_SRCCTRL_LANESKEW | DP0_SRCCTRL_LANES_2 | |
1761 |
+- DP0_SRCCTRL_BW27 | DP0_SRCCTRL_AUTOCORRECT); |
1762 |
+- /* from excel file - DP1_SrcCtrl */ |
1763 |
+- tc_write(0x07a0, 0x00003083); |
1764 |
++ tc_write(DP0_SRCCTRL, tc_srcctrl(tc)); |
1765 |
++ /* SSCG and BW27 on DP1 must be set to the same as on DP0 */ |
1766 |
++ tc_write(DP1_SRCCTRL, |
1767 |
++ (tc->link.spread ? DP0_SRCCTRL_SSCG : 0) | |
1768 |
++ ((tc->link.base.rate != 162000) ? DP0_SRCCTRL_BW27 : 0)); |
1769 |
+ |
1770 |
+ rate = clk_get_rate(tc->refclk); |
1771 |
+ switch (rate) { |
1772 |
+@@ -855,8 +865,11 @@ static int tc_main_link_setup(struct tc_data *tc) |
1773 |
+ } |
1774 |
+ value |= SYSCLK_SEL_LSCLK | LSCLK_DIV_2; |
1775 |
+ tc_write(SYS_PLLPARAM, value); |
1776 |
++ |
1777 |
+ /* Setup Main Link */ |
1778 |
+- dp_phy_ctrl = BGREN | PWR_SW_EN | BIT(2) | PHY_A0_EN | PHY_M0_EN; |
1779 |
++ dp_phy_ctrl = BGREN | PWR_SW_EN | PHY_A0_EN | PHY_M0_EN; |
1780 |
++ if (tc->link.base.num_lanes == 2) |
1781 |
++ dp_phy_ctrl |= PHY_2LANE; |
1782 |
+ tc_write(DP_PHY_CTRL, dp_phy_ctrl); |
1783 |
+ msleep(100); |
1784 |
+ |
1785 |
+@@ -1105,10 +1118,20 @@ static bool tc_bridge_mode_fixup(struct drm_bridge *bridge, |
1786 |
+ static enum drm_mode_status tc_connector_mode_valid(struct drm_connector *connector, |
1787 |
+ struct drm_display_mode *mode) |
1788 |
+ { |
1789 |
++ struct tc_data *tc = connector_to_tc(connector); |
1790 |
++ u32 req, avail; |
1791 |
++ u32 bits_per_pixel = 24; |
1792 |
++ |
1793 |
+ /* DPI interface clock limitation: upto 154 MHz */ |
1794 |
+ if (mode->clock > 154000) |
1795 |
+ return MODE_CLOCK_HIGH; |
1796 |
+ |
1797 |
++ req = mode->clock * bits_per_pixel / 8; |
1798 |
++ avail = tc->link.base.num_lanes * tc->link.base.rate; |
1799 |
++ |
1800 |
++ if (req > avail) |
1801 |
++ return MODE_BAD; |
1802 |
++ |
1803 |
+ return MODE_OK; |
1804 |
+ } |
1805 |
+ |
1806 |
+@@ -1195,6 +1218,10 @@ static int tc_bridge_attach(struct drm_bridge *bridge) |
1807 |
+ |
1808 |
+ drm_display_info_set_bus_formats(&tc->connector.display_info, |
1809 |
+ &bus_format, 1); |
1810 |
++ tc->connector.display_info.bus_flags = |
1811 |
++ DRM_BUS_FLAG_DE_HIGH | |
1812 |
++ DRM_BUS_FLAG_PIXDATA_NEGEDGE | |
1813 |
++ DRM_BUS_FLAG_SYNC_NEGEDGE; |
1814 |
+ drm_connector_attach_encoder(&tc->connector, tc->bridge.encoder); |
1815 |
+ |
1816 |
+ return 0; |
1817 |
+diff --git a/drivers/gpu/drm/drm_lease.c b/drivers/gpu/drm/drm_lease.c |
1818 |
+index fe6bfaf8b53f..086f2adc541b 100644 |
1819 |
+--- a/drivers/gpu/drm/drm_lease.c |
1820 |
++++ b/drivers/gpu/drm/drm_lease.c |
1821 |
+@@ -521,7 +521,8 @@ int drm_mode_create_lease_ioctl(struct drm_device *dev, |
1822 |
+ |
1823 |
+ object_count = cl->object_count; |
1824 |
+ |
1825 |
+- object_ids = memdup_user(u64_to_user_ptr(cl->object_ids), object_count * sizeof(__u32)); |
1826 |
++ object_ids = memdup_user(u64_to_user_ptr(cl->object_ids), |
1827 |
++ array_size(object_count, sizeof(__u32))); |
1828 |
+ if (IS_ERR(object_ids)) |
1829 |
+ return PTR_ERR(object_ids); |
1830 |
+ |
1831 |
+diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c |
1832 |
+index 47cc932e23a7..280c851714e6 100644 |
1833 |
+--- a/drivers/gpu/drm/i915/i915_gem.c |
1834 |
++++ b/drivers/gpu/drm/i915/i915_gem.c |
1835 |
+@@ -1821,6 +1821,16 @@ i915_gem_sw_finish_ioctl(struct drm_device *dev, void *data, |
1836 |
+ return 0; |
1837 |
+ } |
1838 |
+ |
1839 |
++static inline bool |
1840 |
++__vma_matches(struct vm_area_struct *vma, struct file *filp, |
1841 |
++ unsigned long addr, unsigned long size) |
1842 |
++{ |
1843 |
++ if (vma->vm_file != filp) |
1844 |
++ return false; |
1845 |
++ |
1846 |
++ return vma->vm_start == addr && (vma->vm_end - vma->vm_start) == size; |
1847 |
++} |
1848 |
++ |
1849 |
+ /** |
1850 |
+ * i915_gem_mmap_ioctl - Maps the contents of an object, returning the address |
1851 |
+ * it is mapped to. |
1852 |
+@@ -1879,7 +1889,7 @@ i915_gem_mmap_ioctl(struct drm_device *dev, void *data, |
1853 |
+ return -EINTR; |
1854 |
+ } |
1855 |
+ vma = find_vma(mm, addr); |
1856 |
+- if (vma) |
1857 |
++ if (vma && __vma_matches(vma, obj->base.filp, addr, args->size)) |
1858 |
+ vma->vm_page_prot = |
1859 |
+ pgprot_writecombine(vm_get_page_prot(vma->vm_flags)); |
1860 |
+ else |
1861 |
+diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h |
1862 |
+index 8fc61e96754f..50d56498de77 100644 |
1863 |
+--- a/drivers/gpu/drm/i915/intel_drv.h |
1864 |
++++ b/drivers/gpu/drm/i915/intel_drv.h |
1865 |
+@@ -209,6 +209,16 @@ struct intel_fbdev { |
1866 |
+ unsigned long vma_flags; |
1867 |
+ async_cookie_t cookie; |
1868 |
+ int preferred_bpp; |
1869 |
++ |
1870 |
++ /* Whether or not fbdev hpd processing is temporarily suspended */ |
1871 |
++ bool hpd_suspended : 1; |
1872 |
++ /* Set when a hotplug was received while HPD processing was |
1873 |
++ * suspended |
1874 |
++ */ |
1875 |
++ bool hpd_waiting : 1; |
1876 |
++ |
1877 |
++ /* Protects hpd_suspended */ |
1878 |
++ struct mutex hpd_lock; |
1879 |
+ }; |
1880 |
+ |
1881 |
+ struct intel_encoder { |
1882 |
+diff --git a/drivers/gpu/drm/i915/intel_fbdev.c b/drivers/gpu/drm/i915/intel_fbdev.c |
1883 |
+index fb2f9fce34cd..2d6506c08bf7 100644 |
1884 |
+--- a/drivers/gpu/drm/i915/intel_fbdev.c |
1885 |
++++ b/drivers/gpu/drm/i915/intel_fbdev.c |
1886 |
+@@ -677,6 +677,7 @@ int intel_fbdev_init(struct drm_device *dev) |
1887 |
+ if (ifbdev == NULL) |
1888 |
+ return -ENOMEM; |
1889 |
+ |
1890 |
++ mutex_init(&ifbdev->hpd_lock); |
1891 |
+ drm_fb_helper_prepare(dev, &ifbdev->helper, &intel_fb_helper_funcs); |
1892 |
+ |
1893 |
+ if (!intel_fbdev_init_bios(dev, ifbdev)) |
1894 |
+@@ -750,6 +751,26 @@ void intel_fbdev_fini(struct drm_i915_private *dev_priv) |
1895 |
+ intel_fbdev_destroy(ifbdev); |
1896 |
+ } |
1897 |
+ |
1898 |
++/* Suspends/resumes fbdev processing of incoming HPD events. When resuming HPD |
1899 |
++ * processing, fbdev will perform a full connector reprobe if a hotplug event |
1900 |
++ * was received while HPD was suspended. |
1901 |
++ */ |
1902 |
++static void intel_fbdev_hpd_set_suspend(struct intel_fbdev *ifbdev, int state) |
1903 |
++{ |
1904 |
++ bool send_hpd = false; |
1905 |
++ |
1906 |
++ mutex_lock(&ifbdev->hpd_lock); |
1907 |
++ ifbdev->hpd_suspended = state == FBINFO_STATE_SUSPENDED; |
1908 |
++ send_hpd = !ifbdev->hpd_suspended && ifbdev->hpd_waiting; |
1909 |
++ ifbdev->hpd_waiting = false; |
1910 |
++ mutex_unlock(&ifbdev->hpd_lock); |
1911 |
++ |
1912 |
++ if (send_hpd) { |
1913 |
++ DRM_DEBUG_KMS("Handling delayed fbcon HPD event\n"); |
1914 |
++ drm_fb_helper_hotplug_event(&ifbdev->helper); |
1915 |
++ } |
1916 |
++} |
1917 |
++ |
1918 |
+ void intel_fbdev_set_suspend(struct drm_device *dev, int state, bool synchronous) |
1919 |
+ { |
1920 |
+ struct drm_i915_private *dev_priv = to_i915(dev); |
1921 |
+@@ -771,6 +792,7 @@ void intel_fbdev_set_suspend(struct drm_device *dev, int state, bool synchronous |
1922 |
+ */ |
1923 |
+ if (state != FBINFO_STATE_RUNNING) |
1924 |
+ flush_work(&dev_priv->fbdev_suspend_work); |
1925 |
++ |
1926 |
+ console_lock(); |
1927 |
+ } else { |
1928 |
+ /* |
1929 |
+@@ -798,17 +820,26 @@ void intel_fbdev_set_suspend(struct drm_device *dev, int state, bool synchronous |
1930 |
+ |
1931 |
+ drm_fb_helper_set_suspend(&ifbdev->helper, state); |
1932 |
+ console_unlock(); |
1933 |
++ |
1934 |
++ intel_fbdev_hpd_set_suspend(ifbdev, state); |
1935 |
+ } |
1936 |
+ |
1937 |
+ void intel_fbdev_output_poll_changed(struct drm_device *dev) |
1938 |
+ { |
1939 |
+ struct intel_fbdev *ifbdev = to_i915(dev)->fbdev; |
1940 |
++ bool send_hpd; |
1941 |
+ |
1942 |
+ if (!ifbdev) |
1943 |
+ return; |
1944 |
+ |
1945 |
+ intel_fbdev_sync(ifbdev); |
1946 |
+- if (ifbdev->vma || ifbdev->helper.deferred_setup) |
1947 |
++ |
1948 |
++ mutex_lock(&ifbdev->hpd_lock); |
1949 |
++ send_hpd = !ifbdev->hpd_suspended; |
1950 |
++ ifbdev->hpd_waiting = true; |
1951 |
++ mutex_unlock(&ifbdev->hpd_lock); |
1952 |
++ |
1953 |
++ if (send_hpd && (ifbdev->vma || ifbdev->helper.deferred_setup)) |
1954 |
+ drm_fb_helper_hotplug_event(&ifbdev->helper); |
1955 |
+ } |
1956 |
+ |
1957 |
+diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/falcon.c b/drivers/gpu/drm/nouveau/nvkm/engine/falcon.c |
1958 |
+index 816ccaedfc73..8675613e142b 100644 |
1959 |
+--- a/drivers/gpu/drm/nouveau/nvkm/engine/falcon.c |
1960 |
++++ b/drivers/gpu/drm/nouveau/nvkm/engine/falcon.c |
1961 |
+@@ -22,6 +22,7 @@ |
1962 |
+ #include <engine/falcon.h> |
1963 |
+ |
1964 |
+ #include <core/gpuobj.h> |
1965 |
++#include <subdev/mc.h> |
1966 |
+ #include <subdev/timer.h> |
1967 |
+ #include <engine/fifo.h> |
1968 |
+ |
1969 |
+@@ -107,8 +108,10 @@ nvkm_falcon_fini(struct nvkm_engine *engine, bool suspend) |
1970 |
+ } |
1971 |
+ } |
1972 |
+ |
1973 |
+- nvkm_mask(device, base + 0x048, 0x00000003, 0x00000000); |
1974 |
+- nvkm_wr32(device, base + 0x014, 0xffffffff); |
1975 |
++ if (nvkm_mc_enabled(device, engine->subdev.index)) { |
1976 |
++ nvkm_mask(device, base + 0x048, 0x00000003, 0x00000000); |
1977 |
++ nvkm_wr32(device, base + 0x014, 0xffffffff); |
1978 |
++ } |
1979 |
+ return 0; |
1980 |
+ } |
1981 |
+ |
1982 |
+diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/therm/base.c b/drivers/gpu/drm/nouveau/nvkm/subdev/therm/base.c |
1983 |
+index 3695cde669f8..07914e36939e 100644 |
1984 |
+--- a/drivers/gpu/drm/nouveau/nvkm/subdev/therm/base.c |
1985 |
++++ b/drivers/gpu/drm/nouveau/nvkm/subdev/therm/base.c |
1986 |
+@@ -132,11 +132,12 @@ nvkm_therm_update(struct nvkm_therm *therm, int mode) |
1987 |
+ duty = nvkm_therm_update_linear(therm); |
1988 |
+ break; |
1989 |
+ case NVBIOS_THERM_FAN_OTHER: |
1990 |
+- if (therm->cstate) |
1991 |
++ if (therm->cstate) { |
1992 |
+ duty = therm->cstate; |
1993 |
+- else |
1994 |
++ poll = false; |
1995 |
++ } else { |
1996 |
+ duty = nvkm_therm_update_linear_fallback(therm); |
1997 |
+- poll = false; |
1998 |
++ } |
1999 |
+ break; |
2000 |
+ } |
2001 |
+ immd = false; |
2002 |
+diff --git a/drivers/gpu/drm/vkms/vkms_crtc.c b/drivers/gpu/drm/vkms/vkms_crtc.c |
2003 |
+index 875fca662ac0..1ea2dd35bca9 100644 |
2004 |
+--- a/drivers/gpu/drm/vkms/vkms_crtc.c |
2005 |
++++ b/drivers/gpu/drm/vkms/vkms_crtc.c |
2006 |
+@@ -1,10 +1,4 @@ |
2007 |
+-// SPDX-License-Identifier: GPL-2.0 |
2008 |
+-/* |
2009 |
+- * This program is free software; you can redistribute it and/or modify |
2010 |
+- * it under the terms of the GNU General Public License as published by |
2011 |
+- * the Free Software Foundation; either version 2 of the License, or |
2012 |
+- * (at your option) any later version. |
2013 |
+- */ |
2014 |
++// SPDX-License-Identifier: GPL-2.0+ |
2015 |
+ |
2016 |
+ #include "vkms_drv.h" |
2017 |
+ #include <drm/drm_atomic_helper.h> |
2018 |
+diff --git a/drivers/gpu/drm/vkms/vkms_drv.c b/drivers/gpu/drm/vkms/vkms_drv.c |
2019 |
+index 6e728b825259..b1201c18d3eb 100644 |
2020 |
+--- a/drivers/gpu/drm/vkms/vkms_drv.c |
2021 |
++++ b/drivers/gpu/drm/vkms/vkms_drv.c |
2022 |
+@@ -1,9 +1,4 @@ |
2023 |
+-/* |
2024 |
+- * This program is free software; you can redistribute it and/or modify |
2025 |
+- * it under the terms of the GNU General Public License as published by |
2026 |
+- * the Free Software Foundation; either version 2 of the License, or |
2027 |
+- * (at your option) any later version. |
2028 |
+- */ |
2029 |
++// SPDX-License-Identifier: GPL-2.0+ |
2030 |
+ |
2031 |
+ #include <linux/module.h> |
2032 |
+ #include <drm/drm_gem.h> |
2033 |
+diff --git a/drivers/gpu/drm/vkms/vkms_drv.h b/drivers/gpu/drm/vkms/vkms_drv.h |
2034 |
+index 07be29f2dc44..e018752d57bb 100644 |
2035 |
+--- a/drivers/gpu/drm/vkms/vkms_drv.h |
2036 |
++++ b/drivers/gpu/drm/vkms/vkms_drv.h |
2037 |
+@@ -1,3 +1,5 @@ |
2038 |
++/* SPDX-License-Identifier: GPL-2.0+ */ |
2039 |
++ |
2040 |
+ #ifndef _VKMS_DRV_H_ |
2041 |
+ #define _VKMS_DRV_H_ |
2042 |
+ |
2043 |
+diff --git a/drivers/gpu/drm/vkms/vkms_gem.c b/drivers/gpu/drm/vkms/vkms_gem.c |
2044 |
+index c7e38368602b..ca4a74e04977 100644 |
2045 |
+--- a/drivers/gpu/drm/vkms/vkms_gem.c |
2046 |
++++ b/drivers/gpu/drm/vkms/vkms_gem.c |
2047 |
+@@ -1,10 +1,4 @@ |
2048 |
+-// SPDX-License-Identifier: GPL-2.0 |
2049 |
+-/* |
2050 |
+- * This program is free software; you can redistribute it and/or modify |
2051 |
+- * it under the terms of the GNU General Public License as published by |
2052 |
+- * the Free Software Foundation; either version 2 of the License, or |
2053 |
+- * (at your option) any later version. |
2054 |
+- */ |
2055 |
++// SPDX-License-Identifier: GPL-2.0+ |
2056 |
+ |
2057 |
+ #include <linux/shmem_fs.h> |
2058 |
+ |
2059 |
+diff --git a/drivers/gpu/drm/vkms/vkms_output.c b/drivers/gpu/drm/vkms/vkms_output.c |
2060 |
+index 901012cb1af1..5697148e0b73 100644 |
2061 |
+--- a/drivers/gpu/drm/vkms/vkms_output.c |
2062 |
++++ b/drivers/gpu/drm/vkms/vkms_output.c |
2063 |
+@@ -1,10 +1,4 @@ |
2064 |
+-// SPDX-License-Identifier: GPL-2.0 |
2065 |
+-/* |
2066 |
+- * This program is free software; you can redistribute it and/or modify |
2067 |
+- * it under the terms of the GNU General Public License as published by |
2068 |
+- * the Free Software Foundation; either version 2 of the License, or |
2069 |
+- * (at your option) any later version. |
2070 |
+- */ |
2071 |
++// SPDX-License-Identifier: GPL-2.0+ |
2072 |
+ |
2073 |
+ #include "vkms_drv.h" |
2074 |
+ #include <drm/drm_crtc_helper.h> |
2075 |
+diff --git a/drivers/gpu/drm/vkms/vkms_plane.c b/drivers/gpu/drm/vkms/vkms_plane.c |
2076 |
+index 9f75b1e2c1c4..ce043b721e0c 100644 |
2077 |
+--- a/drivers/gpu/drm/vkms/vkms_plane.c |
2078 |
++++ b/drivers/gpu/drm/vkms/vkms_plane.c |
2079 |
+@@ -1,10 +1,4 @@ |
2080 |
+-// SPDX-License-Identifier: GPL-2.0 |
2081 |
+-/* |
2082 |
+- * This program is free software; you can redistribute it and/or modify |
2083 |
+- * it under the terms of the GNU General Public License as published by |
2084 |
+- * the Free Software Foundation; either version 2 of the License, or |
2085 |
+- * (at your option) any later version. |
2086 |
+- */ |
2087 |
++// SPDX-License-Identifier: GPL-2.0+ |
2088 |
+ |
2089 |
+ #include "vkms_drv.h" |
2090 |
+ #include <drm/drm_plane_helper.h> |
2091 |
+diff --git a/drivers/input/misc/bma150.c b/drivers/input/misc/bma150.c |
2092 |
+index 1efcfdf9f8a8..dd9dd4e40827 100644 |
2093 |
+--- a/drivers/input/misc/bma150.c |
2094 |
++++ b/drivers/input/misc/bma150.c |
2095 |
+@@ -481,13 +481,14 @@ static int bma150_register_input_device(struct bma150_data *bma150) |
2096 |
+ idev->close = bma150_irq_close; |
2097 |
+ input_set_drvdata(idev, bma150); |
2098 |
+ |
2099 |
++ bma150->input = idev; |
2100 |
++ |
2101 |
+ error = input_register_device(idev); |
2102 |
+ if (error) { |
2103 |
+ input_free_device(idev); |
2104 |
+ return error; |
2105 |
+ } |
2106 |
+ |
2107 |
+- bma150->input = idev; |
2108 |
+ return 0; |
2109 |
+ } |
2110 |
+ |
2111 |
+@@ -510,15 +511,15 @@ static int bma150_register_polled_device(struct bma150_data *bma150) |
2112 |
+ |
2113 |
+ bma150_init_input_device(bma150, ipoll_dev->input); |
2114 |
+ |
2115 |
++ bma150->input_polled = ipoll_dev; |
2116 |
++ bma150->input = ipoll_dev->input; |
2117 |
++ |
2118 |
+ error = input_register_polled_device(ipoll_dev); |
2119 |
+ if (error) { |
2120 |
+ input_free_polled_device(ipoll_dev); |
2121 |
+ return error; |
2122 |
+ } |
2123 |
+ |
2124 |
+- bma150->input_polled = ipoll_dev; |
2125 |
+- bma150->input = ipoll_dev->input; |
2126 |
+- |
2127 |
+ return 0; |
2128 |
+ } |
2129 |
+ |
2130 |
+diff --git a/drivers/input/mouse/elan_i2c_core.c b/drivers/input/mouse/elan_i2c_core.c |
2131 |
+index f322a1768fbb..225ae6980182 100644 |
2132 |
+--- a/drivers/input/mouse/elan_i2c_core.c |
2133 |
++++ b/drivers/input/mouse/elan_i2c_core.c |
2134 |
+@@ -1336,7 +1336,6 @@ MODULE_DEVICE_TABLE(i2c, elan_id); |
2135 |
+ static const struct acpi_device_id elan_acpi_id[] = { |
2136 |
+ { "ELAN0000", 0 }, |
2137 |
+ { "ELAN0100", 0 }, |
2138 |
+- { "ELAN0501", 0 }, |
2139 |
+ { "ELAN0600", 0 }, |
2140 |
+ { "ELAN0602", 0 }, |
2141 |
+ { "ELAN0605", 0 }, |
2142 |
+@@ -1346,6 +1345,7 @@ static const struct acpi_device_id elan_acpi_id[] = { |
2143 |
+ { "ELAN060C", 0 }, |
2144 |
+ { "ELAN0611", 0 }, |
2145 |
+ { "ELAN0612", 0 }, |
2146 |
++ { "ELAN0617", 0 }, |
2147 |
+ { "ELAN0618", 0 }, |
2148 |
+ { "ELAN061C", 0 }, |
2149 |
+ { "ELAN061D", 0 }, |
2150 |
+diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c |
2151 |
+index 9fe075c137dc..a7f8b1614559 100644 |
2152 |
+--- a/drivers/input/mouse/elantech.c |
2153 |
++++ b/drivers/input/mouse/elantech.c |
2154 |
+@@ -1119,6 +1119,8 @@ static int elantech_get_resolution_v4(struct psmouse *psmouse, |
2155 |
+ * Asus UX31 0x361f00 20, 15, 0e clickpad |
2156 |
+ * Asus UX32VD 0x361f02 00, 15, 0e clickpad |
2157 |
+ * Avatar AVIU-145A2 0x361f00 ? clickpad |
2158 |
++ * Fujitsu CELSIUS H760 0x570f02 40, 14, 0c 3 hw buttons (**) |
2159 |
++ * Fujitsu CELSIUS H780 0x5d0f02 41, 16, 0d 3 hw buttons (**) |
2160 |
+ * Fujitsu LIFEBOOK E544 0x470f00 d0, 12, 09 2 hw buttons |
2161 |
+ * Fujitsu LIFEBOOK E546 0x470f00 50, 12, 09 2 hw buttons |
2162 |
+ * Fujitsu LIFEBOOK E547 0x470f00 50, 12, 09 2 hw buttons |
2163 |
+@@ -1171,6 +1173,13 @@ static const struct dmi_system_id elantech_dmi_has_middle_button[] = { |
2164 |
+ DMI_MATCH(DMI_PRODUCT_NAME, "CELSIUS H760"), |
2165 |
+ }, |
2166 |
+ }, |
2167 |
++ { |
2168 |
++ /* Fujitsu H780 also has a middle button */ |
2169 |
++ .matches = { |
2170 |
++ DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"), |
2171 |
++ DMI_MATCH(DMI_PRODUCT_NAME, "CELSIUS H780"), |
2172 |
++ }, |
2173 |
++ }, |
2174 |
+ #endif |
2175 |
+ { } |
2176 |
+ }; |
2177 |
+diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c |
2178 |
+index 5921ecc670c1..f3dcc7640319 100644 |
2179 |
+--- a/drivers/md/dm-crypt.c |
2180 |
++++ b/drivers/md/dm-crypt.c |
2181 |
+@@ -932,7 +932,7 @@ static int dm_crypt_integrity_io_alloc(struct dm_crypt_io *io, struct bio *bio) |
2182 |
+ if (IS_ERR(bip)) |
2183 |
+ return PTR_ERR(bip); |
2184 |
+ |
2185 |
+- tag_len = io->cc->on_disk_tag_size * bio_sectors(bio); |
2186 |
++ tag_len = io->cc->on_disk_tag_size * (bio_sectors(bio) >> io->cc->sector_shift); |
2187 |
+ |
2188 |
+ bip->bip_iter.bi_size = tag_len; |
2189 |
+ bip->bip_iter.bi_sector = io->cc->start + io->sector; |
2190 |
+diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c |
2191 |
+index c30a7850b2da..cd4220ee7004 100644 |
2192 |
+--- a/drivers/md/dm-thin.c |
2193 |
++++ b/drivers/md/dm-thin.c |
2194 |
+@@ -257,6 +257,7 @@ struct pool { |
2195 |
+ |
2196 |
+ spinlock_t lock; |
2197 |
+ struct bio_list deferred_flush_bios; |
2198 |
++ struct bio_list deferred_flush_completions; |
2199 |
+ struct list_head prepared_mappings; |
2200 |
+ struct list_head prepared_discards; |
2201 |
+ struct list_head prepared_discards_pt2; |
2202 |
+@@ -956,6 +957,39 @@ static void process_prepared_mapping_fail(struct dm_thin_new_mapping *m) |
2203 |
+ mempool_free(m, &m->tc->pool->mapping_pool); |
2204 |
+ } |
2205 |
+ |
2206 |
++static void complete_overwrite_bio(struct thin_c *tc, struct bio *bio) |
2207 |
++{ |
2208 |
++ struct pool *pool = tc->pool; |
2209 |
++ unsigned long flags; |
2210 |
++ |
2211 |
++ /* |
2212 |
++ * If the bio has the REQ_FUA flag set we must commit the metadata |
2213 |
++ * before signaling its completion. |
2214 |
++ */ |
2215 |
++ if (!bio_triggers_commit(tc, bio)) { |
2216 |
++ bio_endio(bio); |
2217 |
++ return; |
2218 |
++ } |
2219 |
++ |
2220 |
++ /* |
2221 |
++ * Complete bio with an error if earlier I/O caused changes to the |
2222 |
++ * metadata that can't be committed, e.g, due to I/O errors on the |
2223 |
++ * metadata device. |
2224 |
++ */ |
2225 |
++ if (dm_thin_aborted_changes(tc->td)) { |
2226 |
++ bio_io_error(bio); |
2227 |
++ return; |
2228 |
++ } |
2229 |
++ |
2230 |
++ /* |
2231 |
++ * Batch together any bios that trigger commits and then issue a |
2232 |
++ * single commit for them in process_deferred_bios(). |
2233 |
++ */ |
2234 |
++ spin_lock_irqsave(&pool->lock, flags); |
2235 |
++ bio_list_add(&pool->deferred_flush_completions, bio); |
2236 |
++ spin_unlock_irqrestore(&pool->lock, flags); |
2237 |
++} |
2238 |
++ |
2239 |
+ static void process_prepared_mapping(struct dm_thin_new_mapping *m) |
2240 |
+ { |
2241 |
+ struct thin_c *tc = m->tc; |
2242 |
+@@ -988,7 +1022,7 @@ static void process_prepared_mapping(struct dm_thin_new_mapping *m) |
2243 |
+ */ |
2244 |
+ if (bio) { |
2245 |
+ inc_remap_and_issue_cell(tc, m->cell, m->data_block); |
2246 |
+- bio_endio(bio); |
2247 |
++ complete_overwrite_bio(tc, bio); |
2248 |
+ } else { |
2249 |
+ inc_all_io_entry(tc->pool, m->cell->holder); |
2250 |
+ remap_and_issue(tc, m->cell->holder, m->data_block); |
2251 |
+@@ -2317,7 +2351,7 @@ static void process_deferred_bios(struct pool *pool) |
2252 |
+ { |
2253 |
+ unsigned long flags; |
2254 |
+ struct bio *bio; |
2255 |
+- struct bio_list bios; |
2256 |
++ struct bio_list bios, bio_completions; |
2257 |
+ struct thin_c *tc; |
2258 |
+ |
2259 |
+ tc = get_first_thin(pool); |
2260 |
+@@ -2328,26 +2362,36 @@ static void process_deferred_bios(struct pool *pool) |
2261 |
+ } |
2262 |
+ |
2263 |
+ /* |
2264 |
+- * If there are any deferred flush bios, we must commit |
2265 |
+- * the metadata before issuing them. |
2266 |
++ * If there are any deferred flush bios, we must commit the metadata |
2267 |
++ * before issuing them or signaling their completion. |
2268 |
+ */ |
2269 |
+ bio_list_init(&bios); |
2270 |
++ bio_list_init(&bio_completions); |
2271 |
++ |
2272 |
+ spin_lock_irqsave(&pool->lock, flags); |
2273 |
+ bio_list_merge(&bios, &pool->deferred_flush_bios); |
2274 |
+ bio_list_init(&pool->deferred_flush_bios); |
2275 |
++ |
2276 |
++ bio_list_merge(&bio_completions, &pool->deferred_flush_completions); |
2277 |
++ bio_list_init(&pool->deferred_flush_completions); |
2278 |
+ spin_unlock_irqrestore(&pool->lock, flags); |
2279 |
+ |
2280 |
+- if (bio_list_empty(&bios) && |
2281 |
++ if (bio_list_empty(&bios) && bio_list_empty(&bio_completions) && |
2282 |
+ !(dm_pool_changed_this_transaction(pool->pmd) && need_commit_due_to_time(pool))) |
2283 |
+ return; |
2284 |
+ |
2285 |
+ if (commit(pool)) { |
2286 |
++ bio_list_merge(&bios, &bio_completions); |
2287 |
++ |
2288 |
+ while ((bio = bio_list_pop(&bios))) |
2289 |
+ bio_io_error(bio); |
2290 |
+ return; |
2291 |
+ } |
2292 |
+ pool->last_commit_jiffies = jiffies; |
2293 |
+ |
2294 |
++ while ((bio = bio_list_pop(&bio_completions))) |
2295 |
++ bio_endio(bio); |
2296 |
++ |
2297 |
+ while ((bio = bio_list_pop(&bios))) |
2298 |
+ generic_make_request(bio); |
2299 |
+ } |
2300 |
+@@ -2954,6 +2998,7 @@ static struct pool *pool_create(struct mapped_device *pool_md, |
2301 |
+ INIT_DELAYED_WORK(&pool->no_space_timeout, do_no_space_timeout); |
2302 |
+ spin_lock_init(&pool->lock); |
2303 |
+ bio_list_init(&pool->deferred_flush_bios); |
2304 |
++ bio_list_init(&pool->deferred_flush_completions); |
2305 |
+ INIT_LIST_HEAD(&pool->prepared_mappings); |
2306 |
+ INIT_LIST_HEAD(&pool->prepared_discards); |
2307 |
+ INIT_LIST_HEAD(&pool->prepared_discards_pt2); |
2308 |
+diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c |
2309 |
+index 1d54109071cc..fa47249fa3e4 100644 |
2310 |
+--- a/drivers/md/raid1.c |
2311 |
++++ b/drivers/md/raid1.c |
2312 |
+@@ -1863,6 +1863,20 @@ static void end_sync_read(struct bio *bio) |
2313 |
+ reschedule_retry(r1_bio); |
2314 |
+ } |
2315 |
+ |
2316 |
++static void abort_sync_write(struct mddev *mddev, struct r1bio *r1_bio) |
2317 |
++{ |
2318 |
++ sector_t sync_blocks = 0; |
2319 |
++ sector_t s = r1_bio->sector; |
2320 |
++ long sectors_to_go = r1_bio->sectors; |
2321 |
++ |
2322 |
++ /* make sure these bits don't get cleared. */ |
2323 |
++ do { |
2324 |
++ md_bitmap_end_sync(mddev->bitmap, s, &sync_blocks, 1); |
2325 |
++ s += sync_blocks; |
2326 |
++ sectors_to_go -= sync_blocks; |
2327 |
++ } while (sectors_to_go > 0); |
2328 |
++} |
2329 |
++ |
2330 |
+ static void end_sync_write(struct bio *bio) |
2331 |
+ { |
2332 |
+ int uptodate = !bio->bi_status; |
2333 |
+@@ -1874,15 +1888,7 @@ static void end_sync_write(struct bio *bio) |
2334 |
+ struct md_rdev *rdev = conf->mirrors[find_bio_disk(r1_bio, bio)].rdev; |
2335 |
+ |
2336 |
+ if (!uptodate) { |
2337 |
+- sector_t sync_blocks = 0; |
2338 |
+- sector_t s = r1_bio->sector; |
2339 |
+- long sectors_to_go = r1_bio->sectors; |
2340 |
+- /* make sure these bits doesn't get cleared. */ |
2341 |
+- do { |
2342 |
+- md_bitmap_end_sync(mddev->bitmap, s, &sync_blocks, 1); |
2343 |
+- s += sync_blocks; |
2344 |
+- sectors_to_go -= sync_blocks; |
2345 |
+- } while (sectors_to_go > 0); |
2346 |
++ abort_sync_write(mddev, r1_bio); |
2347 |
+ set_bit(WriteErrorSeen, &rdev->flags); |
2348 |
+ if (!test_and_set_bit(WantReplacement, &rdev->flags)) |
2349 |
+ set_bit(MD_RECOVERY_NEEDED, & |
2350 |
+@@ -2172,8 +2178,10 @@ static void sync_request_write(struct mddev *mddev, struct r1bio *r1_bio) |
2351 |
+ (i == r1_bio->read_disk || |
2352 |
+ !test_bit(MD_RECOVERY_SYNC, &mddev->recovery)))) |
2353 |
+ continue; |
2354 |
+- if (test_bit(Faulty, &conf->mirrors[i].rdev->flags)) |
2355 |
++ if (test_bit(Faulty, &conf->mirrors[i].rdev->flags)) { |
2356 |
++ abort_sync_write(mddev, r1_bio); |
2357 |
+ continue; |
2358 |
++ } |
2359 |
+ |
2360 |
+ bio_set_op_attrs(wbio, REQ_OP_WRITE, 0); |
2361 |
+ if (test_bit(FailFast, &conf->mirrors[i].rdev->flags)) |
2362 |
+diff --git a/drivers/misc/eeprom/Kconfig b/drivers/misc/eeprom/Kconfig |
2363 |
+index 68a1ac929917..d382b13c27dd 100644 |
2364 |
+--- a/drivers/misc/eeprom/Kconfig |
2365 |
++++ b/drivers/misc/eeprom/Kconfig |
2366 |
+@@ -13,7 +13,7 @@ config EEPROM_AT24 |
2367 |
+ ones like at24c64, 24lc02 or fm24c04: |
2368 |
+ |
2369 |
+ 24c00, 24c01, 24c02, spd (readonly 24c02), 24c04, 24c08, |
2370 |
+- 24c16, 24c32, 24c64, 24c128, 24c256, 24c512, 24c1024 |
2371 |
++ 24c16, 24c32, 24c64, 24c128, 24c256, 24c512, 24c1024, 24c2048 |
2372 |
+ |
2373 |
+ Unless you like data loss puzzles, always be sure that any chip |
2374 |
+ you configure as a 24c32 (32 kbit) or larger is NOT really a |
2375 |
+diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c |
2376 |
+index 7e50e1d6f58c..94836fcbe721 100644 |
2377 |
+--- a/drivers/misc/eeprom/at24.c |
2378 |
++++ b/drivers/misc/eeprom/at24.c |
2379 |
+@@ -173,6 +173,7 @@ AT24_CHIP_DATA(at24_data_24c128, 131072 / 8, AT24_FLAG_ADDR16); |
2380 |
+ AT24_CHIP_DATA(at24_data_24c256, 262144 / 8, AT24_FLAG_ADDR16); |
2381 |
+ AT24_CHIP_DATA(at24_data_24c512, 524288 / 8, AT24_FLAG_ADDR16); |
2382 |
+ AT24_CHIP_DATA(at24_data_24c1024, 1048576 / 8, AT24_FLAG_ADDR16); |
2383 |
++AT24_CHIP_DATA(at24_data_24c2048, 2097152 / 8, AT24_FLAG_ADDR16); |
2384 |
+ /* identical to 24c08 ? */ |
2385 |
+ AT24_CHIP_DATA(at24_data_INT3499, 8192 / 8, 0); |
2386 |
+ |
2387 |
+@@ -199,6 +200,7 @@ static const struct i2c_device_id at24_ids[] = { |
2388 |
+ { "24c256", (kernel_ulong_t)&at24_data_24c256 }, |
2389 |
+ { "24c512", (kernel_ulong_t)&at24_data_24c512 }, |
2390 |
+ { "24c1024", (kernel_ulong_t)&at24_data_24c1024 }, |
2391 |
++ { "24c2048", (kernel_ulong_t)&at24_data_24c2048 }, |
2392 |
+ { "at24", 0 }, |
2393 |
+ { /* END OF LIST */ } |
2394 |
+ }; |
2395 |
+@@ -227,6 +229,7 @@ static const struct of_device_id at24_of_match[] = { |
2396 |
+ { .compatible = "atmel,24c256", .data = &at24_data_24c256 }, |
2397 |
+ { .compatible = "atmel,24c512", .data = &at24_data_24c512 }, |
2398 |
+ { .compatible = "atmel,24c1024", .data = &at24_data_24c1024 }, |
2399 |
++ { .compatible = "atmel,24c2048", .data = &at24_data_24c2048 }, |
2400 |
+ { /* END OF LIST */ }, |
2401 |
+ }; |
2402 |
+ MODULE_DEVICE_TABLE(of, at24_of_match); |
2403 |
+diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c |
2404 |
+index f6755b86eba2..eee004fb3c3e 100644 |
2405 |
+--- a/drivers/mmc/core/block.c |
2406 |
++++ b/drivers/mmc/core/block.c |
2407 |
+@@ -2114,7 +2114,7 @@ static void mmc_blk_mq_req_done(struct mmc_request *mrq) |
2408 |
+ if (waiting) |
2409 |
+ wake_up(&mq->wait); |
2410 |
+ else |
2411 |
+- kblockd_schedule_work(&mq->complete_work); |
2412 |
++ queue_work(mq->card->complete_wq, &mq->complete_work); |
2413 |
+ |
2414 |
+ return; |
2415 |
+ } |
2416 |
+@@ -2928,6 +2928,13 @@ static int mmc_blk_probe(struct mmc_card *card) |
2417 |
+ |
2418 |
+ mmc_fixup_device(card, mmc_blk_fixups); |
2419 |
+ |
2420 |
++ card->complete_wq = alloc_workqueue("mmc_complete", |
2421 |
++ WQ_MEM_RECLAIM | WQ_HIGHPRI, 0); |
2422 |
++ if (unlikely(!card->complete_wq)) { |
2423 |
++ pr_err("Failed to create mmc completion workqueue"); |
2424 |
++ return -ENOMEM; |
2425 |
++ } |
2426 |
++ |
2427 |
+ md = mmc_blk_alloc(card); |
2428 |
+ if (IS_ERR(md)) |
2429 |
+ return PTR_ERR(md); |
2430 |
+@@ -2991,6 +2998,7 @@ static void mmc_blk_remove(struct mmc_card *card) |
2431 |
+ pm_runtime_put_noidle(&card->dev); |
2432 |
+ mmc_blk_remove_req(md); |
2433 |
+ dev_set_drvdata(&card->dev, NULL); |
2434 |
++ destroy_workqueue(card->complete_wq); |
2435 |
+ } |
2436 |
+ |
2437 |
+ static int _mmc_blk_suspend(struct mmc_card *card) |
2438 |
+diff --git a/drivers/mmc/host/sunxi-mmc.c b/drivers/mmc/host/sunxi-mmc.c |
2439 |
+index 568349e1fbc2..c4584184525f 100644 |
2440 |
+--- a/drivers/mmc/host/sunxi-mmc.c |
2441 |
++++ b/drivers/mmc/host/sunxi-mmc.c |
2442 |
+@@ -1394,6 +1394,21 @@ static int sunxi_mmc_probe(struct platform_device *pdev) |
2443 |
+ if (ret) |
2444 |
+ goto error_free_dma; |
2445 |
+ |
2446 |
++ /* |
2447 |
++ * If we don't support delay chains in the SoC, we can't use any |
2448 |
++ * of the higher speed modes. Mask them out in case the device |
2449 |
++ * tree specifies the properties for them, which gets added to |
2450 |
++ * the caps by mmc_of_parse() above. |
2451 |
++ */ |
2452 |
++ if (!(host->cfg->clk_delays || host->use_new_timings)) { |
2453 |
++ mmc->caps &= ~(MMC_CAP_3_3V_DDR | MMC_CAP_1_8V_DDR | |
2454 |
++ MMC_CAP_1_2V_DDR | MMC_CAP_UHS); |
2455 |
++ mmc->caps2 &= ~MMC_CAP2_HS200; |
2456 |
++ } |
2457 |
++ |
2458 |
++ /* TODO: This driver doesn't support HS400 mode yet */ |
2459 |
++ mmc->caps2 &= ~MMC_CAP2_HS400; |
2460 |
++ |
2461 |
+ ret = sunxi_mmc_init_host(host); |
2462 |
+ if (ret) |
2463 |
+ goto error_free_dma; |
2464 |
+diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c |
2465 |
+index e5bddae16ed4..e0d2b7473901 100644 |
2466 |
+--- a/drivers/nvme/host/core.c |
2467 |
++++ b/drivers/nvme/host/core.c |
2468 |
+@@ -2095,7 +2095,7 @@ static void nvme_init_subnqn(struct nvme_subsystem *subsys, struct nvme_ctrl *ct |
2469 |
+ |
2470 |
+ /* Generate a "fake" NQN per Figure 254 in NVMe 1.3 + ECN 001 */ |
2471 |
+ off = snprintf(subsys->subnqn, NVMF_NQN_SIZE, |
2472 |
+- "nqn.2014.08.org.nvmexpress:%4x%4x", |
2473 |
++ "nqn.2014.08.org.nvmexpress:%04x%04x", |
2474 |
+ le16_to_cpu(id->vid), le16_to_cpu(id->ssvid)); |
2475 |
+ memcpy(subsys->subnqn + off, id->sn, sizeof(id->sn)); |
2476 |
+ off += sizeof(id->sn); |
2477 |
+diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c |
2478 |
+index c27af277e14e..815509dbed84 100644 |
2479 |
+--- a/drivers/nvme/host/multipath.c |
2480 |
++++ b/drivers/nvme/host/multipath.c |
2481 |
+@@ -556,6 +556,7 @@ int nvme_mpath_init(struct nvme_ctrl *ctrl, struct nvme_id_ctrl *id) |
2482 |
+ return 0; |
2483 |
+ out_free_ana_log_buf: |
2484 |
+ kfree(ctrl->ana_log_buf); |
2485 |
++ ctrl->ana_log_buf = NULL; |
2486 |
+ out: |
2487 |
+ return error; |
2488 |
+ } |
2489 |
+@@ -563,5 +564,6 @@ out: |
2490 |
+ void nvme_mpath_uninit(struct nvme_ctrl *ctrl) |
2491 |
+ { |
2492 |
+ kfree(ctrl->ana_log_buf); |
2493 |
++ ctrl->ana_log_buf = NULL; |
2494 |
+ } |
2495 |
+ |
2496 |
+diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c |
2497 |
+index d668682f91df..f46313f441ec 100644 |
2498 |
+--- a/drivers/nvme/host/pci.c |
2499 |
++++ b/drivers/nvme/host/pci.c |
2500 |
+@@ -908,9 +908,11 @@ static void nvme_complete_cqes(struct nvme_queue *nvmeq, u16 start, u16 end) |
2501 |
+ |
2502 |
+ static inline void nvme_update_cq_head(struct nvme_queue *nvmeq) |
2503 |
+ { |
2504 |
+- if (++nvmeq->cq_head == nvmeq->q_depth) { |
2505 |
++ if (nvmeq->cq_head == nvmeq->q_depth - 1) { |
2506 |
+ nvmeq->cq_head = 0; |
2507 |
+ nvmeq->cq_phase = !nvmeq->cq_phase; |
2508 |
++ } else { |
2509 |
++ nvmeq->cq_head++; |
2510 |
+ } |
2511 |
+ } |
2512 |
+ |
2513 |
+@@ -1727,8 +1729,9 @@ static void nvme_free_host_mem(struct nvme_dev *dev) |
2514 |
+ struct nvme_host_mem_buf_desc *desc = &dev->host_mem_descs[i]; |
2515 |
+ size_t size = le32_to_cpu(desc->size) * dev->ctrl.page_size; |
2516 |
+ |
2517 |
+- dma_free_coherent(dev->dev, size, dev->host_mem_desc_bufs[i], |
2518 |
+- le64_to_cpu(desc->addr)); |
2519 |
++ dma_free_attrs(dev->dev, size, dev->host_mem_desc_bufs[i], |
2520 |
++ le64_to_cpu(desc->addr), |
2521 |
++ DMA_ATTR_NO_KERNEL_MAPPING | DMA_ATTR_NO_WARN); |
2522 |
+ } |
2523 |
+ |
2524 |
+ kfree(dev->host_mem_desc_bufs); |
2525 |
+@@ -1794,8 +1797,9 @@ out_free_bufs: |
2526 |
+ while (--i >= 0) { |
2527 |
+ size_t size = le32_to_cpu(descs[i].size) * dev->ctrl.page_size; |
2528 |
+ |
2529 |
+- dma_free_coherent(dev->dev, size, bufs[i], |
2530 |
+- le64_to_cpu(descs[i].addr)); |
2531 |
++ dma_free_attrs(dev->dev, size, bufs[i], |
2532 |
++ le64_to_cpu(descs[i].addr), |
2533 |
++ DMA_ATTR_NO_KERNEL_MAPPING | DMA_ATTR_NO_WARN); |
2534 |
+ } |
2535 |
+ |
2536 |
+ kfree(bufs); |
2537 |
+diff --git a/drivers/s390/crypto/ap_bus.c b/drivers/s390/crypto/ap_bus.c |
2538 |
+index f039266b275d..a57b969b8973 100644 |
2539 |
+--- a/drivers/s390/crypto/ap_bus.c |
2540 |
++++ b/drivers/s390/crypto/ap_bus.c |
2541 |
+@@ -249,7 +249,8 @@ static inline int ap_test_config(unsigned int *field, unsigned int nr) |
2542 |
+ static inline int ap_test_config_card_id(unsigned int id) |
2543 |
+ { |
2544 |
+ if (!ap_configuration) /* QCI not supported */ |
2545 |
+- return 1; |
2546 |
++ /* only ids 0...3F may be probed */ |
2547 |
++ return id < 0x40 ? 1 : 0; |
2548 |
+ return ap_test_config(ap_configuration->apm, id); |
2549 |
+ } |
2550 |
+ |
2551 |
+diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c |
2552 |
+index 0a27917263aa..58b78702c6c9 100644 |
2553 |
+--- a/drivers/scsi/sd.c |
2554 |
++++ b/drivers/scsi/sd.c |
2555 |
+@@ -2970,9 +2970,6 @@ static void sd_read_block_characteristics(struct scsi_disk *sdkp) |
2556 |
+ if (rot == 1) { |
2557 |
+ blk_queue_flag_set(QUEUE_FLAG_NONROT, q); |
2558 |
+ blk_queue_flag_clear(QUEUE_FLAG_ADD_RANDOM, q); |
2559 |
+- } else { |
2560 |
+- blk_queue_flag_clear(QUEUE_FLAG_NONROT, q); |
2561 |
+- blk_queue_flag_set(QUEUE_FLAG_ADD_RANDOM, q); |
2562 |
+ } |
2563 |
+ |
2564 |
+ if (sdkp->device->type == TYPE_ZBC) { |
2565 |
+@@ -3109,6 +3106,15 @@ static int sd_revalidate_disk(struct gendisk *disk) |
2566 |
+ if (sdkp->media_present) { |
2567 |
+ sd_read_capacity(sdkp, buffer); |
2568 |
+ |
2569 |
++ /* |
2570 |
++ * set the default to rotational. All non-rotational devices |
2571 |
++ * support the block characteristics VPD page, which will |
2572 |
++ * cause this to be updated correctly and any device which |
2573 |
++ * doesn't support it should be treated as rotational. |
2574 |
++ */ |
2575 |
++ blk_queue_flag_clear(QUEUE_FLAG_NONROT, q); |
2576 |
++ blk_queue_flag_set(QUEUE_FLAG_ADD_RANDOM, q); |
2577 |
++ |
2578 |
+ if (scsi_device_supports_vpd(sdp)) { |
2579 |
+ sd_read_block_provisioning(sdkp); |
2580 |
+ sd_read_block_limits(sdkp); |
2581 |
+diff --git a/fs/cifs/file.c b/fs/cifs/file.c |
2582 |
+index 7b637fc27990..23db881daab5 100644 |
2583 |
+--- a/fs/cifs/file.c |
2584 |
++++ b/fs/cifs/file.c |
2585 |
+@@ -1128,6 +1128,10 @@ cifs_push_mandatory_locks(struct cifsFileInfo *cfile) |
2586 |
+ return -EINVAL; |
2587 |
+ } |
2588 |
+ |
2589 |
++ BUILD_BUG_ON(sizeof(struct smb_hdr) + sizeof(LOCKING_ANDX_RANGE) > |
2590 |
++ PAGE_SIZE); |
2591 |
++ max_buf = min_t(unsigned int, max_buf - sizeof(struct smb_hdr), |
2592 |
++ PAGE_SIZE); |
2593 |
+ max_num = (max_buf - sizeof(struct smb_hdr)) / |
2594 |
+ sizeof(LOCKING_ANDX_RANGE); |
2595 |
+ buf = kcalloc(max_num, sizeof(LOCKING_ANDX_RANGE), GFP_KERNEL); |
2596 |
+@@ -1466,6 +1470,10 @@ cifs_unlock_range(struct cifsFileInfo *cfile, struct file_lock *flock, |
2597 |
+ if (max_buf < (sizeof(struct smb_hdr) + sizeof(LOCKING_ANDX_RANGE))) |
2598 |
+ return -EINVAL; |
2599 |
+ |
2600 |
++ BUILD_BUG_ON(sizeof(struct smb_hdr) + sizeof(LOCKING_ANDX_RANGE) > |
2601 |
++ PAGE_SIZE); |
2602 |
++ max_buf = min_t(unsigned int, max_buf - sizeof(struct smb_hdr), |
2603 |
++ PAGE_SIZE); |
2604 |
+ max_num = (max_buf - sizeof(struct smb_hdr)) / |
2605 |
+ sizeof(LOCKING_ANDX_RANGE); |
2606 |
+ buf = kcalloc(max_num, sizeof(LOCKING_ANDX_RANGE), GFP_KERNEL); |
2607 |
+diff --git a/fs/cifs/smb2file.c b/fs/cifs/smb2file.c |
2608 |
+index 2fc3d31967ee..b204e84b87fb 100644 |
2609 |
+--- a/fs/cifs/smb2file.c |
2610 |
++++ b/fs/cifs/smb2file.c |
2611 |
+@@ -128,6 +128,8 @@ smb2_unlock_range(struct cifsFileInfo *cfile, struct file_lock *flock, |
2612 |
+ if (max_buf < sizeof(struct smb2_lock_element)) |
2613 |
+ return -EINVAL; |
2614 |
+ |
2615 |
++ BUILD_BUG_ON(sizeof(struct smb2_lock_element) > PAGE_SIZE); |
2616 |
++ max_buf = min_t(unsigned int, max_buf, PAGE_SIZE); |
2617 |
+ max_num = max_buf / sizeof(struct smb2_lock_element); |
2618 |
+ buf = kcalloc(max_num, sizeof(struct smb2_lock_element), GFP_KERNEL); |
2619 |
+ if (!buf) |
2620 |
+@@ -264,6 +266,8 @@ smb2_push_mandatory_locks(struct cifsFileInfo *cfile) |
2621 |
+ return -EINVAL; |
2622 |
+ } |
2623 |
+ |
2624 |
++ BUILD_BUG_ON(sizeof(struct smb2_lock_element) > PAGE_SIZE); |
2625 |
++ max_buf = min_t(unsigned int, max_buf, PAGE_SIZE); |
2626 |
+ max_num = max_buf / sizeof(struct smb2_lock_element); |
2627 |
+ buf = kcalloc(max_num, sizeof(struct smb2_lock_element), GFP_KERNEL); |
2628 |
+ if (!buf) { |
2629 |
+diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c |
2630 |
+index 8a01e89ff827..1e5a1171212f 100644 |
2631 |
+--- a/fs/cifs/smb2pdu.c |
2632 |
++++ b/fs/cifs/smb2pdu.c |
2633 |
+@@ -2814,9 +2814,10 @@ smb2_echo_callback(struct mid_q_entry *mid) |
2634 |
+ { |
2635 |
+ struct TCP_Server_Info *server = mid->callback_data; |
2636 |
+ struct smb2_echo_rsp *rsp = (struct smb2_echo_rsp *)mid->resp_buf; |
2637 |
+- unsigned int credits_received = 1; |
2638 |
++ unsigned int credits_received = 0; |
2639 |
+ |
2640 |
+- if (mid->mid_state == MID_RESPONSE_RECEIVED) |
2641 |
++ if (mid->mid_state == MID_RESPONSE_RECEIVED |
2642 |
++ || mid->mid_state == MID_RESPONSE_MALFORMED) |
2643 |
+ credits_received = le16_to_cpu(rsp->sync_hdr.CreditRequest); |
2644 |
+ |
2645 |
+ DeleteMidQEntry(mid); |
2646 |
+@@ -3073,7 +3074,7 @@ smb2_readv_callback(struct mid_q_entry *mid) |
2647 |
+ struct TCP_Server_Info *server = tcon->ses->server; |
2648 |
+ struct smb2_sync_hdr *shdr = |
2649 |
+ (struct smb2_sync_hdr *)rdata->iov[0].iov_base; |
2650 |
+- unsigned int credits_received = 1; |
2651 |
++ unsigned int credits_received = 0; |
2652 |
+ struct smb_rqst rqst = { .rq_iov = rdata->iov, |
2653 |
+ .rq_nvec = 2, |
2654 |
+ .rq_pages = rdata->pages, |
2655 |
+@@ -3112,6 +3113,9 @@ smb2_readv_callback(struct mid_q_entry *mid) |
2656 |
+ task_io_account_read(rdata->got_bytes); |
2657 |
+ cifs_stats_bytes_read(tcon, rdata->got_bytes); |
2658 |
+ break; |
2659 |
++ case MID_RESPONSE_MALFORMED: |
2660 |
++ credits_received = le16_to_cpu(shdr->CreditRequest); |
2661 |
++ /* fall through */ |
2662 |
+ default: |
2663 |
+ if (rdata->result != -ENODATA) |
2664 |
+ rdata->result = -EIO; |
2665 |
+@@ -3305,7 +3309,7 @@ smb2_writev_callback(struct mid_q_entry *mid) |
2666 |
+ struct cifs_tcon *tcon = tlink_tcon(wdata->cfile->tlink); |
2667 |
+ unsigned int written; |
2668 |
+ struct smb2_write_rsp *rsp = (struct smb2_write_rsp *)mid->resp_buf; |
2669 |
+- unsigned int credits_received = 1; |
2670 |
++ unsigned int credits_received = 0; |
2671 |
+ |
2672 |
+ switch (mid->mid_state) { |
2673 |
+ case MID_RESPONSE_RECEIVED: |
2674 |
+@@ -3333,6 +3337,9 @@ smb2_writev_callback(struct mid_q_entry *mid) |
2675 |
+ case MID_RETRY_NEEDED: |
2676 |
+ wdata->result = -EAGAIN; |
2677 |
+ break; |
2678 |
++ case MID_RESPONSE_MALFORMED: |
2679 |
++ credits_received = le16_to_cpu(rsp->sync_hdr.CreditRequest); |
2680 |
++ /* fall through */ |
2681 |
+ default: |
2682 |
+ wdata->result = -EIO; |
2683 |
+ break; |
2684 |
+diff --git a/fs/inode.c b/fs/inode.c |
2685 |
+index 65ae154df760..42f6d25f32a5 100644 |
2686 |
+--- a/fs/inode.c |
2687 |
++++ b/fs/inode.c |
2688 |
+@@ -730,11 +730,8 @@ static enum lru_status inode_lru_isolate(struct list_head *item, |
2689 |
+ return LRU_REMOVED; |
2690 |
+ } |
2691 |
+ |
2692 |
+- /* |
2693 |
+- * Recently referenced inodes and inodes with many attached pages |
2694 |
+- * get one more pass. |
2695 |
+- */ |
2696 |
+- if (inode->i_state & I_REFERENCED || inode->i_data.nrpages > 1) { |
2697 |
++ /* recently referenced inodes get one more pass */ |
2698 |
++ if (inode->i_state & I_REFERENCED) { |
2699 |
+ inode->i_state &= ~I_REFERENCED; |
2700 |
+ spin_unlock(&inode->i_lock); |
2701 |
+ return LRU_ROTATE; |
2702 |
+diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c |
2703 |
+index 899174c7a8ae..39b835d7c445 100644 |
2704 |
+--- a/fs/nfsd/nfsctl.c |
2705 |
++++ b/fs/nfsd/nfsctl.c |
2706 |
+@@ -1239,8 +1239,8 @@ static __net_init int nfsd_init_net(struct net *net) |
2707 |
+ retval = nfsd_idmap_init(net); |
2708 |
+ if (retval) |
2709 |
+ goto out_idmap_error; |
2710 |
+- nn->nfsd4_lease = 45; /* default lease time */ |
2711 |
+- nn->nfsd4_grace = 45; |
2712 |
++ nn->nfsd4_lease = 90; /* default lease time */ |
2713 |
++ nn->nfsd4_grace = 90; |
2714 |
+ nn->somebody_reclaimed = false; |
2715 |
+ nn->clverifier_counter = prandom_u32(); |
2716 |
+ nn->clientid_counter = prandom_u32(); |
2717 |
+diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c |
2718 |
+index a027473561c6..d76fe166f6ce 100644 |
2719 |
+--- a/fs/proc/task_mmu.c |
2720 |
++++ b/fs/proc/task_mmu.c |
2721 |
+@@ -423,7 +423,7 @@ struct mem_size_stats { |
2722 |
+ }; |
2723 |
+ |
2724 |
+ static void smaps_account(struct mem_size_stats *mss, struct page *page, |
2725 |
+- bool compound, bool young, bool dirty) |
2726 |
++ bool compound, bool young, bool dirty, bool locked) |
2727 |
+ { |
2728 |
+ int i, nr = compound ? 1 << compound_order(page) : 1; |
2729 |
+ unsigned long size = nr * PAGE_SIZE; |
2730 |
+@@ -450,24 +450,31 @@ static void smaps_account(struct mem_size_stats *mss, struct page *page, |
2731 |
+ else |
2732 |
+ mss->private_clean += size; |
2733 |
+ mss->pss += (u64)size << PSS_SHIFT; |
2734 |
++ if (locked) |
2735 |
++ mss->pss_locked += (u64)size << PSS_SHIFT; |
2736 |
+ return; |
2737 |
+ } |
2738 |
+ |
2739 |
+ for (i = 0; i < nr; i++, page++) { |
2740 |
+ int mapcount = page_mapcount(page); |
2741 |
++ unsigned long pss = (PAGE_SIZE << PSS_SHIFT); |
2742 |
+ |
2743 |
+ if (mapcount >= 2) { |
2744 |
+ if (dirty || PageDirty(page)) |
2745 |
+ mss->shared_dirty += PAGE_SIZE; |
2746 |
+ else |
2747 |
+ mss->shared_clean += PAGE_SIZE; |
2748 |
+- mss->pss += (PAGE_SIZE << PSS_SHIFT) / mapcount; |
2749 |
++ mss->pss += pss / mapcount; |
2750 |
++ if (locked) |
2751 |
++ mss->pss_locked += pss / mapcount; |
2752 |
+ } else { |
2753 |
+ if (dirty || PageDirty(page)) |
2754 |
+ mss->private_dirty += PAGE_SIZE; |
2755 |
+ else |
2756 |
+ mss->private_clean += PAGE_SIZE; |
2757 |
+- mss->pss += PAGE_SIZE << PSS_SHIFT; |
2758 |
++ mss->pss += pss; |
2759 |
++ if (locked) |
2760 |
++ mss->pss_locked += pss; |
2761 |
+ } |
2762 |
+ } |
2763 |
+ } |
2764 |
+@@ -490,6 +497,7 @@ static void smaps_pte_entry(pte_t *pte, unsigned long addr, |
2765 |
+ { |
2766 |
+ struct mem_size_stats *mss = walk->private; |
2767 |
+ struct vm_area_struct *vma = walk->vma; |
2768 |
++ bool locked = !!(vma->vm_flags & VM_LOCKED); |
2769 |
+ struct page *page = NULL; |
2770 |
+ |
2771 |
+ if (pte_present(*pte)) { |
2772 |
+@@ -532,7 +540,7 @@ static void smaps_pte_entry(pte_t *pte, unsigned long addr, |
2773 |
+ if (!page) |
2774 |
+ return; |
2775 |
+ |
2776 |
+- smaps_account(mss, page, false, pte_young(*pte), pte_dirty(*pte)); |
2777 |
++ smaps_account(mss, page, false, pte_young(*pte), pte_dirty(*pte), locked); |
2778 |
+ } |
2779 |
+ |
2780 |
+ #ifdef CONFIG_TRANSPARENT_HUGEPAGE |
2781 |
+@@ -541,6 +549,7 @@ static void smaps_pmd_entry(pmd_t *pmd, unsigned long addr, |
2782 |
+ { |
2783 |
+ struct mem_size_stats *mss = walk->private; |
2784 |
+ struct vm_area_struct *vma = walk->vma; |
2785 |
++ bool locked = !!(vma->vm_flags & VM_LOCKED); |
2786 |
+ struct page *page; |
2787 |
+ |
2788 |
+ /* FOLL_DUMP will return -EFAULT on huge zero page */ |
2789 |
+@@ -555,7 +564,7 @@ static void smaps_pmd_entry(pmd_t *pmd, unsigned long addr, |
2790 |
+ /* pass */; |
2791 |
+ else |
2792 |
+ VM_BUG_ON_PAGE(1, page); |
2793 |
+- smaps_account(mss, page, true, pmd_young(*pmd), pmd_dirty(*pmd)); |
2794 |
++ smaps_account(mss, page, true, pmd_young(*pmd), pmd_dirty(*pmd), locked); |
2795 |
+ } |
2796 |
+ #else |
2797 |
+ static void smaps_pmd_entry(pmd_t *pmd, unsigned long addr, |
2798 |
+@@ -737,11 +746,8 @@ static void smap_gather_stats(struct vm_area_struct *vma, |
2799 |
+ } |
2800 |
+ } |
2801 |
+ #endif |
2802 |
+- |
2803 |
+ /* mmap_sem is held in m_start */ |
2804 |
+ walk_page_vma(vma, &smaps_walk); |
2805 |
+- if (vma->vm_flags & VM_LOCKED) |
2806 |
+- mss->pss_locked += mss->pss; |
2807 |
+ } |
2808 |
+ |
2809 |
+ #define SEQ_PUT_DEC(str, val) \ |
2810 |
+diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h |
2811 |
+index de7377815b6b..8ef330027b13 100644 |
2812 |
+--- a/include/linux/mmc/card.h |
2813 |
++++ b/include/linux/mmc/card.h |
2814 |
+@@ -308,6 +308,7 @@ struct mmc_card { |
2815 |
+ unsigned int nr_parts; |
2816 |
+ |
2817 |
+ unsigned int bouncesz; /* Bounce buffer size */ |
2818 |
++ struct workqueue_struct *complete_wq; /* Private workqueue */ |
2819 |
+ }; |
2820 |
+ |
2821 |
+ static inline bool mmc_large_sector(struct mmc_card *card) |
2822 |
+diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h |
2823 |
+index 53c500f0ca79..c2876e740514 100644 |
2824 |
+--- a/include/linux/perf_event.h |
2825 |
++++ b/include/linux/perf_event.h |
2826 |
+@@ -447,6 +447,11 @@ struct pmu { |
2827 |
+ * Filter events for PMU-specific reasons. |
2828 |
+ */ |
2829 |
+ int (*filter_match) (struct perf_event *event); /* optional */ |
2830 |
++ |
2831 |
++ /* |
2832 |
++ * Check period value for PERF_EVENT_IOC_PERIOD ioctl. |
2833 |
++ */ |
2834 |
++ int (*check_period) (struct perf_event *event, u64 value); /* optional */ |
2835 |
+ }; |
2836 |
+ |
2837 |
+ enum perf_addr_filter_action_t { |
2838 |
+diff --git a/kernel/events/core.c b/kernel/events/core.c |
2839 |
+index 5a97f34bc14c..4fb9d5054618 100644 |
2840 |
+--- a/kernel/events/core.c |
2841 |
++++ b/kernel/events/core.c |
2842 |
+@@ -4963,6 +4963,11 @@ static void __perf_event_period(struct perf_event *event, |
2843 |
+ } |
2844 |
+ } |
2845 |
+ |
2846 |
++static int perf_event_check_period(struct perf_event *event, u64 value) |
2847 |
++{ |
2848 |
++ return event->pmu->check_period(event, value); |
2849 |
++} |
2850 |
++ |
2851 |
+ static int perf_event_period(struct perf_event *event, u64 __user *arg) |
2852 |
+ { |
2853 |
+ u64 value; |
2854 |
+@@ -4979,6 +4984,9 @@ static int perf_event_period(struct perf_event *event, u64 __user *arg) |
2855 |
+ if (event->attr.freq && value > sysctl_perf_event_sample_rate) |
2856 |
+ return -EINVAL; |
2857 |
+ |
2858 |
++ if (perf_event_check_period(event, value)) |
2859 |
++ return -EINVAL; |
2860 |
++ |
2861 |
+ event_function_call(event, __perf_event_period, &value); |
2862 |
+ |
2863 |
+ return 0; |
2864 |
+@@ -9362,6 +9370,11 @@ static int perf_pmu_nop_int(struct pmu *pmu) |
2865 |
+ return 0; |
2866 |
+ } |
2867 |
+ |
2868 |
++static int perf_event_nop_int(struct perf_event *event, u64 value) |
2869 |
++{ |
2870 |
++ return 0; |
2871 |
++} |
2872 |
++ |
2873 |
+ static DEFINE_PER_CPU(unsigned int, nop_txn_flags); |
2874 |
+ |
2875 |
+ static void perf_pmu_start_txn(struct pmu *pmu, unsigned int flags) |
2876 |
+@@ -9662,6 +9675,9 @@ got_cpu_context: |
2877 |
+ pmu->pmu_disable = perf_pmu_nop_void; |
2878 |
+ } |
2879 |
+ |
2880 |
++ if (!pmu->check_period) |
2881 |
++ pmu->check_period = perf_event_nop_int; |
2882 |
++ |
2883 |
+ if (!pmu->event_idx) |
2884 |
+ pmu->event_idx = perf_event_idx_default; |
2885 |
+ |
2886 |
+diff --git a/kernel/events/ring_buffer.c b/kernel/events/ring_buffer.c |
2887 |
+index 51386d9105fa..5631af940316 100644 |
2888 |
+--- a/kernel/events/ring_buffer.c |
2889 |
++++ b/kernel/events/ring_buffer.c |
2890 |
+@@ -724,7 +724,7 @@ struct ring_buffer *rb_alloc(int nr_pages, long watermark, int cpu, int flags) |
2891 |
+ size = sizeof(struct ring_buffer); |
2892 |
+ size += nr_pages * sizeof(void *); |
2893 |
+ |
2894 |
+- if (order_base_2(size) >= MAX_ORDER) |
2895 |
++ if (order_base_2(size) >= PAGE_SHIFT+MAX_ORDER) |
2896 |
+ goto fail; |
2897 |
+ |
2898 |
+ rb = kzalloc(size, GFP_KERNEL); |
2899 |
+diff --git a/kernel/signal.c b/kernel/signal.c |
2900 |
+index c187def3dba6..9102d60fc5c6 100644 |
2901 |
+--- a/kernel/signal.c |
2902 |
++++ b/kernel/signal.c |
2903 |
+@@ -2433,9 +2433,12 @@ relock: |
2904 |
+ } |
2905 |
+ |
2906 |
+ /* Has this task already been marked for death? */ |
2907 |
+- ksig->info.si_signo = signr = SIGKILL; |
2908 |
+- if (signal_group_exit(signal)) |
2909 |
++ if (signal_group_exit(signal)) { |
2910 |
++ ksig->info.si_signo = signr = SIGKILL; |
2911 |
++ sigdelset(¤t->pending.signal, SIGKILL); |
2912 |
++ recalc_sigpending(); |
2913 |
+ goto fatal; |
2914 |
++ } |
2915 |
+ |
2916 |
+ for (;;) { |
2917 |
+ struct k_sigaction *ka; |
2918 |
+diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c |
2919 |
+index a6aebbc848fe..0da379b90249 100644 |
2920 |
+--- a/kernel/trace/trace_uprobe.c |
2921 |
++++ b/kernel/trace/trace_uprobe.c |
2922 |
+@@ -141,7 +141,14 @@ static void FETCH_FUNC_NAME(memory, string)(struct pt_regs *regs, |
2923 |
+ |
2924 |
+ ret = strncpy_from_user(dst, src, maxlen); |
2925 |
+ if (ret == maxlen) |
2926 |
+- dst[--ret] = '\0'; |
2927 |
++ dst[ret - 1] = '\0'; |
2928 |
++ else if (ret >= 0) |
2929 |
++ /* |
2930 |
++ * Include the terminating null byte. In this case it |
2931 |
++ * was copied by strncpy_from_user but not accounted |
2932 |
++ * for in ret. |
2933 |
++ */ |
2934 |
++ ret++; |
2935 |
+ |
2936 |
+ if (ret < 0) { /* Failed to fetch string */ |
2937 |
+ ((u8 *)get_rloc_data(dest))[0] = '\0'; |
2938 |
+diff --git a/mm/vmscan.c b/mm/vmscan.c |
2939 |
+index 961401c46334..3830066018c1 100644 |
2940 |
+--- a/mm/vmscan.c |
2941 |
++++ b/mm/vmscan.c |
2942 |
+@@ -477,16 +477,6 @@ static unsigned long do_shrink_slab(struct shrink_control *shrinkctl, |
2943 |
+ delta *= 4; |
2944 |
+ do_div(delta, shrinker->seeks); |
2945 |
+ |
2946 |
+- /* |
2947 |
+- * Make sure we apply some minimal pressure on default priority |
2948 |
+- * even on small cgroups. Stale objects are not only consuming memory |
2949 |
+- * by themselves, but can also hold a reference to a dying cgroup, |
2950 |
+- * preventing it from being reclaimed. A dying cgroup with all |
2951 |
+- * corresponding structures like per-cpu stats and kmem caches |
2952 |
+- * can be really big, so it may lead to a significant waste of memory. |
2953 |
+- */ |
2954 |
+- delta = max_t(unsigned long long, delta, min(freeable, batch_size)); |
2955 |
+- |
2956 |
+ total_scan += delta; |
2957 |
+ if (total_scan < 0) { |
2958 |
+ pr_err("shrink_slab: %pF negative objects to delete nr=%ld\n", |
2959 |
+diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c |
2960 |
+index 31a84a5a1338..fead0acb29f7 100644 |
2961 |
+--- a/sound/pci/hda/patch_conexant.c |
2962 |
++++ b/sound/pci/hda/patch_conexant.c |
2963 |
+@@ -924,6 +924,7 @@ static const struct snd_pci_quirk cxt5066_fixups[] = { |
2964 |
+ SND_PCI_QUIRK(0x103c, 0x807C, "HP EliteBook 820 G3", CXT_FIXUP_HP_DOCK), |
2965 |
+ SND_PCI_QUIRK(0x103c, 0x80FD, "HP ProBook 640 G2", CXT_FIXUP_HP_DOCK), |
2966 |
+ SND_PCI_QUIRK(0x103c, 0x828c, "HP EliteBook 840 G4", CXT_FIXUP_HP_DOCK), |
2967 |
++ SND_PCI_QUIRK(0x103c, 0x83b2, "HP EliteBook 840 G5", CXT_FIXUP_HP_DOCK), |
2968 |
+ SND_PCI_QUIRK(0x103c, 0x83b3, "HP EliteBook 830 G5", CXT_FIXUP_HP_DOCK), |
2969 |
+ SND_PCI_QUIRK(0x103c, 0x83d3, "HP ProBook 640 G4", CXT_FIXUP_HP_DOCK), |
2970 |
+ SND_PCI_QUIRK(0x103c, 0x8174, "HP Spectre x360", CXT_FIXUP_HP_SPECTRE), |
2971 |
+diff --git a/sound/soc/codecs/hdmi-codec.c b/sound/soc/codecs/hdmi-codec.c |
2972 |
+index d00734d31e04..e5b6769b9797 100644 |
2973 |
+--- a/sound/soc/codecs/hdmi-codec.c |
2974 |
++++ b/sound/soc/codecs/hdmi-codec.c |
2975 |
+@@ -795,6 +795,8 @@ static int hdmi_codec_probe(struct platform_device *pdev) |
2976 |
+ if (hcd->spdif) |
2977 |
+ hcp->daidrv[i] = hdmi_spdif_dai; |
2978 |
+ |
2979 |
++ dev_set_drvdata(dev, hcp); |
2980 |
++ |
2981 |
+ ret = devm_snd_soc_register_component(dev, &hdmi_driver, hcp->daidrv, |
2982 |
+ dai_count); |
2983 |
+ if (ret) { |
2984 |
+@@ -802,8 +804,6 @@ static int hdmi_codec_probe(struct platform_device *pdev) |
2985 |
+ __func__, ret); |
2986 |
+ return ret; |
2987 |
+ } |
2988 |
+- |
2989 |
+- dev_set_drvdata(dev, hcp); |
2990 |
+ return 0; |
2991 |
+ } |
2992 |
+ |
2993 |
+diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c |
2994 |
+index 382847154227..db114f3977e0 100644 |
2995 |
+--- a/sound/usb/pcm.c |
2996 |
++++ b/sound/usb/pcm.c |
2997 |
+@@ -314,6 +314,9 @@ static int search_roland_implicit_fb(struct usb_device *dev, int ifnum, |
2998 |
+ return 0; |
2999 |
+ } |
3000 |
+ |
3001 |
++/* Setup an implicit feedback endpoint from a quirk. Returns 0 if no quirk |
3002 |
++ * applies. Returns 1 if a quirk was found. |
3003 |
++ */ |
3004 |
+ static int set_sync_ep_implicit_fb_quirk(struct snd_usb_substream *subs, |
3005 |
+ struct usb_device *dev, |
3006 |
+ struct usb_interface_descriptor *altsd, |
3007 |
+@@ -384,7 +387,7 @@ add_sync_ep: |
3008 |
+ |
3009 |
+ subs->data_endpoint->sync_master = subs->sync_endpoint; |
3010 |
+ |
3011 |
+- return 0; |
3012 |
++ return 1; |
3013 |
+ } |
3014 |
+ |
3015 |
+ static int set_sync_endpoint(struct snd_usb_substream *subs, |
3016 |
+@@ -423,6 +426,10 @@ static int set_sync_endpoint(struct snd_usb_substream *subs, |
3017 |
+ if (err < 0) |
3018 |
+ return err; |
3019 |
+ |
3020 |
++ /* endpoint set by quirk */ |
3021 |
++ if (err > 0) |
3022 |
++ return 0; |
3023 |
++ |
3024 |
+ if (altsd->bNumEndpoints < 2) |
3025 |
+ return 0; |
3026 |
+ |
3027 |
+diff --git a/tools/arch/riscv/include/uapi/asm/bitsperlong.h b/tools/arch/riscv/include/uapi/asm/bitsperlong.h |
3028 |
+new file mode 100644 |
3029 |
+index 000000000000..0b3cb52fd29d |
3030 |
+--- /dev/null |
3031 |
++++ b/tools/arch/riscv/include/uapi/asm/bitsperlong.h |
3032 |
+@@ -0,0 +1,25 @@ |
3033 |
++/* |
3034 |
++ * Copyright (C) 2012 ARM Ltd. |
3035 |
++ * Copyright (C) 2015 Regents of the University of California |
3036 |
++ * |
3037 |
++ * This program is free software; you can redistribute it and/or modify |
3038 |
++ * it under the terms of the GNU General Public License version 2 as |
3039 |
++ * published by the Free Software Foundation. |
3040 |
++ * |
3041 |
++ * This program is distributed in the hope that it will be useful, |
3042 |
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of |
3043 |
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3044 |
++ * GNU General Public License for more details. |
3045 |
++ * |
3046 |
++ * You should have received a copy of the GNU General Public License |
3047 |
++ * along with this program. If not, see <http://www.gnu.org/licenses/>. |
3048 |
++ */ |
3049 |
++ |
3050 |
++#ifndef _UAPI_ASM_RISCV_BITSPERLONG_H |
3051 |
++#define _UAPI_ASM_RISCV_BITSPERLONG_H |
3052 |
++ |
3053 |
++#define __BITS_PER_LONG (__SIZEOF_POINTER__ * 8) |
3054 |
++ |
3055 |
++#include <asm-generic/bitsperlong.h> |
3056 |
++ |
3057 |
++#endif /* _UAPI_ASM_RISCV_BITSPERLONG_H */ |
3058 |
+diff --git a/tools/include/uapi/asm/bitsperlong.h b/tools/include/uapi/asm/bitsperlong.h |
3059 |
+index 8dd6aefdafa4..57aaeaf8e192 100644 |
3060 |
+--- a/tools/include/uapi/asm/bitsperlong.h |
3061 |
++++ b/tools/include/uapi/asm/bitsperlong.h |
3062 |
+@@ -13,6 +13,10 @@ |
3063 |
+ #include "../../arch/mips/include/uapi/asm/bitsperlong.h" |
3064 |
+ #elif defined(__ia64__) |
3065 |
+ #include "../../arch/ia64/include/uapi/asm/bitsperlong.h" |
3066 |
++#elif defined(__riscv) |
3067 |
++#include "../../arch/riscv/include/uapi/asm/bitsperlong.h" |
3068 |
++#elif defined(__alpha__) |
3069 |
++#include "../../arch/alpha/include/uapi/asm/bitsperlong.h" |
3070 |
+ #else |
3071 |
+ #include <asm-generic/bitsperlong.h> |
3072 |
+ #endif |
3073 |
+diff --git a/tools/perf/tests/shell/lib/probe_vfs_getname.sh b/tools/perf/tests/shell/lib/probe_vfs_getname.sh |
3074 |
+index 1c16e56cd93e..7cb99b433888 100644 |
3075 |
+--- a/tools/perf/tests/shell/lib/probe_vfs_getname.sh |
3076 |
++++ b/tools/perf/tests/shell/lib/probe_vfs_getname.sh |
3077 |
+@@ -13,7 +13,8 @@ add_probe_vfs_getname() { |
3078 |
+ local verbose=$1 |
3079 |
+ if [ $had_vfs_getname -eq 1 ] ; then |
3080 |
+ line=$(perf probe -L getname_flags 2>&1 | egrep 'result.*=.*filename;' | sed -r 's/[[:space:]]+([[:digit:]]+)[[:space:]]+result->uptr.*/\1/') |
3081 |
+- perf probe $verbose "vfs_getname=getname_flags:${line} pathname=result->name:string" |
3082 |
++ perf probe -q "vfs_getname=getname_flags:${line} pathname=result->name:string" || \ |
3083 |
++ perf probe $verbose "vfs_getname=getname_flags:${line} pathname=filename:string" |
3084 |
+ fi |
3085 |
+ } |
3086 |
+ |
3087 |
+diff --git a/tools/perf/util/callchain.c b/tools/perf/util/callchain.c |
3088 |
+index 32ef7bdca1cf..dc2212e12184 100644 |
3089 |
+--- a/tools/perf/util/callchain.c |
3090 |
++++ b/tools/perf/util/callchain.c |
3091 |
+@@ -766,6 +766,7 @@ static enum match_result match_chain(struct callchain_cursor_node *node, |
3092 |
+ cnode->cycles_count += node->branch_flags.cycles; |
3093 |
+ cnode->iter_count += node->nr_loop_iter; |
3094 |
+ cnode->iter_cycles += node->iter_cycles; |
3095 |
++ cnode->from_count++; |
3096 |
+ } |
3097 |
+ } |
3098 |
+ |
3099 |
+@@ -1345,10 +1346,10 @@ static int branch_to_str(char *bf, int bfsize, |
3100 |
+ static int branch_from_str(char *bf, int bfsize, |
3101 |
+ u64 branch_count, |
3102 |
+ u64 cycles_count, u64 iter_count, |
3103 |
+- u64 iter_cycles) |
3104 |
++ u64 iter_cycles, u64 from_count) |
3105 |
+ { |
3106 |
+ int printed = 0, i = 0; |
3107 |
+- u64 cycles; |
3108 |
++ u64 cycles, v = 0; |
3109 |
+ |
3110 |
+ cycles = cycles_count / branch_count; |
3111 |
+ if (cycles) { |
3112 |
+@@ -1357,14 +1358,16 @@ static int branch_from_str(char *bf, int bfsize, |
3113 |
+ bf + printed, bfsize - printed); |
3114 |
+ } |
3115 |
+ |
3116 |
+- if (iter_count) { |
3117 |
+- printed += count_pri64_printf(i++, "iter", |
3118 |
+- iter_count, |
3119 |
+- bf + printed, bfsize - printed); |
3120 |
++ if (iter_count && from_count) { |
3121 |
++ v = iter_count / from_count; |
3122 |
++ if (v) { |
3123 |
++ printed += count_pri64_printf(i++, "iter", |
3124 |
++ v, bf + printed, bfsize - printed); |
3125 |
+ |
3126 |
+- printed += count_pri64_printf(i++, "avg_cycles", |
3127 |
+- iter_cycles / iter_count, |
3128 |
+- bf + printed, bfsize - printed); |
3129 |
++ printed += count_pri64_printf(i++, "avg_cycles", |
3130 |
++ iter_cycles / iter_count, |
3131 |
++ bf + printed, bfsize - printed); |
3132 |
++ } |
3133 |
+ } |
3134 |
+ |
3135 |
+ if (i) |
3136 |
+@@ -1377,6 +1380,7 @@ static int counts_str_build(char *bf, int bfsize, |
3137 |
+ u64 branch_count, u64 predicted_count, |
3138 |
+ u64 abort_count, u64 cycles_count, |
3139 |
+ u64 iter_count, u64 iter_cycles, |
3140 |
++ u64 from_count, |
3141 |
+ struct branch_type_stat *brtype_stat) |
3142 |
+ { |
3143 |
+ int printed; |
3144 |
+@@ -1389,7 +1393,8 @@ static int counts_str_build(char *bf, int bfsize, |
3145 |
+ predicted_count, abort_count, brtype_stat); |
3146 |
+ } else { |
3147 |
+ printed = branch_from_str(bf, bfsize, branch_count, |
3148 |
+- cycles_count, iter_count, iter_cycles); |
3149 |
++ cycles_count, iter_count, iter_cycles, |
3150 |
++ from_count); |
3151 |
+ } |
3152 |
+ |
3153 |
+ if (!printed) |
3154 |
+@@ -1402,13 +1407,14 @@ static int callchain_counts_printf(FILE *fp, char *bf, int bfsize, |
3155 |
+ u64 branch_count, u64 predicted_count, |
3156 |
+ u64 abort_count, u64 cycles_count, |
3157 |
+ u64 iter_count, u64 iter_cycles, |
3158 |
++ u64 from_count, |
3159 |
+ struct branch_type_stat *brtype_stat) |
3160 |
+ { |
3161 |
+ char str[256]; |
3162 |
+ |
3163 |
+ counts_str_build(str, sizeof(str), branch_count, |
3164 |
+ predicted_count, abort_count, cycles_count, |
3165 |
+- iter_count, iter_cycles, brtype_stat); |
3166 |
++ iter_count, iter_cycles, from_count, brtype_stat); |
3167 |
+ |
3168 |
+ if (fp) |
3169 |
+ return fprintf(fp, "%s", str); |
3170 |
+@@ -1422,6 +1428,7 @@ int callchain_list_counts__printf_value(struct callchain_list *clist, |
3171 |
+ u64 branch_count, predicted_count; |
3172 |
+ u64 abort_count, cycles_count; |
3173 |
+ u64 iter_count, iter_cycles; |
3174 |
++ u64 from_count; |
3175 |
+ |
3176 |
+ branch_count = clist->branch_count; |
3177 |
+ predicted_count = clist->predicted_count; |
3178 |
+@@ -1429,11 +1436,12 @@ int callchain_list_counts__printf_value(struct callchain_list *clist, |
3179 |
+ cycles_count = clist->cycles_count; |
3180 |
+ iter_count = clist->iter_count; |
3181 |
+ iter_cycles = clist->iter_cycles; |
3182 |
++ from_count = clist->from_count; |
3183 |
+ |
3184 |
+ return callchain_counts_printf(fp, bf, bfsize, branch_count, |
3185 |
+ predicted_count, abort_count, |
3186 |
+ cycles_count, iter_count, iter_cycles, |
3187 |
+- &clist->brtype_stat); |
3188 |
++ from_count, &clist->brtype_stat); |
3189 |
+ } |
3190 |
+ |
3191 |
+ static void free_callchain_node(struct callchain_node *node) |
3192 |
+diff --git a/tools/perf/util/callchain.h b/tools/perf/util/callchain.h |
3193 |
+index 154560b1eb65..99d38ac019b8 100644 |
3194 |
+--- a/tools/perf/util/callchain.h |
3195 |
++++ b/tools/perf/util/callchain.h |
3196 |
+@@ -118,6 +118,7 @@ struct callchain_list { |
3197 |
+ bool has_children; |
3198 |
+ }; |
3199 |
+ u64 branch_count; |
3200 |
++ u64 from_count; |
3201 |
+ u64 predicted_count; |
3202 |
+ u64 abort_count; |
3203 |
+ u64 cycles_count; |
3204 |
+diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c |
3205 |
+index d7403d1207d7..b1508ce3e412 100644 |
3206 |
+--- a/tools/perf/util/machine.c |
3207 |
++++ b/tools/perf/util/machine.c |
3208 |
+@@ -1988,7 +1988,7 @@ static void save_iterations(struct iterations *iter, |
3209 |
+ { |
3210 |
+ int i; |
3211 |
+ |
3212 |
+- iter->nr_loop_iter = nr; |
3213 |
++ iter->nr_loop_iter++; |
3214 |
+ iter->cycles = 0; |
3215 |
+ |
3216 |
+ for (i = 0; i < nr; i++) |