Re: [PATCH] bus: mhi: host: Add tracing support
From: kernel test robot
Date: Tue Oct 10 2023 - 11:44:15 EST
Hi Krishna,
kernel test robot noticed the following build warnings:
[auto build test WARNING on 3006adf3be79cde4d14b1800b963b82b6e5572e0]
url: https://github.com/intel-lab-lkp/linux/commits/Krishna-chaitanya-chundru/bus-mhi-host-Add-tracing-support/20231005-231430
base: 3006adf3be79cde4d14b1800b963b82b6e5572e0
patch link: https://lore.kernel.org/r/20231005-ftrace_support-v1-1-23a2f394fa49%40quicinc.com
patch subject: [PATCH] bus: mhi: host: Add tracing support
config: i386-randconfig-062-20231010 (https://download.01.org/0day-ci/archive/20231010/202310102355.6SEa9YSi-lkp@xxxxxxxxx/config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231010/202310102355.6SEa9YSi-lkp@xxxxxxxxx/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@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202310102355.6SEa9YSi-lkp@xxxxxxxxx/
sparse warnings: (new ones prefixed by >>)
>> drivers/bus/mhi/host/main.c:835:56: sparse: sparse: incorrect type in argument 3 (different base types) @@ expected unsigned long long [usertype] ptr @@ got restricted __le64 [usertype] ptr @@
drivers/bus/mhi/host/main.c:835:56: sparse: expected unsigned long long [usertype] ptr
drivers/bus/mhi/host/main.c:835:56: sparse: got restricted __le64 [usertype] ptr
>> drivers/bus/mhi/host/main.c:835:78: sparse: sparse: incorrect type in argument 4 (different base types) @@ expected int dword0 @@ got restricted __le32 @@
drivers/bus/mhi/host/main.c:835:78: sparse: expected int dword0
drivers/bus/mhi/host/main.c:835:78: sparse: got restricted __le32
>> drivers/bus/mhi/host/main.c:836:63: sparse: sparse: incorrect type in argument 5 (different base types) @@ expected int dword1 @@ got restricted __le32 @@
drivers/bus/mhi/host/main.c:836:63: sparse: expected int dword1
drivers/bus/mhi/host/main.c:836:63: sparse: got restricted __le32
drivers/bus/mhi/host/main.c:1004:85: sparse: sparse: incorrect type in argument 2 (different base types) @@ expected unsigned long long [usertype] ptr @@ got restricted __le64 [usertype] ptr @@
drivers/bus/mhi/host/main.c:1004:85: sparse: expected unsigned long long [usertype] ptr
drivers/bus/mhi/host/main.c:1004:85: sparse: got restricted __le64 [usertype] ptr
drivers/bus/mhi/host/main.c:1005:66: sparse: sparse: incorrect type in argument 3 (different base types) @@ expected int dword0 @@ got restricted __le32 @@
drivers/bus/mhi/host/main.c:1005:66: sparse: expected int dword0
drivers/bus/mhi/host/main.c:1005:66: sparse: got restricted __le32
drivers/bus/mhi/host/main.c:1005:86: sparse: sparse: incorrect type in argument 4 (different base types) @@ expected int dword1 @@ got restricted __le32 @@
drivers/bus/mhi/host/main.c:1005:86: sparse: expected int dword1
drivers/bus/mhi/host/main.c:1005:86: sparse: got restricted __le32
>> drivers/bus/mhi/host/main.c:1246:34: sparse: sparse: incorrect type in argument 4 (different base types) @@ expected unsigned long long [usertype] tre_ptr @@ got restricted __le64 [usertype] ptr @@
drivers/bus/mhi/host/main.c:1246:34: sparse: expected unsigned long long [usertype] tre_ptr
drivers/bus/mhi/host/main.c:1246:34: sparse: got restricted __le64 [usertype] ptr
drivers/bus/mhi/host/main.c:1246:55: sparse: sparse: incorrect type in argument 5 (different base types) @@ expected int dword0 @@ got restricted __le32 @@
drivers/bus/mhi/host/main.c:1246:55: sparse: expected int dword0
drivers/bus/mhi/host/main.c:1246:55: sparse: got restricted __le32
drivers/bus/mhi/host/main.c:1246:74: sparse: sparse: incorrect type in argument 6 (different base types) @@ expected int dword1 @@ got restricted __le32 @@
drivers/bus/mhi/host/main.c:1246:74: sparse: expected int dword1
drivers/bus/mhi/host/main.c:1246:74: sparse: got restricted __le32
>> drivers/bus/mhi/host/main.c:834:80: sparse: sparse: non size-preserving pointer to integer cast
drivers/bus/mhi/host/main.c:1245:75: sparse: sparse: non size-preserving pointer to integer cast
vim +835 drivers/bus/mhi/host/main.c
799
800 int mhi_process_ctrl_ev_ring(struct mhi_controller *mhi_cntrl,
801 struct mhi_event *mhi_event,
802 u32 event_quota)
803 {
804 struct mhi_ring_element *dev_rp, *local_rp;
805 struct mhi_ring *ev_ring = &mhi_event->ring;
806 struct mhi_event_ctxt *er_ctxt =
807 &mhi_cntrl->mhi_ctxt->er_ctxt[mhi_event->er_index];
808 struct mhi_chan *mhi_chan;
809 struct device *dev = &mhi_cntrl->mhi_dev->dev;
810 u32 chan;
811 int count = 0;
812 dma_addr_t ptr = le64_to_cpu(er_ctxt->rp);
813
814 /*
815 * This is a quick check to avoid unnecessary event processing
816 * in case MHI is already in error state, but it's still possible
817 * to transition to error state while processing events
818 */
819 if (unlikely(MHI_EVENT_ACCESS_INVALID(mhi_cntrl->pm_state)))
820 return -EIO;
821
822 if (!is_valid_ring_ptr(ev_ring, ptr)) {
823 dev_err(&mhi_cntrl->mhi_dev->dev,
824 "Event ring rp points outside of the event ring\n");
825 return -EIO;
826 }
827
828 dev_rp = mhi_to_virtual(ev_ring, ptr);
829 local_rp = ev_ring->rp;
830
831 while (dev_rp != local_rp) {
832 enum mhi_pkt_type type = MHI_TRE_GET_EV_TYPE(local_rp);
833
> 834 trace_mhi_process_ctrl_ev_ring(mhi_cntrl->mhi_dev->name, (u64)(local_rp),
> 835 local_rp->ptr, local_rp->dword[0],
> 836 local_rp->dword[1],
837 mhi_state_str(MHI_TRE_GET_EV_STATE(local_rp)));
838
839 switch (type) {
840 case MHI_PKT_TYPE_BW_REQ_EVENT:
841 {
842 struct mhi_link_info *link_info;
843
844 link_info = &mhi_cntrl->mhi_link_info;
845 write_lock_irq(&mhi_cntrl->pm_lock);
846 link_info->target_link_speed =
847 MHI_TRE_GET_EV_LINKSPEED(local_rp);
848 link_info->target_link_width =
849 MHI_TRE_GET_EV_LINKWIDTH(local_rp);
850 write_unlock_irq(&mhi_cntrl->pm_lock);
851 dev_dbg(dev, "Received BW_REQ event\n");
852 mhi_cntrl->status_cb(mhi_cntrl, MHI_CB_BW_REQ);
853 break;
854 }
855 case MHI_PKT_TYPE_STATE_CHANGE_EVENT:
856 {
857 enum mhi_state new_state;
858
859 new_state = MHI_TRE_GET_EV_STATE(local_rp);
860
861 dev_dbg(dev, "State change event to state: %s\n",
862 mhi_state_str(new_state));
863
864 switch (new_state) {
865 case MHI_STATE_M0:
866 mhi_pm_m0_transition(mhi_cntrl);
867 break;
868 case MHI_STATE_M1:
869 mhi_pm_m1_transition(mhi_cntrl);
870 break;
871 case MHI_STATE_M3:
872 mhi_pm_m3_transition(mhi_cntrl);
873 break;
874 case MHI_STATE_SYS_ERR:
875 {
876 enum mhi_pm_state pm_state;
877
878 dev_dbg(dev, "System error detected\n");
879 write_lock_irq(&mhi_cntrl->pm_lock);
880 pm_state = mhi_tryset_pm_state(mhi_cntrl,
881 MHI_PM_SYS_ERR_DETECT);
882 write_unlock_irq(&mhi_cntrl->pm_lock);
883 if (pm_state == MHI_PM_SYS_ERR_DETECT)
884 mhi_pm_sys_err_handler(mhi_cntrl);
885 break;
886 }
887 default:
888 dev_err(dev, "Invalid state: %s\n",
889 mhi_state_str(new_state));
890 }
891
892 break;
893 }
894 case MHI_PKT_TYPE_CMD_COMPLETION_EVENT:
895 mhi_process_cmd_completion(mhi_cntrl, local_rp);
896 break;
897 case MHI_PKT_TYPE_EE_EVENT:
898 {
899 enum dev_st_transition st = DEV_ST_TRANSITION_MAX;
900 enum mhi_ee_type event = MHI_TRE_GET_EV_EXECENV(local_rp);
901
902 dev_dbg(dev, "Received EE event: %s\n",
903 TO_MHI_EXEC_STR(event));
904 switch (event) {
905 case MHI_EE_SBL:
906 st = DEV_ST_TRANSITION_SBL;
907 break;
908 case MHI_EE_WFW:
909 case MHI_EE_AMSS:
910 st = DEV_ST_TRANSITION_MISSION_MODE;
911 break;
912 case MHI_EE_FP:
913 st = DEV_ST_TRANSITION_FP;
914 break;
915 case MHI_EE_RDDM:
916 mhi_cntrl->status_cb(mhi_cntrl, MHI_CB_EE_RDDM);
917 write_lock_irq(&mhi_cntrl->pm_lock);
918 mhi_cntrl->ee = event;
919 write_unlock_irq(&mhi_cntrl->pm_lock);
920 wake_up_all(&mhi_cntrl->state_event);
921 break;
922 default:
923 dev_err(dev,
924 "Unhandled EE event: 0x%x\n", type);
925 }
926 if (st != DEV_ST_TRANSITION_MAX)
927 mhi_queue_state_transition(mhi_cntrl, st);
928
929 break;
930 }
931 case MHI_PKT_TYPE_TX_EVENT:
932 chan = MHI_TRE_GET_EV_CHID(local_rp);
933
934 WARN_ON(chan >= mhi_cntrl->max_chan);
935
936 /*
937 * Only process the event ring elements whose channel
938 * ID is within the maximum supported range.
939 */
940 if (chan < mhi_cntrl->max_chan) {
941 mhi_chan = &mhi_cntrl->mhi_chan[chan];
942 if (!mhi_chan->configured)
943 break;
944 parse_xfer_event(mhi_cntrl, local_rp, mhi_chan);
945 }
946 break;
947 default:
948 dev_err(dev, "Unhandled event type: %d\n", type);
949 break;
950 }
951
952 mhi_recycle_ev_ring_element(mhi_cntrl, ev_ring);
953 local_rp = ev_ring->rp;
954
955 ptr = le64_to_cpu(er_ctxt->rp);
956 if (!is_valid_ring_ptr(ev_ring, ptr)) {
957 dev_err(&mhi_cntrl->mhi_dev->dev,
958 "Event ring rp points outside of the event ring\n");
959 return -EIO;
960 }
961
962 dev_rp = mhi_to_virtual(ev_ring, ptr);
963 count++;
964 }
965
966 read_lock_bh(&mhi_cntrl->pm_lock);
967
968 /* Ring EV DB only if there is any pending element to process */
969 if (likely(MHI_DB_ACCESS_VALID(mhi_cntrl)) && count)
970 mhi_ring_er_db(mhi_event);
971 read_unlock_bh(&mhi_cntrl->pm_lock);
972
973 return count;
974 }
975
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki