1 |
commit: ea6a0cd2ef019283d7862522bcb40e7624332ac0 |
2 |
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
3 |
AuthorDate: Tue Feb 1 17:22:19 2022 +0000 |
4 |
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Feb 1 17:22:19 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=ea6a0cd2 |
7 |
|
8 |
Linux patch 5.15.19 |
9 |
|
10 |
Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org> |
11 |
|
12 |
0000_README | 4 + |
13 |
1018_linux-5.15.19.patch | 6314 ++++++++++++++++++++++++++++++++++++++++++++++ |
14 |
2 files changed, 6318 insertions(+) |
15 |
|
16 |
diff --git a/0000_README b/0000_README |
17 |
index dcf875ed..e7523966 100644 |
18 |
--- a/0000_README |
19 |
+++ b/0000_README |
20 |
@@ -115,6 +115,10 @@ Patch: 1017_linux-5.15.18.patch |
21 |
From: http://www.kernel.org |
22 |
Desc: Linux 5.15.18 |
23 |
|
24 |
+Patch: 1018_linux-5.15.19.patch |
25 |
+From: http://www.kernel.org |
26 |
+Desc: Linux 5.15.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.15.19.patch b/1018_linux-5.15.19.patch |
33 |
new file mode 100644 |
34 |
index 00000000..4435263f |
35 |
--- /dev/null |
36 |
+++ b/1018_linux-5.15.19.patch |
37 |
@@ -0,0 +1,6314 @@ |
38 |
+diff --git a/Documentation/accounting/psi.rst b/Documentation/accounting/psi.rst |
39 |
+index f2b3439edcc2c..860fe651d6453 100644 |
40 |
+--- a/Documentation/accounting/psi.rst |
41 |
++++ b/Documentation/accounting/psi.rst |
42 |
+@@ -92,7 +92,8 @@ Triggers can be set on more than one psi metric and more than one trigger |
43 |
+ for the same psi metric can be specified. However for each trigger a separate |
44 |
+ file descriptor is required to be able to poll it separately from others, |
45 |
+ therefore for each trigger a separate open() syscall should be made even |
46 |
+-when opening the same psi interface file. |
47 |
++when opening the same psi interface file. Write operations to a file descriptor |
48 |
++with an already existing psi trigger will fail with EBUSY. |
49 |
+ |
50 |
+ Monitors activate only when system enters stall state for the monitored |
51 |
+ psi metric and deactivates upon exit from the stall state. While system is |
52 |
+diff --git a/Documentation/devicetree/bindings/net/can/tcan4x5x.txt b/Documentation/devicetree/bindings/net/can/tcan4x5x.txt |
53 |
+index 0968b40aef1e8..e3501bfa22e90 100644 |
54 |
+--- a/Documentation/devicetree/bindings/net/can/tcan4x5x.txt |
55 |
++++ b/Documentation/devicetree/bindings/net/can/tcan4x5x.txt |
56 |
+@@ -31,7 +31,7 @@ tcan4x5x: tcan4x5x@0 { |
57 |
+ #address-cells = <1>; |
58 |
+ #size-cells = <1>; |
59 |
+ spi-max-frequency = <10000000>; |
60 |
+- bosch,mram-cfg = <0x0 0 0 32 0 0 1 1>; |
61 |
++ bosch,mram-cfg = <0x0 0 0 16 0 0 1 1>; |
62 |
+ interrupt-parent = <&gpio1>; |
63 |
+ interrupts = <14 IRQ_TYPE_LEVEL_LOW>; |
64 |
+ device-state-gpios = <&gpio3 21 GPIO_ACTIVE_HIGH>; |
65 |
+diff --git a/Makefile b/Makefile |
66 |
+index 385286f987d89..463d46a9e6171 100644 |
67 |
+--- a/Makefile |
68 |
++++ b/Makefile |
69 |
+@@ -1,7 +1,7 @@ |
70 |
+ # SPDX-License-Identifier: GPL-2.0 |
71 |
+ VERSION = 5 |
72 |
+ PATCHLEVEL = 15 |
73 |
+-SUBLEVEL = 18 |
74 |
++SUBLEVEL = 19 |
75 |
+ EXTRAVERSION = |
76 |
+ NAME = Trick or Treat |
77 |
+ |
78 |
+diff --git a/arch/arm/include/asm/assembler.h b/arch/arm/include/asm/assembler.h |
79 |
+index e2b1fd558bf3c..11bb9d12485fb 100644 |
80 |
+--- a/arch/arm/include/asm/assembler.h |
81 |
++++ b/arch/arm/include/asm/assembler.h |
82 |
+@@ -259,6 +259,7 @@ |
83 |
+ */ |
84 |
+ #define ALT_UP(instr...) \ |
85 |
+ .pushsection ".alt.smp.init", "a" ;\ |
86 |
++ .align 2 ;\ |
87 |
+ .long 9998b - . ;\ |
88 |
+ 9997: instr ;\ |
89 |
+ .if . - 9997b == 2 ;\ |
90 |
+@@ -270,6 +271,7 @@ |
91 |
+ .popsection |
92 |
+ #define ALT_UP_B(label) \ |
93 |
+ .pushsection ".alt.smp.init", "a" ;\ |
94 |
++ .align 2 ;\ |
95 |
+ .long 9998b - . ;\ |
96 |
+ W(b) . + (label - 9998b) ;\ |
97 |
+ .popsection |
98 |
+diff --git a/arch/arm/include/asm/processor.h b/arch/arm/include/asm/processor.h |
99 |
+index 9e6b972863077..8aeff55aebfaf 100644 |
100 |
+--- a/arch/arm/include/asm/processor.h |
101 |
++++ b/arch/arm/include/asm/processor.h |
102 |
+@@ -96,6 +96,7 @@ unsigned long get_wchan(struct task_struct *p); |
103 |
+ #define __ALT_SMP_ASM(smp, up) \ |
104 |
+ "9998: " smp "\n" \ |
105 |
+ " .pushsection \".alt.smp.init\", \"a\"\n" \ |
106 |
++ " .align 2\n" \ |
107 |
+ " .long 9998b - .\n" \ |
108 |
+ " " up "\n" \ |
109 |
+ " .popsection\n" |
110 |
+diff --git a/arch/arm/include/asm/uaccess.h b/arch/arm/include/asm/uaccess.h |
111 |
+index 36fbc33292526..32dbfd81f42a4 100644 |
112 |
+--- a/arch/arm/include/asm/uaccess.h |
113 |
++++ b/arch/arm/include/asm/uaccess.h |
114 |
+@@ -11,6 +11,7 @@ |
115 |
+ #include <linux/string.h> |
116 |
+ #include <asm/memory.h> |
117 |
+ #include <asm/domain.h> |
118 |
++#include <asm/unaligned.h> |
119 |
+ #include <asm/unified.h> |
120 |
+ #include <asm/compiler.h> |
121 |
+ |
122 |
+@@ -497,7 +498,10 @@ do { \ |
123 |
+ } \ |
124 |
+ default: __err = __get_user_bad(); break; \ |
125 |
+ } \ |
126 |
+- *(type *)(dst) = __val; \ |
127 |
++ if (IS_ENABLED(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS)) \ |
128 |
++ put_unaligned(__val, (type *)(dst)); \ |
129 |
++ else \ |
130 |
++ *(type *)(dst) = __val; /* aligned by caller */ \ |
131 |
+ if (__err) \ |
132 |
+ goto err_label; \ |
133 |
+ } while (0) |
134 |
+@@ -507,7 +511,9 @@ do { \ |
135 |
+ const type *__pk_ptr = (dst); \ |
136 |
+ unsigned long __dst = (unsigned long)__pk_ptr; \ |
137 |
+ int __err = 0; \ |
138 |
+- type __val = *(type *)src; \ |
139 |
++ type __val = IS_ENABLED(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) \ |
140 |
++ ? get_unaligned((type *)(src)) \ |
141 |
++ : *(type *)(src); /* aligned by caller */ \ |
142 |
+ switch (sizeof(type)) { \ |
143 |
+ case 1: __put_user_asm_byte(__val, __dst, __err, ""); break; \ |
144 |
+ case 2: __put_user_asm_half(__val, __dst, __err, ""); break; \ |
145 |
+diff --git a/arch/arm/probes/kprobes/Makefile b/arch/arm/probes/kprobes/Makefile |
146 |
+index 14db56f49f0a3..6159010dac4a6 100644 |
147 |
+--- a/arch/arm/probes/kprobes/Makefile |
148 |
++++ b/arch/arm/probes/kprobes/Makefile |
149 |
+@@ -1,4 +1,7 @@ |
150 |
+ # SPDX-License-Identifier: GPL-2.0 |
151 |
++KASAN_SANITIZE_actions-common.o := n |
152 |
++KASAN_SANITIZE_actions-arm.o := n |
153 |
++KASAN_SANITIZE_actions-thumb.o := n |
154 |
+ obj-$(CONFIG_KPROBES) += core.o actions-common.o checkers-common.o |
155 |
+ obj-$(CONFIG_ARM_KPROBES_TEST) += test-kprobes.o |
156 |
+ test-kprobes-objs := test-core.o |
157 |
+diff --git a/arch/arm64/kvm/hyp/exception.c b/arch/arm64/kvm/hyp/exception.c |
158 |
+index 0418399e0a201..c5d0097154020 100644 |
159 |
+--- a/arch/arm64/kvm/hyp/exception.c |
160 |
++++ b/arch/arm64/kvm/hyp/exception.c |
161 |
+@@ -38,7 +38,10 @@ static inline void __vcpu_write_sys_reg(struct kvm_vcpu *vcpu, u64 val, int reg) |
162 |
+ |
163 |
+ static void __vcpu_write_spsr(struct kvm_vcpu *vcpu, u64 val) |
164 |
+ { |
165 |
+- write_sysreg_el1(val, SYS_SPSR); |
166 |
++ if (has_vhe()) |
167 |
++ write_sysreg_el1(val, SYS_SPSR); |
168 |
++ else |
169 |
++ __vcpu_sys_reg(vcpu, SPSR_EL1) = val; |
170 |
+ } |
171 |
+ |
172 |
+ static void __vcpu_write_spsr_abt(struct kvm_vcpu *vcpu, u64 val) |
173 |
+diff --git a/arch/arm64/kvm/hyp/pgtable.c b/arch/arm64/kvm/hyp/pgtable.c |
174 |
+index f8ceebe4982eb..4c77ff556f0ae 100644 |
175 |
+--- a/arch/arm64/kvm/hyp/pgtable.c |
176 |
++++ b/arch/arm64/kvm/hyp/pgtable.c |
177 |
+@@ -921,13 +921,9 @@ static int stage2_unmap_walker(u64 addr, u64 end, u32 level, kvm_pte_t *ptep, |
178 |
+ */ |
179 |
+ stage2_put_pte(ptep, mmu, addr, level, mm_ops); |
180 |
+ |
181 |
+- if (need_flush) { |
182 |
+- kvm_pte_t *pte_follow = kvm_pte_follow(pte, mm_ops); |
183 |
+- |
184 |
+- dcache_clean_inval_poc((unsigned long)pte_follow, |
185 |
+- (unsigned long)pte_follow + |
186 |
+- kvm_granule_size(level)); |
187 |
+- } |
188 |
++ if (need_flush && mm_ops->dcache_clean_inval_poc) |
189 |
++ mm_ops->dcache_clean_inval_poc(kvm_pte_follow(pte, mm_ops), |
190 |
++ kvm_granule_size(level)); |
191 |
+ |
192 |
+ if (childp) |
193 |
+ mm_ops->put_page(childp); |
194 |
+@@ -1089,15 +1085,13 @@ static int stage2_flush_walker(u64 addr, u64 end, u32 level, kvm_pte_t *ptep, |
195 |
+ struct kvm_pgtable *pgt = arg; |
196 |
+ struct kvm_pgtable_mm_ops *mm_ops = pgt->mm_ops; |
197 |
+ kvm_pte_t pte = *ptep; |
198 |
+- kvm_pte_t *pte_follow; |
199 |
+ |
200 |
+ if (!kvm_pte_valid(pte) || !stage2_pte_cacheable(pgt, pte)) |
201 |
+ return 0; |
202 |
+ |
203 |
+- pte_follow = kvm_pte_follow(pte, mm_ops); |
204 |
+- dcache_clean_inval_poc((unsigned long)pte_follow, |
205 |
+- (unsigned long)pte_follow + |
206 |
+- kvm_granule_size(level)); |
207 |
++ if (mm_ops->dcache_clean_inval_poc) |
208 |
++ mm_ops->dcache_clean_inval_poc(kvm_pte_follow(pte, mm_ops), |
209 |
++ kvm_granule_size(level)); |
210 |
+ return 0; |
211 |
+ } |
212 |
+ |
213 |
+diff --git a/arch/ia64/pci/fixup.c b/arch/ia64/pci/fixup.c |
214 |
+index acb55a41260dd..2bcdd7d3a1ada 100644 |
215 |
+--- a/arch/ia64/pci/fixup.c |
216 |
++++ b/arch/ia64/pci/fixup.c |
217 |
+@@ -76,5 +76,5 @@ static void pci_fixup_video(struct pci_dev *pdev) |
218 |
+ } |
219 |
+ } |
220 |
+ } |
221 |
+-DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_ANY_ID, PCI_ANY_ID, |
222 |
+- PCI_CLASS_DISPLAY_VGA, 8, pci_fixup_video); |
223 |
++DECLARE_PCI_FIXUP_CLASS_HEADER(PCI_ANY_ID, PCI_ANY_ID, |
224 |
++ PCI_CLASS_DISPLAY_VGA, 8, pci_fixup_video); |
225 |
+diff --git a/arch/mips/loongson64/vbios_quirk.c b/arch/mips/loongson64/vbios_quirk.c |
226 |
+index 9a29e94d3db1d..3115d4de982c5 100644 |
227 |
+--- a/arch/mips/loongson64/vbios_quirk.c |
228 |
++++ b/arch/mips/loongson64/vbios_quirk.c |
229 |
+@@ -3,7 +3,7 @@ |
230 |
+ #include <linux/pci.h> |
231 |
+ #include <loongson.h> |
232 |
+ |
233 |
+-static void pci_fixup_radeon(struct pci_dev *pdev) |
234 |
++static void pci_fixup_video(struct pci_dev *pdev) |
235 |
+ { |
236 |
+ struct resource *res = &pdev->resource[PCI_ROM_RESOURCE]; |
237 |
+ |
238 |
+@@ -22,8 +22,7 @@ static void pci_fixup_radeon(struct pci_dev *pdev) |
239 |
+ res->flags = IORESOURCE_MEM | IORESOURCE_ROM_SHADOW | |
240 |
+ IORESOURCE_PCI_FIXED; |
241 |
+ |
242 |
+- dev_info(&pdev->dev, "BAR %d: assigned %pR for Radeon ROM\n", |
243 |
+- PCI_ROM_RESOURCE, res); |
244 |
++ dev_info(&pdev->dev, "Video device with shadowed ROM at %pR\n", res); |
245 |
+ } |
246 |
+-DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_VENDOR_ID_ATI, 0x9615, |
247 |
+- PCI_CLASS_DISPLAY_VGA, 8, pci_fixup_radeon); |
248 |
++DECLARE_PCI_FIXUP_CLASS_HEADER(PCI_VENDOR_ID_ATI, 0x9615, |
249 |
++ PCI_CLASS_DISPLAY_VGA, 8, pci_fixup_video); |
250 |
+diff --git a/arch/powerpc/include/asm/book3s/32/mmu-hash.h b/arch/powerpc/include/asm/book3s/32/mmu-hash.h |
251 |
+index f5be185cbdf8d..94ad7acfd0565 100644 |
252 |
+--- a/arch/powerpc/include/asm/book3s/32/mmu-hash.h |
253 |
++++ b/arch/powerpc/include/asm/book3s/32/mmu-hash.h |
254 |
+@@ -143,6 +143,8 @@ static __always_inline void update_user_segments(u32 val) |
255 |
+ update_user_segment(15, val); |
256 |
+ } |
257 |
+ |
258 |
++int __init find_free_bat(void); |
259 |
++unsigned int bat_block_size(unsigned long base, unsigned long top); |
260 |
+ #endif /* !__ASSEMBLY__ */ |
261 |
+ |
262 |
+ /* We happily ignore the smaller BATs on 601, we don't actually use |
263 |
+diff --git a/arch/powerpc/include/asm/kvm_book3s_64.h b/arch/powerpc/include/asm/kvm_book3s_64.h |
264 |
+index 19b6942c6969a..eaf3a562bf1ed 100644 |
265 |
+--- a/arch/powerpc/include/asm/kvm_book3s_64.h |
266 |
++++ b/arch/powerpc/include/asm/kvm_book3s_64.h |
267 |
+@@ -39,7 +39,6 @@ struct kvm_nested_guest { |
268 |
+ pgd_t *shadow_pgtable; /* our page table for this guest */ |
269 |
+ u64 l1_gr_to_hr; /* L1's addr of part'n-scoped table */ |
270 |
+ u64 process_table; /* process table entry for this guest */ |
271 |
+- u64 hfscr; /* HFSCR that the L1 requested for this nested guest */ |
272 |
+ long refcnt; /* number of pointers to this struct */ |
273 |
+ struct mutex tlb_lock; /* serialize page faults and tlbies */ |
274 |
+ struct kvm_nested_guest *next; |
275 |
+diff --git a/arch/powerpc/include/asm/kvm_host.h b/arch/powerpc/include/asm/kvm_host.h |
276 |
+index 080a7feb77318..0d81a9bf37650 100644 |
277 |
+--- a/arch/powerpc/include/asm/kvm_host.h |
278 |
++++ b/arch/powerpc/include/asm/kvm_host.h |
279 |
+@@ -814,6 +814,7 @@ struct kvm_vcpu_arch { |
280 |
+ |
281 |
+ /* For support of nested guests */ |
282 |
+ struct kvm_nested_guest *nested; |
283 |
++ u64 nested_hfscr; /* HFSCR that the L1 requested for the nested guest */ |
284 |
+ u32 nested_vcpu_id; |
285 |
+ gpa_t nested_io_gpr; |
286 |
+ #endif |
287 |
+diff --git a/arch/powerpc/include/asm/ppc-opcode.h b/arch/powerpc/include/asm/ppc-opcode.h |
288 |
+index baea657bc8687..bca31a61e57f8 100644 |
289 |
+--- a/arch/powerpc/include/asm/ppc-opcode.h |
290 |
++++ b/arch/powerpc/include/asm/ppc-opcode.h |
291 |
+@@ -498,6 +498,7 @@ |
292 |
+ #define PPC_RAW_LDX(r, base, b) (0x7c00002a | ___PPC_RT(r) | ___PPC_RA(base) | ___PPC_RB(b)) |
293 |
+ #define PPC_RAW_LHZ(r, base, i) (0xa0000000 | ___PPC_RT(r) | ___PPC_RA(base) | IMM_L(i)) |
294 |
+ #define PPC_RAW_LHBRX(r, base, b) (0x7c00062c | ___PPC_RT(r) | ___PPC_RA(base) | ___PPC_RB(b)) |
295 |
++#define PPC_RAW_LWBRX(r, base, b) (0x7c00042c | ___PPC_RT(r) | ___PPC_RA(base) | ___PPC_RB(b)) |
296 |
+ #define PPC_RAW_LDBRX(r, base, b) (0x7c000428 | ___PPC_RT(r) | ___PPC_RA(base) | ___PPC_RB(b)) |
297 |
+ #define PPC_RAW_STWCX(s, a, b) (0x7c00012d | ___PPC_RS(s) | ___PPC_RA(a) | ___PPC_RB(b)) |
298 |
+ #define PPC_RAW_CMPWI(a, i) (0x2c000000 | ___PPC_RA(a) | IMM_L(i)) |
299 |
+diff --git a/arch/powerpc/include/asm/syscall.h b/arch/powerpc/include/asm/syscall.h |
300 |
+index c60ebd04b2ed9..61b968d9fba7c 100644 |
301 |
+--- a/arch/powerpc/include/asm/syscall.h |
302 |
++++ b/arch/powerpc/include/asm/syscall.h |
303 |
+@@ -90,7 +90,7 @@ static inline void syscall_get_arguments(struct task_struct *task, |
304 |
+ unsigned long val, mask = -1UL; |
305 |
+ unsigned int n = 6; |
306 |
+ |
307 |
+- if (is_32bit_task()) |
308 |
++ if (is_tsk_32bit_task(task)) |
309 |
+ mask = 0xffffffff; |
310 |
+ |
311 |
+ while (n--) { |
312 |
+@@ -115,7 +115,7 @@ static inline void syscall_set_arguments(struct task_struct *task, |
313 |
+ |
314 |
+ static inline int syscall_get_arch(struct task_struct *task) |
315 |
+ { |
316 |
+- if (is_32bit_task()) |
317 |
++ if (is_tsk_32bit_task(task)) |
318 |
+ return AUDIT_ARCH_PPC; |
319 |
+ else if (IS_ENABLED(CONFIG_CPU_LITTLE_ENDIAN)) |
320 |
+ return AUDIT_ARCH_PPC64LE; |
321 |
+diff --git a/arch/powerpc/include/asm/thread_info.h b/arch/powerpc/include/asm/thread_info.h |
322 |
+index b4ec6c7dd72ee..2a4ea0e213a92 100644 |
323 |
+--- a/arch/powerpc/include/asm/thread_info.h |
324 |
++++ b/arch/powerpc/include/asm/thread_info.h |
325 |
+@@ -165,8 +165,10 @@ static inline bool test_thread_local_flags(unsigned int flags) |
326 |
+ |
327 |
+ #ifdef CONFIG_COMPAT |
328 |
+ #define is_32bit_task() (test_thread_flag(TIF_32BIT)) |
329 |
++#define is_tsk_32bit_task(tsk) (test_tsk_thread_flag(tsk, TIF_32BIT)) |
330 |
+ #else |
331 |
+ #define is_32bit_task() (IS_ENABLED(CONFIG_PPC32)) |
332 |
++#define is_tsk_32bit_task(tsk) (IS_ENABLED(CONFIG_PPC32)) |
333 |
+ #endif |
334 |
+ |
335 |
+ #if defined(CONFIG_PPC64) |
336 |
+diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile |
337 |
+index 86e40db2dec56..b1b23b4d56ba2 100644 |
338 |
+--- a/arch/powerpc/kernel/Makefile |
339 |
++++ b/arch/powerpc/kernel/Makefile |
340 |
+@@ -11,6 +11,7 @@ CFLAGS_prom_init.o += -fPIC |
341 |
+ CFLAGS_btext.o += -fPIC |
342 |
+ endif |
343 |
+ |
344 |
++CFLAGS_early_32.o += $(DISABLE_LATENT_ENTROPY_PLUGIN) |
345 |
+ CFLAGS_cputable.o += $(DISABLE_LATENT_ENTROPY_PLUGIN) |
346 |
+ CFLAGS_prom_init.o += $(DISABLE_LATENT_ENTROPY_PLUGIN) |
347 |
+ CFLAGS_btext.o += $(DISABLE_LATENT_ENTROPY_PLUGIN) |
348 |
+diff --git a/arch/powerpc/kernel/interrupt_64.S b/arch/powerpc/kernel/interrupt_64.S |
349 |
+index 4b1ff94e67eb4..4c6d1a8dcefed 100644 |
350 |
+--- a/arch/powerpc/kernel/interrupt_64.S |
351 |
++++ b/arch/powerpc/kernel/interrupt_64.S |
352 |
+@@ -30,6 +30,7 @@ COMPAT_SYS_CALL_TABLE: |
353 |
+ .ifc \srr,srr |
354 |
+ mfspr r11,SPRN_SRR0 |
355 |
+ ld r12,_NIP(r1) |
356 |
++ clrrdi r11,r11,2 |
357 |
+ clrrdi r12,r12,2 |
358 |
+ 100: tdne r11,r12 |
359 |
+ EMIT_WARN_ENTRY 100b,__FILE__,__LINE__,(BUGFLAG_WARNING | BUGFLAG_ONCE) |
360 |
+@@ -40,6 +41,7 @@ COMPAT_SYS_CALL_TABLE: |
361 |
+ .else |
362 |
+ mfspr r11,SPRN_HSRR0 |
363 |
+ ld r12,_NIP(r1) |
364 |
++ clrrdi r11,r11,2 |
365 |
+ clrrdi r12,r12,2 |
366 |
+ 100: tdne r11,r12 |
367 |
+ EMIT_WARN_ENTRY 100b,__FILE__,__LINE__,(BUGFLAG_WARNING | BUGFLAG_ONCE) |
368 |
+diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c |
369 |
+index 94da0d25eb125..a2fd1db29f7e8 100644 |
370 |
+--- a/arch/powerpc/kvm/book3s_hv.c |
371 |
++++ b/arch/powerpc/kvm/book3s_hv.c |
372 |
+@@ -1731,7 +1731,6 @@ static int kvmppc_handle_exit_hv(struct kvm_vcpu *vcpu, |
373 |
+ |
374 |
+ static int kvmppc_handle_nested_exit(struct kvm_vcpu *vcpu) |
375 |
+ { |
376 |
+- struct kvm_nested_guest *nested = vcpu->arch.nested; |
377 |
+ int r; |
378 |
+ int srcu_idx; |
379 |
+ |
380 |
+@@ -1831,7 +1830,7 @@ static int kvmppc_handle_nested_exit(struct kvm_vcpu *vcpu) |
381 |
+ * it into a HEAI. |
382 |
+ */ |
383 |
+ if (!(vcpu->arch.hfscr_permitted & (1UL << cause)) || |
384 |
+- (nested->hfscr & (1UL << cause))) { |
385 |
++ (vcpu->arch.nested_hfscr & (1UL << cause))) { |
386 |
+ vcpu->arch.trap = BOOK3S_INTERRUPT_H_EMUL_ASSIST; |
387 |
+ |
388 |
+ /* |
389 |
+diff --git a/arch/powerpc/kvm/book3s_hv_nested.c b/arch/powerpc/kvm/book3s_hv_nested.c |
390 |
+index 89295b52a97c3..6c4e0e93105ff 100644 |
391 |
+--- a/arch/powerpc/kvm/book3s_hv_nested.c |
392 |
++++ b/arch/powerpc/kvm/book3s_hv_nested.c |
393 |
+@@ -362,7 +362,7 @@ long kvmhv_enter_nested_guest(struct kvm_vcpu *vcpu) |
394 |
+ /* set L1 state to L2 state */ |
395 |
+ vcpu->arch.nested = l2; |
396 |
+ vcpu->arch.nested_vcpu_id = l2_hv.vcpu_token; |
397 |
+- l2->hfscr = l2_hv.hfscr; |
398 |
++ vcpu->arch.nested_hfscr = l2_hv.hfscr; |
399 |
+ vcpu->arch.regs = l2_regs; |
400 |
+ |
401 |
+ /* Guest must always run with ME enabled, HV disabled. */ |
402 |
+diff --git a/arch/powerpc/lib/Makefile b/arch/powerpc/lib/Makefile |
403 |
+index 99a7c9132422c..54be64203b2ab 100644 |
404 |
+--- a/arch/powerpc/lib/Makefile |
405 |
++++ b/arch/powerpc/lib/Makefile |
406 |
+@@ -19,6 +19,9 @@ CFLAGS_code-patching.o += -DDISABLE_BRANCH_PROFILING |
407 |
+ CFLAGS_feature-fixups.o += -DDISABLE_BRANCH_PROFILING |
408 |
+ endif |
409 |
+ |
410 |
++CFLAGS_code-patching.o += $(DISABLE_LATENT_ENTROPY_PLUGIN) |
411 |
++CFLAGS_feature-fixups.o += $(DISABLE_LATENT_ENTROPY_PLUGIN) |
412 |
++ |
413 |
+ obj-y += alloc.o code-patching.o feature-fixups.o pmem.o test_code-patching.o |
414 |
+ |
415 |
+ ifndef CONFIG_KASAN |
416 |
+diff --git a/arch/powerpc/mm/book3s32/mmu.c b/arch/powerpc/mm/book3s32/mmu.c |
417 |
+index 27061583a0107..203735caf6915 100644 |
418 |
+--- a/arch/powerpc/mm/book3s32/mmu.c |
419 |
++++ b/arch/powerpc/mm/book3s32/mmu.c |
420 |
+@@ -76,7 +76,7 @@ unsigned long p_block_mapped(phys_addr_t pa) |
421 |
+ return 0; |
422 |
+ } |
423 |
+ |
424 |
+-static int find_free_bat(void) |
425 |
++int __init find_free_bat(void) |
426 |
+ { |
427 |
+ int b; |
428 |
+ int n = mmu_has_feature(MMU_FTR_USE_HIGH_BATS) ? 8 : 4; |
429 |
+@@ -100,7 +100,7 @@ static int find_free_bat(void) |
430 |
+ * - block size has to be a power of two. This is calculated by finding the |
431 |
+ * highest bit set to 1. |
432 |
+ */ |
433 |
+-static unsigned int block_size(unsigned long base, unsigned long top) |
434 |
++unsigned int bat_block_size(unsigned long base, unsigned long top) |
435 |
+ { |
436 |
+ unsigned int max_size = SZ_256M; |
437 |
+ unsigned int base_shift = (ffs(base) - 1) & 31; |
438 |
+@@ -145,7 +145,7 @@ static unsigned long __init __mmu_mapin_ram(unsigned long base, unsigned long to |
439 |
+ int idx; |
440 |
+ |
441 |
+ while ((idx = find_free_bat()) != -1 && base != top) { |
442 |
+- unsigned int size = block_size(base, top); |
443 |
++ unsigned int size = bat_block_size(base, top); |
444 |
+ |
445 |
+ if (size < 128 << 10) |
446 |
+ break; |
447 |
+@@ -196,18 +196,17 @@ void mmu_mark_initmem_nx(void) |
448 |
+ int nb = mmu_has_feature(MMU_FTR_USE_HIGH_BATS) ? 8 : 4; |
449 |
+ int i; |
450 |
+ unsigned long base = (unsigned long)_stext - PAGE_OFFSET; |
451 |
+- unsigned long top = (unsigned long)_etext - PAGE_OFFSET; |
452 |
++ unsigned long top = ALIGN((unsigned long)_etext - PAGE_OFFSET, SZ_128K); |
453 |
+ unsigned long border = (unsigned long)__init_begin - PAGE_OFFSET; |
454 |
+ unsigned long size; |
455 |
+ |
456 |
+- for (i = 0; i < nb - 1 && base < top && top - base > (128 << 10);) { |
457 |
+- size = block_size(base, top); |
458 |
++ for (i = 0; i < nb - 1 && base < top;) { |
459 |
++ size = bat_block_size(base, top); |
460 |
+ setibat(i++, PAGE_OFFSET + base, base, size, PAGE_KERNEL_TEXT); |
461 |
+ base += size; |
462 |
+ } |
463 |
+ if (base < top) { |
464 |
+- size = block_size(base, top); |
465 |
+- size = max(size, 128UL << 10); |
466 |
++ size = bat_block_size(base, top); |
467 |
+ if ((top - base) > size) { |
468 |
+ size <<= 1; |
469 |
+ if (strict_kernel_rwx_enabled() && base + size > border) |
470 |
+diff --git a/arch/powerpc/mm/kasan/book3s_32.c b/arch/powerpc/mm/kasan/book3s_32.c |
471 |
+index 35b287b0a8da4..450a67ef0bbe1 100644 |
472 |
+--- a/arch/powerpc/mm/kasan/book3s_32.c |
473 |
++++ b/arch/powerpc/mm/kasan/book3s_32.c |
474 |
+@@ -10,48 +10,51 @@ int __init kasan_init_region(void *start, size_t size) |
475 |
+ { |
476 |
+ unsigned long k_start = (unsigned long)kasan_mem_to_shadow(start); |
477 |
+ unsigned long k_end = (unsigned long)kasan_mem_to_shadow(start + size); |
478 |
+- unsigned long k_cur = k_start; |
479 |
+- int k_size = k_end - k_start; |
480 |
+- int k_size_base = 1 << (ffs(k_size) - 1); |
481 |
++ unsigned long k_nobat = k_start; |
482 |
++ unsigned long k_cur; |
483 |
++ phys_addr_t phys; |
484 |
+ int ret; |
485 |
+- void *block; |
486 |
+ |
487 |
+- block = memblock_alloc(k_size, k_size_base); |
488 |
+- |
489 |
+- if (block && k_size_base >= SZ_128K && k_start == ALIGN(k_start, k_size_base)) { |
490 |
+- int shift = ffs(k_size - k_size_base); |
491 |
+- int k_size_more = shift ? 1 << (shift - 1) : 0; |
492 |
+- |
493 |
+- setbat(-1, k_start, __pa(block), k_size_base, PAGE_KERNEL); |
494 |
+- if (k_size_more >= SZ_128K) |
495 |
+- setbat(-1, k_start + k_size_base, __pa(block) + k_size_base, |
496 |
+- k_size_more, PAGE_KERNEL); |
497 |
+- if (v_block_mapped(k_start)) |
498 |
+- k_cur = k_start + k_size_base; |
499 |
+- if (v_block_mapped(k_start + k_size_base)) |
500 |
+- k_cur = k_start + k_size_base + k_size_more; |
501 |
+- |
502 |
+- update_bats(); |
503 |
++ while (k_nobat < k_end) { |
504 |
++ unsigned int k_size = bat_block_size(k_nobat, k_end); |
505 |
++ int idx = find_free_bat(); |
506 |
++ |
507 |
++ if (idx == -1) |
508 |
++ break; |
509 |
++ if (k_size < SZ_128K) |
510 |
++ break; |
511 |
++ phys = memblock_phys_alloc_range(k_size, k_size, 0, |
512 |
++ MEMBLOCK_ALLOC_ANYWHERE); |
513 |
++ if (!phys) |
514 |
++ break; |
515 |
++ |
516 |
++ setbat(idx, k_nobat, phys, k_size, PAGE_KERNEL); |
517 |
++ k_nobat += k_size; |
518 |
+ } |
519 |
++ if (k_nobat != k_start) |
520 |
++ update_bats(); |
521 |
+ |
522 |
+- if (!block) |
523 |
+- block = memblock_alloc(k_size, PAGE_SIZE); |
524 |
+- if (!block) |
525 |
+- return -ENOMEM; |
526 |
++ if (k_nobat < k_end) { |
527 |
++ phys = memblock_phys_alloc_range(k_end - k_nobat, PAGE_SIZE, 0, |
528 |
++ MEMBLOCK_ALLOC_ANYWHERE); |
529 |
++ if (!phys) |
530 |
++ return -ENOMEM; |
531 |
++ } |
532 |
+ |
533 |
+ ret = kasan_init_shadow_page_tables(k_start, k_end); |
534 |
+ if (ret) |
535 |
+ return ret; |
536 |
+ |
537 |
+- kasan_update_early_region(k_start, k_cur, __pte(0)); |
538 |
++ kasan_update_early_region(k_start, k_nobat, __pte(0)); |
539 |
+ |
540 |
+- for (; k_cur < k_end; k_cur += PAGE_SIZE) { |
541 |
++ for (k_cur = k_nobat; k_cur < k_end; k_cur += PAGE_SIZE) { |
542 |
+ pmd_t *pmd = pmd_off_k(k_cur); |
543 |
+- void *va = block + k_cur - k_start; |
544 |
+- pte_t pte = pfn_pte(PHYS_PFN(__pa(va)), PAGE_KERNEL); |
545 |
++ pte_t pte = pfn_pte(PHYS_PFN(phys + k_cur - k_nobat), PAGE_KERNEL); |
546 |
+ |
547 |
+ __set_pte_at(&init_mm, k_cur, pte_offset_kernel(pmd, k_cur), pte, 0); |
548 |
+ } |
549 |
+ flush_tlb_kernel_range(k_start, k_end); |
550 |
++ memset(kasan_mem_to_shadow(start), 0, k_end - k_start); |
551 |
++ |
552 |
+ return 0; |
553 |
+ } |
554 |
+diff --git a/arch/powerpc/net/bpf_jit_comp.c b/arch/powerpc/net/bpf_jit_comp.c |
555 |
+index 90ce75f0f1e2a..8acf8a611a265 100644 |
556 |
+--- a/arch/powerpc/net/bpf_jit_comp.c |
557 |
++++ b/arch/powerpc/net/bpf_jit_comp.c |
558 |
+@@ -23,15 +23,15 @@ static void bpf_jit_fill_ill_insns(void *area, unsigned int size) |
559 |
+ memset32(area, BREAKPOINT_INSTRUCTION, size / 4); |
560 |
+ } |
561 |
+ |
562 |
+-/* Fix the branch target addresses for subprog calls */ |
563 |
+-static int bpf_jit_fixup_subprog_calls(struct bpf_prog *fp, u32 *image, |
564 |
+- struct codegen_context *ctx, u32 *addrs) |
565 |
++/* Fix updated addresses (for subprog calls, ldimm64, et al) during extra pass */ |
566 |
++static int bpf_jit_fixup_addresses(struct bpf_prog *fp, u32 *image, |
567 |
++ struct codegen_context *ctx, u32 *addrs) |
568 |
+ { |
569 |
+ const struct bpf_insn *insn = fp->insnsi; |
570 |
+ bool func_addr_fixed; |
571 |
+ u64 func_addr; |
572 |
+ u32 tmp_idx; |
573 |
+- int i, ret; |
574 |
++ int i, j, ret; |
575 |
+ |
576 |
+ for (i = 0; i < fp->len; i++) { |
577 |
+ /* |
578 |
+@@ -66,6 +66,23 @@ static int bpf_jit_fixup_subprog_calls(struct bpf_prog *fp, u32 *image, |
579 |
+ * of the JITed sequence remains unchanged. |
580 |
+ */ |
581 |
+ ctx->idx = tmp_idx; |
582 |
++ } else if (insn[i].code == (BPF_LD | BPF_IMM | BPF_DW)) { |
583 |
++ tmp_idx = ctx->idx; |
584 |
++ ctx->idx = addrs[i] / 4; |
585 |
++#ifdef CONFIG_PPC32 |
586 |
++ PPC_LI32(ctx->b2p[insn[i].dst_reg] - 1, (u32)insn[i + 1].imm); |
587 |
++ PPC_LI32(ctx->b2p[insn[i].dst_reg], (u32)insn[i].imm); |
588 |
++ for (j = ctx->idx - addrs[i] / 4; j < 4; j++) |
589 |
++ EMIT(PPC_RAW_NOP()); |
590 |
++#else |
591 |
++ func_addr = ((u64)(u32)insn[i].imm) | (((u64)(u32)insn[i + 1].imm) << 32); |
592 |
++ PPC_LI64(b2p[insn[i].dst_reg], func_addr); |
593 |
++ /* overwrite rest with nops */ |
594 |
++ for (j = ctx->idx - addrs[i] / 4; j < 5; j++) |
595 |
++ EMIT(PPC_RAW_NOP()); |
596 |
++#endif |
597 |
++ ctx->idx = tmp_idx; |
598 |
++ i++; |
599 |
+ } |
600 |
+ } |
601 |
+ |
602 |
+@@ -193,13 +210,13 @@ skip_init_ctx: |
603 |
+ /* |
604 |
+ * Do not touch the prologue and epilogue as they will remain |
605 |
+ * unchanged. Only fix the branch target address for subprog |
606 |
+- * calls in the body. |
607 |
++ * calls in the body, and ldimm64 instructions. |
608 |
+ * |
609 |
+ * This does not change the offsets and lengths of the subprog |
610 |
+ * call instruction sequences and hence, the size of the JITed |
611 |
+ * image as well. |
612 |
+ */ |
613 |
+- bpf_jit_fixup_subprog_calls(fp, code_base, &cgctx, addrs); |
614 |
++ bpf_jit_fixup_addresses(fp, code_base, &cgctx, addrs); |
615 |
+ |
616 |
+ /* There is no need to perform the usual passes. */ |
617 |
+ goto skip_codegen_passes; |
618 |
+diff --git a/arch/powerpc/net/bpf_jit_comp32.c b/arch/powerpc/net/bpf_jit_comp32.c |
619 |
+index 0da31d41d4131..bce5eda85170f 100644 |
620 |
+--- a/arch/powerpc/net/bpf_jit_comp32.c |
621 |
++++ b/arch/powerpc/net/bpf_jit_comp32.c |
622 |
+@@ -191,6 +191,9 @@ void bpf_jit_emit_func_call_rel(u32 *image, struct codegen_context *ctx, u64 fun |
623 |
+ |
624 |
+ if (image && rel < 0x2000000 && rel >= -0x2000000) { |
625 |
+ PPC_BL_ABS(func); |
626 |
++ EMIT(PPC_RAW_NOP()); |
627 |
++ EMIT(PPC_RAW_NOP()); |
628 |
++ EMIT(PPC_RAW_NOP()); |
629 |
+ } else { |
630 |
+ /* Load function address into r0 */ |
631 |
+ EMIT(PPC_RAW_LIS(_R0, IMM_H(func))); |
632 |
+@@ -289,6 +292,8 @@ int bpf_jit_build_body(struct bpf_prog *fp, u32 *image, struct codegen_context * |
633 |
+ bool func_addr_fixed; |
634 |
+ u64 func_addr; |
635 |
+ u32 true_cond; |
636 |
++ u32 tmp_idx; |
637 |
++ int j; |
638 |
+ |
639 |
+ /* |
640 |
+ * addrs[] maps a BPF bytecode address into a real offset from |
641 |
+@@ -836,8 +841,12 @@ int bpf_jit_build_body(struct bpf_prog *fp, u32 *image, struct codegen_context * |
642 |
+ * 16 byte instruction that uses two 'struct bpf_insn' |
643 |
+ */ |
644 |
+ case BPF_LD | BPF_IMM | BPF_DW: /* dst = (u64) imm */ |
645 |
++ tmp_idx = ctx->idx; |
646 |
+ PPC_LI32(dst_reg_h, (u32)insn[i + 1].imm); |
647 |
+ PPC_LI32(dst_reg, (u32)insn[i].imm); |
648 |
++ /* padding to allow full 4 instructions for later patching */ |
649 |
++ for (j = ctx->idx - tmp_idx; j < 4; j++) |
650 |
++ EMIT(PPC_RAW_NOP()); |
651 |
+ /* Adjust for two bpf instructions */ |
652 |
+ addrs[++i] = ctx->idx * 4; |
653 |
+ break; |
654 |
+diff --git a/arch/powerpc/net/bpf_jit_comp64.c b/arch/powerpc/net/bpf_jit_comp64.c |
655 |
+index 8b5157ccfebae..57e1b6680365c 100644 |
656 |
+--- a/arch/powerpc/net/bpf_jit_comp64.c |
657 |
++++ b/arch/powerpc/net/bpf_jit_comp64.c |
658 |
+@@ -318,6 +318,7 @@ int bpf_jit_build_body(struct bpf_prog *fp, u32 *image, struct codegen_context * |
659 |
+ u64 imm64; |
660 |
+ u32 true_cond; |
661 |
+ u32 tmp_idx; |
662 |
++ int j; |
663 |
+ |
664 |
+ /* |
665 |
+ * addrs[] maps a BPF bytecode address into a real offset from |
666 |
+@@ -632,17 +633,21 @@ bpf_alu32_trunc: |
667 |
+ EMIT(PPC_RAW_MR(dst_reg, b2p[TMP_REG_1])); |
668 |
+ break; |
669 |
+ case 64: |
670 |
+- /* |
671 |
+- * Way easier and faster(?) to store the value |
672 |
+- * into stack and then use ldbrx |
673 |
+- * |
674 |
+- * ctx->seen will be reliable in pass2, but |
675 |
+- * the instructions generated will remain the |
676 |
+- * same across all passes |
677 |
+- */ |
678 |
++ /* Store the value to stack and then use byte-reverse loads */ |
679 |
+ PPC_BPF_STL(dst_reg, 1, bpf_jit_stack_local(ctx)); |
680 |
+ EMIT(PPC_RAW_ADDI(b2p[TMP_REG_1], 1, bpf_jit_stack_local(ctx))); |
681 |
+- EMIT(PPC_RAW_LDBRX(dst_reg, 0, b2p[TMP_REG_1])); |
682 |
++ if (cpu_has_feature(CPU_FTR_ARCH_206)) { |
683 |
++ EMIT(PPC_RAW_LDBRX(dst_reg, 0, b2p[TMP_REG_1])); |
684 |
++ } else { |
685 |
++ EMIT(PPC_RAW_LWBRX(dst_reg, 0, b2p[TMP_REG_1])); |
686 |
++ if (IS_ENABLED(CONFIG_CPU_LITTLE_ENDIAN)) |
687 |
++ EMIT(PPC_RAW_SLDI(dst_reg, dst_reg, 32)); |
688 |
++ EMIT(PPC_RAW_LI(b2p[TMP_REG_2], 4)); |
689 |
++ EMIT(PPC_RAW_LWBRX(b2p[TMP_REG_2], b2p[TMP_REG_2], b2p[TMP_REG_1])); |
690 |
++ if (IS_ENABLED(CONFIG_CPU_BIG_ENDIAN)) |
691 |
++ EMIT(PPC_RAW_SLDI(b2p[TMP_REG_2], b2p[TMP_REG_2], 32)); |
692 |
++ EMIT(PPC_RAW_OR(dst_reg, dst_reg, b2p[TMP_REG_2])); |
693 |
++ } |
694 |
+ break; |
695 |
+ } |
696 |
+ break; |
697 |
+@@ -806,9 +811,13 @@ emit_clear: |
698 |
+ case BPF_LD | BPF_IMM | BPF_DW: /* dst = (u64) imm */ |
699 |
+ imm64 = ((u64)(u32) insn[i].imm) | |
700 |
+ (((u64)(u32) insn[i+1].imm) << 32); |
701 |
++ tmp_idx = ctx->idx; |
702 |
++ PPC_LI64(dst_reg, imm64); |
703 |
++ /* padding to allow full 5 instructions for later patching */ |
704 |
++ for (j = ctx->idx - tmp_idx; j < 5; j++) |
705 |
++ EMIT(PPC_RAW_NOP()); |
706 |
+ /* Adjust for two bpf instructions */ |
707 |
+ addrs[++i] = ctx->idx * 4; |
708 |
+- PPC_LI64(dst_reg, imm64); |
709 |
+ break; |
710 |
+ |
711 |
+ /* |
712 |
+diff --git a/arch/powerpc/perf/core-book3s.c b/arch/powerpc/perf/core-book3s.c |
713 |
+index bef6b1abce702..e78de70509472 100644 |
714 |
+--- a/arch/powerpc/perf/core-book3s.c |
715 |
++++ b/arch/powerpc/perf/core-book3s.c |
716 |
+@@ -1326,9 +1326,20 @@ static void power_pmu_disable(struct pmu *pmu) |
717 |
+ * Otherwise provide a warning if there is PMI pending, but |
718 |
+ * no counter is found overflown. |
719 |
+ */ |
720 |
+- if (any_pmc_overflown(cpuhw)) |
721 |
+- clear_pmi_irq_pending(); |
722 |
+- else |
723 |
++ if (any_pmc_overflown(cpuhw)) { |
724 |
++ /* |
725 |
++ * Since power_pmu_disable runs under local_irq_save, it |
726 |
++ * could happen that code hits a PMC overflow without PMI |
727 |
++ * pending in paca. Hence only clear PMI pending if it was |
728 |
++ * set. |
729 |
++ * |
730 |
++ * If a PMI is pending, then MSR[EE] must be disabled (because |
731 |
++ * the masked PMI handler disabling EE). So it is safe to |
732 |
++ * call clear_pmi_irq_pending(). |
733 |
++ */ |
734 |
++ if (pmi_irq_pending()) |
735 |
++ clear_pmi_irq_pending(); |
736 |
++ } else |
737 |
+ WARN_ON(pmi_irq_pending()); |
738 |
+ |
739 |
+ val = mmcra = cpuhw->mmcr.mmcra; |
740 |
+diff --git a/arch/s390/hypfs/hypfs_vm.c b/arch/s390/hypfs/hypfs_vm.c |
741 |
+index 33f973ff97442..e8f15dbb89d02 100644 |
742 |
+--- a/arch/s390/hypfs/hypfs_vm.c |
743 |
++++ b/arch/s390/hypfs/hypfs_vm.c |
744 |
+@@ -20,6 +20,7 @@ |
745 |
+ |
746 |
+ static char local_guest[] = " "; |
747 |
+ static char all_guests[] = "* "; |
748 |
++static char *all_groups = all_guests; |
749 |
+ static char *guest_query; |
750 |
+ |
751 |
+ struct diag2fc_data { |
752 |
+@@ -62,10 +63,11 @@ static int diag2fc(int size, char* query, void *addr) |
753 |
+ |
754 |
+ memcpy(parm_list.userid, query, NAME_LEN); |
755 |
+ ASCEBC(parm_list.userid, NAME_LEN); |
756 |
+- parm_list.addr = (unsigned long) addr ; |
757 |
++ memcpy(parm_list.aci_grp, all_groups, NAME_LEN); |
758 |
++ ASCEBC(parm_list.aci_grp, NAME_LEN); |
759 |
++ parm_list.addr = (unsigned long)addr; |
760 |
+ parm_list.size = size; |
761 |
+ parm_list.fmt = 0x02; |
762 |
+- memset(parm_list.aci_grp, 0x40, NAME_LEN); |
763 |
+ rc = -1; |
764 |
+ |
765 |
+ diag_stat_inc(DIAG_STAT_X2FC); |
766 |
+diff --git a/arch/s390/kernel/module.c b/arch/s390/kernel/module.c |
767 |
+index b01ba460b7cad..a805ea5cb92d1 100644 |
768 |
+--- a/arch/s390/kernel/module.c |
769 |
++++ b/arch/s390/kernel/module.c |
770 |
+@@ -33,7 +33,7 @@ |
771 |
+ #define DEBUGP(fmt , ...) |
772 |
+ #endif |
773 |
+ |
774 |
+-#define PLT_ENTRY_SIZE 20 |
775 |
++#define PLT_ENTRY_SIZE 22 |
776 |
+ |
777 |
+ void *module_alloc(unsigned long size) |
778 |
+ { |
779 |
+@@ -340,27 +340,26 @@ static int apply_rela(Elf_Rela *rela, Elf_Addr base, Elf_Sym *symtab, |
780 |
+ case R_390_PLTOFF32: /* 32 bit offset from GOT to PLT. */ |
781 |
+ case R_390_PLTOFF64: /* 16 bit offset from GOT to PLT. */ |
782 |
+ if (info->plt_initialized == 0) { |
783 |
+- unsigned int insn[5]; |
784 |
+- unsigned int *ip = me->core_layout.base + |
785 |
+- me->arch.plt_offset + |
786 |
+- info->plt_offset; |
787 |
+- |
788 |
+- insn[0] = 0x0d10e310; /* basr 1,0 */ |
789 |
+- insn[1] = 0x100a0004; /* lg 1,10(1) */ |
790 |
++ unsigned char insn[PLT_ENTRY_SIZE]; |
791 |
++ char *plt_base; |
792 |
++ char *ip; |
793 |
++ |
794 |
++ plt_base = me->core_layout.base + me->arch.plt_offset; |
795 |
++ ip = plt_base + info->plt_offset; |
796 |
++ *(int *)insn = 0x0d10e310; /* basr 1,0 */ |
797 |
++ *(int *)&insn[4] = 0x100c0004; /* lg 1,12(1) */ |
798 |
+ if (IS_ENABLED(CONFIG_EXPOLINE) && !nospec_disable) { |
799 |
+- unsigned int *ij; |
800 |
+- ij = me->core_layout.base + |
801 |
+- me->arch.plt_offset + |
802 |
+- me->arch.plt_size - PLT_ENTRY_SIZE; |
803 |
+- insn[2] = 0xa7f40000 + /* j __jump_r1 */ |
804 |
+- (unsigned int)(u16) |
805 |
+- (((unsigned long) ij - 8 - |
806 |
+- (unsigned long) ip) / 2); |
807 |
++ char *jump_r1; |
808 |
++ |
809 |
++ jump_r1 = plt_base + me->arch.plt_size - |
810 |
++ PLT_ENTRY_SIZE; |
811 |
++ /* brcl 0xf,__jump_r1 */ |
812 |
++ *(short *)&insn[8] = 0xc0f4; |
813 |
++ *(int *)&insn[10] = (jump_r1 - (ip + 8)) / 2; |
814 |
+ } else { |
815 |
+- insn[2] = 0x07f10000; /* br %r1 */ |
816 |
++ *(int *)&insn[8] = 0x07f10000; /* br %r1 */ |
817 |
+ } |
818 |
+- insn[3] = (unsigned int) (val >> 32); |
819 |
+- insn[4] = (unsigned int) val; |
820 |
++ *(long *)&insn[14] = val; |
821 |
+ |
822 |
+ write(ip, insn, sizeof(insn)); |
823 |
+ info->plt_initialized = 1; |
824 |
+diff --git a/arch/s390/kernel/nmi.c b/arch/s390/kernel/nmi.c |
825 |
+index 20f8e1868853f..a50f2ff1b00e8 100644 |
826 |
+--- a/arch/s390/kernel/nmi.c |
827 |
++++ b/arch/s390/kernel/nmi.c |
828 |
+@@ -273,7 +273,14 @@ static int notrace s390_validate_registers(union mci mci, int umode) |
829 |
+ /* Validate vector registers */ |
830 |
+ union ctlreg0 cr0; |
831 |
+ |
832 |
+- if (!mci.vr) { |
833 |
++ /* |
834 |
++ * The vector validity must only be checked if not running a |
835 |
++ * KVM guest. For KVM guests the machine check is forwarded by |
836 |
++ * KVM and it is the responsibility of the guest to take |
837 |
++ * appropriate actions. The host vector or FPU values have been |
838 |
++ * saved by KVM and will be restored by KVM. |
839 |
++ */ |
840 |
++ if (!mci.vr && !test_cpu_flag(CIF_MCCK_GUEST)) { |
841 |
+ /* |
842 |
+ * Vector registers can't be restored. If the kernel |
843 |
+ * currently uses vector registers the system is |
844 |
+@@ -316,11 +323,21 @@ static int notrace s390_validate_registers(union mci mci, int umode) |
845 |
+ if (cr2.gse) { |
846 |
+ if (!mci.gs) { |
847 |
+ /* |
848 |
+- * Guarded storage register can't be restored and |
849 |
+- * the current processes uses guarded storage. |
850 |
+- * It has to be terminated. |
851 |
++ * 2 cases: |
852 |
++ * - machine check in kernel or userspace |
853 |
++ * - machine check while running SIE (KVM guest) |
854 |
++ * For kernel or userspace the userspace values of |
855 |
++ * guarded storage control can not be recreated, the |
856 |
++ * process must be terminated. |
857 |
++ * For SIE the guest values of guarded storage can not |
858 |
++ * be recreated. This is either due to a bug or due to |
859 |
++ * GS being disabled in the guest. The guest will be |
860 |
++ * notified by KVM code and the guests machine check |
861 |
++ * handling must take care of this. The host values |
862 |
++ * are saved by KVM and are not affected. |
863 |
+ */ |
864 |
+- kill_task = 1; |
865 |
++ if (!test_cpu_flag(CIF_MCCK_GUEST)) |
866 |
++ kill_task = 1; |
867 |
+ } else { |
868 |
+ load_gs_cb((struct gs_cb *)mcesa->guarded_storage_save_area); |
869 |
+ } |
870 |
+diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c |
871 |
+index 03e6555aa8f1d..dcf455525cfcb 100644 |
872 |
+--- a/arch/x86/events/intel/core.c |
873 |
++++ b/arch/x86/events/intel/core.c |
874 |
+@@ -6187,6 +6187,19 @@ __init int intel_pmu_init(void) |
875 |
+ pmu->num_counters = x86_pmu.num_counters; |
876 |
+ pmu->num_counters_fixed = x86_pmu.num_counters_fixed; |
877 |
+ } |
878 |
++ |
879 |
++ /* |
880 |
++ * Quirk: For some Alder Lake machine, when all E-cores are disabled in |
881 |
++ * a BIOS, the leaf 0xA will enumerate all counters of P-cores. However, |
882 |
++ * the X86_FEATURE_HYBRID_CPU is still set. The above codes will |
883 |
++ * mistakenly add extra counters for P-cores. Correct the number of |
884 |
++ * counters here. |
885 |
++ */ |
886 |
++ if ((pmu->num_counters > 8) || (pmu->num_counters_fixed > 4)) { |
887 |
++ pmu->num_counters = x86_pmu.num_counters; |
888 |
++ pmu->num_counters_fixed = x86_pmu.num_counters_fixed; |
889 |
++ } |
890 |
++ |
891 |
+ pmu->max_pebs_events = min_t(unsigned, MAX_PEBS_EVENTS, pmu->num_counters); |
892 |
+ pmu->unconstrained = (struct event_constraint) |
893 |
+ __EVENT_CONSTRAINT(0, (1ULL << pmu->num_counters) - 1, |
894 |
+diff --git a/arch/x86/events/intel/uncore_snbep.c b/arch/x86/events/intel/uncore_snbep.c |
895 |
+index 3660f698fb2aa..ed869443efb21 100644 |
896 |
+--- a/arch/x86/events/intel/uncore_snbep.c |
897 |
++++ b/arch/x86/events/intel/uncore_snbep.c |
898 |
+@@ -5482,7 +5482,7 @@ static struct intel_uncore_type icx_uncore_imc = { |
899 |
+ .fixed_ctr_bits = 48, |
900 |
+ .fixed_ctr = SNR_IMC_MMIO_PMON_FIXED_CTR, |
901 |
+ .fixed_ctl = SNR_IMC_MMIO_PMON_FIXED_CTL, |
902 |
+- .event_descs = hswep_uncore_imc_events, |
903 |
++ .event_descs = snr_uncore_imc_events, |
904 |
+ .perf_ctr = SNR_IMC_MMIO_PMON_CTR0, |
905 |
+ .event_ctl = SNR_IMC_MMIO_PMON_CTL0, |
906 |
+ .event_mask = SNBEP_PMON_RAW_EVENT_MASK, |
907 |
+diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h |
908 |
+index 77ab14bcd4777..01759199d7238 100644 |
909 |
+--- a/arch/x86/include/asm/kvm_host.h |
910 |
++++ b/arch/x86/include/asm/kvm_host.h |
911 |
+@@ -1487,6 +1487,7 @@ struct kvm_x86_ops { |
912 |
+ }; |
913 |
+ |
914 |
+ struct kvm_x86_nested_ops { |
915 |
++ void (*leave_nested)(struct kvm_vcpu *vcpu); |
916 |
+ int (*check_events)(struct kvm_vcpu *vcpu); |
917 |
+ bool (*hv_timer_pending)(struct kvm_vcpu *vcpu); |
918 |
+ void (*triple_fault)(struct kvm_vcpu *vcpu); |
919 |
+diff --git a/arch/x86/kernel/cpu/mce/amd.c b/arch/x86/kernel/cpu/mce/amd.c |
920 |
+index 08831acc1d036..c0c57bd05f02d 100644 |
921 |
+--- a/arch/x86/kernel/cpu/mce/amd.c |
922 |
++++ b/arch/x86/kernel/cpu/mce/amd.c |
923 |
+@@ -400,7 +400,7 @@ static void threshold_restart_bank(void *_tr) |
924 |
+ u32 hi, lo; |
925 |
+ |
926 |
+ /* sysfs write might race against an offline operation */ |
927 |
+- if (this_cpu_read(threshold_banks)) |
928 |
++ if (!this_cpu_read(threshold_banks) && !tr->set_lvt_off) |
929 |
+ return; |
930 |
+ |
931 |
+ rdmsr(tr->b->address, lo, hi); |
932 |
+diff --git a/arch/x86/kernel/cpu/mce/intel.c b/arch/x86/kernel/cpu/mce/intel.c |
933 |
+index bb9a46a804bf2..baafbb37be678 100644 |
934 |
+--- a/arch/x86/kernel/cpu/mce/intel.c |
935 |
++++ b/arch/x86/kernel/cpu/mce/intel.c |
936 |
+@@ -486,6 +486,7 @@ static void intel_ppin_init(struct cpuinfo_x86 *c) |
937 |
+ case INTEL_FAM6_BROADWELL_X: |
938 |
+ case INTEL_FAM6_SKYLAKE_X: |
939 |
+ case INTEL_FAM6_ICELAKE_X: |
940 |
++ case INTEL_FAM6_ICELAKE_D: |
941 |
+ case INTEL_FAM6_SAPPHIRERAPIDS_X: |
942 |
+ case INTEL_FAM6_XEON_PHI_KNL: |
943 |
+ case INTEL_FAM6_XEON_PHI_KNM: |
944 |
+diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c |
945 |
+index d8f9aa2605e66..91c2dc9f198df 100644 |
946 |
+--- a/arch/x86/kvm/lapic.c |
947 |
++++ b/arch/x86/kvm/lapic.c |
948 |
+@@ -2623,7 +2623,7 @@ int kvm_apic_set_state(struct kvm_vcpu *vcpu, struct kvm_lapic_state *s) |
949 |
+ kvm_apic_set_version(vcpu); |
950 |
+ |
951 |
+ apic_update_ppr(apic); |
952 |
+- hrtimer_cancel(&apic->lapic_timer.timer); |
953 |
++ cancel_apic_timer(apic); |
954 |
+ apic->lapic_timer.expired_tscdeadline = 0; |
955 |
+ apic_update_lvtt(apic); |
956 |
+ apic_manage_nmi_watchdog(apic, kvm_lapic_get_reg(apic, APIC_LVT0)); |
957 |
+diff --git a/arch/x86/kvm/svm/nested.c b/arch/x86/kvm/svm/nested.c |
958 |
+index 510b833cbd399..de80ae42d044c 100644 |
959 |
+--- a/arch/x86/kvm/svm/nested.c |
960 |
++++ b/arch/x86/kvm/svm/nested.c |
961 |
+@@ -942,9 +942,9 @@ void svm_free_nested(struct vcpu_svm *svm) |
962 |
+ /* |
963 |
+ * Forcibly leave nested mode in order to be able to reset the VCPU later on. |
964 |
+ */ |
965 |
+-void svm_leave_nested(struct vcpu_svm *svm) |
966 |
++void svm_leave_nested(struct kvm_vcpu *vcpu) |
967 |
+ { |
968 |
+- struct kvm_vcpu *vcpu = &svm->vcpu; |
969 |
++ struct vcpu_svm *svm = to_svm(vcpu); |
970 |
+ |
971 |
+ if (is_guest_mode(vcpu)) { |
972 |
+ svm->nested.nested_run_pending = 0; |
973 |
+@@ -1313,7 +1313,7 @@ static int svm_set_nested_state(struct kvm_vcpu *vcpu, |
974 |
+ return -EINVAL; |
975 |
+ |
976 |
+ if (!(kvm_state->flags & KVM_STATE_NESTED_GUEST_MODE)) { |
977 |
+- svm_leave_nested(svm); |
978 |
++ svm_leave_nested(vcpu); |
979 |
+ svm_set_gif(svm, !!(kvm_state->flags & KVM_STATE_NESTED_GIF_SET)); |
980 |
+ return 0; |
981 |
+ } |
982 |
+@@ -1378,7 +1378,7 @@ static int svm_set_nested_state(struct kvm_vcpu *vcpu, |
983 |
+ */ |
984 |
+ |
985 |
+ if (is_guest_mode(vcpu)) |
986 |
+- svm_leave_nested(svm); |
987 |
++ svm_leave_nested(vcpu); |
988 |
+ else |
989 |
+ svm->nested.vmcb02.ptr->save = svm->vmcb01.ptr->save; |
990 |
+ |
991 |
+@@ -1432,6 +1432,7 @@ static bool svm_get_nested_state_pages(struct kvm_vcpu *vcpu) |
992 |
+ } |
993 |
+ |
994 |
+ struct kvm_x86_nested_ops svm_nested_ops = { |
995 |
++ .leave_nested = svm_leave_nested, |
996 |
+ .check_events = svm_check_nested_events, |
997 |
+ .triple_fault = nested_svm_triple_fault, |
998 |
+ .get_nested_state_pages = svm_get_nested_state_pages, |
999 |
+diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c |
1000 |
+index e64f16237b60b..980abc437cdaa 100644 |
1001 |
+--- a/arch/x86/kvm/svm/svm.c |
1002 |
++++ b/arch/x86/kvm/svm/svm.c |
1003 |
+@@ -281,7 +281,7 @@ int svm_set_efer(struct kvm_vcpu *vcpu, u64 efer) |
1004 |
+ |
1005 |
+ if ((old_efer & EFER_SVME) != (efer & EFER_SVME)) { |
1006 |
+ if (!(efer & EFER_SVME)) { |
1007 |
+- svm_leave_nested(svm); |
1008 |
++ svm_leave_nested(vcpu); |
1009 |
+ svm_set_gif(svm, true); |
1010 |
+ /* #GP intercept is still needed for vmware backdoor */ |
1011 |
+ if (!enable_vmware_backdoor) |
1012 |
+@@ -303,7 +303,11 @@ int svm_set_efer(struct kvm_vcpu *vcpu, u64 efer) |
1013 |
+ return ret; |
1014 |
+ } |
1015 |
+ |
1016 |
+- if (svm_gp_erratum_intercept) |
1017 |
++ /* |
1018 |
++ * Never intercept #GP for SEV guests, KVM can't |
1019 |
++ * decrypt guest memory to workaround the erratum. |
1020 |
++ */ |
1021 |
++ if (svm_gp_erratum_intercept && !sev_guest(vcpu->kvm)) |
1022 |
+ set_exception_intercept(svm, GP_VECTOR); |
1023 |
+ } |
1024 |
+ } |
1025 |
+@@ -1176,9 +1180,10 @@ static void init_vmcb(struct kvm_vcpu *vcpu) |
1026 |
+ * Guest access to VMware backdoor ports could legitimately |
1027 |
+ * trigger #GP because of TSS I/O permission bitmap. |
1028 |
+ * We intercept those #GP and allow access to them anyway |
1029 |
+- * as VMware does. |
1030 |
++ * as VMware does. Don't intercept #GP for SEV guests as KVM can't |
1031 |
++ * decrypt guest memory to decode the faulting instruction. |
1032 |
+ */ |
1033 |
+- if (enable_vmware_backdoor) |
1034 |
++ if (enable_vmware_backdoor && !sev_guest(vcpu->kvm)) |
1035 |
+ set_exception_intercept(svm, GP_VECTOR); |
1036 |
+ |
1037 |
+ svm_set_intercept(svm, INTERCEPT_INTR); |
1038 |
+@@ -2233,10 +2238,6 @@ static int gp_interception(struct kvm_vcpu *vcpu) |
1039 |
+ if (error_code) |
1040 |
+ goto reinject; |
1041 |
+ |
1042 |
+- /* All SVM instructions expect page aligned RAX */ |
1043 |
+- if (svm->vmcb->save.rax & ~PAGE_MASK) |
1044 |
+- goto reinject; |
1045 |
+- |
1046 |
+ /* Decode the instruction for usage later */ |
1047 |
+ if (x86_decode_emulated_instruction(vcpu, 0, NULL, 0) != EMULATION_OK) |
1048 |
+ goto reinject; |
1049 |
+@@ -2254,8 +2255,13 @@ static int gp_interception(struct kvm_vcpu *vcpu) |
1050 |
+ if (!is_guest_mode(vcpu)) |
1051 |
+ return kvm_emulate_instruction(vcpu, |
1052 |
+ EMULTYPE_VMWARE_GP | EMULTYPE_NO_DECODE); |
1053 |
+- } else |
1054 |
++ } else { |
1055 |
++ /* All SVM instructions expect page aligned RAX */ |
1056 |
++ if (svm->vmcb->save.rax & ~PAGE_MASK) |
1057 |
++ goto reinject; |
1058 |
++ |
1059 |
+ return emulate_svm_instr(vcpu, opcode); |
1060 |
++ } |
1061 |
+ |
1062 |
+ reinject: |
1063 |
+ kvm_queue_exception_e(vcpu, GP_VECTOR, error_code); |
1064 |
+@@ -4407,8 +4413,13 @@ static bool svm_can_emulate_instruction(struct kvm_vcpu *vcpu, void *insn, int i |
1065 |
+ bool smep, smap, is_user; |
1066 |
+ unsigned long cr4; |
1067 |
+ |
1068 |
++ /* Emulation is always possible when KVM has access to all guest state. */ |
1069 |
++ if (!sev_guest(vcpu->kvm)) |
1070 |
++ return true; |
1071 |
++ |
1072 |
+ /* |
1073 |
+- * When the guest is an SEV-ES guest, emulation is not possible. |
1074 |
++ * Emulation is impossible for SEV-ES guests as KVM doesn't have access |
1075 |
++ * to guest register state. |
1076 |
+ */ |
1077 |
+ if (sev_es_guest(vcpu->kvm)) |
1078 |
+ return false; |
1079 |
+@@ -4456,21 +4467,11 @@ static bool svm_can_emulate_instruction(struct kvm_vcpu *vcpu, void *insn, int i |
1080 |
+ if (likely(!insn || insn_len)) |
1081 |
+ return true; |
1082 |
+ |
1083 |
+- /* |
1084 |
+- * If RIP is invalid, go ahead with emulation which will cause an |
1085 |
+- * internal error exit. |
1086 |
+- */ |
1087 |
+- if (!kvm_vcpu_gfn_to_memslot(vcpu, kvm_rip_read(vcpu) >> PAGE_SHIFT)) |
1088 |
+- return true; |
1089 |
+- |
1090 |
+ cr4 = kvm_read_cr4(vcpu); |
1091 |
+ smep = cr4 & X86_CR4_SMEP; |
1092 |
+ smap = cr4 & X86_CR4_SMAP; |
1093 |
+ is_user = svm_get_cpl(vcpu) == 3; |
1094 |
+ if (smap && (!smep || is_user)) { |
1095 |
+- if (!sev_guest(vcpu->kvm)) |
1096 |
+- return true; |
1097 |
+- |
1098 |
+ pr_err_ratelimited("KVM: SEV Guest triggered AMD Erratum 1096\n"); |
1099 |
+ kvm_make_request(KVM_REQ_TRIPLE_FAULT, vcpu); |
1100 |
+ } |
1101 |
+diff --git a/arch/x86/kvm/svm/svm.h b/arch/x86/kvm/svm/svm.h |
1102 |
+index 5d30db599e10d..ff0855c03c917 100644 |
1103 |
+--- a/arch/x86/kvm/svm/svm.h |
1104 |
++++ b/arch/x86/kvm/svm/svm.h |
1105 |
+@@ -461,7 +461,7 @@ static inline bool nested_exit_on_nmi(struct vcpu_svm *svm) |
1106 |
+ |
1107 |
+ int enter_svm_guest_mode(struct kvm_vcpu *vcpu, |
1108 |
+ u64 vmcb_gpa, struct vmcb *vmcb12, bool from_vmrun); |
1109 |
+-void svm_leave_nested(struct vcpu_svm *svm); |
1110 |
++void svm_leave_nested(struct kvm_vcpu *vcpu); |
1111 |
+ void svm_free_nested(struct vcpu_svm *svm); |
1112 |
+ int svm_allocate_nested(struct vcpu_svm *svm); |
1113 |
+ int nested_svm_vmrun(struct kvm_vcpu *vcpu); |
1114 |
+diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c |
1115 |
+index e97a11abc1d85..a0193b11c381d 100644 |
1116 |
+--- a/arch/x86/kvm/vmx/nested.c |
1117 |
++++ b/arch/x86/kvm/vmx/nested.c |
1118 |
+@@ -6748,6 +6748,7 @@ __init int nested_vmx_hardware_setup(int (*exit_handlers[])(struct kvm_vcpu *)) |
1119 |
+ } |
1120 |
+ |
1121 |
+ struct kvm_x86_nested_ops vmx_nested_ops = { |
1122 |
++ .leave_nested = vmx_leave_nested, |
1123 |
+ .check_events = vmx_check_nested_events, |
1124 |
+ .hv_timer_pending = nested_vmx_preemption_timer_pending, |
1125 |
+ .triple_fault = nested_vmx_triple_fault, |
1126 |
+diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c |
1127 |
+index 2b80edffe02cd..33cb065181248 100644 |
1128 |
+--- a/arch/x86/kvm/x86.c |
1129 |
++++ b/arch/x86/kvm/x86.c |
1130 |
+@@ -3453,6 +3453,7 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info) |
1131 |
+ if (data & ~supported_xss) |
1132 |
+ return 1; |
1133 |
+ vcpu->arch.ia32_xss = data; |
1134 |
++ kvm_update_cpuid_runtime(vcpu); |
1135 |
+ break; |
1136 |
+ case MSR_SMI_COUNT: |
1137 |
+ if (!msr_info->host_initiated) |
1138 |
+@@ -4727,8 +4728,10 @@ static int kvm_vcpu_ioctl_x86_set_vcpu_events(struct kvm_vcpu *vcpu, |
1139 |
+ vcpu->arch.apic->sipi_vector = events->sipi_vector; |
1140 |
+ |
1141 |
+ if (events->flags & KVM_VCPUEVENT_VALID_SMM) { |
1142 |
+- if (!!(vcpu->arch.hflags & HF_SMM_MASK) != events->smi.smm) |
1143 |
++ if (!!(vcpu->arch.hflags & HF_SMM_MASK) != events->smi.smm) { |
1144 |
++ kvm_x86_ops.nested_ops->leave_nested(vcpu); |
1145 |
+ kvm_smm_changed(vcpu, events->smi.smm); |
1146 |
++ } |
1147 |
+ |
1148 |
+ vcpu->arch.smi_pending = events->smi.pending; |
1149 |
+ |
1150 |
+@@ -10987,7 +10990,8 @@ void kvm_vcpu_reset(struct kvm_vcpu *vcpu, bool init_event) |
1151 |
+ |
1152 |
+ vcpu->arch.msr_misc_features_enables = 0; |
1153 |
+ |
1154 |
+- vcpu->arch.xcr0 = XFEATURE_MASK_FP; |
1155 |
++ __kvm_set_xcr(vcpu, 0, XFEATURE_MASK_FP); |
1156 |
++ __kvm_set_msr(vcpu, MSR_IA32_XSS, 0, true); |
1157 |
+ } |
1158 |
+ |
1159 |
+ memset(vcpu->arch.regs, 0, sizeof(vcpu->arch.regs)); |
1160 |
+@@ -11006,8 +11010,6 @@ void kvm_vcpu_reset(struct kvm_vcpu *vcpu, bool init_event) |
1161 |
+ eax = 0x600; |
1162 |
+ kvm_rdx_write(vcpu, eax); |
1163 |
+ |
1164 |
+- vcpu->arch.ia32_xss = 0; |
1165 |
+- |
1166 |
+ static_call(kvm_x86_vcpu_reset)(vcpu, init_event); |
1167 |
+ |
1168 |
+ kvm_set_rflags(vcpu, X86_EFLAGS_FIXED); |
1169 |
+diff --git a/arch/x86/pci/fixup.c b/arch/x86/pci/fixup.c |
1170 |
+index 2edd86649468f..615a76d700194 100644 |
1171 |
+--- a/arch/x86/pci/fixup.c |
1172 |
++++ b/arch/x86/pci/fixup.c |
1173 |
+@@ -353,8 +353,8 @@ static void pci_fixup_video(struct pci_dev *pdev) |
1174 |
+ } |
1175 |
+ } |
1176 |
+ } |
1177 |
+-DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_ANY_ID, PCI_ANY_ID, |
1178 |
+- PCI_CLASS_DISPLAY_VGA, 8, pci_fixup_video); |
1179 |
++DECLARE_PCI_FIXUP_CLASS_HEADER(PCI_ANY_ID, PCI_ANY_ID, |
1180 |
++ PCI_CLASS_DISPLAY_VGA, 8, pci_fixup_video); |
1181 |
+ |
1182 |
+ |
1183 |
+ static const struct dmi_system_id msi_k8t_dmi_table[] = { |
1184 |
+diff --git a/block/bio.c b/block/bio.c |
1185 |
+index a6fb6a0b42955..25f1ed261100b 100644 |
1186 |
+--- a/block/bio.c |
1187 |
++++ b/block/bio.c |
1188 |
+@@ -567,7 +567,8 @@ void bio_truncate(struct bio *bio, unsigned new_size) |
1189 |
+ offset = new_size - done; |
1190 |
+ else |
1191 |
+ offset = 0; |
1192 |
+- zero_user(bv.bv_page, offset, bv.bv_len - offset); |
1193 |
++ zero_user(bv.bv_page, bv.bv_offset + offset, |
1194 |
++ bv.bv_len - offset); |
1195 |
+ truncated = true; |
1196 |
+ } |
1197 |
+ done += bv.bv_len; |
1198 |
+diff --git a/block/blk-core.c b/block/blk-core.c |
1199 |
+index c2d912d0c976c..d42a0f3ff7361 100644 |
1200 |
+--- a/block/blk-core.c |
1201 |
++++ b/block/blk-core.c |
1202 |
+@@ -1293,20 +1293,32 @@ void blk_account_io_start(struct request *rq) |
1203 |
+ } |
1204 |
+ |
1205 |
+ static unsigned long __part_start_io_acct(struct block_device *part, |
1206 |
+- unsigned int sectors, unsigned int op) |
1207 |
++ unsigned int sectors, unsigned int op, |
1208 |
++ unsigned long start_time) |
1209 |
+ { |
1210 |
+ const int sgrp = op_stat_group(op); |
1211 |
+- unsigned long now = READ_ONCE(jiffies); |
1212 |
+ |
1213 |
+ part_stat_lock(); |
1214 |
+- update_io_ticks(part, now, false); |
1215 |
++ update_io_ticks(part, start_time, false); |
1216 |
+ part_stat_inc(part, ios[sgrp]); |
1217 |
+ part_stat_add(part, sectors[sgrp], sectors); |
1218 |
+ part_stat_local_inc(part, in_flight[op_is_write(op)]); |
1219 |
+ part_stat_unlock(); |
1220 |
+ |
1221 |
+- return now; |
1222 |
++ return start_time; |
1223 |
++} |
1224 |
++ |
1225 |
++/** |
1226 |
++ * bio_start_io_acct_time - start I/O accounting for bio based drivers |
1227 |
++ * @bio: bio to start account for |
1228 |
++ * @start_time: start time that should be passed back to bio_end_io_acct(). |
1229 |
++ */ |
1230 |
++void bio_start_io_acct_time(struct bio *bio, unsigned long start_time) |
1231 |
++{ |
1232 |
++ __part_start_io_acct(bio->bi_bdev, bio_sectors(bio), |
1233 |
++ bio_op(bio), start_time); |
1234 |
+ } |
1235 |
++EXPORT_SYMBOL_GPL(bio_start_io_acct_time); |
1236 |
+ |
1237 |
+ /** |
1238 |
+ * bio_start_io_acct - start I/O accounting for bio based drivers |
1239 |
+@@ -1316,14 +1328,15 @@ static unsigned long __part_start_io_acct(struct block_device *part, |
1240 |
+ */ |
1241 |
+ unsigned long bio_start_io_acct(struct bio *bio) |
1242 |
+ { |
1243 |
+- return __part_start_io_acct(bio->bi_bdev, bio_sectors(bio), bio_op(bio)); |
1244 |
++ return __part_start_io_acct(bio->bi_bdev, bio_sectors(bio), |
1245 |
++ bio_op(bio), jiffies); |
1246 |
+ } |
1247 |
+ EXPORT_SYMBOL_GPL(bio_start_io_acct); |
1248 |
+ |
1249 |
+ unsigned long disk_start_io_acct(struct gendisk *disk, unsigned int sectors, |
1250 |
+ unsigned int op) |
1251 |
+ { |
1252 |
+- return __part_start_io_acct(disk->part0, sectors, op); |
1253 |
++ return __part_start_io_acct(disk->part0, sectors, op, jiffies); |
1254 |
+ } |
1255 |
+ EXPORT_SYMBOL(disk_start_io_acct); |
1256 |
+ |
1257 |
+diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c |
1258 |
+index 847f33ffc4aed..9fa86288b78a9 100644 |
1259 |
+--- a/drivers/firmware/efi/efi.c |
1260 |
++++ b/drivers/firmware/efi/efi.c |
1261 |
+@@ -719,6 +719,13 @@ void __init efi_systab_report_header(const efi_table_hdr_t *systab_hdr, |
1262 |
+ systab_hdr->revision >> 16, |
1263 |
+ systab_hdr->revision & 0xffff, |
1264 |
+ vendor); |
1265 |
++ |
1266 |
++ if (IS_ENABLED(CONFIG_X86_64) && |
1267 |
++ systab_hdr->revision > EFI_1_10_SYSTEM_TABLE_REVISION && |
1268 |
++ !strcmp(vendor, "Apple")) { |
1269 |
++ pr_info("Apple Mac detected, using EFI v1.10 runtime services only\n"); |
1270 |
++ efi.runtime_version = EFI_1_10_SYSTEM_TABLE_REVISION; |
1271 |
++ } |
1272 |
+ } |
1273 |
+ |
1274 |
+ static __initdata char memory_type_name[][13] = { |
1275 |
+diff --git a/drivers/firmware/efi/libstub/arm64-stub.c b/drivers/firmware/efi/libstub/arm64-stub.c |
1276 |
+index 2363fee9211c9..9cc556013d085 100644 |
1277 |
+--- a/drivers/firmware/efi/libstub/arm64-stub.c |
1278 |
++++ b/drivers/firmware/efi/libstub/arm64-stub.c |
1279 |
+@@ -119,9 +119,9 @@ efi_status_t handle_kernel_image(unsigned long *image_addr, |
1280 |
+ if (image->image_base != _text) |
1281 |
+ efi_err("FIRMWARE BUG: efi_loaded_image_t::image_base has bogus value\n"); |
1282 |
+ |
1283 |
+- if (!IS_ALIGNED((u64)_text, EFI_KIMG_ALIGN)) |
1284 |
+- efi_err("FIRMWARE BUG: kernel image not aligned on %ldk boundary\n", |
1285 |
+- EFI_KIMG_ALIGN >> 10); |
1286 |
++ if (!IS_ALIGNED((u64)_text, SEGMENT_ALIGN)) |
1287 |
++ efi_err("FIRMWARE BUG: kernel image not aligned on %dk boundary\n", |
1288 |
++ SEGMENT_ALIGN >> 10); |
1289 |
+ |
1290 |
+ kernel_size = _edata - _text; |
1291 |
+ kernel_memsize = kernel_size + (_end - _edata); |
1292 |
+diff --git a/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_resource.c b/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_resource.c |
1293 |
+index 89a237b5864c8..0294d0cc47595 100644 |
1294 |
+--- a/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_resource.c |
1295 |
++++ b/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_resource.c |
1296 |
+@@ -1879,7 +1879,6 @@ static noinline bool dcn30_internal_validate_bw( |
1297 |
+ dc->res_pool->funcs->update_soc_for_wm_a(dc, context); |
1298 |
+ pipe_cnt = dc->res_pool->funcs->populate_dml_pipes(dc, context, pipes, fast_validate); |
1299 |
+ |
1300 |
+- DC_FP_START(); |
1301 |
+ if (!pipe_cnt) { |
1302 |
+ out = true; |
1303 |
+ goto validate_out; |
1304 |
+@@ -2103,7 +2102,6 @@ validate_fail: |
1305 |
+ out = false; |
1306 |
+ |
1307 |
+ validate_out: |
1308 |
+- DC_FP_END(); |
1309 |
+ return out; |
1310 |
+ } |
1311 |
+ |
1312 |
+@@ -2304,7 +2302,9 @@ bool dcn30_validate_bandwidth(struct dc *dc, |
1313 |
+ |
1314 |
+ BW_VAL_TRACE_COUNT(); |
1315 |
+ |
1316 |
++ DC_FP_START(); |
1317 |
+ out = dcn30_internal_validate_bw(dc, context, pipes, &pipe_cnt, &vlevel, fast_validate); |
1318 |
++ DC_FP_END(); |
1319 |
+ |
1320 |
+ if (pipe_cnt == 0) |
1321 |
+ goto validate_out; |
1322 |
+diff --git a/drivers/gpu/drm/ast/ast_tables.h b/drivers/gpu/drm/ast/ast_tables.h |
1323 |
+index d9eb353a4bf09..dbe1cc620f6e6 100644 |
1324 |
+--- a/drivers/gpu/drm/ast/ast_tables.h |
1325 |
++++ b/drivers/gpu/drm/ast/ast_tables.h |
1326 |
+@@ -282,8 +282,6 @@ static const struct ast_vbios_enhtable res_1360x768[] = { |
1327 |
+ }; |
1328 |
+ |
1329 |
+ static const struct ast_vbios_enhtable res_1600x900[] = { |
1330 |
+- {1800, 1600, 24, 80, 1000, 900, 1, 3, VCLK108, /* 60Hz */ |
1331 |
+- (SyncPP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 60, 3, 0x3A }, |
1332 |
+ {1760, 1600, 48, 32, 926, 900, 3, 5, VCLK97_75, /* 60Hz CVT RB */ |
1333 |
+ (SyncNP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo | |
1334 |
+ AST2500PreCatchCRT), 60, 1, 0x3A }, |
1335 |
+diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c |
1336 |
+index ff1416cd609a5..a1e4c7905ebbe 100644 |
1337 |
+--- a/drivers/gpu/drm/drm_atomic.c |
1338 |
++++ b/drivers/gpu/drm/drm_atomic.c |
1339 |
+@@ -1310,8 +1310,10 @@ int drm_atomic_check_only(struct drm_atomic_state *state) |
1340 |
+ |
1341 |
+ DRM_DEBUG_ATOMIC("checking %p\n", state); |
1342 |
+ |
1343 |
+- for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) |
1344 |
+- requested_crtc |= drm_crtc_mask(crtc); |
1345 |
++ for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) { |
1346 |
++ if (new_crtc_state->enable) |
1347 |
++ requested_crtc |= drm_crtc_mask(crtc); |
1348 |
++ } |
1349 |
+ |
1350 |
+ for_each_oldnew_plane_in_state(state, plane, old_plane_state, new_plane_state, i) { |
1351 |
+ ret = drm_atomic_plane_check(old_plane_state, new_plane_state); |
1352 |
+@@ -1360,8 +1362,10 @@ int drm_atomic_check_only(struct drm_atomic_state *state) |
1353 |
+ } |
1354 |
+ } |
1355 |
+ |
1356 |
+- for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) |
1357 |
+- affected_crtc |= drm_crtc_mask(crtc); |
1358 |
++ for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) { |
1359 |
++ if (new_crtc_state->enable) |
1360 |
++ affected_crtc |= drm_crtc_mask(crtc); |
1361 |
++ } |
1362 |
+ |
1363 |
+ /* |
1364 |
+ * For commits that allow modesets drivers can add other CRTCs to the |
1365 |
+diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c b/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c |
1366 |
+index 225fa5879ebd9..90488ab8c6d8e 100644 |
1367 |
+--- a/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c |
1368 |
++++ b/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c |
1369 |
+@@ -469,8 +469,8 @@ int etnaviv_ioctl_gem_submit(struct drm_device *dev, void *data, |
1370 |
+ return -EINVAL; |
1371 |
+ } |
1372 |
+ |
1373 |
+- if (args->stream_size > SZ_64K || args->nr_relocs > SZ_64K || |
1374 |
+- args->nr_bos > SZ_64K || args->nr_pmrs > 128) { |
1375 |
++ if (args->stream_size > SZ_128K || args->nr_relocs > SZ_128K || |
1376 |
++ args->nr_bos > SZ_128K || args->nr_pmrs > 128) { |
1377 |
+ DRM_ERROR("submit arguments out of size limits\n"); |
1378 |
+ return -EINVAL; |
1379 |
+ } |
1380 |
+diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c |
1381 |
+index 723074aae5b63..b681c45520bbd 100644 |
1382 |
+--- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c |
1383 |
++++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c |
1384 |
+@@ -1557,6 +1557,8 @@ static int a6xx_pm_suspend(struct msm_gpu *gpu) |
1385 |
+ for (i = 0; i < gpu->nr_rings; i++) |
1386 |
+ a6xx_gpu->shadow[i] = 0; |
1387 |
+ |
1388 |
++ gpu->suspend_count++; |
1389 |
++ |
1390 |
+ return 0; |
1391 |
+ } |
1392 |
+ |
1393 |
+diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_dspp.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_dspp.c |
1394 |
+index a98e964c3b6fa..355894a3b48c3 100644 |
1395 |
+--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_dspp.c |
1396 |
++++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_dspp.c |
1397 |
+@@ -26,9 +26,16 @@ static void dpu_setup_dspp_pcc(struct dpu_hw_dspp *ctx, |
1398 |
+ struct dpu_hw_pcc_cfg *cfg) |
1399 |
+ { |
1400 |
+ |
1401 |
+- u32 base = ctx->cap->sblk->pcc.base; |
1402 |
++ u32 base; |
1403 |
+ |
1404 |
+- if (!ctx || !base) { |
1405 |
++ if (!ctx) { |
1406 |
++ DRM_ERROR("invalid ctx %pK\n", ctx); |
1407 |
++ return; |
1408 |
++ } |
1409 |
++ |
1410 |
++ base = ctx->cap->sblk->pcc.base; |
1411 |
++ |
1412 |
++ if (!base) { |
1413 |
+ DRM_ERROR("invalid ctx %pK pcc base 0x%x\n", ctx, base); |
1414 |
+ return; |
1415 |
+ } |
1416 |
+diff --git a/drivers/gpu/drm/msm/dsi/dsi.c b/drivers/gpu/drm/msm/dsi/dsi.c |
1417 |
+index fc280cc434943..122fadcf7cc1e 100644 |
1418 |
+--- a/drivers/gpu/drm/msm/dsi/dsi.c |
1419 |
++++ b/drivers/gpu/drm/msm/dsi/dsi.c |
1420 |
+@@ -40,7 +40,12 @@ static int dsi_get_phy(struct msm_dsi *msm_dsi) |
1421 |
+ |
1422 |
+ of_node_put(phy_node); |
1423 |
+ |
1424 |
+- if (!phy_pdev || !msm_dsi->phy) { |
1425 |
++ if (!phy_pdev) { |
1426 |
++ DRM_DEV_ERROR(&pdev->dev, "%s: phy driver is not ready\n", __func__); |
1427 |
++ return -EPROBE_DEFER; |
1428 |
++ } |
1429 |
++ if (!msm_dsi->phy) { |
1430 |
++ put_device(&phy_pdev->dev); |
1431 |
+ DRM_DEV_ERROR(&pdev->dev, "%s: phy driver is not ready\n", __func__); |
1432 |
+ return -EPROBE_DEFER; |
1433 |
+ } |
1434 |
+diff --git a/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c b/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c |
1435 |
+index 8c65ef6968caf..a878b8b079c64 100644 |
1436 |
+--- a/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c |
1437 |
++++ b/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c |
1438 |
+@@ -806,12 +806,14 @@ int msm_dsi_phy_enable(struct msm_dsi_phy *phy, |
1439 |
+ struct msm_dsi_phy_clk_request *clk_req, |
1440 |
+ struct msm_dsi_phy_shared_timings *shared_timings) |
1441 |
+ { |
1442 |
+- struct device *dev = &phy->pdev->dev; |
1443 |
++ struct device *dev; |
1444 |
+ int ret; |
1445 |
+ |
1446 |
+ if (!phy || !phy->cfg->ops.enable) |
1447 |
+ return -EINVAL; |
1448 |
+ |
1449 |
++ dev = &phy->pdev->dev; |
1450 |
++ |
1451 |
+ ret = dsi_phy_enable_resource(phy); |
1452 |
+ if (ret) { |
1453 |
+ DRM_DEV_ERROR(dev, "%s: resource enable failed, %d\n", |
1454 |
+diff --git a/drivers/gpu/drm/msm/hdmi/hdmi.c b/drivers/gpu/drm/msm/hdmi/hdmi.c |
1455 |
+index 737453b6e5966..94f948ef279d1 100644 |
1456 |
+--- a/drivers/gpu/drm/msm/hdmi/hdmi.c |
1457 |
++++ b/drivers/gpu/drm/msm/hdmi/hdmi.c |
1458 |
+@@ -97,10 +97,15 @@ static int msm_hdmi_get_phy(struct hdmi *hdmi) |
1459 |
+ |
1460 |
+ of_node_put(phy_node); |
1461 |
+ |
1462 |
+- if (!phy_pdev || !hdmi->phy) { |
1463 |
++ if (!phy_pdev) { |
1464 |
+ DRM_DEV_ERROR(&pdev->dev, "phy driver is not ready\n"); |
1465 |
+ return -EPROBE_DEFER; |
1466 |
+ } |
1467 |
++ if (!hdmi->phy) { |
1468 |
++ DRM_DEV_ERROR(&pdev->dev, "phy driver is not ready\n"); |
1469 |
++ put_device(&phy_pdev->dev); |
1470 |
++ return -EPROBE_DEFER; |
1471 |
++ } |
1472 |
+ |
1473 |
+ hdmi->phy_dev = get_device(&phy_pdev->dev); |
1474 |
+ |
1475 |
+diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c |
1476 |
+index 27f737a253c77..bbf999c665174 100644 |
1477 |
+--- a/drivers/gpu/drm/msm/msm_drv.c |
1478 |
++++ b/drivers/gpu/drm/msm/msm_drv.c |
1479 |
+@@ -437,7 +437,7 @@ static int msm_init_vram(struct drm_device *dev) |
1480 |
+ of_node_put(node); |
1481 |
+ if (ret) |
1482 |
+ return ret; |
1483 |
+- size = r.end - r.start; |
1484 |
++ size = r.end - r.start + 1; |
1485 |
+ DRM_INFO("using VRAM carveout: %lx@%pa\n", size, &r.start); |
1486 |
+ |
1487 |
+ /* if we have no IOMMU, then we need to use carveout allocator. |
1488 |
+diff --git a/drivers/hv/hv_balloon.c b/drivers/hv/hv_balloon.c |
1489 |
+index ca873a3b98dbe..f2d05bff42453 100644 |
1490 |
+--- a/drivers/hv/hv_balloon.c |
1491 |
++++ b/drivers/hv/hv_balloon.c |
1492 |
+@@ -1660,6 +1660,13 @@ static int balloon_connect_vsp(struct hv_device *dev) |
1493 |
+ unsigned long t; |
1494 |
+ int ret; |
1495 |
+ |
1496 |
++ /* |
1497 |
++ * max_pkt_size should be large enough for one vmbus packet header plus |
1498 |
++ * our receive buffer size. Hyper-V sends messages up to |
1499 |
++ * HV_HYP_PAGE_SIZE bytes long on balloon channel. |
1500 |
++ */ |
1501 |
++ dev->channel->max_pkt_size = HV_HYP_PAGE_SIZE * 2; |
1502 |
++ |
1503 |
+ ret = vmbus_open(dev->channel, dm_ring_size, dm_ring_size, NULL, 0, |
1504 |
+ balloon_onchannelcallback, dev); |
1505 |
+ if (ret) |
1506 |
+diff --git a/drivers/hwmon/adt7470.c b/drivers/hwmon/adt7470.c |
1507 |
+index d519aca4a9d64..fb6d14d213a18 100644 |
1508 |
+--- a/drivers/hwmon/adt7470.c |
1509 |
++++ b/drivers/hwmon/adt7470.c |
1510 |
+@@ -662,6 +662,9 @@ static int adt7470_fan_write(struct device *dev, u32 attr, int channel, long val |
1511 |
+ struct adt7470_data *data = dev_get_drvdata(dev); |
1512 |
+ int err; |
1513 |
+ |
1514 |
++ if (val <= 0) |
1515 |
++ return -EINVAL; |
1516 |
++ |
1517 |
+ val = FAN_RPM_TO_PERIOD(val); |
1518 |
+ val = clamp_val(val, 1, 65534); |
1519 |
+ |
1520 |
+diff --git a/drivers/hwmon/lm90.c b/drivers/hwmon/lm90.c |
1521 |
+index 74019dff2550e..1c9493c708132 100644 |
1522 |
+--- a/drivers/hwmon/lm90.c |
1523 |
++++ b/drivers/hwmon/lm90.c |
1524 |
+@@ -373,7 +373,7 @@ static const struct lm90_params lm90_params[] = { |
1525 |
+ .flags = LM90_HAVE_OFFSET | LM90_HAVE_REM_LIMIT_EXT |
1526 |
+ | LM90_HAVE_BROKEN_ALERT | LM90_HAVE_CRIT, |
1527 |
+ .alert_alarms = 0x7c, |
1528 |
+- .max_convrate = 8, |
1529 |
++ .max_convrate = 7, |
1530 |
+ }, |
1531 |
+ [lm86] = { |
1532 |
+ .flags = LM90_HAVE_OFFSET | LM90_HAVE_REM_LIMIT_EXT |
1533 |
+@@ -394,12 +394,13 @@ static const struct lm90_params lm90_params[] = { |
1534 |
+ .max_convrate = 9, |
1535 |
+ }, |
1536 |
+ [max6646] = { |
1537 |
+- .flags = LM90_HAVE_CRIT, |
1538 |
++ .flags = LM90_HAVE_CRIT | LM90_HAVE_BROKEN_ALERT, |
1539 |
+ .alert_alarms = 0x7c, |
1540 |
+ .max_convrate = 6, |
1541 |
+ .reg_local_ext = MAX6657_REG_R_LOCAL_TEMPL, |
1542 |
+ }, |
1543 |
+ [max6654] = { |
1544 |
++ .flags = LM90_HAVE_BROKEN_ALERT, |
1545 |
+ .alert_alarms = 0x7c, |
1546 |
+ .max_convrate = 7, |
1547 |
+ .reg_local_ext = MAX6657_REG_R_LOCAL_TEMPL, |
1548 |
+@@ -418,7 +419,7 @@ static const struct lm90_params lm90_params[] = { |
1549 |
+ }, |
1550 |
+ [max6680] = { |
1551 |
+ .flags = LM90_HAVE_OFFSET | LM90_HAVE_CRIT |
1552 |
+- | LM90_HAVE_CRIT_ALRM_SWP, |
1553 |
++ | LM90_HAVE_CRIT_ALRM_SWP | LM90_HAVE_BROKEN_ALERT, |
1554 |
+ .alert_alarms = 0x7c, |
1555 |
+ .max_convrate = 7, |
1556 |
+ }, |
1557 |
+@@ -848,7 +849,7 @@ static int lm90_update_device(struct device *dev) |
1558 |
+ * Re-enable ALERT# output if it was originally enabled and |
1559 |
+ * relevant alarms are all clear |
1560 |
+ */ |
1561 |
+- if (!(data->config_orig & 0x80) && |
1562 |
++ if ((client->irq || !(data->config_orig & 0x80)) && |
1563 |
+ !(data->alarms & data->alert_alarms)) { |
1564 |
+ if (data->config & 0x80) { |
1565 |
+ dev_dbg(&client->dev, "Re-enabling ALERT#\n"); |
1566 |
+@@ -1807,22 +1808,22 @@ static bool lm90_is_tripped(struct i2c_client *client, u16 *status) |
1567 |
+ |
1568 |
+ if (st & LM90_STATUS_LLOW) |
1569 |
+ hwmon_notify_event(data->hwmon_dev, hwmon_temp, |
1570 |
+- hwmon_temp_min, 0); |
1571 |
++ hwmon_temp_min_alarm, 0); |
1572 |
+ if (st & LM90_STATUS_RLOW) |
1573 |
+ hwmon_notify_event(data->hwmon_dev, hwmon_temp, |
1574 |
+- hwmon_temp_min, 1); |
1575 |
++ hwmon_temp_min_alarm, 1); |
1576 |
+ if (st2 & MAX6696_STATUS2_R2LOW) |
1577 |
+ hwmon_notify_event(data->hwmon_dev, hwmon_temp, |
1578 |
+- hwmon_temp_min, 2); |
1579 |
++ hwmon_temp_min_alarm, 2); |
1580 |
+ if (st & LM90_STATUS_LHIGH) |
1581 |
+ hwmon_notify_event(data->hwmon_dev, hwmon_temp, |
1582 |
+- hwmon_temp_max, 0); |
1583 |
++ hwmon_temp_max_alarm, 0); |
1584 |
+ if (st & LM90_STATUS_RHIGH) |
1585 |
+ hwmon_notify_event(data->hwmon_dev, hwmon_temp, |
1586 |
+- hwmon_temp_max, 1); |
1587 |
++ hwmon_temp_max_alarm, 1); |
1588 |
+ if (st2 & MAX6696_STATUS2_R2HIGH) |
1589 |
+ hwmon_notify_event(data->hwmon_dev, hwmon_temp, |
1590 |
+- hwmon_temp_max, 2); |
1591 |
++ hwmon_temp_max_alarm, 2); |
1592 |
+ |
1593 |
+ return true; |
1594 |
+ } |
1595 |
+diff --git a/drivers/irqchip/irq-realtek-rtl.c b/drivers/irqchip/irq-realtek-rtl.c |
1596 |
+index fd9f275592d29..568614edd88f4 100644 |
1597 |
+--- a/drivers/irqchip/irq-realtek-rtl.c |
1598 |
++++ b/drivers/irqchip/irq-realtek-rtl.c |
1599 |
+@@ -62,7 +62,7 @@ static struct irq_chip realtek_ictl_irq = { |
1600 |
+ |
1601 |
+ static int intc_map(struct irq_domain *d, unsigned int irq, irq_hw_number_t hw) |
1602 |
+ { |
1603 |
+- irq_set_chip_and_handler(hw, &realtek_ictl_irq, handle_level_irq); |
1604 |
++ irq_set_chip_and_handler(irq, &realtek_ictl_irq, handle_level_irq); |
1605 |
+ |
1606 |
+ return 0; |
1607 |
+ } |
1608 |
+@@ -95,7 +95,8 @@ out: |
1609 |
+ * SoC interrupts are cascaded to MIPS CPU interrupts according to the |
1610 |
+ * interrupt-map in the device tree. Each SoC interrupt gets 4 bits for |
1611 |
+ * the CPU interrupt in an Interrupt Routing Register. Max 32 SoC interrupts |
1612 |
+- * thus go into 4 IRRs. |
1613 |
++ * thus go into 4 IRRs. A routing value of '0' means the interrupt is left |
1614 |
++ * disconnected. Routing values {1..15} connect to output lines {0..14}. |
1615 |
+ */ |
1616 |
+ static int __init map_interrupts(struct device_node *node, struct irq_domain *domain) |
1617 |
+ { |
1618 |
+@@ -134,7 +135,7 @@ static int __init map_interrupts(struct device_node *node, struct irq_domain *do |
1619 |
+ of_node_put(cpu_ictl); |
1620 |
+ |
1621 |
+ cpu_int = be32_to_cpup(imap + 2); |
1622 |
+- if (cpu_int > 7) |
1623 |
++ if (cpu_int > 7 || cpu_int < 2) |
1624 |
+ return -EINVAL; |
1625 |
+ |
1626 |
+ if (!(mips_irqs_set & BIT(cpu_int))) { |
1627 |
+@@ -143,7 +144,8 @@ static int __init map_interrupts(struct device_node *node, struct irq_domain *do |
1628 |
+ mips_irqs_set |= BIT(cpu_int); |
1629 |
+ } |
1630 |
+ |
1631 |
+- regs[(soc_int * 4) / 32] |= cpu_int << (soc_int * 4) % 32; |
1632 |
++ /* Use routing values (1..6) for CPU interrupts (2..7) */ |
1633 |
++ regs[(soc_int * 4) / 32] |= (cpu_int - 1) << (soc_int * 4) % 32; |
1634 |
+ imap += 3; |
1635 |
+ } |
1636 |
+ |
1637 |
+diff --git a/drivers/md/dm.c b/drivers/md/dm.c |
1638 |
+index 671bb454f1649..b75ff6b2b9525 100644 |
1639 |
+--- a/drivers/md/dm.c |
1640 |
++++ b/drivers/md/dm.c |
1641 |
+@@ -489,7 +489,7 @@ static void start_io_acct(struct dm_io *io) |
1642 |
+ struct mapped_device *md = io->md; |
1643 |
+ struct bio *bio = io->orig_bio; |
1644 |
+ |
1645 |
+- io->start_time = bio_start_io_acct(bio); |
1646 |
++ bio_start_io_acct_time(bio, io->start_time); |
1647 |
+ if (unlikely(dm_stats_used(&md->stats))) |
1648 |
+ dm_stats_account_io(&md->stats, bio_data_dir(bio), |
1649 |
+ bio->bi_iter.bi_sector, bio_sectors(bio), |
1650 |
+@@ -535,7 +535,7 @@ static struct dm_io *alloc_io(struct mapped_device *md, struct bio *bio) |
1651 |
+ io->md = md; |
1652 |
+ spin_lock_init(&io->endio_lock); |
1653 |
+ |
1654 |
+- start_io_acct(io); |
1655 |
++ io->start_time = jiffies; |
1656 |
+ |
1657 |
+ return io; |
1658 |
+ } |
1659 |
+@@ -1514,9 +1514,6 @@ static void init_clone_info(struct clone_info *ci, struct mapped_device *md, |
1660 |
+ ci->sector = bio->bi_iter.bi_sector; |
1661 |
+ } |
1662 |
+ |
1663 |
+-#define __dm_part_stat_sub(part, field, subnd) \ |
1664 |
+- (part_stat_get(part, field) -= (subnd)) |
1665 |
+- |
1666 |
+ /* |
1667 |
+ * Entry point to split a bio into clones and submit them to the targets. |
1668 |
+ */ |
1669 |
+@@ -1553,23 +1550,12 @@ static blk_qc_t __split_and_process_bio(struct mapped_device *md, |
1670 |
+ GFP_NOIO, &md->queue->bio_split); |
1671 |
+ ci.io->orig_bio = b; |
1672 |
+ |
1673 |
+- /* |
1674 |
+- * Adjust IO stats for each split, otherwise upon queue |
1675 |
+- * reentry there will be redundant IO accounting. |
1676 |
+- * NOTE: this is a stop-gap fix, a proper fix involves |
1677 |
+- * significant refactoring of DM core's bio splitting |
1678 |
+- * (by eliminating DM's splitting and just using bio_split) |
1679 |
+- */ |
1680 |
+- part_stat_lock(); |
1681 |
+- __dm_part_stat_sub(dm_disk(md)->part0, |
1682 |
+- sectors[op_stat_group(bio_op(bio))], ci.sector_count); |
1683 |
+- part_stat_unlock(); |
1684 |
+- |
1685 |
+ bio_chain(b, bio); |
1686 |
+ trace_block_split(b, bio->bi_iter.bi_sector); |
1687 |
+ ret = submit_bio_noacct(bio); |
1688 |
+ } |
1689 |
+ } |
1690 |
++ start_io_acct(ci.io); |
1691 |
+ |
1692 |
+ /* drop the extra reference count */ |
1693 |
+ dm_io_dec_pending(ci.io, errno_to_blk_status(error)); |
1694 |
+diff --git a/drivers/mtd/nand/raw/mpc5121_nfc.c b/drivers/mtd/nand/raw/mpc5121_nfc.c |
1695 |
+index cb293c50acb87..5b9271b9c3265 100644 |
1696 |
+--- a/drivers/mtd/nand/raw/mpc5121_nfc.c |
1697 |
++++ b/drivers/mtd/nand/raw/mpc5121_nfc.c |
1698 |
+@@ -291,7 +291,6 @@ static int ads5121_chipselect_init(struct mtd_info *mtd) |
1699 |
+ /* Control chips select signal on ADS5121 board */ |
1700 |
+ static void ads5121_select_chip(struct nand_chip *nand, int chip) |
1701 |
+ { |
1702 |
+- struct mtd_info *mtd = nand_to_mtd(nand); |
1703 |
+ struct mpc5121_nfc_prv *prv = nand_get_controller_data(nand); |
1704 |
+ u8 v; |
1705 |
+ |
1706 |
+diff --git a/drivers/net/can/m_can/m_can.c b/drivers/net/can/m_can/m_can.c |
1707 |
+index c2a8421e7845c..25713d6232151 100644 |
1708 |
+--- a/drivers/net/can/m_can/m_can.c |
1709 |
++++ b/drivers/net/can/m_can/m_can.c |
1710 |
+@@ -336,6 +336,9 @@ m_can_fifo_read(struct m_can_classdev *cdev, |
1711 |
+ u32 addr_offset = cdev->mcfg[MRAM_RXF0].off + fgi * RXF0_ELEMENT_SIZE + |
1712 |
+ offset; |
1713 |
+ |
1714 |
++ if (val_count == 0) |
1715 |
++ return 0; |
1716 |
++ |
1717 |
+ return cdev->ops->read_fifo(cdev, addr_offset, val, val_count); |
1718 |
+ } |
1719 |
+ |
1720 |
+@@ -346,6 +349,9 @@ m_can_fifo_write(struct m_can_classdev *cdev, |
1721 |
+ u32 addr_offset = cdev->mcfg[MRAM_TXB].off + fpi * TXB_ELEMENT_SIZE + |
1722 |
+ offset; |
1723 |
+ |
1724 |
++ if (val_count == 0) |
1725 |
++ return 0; |
1726 |
++ |
1727 |
+ return cdev->ops->write_fifo(cdev, addr_offset, val, val_count); |
1728 |
+ } |
1729 |
+ |
1730 |
+diff --git a/drivers/net/can/m_can/tcan4x5x-regmap.c b/drivers/net/can/m_can/tcan4x5x-regmap.c |
1731 |
+index ca80dbaf7a3f5..26e212b8ca7a6 100644 |
1732 |
+--- a/drivers/net/can/m_can/tcan4x5x-regmap.c |
1733 |
++++ b/drivers/net/can/m_can/tcan4x5x-regmap.c |
1734 |
+@@ -12,7 +12,7 @@ |
1735 |
+ #define TCAN4X5X_SPI_INSTRUCTION_WRITE (0x61 << 24) |
1736 |
+ #define TCAN4X5X_SPI_INSTRUCTION_READ (0x41 << 24) |
1737 |
+ |
1738 |
+-#define TCAN4X5X_MAX_REGISTER 0x8ffc |
1739 |
++#define TCAN4X5X_MAX_REGISTER 0x87fc |
1740 |
+ |
1741 |
+ static int tcan4x5x_regmap_gather_write(void *context, |
1742 |
+ const void *reg, size_t reg_len, |
1743 |
+diff --git a/drivers/net/ethernet/google/gve/gve.h b/drivers/net/ethernet/google/gve/gve.h |
1744 |
+index c1d4042671f9f..b1273dce4795b 100644 |
1745 |
+--- a/drivers/net/ethernet/google/gve/gve.h |
1746 |
++++ b/drivers/net/ethernet/google/gve/gve.h |
1747 |
+@@ -815,7 +815,7 @@ static inline bool gve_is_gqi(struct gve_priv *priv) |
1748 |
+ /* buffers */ |
1749 |
+ int gve_alloc_page(struct gve_priv *priv, struct device *dev, |
1750 |
+ struct page **page, dma_addr_t *dma, |
1751 |
+- enum dma_data_direction); |
1752 |
++ enum dma_data_direction, gfp_t gfp_flags); |
1753 |
+ void gve_free_page(struct device *dev, struct page *page, dma_addr_t dma, |
1754 |
+ enum dma_data_direction); |
1755 |
+ /* tx handling */ |
1756 |
+diff --git a/drivers/net/ethernet/google/gve/gve_main.c b/drivers/net/ethernet/google/gve/gve_main.c |
1757 |
+index 959352fceead7..68552848d3888 100644 |
1758 |
+--- a/drivers/net/ethernet/google/gve/gve_main.c |
1759 |
++++ b/drivers/net/ethernet/google/gve/gve_main.c |
1760 |
+@@ -746,9 +746,9 @@ static void gve_free_rings(struct gve_priv *priv) |
1761 |
+ |
1762 |
+ int gve_alloc_page(struct gve_priv *priv, struct device *dev, |
1763 |
+ struct page **page, dma_addr_t *dma, |
1764 |
+- enum dma_data_direction dir) |
1765 |
++ enum dma_data_direction dir, gfp_t gfp_flags) |
1766 |
+ { |
1767 |
+- *page = alloc_page(GFP_KERNEL); |
1768 |
++ *page = alloc_page(gfp_flags); |
1769 |
+ if (!*page) { |
1770 |
+ priv->page_alloc_fail++; |
1771 |
+ return -ENOMEM; |
1772 |
+@@ -792,7 +792,7 @@ static int gve_alloc_queue_page_list(struct gve_priv *priv, u32 id, |
1773 |
+ for (i = 0; i < pages; i++) { |
1774 |
+ err = gve_alloc_page(priv, &priv->pdev->dev, &qpl->pages[i], |
1775 |
+ &qpl->page_buses[i], |
1776 |
+- gve_qpl_dma_dir(priv, id)); |
1777 |
++ gve_qpl_dma_dir(priv, id), GFP_KERNEL); |
1778 |
+ /* caller handles clean up */ |
1779 |
+ if (err) |
1780 |
+ return -ENOMEM; |
1781 |
+diff --git a/drivers/net/ethernet/google/gve/gve_rx.c b/drivers/net/ethernet/google/gve/gve_rx.c |
1782 |
+index 16169f291ad9f..629d8ed08fc61 100644 |
1783 |
+--- a/drivers/net/ethernet/google/gve/gve_rx.c |
1784 |
++++ b/drivers/net/ethernet/google/gve/gve_rx.c |
1785 |
+@@ -79,7 +79,8 @@ static int gve_rx_alloc_buffer(struct gve_priv *priv, struct device *dev, |
1786 |
+ dma_addr_t dma; |
1787 |
+ int err; |
1788 |
+ |
1789 |
+- err = gve_alloc_page(priv, dev, &page, &dma, DMA_FROM_DEVICE); |
1790 |
++ err = gve_alloc_page(priv, dev, &page, &dma, DMA_FROM_DEVICE, |
1791 |
++ GFP_ATOMIC); |
1792 |
+ if (err) |
1793 |
+ return err; |
1794 |
+ |
1795 |
+diff --git a/drivers/net/ethernet/google/gve/gve_rx_dqo.c b/drivers/net/ethernet/google/gve/gve_rx_dqo.c |
1796 |
+index 8500621b2cd41..7b18b4fd9e548 100644 |
1797 |
+--- a/drivers/net/ethernet/google/gve/gve_rx_dqo.c |
1798 |
++++ b/drivers/net/ethernet/google/gve/gve_rx_dqo.c |
1799 |
+@@ -157,7 +157,7 @@ static int gve_alloc_page_dqo(struct gve_priv *priv, |
1800 |
+ int err; |
1801 |
+ |
1802 |
+ err = gve_alloc_page(priv, &priv->pdev->dev, &buf_state->page_info.page, |
1803 |
+- &buf_state->addr, DMA_FROM_DEVICE); |
1804 |
++ &buf_state->addr, DMA_FROM_DEVICE, GFP_KERNEL); |
1805 |
+ if (err) |
1806 |
+ return err; |
1807 |
+ |
1808 |
+diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c |
1809 |
+index fee7d9e79f8c3..417a08d600b83 100644 |
1810 |
+--- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c |
1811 |
++++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c |
1812 |
+@@ -2496,8 +2496,7 @@ static irqreturn_t hclgevf_misc_irq_handle(int irq, void *data) |
1813 |
+ break; |
1814 |
+ } |
1815 |
+ |
1816 |
+- if (event_cause != HCLGEVF_VECTOR0_EVENT_OTHER) |
1817 |
+- hclgevf_enable_vector(&hdev->misc_vector, true); |
1818 |
++ hclgevf_enable_vector(&hdev->misc_vector, true); |
1819 |
+ |
1820 |
+ return IRQ_HANDLED; |
1821 |
+ } |
1822 |
+diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c |
1823 |
+index 352ffe982d849..5c7371dc83848 100644 |
1824 |
+--- a/drivers/net/ethernet/ibm/ibmvnic.c |
1825 |
++++ b/drivers/net/ethernet/ibm/ibmvnic.c |
1826 |
+@@ -2424,6 +2424,7 @@ static void __ibmvnic_reset(struct work_struct *work) |
1827 |
+ struct ibmvnic_rwi *rwi; |
1828 |
+ unsigned long flags; |
1829 |
+ u32 reset_state; |
1830 |
++ int num_fails = 0; |
1831 |
+ int rc = 0; |
1832 |
+ |
1833 |
+ adapter = container_of(work, struct ibmvnic_adapter, ibmvnic_reset); |
1834 |
+@@ -2477,11 +2478,23 @@ static void __ibmvnic_reset(struct work_struct *work) |
1835 |
+ rc = do_hard_reset(adapter, rwi, reset_state); |
1836 |
+ rtnl_unlock(); |
1837 |
+ } |
1838 |
+- if (rc) { |
1839 |
+- /* give backing device time to settle down */ |
1840 |
++ if (rc) |
1841 |
++ num_fails++; |
1842 |
++ else |
1843 |
++ num_fails = 0; |
1844 |
++ |
1845 |
++ /* If auto-priority-failover is enabled we can get |
1846 |
++ * back to back failovers during resets, resulting |
1847 |
++ * in at least two failed resets (from high-priority |
1848 |
++ * backing device to low-priority one and then back) |
1849 |
++ * If resets continue to fail beyond that, give the |
1850 |
++ * adapter some time to settle down before retrying. |
1851 |
++ */ |
1852 |
++ if (num_fails >= 3) { |
1853 |
+ netdev_dbg(adapter->netdev, |
1854 |
+- "[S:%s] Hard reset failed, waiting 60 secs\n", |
1855 |
+- adapter_state_to_string(adapter->state)); |
1856 |
++ "[S:%s] Hard reset failed %d times, waiting 60 secs\n", |
1857 |
++ adapter_state_to_string(adapter->state), |
1858 |
++ num_fails); |
1859 |
+ set_current_state(TASK_UNINTERRUPTIBLE); |
1860 |
+ schedule_timeout(60 * HZ); |
1861 |
+ } |
1862 |
+@@ -3662,11 +3675,25 @@ static void send_request_cap(struct ibmvnic_adapter *adapter, int retry) |
1863 |
+ struct device *dev = &adapter->vdev->dev; |
1864 |
+ union ibmvnic_crq crq; |
1865 |
+ int max_entries; |
1866 |
++ int cap_reqs; |
1867 |
++ |
1868 |
++ /* We send out 6 or 7 REQUEST_CAPABILITY CRQs below (depending on |
1869 |
++ * the PROMISC flag). Initialize this count upfront. When the tasklet |
1870 |
++ * receives a response to all of these, it will send the next protocol |
1871 |
++ * message (QUERY_IP_OFFLOAD). |
1872 |
++ */ |
1873 |
++ if (!(adapter->netdev->flags & IFF_PROMISC) || |
1874 |
++ adapter->promisc_supported) |
1875 |
++ cap_reqs = 7; |
1876 |
++ else |
1877 |
++ cap_reqs = 6; |
1878 |
+ |
1879 |
+ if (!retry) { |
1880 |
+ /* Sub-CRQ entries are 32 byte long */ |
1881 |
+ int entries_page = 4 * PAGE_SIZE / (sizeof(u64) * 4); |
1882 |
+ |
1883 |
++ atomic_set(&adapter->running_cap_crqs, cap_reqs); |
1884 |
++ |
1885 |
+ if (adapter->min_tx_entries_per_subcrq > entries_page || |
1886 |
+ adapter->min_rx_add_entries_per_subcrq > entries_page) { |
1887 |
+ dev_err(dev, "Fatal, invalid entries per sub-crq\n"); |
1888 |
+@@ -3727,44 +3754,45 @@ static void send_request_cap(struct ibmvnic_adapter *adapter, int retry) |
1889 |
+ adapter->opt_rx_comp_queues; |
1890 |
+ |
1891 |
+ adapter->req_rx_add_queues = adapter->max_rx_add_queues; |
1892 |
++ } else { |
1893 |
++ atomic_add(cap_reqs, &adapter->running_cap_crqs); |
1894 |
+ } |
1895 |
+- |
1896 |
+ memset(&crq, 0, sizeof(crq)); |
1897 |
+ crq.request_capability.first = IBMVNIC_CRQ_CMD; |
1898 |
+ crq.request_capability.cmd = REQUEST_CAPABILITY; |
1899 |
+ |
1900 |
+ crq.request_capability.capability = cpu_to_be16(REQ_TX_QUEUES); |
1901 |
+ crq.request_capability.number = cpu_to_be64(adapter->req_tx_queues); |
1902 |
+- atomic_inc(&adapter->running_cap_crqs); |
1903 |
++ cap_reqs--; |
1904 |
+ ibmvnic_send_crq(adapter, &crq); |
1905 |
+ |
1906 |
+ crq.request_capability.capability = cpu_to_be16(REQ_RX_QUEUES); |
1907 |
+ crq.request_capability.number = cpu_to_be64(adapter->req_rx_queues); |
1908 |
+- atomic_inc(&adapter->running_cap_crqs); |
1909 |
++ cap_reqs--; |
1910 |
+ ibmvnic_send_crq(adapter, &crq); |
1911 |
+ |
1912 |
+ crq.request_capability.capability = cpu_to_be16(REQ_RX_ADD_QUEUES); |
1913 |
+ crq.request_capability.number = cpu_to_be64(adapter->req_rx_add_queues); |
1914 |
+- atomic_inc(&adapter->running_cap_crqs); |
1915 |
++ cap_reqs--; |
1916 |
+ ibmvnic_send_crq(adapter, &crq); |
1917 |
+ |
1918 |
+ crq.request_capability.capability = |
1919 |
+ cpu_to_be16(REQ_TX_ENTRIES_PER_SUBCRQ); |
1920 |
+ crq.request_capability.number = |
1921 |
+ cpu_to_be64(adapter->req_tx_entries_per_subcrq); |
1922 |
+- atomic_inc(&adapter->running_cap_crqs); |
1923 |
++ cap_reqs--; |
1924 |
+ ibmvnic_send_crq(adapter, &crq); |
1925 |
+ |
1926 |
+ crq.request_capability.capability = |
1927 |
+ cpu_to_be16(REQ_RX_ADD_ENTRIES_PER_SUBCRQ); |
1928 |
+ crq.request_capability.number = |
1929 |
+ cpu_to_be64(adapter->req_rx_add_entries_per_subcrq); |
1930 |
+- atomic_inc(&adapter->running_cap_crqs); |
1931 |
++ cap_reqs--; |
1932 |
+ ibmvnic_send_crq(adapter, &crq); |
1933 |
+ |
1934 |
+ crq.request_capability.capability = cpu_to_be16(REQ_MTU); |
1935 |
+ crq.request_capability.number = cpu_to_be64(adapter->req_mtu); |
1936 |
+- atomic_inc(&adapter->running_cap_crqs); |
1937 |
++ cap_reqs--; |
1938 |
+ ibmvnic_send_crq(adapter, &crq); |
1939 |
+ |
1940 |
+ if (adapter->netdev->flags & IFF_PROMISC) { |
1941 |
+@@ -3772,16 +3800,21 @@ static void send_request_cap(struct ibmvnic_adapter *adapter, int retry) |
1942 |
+ crq.request_capability.capability = |
1943 |
+ cpu_to_be16(PROMISC_REQUESTED); |
1944 |
+ crq.request_capability.number = cpu_to_be64(1); |
1945 |
+- atomic_inc(&adapter->running_cap_crqs); |
1946 |
++ cap_reqs--; |
1947 |
+ ibmvnic_send_crq(adapter, &crq); |
1948 |
+ } |
1949 |
+ } else { |
1950 |
+ crq.request_capability.capability = |
1951 |
+ cpu_to_be16(PROMISC_REQUESTED); |
1952 |
+ crq.request_capability.number = cpu_to_be64(0); |
1953 |
+- atomic_inc(&adapter->running_cap_crqs); |
1954 |
++ cap_reqs--; |
1955 |
+ ibmvnic_send_crq(adapter, &crq); |
1956 |
+ } |
1957 |
++ |
1958 |
++ /* Keep at end to catch any discrepancy between expected and actual |
1959 |
++ * CRQs sent. |
1960 |
++ */ |
1961 |
++ WARN_ON(cap_reqs != 0); |
1962 |
+ } |
1963 |
+ |
1964 |
+ static int pending_scrq(struct ibmvnic_adapter *adapter, |
1965 |
+@@ -4175,118 +4208,132 @@ static void send_query_map(struct ibmvnic_adapter *adapter) |
1966 |
+ static void send_query_cap(struct ibmvnic_adapter *adapter) |
1967 |
+ { |
1968 |
+ union ibmvnic_crq crq; |
1969 |
++ int cap_reqs; |
1970 |
++ |
1971 |
++ /* We send out 25 QUERY_CAPABILITY CRQs below. Initialize this count |
1972 |
++ * upfront. When the tasklet receives a response to all of these, it |
1973 |
++ * can send out the next protocol messaage (REQUEST_CAPABILITY). |
1974 |
++ */ |
1975 |
++ cap_reqs = 25; |
1976 |
++ |
1977 |
++ atomic_set(&adapter->running_cap_crqs, cap_reqs); |
1978 |
+ |
1979 |
+- atomic_set(&adapter->running_cap_crqs, 0); |
1980 |
+ memset(&crq, 0, sizeof(crq)); |
1981 |
+ crq.query_capability.first = IBMVNIC_CRQ_CMD; |
1982 |
+ crq.query_capability.cmd = QUERY_CAPABILITY; |
1983 |
+ |
1984 |
+ crq.query_capability.capability = cpu_to_be16(MIN_TX_QUEUES); |
1985 |
+- atomic_inc(&adapter->running_cap_crqs); |
1986 |
+ ibmvnic_send_crq(adapter, &crq); |
1987 |
++ cap_reqs--; |
1988 |
+ |
1989 |
+ crq.query_capability.capability = cpu_to_be16(MIN_RX_QUEUES); |
1990 |
+- atomic_inc(&adapter->running_cap_crqs); |
1991 |
+ ibmvnic_send_crq(adapter, &crq); |
1992 |
++ cap_reqs--; |
1993 |
+ |
1994 |
+ crq.query_capability.capability = cpu_to_be16(MIN_RX_ADD_QUEUES); |
1995 |
+- atomic_inc(&adapter->running_cap_crqs); |
1996 |
+ ibmvnic_send_crq(adapter, &crq); |
1997 |
++ cap_reqs--; |
1998 |
+ |
1999 |
+ crq.query_capability.capability = cpu_to_be16(MAX_TX_QUEUES); |
2000 |
+- atomic_inc(&adapter->running_cap_crqs); |
2001 |
+ ibmvnic_send_crq(adapter, &crq); |
2002 |
++ cap_reqs--; |
2003 |
+ |
2004 |
+ crq.query_capability.capability = cpu_to_be16(MAX_RX_QUEUES); |
2005 |
+- atomic_inc(&adapter->running_cap_crqs); |
2006 |
+ ibmvnic_send_crq(adapter, &crq); |
2007 |
++ cap_reqs--; |
2008 |
+ |
2009 |
+ crq.query_capability.capability = cpu_to_be16(MAX_RX_ADD_QUEUES); |
2010 |
+- atomic_inc(&adapter->running_cap_crqs); |
2011 |
+ ibmvnic_send_crq(adapter, &crq); |
2012 |
++ cap_reqs--; |
2013 |
+ |
2014 |
+ crq.query_capability.capability = |
2015 |
+ cpu_to_be16(MIN_TX_ENTRIES_PER_SUBCRQ); |
2016 |
+- atomic_inc(&adapter->running_cap_crqs); |
2017 |
+ ibmvnic_send_crq(adapter, &crq); |
2018 |
++ cap_reqs--; |
2019 |
+ |
2020 |
+ crq.query_capability.capability = |
2021 |
+ cpu_to_be16(MIN_RX_ADD_ENTRIES_PER_SUBCRQ); |
2022 |
+- atomic_inc(&adapter->running_cap_crqs); |
2023 |
+ ibmvnic_send_crq(adapter, &crq); |
2024 |
++ cap_reqs--; |
2025 |
+ |
2026 |
+ crq.query_capability.capability = |
2027 |
+ cpu_to_be16(MAX_TX_ENTRIES_PER_SUBCRQ); |
2028 |
+- atomic_inc(&adapter->running_cap_crqs); |
2029 |
+ ibmvnic_send_crq(adapter, &crq); |
2030 |
++ cap_reqs--; |
2031 |
+ |
2032 |
+ crq.query_capability.capability = |
2033 |
+ cpu_to_be16(MAX_RX_ADD_ENTRIES_PER_SUBCRQ); |
2034 |
+- atomic_inc(&adapter->running_cap_crqs); |
2035 |
+ ibmvnic_send_crq(adapter, &crq); |
2036 |
++ cap_reqs--; |
2037 |
+ |
2038 |
+ crq.query_capability.capability = cpu_to_be16(TCP_IP_OFFLOAD); |
2039 |
+- atomic_inc(&adapter->running_cap_crqs); |
2040 |
+ ibmvnic_send_crq(adapter, &crq); |
2041 |
++ cap_reqs--; |
2042 |
+ |
2043 |
+ crq.query_capability.capability = cpu_to_be16(PROMISC_SUPPORTED); |
2044 |
+- atomic_inc(&adapter->running_cap_crqs); |
2045 |
+ ibmvnic_send_crq(adapter, &crq); |
2046 |
++ cap_reqs--; |
2047 |
+ |
2048 |
+ crq.query_capability.capability = cpu_to_be16(MIN_MTU); |
2049 |
+- atomic_inc(&adapter->running_cap_crqs); |
2050 |
+ ibmvnic_send_crq(adapter, &crq); |
2051 |
++ cap_reqs--; |
2052 |
+ |
2053 |
+ crq.query_capability.capability = cpu_to_be16(MAX_MTU); |
2054 |
+- atomic_inc(&adapter->running_cap_crqs); |
2055 |
+ ibmvnic_send_crq(adapter, &crq); |
2056 |
++ cap_reqs--; |
2057 |
+ |
2058 |
+ crq.query_capability.capability = cpu_to_be16(MAX_MULTICAST_FILTERS); |
2059 |
+- atomic_inc(&adapter->running_cap_crqs); |
2060 |
+ ibmvnic_send_crq(adapter, &crq); |
2061 |
++ cap_reqs--; |
2062 |
+ |
2063 |
+ crq.query_capability.capability = cpu_to_be16(VLAN_HEADER_INSERTION); |
2064 |
+- atomic_inc(&adapter->running_cap_crqs); |
2065 |
+ ibmvnic_send_crq(adapter, &crq); |
2066 |
++ cap_reqs--; |
2067 |
+ |
2068 |
+ crq.query_capability.capability = cpu_to_be16(RX_VLAN_HEADER_INSERTION); |
2069 |
+- atomic_inc(&adapter->running_cap_crqs); |
2070 |
+ ibmvnic_send_crq(adapter, &crq); |
2071 |
++ cap_reqs--; |
2072 |
+ |
2073 |
+ crq.query_capability.capability = cpu_to_be16(MAX_TX_SG_ENTRIES); |
2074 |
+- atomic_inc(&adapter->running_cap_crqs); |
2075 |
+ ibmvnic_send_crq(adapter, &crq); |
2076 |
++ cap_reqs--; |
2077 |
+ |
2078 |
+ crq.query_capability.capability = cpu_to_be16(RX_SG_SUPPORTED); |
2079 |
+- atomic_inc(&adapter->running_cap_crqs); |
2080 |
+ ibmvnic_send_crq(adapter, &crq); |
2081 |
++ cap_reqs--; |
2082 |
+ |
2083 |
+ crq.query_capability.capability = cpu_to_be16(OPT_TX_COMP_SUB_QUEUES); |
2084 |
+- atomic_inc(&adapter->running_cap_crqs); |
2085 |
+ ibmvnic_send_crq(adapter, &crq); |
2086 |
++ cap_reqs--; |
2087 |
+ |
2088 |
+ crq.query_capability.capability = cpu_to_be16(OPT_RX_COMP_QUEUES); |
2089 |
+- atomic_inc(&adapter->running_cap_crqs); |
2090 |
+ ibmvnic_send_crq(adapter, &crq); |
2091 |
++ cap_reqs--; |
2092 |
+ |
2093 |
+ crq.query_capability.capability = |
2094 |
+ cpu_to_be16(OPT_RX_BUFADD_Q_PER_RX_COMP_Q); |
2095 |
+- atomic_inc(&adapter->running_cap_crqs); |
2096 |
+ ibmvnic_send_crq(adapter, &crq); |
2097 |
++ cap_reqs--; |
2098 |
+ |
2099 |
+ crq.query_capability.capability = |
2100 |
+ cpu_to_be16(OPT_TX_ENTRIES_PER_SUBCRQ); |
2101 |
+- atomic_inc(&adapter->running_cap_crqs); |
2102 |
+ ibmvnic_send_crq(adapter, &crq); |
2103 |
++ cap_reqs--; |
2104 |
+ |
2105 |
+ crq.query_capability.capability = |
2106 |
+ cpu_to_be16(OPT_RXBA_ENTRIES_PER_SUBCRQ); |
2107 |
+- atomic_inc(&adapter->running_cap_crqs); |
2108 |
+ ibmvnic_send_crq(adapter, &crq); |
2109 |
++ cap_reqs--; |
2110 |
+ |
2111 |
+ crq.query_capability.capability = cpu_to_be16(TX_RX_DESC_REQ); |
2112 |
+- atomic_inc(&adapter->running_cap_crqs); |
2113 |
++ |
2114 |
+ ibmvnic_send_crq(adapter, &crq); |
2115 |
++ cap_reqs--; |
2116 |
++ |
2117 |
++ /* Keep at end to catch any discrepancy between expected and actual |
2118 |
++ * CRQs sent. |
2119 |
++ */ |
2120 |
++ WARN_ON(cap_reqs != 0); |
2121 |
+ } |
2122 |
+ |
2123 |
+ static void send_query_ip_offload(struct ibmvnic_adapter *adapter) |
2124 |
+@@ -4591,6 +4638,8 @@ static void handle_request_cap_rsp(union ibmvnic_crq *crq, |
2125 |
+ char *name; |
2126 |
+ |
2127 |
+ atomic_dec(&adapter->running_cap_crqs); |
2128 |
++ netdev_dbg(adapter->netdev, "Outstanding request-caps: %d\n", |
2129 |
++ atomic_read(&adapter->running_cap_crqs)); |
2130 |
+ switch (be16_to_cpu(crq->request_capability_rsp.capability)) { |
2131 |
+ case REQ_TX_QUEUES: |
2132 |
+ req_value = &adapter->req_tx_queues; |
2133 |
+@@ -5268,12 +5317,6 @@ static void ibmvnic_tasklet(struct tasklet_struct *t) |
2134 |
+ ibmvnic_handle_crq(crq, adapter); |
2135 |
+ crq->generic.first = 0; |
2136 |
+ } |
2137 |
+- |
2138 |
+- /* remain in tasklet until all |
2139 |
+- * capabilities responses are received |
2140 |
+- */ |
2141 |
+- if (!adapter->wait_capability) |
2142 |
+- done = true; |
2143 |
+ } |
2144 |
+ /* if capabilities CRQ's were sent in this tasklet, the following |
2145 |
+ * tasklet must wait until all responses are received |
2146 |
+diff --git a/drivers/net/ethernet/intel/i40e/i40e.h b/drivers/net/ethernet/intel/i40e/i40e.h |
2147 |
+index b10bc59c5700f..389df4d86ab4c 100644 |
2148 |
+--- a/drivers/net/ethernet/intel/i40e/i40e.h |
2149 |
++++ b/drivers/net/ethernet/intel/i40e/i40e.h |
2150 |
+@@ -174,7 +174,6 @@ enum i40e_interrupt_policy { |
2151 |
+ |
2152 |
+ struct i40e_lump_tracking { |
2153 |
+ u16 num_entries; |
2154 |
+- u16 search_hint; |
2155 |
+ u16 list[0]; |
2156 |
+ #define I40E_PILE_VALID_BIT 0x8000 |
2157 |
+ #define I40E_IWARP_IRQ_PILE_ID (I40E_PILE_VALID_BIT - 2) |
2158 |
+@@ -848,12 +847,12 @@ struct i40e_vsi { |
2159 |
+ struct rtnl_link_stats64 net_stats_offsets; |
2160 |
+ struct i40e_eth_stats eth_stats; |
2161 |
+ struct i40e_eth_stats eth_stats_offsets; |
2162 |
+- u32 tx_restart; |
2163 |
+- u32 tx_busy; |
2164 |
++ u64 tx_restart; |
2165 |
++ u64 tx_busy; |
2166 |
+ u64 tx_linearize; |
2167 |
+ u64 tx_force_wb; |
2168 |
+- u32 rx_buf_failed; |
2169 |
+- u32 rx_page_failed; |
2170 |
++ u64 rx_buf_failed; |
2171 |
++ u64 rx_page_failed; |
2172 |
+ |
2173 |
+ /* These are containers of ring pointers, allocated at run-time */ |
2174 |
+ struct i40e_ring **rx_rings; |
2175 |
+diff --git a/drivers/net/ethernet/intel/i40e/i40e_debugfs.c b/drivers/net/ethernet/intel/i40e/i40e_debugfs.c |
2176 |
+index 2c1b1da1220ec..1e57cc8c47d7b 100644 |
2177 |
+--- a/drivers/net/ethernet/intel/i40e/i40e_debugfs.c |
2178 |
++++ b/drivers/net/ethernet/intel/i40e/i40e_debugfs.c |
2179 |
+@@ -240,7 +240,7 @@ static void i40e_dbg_dump_vsi_seid(struct i40e_pf *pf, int seid) |
2180 |
+ (unsigned long int)vsi->net_stats_offsets.rx_compressed, |
2181 |
+ (unsigned long int)vsi->net_stats_offsets.tx_compressed); |
2182 |
+ dev_info(&pf->pdev->dev, |
2183 |
+- " tx_restart = %d, tx_busy = %d, rx_buf_failed = %d, rx_page_failed = %d\n", |
2184 |
++ " tx_restart = %llu, tx_busy = %llu, rx_buf_failed = %llu, rx_page_failed = %llu\n", |
2185 |
+ vsi->tx_restart, vsi->tx_busy, |
2186 |
+ vsi->rx_buf_failed, vsi->rx_page_failed); |
2187 |
+ rcu_read_lock(); |
2188 |
+diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c |
2189 |
+index cc1cefdd4cdac..20c8c0231e2c4 100644 |
2190 |
+--- a/drivers/net/ethernet/intel/i40e/i40e_main.c |
2191 |
++++ b/drivers/net/ethernet/intel/i40e/i40e_main.c |
2192 |
+@@ -196,10 +196,6 @@ int i40e_free_virt_mem_d(struct i40e_hw *hw, struct i40e_virt_mem *mem) |
2193 |
+ * @id: an owner id to stick on the items assigned |
2194 |
+ * |
2195 |
+ * Returns the base item index of the lump, or negative for error |
2196 |
+- * |
2197 |
+- * The search_hint trick and lack of advanced fit-finding only work |
2198 |
+- * because we're highly likely to have all the same size lump requests. |
2199 |
+- * Linear search time and any fragmentation should be minimal. |
2200 |
+ **/ |
2201 |
+ static int i40e_get_lump(struct i40e_pf *pf, struct i40e_lump_tracking *pile, |
2202 |
+ u16 needed, u16 id) |
2203 |
+@@ -214,8 +210,21 @@ static int i40e_get_lump(struct i40e_pf *pf, struct i40e_lump_tracking *pile, |
2204 |
+ return -EINVAL; |
2205 |
+ } |
2206 |
+ |
2207 |
+- /* start the linear search with an imperfect hint */ |
2208 |
+- i = pile->search_hint; |
2209 |
++ /* Allocate last queue in the pile for FDIR VSI queue |
2210 |
++ * so it doesn't fragment the qp_pile |
2211 |
++ */ |
2212 |
++ if (pile == pf->qp_pile && pf->vsi[id]->type == I40E_VSI_FDIR) { |
2213 |
++ if (pile->list[pile->num_entries - 1] & I40E_PILE_VALID_BIT) { |
2214 |
++ dev_err(&pf->pdev->dev, |
2215 |
++ "Cannot allocate queue %d for I40E_VSI_FDIR\n", |
2216 |
++ pile->num_entries - 1); |
2217 |
++ return -ENOMEM; |
2218 |
++ } |
2219 |
++ pile->list[pile->num_entries - 1] = id | I40E_PILE_VALID_BIT; |
2220 |
++ return pile->num_entries - 1; |
2221 |
++ } |
2222 |
++ |
2223 |
++ i = 0; |
2224 |
+ while (i < pile->num_entries) { |
2225 |
+ /* skip already allocated entries */ |
2226 |
+ if (pile->list[i] & I40E_PILE_VALID_BIT) { |
2227 |
+@@ -234,7 +243,6 @@ static int i40e_get_lump(struct i40e_pf *pf, struct i40e_lump_tracking *pile, |
2228 |
+ for (j = 0; j < needed; j++) |
2229 |
+ pile->list[i+j] = id | I40E_PILE_VALID_BIT; |
2230 |
+ ret = i; |
2231 |
+- pile->search_hint = i + j; |
2232 |
+ break; |
2233 |
+ } |
2234 |
+ |
2235 |
+@@ -257,7 +265,7 @@ static int i40e_put_lump(struct i40e_lump_tracking *pile, u16 index, u16 id) |
2236 |
+ { |
2237 |
+ int valid_id = (id | I40E_PILE_VALID_BIT); |
2238 |
+ int count = 0; |
2239 |
+- int i; |
2240 |
++ u16 i; |
2241 |
+ |
2242 |
+ if (!pile || index >= pile->num_entries) |
2243 |
+ return -EINVAL; |
2244 |
+@@ -269,8 +277,6 @@ static int i40e_put_lump(struct i40e_lump_tracking *pile, u16 index, u16 id) |
2245 |
+ count++; |
2246 |
+ } |
2247 |
+ |
2248 |
+- if (count && index < pile->search_hint) |
2249 |
+- pile->search_hint = index; |
2250 |
+ |
2251 |
+ return count; |
2252 |
+ } |
2253 |
+@@ -772,9 +778,9 @@ static void i40e_update_vsi_stats(struct i40e_vsi *vsi) |
2254 |
+ struct rtnl_link_stats64 *ns; /* netdev stats */ |
2255 |
+ struct i40e_eth_stats *oes; |
2256 |
+ struct i40e_eth_stats *es; /* device's eth stats */ |
2257 |
+- u32 tx_restart, tx_busy; |
2258 |
++ u64 tx_restart, tx_busy; |
2259 |
+ struct i40e_ring *p; |
2260 |
+- u32 rx_page, rx_buf; |
2261 |
++ u64 rx_page, rx_buf; |
2262 |
+ u64 bytes, packets; |
2263 |
+ unsigned int start; |
2264 |
+ u64 tx_linearize; |
2265 |
+@@ -10574,15 +10580,9 @@ static void i40e_rebuild(struct i40e_pf *pf, bool reinit, bool lock_acquired) |
2266 |
+ } |
2267 |
+ i40e_get_oem_version(&pf->hw); |
2268 |
+ |
2269 |
+- if (test_bit(__I40E_EMP_RESET_INTR_RECEIVED, pf->state) && |
2270 |
+- ((hw->aq.fw_maj_ver == 4 && hw->aq.fw_min_ver <= 33) || |
2271 |
+- hw->aq.fw_maj_ver < 4) && hw->mac.type == I40E_MAC_XL710) { |
2272 |
+- /* The following delay is necessary for 4.33 firmware and older |
2273 |
+- * to recover after EMP reset. 200 ms should suffice but we |
2274 |
+- * put here 300 ms to be sure that FW is ready to operate |
2275 |
+- * after reset. |
2276 |
+- */ |
2277 |
+- mdelay(300); |
2278 |
++ if (test_and_clear_bit(__I40E_EMP_RESET_INTR_RECEIVED, pf->state)) { |
2279 |
++ /* The following delay is necessary for firmware update. */ |
2280 |
++ mdelay(1000); |
2281 |
+ } |
2282 |
+ |
2283 |
+ /* re-verify the eeprom if we just had an EMP reset */ |
2284 |
+@@ -11792,7 +11792,6 @@ static int i40e_init_interrupt_scheme(struct i40e_pf *pf) |
2285 |
+ return -ENOMEM; |
2286 |
+ |
2287 |
+ pf->irq_pile->num_entries = vectors; |
2288 |
+- pf->irq_pile->search_hint = 0; |
2289 |
+ |
2290 |
+ /* track first vector for misc interrupts, ignore return */ |
2291 |
+ (void)i40e_get_lump(pf, pf->irq_pile, 1, I40E_PILE_VALID_BIT - 1); |
2292 |
+@@ -12595,7 +12594,6 @@ static int i40e_sw_init(struct i40e_pf *pf) |
2293 |
+ goto sw_init_done; |
2294 |
+ } |
2295 |
+ pf->qp_pile->num_entries = pf->hw.func_caps.num_tx_qp; |
2296 |
+- pf->qp_pile->search_hint = 0; |
2297 |
+ |
2298 |
+ pf->tx_timeout_recovery_level = 1; |
2299 |
+ |
2300 |
+diff --git a/drivers/net/ethernet/intel/i40e/i40e_register.h b/drivers/net/ethernet/intel/i40e/i40e_register.h |
2301 |
+index 8d0588a27a053..1908eed4fa5ee 100644 |
2302 |
+--- a/drivers/net/ethernet/intel/i40e/i40e_register.h |
2303 |
++++ b/drivers/net/ethernet/intel/i40e/i40e_register.h |
2304 |
+@@ -413,6 +413,9 @@ |
2305 |
+ #define I40E_VFINT_DYN_CTLN(_INTVF) (0x00024800 + ((_INTVF) * 4)) /* _i=0...511 */ /* Reset: VFR */ |
2306 |
+ #define I40E_VFINT_DYN_CTLN_CLEARPBA_SHIFT 1 |
2307 |
+ #define I40E_VFINT_DYN_CTLN_CLEARPBA_MASK I40E_MASK(0x1, I40E_VFINT_DYN_CTLN_CLEARPBA_SHIFT) |
2308 |
++#define I40E_VFINT_ICR0_ADMINQ_SHIFT 30 |
2309 |
++#define I40E_VFINT_ICR0_ADMINQ_MASK I40E_MASK(0x1, I40E_VFINT_ICR0_ADMINQ_SHIFT) |
2310 |
++#define I40E_VFINT_ICR0_ENA(_VF) (0x0002C000 + ((_VF) * 4)) /* _i=0...127 */ /* Reset: CORER */ |
2311 |
+ #define I40E_VPINT_AEQCTL(_VF) (0x0002B800 + ((_VF) * 4)) /* _i=0...127 */ /* Reset: CORER */ |
2312 |
+ #define I40E_VPINT_AEQCTL_MSIX_INDX_SHIFT 0 |
2313 |
+ #define I40E_VPINT_AEQCTL_ITR_INDX_SHIFT 11 |
2314 |
+diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c |
2315 |
+index 048f1678ab8ac..c6f643e54c4f7 100644 |
2316 |
+--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c |
2317 |
++++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c |
2318 |
+@@ -1376,6 +1376,32 @@ static i40e_status i40e_config_vf_promiscuous_mode(struct i40e_vf *vf, |
2319 |
+ return aq_ret; |
2320 |
+ } |
2321 |
+ |
2322 |
++/** |
2323 |
++ * i40e_sync_vfr_reset |
2324 |
++ * @hw: pointer to hw struct |
2325 |
++ * @vf_id: VF identifier |
2326 |
++ * |
2327 |
++ * Before trigger hardware reset, we need to know if no other process has |
2328 |
++ * reserved the hardware for any reset operations. This check is done by |
2329 |
++ * examining the status of the RSTAT1 register used to signal the reset. |
2330 |
++ **/ |
2331 |
++static int i40e_sync_vfr_reset(struct i40e_hw *hw, int vf_id) |
2332 |
++{ |
2333 |
++ u32 reg; |
2334 |
++ int i; |
2335 |
++ |
2336 |
++ for (i = 0; i < I40E_VFR_WAIT_COUNT; i++) { |
2337 |
++ reg = rd32(hw, I40E_VFINT_ICR0_ENA(vf_id)) & |
2338 |
++ I40E_VFINT_ICR0_ADMINQ_MASK; |
2339 |
++ if (reg) |
2340 |
++ return 0; |
2341 |
++ |
2342 |
++ usleep_range(100, 200); |
2343 |
++ } |
2344 |
++ |
2345 |
++ return -EAGAIN; |
2346 |
++} |
2347 |
++ |
2348 |
+ /** |
2349 |
+ * i40e_trigger_vf_reset |
2350 |
+ * @vf: pointer to the VF structure |
2351 |
+@@ -1390,9 +1416,11 @@ static void i40e_trigger_vf_reset(struct i40e_vf *vf, bool flr) |
2352 |
+ struct i40e_pf *pf = vf->pf; |
2353 |
+ struct i40e_hw *hw = &pf->hw; |
2354 |
+ u32 reg, reg_idx, bit_idx; |
2355 |
++ bool vf_active; |
2356 |
++ u32 radq; |
2357 |
+ |
2358 |
+ /* warn the VF */ |
2359 |
+- clear_bit(I40E_VF_STATE_ACTIVE, &vf->vf_states); |
2360 |
++ vf_active = test_and_clear_bit(I40E_VF_STATE_ACTIVE, &vf->vf_states); |
2361 |
+ |
2362 |
+ /* Disable VF's configuration API during reset. The flag is re-enabled |
2363 |
+ * in i40e_alloc_vf_res(), when it's safe again to access VF's VSI. |
2364 |
+@@ -1406,7 +1434,19 @@ static void i40e_trigger_vf_reset(struct i40e_vf *vf, bool flr) |
2365 |
+ * just need to clean up, so don't hit the VFRTRIG register. |
2366 |
+ */ |
2367 |
+ if (!flr) { |
2368 |
+- /* reset VF using VPGEN_VFRTRIG reg */ |
2369 |
++ /* Sync VFR reset before trigger next one */ |
2370 |
++ radq = rd32(hw, I40E_VFINT_ICR0_ENA(vf->vf_id)) & |
2371 |
++ I40E_VFINT_ICR0_ADMINQ_MASK; |
2372 |
++ if (vf_active && !radq) |
2373 |
++ /* waiting for finish reset by virtual driver */ |
2374 |
++ if (i40e_sync_vfr_reset(hw, vf->vf_id)) |
2375 |
++ dev_info(&pf->pdev->dev, |
2376 |
++ "Reset VF %d never finished\n", |
2377 |
++ vf->vf_id); |
2378 |
++ |
2379 |
++ /* Reset VF using VPGEN_VFRTRIG reg. It is also setting |
2380 |
++ * in progress state in rstat1 register. |
2381 |
++ */ |
2382 |
+ reg = rd32(hw, I40E_VPGEN_VFRTRIG(vf->vf_id)); |
2383 |
+ reg |= I40E_VPGEN_VFRTRIG_VFSWR_MASK; |
2384 |
+ wr32(hw, I40E_VPGEN_VFRTRIG(vf->vf_id), reg); |
2385 |
+@@ -2617,6 +2657,59 @@ error_param: |
2386 |
+ aq_ret); |
2387 |
+ } |
2388 |
+ |
2389 |
++/** |
2390 |
++ * i40e_check_enough_queue - find big enough queue number |
2391 |
++ * @vf: pointer to the VF info |
2392 |
++ * @needed: the number of items needed |
2393 |
++ * |
2394 |
++ * Returns the base item index of the queue, or negative for error |
2395 |
++ **/ |
2396 |
++static int i40e_check_enough_queue(struct i40e_vf *vf, u16 needed) |
2397 |
++{ |
2398 |
++ unsigned int i, cur_queues, more, pool_size; |
2399 |
++ struct i40e_lump_tracking *pile; |
2400 |
++ struct i40e_pf *pf = vf->pf; |
2401 |
++ struct i40e_vsi *vsi; |
2402 |
++ |
2403 |
++ vsi = pf->vsi[vf->lan_vsi_idx]; |
2404 |
++ cur_queues = vsi->alloc_queue_pairs; |
2405 |
++ |
2406 |
++ /* if current allocated queues are enough for need */ |
2407 |
++ if (cur_queues >= needed) |
2408 |
++ return vsi->base_queue; |
2409 |
++ |
2410 |
++ pile = pf->qp_pile; |
2411 |
++ if (cur_queues > 0) { |
2412 |
++ /* if the allocated queues are not zero |
2413 |
++ * just check if there are enough queues for more |
2414 |
++ * behind the allocated queues. |
2415 |
++ */ |
2416 |
++ more = needed - cur_queues; |
2417 |
++ for (i = vsi->base_queue + cur_queues; |
2418 |
++ i < pile->num_entries; i++) { |
2419 |
++ if (pile->list[i] & I40E_PILE_VALID_BIT) |
2420 |
++ break; |
2421 |
++ |
2422 |
++ if (more-- == 1) |
2423 |
++ /* there is enough */ |
2424 |
++ return vsi->base_queue; |
2425 |
++ } |
2426 |
++ } |
2427 |
++ |
2428 |
++ pool_size = 0; |
2429 |
++ for (i = 0; i < pile->num_entries; i++) { |
2430 |
++ if (pile->list[i] & I40E_PILE_VALID_BIT) { |
2431 |
++ pool_size = 0; |
2432 |
++ continue; |
2433 |
++ } |
2434 |
++ if (needed <= ++pool_size) |
2435 |
++ /* there is enough */ |
2436 |
++ return i; |
2437 |
++ } |
2438 |
++ |
2439 |
++ return -ENOMEM; |
2440 |
++} |
2441 |
++ |
2442 |
+ /** |
2443 |
+ * i40e_vc_request_queues_msg |
2444 |
+ * @vf: pointer to the VF info |
2445 |
+@@ -2651,6 +2744,12 @@ static int i40e_vc_request_queues_msg(struct i40e_vf *vf, u8 *msg) |
2446 |
+ req_pairs - cur_pairs, |
2447 |
+ pf->queues_left); |
2448 |
+ vfres->num_queue_pairs = pf->queues_left + cur_pairs; |
2449 |
++ } else if (i40e_check_enough_queue(vf, req_pairs) < 0) { |
2450 |
++ dev_warn(&pf->pdev->dev, |
2451 |
++ "VF %d requested %d more queues, but there is not enough for it.\n", |
2452 |
++ vf->vf_id, |
2453 |
++ req_pairs - cur_pairs); |
2454 |
++ vfres->num_queue_pairs = cur_pairs; |
2455 |
+ } else { |
2456 |
+ /* successful request */ |
2457 |
+ vf->num_req_queues = req_pairs; |
2458 |
+diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h |
2459 |
+index 49575a640a84c..03c42fd0fea19 100644 |
2460 |
+--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h |
2461 |
++++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h |
2462 |
+@@ -19,6 +19,7 @@ |
2463 |
+ #define I40E_MAX_VF_PROMISC_FLAGS 3 |
2464 |
+ |
2465 |
+ #define I40E_VF_STATE_WAIT_COUNT 20 |
2466 |
++#define I40E_VFR_WAIT_COUNT 100 |
2467 |
+ |
2468 |
+ /* Various queue ctrls */ |
2469 |
+ enum i40e_queue_ctrl { |
2470 |
+diff --git a/drivers/net/ethernet/marvell/octeontx2/af/mbox.h b/drivers/net/ethernet/marvell/octeontx2/af/mbox.h |
2471 |
+index 154877706a0e1..26ad71842b3b2 100644 |
2472 |
+--- a/drivers/net/ethernet/marvell/octeontx2/af/mbox.h |
2473 |
++++ b/drivers/net/ethernet/marvell/octeontx2/af/mbox.h |
2474 |
+@@ -698,6 +698,9 @@ enum nix_af_status { |
2475 |
+ NIX_AF_ERR_INVALID_BANDPROF = -426, |
2476 |
+ NIX_AF_ERR_IPOLICER_NOTSUPP = -427, |
2477 |
+ NIX_AF_ERR_BANDPROF_INVAL_REQ = -428, |
2478 |
++ NIX_AF_ERR_CQ_CTX_WRITE_ERR = -429, |
2479 |
++ NIX_AF_ERR_AQ_CTX_RETRY_WRITE = -430, |
2480 |
++ NIX_AF_ERR_LINK_CREDITS = -431, |
2481 |
+ }; |
2482 |
+ |
2483 |
+ /* For NIX RX vtag action */ |
2484 |
+diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rpm.c b/drivers/net/ethernet/marvell/octeontx2/af/rpm.c |
2485 |
+index 07b0eafccad87..b3803577324e6 100644 |
2486 |
+--- a/drivers/net/ethernet/marvell/octeontx2/af/rpm.c |
2487 |
++++ b/drivers/net/ethernet/marvell/octeontx2/af/rpm.c |
2488 |
+@@ -251,22 +251,19 @@ int rpm_lmac_internal_loopback(void *rpmd, int lmac_id, bool enable) |
2489 |
+ if (!rpm || lmac_id >= rpm->lmac_count) |
2490 |
+ return -ENODEV; |
2491 |
+ lmac_type = rpm->mac_ops->get_lmac_type(rpm, lmac_id); |
2492 |
+- if (lmac_type == LMAC_MODE_100G_R) { |
2493 |
+- cfg = rpm_read(rpm, lmac_id, RPMX_MTI_PCS100X_CONTROL1); |
2494 |
+- |
2495 |
+- if (enable) |
2496 |
+- cfg |= RPMX_MTI_PCS_LBK; |
2497 |
+- else |
2498 |
+- cfg &= ~RPMX_MTI_PCS_LBK; |
2499 |
+- rpm_write(rpm, lmac_id, RPMX_MTI_PCS100X_CONTROL1, cfg); |
2500 |
+- } else { |
2501 |
+- cfg = rpm_read(rpm, lmac_id, RPMX_MTI_LPCSX_CONTROL1); |
2502 |
+- if (enable) |
2503 |
+- cfg |= RPMX_MTI_PCS_LBK; |
2504 |
+- else |
2505 |
+- cfg &= ~RPMX_MTI_PCS_LBK; |
2506 |
+- rpm_write(rpm, lmac_id, RPMX_MTI_LPCSX_CONTROL1, cfg); |
2507 |
++ |
2508 |
++ if (lmac_type == LMAC_MODE_QSGMII || lmac_type == LMAC_MODE_SGMII) { |
2509 |
++ dev_err(&rpm->pdev->dev, "loopback not supported for LPC mode\n"); |
2510 |
++ return 0; |
2511 |
+ } |
2512 |
+ |
2513 |
++ cfg = rpm_read(rpm, lmac_id, RPMX_MTI_PCS100X_CONTROL1); |
2514 |
++ |
2515 |
++ if (enable) |
2516 |
++ cfg |= RPMX_MTI_PCS_LBK; |
2517 |
++ else |
2518 |
++ cfg &= ~RPMX_MTI_PCS_LBK; |
2519 |
++ rpm_write(rpm, lmac_id, RPMX_MTI_PCS100X_CONTROL1, cfg); |
2520 |
++ |
2521 |
+ return 0; |
2522 |
+ } |
2523 |
+diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu.c |
2524 |
+index 90dc5343827f0..11ef46e72ddd9 100644 |
2525 |
+--- a/drivers/net/ethernet/marvell/octeontx2/af/rvu.c |
2526 |
++++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu.c |
2527 |
+@@ -520,8 +520,11 @@ static void rvu_block_reset(struct rvu *rvu, int blkaddr, u64 rst_reg) |
2528 |
+ |
2529 |
+ rvu_write64(rvu, blkaddr, rst_reg, BIT_ULL(0)); |
2530 |
+ err = rvu_poll_reg(rvu, blkaddr, rst_reg, BIT_ULL(63), true); |
2531 |
+- if (err) |
2532 |
+- dev_err(rvu->dev, "HW block:%d reset failed\n", blkaddr); |
2533 |
++ if (err) { |
2534 |
++ dev_err(rvu->dev, "HW block:%d reset timeout retrying again\n", blkaddr); |
2535 |
++ while (rvu_poll_reg(rvu, blkaddr, rst_reg, BIT_ULL(63), true) == -EBUSY) |
2536 |
++ ; |
2537 |
++ } |
2538 |
+ } |
2539 |
+ |
2540 |
+ static void rvu_reset_all_blocks(struct rvu *rvu) |
2541 |
+diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c |
2542 |
+index 49d822a98adab..f001579569a2b 100644 |
2543 |
+--- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c |
2544 |
++++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c |
2545 |
+@@ -1131,6 +1131,8 @@ static void print_nix_cn10k_sq_ctx(struct seq_file *m, |
2546 |
+ seq_printf(m, "W3: head_offset\t\t\t%d\nW3: smenq_next_sqb_vld\t\t%d\n\n", |
2547 |
+ sq_ctx->head_offset, sq_ctx->smenq_next_sqb_vld); |
2548 |
+ |
2549 |
++ seq_printf(m, "W3: smq_next_sq_vld\t\t%d\nW3: smq_pend\t\t\t%d\n", |
2550 |
++ sq_ctx->smq_next_sq_vld, sq_ctx->smq_pend); |
2551 |
+ seq_printf(m, "W4: next_sqb \t\t\t%llx\n\n", sq_ctx->next_sqb); |
2552 |
+ seq_printf(m, "W5: tail_sqb \t\t\t%llx\n\n", sq_ctx->tail_sqb); |
2553 |
+ seq_printf(m, "W6: smenq_sqb \t\t\t%llx\n\n", sq_ctx->smenq_sqb); |
2554 |
+diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c |
2555 |
+index 6970540dc4709..959266894cf15 100644 |
2556 |
+--- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c |
2557 |
++++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c |
2558 |
+@@ -28,6 +28,7 @@ static int nix_verify_bandprof(struct nix_cn10k_aq_enq_req *req, |
2559 |
+ static int nix_free_all_bandprof(struct rvu *rvu, u16 pcifunc); |
2560 |
+ static void nix_clear_ratelimit_aggr(struct rvu *rvu, struct nix_hw *nix_hw, |
2561 |
+ u32 leaf_prof); |
2562 |
++static const char *nix_get_ctx_name(int ctype); |
2563 |
+ |
2564 |
+ enum mc_tbl_sz { |
2565 |
+ MC_TBL_SZ_256, |
2566 |
+@@ -511,11 +512,11 @@ static int rvu_nix_get_bpid(struct rvu *rvu, struct nix_bp_cfg_req *req, |
2567 |
+ cfg = rvu_read64(rvu, blkaddr, NIX_AF_CONST); |
2568 |
+ lmac_chan_cnt = cfg & 0xFF; |
2569 |
+ |
2570 |
+- cfg = rvu_read64(rvu, blkaddr, NIX_AF_CONST1); |
2571 |
+- sdp_chan_cnt = cfg & 0xFFF; |
2572 |
+- |
2573 |
+ cgx_bpid_cnt = hw->cgx_links * lmac_chan_cnt; |
2574 |
+ lbk_bpid_cnt = hw->lbk_links * ((cfg >> 16) & 0xFF); |
2575 |
++ |
2576 |
++ cfg = rvu_read64(rvu, blkaddr, NIX_AF_CONST1); |
2577 |
++ sdp_chan_cnt = cfg & 0xFFF; |
2578 |
+ sdp_bpid_cnt = hw->sdp_links * sdp_chan_cnt; |
2579 |
+ |
2580 |
+ pfvf = rvu_get_pfvf(rvu, req->hdr.pcifunc); |
2581 |
+@@ -1061,10 +1062,68 @@ static int rvu_nix_blk_aq_enq_inst(struct rvu *rvu, struct nix_hw *nix_hw, |
2582 |
+ return 0; |
2583 |
+ } |
2584 |
+ |
2585 |
++static int rvu_nix_verify_aq_ctx(struct rvu *rvu, struct nix_hw *nix_hw, |
2586 |
++ struct nix_aq_enq_req *req, u8 ctype) |
2587 |
++{ |
2588 |
++ struct nix_cn10k_aq_enq_req aq_req; |
2589 |
++ struct nix_cn10k_aq_enq_rsp aq_rsp; |
2590 |
++ int rc, word; |
2591 |
++ |
2592 |
++ if (req->ctype != NIX_AQ_CTYPE_CQ) |
2593 |
++ return 0; |
2594 |
++ |
2595 |
++ rc = nix_aq_context_read(rvu, nix_hw, &aq_req, &aq_rsp, |
2596 |
++ req->hdr.pcifunc, ctype, req->qidx); |
2597 |
++ if (rc) { |
2598 |
++ dev_err(rvu->dev, |
2599 |
++ "%s: Failed to fetch %s%d context of PFFUNC 0x%x\n", |
2600 |
++ __func__, nix_get_ctx_name(ctype), req->qidx, |
2601 |
++ req->hdr.pcifunc); |
2602 |
++ return rc; |
2603 |
++ } |
2604 |
++ |
2605 |
++ /* Make copy of original context & mask which are required |
2606 |
++ * for resubmission |
2607 |
++ */ |
2608 |
++ memcpy(&aq_req.cq_mask, &req->cq_mask, sizeof(struct nix_cq_ctx_s)); |
2609 |
++ memcpy(&aq_req.cq, &req->cq, sizeof(struct nix_cq_ctx_s)); |
2610 |
++ |
2611 |
++ /* exclude fields which HW can update */ |
2612 |
++ aq_req.cq_mask.cq_err = 0; |
2613 |
++ aq_req.cq_mask.wrptr = 0; |
2614 |
++ aq_req.cq_mask.tail = 0; |
2615 |
++ aq_req.cq_mask.head = 0; |
2616 |
++ aq_req.cq_mask.avg_level = 0; |
2617 |
++ aq_req.cq_mask.update_time = 0; |
2618 |
++ aq_req.cq_mask.substream = 0; |
2619 |
++ |
2620 |
++ /* Context mask (cq_mask) holds mask value of fields which |
2621 |
++ * are changed in AQ WRITE operation. |
2622 |
++ * for example cq.drop = 0xa; |
2623 |
++ * cq_mask.drop = 0xff; |
2624 |
++ * Below logic performs '&' between cq and cq_mask so that non |
2625 |
++ * updated fields are masked out for request and response |
2626 |
++ * comparison |
2627 |
++ */ |
2628 |
++ for (word = 0; word < sizeof(struct nix_cq_ctx_s) / sizeof(u64); |
2629 |
++ word++) { |
2630 |
++ *(u64 *)((u8 *)&aq_rsp.cq + word * 8) &= |
2631 |
++ (*(u64 *)((u8 *)&aq_req.cq_mask + word * 8)); |
2632 |
++ *(u64 *)((u8 *)&aq_req.cq + word * 8) &= |
2633 |
++ (*(u64 *)((u8 *)&aq_req.cq_mask + word * 8)); |
2634 |
++ } |
2635 |
++ |
2636 |
++ if (memcmp(&aq_req.cq, &aq_rsp.cq, sizeof(struct nix_cq_ctx_s))) |
2637 |
++ return NIX_AF_ERR_AQ_CTX_RETRY_WRITE; |
2638 |
++ |
2639 |
++ return 0; |
2640 |
++} |
2641 |
++ |
2642 |
+ static int rvu_nix_aq_enq_inst(struct rvu *rvu, struct nix_aq_enq_req *req, |
2643 |
+ struct nix_aq_enq_rsp *rsp) |
2644 |
+ { |
2645 |
+ struct nix_hw *nix_hw; |
2646 |
++ int err, retries = 5; |
2647 |
+ int blkaddr; |
2648 |
+ |
2649 |
+ blkaddr = rvu_get_blkaddr(rvu, BLKTYPE_NIX, req->hdr.pcifunc); |
2650 |
+@@ -1075,7 +1134,24 @@ static int rvu_nix_aq_enq_inst(struct rvu *rvu, struct nix_aq_enq_req *req, |
2651 |
+ if (!nix_hw) |
2652 |
+ return NIX_AF_ERR_INVALID_NIXBLK; |
2653 |
+ |
2654 |
+- return rvu_nix_blk_aq_enq_inst(rvu, nix_hw, req, rsp); |
2655 |
++retry: |
2656 |
++ err = rvu_nix_blk_aq_enq_inst(rvu, nix_hw, req, rsp); |
2657 |
++ |
2658 |
++ /* HW errata 'AQ Modification to CQ could be discarded on heavy traffic' |
2659 |
++ * As a work around perfrom CQ context read after each AQ write. If AQ |
2660 |
++ * read shows AQ write is not updated perform AQ write again. |
2661 |
++ */ |
2662 |
++ if (!err && req->op == NIX_AQ_INSTOP_WRITE) { |
2663 |
++ err = rvu_nix_verify_aq_ctx(rvu, nix_hw, req, NIX_AQ_CTYPE_CQ); |
2664 |
++ if (err == NIX_AF_ERR_AQ_CTX_RETRY_WRITE) { |
2665 |
++ if (retries--) |
2666 |
++ goto retry; |
2667 |
++ else |
2668 |
++ return NIX_AF_ERR_CQ_CTX_WRITE_ERR; |
2669 |
++ } |
2670 |
++ } |
2671 |
++ |
2672 |
++ return err; |
2673 |
+ } |
2674 |
+ |
2675 |
+ static const char *nix_get_ctx_name(int ctype) |
2676 |
+@@ -3815,8 +3891,8 @@ nix_config_link_credits(struct rvu *rvu, int blkaddr, int link, |
2677 |
+ NIX_AF_TL1X_SW_XOFF(schq), BIT_ULL(0)); |
2678 |
+ } |
2679 |
+ |
2680 |
+- rc = -EBUSY; |
2681 |
+- poll_tmo = jiffies + usecs_to_jiffies(10000); |
2682 |
++ rc = NIX_AF_ERR_LINK_CREDITS; |
2683 |
++ poll_tmo = jiffies + usecs_to_jiffies(200000); |
2684 |
+ /* Wait for credits to return */ |
2685 |
+ do { |
2686 |
+ if (time_after(jiffies, poll_tmo)) |
2687 |
+diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c |
2688 |
+index 5efb4174e82df..87f18e32b4634 100644 |
2689 |
+--- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c |
2690 |
++++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c |
2691 |
+@@ -402,6 +402,7 @@ static void npc_fixup_vf_rule(struct rvu *rvu, struct npc_mcam *mcam, |
2692 |
+ int blkaddr, int index, struct mcam_entry *entry, |
2693 |
+ bool *enable) |
2694 |
+ { |
2695 |
++ struct rvu_npc_mcam_rule *rule; |
2696 |
+ u16 owner, target_func; |
2697 |
+ struct rvu_pfvf *pfvf; |
2698 |
+ u64 rx_action; |
2699 |
+@@ -423,6 +424,12 @@ static void npc_fixup_vf_rule(struct rvu *rvu, struct npc_mcam *mcam, |
2700 |
+ test_bit(NIXLF_INITIALIZED, &pfvf->flags))) |
2701 |
+ *enable = false; |
2702 |
+ |
2703 |
++ /* fix up not needed for the rules added by user(ntuple filters) */ |
2704 |
++ list_for_each_entry(rule, &mcam->mcam_rules, list) { |
2705 |
++ if (rule->entry == index) |
2706 |
++ return; |
2707 |
++ } |
2708 |
++ |
2709 |
+ /* copy VF default entry action to the VF mcam entry */ |
2710 |
+ rx_action = npc_get_default_entry_action(rvu, mcam, blkaddr, |
2711 |
+ target_func); |
2712 |
+@@ -489,8 +496,8 @@ static void npc_config_mcam_entry(struct rvu *rvu, struct npc_mcam *mcam, |
2713 |
+ } |
2714 |
+ |
2715 |
+ /* PF installing VF rule */ |
2716 |
+- if (intf == NIX_INTF_RX && actindex < mcam->bmap_entries) |
2717 |
+- npc_fixup_vf_rule(rvu, mcam, blkaddr, index, entry, &enable); |
2718 |
++ if (is_npc_intf_rx(intf) && actindex < mcam->bmap_entries) |
2719 |
++ npc_fixup_vf_rule(rvu, mcam, blkaddr, actindex, entry, &enable); |
2720 |
+ |
2721 |
+ /* Set 'action' */ |
2722 |
+ rvu_write64(rvu, blkaddr, |
2723 |
+@@ -916,7 +923,8 @@ static void npc_update_vf_flow_entry(struct rvu *rvu, struct npc_mcam *mcam, |
2724 |
+ int blkaddr, u16 pcifunc, u64 rx_action) |
2725 |
+ { |
2726 |
+ int actindex, index, bank, entry; |
2727 |
+- bool enable; |
2728 |
++ struct rvu_npc_mcam_rule *rule; |
2729 |
++ bool enable, update; |
2730 |
+ |
2731 |
+ if (!(pcifunc & RVU_PFVF_FUNC_MASK)) |
2732 |
+ return; |
2733 |
+@@ -924,6 +932,14 @@ static void npc_update_vf_flow_entry(struct rvu *rvu, struct npc_mcam *mcam, |
2734 |
+ mutex_lock(&mcam->lock); |
2735 |
+ for (index = 0; index < mcam->bmap_entries; index++) { |
2736 |
+ if (mcam->entry2target_pffunc[index] == pcifunc) { |
2737 |
++ update = true; |
2738 |
++ /* update not needed for the rules added via ntuple filters */ |
2739 |
++ list_for_each_entry(rule, &mcam->mcam_rules, list) { |
2740 |
++ if (rule->entry == index) |
2741 |
++ update = false; |
2742 |
++ } |
2743 |
++ if (!update) |
2744 |
++ continue; |
2745 |
+ bank = npc_get_bank(mcam, index); |
2746 |
+ actindex = index; |
2747 |
+ entry = index & (mcam->banksize - 1); |
2748 |
+diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c |
2749 |
+index 51ddc7b81d0bd..ca404d51d9f56 100644 |
2750 |
+--- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c |
2751 |
++++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c |
2752 |
+@@ -1098,14 +1098,6 @@ find_rule: |
2753 |
+ write_req.cntr = rule->cntr; |
2754 |
+ } |
2755 |
+ |
2756 |
+- err = rvu_mbox_handler_npc_mcam_write_entry(rvu, &write_req, |
2757 |
+- &write_rsp); |
2758 |
+- if (err) { |
2759 |
+- rvu_mcam_remove_counter_from_rule(rvu, owner, rule); |
2760 |
+- if (new) |
2761 |
+- kfree(rule); |
2762 |
+- return err; |
2763 |
+- } |
2764 |
+ /* update rule */ |
2765 |
+ memcpy(&rule->packet, &dummy.packet, sizeof(rule->packet)); |
2766 |
+ memcpy(&rule->mask, &dummy.mask, sizeof(rule->mask)); |
2767 |
+@@ -1129,6 +1121,18 @@ find_rule: |
2768 |
+ if (req->default_rule) |
2769 |
+ pfvf->def_ucast_rule = rule; |
2770 |
+ |
2771 |
++ /* write to mcam entry registers */ |
2772 |
++ err = rvu_mbox_handler_npc_mcam_write_entry(rvu, &write_req, |
2773 |
++ &write_rsp); |
2774 |
++ if (err) { |
2775 |
++ rvu_mcam_remove_counter_from_rule(rvu, owner, rule); |
2776 |
++ if (new) { |
2777 |
++ list_del(&rule->list); |
2778 |
++ kfree(rule); |
2779 |
++ } |
2780 |
++ return err; |
2781 |
++ } |
2782 |
++ |
2783 |
+ /* VF's MAC address is being changed via PF */ |
2784 |
+ if (pf_set_vfs_mac) { |
2785 |
+ ether_addr_copy(pfvf->default_mac, req->packet.dmac); |
2786 |
+diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h |
2787 |
+index a51ecd771d075..637450de189c8 100644 |
2788 |
+--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h |
2789 |
++++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h |
2790 |
+@@ -591,6 +591,7 @@ static inline void __cn10k_aura_freeptr(struct otx2_nic *pfvf, u64 aura, |
2791 |
+ size++; |
2792 |
+ tar_addr |= ((size - 1) & 0x7) << 4; |
2793 |
+ } |
2794 |
++ dma_wmb(); |
2795 |
+ memcpy((u64 *)lmt_info->lmt_addr, ptrs, sizeof(u64) * num_ptrs); |
2796 |
+ /* Perform LMTST flush */ |
2797 |
+ cn10k_lmt_flush(val, tar_addr); |
2798 |
+diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c |
2799 |
+index 53a3e8de1a51e..b1894d4045b8d 100644 |
2800 |
+--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c |
2801 |
++++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c |
2802 |
+@@ -386,7 +386,12 @@ static int otx2_forward_vf_mbox_msgs(struct otx2_nic *pf, |
2803 |
+ dst_mdev->msg_size = mbox_hdr->msg_size; |
2804 |
+ dst_mdev->num_msgs = num_msgs; |
2805 |
+ err = otx2_sync_mbox_msg(dst_mbox); |
2806 |
+- if (err) { |
2807 |
++ /* Error code -EIO indicate there is a communication failure |
2808 |
++ * to the AF. Rest of the error codes indicate that AF processed |
2809 |
++ * VF messages and set the error codes in response messages |
2810 |
++ * (if any) so simply forward responses to VF. |
2811 |
++ */ |
2812 |
++ if (err == -EIO) { |
2813 |
+ dev_warn(pf->dev, |
2814 |
+ "AF not responding to VF%d messages\n", vf); |
2815 |
+ /* restore PF mbase and exit */ |
2816 |
+diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-visconti.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-visconti.c |
2817 |
+index fac788718c045..4578c64953eac 100644 |
2818 |
+--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-visconti.c |
2819 |
++++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-visconti.c |
2820 |
+@@ -22,21 +22,21 @@ |
2821 |
+ #define ETHER_CLK_SEL_RMII_CLK_EN BIT(2) |
2822 |
+ #define ETHER_CLK_SEL_RMII_CLK_RST BIT(3) |
2823 |
+ #define ETHER_CLK_SEL_DIV_SEL_2 BIT(4) |
2824 |
+-#define ETHER_CLK_SEL_DIV_SEL_20 BIT(0) |
2825 |
++#define ETHER_CLK_SEL_DIV_SEL_20 0 |
2826 |
+ #define ETHER_CLK_SEL_FREQ_SEL_125M (BIT(9) | BIT(8)) |
2827 |
+ #define ETHER_CLK_SEL_FREQ_SEL_50M BIT(9) |
2828 |
+ #define ETHER_CLK_SEL_FREQ_SEL_25M BIT(8) |
2829 |
+ #define ETHER_CLK_SEL_FREQ_SEL_2P5M 0 |
2830 |
+-#define ETHER_CLK_SEL_TX_CLK_EXT_SEL_IN BIT(0) |
2831 |
++#define ETHER_CLK_SEL_TX_CLK_EXT_SEL_IN 0 |
2832 |
+ #define ETHER_CLK_SEL_TX_CLK_EXT_SEL_TXC BIT(10) |
2833 |
+ #define ETHER_CLK_SEL_TX_CLK_EXT_SEL_DIV BIT(11) |
2834 |
+-#define ETHER_CLK_SEL_RX_CLK_EXT_SEL_IN BIT(0) |
2835 |
++#define ETHER_CLK_SEL_RX_CLK_EXT_SEL_IN 0 |
2836 |
+ #define ETHER_CLK_SEL_RX_CLK_EXT_SEL_RXC BIT(12) |
2837 |
+ #define ETHER_CLK_SEL_RX_CLK_EXT_SEL_DIV BIT(13) |
2838 |
+-#define ETHER_CLK_SEL_TX_CLK_O_TX_I BIT(0) |
2839 |
++#define ETHER_CLK_SEL_TX_CLK_O_TX_I 0 |
2840 |
+ #define ETHER_CLK_SEL_TX_CLK_O_RMII_I BIT(14) |
2841 |
+ #define ETHER_CLK_SEL_TX_O_E_N_IN BIT(15) |
2842 |
+-#define ETHER_CLK_SEL_RMII_CLK_SEL_IN BIT(0) |
2843 |
++#define ETHER_CLK_SEL_RMII_CLK_SEL_IN 0 |
2844 |
+ #define ETHER_CLK_SEL_RMII_CLK_SEL_RX_C BIT(16) |
2845 |
+ |
2846 |
+ #define ETHER_CLK_SEL_RX_TX_CLK_EN (ETHER_CLK_SEL_RX_CLK_EN | ETHER_CLK_SEL_TX_CLK_EN) |
2847 |
+@@ -96,31 +96,41 @@ static void visconti_eth_fix_mac_speed(void *priv, unsigned int speed) |
2848 |
+ val |= ETHER_CLK_SEL_TX_O_E_N_IN; |
2849 |
+ writel(val, dwmac->reg + REG_ETHER_CLOCK_SEL); |
2850 |
+ |
2851 |
++ /* Set Clock-Mux, Start clock, Set TX_O direction */ |
2852 |
+ switch (dwmac->phy_intf_sel) { |
2853 |
+ case ETHER_CONFIG_INTF_RGMII: |
2854 |
+ val = clk_sel_val | ETHER_CLK_SEL_RX_CLK_EXT_SEL_RXC; |
2855 |
++ writel(val, dwmac->reg + REG_ETHER_CLOCK_SEL); |
2856 |
++ |
2857 |
++ val |= ETHER_CLK_SEL_RX_TX_CLK_EN; |
2858 |
++ writel(val, dwmac->reg + REG_ETHER_CLOCK_SEL); |
2859 |
++ |
2860 |
++ val &= ~ETHER_CLK_SEL_TX_O_E_N_IN; |
2861 |
++ writel(val, dwmac->reg + REG_ETHER_CLOCK_SEL); |
2862 |
+ break; |
2863 |
+ case ETHER_CONFIG_INTF_RMII: |
2864 |
+ val = clk_sel_val | ETHER_CLK_SEL_RX_CLK_EXT_SEL_DIV | |
2865 |
+- ETHER_CLK_SEL_TX_CLK_EXT_SEL_TXC | ETHER_CLK_SEL_TX_O_E_N_IN | |
2866 |
++ ETHER_CLK_SEL_TX_CLK_EXT_SEL_DIV | ETHER_CLK_SEL_TX_O_E_N_IN | |
2867 |
+ ETHER_CLK_SEL_RMII_CLK_SEL_RX_C; |
2868 |
++ writel(val, dwmac->reg + REG_ETHER_CLOCK_SEL); |
2869 |
++ |
2870 |
++ val |= ETHER_CLK_SEL_RMII_CLK_RST; |
2871 |
++ writel(val, dwmac->reg + REG_ETHER_CLOCK_SEL); |
2872 |
++ |
2873 |
++ val |= ETHER_CLK_SEL_RMII_CLK_EN | ETHER_CLK_SEL_RX_TX_CLK_EN; |
2874 |
++ writel(val, dwmac->reg + REG_ETHER_CLOCK_SEL); |
2875 |
+ break; |
2876 |
+ case ETHER_CONFIG_INTF_MII: |
2877 |
+ default: |
2878 |
+ val = clk_sel_val | ETHER_CLK_SEL_RX_CLK_EXT_SEL_RXC | |
2879 |
+- ETHER_CLK_SEL_TX_CLK_EXT_SEL_DIV | ETHER_CLK_SEL_TX_O_E_N_IN | |
2880 |
+- ETHER_CLK_SEL_RMII_CLK_EN; |
2881 |
++ ETHER_CLK_SEL_TX_CLK_EXT_SEL_TXC | ETHER_CLK_SEL_TX_O_E_N_IN; |
2882 |
++ writel(val, dwmac->reg + REG_ETHER_CLOCK_SEL); |
2883 |
++ |
2884 |
++ val |= ETHER_CLK_SEL_RX_TX_CLK_EN; |
2885 |
++ writel(val, dwmac->reg + REG_ETHER_CLOCK_SEL); |
2886 |
+ break; |
2887 |
+ } |
2888 |
+ |
2889 |
+- /* Start clock */ |
2890 |
+- writel(val, dwmac->reg + REG_ETHER_CLOCK_SEL); |
2891 |
+- val |= ETHER_CLK_SEL_RX_TX_CLK_EN; |
2892 |
+- writel(val, dwmac->reg + REG_ETHER_CLOCK_SEL); |
2893 |
+- |
2894 |
+- val &= ~ETHER_CLK_SEL_TX_O_E_N_IN; |
2895 |
+- writel(val, dwmac->reg + REG_ETHER_CLOCK_SEL); |
2896 |
+- |
2897 |
+ spin_unlock_irqrestore(&dwmac->lock, flags); |
2898 |
+ } |
2899 |
+ |
2900 |
+diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c |
2901 |
+index 06e5431cf51df..9f3d18abf62b3 100644 |
2902 |
+--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c |
2903 |
++++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c |
2904 |
+@@ -899,6 +899,9 @@ static int stmmac_init_ptp(struct stmmac_priv *priv) |
2905 |
+ bool xmac = priv->plat->has_gmac4 || priv->plat->has_xgmac; |
2906 |
+ int ret; |
2907 |
+ |
2908 |
++ if (priv->plat->ptp_clk_freq_config) |
2909 |
++ priv->plat->ptp_clk_freq_config(priv); |
2910 |
++ |
2911 |
+ ret = stmmac_init_tstamp_counter(priv, STMMAC_HWTS_ACTIVE); |
2912 |
+ if (ret) |
2913 |
+ return ret; |
2914 |
+@@ -921,8 +924,6 @@ static int stmmac_init_ptp(struct stmmac_priv *priv) |
2915 |
+ priv->hwts_tx_en = 0; |
2916 |
+ priv->hwts_rx_en = 0; |
2917 |
+ |
2918 |
+- stmmac_ptp_register(priv); |
2919 |
+- |
2920 |
+ return 0; |
2921 |
+ } |
2922 |
+ |
2923 |
+@@ -3237,7 +3238,7 @@ static int stmmac_fpe_start_wq(struct stmmac_priv *priv) |
2924 |
+ /** |
2925 |
+ * stmmac_hw_setup - setup mac in a usable state. |
2926 |
+ * @dev : pointer to the device structure. |
2927 |
+- * @init_ptp: initialize PTP if set |
2928 |
++ * @ptp_register: register PTP if set |
2929 |
+ * Description: |
2930 |
+ * this is the main function to setup the HW in a usable state because the |
2931 |
+ * dma engine is reset, the core registers are configured (e.g. AXI, |
2932 |
+@@ -3247,7 +3248,7 @@ static int stmmac_fpe_start_wq(struct stmmac_priv *priv) |
2933 |
+ * 0 on success and an appropriate (-)ve integer as defined in errno.h |
2934 |
+ * file on failure. |
2935 |
+ */ |
2936 |
+-static int stmmac_hw_setup(struct net_device *dev, bool init_ptp) |
2937 |
++static int stmmac_hw_setup(struct net_device *dev, bool ptp_register) |
2938 |
+ { |
2939 |
+ struct stmmac_priv *priv = netdev_priv(dev); |
2940 |
+ u32 rx_cnt = priv->plat->rx_queues_to_use; |
2941 |
+@@ -3304,13 +3305,13 @@ static int stmmac_hw_setup(struct net_device *dev, bool init_ptp) |
2942 |
+ |
2943 |
+ stmmac_mmc_setup(priv); |
2944 |
+ |
2945 |
+- if (init_ptp) { |
2946 |
+- ret = stmmac_init_ptp(priv); |
2947 |
+- if (ret == -EOPNOTSUPP) |
2948 |
+- netdev_warn(priv->dev, "PTP not supported by HW\n"); |
2949 |
+- else if (ret) |
2950 |
+- netdev_warn(priv->dev, "PTP init failed\n"); |
2951 |
+- } |
2952 |
++ ret = stmmac_init_ptp(priv); |
2953 |
++ if (ret == -EOPNOTSUPP) |
2954 |
++ netdev_warn(priv->dev, "PTP not supported by HW\n"); |
2955 |
++ else if (ret) |
2956 |
++ netdev_warn(priv->dev, "PTP init failed\n"); |
2957 |
++ else if (ptp_register) |
2958 |
++ stmmac_ptp_register(priv); |
2959 |
+ |
2960 |
+ priv->eee_tw_timer = STMMAC_DEFAULT_TWT_LS; |
2961 |
+ |
2962 |
+diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c |
2963 |
+index be9b58b2abf9b..ac8bc1c8614d3 100644 |
2964 |
+--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c |
2965 |
++++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c |
2966 |
+@@ -297,9 +297,6 @@ void stmmac_ptp_register(struct stmmac_priv *priv) |
2967 |
+ { |
2968 |
+ int i; |
2969 |
+ |
2970 |
+- if (priv->plat->ptp_clk_freq_config) |
2971 |
+- priv->plat->ptp_clk_freq_config(priv); |
2972 |
+- |
2973 |
+ for (i = 0; i < priv->dma_cap.pps_out_num; i++) { |
2974 |
+ if (i >= STMMAC_PPS_MAX) |
2975 |
+ break; |
2976 |
+diff --git a/drivers/net/ethernet/ti/cpsw_priv.c b/drivers/net/ethernet/ti/cpsw_priv.c |
2977 |
+index 6bb5ac51d23c3..f8e591d69d2cb 100644 |
2978 |
+--- a/drivers/net/ethernet/ti/cpsw_priv.c |
2979 |
++++ b/drivers/net/ethernet/ti/cpsw_priv.c |
2980 |
+@@ -1144,7 +1144,7 @@ int cpsw_fill_rx_channels(struct cpsw_priv *priv) |
2981 |
+ static struct page_pool *cpsw_create_page_pool(struct cpsw_common *cpsw, |
2982 |
+ int size) |
2983 |
+ { |
2984 |
+- struct page_pool_params pp_params; |
2985 |
++ struct page_pool_params pp_params = {}; |
2986 |
+ struct page_pool *pool; |
2987 |
+ |
2988 |
+ pp_params.order = 0; |
2989 |
+diff --git a/drivers/net/hamradio/yam.c b/drivers/net/hamradio/yam.c |
2990 |
+index 6ddacbdb224ba..528d57a435394 100644 |
2991 |
+--- a/drivers/net/hamradio/yam.c |
2992 |
++++ b/drivers/net/hamradio/yam.c |
2993 |
+@@ -950,9 +950,7 @@ static int yam_siocdevprivate(struct net_device *dev, struct ifreq *ifr, void __ |
2994 |
+ ym = memdup_user(data, sizeof(struct yamdrv_ioctl_mcs)); |
2995 |
+ if (IS_ERR(ym)) |
2996 |
+ return PTR_ERR(ym); |
2997 |
+- if (ym->cmd != SIOCYAMSMCS) |
2998 |
+- return -EINVAL; |
2999 |
+- if (ym->bitrate > YAM_MAXBITRATE) { |
3000 |
++ if (ym->cmd != SIOCYAMSMCS || ym->bitrate > YAM_MAXBITRATE) { |
3001 |
+ kfree(ym); |
3002 |
+ return -EINVAL; |
3003 |
+ } |
3004 |
+diff --git a/drivers/net/phy/broadcom.c b/drivers/net/phy/broadcom.c |
3005 |
+index 83aea5c5cd03c..db26ff8ce7dbb 100644 |
3006 |
+--- a/drivers/net/phy/broadcom.c |
3007 |
++++ b/drivers/net/phy/broadcom.c |
3008 |
+@@ -768,6 +768,7 @@ static struct phy_driver broadcom_drivers[] = { |
3009 |
+ .phy_id_mask = 0xfffffff0, |
3010 |
+ .name = "Broadcom BCM54616S", |
3011 |
+ /* PHY_GBIT_FEATURES */ |
3012 |
++ .soft_reset = genphy_soft_reset, |
3013 |
+ .config_init = bcm54xx_config_init, |
3014 |
+ .config_aneg = bcm54616s_config_aneg, |
3015 |
+ .config_intr = bcm_phy_config_intr, |
3016 |
+diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c |
3017 |
+index 4f9990b47a377..28f4a383aba72 100644 |
3018 |
+--- a/drivers/net/phy/phy_device.c |
3019 |
++++ b/drivers/net/phy/phy_device.c |
3020 |
+@@ -1746,6 +1746,9 @@ void phy_detach(struct phy_device *phydev) |
3021 |
+ phy_driver_is_genphy_10g(phydev)) |
3022 |
+ device_release_driver(&phydev->mdio.dev); |
3023 |
+ |
3024 |
++ /* Assert the reset signal */ |
3025 |
++ phy_device_reset(phydev, 1); |
3026 |
++ |
3027 |
+ /* |
3028 |
+ * The phydev might go away on the put_device() below, so avoid |
3029 |
+ * a use-after-free bug by reading the underlying bus first. |
3030 |
+@@ -1757,9 +1760,6 @@ void phy_detach(struct phy_device *phydev) |
3031 |
+ ndev_owner = dev->dev.parent->driver->owner; |
3032 |
+ if (ndev_owner != bus->owner) |
3033 |
+ module_put(bus->owner); |
3034 |
+- |
3035 |
+- /* Assert the reset signal */ |
3036 |
+- phy_device_reset(phydev, 1); |
3037 |
+ } |
3038 |
+ EXPORT_SYMBOL(phy_detach); |
3039 |
+ |
3040 |
+diff --git a/drivers/net/phy/sfp-bus.c b/drivers/net/phy/sfp-bus.c |
3041 |
+index 7362f8c3271c9..ef2c6a09eb0f3 100644 |
3042 |
+--- a/drivers/net/phy/sfp-bus.c |
3043 |
++++ b/drivers/net/phy/sfp-bus.c |
3044 |
+@@ -651,6 +651,11 @@ struct sfp_bus *sfp_bus_find_fwnode(struct fwnode_handle *fwnode) |
3045 |
+ else if (ret < 0) |
3046 |
+ return ERR_PTR(ret); |
3047 |
+ |
3048 |
++ if (!fwnode_device_is_available(ref.fwnode)) { |
3049 |
++ fwnode_handle_put(ref.fwnode); |
3050 |
++ return NULL; |
3051 |
++ } |
3052 |
++ |
3053 |
+ bus = sfp_bus_get(ref.fwnode); |
3054 |
+ fwnode_handle_put(ref.fwnode); |
3055 |
+ if (!bus) |
3056 |
+diff --git a/drivers/rpmsg/rpmsg_char.c b/drivers/rpmsg/rpmsg_char.c |
3057 |
+index 2bebc9b2d1634..49dd5a2009982 100644 |
3058 |
+--- a/drivers/rpmsg/rpmsg_char.c |
3059 |
++++ b/drivers/rpmsg/rpmsg_char.c |
3060 |
+@@ -92,7 +92,7 @@ static int rpmsg_eptdev_destroy(struct device *dev, void *data) |
3061 |
+ /* wake up any blocked readers */ |
3062 |
+ wake_up_interruptible(&eptdev->readq); |
3063 |
+ |
3064 |
+- device_del(&eptdev->dev); |
3065 |
++ cdev_device_del(&eptdev->cdev, &eptdev->dev); |
3066 |
+ put_device(&eptdev->dev); |
3067 |
+ |
3068 |
+ return 0; |
3069 |
+@@ -335,7 +335,6 @@ static void rpmsg_eptdev_release_device(struct device *dev) |
3070 |
+ |
3071 |
+ ida_simple_remove(&rpmsg_ept_ida, dev->id); |
3072 |
+ ida_simple_remove(&rpmsg_minor_ida, MINOR(eptdev->dev.devt)); |
3073 |
+- cdev_del(&eptdev->cdev); |
3074 |
+ kfree(eptdev); |
3075 |
+ } |
3076 |
+ |
3077 |
+@@ -380,19 +379,13 @@ static int rpmsg_eptdev_create(struct rpmsg_ctrldev *ctrldev, |
3078 |
+ dev->id = ret; |
3079 |
+ dev_set_name(dev, "rpmsg%d", ret); |
3080 |
+ |
3081 |
+- ret = cdev_add(&eptdev->cdev, dev->devt, 1); |
3082 |
++ ret = cdev_device_add(&eptdev->cdev, &eptdev->dev); |
3083 |
+ if (ret) |
3084 |
+ goto free_ept_ida; |
3085 |
+ |
3086 |
+ /* We can now rely on the release function for cleanup */ |
3087 |
+ dev->release = rpmsg_eptdev_release_device; |
3088 |
+ |
3089 |
+- ret = device_add(dev); |
3090 |
+- if (ret) { |
3091 |
+- dev_err(dev, "device_add failed: %d\n", ret); |
3092 |
+- put_device(dev); |
3093 |
+- } |
3094 |
+- |
3095 |
+ return ret; |
3096 |
+ |
3097 |
+ free_ept_ida: |
3098 |
+@@ -461,7 +454,6 @@ static void rpmsg_ctrldev_release_device(struct device *dev) |
3099 |
+ |
3100 |
+ ida_simple_remove(&rpmsg_ctrl_ida, dev->id); |
3101 |
+ ida_simple_remove(&rpmsg_minor_ida, MINOR(dev->devt)); |
3102 |
+- cdev_del(&ctrldev->cdev); |
3103 |
+ kfree(ctrldev); |
3104 |
+ } |
3105 |
+ |
3106 |
+@@ -496,19 +488,13 @@ static int rpmsg_chrdev_probe(struct rpmsg_device *rpdev) |
3107 |
+ dev->id = ret; |
3108 |
+ dev_set_name(&ctrldev->dev, "rpmsg_ctrl%d", ret); |
3109 |
+ |
3110 |
+- ret = cdev_add(&ctrldev->cdev, dev->devt, 1); |
3111 |
++ ret = cdev_device_add(&ctrldev->cdev, &ctrldev->dev); |
3112 |
+ if (ret) |
3113 |
+ goto free_ctrl_ida; |
3114 |
+ |
3115 |
+ /* We can now rely on the release function for cleanup */ |
3116 |
+ dev->release = rpmsg_ctrldev_release_device; |
3117 |
+ |
3118 |
+- ret = device_add(dev); |
3119 |
+- if (ret) { |
3120 |
+- dev_err(&rpdev->dev, "device_add failed: %d\n", ret); |
3121 |
+- put_device(dev); |
3122 |
+- } |
3123 |
+- |
3124 |
+ dev_set_drvdata(&rpdev->dev, ctrldev); |
3125 |
+ |
3126 |
+ return ret; |
3127 |
+@@ -534,7 +520,7 @@ static void rpmsg_chrdev_remove(struct rpmsg_device *rpdev) |
3128 |
+ if (ret) |
3129 |
+ dev_warn(&rpdev->dev, "failed to nuke endpoints: %d\n", ret); |
3130 |
+ |
3131 |
+- device_del(&ctrldev->dev); |
3132 |
++ cdev_device_del(&ctrldev->cdev, &ctrldev->dev); |
3133 |
+ put_device(&ctrldev->dev); |
3134 |
+ } |
3135 |
+ |
3136 |
+diff --git a/drivers/s390/scsi/zfcp_fc.c b/drivers/s390/scsi/zfcp_fc.c |
3137 |
+index d24cafe02708f..511bf8e0a436c 100644 |
3138 |
+--- a/drivers/s390/scsi/zfcp_fc.c |
3139 |
++++ b/drivers/s390/scsi/zfcp_fc.c |
3140 |
+@@ -521,6 +521,8 @@ static void zfcp_fc_adisc_handler(void *data) |
3141 |
+ goto out; |
3142 |
+ } |
3143 |
+ |
3144 |
++ /* re-init to undo drop from zfcp_fc_adisc() */ |
3145 |
++ port->d_id = ntoh24(adisc_resp->adisc_port_id); |
3146 |
+ /* port is good, unblock rport without going through erp */ |
3147 |
+ zfcp_scsi_schedule_rport_register(port); |
3148 |
+ out: |
3149 |
+@@ -534,6 +536,7 @@ static int zfcp_fc_adisc(struct zfcp_port *port) |
3150 |
+ struct zfcp_fc_req *fc_req; |
3151 |
+ struct zfcp_adapter *adapter = port->adapter; |
3152 |
+ struct Scsi_Host *shost = adapter->scsi_host; |
3153 |
++ u32 d_id; |
3154 |
+ int ret; |
3155 |
+ |
3156 |
+ fc_req = kmem_cache_zalloc(zfcp_fc_req_cache, GFP_ATOMIC); |
3157 |
+@@ -558,7 +561,15 @@ static int zfcp_fc_adisc(struct zfcp_port *port) |
3158 |
+ fc_req->u.adisc.req.adisc_cmd = ELS_ADISC; |
3159 |
+ hton24(fc_req->u.adisc.req.adisc_port_id, fc_host_port_id(shost)); |
3160 |
+ |
3161 |
+- ret = zfcp_fsf_send_els(adapter, port->d_id, &fc_req->ct_els, |
3162 |
++ d_id = port->d_id; /* remember as destination for send els below */ |
3163 |
++ /* |
3164 |
++ * Force fresh GID_PN lookup on next port recovery. |
3165 |
++ * Must happen after request setup and before sending request, |
3166 |
++ * to prevent race with port->d_id re-init in zfcp_fc_adisc_handler(). |
3167 |
++ */ |
3168 |
++ port->d_id = 0; |
3169 |
++ |
3170 |
++ ret = zfcp_fsf_send_els(adapter, d_id, &fc_req->ct_els, |
3171 |
+ ZFCP_FC_CTELS_TMO); |
3172 |
+ if (ret) |
3173 |
+ kmem_cache_free(zfcp_fc_req_cache, fc_req); |
3174 |
+diff --git a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c |
3175 |
+index 8863a74e6c57d..a8ce854c46847 100644 |
3176 |
+--- a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c |
3177 |
++++ b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c |
3178 |
+@@ -82,7 +82,7 @@ static int bnx2fc_bind_pcidev(struct bnx2fc_hba *hba); |
3179 |
+ static void bnx2fc_unbind_pcidev(struct bnx2fc_hba *hba); |
3180 |
+ static struct fc_lport *bnx2fc_if_create(struct bnx2fc_interface *interface, |
3181 |
+ struct device *parent, int npiv); |
3182 |
+-static void bnx2fc_destroy_work(struct work_struct *work); |
3183 |
++static void bnx2fc_port_destroy(struct fcoe_port *port); |
3184 |
+ |
3185 |
+ static struct bnx2fc_hba *bnx2fc_hba_lookup(struct net_device *phys_dev); |
3186 |
+ static struct bnx2fc_interface *bnx2fc_interface_lookup(struct net_device |
3187 |
+@@ -907,9 +907,6 @@ static void bnx2fc_indicate_netevent(void *context, unsigned long event, |
3188 |
+ __bnx2fc_destroy(interface); |
3189 |
+ } |
3190 |
+ mutex_unlock(&bnx2fc_dev_lock); |
3191 |
+- |
3192 |
+- /* Ensure ALL destroy work has been completed before return */ |
3193 |
+- flush_workqueue(bnx2fc_wq); |
3194 |
+ return; |
3195 |
+ |
3196 |
+ default: |
3197 |
+@@ -1215,8 +1212,8 @@ static int bnx2fc_vport_destroy(struct fc_vport *vport) |
3198 |
+ mutex_unlock(&n_port->lp_mutex); |
3199 |
+ bnx2fc_free_vport(interface->hba, port->lport); |
3200 |
+ bnx2fc_port_shutdown(port->lport); |
3201 |
++ bnx2fc_port_destroy(port); |
3202 |
+ bnx2fc_interface_put(interface); |
3203 |
+- queue_work(bnx2fc_wq, &port->destroy_work); |
3204 |
+ return 0; |
3205 |
+ } |
3206 |
+ |
3207 |
+@@ -1525,7 +1522,6 @@ static struct fc_lport *bnx2fc_if_create(struct bnx2fc_interface *interface, |
3208 |
+ port->lport = lport; |
3209 |
+ port->priv = interface; |
3210 |
+ port->get_netdev = bnx2fc_netdev; |
3211 |
+- INIT_WORK(&port->destroy_work, bnx2fc_destroy_work); |
3212 |
+ |
3213 |
+ /* Configure fcoe_port */ |
3214 |
+ rc = bnx2fc_lport_config(lport); |
3215 |
+@@ -1653,8 +1649,8 @@ static void __bnx2fc_destroy(struct bnx2fc_interface *interface) |
3216 |
+ bnx2fc_interface_cleanup(interface); |
3217 |
+ bnx2fc_stop(interface); |
3218 |
+ list_del(&interface->list); |
3219 |
++ bnx2fc_port_destroy(port); |
3220 |
+ bnx2fc_interface_put(interface); |
3221 |
+- queue_work(bnx2fc_wq, &port->destroy_work); |
3222 |
+ } |
3223 |
+ |
3224 |
+ /** |
3225 |
+@@ -1694,15 +1690,12 @@ netdev_err: |
3226 |
+ return rc; |
3227 |
+ } |
3228 |
+ |
3229 |
+-static void bnx2fc_destroy_work(struct work_struct *work) |
3230 |
++static void bnx2fc_port_destroy(struct fcoe_port *port) |
3231 |
+ { |
3232 |
+- struct fcoe_port *port; |
3233 |
+ struct fc_lport *lport; |
3234 |
+ |
3235 |
+- port = container_of(work, struct fcoe_port, destroy_work); |
3236 |
+ lport = port->lport; |
3237 |
+- |
3238 |
+- BNX2FC_HBA_DBG(lport, "Entered bnx2fc_destroy_work\n"); |
3239 |
++ BNX2FC_HBA_DBG(lport, "Entered %s, destroying lport %p\n", __func__, lport); |
3240 |
+ |
3241 |
+ bnx2fc_if_destroy(lport); |
3242 |
+ } |
3243 |
+@@ -2556,9 +2549,6 @@ static void bnx2fc_ulp_exit(struct cnic_dev *dev) |
3244 |
+ __bnx2fc_destroy(interface); |
3245 |
+ mutex_unlock(&bnx2fc_dev_lock); |
3246 |
+ |
3247 |
+- /* Ensure ALL destroy work has been completed before return */ |
3248 |
+- flush_workqueue(bnx2fc_wq); |
3249 |
+- |
3250 |
+ bnx2fc_ulp_stop(hba); |
3251 |
+ /* unregister cnic device */ |
3252 |
+ if (test_and_clear_bit(BNX2FC_CNIC_REGISTERED, &hba->reg_with_cnic)) |
3253 |
+diff --git a/drivers/scsi/elx/libefc/efc_els.c b/drivers/scsi/elx/libefc/efc_els.c |
3254 |
+index 24db0accb256e..5f690378fe9a9 100644 |
3255 |
+--- a/drivers/scsi/elx/libefc/efc_els.c |
3256 |
++++ b/drivers/scsi/elx/libefc/efc_els.c |
3257 |
+@@ -46,18 +46,14 @@ efc_els_io_alloc_size(struct efc_node *node, u32 reqlen, u32 rsplen) |
3258 |
+ |
3259 |
+ efc = node->efc; |
3260 |
+ |
3261 |
+- spin_lock_irqsave(&node->els_ios_lock, flags); |
3262 |
+- |
3263 |
+ if (!node->els_io_enabled) { |
3264 |
+ efc_log_err(efc, "els io alloc disabled\n"); |
3265 |
+- spin_unlock_irqrestore(&node->els_ios_lock, flags); |
3266 |
+ return NULL; |
3267 |
+ } |
3268 |
+ |
3269 |
+ els = mempool_alloc(efc->els_io_pool, GFP_ATOMIC); |
3270 |
+ if (!els) { |
3271 |
+ atomic_add_return(1, &efc->els_io_alloc_failed_count); |
3272 |
+- spin_unlock_irqrestore(&node->els_ios_lock, flags); |
3273 |
+ return NULL; |
3274 |
+ } |
3275 |
+ |
3276 |
+@@ -74,7 +70,6 @@ efc_els_io_alloc_size(struct efc_node *node, u32 reqlen, u32 rsplen) |
3277 |
+ &els->io.req.phys, GFP_DMA); |
3278 |
+ if (!els->io.req.virt) { |
3279 |
+ mempool_free(els, efc->els_io_pool); |
3280 |
+- spin_unlock_irqrestore(&node->els_ios_lock, flags); |
3281 |
+ return NULL; |
3282 |
+ } |
3283 |
+ |
3284 |
+@@ -94,10 +89,11 @@ efc_els_io_alloc_size(struct efc_node *node, u32 reqlen, u32 rsplen) |
3285 |
+ |
3286 |
+ /* add els structure to ELS IO list */ |
3287 |
+ INIT_LIST_HEAD(&els->list_entry); |
3288 |
++ spin_lock_irqsave(&node->els_ios_lock, flags); |
3289 |
+ list_add_tail(&els->list_entry, &node->els_ios_list); |
3290 |
++ spin_unlock_irqrestore(&node->els_ios_lock, flags); |
3291 |
+ } |
3292 |
+ |
3293 |
+- spin_unlock_irqrestore(&node->els_ios_lock, flags); |
3294 |
+ return els; |
3295 |
+ } |
3296 |
+ |
3297 |
+diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c |
3298 |
+index 1d92d2a848894..09a14f7c79f40 100644 |
3299 |
+--- a/drivers/tty/n_gsm.c |
3300 |
++++ b/drivers/tty/n_gsm.c |
3301 |
+@@ -318,6 +318,7 @@ static struct tty_driver *gsm_tty_driver; |
3302 |
+ #define GSM1_ESCAPE_BITS 0x20 |
3303 |
+ #define XON 0x11 |
3304 |
+ #define XOFF 0x13 |
3305 |
++#define ISO_IEC_646_MASK 0x7F |
3306 |
+ |
3307 |
+ static const struct tty_port_operations gsm_port_ops; |
3308 |
+ |
3309 |
+@@ -527,7 +528,8 @@ static int gsm_stuff_frame(const u8 *input, u8 *output, int len) |
3310 |
+ int olen = 0; |
3311 |
+ while (len--) { |
3312 |
+ if (*input == GSM1_SOF || *input == GSM1_ESCAPE |
3313 |
+- || *input == XON || *input == XOFF) { |
3314 |
++ || (*input & ISO_IEC_646_MASK) == XON |
3315 |
++ || (*input & ISO_IEC_646_MASK) == XOFF) { |
3316 |
+ *output++ = GSM1_ESCAPE; |
3317 |
+ *output++ = *input++ ^ GSM1_ESCAPE_BITS; |
3318 |
+ olen++; |
3319 |
+diff --git a/drivers/tty/serial/8250/8250_of.c b/drivers/tty/serial/8250/8250_of.c |
3320 |
+index bce28729dd7bd..be8626234627e 100644 |
3321 |
+--- a/drivers/tty/serial/8250/8250_of.c |
3322 |
++++ b/drivers/tty/serial/8250/8250_of.c |
3323 |
+@@ -83,8 +83,17 @@ static int of_platform_serial_setup(struct platform_device *ofdev, |
3324 |
+ port->mapsize = resource_size(&resource); |
3325 |
+ |
3326 |
+ /* Check for shifted address mapping */ |
3327 |
+- if (of_property_read_u32(np, "reg-offset", &prop) == 0) |
3328 |
++ if (of_property_read_u32(np, "reg-offset", &prop) == 0) { |
3329 |
++ if (prop >= port->mapsize) { |
3330 |
++ dev_warn(&ofdev->dev, "reg-offset %u exceeds region size %pa\n", |
3331 |
++ prop, &port->mapsize); |
3332 |
++ ret = -EINVAL; |
3333 |
++ goto err_unprepare; |
3334 |
++ } |
3335 |
++ |
3336 |
+ port->mapbase += prop; |
3337 |
++ port->mapsize -= prop; |
3338 |
++ } |
3339 |
+ |
3340 |
+ port->iotype = UPIO_MEM; |
3341 |
+ if (of_property_read_u32(np, "reg-io-width", &prop) == 0) { |
3342 |
+diff --git a/drivers/tty/serial/8250/8250_pci.c b/drivers/tty/serial/8250/8250_pci.c |
3343 |
+index f7d89440076a1..114a49da564a9 100644 |
3344 |
+--- a/drivers/tty/serial/8250/8250_pci.c |
3345 |
++++ b/drivers/tty/serial/8250/8250_pci.c |
3346 |
+@@ -5203,8 +5203,30 @@ static const struct pci_device_id serial_pci_tbl[] = { |
3347 |
+ { PCI_VENDOR_ID_INTASHIELD, PCI_DEVICE_ID_INTASHIELD_IS400, |
3348 |
+ PCI_ANY_ID, PCI_ANY_ID, 0, 0, /* 135a.0dc0 */ |
3349 |
+ pbn_b2_4_115200 }, |
3350 |
++ /* Brainboxes Devices */ |
3351 |
+ /* |
3352 |
+- * BrainBoxes UC-260 |
3353 |
++ * Brainboxes UC-101 |
3354 |
++ */ |
3355 |
++ { PCI_VENDOR_ID_INTASHIELD, 0x0BA1, |
3356 |
++ PCI_ANY_ID, PCI_ANY_ID, |
3357 |
++ 0, 0, |
3358 |
++ pbn_b2_2_115200 }, |
3359 |
++ /* |
3360 |
++ * Brainboxes UC-235/246 |
3361 |
++ */ |
3362 |
++ { PCI_VENDOR_ID_INTASHIELD, 0x0AA1, |
3363 |
++ PCI_ANY_ID, PCI_ANY_ID, |
3364 |
++ 0, 0, |
3365 |
++ pbn_b2_1_115200 }, |
3366 |
++ /* |
3367 |
++ * Brainboxes UC-257 |
3368 |
++ */ |
3369 |
++ { PCI_VENDOR_ID_INTASHIELD, 0x0861, |
3370 |
++ PCI_ANY_ID, PCI_ANY_ID, |
3371 |
++ 0, 0, |
3372 |
++ pbn_b2_2_115200 }, |
3373 |
++ /* |
3374 |
++ * Brainboxes UC-260/271/701/756 |
3375 |
+ */ |
3376 |
+ { PCI_VENDOR_ID_INTASHIELD, 0x0D21, |
3377 |
+ PCI_ANY_ID, PCI_ANY_ID, |
3378 |
+@@ -5212,7 +5234,81 @@ static const struct pci_device_id serial_pci_tbl[] = { |
3379 |
+ pbn_b2_4_115200 }, |
3380 |
+ { PCI_VENDOR_ID_INTASHIELD, 0x0E34, |
3381 |
+ PCI_ANY_ID, PCI_ANY_ID, |
3382 |
+- PCI_CLASS_COMMUNICATION_MULTISERIAL << 8, 0xffff00, |
3383 |
++ PCI_CLASS_COMMUNICATION_MULTISERIAL << 8, 0xffff00, |
3384 |
++ pbn_b2_4_115200 }, |
3385 |
++ /* |
3386 |
++ * Brainboxes UC-268 |
3387 |
++ */ |
3388 |
++ { PCI_VENDOR_ID_INTASHIELD, 0x0841, |
3389 |
++ PCI_ANY_ID, PCI_ANY_ID, |
3390 |
++ 0, 0, |
3391 |
++ pbn_b2_4_115200 }, |
3392 |
++ /* |
3393 |
++ * Brainboxes UC-275/279 |
3394 |
++ */ |
3395 |
++ { PCI_VENDOR_ID_INTASHIELD, 0x0881, |
3396 |
++ PCI_ANY_ID, PCI_ANY_ID, |
3397 |
++ 0, 0, |
3398 |
++ pbn_b2_8_115200 }, |
3399 |
++ /* |
3400 |
++ * Brainboxes UC-302 |
3401 |
++ */ |
3402 |
++ { PCI_VENDOR_ID_INTASHIELD, 0x08E1, |
3403 |
++ PCI_ANY_ID, PCI_ANY_ID, |
3404 |
++ 0, 0, |
3405 |
++ pbn_b2_2_115200 }, |
3406 |
++ /* |
3407 |
++ * Brainboxes UC-310 |
3408 |
++ */ |
3409 |
++ { PCI_VENDOR_ID_INTASHIELD, 0x08C1, |
3410 |
++ PCI_ANY_ID, PCI_ANY_ID, |
3411 |
++ 0, 0, |
3412 |
++ pbn_b2_2_115200 }, |
3413 |
++ /* |
3414 |
++ * Brainboxes UC-313 |
3415 |
++ */ |
3416 |
++ { PCI_VENDOR_ID_INTASHIELD, 0x08A3, |
3417 |
++ PCI_ANY_ID, PCI_ANY_ID, |
3418 |
++ 0, 0, |
3419 |
++ pbn_b2_2_115200 }, |
3420 |
++ /* |
3421 |
++ * Brainboxes UC-320/324 |
3422 |
++ */ |
3423 |
++ { PCI_VENDOR_ID_INTASHIELD, 0x0A61, |
3424 |
++ PCI_ANY_ID, PCI_ANY_ID, |
3425 |
++ 0, 0, |
3426 |
++ pbn_b2_1_115200 }, |
3427 |
++ /* |
3428 |
++ * Brainboxes UC-346 |
3429 |
++ */ |
3430 |
++ { PCI_VENDOR_ID_INTASHIELD, 0x0B02, |
3431 |
++ PCI_ANY_ID, PCI_ANY_ID, |
3432 |
++ 0, 0, |
3433 |
++ pbn_b2_4_115200 }, |
3434 |
++ /* |
3435 |
++ * Brainboxes UC-357 |
3436 |
++ */ |
3437 |
++ { PCI_VENDOR_ID_INTASHIELD, 0x0A81, |
3438 |
++ PCI_ANY_ID, PCI_ANY_ID, |
3439 |
++ 0, 0, |
3440 |
++ pbn_b2_2_115200 }, |
3441 |
++ { PCI_VENDOR_ID_INTASHIELD, 0x0A83, |
3442 |
++ PCI_ANY_ID, PCI_ANY_ID, |
3443 |
++ 0, 0, |
3444 |
++ pbn_b2_2_115200 }, |
3445 |
++ /* |
3446 |
++ * Brainboxes UC-368 |
3447 |
++ */ |
3448 |
++ { PCI_VENDOR_ID_INTASHIELD, 0x0C41, |
3449 |
++ PCI_ANY_ID, PCI_ANY_ID, |
3450 |
++ 0, 0, |
3451 |
++ pbn_b2_4_115200 }, |
3452 |
++ /* |
3453 |
++ * Brainboxes UC-420/431 |
3454 |
++ */ |
3455 |
++ { PCI_VENDOR_ID_INTASHIELD, 0x0921, |
3456 |
++ PCI_ANY_ID, PCI_ANY_ID, |
3457 |
++ 0, 0, |
3458 |
+ pbn_b2_4_115200 }, |
3459 |
+ /* |
3460 |
+ * Perle PCI-RAS cards |
3461 |
+diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c |
3462 |
+index 6ec34260d6b18..da54f827c5efc 100644 |
3463 |
+--- a/drivers/tty/serial/amba-pl011.c |
3464 |
++++ b/drivers/tty/serial/amba-pl011.c |
3465 |
+@@ -1615,8 +1615,12 @@ static void pl011_set_mctrl(struct uart_port *port, unsigned int mctrl) |
3466 |
+ container_of(port, struct uart_amba_port, port); |
3467 |
+ unsigned int cr; |
3468 |
+ |
3469 |
+- if (port->rs485.flags & SER_RS485_ENABLED) |
3470 |
+- mctrl &= ~TIOCM_RTS; |
3471 |
++ if (port->rs485.flags & SER_RS485_ENABLED) { |
3472 |
++ if (port->rs485.flags & SER_RS485_RTS_AFTER_SEND) |
3473 |
++ mctrl &= ~TIOCM_RTS; |
3474 |
++ else |
3475 |
++ mctrl |= TIOCM_RTS; |
3476 |
++ } |
3477 |
+ |
3478 |
+ cr = pl011_read(uap, REG_CR); |
3479 |
+ |
3480 |
+diff --git a/drivers/tty/serial/stm32-usart.c b/drivers/tty/serial/stm32-usart.c |
3481 |
+index 3366914dad7a8..200cd293d14d5 100644 |
3482 |
+--- a/drivers/tty/serial/stm32-usart.c |
3483 |
++++ b/drivers/tty/serial/stm32-usart.c |
3484 |
+@@ -575,7 +575,7 @@ static void stm32_usart_start_tx(struct uart_port *port) |
3485 |
+ struct serial_rs485 *rs485conf = &port->rs485; |
3486 |
+ struct circ_buf *xmit = &port->state->xmit; |
3487 |
+ |
3488 |
+- if (uart_circ_empty(xmit)) |
3489 |
++ if (uart_circ_empty(xmit) && !port->x_char) |
3490 |
+ return; |
3491 |
+ |
3492 |
+ if (rs485conf->flags & SER_RS485_ENABLED) { |
3493 |
+diff --git a/drivers/usb/cdns3/drd.c b/drivers/usb/cdns3/drd.c |
3494 |
+index 55c73b1d87047..d00ff98dffabf 100644 |
3495 |
+--- a/drivers/usb/cdns3/drd.c |
3496 |
++++ b/drivers/usb/cdns3/drd.c |
3497 |
+@@ -483,11 +483,11 @@ int cdns_drd_exit(struct cdns *cdns) |
3498 |
+ /* Indicate the cdns3 core was power lost before */ |
3499 |
+ bool cdns_power_is_lost(struct cdns *cdns) |
3500 |
+ { |
3501 |
+- if (cdns->version == CDNS3_CONTROLLER_V1) { |
3502 |
+- if (!(readl(&cdns->otg_v1_regs->simulate) & BIT(0))) |
3503 |
++ if (cdns->version == CDNS3_CONTROLLER_V0) { |
3504 |
++ if (!(readl(&cdns->otg_v0_regs->simulate) & BIT(0))) |
3505 |
+ return true; |
3506 |
+ } else { |
3507 |
+- if (!(readl(&cdns->otg_v0_regs->simulate) & BIT(0))) |
3508 |
++ if (!(readl(&cdns->otg_v1_regs->simulate) & BIT(0))) |
3509 |
+ return true; |
3510 |
+ } |
3511 |
+ return false; |
3512 |
+diff --git a/drivers/usb/common/ulpi.c b/drivers/usb/common/ulpi.c |
3513 |
+index 4169cf40a03b5..8f8405b0d6080 100644 |
3514 |
+--- a/drivers/usb/common/ulpi.c |
3515 |
++++ b/drivers/usb/common/ulpi.c |
3516 |
+@@ -39,8 +39,11 @@ static int ulpi_match(struct device *dev, struct device_driver *driver) |
3517 |
+ struct ulpi *ulpi = to_ulpi_dev(dev); |
3518 |
+ const struct ulpi_device_id *id; |
3519 |
+ |
3520 |
+- /* Some ULPI devices don't have a vendor id so rely on OF match */ |
3521 |
+- if (ulpi->id.vendor == 0) |
3522 |
++ /* |
3523 |
++ * Some ULPI devices don't have a vendor id |
3524 |
++ * or provide an id_table so rely on OF match. |
3525 |
++ */ |
3526 |
++ if (ulpi->id.vendor == 0 || !drv->id_table) |
3527 |
+ return of_driver_match_device(dev, driver); |
3528 |
+ |
3529 |
+ for (id = drv->id_table; id->vendor; id++) |
3530 |
+diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c |
3531 |
+index 16bab98261272..dd3c288fa952f 100644 |
3532 |
+--- a/drivers/usb/core/hcd.c |
3533 |
++++ b/drivers/usb/core/hcd.c |
3534 |
+@@ -1563,6 +1563,13 @@ int usb_hcd_submit_urb (struct urb *urb, gfp_t mem_flags) |
3535 |
+ urb->hcpriv = NULL; |
3536 |
+ INIT_LIST_HEAD(&urb->urb_list); |
3537 |
+ atomic_dec(&urb->use_count); |
3538 |
++ /* |
3539 |
++ * Order the write of urb->use_count above before the read |
3540 |
++ * of urb->reject below. Pairs with the memory barriers in |
3541 |
++ * usb_kill_urb() and usb_poison_urb(). |
3542 |
++ */ |
3543 |
++ smp_mb__after_atomic(); |
3544 |
++ |
3545 |
+ atomic_dec(&urb->dev->urbnum); |
3546 |
+ if (atomic_read(&urb->reject)) |
3547 |
+ wake_up(&usb_kill_urb_queue); |
3548 |
+@@ -1665,6 +1672,13 @@ static void __usb_hcd_giveback_urb(struct urb *urb) |
3549 |
+ |
3550 |
+ usb_anchor_resume_wakeups(anchor); |
3551 |
+ atomic_dec(&urb->use_count); |
3552 |
++ /* |
3553 |
++ * Order the write of urb->use_count above before the read |
3554 |
++ * of urb->reject below. Pairs with the memory barriers in |
3555 |
++ * usb_kill_urb() and usb_poison_urb(). |
3556 |
++ */ |
3557 |
++ smp_mb__after_atomic(); |
3558 |
++ |
3559 |
+ if (unlikely(atomic_read(&urb->reject))) |
3560 |
+ wake_up(&usb_kill_urb_queue); |
3561 |
+ usb_put_urb(urb); |
3562 |
+diff --git a/drivers/usb/core/urb.c b/drivers/usb/core/urb.c |
3563 |
+index 30727729a44cc..33d62d7e3929f 100644 |
3564 |
+--- a/drivers/usb/core/urb.c |
3565 |
++++ b/drivers/usb/core/urb.c |
3566 |
+@@ -715,6 +715,12 @@ void usb_kill_urb(struct urb *urb) |
3567 |
+ if (!(urb && urb->dev && urb->ep)) |
3568 |
+ return; |
3569 |
+ atomic_inc(&urb->reject); |
3570 |
++ /* |
3571 |
++ * Order the write of urb->reject above before the read |
3572 |
++ * of urb->use_count below. Pairs with the barriers in |
3573 |
++ * __usb_hcd_giveback_urb() and usb_hcd_submit_urb(). |
3574 |
++ */ |
3575 |
++ smp_mb__after_atomic(); |
3576 |
+ |
3577 |
+ usb_hcd_unlink_urb(urb, -ENOENT); |
3578 |
+ wait_event(usb_kill_urb_queue, atomic_read(&urb->use_count) == 0); |
3579 |
+@@ -756,6 +762,12 @@ void usb_poison_urb(struct urb *urb) |
3580 |
+ if (!urb) |
3581 |
+ return; |
3582 |
+ atomic_inc(&urb->reject); |
3583 |
++ /* |
3584 |
++ * Order the write of urb->reject above before the read |
3585 |
++ * of urb->use_count below. Pairs with the barriers in |
3586 |
++ * __usb_hcd_giveback_urb() and usb_hcd_submit_urb(). |
3587 |
++ */ |
3588 |
++ smp_mb__after_atomic(); |
3589 |
+ |
3590 |
+ if (!urb->dev || !urb->ep) |
3591 |
+ return; |
3592 |
+diff --git a/drivers/usb/dwc3/dwc3-xilinx.c b/drivers/usb/dwc3/dwc3-xilinx.c |
3593 |
+index 9cc3ad701a295..a6f3a9b38789e 100644 |
3594 |
+--- a/drivers/usb/dwc3/dwc3-xilinx.c |
3595 |
++++ b/drivers/usb/dwc3/dwc3-xilinx.c |
3596 |
+@@ -99,17 +99,29 @@ static int dwc3_xlnx_init_zynqmp(struct dwc3_xlnx *priv_data) |
3597 |
+ struct device *dev = priv_data->dev; |
3598 |
+ struct reset_control *crst, *hibrst, *apbrst; |
3599 |
+ struct phy *usb3_phy; |
3600 |
+- int ret; |
3601 |
++ int ret = 0; |
3602 |
+ u32 reg; |
3603 |
+ |
3604 |
+- usb3_phy = devm_phy_get(dev, "usb3-phy"); |
3605 |
+- if (PTR_ERR(usb3_phy) == -EPROBE_DEFER) { |
3606 |
+- ret = -EPROBE_DEFER; |
3607 |
++ usb3_phy = devm_phy_optional_get(dev, "usb3-phy"); |
3608 |
++ if (IS_ERR(usb3_phy)) { |
3609 |
++ ret = PTR_ERR(usb3_phy); |
3610 |
++ dev_err_probe(dev, ret, |
3611 |
++ "failed to get USB3 PHY\n"); |
3612 |
+ goto err; |
3613 |
+- } else if (IS_ERR(usb3_phy)) { |
3614 |
+- usb3_phy = NULL; |
3615 |
+ } |
3616 |
+ |
3617 |
++ /* |
3618 |
++ * The following core resets are not required unless a USB3 PHY |
3619 |
++ * is used, and the subsequent register settings are not required |
3620 |
++ * unless a core reset is performed (they should be set properly |
3621 |
++ * by the first-stage boot loader, but may be reverted by a core |
3622 |
++ * reset). They may also break the configuration if USB3 is actually |
3623 |
++ * in use but the usb3-phy entry is missing from the device tree. |
3624 |
++ * Therefore, skip these operations in this case. |
3625 |
++ */ |
3626 |
++ if (!usb3_phy) |
3627 |
++ goto skip_usb3_phy; |
3628 |
++ |
3629 |
+ crst = devm_reset_control_get_exclusive(dev, "usb_crst"); |
3630 |
+ if (IS_ERR(crst)) { |
3631 |
+ ret = PTR_ERR(crst); |
3632 |
+@@ -188,6 +200,7 @@ static int dwc3_xlnx_init_zynqmp(struct dwc3_xlnx *priv_data) |
3633 |
+ goto err; |
3634 |
+ } |
3635 |
+ |
3636 |
++skip_usb3_phy: |
3637 |
+ /* |
3638 |
+ * This routes the USB DMA traffic to go through FPD path instead |
3639 |
+ * of reaching DDR directly. This traffic routing is needed to |
3640 |
+diff --git a/drivers/usb/gadget/function/f_sourcesink.c b/drivers/usb/gadget/function/f_sourcesink.c |
3641 |
+index 1abf08e5164af..6803cd60cc6dc 100644 |
3642 |
+--- a/drivers/usb/gadget/function/f_sourcesink.c |
3643 |
++++ b/drivers/usb/gadget/function/f_sourcesink.c |
3644 |
+@@ -584,6 +584,7 @@ static int source_sink_start_ep(struct f_sourcesink *ss, bool is_in, |
3645 |
+ |
3646 |
+ if (is_iso) { |
3647 |
+ switch (speed) { |
3648 |
++ case USB_SPEED_SUPER_PLUS: |
3649 |
+ case USB_SPEED_SUPER: |
3650 |
+ size = ss->isoc_maxpacket * |
3651 |
+ (ss->isoc_mult + 1) * |
3652 |
+diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c |
3653 |
+index c1edcc9b13cec..dc570ce4e8319 100644 |
3654 |
+--- a/drivers/usb/host/xhci-plat.c |
3655 |
++++ b/drivers/usb/host/xhci-plat.c |
3656 |
+@@ -437,6 +437,9 @@ static int __maybe_unused xhci_plat_suspend(struct device *dev) |
3657 |
+ struct xhci_hcd *xhci = hcd_to_xhci(hcd); |
3658 |
+ int ret; |
3659 |
+ |
3660 |
++ if (pm_runtime_suspended(dev)) |
3661 |
++ pm_runtime_resume(dev); |
3662 |
++ |
3663 |
+ ret = xhci_priv_suspend_quirk(hcd); |
3664 |
+ if (ret) |
3665 |
+ return ret; |
3666 |
+diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h |
3667 |
+index 29191d33c0e3e..1a05e3dcfec8a 100644 |
3668 |
+--- a/drivers/usb/storage/unusual_devs.h |
3669 |
++++ b/drivers/usb/storage/unusual_devs.h |
3670 |
+@@ -2301,6 +2301,16 @@ UNUSUAL_DEV( 0x2027, 0xa001, 0x0000, 0x9999, |
3671 |
+ USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_euscsi_init, |
3672 |
+ US_FL_SCM_MULT_TARG ), |
3673 |
+ |
3674 |
++/* |
3675 |
++ * Reported by DocMAX <mail@××××××××××.de> |
3676 |
++ * and Thomas Weißschuh <linux@××××××××××.net> |
3677 |
++ */ |
3678 |
++UNUSUAL_DEV( 0x2109, 0x0715, 0x9999, 0x9999, |
3679 |
++ "VIA Labs, Inc.", |
3680 |
++ "VL817 SATA Bridge", |
3681 |
++ USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
3682 |
++ US_FL_IGNORE_UAS), |
3683 |
++ |
3684 |
+ UNUSUAL_DEV( 0x2116, 0x0320, 0x0001, 0x0001, |
3685 |
+ "ST", |
3686 |
+ "2A", |
3687 |
+diff --git a/drivers/usb/typec/tcpm/tcpci.c b/drivers/usb/typec/tcpm/tcpci.c |
3688 |
+index c15eec9cc460a..7d540afdb7cc3 100644 |
3689 |
+--- a/drivers/usb/typec/tcpm/tcpci.c |
3690 |
++++ b/drivers/usb/typec/tcpm/tcpci.c |
3691 |
+@@ -75,9 +75,25 @@ static int tcpci_write16(struct tcpci *tcpci, unsigned int reg, u16 val) |
3692 |
+ static int tcpci_set_cc(struct tcpc_dev *tcpc, enum typec_cc_status cc) |
3693 |
+ { |
3694 |
+ struct tcpci *tcpci = tcpc_to_tcpci(tcpc); |
3695 |
++ bool vconn_pres; |
3696 |
++ enum typec_cc_polarity polarity = TYPEC_POLARITY_CC1; |
3697 |
+ unsigned int reg; |
3698 |
+ int ret; |
3699 |
+ |
3700 |
++ ret = regmap_read(tcpci->regmap, TCPC_POWER_STATUS, ®); |
3701 |
++ if (ret < 0) |
3702 |
++ return ret; |
3703 |
++ |
3704 |
++ vconn_pres = !!(reg & TCPC_POWER_STATUS_VCONN_PRES); |
3705 |
++ if (vconn_pres) { |
3706 |
++ ret = regmap_read(tcpci->regmap, TCPC_TCPC_CTRL, ®); |
3707 |
++ if (ret < 0) |
3708 |
++ return ret; |
3709 |
++ |
3710 |
++ if (reg & TCPC_TCPC_CTRL_ORIENTATION) |
3711 |
++ polarity = TYPEC_POLARITY_CC2; |
3712 |
++ } |
3713 |
++ |
3714 |
+ switch (cc) { |
3715 |
+ case TYPEC_CC_RA: |
3716 |
+ reg = (TCPC_ROLE_CTRL_CC_RA << TCPC_ROLE_CTRL_CC1_SHIFT) | |
3717 |
+@@ -112,6 +128,16 @@ static int tcpci_set_cc(struct tcpc_dev *tcpc, enum typec_cc_status cc) |
3718 |
+ break; |
3719 |
+ } |
3720 |
+ |
3721 |
++ if (vconn_pres) { |
3722 |
++ if (polarity == TYPEC_POLARITY_CC2) { |
3723 |
++ reg &= ~(TCPC_ROLE_CTRL_CC1_MASK << TCPC_ROLE_CTRL_CC1_SHIFT); |
3724 |
++ reg |= (TCPC_ROLE_CTRL_CC_OPEN << TCPC_ROLE_CTRL_CC1_SHIFT); |
3725 |
++ } else { |
3726 |
++ reg &= ~(TCPC_ROLE_CTRL_CC2_MASK << TCPC_ROLE_CTRL_CC2_SHIFT); |
3727 |
++ reg |= (TCPC_ROLE_CTRL_CC_OPEN << TCPC_ROLE_CTRL_CC2_SHIFT); |
3728 |
++ } |
3729 |
++ } |
3730 |
++ |
3731 |
+ ret = regmap_write(tcpci->regmap, TCPC_ROLE_CTRL, reg); |
3732 |
+ if (ret < 0) |
3733 |
+ return ret; |
3734 |
+diff --git a/drivers/usb/typec/tcpm/tcpci.h b/drivers/usb/typec/tcpm/tcpci.h |
3735 |
+index 2be7a77d400ef..b2edd45f13c68 100644 |
3736 |
+--- a/drivers/usb/typec/tcpm/tcpci.h |
3737 |
++++ b/drivers/usb/typec/tcpm/tcpci.h |
3738 |
+@@ -98,6 +98,7 @@ |
3739 |
+ #define TCPC_POWER_STATUS_SOURCING_VBUS BIT(4) |
3740 |
+ #define TCPC_POWER_STATUS_VBUS_DET BIT(3) |
3741 |
+ #define TCPC_POWER_STATUS_VBUS_PRES BIT(2) |
3742 |
++#define TCPC_POWER_STATUS_VCONN_PRES BIT(1) |
3743 |
+ #define TCPC_POWER_STATUS_SINKING_VBUS BIT(0) |
3744 |
+ |
3745 |
+ #define TCPC_FAULT_STATUS 0x1f |
3746 |
+diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c |
3747 |
+index 59d4fa2443f2b..5fce795b69c7f 100644 |
3748 |
+--- a/drivers/usb/typec/tcpm/tcpm.c |
3749 |
++++ b/drivers/usb/typec/tcpm/tcpm.c |
3750 |
+@@ -5156,7 +5156,8 @@ static void _tcpm_pd_vbus_off(struct tcpm_port *port) |
3751 |
+ case SNK_TRYWAIT_DEBOUNCE: |
3752 |
+ break; |
3753 |
+ case SNK_ATTACH_WAIT: |
3754 |
+- tcpm_set_state(port, SNK_UNATTACHED, 0); |
3755 |
++ case SNK_DEBOUNCED: |
3756 |
++ /* Do nothing, as TCPM is still waiting for vbus to reaach VSAFE5V to connect */ |
3757 |
+ break; |
3758 |
+ |
3759 |
+ case SNK_NEGOTIATE_CAPABILITIES: |
3760 |
+@@ -5263,6 +5264,10 @@ static void _tcpm_pd_vbus_vsafe0v(struct tcpm_port *port) |
3761 |
+ case PR_SWAP_SNK_SRC_SOURCE_ON: |
3762 |
+ /* Do nothing, vsafe0v is expected during transition */ |
3763 |
+ break; |
3764 |
++ case SNK_ATTACH_WAIT: |
3765 |
++ case SNK_DEBOUNCED: |
3766 |
++ /*Do nothing, still waiting for VSAFE5V for connect */ |
3767 |
++ break; |
3768 |
+ default: |
3769 |
+ if (port->pwr_role == TYPEC_SINK && port->auto_vbus_discharge_enabled) |
3770 |
+ tcpm_set_state(port, SNK_UNATTACHED, 0); |
3771 |
+diff --git a/drivers/usb/typec/ucsi/ucsi_ccg.c b/drivers/usb/typec/ucsi/ucsi_ccg.c |
3772 |
+index bff96d64dddff..6db7c8ddd51cd 100644 |
3773 |
+--- a/drivers/usb/typec/ucsi/ucsi_ccg.c |
3774 |
++++ b/drivers/usb/typec/ucsi/ucsi_ccg.c |
3775 |
+@@ -325,7 +325,7 @@ static int ucsi_ccg_init(struct ucsi_ccg *uc) |
3776 |
+ if (status < 0) |
3777 |
+ return status; |
3778 |
+ |
3779 |
+- if (!data) |
3780 |
++ if (!(data & DEV_INT)) |
3781 |
+ return 0; |
3782 |
+ |
3783 |
+ status = ccg_write(uc, CCGX_RAB_INTR_REG, &data, sizeof(data)); |
3784 |
+diff --git a/drivers/video/fbdev/hyperv_fb.c b/drivers/video/fbdev/hyperv_fb.c |
3785 |
+index 23999df527393..c8e0ea27caf1d 100644 |
3786 |
+--- a/drivers/video/fbdev/hyperv_fb.c |
3787 |
++++ b/drivers/video/fbdev/hyperv_fb.c |
3788 |
+@@ -287,8 +287,6 @@ struct hvfb_par { |
3789 |
+ |
3790 |
+ static uint screen_width = HVFB_WIDTH; |
3791 |
+ static uint screen_height = HVFB_HEIGHT; |
3792 |
+-static uint screen_width_max = HVFB_WIDTH; |
3793 |
+-static uint screen_height_max = HVFB_HEIGHT; |
3794 |
+ static uint screen_depth; |
3795 |
+ static uint screen_fb_size; |
3796 |
+ static uint dio_fb_size; /* FB size for deferred IO */ |
3797 |
+@@ -582,7 +580,6 @@ static int synthvid_get_supported_resolution(struct hv_device *hdev) |
3798 |
+ int ret = 0; |
3799 |
+ unsigned long t; |
3800 |
+ u8 index; |
3801 |
+- int i; |
3802 |
+ |
3803 |
+ memset(msg, 0, sizeof(struct synthvid_msg)); |
3804 |
+ msg->vid_hdr.type = SYNTHVID_RESOLUTION_REQUEST; |
3805 |
+@@ -613,13 +610,6 @@ static int synthvid_get_supported_resolution(struct hv_device *hdev) |
3806 |
+ goto out; |
3807 |
+ } |
3808 |
+ |
3809 |
+- for (i = 0; i < msg->resolution_resp.resolution_count; i++) { |
3810 |
+- screen_width_max = max_t(unsigned int, screen_width_max, |
3811 |
+- msg->resolution_resp.supported_resolution[i].width); |
3812 |
+- screen_height_max = max_t(unsigned int, screen_height_max, |
3813 |
+- msg->resolution_resp.supported_resolution[i].height); |
3814 |
+- } |
3815 |
+- |
3816 |
+ screen_width = |
3817 |
+ msg->resolution_resp.supported_resolution[index].width; |
3818 |
+ screen_height = |
3819 |
+@@ -941,7 +931,7 @@ static void hvfb_get_option(struct fb_info *info) |
3820 |
+ |
3821 |
+ if (x < HVFB_WIDTH_MIN || y < HVFB_HEIGHT_MIN || |
3822 |
+ (synthvid_ver_ge(par->synthvid_version, SYNTHVID_VERSION_WIN10) && |
3823 |
+- (x > screen_width_max || y > screen_height_max)) || |
3824 |
++ (x * y * screen_depth / 8 > screen_fb_size)) || |
3825 |
+ (par->synthvid_version == SYNTHVID_VERSION_WIN8 && |
3826 |
+ x * y * screen_depth / 8 > SYNTHVID_FB_SIZE_WIN8) || |
3827 |
+ (par->synthvid_version == SYNTHVID_VERSION_WIN7 && |
3828 |
+@@ -1194,8 +1184,8 @@ static int hvfb_probe(struct hv_device *hdev, |
3829 |
+ } |
3830 |
+ |
3831 |
+ hvfb_get_option(info); |
3832 |
+- pr_info("Screen resolution: %dx%d, Color depth: %d\n", |
3833 |
+- screen_width, screen_height, screen_depth); |
3834 |
++ pr_info("Screen resolution: %dx%d, Color depth: %d, Frame buffer size: %d\n", |
3835 |
++ screen_width, screen_height, screen_depth, screen_fb_size); |
3836 |
+ |
3837 |
+ ret = hvfb_getmem(hdev, info); |
3838 |
+ if (ret) { |
3839 |
+diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c |
3840 |
+index cc61813213d83..0b6b9c3283ff0 100644 |
3841 |
+--- a/fs/btrfs/ioctl.c |
3842 |
++++ b/fs/btrfs/ioctl.c |
3843 |
+@@ -3098,10 +3098,8 @@ static noinline int btrfs_ioctl_snap_destroy(struct file *file, |
3844 |
+ btrfs_inode_lock(inode, 0); |
3845 |
+ err = btrfs_delete_subvolume(dir, dentry); |
3846 |
+ btrfs_inode_unlock(inode, 0); |
3847 |
+- if (!err) { |
3848 |
+- fsnotify_rmdir(dir, dentry); |
3849 |
+- d_delete(dentry); |
3850 |
+- } |
3851 |
++ if (!err) |
3852 |
++ d_delete_notify(dir, dentry); |
3853 |
+ |
3854 |
+ out_dput: |
3855 |
+ dput(dentry); |
3856 |
+diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c |
3857 |
+index 8be4da2e2b826..09900a9015ea6 100644 |
3858 |
+--- a/fs/ceph/caps.c |
3859 |
++++ b/fs/ceph/caps.c |
3860 |
+@@ -2217,6 +2217,7 @@ static int unsafe_request_wait(struct inode *inode) |
3861 |
+ struct ceph_mds_client *mdsc = ceph_sb_to_client(inode->i_sb)->mdsc; |
3862 |
+ struct ceph_inode_info *ci = ceph_inode(inode); |
3863 |
+ struct ceph_mds_request *req1 = NULL, *req2 = NULL; |
3864 |
++ unsigned int max_sessions; |
3865 |
+ int ret, err = 0; |
3866 |
+ |
3867 |
+ spin_lock(&ci->i_unsafe_lock); |
3868 |
+@@ -2234,37 +2235,45 @@ static int unsafe_request_wait(struct inode *inode) |
3869 |
+ } |
3870 |
+ spin_unlock(&ci->i_unsafe_lock); |
3871 |
+ |
3872 |
++ /* |
3873 |
++ * The mdsc->max_sessions is unlikely to be changed |
3874 |
++ * mostly, here we will retry it by reallocating the |
3875 |
++ * sessions array memory to get rid of the mdsc->mutex |
3876 |
++ * lock. |
3877 |
++ */ |
3878 |
++retry: |
3879 |
++ max_sessions = mdsc->max_sessions; |
3880 |
++ |
3881 |
+ /* |
3882 |
+ * Trigger to flush the journal logs in all the relevant MDSes |
3883 |
+ * manually, or in the worst case we must wait at most 5 seconds |
3884 |
+ * to wait the journal logs to be flushed by the MDSes periodically. |
3885 |
+ */ |
3886 |
+- if (req1 || req2) { |
3887 |
++ if ((req1 || req2) && likely(max_sessions)) { |
3888 |
+ struct ceph_mds_session **sessions = NULL; |
3889 |
+ struct ceph_mds_session *s; |
3890 |
+ struct ceph_mds_request *req; |
3891 |
+- unsigned int max; |
3892 |
+ int i; |
3893 |
+ |
3894 |
+- /* |
3895 |
+- * The mdsc->max_sessions is unlikely to be changed |
3896 |
+- * mostly, here we will retry it by reallocating the |
3897 |
+- * sessions arrary memory to get rid of the mdsc->mutex |
3898 |
+- * lock. |
3899 |
+- */ |
3900 |
+-retry: |
3901 |
+- max = mdsc->max_sessions; |
3902 |
+- sessions = krealloc(sessions, max * sizeof(s), __GFP_ZERO); |
3903 |
+- if (!sessions) |
3904 |
+- return -ENOMEM; |
3905 |
++ sessions = kzalloc(max_sessions * sizeof(s), GFP_KERNEL); |
3906 |
++ if (!sessions) { |
3907 |
++ err = -ENOMEM; |
3908 |
++ goto out; |
3909 |
++ } |
3910 |
+ |
3911 |
+ spin_lock(&ci->i_unsafe_lock); |
3912 |
+ if (req1) { |
3913 |
+ list_for_each_entry(req, &ci->i_unsafe_dirops, |
3914 |
+ r_unsafe_dir_item) { |
3915 |
+ s = req->r_session; |
3916 |
+- if (unlikely(s->s_mds >= max)) { |
3917 |
++ if (unlikely(s->s_mds >= max_sessions)) { |
3918 |
+ spin_unlock(&ci->i_unsafe_lock); |
3919 |
++ for (i = 0; i < max_sessions; i++) { |
3920 |
++ s = sessions[i]; |
3921 |
++ if (s) |
3922 |
++ ceph_put_mds_session(s); |
3923 |
++ } |
3924 |
++ kfree(sessions); |
3925 |
+ goto retry; |
3926 |
+ } |
3927 |
+ if (!sessions[s->s_mds]) { |
3928 |
+@@ -2277,8 +2286,14 @@ retry: |
3929 |
+ list_for_each_entry(req, &ci->i_unsafe_iops, |
3930 |
+ r_unsafe_target_item) { |
3931 |
+ s = req->r_session; |
3932 |
+- if (unlikely(s->s_mds >= max)) { |
3933 |
++ if (unlikely(s->s_mds >= max_sessions)) { |
3934 |
+ spin_unlock(&ci->i_unsafe_lock); |
3935 |
++ for (i = 0; i < max_sessions; i++) { |
3936 |
++ s = sessions[i]; |
3937 |
++ if (s) |
3938 |
++ ceph_put_mds_session(s); |
3939 |
++ } |
3940 |
++ kfree(sessions); |
3941 |
+ goto retry; |
3942 |
+ } |
3943 |
+ if (!sessions[s->s_mds]) { |
3944 |
+@@ -2299,7 +2314,7 @@ retry: |
3945 |
+ spin_unlock(&ci->i_ceph_lock); |
3946 |
+ |
3947 |
+ /* send flush mdlog request to MDSes */ |
3948 |
+- for (i = 0; i < max; i++) { |
3949 |
++ for (i = 0; i < max_sessions; i++) { |
3950 |
+ s = sessions[i]; |
3951 |
+ if (s) { |
3952 |
+ send_flush_mdlog(s); |
3953 |
+@@ -2316,15 +2331,19 @@ retry: |
3954 |
+ ceph_timeout_jiffies(req1->r_timeout)); |
3955 |
+ if (ret) |
3956 |
+ err = -EIO; |
3957 |
+- ceph_mdsc_put_request(req1); |
3958 |
+ } |
3959 |
+ if (req2) { |
3960 |
+ ret = !wait_for_completion_timeout(&req2->r_safe_completion, |
3961 |
+ ceph_timeout_jiffies(req2->r_timeout)); |
3962 |
+ if (ret) |
3963 |
+ err = -EIO; |
3964 |
+- ceph_mdsc_put_request(req2); |
3965 |
+ } |
3966 |
++ |
3967 |
++out: |
3968 |
++ if (req1) |
3969 |
++ ceph_mdsc_put_request(req1); |
3970 |
++ if (req2) |
3971 |
++ ceph_mdsc_put_request(req2); |
3972 |
+ return err; |
3973 |
+ } |
3974 |
+ |
3975 |
+diff --git a/fs/ceph/file.c b/fs/ceph/file.c |
3976 |
+index e873c2ba7a7ff..6180df6f8e61e 100644 |
3977 |
+--- a/fs/ceph/file.c |
3978 |
++++ b/fs/ceph/file.c |
3979 |
+@@ -577,6 +577,7 @@ static int ceph_finish_async_create(struct inode *dir, struct dentry *dentry, |
3980 |
+ struct ceph_inode_info *ci = ceph_inode(dir); |
3981 |
+ struct inode *inode; |
3982 |
+ struct timespec64 now; |
3983 |
++ struct ceph_string *pool_ns; |
3984 |
+ struct ceph_mds_client *mdsc = ceph_sb_to_mdsc(dir->i_sb); |
3985 |
+ struct ceph_vino vino = { .ino = req->r_deleg_ino, |
3986 |
+ .snap = CEPH_NOSNAP }; |
3987 |
+@@ -626,6 +627,12 @@ static int ceph_finish_async_create(struct inode *dir, struct dentry *dentry, |
3988 |
+ in.max_size = cpu_to_le64(lo->stripe_unit); |
3989 |
+ |
3990 |
+ ceph_file_layout_to_legacy(lo, &in.layout); |
3991 |
++ /* lo is private, so pool_ns can't change */ |
3992 |
++ pool_ns = rcu_dereference_raw(lo->pool_ns); |
3993 |
++ if (pool_ns) { |
3994 |
++ iinfo.pool_ns_len = pool_ns->len; |
3995 |
++ iinfo.pool_ns_data = pool_ns->str; |
3996 |
++ } |
3997 |
+ |
3998 |
+ down_read(&mdsc->snap_rwsem); |
3999 |
+ ret = ceph_fill_inode(inode, NULL, &iinfo, NULL, req->r_session, |
4000 |
+@@ -744,8 +751,10 @@ retry: |
4001 |
+ restore_deleg_ino(dir, req->r_deleg_ino); |
4002 |
+ ceph_mdsc_put_request(req); |
4003 |
+ try_async = false; |
4004 |
++ ceph_put_string(rcu_dereference_raw(lo.pool_ns)); |
4005 |
+ goto retry; |
4006 |
+ } |
4007 |
++ ceph_put_string(rcu_dereference_raw(lo.pool_ns)); |
4008 |
+ goto out_req; |
4009 |
+ } |
4010 |
+ } |
4011 |
+diff --git a/fs/configfs/dir.c b/fs/configfs/dir.c |
4012 |
+index 1466b5d01cbb9..d3cd2a94d1e8c 100644 |
4013 |
+--- a/fs/configfs/dir.c |
4014 |
++++ b/fs/configfs/dir.c |
4015 |
+@@ -1780,8 +1780,8 @@ void configfs_unregister_group(struct config_group *group) |
4016 |
+ configfs_detach_group(&group->cg_item); |
4017 |
+ d_inode(dentry)->i_flags |= S_DEAD; |
4018 |
+ dont_mount(dentry); |
4019 |
++ d_drop(dentry); |
4020 |
+ fsnotify_rmdir(d_inode(parent), dentry); |
4021 |
+- d_delete(dentry); |
4022 |
+ inode_unlock(d_inode(parent)); |
4023 |
+ |
4024 |
+ dput(dentry); |
4025 |
+@@ -1922,10 +1922,10 @@ void configfs_unregister_subsystem(struct configfs_subsystem *subsys) |
4026 |
+ configfs_detach_group(&group->cg_item); |
4027 |
+ d_inode(dentry)->i_flags |= S_DEAD; |
4028 |
+ dont_mount(dentry); |
4029 |
+- fsnotify_rmdir(d_inode(root), dentry); |
4030 |
+ inode_unlock(d_inode(dentry)); |
4031 |
+ |
4032 |
+- d_delete(dentry); |
4033 |
++ d_drop(dentry); |
4034 |
++ fsnotify_rmdir(d_inode(root), dentry); |
4035 |
+ |
4036 |
+ inode_unlock(d_inode(root)); |
4037 |
+ |
4038 |
+diff --git a/fs/devpts/inode.c b/fs/devpts/inode.c |
4039 |
+index 42e5a766d33c7..4f25015aa5342 100644 |
4040 |
+--- a/fs/devpts/inode.c |
4041 |
++++ b/fs/devpts/inode.c |
4042 |
+@@ -621,8 +621,8 @@ void devpts_pty_kill(struct dentry *dentry) |
4043 |
+ |
4044 |
+ dentry->d_fsdata = NULL; |
4045 |
+ drop_nlink(dentry->d_inode); |
4046 |
+- fsnotify_unlink(d_inode(dentry->d_parent), dentry); |
4047 |
+ d_drop(dentry); |
4048 |
++ fsnotify_unlink(d_inode(dentry->d_parent), dentry); |
4049 |
+ dput(dentry); /* d_alloc_name() in devpts_pty_new() */ |
4050 |
+ } |
4051 |
+ |
4052 |
+diff --git a/fs/io_uring.c b/fs/io_uring.c |
4053 |
+index f713b91537f41..993913c585fbf 100644 |
4054 |
+--- a/fs/io_uring.c |
4055 |
++++ b/fs/io_uring.c |
4056 |
+@@ -7718,10 +7718,15 @@ static void io_rsrc_node_ref_zero(struct percpu_ref *ref) |
4057 |
+ struct io_ring_ctx *ctx = node->rsrc_data->ctx; |
4058 |
+ unsigned long flags; |
4059 |
+ bool first_add = false; |
4060 |
++ unsigned long delay = HZ; |
4061 |
+ |
4062 |
+ spin_lock_irqsave(&ctx->rsrc_ref_lock, flags); |
4063 |
+ node->done = true; |
4064 |
+ |
4065 |
++ /* if we are mid-quiesce then do not delay */ |
4066 |
++ if (node->rsrc_data->quiesce) |
4067 |
++ delay = 0; |
4068 |
++ |
4069 |
+ while (!list_empty(&ctx->rsrc_ref_list)) { |
4070 |
+ node = list_first_entry(&ctx->rsrc_ref_list, |
4071 |
+ struct io_rsrc_node, node); |
4072 |
+@@ -7734,7 +7739,7 @@ static void io_rsrc_node_ref_zero(struct percpu_ref *ref) |
4073 |
+ spin_unlock_irqrestore(&ctx->rsrc_ref_lock, flags); |
4074 |
+ |
4075 |
+ if (first_add) |
4076 |
+- mod_delayed_work(system_wq, &ctx->rsrc_put_work, HZ); |
4077 |
++ mod_delayed_work(system_wq, &ctx->rsrc_put_work, delay); |
4078 |
+ } |
4079 |
+ |
4080 |
+ static struct io_rsrc_node *io_rsrc_node_alloc(struct io_ring_ctx *ctx) |
4081 |
+diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c |
4082 |
+index 35302bc192eb9..bd9ac98916043 100644 |
4083 |
+--- a/fs/jbd2/journal.c |
4084 |
++++ b/fs/jbd2/journal.c |
4085 |
+@@ -2970,6 +2970,7 @@ struct journal_head *jbd2_journal_grab_journal_head(struct buffer_head *bh) |
4086 |
+ jbd_unlock_bh_journal_head(bh); |
4087 |
+ return jh; |
4088 |
+ } |
4089 |
++EXPORT_SYMBOL(jbd2_journal_grab_journal_head); |
4090 |
+ |
4091 |
+ static void __journal_remove_journal_head(struct buffer_head *bh) |
4092 |
+ { |
4093 |
+@@ -3022,6 +3023,7 @@ void jbd2_journal_put_journal_head(struct journal_head *jh) |
4094 |
+ jbd_unlock_bh_journal_head(bh); |
4095 |
+ } |
4096 |
+ } |
4097 |
++EXPORT_SYMBOL(jbd2_journal_put_journal_head); |
4098 |
+ |
4099 |
+ /* |
4100 |
+ * Initialize jbd inode head |
4101 |
+diff --git a/fs/namei.c b/fs/namei.c |
4102 |
+index 1946d96677908..3bb65f48fe1da 100644 |
4103 |
+--- a/fs/namei.c |
4104 |
++++ b/fs/namei.c |
4105 |
+@@ -3975,13 +3975,12 @@ int vfs_rmdir(struct user_namespace *mnt_userns, struct inode *dir, |
4106 |
+ dentry->d_inode->i_flags |= S_DEAD; |
4107 |
+ dont_mount(dentry); |
4108 |
+ detach_mounts(dentry); |
4109 |
+- fsnotify_rmdir(dir, dentry); |
4110 |
+ |
4111 |
+ out: |
4112 |
+ inode_unlock(dentry->d_inode); |
4113 |
+ dput(dentry); |
4114 |
+ if (!error) |
4115 |
+- d_delete(dentry); |
4116 |
++ d_delete_notify(dir, dentry); |
4117 |
+ return error; |
4118 |
+ } |
4119 |
+ EXPORT_SYMBOL(vfs_rmdir); |
4120 |
+@@ -4103,7 +4102,6 @@ int vfs_unlink(struct user_namespace *mnt_userns, struct inode *dir, |
4121 |
+ if (!error) { |
4122 |
+ dont_mount(dentry); |
4123 |
+ detach_mounts(dentry); |
4124 |
+- fsnotify_unlink(dir, dentry); |
4125 |
+ } |
4126 |
+ } |
4127 |
+ } |
4128 |
+@@ -4111,9 +4109,11 @@ out: |
4129 |
+ inode_unlock(target); |
4130 |
+ |
4131 |
+ /* We don't d_delete() NFS sillyrenamed files--they still exist. */ |
4132 |
+- if (!error && !(dentry->d_flags & DCACHE_NFSFS_RENAMED)) { |
4133 |
++ if (!error && dentry->d_flags & DCACHE_NFSFS_RENAMED) { |
4134 |
++ fsnotify_unlink(dir, dentry); |
4135 |
++ } else if (!error) { |
4136 |
+ fsnotify_link_count(target); |
4137 |
+- d_delete(dentry); |
4138 |
++ d_delete_notify(dir, dentry); |
4139 |
+ } |
4140 |
+ |
4141 |
+ return error; |
4142 |
+diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c |
4143 |
+index 5b68c44848caf..ed79c1bd84a29 100644 |
4144 |
+--- a/fs/nfs/dir.c |
4145 |
++++ b/fs/nfs/dir.c |
4146 |
+@@ -1982,6 +1982,24 @@ out: |
4147 |
+ |
4148 |
+ no_open: |
4149 |
+ res = nfs_lookup(dir, dentry, lookup_flags); |
4150 |
++ if (!res) { |
4151 |
++ inode = d_inode(dentry); |
4152 |
++ if ((lookup_flags & LOOKUP_DIRECTORY) && inode && |
4153 |
++ !S_ISDIR(inode->i_mode)) |
4154 |
++ res = ERR_PTR(-ENOTDIR); |
4155 |
++ else if (inode && S_ISREG(inode->i_mode)) |
4156 |
++ res = ERR_PTR(-EOPENSTALE); |
4157 |
++ } else if (!IS_ERR(res)) { |
4158 |
++ inode = d_inode(res); |
4159 |
++ if ((lookup_flags & LOOKUP_DIRECTORY) && inode && |
4160 |
++ !S_ISDIR(inode->i_mode)) { |
4161 |
++ dput(res); |
4162 |
++ res = ERR_PTR(-ENOTDIR); |
4163 |
++ } else if (inode && S_ISREG(inode->i_mode)) { |
4164 |
++ dput(res); |
4165 |
++ res = ERR_PTR(-EOPENSTALE); |
4166 |
++ } |
4167 |
++ } |
4168 |
+ if (switched) { |
4169 |
+ d_lookup_done(dentry); |
4170 |
+ if (!res) |
4171 |
+@@ -2382,6 +2400,8 @@ nfs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry) |
4172 |
+ |
4173 |
+ trace_nfs_link_enter(inode, dir, dentry); |
4174 |
+ d_drop(dentry); |
4175 |
++ if (S_ISREG(inode->i_mode)) |
4176 |
++ nfs_sync_inode(inode); |
4177 |
+ error = NFS_PROTO(dir)->link(inode, dir, &dentry->d_name); |
4178 |
+ if (error == 0) { |
4179 |
+ ihold(inode); |
4180 |
+@@ -2470,6 +2490,8 @@ int nfs_rename(struct user_namespace *mnt_userns, struct inode *old_dir, |
4181 |
+ } |
4182 |
+ } |
4183 |
+ |
4184 |
++ if (S_ISREG(old_inode->i_mode)) |
4185 |
++ nfs_sync_inode(old_inode); |
4186 |
+ task = nfs_async_rename(old_dir, new_dir, old_dentry, new_dentry, NULL); |
4187 |
+ if (IS_ERR(task)) { |
4188 |
+ error = PTR_ERR(task); |
4189 |
+diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c |
4190 |
+index 5ed04d6be9a59..cb73c12925629 100644 |
4191 |
+--- a/fs/nfsd/nfsctl.c |
4192 |
++++ b/fs/nfsd/nfsctl.c |
4193 |
+@@ -1249,7 +1249,8 @@ static void nfsdfs_remove_file(struct inode *dir, struct dentry *dentry) |
4194 |
+ clear_ncl(d_inode(dentry)); |
4195 |
+ dget(dentry); |
4196 |
+ ret = simple_unlink(dir, dentry); |
4197 |
+- d_delete(dentry); |
4198 |
++ d_drop(dentry); |
4199 |
++ fsnotify_unlink(dir, dentry); |
4200 |
+ dput(dentry); |
4201 |
+ WARN_ON_ONCE(ret); |
4202 |
+ } |
4203 |
+@@ -1340,8 +1341,8 @@ void nfsd_client_rmdir(struct dentry *dentry) |
4204 |
+ dget(dentry); |
4205 |
+ ret = simple_rmdir(dir, dentry); |
4206 |
+ WARN_ON_ONCE(ret); |
4207 |
++ d_drop(dentry); |
4208 |
+ fsnotify_rmdir(dir, dentry); |
4209 |
+- d_delete(dentry); |
4210 |
+ dput(dentry); |
4211 |
+ inode_unlock(dir); |
4212 |
+ } |
4213 |
+diff --git a/fs/ocfs2/suballoc.c b/fs/ocfs2/suballoc.c |
4214 |
+index 481017e1dac5a..166c8918c825a 100644 |
4215 |
+--- a/fs/ocfs2/suballoc.c |
4216 |
++++ b/fs/ocfs2/suballoc.c |
4217 |
+@@ -1251,26 +1251,23 @@ static int ocfs2_test_bg_bit_allocatable(struct buffer_head *bg_bh, |
4218 |
+ { |
4219 |
+ struct ocfs2_group_desc *bg = (struct ocfs2_group_desc *) bg_bh->b_data; |
4220 |
+ struct journal_head *jh; |
4221 |
+- int ret = 1; |
4222 |
++ int ret; |
4223 |
+ |
4224 |
+ if (ocfs2_test_bit(nr, (unsigned long *)bg->bg_bitmap)) |
4225 |
+ return 0; |
4226 |
+ |
4227 |
+- if (!buffer_jbd(bg_bh)) |
4228 |
++ jh = jbd2_journal_grab_journal_head(bg_bh); |
4229 |
++ if (!jh) |
4230 |
+ return 1; |
4231 |
+ |
4232 |
+- jbd_lock_bh_journal_head(bg_bh); |
4233 |
+- if (buffer_jbd(bg_bh)) { |
4234 |
+- jh = bh2jh(bg_bh); |
4235 |
+- spin_lock(&jh->b_state_lock); |
4236 |
+- bg = (struct ocfs2_group_desc *) jh->b_committed_data; |
4237 |
+- if (bg) |
4238 |
+- ret = !ocfs2_test_bit(nr, (unsigned long *)bg->bg_bitmap); |
4239 |
+- else |
4240 |
+- ret = 1; |
4241 |
+- spin_unlock(&jh->b_state_lock); |
4242 |
+- } |
4243 |
+- jbd_unlock_bh_journal_head(bg_bh); |
4244 |
++ spin_lock(&jh->b_state_lock); |
4245 |
++ bg = (struct ocfs2_group_desc *) jh->b_committed_data; |
4246 |
++ if (bg) |
4247 |
++ ret = !ocfs2_test_bit(nr, (unsigned long *)bg->bg_bitmap); |
4248 |
++ else |
4249 |
++ ret = 1; |
4250 |
++ spin_unlock(&jh->b_state_lock); |
4251 |
++ jbd2_journal_put_journal_head(jh); |
4252 |
+ |
4253 |
+ return ret; |
4254 |
+ } |
4255 |
+diff --git a/fs/udf/inode.c b/fs/udf/inode.c |
4256 |
+index 1d6b7a50736ba..ea8f6cd01f501 100644 |
4257 |
+--- a/fs/udf/inode.c |
4258 |
++++ b/fs/udf/inode.c |
4259 |
+@@ -258,10 +258,6 @@ int udf_expand_file_adinicb(struct inode *inode) |
4260 |
+ char *kaddr; |
4261 |
+ struct udf_inode_info *iinfo = UDF_I(inode); |
4262 |
+ int err; |
4263 |
+- struct writeback_control udf_wbc = { |
4264 |
+- .sync_mode = WB_SYNC_NONE, |
4265 |
+- .nr_to_write = 1, |
4266 |
+- }; |
4267 |
+ |
4268 |
+ WARN_ON_ONCE(!inode_is_locked(inode)); |
4269 |
+ if (!iinfo->i_lenAlloc) { |
4270 |
+@@ -305,8 +301,10 @@ int udf_expand_file_adinicb(struct inode *inode) |
4271 |
+ iinfo->i_alloc_type = ICBTAG_FLAG_AD_LONG; |
4272 |
+ /* from now on we have normal address_space methods */ |
4273 |
+ inode->i_data.a_ops = &udf_aops; |
4274 |
++ set_page_dirty(page); |
4275 |
++ unlock_page(page); |
4276 |
+ up_write(&iinfo->i_data_sem); |
4277 |
+- err = inode->i_data.a_ops->writepage(page, &udf_wbc); |
4278 |
++ err = filemap_fdatawrite(inode->i_mapping); |
4279 |
+ if (err) { |
4280 |
+ /* Restore everything back so that we don't lose data... */ |
4281 |
+ lock_page(page); |
4282 |
+@@ -317,6 +315,7 @@ int udf_expand_file_adinicb(struct inode *inode) |
4283 |
+ unlock_page(page); |
4284 |
+ iinfo->i_alloc_type = ICBTAG_FLAG_AD_IN_ICB; |
4285 |
+ inode->i_data.a_ops = &udf_adinicb_aops; |
4286 |
++ iinfo->i_lenAlloc = inode->i_size; |
4287 |
+ up_write(&iinfo->i_data_sem); |
4288 |
+ } |
4289 |
+ put_page(page); |
4290 |
+diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h |
4291 |
+index 0a9fdcbbab83d..be8e7a55d803c 100644 |
4292 |
+--- a/include/linux/blkdev.h |
4293 |
++++ b/include/linux/blkdev.h |
4294 |
+@@ -1947,6 +1947,7 @@ unsigned long disk_start_io_acct(struct gendisk *disk, unsigned int sectors, |
4295 |
+ void disk_end_io_acct(struct gendisk *disk, unsigned int op, |
4296 |
+ unsigned long start_time); |
4297 |
+ |
4298 |
++void bio_start_io_acct_time(struct bio *bio, unsigned long start_time); |
4299 |
+ unsigned long bio_start_io_acct(struct bio *bio); |
4300 |
+ void bio_end_io_acct_remapped(struct bio *bio, unsigned long start_time, |
4301 |
+ struct block_device *orig_bdev); |
4302 |
+diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h |
4303 |
+index 12d3a7d308ab9..a9477c14fad5c 100644 |
4304 |
+--- a/include/linux/fsnotify.h |
4305 |
++++ b/include/linux/fsnotify.h |
4306 |
+@@ -212,6 +212,42 @@ static inline void fsnotify_link(struct inode *dir, struct inode *inode, |
4307 |
+ fsnotify_name(dir, FS_CREATE, inode, &new_dentry->d_name, 0); |
4308 |
+ } |
4309 |
+ |
4310 |
++/* |
4311 |
++ * fsnotify_delete - @dentry was unlinked and unhashed |
4312 |
++ * |
4313 |
++ * Caller must make sure that dentry->d_name is stable. |
4314 |
++ * |
4315 |
++ * Note: unlike fsnotify_unlink(), we have to pass also the unlinked inode |
4316 |
++ * as this may be called after d_delete() and old_dentry may be negative. |
4317 |
++ */ |
4318 |
++static inline void fsnotify_delete(struct inode *dir, struct inode *inode, |
4319 |
++ struct dentry *dentry) |
4320 |
++{ |
4321 |
++ __u32 mask = FS_DELETE; |
4322 |
++ |
4323 |
++ if (S_ISDIR(inode->i_mode)) |
4324 |
++ mask |= FS_ISDIR; |
4325 |
++ |
4326 |
++ fsnotify_name(dir, mask, inode, &dentry->d_name, 0); |
4327 |
++} |
4328 |
++ |
4329 |
++/** |
4330 |
++ * d_delete_notify - delete a dentry and call fsnotify_delete() |
4331 |
++ * @dentry: The dentry to delete |
4332 |
++ * |
4333 |
++ * This helper is used to guaranty that the unlinked inode cannot be found |
4334 |
++ * by lookup of this name after fsnotify_delete() event has been delivered. |
4335 |
++ */ |
4336 |
++static inline void d_delete_notify(struct inode *dir, struct dentry *dentry) |
4337 |
++{ |
4338 |
++ struct inode *inode = d_inode(dentry); |
4339 |
++ |
4340 |
++ ihold(inode); |
4341 |
++ d_delete(dentry); |
4342 |
++ fsnotify_delete(dir, inode, dentry); |
4343 |
++ iput(inode); |
4344 |
++} |
4345 |
++ |
4346 |
+ /* |
4347 |
+ * fsnotify_unlink - 'name' was unlinked |
4348 |
+ * |
4349 |
+@@ -219,10 +255,10 @@ static inline void fsnotify_link(struct inode *dir, struct inode *inode, |
4350 |
+ */ |
4351 |
+ static inline void fsnotify_unlink(struct inode *dir, struct dentry *dentry) |
4352 |
+ { |
4353 |
+- /* Expected to be called before d_delete() */ |
4354 |
+- WARN_ON_ONCE(d_is_negative(dentry)); |
4355 |
++ if (WARN_ON_ONCE(d_is_negative(dentry))) |
4356 |
++ return; |
4357 |
+ |
4358 |
+- fsnotify_dirent(dir, dentry, FS_DELETE); |
4359 |
++ fsnotify_delete(dir, d_inode(dentry), dentry); |
4360 |
+ } |
4361 |
+ |
4362 |
+ /* |
4363 |
+@@ -242,10 +278,10 @@ static inline void fsnotify_mkdir(struct inode *inode, struct dentry *dentry) |
4364 |
+ */ |
4365 |
+ static inline void fsnotify_rmdir(struct inode *dir, struct dentry *dentry) |
4366 |
+ { |
4367 |
+- /* Expected to be called before d_delete() */ |
4368 |
+- WARN_ON_ONCE(d_is_negative(dentry)); |
4369 |
++ if (WARN_ON_ONCE(d_is_negative(dentry))) |
4370 |
++ return; |
4371 |
+ |
4372 |
+- fsnotify_dirent(dir, dentry, FS_DELETE | FS_ISDIR); |
4373 |
++ fsnotify_delete(dir, d_inode(dentry), dentry); |
4374 |
+ } |
4375 |
+ |
4376 |
+ /* |
4377 |
+diff --git a/include/linux/mm.h b/include/linux/mm.h |
4378 |
+index 73a52aba448f9..90c2d7f3c7a88 100644 |
4379 |
+--- a/include/linux/mm.h |
4380 |
++++ b/include/linux/mm.h |
4381 |
+@@ -1511,11 +1511,18 @@ static inline u8 page_kasan_tag(const struct page *page) |
4382 |
+ |
4383 |
+ static inline void page_kasan_tag_set(struct page *page, u8 tag) |
4384 |
+ { |
4385 |
+- if (kasan_enabled()) { |
4386 |
+- tag ^= 0xff; |
4387 |
+- page->flags &= ~(KASAN_TAG_MASK << KASAN_TAG_PGSHIFT); |
4388 |
+- page->flags |= (tag & KASAN_TAG_MASK) << KASAN_TAG_PGSHIFT; |
4389 |
+- } |
4390 |
++ unsigned long old_flags, flags; |
4391 |
++ |
4392 |
++ if (!kasan_enabled()) |
4393 |
++ return; |
4394 |
++ |
4395 |
++ tag ^= 0xff; |
4396 |
++ old_flags = READ_ONCE(page->flags); |
4397 |
++ do { |
4398 |
++ flags = old_flags; |
4399 |
++ flags &= ~(KASAN_TAG_MASK << KASAN_TAG_PGSHIFT); |
4400 |
++ flags |= (tag & KASAN_TAG_MASK) << KASAN_TAG_PGSHIFT; |
4401 |
++ } while (unlikely(!try_cmpxchg(&page->flags, &old_flags, flags))); |
4402 |
+ } |
4403 |
+ |
4404 |
+ static inline void page_kasan_tag_reset(struct page *page) |
4405 |
+diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h |
4406 |
+index ce81cc96a98d9..fba54624191a2 100644 |
4407 |
+--- a/include/linux/netdevice.h |
4408 |
++++ b/include/linux/netdevice.h |
4409 |
+@@ -2636,6 +2636,7 @@ struct packet_type { |
4410 |
+ struct net_device *); |
4411 |
+ bool (*id_match)(struct packet_type *ptype, |
4412 |
+ struct sock *sk); |
4413 |
++ struct net *af_packet_net; |
4414 |
+ void *af_packet_priv; |
4415 |
+ struct list_head list; |
4416 |
+ }; |
4417 |
+diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h |
4418 |
+index ae1f0c8b75623..6cce33e7e7acc 100644 |
4419 |
+--- a/include/linux/perf_event.h |
4420 |
++++ b/include/linux/perf_event.h |
4421 |
+@@ -680,18 +680,6 @@ struct perf_event { |
4422 |
+ u64 total_time_running; |
4423 |
+ u64 tstamp; |
4424 |
+ |
4425 |
+- /* |
4426 |
+- * timestamp shadows the actual context timing but it can |
4427 |
+- * be safely used in NMI interrupt context. It reflects the |
4428 |
+- * context time as it was when the event was last scheduled in, |
4429 |
+- * or when ctx_sched_in failed to schedule the event because we |
4430 |
+- * run out of PMC. |
4431 |
+- * |
4432 |
+- * ctx_time already accounts for ctx->timestamp. Therefore to |
4433 |
+- * compute ctx_time for a sample, simply add perf_clock(). |
4434 |
+- */ |
4435 |
+- u64 shadow_ctx_time; |
4436 |
+- |
4437 |
+ struct perf_event_attr attr; |
4438 |
+ u16 header_size; |
4439 |
+ u16 id_header_size; |
4440 |
+@@ -838,6 +826,7 @@ struct perf_event_context { |
4441 |
+ */ |
4442 |
+ u64 time; |
4443 |
+ u64 timestamp; |
4444 |
++ u64 timeoffset; |
4445 |
+ |
4446 |
+ /* |
4447 |
+ * These fields let us detect when two contexts have both |
4448 |
+@@ -920,6 +909,8 @@ struct bpf_perf_event_data_kern { |
4449 |
+ struct perf_cgroup_info { |
4450 |
+ u64 time; |
4451 |
+ u64 timestamp; |
4452 |
++ u64 timeoffset; |
4453 |
++ int active; |
4454 |
+ }; |
4455 |
+ |
4456 |
+ struct perf_cgroup { |
4457 |
+diff --git a/include/linux/psi.h b/include/linux/psi.h |
4458 |
+index 65eb1476ac705..57823b30c2d3d 100644 |
4459 |
+--- a/include/linux/psi.h |
4460 |
++++ b/include/linux/psi.h |
4461 |
+@@ -24,18 +24,17 @@ void psi_memstall_enter(unsigned long *flags); |
4462 |
+ void psi_memstall_leave(unsigned long *flags); |
4463 |
+ |
4464 |
+ int psi_show(struct seq_file *s, struct psi_group *group, enum psi_res res); |
4465 |
+- |
4466 |
+-#ifdef CONFIG_CGROUPS |
4467 |
+-int psi_cgroup_alloc(struct cgroup *cgrp); |
4468 |
+-void psi_cgroup_free(struct cgroup *cgrp); |
4469 |
+-void cgroup_move_task(struct task_struct *p, struct css_set *to); |
4470 |
+- |
4471 |
+ struct psi_trigger *psi_trigger_create(struct psi_group *group, |
4472 |
+ char *buf, size_t nbytes, enum psi_res res); |
4473 |
+-void psi_trigger_replace(void **trigger_ptr, struct psi_trigger *t); |
4474 |
++void psi_trigger_destroy(struct psi_trigger *t); |
4475 |
+ |
4476 |
+ __poll_t psi_trigger_poll(void **trigger_ptr, struct file *file, |
4477 |
+ poll_table *wait); |
4478 |
++ |
4479 |
++#ifdef CONFIG_CGROUPS |
4480 |
++int psi_cgroup_alloc(struct cgroup *cgrp); |
4481 |
++void psi_cgroup_free(struct cgroup *cgrp); |
4482 |
++void cgroup_move_task(struct task_struct *p, struct css_set *to); |
4483 |
+ #endif |
4484 |
+ |
4485 |
+ #else /* CONFIG_PSI */ |
4486 |
+diff --git a/include/linux/psi_types.h b/include/linux/psi_types.h |
4487 |
+index 0819c82dba920..6f190002a2022 100644 |
4488 |
+--- a/include/linux/psi_types.h |
4489 |
++++ b/include/linux/psi_types.h |
4490 |
+@@ -140,9 +140,6 @@ struct psi_trigger { |
4491 |
+ * events to one per window |
4492 |
+ */ |
4493 |
+ u64 last_event_time; |
4494 |
+- |
4495 |
+- /* Refcounting to prevent premature destruction */ |
4496 |
+- struct kref refcount; |
4497 |
+ }; |
4498 |
+ |
4499 |
+ struct psi_group { |
4500 |
+diff --git a/include/linux/usb/role.h b/include/linux/usb/role.h |
4501 |
+index 031f148ab3734..b5deafd91f67b 100644 |
4502 |
+--- a/include/linux/usb/role.h |
4503 |
++++ b/include/linux/usb/role.h |
4504 |
+@@ -91,6 +91,12 @@ fwnode_usb_role_switch_get(struct fwnode_handle *node) |
4505 |
+ |
4506 |
+ static inline void usb_role_switch_put(struct usb_role_switch *sw) { } |
4507 |
+ |
4508 |
++static inline struct usb_role_switch * |
4509 |
++usb_role_switch_find_by_fwnode(const struct fwnode_handle *fwnode) |
4510 |
++{ |
4511 |
++ return NULL; |
4512 |
++} |
4513 |
++ |
4514 |
+ static inline struct usb_role_switch * |
4515 |
+ usb_role_switch_register(struct device *parent, |
4516 |
+ const struct usb_role_switch_desc *desc) |
4517 |
+diff --git a/include/net/addrconf.h b/include/net/addrconf.h |
4518 |
+index 78ea3e332688f..e7ce719838b5e 100644 |
4519 |
+--- a/include/net/addrconf.h |
4520 |
++++ b/include/net/addrconf.h |
4521 |
+@@ -6,6 +6,8 @@ |
4522 |
+ #define RTR_SOLICITATION_INTERVAL (4*HZ) |
4523 |
+ #define RTR_SOLICITATION_MAX_INTERVAL (3600*HZ) /* 1 hour */ |
4524 |
+ |
4525 |
++#define MIN_VALID_LIFETIME (2*3600) /* 2 hours */ |
4526 |
++ |
4527 |
+ #define TEMP_VALID_LIFETIME (7*86400) |
4528 |
+ #define TEMP_PREFERRED_LIFETIME (86400) |
4529 |
+ #define REGEN_MAX_RETRY (3) |
4530 |
+diff --git a/include/net/ip.h b/include/net/ip.h |
4531 |
+index 9192444f2964e..0106c6590ee7b 100644 |
4532 |
+--- a/include/net/ip.h |
4533 |
++++ b/include/net/ip.h |
4534 |
+@@ -520,19 +520,18 @@ static inline void ip_select_ident_segs(struct net *net, struct sk_buff *skb, |
4535 |
+ { |
4536 |
+ struct iphdr *iph = ip_hdr(skb); |
4537 |
+ |
4538 |
++ /* We had many attacks based on IPID, use the private |
4539 |
++ * generator as much as we can. |
4540 |
++ */ |
4541 |
++ if (sk && inet_sk(sk)->inet_daddr) { |
4542 |
++ iph->id = htons(inet_sk(sk)->inet_id); |
4543 |
++ inet_sk(sk)->inet_id += segs; |
4544 |
++ return; |
4545 |
++ } |
4546 |
+ if ((iph->frag_off & htons(IP_DF)) && !skb->ignore_df) { |
4547 |
+- /* This is only to work around buggy Windows95/2000 |
4548 |
+- * VJ compression implementations. If the ID field |
4549 |
+- * does not change, they drop every other packet in |
4550 |
+- * a TCP stream using header compression. |
4551 |
+- */ |
4552 |
+- if (sk && inet_sk(sk)->inet_daddr) { |
4553 |
+- iph->id = htons(inet_sk(sk)->inet_id); |
4554 |
+- inet_sk(sk)->inet_id += segs; |
4555 |
+- } else { |
4556 |
+- iph->id = 0; |
4557 |
+- } |
4558 |
++ iph->id = 0; |
4559 |
+ } else { |
4560 |
++ /* Unfortunately we need the big hammer to get a suitable IPID */ |
4561 |
+ __ip_select_ident(net, iph, segs); |
4562 |
+ } |
4563 |
+ } |
4564 |
+diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h |
4565 |
+index 83b8070d1cc93..c85b040728d7e 100644 |
4566 |
+--- a/include/net/ip6_fib.h |
4567 |
++++ b/include/net/ip6_fib.h |
4568 |
+@@ -281,7 +281,7 @@ static inline bool fib6_get_cookie_safe(const struct fib6_info *f6i, |
4569 |
+ fn = rcu_dereference(f6i->fib6_node); |
4570 |
+ |
4571 |
+ if (fn) { |
4572 |
+- *cookie = fn->fn_sernum; |
4573 |
++ *cookie = READ_ONCE(fn->fn_sernum); |
4574 |
+ /* pairs with smp_wmb() in __fib6_update_sernum_upto_root() */ |
4575 |
+ smp_rmb(); |
4576 |
+ status = true; |
4577 |
+diff --git a/include/net/route.h b/include/net/route.h |
4578 |
+index 2e6c0e153e3a5..2551f3f03b37e 100644 |
4579 |
+--- a/include/net/route.h |
4580 |
++++ b/include/net/route.h |
4581 |
+@@ -369,7 +369,7 @@ static inline struct neighbour *ip_neigh_gw4(struct net_device *dev, |
4582 |
+ { |
4583 |
+ struct neighbour *neigh; |
4584 |
+ |
4585 |
+- neigh = __ipv4_neigh_lookup_noref(dev, daddr); |
4586 |
++ neigh = __ipv4_neigh_lookup_noref(dev, (__force u32)daddr); |
4587 |
+ if (unlikely(!neigh)) |
4588 |
+ neigh = __neigh_create(&arp_tbl, &daddr, dev, false); |
4589 |
+ |
4590 |
+diff --git a/include/trace/events/sunrpc.h b/include/trace/events/sunrpc.h |
4591 |
+index 2d04eb96d4183..daaf407e9e494 100644 |
4592 |
+--- a/include/trace/events/sunrpc.h |
4593 |
++++ b/include/trace/events/sunrpc.h |
4594 |
+@@ -925,18 +925,19 @@ TRACE_EVENT(rpc_socket_nospace, |
4595 |
+ |
4596 |
+ #define rpc_show_xprt_state(x) \ |
4597 |
+ __print_flags(x, "|", \ |
4598 |
+- { (1UL << XPRT_LOCKED), "LOCKED"}, \ |
4599 |
+- { (1UL << XPRT_CONNECTED), "CONNECTED"}, \ |
4600 |
+- { (1UL << XPRT_CONNECTING), "CONNECTING"}, \ |
4601 |
+- { (1UL << XPRT_CLOSE_WAIT), "CLOSE_WAIT"}, \ |
4602 |
+- { (1UL << XPRT_BOUND), "BOUND"}, \ |
4603 |
+- { (1UL << XPRT_BINDING), "BINDING"}, \ |
4604 |
+- { (1UL << XPRT_CLOSING), "CLOSING"}, \ |
4605 |
+- { (1UL << XPRT_OFFLINE), "OFFLINE"}, \ |
4606 |
+- { (1UL << XPRT_REMOVE), "REMOVE"}, \ |
4607 |
+- { (1UL << XPRT_CONGESTED), "CONGESTED"}, \ |
4608 |
+- { (1UL << XPRT_CWND_WAIT), "CWND_WAIT"}, \ |
4609 |
+- { (1UL << XPRT_WRITE_SPACE), "WRITE_SPACE"}) |
4610 |
++ { BIT(XPRT_LOCKED), "LOCKED" }, \ |
4611 |
++ { BIT(XPRT_CONNECTED), "CONNECTED" }, \ |
4612 |
++ { BIT(XPRT_CONNECTING), "CONNECTING" }, \ |
4613 |
++ { BIT(XPRT_CLOSE_WAIT), "CLOSE_WAIT" }, \ |
4614 |
++ { BIT(XPRT_BOUND), "BOUND" }, \ |
4615 |
++ { BIT(XPRT_BINDING), "BINDING" }, \ |
4616 |
++ { BIT(XPRT_CLOSING), "CLOSING" }, \ |
4617 |
++ { BIT(XPRT_OFFLINE), "OFFLINE" }, \ |
4618 |
++ { BIT(XPRT_REMOVE), "REMOVE" }, \ |
4619 |
++ { BIT(XPRT_CONGESTED), "CONGESTED" }, \ |
4620 |
++ { BIT(XPRT_CWND_WAIT), "CWND_WAIT" }, \ |
4621 |
++ { BIT(XPRT_WRITE_SPACE), "WRITE_SPACE" }, \ |
4622 |
++ { BIT(XPRT_SND_IS_COOKIE), "SND_IS_COOKIE" }) |
4623 |
+ |
4624 |
+ DECLARE_EVENT_CLASS(rpc_xprt_lifetime_class, |
4625 |
+ TP_PROTO( |
4626 |
+@@ -1133,8 +1134,11 @@ DECLARE_EVENT_CLASS(xprt_writelock_event, |
4627 |
+ __entry->task_id = -1; |
4628 |
+ __entry->client_id = -1; |
4629 |
+ } |
4630 |
+- __entry->snd_task_id = xprt->snd_task ? |
4631 |
+- xprt->snd_task->tk_pid : -1; |
4632 |
++ if (xprt->snd_task && |
4633 |
++ !test_bit(XPRT_SND_IS_COOKIE, &xprt->state)) |
4634 |
++ __entry->snd_task_id = xprt->snd_task->tk_pid; |
4635 |
++ else |
4636 |
++ __entry->snd_task_id = -1; |
4637 |
+ ), |
4638 |
+ |
4639 |
+ TP_printk("task:%u@%u snd_task:%u", |
4640 |
+@@ -1178,8 +1182,12 @@ DECLARE_EVENT_CLASS(xprt_cong_event, |
4641 |
+ __entry->task_id = -1; |
4642 |
+ __entry->client_id = -1; |
4643 |
+ } |
4644 |
+- __entry->snd_task_id = xprt->snd_task ? |
4645 |
+- xprt->snd_task->tk_pid : -1; |
4646 |
++ if (xprt->snd_task && |
4647 |
++ !test_bit(XPRT_SND_IS_COOKIE, &xprt->state)) |
4648 |
++ __entry->snd_task_id = xprt->snd_task->tk_pid; |
4649 |
++ else |
4650 |
++ __entry->snd_task_id = -1; |
4651 |
++ |
4652 |
+ __entry->cong = xprt->cong; |
4653 |
+ __entry->cwnd = xprt->cwnd; |
4654 |
+ __entry->wait = test_bit(XPRT_CWND_WAIT, &xprt->state); |
4655 |
+diff --git a/include/uapi/linux/cyclades.h b/include/uapi/linux/cyclades.h |
4656 |
+new file mode 100644 |
4657 |
+index 0000000000000..6225c5aebe06a |
4658 |
+--- /dev/null |
4659 |
++++ b/include/uapi/linux/cyclades.h |
4660 |
+@@ -0,0 +1,35 @@ |
4661 |
++/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ |
4662 |
++ |
4663 |
++#ifndef _UAPI_LINUX_CYCLADES_H |
4664 |
++#define _UAPI_LINUX_CYCLADES_H |
4665 |
++ |
4666 |
++#warning "Support for features provided by this header has been removed" |
4667 |
++#warning "Please consider updating your code" |
4668 |
++ |
4669 |
++struct cyclades_monitor { |
4670 |
++ unsigned long int_count; |
4671 |
++ unsigned long char_count; |
4672 |
++ unsigned long char_max; |
4673 |
++ unsigned long char_last; |
4674 |
++}; |
4675 |
++ |
4676 |
++#define CYGETMON 0x435901 |
4677 |
++#define CYGETTHRESH 0x435902 |
4678 |
++#define CYSETTHRESH 0x435903 |
4679 |
++#define CYGETDEFTHRESH 0x435904 |
4680 |
++#define CYSETDEFTHRESH 0x435905 |
4681 |
++#define CYGETTIMEOUT 0x435906 |
4682 |
++#define CYSETTIMEOUT 0x435907 |
4683 |
++#define CYGETDEFTIMEOUT 0x435908 |
4684 |
++#define CYSETDEFTIMEOUT 0x435909 |
4685 |
++#define CYSETRFLOW 0x43590a |
4686 |
++#define CYGETRFLOW 0x43590b |
4687 |
++#define CYSETRTSDTR_INV 0x43590c |
4688 |
++#define CYGETRTSDTR_INV 0x43590d |
4689 |
++#define CYZSETPOLLCYCLE 0x43590e |
4690 |
++#define CYZGETPOLLCYCLE 0x43590f |
4691 |
++#define CYGETCD1400VER 0x435910 |
4692 |
++#define CYSETWAIT 0x435912 |
4693 |
++#define CYGETWAIT 0x435913 |
4694 |
++ |
4695 |
++#endif /* _UAPI_LINUX_CYCLADES_H */ |
4696 |
+diff --git a/kernel/bpf/stackmap.c b/kernel/bpf/stackmap.c |
4697 |
+index 6e75bbee39f0b..0dcaed4d3f4ce 100644 |
4698 |
+--- a/kernel/bpf/stackmap.c |
4699 |
++++ b/kernel/bpf/stackmap.c |
4700 |
+@@ -525,13 +525,14 @@ BPF_CALL_4(bpf_get_task_stack, struct task_struct *, task, void *, buf, |
4701 |
+ u32, size, u64, flags) |
4702 |
+ { |
4703 |
+ struct pt_regs *regs; |
4704 |
+- long res; |
4705 |
++ long res = -EINVAL; |
4706 |
+ |
4707 |
+ if (!try_get_task_stack(task)) |
4708 |
+ return -EFAULT; |
4709 |
+ |
4710 |
+ regs = task_pt_regs(task); |
4711 |
+- res = __bpf_get_stack(regs, task, NULL, buf, size, flags); |
4712 |
++ if (regs) |
4713 |
++ res = __bpf_get_stack(regs, task, NULL, buf, size, flags); |
4714 |
+ put_task_stack(task); |
4715 |
+ |
4716 |
+ return res; |
4717 |
+diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c |
4718 |
+index bb1a78ff14374..de8b4fa1e1fd6 100644 |
4719 |
+--- a/kernel/cgroup/cgroup.c |
4720 |
++++ b/kernel/cgroup/cgroup.c |
4721 |
+@@ -3642,6 +3642,12 @@ static ssize_t cgroup_pressure_write(struct kernfs_open_file *of, char *buf, |
4722 |
+ cgroup_get(cgrp); |
4723 |
+ cgroup_kn_unlock(of->kn); |
4724 |
+ |
4725 |
++ /* Allow only one trigger per file descriptor */ |
4726 |
++ if (ctx->psi.trigger) { |
4727 |
++ cgroup_put(cgrp); |
4728 |
++ return -EBUSY; |
4729 |
++ } |
4730 |
++ |
4731 |
+ psi = cgroup_ino(cgrp) == 1 ? &psi_system : &cgrp->psi; |
4732 |
+ new = psi_trigger_create(psi, buf, nbytes, res); |
4733 |
+ if (IS_ERR(new)) { |
4734 |
+@@ -3649,8 +3655,7 @@ static ssize_t cgroup_pressure_write(struct kernfs_open_file *of, char *buf, |
4735 |
+ return PTR_ERR(new); |
4736 |
+ } |
4737 |
+ |
4738 |
+- psi_trigger_replace(&ctx->psi.trigger, new); |
4739 |
+- |
4740 |
++ smp_store_release(&ctx->psi.trigger, new); |
4741 |
+ cgroup_put(cgrp); |
4742 |
+ |
4743 |
+ return nbytes; |
4744 |
+@@ -3689,7 +3694,7 @@ static void cgroup_pressure_release(struct kernfs_open_file *of) |
4745 |
+ { |
4746 |
+ struct cgroup_file_ctx *ctx = of->priv; |
4747 |
+ |
4748 |
+- psi_trigger_replace(&ctx->psi.trigger, NULL); |
4749 |
++ psi_trigger_destroy(ctx->psi.trigger); |
4750 |
+ } |
4751 |
+ |
4752 |
+ bool cgroup_psi_enabled(void) |
4753 |
+diff --git a/kernel/events/core.c b/kernel/events/core.c |
4754 |
+index 0fe6a65bbd58f..c7581e3fb8ab1 100644 |
4755 |
+--- a/kernel/events/core.c |
4756 |
++++ b/kernel/events/core.c |
4757 |
+@@ -674,6 +674,23 @@ perf_event_set_state(struct perf_event *event, enum perf_event_state state) |
4758 |
+ WRITE_ONCE(event->state, state); |
4759 |
+ } |
4760 |
+ |
4761 |
++/* |
4762 |
++ * UP store-release, load-acquire |
4763 |
++ */ |
4764 |
++ |
4765 |
++#define __store_release(ptr, val) \ |
4766 |
++do { \ |
4767 |
++ barrier(); \ |
4768 |
++ WRITE_ONCE(*(ptr), (val)); \ |
4769 |
++} while (0) |
4770 |
++ |
4771 |
++#define __load_acquire(ptr) \ |
4772 |
++({ \ |
4773 |
++ __unqual_scalar_typeof(*(ptr)) ___p = READ_ONCE(*(ptr)); \ |
4774 |
++ barrier(); \ |
4775 |
++ ___p; \ |
4776 |
++}) |
4777 |
++ |
4778 |
+ #ifdef CONFIG_CGROUP_PERF |
4779 |
+ |
4780 |
+ static inline bool |
4781 |
+@@ -719,34 +736,51 @@ static inline u64 perf_cgroup_event_time(struct perf_event *event) |
4782 |
+ return t->time; |
4783 |
+ } |
4784 |
+ |
4785 |
+-static inline void __update_cgrp_time(struct perf_cgroup *cgrp) |
4786 |
++static inline u64 perf_cgroup_event_time_now(struct perf_event *event, u64 now) |
4787 |
+ { |
4788 |
+- struct perf_cgroup_info *info; |
4789 |
+- u64 now; |
4790 |
+- |
4791 |
+- now = perf_clock(); |
4792 |
++ struct perf_cgroup_info *t; |
4793 |
+ |
4794 |
+- info = this_cpu_ptr(cgrp->info); |
4795 |
++ t = per_cpu_ptr(event->cgrp->info, event->cpu); |
4796 |
++ if (!__load_acquire(&t->active)) |
4797 |
++ return t->time; |
4798 |
++ now += READ_ONCE(t->timeoffset); |
4799 |
++ return now; |
4800 |
++} |
4801 |
+ |
4802 |
+- info->time += now - info->timestamp; |
4803 |
++static inline void __update_cgrp_time(struct perf_cgroup_info *info, u64 now, bool adv) |
4804 |
++{ |
4805 |
++ if (adv) |
4806 |
++ info->time += now - info->timestamp; |
4807 |
+ info->timestamp = now; |
4808 |
++ /* |
4809 |
++ * see update_context_time() |
4810 |
++ */ |
4811 |
++ WRITE_ONCE(info->timeoffset, info->time - info->timestamp); |
4812 |
+ } |
4813 |
+ |
4814 |
+-static inline void update_cgrp_time_from_cpuctx(struct perf_cpu_context *cpuctx) |
4815 |
++static inline void update_cgrp_time_from_cpuctx(struct perf_cpu_context *cpuctx, bool final) |
4816 |
+ { |
4817 |
+ struct perf_cgroup *cgrp = cpuctx->cgrp; |
4818 |
+ struct cgroup_subsys_state *css; |
4819 |
++ struct perf_cgroup_info *info; |
4820 |
+ |
4821 |
+ if (cgrp) { |
4822 |
++ u64 now = perf_clock(); |
4823 |
++ |
4824 |
+ for (css = &cgrp->css; css; css = css->parent) { |
4825 |
+ cgrp = container_of(css, struct perf_cgroup, css); |
4826 |
+- __update_cgrp_time(cgrp); |
4827 |
++ info = this_cpu_ptr(cgrp->info); |
4828 |
++ |
4829 |
++ __update_cgrp_time(info, now, true); |
4830 |
++ if (final) |
4831 |
++ __store_release(&info->active, 0); |
4832 |
+ } |
4833 |
+ } |
4834 |
+ } |
4835 |
+ |
4836 |
+ static inline void update_cgrp_time_from_event(struct perf_event *event) |
4837 |
+ { |
4838 |
++ struct perf_cgroup_info *info; |
4839 |
+ struct perf_cgroup *cgrp; |
4840 |
+ |
4841 |
+ /* |
4842 |
+@@ -760,8 +794,10 @@ static inline void update_cgrp_time_from_event(struct perf_event *event) |
4843 |
+ /* |
4844 |
+ * Do not update time when cgroup is not active |
4845 |
+ */ |
4846 |
+- if (cgroup_is_descendant(cgrp->css.cgroup, event->cgrp->css.cgroup)) |
4847 |
+- __update_cgrp_time(event->cgrp); |
4848 |
++ if (cgroup_is_descendant(cgrp->css.cgroup, event->cgrp->css.cgroup)) { |
4849 |
++ info = this_cpu_ptr(event->cgrp->info); |
4850 |
++ __update_cgrp_time(info, perf_clock(), true); |
4851 |
++ } |
4852 |
+ } |
4853 |
+ |
4854 |
+ static inline void |
4855 |
+@@ -785,7 +821,8 @@ perf_cgroup_set_timestamp(struct task_struct *task, |
4856 |
+ for (css = &cgrp->css; css; css = css->parent) { |
4857 |
+ cgrp = container_of(css, struct perf_cgroup, css); |
4858 |
+ info = this_cpu_ptr(cgrp->info); |
4859 |
+- info->timestamp = ctx->timestamp; |
4860 |
++ __update_cgrp_time(info, ctx->timestamp, false); |
4861 |
++ __store_release(&info->active, 1); |
4862 |
+ } |
4863 |
+ } |
4864 |
+ |
4865 |
+@@ -981,14 +1018,6 @@ out: |
4866 |
+ return ret; |
4867 |
+ } |
4868 |
+ |
4869 |
+-static inline void |
4870 |
+-perf_cgroup_set_shadow_time(struct perf_event *event, u64 now) |
4871 |
+-{ |
4872 |
+- struct perf_cgroup_info *t; |
4873 |
+- t = per_cpu_ptr(event->cgrp->info, event->cpu); |
4874 |
+- event->shadow_ctx_time = now - t->timestamp; |
4875 |
+-} |
4876 |
+- |
4877 |
+ static inline void |
4878 |
+ perf_cgroup_event_enable(struct perf_event *event, struct perf_event_context *ctx) |
4879 |
+ { |
4880 |
+@@ -1066,7 +1095,8 @@ static inline void update_cgrp_time_from_event(struct perf_event *event) |
4881 |
+ { |
4882 |
+ } |
4883 |
+ |
4884 |
+-static inline void update_cgrp_time_from_cpuctx(struct perf_cpu_context *cpuctx) |
4885 |
++static inline void update_cgrp_time_from_cpuctx(struct perf_cpu_context *cpuctx, |
4886 |
++ bool final) |
4887 |
+ { |
4888 |
+ } |
4889 |
+ |
4890 |
+@@ -1098,12 +1128,12 @@ perf_cgroup_switch(struct task_struct *task, struct task_struct *next) |
4891 |
+ { |
4892 |
+ } |
4893 |
+ |
4894 |
+-static inline void |
4895 |
+-perf_cgroup_set_shadow_time(struct perf_event *event, u64 now) |
4896 |
++static inline u64 perf_cgroup_event_time(struct perf_event *event) |
4897 |
+ { |
4898 |
++ return 0; |
4899 |
+ } |
4900 |
+ |
4901 |
+-static inline u64 perf_cgroup_event_time(struct perf_event *event) |
4902 |
++static inline u64 perf_cgroup_event_time_now(struct perf_event *event, u64 now) |
4903 |
+ { |
4904 |
+ return 0; |
4905 |
+ } |
4906 |
+@@ -1525,22 +1555,59 @@ static void perf_unpin_context(struct perf_event_context *ctx) |
4907 |
+ /* |
4908 |
+ * Update the record of the current time in a context. |
4909 |
+ */ |
4910 |
+-static void update_context_time(struct perf_event_context *ctx) |
4911 |
++static void __update_context_time(struct perf_event_context *ctx, bool adv) |
4912 |
+ { |
4913 |
+ u64 now = perf_clock(); |
4914 |
+ |
4915 |
+- ctx->time += now - ctx->timestamp; |
4916 |
++ if (adv) |
4917 |
++ ctx->time += now - ctx->timestamp; |
4918 |
+ ctx->timestamp = now; |
4919 |
++ |
4920 |
++ /* |
4921 |
++ * The above: time' = time + (now - timestamp), can be re-arranged |
4922 |
++ * into: time` = now + (time - timestamp), which gives a single value |
4923 |
++ * offset to compute future time without locks on. |
4924 |
++ * |
4925 |
++ * See perf_event_time_now(), which can be used from NMI context where |
4926 |
++ * it's (obviously) not possible to acquire ctx->lock in order to read |
4927 |
++ * both the above values in a consistent manner. |
4928 |
++ */ |
4929 |
++ WRITE_ONCE(ctx->timeoffset, ctx->time - ctx->timestamp); |
4930 |
++} |
4931 |
++ |
4932 |
++static void update_context_time(struct perf_event_context *ctx) |
4933 |
++{ |
4934 |
++ __update_context_time(ctx, true); |
4935 |
+ } |
4936 |
+ |
4937 |
+ static u64 perf_event_time(struct perf_event *event) |
4938 |
+ { |
4939 |
+ struct perf_event_context *ctx = event->ctx; |
4940 |
+ |
4941 |
++ if (unlikely(!ctx)) |
4942 |
++ return 0; |
4943 |
++ |
4944 |
+ if (is_cgroup_event(event)) |
4945 |
+ return perf_cgroup_event_time(event); |
4946 |
+ |
4947 |
+- return ctx ? ctx->time : 0; |
4948 |
++ return ctx->time; |
4949 |
++} |
4950 |
++ |
4951 |
++static u64 perf_event_time_now(struct perf_event *event, u64 now) |
4952 |
++{ |
4953 |
++ struct perf_event_context *ctx = event->ctx; |
4954 |
++ |
4955 |
++ if (unlikely(!ctx)) |
4956 |
++ return 0; |
4957 |
++ |
4958 |
++ if (is_cgroup_event(event)) |
4959 |
++ return perf_cgroup_event_time_now(event, now); |
4960 |
++ |
4961 |
++ if (!(__load_acquire(&ctx->is_active) & EVENT_TIME)) |
4962 |
++ return ctx->time; |
4963 |
++ |
4964 |
++ now += READ_ONCE(ctx->timeoffset); |
4965 |
++ return now; |
4966 |
+ } |
4967 |
+ |
4968 |
+ static enum event_type_t get_event_type(struct perf_event *event) |
4969 |
+@@ -2346,7 +2413,7 @@ __perf_remove_from_context(struct perf_event *event, |
4970 |
+ |
4971 |
+ if (ctx->is_active & EVENT_TIME) { |
4972 |
+ update_context_time(ctx); |
4973 |
+- update_cgrp_time_from_cpuctx(cpuctx); |
4974 |
++ update_cgrp_time_from_cpuctx(cpuctx, false); |
4975 |
+ } |
4976 |
+ |
4977 |
+ event_sched_out(event, cpuctx, ctx); |
4978 |
+@@ -2357,6 +2424,9 @@ __perf_remove_from_context(struct perf_event *event, |
4979 |
+ list_del_event(event, ctx); |
4980 |
+ |
4981 |
+ if (!ctx->nr_events && ctx->is_active) { |
4982 |
++ if (ctx == &cpuctx->ctx) |
4983 |
++ update_cgrp_time_from_cpuctx(cpuctx, true); |
4984 |
++ |
4985 |
+ ctx->is_active = 0; |
4986 |
+ ctx->rotate_necessary = 0; |
4987 |
+ if (ctx->task) { |
4988 |
+@@ -2388,7 +2458,11 @@ static void perf_remove_from_context(struct perf_event *event, unsigned long fla |
4989 |
+ * event_function_call() user. |
4990 |
+ */ |
4991 |
+ raw_spin_lock_irq(&ctx->lock); |
4992 |
+- if (!ctx->is_active) { |
4993 |
++ /* |
4994 |
++ * Cgroup events are per-cpu events, and must IPI because of |
4995 |
++ * cgrp_cpuctx_list. |
4996 |
++ */ |
4997 |
++ if (!ctx->is_active && !is_cgroup_event(event)) { |
4998 |
+ __perf_remove_from_context(event, __get_cpu_context(ctx), |
4999 |
+ ctx, (void *)flags); |
5000 |
+ raw_spin_unlock_irq(&ctx->lock); |
5001 |
+@@ -2478,40 +2552,6 @@ void perf_event_disable_inatomic(struct perf_event *event) |
5002 |
+ irq_work_queue(&event->pending); |
5003 |
+ } |
5004 |
+ |
5005 |
+-static void perf_set_shadow_time(struct perf_event *event, |
5006 |
+- struct perf_event_context *ctx) |
5007 |
+-{ |
5008 |
+- /* |
5009 |
+- * use the correct time source for the time snapshot |
5010 |
+- * |
5011 |
+- * We could get by without this by leveraging the |
5012 |
+- * fact that to get to this function, the caller |
5013 |
+- * has most likely already called update_context_time() |
5014 |
+- * and update_cgrp_time_xx() and thus both timestamp |
5015 |
+- * are identical (or very close). Given that tstamp is, |
5016 |
+- * already adjusted for cgroup, we could say that: |
5017 |
+- * tstamp - ctx->timestamp |
5018 |
+- * is equivalent to |
5019 |
+- * tstamp - cgrp->timestamp. |
5020 |
+- * |
5021 |
+- * Then, in perf_output_read(), the calculation would |
5022 |
+- * work with no changes because: |
5023 |
+- * - event is guaranteed scheduled in |
5024 |
+- * - no scheduled out in between |
5025 |
+- * - thus the timestamp would be the same |
5026 |
+- * |
5027 |
+- * But this is a bit hairy. |
5028 |
+- * |
5029 |
+- * So instead, we have an explicit cgroup call to remain |
5030 |
+- * within the time source all along. We believe it |
5031 |
+- * is cleaner and simpler to understand. |
5032 |
+- */ |
5033 |
+- if (is_cgroup_event(event)) |
5034 |
+- perf_cgroup_set_shadow_time(event, event->tstamp); |
5035 |
+- else |
5036 |
+- event->shadow_ctx_time = event->tstamp - ctx->timestamp; |
5037 |
+-} |
5038 |
+- |
5039 |
+ #define MAX_INTERRUPTS (~0ULL) |
5040 |
+ |
5041 |
+ static void perf_log_throttle(struct perf_event *event, int enable); |
5042 |
+@@ -2552,8 +2592,6 @@ event_sched_in(struct perf_event *event, |
5043 |
+ |
5044 |
+ perf_pmu_disable(event->pmu); |
5045 |
+ |
5046 |
+- perf_set_shadow_time(event, ctx); |
5047 |
+- |
5048 |
+ perf_log_itrace_start(event); |
5049 |
+ |
5050 |
+ if (event->pmu->add(event, PERF_EF_START)) { |
5051 |
+@@ -2857,11 +2895,14 @@ perf_install_in_context(struct perf_event_context *ctx, |
5052 |
+ * perf_event_attr::disabled events will not run and can be initialized |
5053 |
+ * without IPI. Except when this is the first event for the context, in |
5054 |
+ * that case we need the magic of the IPI to set ctx->is_active. |
5055 |
++ * Similarly, cgroup events for the context also needs the IPI to |
5056 |
++ * manipulate the cgrp_cpuctx_list. |
5057 |
+ * |
5058 |
+ * The IOC_ENABLE that is sure to follow the creation of a disabled |
5059 |
+ * event will issue the IPI and reprogram the hardware. |
5060 |
+ */ |
5061 |
+- if (__perf_effective_state(event) == PERF_EVENT_STATE_OFF && ctx->nr_events) { |
5062 |
++ if (__perf_effective_state(event) == PERF_EVENT_STATE_OFF && |
5063 |
++ ctx->nr_events && !is_cgroup_event(event)) { |
5064 |
+ raw_spin_lock_irq(&ctx->lock); |
5065 |
+ if (ctx->task == TASK_TOMBSTONE) { |
5066 |
+ raw_spin_unlock_irq(&ctx->lock); |
5067 |
+@@ -3247,16 +3288,6 @@ static void ctx_sched_out(struct perf_event_context *ctx, |
5068 |
+ return; |
5069 |
+ } |
5070 |
+ |
5071 |
+- ctx->is_active &= ~event_type; |
5072 |
+- if (!(ctx->is_active & EVENT_ALL)) |
5073 |
+- ctx->is_active = 0; |
5074 |
+- |
5075 |
+- if (ctx->task) { |
5076 |
+- WARN_ON_ONCE(cpuctx->task_ctx != ctx); |
5077 |
+- if (!ctx->is_active) |
5078 |
+- cpuctx->task_ctx = NULL; |
5079 |
+- } |
5080 |
+- |
5081 |
+ /* |
5082 |
+ * Always update time if it was set; not only when it changes. |
5083 |
+ * Otherwise we can 'forget' to update time for any but the last |
5084 |
+@@ -3270,7 +3301,22 @@ static void ctx_sched_out(struct perf_event_context *ctx, |
5085 |
+ if (is_active & EVENT_TIME) { |
5086 |
+ /* update (and stop) ctx time */ |
5087 |
+ update_context_time(ctx); |
5088 |
+- update_cgrp_time_from_cpuctx(cpuctx); |
5089 |
++ update_cgrp_time_from_cpuctx(cpuctx, ctx == &cpuctx->ctx); |
5090 |
++ /* |
5091 |
++ * CPU-release for the below ->is_active store, |
5092 |
++ * see __load_acquire() in perf_event_time_now() |
5093 |
++ */ |
5094 |
++ barrier(); |
5095 |
++ } |
5096 |
++ |
5097 |
++ ctx->is_active &= ~event_type; |
5098 |
++ if (!(ctx->is_active & EVENT_ALL)) |
5099 |
++ ctx->is_active = 0; |
5100 |
++ |
5101 |
++ if (ctx->task) { |
5102 |
++ WARN_ON_ONCE(cpuctx->task_ctx != ctx); |
5103 |
++ if (!ctx->is_active) |
5104 |
++ cpuctx->task_ctx = NULL; |
5105 |
+ } |
5106 |
+ |
5107 |
+ is_active ^= ctx->is_active; /* changed bits */ |
5108 |
+@@ -3707,13 +3753,19 @@ static noinline int visit_groups_merge(struct perf_cpu_context *cpuctx, |
5109 |
+ return 0; |
5110 |
+ } |
5111 |
+ |
5112 |
++/* |
5113 |
++ * Because the userpage is strictly per-event (there is no concept of context, |
5114 |
++ * so there cannot be a context indirection), every userpage must be updated |
5115 |
++ * when context time starts :-( |
5116 |
++ * |
5117 |
++ * IOW, we must not miss EVENT_TIME edges. |
5118 |
++ */ |
5119 |
+ static inline bool event_update_userpage(struct perf_event *event) |
5120 |
+ { |
5121 |
+ if (likely(!atomic_read(&event->mmap_count))) |
5122 |
+ return false; |
5123 |
+ |
5124 |
+ perf_event_update_time(event); |
5125 |
+- perf_set_shadow_time(event, event->ctx); |
5126 |
+ perf_event_update_userpage(event); |
5127 |
+ |
5128 |
+ return true; |
5129 |
+@@ -3797,13 +3849,23 @@ ctx_sched_in(struct perf_event_context *ctx, |
5130 |
+ struct task_struct *task) |
5131 |
+ { |
5132 |
+ int is_active = ctx->is_active; |
5133 |
+- u64 now; |
5134 |
+ |
5135 |
+ lockdep_assert_held(&ctx->lock); |
5136 |
+ |
5137 |
+ if (likely(!ctx->nr_events)) |
5138 |
+ return; |
5139 |
+ |
5140 |
++ if (is_active ^ EVENT_TIME) { |
5141 |
++ /* start ctx time */ |
5142 |
++ __update_context_time(ctx, false); |
5143 |
++ perf_cgroup_set_timestamp(task, ctx); |
5144 |
++ /* |
5145 |
++ * CPU-release for the below ->is_active store, |
5146 |
++ * see __load_acquire() in perf_event_time_now() |
5147 |
++ */ |
5148 |
++ barrier(); |
5149 |
++ } |
5150 |
++ |
5151 |
+ ctx->is_active |= (event_type | EVENT_TIME); |
5152 |
+ if (ctx->task) { |
5153 |
+ if (!is_active) |
5154 |
+@@ -3814,13 +3876,6 @@ ctx_sched_in(struct perf_event_context *ctx, |
5155 |
+ |
5156 |
+ is_active ^= ctx->is_active; /* changed bits */ |
5157 |
+ |
5158 |
+- if (is_active & EVENT_TIME) { |
5159 |
+- /* start ctx time */ |
5160 |
+- now = perf_clock(); |
5161 |
+- ctx->timestamp = now; |
5162 |
+- perf_cgroup_set_timestamp(task, ctx); |
5163 |
+- } |
5164 |
+- |
5165 |
+ /* |
5166 |
+ * First go through the list and put on any pinned groups |
5167 |
+ * in order to give them the best chance of going on. |
5168 |
+@@ -4414,6 +4469,18 @@ static inline u64 perf_event_count(struct perf_event *event) |
5169 |
+ return local64_read(&event->count) + atomic64_read(&event->child_count); |
5170 |
+ } |
5171 |
+ |
5172 |
++static void calc_timer_values(struct perf_event *event, |
5173 |
++ u64 *now, |
5174 |
++ u64 *enabled, |
5175 |
++ u64 *running) |
5176 |
++{ |
5177 |
++ u64 ctx_time; |
5178 |
++ |
5179 |
++ *now = perf_clock(); |
5180 |
++ ctx_time = perf_event_time_now(event, *now); |
5181 |
++ __perf_update_times(event, ctx_time, enabled, running); |
5182 |
++} |
5183 |
++ |
5184 |
+ /* |
5185 |
+ * NMI-safe method to read a local event, that is an event that |
5186 |
+ * is: |
5187 |
+@@ -4473,10 +4540,9 @@ int perf_event_read_local(struct perf_event *event, u64 *value, |
5188 |
+ |
5189 |
+ *value = local64_read(&event->count); |
5190 |
+ if (enabled || running) { |
5191 |
+- u64 now = event->shadow_ctx_time + perf_clock(); |
5192 |
+- u64 __enabled, __running; |
5193 |
++ u64 __enabled, __running, __now;; |
5194 |
+ |
5195 |
+- __perf_update_times(event, now, &__enabled, &__running); |
5196 |
++ calc_timer_values(event, &__now, &__enabled, &__running); |
5197 |
+ if (enabled) |
5198 |
+ *enabled = __enabled; |
5199 |
+ if (running) |
5200 |
+@@ -5798,18 +5864,6 @@ static int perf_event_index(struct perf_event *event) |
5201 |
+ return event->pmu->event_idx(event); |
5202 |
+ } |
5203 |
+ |
5204 |
+-static void calc_timer_values(struct perf_event *event, |
5205 |
+- u64 *now, |
5206 |
+- u64 *enabled, |
5207 |
+- u64 *running) |
5208 |
+-{ |
5209 |
+- u64 ctx_time; |
5210 |
+- |
5211 |
+- *now = perf_clock(); |
5212 |
+- ctx_time = event->shadow_ctx_time + *now; |
5213 |
+- __perf_update_times(event, ctx_time, enabled, running); |
5214 |
+-} |
5215 |
+- |
5216 |
+ static void perf_event_init_userpage(struct perf_event *event) |
5217 |
+ { |
5218 |
+ struct perf_event_mmap_page *userpg; |
5219 |
+@@ -6349,7 +6403,6 @@ accounting: |
5220 |
+ ring_buffer_attach(event, rb); |
5221 |
+ |
5222 |
+ perf_event_update_time(event); |
5223 |
+- perf_set_shadow_time(event, event->ctx); |
5224 |
+ perf_event_init_userpage(event); |
5225 |
+ perf_event_update_userpage(event); |
5226 |
+ } else { |
5227 |
+diff --git a/kernel/power/wakelock.c b/kernel/power/wakelock.c |
5228 |
+index 105df4dfc7839..52571dcad768b 100644 |
5229 |
+--- a/kernel/power/wakelock.c |
5230 |
++++ b/kernel/power/wakelock.c |
5231 |
+@@ -39,23 +39,20 @@ ssize_t pm_show_wakelocks(char *buf, bool show_active) |
5232 |
+ { |
5233 |
+ struct rb_node *node; |
5234 |
+ struct wakelock *wl; |
5235 |
+- char *str = buf; |
5236 |
+- char *end = buf + PAGE_SIZE; |
5237 |
++ int len = 0; |
5238 |
+ |
5239 |
+ mutex_lock(&wakelocks_lock); |
5240 |
+ |
5241 |
+ for (node = rb_first(&wakelocks_tree); node; node = rb_next(node)) { |
5242 |
+ wl = rb_entry(node, struct wakelock, node); |
5243 |
+ if (wl->ws->active == show_active) |
5244 |
+- str += scnprintf(str, end - str, "%s ", wl->name); |
5245 |
++ len += sysfs_emit_at(buf, len, "%s ", wl->name); |
5246 |
+ } |
5247 |
+- if (str > buf) |
5248 |
+- str--; |
5249 |
+ |
5250 |
+- str += scnprintf(str, end - str, "\n"); |
5251 |
++ len += sysfs_emit_at(buf, len, "\n"); |
5252 |
+ |
5253 |
+ mutex_unlock(&wakelocks_lock); |
5254 |
+- return (str - buf); |
5255 |
++ return len; |
5256 |
+ } |
5257 |
+ |
5258 |
+ #if CONFIG_PM_WAKELOCKS_LIMIT > 0 |
5259 |
+diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c |
5260 |
+index d41f966f5866a..6420580f2730b 100644 |
5261 |
+--- a/kernel/sched/fair.c |
5262 |
++++ b/kernel/sched/fair.c |
5263 |
+@@ -3422,7 +3422,6 @@ void set_task_rq_fair(struct sched_entity *se, |
5264 |
+ se->avg.last_update_time = n_last_update_time; |
5265 |
+ } |
5266 |
+ |
5267 |
+- |
5268 |
+ /* |
5269 |
+ * When on migration a sched_entity joins/leaves the PELT hierarchy, we need to |
5270 |
+ * propagate its contribution. The key to this propagation is the invariant |
5271 |
+@@ -3490,7 +3489,6 @@ void set_task_rq_fair(struct sched_entity *se, |
5272 |
+ * XXX: only do this for the part of runnable > running ? |
5273 |
+ * |
5274 |
+ */ |
5275 |
+- |
5276 |
+ static inline void |
5277 |
+ update_tg_cfs_util(struct cfs_rq *cfs_rq, struct sched_entity *se, struct cfs_rq *gcfs_rq) |
5278 |
+ { |
5279 |
+@@ -3722,7 +3720,19 @@ update_cfs_rq_load_avg(u64 now, struct cfs_rq *cfs_rq) |
5280 |
+ |
5281 |
+ r = removed_util; |
5282 |
+ sub_positive(&sa->util_avg, r); |
5283 |
+- sa->util_sum = sa->util_avg * divider; |
5284 |
++ sub_positive(&sa->util_sum, r * divider); |
5285 |
++ /* |
5286 |
++ * Because of rounding, se->util_sum might ends up being +1 more than |
5287 |
++ * cfs->util_sum. Although this is not a problem by itself, detaching |
5288 |
++ * a lot of tasks with the rounding problem between 2 updates of |
5289 |
++ * util_avg (~1ms) can make cfs->util_sum becoming null whereas |
5290 |
++ * cfs_util_avg is not. |
5291 |
++ * Check that util_sum is still above its lower bound for the new |
5292 |
++ * util_avg. Given that period_contrib might have moved since the last |
5293 |
++ * sync, we are only sure that util_sum must be above or equal to |
5294 |
++ * util_avg * minimum possible divider |
5295 |
++ */ |
5296 |
++ sa->util_sum = max_t(u32, sa->util_sum, sa->util_avg * PELT_MIN_DIVIDER); |
5297 |
+ |
5298 |
+ r = removed_runnable; |
5299 |
+ sub_positive(&sa->runnable_avg, r); |
5300 |
+diff --git a/kernel/sched/membarrier.c b/kernel/sched/membarrier.c |
5301 |
+index b5add64d9698c..3d2825408e3a2 100644 |
5302 |
+--- a/kernel/sched/membarrier.c |
5303 |
++++ b/kernel/sched/membarrier.c |
5304 |
+@@ -147,11 +147,11 @@ |
5305 |
+ #endif |
5306 |
+ |
5307 |
+ #ifdef CONFIG_RSEQ |
5308 |
+-#define MEMBARRIER_CMD_PRIVATE_EXPEDITED_RSEQ_BITMASK \ |
5309 |
++#define MEMBARRIER_PRIVATE_EXPEDITED_RSEQ_BITMASK \ |
5310 |
+ (MEMBARRIER_CMD_PRIVATE_EXPEDITED_RSEQ \ |
5311 |
+- | MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_RSEQ_BITMASK) |
5312 |
++ | MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_RSEQ) |
5313 |
+ #else |
5314 |
+-#define MEMBARRIER_CMD_PRIVATE_EXPEDITED_RSEQ_BITMASK 0 |
5315 |
++#define MEMBARRIER_PRIVATE_EXPEDITED_RSEQ_BITMASK 0 |
5316 |
+ #endif |
5317 |
+ |
5318 |
+ #define MEMBARRIER_CMD_BITMASK \ |
5319 |
+@@ -159,7 +159,8 @@ |
5320 |
+ | MEMBARRIER_CMD_REGISTER_GLOBAL_EXPEDITED \ |
5321 |
+ | MEMBARRIER_CMD_PRIVATE_EXPEDITED \ |
5322 |
+ | MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED \ |
5323 |
+- | MEMBARRIER_PRIVATE_EXPEDITED_SYNC_CORE_BITMASK) |
5324 |
++ | MEMBARRIER_PRIVATE_EXPEDITED_SYNC_CORE_BITMASK \ |
5325 |
++ | MEMBARRIER_PRIVATE_EXPEDITED_RSEQ_BITMASK) |
5326 |
+ |
5327 |
+ static void ipi_mb(void *info) |
5328 |
+ { |
5329 |
+diff --git a/kernel/sched/pelt.h b/kernel/sched/pelt.h |
5330 |
+index e06071bf3472c..c336f5f481bca 100644 |
5331 |
+--- a/kernel/sched/pelt.h |
5332 |
++++ b/kernel/sched/pelt.h |
5333 |
+@@ -37,9 +37,11 @@ update_irq_load_avg(struct rq *rq, u64 running) |
5334 |
+ } |
5335 |
+ #endif |
5336 |
+ |
5337 |
++#define PELT_MIN_DIVIDER (LOAD_AVG_MAX - 1024) |
5338 |
++ |
5339 |
+ static inline u32 get_pelt_divider(struct sched_avg *avg) |
5340 |
+ { |
5341 |
+- return LOAD_AVG_MAX - 1024 + avg->period_contrib; |
5342 |
++ return PELT_MIN_DIVIDER + avg->period_contrib; |
5343 |
+ } |
5344 |
+ |
5345 |
+ static inline void cfs_se_util_change(struct sched_avg *avg) |
5346 |
+diff --git a/kernel/sched/psi.c b/kernel/sched/psi.c |
5347 |
+index 69b19d3af690f..422f3b0445cf1 100644 |
5348 |
+--- a/kernel/sched/psi.c |
5349 |
++++ b/kernel/sched/psi.c |
5350 |
+@@ -1082,44 +1082,6 @@ int psi_show(struct seq_file *m, struct psi_group *group, enum psi_res res) |
5351 |
+ return 0; |
5352 |
+ } |
5353 |
+ |
5354 |
+-static int psi_io_show(struct seq_file *m, void *v) |
5355 |
+-{ |
5356 |
+- return psi_show(m, &psi_system, PSI_IO); |
5357 |
+-} |
5358 |
+- |
5359 |
+-static int psi_memory_show(struct seq_file *m, void *v) |
5360 |
+-{ |
5361 |
+- return psi_show(m, &psi_system, PSI_MEM); |
5362 |
+-} |
5363 |
+- |
5364 |
+-static int psi_cpu_show(struct seq_file *m, void *v) |
5365 |
+-{ |
5366 |
+- return psi_show(m, &psi_system, PSI_CPU); |
5367 |
+-} |
5368 |
+- |
5369 |
+-static int psi_open(struct file *file, int (*psi_show)(struct seq_file *, void *)) |
5370 |
+-{ |
5371 |
+- if (file->f_mode & FMODE_WRITE && !capable(CAP_SYS_RESOURCE)) |
5372 |
+- return -EPERM; |
5373 |
+- |
5374 |
+- return single_open(file, psi_show, NULL); |
5375 |
+-} |
5376 |
+- |
5377 |
+-static int psi_io_open(struct inode *inode, struct file *file) |
5378 |
+-{ |
5379 |
+- return psi_open(file, psi_io_show); |
5380 |
+-} |
5381 |
+- |
5382 |
+-static int psi_memory_open(struct inode *inode, struct file *file) |
5383 |
+-{ |
5384 |
+- return psi_open(file, psi_memory_show); |
5385 |
+-} |
5386 |
+- |
5387 |
+-static int psi_cpu_open(struct inode *inode, struct file *file) |
5388 |
+-{ |
5389 |
+- return psi_open(file, psi_cpu_show); |
5390 |
+-} |
5391 |
+- |
5392 |
+ struct psi_trigger *psi_trigger_create(struct psi_group *group, |
5393 |
+ char *buf, size_t nbytes, enum psi_res res) |
5394 |
+ { |
5395 |
+@@ -1162,7 +1124,6 @@ struct psi_trigger *psi_trigger_create(struct psi_group *group, |
5396 |
+ t->event = 0; |
5397 |
+ t->last_event_time = 0; |
5398 |
+ init_waitqueue_head(&t->event_wait); |
5399 |
+- kref_init(&t->refcount); |
5400 |
+ |
5401 |
+ mutex_lock(&group->trigger_lock); |
5402 |
+ |
5403 |
+@@ -1191,15 +1152,19 @@ struct psi_trigger *psi_trigger_create(struct psi_group *group, |
5404 |
+ return t; |
5405 |
+ } |
5406 |
+ |
5407 |
+-static void psi_trigger_destroy(struct kref *ref) |
5408 |
++void psi_trigger_destroy(struct psi_trigger *t) |
5409 |
+ { |
5410 |
+- struct psi_trigger *t = container_of(ref, struct psi_trigger, refcount); |
5411 |
+- struct psi_group *group = t->group; |
5412 |
++ struct psi_group *group; |
5413 |
+ struct task_struct *task_to_destroy = NULL; |
5414 |
+ |
5415 |
+- if (static_branch_likely(&psi_disabled)) |
5416 |
++ /* |
5417 |
++ * We do not check psi_disabled since it might have been disabled after |
5418 |
++ * the trigger got created. |
5419 |
++ */ |
5420 |
++ if (!t) |
5421 |
+ return; |
5422 |
+ |
5423 |
++ group = t->group; |
5424 |
+ /* |
5425 |
+ * Wakeup waiters to stop polling. Can happen if cgroup is deleted |
5426 |
+ * from under a polling process. |
5427 |
+@@ -1235,9 +1200,9 @@ static void psi_trigger_destroy(struct kref *ref) |
5428 |
+ mutex_unlock(&group->trigger_lock); |
5429 |
+ |
5430 |
+ /* |
5431 |
+- * Wait for both *trigger_ptr from psi_trigger_replace and |
5432 |
+- * poll_task RCUs to complete their read-side critical sections |
5433 |
+- * before destroying the trigger and optionally the poll_task |
5434 |
++ * Wait for psi_schedule_poll_work RCU to complete its read-side |
5435 |
++ * critical section before destroying the trigger and optionally the |
5436 |
++ * poll_task. |
5437 |
+ */ |
5438 |
+ synchronize_rcu(); |
5439 |
+ /* |
5440 |
+@@ -1254,18 +1219,6 @@ static void psi_trigger_destroy(struct kref *ref) |
5441 |
+ kfree(t); |
5442 |
+ } |
5443 |
+ |
5444 |
+-void psi_trigger_replace(void **trigger_ptr, struct psi_trigger *new) |
5445 |
+-{ |
5446 |
+- struct psi_trigger *old = *trigger_ptr; |
5447 |
+- |
5448 |
+- if (static_branch_likely(&psi_disabled)) |
5449 |
+- return; |
5450 |
+- |
5451 |
+- rcu_assign_pointer(*trigger_ptr, new); |
5452 |
+- if (old) |
5453 |
+- kref_put(&old->refcount, psi_trigger_destroy); |
5454 |
+-} |
5455 |
+- |
5456 |
+ __poll_t psi_trigger_poll(void **trigger_ptr, |
5457 |
+ struct file *file, poll_table *wait) |
5458 |
+ { |
5459 |
+@@ -1275,27 +1228,57 @@ __poll_t psi_trigger_poll(void **trigger_ptr, |
5460 |
+ if (static_branch_likely(&psi_disabled)) |
5461 |
+ return DEFAULT_POLLMASK | EPOLLERR | EPOLLPRI; |
5462 |
+ |
5463 |
+- rcu_read_lock(); |
5464 |
+- |
5465 |
+- t = rcu_dereference(*(void __rcu __force **)trigger_ptr); |
5466 |
+- if (!t) { |
5467 |
+- rcu_read_unlock(); |
5468 |
++ t = smp_load_acquire(trigger_ptr); |
5469 |
++ if (!t) |
5470 |
+ return DEFAULT_POLLMASK | EPOLLERR | EPOLLPRI; |
5471 |
+- } |
5472 |
+- kref_get(&t->refcount); |
5473 |
+- |
5474 |
+- rcu_read_unlock(); |
5475 |
+ |
5476 |
+ poll_wait(file, &t->event_wait, wait); |
5477 |
+ |
5478 |
+ if (cmpxchg(&t->event, 1, 0) == 1) |
5479 |
+ ret |= EPOLLPRI; |
5480 |
+ |
5481 |
+- kref_put(&t->refcount, psi_trigger_destroy); |
5482 |
+- |
5483 |
+ return ret; |
5484 |
+ } |
5485 |
+ |
5486 |
++#ifdef CONFIG_PROC_FS |
5487 |
++static int psi_io_show(struct seq_file *m, void *v) |
5488 |
++{ |
5489 |
++ return psi_show(m, &psi_system, PSI_IO); |
5490 |
++} |
5491 |
++ |
5492 |
++static int psi_memory_show(struct seq_file *m, void *v) |
5493 |
++{ |
5494 |
++ return psi_show(m, &psi_system, PSI_MEM); |
5495 |
++} |
5496 |
++ |
5497 |
++static int psi_cpu_show(struct seq_file *m, void *v) |
5498 |
++{ |
5499 |
++ return psi_show(m, &psi_system, PSI_CPU); |
5500 |
++} |
5501 |
++ |
5502 |
++static int psi_open(struct file *file, int (*psi_show)(struct seq_file *, void *)) |
5503 |
++{ |
5504 |
++ if (file->f_mode & FMODE_WRITE && !capable(CAP_SYS_RESOURCE)) |
5505 |
++ return -EPERM; |
5506 |
++ |
5507 |
++ return single_open(file, psi_show, NULL); |
5508 |
++} |
5509 |
++ |
5510 |
++static int psi_io_open(struct inode *inode, struct file *file) |
5511 |
++{ |
5512 |
++ return psi_open(file, psi_io_show); |
5513 |
++} |
5514 |
++ |
5515 |
++static int psi_memory_open(struct inode *inode, struct file *file) |
5516 |
++{ |
5517 |
++ return psi_open(file, psi_memory_show); |
5518 |
++} |
5519 |
++ |
5520 |
++static int psi_cpu_open(struct inode *inode, struct file *file) |
5521 |
++{ |
5522 |
++ return psi_open(file, psi_cpu_show); |
5523 |
++} |
5524 |
++ |
5525 |
+ static ssize_t psi_write(struct file *file, const char __user *user_buf, |
5526 |
+ size_t nbytes, enum psi_res res) |
5527 |
+ { |
5528 |
+@@ -1316,14 +1299,24 @@ static ssize_t psi_write(struct file *file, const char __user *user_buf, |
5529 |
+ |
5530 |
+ buf[buf_size - 1] = '\0'; |
5531 |
+ |
5532 |
+- new = psi_trigger_create(&psi_system, buf, nbytes, res); |
5533 |
+- if (IS_ERR(new)) |
5534 |
+- return PTR_ERR(new); |
5535 |
+- |
5536 |
+ seq = file->private_data; |
5537 |
++ |
5538 |
+ /* Take seq->lock to protect seq->private from concurrent writes */ |
5539 |
+ mutex_lock(&seq->lock); |
5540 |
+- psi_trigger_replace(&seq->private, new); |
5541 |
++ |
5542 |
++ /* Allow only one trigger per file descriptor */ |
5543 |
++ if (seq->private) { |
5544 |
++ mutex_unlock(&seq->lock); |
5545 |
++ return -EBUSY; |
5546 |
++ } |
5547 |
++ |
5548 |
++ new = psi_trigger_create(&psi_system, buf, nbytes, res); |
5549 |
++ if (IS_ERR(new)) { |
5550 |
++ mutex_unlock(&seq->lock); |
5551 |
++ return PTR_ERR(new); |
5552 |
++ } |
5553 |
++ |
5554 |
++ smp_store_release(&seq->private, new); |
5555 |
+ mutex_unlock(&seq->lock); |
5556 |
+ |
5557 |
+ return nbytes; |
5558 |
+@@ -1358,7 +1351,7 @@ static int psi_fop_release(struct inode *inode, struct file *file) |
5559 |
+ { |
5560 |
+ struct seq_file *seq = file->private_data; |
5561 |
+ |
5562 |
+- psi_trigger_replace(&seq->private, NULL); |
5563 |
++ psi_trigger_destroy(seq->private); |
5564 |
+ return single_release(inode, file); |
5565 |
+ } |
5566 |
+ |
5567 |
+@@ -1400,3 +1393,5 @@ static int __init psi_proc_init(void) |
5568 |
+ return 0; |
5569 |
+ } |
5570 |
+ module_init(psi_proc_init); |
5571 |
++ |
5572 |
++#endif /* CONFIG_PROC_FS */ |
5573 |
+diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c |
5574 |
+index ce05ba0412889..51a87a67e2abe 100644 |
5575 |
+--- a/kernel/trace/trace.c |
5576 |
++++ b/kernel/trace/trace.c |
5577 |
+@@ -7749,7 +7749,8 @@ static struct tracing_log_err *get_tracing_log_err(struct trace_array *tr) |
5578 |
+ err = kzalloc(sizeof(*err), GFP_KERNEL); |
5579 |
+ if (!err) |
5580 |
+ err = ERR_PTR(-ENOMEM); |
5581 |
+- tr->n_err_log_entries++; |
5582 |
++ else |
5583 |
++ tr->n_err_log_entries++; |
5584 |
+ |
5585 |
+ return err; |
5586 |
+ } |
5587 |
+diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_hist.c |
5588 |
+index 12a735bd90a56..83efce3a87ca7 100644 |
5589 |
+--- a/kernel/trace/trace_events_hist.c |
5590 |
++++ b/kernel/trace/trace_events_hist.c |
5591 |
+@@ -3581,6 +3581,7 @@ static int trace_action_create(struct hist_trigger_data *hist_data, |
5592 |
+ |
5593 |
+ var_ref_idx = find_var_ref_idx(hist_data, var_ref); |
5594 |
+ if (WARN_ON(var_ref_idx < 0)) { |
5595 |
++ kfree(p); |
5596 |
+ ret = var_ref_idx; |
5597 |
+ goto err; |
5598 |
+ } |
5599 |
+diff --git a/kernel/ucount.c b/kernel/ucount.c |
5600 |
+index 16feb710ee638..804f64799fc14 100644 |
5601 |
+--- a/kernel/ucount.c |
5602 |
++++ b/kernel/ucount.c |
5603 |
+@@ -184,6 +184,7 @@ struct ucounts *alloc_ucounts(struct user_namespace *ns, kuid_t uid) |
5604 |
+ kfree(new); |
5605 |
+ } else { |
5606 |
+ hlist_add_head(&new->node, hashent); |
5607 |
++ get_user_ns(new->ns); |
5608 |
+ spin_unlock_irq(&ucounts_lock); |
5609 |
+ return new; |
5610 |
+ } |
5611 |
+@@ -204,6 +205,7 @@ void put_ucounts(struct ucounts *ucounts) |
5612 |
+ if (atomic_dec_and_lock_irqsave(&ucounts->count, &ucounts_lock, flags)) { |
5613 |
+ hlist_del_init(&ucounts->node); |
5614 |
+ spin_unlock_irqrestore(&ucounts_lock, flags); |
5615 |
++ put_user_ns(ucounts->ns); |
5616 |
+ kfree(ucounts); |
5617 |
+ } |
5618 |
+ } |
5619 |
+diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c |
5620 |
+index 20e36126bbdae..868a22df32850 100644 |
5621 |
+--- a/net/bluetooth/hci_event.c |
5622 |
++++ b/net/bluetooth/hci_event.c |
5623 |
+@@ -5782,6 +5782,11 @@ static void hci_le_adv_report_evt(struct hci_dev *hdev, struct sk_buff *skb) |
5624 |
+ struct hci_ev_le_advertising_info *ev = ptr; |
5625 |
+ s8 rssi; |
5626 |
+ |
5627 |
++ if (ptr > (void *)skb_tail_pointer(skb) - sizeof(*ev)) { |
5628 |
++ bt_dev_err(hdev, "Malicious advertising data."); |
5629 |
++ break; |
5630 |
++ } |
5631 |
++ |
5632 |
+ if (ev->length <= HCI_MAX_AD_LENGTH && |
5633 |
+ ev->data + ev->length <= skb_tail_pointer(skb)) { |
5634 |
+ rssi = ev->data[ev->length]; |
5635 |
+@@ -5793,11 +5798,6 @@ static void hci_le_adv_report_evt(struct hci_dev *hdev, struct sk_buff *skb) |
5636 |
+ } |
5637 |
+ |
5638 |
+ ptr += sizeof(*ev) + ev->length + 1; |
5639 |
+- |
5640 |
+- if (ptr > (void *) skb_tail_pointer(skb) - sizeof(*ev)) { |
5641 |
+- bt_dev_err(hdev, "Malicious advertising data. Stopping processing"); |
5642 |
+- break; |
5643 |
+- } |
5644 |
+ } |
5645 |
+ |
5646 |
+ hci_dev_unlock(hdev); |
5647 |
+diff --git a/net/bridge/br_vlan.c b/net/bridge/br_vlan.c |
5648 |
+index 19f65ab91a027..10e63ea6a13e1 100644 |
5649 |
+--- a/net/bridge/br_vlan.c |
5650 |
++++ b/net/bridge/br_vlan.c |
5651 |
+@@ -560,10 +560,10 @@ static bool __allowed_ingress(const struct net_bridge *br, |
5652 |
+ !br_opt_get(br, BROPT_VLAN_STATS_ENABLED)) { |
5653 |
+ if (*state == BR_STATE_FORWARDING) { |
5654 |
+ *state = br_vlan_get_pvid_state(vg); |
5655 |
+- return br_vlan_state_allowed(*state, true); |
5656 |
+- } else { |
5657 |
+- return true; |
5658 |
++ if (!br_vlan_state_allowed(*state, true)) |
5659 |
++ goto drop; |
5660 |
+ } |
5661 |
++ return true; |
5662 |
+ } |
5663 |
+ } |
5664 |
+ v = br_vlan_find(vg, *vid); |
5665 |
+@@ -2105,7 +2105,8 @@ static int br_vlan_rtm_dump(struct sk_buff *skb, struct netlink_callback *cb) |
5666 |
+ goto out_err; |
5667 |
+ } |
5668 |
+ err = br_vlan_dump_dev(dev, skb, cb, dump_flags); |
5669 |
+- if (err && err != -EMSGSIZE) |
5670 |
++ /* if the dump completed without an error we return 0 here */ |
5671 |
++ if (err != -EMSGSIZE) |
5672 |
+ goto out_err; |
5673 |
+ } else { |
5674 |
+ for_each_netdev_rcu(net, dev) { |
5675 |
+diff --git a/net/core/net-procfs.c b/net/core/net-procfs.c |
5676 |
+index d8b9dbabd4a43..88cc0ad7d386e 100644 |
5677 |
+--- a/net/core/net-procfs.c |
5678 |
++++ b/net/core/net-procfs.c |
5679 |
+@@ -190,12 +190,23 @@ static const struct seq_operations softnet_seq_ops = { |
5680 |
+ .show = softnet_seq_show, |
5681 |
+ }; |
5682 |
+ |
5683 |
+-static void *ptype_get_idx(loff_t pos) |
5684 |
++static void *ptype_get_idx(struct seq_file *seq, loff_t pos) |
5685 |
+ { |
5686 |
++ struct list_head *ptype_list = NULL; |
5687 |
+ struct packet_type *pt = NULL; |
5688 |
++ struct net_device *dev; |
5689 |
+ loff_t i = 0; |
5690 |
+ int t; |
5691 |
+ |
5692 |
++ for_each_netdev_rcu(seq_file_net(seq), dev) { |
5693 |
++ ptype_list = &dev->ptype_all; |
5694 |
++ list_for_each_entry_rcu(pt, ptype_list, list) { |
5695 |
++ if (i == pos) |
5696 |
++ return pt; |
5697 |
++ ++i; |
5698 |
++ } |
5699 |
++ } |
5700 |
++ |
5701 |
+ list_for_each_entry_rcu(pt, &ptype_all, list) { |
5702 |
+ if (i == pos) |
5703 |
+ return pt; |
5704 |
+@@ -216,22 +227,40 @@ static void *ptype_seq_start(struct seq_file *seq, loff_t *pos) |
5705 |
+ __acquires(RCU) |
5706 |
+ { |
5707 |
+ rcu_read_lock(); |
5708 |
+- return *pos ? ptype_get_idx(*pos - 1) : SEQ_START_TOKEN; |
5709 |
++ return *pos ? ptype_get_idx(seq, *pos - 1) : SEQ_START_TOKEN; |
5710 |
+ } |
5711 |
+ |
5712 |
+ static void *ptype_seq_next(struct seq_file *seq, void *v, loff_t *pos) |
5713 |
+ { |
5714 |
++ struct net_device *dev; |
5715 |
+ struct packet_type *pt; |
5716 |
+ struct list_head *nxt; |
5717 |
+ int hash; |
5718 |
+ |
5719 |
+ ++*pos; |
5720 |
+ if (v == SEQ_START_TOKEN) |
5721 |
+- return ptype_get_idx(0); |
5722 |
++ return ptype_get_idx(seq, 0); |
5723 |
+ |
5724 |
+ pt = v; |
5725 |
+ nxt = pt->list.next; |
5726 |
++ if (pt->dev) { |
5727 |
++ if (nxt != &pt->dev->ptype_all) |
5728 |
++ goto found; |
5729 |
++ |
5730 |
++ dev = pt->dev; |
5731 |
++ for_each_netdev_continue_rcu(seq_file_net(seq), dev) { |
5732 |
++ if (!list_empty(&dev->ptype_all)) { |
5733 |
++ nxt = dev->ptype_all.next; |
5734 |
++ goto found; |
5735 |
++ } |
5736 |
++ } |
5737 |
++ |
5738 |
++ nxt = ptype_all.next; |
5739 |
++ goto ptype_all; |
5740 |
++ } |
5741 |
++ |
5742 |
+ if (pt->type == htons(ETH_P_ALL)) { |
5743 |
++ptype_all: |
5744 |
+ if (nxt != &ptype_all) |
5745 |
+ goto found; |
5746 |
+ hash = 0; |
5747 |
+@@ -260,7 +289,8 @@ static int ptype_seq_show(struct seq_file *seq, void *v) |
5748 |
+ |
5749 |
+ if (v == SEQ_START_TOKEN) |
5750 |
+ seq_puts(seq, "Type Device Function\n"); |
5751 |
+- else if (pt->dev == NULL || dev_net(pt->dev) == seq_file_net(seq)) { |
5752 |
++ else if ((!pt->af_packet_net || net_eq(pt->af_packet_net, seq_file_net(seq))) && |
5753 |
++ (!pt->dev || net_eq(dev_net(pt->dev), seq_file_net(seq)))) { |
5754 |
+ if (pt->type == htons(ETH_P_ALL)) |
5755 |
+ seq_puts(seq, "ALL "); |
5756 |
+ else |
5757 |
+diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c |
5758 |
+index 9bca57ef8b838..a4d2eb691cbc1 100644 |
5759 |
+--- a/net/ipv4/ip_output.c |
5760 |
++++ b/net/ipv4/ip_output.c |
5761 |
+@@ -162,12 +162,19 @@ int ip_build_and_send_pkt(struct sk_buff *skb, const struct sock *sk, |
5762 |
+ iph->daddr = (opt && opt->opt.srr ? opt->opt.faddr : daddr); |
5763 |
+ iph->saddr = saddr; |
5764 |
+ iph->protocol = sk->sk_protocol; |
5765 |
+- if (ip_dont_fragment(sk, &rt->dst)) { |
5766 |
++ /* Do not bother generating IPID for small packets (eg SYNACK) */ |
5767 |
++ if (skb->len <= IPV4_MIN_MTU || ip_dont_fragment(sk, &rt->dst)) { |
5768 |
+ iph->frag_off = htons(IP_DF); |
5769 |
+ iph->id = 0; |
5770 |
+ } else { |
5771 |
+ iph->frag_off = 0; |
5772 |
+- __ip_select_ident(net, iph, 1); |
5773 |
++ /* TCP packets here are SYNACK with fat IPv4/TCP options. |
5774 |
++ * Avoid using the hashed IP ident generator. |
5775 |
++ */ |
5776 |
++ if (sk->sk_protocol == IPPROTO_TCP) |
5777 |
++ iph->id = (__force __be16)prandom_u32(); |
5778 |
++ else |
5779 |
++ __ip_select_ident(net, iph, 1); |
5780 |
+ } |
5781 |
+ |
5782 |
+ if (opt && opt->opt.optlen) { |
5783 |
+@@ -826,15 +833,24 @@ int ip_do_fragment(struct net *net, struct sock *sk, struct sk_buff *skb, |
5784 |
+ /* Everything is OK. Generate! */ |
5785 |
+ ip_fraglist_init(skb, iph, hlen, &iter); |
5786 |
+ |
5787 |
+- if (iter.frag) |
5788 |
+- ip_options_fragment(iter.frag); |
5789 |
+- |
5790 |
+ for (;;) { |
5791 |
+ /* Prepare header of the next frame, |
5792 |
+ * before previous one went down. */ |
5793 |
+ if (iter.frag) { |
5794 |
++ bool first_frag = (iter.offset == 0); |
5795 |
++ |
5796 |
+ IPCB(iter.frag)->flags = IPCB(skb)->flags; |
5797 |
+ ip_fraglist_prepare(skb, &iter); |
5798 |
++ if (first_frag && IPCB(skb)->opt.optlen) { |
5799 |
++ /* ipcb->opt is not populated for frags |
5800 |
++ * coming from __ip_make_skb(), |
5801 |
++ * ip_options_fragment() needs optlen |
5802 |
++ */ |
5803 |
++ IPCB(iter.frag)->opt.optlen = |
5804 |
++ IPCB(skb)->opt.optlen; |
5805 |
++ ip_options_fragment(iter.frag); |
5806 |
++ ip_send_check(iter.iph); |
5807 |
++ } |
5808 |
+ } |
5809 |
+ |
5810 |
+ skb->tstamp = tstamp; |
5811 |
+diff --git a/net/ipv4/ping.c b/net/ipv4/ping.c |
5812 |
+index 1e44a43acfe2d..086822cb1cc96 100644 |
5813 |
+--- a/net/ipv4/ping.c |
5814 |
++++ b/net/ipv4/ping.c |
5815 |
+@@ -220,7 +220,8 @@ static struct sock *ping_lookup(struct net *net, struct sk_buff *skb, u16 ident) |
5816 |
+ continue; |
5817 |
+ } |
5818 |
+ |
5819 |
+- if (sk->sk_bound_dev_if && sk->sk_bound_dev_if != dif) |
5820 |
++ if (sk->sk_bound_dev_if && sk->sk_bound_dev_if != dif && |
5821 |
++ sk->sk_bound_dev_if != inet_sdif(skb)) |
5822 |
+ continue; |
5823 |
+ |
5824 |
+ sock_hold(sk); |
5825 |
+diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c |
5826 |
+index bb446e60cf580..b8689052079cd 100644 |
5827 |
+--- a/net/ipv4/raw.c |
5828 |
++++ b/net/ipv4/raw.c |
5829 |
+@@ -721,6 +721,7 @@ static int raw_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len) |
5830 |
+ int ret = -EINVAL; |
5831 |
+ int chk_addr_ret; |
5832 |
+ |
5833 |
++ lock_sock(sk); |
5834 |
+ if (sk->sk_state != TCP_CLOSE || addr_len < sizeof(struct sockaddr_in)) |
5835 |
+ goto out; |
5836 |
+ |
5837 |
+@@ -740,7 +741,9 @@ static int raw_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len) |
5838 |
+ inet->inet_saddr = 0; /* Use device */ |
5839 |
+ sk_dst_reset(sk); |
5840 |
+ ret = 0; |
5841 |
+-out: return ret; |
5842 |
++out: |
5843 |
++ release_sock(sk); |
5844 |
++ return ret; |
5845 |
+ } |
5846 |
+ |
5847 |
+ /* |
5848 |
+diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c |
5849 |
+index 846037e73723f..bf13865426340 100644 |
5850 |
+--- a/net/ipv6/addrconf.c |
5851 |
++++ b/net/ipv6/addrconf.c |
5852 |
+@@ -2587,7 +2587,7 @@ int addrconf_prefix_rcv_add_addr(struct net *net, struct net_device *dev, |
5853 |
+ __u32 valid_lft, u32 prefered_lft) |
5854 |
+ { |
5855 |
+ struct inet6_ifaddr *ifp = ipv6_get_ifaddr(net, addr, dev, 1); |
5856 |
+- int create = 0; |
5857 |
++ int create = 0, update_lft = 0; |
5858 |
+ |
5859 |
+ if (!ifp && valid_lft) { |
5860 |
+ int max_addresses = in6_dev->cnf.max_addresses; |
5861 |
+@@ -2631,19 +2631,32 @@ int addrconf_prefix_rcv_add_addr(struct net *net, struct net_device *dev, |
5862 |
+ unsigned long now; |
5863 |
+ u32 stored_lft; |
5864 |
+ |
5865 |
+- /* Update lifetime (RFC4862 5.5.3 e) |
5866 |
+- * We deviate from RFC4862 by honoring all Valid Lifetimes to |
5867 |
+- * improve the reaction of SLAAC to renumbering events |
5868 |
+- * (draft-gont-6man-slaac-renum-06, Section 4.2) |
5869 |
+- */ |
5870 |
++ /* update lifetime (RFC2462 5.5.3 e) */ |
5871 |
+ spin_lock_bh(&ifp->lock); |
5872 |
+ now = jiffies; |
5873 |
+ if (ifp->valid_lft > (now - ifp->tstamp) / HZ) |
5874 |
+ stored_lft = ifp->valid_lft - (now - ifp->tstamp) / HZ; |
5875 |
+ else |
5876 |
+ stored_lft = 0; |
5877 |
+- |
5878 |
+ if (!create && stored_lft) { |
5879 |
++ const u32 minimum_lft = min_t(u32, |
5880 |
++ stored_lft, MIN_VALID_LIFETIME); |
5881 |
++ valid_lft = max(valid_lft, minimum_lft); |
5882 |
++ |
5883 |
++ /* RFC4862 Section 5.5.3e: |
5884 |
++ * "Note that the preferred lifetime of the |
5885 |
++ * corresponding address is always reset to |
5886 |
++ * the Preferred Lifetime in the received |
5887 |
++ * Prefix Information option, regardless of |
5888 |
++ * whether the valid lifetime is also reset or |
5889 |
++ * ignored." |
5890 |
++ * |
5891 |
++ * So we should always update prefered_lft here. |
5892 |
++ */ |
5893 |
++ update_lft = 1; |
5894 |
++ } |
5895 |
++ |
5896 |
++ if (update_lft) { |
5897 |
+ ifp->valid_lft = valid_lft; |
5898 |
+ ifp->prefered_lft = prefered_lft; |
5899 |
+ ifp->tstamp = now; |
5900 |
+diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c |
5901 |
+index 0371d2c141455..a506e57c4032a 100644 |
5902 |
+--- a/net/ipv6/ip6_fib.c |
5903 |
++++ b/net/ipv6/ip6_fib.c |
5904 |
+@@ -111,7 +111,7 @@ void fib6_update_sernum(struct net *net, struct fib6_info *f6i) |
5905 |
+ fn = rcu_dereference_protected(f6i->fib6_node, |
5906 |
+ lockdep_is_held(&f6i->fib6_table->tb6_lock)); |
5907 |
+ if (fn) |
5908 |
+- fn->fn_sernum = fib6_new_sernum(net); |
5909 |
++ WRITE_ONCE(fn->fn_sernum, fib6_new_sernum(net)); |
5910 |
+ } |
5911 |
+ |
5912 |
+ /* |
5913 |
+@@ -589,12 +589,13 @@ static int fib6_dump_table(struct fib6_table *table, struct sk_buff *skb, |
5914 |
+ spin_unlock_bh(&table->tb6_lock); |
5915 |
+ if (res > 0) { |
5916 |
+ cb->args[4] = 1; |
5917 |
+- cb->args[5] = w->root->fn_sernum; |
5918 |
++ cb->args[5] = READ_ONCE(w->root->fn_sernum); |
5919 |
+ } |
5920 |
+ } else { |
5921 |
+- if (cb->args[5] != w->root->fn_sernum) { |
5922 |
++ int sernum = READ_ONCE(w->root->fn_sernum); |
5923 |
++ if (cb->args[5] != sernum) { |
5924 |
+ /* Begin at the root if the tree changed */ |
5925 |
+- cb->args[5] = w->root->fn_sernum; |
5926 |
++ cb->args[5] = sernum; |
5927 |
+ w->state = FWS_INIT; |
5928 |
+ w->node = w->root; |
5929 |
+ w->skip = w->count; |
5930 |
+@@ -1344,7 +1345,7 @@ static void __fib6_update_sernum_upto_root(struct fib6_info *rt, |
5931 |
+ /* paired with smp_rmb() in fib6_get_cookie_safe() */ |
5932 |
+ smp_wmb(); |
5933 |
+ while (fn) { |
5934 |
+- fn->fn_sernum = sernum; |
5935 |
++ WRITE_ONCE(fn->fn_sernum, sernum); |
5936 |
+ fn = rcu_dereference_protected(fn->parent, |
5937 |
+ lockdep_is_held(&rt->fib6_table->tb6_lock)); |
5938 |
+ } |
5939 |
+@@ -2173,8 +2174,8 @@ static int fib6_clean_node(struct fib6_walker *w) |
5940 |
+ }; |
5941 |
+ |
5942 |
+ if (c->sernum != FIB6_NO_SERNUM_CHANGE && |
5943 |
+- w->node->fn_sernum != c->sernum) |
5944 |
+- w->node->fn_sernum = c->sernum; |
5945 |
++ READ_ONCE(w->node->fn_sernum) != c->sernum) |
5946 |
++ WRITE_ONCE(w->node->fn_sernum, c->sernum); |
5947 |
+ |
5948 |
+ if (!c->func) { |
5949 |
+ WARN_ON_ONCE(c->sernum == FIB6_NO_SERNUM_CHANGE); |
5950 |
+@@ -2542,7 +2543,7 @@ static void ipv6_route_seq_setup_walk(struct ipv6_route_iter *iter, |
5951 |
+ iter->w.state = FWS_INIT; |
5952 |
+ iter->w.node = iter->w.root; |
5953 |
+ iter->w.args = iter; |
5954 |
+- iter->sernum = iter->w.root->fn_sernum; |
5955 |
++ iter->sernum = READ_ONCE(iter->w.root->fn_sernum); |
5956 |
+ INIT_LIST_HEAD(&iter->w.lh); |
5957 |
+ fib6_walker_link(net, &iter->w); |
5958 |
+ } |
5959 |
+@@ -2570,8 +2571,10 @@ static struct fib6_table *ipv6_route_seq_next_table(struct fib6_table *tbl, |
5960 |
+ |
5961 |
+ static void ipv6_route_check_sernum(struct ipv6_route_iter *iter) |
5962 |
+ { |
5963 |
+- if (iter->sernum != iter->w.root->fn_sernum) { |
5964 |
+- iter->sernum = iter->w.root->fn_sernum; |
5965 |
++ int sernum = READ_ONCE(iter->w.root->fn_sernum); |
5966 |
++ |
5967 |
++ if (iter->sernum != sernum) { |
5968 |
++ iter->sernum = sernum; |
5969 |
+ iter->w.state = FWS_INIT; |
5970 |
+ iter->w.node = iter->w.root; |
5971 |
+ WARN_ON(iter->w.skip); |
5972 |
+diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c |
5973 |
+index 20a67efda47f5..fa8da8ff35b42 100644 |
5974 |
+--- a/net/ipv6/ip6_tunnel.c |
5975 |
++++ b/net/ipv6/ip6_tunnel.c |
5976 |
+@@ -1036,14 +1036,14 @@ int ip6_tnl_xmit_ctl(struct ip6_tnl *t, |
5977 |
+ |
5978 |
+ if (unlikely(!ipv6_chk_addr_and_flags(net, laddr, ldev, false, |
5979 |
+ 0, IFA_F_TENTATIVE))) |
5980 |
+- pr_warn("%s xmit: Local address not yet configured!\n", |
5981 |
+- p->name); |
5982 |
++ pr_warn_ratelimited("%s xmit: Local address not yet configured!\n", |
5983 |
++ p->name); |
5984 |
+ else if (!(p->flags & IP6_TNL_F_ALLOW_LOCAL_REMOTE) && |
5985 |
+ !ipv6_addr_is_multicast(raddr) && |
5986 |
+ unlikely(ipv6_chk_addr_and_flags(net, raddr, ldev, |
5987 |
+ true, 0, IFA_F_TENTATIVE))) |
5988 |
+- pr_warn("%s xmit: Routing loop! Remote address found on this node!\n", |
5989 |
+- p->name); |
5990 |
++ pr_warn_ratelimited("%s xmit: Routing loop! Remote address found on this node!\n", |
5991 |
++ p->name); |
5992 |
+ else |
5993 |
+ ret = 1; |
5994 |
+ rcu_read_unlock(); |
5995 |
+diff --git a/net/ipv6/route.c b/net/ipv6/route.c |
5996 |
+index 0632382a5427b..3c5bb49692206 100644 |
5997 |
+--- a/net/ipv6/route.c |
5998 |
++++ b/net/ipv6/route.c |
5999 |
+@@ -2802,7 +2802,7 @@ static void ip6_link_failure(struct sk_buff *skb) |
6000 |
+ if (from) { |
6001 |
+ fn = rcu_dereference(from->fib6_node); |
6002 |
+ if (fn && (rt->rt6i_flags & RTF_DEFAULT)) |
6003 |
+- fn->fn_sernum = -1; |
6004 |
++ WRITE_ONCE(fn->fn_sernum, -1); |
6005 |
+ } |
6006 |
+ } |
6007 |
+ rcu_read_unlock(); |
6008 |
+diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c |
6009 |
+index 4712a90a1820c..7f79974607643 100644 |
6010 |
+--- a/net/netfilter/nf_conntrack_core.c |
6011 |
++++ b/net/netfilter/nf_conntrack_core.c |
6012 |
+@@ -1922,15 +1922,17 @@ repeat: |
6013 |
+ pr_debug("nf_conntrack_in: Can't track with proto module\n"); |
6014 |
+ nf_conntrack_put(&ct->ct_general); |
6015 |
+ skb->_nfct = 0; |
6016 |
+- NF_CT_STAT_INC_ATOMIC(state->net, invalid); |
6017 |
+- if (ret == -NF_DROP) |
6018 |
+- NF_CT_STAT_INC_ATOMIC(state->net, drop); |
6019 |
+ /* Special case: TCP tracker reports an attempt to reopen a |
6020 |
+ * closed/aborted connection. We have to go back and create a |
6021 |
+ * fresh conntrack. |
6022 |
+ */ |
6023 |
+ if (ret == -NF_REPEAT) |
6024 |
+ goto repeat; |
6025 |
++ |
6026 |
++ NF_CT_STAT_INC_ATOMIC(state->net, invalid); |
6027 |
++ if (ret == -NF_DROP) |
6028 |
++ NF_CT_STAT_INC_ATOMIC(state->net, drop); |
6029 |
++ |
6030 |
+ ret = -ret; |
6031 |
+ goto out; |
6032 |
+ } |
6033 |
+diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c |
6034 |
+index 1bc7ef49e1487..1a138e8d32d66 100644 |
6035 |
+--- a/net/packet/af_packet.c |
6036 |
++++ b/net/packet/af_packet.c |
6037 |
+@@ -1738,6 +1738,7 @@ static int fanout_add(struct sock *sk, struct fanout_args *args) |
6038 |
+ match->prot_hook.dev = po->prot_hook.dev; |
6039 |
+ match->prot_hook.func = packet_rcv_fanout; |
6040 |
+ match->prot_hook.af_packet_priv = match; |
6041 |
++ match->prot_hook.af_packet_net = read_pnet(&match->net); |
6042 |
+ match->prot_hook.id_match = match_fanout_group; |
6043 |
+ match->max_num_members = args->max_num_members; |
6044 |
+ list_add(&match->list, &fanout_list); |
6045 |
+@@ -3323,6 +3324,7 @@ static int packet_create(struct net *net, struct socket *sock, int protocol, |
6046 |
+ po->prot_hook.func = packet_rcv_spkt; |
6047 |
+ |
6048 |
+ po->prot_hook.af_packet_priv = sk; |
6049 |
++ po->prot_hook.af_packet_net = sock_net(sk); |
6050 |
+ |
6051 |
+ if (proto) { |
6052 |
+ po->prot_hook.type = proto; |
6053 |
+diff --git a/net/rxrpc/call_event.c b/net/rxrpc/call_event.c |
6054 |
+index 6be2672a65eab..df864e6922679 100644 |
6055 |
+--- a/net/rxrpc/call_event.c |
6056 |
++++ b/net/rxrpc/call_event.c |
6057 |
+@@ -157,7 +157,7 @@ static void rxrpc_congestion_timeout(struct rxrpc_call *call) |
6058 |
+ static void rxrpc_resend(struct rxrpc_call *call, unsigned long now_j) |
6059 |
+ { |
6060 |
+ struct sk_buff *skb; |
6061 |
+- unsigned long resend_at, rto_j; |
6062 |
++ unsigned long resend_at; |
6063 |
+ rxrpc_seq_t cursor, seq, top; |
6064 |
+ ktime_t now, max_age, oldest, ack_ts; |
6065 |
+ int ix; |
6066 |
+@@ -165,10 +165,8 @@ static void rxrpc_resend(struct rxrpc_call *call, unsigned long now_j) |
6067 |
+ |
6068 |
+ _enter("{%d,%d}", call->tx_hard_ack, call->tx_top); |
6069 |
+ |
6070 |
+- rto_j = call->peer->rto_j; |
6071 |
+- |
6072 |
+ now = ktime_get_real(); |
6073 |
+- max_age = ktime_sub(now, jiffies_to_usecs(rto_j)); |
6074 |
++ max_age = ktime_sub(now, jiffies_to_usecs(call->peer->rto_j)); |
6075 |
+ |
6076 |
+ spin_lock_bh(&call->lock); |
6077 |
+ |
6078 |
+@@ -213,7 +211,7 @@ static void rxrpc_resend(struct rxrpc_call *call, unsigned long now_j) |
6079 |
+ } |
6080 |
+ |
6081 |
+ resend_at = nsecs_to_jiffies(ktime_to_ns(ktime_sub(now, oldest))); |
6082 |
+- resend_at += jiffies + rto_j; |
6083 |
++ resend_at += jiffies + rxrpc_get_rto_backoff(call->peer, retrans); |
6084 |
+ WRITE_ONCE(call->resend_at, resend_at); |
6085 |
+ |
6086 |
+ if (unacked) |
6087 |
+diff --git a/net/rxrpc/output.c b/net/rxrpc/output.c |
6088 |
+index 10f2bf2e9068a..a45c83f22236e 100644 |
6089 |
+--- a/net/rxrpc/output.c |
6090 |
++++ b/net/rxrpc/output.c |
6091 |
+@@ -468,7 +468,7 @@ done: |
6092 |
+ if (call->peer->rtt_count > 1) { |
6093 |
+ unsigned long nowj = jiffies, ack_lost_at; |
6094 |
+ |
6095 |
+- ack_lost_at = rxrpc_get_rto_backoff(call->peer, retrans); |
6096 |
++ ack_lost_at = rxrpc_get_rto_backoff(call->peer, false); |
6097 |
+ ack_lost_at += nowj; |
6098 |
+ WRITE_ONCE(call->ack_lost_at, ack_lost_at); |
6099 |
+ rxrpc_reduce_call_timer(call, ack_lost_at, nowj, |
6100 |
+diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c |
6101 |
+index 5067a6e5d4fde..5cbc32fee8674 100644 |
6102 |
+--- a/net/sched/sch_htb.c |
6103 |
++++ b/net/sched/sch_htb.c |
6104 |
+@@ -1803,6 +1803,26 @@ static int htb_change_class(struct Qdisc *sch, u32 classid, |
6105 |
+ if (!hopt->rate.rate || !hopt->ceil.rate) |
6106 |
+ goto failure; |
6107 |
+ |
6108 |
++ if (q->offload) { |
6109 |
++ /* Options not supported by the offload. */ |
6110 |
++ if (hopt->rate.overhead || hopt->ceil.overhead) { |
6111 |
++ NL_SET_ERR_MSG(extack, "HTB offload doesn't support the overhead parameter"); |
6112 |
++ goto failure; |
6113 |
++ } |
6114 |
++ if (hopt->rate.mpu || hopt->ceil.mpu) { |
6115 |
++ NL_SET_ERR_MSG(extack, "HTB offload doesn't support the mpu parameter"); |
6116 |
++ goto failure; |
6117 |
++ } |
6118 |
++ if (hopt->quantum) { |
6119 |
++ NL_SET_ERR_MSG(extack, "HTB offload doesn't support the quantum parameter"); |
6120 |
++ goto failure; |
6121 |
++ } |
6122 |
++ if (hopt->prio) { |
6123 |
++ NL_SET_ERR_MSG(extack, "HTB offload doesn't support the prio parameter"); |
6124 |
++ goto failure; |
6125 |
++ } |
6126 |
++ } |
6127 |
++ |
6128 |
+ /* Keeping backward compatible with rate_table based iproute2 tc */ |
6129 |
+ if (hopt->rate.linklayer == TC_LINKLAYER_UNAWARE) |
6130 |
+ qdisc_put_rtab(qdisc_get_rtab(&hopt->rate, tb[TCA_HTB_RTAB], |
6131 |
+diff --git a/net/smc/af_smc.c b/net/smc/af_smc.c |
6132 |
+index 07ff719f39077..34608369b426f 100644 |
6133 |
+--- a/net/smc/af_smc.c |
6134 |
++++ b/net/smc/af_smc.c |
6135 |
+@@ -548,12 +548,17 @@ static void smc_stat_fallback(struct smc_sock *smc) |
6136 |
+ mutex_unlock(&net->smc.mutex_fback_rsn); |
6137 |
+ } |
6138 |
+ |
6139 |
+-static void smc_switch_to_fallback(struct smc_sock *smc, int reason_code) |
6140 |
++static int smc_switch_to_fallback(struct smc_sock *smc, int reason_code) |
6141 |
+ { |
6142 |
+ wait_queue_head_t *smc_wait = sk_sleep(&smc->sk); |
6143 |
+- wait_queue_head_t *clc_wait = sk_sleep(smc->clcsock->sk); |
6144 |
++ wait_queue_head_t *clc_wait; |
6145 |
+ unsigned long flags; |
6146 |
+ |
6147 |
++ mutex_lock(&smc->clcsock_release_lock); |
6148 |
++ if (!smc->clcsock) { |
6149 |
++ mutex_unlock(&smc->clcsock_release_lock); |
6150 |
++ return -EBADF; |
6151 |
++ } |
6152 |
+ smc->use_fallback = true; |
6153 |
+ smc->fallback_rsn = reason_code; |
6154 |
+ smc_stat_fallback(smc); |
6155 |
+@@ -567,18 +572,30 @@ static void smc_switch_to_fallback(struct smc_sock *smc, int reason_code) |
6156 |
+ * smc socket->wq, which should be removed |
6157 |
+ * to clcsocket->wq during the fallback. |
6158 |
+ */ |
6159 |
++ clc_wait = sk_sleep(smc->clcsock->sk); |
6160 |
+ spin_lock_irqsave(&smc_wait->lock, flags); |
6161 |
+ spin_lock_nested(&clc_wait->lock, SINGLE_DEPTH_NESTING); |
6162 |
+ list_splice_init(&smc_wait->head, &clc_wait->head); |
6163 |
+ spin_unlock(&clc_wait->lock); |
6164 |
+ spin_unlock_irqrestore(&smc_wait->lock, flags); |
6165 |
+ } |
6166 |
++ mutex_unlock(&smc->clcsock_release_lock); |
6167 |
++ return 0; |
6168 |
+ } |
6169 |
+ |
6170 |
+ /* fall back during connect */ |
6171 |
+ static int smc_connect_fallback(struct smc_sock *smc, int reason_code) |
6172 |
+ { |
6173 |
+- smc_switch_to_fallback(smc, reason_code); |
6174 |
++ struct net *net = sock_net(&smc->sk); |
6175 |
++ int rc = 0; |
6176 |
++ |
6177 |
++ rc = smc_switch_to_fallback(smc, reason_code); |
6178 |
++ if (rc) { /* fallback fails */ |
6179 |
++ this_cpu_inc(net->smc.smc_stats->clnt_hshake_err_cnt); |
6180 |
++ if (smc->sk.sk_state == SMC_INIT) |
6181 |
++ sock_put(&smc->sk); /* passive closing */ |
6182 |
++ return rc; |
6183 |
++ } |
6184 |
+ smc_copy_sock_settings_to_clc(smc); |
6185 |
+ smc->connect_nonblock = 0; |
6186 |
+ if (smc->sk.sk_state == SMC_INIT) |
6187 |
+@@ -1384,11 +1401,12 @@ static void smc_listen_decline(struct smc_sock *new_smc, int reason_code, |
6188 |
+ { |
6189 |
+ /* RDMA setup failed, switch back to TCP */ |
6190 |
+ smc_conn_abort(new_smc, local_first); |
6191 |
+- if (reason_code < 0) { /* error, no fallback possible */ |
6192 |
++ if (reason_code < 0 || |
6193 |
++ smc_switch_to_fallback(new_smc, reason_code)) { |
6194 |
++ /* error, no fallback possible */ |
6195 |
+ smc_listen_out_err(new_smc); |
6196 |
+ return; |
6197 |
+ } |
6198 |
+- smc_switch_to_fallback(new_smc, reason_code); |
6199 |
+ if (reason_code && reason_code != SMC_CLC_DECL_PEERDECL) { |
6200 |
+ if (smc_clc_send_decline(new_smc, reason_code, version) < 0) { |
6201 |
+ smc_listen_out_err(new_smc); |
6202 |
+@@ -1761,8 +1779,11 @@ static void smc_listen_work(struct work_struct *work) |
6203 |
+ |
6204 |
+ /* check if peer is smc capable */ |
6205 |
+ if (!tcp_sk(newclcsock->sk)->syn_smc) { |
6206 |
+- smc_switch_to_fallback(new_smc, SMC_CLC_DECL_PEERNOSMC); |
6207 |
+- smc_listen_out_connected(new_smc); |
6208 |
++ rc = smc_switch_to_fallback(new_smc, SMC_CLC_DECL_PEERNOSMC); |
6209 |
++ if (rc) |
6210 |
++ smc_listen_out_err(new_smc); |
6211 |
++ else |
6212 |
++ smc_listen_out_connected(new_smc); |
6213 |
+ return; |
6214 |
+ } |
6215 |
+ |
6216 |
+@@ -2048,7 +2069,9 @@ static int smc_sendmsg(struct socket *sock, struct msghdr *msg, size_t len) |
6217 |
+ |
6218 |
+ if (msg->msg_flags & MSG_FASTOPEN) { |
6219 |
+ if (sk->sk_state == SMC_INIT && !smc->connect_nonblock) { |
6220 |
+- smc_switch_to_fallback(smc, SMC_CLC_DECL_OPTUNSUPP); |
6221 |
++ rc = smc_switch_to_fallback(smc, SMC_CLC_DECL_OPTUNSUPP); |
6222 |
++ if (rc) |
6223 |
++ goto out; |
6224 |
+ } else { |
6225 |
+ rc = -EINVAL; |
6226 |
+ goto out; |
6227 |
+@@ -2241,6 +2264,11 @@ static int smc_setsockopt(struct socket *sock, int level, int optname, |
6228 |
+ /* generic setsockopts reaching us here always apply to the |
6229 |
+ * CLC socket |
6230 |
+ */ |
6231 |
++ mutex_lock(&smc->clcsock_release_lock); |
6232 |
++ if (!smc->clcsock) { |
6233 |
++ mutex_unlock(&smc->clcsock_release_lock); |
6234 |
++ return -EBADF; |
6235 |
++ } |
6236 |
+ if (unlikely(!smc->clcsock->ops->setsockopt)) |
6237 |
+ rc = -EOPNOTSUPP; |
6238 |
+ else |
6239 |
+@@ -2250,6 +2278,7 @@ static int smc_setsockopt(struct socket *sock, int level, int optname, |
6240 |
+ sk->sk_err = smc->clcsock->sk->sk_err; |
6241 |
+ sk_error_report(sk); |
6242 |
+ } |
6243 |
++ mutex_unlock(&smc->clcsock_release_lock); |
6244 |
+ |
6245 |
+ if (optlen < sizeof(int)) |
6246 |
+ return -EINVAL; |
6247 |
+@@ -2266,7 +2295,7 @@ static int smc_setsockopt(struct socket *sock, int level, int optname, |
6248 |
+ case TCP_FASTOPEN_NO_COOKIE: |
6249 |
+ /* option not supported by SMC */ |
6250 |
+ if (sk->sk_state == SMC_INIT && !smc->connect_nonblock) { |
6251 |
+- smc_switch_to_fallback(smc, SMC_CLC_DECL_OPTUNSUPP); |
6252 |
++ rc = smc_switch_to_fallback(smc, SMC_CLC_DECL_OPTUNSUPP); |
6253 |
+ } else { |
6254 |
+ rc = -EINVAL; |
6255 |
+ } |
6256 |
+@@ -2309,13 +2338,23 @@ static int smc_getsockopt(struct socket *sock, int level, int optname, |
6257 |
+ char __user *optval, int __user *optlen) |
6258 |
+ { |
6259 |
+ struct smc_sock *smc; |
6260 |
++ int rc; |
6261 |
+ |
6262 |
+ smc = smc_sk(sock->sk); |
6263 |
++ mutex_lock(&smc->clcsock_release_lock); |
6264 |
++ if (!smc->clcsock) { |
6265 |
++ mutex_unlock(&smc->clcsock_release_lock); |
6266 |
++ return -EBADF; |
6267 |
++ } |
6268 |
+ /* socket options apply to the CLC socket */ |
6269 |
+- if (unlikely(!smc->clcsock->ops->getsockopt)) |
6270 |
++ if (unlikely(!smc->clcsock->ops->getsockopt)) { |
6271 |
++ mutex_unlock(&smc->clcsock_release_lock); |
6272 |
+ return -EOPNOTSUPP; |
6273 |
+- return smc->clcsock->ops->getsockopt(smc->clcsock, level, optname, |
6274 |
+- optval, optlen); |
6275 |
++ } |
6276 |
++ rc = smc->clcsock->ops->getsockopt(smc->clcsock, level, optname, |
6277 |
++ optval, optlen); |
6278 |
++ mutex_unlock(&smc->clcsock_release_lock); |
6279 |
++ return rc; |
6280 |
+ } |
6281 |
+ |
6282 |
+ static int smc_ioctl(struct socket *sock, unsigned int cmd, |
6283 |
+diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c |
6284 |
+index ee5336d73fddc..35588f0afa864 100644 |
6285 |
+--- a/net/sunrpc/rpc_pipe.c |
6286 |
++++ b/net/sunrpc/rpc_pipe.c |
6287 |
+@@ -600,9 +600,9 @@ static int __rpc_rmdir(struct inode *dir, struct dentry *dentry) |
6288 |
+ |
6289 |
+ dget(dentry); |
6290 |
+ ret = simple_rmdir(dir, dentry); |
6291 |
++ d_drop(dentry); |
6292 |
+ if (!ret) |
6293 |
+ fsnotify_rmdir(dir, dentry); |
6294 |
+- d_delete(dentry); |
6295 |
+ dput(dentry); |
6296 |
+ return ret; |
6297 |
+ } |
6298 |
+@@ -613,9 +613,9 @@ static int __rpc_unlink(struct inode *dir, struct dentry *dentry) |
6299 |
+ |
6300 |
+ dget(dentry); |
6301 |
+ ret = simple_unlink(dir, dentry); |
6302 |
++ d_drop(dentry); |
6303 |
+ if (!ret) |
6304 |
+ fsnotify_unlink(dir, dentry); |
6305 |
+- d_delete(dentry); |
6306 |
+ dput(dentry); |
6307 |
+ return ret; |
6308 |
+ } |
6309 |
+diff --git a/tools/testing/selftests/kvm/x86_64/smm_test.c b/tools/testing/selftests/kvm/x86_64/smm_test.c |
6310 |
+index d0fe2fdce58c4..db2a17559c3d5 100644 |
6311 |
+--- a/tools/testing/selftests/kvm/x86_64/smm_test.c |
6312 |
++++ b/tools/testing/selftests/kvm/x86_64/smm_test.c |
6313 |
+@@ -105,7 +105,6 @@ static void guest_code(void *arg) |
6314 |
+ |
6315 |
+ if (cpu_has_svm()) { |
6316 |
+ run_guest(svm->vmcb, svm->vmcb_gpa); |
6317 |
+- svm->vmcb->save.rip += 3; |
6318 |
+ run_guest(svm->vmcb, svm->vmcb_gpa); |
6319 |
+ } else { |
6320 |
+ vmlaunch(); |
6321 |
+diff --git a/usr/include/Makefile b/usr/include/Makefile |
6322 |
+index 1c2ae1368079d..adc6cb2587369 100644 |
6323 |
+--- a/usr/include/Makefile |
6324 |
++++ b/usr/include/Makefile |
6325 |
+@@ -28,13 +28,13 @@ no-header-test += linux/am437x-vpfe.h |
6326 |
+ no-header-test += linux/android/binder.h |
6327 |
+ no-header-test += linux/android/binderfs.h |
6328 |
+ no-header-test += linux/coda.h |
6329 |
++no-header-test += linux/cyclades.h |
6330 |
+ no-header-test += linux/errqueue.h |
6331 |
+ no-header-test += linux/fsmap.h |
6332 |
+ no-header-test += linux/hdlc/ioctl.h |
6333 |
+ no-header-test += linux/ivtv.h |
6334 |
+ no-header-test += linux/kexec.h |
6335 |
+ no-header-test += linux/matroxfb.h |
6336 |
+-no-header-test += linux/nfc.h |
6337 |
+ no-header-test += linux/omap3isp.h |
6338 |
+ no-header-test += linux/omapfb.h |
6339 |
+ no-header-test += linux/patchkey.h |
6340 |
+diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c |
6341 |
+index c6bfd4e15d28a..13aff136e6eef 100644 |
6342 |
+--- a/virt/kvm/kvm_main.c |
6343 |
++++ b/virt/kvm/kvm_main.c |
6344 |
+@@ -2104,7 +2104,6 @@ struct kvm_memory_slot *kvm_vcpu_gfn_to_memslot(struct kvm_vcpu *vcpu, gfn_t gfn |
6345 |
+ |
6346 |
+ return NULL; |
6347 |
+ } |
6348 |
+-EXPORT_SYMBOL_GPL(kvm_vcpu_gfn_to_memslot); |
6349 |
+ |
6350 |
+ bool kvm_is_visible_gfn(struct kvm *kvm, gfn_t gfn) |
6351 |
+ { |