Re: [PATCH v4 10/11] KVM: x86/xen: Add KVM_IRQ_ROUTING_XEN_EVTCHN and event channel delivery
by kernel test robot
Hi David,
I love your patch! Perhaps something to improve:
[auto build test WARNING on linus/master]
[also build test WARNING on next-20211118]
[cannot apply to kvm/queue kvms390/next powerpc/topic/ppc-kvm kvmarm/next mst-vhost/linux-next v5.16-rc1]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/David-Woodhouse/KVM-Introduce-CO...
base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git a90af8f15bdc9449ee2d24e1d73fa3f7e8633f81
config: i386-randconfig-s001-20211118 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.4-dirty
# https://github.com/0day-ci/linux/commit/a9a90c7ab5f10064f2153f60e2410222c...
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review David-Woodhouse/KVM-Introduce-CONFIG_HAVE_KVM_DIRTY_RING/20211120-192837
git checkout a9a90c7ab5f10064f2153f60e2410222c1b00700
# save the attached .config to linux build tree
make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=i386
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
sparse warnings: (new ones prefixed by >>)
>> arch/x86/kvm/xen.c:272:22: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const [noderef] __user *ptr @@ got void * @@
arch/x86/kvm/xen.c:272:22: sparse: expected void const [noderef] __user *ptr
arch/x86/kvm/xen.c:272:22: sparse: got void *
>> arch/x86/kvm/xen.c:276:56: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected struct vcpu_info [noderef] __user *vi @@ got void * @@
arch/x86/kvm/xen.c:276:56: sparse: expected struct vcpu_info [noderef] __user *vi
arch/x86/kvm/xen.c:276:56: sparse: got void *
>> arch/x86/kvm/xen.c:294:63: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected struct compat_vcpu_info [noderef] __user *vi @@ got void * @@
arch/x86/kvm/xen.c:294:63: sparse: expected struct compat_vcpu_info [noderef] __user *vi
arch/x86/kvm/xen.c:294:63: sparse: got void *
vim +272 arch/x86/kvm/xen.c
196
197 int __kvm_xen_has_interrupt(struct kvm_vcpu *v)
198 {
199 unsigned long evtchn_pending_sel = READ_ONCE(v->arch.xen.evtchn_pending_sel);
200 bool atomic = in_atomic() || !task_is_running(current);
201 int err;
202 u8 rc = 0;
203
204 /*
205 * If the global upcall vector (HVMIRQ_callback_vector) is set and
206 * the vCPU's evtchn_upcall_pending flag is set, the IRQ is pending.
207 */
208 struct gfn_to_hva_cache *ghc = &v->arch.xen.vcpu_info_cache;
209 struct kvm_memslots *slots = kvm_memslots(v->kvm);
210 bool ghc_valid = slots->generation == ghc->generation &&
211 !kvm_is_error_hva(ghc->hva) && ghc->memslot;
212
213 unsigned int offset = offsetof(struct vcpu_info, evtchn_upcall_pending);
214
215 /* No need for compat handling here */
216 BUILD_BUG_ON(offsetof(struct vcpu_info, evtchn_upcall_pending) !=
217 offsetof(struct compat_vcpu_info, evtchn_upcall_pending));
218 BUILD_BUG_ON(sizeof(rc) !=
219 sizeof_field(struct vcpu_info, evtchn_upcall_pending));
220 BUILD_BUG_ON(sizeof(rc) !=
221 sizeof_field(struct compat_vcpu_info, evtchn_upcall_pending));
222
223 /*
224 * For efficiency, this mirrors the checks for using the valid
225 * cache in kvm_read_guest_offset_cached(), but just uses
226 * __get_user() instead. And falls back to the slow path.
227 */
228 if (!evtchn_pending_sel && ghc_valid) {
229 /* Fast path */
230 pagefault_disable();
231 err = __get_user(rc, (u8 __user *)ghc->hva + offset);
232 pagefault_enable();
233 if (!err)
234 return rc;
235 }
236
237 /* Slow path */
238
239 /*
240 * This function gets called from kvm_vcpu_block() after setting the
241 * task to TASK_INTERRUPTIBLE, to see if it needs to wake immediately
242 * from a HLT. So we really mustn't sleep. If the page ended up absent
243 * at that point, just return 1 in order to trigger an immediate wake,
244 * and we'll end up getting called again from a context where we *can*
245 * fault in the page and wait for it.
246 */
247 if (atomic)
248 return 1;
249
250 if (!ghc_valid) {
251 err = kvm_gfn_to_hva_cache_init(v->kvm, ghc, ghc->gpa, ghc->len);
252 if (err || !ghc->memslot) {
253 /*
254 * If this failed, userspace has screwed up the
255 * vcpu_info mapping. No interrupts for you.
256 */
257 return 0;
258 }
259 }
260
261 /*
262 * Now we have a valid (protected by srcu) userspace HVA in
263 * ghc->hva which points to the struct vcpu_info. If there
264 * are any bits in the in-kernel evtchn_pending_sel then
265 * we need to write those to the guest vcpu_info and set
266 * its evtchn_upcall_pending flag. If there aren't any bits
267 * to add, we only want to *check* evtchn_upcall_pending.
268 */
269 if (evtchn_pending_sel) {
270 bool long_mode = v->kvm->arch.xen.long_mode;
271
> 272 if (!user_access_begin((void *)ghc->hva, sizeof(struct vcpu_info)))
273 return 0;
274
275 if (IS_ENABLED(CONFIG_64BIT) && long_mode) {
> 276 struct vcpu_info __user *vi = (void *)ghc->hva;
277
278 /* Attempt to set the evtchn_pending_sel bits in the
279 * guest, and if that succeeds then clear the same
280 * bits in the in-kernel version. */
281 asm volatile("1:\t" LOCK_PREFIX "orq %0, %1\n"
282 "\tnotq %0\n"
283 "\t" LOCK_PREFIX "andq %0, %2\n"
284 "2:\n"
285 "\t.section .fixup,\"ax\"\n"
286 "3:\tjmp\t2b\n"
287 "\t.previous\n"
288 _ASM_EXTABLE_UA(1b, 3b)
289 : "=r" (evtchn_pending_sel),
290 "+m" (vi->evtchn_pending_sel),
291 "+m" (v->arch.xen.evtchn_pending_sel)
292 : "0" (evtchn_pending_sel));
293 } else {
> 294 struct compat_vcpu_info __user *vi = (void *)ghc->hva;
295 u32 evtchn_pending_sel32 = evtchn_pending_sel;
296
297 /* Attempt to set the evtchn_pending_sel bits in the
298 * guest, and if that succeeds then clear the same
299 * bits in the in-kernel version. */
300 asm volatile("1:\t" LOCK_PREFIX "orl %0, %1\n"
301 "\tnotl %0\n"
302 "\t" LOCK_PREFIX "andl %0, %2\n"
303 "2:\n"
304 "\t.section .fixup,\"ax\"\n"
305 "3:\tjmp\t2b\n"
306 "\t.previous\n"
307 _ASM_EXTABLE_UA(1b, 3b)
308 : "=r" (evtchn_pending_sel32),
309 "+m" (vi->evtchn_pending_sel),
310 "+m" (v->arch.xen.evtchn_pending_sel)
311 : "0" (evtchn_pending_sel32));
312 }
313 rc = 1;
314 unsafe_put_user(rc, (u8 __user *)ghc->hva + offset, err);
315
316 err:
317 user_access_end();
318
319 mark_page_dirty_in_slot(v->kvm, ghc->memslot, ghc->gpa >> PAGE_SHIFT);
320 } else {
321 __get_user(rc, (u8 __user *)ghc->hva + offset);
322 }
323
324 return rc;
325 }
326
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
10 months
[mark:treewide/thread-flags 9/11] arch/powerpc/kernel/interrupt.c:151:64: sparse: sparse: incorrect type in argument 2 (different base types)
by kernel test robot
tree: https://git.kernel.org/pub/scm/linux/kernel/git/mark/linux.git treewide/thread-flags
head: d5fcb79b14c4566888a8a85004a261a740260a02
commit: db22de8cb00a64b2dc2d24bed04b8b0aef40b015 [9/11] powerpc: avoid discarding flags in system_call_exception()
config: powerpc-randconfig-s031-20211118 (attached as .config)
compiler: powerpc-linux-gcc (GCC) 11.2.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.4-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/mark/linux.git/commit/?id...
git remote add mark https://git.kernel.org/pub/scm/linux/kernel/git/mark/linux.git
git fetch --no-tags mark treewide/thread-flags
git checkout db22de8cb00a64b2dc2d24bed04b8b0aef40b015
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=powerpc
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
sparse warnings: (new ones prefixed by >>)
>> arch/powerpc/kernel/interrupt.c:151:64: sparse: sparse: incorrect type in argument 2 (different base types) @@ expected unsigned long volatile *_p @@ got unsigned long flags @@
arch/powerpc/kernel/interrupt.c:151:64: sparse: expected unsigned long volatile *_p
arch/powerpc/kernel/interrupt.c:151:64: sparse: got unsigned long flags
vim +151 arch/powerpc/kernel/interrupt.c
76
77 /* Has to run notrace because it is entered not completely "reconciled" */
78 notrace long system_call_exception(long r3, long r4, long r5,
79 long r6, long r7, long r8,
80 unsigned long r0, struct pt_regs *regs)
81 {
82 syscall_fn f;
83
84 kuep_lock();
85
86 regs->orig_gpr3 = r3;
87
88 if (IS_ENABLED(CONFIG_PPC_IRQ_SOFT_MASK_DEBUG))
89 BUG_ON(irq_soft_mask_return() != IRQS_ALL_DISABLED);
90
91 trace_hardirqs_off(); /* finish reconciling */
92
93 CT_WARN_ON(ct_state() == CONTEXT_KERNEL);
94 user_exit_irqoff();
95
96 BUG_ON(regs_is_unrecoverable(regs));
97 BUG_ON(!(regs->msr & MSR_PR));
98 BUG_ON(arch_irq_disabled_regs(regs));
99
100 #ifdef CONFIG_PPC_PKEY
101 if (mmu_has_feature(MMU_FTR_PKEY)) {
102 unsigned long amr, iamr;
103 bool flush_needed = false;
104 /*
105 * When entering from userspace we mostly have the AMR/IAMR
106 * different from kernel default values. Hence don't compare.
107 */
108 amr = mfspr(SPRN_AMR);
109 iamr = mfspr(SPRN_IAMR);
110 regs->amr = amr;
111 regs->iamr = iamr;
112 if (mmu_has_feature(MMU_FTR_BOOK3S_KUAP)) {
113 mtspr(SPRN_AMR, AMR_KUAP_BLOCKED);
114 flush_needed = true;
115 }
116 if (mmu_has_feature(MMU_FTR_BOOK3S_KUEP)) {
117 mtspr(SPRN_IAMR, AMR_KUEP_BLOCKED);
118 flush_needed = true;
119 }
120 if (flush_needed)
121 isync();
122 } else
123 #endif
124 kuap_assert_locked();
125
126 booke_restore_dbcr0();
127
128 account_cpu_user_entry();
129
130 account_stolen_time();
131
132 /*
133 * This is not required for the syscall exit path, but makes the
134 * stack frame look nicer. If this was initialised in the first stack
135 * frame, or if the unwinder was taught the first stack frame always
136 * returns to user with IRQS_ENABLED, this store could be avoided!
137 */
138 irq_soft_mask_regs_set_state(regs, IRQS_ENABLED);
139
140 /*
141 * If system call is called with TM active, set _TIF_RESTOREALL to
142 * prevent RFSCV being used to return to userspace, because POWER9
143 * TM implementation has problems with this instruction returning to
144 * transactional state. Final register values are not relevant because
145 * the transaction will be aborted upon return anyway. Or in the case
146 * of unsupported_scv SIGILL fault, the return state does not much
147 * matter because it's an edge case.
148 */
149 if (IS_ENABLED(CONFIG_PPC_TRANSACTIONAL_MEM) &&
150 unlikely(MSR_TM_TRANSACTIONAL(regs->msr)))
> 151 set_bits(_TIF_RESTOREALL, current_thread_info()->flags);
152
153 /*
154 * If the system call was made with a transaction active, doom it and
155 * return without performing the system call. Unless it was an
156 * unsupported scv vector, in which case it's treated like an illegal
157 * instruction.
158 */
159 #ifdef CONFIG_PPC_TRANSACTIONAL_MEM
160 if (unlikely(MSR_TM_TRANSACTIONAL(regs->msr)) &&
161 !trap_is_unsupported_scv(regs)) {
162 /* Enable TM in the kernel, and disable EE (for scv) */
163 hard_irq_disable();
164 mtmsr(mfmsr() | MSR_TM);
165
166 /* tabort, this dooms the transaction, nothing else */
167 asm volatile(".long 0x7c00071d | ((%0) << 16)"
168 :: "r"(TM_CAUSE_SYSCALL|TM_CAUSE_PERSISTENT));
169
170 /*
171 * Userspace will never see the return value. Execution will
172 * resume after the tbegin. of the aborted transaction with the
173 * checkpointed register state. A context switch could occur
174 * or signal delivered to the process before resuming the
175 * doomed transaction context, but that should all be handled
176 * as expected.
177 */
178 return -ENOSYS;
179 }
180 #endif // CONFIG_PPC_TRANSACTIONAL_MEM
181
182 local_irq_enable();
183
184 if (unlikely(current_thread_info()->flags & _TIF_SYSCALL_DOTRACE)) {
185 if (unlikely(trap_is_unsupported_scv(regs))) {
186 /* Unsupported scv vector */
187 _exception(SIGILL, regs, ILL_ILLOPC, regs->nip);
188 return regs->gpr[3];
189 }
190 /*
191 * We use the return value of do_syscall_trace_enter() as the
192 * syscall number. If the syscall was rejected for any reason
193 * do_syscall_trace_enter() returns an invalid syscall number
194 * and the test against NR_syscalls will fail and the return
195 * value to be used is in regs->gpr[3].
196 */
197 r0 = do_syscall_trace_enter(regs);
198 if (unlikely(r0 >= NR_syscalls))
199 return regs->gpr[3];
200 r3 = regs->gpr[3];
201 r4 = regs->gpr[4];
202 r5 = regs->gpr[5];
203 r6 = regs->gpr[6];
204 r7 = regs->gpr[7];
205 r8 = regs->gpr[8];
206
207 } else if (unlikely(r0 >= NR_syscalls)) {
208 if (unlikely(trap_is_unsupported_scv(regs))) {
209 /* Unsupported scv vector */
210 _exception(SIGILL, regs, ILL_ILLOPC, regs->nip);
211 return regs->gpr[3];
212 }
213 return -ENOSYS;
214 }
215
216 /* May be faster to do array_index_nospec? */
217 barrier_nospec();
218
219 if (unlikely(is_compat_task())) {
220 f = (void *)compat_sys_call_table[r0];
221
222 r3 &= 0x00000000ffffffffULL;
223 r4 &= 0x00000000ffffffffULL;
224 r5 &= 0x00000000ffffffffULL;
225 r6 &= 0x00000000ffffffffULL;
226 r7 &= 0x00000000ffffffffULL;
227 r8 &= 0x00000000ffffffffULL;
228
229 } else {
230 f = (void *)sys_call_table[r0];
231 }
232
233 return f(r3, r4, r5, r6, r7, r8);
234 }
235
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
10 months
drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c:127:25: warning: 'strncpy' specified bound depends on the length of the source argument
by kernel test robot
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: a90af8f15bdc9449ee2d24e1d73fa3f7e8633f81
commit: 77e9184869c9fb00a482357ea8eef3bd7ae3d45a net: hns3: refactor dump bd info of debugfs
date: 6 months ago
config: ia64-randconfig-r021-20211115 (attached as .config)
compiler: ia64-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit...
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 77e9184869c9fb00a482357ea8eef3bd7ae3d45a
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=ia64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All warnings (new ones prefixed by >>):
In file included from arch/ia64/include/asm/pgtable.h:154,
from include/linux/pgtable.h:6,
from arch/ia64/include/asm/uaccess.h:40,
from include/linux/uaccess.h:11,
from include/linux/sched/task.h:11,
from include/linux/sched/signal.h:9,
from include/linux/rcuwait.h:6,
from include/linux/percpu-rwsem.h:7,
from include/linux/fs.h:33,
from include/linux/debugfs.h:15,
from drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c:4:
arch/ia64/include/asm/mmu_context.h: In function 'reload_context':
arch/ia64/include/asm/mmu_context.h:127:48: warning: variable 'old_rr4' set but not used [-Wunused-but-set-variable]
127 | unsigned long rr0, rr1, rr2, rr3, rr4, old_rr4;
| ^~~~~~~
drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c: In function 'hns3_dbg_fill_content.constprop':
>> drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c:127:25: warning: 'strncpy' specified bound depends on the length of the source argument [-Wstringop-truncation]
127 | strncpy(pos, items[i].name, strlen(items[i].name));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c:125:25: warning: 'strncpy' specified bound depends on the length of the source argument [-Wstringop-truncation]
125 | strncpy(pos, result[i], strlen(result[i]));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function 'hns3_dbg_fill_content',
inlined from 'hns3_dbg_tx_bd_info' at drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c:432:2:
>> drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c:127:25: warning: 'strncpy' specified bound depends on the length of the source argument [-Wstringop-truncation]
127 | strncpy(pos, items[i].name, strlen(items[i].name));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function 'hns3_dbg_fill_content',
inlined from 'hns3_dbg_rx_bd_info' at drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c:358:2:
>> drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c:127:25: warning: 'strncpy' specified bound depends on the length of the source argument [-Wstringop-truncation]
127 | strncpy(pos, items[i].name, strlen(items[i].name));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
vim +/strncpy +127 drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c
114
115 static void hns3_dbg_fill_content(char *content, u16 len,
116 const struct hns3_dbg_item *items,
117 const char **result, u16 size)
118 {
119 char *pos = content;
120 u16 i;
121
122 memset(content, ' ', len);
123 for (i = 0; i < size; i++) {
124 if (result)
125 strncpy(pos, result[i], strlen(result[i]));
126 else
> 127 strncpy(pos, items[i].name, strlen(items[i].name));
128
129 pos += strlen(items[i].name) + items[i].interval;
130 }
131
132 *pos++ = '\n';
133 *pos++ = '\0';
134 }
135
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
10 months
[groeck-staging:watchdog-next 14/24] drivers/watchdog/s3c2410_wdt.c:633:18: error: use of undeclared identifier 'drv_data_exynos850_cl0'
by kernel test robot
tree: https://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git watchdog-next
head: 1a57ba062bc2999cbeb224b38cfcf9160bcec14b
commit: 628fba9f2183bd5ae9ea03a2d8ad43e39dc85a3b [14/24] watchdog: s3c2410: Add Exynos850 support
config: hexagon-randconfig-r041-20211118 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project c46becf500df2a7fb4b4fce16178a036c344315a)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git/...
git remote add groeck-staging https://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git
git fetch --no-tags groeck-staging watchdog-next
git checkout 628fba9f2183bd5ae9ea03a2d8ad43e39dc85a3b
# save the attached .config to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash drivers/mmc/host/ drivers/watchdog/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All errors (new ones prefixed by >>):
>> drivers/watchdog/s3c2410_wdt.c:633:18: error: use of undeclared identifier 'drv_data_exynos850_cl0'
if (variant == &drv_data_exynos850_cl0) {
^
drivers/watchdog/s3c2410_wdt.c:646:12: error: use of undeclared identifier 'drv_data_exynos850_cl0'
return &drv_data_exynos850_cl0;
^
>> drivers/watchdog/s3c2410_wdt.c:648:12: error: use of undeclared identifier 'drv_data_exynos850_cl1'
return &drv_data_exynos850_cl1;
^
3 errors generated.
vim +/drv_data_exynos850_cl0 +633 drivers/watchdog/s3c2410_wdt.c
618
619 static inline const struct s3c2410_wdt_variant *
620 s3c2410_get_wdt_drv_data(struct platform_device *pdev)
621 {
622 const struct s3c2410_wdt_variant *variant;
623 struct device *dev = &pdev->dev;
624
625 variant = of_device_get_match_data(dev);
626 if (!variant) {
627 /* Device matched by platform_device_id */
628 variant = (struct s3c2410_wdt_variant *)
629 platform_get_device_id(pdev)->driver_data;
630 }
631
632 /* Choose Exynos850 driver data w.r.t. cluster index */
> 633 if (variant == &drv_data_exynos850_cl0) {
634 u32 index;
635 int err;
636
637 err = of_property_read_u32(dev->of_node,
638 "samsung,cluster-index", &index);
639 if (err) {
640 dev_err(dev, "failed to get cluster index\n");
641 return NULL;
642 }
643
644 switch (index) {
645 case 0:
646 return &drv_data_exynos850_cl0;
647 case 1:
> 648 return &drv_data_exynos850_cl1;
649 default:
650 dev_err(dev, "wrong cluster index: %u\n", index);
651 return NULL;
652 }
653 }
654
655 return variant;
656 }
657
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
10 months
Re: [PATCH bpf] treewide: add missing includes masked by cgroup -> bpf dependency
by kernel test robot
Hi Jakub,
I love your patch! Yet something to improve:
[auto build test ERROR on bpf/master]
url: https://github.com/0day-ci/linux/commits/Jakub-Kicinski/treewide-add-miss...
base: https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf.git master
config: riscv-randconfig-m031-20211118 (attached as .config)
compiler: riscv32-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/e31b3bdd266ef8f63543f27cf7493e981...
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Jakub-Kicinski/treewide-add-missing-includes-masked-by-cgroup-bpf-dependency/20211120-115325
git checkout e31b3bdd266ef8f63543f27cf7493e98112fd74a
# save the attached .config to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=riscv SHELL=/bin/bash drivers/base/ drivers/iio/dac/ drivers/of/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All error/warnings (new ones prefixed by >>):
In file included from include/linux/cpu.h:17,
from include/linux/cacheinfo.h:6,
from arch/riscv/include/asm/cacheinfo.h:9,
from arch/riscv/include/asm/elf.h:14,
from include/linux/elf.h:6,
from include/linux/module.h:19,
from include/linux/device/driver.h:21,
from include/linux/device.h:32,
from drivers/base/component.c:11:
>> include/linux/node.h:85:25: error: field 'dev' has incomplete type
85 | struct device dev;
| ^~~
In file included from include/linux/cacheinfo.h:6,
from arch/riscv/include/asm/cacheinfo.h:9,
from arch/riscv/include/asm/elf.h:14,
from include/linux/elf.h:6,
from include/linux/module.h:19,
from include/linux/device/driver.h:21,
from include/linux/device.h:32,
from drivers/base/component.c:11:
>> include/linux/cpu.h:29:23: error: field 'dev' has incomplete type
29 | struct device dev;
| ^~~
>> include/linux/cpu.h:44:36: warning: 'struct device_attribute' declared inside parameter list will not be visible outside of this definition or declaration
44 | extern int cpu_add_dev_attr(struct device_attribute *attr);
| ^~~~~~~~~~~~~~~~
include/linux/cpu.h:45:40: warning: 'struct device_attribute' declared inside parameter list will not be visible outside of this definition or declaration
45 | extern void cpu_remove_dev_attr(struct device_attribute *attr);
| ^~~~~~~~~~~~~~~~
include/linux/cpu.h:51:41: warning: 'struct device_attribute' declared inside parameter list will not be visible outside of this definition or declaration
51 | struct device_attribute *attr, char *buf);
| ^~~~~~~~~~~~~~~~
include/linux/cpu.h:53:43: warning: 'struct device_attribute' declared inside parameter list will not be visible outside of this definition or declaration
53 | struct device_attribute *attr, char *buf);
| ^~~~~~~~~~~~~~~~
include/linux/cpu.h:55:43: warning: 'struct device_attribute' declared inside parameter list will not be visible outside of this definition or declaration
55 | struct device_attribute *attr, char *buf);
| ^~~~~~~~~~~~~~~~
include/linux/cpu.h:57:50: warning: 'struct device_attribute' declared inside parameter list will not be visible outside of this definition or declaration
57 | struct device_attribute *attr, char *buf);
| ^~~~~~~~~~~~~~~~
include/linux/cpu.h:59:37: warning: 'struct device_attribute' declared inside parameter list will not be visible outside of this definition or declaration
59 | struct device_attribute *attr, char *buf);
| ^~~~~~~~~~~~~~~~
include/linux/cpu.h:61:36: warning: 'struct device_attribute' declared inside parameter list will not be visible outside of this definition or declaration
61 | struct device_attribute *attr, char *buf);
| ^~~~~~~~~~~~~~~~
include/linux/cpu.h:63:48: warning: 'struct device_attribute' declared inside parameter list will not be visible outside of this definition or declaration
63 | struct device_attribute *attr,
| ^~~~~~~~~~~~~~~~
include/linux/cpu.h:66:46: warning: 'struct device_attribute' declared inside parameter list will not be visible outside of this definition or declaration
66 | struct device_attribute *attr, char *buf);
| ^~~~~~~~~~~~~~~~
include/linux/cpu.h:67:58: warning: 'struct device_attribute' declared inside parameter list will not be visible outside of this definition or declaration
67 | extern ssize_t cpu_show_srbds(struct device *dev, struct device_attribute *attr, char *buf);
| ^~~~~~~~~~~~~~~~
--
In file included from include/linux/node.h:18,
from include/linux/cpu.h:17,
from include/linux/cacheinfo.h:6,
from arch/riscv/include/asm/cacheinfo.h:9,
from arch/riscv/include/asm/elf.h:14,
from include/linux/elf.h:6,
from include/linux/module.h:19,
from include/linux/device/driver.h:21,
from drivers/base/driver.c:11:
include/linux/device.h: In function 'dev_has_sync_state':
>> include/linux/device.h:794:39: error: invalid use of undefined type 'struct device_driver'
794 | if (dev->driver && dev->driver->sync_state)
| ^~
--
In file included from include/linux/cpu.h:17,
from include/linux/cacheinfo.h:6,
from arch/riscv/include/asm/cacheinfo.h:9,
from arch/riscv/include/asm/elf.h:14,
from include/linux/elf.h:6,
from include/linux/module.h:19,
from include/linux/device/driver.h:21,
from include/linux/device.h:32,
from drivers/base/attribute_container.c:14:
>> include/linux/node.h:85:25: error: field 'dev' has incomplete type
85 | struct device dev;
| ^~~
In file included from include/linux/cacheinfo.h:6,
from arch/riscv/include/asm/cacheinfo.h:9,
from arch/riscv/include/asm/elf.h:14,
from include/linux/elf.h:6,
from include/linux/module.h:19,
from include/linux/device/driver.h:21,
from include/linux/device.h:32,
from drivers/base/attribute_container.c:14:
>> include/linux/cpu.h:29:23: error: field 'dev' has incomplete type
29 | struct device dev;
| ^~~
--
In file included from arch/riscv/include/asm/module.h:7,
from include/linux/module.h:33,
from include/linux/device/driver.h:21,
from include/linux/device.h:32,
from include/linux/node.h:18,
from include/linux/cpu.h:17,
from include/linux/cacheinfo.h:6,
from arch/riscv/include/asm/cacheinfo.h:9,
from arch/riscv/include/asm/elf.h:14,
from include/linux/elf.h:6,
from include/linux/elfcore.h:13,
from include/linux/crash_core.h:6,
from include/linux/kexec.h:18,
from include/linux/crash_dump.h:5,
from drivers/of/fdt.c:11:
>> include/asm-generic/module.h:37:25: error: unknown type name 'Elf32_Ehdr'
37 | #define Elf_Ehdr Elf32_Ehdr
| ^~~~~~~~~~
include/linux/module.h:835:32: note: in expansion of macro 'Elf_Ehdr'
835 | void module_bug_finalize(const Elf_Ehdr *, const Elf_Shdr *,
| ^~~~~~~~
>> include/asm-generic/module.h:33:25: error: unknown type name 'Elf32_Shdr'
33 | #define Elf_Shdr Elf32_Shdr
| ^~~~~~~~~~
include/linux/module.h:835:50: note: in expansion of macro 'Elf_Shdr'
835 | void module_bug_finalize(const Elf_Ehdr *, const Elf_Shdr *,
| ^~~~~~~~
--
In file included from include/linux/cpu.h:17,
from include/linux/cacheinfo.h:6,
from arch/riscv/include/asm/cacheinfo.h:9,
from arch/riscv/include/asm/elf.h:14,
from include/linux/elf.h:6,
from include/linux/module.h:19,
from include/linux/device/driver.h:21,
from include/linux/device.h:32,
from drivers/iio/dac/ad5755.c:8:
>> include/linux/node.h:85:25: error: field 'dev' has incomplete type
85 | struct device dev;
| ^~~
In file included from include/linux/cacheinfo.h:6,
from arch/riscv/include/asm/cacheinfo.h:9,
from arch/riscv/include/asm/elf.h:14,
from include/linux/elf.h:6,
from include/linux/module.h:19,
from include/linux/device/driver.h:21,
from include/linux/device.h:32,
from drivers/iio/dac/ad5755.c:8:
>> include/linux/cpu.h:29:23: error: field 'dev' has incomplete type
29 | struct device dev;
| ^~~
>> include/linux/cpu.h:44:36: warning: 'struct device_attribute' declared inside parameter list will not be visible outside of this definition or declaration
44 | extern int cpu_add_dev_attr(struct device_attribute *attr);
| ^~~~~~~~~~~~~~~~
include/linux/cpu.h:45:40: warning: 'struct device_attribute' declared inside parameter list will not be visible outside of this definition or declaration
45 | extern void cpu_remove_dev_attr(struct device_attribute *attr);
| ^~~~~~~~~~~~~~~~
include/linux/cpu.h:51:41: warning: 'struct device_attribute' declared inside parameter list will not be visible outside of this definition or declaration
51 | struct device_attribute *attr, char *buf);
| ^~~~~~~~~~~~~~~~
include/linux/cpu.h:53:43: warning: 'struct device_attribute' declared inside parameter list will not be visible outside of this definition or declaration
53 | struct device_attribute *attr, char *buf);
| ^~~~~~~~~~~~~~~~
include/linux/cpu.h:55:43: warning: 'struct device_attribute' declared inside parameter list will not be visible outside of this definition or declaration
55 | struct device_attribute *attr, char *buf);
| ^~~~~~~~~~~~~~~~
include/linux/cpu.h:57:50: warning: 'struct device_attribute' declared inside parameter list will not be visible outside of this definition or declaration
57 | struct device_attribute *attr, char *buf);
| ^~~~~~~~~~~~~~~~
include/linux/cpu.h:59:37: warning: 'struct device_attribute' declared inside parameter list will not be visible outside of this definition or declaration
59 | struct device_attribute *attr, char *buf);
| ^~~~~~~~~~~~~~~~
include/linux/cpu.h:61:36: warning: 'struct device_attribute' declared inside parameter list will not be visible outside of this definition or declaration
61 | struct device_attribute *attr, char *buf);
| ^~~~~~~~~~~~~~~~
include/linux/cpu.h:63:48: warning: 'struct device_attribute' declared inside parameter list will not be visible outside of this definition or declaration
63 | struct device_attribute *attr,
| ^~~~~~~~~~~~~~~~
include/linux/cpu.h:66:46: warning: 'struct device_attribute' declared inside parameter list will not be visible outside of this definition or declaration
66 | struct device_attribute *attr, char *buf);
| ^~~~~~~~~~~~~~~~
include/linux/cpu.h:67:58: warning: 'struct device_attribute' declared inside parameter list will not be visible outside of this definition or declaration
67 | extern ssize_t cpu_show_srbds(struct device *dev, struct device_attribute *attr, char *buf);
| ^~~~~~~~~~~~~~~~
drivers/iio/dac/ad5755.c:785:34: warning: 'ad5755_of_match' defined but not used [-Wunused-const-variable=]
785 | static const struct of_device_id ad5755_of_match[] = {
| ^~~~~~~~~~~~~~~
vim +/dev +29 include/linux/cpu.h
313162d0b83836 Paul Gortmaker 2012-01-30 25
^1da177e4c3f41 Linus Torvalds 2005-04-16 26 struct cpu {
^1da177e4c3f41 Linus Torvalds 2005-04-16 27 int node_id; /* The node which contains the CPU */
72486f1f8f0a2b Siddha, Suresh B 2006-12-07 28 int hotpluggable; /* creates sysfs control file if hotpluggable */
8a25a2fd126c62 Kay Sievers 2011-12-21 @29 struct device dev;
^1da177e4c3f41 Linus Torvalds 2005-04-16 30 };
^1da177e4c3f41 Linus Torvalds 2005-04-16 31
cff7d378d3fdbb Thomas Gleixner 2016-02-26 32 extern void boot_cpu_init(void);
b5b1404d081589 Linus Torvalds 2018-08-12 33 extern void boot_cpu_hotplug_init(void);
1777e463550726 Ingo Molnar 2017-02-05 34 extern void cpu_init(void);
1777e463550726 Ingo Molnar 2017-02-05 35 extern void trap_init(void);
cff7d378d3fdbb Thomas Gleixner 2016-02-26 36
76b67ed9dce69a KAMEZAWA Hiroyuki 2006-06-27 37 extern int register_cpu(struct cpu *cpu, int num);
8a25a2fd126c62 Kay Sievers 2011-12-21 38 extern struct device *get_cpu_device(unsigned cpu);
2987557f52b97f Josh Triplett 2011-12-03 39 extern bool cpu_is_hotpluggable(unsigned cpu);
183912d352a242 Sudeep Holla 2013-08-15 40 extern bool arch_match_cpu_phys_id(int cpu, u64 phys_id);
d1cb9d1af0bc11 David Miller 2013-10-03 41 extern bool arch_find_n_match_cpu_physical_id(struct device_node *cpun,
d1cb9d1af0bc11 David Miller 2013-10-03 42 int cpu, unsigned int *thread);
0344c6c5387ba3 Christian Krafft 2006-10-24 43
8a25a2fd126c62 Kay Sievers 2011-12-21 @44 extern int cpu_add_dev_attr(struct device_attribute *attr);
8a25a2fd126c62 Kay Sievers 2011-12-21 45 extern void cpu_remove_dev_attr(struct device_attribute *attr);
0344c6c5387ba3 Christian Krafft 2006-10-24 46
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
10 months
Re: [PATCH 2/2] PCI: vmd: Override ASPM on TGL/ADL VMD devices
by kernel test robot
Hi "David,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on helgaas-pci/next]
[also build test WARNING on v5.16-rc1 next-20211118]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/David-E-Box/PCI-ASPM-Add-ASPM-BI...
base: https://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git next
config: x86_64-buildonly-randconfig-r001-20211118 (attached as .config)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/d0452407e2d5bf22bd1094654d7e86831...
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review David-E-Box/PCI-ASPM-Add-ASPM-BIOS-override-function/20211120-095959
git checkout d0452407e2d5bf22bd1094654d7e868311b7c94e
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All warnings (new ones prefixed by >>):
>> drivers/pci/controller/vmd.c:676:5: warning: no previous prototype for function 'vmd_enable_aspm' [-Wmissing-prototypes]
int vmd_enable_aspm(struct pci_dev *pdev, void *userdata)
^
drivers/pci/controller/vmd.c:676:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
int vmd_enable_aspm(struct pci_dev *pdev, void *userdata)
^
static
1 warning generated.
vim +/vmd_enable_aspm +676 drivers/pci/controller/vmd.c
671
672 /*
673 * Override the BIOS ASPM policy and set the LTR value for PCI storage
674 * devices on the VMD bride.
675 */
> 676 int vmd_enable_aspm(struct pci_dev *pdev, void *userdata)
677 {
678 int features = *(int *)userdata;
679
680 if (features & VMD_FEAT_QUIRK_OVERRIDE_ASPM &&
681 pdev->class == PCI_CLASS_STORAGE_EXPRESS) {
682 int pos = pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_LTR);
683
684 if (pos) {
685 pci_write_config_word(pdev, pos + PCI_LTR_MAX_SNOOP_LAT, 0x1003);
686 pci_write_config_word(pdev, pos + PCI_LTR_MAX_NOSNOOP_LAT, 0x1003);
687 pcie_aspm_policy_override(pdev);
688 }
689 }
690 return 0;
691 }
692
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
10 months
[freescale-fslc:pr/502 11426/15836] drivers/firmware/imx/s400-api.c:161:16: warning: no previous prototype for function 'imx_soc_device_register'
by kernel test robot
Hi Alice,
FYI, the error/warning still remains.
tree: https://github.com/Freescale/linux-fslc pr/502
head: f040ed8ce37b5dc2c7d94005a4788549dcb608d1
commit: 3bc399ee42d1bb2c1d442bb524711eda588f13ca [11426/15836] MLK-25423-2 firmware: imx: register i.MX8ULP SoC device
config: arm-randconfig-c002-20211119 (attached as .config)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install arm cross compiling tool for clang build
# apt-get install binutils-arm-linux-gnueabi
# https://github.com/Freescale/linux-fslc/commit/3bc399ee42d1bb2c1d442bb524...
git remote add freescale-fslc https://github.com/Freescale/linux-fslc
git fetch --no-tags freescale-fslc pr/502
git checkout 3bc399ee42d1bb2c1d442bb524711eda588f13ca
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=arm
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All warnings (new ones prefixed by >>):
>> drivers/firmware/imx/s400-api.c:161:16: warning: no previous prototype for function 'imx_soc_device_register' [-Wmissing-prototypes]
struct device *imx_soc_device_register(void)
^
drivers/firmware/imx/s400-api.c:161:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
struct device *imx_soc_device_register(void)
^
static
1 warning generated.
vim +/imx_soc_device_register +161 drivers/firmware/imx/s400-api.c
160
> 161 struct device *imx_soc_device_register(void)
162 {
163 struct soc_device_attribute *attr;
164 struct soc_device *dev;
165 u32 v[4];
166 int err;
167
168 s400_api_export->tx_msg.header = 0x17970206;
169 s400_api_export->tx_msg.data[0] = 0x1;
170 err = imx_s400_api_call(s400_api_export, v);
171 if (err)
172 return NULL;
173
174 attr = kzalloc(sizeof(*attr), GFP_KERNEL);
175 if (!attr)
176 return NULL;
177
178 attr->family = kasprintf(GFP_KERNEL, "Freescale i.MX");
179 attr->revision = kasprintf(GFP_KERNEL, "unknown");
180 attr->serial_number = kasprintf(GFP_KERNEL, "%016llX", (u64)v[3] << 32 | v[0]);
181 attr->soc_id = kasprintf(GFP_KERNEL, "i.MX8ULP");
182
183 dev = soc_device_register(attr);
184 if (IS_ERR(dev)) {
185 kfree(attr->soc_id);
186 kfree(attr->serial_number);
187 kfree(attr->revision);
188 kfree(attr->family);
189 kfree(attr);
190 return ERR_CAST(dev);
191 }
192
193 return soc_device_to_device(dev);
194 }
195
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
10 months
sound/soc/fsl/imx-card.c:631:59: sparse: sparse: incorrect type in assignment (different base types)
by kernel test robot
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: a90af8f15bdc9449ee2d24e1d73fa3f7e8633f81
commit: aa736700f42fa0813e286ca2f9274ffaa25163b9 ASoC: imx-card: Add imx-card machine driver
date: 6 months ago
config: sparc64-randconfig-s031-20211116 (attached as .config)
compiler: sparc64-linux-gcc (GCC) 11.2.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.4-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit...
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout aa736700f42fa0813e286ca2f9274ffaa25163b9
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=sparc64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
sparse warnings: (new ones prefixed by >>)
sound/soc/fsl/imx-card.c:121:27: sparse: sparse: symbol 'ak4458_fs_mul' was not declared. Should it be static?
sound/soc/fsl/imx-card.c:138:31: sparse: sparse: symbol 'ak4458_tdm_fs_mul' was not declared. Should it be static?
sound/soc/fsl/imx-card.c:149:27: sparse: sparse: symbol 'ak4497_fs_mul' was not declared. Should it be static?
sound/soc/fsl/imx-card.c:166:27: sparse: sparse: symbol 'ak5558_fs_mul' was not declared. Should it be static?
sound/soc/fsl/imx-card.c:180:31: sparse: sparse: symbol 'ak5558_tdm_fs_mul' was not declared. Should it be static?
>> sound/soc/fsl/imx-card.c:631:59: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] asrc_format @@ got restricted snd_pcm_format_t [usertype] @@
sound/soc/fsl/imx-card.c:631:59: sparse: expected unsigned int [usertype] asrc_format
sound/soc/fsl/imx-card.c:631:59: sparse: got restricted snd_pcm_format_t [usertype]
sound/soc/fsl/imx-card.c:633:59: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] asrc_format @@ got restricted snd_pcm_format_t [usertype] @@
sound/soc/fsl/imx-card.c:633:59: sparse: expected unsigned int [usertype] asrc_format
sound/soc/fsl/imx-card.c:633:59: sparse: got restricted snd_pcm_format_t [usertype]
vim +631 sound/soc/fsl/imx-card.c
472
473 static int imx_card_parse_of(struct imx_card_data *data)
474 {
475 struct imx_card_plat_data *plat_data = data->plat_data;
476 struct snd_soc_card *card = &data->card;
477 struct snd_soc_dai_link_component *dlc;
478 struct device_node *platform = NULL;
479 struct device_node *codec = NULL;
480 struct device_node *cpu = NULL;
481 struct device_node *np;
482 struct device *dev = card->dev;
483 struct snd_soc_dai_link *link;
484 struct dai_link_data *link_data;
485 struct of_phandle_args args;
486 int ret, num_links;
487 u32 width;
488
489 ret = snd_soc_of_parse_card_name(card, "model");
490 if (ret) {
491 dev_err(dev, "Error parsing card name: %d\n", ret);
492 return ret;
493 }
494
495 /* DAPM routes */
496 if (of_property_read_bool(dev->of_node, "audio-routing")) {
497 ret = snd_soc_of_parse_audio_routing(card, "audio-routing");
498 if (ret)
499 return ret;
500 }
501
502 /* Populate links */
503 num_links = of_get_child_count(dev->of_node);
504
505 /* Allocate the DAI link array */
506 card->dai_link = devm_kcalloc(dev, num_links, sizeof(*link), GFP_KERNEL);
507 if (!card->dai_link)
508 return -ENOMEM;
509
510 data->link_data = devm_kcalloc(dev, num_links, sizeof(*link), GFP_KERNEL);
511 if (!data->link_data)
512 return -ENOMEM;
513
514 card->num_links = num_links;
515 link = card->dai_link;
516 link_data = data->link_data;
517
518 for_each_child_of_node(dev->of_node, np) {
519 dlc = devm_kzalloc(dev, 2 * sizeof(*dlc), GFP_KERNEL);
520 if (!dlc) {
521 ret = -ENOMEM;
522 goto err_put_np;
523 }
524
525 link->cpus = &dlc[0];
526 link->platforms = &dlc[1];
527
528 link->num_cpus = 1;
529 link->num_platforms = 1;
530
531 ret = of_property_read_string(np, "link-name", &link->name);
532 if (ret) {
533 dev_err(card->dev, "error getting codec dai_link name\n");
534 goto err_put_np;
535 }
536
537 cpu = of_get_child_by_name(np, "cpu");
538 if (!cpu) {
539 dev_err(dev, "%s: Can't find cpu DT node\n", link->name);
540 ret = -EINVAL;
541 goto err;
542 }
543
544 ret = of_parse_phandle_with_args(cpu, "sound-dai",
545 "#sound-dai-cells", 0, &args);
546 if (ret) {
547 dev_err(card->dev, "%s: error getting cpu phandle\n", link->name);
548 goto err;
549 }
550
551 if (of_node_name_eq(args.np, "sai")) {
552 /* sai sysclk id */
553 link_data->cpu_sysclk_id = FSL_SAI_CLK_MAST1;
554
555 /* sai may support mclk/bclk = 1 */
556 if (of_find_property(np, "fsl,mclk-equal-bclk", NULL))
557 link_data->one2one_ratio = true;
558 }
559
560 link->cpus->of_node = args.np;
561 link->platforms->of_node = link->cpus->of_node;
562 link->id = args.args[0];
563
564 ret = snd_soc_of_get_dai_name(cpu, &link->cpus->dai_name);
565 if (ret) {
566 if (ret != -EPROBE_DEFER)
567 dev_err(card->dev, "%s: error getting cpu dai name: %d\n",
568 link->name, ret);
569 goto err;
570 }
571
572 codec = of_get_child_by_name(np, "codec");
573 if (codec) {
574 ret = snd_soc_of_get_dai_link_codecs(dev, codec, link);
575 if (ret < 0) {
576 if (ret != -EPROBE_DEFER)
577 dev_err(dev, "%s: codec dai not found: %d\n",
578 link->name, ret);
579 goto err;
580 }
581
582 plat_data->num_codecs = link->num_codecs;
583
584 /* Check the akcodec type */
585 if (!strcmp(link->codecs->dai_name, "ak4458-aif"))
586 plat_data->type = CODEC_AK4458;
587 else if (!strcmp(link->codecs->dai_name, "ak4497-aif"))
588 plat_data->type = CODEC_AK4497;
589 else if (!strcmp(link->codecs->dai_name, "ak5558-aif"))
590 plat_data->type = CODEC_AK5558;
591 else if (!strcmp(link->codecs->dai_name, "ak5552-aif"))
592 plat_data->type = CODEC_AK5552;
593
594 } else {
595 dlc = devm_kzalloc(dev, sizeof(*dlc), GFP_KERNEL);
596 if (!dlc) {
597 ret = -ENOMEM;
598 goto err;
599 }
600
601 link->codecs = dlc;
602 link->num_codecs = 1;
603
604 link->codecs->dai_name = "snd-soc-dummy-dai";
605 link->codecs->name = "snd-soc-dummy";
606 }
607
608 if (!strncmp(link->name, "HiFi-ASRC-FE", 12)) {
609 /* DPCM frontend */
610 link->dynamic = 1;
611 link->dpcm_merged_chan = 1;
612
613 ret = of_property_read_u32(args.np, "fsl,asrc-rate", &data->asrc_rate);
614 if (ret) {
615 dev_err(dev, "failed to get output rate\n");
616 ret = -EINVAL;
617 goto err;
618 }
619
620 ret = of_property_read_u32(args.np, "fsl,asrc-format", &data->asrc_format);
621 if (ret) {
622 /* Fallback to old binding; translate to asrc_format */
623 ret = of_property_read_u32(args.np, "fsl,asrc-width", &width);
624 if (ret) {
625 dev_err(dev,
626 "failed to decide output format\n");
627 goto err;
628 }
629
630 if (width == 24)
> 631 data->asrc_format = SNDRV_PCM_FORMAT_S24_LE;
632 else
633 data->asrc_format = SNDRV_PCM_FORMAT_S16_LE;
634 }
635 } else if (!strncmp(link->name, "HiFi-ASRC-BE", 12)) {
636 /* DPCM backend */
637 link->no_pcm = 1;
638 link->platforms->of_node = NULL;
639 link->platforms->name = "snd-soc-dummy";
640
641 link->be_hw_params_fixup = be_hw_params_fixup;
642 link->ops = &imx_aif_ops_be;
643 } else {
644 link->ops = &imx_aif_ops;
645 }
646
647 if (link->no_pcm || link->dynamic)
648 snd_soc_dai_link_set_capabilities(link);
649
650 /* Get dai fmt */
651 ret = asoc_simple_parse_daifmt(dev, np, codec,
652 NULL, &link->dai_fmt);
653 if (ret)
654 link->dai_fmt = SND_SOC_DAIFMT_NB_NF |
655 SND_SOC_DAIFMT_CBS_CFS |
656 SND_SOC_DAIFMT_I2S;
657
658 /* Get tdm slot */
659 snd_soc_of_parse_tdm_slot(np, NULL, NULL,
660 &link_data->slots,
661 &link_data->slot_width);
662 /* default value */
663 if (!link_data->slots)
664 link_data->slots = 2;
665
666 if (!link_data->slot_width)
667 link_data->slot_width = 32;
668
669 link->ignore_pmdown_time = 1;
670 link->stream_name = link->name;
671 link++;
672 link_data++;
673
674 of_node_put(cpu);
675 of_node_put(codec);
676 of_node_put(platform);
677 }
678
679 return 0;
680 err:
681 of_node_put(cpu);
682 of_node_put(codec);
683 of_node_put(platform);
684 err_put_np:
685 of_node_put(np);
686 return ret;
687 }
688
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
10 months