[mani-mhi:mhi-next 26/30] drivers/bus/mhi/ep/main.c:357:71: sparse: sparse: incorrect type in argument 3 (different address spaces)
From: kernel test robot
Date: Thu Mar 03 2022 - 00:56:03 EST
tree: https://git.kernel.org/pub/scm/linux/kernel/git/mani/mhi.git mhi-next
head: 4aa2b597db8f8808b7e0f89239cd98c3a56b21b1
commit: 8c4345a08ac4d20d50fe394141ba5f7945196c7d [26/30] bus: mhi: ep: Add support for reading from the host
config: ia64-randconfig-s031-20220302 (https://download.01.org/0day-ci/archive/20220303/202203031356.vS8LSPwY-lkp@xxxxxxxxx/config)
compiler: ia64-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/mani/mhi.git/commit/?id=8c4345a08ac4d20d50fe394141ba5f7945196c7d
git remote add mani-mhi https://git.kernel.org/pub/scm/linux/kernel/git/mani/mhi.git
git fetch --no-tags mani-mhi mhi-next
git checkout 8c4345a08ac4d20d50fe394141ba5f7945196c7d
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=ia64 SHELL=/bin/bash drivers/bus/mhi/ep/ drivers/nvmem/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>
sparse warnings: (new ones prefixed by >>)
drivers/bus/mhi/ep/main.c:152:5: sparse: sparse: symbol 'mhi_ep_process_cmd_ring' was not declared. Should it be static?
>> drivers/bus/mhi/ep/main.c:357:71: sparse: sparse: incorrect type in argument 3 (different address spaces) @@ expected void [noderef] __iomem *to @@ got void *[assigned] write_addr @@
drivers/bus/mhi/ep/main.c:357:71: sparse: expected void [noderef] __iomem *to
drivers/bus/mhi/ep/main.c:357:71: sparse: got void *[assigned] write_addr
drivers/bus/mhi/ep/main.c:487:34: sparse: sparse: incorrect type in argument 4 (different address spaces) @@ expected void [noderef] __iomem *virt @@ got struct mhi_cmd_ctxt *cmd_ctx_cache @@
drivers/bus/mhi/ep/main.c:487:34: sparse: expected void [noderef] __iomem *virt
drivers/bus/mhi/ep/main.c:487:34: sparse: got struct mhi_cmd_ctxt *cmd_ctx_cache
drivers/bus/mhi/ep/main.c:491:34: sparse: sparse: incorrect type in argument 4 (different address spaces) @@ expected void [noderef] __iomem *virt @@ got struct mhi_event_ctxt *ev_ctx_cache @@
drivers/bus/mhi/ep/main.c:491:34: sparse: expected void [noderef] __iomem *virt
drivers/bus/mhi/ep/main.c:491:34: sparse: got struct mhi_event_ctxt *ev_ctx_cache
drivers/bus/mhi/ep/main.c:495:34: sparse: sparse: incorrect type in argument 4 (different address spaces) @@ expected void [noderef] __iomem *virt @@ got struct mhi_chan_ctxt *ch_ctx_cache @@
drivers/bus/mhi/ep/main.c:495:34: sparse: expected void [noderef] __iomem *virt
drivers/bus/mhi/ep/main.c:495:34: sparse: got struct mhi_chan_ctxt *ch_ctx_cache
drivers/bus/mhi/ep/main.c:509:34: sparse: sparse: incorrect type in argument 4 (different address spaces) @@ expected void [noderef] __iomem *virt @@ got struct mhi_cmd_ctxt *cmd_ctx_cache @@
drivers/bus/mhi/ep/main.c:509:34: sparse: expected void [noderef] __iomem *virt
drivers/bus/mhi/ep/main.c:509:34: sparse: got struct mhi_cmd_ctxt *cmd_ctx_cache
drivers/bus/mhi/ep/main.c:511:34: sparse: sparse: incorrect type in argument 4 (different address spaces) @@ expected void [noderef] __iomem *virt @@ got struct mhi_event_ctxt *ev_ctx_cache @@
drivers/bus/mhi/ep/main.c:511:34: sparse: expected void [noderef] __iomem *virt
drivers/bus/mhi/ep/main.c:511:34: sparse: got struct mhi_event_ctxt *ev_ctx_cache
drivers/bus/mhi/ep/main.c:513:34: sparse: sparse: incorrect type in argument 4 (different address spaces) @@ expected void [noderef] __iomem *virt @@ got struct mhi_chan_ctxt *ch_ctx_cache @@
drivers/bus/mhi/ep/main.c:513:34: sparse: expected void [noderef] __iomem *virt
drivers/bus/mhi/ep/main.c:513:34: sparse: got struct mhi_chan_ctxt *ch_ctx_cache
vim +357 drivers/bus/mhi/ep/main.c
312
313 static int mhi_ep_read_channel(struct mhi_ep_cntrl *mhi_cntrl,
314 struct mhi_ep_ring *ring,
315 struct mhi_result *result,
316 u32 len)
317 {
318 struct mhi_ep_chan *mhi_chan = &mhi_cntrl->mhi_chan[ring->ch_id];
319 struct device *dev = &mhi_cntrl->mhi_dev->dev;
320 size_t tr_len, read_offset, write_offset;
321 struct mhi_ring_element *el;
322 bool tr_done = false;
323 void *write_addr;
324 u64 read_addr;
325 u32 buf_left;
326 int ret;
327
328 buf_left = len;
329
330 do {
331 /* Don't process the transfer ring if the channel is not in RUNNING state */
332 if (mhi_chan->state != MHI_CH_STATE_RUNNING) {
333 dev_err(dev, "Channel not available\n");
334 return -ENODEV;
335 }
336
337 el = &ring->ring_cache[ring->rd_offset];
338
339 /* Check if there is data pending to be read from previous read operation */
340 if (mhi_chan->tre_bytes_left) {
341 dev_dbg(dev, "TRE bytes remaining: %u\n", mhi_chan->tre_bytes_left);
342 tr_len = min(buf_left, mhi_chan->tre_bytes_left);
343 } else {
344 mhi_chan->tre_loc = MHI_TRE_DATA_GET_PTR(el);
345 mhi_chan->tre_size = MHI_TRE_DATA_GET_LEN(el);
346 mhi_chan->tre_bytes_left = mhi_chan->tre_size;
347
348 tr_len = min(buf_left, mhi_chan->tre_size);
349 }
350
351 read_offset = mhi_chan->tre_size - mhi_chan->tre_bytes_left;
352 write_offset = len - buf_left;
353 read_addr = mhi_chan->tre_loc + read_offset;
354 write_addr = result->buf_addr + write_offset;
355
356 dev_dbg(dev, "Reading %zd bytes from channel (%u)\n", tr_len, ring->ch_id);
> 357 ret = mhi_cntrl->read_from_host(mhi_cntrl, read_addr, write_addr, tr_len);
358 if (ret < 0) {
359 dev_err(&mhi_chan->mhi_dev->dev, "Error reading from channel\n");
360 return ret;
361 }
362
363 buf_left -= tr_len;
364 mhi_chan->tre_bytes_left -= tr_len;
365
366 /*
367 * Once the TRE (Transfer Ring Element) of a TD (Transfer Descriptor) has been
368 * read completely:
369 *
370 * 1. Send completion event to the host based on the flags set in TRE.
371 * 2. Increment the local read offset of the transfer ring.
372 */
373 if (!mhi_chan->tre_bytes_left) {
374 /*
375 * The host will split the data packet into multiple TREs if it can't fit
376 * the packet in a single TRE. In that case, CHAIN flag will be set by the
377 * host for all TREs except the last one.
378 */
379 if (MHI_TRE_DATA_GET_CHAIN(el)) {
380 /*
381 * IEOB (Interrupt on End of Block) flag will be set by the host if
382 * it expects the completion event for all TREs of a TD.
383 */
384 if (MHI_TRE_DATA_GET_IEOB(el)) {
385 ret = mhi_ep_send_completion_event(mhi_cntrl, ring, el,
386 MHI_TRE_DATA_GET_LEN(el),
387 MHI_EV_CC_EOB);
388 if (ret < 0) {
389 dev_err(&mhi_chan->mhi_dev->dev,
390 "Error sending transfer compl. event\n");
391 return ret;
392 }
393 }
394 } else {
395 /*
396 * IEOT (Interrupt on End of Transfer) flag will be set by the host
397 * for the last TRE of the TD and expects the completion event for
398 * the same.
399 */
400 if (MHI_TRE_DATA_GET_IEOT(el)) {
401 ret = mhi_ep_send_completion_event(mhi_cntrl, ring, el,
402 MHI_TRE_DATA_GET_LEN(el),
403 MHI_EV_CC_EOT);
404 if (ret < 0) {
405 dev_err(&mhi_chan->mhi_dev->dev,
406 "Error sending transfer compl. event\n");
407 return ret;
408 }
409 }
410
411 tr_done = true;
412 }
413
414 mhi_ep_ring_inc_index(ring);
415 }
416
417 result->bytes_xferd += tr_len;
418 } while (buf_left && !tr_done);
419
420 return 0;
421 }
422
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx