drivers/misc/habanalabs/gaudi/gaudi.c:902 _gaudi_init_tpc_mem() warn: should 'cb->id << (12)' be a 64 bit
From: kernel test robot
Date: Mon Aug 10 2020 - 11:18:27 EST
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: fc80c51fd4b23ec007e88d4c688f2cac1b8648e7
commit: ac0ae6a96aa58eeba4aed97b12ef1dea8c5bf399 habanalabs: add gaudi asic-dependent code
date: 3 months ago
config: riscv-randconfig-m031-20200810 (attached as .config)
compiler: riscv32-linux-gcc (GCC) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>
smatch warnings:
drivers/misc/habanalabs/gaudi/gaudi.c:902 _gaudi_init_tpc_mem() warn: should 'cb->id << (12)' be a 64 bit type?
drivers/misc/habanalabs/gaudi/gaudi.c:4612 gaudi_memset_device_memory() warn: should 'cb->id << (12)' be a 64 bit type?
vim +902 drivers/misc/habanalabs/gaudi/gaudi.c
829
830 static int _gaudi_init_tpc_mem(struct hl_device *hdev,
831 dma_addr_t tpc_kernel_src_addr, u32 tpc_kernel_size)
832 {
833 struct asic_fixed_properties *prop = &hdev->asic_prop;
834 struct packet_lin_dma *init_tpc_mem_pkt;
835 struct hl_cs_job *job;
836 struct hl_cb *cb;
837 u64 dst_addr;
838 u32 cb_size, ctl;
839 u8 tpc_id;
840 int rc;
841
842 cb = hl_cb_kernel_create(hdev, PAGE_SIZE);
843 if (!cb)
844 return -EFAULT;
845
846 init_tpc_mem_pkt = (struct packet_lin_dma *) (uintptr_t)
847 cb->kernel_address;
848 cb_size = sizeof(*init_tpc_mem_pkt);
849 memset(init_tpc_mem_pkt, 0, cb_size);
850
851 init_tpc_mem_pkt->tsize = cpu_to_le32(tpc_kernel_size);
852
853 ctl = ((PACKET_LIN_DMA << GAUDI_PKT_CTL_OPCODE_SHIFT) |
854 (1 << GAUDI_PKT_LIN_DMA_CTL_LIN_SHIFT) |
855 (1 << GAUDI_PKT_CTL_RB_SHIFT) |
856 (1 << GAUDI_PKT_CTL_MB_SHIFT));
857
858 init_tpc_mem_pkt->ctl = cpu_to_le32(ctl);
859
860 init_tpc_mem_pkt->src_addr = cpu_to_le64(tpc_kernel_src_addr);
861 dst_addr = (prop->sram_user_base_address &
862 GAUDI_PKT_LIN_DMA_DST_ADDR_MASK) >>
863 GAUDI_PKT_LIN_DMA_DST_ADDR_SHIFT;
864 init_tpc_mem_pkt->dst_addr |= cpu_to_le64(dst_addr);
865
866 job = hl_cs_allocate_job(hdev, QUEUE_TYPE_EXT, true);
867 if (!job) {
868 dev_err(hdev->dev, "Failed to allocate a new job\n");
869 rc = -ENOMEM;
870 goto release_cb;
871 }
872
873 job->id = 0;
874 job->user_cb = cb;
875 job->user_cb->cs_cnt++;
876 job->user_cb_size = cb_size;
877 job->hw_queue_id = GAUDI_QUEUE_ID_DMA_0_0;
878 job->patched_cb = job->user_cb;
879 job->job_cb_size = job->user_cb_size + sizeof(struct packet_msg_prot);
880
881 hl_debugfs_add_job(hdev, job);
882
883 rc = gaudi_send_job_on_qman0(hdev, job);
884
885 if (rc)
886 goto free_job;
887
888 for (tpc_id = 0 ; tpc_id < TPC_NUMBER_OF_ENGINES ; tpc_id++) {
889 rc = gaudi_run_tpc_kernel(hdev, dst_addr, tpc_id);
890 if (rc)
891 break;
892 }
893
894 free_job:
895 hl_userptr_delete_list(hdev, &job->userptr_list);
896 hl_debugfs_remove_job(hdev, job);
897 kfree(job);
898 cb->cs_cnt--;
899
900 release_cb:
901 hl_cb_put(cb);
> 902 hl_cb_destroy(hdev, &hdev->kernel_cb_mgr, cb->id << PAGE_SHIFT);
903
904 return rc;
905 }
906
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx
Attachment:
.config.gz
Description: application/gzip