linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: kbuild test robot <lkp@intel.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: kbuild-all@lists.01.org,
	Linux Memory Management List <linux-mm@kvack.org>
Subject: [linux-next:master 5171/7050] drivers/scsi/qla2xxx/qla_iocb.c:3547:13: sparse: sparse: incorrect type in argument 1 (different base types)
Date: Sun, 8 Mar 2020 10:13:24 +0800	[thread overview]
Message-ID: <202003081021.Hym7BolI%lkp@intel.com> (raw)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   b86a6a241b7c60ca7a6ca4fb3c0d2aedbbf2c1b6
commit: c25eb70a10243c1ad24e74375aceb65ab8951e93 [5171/7050] scsi: qla2xxx: Convert MAKE_HANDLE() from a define into an inline function
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.1-174-g094d5a94-dirty
        git checkout c25eb70a10243c1ad24e74375aceb65ab8951e93
        make ARCH=x86_64 allmodconfig
        make C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>


sparse warnings: (new ones prefixed by >>)

   drivers/scsi/qla2xxx/qla_iocb.c:2473:18: sparse:    got restricted __le16 [usertype]
   drivers/scsi/qla2xxx/qla_iocb.c:2474:18: sparse: sparse: incorrect type in assignment (different base types) @@    expected unsigned short [usertype] mb7 @@    got resunsigned short [usertype] mb7 @@
   drivers/scsi/qla2xxx/qla_iocb.c:2474:18: sparse:    expected unsigned short [usertype] mb7
   drivers/scsi/qla2xxx/qla_iocb.c:2474:18: sparse:    got restricted __le16 [usertype]
   drivers/scsi/qla2xxx/qla_iocb.c:2475:18: sparse: sparse: incorrect type in assignment (different base types) @@    expected unsigned short [usertype] mb9 @@    got resunsigned short [usertype] mb9 @@
   drivers/scsi/qla2xxx/qla_iocb.c:2475:18: sparse:    expected unsigned short [usertype] mb9
   drivers/scsi/qla2xxx/qla_iocb.c:2475:18: sparse:    got restricted __le16 [usertype]
   drivers/scsi/qla2xxx/qla_iocb.c:2495:27: sparse: sparse: incorrect type in assignment (different base types) @@    expected unsigned short [usertype] nport_handle @@    got resunsigned short [usertype] nport_handle @@
   drivers/scsi/qla2xxx/qla_iocb.c:2495:27: sparse:    expected unsigned short [usertype] nport_handle
   drivers/scsi/qla2xxx/qla_iocb.c:2495:27: sparse:    got restricted __le16 [usertype]
   drivers/scsi/qla2xxx/qla_iocb.c:2496:22: sparse: sparse: incorrect type in assignment (different base types) @@    expected unsigned short [usertype] timeout @@    got resunsigned short [usertype] timeout @@
   drivers/scsi/qla2xxx/qla_iocb.c:2496:22: sparse:    expected unsigned short [usertype] timeout
   drivers/scsi/qla2xxx/qla_iocb.c:2496:22: sparse:    got restricted __le16 [usertype]
   drivers/scsi/qla2xxx/qla_iocb.c:2497:28: sparse: sparse: incorrect type in assignment (different base types) @@    expected unsigned int [usertype] control_flags @@    got restrunsigned int [usertype] control_flags @@
   drivers/scsi/qla2xxx/qla_iocb.c:2497:28: sparse:    expected unsigned int [usertype] control_flags
   drivers/scsi/qla2xxx/qla_iocb.c:2497:28: sparse:    got restricted __le32 [usertype]
   drivers/scsi/qla2xxx/qla_iocb.c:2682:32: sparse: sparse: incorrect type in assignment (different base types) @@    expected unsigned short [usertype] nport_handle @@    got resunsigned short [usertype] nport_handle @@
   drivers/scsi/qla2xxx/qla_iocb.c:2682:32: sparse:    expected unsigned short [usertype] nport_handle
   drivers/scsi/qla2xxx/qla_iocb.c:2682:32: sparse:    got restricted __le16 [usertype]
   drivers/scsi/qla2xxx/qla_iocb.c:3025:32: sparse: sparse: incorrect type in assignment (different base types) @@    expected unsigned short [usertype] nport_handle @@    got resunsigned short [usertype] nport_handle @@
   drivers/scsi/qla2xxx/qla_iocb.c:3025:32: sparse:    expected unsigned short [usertype] nport_handle
   drivers/scsi/qla2xxx/qla_iocb.c:3025:32: sparse:    got restricted __le16 [usertype]
   drivers/scsi/qla2xxx/qla_iocb.c:3026:32: sparse: sparse: incorrect type in assignment (different base types) @@    expected unsigned short [usertype] tx_dsd_count @@    got resunsigned short [usertype] tx_dsd_count @@
   drivers/scsi/qla2xxx/qla_iocb.c:3026:32: sparse:    expected unsigned short [usertype] tx_dsd_count
   drivers/scsi/qla2xxx/qla_iocb.c:3026:32: sparse:    got restricted __le16 [usertype]
   drivers/scsi/qla2xxx/qla_iocb.c:3029:32: sparse: sparse: incorrect type in assignment (different base types) @@    expected unsigned short [usertype] rx_dsd_count @@    got resunsigned short [usertype] rx_dsd_count @@
   drivers/scsi/qla2xxx/qla_iocb.c:3029:32: sparse:    expected unsigned short [usertype] rx_dsd_count
   drivers/scsi/qla2xxx/qla_iocb.c:3029:32: sparse:    got restricted __le16 [usertype]
   drivers/scsi/qla2xxx/qla_iocb.c:3074:9: sparse: sparse: incorrect type in assignment (different base types) @@    expected unsigned short [usertype] extended @@    got resunsigned short [usertype] extended @@
   drivers/scsi/qla2xxx/qla_iocb.c:3074:9: sparse:    expected unsigned short [usertype] extended
   drivers/scsi/qla2xxx/qla_iocb.c:3074:9: sparse:    got restricted __le16 [usertype]
   drivers/scsi/qla2xxx/qla_iocb.c:3075:25: sparse: sparse: incorrect type in assignment (different base types) @@    expected unsigned short [usertype] status @@    got resunsigned short [usertype] status @@
   drivers/scsi/qla2xxx/qla_iocb.c:3075:25: sparse:    expected unsigned short [usertype] status
   drivers/scsi/qla2xxx/qla_iocb.c:3075:25: sparse:    got restricted __le16 [usertype]
   drivers/scsi/qla2xxx/qla_iocb.c:3076:32: sparse: sparse: incorrect type in assignment (different base types) @@    expected unsigned short [usertype] control_flags @@    got resunsigned short [usertype] control_flags @@
   drivers/scsi/qla2xxx/qla_iocb.c:3076:32: sparse:    expected unsigned short [usertype] control_flags
   drivers/scsi/qla2xxx/qla_iocb.c:3076:32: sparse:    got restricted __le16 [usertype]
   drivers/scsi/qla2xxx/qla_iocb.c:3078:32: sparse: sparse: incorrect type in assignment (different base types) @@    expected unsigned short [usertype] cmd_dsd_count @@    got resunsigned short [usertype] cmd_dsd_count @@
   drivers/scsi/qla2xxx/qla_iocb.c:3078:32: sparse:    expected unsigned short [usertype] cmd_dsd_count
   drivers/scsi/qla2xxx/qla_iocb.c:3078:32: sparse:    got restricted __le16 [usertype]
   drivers/scsi/qla2xxx/qla_iocb.c:3080:34: sparse: sparse: incorrect type in assignment (different base types) @@    expected unsigned short [usertype] total_dsd_count @@    got resunsigned short [usertype] total_dsd_count @@
   drivers/scsi/qla2xxx/qla_iocb.c:3080:34: sparse:    expected unsigned short [usertype] total_dsd_count
   drivers/scsi/qla2xxx/qla_iocb.c:3080:34: sparse:    got restricted __le16 [usertype]
   drivers/scsi/qla2xxx/qla_iocb.c:3082:32: sparse: sparse: incorrect type in assignment (different base types) @@    expected unsigned int [usertype] req_bytecount @@    got restrunsigned int [usertype] req_bytecount @@
   drivers/scsi/qla2xxx/qla_iocb.c:3082:32: sparse:    expected unsigned int [usertype] req_bytecount
   drivers/scsi/qla2xxx/qla_iocb.c:3082:32: sparse:    got restricted __le32 [usertype]
   drivers/scsi/qla2xxx/qla_iocb.c:3084:32: sparse: sparse: incorrect type in assignment (different base types) @@    expected unsigned int [usertype] rsp_bytecount @@    got restrunsigned int [usertype] rsp_bytecount @@
   drivers/scsi/qla2xxx/qla_iocb.c:3084:32: sparse:    expected unsigned int [usertype] rsp_bytecount
   drivers/scsi/qla2xxx/qla_iocb.c:3084:32: sparse:    got restricted __le32 [usertype]
   drivers/scsi/qla2xxx/qla_iocb.c:3089:33: sparse: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] length @@    got icted __le32 [usertype] length @@
   drivers/scsi/qla2xxx/qla_iocb.c:3089:33: sparse:    expected restricted __le32 [usertype] length
   drivers/scsi/qla2xxx/qla_iocb.c:3089:33: sparse:    got unsigned int [usertype] req_bytecount
   drivers/scsi/qla2xxx/qla_iocb.c:3093:33: sparse: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] length @@    got icted __le32 [usertype] length @@
   drivers/scsi/qla2xxx/qla_iocb.c:3093:33: sparse:    expected restricted __le32 [usertype] length
   drivers/scsi/qla2xxx/qla_iocb.c:3093:33: sparse:    got unsigned int [usertype] rsp_bytecount
   drivers/scsi/qla2xxx/qla_iocb.c:3143:31: sparse: sparse: incorrect type in assignment (different base types) @@    expected unsigned short [usertype] nport_handle @@    got resunsigned short [usertype] nport_handle @@
   drivers/scsi/qla2xxx/qla_iocb.c:3143:31: sparse:    expected unsigned short [usertype] nport_handle
   drivers/scsi/qla2xxx/qla_iocb.c:3143:31: sparse:    got restricted __le16 [usertype]
   drivers/scsi/qla2xxx/qla_iocb.c:3145:30: sparse: sparse: incorrect type in assignment (different base types) @@    expected unsigned short [usertype] comp_status @@    got resunsigned short [usertype] comp_status @@
   drivers/scsi/qla2xxx/qla_iocb.c:3145:30: sparse:    expected unsigned short [usertype] comp_status
   drivers/scsi/qla2xxx/qla_iocb.c:3145:30: sparse:    got restricted __le16 [usertype]
   drivers/scsi/qla2xxx/qla_iocb.c:3150:32: sparse: sparse: incorrect type in assignment (different base types) @@    expected unsigned short [usertype] cmd_dsd_count @@    got resunsigned short [usertype] cmd_dsd_count @@
   drivers/scsi/qla2xxx/qla_iocb.c:3150:32: sparse:    expected unsigned short [usertype] cmd_dsd_count
   drivers/scsi/qla2xxx/qla_iocb.c:3150:32: sparse:    got restricted __le16 [usertype]
   drivers/scsi/qla2xxx/qla_iocb.c:3152:32: sparse: sparse: incorrect type in assignment (different base types) @@    expected unsigned short [usertype] rsp_dsd_count @@    got resunsigned short [usertype] rsp_dsd_count @@
   drivers/scsi/qla2xxx/qla_iocb.c:3152:32: sparse:    expected unsigned short [usertype] rsp_dsd_count
   drivers/scsi/qla2xxx/qla_iocb.c:3152:32: sparse:    got restricted __le16 [usertype]
   drivers/scsi/qla2xxx/qla_iocb.c:3153:33: sparse: sparse: incorrect type in assignment (different base types) @@    expected unsigned int [usertype] cmd_byte_count @@    got restrunsigned int [usertype] cmd_byte_count @@
   drivers/scsi/qla2xxx/qla_iocb.c:3153:33: sparse:    expected unsigned int [usertype] cmd_byte_count
   drivers/scsi/qla2xxx/qla_iocb.c:3153:33: sparse:    got restricted __le32 [usertype]
   drivers/scsi/qla2xxx/qla_iocb.c:3369:37: sparse: sparse: incorrect type in assignment (different base types) @@    expected unsigned short [usertype] dseg_count @@    got resunsigned short [usertype] dseg_count @@
   drivers/scsi/qla2xxx/qla_iocb.c:3369:37: sparse:    expected unsigned short [usertype] dseg_count
   drivers/scsi/qla2xxx/qla_iocb.c:3369:37: sparse:    got restricted __le16 [usertype]
   drivers/scsi/qla2xxx/qla_iocb.c:3372:39: sparse: sparse: incorrect type in assignment (different base types) @@    expected unsigned short [usertype] nport_handle @@    got resunsigned short [usertype] nport_handle @@
   drivers/scsi/qla2xxx/qla_iocb.c:3372:39: sparse:    expected unsigned short [usertype] nport_handle
   drivers/scsi/qla2xxx/qla_iocb.c:3372:39: sparse:    got restricted __le16 [usertype]
   drivers/scsi/qla2xxx/qla_iocb.c:3403:25: sparse: sparse: incorrect type in assignment (different base types) @@    expected unsigned int [usertype] @@    got restrunsigned int [usertype] @@
   drivers/scsi/qla2xxx/qla_iocb.c:3403:25: sparse:    expected unsigned int [usertype]
   drivers/scsi/qla2xxx/qla_iocb.c:3403:25: sparse:    got restricted __be32 [usertype]
   drivers/scsi/qla2xxx/qla_iocb.c:3405:44: sparse: sparse: incorrect type in assignment (different base types) @@    expected unsigned short [usertype] fcp_cmnd_dseg_len @@    got resunsigned short [usertype] fcp_cmnd_dseg_len @@
   drivers/scsi/qla2xxx/qla_iocb.c:3405:44: sparse:    expected unsigned short [usertype] fcp_cmnd_dseg_len
   drivers/scsi/qla2xxx/qla_iocb.c:3405:44: sparse:    got restricted __le16 [usertype]
   drivers/scsi/qla2xxx/qla_iocb.c:3410:37: sparse: sparse: incorrect type in assignment (different base types) @@    expected unsigned int [usertype] byte_count @@    got restrunsigned int [usertype] byte_count @@
   drivers/scsi/qla2xxx/qla_iocb.c:3410:37: sparse:    expected unsigned int [usertype] byte_count
   drivers/scsi/qla2xxx/qla_iocb.c:3410:37: sparse:    got restricted __le32 [usertype]
   drivers/scsi/qla2xxx/qla_iocb.c:3440:37: sparse: sparse: incorrect type in assignment (different base types) @@    expected unsigned short [usertype] dseg_count @@    got resunsigned short [usertype] dseg_count @@
   drivers/scsi/qla2xxx/qla_iocb.c:3440:37: sparse:    expected unsigned short [usertype] dseg_count
   drivers/scsi/qla2xxx/qla_iocb.c:3440:37: sparse:    got restricted __le16 [usertype]
   drivers/scsi/qla2xxx/qla_iocb.c:3443:39: sparse: sparse: incorrect type in assignment (different base types) @@    expected unsigned short [usertype] nport_handle @@    got resunsigned short [usertype] nport_handle @@
   drivers/scsi/qla2xxx/qla_iocb.c:3443:39: sparse:    expected unsigned short [usertype] nport_handle
   drivers/scsi/qla2xxx/qla_iocb.c:3443:39: sparse:    got restricted __le16 [usertype]
   drivers/scsi/qla2xxx/qla_iocb.c:3461:37: sparse: sparse: incorrect type in assignment (different base types) @@    expected unsigned int [usertype] byte_count @@    got restrunsigned int [usertype] byte_count @@
   drivers/scsi/qla2xxx/qla_iocb.c:3461:37: sparse:    expected unsigned int [usertype] byte_count
   drivers/scsi/qla2xxx/qla_iocb.c:3461:37: sparse:    got restricted __le32 [usertype]
   drivers/scsi/qla2xxx/qla_iocb.c:3539:26: sparse: sparse: incorrect type in assignment (different base types) @@    expected unsigned int [usertype] handle @@    got restrunsigned int [usertype] handle @@
   drivers/scsi/qla2xxx/qla_iocb.c:3539:26: sparse:    expected unsigned int [usertype] handle
   drivers/scsi/qla2xxx/qla_iocb.c:3539:26: sparse:    got restricted __le32 [usertype]
   drivers/scsi/qla2xxx/qla_iocb.c:3541:40: sparse: sparse: incorrect type in assignment (different base types) @@    expected unsigned short [usertype] nport_handle @@    got resunsigned short [usertype] nport_handle @@
   drivers/scsi/qla2xxx/qla_iocb.c:3541:40: sparse:    expected unsigned short [usertype] nport_handle
   drivers/scsi/qla2xxx/qla_iocb.c:3541:40: sparse:    got restricted __le16 [usertype]
>> drivers/scsi/qla2xxx/qla_iocb.c:3547:13: sparse: sparse: incorrect type in argument 1 (different base types) @@    expected unsigned short [usertype] x @@    got resunsigned short [usertype] x @@
   drivers/scsi/qla2xxx/qla_iocb.c:3547:13: sparse:    expected unsigned short [usertype] x
   drivers/scsi/qla2xxx/qla_iocb.c:3547:13: sparse:    got restricted __le16 [usertype] req_que_no
   drivers/scsi/qla2xxx/qla_iocb.c:3546:35: sparse: sparse: incorrect type in assignment (different base types) @@    expected unsigned int [usertype] handle_to_abort @@    got restrunsigned int [usertype] handle_to_abort @@
   drivers/scsi/qla2xxx/qla_iocb.c:3546:35: sparse:    expected unsigned int [usertype] handle_to_abort
   drivers/scsi/qla2xxx/qla_iocb.c:3546:35: sparse:    got restricted __le32 [usertype]
   drivers/scsi/qla2xxx/qla_iocb.c:3550:32: sparse: sparse: cast from restricted __le16
   drivers/scsi/qla2xxx/qla_iocb.c:3550:30: sparse: sparse: incorrect type in assignment (different base types) @@    expected unsigned short [usertype] req_que_no @@    got resunsigned short [usertype] req_que_no @@
   drivers/scsi/qla2xxx/qla_iocb.c:3550:30: sparse:    expected unsigned short [usertype] req_que_no
   drivers/scsi/qla2xxx/qla_iocb.c:3550:30: sparse:    got restricted __le16 [usertype]
   drivers/scsi/qla2xxx/qla_iocb.c:3565:30: sparse: sparse: cast from restricted __le16
   drivers/scsi/qla2xxx/qla_iocb.c:3565:28: sparse: sparse: incorrect type in assignment (different base types) @@    expected unsigned short @@    got restricted __leunsigned short @@
   drivers/scsi/qla2xxx/qla_iocb.c:3565:28: sparse:    expected unsigned short
   drivers/scsi/qla2xxx/qla_iocb.c:3565:28: sparse:    got restricted __le16 [usertype]
   drivers/scsi/qla2xxx/qla_iocb.c:3587:13: sparse: sparse: cast to restricted __le16
   drivers/scsi/qla2xxx/qla_iocb.c:3589:25: sparse: sparse: restricted __le32 degrades to integer
   drivers/scsi/qla2xxx/qla_iocb.c:3618:26: sparse: sparse: too many warnings

