1 |
commit: 07dd1095fd4c2871c25d22d002308ad564979b94 |
2 |
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun Jul 21 14:42:21 2019 +0000 |
4 |
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Jul 21 14:42:21 2019 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=07dd1095 |
7 |
|
8 |
Linux patch 5.1.19 |
9 |
|
10 |
Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org> |
11 |
|
12 |
0000_README | 4 + |
13 |
1018_linux-5.1.19.patch | 2234 +++++++++++++++++++++++++++++++++++++++++++++++ |
14 |
2 files changed, 2238 insertions(+) |
15 |
|
16 |
diff --git a/0000_README b/0000_README |
17 |
index 83bea0b..99c9da8 100644 |
18 |
--- a/0000_README |
19 |
+++ b/0000_README |
20 |
@@ -115,6 +115,10 @@ Patch: 1017_linux-5.1.18.patch |
21 |
From: https://www.kernel.org |
22 |
Desc: Linux 5.1.18 |
23 |
|
24 |
+Patch: 1018_linux-5.1.19.patch |
25 |
+From: https://www.kernel.org |
26 |
+Desc: Linux 5.1.19 |
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/1018_linux-5.1.19.patch b/1018_linux-5.1.19.patch |
33 |
new file mode 100644 |
34 |
index 0000000..a1293bd |
35 |
--- /dev/null |
36 |
+++ b/1018_linux-5.1.19.patch |
37 |
@@ -0,0 +1,2234 @@ |
38 |
+diff --git a/Makefile b/Makefile |
39 |
+index 01a0a61f86e7..432a62fec680 100644 |
40 |
+--- a/Makefile |
41 |
++++ b/Makefile |
42 |
+@@ -1,7 +1,7 @@ |
43 |
+ # SPDX-License-Identifier: GPL-2.0 |
44 |
+ VERSION = 5 |
45 |
+ PATCHLEVEL = 1 |
46 |
+-SUBLEVEL = 18 |
47 |
++SUBLEVEL = 19 |
48 |
+ EXTRAVERSION = |
49 |
+ NAME = Shy Crocodile |
50 |
+ |
51 |
+diff --git a/arch/arc/kernel/unwind.c b/arch/arc/kernel/unwind.c |
52 |
+index 271e9fafa479..4c221f0edaae 100644 |
53 |
+--- a/arch/arc/kernel/unwind.c |
54 |
++++ b/arch/arc/kernel/unwind.c |
55 |
+@@ -184,11 +184,6 @@ static void *__init unw_hdr_alloc_early(unsigned long sz) |
56 |
+ return memblock_alloc_from(sz, sizeof(unsigned int), MAX_DMA_ADDRESS); |
57 |
+ } |
58 |
+ |
59 |
+-static void *unw_hdr_alloc(unsigned long sz) |
60 |
+-{ |
61 |
+- return kmalloc(sz, GFP_KERNEL); |
62 |
+-} |
63 |
+- |
64 |
+ static void init_unwind_table(struct unwind_table *table, const char *name, |
65 |
+ const void *core_start, unsigned long core_size, |
66 |
+ const void *init_start, unsigned long init_size, |
67 |
+@@ -369,6 +364,10 @@ ret_err: |
68 |
+ } |
69 |
+ |
70 |
+ #ifdef CONFIG_MODULES |
71 |
++static void *unw_hdr_alloc(unsigned long sz) |
72 |
++{ |
73 |
++ return kmalloc(sz, GFP_KERNEL); |
74 |
++} |
75 |
+ |
76 |
+ static struct unwind_table *last_table; |
77 |
+ |
78 |
+diff --git a/arch/arm/boot/dts/gemini-dlink-dns-313.dts b/arch/arm/boot/dts/gemini-dlink-dns-313.dts |
79 |
+index b12504e10f0b..360642a02a48 100644 |
80 |
+--- a/arch/arm/boot/dts/gemini-dlink-dns-313.dts |
81 |
++++ b/arch/arm/boot/dts/gemini-dlink-dns-313.dts |
82 |
+@@ -11,7 +11,7 @@ |
83 |
+ |
84 |
+ / { |
85 |
+ model = "D-Link DNS-313 1-Bay Network Storage Enclosure"; |
86 |
+- compatible = "dlink,dir-313", "cortina,gemini"; |
87 |
++ compatible = "dlink,dns-313", "cortina,gemini"; |
88 |
+ #address-cells = <1>; |
89 |
+ #size-cells = <1>; |
90 |
+ |
91 |
+diff --git a/arch/arm/boot/dts/imx6ul.dtsi b/arch/arm/boot/dts/imx6ul.dtsi |
92 |
+index facd65602c2d..572c04296fe1 100644 |
93 |
+--- a/arch/arm/boot/dts/imx6ul.dtsi |
94 |
++++ b/arch/arm/boot/dts/imx6ul.dtsi |
95 |
+@@ -358,7 +358,7 @@ |
96 |
+ pwm1: pwm@2080000 { |
97 |
+ compatible = "fsl,imx6ul-pwm", "fsl,imx27-pwm"; |
98 |
+ reg = <0x02080000 0x4000>; |
99 |
+- interrupts = <GIC_SPI 115 IRQ_TYPE_LEVEL_HIGH>; |
100 |
++ interrupts = <GIC_SPI 83 IRQ_TYPE_LEVEL_HIGH>; |
101 |
+ clocks = <&clks IMX6UL_CLK_PWM1>, |
102 |
+ <&clks IMX6UL_CLK_PWM1>; |
103 |
+ clock-names = "ipg", "per"; |
104 |
+@@ -369,7 +369,7 @@ |
105 |
+ pwm2: pwm@2084000 { |
106 |
+ compatible = "fsl,imx6ul-pwm", "fsl,imx27-pwm"; |
107 |
+ reg = <0x02084000 0x4000>; |
108 |
+- interrupts = <GIC_SPI 116 IRQ_TYPE_LEVEL_HIGH>; |
109 |
++ interrupts = <GIC_SPI 84 IRQ_TYPE_LEVEL_HIGH>; |
110 |
+ clocks = <&clks IMX6UL_CLK_PWM2>, |
111 |
+ <&clks IMX6UL_CLK_PWM2>; |
112 |
+ clock-names = "ipg", "per"; |
113 |
+@@ -380,7 +380,7 @@ |
114 |
+ pwm3: pwm@2088000 { |
115 |
+ compatible = "fsl,imx6ul-pwm", "fsl,imx27-pwm"; |
116 |
+ reg = <0x02088000 0x4000>; |
117 |
+- interrupts = <GIC_SPI 117 IRQ_TYPE_LEVEL_HIGH>; |
118 |
++ interrupts = <GIC_SPI 85 IRQ_TYPE_LEVEL_HIGH>; |
119 |
+ clocks = <&clks IMX6UL_CLK_PWM3>, |
120 |
+ <&clks IMX6UL_CLK_PWM3>; |
121 |
+ clock-names = "ipg", "per"; |
122 |
+@@ -391,7 +391,7 @@ |
123 |
+ pwm4: pwm@208c000 { |
124 |
+ compatible = "fsl,imx6ul-pwm", "fsl,imx27-pwm"; |
125 |
+ reg = <0x0208c000 0x4000>; |
126 |
+- interrupts = <GIC_SPI 118 IRQ_TYPE_LEVEL_HIGH>; |
127 |
++ interrupts = <GIC_SPI 86 IRQ_TYPE_LEVEL_HIGH>; |
128 |
+ clocks = <&clks IMX6UL_CLK_PWM4>, |
129 |
+ <&clks IMX6UL_CLK_PWM4>; |
130 |
+ clock-names = "ipg", "per"; |
131 |
+diff --git a/arch/arm/boot/dts/meson8.dtsi b/arch/arm/boot/dts/meson8.dtsi |
132 |
+index a9781243453e..048b55c8dc1e 100644 |
133 |
+--- a/arch/arm/boot/dts/meson8.dtsi |
134 |
++++ b/arch/arm/boot/dts/meson8.dtsi |
135 |
+@@ -248,8 +248,8 @@ |
136 |
+ <GIC_SPI 167 IRQ_TYPE_LEVEL_HIGH>, |
137 |
+ <GIC_SPI 168 IRQ_TYPE_LEVEL_HIGH>, |
138 |
+ <GIC_SPI 169 IRQ_TYPE_LEVEL_HIGH>, |
139 |
+- <GIC_SPI 172 IRQ_TYPE_LEVEL_HIGH>, |
140 |
+- <GIC_SPI 173 IRQ_TYPE_LEVEL_HIGH>, |
141 |
++ <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, |
142 |
++ <GIC_SPI 171 IRQ_TYPE_LEVEL_HIGH>, |
143 |
+ <GIC_SPI 172 IRQ_TYPE_LEVEL_HIGH>, |
144 |
+ <GIC_SPI 173 IRQ_TYPE_LEVEL_HIGH>, |
145 |
+ <GIC_SPI 174 IRQ_TYPE_LEVEL_HIGH>, |
146 |
+@@ -264,7 +264,6 @@ |
147 |
+ clocks = <&clkc CLKID_CLK81>, <&clkc CLKID_MALI>; |
148 |
+ clock-names = "bus", "core"; |
149 |
+ operating-points-v2 = <&gpu_opp_table>; |
150 |
+- switch-delay = <0xffff>; |
151 |
+ }; |
152 |
+ }; |
153 |
+ }; /* end of / */ |
154 |
+diff --git a/arch/arm/boot/dts/meson8b.dtsi b/arch/arm/boot/dts/meson8b.dtsi |
155 |
+index fe84a8c3ce81..6b80aff32fc2 100644 |
156 |
+--- a/arch/arm/boot/dts/meson8b.dtsi |
157 |
++++ b/arch/arm/boot/dts/meson8b.dtsi |
158 |
+@@ -163,23 +163,23 @@ |
159 |
+ |
160 |
+ opp-255000000 { |
161 |
+ opp-hz = /bits/ 64 <255000000>; |
162 |
+- opp-microvolt = <1150000>; |
163 |
++ opp-microvolt = <1100000>; |
164 |
+ }; |
165 |
+ opp-364300000 { |
166 |
+ opp-hz = /bits/ 64 <364300000>; |
167 |
+- opp-microvolt = <1150000>; |
168 |
++ opp-microvolt = <1100000>; |
169 |
+ }; |
170 |
+ opp-425000000 { |
171 |
+ opp-hz = /bits/ 64 <425000000>; |
172 |
+- opp-microvolt = <1150000>; |
173 |
++ opp-microvolt = <1100000>; |
174 |
+ }; |
175 |
+ opp-510000000 { |
176 |
+ opp-hz = /bits/ 64 <510000000>; |
177 |
+- opp-microvolt = <1150000>; |
178 |
++ opp-microvolt = <1100000>; |
179 |
+ }; |
180 |
+ opp-637500000 { |
181 |
+ opp-hz = /bits/ 64 <637500000>; |
182 |
+- opp-microvolt = <1150000>; |
183 |
++ opp-microvolt = <1100000>; |
184 |
+ turbo-mode; |
185 |
+ }; |
186 |
+ }; |
187 |
+diff --git a/arch/arm/mach-omap2/prm3xxx.c b/arch/arm/mach-omap2/prm3xxx.c |
188 |
+index 05858f966f7d..dfa65fc2c82b 100644 |
189 |
+--- a/arch/arm/mach-omap2/prm3xxx.c |
190 |
++++ b/arch/arm/mach-omap2/prm3xxx.c |
191 |
+@@ -433,7 +433,7 @@ static void omap3_prm_reconfigure_io_chain(void) |
192 |
+ * registers, and omap3xxx_prm_reconfigure_io_chain() must be called. |
193 |
+ * No return value. |
194 |
+ */ |
195 |
+-static void __init omap3xxx_prm_enable_io_wakeup(void) |
196 |
++static void omap3xxx_prm_enable_io_wakeup(void) |
197 |
+ { |
198 |
+ if (prm_features & PRM_HAS_IO_WAKEUP) |
199 |
+ omap2_prm_set_mod_reg_bits(OMAP3430_EN_IO_MASK, WKUP_MOD, |
200 |
+diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi b/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi |
201 |
+index 2896bbcfa3bb..228872549f01 100644 |
202 |
+--- a/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi |
203 |
++++ b/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi |
204 |
+@@ -28,7 +28,7 @@ |
205 |
+ enable-method = "psci"; |
206 |
+ clocks = <&clockgen 1 0>; |
207 |
+ next-level-cache = <&l2>; |
208 |
+- cpu-idle-states = <&CPU_PH20>; |
209 |
++ cpu-idle-states = <&CPU_PW20>; |
210 |
+ }; |
211 |
+ |
212 |
+ cpu1: cpu@1 { |
213 |
+@@ -38,7 +38,7 @@ |
214 |
+ enable-method = "psci"; |
215 |
+ clocks = <&clockgen 1 0>; |
216 |
+ next-level-cache = <&l2>; |
217 |
+- cpu-idle-states = <&CPU_PH20>; |
218 |
++ cpu-idle-states = <&CPU_PW20>; |
219 |
+ }; |
220 |
+ |
221 |
+ l2: l2-cache { |
222 |
+@@ -53,13 +53,13 @@ |
223 |
+ */ |
224 |
+ entry-method = "arm,psci"; |
225 |
+ |
226 |
+- CPU_PH20: cpu-ph20 { |
227 |
+- compatible = "arm,idle-state"; |
228 |
+- idle-state-name = "PH20"; |
229 |
+- arm,psci-suspend-param = <0x00010000>; |
230 |
+- entry-latency-us = <1000>; |
231 |
+- exit-latency-us = <1000>; |
232 |
+- min-residency-us = <3000>; |
233 |
++ CPU_PW20: cpu-pw20 { |
234 |
++ compatible = "arm,idle-state"; |
235 |
++ idle-state-name = "PW20"; |
236 |
++ arm,psci-suspend-param = <0x0>; |
237 |
++ entry-latency-us = <2000>; |
238 |
++ exit-latency-us = <2000>; |
239 |
++ min-residency-us = <6000>; |
240 |
+ }; |
241 |
+ }; |
242 |
+ |
243 |
+diff --git a/arch/s390/include/asm/facility.h b/arch/s390/include/asm/facility.h |
244 |
+index e78cda94456b..68c476b20b57 100644 |
245 |
+--- a/arch/s390/include/asm/facility.h |
246 |
++++ b/arch/s390/include/asm/facility.h |
247 |
+@@ -59,6 +59,18 @@ static inline int test_facility(unsigned long nr) |
248 |
+ return __test_facility(nr, &S390_lowcore.stfle_fac_list); |
249 |
+ } |
250 |
+ |
251 |
++static inline unsigned long __stfle_asm(u64 *stfle_fac_list, int size) |
252 |
++{ |
253 |
++ register unsigned long reg0 asm("0") = size - 1; |
254 |
++ |
255 |
++ asm volatile( |
256 |
++ ".insn s,0xb2b00000,0(%1)" /* stfle */ |
257 |
++ : "+d" (reg0) |
258 |
++ : "a" (stfle_fac_list) |
259 |
++ : "memory", "cc"); |
260 |
++ return reg0; |
261 |
++} |
262 |
++ |
263 |
+ /** |
264 |
+ * stfle - Store facility list extended |
265 |
+ * @stfle_fac_list: array where facility list can be stored |
266 |
+@@ -75,13 +87,8 @@ static inline void __stfle(u64 *stfle_fac_list, int size) |
267 |
+ memcpy(stfle_fac_list, &S390_lowcore.stfl_fac_list, 4); |
268 |
+ if (S390_lowcore.stfl_fac_list & 0x01000000) { |
269 |
+ /* More facility bits available with stfle */ |
270 |
+- register unsigned long reg0 asm("0") = size - 1; |
271 |
+- |
272 |
+- asm volatile(".insn s,0xb2b00000,0(%1)" /* stfle */ |
273 |
+- : "+d" (reg0) |
274 |
+- : "a" (stfle_fac_list) |
275 |
+- : "memory", "cc"); |
276 |
+- nr = (reg0 + 1) * 8; /* # bytes stored by stfle */ |
277 |
++ nr = __stfle_asm(stfle_fac_list, size); |
278 |
++ nr = min_t(unsigned long, (nr + 1) * 8, size * 8); |
279 |
+ } |
280 |
+ memset((char *) stfle_fac_list + nr, 0, size * 8 - nr); |
281 |
+ } |
282 |
+diff --git a/arch/x86/entry/entry_32.S b/arch/x86/entry/entry_32.S |
283 |
+index 5fc76b755510..f4afacfd40bb 100644 |
284 |
+--- a/arch/x86/entry/entry_32.S |
285 |
++++ b/arch/x86/entry/entry_32.S |
286 |
+@@ -1105,6 +1105,30 @@ ENTRY(irq_entries_start) |
287 |
+ .endr |
288 |
+ END(irq_entries_start) |
289 |
+ |
290 |
++#ifdef CONFIG_X86_LOCAL_APIC |
291 |
++ .align 8 |
292 |
++ENTRY(spurious_entries_start) |
293 |
++ vector=FIRST_SYSTEM_VECTOR |
294 |
++ .rept (NR_VECTORS - FIRST_SYSTEM_VECTOR) |
295 |
++ pushl $(~vector+0x80) /* Note: always in signed byte range */ |
296 |
++ vector=vector+1 |
297 |
++ jmp common_spurious |
298 |
++ .align 8 |
299 |
++ .endr |
300 |
++END(spurious_entries_start) |
301 |
++ |
302 |
++common_spurious: |
303 |
++ ASM_CLAC |
304 |
++ addl $-0x80, (%esp) /* Adjust vector into the [-256, -1] range */ |
305 |
++ SAVE_ALL switch_stacks=1 |
306 |
++ ENCODE_FRAME_POINTER |
307 |
++ TRACE_IRQS_OFF |
308 |
++ movl %esp, %eax |
309 |
++ call smp_spurious_interrupt |
310 |
++ jmp ret_from_intr |
311 |
++ENDPROC(common_spurious) |
312 |
++#endif |
313 |
++ |
314 |
+ /* |
315 |
+ * the CPU automatically disables interrupts when executing an IRQ vector, |
316 |
+ * so IRQ-flags tracing has to follow that: |
317 |
+diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S |
318 |
+index b1d59a7c556e..16a472ddbfe4 100644 |
319 |
+--- a/arch/x86/entry/entry_64.S |
320 |
++++ b/arch/x86/entry/entry_64.S |
321 |
+@@ -377,6 +377,18 @@ ENTRY(irq_entries_start) |
322 |
+ .endr |
323 |
+ END(irq_entries_start) |
324 |
+ |
325 |
++ .align 8 |
326 |
++ENTRY(spurious_entries_start) |
327 |
++ vector=FIRST_SYSTEM_VECTOR |
328 |
++ .rept (NR_VECTORS - FIRST_SYSTEM_VECTOR) |
329 |
++ UNWIND_HINT_IRET_REGS |
330 |
++ pushq $(~vector+0x80) /* Note: always in signed byte range */ |
331 |
++ jmp common_spurious |
332 |
++ .align 8 |
333 |
++ vector=vector+1 |
334 |
++ .endr |
335 |
++END(spurious_entries_start) |
336 |
++ |
337 |
+ .macro DEBUG_ENTRY_ASSERT_IRQS_OFF |
338 |
+ #ifdef CONFIG_DEBUG_ENTRY |
339 |
+ pushq %rax |
340 |
+@@ -573,10 +585,20 @@ _ASM_NOKPROBE(interrupt_entry) |
341 |
+ |
342 |
+ /* Interrupt entry/exit. */ |
343 |
+ |
344 |
+- /* |
345 |
+- * The interrupt stubs push (~vector+0x80) onto the stack and |
346 |
+- * then jump to common_interrupt. |
347 |
+- */ |
348 |
++/* |
349 |
++ * The interrupt stubs push (~vector+0x80) onto the stack and |
350 |
++ * then jump to common_spurious/interrupt. |
351 |
++ */ |
352 |
++common_spurious: |
353 |
++ addq $-0x80, (%rsp) /* Adjust vector to [-256, -1] range */ |
354 |
++ call interrupt_entry |
355 |
++ UNWIND_HINT_REGS indirect=1 |
356 |
++ call smp_spurious_interrupt /* rdi points to pt_regs */ |
357 |
++ jmp ret_from_intr |
358 |
++END(common_spurious) |
359 |
++_ASM_NOKPROBE(common_spurious) |
360 |
++ |
361 |
++/* common_interrupt is a hotpath. Align it */ |
362 |
+ .p2align CONFIG_X86_L1_CACHE_SHIFT |
363 |
+ common_interrupt: |
364 |
+ addq $-0x80, (%rsp) /* Adjust vector to [-256, -1] range */ |
365 |
+diff --git a/arch/x86/include/asm/hw_irq.h b/arch/x86/include/asm/hw_irq.h |
366 |
+index 32e666e1231e..cbd97e22d2f3 100644 |
367 |
+--- a/arch/x86/include/asm/hw_irq.h |
368 |
++++ b/arch/x86/include/asm/hw_irq.h |
369 |
+@@ -150,8 +150,11 @@ extern char irq_entries_start[]; |
370 |
+ #define trace_irq_entries_start irq_entries_start |
371 |
+ #endif |
372 |
+ |
373 |
++extern char spurious_entries_start[]; |
374 |
++ |
375 |
+ #define VECTOR_UNUSED NULL |
376 |
+-#define VECTOR_RETRIGGERED ((void *)~0UL) |
377 |
++#define VECTOR_SHUTDOWN ((void *)~0UL) |
378 |
++#define VECTOR_RETRIGGERED ((void *)~1UL) |
379 |
+ |
380 |
+ typedef struct irq_desc* vector_irq_t[NR_VECTORS]; |
381 |
+ DECLARE_PER_CPU(vector_irq_t, vector_irq); |
382 |
+diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c |
383 |
+index b7bcdd781651..2b8a57ae57f6 100644 |
384 |
+--- a/arch/x86/kernel/apic/apic.c |
385 |
++++ b/arch/x86/kernel/apic/apic.c |
386 |
+@@ -1458,7 +1458,8 @@ static void apic_pending_intr_clear(void) |
387 |
+ if (queued) { |
388 |
+ if (boot_cpu_has(X86_FEATURE_TSC) && cpu_khz) { |
389 |
+ ntsc = rdtsc(); |
390 |
+- max_loops = (cpu_khz << 10) - (ntsc - tsc); |
391 |
++ max_loops = (long long)cpu_khz << 10; |
392 |
++ max_loops -= ntsc - tsc; |
393 |
+ } else { |
394 |
+ max_loops--; |
395 |
+ } |
396 |
+@@ -2034,21 +2035,32 @@ __visible void __irq_entry smp_spurious_interrupt(struct pt_regs *regs) |
397 |
+ entering_irq(); |
398 |
+ trace_spurious_apic_entry(vector); |
399 |
+ |
400 |
++ inc_irq_stat(irq_spurious_count); |
401 |
++ |
402 |
++ /* |
403 |
++ * If this is a spurious interrupt then do not acknowledge |
404 |
++ */ |
405 |
++ if (vector == SPURIOUS_APIC_VECTOR) { |
406 |
++ /* See SDM vol 3 */ |
407 |
++ pr_info("Spurious APIC interrupt (vector 0xFF) on CPU#%d, should never happen.\n", |
408 |
++ smp_processor_id()); |
409 |
++ goto out; |
410 |
++ } |
411 |
++ |
412 |
+ /* |
413 |
+- * Check if this really is a spurious interrupt and ACK it |
414 |
+- * if it is a vectored one. Just in case... |
415 |
+- * Spurious interrupts should not be ACKed. |
416 |
++ * If it is a vectored one, verify it's set in the ISR. If set, |
417 |
++ * acknowledge it. |
418 |
+ */ |
419 |
+ v = apic_read(APIC_ISR + ((vector & ~0x1f) >> 1)); |
420 |
+- if (v & (1 << (vector & 0x1f))) |
421 |
++ if (v & (1 << (vector & 0x1f))) { |
422 |
++ pr_info("Spurious interrupt (vector 0x%02x) on CPU#%d. Acked\n", |
423 |
++ vector, smp_processor_id()); |
424 |
+ ack_APIC_irq(); |
425 |
+- |
426 |
+- inc_irq_stat(irq_spurious_count); |
427 |
+- |
428 |
+- /* see sw-dev-man vol 3, chapter 7.4.13.5 */ |
429 |
+- pr_info("spurious APIC interrupt through vector %02x on CPU#%d, " |
430 |
+- "should never happen.\n", vector, smp_processor_id()); |
431 |
+- |
432 |
++ } else { |
433 |
++ pr_info("Spurious interrupt (vector 0x%02x) on CPU#%d. Not pending!\n", |
434 |
++ vector, smp_processor_id()); |
435 |
++ } |
436 |
++out: |
437 |
+ trace_spurious_apic_exit(vector); |
438 |
+ exiting_irq(); |
439 |
+ } |
440 |
+diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c |
441 |
+index 53aa234a6803..c9fec0657eea 100644 |
442 |
+--- a/arch/x86/kernel/apic/io_apic.c |
443 |
++++ b/arch/x86/kernel/apic/io_apic.c |
444 |
+@@ -1893,6 +1893,50 @@ static int ioapic_set_affinity(struct irq_data *irq_data, |
445 |
+ return ret; |
446 |
+ } |
447 |
+ |
448 |
++/* |
449 |
++ * Interrupt shutdown masks the ioapic pin, but the interrupt might already |
450 |
++ * be in flight, but not yet serviced by the target CPU. That means |
451 |
++ * __synchronize_hardirq() would return and claim that everything is calmed |
452 |
++ * down. So free_irq() would proceed and deactivate the interrupt and free |
453 |
++ * resources. |
454 |
++ * |
455 |
++ * Once the target CPU comes around to service it it will find a cleared |
456 |
++ * vector and complain. While the spurious interrupt is harmless, the full |
457 |
++ * release of resources might prevent the interrupt from being acknowledged |
458 |
++ * which keeps the hardware in a weird state. |
459 |
++ * |
460 |
++ * Verify that the corresponding Remote-IRR bits are clear. |
461 |
++ */ |
462 |
++static int ioapic_irq_get_chip_state(struct irq_data *irqd, |
463 |
++ enum irqchip_irq_state which, |
464 |
++ bool *state) |
465 |
++{ |
466 |
++ struct mp_chip_data *mcd = irqd->chip_data; |
467 |
++ struct IO_APIC_route_entry rentry; |
468 |
++ struct irq_pin_list *p; |
469 |
++ |
470 |
++ if (which != IRQCHIP_STATE_ACTIVE) |
471 |
++ return -EINVAL; |
472 |
++ |
473 |
++ *state = false; |
474 |
++ raw_spin_lock(&ioapic_lock); |
475 |
++ for_each_irq_pin(p, mcd->irq_2_pin) { |
476 |
++ rentry = __ioapic_read_entry(p->apic, p->pin); |
477 |
++ /* |
478 |
++ * The remote IRR is only valid in level trigger mode. It's |
479 |
++ * meaning is undefined for edge triggered interrupts and |
480 |
++ * irrelevant because the IO-APIC treats them as fire and |
481 |
++ * forget. |
482 |
++ */ |
483 |
++ if (rentry.irr && rentry.trigger) { |
484 |
++ *state = true; |
485 |
++ break; |
486 |
++ } |
487 |
++ } |
488 |
++ raw_spin_unlock(&ioapic_lock); |
489 |
++ return 0; |
490 |
++} |
491 |
++ |
492 |
+ static struct irq_chip ioapic_chip __read_mostly = { |
493 |
+ .name = "IO-APIC", |
494 |
+ .irq_startup = startup_ioapic_irq, |
495 |
+@@ -1902,6 +1946,7 @@ static struct irq_chip ioapic_chip __read_mostly = { |
496 |
+ .irq_eoi = ioapic_ack_level, |
497 |
+ .irq_set_affinity = ioapic_set_affinity, |
498 |
+ .irq_retrigger = irq_chip_retrigger_hierarchy, |
499 |
++ .irq_get_irqchip_state = ioapic_irq_get_chip_state, |
500 |
+ .flags = IRQCHIP_SKIP_SET_WAKE, |
501 |
+ }; |
502 |
+ |
503 |
+@@ -1914,6 +1959,7 @@ static struct irq_chip ioapic_ir_chip __read_mostly = { |
504 |
+ .irq_eoi = ioapic_ir_ack_level, |
505 |
+ .irq_set_affinity = ioapic_set_affinity, |
506 |
+ .irq_retrigger = irq_chip_retrigger_hierarchy, |
507 |
++ .irq_get_irqchip_state = ioapic_irq_get_chip_state, |
508 |
+ .flags = IRQCHIP_SKIP_SET_WAKE, |
509 |
+ }; |
510 |
+ |
511 |
+diff --git a/arch/x86/kernel/apic/vector.c b/arch/x86/kernel/apic/vector.c |
512 |
+index 3173e07d3791..1c6d1d5f28d3 100644 |
513 |
+--- a/arch/x86/kernel/apic/vector.c |
514 |
++++ b/arch/x86/kernel/apic/vector.c |
515 |
+@@ -343,7 +343,7 @@ static void clear_irq_vector(struct irq_data *irqd) |
516 |
+ trace_vector_clear(irqd->irq, vector, apicd->cpu, apicd->prev_vector, |
517 |
+ apicd->prev_cpu); |
518 |
+ |
519 |
+- per_cpu(vector_irq, apicd->cpu)[vector] = VECTOR_UNUSED; |
520 |
++ per_cpu(vector_irq, apicd->cpu)[vector] = VECTOR_SHUTDOWN; |
521 |
+ irq_matrix_free(vector_matrix, apicd->cpu, vector, managed); |
522 |
+ apicd->vector = 0; |
523 |
+ |
524 |
+@@ -352,7 +352,7 @@ static void clear_irq_vector(struct irq_data *irqd) |
525 |
+ if (!vector) |
526 |
+ return; |
527 |
+ |
528 |
+- per_cpu(vector_irq, apicd->prev_cpu)[vector] = VECTOR_UNUSED; |
529 |
++ per_cpu(vector_irq, apicd->prev_cpu)[vector] = VECTOR_SHUTDOWN; |
530 |
+ irq_matrix_free(vector_matrix, apicd->prev_cpu, vector, managed); |
531 |
+ apicd->prev_vector = 0; |
532 |
+ apicd->move_in_progress = 0; |
533 |
+diff --git a/arch/x86/kernel/head64.c b/arch/x86/kernel/head64.c |
534 |
+index 16b1cbd3a61e..29ffa495bd1c 100644 |
535 |
+--- a/arch/x86/kernel/head64.c |
536 |
++++ b/arch/x86/kernel/head64.c |
537 |
+@@ -184,24 +184,25 @@ unsigned long __head __startup_64(unsigned long physaddr, |
538 |
+ pgtable_flags = _KERNPG_TABLE_NOENC + sme_get_me_mask(); |
539 |
+ |
540 |
+ if (la57) { |
541 |
+- p4d = fixup_pointer(early_dynamic_pgts[next_early_pgt++], physaddr); |
542 |
++ p4d = fixup_pointer(early_dynamic_pgts[(*next_pgt_ptr)++], |
543 |
++ physaddr); |
544 |
+ |
545 |
+ i = (physaddr >> PGDIR_SHIFT) % PTRS_PER_PGD; |
546 |
+ pgd[i + 0] = (pgdval_t)p4d + pgtable_flags; |
547 |
+ pgd[i + 1] = (pgdval_t)p4d + pgtable_flags; |
548 |
+ |
549 |
+- i = (physaddr >> P4D_SHIFT) % PTRS_PER_P4D; |
550 |
+- p4d[i + 0] = (pgdval_t)pud + pgtable_flags; |
551 |
+- p4d[i + 1] = (pgdval_t)pud + pgtable_flags; |
552 |
++ i = physaddr >> P4D_SHIFT; |
553 |
++ p4d[(i + 0) % PTRS_PER_P4D] = (pgdval_t)pud + pgtable_flags; |
554 |
++ p4d[(i + 1) % PTRS_PER_P4D] = (pgdval_t)pud + pgtable_flags; |
555 |
+ } else { |
556 |
+ i = (physaddr >> PGDIR_SHIFT) % PTRS_PER_PGD; |
557 |
+ pgd[i + 0] = (pgdval_t)pud + pgtable_flags; |
558 |
+ pgd[i + 1] = (pgdval_t)pud + pgtable_flags; |
559 |
+ } |
560 |
+ |
561 |
+- i = (physaddr >> PUD_SHIFT) % PTRS_PER_PUD; |
562 |
+- pud[i + 0] = (pudval_t)pmd + pgtable_flags; |
563 |
+- pud[i + 1] = (pudval_t)pmd + pgtable_flags; |
564 |
++ i = physaddr >> PUD_SHIFT; |
565 |
++ pud[(i + 0) % PTRS_PER_PUD] = (pudval_t)pmd + pgtable_flags; |
566 |
++ pud[(i + 1) % PTRS_PER_PUD] = (pudval_t)pmd + pgtable_flags; |
567 |
+ |
568 |
+ pmd_entry = __PAGE_KERNEL_LARGE_EXEC & ~_PAGE_GLOBAL; |
569 |
+ /* Filter out unsupported __PAGE_KERNEL_* bits: */ |
570 |
+@@ -211,8 +212,9 @@ unsigned long __head __startup_64(unsigned long physaddr, |
571 |
+ pmd_entry += physaddr; |
572 |
+ |
573 |
+ for (i = 0; i < DIV_ROUND_UP(_end - _text, PMD_SIZE); i++) { |
574 |
+- int idx = i + (physaddr >> PMD_SHIFT) % PTRS_PER_PMD; |
575 |
+- pmd[idx] = pmd_entry + i * PMD_SIZE; |
576 |
++ int idx = i + (physaddr >> PMD_SHIFT); |
577 |
++ |
578 |
++ pmd[idx % PTRS_PER_PMD] = pmd_entry + i * PMD_SIZE; |
579 |
+ } |
580 |
+ |
581 |
+ /* |
582 |
+diff --git a/arch/x86/kernel/idt.c b/arch/x86/kernel/idt.c |
583 |
+index 01adea278a71..a7e0e975043f 100644 |
584 |
+--- a/arch/x86/kernel/idt.c |
585 |
++++ b/arch/x86/kernel/idt.c |
586 |
+@@ -321,7 +321,8 @@ void __init idt_setup_apic_and_irq_gates(void) |
587 |
+ #ifdef CONFIG_X86_LOCAL_APIC |
588 |
+ for_each_clear_bit_from(i, system_vectors, NR_VECTORS) { |
589 |
+ set_bit(i, system_vectors); |
590 |
+- set_intr_gate(i, spurious_interrupt); |
591 |
++ entry = spurious_entries_start + 8 * (i - FIRST_SYSTEM_VECTOR); |
592 |
++ set_intr_gate(i, entry); |
593 |
+ } |
594 |
+ #endif |
595 |
+ } |
596 |
+diff --git a/arch/x86/kernel/irq.c b/arch/x86/kernel/irq.c |
597 |
+index 59b5f2ea7c2f..a975246074b5 100644 |
598 |
+--- a/arch/x86/kernel/irq.c |
599 |
++++ b/arch/x86/kernel/irq.c |
600 |
+@@ -246,7 +246,7 @@ __visible unsigned int __irq_entry do_IRQ(struct pt_regs *regs) |
601 |
+ if (!handle_irq(desc, regs)) { |
602 |
+ ack_APIC_irq(); |
603 |
+ |
604 |
+- if (desc != VECTOR_RETRIGGERED) { |
605 |
++ if (desc != VECTOR_RETRIGGERED && desc != VECTOR_SHUTDOWN) { |
606 |
+ pr_emerg_ratelimited("%s: %d.%d No irq handler for vector\n", |
607 |
+ __func__, smp_processor_id(), |
608 |
+ vector); |
609 |
+diff --git a/arch/x86/platform/efi/quirks.c b/arch/x86/platform/efi/quirks.c |
610 |
+index a25a9fd987a9..529522c62d89 100644 |
611 |
+--- a/arch/x86/platform/efi/quirks.c |
612 |
++++ b/arch/x86/platform/efi/quirks.c |
613 |
+@@ -724,7 +724,7 @@ void efi_recover_from_page_fault(unsigned long phys_addr) |
614 |
+ * Address range 0x0000 - 0x0fff is always mapped in the efi_pgd, so |
615 |
+ * page faulting on these addresses isn't expected. |
616 |
+ */ |
617 |
+- if (phys_addr >= 0x0000 && phys_addr <= 0x0fff) |
618 |
++ if (phys_addr <= 0x0fff) |
619 |
+ return; |
620 |
+ |
621 |
+ /* |
622 |
+diff --git a/drivers/base/cacheinfo.c b/drivers/base/cacheinfo.c |
623 |
+index a7359535caf5..b444f89a2041 100644 |
624 |
+--- a/drivers/base/cacheinfo.c |
625 |
++++ b/drivers/base/cacheinfo.c |
626 |
+@@ -655,7 +655,8 @@ static int cacheinfo_cpu_pre_down(unsigned int cpu) |
627 |
+ |
628 |
+ static int __init cacheinfo_sysfs_init(void) |
629 |
+ { |
630 |
+- return cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "base/cacheinfo:online", |
631 |
++ return cpuhp_setup_state(CPUHP_AP_BASE_CACHEINFO_ONLINE, |
632 |
++ "base/cacheinfo:online", |
633 |
+ cacheinfo_cpu_online, cacheinfo_cpu_pre_down); |
634 |
+ } |
635 |
+ device_initcall(cacheinfo_sysfs_init); |
636 |
+diff --git a/drivers/base/firmware_loader/fallback.c b/drivers/base/firmware_loader/fallback.c |
637 |
+index b5c865fe263b..818d8c37d70a 100644 |
638 |
+--- a/drivers/base/firmware_loader/fallback.c |
639 |
++++ b/drivers/base/firmware_loader/fallback.c |
640 |
+@@ -659,7 +659,7 @@ static bool fw_run_sysfs_fallback(enum fw_opt opt_flags) |
641 |
+ /* Also permit LSMs and IMA to fail firmware sysfs fallback */ |
642 |
+ ret = security_kernel_load_data(LOADING_FIRMWARE); |
643 |
+ if (ret < 0) |
644 |
+- return ret; |
645 |
++ return false; |
646 |
+ |
647 |
+ return fw_force_sysfs_fallback(opt_flags); |
648 |
+ } |
649 |
+diff --git a/drivers/clk/ti/clkctrl.c b/drivers/clk/ti/clkctrl.c |
650 |
+index 3325ee43bcc1..626090b59cd7 100644 |
651 |
+--- a/drivers/clk/ti/clkctrl.c |
652 |
++++ b/drivers/clk/ti/clkctrl.c |
653 |
+@@ -229,6 +229,7 @@ static struct clk_hw *_ti_omap4_clkctrl_xlate(struct of_phandle_args *clkspec, |
654 |
+ { |
655 |
+ struct omap_clkctrl_provider *provider = data; |
656 |
+ struct omap_clkctrl_clk *entry; |
657 |
++ bool found = false; |
658 |
+ |
659 |
+ if (clkspec->args_count != 2) |
660 |
+ return ERR_PTR(-EINVAL); |
661 |
+@@ -238,11 +239,13 @@ static struct clk_hw *_ti_omap4_clkctrl_xlate(struct of_phandle_args *clkspec, |
662 |
+ |
663 |
+ list_for_each_entry(entry, &provider->clocks, node) { |
664 |
+ if (entry->reg_offset == clkspec->args[0] && |
665 |
+- entry->bit_offset == clkspec->args[1]) |
666 |
++ entry->bit_offset == clkspec->args[1]) { |
667 |
++ found = true; |
668 |
+ break; |
669 |
++ } |
670 |
+ } |
671 |
+ |
672 |
+- if (!entry) |
673 |
++ if (!found) |
674 |
+ return ERR_PTR(-EINVAL); |
675 |
+ |
676 |
+ return entry->clk; |
677 |
+diff --git a/drivers/crypto/nx/nx-842-powernv.c b/drivers/crypto/nx/nx-842-powernv.c |
678 |
+index c68df7e8bee1..7ce2467c771e 100644 |
679 |
+--- a/drivers/crypto/nx/nx-842-powernv.c |
680 |
++++ b/drivers/crypto/nx/nx-842-powernv.c |
681 |
+@@ -36,8 +36,6 @@ MODULE_ALIAS_CRYPTO("842-nx"); |
682 |
+ #define WORKMEM_ALIGN (CRB_ALIGN) |
683 |
+ #define CSB_WAIT_MAX (5000) /* ms */ |
684 |
+ #define VAS_RETRIES (10) |
685 |
+-/* # of requests allowed per RxFIFO at a time. 0 for unlimited */ |
686 |
+-#define MAX_CREDITS_PER_RXFIFO (1024) |
687 |
+ |
688 |
+ struct nx842_workmem { |
689 |
+ /* Below fields must be properly aligned */ |
690 |
+@@ -821,7 +819,11 @@ static int __init vas_cfg_coproc_info(struct device_node *dn, int chip_id, |
691 |
+ rxattr.lnotify_lpid = lpid; |
692 |
+ rxattr.lnotify_pid = pid; |
693 |
+ rxattr.lnotify_tid = tid; |
694 |
+- rxattr.wcreds_max = MAX_CREDITS_PER_RXFIFO; |
695 |
++ /* |
696 |
++ * Maximum RX window credits can not be more than #CRBs in |
697 |
++ * RxFIFO. Otherwise, can get checkstop if RxFIFO overruns. |
698 |
++ */ |
699 |
++ rxattr.wcreds_max = fifo_size / CRB_SIZE; |
700 |
+ |
701 |
+ /* |
702 |
+ * Open a VAS receice window which is used to configure RxFIFO |
703 |
+diff --git a/drivers/crypto/talitos.c b/drivers/crypto/talitos.c |
704 |
+index 0fee83b2eb91..becc654e0cd3 100644 |
705 |
+--- a/drivers/crypto/talitos.c |
706 |
++++ b/drivers/crypto/talitos.c |
707 |
+@@ -334,6 +334,21 @@ int talitos_submit(struct device *dev, int ch, struct talitos_desc *desc, |
708 |
+ } |
709 |
+ EXPORT_SYMBOL(talitos_submit); |
710 |
+ |
711 |
++static __be32 get_request_hdr(struct talitos_request *request, bool is_sec1) |
712 |
++{ |
713 |
++ struct talitos_edesc *edesc; |
714 |
++ |
715 |
++ if (!is_sec1) |
716 |
++ return request->desc->hdr; |
717 |
++ |
718 |
++ if (!request->desc->next_desc) |
719 |
++ return request->desc->hdr1; |
720 |
++ |
721 |
++ edesc = container_of(request->desc, struct talitos_edesc, desc); |
722 |
++ |
723 |
++ return ((struct talitos_desc *)(edesc->buf + edesc->dma_len))->hdr1; |
724 |
++} |
725 |
++ |
726 |
+ /* |
727 |
+ * process what was done, notify callback of error if not |
728 |
+ */ |
729 |
+@@ -355,12 +370,7 @@ static void flush_channel(struct device *dev, int ch, int error, int reset_ch) |
730 |
+ |
731 |
+ /* descriptors with their done bits set don't get the error */ |
732 |
+ rmb(); |
733 |
+- if (!is_sec1) |
734 |
+- hdr = request->desc->hdr; |
735 |
+- else if (request->desc->next_desc) |
736 |
+- hdr = (request->desc + 1)->hdr1; |
737 |
+- else |
738 |
+- hdr = request->desc->hdr1; |
739 |
++ hdr = get_request_hdr(request, is_sec1); |
740 |
+ |
741 |
+ if ((hdr & DESC_HDR_DONE) == DESC_HDR_DONE) |
742 |
+ status = 0; |
743 |
+@@ -490,8 +500,14 @@ static u32 current_desc_hdr(struct device *dev, int ch) |
744 |
+ } |
745 |
+ } |
746 |
+ |
747 |
+- if (priv->chan[ch].fifo[iter].desc->next_desc == cur_desc) |
748 |
+- return (priv->chan[ch].fifo[iter].desc + 1)->hdr; |
749 |
++ if (priv->chan[ch].fifo[iter].desc->next_desc == cur_desc) { |
750 |
++ struct talitos_edesc *edesc; |
751 |
++ |
752 |
++ edesc = container_of(priv->chan[ch].fifo[iter].desc, |
753 |
++ struct talitos_edesc, desc); |
754 |
++ return ((struct talitos_desc *) |
755 |
++ (edesc->buf + edesc->dma_len))->hdr; |
756 |
++ } |
757 |
+ |
758 |
+ return priv->chan[ch].fifo[iter].desc->hdr; |
759 |
+ } |
760 |
+@@ -913,36 +929,6 @@ badkey: |
761 |
+ return -EINVAL; |
762 |
+ } |
763 |
+ |
764 |
+-/* |
765 |
+- * talitos_edesc - s/w-extended descriptor |
766 |
+- * @src_nents: number of segments in input scatterlist |
767 |
+- * @dst_nents: number of segments in output scatterlist |
768 |
+- * @icv_ool: whether ICV is out-of-line |
769 |
+- * @iv_dma: dma address of iv for checking continuity and link table |
770 |
+- * @dma_len: length of dma mapped link_tbl space |
771 |
+- * @dma_link_tbl: bus physical address of link_tbl/buf |
772 |
+- * @desc: h/w descriptor |
773 |
+- * @link_tbl: input and output h/w link tables (if {src,dst}_nents > 1) (SEC2) |
774 |
+- * @buf: input and output buffeur (if {src,dst}_nents > 1) (SEC1) |
775 |
+- * |
776 |
+- * if decrypting (with authcheck), or either one of src_nents or dst_nents |
777 |
+- * is greater than 1, an integrity check value is concatenated to the end |
778 |
+- * of link_tbl data |
779 |
+- */ |
780 |
+-struct talitos_edesc { |
781 |
+- int src_nents; |
782 |
+- int dst_nents; |
783 |
+- bool icv_ool; |
784 |
+- dma_addr_t iv_dma; |
785 |
+- int dma_len; |
786 |
+- dma_addr_t dma_link_tbl; |
787 |
+- struct talitos_desc desc; |
788 |
+- union { |
789 |
+- struct talitos_ptr link_tbl[0]; |
790 |
+- u8 buf[0]; |
791 |
+- }; |
792 |
+-}; |
793 |
+- |
794 |
+ static void talitos_sg_unmap(struct device *dev, |
795 |
+ struct talitos_edesc *edesc, |
796 |
+ struct scatterlist *src, |
797 |
+@@ -1431,15 +1417,11 @@ static struct talitos_edesc *talitos_edesc_alloc(struct device *dev, |
798 |
+ edesc->dst_nents = dst_nents; |
799 |
+ edesc->iv_dma = iv_dma; |
800 |
+ edesc->dma_len = dma_len; |
801 |
+- if (dma_len) { |
802 |
+- void *addr = &edesc->link_tbl[0]; |
803 |
+- |
804 |
+- if (is_sec1 && !dst) |
805 |
+- addr += sizeof(struct talitos_desc); |
806 |
+- edesc->dma_link_tbl = dma_map_single(dev, addr, |
807 |
++ if (dma_len) |
808 |
++ edesc->dma_link_tbl = dma_map_single(dev, &edesc->link_tbl[0], |
809 |
+ edesc->dma_len, |
810 |
+ DMA_BIDIRECTIONAL); |
811 |
+- } |
812 |
++ |
813 |
+ return edesc; |
814 |
+ } |
815 |
+ |
816 |
+@@ -1706,14 +1688,16 @@ static void common_nonsnoop_hash_unmap(struct device *dev, |
817 |
+ struct talitos_private *priv = dev_get_drvdata(dev); |
818 |
+ bool is_sec1 = has_ftr_sec1(priv); |
819 |
+ struct talitos_desc *desc = &edesc->desc; |
820 |
+- struct talitos_desc *desc2 = desc + 1; |
821 |
++ struct talitos_desc *desc2 = (struct talitos_desc *) |
822 |
++ (edesc->buf + edesc->dma_len); |
823 |
+ |
824 |
+ unmap_single_talitos_ptr(dev, &edesc->desc.ptr[5], DMA_FROM_DEVICE); |
825 |
+ if (desc->next_desc && |
826 |
+ desc->ptr[5].ptr != desc2->ptr[5].ptr) |
827 |
+ unmap_single_talitos_ptr(dev, &desc2->ptr[5], DMA_FROM_DEVICE); |
828 |
+ |
829 |
+- talitos_sg_unmap(dev, edesc, req_ctx->psrc, NULL, 0, 0); |
830 |
++ if (req_ctx->psrc) |
831 |
++ talitos_sg_unmap(dev, edesc, req_ctx->psrc, NULL, 0, 0); |
832 |
+ |
833 |
+ /* When using hashctx-in, must unmap it. */ |
834 |
+ if (from_talitos_ptr_len(&edesc->desc.ptr[1], is_sec1)) |
835 |
+@@ -1780,7 +1764,6 @@ static void talitos_handle_buggy_hash(struct talitos_ctx *ctx, |
836 |
+ |
837 |
+ static int common_nonsnoop_hash(struct talitos_edesc *edesc, |
838 |
+ struct ahash_request *areq, unsigned int length, |
839 |
+- unsigned int offset, |
840 |
+ void (*callback) (struct device *dev, |
841 |
+ struct talitos_desc *desc, |
842 |
+ void *context, int error)) |
843 |
+@@ -1819,9 +1802,7 @@ static int common_nonsnoop_hash(struct talitos_edesc *edesc, |
844 |
+ |
845 |
+ sg_count = edesc->src_nents ?: 1; |
846 |
+ if (is_sec1 && sg_count > 1) |
847 |
+- sg_pcopy_to_buffer(req_ctx->psrc, sg_count, |
848 |
+- edesc->buf + sizeof(struct talitos_desc), |
849 |
+- length, req_ctx->nbuf); |
850 |
++ sg_copy_to_buffer(req_ctx->psrc, sg_count, edesc->buf, length); |
851 |
+ else if (length) |
852 |
+ sg_count = dma_map_sg(dev, req_ctx->psrc, sg_count, |
853 |
+ DMA_TO_DEVICE); |
854 |
+@@ -1834,7 +1815,7 @@ static int common_nonsnoop_hash(struct talitos_edesc *edesc, |
855 |
+ DMA_TO_DEVICE); |
856 |
+ } else { |
857 |
+ sg_count = talitos_sg_map(dev, req_ctx->psrc, length, edesc, |
858 |
+- &desc->ptr[3], sg_count, offset, 0); |
859 |
++ &desc->ptr[3], sg_count, 0, 0); |
860 |
+ if (sg_count > 1) |
861 |
+ sync_needed = true; |
862 |
+ } |
863 |
+@@ -1858,7 +1839,8 @@ static int common_nonsnoop_hash(struct talitos_edesc *edesc, |
864 |
+ talitos_handle_buggy_hash(ctx, edesc, &desc->ptr[3]); |
865 |
+ |
866 |
+ if (is_sec1 && req_ctx->nbuf && length) { |
867 |
+- struct talitos_desc *desc2 = desc + 1; |
868 |
++ struct talitos_desc *desc2 = (struct talitos_desc *) |
869 |
++ (edesc->buf + edesc->dma_len); |
870 |
+ dma_addr_t next_desc; |
871 |
+ |
872 |
+ memset(desc2, 0, sizeof(*desc2)); |
873 |
+@@ -1879,7 +1861,7 @@ static int common_nonsnoop_hash(struct talitos_edesc *edesc, |
874 |
+ DMA_TO_DEVICE); |
875 |
+ copy_talitos_ptr(&desc2->ptr[2], &desc->ptr[2], is_sec1); |
876 |
+ sg_count = talitos_sg_map(dev, req_ctx->psrc, length, edesc, |
877 |
+- &desc2->ptr[3], sg_count, offset, 0); |
878 |
++ &desc2->ptr[3], sg_count, 0, 0); |
879 |
+ if (sg_count > 1) |
880 |
+ sync_needed = true; |
881 |
+ copy_talitos_ptr(&desc2->ptr[5], &desc->ptr[5], is_sec1); |
882 |
+@@ -1990,7 +1972,6 @@ static int ahash_process_req(struct ahash_request *areq, unsigned int nbytes) |
883 |
+ struct device *dev = ctx->dev; |
884 |
+ struct talitos_private *priv = dev_get_drvdata(dev); |
885 |
+ bool is_sec1 = has_ftr_sec1(priv); |
886 |
+- int offset = 0; |
887 |
+ u8 *ctx_buf = req_ctx->buf[req_ctx->buf_idx]; |
888 |
+ |
889 |
+ if (!req_ctx->last && (nbytes + req_ctx->nbuf <= blocksize)) { |
890 |
+@@ -2030,6 +2011,8 @@ static int ahash_process_req(struct ahash_request *areq, unsigned int nbytes) |
891 |
+ sg_chain(req_ctx->bufsl, 2, areq->src); |
892 |
+ req_ctx->psrc = req_ctx->bufsl; |
893 |
+ } else if (is_sec1 && req_ctx->nbuf && req_ctx->nbuf < blocksize) { |
894 |
++ int offset; |
895 |
++ |
896 |
+ if (nbytes_to_hash > blocksize) |
897 |
+ offset = blocksize - req_ctx->nbuf; |
898 |
+ else |
899 |
+@@ -2042,7 +2025,8 @@ static int ahash_process_req(struct ahash_request *areq, unsigned int nbytes) |
900 |
+ sg_copy_to_buffer(areq->src, nents, |
901 |
+ ctx_buf + req_ctx->nbuf, offset); |
902 |
+ req_ctx->nbuf += offset; |
903 |
+- req_ctx->psrc = areq->src; |
904 |
++ req_ctx->psrc = scatterwalk_ffwd(req_ctx->bufsl, areq->src, |
905 |
++ offset); |
906 |
+ } else |
907 |
+ req_ctx->psrc = areq->src; |
908 |
+ |
909 |
+@@ -2082,8 +2066,7 @@ static int ahash_process_req(struct ahash_request *areq, unsigned int nbytes) |
910 |
+ if (ctx->keylen && (req_ctx->first || req_ctx->last)) |
911 |
+ edesc->desc.hdr |= DESC_HDR_MODE0_MDEU_HMAC; |
912 |
+ |
913 |
+- return common_nonsnoop_hash(edesc, areq, nbytes_to_hash, offset, |
914 |
+- ahash_done); |
915 |
++ return common_nonsnoop_hash(edesc, areq, nbytes_to_hash, ahash_done); |
916 |
+ } |
917 |
+ |
918 |
+ static int ahash_update(struct ahash_request *areq) |
919 |
+diff --git a/drivers/crypto/talitos.h b/drivers/crypto/talitos.h |
920 |
+index a65a63e0d6c1..979f6a61e545 100644 |
921 |
+--- a/drivers/crypto/talitos.h |
922 |
++++ b/drivers/crypto/talitos.h |
923 |
+@@ -65,6 +65,36 @@ struct talitos_desc { |
924 |
+ |
925 |
+ #define TALITOS_DESC_SIZE (sizeof(struct talitos_desc) - sizeof(__be32)) |
926 |
+ |
927 |
++/* |
928 |
++ * talitos_edesc - s/w-extended descriptor |
929 |
++ * @src_nents: number of segments in input scatterlist |
930 |
++ * @dst_nents: number of segments in output scatterlist |
931 |
++ * @icv_ool: whether ICV is out-of-line |
932 |
++ * @iv_dma: dma address of iv for checking continuity and link table |
933 |
++ * @dma_len: length of dma mapped link_tbl space |
934 |
++ * @dma_link_tbl: bus physical address of link_tbl/buf |
935 |
++ * @desc: h/w descriptor |
936 |
++ * @link_tbl: input and output h/w link tables (if {src,dst}_nents > 1) (SEC2) |
937 |
++ * @buf: input and output buffeur (if {src,dst}_nents > 1) (SEC1) |
938 |
++ * |
939 |
++ * if decrypting (with authcheck), or either one of src_nents or dst_nents |
940 |
++ * is greater than 1, an integrity check value is concatenated to the end |
941 |
++ * of link_tbl data |
942 |
++ */ |
943 |
++struct talitos_edesc { |
944 |
++ int src_nents; |
945 |
++ int dst_nents; |
946 |
++ bool icv_ool; |
947 |
++ dma_addr_t iv_dma; |
948 |
++ int dma_len; |
949 |
++ dma_addr_t dma_link_tbl; |
950 |
++ struct talitos_desc desc; |
951 |
++ union { |
952 |
++ struct talitos_ptr link_tbl[0]; |
953 |
++ u8 buf[0]; |
954 |
++ }; |
955 |
++}; |
956 |
++ |
957 |
+ /** |
958 |
+ * talitos_request - descriptor submission request |
959 |
+ * @desc: descriptor pointer (kernel virtual) |
960 |
+diff --git a/drivers/firmware/efi/efi-bgrt.c b/drivers/firmware/efi/efi-bgrt.c |
961 |
+index a2384184a7de..b07c17643210 100644 |
962 |
+--- a/drivers/firmware/efi/efi-bgrt.c |
963 |
++++ b/drivers/firmware/efi/efi-bgrt.c |
964 |
+@@ -47,11 +47,6 @@ void __init efi_bgrt_init(struct acpi_table_header *table) |
965 |
+ bgrt->version); |
966 |
+ goto out; |
967 |
+ } |
968 |
+- if (bgrt->status & 0xfe) { |
969 |
+- pr_notice("Ignoring BGRT: reserved status bits are non-zero %u\n", |
970 |
+- bgrt->status); |
971 |
+- goto out; |
972 |
+- } |
973 |
+ if (bgrt->image_type != 0) { |
974 |
+ pr_notice("Ignoring BGRT: invalid image type %u (expected 0)\n", |
975 |
+ bgrt->image_type); |
976 |
+diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h |
977 |
+index 6537086fb145..b1636ce22060 100644 |
978 |
+--- a/drivers/hid/hid-ids.h |
979 |
++++ b/drivers/hid/hid-ids.h |
980 |
+@@ -83,6 +83,7 @@ |
981 |
+ #define HID_DEVICE_ID_ALPS_U1_DUAL_3BTN_PTP 0x1220 |
982 |
+ #define HID_DEVICE_ID_ALPS_U1 0x1215 |
983 |
+ #define HID_DEVICE_ID_ALPS_T4_BTNLESS 0x120C |
984 |
++#define HID_DEVICE_ID_ALPS_1222 0x1222 |
985 |
+ |
986 |
+ |
987 |
+ #define USB_VENDOR_ID_AMI 0x046b |
988 |
+@@ -272,6 +273,7 @@ |
989 |
+ #define USB_DEVICE_ID_CHICONY_MULTI_TOUCH 0xb19d |
990 |
+ #define USB_DEVICE_ID_CHICONY_WIRELESS 0x0618 |
991 |
+ #define USB_DEVICE_ID_CHICONY_PIXART_USB_OPTICAL_MOUSE 0x1053 |
992 |
++#define USB_DEVICE_ID_CHICONY_PIXART_USB_OPTICAL_MOUSE2 0x0939 |
993 |
+ #define USB_DEVICE_ID_CHICONY_WIRELESS2 0x1123 |
994 |
+ #define USB_DEVICE_ID_ASUS_AK1D 0x1125 |
995 |
+ #define USB_DEVICE_ID_CHICONY_TOSHIBA_WT10A 0x1408 |
996 |
+@@ -571,6 +573,7 @@ |
997 |
+ |
998 |
+ #define USB_VENDOR_ID_HUION 0x256c |
999 |
+ #define USB_DEVICE_ID_HUION_TABLET 0x006e |
1000 |
++#define USB_DEVICE_ID_HUION_HS64 0x006d |
1001 |
+ |
1002 |
+ #define USB_VENDOR_ID_IBM 0x04b3 |
1003 |
+ #define USB_DEVICE_ID_IBM_SCROLLPOINT_III 0x3100 |
1004 |
+diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c |
1005 |
+index 1565a307170a..42bb635895cf 100644 |
1006 |
+--- a/drivers/hid/hid-multitouch.c |
1007 |
++++ b/drivers/hid/hid-multitouch.c |
1008 |
+@@ -1780,6 +1780,10 @@ static const struct hid_device_id mt_devices[] = { |
1009 |
+ HID_DEVICE(BUS_I2C, HID_GROUP_MULTITOUCH_WIN_8, |
1010 |
+ USB_VENDOR_ID_ALPS_JP, |
1011 |
+ HID_DEVICE_ID_ALPS_U1_DUAL_3BTN_PTP) }, |
1012 |
++ { .driver_data = MT_CLS_WIN_8_DUAL, |
1013 |
++ HID_DEVICE(BUS_I2C, HID_GROUP_MULTITOUCH_WIN_8, |
1014 |
++ USB_VENDOR_ID_ALPS_JP, |
1015 |
++ HID_DEVICE_ID_ALPS_1222) }, |
1016 |
+ |
1017 |
+ /* Lenovo X1 TAB Gen 2 */ |
1018 |
+ { .driver_data = MT_CLS_WIN_8_DUAL, |
1019 |
+diff --git a/drivers/hid/hid-quirks.c b/drivers/hid/hid-quirks.c |
1020 |
+index 189bf68eb35c..74c0ad21b267 100644 |
1021 |
+--- a/drivers/hid/hid-quirks.c |
1022 |
++++ b/drivers/hid/hid-quirks.c |
1023 |
+@@ -45,6 +45,7 @@ static const struct hid_device_id hid_quirks[] = { |
1024 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_UC100KM), HID_QUIRK_NOGET }, |
1025 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_MULTI_TOUCH), HID_QUIRK_MULTI_INPUT }, |
1026 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_PIXART_USB_OPTICAL_MOUSE), HID_QUIRK_ALWAYS_POLL }, |
1027 |
++ { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_PIXART_USB_OPTICAL_MOUSE2), HID_QUIRK_ALWAYS_POLL }, |
1028 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_WIRELESS), HID_QUIRK_MULTI_INPUT }, |
1029 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_CHIC, USB_DEVICE_ID_CHIC_GAMEPAD), HID_QUIRK_BADPAD }, |
1030 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_3AXIS_5BUTTON_STICK), HID_QUIRK_NOGET }, |
1031 |
+diff --git a/drivers/hid/hid-uclogic-core.c b/drivers/hid/hid-uclogic-core.c |
1032 |
+index 8fe02d81265d..914fb527ae7a 100644 |
1033 |
+--- a/drivers/hid/hid-uclogic-core.c |
1034 |
++++ b/drivers/hid/hid-uclogic-core.c |
1035 |
+@@ -369,6 +369,8 @@ static const struct hid_device_id uclogic_devices[] = { |
1036 |
+ USB_DEVICE_ID_UCLOGIC_TABLET_TWHA60) }, |
1037 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_HUION, |
1038 |
+ USB_DEVICE_ID_HUION_TABLET) }, |
1039 |
++ { HID_USB_DEVICE(USB_VENDOR_ID_HUION, |
1040 |
++ USB_DEVICE_ID_HUION_HS64) }, |
1041 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, |
1042 |
+ USB_DEVICE_ID_HUION_TABLET) }, |
1043 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, |
1044 |
+diff --git a/drivers/hid/hid-uclogic-params.c b/drivers/hid/hid-uclogic-params.c |
1045 |
+index 0187c9f8fc22..273d784fff66 100644 |
1046 |
+--- a/drivers/hid/hid-uclogic-params.c |
1047 |
++++ b/drivers/hid/hid-uclogic-params.c |
1048 |
+@@ -977,6 +977,8 @@ int uclogic_params_init(struct uclogic_params *params, |
1049 |
+ /* FALL THROUGH */ |
1050 |
+ case VID_PID(USB_VENDOR_ID_HUION, |
1051 |
+ USB_DEVICE_ID_HUION_TABLET): |
1052 |
++ case VID_PID(USB_VENDOR_ID_HUION, |
1053 |
++ USB_DEVICE_ID_HUION_HS64): |
1054 |
+ case VID_PID(USB_VENDOR_ID_UCLOGIC, |
1055 |
+ USB_DEVICE_ID_HUION_TABLET): |
1056 |
+ case VID_PID(USB_VENDOR_ID_UCLOGIC, |
1057 |
+diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c |
1058 |
+index 8e6077d8e434..68fd8232d44c 100644 |
1059 |
+--- a/drivers/input/mouse/synaptics.c |
1060 |
++++ b/drivers/input/mouse/synaptics.c |
1061 |
+@@ -176,6 +176,7 @@ static const char * const smbus_pnp_ids[] = { |
1062 |
+ "LEN0072", /* X1 Carbon Gen 5 (2017) - Elan/ALPS trackpoint */ |
1063 |
+ "LEN0073", /* X1 Carbon G5 (Elantech) */ |
1064 |
+ "LEN0092", /* X1 Carbon 6 */ |
1065 |
++ "LEN0093", /* T480 */ |
1066 |
+ "LEN0096", /* X280 */ |
1067 |
+ "LEN0097", /* X280 -> ALPS trackpoint */ |
1068 |
+ "LEN200f", /* T450s */ |
1069 |
+diff --git a/drivers/irqchip/irq-csky-mpintc.c b/drivers/irqchip/irq-csky-mpintc.c |
1070 |
+index c67c961ab6cc..a4c1aacba1ff 100644 |
1071 |
+--- a/drivers/irqchip/irq-csky-mpintc.c |
1072 |
++++ b/drivers/irqchip/irq-csky-mpintc.c |
1073 |
+@@ -89,8 +89,19 @@ static int csky_irq_set_affinity(struct irq_data *d, |
1074 |
+ if (cpu >= nr_cpu_ids) |
1075 |
+ return -EINVAL; |
1076 |
+ |
1077 |
+- /* Enable interrupt destination */ |
1078 |
+- cpu |= BIT(31); |
1079 |
++ /* |
1080 |
++ * The csky,mpintc could support auto irq deliver, but it only |
1081 |
++ * could deliver external irq to one cpu or all cpus. So it |
1082 |
++ * doesn't support deliver external irq to a group of cpus |
1083 |
++ * with cpu_mask. |
1084 |
++ * SO we only use auto deliver mode when affinity mask_val is |
1085 |
++ * equal to cpu_present_mask. |
1086 |
++ * |
1087 |
++ */ |
1088 |
++ if (cpumask_equal(mask_val, cpu_present_mask)) |
1089 |
++ cpu = 0; |
1090 |
++ else |
1091 |
++ cpu |= BIT(31); |
1092 |
+ |
1093 |
+ writel_relaxed(cpu, INTCG_base + INTCG_CIDSTR + offset); |
1094 |
+ |
1095 |
+diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c |
1096 |
+index 7577755bdcf4..eead9def9921 100644 |
1097 |
+--- a/drivers/irqchip/irq-gic-v3-its.c |
1098 |
++++ b/drivers/irqchip/irq-gic-v3-its.c |
1099 |
+@@ -745,32 +745,43 @@ static void its_flush_cmd(struct its_node *its, struct its_cmd_block *cmd) |
1100 |
+ } |
1101 |
+ |
1102 |
+ static int its_wait_for_range_completion(struct its_node *its, |
1103 |
+- struct its_cmd_block *from, |
1104 |
++ u64 prev_idx, |
1105 |
+ struct its_cmd_block *to) |
1106 |
+ { |
1107 |
+- u64 rd_idx, from_idx, to_idx; |
1108 |
++ u64 rd_idx, to_idx, linear_idx; |
1109 |
+ u32 count = 1000000; /* 1s! */ |
1110 |
+ |
1111 |
+- from_idx = its_cmd_ptr_to_offset(its, from); |
1112 |
++ /* Linearize to_idx if the command set has wrapped around */ |
1113 |
+ to_idx = its_cmd_ptr_to_offset(its, to); |
1114 |
++ if (to_idx < prev_idx) |
1115 |
++ to_idx += ITS_CMD_QUEUE_SZ; |
1116 |
++ |
1117 |
++ linear_idx = prev_idx; |
1118 |
+ |
1119 |
+ while (1) { |
1120 |
++ s64 delta; |
1121 |
++ |
1122 |
+ rd_idx = readl_relaxed(its->base + GITS_CREADR); |
1123 |
+ |
1124 |
+- /* Direct case */ |
1125 |
+- if (from_idx < to_idx && rd_idx >= to_idx) |
1126 |
+- break; |
1127 |
++ /* |
1128 |
++ * Compute the read pointer progress, taking the |
1129 |
++ * potential wrap-around into account. |
1130 |
++ */ |
1131 |
++ delta = rd_idx - prev_idx; |
1132 |
++ if (rd_idx < prev_idx) |
1133 |
++ delta += ITS_CMD_QUEUE_SZ; |
1134 |
+ |
1135 |
+- /* Wrapped case */ |
1136 |
+- if (from_idx >= to_idx && rd_idx >= to_idx && rd_idx < from_idx) |
1137 |
++ linear_idx += delta; |
1138 |
++ if (linear_idx >= to_idx) |
1139 |
+ break; |
1140 |
+ |
1141 |
+ count--; |
1142 |
+ if (!count) { |
1143 |
+- pr_err_ratelimited("ITS queue timeout (%llu %llu %llu)\n", |
1144 |
+- from_idx, to_idx, rd_idx); |
1145 |
++ pr_err_ratelimited("ITS queue timeout (%llu %llu)\n", |
1146 |
++ to_idx, linear_idx); |
1147 |
+ return -1; |
1148 |
+ } |
1149 |
++ prev_idx = rd_idx; |
1150 |
+ cpu_relax(); |
1151 |
+ udelay(1); |
1152 |
+ } |
1153 |
+@@ -787,6 +798,7 @@ void name(struct its_node *its, \ |
1154 |
+ struct its_cmd_block *cmd, *sync_cmd, *next_cmd; \ |
1155 |
+ synctype *sync_obj; \ |
1156 |
+ unsigned long flags; \ |
1157 |
++ u64 rd_idx; \ |
1158 |
+ \ |
1159 |
+ raw_spin_lock_irqsave(&its->lock, flags); \ |
1160 |
+ \ |
1161 |
+@@ -808,10 +820,11 @@ void name(struct its_node *its, \ |
1162 |
+ } \ |
1163 |
+ \ |
1164 |
+ post: \ |
1165 |
++ rd_idx = readl_relaxed(its->base + GITS_CREADR); \ |
1166 |
+ next_cmd = its_post_commands(its); \ |
1167 |
+ raw_spin_unlock_irqrestore(&its->lock, flags); \ |
1168 |
+ \ |
1169 |
+- if (its_wait_for_range_completion(its, cmd, next_cmd)) \ |
1170 |
++ if (its_wait_for_range_completion(its, rd_idx, next_cmd)) \ |
1171 |
+ pr_err_ratelimited("ITS cmd %ps failed\n", builder); \ |
1172 |
+ } |
1173 |
+ |
1174 |
+diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c |
1175 |
+index 350cf0451456..ec8b27e20de3 100644 |
1176 |
+--- a/drivers/md/dm-table.c |
1177 |
++++ b/drivers/md/dm-table.c |
1178 |
+@@ -561,7 +561,7 @@ static char **realloc_argv(unsigned *size, char **old_argv) |
1179 |
+ gfp = GFP_NOIO; |
1180 |
+ } |
1181 |
+ argv = kmalloc_array(new_size, sizeof(*argv), gfp); |
1182 |
+- if (argv) { |
1183 |
++ if (argv && old_argv) { |
1184 |
+ memcpy(argv, old_argv, *size * sizeof(*argv)); |
1185 |
+ *size = new_size; |
1186 |
+ } |
1187 |
+diff --git a/drivers/md/dm-verity-target.c b/drivers/md/dm-verity-target.c |
1188 |
+index f4c31ffaa88e..cec1c0ff33eb 100644 |
1189 |
+--- a/drivers/md/dm-verity-target.c |
1190 |
++++ b/drivers/md/dm-verity-target.c |
1191 |
+@@ -236,8 +236,8 @@ static int verity_handle_err(struct dm_verity *v, enum verity_block_type type, |
1192 |
+ BUG(); |
1193 |
+ } |
1194 |
+ |
1195 |
+- DMERR("%s: %s block %llu is corrupted", v->data_dev->name, type_str, |
1196 |
+- block); |
1197 |
++ DMERR_LIMIT("%s: %s block %llu is corrupted", v->data_dev->name, |
1198 |
++ type_str, block); |
1199 |
+ |
1200 |
+ if (v->corrupted_errs == DM_VERITY_MAX_CORRUPTED_ERRS) |
1201 |
+ DMERR("%s: reached maximum errors", v->data_dev->name); |
1202 |
+diff --git a/drivers/net/ethernet/emulex/benet/be_ethtool.c b/drivers/net/ethernet/emulex/benet/be_ethtool.c |
1203 |
+index 6e635debc7fd..cfa01efa5b48 100644 |
1204 |
+--- a/drivers/net/ethernet/emulex/benet/be_ethtool.c |
1205 |
++++ b/drivers/net/ethernet/emulex/benet/be_ethtool.c |
1206 |
+@@ -895,7 +895,7 @@ static void be_self_test(struct net_device *netdev, struct ethtool_test *test, |
1207 |
+ u64 *data) |
1208 |
+ { |
1209 |
+ struct be_adapter *adapter = netdev_priv(netdev); |
1210 |
+- int status; |
1211 |
++ int status, cnt; |
1212 |
+ u8 link_status = 0; |
1213 |
+ |
1214 |
+ if (adapter->function_caps & BE_FUNCTION_CAPS_SUPER_NIC) { |
1215 |
+@@ -906,6 +906,9 @@ static void be_self_test(struct net_device *netdev, struct ethtool_test *test, |
1216 |
+ |
1217 |
+ memset(data, 0, sizeof(u64) * ETHTOOL_TESTS_NUM); |
1218 |
+ |
1219 |
++ /* check link status before offline tests */ |
1220 |
++ link_status = netif_carrier_ok(netdev); |
1221 |
++ |
1222 |
+ if (test->flags & ETH_TEST_FL_OFFLINE) { |
1223 |
+ if (be_loopback_test(adapter, BE_MAC_LOOPBACK, &data[0]) != 0) |
1224 |
+ test->flags |= ETH_TEST_FL_FAILED; |
1225 |
+@@ -926,13 +929,26 @@ static void be_self_test(struct net_device *netdev, struct ethtool_test *test, |
1226 |
+ test->flags |= ETH_TEST_FL_FAILED; |
1227 |
+ } |
1228 |
+ |
1229 |
+- status = be_cmd_link_status_query(adapter, NULL, &link_status, 0); |
1230 |
+- if (status) { |
1231 |
+- test->flags |= ETH_TEST_FL_FAILED; |
1232 |
+- data[4] = -1; |
1233 |
+- } else if (!link_status) { |
1234 |
++ /* link status was down prior to test */ |
1235 |
++ if (!link_status) { |
1236 |
+ test->flags |= ETH_TEST_FL_FAILED; |
1237 |
+ data[4] = 1; |
1238 |
++ return; |
1239 |
++ } |
1240 |
++ |
1241 |
++ for (cnt = 10; cnt; cnt--) { |
1242 |
++ status = be_cmd_link_status_query(adapter, NULL, &link_status, |
1243 |
++ 0); |
1244 |
++ if (status) { |
1245 |
++ test->flags |= ETH_TEST_FL_FAILED; |
1246 |
++ data[4] = -1; |
1247 |
++ break; |
1248 |
++ } |
1249 |
++ |
1250 |
++ if (link_status) |
1251 |
++ break; |
1252 |
++ |
1253 |
++ msleep_interruptible(500); |
1254 |
+ } |
1255 |
+ } |
1256 |
+ |
1257 |
+diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c |
1258 |
+index c10c9d7eadaa..f4a00ee39834 100644 |
1259 |
+--- a/drivers/net/ethernet/intel/e1000e/netdev.c |
1260 |
++++ b/drivers/net/ethernet/intel/e1000e/netdev.c |
1261 |
+@@ -4209,7 +4209,7 @@ void e1000e_up(struct e1000_adapter *adapter) |
1262 |
+ e1000_configure_msix(adapter); |
1263 |
+ e1000_irq_enable(adapter); |
1264 |
+ |
1265 |
+- netif_start_queue(adapter->netdev); |
1266 |
++ /* Tx queue started by watchdog timer when link is up */ |
1267 |
+ |
1268 |
+ e1000e_trigger_lsc(adapter); |
1269 |
+ } |
1270 |
+@@ -4607,6 +4607,7 @@ int e1000e_open(struct net_device *netdev) |
1271 |
+ pm_runtime_get_sync(&pdev->dev); |
1272 |
+ |
1273 |
+ netif_carrier_off(netdev); |
1274 |
++ netif_stop_queue(netdev); |
1275 |
+ |
1276 |
+ /* allocate transmit descriptors */ |
1277 |
+ err = e1000e_setup_tx_resources(adapter->tx_ring); |
1278 |
+@@ -4667,7 +4668,6 @@ int e1000e_open(struct net_device *netdev) |
1279 |
+ e1000_irq_enable(adapter); |
1280 |
+ |
1281 |
+ adapter->tx_hang_recheck = false; |
1282 |
+- netif_start_queue(netdev); |
1283 |
+ |
1284 |
+ hw->mac.get_link_status = true; |
1285 |
+ pm_runtime_put(&pdev->dev); |
1286 |
+@@ -5289,6 +5289,7 @@ static void e1000_watchdog_task(struct work_struct *work) |
1287 |
+ if (phy->ops.cfg_on_link_up) |
1288 |
+ phy->ops.cfg_on_link_up(hw); |
1289 |
+ |
1290 |
++ netif_wake_queue(netdev); |
1291 |
+ netif_carrier_on(netdev); |
1292 |
+ |
1293 |
+ if (!test_bit(__E1000_DOWN, &adapter->state)) |
1294 |
+@@ -5302,6 +5303,7 @@ static void e1000_watchdog_task(struct work_struct *work) |
1295 |
+ /* Link status message must follow this format */ |
1296 |
+ pr_info("%s NIC Link is Down\n", adapter->netdev->name); |
1297 |
+ netif_carrier_off(netdev); |
1298 |
++ netif_stop_queue(netdev); |
1299 |
+ if (!test_bit(__E1000_DOWN, &adapter->state)) |
1300 |
+ mod_timer(&adapter->phy_info_timer, |
1301 |
+ round_jiffies(jiffies + 2 * HZ)); |
1302 |
+@@ -5309,13 +5311,8 @@ static void e1000_watchdog_task(struct work_struct *work) |
1303 |
+ /* 8000ES2LAN requires a Rx packet buffer work-around |
1304 |
+ * on link down event; reset the controller to flush |
1305 |
+ * the Rx packet buffer. |
1306 |
+- * |
1307 |
+- * If the link is lost the controller stops DMA, but |
1308 |
+- * if there is queued Tx work it cannot be done. So |
1309 |
+- * reset the controller to flush the Tx packet buffers. |
1310 |
+ */ |
1311 |
+- if ((adapter->flags & FLAG_RX_NEEDS_RESTART) || |
1312 |
+- e1000_desc_unused(tx_ring) + 1 < tx_ring->count) |
1313 |
++ if (adapter->flags & FLAG_RX_NEEDS_RESTART) |
1314 |
+ adapter->flags |= FLAG_RESTART_NOW; |
1315 |
+ else |
1316 |
+ pm_schedule_suspend(netdev->dev.parent, |
1317 |
+@@ -5338,6 +5335,14 @@ link_up: |
1318 |
+ adapter->gotc_old = adapter->stats.gotc; |
1319 |
+ spin_unlock(&adapter->stats64_lock); |
1320 |
+ |
1321 |
++ /* If the link is lost the controller stops DMA, but |
1322 |
++ * if there is queued Tx work it cannot be done. So |
1323 |
++ * reset the controller to flush the Tx packet buffers. |
1324 |
++ */ |
1325 |
++ if (!netif_carrier_ok(netdev) && |
1326 |
++ (e1000_desc_unused(tx_ring) + 1 < tx_ring->count)) |
1327 |
++ adapter->flags |= FLAG_RESTART_NOW; |
1328 |
++ |
1329 |
+ /* If reset is necessary, do it outside of interrupt context. */ |
1330 |
+ if (adapter->flags & FLAG_RESTART_NOW) { |
1331 |
+ schedule_work(&adapter->reset_task); |
1332 |
+diff --git a/drivers/net/ethernet/sis/sis900.c b/drivers/net/ethernet/sis/sis900.c |
1333 |
+index 67f9bb6e941b..9b036c857b1d 100644 |
1334 |
+--- a/drivers/net/ethernet/sis/sis900.c |
1335 |
++++ b/drivers/net/ethernet/sis/sis900.c |
1336 |
+@@ -1057,7 +1057,7 @@ sis900_open(struct net_device *net_dev) |
1337 |
+ sis900_set_mode(sis_priv, HW_SPEED_10_MBPS, FDX_CAPABLE_HALF_SELECTED); |
1338 |
+ |
1339 |
+ /* Enable all known interrupts by setting the interrupt mask. */ |
1340 |
+- sw32(imr, RxSOVR | RxORN | RxERR | RxOK | TxURN | TxERR | TxIDLE); |
1341 |
++ sw32(imr, RxSOVR | RxORN | RxERR | RxOK | TxURN | TxERR | TxIDLE | TxDESC); |
1342 |
+ sw32(cr, RxENA | sr32(cr)); |
1343 |
+ sw32(ier, IE); |
1344 |
+ |
1345 |
+@@ -1578,7 +1578,7 @@ static void sis900_tx_timeout(struct net_device *net_dev) |
1346 |
+ sw32(txdp, sis_priv->tx_ring_dma); |
1347 |
+ |
1348 |
+ /* Enable all known interrupts by setting the interrupt mask. */ |
1349 |
+- sw32(imr, RxSOVR | RxORN | RxERR | RxOK | TxURN | TxERR | TxIDLE); |
1350 |
++ sw32(imr, RxSOVR | RxORN | RxERR | RxOK | TxURN | TxERR | TxIDLE | TxDESC); |
1351 |
+ } |
1352 |
+ |
1353 |
+ /** |
1354 |
+@@ -1618,7 +1618,7 @@ sis900_start_xmit(struct sk_buff *skb, struct net_device *net_dev) |
1355 |
+ spin_unlock_irqrestore(&sis_priv->lock, flags); |
1356 |
+ return NETDEV_TX_OK; |
1357 |
+ } |
1358 |
+- sis_priv->tx_ring[entry].cmdsts = (OWN | skb->len); |
1359 |
++ sis_priv->tx_ring[entry].cmdsts = (OWN | INTR | skb->len); |
1360 |
+ sw32(cr, TxENA | sr32(cr)); |
1361 |
+ |
1362 |
+ sis_priv->cur_tx ++; |
1363 |
+@@ -1674,7 +1674,7 @@ static irqreturn_t sis900_interrupt(int irq, void *dev_instance) |
1364 |
+ do { |
1365 |
+ status = sr32(isr); |
1366 |
+ |
1367 |
+- if ((status & (HIBERR|TxURN|TxERR|TxIDLE|RxORN|RxERR|RxOK)) == 0) |
1368 |
++ if ((status & (HIBERR|TxURN|TxERR|TxIDLE|TxDESC|RxORN|RxERR|RxOK)) == 0) |
1369 |
+ /* nothing intresting happened */ |
1370 |
+ break; |
1371 |
+ handled = 1; |
1372 |
+@@ -1684,7 +1684,7 @@ static irqreturn_t sis900_interrupt(int irq, void *dev_instance) |
1373 |
+ /* Rx interrupt */ |
1374 |
+ sis900_rx(net_dev); |
1375 |
+ |
1376 |
+- if (status & (TxURN | TxERR | TxIDLE)) |
1377 |
++ if (status & (TxURN | TxERR | TxIDLE | TxDESC)) |
1378 |
+ /* Tx interrupt */ |
1379 |
+ sis900_finish_xmit(net_dev); |
1380 |
+ |
1381 |
+@@ -1896,8 +1896,8 @@ static void sis900_finish_xmit (struct net_device *net_dev) |
1382 |
+ |
1383 |
+ if (tx_status & OWN) { |
1384 |
+ /* The packet is not transmitted yet (owned by hardware) ! |
1385 |
+- * Note: the interrupt is generated only when Tx Machine |
1386 |
+- * is idle, so this is an almost impossible case */ |
1387 |
++ * Note: this is an almost impossible condition |
1388 |
++ * in case of TxDESC ('descriptor interrupt') */ |
1389 |
+ break; |
1390 |
+ } |
1391 |
+ |
1392 |
+@@ -2473,7 +2473,7 @@ static int sis900_resume(struct pci_dev *pci_dev) |
1393 |
+ sis900_set_mode(sis_priv, HW_SPEED_10_MBPS, FDX_CAPABLE_HALF_SELECTED); |
1394 |
+ |
1395 |
+ /* Enable all known interrupts by setting the interrupt mask. */ |
1396 |
+- sw32(imr, RxSOVR | RxORN | RxERR | RxOK | TxURN | TxERR | TxIDLE); |
1397 |
++ sw32(imr, RxSOVR | RxORN | RxERR | RxOK | TxURN | TxERR | TxIDLE | TxDESC); |
1398 |
+ sw32(cr, RxENA | sr32(cr)); |
1399 |
+ sw32(ier, IE); |
1400 |
+ |
1401 |
+diff --git a/drivers/net/ppp/ppp_mppe.c b/drivers/net/ppp/ppp_mppe.c |
1402 |
+index 7ccdc62c6052..06d620b10704 100644 |
1403 |
+--- a/drivers/net/ppp/ppp_mppe.c |
1404 |
++++ b/drivers/net/ppp/ppp_mppe.c |
1405 |
+@@ -63,6 +63,7 @@ MODULE_AUTHOR("Frank Cusack <fcusack@×××××××.com>"); |
1406 |
+ MODULE_DESCRIPTION("Point-to-Point Protocol Microsoft Point-to-Point Encryption support"); |
1407 |
+ MODULE_LICENSE("Dual BSD/GPL"); |
1408 |
+ MODULE_ALIAS("ppp-compress-" __stringify(CI_MPPE)); |
1409 |
++MODULE_SOFTDEP("pre: arc4"); |
1410 |
+ MODULE_VERSION("1.0.2"); |
1411 |
+ |
1412 |
+ static unsigned int |
1413 |
+diff --git a/drivers/pinctrl/mediatek/mtk-eint.c b/drivers/pinctrl/mediatek/mtk-eint.c |
1414 |
+index f464f8cd274b..7e526bcf5e0b 100644 |
1415 |
+--- a/drivers/pinctrl/mediatek/mtk-eint.c |
1416 |
++++ b/drivers/pinctrl/mediatek/mtk-eint.c |
1417 |
+@@ -113,6 +113,8 @@ static void mtk_eint_mask(struct irq_data *d) |
1418 |
+ void __iomem *reg = mtk_eint_get_offset(eint, d->hwirq, |
1419 |
+ eint->regs->mask_set); |
1420 |
+ |
1421 |
++ eint->cur_mask[d->hwirq >> 5] &= ~mask; |
1422 |
++ |
1423 |
+ writel(mask, reg); |
1424 |
+ } |
1425 |
+ |
1426 |
+@@ -123,6 +125,8 @@ static void mtk_eint_unmask(struct irq_data *d) |
1427 |
+ void __iomem *reg = mtk_eint_get_offset(eint, d->hwirq, |
1428 |
+ eint->regs->mask_clr); |
1429 |
+ |
1430 |
++ eint->cur_mask[d->hwirq >> 5] |= mask; |
1431 |
++ |
1432 |
+ writel(mask, reg); |
1433 |
+ |
1434 |
+ if (eint->dual_edge[d->hwirq]) |
1435 |
+@@ -217,19 +221,6 @@ static void mtk_eint_chip_write_mask(const struct mtk_eint *eint, |
1436 |
+ } |
1437 |
+ } |
1438 |
+ |
1439 |
+-static void mtk_eint_chip_read_mask(const struct mtk_eint *eint, |
1440 |
+- void __iomem *base, u32 *buf) |
1441 |
+-{ |
1442 |
+- int port; |
1443 |
+- void __iomem *reg; |
1444 |
+- |
1445 |
+- for (port = 0; port < eint->hw->ports; port++) { |
1446 |
+- reg = base + eint->regs->mask + (port << 2); |
1447 |
+- buf[port] = ~readl_relaxed(reg); |
1448 |
+- /* Mask is 0 when irq is enabled, and 1 when disabled. */ |
1449 |
+- } |
1450 |
+-} |
1451 |
+- |
1452 |
+ static int mtk_eint_irq_request_resources(struct irq_data *d) |
1453 |
+ { |
1454 |
+ struct mtk_eint *eint = irq_data_get_irq_chip_data(d); |
1455 |
+@@ -318,7 +309,7 @@ static void mtk_eint_irq_handler(struct irq_desc *desc) |
1456 |
+ struct irq_chip *chip = irq_desc_get_chip(desc); |
1457 |
+ struct mtk_eint *eint = irq_desc_get_handler_data(desc); |
1458 |
+ unsigned int status, eint_num; |
1459 |
+- int offset, index, virq; |
1460 |
++ int offset, mask_offset, index, virq; |
1461 |
+ void __iomem *reg = mtk_eint_get_offset(eint, 0, eint->regs->stat); |
1462 |
+ int dual_edge, start_level, curr_level; |
1463 |
+ |
1464 |
+@@ -328,10 +319,24 @@ static void mtk_eint_irq_handler(struct irq_desc *desc) |
1465 |
+ status = readl(reg); |
1466 |
+ while (status) { |
1467 |
+ offset = __ffs(status); |
1468 |
++ mask_offset = eint_num >> 5; |
1469 |
+ index = eint_num + offset; |
1470 |
+ virq = irq_find_mapping(eint->domain, index); |
1471 |
+ status &= ~BIT(offset); |
1472 |
+ |
1473 |
++ /* |
1474 |
++ * If we get an interrupt on pin that was only required |
1475 |
++ * for wake (but no real interrupt requested), mask the |
1476 |
++ * interrupt (as would mtk_eint_resume do anyway later |
1477 |
++ * in the resume sequence). |
1478 |
++ */ |
1479 |
++ if (eint->wake_mask[mask_offset] & BIT(offset) && |
1480 |
++ !(eint->cur_mask[mask_offset] & BIT(offset))) { |
1481 |
++ writel_relaxed(BIT(offset), reg - |
1482 |
++ eint->regs->stat + |
1483 |
++ eint->regs->mask_set); |
1484 |
++ } |
1485 |
++ |
1486 |
+ dual_edge = eint->dual_edge[index]; |
1487 |
+ if (dual_edge) { |
1488 |
+ /* |
1489 |
+@@ -370,7 +375,6 @@ static void mtk_eint_irq_handler(struct irq_desc *desc) |
1490 |
+ |
1491 |
+ int mtk_eint_do_suspend(struct mtk_eint *eint) |
1492 |
+ { |
1493 |
+- mtk_eint_chip_read_mask(eint, eint->base, eint->cur_mask); |
1494 |
+ mtk_eint_chip_write_mask(eint, eint->base, eint->wake_mask); |
1495 |
+ |
1496 |
+ return 0; |
1497 |
+diff --git a/drivers/pinctrl/pinctrl-mcp23s08.c b/drivers/pinctrl/pinctrl-mcp23s08.c |
1498 |
+index 5d7a8514def9..b727de5654cd 100644 |
1499 |
+--- a/drivers/pinctrl/pinctrl-mcp23s08.c |
1500 |
++++ b/drivers/pinctrl/pinctrl-mcp23s08.c |
1501 |
+@@ -881,6 +881,10 @@ static int mcp23s08_probe_one(struct mcp23s08 *mcp, struct device *dev, |
1502 |
+ if (ret < 0) |
1503 |
+ goto fail; |
1504 |
+ |
1505 |
++ ret = devm_gpiochip_add_data(dev, &mcp->chip, mcp); |
1506 |
++ if (ret < 0) |
1507 |
++ goto fail; |
1508 |
++ |
1509 |
+ mcp->irq_controller = |
1510 |
+ device_property_read_bool(dev, "interrupt-controller"); |
1511 |
+ if (mcp->irq && mcp->irq_controller) { |
1512 |
+@@ -922,10 +926,6 @@ static int mcp23s08_probe_one(struct mcp23s08 *mcp, struct device *dev, |
1513 |
+ goto fail; |
1514 |
+ } |
1515 |
+ |
1516 |
+- ret = devm_gpiochip_add_data(dev, &mcp->chip, mcp); |
1517 |
+- if (ret < 0) |
1518 |
+- goto fail; |
1519 |
+- |
1520 |
+ if (one_regmap_config) { |
1521 |
+ mcp->pinctrl_desc.name = devm_kasprintf(dev, GFP_KERNEL, |
1522 |
+ "mcp23xxx-pinctrl.%d", raw_chip_address); |
1523 |
+diff --git a/drivers/pinctrl/pinctrl-ocelot.c b/drivers/pinctrl/pinctrl-ocelot.c |
1524 |
+index 3b4ca52d2456..fb76fb2e9ea5 100644 |
1525 |
+--- a/drivers/pinctrl/pinctrl-ocelot.c |
1526 |
++++ b/drivers/pinctrl/pinctrl-ocelot.c |
1527 |
+@@ -396,7 +396,7 @@ static int ocelot_pin_function_idx(struct ocelot_pinctrl *info, |
1528 |
+ return -1; |
1529 |
+ } |
1530 |
+ |
1531 |
+-#define REG(r, info, p) ((r) * (info)->stride + (4 * ((p) / 32))) |
1532 |
++#define REG_ALT(msb, info, p) (OCELOT_GPIO_ALT0 * (info)->stride + 4 * ((msb) + ((info)->stride * ((p) / 32)))) |
1533 |
+ |
1534 |
+ static int ocelot_pinmux_set_mux(struct pinctrl_dev *pctldev, |
1535 |
+ unsigned int selector, unsigned int group) |
1536 |
+@@ -412,19 +412,21 @@ static int ocelot_pinmux_set_mux(struct pinctrl_dev *pctldev, |
1537 |
+ |
1538 |
+ /* |
1539 |
+ * f is encoded on two bits. |
1540 |
+- * bit 0 of f goes in BIT(pin) of ALT0, bit 1 of f goes in BIT(pin) of |
1541 |
+- * ALT1 |
1542 |
++ * bit 0 of f goes in BIT(pin) of ALT[0], bit 1 of f goes in BIT(pin) of |
1543 |
++ * ALT[1] |
1544 |
+ * This is racy because both registers can't be updated at the same time |
1545 |
+ * but it doesn't matter much for now. |
1546 |
+ */ |
1547 |
+- regmap_update_bits(info->map, REG(OCELOT_GPIO_ALT0, info, pin->pin), |
1548 |
++ regmap_update_bits(info->map, REG_ALT(0, info, pin->pin), |
1549 |
+ BIT(p), f << p); |
1550 |
+- regmap_update_bits(info->map, REG(OCELOT_GPIO_ALT1, info, pin->pin), |
1551 |
++ regmap_update_bits(info->map, REG_ALT(1, info, pin->pin), |
1552 |
+ BIT(p), f << (p - 1)); |
1553 |
+ |
1554 |
+ return 0; |
1555 |
+ } |
1556 |
+ |
1557 |
++#define REG(r, info, p) ((r) * (info)->stride + (4 * ((p) / 32))) |
1558 |
++ |
1559 |
+ static int ocelot_gpio_set_direction(struct pinctrl_dev *pctldev, |
1560 |
+ struct pinctrl_gpio_range *range, |
1561 |
+ unsigned int pin, bool input) |
1562 |
+@@ -432,7 +434,7 @@ static int ocelot_gpio_set_direction(struct pinctrl_dev *pctldev, |
1563 |
+ struct ocelot_pinctrl *info = pinctrl_dev_get_drvdata(pctldev); |
1564 |
+ unsigned int p = pin % 32; |
1565 |
+ |
1566 |
+- regmap_update_bits(info->map, REG(OCELOT_GPIO_OE, info, p), BIT(p), |
1567 |
++ regmap_update_bits(info->map, REG(OCELOT_GPIO_OE, info, pin), BIT(p), |
1568 |
+ input ? 0 : BIT(p)); |
1569 |
+ |
1570 |
+ return 0; |
1571 |
+@@ -445,9 +447,9 @@ static int ocelot_gpio_request_enable(struct pinctrl_dev *pctldev, |
1572 |
+ struct ocelot_pinctrl *info = pinctrl_dev_get_drvdata(pctldev); |
1573 |
+ unsigned int p = offset % 32; |
1574 |
+ |
1575 |
+- regmap_update_bits(info->map, REG(OCELOT_GPIO_ALT0, info, offset), |
1576 |
++ regmap_update_bits(info->map, REG_ALT(0, info, offset), |
1577 |
+ BIT(p), 0); |
1578 |
+- regmap_update_bits(info->map, REG(OCELOT_GPIO_ALT1, info, offset), |
1579 |
++ regmap_update_bits(info->map, REG_ALT(1, info, offset), |
1580 |
+ BIT(p), 0); |
1581 |
+ |
1582 |
+ return 0; |
1583 |
+diff --git a/drivers/s390/cio/qdio_setup.c b/drivers/s390/cio/qdio_setup.c |
1584 |
+index a59887fad13e..06a9c7e3a63a 100644 |
1585 |
+--- a/drivers/s390/cio/qdio_setup.c |
1586 |
++++ b/drivers/s390/cio/qdio_setup.c |
1587 |
+@@ -150,6 +150,7 @@ static int __qdio_allocate_qs(struct qdio_q **irq_ptr_qs, int nr_queues) |
1588 |
+ return -ENOMEM; |
1589 |
+ } |
1590 |
+ irq_ptr_qs[i] = q; |
1591 |
++ INIT_LIST_HEAD(&q->entry); |
1592 |
+ } |
1593 |
+ return 0; |
1594 |
+ } |
1595 |
+@@ -178,6 +179,7 @@ static void setup_queues_misc(struct qdio_q *q, struct qdio_irq *irq_ptr, |
1596 |
+ q->mask = 1 << (31 - i); |
1597 |
+ q->nr = i; |
1598 |
+ q->handler = handler; |
1599 |
++ INIT_LIST_HEAD(&q->entry); |
1600 |
+ } |
1601 |
+ |
1602 |
+ static void setup_storage_lists(struct qdio_q *q, struct qdio_irq *irq_ptr, |
1603 |
+diff --git a/drivers/s390/cio/qdio_thinint.c b/drivers/s390/cio/qdio_thinint.c |
1604 |
+index 07dea602205b..6628e0c9e70e 100644 |
1605 |
+--- a/drivers/s390/cio/qdio_thinint.c |
1606 |
++++ b/drivers/s390/cio/qdio_thinint.c |
1607 |
+@@ -79,7 +79,6 @@ void tiqdio_add_input_queues(struct qdio_irq *irq_ptr) |
1608 |
+ mutex_lock(&tiq_list_lock); |
1609 |
+ list_add_rcu(&irq_ptr->input_qs[0]->entry, &tiq_list); |
1610 |
+ mutex_unlock(&tiq_list_lock); |
1611 |
+- xchg(irq_ptr->dsci, 1 << 7); |
1612 |
+ } |
1613 |
+ |
1614 |
+ void tiqdio_remove_input_queues(struct qdio_irq *irq_ptr) |
1615 |
+@@ -87,14 +86,14 @@ void tiqdio_remove_input_queues(struct qdio_irq *irq_ptr) |
1616 |
+ struct qdio_q *q; |
1617 |
+ |
1618 |
+ q = irq_ptr->input_qs[0]; |
1619 |
+- /* if establish triggered an error */ |
1620 |
+- if (!q || !q->entry.prev || !q->entry.next) |
1621 |
++ if (!q) |
1622 |
+ return; |
1623 |
+ |
1624 |
+ mutex_lock(&tiq_list_lock); |
1625 |
+ list_del_rcu(&q->entry); |
1626 |
+ mutex_unlock(&tiq_list_lock); |
1627 |
+ synchronize_rcu(); |
1628 |
++ INIT_LIST_HEAD(&q->entry); |
1629 |
+ } |
1630 |
+ |
1631 |
+ static inline int has_multiple_inq_on_dsci(struct qdio_irq *irq_ptr) |
1632 |
+diff --git a/fs/afs/callback.c b/fs/afs/callback.c |
1633 |
+index 128f2dbe256a..fee6fde79e6b 100644 |
1634 |
+--- a/fs/afs/callback.c |
1635 |
++++ b/fs/afs/callback.c |
1636 |
+@@ -278,9 +278,9 @@ static void afs_break_one_callback(struct afs_server *server, |
1637 |
+ struct afs_super_info *as = AFS_FS_S(cbi->sb); |
1638 |
+ struct afs_volume *volume = as->volume; |
1639 |
+ |
1640 |
+- write_lock(&volume->cb_break_lock); |
1641 |
++ write_lock(&volume->cb_v_break_lock); |
1642 |
+ volume->cb_v_break++; |
1643 |
+- write_unlock(&volume->cb_break_lock); |
1644 |
++ write_unlock(&volume->cb_v_break_lock); |
1645 |
+ } else { |
1646 |
+ data.volume = NULL; |
1647 |
+ data.fid = *fid; |
1648 |
+diff --git a/fs/afs/internal.h b/fs/afs/internal.h |
1649 |
+index 3904ab0b9563..fd0750fb96a5 100644 |
1650 |
+--- a/fs/afs/internal.h |
1651 |
++++ b/fs/afs/internal.h |
1652 |
+@@ -582,7 +582,7 @@ struct afs_volume { |
1653 |
+ unsigned int servers_seq; /* Incremented each time ->servers changes */ |
1654 |
+ |
1655 |
+ unsigned cb_v_break; /* Break-everything counter. */ |
1656 |
+- rwlock_t cb_break_lock; |
1657 |
++ rwlock_t cb_v_break_lock; |
1658 |
+ |
1659 |
+ afs_voltype_t type; /* type of volume */ |
1660 |
+ short error; |
1661 |
+diff --git a/fs/afs/volume.c b/fs/afs/volume.c |
1662 |
+index f6eba2def0a1..3e8dbee09f87 100644 |
1663 |
+--- a/fs/afs/volume.c |
1664 |
++++ b/fs/afs/volume.c |
1665 |
+@@ -47,6 +47,7 @@ static struct afs_volume *afs_alloc_volume(struct afs_fs_context *params, |
1666 |
+ atomic_set(&volume->usage, 1); |
1667 |
+ INIT_LIST_HEAD(&volume->proc_link); |
1668 |
+ rwlock_init(&volume->servers_lock); |
1669 |
++ rwlock_init(&volume->cb_v_break_lock); |
1670 |
+ memcpy(volume->name, vldb->name, vldb->name_len + 1); |
1671 |
+ |
1672 |
+ slist = afs_alloc_server_list(params->cell, params->key, vldb, type_mask); |
1673 |
+diff --git a/include/linux/cpuhotplug.h b/include/linux/cpuhotplug.h |
1674 |
+index 63fedd85c6c5..dec95654f3ae 100644 |
1675 |
+--- a/include/linux/cpuhotplug.h |
1676 |
++++ b/include/linux/cpuhotplug.h |
1677 |
+@@ -174,6 +174,7 @@ enum cpuhp_state { |
1678 |
+ CPUHP_AP_WATCHDOG_ONLINE, |
1679 |
+ CPUHP_AP_WORKQUEUE_ONLINE, |
1680 |
+ CPUHP_AP_RCUTREE_ONLINE, |
1681 |
++ CPUHP_AP_BASE_CACHEINFO_ONLINE, |
1682 |
+ CPUHP_AP_ONLINE_DYN, |
1683 |
+ CPUHP_AP_ONLINE_DYN_END = CPUHP_AP_ONLINE_DYN + 30, |
1684 |
+ CPUHP_AP_X86_HPET_ONLINE, |
1685 |
+diff --git a/include/linux/kernel.h b/include/linux/kernel.h |
1686 |
+index 2d14e21c16c0..4330cecd2237 100644 |
1687 |
+--- a/include/linux/kernel.h |
1688 |
++++ b/include/linux/kernel.h |
1689 |
+@@ -92,7 +92,8 @@ |
1690 |
+ #define DIV_ROUND_DOWN_ULL(ll, d) \ |
1691 |
+ ({ unsigned long long _tmp = (ll); do_div(_tmp, d); _tmp; }) |
1692 |
+ |
1693 |
+-#define DIV_ROUND_UP_ULL(ll, d) DIV_ROUND_DOWN_ULL((ll) + (d) - 1, (d)) |
1694 |
++#define DIV_ROUND_UP_ULL(ll, d) \ |
1695 |
++ DIV_ROUND_DOWN_ULL((unsigned long long)(ll) + (d) - 1, (d)) |
1696 |
+ |
1697 |
+ #if BITS_PER_LONG == 32 |
1698 |
+ # define DIV_ROUND_UP_SECTOR_T(ll,d) DIV_ROUND_UP_ULL(ll, d) |
1699 |
+diff --git a/include/uapi/linux/nilfs2_ondisk.h b/include/uapi/linux/nilfs2_ondisk.h |
1700 |
+index a7e66ab11d1d..c23f91ae5fe8 100644 |
1701 |
+--- a/include/uapi/linux/nilfs2_ondisk.h |
1702 |
++++ b/include/uapi/linux/nilfs2_ondisk.h |
1703 |
+@@ -29,7 +29,7 @@ |
1704 |
+ |
1705 |
+ #include <linux/types.h> |
1706 |
+ #include <linux/magic.h> |
1707 |
+- |
1708 |
++#include <asm/byteorder.h> |
1709 |
+ |
1710 |
+ #define NILFS_INODE_BMAP_SIZE 7 |
1711 |
+ |
1712 |
+@@ -533,19 +533,19 @@ enum { |
1713 |
+ static inline void \ |
1714 |
+ nilfs_checkpoint_set_##name(struct nilfs_checkpoint *cp) \ |
1715 |
+ { \ |
1716 |
+- cp->cp_flags = cpu_to_le32(le32_to_cpu(cp->cp_flags) | \ |
1717 |
+- (1UL << NILFS_CHECKPOINT_##flag)); \ |
1718 |
++ cp->cp_flags = __cpu_to_le32(__le32_to_cpu(cp->cp_flags) | \ |
1719 |
++ (1UL << NILFS_CHECKPOINT_##flag)); \ |
1720 |
+ } \ |
1721 |
+ static inline void \ |
1722 |
+ nilfs_checkpoint_clear_##name(struct nilfs_checkpoint *cp) \ |
1723 |
+ { \ |
1724 |
+- cp->cp_flags = cpu_to_le32(le32_to_cpu(cp->cp_flags) & \ |
1725 |
++ cp->cp_flags = __cpu_to_le32(__le32_to_cpu(cp->cp_flags) & \ |
1726 |
+ ~(1UL << NILFS_CHECKPOINT_##flag)); \ |
1727 |
+ } \ |
1728 |
+ static inline int \ |
1729 |
+ nilfs_checkpoint_##name(const struct nilfs_checkpoint *cp) \ |
1730 |
+ { \ |
1731 |
+- return !!(le32_to_cpu(cp->cp_flags) & \ |
1732 |
++ return !!(__le32_to_cpu(cp->cp_flags) & \ |
1733 |
+ (1UL << NILFS_CHECKPOINT_##flag)); \ |
1734 |
+ } |
1735 |
+ |
1736 |
+@@ -595,20 +595,20 @@ enum { |
1737 |
+ static inline void \ |
1738 |
+ nilfs_segment_usage_set_##name(struct nilfs_segment_usage *su) \ |
1739 |
+ { \ |
1740 |
+- su->su_flags = cpu_to_le32(le32_to_cpu(su->su_flags) | \ |
1741 |
++ su->su_flags = __cpu_to_le32(__le32_to_cpu(su->su_flags) | \ |
1742 |
+ (1UL << NILFS_SEGMENT_USAGE_##flag));\ |
1743 |
+ } \ |
1744 |
+ static inline void \ |
1745 |
+ nilfs_segment_usage_clear_##name(struct nilfs_segment_usage *su) \ |
1746 |
+ { \ |
1747 |
+ su->su_flags = \ |
1748 |
+- cpu_to_le32(le32_to_cpu(su->su_flags) & \ |
1749 |
++ __cpu_to_le32(__le32_to_cpu(su->su_flags) & \ |
1750 |
+ ~(1UL << NILFS_SEGMENT_USAGE_##flag)); \ |
1751 |
+ } \ |
1752 |
+ static inline int \ |
1753 |
+ nilfs_segment_usage_##name(const struct nilfs_segment_usage *su) \ |
1754 |
+ { \ |
1755 |
+- return !!(le32_to_cpu(su->su_flags) & \ |
1756 |
++ return !!(__le32_to_cpu(su->su_flags) & \ |
1757 |
+ (1UL << NILFS_SEGMENT_USAGE_##flag)); \ |
1758 |
+ } |
1759 |
+ |
1760 |
+@@ -619,15 +619,15 @@ NILFS_SEGMENT_USAGE_FNS(ERROR, error) |
1761 |
+ static inline void |
1762 |
+ nilfs_segment_usage_set_clean(struct nilfs_segment_usage *su) |
1763 |
+ { |
1764 |
+- su->su_lastmod = cpu_to_le64(0); |
1765 |
+- su->su_nblocks = cpu_to_le32(0); |
1766 |
+- su->su_flags = cpu_to_le32(0); |
1767 |
++ su->su_lastmod = __cpu_to_le64(0); |
1768 |
++ su->su_nblocks = __cpu_to_le32(0); |
1769 |
++ su->su_flags = __cpu_to_le32(0); |
1770 |
+ } |
1771 |
+ |
1772 |
+ static inline int |
1773 |
+ nilfs_segment_usage_clean(const struct nilfs_segment_usage *su) |
1774 |
+ { |
1775 |
+- return !le32_to_cpu(su->su_flags); |
1776 |
++ return !__le32_to_cpu(su->su_flags); |
1777 |
+ } |
1778 |
+ |
1779 |
+ /** |
1780 |
+diff --git a/kernel/cpu.c b/kernel/cpu.c |
1781 |
+index 6170034f4118..e97e7224ab47 100644 |
1782 |
+--- a/kernel/cpu.c |
1783 |
++++ b/kernel/cpu.c |
1784 |
+@@ -1954,6 +1954,9 @@ static ssize_t write_cpuhp_fail(struct device *dev, |
1785 |
+ if (ret) |
1786 |
+ return ret; |
1787 |
+ |
1788 |
++ if (fail < CPUHP_OFFLINE || fail > CPUHP_ONLINE) |
1789 |
++ return -EINVAL; |
1790 |
++ |
1791 |
+ /* |
1792 |
+ * Cannot fail STARTING/DYING callbacks. |
1793 |
+ */ |
1794 |
+diff --git a/kernel/events/core.c b/kernel/events/core.c |
1795 |
+index dc7dead2d2cc..f33bd0a89391 100644 |
1796 |
+--- a/kernel/events/core.c |
1797 |
++++ b/kernel/events/core.c |
1798 |
+@@ -5913,7 +5913,7 @@ static void perf_sample_regs_user(struct perf_regs *regs_user, |
1799 |
+ if (user_mode(regs)) { |
1800 |
+ regs_user->abi = perf_reg_abi(current); |
1801 |
+ regs_user->regs = regs; |
1802 |
+- } else if (current->mm) { |
1803 |
++ } else if (!(current->flags & PF_KTHREAD)) { |
1804 |
+ perf_get_regs_user(regs_user, regs, regs_user_copy); |
1805 |
+ } else { |
1806 |
+ regs_user->abi = PERF_SAMPLE_REGS_ABI_NONE; |
1807 |
+diff --git a/kernel/fork.c b/kernel/fork.c |
1808 |
+index 2628f3773ca8..ee24fea0eede 100644 |
1809 |
+--- a/kernel/fork.c |
1810 |
++++ b/kernel/fork.c |
1811 |
+@@ -245,7 +245,11 @@ static unsigned long *alloc_thread_stack_node(struct task_struct *tsk, int node) |
1812 |
+ struct page *page = alloc_pages_node(node, THREADINFO_GFP, |
1813 |
+ THREAD_SIZE_ORDER); |
1814 |
+ |
1815 |
+- return page ? page_address(page) : NULL; |
1816 |
++ if (likely(page)) { |
1817 |
++ tsk->stack = page_address(page); |
1818 |
++ return tsk->stack; |
1819 |
++ } |
1820 |
++ return NULL; |
1821 |
+ #endif |
1822 |
+ } |
1823 |
+ |
1824 |
+diff --git a/kernel/irq/autoprobe.c b/kernel/irq/autoprobe.c |
1825 |
+index 16cbf6beb276..ae60cae24e9a 100644 |
1826 |
+--- a/kernel/irq/autoprobe.c |
1827 |
++++ b/kernel/irq/autoprobe.c |
1828 |
+@@ -90,7 +90,7 @@ unsigned long probe_irq_on(void) |
1829 |
+ /* It triggered already - consider it spurious. */ |
1830 |
+ if (!(desc->istate & IRQS_WAITING)) { |
1831 |
+ desc->istate &= ~IRQS_AUTODETECT; |
1832 |
+- irq_shutdown(desc); |
1833 |
++ irq_shutdown_and_deactivate(desc); |
1834 |
+ } else |
1835 |
+ if (i < 32) |
1836 |
+ mask |= 1 << i; |
1837 |
+@@ -127,7 +127,7 @@ unsigned int probe_irq_mask(unsigned long val) |
1838 |
+ mask |= 1 << i; |
1839 |
+ |
1840 |
+ desc->istate &= ~IRQS_AUTODETECT; |
1841 |
+- irq_shutdown(desc); |
1842 |
++ irq_shutdown_and_deactivate(desc); |
1843 |
+ } |
1844 |
+ raw_spin_unlock_irq(&desc->lock); |
1845 |
+ } |
1846 |
+@@ -169,7 +169,7 @@ int probe_irq_off(unsigned long val) |
1847 |
+ nr_of_irqs++; |
1848 |
+ } |
1849 |
+ desc->istate &= ~IRQS_AUTODETECT; |
1850 |
+- irq_shutdown(desc); |
1851 |
++ irq_shutdown_and_deactivate(desc); |
1852 |
+ } |
1853 |
+ raw_spin_unlock_irq(&desc->lock); |
1854 |
+ } |
1855 |
+diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c |
1856 |
+index 51128bea3846..04fe4f989bd8 100644 |
1857 |
+--- a/kernel/irq/chip.c |
1858 |
++++ b/kernel/irq/chip.c |
1859 |
+@@ -314,6 +314,12 @@ void irq_shutdown(struct irq_desc *desc) |
1860 |
+ } |
1861 |
+ irq_state_clr_started(desc); |
1862 |
+ } |
1863 |
++} |
1864 |
++ |
1865 |
++ |
1866 |
++void irq_shutdown_and_deactivate(struct irq_desc *desc) |
1867 |
++{ |
1868 |
++ irq_shutdown(desc); |
1869 |
+ /* |
1870 |
+ * This must be called even if the interrupt was never started up, |
1871 |
+ * because the activation can happen before the interrupt is |
1872 |
+diff --git a/kernel/irq/cpuhotplug.c b/kernel/irq/cpuhotplug.c |
1873 |
+index 5b1072e394b2..6c7ca2e983a5 100644 |
1874 |
+--- a/kernel/irq/cpuhotplug.c |
1875 |
++++ b/kernel/irq/cpuhotplug.c |
1876 |
+@@ -116,7 +116,7 @@ static bool migrate_one_irq(struct irq_desc *desc) |
1877 |
+ */ |
1878 |
+ if (irqd_affinity_is_managed(d)) { |
1879 |
+ irqd_set_managed_shutdown(d); |
1880 |
+- irq_shutdown(desc); |
1881 |
++ irq_shutdown_and_deactivate(desc); |
1882 |
+ return false; |
1883 |
+ } |
1884 |
+ affinity = cpu_online_mask; |
1885 |
+diff --git a/kernel/irq/internals.h b/kernel/irq/internals.h |
1886 |
+index 70c3053bc1f6..3a948f41ab00 100644 |
1887 |
+--- a/kernel/irq/internals.h |
1888 |
++++ b/kernel/irq/internals.h |
1889 |
+@@ -82,6 +82,7 @@ extern int irq_activate_and_startup(struct irq_desc *desc, bool resend); |
1890 |
+ extern int irq_startup(struct irq_desc *desc, bool resend, bool force); |
1891 |
+ |
1892 |
+ extern void irq_shutdown(struct irq_desc *desc); |
1893 |
++extern void irq_shutdown_and_deactivate(struct irq_desc *desc); |
1894 |
+ extern void irq_enable(struct irq_desc *desc); |
1895 |
+ extern void irq_disable(struct irq_desc *desc); |
1896 |
+ extern void irq_percpu_enable(struct irq_desc *desc, unsigned int cpu); |
1897 |
+@@ -96,6 +97,10 @@ static inline void irq_mark_irq(unsigned int irq) { } |
1898 |
+ extern void irq_mark_irq(unsigned int irq); |
1899 |
+ #endif |
1900 |
+ |
1901 |
++extern int __irq_get_irqchip_state(struct irq_data *data, |
1902 |
++ enum irqchip_irq_state which, |
1903 |
++ bool *state); |
1904 |
++ |
1905 |
+ extern void init_kstat_irqs(struct irq_desc *desc, int node, int nr); |
1906 |
+ |
1907 |
+ irqreturn_t __handle_irq_event_percpu(struct irq_desc *desc, unsigned int *flags); |
1908 |
+diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c |
1909 |
+index 53a081392115..fad61986f35c 100644 |
1910 |
+--- a/kernel/irq/manage.c |
1911 |
++++ b/kernel/irq/manage.c |
1912 |
+@@ -13,6 +13,7 @@ |
1913 |
+ #include <linux/module.h> |
1914 |
+ #include <linux/random.h> |
1915 |
+ #include <linux/interrupt.h> |
1916 |
++#include <linux/irqdomain.h> |
1917 |
+ #include <linux/slab.h> |
1918 |
+ #include <linux/sched.h> |
1919 |
+ #include <linux/sched/rt.h> |
1920 |
+@@ -34,8 +35,9 @@ static int __init setup_forced_irqthreads(char *arg) |
1921 |
+ early_param("threadirqs", setup_forced_irqthreads); |
1922 |
+ #endif |
1923 |
+ |
1924 |
+-static void __synchronize_hardirq(struct irq_desc *desc) |
1925 |
++static void __synchronize_hardirq(struct irq_desc *desc, bool sync_chip) |
1926 |
+ { |
1927 |
++ struct irq_data *irqd = irq_desc_get_irq_data(desc); |
1928 |
+ bool inprogress; |
1929 |
+ |
1930 |
+ do { |
1931 |
+@@ -51,6 +53,20 @@ static void __synchronize_hardirq(struct irq_desc *desc) |
1932 |
+ /* Ok, that indicated we're done: double-check carefully. */ |
1933 |
+ raw_spin_lock_irqsave(&desc->lock, flags); |
1934 |
+ inprogress = irqd_irq_inprogress(&desc->irq_data); |
1935 |
++ |
1936 |
++ /* |
1937 |
++ * If requested and supported, check at the chip whether it |
1938 |
++ * is in flight at the hardware level, i.e. already pending |
1939 |
++ * in a CPU and waiting for service and acknowledge. |
1940 |
++ */ |
1941 |
++ if (!inprogress && sync_chip) { |
1942 |
++ /* |
1943 |
++ * Ignore the return code. inprogress is only updated |
1944 |
++ * when the chip supports it. |
1945 |
++ */ |
1946 |
++ __irq_get_irqchip_state(irqd, IRQCHIP_STATE_ACTIVE, |
1947 |
++ &inprogress); |
1948 |
++ } |
1949 |
+ raw_spin_unlock_irqrestore(&desc->lock, flags); |
1950 |
+ |
1951 |
+ /* Oops, that failed? */ |
1952 |
+@@ -73,13 +89,18 @@ static void __synchronize_hardirq(struct irq_desc *desc) |
1953 |
+ * Returns: false if a threaded handler is active. |
1954 |
+ * |
1955 |
+ * This function may be called - with care - from IRQ context. |
1956 |
++ * |
1957 |
++ * It does not check whether there is an interrupt in flight at the |
1958 |
++ * hardware level, but not serviced yet, as this might deadlock when |
1959 |
++ * called with interrupts disabled and the target CPU of the interrupt |
1960 |
++ * is the current CPU. |
1961 |
+ */ |
1962 |
+ bool synchronize_hardirq(unsigned int irq) |
1963 |
+ { |
1964 |
+ struct irq_desc *desc = irq_to_desc(irq); |
1965 |
+ |
1966 |
+ if (desc) { |
1967 |
+- __synchronize_hardirq(desc); |
1968 |
++ __synchronize_hardirq(desc, false); |
1969 |
+ return !atomic_read(&desc->threads_active); |
1970 |
+ } |
1971 |
+ |
1972 |
+@@ -95,14 +116,19 @@ EXPORT_SYMBOL(synchronize_hardirq); |
1973 |
+ * to complete before returning. If you use this function while |
1974 |
+ * holding a resource the IRQ handler may need you will deadlock. |
1975 |
+ * |
1976 |
+- * This function may be called - with care - from IRQ context. |
1977 |
++ * Can only be called from preemptible code as it might sleep when |
1978 |
++ * an interrupt thread is associated to @irq. |
1979 |
++ * |
1980 |
++ * It optionally makes sure (when the irq chip supports that method) |
1981 |
++ * that the interrupt is not pending in any CPU and waiting for |
1982 |
++ * service. |
1983 |
+ */ |
1984 |
+ void synchronize_irq(unsigned int irq) |
1985 |
+ { |
1986 |
+ struct irq_desc *desc = irq_to_desc(irq); |
1987 |
+ |
1988 |
+ if (desc) { |
1989 |
+- __synchronize_hardirq(desc); |
1990 |
++ __synchronize_hardirq(desc, true); |
1991 |
+ /* |
1992 |
+ * We made sure that no hardirq handler is |
1993 |
+ * running. Now verify that no threaded handlers are |
1994 |
+@@ -1699,6 +1725,7 @@ static struct irqaction *__free_irq(struct irq_desc *desc, void *dev_id) |
1995 |
+ /* If this was the last handler, shut down the IRQ line: */ |
1996 |
+ if (!desc->action) { |
1997 |
+ irq_settings_clr_disable_unlazy(desc); |
1998 |
++ /* Only shutdown. Deactivate after synchronize_hardirq() */ |
1999 |
+ irq_shutdown(desc); |
2000 |
+ } |
2001 |
+ |
2002 |
+@@ -1727,8 +1754,12 @@ static struct irqaction *__free_irq(struct irq_desc *desc, void *dev_id) |
2003 |
+ |
2004 |
+ unregister_handler_proc(irq, action); |
2005 |
+ |
2006 |
+- /* Make sure it's not being used on another CPU: */ |
2007 |
+- synchronize_hardirq(irq); |
2008 |
++ /* |
2009 |
++ * Make sure it's not being used on another CPU and if the chip |
2010 |
++ * supports it also make sure that there is no (not yet serviced) |
2011 |
++ * interrupt in flight at the hardware level. |
2012 |
++ */ |
2013 |
++ __synchronize_hardirq(desc, true); |
2014 |
+ |
2015 |
+ #ifdef CONFIG_DEBUG_SHIRQ |
2016 |
+ /* |
2017 |
+@@ -1768,6 +1799,14 @@ static struct irqaction *__free_irq(struct irq_desc *desc, void *dev_id) |
2018 |
+ * require it to deallocate resources over the slow bus. |
2019 |
+ */ |
2020 |
+ chip_bus_lock(desc); |
2021 |
++ /* |
2022 |
++ * There is no interrupt on the fly anymore. Deactivate it |
2023 |
++ * completely. |
2024 |
++ */ |
2025 |
++ raw_spin_lock_irqsave(&desc->lock, flags); |
2026 |
++ irq_domain_deactivate_irq(&desc->irq_data); |
2027 |
++ raw_spin_unlock_irqrestore(&desc->lock, flags); |
2028 |
++ |
2029 |
+ irq_release_resources(desc); |
2030 |
+ chip_bus_sync_unlock(desc); |
2031 |
+ irq_remove_timings(desc); |
2032 |
+@@ -1855,7 +1894,7 @@ static const void *__cleanup_nmi(unsigned int irq, struct irq_desc *desc) |
2033 |
+ } |
2034 |
+ |
2035 |
+ irq_settings_clr_disable_unlazy(desc); |
2036 |
+- irq_shutdown(desc); |
2037 |
++ irq_shutdown_and_deactivate(desc); |
2038 |
+ |
2039 |
+ irq_release_resources(desc); |
2040 |
+ |
2041 |
+@@ -2578,6 +2617,28 @@ out: |
2042 |
+ irq_put_desc_unlock(desc, flags); |
2043 |
+ } |
2044 |
+ |
2045 |
++int __irq_get_irqchip_state(struct irq_data *data, enum irqchip_irq_state which, |
2046 |
++ bool *state) |
2047 |
++{ |
2048 |
++ struct irq_chip *chip; |
2049 |
++ int err = -EINVAL; |
2050 |
++ |
2051 |
++ do { |
2052 |
++ chip = irq_data_get_irq_chip(data); |
2053 |
++ if (chip->irq_get_irqchip_state) |
2054 |
++ break; |
2055 |
++#ifdef CONFIG_IRQ_DOMAIN_HIERARCHY |
2056 |
++ data = data->parent_data; |
2057 |
++#else |
2058 |
++ data = NULL; |
2059 |
++#endif |
2060 |
++ } while (data); |
2061 |
++ |
2062 |
++ if (data) |
2063 |
++ err = chip->irq_get_irqchip_state(data, which, state); |
2064 |
++ return err; |
2065 |
++} |
2066 |
++ |
2067 |
+ /** |
2068 |
+ * irq_get_irqchip_state - returns the irqchip state of a interrupt. |
2069 |
+ * @irq: Interrupt line that is forwarded to a VM |
2070 |
+@@ -2596,7 +2657,6 @@ int irq_get_irqchip_state(unsigned int irq, enum irqchip_irq_state which, |
2071 |
+ { |
2072 |
+ struct irq_desc *desc; |
2073 |
+ struct irq_data *data; |
2074 |
+- struct irq_chip *chip; |
2075 |
+ unsigned long flags; |
2076 |
+ int err = -EINVAL; |
2077 |
+ |
2078 |
+@@ -2606,19 +2666,7 @@ int irq_get_irqchip_state(unsigned int irq, enum irqchip_irq_state which, |
2079 |
+ |
2080 |
+ data = irq_desc_get_irq_data(desc); |
2081 |
+ |
2082 |
+- do { |
2083 |
+- chip = irq_data_get_irq_chip(data); |
2084 |
+- if (chip->irq_get_irqchip_state) |
2085 |
+- break; |
2086 |
+-#ifdef CONFIG_IRQ_DOMAIN_HIERARCHY |
2087 |
+- data = data->parent_data; |
2088 |
+-#else |
2089 |
+- data = NULL; |
2090 |
+-#endif |
2091 |
+- } while (data); |
2092 |
+- |
2093 |
+- if (data) |
2094 |
+- err = chip->irq_get_irqchip_state(data, which, state); |
2095 |
++ err = __irq_get_irqchip_state(data, which, state); |
2096 |
+ |
2097 |
+ irq_put_desc_busunlock(desc, flags); |
2098 |
+ return err; |
2099 |
+diff --git a/mm/oom_kill.c b/mm/oom_kill.c |
2100 |
+index 3a2484884cfd..263efad6fc7e 100644 |
2101 |
+--- a/mm/oom_kill.c |
2102 |
++++ b/mm/oom_kill.c |
2103 |
+@@ -985,8 +985,7 @@ static void oom_kill_process(struct oom_control *oc, const char *message) |
2104 |
+ /* |
2105 |
+ * Determines whether the kernel must panic because of the panic_on_oom sysctl. |
2106 |
+ */ |
2107 |
+-static void check_panic_on_oom(struct oom_control *oc, |
2108 |
+- enum oom_constraint constraint) |
2109 |
++static void check_panic_on_oom(struct oom_control *oc) |
2110 |
+ { |
2111 |
+ if (likely(!sysctl_panic_on_oom)) |
2112 |
+ return; |
2113 |
+@@ -996,7 +995,7 @@ static void check_panic_on_oom(struct oom_control *oc, |
2114 |
+ * does not panic for cpuset, mempolicy, or memcg allocation |
2115 |
+ * failures. |
2116 |
+ */ |
2117 |
+- if (constraint != CONSTRAINT_NONE) |
2118 |
++ if (oc->constraint != CONSTRAINT_NONE) |
2119 |
+ return; |
2120 |
+ } |
2121 |
+ /* Do not panic for oom kills triggered by sysrq */ |
2122 |
+@@ -1033,7 +1032,6 @@ EXPORT_SYMBOL_GPL(unregister_oom_notifier); |
2123 |
+ bool out_of_memory(struct oom_control *oc) |
2124 |
+ { |
2125 |
+ unsigned long freed = 0; |
2126 |
+- enum oom_constraint constraint = CONSTRAINT_NONE; |
2127 |
+ |
2128 |
+ if (oom_killer_disabled) |
2129 |
+ return false; |
2130 |
+@@ -1069,10 +1067,10 @@ bool out_of_memory(struct oom_control *oc) |
2131 |
+ * Check if there were limitations on the allocation (only relevant for |
2132 |
+ * NUMA and memcg) that may require different handling. |
2133 |
+ */ |
2134 |
+- constraint = constrained_alloc(oc); |
2135 |
+- if (constraint != CONSTRAINT_MEMORY_POLICY) |
2136 |
++ oc->constraint = constrained_alloc(oc); |
2137 |
++ if (oc->constraint != CONSTRAINT_MEMORY_POLICY) |
2138 |
+ oc->nodemask = NULL; |
2139 |
+- check_panic_on_oom(oc, constraint); |
2140 |
++ check_panic_on_oom(oc); |
2141 |
+ |
2142 |
+ if (!is_memcg_oom(oc) && sysctl_oom_kill_allocating_task && |
2143 |
+ current->mm && !oom_unkillable_task(current, NULL, oc->nodemask) && |
2144 |
+diff --git a/tools/testing/selftests/powerpc/mm/.gitignore b/tools/testing/selftests/powerpc/mm/.gitignore |
2145 |
+index ba919308fe30..d503b8764a8e 100644 |
2146 |
+--- a/tools/testing/selftests/powerpc/mm/.gitignore |
2147 |
++++ b/tools/testing/selftests/powerpc/mm/.gitignore |
2148 |
+@@ -3,4 +3,5 @@ subpage_prot |
2149 |
+ tempfile |
2150 |
+ prot_sao |
2151 |
+ segv_errors |
2152 |
+-wild_bctr |
2153 |
+\ No newline at end of file |
2154 |
++wild_bctr |
2155 |
++large_vm_fork_separation |
2156 |
+\ No newline at end of file |
2157 |
+diff --git a/tools/testing/selftests/powerpc/mm/Makefile b/tools/testing/selftests/powerpc/mm/Makefile |
2158 |
+index 43d68420e363..f1fbc15800c4 100644 |
2159 |
+--- a/tools/testing/selftests/powerpc/mm/Makefile |
2160 |
++++ b/tools/testing/selftests/powerpc/mm/Makefile |
2161 |
+@@ -2,7 +2,8 @@ |
2162 |
+ noarg: |
2163 |
+ $(MAKE) -C ../ |
2164 |
+ |
2165 |
+-TEST_GEN_PROGS := hugetlb_vs_thp_test subpage_prot prot_sao segv_errors wild_bctr |
2166 |
++TEST_GEN_PROGS := hugetlb_vs_thp_test subpage_prot prot_sao segv_errors wild_bctr \ |
2167 |
++ large_vm_fork_separation |
2168 |
+ TEST_GEN_FILES := tempfile |
2169 |
+ |
2170 |
+ top_srcdir = ../../../../.. |
2171 |
+@@ -13,6 +14,7 @@ $(TEST_GEN_PROGS): ../harness.c |
2172 |
+ $(OUTPUT)/prot_sao: ../utils.c |
2173 |
+ |
2174 |
+ $(OUTPUT)/wild_bctr: CFLAGS += -m64 |
2175 |
++$(OUTPUT)/large_vm_fork_separation: CFLAGS += -m64 |
2176 |
+ |
2177 |
+ $(OUTPUT)/tempfile: |
2178 |
+ dd if=/dev/zero of=$@ bs=64k count=1 |
2179 |
+diff --git a/tools/testing/selftests/powerpc/mm/large_vm_fork_separation.c b/tools/testing/selftests/powerpc/mm/large_vm_fork_separation.c |
2180 |
+new file mode 100644 |
2181 |
+index 000000000000..2363a7f3ab0d |
2182 |
+--- /dev/null |
2183 |
++++ b/tools/testing/selftests/powerpc/mm/large_vm_fork_separation.c |
2184 |
+@@ -0,0 +1,87 @@ |
2185 |
++// SPDX-License-Identifier: GPL-2.0+ |
2186 |
++// |
2187 |
++// Copyright 2019, Michael Ellerman, IBM Corp. |
2188 |
++// |
2189 |
++// Test that allocating memory beyond the memory limit and then forking is |
2190 |
++// handled correctly, ie. the child is able to access the mappings beyond the |
2191 |
++// memory limit and the child's writes are not visible to the parent. |
2192 |
++ |
2193 |
++#include <stdio.h> |
2194 |
++#include <stdlib.h> |
2195 |
++#include <sys/mman.h> |
2196 |
++#include <sys/types.h> |
2197 |
++#include <sys/wait.h> |
2198 |
++#include <unistd.h> |
2199 |
++ |
2200 |
++#include "utils.h" |
2201 |
++ |
2202 |
++ |
2203 |
++#ifndef MAP_FIXED_NOREPLACE |
2204 |
++#define MAP_FIXED_NOREPLACE MAP_FIXED // "Should be safe" above 512TB |
2205 |
++#endif |
2206 |
++ |
2207 |
++ |
2208 |
++static int test(void) |
2209 |
++{ |
2210 |
++ int p2c[2], c2p[2], rc, status, c, *p; |
2211 |
++ unsigned long page_size; |
2212 |
++ pid_t pid; |
2213 |
++ |
2214 |
++ page_size = sysconf(_SC_PAGESIZE); |
2215 |
++ SKIP_IF(page_size != 65536); |
2216 |
++ |
2217 |
++ // Create a mapping at 512TB to allocate an extended_id |
2218 |
++ p = mmap((void *)(512ul << 40), page_size, PROT_READ | PROT_WRITE, |
2219 |
++ MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED_NOREPLACE, -1, 0); |
2220 |
++ if (p == MAP_FAILED) { |
2221 |
++ perror("mmap"); |
2222 |
++ printf("Error: couldn't mmap(), confirm kernel has 4TB support?\n"); |
2223 |
++ return 1; |
2224 |
++ } |
2225 |
++ |
2226 |
++ printf("parent writing %p = 1\n", p); |
2227 |
++ *p = 1; |
2228 |
++ |
2229 |
++ FAIL_IF(pipe(p2c) == -1 || pipe(c2p) == -1); |
2230 |
++ |
2231 |
++ pid = fork(); |
2232 |
++ if (pid == 0) { |
2233 |
++ FAIL_IF(read(p2c[0], &c, 1) != 1); |
2234 |
++ |
2235 |
++ pid = getpid(); |
2236 |
++ printf("child writing %p = %d\n", p, pid); |
2237 |
++ *p = pid; |
2238 |
++ |
2239 |
++ FAIL_IF(write(c2p[1], &c, 1) != 1); |
2240 |
++ FAIL_IF(read(p2c[0], &c, 1) != 1); |
2241 |
++ exit(0); |
2242 |
++ } |
2243 |
++ |
2244 |
++ c = 0; |
2245 |
++ FAIL_IF(write(p2c[1], &c, 1) != 1); |
2246 |
++ FAIL_IF(read(c2p[0], &c, 1) != 1); |
2247 |
++ |
2248 |
++ // Prevent compiler optimisation |
2249 |
++ barrier(); |
2250 |
++ |
2251 |
++ rc = 0; |
2252 |
++ printf("parent reading %p = %d\n", p, *p); |
2253 |
++ if (*p != 1) { |
2254 |
++ printf("Error: BUG! parent saw child's write! *p = %d\n", *p); |
2255 |
++ rc = 1; |
2256 |
++ } |
2257 |
++ |
2258 |
++ FAIL_IF(write(p2c[1], &c, 1) != 1); |
2259 |
++ FAIL_IF(waitpid(pid, &status, 0) == -1); |
2260 |
++ FAIL_IF(!WIFEXITED(status) || WEXITSTATUS(status)); |
2261 |
++ |
2262 |
++ if (rc == 0) |
2263 |
++ printf("success: test completed OK\n"); |
2264 |
++ |
2265 |
++ return rc; |
2266 |
++} |
2267 |
++ |
2268 |
++int main(void) |
2269 |
++{ |
2270 |
++ return test_harness(test, "large_vm_fork_separation"); |
2271 |
++} |