[PATCH v6 6/8] mailbox: mediatek: Add CMDQ secure mailbox driver
kernel test robot
lkp at intel.com
Sun May 26 01:59:51 UTC 2024
Hi Jason-JH.Lin,
kernel test robot noticed the following build warnings:
[auto build test WARNING on linus/master]
[also build test WARNING on next-20240523]
[cannot apply to robh/for-next krzk-dt/for-next fujitsu-integration/mailbox-for-next v6.9]
[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#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Jason-JH-Lin/dt-bindings-gce-mt8195-Add-CMDQ_SYNC_TOKEN_SECURE_THR_EOF-event-id/20240526-071102
base: linus/master
patch link: https://lore.kernel.org/r/20240525230810.24623-7-jason-jh.lin%40mediatek.com
patch subject: [PATCH v6 6/8] mailbox: mediatek: Add CMDQ secure mailbox driver
config: m68k-allyesconfig (https://download.01.org/0day-ci/archive/20240526/202405260953.uzQ4Rwg2-lkp@intel.com/config)
compiler: m68k-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240526/202405260953.uzQ4Rwg2-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp at intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202405260953.uzQ4Rwg2-lkp@intel.com/
All warnings (new ones prefixed by >>):
drivers/mailbox/mtk-cmdq-sec-mailbox.c: In function 'cmdq_sec_task_exec_work':
>> drivers/mailbox/mtk-cmdq-sec-mailbox.c:619:31: warning: variable 'data' set but not used [-Wunused-but-set-variable]
619 | struct cmdq_sec_data *data;
| ^~~~
vim +/data +619 drivers/mailbox/mtk-cmdq-sec-mailbox.c
611
612 static void cmdq_sec_task_exec_work(struct work_struct *work_item)
613 {
614 struct cmdq_sec_task *sec_task = container_of(work_item,
615 struct cmdq_sec_task, exec_work);
616 struct cmdq_sec_thread *sec_thread = container_of(sec_task->task.thread,
617 struct cmdq_sec_thread, thread);
618 struct cmdq_sec *cmdq = container_of(sec_thread->dev, struct cmdq_sec, dev);
> 619 struct cmdq_sec_data *data;
620 unsigned long flags;
621 int err;
622
623 dev_dbg(&cmdq->dev, "%s gce:%#lx sec_task:%p pkt:%p thread:%u",
624 __func__, (unsigned long)cmdq->base_pa,
625 sec_task, sec_task->task.pkt, sec_thread->idx);
626
627 if (!sec_task->task.pkt->sec_data) {
628 dev_err(&cmdq->dev, "pkt:%p without sec_data", sec_task->task.pkt);
629 return;
630 }
631 data = (struct cmdq_sec_data *)sec_task->task.pkt->sec_data;
632
633 mutex_lock(&cmdq->exec_lock);
634
635 spin_lock_irqsave(&sec_thread->thread.chan->lock, flags);
636 if (!sec_thread->task_cnt) {
637 mod_timer(&sec_thread->timeout, jiffies +
638 msecs_to_jiffies(sec_thread->timeout_ms));
639 sec_thread->wait_cookie = 1;
640 sec_thread->next_cookie = 1;
641 sec_thread->task_cnt = 0;
642 __raw_writel(0, (void __iomem *)cmdq->shared_mem->va +
643 CMDQ_SEC_SHARED_THR_CNT_OFFSET + sec_thread->idx * sizeof(u32));
644 }
645
646 sec_task->reset_exec = sec_thread->task_cnt ? false : true;
647 sec_task->wait_cookie = sec_thread->next_cookie;
648 sec_thread->next_cookie = (sec_thread->next_cookie + 1) % CMDQ_MAX_COOKIE_VALUE;
649 list_add_tail(&sec_task->task.list_entry, &sec_thread->thread.task_busy_list);
650 sec_thread->task_cnt += 1;
651 spin_unlock_irqrestore(&sec_thread->thread.chan->lock, flags);
652 sec_task->trigger = sched_clock();
653
654 if (!atomic_cmpxchg(&cmdq_path_res, 0, 1)) {
655 err = cmdq_sec_task_submit(cmdq, NULL, CMD_CMDQ_IWC_PATH_RES_ALLOCATE,
656 CMDQ_INVALID_THREAD);
657 if (err) {
658 atomic_set(&cmdq_path_res, 0);
659 goto task_end;
660 }
661 }
662
663 if (sec_thread->task_cnt > CMDQ_MAX_TASK_IN_SECURE_THREAD) {
664 dev_err(&cmdq->dev, "task_cnt:%u cannot more than %u sec_task:%p thread:%u",
665 sec_thread->task_cnt, CMDQ_MAX_TASK_IN_SECURE_THREAD,
666 sec_task, sec_thread->idx);
667 err = -EMSGSIZE;
668 goto task_end;
669 }
670
671 err = cmdq_sec_task_submit(cmdq, sec_task, CMD_CMDQ_IWC_SUBMIT_TASK,
672 sec_thread->idx);
673 if (err)
674 dev_err(&cmdq->dev, "cmdq_sec_task_submit err:%d sec_task:%p thread:%u",
675 err, sec_task, sec_thread->idx);
676
677 task_end:
678 if (err) {
679 struct cmdq_cb_data cb_data;
680
681 cb_data.sta = err;
682 cb_data.pkt = sec_task->task.pkt;
683 mbox_chan_received_data(sec_thread->thread.chan, &cb_data);
684
685 spin_lock_irqsave(&sec_thread->thread.chan->lock, flags);
686 if (!sec_thread->task_cnt)
687 dev_err(&cmdq->dev, "thread:%u task_cnt:%u cannot below zero",
688 sec_thread->idx, sec_thread->task_cnt);
689 else
690 sec_thread->task_cnt -= 1;
691
692 sec_thread->next_cookie = (sec_thread->next_cookie - 1 +
693 CMDQ_MAX_COOKIE_VALUE) % CMDQ_MAX_COOKIE_VALUE;
694 list_del(&sec_task->task.list_entry);
695 dev_dbg(&cmdq->dev, "gce:%#lx err:%d sec_task:%p pkt:%p",
696 (unsigned long)cmdq->base_pa, err, sec_task, sec_task->task.pkt);
697 dev_dbg(&cmdq->dev, "thread:%u task_cnt:%u wait_cookie:%u next_cookie:%u",
698 sec_thread->idx, sec_thread->task_cnt,
699 sec_thread->wait_cookie, sec_thread->next_cookie);
700 spin_unlock_irqrestore(&sec_thread->thread.chan->lock, flags);
701
702 kfree(sec_task);
703 }
704
705 mutex_unlock(&cmdq->exec_lock);
706 }
707
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
More information about the dri-devel
mailing list