vim +3547 drivers/scsi/qla2xxx/qla_iocb.c

  3199	
  3200	/*
  3201	 * qla82xx_start_scsi() - Send a SCSI command to the ISP
  3202	 * @sp: command to send to the ISP
  3203	 *
  3204	 * Returns non-zero if a failure occurred, else zero.
  3205	 */
  3206	int
  3207	qla82xx_start_scsi(srb_t *sp)
  3208	{
  3209		int		nseg;
  3210		unsigned long   flags;
  3211		struct scsi_cmnd *cmd;
  3212		uint32_t	*clr_ptr;
  3213		uint32_t	handle;
  3214		uint16_t	cnt;
  3215		uint16_t	req_cnt;
  3216		uint16_t	tot_dsds;
  3217		struct device_reg_82xx __iomem *reg;
  3218		uint32_t dbval;
  3219		uint32_t *fcp_dl;
  3220		uint8_t additional_cdb_len;
  3221		struct ct6_dsd *ctx;
  3222		struct scsi_qla_host *vha = sp->vha;
  3223		struct qla_hw_data *ha = vha->hw;
  3224		struct req_que *req = NULL;
  3225		struct rsp_que *rsp = NULL;
  3226	
  3227		/* Setup device pointers. */
  3228		reg = &ha->iobase->isp82;
  3229		cmd = GET_CMD_SP(sp);
  3230		req = vha->req;
  3231		rsp = ha->rsp_q_map[0];
  3232	
  3233		/* So we know we haven't pci_map'ed anything yet */
  3234		tot_dsds = 0;
  3235	
  3236		dbval = 0x04 | (ha->portnum << 5);
  3237	
  3238		/* Send marker if required */
  3239		if (vha->marker_needed != 0) {
  3240			if (qla2x00_marker(vha, ha->base_qpair,
  3241				0, 0, MK_SYNC_ALL) != QLA_SUCCESS) {
  3242				ql_log(ql_log_warn, vha, 0x300c,
  3243				    "qla2x00_marker failed for cmd=%p.\n", cmd);
  3244				return QLA_FUNCTION_FAILED;
  3245			}
  3246			vha->marker_needed = 0;
  3247		}
  3248	
  3249		/* Acquire ring specific lock */
  3250		spin_lock_irqsave(&ha->hardware_lock, flags);
  3251	
  3252		handle = qla2xxx_get_next_handle(req);
  3253		if (handle == 0)
  3254			goto queuing_error;
  3255	
  3256		/* Map the sg table so we have an accurate count of sg entries needed */
  3257		if (scsi_sg_count(cmd)) {
  3258			nseg = dma_map_sg(&ha->pdev->dev, scsi_sglist(cmd),
  3259			    scsi_sg_count(cmd), cmd->sc_data_direction);
  3260			if (unlikely(!nseg))
  3261				goto queuing_error;
  3262		} else
  3263			nseg = 0;
  3264	
  3265		tot_dsds = nseg;
  3266	
  3267		if (tot_dsds > ql2xshiftctondsd) {
  3268			struct cmd_type_6 *cmd_pkt;
  3269			uint16_t more_dsd_lists = 0;
  3270			struct dsd_dma *dsd_ptr;
  3271			uint16_t i;
  3272	
  3273			more_dsd_lists = qla24xx_calc_dsd_lists(tot_dsds);
  3274			if ((more_dsd_lists + ha->gbl_dsd_inuse) >= NUM_DSD_CHAIN) {
  3275				ql_dbg(ql_dbg_io, vha, 0x300d,
  3276				    "Num of DSD list %d is than %d for cmd=%p.\n",
  3277				    more_dsd_lists + ha->gbl_dsd_inuse, NUM_DSD_CHAIN,
  3278				    cmd);
  3279				goto queuing_error;
  3280			}
  3281	
  3282			if (more_dsd_lists <= ha->gbl_dsd_avail)
  3283				goto sufficient_dsds;
  3284			else
  3285				more_dsd_lists -= ha->gbl_dsd_avail;
  3286	
  3287			for (i = 0; i < more_dsd_lists; i++) {
  3288				dsd_ptr = kzalloc(sizeof(struct dsd_dma), GFP_ATOMIC);
  3289				if (!dsd_ptr) {
  3290					ql_log(ql_log_fatal, vha, 0x300e,
  3291					    "Failed to allocate memory for dsd_dma "
  3292					    "for cmd=%p.\n", cmd);
  3293					goto queuing_error;
  3294				}
  3295	
  3296				dsd_ptr->dsd_addr = dma_pool_alloc(ha->dl_dma_pool,
  3297					GFP_ATOMIC, &dsd_ptr->dsd_list_dma);
  3298				if (!dsd_ptr->dsd_addr) {
  3299					kfree(dsd_ptr);
  3300					ql_log(ql_log_fatal, vha, 0x300f,
  3301					    "Failed to allocate memory for dsd_addr "
  3302					    "for cmd=%p.\n", cmd);
  3303					goto queuing_error;
  3304				}
  3305				list_add_tail(&dsd_ptr->list, &ha->gbl_dsd_list);
  3306				ha->gbl_dsd_avail++;
  3307			}
  3308	
  3309	sufficient_dsds:
  3310			req_cnt = 1;
  3311	
  3312			if (req->cnt < (req_cnt + 2)) {
  3313				cnt = (uint16_t)RD_REG_DWORD_RELAXED(
  3314					&reg->req_q_out[0]);
  3315				if (req->ring_index < cnt)
  3316					req->cnt = cnt - req->ring_index;
  3317				else
  3318					req->cnt = req->length -
  3319						(req->ring_index - cnt);
  3320				if (req->cnt < (req_cnt + 2))
  3321					goto queuing_error;
  3322			}
  3323	
  3324			ctx = sp->u.scmd.ct6_ctx =
  3325			    mempool_alloc(ha->ctx_mempool, GFP_ATOMIC);
  3326			if (!ctx) {
  3327				ql_log(ql_log_fatal, vha, 0x3010,
  3328				    "Failed to allocate ctx for cmd=%p.\n", cmd);
  3329				goto queuing_error;
  3330			}
  3331	
  3332			memset(ctx, 0, sizeof(struct ct6_dsd));
  3333			ctx->fcp_cmnd = dma_pool_zalloc(ha->fcp_cmnd_dma_pool,
  3334				GFP_ATOMIC, &ctx->fcp_cmnd_dma);
  3335			if (!ctx->fcp_cmnd) {
  3336				ql_log(ql_log_fatal, vha, 0x3011,
  3337				    "Failed to allocate fcp_cmnd for cmd=%p.\n", cmd);
  3338				goto queuing_error;
  3339			}
  3340	
  3341			/* Initialize the DSD list and dma handle */
  3342			INIT_LIST_HEAD(&ctx->dsd_list);
  3343			ctx->dsd_use_cnt = 0;
  3344	
  3345			if (cmd->cmd_len > 16) {
  3346				additional_cdb_len = cmd->cmd_len - 16;
  3347				if ((cmd->cmd_len % 4) != 0) {
  3348					/* SCSI command bigger than 16 bytes must be
  3349					 * multiple of 4
  3350					 */
  3351					ql_log(ql_log_warn, vha, 0x3012,
  3352					    "scsi cmd len %d not multiple of 4 "
  3353					    "for cmd=%p.\n", cmd->cmd_len, cmd);
  3354					goto queuing_error_fcp_cmnd;
  3355				}
  3356				ctx->fcp_cmnd_len = 12 + cmd->cmd_len + 4;
  3357			} else {
  3358				additional_cdb_len = 0;
  3359				ctx->fcp_cmnd_len = 12 + 16 + 4;
  3360			}
  3361	
  3362			cmd_pkt = (struct cmd_type_6 *)req->ring_ptr;
  3363			cmd_pkt->handle = make_handle(req->id, handle);
  3364	
  3365			/* Zero out remaining portion of packet. */
  3366			/*    tagged queuing modifier -- default is TSK_SIMPLE (0). */
  3367			clr_ptr = (uint32_t *)cmd_pkt + 2;
  3368			memset(clr_ptr, 0, REQUEST_ENTRY_SIZE - 8);
  3369			cmd_pkt->dseg_count = cpu_to_le16(tot_dsds);
  3370	
  3371			/* Set NPORT-ID and LUN number*/
  3372			cmd_pkt->nport_handle = cpu_to_le16(sp->fcport->loop_id);
  3373			cmd_pkt->port_id[0] = sp->fcport->d_id.b.al_pa;
  3374			cmd_pkt->port_id[1] = sp->fcport->d_id.b.area;
  3375			cmd_pkt->port_id[2] = sp->fcport->d_id.b.domain;
  3376			cmd_pkt->vp_index = sp->vha->vp_idx;
  3377	
  3378			/* Build IOCB segments */
  3379			if (qla24xx_build_scsi_type_6_iocbs(sp, cmd_pkt, tot_dsds))
  3380				goto queuing_error_fcp_cmnd;
  3381	
  3382			int_to_scsilun(cmd->device->lun, &cmd_pkt->lun);
  3383			host_to_fcp_swap((uint8_t *)&cmd_pkt->lun, sizeof(cmd_pkt->lun));
  3384	
  3385			/* build FCP_CMND IU */
  3386			int_to_scsilun(cmd->device->lun, &ctx->fcp_cmnd->lun);
  3387			ctx->fcp_cmnd->additional_cdb_len = additional_cdb_len;
  3388	
  3389			if (cmd->sc_data_direction == DMA_TO_DEVICE)
  3390				ctx->fcp_cmnd->additional_cdb_len |= 1;
  3391			else if (cmd->sc_data_direction == DMA_FROM_DEVICE)
  3392				ctx->fcp_cmnd->additional_cdb_len |= 2;
  3393	
  3394			/* Populate the FCP_PRIO. */
  3395			if (ha->flags.fcp_prio_enabled)
  3396				ctx->fcp_cmnd->task_attribute |=
  3397				    sp->fcport->fcp_prio << 3;
  3398	
  3399			memcpy(ctx->fcp_cmnd->cdb, cmd->cmnd, cmd->cmd_len);
  3400	
  3401			fcp_dl = (uint32_t *)(ctx->fcp_cmnd->cdb + 16 +
  3402			    additional_cdb_len);
  3403			*fcp_dl = htonl((uint32_t)scsi_bufflen(cmd));
  3404	
  3405			cmd_pkt->fcp_cmnd_dseg_len = cpu_to_le16(ctx->fcp_cmnd_len);
  3406			put_unaligned_le64(ctx->fcp_cmnd_dma,
  3407					   &cmd_pkt->fcp_cmnd_dseg_address);
  3408	
  3409			sp->flags |= SRB_FCP_CMND_DMA_VALID;
  3410			cmd_pkt->byte_count = cpu_to_le32((uint32_t)scsi_bufflen(cmd));
  3411			/* Set total data segment count. */
  3412			cmd_pkt->entry_count = (uint8_t)req_cnt;
  3413			/* Specify response queue number where
  3414			 * completion should happen
  3415			 */
  3416			cmd_pkt->entry_status = (uint8_t) rsp->id;
  3417		} else {
  3418			struct cmd_type_7 *cmd_pkt;
  3419	
  3420			req_cnt = qla24xx_calc_iocbs(vha, tot_dsds);
  3421			if (req->cnt < (req_cnt + 2)) {
  3422				cnt = (uint16_t)RD_REG_DWORD_RELAXED(
  3423				    &reg->req_q_out[0]);
  3424				if (req->ring_index < cnt)
  3425					req->cnt = cnt - req->ring_index;
  3426				else
  3427					req->cnt = req->length -
  3428						(req->ring_index - cnt);
  3429			}
  3430			if (req->cnt < (req_cnt + 2))
  3431				goto queuing_error;
  3432	
  3433			cmd_pkt = (struct cmd_type_7 *)req->ring_ptr;
  3434			cmd_pkt->handle = make_handle(req->id, handle);
  3435	
  3436			/* Zero out remaining portion of packet. */
  3437			/* tagged queuing modifier -- default is TSK_SIMPLE (0).*/
  3438			clr_ptr = (uint32_t *)cmd_pkt + 2;
  3439			memset(clr_ptr, 0, REQUEST_ENTRY_SIZE - 8);
  3440			cmd_pkt->dseg_count = cpu_to_le16(tot_dsds);
  3441	
  3442			/* Set NPORT-ID and LUN number*/
  3443			cmd_pkt->nport_handle = cpu_to_le16(sp->fcport->loop_id);
  3444			cmd_pkt->port_id[0] = sp->fcport->d_id.b.al_pa;
  3445			cmd_pkt->port_id[1] = sp->fcport->d_id.b.area;
  3446			cmd_pkt->port_id[2] = sp->fcport->d_id.b.domain;
  3447			cmd_pkt->vp_index = sp->vha->vp_idx;
  3448	
  3449			int_to_scsilun(cmd->device->lun, &cmd_pkt->lun);
  3450			host_to_fcp_swap((uint8_t *)&cmd_pkt->lun,
  3451			    sizeof(cmd_pkt->lun));
  3452	
  3453			/* Populate the FCP_PRIO. */
  3454			if (ha->flags.fcp_prio_enabled)
  3455				cmd_pkt->task |= sp->fcport->fcp_prio << 3;
  3456	
  3457			/* Load SCSI command packet. */
  3458			memcpy(cmd_pkt->fcp_cdb, cmd->cmnd, cmd->cmd_len);
  3459			host_to_fcp_swap(cmd_pkt->fcp_cdb, sizeof(cmd_pkt->fcp_cdb));
  3460	
> 3461			cmd_pkt->byte_count = cpu_to_le32((uint32_t)scsi_bufflen(cmd));
  3462	
  3463			/* Build IOCB segments */
  3464			qla24xx_build_scsi_iocbs(sp, cmd_pkt, tot_dsds, req);
  3465	
  3466			/* Set total data segment count. */
  3467			cmd_pkt->entry_count = (uint8_t)req_cnt;
  3468			/* Specify response queue number where
  3469			 * completion should happen.
  3470			 */
  3471			cmd_pkt->entry_status = (uint8_t) rsp->id;
  3472	
  3473		}
  3474		/* Build command packet. */
  3475		req->current_outstanding_cmd = handle;
  3476		req->outstanding_cmds[handle] = sp;
  3477		sp->handle = handle;
  3478		cmd->host_scribble = (unsigned char *)(unsigned long)handle;
  3479		req->cnt -= req_cnt;
  3480		wmb();
  3481	
  3482		/* Adjust ring index. */
  3483		req->ring_index++;
  3484		if (req->ring_index == req->length) {
  3485			req->ring_index = 0;
  3486			req->ring_ptr = req->ring;
  3487		} else
  3488			req->ring_ptr++;
  3489	
  3490		sp->flags |= SRB_DMA_VALID;
  3491	
  3492		/* Set chip new ring index. */
  3493		/* write, read and verify logic */
  3494		dbval = dbval | (req->id << 8) | (req->ring_index << 16);
  3495		if (ql2xdbwr)
  3496			qla82xx_wr_32(ha, (uintptr_t __force)ha->nxdb_wr_ptr, dbval);
  3497		else {
  3498			WRT_REG_DWORD(ha->nxdb_wr_ptr, dbval);
  3499			wmb();
  3500			while (RD_REG_DWORD(ha->nxdb_rd_ptr) != dbval) {
  3501				WRT_REG_DWORD(ha->nxdb_wr_ptr, dbval);
  3502				wmb();
  3503			}
  3504		}
  3505	
  3506		/* Manage unprocessed RIO/ZIO commands in response queue. */
  3507		if (vha->flags.process_response_queue &&
  3508		    rsp->ring_ptr->signature != RESPONSE_PROCESSED)
  3509			qla24xx_process_response_queue(vha, rsp);
  3510	
  3511		spin_unlock_irqrestore(&ha->hardware_lock, flags);
  3512		return QLA_SUCCESS;
  3513	
  3514	queuing_error_fcp_cmnd:
  3515		dma_pool_free(ha->fcp_cmnd_dma_pool, ctx->fcp_cmnd, ctx->fcp_cmnd_dma);
  3516	queuing_error:
  3517		if (tot_dsds)
  3518			scsi_dma_unmap(cmd);
  3519	
  3520		if (sp->u.scmd.crc_ctx) {
  3521			mempool_free(sp->u.scmd.crc_ctx, ha->ctx_mempool);
  3522			sp->u.scmd.crc_ctx = NULL;
  3523		}
  3524		spin_unlock_irqrestore(&ha->hardware_lock, flags);
  3525	
  3526		return QLA_FUNCTION_FAILED;
  3527	}
  3528	
  3529	static void
  3530	qla24xx_abort_iocb(srb_t *sp, struct abort_entry_24xx *abt_iocb)
  3531	{
  3532		struct srb_iocb *aio = &sp->u.iocb_cmd;
  3533		scsi_qla_host_t *vha = sp->vha;
  3534		struct req_que *req = sp->qpair->req;
  3535	
  3536		memset(abt_iocb, 0, sizeof(struct abort_entry_24xx));
  3537		abt_iocb->entry_type = ABORT_IOCB_TYPE;
  3538		abt_iocb->entry_count = 1;
  3539		abt_iocb->handle = cpu_to_le32(make_handle(req->id, sp->handle));
  3540		if (sp->fcport) {
  3541			abt_iocb->nport_handle = cpu_to_le16(sp->fcport->loop_id);
  3542			abt_iocb->port_id[0] = sp->fcport->d_id.b.al_pa;
  3543			abt_iocb->port_id[1] = sp->fcport->d_id.b.area;
  3544			abt_iocb->port_id[2] = sp->fcport->d_id.b.domain;
  3545		}
  3546		abt_iocb->handle_to_abort =
> 3547		    cpu_to_le32(make_handle(aio->u.abt.req_que_no,
  3548					    aio->u.abt.cmd_hndl));
  3549		abt_iocb->vp_index = vha->vp_idx;
  3550		abt_iocb->req_que_no = cpu_to_le16(aio->u.abt.req_que_no);
  3551		/* Send the command to the firmware */
  3552		wmb();
  3553	}
  3554	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org


                 reply	other threads:[~2020-03-08  2:13 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202003081021.Hym7BolI%lkp@intel.com \
    --to=lkp@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-mm@kvack.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).