1 |
commit: 26acee3a7d09b52f0931bbb00de5253f7ce5701c |
2 |
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
3 |
AuthorDate: Tue Dec 31 17:48:28 2019 +0000 |
4 |
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Dec 31 17:48:28 2019 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=26acee3a |
7 |
|
8 |
Linux patch 5.4.7 |
9 |
|
10 |
Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org> |
11 |
|
12 |
0000_README | 4 + |
13 |
1006_linux-5.4.7.patch | 13632 +++++++++++++++++++++++++++++++++++++++++++++++ |
14 |
2 files changed, 13636 insertions(+) |
15 |
|
16 |
diff --git a/0000_README b/0000_README |
17 |
index 223c519..ca2457e 100644 |
18 |
--- a/0000_README |
19 |
+++ b/0000_README |
20 |
@@ -67,6 +67,10 @@ Patch: 1005_linux-5.4.6.patch |
21 |
From: http://www.kernel.org |
22 |
Desc: Linux 5.4.6 |
23 |
|
24 |
+Patch: 1006_linux-5.4.7.patch |
25 |
+From: http://www.kernel.org |
26 |
+Desc: Linux 5.4.7 |
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/1006_linux-5.4.7.patch b/1006_linux-5.4.7.patch |
33 |
new file mode 100644 |
34 |
index 0000000..213068a |
35 |
--- /dev/null |
36 |
+++ b/1006_linux-5.4.7.patch |
37 |
@@ -0,0 +1,13632 @@ |
38 |
+diff --git a/Makefile b/Makefile |
39 |
+index 20ec7c20279e..0e2e0a034064 100644 |
40 |
+--- a/Makefile |
41 |
++++ b/Makefile |
42 |
+@@ -1,7 +1,7 @@ |
43 |
+ # SPDX-License-Identifier: GPL-2.0 |
44 |
+ VERSION = 5 |
45 |
+ PATCHLEVEL = 4 |
46 |
+-SUBLEVEL = 6 |
47 |
++SUBLEVEL = 7 |
48 |
+ EXTRAVERSION = |
49 |
+ NAME = Kleptomaniac Octopus |
50 |
+ |
51 |
+diff --git a/arch/arm/boot/dts/motorola-cpcap-mapphone.dtsi b/arch/arm/boot/dts/motorola-cpcap-mapphone.dtsi |
52 |
+index d1eae47b83f6..82f7ae030600 100644 |
53 |
+--- a/arch/arm/boot/dts/motorola-cpcap-mapphone.dtsi |
54 |
++++ b/arch/arm/boot/dts/motorola-cpcap-mapphone.dtsi |
55 |
+@@ -160,12 +160,12 @@ |
56 |
+ regulator-enable-ramp-delay = <1000>; |
57 |
+ }; |
58 |
+ |
59 |
+- /* Used by DSS */ |
60 |
++ /* Used by DSS and is the "zerov_regulator" trigger for SoC off mode */ |
61 |
+ vcsi: VCSI { |
62 |
+ regulator-min-microvolt = <1800000>; |
63 |
+ regulator-max-microvolt = <1800000>; |
64 |
+ regulator-enable-ramp-delay = <1000>; |
65 |
+- regulator-boot-on; |
66 |
++ regulator-always-on; |
67 |
+ }; |
68 |
+ |
69 |
+ vdac: VDAC { |
70 |
+diff --git a/arch/arm64/kernel/psci.c b/arch/arm64/kernel/psci.c |
71 |
+index c9f72b2665f1..43ae4e0c968f 100644 |
72 |
+--- a/arch/arm64/kernel/psci.c |
73 |
++++ b/arch/arm64/kernel/psci.c |
74 |
+@@ -81,7 +81,8 @@ static void cpu_psci_cpu_die(unsigned int cpu) |
75 |
+ |
76 |
+ static int cpu_psci_cpu_kill(unsigned int cpu) |
77 |
+ { |
78 |
+- int err, i; |
79 |
++ int err; |
80 |
++ unsigned long start, end; |
81 |
+ |
82 |
+ if (!psci_ops.affinity_info) |
83 |
+ return 0; |
84 |
+@@ -91,16 +92,18 @@ static int cpu_psci_cpu_kill(unsigned int cpu) |
85 |
+ * while it is dying. So, try again a few times. |
86 |
+ */ |
87 |
+ |
88 |
+- for (i = 0; i < 10; i++) { |
89 |
++ start = jiffies; |
90 |
++ end = start + msecs_to_jiffies(100); |
91 |
++ do { |
92 |
+ err = psci_ops.affinity_info(cpu_logical_map(cpu), 0); |
93 |
+ if (err == PSCI_0_2_AFFINITY_LEVEL_OFF) { |
94 |
+- pr_info("CPU%d killed.\n", cpu); |
95 |
++ pr_info("CPU%d killed (polled %d ms)\n", cpu, |
96 |
++ jiffies_to_msecs(jiffies - start)); |
97 |
+ return 0; |
98 |
+ } |
99 |
+ |
100 |
+- msleep(10); |
101 |
+- pr_info("Retrying again to check for CPU kill\n"); |
102 |
+- } |
103 |
++ usleep_range(100, 1000); |
104 |
++ } while (time_before(jiffies, end)); |
105 |
+ |
106 |
+ pr_warn("CPU%d may not have shut down cleanly (AFFINITY_INFO reports %d)\n", |
107 |
+ cpu, err); |
108 |
+diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c |
109 |
+index 46822afc57e0..01a515e0171e 100644 |
110 |
+--- a/arch/arm64/kvm/sys_regs.c |
111 |
++++ b/arch/arm64/kvm/sys_regs.c |
112 |
+@@ -2360,8 +2360,11 @@ static const struct sys_reg_desc *index_to_sys_reg_desc(struct kvm_vcpu *vcpu, |
113 |
+ if ((id & KVM_REG_ARM_COPROC_MASK) != KVM_REG_ARM64_SYSREG) |
114 |
+ return NULL; |
115 |
+ |
116 |
++ if (!index_to_params(id, ¶ms)) |
117 |
++ return NULL; |
118 |
++ |
119 |
+ table = get_target_table(vcpu->arch.target, true, &num); |
120 |
+- r = find_reg_by_id(id, ¶ms, table, num); |
121 |
++ r = find_reg(¶ms, table, num); |
122 |
+ if (!r) |
123 |
+ r = find_reg(¶ms, sys_reg_descs, ARRAY_SIZE(sys_reg_descs)); |
124 |
+ |
125 |
+diff --git a/arch/mips/include/asm/barrier.h b/arch/mips/include/asm/barrier.h |
126 |
+index 9228f7386220..fb842965d541 100644 |
127 |
+--- a/arch/mips/include/asm/barrier.h |
128 |
++++ b/arch/mips/include/asm/barrier.h |
129 |
+@@ -218,13 +218,14 @@ |
130 |
+ * ordering will be done by smp_llsc_mb() and friends. |
131 |
+ */ |
132 |
+ #if defined(CONFIG_WEAK_REORDERING_BEYOND_LLSC) && defined(CONFIG_SMP) |
133 |
+-#define __WEAK_LLSC_MB " sync \n" |
134 |
+-#define smp_llsc_mb() __asm__ __volatile__(__WEAK_LLSC_MB : : :"memory") |
135 |
+-#define __LLSC_CLOBBER |
136 |
++# define __WEAK_LLSC_MB sync |
137 |
++# define smp_llsc_mb() \ |
138 |
++ __asm__ __volatile__(__stringify(__WEAK_LLSC_MB) : : :"memory") |
139 |
++# define __LLSC_CLOBBER |
140 |
+ #else |
141 |
+-#define __WEAK_LLSC_MB " \n" |
142 |
+-#define smp_llsc_mb() do { } while (0) |
143 |
+-#define __LLSC_CLOBBER "memory" |
144 |
++# define __WEAK_LLSC_MB |
145 |
++# define smp_llsc_mb() do { } while (0) |
146 |
++# define __LLSC_CLOBBER "memory" |
147 |
+ #endif |
148 |
+ |
149 |
+ #ifdef CONFIG_CPU_CAVIUM_OCTEON |
150 |
+diff --git a/arch/mips/include/asm/futex.h b/arch/mips/include/asm/futex.h |
151 |
+index b83b0397462d..110220705e97 100644 |
152 |
+--- a/arch/mips/include/asm/futex.h |
153 |
++++ b/arch/mips/include/asm/futex.h |
154 |
+@@ -16,6 +16,7 @@ |
155 |
+ #include <asm/barrier.h> |
156 |
+ #include <asm/compiler.h> |
157 |
+ #include <asm/errno.h> |
158 |
++#include <asm/sync.h> |
159 |
+ #include <asm/war.h> |
160 |
+ |
161 |
+ #define __futex_atomic_op(insn, ret, oldval, uaddr, oparg) \ |
162 |
+@@ -32,7 +33,7 @@ |
163 |
+ " .set arch=r4000 \n" \ |
164 |
+ "2: sc $1, %2 \n" \ |
165 |
+ " beqzl $1, 1b \n" \ |
166 |
+- __WEAK_LLSC_MB \ |
167 |
++ __stringify(__WEAK_LLSC_MB) " \n" \ |
168 |
+ "3: \n" \ |
169 |
+ " .insn \n" \ |
170 |
+ " .set pop \n" \ |
171 |
+@@ -50,19 +51,19 @@ |
172 |
+ "i" (-EFAULT) \ |
173 |
+ : "memory"); \ |
174 |
+ } else if (cpu_has_llsc) { \ |
175 |
+- loongson_llsc_mb(); \ |
176 |
+ __asm__ __volatile__( \ |
177 |
+ " .set push \n" \ |
178 |
+ " .set noat \n" \ |
179 |
+ " .set push \n" \ |
180 |
+ " .set "MIPS_ISA_ARCH_LEVEL" \n" \ |
181 |
++ " " __SYNC(full, loongson3_war) " \n" \ |
182 |
+ "1: "user_ll("%1", "%4")" # __futex_atomic_op\n" \ |
183 |
+ " .set pop \n" \ |
184 |
+ " " insn " \n" \ |
185 |
+ " .set "MIPS_ISA_ARCH_LEVEL" \n" \ |
186 |
+ "2: "user_sc("$1", "%2")" \n" \ |
187 |
+ " beqz $1, 1b \n" \ |
188 |
+- __WEAK_LLSC_MB \ |
189 |
++ __stringify(__WEAK_LLSC_MB) " \n" \ |
190 |
+ "3: \n" \ |
191 |
+ " .insn \n" \ |
192 |
+ " .set pop \n" \ |
193 |
+@@ -147,7 +148,7 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr, |
194 |
+ " .set arch=r4000 \n" |
195 |
+ "2: sc $1, %2 \n" |
196 |
+ " beqzl $1, 1b \n" |
197 |
+- __WEAK_LLSC_MB |
198 |
++ __stringify(__WEAK_LLSC_MB) " \n" |
199 |
+ "3: \n" |
200 |
+ " .insn \n" |
201 |
+ " .set pop \n" |
202 |
+@@ -164,13 +165,13 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr, |
203 |
+ "i" (-EFAULT) |
204 |
+ : "memory"); |
205 |
+ } else if (cpu_has_llsc) { |
206 |
+- loongson_llsc_mb(); |
207 |
+ __asm__ __volatile__( |
208 |
+ "# futex_atomic_cmpxchg_inatomic \n" |
209 |
+ " .set push \n" |
210 |
+ " .set noat \n" |
211 |
+ " .set push \n" |
212 |
+ " .set "MIPS_ISA_ARCH_LEVEL" \n" |
213 |
++ " " __SYNC(full, loongson3_war) " \n" |
214 |
+ "1: "user_ll("%1", "%3")" \n" |
215 |
+ " bne %1, %z4, 3f \n" |
216 |
+ " .set pop \n" |
217 |
+@@ -178,8 +179,7 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr, |
218 |
+ " .set "MIPS_ISA_ARCH_LEVEL" \n" |
219 |
+ "2: "user_sc("$1", "%2")" \n" |
220 |
+ " beqz $1, 1b \n" |
221 |
+- __WEAK_LLSC_MB |
222 |
+- "3: \n" |
223 |
++ "3: " __SYNC_ELSE(full, loongson3_war, __WEAK_LLSC_MB) "\n" |
224 |
+ " .insn \n" |
225 |
+ " .set pop \n" |
226 |
+ " .section .fixup,\"ax\" \n" |
227 |
+@@ -194,7 +194,6 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr, |
228 |
+ : GCC_OFF_SMALL_ASM() (*uaddr), "Jr" (oldval), "Jr" (newval), |
229 |
+ "i" (-EFAULT) |
230 |
+ : "memory"); |
231 |
+- loongson_llsc_mb(); |
232 |
+ } else |
233 |
+ return -ENOSYS; |
234 |
+ |
235 |
+diff --git a/arch/mips/include/asm/pgtable-64.h b/arch/mips/include/asm/pgtable-64.h |
236 |
+index 93a9dce31f25..813dfe5f45a5 100644 |
237 |
+--- a/arch/mips/include/asm/pgtable-64.h |
238 |
++++ b/arch/mips/include/asm/pgtable-64.h |
239 |
+@@ -18,10 +18,12 @@ |
240 |
+ #include <asm/fixmap.h> |
241 |
+ |
242 |
+ #define __ARCH_USE_5LEVEL_HACK |
243 |
+-#if defined(CONFIG_PAGE_SIZE_64KB) && !defined(CONFIG_MIPS_VA_BITS_48) |
244 |
++#if CONFIG_PGTABLE_LEVELS == 2 |
245 |
+ #include <asm-generic/pgtable-nopmd.h> |
246 |
+-#elif !(defined(CONFIG_PAGE_SIZE_4KB) && defined(CONFIG_MIPS_VA_BITS_48)) |
247 |
++#elif CONFIG_PGTABLE_LEVELS == 3 |
248 |
+ #include <asm-generic/pgtable-nopud.h> |
249 |
++#else |
250 |
++#include <asm-generic/5level-fixup.h> |
251 |
+ #endif |
252 |
+ |
253 |
+ /* |
254 |
+@@ -216,6 +218,9 @@ static inline unsigned long pgd_page_vaddr(pgd_t pgd) |
255 |
+ return pgd_val(pgd); |
256 |
+ } |
257 |
+ |
258 |
++#define pgd_phys(pgd) virt_to_phys((void *)pgd_val(pgd)) |
259 |
++#define pgd_page(pgd) (pfn_to_page(pgd_phys(pgd) >> PAGE_SHIFT)) |
260 |
++ |
261 |
+ static inline pud_t *pud_offset(pgd_t *pgd, unsigned long address) |
262 |
+ { |
263 |
+ return (pud_t *)pgd_page_vaddr(*pgd) + pud_index(address); |
264 |
+diff --git a/arch/mips/ralink/Kconfig b/arch/mips/ralink/Kconfig |
265 |
+index 1434fa60f3db..94e9ce994494 100644 |
266 |
+--- a/arch/mips/ralink/Kconfig |
267 |
++++ b/arch/mips/ralink/Kconfig |
268 |
+@@ -51,6 +51,7 @@ choice |
269 |
+ select MIPS_GIC |
270 |
+ select COMMON_CLK |
271 |
+ select CLKSRC_MIPS_GIC |
272 |
++ select HAVE_PCI if PCI_MT7621 |
273 |
+ endchoice |
274 |
+ |
275 |
+ choice |
276 |
+diff --git a/arch/powerpc/include/asm/spinlock.h b/arch/powerpc/include/asm/spinlock.h |
277 |
+index e9a960e28f3c..cac95a3f30c2 100644 |
278 |
+--- a/arch/powerpc/include/asm/spinlock.h |
279 |
++++ b/arch/powerpc/include/asm/spinlock.h |
280 |
+@@ -36,10 +36,12 @@ |
281 |
+ #endif |
282 |
+ |
283 |
+ #ifdef CONFIG_PPC_PSERIES |
284 |
++DECLARE_STATIC_KEY_FALSE(shared_processor); |
285 |
++ |
286 |
+ #define vcpu_is_preempted vcpu_is_preempted |
287 |
+ static inline bool vcpu_is_preempted(int cpu) |
288 |
+ { |
289 |
+- if (!firmware_has_feature(FW_FEATURE_SPLPAR)) |
290 |
++ if (!static_branch_unlikely(&shared_processor)) |
291 |
+ return false; |
292 |
+ return !!(be32_to_cpu(lppaca_of(cpu).yield_count) & 1); |
293 |
+ } |
294 |
+diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c |
295 |
+index 5645bc9cbc09..add67498c126 100644 |
296 |
+--- a/arch/powerpc/kernel/irq.c |
297 |
++++ b/arch/powerpc/kernel/irq.c |
298 |
+@@ -619,8 +619,6 @@ void __do_irq(struct pt_regs *regs) |
299 |
+ |
300 |
+ trace_irq_entry(regs); |
301 |
+ |
302 |
+- check_stack_overflow(); |
303 |
+- |
304 |
+ /* |
305 |
+ * Query the platform PIC for the interrupt & ack it. |
306 |
+ * |
307 |
+@@ -652,6 +650,8 @@ void do_IRQ(struct pt_regs *regs) |
308 |
+ irqsp = hardirq_ctx[raw_smp_processor_id()]; |
309 |
+ sirqsp = softirq_ctx[raw_smp_processor_id()]; |
310 |
+ |
311 |
++ check_stack_overflow(); |
312 |
++ |
313 |
+ /* Already there ? */ |
314 |
+ if (unlikely(cursp == irqsp || cursp == sirqsp)) { |
315 |
+ __do_irq(regs); |
316 |
+diff --git a/arch/powerpc/kvm/book3s_hv_rmhandlers.S b/arch/powerpc/kvm/book3s_hv_rmhandlers.S |
317 |
+index 0496e66aaa56..c6fbbd29bd87 100644 |
318 |
+--- a/arch/powerpc/kvm/book3s_hv_rmhandlers.S |
319 |
++++ b/arch/powerpc/kvm/book3s_hv_rmhandlers.S |
320 |
+@@ -1117,7 +1117,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_300) |
321 |
+ ld r7, VCPU_GPR(R7)(r4) |
322 |
+ bne ret_to_ultra |
323 |
+ |
324 |
+- lwz r0, VCPU_CR(r4) |
325 |
++ ld r0, VCPU_CR(r4) |
326 |
+ mtcr r0 |
327 |
+ |
328 |
+ ld r0, VCPU_GPR(R0)(r4) |
329 |
+@@ -1137,7 +1137,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_300) |
330 |
+ * R3 = UV_RETURN |
331 |
+ */ |
332 |
+ ret_to_ultra: |
333 |
+- lwz r0, VCPU_CR(r4) |
334 |
++ ld r0, VCPU_CR(r4) |
335 |
+ mtcr r0 |
336 |
+ |
337 |
+ ld r0, VCPU_GPR(R3)(r4) |
338 |
+diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c |
339 |
+index 0a40201f315f..0c8421dd01ab 100644 |
340 |
+--- a/arch/powerpc/platforms/pseries/setup.c |
341 |
++++ b/arch/powerpc/platforms/pseries/setup.c |
342 |
+@@ -74,6 +74,9 @@ |
343 |
+ #include "pseries.h" |
344 |
+ #include "../../../../drivers/pci/pci.h" |
345 |
+ |
346 |
++DEFINE_STATIC_KEY_FALSE(shared_processor); |
347 |
++EXPORT_SYMBOL_GPL(shared_processor); |
348 |
++ |
349 |
+ int CMO_PrPSP = -1; |
350 |
+ int CMO_SecPSP = -1; |
351 |
+ unsigned long CMO_PageSize = (ASM_CONST(1) << IOMMU_PAGE_SHIFT_4K); |
352 |
+@@ -758,6 +761,10 @@ static void __init pSeries_setup_arch(void) |
353 |
+ |
354 |
+ if (firmware_has_feature(FW_FEATURE_LPAR)) { |
355 |
+ vpa_init(boot_cpuid); |
356 |
++ |
357 |
++ if (lppaca_shared_proc(get_lppaca())) |
358 |
++ static_branch_enable(&shared_processor); |
359 |
++ |
360 |
+ ppc_md.power_save = pseries_lpar_idle; |
361 |
+ ppc_md.enable_pmcs = pseries_lpar_enable_pmcs; |
362 |
+ #ifdef CONFIG_PCI_IOV |
363 |
+diff --git a/arch/s390/crypto/sha_common.c b/arch/s390/crypto/sha_common.c |
364 |
+index d39e0f079217..686fe7aa192f 100644 |
365 |
+--- a/arch/s390/crypto/sha_common.c |
366 |
++++ b/arch/s390/crypto/sha_common.c |
367 |
+@@ -74,14 +74,17 @@ int s390_sha_final(struct shash_desc *desc, u8 *out) |
368 |
+ struct s390_sha_ctx *ctx = shash_desc_ctx(desc); |
369 |
+ unsigned int bsize = crypto_shash_blocksize(desc->tfm); |
370 |
+ u64 bits; |
371 |
+- unsigned int n, mbl_offset; |
372 |
++ unsigned int n; |
373 |
++ int mbl_offset; |
374 |
+ |
375 |
+ n = ctx->count % bsize; |
376 |
+ bits = ctx->count * 8; |
377 |
+- mbl_offset = s390_crypto_shash_parmsize(ctx->func) / sizeof(u32); |
378 |
++ mbl_offset = s390_crypto_shash_parmsize(ctx->func); |
379 |
+ if (mbl_offset < 0) |
380 |
+ return -EINVAL; |
381 |
+ |
382 |
++ mbl_offset = mbl_offset / sizeof(u32); |
383 |
++ |
384 |
+ /* set total msg bit length (mbl) in CPACF parmblock */ |
385 |
+ switch (ctx->func) { |
386 |
+ case CPACF_KLMD_SHA_1: |
387 |
+diff --git a/arch/s390/include/asm/pgalloc.h b/arch/s390/include/asm/pgalloc.h |
388 |
+index bccb8f4a63e2..77606c4acd58 100644 |
389 |
+--- a/arch/s390/include/asm/pgalloc.h |
390 |
++++ b/arch/s390/include/asm/pgalloc.h |
391 |
+@@ -56,7 +56,12 @@ static inline p4d_t *p4d_alloc_one(struct mm_struct *mm, unsigned long address) |
392 |
+ crst_table_init(table, _REGION2_ENTRY_EMPTY); |
393 |
+ return (p4d_t *) table; |
394 |
+ } |
395 |
+-#define p4d_free(mm, p4d) crst_table_free(mm, (unsigned long *) p4d) |
396 |
++ |
397 |
++static inline void p4d_free(struct mm_struct *mm, p4d_t *p4d) |
398 |
++{ |
399 |
++ if (!mm_p4d_folded(mm)) |
400 |
++ crst_table_free(mm, (unsigned long *) p4d); |
401 |
++} |
402 |
+ |
403 |
+ static inline pud_t *pud_alloc_one(struct mm_struct *mm, unsigned long address) |
404 |
+ { |
405 |
+@@ -65,7 +70,12 @@ static inline pud_t *pud_alloc_one(struct mm_struct *mm, unsigned long address) |
406 |
+ crst_table_init(table, _REGION3_ENTRY_EMPTY); |
407 |
+ return (pud_t *) table; |
408 |
+ } |
409 |
+-#define pud_free(mm, pud) crst_table_free(mm, (unsigned long *) pud) |
410 |
++ |
411 |
++static inline void pud_free(struct mm_struct *mm, pud_t *pud) |
412 |
++{ |
413 |
++ if (!mm_pud_folded(mm)) |
414 |
++ crst_table_free(mm, (unsigned long *) pud); |
415 |
++} |
416 |
+ |
417 |
+ static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long vmaddr) |
418 |
+ { |
419 |
+@@ -83,6 +93,8 @@ static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long vmaddr) |
420 |
+ |
421 |
+ static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd) |
422 |
+ { |
423 |
++ if (mm_pmd_folded(mm)) |
424 |
++ return; |
425 |
+ pgtable_pmd_page_dtor(virt_to_page(pmd)); |
426 |
+ crst_table_free(mm, (unsigned long *) pmd); |
427 |
+ } |
428 |
+diff --git a/arch/s390/include/asm/timex.h b/arch/s390/include/asm/timex.h |
429 |
+index 64539c221672..2dc9eb4e1acc 100644 |
430 |
+--- a/arch/s390/include/asm/timex.h |
431 |
++++ b/arch/s390/include/asm/timex.h |
432 |
+@@ -10,8 +10,9 @@ |
433 |
+ #ifndef _ASM_S390_TIMEX_H |
434 |
+ #define _ASM_S390_TIMEX_H |
435 |
+ |
436 |
+-#include <asm/lowcore.h> |
437 |
++#include <linux/preempt.h> |
438 |
+ #include <linux/time64.h> |
439 |
++#include <asm/lowcore.h> |
440 |
+ |
441 |
+ /* The value of the TOD clock for 1.1.1970. */ |
442 |
+ #define TOD_UNIX_EPOCH 0x7d91048bca000000ULL |
443 |
+@@ -186,15 +187,18 @@ extern unsigned char tod_clock_base[16] __aligned(8); |
444 |
+ /** |
445 |
+ * get_clock_monotonic - returns current time in clock rate units |
446 |
+ * |
447 |
+- * The caller must ensure that preemption is disabled. |
448 |
+ * The clock and tod_clock_base get changed via stop_machine. |
449 |
+- * Therefore preemption must be disabled when calling this |
450 |
+- * function, otherwise the returned value is not guaranteed to |
451 |
+- * be monotonic. |
452 |
++ * Therefore preemption must be disabled, otherwise the returned |
453 |
++ * value is not guaranteed to be monotonic. |
454 |
+ */ |
455 |
+ static inline unsigned long long get_tod_clock_monotonic(void) |
456 |
+ { |
457 |
+- return get_tod_clock() - *(unsigned long long *) &tod_clock_base[1]; |
458 |
++ unsigned long long tod; |
459 |
++ |
460 |
++ preempt_disable_notrace(); |
461 |
++ tod = get_tod_clock() - *(unsigned long long *) &tod_clock_base[1]; |
462 |
++ preempt_enable_notrace(); |
463 |
++ return tod; |
464 |
+ } |
465 |
+ |
466 |
+ /** |
467 |
+diff --git a/arch/s390/kernel/dis.c b/arch/s390/kernel/dis.c |
468 |
+index 7abe6ae261b4..f304802ecf7b 100644 |
469 |
+--- a/arch/s390/kernel/dis.c |
470 |
++++ b/arch/s390/kernel/dis.c |
471 |
+@@ -461,10 +461,11 @@ static int print_insn(char *buffer, unsigned char *code, unsigned long addr) |
472 |
+ ptr += sprintf(ptr, "%%c%i", value); |
473 |
+ else if (operand->flags & OPERAND_VR) |
474 |
+ ptr += sprintf(ptr, "%%v%i", value); |
475 |
+- else if (operand->flags & OPERAND_PCREL) |
476 |
+- ptr += sprintf(ptr, "%lx", (signed int) value |
477 |
+- + addr); |
478 |
+- else if (operand->flags & OPERAND_SIGNED) |
479 |
++ else if (operand->flags & OPERAND_PCREL) { |
480 |
++ void *pcrel = (void *)((int)value + addr); |
481 |
++ |
482 |
++ ptr += sprintf(ptr, "%px", pcrel); |
483 |
++ } else if (operand->flags & OPERAND_SIGNED) |
484 |
+ ptr += sprintf(ptr, "%i", value); |
485 |
+ else |
486 |
+ ptr += sprintf(ptr, "%u", value); |
487 |
+@@ -536,7 +537,7 @@ void show_code(struct pt_regs *regs) |
488 |
+ else |
489 |
+ *ptr++ = ' '; |
490 |
+ addr = regs->psw.addr + start - 32; |
491 |
+- ptr += sprintf(ptr, "%016lx: ", addr); |
492 |
++ ptr += sprintf(ptr, "%px: ", (void *)addr); |
493 |
+ if (start + opsize >= end) |
494 |
+ break; |
495 |
+ for (i = 0; i < opsize; i++) |
496 |
+@@ -564,7 +565,7 @@ void print_fn_code(unsigned char *code, unsigned long len) |
497 |
+ opsize = insn_length(*code); |
498 |
+ if (opsize > len) |
499 |
+ break; |
500 |
+- ptr += sprintf(ptr, "%p: ", code); |
501 |
++ ptr += sprintf(ptr, "%px: ", code); |
502 |
+ for (i = 0; i < opsize; i++) |
503 |
+ ptr += sprintf(ptr, "%02x", code[i]); |
504 |
+ *ptr++ = '\t'; |
505 |
+diff --git a/arch/s390/kernel/perf_cpum_cf.c b/arch/s390/kernel/perf_cpum_cf.c |
506 |
+index 48d48b6187c0..0eb1d1cc53a8 100644 |
507 |
+--- a/arch/s390/kernel/perf_cpum_cf.c |
508 |
++++ b/arch/s390/kernel/perf_cpum_cf.c |
509 |
+@@ -199,7 +199,7 @@ static const int cpumf_generic_events_user[] = { |
510 |
+ [PERF_COUNT_HW_BUS_CYCLES] = -1, |
511 |
+ }; |
512 |
+ |
513 |
+-static int __hw_perf_event_init(struct perf_event *event) |
514 |
++static int __hw_perf_event_init(struct perf_event *event, unsigned int type) |
515 |
+ { |
516 |
+ struct perf_event_attr *attr = &event->attr; |
517 |
+ struct hw_perf_event *hwc = &event->hw; |
518 |
+@@ -207,7 +207,7 @@ static int __hw_perf_event_init(struct perf_event *event) |
519 |
+ int err = 0; |
520 |
+ u64 ev; |
521 |
+ |
522 |
+- switch (attr->type) { |
523 |
++ switch (type) { |
524 |
+ case PERF_TYPE_RAW: |
525 |
+ /* Raw events are used to access counters directly, |
526 |
+ * hence do not permit excludes */ |
527 |
+@@ -294,17 +294,16 @@ static int __hw_perf_event_init(struct perf_event *event) |
528 |
+ |
529 |
+ static int cpumf_pmu_event_init(struct perf_event *event) |
530 |
+ { |
531 |
++ unsigned int type = event->attr.type; |
532 |
+ int err; |
533 |
+ |
534 |
+- switch (event->attr.type) { |
535 |
+- case PERF_TYPE_HARDWARE: |
536 |
+- case PERF_TYPE_HW_CACHE: |
537 |
+- case PERF_TYPE_RAW: |
538 |
+- err = __hw_perf_event_init(event); |
539 |
+- break; |
540 |
+- default: |
541 |
++ if (type == PERF_TYPE_HARDWARE || type == PERF_TYPE_RAW) |
542 |
++ err = __hw_perf_event_init(event, type); |
543 |
++ else if (event->pmu->type == type) |
544 |
++ /* Registered as unknown PMU */ |
545 |
++ err = __hw_perf_event_init(event, PERF_TYPE_RAW); |
546 |
++ else |
547 |
+ return -ENOENT; |
548 |
+- } |
549 |
+ |
550 |
+ if (unlikely(err) && event->destroy) |
551 |
+ event->destroy(event); |
552 |
+@@ -553,7 +552,7 @@ static int __init cpumf_pmu_init(void) |
553 |
+ return -ENODEV; |
554 |
+ |
555 |
+ cpumf_pmu.attr_groups = cpumf_cf_event_group(); |
556 |
+- rc = perf_pmu_register(&cpumf_pmu, "cpum_cf", PERF_TYPE_RAW); |
557 |
++ rc = perf_pmu_register(&cpumf_pmu, "cpum_cf", -1); |
558 |
+ if (rc) |
559 |
+ pr_err("Registering the cpum_cf PMU failed with rc=%i\n", rc); |
560 |
+ return rc; |
561 |
+diff --git a/arch/s390/kernel/perf_cpum_cf_diag.c b/arch/s390/kernel/perf_cpum_cf_diag.c |
562 |
+index 2654e348801a..e949ab832ed7 100644 |
563 |
+--- a/arch/s390/kernel/perf_cpum_cf_diag.c |
564 |
++++ b/arch/s390/kernel/perf_cpum_cf_diag.c |
565 |
+@@ -243,13 +243,13 @@ static int cf_diag_event_init(struct perf_event *event) |
566 |
+ int err = -ENOENT; |
567 |
+ |
568 |
+ debug_sprintf_event(cf_diag_dbg, 5, |
569 |
+- "%s event %p cpu %d config %#llx " |
570 |
++ "%s event %p cpu %d config %#llx type:%u " |
571 |
+ "sample_type %#llx cf_diag_events %d\n", __func__, |
572 |
+- event, event->cpu, attr->config, attr->sample_type, |
573 |
+- atomic_read(&cf_diag_events)); |
574 |
++ event, event->cpu, attr->config, event->pmu->type, |
575 |
++ attr->sample_type, atomic_read(&cf_diag_events)); |
576 |
+ |
577 |
+ if (event->attr.config != PERF_EVENT_CPUM_CF_DIAG || |
578 |
+- event->attr.type != PERF_TYPE_RAW) |
579 |
++ event->attr.type != event->pmu->type) |
580 |
+ goto out; |
581 |
+ |
582 |
+ /* Raw events are used to access counters directly, |
583 |
+@@ -693,7 +693,7 @@ static int __init cf_diag_init(void) |
584 |
+ } |
585 |
+ debug_register_view(cf_diag_dbg, &debug_sprintf_view); |
586 |
+ |
587 |
+- rc = perf_pmu_register(&cf_diag, "cpum_cf_diag", PERF_TYPE_RAW); |
588 |
++ rc = perf_pmu_register(&cf_diag, "cpum_cf_diag", -1); |
589 |
+ if (rc) { |
590 |
+ debug_unregister_view(cf_diag_dbg, &debug_sprintf_view); |
591 |
+ debug_unregister(cf_diag_dbg); |
592 |
+diff --git a/arch/s390/kernel/perf_event.c b/arch/s390/kernel/perf_event.c |
593 |
+index fcb6c2e92b07..1e75cc983546 100644 |
594 |
+--- a/arch/s390/kernel/perf_event.c |
595 |
++++ b/arch/s390/kernel/perf_event.c |
596 |
+@@ -224,9 +224,13 @@ void perf_callchain_kernel(struct perf_callchain_entry_ctx *entry, |
597 |
+ struct pt_regs *regs) |
598 |
+ { |
599 |
+ struct unwind_state state; |
600 |
++ unsigned long addr; |
601 |
+ |
602 |
+- unwind_for_each_frame(&state, current, regs, 0) |
603 |
+- perf_callchain_store(entry, state.ip); |
604 |
++ unwind_for_each_frame(&state, current, regs, 0) { |
605 |
++ addr = unwind_get_return_address(&state); |
606 |
++ if (!addr || perf_callchain_store(entry, addr)) |
607 |
++ return; |
608 |
++ } |
609 |
+ } |
610 |
+ |
611 |
+ /* Perf definitions for PMU event attributes in sysfs */ |
612 |
+diff --git a/arch/s390/mm/maccess.c b/arch/s390/mm/maccess.c |
613 |
+index 1864a8bb9622..59ad7997fed1 100644 |
614 |
+--- a/arch/s390/mm/maccess.c |
615 |
++++ b/arch/s390/mm/maccess.c |
616 |
+@@ -70,7 +70,7 @@ void notrace s390_kernel_write(void *dst, const void *src, size_t size) |
617 |
+ spin_unlock_irqrestore(&s390_kernel_write_lock, flags); |
618 |
+ } |
619 |
+ |
620 |
+-static int __memcpy_real(void *dest, void *src, size_t count) |
621 |
++static int __no_sanitize_address __memcpy_real(void *dest, void *src, size_t count) |
622 |
+ { |
623 |
+ register unsigned long _dest asm("2") = (unsigned long) dest; |
624 |
+ register unsigned long _len1 asm("3") = (unsigned long) count; |
625 |
+@@ -91,19 +91,23 @@ static int __memcpy_real(void *dest, void *src, size_t count) |
626 |
+ return rc; |
627 |
+ } |
628 |
+ |
629 |
+-static unsigned long _memcpy_real(unsigned long dest, unsigned long src, |
630 |
+- unsigned long count) |
631 |
++static unsigned long __no_sanitize_address _memcpy_real(unsigned long dest, |
632 |
++ unsigned long src, |
633 |
++ unsigned long count) |
634 |
+ { |
635 |
+ int irqs_disabled, rc; |
636 |
+ unsigned long flags; |
637 |
+ |
638 |
+ if (!count) |
639 |
+ return 0; |
640 |
+- flags = __arch_local_irq_stnsm(0xf8UL); |
641 |
++ flags = arch_local_irq_save(); |
642 |
+ irqs_disabled = arch_irqs_disabled_flags(flags); |
643 |
+ if (!irqs_disabled) |
644 |
+ trace_hardirqs_off(); |
645 |
++ __arch_local_irq_stnsm(0xf8); // disable DAT |
646 |
+ rc = __memcpy_real((void *) dest, (void *) src, (size_t) count); |
647 |
++ if (flags & PSW_MASK_DAT) |
648 |
++ __arch_local_irq_stosm(0x04); // enable DAT |
649 |
+ if (!irqs_disabled) |
650 |
+ trace_hardirqs_on(); |
651 |
+ __arch_local_irq_ssm(flags); |
652 |
+diff --git a/arch/s390/net/bpf_jit_comp.c b/arch/s390/net/bpf_jit_comp.c |
653 |
+index ce88211b9c6c..c8c16b5eed6b 100644 |
654 |
+--- a/arch/s390/net/bpf_jit_comp.c |
655 |
++++ b/arch/s390/net/bpf_jit_comp.c |
656 |
+@@ -23,6 +23,7 @@ |
657 |
+ #include <linux/filter.h> |
658 |
+ #include <linux/init.h> |
659 |
+ #include <linux/bpf.h> |
660 |
++#include <linux/mm.h> |
661 |
+ #include <asm/cacheflush.h> |
662 |
+ #include <asm/dis.h> |
663 |
+ #include <asm/facility.h> |
664 |
+@@ -1369,7 +1370,7 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *fp) |
665 |
+ } |
666 |
+ |
667 |
+ memset(&jit, 0, sizeof(jit)); |
668 |
+- jit.addrs = kcalloc(fp->len + 1, sizeof(*jit.addrs), GFP_KERNEL); |
669 |
++ jit.addrs = kvcalloc(fp->len + 1, sizeof(*jit.addrs), GFP_KERNEL); |
670 |
+ if (jit.addrs == NULL) { |
671 |
+ fp = orig_fp; |
672 |
+ goto out; |
673 |
+@@ -1422,7 +1423,7 @@ skip_init_ctx: |
674 |
+ if (!fp->is_func || extra_pass) { |
675 |
+ bpf_prog_fill_jited_linfo(fp, jit.addrs + 1); |
676 |
+ free_addrs: |
677 |
+- kfree(jit.addrs); |
678 |
++ kvfree(jit.addrs); |
679 |
+ kfree(jit_data); |
680 |
+ fp->aux->jit_data = NULL; |
681 |
+ } |
682 |
+diff --git a/arch/sh/include/cpu-sh4/cpu/sh7734.h b/arch/sh/include/cpu-sh4/cpu/sh7734.h |
683 |
+index 96f0246ad2f2..82b63208135a 100644 |
684 |
+--- a/arch/sh/include/cpu-sh4/cpu/sh7734.h |
685 |
++++ b/arch/sh/include/cpu-sh4/cpu/sh7734.h |
686 |
+@@ -134,7 +134,7 @@ enum { |
687 |
+ GPIO_FN_EX_WAIT1, GPIO_FN_SD1_DAT0_A, GPIO_FN_DREQ2, GPIO_FN_CAN1_TX_C, |
688 |
+ GPIO_FN_ET0_LINK_C, GPIO_FN_ET0_ETXD5_A, |
689 |
+ GPIO_FN_EX_WAIT0, GPIO_FN_TCLK1_B, |
690 |
+- GPIO_FN_RD_WR, GPIO_FN_TCLK0, |
691 |
++ GPIO_FN_RD_WR, GPIO_FN_TCLK0, GPIO_FN_CAN_CLK_B, GPIO_FN_ET0_ETXD4, |
692 |
+ GPIO_FN_EX_CS5, GPIO_FN_SD1_CMD_A, GPIO_FN_ATADIR, GPIO_FN_QSSL_B, |
693 |
+ GPIO_FN_ET0_ETXD3_A, |
694 |
+ GPIO_FN_EX_CS4, GPIO_FN_SD1_WP_A, GPIO_FN_ATAWR, GPIO_FN_QMI_QIO1_B, |
695 |
+diff --git a/arch/x86/include/asm/crash.h b/arch/x86/include/asm/crash.h |
696 |
+index 0acf5ee45a21..ef5638f641f2 100644 |
697 |
+--- a/arch/x86/include/asm/crash.h |
698 |
++++ b/arch/x86/include/asm/crash.h |
699 |
+@@ -2,6 +2,8 @@ |
700 |
+ #ifndef _ASM_X86_CRASH_H |
701 |
+ #define _ASM_X86_CRASH_H |
702 |
+ |
703 |
++struct kimage; |
704 |
++ |
705 |
+ int crash_load_segments(struct kimage *image); |
706 |
+ int crash_copy_backup_region(struct kimage *image); |
707 |
+ int crash_setup_memmap_entries(struct kimage *image, |
708 |
+diff --git a/arch/x86/include/asm/fixmap.h b/arch/x86/include/asm/fixmap.h |
709 |
+index 0c47aa82e2e2..28183ee3cc42 100644 |
710 |
+--- a/arch/x86/include/asm/fixmap.h |
711 |
++++ b/arch/x86/include/asm/fixmap.h |
712 |
+@@ -156,7 +156,7 @@ extern pte_t *kmap_pte; |
713 |
+ extern pte_t *pkmap_page_table; |
714 |
+ |
715 |
+ void __native_set_fixmap(enum fixed_addresses idx, pte_t pte); |
716 |
+-void native_set_fixmap(enum fixed_addresses idx, |
717 |
++void native_set_fixmap(unsigned /* enum fixed_addresses */ idx, |
718 |
+ phys_addr_t phys, pgprot_t flags); |
719 |
+ |
720 |
+ #ifndef CONFIG_PARAVIRT_XXL |
721 |
+diff --git a/arch/x86/include/asm/syscall_wrapper.h b/arch/x86/include/asm/syscall_wrapper.h |
722 |
+index e046a405743d..90eb70df0b18 100644 |
723 |
+--- a/arch/x86/include/asm/syscall_wrapper.h |
724 |
++++ b/arch/x86/include/asm/syscall_wrapper.h |
725 |
+@@ -48,12 +48,13 @@ |
726 |
+ * To keep the naming coherent, re-define SYSCALL_DEFINE0 to create an alias |
727 |
+ * named __ia32_sys_*() |
728 |
+ */ |
729 |
+-#define SYSCALL_DEFINE0(sname) \ |
730 |
+- SYSCALL_METADATA(_##sname, 0); \ |
731 |
+- asmlinkage long __x64_sys_##sname(void); \ |
732 |
+- ALLOW_ERROR_INJECTION(__x64_sys_##sname, ERRNO); \ |
733 |
+- SYSCALL_ALIAS(__ia32_sys_##sname, __x64_sys_##sname); \ |
734 |
+- asmlinkage long __x64_sys_##sname(void) |
735 |
++ |
736 |
++#define SYSCALL_DEFINE0(sname) \ |
737 |
++ SYSCALL_METADATA(_##sname, 0); \ |
738 |
++ asmlinkage long __x64_sys_##sname(const struct pt_regs *__unused);\ |
739 |
++ ALLOW_ERROR_INJECTION(__x64_sys_##sname, ERRNO); \ |
740 |
++ SYSCALL_ALIAS(__ia32_sys_##sname, __x64_sys_##sname); \ |
741 |
++ asmlinkage long __x64_sys_##sname(const struct pt_regs *__unused) |
742 |
+ |
743 |
+ #define COND_SYSCALL(name) \ |
744 |
+ cond_syscall(__x64_sys_##name); \ |
745 |
+@@ -181,11 +182,11 @@ |
746 |
+ * macros to work correctly. |
747 |
+ */ |
748 |
+ #ifndef SYSCALL_DEFINE0 |
749 |
+-#define SYSCALL_DEFINE0(sname) \ |
750 |
+- SYSCALL_METADATA(_##sname, 0); \ |
751 |
+- asmlinkage long __x64_sys_##sname(void); \ |
752 |
+- ALLOW_ERROR_INJECTION(__x64_sys_##sname, ERRNO); \ |
753 |
+- asmlinkage long __x64_sys_##sname(void) |
754 |
++#define SYSCALL_DEFINE0(sname) \ |
755 |
++ SYSCALL_METADATA(_##sname, 0); \ |
756 |
++ asmlinkage long __x64_sys_##sname(const struct pt_regs *__unused);\ |
757 |
++ ALLOW_ERROR_INJECTION(__x64_sys_##sname, ERRNO); \ |
758 |
++ asmlinkage long __x64_sys_##sname(const struct pt_regs *__unused) |
759 |
+ #endif |
760 |
+ |
761 |
+ #ifndef COND_SYSCALL |
762 |
+diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c |
763 |
+index d6af97fd170a..f0262cb5657a 100644 |
764 |
+--- a/arch/x86/kernel/apic/io_apic.c |
765 |
++++ b/arch/x86/kernel/apic/io_apic.c |
766 |
+@@ -1727,9 +1727,10 @@ static bool io_apic_level_ack_pending(struct mp_chip_data *data) |
767 |
+ |
768 |
+ static inline bool ioapic_irqd_mask(struct irq_data *data) |
769 |
+ { |
770 |
+- /* If we are moving the irq we need to mask it */ |
771 |
++ /* If we are moving the IRQ we need to mask it */ |
772 |
+ if (unlikely(irqd_is_setaffinity_pending(data))) { |
773 |
+- mask_ioapic_irq(data); |
774 |
++ if (!irqd_irq_masked(data)) |
775 |
++ mask_ioapic_irq(data); |
776 |
+ return true; |
777 |
+ } |
778 |
+ return false; |
779 |
+@@ -1766,7 +1767,9 @@ static inline void ioapic_irqd_unmask(struct irq_data *data, bool masked) |
780 |
+ */ |
781 |
+ if (!io_apic_level_ack_pending(data->chip_data)) |
782 |
+ irq_move_masked_irq(data); |
783 |
+- unmask_ioapic_irq(data); |
784 |
++ /* If the IRQ is masked in the core, leave it: */ |
785 |
++ if (!irqd_irq_masked(data)) |
786 |
++ unmask_ioapic_irq(data); |
787 |
+ } |
788 |
+ } |
789 |
+ #else |
790 |
+diff --git a/arch/x86/kernel/cpu/mce/amd.c b/arch/x86/kernel/cpu/mce/amd.c |
791 |
+index 6ea7fdc82f3c..259f3f4e2e5f 100644 |
792 |
+--- a/arch/x86/kernel/cpu/mce/amd.c |
793 |
++++ b/arch/x86/kernel/cpu/mce/amd.c |
794 |
+@@ -266,10 +266,10 @@ static void smca_configure(unsigned int bank, unsigned int cpu) |
795 |
+ smca_set_misc_banks_map(bank, cpu); |
796 |
+ |
797 |
+ /* Return early if this bank was already initialized. */ |
798 |
+- if (smca_banks[bank].hwid) |
799 |
++ if (smca_banks[bank].hwid && smca_banks[bank].hwid->hwid_mcatype != 0) |
800 |
+ return; |
801 |
+ |
802 |
+- if (rdmsr_safe_on_cpu(cpu, MSR_AMD64_SMCA_MCx_IPID(bank), &low, &high)) { |
803 |
++ if (rdmsr_safe(MSR_AMD64_SMCA_MCx_IPID(bank), &low, &high)) { |
804 |
+ pr_warn("Failed to read MCA_IPID for bank %d\n", bank); |
805 |
+ return; |
806 |
+ } |
807 |
+diff --git a/arch/x86/kernel/cpu/mce/core.c b/arch/x86/kernel/cpu/mce/core.c |
808 |
+index 743370ee4983..aecb15ba66cd 100644 |
809 |
+--- a/arch/x86/kernel/cpu/mce/core.c |
810 |
++++ b/arch/x86/kernel/cpu/mce/core.c |
811 |
+@@ -814,8 +814,8 @@ static int mce_no_way_out(struct mce *m, char **msg, unsigned long *validp, |
812 |
+ if (quirk_no_way_out) |
813 |
+ quirk_no_way_out(i, m, regs); |
814 |
+ |
815 |
++ m->bank = i; |
816 |
+ if (mce_severity(m, mca_cfg.tolerant, &tmp, true) >= MCE_PANIC_SEVERITY) { |
817 |
+- m->bank = i; |
818 |
+ mce_read_aux(m, i); |
819 |
+ *msg = tmp; |
820 |
+ return 1; |
821 |
+diff --git a/arch/x86/kernel/cpu/mce/therm_throt.c b/arch/x86/kernel/cpu/mce/therm_throt.c |
822 |
+index 6e2becf547c5..bc441d68d060 100644 |
823 |
+--- a/arch/x86/kernel/cpu/mce/therm_throt.c |
824 |
++++ b/arch/x86/kernel/cpu/mce/therm_throt.c |
825 |
+@@ -188,7 +188,7 @@ static void therm_throt_process(bool new_event, int event, int level) |
826 |
+ /* if we just entered the thermal event */ |
827 |
+ if (new_event) { |
828 |
+ if (event == THERMAL_THROTTLING_EVENT) |
829 |
+- pr_crit("CPU%d: %s temperature above threshold, cpu clock throttled (total events = %lu)\n", |
830 |
++ pr_warn("CPU%d: %s temperature above threshold, cpu clock throttled (total events = %lu)\n", |
831 |
+ this_cpu, |
832 |
+ level == CORE_LEVEL ? "Core" : "Package", |
833 |
+ state->count); |
834 |
+diff --git a/arch/x86/kernel/early-quirks.c b/arch/x86/kernel/early-quirks.c |
835 |
+index 4cba91ec8049..606711f5ebf8 100644 |
836 |
+--- a/arch/x86/kernel/early-quirks.c |
837 |
++++ b/arch/x86/kernel/early-quirks.c |
838 |
+@@ -710,6 +710,8 @@ static struct chipset early_qrk[] __initdata = { |
839 |
+ */ |
840 |
+ { PCI_VENDOR_ID_INTEL, 0x0f00, |
841 |
+ PCI_CLASS_BRIDGE_HOST, PCI_ANY_ID, 0, force_disable_hpet}, |
842 |
++ { PCI_VENDOR_ID_INTEL, 0x3e20, |
843 |
++ PCI_CLASS_BRIDGE_HOST, PCI_ANY_ID, 0, force_disable_hpet}, |
844 |
+ { PCI_VENDOR_ID_INTEL, 0x3ec4, |
845 |
+ PCI_CLASS_BRIDGE_HOST, PCI_ANY_ID, 0, force_disable_hpet}, |
846 |
+ { PCI_VENDOR_ID_BROADCOM, 0x4331, |
847 |
+diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c |
848 |
+index 53dbcca9af09..b1d5a8c94a57 100644 |
849 |
+--- a/arch/x86/kvm/cpuid.c |
850 |
++++ b/arch/x86/kvm/cpuid.c |
851 |
+@@ -402,7 +402,8 @@ static inline void do_cpuid_7_mask(struct kvm_cpuid_entry2 *entry, int index) |
852 |
+ entry->edx |= F(SPEC_CTRL); |
853 |
+ if (boot_cpu_has(X86_FEATURE_STIBP)) |
854 |
+ entry->edx |= F(INTEL_STIBP); |
855 |
+- if (boot_cpu_has(X86_FEATURE_SSBD)) |
856 |
++ if (boot_cpu_has(X86_FEATURE_SPEC_CTRL_SSBD) || |
857 |
++ boot_cpu_has(X86_FEATURE_AMD_SSBD)) |
858 |
+ entry->edx |= F(SPEC_CTRL_SSBD); |
859 |
+ /* |
860 |
+ * We emulate ARCH_CAPABILITIES in software even |
861 |
+@@ -759,7 +760,8 @@ static inline int __do_cpuid_func(struct kvm_cpuid_entry2 *entry, u32 function, |
862 |
+ entry->ebx |= F(AMD_IBRS); |
863 |
+ if (boot_cpu_has(X86_FEATURE_STIBP)) |
864 |
+ entry->ebx |= F(AMD_STIBP); |
865 |
+- if (boot_cpu_has(X86_FEATURE_SSBD)) |
866 |
++ if (boot_cpu_has(X86_FEATURE_SPEC_CTRL_SSBD) || |
867 |
++ boot_cpu_has(X86_FEATURE_AMD_SSBD)) |
868 |
+ entry->ebx |= F(AMD_SSBD); |
869 |
+ if (!boot_cpu_has_bug(X86_BUG_SPEC_STORE_BYPASS)) |
870 |
+ entry->ebx |= F(AMD_SSB_NO); |
871 |
+diff --git a/arch/x86/lib/x86-opcode-map.txt b/arch/x86/lib/x86-opcode-map.txt |
872 |
+index e0b85930dd77..0a0e9112f284 100644 |
873 |
+--- a/arch/x86/lib/x86-opcode-map.txt |
874 |
++++ b/arch/x86/lib/x86-opcode-map.txt |
875 |
+@@ -333,7 +333,7 @@ AVXcode: 1 |
876 |
+ 06: CLTS |
877 |
+ 07: SYSRET (o64) |
878 |
+ 08: INVD |
879 |
+-09: WBINVD |
880 |
++09: WBINVD | WBNOINVD (F3) |
881 |
+ 0a: |
882 |
+ 0b: UD2 (1B) |
883 |
+ 0c: |
884 |
+@@ -364,7 +364,7 @@ AVXcode: 1 |
885 |
+ # a ModR/M byte. |
886 |
+ 1a: BNDCL Gv,Ev (F3) | BNDCU Gv,Ev (F2) | BNDMOV Gv,Ev (66) | BNDLDX Gv,Ev |
887 |
+ 1b: BNDCN Gv,Ev (F2) | BNDMOV Ev,Gv (66) | BNDMK Gv,Ev (F3) | BNDSTX Ev,Gv |
888 |
+-1c: |
889 |
++1c: Grp20 (1A),(1C) |
890 |
+ 1d: |
891 |
+ 1e: |
892 |
+ 1f: NOP Ev |
893 |
+@@ -792,6 +792,8 @@ f3: Grp17 (1A) |
894 |
+ f5: BZHI Gy,Ey,By (v) | PEXT Gy,By,Ey (F3),(v) | PDEP Gy,By,Ey (F2),(v) |
895 |
+ f6: ADCX Gy,Ey (66) | ADOX Gy,Ey (F3) | MULX By,Gy,rDX,Ey (F2),(v) |
896 |
+ f7: BEXTR Gy,Ey,By (v) | SHLX Gy,Ey,By (66),(v) | SARX Gy,Ey,By (F3),(v) | SHRX Gy,Ey,By (F2),(v) |
897 |
++f8: MOVDIR64B Gv,Mdqq (66) | ENQCMD Gv,Mdqq (F2) | ENQCMDS Gv,Mdqq (F3) |
898 |
++f9: MOVDIRI My,Gy |
899 |
+ EndTable |
900 |
+ |
901 |
+ Table: 3-byte opcode 2 (0x0f 0x3a) |
902 |
+@@ -943,9 +945,9 @@ GrpTable: Grp6 |
903 |
+ EndTable |
904 |
+ |
905 |
+ GrpTable: Grp7 |
906 |
+-0: SGDT Ms | VMCALL (001),(11B) | VMLAUNCH (010),(11B) | VMRESUME (011),(11B) | VMXOFF (100),(11B) |
907 |
+-1: SIDT Ms | MONITOR (000),(11B) | MWAIT (001),(11B) | CLAC (010),(11B) | STAC (011),(11B) |
908 |
+-2: LGDT Ms | XGETBV (000),(11B) | XSETBV (001),(11B) | VMFUNC (100),(11B) | XEND (101)(11B) | XTEST (110)(11B) |
909 |
++0: SGDT Ms | VMCALL (001),(11B) | VMLAUNCH (010),(11B) | VMRESUME (011),(11B) | VMXOFF (100),(11B) | PCONFIG (101),(11B) | ENCLV (000),(11B) |
910 |
++1: SIDT Ms | MONITOR (000),(11B) | MWAIT (001),(11B) | CLAC (010),(11B) | STAC (011),(11B) | ENCLS (111),(11B) |
911 |
++2: LGDT Ms | XGETBV (000),(11B) | XSETBV (001),(11B) | VMFUNC (100),(11B) | XEND (101)(11B) | XTEST (110)(11B) | ENCLU (111),(11B) |
912 |
+ 3: LIDT Ms |
913 |
+ 4: SMSW Mw/Rv |
914 |
+ 5: rdpkru (110),(11B) | wrpkru (111),(11B) |
915 |
+@@ -1020,7 +1022,7 @@ GrpTable: Grp15 |
916 |
+ 3: vstmxcsr Md (v1) | WRGSBASE Ry (F3),(11B) |
917 |
+ 4: XSAVE | ptwrite Ey (F3),(11B) |
918 |
+ 5: XRSTOR | lfence (11B) |
919 |
+-6: XSAVEOPT | clwb (66) | mfence (11B) |
920 |
++6: XSAVEOPT | clwb (66) | mfence (11B) | TPAUSE Rd (66),(11B) | UMONITOR Rv (F3),(11B) | UMWAIT Rd (F2),(11B) |
921 |
+ 7: clflush | clflushopt (66) | sfence (11B) |
922 |
+ EndTable |
923 |
+ |
924 |
+@@ -1051,6 +1053,10 @@ GrpTable: Grp19 |
925 |
+ 6: vscatterpf1qps/d Wx (66),(ev) |
926 |
+ EndTable |
927 |
+ |
928 |
++GrpTable: Grp20 |
929 |
++0: cldemote Mb |
930 |
++EndTable |
931 |
++ |
932 |
+ # AMD's Prefetch Group |
933 |
+ GrpTable: GrpP |
934 |
+ 0: PREFETCH |
935 |
+diff --git a/arch/x86/math-emu/fpu_system.h b/arch/x86/math-emu/fpu_system.h |
936 |
+index f98a0c956764..9b41391867dc 100644 |
937 |
+--- a/arch/x86/math-emu/fpu_system.h |
938 |
++++ b/arch/x86/math-emu/fpu_system.h |
939 |
+@@ -107,6 +107,8 @@ static inline bool seg_writable(struct desc_struct *d) |
940 |
+ #define FPU_access_ok(y,z) if ( !access_ok(y,z) ) \ |
941 |
+ math_abort(FPU_info,SIGSEGV) |
942 |
+ #define FPU_abort math_abort(FPU_info, SIGSEGV) |
943 |
++#define FPU_copy_from_user(to, from, n) \ |
944 |
++ do { if (copy_from_user(to, from, n)) FPU_abort; } while (0) |
945 |
+ |
946 |
+ #undef FPU_IGNORE_CODE_SEGV |
947 |
+ #ifdef FPU_IGNORE_CODE_SEGV |
948 |
+@@ -122,7 +124,7 @@ static inline bool seg_writable(struct desc_struct *d) |
949 |
+ #define FPU_code_access_ok(z) FPU_access_ok((void __user *)FPU_EIP,z) |
950 |
+ #endif |
951 |
+ |
952 |
+-#define FPU_get_user(x,y) get_user((x),(y)) |
953 |
+-#define FPU_put_user(x,y) put_user((x),(y)) |
954 |
++#define FPU_get_user(x,y) do { if (get_user((x),(y))) FPU_abort; } while (0) |
955 |
++#define FPU_put_user(x,y) do { if (put_user((x),(y))) FPU_abort; } while (0) |
956 |
+ |
957 |
+ #endif |
958 |
+diff --git a/arch/x86/math-emu/reg_ld_str.c b/arch/x86/math-emu/reg_ld_str.c |
959 |
+index f3779743d15e..fe6246ff9887 100644 |
960 |
+--- a/arch/x86/math-emu/reg_ld_str.c |
961 |
++++ b/arch/x86/math-emu/reg_ld_str.c |
962 |
+@@ -85,7 +85,7 @@ int FPU_load_extended(long double __user *s, int stnr) |
963 |
+ |
964 |
+ RE_ENTRANT_CHECK_OFF; |
965 |
+ FPU_access_ok(s, 10); |
966 |
+- __copy_from_user(sti_ptr, s, 10); |
967 |
++ FPU_copy_from_user(sti_ptr, s, 10); |
968 |
+ RE_ENTRANT_CHECK_ON; |
969 |
+ |
970 |
+ return FPU_tagof(sti_ptr); |
971 |
+@@ -1126,9 +1126,9 @@ void frstor(fpu_addr_modes addr_modes, u_char __user *data_address) |
972 |
+ /* Copy all registers in stack order. */ |
973 |
+ RE_ENTRANT_CHECK_OFF; |
974 |
+ FPU_access_ok(s, 80); |
975 |
+- __copy_from_user(register_base + offset, s, other); |
976 |
++ FPU_copy_from_user(register_base + offset, s, other); |
977 |
+ if (offset) |
978 |
+- __copy_from_user(register_base, s + other, offset); |
979 |
++ FPU_copy_from_user(register_base, s + other, offset); |
980 |
+ RE_ENTRANT_CHECK_ON; |
981 |
+ |
982 |
+ for (i = 0; i < 8; i++) { |
983 |
+diff --git a/arch/x86/mm/pgtable.c b/arch/x86/mm/pgtable.c |
984 |
+index 3e4b9035bb9a..7bd2c3a52297 100644 |
985 |
+--- a/arch/x86/mm/pgtable.c |
986 |
++++ b/arch/x86/mm/pgtable.c |
987 |
+@@ -643,8 +643,8 @@ void __native_set_fixmap(enum fixed_addresses idx, pte_t pte) |
988 |
+ fixmaps_set++; |
989 |
+ } |
990 |
+ |
991 |
+-void native_set_fixmap(enum fixed_addresses idx, phys_addr_t phys, |
992 |
+- pgprot_t flags) |
993 |
++void native_set_fixmap(unsigned /* enum fixed_addresses */ idx, |
994 |
++ phys_addr_t phys, pgprot_t flags) |
995 |
+ { |
996 |
+ /* Sanitize 'prot' against any unsupported bits: */ |
997 |
+ pgprot_val(flags) &= __default_kernel_pte_mask; |
998 |
+diff --git a/block/blk-iocost.c b/block/blk-iocost.c |
999 |
+index e01267f99183..27ca68621137 100644 |
1000 |
+--- a/block/blk-iocost.c |
1001 |
++++ b/block/blk-iocost.c |
1002 |
+@@ -1212,7 +1212,7 @@ static enum hrtimer_restart iocg_waitq_timer_fn(struct hrtimer *timer) |
1003 |
+ return HRTIMER_NORESTART; |
1004 |
+ } |
1005 |
+ |
1006 |
+-static void iocg_kick_delay(struct ioc_gq *iocg, struct ioc_now *now, u64 cost) |
1007 |
++static bool iocg_kick_delay(struct ioc_gq *iocg, struct ioc_now *now, u64 cost) |
1008 |
+ { |
1009 |
+ struct ioc *ioc = iocg->ioc; |
1010 |
+ struct blkcg_gq *blkg = iocg_to_blkg(iocg); |
1011 |
+@@ -1229,11 +1229,11 @@ static void iocg_kick_delay(struct ioc_gq *iocg, struct ioc_now *now, u64 cost) |
1012 |
+ /* clear or maintain depending on the overage */ |
1013 |
+ if (time_before_eq64(vtime, now->vnow)) { |
1014 |
+ blkcg_clear_delay(blkg); |
1015 |
+- return; |
1016 |
++ return false; |
1017 |
+ } |
1018 |
+ if (!atomic_read(&blkg->use_delay) && |
1019 |
+ time_before_eq64(vtime, now->vnow + vmargin)) |
1020 |
+- return; |
1021 |
++ return false; |
1022 |
+ |
1023 |
+ /* use delay */ |
1024 |
+ if (cost) { |
1025 |
+@@ -1250,10 +1250,11 @@ static void iocg_kick_delay(struct ioc_gq *iocg, struct ioc_now *now, u64 cost) |
1026 |
+ oexpires = ktime_to_ns(hrtimer_get_softexpires(&iocg->delay_timer)); |
1027 |
+ if (hrtimer_is_queued(&iocg->delay_timer) && |
1028 |
+ abs(oexpires - expires) <= margin_ns / 4) |
1029 |
+- return; |
1030 |
++ return true; |
1031 |
+ |
1032 |
+ hrtimer_start_range_ns(&iocg->delay_timer, ns_to_ktime(expires), |
1033 |
+ margin_ns / 4, HRTIMER_MODE_ABS); |
1034 |
++ return true; |
1035 |
+ } |
1036 |
+ |
1037 |
+ static enum hrtimer_restart iocg_delay_timer_fn(struct hrtimer *timer) |
1038 |
+@@ -1739,7 +1740,9 @@ static void ioc_rqos_throttle(struct rq_qos *rqos, struct bio *bio) |
1039 |
+ */ |
1040 |
+ if (bio_issue_as_root_blkg(bio) || fatal_signal_pending(current)) { |
1041 |
+ atomic64_add(abs_cost, &iocg->abs_vdebt); |
1042 |
+- iocg_kick_delay(iocg, &now, cost); |
1043 |
++ if (iocg_kick_delay(iocg, &now, cost)) |
1044 |
++ blkcg_schedule_throttle(rqos->q, |
1045 |
++ (bio->bi_opf & REQ_SWAP) == REQ_SWAP); |
1046 |
+ return; |
1047 |
+ } |
1048 |
+ |
1049 |
+diff --git a/crypto/Kconfig b/crypto/Kconfig |
1050 |
+index 9e524044d312..29472fb795f3 100644 |
1051 |
+--- a/crypto/Kconfig |
1052 |
++++ b/crypto/Kconfig |
1053 |
+@@ -309,6 +309,7 @@ config CRYPTO_AEGIS128 |
1054 |
+ config CRYPTO_AEGIS128_SIMD |
1055 |
+ bool "Support SIMD acceleration for AEGIS-128" |
1056 |
+ depends on CRYPTO_AEGIS128 && ((ARM || ARM64) && KERNEL_MODE_NEON) |
1057 |
++ depends on !ARM || CC_IS_CLANG || GCC_VERSION >= 40800 |
1058 |
+ default y |
1059 |
+ |
1060 |
+ config CRYPTO_AEGIS128_AESNI_SSE2 |
1061 |
+diff --git a/crypto/Makefile b/crypto/Makefile |
1062 |
+index fcb1ee679782..aa740c8492b9 100644 |
1063 |
+--- a/crypto/Makefile |
1064 |
++++ b/crypto/Makefile |
1065 |
+@@ -93,7 +93,7 @@ obj-$(CONFIG_CRYPTO_AEGIS128) += aegis128.o |
1066 |
+ aegis128-y := aegis128-core.o |
1067 |
+ |
1068 |
+ ifeq ($(ARCH),arm) |
1069 |
+-CFLAGS_aegis128-neon-inner.o += -ffreestanding -march=armv7-a -mfloat-abi=softfp |
1070 |
++CFLAGS_aegis128-neon-inner.o += -ffreestanding -march=armv8-a -mfloat-abi=softfp |
1071 |
+ CFLAGS_aegis128-neon-inner.o += -mfpu=crypto-neon-fp-armv8 |
1072 |
+ aegis128-$(CONFIG_CRYPTO_AEGIS128_SIMD) += aegis128-neon.o aegis128-neon-inner.o |
1073 |
+ endif |
1074 |
+diff --git a/crypto/asymmetric_keys/asym_tpm.c b/crypto/asymmetric_keys/asym_tpm.c |
1075 |
+index 76d2ce3a1b5b..5154e280ada2 100644 |
1076 |
+--- a/crypto/asymmetric_keys/asym_tpm.c |
1077 |
++++ b/crypto/asymmetric_keys/asym_tpm.c |
1078 |
+@@ -486,6 +486,7 @@ static int tpm_key_encrypt(struct tpm_key *tk, |
1079 |
+ if (ret < 0) |
1080 |
+ goto error_free_tfm; |
1081 |
+ |
1082 |
++ ret = -ENOMEM; |
1083 |
+ req = akcipher_request_alloc(tfm, GFP_KERNEL); |
1084 |
+ if (!req) |
1085 |
+ goto error_free_tfm; |
1086 |
+diff --git a/crypto/asymmetric_keys/public_key.c b/crypto/asymmetric_keys/public_key.c |
1087 |
+index 364b9df9d631..d7f43d4ea925 100644 |
1088 |
+--- a/crypto/asymmetric_keys/public_key.c |
1089 |
++++ b/crypto/asymmetric_keys/public_key.c |
1090 |
+@@ -184,6 +184,7 @@ static int software_key_eds_op(struct kernel_pkey_params *params, |
1091 |
+ if (IS_ERR(tfm)) |
1092 |
+ return PTR_ERR(tfm); |
1093 |
+ |
1094 |
++ ret = -ENOMEM; |
1095 |
+ req = akcipher_request_alloc(tfm, GFP_KERNEL); |
1096 |
+ if (!req) |
1097 |
+ goto error_free_tfm; |
1098 |
+diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c |
1099 |
+index 4a2cde2c536a..ce93a355bd1c 100644 |
1100 |
+--- a/drivers/acpi/button.c |
1101 |
++++ b/drivers/acpi/button.c |
1102 |
+@@ -78,6 +78,17 @@ static const struct dmi_system_id lid_blacklst[] = { |
1103 |
+ DMI_MATCH(DMI_BIOS_VERSION, "BYT70A.YNCHENG.WIN.007"), |
1104 |
+ }, |
1105 |
+ }, |
1106 |
++ { |
1107 |
++ /* |
1108 |
++ * Medion Akoya E2215T, notification of the LID device only |
1109 |
++ * happens on close, not on open and _LID always returns closed. |
1110 |
++ */ |
1111 |
++ .matches = { |
1112 |
++ DMI_MATCH(DMI_SYS_VENDOR, "MEDION"), |
1113 |
++ DMI_MATCH(DMI_PRODUCT_NAME, "E2215T MD60198"), |
1114 |
++ }, |
1115 |
++ .driver_data = (void *)(long)ACPI_BUTTON_LID_INIT_OPEN, |
1116 |
++ }, |
1117 |
+ {} |
1118 |
+ }; |
1119 |
+ |
1120 |
+diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c |
1121 |
+index 28c492be0a57..74c9b3032d46 100644 |
1122 |
+--- a/drivers/ata/libata-core.c |
1123 |
++++ b/drivers/ata/libata-core.c |
1124 |
+@@ -6708,6 +6708,9 @@ void ata_host_detach(struct ata_host *host) |
1125 |
+ { |
1126 |
+ int i; |
1127 |
+ |
1128 |
++ /* Ensure ata_port probe has completed */ |
1129 |
++ async_synchronize_full(); |
1130 |
++ |
1131 |
+ for (i = 0; i < host->n_ports; i++) |
1132 |
+ ata_port_detach(host->ports[i]); |
1133 |
+ |
1134 |
+diff --git a/drivers/base/firmware_loader/builtin/Makefile b/drivers/base/firmware_loader/builtin/Makefile |
1135 |
+index 37e5ae387400..4a66888e7253 100644 |
1136 |
+--- a/drivers/base/firmware_loader/builtin/Makefile |
1137 |
++++ b/drivers/base/firmware_loader/builtin/Makefile |
1138 |
+@@ -8,7 +8,8 @@ fwdir := $(addprefix $(srctree)/,$(filter-out /%,$(fwdir)))$(filter /%,$(fwdir)) |
1139 |
+ obj-y := $(addsuffix .gen.o, $(subst $(quote),,$(CONFIG_EXTRA_FIRMWARE))) |
1140 |
+ |
1141 |
+ FWNAME = $(patsubst $(obj)/%.gen.S,%,$@) |
1142 |
+-FWSTR = $(subst /,_,$(subst .,_,$(subst -,_,$(FWNAME)))) |
1143 |
++comma := , |
1144 |
++FWSTR = $(subst $(comma),_,$(subst /,_,$(subst .,_,$(subst -,_,$(FWNAME))))) |
1145 |
+ ASM_WORD = $(if $(CONFIG_64BIT),.quad,.long) |
1146 |
+ ASM_ALIGN = $(if $(CONFIG_64BIT),3,2) |
1147 |
+ PROGBITS = $(if $(CONFIG_ARM),%,@)progbits |
1148 |
+diff --git a/drivers/block/loop.c b/drivers/block/loop.c |
1149 |
+index f6f77eaa7217..ef6e251857c8 100644 |
1150 |
+--- a/drivers/block/loop.c |
1151 |
++++ b/drivers/block/loop.c |
1152 |
+@@ -417,18 +417,20 @@ out_free_page: |
1153 |
+ return ret; |
1154 |
+ } |
1155 |
+ |
1156 |
+-static int lo_discard(struct loop_device *lo, struct request *rq, loff_t pos) |
1157 |
++static int lo_fallocate(struct loop_device *lo, struct request *rq, loff_t pos, |
1158 |
++ int mode) |
1159 |
+ { |
1160 |
+ /* |
1161 |
+- * We use punch hole to reclaim the free space used by the |
1162 |
+- * image a.k.a. discard. However we do not support discard if |
1163 |
+- * encryption is enabled, because it may give an attacker |
1164 |
+- * useful information. |
1165 |
++ * We use fallocate to manipulate the space mappings used by the image |
1166 |
++ * a.k.a. discard/zerorange. However we do not support this if |
1167 |
++ * encryption is enabled, because it may give an attacker useful |
1168 |
++ * information. |
1169 |
+ */ |
1170 |
+ struct file *file = lo->lo_backing_file; |
1171 |
+- int mode = FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE; |
1172 |
+ int ret; |
1173 |
+ |
1174 |
++ mode |= FALLOC_FL_KEEP_SIZE; |
1175 |
++ |
1176 |
+ if ((!file->f_op->fallocate) || lo->lo_encrypt_key_size) { |
1177 |
+ ret = -EOPNOTSUPP; |
1178 |
+ goto out; |
1179 |
+@@ -596,9 +598,17 @@ static int do_req_filebacked(struct loop_device *lo, struct request *rq) |
1180 |
+ switch (req_op(rq)) { |
1181 |
+ case REQ_OP_FLUSH: |
1182 |
+ return lo_req_flush(lo, rq); |
1183 |
+- case REQ_OP_DISCARD: |
1184 |
+ case REQ_OP_WRITE_ZEROES: |
1185 |
+- return lo_discard(lo, rq, pos); |
1186 |
++ /* |
1187 |
++ * If the caller doesn't want deallocation, call zeroout to |
1188 |
++ * write zeroes the range. Otherwise, punch them out. |
1189 |
++ */ |
1190 |
++ return lo_fallocate(lo, rq, pos, |
1191 |
++ (rq->cmd_flags & REQ_NOUNMAP) ? |
1192 |
++ FALLOC_FL_ZERO_RANGE : |
1193 |
++ FALLOC_FL_PUNCH_HOLE); |
1194 |
++ case REQ_OP_DISCARD: |
1195 |
++ return lo_fallocate(lo, rq, pos, FALLOC_FL_PUNCH_HOLE); |
1196 |
+ case REQ_OP_WRITE: |
1197 |
+ if (lo->transfer) |
1198 |
+ return lo_write_transfer(lo, rq, pos); |
1199 |
+diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c |
1200 |
+index 57532465fb83..b4607dd96185 100644 |
1201 |
+--- a/drivers/block/nbd.c |
1202 |
++++ b/drivers/block/nbd.c |
1203 |
+@@ -1296,10 +1296,10 @@ static int nbd_start_device_ioctl(struct nbd_device *nbd, struct block_device *b |
1204 |
+ mutex_unlock(&nbd->config_lock); |
1205 |
+ ret = wait_event_interruptible(config->recv_wq, |
1206 |
+ atomic_read(&config->recv_threads) == 0); |
1207 |
+- if (ret) { |
1208 |
++ if (ret) |
1209 |
+ sock_shutdown(nbd); |
1210 |
+- flush_workqueue(nbd->recv_workq); |
1211 |
+- } |
1212 |
++ flush_workqueue(nbd->recv_workq); |
1213 |
++ |
1214 |
+ mutex_lock(&nbd->config_lock); |
1215 |
+ nbd_bdev_reset(bdev); |
1216 |
+ /* user requested, ignore socket errors */ |
1217 |
+diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c |
1218 |
+index a9c35ebb30f8..23e606aaaea4 100644 |
1219 |
+--- a/drivers/bluetooth/btusb.c |
1220 |
++++ b/drivers/bluetooth/btusb.c |
1221 |
+@@ -3807,8 +3807,8 @@ static int btusb_probe(struct usb_interface *intf, |
1222 |
+ btusb_check_needs_reset_resume(intf); |
1223 |
+ } |
1224 |
+ |
1225 |
+-#ifdef CONFIG_BT_HCIBTUSB_RTL |
1226 |
+- if (id->driver_info & BTUSB_REALTEK) { |
1227 |
++ if (IS_ENABLED(CONFIG_BT_HCIBTUSB_RTL) && |
1228 |
++ (id->driver_info & BTUSB_REALTEK)) { |
1229 |
+ hdev->setup = btrtl_setup_realtek; |
1230 |
+ hdev->shutdown = btrtl_shutdown_realtek; |
1231 |
+ hdev->cmd_timeout = btusb_rtl_cmd_timeout; |
1232 |
+@@ -3819,7 +3819,6 @@ static int btusb_probe(struct usb_interface *intf, |
1233 |
+ */ |
1234 |
+ set_bit(BTUSB_WAKEUP_DISABLE, &data->flags); |
1235 |
+ } |
1236 |
+-#endif |
1237 |
+ |
1238 |
+ if (id->driver_info & BTUSB_AMP) { |
1239 |
+ /* AMP controllers do not support SCO packets */ |
1240 |
+diff --git a/drivers/char/hw_random/omap3-rom-rng.c b/drivers/char/hw_random/omap3-rom-rng.c |
1241 |
+index 38b719017186..648e39ce6bd9 100644 |
1242 |
+--- a/drivers/char/hw_random/omap3-rom-rng.c |
1243 |
++++ b/drivers/char/hw_random/omap3-rom-rng.c |
1244 |
+@@ -121,7 +121,8 @@ static int omap3_rom_rng_remove(struct platform_device *pdev) |
1245 |
+ { |
1246 |
+ cancel_delayed_work_sync(&idle_work); |
1247 |
+ hwrng_unregister(&omap3_rom_rng_ops); |
1248 |
+- clk_disable_unprepare(rng_clk); |
1249 |
++ if (!rng_idle) |
1250 |
++ clk_disable_unprepare(rng_clk); |
1251 |
+ return 0; |
1252 |
+ } |
1253 |
+ |
1254 |
+diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c |
1255 |
+index 2aab80e19ae0..3c8a559506e8 100644 |
1256 |
+--- a/drivers/char/ipmi/ipmi_msghandler.c |
1257 |
++++ b/drivers/char/ipmi/ipmi_msghandler.c |
1258 |
+@@ -448,6 +448,8 @@ enum ipmi_stat_indexes { |
1259 |
+ |
1260 |
+ #define IPMI_IPMB_NUM_SEQ 64 |
1261 |
+ struct ipmi_smi { |
1262 |
++ struct module *owner; |
1263 |
++ |
1264 |
+ /* What interface number are we? */ |
1265 |
+ int intf_num; |
1266 |
+ |
1267 |
+@@ -1220,6 +1222,11 @@ int ipmi_create_user(unsigned int if_num, |
1268 |
+ if (rv) |
1269 |
+ goto out_kfree; |
1270 |
+ |
1271 |
++ if (!try_module_get(intf->owner)) { |
1272 |
++ rv = -ENODEV; |
1273 |
++ goto out_kfree; |
1274 |
++ } |
1275 |
++ |
1276 |
+ /* Note that each existing user holds a refcount to the interface. */ |
1277 |
+ kref_get(&intf->refcount); |
1278 |
+ |
1279 |
+@@ -1349,6 +1356,7 @@ static void _ipmi_destroy_user(struct ipmi_user *user) |
1280 |
+ } |
1281 |
+ |
1282 |
+ kref_put(&intf->refcount, intf_free); |
1283 |
++ module_put(intf->owner); |
1284 |
+ } |
1285 |
+ |
1286 |
+ int ipmi_destroy_user(struct ipmi_user *user) |
1287 |
+@@ -2459,7 +2467,7 @@ static int __get_device_id(struct ipmi_smi *intf, struct bmc_device *bmc) |
1288 |
+ * been recently fetched, this will just use the cached data. Otherwise |
1289 |
+ * it will run a new fetch. |
1290 |
+ * |
1291 |
+- * Except for the first time this is called (in ipmi_register_smi()), |
1292 |
++ * Except for the first time this is called (in ipmi_add_smi()), |
1293 |
+ * this will always return good data; |
1294 |
+ */ |
1295 |
+ static int __bmc_get_device_id(struct ipmi_smi *intf, struct bmc_device *bmc, |
1296 |
+@@ -3377,10 +3385,11 @@ static void redo_bmc_reg(struct work_struct *work) |
1297 |
+ kref_put(&intf->refcount, intf_free); |
1298 |
+ } |
1299 |
+ |
1300 |
+-int ipmi_register_smi(const struct ipmi_smi_handlers *handlers, |
1301 |
+- void *send_info, |
1302 |
+- struct device *si_dev, |
1303 |
+- unsigned char slave_addr) |
1304 |
++int ipmi_add_smi(struct module *owner, |
1305 |
++ const struct ipmi_smi_handlers *handlers, |
1306 |
++ void *send_info, |
1307 |
++ struct device *si_dev, |
1308 |
++ unsigned char slave_addr) |
1309 |
+ { |
1310 |
+ int i, j; |
1311 |
+ int rv; |
1312 |
+@@ -3406,7 +3415,7 @@ int ipmi_register_smi(const struct ipmi_smi_handlers *handlers, |
1313 |
+ return rv; |
1314 |
+ } |
1315 |
+ |
1316 |
+- |
1317 |
++ intf->owner = owner; |
1318 |
+ intf->bmc = &intf->tmp_bmc; |
1319 |
+ INIT_LIST_HEAD(&intf->bmc->intfs); |
1320 |
+ mutex_init(&intf->bmc->dyn_mutex); |
1321 |
+@@ -3514,7 +3523,7 @@ int ipmi_register_smi(const struct ipmi_smi_handlers *handlers, |
1322 |
+ |
1323 |
+ return rv; |
1324 |
+ } |
1325 |
+-EXPORT_SYMBOL(ipmi_register_smi); |
1326 |
++EXPORT_SYMBOL(ipmi_add_smi); |
1327 |
+ |
1328 |
+ static void deliver_smi_err_response(struct ipmi_smi *intf, |
1329 |
+ struct ipmi_smi_msg *msg, |
1330 |
+diff --git a/drivers/char/tpm/tpm-dev-common.c b/drivers/char/tpm/tpm-dev-common.c |
1331 |
+index 2ec47a69a2a6..b23b0b999232 100644 |
1332 |
+--- a/drivers/char/tpm/tpm-dev-common.c |
1333 |
++++ b/drivers/char/tpm/tpm-dev-common.c |
1334 |
+@@ -61,6 +61,12 @@ static void tpm_dev_async_work(struct work_struct *work) |
1335 |
+ |
1336 |
+ mutex_lock(&priv->buffer_mutex); |
1337 |
+ priv->command_enqueued = false; |
1338 |
++ ret = tpm_try_get_ops(priv->chip); |
1339 |
++ if (ret) { |
1340 |
++ priv->response_length = ret; |
1341 |
++ goto out; |
1342 |
++ } |
1343 |
++ |
1344 |
+ ret = tpm_dev_transmit(priv->chip, priv->space, priv->data_buffer, |
1345 |
+ sizeof(priv->data_buffer)); |
1346 |
+ tpm_put_ops(priv->chip); |
1347 |
+@@ -68,6 +74,7 @@ static void tpm_dev_async_work(struct work_struct *work) |
1348 |
+ priv->response_length = ret; |
1349 |
+ mod_timer(&priv->user_read_timer, jiffies + (120 * HZ)); |
1350 |
+ } |
1351 |
++out: |
1352 |
+ mutex_unlock(&priv->buffer_mutex); |
1353 |
+ wake_up_interruptible(&priv->async_wait); |
1354 |
+ } |
1355 |
+@@ -204,6 +211,7 @@ ssize_t tpm_common_write(struct file *file, const char __user *buf, |
1356 |
+ if (file->f_flags & O_NONBLOCK) { |
1357 |
+ priv->command_enqueued = true; |
1358 |
+ queue_work(tpm_dev_wq, &priv->async_work); |
1359 |
++ tpm_put_ops(priv->chip); |
1360 |
+ mutex_unlock(&priv->buffer_mutex); |
1361 |
+ return size; |
1362 |
+ } |
1363 |
+diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_core.c |
1364 |
+index 270f43acbb77..f528fc39ea6b 100644 |
1365 |
+--- a/drivers/char/tpm/tpm_tis_core.c |
1366 |
++++ b/drivers/char/tpm/tpm_tis_core.c |
1367 |
+@@ -899,13 +899,13 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq, |
1368 |
+ |
1369 |
+ if (wait_startup(chip, 0) != 0) { |
1370 |
+ rc = -ENODEV; |
1371 |
+- goto out_err; |
1372 |
++ goto err_start; |
1373 |
+ } |
1374 |
+ |
1375 |
+ /* Take control of the TPM's interrupt hardware and shut it off */ |
1376 |
+ rc = tpm_tis_read32(priv, TPM_INT_ENABLE(priv->locality), &intmask); |
1377 |
+ if (rc < 0) |
1378 |
+- goto out_err; |
1379 |
++ goto err_start; |
1380 |
+ |
1381 |
+ intmask |= TPM_INTF_CMD_READY_INT | TPM_INTF_LOCALITY_CHANGE_INT | |
1382 |
+ TPM_INTF_DATA_AVAIL_INT | TPM_INTF_STS_VALID_INT; |
1383 |
+@@ -914,21 +914,21 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq, |
1384 |
+ |
1385 |
+ rc = tpm_chip_start(chip); |
1386 |
+ if (rc) |
1387 |
+- goto out_err; |
1388 |
++ goto err_start; |
1389 |
++ |
1390 |
+ rc = tpm2_probe(chip); |
1391 |
+- tpm_chip_stop(chip); |
1392 |
+ if (rc) |
1393 |
+- goto out_err; |
1394 |
++ goto err_probe; |
1395 |
+ |
1396 |
+ rc = tpm_tis_read32(priv, TPM_DID_VID(0), &vendor); |
1397 |
+ if (rc < 0) |
1398 |
+- goto out_err; |
1399 |
++ goto err_probe; |
1400 |
+ |
1401 |
+ priv->manufacturer_id = vendor; |
1402 |
+ |
1403 |
+ rc = tpm_tis_read8(priv, TPM_RID(0), &rid); |
1404 |
+ if (rc < 0) |
1405 |
+- goto out_err; |
1406 |
++ goto err_probe; |
1407 |
+ |
1408 |
+ dev_info(dev, "%s TPM (device-id 0x%X, rev-id %d)\n", |
1409 |
+ (chip->flags & TPM_CHIP_FLAG_TPM2) ? "2.0" : "1.2", |
1410 |
+@@ -937,13 +937,13 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq, |
1411 |
+ probe = probe_itpm(chip); |
1412 |
+ if (probe < 0) { |
1413 |
+ rc = -ENODEV; |
1414 |
+- goto out_err; |
1415 |
++ goto err_probe; |
1416 |
+ } |
1417 |
+ |
1418 |
+ /* Figure out the capabilities */ |
1419 |
+ rc = tpm_tis_read32(priv, TPM_INTF_CAPS(priv->locality), &intfcaps); |
1420 |
+ if (rc < 0) |
1421 |
+- goto out_err; |
1422 |
++ goto err_probe; |
1423 |
+ |
1424 |
+ dev_dbg(dev, "TPM interface capabilities (0x%x):\n", |
1425 |
+ intfcaps); |
1426 |
+@@ -977,10 +977,9 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq, |
1427 |
+ if (tpm_get_timeouts(chip)) { |
1428 |
+ dev_err(dev, "Could not get TPM timeouts and durations\n"); |
1429 |
+ rc = -ENODEV; |
1430 |
+- goto out_err; |
1431 |
++ goto err_probe; |
1432 |
+ } |
1433 |
+ |
1434 |
+- tpm_chip_start(chip); |
1435 |
+ chip->flags |= TPM_CHIP_FLAG_IRQ; |
1436 |
+ if (irq) { |
1437 |
+ tpm_tis_probe_irq_single(chip, intmask, IRQF_SHARED, |
1438 |
+@@ -991,18 +990,20 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq, |
1439 |
+ } else { |
1440 |
+ tpm_tis_probe_irq(chip, intmask); |
1441 |
+ } |
1442 |
+- tpm_chip_stop(chip); |
1443 |
+ } |
1444 |
+ |
1445 |
++ tpm_chip_stop(chip); |
1446 |
++ |
1447 |
+ rc = tpm_chip_register(chip); |
1448 |
+ if (rc) |
1449 |
+- goto out_err; |
1450 |
+- |
1451 |
+- if (chip->ops->clk_enable != NULL) |
1452 |
+- chip->ops->clk_enable(chip, false); |
1453 |
++ goto err_start; |
1454 |
+ |
1455 |
+ return 0; |
1456 |
+-out_err: |
1457 |
++ |
1458 |
++err_probe: |
1459 |
++ tpm_chip_stop(chip); |
1460 |
++ |
1461 |
++err_start: |
1462 |
+ if ((chip->ops != NULL) && (chip->ops->clk_enable != NULL)) |
1463 |
+ chip->ops->clk_enable(chip, false); |
1464 |
+ |
1465 |
+diff --git a/drivers/clk/imx/clk-composite-8m.c b/drivers/clk/imx/clk-composite-8m.c |
1466 |
+index 388bdb94f841..d3486ee79ab5 100644 |
1467 |
+--- a/drivers/clk/imx/clk-composite-8m.c |
1468 |
++++ b/drivers/clk/imx/clk-composite-8m.c |
1469 |
+@@ -142,6 +142,7 @@ struct clk *imx8m_clk_composite_flags(const char *name, |
1470 |
+ mux->reg = reg; |
1471 |
+ mux->shift = PCG_PCS_SHIFT; |
1472 |
+ mux->mask = PCG_PCS_MASK; |
1473 |
++ mux->lock = &imx_ccm_lock; |
1474 |
+ |
1475 |
+ div = kzalloc(sizeof(*div), GFP_KERNEL); |
1476 |
+ if (!div) |
1477 |
+@@ -161,6 +162,7 @@ struct clk *imx8m_clk_composite_flags(const char *name, |
1478 |
+ gate_hw = &gate->hw; |
1479 |
+ gate->reg = reg; |
1480 |
+ gate->bit_idx = PCG_CGC_SHIFT; |
1481 |
++ gate->lock = &imx_ccm_lock; |
1482 |
+ |
1483 |
+ hw = clk_hw_register_composite(NULL, name, parent_names, num_parents, |
1484 |
+ mux_hw, &clk_mux_ops, div_hw, |
1485 |
+diff --git a/drivers/clk/imx/clk-imx7ulp.c b/drivers/clk/imx/clk-imx7ulp.c |
1486 |
+index 2022d9bead91..a0f650150367 100644 |
1487 |
+--- a/drivers/clk/imx/clk-imx7ulp.c |
1488 |
++++ b/drivers/clk/imx/clk-imx7ulp.c |
1489 |
+@@ -40,6 +40,7 @@ static const struct clk_div_table ulp_div_table[] = { |
1490 |
+ { .val = 5, .div = 16, }, |
1491 |
+ { .val = 6, .div = 32, }, |
1492 |
+ { .val = 7, .div = 64, }, |
1493 |
++ { /* sentinel */ }, |
1494 |
+ }; |
1495 |
+ |
1496 |
+ static const int pcc2_uart_clk_ids[] __initconst = { |
1497 |
+diff --git a/drivers/clk/imx/clk-pll14xx.c b/drivers/clk/imx/clk-pll14xx.c |
1498 |
+index 7a815ec76aa5..d43b4a3c0de8 100644 |
1499 |
+--- a/drivers/clk/imx/clk-pll14xx.c |
1500 |
++++ b/drivers/clk/imx/clk-pll14xx.c |
1501 |
+@@ -153,7 +153,7 @@ static int clk_pll14xx_wait_lock(struct clk_pll14xx *pll) |
1502 |
+ { |
1503 |
+ u32 val; |
1504 |
+ |
1505 |
+- return readl_poll_timeout(pll->base, val, val & LOCK_TIMEOUT_US, 0, |
1506 |
++ return readl_poll_timeout(pll->base, val, val & LOCK_STATUS, 0, |
1507 |
+ LOCK_TIMEOUT_US); |
1508 |
+ } |
1509 |
+ |
1510 |
+diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c |
1511 |
+index bc19d6c16aaa..a7db4f22a077 100644 |
1512 |
+--- a/drivers/cpufreq/cpufreq.c |
1513 |
++++ b/drivers/cpufreq/cpufreq.c |
1514 |
+@@ -2634,6 +2634,13 @@ int cpufreq_register_driver(struct cpufreq_driver *driver_data) |
1515 |
+ if (cpufreq_disabled()) |
1516 |
+ return -ENODEV; |
1517 |
+ |
1518 |
++ /* |
1519 |
++ * The cpufreq core depends heavily on the availability of device |
1520 |
++ * structure, make sure they are available before proceeding further. |
1521 |
++ */ |
1522 |
++ if (!get_cpu_device(0)) |
1523 |
++ return -EPROBE_DEFER; |
1524 |
++ |
1525 |
+ if (!driver_data || !driver_data->verify || !driver_data->init || |
1526 |
+ !(driver_data->setpolicy || driver_data->target_index || |
1527 |
+ driver_data->target) || |
1528 |
+diff --git a/drivers/cpufreq/sun50i-cpufreq-nvmem.c b/drivers/cpufreq/sun50i-cpufreq-nvmem.c |
1529 |
+index eca32e443716..9907a165135b 100644 |
1530 |
+--- a/drivers/cpufreq/sun50i-cpufreq-nvmem.c |
1531 |
++++ b/drivers/cpufreq/sun50i-cpufreq-nvmem.c |
1532 |
+@@ -25,7 +25,7 @@ |
1533 |
+ static struct platform_device *cpufreq_dt_pdev, *sun50i_cpufreq_pdev; |
1534 |
+ |
1535 |
+ /** |
1536 |
+- * sun50i_cpufreq_get_efuse() - Parse and return efuse value present on SoC |
1537 |
++ * sun50i_cpufreq_get_efuse() - Determine speed grade from efuse value |
1538 |
+ * @versions: Set to the value parsed from efuse |
1539 |
+ * |
1540 |
+ * Returns 0 if success. |
1541 |
+@@ -69,21 +69,16 @@ static int sun50i_cpufreq_get_efuse(u32 *versions) |
1542 |
+ return PTR_ERR(speedbin); |
1543 |
+ |
1544 |
+ efuse_value = (*speedbin >> NVMEM_SHIFT) & NVMEM_MASK; |
1545 |
+- switch (efuse_value) { |
1546 |
+- case 0b0001: |
1547 |
+- *versions = 1; |
1548 |
+- break; |
1549 |
+- case 0b0011: |
1550 |
+- *versions = 2; |
1551 |
+- break; |
1552 |
+- default: |
1553 |
+- /* |
1554 |
+- * For other situations, we treat it as bin0. |
1555 |
+- * This vf table can be run for any good cpu. |
1556 |
+- */ |
1557 |
++ |
1558 |
++ /* |
1559 |
++ * We treat unexpected efuse values as if the SoC was from |
1560 |
++ * the slowest bin. Expected efuse values are 1-3, slowest |
1561 |
++ * to fastest. |
1562 |
++ */ |
1563 |
++ if (efuse_value >= 1 && efuse_value <= 3) |
1564 |
++ *versions = efuse_value - 1; |
1565 |
++ else |
1566 |
+ *versions = 0; |
1567 |
+- break; |
1568 |
+- } |
1569 |
+ |
1570 |
+ kfree(speedbin); |
1571 |
+ return 0; |
1572 |
+diff --git a/drivers/crypto/atmel-aes.c b/drivers/crypto/atmel-aes.c |
1573 |
+index 00920a2b95ce..db99cee1991c 100644 |
1574 |
+--- a/drivers/crypto/atmel-aes.c |
1575 |
++++ b/drivers/crypto/atmel-aes.c |
1576 |
+@@ -145,7 +145,7 @@ struct atmel_aes_xts_ctx { |
1577 |
+ u32 key2[AES_KEYSIZE_256 / sizeof(u32)]; |
1578 |
+ }; |
1579 |
+ |
1580 |
+-#ifdef CONFIG_CRYPTO_DEV_ATMEL_AUTHENC |
1581 |
++#if IS_ENABLED(CONFIG_CRYPTO_DEV_ATMEL_AUTHENC) |
1582 |
+ struct atmel_aes_authenc_ctx { |
1583 |
+ struct atmel_aes_base_ctx base; |
1584 |
+ struct atmel_sha_authenc_ctx *auth; |
1585 |
+@@ -157,7 +157,7 @@ struct atmel_aes_reqctx { |
1586 |
+ u32 lastc[AES_BLOCK_SIZE / sizeof(u32)]; |
1587 |
+ }; |
1588 |
+ |
1589 |
+-#ifdef CONFIG_CRYPTO_DEV_ATMEL_AUTHENC |
1590 |
++#if IS_ENABLED(CONFIG_CRYPTO_DEV_ATMEL_AUTHENC) |
1591 |
+ struct atmel_aes_authenc_reqctx { |
1592 |
+ struct atmel_aes_reqctx base; |
1593 |
+ |
1594 |
+@@ -486,7 +486,7 @@ static inline bool atmel_aes_is_encrypt(const struct atmel_aes_dev *dd) |
1595 |
+ return (dd->flags & AES_FLAGS_ENCRYPT); |
1596 |
+ } |
1597 |
+ |
1598 |
+-#ifdef CONFIG_CRYPTO_DEV_ATMEL_AUTHENC |
1599 |
++#if IS_ENABLED(CONFIG_CRYPTO_DEV_ATMEL_AUTHENC) |
1600 |
+ static void atmel_aes_authenc_complete(struct atmel_aes_dev *dd, int err); |
1601 |
+ #endif |
1602 |
+ |
1603 |
+@@ -515,7 +515,7 @@ static void atmel_aes_set_iv_as_last_ciphertext_block(struct atmel_aes_dev *dd) |
1604 |
+ |
1605 |
+ static inline int atmel_aes_complete(struct atmel_aes_dev *dd, int err) |
1606 |
+ { |
1607 |
+-#ifdef CONFIG_CRYPTO_DEV_ATMEL_AUTHENC |
1608 |
++#if IS_ENABLED(CONFIG_CRYPTO_DEV_ATMEL_AUTHENC) |
1609 |
+ if (dd->ctx->is_aead) |
1610 |
+ atmel_aes_authenc_complete(dd, err); |
1611 |
+ #endif |
1612 |
+@@ -1980,7 +1980,7 @@ static struct crypto_alg aes_xts_alg = { |
1613 |
+ } |
1614 |
+ }; |
1615 |
+ |
1616 |
+-#ifdef CONFIG_CRYPTO_DEV_ATMEL_AUTHENC |
1617 |
++#if IS_ENABLED(CONFIG_CRYPTO_DEV_ATMEL_AUTHENC) |
1618 |
+ /* authenc aead functions */ |
1619 |
+ |
1620 |
+ static int atmel_aes_authenc_start(struct atmel_aes_dev *dd); |
1621 |
+@@ -2467,7 +2467,7 @@ static void atmel_aes_unregister_algs(struct atmel_aes_dev *dd) |
1622 |
+ { |
1623 |
+ int i; |
1624 |
+ |
1625 |
+-#ifdef CONFIG_CRYPTO_DEV_ATMEL_AUTHENC |
1626 |
++#if IS_ENABLED(CONFIG_CRYPTO_DEV_ATMEL_AUTHENC) |
1627 |
+ if (dd->caps.has_authenc) |
1628 |
+ for (i = 0; i < ARRAY_SIZE(aes_authenc_algs); i++) |
1629 |
+ crypto_unregister_aead(&aes_authenc_algs[i]); |
1630 |
+@@ -2514,7 +2514,7 @@ static int atmel_aes_register_algs(struct atmel_aes_dev *dd) |
1631 |
+ goto err_aes_xts_alg; |
1632 |
+ } |
1633 |
+ |
1634 |
+-#ifdef CONFIG_CRYPTO_DEV_ATMEL_AUTHENC |
1635 |
++#if IS_ENABLED(CONFIG_CRYPTO_DEV_ATMEL_AUTHENC) |
1636 |
+ if (dd->caps.has_authenc) { |
1637 |
+ for (i = 0; i < ARRAY_SIZE(aes_authenc_algs); i++) { |
1638 |
+ err = crypto_register_aead(&aes_authenc_algs[i]); |
1639 |
+@@ -2526,7 +2526,7 @@ static int atmel_aes_register_algs(struct atmel_aes_dev *dd) |
1640 |
+ |
1641 |
+ return 0; |
1642 |
+ |
1643 |
+-#ifdef CONFIG_CRYPTO_DEV_ATMEL_AUTHENC |
1644 |
++#if IS_ENABLED(CONFIG_CRYPTO_DEV_ATMEL_AUTHENC) |
1645 |
+ /* i = ARRAY_SIZE(aes_authenc_algs); */ |
1646 |
+ err_aes_authenc_alg: |
1647 |
+ for (j = 0; j < i; j++) |
1648 |
+@@ -2716,7 +2716,7 @@ static int atmel_aes_probe(struct platform_device *pdev) |
1649 |
+ |
1650 |
+ atmel_aes_get_cap(aes_dd); |
1651 |
+ |
1652 |
+-#ifdef CONFIG_CRYPTO_DEV_ATMEL_AUTHENC |
1653 |
++#if IS_ENABLED(CONFIG_CRYPTO_DEV_ATMEL_AUTHENC) |
1654 |
+ if (aes_dd->caps.has_authenc && !atmel_sha_authenc_is_ready()) { |
1655 |
+ err = -EPROBE_DEFER; |
1656 |
+ goto iclk_unprepare; |
1657 |
+diff --git a/drivers/crypto/atmel-authenc.h b/drivers/crypto/atmel-authenc.h |
1658 |
+index cbd37a2edada..d6de810df44f 100644 |
1659 |
+--- a/drivers/crypto/atmel-authenc.h |
1660 |
++++ b/drivers/crypto/atmel-authenc.h |
1661 |
+@@ -12,7 +12,7 @@ |
1662 |
+ #ifndef __ATMEL_AUTHENC_H__ |
1663 |
+ #define __ATMEL_AUTHENC_H__ |
1664 |
+ |
1665 |
+-#ifdef CONFIG_CRYPTO_DEV_ATMEL_AUTHENC |
1666 |
++#if IS_ENABLED(CONFIG_CRYPTO_DEV_ATMEL_AUTHENC) |
1667 |
+ |
1668 |
+ #include <crypto/authenc.h> |
1669 |
+ #include <crypto/hash.h> |
1670 |
+diff --git a/drivers/crypto/atmel-sha.c b/drivers/crypto/atmel-sha.c |
1671 |
+index 84cb8748a795..d32626458e67 100644 |
1672 |
+--- a/drivers/crypto/atmel-sha.c |
1673 |
++++ b/drivers/crypto/atmel-sha.c |
1674 |
+@@ -2212,7 +2212,7 @@ static struct ahash_alg sha_hmac_algs[] = { |
1675 |
+ }, |
1676 |
+ }; |
1677 |
+ |
1678 |
+-#ifdef CONFIG_CRYPTO_DEV_ATMEL_AUTHENC |
1679 |
++#if IS_ENABLED(CONFIG_CRYPTO_DEV_ATMEL_AUTHENC) |
1680 |
+ /* authenc functions */ |
1681 |
+ |
1682 |
+ static int atmel_sha_authenc_init2(struct atmel_sha_dev *dd); |
1683 |
+diff --git a/drivers/crypto/inside-secure/safexcel.c b/drivers/crypto/inside-secure/safexcel.c |
1684 |
+index 294debd435b6..991a4425f006 100644 |
1685 |
+--- a/drivers/crypto/inside-secure/safexcel.c |
1686 |
++++ b/drivers/crypto/inside-secure/safexcel.c |
1687 |
+@@ -1120,6 +1120,8 @@ static int safexcel_request_ring_irq(void *pdev, int irqid, |
1688 |
+ irq_name, irq); |
1689 |
+ return irq; |
1690 |
+ } |
1691 |
++ } else { |
1692 |
++ return -ENXIO; |
1693 |
+ } |
1694 |
+ |
1695 |
+ ret = devm_request_threaded_irq(dev, irq, handler, |
1696 |
+diff --git a/drivers/crypto/sunxi-ss/sun4i-ss-cipher.c b/drivers/crypto/sunxi-ss/sun4i-ss-cipher.c |
1697 |
+index 6536fd4bee65..7e5e092a23b3 100644 |
1698 |
+--- a/drivers/crypto/sunxi-ss/sun4i-ss-cipher.c |
1699 |
++++ b/drivers/crypto/sunxi-ss/sun4i-ss-cipher.c |
1700 |
+@@ -72,7 +72,8 @@ static int noinline_for_stack sun4i_ss_opti_poll(struct skcipher_request *areq) |
1701 |
+ oi = 0; |
1702 |
+ oo = 0; |
1703 |
+ do { |
1704 |
+- todo = min3(rx_cnt, ileft, (mi.length - oi) / 4); |
1705 |
++ todo = min(rx_cnt, ileft); |
1706 |
++ todo = min_t(size_t, todo, (mi.length - oi) / 4); |
1707 |
+ if (todo) { |
1708 |
+ ileft -= todo; |
1709 |
+ writesl(ss->base + SS_RXFIFO, mi.addr + oi, todo); |
1710 |
+@@ -87,7 +88,8 @@ static int noinline_for_stack sun4i_ss_opti_poll(struct skcipher_request *areq) |
1711 |
+ rx_cnt = SS_RXFIFO_SPACES(spaces); |
1712 |
+ tx_cnt = SS_TXFIFO_SPACES(spaces); |
1713 |
+ |
1714 |
+- todo = min3(tx_cnt, oleft, (mo.length - oo) / 4); |
1715 |
++ todo = min(tx_cnt, oleft); |
1716 |
++ todo = min_t(size_t, todo, (mo.length - oo) / 4); |
1717 |
+ if (todo) { |
1718 |
+ oleft -= todo; |
1719 |
+ readsl(ss->base + SS_TXFIFO, mo.addr + oo, todo); |
1720 |
+@@ -239,7 +241,8 @@ static int sun4i_ss_cipher_poll(struct skcipher_request *areq) |
1721 |
+ * todo is the number of consecutive 4byte word that we |
1722 |
+ * can read from current SG |
1723 |
+ */ |
1724 |
+- todo = min3(rx_cnt, ileft / 4, (mi.length - oi) / 4); |
1725 |
++ todo = min(rx_cnt, ileft / 4); |
1726 |
++ todo = min_t(size_t, todo, (mi.length - oi) / 4); |
1727 |
+ if (todo && !ob) { |
1728 |
+ writesl(ss->base + SS_RXFIFO, mi.addr + oi, |
1729 |
+ todo); |
1730 |
+@@ -253,8 +256,8 @@ static int sun4i_ss_cipher_poll(struct skcipher_request *areq) |
1731 |
+ * we need to be able to write all buf in one |
1732 |
+ * pass, so it is why we min() with rx_cnt |
1733 |
+ */ |
1734 |
+- todo = min3(rx_cnt * 4 - ob, ileft, |
1735 |
+- mi.length - oi); |
1736 |
++ todo = min(rx_cnt * 4 - ob, ileft); |
1737 |
++ todo = min_t(size_t, todo, mi.length - oi); |
1738 |
+ memcpy(buf + ob, mi.addr + oi, todo); |
1739 |
+ ileft -= todo; |
1740 |
+ oi += todo; |
1741 |
+@@ -274,7 +277,8 @@ static int sun4i_ss_cipher_poll(struct skcipher_request *areq) |
1742 |
+ spaces = readl(ss->base + SS_FCSR); |
1743 |
+ rx_cnt = SS_RXFIFO_SPACES(spaces); |
1744 |
+ tx_cnt = SS_TXFIFO_SPACES(spaces); |
1745 |
+- dev_dbg(ss->dev, "%x %u/%u %u/%u cnt=%u %u/%u %u/%u cnt=%u %u\n", |
1746 |
++ dev_dbg(ss->dev, |
1747 |
++ "%x %u/%zu %u/%u cnt=%u %u/%zu %u/%u cnt=%u %u\n", |
1748 |
+ mode, |
1749 |
+ oi, mi.length, ileft, areq->cryptlen, rx_cnt, |
1750 |
+ oo, mo.length, oleft, areq->cryptlen, tx_cnt, ob); |
1751 |
+@@ -282,7 +286,8 @@ static int sun4i_ss_cipher_poll(struct skcipher_request *areq) |
1752 |
+ if (!tx_cnt) |
1753 |
+ continue; |
1754 |
+ /* todo in 4bytes word */ |
1755 |
+- todo = min3(tx_cnt, oleft / 4, (mo.length - oo) / 4); |
1756 |
++ todo = min(tx_cnt, oleft / 4); |
1757 |
++ todo = min_t(size_t, todo, (mo.length - oo) / 4); |
1758 |
+ if (todo) { |
1759 |
+ readsl(ss->base + SS_TXFIFO, mo.addr + oo, todo); |
1760 |
+ oleft -= todo * 4; |
1761 |
+@@ -308,7 +313,8 @@ static int sun4i_ss_cipher_poll(struct skcipher_request *areq) |
1762 |
+ * no more than remaining buffer |
1763 |
+ * no need to test against oleft |
1764 |
+ */ |
1765 |
+- todo = min(mo.length - oo, obl - obo); |
1766 |
++ todo = min_t(size_t, |
1767 |
++ mo.length - oo, obl - obo); |
1768 |
+ memcpy(mo.addr + oo, bufo + obo, todo); |
1769 |
+ oleft -= todo; |
1770 |
+ obo += todo; |
1771 |
+diff --git a/drivers/crypto/sunxi-ss/sun4i-ss-hash.c b/drivers/crypto/sunxi-ss/sun4i-ss-hash.c |
1772 |
+index fcffba5ef927..1369c5fa3087 100644 |
1773 |
+--- a/drivers/crypto/sunxi-ss/sun4i-ss-hash.c |
1774 |
++++ b/drivers/crypto/sunxi-ss/sun4i-ss-hash.c |
1775 |
+@@ -272,8 +272,8 @@ static int sun4i_hash(struct ahash_request *areq) |
1776 |
+ */ |
1777 |
+ while (op->len < 64 && i < end) { |
1778 |
+ /* how many bytes we can read from current SG */ |
1779 |
+- in_r = min3(mi.length - in_i, end - i, |
1780 |
+- 64 - op->len); |
1781 |
++ in_r = min(end - i, 64 - op->len); |
1782 |
++ in_r = min_t(size_t, mi.length - in_i, in_r); |
1783 |
+ memcpy(op->buf + op->len, mi.addr + in_i, in_r); |
1784 |
+ op->len += in_r; |
1785 |
+ i += in_r; |
1786 |
+@@ -293,8 +293,8 @@ static int sun4i_hash(struct ahash_request *areq) |
1787 |
+ } |
1788 |
+ if (mi.length - in_i > 3 && i < end) { |
1789 |
+ /* how many bytes we can read from current SG */ |
1790 |
+- in_r = min3(mi.length - in_i, areq->nbytes - i, |
1791 |
+- ((mi.length - in_i) / 4) * 4); |
1792 |
++ in_r = min_t(size_t, mi.length - in_i, areq->nbytes - i); |
1793 |
++ in_r = min_t(size_t, ((mi.length - in_i) / 4) * 4, in_r); |
1794 |
+ /* how many bytes we can write in the device*/ |
1795 |
+ todo = min3((u32)(end - i) / 4, rx_cnt, (u32)in_r / 4); |
1796 |
+ writesl(ss->base + SS_RXFIFO, mi.addr + in_i, todo); |
1797 |
+@@ -320,8 +320,8 @@ static int sun4i_hash(struct ahash_request *areq) |
1798 |
+ if ((areq->nbytes - i) < 64) { |
1799 |
+ while (i < areq->nbytes && in_i < mi.length && op->len < 64) { |
1800 |
+ /* how many bytes we can read from current SG */ |
1801 |
+- in_r = min3(mi.length - in_i, areq->nbytes - i, |
1802 |
+- 64 - op->len); |
1803 |
++ in_r = min(areq->nbytes - i, 64 - op->len); |
1804 |
++ in_r = min_t(size_t, mi.length - in_i, in_r); |
1805 |
+ memcpy(op->buf + op->len, mi.addr + in_i, in_r); |
1806 |
+ op->len += in_r; |
1807 |
+ i += in_r; |
1808 |
+diff --git a/drivers/crypto/virtio/virtio_crypto_algs.c b/drivers/crypto/virtio/virtio_crypto_algs.c |
1809 |
+index 42d19205166b..673fb29fda53 100644 |
1810 |
+--- a/drivers/crypto/virtio/virtio_crypto_algs.c |
1811 |
++++ b/drivers/crypto/virtio/virtio_crypto_algs.c |
1812 |
+@@ -105,8 +105,6 @@ virtio_crypto_alg_validate_key(int key_len, uint32_t *alg) |
1813 |
+ *alg = VIRTIO_CRYPTO_CIPHER_AES_CBC; |
1814 |
+ break; |
1815 |
+ default: |
1816 |
+- pr_err("virtio_crypto: Unsupported key length: %d\n", |
1817 |
+- key_len); |
1818 |
+ return -EINVAL; |
1819 |
+ } |
1820 |
+ return 0; |
1821 |
+@@ -484,6 +482,11 @@ static int virtio_crypto_ablkcipher_encrypt(struct ablkcipher_request *req) |
1822 |
+ /* Use the first data virtqueue as default */ |
1823 |
+ struct data_queue *data_vq = &vcrypto->data_vq[0]; |
1824 |
+ |
1825 |
++ if (!req->nbytes) |
1826 |
++ return 0; |
1827 |
++ if (req->nbytes % AES_BLOCK_SIZE) |
1828 |
++ return -EINVAL; |
1829 |
++ |
1830 |
+ vc_req->dataq = data_vq; |
1831 |
+ vc_req->alg_cb = virtio_crypto_dataq_sym_callback; |
1832 |
+ vc_sym_req->ablkcipher_ctx = ctx; |
1833 |
+@@ -504,6 +507,11 @@ static int virtio_crypto_ablkcipher_decrypt(struct ablkcipher_request *req) |
1834 |
+ /* Use the first data virtqueue as default */ |
1835 |
+ struct data_queue *data_vq = &vcrypto->data_vq[0]; |
1836 |
+ |
1837 |
++ if (!req->nbytes) |
1838 |
++ return 0; |
1839 |
++ if (req->nbytes % AES_BLOCK_SIZE) |
1840 |
++ return -EINVAL; |
1841 |
++ |
1842 |
+ vc_req->dataq = data_vq; |
1843 |
+ vc_req->alg_cb = virtio_crypto_dataq_sym_callback; |
1844 |
+ vc_sym_req->ablkcipher_ctx = ctx; |
1845 |
+diff --git a/drivers/crypto/vmx/Makefile b/drivers/crypto/vmx/Makefile |
1846 |
+index cab32cfec9c4..709670d2b553 100644 |
1847 |
+--- a/drivers/crypto/vmx/Makefile |
1848 |
++++ b/drivers/crypto/vmx/Makefile |
1849 |
+@@ -3,13 +3,13 @@ obj-$(CONFIG_CRYPTO_DEV_VMX_ENCRYPT) += vmx-crypto.o |
1850 |
+ vmx-crypto-objs := vmx.o aesp8-ppc.o ghashp8-ppc.o aes.o aes_cbc.o aes_ctr.o aes_xts.o ghash.o |
1851 |
+ |
1852 |
+ ifeq ($(CONFIG_CPU_LITTLE_ENDIAN),y) |
1853 |
+-TARGET := linux-ppc64le |
1854 |
++override flavour := linux-ppc64le |
1855 |
+ else |
1856 |
+-TARGET := linux-ppc64 |
1857 |
++override flavour := linux-ppc64 |
1858 |
+ endif |
1859 |
+ |
1860 |
+ quiet_cmd_perl = PERL $@ |
1861 |
+- cmd_perl = $(PERL) $(<) $(TARGET) > $(@) |
1862 |
++ cmd_perl = $(PERL) $(<) $(flavour) > $(@) |
1863 |
+ |
1864 |
+ targets += aesp8-ppc.S ghashp8-ppc.S |
1865 |
+ |
1866 |
+diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c |
1867 |
+index c1d4536ae466..cc5e56d752c8 100644 |
1868 |
+--- a/drivers/edac/amd64_edac.c |
1869 |
++++ b/drivers/edac/amd64_edac.c |
1870 |
+@@ -2936,6 +2936,7 @@ static int init_csrows_df(struct mem_ctl_info *mci) |
1871 |
+ dimm->mtype = pvt->dram_type; |
1872 |
+ dimm->edac_mode = edac_mode; |
1873 |
+ dimm->dtype = dev_type; |
1874 |
++ dimm->grain = 64; |
1875 |
+ } |
1876 |
+ } |
1877 |
+ |
1878 |
+@@ -3012,6 +3013,7 @@ static int init_csrows(struct mem_ctl_info *mci) |
1879 |
+ dimm = csrow->channels[j]->dimm; |
1880 |
+ dimm->mtype = pvt->dram_type; |
1881 |
+ dimm->edac_mode = edac_mode; |
1882 |
++ dimm->grain = 64; |
1883 |
+ } |
1884 |
+ } |
1885 |
+ |
1886 |
+diff --git a/drivers/edac/ghes_edac.c b/drivers/edac/ghes_edac.c |
1887 |
+index 296e714bf553..523dd56a798c 100644 |
1888 |
+--- a/drivers/edac/ghes_edac.c |
1889 |
++++ b/drivers/edac/ghes_edac.c |
1890 |
+@@ -231,6 +231,7 @@ void ghes_edac_report_mem_error(int sev, struct cper_sec_mem_err *mem_err) |
1891 |
+ /* Cleans the error report buffer */ |
1892 |
+ memset(e, 0, sizeof (*e)); |
1893 |
+ e->error_count = 1; |
1894 |
++ e->grain = 1; |
1895 |
+ strcpy(e->label, "unknown label"); |
1896 |
+ e->msg = pvt->msg; |
1897 |
+ e->other_detail = pvt->other_detail; |
1898 |
+@@ -326,7 +327,7 @@ void ghes_edac_report_mem_error(int sev, struct cper_sec_mem_err *mem_err) |
1899 |
+ |
1900 |
+ /* Error grain */ |
1901 |
+ if (mem_err->validation_bits & CPER_MEM_VALID_PA_MASK) |
1902 |
+- e->grain = ~(mem_err->physical_addr_mask & ~PAGE_MASK); |
1903 |
++ e->grain = ~mem_err->physical_addr_mask + 1; |
1904 |
+ |
1905 |
+ /* Memory error location, mapped on e->location */ |
1906 |
+ p = e->location; |
1907 |
+@@ -442,8 +443,13 @@ void ghes_edac_report_mem_error(int sev, struct cper_sec_mem_err *mem_err) |
1908 |
+ if (p > pvt->other_detail) |
1909 |
+ *(p - 1) = '\0'; |
1910 |
+ |
1911 |
++ /* Sanity-check driver-supplied grain value. */ |
1912 |
++ if (WARN_ON_ONCE(!e->grain)) |
1913 |
++ e->grain = 1; |
1914 |
++ |
1915 |
++ grain_bits = fls_long(e->grain - 1); |
1916 |
++ |
1917 |
+ /* Generate the trace event */ |
1918 |
+- grain_bits = fls_long(e->grain); |
1919 |
+ snprintf(pvt->detail_location, sizeof(pvt->detail_location), |
1920 |
+ "APEI location: %s %s", e->location, e->other_detail); |
1921 |
+ trace_mc_event(type, e->msg, e->label, e->error_count, |
1922 |
+diff --git a/drivers/extcon/extcon-sm5502.c b/drivers/extcon/extcon-sm5502.c |
1923 |
+index dc43847ad2b0..b3d93baf4fc5 100644 |
1924 |
+--- a/drivers/extcon/extcon-sm5502.c |
1925 |
++++ b/drivers/extcon/extcon-sm5502.c |
1926 |
+@@ -65,6 +65,10 @@ struct sm5502_muic_info { |
1927 |
+ /* Default value of SM5502 register to bring up MUIC device. */ |
1928 |
+ static struct reg_data sm5502_reg_data[] = { |
1929 |
+ { |
1930 |
++ .reg = SM5502_REG_RESET, |
1931 |
++ .val = SM5502_REG_RESET_MASK, |
1932 |
++ .invert = true, |
1933 |
++ }, { |
1934 |
+ .reg = SM5502_REG_CONTROL, |
1935 |
+ .val = SM5502_REG_CONTROL_MASK_INT_MASK, |
1936 |
+ .invert = false, |
1937 |
+diff --git a/drivers/extcon/extcon-sm5502.h b/drivers/extcon/extcon-sm5502.h |
1938 |
+index 9dbb634d213b..ce1f1ec310c4 100644 |
1939 |
+--- a/drivers/extcon/extcon-sm5502.h |
1940 |
++++ b/drivers/extcon/extcon-sm5502.h |
1941 |
+@@ -237,6 +237,8 @@ enum sm5502_reg { |
1942 |
+ #define DM_DP_SWITCH_UART ((DM_DP_CON_SWITCH_UART <<SM5502_REG_MANUAL_SW1_DP_SHIFT) \ |
1943 |
+ | (DM_DP_CON_SWITCH_UART <<SM5502_REG_MANUAL_SW1_DM_SHIFT)) |
1944 |
+ |
1945 |
++#define SM5502_REG_RESET_MASK (0x1) |
1946 |
++ |
1947 |
+ /* SM5502 Interrupts */ |
1948 |
+ enum sm5502_irq { |
1949 |
+ /* INT1 */ |
1950 |
+diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c |
1951 |
+index e98bbf8e56d9..34d41f67b54d 100644 |
1952 |
+--- a/drivers/firmware/efi/efi.c |
1953 |
++++ b/drivers/firmware/efi/efi.c |
1954 |
+@@ -970,6 +970,24 @@ static int __init efi_memreserve_map_root(void) |
1955 |
+ return 0; |
1956 |
+ } |
1957 |
+ |
1958 |
++static int efi_mem_reserve_iomem(phys_addr_t addr, u64 size) |
1959 |
++{ |
1960 |
++ struct resource *res, *parent; |
1961 |
++ |
1962 |
++ res = kzalloc(sizeof(struct resource), GFP_ATOMIC); |
1963 |
++ if (!res) |
1964 |
++ return -ENOMEM; |
1965 |
++ |
1966 |
++ res->name = "reserved"; |
1967 |
++ res->flags = IORESOURCE_MEM; |
1968 |
++ res->start = addr; |
1969 |
++ res->end = addr + size - 1; |
1970 |
++ |
1971 |
++ /* we expect a conflict with a 'System RAM' region */ |
1972 |
++ parent = request_resource_conflict(&iomem_resource, res); |
1973 |
++ return parent ? request_resource(parent, res) : 0; |
1974 |
++} |
1975 |
++ |
1976 |
+ int __ref efi_mem_reserve_persistent(phys_addr_t addr, u64 size) |
1977 |
+ { |
1978 |
+ struct linux_efi_memreserve *rsv; |
1979 |
+@@ -994,7 +1012,7 @@ int __ref efi_mem_reserve_persistent(phys_addr_t addr, u64 size) |
1980 |
+ rsv->entry[index].size = size; |
1981 |
+ |
1982 |
+ memunmap(rsv); |
1983 |
+- return 0; |
1984 |
++ return efi_mem_reserve_iomem(addr, size); |
1985 |
+ } |
1986 |
+ memunmap(rsv); |
1987 |
+ } |
1988 |
+@@ -1004,6 +1022,12 @@ int __ref efi_mem_reserve_persistent(phys_addr_t addr, u64 size) |
1989 |
+ if (!rsv) |
1990 |
+ return -ENOMEM; |
1991 |
+ |
1992 |
++ rc = efi_mem_reserve_iomem(__pa(rsv), SZ_4K); |
1993 |
++ if (rc) { |
1994 |
++ free_page((unsigned long)rsv); |
1995 |
++ return rc; |
1996 |
++ } |
1997 |
++ |
1998 |
+ /* |
1999 |
+ * The memremap() call above assumes that a linux_efi_memreserve entry |
2000 |
+ * never crosses a page boundary, so let's ensure that this remains true |
2001 |
+@@ -1020,7 +1044,7 @@ int __ref efi_mem_reserve_persistent(phys_addr_t addr, u64 size) |
2002 |
+ efi_memreserve_root->next = __pa(rsv); |
2003 |
+ spin_unlock(&efi_mem_reserve_persistent_lock); |
2004 |
+ |
2005 |
+- return 0; |
2006 |
++ return efi_mem_reserve_iomem(addr, size); |
2007 |
+ } |
2008 |
+ |
2009 |
+ static int __init efi_memreserve_root_init(void) |
2010 |
+diff --git a/drivers/fsi/fsi-core.c b/drivers/fsi/fsi-core.c |
2011 |
+index 1f76740f33b6..9282239b4d95 100644 |
2012 |
+--- a/drivers/fsi/fsi-core.c |
2013 |
++++ b/drivers/fsi/fsi-core.c |
2014 |
+@@ -544,6 +544,31 @@ static int fsi_slave_scan(struct fsi_slave *slave) |
2015 |
+ return 0; |
2016 |
+ } |
2017 |
+ |
2018 |
++static unsigned long aligned_access_size(size_t offset, size_t count) |
2019 |
++{ |
2020 |
++ unsigned long offset_unit, count_unit; |
2021 |
++ |
2022 |
++ /* Criteria: |
2023 |
++ * |
2024 |
++ * 1. Access size must be less than or equal to the maximum access |
2025 |
++ * width or the highest power-of-two factor of offset |
2026 |
++ * 2. Access size must be less than or equal to the amount specified by |
2027 |
++ * count |
2028 |
++ * |
2029 |
++ * The access width is optimal if we can calculate 1 to be strictly |
2030 |
++ * equal while still satisfying 2. |
2031 |
++ */ |
2032 |
++ |
2033 |
++ /* Find 1 by the bottom bit of offset (with a 4 byte access cap) */ |
2034 |
++ offset_unit = BIT(__builtin_ctzl(offset | 4)); |
2035 |
++ |
2036 |
++ /* Find 2 by the top bit of count */ |
2037 |
++ count_unit = BIT(8 * sizeof(unsigned long) - 1 - __builtin_clzl(count)); |
2038 |
++ |
2039 |
++ /* Constrain the maximum access width to the minimum of both criteria */ |
2040 |
++ return BIT(__builtin_ctzl(offset_unit | count_unit)); |
2041 |
++} |
2042 |
++ |
2043 |
+ static ssize_t fsi_slave_sysfs_raw_read(struct file *file, |
2044 |
+ struct kobject *kobj, struct bin_attribute *attr, char *buf, |
2045 |
+ loff_t off, size_t count) |
2046 |
+@@ -559,8 +584,7 @@ static ssize_t fsi_slave_sysfs_raw_read(struct file *file, |
2047 |
+ return -EINVAL; |
2048 |
+ |
2049 |
+ for (total_len = 0; total_len < count; total_len += read_len) { |
2050 |
+- read_len = min_t(size_t, count, 4); |
2051 |
+- read_len -= off & 0x3; |
2052 |
++ read_len = aligned_access_size(off, count - total_len); |
2053 |
+ |
2054 |
+ rc = fsi_slave_read(slave, off, buf + total_len, read_len); |
2055 |
+ if (rc) |
2056 |
+@@ -587,8 +611,7 @@ static ssize_t fsi_slave_sysfs_raw_write(struct file *file, |
2057 |
+ return -EINVAL; |
2058 |
+ |
2059 |
+ for (total_len = 0; total_len < count; total_len += write_len) { |
2060 |
+- write_len = min_t(size_t, count, 4); |
2061 |
+- write_len -= off & 0x3; |
2062 |
++ write_len = aligned_access_size(off, count - total_len); |
2063 |
+ |
2064 |
+ rc = fsi_slave_write(slave, off, buf + total_len, write_len); |
2065 |
+ if (rc) |
2066 |
+diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c |
2067 |
+index 5652cc72ed3a..81842ba8cd75 100644 |
2068 |
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c |
2069 |
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c |
2070 |
+@@ -859,6 +859,9 @@ static int amdgpu_debugfs_test_ib(struct seq_file *m, void *data) |
2071 |
+ struct amdgpu_device *adev = dev->dev_private; |
2072 |
+ int r = 0, i; |
2073 |
+ |
2074 |
++ /* Avoid accidently unparking the sched thread during GPU reset */ |
2075 |
++ mutex_lock(&adev->lock_reset); |
2076 |
++ |
2077 |
+ /* hold on the scheduler */ |
2078 |
+ for (i = 0; i < AMDGPU_MAX_RINGS; i++) { |
2079 |
+ struct amdgpu_ring *ring = adev->rings[i]; |
2080 |
+@@ -884,6 +887,8 @@ static int amdgpu_debugfs_test_ib(struct seq_file *m, void *data) |
2081 |
+ kthread_unpark(ring->sched.thread); |
2082 |
+ } |
2083 |
+ |
2084 |
++ mutex_unlock(&adev->lock_reset); |
2085 |
++ |
2086 |
+ return 0; |
2087 |
+ } |
2088 |
+ |
2089 |
+@@ -1036,6 +1041,9 @@ static int amdgpu_debugfs_ib_preempt(void *data, u64 val) |
2090 |
+ if (!fences) |
2091 |
+ return -ENOMEM; |
2092 |
+ |
2093 |
++ /* Avoid accidently unparking the sched thread during GPU reset */ |
2094 |
++ mutex_lock(&adev->lock_reset); |
2095 |
++ |
2096 |
+ /* stop the scheduler */ |
2097 |
+ kthread_park(ring->sched.thread); |
2098 |
+ |
2099 |
+@@ -1075,6 +1083,8 @@ failure: |
2100 |
+ /* restart the scheduler */ |
2101 |
+ kthread_unpark(ring->sched.thread); |
2102 |
+ |
2103 |
++ mutex_unlock(&adev->lock_reset); |
2104 |
++ |
2105 |
+ ttm_bo_unlock_delayed_workqueue(&adev->mman.bdev, resched); |
2106 |
+ |
2107 |
+ if (fences) |
2108 |
+diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_test.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_test.c |
2109 |
+index b66d29d5ffa2..b158230af8db 100644 |
2110 |
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_test.c |
2111 |
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_test.c |
2112 |
+@@ -138,6 +138,7 @@ static void amdgpu_do_test_moves(struct amdgpu_device *adev) |
2113 |
+ } |
2114 |
+ |
2115 |
+ dma_fence_put(fence); |
2116 |
++ fence = NULL; |
2117 |
+ |
2118 |
+ r = amdgpu_bo_kmap(vram_obj, &vram_map); |
2119 |
+ if (r) { |
2120 |
+@@ -183,6 +184,7 @@ static void amdgpu_do_test_moves(struct amdgpu_device *adev) |
2121 |
+ } |
2122 |
+ |
2123 |
+ dma_fence_put(fence); |
2124 |
++ fence = NULL; |
2125 |
+ |
2126 |
+ r = amdgpu_bo_kmap(gtt_obj[i], >t_map); |
2127 |
+ if (r) { |
2128 |
+diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h |
2129 |
+index 77674a7b9616..91899d28fa72 100644 |
2130 |
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h |
2131 |
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h |
2132 |
+@@ -170,7 +170,7 @@ TRACE_EVENT(amdgpu_cs_ioctl, |
2133 |
+ __field(unsigned int, context) |
2134 |
+ __field(unsigned int, seqno) |
2135 |
+ __field(struct dma_fence *, fence) |
2136 |
+- __field(char *, ring_name) |
2137 |
++ __string(ring, to_amdgpu_ring(job->base.sched)->name) |
2138 |
+ __field(u32, num_ibs) |
2139 |
+ ), |
2140 |
+ |
2141 |
+@@ -179,12 +179,12 @@ TRACE_EVENT(amdgpu_cs_ioctl, |
2142 |
+ __assign_str(timeline, AMDGPU_JOB_GET_TIMELINE_NAME(job)) |
2143 |
+ __entry->context = job->base.s_fence->finished.context; |
2144 |
+ __entry->seqno = job->base.s_fence->finished.seqno; |
2145 |
+- __entry->ring_name = to_amdgpu_ring(job->base.sched)->name; |
2146 |
++ __assign_str(ring, to_amdgpu_ring(job->base.sched)->name) |
2147 |
+ __entry->num_ibs = job->num_ibs; |
2148 |
+ ), |
2149 |
+ TP_printk("sched_job=%llu, timeline=%s, context=%u, seqno=%u, ring_name=%s, num_ibs=%u", |
2150 |
+ __entry->sched_job_id, __get_str(timeline), __entry->context, |
2151 |
+- __entry->seqno, __entry->ring_name, __entry->num_ibs) |
2152 |
++ __entry->seqno, __get_str(ring), __entry->num_ibs) |
2153 |
+ ); |
2154 |
+ |
2155 |
+ TRACE_EVENT(amdgpu_sched_run_job, |
2156 |
+@@ -195,7 +195,7 @@ TRACE_EVENT(amdgpu_sched_run_job, |
2157 |
+ __string(timeline, AMDGPU_JOB_GET_TIMELINE_NAME(job)) |
2158 |
+ __field(unsigned int, context) |
2159 |
+ __field(unsigned int, seqno) |
2160 |
+- __field(char *, ring_name) |
2161 |
++ __string(ring, to_amdgpu_ring(job->base.sched)->name) |
2162 |
+ __field(u32, num_ibs) |
2163 |
+ ), |
2164 |
+ |
2165 |
+@@ -204,12 +204,12 @@ TRACE_EVENT(amdgpu_sched_run_job, |
2166 |
+ __assign_str(timeline, AMDGPU_JOB_GET_TIMELINE_NAME(job)) |
2167 |
+ __entry->context = job->base.s_fence->finished.context; |
2168 |
+ __entry->seqno = job->base.s_fence->finished.seqno; |
2169 |
+- __entry->ring_name = to_amdgpu_ring(job->base.sched)->name; |
2170 |
++ __assign_str(ring, to_amdgpu_ring(job->base.sched)->name) |
2171 |
+ __entry->num_ibs = job->num_ibs; |
2172 |
+ ), |
2173 |
+ TP_printk("sched_job=%llu, timeline=%s, context=%u, seqno=%u, ring_name=%s, num_ibs=%u", |
2174 |
+ __entry->sched_job_id, __get_str(timeline), __entry->context, |
2175 |
+- __entry->seqno, __entry->ring_name, __entry->num_ibs) |
2176 |
++ __entry->seqno, __get_str(ring), __entry->num_ibs) |
2177 |
+ ); |
2178 |
+ |
2179 |
+ |
2180 |
+@@ -468,7 +468,7 @@ TRACE_EVENT(amdgpu_ib_pipe_sync, |
2181 |
+ TP_PROTO(struct amdgpu_job *sched_job, struct dma_fence *fence), |
2182 |
+ TP_ARGS(sched_job, fence), |
2183 |
+ TP_STRUCT__entry( |
2184 |
+- __field(const char *,name) |
2185 |
++ __string(ring, sched_job->base.sched->name); |
2186 |
+ __field(uint64_t, id) |
2187 |
+ __field(struct dma_fence *, fence) |
2188 |
+ __field(uint64_t, ctx) |
2189 |
+@@ -476,14 +476,14 @@ TRACE_EVENT(amdgpu_ib_pipe_sync, |
2190 |
+ ), |
2191 |
+ |
2192 |
+ TP_fast_assign( |
2193 |
+- __entry->name = sched_job->base.sched->name; |
2194 |
++ __assign_str(ring, sched_job->base.sched->name) |
2195 |
+ __entry->id = sched_job->base.id; |
2196 |
+ __entry->fence = fence; |
2197 |
+ __entry->ctx = fence->context; |
2198 |
+ __entry->seqno = fence->seqno; |
2199 |
+ ), |
2200 |
+ TP_printk("job ring=%s, id=%llu, need pipe sync to fence=%p, context=%llu, seq=%u", |
2201 |
+- __entry->name, __entry->id, |
2202 |
++ __get_str(ring), __entry->id, |
2203 |
+ __entry->fence, __entry->ctx, |
2204 |
+ __entry->seqno) |
2205 |
+ ); |
2206 |
+diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c |
2207 |
+index 5251352f5922..c7514f743409 100644 |
2208 |
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c |
2209 |
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c |
2210 |
+@@ -1034,10 +1034,8 @@ int amdgpu_vm_flush(struct amdgpu_ring *ring, struct amdgpu_job *job, bool need_ |
2211 |
+ id->oa_base != job->oa_base || |
2212 |
+ id->oa_size != job->oa_size); |
2213 |
+ bool vm_flush_needed = job->vm_needs_flush; |
2214 |
+- bool pasid_mapping_needed = id->pasid != job->pasid || |
2215 |
+- !id->pasid_mapping || |
2216 |
+- !dma_fence_is_signaled(id->pasid_mapping); |
2217 |
+ struct dma_fence *fence = NULL; |
2218 |
++ bool pasid_mapping_needed = false; |
2219 |
+ unsigned patch_offset = 0; |
2220 |
+ int r; |
2221 |
+ |
2222 |
+@@ -1047,6 +1045,12 @@ int amdgpu_vm_flush(struct amdgpu_ring *ring, struct amdgpu_job *job, bool need_ |
2223 |
+ pasid_mapping_needed = true; |
2224 |
+ } |
2225 |
+ |
2226 |
++ mutex_lock(&id_mgr->lock); |
2227 |
++ if (id->pasid != job->pasid || !id->pasid_mapping || |
2228 |
++ !dma_fence_is_signaled(id->pasid_mapping)) |
2229 |
++ pasid_mapping_needed = true; |
2230 |
++ mutex_unlock(&id_mgr->lock); |
2231 |
++ |
2232 |
+ gds_switch_needed &= !!ring->funcs->emit_gds_switch; |
2233 |
+ vm_flush_needed &= !!ring->funcs->emit_vm_flush && |
2234 |
+ job->vm_pd_addr != AMDGPU_BO_INVALID_OFFSET; |
2235 |
+@@ -1086,9 +1090,11 @@ int amdgpu_vm_flush(struct amdgpu_ring *ring, struct amdgpu_job *job, bool need_ |
2236 |
+ } |
2237 |
+ |
2238 |
+ if (pasid_mapping_needed) { |
2239 |
++ mutex_lock(&id_mgr->lock); |
2240 |
+ id->pasid = job->pasid; |
2241 |
+ dma_fence_put(id->pasid_mapping); |
2242 |
+ id->pasid_mapping = dma_fence_get(fence); |
2243 |
++ mutex_unlock(&id_mgr->lock); |
2244 |
+ } |
2245 |
+ dma_fence_put(fence); |
2246 |
+ |
2247 |
+diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c |
2248 |
+index 97cf0b536873..c9ba2ec6d038 100644 |
2249 |
+--- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c |
2250 |
++++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c |
2251 |
+@@ -2930,7 +2930,8 @@ static void gfx_v9_0_init_pg(struct amdgpu_device *adev) |
2252 |
+ * And it's needed by gfxoff feature. |
2253 |
+ */ |
2254 |
+ if (adev->gfx.rlc.is_rlc_v2_1) { |
2255 |
+- gfx_v9_1_init_rlc_save_restore_list(adev); |
2256 |
++ if (adev->asic_type == CHIP_VEGA12) |
2257 |
++ gfx_v9_1_init_rlc_save_restore_list(adev); |
2258 |
+ gfx_v9_0_enable_save_restore_machine(adev); |
2259 |
+ } |
2260 |
+ |
2261 |
+diff --git a/drivers/gpu/drm/amd/amdgpu/psp_v11_0.c b/drivers/gpu/drm/amd/amdgpu/psp_v11_0.c |
2262 |
+index 10166104b8a3..d483684db95b 100644 |
2263 |
+--- a/drivers/gpu/drm/amd/amdgpu/psp_v11_0.c |
2264 |
++++ b/drivers/gpu/drm/amd/amdgpu/psp_v11_0.c |
2265 |
+@@ -398,6 +398,34 @@ static bool psp_v11_0_support_vmr_ring(struct psp_context *psp) |
2266 |
+ return false; |
2267 |
+ } |
2268 |
+ |
2269 |
++static int psp_v11_0_ring_stop(struct psp_context *psp, |
2270 |
++ enum psp_ring_type ring_type) |
2271 |
++{ |
2272 |
++ int ret = 0; |
2273 |
++ struct amdgpu_device *adev = psp->adev; |
2274 |
++ |
2275 |
++ /* Write the ring destroy command*/ |
2276 |
++ if (psp_v11_0_support_vmr_ring(psp)) |
2277 |
++ WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_101, |
2278 |
++ GFX_CTRL_CMD_ID_DESTROY_GPCOM_RING); |
2279 |
++ else |
2280 |
++ WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_64, |
2281 |
++ GFX_CTRL_CMD_ID_DESTROY_RINGS); |
2282 |
++ |
2283 |
++ /* there might be handshake issue with hardware which needs delay */ |
2284 |
++ mdelay(20); |
2285 |
++ |
2286 |
++ /* Wait for response flag (bit 31) */ |
2287 |
++ if (psp_v11_0_support_vmr_ring(psp)) |
2288 |
++ ret = psp_wait_for(psp, SOC15_REG_OFFSET(MP0, 0, mmMP0_SMN_C2PMSG_101), |
2289 |
++ 0x80000000, 0x80000000, false); |
2290 |
++ else |
2291 |
++ ret = psp_wait_for(psp, SOC15_REG_OFFSET(MP0, 0, mmMP0_SMN_C2PMSG_64), |
2292 |
++ 0x80000000, 0x80000000, false); |
2293 |
++ |
2294 |
++ return ret; |
2295 |
++} |
2296 |
++ |
2297 |
+ static int psp_v11_0_ring_create(struct psp_context *psp, |
2298 |
+ enum psp_ring_type ring_type) |
2299 |
+ { |
2300 |
+@@ -407,6 +435,12 @@ static int psp_v11_0_ring_create(struct psp_context *psp, |
2301 |
+ struct amdgpu_device *adev = psp->adev; |
2302 |
+ |
2303 |
+ if (psp_v11_0_support_vmr_ring(psp)) { |
2304 |
++ ret = psp_v11_0_ring_stop(psp, ring_type); |
2305 |
++ if (ret) { |
2306 |
++ DRM_ERROR("psp_v11_0_ring_stop_sriov failed!\n"); |
2307 |
++ return ret; |
2308 |
++ } |
2309 |
++ |
2310 |
+ /* Write low address of the ring to C2PMSG_102 */ |
2311 |
+ psp_ring_reg = lower_32_bits(ring->ring_mem_mc_addr); |
2312 |
+ WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_102, psp_ring_reg); |
2313 |
+@@ -451,33 +485,6 @@ static int psp_v11_0_ring_create(struct psp_context *psp, |
2314 |
+ return ret; |
2315 |
+ } |
2316 |
+ |
2317 |
+-static int psp_v11_0_ring_stop(struct psp_context *psp, |
2318 |
+- enum psp_ring_type ring_type) |
2319 |
+-{ |
2320 |
+- int ret = 0; |
2321 |
+- struct amdgpu_device *adev = psp->adev; |
2322 |
+- |
2323 |
+- /* Write the ring destroy command*/ |
2324 |
+- if (psp_v11_0_support_vmr_ring(psp)) |
2325 |
+- WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_101, |
2326 |
+- GFX_CTRL_CMD_ID_DESTROY_GPCOM_RING); |
2327 |
+- else |
2328 |
+- WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_64, |
2329 |
+- GFX_CTRL_CMD_ID_DESTROY_RINGS); |
2330 |
+- |
2331 |
+- /* there might be handshake issue with hardware which needs delay */ |
2332 |
+- mdelay(20); |
2333 |
+- |
2334 |
+- /* Wait for response flag (bit 31) */ |
2335 |
+- if (psp_v11_0_support_vmr_ring(psp)) |
2336 |
+- ret = psp_wait_for(psp, SOC15_REG_OFFSET(MP0, 0, mmMP0_SMN_C2PMSG_101), |
2337 |
+- 0x80000000, 0x80000000, false); |
2338 |
+- else |
2339 |
+- ret = psp_wait_for(psp, SOC15_REG_OFFSET(MP0, 0, mmMP0_SMN_C2PMSG_64), |
2340 |
+- 0x80000000, 0x80000000, false); |
2341 |
+- |
2342 |
+- return ret; |
2343 |
+-} |
2344 |
+ |
2345 |
+ static int psp_v11_0_ring_destroy(struct psp_context *psp, |
2346 |
+ enum psp_ring_type ring_type) |
2347 |
+diff --git a/drivers/gpu/drm/amd/amdgpu/si_ih.c b/drivers/gpu/drm/amd/amdgpu/si_ih.c |
2348 |
+index 57bb5f9e08b2..88ae27a5a03d 100644 |
2349 |
+--- a/drivers/gpu/drm/amd/amdgpu/si_ih.c |
2350 |
++++ b/drivers/gpu/drm/amd/amdgpu/si_ih.c |
2351 |
+@@ -64,7 +64,8 @@ static int si_ih_irq_init(struct amdgpu_device *adev) |
2352 |
+ u32 interrupt_cntl, ih_cntl, ih_rb_cntl; |
2353 |
+ |
2354 |
+ si_ih_disable_interrupts(adev); |
2355 |
+- WREG32(INTERRUPT_CNTL2, adev->irq.ih.gpu_addr >> 8); |
2356 |
++ /* set dummy read address to dummy page address */ |
2357 |
++ WREG32(INTERRUPT_CNTL2, adev->dummy_page_addr >> 8); |
2358 |
+ interrupt_cntl = RREG32(INTERRUPT_CNTL); |
2359 |
+ interrupt_cntl &= ~IH_DUMMY_RD_OVERRIDE; |
2360 |
+ interrupt_cntl &= ~IH_REQ_NONSNOOP_EN; |
2361 |
+diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c |
2362 |
+index d985e31fcc1e..f335f73919d1 100644 |
2363 |
+--- a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c |
2364 |
++++ b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c |
2365 |
+@@ -1676,7 +1676,8 @@ static int allocate_hiq_sdma_mqd(struct device_queue_manager *dqm) |
2366 |
+ struct kfd_dev *dev = dqm->dev; |
2367 |
+ struct kfd_mem_obj *mem_obj = &dqm->hiq_sdma_mqd; |
2368 |
+ uint32_t size = dqm->mqd_mgrs[KFD_MQD_TYPE_SDMA]->mqd_size * |
2369 |
+- dev->device_info->num_sdma_engines * |
2370 |
++ (dev->device_info->num_sdma_engines + |
2371 |
++ dev->device_info->num_xgmi_sdma_engines) * |
2372 |
+ dev->device_info->num_sdma_queues_per_engine + |
2373 |
+ dqm->mqd_mgrs[KFD_MQD_TYPE_HIQ]->mqd_size; |
2374 |
+ |
2375 |
+diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_interrupt.c b/drivers/gpu/drm/amd/amdkfd/kfd_interrupt.c |
2376 |
+index c56ac47cd318..bc47f6a44456 100644 |
2377 |
+--- a/drivers/gpu/drm/amd/amdkfd/kfd_interrupt.c |
2378 |
++++ b/drivers/gpu/drm/amd/amdkfd/kfd_interrupt.c |
2379 |
+@@ -62,6 +62,11 @@ int kfd_interrupt_init(struct kfd_dev *kfd) |
2380 |
+ } |
2381 |
+ |
2382 |
+ kfd->ih_wq = alloc_workqueue("KFD IH", WQ_HIGHPRI, 1); |
2383 |
++ if (unlikely(!kfd->ih_wq)) { |
2384 |
++ kfifo_free(&kfd->ih_fifo); |
2385 |
++ dev_err(kfd_chardev(), "Failed to allocate KFD IH workqueue\n"); |
2386 |
++ return -ENOMEM; |
2387 |
++ } |
2388 |
+ spin_lock_init(&kfd->interrupt_lock); |
2389 |
+ |
2390 |
+ INIT_WORK(&kfd->interrupt_work, interrupt_wq); |
2391 |
+diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |
2392 |
+index 4139f129eafb..4e9c15c409ba 100644 |
2393 |
+--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |
2394 |
++++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |
2395 |
+@@ -940,6 +940,11 @@ static int dm_late_init(void *handle) |
2396 |
+ params.backlight_lut_array_size = 16; |
2397 |
+ params.backlight_lut_array = linear_lut; |
2398 |
+ |
2399 |
++ /* Min backlight level after ABM reduction, Don't allow below 1% |
2400 |
++ * 0xFFFF x 0.01 = 0x28F |
2401 |
++ */ |
2402 |
++ params.min_abm_backlight = 0x28F; |
2403 |
++ |
2404 |
+ /* todo will enable for navi10 */ |
2405 |
+ if (adev->asic_type <= CHIP_RAVEN) { |
2406 |
+ ret = dmcu_load_iram(dmcu, params); |
2407 |
+diff --git a/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn20/dcn20_clk_mgr.c b/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn20/dcn20_clk_mgr.c |
2408 |
+index 3e8ac303bd52..23ec283eb07b 100644 |
2409 |
+--- a/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn20/dcn20_clk_mgr.c |
2410 |
++++ b/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn20/dcn20_clk_mgr.c |
2411 |
+@@ -320,6 +320,8 @@ void dcn2_update_clocks_fpga(struct clk_mgr *clk_mgr, |
2412 |
+ struct dc_state *context, |
2413 |
+ bool safe_to_lower) |
2414 |
+ { |
2415 |
++ struct clk_mgr_internal *clk_mgr_int = TO_CLK_MGR_INTERNAL(clk_mgr); |
2416 |
++ |
2417 |
+ struct dc_clocks *new_clocks = &context->bw_ctx.bw.dcn.clk; |
2418 |
+ /* Min fclk = 1.2GHz since all the extra scemi logic seems to run off of it */ |
2419 |
+ int fclk_adj = new_clocks->fclk_khz > 1200000 ? new_clocks->fclk_khz : 1200000; |
2420 |
+@@ -357,14 +359,18 @@ void dcn2_update_clocks_fpga(struct clk_mgr *clk_mgr, |
2421 |
+ clk_mgr->clks.dispclk_khz = new_clocks->dispclk_khz; |
2422 |
+ } |
2423 |
+ |
2424 |
+- /* Both fclk and dppclk ref are run on the same scemi clock so we |
2425 |
+- * need to keep the same value for both |
2426 |
++ /* Both fclk and ref_dppclk run on the same scemi clock. |
2427 |
++ * So take the higher value since the DPP DTO is typically programmed |
2428 |
++ * such that max dppclk is 1:1 with ref_dppclk. |
2429 |
+ */ |
2430 |
+ if (clk_mgr->clks.fclk_khz > clk_mgr->clks.dppclk_khz) |
2431 |
+ clk_mgr->clks.dppclk_khz = clk_mgr->clks.fclk_khz; |
2432 |
+ if (clk_mgr->clks.dppclk_khz > clk_mgr->clks.fclk_khz) |
2433 |
+ clk_mgr->clks.fclk_khz = clk_mgr->clks.dppclk_khz; |
2434 |
+ |
2435 |
++ // Both fclk and ref_dppclk run on the same scemi clock. |
2436 |
++ clk_mgr_int->dccg->ref_dppclk = clk_mgr->clks.fclk_khz; |
2437 |
++ |
2438 |
+ dm_set_dcn_clocks(clk_mgr->ctx, &clk_mgr->clks); |
2439 |
+ } |
2440 |
+ |
2441 |
+diff --git a/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn21/rn_clk_mgr_vbios_smu.c b/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn21/rn_clk_mgr_vbios_smu.c |
2442 |
+index 50984c1811bb..468c6bb0e311 100644 |
2443 |
+--- a/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn21/rn_clk_mgr_vbios_smu.c |
2444 |
++++ b/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn21/rn_clk_mgr_vbios_smu.c |
2445 |
+@@ -33,7 +33,7 @@ |
2446 |
+ #include "mp/mp_12_0_0_sh_mask.h" |
2447 |
+ |
2448 |
+ #define REG(reg_name) \ |
2449 |
+- (MP1_BASE.instance[0].segment[mm ## reg_name ## _BASE_IDX] + mm ## reg_name) |
2450 |
++ (MP0_BASE.instance[0].segment[mm ## reg_name ## _BASE_IDX] + mm ## reg_name) |
2451 |
+ |
2452 |
+ #define FN(reg_name, field) \ |
2453 |
+ FD(reg_name##__##field) |
2454 |
+diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link.c b/drivers/gpu/drm/amd/display/dc/core/dc_link.c |
2455 |
+index ca20b150afcc..067f5579f452 100644 |
2456 |
+--- a/drivers/gpu/drm/amd/display/dc/core/dc_link.c |
2457 |
++++ b/drivers/gpu/drm/amd/display/dc/core/dc_link.c |
2458 |
+@@ -2169,8 +2169,10 @@ static void disable_link(struct dc_link *link, enum signal_type signal) |
2459 |
+ dp_set_fec_ready(link, false); |
2460 |
+ } |
2461 |
+ #endif |
2462 |
+- } else |
2463 |
+- link->link_enc->funcs->disable_output(link->link_enc, signal); |
2464 |
++ } else { |
2465 |
++ if (signal != SIGNAL_TYPE_VIRTUAL) |
2466 |
++ link->link_enc->funcs->disable_output(link->link_enc, signal); |
2467 |
++ } |
2468 |
+ |
2469 |
+ if (signal == SIGNAL_TYPE_DISPLAY_PORT_MST) { |
2470 |
+ /* MST disable link only when no stream use the link */ |
2471 |
+@@ -2217,7 +2219,7 @@ static bool dp_active_dongle_validate_timing( |
2472 |
+ break; |
2473 |
+ } |
2474 |
+ |
2475 |
+- if (dongle_caps->dongle_type != DISPLAY_DONGLE_DP_HDMI_CONVERTER || |
2476 |
++ if (dpcd_caps->dongle_type != DISPLAY_DONGLE_DP_HDMI_CONVERTER || |
2477 |
+ dongle_caps->extendedCapValid == false) |
2478 |
+ return true; |
2479 |
+ |
2480 |
+@@ -2767,6 +2769,15 @@ void core_link_enable_stream( |
2481 |
+ CONTROLLER_DP_TEST_PATTERN_VIDEOMODE, |
2482 |
+ COLOR_DEPTH_UNDEFINED); |
2483 |
+ |
2484 |
++ /* This second call is needed to reconfigure the DIG |
2485 |
++ * as a workaround for the incorrect value being applied |
2486 |
++ * from transmitter control. |
2487 |
++ */ |
2488 |
++ if (!dc_is_virtual_signal(pipe_ctx->stream->signal)) |
2489 |
++ stream->link->link_enc->funcs->setup( |
2490 |
++ stream->link->link_enc, |
2491 |
++ pipe_ctx->stream->signal); |
2492 |
++ |
2493 |
+ #ifdef CONFIG_DRM_AMD_DC_DSC_SUPPORT |
2494 |
+ if (pipe_ctx->stream->timing.flags.DSC) { |
2495 |
+ if (dc_is_dp_signal(pipe_ctx->stream->signal) || |
2496 |
+diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c b/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c |
2497 |
+index f5742719b5d9..5a583707d198 100644 |
2498 |
+--- a/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c |
2499 |
++++ b/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c |
2500 |
+@@ -2545,6 +2545,7 @@ static void get_active_converter_info( |
2501 |
+ uint8_t data, struct dc_link *link) |
2502 |
+ { |
2503 |
+ union dp_downstream_port_present ds_port = { .byte = data }; |
2504 |
++ memset(&link->dpcd_caps.dongle_caps, 0, sizeof(link->dpcd_caps.dongle_caps)); |
2505 |
+ |
2506 |
+ /* decode converter info*/ |
2507 |
+ if (!ds_port.fields.PORT_PRESENT) { |
2508 |
+@@ -2691,6 +2692,7 @@ static void dp_wa_power_up_0010FA(struct dc_link *link, uint8_t *dpcd_data, |
2509 |
+ * keep receiver powered all the time.*/ |
2510 |
+ case DP_BRANCH_DEVICE_ID_0010FA: |
2511 |
+ case DP_BRANCH_DEVICE_ID_0080E1: |
2512 |
++ case DP_BRANCH_DEVICE_ID_00E04C: |
2513 |
+ link->wa_flags.dp_keep_receiver_powered = true; |
2514 |
+ break; |
2515 |
+ |
2516 |
+diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link_hwss.c b/drivers/gpu/drm/amd/display/dc/core/dc_link_hwss.c |
2517 |
+index 79438c4f1e20..a519dbc5ecb6 100644 |
2518 |
+--- a/drivers/gpu/drm/amd/display/dc/core/dc_link_hwss.c |
2519 |
++++ b/drivers/gpu/drm/amd/display/dc/core/dc_link_hwss.c |
2520 |
+@@ -277,7 +277,8 @@ void dp_retrain_link_dp_test(struct dc_link *link, |
2521 |
+ if (pipes[i].stream != NULL && |
2522 |
+ !pipes[i].top_pipe && !pipes[i].prev_odm_pipe && |
2523 |
+ pipes[i].stream->link != NULL && |
2524 |
+- pipes[i].stream_res.stream_enc != NULL) { |
2525 |
++ pipes[i].stream_res.stream_enc != NULL && |
2526 |
++ pipes[i].stream->link == link) { |
2527 |
+ udelay(100); |
2528 |
+ |
2529 |
+ pipes[i].stream_res.stream_enc->funcs->dp_blank( |
2530 |
+diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_stream.c b/drivers/gpu/drm/amd/display/dc/core/dc_stream.c |
2531 |
+index bf1d7bb90e0f..bb09243758fe 100644 |
2532 |
+--- a/drivers/gpu/drm/amd/display/dc/core/dc_stream.c |
2533 |
++++ b/drivers/gpu/drm/amd/display/dc/core/dc_stream.c |
2534 |
+@@ -423,10 +423,10 @@ bool dc_stream_add_writeback(struct dc *dc, |
2535 |
+ |
2536 |
+ if (dwb->funcs->is_enabled(dwb)) { |
2537 |
+ /* writeback pipe already enabled, only need to update */ |
2538 |
+- dc->hwss.update_writeback(dc, stream_status, wb_info); |
2539 |
++ dc->hwss.update_writeback(dc, stream_status, wb_info, dc->current_state); |
2540 |
+ } else { |
2541 |
+ /* Enable writeback pipe from scratch*/ |
2542 |
+- dc->hwss.enable_writeback(dc, stream_status, wb_info); |
2543 |
++ dc->hwss.enable_writeback(dc, stream_status, wb_info, dc->current_state); |
2544 |
+ } |
2545 |
+ } |
2546 |
+ |
2547 |
+diff --git a/drivers/gpu/drm/amd/display/dc/dce/dce_abm.c b/drivers/gpu/drm/amd/display/dc/dce/dce_abm.c |
2548 |
+index 58bd131d5b48..7700a855d77c 100644 |
2549 |
+--- a/drivers/gpu/drm/amd/display/dc/dce/dce_abm.c |
2550 |
++++ b/drivers/gpu/drm/amd/display/dc/dce/dce_abm.c |
2551 |
+@@ -77,6 +77,9 @@ static bool dce_abm_set_pipe(struct abm *abm, uint32_t controller_id) |
2552 |
+ /* notifyDMCUMsg */ |
2553 |
+ REG_UPDATE(MASTER_COMM_CNTL_REG, MASTER_COMM_INTERRUPT, 1); |
2554 |
+ |
2555 |
++ REG_WAIT(MASTER_COMM_CNTL_REG, MASTER_COMM_INTERRUPT, 0, |
2556 |
++ 1, 80000); |
2557 |
++ |
2558 |
+ return true; |
2559 |
+ } |
2560 |
+ |
2561 |
+diff --git a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c |
2562 |
+index b3ae1c41fc69..937a8ba81160 100644 |
2563 |
+--- a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c |
2564 |
++++ b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c |
2565 |
+@@ -1356,7 +1356,8 @@ bool dcn20_update_bandwidth( |
2566 |
+ static void dcn20_enable_writeback( |
2567 |
+ struct dc *dc, |
2568 |
+ const struct dc_stream_status *stream_status, |
2569 |
+- struct dc_writeback_info *wb_info) |
2570 |
++ struct dc_writeback_info *wb_info, |
2571 |
++ struct dc_state *context) |
2572 |
+ { |
2573 |
+ struct dwbc *dwb; |
2574 |
+ struct mcif_wb *mcif_wb; |
2575 |
+@@ -1373,7 +1374,7 @@ static void dcn20_enable_writeback( |
2576 |
+ optc->funcs->set_dwb_source(optc, wb_info->dwb_pipe_inst); |
2577 |
+ /* set MCIF_WB buffer and arbitration configuration */ |
2578 |
+ mcif_wb->funcs->config_mcif_buf(mcif_wb, &wb_info->mcif_buf_params, wb_info->dwb_params.dest_height); |
2579 |
+- mcif_wb->funcs->config_mcif_arb(mcif_wb, &dc->current_state->bw_ctx.bw.dcn.bw_writeback.mcif_wb_arb[wb_info->dwb_pipe_inst]); |
2580 |
++ mcif_wb->funcs->config_mcif_arb(mcif_wb, &context->bw_ctx.bw.dcn.bw_writeback.mcif_wb_arb[wb_info->dwb_pipe_inst]); |
2581 |
+ /* Enable MCIF_WB */ |
2582 |
+ mcif_wb->funcs->enable_mcif(mcif_wb); |
2583 |
+ /* Enable DWB */ |
2584 |
+diff --git a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_optc.c b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_optc.c |
2585 |
+index 2137e2be2140..dda90995ba93 100644 |
2586 |
+--- a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_optc.c |
2587 |
++++ b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_optc.c |
2588 |
+@@ -287,6 +287,10 @@ void optc2_get_optc_source(struct timing_generator *optc, |
2589 |
+ *num_of_src_opp = 2; |
2590 |
+ else |
2591 |
+ *num_of_src_opp = 1; |
2592 |
++ |
2593 |
++ /* Work around VBIOS not updating OPTC_NUM_OF_INPUT_SEGMENT */ |
2594 |
++ if (*src_opp_id_1 == 0xf) |
2595 |
++ *num_of_src_opp = 1; |
2596 |
+ } |
2597 |
+ |
2598 |
+ void optc2_set_dwb_source(struct timing_generator *optc, |
2599 |
+diff --git a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c |
2600 |
+index 6b2f2f1a1c9c..78b2cc2e122f 100644 |
2601 |
+--- a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c |
2602 |
++++ b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c |
2603 |
+@@ -1765,7 +1765,7 @@ int dcn20_populate_dml_pipes_from_context( |
2604 |
+ pipe_cnt = i; |
2605 |
+ continue; |
2606 |
+ } |
2607 |
+- if (!resource_are_streams_timing_synchronizable( |
2608 |
++ if (dc->debug.disable_timing_sync || !resource_are_streams_timing_synchronizable( |
2609 |
+ res_ctx->pipe_ctx[pipe_cnt].stream, |
2610 |
+ res_ctx->pipe_ctx[i].stream)) { |
2611 |
+ synchronized_vblank = false; |
2612 |
+@@ -2474,6 +2474,7 @@ bool dcn20_fast_validate_bw( |
2613 |
+ &context->res_ctx, dc->res_pool, |
2614 |
+ pipe, hsplit_pipe)) |
2615 |
+ goto validate_fail; |
2616 |
++ dcn20_build_mapped_resource(dc, context, pipe->stream); |
2617 |
+ } else |
2618 |
+ dcn20_split_stream_for_mpc( |
2619 |
+ &context->res_ctx, dc->res_pool, |
2620 |
+@@ -3040,7 +3041,7 @@ static void cap_soc_clocks( |
2621 |
+ static void update_bounding_box(struct dc *dc, struct _vcs_dpi_soc_bounding_box_st *bb, |
2622 |
+ struct pp_smu_nv_clock_table *max_clocks, unsigned int *uclk_states, unsigned int num_states) |
2623 |
+ { |
2624 |
+- struct _vcs_dpi_voltage_scaling_st calculated_states[MAX_CLOCK_LIMIT_STATES] = {0}; |
2625 |
++ struct _vcs_dpi_voltage_scaling_st calculated_states[MAX_CLOCK_LIMIT_STATES]; |
2626 |
+ int i; |
2627 |
+ int num_calculated_states = 0; |
2628 |
+ int min_dcfclk = 0; |
2629 |
+@@ -3048,6 +3049,8 @@ static void update_bounding_box(struct dc *dc, struct _vcs_dpi_soc_bounding_box_ |
2630 |
+ if (num_states == 0) |
2631 |
+ return; |
2632 |
+ |
2633 |
++ memset(calculated_states, 0, sizeof(calculated_states)); |
2634 |
++ |
2635 |
+ if (dc->bb_overrides.min_dcfclk_mhz > 0) |
2636 |
+ min_dcfclk = dc->bb_overrides.min_dcfclk_mhz; |
2637 |
+ else |
2638 |
+diff --git a/drivers/gpu/drm/amd/display/dc/dcn21/dcn21_hubbub.c b/drivers/gpu/drm/amd/display/dc/dcn21/dcn21_hubbub.c |
2639 |
+index d1266741763b..f5f6b4a0f0aa 100644 |
2640 |
+--- a/drivers/gpu/drm/amd/display/dc/dcn21/dcn21_hubbub.c |
2641 |
++++ b/drivers/gpu/drm/amd/display/dc/dcn21/dcn21_hubbub.c |
2642 |
+@@ -22,6 +22,7 @@ |
2643 |
+ * Authors: AMD |
2644 |
+ * |
2645 |
+ */ |
2646 |
++#include <linux/delay.h> |
2647 |
+ #include "dm_services.h" |
2648 |
+ #include "dcn20/dcn20_hubbub.h" |
2649 |
+ #include "dcn21_hubbub.h" |
2650 |
+@@ -71,30 +72,39 @@ static uint32_t convert_and_clamp( |
2651 |
+ void dcn21_dchvm_init(struct hubbub *hubbub) |
2652 |
+ { |
2653 |
+ struct dcn20_hubbub *hubbub1 = TO_DCN20_HUBBUB(hubbub); |
2654 |
++ uint32_t riommu_active; |
2655 |
++ int i; |
2656 |
+ |
2657 |
+ //Init DCHVM block |
2658 |
+ REG_UPDATE(DCHVM_CTRL0, HOSTVM_INIT_REQ, 1); |
2659 |
+ |
2660 |
+ //Poll until RIOMMU_ACTIVE = 1 |
2661 |
+- //TODO: Figure out interval us and retry count |
2662 |
+- REG_WAIT(DCHVM_RIOMMU_STAT0, RIOMMU_ACTIVE, 1, 5, 100); |
2663 |
++ for (i = 0; i < 100; i++) { |
2664 |
++ REG_GET(DCHVM_RIOMMU_STAT0, RIOMMU_ACTIVE, &riommu_active); |
2665 |
+ |
2666 |
+- //Reflect the power status of DCHUBBUB |
2667 |
+- REG_UPDATE(DCHVM_RIOMMU_CTRL0, HOSTVM_POWERSTATUS, 1); |
2668 |
++ if (riommu_active) |
2669 |
++ break; |
2670 |
++ else |
2671 |
++ udelay(5); |
2672 |
++ } |
2673 |
++ |
2674 |
++ if (riommu_active) { |
2675 |
++ //Reflect the power status of DCHUBBUB |
2676 |
++ REG_UPDATE(DCHVM_RIOMMU_CTRL0, HOSTVM_POWERSTATUS, 1); |
2677 |
+ |
2678 |
+- //Start rIOMMU prefetching |
2679 |
+- REG_UPDATE(DCHVM_RIOMMU_CTRL0, HOSTVM_PREFETCH_REQ, 1); |
2680 |
++ //Start rIOMMU prefetching |
2681 |
++ REG_UPDATE(DCHVM_RIOMMU_CTRL0, HOSTVM_PREFETCH_REQ, 1); |
2682 |
+ |
2683 |
+- // Enable dynamic clock gating |
2684 |
+- REG_UPDATE_4(DCHVM_CLK_CTRL, |
2685 |
+- HVM_DISPCLK_R_GATE_DIS, 0, |
2686 |
+- HVM_DISPCLK_G_GATE_DIS, 0, |
2687 |
+- HVM_DCFCLK_R_GATE_DIS, 0, |
2688 |
+- HVM_DCFCLK_G_GATE_DIS, 0); |
2689 |
++ // Enable dynamic clock gating |
2690 |
++ REG_UPDATE_4(DCHVM_CLK_CTRL, |
2691 |
++ HVM_DISPCLK_R_GATE_DIS, 0, |
2692 |
++ HVM_DISPCLK_G_GATE_DIS, 0, |
2693 |
++ HVM_DCFCLK_R_GATE_DIS, 0, |
2694 |
++ HVM_DCFCLK_G_GATE_DIS, 0); |
2695 |
+ |
2696 |
+- //Poll until HOSTVM_PREFETCH_DONE = 1 |
2697 |
+- //TODO: Figure out interval us and retry count |
2698 |
+- REG_WAIT(DCHVM_RIOMMU_STAT0, HOSTVM_PREFETCH_DONE, 1, 5, 100); |
2699 |
++ //Poll until HOSTVM_PREFETCH_DONE = 1 |
2700 |
++ REG_WAIT(DCHVM_RIOMMU_STAT0, HOSTVM_PREFETCH_DONE, 1, 5, 100); |
2701 |
++ } |
2702 |
+ } |
2703 |
+ |
2704 |
+ static int hubbub21_init_dchub(struct hubbub *hubbub, |
2705 |
+diff --git a/drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h b/drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h |
2706 |
+index 3a938cd414ea..f6cc2d6f576d 100644 |
2707 |
+--- a/drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h |
2708 |
++++ b/drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h |
2709 |
+@@ -321,10 +321,12 @@ struct hw_sequencer_funcs { |
2710 |
+ struct dc_state *context); |
2711 |
+ void (*update_writeback)(struct dc *dc, |
2712 |
+ const struct dc_stream_status *stream_status, |
2713 |
+- struct dc_writeback_info *wb_info); |
2714 |
++ struct dc_writeback_info *wb_info, |
2715 |
++ struct dc_state *context); |
2716 |
+ void (*enable_writeback)(struct dc *dc, |
2717 |
+ const struct dc_stream_status *stream_status, |
2718 |
+- struct dc_writeback_info *wb_info); |
2719 |
++ struct dc_writeback_info *wb_info, |
2720 |
++ struct dc_state *context); |
2721 |
+ void (*disable_writeback)(struct dc *dc, |
2722 |
+ unsigned int dwb_pipe_inst); |
2723 |
+ #endif |
2724 |
+diff --git a/drivers/gpu/drm/amd/display/include/ddc_service_types.h b/drivers/gpu/drm/amd/display/include/ddc_service_types.h |
2725 |
+index 18961707db23..9ad49da50a17 100644 |
2726 |
+--- a/drivers/gpu/drm/amd/display/include/ddc_service_types.h |
2727 |
++++ b/drivers/gpu/drm/amd/display/include/ddc_service_types.h |
2728 |
+@@ -31,6 +31,8 @@ |
2729 |
+ #define DP_BRANCH_DEVICE_ID_0022B9 0x0022B9 |
2730 |
+ #define DP_BRANCH_DEVICE_ID_00001A 0x00001A |
2731 |
+ #define DP_BRANCH_DEVICE_ID_0080E1 0x0080e1 |
2732 |
++#define DP_BRANCH_DEVICE_ID_90CC24 0x90CC24 |
2733 |
++#define DP_BRANCH_DEVICE_ID_00E04C 0x00E04C |
2734 |
+ |
2735 |
+ enum ddc_result { |
2736 |
+ DDC_RESULT_UNKNOWN = 0, |
2737 |
+diff --git a/drivers/gpu/drm/amd/display/modules/freesync/freesync.c b/drivers/gpu/drm/amd/display/modules/freesync/freesync.c |
2738 |
+index ec70c9b12e1a..0978c698f0f8 100644 |
2739 |
+--- a/drivers/gpu/drm/amd/display/modules/freesync/freesync.c |
2740 |
++++ b/drivers/gpu/drm/amd/display/modules/freesync/freesync.c |
2741 |
+@@ -743,6 +743,10 @@ void mod_freesync_build_vrr_params(struct mod_freesync *mod_freesync, |
2742 |
+ nominal_field_rate_in_uhz = |
2743 |
+ mod_freesync_calc_nominal_field_rate(stream); |
2744 |
+ |
2745 |
++ /* Rounded to the nearest Hz */ |
2746 |
++ nominal_field_rate_in_uhz = 1000000ULL * |
2747 |
++ div_u64(nominal_field_rate_in_uhz + 500000, 1000000); |
2748 |
++ |
2749 |
+ min_refresh_in_uhz = in_config->min_refresh_in_uhz; |
2750 |
+ max_refresh_in_uhz = in_config->max_refresh_in_uhz; |
2751 |
+ |
2752 |
+@@ -996,14 +1000,13 @@ unsigned long long mod_freesync_calc_nominal_field_rate( |
2753 |
+ const struct dc_stream_state *stream) |
2754 |
+ { |
2755 |
+ unsigned long long nominal_field_rate_in_uhz = 0; |
2756 |
++ unsigned int total = stream->timing.h_total * stream->timing.v_total; |
2757 |
+ |
2758 |
+- /* Calculate nominal field rate for stream */ |
2759 |
++ /* Calculate nominal field rate for stream, rounded up to nearest integer */ |
2760 |
+ nominal_field_rate_in_uhz = stream->timing.pix_clk_100hz / 10; |
2761 |
+ nominal_field_rate_in_uhz *= 1000ULL * 1000ULL * 1000ULL; |
2762 |
+- nominal_field_rate_in_uhz = div_u64(nominal_field_rate_in_uhz, |
2763 |
+- stream->timing.h_total); |
2764 |
+- nominal_field_rate_in_uhz = div_u64(nominal_field_rate_in_uhz, |
2765 |
+- stream->timing.v_total); |
2766 |
++ |
2767 |
++ nominal_field_rate_in_uhz = div_u64(nominal_field_rate_in_uhz, total); |
2768 |
+ |
2769 |
+ return nominal_field_rate_in_uhz; |
2770 |
+ } |
2771 |
+diff --git a/drivers/gpu/drm/amd/display/modules/power/power_helpers.c b/drivers/gpu/drm/amd/display/modules/power/power_helpers.c |
2772 |
+index 05e2be856037..ba1aafe40512 100644 |
2773 |
+--- a/drivers/gpu/drm/amd/display/modules/power/power_helpers.c |
2774 |
++++ b/drivers/gpu/drm/amd/display/modules/power/power_helpers.c |
2775 |
+@@ -115,7 +115,7 @@ static const struct abm_parameters * const abm_settings[] = { |
2776 |
+ /* NOTE: iRAM is 256B in size */ |
2777 |
+ struct iram_table_v_2 { |
2778 |
+ /* flags */ |
2779 |
+- uint16_t flags; /* 0x00 U16 */ |
2780 |
++ uint16_t min_abm_backlight; /* 0x00 U16 */ |
2781 |
+ |
2782 |
+ /* parameters for ABM2.0 algorithm */ |
2783 |
+ uint8_t min_reduction[NUM_AMBI_LEVEL][NUM_AGGR_LEVEL]; /* 0x02 U0.8 */ |
2784 |
+@@ -140,10 +140,10 @@ struct iram_table_v_2 { |
2785 |
+ |
2786 |
+ /* For reading PSR State directly from IRAM */ |
2787 |
+ uint8_t psr_state; /* 0xf0 */ |
2788 |
+- uint8_t dmcu_mcp_interface_version; /* 0xf1 */ |
2789 |
+- uint8_t dmcu_abm_feature_version; /* 0xf2 */ |
2790 |
+- uint8_t dmcu_psr_feature_version; /* 0xf3 */ |
2791 |
+- uint16_t dmcu_version; /* 0xf4 */ |
2792 |
++ uint8_t dmcu_mcp_interface_version; /* 0xf1 */ |
2793 |
++ uint8_t dmcu_abm_feature_version; /* 0xf2 */ |
2794 |
++ uint8_t dmcu_psr_feature_version; /* 0xf3 */ |
2795 |
++ uint16_t dmcu_version; /* 0xf4 */ |
2796 |
+ uint8_t dmcu_state; /* 0xf6 */ |
2797 |
+ |
2798 |
+ uint16_t blRampReduction; /* 0xf7 */ |
2799 |
+@@ -164,42 +164,43 @@ struct iram_table_v_2_2 { |
2800 |
+ uint8_t max_reduction[NUM_AMBI_LEVEL][NUM_AGGR_LEVEL]; /* 0x16 U0.8 */ |
2801 |
+ uint8_t bright_pos_gain[NUM_AMBI_LEVEL][NUM_AGGR_LEVEL]; /* 0x2a U2.6 */ |
2802 |
+ uint8_t dark_pos_gain[NUM_AMBI_LEVEL][NUM_AGGR_LEVEL]; /* 0x3e U2.6 */ |
2803 |
+- uint8_t hybrid_factor[NUM_AGGR_LEVEL]; /* 0x52 U0.8 */ |
2804 |
+- uint8_t contrast_factor[NUM_AGGR_LEVEL]; /* 0x56 U0.8 */ |
2805 |
+- uint8_t deviation_gain[NUM_AGGR_LEVEL]; /* 0x5a U0.8 */ |
2806 |
+- uint8_t iir_curve[NUM_AMBI_LEVEL]; /* 0x5e U0.8 */ |
2807 |
+- uint8_t min_knee[NUM_AGGR_LEVEL]; /* 0x63 U0.8 */ |
2808 |
+- uint8_t max_knee[NUM_AGGR_LEVEL]; /* 0x67 U0.8 */ |
2809 |
+- uint8_t pad[21]; /* 0x6b U0.8 */ |
2810 |
++ uint8_t hybrid_factor[NUM_AGGR_LEVEL]; /* 0x52 U0.8 */ |
2811 |
++ uint8_t contrast_factor[NUM_AGGR_LEVEL]; /* 0x56 U0.8 */ |
2812 |
++ uint8_t deviation_gain[NUM_AGGR_LEVEL]; /* 0x5a U0.8 */ |
2813 |
++ uint8_t iir_curve[NUM_AMBI_LEVEL]; /* 0x5e U0.8 */ |
2814 |
++ uint8_t min_knee[NUM_AGGR_LEVEL]; /* 0x63 U0.8 */ |
2815 |
++ uint8_t max_knee[NUM_AGGR_LEVEL]; /* 0x67 U0.8 */ |
2816 |
++ uint16_t min_abm_backlight; /* 0x6b U16 */ |
2817 |
++ uint8_t pad[19]; /* 0x6d U0.8 */ |
2818 |
+ |
2819 |
+ /* parameters for crgb conversion */ |
2820 |
+- uint16_t crgb_thresh[NUM_POWER_FN_SEGS]; /* 0x80 U3.13 */ |
2821 |
+- uint16_t crgb_offset[NUM_POWER_FN_SEGS]; /* 0x90 U1.15 */ |
2822 |
+- uint16_t crgb_slope[NUM_POWER_FN_SEGS]; /* 0xa0 U4.12 */ |
2823 |
++ uint16_t crgb_thresh[NUM_POWER_FN_SEGS]; /* 0x80 U3.13 */ |
2824 |
++ uint16_t crgb_offset[NUM_POWER_FN_SEGS]; /* 0x90 U1.15 */ |
2825 |
++ uint16_t crgb_slope[NUM_POWER_FN_SEGS]; /* 0xa0 U4.12 */ |
2826 |
+ |
2827 |
+ /* parameters for custom curve */ |
2828 |
+ /* thresholds for brightness --> backlight */ |
2829 |
+- uint16_t backlight_thresholds[NUM_BL_CURVE_SEGS]; /* 0xb0 U16.0 */ |
2830 |
++ uint16_t backlight_thresholds[NUM_BL_CURVE_SEGS]; /* 0xb0 U16.0 */ |
2831 |
+ /* offsets for brightness --> backlight */ |
2832 |
+- uint16_t backlight_offsets[NUM_BL_CURVE_SEGS]; /* 0xd0 U16.0 */ |
2833 |
++ uint16_t backlight_offsets[NUM_BL_CURVE_SEGS]; /* 0xd0 U16.0 */ |
2834 |
+ |
2835 |
+ /* For reading PSR State directly from IRAM */ |
2836 |
+- uint8_t psr_state; /* 0xf0 */ |
2837 |
+- uint8_t dmcu_mcp_interface_version; /* 0xf1 */ |
2838 |
+- uint8_t dmcu_abm_feature_version; /* 0xf2 */ |
2839 |
+- uint8_t dmcu_psr_feature_version; /* 0xf3 */ |
2840 |
+- uint16_t dmcu_version; /* 0xf4 */ |
2841 |
+- uint8_t dmcu_state; /* 0xf6 */ |
2842 |
+- |
2843 |
+- uint8_t dummy1; /* 0xf7 */ |
2844 |
+- uint8_t dummy2; /* 0xf8 */ |
2845 |
+- uint8_t dummy3; /* 0xf9 */ |
2846 |
+- uint8_t dummy4; /* 0xfa */ |
2847 |
+- uint8_t dummy5; /* 0xfb */ |
2848 |
+- uint8_t dummy6; /* 0xfc */ |
2849 |
+- uint8_t dummy7; /* 0xfd */ |
2850 |
+- uint8_t dummy8; /* 0xfe */ |
2851 |
+- uint8_t dummy9; /* 0xff */ |
2852 |
++ uint8_t psr_state; /* 0xf0 */ |
2853 |
++ uint8_t dmcu_mcp_interface_version; /* 0xf1 */ |
2854 |
++ uint8_t dmcu_abm_feature_version; /* 0xf2 */ |
2855 |
++ uint8_t dmcu_psr_feature_version; /* 0xf3 */ |
2856 |
++ uint16_t dmcu_version; /* 0xf4 */ |
2857 |
++ uint8_t dmcu_state; /* 0xf6 */ |
2858 |
++ |
2859 |
++ uint8_t dummy1; /* 0xf7 */ |
2860 |
++ uint8_t dummy2; /* 0xf8 */ |
2861 |
++ uint8_t dummy3; /* 0xf9 */ |
2862 |
++ uint8_t dummy4; /* 0xfa */ |
2863 |
++ uint8_t dummy5; /* 0xfb */ |
2864 |
++ uint8_t dummy6; /* 0xfc */ |
2865 |
++ uint8_t dummy7; /* 0xfd */ |
2866 |
++ uint8_t dummy8; /* 0xfe */ |
2867 |
++ uint8_t dummy9; /* 0xff */ |
2868 |
+ }; |
2869 |
+ #pragma pack(pop) |
2870 |
+ |
2871 |
+@@ -271,7 +272,8 @@ void fill_iram_v_2(struct iram_table_v_2 *ram_table, struct dmcu_iram_parameters |
2872 |
+ { |
2873 |
+ unsigned int set = params.set; |
2874 |
+ |
2875 |
+- ram_table->flags = 0x0; |
2876 |
++ ram_table->min_abm_backlight = |
2877 |
++ cpu_to_be16(params.min_abm_backlight); |
2878 |
+ ram_table->deviation_gain = 0xb3; |
2879 |
+ |
2880 |
+ ram_table->blRampReduction = |
2881 |
+@@ -445,6 +447,9 @@ void fill_iram_v_2_2(struct iram_table_v_2_2 *ram_table, struct dmcu_iram_parame |
2882 |
+ |
2883 |
+ ram_table->flags = 0x0; |
2884 |
+ |
2885 |
++ ram_table->min_abm_backlight = |
2886 |
++ cpu_to_be16(params.min_abm_backlight); |
2887 |
++ |
2888 |
+ ram_table->deviation_gain[0] = 0xb3; |
2889 |
+ ram_table->deviation_gain[1] = 0xa8; |
2890 |
+ ram_table->deviation_gain[2] = 0x98; |
2891 |
+@@ -588,6 +593,10 @@ void fill_iram_v_2_3(struct iram_table_v_2_2 *ram_table, struct dmcu_iram_parame |
2892 |
+ unsigned int set = params.set; |
2893 |
+ |
2894 |
+ ram_table->flags = 0x0; |
2895 |
++ |
2896 |
++ ram_table->min_abm_backlight = |
2897 |
++ cpu_to_be16(params.min_abm_backlight); |
2898 |
++ |
2899 |
+ for (i = 0; i < NUM_AGGR_LEVEL; i++) { |
2900 |
+ ram_table->hybrid_factor[i] = abm_settings[set][i].brightness_gain; |
2901 |
+ ram_table->contrast_factor[i] = abm_settings[set][i].contrast_factor; |
2902 |
+diff --git a/drivers/gpu/drm/amd/display/modules/power/power_helpers.h b/drivers/gpu/drm/amd/display/modules/power/power_helpers.h |
2903 |
+index da5df00fedce..e54157026330 100644 |
2904 |
+--- a/drivers/gpu/drm/amd/display/modules/power/power_helpers.h |
2905 |
++++ b/drivers/gpu/drm/amd/display/modules/power/power_helpers.h |
2906 |
+@@ -38,6 +38,7 @@ struct dmcu_iram_parameters { |
2907 |
+ unsigned int backlight_lut_array_size; |
2908 |
+ unsigned int backlight_ramping_reduction; |
2909 |
+ unsigned int backlight_ramping_start; |
2910 |
++ unsigned int min_abm_backlight; |
2911 |
+ unsigned int set; |
2912 |
+ }; |
2913 |
+ |
2914 |
+diff --git a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c |
2915 |
+index 4acf139ea014..58c091ab67b2 100644 |
2916 |
+--- a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c |
2917 |
++++ b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c |
2918 |
+@@ -1344,7 +1344,10 @@ static int smu_suspend(void *handle) |
2919 |
+ int ret; |
2920 |
+ struct amdgpu_device *adev = (struct amdgpu_device *)handle; |
2921 |
+ struct smu_context *smu = &adev->smu; |
2922 |
+- bool baco_feature_is_enabled = smu_feature_is_enabled(smu, SMU_FEATURE_BACO_BIT); |
2923 |
++ bool baco_feature_is_enabled = false; |
2924 |
++ |
2925 |
++ if(!(adev->flags & AMD_IS_APU)) |
2926 |
++ baco_feature_is_enabled = smu_feature_is_enabled(smu, SMU_FEATURE_BACO_BIT); |
2927 |
+ |
2928 |
+ ret = smu_system_features_control(smu, false); |
2929 |
+ if (ret) |
2930 |
+diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_baco.c b/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_baco.c |
2931 |
+index df6ff9252401..b068d1c7b44d 100644 |
2932 |
+--- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_baco.c |
2933 |
++++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_baco.c |
2934 |
+@@ -29,7 +29,7 @@ |
2935 |
+ #include "vega20_baco.h" |
2936 |
+ #include "vega20_smumgr.h" |
2937 |
+ |
2938 |
+- |
2939 |
++#include "amdgpu_ras.h" |
2940 |
+ |
2941 |
+ static const struct soc15_baco_cmd_entry clean_baco_tbl[] = |
2942 |
+ { |
2943 |
+@@ -74,6 +74,7 @@ int vega20_baco_get_state(struct pp_hwmgr *hwmgr, enum BACO_STATE *state) |
2944 |
+ int vega20_baco_set_state(struct pp_hwmgr *hwmgr, enum BACO_STATE state) |
2945 |
+ { |
2946 |
+ struct amdgpu_device *adev = (struct amdgpu_device *)(hwmgr->adev); |
2947 |
++ struct amdgpu_ras *ras = amdgpu_ras_get_context(adev); |
2948 |
+ enum BACO_STATE cur_state; |
2949 |
+ uint32_t data; |
2950 |
+ |
2951 |
+@@ -84,10 +85,11 @@ int vega20_baco_set_state(struct pp_hwmgr *hwmgr, enum BACO_STATE state) |
2952 |
+ return 0; |
2953 |
+ |
2954 |
+ if (state == BACO_STATE_IN) { |
2955 |
+- data = RREG32_SOC15(THM, 0, mmTHM_BACO_CNTL); |
2956 |
+- data |= 0x80000000; |
2957 |
+- WREG32_SOC15(THM, 0, mmTHM_BACO_CNTL, data); |
2958 |
+- |
2959 |
++ if (!ras || !ras->supported) { |
2960 |
++ data = RREG32_SOC15(THM, 0, mmTHM_BACO_CNTL); |
2961 |
++ data |= 0x80000000; |
2962 |
++ WREG32_SOC15(THM, 0, mmTHM_BACO_CNTL, data); |
2963 |
++ } |
2964 |
+ |
2965 |
+ if(smum_send_msg_to_smc_with_parameter(hwmgr, PPSMC_MSG_EnterBaco, 0)) |
2966 |
+ return -EINVAL; |
2967 |
+diff --git a/drivers/gpu/drm/amd/powerplay/renoir_ppt.c b/drivers/gpu/drm/amd/powerplay/renoir_ppt.c |
2968 |
+index e62bfba51562..e5283dafc414 100644 |
2969 |
+--- a/drivers/gpu/drm/amd/powerplay/renoir_ppt.c |
2970 |
++++ b/drivers/gpu/drm/amd/powerplay/renoir_ppt.c |
2971 |
+@@ -183,11 +183,13 @@ static int renoir_print_clk_levels(struct smu_context *smu, |
2972 |
+ int i, size = 0, ret = 0; |
2973 |
+ uint32_t cur_value = 0, value = 0, count = 0, min = 0, max = 0; |
2974 |
+ DpmClocks_t *clk_table = smu->smu_table.clocks_table; |
2975 |
+- SmuMetrics_t metrics = {0}; |
2976 |
++ SmuMetrics_t metrics; |
2977 |
+ |
2978 |
+ if (!clk_table || clk_type >= SMU_CLK_COUNT) |
2979 |
+ return -EINVAL; |
2980 |
+ |
2981 |
++ memset(&metrics, 0, sizeof(metrics)); |
2982 |
++ |
2983 |
+ ret = smu_update_table(smu, SMU_TABLE_SMU_METRICS, 0, |
2984 |
+ (void *)&metrics, false); |
2985 |
+ if (ret) |
2986 |
+diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c b/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c |
2987 |
+index 624d257da20f..52c42569a111 100644 |
2988 |
+--- a/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c |
2989 |
++++ b/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c |
2990 |
+@@ -250,6 +250,7 @@ komeda_crtc_atomic_enable(struct drm_crtc *crtc, |
2991 |
+ { |
2992 |
+ komeda_crtc_prepare(to_kcrtc(crtc)); |
2993 |
+ drm_crtc_vblank_on(crtc); |
2994 |
++ WARN_ON(drm_crtc_vblank_get(crtc)); |
2995 |
+ komeda_crtc_do_flush(crtc, old); |
2996 |
+ } |
2997 |
+ |
2998 |
+@@ -319,6 +320,7 @@ komeda_crtc_atomic_disable(struct drm_crtc *crtc, |
2999 |
+ } |
3000 |
+ } |
3001 |
+ |
3002 |
++ drm_crtc_vblank_put(crtc); |
3003 |
+ drm_crtc_vblank_off(crtc); |
3004 |
+ komeda_crtc_unprepare(kcrtc); |
3005 |
+ } |
3006 |
+diff --git a/drivers/gpu/drm/bridge/analogix-anx78xx.c b/drivers/gpu/drm/bridge/analogix-anx78xx.c |
3007 |
+index 3c7cc5af735c..56df07cdab68 100644 |
3008 |
+--- a/drivers/gpu/drm/bridge/analogix-anx78xx.c |
3009 |
++++ b/drivers/gpu/drm/bridge/analogix-anx78xx.c |
3010 |
+@@ -715,7 +715,9 @@ static int anx78xx_init_pdata(struct anx78xx *anx78xx) |
3011 |
+ /* 1.0V digital core power regulator */ |
3012 |
+ pdata->dvdd10 = devm_regulator_get(dev, "dvdd10"); |
3013 |
+ if (IS_ERR(pdata->dvdd10)) { |
3014 |
+- DRM_ERROR("DVDD10 regulator not found\n"); |
3015 |
++ if (PTR_ERR(pdata->dvdd10) != -EPROBE_DEFER) |
3016 |
++ DRM_ERROR("DVDD10 regulator not found\n"); |
3017 |
++ |
3018 |
+ return PTR_ERR(pdata->dvdd10); |
3019 |
+ } |
3020 |
+ |
3021 |
+@@ -1332,7 +1334,9 @@ static int anx78xx_i2c_probe(struct i2c_client *client, |
3022 |
+ |
3023 |
+ err = anx78xx_init_pdata(anx78xx); |
3024 |
+ if (err) { |
3025 |
+- DRM_ERROR("Failed to initialize pdata: %d\n", err); |
3026 |
++ if (err != -EPROBE_DEFER) |
3027 |
++ DRM_ERROR("Failed to initialize pdata: %d\n", err); |
3028 |
++ |
3029 |
+ return err; |
3030 |
+ } |
3031 |
+ |
3032 |
+diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c |
3033 |
+index 521d689413c8..1326f2c734bf 100644 |
3034 |
+--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c |
3035 |
++++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c |
3036 |
+@@ -36,6 +36,7 @@ |
3037 |
+ #include "dw-hdmi-cec.h" |
3038 |
+ #include "dw-hdmi.h" |
3039 |
+ |
3040 |
++#define DDC_CI_ADDR 0x37 |
3041 |
+ #define DDC_SEGMENT_ADDR 0x30 |
3042 |
+ |
3043 |
+ #define HDMI_EDID_LEN 512 |
3044 |
+@@ -398,6 +399,15 @@ static int dw_hdmi_i2c_xfer(struct i2c_adapter *adap, |
3045 |
+ u8 addr = msgs[0].addr; |
3046 |
+ int i, ret = 0; |
3047 |
+ |
3048 |
++ if (addr == DDC_CI_ADDR) |
3049 |
++ /* |
3050 |
++ * The internal I2C controller does not support the multi-byte |
3051 |
++ * read and write operations needed for DDC/CI. |
3052 |
++ * TOFIX: Blacklist the DDC/CI address until we filter out |
3053 |
++ * unsupported I2C operations. |
3054 |
++ */ |
3055 |
++ return -EOPNOTSUPP; |
3056 |
++ |
3057 |
+ dev_dbg(hdmi->dev, "xfer: num: %d, addr: %#x\n", num, addr); |
3058 |
+ |
3059 |
+ for (i = 0; i < num; i++) { |
3060 |
+@@ -2023,7 +2033,7 @@ static int dw_hdmi_setup(struct dw_hdmi *hdmi, struct drm_display_mode *mode) |
3061 |
+ |
3062 |
+ /* HDMI Initialization Step E - Configure audio */ |
3063 |
+ hdmi_clk_regenerator_update_pixel_clock(hdmi); |
3064 |
+- hdmi_enable_audio_clk(hdmi, true); |
3065 |
++ hdmi_enable_audio_clk(hdmi, hdmi->audio_enable); |
3066 |
+ } |
3067 |
+ |
3068 |
+ /* not for DVI mode */ |
3069 |
+diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c |
3070 |
+index 6b0177112e18..3f50b8865db4 100644 |
3071 |
+--- a/drivers/gpu/drm/drm_edid.c |
3072 |
++++ b/drivers/gpu/drm/drm_edid.c |
3073 |
+@@ -3722,7 +3722,7 @@ cea_db_offsets(const u8 *cea, int *start, int *end) |
3074 |
+ if (*end < 4 || *end > 127) |
3075 |
+ return -ERANGE; |
3076 |
+ } else { |
3077 |
+- return -ENOTSUPP; |
3078 |
++ return -EOPNOTSUPP; |
3079 |
+ } |
3080 |
+ |
3081 |
+ return 0; |
3082 |
+@@ -4191,7 +4191,7 @@ int drm_edid_to_sad(struct edid *edid, struct cea_sad **sads) |
3083 |
+ |
3084 |
+ if (cea_revision(cea) < 3) { |
3085 |
+ DRM_DEBUG_KMS("SAD: wrong CEA revision\n"); |
3086 |
+- return -ENOTSUPP; |
3087 |
++ return -EOPNOTSUPP; |
3088 |
+ } |
3089 |
+ |
3090 |
+ if (cea_db_offsets(cea, &start, &end)) { |
3091 |
+@@ -4252,7 +4252,7 @@ int drm_edid_to_speaker_allocation(struct edid *edid, u8 **sadb) |
3092 |
+ |
3093 |
+ if (cea_revision(cea) < 3) { |
3094 |
+ DRM_DEBUG_KMS("SAD: wrong CEA revision\n"); |
3095 |
+- return -ENOTSUPP; |
3096 |
++ return -EOPNOTSUPP; |
3097 |
+ } |
3098 |
+ |
3099 |
+ if (cea_db_offsets(cea, &start, &end)) { |
3100 |
+diff --git a/drivers/gpu/drm/drm_mipi_dbi.c b/drivers/gpu/drm/drm_mipi_dbi.c |
3101 |
+index 1961f713aaab..f8154316a3b0 100644 |
3102 |
+--- a/drivers/gpu/drm/drm_mipi_dbi.c |
3103 |
++++ b/drivers/gpu/drm/drm_mipi_dbi.c |
3104 |
+@@ -955,7 +955,7 @@ static int mipi_dbi_typec1_command(struct mipi_dbi *dbi, u8 *cmd, |
3105 |
+ int ret; |
3106 |
+ |
3107 |
+ if (mipi_dbi_command_is_read(dbi, *cmd)) |
3108 |
+- return -ENOTSUPP; |
3109 |
++ return -EOPNOTSUPP; |
3110 |
+ |
3111 |
+ MIPI_DBI_DEBUG_COMMAND(*cmd, parameters, num); |
3112 |
+ |
3113 |
+@@ -1187,8 +1187,7 @@ static ssize_t mipi_dbi_debugfs_command_write(struct file *file, |
3114 |
+ struct mipi_dbi_dev *dbidev = m->private; |
3115 |
+ u8 val, cmd = 0, parameters[64]; |
3116 |
+ char *buf, *pos, *token; |
3117 |
+- unsigned int i; |
3118 |
+- int ret, idx; |
3119 |
++ int i, ret, idx; |
3120 |
+ |
3121 |
+ if (!drm_dev_enter(&dbidev->drm, &idx)) |
3122 |
+ return -ENODEV; |
3123 |
+diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c |
3124 |
+index fd1fbc77871f..552ec82e9bc5 100644 |
3125 |
+--- a/drivers/gpu/drm/drm_vblank.c |
3126 |
++++ b/drivers/gpu/drm/drm_vblank.c |
3127 |
+@@ -1581,7 +1581,7 @@ int drm_wait_vblank_ioctl(struct drm_device *dev, void *data, |
3128 |
+ unsigned int flags, pipe, high_pipe; |
3129 |
+ |
3130 |
+ if (!dev->irq_enabled) |
3131 |
+- return -EINVAL; |
3132 |
++ return -EOPNOTSUPP; |
3133 |
+ |
3134 |
+ if (vblwait->request.type & _DRM_VBLANK_SIGNAL) |
3135 |
+ return -EINVAL; |
3136 |
+@@ -1838,7 +1838,7 @@ int drm_crtc_get_sequence_ioctl(struct drm_device *dev, void *data, |
3137 |
+ return -EOPNOTSUPP; |
3138 |
+ |
3139 |
+ if (!dev->irq_enabled) |
3140 |
+- return -EINVAL; |
3141 |
++ return -EOPNOTSUPP; |
3142 |
+ |
3143 |
+ crtc = drm_crtc_find(dev, file_priv, get_seq->crtc_id); |
3144 |
+ if (!crtc) |
3145 |
+@@ -1896,7 +1896,7 @@ int drm_crtc_queue_sequence_ioctl(struct drm_device *dev, void *data, |
3146 |
+ return -EOPNOTSUPP; |
3147 |
+ |
3148 |
+ if (!dev->irq_enabled) |
3149 |
+- return -EINVAL; |
3150 |
++ return -EOPNOTSUPP; |
3151 |
+ |
3152 |
+ crtc = drm_crtc_find(dev, file_priv, queue_seq->crtc_id); |
3153 |
+ if (!crtc) |
3154 |
+diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c |
3155 |
+index bc1565f1822a..09aa73c0f2ad 100644 |
3156 |
+--- a/drivers/gpu/drm/exynos/exynos_hdmi.c |
3157 |
++++ b/drivers/gpu/drm/exynos/exynos_hdmi.c |
3158 |
+@@ -852,6 +852,10 @@ static enum drm_connector_status hdmi_detect(struct drm_connector *connector, |
3159 |
+ |
3160 |
+ static void hdmi_connector_destroy(struct drm_connector *connector) |
3161 |
+ { |
3162 |
++ struct hdmi_context *hdata = connector_to_hdmi(connector); |
3163 |
++ |
3164 |
++ cec_notifier_conn_unregister(hdata->notifier); |
3165 |
++ |
3166 |
+ drm_connector_unregister(connector); |
3167 |
+ drm_connector_cleanup(connector); |
3168 |
+ } |
3169 |
+@@ -935,6 +939,7 @@ static int hdmi_create_connector(struct drm_encoder *encoder) |
3170 |
+ { |
3171 |
+ struct hdmi_context *hdata = encoder_to_hdmi(encoder); |
3172 |
+ struct drm_connector *connector = &hdata->connector; |
3173 |
++ struct cec_connector_info conn_info; |
3174 |
+ int ret; |
3175 |
+ |
3176 |
+ connector->interlace_allowed = true; |
3177 |
+@@ -957,6 +962,15 @@ static int hdmi_create_connector(struct drm_encoder *encoder) |
3178 |
+ DRM_DEV_ERROR(hdata->dev, "Failed to attach bridge\n"); |
3179 |
+ } |
3180 |
+ |
3181 |
++ cec_fill_conn_info_from_drm(&conn_info, connector); |
3182 |
++ |
3183 |
++ hdata->notifier = cec_notifier_conn_register(hdata->dev, NULL, |
3184 |
++ &conn_info); |
3185 |
++ if (!hdata->notifier) { |
3186 |
++ ret = -ENOMEM; |
3187 |
++ DRM_DEV_ERROR(hdata->dev, "Failed to allocate CEC notifier\n"); |
3188 |
++ } |
3189 |
++ |
3190 |
+ return ret; |
3191 |
+ } |
3192 |
+ |
3193 |
+@@ -1528,8 +1542,8 @@ static void hdmi_disable(struct drm_encoder *encoder) |
3194 |
+ */ |
3195 |
+ mutex_unlock(&hdata->mutex); |
3196 |
+ cancel_delayed_work(&hdata->hotplug_work); |
3197 |
+- cec_notifier_set_phys_addr(hdata->notifier, |
3198 |
+- CEC_PHYS_ADDR_INVALID); |
3199 |
++ if (hdata->notifier) |
3200 |
++ cec_notifier_phys_addr_invalidate(hdata->notifier); |
3201 |
+ return; |
3202 |
+ } |
3203 |
+ |
3204 |
+@@ -2006,12 +2020,6 @@ static int hdmi_probe(struct platform_device *pdev) |
3205 |
+ } |
3206 |
+ } |
3207 |
+ |
3208 |
+- hdata->notifier = cec_notifier_get(&pdev->dev); |
3209 |
+- if (hdata->notifier == NULL) { |
3210 |
+- ret = -ENOMEM; |
3211 |
+- goto err_hdmiphy; |
3212 |
+- } |
3213 |
+- |
3214 |
+ pm_runtime_enable(dev); |
3215 |
+ |
3216 |
+ audio_infoframe = &hdata->audio.infoframe; |
3217 |
+@@ -2023,7 +2031,7 @@ static int hdmi_probe(struct platform_device *pdev) |
3218 |
+ |
3219 |
+ ret = hdmi_register_audio_device(hdata); |
3220 |
+ if (ret) |
3221 |
+- goto err_notifier_put; |
3222 |
++ goto err_rpm_disable; |
3223 |
+ |
3224 |
+ ret = component_add(&pdev->dev, &hdmi_component_ops); |
3225 |
+ if (ret) |
3226 |
+@@ -2034,8 +2042,7 @@ static int hdmi_probe(struct platform_device *pdev) |
3227 |
+ err_unregister_audio: |
3228 |
+ platform_device_unregister(hdata->audio.pdev); |
3229 |
+ |
3230 |
+-err_notifier_put: |
3231 |
+- cec_notifier_put(hdata->notifier); |
3232 |
++err_rpm_disable: |
3233 |
+ pm_runtime_disable(dev); |
3234 |
+ |
3235 |
+ err_hdmiphy: |
3236 |
+@@ -2054,12 +2061,10 @@ static int hdmi_remove(struct platform_device *pdev) |
3237 |
+ struct hdmi_context *hdata = platform_get_drvdata(pdev); |
3238 |
+ |
3239 |
+ cancel_delayed_work_sync(&hdata->hotplug_work); |
3240 |
+- cec_notifier_set_phys_addr(hdata->notifier, CEC_PHYS_ADDR_INVALID); |
3241 |
+ |
3242 |
+ component_del(&pdev->dev, &hdmi_component_ops); |
3243 |
+ platform_device_unregister(hdata->audio.pdev); |
3244 |
+ |
3245 |
+- cec_notifier_put(hdata->notifier); |
3246 |
+ pm_runtime_disable(&pdev->dev); |
3247 |
+ |
3248 |
+ if (!IS_ERR(hdata->reg_hdmi_en)) |
3249 |
+diff --git a/drivers/gpu/drm/gma500/oaktrail_crtc.c b/drivers/gpu/drm/gma500/oaktrail_crtc.c |
3250 |
+index 167c10767dd4..900e5499249d 100644 |
3251 |
+--- a/drivers/gpu/drm/gma500/oaktrail_crtc.c |
3252 |
++++ b/drivers/gpu/drm/gma500/oaktrail_crtc.c |
3253 |
+@@ -129,6 +129,7 @@ static bool mrst_sdvo_find_best_pll(const struct gma_limit_t *limit, |
3254 |
+ s32 freq_error, min_error = 100000; |
3255 |
+ |
3256 |
+ memset(best_clock, 0, sizeof(*best_clock)); |
3257 |
++ memset(&clock, 0, sizeof(clock)); |
3258 |
+ |
3259 |
+ for (clock.m = limit->m.min; clock.m <= limit->m.max; clock.m++) { |
3260 |
+ for (clock.n = limit->n.min; clock.n <= limit->n.max; |
3261 |
+@@ -185,6 +186,7 @@ static bool mrst_lvds_find_best_pll(const struct gma_limit_t *limit, |
3262 |
+ int err = target; |
3263 |
+ |
3264 |
+ memset(best_clock, 0, sizeof(*best_clock)); |
3265 |
++ memset(&clock, 0, sizeof(clock)); |
3266 |
+ |
3267 |
+ for (clock.m = limit->m.min; clock.m <= limit->m.max; clock.m++) { |
3268 |
+ for (clock.p1 = limit->p1.min; clock.p1 <= limit->p1.max; |
3269 |
+diff --git a/drivers/gpu/drm/meson/meson_vclk.c b/drivers/gpu/drm/meson/meson_vclk.c |
3270 |
+index ac491a781952..f690793ae2d5 100644 |
3271 |
+--- a/drivers/gpu/drm/meson/meson_vclk.c |
3272 |
++++ b/drivers/gpu/drm/meson/meson_vclk.c |
3273 |
+@@ -638,13 +638,18 @@ static bool meson_hdmi_pll_validate_params(struct meson_drm *priv, |
3274 |
+ if (frac >= HDMI_FRAC_MAX_GXBB) |
3275 |
+ return false; |
3276 |
+ } else if (meson_vpu_is_compatible(priv, VPU_COMPATIBLE_GXM) || |
3277 |
+- meson_vpu_is_compatible(priv, VPU_COMPATIBLE_GXL) || |
3278 |
+- meson_vpu_is_compatible(priv, VPU_COMPATIBLE_G12A)) { |
3279 |
++ meson_vpu_is_compatible(priv, VPU_COMPATIBLE_GXL)) { |
3280 |
+ /* Empiric supported min/max dividers */ |
3281 |
+ if (m < 106 || m > 247) |
3282 |
+ return false; |
3283 |
+ if (frac >= HDMI_FRAC_MAX_GXL) |
3284 |
+ return false; |
3285 |
++ } else if (meson_vpu_is_compatible(priv, VPU_COMPATIBLE_G12A)) { |
3286 |
++ /* Empiric supported min/max dividers */ |
3287 |
++ if (m < 106 || m > 247) |
3288 |
++ return false; |
3289 |
++ if (frac >= HDMI_FRAC_MAX_G12A) |
3290 |
++ return false; |
3291 |
+ } |
3292 |
+ |
3293 |
+ return true; |
3294 |
+diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu_state.c b/drivers/gpu/drm/msm/adreno/a6xx_gpu_state.c |
3295 |
+index e686331fa089..691c1a277d91 100644 |
3296 |
+--- a/drivers/gpu/drm/msm/adreno/a6xx_gpu_state.c |
3297 |
++++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu_state.c |
3298 |
+@@ -352,26 +352,26 @@ static void a6xx_get_debugbus(struct msm_gpu *gpu, |
3299 |
+ cxdbg = ioremap(res->start, resource_size(res)); |
3300 |
+ |
3301 |
+ if (cxdbg) { |
3302 |
+- cxdbg_write(cxdbg, REG_A6XX_DBGC_CFG_DBGBUS_CNTLT, |
3303 |
++ cxdbg_write(cxdbg, REG_A6XX_CX_DBGC_CFG_DBGBUS_CNTLT, |
3304 |
+ A6XX_DBGC_CFG_DBGBUS_CNTLT_SEGT(0xf)); |
3305 |
+ |
3306 |
+- cxdbg_write(cxdbg, REG_A6XX_DBGC_CFG_DBGBUS_CNTLM, |
3307 |
++ cxdbg_write(cxdbg, REG_A6XX_CX_DBGC_CFG_DBGBUS_CNTLM, |
3308 |
+ A6XX_DBGC_CFG_DBGBUS_CNTLM_ENABLE(0xf)); |
3309 |
+ |
3310 |
+- cxdbg_write(cxdbg, REG_A6XX_DBGC_CFG_DBGBUS_IVTL_0, 0); |
3311 |
+- cxdbg_write(cxdbg, REG_A6XX_DBGC_CFG_DBGBUS_IVTL_1, 0); |
3312 |
+- cxdbg_write(cxdbg, REG_A6XX_DBGC_CFG_DBGBUS_IVTL_2, 0); |
3313 |
+- cxdbg_write(cxdbg, REG_A6XX_DBGC_CFG_DBGBUS_IVTL_3, 0); |
3314 |
++ cxdbg_write(cxdbg, REG_A6XX_CX_DBGC_CFG_DBGBUS_IVTL_0, 0); |
3315 |
++ cxdbg_write(cxdbg, REG_A6XX_CX_DBGC_CFG_DBGBUS_IVTL_1, 0); |
3316 |
++ cxdbg_write(cxdbg, REG_A6XX_CX_DBGC_CFG_DBGBUS_IVTL_2, 0); |
3317 |
++ cxdbg_write(cxdbg, REG_A6XX_CX_DBGC_CFG_DBGBUS_IVTL_3, 0); |
3318 |
+ |
3319 |
+- cxdbg_write(cxdbg, REG_A6XX_DBGC_CFG_DBGBUS_BYTEL_0, |
3320 |
++ cxdbg_write(cxdbg, REG_A6XX_CX_DBGC_CFG_DBGBUS_BYTEL_0, |
3321 |
+ 0x76543210); |
3322 |
+- cxdbg_write(cxdbg, REG_A6XX_DBGC_CFG_DBGBUS_BYTEL_1, |
3323 |
++ cxdbg_write(cxdbg, REG_A6XX_CX_DBGC_CFG_DBGBUS_BYTEL_1, |
3324 |
+ 0xFEDCBA98); |
3325 |
+ |
3326 |
+- cxdbg_write(cxdbg, REG_A6XX_DBGC_CFG_DBGBUS_MASKL_0, 0); |
3327 |
+- cxdbg_write(cxdbg, REG_A6XX_DBGC_CFG_DBGBUS_MASKL_1, 0); |
3328 |
+- cxdbg_write(cxdbg, REG_A6XX_DBGC_CFG_DBGBUS_MASKL_2, 0); |
3329 |
+- cxdbg_write(cxdbg, REG_A6XX_DBGC_CFG_DBGBUS_MASKL_3, 0); |
3330 |
++ cxdbg_write(cxdbg, REG_A6XX_CX_DBGC_CFG_DBGBUS_MASKL_0, 0); |
3331 |
++ cxdbg_write(cxdbg, REG_A6XX_CX_DBGC_CFG_DBGBUS_MASKL_1, 0); |
3332 |
++ cxdbg_write(cxdbg, REG_A6XX_CX_DBGC_CFG_DBGBUS_MASKL_2, 0); |
3333 |
++ cxdbg_write(cxdbg, REG_A6XX_CX_DBGC_CFG_DBGBUS_MASKL_3, 0); |
3334 |
+ } |
3335 |
+ |
3336 |
+ a6xx_state->debugbus = state_kcalloc(a6xx_state, |
3337 |
+diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.c b/drivers/gpu/drm/nouveau/nouveau_connector.c |
3338 |
+index 94dfa2e5a9ab..a442a955f98c 100644 |
3339 |
+--- a/drivers/gpu/drm/nouveau/nouveau_connector.c |
3340 |
++++ b/drivers/gpu/drm/nouveau/nouveau_connector.c |
3341 |
+@@ -1131,6 +1131,16 @@ nouveau_connector_hotplug(struct nvif_notify *notify) |
3342 |
+ const char *name = connector->name; |
3343 |
+ struct nouveau_encoder *nv_encoder; |
3344 |
+ int ret; |
3345 |
++ bool plugged = (rep->mask != NVIF_NOTIFY_CONN_V0_UNPLUG); |
3346 |
++ |
3347 |
++ if (rep->mask & NVIF_NOTIFY_CONN_V0_IRQ) { |
3348 |
++ NV_DEBUG(drm, "service %s\n", name); |
3349 |
++ drm_dp_cec_irq(&nv_connector->aux); |
3350 |
++ if ((nv_encoder = find_encoder(connector, DCB_OUTPUT_DP))) |
3351 |
++ nv50_mstm_service(nv_encoder->dp.mstm); |
3352 |
++ |
3353 |
++ return NVIF_NOTIFY_KEEP; |
3354 |
++ } |
3355 |
+ |
3356 |
+ ret = pm_runtime_get(drm->dev->dev); |
3357 |
+ if (ret == 0) { |
3358 |
+@@ -1151,25 +1161,16 @@ nouveau_connector_hotplug(struct nvif_notify *notify) |
3359 |
+ return NVIF_NOTIFY_DROP; |
3360 |
+ } |
3361 |
+ |
3362 |
+- if (rep->mask & NVIF_NOTIFY_CONN_V0_IRQ) { |
3363 |
+- NV_DEBUG(drm, "service %s\n", name); |
3364 |
+- drm_dp_cec_irq(&nv_connector->aux); |
3365 |
+- if ((nv_encoder = find_encoder(connector, DCB_OUTPUT_DP))) |
3366 |
+- nv50_mstm_service(nv_encoder->dp.mstm); |
3367 |
+- } else { |
3368 |
+- bool plugged = (rep->mask != NVIF_NOTIFY_CONN_V0_UNPLUG); |
3369 |
+- |
3370 |
++ if (!plugged) |
3371 |
++ drm_dp_cec_unset_edid(&nv_connector->aux); |
3372 |
++ NV_DEBUG(drm, "%splugged %s\n", plugged ? "" : "un", name); |
3373 |
++ if ((nv_encoder = find_encoder(connector, DCB_OUTPUT_DP))) { |
3374 |
+ if (!plugged) |
3375 |
+- drm_dp_cec_unset_edid(&nv_connector->aux); |
3376 |
+- NV_DEBUG(drm, "%splugged %s\n", plugged ? "" : "un", name); |
3377 |
+- if ((nv_encoder = find_encoder(connector, DCB_OUTPUT_DP))) { |
3378 |
+- if (!plugged) |
3379 |
+- nv50_mstm_remove(nv_encoder->dp.mstm); |
3380 |
+- } |
3381 |
+- |
3382 |
+- drm_helper_hpd_irq_event(connector->dev); |
3383 |
++ nv50_mstm_remove(nv_encoder->dp.mstm); |
3384 |
+ } |
3385 |
+ |
3386 |
++ drm_helper_hpd_irq_event(connector->dev); |
3387 |
++ |
3388 |
+ pm_runtime_mark_last_busy(drm->dev->dev); |
3389 |
+ pm_runtime_put_autosuspend(drm->dev->dev); |
3390 |
+ return NVIF_NOTIFY_KEEP; |
3391 |
+diff --git a/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c b/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c |
3392 |
+index b5b14aa059ea..2aa89eaecf6f 100644 |
3393 |
+--- a/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c |
3394 |
++++ b/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c |
3395 |
+@@ -426,6 +426,7 @@ static int rpi_touchscreen_probe(struct i2c_client *i2c, |
3396 |
+ return PTR_ERR(ts->dsi); |
3397 |
+ } |
3398 |
+ |
3399 |
++ drm_panel_init(&ts->base); |
3400 |
+ ts->base.dev = dev; |
3401 |
+ ts->base.funcs = &rpi_touchscreen_funcs; |
3402 |
+ |
3403 |
+diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7789v.c b/drivers/gpu/drm/panel/panel-sitronix-st7789v.c |
3404 |
+index 5e3e92ea9ea6..3b2612ae931e 100644 |
3405 |
+--- a/drivers/gpu/drm/panel/panel-sitronix-st7789v.c |
3406 |
++++ b/drivers/gpu/drm/panel/panel-sitronix-st7789v.c |
3407 |
+@@ -381,6 +381,7 @@ static int st7789v_probe(struct spi_device *spi) |
3408 |
+ spi_set_drvdata(spi, ctx); |
3409 |
+ ctx->spi = spi; |
3410 |
+ |
3411 |
++ drm_panel_init(&ctx->panel); |
3412 |
+ ctx->panel.dev = &spi->dev; |
3413 |
+ ctx->panel.funcs = &st7789v_drm_funcs; |
3414 |
+ |
3415 |
+diff --git a/drivers/gpu/drm/scheduler/sched_main.c b/drivers/gpu/drm/scheduler/sched_main.c |
3416 |
+index f39b97ed4ade..2af64459b3d7 100644 |
3417 |
+--- a/drivers/gpu/drm/scheduler/sched_main.c |
3418 |
++++ b/drivers/gpu/drm/scheduler/sched_main.c |
3419 |
+@@ -632,43 +632,41 @@ static void drm_sched_process_job(struct dma_fence *f, struct dma_fence_cb *cb) |
3420 |
+ } |
3421 |
+ |
3422 |
+ /** |
3423 |
+- * drm_sched_cleanup_jobs - destroy finished jobs |
3424 |
++ * drm_sched_get_cleanup_job - fetch the next finished job to be destroyed |
3425 |
+ * |
3426 |
+ * @sched: scheduler instance |
3427 |
+ * |
3428 |
+- * Remove all finished jobs from the mirror list and destroy them. |
3429 |
++ * Returns the next finished job from the mirror list (if there is one) |
3430 |
++ * ready for it to be destroyed. |
3431 |
+ */ |
3432 |
+-static void drm_sched_cleanup_jobs(struct drm_gpu_scheduler *sched) |
3433 |
++static struct drm_sched_job * |
3434 |
++drm_sched_get_cleanup_job(struct drm_gpu_scheduler *sched) |
3435 |
+ { |
3436 |
++ struct drm_sched_job *job; |
3437 |
+ unsigned long flags; |
3438 |
+ |
3439 |
+ /* Don't destroy jobs while the timeout worker is running */ |
3440 |
+ if (sched->timeout != MAX_SCHEDULE_TIMEOUT && |
3441 |
+ !cancel_delayed_work(&sched->work_tdr)) |
3442 |
+- return; |
3443 |
+- |
3444 |
++ return NULL; |
3445 |
+ |
3446 |
+- while (!list_empty(&sched->ring_mirror_list)) { |
3447 |
+- struct drm_sched_job *job; |
3448 |
++ spin_lock_irqsave(&sched->job_list_lock, flags); |
3449 |
+ |
3450 |
+- job = list_first_entry(&sched->ring_mirror_list, |
3451 |
++ job = list_first_entry_or_null(&sched->ring_mirror_list, |
3452 |
+ struct drm_sched_job, node); |
3453 |
+- if (!dma_fence_is_signaled(&job->s_fence->finished)) |
3454 |
+- break; |
3455 |
+ |
3456 |
+- spin_lock_irqsave(&sched->job_list_lock, flags); |
3457 |
++ if (job && dma_fence_is_signaled(&job->s_fence->finished)) { |
3458 |
+ /* remove job from ring_mirror_list */ |
3459 |
+ list_del_init(&job->node); |
3460 |
+- spin_unlock_irqrestore(&sched->job_list_lock, flags); |
3461 |
+- |
3462 |
+- sched->ops->free_job(job); |
3463 |
++ } else { |
3464 |
++ job = NULL; |
3465 |
++ /* queue timeout for next job */ |
3466 |
++ drm_sched_start_timeout(sched); |
3467 |
+ } |
3468 |
+ |
3469 |
+- /* queue timeout for next job */ |
3470 |
+- spin_lock_irqsave(&sched->job_list_lock, flags); |
3471 |
+- drm_sched_start_timeout(sched); |
3472 |
+ spin_unlock_irqrestore(&sched->job_list_lock, flags); |
3473 |
+ |
3474 |
++ return job; |
3475 |
+ } |
3476 |
+ |
3477 |
+ /** |
3478 |
+@@ -708,12 +706,19 @@ static int drm_sched_main(void *param) |
3479 |
+ struct drm_sched_fence *s_fence; |
3480 |
+ struct drm_sched_job *sched_job; |
3481 |
+ struct dma_fence *fence; |
3482 |
++ struct drm_sched_job *cleanup_job = NULL; |
3483 |
+ |
3484 |
+ wait_event_interruptible(sched->wake_up_worker, |
3485 |
+- (drm_sched_cleanup_jobs(sched), |
3486 |
++ (cleanup_job = drm_sched_get_cleanup_job(sched)) || |
3487 |
+ (!drm_sched_blocked(sched) && |
3488 |
+ (entity = drm_sched_select_entity(sched))) || |
3489 |
+- kthread_should_stop())); |
3490 |
++ kthread_should_stop()); |
3491 |
++ |
3492 |
++ if (cleanup_job) { |
3493 |
++ sched->ops->free_job(cleanup_job); |
3494 |
++ /* queue timeout for next job */ |
3495 |
++ drm_sched_start_timeout(sched); |
3496 |
++ } |
3497 |
+ |
3498 |
+ if (!entity) |
3499 |
+ continue; |
3500 |
+diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c |
3501 |
+index 1636344ba9ec..f83522717488 100644 |
3502 |
+--- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c |
3503 |
++++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c |
3504 |
+@@ -437,9 +437,9 @@ static void sun6i_dsi_setup_burst(struct sun6i_dsi *dsi, |
3505 |
+ SUN6I_DSI_BURST_LINE_SYNC_POINT(SUN6I_DSI_SYNC_POINT)); |
3506 |
+ |
3507 |
+ val = SUN6I_DSI_TCON_DRQ_ENABLE_MODE; |
3508 |
+- } else if ((mode->hsync_end - mode->hdisplay) > 20) { |
3509 |
++ } else if ((mode->hsync_start - mode->hdisplay) > 20) { |
3510 |
+ /* Maaaaaagic */ |
3511 |
+- u16 drq = (mode->hsync_end - mode->hdisplay) - 20; |
3512 |
++ u16 drq = (mode->hsync_start - mode->hdisplay) - 20; |
3513 |
+ |
3514 |
+ drq *= mipi_dsi_pixel_format_to_bpp(device->format); |
3515 |
+ drq /= 32; |
3516 |
+diff --git a/drivers/gpu/drm/tegra/sor.c b/drivers/gpu/drm/tegra/sor.c |
3517 |
+index e1669ada0a40..75e65d9536d5 100644 |
3518 |
+--- a/drivers/gpu/drm/tegra/sor.c |
3519 |
++++ b/drivers/gpu/drm/tegra/sor.c |
3520 |
+@@ -3200,6 +3200,11 @@ static int tegra_sor_parse_dt(struct tegra_sor *sor) |
3521 |
+ * earlier |
3522 |
+ */ |
3523 |
+ sor->pad = TEGRA_IO_PAD_HDMI_DP0 + sor->index; |
3524 |
++ } else { |
3525 |
++ if (sor->soc->supports_edp) |
3526 |
++ sor->index = 0; |
3527 |
++ else |
3528 |
++ sor->index = 1; |
3529 |
+ } |
3530 |
+ |
3531 |
+ err = of_property_read_u32_array(np, "nvidia,xbar-cfg", xbar_cfg, 5); |
3532 |
+diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c |
3533 |
+index 98819462f025..f07803699809 100644 |
3534 |
+--- a/drivers/gpu/drm/ttm/ttm_bo.c |
3535 |
++++ b/drivers/gpu/drm/ttm/ttm_bo.c |
3536 |
+@@ -926,7 +926,8 @@ EXPORT_SYMBOL(ttm_bo_mem_put); |
3537 |
+ */ |
3538 |
+ static int ttm_bo_add_move_fence(struct ttm_buffer_object *bo, |
3539 |
+ struct ttm_mem_type_manager *man, |
3540 |
+- struct ttm_mem_reg *mem) |
3541 |
++ struct ttm_mem_reg *mem, |
3542 |
++ bool no_wait_gpu) |
3543 |
+ { |
3544 |
+ struct dma_fence *fence; |
3545 |
+ int ret; |
3546 |
+@@ -935,19 +936,22 @@ static int ttm_bo_add_move_fence(struct ttm_buffer_object *bo, |
3547 |
+ fence = dma_fence_get(man->move); |
3548 |
+ spin_unlock(&man->move_lock); |
3549 |
+ |
3550 |
+- if (fence) { |
3551 |
+- dma_resv_add_shared_fence(bo->base.resv, fence); |
3552 |
++ if (!fence) |
3553 |
++ return 0; |
3554 |
+ |
3555 |
+- ret = dma_resv_reserve_shared(bo->base.resv, 1); |
3556 |
+- if (unlikely(ret)) { |
3557 |
+- dma_fence_put(fence); |
3558 |
+- return ret; |
3559 |
+- } |
3560 |
++ if (no_wait_gpu) |
3561 |
++ return -EBUSY; |
3562 |
++ |
3563 |
++ dma_resv_add_shared_fence(bo->base.resv, fence); |
3564 |
+ |
3565 |
+- dma_fence_put(bo->moving); |
3566 |
+- bo->moving = fence; |
3567 |
++ ret = dma_resv_reserve_shared(bo->base.resv, 1); |
3568 |
++ if (unlikely(ret)) { |
3569 |
++ dma_fence_put(fence); |
3570 |
++ return ret; |
3571 |
+ } |
3572 |
+ |
3573 |
++ dma_fence_put(bo->moving); |
3574 |
++ bo->moving = fence; |
3575 |
+ return 0; |
3576 |
+ } |
3577 |
+ |
3578 |
+@@ -978,7 +982,7 @@ static int ttm_bo_mem_force_space(struct ttm_buffer_object *bo, |
3579 |
+ return ret; |
3580 |
+ } while (1); |
3581 |
+ |
3582 |
+- return ttm_bo_add_move_fence(bo, man, mem); |
3583 |
++ return ttm_bo_add_move_fence(bo, man, mem, ctx->no_wait_gpu); |
3584 |
+ } |
3585 |
+ |
3586 |
+ static uint32_t ttm_bo_select_caching(struct ttm_mem_type_manager *man, |
3587 |
+@@ -1120,14 +1124,18 @@ int ttm_bo_mem_space(struct ttm_buffer_object *bo, |
3588 |
+ if (unlikely(ret)) |
3589 |
+ goto error; |
3590 |
+ |
3591 |
+- if (mem->mm_node) { |
3592 |
+- ret = ttm_bo_add_move_fence(bo, man, mem); |
3593 |
+- if (unlikely(ret)) { |
3594 |
+- (*man->func->put_node)(man, mem); |
3595 |
+- goto error; |
3596 |
+- } |
3597 |
+- return 0; |
3598 |
++ if (!mem->mm_node) |
3599 |
++ continue; |
3600 |
++ |
3601 |
++ ret = ttm_bo_add_move_fence(bo, man, mem, ctx->no_wait_gpu); |
3602 |
++ if (unlikely(ret)) { |
3603 |
++ (*man->func->put_node)(man, mem); |
3604 |
++ if (ret == -EBUSY) |
3605 |
++ continue; |
3606 |
++ |
3607 |
++ goto error; |
3608 |
+ } |
3609 |
++ return 0; |
3610 |
+ } |
3611 |
+ |
3612 |
+ for (i = 0; i < placement->num_busy_placement; ++i) { |
3613 |
+diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c |
3614 |
+index ee7d4e7b0ee3..0853b980bcb3 100644 |
3615 |
+--- a/drivers/gpu/drm/vc4/vc4_hdmi.c |
3616 |
++++ b/drivers/gpu/drm/vc4/vc4_hdmi.c |
3617 |
+@@ -1285,6 +1285,9 @@ static const struct cec_adap_ops vc4_hdmi_cec_adap_ops = { |
3618 |
+ |
3619 |
+ static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data) |
3620 |
+ { |
3621 |
++#ifdef CONFIG_DRM_VC4_HDMI_CEC |
3622 |
++ struct cec_connector_info conn_info; |
3623 |
++#endif |
3624 |
+ struct platform_device *pdev = to_platform_device(dev); |
3625 |
+ struct drm_device *drm = dev_get_drvdata(master); |
3626 |
+ struct vc4_dev *vc4 = drm->dev_private; |
3627 |
+@@ -1403,13 +1406,15 @@ static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data) |
3628 |
+ #ifdef CONFIG_DRM_VC4_HDMI_CEC |
3629 |
+ hdmi->cec_adap = cec_allocate_adapter(&vc4_hdmi_cec_adap_ops, |
3630 |
+ vc4, "vc4", |
3631 |
+- CEC_CAP_TRANSMIT | |
3632 |
+- CEC_CAP_LOG_ADDRS | |
3633 |
+- CEC_CAP_PASSTHROUGH | |
3634 |
+- CEC_CAP_RC, 1); |
3635 |
++ CEC_CAP_DEFAULTS | |
3636 |
++ CEC_CAP_CONNECTOR_INFO, 1); |
3637 |
+ ret = PTR_ERR_OR_ZERO(hdmi->cec_adap); |
3638 |
+ if (ret < 0) |
3639 |
+ goto err_destroy_conn; |
3640 |
++ |
3641 |
++ cec_fill_conn_info_from_drm(&conn_info, hdmi->connector); |
3642 |
++ cec_s_conn_info(hdmi->cec_adap, &conn_info); |
3643 |
++ |
3644 |
+ HDMI_WRITE(VC4_HDMI_CPU_MASK_SET, 0xffffffff); |
3645 |
+ value = HDMI_READ(VC4_HDMI_CEC_CNTRL_1); |
3646 |
+ value &= ~VC4_HDMI_CEC_DIV_CLK_CNT_MASK; |
3647 |
+diff --git a/drivers/gpu/drm/virtio/virtgpu_ioctl.c b/drivers/gpu/drm/virtio/virtgpu_ioctl.c |
3648 |
+index 0a88ef11b9d3..a662394f6892 100644 |
3649 |
+--- a/drivers/gpu/drm/virtio/virtgpu_ioctl.c |
3650 |
++++ b/drivers/gpu/drm/virtio/virtgpu_ioctl.c |
3651 |
+@@ -463,25 +463,29 @@ out: |
3652 |
+ } |
3653 |
+ |
3654 |
+ static int virtio_gpu_wait_ioctl(struct drm_device *dev, void *data, |
3655 |
+- struct drm_file *file) |
3656 |
++ struct drm_file *file) |
3657 |
+ { |
3658 |
+ struct drm_virtgpu_3d_wait *args = data; |
3659 |
+- struct drm_gem_object *gobj = NULL; |
3660 |
+- struct virtio_gpu_object *qobj = NULL; |
3661 |
++ struct drm_gem_object *obj; |
3662 |
++ long timeout = 15 * HZ; |
3663 |
+ int ret; |
3664 |
+- bool nowait = false; |
3665 |
+ |
3666 |
+- gobj = drm_gem_object_lookup(file, args->handle); |
3667 |
+- if (gobj == NULL) |
3668 |
++ obj = drm_gem_object_lookup(file, args->handle); |
3669 |
++ if (obj == NULL) |
3670 |
+ return -ENOENT; |
3671 |
+ |
3672 |
+- qobj = gem_to_virtio_gpu_obj(gobj); |
3673 |
+- |
3674 |
+- if (args->flags & VIRTGPU_WAIT_NOWAIT) |
3675 |
+- nowait = true; |
3676 |
+- ret = virtio_gpu_object_wait(qobj, nowait); |
3677 |
++ if (args->flags & VIRTGPU_WAIT_NOWAIT) { |
3678 |
++ ret = dma_resv_test_signaled_rcu(obj->resv, true); |
3679 |
++ } else { |
3680 |
++ ret = dma_resv_wait_timeout_rcu(obj->resv, true, true, |
3681 |
++ timeout); |
3682 |
++ } |
3683 |
++ if (ret == 0) |
3684 |
++ ret = -EBUSY; |
3685 |
++ else if (ret > 0) |
3686 |
++ ret = 0; |
3687 |
+ |
3688 |
+- drm_gem_object_put_unlocked(gobj); |
3689 |
++ drm_gem_object_put_unlocked(obj); |
3690 |
+ return ret; |
3691 |
+ } |
3692 |
+ |
3693 |
+diff --git a/drivers/gpu/host1x/job.c b/drivers/gpu/host1x/job.c |
3694 |
+index eaa5c3352c13..22559670faee 100644 |
3695 |
+--- a/drivers/gpu/host1x/job.c |
3696 |
++++ b/drivers/gpu/host1x/job.c |
3697 |
+@@ -436,7 +436,8 @@ out: |
3698 |
+ return err; |
3699 |
+ } |
3700 |
+ |
3701 |
+-static inline int copy_gathers(struct host1x_job *job, struct device *dev) |
3702 |
++static inline int copy_gathers(struct device *host, struct host1x_job *job, |
3703 |
++ struct device *dev) |
3704 |
+ { |
3705 |
+ struct host1x_firewall fw; |
3706 |
+ size_t size = 0; |
3707 |
+@@ -459,12 +460,12 @@ static inline int copy_gathers(struct host1x_job *job, struct device *dev) |
3708 |
+ * Try a non-blocking allocation from a higher priority pools first, |
3709 |
+ * as awaiting for the allocation here is a major performance hit. |
3710 |
+ */ |
3711 |
+- job->gather_copy_mapped = dma_alloc_wc(dev, size, &job->gather_copy, |
3712 |
++ job->gather_copy_mapped = dma_alloc_wc(host, size, &job->gather_copy, |
3713 |
+ GFP_NOWAIT); |
3714 |
+ |
3715 |
+ /* the higher priority allocation failed, try the generic-blocking */ |
3716 |
+ if (!job->gather_copy_mapped) |
3717 |
+- job->gather_copy_mapped = dma_alloc_wc(dev, size, |
3718 |
++ job->gather_copy_mapped = dma_alloc_wc(host, size, |
3719 |
+ &job->gather_copy, |
3720 |
+ GFP_KERNEL); |
3721 |
+ if (!job->gather_copy_mapped) |
3722 |
+@@ -512,7 +513,7 @@ int host1x_job_pin(struct host1x_job *job, struct device *dev) |
3723 |
+ goto out; |
3724 |
+ |
3725 |
+ if (IS_ENABLED(CONFIG_TEGRA_HOST1X_FIREWALL)) { |
3726 |
+- err = copy_gathers(job, dev); |
3727 |
++ err = copy_gathers(host->dev, job, dev); |
3728 |
+ if (err) |
3729 |
+ goto out; |
3730 |
+ } |
3731 |
+@@ -573,7 +574,7 @@ void host1x_job_unpin(struct host1x_job *job) |
3732 |
+ job->num_unpins = 0; |
3733 |
+ |
3734 |
+ if (job->gather_copy_size) |
3735 |
+- dma_free_wc(job->channel->dev, job->gather_copy_size, |
3736 |
++ dma_free_wc(host->dev, job->gather_copy_size, |
3737 |
+ job->gather_copy_mapped, job->gather_copy); |
3738 |
+ } |
3739 |
+ EXPORT_SYMBOL(host1x_job_unpin); |
3740 |
+diff --git a/drivers/hwtracing/intel_th/core.c b/drivers/hwtracing/intel_th/core.c |
3741 |
+index 0dfd97bbde9e..ca232ec565e8 100644 |
3742 |
+--- a/drivers/hwtracing/intel_th/core.c |
3743 |
++++ b/drivers/hwtracing/intel_th/core.c |
3744 |
+@@ -834,9 +834,6 @@ static irqreturn_t intel_th_irq(int irq, void *data) |
3745 |
+ ret |= d->irq(th->thdev[i]); |
3746 |
+ } |
3747 |
+ |
3748 |
+- if (ret == IRQ_NONE) |
3749 |
+- pr_warn_ratelimited("nobody cared for irq\n"); |
3750 |
+- |
3751 |
+ return ret; |
3752 |
+ } |
3753 |
+ |
3754 |
+@@ -887,6 +884,7 @@ intel_th_alloc(struct device *dev, struct intel_th_drvdata *drvdata, |
3755 |
+ |
3756 |
+ if (th->irq == -1) |
3757 |
+ th->irq = devres[r].start; |
3758 |
++ th->num_irqs++; |
3759 |
+ break; |
3760 |
+ default: |
3761 |
+ dev_warn(dev, "Unknown resource type %lx\n", |
3762 |
+@@ -940,6 +938,9 @@ void intel_th_free(struct intel_th *th) |
3763 |
+ |
3764 |
+ th->num_thdevs = 0; |
3765 |
+ |
3766 |
++ for (i = 0; i < th->num_irqs; i++) |
3767 |
++ devm_free_irq(th->dev, th->irq + i, th); |
3768 |
++ |
3769 |
+ pm_runtime_get_sync(th->dev); |
3770 |
+ pm_runtime_forbid(th->dev); |
3771 |
+ |
3772 |
+diff --git a/drivers/hwtracing/intel_th/intel_th.h b/drivers/hwtracing/intel_th/intel_th.h |
3773 |
+index 0df480072b6c..6f4f5486fe6d 100644 |
3774 |
+--- a/drivers/hwtracing/intel_th/intel_th.h |
3775 |
++++ b/drivers/hwtracing/intel_th/intel_th.h |
3776 |
+@@ -261,6 +261,7 @@ enum th_mmio_idx { |
3777 |
+ * @num_thdevs: number of devices in the @thdev array |
3778 |
+ * @num_resources: number of resources in the @resource array |
3779 |
+ * @irq: irq number |
3780 |
++ * @num_irqs: number of IRQs is use |
3781 |
+ * @id: this Intel TH controller's device ID in the system |
3782 |
+ * @major: device node major for output devices |
3783 |
+ */ |
3784 |
+@@ -277,6 +278,7 @@ struct intel_th { |
3785 |
+ unsigned int num_thdevs; |
3786 |
+ unsigned int num_resources; |
3787 |
+ int irq; |
3788 |
++ int num_irqs; |
3789 |
+ |
3790 |
+ int id; |
3791 |
+ int major; |
3792 |
+diff --git a/drivers/hwtracing/intel_th/msu.c b/drivers/hwtracing/intel_th/msu.c |
3793 |
+index 6d240dfae9d9..8e48c7458aa3 100644 |
3794 |
+--- a/drivers/hwtracing/intel_th/msu.c |
3795 |
++++ b/drivers/hwtracing/intel_th/msu.c |
3796 |
+@@ -1676,10 +1676,13 @@ static int intel_th_msc_init(struct msc *msc) |
3797 |
+ return 0; |
3798 |
+ } |
3799 |
+ |
3800 |
+-static void msc_win_switch(struct msc *msc) |
3801 |
++static int msc_win_switch(struct msc *msc) |
3802 |
+ { |
3803 |
+ struct msc_window *first; |
3804 |
+ |
3805 |
++ if (list_empty(&msc->win_list)) |
3806 |
++ return -EINVAL; |
3807 |
++ |
3808 |
+ first = list_first_entry(&msc->win_list, struct msc_window, entry); |
3809 |
+ |
3810 |
+ if (msc_is_last_win(msc->cur_win)) |
3811 |
+@@ -1691,6 +1694,8 @@ static void msc_win_switch(struct msc *msc) |
3812 |
+ msc->base_addr = msc_win_base_dma(msc->cur_win); |
3813 |
+ |
3814 |
+ intel_th_trace_switch(msc->thdev); |
3815 |
++ |
3816 |
++ return 0; |
3817 |
+ } |
3818 |
+ |
3819 |
+ /** |
3820 |
+@@ -2025,16 +2030,15 @@ win_switch_store(struct device *dev, struct device_attribute *attr, |
3821 |
+ if (val != 1) |
3822 |
+ return -EINVAL; |
3823 |
+ |
3824 |
++ ret = -EINVAL; |
3825 |
+ mutex_lock(&msc->buf_mutex); |
3826 |
+ /* |
3827 |
+ * Window switch can only happen in the "multi" mode. |
3828 |
+ * If a external buffer is engaged, they have the full |
3829 |
+ * control over window switching. |
3830 |
+ */ |
3831 |
+- if (msc->mode != MSC_MODE_MULTI || msc->mbuf) |
3832 |
+- ret = -ENOTSUPP; |
3833 |
+- else |
3834 |
+- msc_win_switch(msc); |
3835 |
++ if (msc->mode == MSC_MODE_MULTI && !msc->mbuf) |
3836 |
++ ret = msc_win_switch(msc); |
3837 |
+ mutex_unlock(&msc->buf_mutex); |
3838 |
+ |
3839 |
+ return ret ? ret : size; |
3840 |
+diff --git a/drivers/hwtracing/intel_th/pci.c b/drivers/hwtracing/intel_th/pci.c |
3841 |
+index ebf3e30e989a..e9d90b53bbc4 100644 |
3842 |
+--- a/drivers/hwtracing/intel_th/pci.c |
3843 |
++++ b/drivers/hwtracing/intel_th/pci.c |
3844 |
+@@ -204,6 +204,11 @@ static const struct pci_device_id intel_th_pci_id_table[] = { |
3845 |
+ PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x06a6), |
3846 |
+ .driver_data = (kernel_ulong_t)&intel_th_2x, |
3847 |
+ }, |
3848 |
++ { |
3849 |
++ /* Comet Lake PCH-V */ |
3850 |
++ PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0xa3a6), |
3851 |
++ .driver_data = (kernel_ulong_t)&intel_th_2x, |
3852 |
++ }, |
3853 |
+ { |
3854 |
+ /* Ice Lake NNPI */ |
3855 |
+ PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x45c5), |
3856 |
+@@ -229,6 +234,11 @@ static const struct pci_device_id intel_th_pci_id_table[] = { |
3857 |
+ PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x4da6), |
3858 |
+ .driver_data = (kernel_ulong_t)&intel_th_2x, |
3859 |
+ }, |
3860 |
++ { |
3861 |
++ /* Elkhart Lake */ |
3862 |
++ PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x4b26), |
3863 |
++ .driver_data = (kernel_ulong_t)&intel_th_2x, |
3864 |
++ }, |
3865 |
+ { 0 }, |
3866 |
+ }; |
3867 |
+ |
3868 |
+diff --git a/drivers/iio/adc/dln2-adc.c b/drivers/iio/adc/dln2-adc.c |
3869 |
+index 5fa78c273a25..65c7c9329b1c 100644 |
3870 |
+--- a/drivers/iio/adc/dln2-adc.c |
3871 |
++++ b/drivers/iio/adc/dln2-adc.c |
3872 |
+@@ -524,6 +524,10 @@ static int dln2_adc_triggered_buffer_postenable(struct iio_dev *indio_dev) |
3873 |
+ u16 conflict; |
3874 |
+ unsigned int trigger_chan; |
3875 |
+ |
3876 |
++ ret = iio_triggered_buffer_postenable(indio_dev); |
3877 |
++ if (ret) |
3878 |
++ return ret; |
3879 |
++ |
3880 |
+ mutex_lock(&dln2->mutex); |
3881 |
+ |
3882 |
+ /* Enable ADC */ |
3883 |
+@@ -537,6 +541,7 @@ static int dln2_adc_triggered_buffer_postenable(struct iio_dev *indio_dev) |
3884 |
+ (int)conflict); |
3885 |
+ ret = -EBUSY; |
3886 |
+ } |
3887 |
++ iio_triggered_buffer_predisable(indio_dev); |
3888 |
+ return ret; |
3889 |
+ } |
3890 |
+ |
3891 |
+@@ -550,6 +555,7 @@ static int dln2_adc_triggered_buffer_postenable(struct iio_dev *indio_dev) |
3892 |
+ mutex_unlock(&dln2->mutex); |
3893 |
+ if (ret < 0) { |
3894 |
+ dev_dbg(&dln2->pdev->dev, "Problem in %s\n", __func__); |
3895 |
++ iio_triggered_buffer_predisable(indio_dev); |
3896 |
+ return ret; |
3897 |
+ } |
3898 |
+ } else { |
3899 |
+@@ -557,12 +563,12 @@ static int dln2_adc_triggered_buffer_postenable(struct iio_dev *indio_dev) |
3900 |
+ mutex_unlock(&dln2->mutex); |
3901 |
+ } |
3902 |
+ |
3903 |
+- return iio_triggered_buffer_postenable(indio_dev); |
3904 |
++ return 0; |
3905 |
+ } |
3906 |
+ |
3907 |
+ static int dln2_adc_triggered_buffer_predisable(struct iio_dev *indio_dev) |
3908 |
+ { |
3909 |
+- int ret; |
3910 |
++ int ret, ret2; |
3911 |
+ struct dln2_adc *dln2 = iio_priv(indio_dev); |
3912 |
+ |
3913 |
+ mutex_lock(&dln2->mutex); |
3914 |
+@@ -577,12 +583,14 @@ static int dln2_adc_triggered_buffer_predisable(struct iio_dev *indio_dev) |
3915 |
+ ret = dln2_adc_set_port_enabled(dln2, false, NULL); |
3916 |
+ |
3917 |
+ mutex_unlock(&dln2->mutex); |
3918 |
+- if (ret < 0) { |
3919 |
++ if (ret < 0) |
3920 |
+ dev_dbg(&dln2->pdev->dev, "Problem in %s\n", __func__); |
3921 |
+- return ret; |
3922 |
+- } |
3923 |
+ |
3924 |
+- return iio_triggered_buffer_predisable(indio_dev); |
3925 |
++ ret2 = iio_triggered_buffer_predisable(indio_dev); |
3926 |
++ if (ret == 0) |
3927 |
++ ret = ret2; |
3928 |
++ |
3929 |
++ return ret; |
3930 |
+ } |
3931 |
+ |
3932 |
+ static const struct iio_buffer_setup_ops dln2_adc_buffer_setup_ops = { |
3933 |
+diff --git a/drivers/iio/adc/max1027.c b/drivers/iio/adc/max1027.c |
3934 |
+index 214883458582..e3be8eedd773 100644 |
3935 |
+--- a/drivers/iio/adc/max1027.c |
3936 |
++++ b/drivers/iio/adc/max1027.c |
3937 |
+@@ -458,6 +458,14 @@ static int max1027_probe(struct spi_device *spi) |
3938 |
+ return ret; |
3939 |
+ } |
3940 |
+ |
3941 |
++ /* Internal reset */ |
3942 |
++ st->reg = MAX1027_RST_REG; |
3943 |
++ ret = spi_write(st->spi, &st->reg, 1); |
3944 |
++ if (ret < 0) { |
3945 |
++ dev_err(&indio_dev->dev, "Failed to reset the ADC\n"); |
3946 |
++ return ret; |
3947 |
++ } |
3948 |
++ |
3949 |
+ /* Disable averaging */ |
3950 |
+ st->reg = MAX1027_AVG_REG; |
3951 |
+ ret = spi_write(st->spi, &st->reg, 1); |
3952 |
+diff --git a/drivers/iio/dac/Kconfig b/drivers/iio/dac/Kconfig |
3953 |
+index cc42219a64f7..979070196da9 100644 |
3954 |
+--- a/drivers/iio/dac/Kconfig |
3955 |
++++ b/drivers/iio/dac/Kconfig |
3956 |
+@@ -60,8 +60,8 @@ config AD5446 |
3957 |
+ help |
3958 |
+ Say yes here to build support for Analog Devices AD5300, AD5301, AD5310, |
3959 |
+ AD5311, AD5320, AD5321, AD5444, AD5446, AD5450, AD5451, AD5452, AD5453, |
3960 |
+- AD5512A, AD5541A, AD5542A, AD5543, AD5553, AD5601, AD5602, AD5611, AD5612, |
3961 |
+- AD5620, AD5621, AD5622, AD5640, AD5641, AD5660, AD5662 DACs |
3962 |
++ AD5512A, AD5541A, AD5542A, AD5543, AD5553, AD5600, AD5601, AD5602, AD5611, |
3963 |
++ AD5612, AD5620, AD5621, AD5622, AD5640, AD5641, AD5660, AD5662 DACs |
3964 |
+ as well as Texas Instruments DAC081S101, DAC101S101, DAC121S101. |
3965 |
+ |
3966 |
+ To compile this driver as a module, choose M here: the |
3967 |
+diff --git a/drivers/iio/dac/ad5446.c b/drivers/iio/dac/ad5446.c |
3968 |
+index 7df8b4cc295d..61c670f7fc5f 100644 |
3969 |
+--- a/drivers/iio/dac/ad5446.c |
3970 |
++++ b/drivers/iio/dac/ad5446.c |
3971 |
+@@ -327,6 +327,7 @@ enum ad5446_supported_spi_device_ids { |
3972 |
+ ID_AD5541A, |
3973 |
+ ID_AD5512A, |
3974 |
+ ID_AD5553, |
3975 |
++ ID_AD5600, |
3976 |
+ ID_AD5601, |
3977 |
+ ID_AD5611, |
3978 |
+ ID_AD5621, |
3979 |
+@@ -381,6 +382,10 @@ static const struct ad5446_chip_info ad5446_spi_chip_info[] = { |
3980 |
+ .channel = AD5446_CHANNEL(14, 16, 0), |
3981 |
+ .write = ad5446_write, |
3982 |
+ }, |
3983 |
++ [ID_AD5600] = { |
3984 |
++ .channel = AD5446_CHANNEL(16, 16, 0), |
3985 |
++ .write = ad5446_write, |
3986 |
++ }, |
3987 |
+ [ID_AD5601] = { |
3988 |
+ .channel = AD5446_CHANNEL_POWERDOWN(8, 16, 6), |
3989 |
+ .write = ad5446_write, |
3990 |
+@@ -448,6 +453,7 @@ static const struct spi_device_id ad5446_spi_ids[] = { |
3991 |
+ {"ad5542a", ID_AD5541A}, /* ad5541a and ad5542a are compatible */ |
3992 |
+ {"ad5543", ID_AD5541A}, /* ad5541a and ad5543 are compatible */ |
3993 |
+ {"ad5553", ID_AD5553}, |
3994 |
++ {"ad5600", ID_AD5600}, |
3995 |
+ {"ad5601", ID_AD5601}, |
3996 |
+ {"ad5611", ID_AD5611}, |
3997 |
+ {"ad5621", ID_AD5621}, |
3998 |
+diff --git a/drivers/iio/light/bh1750.c b/drivers/iio/light/bh1750.c |
3999 |
+index 28347df78cff..adb5ab9e3439 100644 |
4000 |
+--- a/drivers/iio/light/bh1750.c |
4001 |
++++ b/drivers/iio/light/bh1750.c |
4002 |
+@@ -59,9 +59,9 @@ struct bh1750_chip_info { |
4003 |
+ |
4004 |
+ u16 int_time_low_mask; |
4005 |
+ u16 int_time_high_mask; |
4006 |
+-} |
4007 |
++}; |
4008 |
+ |
4009 |
+-static const bh1750_chip_info_tbl[] = { |
4010 |
++static const struct bh1750_chip_info bh1750_chip_info_tbl[] = { |
4011 |
+ [BH1710] = { 140, 1022, 300, 400, 250000000, 2, 0x001F, 0x03E0 }, |
4012 |
+ [BH1721] = { 140, 1020, 300, 400, 250000000, 2, 0x0010, 0x03E0 }, |
4013 |
+ [BH1750] = { 31, 254, 69, 1740, 57500000, 1, 0x001F, 0x00E0 }, |
4014 |
+diff --git a/drivers/iio/pressure/cros_ec_baro.c b/drivers/iio/pressure/cros_ec_baro.c |
4015 |
+index 2354302375de..52f53f3123b1 100644 |
4016 |
+--- a/drivers/iio/pressure/cros_ec_baro.c |
4017 |
++++ b/drivers/iio/pressure/cros_ec_baro.c |
4018 |
+@@ -114,6 +114,7 @@ static int cros_ec_baro_write(struct iio_dev *indio_dev, |
4019 |
+ static const struct iio_info cros_ec_baro_info = { |
4020 |
+ .read_raw = &cros_ec_baro_read, |
4021 |
+ .write_raw = &cros_ec_baro_write, |
4022 |
++ .read_avail = &cros_ec_sensors_core_read_avail, |
4023 |
+ }; |
4024 |
+ |
4025 |
+ static int cros_ec_baro_probe(struct platform_device *pdev) |
4026 |
+@@ -149,6 +150,8 @@ static int cros_ec_baro_probe(struct platform_device *pdev) |
4027 |
+ BIT(IIO_CHAN_INFO_SCALE) | |
4028 |
+ BIT(IIO_CHAN_INFO_SAMP_FREQ) | |
4029 |
+ BIT(IIO_CHAN_INFO_FREQUENCY); |
4030 |
++ channel->info_mask_shared_by_all_available = |
4031 |
++ BIT(IIO_CHAN_INFO_SAMP_FREQ); |
4032 |
+ channel->scan_type.realbits = CROS_EC_SENSOR_BITS; |
4033 |
+ channel->scan_type.storagebits = CROS_EC_SENSOR_BITS; |
4034 |
+ channel->scan_type.shift = 0; |
4035 |
+diff --git a/drivers/iio/temperature/max31856.c b/drivers/iio/temperature/max31856.c |
4036 |
+index f184ba5601d9..73ed550e3fc9 100644 |
4037 |
+--- a/drivers/iio/temperature/max31856.c |
4038 |
++++ b/drivers/iio/temperature/max31856.c |
4039 |
+@@ -284,6 +284,8 @@ static int max31856_probe(struct spi_device *spi) |
4040 |
+ spi_set_drvdata(spi, indio_dev); |
4041 |
+ |
4042 |
+ indio_dev->info = &max31856_info; |
4043 |
++ indio_dev->dev.parent = &spi->dev; |
4044 |
++ indio_dev->dev.of_node = spi->dev.of_node; |
4045 |
+ indio_dev->name = id->name; |
4046 |
+ indio_dev->modes = INDIO_DIRECT_MODE; |
4047 |
+ indio_dev->channels = max31856_channels; |
4048 |
+diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c |
4049 |
+index 50a92442c4f7..2b5bd7206fc6 100644 |
4050 |
+--- a/drivers/infiniband/core/device.c |
4051 |
++++ b/drivers/infiniband/core/device.c |
4052 |
+@@ -1199,9 +1199,21 @@ static void setup_dma_device(struct ib_device *device) |
4053 |
+ WARN_ON_ONCE(!parent); |
4054 |
+ device->dma_device = parent; |
4055 |
+ } |
4056 |
+- /* Setup default max segment size for all IB devices */ |
4057 |
+- dma_set_max_seg_size(device->dma_device, SZ_2G); |
4058 |
+ |
4059 |
++ if (!device->dev.dma_parms) { |
4060 |
++ if (parent) { |
4061 |
++ /* |
4062 |
++ * The caller did not provide DMA parameters, so |
4063 |
++ * 'parent' probably represents a PCI device. The PCI |
4064 |
++ * core sets the maximum segment size to 64 |
4065 |
++ * KB. Increase this parameter to 2 GB. |
4066 |
++ */ |
4067 |
++ device->dev.dma_parms = parent->dma_parms; |
4068 |
++ dma_set_max_seg_size(device->dma_device, SZ_2G); |
4069 |
++ } else { |
4070 |
++ WARN_ON_ONCE(true); |
4071 |
++ } |
4072 |
++ } |
4073 |
+ } |
4074 |
+ |
4075 |
+ /* |
4076 |
+@@ -2397,8 +2409,12 @@ int ib_modify_port(struct ib_device *device, |
4077 |
+ rc = device->ops.modify_port(device, port_num, |
4078 |
+ port_modify_mask, |
4079 |
+ port_modify); |
4080 |
++ else if (rdma_protocol_roce(device, port_num) && |
4081 |
++ ((port_modify->set_port_cap_mask & ~IB_PORT_CM_SUP) == 0 || |
4082 |
++ (port_modify->clr_port_cap_mask & ~IB_PORT_CM_SUP) == 0)) |
4083 |
++ rc = 0; |
4084 |
+ else |
4085 |
+- rc = rdma_protocol_roce(device, port_num) ? 0 : -ENOSYS; |
4086 |
++ rc = -EOPNOTSUPP; |
4087 |
+ return rc; |
4088 |
+ } |
4089 |
+ EXPORT_SYMBOL(ib_modify_port); |
4090 |
+diff --git a/drivers/infiniband/hw/bnxt_re/main.c b/drivers/infiniband/hw/bnxt_re/main.c |
4091 |
+index 30a54f8aa42c..27e2df44d043 100644 |
4092 |
+--- a/drivers/infiniband/hw/bnxt_re/main.c |
4093 |
++++ b/drivers/infiniband/hw/bnxt_re/main.c |
4094 |
+@@ -477,6 +477,7 @@ static int bnxt_re_net_stats_ctx_alloc(struct bnxt_re_dev *rdev, |
4095 |
+ bnxt_re_init_hwrm_hdr(rdev, (void *)&req, HWRM_STAT_CTX_ALLOC, -1, -1); |
4096 |
+ req.update_period_ms = cpu_to_le32(1000); |
4097 |
+ req.stats_dma_addr = cpu_to_le64(dma_map); |
4098 |
++ req.stats_dma_length = cpu_to_le16(sizeof(struct ctx_hw_stats_ext)); |
4099 |
+ req.stat_ctx_flags = STAT_CTX_ALLOC_REQ_STAT_CTX_FLAGS_ROCE; |
4100 |
+ bnxt_re_fill_fw_msg(&fw_msg, (void *)&req, sizeof(req), (void *)&resp, |
4101 |
+ sizeof(resp), DFLT_HWRM_CMD_TIMEOUT); |
4102 |
+@@ -1270,10 +1271,10 @@ static void bnxt_re_query_hwrm_intf_version(struct bnxt_re_dev *rdev) |
4103 |
+ return; |
4104 |
+ } |
4105 |
+ rdev->qplib_ctx.hwrm_intf_ver = |
4106 |
+- (u64)resp.hwrm_intf_major << 48 | |
4107 |
+- (u64)resp.hwrm_intf_minor << 32 | |
4108 |
+- (u64)resp.hwrm_intf_build << 16 | |
4109 |
+- resp.hwrm_intf_patch; |
4110 |
++ (u64)le16_to_cpu(resp.hwrm_intf_major) << 48 | |
4111 |
++ (u64)le16_to_cpu(resp.hwrm_intf_minor) << 32 | |
4112 |
++ (u64)le16_to_cpu(resp.hwrm_intf_build) << 16 | |
4113 |
++ le16_to_cpu(resp.hwrm_intf_patch); |
4114 |
+ } |
4115 |
+ |
4116 |
+ static void bnxt_re_ib_unreg(struct bnxt_re_dev *rdev) |
4117 |
+diff --git a/drivers/infiniband/hw/bnxt_re/qplib_res.h b/drivers/infiniband/hw/bnxt_re/qplib_res.h |
4118 |
+index fbda11a7ab1a..aaa76d792185 100644 |
4119 |
+--- a/drivers/infiniband/hw/bnxt_re/qplib_res.h |
4120 |
++++ b/drivers/infiniband/hw/bnxt_re/qplib_res.h |
4121 |
+@@ -186,7 +186,9 @@ struct bnxt_qplib_chip_ctx { |
4122 |
+ u8 chip_metal; |
4123 |
+ }; |
4124 |
+ |
4125 |
+-#define CHIP_NUM_57500 0x1750 |
4126 |
++#define CHIP_NUM_57508 0x1750 |
4127 |
++#define CHIP_NUM_57504 0x1751 |
4128 |
++#define CHIP_NUM_57502 0x1752 |
4129 |
+ |
4130 |
+ struct bnxt_qplib_res { |
4131 |
+ struct pci_dev *pdev; |
4132 |
+@@ -203,7 +205,9 @@ struct bnxt_qplib_res { |
4133 |
+ |
4134 |
+ static inline bool bnxt_qplib_is_chip_gen_p5(struct bnxt_qplib_chip_ctx *cctx) |
4135 |
+ { |
4136 |
+- return (cctx->chip_num == CHIP_NUM_57500); |
4137 |
++ return (cctx->chip_num == CHIP_NUM_57508 || |
4138 |
++ cctx->chip_num == CHIP_NUM_57504 || |
4139 |
++ cctx->chip_num == CHIP_NUM_57502); |
4140 |
+ } |
4141 |
+ |
4142 |
+ static inline u8 bnxt_qplib_get_hwq_type(struct bnxt_qplib_res *res) |
4143 |
+diff --git a/drivers/infiniband/hw/efa/efa_com.c b/drivers/infiniband/hw/efa/efa_com.c |
4144 |
+index 3c412bc5b94f..0778f4f7dccd 100644 |
4145 |
+--- a/drivers/infiniband/hw/efa/efa_com.c |
4146 |
++++ b/drivers/infiniband/hw/efa/efa_com.c |
4147 |
+@@ -317,6 +317,7 @@ static struct efa_comp_ctx *__efa_com_submit_admin_cmd(struct efa_com_admin_queu |
4148 |
+ struct efa_admin_acq_entry *comp, |
4149 |
+ size_t comp_size_in_bytes) |
4150 |
+ { |
4151 |
++ struct efa_admin_aq_entry *aqe; |
4152 |
+ struct efa_comp_ctx *comp_ctx; |
4153 |
+ u16 queue_size_mask; |
4154 |
+ u16 cmd_id; |
4155 |
+@@ -350,7 +351,9 @@ static struct efa_comp_ctx *__efa_com_submit_admin_cmd(struct efa_com_admin_queu |
4156 |
+ |
4157 |
+ reinit_completion(&comp_ctx->wait_event); |
4158 |
+ |
4159 |
+- memcpy(&aq->sq.entries[pi], cmd, cmd_size_in_bytes); |
4160 |
++ aqe = &aq->sq.entries[pi]; |
4161 |
++ memset(aqe, 0, sizeof(*aqe)); |
4162 |
++ memcpy(aqe, cmd, cmd_size_in_bytes); |
4163 |
+ |
4164 |
+ aq->sq.pc++; |
4165 |
+ atomic64_inc(&aq->stats.submitted_cmd); |
4166 |
+diff --git a/drivers/infiniband/hw/hns/hns_roce_restrack.c b/drivers/infiniband/hw/hns/hns_roce_restrack.c |
4167 |
+index 0a31d0a3d657..06871731ac43 100644 |
4168 |
+--- a/drivers/infiniband/hw/hns/hns_roce_restrack.c |
4169 |
++++ b/drivers/infiniband/hw/hns/hns_roce_restrack.c |
4170 |
+@@ -98,11 +98,15 @@ static int hns_roce_fill_res_cq_entry(struct sk_buff *msg, |
4171 |
+ goto err; |
4172 |
+ |
4173 |
+ table_attr = nla_nest_start(msg, RDMA_NLDEV_ATTR_DRIVER); |
4174 |
+- if (!table_attr) |
4175 |
++ if (!table_attr) { |
4176 |
++ ret = -EMSGSIZE; |
4177 |
+ goto err; |
4178 |
++ } |
4179 |
+ |
4180 |
+- if (hns_roce_fill_cq(msg, context)) |
4181 |
++ if (hns_roce_fill_cq(msg, context)) { |
4182 |
++ ret = -EMSGSIZE; |
4183 |
+ goto err_cancel_table; |
4184 |
++ } |
4185 |
+ |
4186 |
+ nla_nest_end(msg, table_attr); |
4187 |
+ kfree(context); |
4188 |
+@@ -113,7 +117,7 @@ err_cancel_table: |
4189 |
+ nla_nest_cancel(msg, table_attr); |
4190 |
+ err: |
4191 |
+ kfree(context); |
4192 |
+- return -EMSGSIZE; |
4193 |
++ return ret; |
4194 |
+ } |
4195 |
+ |
4196 |
+ int hns_roce_fill_res_entry(struct sk_buff *msg, |
4197 |
+diff --git a/drivers/infiniband/hw/hns/hns_roce_srq.c b/drivers/infiniband/hw/hns/hns_roce_srq.c |
4198 |
+index 43ea2c13b212..108667ae6b14 100644 |
4199 |
+--- a/drivers/infiniband/hw/hns/hns_roce_srq.c |
4200 |
++++ b/drivers/infiniband/hw/hns/hns_roce_srq.c |
4201 |
+@@ -180,8 +180,7 @@ static int create_user_srq(struct hns_roce_srq *srq, struct ib_udata *udata, |
4202 |
+ { |
4203 |
+ struct hns_roce_dev *hr_dev = to_hr_dev(srq->ibsrq.device); |
4204 |
+ struct hns_roce_ib_create_srq ucmd; |
4205 |
+- u32 page_shift; |
4206 |
+- u32 npages; |
4207 |
++ struct hns_roce_buf *buf; |
4208 |
+ int ret; |
4209 |
+ |
4210 |
+ if (ib_copy_from_udata(&ucmd, udata, sizeof(ucmd))) |
4211 |
+@@ -191,11 +190,13 @@ static int create_user_srq(struct hns_roce_srq *srq, struct ib_udata *udata, |
4212 |
+ if (IS_ERR(srq->umem)) |
4213 |
+ return PTR_ERR(srq->umem); |
4214 |
+ |
4215 |
+- npages = (ib_umem_page_count(srq->umem) + |
4216 |
+- (1 << hr_dev->caps.srqwqe_buf_pg_sz) - 1) / |
4217 |
+- (1 << hr_dev->caps.srqwqe_buf_pg_sz); |
4218 |
+- page_shift = PAGE_SHIFT + hr_dev->caps.srqwqe_buf_pg_sz; |
4219 |
+- ret = hns_roce_mtt_init(hr_dev, npages, page_shift, &srq->mtt); |
4220 |
++ buf = &srq->buf; |
4221 |
++ buf->npages = (ib_umem_page_count(srq->umem) + |
4222 |
++ (1 << hr_dev->caps.srqwqe_buf_pg_sz) - 1) / |
4223 |
++ (1 << hr_dev->caps.srqwqe_buf_pg_sz); |
4224 |
++ buf->page_shift = PAGE_SHIFT + hr_dev->caps.srqwqe_buf_pg_sz; |
4225 |
++ ret = hns_roce_mtt_init(hr_dev, buf->npages, buf->page_shift, |
4226 |
++ &srq->mtt); |
4227 |
+ if (ret) |
4228 |
+ goto err_user_buf; |
4229 |
+ |
4230 |
+@@ -212,9 +213,12 @@ static int create_user_srq(struct hns_roce_srq *srq, struct ib_udata *udata, |
4231 |
+ goto err_user_srq_mtt; |
4232 |
+ } |
4233 |
+ |
4234 |
+- ret = hns_roce_mtt_init(hr_dev, ib_umem_page_count(srq->idx_que.umem), |
4235 |
+- PAGE_SHIFT, &srq->idx_que.mtt); |
4236 |
+- |
4237 |
++ buf = &srq->idx_que.idx_buf; |
4238 |
++ buf->npages = DIV_ROUND_UP(ib_umem_page_count(srq->idx_que.umem), |
4239 |
++ 1 << hr_dev->caps.idx_buf_pg_sz); |
4240 |
++ buf->page_shift = PAGE_SHIFT + hr_dev->caps.idx_buf_pg_sz; |
4241 |
++ ret = hns_roce_mtt_init(hr_dev, buf->npages, buf->page_shift, |
4242 |
++ &srq->idx_que.mtt); |
4243 |
+ if (ret) { |
4244 |
+ dev_err(hr_dev->dev, "hns_roce_mtt_init error for idx que\n"); |
4245 |
+ goto err_user_idx_mtt; |
4246 |
+diff --git a/drivers/infiniband/hw/qedr/main.c b/drivers/infiniband/hw/qedr/main.c |
4247 |
+index dc71b6e16a07..b462eaca1ee3 100644 |
4248 |
+--- a/drivers/infiniband/hw/qedr/main.c |
4249 |
++++ b/drivers/infiniband/hw/qedr/main.c |
4250 |
+@@ -357,6 +357,7 @@ static int qedr_alloc_resources(struct qedr_dev *dev) |
4251 |
+ return -ENOMEM; |
4252 |
+ |
4253 |
+ spin_lock_init(&dev->sgid_lock); |
4254 |
++ xa_init_flags(&dev->srqs, XA_FLAGS_LOCK_IRQ); |
4255 |
+ |
4256 |
+ if (IS_IWARP(dev)) { |
4257 |
+ xa_init_flags(&dev->qps, XA_FLAGS_LOCK_IRQ); |
4258 |
+diff --git a/drivers/infiniband/hw/qedr/verbs.c b/drivers/infiniband/hw/qedr/verbs.c |
4259 |
+index 6f3ce86019b7..a7ccca3c4f89 100644 |
4260 |
+--- a/drivers/infiniband/hw/qedr/verbs.c |
4261 |
++++ b/drivers/infiniband/hw/qedr/verbs.c |
4262 |
+@@ -1577,6 +1577,14 @@ static void qedr_cleanup_user(struct qedr_dev *dev, struct qedr_qp *qp) |
4263 |
+ |
4264 |
+ ib_umem_release(qp->urq.umem); |
4265 |
+ qp->urq.umem = NULL; |
4266 |
++ |
4267 |
++ if (rdma_protocol_roce(&dev->ibdev, 1)) { |
4268 |
++ qedr_free_pbl(dev, &qp->usq.pbl_info, qp->usq.pbl_tbl); |
4269 |
++ qedr_free_pbl(dev, &qp->urq.pbl_info, qp->urq.pbl_tbl); |
4270 |
++ } else { |
4271 |
++ kfree(qp->usq.pbl_tbl); |
4272 |
++ kfree(qp->urq.pbl_tbl); |
4273 |
++ } |
4274 |
+ } |
4275 |
+ |
4276 |
+ static int qedr_create_user_qp(struct qedr_dev *dev, |
4277 |
+@@ -2673,8 +2681,8 @@ int qedr_dereg_mr(struct ib_mr *ib_mr, struct ib_udata *udata) |
4278 |
+ |
4279 |
+ dev->ops->rdma_free_tid(dev->rdma_ctx, mr->hw_mr.itid); |
4280 |
+ |
4281 |
+- if ((mr->type != QEDR_MR_DMA) && (mr->type != QEDR_MR_FRMR)) |
4282 |
+- qedr_free_pbl(dev, &mr->info.pbl_info, mr->info.pbl_table); |
4283 |
++ if (mr->type != QEDR_MR_DMA) |
4284 |
++ free_mr_info(dev, &mr->info); |
4285 |
+ |
4286 |
+ /* it could be user registered memory. */ |
4287 |
+ ib_umem_release(mr->umem); |
4288 |
+diff --git a/drivers/infiniband/sw/siw/siw_main.c b/drivers/infiniband/sw/siw/siw_main.c |
4289 |
+index 05a92f997f60..fb01407a310f 100644 |
4290 |
+--- a/drivers/infiniband/sw/siw/siw_main.c |
4291 |
++++ b/drivers/infiniband/sw/siw/siw_main.c |
4292 |
+@@ -248,24 +248,6 @@ static struct ib_qp *siw_get_base_qp(struct ib_device *base_dev, int id) |
4293 |
+ return NULL; |
4294 |
+ } |
4295 |
+ |
4296 |
+-static void siw_verbs_sq_flush(struct ib_qp *base_qp) |
4297 |
+-{ |
4298 |
+- struct siw_qp *qp = to_siw_qp(base_qp); |
4299 |
+- |
4300 |
+- down_write(&qp->state_lock); |
4301 |
+- siw_sq_flush(qp); |
4302 |
+- up_write(&qp->state_lock); |
4303 |
+-} |
4304 |
+- |
4305 |
+-static void siw_verbs_rq_flush(struct ib_qp *base_qp) |
4306 |
+-{ |
4307 |
+- struct siw_qp *qp = to_siw_qp(base_qp); |
4308 |
+- |
4309 |
+- down_write(&qp->state_lock); |
4310 |
+- siw_rq_flush(qp); |
4311 |
+- up_write(&qp->state_lock); |
4312 |
+-} |
4313 |
+- |
4314 |
+ static const struct ib_device_ops siw_device_ops = { |
4315 |
+ .owner = THIS_MODULE, |
4316 |
+ .uverbs_abi_ver = SIW_ABI_VERSION, |
4317 |
+@@ -284,8 +266,6 @@ static const struct ib_device_ops siw_device_ops = { |
4318 |
+ .destroy_cq = siw_destroy_cq, |
4319 |
+ .destroy_qp = siw_destroy_qp, |
4320 |
+ .destroy_srq = siw_destroy_srq, |
4321 |
+- .drain_rq = siw_verbs_rq_flush, |
4322 |
+- .drain_sq = siw_verbs_sq_flush, |
4323 |
+ .get_dma_mr = siw_get_dma_mr, |
4324 |
+ .get_port_immutable = siw_get_port_immutable, |
4325 |
+ .iw_accept = siw_accept, |
4326 |
+diff --git a/drivers/infiniband/sw/siw/siw_verbs.c b/drivers/infiniband/sw/siw/siw_verbs.c |
4327 |
+index b18a677832e1..1b1a40db529c 100644 |
4328 |
+--- a/drivers/infiniband/sw/siw/siw_verbs.c |
4329 |
++++ b/drivers/infiniband/sw/siw/siw_verbs.c |
4330 |
+@@ -685,6 +685,47 @@ static int siw_copy_inline_sgl(const struct ib_send_wr *core_wr, |
4331 |
+ return bytes; |
4332 |
+ } |
4333 |
+ |
4334 |
++/* Complete SQ WR's without processing */ |
4335 |
++static int siw_sq_flush_wr(struct siw_qp *qp, const struct ib_send_wr *wr, |
4336 |
++ const struct ib_send_wr **bad_wr) |
4337 |
++{ |
4338 |
++ struct siw_sqe sqe = {}; |
4339 |
++ int rv = 0; |
4340 |
++ |
4341 |
++ while (wr) { |
4342 |
++ sqe.id = wr->wr_id; |
4343 |
++ sqe.opcode = wr->opcode; |
4344 |
++ rv = siw_sqe_complete(qp, &sqe, 0, SIW_WC_WR_FLUSH_ERR); |
4345 |
++ if (rv) { |
4346 |
++ if (bad_wr) |
4347 |
++ *bad_wr = wr; |
4348 |
++ break; |
4349 |
++ } |
4350 |
++ wr = wr->next; |
4351 |
++ } |
4352 |
++ return rv; |
4353 |
++} |
4354 |
++ |
4355 |
++/* Complete RQ WR's without processing */ |
4356 |
++static int siw_rq_flush_wr(struct siw_qp *qp, const struct ib_recv_wr *wr, |
4357 |
++ const struct ib_recv_wr **bad_wr) |
4358 |
++{ |
4359 |
++ struct siw_rqe rqe = {}; |
4360 |
++ int rv = 0; |
4361 |
++ |
4362 |
++ while (wr) { |
4363 |
++ rqe.id = wr->wr_id; |
4364 |
++ rv = siw_rqe_complete(qp, &rqe, 0, 0, SIW_WC_WR_FLUSH_ERR); |
4365 |
++ if (rv) { |
4366 |
++ if (bad_wr) |
4367 |
++ *bad_wr = wr; |
4368 |
++ break; |
4369 |
++ } |
4370 |
++ wr = wr->next; |
4371 |
++ } |
4372 |
++ return rv; |
4373 |
++} |
4374 |
++ |
4375 |
+ /* |
4376 |
+ * siw_post_send() |
4377 |
+ * |
4378 |
+@@ -703,26 +744,54 @@ int siw_post_send(struct ib_qp *base_qp, const struct ib_send_wr *wr, |
4379 |
+ unsigned long flags; |
4380 |
+ int rv = 0; |
4381 |
+ |
4382 |
++ if (wr && !qp->kernel_verbs) { |
4383 |
++ siw_dbg_qp(qp, "wr must be empty for user mapped sq\n"); |
4384 |
++ *bad_wr = wr; |
4385 |
++ return -EINVAL; |
4386 |
++ } |
4387 |
++ |
4388 |
+ /* |
4389 |
+ * Try to acquire QP state lock. Must be non-blocking |
4390 |
+ * to accommodate kernel clients needs. |
4391 |
+ */ |
4392 |
+ if (!down_read_trylock(&qp->state_lock)) { |
4393 |
+- *bad_wr = wr; |
4394 |
+- siw_dbg_qp(qp, "QP locked, state %d\n", qp->attrs.state); |
4395 |
+- return -ENOTCONN; |
4396 |
++ if (qp->attrs.state == SIW_QP_STATE_ERROR) { |
4397 |
++ /* |
4398 |
++ * ERROR state is final, so we can be sure |
4399 |
++ * this state will not change as long as the QP |
4400 |
++ * exists. |
4401 |
++ * |
4402 |
++ * This handles an ib_drain_sq() call with |
4403 |
++ * a concurrent request to set the QP state |
4404 |
++ * to ERROR. |
4405 |
++ */ |
4406 |
++ rv = siw_sq_flush_wr(qp, wr, bad_wr); |
4407 |
++ } else { |
4408 |
++ siw_dbg_qp(qp, "QP locked, state %d\n", |
4409 |
++ qp->attrs.state); |
4410 |
++ *bad_wr = wr; |
4411 |
++ rv = -ENOTCONN; |
4412 |
++ } |
4413 |
++ return rv; |
4414 |
+ } |
4415 |
+ if (unlikely(qp->attrs.state != SIW_QP_STATE_RTS)) { |
4416 |
++ if (qp->attrs.state == SIW_QP_STATE_ERROR) { |
4417 |
++ /* |
4418 |
++ * Immediately flush this WR to CQ, if QP |
4419 |
++ * is in ERROR state. SQ is guaranteed to |
4420 |
++ * be empty, so WR complets in-order. |
4421 |
++ * |
4422 |
++ * Typically triggered by ib_drain_sq(). |
4423 |
++ */ |
4424 |
++ rv = siw_sq_flush_wr(qp, wr, bad_wr); |
4425 |
++ } else { |
4426 |
++ siw_dbg_qp(qp, "QP out of state %d\n", |
4427 |
++ qp->attrs.state); |
4428 |
++ *bad_wr = wr; |
4429 |
++ rv = -ENOTCONN; |
4430 |
++ } |
4431 |
+ up_read(&qp->state_lock); |
4432 |
+- *bad_wr = wr; |
4433 |
+- siw_dbg_qp(qp, "QP out of state %d\n", qp->attrs.state); |
4434 |
+- return -ENOTCONN; |
4435 |
+- } |
4436 |
+- if (wr && !qp->kernel_verbs) { |
4437 |
+- siw_dbg_qp(qp, "wr must be empty for user mapped sq\n"); |
4438 |
+- up_read(&qp->state_lock); |
4439 |
+- *bad_wr = wr; |
4440 |
+- return -EINVAL; |
4441 |
++ return rv; |
4442 |
+ } |
4443 |
+ spin_lock_irqsave(&qp->sq_lock, flags); |
4444 |
+ |
4445 |
+@@ -917,24 +986,54 @@ int siw_post_receive(struct ib_qp *base_qp, const struct ib_recv_wr *wr, |
4446 |
+ *bad_wr = wr; |
4447 |
+ return -EOPNOTSUPP; /* what else from errno.h? */ |
4448 |
+ } |
4449 |
++ if (!qp->kernel_verbs) { |
4450 |
++ siw_dbg_qp(qp, "no kernel post_recv for user mapped sq\n"); |
4451 |
++ *bad_wr = wr; |
4452 |
++ return -EINVAL; |
4453 |
++ } |
4454 |
++ |
4455 |
+ /* |
4456 |
+ * Try to acquire QP state lock. Must be non-blocking |
4457 |
+ * to accommodate kernel clients needs. |
4458 |
+ */ |
4459 |
+ if (!down_read_trylock(&qp->state_lock)) { |
4460 |
+- *bad_wr = wr; |
4461 |
+- return -ENOTCONN; |
4462 |
+- } |
4463 |
+- if (!qp->kernel_verbs) { |
4464 |
+- siw_dbg_qp(qp, "no kernel post_recv for user mapped sq\n"); |
4465 |
+- up_read(&qp->state_lock); |
4466 |
+- *bad_wr = wr; |
4467 |
+- return -EINVAL; |
4468 |
++ if (qp->attrs.state == SIW_QP_STATE_ERROR) { |
4469 |
++ /* |
4470 |
++ * ERROR state is final, so we can be sure |
4471 |
++ * this state will not change as long as the QP |
4472 |
++ * exists. |
4473 |
++ * |
4474 |
++ * This handles an ib_drain_rq() call with |
4475 |
++ * a concurrent request to set the QP state |
4476 |
++ * to ERROR. |
4477 |
++ */ |
4478 |
++ rv = siw_rq_flush_wr(qp, wr, bad_wr); |
4479 |
++ } else { |
4480 |
++ siw_dbg_qp(qp, "QP locked, state %d\n", |
4481 |
++ qp->attrs.state); |
4482 |
++ *bad_wr = wr; |
4483 |
++ rv = -ENOTCONN; |
4484 |
++ } |
4485 |
++ return rv; |
4486 |
+ } |
4487 |
+ if (qp->attrs.state > SIW_QP_STATE_RTS) { |
4488 |
++ if (qp->attrs.state == SIW_QP_STATE_ERROR) { |
4489 |
++ /* |
4490 |
++ * Immediately flush this WR to CQ, if QP |
4491 |
++ * is in ERROR state. RQ is guaranteed to |
4492 |
++ * be empty, so WR complets in-order. |
4493 |
++ * |
4494 |
++ * Typically triggered by ib_drain_rq(). |
4495 |
++ */ |
4496 |
++ rv = siw_rq_flush_wr(qp, wr, bad_wr); |
4497 |
++ } else { |
4498 |
++ siw_dbg_qp(qp, "QP out of state %d\n", |
4499 |
++ qp->attrs.state); |
4500 |
++ *bad_wr = wr; |
4501 |
++ rv = -ENOTCONN; |
4502 |
++ } |
4503 |
+ up_read(&qp->state_lock); |
4504 |
+- *bad_wr = wr; |
4505 |
+- return -EINVAL; |
4506 |
++ return rv; |
4507 |
+ } |
4508 |
+ /* |
4509 |
+ * Serialize potentially multiple producers. |
4510 |
+diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.c b/drivers/infiniband/ulp/iser/iscsi_iser.c |
4511 |
+index 2e72fc5af157..c4c015c60446 100644 |
4512 |
+--- a/drivers/infiniband/ulp/iser/iscsi_iser.c |
4513 |
++++ b/drivers/infiniband/ulp/iser/iscsi_iser.c |
4514 |
+@@ -646,6 +646,7 @@ iscsi_iser_session_create(struct iscsi_endpoint *ep, |
4515 |
+ if (ib_conn->pi_support) { |
4516 |
+ u32 sig_caps = ib_dev->attrs.sig_prot_cap; |
4517 |
+ |
4518 |
++ shost->sg_prot_tablesize = shost->sg_tablesize; |
4519 |
+ scsi_host_set_prot(shost, iser_dif_prot_caps(sig_caps)); |
4520 |
+ scsi_host_set_guard(shost, SHOST_DIX_GUARD_IP | |
4521 |
+ SHOST_DIX_GUARD_CRC); |
4522 |
+diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c |
4523 |
+index 6db6d969e31c..4ce797d4259f 100644 |
4524 |
+--- a/drivers/iommu/intel-iommu.c |
4525 |
++++ b/drivers/iommu/intel-iommu.c |
4526 |
+@@ -5447,9 +5447,6 @@ static int intel_iommu_map(struct iommu_domain *domain, |
4527 |
+ int prot = 0; |
4528 |
+ int ret; |
4529 |
+ |
4530 |
+- if (dmar_domain->flags & DOMAIN_FLAG_LOSE_CHILDREN) |
4531 |
+- return -EINVAL; |
4532 |
+- |
4533 |
+ if (iommu_prot & IOMMU_READ) |
4534 |
+ prot |= DMA_PTE_READ; |
4535 |
+ if (iommu_prot & IOMMU_WRITE) |
4536 |
+@@ -5492,8 +5489,6 @@ static size_t intel_iommu_unmap(struct iommu_domain *domain, |
4537 |
+ /* Cope with horrid API which requires us to unmap more than the |
4538 |
+ size argument if it happens to be a large-page mapping. */ |
4539 |
+ BUG_ON(!pfn_to_dma_pte(dmar_domain, iova >> VTD_PAGE_SHIFT, &level)); |
4540 |
+- if (dmar_domain->flags & DOMAIN_FLAG_LOSE_CHILDREN) |
4541 |
+- return 0; |
4542 |
+ |
4543 |
+ if (size < VTD_PAGE_SIZE << level_to_offset_bits(level)) |
4544 |
+ size = VTD_PAGE_SIZE << level_to_offset_bits(level); |
4545 |
+@@ -5525,9 +5520,6 @@ static phys_addr_t intel_iommu_iova_to_phys(struct iommu_domain *domain, |
4546 |
+ int level = 0; |
4547 |
+ u64 phys = 0; |
4548 |
+ |
4549 |
+- if (dmar_domain->flags & DOMAIN_FLAG_LOSE_CHILDREN) |
4550 |
+- return 0; |
4551 |
+- |
4552 |
+ pte = pfn_to_dma_pte(dmar_domain, iova >> VTD_PAGE_SHIFT, &level); |
4553 |
+ if (pte) |
4554 |
+ phys = dma_pte_addr(pte); |
4555 |
+@@ -5705,8 +5697,8 @@ static void intel_iommu_get_resv_regions(struct device *device, |
4556 |
+ struct pci_dev *pdev = to_pci_dev(device); |
4557 |
+ |
4558 |
+ if ((pdev->class >> 8) == PCI_CLASS_BRIDGE_ISA) { |
4559 |
+- reg = iommu_alloc_resv_region(0, 1UL << 24, 0, |
4560 |
+- IOMMU_RESV_DIRECT); |
4561 |
++ reg = iommu_alloc_resv_region(0, 1UL << 24, prot, |
4562 |
++ IOMMU_RESV_DIRECT_RELAXABLE); |
4563 |
+ if (reg) |
4564 |
+ list_add_tail(®->list, head); |
4565 |
+ } |
4566 |
+diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c |
4567 |
+index d658c7c6a2ab..24248aa8a7e5 100644 |
4568 |
+--- a/drivers/iommu/iommu.c |
4569 |
++++ b/drivers/iommu/iommu.c |
4570 |
+@@ -312,8 +312,8 @@ int iommu_insert_resv_region(struct iommu_resv_region *new, |
4571 |
+ list_for_each_entry_safe(iter, tmp, regions, list) { |
4572 |
+ phys_addr_t top_end, iter_end = iter->start + iter->length - 1; |
4573 |
+ |
4574 |
+- /* no merge needed on elements of different types than @nr */ |
4575 |
+- if (iter->type != nr->type) { |
4576 |
++ /* no merge needed on elements of different types than @new */ |
4577 |
++ if (iter->type != new->type) { |
4578 |
+ list_move_tail(&iter->list, &stack); |
4579 |
+ continue; |
4580 |
+ } |
4581 |
+@@ -2221,13 +2221,13 @@ request_default_domain_for_dev(struct device *dev, unsigned long type) |
4582 |
+ goto out; |
4583 |
+ } |
4584 |
+ |
4585 |
+- iommu_group_create_direct_mappings(group, dev); |
4586 |
+- |
4587 |
+ /* Make the domain the default for this group */ |
4588 |
+ if (group->default_domain) |
4589 |
+ iommu_domain_free(group->default_domain); |
4590 |
+ group->default_domain = domain; |
4591 |
+ |
4592 |
++ iommu_group_create_direct_mappings(group, dev); |
4593 |
++ |
4594 |
+ dev_info(dev, "Using iommu %s mapping\n", |
4595 |
+ type == IOMMU_DOMAIN_DMA ? "dma" : "direct"); |
4596 |
+ |
4597 |
+diff --git a/drivers/md/bcache/alloc.c b/drivers/md/bcache/alloc.c |
4598 |
+index 6f776823b9ba..a1df0d95151c 100644 |
4599 |
+--- a/drivers/md/bcache/alloc.c |
4600 |
++++ b/drivers/md/bcache/alloc.c |
4601 |
+@@ -377,7 +377,10 @@ retry_invalidate: |
4602 |
+ if (!fifo_full(&ca->free_inc)) |
4603 |
+ goto retry_invalidate; |
4604 |
+ |
4605 |
+- bch_prio_write(ca); |
4606 |
++ if (bch_prio_write(ca, false) < 0) { |
4607 |
++ ca->invalidate_needs_gc = 1; |
4608 |
++ wake_up_gc(ca->set); |
4609 |
++ } |
4610 |
+ } |
4611 |
+ } |
4612 |
+ out: |
4613 |
+diff --git a/drivers/md/bcache/bcache.h b/drivers/md/bcache/bcache.h |
4614 |
+index 013e35a9e317..deb924e1d790 100644 |
4615 |
+--- a/drivers/md/bcache/bcache.h |
4616 |
++++ b/drivers/md/bcache/bcache.h |
4617 |
+@@ -977,7 +977,7 @@ bool bch_cached_dev_error(struct cached_dev *dc); |
4618 |
+ __printf(2, 3) |
4619 |
+ bool bch_cache_set_error(struct cache_set *c, const char *fmt, ...); |
4620 |
+ |
4621 |
+-void bch_prio_write(struct cache *ca); |
4622 |
++int bch_prio_write(struct cache *ca, bool wait); |
4623 |
+ void bch_write_bdev_super(struct cached_dev *dc, struct closure *parent); |
4624 |
+ |
4625 |
+ extern struct workqueue_struct *bcache_wq; |
4626 |
+diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c |
4627 |
+index 20ed838e9413..64999c7a8033 100644 |
4628 |
+--- a/drivers/md/bcache/super.c |
4629 |
++++ b/drivers/md/bcache/super.c |
4630 |
+@@ -529,12 +529,29 @@ static void prio_io(struct cache *ca, uint64_t bucket, int op, |
4631 |
+ closure_sync(cl); |
4632 |
+ } |
4633 |
+ |
4634 |
+-void bch_prio_write(struct cache *ca) |
4635 |
++int bch_prio_write(struct cache *ca, bool wait) |
4636 |
+ { |
4637 |
+ int i; |
4638 |
+ struct bucket *b; |
4639 |
+ struct closure cl; |
4640 |
+ |
4641 |
++ pr_debug("free_prio=%zu, free_none=%zu, free_inc=%zu", |
4642 |
++ fifo_used(&ca->free[RESERVE_PRIO]), |
4643 |
++ fifo_used(&ca->free[RESERVE_NONE]), |
4644 |
++ fifo_used(&ca->free_inc)); |
4645 |
++ |
4646 |
++ /* |
4647 |
++ * Pre-check if there are enough free buckets. In the non-blocking |
4648 |
++ * scenario it's better to fail early rather than starting to allocate |
4649 |
++ * buckets and do a cleanup later in case of failure. |
4650 |
++ */ |
4651 |
++ if (!wait) { |
4652 |
++ size_t avail = fifo_used(&ca->free[RESERVE_PRIO]) + |
4653 |
++ fifo_used(&ca->free[RESERVE_NONE]); |
4654 |
++ if (prio_buckets(ca) > avail) |
4655 |
++ return -ENOMEM; |
4656 |
++ } |
4657 |
++ |
4658 |
+ closure_init_stack(&cl); |
4659 |
+ |
4660 |
+ lockdep_assert_held(&ca->set->bucket_lock); |
4661 |
+@@ -544,9 +561,6 @@ void bch_prio_write(struct cache *ca) |
4662 |
+ atomic_long_add(ca->sb.bucket_size * prio_buckets(ca), |
4663 |
+ &ca->meta_sectors_written); |
4664 |
+ |
4665 |
+- //pr_debug("free %zu, free_inc %zu, unused %zu", fifo_used(&ca->free), |
4666 |
+- // fifo_used(&ca->free_inc), fifo_used(&ca->unused)); |
4667 |
+- |
4668 |
+ for (i = prio_buckets(ca) - 1; i >= 0; --i) { |
4669 |
+ long bucket; |
4670 |
+ struct prio_set *p = ca->disk_buckets; |
4671 |
+@@ -564,7 +578,7 @@ void bch_prio_write(struct cache *ca) |
4672 |
+ p->magic = pset_magic(&ca->sb); |
4673 |
+ p->csum = bch_crc64(&p->magic, bucket_bytes(ca) - 8); |
4674 |
+ |
4675 |
+- bucket = bch_bucket_alloc(ca, RESERVE_PRIO, true); |
4676 |
++ bucket = bch_bucket_alloc(ca, RESERVE_PRIO, wait); |
4677 |
+ BUG_ON(bucket == -1); |
4678 |
+ |
4679 |
+ mutex_unlock(&ca->set->bucket_lock); |
4680 |
+@@ -593,6 +607,7 @@ void bch_prio_write(struct cache *ca) |
4681 |
+ |
4682 |
+ ca->prio_last_buckets[i] = ca->prio_buckets[i]; |
4683 |
+ } |
4684 |
++ return 0; |
4685 |
+ } |
4686 |
+ |
4687 |
+ static void prio_read(struct cache *ca, uint64_t bucket) |
4688 |
+@@ -761,20 +776,28 @@ static inline int idx_to_first_minor(int idx) |
4689 |
+ |
4690 |
+ static void bcache_device_free(struct bcache_device *d) |
4691 |
+ { |
4692 |
++ struct gendisk *disk = d->disk; |
4693 |
++ |
4694 |
+ lockdep_assert_held(&bch_register_lock); |
4695 |
+ |
4696 |
+- pr_info("%s stopped", d->disk->disk_name); |
4697 |
++ if (disk) |
4698 |
++ pr_info("%s stopped", disk->disk_name); |
4699 |
++ else |
4700 |
++ pr_err("bcache device (NULL gendisk) stopped"); |
4701 |
+ |
4702 |
+ if (d->c) |
4703 |
+ bcache_device_detach(d); |
4704 |
+- if (d->disk && d->disk->flags & GENHD_FL_UP) |
4705 |
+- del_gendisk(d->disk); |
4706 |
+- if (d->disk && d->disk->queue) |
4707 |
+- blk_cleanup_queue(d->disk->queue); |
4708 |
+- if (d->disk) { |
4709 |
++ |
4710 |
++ if (disk) { |
4711 |
++ if (disk->flags & GENHD_FL_UP) |
4712 |
++ del_gendisk(disk); |
4713 |
++ |
4714 |
++ if (disk->queue) |
4715 |
++ blk_cleanup_queue(disk->queue); |
4716 |
++ |
4717 |
+ ida_simple_remove(&bcache_device_idx, |
4718 |
+- first_minor_to_idx(d->disk->first_minor)); |
4719 |
+- put_disk(d->disk); |
4720 |
++ first_minor_to_idx(disk->first_minor)); |
4721 |
++ put_disk(disk); |
4722 |
+ } |
4723 |
+ |
4724 |
+ bioset_exit(&d->bio_split); |
4725 |
+@@ -1954,7 +1977,7 @@ static int run_cache_set(struct cache_set *c) |
4726 |
+ |
4727 |
+ mutex_lock(&c->bucket_lock); |
4728 |
+ for_each_cache(ca, c, i) |
4729 |
+- bch_prio_write(ca); |
4730 |
++ bch_prio_write(ca, true); |
4731 |
+ mutex_unlock(&c->bucket_lock); |
4732 |
+ |
4733 |
+ err = "cannot allocate new UUID bucket"; |
4734 |
+diff --git a/drivers/md/md-bitmap.c b/drivers/md/md-bitmap.c |
4735 |
+index b092c7b5282f..3ad18246fcb3 100644 |
4736 |
+--- a/drivers/md/md-bitmap.c |
4737 |
++++ b/drivers/md/md-bitmap.c |
4738 |
+@@ -2139,6 +2139,7 @@ int md_bitmap_resize(struct bitmap *bitmap, sector_t blocks, |
4739 |
+ memcpy(page_address(store.sb_page), |
4740 |
+ page_address(bitmap->storage.sb_page), |
4741 |
+ sizeof(bitmap_super_t)); |
4742 |
++ spin_lock_irq(&bitmap->counts.lock); |
4743 |
+ md_bitmap_file_unmap(&bitmap->storage); |
4744 |
+ bitmap->storage = store; |
4745 |
+ |
4746 |
+@@ -2154,7 +2155,6 @@ int md_bitmap_resize(struct bitmap *bitmap, sector_t blocks, |
4747 |
+ blocks = min(old_counts.chunks << old_counts.chunkshift, |
4748 |
+ chunks << chunkshift); |
4749 |
+ |
4750 |
+- spin_lock_irq(&bitmap->counts.lock); |
4751 |
+ /* For cluster raid, need to pre-allocate bitmap */ |
4752 |
+ if (mddev_is_clustered(bitmap->mddev)) { |
4753 |
+ unsigned long page; |
4754 |
+diff --git a/drivers/md/md.c b/drivers/md/md.c |
4755 |
+index b8dd56b746da..805b33e27496 100644 |
4756 |
+--- a/drivers/md/md.c |
4757 |
++++ b/drivers/md/md.c |
4758 |
+@@ -1105,6 +1105,7 @@ static int super_90_load(struct md_rdev *rdev, struct md_rdev *refdev, int minor |
4759 |
+ char b[BDEVNAME_SIZE], b2[BDEVNAME_SIZE]; |
4760 |
+ mdp_super_t *sb; |
4761 |
+ int ret; |
4762 |
++ bool spare_disk = true; |
4763 |
+ |
4764 |
+ /* |
4765 |
+ * Calculate the position of the superblock (512byte sectors), |
4766 |
+@@ -1155,8 +1156,18 @@ static int super_90_load(struct md_rdev *rdev, struct md_rdev *refdev, int minor |
4767 |
+ else |
4768 |
+ rdev->desc_nr = sb->this_disk.number; |
4769 |
+ |
4770 |
++ /* not spare disk, or LEVEL_MULTIPATH */ |
4771 |
++ if (sb->level == LEVEL_MULTIPATH || |
4772 |
++ (rdev->desc_nr >= 0 && |
4773 |
++ sb->disks[rdev->desc_nr].state & |
4774 |
++ ((1<<MD_DISK_SYNC) | (1 << MD_DISK_ACTIVE)))) |
4775 |
++ spare_disk = false; |
4776 |
++ |
4777 |
+ if (!refdev) { |
4778 |
+- ret = 1; |
4779 |
++ if (!spare_disk) |
4780 |
++ ret = 1; |
4781 |
++ else |
4782 |
++ ret = 0; |
4783 |
+ } else { |
4784 |
+ __u64 ev1, ev2; |
4785 |
+ mdp_super_t *refsb = page_address(refdev->sb_page); |
4786 |
+@@ -1172,7 +1183,8 @@ static int super_90_load(struct md_rdev *rdev, struct md_rdev *refdev, int minor |
4787 |
+ } |
4788 |
+ ev1 = md_event(sb); |
4789 |
+ ev2 = md_event(refsb); |
4790 |
+- if (ev1 > ev2) |
4791 |
++ |
4792 |
++ if (!spare_disk && ev1 > ev2) |
4793 |
+ ret = 1; |
4794 |
+ else |
4795 |
+ ret = 0; |
4796 |
+@@ -1532,6 +1544,7 @@ static int super_1_load(struct md_rdev *rdev, struct md_rdev *refdev, int minor_ |
4797 |
+ sector_t sectors; |
4798 |
+ char b[BDEVNAME_SIZE], b2[BDEVNAME_SIZE]; |
4799 |
+ int bmask; |
4800 |
++ bool spare_disk = true; |
4801 |
+ |
4802 |
+ /* |
4803 |
+ * Calculate the position of the superblock in 512byte sectors. |
4804 |
+@@ -1665,8 +1678,19 @@ static int super_1_load(struct md_rdev *rdev, struct md_rdev *refdev, int minor_ |
4805 |
+ sb->level != 0) |
4806 |
+ return -EINVAL; |
4807 |
+ |
4808 |
++ /* not spare disk, or LEVEL_MULTIPATH */ |
4809 |
++ if (sb->level == cpu_to_le32(LEVEL_MULTIPATH) || |
4810 |
++ (rdev->desc_nr >= 0 && |
4811 |
++ rdev->desc_nr < le32_to_cpu(sb->max_dev) && |
4812 |
++ (le16_to_cpu(sb->dev_roles[rdev->desc_nr]) < MD_DISK_ROLE_MAX || |
4813 |
++ le16_to_cpu(sb->dev_roles[rdev->desc_nr]) == MD_DISK_ROLE_JOURNAL))) |
4814 |
++ spare_disk = false; |
4815 |
++ |
4816 |
+ if (!refdev) { |
4817 |
+- ret = 1; |
4818 |
++ if (!spare_disk) |
4819 |
++ ret = 1; |
4820 |
++ else |
4821 |
++ ret = 0; |
4822 |
+ } else { |
4823 |
+ __u64 ev1, ev2; |
4824 |
+ struct mdp_superblock_1 *refsb = page_address(refdev->sb_page); |
4825 |
+@@ -1683,7 +1707,7 @@ static int super_1_load(struct md_rdev *rdev, struct md_rdev *refdev, int minor_ |
4826 |
+ ev1 = le64_to_cpu(sb->events); |
4827 |
+ ev2 = le64_to_cpu(refsb->events); |
4828 |
+ |
4829 |
+- if (ev1 > ev2) |
4830 |
++ if (!spare_disk && ev1 > ev2) |
4831 |
+ ret = 1; |
4832 |
+ else |
4833 |
+ ret = 0; |
4834 |
+@@ -3604,7 +3628,7 @@ abort_free: |
4835 |
+ * Check a full RAID array for plausibility |
4836 |
+ */ |
4837 |
+ |
4838 |
+-static void analyze_sbs(struct mddev *mddev) |
4839 |
++static int analyze_sbs(struct mddev *mddev) |
4840 |
+ { |
4841 |
+ int i; |
4842 |
+ struct md_rdev *rdev, *freshest, *tmp; |
4843 |
+@@ -3625,6 +3649,12 @@ static void analyze_sbs(struct mddev *mddev) |
4844 |
+ md_kick_rdev_from_array(rdev); |
4845 |
+ } |
4846 |
+ |
4847 |
++ /* Cannot find a valid fresh disk */ |
4848 |
++ if (!freshest) { |
4849 |
++ pr_warn("md: cannot find a valid disk\n"); |
4850 |
++ return -EINVAL; |
4851 |
++ } |
4852 |
++ |
4853 |
+ super_types[mddev->major_version]. |
4854 |
+ validate_super(mddev, freshest); |
4855 |
+ |
4856 |
+@@ -3659,6 +3689,8 @@ static void analyze_sbs(struct mddev *mddev) |
4857 |
+ clear_bit(In_sync, &rdev->flags); |
4858 |
+ } |
4859 |
+ } |
4860 |
++ |
4861 |
++ return 0; |
4862 |
+ } |
4863 |
+ |
4864 |
+ /* Read a fixed-point number. |
4865 |
+@@ -5577,7 +5609,9 @@ int md_run(struct mddev *mddev) |
4866 |
+ if (!mddev->raid_disks) { |
4867 |
+ if (!mddev->persistent) |
4868 |
+ return -EINVAL; |
4869 |
+- analyze_sbs(mddev); |
4870 |
++ err = analyze_sbs(mddev); |
4871 |
++ if (err) |
4872 |
++ return -EINVAL; |
4873 |
+ } |
4874 |
+ |
4875 |
+ if (mddev->level != LEVEL_NONE) |
4876 |
+diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig |
4877 |
+index 7eee1812bba3..fcffcc31d168 100644 |
4878 |
+--- a/drivers/media/i2c/Kconfig |
4879 |
++++ b/drivers/media/i2c/Kconfig |
4880 |
+@@ -1113,6 +1113,7 @@ comment "SDR tuner chips" |
4881 |
+ config SDR_MAX2175 |
4882 |
+ tristate "Maxim 2175 RF to Bits tuner" |
4883 |
+ depends on VIDEO_V4L2 && MEDIA_SDR_SUPPORT && I2C |
4884 |
++ select REGMAP_I2C |
4885 |
+ help |
4886 |
+ Support for Maxim 2175 tuner. It is an advanced analog/digital |
4887 |
+ radio receiver with RF-to-Bits front-end designed for SDR solutions. |
4888 |
+diff --git a/drivers/media/i2c/ad5820.c b/drivers/media/i2c/ad5820.c |
4889 |
+index 925c171e7797..7a49651f4d1f 100644 |
4890 |
+--- a/drivers/media/i2c/ad5820.c |
4891 |
++++ b/drivers/media/i2c/ad5820.c |
4892 |
+@@ -309,6 +309,7 @@ static int ad5820_probe(struct i2c_client *client, |
4893 |
+ v4l2_i2c_subdev_init(&coil->subdev, client, &ad5820_ops); |
4894 |
+ coil->subdev.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; |
4895 |
+ coil->subdev.internal_ops = &ad5820_internal_ops; |
4896 |
++ coil->subdev.entity.function = MEDIA_ENT_F_LENS; |
4897 |
+ strscpy(coil->subdev.name, "ad5820 focus", sizeof(coil->subdev.name)); |
4898 |
+ |
4899 |
+ ret = media_entity_pads_init(&coil->subdev.entity, 0, NULL); |
4900 |
+diff --git a/drivers/media/i2c/ov2659.c b/drivers/media/i2c/ov2659.c |
4901 |
+index f4ded0669ff9..e1ff38009cf0 100644 |
4902 |
+--- a/drivers/media/i2c/ov2659.c |
4903 |
++++ b/drivers/media/i2c/ov2659.c |
4904 |
+@@ -419,10 +419,14 @@ static struct sensor_register ov2659_720p[] = { |
4905 |
+ { REG_TIMING_YINC, 0x11 }, |
4906 |
+ { REG_TIMING_VERT_FORMAT, 0x80 }, |
4907 |
+ { REG_TIMING_HORIZ_FORMAT, 0x00 }, |
4908 |
++ { 0x370a, 0x12 }, |
4909 |
+ { 0x3a03, 0xe8 }, |
4910 |
+ { 0x3a09, 0x6f }, |
4911 |
+ { 0x3a0b, 0x5d }, |
4912 |
+ { 0x3a15, 0x9a }, |
4913 |
++ { REG_VFIFO_READ_START_H, 0x00 }, |
4914 |
++ { REG_VFIFO_READ_START_L, 0x80 }, |
4915 |
++ { REG_ISP_CTRL02, 0x00 }, |
4916 |
+ { REG_NULL, 0x00 }, |
4917 |
+ }; |
4918 |
+ |
4919 |
+@@ -1201,11 +1205,15 @@ static int ov2659_s_stream(struct v4l2_subdev *sd, int on) |
4920 |
+ goto unlock; |
4921 |
+ } |
4922 |
+ |
4923 |
+- ov2659_set_pixel_clock(ov2659); |
4924 |
+- ov2659_set_frame_size(ov2659); |
4925 |
+- ov2659_set_format(ov2659); |
4926 |
+- ov2659_set_streaming(ov2659, 1); |
4927 |
+- ov2659->streaming = on; |
4928 |
++ ret = ov2659_set_pixel_clock(ov2659); |
4929 |
++ if (!ret) |
4930 |
++ ret = ov2659_set_frame_size(ov2659); |
4931 |
++ if (!ret) |
4932 |
++ ret = ov2659_set_format(ov2659); |
4933 |
++ if (!ret) { |
4934 |
++ ov2659_set_streaming(ov2659, 1); |
4935 |
++ ov2659->streaming = on; |
4936 |
++ } |
4937 |
+ |
4938 |
+ unlock: |
4939 |
+ mutex_unlock(&ov2659->lock); |
4940 |
+diff --git a/drivers/media/i2c/ov5640.c b/drivers/media/i2c/ov5640.c |
4941 |
+index 500d9bbff10b..18dd2d717088 100644 |
4942 |
+--- a/drivers/media/i2c/ov5640.c |
4943 |
++++ b/drivers/media/i2c/ov5640.c |
4944 |
+@@ -1611,6 +1611,11 @@ ov5640_find_mode(struct ov5640_dev *sensor, enum ov5640_frame_rate fr, |
4945 |
+ !(mode->hact == 640 && mode->vact == 480)) |
4946 |
+ return NULL; |
4947 |
+ |
4948 |
++ /* 2592x1944 only works at 15fps max */ |
4949 |
++ if ((mode->hact == 2592 && mode->vact == 1944) && |
4950 |
++ fr > OV5640_15_FPS) |
4951 |
++ return NULL; |
4952 |
++ |
4953 |
+ return mode; |
4954 |
+ } |
4955 |
+ |
4956 |
+diff --git a/drivers/media/i2c/ov6650.c b/drivers/media/i2c/ov6650.c |
4957 |
+index 5b9af5e5b7f1..a5b2448c0abc 100644 |
4958 |
+--- a/drivers/media/i2c/ov6650.c |
4959 |
++++ b/drivers/media/i2c/ov6650.c |
4960 |
+@@ -130,6 +130,7 @@ |
4961 |
+ #define CLKRC_24MHz 0xc0 |
4962 |
+ #define CLKRC_DIV_MASK 0x3f |
4963 |
+ #define GET_CLKRC_DIV(x) (((x) & CLKRC_DIV_MASK) + 1) |
4964 |
++#define DEF_CLKRC 0x00 |
4965 |
+ |
4966 |
+ #define COMA_RESET BIT(7) |
4967 |
+ #define COMA_QCIF BIT(5) |
4968 |
+@@ -465,38 +466,39 @@ static int ov6650_set_selection(struct v4l2_subdev *sd, |
4969 |
+ { |
4970 |
+ struct i2c_client *client = v4l2_get_subdevdata(sd); |
4971 |
+ struct ov6650 *priv = to_ov6650(client); |
4972 |
+- struct v4l2_rect rect = sel->r; |
4973 |
+ int ret; |
4974 |
+ |
4975 |
+ if (sel->which != V4L2_SUBDEV_FORMAT_ACTIVE || |
4976 |
+ sel->target != V4L2_SEL_TGT_CROP) |
4977 |
+ return -EINVAL; |
4978 |
+ |
4979 |
+- v4l_bound_align_image(&rect.width, 2, W_CIF, 1, |
4980 |
+- &rect.height, 2, H_CIF, 1, 0); |
4981 |
+- v4l_bound_align_image(&rect.left, DEF_HSTRT << 1, |
4982 |
+- (DEF_HSTRT << 1) + W_CIF - (__s32)rect.width, 1, |
4983 |
+- &rect.top, DEF_VSTRT << 1, |
4984 |
+- (DEF_VSTRT << 1) + H_CIF - (__s32)rect.height, 1, |
4985 |
+- 0); |
4986 |
++ v4l_bound_align_image(&sel->r.width, 2, W_CIF, 1, |
4987 |
++ &sel->r.height, 2, H_CIF, 1, 0); |
4988 |
++ v4l_bound_align_image(&sel->r.left, DEF_HSTRT << 1, |
4989 |
++ (DEF_HSTRT << 1) + W_CIF - (__s32)sel->r.width, 1, |
4990 |
++ &sel->r.top, DEF_VSTRT << 1, |
4991 |
++ (DEF_VSTRT << 1) + H_CIF - (__s32)sel->r.height, |
4992 |
++ 1, 0); |
4993 |
+ |
4994 |
+- ret = ov6650_reg_write(client, REG_HSTRT, rect.left >> 1); |
4995 |
++ ret = ov6650_reg_write(client, REG_HSTRT, sel->r.left >> 1); |
4996 |
+ if (!ret) { |
4997 |
+- priv->rect.left = rect.left; |
4998 |
++ priv->rect.width += priv->rect.left - sel->r.left; |
4999 |
++ priv->rect.left = sel->r.left; |
5000 |
+ ret = ov6650_reg_write(client, REG_HSTOP, |
5001 |
+- (rect.left + rect.width) >> 1); |
5002 |
++ (sel->r.left + sel->r.width) >> 1); |
5003 |
+ } |
5004 |
+ if (!ret) { |
5005 |
+- priv->rect.width = rect.width; |
5006 |
+- ret = ov6650_reg_write(client, REG_VSTRT, rect.top >> 1); |
5007 |
++ priv->rect.width = sel->r.width; |
5008 |
++ ret = ov6650_reg_write(client, REG_VSTRT, sel->r.top >> 1); |
5009 |
+ } |
5010 |
+ if (!ret) { |
5011 |
+- priv->rect.top = rect.top; |
5012 |
++ priv->rect.height += priv->rect.top - sel->r.top; |
5013 |
++ priv->rect.top = sel->r.top; |
5014 |
+ ret = ov6650_reg_write(client, REG_VSTOP, |
5015 |
+- (rect.top + rect.height) >> 1); |
5016 |
++ (sel->r.top + sel->r.height) >> 1); |
5017 |
+ } |
5018 |
+ if (!ret) |
5019 |
+- priv->rect.height = rect.height; |
5020 |
++ priv->rect.height = sel->r.height; |
5021 |
+ |
5022 |
+ return ret; |
5023 |
+ } |
5024 |
+@@ -610,7 +612,6 @@ static int ov6650_s_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf) |
5025 |
+ dev_err(&client->dev, "Pixel format not handled: 0x%x\n", code); |
5026 |
+ return -EINVAL; |
5027 |
+ } |
5028 |
+- priv->code = code; |
5029 |
+ |
5030 |
+ if (code == MEDIA_BUS_FMT_Y8_1X8 || |
5031 |
+ code == MEDIA_BUS_FMT_SBGGR8_1X8) { |
5032 |
+@@ -636,7 +637,6 @@ static int ov6650_s_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf) |
5033 |
+ dev_dbg(&client->dev, "max resolution: CIF\n"); |
5034 |
+ coma_mask |= COMA_QCIF; |
5035 |
+ } |
5036 |
+- priv->half_scale = half_scale; |
5037 |
+ |
5038 |
+ clkrc = CLKRC_12MHz; |
5039 |
+ mclk = 12000000; |
5040 |
+@@ -654,8 +654,13 @@ static int ov6650_s_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf) |
5041 |
+ ret = ov6650_reg_rmw(client, REG_COMA, coma_set, coma_mask); |
5042 |
+ if (!ret) |
5043 |
+ ret = ov6650_reg_write(client, REG_CLKRC, clkrc); |
5044 |
+- if (!ret) |
5045 |
++ if (!ret) { |
5046 |
++ priv->half_scale = half_scale; |
5047 |
++ |
5048 |
+ ret = ov6650_reg_rmw(client, REG_COML, coml_set, coml_mask); |
5049 |
++ } |
5050 |
++ if (!ret) |
5051 |
++ priv->code = code; |
5052 |
+ |
5053 |
+ if (!ret) { |
5054 |
+ mf->colorspace = priv->colorspace; |
5055 |
+@@ -754,19 +759,17 @@ static int ov6650_s_frame_interval(struct v4l2_subdev *sd, |
5056 |
+ else if (div > GET_CLKRC_DIV(CLKRC_DIV_MASK)) |
5057 |
+ div = GET_CLKRC_DIV(CLKRC_DIV_MASK); |
5058 |
+ |
5059 |
+- /* |
5060 |
+- * Keep result to be used as tpf limit |
5061 |
+- * for subsequent clock divider calculations |
5062 |
+- */ |
5063 |
+- priv->tpf.numerator = div; |
5064 |
+- priv->tpf.denominator = FRAME_RATE_MAX; |
5065 |
++ tpf->numerator = div; |
5066 |
++ tpf->denominator = FRAME_RATE_MAX; |
5067 |
+ |
5068 |
+- clkrc = to_clkrc(&priv->tpf, priv->pclk_limit, priv->pclk_max); |
5069 |
++ clkrc = to_clkrc(tpf, priv->pclk_limit, priv->pclk_max); |
5070 |
+ |
5071 |
+ ret = ov6650_reg_rmw(client, REG_CLKRC, clkrc, CLKRC_DIV_MASK); |
5072 |
+ if (!ret) { |
5073 |
+- tpf->numerator = GET_CLKRC_DIV(clkrc); |
5074 |
+- tpf->denominator = FRAME_RATE_MAX; |
5075 |
++ priv->tpf.numerator = GET_CLKRC_DIV(clkrc); |
5076 |
++ priv->tpf.denominator = FRAME_RATE_MAX; |
5077 |
++ |
5078 |
++ *tpf = priv->tpf; |
5079 |
+ } |
5080 |
+ |
5081 |
+ return ret; |
5082 |
+@@ -989,8 +992,10 @@ static int ov6650_probe(struct i2c_client *client, |
5083 |
+ V4L2_CID_GAMMA, 0, 0xff, 1, 0x12); |
5084 |
+ |
5085 |
+ priv->subdev.ctrl_handler = &priv->hdl; |
5086 |
+- if (priv->hdl.error) |
5087 |
+- return priv->hdl.error; |
5088 |
++ if (priv->hdl.error) { |
5089 |
++ ret = priv->hdl.error; |
5090 |
++ goto ectlhdlfree; |
5091 |
++ } |
5092 |
+ |
5093 |
+ v4l2_ctrl_auto_cluster(2, &priv->autogain, 0, true); |
5094 |
+ v4l2_ctrl_auto_cluster(3, &priv->autowb, 0, true); |
5095 |
+@@ -1005,11 +1010,17 @@ static int ov6650_probe(struct i2c_client *client, |
5096 |
+ priv->code = MEDIA_BUS_FMT_YUYV8_2X8; |
5097 |
+ priv->colorspace = V4L2_COLORSPACE_JPEG; |
5098 |
+ |
5099 |
++ /* Hardware default frame interval */ |
5100 |
++ priv->tpf.numerator = GET_CLKRC_DIV(DEF_CLKRC); |
5101 |
++ priv->tpf.denominator = FRAME_RATE_MAX; |
5102 |
++ |
5103 |
+ priv->subdev.internal_ops = &ov6650_internal_ops; |
5104 |
+ |
5105 |
+ ret = v4l2_async_register_subdev(&priv->subdev); |
5106 |
+- if (ret) |
5107 |
+- v4l2_ctrl_handler_free(&priv->hdl); |
5108 |
++ if (!ret) |
5109 |
++ return 0; |
5110 |
++ectlhdlfree: |
5111 |
++ v4l2_ctrl_handler_free(&priv->hdl); |
5112 |
+ |
5113 |
+ return ret; |
5114 |
+ } |
5115 |
+diff --git a/drivers/media/i2c/smiapp/smiapp-core.c b/drivers/media/i2c/smiapp/smiapp-core.c |
5116 |
+index 9adf8e034e7d..42805dfbffeb 100644 |
5117 |
+--- a/drivers/media/i2c/smiapp/smiapp-core.c |
5118 |
++++ b/drivers/media/i2c/smiapp/smiapp-core.c |
5119 |
+@@ -3101,19 +3101,23 @@ static int smiapp_probe(struct i2c_client *client) |
5120 |
+ if (rval < 0) |
5121 |
+ goto out_media_entity_cleanup; |
5122 |
+ |
5123 |
+- rval = v4l2_async_register_subdev_sensor_common(&sensor->src->sd); |
5124 |
+- if (rval < 0) |
5125 |
+- goto out_media_entity_cleanup; |
5126 |
+- |
5127 |
+ pm_runtime_set_active(&client->dev); |
5128 |
+ pm_runtime_get_noresume(&client->dev); |
5129 |
+ pm_runtime_enable(&client->dev); |
5130 |
++ |
5131 |
++ rval = v4l2_async_register_subdev_sensor_common(&sensor->src->sd); |
5132 |
++ if (rval < 0) |
5133 |
++ goto out_disable_runtime_pm; |
5134 |
++ |
5135 |
+ pm_runtime_set_autosuspend_delay(&client->dev, 1000); |
5136 |
+ pm_runtime_use_autosuspend(&client->dev); |
5137 |
+ pm_runtime_put_autosuspend(&client->dev); |
5138 |
+ |
5139 |
+ return 0; |
5140 |
+ |
5141 |
++out_disable_runtime_pm: |
5142 |
++ pm_runtime_disable(&client->dev); |
5143 |
++ |
5144 |
+ out_media_entity_cleanup: |
5145 |
+ media_entity_cleanup(&sensor->src->sd.entity); |
5146 |
+ |
5147 |
+diff --git a/drivers/media/i2c/st-mipid02.c b/drivers/media/i2c/st-mipid02.c |
5148 |
+index 81285b8d5cfb..003ba22334cd 100644 |
5149 |
+--- a/drivers/media/i2c/st-mipid02.c |
5150 |
++++ b/drivers/media/i2c/st-mipid02.c |
5151 |
+@@ -971,6 +971,11 @@ static int mipid02_probe(struct i2c_client *client) |
5152 |
+ bridge->reset_gpio = devm_gpiod_get_optional(dev, "reset", |
5153 |
+ GPIOD_OUT_HIGH); |
5154 |
+ |
5155 |
++ if (IS_ERR(bridge->reset_gpio)) { |
5156 |
++ dev_err(dev, "failed to get reset GPIO\n"); |
5157 |
++ return PTR_ERR(bridge->reset_gpio); |
5158 |
++ } |
5159 |
++ |
5160 |
+ ret = mipid02_get_regulators(bridge); |
5161 |
+ if (ret) { |
5162 |
+ dev_err(dev, "failed to get regulators %d", ret); |
5163 |
+diff --git a/drivers/media/pci/cx88/cx88-video.c b/drivers/media/pci/cx88/cx88-video.c |
5164 |
+index dcc0f02aeb70..b8abcd550604 100644 |
5165 |
+--- a/drivers/media/pci/cx88/cx88-video.c |
5166 |
++++ b/drivers/media/pci/cx88/cx88-video.c |
5167 |
+@@ -1277,7 +1277,7 @@ static int cx8800_initdev(struct pci_dev *pci_dev, |
5168 |
+ core = cx88_core_get(dev->pci); |
5169 |
+ if (!core) { |
5170 |
+ err = -EINVAL; |
5171 |
+- goto fail_free; |
5172 |
++ goto fail_disable; |
5173 |
+ } |
5174 |
+ dev->core = core; |
5175 |
+ |
5176 |
+@@ -1323,7 +1323,7 @@ static int cx8800_initdev(struct pci_dev *pci_dev, |
5177 |
+ cc->step, cc->default_value); |
5178 |
+ if (!vc) { |
5179 |
+ err = core->audio_hdl.error; |
5180 |
+- goto fail_core; |
5181 |
++ goto fail_irq; |
5182 |
+ } |
5183 |
+ vc->priv = (void *)cc; |
5184 |
+ } |
5185 |
+@@ -1337,7 +1337,7 @@ static int cx8800_initdev(struct pci_dev *pci_dev, |
5186 |
+ cc->step, cc->default_value); |
5187 |
+ if (!vc) { |
5188 |
+ err = core->video_hdl.error; |
5189 |
+- goto fail_core; |
5190 |
++ goto fail_irq; |
5191 |
+ } |
5192 |
+ vc->priv = (void *)cc; |
5193 |
+ if (vc->id == V4L2_CID_CHROMA_AGC) |
5194 |
+@@ -1509,11 +1509,14 @@ static int cx8800_initdev(struct pci_dev *pci_dev, |
5195 |
+ |
5196 |
+ fail_unreg: |
5197 |
+ cx8800_unregister_video(dev); |
5198 |
+- free_irq(pci_dev->irq, dev); |
5199 |
+ mutex_unlock(&core->lock); |
5200 |
++fail_irq: |
5201 |
++ free_irq(pci_dev->irq, dev); |
5202 |
+ fail_core: |
5203 |
+ core->v4ldev = NULL; |
5204 |
+ cx88_core_put(core, dev->pci); |
5205 |
++fail_disable: |
5206 |
++ pci_disable_device(pci_dev); |
5207 |
+ fail_free: |
5208 |
+ kfree(dev); |
5209 |
+ return err; |
5210 |
+diff --git a/drivers/media/platform/am437x/am437x-vpfe.c b/drivers/media/platform/am437x/am437x-vpfe.c |
5211 |
+index 2b42ba1f5949..e13dbf27a9c2 100644 |
5212 |
+--- a/drivers/media/platform/am437x/am437x-vpfe.c |
5213 |
++++ b/drivers/media/platform/am437x/am437x-vpfe.c |
5214 |
+@@ -1830,6 +1830,10 @@ static int vpfe_s_std(struct file *file, void *priv, v4l2_std_id std_id) |
5215 |
+ if (!(sdinfo->inputs[0].capabilities & V4L2_IN_CAP_STD)) |
5216 |
+ return -ENODATA; |
5217 |
+ |
5218 |
++ /* if trying to set the same std then nothing to do */ |
5219 |
++ if (vpfe_standards[vpfe->std_index].std_id == std_id) |
5220 |
++ return 0; |
5221 |
++ |
5222 |
+ /* If streaming is started, return error */ |
5223 |
+ if (vb2_is_busy(&vpfe->buffer_queue)) { |
5224 |
+ vpfe_err(vpfe, "%s device busy\n", __func__); |
5225 |
+diff --git a/drivers/media/platform/aspeed-video.c b/drivers/media/platform/aspeed-video.c |
5226 |
+index eb12f3793062..096a7c9a8963 100644 |
5227 |
+--- a/drivers/media/platform/aspeed-video.c |
5228 |
++++ b/drivers/media/platform/aspeed-video.c |
5229 |
+@@ -606,6 +606,16 @@ static irqreturn_t aspeed_video_irq(int irq, void *arg) |
5230 |
+ aspeed_video_start_frame(video); |
5231 |
+ } |
5232 |
+ |
5233 |
++ /* |
5234 |
++ * CAPTURE_COMPLETE and FRAME_COMPLETE interrupts come even when these |
5235 |
++ * are disabled in the VE_INTERRUPT_CTRL register so clear them to |
5236 |
++ * prevent unnecessary interrupt calls. |
5237 |
++ */ |
5238 |
++ if (sts & VE_INTERRUPT_CAPTURE_COMPLETE) |
5239 |
++ sts &= ~VE_INTERRUPT_CAPTURE_COMPLETE; |
5240 |
++ if (sts & VE_INTERRUPT_FRAME_COMPLETE) |
5241 |
++ sts &= ~VE_INTERRUPT_FRAME_COMPLETE; |
5242 |
++ |
5243 |
+ return sts ? IRQ_NONE : IRQ_HANDLED; |
5244 |
+ } |
5245 |
+ |
5246 |
+@@ -741,6 +751,8 @@ static void aspeed_video_get_resolution(struct aspeed_video *video) |
5247 |
+ } |
5248 |
+ |
5249 |
+ set_bit(VIDEO_RES_DETECT, &video->flags); |
5250 |
++ aspeed_video_update(video, VE_CTRL, |
5251 |
++ VE_CTRL_VSYNC_POL | VE_CTRL_HSYNC_POL, 0); |
5252 |
+ aspeed_video_enable_mode_detect(video); |
5253 |
+ |
5254 |
+ rc = wait_event_interruptible_timeout(video->wait, |
5255 |
+diff --git a/drivers/media/platform/exynos4-is/media-dev.c b/drivers/media/platform/exynos4-is/media-dev.c |
5256 |
+index a838189d4490..9aaf3b8060d5 100644 |
5257 |
+--- a/drivers/media/platform/exynos4-is/media-dev.c |
5258 |
++++ b/drivers/media/platform/exynos4-is/media-dev.c |
5259 |
+@@ -1457,12 +1457,12 @@ static int fimc_md_probe(struct platform_device *pdev) |
5260 |
+ ret = v4l2_device_register(dev, &fmd->v4l2_dev); |
5261 |
+ if (ret < 0) { |
5262 |
+ v4l2_err(v4l2_dev, "Failed to register v4l2_device: %d\n", ret); |
5263 |
+- return ret; |
5264 |
++ goto err_md; |
5265 |
+ } |
5266 |
+ |
5267 |
+ ret = fimc_md_get_clocks(fmd); |
5268 |
+ if (ret) |
5269 |
+- goto err_md; |
5270 |
++ goto err_v4l2dev; |
5271 |
+ |
5272 |
+ ret = fimc_md_get_pinctrl(fmd); |
5273 |
+ if (ret < 0) { |
5274 |
+@@ -1519,9 +1519,10 @@ err_m_ent: |
5275 |
+ fimc_md_unregister_entities(fmd); |
5276 |
+ err_clk: |
5277 |
+ fimc_md_put_clocks(fmd); |
5278 |
++err_v4l2dev: |
5279 |
++ v4l2_device_unregister(&fmd->v4l2_dev); |
5280 |
+ err_md: |
5281 |
+ media_device_cleanup(&fmd->media_dev); |
5282 |
+- v4l2_device_unregister(&fmd->v4l2_dev); |
5283 |
+ return ret; |
5284 |
+ } |
5285 |
+ |
5286 |
+diff --git a/drivers/media/platform/meson/ao-cec-g12a.c b/drivers/media/platform/meson/ao-cec-g12a.c |
5287 |
+index 3b39e875292e..3d8fe854feb0 100644 |
5288 |
+--- a/drivers/media/platform/meson/ao-cec-g12a.c |
5289 |
++++ b/drivers/media/platform/meson/ao-cec-g12a.c |
5290 |
+@@ -662,34 +662,27 @@ static int meson_ao_cec_g12a_probe(struct platform_device *pdev) |
5291 |
+ if (IS_ERR(ao_cec->adap)) |
5292 |
+ return PTR_ERR(ao_cec->adap); |
5293 |
+ |
5294 |
+- ao_cec->notify = cec_notifier_cec_adap_register(hdmi_dev, NULL, |
5295 |
+- ao_cec->adap); |
5296 |
+- if (!ao_cec->notify) { |
5297 |
+- ret = -ENOMEM; |
5298 |
+- goto out_probe_adapter; |
5299 |
+- } |
5300 |
+- |
5301 |
+ ao_cec->adap->owner = THIS_MODULE; |
5302 |
+ |
5303 |
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
5304 |
+ base = devm_ioremap_resource(&pdev->dev, res); |
5305 |
+ if (IS_ERR(base)) { |
5306 |
+ ret = PTR_ERR(base); |
5307 |
+- goto out_probe_notify; |
5308 |
++ goto out_probe_adapter; |
5309 |
+ } |
5310 |
+ |
5311 |
+ ao_cec->regmap = devm_regmap_init_mmio(&pdev->dev, base, |
5312 |
+ &meson_ao_cec_g12a_regmap_conf); |
5313 |
+ if (IS_ERR(ao_cec->regmap)) { |
5314 |
+ ret = PTR_ERR(ao_cec->regmap); |
5315 |
+- goto out_probe_notify; |
5316 |
++ goto out_probe_adapter; |
5317 |
+ } |
5318 |
+ |
5319 |
+ ao_cec->regmap_cec = devm_regmap_init(&pdev->dev, NULL, ao_cec, |
5320 |
+ &meson_ao_cec_g12a_cec_regmap_conf); |
5321 |
+ if (IS_ERR(ao_cec->regmap_cec)) { |
5322 |
+ ret = PTR_ERR(ao_cec->regmap_cec); |
5323 |
+- goto out_probe_notify; |
5324 |
++ goto out_probe_adapter; |
5325 |
+ } |
5326 |
+ |
5327 |
+ irq = platform_get_irq(pdev, 0); |
5328 |
+@@ -699,45 +692,52 @@ static int meson_ao_cec_g12a_probe(struct platform_device *pdev) |
5329 |
+ 0, NULL, ao_cec); |
5330 |
+ if (ret) { |
5331 |
+ dev_err(&pdev->dev, "irq request failed\n"); |
5332 |
+- goto out_probe_notify; |
5333 |
++ goto out_probe_adapter; |
5334 |
+ } |
5335 |
+ |
5336 |
+ ao_cec->oscin = devm_clk_get(&pdev->dev, "oscin"); |
5337 |
+ if (IS_ERR(ao_cec->oscin)) { |
5338 |
+ dev_err(&pdev->dev, "oscin clock request failed\n"); |
5339 |
+ ret = PTR_ERR(ao_cec->oscin); |
5340 |
+- goto out_probe_notify; |
5341 |
++ goto out_probe_adapter; |
5342 |
+ } |
5343 |
+ |
5344 |
+ ret = meson_ao_cec_g12a_setup_clk(ao_cec); |
5345 |
+ if (ret) |
5346 |
+- goto out_probe_notify; |
5347 |
++ goto out_probe_adapter; |
5348 |
+ |
5349 |
+ ret = clk_prepare_enable(ao_cec->core); |
5350 |
+ if (ret) { |
5351 |
+ dev_err(&pdev->dev, "core clock enable failed\n"); |
5352 |
+- goto out_probe_notify; |
5353 |
++ goto out_probe_adapter; |
5354 |
+ } |
5355 |
+ |
5356 |
+ device_reset_optional(&pdev->dev); |
5357 |
+ |
5358 |
+ platform_set_drvdata(pdev, ao_cec); |
5359 |
+ |
5360 |
++ ao_cec->notify = cec_notifier_cec_adap_register(hdmi_dev, NULL, |
5361 |
++ ao_cec->adap); |
5362 |
++ if (!ao_cec->notify) { |
5363 |
++ ret = -ENOMEM; |
5364 |
++ goto out_probe_core_clk; |
5365 |
++ } |
5366 |
++ |
5367 |
+ ret = cec_register_adapter(ao_cec->adap, &pdev->dev); |
5368 |
+ if (ret < 0) |
5369 |
+- goto out_probe_core_clk; |
5370 |
++ goto out_probe_notify; |
5371 |
+ |
5372 |
+ /* Setup Hardware */ |
5373 |
+ regmap_write(ao_cec->regmap, CECB_GEN_CNTL_REG, CECB_GEN_CNTL_RESET); |
5374 |
+ |
5375 |
+ return 0; |
5376 |
+ |
5377 |
+-out_probe_core_clk: |
5378 |
+- clk_disable_unprepare(ao_cec->core); |
5379 |
+- |
5380 |
+ out_probe_notify: |
5381 |
+ cec_notifier_cec_adap_unregister(ao_cec->notify); |
5382 |
+ |
5383 |
++out_probe_core_clk: |
5384 |
++ clk_disable_unprepare(ao_cec->core); |
5385 |
++ |
5386 |
+ out_probe_adapter: |
5387 |
+ cec_delete_adapter(ao_cec->adap); |
5388 |
+ |
5389 |
+diff --git a/drivers/media/platform/meson/ao-cec.c b/drivers/media/platform/meson/ao-cec.c |
5390 |
+index 64ed549bf012..03600e8b3ef0 100644 |
5391 |
+--- a/drivers/media/platform/meson/ao-cec.c |
5392 |
++++ b/drivers/media/platform/meson/ao-cec.c |
5393 |
+@@ -624,20 +624,13 @@ static int meson_ao_cec_probe(struct platform_device *pdev) |
5394 |
+ if (IS_ERR(ao_cec->adap)) |
5395 |
+ return PTR_ERR(ao_cec->adap); |
5396 |
+ |
5397 |
+- ao_cec->notify = cec_notifier_cec_adap_register(hdmi_dev, NULL, |
5398 |
+- ao_cec->adap); |
5399 |
+- if (!ao_cec->notify) { |
5400 |
+- ret = -ENOMEM; |
5401 |
+- goto out_probe_adapter; |
5402 |
+- } |
5403 |
+- |
5404 |
+ ao_cec->adap->owner = THIS_MODULE; |
5405 |
+ |
5406 |
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
5407 |
+ ao_cec->base = devm_ioremap_resource(&pdev->dev, res); |
5408 |
+ if (IS_ERR(ao_cec->base)) { |
5409 |
+ ret = PTR_ERR(ao_cec->base); |
5410 |
+- goto out_probe_notify; |
5411 |
++ goto out_probe_adapter; |
5412 |
+ } |
5413 |
+ |
5414 |
+ irq = platform_get_irq(pdev, 0); |
5415 |
+@@ -647,20 +640,20 @@ static int meson_ao_cec_probe(struct platform_device *pdev) |
5416 |
+ 0, NULL, ao_cec); |
5417 |
+ if (ret) { |
5418 |
+ dev_err(&pdev->dev, "irq request failed\n"); |
5419 |
+- goto out_probe_notify; |
5420 |
++ goto out_probe_adapter; |
5421 |
+ } |
5422 |
+ |
5423 |
+ ao_cec->core = devm_clk_get(&pdev->dev, "core"); |
5424 |
+ if (IS_ERR(ao_cec->core)) { |
5425 |
+ dev_err(&pdev->dev, "core clock request failed\n"); |
5426 |
+ ret = PTR_ERR(ao_cec->core); |
5427 |
+- goto out_probe_notify; |
5428 |
++ goto out_probe_adapter; |
5429 |
+ } |
5430 |
+ |
5431 |
+ ret = clk_prepare_enable(ao_cec->core); |
5432 |
+ if (ret) { |
5433 |
+ dev_err(&pdev->dev, "core clock enable failed\n"); |
5434 |
+- goto out_probe_notify; |
5435 |
++ goto out_probe_adapter; |
5436 |
+ } |
5437 |
+ |
5438 |
+ ret = clk_set_rate(ao_cec->core, CEC_CLK_RATE); |
5439 |
+@@ -674,9 +667,16 @@ static int meson_ao_cec_probe(struct platform_device *pdev) |
5440 |
+ ao_cec->pdev = pdev; |
5441 |
+ platform_set_drvdata(pdev, ao_cec); |
5442 |
+ |
5443 |
++ ao_cec->notify = cec_notifier_cec_adap_register(hdmi_dev, NULL, |
5444 |
++ ao_cec->adap); |
5445 |
++ if (!ao_cec->notify) { |
5446 |
++ ret = -ENOMEM; |
5447 |
++ goto out_probe_clk; |
5448 |
++ } |
5449 |
++ |
5450 |
+ ret = cec_register_adapter(ao_cec->adap, &pdev->dev); |
5451 |
+ if (ret < 0) |
5452 |
+- goto out_probe_clk; |
5453 |
++ goto out_probe_notify; |
5454 |
+ |
5455 |
+ /* Setup Hardware */ |
5456 |
+ writel_relaxed(CEC_GEN_CNTL_RESET, |
5457 |
+@@ -684,12 +684,12 @@ static int meson_ao_cec_probe(struct platform_device *pdev) |
5458 |
+ |
5459 |
+ return 0; |
5460 |
+ |
5461 |
+-out_probe_clk: |
5462 |
+- clk_disable_unprepare(ao_cec->core); |
5463 |
+- |
5464 |
+ out_probe_notify: |
5465 |
+ cec_notifier_cec_adap_unregister(ao_cec->notify); |
5466 |
+ |
5467 |
++out_probe_clk: |
5468 |
++ clk_disable_unprepare(ao_cec->core); |
5469 |
++ |
5470 |
+ out_probe_adapter: |
5471 |
+ cec_delete_adapter(ao_cec->adap); |
5472 |
+ |
5473 |
+diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c |
5474 |
+index e6eff512a8a1..84e982f259a0 100644 |
5475 |
+--- a/drivers/media/platform/qcom/venus/core.c |
5476 |
++++ b/drivers/media/platform/qcom/venus/core.c |
5477 |
+@@ -427,10 +427,11 @@ static const struct venus_resources msm8916_res = { |
5478 |
+ }; |
5479 |
+ |
5480 |
+ static const struct freq_tbl msm8996_freq_table[] = { |
5481 |
+- { 1944000, 490000000 }, /* 4k UHD @ 60 */ |
5482 |
+- { 972000, 320000000 }, /* 4k UHD @ 30 */ |
5483 |
+- { 489600, 150000000 }, /* 1080p @ 60 */ |
5484 |
+- { 244800, 75000000 }, /* 1080p @ 30 */ |
5485 |
++ { 1944000, 520000000 }, /* 4k UHD @ 60 (decode only) */ |
5486 |
++ { 972000, 520000000 }, /* 4k UHD @ 30 */ |
5487 |
++ { 489600, 346666667 }, /* 1080p @ 60 */ |
5488 |
++ { 244800, 150000000 }, /* 1080p @ 30 */ |
5489 |
++ { 108000, 75000000 }, /* 720p @ 30 */ |
5490 |
+ }; |
5491 |
+ |
5492 |
+ static const struct reg_val msm8996_reg_preset[] = { |
5493 |
+diff --git a/drivers/media/platform/qcom/venus/hfi_venus.c b/drivers/media/platform/qcom/venus/hfi_venus.c |
5494 |
+index 7129a2aea09a..0d8855014ab3 100644 |
5495 |
+--- a/drivers/media/platform/qcom/venus/hfi_venus.c |
5496 |
++++ b/drivers/media/platform/qcom/venus/hfi_venus.c |
5497 |
+@@ -1472,6 +1472,7 @@ static int venus_suspend_3xx(struct venus_core *core) |
5498 |
+ { |
5499 |
+ struct venus_hfi_device *hdev = to_hfi_priv(core); |
5500 |
+ struct device *dev = core->dev; |
5501 |
++ u32 ctrl_status; |
5502 |
+ bool val; |
5503 |
+ int ret; |
5504 |
+ |
5505 |
+@@ -1487,6 +1488,10 @@ static int venus_suspend_3xx(struct venus_core *core) |
5506 |
+ return -EINVAL; |
5507 |
+ } |
5508 |
+ |
5509 |
++ ctrl_status = venus_readl(hdev, CPU_CS_SCIACMDARG0); |
5510 |
++ if (ctrl_status & CPU_CS_SCIACMDARG0_PC_READY) |
5511 |
++ goto power_off; |
5512 |
++ |
5513 |
+ /* |
5514 |
+ * Power collapse sequence for Venus 3xx and 4xx versions: |
5515 |
+ * 1. Check for ARM9 and video core to be idle by checking WFI bit |
5516 |
+@@ -1511,6 +1516,7 @@ static int venus_suspend_3xx(struct venus_core *core) |
5517 |
+ if (ret) |
5518 |
+ return ret; |
5519 |
+ |
5520 |
++power_off: |
5521 |
+ mutex_lock(&hdev->lock); |
5522 |
+ |
5523 |
+ ret = venus_power_off(hdev); |
5524 |
+diff --git a/drivers/media/platform/rcar_drif.c b/drivers/media/platform/rcar_drif.c |
5525 |
+index 608e5217ccd5..0f267a237b42 100644 |
5526 |
+--- a/drivers/media/platform/rcar_drif.c |
5527 |
++++ b/drivers/media/platform/rcar_drif.c |
5528 |
+@@ -912,6 +912,7 @@ static int rcar_drif_g_fmt_sdr_cap(struct file *file, void *priv, |
5529 |
+ { |
5530 |
+ struct rcar_drif_sdr *sdr = video_drvdata(file); |
5531 |
+ |
5532 |
++ memset(f->fmt.sdr.reserved, 0, sizeof(f->fmt.sdr.reserved)); |
5533 |
+ f->fmt.sdr.pixelformat = sdr->fmt->pixelformat; |
5534 |
+ f->fmt.sdr.buffersize = sdr->fmt->buffersize; |
5535 |
+ |
5536 |
+diff --git a/drivers/media/platform/seco-cec/seco-cec.c b/drivers/media/platform/seco-cec/seco-cec.c |
5537 |
+index 9cd60fe1867c..a86b6e8f9196 100644 |
5538 |
+--- a/drivers/media/platform/seco-cec/seco-cec.c |
5539 |
++++ b/drivers/media/platform/seco-cec/seco-cec.c |
5540 |
+@@ -675,6 +675,7 @@ err_notifier: |
5541 |
+ err_delete_adapter: |
5542 |
+ cec_delete_adapter(secocec->cec_adap); |
5543 |
+ err: |
5544 |
++ release_region(BRA_SMB_BASE_ADDR, 7); |
5545 |
+ dev_err(dev, "%s device probe failed\n", dev_name(dev)); |
5546 |
+ |
5547 |
+ return ret; |
5548 |
+diff --git a/drivers/media/platform/ti-vpe/vpdma.h b/drivers/media/platform/ti-vpe/vpdma.h |
5549 |
+index 28bc94129348..9bacfd603250 100644 |
5550 |
+--- a/drivers/media/platform/ti-vpe/vpdma.h |
5551 |
++++ b/drivers/media/platform/ti-vpe/vpdma.h |
5552 |
+@@ -57,6 +57,7 @@ struct vpdma_data_format { |
5553 |
+ * line stride of source and dest |
5554 |
+ * buffers should be 16 byte aligned |
5555 |
+ */ |
5556 |
++#define VPDMA_MAX_STRIDE 65520 /* Max line stride 16 byte aligned */ |
5557 |
+ #define VPDMA_DTD_DESC_SIZE 32 /* 8 words */ |
5558 |
+ #define VPDMA_CFD_CTD_DESC_SIZE 16 /* 4 words */ |
5559 |
+ |
5560 |
+diff --git a/drivers/media/platform/ti-vpe/vpe.c b/drivers/media/platform/ti-vpe/vpe.c |
5561 |
+index 60b575bb44c4..8b14ba4a3d9e 100644 |
5562 |
+--- a/drivers/media/platform/ti-vpe/vpe.c |
5563 |
++++ b/drivers/media/platform/ti-vpe/vpe.c |
5564 |
+@@ -338,20 +338,25 @@ enum { |
5565 |
+ }; |
5566 |
+ |
5567 |
+ /* find our format description corresponding to the passed v4l2_format */ |
5568 |
+-static struct vpe_fmt *find_format(struct v4l2_format *f) |
5569 |
++static struct vpe_fmt *__find_format(u32 fourcc) |
5570 |
+ { |
5571 |
+ struct vpe_fmt *fmt; |
5572 |
+ unsigned int k; |
5573 |
+ |
5574 |
+ for (k = 0; k < ARRAY_SIZE(vpe_formats); k++) { |
5575 |
+ fmt = &vpe_formats[k]; |
5576 |
+- if (fmt->fourcc == f->fmt.pix.pixelformat) |
5577 |
++ if (fmt->fourcc == fourcc) |
5578 |
+ return fmt; |
5579 |
+ } |
5580 |
+ |
5581 |
+ return NULL; |
5582 |
+ } |
5583 |
+ |
5584 |
++static struct vpe_fmt *find_format(struct v4l2_format *f) |
5585 |
++{ |
5586 |
++ return __find_format(f->fmt.pix.pixelformat); |
5587 |
++} |
5588 |
++ |
5589 |
+ /* |
5590 |
+ * there is one vpe_dev structure in the driver, it is shared by |
5591 |
+ * all instances. |
5592 |
+@@ -1013,11 +1018,14 @@ static void add_out_dtd(struct vpe_ctx *ctx, int port) |
5593 |
+ dma_addr_t dma_addr; |
5594 |
+ u32 flags = 0; |
5595 |
+ u32 offset = 0; |
5596 |
++ u32 stride; |
5597 |
+ |
5598 |
+ if (port == VPE_PORT_MV_OUT) { |
5599 |
+ vpdma_fmt = &vpdma_misc_fmts[VPDMA_DATA_FMT_MV]; |
5600 |
+ dma_addr = ctx->mv_buf_dma[mv_buf_selector]; |
5601 |
+ q_data = &ctx->q_data[Q_DATA_SRC]; |
5602 |
++ stride = ALIGN((q_data->width * vpdma_fmt->depth) >> 3, |
5603 |
++ VPDMA_STRIDE_ALIGN); |
5604 |
+ } else { |
5605 |
+ /* to incorporate interleaved formats */ |
5606 |
+ int plane = fmt->coplanar ? p_data->vb_part : 0; |
5607 |
+@@ -1044,6 +1052,7 @@ static void add_out_dtd(struct vpe_ctx *ctx, int port) |
5608 |
+ } |
5609 |
+ /* Apply the offset */ |
5610 |
+ dma_addr += offset; |
5611 |
++ stride = q_data->bytesperline[VPE_LUMA]; |
5612 |
+ } |
5613 |
+ |
5614 |
+ if (q_data->flags & Q_DATA_FRAME_1D) |
5615 |
+@@ -1055,7 +1064,7 @@ static void add_out_dtd(struct vpe_ctx *ctx, int port) |
5616 |
+ MAX_W, MAX_H); |
5617 |
+ |
5618 |
+ vpdma_add_out_dtd(&ctx->desc_list, q_data->width, |
5619 |
+- q_data->bytesperline[VPE_LUMA], &q_data->c_rect, |
5620 |
++ stride, &q_data->c_rect, |
5621 |
+ vpdma_fmt, dma_addr, MAX_OUT_WIDTH_REG1, |
5622 |
+ MAX_OUT_HEIGHT_REG1, p_data->channel, flags); |
5623 |
+ } |
5624 |
+@@ -1074,10 +1083,13 @@ static void add_in_dtd(struct vpe_ctx *ctx, int port) |
5625 |
+ dma_addr_t dma_addr; |
5626 |
+ u32 flags = 0; |
5627 |
+ u32 offset = 0; |
5628 |
++ u32 stride; |
5629 |
+ |
5630 |
+ if (port == VPE_PORT_MV_IN) { |
5631 |
+ vpdma_fmt = &vpdma_misc_fmts[VPDMA_DATA_FMT_MV]; |
5632 |
+ dma_addr = ctx->mv_buf_dma[mv_buf_selector]; |
5633 |
++ stride = ALIGN((q_data->width * vpdma_fmt->depth) >> 3, |
5634 |
++ VPDMA_STRIDE_ALIGN); |
5635 |
+ } else { |
5636 |
+ /* to incorporate interleaved formats */ |
5637 |
+ int plane = fmt->coplanar ? p_data->vb_part : 0; |
5638 |
+@@ -1104,6 +1116,7 @@ static void add_in_dtd(struct vpe_ctx *ctx, int port) |
5639 |
+ } |
5640 |
+ /* Apply the offset */ |
5641 |
+ dma_addr += offset; |
5642 |
++ stride = q_data->bytesperline[VPE_LUMA]; |
5643 |
+ |
5644 |
+ if (q_data->flags & Q_DATA_INTERLACED_SEQ_TB) { |
5645 |
+ /* |
5646 |
+@@ -1139,10 +1152,10 @@ static void add_in_dtd(struct vpe_ctx *ctx, int port) |
5647 |
+ if (p_data->vb_part && fmt->fourcc == V4L2_PIX_FMT_NV12) |
5648 |
+ frame_height /= 2; |
5649 |
+ |
5650 |
+- vpdma_add_in_dtd(&ctx->desc_list, q_data->width, |
5651 |
+- q_data->bytesperline[VPE_LUMA], &q_data->c_rect, |
5652 |
+- vpdma_fmt, dma_addr, p_data->channel, field, flags, frame_width, |
5653 |
+- frame_height, 0, 0); |
5654 |
++ vpdma_add_in_dtd(&ctx->desc_list, q_data->width, stride, |
5655 |
++ &q_data->c_rect, vpdma_fmt, dma_addr, |
5656 |
++ p_data->channel, field, flags, frame_width, |
5657 |
++ frame_height, 0, 0); |
5658 |
+ } |
5659 |
+ |
5660 |
+ /* |
5661 |
+@@ -1391,9 +1404,6 @@ static irqreturn_t vpe_irq(int irq_vpe, void *data) |
5662 |
+ /* the previous dst mv buffer becomes the next src mv buffer */ |
5663 |
+ ctx->src_mv_buf_selector = !ctx->src_mv_buf_selector; |
5664 |
+ |
5665 |
+- if (ctx->aborting) |
5666 |
+- goto finished; |
5667 |
+- |
5668 |
+ s_vb = ctx->src_vbs[0]; |
5669 |
+ d_vb = ctx->dst_vb; |
5670 |
+ |
5671 |
+@@ -1404,6 +1414,7 @@ static irqreturn_t vpe_irq(int irq_vpe, void *data) |
5672 |
+ d_vb->timecode = s_vb->timecode; |
5673 |
+ |
5674 |
+ d_vb->sequence = ctx->sequence; |
5675 |
++ s_vb->sequence = ctx->sequence; |
5676 |
+ |
5677 |
+ d_q_data = &ctx->q_data[Q_DATA_DST]; |
5678 |
+ if (d_q_data->flags & Q_IS_INTERLACED) { |
5679 |
+@@ -1457,6 +1468,9 @@ static irqreturn_t vpe_irq(int irq_vpe, void *data) |
5680 |
+ ctx->src_vbs[0] = NULL; |
5681 |
+ ctx->dst_vb = NULL; |
5682 |
+ |
5683 |
++ if (ctx->aborting) |
5684 |
++ goto finished; |
5685 |
++ |
5686 |
+ ctx->bufs_completed++; |
5687 |
+ if (ctx->bufs_completed < ctx->bufs_per_job && job_ready(ctx)) { |
5688 |
+ device_run(ctx); |
5689 |
+@@ -1566,9 +1580,9 @@ static int __vpe_try_fmt(struct vpe_ctx *ctx, struct v4l2_format *f, |
5690 |
+ unsigned int stride = 0; |
5691 |
+ |
5692 |
+ if (!fmt || !(fmt->types & type)) { |
5693 |
+- vpe_err(ctx->dev, "Fourcc format (0x%08x) invalid.\n", |
5694 |
++ vpe_dbg(ctx->dev, "Fourcc format (0x%08x) invalid.\n", |
5695 |
+ pix->pixelformat); |
5696 |
+- return -EINVAL; |
5697 |
++ fmt = __find_format(V4L2_PIX_FMT_YUYV); |
5698 |
+ } |
5699 |
+ |
5700 |
+ if (pix->field != V4L2_FIELD_NONE && pix->field != V4L2_FIELD_ALTERNATE |
5701 |
+@@ -1615,7 +1629,7 @@ static int __vpe_try_fmt(struct vpe_ctx *ctx, struct v4l2_format *f, |
5702 |
+ &pix->height, MIN_H, MAX_H, H_ALIGN, |
5703 |
+ S_ALIGN); |
5704 |
+ |
5705 |
+- if (!pix->num_planes) |
5706 |
++ if (!pix->num_planes || pix->num_planes > 2) |
5707 |
+ pix->num_planes = fmt->coplanar ? 2 : 1; |
5708 |
+ else if (pix->num_planes > 1 && !fmt->coplanar) |
5709 |
+ pix->num_planes = 1; |
5710 |
+@@ -1654,6 +1668,10 @@ static int __vpe_try_fmt(struct vpe_ctx *ctx, struct v4l2_format *f, |
5711 |
+ if (stride > plane_fmt->bytesperline) |
5712 |
+ plane_fmt->bytesperline = stride; |
5713 |
+ |
5714 |
++ plane_fmt->bytesperline = clamp_t(u32, plane_fmt->bytesperline, |
5715 |
++ stride, |
5716 |
++ VPDMA_MAX_STRIDE); |
5717 |
++ |
5718 |
+ plane_fmt->bytesperline = ALIGN(plane_fmt->bytesperline, |
5719 |
+ VPDMA_STRIDE_ALIGN); |
5720 |
+ |
5721 |
+@@ -2274,7 +2292,7 @@ static int vpe_open(struct file *file) |
5722 |
+ v4l2_ctrl_handler_setup(hdl); |
5723 |
+ |
5724 |
+ s_q_data = &ctx->q_data[Q_DATA_SRC]; |
5725 |
+- s_q_data->fmt = &vpe_formats[2]; |
5726 |
++ s_q_data->fmt = __find_format(V4L2_PIX_FMT_YUYV); |
5727 |
+ s_q_data->width = 1920; |
5728 |
+ s_q_data->height = 1080; |
5729 |
+ s_q_data->nplanes = 1; |
5730 |
+@@ -2352,6 +2370,12 @@ static int vpe_release(struct file *file) |
5731 |
+ |
5732 |
+ mutex_lock(&dev->dev_mutex); |
5733 |
+ free_mv_buffers(ctx); |
5734 |
++ |
5735 |
++ vpdma_unmap_desc_buf(dev->vpdma, &ctx->desc_list.buf); |
5736 |
++ vpdma_unmap_desc_buf(dev->vpdma, &ctx->mmr_adb); |
5737 |
++ vpdma_unmap_desc_buf(dev->vpdma, &ctx->sc_coeff_h); |
5738 |
++ vpdma_unmap_desc_buf(dev->vpdma, &ctx->sc_coeff_v); |
5739 |
++ |
5740 |
+ vpdma_free_desc_list(&ctx->desc_list); |
5741 |
+ vpdma_free_desc_buf(&ctx->mmr_adb); |
5742 |
+ |
5743 |
+diff --git a/drivers/media/platform/vicodec/vicodec-core.c b/drivers/media/platform/vicodec/vicodec-core.c |
5744 |
+index 0ee143ae0f6b..82350097503e 100644 |
5745 |
+--- a/drivers/media/platform/vicodec/vicodec-core.c |
5746 |
++++ b/drivers/media/platform/vicodec/vicodec-core.c |
5747 |
+@@ -2139,6 +2139,9 @@ static void vicodec_v4l2_dev_release(struct v4l2_device *v4l2_dev) |
5748 |
+ v4l2_m2m_release(dev->stateful_enc.m2m_dev); |
5749 |
+ v4l2_m2m_release(dev->stateful_dec.m2m_dev); |
5750 |
+ v4l2_m2m_release(dev->stateless_dec.m2m_dev); |
5751 |
++#ifdef CONFIG_MEDIA_CONTROLLER |
5752 |
++ media_device_cleanup(&dev->mdev); |
5753 |
++#endif |
5754 |
+ kfree(dev); |
5755 |
+ } |
5756 |
+ |
5757 |
+@@ -2250,7 +2253,6 @@ static int vicodec_remove(struct platform_device *pdev) |
5758 |
+ v4l2_m2m_unregister_media_controller(dev->stateful_enc.m2m_dev); |
5759 |
+ v4l2_m2m_unregister_media_controller(dev->stateful_dec.m2m_dev); |
5760 |
+ v4l2_m2m_unregister_media_controller(dev->stateless_dec.m2m_dev); |
5761 |
+- media_device_cleanup(&dev->mdev); |
5762 |
+ #endif |
5763 |
+ |
5764 |
+ video_unregister_device(&dev->stateful_enc.vfd); |
5765 |
+diff --git a/drivers/media/platform/vim2m.c b/drivers/media/platform/vim2m.c |
5766 |
+index acd3bd48c7e2..8d6b09623d88 100644 |
5767 |
+--- a/drivers/media/platform/vim2m.c |
5768 |
++++ b/drivers/media/platform/vim2m.c |
5769 |
+@@ -1073,6 +1073,9 @@ static int vim2m_start_streaming(struct vb2_queue *q, unsigned int count) |
5770 |
+ if (!q_data) |
5771 |
+ return -EINVAL; |
5772 |
+ |
5773 |
++ if (V4L2_TYPE_IS_OUTPUT(q->type)) |
5774 |
++ ctx->aborting = 0; |
5775 |
++ |
5776 |
+ q_data->sequence = 0; |
5777 |
+ return 0; |
5778 |
+ } |
5779 |
+@@ -1272,6 +1275,9 @@ static void vim2m_device_release(struct video_device *vdev) |
5780 |
+ |
5781 |
+ v4l2_device_unregister(&dev->v4l2_dev); |
5782 |
+ v4l2_m2m_release(dev->m2m_dev); |
5783 |
++#ifdef CONFIG_MEDIA_CONTROLLER |
5784 |
++ media_device_cleanup(&dev->mdev); |
5785 |
++#endif |
5786 |
+ kfree(dev); |
5787 |
+ } |
5788 |
+ |
5789 |
+@@ -1343,6 +1349,7 @@ static int vim2m_probe(struct platform_device *pdev) |
5790 |
+ if (IS_ERR(dev->m2m_dev)) { |
5791 |
+ v4l2_err(&dev->v4l2_dev, "Failed to init mem2mem device\n"); |
5792 |
+ ret = PTR_ERR(dev->m2m_dev); |
5793 |
++ dev->m2m_dev = NULL; |
5794 |
+ goto error_dev; |
5795 |
+ } |
5796 |
+ |
5797 |
+@@ -1395,7 +1402,6 @@ static int vim2m_remove(struct platform_device *pdev) |
5798 |
+ #ifdef CONFIG_MEDIA_CONTROLLER |
5799 |
+ media_device_unregister(&dev->mdev); |
5800 |
+ v4l2_m2m_unregister_media_controller(dev->m2m_dev); |
5801 |
+- media_device_cleanup(&dev->mdev); |
5802 |
+ #endif |
5803 |
+ video_unregister_device(&dev->vfd); |
5804 |
+ |
5805 |
+diff --git a/drivers/media/platform/vimc/vimc-common.c b/drivers/media/platform/vimc/vimc-common.c |
5806 |
+index 7e1ae0b12f1e..a3120f4f7a90 100644 |
5807 |
+--- a/drivers/media/platform/vimc/vimc-common.c |
5808 |
++++ b/drivers/media/platform/vimc/vimc-common.c |
5809 |
+@@ -375,7 +375,7 @@ int vimc_ent_sd_register(struct vimc_ent_device *ved, |
5810 |
+ { |
5811 |
+ int ret; |
5812 |
+ |
5813 |
+- /* Allocate the pads */ |
5814 |
++ /* Allocate the pads. Should be released from the sd_int_op release */ |
5815 |
+ ved->pads = vimc_pads_init(num_pads, pads_flag); |
5816 |
+ if (IS_ERR(ved->pads)) |
5817 |
+ return PTR_ERR(ved->pads); |
5818 |
+@@ -424,7 +424,6 @@ EXPORT_SYMBOL_GPL(vimc_ent_sd_register); |
5819 |
+ void vimc_ent_sd_unregister(struct vimc_ent_device *ved, struct v4l2_subdev *sd) |
5820 |
+ { |
5821 |
+ media_entity_cleanup(ved->ent); |
5822 |
+- vimc_pads_cleanup(ved->pads); |
5823 |
+ v4l2_device_unregister_subdev(sd); |
5824 |
+ } |
5825 |
+ EXPORT_SYMBOL_GPL(vimc_ent_sd_unregister); |
5826 |
+diff --git a/drivers/media/platform/vimc/vimc-debayer.c b/drivers/media/platform/vimc/vimc-debayer.c |
5827 |
+index b72b8385067b..baafd9d7fb2c 100644 |
5828 |
+--- a/drivers/media/platform/vimc/vimc-debayer.c |
5829 |
++++ b/drivers/media/platform/vimc/vimc-debayer.c |
5830 |
+@@ -484,6 +484,7 @@ static void vimc_deb_release(struct v4l2_subdev *sd) |
5831 |
+ struct vimc_deb_device *vdeb = |
5832 |
+ container_of(sd, struct vimc_deb_device, sd); |
5833 |
+ |
5834 |
++ vimc_pads_cleanup(vdeb->ved.pads); |
5835 |
+ kfree(vdeb); |
5836 |
+ } |
5837 |
+ |
5838 |
+diff --git a/drivers/media/platform/vimc/vimc-scaler.c b/drivers/media/platform/vimc/vimc-scaler.c |
5839 |
+index 49ab8d9dd9c9..c0d9f43d5777 100644 |
5840 |
+--- a/drivers/media/platform/vimc/vimc-scaler.c |
5841 |
++++ b/drivers/media/platform/vimc/vimc-scaler.c |
5842 |
+@@ -343,6 +343,7 @@ static void vimc_sca_release(struct v4l2_subdev *sd) |
5843 |
+ struct vimc_sca_device *vsca = |
5844 |
+ container_of(sd, struct vimc_sca_device, sd); |
5845 |
+ |
5846 |
++ vimc_pads_cleanup(vsca->ved.pads); |
5847 |
+ kfree(vsca); |
5848 |
+ } |
5849 |
+ |
5850 |
+diff --git a/drivers/media/platform/vimc/vimc-sensor.c b/drivers/media/platform/vimc/vimc-sensor.c |
5851 |
+index 4a6a7e8e66c2..420573e5f6d6 100644 |
5852 |
+--- a/drivers/media/platform/vimc/vimc-sensor.c |
5853 |
++++ b/drivers/media/platform/vimc/vimc-sensor.c |
5854 |
+@@ -292,6 +292,7 @@ static void vimc_sen_release(struct v4l2_subdev *sd) |
5855 |
+ |
5856 |
+ v4l2_ctrl_handler_free(&vsen->hdl); |
5857 |
+ tpg_free(&vsen->tpg); |
5858 |
++ vimc_pads_cleanup(vsen->ved.pads); |
5859 |
+ kfree(vsen); |
5860 |
+ } |
5861 |
+ |
5862 |
+diff --git a/drivers/media/platform/vivid/vivid-core.c b/drivers/media/platform/vivid/vivid-core.c |
5863 |
+index 53315c8dd2bb..f6a5cdbd74e7 100644 |
5864 |
+--- a/drivers/media/platform/vivid/vivid-core.c |
5865 |
++++ b/drivers/media/platform/vivid/vivid-core.c |
5866 |
+@@ -616,6 +616,9 @@ static void vivid_dev_release(struct v4l2_device *v4l2_dev) |
5867 |
+ |
5868 |
+ vivid_free_controls(dev); |
5869 |
+ v4l2_device_unregister(&dev->v4l2_dev); |
5870 |
++#ifdef CONFIG_MEDIA_CONTROLLER |
5871 |
++ media_device_cleanup(&dev->mdev); |
5872 |
++#endif |
5873 |
+ vfree(dev->scaled_line); |
5874 |
+ vfree(dev->blended_line); |
5875 |
+ vfree(dev->edid); |
5876 |
+@@ -1580,7 +1583,6 @@ static int vivid_remove(struct platform_device *pdev) |
5877 |
+ |
5878 |
+ #ifdef CONFIG_MEDIA_CONTROLLER |
5879 |
+ media_device_unregister(&dev->mdev); |
5880 |
+- media_device_cleanup(&dev->mdev); |
5881 |
+ #endif |
5882 |
+ |
5883 |
+ if (dev->has_vid_cap) { |
5884 |
+diff --git a/drivers/media/radio/si470x/radio-si470x-i2c.c b/drivers/media/radio/si470x/radio-si470x-i2c.c |
5885 |
+index 7541698a0be1..f491420d7b53 100644 |
5886 |
+--- a/drivers/media/radio/si470x/radio-si470x-i2c.c |
5887 |
++++ b/drivers/media/radio/si470x/radio-si470x-i2c.c |
5888 |
+@@ -482,6 +482,8 @@ static int si470x_i2c_remove(struct i2c_client *client) |
5889 |
+ if (radio->gpio_reset) |
5890 |
+ gpiod_set_value(radio->gpio_reset, 0); |
5891 |
+ |
5892 |
++ v4l2_ctrl_handler_free(&radio->hdl); |
5893 |
++ v4l2_device_unregister(&radio->v4l2_dev); |
5894 |
+ return 0; |
5895 |
+ } |
5896 |
+ |
5897 |
+diff --git a/drivers/media/usb/b2c2/flexcop-usb.c b/drivers/media/usb/b2c2/flexcop-usb.c |
5898 |
+index 1a801dc286f8..d1331f828108 100644 |
5899 |
+--- a/drivers/media/usb/b2c2/flexcop-usb.c |
5900 |
++++ b/drivers/media/usb/b2c2/flexcop-usb.c |
5901 |
+@@ -504,7 +504,13 @@ urb_error: |
5902 |
+ static int flexcop_usb_init(struct flexcop_usb *fc_usb) |
5903 |
+ { |
5904 |
+ /* use the alternate setting with the larges buffer */ |
5905 |
+- usb_set_interface(fc_usb->udev,0,1); |
5906 |
++ int ret = usb_set_interface(fc_usb->udev, 0, 1); |
5907 |
++ |
5908 |
++ if (ret) { |
5909 |
++ err("set interface failed."); |
5910 |
++ return ret; |
5911 |
++ } |
5912 |
++ |
5913 |
+ switch (fc_usb->udev->speed) { |
5914 |
+ case USB_SPEED_LOW: |
5915 |
+ err("cannot handle USB speed because it is too slow."); |
5916 |
+diff --git a/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c b/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c |
5917 |
+index a34717eba409..eaa08c7999d4 100644 |
5918 |
+--- a/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c |
5919 |
++++ b/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c |
5920 |
+@@ -898,8 +898,12 @@ static void pvr2_v4l2_internal_check(struct pvr2_channel *chp) |
5921 |
+ pvr2_v4l2_dev_disassociate_parent(vp->dev_video); |
5922 |
+ pvr2_v4l2_dev_disassociate_parent(vp->dev_radio); |
5923 |
+ if (!list_empty(&vp->dev_video->devbase.fh_list) || |
5924 |
+- !list_empty(&vp->dev_radio->devbase.fh_list)) |
5925 |
++ (vp->dev_radio && |
5926 |
++ !list_empty(&vp->dev_radio->devbase.fh_list))) { |
5927 |
++ pvr2_trace(PVR2_TRACE_STRUCT, |
5928 |
++ "pvr2_v4l2 internal_check exit-empty id=%p", vp); |
5929 |
+ return; |
5930 |
++ } |
5931 |
+ pvr2_v4l2_destroy_no_lock(vp); |
5932 |
+ } |
5933 |
+ |
5934 |
+@@ -935,7 +939,8 @@ static int pvr2_v4l2_release(struct file *file) |
5935 |
+ kfree(fhp); |
5936 |
+ if (vp->channel.mc_head->disconnect_flag && |
5937 |
+ list_empty(&vp->dev_video->devbase.fh_list) && |
5938 |
+- list_empty(&vp->dev_radio->devbase.fh_list)) { |
5939 |
++ (!vp->dev_radio || |
5940 |
++ list_empty(&vp->dev_radio->devbase.fh_list))) { |
5941 |
+ pvr2_v4l2_destroy_no_lock(vp); |
5942 |
+ } |
5943 |
+ return 0; |
5944 |
+diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c |
5945 |
+index 1d8f38824631..cd84dbbf6a89 100644 |
5946 |
+--- a/drivers/media/v4l2-core/v4l2-ctrls.c |
5947 |
++++ b/drivers/media/v4l2-core/v4l2-ctrls.c |
5948 |
+@@ -3144,6 +3144,7 @@ static void v4l2_ctrl_request_queue(struct media_request_object *obj) |
5949 |
+ struct v4l2_ctrl_handler *prev_hdl = NULL; |
5950 |
+ struct v4l2_ctrl_ref *ref_ctrl, *ref_ctrl_prev = NULL; |
5951 |
+ |
5952 |
++ mutex_lock(main_hdl->lock); |
5953 |
+ if (list_empty(&main_hdl->requests_queued)) |
5954 |
+ goto queue; |
5955 |
+ |
5956 |
+@@ -3175,18 +3176,22 @@ static void v4l2_ctrl_request_queue(struct media_request_object *obj) |
5957 |
+ queue: |
5958 |
+ list_add_tail(&hdl->requests_queued, &main_hdl->requests_queued); |
5959 |
+ hdl->request_is_queued = true; |
5960 |
++ mutex_unlock(main_hdl->lock); |
5961 |
+ } |
5962 |
+ |
5963 |
+ static void v4l2_ctrl_request_unbind(struct media_request_object *obj) |
5964 |
+ { |
5965 |
+ struct v4l2_ctrl_handler *hdl = |
5966 |
+ container_of(obj, struct v4l2_ctrl_handler, req_obj); |
5967 |
++ struct v4l2_ctrl_handler *main_hdl = obj->priv; |
5968 |
+ |
5969 |
+ list_del_init(&hdl->requests); |
5970 |
++ mutex_lock(main_hdl->lock); |
5971 |
+ if (hdl->request_is_queued) { |
5972 |
+ list_del_init(&hdl->requests_queued); |
5973 |
+ hdl->request_is_queued = false; |
5974 |
+ } |
5975 |
++ mutex_unlock(main_hdl->lock); |
5976 |
+ } |
5977 |
+ |
5978 |
+ static void v4l2_ctrl_request_release(struct media_request_object *obj) |
5979 |
+@@ -4128,9 +4133,11 @@ void v4l2_ctrl_request_complete(struct media_request *req, |
5980 |
+ v4l2_ctrl_unlock(ctrl); |
5981 |
+ } |
5982 |
+ |
5983 |
++ mutex_lock(main_hdl->lock); |
5984 |
+ WARN_ON(!hdl->request_is_queued); |
5985 |
+ list_del_init(&hdl->requests_queued); |
5986 |
+ hdl->request_is_queued = false; |
5987 |
++ mutex_unlock(main_hdl->lock); |
5988 |
+ media_request_object_complete(obj); |
5989 |
+ media_request_object_put(obj); |
5990 |
+ } |
5991 |
+diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c |
5992 |
+index 51b912743f0f..21bb96ce4cd6 100644 |
5993 |
+--- a/drivers/media/v4l2-core/v4l2-ioctl.c |
5994 |
++++ b/drivers/media/v4l2-core/v4l2-ioctl.c |
5995 |
+@@ -1466,10 +1466,26 @@ static int v4l_enum_fmt(const struct v4l2_ioctl_ops *ops, |
5996 |
+ return ret; |
5997 |
+ } |
5998 |
+ |
5999 |
++static void v4l_pix_format_touch(struct v4l2_pix_format *p) |
6000 |
++{ |
6001 |
++ /* |
6002 |
++ * The v4l2_pix_format structure contains fields that make no sense for |
6003 |
++ * touch. Set them to default values in this case. |
6004 |
++ */ |
6005 |
++ |
6006 |
++ p->field = V4L2_FIELD_NONE; |
6007 |
++ p->colorspace = V4L2_COLORSPACE_RAW; |
6008 |
++ p->flags = 0; |
6009 |
++ p->ycbcr_enc = 0; |
6010 |
++ p->quantization = 0; |
6011 |
++ p->xfer_func = 0; |
6012 |
++} |
6013 |
++ |
6014 |
+ static int v4l_g_fmt(const struct v4l2_ioctl_ops *ops, |
6015 |
+ struct file *file, void *fh, void *arg) |
6016 |
+ { |
6017 |
+ struct v4l2_format *p = arg; |
6018 |
++ struct video_device *vfd = video_devdata(file); |
6019 |
+ int ret = check_fmt(file, p->type); |
6020 |
+ |
6021 |
+ if (ret) |
6022 |
+@@ -1507,6 +1523,8 @@ static int v4l_g_fmt(const struct v4l2_ioctl_ops *ops, |
6023 |
+ ret = ops->vidioc_g_fmt_vid_cap(file, fh, arg); |
6024 |
+ /* just in case the driver zeroed it again */ |
6025 |
+ p->fmt.pix.priv = V4L2_PIX_FMT_PRIV_MAGIC; |
6026 |
++ if (vfd->vfl_type == VFL_TYPE_TOUCH) |
6027 |
++ v4l_pix_format_touch(&p->fmt.pix); |
6028 |
+ return ret; |
6029 |
+ case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE: |
6030 |
+ return ops->vidioc_g_fmt_vid_cap_mplane(file, fh, arg); |
6031 |
+@@ -1544,21 +1562,6 @@ static int v4l_g_fmt(const struct v4l2_ioctl_ops *ops, |
6032 |
+ return -EINVAL; |
6033 |
+ } |
6034 |
+ |
6035 |
+-static void v4l_pix_format_touch(struct v4l2_pix_format *p) |
6036 |
+-{ |
6037 |
+- /* |
6038 |
+- * The v4l2_pix_format structure contains fields that make no sense for |
6039 |
+- * touch. Set them to default values in this case. |
6040 |
+- */ |
6041 |
+- |
6042 |
+- p->field = V4L2_FIELD_NONE; |
6043 |
+- p->colorspace = V4L2_COLORSPACE_RAW; |
6044 |
+- p->flags = 0; |
6045 |
+- p->ycbcr_enc = 0; |
6046 |
+- p->quantization = 0; |
6047 |
+- p->xfer_func = 0; |
6048 |
+-} |
6049 |
+- |
6050 |
+ static int v4l_s_fmt(const struct v4l2_ioctl_ops *ops, |
6051 |
+ struct file *file, void *fh, void *arg) |
6052 |
+ { |
6053 |
+diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c |
6054 |
+index 1b1a794d639d..842f2210dc7e 100644 |
6055 |
+--- a/drivers/misc/fastrpc.c |
6056 |
++++ b/drivers/misc/fastrpc.c |
6057 |
+@@ -1430,8 +1430,8 @@ static int fastrpc_rpmsg_probe(struct rpmsg_device *rpdev) |
6058 |
+ return -ENOMEM; |
6059 |
+ |
6060 |
+ data->miscdev.minor = MISC_DYNAMIC_MINOR; |
6061 |
+- data->miscdev.name = kasprintf(GFP_KERNEL, "fastrpc-%s", |
6062 |
+- domains[domain_id]); |
6063 |
++ data->miscdev.name = devm_kasprintf(rdev, GFP_KERNEL, "fastrpc-%s", |
6064 |
++ domains[domain_id]); |
6065 |
+ data->miscdev.fops = &fastrpc_fops; |
6066 |
+ err = misc_register(&data->miscdev); |
6067 |
+ if (err) |
6068 |
+diff --git a/drivers/misc/ocxl/file.c b/drivers/misc/ocxl/file.c |
6069 |
+index 2870c25da166..4d1b44de1492 100644 |
6070 |
+--- a/drivers/misc/ocxl/file.c |
6071 |
++++ b/drivers/misc/ocxl/file.c |
6072 |
+@@ -18,18 +18,15 @@ static struct class *ocxl_class; |
6073 |
+ static struct mutex minors_idr_lock; |
6074 |
+ static struct idr minors_idr; |
6075 |
+ |
6076 |
+-static struct ocxl_file_info *find_file_info(dev_t devno) |
6077 |
++static struct ocxl_file_info *find_and_get_file_info(dev_t devno) |
6078 |
+ { |
6079 |
+ struct ocxl_file_info *info; |
6080 |
+ |
6081 |
+- /* |
6082 |
+- * We don't declare an RCU critical section here, as our AFU |
6083 |
+- * is protected by a reference counter on the device. By the time the |
6084 |
+- * info reference is removed from the idr, the ref count of |
6085 |
+- * the device is already at 0, so no user API will access that AFU and |
6086 |
+- * this function can't return it. |
6087 |
+- */ |
6088 |
++ mutex_lock(&minors_idr_lock); |
6089 |
+ info = idr_find(&minors_idr, MINOR(devno)); |
6090 |
++ if (info) |
6091 |
++ get_device(&info->dev); |
6092 |
++ mutex_unlock(&minors_idr_lock); |
6093 |
+ return info; |
6094 |
+ } |
6095 |
+ |
6096 |
+@@ -58,14 +55,16 @@ static int afu_open(struct inode *inode, struct file *file) |
6097 |
+ |
6098 |
+ pr_debug("%s for device %x\n", __func__, inode->i_rdev); |
6099 |
+ |
6100 |
+- info = find_file_info(inode->i_rdev); |
6101 |
++ info = find_and_get_file_info(inode->i_rdev); |
6102 |
+ if (!info) |
6103 |
+ return -ENODEV; |
6104 |
+ |
6105 |
+ rc = ocxl_context_alloc(&ctx, info->afu, inode->i_mapping); |
6106 |
+- if (rc) |
6107 |
++ if (rc) { |
6108 |
++ put_device(&info->dev); |
6109 |
+ return rc; |
6110 |
+- |
6111 |
++ } |
6112 |
++ put_device(&info->dev); |
6113 |
+ file->private_data = ctx; |
6114 |
+ return 0; |
6115 |
+ } |
6116 |
+@@ -487,7 +486,6 @@ static void info_release(struct device *dev) |
6117 |
+ { |
6118 |
+ struct ocxl_file_info *info = container_of(dev, struct ocxl_file_info, dev); |
6119 |
+ |
6120 |
+- free_minor(info); |
6121 |
+ ocxl_afu_put(info->afu); |
6122 |
+ kfree(info); |
6123 |
+ } |
6124 |
+@@ -577,6 +575,7 @@ void ocxl_file_unregister_afu(struct ocxl_afu *afu) |
6125 |
+ |
6126 |
+ ocxl_file_make_invisible(info); |
6127 |
+ ocxl_sysfs_unregister_afu(info); |
6128 |
++ free_minor(info); |
6129 |
+ device_unregister(&info->dev); |
6130 |
+ } |
6131 |
+ |
6132 |
+diff --git a/drivers/mmc/host/mtk-sd.c b/drivers/mmc/host/mtk-sd.c |
6133 |
+index 189e42674d85..010fe29a4888 100644 |
6134 |
+--- a/drivers/mmc/host/mtk-sd.c |
6135 |
++++ b/drivers/mmc/host/mtk-sd.c |
6136 |
+@@ -228,6 +228,7 @@ |
6137 |
+ #define MSDC_PATCH_BIT_SPCPUSH (0x1 << 29) /* RW */ |
6138 |
+ #define MSDC_PATCH_BIT_DECRCTMO (0x1 << 30) /* RW */ |
6139 |
+ |
6140 |
++#define MSDC_PATCH_BIT1_CMDTA (0x7 << 3) /* RW */ |
6141 |
+ #define MSDC_PATCH_BIT1_STOP_DLY (0xf << 8) /* RW */ |
6142 |
+ |
6143 |
+ #define MSDC_PATCH_BIT2_CFGRESP (0x1 << 15) /* RW */ |
6144 |
+@@ -1881,6 +1882,7 @@ static int hs400_tune_response(struct mmc_host *mmc, u32 opcode) |
6145 |
+ |
6146 |
+ /* select EMMC50 PAD CMD tune */ |
6147 |
+ sdr_set_bits(host->base + PAD_CMD_TUNE, BIT(0)); |
6148 |
++ sdr_set_field(host->base + MSDC_PATCH_BIT1, MSDC_PATCH_BIT1_CMDTA, 2); |
6149 |
+ |
6150 |
+ if (mmc->ios.timing == MMC_TIMING_MMC_HS200 || |
6151 |
+ mmc->ios.timing == MMC_TIMING_UHS_SDR104) |
6152 |
+diff --git a/drivers/mmc/host/sdhci-msm.c b/drivers/mmc/host/sdhci-msm.c |
6153 |
+index b75c82d8d6c1..3d0bb5e2e09b 100644 |
6154 |
+--- a/drivers/mmc/host/sdhci-msm.c |
6155 |
++++ b/drivers/mmc/host/sdhci-msm.c |
6156 |
+@@ -99,7 +99,7 @@ |
6157 |
+ |
6158 |
+ #define CORE_PWRSAVE_DLL BIT(3) |
6159 |
+ |
6160 |
+-#define DDR_CONFIG_POR_VAL 0x80040853 |
6161 |
++#define DDR_CONFIG_POR_VAL 0x80040873 |
6162 |
+ |
6163 |
+ |
6164 |
+ #define INVALID_TUNING_PHASE -1 |
6165 |
+@@ -148,8 +148,9 @@ struct sdhci_msm_offset { |
6166 |
+ u32 core_ddr_200_cfg; |
6167 |
+ u32 core_vendor_spec3; |
6168 |
+ u32 core_dll_config_2; |
6169 |
++ u32 core_dll_config_3; |
6170 |
++ u32 core_ddr_config_old; /* Applicable to sdcc minor ver < 0x49 */ |
6171 |
+ u32 core_ddr_config; |
6172 |
+- u32 core_ddr_config_2; |
6173 |
+ }; |
6174 |
+ |
6175 |
+ static const struct sdhci_msm_offset sdhci_msm_v5_offset = { |
6176 |
+@@ -177,8 +178,8 @@ static const struct sdhci_msm_offset sdhci_msm_v5_offset = { |
6177 |
+ .core_ddr_200_cfg = 0x224, |
6178 |
+ .core_vendor_spec3 = 0x250, |
6179 |
+ .core_dll_config_2 = 0x254, |
6180 |
+- .core_ddr_config = 0x258, |
6181 |
+- .core_ddr_config_2 = 0x25c, |
6182 |
++ .core_dll_config_3 = 0x258, |
6183 |
++ .core_ddr_config = 0x25c, |
6184 |
+ }; |
6185 |
+ |
6186 |
+ static const struct sdhci_msm_offset sdhci_msm_mci_offset = { |
6187 |
+@@ -207,8 +208,8 @@ static const struct sdhci_msm_offset sdhci_msm_mci_offset = { |
6188 |
+ .core_ddr_200_cfg = 0x184, |
6189 |
+ .core_vendor_spec3 = 0x1b0, |
6190 |
+ .core_dll_config_2 = 0x1b4, |
6191 |
+- .core_ddr_config = 0x1b8, |
6192 |
+- .core_ddr_config_2 = 0x1bc, |
6193 |
++ .core_ddr_config_old = 0x1b8, |
6194 |
++ .core_ddr_config = 0x1bc, |
6195 |
+ }; |
6196 |
+ |
6197 |
+ struct sdhci_msm_variant_ops { |
6198 |
+@@ -253,6 +254,7 @@ struct sdhci_msm_host { |
6199 |
+ const struct sdhci_msm_offset *offset; |
6200 |
+ bool use_cdr; |
6201 |
+ u32 transfer_mode; |
6202 |
++ bool updated_ddr_cfg; |
6203 |
+ }; |
6204 |
+ |
6205 |
+ static const struct sdhci_msm_offset *sdhci_priv_msm_offset(struct sdhci_host *host) |
6206 |
+@@ -924,8 +926,10 @@ out: |
6207 |
+ static int sdhci_msm_cm_dll_sdc4_calibration(struct sdhci_host *host) |
6208 |
+ { |
6209 |
+ struct mmc_host *mmc = host->mmc; |
6210 |
+- u32 dll_status, config; |
6211 |
++ u32 dll_status, config, ddr_cfg_offset; |
6212 |
+ int ret; |
6213 |
++ struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); |
6214 |
++ struct sdhci_msm_host *msm_host = sdhci_pltfm_priv(pltfm_host); |
6215 |
+ const struct sdhci_msm_offset *msm_offset = |
6216 |
+ sdhci_priv_msm_offset(host); |
6217 |
+ |
6218 |
+@@ -938,8 +942,11 @@ static int sdhci_msm_cm_dll_sdc4_calibration(struct sdhci_host *host) |
6219 |
+ * bootloaders. In the future, if this changes, then the desired |
6220 |
+ * values will need to be programmed appropriately. |
6221 |
+ */ |
6222 |
+- writel_relaxed(DDR_CONFIG_POR_VAL, host->ioaddr + |
6223 |
+- msm_offset->core_ddr_config); |
6224 |
++ if (msm_host->updated_ddr_cfg) |
6225 |
++ ddr_cfg_offset = msm_offset->core_ddr_config; |
6226 |
++ else |
6227 |
++ ddr_cfg_offset = msm_offset->core_ddr_config_old; |
6228 |
++ writel_relaxed(DDR_CONFIG_POR_VAL, host->ioaddr + ddr_cfg_offset); |
6229 |
+ |
6230 |
+ if (mmc->ios.enhanced_strobe) { |
6231 |
+ config = readl_relaxed(host->ioaddr + |
6232 |
+@@ -1899,6 +1906,9 @@ static int sdhci_msm_probe(struct platform_device *pdev) |
6233 |
+ msm_offset->core_vendor_spec_capabilities0); |
6234 |
+ } |
6235 |
+ |
6236 |
++ if (core_major == 1 && core_minor >= 0x49) |
6237 |
++ msm_host->updated_ddr_cfg = true; |
6238 |
++ |
6239 |
+ /* |
6240 |
+ * Power on reset state may trigger power irq if previous status of |
6241 |
+ * PWRCTL was either BUS_ON or IO_HIGH_V. So before enabling pwr irq |
6242 |
+diff --git a/drivers/mmc/host/sdhci-of-esdhc.c b/drivers/mmc/host/sdhci-of-esdhc.c |
6243 |
+index 1d1953dfc54b..889ed98ec0e7 100644 |
6244 |
+--- a/drivers/mmc/host/sdhci-of-esdhc.c |
6245 |
++++ b/drivers/mmc/host/sdhci-of-esdhc.c |
6246 |
+@@ -710,9 +710,6 @@ static void esdhc_reset(struct sdhci_host *host, u8 mask) |
6247 |
+ sdhci_writel(host, host->ier, SDHCI_INT_ENABLE); |
6248 |
+ sdhci_writel(host, host->ier, SDHCI_SIGNAL_ENABLE); |
6249 |
+ |
6250 |
+- if (of_find_compatible_node(NULL, NULL, "fsl,p2020-esdhc")) |
6251 |
+- mdelay(5); |
6252 |
+- |
6253 |
+ if (mask & SDHCI_RESET_ALL) { |
6254 |
+ val = sdhci_readl(host, ESDHC_TBCTL); |
6255 |
+ val &= ~ESDHC_TB_EN; |
6256 |
+@@ -1126,8 +1123,8 @@ static int sdhci_esdhc_probe(struct platform_device *pdev) |
6257 |
+ host->quirks &= ~SDHCI_QUIRK_NO_BUSY_IRQ; |
6258 |
+ |
6259 |
+ if (of_find_compatible_node(NULL, NULL, "fsl,p2020-esdhc")) { |
6260 |
+- host->quirks2 |= SDHCI_QUIRK_RESET_AFTER_REQUEST; |
6261 |
+- host->quirks2 |= SDHCI_QUIRK_BROKEN_TIMEOUT_VAL; |
6262 |
++ host->quirks |= SDHCI_QUIRK_RESET_AFTER_REQUEST; |
6263 |
++ host->quirks |= SDHCI_QUIRK_BROKEN_TIMEOUT_VAL; |
6264 |
+ } |
6265 |
+ |
6266 |
+ if (of_device_is_compatible(np, "fsl,p5040-esdhc") || |
6267 |
+diff --git a/drivers/mmc/host/sdhci-pci-core.c b/drivers/mmc/host/sdhci-pci-core.c |
6268 |
+index eaffa85bc728..642a9667db4d 100644 |
6269 |
+--- a/drivers/mmc/host/sdhci-pci-core.c |
6270 |
++++ b/drivers/mmc/host/sdhci-pci-core.c |
6271 |
+@@ -26,6 +26,7 @@ |
6272 |
+ #include <linux/mmc/slot-gpio.h> |
6273 |
+ #include <linux/mmc/sdhci-pci-data.h> |
6274 |
+ #include <linux/acpi.h> |
6275 |
++#include <linux/dmi.h> |
6276 |
+ |
6277 |
+ #ifdef CONFIG_X86 |
6278 |
+ #include <asm/iosf_mbi.h> |
6279 |
+@@ -782,11 +783,18 @@ static int byt_emmc_probe_slot(struct sdhci_pci_slot *slot) |
6280 |
+ return 0; |
6281 |
+ } |
6282 |
+ |
6283 |
++static bool glk_broken_cqhci(struct sdhci_pci_slot *slot) |
6284 |
++{ |
6285 |
++ return slot->chip->pdev->device == PCI_DEVICE_ID_INTEL_GLK_EMMC && |
6286 |
++ dmi_match(DMI_BIOS_VENDOR, "LENOVO"); |
6287 |
++} |
6288 |
++ |
6289 |
+ static int glk_emmc_probe_slot(struct sdhci_pci_slot *slot) |
6290 |
+ { |
6291 |
+ int ret = byt_emmc_probe_slot(slot); |
6292 |
+ |
6293 |
+- slot->host->mmc->caps2 |= MMC_CAP2_CQE; |
6294 |
++ if (!glk_broken_cqhci(slot)) |
6295 |
++ slot->host->mmc->caps2 |= MMC_CAP2_CQE; |
6296 |
+ |
6297 |
+ if (slot->chip->pdev->device != PCI_DEVICE_ID_INTEL_GLK_EMMC) { |
6298 |
+ slot->host->mmc->caps2 |= MMC_CAP2_HS400_ES, |
6299 |
+diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c |
6300 |
+index b056400e34b1..5f9df2dbde06 100644 |
6301 |
+--- a/drivers/mmc/host/sdhci.c |
6302 |
++++ b/drivers/mmc/host/sdhci.c |
6303 |
+@@ -1871,9 +1871,7 @@ void sdhci_set_uhs_signaling(struct sdhci_host *host, unsigned timing) |
6304 |
+ ctrl_2 |= SDHCI_CTRL_UHS_SDR104; |
6305 |
+ else if (timing == MMC_TIMING_UHS_SDR12) |
6306 |
+ ctrl_2 |= SDHCI_CTRL_UHS_SDR12; |
6307 |
+- else if (timing == MMC_TIMING_SD_HS || |
6308 |
+- timing == MMC_TIMING_MMC_HS || |
6309 |
+- timing == MMC_TIMING_UHS_SDR25) |
6310 |
++ else if (timing == MMC_TIMING_UHS_SDR25) |
6311 |
+ ctrl_2 |= SDHCI_CTRL_UHS_SDR25; |
6312 |
+ else if (timing == MMC_TIMING_UHS_SDR50) |
6313 |
+ ctrl_2 |= SDHCI_CTRL_UHS_SDR50; |
6314 |
+@@ -2408,8 +2406,8 @@ static int __sdhci_execute_tuning(struct sdhci_host *host, u32 opcode) |
6315 |
+ sdhci_send_tuning(host, opcode); |
6316 |
+ |
6317 |
+ if (!host->tuning_done) { |
6318 |
+- pr_info("%s: Tuning timeout, falling back to fixed sampling clock\n", |
6319 |
+- mmc_hostname(host->mmc)); |
6320 |
++ pr_debug("%s: Tuning timeout, falling back to fixed sampling clock\n", |
6321 |
++ mmc_hostname(host->mmc)); |
6322 |
+ sdhci_abort_tuning(host, opcode); |
6323 |
+ return -ETIMEDOUT; |
6324 |
+ } |
6325 |
+@@ -3758,6 +3756,9 @@ int sdhci_setup_host(struct sdhci_host *host) |
6326 |
+ mmc_hostname(mmc), host->version); |
6327 |
+ } |
6328 |
+ |
6329 |
++ if (host->quirks & SDHCI_QUIRK_BROKEN_CQE) |
6330 |
++ mmc->caps2 &= ~MMC_CAP2_CQE; |
6331 |
++ |
6332 |
+ if (host->quirks & SDHCI_QUIRK_FORCE_DMA) |
6333 |
+ host->flags |= SDHCI_USE_SDMA; |
6334 |
+ else if (!(host->caps & SDHCI_CAN_DO_SDMA)) |
6335 |
+diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h |
6336 |
+index 0ed3e0eaef5f..fe83ece6965b 100644 |
6337 |
+--- a/drivers/mmc/host/sdhci.h |
6338 |
++++ b/drivers/mmc/host/sdhci.h |
6339 |
+@@ -409,6 +409,8 @@ struct sdhci_host { |
6340 |
+ #define SDHCI_QUIRK_BROKEN_CARD_DETECTION (1<<15) |
6341 |
+ /* Controller reports inverted write-protect state */ |
6342 |
+ #define SDHCI_QUIRK_INVERTED_WRITE_PROTECT (1<<16) |
6343 |
++/* Controller has unusable command queue engine */ |
6344 |
++#define SDHCI_QUIRK_BROKEN_CQE (1<<17) |
6345 |
+ /* Controller does not like fast PIO transfers */ |
6346 |
+ #define SDHCI_QUIRK_PIO_NEEDS_DELAY (1<<18) |
6347 |
+ /* Controller does not have a LED */ |
6348 |
+diff --git a/drivers/mmc/host/tmio_mmc_core.c b/drivers/mmc/host/tmio_mmc_core.c |
6349 |
+index 9b6e1001e77c..dec5a99f52cf 100644 |
6350 |
+--- a/drivers/mmc/host/tmio_mmc_core.c |
6351 |
++++ b/drivers/mmc/host/tmio_mmc_core.c |
6352 |
+@@ -1184,7 +1184,7 @@ int tmio_mmc_host_probe(struct tmio_mmc_host *_host) |
6353 |
+ if (ret == -EPROBE_DEFER) |
6354 |
+ return ret; |
6355 |
+ |
6356 |
+- mmc->caps |= MMC_CAP_4_BIT_DATA | pdata->capabilities; |
6357 |
++ mmc->caps |= MMC_CAP_ERASE | MMC_CAP_4_BIT_DATA | pdata->capabilities; |
6358 |
+ mmc->caps2 |= pdata->capabilities2; |
6359 |
+ mmc->max_segs = pdata->max_segs ? : 32; |
6360 |
+ mmc->max_blk_size = TMIO_MAX_BLK_SIZE; |
6361 |
+diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c |
6362 |
+index 62f65573eb04..face00c622ed 100644 |
6363 |
+--- a/drivers/net/bonding/bond_main.c |
6364 |
++++ b/drivers/net/bonding/bond_main.c |
6365 |
+@@ -3612,32 +3612,35 @@ static int bond_neigh_init(struct neighbour *n) |
6366 |
+ const struct net_device_ops *slave_ops; |
6367 |
+ struct neigh_parms parms; |
6368 |
+ struct slave *slave; |
6369 |
+- int ret; |
6370 |
++ int ret = 0; |
6371 |
+ |
6372 |
+- slave = bond_first_slave(bond); |
6373 |
++ rcu_read_lock(); |
6374 |
++ slave = bond_first_slave_rcu(bond); |
6375 |
+ if (!slave) |
6376 |
+- return 0; |
6377 |
++ goto out; |
6378 |
+ slave_ops = slave->dev->netdev_ops; |
6379 |
+ if (!slave_ops->ndo_neigh_setup) |
6380 |
+- return 0; |
6381 |
+- |
6382 |
+- parms.neigh_setup = NULL; |
6383 |
+- parms.neigh_cleanup = NULL; |
6384 |
+- ret = slave_ops->ndo_neigh_setup(slave->dev, &parms); |
6385 |
+- if (ret) |
6386 |
+- return ret; |
6387 |
++ goto out; |
6388 |
+ |
6389 |
+- /* Assign slave's neigh_cleanup to neighbour in case cleanup is called |
6390 |
+- * after the last slave has been detached. Assumes that all slaves |
6391 |
+- * utilize the same neigh_cleanup (true at this writing as only user |
6392 |
+- * is ipoib). |
6393 |
++ /* TODO: find another way [1] to implement this. |
6394 |
++ * Passing a zeroed structure is fragile, |
6395 |
++ * but at least we do not pass garbage. |
6396 |
++ * |
6397 |
++ * [1] One way would be that ndo_neigh_setup() never touch |
6398 |
++ * struct neigh_parms, but propagate the new neigh_setup() |
6399 |
++ * back to ___neigh_create() / neigh_parms_alloc() |
6400 |
+ */ |
6401 |
+- n->parms->neigh_cleanup = parms.neigh_cleanup; |
6402 |
++ memset(&parms, 0, sizeof(parms)); |
6403 |
++ ret = slave_ops->ndo_neigh_setup(slave->dev, &parms); |
6404 |
+ |
6405 |
+- if (!parms.neigh_setup) |
6406 |
+- return 0; |
6407 |
++ if (ret) |
6408 |
++ goto out; |
6409 |
+ |
6410 |
+- return parms.neigh_setup(n); |
6411 |
++ if (parms.neigh_setup) |
6412 |
++ ret = parms.neigh_setup(n); |
6413 |
++out: |
6414 |
++ rcu_read_unlock(); |
6415 |
++ return ret; |
6416 |
+ } |
6417 |
+ |
6418 |
+ /* The bonding ndo_neigh_setup is called at init time beofre any |
6419 |
+diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c |
6420 |
+index 57f9a2f51085..e5c207ad3c77 100644 |
6421 |
+--- a/drivers/net/can/flexcan.c |
6422 |
++++ b/drivers/net/can/flexcan.c |
6423 |
+@@ -389,6 +389,34 @@ static struct flexcan_mb __iomem *flexcan_get_mb(const struct flexcan_priv *priv |
6424 |
+ (&priv->regs->mb[bank][priv->mb_size * mb_index]); |
6425 |
+ } |
6426 |
+ |
6427 |
++static int flexcan_low_power_enter_ack(struct flexcan_priv *priv) |
6428 |
++{ |
6429 |
++ struct flexcan_regs __iomem *regs = priv->regs; |
6430 |
++ unsigned int timeout = FLEXCAN_TIMEOUT_US / 10; |
6431 |
++ |
6432 |
++ while (timeout-- && !(priv->read(®s->mcr) & FLEXCAN_MCR_LPM_ACK)) |
6433 |
++ udelay(10); |
6434 |
++ |
6435 |
++ if (!(priv->read(®s->mcr) & FLEXCAN_MCR_LPM_ACK)) |
6436 |
++ return -ETIMEDOUT; |
6437 |
++ |
6438 |
++ return 0; |
6439 |
++} |
6440 |
++ |
6441 |
++static int flexcan_low_power_exit_ack(struct flexcan_priv *priv) |
6442 |
++{ |
6443 |
++ struct flexcan_regs __iomem *regs = priv->regs; |
6444 |
++ unsigned int timeout = FLEXCAN_TIMEOUT_US / 10; |
6445 |
++ |
6446 |
++ while (timeout-- && (priv->read(®s->mcr) & FLEXCAN_MCR_LPM_ACK)) |
6447 |
++ udelay(10); |
6448 |
++ |
6449 |
++ if (priv->read(®s->mcr) & FLEXCAN_MCR_LPM_ACK) |
6450 |
++ return -ETIMEDOUT; |
6451 |
++ |
6452 |
++ return 0; |
6453 |
++} |
6454 |
++ |
6455 |
+ static void flexcan_enable_wakeup_irq(struct flexcan_priv *priv, bool enable) |
6456 |
+ { |
6457 |
+ struct flexcan_regs __iomem *regs = priv->regs; |
6458 |
+@@ -407,7 +435,6 @@ static void flexcan_enable_wakeup_irq(struct flexcan_priv *priv, bool enable) |
6459 |
+ static inline int flexcan_enter_stop_mode(struct flexcan_priv *priv) |
6460 |
+ { |
6461 |
+ struct flexcan_regs __iomem *regs = priv->regs; |
6462 |
+- unsigned int ackval; |
6463 |
+ u32 reg_mcr; |
6464 |
+ |
6465 |
+ reg_mcr = priv->read(®s->mcr); |
6466 |
+@@ -418,36 +445,24 @@ static inline int flexcan_enter_stop_mode(struct flexcan_priv *priv) |
6467 |
+ regmap_update_bits(priv->stm.gpr, priv->stm.req_gpr, |
6468 |
+ 1 << priv->stm.req_bit, 1 << priv->stm.req_bit); |
6469 |
+ |
6470 |
+- /* get stop acknowledgment */ |
6471 |
+- if (regmap_read_poll_timeout(priv->stm.gpr, priv->stm.ack_gpr, |
6472 |
+- ackval, ackval & (1 << priv->stm.ack_bit), |
6473 |
+- 0, FLEXCAN_TIMEOUT_US)) |
6474 |
+- return -ETIMEDOUT; |
6475 |
+- |
6476 |
+- return 0; |
6477 |
++ return flexcan_low_power_enter_ack(priv); |
6478 |
+ } |
6479 |
+ |
6480 |
+ static inline int flexcan_exit_stop_mode(struct flexcan_priv *priv) |
6481 |
+ { |
6482 |
+ struct flexcan_regs __iomem *regs = priv->regs; |
6483 |
+- unsigned int ackval; |
6484 |
+ u32 reg_mcr; |
6485 |
+ |
6486 |
+ /* remove stop request */ |
6487 |
+ regmap_update_bits(priv->stm.gpr, priv->stm.req_gpr, |
6488 |
+ 1 << priv->stm.req_bit, 0); |
6489 |
+ |
6490 |
+- /* get stop acknowledgment */ |
6491 |
+- if (regmap_read_poll_timeout(priv->stm.gpr, priv->stm.ack_gpr, |
6492 |
+- ackval, !(ackval & (1 << priv->stm.ack_bit)), |
6493 |
+- 0, FLEXCAN_TIMEOUT_US)) |
6494 |
+- return -ETIMEDOUT; |
6495 |
+ |
6496 |
+ reg_mcr = priv->read(®s->mcr); |
6497 |
+ reg_mcr &= ~FLEXCAN_MCR_SLF_WAK; |
6498 |
+ priv->write(reg_mcr, ®s->mcr); |
6499 |
+ |
6500 |
+- return 0; |
6501 |
++ return flexcan_low_power_exit_ack(priv); |
6502 |
+ } |
6503 |
+ |
6504 |
+ static inline void flexcan_error_irq_enable(const struct flexcan_priv *priv) |
6505 |
+@@ -506,39 +521,25 @@ static inline int flexcan_transceiver_disable(const struct flexcan_priv *priv) |
6506 |
+ static int flexcan_chip_enable(struct flexcan_priv *priv) |
6507 |
+ { |
6508 |
+ struct flexcan_regs __iomem *regs = priv->regs; |
6509 |
+- unsigned int timeout = FLEXCAN_TIMEOUT_US / 10; |
6510 |
+ u32 reg; |
6511 |
+ |
6512 |
+ reg = priv->read(®s->mcr); |
6513 |
+ reg &= ~FLEXCAN_MCR_MDIS; |
6514 |
+ priv->write(reg, ®s->mcr); |
6515 |
+ |
6516 |
+- while (timeout-- && (priv->read(®s->mcr) & FLEXCAN_MCR_LPM_ACK)) |
6517 |
+- udelay(10); |
6518 |
+- |
6519 |
+- if (priv->read(®s->mcr) & FLEXCAN_MCR_LPM_ACK) |
6520 |
+- return -ETIMEDOUT; |
6521 |
+- |
6522 |
+- return 0; |
6523 |
++ return flexcan_low_power_exit_ack(priv); |
6524 |
+ } |
6525 |
+ |
6526 |
+ static int flexcan_chip_disable(struct flexcan_priv *priv) |
6527 |
+ { |
6528 |
+ struct flexcan_regs __iomem *regs = priv->regs; |
6529 |
+- unsigned int timeout = FLEXCAN_TIMEOUT_US / 10; |
6530 |
+ u32 reg; |
6531 |
+ |
6532 |
+ reg = priv->read(®s->mcr); |
6533 |
+ reg |= FLEXCAN_MCR_MDIS; |
6534 |
+ priv->write(reg, ®s->mcr); |
6535 |
+ |
6536 |
+- while (timeout-- && !(priv->read(®s->mcr) & FLEXCAN_MCR_LPM_ACK)) |
6537 |
+- udelay(10); |
6538 |
+- |
6539 |
+- if (!(priv->read(®s->mcr) & FLEXCAN_MCR_LPM_ACK)) |
6540 |
+- return -ETIMEDOUT; |
6541 |
+- |
6542 |
+- return 0; |
6543 |
++ return flexcan_low_power_enter_ack(priv); |
6544 |
+ } |
6545 |
+ |
6546 |
+ static int flexcan_chip_freeze(struct flexcan_priv *priv) |
6547 |
+@@ -1703,6 +1704,9 @@ static int __maybe_unused flexcan_resume(struct device *device) |
6548 |
+ netif_start_queue(dev); |
6549 |
+ if (device_may_wakeup(device)) { |
6550 |
+ disable_irq_wake(dev->irq); |
6551 |
++ err = flexcan_exit_stop_mode(priv); |
6552 |
++ if (err) |
6553 |
++ return err; |
6554 |
+ } else { |
6555 |
+ err = pm_runtime_force_resume(device); |
6556 |
+ if (err) |
6557 |
+@@ -1748,14 +1752,9 @@ static int __maybe_unused flexcan_noirq_resume(struct device *device) |
6558 |
+ { |
6559 |
+ struct net_device *dev = dev_get_drvdata(device); |
6560 |
+ struct flexcan_priv *priv = netdev_priv(dev); |
6561 |
+- int err; |
6562 |
+ |
6563 |
+- if (netif_running(dev) && device_may_wakeup(device)) { |
6564 |
++ if (netif_running(dev) && device_may_wakeup(device)) |
6565 |
+ flexcan_enable_wakeup_irq(priv, false); |
6566 |
+- err = flexcan_exit_stop_mode(priv); |
6567 |
+- if (err) |
6568 |
+- return err; |
6569 |
+- } |
6570 |
+ |
6571 |
+ return 0; |
6572 |
+ } |
6573 |
+diff --git a/drivers/net/can/m_can/tcan4x5x.c b/drivers/net/can/m_can/tcan4x5x.c |
6574 |
+index 3db619209fe1..d5d4bfa9c8fd 100644 |
6575 |
+--- a/drivers/net/can/m_can/tcan4x5x.c |
6576 |
++++ b/drivers/net/can/m_can/tcan4x5x.c |
6577 |
+@@ -354,6 +354,8 @@ static int tcan4x5x_parse_config(struct m_can_classdev *cdev) |
6578 |
+ if (IS_ERR(tcan4x5x->reset_gpio)) |
6579 |
+ tcan4x5x->reset_gpio = NULL; |
6580 |
+ |
6581 |
++ usleep_range(700, 1000); |
6582 |
++ |
6583 |
+ tcan4x5x->device_state_gpio = devm_gpiod_get_optional(cdev->dev, |
6584 |
+ "device-state", |
6585 |
+ GPIOD_IN); |
6586 |
+diff --git a/drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c b/drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c |
6587 |
+index 07d2f3aa2c02..ae4c37e1bb75 100644 |
6588 |
+--- a/drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c |
6589 |
++++ b/drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c |
6590 |
+@@ -608,7 +608,7 @@ static int kvaser_usb_leaf_simple_cmd_async(struct kvaser_usb_net_priv *priv, |
6591 |
+ struct kvaser_cmd *cmd; |
6592 |
+ int err; |
6593 |
+ |
6594 |
+- cmd = kmalloc(sizeof(*cmd), GFP_ATOMIC); |
6595 |
++ cmd = kzalloc(sizeof(*cmd), GFP_ATOMIC); |
6596 |
+ if (!cmd) |
6597 |
+ return -ENOMEM; |
6598 |
+ |
6599 |
+@@ -1140,7 +1140,7 @@ static int kvaser_usb_leaf_set_opt_mode(const struct kvaser_usb_net_priv *priv) |
6600 |
+ struct kvaser_cmd *cmd; |
6601 |
+ int rc; |
6602 |
+ |
6603 |
+- cmd = kmalloc(sizeof(*cmd), GFP_KERNEL); |
6604 |
++ cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); |
6605 |
+ if (!cmd) |
6606 |
+ return -ENOMEM; |
6607 |
+ |
6608 |
+@@ -1206,7 +1206,7 @@ static int kvaser_usb_leaf_flush_queue(struct kvaser_usb_net_priv *priv) |
6609 |
+ struct kvaser_cmd *cmd; |
6610 |
+ int rc; |
6611 |
+ |
6612 |
+- cmd = kmalloc(sizeof(*cmd), GFP_KERNEL); |
6613 |
++ cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); |
6614 |
+ if (!cmd) |
6615 |
+ return -ENOMEM; |
6616 |
+ |
6617 |
+diff --git a/drivers/net/can/xilinx_can.c b/drivers/net/can/xilinx_can.c |
6618 |
+index 7c482b2d78d2..2be846ee627d 100644 |
6619 |
+--- a/drivers/net/can/xilinx_can.c |
6620 |
++++ b/drivers/net/can/xilinx_can.c |
6621 |
+@@ -60,6 +60,8 @@ enum xcan_reg { |
6622 |
+ XCAN_TXMSG_BASE_OFFSET = 0x0100, /* TX Message Space */ |
6623 |
+ XCAN_RXMSG_BASE_OFFSET = 0x1100, /* RX Message Space */ |
6624 |
+ XCAN_RXMSG_2_BASE_OFFSET = 0x2100, /* RX Message Space */ |
6625 |
++ XCAN_AFR_2_MASK_OFFSET = 0x0A00, /* Acceptance Filter MASK */ |
6626 |
++ XCAN_AFR_2_ID_OFFSET = 0x0A04, /* Acceptance Filter ID */ |
6627 |
+ }; |
6628 |
+ |
6629 |
+ #define XCAN_FRAME_ID_OFFSET(frame_base) ((frame_base) + 0x00) |
6630 |
+@@ -1803,6 +1805,11 @@ static int xcan_probe(struct platform_device *pdev) |
6631 |
+ |
6632 |
+ pm_runtime_put(&pdev->dev); |
6633 |
+ |
6634 |
++ if (priv->devtype.flags & XCAN_FLAG_CANFD_2) { |
6635 |
++ priv->write_reg(priv, XCAN_AFR_2_ID_OFFSET, 0x00000000); |
6636 |
++ priv->write_reg(priv, XCAN_AFR_2_MASK_OFFSET, 0x00000000); |
6637 |
++ } |
6638 |
++ |
6639 |
+ netdev_dbg(ndev, "reg_base=0x%p irq=%d clock=%d, tx buffers: actual %d, using %d\n", |
6640 |
+ priv->reg_base, ndev->irq, priv->can.clock.freq, |
6641 |
+ hw_tx_max, priv->tx_max); |
6642 |
+diff --git a/drivers/net/dsa/Kconfig b/drivers/net/dsa/Kconfig |
6643 |
+index f6232ce8481f..685e12b05a7c 100644 |
6644 |
+--- a/drivers/net/dsa/Kconfig |
6645 |
++++ b/drivers/net/dsa/Kconfig |
6646 |
+@@ -77,6 +77,7 @@ config NET_DSA_REALTEK_SMI |
6647 |
+ config NET_DSA_SMSC_LAN9303 |
6648 |
+ tristate |
6649 |
+ select NET_DSA_TAG_LAN9303 |
6650 |
++ select REGMAP |
6651 |
+ ---help--- |
6652 |
+ This enables support for the SMSC/Microchip LAN9303 3 port ethernet |
6653 |
+ switch chips. |
6654 |
+diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c |
6655 |
+index cc3536315eff..a7132c1593c3 100644 |
6656 |
+--- a/drivers/net/dsa/b53/b53_common.c |
6657 |
++++ b/drivers/net/dsa/b53/b53_common.c |
6658 |
+@@ -347,7 +347,7 @@ static void b53_set_forwarding(struct b53_device *dev, int enable) |
6659 |
+ * frames should be flooded or not. |
6660 |
+ */ |
6661 |
+ b53_read8(dev, B53_CTRL_PAGE, B53_IP_MULTICAST_CTRL, &mgmt); |
6662 |
+- mgmt |= B53_UC_FWD_EN | B53_MC_FWD_EN; |
6663 |
++ mgmt |= B53_UC_FWD_EN | B53_MC_FWD_EN | B53_IPMC_FWD_EN; |
6664 |
+ b53_write8(dev, B53_CTRL_PAGE, B53_IP_MULTICAST_CTRL, mgmt); |
6665 |
+ } |
6666 |
+ |
6667 |
+@@ -526,6 +526,8 @@ int b53_enable_port(struct dsa_switch *ds, int port, struct phy_device *phy) |
6668 |
+ |
6669 |
+ cpu_port = ds->ports[port].cpu_dp->index; |
6670 |
+ |
6671 |
++ b53_br_egress_floods(ds, port, true, true); |
6672 |
++ |
6673 |
+ if (dev->ops->irq_enable) |
6674 |
+ ret = dev->ops->irq_enable(dev, port); |
6675 |
+ if (ret) |
6676 |
+@@ -641,6 +643,8 @@ static void b53_enable_cpu_port(struct b53_device *dev, int port) |
6677 |
+ b53_write8(dev, B53_CTRL_PAGE, B53_PORT_CTRL(port), port_ctrl); |
6678 |
+ |
6679 |
+ b53_brcm_hdr_setup(dev->ds, port); |
6680 |
++ |
6681 |
++ b53_br_egress_floods(dev->ds, port, true, true); |
6682 |
+ } |
6683 |
+ |
6684 |
+ static void b53_enable_mib(struct b53_device *dev) |
6685 |
+@@ -1766,19 +1770,26 @@ int b53_br_egress_floods(struct dsa_switch *ds, int port, |
6686 |
+ struct b53_device *dev = ds->priv; |
6687 |
+ u16 uc, mc; |
6688 |
+ |
6689 |
+- b53_read16(dev, B53_CTRL_PAGE, B53_UC_FWD_EN, &uc); |
6690 |
++ b53_read16(dev, B53_CTRL_PAGE, B53_UC_FLOOD_MASK, &uc); |
6691 |
+ if (unicast) |
6692 |
+ uc |= BIT(port); |
6693 |
+ else |
6694 |
+ uc &= ~BIT(port); |
6695 |
+- b53_write16(dev, B53_CTRL_PAGE, B53_UC_FWD_EN, uc); |
6696 |
++ b53_write16(dev, B53_CTRL_PAGE, B53_UC_FLOOD_MASK, uc); |
6697 |
++ |
6698 |
++ b53_read16(dev, B53_CTRL_PAGE, B53_MC_FLOOD_MASK, &mc); |
6699 |
++ if (multicast) |
6700 |
++ mc |= BIT(port); |
6701 |
++ else |
6702 |
++ mc &= ~BIT(port); |
6703 |
++ b53_write16(dev, B53_CTRL_PAGE, B53_MC_FLOOD_MASK, mc); |
6704 |
+ |
6705 |
+- b53_read16(dev, B53_CTRL_PAGE, B53_MC_FWD_EN, &mc); |
6706 |
++ b53_read16(dev, B53_CTRL_PAGE, B53_IPMC_FLOOD_MASK, &mc); |
6707 |
+ if (multicast) |
6708 |
+ mc |= BIT(port); |
6709 |
+ else |
6710 |
+ mc &= ~BIT(port); |
6711 |
+- b53_write16(dev, B53_CTRL_PAGE, B53_MC_FWD_EN, mc); |
6712 |
++ b53_write16(dev, B53_CTRL_PAGE, B53_IPMC_FLOOD_MASK, mc); |
6713 |
+ |
6714 |
+ return 0; |
6715 |
+ |
6716 |
+diff --git a/drivers/net/dsa/sja1105/sja1105_main.c b/drivers/net/dsa/sja1105/sja1105_main.c |
6717 |
+index aa140662c7c2..4e5a428ab1a4 100644 |
6718 |
+--- a/drivers/net/dsa/sja1105/sja1105_main.c |
6719 |
++++ b/drivers/net/dsa/sja1105/sja1105_main.c |
6720 |
+@@ -1389,6 +1389,8 @@ int sja1105_static_config_reload(struct sja1105_private *priv) |
6721 |
+ int speed_mbps[SJA1105_NUM_PORTS]; |
6722 |
+ int rc, i; |
6723 |
+ |
6724 |
++ mutex_lock(&priv->mgmt_lock); |
6725 |
++ |
6726 |
+ mac = priv->static_config.tables[BLK_IDX_MAC_CONFIG].entries; |
6727 |
+ |
6728 |
+ /* Back up the dynamic link speed changed by sja1105_adjust_port_config |
6729 |
+@@ -1420,6 +1422,8 @@ int sja1105_static_config_reload(struct sja1105_private *priv) |
6730 |
+ goto out; |
6731 |
+ } |
6732 |
+ out: |
6733 |
++ mutex_unlock(&priv->mgmt_lock); |
6734 |
++ |
6735 |
+ return rc; |
6736 |
+ } |
6737 |
+ |
6738 |
+diff --git a/drivers/net/ethernet/amazon/ena/ena_com.h b/drivers/net/ethernet/amazon/ena/ena_com.h |
6739 |
+index 7c941eba0bc9..0ce37d54ed10 100644 |
6740 |
+--- a/drivers/net/ethernet/amazon/ena/ena_com.h |
6741 |
++++ b/drivers/net/ethernet/amazon/ena/ena_com.h |
6742 |
+@@ -72,7 +72,7 @@ |
6743 |
+ /*****************************************************************************/ |
6744 |
+ /* ENA adaptive interrupt moderation settings */ |
6745 |
+ |
6746 |
+-#define ENA_INTR_INITIAL_TX_INTERVAL_USECS 196 |
6747 |
++#define ENA_INTR_INITIAL_TX_INTERVAL_USECS 64 |
6748 |
+ #define ENA_INTR_INITIAL_RX_INTERVAL_USECS 0 |
6749 |
+ #define ENA_DEFAULT_INTR_DELAY_RESOLUTION 1 |
6750 |
+ |
6751 |
+diff --git a/drivers/net/ethernet/amazon/ena/ena_ethtool.c b/drivers/net/ethernet/amazon/ena/ena_ethtool.c |
6752 |
+index 16553d92fad2..8c1c73b0ced7 100644 |
6753 |
+--- a/drivers/net/ethernet/amazon/ena/ena_ethtool.c |
6754 |
++++ b/drivers/net/ethernet/amazon/ena/ena_ethtool.c |
6755 |
+@@ -315,10 +315,9 @@ static int ena_get_coalesce(struct net_device *net_dev, |
6756 |
+ ena_com_get_nonadaptive_moderation_interval_tx(ena_dev) * |
6757 |
+ ena_dev->intr_delay_resolution; |
6758 |
+ |
6759 |
+- if (!ena_com_get_adaptive_moderation_enabled(ena_dev)) |
6760 |
+- coalesce->rx_coalesce_usecs = |
6761 |
+- ena_com_get_nonadaptive_moderation_interval_rx(ena_dev) |
6762 |
+- * ena_dev->intr_delay_resolution; |
6763 |
++ coalesce->rx_coalesce_usecs = |
6764 |
++ ena_com_get_nonadaptive_moderation_interval_rx(ena_dev) |
6765 |
++ * ena_dev->intr_delay_resolution; |
6766 |
+ |
6767 |
+ coalesce->use_adaptive_rx_coalesce = |
6768 |
+ ena_com_get_adaptive_moderation_enabled(ena_dev); |
6769 |
+@@ -367,12 +366,6 @@ static int ena_set_coalesce(struct net_device *net_dev, |
6770 |
+ |
6771 |
+ ena_update_tx_rings_intr_moderation(adapter); |
6772 |
+ |
6773 |
+- if (coalesce->use_adaptive_rx_coalesce) { |
6774 |
+- if (!ena_com_get_adaptive_moderation_enabled(ena_dev)) |
6775 |
+- ena_com_enable_adaptive_moderation(ena_dev); |
6776 |
+- return 0; |
6777 |
+- } |
6778 |
+- |
6779 |
+ rc = ena_com_update_nonadaptive_moderation_interval_rx(ena_dev, |
6780 |
+ coalesce->rx_coalesce_usecs); |
6781 |
+ if (rc) |
6782 |
+@@ -380,10 +373,13 @@ static int ena_set_coalesce(struct net_device *net_dev, |
6783 |
+ |
6784 |
+ ena_update_rx_rings_intr_moderation(adapter); |
6785 |
+ |
6786 |
+- if (!coalesce->use_adaptive_rx_coalesce) { |
6787 |
+- if (ena_com_get_adaptive_moderation_enabled(ena_dev)) |
6788 |
+- ena_com_disable_adaptive_moderation(ena_dev); |
6789 |
+- } |
6790 |
++ if (coalesce->use_adaptive_rx_coalesce && |
6791 |
++ !ena_com_get_adaptive_moderation_enabled(ena_dev)) |
6792 |
++ ena_com_enable_adaptive_moderation(ena_dev); |
6793 |
++ |
6794 |
++ if (!coalesce->use_adaptive_rx_coalesce && |
6795 |
++ ena_com_get_adaptive_moderation_enabled(ena_dev)) |
6796 |
++ ena_com_disable_adaptive_moderation(ena_dev); |
6797 |
+ |
6798 |
+ return 0; |
6799 |
+ } |
6800 |
+diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c |
6801 |
+index 0edbb0a76847..5097a44686b3 100644 |
6802 |
+--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c |
6803 |
++++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c |
6804 |
+@@ -2397,15 +2397,21 @@ static int bnx2x_set_pf_tx_switching(struct bnx2x *bp, bool enable) |
6805 |
+ /* send the ramrod on all the queues of the PF */ |
6806 |
+ for_each_eth_queue(bp, i) { |
6807 |
+ struct bnx2x_fastpath *fp = &bp->fp[i]; |
6808 |
++ int tx_idx; |
6809 |
+ |
6810 |
+ /* Set the appropriate Queue object */ |
6811 |
+ q_params.q_obj = &bnx2x_sp_obj(bp, fp).q_obj; |
6812 |
+ |
6813 |
+- /* Update the Queue state */ |
6814 |
+- rc = bnx2x_queue_state_change(bp, &q_params); |
6815 |
+- if (rc) { |
6816 |
+- BNX2X_ERR("Failed to configure Tx switching\n"); |
6817 |
+- return rc; |
6818 |
++ for (tx_idx = FIRST_TX_COS_INDEX; |
6819 |
++ tx_idx < fp->max_cos; tx_idx++) { |
6820 |
++ q_params.params.update.cid_index = tx_idx; |
6821 |
++ |
6822 |
++ /* Update the Queue state */ |
6823 |
++ rc = bnx2x_queue_state_change(bp, &q_params); |
6824 |
++ if (rc) { |
6825 |
++ BNX2X_ERR("Failed to configure Tx switching\n"); |
6826 |
++ return rc; |
6827 |
++ } |
6828 |
+ } |
6829 |
+ } |
6830 |
+ |
6831 |
+diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c |
6832 |
+index 04ec909e06df..527e1bf93116 100644 |
6833 |
+--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c |
6834 |
++++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c |
6835 |
+@@ -1767,8 +1767,12 @@ static int bnxt_rx_pkt(struct bnxt *bp, struct bnxt_cp_ring_info *cpr, |
6836 |
+ |
6837 |
+ rc = -EIO; |
6838 |
+ if (rx_err & RX_CMPL_ERRORS_BUFFER_ERROR_MASK) { |
6839 |
+- netdev_warn(bp->dev, "RX buffer error %x\n", rx_err); |
6840 |
+- bnxt_sched_reset(bp, rxr); |
6841 |
++ bnapi->cp_ring.rx_buf_errors++; |
6842 |
++ if (!(bp->flags & BNXT_FLAG_CHIP_P5)) { |
6843 |
++ netdev_warn(bp->dev, "RX buffer error %x\n", |
6844 |
++ rx_err); |
6845 |
++ bnxt_sched_reset(bp, rxr); |
6846 |
++ } |
6847 |
+ } |
6848 |
+ goto next_rx_no_len; |
6849 |
+ } |
6850 |
+diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.h b/drivers/net/ethernet/broadcom/bnxt/bnxt.h |
6851 |
+index d333589811a5..5163bb848618 100644 |
6852 |
+--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.h |
6853 |
++++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.h |
6854 |
+@@ -927,6 +927,7 @@ struct bnxt_cp_ring_info { |
6855 |
+ dma_addr_t hw_stats_map; |
6856 |
+ u32 hw_stats_ctx_id; |
6857 |
+ u64 rx_l4_csum_errors; |
6858 |
++ u64 rx_buf_errors; |
6859 |
+ u64 missed_irqs; |
6860 |
+ |
6861 |
+ struct bnxt_ring_struct cp_ring_struct; |
6862 |
+diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c |
6863 |
+index 7151244f8c7d..7d2cfea05737 100644 |
6864 |
+--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c |
6865 |
++++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c |
6866 |
+@@ -311,10 +311,17 @@ static int bnxt_hwrm_nvm_req(struct bnxt *bp, u32 param_id, void *msg, |
6867 |
+ } else { |
6868 |
+ rc = hwrm_send_message_silent(bp, msg, msg_len, |
6869 |
+ HWRM_CMD_TIMEOUT); |
6870 |
+- if (!rc) |
6871 |
++ if (!rc) { |
6872 |
+ bnxt_copy_from_nvm_data(val, data, |
6873 |
+ nvm_param.nvm_num_bits, |
6874 |
+ nvm_param.dl_num_bytes); |
6875 |
++ } else { |
6876 |
++ struct hwrm_err_output *resp = bp->hwrm_cmd_resp_addr; |
6877 |
++ |
6878 |
++ if (resp->cmd_err == |
6879 |
++ NVM_GET_VARIABLE_CMD_ERR_CODE_VAR_NOT_EXIST) |
6880 |
++ rc = -EOPNOTSUPP; |
6881 |
++ } |
6882 |
+ } |
6883 |
+ dma_free_coherent(&bp->pdev->dev, sizeof(*data), data, data_dma_addr); |
6884 |
+ if (rc == -EACCES) |
6885 |
+diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c |
6886 |
+index 51c140476717..89f95428556e 100644 |
6887 |
+--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c |
6888 |
++++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c |
6889 |
+@@ -173,6 +173,7 @@ static const char * const bnxt_ring_tpa2_stats_str[] = { |
6890 |
+ |
6891 |
+ static const char * const bnxt_ring_sw_stats_str[] = { |
6892 |
+ "rx_l4_csum_errors", |
6893 |
++ "rx_buf_errors", |
6894 |
+ "missed_irqs", |
6895 |
+ }; |
6896 |
+ |
6897 |
+@@ -552,6 +553,7 @@ static void bnxt_get_ethtool_stats(struct net_device *dev, |
6898 |
+ for (k = 0; k < stat_fields; j++, k++) |
6899 |
+ buf[j] = le64_to_cpu(hw_stats[k]); |
6900 |
+ buf[j++] = cpr->rx_l4_csum_errors; |
6901 |
++ buf[j++] = cpr->rx_buf_errors; |
6902 |
+ buf[j++] = cpr->missed_irqs; |
6903 |
+ |
6904 |
+ bnxt_sw_func_stats[RX_TOTAL_DISCARDS].counter += |
6905 |
+diff --git a/drivers/net/ethernet/cortina/gemini.c b/drivers/net/ethernet/cortina/gemini.c |
6906 |
+index a8f4c69252ff..2814b96751b4 100644 |
6907 |
+--- a/drivers/net/ethernet/cortina/gemini.c |
6908 |
++++ b/drivers/net/ethernet/cortina/gemini.c |
6909 |
+@@ -576,6 +576,8 @@ static int gmac_setup_txqs(struct net_device *netdev) |
6910 |
+ |
6911 |
+ if (port->txq_dma_base & ~DMA_Q_BASE_MASK) { |
6912 |
+ dev_warn(geth->dev, "TX queue base is not aligned\n"); |
6913 |
++ dma_free_coherent(geth->dev, len * sizeof(*desc_ring), |
6914 |
++ desc_ring, port->txq_dma_base); |
6915 |
+ kfree(skb_tab); |
6916 |
+ return -ENOMEM; |
6917 |
+ } |
6918 |
+diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-ptp.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-ptp.c |
6919 |
+index a9503aea527f..6437fe6b9abf 100644 |
6920 |
+--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-ptp.c |
6921 |
++++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-ptp.c |
6922 |
+@@ -160,10 +160,10 @@ static int dpaa2_ptp_probe(struct fsl_mc_device *mc_dev) |
6923 |
+ irq = mc_dev->irqs[0]; |
6924 |
+ ptp_qoriq->irq = irq->msi_desc->irq; |
6925 |
+ |
6926 |
+- err = devm_request_threaded_irq(dev, ptp_qoriq->irq, NULL, |
6927 |
+- dpaa2_ptp_irq_handler_thread, |
6928 |
+- IRQF_NO_SUSPEND | IRQF_ONESHOT, |
6929 |
+- dev_name(dev), ptp_qoriq); |
6930 |
++ err = request_threaded_irq(ptp_qoriq->irq, NULL, |
6931 |
++ dpaa2_ptp_irq_handler_thread, |
6932 |
++ IRQF_NO_SUSPEND | IRQF_ONESHOT, |
6933 |
++ dev_name(dev), ptp_qoriq); |
6934 |
+ if (err < 0) { |
6935 |
+ dev_err(dev, "devm_request_threaded_irq(): %d\n", err); |
6936 |
+ goto err_free_mc_irq; |
6937 |
+@@ -173,18 +173,20 @@ static int dpaa2_ptp_probe(struct fsl_mc_device *mc_dev) |
6938 |
+ DPRTC_IRQ_INDEX, 1); |
6939 |
+ if (err < 0) { |
6940 |
+ dev_err(dev, "dprtc_set_irq_enable(): %d\n", err); |
6941 |
+- goto err_free_mc_irq; |
6942 |
++ goto err_free_threaded_irq; |
6943 |
+ } |
6944 |
+ |
6945 |
+ err = ptp_qoriq_init(ptp_qoriq, base, &dpaa2_ptp_caps); |
6946 |
+ if (err) |
6947 |
+- goto err_free_mc_irq; |
6948 |
++ goto err_free_threaded_irq; |
6949 |
+ |
6950 |
+ dpaa2_phc_index = ptp_qoriq->phc_index; |
6951 |
+ dev_set_drvdata(dev, ptp_qoriq); |
6952 |
+ |
6953 |
+ return 0; |
6954 |
+ |
6955 |
++err_free_threaded_irq: |
6956 |
++ free_irq(ptp_qoriq->irq, ptp_qoriq); |
6957 |
+ err_free_mc_irq: |
6958 |
+ fsl_mc_free_irqs(mc_dev); |
6959 |
+ err_unmap: |
6960 |
+diff --git a/drivers/net/ethernet/hisilicon/hip04_eth.c b/drivers/net/ethernet/hisilicon/hip04_eth.c |
6961 |
+index 4606a7e4a6d1..2ffe035e96d6 100644 |
6962 |
+--- a/drivers/net/ethernet/hisilicon/hip04_eth.c |
6963 |
++++ b/drivers/net/ethernet/hisilicon/hip04_eth.c |
6964 |
+@@ -543,9 +543,9 @@ hip04_mac_start_xmit(struct sk_buff *skb, struct net_device *ndev) |
6965 |
+ skb_tx_timestamp(skb); |
6966 |
+ |
6967 |
+ hip04_set_xmit_desc(priv, phys); |
6968 |
+- priv->tx_head = TX_NEXT(tx_head); |
6969 |
+ count++; |
6970 |
+ netdev_sent_queue(ndev, skb->len); |
6971 |
++ priv->tx_head = TX_NEXT(tx_head); |
6972 |
+ |
6973 |
+ stats->tx_bytes += skb->len; |
6974 |
+ stats->tx_packets++; |
6975 |
+diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c |
6976 |
+index 616cad0faa21..84d8816c8681 100644 |
6977 |
+--- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c |
6978 |
++++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c |
6979 |
+@@ -1692,6 +1692,9 @@ static bool hns3_get_tx_timeo_queue_info(struct net_device *ndev) |
6980 |
+ time_after(jiffies, |
6981 |
+ (trans_start + ndev->watchdog_timeo))) { |
6982 |
+ timeout_queue = i; |
6983 |
++ netdev_info(ndev, "queue state: 0x%lx, delta msecs: %u\n", |
6984 |
++ q->state, |
6985 |
++ jiffies_to_msecs(jiffies - trans_start)); |
6986 |
+ break; |
6987 |
+ } |
6988 |
+ } |
6989 |
+diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c |
6990 |
+index c052bb33b3d3..162881005a6d 100644 |
6991 |
+--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c |
6992 |
++++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c |
6993 |
+@@ -9443,6 +9443,9 @@ static int hclge_reset_ae_dev(struct hnae3_ae_dev *ae_dev) |
6994 |
+ return ret; |
6995 |
+ } |
6996 |
+ |
6997 |
++ /* Log and clear the hw errors those already occurred */ |
6998 |
++ hclge_handle_all_hns_hw_errors(ae_dev); |
6999 |
++ |
7000 |
+ /* Re-enable the hw error interrupts because |
7001 |
+ * the interrupts get disabled on global reset. |
7002 |
+ */ |
7003 |
+diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c |
7004 |
+index 0686ded7ad3a..e1ab2feeae53 100644 |
7005 |
+--- a/drivers/net/ethernet/ibm/ibmvnic.c |
7006 |
++++ b/drivers/net/ethernet/ibm/ibmvnic.c |
7007 |
+@@ -176,7 +176,7 @@ static int alloc_long_term_buff(struct ibmvnic_adapter *adapter, |
7008 |
+ ltb->map_id = adapter->map_id; |
7009 |
+ adapter->map_id++; |
7010 |
+ |
7011 |
+- init_completion(&adapter->fw_done); |
7012 |
++ reinit_completion(&adapter->fw_done); |
7013 |
+ rc = send_request_map(adapter, ltb->addr, |
7014 |
+ ltb->size, ltb->map_id); |
7015 |
+ if (rc) { |
7016 |
+@@ -215,7 +215,7 @@ static int reset_long_term_buff(struct ibmvnic_adapter *adapter, |
7017 |
+ |
7018 |
+ memset(ltb->buff, 0, ltb->size); |
7019 |
+ |
7020 |
+- init_completion(&adapter->fw_done); |
7021 |
++ reinit_completion(&adapter->fw_done); |
7022 |
+ rc = send_request_map(adapter, ltb->addr, ltb->size, ltb->map_id); |
7023 |
+ if (rc) |
7024 |
+ return rc; |
7025 |
+@@ -943,7 +943,7 @@ static int ibmvnic_get_vpd(struct ibmvnic_adapter *adapter) |
7026 |
+ if (adapter->vpd->buff) |
7027 |
+ len = adapter->vpd->len; |
7028 |
+ |
7029 |
+- init_completion(&adapter->fw_done); |
7030 |
++ reinit_completion(&adapter->fw_done); |
7031 |
+ crq.get_vpd_size.first = IBMVNIC_CRQ_CMD; |
7032 |
+ crq.get_vpd_size.cmd = GET_VPD_SIZE; |
7033 |
+ rc = ibmvnic_send_crq(adapter, &crq); |
7034 |
+@@ -1689,7 +1689,7 @@ static int __ibmvnic_set_mac(struct net_device *netdev, u8 *dev_addr) |
7035 |
+ crq.change_mac_addr.cmd = CHANGE_MAC_ADDR; |
7036 |
+ ether_addr_copy(&crq.change_mac_addr.mac_addr[0], dev_addr); |
7037 |
+ |
7038 |
+- init_completion(&adapter->fw_done); |
7039 |
++ reinit_completion(&adapter->fw_done); |
7040 |
+ rc = ibmvnic_send_crq(adapter, &crq); |
7041 |
+ if (rc) { |
7042 |
+ rc = -EIO; |
7043 |
+@@ -2316,7 +2316,7 @@ static int wait_for_reset(struct ibmvnic_adapter *adapter) |
7044 |
+ adapter->fallback.rx_entries = adapter->req_rx_add_entries_per_subcrq; |
7045 |
+ adapter->fallback.tx_entries = adapter->req_tx_entries_per_subcrq; |
7046 |
+ |
7047 |
+- init_completion(&adapter->reset_done); |
7048 |
++ reinit_completion(&adapter->reset_done); |
7049 |
+ adapter->wait_for_reset = true; |
7050 |
+ rc = ibmvnic_reset(adapter, VNIC_RESET_CHANGE_PARAM); |
7051 |
+ if (rc) |
7052 |
+@@ -2332,7 +2332,7 @@ static int wait_for_reset(struct ibmvnic_adapter *adapter) |
7053 |
+ adapter->desired.rx_entries = adapter->fallback.rx_entries; |
7054 |
+ adapter->desired.tx_entries = adapter->fallback.tx_entries; |
7055 |
+ |
7056 |
+- init_completion(&adapter->reset_done); |
7057 |
++ reinit_completion(&adapter->reset_done); |
7058 |
+ adapter->wait_for_reset = true; |
7059 |
+ rc = ibmvnic_reset(adapter, VNIC_RESET_CHANGE_PARAM); |
7060 |
+ if (rc) |
7061 |
+@@ -2603,7 +2603,7 @@ static void ibmvnic_get_ethtool_stats(struct net_device *dev, |
7062 |
+ cpu_to_be32(sizeof(struct ibmvnic_statistics)); |
7063 |
+ |
7064 |
+ /* Wait for data to be written */ |
7065 |
+- init_completion(&adapter->stats_done); |
7066 |
++ reinit_completion(&adapter->stats_done); |
7067 |
+ rc = ibmvnic_send_crq(adapter, &crq); |
7068 |
+ if (rc) |
7069 |
+ return; |
7070 |
+@@ -4408,7 +4408,7 @@ static int send_query_phys_parms(struct ibmvnic_adapter *adapter) |
7071 |
+ memset(&crq, 0, sizeof(crq)); |
7072 |
+ crq.query_phys_parms.first = IBMVNIC_CRQ_CMD; |
7073 |
+ crq.query_phys_parms.cmd = QUERY_PHYS_PARMS; |
7074 |
+- init_completion(&adapter->fw_done); |
7075 |
++ reinit_completion(&adapter->fw_done); |
7076 |
+ rc = ibmvnic_send_crq(adapter, &crq); |
7077 |
+ if (rc) |
7078 |
+ return rc; |
7079 |
+@@ -4960,6 +4960,9 @@ static int ibmvnic_probe(struct vio_dev *dev, const struct vio_device_id *id) |
7080 |
+ INIT_LIST_HEAD(&adapter->rwi_list); |
7081 |
+ spin_lock_init(&adapter->rwi_lock); |
7082 |
+ init_completion(&adapter->init_done); |
7083 |
++ init_completion(&adapter->fw_done); |
7084 |
++ init_completion(&adapter->reset_done); |
7085 |
++ init_completion(&adapter->stats_done); |
7086 |
+ clear_bit(0, &adapter->resetting); |
7087 |
+ |
7088 |
+ do { |
7089 |
+diff --git a/drivers/net/ethernet/intel/i40e/i40e_common.c b/drivers/net/ethernet/intel/i40e/i40e_common.c |
7090 |
+index 7560f06768e0..3160b5bbe672 100644 |
7091 |
+--- a/drivers/net/ethernet/intel/i40e/i40e_common.c |
7092 |
++++ b/drivers/net/ethernet/intel/i40e/i40e_common.c |
7093 |
+@@ -2571,9 +2571,16 @@ noinline_for_stack i40e_status i40e_update_link_info(struct i40e_hw *hw) |
7094 |
+ if (status) |
7095 |
+ return status; |
7096 |
+ |
7097 |
+- hw->phy.link_info.req_fec_info = |
7098 |
+- abilities.fec_cfg_curr_mod_ext_info & |
7099 |
+- (I40E_AQ_REQUEST_FEC_KR | I40E_AQ_REQUEST_FEC_RS); |
7100 |
++ if (abilities.fec_cfg_curr_mod_ext_info & |
7101 |
++ I40E_AQ_ENABLE_FEC_AUTO) |
7102 |
++ hw->phy.link_info.req_fec_info = |
7103 |
++ (I40E_AQ_REQUEST_FEC_KR | |
7104 |
++ I40E_AQ_REQUEST_FEC_RS); |
7105 |
++ else |
7106 |
++ hw->phy.link_info.req_fec_info = |
7107 |
++ abilities.fec_cfg_curr_mod_ext_info & |
7108 |
++ (I40E_AQ_REQUEST_FEC_KR | |
7109 |
++ I40E_AQ_REQUEST_FEC_RS); |
7110 |
+ |
7111 |
+ memcpy(hw->phy.link_info.module_type, &abilities.module_type, |
7112 |
+ sizeof(hw->phy.link_info.module_type)); |
7113 |
+diff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c |
7114 |
+index 41e1240acaea..b577e6adf3bf 100644 |
7115 |
+--- a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c |
7116 |
++++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c |
7117 |
+@@ -722,7 +722,14 @@ static void i40e_get_settings_link_up_fec(u8 req_fec_info, |
7118 |
+ ethtool_link_ksettings_add_link_mode(ks, supported, FEC_RS); |
7119 |
+ ethtool_link_ksettings_add_link_mode(ks, supported, FEC_BASER); |
7120 |
+ |
7121 |
+- if (I40E_AQ_SET_FEC_REQUEST_RS & req_fec_info) { |
7122 |
++ if ((I40E_AQ_SET_FEC_REQUEST_RS & req_fec_info) && |
7123 |
++ (I40E_AQ_SET_FEC_REQUEST_KR & req_fec_info)) { |
7124 |
++ ethtool_link_ksettings_add_link_mode(ks, advertising, |
7125 |
++ FEC_NONE); |
7126 |
++ ethtool_link_ksettings_add_link_mode(ks, advertising, |
7127 |
++ FEC_BASER); |
7128 |
++ ethtool_link_ksettings_add_link_mode(ks, advertising, FEC_RS); |
7129 |
++ } else if (I40E_AQ_SET_FEC_REQUEST_RS & req_fec_info) { |
7130 |
+ ethtool_link_ksettings_add_link_mode(ks, advertising, FEC_RS); |
7131 |
+ } else if (I40E_AQ_SET_FEC_REQUEST_KR & req_fec_info) { |
7132 |
+ ethtool_link_ksettings_add_link_mode(ks, advertising, |
7133 |
+@@ -730,12 +737,6 @@ static void i40e_get_settings_link_up_fec(u8 req_fec_info, |
7134 |
+ } else { |
7135 |
+ ethtool_link_ksettings_add_link_mode(ks, advertising, |
7136 |
+ FEC_NONE); |
7137 |
+- if (I40E_AQ_SET_FEC_AUTO & req_fec_info) { |
7138 |
+- ethtool_link_ksettings_add_link_mode(ks, advertising, |
7139 |
+- FEC_RS); |
7140 |
+- ethtool_link_ksettings_add_link_mode(ks, advertising, |
7141 |
+- FEC_BASER); |
7142 |
+- } |
7143 |
+ } |
7144 |
+ } |
7145 |
+ |
7146 |
+@@ -1437,6 +1438,7 @@ static int i40e_get_fec_param(struct net_device *netdev, |
7147 |
+ struct i40e_hw *hw = &pf->hw; |
7148 |
+ i40e_status status = 0; |
7149 |
+ int err = 0; |
7150 |
++ u8 fec_cfg; |
7151 |
+ |
7152 |
+ /* Get the current phy config */ |
7153 |
+ memset(&abilities, 0, sizeof(abilities)); |
7154 |
+@@ -1448,18 +1450,16 @@ static int i40e_get_fec_param(struct net_device *netdev, |
7155 |
+ } |
7156 |
+ |
7157 |
+ fecparam->fec = 0; |
7158 |
+- if (abilities.fec_cfg_curr_mod_ext_info & I40E_AQ_SET_FEC_AUTO) |
7159 |
++ fec_cfg = abilities.fec_cfg_curr_mod_ext_info; |
7160 |
++ if (fec_cfg & I40E_AQ_SET_FEC_AUTO) |
7161 |
+ fecparam->fec |= ETHTOOL_FEC_AUTO; |
7162 |
+- if ((abilities.fec_cfg_curr_mod_ext_info & |
7163 |
+- I40E_AQ_SET_FEC_REQUEST_RS) || |
7164 |
+- (abilities.fec_cfg_curr_mod_ext_info & |
7165 |
+- I40E_AQ_SET_FEC_ABILITY_RS)) |
7166 |
++ else if (fec_cfg & (I40E_AQ_SET_FEC_REQUEST_RS | |
7167 |
++ I40E_AQ_SET_FEC_ABILITY_RS)) |
7168 |
+ fecparam->fec |= ETHTOOL_FEC_RS; |
7169 |
+- if ((abilities.fec_cfg_curr_mod_ext_info & |
7170 |
+- I40E_AQ_SET_FEC_REQUEST_KR) || |
7171 |
+- (abilities.fec_cfg_curr_mod_ext_info & I40E_AQ_SET_FEC_ABILITY_KR)) |
7172 |
++ else if (fec_cfg & (I40E_AQ_SET_FEC_REQUEST_KR | |
7173 |
++ I40E_AQ_SET_FEC_ABILITY_KR)) |
7174 |
+ fecparam->fec |= ETHTOOL_FEC_BASER; |
7175 |
+- if (abilities.fec_cfg_curr_mod_ext_info == 0) |
7176 |
++ if (fec_cfg == 0) |
7177 |
+ fecparam->fec |= ETHTOOL_FEC_OFF; |
7178 |
+ |
7179 |
+ if (hw->phy.link_info.fec_info & I40E_AQ_CONFIG_FEC_KR_ENA) |
7180 |
+diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c |
7181 |
+index 6031223eafab..339925af0206 100644 |
7182 |
+--- a/drivers/net/ethernet/intel/i40e/i40e_main.c |
7183 |
++++ b/drivers/net/ethernet/intel/i40e/i40e_main.c |
7184 |
+@@ -3534,14 +3534,14 @@ static void i40e_vsi_configure_msix(struct i40e_vsi *vsi) |
7185 |
+ q_vector->rx.target_itr = |
7186 |
+ ITR_TO_REG(vsi->rx_rings[i]->itr_setting); |
7187 |
+ wr32(hw, I40E_PFINT_ITRN(I40E_RX_ITR, vector - 1), |
7188 |
+- q_vector->rx.target_itr); |
7189 |
++ q_vector->rx.target_itr >> 1); |
7190 |
+ q_vector->rx.current_itr = q_vector->rx.target_itr; |
7191 |
+ |
7192 |
+ q_vector->tx.next_update = jiffies + 1; |
7193 |
+ q_vector->tx.target_itr = |
7194 |
+ ITR_TO_REG(vsi->tx_rings[i]->itr_setting); |
7195 |
+ wr32(hw, I40E_PFINT_ITRN(I40E_TX_ITR, vector - 1), |
7196 |
+- q_vector->tx.target_itr); |
7197 |
++ q_vector->tx.target_itr >> 1); |
7198 |
+ q_vector->tx.current_itr = q_vector->tx.target_itr; |
7199 |
+ |
7200 |
+ wr32(hw, I40E_PFINT_RATEN(vector - 1), |
7201 |
+@@ -3646,11 +3646,11 @@ static void i40e_configure_msi_and_legacy(struct i40e_vsi *vsi) |
7202 |
+ /* set the ITR configuration */ |
7203 |
+ q_vector->rx.next_update = jiffies + 1; |
7204 |
+ q_vector->rx.target_itr = ITR_TO_REG(vsi->rx_rings[0]->itr_setting); |
7205 |
+- wr32(hw, I40E_PFINT_ITR0(I40E_RX_ITR), q_vector->rx.target_itr); |
7206 |
++ wr32(hw, I40E_PFINT_ITR0(I40E_RX_ITR), q_vector->rx.target_itr >> 1); |
7207 |
+ q_vector->rx.current_itr = q_vector->rx.target_itr; |
7208 |
+ q_vector->tx.next_update = jiffies + 1; |
7209 |
+ q_vector->tx.target_itr = ITR_TO_REG(vsi->tx_rings[0]->itr_setting); |
7210 |
+- wr32(hw, I40E_PFINT_ITR0(I40E_TX_ITR), q_vector->tx.target_itr); |
7211 |
++ wr32(hw, I40E_PFINT_ITR0(I40E_TX_ITR), q_vector->tx.target_itr >> 1); |
7212 |
+ q_vector->tx.current_itr = q_vector->tx.target_itr; |
7213 |
+ |
7214 |
+ i40e_enable_misc_int_causes(pf); |
7215 |
+@@ -11396,7 +11396,7 @@ static int i40e_setup_misc_vector(struct i40e_pf *pf) |
7216 |
+ |
7217 |
+ /* associate no queues to the misc vector */ |
7218 |
+ wr32(hw, I40E_PFINT_LNKLST0, I40E_QUEUE_END_OF_LIST); |
7219 |
+- wr32(hw, I40E_PFINT_ITR0(I40E_RX_ITR), I40E_ITR_8K); |
7220 |
++ wr32(hw, I40E_PFINT_ITR0(I40E_RX_ITR), I40E_ITR_8K >> 1); |
7221 |
+ |
7222 |
+ i40e_flush(hw); |
7223 |
+ |
7224 |
+diff --git a/drivers/net/ethernet/intel/ice/ice_controlq.c b/drivers/net/ethernet/intel/ice/ice_controlq.c |
7225 |
+index 2353166c654e..c68709c7ef81 100644 |
7226 |
+--- a/drivers/net/ethernet/intel/ice/ice_controlq.c |
7227 |
++++ b/drivers/net/ethernet/intel/ice/ice_controlq.c |
7228 |
+@@ -948,7 +948,7 @@ ice_sq_send_cmd(struct ice_hw *hw, struct ice_ctl_q_info *cq, |
7229 |
+ if (ice_sq_done(hw, cq)) |
7230 |
+ break; |
7231 |
+ |
7232 |
+- mdelay(1); |
7233 |
++ udelay(ICE_CTL_Q_SQ_CMD_USEC); |
7234 |
+ total_delay++; |
7235 |
+ } while (total_delay < cq->sq_cmd_timeout); |
7236 |
+ |
7237 |
+diff --git a/drivers/net/ethernet/intel/ice/ice_controlq.h b/drivers/net/ethernet/intel/ice/ice_controlq.h |
7238 |
+index 44945c2165d8..4df9da359135 100644 |
7239 |
+--- a/drivers/net/ethernet/intel/ice/ice_controlq.h |
7240 |
++++ b/drivers/net/ethernet/intel/ice/ice_controlq.h |
7241 |
+@@ -31,8 +31,9 @@ enum ice_ctl_q { |
7242 |
+ ICE_CTL_Q_MAILBOX, |
7243 |
+ }; |
7244 |
+ |
7245 |
+-/* Control Queue default settings */ |
7246 |
+-#define ICE_CTL_Q_SQ_CMD_TIMEOUT 250 /* msecs */ |
7247 |
++/* Control Queue timeout settings - max delay 250ms */ |
7248 |
++#define ICE_CTL_Q_SQ_CMD_TIMEOUT 2500 /* Count 2500 times */ |
7249 |
++#define ICE_CTL_Q_SQ_CMD_USEC 100 /* Check every 100usec */ |
7250 |
+ |
7251 |
+ struct ice_ctl_q_ring { |
7252 |
+ void *dma_head; /* Virtual address to DMA head */ |
7253 |
+diff --git a/drivers/net/ethernet/intel/ice/ice_ethtool.c b/drivers/net/ethernet/intel/ice/ice_ethtool.c |
7254 |
+index 7e23034df955..1fe9f6050635 100644 |
7255 |
+--- a/drivers/net/ethernet/intel/ice/ice_ethtool.c |
7256 |
++++ b/drivers/net/ethernet/intel/ice/ice_ethtool.c |
7257 |
+@@ -3368,10 +3368,17 @@ __ice_set_coalesce(struct net_device *netdev, struct ethtool_coalesce *ec, |
7258 |
+ struct ice_vsi *vsi = np->vsi; |
7259 |
+ |
7260 |
+ if (q_num < 0) { |
7261 |
+- int i; |
7262 |
++ int v_idx; |
7263 |
++ |
7264 |
++ ice_for_each_q_vector(vsi, v_idx) { |
7265 |
++ /* In some cases if DCB is configured the num_[rx|tx]q |
7266 |
++ * can be less than vsi->num_q_vectors. This check |
7267 |
++ * accounts for that so we don't report a false failure |
7268 |
++ */ |
7269 |
++ if (v_idx >= vsi->num_rxq && v_idx >= vsi->num_txq) |
7270 |
++ goto set_complete; |
7271 |
+ |
7272 |
+- ice_for_each_q_vector(vsi, i) { |
7273 |
+- if (ice_set_q_coalesce(vsi, ec, i)) |
7274 |
++ if (ice_set_q_coalesce(vsi, ec, v_idx)) |
7275 |
+ return -EINVAL; |
7276 |
+ } |
7277 |
+ goto set_complete; |
7278 |
+diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c |
7279 |
+index 214cd6eca405..2408f0de95fc 100644 |
7280 |
+--- a/drivers/net/ethernet/intel/ice/ice_main.c |
7281 |
++++ b/drivers/net/ethernet/intel/ice/ice_main.c |
7282 |
+@@ -3970,8 +3970,13 @@ int ice_vsi_setup_tx_rings(struct ice_vsi *vsi) |
7283 |
+ } |
7284 |
+ |
7285 |
+ ice_for_each_txq(vsi, i) { |
7286 |
+- vsi->tx_rings[i]->netdev = vsi->netdev; |
7287 |
+- err = ice_setup_tx_ring(vsi->tx_rings[i]); |
7288 |
++ struct ice_ring *ring = vsi->tx_rings[i]; |
7289 |
++ |
7290 |
++ if (!ring) |
7291 |
++ return -EINVAL; |
7292 |
++ |
7293 |
++ ring->netdev = vsi->netdev; |
7294 |
++ err = ice_setup_tx_ring(ring); |
7295 |
+ if (err) |
7296 |
+ break; |
7297 |
+ } |
7298 |
+@@ -3996,8 +4001,13 @@ int ice_vsi_setup_rx_rings(struct ice_vsi *vsi) |
7299 |
+ } |
7300 |
+ |
7301 |
+ ice_for_each_rxq(vsi, i) { |
7302 |
+- vsi->rx_rings[i]->netdev = vsi->netdev; |
7303 |
+- err = ice_setup_rx_ring(vsi->rx_rings[i]); |
7304 |
++ struct ice_ring *ring = vsi->rx_rings[i]; |
7305 |
++ |
7306 |
++ if (!ring) |
7307 |
++ return -EINVAL; |
7308 |
++ |
7309 |
++ ring->netdev = vsi->netdev; |
7310 |
++ err = ice_setup_rx_ring(ring); |
7311 |
+ if (err) |
7312 |
+ break; |
7313 |
+ } |
7314 |
+diff --git a/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c b/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c |
7315 |
+index b45797f39b2f..c0637a0cbfe8 100644 |
7316 |
+--- a/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c |
7317 |
++++ b/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c |
7318 |
+@@ -317,8 +317,9 @@ void ice_free_vfs(struct ice_pf *pf) |
7319 |
+ pf->num_alloc_vfs = 0; |
7320 |
+ for (i = 0; i < tmp; i++) { |
7321 |
+ if (test_bit(ICE_VF_STATE_INIT, pf->vf[i].vf_states)) { |
7322 |
+- /* disable VF qp mappings */ |
7323 |
++ /* disable VF qp mappings and set VF disable state */ |
7324 |
+ ice_dis_vf_mappings(&pf->vf[i]); |
7325 |
++ set_bit(ICE_VF_STATE_DIS, pf->vf[i].vf_states); |
7326 |
+ ice_free_vf_res(&pf->vf[i]); |
7327 |
+ } |
7328 |
+ } |
7329 |
+@@ -1287,9 +1288,12 @@ static void ice_vc_notify_vf_reset(struct ice_vf *vf) |
7330 |
+ if (!vf || vf->vf_id >= vf->pf->num_alloc_vfs) |
7331 |
+ return; |
7332 |
+ |
7333 |
+- /* verify if the VF is in either init or active before proceeding */ |
7334 |
+- if (!test_bit(ICE_VF_STATE_INIT, vf->vf_states) && |
7335 |
+- !test_bit(ICE_VF_STATE_ACTIVE, vf->vf_states)) |
7336 |
++ /* Bail out if VF is in disabled state, neither initialized, nor active |
7337 |
++ * state - otherwise proceed with notifications |
7338 |
++ */ |
7339 |
++ if ((!test_bit(ICE_VF_STATE_INIT, vf->vf_states) && |
7340 |
++ !test_bit(ICE_VF_STATE_ACTIVE, vf->vf_states)) || |
7341 |
++ test_bit(ICE_VF_STATE_DIS, vf->vf_states)) |
7342 |
+ return; |
7343 |
+ |
7344 |
+ pfe.event = VIRTCHNL_EVENT_RESET_IMPENDING; |
7345 |
+diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c |
7346 |
+index 91b3780ddb04..1a7203fede12 100644 |
7347 |
+--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c |
7348 |
++++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c |
7349 |
+@@ -8639,7 +8639,8 @@ netdev_tx_t ixgbe_xmit_frame_ring(struct sk_buff *skb, |
7350 |
+ |
7351 |
+ if (unlikely(skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP) && |
7352 |
+ adapter->ptp_clock) { |
7353 |
+- if (!test_and_set_bit_lock(__IXGBE_PTP_TX_IN_PROGRESS, |
7354 |
++ if (adapter->tstamp_config.tx_type == HWTSTAMP_TX_ON && |
7355 |
++ !test_and_set_bit_lock(__IXGBE_PTP_TX_IN_PROGRESS, |
7356 |
+ &adapter->state)) { |
7357 |
+ skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS; |
7358 |
+ tx_flags |= IXGBE_TX_FLAGS_TSTAMP; |
7359 |
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c |
7360 |
+index c2c7f214a56a..814a4ba4e7fa 100644 |
7361 |
+--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c |
7362 |
++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c |
7363 |
+@@ -3443,6 +3443,12 @@ static int parse_tc_fdb_actions(struct mlx5e_priv *priv, |
7364 |
+ attr->action |= MLX5_FLOW_CONTEXT_ACTION_FWD_DEST; |
7365 |
+ } |
7366 |
+ |
7367 |
++ if (!(attr->action & |
7368 |
++ (MLX5_FLOW_CONTEXT_ACTION_FWD_DEST | MLX5_FLOW_CONTEXT_ACTION_DROP))) { |
7369 |
++ NL_SET_ERR_MSG(extack, "Rule must have at least one forward/drop action"); |
7370 |
++ return -EOPNOTSUPP; |
7371 |
++ } |
7372 |
++ |
7373 |
+ if (attr->split_count > 0 && !mlx5_esw_has_fwd_fdb(priv->mdev)) { |
7374 |
+ NL_SET_ERR_MSG_MOD(extack, |
7375 |
+ "current firmware doesn't support split rule for port mirroring"); |
7376 |
+diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c |
7377 |
+index 39d600c8b92d..210ebc91d3d6 100644 |
7378 |
+--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c |
7379 |
++++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c |
7380 |
+@@ -5637,8 +5637,13 @@ static void mlxsw_sp_router_fib6_del(struct mlxsw_sp *mlxsw_sp, |
7381 |
+ if (mlxsw_sp_fib6_rt_should_ignore(rt)) |
7382 |
+ return; |
7383 |
+ |
7384 |
++ /* Multipath routes are first added to the FIB trie and only then |
7385 |
++ * notified. If we vetoed the addition, we will get a delete |
7386 |
++ * notification for a route we do not have. Therefore, do not warn if |
7387 |
++ * route was not found. |
7388 |
++ */ |
7389 |
+ fib6_entry = mlxsw_sp_fib6_entry_lookup(mlxsw_sp, rt); |
7390 |
+- if (WARN_ON(!fib6_entry)) |
7391 |
++ if (!fib6_entry) |
7392 |
+ return; |
7393 |
+ |
7394 |
+ /* If not all the nexthops are deleted, then only reduce the nexthop |
7395 |
+diff --git a/drivers/net/ethernet/netronome/nfp/flower/metadata.c b/drivers/net/ethernet/netronome/nfp/flower/metadata.c |
7396 |
+index 7c4a15e967df..5defd31d481c 100644 |
7397 |
+--- a/drivers/net/ethernet/netronome/nfp/flower/metadata.c |
7398 |
++++ b/drivers/net/ethernet/netronome/nfp/flower/metadata.c |
7399 |
+@@ -65,17 +65,17 @@ static int nfp_get_stats_entry(struct nfp_app *app, u32 *stats_context_id) |
7400 |
+ freed_stats_id = priv->stats_ring_size; |
7401 |
+ /* Check for unallocated entries first. */ |
7402 |
+ if (priv->stats_ids.init_unalloc > 0) { |
7403 |
+- if (priv->active_mem_unit == priv->total_mem_units) { |
7404 |
+- priv->stats_ids.init_unalloc--; |
7405 |
+- priv->active_mem_unit = 0; |
7406 |
+- } |
7407 |
+- |
7408 |
+ *stats_context_id = |
7409 |
+ FIELD_PREP(NFP_FL_STAT_ID_STAT, |
7410 |
+ priv->stats_ids.init_unalloc - 1) | |
7411 |
+ FIELD_PREP(NFP_FL_STAT_ID_MU_NUM, |
7412 |
+ priv->active_mem_unit); |
7413 |
+- priv->active_mem_unit++; |
7414 |
++ |
7415 |
++ if (++priv->active_mem_unit == priv->total_mem_units) { |
7416 |
++ priv->stats_ids.init_unalloc--; |
7417 |
++ priv->active_mem_unit = 0; |
7418 |
++ } |
7419 |
++ |
7420 |
+ return 0; |
7421 |
+ } |
7422 |
+ |
7423 |
+diff --git a/drivers/net/ethernet/qlogic/qede/qede_filter.c b/drivers/net/ethernet/qlogic/qede/qede_filter.c |
7424 |
+index 9a6a9a008714..c8bdbf057d5a 100644 |
7425 |
+--- a/drivers/net/ethernet/qlogic/qede/qede_filter.c |
7426 |
++++ b/drivers/net/ethernet/qlogic/qede/qede_filter.c |
7427 |
+@@ -1230,7 +1230,7 @@ qede_configure_mcast_filtering(struct net_device *ndev, |
7428 |
+ netif_addr_lock_bh(ndev); |
7429 |
+ |
7430 |
+ mc_count = netdev_mc_count(ndev); |
7431 |
+- if (mc_count < 64) { |
7432 |
++ if (mc_count <= 64) { |
7433 |
+ netdev_for_each_mc_addr(ha, ndev) { |
7434 |
+ ether_addr_copy(temp, ha->addr); |
7435 |
+ temp += ETH_ALEN; |
7436 |
+diff --git a/drivers/net/ethernet/qlogic/qede/qede_main.c b/drivers/net/ethernet/qlogic/qede/qede_main.c |
7437 |
+index a220cc7c947a..ba53612ae0df 100644 |
7438 |
+--- a/drivers/net/ethernet/qlogic/qede/qede_main.c |
7439 |
++++ b/drivers/net/ethernet/qlogic/qede/qede_main.c |
7440 |
+@@ -1406,6 +1406,7 @@ static int qede_alloc_mem_rxq(struct qede_dev *edev, struct qede_rx_queue *rxq) |
7441 |
+ rxq->rx_buf_seg_size = roundup_pow_of_two(size); |
7442 |
+ } else { |
7443 |
+ rxq->rx_buf_seg_size = PAGE_SIZE; |
7444 |
++ edev->ndev->features &= ~NETIF_F_GRO_HW; |
7445 |
+ } |
7446 |
+ |
7447 |
+ /* Allocate the parallel driver ring for Rx buffers */ |
7448 |
+@@ -1450,6 +1451,7 @@ static int qede_alloc_mem_rxq(struct qede_dev *edev, struct qede_rx_queue *rxq) |
7449 |
+ } |
7450 |
+ } |
7451 |
+ |
7452 |
++ edev->gro_disable = !(edev->ndev->features & NETIF_F_GRO_HW); |
7453 |
+ if (!edev->gro_disable) |
7454 |
+ qede_set_tpa_param(rxq); |
7455 |
+ err: |
7456 |
+@@ -1702,8 +1704,6 @@ static void qede_init_fp(struct qede_dev *edev) |
7457 |
+ snprintf(fp->name, sizeof(fp->name), "%s-fp-%d", |
7458 |
+ edev->ndev->name, queue_id); |
7459 |
+ } |
7460 |
+- |
7461 |
+- edev->gro_disable = !(edev->ndev->features & NETIF_F_GRO_HW); |
7462 |
+ } |
7463 |
+ |
7464 |
+ static int qede_set_real_num_queues(struct qede_dev *edev) |
7465 |
+diff --git a/drivers/net/ethernet/qlogic/qla3xxx.c b/drivers/net/ethernet/qlogic/qla3xxx.c |
7466 |
+index b4b8ba00ee01..986f26578d34 100644 |
7467 |
+--- a/drivers/net/ethernet/qlogic/qla3xxx.c |
7468 |
++++ b/drivers/net/ethernet/qlogic/qla3xxx.c |
7469 |
+@@ -2756,6 +2756,9 @@ static int ql_alloc_large_buffers(struct ql3_adapter *qdev) |
7470 |
+ int err; |
7471 |
+ |
7472 |
+ for (i = 0; i < qdev->num_large_buffers; i++) { |
7473 |
++ lrg_buf_cb = &qdev->lrg_buf[i]; |
7474 |
++ memset(lrg_buf_cb, 0, sizeof(struct ql_rcv_buf_cb)); |
7475 |
++ |
7476 |
+ skb = netdev_alloc_skb(qdev->ndev, |
7477 |
+ qdev->lrg_buffer_len); |
7478 |
+ if (unlikely(!skb)) { |
7479 |
+@@ -2766,11 +2769,7 @@ static int ql_alloc_large_buffers(struct ql3_adapter *qdev) |
7480 |
+ ql_free_large_buffers(qdev); |
7481 |
+ return -ENOMEM; |
7482 |
+ } else { |
7483 |
+- |
7484 |
+- lrg_buf_cb = &qdev->lrg_buf[i]; |
7485 |
+- memset(lrg_buf_cb, 0, sizeof(struct ql_rcv_buf_cb)); |
7486 |
+ lrg_buf_cb->index = i; |
7487 |
+- lrg_buf_cb->skb = skb; |
7488 |
+ /* |
7489 |
+ * We save some space to copy the ethhdr from first |
7490 |
+ * buffer |
7491 |
+@@ -2792,6 +2791,7 @@ static int ql_alloc_large_buffers(struct ql3_adapter *qdev) |
7492 |
+ return -ENOMEM; |
7493 |
+ } |
7494 |
+ |
7495 |
++ lrg_buf_cb->skb = skb; |
7496 |
+ dma_unmap_addr_set(lrg_buf_cb, mapaddr, map); |
7497 |
+ dma_unmap_len_set(lrg_buf_cb, maplen, |
7498 |
+ qdev->lrg_buffer_len - |
7499 |
+diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c |
7500 |
+index 4fe0977d01fa..5ae0b5663d54 100644 |
7501 |
+--- a/drivers/net/ethernet/realtek/r8169_main.c |
7502 |
++++ b/drivers/net/ethernet/realtek/r8169_main.c |
7503 |
+@@ -680,6 +680,7 @@ struct rtl8169_private { |
7504 |
+ struct rtl8169_counters *counters; |
7505 |
+ struct rtl8169_tc_offsets tc_offset; |
7506 |
+ u32 saved_wolopts; |
7507 |
++ int eee_adv; |
7508 |
+ |
7509 |
+ const char *fw_name; |
7510 |
+ struct rtl_fw *rtl_fw; |
7511 |
+@@ -2075,6 +2076,10 @@ static int rtl8169_set_eee(struct net_device *dev, struct ethtool_eee *data) |
7512 |
+ } |
7513 |
+ |
7514 |
+ ret = phy_ethtool_set_eee(tp->phydev, data); |
7515 |
++ |
7516 |
++ if (!ret) |
7517 |
++ tp->eee_adv = phy_read_mmd(dev->phydev, MDIO_MMD_AN, |
7518 |
++ MDIO_AN_EEE_ADV); |
7519 |
+ out: |
7520 |
+ pm_runtime_put_noidle(d); |
7521 |
+ return ret; |
7522 |
+@@ -2105,10 +2110,16 @@ static const struct ethtool_ops rtl8169_ethtool_ops = { |
7523 |
+ static void rtl_enable_eee(struct rtl8169_private *tp) |
7524 |
+ { |
7525 |
+ struct phy_device *phydev = tp->phydev; |
7526 |
+- int supported = phy_read_mmd(phydev, MDIO_MMD_PCS, MDIO_PCS_EEE_ABLE); |
7527 |
++ int adv; |
7528 |
++ |
7529 |
++ /* respect EEE advertisement the user may have set */ |
7530 |
++ if (tp->eee_adv >= 0) |
7531 |
++ adv = tp->eee_adv; |
7532 |
++ else |
7533 |
++ adv = phy_read_mmd(phydev, MDIO_MMD_PCS, MDIO_PCS_EEE_ABLE); |
7534 |
+ |
7535 |
+- if (supported > 0) |
7536 |
+- phy_write_mmd(phydev, MDIO_MMD_AN, MDIO_AN_EEE_ADV, supported); |
7537 |
++ if (adv >= 0) |
7538 |
++ phy_write_mmd(phydev, MDIO_MMD_AN, MDIO_AN_EEE_ADV, adv); |
7539 |
+ } |
7540 |
+ |
7541 |
+ static void rtl8169_get_mac_version(struct rtl8169_private *tp) |
7542 |
+@@ -7064,6 +7075,7 @@ static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) |
7543 |
+ tp->pci_dev = pdev; |
7544 |
+ tp->msg_enable = netif_msg_init(debug.msg_enable, R8169_MSG_DEFAULT); |
7545 |
+ tp->supports_gmii = ent->driver_data == RTL_CFG_NO_GBIT ? 0 : 1; |
7546 |
++ tp->eee_adv = -1; |
7547 |
+ |
7548 |
+ /* Get the *optional* external "ether_clk" used on some boards */ |
7549 |
+ rc = rtl_get_ether_clk(tp); |
7550 |
+diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c |
7551 |
+index 170c3a052b14..1f230bd854c4 100644 |
7552 |
+--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c |
7553 |
++++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c |
7554 |
+@@ -320,7 +320,7 @@ out: |
7555 |
+ static int stmmac_dt_phy(struct plat_stmmacenet_data *plat, |
7556 |
+ struct device_node *np, struct device *dev) |
7557 |
+ { |
7558 |
+- bool mdio = true; |
7559 |
++ bool mdio = false; |
7560 |
+ static const struct of_device_id need_mdio_ids[] = { |
7561 |
+ { .compatible = "snps,dwc-qos-ethernet-4.10" }, |
7562 |
+ {}, |
7563 |
+diff --git a/drivers/net/ethernet/ti/Kconfig b/drivers/net/ethernet/ti/Kconfig |
7564 |
+index 834afca3a019..137632b09c72 100644 |
7565 |
+--- a/drivers/net/ethernet/ti/Kconfig |
7566 |
++++ b/drivers/net/ethernet/ti/Kconfig |
7567 |
+@@ -22,6 +22,7 @@ config TI_DAVINCI_EMAC |
7568 |
+ depends on ARM && ( ARCH_DAVINCI || ARCH_OMAP3 ) || COMPILE_TEST |
7569 |
+ select TI_DAVINCI_MDIO |
7570 |
+ select PHYLIB |
7571 |
++ select GENERIC_ALLOCATOR |
7572 |
+ ---help--- |
7573 |
+ This driver supports TI's DaVinci Ethernet . |
7574 |
+ |
7575 |
+diff --git a/drivers/net/ethernet/ti/cpsw_ale.c b/drivers/net/ethernet/ti/cpsw_ale.c |
7576 |
+index 84025dcc78d5..e7c24396933e 100644 |
7577 |
+--- a/drivers/net/ethernet/ti/cpsw_ale.c |
7578 |
++++ b/drivers/net/ethernet/ti/cpsw_ale.c |
7579 |
+@@ -779,6 +779,7 @@ void cpsw_ale_start(struct cpsw_ale *ale) |
7580 |
+ void cpsw_ale_stop(struct cpsw_ale *ale) |
7581 |
+ { |
7582 |
+ del_timer_sync(&ale->timer); |
7583 |
++ cpsw_ale_control_set(ale, 0, ALE_CLEAR, 1); |
7584 |
+ cpsw_ale_control_set(ale, 0, ALE_ENABLE, 0); |
7585 |
+ } |
7586 |
+ |
7587 |
+@@ -862,6 +863,7 @@ struct cpsw_ale *cpsw_ale_create(struct cpsw_ale_params *params) |
7588 |
+ ALE_UNKNOWNVLAN_FORCE_UNTAG_EGRESS; |
7589 |
+ } |
7590 |
+ |
7591 |
++ cpsw_ale_control_set(ale, 0, ALE_CLEAR, 1); |
7592 |
+ return ale; |
7593 |
+ } |
7594 |
+ |
7595 |
+diff --git a/drivers/net/ethernet/ti/davinci_cpdma.c b/drivers/net/ethernet/ti/davinci_cpdma.c |
7596 |
+index 37ba708ac781..6614fa3089b2 100644 |
7597 |
+--- a/drivers/net/ethernet/ti/davinci_cpdma.c |
7598 |
++++ b/drivers/net/ethernet/ti/davinci_cpdma.c |
7599 |
+@@ -1018,7 +1018,6 @@ static int cpdma_chan_submit_si(struct submit_info *si) |
7600 |
+ struct cpdma_chan *chan = si->chan; |
7601 |
+ struct cpdma_ctlr *ctlr = chan->ctlr; |
7602 |
+ int len = si->len; |
7603 |
+- int swlen = len; |
7604 |
+ struct cpdma_desc __iomem *desc; |
7605 |
+ dma_addr_t buffer; |
7606 |
+ u32 mode; |
7607 |
+@@ -1046,7 +1045,6 @@ static int cpdma_chan_submit_si(struct submit_info *si) |
7608 |
+ if (si->data_dma) { |
7609 |
+ buffer = si->data_dma; |
7610 |
+ dma_sync_single_for_device(ctlr->dev, buffer, len, chan->dir); |
7611 |
+- swlen |= CPDMA_DMA_EXT_MAP; |
7612 |
+ } else { |
7613 |
+ buffer = dma_map_single(ctlr->dev, si->data_virt, len, chan->dir); |
7614 |
+ ret = dma_mapping_error(ctlr->dev, buffer); |
7615 |
+@@ -1065,7 +1063,8 @@ static int cpdma_chan_submit_si(struct submit_info *si) |
7616 |
+ writel_relaxed(mode | len, &desc->hw_mode); |
7617 |
+ writel_relaxed((uintptr_t)si->token, &desc->sw_token); |
7618 |
+ writel_relaxed(buffer, &desc->sw_buffer); |
7619 |
+- writel_relaxed(swlen, &desc->sw_len); |
7620 |
++ writel_relaxed(si->data_dma ? len | CPDMA_DMA_EXT_MAP : len, |
7621 |
++ &desc->sw_len); |
7622 |
+ desc_read(desc, sw_len); |
7623 |
+ |
7624 |
+ __cpdma_chan_submit(chan, desc); |
7625 |
+diff --git a/drivers/net/fjes/fjes_main.c b/drivers/net/fjes/fjes_main.c |
7626 |
+index b517c1af9de0..91a1059517f5 100644 |
7627 |
+--- a/drivers/net/fjes/fjes_main.c |
7628 |
++++ b/drivers/net/fjes/fjes_main.c |
7629 |
+@@ -166,6 +166,9 @@ static int fjes_acpi_add(struct acpi_device *device) |
7630 |
+ /* create platform_device */ |
7631 |
+ plat_dev = platform_device_register_simple(DRV_NAME, 0, fjes_resource, |
7632 |
+ ARRAY_SIZE(fjes_resource)); |
7633 |
++ if (IS_ERR(plat_dev)) |
7634 |
++ return PTR_ERR(plat_dev); |
7635 |
++ |
7636 |
+ device->driver_data = plat_dev; |
7637 |
+ |
7638 |
+ return 0; |
7639 |
+diff --git a/drivers/net/phy/dp83867.c b/drivers/net/phy/dp83867.c |
7640 |
+index 37fceaf9fa10..cf4455bbf888 100644 |
7641 |
+--- a/drivers/net/phy/dp83867.c |
7642 |
++++ b/drivers/net/phy/dp83867.c |
7643 |
+@@ -95,6 +95,10 @@ |
7644 |
+ #define DP83867_IO_MUX_CFG_CLK_O_SEL_MASK (0x1f << 8) |
7645 |
+ #define DP83867_IO_MUX_CFG_CLK_O_SEL_SHIFT 8 |
7646 |
+ |
7647 |
++/* CFG3 bits */ |
7648 |
++#define DP83867_CFG3_INT_OE BIT(7) |
7649 |
++#define DP83867_CFG3_ROBUST_AUTO_MDIX BIT(9) |
7650 |
++ |
7651 |
+ /* CFG4 bits */ |
7652 |
+ #define DP83867_CFG4_PORT_MIRROR_EN BIT(0) |
7653 |
+ |
7654 |
+@@ -410,12 +414,13 @@ static int dp83867_config_init(struct phy_device *phydev) |
7655 |
+ phy_write_mmd(phydev, DP83867_DEVADDR, DP83867_SGMIICTL, val); |
7656 |
+ } |
7657 |
+ |
7658 |
++ val = phy_read(phydev, DP83867_CFG3); |
7659 |
+ /* Enable Interrupt output INT_OE in CFG3 register */ |
7660 |
+- if (phy_interrupt_is_valid(phydev)) { |
7661 |
+- val = phy_read(phydev, DP83867_CFG3); |
7662 |
+- val |= BIT(7); |
7663 |
+- phy_write(phydev, DP83867_CFG3, val); |
7664 |
+- } |
7665 |
++ if (phy_interrupt_is_valid(phydev)) |
7666 |
++ val |= DP83867_CFG3_INT_OE; |
7667 |
++ |
7668 |
++ val |= DP83867_CFG3_ROBUST_AUTO_MDIX; |
7669 |
++ phy_write(phydev, DP83867_CFG3, val); |
7670 |
+ |
7671 |
+ if (dp83867->port_mirroring != DP83867_PORT_MIRROING_KEEP) |
7672 |
+ dp83867_config_port_mirroring(phydev); |
7673 |
+diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c |
7674 |
+index adb66a2fae18..2bf0fda209a8 100644 |
7675 |
+--- a/drivers/net/phy/phy_device.c |
7676 |
++++ b/drivers/net/phy/phy_device.c |
7677 |
+@@ -488,7 +488,7 @@ static int phy_bus_match(struct device *dev, struct device_driver *drv) |
7678 |
+ |
7679 |
+ if (phydev->is_c45) { |
7680 |
+ for (i = 1; i < num_ids; i++) { |
7681 |
+- if (!(phydev->c45_ids.devices_in_package & (1 << i))) |
7682 |
++ if (phydev->c45_ids.device_ids[i] == 0xffffffff) |
7683 |
+ continue; |
7684 |
+ |
7685 |
+ if ((phydrv->phy_id & phydrv->phy_id_mask) == |
7686 |
+@@ -552,7 +552,7 @@ static const struct device_type mdio_bus_phy_type = { |
7687 |
+ .pm = MDIO_BUS_PHY_PM_OPS, |
7688 |
+ }; |
7689 |
+ |
7690 |
+-static int phy_request_driver_module(struct phy_device *dev, int phy_id) |
7691 |
++static int phy_request_driver_module(struct phy_device *dev, u32 phy_id) |
7692 |
+ { |
7693 |
+ int ret; |
7694 |
+ |
7695 |
+@@ -564,15 +564,15 @@ static int phy_request_driver_module(struct phy_device *dev, int phy_id) |
7696 |
+ * then modprobe isn't available. |
7697 |
+ */ |
7698 |
+ if (IS_ENABLED(CONFIG_MODULES) && ret < 0 && ret != -ENOENT) { |
7699 |
+- phydev_err(dev, "error %d loading PHY driver module for ID 0x%08x\n", |
7700 |
+- ret, phy_id); |
7701 |
++ phydev_err(dev, "error %d loading PHY driver module for ID 0x%08lx\n", |
7702 |
++ ret, (unsigned long)phy_id); |
7703 |
+ return ret; |
7704 |
+ } |
7705 |
+ |
7706 |
+ return 0; |
7707 |
+ } |
7708 |
+ |
7709 |
+-struct phy_device *phy_device_create(struct mii_bus *bus, int addr, int phy_id, |
7710 |
++struct phy_device *phy_device_create(struct mii_bus *bus, int addr, u32 phy_id, |
7711 |
+ bool is_c45, |
7712 |
+ struct phy_c45_device_ids *c45_ids) |
7713 |
+ { |
7714 |
+@@ -596,8 +596,8 @@ struct phy_device *phy_device_create(struct mii_bus *bus, int addr, int phy_id, |
7715 |
+ mdiodev->device_free = phy_mdio_device_free; |
7716 |
+ mdiodev->device_remove = phy_mdio_device_remove; |
7717 |
+ |
7718 |
+- dev->speed = 0; |
7719 |
+- dev->duplex = -1; |
7720 |
++ dev->speed = SPEED_UNKNOWN; |
7721 |
++ dev->duplex = DUPLEX_UNKNOWN; |
7722 |
+ dev->pause = 0; |
7723 |
+ dev->asym_pause = 0; |
7724 |
+ dev->link = 0; |
7725 |
+@@ -632,7 +632,7 @@ struct phy_device *phy_device_create(struct mii_bus *bus, int addr, int phy_id, |
7726 |
+ int i; |
7727 |
+ |
7728 |
+ for (i = 1; i < num_ids; i++) { |
7729 |
+- if (!(c45_ids->devices_in_package & (1 << i))) |
7730 |
++ if (c45_ids->device_ids[i] == 0xffffffff) |
7731 |
+ continue; |
7732 |
+ |
7733 |
+ ret = phy_request_driver_module(dev, |
7734 |
+@@ -812,10 +812,13 @@ static int get_phy_id(struct mii_bus *bus, int addr, u32 *phy_id, |
7735 |
+ */ |
7736 |
+ struct phy_device *get_phy_device(struct mii_bus *bus, int addr, bool is_c45) |
7737 |
+ { |
7738 |
+- struct phy_c45_device_ids c45_ids = {0}; |
7739 |
++ struct phy_c45_device_ids c45_ids; |
7740 |
+ u32 phy_id = 0; |
7741 |
+ int r; |
7742 |
+ |
7743 |
++ c45_ids.devices_in_package = 0; |
7744 |
++ memset(c45_ids.device_ids, 0xff, sizeof(c45_ids.device_ids)); |
7745 |
++ |
7746 |
+ r = get_phy_id(bus, addr, &phy_id, is_c45, &c45_ids); |
7747 |
+ if (r) |
7748 |
+ return ERR_PTR(r); |
7749 |
+diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c |
7750 |
+index 8156b33ee3e7..ca70a1d840eb 100644 |
7751 |
+--- a/drivers/net/team/team.c |
7752 |
++++ b/drivers/net/team/team.c |
7753 |
+@@ -2074,7 +2074,8 @@ static int team_ethtool_get_link_ksettings(struct net_device *dev, |
7754 |
+ cmd->base.duplex = DUPLEX_UNKNOWN; |
7755 |
+ cmd->base.port = PORT_OTHER; |
7756 |
+ |
7757 |
+- list_for_each_entry(port, &team->port_list, list) { |
7758 |
++ rcu_read_lock(); |
7759 |
++ list_for_each_entry_rcu(port, &team->port_list, list) { |
7760 |
+ if (team_port_txable(port)) { |
7761 |
+ if (port->state.speed != SPEED_UNKNOWN) |
7762 |
+ speed += port->state.speed; |
7763 |
+@@ -2083,6 +2084,8 @@ static int team_ethtool_get_link_ksettings(struct net_device *dev, |
7764 |
+ cmd->base.duplex = port->state.duplex; |
7765 |
+ } |
7766 |
+ } |
7767 |
++ rcu_read_unlock(); |
7768 |
++ |
7769 |
+ cmd->base.speed = speed ? : SPEED_UNKNOWN; |
7770 |
+ |
7771 |
+ return 0; |
7772 |
+diff --git a/drivers/net/tun.c b/drivers/net/tun.c |
7773 |
+index a8d3141582a5..16564ebcde50 100644 |
7774 |
+--- a/drivers/net/tun.c |
7775 |
++++ b/drivers/net/tun.c |
7776 |
+@@ -313,8 +313,8 @@ static void tun_napi_init(struct tun_struct *tun, struct tun_file *tfile, |
7777 |
+ tfile->napi_enabled = napi_en; |
7778 |
+ tfile->napi_frags_enabled = napi_en && napi_frags; |
7779 |
+ if (napi_en) { |
7780 |
+- netif_napi_add(tun->dev, &tfile->napi, tun_napi_poll, |
7781 |
+- NAPI_POLL_WEIGHT); |
7782 |
++ netif_tx_napi_add(tun->dev, &tfile->napi, tun_napi_poll, |
7783 |
++ NAPI_POLL_WEIGHT); |
7784 |
+ napi_enable(&tfile->napi); |
7785 |
+ } |
7786 |
+ } |
7787 |
+diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c |
7788 |
+index f24a1b0b801f..0becc79fd431 100644 |
7789 |
+--- a/drivers/net/usb/lan78xx.c |
7790 |
++++ b/drivers/net/usb/lan78xx.c |
7791 |
+@@ -1808,6 +1808,7 @@ static int lan78xx_mdio_init(struct lan78xx_net *dev) |
7792 |
+ dev->mdiobus->read = lan78xx_mdiobus_read; |
7793 |
+ dev->mdiobus->write = lan78xx_mdiobus_write; |
7794 |
+ dev->mdiobus->name = "lan78xx-mdiobus"; |
7795 |
++ dev->mdiobus->parent = &dev->udev->dev; |
7796 |
+ |
7797 |
+ snprintf(dev->mdiobus->id, MII_BUS_ID_SIZE, "usb-%03d:%03d", |
7798 |
+ dev->udev->bus->busnum, dev->udev->devnum); |
7799 |
+diff --git a/drivers/net/wireless/ath/ath10k/coredump.c b/drivers/net/wireless/ath/ath10k/coredump.c |
7800 |
+index b6d2932383cf..1cfe75a2d0c3 100644 |
7801 |
+--- a/drivers/net/wireless/ath/ath10k/coredump.c |
7802 |
++++ b/drivers/net/wireless/ath/ath10k/coredump.c |
7803 |
+@@ -1208,9 +1208,11 @@ static struct ath10k_dump_file_data *ath10k_coredump_build(struct ath10k *ar) |
7804 |
+ dump_tlv = (struct ath10k_tlv_dump_data *)(buf + sofar); |
7805 |
+ dump_tlv->type = cpu_to_le32(ATH10K_FW_CRASH_DUMP_RAM_DATA); |
7806 |
+ dump_tlv->tlv_len = cpu_to_le32(crash_data->ramdump_buf_len); |
7807 |
+- memcpy(dump_tlv->tlv_data, crash_data->ramdump_buf, |
7808 |
+- crash_data->ramdump_buf_len); |
7809 |
+- sofar += sizeof(*dump_tlv) + crash_data->ramdump_buf_len; |
7810 |
++ if (crash_data->ramdump_buf_len) { |
7811 |
++ memcpy(dump_tlv->tlv_data, crash_data->ramdump_buf, |
7812 |
++ crash_data->ramdump_buf_len); |
7813 |
++ sofar += sizeof(*dump_tlv) + crash_data->ramdump_buf_len; |
7814 |
++ } |
7815 |
+ } |
7816 |
+ |
7817 |
+ mutex_unlock(&ar->dump_mutex); |
7818 |
+@@ -1257,6 +1259,9 @@ int ath10k_coredump_register(struct ath10k *ar) |
7819 |
+ if (test_bit(ATH10K_FW_CRASH_DUMP_RAM_DATA, &ath10k_coredump_mask)) { |
7820 |
+ crash_data->ramdump_buf_len = ath10k_coredump_get_ramdump_size(ar); |
7821 |
+ |
7822 |
++ if (!crash_data->ramdump_buf_len) |
7823 |
++ return 0; |
7824 |
++ |
7825 |
+ crash_data->ramdump_buf = vzalloc(crash_data->ramdump_buf_len); |
7826 |
+ if (!crash_data->ramdump_buf) |
7827 |
+ return -ENOMEM; |
7828 |
+diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c b/drivers/net/wireless/ath/ath10k/htt_rx.c |
7829 |
+index 53f1095de8ff..9f0e7b4943ec 100644 |
7830 |
+--- a/drivers/net/wireless/ath/ath10k/htt_rx.c |
7831 |
++++ b/drivers/net/wireless/ath/ath10k/htt_rx.c |
7832 |
+@@ -2726,7 +2726,7 @@ static void ath10k_htt_rx_tx_compl_ind(struct ath10k *ar, |
7833 |
+ spin_lock_bh(&ar->data_lock); |
7834 |
+ |
7835 |
+ peer = ath10k_peer_find_by_id(ar, peer_id); |
7836 |
+- if (!peer) { |
7837 |
++ if (!peer || !peer->sta) { |
7838 |
+ spin_unlock_bh(&ar->data_lock); |
7839 |
+ rcu_read_unlock(); |
7840 |
+ continue; |
7841 |
+diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c |
7842 |
+index a6d21856b7e7..36d24ea126a2 100644 |
7843 |
+--- a/drivers/net/wireless/ath/ath10k/mac.c |
7844 |
++++ b/drivers/net/wireless/ath/ath10k/mac.c |
7845 |
+@@ -3708,7 +3708,7 @@ static int ath10k_mac_tx(struct ath10k *ar, |
7846 |
+ struct ieee80211_vif *vif, |
7847 |
+ enum ath10k_hw_txrx_mode txmode, |
7848 |
+ enum ath10k_mac_tx_path txpath, |
7849 |
+- struct sk_buff *skb) |
7850 |
++ struct sk_buff *skb, bool noque_offchan) |
7851 |
+ { |
7852 |
+ struct ieee80211_hw *hw = ar->hw; |
7853 |
+ struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); |
7854 |
+@@ -3738,10 +3738,10 @@ static int ath10k_mac_tx(struct ath10k *ar, |
7855 |
+ } |
7856 |
+ } |
7857 |
+ |
7858 |
+- if (info->flags & IEEE80211_TX_CTL_TX_OFFCHAN) { |
7859 |
++ if (!noque_offchan && info->flags & IEEE80211_TX_CTL_TX_OFFCHAN) { |
7860 |
+ if (!ath10k_mac_tx_frm_has_freq(ar)) { |
7861 |
+- ath10k_dbg(ar, ATH10K_DBG_MAC, "queued offchannel skb %pK\n", |
7862 |
+- skb); |
7863 |
++ ath10k_dbg(ar, ATH10K_DBG_MAC, "mac queued offchannel skb %pK len %d\n", |
7864 |
++ skb, skb->len); |
7865 |
+ |
7866 |
+ skb_queue_tail(&ar->offchan_tx_queue, skb); |
7867 |
+ ieee80211_queue_work(hw, &ar->offchan_tx_work); |
7868 |
+@@ -3803,8 +3803,8 @@ void ath10k_offchan_tx_work(struct work_struct *work) |
7869 |
+ |
7870 |
+ mutex_lock(&ar->conf_mutex); |
7871 |
+ |
7872 |
+- ath10k_dbg(ar, ATH10K_DBG_MAC, "mac offchannel skb %pK\n", |
7873 |
+- skb); |
7874 |
++ ath10k_dbg(ar, ATH10K_DBG_MAC, "mac offchannel skb %pK len %d\n", |
7875 |
++ skb, skb->len); |
7876 |
+ |
7877 |
+ hdr = (struct ieee80211_hdr *)skb->data; |
7878 |
+ peer_addr = ieee80211_get_DA(hdr); |
7879 |
+@@ -3850,7 +3850,7 @@ void ath10k_offchan_tx_work(struct work_struct *work) |
7880 |
+ txmode = ath10k_mac_tx_h_get_txmode(ar, vif, sta, skb); |
7881 |
+ txpath = ath10k_mac_tx_h_get_txpath(ar, skb, txmode); |
7882 |
+ |
7883 |
+- ret = ath10k_mac_tx(ar, vif, txmode, txpath, skb); |
7884 |
++ ret = ath10k_mac_tx(ar, vif, txmode, txpath, skb, true); |
7885 |
+ if (ret) { |
7886 |
+ ath10k_warn(ar, "failed to transmit offchannel frame: %d\n", |
7887 |
+ ret); |
7888 |
+@@ -3860,8 +3860,8 @@ void ath10k_offchan_tx_work(struct work_struct *work) |
7889 |
+ time_left = |
7890 |
+ wait_for_completion_timeout(&ar->offchan_tx_completed, 3 * HZ); |
7891 |
+ if (time_left == 0) |
7892 |
+- ath10k_warn(ar, "timed out waiting for offchannel skb %pK\n", |
7893 |
+- skb); |
7894 |
++ ath10k_warn(ar, "timed out waiting for offchannel skb %pK, len: %d\n", |
7895 |
++ skb, skb->len); |
7896 |
+ |
7897 |
+ if (!peer && tmp_peer_created) { |
7898 |
+ ret = ath10k_peer_delete(ar, vdev_id, peer_addr); |
7899 |
+@@ -3903,8 +3903,10 @@ void ath10k_mgmt_over_wmi_tx_work(struct work_struct *work) |
7900 |
+ ar->running_fw->fw_file.fw_features)) { |
7901 |
+ paddr = dma_map_single(ar->dev, skb->data, |
7902 |
+ skb->len, DMA_TO_DEVICE); |
7903 |
+- if (!paddr) |
7904 |
++ if (dma_mapping_error(ar->dev, paddr)) { |
7905 |
++ ieee80211_free_txskb(ar->hw, skb); |
7906 |
+ continue; |
7907 |
++ } |
7908 |
+ ret = ath10k_wmi_mgmt_tx_send(ar, skb, paddr); |
7909 |
+ if (ret) { |
7910 |
+ ath10k_warn(ar, "failed to transmit management frame by ref via WMI: %d\n", |
7911 |
+@@ -4097,7 +4099,7 @@ int ath10k_mac_tx_push_txq(struct ieee80211_hw *hw, |
7912 |
+ spin_unlock_bh(&ar->htt.tx_lock); |
7913 |
+ } |
7914 |
+ |
7915 |
+- ret = ath10k_mac_tx(ar, vif, txmode, txpath, skb); |
7916 |
++ ret = ath10k_mac_tx(ar, vif, txmode, txpath, skb, false); |
7917 |
+ if (unlikely(ret)) { |
7918 |
+ ath10k_warn(ar, "failed to push frame: %d\n", ret); |
7919 |
+ |
7920 |
+@@ -4378,7 +4380,7 @@ static void ath10k_mac_op_tx(struct ieee80211_hw *hw, |
7921 |
+ spin_unlock_bh(&ar->htt.tx_lock); |
7922 |
+ } |
7923 |
+ |
7924 |
+- ret = ath10k_mac_tx(ar, vif, txmode, txpath, skb); |
7925 |
++ ret = ath10k_mac_tx(ar, vif, txmode, txpath, skb, false); |
7926 |
+ if (ret) { |
7927 |
+ ath10k_warn(ar, "failed to transmit frame: %d\n", ret); |
7928 |
+ if (is_htt) { |
7929 |
+diff --git a/drivers/net/wireless/ath/ath10k/txrx.c b/drivers/net/wireless/ath/ath10k/txrx.c |
7930 |
+index 4102df016931..39abf8b12903 100644 |
7931 |
+--- a/drivers/net/wireless/ath/ath10k/txrx.c |
7932 |
++++ b/drivers/net/wireless/ath/ath10k/txrx.c |
7933 |
+@@ -95,6 +95,8 @@ int ath10k_txrx_tx_unref(struct ath10k_htt *htt, |
7934 |
+ |
7935 |
+ info = IEEE80211_SKB_CB(msdu); |
7936 |
+ memset(&info->status, 0, sizeof(info->status)); |
7937 |
++ info->status.rates[0].idx = -1; |
7938 |
++ |
7939 |
+ trace_ath10k_txrx_tx_unref(ar, tx_done->msdu_id); |
7940 |
+ |
7941 |
+ if (!(info->flags & IEEE80211_TX_CTL_NO_ACK)) |
7942 |
+diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c |
7943 |
+index 406b367c284c..85cf96461dde 100644 |
7944 |
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c |
7945 |
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c |
7946 |
+@@ -1350,6 +1350,11 @@ void brcmf_detach(struct device *dev) |
7947 |
+ brcmf_fweh_detach(drvr); |
7948 |
+ brcmf_proto_detach(drvr); |
7949 |
+ |
7950 |
++ if (drvr->mon_if) { |
7951 |
++ brcmf_net_detach(drvr->mon_if->ndev, false); |
7952 |
++ drvr->mon_if = NULL; |
7953 |
++ } |
7954 |
++ |
7955 |
+ /* make sure primary interface removed last */ |
7956 |
+ for (i = BRCMF_MAX_IFS - 1; i > -1; i--) { |
7957 |
+ if (drvr->iflist[i]) |
7958 |
+diff --git a/drivers/net/wireless/intel/iwlwifi/dvm/led.c b/drivers/net/wireless/intel/iwlwifi/dvm/led.c |
7959 |
+index dd387aba3317..e8a4d604b910 100644 |
7960 |
+--- a/drivers/net/wireless/intel/iwlwifi/dvm/led.c |
7961 |
++++ b/drivers/net/wireless/intel/iwlwifi/dvm/led.c |
7962 |
+@@ -171,6 +171,9 @@ void iwl_leds_init(struct iwl_priv *priv) |
7963 |
+ |
7964 |
+ priv->led.name = kasprintf(GFP_KERNEL, "%s-led", |
7965 |
+ wiphy_name(priv->hw->wiphy)); |
7966 |
++ if (!priv->led.name) |
7967 |
++ return; |
7968 |
++ |
7969 |
+ priv->led.brightness_set = iwl_led_brightness_set; |
7970 |
+ priv->led.blink_set = iwl_led_blink_set; |
7971 |
+ priv->led.max_brightness = 1; |
7972 |
+diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/led.c b/drivers/net/wireless/intel/iwlwifi/mvm/led.c |
7973 |
+index d104da9170ca..72c4b2b8399d 100644 |
7974 |
+--- a/drivers/net/wireless/intel/iwlwifi/mvm/led.c |
7975 |
++++ b/drivers/net/wireless/intel/iwlwifi/mvm/led.c |
7976 |
+@@ -129,6 +129,9 @@ int iwl_mvm_leds_init(struct iwl_mvm *mvm) |
7977 |
+ |
7978 |
+ mvm->led.name = kasprintf(GFP_KERNEL, "%s-led", |
7979 |
+ wiphy_name(mvm->hw->wiphy)); |
7980 |
++ if (!mvm->led.name) |
7981 |
++ return -ENOMEM; |
7982 |
++ |
7983 |
+ mvm->led.brightness_set = iwl_led_brightness_set; |
7984 |
+ mvm->led.max_brightness = 1; |
7985 |
+ |
7986 |
+diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rx.c b/drivers/net/wireless/intel/iwlwifi/mvm/rx.c |
7987 |
+index 0ad8ed23a455..5ee33c8ae9d2 100644 |
7988 |
+--- a/drivers/net/wireless/intel/iwlwifi/mvm/rx.c |
7989 |
++++ b/drivers/net/wireless/intel/iwlwifi/mvm/rx.c |
7990 |
+@@ -60,6 +60,7 @@ |
7991 |
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
7992 |
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
7993 |
+ *****************************************************************************/ |
7994 |
++#include <asm/unaligned.h> |
7995 |
+ #include <linux/etherdevice.h> |
7996 |
+ #include <linux/skbuff.h> |
7997 |
+ #include "iwl-trans.h" |
7998 |
+@@ -357,7 +358,7 @@ void iwl_mvm_rx_rx_mpdu(struct iwl_mvm *mvm, struct napi_struct *napi, |
7999 |
+ rx_res = (struct iwl_rx_mpdu_res_start *)pkt->data; |
8000 |
+ hdr = (struct ieee80211_hdr *)(pkt->data + sizeof(*rx_res)); |
8001 |
+ len = le16_to_cpu(rx_res->byte_count); |
8002 |
+- rx_pkt_status = le32_to_cpup((__le32 *) |
8003 |
++ rx_pkt_status = get_unaligned_le32((__le32 *) |
8004 |
+ (pkt->data + sizeof(*rx_res) + len)); |
8005 |
+ |
8006 |
+ /* Dont use dev_alloc_skb(), we'll have enough headroom once |
8007 |
+diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/rx.c b/drivers/net/wireless/intel/iwlwifi/pcie/rx.c |
8008 |
+index 19dd075f2f63..041dd75ac72b 100644 |
8009 |
+--- a/drivers/net/wireless/intel/iwlwifi/pcie/rx.c |
8010 |
++++ b/drivers/net/wireless/intel/iwlwifi/pcie/rx.c |
8011 |
+@@ -1429,6 +1429,7 @@ out_err: |
8012 |
+ static void iwl_pcie_rx_handle(struct iwl_trans *trans, int queue) |
8013 |
+ { |
8014 |
+ struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); |
8015 |
++ struct napi_struct *napi; |
8016 |
+ struct iwl_rxq *rxq; |
8017 |
+ u32 r, i, count = 0; |
8018 |
+ bool emergency = false; |
8019 |
+@@ -1534,8 +1535,16 @@ out: |
8020 |
+ if (unlikely(emergency && count)) |
8021 |
+ iwl_pcie_rxq_alloc_rbs(trans, GFP_ATOMIC, rxq); |
8022 |
+ |
8023 |
+- if (rxq->napi.poll) |
8024 |
+- napi_gro_flush(&rxq->napi, false); |
8025 |
++ napi = &rxq->napi; |
8026 |
++ if (napi->poll) { |
8027 |
++ if (napi->rx_count) { |
8028 |
++ netif_receive_skb_list(&napi->rx_list); |
8029 |
++ INIT_LIST_HEAD(&napi->rx_list); |
8030 |
++ napi->rx_count = 0; |
8031 |
++ } |
8032 |
++ |
8033 |
++ napi_gro_flush(napi, false); |
8034 |
++ } |
8035 |
+ |
8036 |
+ iwl_pcie_rxq_restock(trans, rxq); |
8037 |
+ } |
8038 |
+diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/trans-gen2.c b/drivers/net/wireless/intel/iwlwifi/pcie/trans-gen2.c |
8039 |
+index ca3bb4d65b00..df8455f14e4d 100644 |
8040 |
+--- a/drivers/net/wireless/intel/iwlwifi/pcie/trans-gen2.c |
8041 |
++++ b/drivers/net/wireless/intel/iwlwifi/pcie/trans-gen2.c |
8042 |
+@@ -57,24 +57,6 @@ |
8043 |
+ #include "internal.h" |
8044 |
+ #include "fw/dbg.h" |
8045 |
+ |
8046 |
+-static int iwl_pcie_gen2_force_power_gating(struct iwl_trans *trans) |
8047 |
+-{ |
8048 |
+- iwl_set_bits_prph(trans, HPM_HIPM_GEN_CFG, |
8049 |
+- HPM_HIPM_GEN_CFG_CR_FORCE_ACTIVE); |
8050 |
+- udelay(20); |
8051 |
+- iwl_set_bits_prph(trans, HPM_HIPM_GEN_CFG, |
8052 |
+- HPM_HIPM_GEN_CFG_CR_PG_EN | |
8053 |
+- HPM_HIPM_GEN_CFG_CR_SLP_EN); |
8054 |
+- udelay(20); |
8055 |
+- iwl_clear_bits_prph(trans, HPM_HIPM_GEN_CFG, |
8056 |
+- HPM_HIPM_GEN_CFG_CR_FORCE_ACTIVE); |
8057 |
+- |
8058 |
+- iwl_trans_sw_reset(trans); |
8059 |
+- iwl_clear_bit(trans, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE); |
8060 |
+- |
8061 |
+- return 0; |
8062 |
+-} |
8063 |
+- |
8064 |
+ /* |
8065 |
+ * Start up NIC's basic functionality after it has been reset |
8066 |
+ * (e.g. after platform boot, or shutdown via iwl_pcie_apm_stop()) |
8067 |
+@@ -110,13 +92,6 @@ int iwl_pcie_gen2_apm_init(struct iwl_trans *trans) |
8068 |
+ |
8069 |
+ iwl_pcie_apm_config(trans); |
8070 |
+ |
8071 |
+- if (trans->trans_cfg->device_family == IWL_DEVICE_FAMILY_22000 && |
8072 |
+- trans->cfg->integrated) { |
8073 |
+- ret = iwl_pcie_gen2_force_power_gating(trans); |
8074 |
+- if (ret) |
8075 |
+- return ret; |
8076 |
+- } |
8077 |
+- |
8078 |
+ ret = iwl_finish_nic_init(trans, trans->trans_cfg); |
8079 |
+ if (ret) |
8080 |
+ return ret; |
8081 |
+diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c |
8082 |
+index 6961f00ff812..d3db38c3095b 100644 |
8083 |
+--- a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c |
8084 |
++++ b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c |
8085 |
+@@ -1783,6 +1783,29 @@ static int iwl_trans_pcie_clear_persistence_bit(struct iwl_trans *trans) |
8086 |
+ return 0; |
8087 |
+ } |
8088 |
+ |
8089 |
++static int iwl_pcie_gen2_force_power_gating(struct iwl_trans *trans) |
8090 |
++{ |
8091 |
++ int ret; |
8092 |
++ |
8093 |
++ ret = iwl_finish_nic_init(trans, trans->trans_cfg); |
8094 |
++ if (ret < 0) |
8095 |
++ return ret; |
8096 |
++ |
8097 |
++ iwl_set_bits_prph(trans, HPM_HIPM_GEN_CFG, |
8098 |
++ HPM_HIPM_GEN_CFG_CR_FORCE_ACTIVE); |
8099 |
++ udelay(20); |
8100 |
++ iwl_set_bits_prph(trans, HPM_HIPM_GEN_CFG, |
8101 |
++ HPM_HIPM_GEN_CFG_CR_PG_EN | |
8102 |
++ HPM_HIPM_GEN_CFG_CR_SLP_EN); |
8103 |
++ udelay(20); |
8104 |
++ iwl_clear_bits_prph(trans, HPM_HIPM_GEN_CFG, |
8105 |
++ HPM_HIPM_GEN_CFG_CR_FORCE_ACTIVE); |
8106 |
++ |
8107 |
++ iwl_trans_pcie_sw_reset(trans); |
8108 |
++ |
8109 |
++ return 0; |
8110 |
++} |
8111 |
++ |
8112 |
+ static int _iwl_trans_pcie_start_hw(struct iwl_trans *trans) |
8113 |
+ { |
8114 |
+ struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); |
8115 |
+@@ -1802,6 +1825,13 @@ static int _iwl_trans_pcie_start_hw(struct iwl_trans *trans) |
8116 |
+ |
8117 |
+ iwl_trans_pcie_sw_reset(trans); |
8118 |
+ |
8119 |
++ if (trans->trans_cfg->device_family == IWL_DEVICE_FAMILY_22000 && |
8120 |
++ trans->cfg->integrated) { |
8121 |
++ err = iwl_pcie_gen2_force_power_gating(trans); |
8122 |
++ if (err) |
8123 |
++ return err; |
8124 |
++ } |
8125 |
++ |
8126 |
+ err = iwl_pcie_apm_init(trans); |
8127 |
+ if (err) |
8128 |
+ return err; |
8129 |
+diff --git a/drivers/net/wireless/marvell/libertas/if_sdio.c b/drivers/net/wireless/marvell/libertas/if_sdio.c |
8130 |
+index 242d8845da3f..30f1025ecb9b 100644 |
8131 |
+--- a/drivers/net/wireless/marvell/libertas/if_sdio.c |
8132 |
++++ b/drivers/net/wireless/marvell/libertas/if_sdio.c |
8133 |
+@@ -1179,6 +1179,10 @@ static int if_sdio_probe(struct sdio_func *func, |
8134 |
+ |
8135 |
+ spin_lock_init(&card->lock); |
8136 |
+ card->workqueue = alloc_workqueue("libertas_sdio", WQ_MEM_RECLAIM, 0); |
8137 |
++ if (unlikely(!card->workqueue)) { |
8138 |
++ ret = -ENOMEM; |
8139 |
++ goto err_queue; |
8140 |
++ } |
8141 |
+ INIT_WORK(&card->packet_worker, if_sdio_host_to_card_worker); |
8142 |
+ init_waitqueue_head(&card->pwron_waitq); |
8143 |
+ |
8144 |
+@@ -1230,6 +1234,7 @@ err_activate_card: |
8145 |
+ lbs_remove_card(priv); |
8146 |
+ free: |
8147 |
+ destroy_workqueue(card->workqueue); |
8148 |
++err_queue: |
8149 |
+ while (card->packets) { |
8150 |
+ packet = card->packets; |
8151 |
+ card->packets = card->packets->next; |
8152 |
+diff --git a/drivers/net/wireless/marvell/mwifiex/pcie.c b/drivers/net/wireless/marvell/mwifiex/pcie.c |
8153 |
+index eff06d59e9df..096334e941a1 100644 |
8154 |
+--- a/drivers/net/wireless/marvell/mwifiex/pcie.c |
8155 |
++++ b/drivers/net/wireless/marvell/mwifiex/pcie.c |
8156 |
+@@ -687,8 +687,11 @@ static int mwifiex_pcie_init_evt_ring(struct mwifiex_adapter *adapter) |
8157 |
+ skb_put(skb, MAX_EVENT_SIZE); |
8158 |
+ |
8159 |
+ if (mwifiex_map_pci_memory(adapter, skb, MAX_EVENT_SIZE, |
8160 |
+- PCI_DMA_FROMDEVICE)) |
8161 |
++ PCI_DMA_FROMDEVICE)) { |
8162 |
++ kfree_skb(skb); |
8163 |
++ kfree(card->evtbd_ring_vbase); |
8164 |
+ return -1; |
8165 |
++ } |
8166 |
+ |
8167 |
+ buf_pa = MWIFIEX_SKB_DMA_ADDR(skb); |
8168 |
+ |
8169 |
+diff --git a/drivers/net/wireless/mediatek/mt76/mt7603/mac.c b/drivers/net/wireless/mediatek/mt76/mt7603/mac.c |
8170 |
+index c328192307c4..ff3f3d98b625 100644 |
8171 |
+--- a/drivers/net/wireless/mediatek/mt76/mt7603/mac.c |
8172 |
++++ b/drivers/net/wireless/mediatek/mt76/mt7603/mac.c |
8173 |
+@@ -1032,8 +1032,10 @@ mt7603_fill_txs(struct mt7603_dev *dev, struct mt7603_sta *sta, |
8174 |
+ if (idx && (cur_rate->idx != info->status.rates[i].idx || |
8175 |
+ cur_rate->flags != info->status.rates[i].flags)) { |
8176 |
+ i++; |
8177 |
+- if (i == ARRAY_SIZE(info->status.rates)) |
8178 |
++ if (i == ARRAY_SIZE(info->status.rates)) { |
8179 |
++ i--; |
8180 |
+ break; |
8181 |
++ } |
8182 |
+ |
8183 |
+ info->status.rates[i] = *cur_rate; |
8184 |
+ info->status.rates[i].count = 0; |
8185 |
+diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mac.c b/drivers/net/wireless/mediatek/mt76/mt7615/mac.c |
8186 |
+index e07ce2c10013..111e38ff954a 100644 |
8187 |
+--- a/drivers/net/wireless/mediatek/mt76/mt7615/mac.c |
8188 |
++++ b/drivers/net/wireless/mediatek/mt76/mt7615/mac.c |
8189 |
+@@ -914,8 +914,10 @@ static bool mt7615_fill_txs(struct mt7615_dev *dev, struct mt7615_sta *sta, |
8190 |
+ if (idx && (cur_rate->idx != info->status.rates[i].idx || |
8191 |
+ cur_rate->flags != info->status.rates[i].flags)) { |
8192 |
+ i++; |
8193 |
+- if (i == ARRAY_SIZE(info->status.rates)) |
8194 |
++ if (i == ARRAY_SIZE(info->status.rates)) { |
8195 |
++ i--; |
8196 |
+ break; |
8197 |
++ } |
8198 |
+ |
8199 |
+ info->status.rates[i] = *cur_rate; |
8200 |
+ info->status.rates[i].count = 0; |
8201 |
+diff --git a/drivers/net/wireless/quantenna/qtnfmac/commands.c b/drivers/net/wireless/quantenna/qtnfmac/commands.c |
8202 |
+index dc0c7244b60e..c0c32805fb8d 100644 |
8203 |
+--- a/drivers/net/wireless/quantenna/qtnfmac/commands.c |
8204 |
++++ b/drivers/net/wireless/quantenna/qtnfmac/commands.c |
8205 |
+@@ -83,6 +83,7 @@ static int qtnf_cmd_send_with_reply(struct qtnf_bus *bus, |
8206 |
+ struct qlink_cmd *cmd; |
8207 |
+ struct qlink_resp *resp = NULL; |
8208 |
+ struct sk_buff *resp_skb = NULL; |
8209 |
++ int resp_res = 0; |
8210 |
+ u16 cmd_id; |
8211 |
+ u8 mac_id; |
8212 |
+ u8 vif_id; |
8213 |
+@@ -113,6 +114,7 @@ static int qtnf_cmd_send_with_reply(struct qtnf_bus *bus, |
8214 |
+ } |
8215 |
+ |
8216 |
+ resp = (struct qlink_resp *)resp_skb->data; |
8217 |
++ resp_res = le16_to_cpu(resp->result); |
8218 |
+ ret = qtnf_cmd_check_reply_header(resp, cmd_id, mac_id, vif_id, |
8219 |
+ const_resp_size); |
8220 |
+ if (ret) |
8221 |
+@@ -128,8 +130,8 @@ out: |
8222 |
+ else |
8223 |
+ consume_skb(resp_skb); |
8224 |
+ |
8225 |
+- if (!ret && resp) |
8226 |
+- return qtnf_cmd_resp_result_decode(le16_to_cpu(resp->result)); |
8227 |
++ if (!ret) |
8228 |
++ return qtnf_cmd_resp_result_decode(resp_res); |
8229 |
+ |
8230 |
+ pr_warn("VIF%u.%u: cmd 0x%.4X failed: %d\n", |
8231 |
+ mac_id, vif_id, cmd_id, ret); |
8232 |
+diff --git a/drivers/net/wireless/quantenna/qtnfmac/event.c b/drivers/net/wireless/quantenna/qtnfmac/event.c |
8233 |
+index b57c8c18a8d0..7846383c8828 100644 |
8234 |
+--- a/drivers/net/wireless/quantenna/qtnfmac/event.c |
8235 |
++++ b/drivers/net/wireless/quantenna/qtnfmac/event.c |
8236 |
+@@ -171,8 +171,9 @@ qtnf_event_handle_bss_join(struct qtnf_vif *vif, |
8237 |
+ return -EPROTO; |
8238 |
+ } |
8239 |
+ |
8240 |
+- pr_debug("VIF%u.%u: BSSID:%pM status:%u\n", |
8241 |
+- vif->mac->macid, vif->vifid, join_info->bssid, status); |
8242 |
++ pr_debug("VIF%u.%u: BSSID:%pM chan:%u status:%u\n", |
8243 |
++ vif->mac->macid, vif->vifid, join_info->bssid, |
8244 |
++ le16_to_cpu(join_info->chan.chan.center_freq), status); |
8245 |
+ |
8246 |
+ if (status != WLAN_STATUS_SUCCESS) |
8247 |
+ goto done; |
8248 |
+@@ -181,7 +182,7 @@ qtnf_event_handle_bss_join(struct qtnf_vif *vif, |
8249 |
+ if (!cfg80211_chandef_valid(&chandef)) { |
8250 |
+ pr_warn("MAC%u.%u: bad channel freq=%u cf1=%u cf2=%u bw=%u\n", |
8251 |
+ vif->mac->macid, vif->vifid, |
8252 |
+- chandef.chan->center_freq, |
8253 |
++ chandef.chan ? chandef.chan->center_freq : 0, |
8254 |
+ chandef.center_freq1, |
8255 |
+ chandef.center_freq2, |
8256 |
+ chandef.width); |
8257 |
+diff --git a/drivers/net/wireless/quantenna/qtnfmac/pcie/pcie.c b/drivers/net/wireless/quantenna/qtnfmac/pcie/pcie.c |
8258 |
+index 8ae318b5fe54..4824be0c6231 100644 |
8259 |
+--- a/drivers/net/wireless/quantenna/qtnfmac/pcie/pcie.c |
8260 |
++++ b/drivers/net/wireless/quantenna/qtnfmac/pcie/pcie.c |
8261 |
+@@ -130,6 +130,8 @@ static int qtnf_dbg_shm_stats(struct seq_file *s, void *data) |
8262 |
+ |
8263 |
+ int qtnf_pcie_fw_boot_done(struct qtnf_bus *bus) |
8264 |
+ { |
8265 |
++ struct qtnf_pcie_bus_priv *priv = get_bus_priv(bus); |
8266 |
++ char card_id[64]; |
8267 |
+ int ret; |
8268 |
+ |
8269 |
+ bus->fw_state = QTNF_FW_STATE_BOOT_DONE; |
8270 |
+@@ -137,7 +139,9 @@ int qtnf_pcie_fw_boot_done(struct qtnf_bus *bus) |
8271 |
+ if (ret) { |
8272 |
+ pr_err("failed to attach core\n"); |
8273 |
+ } else { |
8274 |
+- qtnf_debugfs_init(bus, DRV_NAME); |
8275 |
++ snprintf(card_id, sizeof(card_id), "%s:%s", |
8276 |
++ DRV_NAME, pci_name(priv->pdev)); |
8277 |
++ qtnf_debugfs_init(bus, card_id); |
8278 |
+ qtnf_debugfs_add_entry(bus, "mps", qtnf_dbg_mps_show); |
8279 |
+ qtnf_debugfs_add_entry(bus, "msi_enabled", qtnf_dbg_msi_show); |
8280 |
+ qtnf_debugfs_add_entry(bus, "shm_stats", qtnf_dbg_shm_stats); |
8281 |
+diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h |
8282 |
+index ade057d868f7..5e9ce03067de 100644 |
8283 |
+--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h |
8284 |
++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h |
8285 |
+@@ -1341,6 +1341,7 @@ struct rtl8xxxu_fileops { |
8286 |
+ u8 has_s0s1:1; |
8287 |
+ u8 has_tx_report:1; |
8288 |
+ u8 gen2_thermal_meter:1; |
8289 |
++ u8 needs_full_init:1; |
8290 |
+ u32 adda_1t_init; |
8291 |
+ u32 adda_1t_path_on; |
8292 |
+ u32 adda_2t_path_on_a; |
8293 |
+diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723b.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723b.c |
8294 |
+index ceffe05bd65b..f3cd314d1a9c 100644 |
8295 |
+--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723b.c |
8296 |
++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723b.c |
8297 |
+@@ -1670,6 +1670,7 @@ struct rtl8xxxu_fileops rtl8723bu_fops = { |
8298 |
+ .has_s0s1 = 1, |
8299 |
+ .has_tx_report = 1, |
8300 |
+ .gen2_thermal_meter = 1, |
8301 |
++ .needs_full_init = 1, |
8302 |
+ .adda_1t_init = 0x01c00014, |
8303 |
+ .adda_1t_path_on = 0x01c00014, |
8304 |
+ .adda_2t_path_on_a = 0x01c00014, |
8305 |
+diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c |
8306 |
+index c6c41fb962ff..361248e97568 100644 |
8307 |
+--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c |
8308 |
++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c |
8309 |
+@@ -3902,6 +3902,9 @@ static int rtl8xxxu_init_device(struct ieee80211_hw *hw) |
8310 |
+ else |
8311 |
+ macpower = true; |
8312 |
+ |
8313 |
++ if (fops->needs_full_init) |
8314 |
++ macpower = false; |
8315 |
++ |
8316 |
+ ret = fops->power_on(priv); |
8317 |
+ if (ret < 0) { |
8318 |
+ dev_warn(dev, "%s: Failed power on\n", __func__); |
8319 |
+diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/hw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/hw.c |
8320 |
+index 56cc3bc30860..f070f25bb735 100644 |
8321 |
+--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/hw.c |
8322 |
++++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/hw.c |
8323 |
+@@ -1540,6 +1540,8 @@ static bool usb_cmd_send_packet(struct ieee80211_hw *hw, struct sk_buff *skb) |
8324 |
+ * This is maybe necessary: |
8325 |
+ * rtlpriv->cfg->ops->fill_tx_cmddesc(hw, buffer, 1, 1, skb); |
8326 |
+ */ |
8327 |
++ dev_kfree_skb(skb); |
8328 |
++ |
8329 |
+ return true; |
8330 |
+ } |
8331 |
+ |
8332 |
+diff --git a/drivers/net/wireless/realtek/rtlwifi/usb.c b/drivers/net/wireless/realtek/rtlwifi/usb.c |
8333 |
+index 4b59f3b46b28..348b0072cdd6 100644 |
8334 |
+--- a/drivers/net/wireless/realtek/rtlwifi/usb.c |
8335 |
++++ b/drivers/net/wireless/realtek/rtlwifi/usb.c |
8336 |
+@@ -1021,8 +1021,10 @@ int rtl_usb_probe(struct usb_interface *intf, |
8337 |
+ rtlpriv->hw = hw; |
8338 |
+ rtlpriv->usb_data = kcalloc(RTL_USB_MAX_RX_COUNT, sizeof(u32), |
8339 |
+ GFP_KERNEL); |
8340 |
+- if (!rtlpriv->usb_data) |
8341 |
++ if (!rtlpriv->usb_data) { |
8342 |
++ ieee80211_free_hw(hw); |
8343 |
+ return -ENOMEM; |
8344 |
++ } |
8345 |
+ |
8346 |
+ /* this spin lock must be initialized early */ |
8347 |
+ spin_lock_init(&rtlpriv->locks.usb_lock); |
8348 |
+@@ -1083,6 +1085,7 @@ error_out2: |
8349 |
+ _rtl_usb_io_handler_release(hw); |
8350 |
+ usb_put_dev(udev); |
8351 |
+ complete(&rtlpriv->firmware_loading_complete); |
8352 |
++ kfree(rtlpriv->usb_data); |
8353 |
+ return -ENODEV; |
8354 |
+ } |
8355 |
+ EXPORT_SYMBOL(rtl_usb_probe); |
8356 |
+diff --git a/drivers/net/wireless/realtek/rtw88/coex.c b/drivers/net/wireless/realtek/rtw88/coex.c |
8357 |
+index 793b40bdbf7c..3e95ad198912 100644 |
8358 |
+--- a/drivers/net/wireless/realtek/rtw88/coex.c |
8359 |
++++ b/drivers/net/wireless/realtek/rtw88/coex.c |
8360 |
+@@ -1308,6 +1308,7 @@ static void rtw_coex_action_bt_inquiry(struct rtw_dev *rtwdev) |
8361 |
+ struct rtw_chip_info *chip = rtwdev->chip; |
8362 |
+ bool wl_hi_pri = false; |
8363 |
+ u8 table_case, tdma_case; |
8364 |
++ u32 slot_type = 0; |
8365 |
+ |
8366 |
+ if (coex_stat->wl_linkscan_proc || coex_stat->wl_hi_pri_task1 || |
8367 |
+ coex_stat->wl_hi_pri_task2) |
8368 |
+@@ -1318,14 +1319,16 @@ static void rtw_coex_action_bt_inquiry(struct rtw_dev *rtwdev) |
8369 |
+ if (wl_hi_pri) { |
8370 |
+ table_case = 15; |
8371 |
+ if (coex_stat->bt_a2dp_exist && |
8372 |
+- !coex_stat->bt_pan_exist) |
8373 |
++ !coex_stat->bt_pan_exist) { |
8374 |
++ slot_type = TDMA_4SLOT; |
8375 |
+ tdma_case = 11; |
8376 |
+- else if (coex_stat->wl_hi_pri_task1) |
8377 |
++ } else if (coex_stat->wl_hi_pri_task1) { |
8378 |
+ tdma_case = 6; |
8379 |
+- else if (!coex_stat->bt_page) |
8380 |
++ } else if (!coex_stat->bt_page) { |
8381 |
+ tdma_case = 8; |
8382 |
+- else |
8383 |
++ } else { |
8384 |
+ tdma_case = 9; |
8385 |
++ } |
8386 |
+ } else if (coex_stat->wl_connected) { |
8387 |
+ table_case = 10; |
8388 |
+ tdma_case = 10; |
8389 |
+@@ -1361,7 +1364,7 @@ static void rtw_coex_action_bt_inquiry(struct rtw_dev *rtwdev) |
8390 |
+ rtw_coex_set_ant_path(rtwdev, false, COEX_SET_ANT_2G); |
8391 |
+ rtw_coex_set_rf_para(rtwdev, chip->wl_rf_para_rx[0]); |
8392 |
+ rtw_coex_table(rtwdev, table_case); |
8393 |
+- rtw_coex_tdma(rtwdev, false, tdma_case); |
8394 |
++ rtw_coex_tdma(rtwdev, false, tdma_case | slot_type); |
8395 |
+ } |
8396 |
+ |
8397 |
+ static void rtw_coex_action_bt_hfp(struct rtw_dev *rtwdev) |
8398 |
+@@ -1475,13 +1478,13 @@ static void rtw_coex_action_bt_a2dp(struct rtw_dev *rtwdev) |
8399 |
+ |
8400 |
+ if (efuse->share_ant) { |
8401 |
+ /* Shared-Ant */ |
8402 |
++ slot_type = TDMA_4SLOT; |
8403 |
++ |
8404 |
+ if (coex_stat->wl_gl_busy && coex_stat->wl_noisy_level == 0) |
8405 |
+ table_case = 10; |
8406 |
+ else |
8407 |
+ table_case = 9; |
8408 |
+ |
8409 |
+- slot_type = TDMA_4SLOT; |
8410 |
+- |
8411 |
+ if (coex_stat->wl_gl_busy) |
8412 |
+ tdma_case = 13; |
8413 |
+ else |
8414 |
+@@ -1585,13 +1588,14 @@ static void rtw_coex_action_bt_a2dp_hid(struct rtw_dev *rtwdev) |
8415 |
+ |
8416 |
+ if (efuse->share_ant) { |
8417 |
+ /* Shared-Ant */ |
8418 |
++ slot_type = TDMA_4SLOT; |
8419 |
++ |
8420 |
+ if (coex_stat->bt_ble_exist) |
8421 |
+ table_case = 26; |
8422 |
+ else |
8423 |
+ table_case = 9; |
8424 |
+ |
8425 |
+ if (coex_stat->wl_gl_busy) { |
8426 |
+- slot_type = TDMA_4SLOT; |
8427 |
+ tdma_case = 13; |
8428 |
+ } else { |
8429 |
+ tdma_case = 14; |
8430 |
+@@ -1794,10 +1798,12 @@ static void rtw_coex_action_wl_linkscan(struct rtw_dev *rtwdev) |
8431 |
+ struct rtw_efuse *efuse = &rtwdev->efuse; |
8432 |
+ struct rtw_chip_info *chip = rtwdev->chip; |
8433 |
+ u8 table_case, tdma_case; |
8434 |
++ u32 slot_type = 0; |
8435 |
+ |
8436 |
+ if (efuse->share_ant) { |
8437 |
+ /* Shared-Ant */ |
8438 |
+ if (coex_stat->bt_a2dp_exist) { |
8439 |
++ slot_type = TDMA_4SLOT; |
8440 |
+ table_case = 9; |
8441 |
+ tdma_case = 11; |
8442 |
+ } else { |
8443 |
+@@ -1818,7 +1824,7 @@ static void rtw_coex_action_wl_linkscan(struct rtw_dev *rtwdev) |
8444 |
+ rtw_coex_set_ant_path(rtwdev, true, COEX_SET_ANT_2G); |
8445 |
+ rtw_coex_set_rf_para(rtwdev, chip->wl_rf_para_rx[0]); |
8446 |
+ rtw_coex_table(rtwdev, table_case); |
8447 |
+- rtw_coex_tdma(rtwdev, false, tdma_case); |
8448 |
++ rtw_coex_tdma(rtwdev, false, tdma_case | slot_type); |
8449 |
+ } |
8450 |
+ |
8451 |
+ static void rtw_coex_action_wl_not_connected(struct rtw_dev *rtwdev) |
8452 |
+diff --git a/drivers/net/wireless/realtek/rtw88/main.c b/drivers/net/wireless/realtek/rtw88/main.c |
8453 |
+index 6dd457741b15..7a3a4911bde2 100644 |
8454 |
+--- a/drivers/net/wireless/realtek/rtw88/main.c |
8455 |
++++ b/drivers/net/wireless/realtek/rtw88/main.c |
8456 |
+@@ -1020,7 +1020,8 @@ static int rtw_dump_hw_feature(struct rtw_dev *rtwdev) |
8457 |
+ |
8458 |
+ rtw_hw_config_rf_ant_num(rtwdev, efuse->hw_cap.ant_num); |
8459 |
+ |
8460 |
+- if (efuse->hw_cap.nss == EFUSE_HW_CAP_IGNORE) |
8461 |
++ if (efuse->hw_cap.nss == EFUSE_HW_CAP_IGNORE || |
8462 |
++ efuse->hw_cap.nss > rtwdev->hal.rf_path_num) |
8463 |
+ efuse->hw_cap.nss = rtwdev->hal.rf_path_num; |
8464 |
+ |
8465 |
+ rtw_dbg(rtwdev, RTW_DBG_EFUSE, |
8466 |
+diff --git a/drivers/nfc/nxp-nci/i2c.c b/drivers/nfc/nxp-nci/i2c.c |
8467 |
+index 4d1909aecd6c..9f60e4dc5a90 100644 |
8468 |
+--- a/drivers/nfc/nxp-nci/i2c.c |
8469 |
++++ b/drivers/nfc/nxp-nci/i2c.c |
8470 |
+@@ -278,7 +278,7 @@ static int nxp_nci_i2c_probe(struct i2c_client *client, |
8471 |
+ |
8472 |
+ r = devm_acpi_dev_add_driver_gpios(dev, acpi_nxp_nci_gpios); |
8473 |
+ if (r) |
8474 |
+- return r; |
8475 |
++ dev_dbg(dev, "Unable to add GPIO mapping table\n"); |
8476 |
+ |
8477 |
+ phy->gpiod_en = devm_gpiod_get(dev, "enable", GPIOD_OUT_LOW); |
8478 |
+ if (IS_ERR(phy->gpiod_en)) { |
8479 |
+diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c |
8480 |
+index af3212aec871..a6b7b242d516 100644 |
8481 |
+--- a/drivers/nvme/host/core.c |
8482 |
++++ b/drivers/nvme/host/core.c |
8483 |
+@@ -313,7 +313,7 @@ bool nvme_cancel_request(struct request *req, void *data, bool reserved) |
8484 |
+ if (blk_mq_request_completed(req)) |
8485 |
+ return true; |
8486 |
+ |
8487 |
+- nvme_req(req)->status = NVME_SC_HOST_PATH_ERROR; |
8488 |
++ nvme_req(req)->status = NVME_SC_HOST_ABORTED_CMD; |
8489 |
+ blk_mq_complete_request(req); |
8490 |
+ return true; |
8491 |
+ } |
8492 |
+@@ -611,8 +611,14 @@ static blk_status_t nvme_setup_discard(struct nvme_ns *ns, struct request *req, |
8493 |
+ struct nvme_dsm_range *range; |
8494 |
+ struct bio *bio; |
8495 |
+ |
8496 |
+- range = kmalloc_array(segments, sizeof(*range), |
8497 |
+- GFP_ATOMIC | __GFP_NOWARN); |
8498 |
++ /* |
8499 |
++ * Some devices do not consider the DSM 'Number of Ranges' field when |
8500 |
++ * determining how much data to DMA. Always allocate memory for maximum |
8501 |
++ * number of segments to prevent device reading beyond end of buffer. |
8502 |
++ */ |
8503 |
++ static const size_t alloc_size = sizeof(*range) * NVME_DSM_MAX_RANGES; |
8504 |
++ |
8505 |
++ range = kzalloc(alloc_size, GFP_ATOMIC | __GFP_NOWARN); |
8506 |
+ if (!range) { |
8507 |
+ /* |
8508 |
+ * If we fail allocation our range, fallback to the controller |
8509 |
+@@ -652,7 +658,7 @@ static blk_status_t nvme_setup_discard(struct nvme_ns *ns, struct request *req, |
8510 |
+ |
8511 |
+ req->special_vec.bv_page = virt_to_page(range); |
8512 |
+ req->special_vec.bv_offset = offset_in_page(range); |
8513 |
+- req->special_vec.bv_len = sizeof(*range) * segments; |
8514 |
++ req->special_vec.bv_len = alloc_size; |
8515 |
+ req->rq_flags |= RQF_SPECIAL_PAYLOAD; |
8516 |
+ |
8517 |
+ return BLK_STS_OK; |
8518 |
+diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c |
8519 |
+index e0f064dcbd02..132ade51ee87 100644 |
8520 |
+--- a/drivers/nvme/host/multipath.c |
8521 |
++++ b/drivers/nvme/host/multipath.c |
8522 |
+@@ -95,6 +95,7 @@ void nvme_failover_req(struct request *req) |
8523 |
+ } |
8524 |
+ break; |
8525 |
+ case NVME_SC_HOST_PATH_ERROR: |
8526 |
++ case NVME_SC_HOST_ABORTED_CMD: |
8527 |
+ /* |
8528 |
+ * Temporary transport disruption in talking to the controller. |
8529 |
+ * Try to send on a new path. |
8530 |
+diff --git a/drivers/nvmem/imx-ocotp.c b/drivers/nvmem/imx-ocotp.c |
8531 |
+index dff2f3c357f5..fc40555ca4cd 100644 |
8532 |
+--- a/drivers/nvmem/imx-ocotp.c |
8533 |
++++ b/drivers/nvmem/imx-ocotp.c |
8534 |
+@@ -521,6 +521,10 @@ static int imx_ocotp_probe(struct platform_device *pdev) |
8535 |
+ if (IS_ERR(priv->clk)) |
8536 |
+ return PTR_ERR(priv->clk); |
8537 |
+ |
8538 |
++ clk_prepare_enable(priv->clk); |
8539 |
++ imx_ocotp_clr_err_if_set(priv->base); |
8540 |
++ clk_disable_unprepare(priv->clk); |
8541 |
++ |
8542 |
+ priv->params = of_device_get_match_data(&pdev->dev); |
8543 |
+ imx_ocotp_nvmem_config.size = 4 * priv->params->nregs; |
8544 |
+ imx_ocotp_nvmem_config.dev = dev; |
8545 |
+diff --git a/drivers/parport/share.c b/drivers/parport/share.c |
8546 |
+index 7b4ee33c1935..15c81cffd2de 100644 |
8547 |
+--- a/drivers/parport/share.c |
8548 |
++++ b/drivers/parport/share.c |
8549 |
+@@ -230,6 +230,18 @@ static int port_check(struct device *dev, void *dev_drv) |
8550 |
+ return 0; |
8551 |
+ } |
8552 |
+ |
8553 |
++/* |
8554 |
++ * Iterates through all the devices connected to the bus and return 1 |
8555 |
++ * if the device is a parallel port. |
8556 |
++ */ |
8557 |
++ |
8558 |
++static int port_detect(struct device *dev, void *dev_drv) |
8559 |
++{ |
8560 |
++ if (is_parport(dev)) |
8561 |
++ return 1; |
8562 |
++ return 0; |
8563 |
++} |
8564 |
++ |
8565 |
+ /** |
8566 |
+ * parport_register_driver - register a parallel port device driver |
8567 |
+ * @drv: structure describing the driver |
8568 |
+@@ -282,6 +294,15 @@ int __parport_register_driver(struct parport_driver *drv, struct module *owner, |
8569 |
+ if (ret) |
8570 |
+ return ret; |
8571 |
+ |
8572 |
++ /* |
8573 |
++ * check if bus has any parallel port registered, if |
8574 |
++ * none is found then load the lowlevel driver. |
8575 |
++ */ |
8576 |
++ ret = bus_for_each_dev(&parport_bus_type, NULL, NULL, |
8577 |
++ port_detect); |
8578 |
++ if (!ret) |
8579 |
++ get_lowlevel_driver(); |
8580 |
++ |
8581 |
+ mutex_lock(®istration_lock); |
8582 |
+ if (drv->match_port) |
8583 |
+ bus_for_each_dev(&parport_bus_type, NULL, drv, |
8584 |
+diff --git a/drivers/phy/qualcomm/phy-qcom-usb-hs.c b/drivers/phy/qualcomm/phy-qcom-usb-hs.c |
8585 |
+index b163b3a1558d..61054272a7c8 100644 |
8586 |
+--- a/drivers/phy/qualcomm/phy-qcom-usb-hs.c |
8587 |
++++ b/drivers/phy/qualcomm/phy-qcom-usb-hs.c |
8588 |
+@@ -158,8 +158,8 @@ static int qcom_usb_hs_phy_power_on(struct phy *phy) |
8589 |
+ /* setup initial state */ |
8590 |
+ qcom_usb_hs_phy_vbus_notifier(&uphy->vbus_notify, state, |
8591 |
+ uphy->vbus_edev); |
8592 |
+- ret = devm_extcon_register_notifier(&ulpi->dev, uphy->vbus_edev, |
8593 |
+- EXTCON_USB, &uphy->vbus_notify); |
8594 |
++ ret = extcon_register_notifier(uphy->vbus_edev, EXTCON_USB, |
8595 |
++ &uphy->vbus_notify); |
8596 |
+ if (ret) |
8597 |
+ goto err_ulpi; |
8598 |
+ } |
8599 |
+@@ -180,6 +180,9 @@ static int qcom_usb_hs_phy_power_off(struct phy *phy) |
8600 |
+ { |
8601 |
+ struct qcom_usb_hs_phy *uphy = phy_get_drvdata(phy); |
8602 |
+ |
8603 |
++ if (uphy->vbus_edev) |
8604 |
++ extcon_unregister_notifier(uphy->vbus_edev, EXTCON_USB, |
8605 |
++ &uphy->vbus_notify); |
8606 |
+ regulator_disable(uphy->v3p3); |
8607 |
+ regulator_disable(uphy->v1p8); |
8608 |
+ clk_disable_unprepare(uphy->sleep_clk); |
8609 |
+diff --git a/drivers/phy/renesas/phy-rcar-gen2.c b/drivers/phy/renesas/phy-rcar-gen2.c |
8610 |
+index 2926e4937301..2e279ac0fa4d 100644 |
8611 |
+--- a/drivers/phy/renesas/phy-rcar-gen2.c |
8612 |
++++ b/drivers/phy/renesas/phy-rcar-gen2.c |
8613 |
+@@ -71,6 +71,7 @@ struct rcar_gen2_phy_driver { |
8614 |
+ struct rcar_gen2_phy_data { |
8615 |
+ const struct phy_ops *gen2_phy_ops; |
8616 |
+ const u32 (*select_value)[PHYS_PER_CHANNEL]; |
8617 |
++ const u32 num_channels; |
8618 |
+ }; |
8619 |
+ |
8620 |
+ static int rcar_gen2_phy_init(struct phy *p) |
8621 |
+@@ -271,11 +272,13 @@ static const u32 usb20_select_value[][PHYS_PER_CHANNEL] = { |
8622 |
+ static const struct rcar_gen2_phy_data rcar_gen2_usb_phy_data = { |
8623 |
+ .gen2_phy_ops = &rcar_gen2_phy_ops, |
8624 |
+ .select_value = pci_select_value, |
8625 |
++ .num_channels = ARRAY_SIZE(pci_select_value), |
8626 |
+ }; |
8627 |
+ |
8628 |
+ static const struct rcar_gen2_phy_data rz_g1c_usb_phy_data = { |
8629 |
+ .gen2_phy_ops = &rz_g1c_phy_ops, |
8630 |
+ .select_value = usb20_select_value, |
8631 |
++ .num_channels = ARRAY_SIZE(usb20_select_value), |
8632 |
+ }; |
8633 |
+ |
8634 |
+ static const struct of_device_id rcar_gen2_phy_match_table[] = { |
8635 |
+@@ -389,7 +392,7 @@ static int rcar_gen2_phy_probe(struct platform_device *pdev) |
8636 |
+ channel->selected_phy = -1; |
8637 |
+ |
8638 |
+ error = of_property_read_u32(np, "reg", &channel_num); |
8639 |
+- if (error || channel_num > 2) { |
8640 |
++ if (error || channel_num >= data->num_channels) { |
8641 |
+ dev_err(dev, "Invalid \"reg\" property\n"); |
8642 |
+ of_node_put(np); |
8643 |
+ return error; |
8644 |
+diff --git a/drivers/pinctrl/devicetree.c b/drivers/pinctrl/devicetree.c |
8645 |
+index 5d6d8b1e9062..dbaacde1b36a 100644 |
8646 |
+--- a/drivers/pinctrl/devicetree.c |
8647 |
++++ b/drivers/pinctrl/devicetree.c |
8648 |
+@@ -29,6 +29,13 @@ struct pinctrl_dt_map { |
8649 |
+ static void dt_free_map(struct pinctrl_dev *pctldev, |
8650 |
+ struct pinctrl_map *map, unsigned num_maps) |
8651 |
+ { |
8652 |
++ int i; |
8653 |
++ |
8654 |
++ for (i = 0; i < num_maps; ++i) { |
8655 |
++ kfree_const(map[i].dev_name); |
8656 |
++ map[i].dev_name = NULL; |
8657 |
++ } |
8658 |
++ |
8659 |
+ if (pctldev) { |
8660 |
+ const struct pinctrl_ops *ops = pctldev->desc->pctlops; |
8661 |
+ if (ops->dt_free_map) |
8662 |
+@@ -63,7 +70,13 @@ static int dt_remember_or_free_map(struct pinctrl *p, const char *statename, |
8663 |
+ |
8664 |
+ /* Initialize common mapping table entry fields */ |
8665 |
+ for (i = 0; i < num_maps; i++) { |
8666 |
+- map[i].dev_name = dev_name(p->dev); |
8667 |
++ const char *devname; |
8668 |
++ |
8669 |
++ devname = kstrdup_const(dev_name(p->dev), GFP_KERNEL); |
8670 |
++ if (!devname) |
8671 |
++ goto err_free_map; |
8672 |
++ |
8673 |
++ map[i].dev_name = devname; |
8674 |
+ map[i].name = statename; |
8675 |
+ if (pctldev) |
8676 |
+ map[i].ctrl_dev_name = dev_name(pctldev->dev); |
8677 |
+@@ -71,10 +84,8 @@ static int dt_remember_or_free_map(struct pinctrl *p, const char *statename, |
8678 |
+ |
8679 |
+ /* Remember the converted mapping table entries */ |
8680 |
+ dt_map = kzalloc(sizeof(*dt_map), GFP_KERNEL); |
8681 |
+- if (!dt_map) { |
8682 |
+- dt_free_map(pctldev, map, num_maps); |
8683 |
+- return -ENOMEM; |
8684 |
+- } |
8685 |
++ if (!dt_map) |
8686 |
++ goto err_free_map; |
8687 |
+ |
8688 |
+ dt_map->pctldev = pctldev; |
8689 |
+ dt_map->map = map; |
8690 |
+@@ -82,6 +93,10 @@ static int dt_remember_or_free_map(struct pinctrl *p, const char *statename, |
8691 |
+ list_add_tail(&dt_map->node, &p->dt_maps); |
8692 |
+ |
8693 |
+ return pinctrl_register_map(map, num_maps, false); |
8694 |
++ |
8695 |
++err_free_map: |
8696 |
++ dt_free_map(pctldev, map, num_maps); |
8697 |
++ return -ENOMEM; |
8698 |
+ } |
8699 |
+ |
8700 |
+ struct pinctrl_dev *of_pinctrl_get(struct device_node *np) |
8701 |
+diff --git a/drivers/pinctrl/intel/pinctrl-baytrail.c b/drivers/pinctrl/intel/pinctrl-baytrail.c |
8702 |
+index 9ffb22211d2b..7d658e6627e7 100644 |
8703 |
+--- a/drivers/pinctrl/intel/pinctrl-baytrail.c |
8704 |
++++ b/drivers/pinctrl/intel/pinctrl-baytrail.c |
8705 |
+@@ -110,7 +110,6 @@ struct byt_gpio { |
8706 |
+ struct platform_device *pdev; |
8707 |
+ struct pinctrl_dev *pctl_dev; |
8708 |
+ struct pinctrl_desc pctl_desc; |
8709 |
+- raw_spinlock_t lock; |
8710 |
+ const struct intel_pinctrl_soc_data *soc_data; |
8711 |
+ struct intel_community *communities_copy; |
8712 |
+ struct byt_gpio_pin_context *saved_context; |
8713 |
+@@ -549,6 +548,8 @@ static const struct intel_pinctrl_soc_data *byt_soc_data[] = { |
8714 |
+ NULL |
8715 |
+ }; |
8716 |
+ |
8717 |
++static DEFINE_RAW_SPINLOCK(byt_lock); |
8718 |
++ |
8719 |
+ static struct intel_community *byt_get_community(struct byt_gpio *vg, |
8720 |
+ unsigned int pin) |
8721 |
+ { |
8722 |
+@@ -658,7 +659,7 @@ static void byt_set_group_simple_mux(struct byt_gpio *vg, |
8723 |
+ unsigned long flags; |
8724 |
+ int i; |
8725 |
+ |
8726 |
+- raw_spin_lock_irqsave(&vg->lock, flags); |
8727 |
++ raw_spin_lock_irqsave(&byt_lock, flags); |
8728 |
+ |
8729 |
+ for (i = 0; i < group.npins; i++) { |
8730 |
+ void __iomem *padcfg0; |
8731 |
+@@ -678,7 +679,7 @@ static void byt_set_group_simple_mux(struct byt_gpio *vg, |
8732 |
+ writel(value, padcfg0); |
8733 |
+ } |
8734 |
+ |
8735 |
+- raw_spin_unlock_irqrestore(&vg->lock, flags); |
8736 |
++ raw_spin_unlock_irqrestore(&byt_lock, flags); |
8737 |
+ } |
8738 |
+ |
8739 |
+ static void byt_set_group_mixed_mux(struct byt_gpio *vg, |
8740 |
+@@ -688,7 +689,7 @@ static void byt_set_group_mixed_mux(struct byt_gpio *vg, |
8741 |
+ unsigned long flags; |
8742 |
+ int i; |
8743 |
+ |
8744 |
+- raw_spin_lock_irqsave(&vg->lock, flags); |
8745 |
++ raw_spin_lock_irqsave(&byt_lock, flags); |
8746 |
+ |
8747 |
+ for (i = 0; i < group.npins; i++) { |
8748 |
+ void __iomem *padcfg0; |
8749 |
+@@ -708,7 +709,7 @@ static void byt_set_group_mixed_mux(struct byt_gpio *vg, |
8750 |
+ writel(value, padcfg0); |
8751 |
+ } |
8752 |
+ |
8753 |
+- raw_spin_unlock_irqrestore(&vg->lock, flags); |
8754 |
++ raw_spin_unlock_irqrestore(&byt_lock, flags); |
8755 |
+ } |
8756 |
+ |
8757 |
+ static int byt_set_mux(struct pinctrl_dev *pctldev, unsigned int func_selector, |
8758 |
+@@ -749,11 +750,11 @@ static void byt_gpio_clear_triggering(struct byt_gpio *vg, unsigned int offset) |
8759 |
+ unsigned long flags; |
8760 |
+ u32 value; |
8761 |
+ |
8762 |
+- raw_spin_lock_irqsave(&vg->lock, flags); |
8763 |
++ raw_spin_lock_irqsave(&byt_lock, flags); |
8764 |
+ value = readl(reg); |
8765 |
+ value &= ~(BYT_TRIG_POS | BYT_TRIG_NEG | BYT_TRIG_LVL); |
8766 |
+ writel(value, reg); |
8767 |
+- raw_spin_unlock_irqrestore(&vg->lock, flags); |
8768 |
++ raw_spin_unlock_irqrestore(&byt_lock, flags); |
8769 |
+ } |
8770 |
+ |
8771 |
+ static int byt_gpio_request_enable(struct pinctrl_dev *pctl_dev, |
8772 |
+@@ -765,7 +766,7 @@ static int byt_gpio_request_enable(struct pinctrl_dev *pctl_dev, |
8773 |
+ u32 value, gpio_mux; |
8774 |
+ unsigned long flags; |
8775 |
+ |
8776 |
+- raw_spin_lock_irqsave(&vg->lock, flags); |
8777 |
++ raw_spin_lock_irqsave(&byt_lock, flags); |
8778 |
+ |
8779 |
+ /* |
8780 |
+ * In most cases, func pin mux 000 means GPIO function. |
8781 |
+@@ -787,7 +788,7 @@ static int byt_gpio_request_enable(struct pinctrl_dev *pctl_dev, |
8782 |
+ "pin %u forcibly re-configured as GPIO\n", offset); |
8783 |
+ } |
8784 |
+ |
8785 |
+- raw_spin_unlock_irqrestore(&vg->lock, flags); |
8786 |
++ raw_spin_unlock_irqrestore(&byt_lock, flags); |
8787 |
+ |
8788 |
+ pm_runtime_get(&vg->pdev->dev); |
8789 |
+ |
8790 |
+@@ -815,7 +816,7 @@ static int byt_gpio_set_direction(struct pinctrl_dev *pctl_dev, |
8791 |
+ unsigned long flags; |
8792 |
+ u32 value; |
8793 |
+ |
8794 |
+- raw_spin_lock_irqsave(&vg->lock, flags); |
8795 |
++ raw_spin_lock_irqsave(&byt_lock, flags); |
8796 |
+ |
8797 |
+ value = readl(val_reg); |
8798 |
+ value &= ~BYT_DIR_MASK; |
8799 |
+@@ -832,7 +833,7 @@ static int byt_gpio_set_direction(struct pinctrl_dev *pctl_dev, |
8800 |
+ "Potential Error: Setting GPIO with direct_irq_en to output"); |
8801 |
+ writel(value, val_reg); |
8802 |
+ |
8803 |
+- raw_spin_unlock_irqrestore(&vg->lock, flags); |
8804 |
++ raw_spin_unlock_irqrestore(&byt_lock, flags); |
8805 |
+ |
8806 |
+ return 0; |
8807 |
+ } |
8808 |
+@@ -901,11 +902,11 @@ static int byt_pin_config_get(struct pinctrl_dev *pctl_dev, unsigned int offset, |
8809 |
+ u32 conf, pull, val, debounce; |
8810 |
+ u16 arg = 0; |
8811 |
+ |
8812 |
+- raw_spin_lock_irqsave(&vg->lock, flags); |
8813 |
++ raw_spin_lock_irqsave(&byt_lock, flags); |
8814 |
+ conf = readl(conf_reg); |
8815 |
+ pull = conf & BYT_PULL_ASSIGN_MASK; |
8816 |
+ val = readl(val_reg); |
8817 |
+- raw_spin_unlock_irqrestore(&vg->lock, flags); |
8818 |
++ raw_spin_unlock_irqrestore(&byt_lock, flags); |
8819 |
+ |
8820 |
+ switch (param) { |
8821 |
+ case PIN_CONFIG_BIAS_DISABLE: |
8822 |
+@@ -932,9 +933,9 @@ static int byt_pin_config_get(struct pinctrl_dev *pctl_dev, unsigned int offset, |
8823 |
+ if (!(conf & BYT_DEBOUNCE_EN)) |
8824 |
+ return -EINVAL; |
8825 |
+ |
8826 |
+- raw_spin_lock_irqsave(&vg->lock, flags); |
8827 |
++ raw_spin_lock_irqsave(&byt_lock, flags); |
8828 |
+ debounce = readl(db_reg); |
8829 |
+- raw_spin_unlock_irqrestore(&vg->lock, flags); |
8830 |
++ raw_spin_unlock_irqrestore(&byt_lock, flags); |
8831 |
+ |
8832 |
+ switch (debounce & BYT_DEBOUNCE_PULSE_MASK) { |
8833 |
+ case BYT_DEBOUNCE_PULSE_375US: |
8834 |
+@@ -986,7 +987,7 @@ static int byt_pin_config_set(struct pinctrl_dev *pctl_dev, |
8835 |
+ u32 conf, val, debounce; |
8836 |
+ int i, ret = 0; |
8837 |
+ |
8838 |
+- raw_spin_lock_irqsave(&vg->lock, flags); |
8839 |
++ raw_spin_lock_irqsave(&byt_lock, flags); |
8840 |
+ |
8841 |
+ conf = readl(conf_reg); |
8842 |
+ val = readl(val_reg); |
8843 |
+@@ -1094,7 +1095,7 @@ static int byt_pin_config_set(struct pinctrl_dev *pctl_dev, |
8844 |
+ if (!ret) |
8845 |
+ writel(conf, conf_reg); |
8846 |
+ |
8847 |
+- raw_spin_unlock_irqrestore(&vg->lock, flags); |
8848 |
++ raw_spin_unlock_irqrestore(&byt_lock, flags); |
8849 |
+ |
8850 |
+ return ret; |
8851 |
+ } |
8852 |
+@@ -1119,9 +1120,9 @@ static int byt_gpio_get(struct gpio_chip *chip, unsigned int offset) |
8853 |
+ unsigned long flags; |
8854 |
+ u32 val; |
8855 |
+ |
8856 |
+- raw_spin_lock_irqsave(&vg->lock, flags); |
8857 |
++ raw_spin_lock_irqsave(&byt_lock, flags); |
8858 |
+ val = readl(reg); |
8859 |
+- raw_spin_unlock_irqrestore(&vg->lock, flags); |
8860 |
++ raw_spin_unlock_irqrestore(&byt_lock, flags); |
8861 |
+ |
8862 |
+ return !!(val & BYT_LEVEL); |
8863 |
+ } |
8864 |
+@@ -1136,13 +1137,13 @@ static void byt_gpio_set(struct gpio_chip *chip, unsigned int offset, int value) |
8865 |
+ if (!reg) |
8866 |
+ return; |
8867 |
+ |
8868 |
+- raw_spin_lock_irqsave(&vg->lock, flags); |
8869 |
++ raw_spin_lock_irqsave(&byt_lock, flags); |
8870 |
+ old_val = readl(reg); |
8871 |
+ if (value) |
8872 |
+ writel(old_val | BYT_LEVEL, reg); |
8873 |
+ else |
8874 |
+ writel(old_val & ~BYT_LEVEL, reg); |
8875 |
+- raw_spin_unlock_irqrestore(&vg->lock, flags); |
8876 |
++ raw_spin_unlock_irqrestore(&byt_lock, flags); |
8877 |
+ } |
8878 |
+ |
8879 |
+ static int byt_gpio_get_direction(struct gpio_chip *chip, unsigned int offset) |
8880 |
+@@ -1155,9 +1156,9 @@ static int byt_gpio_get_direction(struct gpio_chip *chip, unsigned int offset) |
8881 |
+ if (!reg) |
8882 |
+ return -EINVAL; |
8883 |
+ |
8884 |
+- raw_spin_lock_irqsave(&vg->lock, flags); |
8885 |
++ raw_spin_lock_irqsave(&byt_lock, flags); |
8886 |
+ value = readl(reg); |
8887 |
+- raw_spin_unlock_irqrestore(&vg->lock, flags); |
8888 |
++ raw_spin_unlock_irqrestore(&byt_lock, flags); |
8889 |
+ |
8890 |
+ if (!(value & BYT_OUTPUT_EN)) |
8891 |
+ return 0; |
8892 |
+@@ -1200,14 +1201,14 @@ static void byt_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip) |
8893 |
+ const char *label; |
8894 |
+ unsigned int pin; |
8895 |
+ |
8896 |
+- raw_spin_lock_irqsave(&vg->lock, flags); |
8897 |
++ raw_spin_lock_irqsave(&byt_lock, flags); |
8898 |
+ pin = vg->soc_data->pins[i].number; |
8899 |
+ reg = byt_gpio_reg(vg, pin, BYT_CONF0_REG); |
8900 |
+ if (!reg) { |
8901 |
+ seq_printf(s, |
8902 |
+ "Could not retrieve pin %i conf0 reg\n", |
8903 |
+ pin); |
8904 |
+- raw_spin_unlock_irqrestore(&vg->lock, flags); |
8905 |
++ raw_spin_unlock_irqrestore(&byt_lock, flags); |
8906 |
+ continue; |
8907 |
+ } |
8908 |
+ conf0 = readl(reg); |
8909 |
+@@ -1216,11 +1217,11 @@ static void byt_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip) |
8910 |
+ if (!reg) { |
8911 |
+ seq_printf(s, |
8912 |
+ "Could not retrieve pin %i val reg\n", pin); |
8913 |
+- raw_spin_unlock_irqrestore(&vg->lock, flags); |
8914 |
++ raw_spin_unlock_irqrestore(&byt_lock, flags); |
8915 |
+ continue; |
8916 |
+ } |
8917 |
+ val = readl(reg); |
8918 |
+- raw_spin_unlock_irqrestore(&vg->lock, flags); |
8919 |
++ raw_spin_unlock_irqrestore(&byt_lock, flags); |
8920 |
+ |
8921 |
+ comm = byt_get_community(vg, pin); |
8922 |
+ if (!comm) { |
8923 |
+@@ -1304,9 +1305,9 @@ static void byt_irq_ack(struct irq_data *d) |
8924 |
+ if (!reg) |
8925 |
+ return; |
8926 |
+ |
8927 |
+- raw_spin_lock(&vg->lock); |
8928 |
++ raw_spin_lock(&byt_lock); |
8929 |
+ writel(BIT(offset % 32), reg); |
8930 |
+- raw_spin_unlock(&vg->lock); |
8931 |
++ raw_spin_unlock(&byt_lock); |
8932 |
+ } |
8933 |
+ |
8934 |
+ static void byt_irq_mask(struct irq_data *d) |
8935 |
+@@ -1330,7 +1331,7 @@ static void byt_irq_unmask(struct irq_data *d) |
8936 |
+ if (!reg) |
8937 |
+ return; |
8938 |
+ |
8939 |
+- raw_spin_lock_irqsave(&vg->lock, flags); |
8940 |
++ raw_spin_lock_irqsave(&byt_lock, flags); |
8941 |
+ value = readl(reg); |
8942 |
+ |
8943 |
+ switch (irqd_get_trigger_type(d)) { |
8944 |
+@@ -1353,7 +1354,7 @@ static void byt_irq_unmask(struct irq_data *d) |
8945 |
+ |
8946 |
+ writel(value, reg); |
8947 |
+ |
8948 |
+- raw_spin_unlock_irqrestore(&vg->lock, flags); |
8949 |
++ raw_spin_unlock_irqrestore(&byt_lock, flags); |
8950 |
+ } |
8951 |
+ |
8952 |
+ static int byt_irq_type(struct irq_data *d, unsigned int type) |
8953 |
+@@ -1367,7 +1368,7 @@ static int byt_irq_type(struct irq_data *d, unsigned int type) |
8954 |
+ if (!reg || offset >= vg->chip.ngpio) |
8955 |
+ return -EINVAL; |
8956 |
+ |
8957 |
+- raw_spin_lock_irqsave(&vg->lock, flags); |
8958 |
++ raw_spin_lock_irqsave(&byt_lock, flags); |
8959 |
+ value = readl(reg); |
8960 |
+ |
8961 |
+ WARN(value & BYT_DIRECT_IRQ_EN, |
8962 |
+@@ -1389,7 +1390,7 @@ static int byt_irq_type(struct irq_data *d, unsigned int type) |
8963 |
+ else if (type & IRQ_TYPE_LEVEL_MASK) |
8964 |
+ irq_set_handler_locked(d, handle_level_irq); |
8965 |
+ |
8966 |
+- raw_spin_unlock_irqrestore(&vg->lock, flags); |
8967 |
++ raw_spin_unlock_irqrestore(&byt_lock, flags); |
8968 |
+ |
8969 |
+ return 0; |
8970 |
+ } |
8971 |
+@@ -1425,9 +1426,9 @@ static void byt_gpio_irq_handler(struct irq_desc *desc) |
8972 |
+ continue; |
8973 |
+ } |
8974 |
+ |
8975 |
+- raw_spin_lock(&vg->lock); |
8976 |
++ raw_spin_lock(&byt_lock); |
8977 |
+ pending = readl(reg); |
8978 |
+- raw_spin_unlock(&vg->lock); |
8979 |
++ raw_spin_unlock(&byt_lock); |
8980 |
+ for_each_set_bit(pin, &pending, 32) { |
8981 |
+ virq = irq_find_mapping(vg->chip.irq.domain, base + pin); |
8982 |
+ generic_handle_irq(virq); |
8983 |
+@@ -1638,8 +1639,6 @@ static int byt_pinctrl_probe(struct platform_device *pdev) |
8984 |
+ return PTR_ERR(vg->pctl_dev); |
8985 |
+ } |
8986 |
+ |
8987 |
+- raw_spin_lock_init(&vg->lock); |
8988 |
+- |
8989 |
+ ret = byt_gpio_probe(vg); |
8990 |
+ if (ret) |
8991 |
+ return ret; |
8992 |
+@@ -1654,8 +1653,11 @@ static int byt_pinctrl_probe(struct platform_device *pdev) |
8993 |
+ static int byt_gpio_suspend(struct device *dev) |
8994 |
+ { |
8995 |
+ struct byt_gpio *vg = dev_get_drvdata(dev); |
8996 |
++ unsigned long flags; |
8997 |
+ int i; |
8998 |
+ |
8999 |
++ raw_spin_lock_irqsave(&byt_lock, flags); |
9000 |
++ |
9001 |
+ for (i = 0; i < vg->soc_data->npins; i++) { |
9002 |
+ void __iomem *reg; |
9003 |
+ u32 value; |
9004 |
+@@ -1676,14 +1678,18 @@ static int byt_gpio_suspend(struct device *dev) |
9005 |
+ vg->saved_context[i].val = value; |
9006 |
+ } |
9007 |
+ |
9008 |
++ raw_spin_unlock_irqrestore(&byt_lock, flags); |
9009 |
+ return 0; |
9010 |
+ } |
9011 |
+ |
9012 |
+ static int byt_gpio_resume(struct device *dev) |
9013 |
+ { |
9014 |
+ struct byt_gpio *vg = dev_get_drvdata(dev); |
9015 |
++ unsigned long flags; |
9016 |
+ int i; |
9017 |
+ |
9018 |
++ raw_spin_lock_irqsave(&byt_lock, flags); |
9019 |
++ |
9020 |
+ for (i = 0; i < vg->soc_data->npins; i++) { |
9021 |
+ void __iomem *reg; |
9022 |
+ u32 value; |
9023 |
+@@ -1721,6 +1727,7 @@ static int byt_gpio_resume(struct device *dev) |
9024 |
+ } |
9025 |
+ } |
9026 |
+ |
9027 |
++ raw_spin_unlock_irqrestore(&byt_lock, flags); |
9028 |
+ return 0; |
9029 |
+ } |
9030 |
+ #endif |
9031 |
+diff --git a/drivers/pinctrl/pinctrl-amd.c b/drivers/pinctrl/pinctrl-amd.c |
9032 |
+index 2c61141519f8..eab078244a4c 100644 |
9033 |
+--- a/drivers/pinctrl/pinctrl-amd.c |
9034 |
++++ b/drivers/pinctrl/pinctrl-amd.c |
9035 |
+@@ -540,7 +540,8 @@ static irqreturn_t amd_gpio_irq_handler(int irq, void *dev_id) |
9036 |
+ irqreturn_t ret = IRQ_NONE; |
9037 |
+ unsigned int i, irqnr; |
9038 |
+ unsigned long flags; |
9039 |
+- u32 *regs, regval; |
9040 |
++ u32 __iomem *regs; |
9041 |
++ u32 regval; |
9042 |
+ u64 status, mask; |
9043 |
+ |
9044 |
+ /* Read the wake status */ |
9045 |
+diff --git a/drivers/pinctrl/qcom/pinctrl-sc7180.c b/drivers/pinctrl/qcom/pinctrl-sc7180.c |
9046 |
+index 6399c8a2bc22..d6cfad7417b1 100644 |
9047 |
+--- a/drivers/pinctrl/qcom/pinctrl-sc7180.c |
9048 |
++++ b/drivers/pinctrl/qcom/pinctrl-sc7180.c |
9049 |
+@@ -77,6 +77,7 @@ enum { |
9050 |
+ .intr_cfg_reg = 0, \ |
9051 |
+ .intr_status_reg = 0, \ |
9052 |
+ .intr_target_reg = 0, \ |
9053 |
++ .tile = SOUTH, \ |
9054 |
+ .mux_bit = -1, \ |
9055 |
+ .pull_bit = pull, \ |
9056 |
+ .drv_bit = drv, \ |
9057 |
+@@ -102,6 +103,7 @@ enum { |
9058 |
+ .intr_cfg_reg = 0, \ |
9059 |
+ .intr_status_reg = 0, \ |
9060 |
+ .intr_target_reg = 0, \ |
9061 |
++ .tile = SOUTH, \ |
9062 |
+ .mux_bit = -1, \ |
9063 |
+ .pull_bit = 3, \ |
9064 |
+ .drv_bit = 0, \ |
9065 |
+@@ -1087,14 +1089,14 @@ static const struct msm_pingroup sc7180_groups[] = { |
9066 |
+ [116] = PINGROUP(116, WEST, qup04, qup04, _, _, _, _, _, _, _), |
9067 |
+ [117] = PINGROUP(117, WEST, dp_hot, _, _, _, _, _, _, _, _), |
9068 |
+ [118] = PINGROUP(118, WEST, _, _, _, _, _, _, _, _, _), |
9069 |
+- [119] = UFS_RESET(ufs_reset, 0x97f000), |
9070 |
+- [120] = SDC_QDSD_PINGROUP(sdc1_rclk, 0x97a000, 15, 0), |
9071 |
+- [121] = SDC_QDSD_PINGROUP(sdc1_clk, 0x97a000, 13, 6), |
9072 |
+- [122] = SDC_QDSD_PINGROUP(sdc1_cmd, 0x97a000, 11, 3), |
9073 |
+- [123] = SDC_QDSD_PINGROUP(sdc1_data, 0x97a000, 9, 0), |
9074 |
+- [124] = SDC_QDSD_PINGROUP(sdc2_clk, 0x97b000, 14, 6), |
9075 |
+- [125] = SDC_QDSD_PINGROUP(sdc2_cmd, 0x97b000, 11, 3), |
9076 |
+- [126] = SDC_QDSD_PINGROUP(sdc2_data, 0x97b000, 9, 0), |
9077 |
++ [119] = UFS_RESET(ufs_reset, 0x7f000), |
9078 |
++ [120] = SDC_QDSD_PINGROUP(sdc1_rclk, 0x7a000, 15, 0), |
9079 |
++ [121] = SDC_QDSD_PINGROUP(sdc1_clk, 0x7a000, 13, 6), |
9080 |
++ [122] = SDC_QDSD_PINGROUP(sdc1_cmd, 0x7a000, 11, 3), |
9081 |
++ [123] = SDC_QDSD_PINGROUP(sdc1_data, 0x7a000, 9, 0), |
9082 |
++ [124] = SDC_QDSD_PINGROUP(sdc2_clk, 0x7b000, 14, 6), |
9083 |
++ [125] = SDC_QDSD_PINGROUP(sdc2_cmd, 0x7b000, 11, 3), |
9084 |
++ [126] = SDC_QDSD_PINGROUP(sdc2_data, 0x7b000, 9, 0), |
9085 |
+ }; |
9086 |
+ |
9087 |
+ static const struct msm_pinctrl_soc_data sc7180_pinctrl = { |
9088 |
+diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a77990.c b/drivers/pinctrl/sh-pfc/pfc-r8a77990.c |
9089 |
+index 2dfb8d9cfda1..5200dadd6b3e 100644 |
9090 |
+--- a/drivers/pinctrl/sh-pfc/pfc-r8a77990.c |
9091 |
++++ b/drivers/pinctrl/sh-pfc/pfc-r8a77990.c |
9092 |
+@@ -448,6 +448,8 @@ FM(IP12_31_28) IP12_31_28 FM(IP13_31_28) IP13_31_28 FM(IP14_31_28) IP14_31_28 FM |
9093 |
+ #define MOD_SEL0_1_0 REV4(FM(SEL_SPEED_PULSE_IF_0), FM(SEL_SPEED_PULSE_IF_1), FM(SEL_SPEED_PULSE_IF_2), F_(0, 0)) |
9094 |
+ |
9095 |
+ /* MOD_SEL1 */ /* 0 */ /* 1 */ /* 2 */ /* 3 */ /* 4 */ /* 5 */ /* 6 */ /* 7 */ |
9096 |
++#define MOD_SEL1_31 FM(SEL_SIMCARD_0) FM(SEL_SIMCARD_1) |
9097 |
++#define MOD_SEL1_30 FM(SEL_SSI2_0) FM(SEL_SSI2_1) |
9098 |
+ #define MOD_SEL1_29 FM(SEL_TIMER_TMU_0) FM(SEL_TIMER_TMU_1) |
9099 |
+ #define MOD_SEL1_28 FM(SEL_USB_20_CH0_0) FM(SEL_USB_20_CH0_1) |
9100 |
+ #define MOD_SEL1_26 FM(SEL_DRIF2_0) FM(SEL_DRIF2_1) |
9101 |
+@@ -468,7 +470,8 @@ FM(IP12_31_28) IP12_31_28 FM(IP13_31_28) IP13_31_28 FM(IP14_31_28) IP14_31_28 FM |
9102 |
+ |
9103 |
+ #define PINMUX_MOD_SELS \ |
9104 |
+ \ |
9105 |
+-MOD_SEL0_30_29 \ |
9106 |
++ MOD_SEL1_31 \ |
9107 |
++MOD_SEL0_30_29 MOD_SEL1_30 \ |
9108 |
+ MOD_SEL1_29 \ |
9109 |
+ MOD_SEL0_28 MOD_SEL1_28 \ |
9110 |
+ MOD_SEL0_27_26 \ |
9111 |
+@@ -1058,7 +1061,7 @@ static const u16 pinmux_data[] = { |
9112 |
+ PINMUX_IPSR_MSEL(IP10_27_24, RIF0_CLK_B, SEL_DRIF0_1), |
9113 |
+ PINMUX_IPSR_MSEL(IP10_27_24, SCL2_B, SEL_I2C2_1), |
9114 |
+ PINMUX_IPSR_MSEL(IP10_27_24, TCLK1_A, SEL_TIMER_TMU_0), |
9115 |
+- PINMUX_IPSR_GPSR(IP10_27_24, SSI_SCK2_B), |
9116 |
++ PINMUX_IPSR_MSEL(IP10_27_24, SSI_SCK2_B, SEL_SSI2_1), |
9117 |
+ PINMUX_IPSR_GPSR(IP10_27_24, TS_SCK0), |
9118 |
+ |
9119 |
+ PINMUX_IPSR_GPSR(IP10_31_28, SD0_WP), |
9120 |
+@@ -1067,7 +1070,7 @@ static const u16 pinmux_data[] = { |
9121 |
+ PINMUX_IPSR_MSEL(IP10_31_28, RIF0_D0_B, SEL_DRIF0_1), |
9122 |
+ PINMUX_IPSR_MSEL(IP10_31_28, SDA2_B, SEL_I2C2_1), |
9123 |
+ PINMUX_IPSR_MSEL(IP10_31_28, TCLK2_A, SEL_TIMER_TMU_0), |
9124 |
+- PINMUX_IPSR_GPSR(IP10_31_28, SSI_WS2_B), |
9125 |
++ PINMUX_IPSR_MSEL(IP10_31_28, SSI_WS2_B, SEL_SSI2_1), |
9126 |
+ PINMUX_IPSR_GPSR(IP10_31_28, TS_SDAT0), |
9127 |
+ |
9128 |
+ /* IPSR11 */ |
9129 |
+@@ -1085,13 +1088,13 @@ static const u16 pinmux_data[] = { |
9130 |
+ |
9131 |
+ PINMUX_IPSR_MSEL(IP11_11_8, RX0_A, SEL_SCIF0_0), |
9132 |
+ PINMUX_IPSR_MSEL(IP11_11_8, HRX1_A, SEL_HSCIF1_0), |
9133 |
+- PINMUX_IPSR_GPSR(IP11_11_8, SSI_SCK2_A), |
9134 |
++ PINMUX_IPSR_MSEL(IP11_11_8, SSI_SCK2_A, SEL_SSI2_0), |
9135 |
+ PINMUX_IPSR_GPSR(IP11_11_8, RIF1_SYNC), |
9136 |
+ PINMUX_IPSR_GPSR(IP11_11_8, TS_SCK1), |
9137 |
+ |
9138 |
+ PINMUX_IPSR_MSEL(IP11_15_12, TX0_A, SEL_SCIF0_0), |
9139 |
+ PINMUX_IPSR_GPSR(IP11_15_12, HTX1_A), |
9140 |
+- PINMUX_IPSR_GPSR(IP11_15_12, SSI_WS2_A), |
9141 |
++ PINMUX_IPSR_MSEL(IP11_15_12, SSI_WS2_A, SEL_SSI2_0), |
9142 |
+ PINMUX_IPSR_GPSR(IP11_15_12, RIF1_D0), |
9143 |
+ PINMUX_IPSR_GPSR(IP11_15_12, TS_SDAT1), |
9144 |
+ |
9145 |
+@@ -1196,7 +1199,7 @@ static const u16 pinmux_data[] = { |
9146 |
+ PINMUX_IPSR_MSEL(IP13_19_16, RIF0_D1_A, SEL_DRIF0_0), |
9147 |
+ PINMUX_IPSR_MSEL(IP13_19_16, SDA1_B, SEL_I2C1_1), |
9148 |
+ PINMUX_IPSR_MSEL(IP13_19_16, TCLK2_B, SEL_TIMER_TMU_1), |
9149 |
+- PINMUX_IPSR_GPSR(IP13_19_16, SIM0_D_A), |
9150 |
++ PINMUX_IPSR_MSEL(IP13_19_16, SIM0_D_A, SEL_SIMCARD_0), |
9151 |
+ |
9152 |
+ PINMUX_IPSR_GPSR(IP13_23_20, MLB_DAT), |
9153 |
+ PINMUX_IPSR_MSEL(IP13_23_20, TX0_B, SEL_SCIF0_1), |
9154 |
+@@ -1264,7 +1267,7 @@ static const u16 pinmux_data[] = { |
9155 |
+ PINMUX_IPSR_GPSR(IP15_15_12, TPU0TO2), |
9156 |
+ PINMUX_IPSR_MSEL(IP15_15_12, SDA1_D, SEL_I2C1_3), |
9157 |
+ PINMUX_IPSR_MSEL(IP15_15_12, FSO_CFE_1_N_B, SEL_FSO_1), |
9158 |
+- PINMUX_IPSR_GPSR(IP15_15_12, SIM0_D_B), |
9159 |
++ PINMUX_IPSR_MSEL(IP15_15_12, SIM0_D_B, SEL_SIMCARD_1), |
9160 |
+ |
9161 |
+ PINMUX_IPSR_GPSR(IP15_19_16, SSI_SDATA6), |
9162 |
+ PINMUX_IPSR_MSEL(IP15_19_16, HRTS2_N_A, SEL_HSCIF2_0), |
9163 |
+@@ -4957,11 +4960,11 @@ static const struct pinmux_cfg_reg pinmux_config_regs[] = { |
9164 |
+ MOD_SEL0_1_0 )) |
9165 |
+ }, |
9166 |
+ { PINMUX_CFG_REG_VAR("MOD_SEL1", 0xe6060504, 32, |
9167 |
+- GROUP(2, 1, 1, 1, 1, 1, 3, 3, 1, 1, 1, 1, |
9168 |
+- 2, 2, 2, 1, 1, 2, 1, 4), |
9169 |
++ GROUP(1, 1, 1, 1, 1, 1, 1, 3, 3, 1, 1, 1, |
9170 |
++ 1, 2, 2, 2, 1, 1, 2, 1, 4), |
9171 |
+ GROUP( |
9172 |
+- /* RESERVED 31, 30 */ |
9173 |
+- 0, 0, 0, 0, |
9174 |
++ MOD_SEL1_31 |
9175 |
++ MOD_SEL1_30 |
9176 |
+ MOD_SEL1_29 |
9177 |
+ MOD_SEL1_28 |
9178 |
+ /* RESERVED 27 */ |
9179 |
+diff --git a/drivers/pinctrl/sh-pfc/pfc-sh7734.c b/drivers/pinctrl/sh-pfc/pfc-sh7734.c |
9180 |
+index 5dfd991ffdaa..dbc36079c381 100644 |
9181 |
+--- a/drivers/pinctrl/sh-pfc/pfc-sh7734.c |
9182 |
++++ b/drivers/pinctrl/sh-pfc/pfc-sh7734.c |
9183 |
+@@ -1450,7 +1450,7 @@ static const struct pinmux_func pinmux_func_gpios[] = { |
9184 |
+ GPIO_FN(ET0_ETXD2_A), |
9185 |
+ GPIO_FN(EX_CS5), GPIO_FN(SD1_CMD_A), GPIO_FN(ATADIR), GPIO_FN(QSSL_B), |
9186 |
+ GPIO_FN(ET0_ETXD3_A), |
9187 |
+- GPIO_FN(RD_WR), GPIO_FN(TCLK1_B), |
9188 |
++ GPIO_FN(RD_WR), GPIO_FN(TCLK0), GPIO_FN(CAN_CLK_B), GPIO_FN(ET0_ETXD4), |
9189 |
+ GPIO_FN(EX_WAIT0), GPIO_FN(TCLK1_B), |
9190 |
+ GPIO_FN(EX_WAIT1), GPIO_FN(SD1_DAT0_A), GPIO_FN(DREQ2), |
9191 |
+ GPIO_FN(CAN1_TX_C), GPIO_FN(ET0_LINK_C), GPIO_FN(ET0_ETXD5_A), |
9192 |
+@@ -1949,7 +1949,7 @@ static const struct pinmux_cfg_reg pinmux_config_regs[] = { |
9193 |
+ /* IP3_20 [1] */ |
9194 |
+ FN_EX_WAIT0, FN_TCLK1_B, |
9195 |
+ /* IP3_19_18 [2] */ |
9196 |
+- FN_RD_WR, FN_TCLK1_B, 0, 0, |
9197 |
++ FN_RD_WR, FN_TCLK0, FN_CAN_CLK_B, FN_ET0_ETXD4, |
9198 |
+ /* IP3_17_15 [3] */ |
9199 |
+ FN_EX_CS5, FN_SD1_CMD_A, FN_ATADIR, FN_QSSL_B, |
9200 |
+ FN_ET0_ETXD3_A, 0, 0, 0, |
9201 |
+diff --git a/drivers/platform/x86/hp-wmi.c b/drivers/platform/x86/hp-wmi.c |
9202 |
+index 9579a706fc08..a881b709af25 100644 |
9203 |
+--- a/drivers/platform/x86/hp-wmi.c |
9204 |
++++ b/drivers/platform/x86/hp-wmi.c |
9205 |
+@@ -300,7 +300,7 @@ static int __init hp_wmi_bios_2008_later(void) |
9206 |
+ |
9207 |
+ static int __init hp_wmi_bios_2009_later(void) |
9208 |
+ { |
9209 |
+- int state = 0; |
9210 |
++ u8 state[128]; |
9211 |
+ int ret = hp_wmi_perform_query(HPWMI_FEATURE2_QUERY, HPWMI_READ, &state, |
9212 |
+ sizeof(state), sizeof(state)); |
9213 |
+ if (!ret) |
9214 |
+diff --git a/drivers/power/supply/cpcap-battery.c b/drivers/power/supply/cpcap-battery.c |
9215 |
+index 61d6447d1966..00a96e4a1cdc 100644 |
9216 |
+--- a/drivers/power/supply/cpcap-battery.c |
9217 |
++++ b/drivers/power/supply/cpcap-battery.c |
9218 |
+@@ -562,12 +562,14 @@ static irqreturn_t cpcap_battery_irq_thread(int irq, void *data) |
9219 |
+ switch (d->action) { |
9220 |
+ case CPCAP_BATTERY_IRQ_ACTION_BATTERY_LOW: |
9221 |
+ if (latest->current_ua >= 0) |
9222 |
+- dev_warn(ddata->dev, "Battery low at 3.3V!\n"); |
9223 |
++ dev_warn(ddata->dev, "Battery low at %imV!\n", |
9224 |
++ latest->voltage / 1000); |
9225 |
+ break; |
9226 |
+ case CPCAP_BATTERY_IRQ_ACTION_POWEROFF: |
9227 |
+- if (latest->current_ua >= 0) { |
9228 |
++ if (latest->current_ua >= 0 && latest->voltage <= 3200000) { |
9229 |
+ dev_emerg(ddata->dev, |
9230 |
+- "Battery empty at 3.1V, powering off\n"); |
9231 |
++ "Battery empty at %imV, powering off\n", |
9232 |
++ latest->voltage / 1000); |
9233 |
+ orderly_poweroff(true); |
9234 |
+ } |
9235 |
+ break; |
9236 |
+diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c |
9237 |
+index a46be221dbdc..87bc06b386a0 100644 |
9238 |
+--- a/drivers/regulator/core.c |
9239 |
++++ b/drivers/regulator/core.c |
9240 |
+@@ -1403,7 +1403,9 @@ static int set_machine_constraints(struct regulator_dev *rdev, |
9241 |
+ rdev_err(rdev, "failed to enable\n"); |
9242 |
+ return ret; |
9243 |
+ } |
9244 |
+- rdev->use_count++; |
9245 |
++ |
9246 |
++ if (rdev->constraints->always_on) |
9247 |
++ rdev->use_count++; |
9248 |
+ } |
9249 |
+ |
9250 |
+ print_constraints(rdev); |
9251 |
+@@ -5198,6 +5200,7 @@ unset_supplies: |
9252 |
+ regulator_remove_coupling(rdev); |
9253 |
+ mutex_unlock(®ulator_list_mutex); |
9254 |
+ wash: |
9255 |
++ kfree(rdev->coupling_desc.coupled_rdevs); |
9256 |
+ kfree(rdev->constraints); |
9257 |
+ mutex_lock(®ulator_list_mutex); |
9258 |
+ regulator_ena_gpio_free(rdev); |
9259 |
+diff --git a/drivers/regulator/max8907-regulator.c b/drivers/regulator/max8907-regulator.c |
9260 |
+index 76152aaa330b..96dc0eea7659 100644 |
9261 |
+--- a/drivers/regulator/max8907-regulator.c |
9262 |
++++ b/drivers/regulator/max8907-regulator.c |
9263 |
+@@ -296,7 +296,10 @@ static int max8907_regulator_probe(struct platform_device *pdev) |
9264 |
+ memcpy(pmic->desc, max8907_regulators, sizeof(pmic->desc)); |
9265 |
+ |
9266 |
+ /* Backwards compatibility with MAX8907B; SD1 uses different voltages */ |
9267 |
+- regmap_read(max8907->regmap_gen, MAX8907_REG_II2RR, &val); |
9268 |
++ ret = regmap_read(max8907->regmap_gen, MAX8907_REG_II2RR, &val); |
9269 |
++ if (ret) |
9270 |
++ return ret; |
9271 |
++ |
9272 |
+ if ((val & MAX8907_II2RR_VERSION_MASK) == |
9273 |
+ MAX8907_II2RR_VERSION_REV_B) { |
9274 |
+ pmic->desc[MAX8907_SD1].min_uV = 637500; |
9275 |
+@@ -333,14 +336,20 @@ static int max8907_regulator_probe(struct platform_device *pdev) |
9276 |
+ } |
9277 |
+ |
9278 |
+ if (pmic->desc[i].ops == &max8907_ldo_ops) { |
9279 |
+- regmap_read(config.regmap, pmic->desc[i].enable_reg, |
9280 |
++ ret = regmap_read(config.regmap, pmic->desc[i].enable_reg, |
9281 |
+ &val); |
9282 |
++ if (ret) |
9283 |
++ return ret; |
9284 |
++ |
9285 |
+ if ((val & MAX8907_MASK_LDO_SEQ) != |
9286 |
+ MAX8907_MASK_LDO_SEQ) |
9287 |
+ pmic->desc[i].ops = &max8907_ldo_hwctl_ops; |
9288 |
+ } else if (pmic->desc[i].ops == &max8907_out5v_ops) { |
9289 |
+- regmap_read(config.regmap, pmic->desc[i].enable_reg, |
9290 |
++ ret = regmap_read(config.regmap, pmic->desc[i].enable_reg, |
9291 |
+ &val); |
9292 |
++ if (ret) |
9293 |
++ return ret; |
9294 |
++ |
9295 |
+ if ((val & (MAX8907_MASK_OUT5V_VINEN | |
9296 |
+ MAX8907_MASK_OUT5V_ENSRC)) != |
9297 |
+ MAX8907_MASK_OUT5V_ENSRC) |
9298 |
+diff --git a/drivers/soundwire/intel.c b/drivers/soundwire/intel.c |
9299 |
+index 13c54eac0cc3..d1839707128a 100644 |
9300 |
+--- a/drivers/soundwire/intel.c |
9301 |
++++ b/drivers/soundwire/intel.c |
9302 |
+@@ -479,7 +479,10 @@ intel_pdi_shim_configure(struct sdw_intel *sdw, struct sdw_cdns_pdi *pdi) |
9303 |
+ unsigned int link_id = sdw->instance; |
9304 |
+ int pdi_conf = 0; |
9305 |
+ |
9306 |
+- pdi->intel_alh_id = (link_id * 16) + pdi->num + 5; |
9307 |
++ /* the Bulk and PCM streams are not contiguous */ |
9308 |
++ pdi->intel_alh_id = (link_id * 16) + pdi->num + 3; |
9309 |
++ if (pdi->num >= 2) |
9310 |
++ pdi->intel_alh_id += 2; |
9311 |
+ |
9312 |
+ /* |
9313 |
+ * Program stream parameters to stream SHIM register |
9314 |
+@@ -508,7 +511,10 @@ intel_pdi_alh_configure(struct sdw_intel *sdw, struct sdw_cdns_pdi *pdi) |
9315 |
+ unsigned int link_id = sdw->instance; |
9316 |
+ unsigned int conf; |
9317 |
+ |
9318 |
+- pdi->intel_alh_id = (link_id * 16) + pdi->num + 5; |
9319 |
++ /* the Bulk and PCM streams are not contiguous */ |
9320 |
++ pdi->intel_alh_id = (link_id * 16) + pdi->num + 3; |
9321 |
++ if (pdi->num >= 2) |
9322 |
++ pdi->intel_alh_id += 2; |
9323 |
+ |
9324 |
+ /* Program Stream config ALH register */ |
9325 |
+ conf = intel_readl(alh, SDW_ALH_STRMZCFG(pdi->intel_alh_id)); |
9326 |
+diff --git a/drivers/spi/spi-cadence.c b/drivers/spi/spi-cadence.c |
9327 |
+index c36587b42e95..82a0ee09cbe1 100644 |
9328 |
+--- a/drivers/spi/spi-cadence.c |
9329 |
++++ b/drivers/spi/spi-cadence.c |
9330 |
+@@ -168,16 +168,16 @@ static void cdns_spi_init_hw(struct cdns_spi *xspi) |
9331 |
+ /** |
9332 |
+ * cdns_spi_chipselect - Select or deselect the chip select line |
9333 |
+ * @spi: Pointer to the spi_device structure |
9334 |
+- * @enable: Select (1) or deselect (0) the chip select line |
9335 |
++ * @is_high: Select(0) or deselect (1) the chip select line |
9336 |
+ */ |
9337 |
+-static void cdns_spi_chipselect(struct spi_device *spi, bool enable) |
9338 |
++static void cdns_spi_chipselect(struct spi_device *spi, bool is_high) |
9339 |
+ { |
9340 |
+ struct cdns_spi *xspi = spi_master_get_devdata(spi->master); |
9341 |
+ u32 ctrl_reg; |
9342 |
+ |
9343 |
+ ctrl_reg = cdns_spi_read(xspi, CDNS_SPI_CR); |
9344 |
+ |
9345 |
+- if (!enable) { |
9346 |
++ if (is_high) { |
9347 |
+ /* Deselect the slave */ |
9348 |
+ ctrl_reg |= CDNS_SPI_CR_SSCTRL; |
9349 |
+ } else { |
9350 |
+diff --git a/drivers/spi/spi-dw.c b/drivers/spi/spi-dw.c |
9351 |
+index 9a49e073e8b7..45972056ed8c 100644 |
9352 |
+--- a/drivers/spi/spi-dw.c |
9353 |
++++ b/drivers/spi/spi-dw.c |
9354 |
+@@ -129,10 +129,11 @@ void dw_spi_set_cs(struct spi_device *spi, bool enable) |
9355 |
+ struct dw_spi *dws = spi_controller_get_devdata(spi->controller); |
9356 |
+ struct chip_data *chip = spi_get_ctldata(spi); |
9357 |
+ |
9358 |
++ /* Chip select logic is inverted from spi_set_cs() */ |
9359 |
+ if (chip && chip->cs_control) |
9360 |
+- chip->cs_control(enable); |
9361 |
++ chip->cs_control(!enable); |
9362 |
+ |
9363 |
+- if (enable) |
9364 |
++ if (!enable) |
9365 |
+ dw_writel(dws, DW_SPI_SER, BIT(spi->chip_select)); |
9366 |
+ else if (dws->cs_override) |
9367 |
+ dw_writel(dws, DW_SPI_SER, 0); |
9368 |
+@@ -308,7 +309,8 @@ static int dw_spi_transfer_one(struct spi_controller *master, |
9369 |
+ cr0 = (transfer->bits_per_word - 1) |
9370 |
+ | (chip->type << SPI_FRF_OFFSET) |
9371 |
+ | ((((spi->mode & SPI_CPOL) ? 1 : 0) << SPI_SCOL_OFFSET) | |
9372 |
+- (((spi->mode & SPI_CPHA) ? 1 : 0) << SPI_SCPH_OFFSET)) |
9373 |
++ (((spi->mode & SPI_CPHA) ? 1 : 0) << SPI_SCPH_OFFSET) | |
9374 |
++ (((spi->mode & SPI_LOOP) ? 1 : 0) << SPI_SRL_OFFSET)) |
9375 |
+ | (chip->tmode << SPI_TMOD_OFFSET); |
9376 |
+ |
9377 |
+ /* |
9378 |
+diff --git a/drivers/spi/spi-fsl-spi.c b/drivers/spi/spi-fsl-spi.c |
9379 |
+index 4b80ace1d137..2d563874b4ac 100644 |
9380 |
+--- a/drivers/spi/spi-fsl-spi.c |
9381 |
++++ b/drivers/spi/spi-fsl-spi.c |
9382 |
+@@ -736,9 +736,9 @@ static int of_fsl_spi_probe(struct platform_device *ofdev) |
9383 |
+ if (ret) |
9384 |
+ goto err; |
9385 |
+ |
9386 |
+- irq = irq_of_parse_and_map(np, 0); |
9387 |
+- if (!irq) { |
9388 |
+- ret = -EINVAL; |
9389 |
++ irq = platform_get_irq(ofdev, 0); |
9390 |
++ if (irq < 0) { |
9391 |
++ ret = irq; |
9392 |
+ goto err; |
9393 |
+ } |
9394 |
+ |
9395 |
+@@ -751,7 +751,6 @@ static int of_fsl_spi_probe(struct platform_device *ofdev) |
9396 |
+ return 0; |
9397 |
+ |
9398 |
+ err: |
9399 |
+- irq_dispose_mapping(irq); |
9400 |
+ return ret; |
9401 |
+ } |
9402 |
+ |
9403 |
+diff --git a/drivers/spi/spi-gpio.c b/drivers/spi/spi-gpio.c |
9404 |
+index 1d3e23ec20a6..f9c5bbb74714 100644 |
9405 |
+--- a/drivers/spi/spi-gpio.c |
9406 |
++++ b/drivers/spi/spi-gpio.c |
9407 |
+@@ -371,8 +371,10 @@ static int spi_gpio_probe(struct platform_device *pdev) |
9408 |
+ return -ENOMEM; |
9409 |
+ |
9410 |
+ status = devm_add_action_or_reset(&pdev->dev, spi_gpio_put, master); |
9411 |
+- if (status) |
9412 |
++ if (status) { |
9413 |
++ spi_master_put(master); |
9414 |
+ return status; |
9415 |
++ } |
9416 |
+ |
9417 |
+ if (of_id) |
9418 |
+ status = spi_gpio_probe_dt(pdev, master); |
9419 |
+diff --git a/drivers/spi/spi-img-spfi.c b/drivers/spi/spi-img-spfi.c |
9420 |
+index 439b01e4a2c8..f4a8f470aecc 100644 |
9421 |
+--- a/drivers/spi/spi-img-spfi.c |
9422 |
++++ b/drivers/spi/spi-img-spfi.c |
9423 |
+@@ -673,6 +673,8 @@ static int img_spfi_probe(struct platform_device *pdev) |
9424 |
+ dma_release_channel(spfi->tx_ch); |
9425 |
+ if (spfi->rx_ch) |
9426 |
+ dma_release_channel(spfi->rx_ch); |
9427 |
++ spfi->tx_ch = NULL; |
9428 |
++ spfi->rx_ch = NULL; |
9429 |
+ dev_warn(spfi->dev, "Failed to get DMA channels, falling back to PIO mode\n"); |
9430 |
+ } else { |
9431 |
+ master->dma_tx = spfi->tx_ch; |
9432 |
+diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c |
9433 |
+index bb6a14d1ab0f..2e73d75a6ac5 100644 |
9434 |
+--- a/drivers/spi/spi-pxa2xx.c |
9435 |
++++ b/drivers/spi/spi-pxa2xx.c |
9436 |
+@@ -1565,7 +1565,13 @@ pxa2xx_spi_init_pdata(struct platform_device *pdev) |
9437 |
+ #endif |
9438 |
+ |
9439 |
+ ssp->clk = devm_clk_get(&pdev->dev, NULL); |
9440 |
++ if (IS_ERR(ssp->clk)) |
9441 |
++ return NULL; |
9442 |
++ |
9443 |
+ ssp->irq = platform_get_irq(pdev, 0); |
9444 |
++ if (ssp->irq < 0) |
9445 |
++ return NULL; |
9446 |
++ |
9447 |
+ ssp->type = type; |
9448 |
+ ssp->pdev = pdev; |
9449 |
+ ssp->port_id = pxa2xx_spi_get_port_id(adev); |
9450 |
+diff --git a/drivers/spi/spi-sifive.c b/drivers/spi/spi-sifive.c |
9451 |
+index 35254bdc42c4..f7c1e20432e0 100644 |
9452 |
+--- a/drivers/spi/spi-sifive.c |
9453 |
++++ b/drivers/spi/spi-sifive.c |
9454 |
+@@ -357,14 +357,14 @@ static int sifive_spi_probe(struct platform_device *pdev) |
9455 |
+ if (!cs_bits) { |
9456 |
+ dev_err(&pdev->dev, "Could not auto probe CS lines\n"); |
9457 |
+ ret = -EINVAL; |
9458 |
+- goto put_master; |
9459 |
++ goto disable_clk; |
9460 |
+ } |
9461 |
+ |
9462 |
+ num_cs = ilog2(cs_bits) + 1; |
9463 |
+ if (num_cs > SIFIVE_SPI_MAX_CS) { |
9464 |
+ dev_err(&pdev->dev, "Invalid number of spi slaves\n"); |
9465 |
+ ret = -EINVAL; |
9466 |
+- goto put_master; |
9467 |
++ goto disable_clk; |
9468 |
+ } |
9469 |
+ |
9470 |
+ /* Define our master */ |
9471 |
+@@ -393,7 +393,7 @@ static int sifive_spi_probe(struct platform_device *pdev) |
9472 |
+ dev_name(&pdev->dev), spi); |
9473 |
+ if (ret) { |
9474 |
+ dev_err(&pdev->dev, "Unable to bind to interrupt\n"); |
9475 |
+- goto put_master; |
9476 |
++ goto disable_clk; |
9477 |
+ } |
9478 |
+ |
9479 |
+ dev_info(&pdev->dev, "mapped; irq=%d, cs=%d\n", |
9480 |
+@@ -402,11 +402,13 @@ static int sifive_spi_probe(struct platform_device *pdev) |
9481 |
+ ret = devm_spi_register_master(&pdev->dev, master); |
9482 |
+ if (ret < 0) { |
9483 |
+ dev_err(&pdev->dev, "spi_register_master failed\n"); |
9484 |
+- goto put_master; |
9485 |
++ goto disable_clk; |
9486 |
+ } |
9487 |
+ |
9488 |
+ return 0; |
9489 |
+ |
9490 |
++disable_clk: |
9491 |
++ clk_disable_unprepare(spi->clk); |
9492 |
+ put_master: |
9493 |
+ spi_master_put(master); |
9494 |
+ |
9495 |
+@@ -420,6 +422,7 @@ static int sifive_spi_remove(struct platform_device *pdev) |
9496 |
+ |
9497 |
+ /* Disable all the interrupts just in case */ |
9498 |
+ sifive_spi_write(spi, SIFIVE_SPI_REG_IE, 0); |
9499 |
++ clk_disable_unprepare(spi->clk); |
9500 |
+ |
9501 |
+ return 0; |
9502 |
+ } |
9503 |
+diff --git a/drivers/spi/spi-sprd-adi.c b/drivers/spi/spi-sprd-adi.c |
9504 |
+index 9a051286f120..9613cfe3c0a2 100644 |
9505 |
+--- a/drivers/spi/spi-sprd-adi.c |
9506 |
++++ b/drivers/spi/spi-sprd-adi.c |
9507 |
+@@ -393,6 +393,9 @@ static int sprd_adi_restart_handler(struct notifier_block *this, |
9508 |
+ val |= BIT_WDG_RUN | BIT_WDG_RST; |
9509 |
+ sprd_adi_write(sadi, sadi->slave_pbase + REG_WDG_CTRL, val); |
9510 |
+ |
9511 |
++ /* Lock the watchdog */ |
9512 |
++ sprd_adi_write(sadi, sadi->slave_pbase + REG_WDG_LOCK, ~WDG_UNLOCK_KEY); |
9513 |
++ |
9514 |
+ mdelay(1000); |
9515 |
+ |
9516 |
+ dev_emerg(sadi->dev, "Unable to restart system\n"); |
9517 |
+diff --git a/drivers/spi/spi-st-ssc4.c b/drivers/spi/spi-st-ssc4.c |
9518 |
+index 0c24c494f386..77d26d64541a 100644 |
9519 |
+--- a/drivers/spi/spi-st-ssc4.c |
9520 |
++++ b/drivers/spi/spi-st-ssc4.c |
9521 |
+@@ -381,6 +381,7 @@ static int spi_st_probe(struct platform_device *pdev) |
9522 |
+ return 0; |
9523 |
+ |
9524 |
+ clk_disable: |
9525 |
++ pm_runtime_disable(&pdev->dev); |
9526 |
+ clk_disable_unprepare(spi_st->clk); |
9527 |
+ put_master: |
9528 |
+ spi_master_put(master); |
9529 |
+@@ -392,6 +393,8 @@ static int spi_st_remove(struct platform_device *pdev) |
9530 |
+ struct spi_master *master = platform_get_drvdata(pdev); |
9531 |
+ struct spi_st *spi_st = spi_master_get_devdata(master); |
9532 |
+ |
9533 |
++ pm_runtime_disable(&pdev->dev); |
9534 |
++ |
9535 |
+ clk_disable_unprepare(spi_st->clk); |
9536 |
+ |
9537 |
+ pinctrl_pm_select_sleep_state(&pdev->dev); |
9538 |
+diff --git a/drivers/spi/spi-tegra20-slink.c b/drivers/spi/spi-tegra20-slink.c |
9539 |
+index 111fffc91435..374a2a32edcd 100644 |
9540 |
+--- a/drivers/spi/spi-tegra20-slink.c |
9541 |
++++ b/drivers/spi/spi-tegra20-slink.c |
9542 |
+@@ -1073,7 +1073,7 @@ static int tegra_slink_probe(struct platform_device *pdev) |
9543 |
+ ret = clk_enable(tspi->clk); |
9544 |
+ if (ret < 0) { |
9545 |
+ dev_err(&pdev->dev, "Clock enable failed %d\n", ret); |
9546 |
+- goto exit_free_master; |
9547 |
++ goto exit_clk_unprepare; |
9548 |
+ } |
9549 |
+ |
9550 |
+ spi_irq = platform_get_irq(pdev, 0); |
9551 |
+@@ -1146,6 +1146,8 @@ exit_free_irq: |
9552 |
+ free_irq(spi_irq, tspi); |
9553 |
+ exit_clk_disable: |
9554 |
+ clk_disable(tspi->clk); |
9555 |
++exit_clk_unprepare: |
9556 |
++ clk_unprepare(tspi->clk); |
9557 |
+ exit_free_master: |
9558 |
+ spi_master_put(master); |
9559 |
+ return ret; |
9560 |
+@@ -1159,6 +1161,7 @@ static int tegra_slink_remove(struct platform_device *pdev) |
9561 |
+ free_irq(tspi->irq, tspi); |
9562 |
+ |
9563 |
+ clk_disable(tspi->clk); |
9564 |
++ clk_unprepare(tspi->clk); |
9565 |
+ |
9566 |
+ if (tspi->tx_dma_chan) |
9567 |
+ tegra_slink_deinit_dma_param(tspi, false); |
9568 |
+diff --git a/drivers/spi/spidev.c b/drivers/spi/spidev.c |
9569 |
+index 255786f2e844..3ea9d8a3e6e8 100644 |
9570 |
+--- a/drivers/spi/spidev.c |
9571 |
++++ b/drivers/spi/spidev.c |
9572 |
+@@ -627,6 +627,9 @@ static int spidev_release(struct inode *inode, struct file *filp) |
9573 |
+ if (dofree) |
9574 |
+ kfree(spidev); |
9575 |
+ } |
9576 |
++#ifdef CONFIG_SPI_SLAVE |
9577 |
++ spi_slave_abort(spidev->spi); |
9578 |
++#endif |
9579 |
+ mutex_unlock(&device_list_lock); |
9580 |
+ |
9581 |
+ return 0; |
9582 |
+diff --git a/drivers/staging/comedi/drivers/gsc_hpdi.c b/drivers/staging/comedi/drivers/gsc_hpdi.c |
9583 |
+index 4bdf44d82879..dc62db1ee1dd 100644 |
9584 |
+--- a/drivers/staging/comedi/drivers/gsc_hpdi.c |
9585 |
++++ b/drivers/staging/comedi/drivers/gsc_hpdi.c |
9586 |
+@@ -623,6 +623,11 @@ static int gsc_hpdi_auto_attach(struct comedi_device *dev, |
9587 |
+ dma_alloc_coherent(&pcidev->dev, DMA_BUFFER_SIZE, |
9588 |
+ &devpriv->dio_buffer_phys_addr[i], |
9589 |
+ GFP_KERNEL); |
9590 |
++ if (!devpriv->dio_buffer[i]) { |
9591 |
++ dev_warn(dev->class_dev, |
9592 |
++ "failed to allocate DMA buffer\n"); |
9593 |
++ return -ENOMEM; |
9594 |
++ } |
9595 |
+ } |
9596 |
+ /* allocate dma descriptors */ |
9597 |
+ devpriv->dma_desc = dma_alloc_coherent(&pcidev->dev, |
9598 |
+@@ -630,6 +635,11 @@ static int gsc_hpdi_auto_attach(struct comedi_device *dev, |
9599 |
+ NUM_DMA_DESCRIPTORS, |
9600 |
+ &devpriv->dma_desc_phys_addr, |
9601 |
+ GFP_KERNEL); |
9602 |
++ if (!devpriv->dma_desc) { |
9603 |
++ dev_warn(dev->class_dev, |
9604 |
++ "failed to allocate DMA descriptors\n"); |
9605 |
++ return -ENOMEM; |
9606 |
++ } |
9607 |
+ if (devpriv->dma_desc_phys_addr & 0xf) { |
9608 |
+ dev_warn(dev->class_dev, |
9609 |
+ " dma descriptors not quad-word aligned (bug)\n"); |
9610 |
+diff --git a/drivers/staging/fbtft/fbtft-core.c b/drivers/staging/fbtft/fbtft-core.c |
9611 |
+index a0a67aa517f0..61f0286fb157 100644 |
9612 |
+--- a/drivers/staging/fbtft/fbtft-core.c |
9613 |
++++ b/drivers/staging/fbtft/fbtft-core.c |
9614 |
+@@ -666,7 +666,7 @@ struct fb_info *fbtft_framebuffer_alloc(struct fbtft_display *display, |
9615 |
+ fbdefio->deferred_io = fbtft_deferred_io; |
9616 |
+ fb_deferred_io_init(info); |
9617 |
+ |
9618 |
+- strncpy(info->fix.id, dev->driver->name, 16); |
9619 |
++ snprintf(info->fix.id, sizeof(info->fix.id), "%s", dev->driver->name); |
9620 |
+ info->fix.type = FB_TYPE_PACKED_PIXELS; |
9621 |
+ info->fix.visual = FB_VISUAL_TRUECOLOR; |
9622 |
+ info->fix.xpanstep = 0; |
9623 |
+diff --git a/drivers/staging/iio/frequency/ad9834.c b/drivers/staging/iio/frequency/ad9834.c |
9624 |
+index 038d6732c3fd..23026978a5a5 100644 |
9625 |
+--- a/drivers/staging/iio/frequency/ad9834.c |
9626 |
++++ b/drivers/staging/iio/frequency/ad9834.c |
9627 |
+@@ -417,6 +417,10 @@ static int ad9834_probe(struct spi_device *spi) |
9628 |
+ st = iio_priv(indio_dev); |
9629 |
+ mutex_init(&st->lock); |
9630 |
+ st->mclk = devm_clk_get(&spi->dev, NULL); |
9631 |
++ if (IS_ERR(st->mclk)) { |
9632 |
++ ret = PTR_ERR(st->mclk); |
9633 |
++ goto error_disable_reg; |
9634 |
++ } |
9635 |
+ |
9636 |
+ ret = clk_prepare_enable(st->mclk); |
9637 |
+ if (ret) { |
9638 |
+diff --git a/drivers/staging/media/imx/imx-media-capture.c b/drivers/staging/media/imx/imx-media-capture.c |
9639 |
+index b33a07bc9105..46576e32581f 100644 |
9640 |
+--- a/drivers/staging/media/imx/imx-media-capture.c |
9641 |
++++ b/drivers/staging/media/imx/imx-media-capture.c |
9642 |
+@@ -26,6 +26,8 @@ |
9643 |
+ #include <media/imx.h> |
9644 |
+ #include "imx-media.h" |
9645 |
+ |
9646 |
++#define IMX_CAPTURE_NAME "imx-capture" |
9647 |
++ |
9648 |
+ struct capture_priv { |
9649 |
+ struct imx_media_video_dev vdev; |
9650 |
+ |
9651 |
+@@ -69,8 +71,8 @@ static int vidioc_querycap(struct file *file, void *fh, |
9652 |
+ { |
9653 |
+ struct capture_priv *priv = video_drvdata(file); |
9654 |
+ |
9655 |
+- strscpy(cap->driver, "imx-media-capture", sizeof(cap->driver)); |
9656 |
+- strscpy(cap->card, "imx-media-capture", sizeof(cap->card)); |
9657 |
++ strscpy(cap->driver, IMX_CAPTURE_NAME, sizeof(cap->driver)); |
9658 |
++ strscpy(cap->card, IMX_CAPTURE_NAME, sizeof(cap->card)); |
9659 |
+ snprintf(cap->bus_info, sizeof(cap->bus_info), |
9660 |
+ "platform:%s", priv->src_sd->name); |
9661 |
+ |
9662 |
+diff --git a/drivers/staging/media/imx/imx7-mipi-csis.c b/drivers/staging/media/imx/imx7-mipi-csis.c |
9663 |
+index 73d8354e618c..e50b1f88e25b 100644 |
9664 |
+--- a/drivers/staging/media/imx/imx7-mipi-csis.c |
9665 |
++++ b/drivers/staging/media/imx/imx7-mipi-csis.c |
9666 |
+@@ -350,6 +350,8 @@ static void mipi_csis_sw_reset(struct csi_state *state) |
9667 |
+ static int mipi_csis_phy_init(struct csi_state *state) |
9668 |
+ { |
9669 |
+ state->mipi_phy_regulator = devm_regulator_get(state->dev, "phy"); |
9670 |
++ if (IS_ERR(state->mipi_phy_regulator)) |
9671 |
++ return PTR_ERR(state->mipi_phy_regulator); |
9672 |
+ |
9673 |
+ return regulator_set_voltage(state->mipi_phy_regulator, 1000000, |
9674 |
+ 1000000); |
9675 |
+@@ -966,7 +968,10 @@ static int mipi_csis_probe(struct platform_device *pdev) |
9676 |
+ return ret; |
9677 |
+ } |
9678 |
+ |
9679 |
+- mipi_csis_phy_init(state); |
9680 |
++ ret = mipi_csis_phy_init(state); |
9681 |
++ if (ret < 0) |
9682 |
++ return ret; |
9683 |
++ |
9684 |
+ mipi_csis_phy_reset(state); |
9685 |
+ |
9686 |
+ mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
9687 |
+diff --git a/drivers/staging/media/sunxi/cedrus/cedrus.c b/drivers/staging/media/sunxi/cedrus/cedrus.c |
9688 |
+index 2d3ea8b74dfd..3439f6ad6338 100644 |
9689 |
+--- a/drivers/staging/media/sunxi/cedrus/cedrus.c |
9690 |
++++ b/drivers/staging/media/sunxi/cedrus/cedrus.c |
9691 |
+@@ -357,6 +357,8 @@ static int cedrus_probe(struct platform_device *pdev) |
9692 |
+ |
9693 |
+ dev->mdev.dev = &pdev->dev; |
9694 |
+ strscpy(dev->mdev.model, CEDRUS_NAME, sizeof(dev->mdev.model)); |
9695 |
++ strscpy(dev->mdev.bus_info, "platform:" CEDRUS_NAME, |
9696 |
++ sizeof(dev->mdev.bus_info)); |
9697 |
+ |
9698 |
+ media_device_init(&dev->mdev); |
9699 |
+ dev->mdev.ops = &cedrus_m2m_media_ops; |
9700 |
+diff --git a/drivers/staging/media/sunxi/cedrus/cedrus.h b/drivers/staging/media/sunxi/cedrus/cedrus.h |
9701 |
+index 2f017a651848..3758a1c4e2d0 100644 |
9702 |
+--- a/drivers/staging/media/sunxi/cedrus/cedrus.h |
9703 |
++++ b/drivers/staging/media/sunxi/cedrus/cedrus.h |
9704 |
+@@ -179,12 +179,16 @@ static inline dma_addr_t cedrus_buf_addr(struct vb2_buffer *buf, |
9705 |
+ static inline dma_addr_t cedrus_dst_buf_addr(struct cedrus_ctx *ctx, |
9706 |
+ int index, unsigned int plane) |
9707 |
+ { |
9708 |
+- struct vb2_buffer *buf; |
9709 |
++ struct vb2_buffer *buf = NULL; |
9710 |
++ struct vb2_queue *vq; |
9711 |
+ |
9712 |
+ if (index < 0) |
9713 |
+ return 0; |
9714 |
+ |
9715 |
+- buf = ctx->fh.m2m_ctx->cap_q_ctx.q.bufs[index]; |
9716 |
++ vq = v4l2_m2m_get_vq(ctx->fh.m2m_ctx, V4L2_BUF_TYPE_VIDEO_CAPTURE); |
9717 |
++ if (vq) |
9718 |
++ buf = vb2_get_buffer(vq, index); |
9719 |
++ |
9720 |
+ return buf ? cedrus_buf_addr(buf, &ctx->dst_fmt, plane) : 0; |
9721 |
+ } |
9722 |
+ |
9723 |
+diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_h264.c b/drivers/staging/media/sunxi/cedrus/cedrus_h264.c |
9724 |
+index d6a782703c9b..08c6c9c410cc 100644 |
9725 |
+--- a/drivers/staging/media/sunxi/cedrus/cedrus_h264.c |
9726 |
++++ b/drivers/staging/media/sunxi/cedrus/cedrus_h264.c |
9727 |
+@@ -96,7 +96,7 @@ static void cedrus_write_frame_list(struct cedrus_ctx *ctx, |
9728 |
+ const struct v4l2_ctrl_h264_decode_params *decode = run->h264.decode_params; |
9729 |
+ const struct v4l2_ctrl_h264_slice_params *slice = run->h264.slice_params; |
9730 |
+ const struct v4l2_ctrl_h264_sps *sps = run->h264.sps; |
9731 |
+- struct vb2_queue *cap_q = &ctx->fh.m2m_ctx->cap_q_ctx.q; |
9732 |
++ struct vb2_queue *cap_q; |
9733 |
+ struct cedrus_buffer *output_buf; |
9734 |
+ struct cedrus_dev *dev = ctx->dev; |
9735 |
+ unsigned long used_dpbs = 0; |
9736 |
+@@ -104,6 +104,8 @@ static void cedrus_write_frame_list(struct cedrus_ctx *ctx, |
9737 |
+ unsigned int output = 0; |
9738 |
+ unsigned int i; |
9739 |
+ |
9740 |
++ cap_q = v4l2_m2m_get_vq(ctx->fh.m2m_ctx, V4L2_BUF_TYPE_VIDEO_CAPTURE); |
9741 |
++ |
9742 |
+ memset(pic_list, 0, sizeof(pic_list)); |
9743 |
+ |
9744 |
+ for (i = 0; i < ARRAY_SIZE(decode->dpb); i++) { |
9745 |
+@@ -167,12 +169,14 @@ static void _cedrus_write_ref_list(struct cedrus_ctx *ctx, |
9746 |
+ enum cedrus_h264_sram_off sram) |
9747 |
+ { |
9748 |
+ const struct v4l2_ctrl_h264_decode_params *decode = run->h264.decode_params; |
9749 |
+- struct vb2_queue *cap_q = &ctx->fh.m2m_ctx->cap_q_ctx.q; |
9750 |
++ struct vb2_queue *cap_q; |
9751 |
+ struct cedrus_dev *dev = ctx->dev; |
9752 |
+ u8 sram_array[CEDRUS_MAX_REF_IDX]; |
9753 |
+ unsigned int i; |
9754 |
+ size_t size; |
9755 |
+ |
9756 |
++ cap_q = v4l2_m2m_get_vq(ctx->fh.m2m_ctx, V4L2_BUF_TYPE_VIDEO_CAPTURE); |
9757 |
++ |
9758 |
+ memset(sram_array, 0, sizeof(sram_array)); |
9759 |
+ |
9760 |
+ for (i = 0; i < num_ref; i++) { |
9761 |
+diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_regs.h b/drivers/staging/media/sunxi/cedrus/cedrus_regs.h |
9762 |
+index ddd29788d685..f9dd8cbf3458 100644 |
9763 |
+--- a/drivers/staging/media/sunxi/cedrus/cedrus_regs.h |
9764 |
++++ b/drivers/staging/media/sunxi/cedrus/cedrus_regs.h |
9765 |
+@@ -10,6 +10,9 @@ |
9766 |
+ #ifndef _CEDRUS_REGS_H_ |
9767 |
+ #define _CEDRUS_REGS_H_ |
9768 |
+ |
9769 |
++#define SHIFT_AND_MASK_BITS(v, h, l) \ |
9770 |
++ (((unsigned long)(v) << (l)) & GENMASK(h, l)) |
9771 |
++ |
9772 |
+ /* |
9773 |
+ * Common acronyms and contractions used in register descriptions: |
9774 |
+ * * VLD : Variable-Length Decoder |
9775 |
+@@ -37,8 +40,8 @@ |
9776 |
+ #define VE_PRIMARY_CHROMA_BUF_LEN 0xc4 |
9777 |
+ #define VE_PRIMARY_FB_LINE_STRIDE 0xc8 |
9778 |
+ |
9779 |
+-#define VE_PRIMARY_FB_LINE_STRIDE_CHROMA(s) (((s) << 16) & GENMASK(31, 16)) |
9780 |
+-#define VE_PRIMARY_FB_LINE_STRIDE_LUMA(s) (((s) << 0) & GENMASK(15, 0)) |
9781 |
++#define VE_PRIMARY_FB_LINE_STRIDE_CHROMA(s) SHIFT_AND_MASK_BITS(s, 31, 16) |
9782 |
++#define VE_PRIMARY_FB_LINE_STRIDE_LUMA(s) SHIFT_AND_MASK_BITS(s, 15, 0) |
9783 |
+ |
9784 |
+ #define VE_CHROMA_BUF_LEN 0xe8 |
9785 |
+ |
9786 |
+@@ -46,7 +49,7 @@ |
9787 |
+ #define VE_SECONDARY_OUT_FMT_EXT (0x01 << 30) |
9788 |
+ #define VE_SECONDARY_OUT_FMT_YU12 (0x02 << 30) |
9789 |
+ #define VE_SECONDARY_OUT_FMT_YV12 (0x03 << 30) |
9790 |
+-#define VE_CHROMA_BUF_LEN_SDRT(l) ((l) & GENMASK(27, 0)) |
9791 |
++#define VE_CHROMA_BUF_LEN_SDRT(l) SHIFT_AND_MASK_BITS(l, 27, 0) |
9792 |
+ |
9793 |
+ #define VE_PRIMARY_OUT_FMT 0xec |
9794 |
+ |
9795 |
+@@ -69,15 +72,15 @@ |
9796 |
+ |
9797 |
+ #define VE_DEC_MPEG_MP12HDR (VE_ENGINE_DEC_MPEG + 0x00) |
9798 |
+ |
9799 |
+-#define VE_DEC_MPEG_MP12HDR_SLICE_TYPE(t) (((t) << 28) & GENMASK(30, 28)) |
9800 |
++#define VE_DEC_MPEG_MP12HDR_SLICE_TYPE(t) SHIFT_AND_MASK_BITS(t, 30, 28) |
9801 |
+ #define VE_DEC_MPEG_MP12HDR_F_CODE_SHIFT(x, y) (24 - 4 * (y) - 8 * (x)) |
9802 |
+ #define VE_DEC_MPEG_MP12HDR_F_CODE(__x, __y, __v) \ |
9803 |
+- (((__v) & GENMASK(3, 0)) << VE_DEC_MPEG_MP12HDR_F_CODE_SHIFT(__x, __y)) |
9804 |
++ (((unsigned long)(__v) & GENMASK(3, 0)) << VE_DEC_MPEG_MP12HDR_F_CODE_SHIFT(__x, __y)) |
9805 |
+ |
9806 |
+ #define VE_DEC_MPEG_MP12HDR_INTRA_DC_PRECISION(p) \ |
9807 |
+- (((p) << 10) & GENMASK(11, 10)) |
9808 |
++ SHIFT_AND_MASK_BITS(p, 11, 10) |
9809 |
+ #define VE_DEC_MPEG_MP12HDR_INTRA_PICTURE_STRUCTURE(s) \ |
9810 |
+- (((s) << 8) & GENMASK(9, 8)) |
9811 |
++ SHIFT_AND_MASK_BITS(s, 9, 8) |
9812 |
+ #define VE_DEC_MPEG_MP12HDR_TOP_FIELD_FIRST(v) \ |
9813 |
+ ((v) ? BIT(7) : 0) |
9814 |
+ #define VE_DEC_MPEG_MP12HDR_FRAME_PRED_FRAME_DCT(v) \ |
9815 |
+@@ -98,19 +101,19 @@ |
9816 |
+ #define VE_DEC_MPEG_PICCODEDSIZE (VE_ENGINE_DEC_MPEG + 0x08) |
9817 |
+ |
9818 |
+ #define VE_DEC_MPEG_PICCODEDSIZE_WIDTH(w) \ |
9819 |
+- ((DIV_ROUND_UP((w), 16) << 8) & GENMASK(15, 8)) |
9820 |
++ SHIFT_AND_MASK_BITS(DIV_ROUND_UP((w), 16), 15, 8) |
9821 |
+ #define VE_DEC_MPEG_PICCODEDSIZE_HEIGHT(h) \ |
9822 |
+- ((DIV_ROUND_UP((h), 16) << 0) & GENMASK(7, 0)) |
9823 |
++ SHIFT_AND_MASK_BITS(DIV_ROUND_UP((h), 16), 7, 0) |
9824 |
+ |
9825 |
+ #define VE_DEC_MPEG_PICBOUNDSIZE (VE_ENGINE_DEC_MPEG + 0x0c) |
9826 |
+ |
9827 |
+-#define VE_DEC_MPEG_PICBOUNDSIZE_WIDTH(w) (((w) << 16) & GENMASK(27, 16)) |
9828 |
+-#define VE_DEC_MPEG_PICBOUNDSIZE_HEIGHT(h) (((h) << 0) & GENMASK(11, 0)) |
9829 |
++#define VE_DEC_MPEG_PICBOUNDSIZE_WIDTH(w) SHIFT_AND_MASK_BITS(w, 27, 16) |
9830 |
++#define VE_DEC_MPEG_PICBOUNDSIZE_HEIGHT(h) SHIFT_AND_MASK_BITS(h, 11, 0) |
9831 |
+ |
9832 |
+ #define VE_DEC_MPEG_MBADDR (VE_ENGINE_DEC_MPEG + 0x10) |
9833 |
+ |
9834 |
+-#define VE_DEC_MPEG_MBADDR_X(w) (((w) << 8) & GENMASK(15, 8)) |
9835 |
+-#define VE_DEC_MPEG_MBADDR_Y(h) (((h) << 0) & GENMASK(7, 0)) |
9836 |
++#define VE_DEC_MPEG_MBADDR_X(w) SHIFT_AND_MASK_BITS(w, 15, 8) |
9837 |
++#define VE_DEC_MPEG_MBADDR_Y(h) SHIFT_AND_MASK_BITS(h, 7, 0) |
9838 |
+ |
9839 |
+ #define VE_DEC_MPEG_CTRL (VE_ENGINE_DEC_MPEG + 0x14) |
9840 |
+ |
9841 |
+@@ -225,7 +228,7 @@ |
9842 |
+ #define VE_DEC_MPEG_IQMINPUT_FLAG_INTRA (0x01 << 14) |
9843 |
+ #define VE_DEC_MPEG_IQMINPUT_FLAG_NON_INTRA (0x00 << 14) |
9844 |
+ #define VE_DEC_MPEG_IQMINPUT_WEIGHT(i, v) \ |
9845 |
+- (((v) & GENMASK(7, 0)) | (((i) << 8) & GENMASK(13, 8))) |
9846 |
++ (SHIFT_AND_MASK_BITS(i, 13, 8) | SHIFT_AND_MASK_BITS(v, 7, 0)) |
9847 |
+ |
9848 |
+ #define VE_DEC_MPEG_ERROR (VE_ENGINE_DEC_MPEG + 0xc4) |
9849 |
+ #define VE_DEC_MPEG_CRTMBADDR (VE_ENGINE_DEC_MPEG + 0xc8) |
9850 |
+diff --git a/drivers/staging/mt7621-pci/Kconfig b/drivers/staging/mt7621-pci/Kconfig |
9851 |
+index af928b75a940..ce58042f2f21 100644 |
9852 |
+--- a/drivers/staging/mt7621-pci/Kconfig |
9853 |
++++ b/drivers/staging/mt7621-pci/Kconfig |
9854 |
+@@ -2,7 +2,6 @@ |
9855 |
+ config PCI_MT7621 |
9856 |
+ tristate "MediaTek MT7621 PCI Controller" |
9857 |
+ depends on RALINK |
9858 |
+- depends on PCI |
9859 |
+ select PCI_DRIVERS_GENERIC |
9860 |
+ help |
9861 |
+ This selects a driver for the MediaTek MT7621 PCI Controller. |
9862 |
+diff --git a/drivers/staging/rtl8188eu/core/rtw_xmit.c b/drivers/staging/rtl8188eu/core/rtw_xmit.c |
9863 |
+index 952f2ab51347..c37591657bac 100644 |
9864 |
+--- a/drivers/staging/rtl8188eu/core/rtw_xmit.c |
9865 |
++++ b/drivers/staging/rtl8188eu/core/rtw_xmit.c |
9866 |
+@@ -776,7 +776,7 @@ s32 rtw_make_wlanhdr(struct adapter *padapter, u8 *hdr, struct pkt_attrib *pattr |
9867 |
+ memcpy(pwlanhdr->addr2, get_bssid(pmlmepriv), ETH_ALEN); |
9868 |
+ memcpy(pwlanhdr->addr3, pattrib->src, ETH_ALEN); |
9869 |
+ |
9870 |
+- if (psta->qos_option) |
9871 |
++ if (psta && psta->qos_option) |
9872 |
+ qos_option = true; |
9873 |
+ } else if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) || |
9874 |
+ check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE)) { |
9875 |
+@@ -784,7 +784,7 @@ s32 rtw_make_wlanhdr(struct adapter *padapter, u8 *hdr, struct pkt_attrib *pattr |
9876 |
+ memcpy(pwlanhdr->addr2, pattrib->src, ETH_ALEN); |
9877 |
+ memcpy(pwlanhdr->addr3, get_bssid(pmlmepriv), ETH_ALEN); |
9878 |
+ |
9879 |
+- if (psta->qos_option) |
9880 |
++ if (psta && psta->qos_option) |
9881 |
+ qos_option = true; |
9882 |
+ } else { |
9883 |
+ RT_TRACE(_module_rtl871x_xmit_c_, _drv_err_, ("fw_state:%x is not allowed to xmit frame\n", get_fwstate(pmlmepriv))); |
9884 |
+diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c |
9885 |
+index 2821411878ce..511136dce3a4 100644 |
9886 |
+--- a/drivers/staging/rtl8192u/r8192U_core.c |
9887 |
++++ b/drivers/staging/rtl8192u/r8192U_core.c |
9888 |
+@@ -1422,7 +1422,7 @@ short rtl8192_tx(struct net_device *dev, struct sk_buff *skb) |
9889 |
+ (struct tx_fwinfo_819x_usb *)(skb->data + USB_HWDESC_HEADER_LEN); |
9890 |
+ struct usb_device *udev = priv->udev; |
9891 |
+ int pend; |
9892 |
+- int status; |
9893 |
++ int status, rt = -1; |
9894 |
+ struct urb *tx_urb = NULL, *tx_urb_zero = NULL; |
9895 |
+ unsigned int idx_pipe; |
9896 |
+ |
9897 |
+@@ -1566,8 +1566,10 @@ short rtl8192_tx(struct net_device *dev, struct sk_buff *skb) |
9898 |
+ } |
9899 |
+ if (bSend0Byte) { |
9900 |
+ tx_urb_zero = usb_alloc_urb(0, GFP_ATOMIC); |
9901 |
+- if (!tx_urb_zero) |
9902 |
+- return -ENOMEM; |
9903 |
++ if (!tx_urb_zero) { |
9904 |
++ rt = -ENOMEM; |
9905 |
++ goto error; |
9906 |
++ } |
9907 |
+ usb_fill_bulk_urb(tx_urb_zero, udev, |
9908 |
+ usb_sndbulkpipe(udev, idx_pipe), |
9909 |
+ &zero, 0, tx_zero_isr, dev); |
9910 |
+@@ -1577,7 +1579,7 @@ short rtl8192_tx(struct net_device *dev, struct sk_buff *skb) |
9911 |
+ "Error TX URB for zero byte %d, error %d", |
9912 |
+ atomic_read(&priv->tx_pending[tcb_desc->queue_index]), |
9913 |
+ status); |
9914 |
+- return -1; |
9915 |
++ goto error; |
9916 |
+ } |
9917 |
+ } |
9918 |
+ netif_trans_update(dev); |
9919 |
+@@ -1588,7 +1590,12 @@ short rtl8192_tx(struct net_device *dev, struct sk_buff *skb) |
9920 |
+ RT_TRACE(COMP_ERR, "Error TX URB %d, error %d", |
9921 |
+ atomic_read(&priv->tx_pending[tcb_desc->queue_index]), |
9922 |
+ status); |
9923 |
+- return -1; |
9924 |
++ |
9925 |
++error: |
9926 |
++ dev_kfree_skb_any(skb); |
9927 |
++ usb_free_urb(tx_urb); |
9928 |
++ usb_free_urb(tx_urb_zero); |
9929 |
++ return rt; |
9930 |
+ } |
9931 |
+ |
9932 |
+ static short rtl8192_usb_initendpoints(struct net_device *dev) |
9933 |
+diff --git a/drivers/staging/wilc1000/wilc_hif.c b/drivers/staging/wilc1000/wilc_hif.c |
9934 |
+index d3d9ea284816..77d0732f451b 100644 |
9935 |
+--- a/drivers/staging/wilc1000/wilc_hif.c |
9936 |
++++ b/drivers/staging/wilc1000/wilc_hif.c |
9937 |
+@@ -473,6 +473,8 @@ void *wilc_parse_join_bss_param(struct cfg80211_bss *bss, |
9938 |
+ rates_ie = cfg80211_find_ie(WLAN_EID_SUPP_RATES, ies->data, ies->len); |
9939 |
+ if (rates_ie) { |
9940 |
+ rates_len = rates_ie[1]; |
9941 |
++ if (rates_len > WILC_MAX_RATES_SUPPORTED) |
9942 |
++ rates_len = WILC_MAX_RATES_SUPPORTED; |
9943 |
+ param->supp_rates[0] = rates_len; |
9944 |
+ memcpy(¶m->supp_rates[1], rates_ie + 2, rates_len); |
9945 |
+ } |
9946 |
+diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c |
9947 |
+index 22f21831649b..c3cd6f389a98 100644 |
9948 |
+--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c |
9949 |
++++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c |
9950 |
+@@ -1419,8 +1419,10 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, |
9951 |
+ if (vif->iftype == WILC_AP_MODE || vif->iftype == WILC_GO_MODE) |
9952 |
+ wilc_wfi_deinit_mon_interface(wl, true); |
9953 |
+ vif->iftype = WILC_STATION_MODE; |
9954 |
+- wilc_set_operation_mode(vif, wilc_get_vif_idx(vif), |
9955 |
+- WILC_STATION_MODE, vif->idx); |
9956 |
++ |
9957 |
++ if (wl->initialized) |
9958 |
++ wilc_set_operation_mode(vif, wilc_get_vif_idx(vif), |
9959 |
++ WILC_STATION_MODE, vif->idx); |
9960 |
+ |
9961 |
+ memset(priv->assoc_stainfo.sta_associated_bss, 0, |
9962 |
+ WILC_MAX_NUM_STA * ETH_ALEN); |
9963 |
+@@ -1432,8 +1434,10 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, |
9964 |
+ priv->wdev.iftype = type; |
9965 |
+ vif->monitor_flag = 0; |
9966 |
+ vif->iftype = WILC_CLIENT_MODE; |
9967 |
+- wilc_set_operation_mode(vif, wilc_get_vif_idx(vif), |
9968 |
+- WILC_STATION_MODE, vif->idx); |
9969 |
++ |
9970 |
++ if (wl->initialized) |
9971 |
++ wilc_set_operation_mode(vif, wilc_get_vif_idx(vif), |
9972 |
++ WILC_STATION_MODE, vif->idx); |
9973 |
+ break; |
9974 |
+ |
9975 |
+ case NL80211_IFTYPE_AP: |
9976 |
+@@ -1450,8 +1454,10 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, |
9977 |
+ dev->ieee80211_ptr->iftype = type; |
9978 |
+ priv->wdev.iftype = type; |
9979 |
+ vif->iftype = WILC_GO_MODE; |
9980 |
+- wilc_set_operation_mode(vif, wilc_get_vif_idx(vif), |
9981 |
+- WILC_AP_MODE, vif->idx); |
9982 |
++ |
9983 |
++ if (wl->initialized) |
9984 |
++ wilc_set_operation_mode(vif, wilc_get_vif_idx(vif), |
9985 |
++ WILC_AP_MODE, vif->idx); |
9986 |
+ break; |
9987 |
+ |
9988 |
+ default: |
9989 |
+diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c |
9990 |
+index a8dc8af83f39..1ba9bc667e13 100644 |
9991 |
+--- a/drivers/tty/serial/atmel_serial.c |
9992 |
++++ b/drivers/tty/serial/atmel_serial.c |
9993 |
+@@ -2270,27 +2270,6 @@ static void atmel_set_termios(struct uart_port *port, struct ktermios *termios, |
9994 |
+ mode |= ATMEL_US_USMODE_NORMAL; |
9995 |
+ } |
9996 |
+ |
9997 |
+- /* set the mode, clock divisor, parity, stop bits and data size */ |
9998 |
+- atmel_uart_writel(port, ATMEL_US_MR, mode); |
9999 |
+- |
10000 |
+- /* |
10001 |
+- * when switching the mode, set the RTS line state according to the |
10002 |
+- * new mode, otherwise keep the former state |
10003 |
+- */ |
10004 |
+- if ((old_mode & ATMEL_US_USMODE) != (mode & ATMEL_US_USMODE)) { |
10005 |
+- unsigned int rts_state; |
10006 |
+- |
10007 |
+- if ((mode & ATMEL_US_USMODE) == ATMEL_US_USMODE_HWHS) { |
10008 |
+- /* let the hardware control the RTS line */ |
10009 |
+- rts_state = ATMEL_US_RTSDIS; |
10010 |
+- } else { |
10011 |
+- /* force RTS line to low level */ |
10012 |
+- rts_state = ATMEL_US_RTSEN; |
10013 |
+- } |
10014 |
+- |
10015 |
+- atmel_uart_writel(port, ATMEL_US_CR, rts_state); |
10016 |
+- } |
10017 |
+- |
10018 |
+ /* |
10019 |
+ * Set the baud rate: |
10020 |
+ * Fractional baudrate allows to setup output frequency more |
10021 |
+@@ -2317,6 +2296,28 @@ static void atmel_set_termios(struct uart_port *port, struct ktermios *termios, |
10022 |
+ |
10023 |
+ if (!(port->iso7816.flags & SER_ISO7816_ENABLED)) |
10024 |
+ atmel_uart_writel(port, ATMEL_US_BRGR, quot); |
10025 |
++ |
10026 |
++ /* set the mode, clock divisor, parity, stop bits and data size */ |
10027 |
++ atmel_uart_writel(port, ATMEL_US_MR, mode); |
10028 |
++ |
10029 |
++ /* |
10030 |
++ * when switching the mode, set the RTS line state according to the |
10031 |
++ * new mode, otherwise keep the former state |
10032 |
++ */ |
10033 |
++ if ((old_mode & ATMEL_US_USMODE) != (mode & ATMEL_US_USMODE)) { |
10034 |
++ unsigned int rts_state; |
10035 |
++ |
10036 |
++ if ((mode & ATMEL_US_USMODE) == ATMEL_US_USMODE_HWHS) { |
10037 |
++ /* let the hardware control the RTS line */ |
10038 |
++ rts_state = ATMEL_US_RTSDIS; |
10039 |
++ } else { |
10040 |
++ /* force RTS line to low level */ |
10041 |
++ rts_state = ATMEL_US_RTSEN; |
10042 |
++ } |
10043 |
++ |
10044 |
++ atmel_uart_writel(port, ATMEL_US_CR, rts_state); |
10045 |
++ } |
10046 |
++ |
10047 |
+ atmel_uart_writel(port, ATMEL_US_CR, ATMEL_US_RSTSTA | ATMEL_US_RSTRX); |
10048 |
+ atmel_uart_writel(port, ATMEL_US_CR, ATMEL_US_TXEN | ATMEL_US_RXEN); |
10049 |
+ atmel_port->tx_stopped = false; |
10050 |
+diff --git a/drivers/tty/serial/sprd_serial.c b/drivers/tty/serial/sprd_serial.c |
10051 |
+index 771d11196523..494e2672ebd7 100644 |
10052 |
+--- a/drivers/tty/serial/sprd_serial.c |
10053 |
++++ b/drivers/tty/serial/sprd_serial.c |
10054 |
+@@ -679,6 +679,9 @@ static irqreturn_t sprd_handle_irq(int irq, void *dev_id) |
10055 |
+ if (ims & SPRD_IMSR_TIMEOUT) |
10056 |
+ serial_out(port, SPRD_ICLR, SPRD_ICLR_TIMEOUT); |
10057 |
+ |
10058 |
++ if (ims & SPRD_IMSR_BREAK_DETECT) |
10059 |
++ serial_out(port, SPRD_ICLR, SPRD_IMSR_BREAK_DETECT); |
10060 |
++ |
10061 |
+ if (ims & (SPRD_IMSR_RX_FIFO_FULL | SPRD_IMSR_BREAK_DETECT | |
10062 |
+ SPRD_IMSR_TIMEOUT)) |
10063 |
+ sprd_rx(port); |
10064 |
+diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c |
10065 |
+index 3f899552f6e3..6ca40d135430 100644 |
10066 |
+--- a/drivers/usb/core/devio.c |
10067 |
++++ b/drivers/usb/core/devio.c |
10068 |
+@@ -764,8 +764,15 @@ static int claimintf(struct usb_dev_state *ps, unsigned int ifnum) |
10069 |
+ intf = usb_ifnum_to_if(dev, ifnum); |
10070 |
+ if (!intf) |
10071 |
+ err = -ENOENT; |
10072 |
+- else |
10073 |
++ else { |
10074 |
++ unsigned int old_suppress; |
10075 |
++ |
10076 |
++ /* suppress uevents while claiming interface */ |
10077 |
++ old_suppress = dev_get_uevent_suppress(&intf->dev); |
10078 |
++ dev_set_uevent_suppress(&intf->dev, 1); |
10079 |
+ err = usb_driver_claim_interface(&usbfs_driver, intf, ps); |
10080 |
++ dev_set_uevent_suppress(&intf->dev, old_suppress); |
10081 |
++ } |
10082 |
+ if (err == 0) |
10083 |
+ set_bit(ifnum, &ps->ifclaimed); |
10084 |
+ return err; |
10085 |
+@@ -785,7 +792,13 @@ static int releaseintf(struct usb_dev_state *ps, unsigned int ifnum) |
10086 |
+ if (!intf) |
10087 |
+ err = -ENOENT; |
10088 |
+ else if (test_and_clear_bit(ifnum, &ps->ifclaimed)) { |
10089 |
++ unsigned int old_suppress; |
10090 |
++ |
10091 |
++ /* suppress uevents while releasing interface */ |
10092 |
++ old_suppress = dev_get_uevent_suppress(&intf->dev); |
10093 |
++ dev_set_uevent_suppress(&intf->dev, 1); |
10094 |
+ usb_driver_release_interface(&usbfs_driver, intf); |
10095 |
++ dev_set_uevent_suppress(&intf->dev, old_suppress); |
10096 |
+ err = 0; |
10097 |
+ } |
10098 |
+ return err; |
10099 |
+diff --git a/drivers/usb/host/ehci-q.c b/drivers/usb/host/ehci-q.c |
10100 |
+index aa2f77f1506d..8a5c9b3ebe1e 100644 |
10101 |
+--- a/drivers/usb/host/ehci-q.c |
10102 |
++++ b/drivers/usb/host/ehci-q.c |
10103 |
+@@ -27,6 +27,10 @@ |
10104 |
+ |
10105 |
+ /*-------------------------------------------------------------------------*/ |
10106 |
+ |
10107 |
++/* PID Codes that are used here, from EHCI specification, Table 3-16. */ |
10108 |
++#define PID_CODE_IN 1 |
10109 |
++#define PID_CODE_SETUP 2 |
10110 |
++ |
10111 |
+ /* fill a qtd, returning how much of the buffer we were able to queue up */ |
10112 |
+ |
10113 |
+ static int |
10114 |
+@@ -190,7 +194,7 @@ static int qtd_copy_status ( |
10115 |
+ int status = -EINPROGRESS; |
10116 |
+ |
10117 |
+ /* count IN/OUT bytes, not SETUP (even short packets) */ |
10118 |
+- if (likely (QTD_PID (token) != 2)) |
10119 |
++ if (likely(QTD_PID(token) != PID_CODE_SETUP)) |
10120 |
+ urb->actual_length += length - QTD_LENGTH (token); |
10121 |
+ |
10122 |
+ /* don't modify error codes */ |
10123 |
+@@ -206,6 +210,13 @@ static int qtd_copy_status ( |
10124 |
+ if (token & QTD_STS_BABBLE) { |
10125 |
+ /* FIXME "must" disable babbling device's port too */ |
10126 |
+ status = -EOVERFLOW; |
10127 |
++ /* |
10128 |
++ * When MMF is active and PID Code is IN, queue is halted. |
10129 |
++ * EHCI Specification, Table 4-13. |
10130 |
++ */ |
10131 |
++ } else if ((token & QTD_STS_MMF) && |
10132 |
++ (QTD_PID(token) == PID_CODE_IN)) { |
10133 |
++ status = -EPROTO; |
10134 |
+ /* CERR nonzero + halt --> stall */ |
10135 |
+ } else if (QTD_CERR(token)) { |
10136 |
+ status = -EPIPE; |
10137 |
+diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c |
10138 |
+index 1904ef56f61c..4917c5b033fa 100644 |
10139 |
+--- a/drivers/usb/host/xhci-pci.c |
10140 |
++++ b/drivers/usb/host/xhci-pci.c |
10141 |
+@@ -48,6 +48,7 @@ |
10142 |
+ #define PCI_DEVICE_ID_INTEL_TITAN_RIDGE_2C_XHCI 0x15e9 |
10143 |
+ #define PCI_DEVICE_ID_INTEL_TITAN_RIDGE_4C_XHCI 0x15ec |
10144 |
+ #define PCI_DEVICE_ID_INTEL_TITAN_RIDGE_DD_XHCI 0x15f0 |
10145 |
++#define PCI_DEVICE_ID_INTEL_ICE_LAKE_XHCI 0x8a13 |
10146 |
+ |
10147 |
+ #define PCI_DEVICE_ID_AMD_PROMONTORYA_4 0x43b9 |
10148 |
+ #define PCI_DEVICE_ID_AMD_PROMONTORYA_3 0x43ba |
10149 |
+@@ -212,7 +213,8 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) |
10150 |
+ pdev->device == PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_C_4C_XHCI || |
10151 |
+ pdev->device == PCI_DEVICE_ID_INTEL_TITAN_RIDGE_2C_XHCI || |
10152 |
+ pdev->device == PCI_DEVICE_ID_INTEL_TITAN_RIDGE_4C_XHCI || |
10153 |
+- pdev->device == PCI_DEVICE_ID_INTEL_TITAN_RIDGE_DD_XHCI)) |
10154 |
++ pdev->device == PCI_DEVICE_ID_INTEL_TITAN_RIDGE_DD_XHCI || |
10155 |
++ pdev->device == PCI_DEVICE_ID_INTEL_ICE_LAKE_XHCI)) |
10156 |
+ xhci->quirks |= XHCI_DEFAULT_PM_RUNTIME_ALLOW; |
10157 |
+ |
10158 |
+ if (pdev->vendor == PCI_VENDOR_ID_ETRON && |
10159 |
+@@ -517,7 +519,6 @@ static int xhci_pci_resume(struct usb_hcd *hcd, bool hibernated) |
10160 |
+ retval = xhci_resume(xhci, hibernated); |
10161 |
+ return retval; |
10162 |
+ } |
10163 |
+-#endif /* CONFIG_PM */ |
10164 |
+ |
10165 |
+ static void xhci_pci_shutdown(struct usb_hcd *hcd) |
10166 |
+ { |
10167 |
+@@ -530,6 +531,7 @@ static void xhci_pci_shutdown(struct usb_hcd *hcd) |
10168 |
+ if (xhci->quirks & XHCI_SPURIOUS_WAKEUP) |
10169 |
+ pci_set_power_state(pdev, PCI_D3hot); |
10170 |
+ } |
10171 |
++#endif /* CONFIG_PM */ |
10172 |
+ |
10173 |
+ /*-------------------------------------------------------------------------*/ |
10174 |
+ |
10175 |
+diff --git a/drivers/usb/renesas_usbhs/common.h b/drivers/usb/renesas_usbhs/common.h |
10176 |
+index 0824099b905e..ef1735d014da 100644 |
10177 |
+--- a/drivers/usb/renesas_usbhs/common.h |
10178 |
++++ b/drivers/usb/renesas_usbhs/common.h |
10179 |
+@@ -161,11 +161,12 @@ struct usbhs_priv; |
10180 |
+ #define VBSTS (1 << 7) /* VBUS_0 and VBUSIN_0 Input Status */ |
10181 |
+ #define VALID (1 << 3) /* USB Request Receive */ |
10182 |
+ |
10183 |
+-#define DVSQ_MASK (0x3 << 4) /* Device State */ |
10184 |
++#define DVSQ_MASK (0x7 << 4) /* Device State */ |
10185 |
+ #define POWER_STATE (0 << 4) |
10186 |
+ #define DEFAULT_STATE (1 << 4) |
10187 |
+ #define ADDRESS_STATE (2 << 4) |
10188 |
+ #define CONFIGURATION_STATE (3 << 4) |
10189 |
++#define SUSPENDED_STATE (4 << 4) |
10190 |
+ |
10191 |
+ #define CTSQ_MASK (0x7) /* Control Transfer Stage */ |
10192 |
+ #define IDLE_SETUP_STAGE 0 /* Idle stage or setup stage */ |
10193 |
+diff --git a/drivers/usb/renesas_usbhs/mod_gadget.c b/drivers/usb/renesas_usbhs/mod_gadget.c |
10194 |
+index cd38d74b3223..53489cafecc1 100644 |
10195 |
+--- a/drivers/usb/renesas_usbhs/mod_gadget.c |
10196 |
++++ b/drivers/usb/renesas_usbhs/mod_gadget.c |
10197 |
+@@ -457,12 +457,18 @@ static int usbhsg_irq_dev_state(struct usbhs_priv *priv, |
10198 |
+ { |
10199 |
+ struct usbhsg_gpriv *gpriv = usbhsg_priv_to_gpriv(priv); |
10200 |
+ struct device *dev = usbhsg_gpriv_to_dev(gpriv); |
10201 |
++ int state = usbhs_status_get_device_state(irq_state); |
10202 |
+ |
10203 |
+ gpriv->gadget.speed = usbhs_bus_get_speed(priv); |
10204 |
+ |
10205 |
+- dev_dbg(dev, "state = %x : speed : %d\n", |
10206 |
+- usbhs_status_get_device_state(irq_state), |
10207 |
+- gpriv->gadget.speed); |
10208 |
++ dev_dbg(dev, "state = %x : speed : %d\n", state, gpriv->gadget.speed); |
10209 |
++ |
10210 |
++ if (gpriv->gadget.speed != USB_SPEED_UNKNOWN && |
10211 |
++ (state & SUSPENDED_STATE)) { |
10212 |
++ if (gpriv->driver && gpriv->driver->suspend) |
10213 |
++ gpriv->driver->suspend(&gpriv->gadget); |
10214 |
++ usb_gadget_set_state(&gpriv->gadget, USB_STATE_SUSPENDED); |
10215 |
++ } |
10216 |
+ |
10217 |
+ return 0; |
10218 |
+ } |
10219 |
+diff --git a/drivers/usb/usbip/usbip_common.c b/drivers/usb/usbip/usbip_common.c |
10220 |
+index 6532d68e8808..e4b96674c405 100644 |
10221 |
+--- a/drivers/usb/usbip/usbip_common.c |
10222 |
++++ b/drivers/usb/usbip/usbip_common.c |
10223 |
+@@ -727,6 +727,9 @@ int usbip_recv_xbuff(struct usbip_device *ud, struct urb *urb) |
10224 |
+ |
10225 |
+ copy -= recv; |
10226 |
+ ret += recv; |
10227 |
++ |
10228 |
++ if (!copy) |
10229 |
++ break; |
10230 |
+ } |
10231 |
+ |
10232 |
+ if (ret != size) |
10233 |
+diff --git a/drivers/usb/usbip/vhci_rx.c b/drivers/usb/usbip/vhci_rx.c |
10234 |
+index 33f8972ba842..00fc98741c5d 100644 |
10235 |
+--- a/drivers/usb/usbip/vhci_rx.c |
10236 |
++++ b/drivers/usb/usbip/vhci_rx.c |
10237 |
+@@ -77,16 +77,21 @@ static void vhci_recv_ret_submit(struct vhci_device *vdev, |
10238 |
+ usbip_pack_pdu(pdu, urb, USBIP_RET_SUBMIT, 0); |
10239 |
+ |
10240 |
+ /* recv transfer buffer */ |
10241 |
+- if (usbip_recv_xbuff(ud, urb) < 0) |
10242 |
+- return; |
10243 |
++ if (usbip_recv_xbuff(ud, urb) < 0) { |
10244 |
++ urb->status = -EPROTO; |
10245 |
++ goto error; |
10246 |
++ } |
10247 |
+ |
10248 |
+ /* recv iso_packet_descriptor */ |
10249 |
+- if (usbip_recv_iso(ud, urb) < 0) |
10250 |
+- return; |
10251 |
++ if (usbip_recv_iso(ud, urb) < 0) { |
10252 |
++ urb->status = -EPROTO; |
10253 |
++ goto error; |
10254 |
++ } |
10255 |
+ |
10256 |
+ /* restore the padding in iso packets */ |
10257 |
+ usbip_pad_iso(ud, urb); |
10258 |
+ |
10259 |
++error: |
10260 |
+ if (usbip_dbg_flag_vhci_rx) |
10261 |
+ usbip_dump_urb(urb); |
10262 |
+ |
10263 |
+diff --git a/drivers/xen/Kconfig b/drivers/xen/Kconfig |
10264 |
+index 79cc75096f42..a50dadd01093 100644 |
10265 |
+--- a/drivers/xen/Kconfig |
10266 |
++++ b/drivers/xen/Kconfig |
10267 |
+@@ -141,7 +141,8 @@ config XEN_GNTDEV |
10268 |
+ |
10269 |
+ config XEN_GNTDEV_DMABUF |
10270 |
+ bool "Add support for dma-buf grant access device driver extension" |
10271 |
+- depends on XEN_GNTDEV && XEN_GRANT_DMA_ALLOC && DMA_SHARED_BUFFER |
10272 |
++ depends on XEN_GNTDEV && XEN_GRANT_DMA_ALLOC |
10273 |
++ select DMA_SHARED_BUFFER |
10274 |
+ help |
10275 |
+ Allows userspace processes and kernel modules to use Xen backed |
10276 |
+ dma-buf implementation. With this extension grant references to |
10277 |
+diff --git a/fs/btrfs/async-thread.c b/fs/btrfs/async-thread.c |
10278 |
+index 2e9e13ffbd08..10a04b99798a 100644 |
10279 |
+--- a/fs/btrfs/async-thread.c |
10280 |
++++ b/fs/btrfs/async-thread.c |
10281 |
+@@ -252,16 +252,17 @@ out: |
10282 |
+ } |
10283 |
+ } |
10284 |
+ |
10285 |
+-static void run_ordered_work(struct __btrfs_workqueue *wq) |
10286 |
++static void run_ordered_work(struct __btrfs_workqueue *wq, |
10287 |
++ struct btrfs_work *self) |
10288 |
+ { |
10289 |
+ struct list_head *list = &wq->ordered_list; |
10290 |
+ struct btrfs_work *work; |
10291 |
+ spinlock_t *lock = &wq->list_lock; |
10292 |
+ unsigned long flags; |
10293 |
++ void *wtag; |
10294 |
++ bool free_self = false; |
10295 |
+ |
10296 |
+ while (1) { |
10297 |
+- void *wtag; |
10298 |
+- |
10299 |
+ spin_lock_irqsave(lock, flags); |
10300 |
+ if (list_empty(list)) |
10301 |
+ break; |
10302 |
+@@ -287,16 +288,47 @@ static void run_ordered_work(struct __btrfs_workqueue *wq) |
10303 |
+ list_del(&work->ordered_list); |
10304 |
+ spin_unlock_irqrestore(lock, flags); |
10305 |
+ |
10306 |
+- /* |
10307 |
+- * We don't want to call the ordered free functions with the |
10308 |
+- * lock held though. Save the work as tag for the trace event, |
10309 |
+- * because the callback could free the structure. |
10310 |
+- */ |
10311 |
+- wtag = work; |
10312 |
+- work->ordered_free(work); |
10313 |
+- trace_btrfs_all_work_done(wq->fs_info, wtag); |
10314 |
++ if (work == self) { |
10315 |
++ /* |
10316 |
++ * This is the work item that the worker is currently |
10317 |
++ * executing. |
10318 |
++ * |
10319 |
++ * The kernel workqueue code guarantees non-reentrancy |
10320 |
++ * of work items. I.e., if a work item with the same |
10321 |
++ * address and work function is queued twice, the second |
10322 |
++ * execution is blocked until the first one finishes. A |
10323 |
++ * work item may be freed and recycled with the same |
10324 |
++ * work function; the workqueue code assumes that the |
10325 |
++ * original work item cannot depend on the recycled work |
10326 |
++ * item in that case (see find_worker_executing_work()). |
10327 |
++ * |
10328 |
++ * Note that the work of one Btrfs filesystem may depend |
10329 |
++ * on the work of another Btrfs filesystem via, e.g., a |
10330 |
++ * loop device. Therefore, we must not allow the current |
10331 |
++ * work item to be recycled until we are really done, |
10332 |
++ * otherwise we break the above assumption and can |
10333 |
++ * deadlock. |
10334 |
++ */ |
10335 |
++ free_self = true; |
10336 |
++ } else { |
10337 |
++ /* |
10338 |
++ * We don't want to call the ordered free functions with |
10339 |
++ * the lock held though. Save the work as tag for the |
10340 |
++ * trace event, because the callback could free the |
10341 |
++ * structure. |
10342 |
++ */ |
10343 |
++ wtag = work; |
10344 |
++ work->ordered_free(work); |
10345 |
++ trace_btrfs_all_work_done(wq->fs_info, wtag); |
10346 |
++ } |
10347 |
+ } |
10348 |
+ spin_unlock_irqrestore(lock, flags); |
10349 |
++ |
10350 |
++ if (free_self) { |
10351 |
++ wtag = self; |
10352 |
++ self->ordered_free(self); |
10353 |
++ trace_btrfs_all_work_done(wq->fs_info, wtag); |
10354 |
++ } |
10355 |
+ } |
10356 |
+ |
10357 |
+ static void normal_work_helper(struct btrfs_work *work) |
10358 |
+@@ -324,7 +356,7 @@ static void normal_work_helper(struct btrfs_work *work) |
10359 |
+ work->func(work); |
10360 |
+ if (need_order) { |
10361 |
+ set_bit(WORK_DONE_BIT, &work->flags); |
10362 |
+- run_ordered_work(wq); |
10363 |
++ run_ordered_work(wq, work); |
10364 |
+ } |
10365 |
+ if (!need_order) |
10366 |
+ trace_btrfs_all_work_done(wq->fs_info, wtag); |
10367 |
+diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c |
10368 |
+index e59cde204b2f..da9b0f060a9d 100644 |
10369 |
+--- a/fs/btrfs/ctree.c |
10370 |
++++ b/fs/btrfs/ctree.c |
10371 |
+@@ -383,7 +383,7 @@ void btrfs_put_tree_mod_seq(struct btrfs_fs_info *fs_info, |
10372 |
+ for (node = rb_first(tm_root); node; node = next) { |
10373 |
+ next = rb_next(node); |
10374 |
+ tm = rb_entry(node, struct tree_mod_elem, node); |
10375 |
+- if (tm->seq > min_seq) |
10376 |
++ if (tm->seq >= min_seq) |
10377 |
+ continue; |
10378 |
+ rb_erase(node, tm_root); |
10379 |
+ kfree(tm); |
10380 |
+diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h |
10381 |
+index fe2b8765d9e6..5e9f80b28fcf 100644 |
10382 |
+--- a/fs/btrfs/ctree.h |
10383 |
++++ b/fs/btrfs/ctree.h |
10384 |
+@@ -2785,7 +2785,7 @@ struct btrfs_inode_extref *btrfs_find_name_in_ext_backref( |
10385 |
+ /* file-item.c */ |
10386 |
+ struct btrfs_dio_private; |
10387 |
+ int btrfs_del_csums(struct btrfs_trans_handle *trans, |
10388 |
+- struct btrfs_fs_info *fs_info, u64 bytenr, u64 len); |
10389 |
++ struct btrfs_root *root, u64 bytenr, u64 len); |
10390 |
+ blk_status_t btrfs_lookup_bio_sums(struct inode *inode, struct bio *bio, |
10391 |
+ u8 *dst); |
10392 |
+ blk_status_t btrfs_lookup_bio_sums_dio(struct inode *inode, struct bio *bio, |
10393 |
+diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c |
10394 |
+index 402b61bf345c..3895c21853cc 100644 |
10395 |
+--- a/fs/btrfs/disk-io.c |
10396 |
++++ b/fs/btrfs/disk-io.c |
10397 |
+@@ -1657,8 +1657,8 @@ static void end_workqueue_fn(struct btrfs_work *work) |
10398 |
+ bio->bi_status = end_io_wq->status; |
10399 |
+ bio->bi_private = end_io_wq->private; |
10400 |
+ bio->bi_end_io = end_io_wq->end_io; |
10401 |
+- kmem_cache_free(btrfs_end_io_wq_cache, end_io_wq); |
10402 |
+ bio_endio(bio); |
10403 |
++ kmem_cache_free(btrfs_end_io_wq_cache, end_io_wq); |
10404 |
+ } |
10405 |
+ |
10406 |
+ static int cleaner_kthread(void *arg) |
10407 |
+diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c |
10408 |
+index 49cb26fa7c63..eb95ed78a18e 100644 |
10409 |
+--- a/fs/btrfs/extent-tree.c |
10410 |
++++ b/fs/btrfs/extent-tree.c |
10411 |
+@@ -1848,8 +1848,8 @@ static int cleanup_ref_head(struct btrfs_trans_handle *trans, |
10412 |
+ btrfs_pin_extent(fs_info, head->bytenr, |
10413 |
+ head->num_bytes, 1); |
10414 |
+ if (head->is_data) { |
10415 |
+- ret = btrfs_del_csums(trans, fs_info, head->bytenr, |
10416 |
+- head->num_bytes); |
10417 |
++ ret = btrfs_del_csums(trans, fs_info->csum_root, |
10418 |
++ head->bytenr, head->num_bytes); |
10419 |
+ } |
10420 |
+ } |
10421 |
+ |
10422 |
+@@ -3155,7 +3155,8 @@ static int __btrfs_free_extent(struct btrfs_trans_handle *trans, |
10423 |
+ btrfs_release_path(path); |
10424 |
+ |
10425 |
+ if (is_data) { |
10426 |
+- ret = btrfs_del_csums(trans, info, bytenr, num_bytes); |
10427 |
++ ret = btrfs_del_csums(trans, info->csum_root, bytenr, |
10428 |
++ num_bytes); |
10429 |
+ if (ret) { |
10430 |
+ btrfs_abort_transaction(trans, ret); |
10431 |
+ goto out; |
10432 |
+diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c |
10433 |
+index 4905f48587df..be9dc78aa727 100644 |
10434 |
+--- a/fs/btrfs/extent_io.c |
10435 |
++++ b/fs/btrfs/extent_io.c |
10436 |
+@@ -5066,12 +5066,14 @@ struct extent_buffer *alloc_test_extent_buffer(struct btrfs_fs_info *fs_info, |
10437 |
+ return eb; |
10438 |
+ eb = alloc_dummy_extent_buffer(fs_info, start); |
10439 |
+ if (!eb) |
10440 |
+- return NULL; |
10441 |
++ return ERR_PTR(-ENOMEM); |
10442 |
+ eb->fs_info = fs_info; |
10443 |
+ again: |
10444 |
+ ret = radix_tree_preload(GFP_NOFS); |
10445 |
+- if (ret) |
10446 |
++ if (ret) { |
10447 |
++ exists = ERR_PTR(ret); |
10448 |
+ goto free_eb; |
10449 |
++ } |
10450 |
+ spin_lock(&fs_info->buffer_lock); |
10451 |
+ ret = radix_tree_insert(&fs_info->buffer_radix, |
10452 |
+ start >> PAGE_SHIFT, eb); |
10453 |
+diff --git a/fs/btrfs/file-item.c b/fs/btrfs/file-item.c |
10454 |
+index 1a599f50837b..c878bc25d046 100644 |
10455 |
+--- a/fs/btrfs/file-item.c |
10456 |
++++ b/fs/btrfs/file-item.c |
10457 |
+@@ -590,9 +590,9 @@ static noinline void truncate_one_csum(struct btrfs_fs_info *fs_info, |
10458 |
+ * range of bytes. |
10459 |
+ */ |
10460 |
+ int btrfs_del_csums(struct btrfs_trans_handle *trans, |
10461 |
+- struct btrfs_fs_info *fs_info, u64 bytenr, u64 len) |
10462 |
++ struct btrfs_root *root, u64 bytenr, u64 len) |
10463 |
+ { |
10464 |
+- struct btrfs_root *root = fs_info->csum_root; |
10465 |
++ struct btrfs_fs_info *fs_info = trans->fs_info; |
10466 |
+ struct btrfs_path *path; |
10467 |
+ struct btrfs_key key; |
10468 |
+ u64 end_byte = bytenr + len; |
10469 |
+@@ -602,6 +602,9 @@ int btrfs_del_csums(struct btrfs_trans_handle *trans, |
10470 |
+ u16 csum_size = btrfs_super_csum_size(fs_info->super_copy); |
10471 |
+ int blocksize_bits = fs_info->sb->s_blocksize_bits; |
10472 |
+ |
10473 |
++ ASSERT(root == fs_info->csum_root || |
10474 |
++ root->root_key.objectid == BTRFS_TREE_LOG_OBJECTID); |
10475 |
++ |
10476 |
+ path = btrfs_alloc_path(); |
10477 |
+ if (!path) |
10478 |
+ return -ENOMEM; |
10479 |
+diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c |
10480 |
+index 10a01dd0c4e6..e5758f62e8d8 100644 |
10481 |
+--- a/fs/btrfs/inode.c |
10482 |
++++ b/fs/btrfs/inode.c |
10483 |
+@@ -5697,7 +5697,6 @@ static void inode_tree_add(struct inode *inode) |
10484 |
+ |
10485 |
+ static void inode_tree_del(struct inode *inode) |
10486 |
+ { |
10487 |
+- struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb); |
10488 |
+ struct btrfs_root *root = BTRFS_I(inode)->root; |
10489 |
+ int empty = 0; |
10490 |
+ |
10491 |
+@@ -5710,7 +5709,6 @@ static void inode_tree_del(struct inode *inode) |
10492 |
+ spin_unlock(&root->inode_lock); |
10493 |
+ |
10494 |
+ if (empty && btrfs_root_refs(&root->root_item) == 0) { |
10495 |
+- synchronize_srcu(&fs_info->subvol_srcu); |
10496 |
+ spin_lock(&root->inode_lock); |
10497 |
+ empty = RB_EMPTY_ROOT(&root->inode_tree); |
10498 |
+ spin_unlock(&root->inode_lock); |
10499 |
+@@ -9535,9 +9533,8 @@ static int btrfs_rename_exchange(struct inode *old_dir, |
10500 |
+ btrfs_init_log_ctx(&ctx_dest, new_inode); |
10501 |
+ |
10502 |
+ /* close the race window with snapshot create/destroy ioctl */ |
10503 |
+- if (old_ino == BTRFS_FIRST_FREE_OBJECTID) |
10504 |
+- down_read(&fs_info->subvol_sem); |
10505 |
+- if (new_ino == BTRFS_FIRST_FREE_OBJECTID) |
10506 |
++ if (old_ino == BTRFS_FIRST_FREE_OBJECTID || |
10507 |
++ new_ino == BTRFS_FIRST_FREE_OBJECTID) |
10508 |
+ down_read(&fs_info->subvol_sem); |
10509 |
+ |
10510 |
+ /* |
10511 |
+@@ -9771,9 +9768,8 @@ out_fail: |
10512 |
+ ret = ret ? ret : ret2; |
10513 |
+ } |
10514 |
+ out_notrans: |
10515 |
+- if (new_ino == BTRFS_FIRST_FREE_OBJECTID) |
10516 |
+- up_read(&fs_info->subvol_sem); |
10517 |
+- if (old_ino == BTRFS_FIRST_FREE_OBJECTID) |
10518 |
++ if (new_ino == BTRFS_FIRST_FREE_OBJECTID || |
10519 |
++ old_ino == BTRFS_FIRST_FREE_OBJECTID) |
10520 |
+ up_read(&fs_info->subvol_sem); |
10521 |
+ |
10522 |
+ ASSERT(list_empty(&ctx_root.list)); |
10523 |
+diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c |
10524 |
+index 23272d9154f3..a56dcc0c9c2a 100644 |
10525 |
+--- a/fs/btrfs/ioctl.c |
10526 |
++++ b/fs/btrfs/ioctl.c |
10527 |
+@@ -705,11 +705,17 @@ static noinline int create_subvol(struct inode *dir, |
10528 |
+ |
10529 |
+ btrfs_i_size_write(BTRFS_I(dir), dir->i_size + namelen * 2); |
10530 |
+ ret = btrfs_update_inode(trans, root, dir); |
10531 |
+- BUG_ON(ret); |
10532 |
++ if (ret) { |
10533 |
++ btrfs_abort_transaction(trans, ret); |
10534 |
++ goto fail; |
10535 |
++ } |
10536 |
+ |
10537 |
+ ret = btrfs_add_root_ref(trans, objectid, root->root_key.objectid, |
10538 |
+ btrfs_ino(BTRFS_I(dir)), index, name, namelen); |
10539 |
+- BUG_ON(ret); |
10540 |
++ if (ret) { |
10541 |
++ btrfs_abort_transaction(trans, ret); |
10542 |
++ goto fail; |
10543 |
++ } |
10544 |
+ |
10545 |
+ ret = btrfs_uuid_tree_add(trans, root_item->uuid, |
10546 |
+ BTRFS_UUID_KEY_SUBVOL, objectid); |
10547 |
+diff --git a/fs/btrfs/reada.c b/fs/btrfs/reada.c |
10548 |
+index ee6f60547a8d..dd4f9c2b7107 100644 |
10549 |
+--- a/fs/btrfs/reada.c |
10550 |
++++ b/fs/btrfs/reada.c |
10551 |
+@@ -752,21 +752,19 @@ static int reada_start_machine_dev(struct btrfs_device *dev) |
10552 |
+ static void reada_start_machine_worker(struct btrfs_work *work) |
10553 |
+ { |
10554 |
+ struct reada_machine_work *rmw; |
10555 |
+- struct btrfs_fs_info *fs_info; |
10556 |
+ int old_ioprio; |
10557 |
+ |
10558 |
+ rmw = container_of(work, struct reada_machine_work, work); |
10559 |
+- fs_info = rmw->fs_info; |
10560 |
+- |
10561 |
+- kfree(rmw); |
10562 |
+ |
10563 |
+ old_ioprio = IOPRIO_PRIO_VALUE(task_nice_ioclass(current), |
10564 |
+ task_nice_ioprio(current)); |
10565 |
+ set_task_ioprio(current, BTRFS_IOPRIO_READA); |
10566 |
+- __reada_start_machine(fs_info); |
10567 |
++ __reada_start_machine(rmw->fs_info); |
10568 |
+ set_task_ioprio(current, old_ioprio); |
10569 |
+ |
10570 |
+- atomic_dec(&fs_info->reada_works_cnt); |
10571 |
++ atomic_dec(&rmw->fs_info->reada_works_cnt); |
10572 |
++ |
10573 |
++ kfree(rmw); |
10574 |
+ } |
10575 |
+ |
10576 |
+ static void __reada_start_machine(struct btrfs_fs_info *fs_info) |
10577 |
+diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c |
10578 |
+index 5cd42b66818c..fd0f4c1696c8 100644 |
10579 |
+--- a/fs/btrfs/relocation.c |
10580 |
++++ b/fs/btrfs/relocation.c |
10581 |
+@@ -4555,6 +4555,7 @@ int btrfs_recover_relocation(struct btrfs_root *root) |
10582 |
+ fs_root = read_fs_root(fs_info, reloc_root->root_key.offset); |
10583 |
+ if (IS_ERR(fs_root)) { |
10584 |
+ err = PTR_ERR(fs_root); |
10585 |
++ list_add_tail(&reloc_root->root_list, &reloc_roots); |
10586 |
+ goto out_free; |
10587 |
+ } |
10588 |
+ |
10589 |
+diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c |
10590 |
+index f7d4e03f4c5d..a0770a6aee00 100644 |
10591 |
+--- a/fs/btrfs/scrub.c |
10592 |
++++ b/fs/btrfs/scrub.c |
10593 |
+@@ -2149,14 +2149,13 @@ static void scrub_missing_raid56_worker(struct btrfs_work *work) |
10594 |
+ scrub_write_block_to_dev_replace(sblock); |
10595 |
+ } |
10596 |
+ |
10597 |
+- scrub_block_put(sblock); |
10598 |
+- |
10599 |
+ if (sctx->is_dev_replace && sctx->flush_all_writes) { |
10600 |
+ mutex_lock(&sctx->wr_lock); |
10601 |
+ scrub_wr_submit(sctx); |
10602 |
+ mutex_unlock(&sctx->wr_lock); |
10603 |
+ } |
10604 |
+ |
10605 |
++ scrub_block_put(sblock); |
10606 |
+ scrub_pending_bio_dec(sctx); |
10607 |
+ } |
10608 |
+ |
10609 |
+diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c |
10610 |
+index 518ec1265a0c..3eb0fec2488a 100644 |
10611 |
+--- a/fs/btrfs/send.c |
10612 |
++++ b/fs/btrfs/send.c |
10613 |
+@@ -7075,12 +7075,6 @@ long btrfs_ioctl_send(struct file *mnt_file, struct btrfs_ioctl_send_args *arg) |
10614 |
+ send_root->send_in_progress++; |
10615 |
+ spin_unlock(&send_root->root_item_lock); |
10616 |
+ |
10617 |
+- /* |
10618 |
+- * This is done when we lookup the root, it should already be complete |
10619 |
+- * by the time we get here. |
10620 |
+- */ |
10621 |
+- WARN_ON(send_root->orphan_cleanup_state != ORPHAN_CLEANUP_DONE); |
10622 |
+- |
10623 |
+ /* |
10624 |
+ * Userspace tools do the checks and warn the user if it's |
10625 |
+ * not RO. |
10626 |
+diff --git a/fs/btrfs/tests/free-space-tree-tests.c b/fs/btrfs/tests/free-space-tree-tests.c |
10627 |
+index bc92df977630..6e774d055402 100644 |
10628 |
+--- a/fs/btrfs/tests/free-space-tree-tests.c |
10629 |
++++ b/fs/btrfs/tests/free-space-tree-tests.c |
10630 |
+@@ -463,9 +463,9 @@ static int run_test(test_func_t test_func, int bitmaps, u32 sectorsize, |
10631 |
+ root->fs_info->tree_root = root; |
10632 |
+ |
10633 |
+ root->node = alloc_test_extent_buffer(root->fs_info, nodesize); |
10634 |
+- if (!root->node) { |
10635 |
++ if (IS_ERR(root->node)) { |
10636 |
+ test_std_err(TEST_ALLOC_EXTENT_BUFFER); |
10637 |
+- ret = -ENOMEM; |
10638 |
++ ret = PTR_ERR(root->node); |
10639 |
+ goto out; |
10640 |
+ } |
10641 |
+ btrfs_set_header_level(root->node, 0); |
10642 |
+diff --git a/fs/btrfs/tests/qgroup-tests.c b/fs/btrfs/tests/qgroup-tests.c |
10643 |
+index 09aaca1efd62..ac035a6fa003 100644 |
10644 |
+--- a/fs/btrfs/tests/qgroup-tests.c |
10645 |
++++ b/fs/btrfs/tests/qgroup-tests.c |
10646 |
+@@ -484,9 +484,9 @@ int btrfs_test_qgroups(u32 sectorsize, u32 nodesize) |
10647 |
+ * *cough*backref walking code*cough* |
10648 |
+ */ |
10649 |
+ root->node = alloc_test_extent_buffer(root->fs_info, nodesize); |
10650 |
+- if (!root->node) { |
10651 |
++ if (IS_ERR(root->node)) { |
10652 |
+ test_err("couldn't allocate dummy buffer"); |
10653 |
+- ret = -ENOMEM; |
10654 |
++ ret = PTR_ERR(root->node); |
10655 |
+ goto out; |
10656 |
+ } |
10657 |
+ btrfs_set_header_level(root->node, 0); |
10658 |
+diff --git a/fs/btrfs/tree-checker.c b/fs/btrfs/tree-checker.c |
10659 |
+index 076d5b8014fb..0e44db066641 100644 |
10660 |
+--- a/fs/btrfs/tree-checker.c |
10661 |
++++ b/fs/btrfs/tree-checker.c |
10662 |
+@@ -243,7 +243,7 @@ static int check_extent_data_item(struct extent_buffer *leaf, |
10663 |
+ } |
10664 |
+ |
10665 |
+ static int check_csum_item(struct extent_buffer *leaf, struct btrfs_key *key, |
10666 |
+- int slot) |
10667 |
++ int slot, struct btrfs_key *prev_key) |
10668 |
+ { |
10669 |
+ struct btrfs_fs_info *fs_info = leaf->fs_info; |
10670 |
+ u32 sectorsize = fs_info->sectorsize; |
10671 |
+@@ -267,6 +267,20 @@ static int check_csum_item(struct extent_buffer *leaf, struct btrfs_key *key, |
10672 |
+ btrfs_item_size_nr(leaf, slot), csumsize); |
10673 |
+ return -EUCLEAN; |
10674 |
+ } |
10675 |
++ if (slot > 0 && prev_key->type == BTRFS_EXTENT_CSUM_KEY) { |
10676 |
++ u64 prev_csum_end; |
10677 |
++ u32 prev_item_size; |
10678 |
++ |
10679 |
++ prev_item_size = btrfs_item_size_nr(leaf, slot - 1); |
10680 |
++ prev_csum_end = (prev_item_size / csumsize) * sectorsize; |
10681 |
++ prev_csum_end += prev_key->offset; |
10682 |
++ if (prev_csum_end > key->offset) { |
10683 |
++ generic_err(leaf, slot - 1, |
10684 |
++"csum end range (%llu) goes beyond the start range (%llu) of the next csum item", |
10685 |
++ prev_csum_end, key->offset); |
10686 |
++ return -EUCLEAN; |
10687 |
++ } |
10688 |
++ } |
10689 |
+ return 0; |
10690 |
+ } |
10691 |
+ |
10692 |
+@@ -1239,7 +1253,7 @@ static int check_leaf_item(struct extent_buffer *leaf, |
10693 |
+ ret = check_extent_data_item(leaf, key, slot, prev_key); |
10694 |
+ break; |
10695 |
+ case BTRFS_EXTENT_CSUM_KEY: |
10696 |
+- ret = check_csum_item(leaf, key, slot); |
10697 |
++ ret = check_csum_item(leaf, key, slot, prev_key); |
10698 |
+ break; |
10699 |
+ case BTRFS_DIR_ITEM_KEY: |
10700 |
+ case BTRFS_DIR_INDEX_KEY: |
10701 |
+diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c |
10702 |
+index 8a6cc600bf18..ab27e6cd9b3e 100644 |
10703 |
+--- a/fs/btrfs/tree-log.c |
10704 |
++++ b/fs/btrfs/tree-log.c |
10705 |
+@@ -808,7 +808,8 @@ static noinline int replay_one_extent(struct btrfs_trans_handle *trans, |
10706 |
+ struct btrfs_ordered_sum, |
10707 |
+ list); |
10708 |
+ if (!ret) |
10709 |
+- ret = btrfs_del_csums(trans, fs_info, |
10710 |
++ ret = btrfs_del_csums(trans, |
10711 |
++ fs_info->csum_root, |
10712 |
+ sums->bytenr, |
10713 |
+ sums->len); |
10714 |
+ if (!ret) |
10715 |
+@@ -3927,6 +3928,28 @@ static int log_inode_item(struct btrfs_trans_handle *trans, |
10716 |
+ return 0; |
10717 |
+ } |
10718 |
+ |
10719 |
++static int log_csums(struct btrfs_trans_handle *trans, |
10720 |
++ struct btrfs_root *log_root, |
10721 |
++ struct btrfs_ordered_sum *sums) |
10722 |
++{ |
10723 |
++ int ret; |
10724 |
++ |
10725 |
++ /* |
10726 |
++ * Due to extent cloning, we might have logged a csum item that covers a |
10727 |
++ * subrange of a cloned extent, and later we can end up logging a csum |
10728 |
++ * item for a larger subrange of the same extent or the entire range. |
10729 |
++ * This would leave csum items in the log tree that cover the same range |
10730 |
++ * and break the searches for checksums in the log tree, resulting in |
10731 |
++ * some checksums missing in the fs/subvolume tree. So just delete (or |
10732 |
++ * trim and adjust) any existing csum items in the log for this range. |
10733 |
++ */ |
10734 |
++ ret = btrfs_del_csums(trans, log_root, sums->bytenr, sums->len); |
10735 |
++ if (ret) |
10736 |
++ return ret; |
10737 |
++ |
10738 |
++ return btrfs_csum_file_blocks(trans, log_root, sums); |
10739 |
++} |
10740 |
++ |
10741 |
+ static noinline int copy_items(struct btrfs_trans_handle *trans, |
10742 |
+ struct btrfs_inode *inode, |
10743 |
+ struct btrfs_path *dst_path, |
10744 |
+@@ -4072,7 +4095,7 @@ static noinline int copy_items(struct btrfs_trans_handle *trans, |
10745 |
+ struct btrfs_ordered_sum, |
10746 |
+ list); |
10747 |
+ if (!ret) |
10748 |
+- ret = btrfs_csum_file_blocks(trans, log, sums); |
10749 |
++ ret = log_csums(trans, log, sums); |
10750 |
+ list_del(&sums->list); |
10751 |
+ kfree(sums); |
10752 |
+ } |
10753 |
+@@ -4292,7 +4315,7 @@ static int log_extent_csums(struct btrfs_trans_handle *trans, |
10754 |
+ struct btrfs_ordered_sum, |
10755 |
+ list); |
10756 |
+ if (!ret) |
10757 |
+- ret = btrfs_csum_file_blocks(trans, log_root, sums); |
10758 |
++ ret = log_csums(trans, log_root, sums); |
10759 |
+ list_del(&sums->list); |
10760 |
+ kfree(sums); |
10761 |
+ } |
10762 |
+@@ -6314,9 +6337,28 @@ again: |
10763 |
+ wc.replay_dest = btrfs_read_fs_root_no_name(fs_info, &tmp_key); |
10764 |
+ if (IS_ERR(wc.replay_dest)) { |
10765 |
+ ret = PTR_ERR(wc.replay_dest); |
10766 |
++ |
10767 |
++ /* |
10768 |
++ * We didn't find the subvol, likely because it was |
10769 |
++ * deleted. This is ok, simply skip this log and go to |
10770 |
++ * the next one. |
10771 |
++ * |
10772 |
++ * We need to exclude the root because we can't have |
10773 |
++ * other log replays overwriting this log as we'll read |
10774 |
++ * it back in a few more times. This will keep our |
10775 |
++ * block from being modified, and we'll just bail for |
10776 |
++ * each subsequent pass. |
10777 |
++ */ |
10778 |
++ if (ret == -ENOENT) |
10779 |
++ ret = btrfs_pin_extent_for_log_replay(fs_info, |
10780 |
++ log->node->start, |
10781 |
++ log->node->len); |
10782 |
+ free_extent_buffer(log->node); |
10783 |
+ free_extent_buffer(log->commit_root); |
10784 |
+ kfree(log); |
10785 |
++ |
10786 |
++ if (!ret) |
10787 |
++ goto next; |
10788 |
+ btrfs_handle_fs_error(fs_info, ret, |
10789 |
+ "Couldn't read target root for tree log recovery."); |
10790 |
+ goto error; |
10791 |
+@@ -6348,7 +6390,6 @@ again: |
10792 |
+ &root->highest_objectid); |
10793 |
+ } |
10794 |
+ |
10795 |
+- key.offset = found_key.offset - 1; |
10796 |
+ wc.replay_dest->log_root = NULL; |
10797 |
+ free_extent_buffer(log->node); |
10798 |
+ free_extent_buffer(log->commit_root); |
10799 |
+@@ -6356,9 +6397,10 @@ again: |
10800 |
+ |
10801 |
+ if (ret) |
10802 |
+ goto error; |
10803 |
+- |
10804 |
++next: |
10805 |
+ if (found_key.offset == 0) |
10806 |
+ break; |
10807 |
++ key.offset = found_key.offset - 1; |
10808 |
+ } |
10809 |
+ btrfs_release_path(path); |
10810 |
+ |
10811 |
+diff --git a/fs/btrfs/uuid-tree.c b/fs/btrfs/uuid-tree.c |
10812 |
+index 91caab63bdf5..76b84f2397b1 100644 |
10813 |
+--- a/fs/btrfs/uuid-tree.c |
10814 |
++++ b/fs/btrfs/uuid-tree.c |
10815 |
+@@ -324,6 +324,8 @@ again_search_slot: |
10816 |
+ } |
10817 |
+ if (ret < 0 && ret != -ENOENT) |
10818 |
+ goto out; |
10819 |
++ key.offset++; |
10820 |
++ goto again_search_slot; |
10821 |
+ } |
10822 |
+ item_size -= sizeof(subid_le); |
10823 |
+ offset += sizeof(subid_le); |
10824 |
+diff --git a/fs/ext4/dir.c b/fs/ext4/dir.c |
10825 |
+index 9fdd2b269d61..6305d5ec25af 100644 |
10826 |
+--- a/fs/ext4/dir.c |
10827 |
++++ b/fs/ext4/dir.c |
10828 |
+@@ -81,6 +81,11 @@ int __ext4_check_dir_entry(const char *function, unsigned int line, |
10829 |
+ error_msg = "rec_len is too small for name_len"; |
10830 |
+ else if (unlikely(((char *) de - buf) + rlen > size)) |
10831 |
+ error_msg = "directory entry overrun"; |
10832 |
++ else if (unlikely(((char *) de - buf) + rlen > |
10833 |
++ size - EXT4_DIR_REC_LEN(1) && |
10834 |
++ ((char *) de - buf) + rlen != size)) { |
10835 |
++ error_msg = "directory entry too close to block end"; |
10836 |
++ } |
10837 |
+ else if (unlikely(le32_to_cpu(de->inode) > |
10838 |
+ le32_to_cpu(EXT4_SB(dir->i_sb)->s_es->s_inodes_count))) |
10839 |
+ error_msg = "inode out of bounds"; |
10840 |
+diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c |
10841 |
+index 91da21890360..53134e4509b8 100644 |
10842 |
+--- a/fs/ext4/inode.c |
10843 |
++++ b/fs/ext4/inode.c |
10844 |
+@@ -6035,7 +6035,7 @@ int ext4_expand_extra_isize(struct inode *inode, |
10845 |
+ error = ext4_journal_get_write_access(handle, iloc->bh); |
10846 |
+ if (error) { |
10847 |
+ brelse(iloc->bh); |
10848 |
+- goto out_stop; |
10849 |
++ goto out_unlock; |
10850 |
+ } |
10851 |
+ |
10852 |
+ error = __ext4_expand_extra_isize(inode, new_extra_isize, iloc, |
10853 |
+@@ -6045,8 +6045,8 @@ int ext4_expand_extra_isize(struct inode *inode, |
10854 |
+ if (!error) |
10855 |
+ error = rc; |
10856 |
+ |
10857 |
++out_unlock: |
10858 |
+ ext4_write_unlock_xattr(inode, &no_expand); |
10859 |
+-out_stop: |
10860 |
+ ext4_journal_stop(handle); |
10861 |
+ return error; |
10862 |
+ } |
10863 |
+diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c |
10864 |
+index 923476e3aefb..f56402e9c11c 100644 |
10865 |
+--- a/fs/ext4/namei.c |
10866 |
++++ b/fs/ext4/namei.c |
10867 |
+@@ -2808,7 +2808,7 @@ bool ext4_empty_dir(struct inode *inode) |
10868 |
+ { |
10869 |
+ unsigned int offset; |
10870 |
+ struct buffer_head *bh; |
10871 |
+- struct ext4_dir_entry_2 *de, *de1; |
10872 |
++ struct ext4_dir_entry_2 *de; |
10873 |
+ struct super_block *sb; |
10874 |
+ |
10875 |
+ if (ext4_has_inline_data(inode)) { |
10876 |
+@@ -2833,19 +2833,25 @@ bool ext4_empty_dir(struct inode *inode) |
10877 |
+ return true; |
10878 |
+ |
10879 |
+ de = (struct ext4_dir_entry_2 *) bh->b_data; |
10880 |
+- de1 = ext4_next_entry(de, sb->s_blocksize); |
10881 |
+- if (le32_to_cpu(de->inode) != inode->i_ino || |
10882 |
+- le32_to_cpu(de1->inode) == 0 || |
10883 |
+- strcmp(".", de->name) || strcmp("..", de1->name)) { |
10884 |
+- ext4_warning_inode(inode, "directory missing '.' and/or '..'"); |
10885 |
++ if (ext4_check_dir_entry(inode, NULL, de, bh, bh->b_data, bh->b_size, |
10886 |
++ 0) || |
10887 |
++ le32_to_cpu(de->inode) != inode->i_ino || strcmp(".", de->name)) { |
10888 |
++ ext4_warning_inode(inode, "directory missing '.'"); |
10889 |
++ brelse(bh); |
10890 |
++ return true; |
10891 |
++ } |
10892 |
++ offset = ext4_rec_len_from_disk(de->rec_len, sb->s_blocksize); |
10893 |
++ de = ext4_next_entry(de, sb->s_blocksize); |
10894 |
++ if (ext4_check_dir_entry(inode, NULL, de, bh, bh->b_data, bh->b_size, |
10895 |
++ offset) || |
10896 |
++ le32_to_cpu(de->inode) == 0 || strcmp("..", de->name)) { |
10897 |
++ ext4_warning_inode(inode, "directory missing '..'"); |
10898 |
+ brelse(bh); |
10899 |
+ return true; |
10900 |
+ } |
10901 |
+- offset = ext4_rec_len_from_disk(de->rec_len, sb->s_blocksize) + |
10902 |
+- ext4_rec_len_from_disk(de1->rec_len, sb->s_blocksize); |
10903 |
+- de = ext4_next_entry(de1, sb->s_blocksize); |
10904 |
++ offset += ext4_rec_len_from_disk(de->rec_len, sb->s_blocksize); |
10905 |
+ while (offset < inode->i_size) { |
10906 |
+- if ((void *) de >= (void *) (bh->b_data+sb->s_blocksize)) { |
10907 |
++ if (!(offset & (sb->s_blocksize - 1))) { |
10908 |
+ unsigned int lblock; |
10909 |
+ brelse(bh); |
10910 |
+ lblock = offset >> EXT4_BLOCK_SIZE_BITS(sb); |
10911 |
+@@ -2856,12 +2862,11 @@ bool ext4_empty_dir(struct inode *inode) |
10912 |
+ } |
10913 |
+ if (IS_ERR(bh)) |
10914 |
+ return true; |
10915 |
+- de = (struct ext4_dir_entry_2 *) bh->b_data; |
10916 |
+ } |
10917 |
++ de = (struct ext4_dir_entry_2 *) (bh->b_data + |
10918 |
++ (offset & (sb->s_blocksize - 1))); |
10919 |
+ if (ext4_check_dir_entry(inode, NULL, de, bh, |
10920 |
+ bh->b_data, bh->b_size, offset)) { |
10921 |
+- de = (struct ext4_dir_entry_2 *)(bh->b_data + |
10922 |
+- sb->s_blocksize); |
10923 |
+ offset = (offset | (sb->s_blocksize - 1)) + 1; |
10924 |
+ continue; |
10925 |
+ } |
10926 |
+@@ -2870,7 +2875,6 @@ bool ext4_empty_dir(struct inode *inode) |
10927 |
+ return false; |
10928 |
+ } |
10929 |
+ offset += ext4_rec_len_from_disk(de->rec_len, sb->s_blocksize); |
10930 |
+- de = ext4_next_entry(de, sb->s_blocksize); |
10931 |
+ } |
10932 |
+ brelse(bh); |
10933 |
+ return true; |
10934 |
+diff --git a/fs/ext4/super.c b/fs/ext4/super.c |
10935 |
+index 98d37b8d0050..66162b430edc 100644 |
10936 |
+--- a/fs/ext4/super.c |
10937 |
++++ b/fs/ext4/super.c |
10938 |
+@@ -1887,6 +1887,13 @@ static int handle_mount_opt(struct super_block *sb, char *opt, int token, |
10939 |
+ } |
10940 |
+ sbi->s_commit_interval = HZ * arg; |
10941 |
+ } else if (token == Opt_debug_want_extra_isize) { |
10942 |
++ if ((arg & 1) || |
10943 |
++ (arg < 4) || |
10944 |
++ (arg > (sbi->s_inode_size - EXT4_GOOD_OLD_INODE_SIZE))) { |
10945 |
++ ext4_msg(sb, KERN_ERR, |
10946 |
++ "Invalid want_extra_isize %d", arg); |
10947 |
++ return -1; |
10948 |
++ } |
10949 |
+ sbi->s_want_extra_isize = arg; |
10950 |
+ } else if (token == Opt_max_batch_time) { |
10951 |
+ sbi->s_max_batch_time = arg; |
10952 |
+@@ -3551,40 +3558,6 @@ int ext4_calculate_overhead(struct super_block *sb) |
10953 |
+ return 0; |
10954 |
+ } |
10955 |
+ |
10956 |
+-static void ext4_clamp_want_extra_isize(struct super_block *sb) |
10957 |
+-{ |
10958 |
+- struct ext4_sb_info *sbi = EXT4_SB(sb); |
10959 |
+- struct ext4_super_block *es = sbi->s_es; |
10960 |
+- unsigned def_extra_isize = sizeof(struct ext4_inode) - |
10961 |
+- EXT4_GOOD_OLD_INODE_SIZE; |
10962 |
+- |
10963 |
+- if (sbi->s_inode_size == EXT4_GOOD_OLD_INODE_SIZE) { |
10964 |
+- sbi->s_want_extra_isize = 0; |
10965 |
+- return; |
10966 |
+- } |
10967 |
+- if (sbi->s_want_extra_isize < 4) { |
10968 |
+- sbi->s_want_extra_isize = def_extra_isize; |
10969 |
+- if (ext4_has_feature_extra_isize(sb)) { |
10970 |
+- if (sbi->s_want_extra_isize < |
10971 |
+- le16_to_cpu(es->s_want_extra_isize)) |
10972 |
+- sbi->s_want_extra_isize = |
10973 |
+- le16_to_cpu(es->s_want_extra_isize); |
10974 |
+- if (sbi->s_want_extra_isize < |
10975 |
+- le16_to_cpu(es->s_min_extra_isize)) |
10976 |
+- sbi->s_want_extra_isize = |
10977 |
+- le16_to_cpu(es->s_min_extra_isize); |
10978 |
+- } |
10979 |
+- } |
10980 |
+- /* Check if enough inode space is available */ |
10981 |
+- if ((sbi->s_want_extra_isize > sbi->s_inode_size) || |
10982 |
+- (EXT4_GOOD_OLD_INODE_SIZE + sbi->s_want_extra_isize > |
10983 |
+- sbi->s_inode_size)) { |
10984 |
+- sbi->s_want_extra_isize = def_extra_isize; |
10985 |
+- ext4_msg(sb, KERN_INFO, |
10986 |
+- "required extra inode space not available"); |
10987 |
+- } |
10988 |
+-} |
10989 |
+- |
10990 |
+ static void ext4_set_resv_clusters(struct super_block *sb) |
10991 |
+ { |
10992 |
+ ext4_fsblk_t resv_clusters; |
10993 |
+@@ -3792,6 +3765,68 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) |
10994 |
+ */ |
10995 |
+ sbi->s_li_wait_mult = EXT4_DEF_LI_WAIT_MULT; |
10996 |
+ |
10997 |
++ if (le32_to_cpu(es->s_rev_level) == EXT4_GOOD_OLD_REV) { |
10998 |
++ sbi->s_inode_size = EXT4_GOOD_OLD_INODE_SIZE; |
10999 |
++ sbi->s_first_ino = EXT4_GOOD_OLD_FIRST_INO; |
11000 |
++ } else { |
11001 |
++ sbi->s_inode_size = le16_to_cpu(es->s_inode_size); |
11002 |
++ sbi->s_first_ino = le32_to_cpu(es->s_first_ino); |
11003 |
++ if (sbi->s_first_ino < EXT4_GOOD_OLD_FIRST_INO) { |
11004 |
++ ext4_msg(sb, KERN_ERR, "invalid first ino: %u", |
11005 |
++ sbi->s_first_ino); |
11006 |
++ goto failed_mount; |
11007 |
++ } |
11008 |
++ if ((sbi->s_inode_size < EXT4_GOOD_OLD_INODE_SIZE) || |
11009 |
++ (!is_power_of_2(sbi->s_inode_size)) || |
11010 |
++ (sbi->s_inode_size > blocksize)) { |
11011 |
++ ext4_msg(sb, KERN_ERR, |
11012 |
++ "unsupported inode size: %d", |
11013 |
++ sbi->s_inode_size); |
11014 |
++ goto failed_mount; |
11015 |
++ } |
11016 |
++ /* |
11017 |
++ * i_atime_extra is the last extra field available for |
11018 |
++ * [acm]times in struct ext4_inode. Checking for that |
11019 |
++ * field should suffice to ensure we have extra space |
11020 |
++ * for all three. |
11021 |
++ */ |
11022 |
++ if (sbi->s_inode_size >= offsetof(struct ext4_inode, i_atime_extra) + |
11023 |
++ sizeof(((struct ext4_inode *)0)->i_atime_extra)) { |
11024 |
++ sb->s_time_gran = 1; |
11025 |
++ sb->s_time_max = EXT4_EXTRA_TIMESTAMP_MAX; |
11026 |
++ } else { |
11027 |
++ sb->s_time_gran = NSEC_PER_SEC; |
11028 |
++ sb->s_time_max = EXT4_NON_EXTRA_TIMESTAMP_MAX; |
11029 |
++ } |
11030 |
++ sb->s_time_min = EXT4_TIMESTAMP_MIN; |
11031 |
++ } |
11032 |
++ if (sbi->s_inode_size > EXT4_GOOD_OLD_INODE_SIZE) { |
11033 |
++ sbi->s_want_extra_isize = sizeof(struct ext4_inode) - |
11034 |
++ EXT4_GOOD_OLD_INODE_SIZE; |
11035 |
++ if (ext4_has_feature_extra_isize(sb)) { |
11036 |
++ unsigned v, max = (sbi->s_inode_size - |
11037 |
++ EXT4_GOOD_OLD_INODE_SIZE); |
11038 |
++ |
11039 |
++ v = le16_to_cpu(es->s_want_extra_isize); |
11040 |
++ if (v > max) { |
11041 |
++ ext4_msg(sb, KERN_ERR, |
11042 |
++ "bad s_want_extra_isize: %d", v); |
11043 |
++ goto failed_mount; |
11044 |
++ } |
11045 |
++ if (sbi->s_want_extra_isize < v) |
11046 |
++ sbi->s_want_extra_isize = v; |
11047 |
++ |
11048 |
++ v = le16_to_cpu(es->s_min_extra_isize); |
11049 |
++ if (v > max) { |
11050 |
++ ext4_msg(sb, KERN_ERR, |
11051 |
++ "bad s_min_extra_isize: %d", v); |
11052 |
++ goto failed_mount; |
11053 |
++ } |
11054 |
++ if (sbi->s_want_extra_isize < v) |
11055 |
++ sbi->s_want_extra_isize = v; |
11056 |
++ } |
11057 |
++ } |
11058 |
++ |
11059 |
+ if (sbi->s_es->s_mount_opts[0]) { |
11060 |
+ char *s_mount_opts = kstrndup(sbi->s_es->s_mount_opts, |
11061 |
+ sizeof(sbi->s_es->s_mount_opts), |
11062 |
+@@ -4030,42 +4065,6 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) |
11063 |
+ has_huge_files); |
11064 |
+ sb->s_maxbytes = ext4_max_size(sb->s_blocksize_bits, has_huge_files); |
11065 |
+ |
11066 |
+- if (le32_to_cpu(es->s_rev_level) == EXT4_GOOD_OLD_REV) { |
11067 |
+- sbi->s_inode_size = EXT4_GOOD_OLD_INODE_SIZE; |
11068 |
+- sbi->s_first_ino = EXT4_GOOD_OLD_FIRST_INO; |
11069 |
+- } else { |
11070 |
+- sbi->s_inode_size = le16_to_cpu(es->s_inode_size); |
11071 |
+- sbi->s_first_ino = le32_to_cpu(es->s_first_ino); |
11072 |
+- if (sbi->s_first_ino < EXT4_GOOD_OLD_FIRST_INO) { |
11073 |
+- ext4_msg(sb, KERN_ERR, "invalid first ino: %u", |
11074 |
+- sbi->s_first_ino); |
11075 |
+- goto failed_mount; |
11076 |
+- } |
11077 |
+- if ((sbi->s_inode_size < EXT4_GOOD_OLD_INODE_SIZE) || |
11078 |
+- (!is_power_of_2(sbi->s_inode_size)) || |
11079 |
+- (sbi->s_inode_size > blocksize)) { |
11080 |
+- ext4_msg(sb, KERN_ERR, |
11081 |
+- "unsupported inode size: %d", |
11082 |
+- sbi->s_inode_size); |
11083 |
+- goto failed_mount; |
11084 |
+- } |
11085 |
+- /* |
11086 |
+- * i_atime_extra is the last extra field available for [acm]times in |
11087 |
+- * struct ext4_inode. Checking for that field should suffice to ensure |
11088 |
+- * we have extra space for all three. |
11089 |
+- */ |
11090 |
+- if (sbi->s_inode_size >= offsetof(struct ext4_inode, i_atime_extra) + |
11091 |
+- sizeof(((struct ext4_inode *)0)->i_atime_extra)) { |
11092 |
+- sb->s_time_gran = 1; |
11093 |
+- sb->s_time_max = EXT4_EXTRA_TIMESTAMP_MAX; |
11094 |
+- } else { |
11095 |
+- sb->s_time_gran = NSEC_PER_SEC; |
11096 |
+- sb->s_time_max = EXT4_NON_EXTRA_TIMESTAMP_MAX; |
11097 |
+- } |
11098 |
+- |
11099 |
+- sb->s_time_min = EXT4_TIMESTAMP_MIN; |
11100 |
+- } |
11101 |
+- |
11102 |
+ sbi->s_desc_size = le16_to_cpu(es->s_desc_size); |
11103 |
+ if (ext4_has_feature_64bit(sb)) { |
11104 |
+ if (sbi->s_desc_size < EXT4_MIN_DESC_SIZE_64BIT || |
11105 |
+@@ -4521,8 +4520,6 @@ no_journal: |
11106 |
+ } else if (ret) |
11107 |
+ goto failed_mount4a; |
11108 |
+ |
11109 |
+- ext4_clamp_want_extra_isize(sb); |
11110 |
+- |
11111 |
+ ext4_set_resv_clusters(sb); |
11112 |
+ |
11113 |
+ err = ext4_setup_system_zone(sb); |
11114 |
+@@ -5310,8 +5307,6 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data) |
11115 |
+ goto restore_opts; |
11116 |
+ } |
11117 |
+ |
11118 |
+- ext4_clamp_want_extra_isize(sb); |
11119 |
+- |
11120 |
+ if ((old_opts.s_mount_opt & EXT4_MOUNT_JOURNAL_CHECKSUM) ^ |
11121 |
+ test_opt(sb, JOURNAL_CHECKSUM)) { |
11122 |
+ ext4_msg(sb, KERN_ERR, "changing journal_checksum " |
11123 |
+diff --git a/include/drm/drm_dp_mst_helper.h b/include/drm/drm_dp_mst_helper.h |
11124 |
+index 2ba6253ea6d3..fc349204a71b 100644 |
11125 |
+--- a/include/drm/drm_dp_mst_helper.h |
11126 |
++++ b/include/drm/drm_dp_mst_helper.h |
11127 |
+@@ -334,7 +334,7 @@ struct drm_dp_resource_status_notify { |
11128 |
+ |
11129 |
+ struct drm_dp_query_payload_ack_reply { |
11130 |
+ u8 port_number; |
11131 |
+- u8 allocated_pbn; |
11132 |
++ u16 allocated_pbn; |
11133 |
+ }; |
11134 |
+ |
11135 |
+ struct drm_dp_sideband_msg_req_body { |
11136 |
+diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h |
11137 |
+index 92d5fdc8154e..31b1b0e03df8 100644 |
11138 |
+--- a/include/linux/cpufreq.h |
11139 |
++++ b/include/linux/cpufreq.h |
11140 |
+@@ -595,17 +595,6 @@ struct governor_attr { |
11141 |
+ size_t count); |
11142 |
+ }; |
11143 |
+ |
11144 |
+-static inline bool cpufreq_this_cpu_can_update(struct cpufreq_policy *policy) |
11145 |
+-{ |
11146 |
+- /* |
11147 |
+- * Allow remote callbacks if: |
11148 |
+- * - dvfs_possible_from_any_cpu flag is set |
11149 |
+- * - the local and remote CPUs share cpufreq policy |
11150 |
+- */ |
11151 |
+- return policy->dvfs_possible_from_any_cpu || |
11152 |
+- cpumask_test_cpu(smp_processor_id(), policy->cpus); |
11153 |
+-} |
11154 |
+- |
11155 |
+ /********************************************************************* |
11156 |
+ * FREQUENCY TABLE HELPERS * |
11157 |
+ *********************************************************************/ |
11158 |
+diff --git a/include/linux/ipmi_smi.h b/include/linux/ipmi_smi.h |
11159 |
+index 4dc66157d872..deec18b8944a 100644 |
11160 |
+--- a/include/linux/ipmi_smi.h |
11161 |
++++ b/include/linux/ipmi_smi.h |
11162 |
+@@ -224,10 +224,14 @@ static inline int ipmi_demangle_device_id(uint8_t netfn, uint8_t cmd, |
11163 |
+ * is called, and the lower layer must get the interface from that |
11164 |
+ * call. |
11165 |
+ */ |
11166 |
+-int ipmi_register_smi(const struct ipmi_smi_handlers *handlers, |
11167 |
+- void *send_info, |
11168 |
+- struct device *dev, |
11169 |
+- unsigned char slave_addr); |
11170 |
++int ipmi_add_smi(struct module *owner, |
11171 |
++ const struct ipmi_smi_handlers *handlers, |
11172 |
++ void *send_info, |
11173 |
++ struct device *dev, |
11174 |
++ unsigned char slave_addr); |
11175 |
++ |
11176 |
++#define ipmi_register_smi(handlers, send_info, dev, slave_addr) \ |
11177 |
++ ipmi_add_smi(THIS_MODULE, handlers, send_info, dev, slave_addr) |
11178 |
+ |
11179 |
+ /* |
11180 |
+ * Remove a low-level interface from the IPMI driver. This will |
11181 |
+diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h |
11182 |
+index 5714fd35a83c..e3596db077dc 100644 |
11183 |
+--- a/include/linux/mod_devicetable.h |
11184 |
++++ b/include/linux/mod_devicetable.h |
11185 |
+@@ -587,9 +587,9 @@ struct platform_device_id { |
11186 |
+ #define MDIO_NAME_SIZE 32 |
11187 |
+ #define MDIO_MODULE_PREFIX "mdio:" |
11188 |
+ |
11189 |
+-#define MDIO_ID_FMT "%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d" |
11190 |
++#define MDIO_ID_FMT "%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u" |
11191 |
+ #define MDIO_ID_ARGS(_id) \ |
11192 |
+- (_id)>>31, ((_id)>>30) & 1, ((_id)>>29) & 1, ((_id)>>28) & 1, \ |
11193 |
++ ((_id)>>31) & 1, ((_id)>>30) & 1, ((_id)>>29) & 1, ((_id)>>28) & 1, \ |
11194 |
+ ((_id)>>27) & 1, ((_id)>>26) & 1, ((_id)>>25) & 1, ((_id)>>24) & 1, \ |
11195 |
+ ((_id)>>23) & 1, ((_id)>>22) & 1, ((_id)>>21) & 1, ((_id)>>20) & 1, \ |
11196 |
+ ((_id)>>19) & 1, ((_id)>>18) & 1, ((_id)>>17) & 1, ((_id)>>16) & 1, \ |
11197 |
+diff --git a/include/linux/nvme.h b/include/linux/nvme.h |
11198 |
+index f61d6906e59d..a260cd754f28 100644 |
11199 |
+--- a/include/linux/nvme.h |
11200 |
++++ b/include/linux/nvme.h |
11201 |
+@@ -1368,6 +1368,7 @@ enum { |
11202 |
+ NVME_SC_ANA_INACCESSIBLE = 0x302, |
11203 |
+ NVME_SC_ANA_TRANSITION = 0x303, |
11204 |
+ NVME_SC_HOST_PATH_ERROR = 0x370, |
11205 |
++ NVME_SC_HOST_ABORTED_CMD = 0x371, |
11206 |
+ |
11207 |
+ NVME_SC_CRD = 0x1800, |
11208 |
+ NVME_SC_DNR = 0x4000, |
11209 |
+diff --git a/include/linux/nvmem-consumer.h b/include/linux/nvmem-consumer.h |
11210 |
+index 8f8be5b00060..5c17cb733224 100644 |
11211 |
+--- a/include/linux/nvmem-consumer.h |
11212 |
++++ b/include/linux/nvmem-consumer.h |
11213 |
+@@ -118,7 +118,7 @@ static inline void *nvmem_cell_read(struct nvmem_cell *cell, size_t *len) |
11214 |
+ } |
11215 |
+ |
11216 |
+ static inline int nvmem_cell_write(struct nvmem_cell *cell, |
11217 |
+- const char *buf, size_t len) |
11218 |
++ void *buf, size_t len) |
11219 |
+ { |
11220 |
+ return -EOPNOTSUPP; |
11221 |
+ } |
11222 |
+diff --git a/include/linux/phy.h b/include/linux/phy.h |
11223 |
+index 9a0e981df502..3d5d53313e6c 100644 |
11224 |
+--- a/include/linux/phy.h |
11225 |
++++ b/include/linux/phy.h |
11226 |
+@@ -993,7 +993,7 @@ int phy_modify_paged_changed(struct phy_device *phydev, int page, u32 regnum, |
11227 |
+ int phy_modify_paged(struct phy_device *phydev, int page, u32 regnum, |
11228 |
+ u16 mask, u16 set); |
11229 |
+ |
11230 |
+-struct phy_device *phy_device_create(struct mii_bus *bus, int addr, int phy_id, |
11231 |
++struct phy_device *phy_device_create(struct mii_bus *bus, int addr, u32 phy_id, |
11232 |
+ bool is_c45, |
11233 |
+ struct phy_c45_device_ids *c45_ids); |
11234 |
+ #if IS_ENABLED(CONFIG_PHYLIB) |
11235 |
+diff --git a/include/linux/sched/cpufreq.h b/include/linux/sched/cpufreq.h |
11236 |
+index afa940cd50dc..cc6bcc1e96bc 100644 |
11237 |
+--- a/include/linux/sched/cpufreq.h |
11238 |
++++ b/include/linux/sched/cpufreq.h |
11239 |
+@@ -12,6 +12,8 @@ |
11240 |
+ #define SCHED_CPUFREQ_MIGRATION (1U << 1) |
11241 |
+ |
11242 |
+ #ifdef CONFIG_CPU_FREQ |
11243 |
++struct cpufreq_policy; |
11244 |
++ |
11245 |
+ struct update_util_data { |
11246 |
+ void (*func)(struct update_util_data *data, u64 time, unsigned int flags); |
11247 |
+ }; |
11248 |
+@@ -20,6 +22,7 @@ void cpufreq_add_update_util_hook(int cpu, struct update_util_data *data, |
11249 |
+ void (*func)(struct update_util_data *data, u64 time, |
11250 |
+ unsigned int flags)); |
11251 |
+ void cpufreq_remove_update_util_hook(int cpu); |
11252 |
++bool cpufreq_this_cpu_can_update(struct cpufreq_policy *policy); |
11253 |
+ |
11254 |
+ static inline unsigned long map_util_freq(unsigned long util, |
11255 |
+ unsigned long freq, unsigned long cap) |
11256 |
+diff --git a/include/net/arp.h b/include/net/arp.h |
11257 |
+index c8f580a0e6b1..4950191f6b2b 100644 |
11258 |
+--- a/include/net/arp.h |
11259 |
++++ b/include/net/arp.h |
11260 |
+@@ -57,8 +57,8 @@ static inline void __ipv4_confirm_neigh(struct net_device *dev, u32 key) |
11261 |
+ unsigned long now = jiffies; |
11262 |
+ |
11263 |
+ /* avoid dirtying neighbour */ |
11264 |
+- if (n->confirmed != now) |
11265 |
+- n->confirmed = now; |
11266 |
++ if (READ_ONCE(n->confirmed) != now) |
11267 |
++ WRITE_ONCE(n->confirmed, now); |
11268 |
+ } |
11269 |
+ rcu_read_unlock_bh(); |
11270 |
+ } |
11271 |
+diff --git a/include/net/dst.h b/include/net/dst.h |
11272 |
+index fe62fe2eb781..8224dad2ae94 100644 |
11273 |
+--- a/include/net/dst.h |
11274 |
++++ b/include/net/dst.h |
11275 |
+@@ -82,7 +82,7 @@ struct dst_entry { |
11276 |
+ struct dst_metrics { |
11277 |
+ u32 metrics[RTAX_MAX]; |
11278 |
+ refcount_t refcnt; |
11279 |
+-}; |
11280 |
++} __aligned(4); /* Low pointer bits contain DST_METRICS_FLAGS */ |
11281 |
+ extern const struct dst_metrics dst_default_metrics; |
11282 |
+ |
11283 |
+ u32 *dst_cow_metrics_generic(struct dst_entry *dst, unsigned long old); |
11284 |
+diff --git a/include/net/ndisc.h b/include/net/ndisc.h |
11285 |
+index b2f715ca0567..b5ebeb3b0de0 100644 |
11286 |
+--- a/include/net/ndisc.h |
11287 |
++++ b/include/net/ndisc.h |
11288 |
+@@ -414,8 +414,8 @@ static inline void __ipv6_confirm_neigh(struct net_device *dev, |
11289 |
+ unsigned long now = jiffies; |
11290 |
+ |
11291 |
+ /* avoid dirtying neighbour */ |
11292 |
+- if (n->confirmed != now) |
11293 |
+- n->confirmed = now; |
11294 |
++ if (READ_ONCE(n->confirmed) != now) |
11295 |
++ WRITE_ONCE(n->confirmed, now); |
11296 |
+ } |
11297 |
+ rcu_read_unlock_bh(); |
11298 |
+ } |
11299 |
+@@ -431,8 +431,8 @@ static inline void __ipv6_confirm_neigh_stub(struct net_device *dev, |
11300 |
+ unsigned long now = jiffies; |
11301 |
+ |
11302 |
+ /* avoid dirtying neighbour */ |
11303 |
+- if (n->confirmed != now) |
11304 |
+- n->confirmed = now; |
11305 |
++ if (READ_ONCE(n->confirmed) != now) |
11306 |
++ WRITE_ONCE(n->confirmed, now); |
11307 |
+ } |
11308 |
+ rcu_read_unlock_bh(); |
11309 |
+ } |
11310 |
+diff --git a/include/net/neighbour.h b/include/net/neighbour.h |
11311 |
+index b8452cc0e059..5e679c8dae0b 100644 |
11312 |
+--- a/include/net/neighbour.h |
11313 |
++++ b/include/net/neighbour.h |
11314 |
+@@ -72,7 +72,6 @@ struct neigh_parms { |
11315 |
+ struct net_device *dev; |
11316 |
+ struct list_head list; |
11317 |
+ int (*neigh_setup)(struct neighbour *); |
11318 |
+- void (*neigh_cleanup)(struct neighbour *); |
11319 |
+ struct neigh_table *tbl; |
11320 |
+ |
11321 |
+ void *sysctl_table; |
11322 |
+diff --git a/include/net/sock.h b/include/net/sock.h |
11323 |
+index 718e62fbe869..013396e50b91 100644 |
11324 |
+--- a/include/net/sock.h |
11325 |
++++ b/include/net/sock.h |
11326 |
+@@ -1940,8 +1940,8 @@ struct dst_entry *sk_dst_check(struct sock *sk, u32 cookie); |
11327 |
+ |
11328 |
+ static inline void sk_dst_confirm(struct sock *sk) |
11329 |
+ { |
11330 |
+- if (!sk->sk_dst_pending_confirm) |
11331 |
+- sk->sk_dst_pending_confirm = 1; |
11332 |
++ if (!READ_ONCE(sk->sk_dst_pending_confirm)) |
11333 |
++ WRITE_ONCE(sk->sk_dst_pending_confirm, 1); |
11334 |
+ } |
11335 |
+ |
11336 |
+ static inline void sock_confirm_neigh(struct sk_buff *skb, struct neighbour *n) |
11337 |
+@@ -1951,10 +1951,10 @@ static inline void sock_confirm_neigh(struct sk_buff *skb, struct neighbour *n) |
11338 |
+ unsigned long now = jiffies; |
11339 |
+ |
11340 |
+ /* avoid dirtying neighbour */ |
11341 |
+- if (n->confirmed != now) |
11342 |
+- n->confirmed = now; |
11343 |
+- if (sk && sk->sk_dst_pending_confirm) |
11344 |
+- sk->sk_dst_pending_confirm = 0; |
11345 |
++ if (READ_ONCE(n->confirmed) != now) |
11346 |
++ WRITE_ONCE(n->confirmed, now); |
11347 |
++ if (sk && READ_ONCE(sk->sk_dst_pending_confirm)) |
11348 |
++ WRITE_ONCE(sk->sk_dst_pending_confirm, 0); |
11349 |
+ } |
11350 |
+ } |
11351 |
+ |
11352 |
+diff --git a/include/trace/events/wbt.h b/include/trace/events/wbt.h |
11353 |
+index b048694070e2..37342a13c9cb 100644 |
11354 |
+--- a/include/trace/events/wbt.h |
11355 |
++++ b/include/trace/events/wbt.h |
11356 |
+@@ -33,7 +33,8 @@ TRACE_EVENT(wbt_stat, |
11357 |
+ ), |
11358 |
+ |
11359 |
+ TP_fast_assign( |
11360 |
+- strncpy(__entry->name, dev_name(bdi->dev), 32); |
11361 |
++ strlcpy(__entry->name, dev_name(bdi->dev), |
11362 |
++ ARRAY_SIZE(__entry->name)); |
11363 |
+ __entry->rmean = stat[0].mean; |
11364 |
+ __entry->rmin = stat[0].min; |
11365 |
+ __entry->rmax = stat[0].max; |
11366 |
+@@ -67,7 +68,8 @@ TRACE_EVENT(wbt_lat, |
11367 |
+ ), |
11368 |
+ |
11369 |
+ TP_fast_assign( |
11370 |
+- strncpy(__entry->name, dev_name(bdi->dev), 32); |
11371 |
++ strlcpy(__entry->name, dev_name(bdi->dev), |
11372 |
++ ARRAY_SIZE(__entry->name)); |
11373 |
+ __entry->lat = div_u64(lat, 1000); |
11374 |
+ ), |
11375 |
+ |
11376 |
+@@ -103,7 +105,8 @@ TRACE_EVENT(wbt_step, |
11377 |
+ ), |
11378 |
+ |
11379 |
+ TP_fast_assign( |
11380 |
+- strncpy(__entry->name, dev_name(bdi->dev), 32); |
11381 |
++ strlcpy(__entry->name, dev_name(bdi->dev), |
11382 |
++ ARRAY_SIZE(__entry->name)); |
11383 |
+ __entry->msg = msg; |
11384 |
+ __entry->step = step; |
11385 |
+ __entry->window = div_u64(window, 1000); |
11386 |
+@@ -138,7 +141,8 @@ TRACE_EVENT(wbt_timer, |
11387 |
+ ), |
11388 |
+ |
11389 |
+ TP_fast_assign( |
11390 |
+- strncpy(__entry->name, dev_name(bdi->dev), 32); |
11391 |
++ strlcpy(__entry->name, dev_name(bdi->dev), |
11392 |
++ ARRAY_SIZE(__entry->name)); |
11393 |
+ __entry->status = status; |
11394 |
+ __entry->step = step; |
11395 |
+ __entry->inflight = inflight; |
11396 |
+diff --git a/include/uapi/linux/cec-funcs.h b/include/uapi/linux/cec-funcs.h |
11397 |
+index 8997d5068c08..4511b85c84df 100644 |
11398 |
+--- a/include/uapi/linux/cec-funcs.h |
11399 |
++++ b/include/uapi/linux/cec-funcs.h |
11400 |
+@@ -923,7 +923,8 @@ static inline void cec_msg_give_deck_status(struct cec_msg *msg, |
11401 |
+ msg->len = 3; |
11402 |
+ msg->msg[1] = CEC_MSG_GIVE_DECK_STATUS; |
11403 |
+ msg->msg[2] = status_req; |
11404 |
+- msg->reply = reply ? CEC_MSG_DECK_STATUS : 0; |
11405 |
++ msg->reply = (reply && status_req != CEC_OP_STATUS_REQ_OFF) ? |
11406 |
++ CEC_MSG_DECK_STATUS : 0; |
11407 |
+ } |
11408 |
+ |
11409 |
+ static inline void cec_ops_give_deck_status(const struct cec_msg *msg, |
11410 |
+@@ -1027,7 +1028,8 @@ static inline void cec_msg_give_tuner_device_status(struct cec_msg *msg, |
11411 |
+ msg->len = 3; |
11412 |
+ msg->msg[1] = CEC_MSG_GIVE_TUNER_DEVICE_STATUS; |
11413 |
+ msg->msg[2] = status_req; |
11414 |
+- msg->reply = reply ? CEC_MSG_TUNER_DEVICE_STATUS : 0; |
11415 |
++ msg->reply = (reply && status_req != CEC_OP_STATUS_REQ_OFF) ? |
11416 |
++ CEC_MSG_TUNER_DEVICE_STATUS : 0; |
11417 |
+ } |
11418 |
+ |
11419 |
+ static inline void cec_ops_give_tuner_device_status(const struct cec_msg *msg, |
11420 |
+diff --git a/kernel/bpf/stackmap.c b/kernel/bpf/stackmap.c |
11421 |
+index 052580c33d26..173e983619d7 100644 |
11422 |
+--- a/kernel/bpf/stackmap.c |
11423 |
++++ b/kernel/bpf/stackmap.c |
11424 |
+@@ -287,7 +287,7 @@ static void stack_map_get_build_id_offset(struct bpf_stack_build_id *id_offs, |
11425 |
+ bool irq_work_busy = false; |
11426 |
+ struct stack_map_irq_work *work = NULL; |
11427 |
+ |
11428 |
+- if (in_nmi()) { |
11429 |
++ if (irqs_disabled()) { |
11430 |
+ work = this_cpu_ptr(&up_read_work); |
11431 |
+ if (work->irq_work.flags & IRQ_WORK_BUSY) |
11432 |
+ /* cannot queue more up_read, fallback */ |
11433 |
+@@ -295,8 +295,9 @@ static void stack_map_get_build_id_offset(struct bpf_stack_build_id *id_offs, |
11434 |
+ } |
11435 |
+ |
11436 |
+ /* |
11437 |
+- * We cannot do up_read() in nmi context. To do build_id lookup |
11438 |
+- * in nmi context, we need to run up_read() in irq_work. We use |
11439 |
++ * We cannot do up_read() when the irq is disabled, because of |
11440 |
++ * risk to deadlock with rq_lock. To do build_id lookup when the |
11441 |
++ * irqs are disabled, we need to run up_read() in irq_work. We use |
11442 |
+ * a percpu variable to do the irq_work. If the irq_work is |
11443 |
+ * already used by another lookup, we fall back to report ips. |
11444 |
+ * |
11445 |
+diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c |
11446 |
+index ffc3e53f5300..9e7cee5307e0 100644 |
11447 |
+--- a/kernel/bpf/verifier.c |
11448 |
++++ b/kernel/bpf/verifier.c |
11449 |
+@@ -978,6 +978,17 @@ static void __reg_bound_offset(struct bpf_reg_state *reg) |
11450 |
+ reg->umax_value)); |
11451 |
+ } |
11452 |
+ |
11453 |
++static void __reg_bound_offset32(struct bpf_reg_state *reg) |
11454 |
++{ |
11455 |
++ u64 mask = 0xffffFFFF; |
11456 |
++ struct tnum range = tnum_range(reg->umin_value & mask, |
11457 |
++ reg->umax_value & mask); |
11458 |
++ struct tnum lo32 = tnum_cast(reg->var_off, 4); |
11459 |
++ struct tnum hi32 = tnum_lshift(tnum_rshift(reg->var_off, 32), 32); |
11460 |
++ |
11461 |
++ reg->var_off = tnum_or(hi32, tnum_intersect(lo32, range)); |
11462 |
++} |
11463 |
++ |
11464 |
+ /* Reset the min/max bounds of a register */ |
11465 |
+ static void __mark_reg_unbounded(struct bpf_reg_state *reg) |
11466 |
+ { |
11467 |
+@@ -5433,6 +5444,10 @@ static void reg_set_min_max(struct bpf_reg_state *true_reg, |
11468 |
+ /* We might have learned some bits from the bounds. */ |
11469 |
+ __reg_bound_offset(false_reg); |
11470 |
+ __reg_bound_offset(true_reg); |
11471 |
++ if (is_jmp32) { |
11472 |
++ __reg_bound_offset32(false_reg); |
11473 |
++ __reg_bound_offset32(true_reg); |
11474 |
++ } |
11475 |
+ /* Intersecting with the old var_off might have improved our bounds |
11476 |
+ * slightly. e.g. if umax was 0x7f...f and var_off was (0; 0xf...fc), |
11477 |
+ * then new var_off is (0; 0x7f...fc) which improves our umax. |
11478 |
+@@ -5542,6 +5557,10 @@ static void reg_set_min_max_inv(struct bpf_reg_state *true_reg, |
11479 |
+ /* We might have learned some bits from the bounds. */ |
11480 |
+ __reg_bound_offset(false_reg); |
11481 |
+ __reg_bound_offset(true_reg); |
11482 |
++ if (is_jmp32) { |
11483 |
++ __reg_bound_offset32(false_reg); |
11484 |
++ __reg_bound_offset32(true_reg); |
11485 |
++ } |
11486 |
+ /* Intersecting with the old var_off might have improved our bounds |
11487 |
+ * slightly. e.g. if umax was 0x7f...f and var_off was (0; 0xf...fc), |
11488 |
+ * then new var_off is (0; 0x7f...fc) which improves our umax. |
11489 |
+diff --git a/kernel/cgroup/freezer.c b/kernel/cgroup/freezer.c |
11490 |
+index 8cf010680678..3984dd6b8ddb 100644 |
11491 |
+--- a/kernel/cgroup/freezer.c |
11492 |
++++ b/kernel/cgroup/freezer.c |
11493 |
+@@ -230,6 +230,15 @@ void cgroup_freezer_migrate_task(struct task_struct *task, |
11494 |
+ if (task->flags & PF_KTHREAD) |
11495 |
+ return; |
11496 |
+ |
11497 |
++ /* |
11498 |
++ * It's not necessary to do changes if both of the src and dst cgroups |
11499 |
++ * are not freezing and task is not frozen. |
11500 |
++ */ |
11501 |
++ if (!test_bit(CGRP_FREEZE, &src->flags) && |
11502 |
++ !test_bit(CGRP_FREEZE, &dst->flags) && |
11503 |
++ !task->frozen) |
11504 |
++ return; |
11505 |
++ |
11506 |
+ /* |
11507 |
+ * Adjust counters of freezing and frozen tasks. |
11508 |
+ * Note, that if the task is frozen, but the destination cgroup is not |
11509 |
+diff --git a/kernel/events/core.c b/kernel/events/core.c |
11510 |
+index 00a014670ed0..8f66a4833ded 100644 |
11511 |
+--- a/kernel/events/core.c |
11512 |
++++ b/kernel/events/core.c |
11513 |
+@@ -5607,10 +5607,8 @@ static void perf_mmap_close(struct vm_area_struct *vma) |
11514 |
+ perf_pmu_output_stop(event); |
11515 |
+ |
11516 |
+ /* now it's safe to free the pages */ |
11517 |
+- if (!rb->aux_mmap_locked) |
11518 |
+- atomic_long_sub(rb->aux_nr_pages, &mmap_user->locked_vm); |
11519 |
+- else |
11520 |
+- atomic64_sub(rb->aux_mmap_locked, &vma->vm_mm->pinned_vm); |
11521 |
++ atomic_long_sub(rb->aux_nr_pages - rb->aux_mmap_locked, &mmap_user->locked_vm); |
11522 |
++ atomic64_sub(rb->aux_mmap_locked, &vma->vm_mm->pinned_vm); |
11523 |
+ |
11524 |
+ /* this has to be the last one */ |
11525 |
+ rb_free_aux(rb); |
11526 |
+diff --git a/kernel/sched/core.c b/kernel/sched/core.c |
11527 |
+index 44123b4d14e8..8dacda4b0362 100644 |
11528 |
+--- a/kernel/sched/core.c |
11529 |
++++ b/kernel/sched/core.c |
11530 |
+@@ -810,7 +810,7 @@ static inline unsigned int uclamp_bucket_base_value(unsigned int clamp_value) |
11531 |
+ return UCLAMP_BUCKET_DELTA * uclamp_bucket_id(clamp_value); |
11532 |
+ } |
11533 |
+ |
11534 |
+-static inline enum uclamp_id uclamp_none(enum uclamp_id clamp_id) |
11535 |
++static inline unsigned int uclamp_none(enum uclamp_id clamp_id) |
11536 |
+ { |
11537 |
+ if (clamp_id == UCLAMP_MIN) |
11538 |
+ return 0; |
11539 |
+@@ -853,7 +853,7 @@ static inline void uclamp_idle_reset(struct rq *rq, enum uclamp_id clamp_id, |
11540 |
+ } |
11541 |
+ |
11542 |
+ static inline |
11543 |
+-enum uclamp_id uclamp_rq_max_value(struct rq *rq, enum uclamp_id clamp_id, |
11544 |
++unsigned int uclamp_rq_max_value(struct rq *rq, enum uclamp_id clamp_id, |
11545 |
+ unsigned int clamp_value) |
11546 |
+ { |
11547 |
+ struct uclamp_bucket *bucket = rq->uclamp[clamp_id].bucket; |
11548 |
+@@ -918,7 +918,7 @@ uclamp_eff_get(struct task_struct *p, enum uclamp_id clamp_id) |
11549 |
+ return uc_req; |
11550 |
+ } |
11551 |
+ |
11552 |
+-enum uclamp_id uclamp_eff_value(struct task_struct *p, enum uclamp_id clamp_id) |
11553 |
++unsigned int uclamp_eff_value(struct task_struct *p, enum uclamp_id clamp_id) |
11554 |
+ { |
11555 |
+ struct uclamp_se uc_eff; |
11556 |
+ |
11557 |
+diff --git a/kernel/sched/cpufreq.c b/kernel/sched/cpufreq.c |
11558 |
+index b5dcd1d83c7f..7c2fe50fd76d 100644 |
11559 |
+--- a/kernel/sched/cpufreq.c |
11560 |
++++ b/kernel/sched/cpufreq.c |
11561 |
+@@ -5,6 +5,8 @@ |
11562 |
+ * Copyright (C) 2016, Intel Corporation |
11563 |
+ * Author: Rafael J. Wysocki <rafael.j.wysocki@×××××.com> |
11564 |
+ */ |
11565 |
++#include <linux/cpufreq.h> |
11566 |
++ |
11567 |
+ #include "sched.h" |
11568 |
+ |
11569 |
+ DEFINE_PER_CPU(struct update_util_data __rcu *, cpufreq_update_util_data); |
11570 |
+@@ -57,3 +59,19 @@ void cpufreq_remove_update_util_hook(int cpu) |
11571 |
+ rcu_assign_pointer(per_cpu(cpufreq_update_util_data, cpu), NULL); |
11572 |
+ } |
11573 |
+ EXPORT_SYMBOL_GPL(cpufreq_remove_update_util_hook); |
11574 |
++ |
11575 |
++/** |
11576 |
++ * cpufreq_this_cpu_can_update - Check if cpufreq policy can be updated. |
11577 |
++ * @policy: cpufreq policy to check. |
11578 |
++ * |
11579 |
++ * Return 'true' if: |
11580 |
++ * - the local and remote CPUs share @policy, |
11581 |
++ * - dvfs_possible_from_any_cpu is set in @policy and the local CPU is not going |
11582 |
++ * offline (in which case it is not expected to run cpufreq updates any more). |
11583 |
++ */ |
11584 |
++bool cpufreq_this_cpu_can_update(struct cpufreq_policy *policy) |
11585 |
++{ |
11586 |
++ return cpumask_test_cpu(smp_processor_id(), policy->cpus) || |
11587 |
++ (policy->dvfs_possible_from_any_cpu && |
11588 |
++ rcu_dereference_sched(*this_cpu_ptr(&cpufreq_update_util_data))); |
11589 |
++} |
11590 |
+diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c |
11591 |
+index 86800b4d5453..b6f56e7c8dd1 100644 |
11592 |
+--- a/kernel/sched/cpufreq_schedutil.c |
11593 |
++++ b/kernel/sched/cpufreq_schedutil.c |
11594 |
+@@ -82,12 +82,10 @@ static bool sugov_should_update_freq(struct sugov_policy *sg_policy, u64 time) |
11595 |
+ * by the hardware, as calculating the frequency is pointless if |
11596 |
+ * we cannot in fact act on it. |
11597 |
+ * |
11598 |
+- * For the slow switching platforms, the kthread is always scheduled on |
11599 |
+- * the right set of CPUs and any CPU can find the next frequency and |
11600 |
+- * schedule the kthread. |
11601 |
++ * This is needed on the slow switching platforms too to prevent CPUs |
11602 |
++ * going offline from leaving stale IRQ work items behind. |
11603 |
+ */ |
11604 |
+- if (sg_policy->policy->fast_switch_enabled && |
11605 |
+- !cpufreq_this_cpu_can_update(sg_policy->policy)) |
11606 |
++ if (!cpufreq_this_cpu_can_update(sg_policy->policy)) |
11607 |
+ return false; |
11608 |
+ |
11609 |
+ if (unlikely(sg_policy->limits_changed)) { |
11610 |
+diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h |
11611 |
+index c8870c5bd7df..49ed949f850c 100644 |
11612 |
+--- a/kernel/sched/sched.h |
11613 |
++++ b/kernel/sched/sched.h |
11614 |
+@@ -2309,7 +2309,7 @@ static inline void cpufreq_update_util(struct rq *rq, unsigned int flags) {} |
11615 |
+ #endif /* CONFIG_CPU_FREQ */ |
11616 |
+ |
11617 |
+ #ifdef CONFIG_UCLAMP_TASK |
11618 |
+-enum uclamp_id uclamp_eff_value(struct task_struct *p, enum uclamp_id clamp_id); |
11619 |
++unsigned int uclamp_eff_value(struct task_struct *p, enum uclamp_id clamp_id); |
11620 |
+ |
11621 |
+ static __always_inline |
11622 |
+ unsigned int uclamp_util_with(struct rq *rq, unsigned int util, |
11623 |
+diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c |
11624 |
+index 6a0ee9178365..2fa72419bbd7 100644 |
11625 |
+--- a/kernel/trace/trace.c |
11626 |
++++ b/kernel/trace/trace.c |
11627 |
+@@ -4609,7 +4609,7 @@ int set_tracer_flag(struct trace_array *tr, unsigned int mask, int enabled) |
11628 |
+ |
11629 |
+ if (mask == TRACE_ITER_RECORD_TGID) { |
11630 |
+ if (!tgid_map) |
11631 |
+- tgid_map = kcalloc(PID_MAX_DEFAULT + 1, |
11632 |
++ tgid_map = kvcalloc(PID_MAX_DEFAULT + 1, |
11633 |
+ sizeof(*tgid_map), |
11634 |
+ GFP_KERNEL); |
11635 |
+ if (!tgid_map) { |
11636 |
+diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c |
11637 |
+index 1552a95c743b..7f890262c8a3 100644 |
11638 |
+--- a/kernel/trace/trace_kprobe.c |
11639 |
++++ b/kernel/trace/trace_kprobe.c |
11640 |
+@@ -435,11 +435,10 @@ static int disable_trace_kprobe(struct trace_event_call *call, |
11641 |
+ |
11642 |
+ #if defined(CONFIG_KPROBES_ON_FTRACE) && \ |
11643 |
+ !defined(CONFIG_KPROBE_EVENTS_ON_NOTRACE) |
11644 |
+-static bool within_notrace_func(struct trace_kprobe *tk) |
11645 |
++static bool __within_notrace_func(unsigned long addr) |
11646 |
+ { |
11647 |
+- unsigned long offset, size, addr; |
11648 |
++ unsigned long offset, size; |
11649 |
+ |
11650 |
+- addr = trace_kprobe_address(tk); |
11651 |
+ if (!addr || !kallsyms_lookup_size_offset(addr, &size, &offset)) |
11652 |
+ return false; |
11653 |
+ |
11654 |
+@@ -452,6 +451,28 @@ static bool within_notrace_func(struct trace_kprobe *tk) |
11655 |
+ */ |
11656 |
+ return !ftrace_location_range(addr, addr + size - 1); |
11657 |
+ } |
11658 |
++ |
11659 |
++static bool within_notrace_func(struct trace_kprobe *tk) |
11660 |
++{ |
11661 |
++ unsigned long addr = addr = trace_kprobe_address(tk); |
11662 |
++ char symname[KSYM_NAME_LEN], *p; |
11663 |
++ |
11664 |
++ if (!__within_notrace_func(addr)) |
11665 |
++ return false; |
11666 |
++ |
11667 |
++ /* Check if the address is on a suffixed-symbol */ |
11668 |
++ if (!lookup_symbol_name(addr, symname)) { |
11669 |
++ p = strchr(symname, '.'); |
11670 |
++ if (!p) |
11671 |
++ return true; |
11672 |
++ *p = '\0'; |
11673 |
++ addr = (unsigned long)kprobe_lookup_name(symname, 0); |
11674 |
++ if (addr) |
11675 |
++ return __within_notrace_func(addr); |
11676 |
++ } |
11677 |
++ |
11678 |
++ return true; |
11679 |
++} |
11680 |
+ #else |
11681 |
+ #define within_notrace_func(tk) (false) |
11682 |
+ #endif |
11683 |
+diff --git a/lib/ubsan.c b/lib/ubsan.c |
11684 |
+index e7d31735950d..0c4681118fcd 100644 |
11685 |
+--- a/lib/ubsan.c |
11686 |
++++ b/lib/ubsan.c |
11687 |
+@@ -374,9 +374,10 @@ void __ubsan_handle_shift_out_of_bounds(struct shift_out_of_bounds_data *data, |
11688 |
+ struct type_descriptor *lhs_type = data->lhs_type; |
11689 |
+ char rhs_str[VALUE_LENGTH]; |
11690 |
+ char lhs_str[VALUE_LENGTH]; |
11691 |
++ unsigned long ua_flags = user_access_save(); |
11692 |
+ |
11693 |
+ if (suppress_report(&data->location)) |
11694 |
+- return; |
11695 |
++ goto out; |
11696 |
+ |
11697 |
+ ubsan_prologue(&data->location, &flags); |
11698 |
+ |
11699 |
+@@ -402,6 +403,8 @@ void __ubsan_handle_shift_out_of_bounds(struct shift_out_of_bounds_data *data, |
11700 |
+ lhs_type->type_name); |
11701 |
+ |
11702 |
+ ubsan_epilogue(&flags); |
11703 |
++out: |
11704 |
++ user_access_restore(ua_flags); |
11705 |
+ } |
11706 |
+ EXPORT_SYMBOL(__ubsan_handle_shift_out_of_bounds); |
11707 |
+ |
11708 |
+diff --git a/mm/vmscan.c b/mm/vmscan.c |
11709 |
+index ee4eecc7e1c2..e7f10c4b40f0 100644 |
11710 |
+--- a/mm/vmscan.c |
11711 |
++++ b/mm/vmscan.c |
11712 |
+@@ -422,7 +422,7 @@ void register_shrinker_prepared(struct shrinker *shrinker) |
11713 |
+ { |
11714 |
+ down_write(&shrinker_rwsem); |
11715 |
+ list_add_tail(&shrinker->list, &shrinker_list); |
11716 |
+-#ifdef CONFIG_MEMCG_KMEM |
11717 |
++#ifdef CONFIG_MEMCG |
11718 |
+ if (shrinker->flags & SHRINKER_MEMCG_AWARE) |
11719 |
+ idr_replace(&shrinker_idr, shrinker, shrinker->id); |
11720 |
+ #endif |
11721 |
+diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c |
11722 |
+index ad5b0ac1f9ce..7ff92dd4c53c 100644 |
11723 |
+--- a/net/bluetooth/hci_conn.c |
11724 |
++++ b/net/bluetooth/hci_conn.c |
11725 |
+@@ -934,6 +934,14 @@ static void hci_req_directed_advertising(struct hci_request *req, |
11726 |
+ return; |
11727 |
+ |
11728 |
+ memset(&cp, 0, sizeof(cp)); |
11729 |
++ |
11730 |
++ /* Some controllers might reject command if intervals are not |
11731 |
++ * within range for undirected advertising. |
11732 |
++ * BCM20702A0 is known to be affected by this. |
11733 |
++ */ |
11734 |
++ cp.min_interval = cpu_to_le16(0x0020); |
11735 |
++ cp.max_interval = cpu_to_le16(0x0020); |
11736 |
++ |
11737 |
+ cp.type = LE_ADV_DIRECT_IND; |
11738 |
+ cp.own_address_type = own_addr_type; |
11739 |
+ cp.direct_addr_type = conn->dst_type; |
11740 |
+diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c |
11741 |
+index 04bc79359a17..0cc9ce917222 100644 |
11742 |
+--- a/net/bluetooth/hci_core.c |
11743 |
++++ b/net/bluetooth/hci_core.c |
11744 |
+@@ -842,8 +842,8 @@ static int hci_init4_req(struct hci_request *req, unsigned long opt) |
11745 |
+ if (hdev->le_features[0] & HCI_LE_DATA_LEN_EXT) { |
11746 |
+ struct hci_cp_le_write_def_data_len cp; |
11747 |
+ |
11748 |
+- cp.tx_len = hdev->le_max_tx_len; |
11749 |
+- cp.tx_time = hdev->le_max_tx_time; |
11750 |
++ cp.tx_len = cpu_to_le16(hdev->le_max_tx_len); |
11751 |
++ cp.tx_time = cpu_to_le16(hdev->le_max_tx_time); |
11752 |
+ hci_req_add(req, HCI_OP_LE_WRITE_DEF_DATA_LEN, sizeof(cp), &cp); |
11753 |
+ } |
11754 |
+ |
11755 |
+@@ -4440,7 +4440,14 @@ static void hci_rx_work(struct work_struct *work) |
11756 |
+ hci_send_to_sock(hdev, skb); |
11757 |
+ } |
11758 |
+ |
11759 |
+- if (hci_dev_test_flag(hdev, HCI_USER_CHANNEL)) { |
11760 |
++ /* If the device has been opened in HCI_USER_CHANNEL, |
11761 |
++ * the userspace has exclusive access to device. |
11762 |
++ * When device is HCI_INIT, we still need to process |
11763 |
++ * the data packets to the driver in order |
11764 |
++ * to complete its setup(). |
11765 |
++ */ |
11766 |
++ if (hci_dev_test_flag(hdev, HCI_USER_CHANNEL) && |
11767 |
++ !test_bit(HCI_INIT, &hdev->flags)) { |
11768 |
+ kfree_skb(skb); |
11769 |
+ continue; |
11770 |
+ } |
11771 |
+diff --git a/net/bluetooth/hci_request.c b/net/bluetooth/hci_request.c |
11772 |
+index 7f6a581b5b7e..3d25dbf10b26 100644 |
11773 |
+--- a/net/bluetooth/hci_request.c |
11774 |
++++ b/net/bluetooth/hci_request.c |
11775 |
+@@ -1273,6 +1273,14 @@ static u8 create_instance_adv_data(struct hci_dev *hdev, u8 instance, u8 *ptr) |
11776 |
+ |
11777 |
+ instance_flags = get_adv_instance_flags(hdev, instance); |
11778 |
+ |
11779 |
++ /* If instance already has the flags set skip adding it once |
11780 |
++ * again. |
11781 |
++ */ |
11782 |
++ if (adv_instance && eir_get_data(adv_instance->adv_data, |
11783 |
++ adv_instance->adv_data_len, EIR_FLAGS, |
11784 |
++ NULL)) |
11785 |
++ goto skip_flags; |
11786 |
++ |
11787 |
+ /* The Add Advertising command allows userspace to set both the general |
11788 |
+ * and limited discoverable flags. |
11789 |
+ */ |
11790 |
+@@ -1305,6 +1313,7 @@ static u8 create_instance_adv_data(struct hci_dev *hdev, u8 instance, u8 *ptr) |
11791 |
+ } |
11792 |
+ } |
11793 |
+ |
11794 |
++skip_flags: |
11795 |
+ if (adv_instance) { |
11796 |
+ memcpy(ptr, adv_instance->adv_data, |
11797 |
+ adv_instance->adv_data_len); |
11798 |
+diff --git a/net/can/j1939/socket.c b/net/can/j1939/socket.c |
11799 |
+index de09b0a65791..f7587428febd 100644 |
11800 |
+--- a/net/can/j1939/socket.c |
11801 |
++++ b/net/can/j1939/socket.c |
11802 |
+@@ -423,9 +423,9 @@ static int j1939_sk_bind(struct socket *sock, struct sockaddr *uaddr, int len) |
11803 |
+ { |
11804 |
+ struct sockaddr_can *addr = (struct sockaddr_can *)uaddr; |
11805 |
+ struct j1939_sock *jsk = j1939_sk(sock->sk); |
11806 |
+- struct j1939_priv *priv = jsk->priv; |
11807 |
+- struct sock *sk = sock->sk; |
11808 |
+- struct net *net = sock_net(sk); |
11809 |
++ struct j1939_priv *priv; |
11810 |
++ struct sock *sk; |
11811 |
++ struct net *net; |
11812 |
+ int ret = 0; |
11813 |
+ |
11814 |
+ ret = j1939_sk_sanity_check(addr, len); |
11815 |
+@@ -434,6 +434,10 @@ static int j1939_sk_bind(struct socket *sock, struct sockaddr *uaddr, int len) |
11816 |
+ |
11817 |
+ lock_sock(sock->sk); |
11818 |
+ |
11819 |
++ priv = jsk->priv; |
11820 |
++ sk = sock->sk; |
11821 |
++ net = sock_net(sk); |
11822 |
++ |
11823 |
+ /* Already bound to an interface? */ |
11824 |
+ if (jsk->state & J1939_SOCK_BOUND) { |
11825 |
+ /* A re-bind() to a different interface is not |
11826 |
+diff --git a/net/core/neighbour.c b/net/core/neighbour.c |
11827 |
+index 5480edff0c86..08ebc3ac5343 100644 |
11828 |
+--- a/net/core/neighbour.c |
11829 |
++++ b/net/core/neighbour.c |
11830 |
+@@ -98,9 +98,6 @@ static int neigh_blackhole(struct neighbour *neigh, struct sk_buff *skb) |
11831 |
+ |
11832 |
+ static void neigh_cleanup_and_release(struct neighbour *neigh) |
11833 |
+ { |
11834 |
+- if (neigh->parms->neigh_cleanup) |
11835 |
+- neigh->parms->neigh_cleanup(neigh); |
11836 |
+- |
11837 |
+ trace_neigh_cleanup_and_release(neigh, 0); |
11838 |
+ __neigh_notify(neigh, RTM_DELNEIGH, 0, 0); |
11839 |
+ call_netevent_notifiers(NETEVENT_NEIGH_UPDATE, neigh); |
11840 |
+diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c |
11841 |
+index ae3bcb1540ec..b4db68e5caa9 100644 |
11842 |
+--- a/net/core/net-sysfs.c |
11843 |
++++ b/net/core/net-sysfs.c |
11844 |
+@@ -919,14 +919,17 @@ static int rx_queue_add_kobject(struct net_device *dev, int index) |
11845 |
+ struct kobject *kobj = &queue->kobj; |
11846 |
+ int error = 0; |
11847 |
+ |
11848 |
++ /* Kobject_put later will trigger rx_queue_release call which |
11849 |
++ * decreases dev refcount: Take that reference here |
11850 |
++ */ |
11851 |
++ dev_hold(queue->dev); |
11852 |
++ |
11853 |
+ kobj->kset = dev->queues_kset; |
11854 |
+ error = kobject_init_and_add(kobj, &rx_queue_ktype, NULL, |
11855 |
+ "rx-%u", index); |
11856 |
+ if (error) |
11857 |
+ goto err; |
11858 |
+ |
11859 |
+- dev_hold(queue->dev); |
11860 |
+- |
11861 |
+ if (dev->sysfs_rx_queue_group) { |
11862 |
+ error = sysfs_create_group(kobj, dev->sysfs_rx_queue_group); |
11863 |
+ if (error) |
11864 |
+diff --git a/net/mac80211/status.c b/net/mac80211/status.c |
11865 |
+index ab8ba5835ca0..5a3d645fe1bc 100644 |
11866 |
+--- a/net/mac80211/status.c |
11867 |
++++ b/net/mac80211/status.c |
11868 |
+@@ -1030,7 +1030,8 @@ static void __ieee80211_tx_status(struct ieee80211_hw *hw, |
11869 |
+ I802_DEBUG_INC(local->dot11FailedCount); |
11870 |
+ } |
11871 |
+ |
11872 |
+- if (ieee80211_is_nullfunc(fc) && ieee80211_has_pm(fc) && |
11873 |
++ if ((ieee80211_is_nullfunc(fc) || ieee80211_is_qos_nullfunc(fc)) && |
11874 |
++ ieee80211_has_pm(fc) && |
11875 |
+ ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS) && |
11876 |
+ !(info->flags & IEEE80211_TX_CTL_INJECTED) && |
11877 |
+ local->ps_sdata && !(local->scanning)) { |
11878 |
+diff --git a/net/nfc/nci/uart.c b/net/nfc/nci/uart.c |
11879 |
+index 78fe622eba65..11b554ce07ff 100644 |
11880 |
+--- a/net/nfc/nci/uart.c |
11881 |
++++ b/net/nfc/nci/uart.c |
11882 |
+@@ -346,7 +346,7 @@ static int nci_uart_default_recv_buf(struct nci_uart *nu, const u8 *data, |
11883 |
+ nu->rx_packet_len = -1; |
11884 |
+ nu->rx_skb = nci_skb_alloc(nu->ndev, |
11885 |
+ NCI_MAX_PACKET_SIZE, |
11886 |
+- GFP_KERNEL); |
11887 |
++ GFP_ATOMIC); |
11888 |
+ if (!nu->rx_skb) |
11889 |
+ return -ENOMEM; |
11890 |
+ } |
11891 |
+diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c |
11892 |
+index 82a50e850245..529d4ce945db 100644 |
11893 |
+--- a/net/packet/af_packet.c |
11894 |
++++ b/net/packet/af_packet.c |
11895 |
+@@ -544,7 +544,8 @@ static int prb_calc_retire_blk_tmo(struct packet_sock *po, |
11896 |
+ msec = 1; |
11897 |
+ div = ecmd.base.speed / 1000; |
11898 |
+ } |
11899 |
+- } |
11900 |
++ } else |
11901 |
++ return DEFAULT_PRB_RETIRE_TOV; |
11902 |
+ |
11903 |
+ mbits = (blk_size_in_bytes * 8) / (1024 * 1024); |
11904 |
+ |
11905 |
+diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c |
11906 |
+index 08d14d86ecfb..681ffb3545db 100644 |
11907 |
+--- a/net/sctp/protocol.c |
11908 |
++++ b/net/sctp/protocol.c |
11909 |
+@@ -227,6 +227,7 @@ static void sctp_v4_from_skb(union sctp_addr *addr, struct sk_buff *skb, |
11910 |
+ sa->sin_port = sh->dest; |
11911 |
+ sa->sin_addr.s_addr = ip_hdr(skb)->daddr; |
11912 |
+ } |
11913 |
++ memset(sa->sin_zero, 0, sizeof(sa->sin_zero)); |
11914 |
+ } |
11915 |
+ |
11916 |
+ /* Initialize an sctp_addr from a socket. */ |
11917 |
+@@ -235,6 +236,7 @@ static void sctp_v4_from_sk(union sctp_addr *addr, struct sock *sk) |
11918 |
+ addr->v4.sin_family = AF_INET; |
11919 |
+ addr->v4.sin_port = 0; |
11920 |
+ addr->v4.sin_addr.s_addr = inet_sk(sk)->inet_rcv_saddr; |
11921 |
++ memset(addr->v4.sin_zero, 0, sizeof(addr->v4.sin_zero)); |
11922 |
+ } |
11923 |
+ |
11924 |
+ /* Initialize sk->sk_rcv_saddr from sctp_addr. */ |
11925 |
+@@ -257,6 +259,7 @@ static void sctp_v4_from_addr_param(union sctp_addr *addr, |
11926 |
+ addr->v4.sin_family = AF_INET; |
11927 |
+ addr->v4.sin_port = port; |
11928 |
+ addr->v4.sin_addr.s_addr = param->v4.addr.s_addr; |
11929 |
++ memset(addr->v4.sin_zero, 0, sizeof(addr->v4.sin_zero)); |
11930 |
+ } |
11931 |
+ |
11932 |
+ /* Initialize an address parameter from a sctp_addr and return the length |
11933 |
+@@ -281,6 +284,7 @@ static void sctp_v4_dst_saddr(union sctp_addr *saddr, struct flowi4 *fl4, |
11934 |
+ saddr->v4.sin_family = AF_INET; |
11935 |
+ saddr->v4.sin_port = port; |
11936 |
+ saddr->v4.sin_addr.s_addr = fl4->saddr; |
11937 |
++ memset(saddr->v4.sin_zero, 0, sizeof(saddr->v4.sin_zero)); |
11938 |
+ } |
11939 |
+ |
11940 |
+ /* Compare two addresses exactly. */ |
11941 |
+@@ -303,6 +307,7 @@ static void sctp_v4_inaddr_any(union sctp_addr *addr, __be16 port) |
11942 |
+ addr->v4.sin_family = AF_INET; |
11943 |
+ addr->v4.sin_addr.s_addr = htonl(INADDR_ANY); |
11944 |
+ addr->v4.sin_port = port; |
11945 |
++ memset(addr->v4.sin_zero, 0, sizeof(addr->v4.sin_zero)); |
11946 |
+ } |
11947 |
+ |
11948 |
+ /* Is this a wildcard address? */ |
11949 |
+diff --git a/net/sctp/stream.c b/net/sctp/stream.c |
11950 |
+index e83cdaa2ab76..6a30392068a0 100644 |
11951 |
+--- a/net/sctp/stream.c |
11952 |
++++ b/net/sctp/stream.c |
11953 |
+@@ -84,8 +84,10 @@ static int sctp_stream_alloc_out(struct sctp_stream *stream, __u16 outcnt, |
11954 |
+ return 0; |
11955 |
+ |
11956 |
+ ret = genradix_prealloc(&stream->out, outcnt, gfp); |
11957 |
+- if (ret) |
11958 |
++ if (ret) { |
11959 |
++ genradix_free(&stream->out); |
11960 |
+ return ret; |
11961 |
++ } |
11962 |
+ |
11963 |
+ stream->outcnt = outcnt; |
11964 |
+ return 0; |
11965 |
+@@ -100,8 +102,10 @@ static int sctp_stream_alloc_in(struct sctp_stream *stream, __u16 incnt, |
11966 |
+ return 0; |
11967 |
+ |
11968 |
+ ret = genradix_prealloc(&stream->in, incnt, gfp); |
11969 |
+- if (ret) |
11970 |
++ if (ret) { |
11971 |
++ genradix_free(&stream->in); |
11972 |
+ return ret; |
11973 |
++ } |
11974 |
+ |
11975 |
+ stream->incnt = incnt; |
11976 |
+ return 0; |
11977 |
+diff --git a/net/smc/smc_core.c b/net/smc/smc_core.c |
11978 |
+index 2ba97ff325a5..0c5fcb8ed404 100644 |
11979 |
+--- a/net/smc/smc_core.c |
11980 |
++++ b/net/smc/smc_core.c |
11981 |
+@@ -231,10 +231,12 @@ static int smc_lgr_create(struct smc_sock *smc, struct smc_init_info *ini) |
11982 |
+ lgr->conns_all = RB_ROOT; |
11983 |
+ if (ini->is_smcd) { |
11984 |
+ /* SMC-D specific settings */ |
11985 |
++ get_device(&ini->ism_dev->dev); |
11986 |
+ lgr->peer_gid = ini->ism_gid; |
11987 |
+ lgr->smcd = ini->ism_dev; |
11988 |
+ } else { |
11989 |
+ /* SMC-R specific settings */ |
11990 |
++ get_device(&ini->ib_dev->ibdev->dev); |
11991 |
+ lgr->role = smc->listen_smc ? SMC_SERV : SMC_CLNT; |
11992 |
+ memcpy(lgr->peer_systemid, ini->ib_lcl->id_for_peer, |
11993 |
+ SMC_SYSTEMID_LEN); |
11994 |
+@@ -433,10 +435,13 @@ static void smc_lgr_free_bufs(struct smc_link_group *lgr) |
11995 |
+ static void smc_lgr_free(struct smc_link_group *lgr) |
11996 |
+ { |
11997 |
+ smc_lgr_free_bufs(lgr); |
11998 |
+- if (lgr->is_smcd) |
11999 |
++ if (lgr->is_smcd) { |
12000 |
+ smc_ism_put_vlan(lgr->smcd, lgr->vlan_id); |
12001 |
+- else |
12002 |
++ put_device(&lgr->smcd->dev); |
12003 |
++ } else { |
12004 |
+ smc_link_clear(&lgr->lnk[SMC_SINGLE_LINK]); |
12005 |
++ put_device(&lgr->lnk[SMC_SINGLE_LINK].smcibdev->ibdev->dev); |
12006 |
++ } |
12007 |
+ kfree(lgr); |
12008 |
+ } |
12009 |
+ |
12010 |
+diff --git a/samples/pktgen/functions.sh b/samples/pktgen/functions.sh |
12011 |
+index 4af4046d71be..40873a5d1461 100644 |
12012 |
+--- a/samples/pktgen/functions.sh |
12013 |
++++ b/samples/pktgen/functions.sh |
12014 |
+@@ -5,6 +5,8 @@ |
12015 |
+ # Author: Jesper Dangaaard Brouer |
12016 |
+ # License: GPL |
12017 |
+ |
12018 |
++set -o errexit |
12019 |
++ |
12020 |
+ ## -- General shell logging cmds -- |
12021 |
+ function err() { |
12022 |
+ local exitcode=$1 |
12023 |
+@@ -58,6 +60,7 @@ function pg_set() { |
12024 |
+ function proc_cmd() { |
12025 |
+ local result |
12026 |
+ local proc_file=$1 |
12027 |
++ local status=0 |
12028 |
+ # after shift, the remaining args are contained in $@ |
12029 |
+ shift |
12030 |
+ local proc_ctrl=${PROC_DIR}/$proc_file |
12031 |
+@@ -73,13 +76,13 @@ function proc_cmd() { |
12032 |
+ echo "cmd: $@ > $proc_ctrl" |
12033 |
+ fi |
12034 |
+ # Quoting of "$@" is important for space expansion |
12035 |
+- echo "$@" > "$proc_ctrl" |
12036 |
+- local status=$? |
12037 |
++ echo "$@" > "$proc_ctrl" || status=$? |
12038 |
+ |
12039 |
+- result=$(grep "Result: OK:" $proc_ctrl) |
12040 |
+- # Due to pgctrl, cannot use exit code $? from grep |
12041 |
+- if [[ "$result" == "" ]]; then |
12042 |
+- grep "Result:" $proc_ctrl >&2 |
12043 |
++ if [[ "$proc_file" != "pgctrl" ]]; then |
12044 |
++ result=$(grep "Result: OK:" $proc_ctrl) || true |
12045 |
++ if [[ "$result" == "" ]]; then |
12046 |
++ grep "Result:" $proc_ctrl >&2 |
12047 |
++ fi |
12048 |
+ fi |
12049 |
+ if (( $status != 0 )); then |
12050 |
+ err 5 "Write error($status) occurred cmd: \"$@ > $proc_ctrl\"" |
12051 |
+@@ -105,6 +108,8 @@ function pgset() { |
12052 |
+ fi |
12053 |
+ } |
12054 |
+ |
12055 |
++[[ $EUID -eq 0 ]] && trap 'pg_ctrl "reset"' EXIT |
12056 |
++ |
12057 |
+ ## -- General shell tricks -- |
12058 |
+ |
12059 |
+ function root_check_run_with_sudo() { |
12060 |
+diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c |
12061 |
+index 91c6ad58729f..d4280568a41e 100644 |
12062 |
+--- a/sound/core/pcm_native.c |
12063 |
++++ b/sound/core/pcm_native.c |
12064 |
+@@ -222,7 +222,8 @@ static bool hw_support_mmap(struct snd_pcm_substream *substream) |
12065 |
+ return false; |
12066 |
+ |
12067 |
+ if (substream->ops->mmap || |
12068 |
+- substream->dma_buffer.dev.type != SNDRV_DMA_TYPE_DEV) |
12069 |
++ (substream->dma_buffer.dev.type != SNDRV_DMA_TYPE_DEV && |
12070 |
++ substream->dma_buffer.dev.type != SNDRV_DMA_TYPE_DEV_UC)) |
12071 |
+ return true; |
12072 |
+ |
12073 |
+ return dma_can_mmap(substream->dma_buffer.dev.dev); |
12074 |
+@@ -705,6 +706,10 @@ static int snd_pcm_hw_params(struct snd_pcm_substream *substream, |
12075 |
+ while (runtime->boundary * 2 <= LONG_MAX - runtime->buffer_size) |
12076 |
+ runtime->boundary *= 2; |
12077 |
+ |
12078 |
++ /* clear the buffer for avoiding possible kernel info leaks */ |
12079 |
++ if (runtime->dma_area && !substream->ops->copy_user) |
12080 |
++ memset(runtime->dma_area, 0, runtime->dma_bytes); |
12081 |
++ |
12082 |
+ snd_pcm_timer_resolution_change(substream); |
12083 |
+ snd_pcm_set_state(substream, SNDRV_PCM_STATE_SETUP); |
12084 |
+ |
12085 |
+diff --git a/sound/core/timer.c b/sound/core/timer.c |
12086 |
+index 59ae21b0bb93..013f0e69ff0f 100644 |
12087 |
+--- a/sound/core/timer.c |
12088 |
++++ b/sound/core/timer.c |
12089 |
+@@ -74,6 +74,9 @@ static LIST_HEAD(snd_timer_slave_list); |
12090 |
+ /* lock for slave active lists */ |
12091 |
+ static DEFINE_SPINLOCK(slave_active_lock); |
12092 |
+ |
12093 |
++#define MAX_SLAVE_INSTANCES 1000 |
12094 |
++static int num_slaves; |
12095 |
++ |
12096 |
+ static DEFINE_MUTEX(register_mutex); |
12097 |
+ |
12098 |
+ static int snd_timer_free(struct snd_timer *timer); |
12099 |
+@@ -252,6 +255,10 @@ int snd_timer_open(struct snd_timer_instance **ti, |
12100 |
+ err = -EINVAL; |
12101 |
+ goto unlock; |
12102 |
+ } |
12103 |
++ if (num_slaves >= MAX_SLAVE_INSTANCES) { |
12104 |
++ err = -EBUSY; |
12105 |
++ goto unlock; |
12106 |
++ } |
12107 |
+ timeri = snd_timer_instance_new(owner, NULL); |
12108 |
+ if (!timeri) { |
12109 |
+ err = -ENOMEM; |
12110 |
+@@ -261,6 +268,7 @@ int snd_timer_open(struct snd_timer_instance **ti, |
12111 |
+ timeri->slave_id = tid->device; |
12112 |
+ timeri->flags |= SNDRV_TIMER_IFLG_SLAVE; |
12113 |
+ list_add_tail(&timeri->open_list, &snd_timer_slave_list); |
12114 |
++ num_slaves++; |
12115 |
+ err = snd_timer_check_slave(timeri); |
12116 |
+ if (err < 0) { |
12117 |
+ snd_timer_close_locked(timeri, &card_dev_to_put); |
12118 |
+@@ -356,6 +364,8 @@ static int snd_timer_close_locked(struct snd_timer_instance *timeri, |
12119 |
+ } |
12120 |
+ |
12121 |
+ list_del(&timeri->open_list); |
12122 |
++ if (timeri->flags & SNDRV_TIMER_IFLG_SLAVE) |
12123 |
++ num_slaves--; |
12124 |
+ |
12125 |
+ /* force to stop the timer */ |
12126 |
+ snd_timer_stop(timeri); |
12127 |
+diff --git a/sound/firewire/bebob/bebob_stream.c b/sound/firewire/bebob/bebob_stream.c |
12128 |
+index 6c1497d9f52b..ce07ea0d4e71 100644 |
12129 |
+--- a/sound/firewire/bebob/bebob_stream.c |
12130 |
++++ b/sound/firewire/bebob/bebob_stream.c |
12131 |
+@@ -415,15 +415,16 @@ static int make_both_connections(struct snd_bebob *bebob) |
12132 |
+ return 0; |
12133 |
+ } |
12134 |
+ |
12135 |
+-static void |
12136 |
+-break_both_connections(struct snd_bebob *bebob) |
12137 |
++static void break_both_connections(struct snd_bebob *bebob) |
12138 |
+ { |
12139 |
+ cmp_connection_break(&bebob->in_conn); |
12140 |
+ cmp_connection_break(&bebob->out_conn); |
12141 |
+ |
12142 |
+- /* These models seems to be in transition state for a longer time. */ |
12143 |
+- if (bebob->maudio_special_quirk != NULL) |
12144 |
+- msleep(200); |
12145 |
++ // These models seem to be in transition state for a longer time. When |
12146 |
++ // accessing in the state, any transactions is corrupted. In the worst |
12147 |
++ // case, the device is going to reboot. |
12148 |
++ if (bebob->version < 2) |
12149 |
++ msleep(600); |
12150 |
+ } |
12151 |
+ |
12152 |
+ static int |
12153 |
+diff --git a/sound/pci/hda/patch_ca0132.c b/sound/pci/hda/patch_ca0132.c |
12154 |
+index b7a1abb3e231..32ed46464af7 100644 |
12155 |
+--- a/sound/pci/hda/patch_ca0132.c |
12156 |
++++ b/sound/pci/hda/patch_ca0132.c |
12157 |
+@@ -1809,13 +1809,14 @@ struct scp_msg { |
12158 |
+ |
12159 |
+ static void dspio_clear_response_queue(struct hda_codec *codec) |
12160 |
+ { |
12161 |
++ unsigned long timeout = jiffies + msecs_to_jiffies(1000); |
12162 |
+ unsigned int dummy = 0; |
12163 |
+- int status = -1; |
12164 |
++ int status; |
12165 |
+ |
12166 |
+ /* clear all from the response queue */ |
12167 |
+ do { |
12168 |
+ status = dspio_read(codec, &dummy); |
12169 |
+- } while (status == 0); |
12170 |
++ } while (status == 0 && time_before(jiffies, timeout)); |
12171 |
+ } |
12172 |
+ |
12173 |
+ static int dspio_get_response_data(struct hda_codec *codec) |
12174 |
+@@ -7588,12 +7589,14 @@ static void ca0132_process_dsp_response(struct hda_codec *codec, |
12175 |
+ struct ca0132_spec *spec = codec->spec; |
12176 |
+ |
12177 |
+ codec_dbg(codec, "ca0132_process_dsp_response\n"); |
12178 |
++ snd_hda_power_up_pm(codec); |
12179 |
+ if (spec->wait_scp) { |
12180 |
+ if (dspio_get_response_data(codec) >= 0) |
12181 |
+ spec->wait_scp = 0; |
12182 |
+ } |
12183 |
+ |
12184 |
+ dspio_clear_response_queue(codec); |
12185 |
++ snd_hda_power_down_pm(codec); |
12186 |
+ } |
12187 |
+ |
12188 |
+ static void hp_callback(struct hda_codec *codec, struct hda_jack_callback *cb) |
12189 |
+@@ -7604,11 +7607,10 @@ static void hp_callback(struct hda_codec *codec, struct hda_jack_callback *cb) |
12190 |
+ /* Delay enabling the HP amp, to let the mic-detection |
12191 |
+ * state machine run. |
12192 |
+ */ |
12193 |
+- cancel_delayed_work(&spec->unsol_hp_work); |
12194 |
+- schedule_delayed_work(&spec->unsol_hp_work, msecs_to_jiffies(500)); |
12195 |
+ tbl = snd_hda_jack_tbl_get(codec, cb->nid); |
12196 |
+ if (tbl) |
12197 |
+ tbl->block_report = 1; |
12198 |
++ schedule_delayed_work(&spec->unsol_hp_work, msecs_to_jiffies(500)); |
12199 |
+ } |
12200 |
+ |
12201 |
+ static void amic_callback(struct hda_codec *codec, struct hda_jack_callback *cb) |
12202 |
+@@ -8454,12 +8456,25 @@ static void ca0132_reboot_notify(struct hda_codec *codec) |
12203 |
+ codec->patch_ops.free(codec); |
12204 |
+ } |
12205 |
+ |
12206 |
++#ifdef CONFIG_PM |
12207 |
++static int ca0132_suspend(struct hda_codec *codec) |
12208 |
++{ |
12209 |
++ struct ca0132_spec *spec = codec->spec; |
12210 |
++ |
12211 |
++ cancel_delayed_work_sync(&spec->unsol_hp_work); |
12212 |
++ return 0; |
12213 |
++} |
12214 |
++#endif |
12215 |
++ |
12216 |
+ static const struct hda_codec_ops ca0132_patch_ops = { |
12217 |
+ .build_controls = ca0132_build_controls, |
12218 |
+ .build_pcms = ca0132_build_pcms, |
12219 |
+ .init = ca0132_init, |
12220 |
+ .free = ca0132_free, |
12221 |
+ .unsol_event = snd_hda_jack_unsol_event, |
12222 |
++#ifdef CONFIG_PM |
12223 |
++ .suspend = ca0132_suspend, |
12224 |
++#endif |
12225 |
+ .reboot_notify = ca0132_reboot_notify, |
12226 |
+ }; |
12227 |
+ |
12228 |
+diff --git a/sound/soc/codecs/rt5677.c b/sound/soc/codecs/rt5677.c |
12229 |
+index 315a3d39bc09..8bc9450da79c 100644 |
12230 |
+--- a/sound/soc/codecs/rt5677.c |
12231 |
++++ b/sound/soc/codecs/rt5677.c |
12232 |
+@@ -298,6 +298,7 @@ static bool rt5677_volatile_register(struct device *dev, unsigned int reg) |
12233 |
+ case RT5677_I2C_MASTER_CTRL7: |
12234 |
+ case RT5677_I2C_MASTER_CTRL8: |
12235 |
+ case RT5677_HAP_GENE_CTRL2: |
12236 |
++ case RT5677_PWR_ANLG2: /* Modified by DSP firmware */ |
12237 |
+ case RT5677_PWR_DSP_ST: |
12238 |
+ case RT5677_PRIV_DATA: |
12239 |
+ case RT5677_ASRC_22: |
12240 |
+diff --git a/sound/soc/codecs/wm2200.c b/sound/soc/codecs/wm2200.c |
12241 |
+index cf64e109c658..7b087d94141b 100644 |
12242 |
+--- a/sound/soc/codecs/wm2200.c |
12243 |
++++ b/sound/soc/codecs/wm2200.c |
12244 |
+@@ -2410,6 +2410,8 @@ static int wm2200_i2c_probe(struct i2c_client *i2c, |
12245 |
+ |
12246 |
+ err_pm_runtime: |
12247 |
+ pm_runtime_disable(&i2c->dev); |
12248 |
++ if (i2c->irq) |
12249 |
++ free_irq(i2c->irq, wm2200); |
12250 |
+ err_reset: |
12251 |
+ if (wm2200->pdata.reset) |
12252 |
+ gpio_set_value_cansleep(wm2200->pdata.reset, 0); |
12253 |
+@@ -2426,12 +2428,15 @@ static int wm2200_i2c_remove(struct i2c_client *i2c) |
12254 |
+ { |
12255 |
+ struct wm2200_priv *wm2200 = i2c_get_clientdata(i2c); |
12256 |
+ |
12257 |
++ pm_runtime_disable(&i2c->dev); |
12258 |
+ if (i2c->irq) |
12259 |
+ free_irq(i2c->irq, wm2200); |
12260 |
+ if (wm2200->pdata.reset) |
12261 |
+ gpio_set_value_cansleep(wm2200->pdata.reset, 0); |
12262 |
+ if (wm2200->pdata.ldo_ena) |
12263 |
+ gpio_set_value_cansleep(wm2200->pdata.ldo_ena, 0); |
12264 |
++ regulator_bulk_disable(ARRAY_SIZE(wm2200->core_supplies), |
12265 |
++ wm2200->core_supplies); |
12266 |
+ |
12267 |
+ return 0; |
12268 |
+ } |
12269 |
+diff --git a/sound/soc/codecs/wm5100.c b/sound/soc/codecs/wm5100.c |
12270 |
+index 4af0e519e623..91cc63c5a51f 100644 |
12271 |
+--- a/sound/soc/codecs/wm5100.c |
12272 |
++++ b/sound/soc/codecs/wm5100.c |
12273 |
+@@ -2617,6 +2617,7 @@ static int wm5100_i2c_probe(struct i2c_client *i2c, |
12274 |
+ return ret; |
12275 |
+ |
12276 |
+ err_reset: |
12277 |
++ pm_runtime_disable(&i2c->dev); |
12278 |
+ if (i2c->irq) |
12279 |
+ free_irq(i2c->irq, wm5100); |
12280 |
+ wm5100_free_gpio(i2c); |
12281 |
+@@ -2640,6 +2641,7 @@ static int wm5100_i2c_remove(struct i2c_client *i2c) |
12282 |
+ { |
12283 |
+ struct wm5100_priv *wm5100 = i2c_get_clientdata(i2c); |
12284 |
+ |
12285 |
++ pm_runtime_disable(&i2c->dev); |
12286 |
+ if (i2c->irq) |
12287 |
+ free_irq(i2c->irq, wm5100); |
12288 |
+ wm5100_free_gpio(i2c); |
12289 |
+diff --git a/sound/soc/codecs/wm8904.c b/sound/soc/codecs/wm8904.c |
12290 |
+index bcb3c9d5abf0..9e8c564f6e9c 100644 |
12291 |
+--- a/sound/soc/codecs/wm8904.c |
12292 |
++++ b/sound/soc/codecs/wm8904.c |
12293 |
+@@ -1917,6 +1917,7 @@ static int wm8904_set_bias_level(struct snd_soc_component *component, |
12294 |
+ snd_soc_component_update_bits(component, WM8904_BIAS_CONTROL_0, |
12295 |
+ WM8904_BIAS_ENA, 0); |
12296 |
+ |
12297 |
++ snd_soc_component_write(component, WM8904_SW_RESET_AND_ID, 0); |
12298 |
+ regcache_cache_only(wm8904->regmap, true); |
12299 |
+ regcache_mark_dirty(wm8904->regmap); |
12300 |
+ |
12301 |
+diff --git a/sound/soc/intel/boards/bytcr_rt5640.c b/sound/soc/intel/boards/bytcr_rt5640.c |
12302 |
+index 9c1aa4ec9cba..dd2b5ad08659 100644 |
12303 |
+--- a/sound/soc/intel/boards/bytcr_rt5640.c |
12304 |
++++ b/sound/soc/intel/boards/bytcr_rt5640.c |
12305 |
+@@ -405,10 +405,12 @@ static const struct dmi_system_id byt_rt5640_quirk_table[] = { |
12306 |
+ DMI_MATCH(DMI_SYS_VENDOR, "Acer"), |
12307 |
+ DMI_MATCH(DMI_PRODUCT_NAME, "Aspire SW5-012"), |
12308 |
+ }, |
12309 |
+- .driver_data = (void *)(BYT_RT5640_IN1_MAP | |
12310 |
+- BYT_RT5640_MCLK_EN | |
12311 |
+- BYT_RT5640_SSP0_AIF1), |
12312 |
+- |
12313 |
++ .driver_data = (void *)(BYT_RT5640_DMIC1_MAP | |
12314 |
++ BYT_RT5640_JD_SRC_JD2_IN4N | |
12315 |
++ BYT_RT5640_OVCD_TH_2000UA | |
12316 |
++ BYT_RT5640_OVCD_SF_0P75 | |
12317 |
++ BYT_RT5640_SSP0_AIF1 | |
12318 |
++ BYT_RT5640_MCLK_EN), |
12319 |
+ }, |
12320 |
+ { |
12321 |
+ .matches = { |
12322 |
+diff --git a/sound/soc/intel/boards/kbl_rt5663_rt5514_max98927.c b/sound/soc/intel/boards/kbl_rt5663_rt5514_max98927.c |
12323 |
+index 74dda8784f1a..67b276a65a8d 100644 |
12324 |
+--- a/sound/soc/intel/boards/kbl_rt5663_rt5514_max98927.c |
12325 |
++++ b/sound/soc/intel/boards/kbl_rt5663_rt5514_max98927.c |
12326 |
+@@ -400,6 +400,9 @@ static int kabylake_dmic_startup(struct snd_pcm_substream *substream) |
12327 |
+ snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS, |
12328 |
+ dmic_constraints); |
12329 |
+ |
12330 |
++ runtime->hw.formats = SNDRV_PCM_FMTBIT_S16_LE; |
12331 |
++ snd_pcm_hw_constraint_msbits(runtime, 0, 16, 16); |
12332 |
++ |
12333 |
+ return snd_pcm_hw_constraint_list(substream->runtime, 0, |
12334 |
+ SNDRV_PCM_HW_PARAM_RATE, &constraints_rates); |
12335 |
+ } |
12336 |
+diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c |
12337 |
+index b600d3eaaf5c..a6e96cf1d8ff 100644 |
12338 |
+--- a/sound/soc/soc-pcm.c |
12339 |
++++ b/sound/soc/soc-pcm.c |
12340 |
+@@ -877,6 +877,11 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream, |
12341 |
+ int i, ret = 0; |
12342 |
+ |
12343 |
+ mutex_lock_nested(&rtd->card->pcm_mutex, rtd->card->pcm_subclass); |
12344 |
++ |
12345 |
++ ret = soc_pcm_params_symmetry(substream, params); |
12346 |
++ if (ret) |
12347 |
++ goto out; |
12348 |
++ |
12349 |
+ if (rtd->dai_link->ops->hw_params) { |
12350 |
+ ret = rtd->dai_link->ops->hw_params(substream, params); |
12351 |
+ if (ret < 0) { |
12352 |
+@@ -958,9 +963,6 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream, |
12353 |
+ } |
12354 |
+ component = NULL; |
12355 |
+ |
12356 |
+- ret = soc_pcm_params_symmetry(substream, params); |
12357 |
+- if (ret) |
12358 |
+- goto component_err; |
12359 |
+ out: |
12360 |
+ mutex_unlock(&rtd->card->pcm_mutex); |
12361 |
+ return ret; |
12362 |
+@@ -1385,6 +1387,7 @@ static int dpcm_prune_paths(struct snd_soc_pcm_runtime *fe, int stream, |
12363 |
+ struct snd_soc_dapm_widget *widget; |
12364 |
+ struct snd_soc_dai *dai; |
12365 |
+ int prune = 0; |
12366 |
++ int do_prune; |
12367 |
+ |
12368 |
+ /* Destroy any old FE <--> BE connections */ |
12369 |
+ for_each_dpcm_be(fe, stream, dpcm) { |
12370 |
+@@ -1398,13 +1401,16 @@ static int dpcm_prune_paths(struct snd_soc_pcm_runtime *fe, int stream, |
12371 |
+ continue; |
12372 |
+ |
12373 |
+ /* is there a valid CODEC DAI widget for this BE */ |
12374 |
++ do_prune = 1; |
12375 |
+ for_each_rtd_codec_dai(dpcm->be, i, dai) { |
12376 |
+ widget = dai_get_widget(dai, stream); |
12377 |
+ |
12378 |
+ /* prune the BE if it's no longer in our active list */ |
12379 |
+ if (widget && widget_in_list(list, widget)) |
12380 |
+- continue; |
12381 |
++ do_prune = 0; |
12382 |
+ } |
12383 |
++ if (!do_prune) |
12384 |
++ continue; |
12385 |
+ |
12386 |
+ dev_dbg(fe->dev, "ASoC: pruning %s BE %s for %s\n", |
12387 |
+ stream ? "capture" : "playback", |
12388 |
+diff --git a/sound/soc/sof/imx/Kconfig b/sound/soc/sof/imx/Kconfig |
12389 |
+index 5acae75f5750..71f318bc2c74 100644 |
12390 |
+--- a/sound/soc/sof/imx/Kconfig |
12391 |
++++ b/sound/soc/sof/imx/Kconfig |
12392 |
+@@ -11,8 +11,8 @@ config SND_SOC_SOF_IMX_TOPLEVEL |
12393 |
+ |
12394 |
+ if SND_SOC_SOF_IMX_TOPLEVEL |
12395 |
+ |
12396 |
+-config SND_SOC_SOF_IMX8 |
12397 |
+- tristate "SOF support for i.MX8" |
12398 |
++config SND_SOC_SOF_IMX8_SUPPORT |
12399 |
++ bool "SOF support for i.MX8" |
12400 |
+ depends on IMX_SCU |
12401 |
+ depends on IMX_DSP |
12402 |
+ help |
12403 |
+@@ -20,4 +20,8 @@ config SND_SOC_SOF_IMX8 |
12404 |
+ Say Y if you have such a device. |
12405 |
+ If unsure select "N". |
12406 |
+ |
12407 |
++config SND_SOC_SOF_IMX8 |
12408 |
++ def_tristate SND_SOC_SOF_OF |
12409 |
++ depends on SND_SOC_SOF_IMX8_SUPPORT |
12410 |
++ |
12411 |
+ endif ## SND_SOC_SOF_IMX_IMX_TOPLEVEL |
12412 |
+diff --git a/sound/soc/sof/intel/hda.c b/sound/soc/sof/intel/hda.c |
12413 |
+index 06e84679087b..5a5163eef2ef 100644 |
12414 |
+--- a/sound/soc/sof/intel/hda.c |
12415 |
++++ b/sound/soc/sof/intel/hda.c |
12416 |
+@@ -268,6 +268,7 @@ static int hda_init(struct snd_sof_dev *sdev) |
12417 |
+ |
12418 |
+ bus->use_posbuf = 1; |
12419 |
+ bus->bdl_pos_adj = 0; |
12420 |
++ bus->sync_write = 1; |
12421 |
+ |
12422 |
+ mutex_init(&hbus->prepare_mutex); |
12423 |
+ hbus->pci = pci; |
12424 |
+diff --git a/sound/soc/sof/topology.c b/sound/soc/sof/topology.c |
12425 |
+index 4452594c2e17..fa299e078156 100644 |
12426 |
+--- a/sound/soc/sof/topology.c |
12427 |
++++ b/sound/soc/sof/topology.c |
12428 |
+@@ -2828,6 +2828,10 @@ static int sof_link_load(struct snd_soc_component *scomp, int index, |
12429 |
+ if (!link->no_pcm) { |
12430 |
+ link->nonatomic = true; |
12431 |
+ |
12432 |
++ /* set trigger order */ |
12433 |
++ link->trigger[0] = SND_SOC_DPCM_TRIGGER_POST; |
12434 |
++ link->trigger[1] = SND_SOC_DPCM_TRIGGER_POST; |
12435 |
++ |
12436 |
+ /* nothing more to do for FE dai links */ |
12437 |
+ return 0; |
12438 |
+ } |
12439 |
+diff --git a/tools/arch/x86/lib/x86-opcode-map.txt b/tools/arch/x86/lib/x86-opcode-map.txt |
12440 |
+index e0b85930dd77..0a0e9112f284 100644 |
12441 |
+--- a/tools/arch/x86/lib/x86-opcode-map.txt |
12442 |
++++ b/tools/arch/x86/lib/x86-opcode-map.txt |
12443 |
+@@ -333,7 +333,7 @@ AVXcode: 1 |
12444 |
+ 06: CLTS |
12445 |
+ 07: SYSRET (o64) |
12446 |
+ 08: INVD |
12447 |
+-09: WBINVD |
12448 |
++09: WBINVD | WBNOINVD (F3) |
12449 |
+ 0a: |
12450 |
+ 0b: UD2 (1B) |
12451 |
+ 0c: |
12452 |
+@@ -364,7 +364,7 @@ AVXcode: 1 |
12453 |
+ # a ModR/M byte. |
12454 |
+ 1a: BNDCL Gv,Ev (F3) | BNDCU Gv,Ev (F2) | BNDMOV Gv,Ev (66) | BNDLDX Gv,Ev |
12455 |
+ 1b: BNDCN Gv,Ev (F2) | BNDMOV Ev,Gv (66) | BNDMK Gv,Ev (F3) | BNDSTX Ev,Gv |
12456 |
+-1c: |
12457 |
++1c: Grp20 (1A),(1C) |
12458 |
+ 1d: |
12459 |
+ 1e: |
12460 |
+ 1f: NOP Ev |
12461 |
+@@ -792,6 +792,8 @@ f3: Grp17 (1A) |
12462 |
+ f5: BZHI Gy,Ey,By (v) | PEXT Gy,By,Ey (F3),(v) | PDEP Gy,By,Ey (F2),(v) |
12463 |
+ f6: ADCX Gy,Ey (66) | ADOX Gy,Ey (F3) | MULX By,Gy,rDX,Ey (F2),(v) |
12464 |
+ f7: BEXTR Gy,Ey,By (v) | SHLX Gy,Ey,By (66),(v) | SARX Gy,Ey,By (F3),(v) | SHRX Gy,Ey,By (F2),(v) |
12465 |
++f8: MOVDIR64B Gv,Mdqq (66) | ENQCMD Gv,Mdqq (F2) | ENQCMDS Gv,Mdqq (F3) |
12466 |
++f9: MOVDIRI My,Gy |
12467 |
+ EndTable |
12468 |
+ |
12469 |
+ Table: 3-byte opcode 2 (0x0f 0x3a) |
12470 |
+@@ -943,9 +945,9 @@ GrpTable: Grp6 |
12471 |
+ EndTable |
12472 |
+ |
12473 |
+ GrpTable: Grp7 |
12474 |
+-0: SGDT Ms | VMCALL (001),(11B) | VMLAUNCH (010),(11B) | VMRESUME (011),(11B) | VMXOFF (100),(11B) |
12475 |
+-1: SIDT Ms | MONITOR (000),(11B) | MWAIT (001),(11B) | CLAC (010),(11B) | STAC (011),(11B) |
12476 |
+-2: LGDT Ms | XGETBV (000),(11B) | XSETBV (001),(11B) | VMFUNC (100),(11B) | XEND (101)(11B) | XTEST (110)(11B) |
12477 |
++0: SGDT Ms | VMCALL (001),(11B) | VMLAUNCH (010),(11B) | VMRESUME (011),(11B) | VMXOFF (100),(11B) | PCONFIG (101),(11B) | ENCLV (000),(11B) |
12478 |
++1: SIDT Ms | MONITOR (000),(11B) | MWAIT (001),(11B) | CLAC (010),(11B) | STAC (011),(11B) | ENCLS (111),(11B) |
12479 |
++2: LGDT Ms | XGETBV (000),(11B) | XSETBV (001),(11B) | VMFUNC (100),(11B) | XEND (101)(11B) | XTEST (110)(11B) | ENCLU (111),(11B) |
12480 |
+ 3: LIDT Ms |
12481 |
+ 4: SMSW Mw/Rv |
12482 |
+ 5: rdpkru (110),(11B) | wrpkru (111),(11B) |
12483 |
+@@ -1020,7 +1022,7 @@ GrpTable: Grp15 |
12484 |
+ 3: vstmxcsr Md (v1) | WRGSBASE Ry (F3),(11B) |
12485 |
+ 4: XSAVE | ptwrite Ey (F3),(11B) |
12486 |
+ 5: XRSTOR | lfence (11B) |
12487 |
+-6: XSAVEOPT | clwb (66) | mfence (11B) |
12488 |
++6: XSAVEOPT | clwb (66) | mfence (11B) | TPAUSE Rd (66),(11B) | UMONITOR Rv (F3),(11B) | UMWAIT Rd (F2),(11B) |
12489 |
+ 7: clflush | clflushopt (66) | sfence (11B) |
12490 |
+ EndTable |
12491 |
+ |
12492 |
+@@ -1051,6 +1053,10 @@ GrpTable: Grp19 |
12493 |
+ 6: vscatterpf1qps/d Wx (66),(ev) |
12494 |
+ EndTable |
12495 |
+ |
12496 |
++GrpTable: Grp20 |
12497 |
++0: cldemote Mb |
12498 |
++EndTable |
12499 |
++ |
12500 |
+ # AMD's Prefetch Group |
12501 |
+ GrpTable: GrpP |
12502 |
+ 0: PREFETCH |
12503 |
+diff --git a/tools/bpf/Makefile b/tools/bpf/Makefile |
12504 |
+index 5d1995fd369c..5535650800ab 100644 |
12505 |
+--- a/tools/bpf/Makefile |
12506 |
++++ b/tools/bpf/Makefile |
12507 |
+@@ -16,7 +16,13 @@ CFLAGS += -D__EXPORTED_HEADERS__ -I$(srctree)/include/uapi -I$(srctree)/include |
12508 |
+ # isn't set and when invoked from selftests build, where srctree |
12509 |
+ # is set to ".". building_out_of_srctree is undefined for in srctree |
12510 |
+ # builds |
12511 |
++ifeq ($(srctree),) |
12512 |
++update_srctree := 1 |
12513 |
++endif |
12514 |
+ ifndef building_out_of_srctree |
12515 |
++update_srctree := 1 |
12516 |
++endif |
12517 |
++ifeq ($(update_srctree),1) |
12518 |
+ srctree := $(patsubst %/,%,$(dir $(CURDIR))) |
12519 |
+ srctree := $(patsubst %/,%,$(dir $(srctree))) |
12520 |
+ endif |
12521 |
+diff --git a/tools/lib/bpf/btf_dump.c b/tools/lib/bpf/btf_dump.c |
12522 |
+index ede55fec3618..87f27e2664c5 100644 |
12523 |
+--- a/tools/lib/bpf/btf_dump.c |
12524 |
++++ b/tools/lib/bpf/btf_dump.c |
12525 |
+@@ -876,7 +876,6 @@ static void btf_dump_emit_struct_def(struct btf_dump *d, |
12526 |
+ __u16 vlen = btf_vlen(t); |
12527 |
+ |
12528 |
+ packed = is_struct ? btf_is_struct_packed(d->btf, id, t) : 0; |
12529 |
+- align = packed ? 1 : btf_align_of(d->btf, id); |
12530 |
+ |
12531 |
+ btf_dump_printf(d, "%s%s%s {", |
12532 |
+ is_struct ? "struct" : "union", |
12533 |
+@@ -906,6 +905,13 @@ static void btf_dump_emit_struct_def(struct btf_dump *d, |
12534 |
+ btf_dump_printf(d, ";"); |
12535 |
+ } |
12536 |
+ |
12537 |
++ /* pad at the end, if necessary */ |
12538 |
++ if (is_struct) { |
12539 |
++ align = packed ? 1 : btf_align_of(d->btf, id); |
12540 |
++ btf_dump_emit_bit_padding(d, off, t->size * 8, 0, align, |
12541 |
++ lvl + 1); |
12542 |
++ } |
12543 |
++ |
12544 |
+ if (vlen) |
12545 |
+ btf_dump_printf(d, "\n"); |
12546 |
+ btf_dump_printf(d, "%s}", pfx(lvl)); |
12547 |
+diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c |
12548 |
+index e0276520171b..a267cd0c0ce2 100644 |
12549 |
+--- a/tools/lib/bpf/libbpf.c |
12550 |
++++ b/tools/lib/bpf/libbpf.c |
12551 |
+@@ -1897,16 +1897,22 @@ int bpf_map__reuse_fd(struct bpf_map *map, int fd) |
12552 |
+ return -errno; |
12553 |
+ |
12554 |
+ new_fd = open("/", O_RDONLY | O_CLOEXEC); |
12555 |
+- if (new_fd < 0) |
12556 |
++ if (new_fd < 0) { |
12557 |
++ err = -errno; |
12558 |
+ goto err_free_new_name; |
12559 |
++ } |
12560 |
+ |
12561 |
+ new_fd = dup3(fd, new_fd, O_CLOEXEC); |
12562 |
+- if (new_fd < 0) |
12563 |
++ if (new_fd < 0) { |
12564 |
++ err = -errno; |
12565 |
+ goto err_close_new_fd; |
12566 |
++ } |
12567 |
+ |
12568 |
+ err = zclose(map->fd); |
12569 |
+- if (err) |
12570 |
++ if (err) { |
12571 |
++ err = -errno; |
12572 |
+ goto err_close_new_fd; |
12573 |
++ } |
12574 |
+ free(map->name); |
12575 |
+ |
12576 |
+ map->fd = new_fd; |
12577 |
+@@ -1925,7 +1931,7 @@ err_close_new_fd: |
12578 |
+ close(new_fd); |
12579 |
+ err_free_new_name: |
12580 |
+ free(new_name); |
12581 |
+- return -errno; |
12582 |
++ return err; |
12583 |
+ } |
12584 |
+ |
12585 |
+ int bpf_map__resize(struct bpf_map *map, __u32 max_entries) |
12586 |
+diff --git a/tools/lib/bpf/xsk.c b/tools/lib/bpf/xsk.c |
12587 |
+index a902838f9fcc..70f9e10de286 100644 |
12588 |
+--- a/tools/lib/bpf/xsk.c |
12589 |
++++ b/tools/lib/bpf/xsk.c |
12590 |
+@@ -163,6 +163,7 @@ int xsk_umem__create_v0_0_4(struct xsk_umem **umem_ptr, void *umem_area, |
12591 |
+ umem->umem_area = umem_area; |
12592 |
+ xsk_set_umem_config(&umem->config, usr_config); |
12593 |
+ |
12594 |
++ memset(&mr, 0, sizeof(mr)); |
12595 |
+ mr.addr = (uintptr_t)umem_area; |
12596 |
+ mr.len = size; |
12597 |
+ mr.chunk_size = umem->config.frame_size; |
12598 |
+@@ -343,13 +344,18 @@ static int xsk_get_max_queues(struct xsk_socket *xsk) |
12599 |
+ goto out; |
12600 |
+ } |
12601 |
+ |
12602 |
+- if (err || channels.max_combined == 0) |
12603 |
++ if (err) { |
12604 |
+ /* If the device says it has no channels, then all traffic |
12605 |
+ * is sent to a single stream, so max queues = 1. |
12606 |
+ */ |
12607 |
+ ret = 1; |
12608 |
+- else |
12609 |
+- ret = channels.max_combined; |
12610 |
++ } else { |
12611 |
++ /* Take the max of rx, tx, combined. Drivers return |
12612 |
++ * the number of channels in different ways. |
12613 |
++ */ |
12614 |
++ ret = max(channels.max_rx, channels.max_tx); |
12615 |
++ ret = max(ret, (int)channels.max_combined); |
12616 |
++ } |
12617 |
+ |
12618 |
+ out: |
12619 |
+ close(fd); |
12620 |
+@@ -465,6 +471,8 @@ static int xsk_setup_xdp_prog(struct xsk_socket *xsk) |
12621 |
+ } |
12622 |
+ } else { |
12623 |
+ xsk->prog_fd = bpf_prog_get_fd_by_id(prog_id); |
12624 |
++ if (xsk->prog_fd < 0) |
12625 |
++ return -errno; |
12626 |
+ err = xsk_lookup_bpf_maps(xsk); |
12627 |
+ if (err) { |
12628 |
+ close(xsk->prog_fd); |
12629 |
+diff --git a/tools/lib/subcmd/Makefile b/tools/lib/subcmd/Makefile |
12630 |
+index 5b2cd5e58df0..5dbb0dde208c 100644 |
12631 |
+--- a/tools/lib/subcmd/Makefile |
12632 |
++++ b/tools/lib/subcmd/Makefile |
12633 |
+@@ -28,7 +28,9 @@ ifeq ($(DEBUG),0) |
12634 |
+ endif |
12635 |
+ endif |
12636 |
+ |
12637 |
+-ifeq ($(CC_NO_CLANG), 0) |
12638 |
++ifeq ($(DEBUG),1) |
12639 |
++ CFLAGS += -O0 |
12640 |
++else ifeq ($(CC_NO_CLANG), 0) |
12641 |
+ CFLAGS += -O3 |
12642 |
+ else |
12643 |
+ CFLAGS += -O6 |
12644 |
+diff --git a/tools/lib/traceevent/parse-filter.c b/tools/lib/traceevent/parse-filter.c |
12645 |
+index 552592d153fb..f3cbf86e51ac 100644 |
12646 |
+--- a/tools/lib/traceevent/parse-filter.c |
12647 |
++++ b/tools/lib/traceevent/parse-filter.c |
12648 |
+@@ -1473,8 +1473,10 @@ static int copy_filter_type(struct tep_event_filter *filter, |
12649 |
+ if (strcmp(str, "TRUE") == 0 || strcmp(str, "FALSE") == 0) { |
12650 |
+ /* Add trivial event */ |
12651 |
+ arg = allocate_arg(); |
12652 |
+- if (arg == NULL) |
12653 |
++ if (arg == NULL) { |
12654 |
++ free(str); |
12655 |
+ return -1; |
12656 |
++ } |
12657 |
+ |
12658 |
+ arg->type = TEP_FILTER_ARG_BOOLEAN; |
12659 |
+ if (strcmp(str, "TRUE") == 0) |
12660 |
+@@ -1483,8 +1485,11 @@ static int copy_filter_type(struct tep_event_filter *filter, |
12661 |
+ arg->boolean.value = 0; |
12662 |
+ |
12663 |
+ filter_type = add_filter_type(filter, event->id); |
12664 |
+- if (filter_type == NULL) |
12665 |
++ if (filter_type == NULL) { |
12666 |
++ free(str); |
12667 |
++ free_arg(arg); |
12668 |
+ return -1; |
12669 |
++ } |
12670 |
+ |
12671 |
+ filter_type->filter = arg; |
12672 |
+ |
12673 |
+diff --git a/tools/memory-model/linux-kernel.cat b/tools/memory-model/linux-kernel.cat |
12674 |
+index ea2ff4b94074..2a9b4fe4a84e 100644 |
12675 |
+--- a/tools/memory-model/linux-kernel.cat |
12676 |
++++ b/tools/memory-model/linux-kernel.cat |
12677 |
+@@ -197,7 +197,7 @@ empty (wr-incoh | rw-incoh | ww-incoh) as plain-coherence |
12678 |
+ (* Actual races *) |
12679 |
+ let ww-nonrace = ww-vis & ((Marked * W) | rw-xbstar) & ((W * Marked) | wr-vis) |
12680 |
+ let ww-race = (pre-race & co) \ ww-nonrace |
12681 |
+-let wr-race = (pre-race & (co? ; rf)) \ wr-vis |
12682 |
++let wr-race = (pre-race & (co? ; rf)) \ wr-vis \ rw-xbstar^-1 |
12683 |
+ let rw-race = (pre-race & fr) \ rw-xbstar |
12684 |
+ |
12685 |
+ flag ~empty (ww-race | wr-race | rw-race) as data-race |
12686 |
+diff --git a/tools/objtool/check.c b/tools/objtool/check.c |
12687 |
+index 044c9a3cb247..f53d3c515cdc 100644 |
12688 |
+--- a/tools/objtool/check.c |
12689 |
++++ b/tools/objtool/check.c |
12690 |
+@@ -481,6 +481,7 @@ static const char *uaccess_safe_builtin[] = { |
12691 |
+ "ubsan_type_mismatch_common", |
12692 |
+ "__ubsan_handle_type_mismatch", |
12693 |
+ "__ubsan_handle_type_mismatch_v1", |
12694 |
++ "__ubsan_handle_shift_out_of_bounds", |
12695 |
+ /* misc */ |
12696 |
+ "csum_partial_copy_generic", |
12697 |
+ "__memcpy_mcsafe", |
12698 |
+diff --git a/tools/perf/arch/arm64/util/sym-handling.c b/tools/perf/arch/arm64/util/sym-handling.c |
12699 |
+index 5df788985130..8dfa3e5229f1 100644 |
12700 |
+--- a/tools/perf/arch/arm64/util/sym-handling.c |
12701 |
++++ b/tools/perf/arch/arm64/util/sym-handling.c |
12702 |
+@@ -6,9 +6,10 @@ |
12703 |
+ |
12704 |
+ #include "symbol.h" // for the elf__needs_adjust_symbols() prototype |
12705 |
+ #include <stdbool.h> |
12706 |
+-#include <gelf.h> |
12707 |
+ |
12708 |
+ #ifdef HAVE_LIBELF_SUPPORT |
12709 |
++#include <gelf.h> |
12710 |
++ |
12711 |
+ bool elf__needs_adjust_symbols(GElf_Ehdr ehdr) |
12712 |
+ { |
12713 |
+ return ehdr.e_type == ET_EXEC || |
12714 |
+diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c |
12715 |
+index aae0e57c60fb..7accaf8ef689 100644 |
12716 |
+--- a/tools/perf/builtin-report.c |
12717 |
++++ b/tools/perf/builtin-report.c |
12718 |
+@@ -399,6 +399,13 @@ static int report__setup_sample_type(struct report *rep) |
12719 |
+ PERF_SAMPLE_BRANCH_ANY)) |
12720 |
+ rep->nonany_branch_mode = true; |
12721 |
+ |
12722 |
++#ifndef HAVE_LIBUNWIND_SUPPORT |
12723 |
++ if (dwarf_callchain_users) { |
12724 |
++ ui__warning("Please install libunwind development packages " |
12725 |
++ "during the perf build.\n"); |
12726 |
++ } |
12727 |
++#endif |
12728 |
++ |
12729 |
+ return 0; |
12730 |
+ } |
12731 |
+ |
12732 |
+diff --git a/tools/perf/pmu-events/arch/arm64/hisilicon/hip08/uncore-ddrc.json b/tools/perf/pmu-events/arch/arm64/hisilicon/hip08/uncore-ddrc.json |
12733 |
+index 0d1556fcdffe..99f4fc425564 100644 |
12734 |
+--- a/tools/perf/pmu-events/arch/arm64/hisilicon/hip08/uncore-ddrc.json |
12735 |
++++ b/tools/perf/pmu-events/arch/arm64/hisilicon/hip08/uncore-ddrc.json |
12736 |
+@@ -15,7 +15,7 @@ |
12737 |
+ }, |
12738 |
+ { |
12739 |
+ "EventCode": "0x04", |
12740 |
+- "EventName": "uncore_hisi_ddrc.flux_wr", |
12741 |
++ "EventName": "uncore_hisi_ddrc.pre_cmd", |
12742 |
+ "BriefDescription": "DDRC precharge commands", |
12743 |
+ "PublicDescription": "DDRC precharge commands", |
12744 |
+ "Unit": "hisi_sccl,ddrc", |
12745 |
+diff --git a/tools/perf/pmu-events/jevents.c b/tools/perf/pmu-events/jevents.c |
12746 |
+index e2837260ca4d..99e3fd04a5cb 100644 |
12747 |
+--- a/tools/perf/pmu-events/jevents.c |
12748 |
++++ b/tools/perf/pmu-events/jevents.c |
12749 |
+@@ -758,6 +758,7 @@ static int process_mapfile(FILE *outfp, char *fpath) |
12750 |
+ char *line, *p; |
12751 |
+ int line_num; |
12752 |
+ char *tblname; |
12753 |
++ int ret = 0; |
12754 |
+ |
12755 |
+ pr_info("%s: Processing mapfile %s\n", prog, fpath); |
12756 |
+ |
12757 |
+@@ -769,6 +770,7 @@ static int process_mapfile(FILE *outfp, char *fpath) |
12758 |
+ if (!mapfp) { |
12759 |
+ pr_info("%s: Error %s opening %s\n", prog, strerror(errno), |
12760 |
+ fpath); |
12761 |
++ free(line); |
12762 |
+ return -1; |
12763 |
+ } |
12764 |
+ |
12765 |
+@@ -795,7 +797,8 @@ static int process_mapfile(FILE *outfp, char *fpath) |
12766 |
+ /* TODO Deal with lines longer than 16K */ |
12767 |
+ pr_info("%s: Mapfile %s: line %d too long, aborting\n", |
12768 |
+ prog, fpath, line_num); |
12769 |
+- return -1; |
12770 |
++ ret = -1; |
12771 |
++ goto out; |
12772 |
+ } |
12773 |
+ line[strlen(line)-1] = '\0'; |
12774 |
+ |
12775 |
+@@ -825,7 +828,9 @@ static int process_mapfile(FILE *outfp, char *fpath) |
12776 |
+ |
12777 |
+ out: |
12778 |
+ print_mapping_table_suffix(outfp); |
12779 |
+- return 0; |
12780 |
++ fclose(mapfp); |
12781 |
++ free(line); |
12782 |
++ return ret; |
12783 |
+ } |
12784 |
+ |
12785 |
+ /* |
12786 |
+@@ -1122,6 +1127,7 @@ int main(int argc, char *argv[]) |
12787 |
+ goto empty_map; |
12788 |
+ } else if (rc < 0) { |
12789 |
+ /* Make build fail */ |
12790 |
++ fclose(eventsfp); |
12791 |
+ free_arch_std_events(); |
12792 |
+ return 1; |
12793 |
+ } else if (rc) { |
12794 |
+@@ -1134,6 +1140,7 @@ int main(int argc, char *argv[]) |
12795 |
+ goto empty_map; |
12796 |
+ } else if (rc < 0) { |
12797 |
+ /* Make build fail */ |
12798 |
++ fclose(eventsfp); |
12799 |
+ free_arch_std_events(); |
12800 |
+ return 1; |
12801 |
+ } else if (rc) { |
12802 |
+@@ -1151,6 +1158,8 @@ int main(int argc, char *argv[]) |
12803 |
+ if (process_mapfile(eventsfp, mapfile)) { |
12804 |
+ pr_info("%s: Error processing mapfile %s\n", prog, mapfile); |
12805 |
+ /* Make build fail */ |
12806 |
++ fclose(eventsfp); |
12807 |
++ free_arch_std_events(); |
12808 |
+ return 1; |
12809 |
+ } |
12810 |
+ |
12811 |
+diff --git a/tools/perf/tests/bp_signal.c b/tools/perf/tests/bp_signal.c |
12812 |
+index c1c2c13de254..166f411568a5 100644 |
12813 |
+--- a/tools/perf/tests/bp_signal.c |
12814 |
++++ b/tools/perf/tests/bp_signal.c |
12815 |
+@@ -49,14 +49,6 @@ asm ( |
12816 |
+ "__test_function:\n" |
12817 |
+ "incq (%rdi)\n" |
12818 |
+ "ret\n"); |
12819 |
+-#elif defined (__aarch64__) |
12820 |
+-extern void __test_function(volatile long *ptr); |
12821 |
+-asm ( |
12822 |
+- ".globl __test_function\n" |
12823 |
+- "__test_function:\n" |
12824 |
+- "str x30, [x0]\n" |
12825 |
+- "ret\n"); |
12826 |
+- |
12827 |
+ #else |
12828 |
+ static void __test_function(volatile long *ptr) |
12829 |
+ { |
12830 |
+@@ -302,10 +294,15 @@ bool test__bp_signal_is_supported(void) |
12831 |
+ * stepping into the SIGIO handler and getting stuck on the |
12832 |
+ * breakpointed instruction. |
12833 |
+ * |
12834 |
++ * Since arm64 has the same issue with arm for the single-step |
12835 |
++ * handling, this case also gets suck on the breakpointed |
12836 |
++ * instruction. |
12837 |
++ * |
12838 |
+ * Just disable the test for these architectures until these |
12839 |
+ * issues are resolved. |
12840 |
+ */ |
12841 |
+-#if defined(__powerpc__) || defined(__s390x__) || defined(__arm__) |
12842 |
++#if defined(__powerpc__) || defined(__s390x__) || defined(__arm__) || \ |
12843 |
++ defined(__aarch64__) |
12844 |
+ return false; |
12845 |
+ #else |
12846 |
+ return true; |
12847 |
+diff --git a/tools/perf/tests/task-exit.c b/tools/perf/tests/task-exit.c |
12848 |
+index bce3a4cb4c89..d85c9f608564 100644 |
12849 |
+--- a/tools/perf/tests/task-exit.c |
12850 |
++++ b/tools/perf/tests/task-exit.c |
12851 |
+@@ -53,6 +53,7 @@ int test__task_exit(struct test *test __maybe_unused, int subtest __maybe_unused |
12852 |
+ struct perf_cpu_map *cpus; |
12853 |
+ struct perf_thread_map *threads; |
12854 |
+ struct mmap *md; |
12855 |
++ int retry_count = 0; |
12856 |
+ |
12857 |
+ signal(SIGCHLD, sig_handler); |
12858 |
+ |
12859 |
+@@ -110,6 +111,7 @@ int test__task_exit(struct test *test __maybe_unused, int subtest __maybe_unused |
12860 |
+ if (evlist__mmap(evlist, 128) < 0) { |
12861 |
+ pr_debug("failed to mmap events: %d (%s)\n", errno, |
12862 |
+ str_error_r(errno, sbuf, sizeof(sbuf))); |
12863 |
++ err = -1; |
12864 |
+ goto out_delete_evlist; |
12865 |
+ } |
12866 |
+ |
12867 |
+@@ -131,6 +133,13 @@ retry: |
12868 |
+ out_init: |
12869 |
+ if (!exited || !nr_exit) { |
12870 |
+ evlist__poll(evlist, -1); |
12871 |
++ |
12872 |
++ if (retry_count++ > 1000) { |
12873 |
++ pr_debug("Failed after retrying 1000 times\n"); |
12874 |
++ err = -1; |
12875 |
++ goto out_free_maps; |
12876 |
++ } |
12877 |
++ |
12878 |
+ goto retry; |
12879 |
+ } |
12880 |
+ |
12881 |
+diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c |
12882 |
+index 4ba0f871f086..f5f855fff412 100644 |
12883 |
+--- a/tools/perf/util/cs-etm.c |
12884 |
++++ b/tools/perf/util/cs-etm.c |
12885 |
+@@ -110,7 +110,7 @@ static int cs_etm__decode_data_block(struct cs_etm_queue *etmq); |
12886 |
+ * encode the etm queue number as the upper 16 bit and the channel as |
12887 |
+ * the lower 16 bit. |
12888 |
+ */ |
12889 |
+-#define TO_CS_QUEUE_NR(queue_nr, trace_id_chan) \ |
12890 |
++#define TO_CS_QUEUE_NR(queue_nr, trace_chan_id) \ |
12891 |
+ (queue_nr << 16 | trace_chan_id) |
12892 |
+ #define TO_QUEUE_NR(cs_queue_nr) (cs_queue_nr >> 16) |
12893 |
+ #define TO_TRACE_CHAN_ID(cs_queue_nr) (cs_queue_nr & 0x0000ffff) |
12894 |
+@@ -819,7 +819,7 @@ static int cs_etm__setup_queue(struct cs_etm_auxtrace *etm, |
12895 |
+ * Note that packets decoded above are still in the traceID's packet |
12896 |
+ * queue and will be processed in cs_etm__process_queues(). |
12897 |
+ */ |
12898 |
+- cs_queue_nr = TO_CS_QUEUE_NR(queue_nr, trace_id_chan); |
12899 |
++ cs_queue_nr = TO_CS_QUEUE_NR(queue_nr, trace_chan_id); |
12900 |
+ ret = auxtrace_heap__add(&etm->heap, cs_queue_nr, timestamp); |
12901 |
+ out: |
12902 |
+ return ret; |
12903 |
+diff --git a/tools/perf/util/dwarf-aux.c b/tools/perf/util/dwarf-aux.c |
12904 |
+index df6cee5c071f..5544bfbd0f6c 100644 |
12905 |
+--- a/tools/perf/util/dwarf-aux.c |
12906 |
++++ b/tools/perf/util/dwarf-aux.c |
12907 |
+@@ -307,21 +307,51 @@ bool die_is_func_def(Dwarf_Die *dw_die) |
12908 |
+ dwarf_attr(dw_die, DW_AT_declaration, &attr) == NULL); |
12909 |
+ } |
12910 |
+ |
12911 |
++/** |
12912 |
++ * die_entrypc - Returns entry PC (the lowest address) of a DIE |
12913 |
++ * @dw_die: a DIE |
12914 |
++ * @addr: where to store entry PC |
12915 |
++ * |
12916 |
++ * Since dwarf_entrypc() does not return entry PC if the DIE has only address |
12917 |
++ * range, we have to use this to retrieve the lowest address from the address |
12918 |
++ * range attribute. |
12919 |
++ */ |
12920 |
++int die_entrypc(Dwarf_Die *dw_die, Dwarf_Addr *addr) |
12921 |
++{ |
12922 |
++ Dwarf_Addr base, end; |
12923 |
++ |
12924 |
++ if (!addr) |
12925 |
++ return -EINVAL; |
12926 |
++ |
12927 |
++ if (dwarf_entrypc(dw_die, addr) == 0) |
12928 |
++ return 0; |
12929 |
++ |
12930 |
++ return dwarf_ranges(dw_die, 0, &base, addr, &end) < 0 ? -ENOENT : 0; |
12931 |
++} |
12932 |
++ |
12933 |
+ /** |
12934 |
+ * die_is_func_instance - Ensure that this DIE is an instance of a subprogram |
12935 |
+ * @dw_die: a DIE |
12936 |
+ * |
12937 |
+ * Ensure that this DIE is an instance (which has an entry address). |
12938 |
+- * This returns true if @dw_die is a function instance. If not, you need to |
12939 |
+- * call die_walk_instances() to find actual instances. |
12940 |
++ * This returns true if @dw_die is a function instance. If not, the @dw_die |
12941 |
++ * must be a prototype. You can use die_walk_instances() to find actual |
12942 |
++ * instances. |
12943 |
+ **/ |
12944 |
+ bool die_is_func_instance(Dwarf_Die *dw_die) |
12945 |
+ { |
12946 |
+ Dwarf_Addr tmp; |
12947 |
++ Dwarf_Attribute attr_mem; |
12948 |
++ int tag = dwarf_tag(dw_die); |
12949 |
+ |
12950 |
+- /* Actually gcc optimizes non-inline as like as inlined */ |
12951 |
+- return !dwarf_func_inline(dw_die) && dwarf_entrypc(dw_die, &tmp) == 0; |
12952 |
++ if (tag != DW_TAG_subprogram && |
12953 |
++ tag != DW_TAG_inlined_subroutine) |
12954 |
++ return false; |
12955 |
++ |
12956 |
++ return dwarf_entrypc(dw_die, &tmp) == 0 || |
12957 |
++ dwarf_attr(dw_die, DW_AT_ranges, &attr_mem) != NULL; |
12958 |
+ } |
12959 |
++ |
12960 |
+ /** |
12961 |
+ * die_get_data_member_location - Get the data-member offset |
12962 |
+ * @mb_die: a DIE of a member of a data structure |
12963 |
+@@ -598,6 +628,9 @@ static int __die_walk_instances_cb(Dwarf_Die *inst, void *data) |
12964 |
+ Dwarf_Die *origin; |
12965 |
+ int tmp; |
12966 |
+ |
12967 |
++ if (!die_is_func_instance(inst)) |
12968 |
++ return DIE_FIND_CB_CONTINUE; |
12969 |
++ |
12970 |
+ attr = dwarf_attr(inst, DW_AT_abstract_origin, &attr_mem); |
12971 |
+ if (attr == NULL) |
12972 |
+ return DIE_FIND_CB_CONTINUE; |
12973 |
+@@ -669,15 +702,14 @@ static int __die_walk_funclines_cb(Dwarf_Die *in_die, void *data) |
12974 |
+ if (dwarf_tag(in_die) == DW_TAG_inlined_subroutine) { |
12975 |
+ fname = die_get_call_file(in_die); |
12976 |
+ lineno = die_get_call_lineno(in_die); |
12977 |
+- if (fname && lineno > 0 && dwarf_entrypc(in_die, &addr) == 0) { |
12978 |
++ if (fname && lineno > 0 && die_entrypc(in_die, &addr) == 0) { |
12979 |
+ lw->retval = lw->callback(fname, lineno, addr, lw->data); |
12980 |
+ if (lw->retval != 0) |
12981 |
+ return DIE_FIND_CB_END; |
12982 |
+ } |
12983 |
++ if (!lw->recursive) |
12984 |
++ return DIE_FIND_CB_SIBLING; |
12985 |
+ } |
12986 |
+- if (!lw->recursive) |
12987 |
+- /* Don't need to search recursively */ |
12988 |
+- return DIE_FIND_CB_SIBLING; |
12989 |
+ |
12990 |
+ if (addr) { |
12991 |
+ fname = dwarf_decl_file(in_die); |
12992 |
+@@ -710,7 +742,7 @@ static int __die_walk_funclines(Dwarf_Die *sp_die, bool recursive, |
12993 |
+ /* Handle function declaration line */ |
12994 |
+ fname = dwarf_decl_file(sp_die); |
12995 |
+ if (fname && dwarf_decl_line(sp_die, &lineno) == 0 && |
12996 |
+- dwarf_entrypc(sp_die, &addr) == 0) { |
12997 |
++ die_entrypc(sp_die, &addr) == 0) { |
12998 |
+ lw.retval = callback(fname, lineno, addr, data); |
12999 |
+ if (lw.retval != 0) |
13000 |
+ goto done; |
13001 |
+@@ -724,6 +756,10 @@ static int __die_walk_culines_cb(Dwarf_Die *sp_die, void *data) |
13002 |
+ { |
13003 |
+ struct __line_walk_param *lw = data; |
13004 |
+ |
13005 |
++ /* |
13006 |
++ * Since inlined function can include another inlined function in |
13007 |
++ * the same file, we need to walk in it recursively. |
13008 |
++ */ |
13009 |
+ lw->retval = __die_walk_funclines(sp_die, true, lw->callback, lw->data); |
13010 |
+ if (lw->retval != 0) |
13011 |
+ return DWARF_CB_ABORT; |
13012 |
+@@ -748,11 +784,12 @@ int die_walk_lines(Dwarf_Die *rt_die, line_walk_callback_t callback, void *data) |
13013 |
+ Dwarf_Lines *lines; |
13014 |
+ Dwarf_Line *line; |
13015 |
+ Dwarf_Addr addr; |
13016 |
+- const char *fname, *decf = NULL; |
13017 |
++ const char *fname, *decf = NULL, *inf = NULL; |
13018 |
+ int lineno, ret = 0; |
13019 |
+ int decl = 0, inl; |
13020 |
+ Dwarf_Die die_mem, *cu_die; |
13021 |
+ size_t nlines, i; |
13022 |
++ bool flag; |
13023 |
+ |
13024 |
+ /* Get the CU die */ |
13025 |
+ if (dwarf_tag(rt_die) != DW_TAG_compile_unit) { |
13026 |
+@@ -783,6 +820,12 @@ int die_walk_lines(Dwarf_Die *rt_die, line_walk_callback_t callback, void *data) |
13027 |
+ "Possible error in debuginfo.\n"); |
13028 |
+ continue; |
13029 |
+ } |
13030 |
++ /* Skip end-of-sequence */ |
13031 |
++ if (dwarf_lineendsequence(line, &flag) != 0 || flag) |
13032 |
++ continue; |
13033 |
++ /* Skip Non statement line-info */ |
13034 |
++ if (dwarf_linebeginstatement(line, &flag) != 0 || !flag) |
13035 |
++ continue; |
13036 |
+ /* Filter lines based on address */ |
13037 |
+ if (rt_die != cu_die) { |
13038 |
+ /* |
13039 |
+@@ -792,13 +835,21 @@ int die_walk_lines(Dwarf_Die *rt_die, line_walk_callback_t callback, void *data) |
13040 |
+ */ |
13041 |
+ if (!dwarf_haspc(rt_die, addr)) |
13042 |
+ continue; |
13043 |
++ |
13044 |
+ if (die_find_inlinefunc(rt_die, addr, &die_mem)) { |
13045 |
++ /* Call-site check */ |
13046 |
++ inf = die_get_call_file(&die_mem); |
13047 |
++ if ((inf && !strcmp(inf, decf)) && |
13048 |
++ die_get_call_lineno(&die_mem) == lineno) |
13049 |
++ goto found; |
13050 |
++ |
13051 |
+ dwarf_decl_line(&die_mem, &inl); |
13052 |
+ if (inl != decl || |
13053 |
+ decf != dwarf_decl_file(&die_mem)) |
13054 |
+ continue; |
13055 |
+ } |
13056 |
+ } |
13057 |
++found: |
13058 |
+ /* Get source line */ |
13059 |
+ fname = dwarf_linesrc(line, NULL, NULL); |
13060 |
+ |
13061 |
+@@ -813,8 +864,9 @@ int die_walk_lines(Dwarf_Die *rt_die, line_walk_callback_t callback, void *data) |
13062 |
+ */ |
13063 |
+ if (rt_die != cu_die) |
13064 |
+ /* |
13065 |
+- * Don't need walk functions recursively, because nested |
13066 |
+- * inlined functions don't have lines of the specified DIE. |
13067 |
++ * Don't need walk inlined functions recursively, because |
13068 |
++ * inner inlined functions don't have the lines of the |
13069 |
++ * specified function. |
13070 |
+ */ |
13071 |
+ ret = __die_walk_funclines(rt_die, false, callback, data); |
13072 |
+ else { |
13073 |
+@@ -989,7 +1041,7 @@ static int die_get_var_innermost_scope(Dwarf_Die *sp_die, Dwarf_Die *vr_die, |
13074 |
+ bool first = true; |
13075 |
+ const char *name; |
13076 |
+ |
13077 |
+- ret = dwarf_entrypc(sp_die, &entry); |
13078 |
++ ret = die_entrypc(sp_die, &entry); |
13079 |
+ if (ret) |
13080 |
+ return ret; |
13081 |
+ |
13082 |
+@@ -1052,7 +1104,7 @@ int die_get_var_range(Dwarf_Die *sp_die, Dwarf_Die *vr_die, struct strbuf *buf) |
13083 |
+ bool first = true; |
13084 |
+ const char *name; |
13085 |
+ |
13086 |
+- ret = dwarf_entrypc(sp_die, &entry); |
13087 |
++ ret = die_entrypc(sp_die, &entry); |
13088 |
+ if (ret) |
13089 |
+ return ret; |
13090 |
+ |
13091 |
+diff --git a/tools/perf/util/dwarf-aux.h b/tools/perf/util/dwarf-aux.h |
13092 |
+index f204e5892403..506006e0cf66 100644 |
13093 |
+--- a/tools/perf/util/dwarf-aux.h |
13094 |
++++ b/tools/perf/util/dwarf-aux.h |
13095 |
+@@ -29,6 +29,9 @@ int cu_walk_functions_at(Dwarf_Die *cu_die, Dwarf_Addr addr, |
13096 |
+ /* Get DW_AT_linkage_name (should be NULL for C binary) */ |
13097 |
+ const char *die_get_linkage_name(Dwarf_Die *dw_die); |
13098 |
+ |
13099 |
++/* Get the lowest PC in DIE (including range list) */ |
13100 |
++int die_entrypc(Dwarf_Die *dw_die, Dwarf_Addr *addr); |
13101 |
++ |
13102 |
+ /* Ensure that this DIE is a subprogram and definition (not declaration) */ |
13103 |
+ bool die_is_func_def(Dwarf_Die *dw_die); |
13104 |
+ |
13105 |
+diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c |
13106 |
+index b5e2adef49de..422ad1888e74 100644 |
13107 |
+--- a/tools/perf/util/parse-events.c |
13108 |
++++ b/tools/perf/util/parse-events.c |
13109 |
+@@ -1365,8 +1365,15 @@ int parse_events_add_pmu(struct parse_events_state *parse_state, |
13110 |
+ if (get_config_terms(head_config, &config_terms)) |
13111 |
+ return -ENOMEM; |
13112 |
+ |
13113 |
+- if (perf_pmu__config(pmu, &attr, head_config, parse_state->error)) |
13114 |
++ if (perf_pmu__config(pmu, &attr, head_config, parse_state->error)) { |
13115 |
++ struct perf_evsel_config_term *pos, *tmp; |
13116 |
++ |
13117 |
++ list_for_each_entry_safe(pos, tmp, &config_terms, list) { |
13118 |
++ list_del_init(&pos->list); |
13119 |
++ free(pos); |
13120 |
++ } |
13121 |
+ return -EINVAL; |
13122 |
++ } |
13123 |
+ |
13124 |
+ evsel = __add_event(list, &parse_state->idx, &attr, |
13125 |
+ get_config_name(head_config), pmu, |
13126 |
+@@ -1927,15 +1934,20 @@ int parse_events(struct evlist *evlist, const char *str, |
13127 |
+ |
13128 |
+ ret = parse_events__scanner(str, &parse_state, PE_START_EVENTS); |
13129 |
+ perf_pmu__parse_cleanup(); |
13130 |
++ |
13131 |
++ if (!ret && list_empty(&parse_state.list)) { |
13132 |
++ WARN_ONCE(true, "WARNING: event parser found nothing\n"); |
13133 |
++ return -1; |
13134 |
++ } |
13135 |
++ |
13136 |
++ /* |
13137 |
++ * Add list to the evlist even with errors to allow callers to clean up. |
13138 |
++ */ |
13139 |
++ perf_evlist__splice_list_tail(evlist, &parse_state.list); |
13140 |
++ |
13141 |
+ if (!ret) { |
13142 |
+ struct evsel *last; |
13143 |
+ |
13144 |
+- if (list_empty(&parse_state.list)) { |
13145 |
+- WARN_ONCE(true, "WARNING: event parser found nothing\n"); |
13146 |
+- return -1; |
13147 |
+- } |
13148 |
+- |
13149 |
+- perf_evlist__splice_list_tail(evlist, &parse_state.list); |
13150 |
+ evlist->nr_groups += parse_state.nr_groups; |
13151 |
+ last = evlist__last(evlist); |
13152 |
+ last->cmdline_group_boundary = true; |
13153 |
+diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c |
13154 |
+index cd9f95e5044e..08cccd86447c 100644 |
13155 |
+--- a/tools/perf/util/probe-finder.c |
13156 |
++++ b/tools/perf/util/probe-finder.c |
13157 |
+@@ -756,6 +756,16 @@ static int find_best_scope_cb(Dwarf_Die *fn_die, void *data) |
13158 |
+ return 0; |
13159 |
+ } |
13160 |
+ |
13161 |
++/* Return innermost DIE */ |
13162 |
++static int find_inner_scope_cb(Dwarf_Die *fn_die, void *data) |
13163 |
++{ |
13164 |
++ struct find_scope_param *fsp = data; |
13165 |
++ |
13166 |
++ memcpy(fsp->die_mem, fn_die, sizeof(Dwarf_Die)); |
13167 |
++ fsp->found = true; |
13168 |
++ return 1; |
13169 |
++} |
13170 |
++ |
13171 |
+ /* Find an appropriate scope fits to given conditions */ |
13172 |
+ static Dwarf_Die *find_best_scope(struct probe_finder *pf, Dwarf_Die *die_mem) |
13173 |
+ { |
13174 |
+@@ -767,8 +777,13 @@ static Dwarf_Die *find_best_scope(struct probe_finder *pf, Dwarf_Die *die_mem) |
13175 |
+ .die_mem = die_mem, |
13176 |
+ .found = false, |
13177 |
+ }; |
13178 |
++ int ret; |
13179 |
+ |
13180 |
+- cu_walk_functions_at(&pf->cu_die, pf->addr, find_best_scope_cb, &fsp); |
13181 |
++ ret = cu_walk_functions_at(&pf->cu_die, pf->addr, find_best_scope_cb, |
13182 |
++ &fsp); |
13183 |
++ if (!ret && !fsp.found) |
13184 |
++ cu_walk_functions_at(&pf->cu_die, pf->addr, |
13185 |
++ find_inner_scope_cb, &fsp); |
13186 |
+ |
13187 |
+ return fsp.found ? die_mem : NULL; |
13188 |
+ } |
13189 |
+@@ -942,7 +957,7 @@ static int probe_point_inline_cb(Dwarf_Die *in_die, void *data) |
13190 |
+ ret = find_probe_point_lazy(in_die, pf); |
13191 |
+ else { |
13192 |
+ /* Get probe address */ |
13193 |
+- if (dwarf_entrypc(in_die, &addr) != 0) { |
13194 |
++ if (die_entrypc(in_die, &addr) != 0) { |
13195 |
+ pr_warning("Failed to get entry address of %s.\n", |
13196 |
+ dwarf_diename(in_die)); |
13197 |
+ return -ENOENT; |
13198 |
+@@ -994,7 +1009,7 @@ static int probe_point_search_cb(Dwarf_Die *sp_die, void *data) |
13199 |
+ param->retval = find_probe_point_by_line(pf); |
13200 |
+ } else if (die_is_func_instance(sp_die)) { |
13201 |
+ /* Instances always have the entry address */ |
13202 |
+- dwarf_entrypc(sp_die, &pf->addr); |
13203 |
++ die_entrypc(sp_die, &pf->addr); |
13204 |
+ /* But in some case the entry address is 0 */ |
13205 |
+ if (pf->addr == 0) { |
13206 |
+ pr_debug("%s has no entry PC. Skipped\n", |
13207 |
+@@ -1425,6 +1440,18 @@ error: |
13208 |
+ return DIE_FIND_CB_END; |
13209 |
+ } |
13210 |
+ |
13211 |
++static bool available_var_finder_overlap(struct available_var_finder *af) |
13212 |
++{ |
13213 |
++ int i; |
13214 |
++ |
13215 |
++ for (i = 0; i < af->nvls; i++) { |
13216 |
++ if (af->pf.addr == af->vls[i].point.address) |
13217 |
++ return true; |
13218 |
++ } |
13219 |
++ return false; |
13220 |
++ |
13221 |
++} |
13222 |
++ |
13223 |
+ /* Add a found vars into available variables list */ |
13224 |
+ static int add_available_vars(Dwarf_Die *sc_die, struct probe_finder *pf) |
13225 |
+ { |
13226 |
+@@ -1435,6 +1462,14 @@ static int add_available_vars(Dwarf_Die *sc_die, struct probe_finder *pf) |
13227 |
+ Dwarf_Die die_mem; |
13228 |
+ int ret; |
13229 |
+ |
13230 |
++ /* |
13231 |
++ * For some reason (e.g. different column assigned to same address), |
13232 |
++ * this callback can be called with the address which already passed. |
13233 |
++ * Ignore it first. |
13234 |
++ */ |
13235 |
++ if (available_var_finder_overlap(af)) |
13236 |
++ return 0; |
13237 |
++ |
13238 |
+ /* Check number of tevs */ |
13239 |
+ if (af->nvls == af->max_vls) { |
13240 |
+ pr_warning("Too many( > %d) probe point found.\n", af->max_vls); |
13241 |
+@@ -1578,7 +1613,7 @@ int debuginfo__find_probe_point(struct debuginfo *dbg, unsigned long addr, |
13242 |
+ /* Get function entry information */ |
13243 |
+ func = basefunc = dwarf_diename(&spdie); |
13244 |
+ if (!func || |
13245 |
+- dwarf_entrypc(&spdie, &baseaddr) != 0 || |
13246 |
++ die_entrypc(&spdie, &baseaddr) != 0 || |
13247 |
+ dwarf_decl_line(&spdie, &baseline) != 0) { |
13248 |
+ lineno = 0; |
13249 |
+ goto post; |
13250 |
+@@ -1595,7 +1630,7 @@ int debuginfo__find_probe_point(struct debuginfo *dbg, unsigned long addr, |
13251 |
+ while (die_find_top_inlinefunc(&spdie, (Dwarf_Addr)addr, |
13252 |
+ &indie)) { |
13253 |
+ /* There is an inline function */ |
13254 |
+- if (dwarf_entrypc(&indie, &_addr) == 0 && |
13255 |
++ if (die_entrypc(&indie, &_addr) == 0 && |
13256 |
+ _addr == addr) { |
13257 |
+ /* |
13258 |
+ * addr is at an inline function entry. |
13259 |
+diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c |
13260 |
+index 061bb4d6a3f5..5c172845fa5a 100644 |
13261 |
+--- a/tools/perf/util/session.c |
13262 |
++++ b/tools/perf/util/session.c |
13263 |
+@@ -1954,8 +1954,8 @@ out_err: |
13264 |
+ } |
13265 |
+ |
13266 |
+ static union perf_event * |
13267 |
+-fetch_mmaped_event(struct perf_session *session, |
13268 |
+- u64 head, size_t mmap_size, char *buf) |
13269 |
++prefetch_event(char *buf, u64 head, size_t mmap_size, |
13270 |
++ bool needs_swap, union perf_event *error) |
13271 |
+ { |
13272 |
+ union perf_event *event; |
13273 |
+ |
13274 |
+@@ -1967,20 +1967,32 @@ fetch_mmaped_event(struct perf_session *session, |
13275 |
+ return NULL; |
13276 |
+ |
13277 |
+ event = (union perf_event *)(buf + head); |
13278 |
++ if (needs_swap) |
13279 |
++ perf_event_header__bswap(&event->header); |
13280 |
+ |
13281 |
+- if (session->header.needs_swap) |
13282 |
++ if (head + event->header.size <= mmap_size) |
13283 |
++ return event; |
13284 |
++ |
13285 |
++ /* We're not fetching the event so swap back again */ |
13286 |
++ if (needs_swap) |
13287 |
+ perf_event_header__bswap(&event->header); |
13288 |
+ |
13289 |
+- if (head + event->header.size > mmap_size) { |
13290 |
+- /* We're not fetching the event so swap back again */ |
13291 |
+- if (session->header.needs_swap) |
13292 |
+- perf_event_header__bswap(&event->header); |
13293 |
+- pr_debug("%s: head=%#" PRIx64 " event->header_size=%#x, mmap_size=%#zx: fuzzed perf.data?\n", |
13294 |
+- __func__, head, event->header.size, mmap_size); |
13295 |
+- return ERR_PTR(-EINVAL); |
13296 |
+- } |
13297 |
++ pr_debug("%s: head=%#" PRIx64 " event->header_size=%#x, mmap_size=%#zx:" |
13298 |
++ " fuzzed or compressed perf.data?\n",__func__, head, event->header.size, mmap_size); |
13299 |
+ |
13300 |
+- return event; |
13301 |
++ return error; |
13302 |
++} |
13303 |
++ |
13304 |
++static union perf_event * |
13305 |
++fetch_mmaped_event(u64 head, size_t mmap_size, char *buf, bool needs_swap) |
13306 |
++{ |
13307 |
++ return prefetch_event(buf, head, mmap_size, needs_swap, ERR_PTR(-EINVAL)); |
13308 |
++} |
13309 |
++ |
13310 |
++static union perf_event * |
13311 |
++fetch_decomp_event(u64 head, size_t mmap_size, char *buf, bool needs_swap) |
13312 |
++{ |
13313 |
++ return prefetch_event(buf, head, mmap_size, needs_swap, NULL); |
13314 |
+ } |
13315 |
+ |
13316 |
+ static int __perf_session__process_decomp_events(struct perf_session *session) |
13317 |
+@@ -1993,10 +2005,8 @@ static int __perf_session__process_decomp_events(struct perf_session *session) |
13318 |
+ return 0; |
13319 |
+ |
13320 |
+ while (decomp->head < decomp->size && !session_done()) { |
13321 |
+- union perf_event *event = fetch_mmaped_event(session, decomp->head, decomp->size, decomp->data); |
13322 |
+- |
13323 |
+- if (IS_ERR(event)) |
13324 |
+- return PTR_ERR(event); |
13325 |
++ union perf_event *event = fetch_decomp_event(decomp->head, decomp->size, decomp->data, |
13326 |
++ session->header.needs_swap); |
13327 |
+ |
13328 |
+ if (!event) |
13329 |
+ break; |
13330 |
+@@ -2096,7 +2106,7 @@ remap: |
13331 |
+ } |
13332 |
+ |
13333 |
+ more: |
13334 |
+- event = fetch_mmaped_event(session, head, mmap_size, buf); |
13335 |
++ event = fetch_mmaped_event(head, mmap_size, buf, session->header.needs_swap); |
13336 |
+ if (IS_ERR(event)) |
13337 |
+ return PTR_ERR(event); |
13338 |
+ |
13339 |
+diff --git a/tools/power/cpupower/utils/idle_monitor/hsw_ext_idle.c b/tools/power/cpupower/utils/idle_monitor/hsw_ext_idle.c |
13340 |
+index 7c7451d3f494..58dbdfd4fa13 100644 |
13341 |
+--- a/tools/power/cpupower/utils/idle_monitor/hsw_ext_idle.c |
13342 |
++++ b/tools/power/cpupower/utils/idle_monitor/hsw_ext_idle.c |
13343 |
+@@ -39,7 +39,6 @@ static cstate_t hsw_ext_cstates[HSW_EXT_CSTATE_COUNT] = { |
13344 |
+ { |
13345 |
+ .name = "PC9", |
13346 |
+ .desc = N_("Processor Package C9"), |
13347 |
+- .desc = N_("Processor Package C2"), |
13348 |
+ .id = PC9, |
13349 |
+ .range = RANGE_PACKAGE, |
13350 |
+ .get_count_percent = hsw_ext_get_count_percent, |
13351 |
+diff --git a/tools/testing/selftests/bpf/cgroup_helpers.c b/tools/testing/selftests/bpf/cgroup_helpers.c |
13352 |
+index e95c33e333a4..b29a73fe64db 100644 |
13353 |
+--- a/tools/testing/selftests/bpf/cgroup_helpers.c |
13354 |
++++ b/tools/testing/selftests/bpf/cgroup_helpers.c |
13355 |
+@@ -98,7 +98,7 @@ int enable_all_controllers(char *cgroup_path) |
13356 |
+ */ |
13357 |
+ int setup_cgroup_environment(void) |
13358 |
+ { |
13359 |
+- char cgroup_workdir[PATH_MAX + 1]; |
13360 |
++ char cgroup_workdir[PATH_MAX - 24]; |
13361 |
+ |
13362 |
+ format_cgroup_path(cgroup_workdir, ""); |
13363 |
+ |
13364 |
+diff --git a/tools/testing/selftests/bpf/progs/btf_dump_test_case_padding.c b/tools/testing/selftests/bpf/progs/btf_dump_test_case_padding.c |
13365 |
+index 3a62119c7498..35c512818a56 100644 |
13366 |
+--- a/tools/testing/selftests/bpf/progs/btf_dump_test_case_padding.c |
13367 |
++++ b/tools/testing/selftests/bpf/progs/btf_dump_test_case_padding.c |
13368 |
+@@ -62,6 +62,10 @@ struct padded_a_lot { |
13369 |
+ * long: 64; |
13370 |
+ * long: 64; |
13371 |
+ * int b; |
13372 |
++ * long: 32; |
13373 |
++ * long: 64; |
13374 |
++ * long: 64; |
13375 |
++ * long: 64; |
13376 |
+ *}; |
13377 |
+ * |
13378 |
+ */ |
13379 |
+@@ -95,7 +99,6 @@ struct zone_padding { |
13380 |
+ struct zone { |
13381 |
+ int a; |
13382 |
+ short b; |
13383 |
+- short: 16; |
13384 |
+ struct zone_padding __pad__; |
13385 |
+ }; |
13386 |
+ |
13387 |
+diff --git a/tools/testing/selftests/bpf/progs/test_seg6_loop.c b/tools/testing/selftests/bpf/progs/test_seg6_loop.c |
13388 |
+index c4d104428643..69880c1e7700 100644 |
13389 |
+--- a/tools/testing/selftests/bpf/progs/test_seg6_loop.c |
13390 |
++++ b/tools/testing/selftests/bpf/progs/test_seg6_loop.c |
13391 |
+@@ -132,8 +132,10 @@ static __always_inline int is_valid_tlv_boundary(struct __sk_buff *skb, |
13392 |
+ *pad_off = 0; |
13393 |
+ |
13394 |
+ // we can only go as far as ~10 TLVs due to the BPF max stack size |
13395 |
++ // workaround: define induction variable "i" as "long" instead |
13396 |
++ // of "int" to prevent alu32 sub-register spilling. |
13397 |
+ #pragma clang loop unroll(disable) |
13398 |
+- for (int i = 0; i < 100; i++) { |
13399 |
++ for (long i = 0; i < 100; i++) { |
13400 |
+ struct sr6_tlv_t tlv; |
13401 |
+ |
13402 |
+ if (cur_off == *tlv_off) |
13403 |
+diff --git a/tools/testing/selftests/bpf/progs/test_sysctl_loop1.c b/tools/testing/selftests/bpf/progs/test_sysctl_loop1.c |
13404 |
+index 608a06871572..d22e438198cf 100644 |
13405 |
+--- a/tools/testing/selftests/bpf/progs/test_sysctl_loop1.c |
13406 |
++++ b/tools/testing/selftests/bpf/progs/test_sysctl_loop1.c |
13407 |
+@@ -44,7 +44,10 @@ int sysctl_tcp_mem(struct bpf_sysctl *ctx) |
13408 |
+ unsigned long tcp_mem[TCP_MEM_LOOPS] = {}; |
13409 |
+ char value[MAX_VALUE_STR_LEN]; |
13410 |
+ unsigned char i, off = 0; |
13411 |
+- int ret; |
13412 |
++ /* a workaround to prevent compiler from generating |
13413 |
++ * codes verifier cannot handle yet. |
13414 |
++ */ |
13415 |
++ volatile int ret; |
13416 |
+ |
13417 |
+ if (ctx->write) |
13418 |
+ return 0; |
13419 |
+diff --git a/tools/testing/selftests/bpf/test_progs.c b/tools/testing/selftests/bpf/test_progs.c |
13420 |
+index af75a1c7a458..3bf18364c67c 100644 |
13421 |
+--- a/tools/testing/selftests/bpf/test_progs.c |
13422 |
++++ b/tools/testing/selftests/bpf/test_progs.c |
13423 |
+@@ -20,7 +20,7 @@ struct prog_test_def { |
13424 |
+ bool tested; |
13425 |
+ bool need_cgroup_cleanup; |
13426 |
+ |
13427 |
+- const char *subtest_name; |
13428 |
++ char *subtest_name; |
13429 |
+ int subtest_num; |
13430 |
+ |
13431 |
+ /* store counts before subtest started */ |
13432 |
+@@ -81,16 +81,17 @@ void test__end_subtest() |
13433 |
+ fprintf(env.stdout, "#%d/%d %s:%s\n", |
13434 |
+ test->test_num, test->subtest_num, |
13435 |
+ test->subtest_name, sub_error_cnt ? "FAIL" : "OK"); |
13436 |
++ |
13437 |
++ free(test->subtest_name); |
13438 |
++ test->subtest_name = NULL; |
13439 |
+ } |
13440 |
+ |
13441 |
+ bool test__start_subtest(const char *name) |
13442 |
+ { |
13443 |
+ struct prog_test_def *test = env.test; |
13444 |
+ |
13445 |
+- if (test->subtest_name) { |
13446 |
++ if (test->subtest_name) |
13447 |
+ test__end_subtest(); |
13448 |
+- test->subtest_name = NULL; |
13449 |
+- } |
13450 |
+ |
13451 |
+ test->subtest_num++; |
13452 |
+ |
13453 |
+@@ -104,7 +105,13 @@ bool test__start_subtest(const char *name) |
13454 |
+ if (!should_run(&env.subtest_selector, test->subtest_num, name)) |
13455 |
+ return false; |
13456 |
+ |
13457 |
+- test->subtest_name = name; |
13458 |
++ test->subtest_name = strdup(name); |
13459 |
++ if (!test->subtest_name) { |
13460 |
++ fprintf(env.stderr, |
13461 |
++ "Subtest #%d: failed to copy subtest name!\n", |
13462 |
++ test->subtest_num); |
13463 |
++ return false; |
13464 |
++ } |
13465 |
+ env.test->old_error_cnt = env.test->error_cnt; |
13466 |
+ |
13467 |
+ return true; |
13468 |
+diff --git a/tools/testing/selftests/bpf/test_tc_tunnel.sh b/tools/testing/selftests/bpf/test_tc_tunnel.sh |
13469 |
+index ff0d31d38061..7c76b841b17b 100755 |
13470 |
+--- a/tools/testing/selftests/bpf/test_tc_tunnel.sh |
13471 |
++++ b/tools/testing/selftests/bpf/test_tc_tunnel.sh |
13472 |
+@@ -62,6 +62,10 @@ cleanup() { |
13473 |
+ if [[ -f "${infile}" ]]; then |
13474 |
+ rm "${infile}" |
13475 |
+ fi |
13476 |
++ |
13477 |
++ if [[ -n $server_pid ]]; then |
13478 |
++ kill $server_pid 2> /dev/null |
13479 |
++ fi |
13480 |
+ } |
13481 |
+ |
13482 |
+ server_listen() { |
13483 |
+@@ -77,6 +81,7 @@ client_connect() { |
13484 |
+ |
13485 |
+ verify_data() { |
13486 |
+ wait "${server_pid}" |
13487 |
++ server_pid= |
13488 |
+ # sha1sum returns two fields [sha1] [filepath] |
13489 |
+ # convert to bash array and access first elem |
13490 |
+ insum=($(sha1sum ${infile})) |
13491 |
+diff --git a/tools/testing/selftests/net/forwarding/router_bridge_vlan.sh b/tools/testing/selftests/net/forwarding/router_bridge_vlan.sh |
13492 |
+index fef88eb4b873..fa6a88c50750 100755 |
13493 |
+--- a/tools/testing/selftests/net/forwarding/router_bridge_vlan.sh |
13494 |
++++ b/tools/testing/selftests/net/forwarding/router_bridge_vlan.sh |
13495 |
+@@ -36,7 +36,7 @@ h2_destroy() |
13496 |
+ { |
13497 |
+ ip -6 route del 2001:db8:1::/64 vrf v$h2 |
13498 |
+ ip -4 route del 192.0.2.0/28 vrf v$h2 |
13499 |
+- simple_if_fini $h2 192.0.2.130/28 |
13500 |
++ simple_if_fini $h2 192.0.2.130/28 2001:db8:2::2/64 |
13501 |
+ } |
13502 |
+ |
13503 |
+ router_create() |
13504 |
+diff --git a/tools/testing/selftests/net/so_txtime.c b/tools/testing/selftests/net/so_txtime.c |
13505 |
+index 53f598f06647..34df4c8882af 100644 |
13506 |
+--- a/tools/testing/selftests/net/so_txtime.c |
13507 |
++++ b/tools/testing/selftests/net/so_txtime.c |
13508 |
+@@ -105,8 +105,8 @@ static void do_recv_one(int fdr, struct timed_send *ts) |
13509 |
+ tstop = (gettime_ns() - glob_tstart) / 1000; |
13510 |
+ texpect = ts->delay_us >= 0 ? ts->delay_us : 0; |
13511 |
+ |
13512 |
+- fprintf(stderr, "payload:%c delay:%ld expected:%ld (us)\n", |
13513 |
+- rbuf[0], tstop, texpect); |
13514 |
++ fprintf(stderr, "payload:%c delay:%lld expected:%lld (us)\n", |
13515 |
++ rbuf[0], (long long)tstop, (long long)texpect); |
13516 |
+ |
13517 |
+ if (rbuf[0] != ts->data) |
13518 |
+ error(1, 0, "payload mismatch. expected %c", ts->data); |
13519 |
+diff --git a/tools/testing/selftests/net/tls.c b/tools/testing/selftests/net/tls.c |
13520 |
+index 13e5ef615026..0ea44d975b6c 100644 |
13521 |
+--- a/tools/testing/selftests/net/tls.c |
13522 |
++++ b/tools/testing/selftests/net/tls.c |
13523 |
+@@ -722,34 +722,6 @@ TEST_F(tls, recv_lowat) |
13524 |
+ EXPECT_EQ(memcmp(send_mem, recv_mem + 10, 5), 0); |
13525 |
+ } |
13526 |
+ |
13527 |
+-TEST_F(tls, recv_rcvbuf) |
13528 |
+-{ |
13529 |
+- char send_mem[4096]; |
13530 |
+- char recv_mem[4096]; |
13531 |
+- int rcv_buf = 1024; |
13532 |
+- |
13533 |
+- memset(send_mem, 0x1c, sizeof(send_mem)); |
13534 |
+- |
13535 |
+- EXPECT_EQ(setsockopt(self->cfd, SOL_SOCKET, SO_RCVBUF, |
13536 |
+- &rcv_buf, sizeof(rcv_buf)), 0); |
13537 |
+- |
13538 |
+- EXPECT_EQ(send(self->fd, send_mem, 512, 0), 512); |
13539 |
+- memset(recv_mem, 0, sizeof(recv_mem)); |
13540 |
+- EXPECT_EQ(recv(self->cfd, recv_mem, sizeof(recv_mem), 0), 512); |
13541 |
+- EXPECT_EQ(memcmp(send_mem, recv_mem, 512), 0); |
13542 |
+- |
13543 |
+- if (self->notls) |
13544 |
+- return; |
13545 |
+- |
13546 |
+- EXPECT_EQ(send(self->fd, send_mem, 4096, 0), 4096); |
13547 |
+- memset(recv_mem, 0, sizeof(recv_mem)); |
13548 |
+- EXPECT_EQ(recv(self->cfd, recv_mem, sizeof(recv_mem), 0), -1); |
13549 |
+- EXPECT_EQ(errno, EMSGSIZE); |
13550 |
+- |
13551 |
+- EXPECT_EQ(recv(self->cfd, recv_mem, sizeof(recv_mem), 0), -1); |
13552 |
+- EXPECT_EQ(errno, EMSGSIZE); |
13553 |
+-} |
13554 |
+- |
13555 |
+ TEST_F(tls, bidir) |
13556 |
+ { |
13557 |
+ char const *test_str = "test_read"; |
13558 |
+diff --git a/tools/testing/selftests/net/udpgso.c b/tools/testing/selftests/net/udpgso.c |
13559 |
+index 614b31aad168..c66da6ffd6d8 100644 |
13560 |
+--- a/tools/testing/selftests/net/udpgso.c |
13561 |
++++ b/tools/testing/selftests/net/udpgso.c |
13562 |
+@@ -440,7 +440,8 @@ static bool __send_one(int fd, struct msghdr *msg, int flags) |
13563 |
+ if (ret == -1) |
13564 |
+ error(1, errno, "sendmsg"); |
13565 |
+ if (ret != msg->msg_iov->iov_len) |
13566 |
+- error(1, 0, "sendto: %d != %lu", ret, msg->msg_iov->iov_len); |
13567 |
++ error(1, 0, "sendto: %d != %llu", ret, |
13568 |
++ (unsigned long long)msg->msg_iov->iov_len); |
13569 |
+ if (msg->msg_flags) |
13570 |
+ error(1, 0, "sendmsg: return flags 0x%x\n", msg->msg_flags); |
13571 |
+ |
13572 |
+diff --git a/tools/testing/selftests/net/udpgso_bench_tx.c b/tools/testing/selftests/net/udpgso_bench_tx.c |
13573 |
+index ada99496634a..17512a43885e 100644 |
13574 |
+--- a/tools/testing/selftests/net/udpgso_bench_tx.c |
13575 |
++++ b/tools/testing/selftests/net/udpgso_bench_tx.c |
13576 |
+@@ -405,7 +405,8 @@ static int send_udp_segment(int fd, char *data) |
13577 |
+ if (ret == -1) |
13578 |
+ error(1, errno, "sendmsg"); |
13579 |
+ if (ret != iov.iov_len) |
13580 |
+- error(1, 0, "sendmsg: %u != %lu\n", ret, iov.iov_len); |
13581 |
++ error(1, 0, "sendmsg: %u != %llu\n", ret, |
13582 |
++ (unsigned long long)iov.iov_len); |
13583 |
+ |
13584 |
+ return 1; |
13585 |
+ } |
13586 |
+diff --git a/tools/testing/selftests/proc/proc-self-map-files-002.c b/tools/testing/selftests/proc/proc-self-map-files-002.c |
13587 |
+index 47b7473dedef..e6aa00a183bc 100644 |
13588 |
+--- a/tools/testing/selftests/proc/proc-self-map-files-002.c |
13589 |
++++ b/tools/testing/selftests/proc/proc-self-map-files-002.c |
13590 |
+@@ -47,7 +47,11 @@ static void fail(const char *fmt, unsigned long a, unsigned long b) |
13591 |
+ int main(void) |
13592 |
+ { |
13593 |
+ const int PAGE_SIZE = sysconf(_SC_PAGESIZE); |
13594 |
+- const unsigned long va_max = 1UL << 32; |
13595 |
++ /* |
13596 |
++ * va_max must be enough bigger than vm.mmap_min_addr, which is |
13597 |
++ * 64KB/32KB by default. (depends on CONFIG_LSM_MMAP_MIN_ADDR) |
13598 |
++ */ |
13599 |
++ const unsigned long va_max = 1UL << 20; |
13600 |
+ unsigned long va; |
13601 |
+ void *p; |
13602 |
+ int fd; |
13603 |
+diff --git a/virt/kvm/arm/mmu.c b/virt/kvm/arm/mmu.c |
13604 |
+index 38b4c910b6c3..f23c9cd5684f 100644 |
13605 |
+--- a/virt/kvm/arm/mmu.c |
13606 |
++++ b/virt/kvm/arm/mmu.c |
13607 |
+@@ -38,6 +38,11 @@ static unsigned long io_map_base; |
13608 |
+ #define KVM_S2PTE_FLAG_IS_IOMAP (1UL << 0) |
13609 |
+ #define KVM_S2_FLAG_LOGGING_ACTIVE (1UL << 1) |
13610 |
+ |
13611 |
++static bool is_iomap(unsigned long flags) |
13612 |
++{ |
13613 |
++ return flags & KVM_S2PTE_FLAG_IS_IOMAP; |
13614 |
++} |
13615 |
++ |
13616 |
+ static bool memslot_is_logging(struct kvm_memory_slot *memslot) |
13617 |
+ { |
13618 |
+ return memslot->dirty_bitmap && !(memslot->flags & KVM_MEM_READONLY); |
13619 |
+@@ -1698,6 +1703,7 @@ static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa, |
13620 |
+ |
13621 |
+ vma_pagesize = vma_kernel_pagesize(vma); |
13622 |
+ if (logging_active || |
13623 |
++ (vma->vm_flags & VM_PFNMAP) || |
13624 |
+ !fault_supports_stage2_huge_mapping(memslot, hva, vma_pagesize)) { |
13625 |
+ force_pte = true; |
13626 |
+ vma_pagesize = PAGE_SIZE; |
13627 |
+@@ -1760,6 +1766,9 @@ static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa, |
13628 |
+ writable = false; |
13629 |
+ } |
13630 |
+ |
13631 |
++ if (exec_fault && is_iomap(flags)) |
13632 |
++ return -ENOEXEC; |
13633 |
++ |
13634 |
+ spin_lock(&kvm->mmu_lock); |
13635 |
+ if (mmu_notifier_retry(kvm, mmu_seq)) |
13636 |
+ goto out_unlock; |
13637 |
+@@ -1781,7 +1790,7 @@ static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa, |
13638 |
+ if (writable) |
13639 |
+ kvm_set_pfn_dirty(pfn); |
13640 |
+ |
13641 |
+- if (fault_status != FSC_PERM) |
13642 |
++ if (fault_status != FSC_PERM && !is_iomap(flags)) |
13643 |
+ clean_dcache_guest_page(pfn, vma_pagesize); |
13644 |
+ |
13645 |
+ if (exec_fault) |
13646 |
+@@ -1948,9 +1957,8 @@ int kvm_handle_guest_abort(struct kvm_vcpu *vcpu, struct kvm_run *run) |
13647 |
+ if (kvm_is_error_hva(hva) || (write_fault && !writable)) { |
13648 |
+ if (is_iabt) { |
13649 |
+ /* Prefetch Abort on I/O address */ |
13650 |
+- kvm_inject_pabt(vcpu, kvm_vcpu_get_hfar(vcpu)); |
13651 |
+- ret = 1; |
13652 |
+- goto out_unlock; |
13653 |
++ ret = -ENOEXEC; |
13654 |
++ goto out; |
13655 |
+ } |
13656 |
+ |
13657 |
+ /* |
13658 |
+@@ -1992,6 +2000,11 @@ int kvm_handle_guest_abort(struct kvm_vcpu *vcpu, struct kvm_run *run) |
13659 |
+ ret = user_mem_abort(vcpu, fault_ipa, memslot, hva, fault_status); |
13660 |
+ if (ret == 0) |
13661 |
+ ret = 1; |
13662 |
++out: |
13663 |
++ if (ret == -ENOEXEC) { |
13664 |
++ kvm_inject_pabt(vcpu, kvm_vcpu_get_hfar(vcpu)); |
13665 |
++ ret = 1; |
13666 |
++ } |
13667 |
+ out_unlock: |
13668 |
+ srcu_read_unlock(&vcpu->kvm->srcu, idx); |
13669 |
+ return ret; |