public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Sherry Sun <sherry.sun@nxp.com>,
	sudeep.dutt@intel.com, ashutosh.dixit@intel.com, arnd@arndb.de,
	gregkh@linuxfoundation.org, rikard.falkeborn@gmail.com,
	lee.jones@linaro.org, mst@redhat.com
Cc: kbuild-all@lists.01.org, linux-kernel@vger.kernel.org, linux-imx@nxp.com
Subject: Re: [PATCH 4/4] mic: vop: copy data to kernel space then write to io memory
Date: Fri, 25 Sep 2020 18:55:59 +0800	[thread overview]
Message-ID: <202009251854.wIYgO6ar%lkp@intel.com> (raw)
In-Reply-To: <20200925071831.8025-5-sherry.sun@nxp.com>

[-- Attachment #1: Type: text/plain, Size: 5112 bytes --]

Hi Sherry,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on char-misc/char-misc-testing]
[also build test WARNING on soc/for-next linus/master v5.9-rc6 next-20200924]
[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]

url:    https://github.com/0day-ci/linux/commits/Sherry-Sun/Fix-some-bugs-of-the-vop-driver-and-mpssd-user-space-tool/20200925-152356
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git 9eb29f2ed95edda511ce28651b1d7cdef3614c12
config: x86_64-randconfig-s021-20200925 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.2-201-g24bdaac6-dirty
        # https://github.com/0day-ci/linux/commit/5f4b5ded8447941d43166eba5d303cdca2e54f07
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Sherry-Sun/Fix-some-bugs-of-the-vop-driver-and-mpssd-user-space-tool/20200925-152356
        git checkout 5f4b5ded8447941d43166eba5d303cdca2e54f07
        # save the attached .config to linux build tree
        make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=x86_64 

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


sparse warnings: (new ones prefixed by >>)

>> drivers/misc/mic/vop/vop_vringh.c:666:22: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void volatile [noderef] __iomem * @@     got void * @@
>> drivers/misc/mic/vop/vop_vringh.c:666:22: sparse:     expected void volatile [noderef] __iomem *
>> drivers/misc/mic/vop/vop_vringh.c:666:22: sparse:     got void *

vim +666 drivers/misc/mic/vop/vop_vringh.c

   585	
   586	/*
   587	 * Initiates copies across the PCIe bus from a user space buffer to card
   588	 * memory. When transfers are done using DMA, source/destination addresses
   589	 * and transfer length must follow the alignment requirements of the MIC
   590	 * DMA engine.
   591	 */
   592	static int vop_virtio_copy_from_user(struct vop_vdev *vdev, void __user *ubuf,
   593					     size_t len, u64 daddr, size_t dlen,
   594					     int vr_idx)
   595	{
   596		struct vop_device *vpdev = vdev->vpdev;
   597		void __iomem *dbuf = vpdev->hw_ops->remap(vpdev, daddr, len);
   598		struct vop_vringh *vvr = &vdev->vvr[vr_idx];
   599		struct vop_info *vi = dev_get_drvdata(&vdev->vpdev->dev);
   600		size_t dma_alignment;
   601		bool x200;
   602		size_t partlen;
   603		bool dma = VOP_USE_DMA && vi->dma_ch;
   604		int err = 0;
   605		void *temp = NULL;
   606	
   607		if (dma) {
   608			dma_alignment = 1 << vi->dma_ch->device->copy_align;
   609			x200 = is_dma_copy_aligned(vi->dma_ch->device, 1, 1, 1);
   610	
   611			if (daddr & (dma_alignment - 1)) {
   612				vdev->tx_dst_unaligned += len;
   613				dma = false;
   614			} else if (ALIGN(len, dma_alignment) > dlen) {
   615				vdev->tx_len_unaligned += len;
   616				dma = false;
   617			}
   618		}
   619	
   620		if (!dma)
   621			goto memcpy;
   622	
   623		/*
   624		 * X100 uses DMA addresses as seen by the card so adding
   625		 * the aperture base is not required for DMA. However x200
   626		 * requires DMA addresses to be an offset into the bar so
   627		 * add the aperture base for x200.
   628		 */
   629		if (x200)
   630			daddr += vpdev->aper->pa;
   631		while (len) {
   632			partlen = min_t(size_t, len, VOP_INT_DMA_BUF_SIZE);
   633	
   634			if (copy_from_user(vvr->buf, ubuf, partlen)) {
   635				err = -EFAULT;
   636				dev_err(vop_dev(vdev), "%s %d err %d\n",
   637					__func__, __LINE__, err);
   638				goto err;
   639			}
   640			err = vop_sync_dma(vdev, daddr, vvr->buf_da,
   641					   ALIGN(partlen, dma_alignment));
   642			if (err) {
   643				dev_err(vop_dev(vdev), "%s %d err %d\n",
   644					__func__, __LINE__, err);
   645				goto err;
   646			}
   647			daddr += partlen;
   648			ubuf += partlen;
   649			dbuf += partlen;
   650			vdev->out_bytes_dma += partlen;
   651			vdev->out_bytes += partlen;
   652			len -= partlen;
   653		}
   654	memcpy:
   655		/*
   656		 * We are copying to IO below and should ideally use something
   657		 * like copy_from_user_toio(..) if it existed.
   658		 */
   659		temp = kmalloc(len, GFP_KERNEL);
   660		if (copy_from_user(temp, ubuf, len)) {
   661			err = -EFAULT;
   662			dev_err(vop_dev(vdev), "%s %d err %d\n",
   663				__func__, __LINE__, err);
   664			goto err;
   665		}
 > 666		memcpy_toio((void __force *)dbuf, temp, len);
   667		kfree(temp);
   668		vdev->out_bytes += len;
   669		err = 0;
   670	err:
   671		vpdev->hw_ops->unmap(vpdev, dbuf);
   672		dev_dbg(vop_dev(vdev),
   673			"%s: ubuf %p dbuf %p len 0x%zx vr_idx 0x%x\n",
   674			__func__, ubuf, dbuf, len, vr_idx);
   675		return err;
   676	}
   677	

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 28053 bytes --]

  parent reply	other threads:[~2020-09-25 10:56 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-25  7:18 [PATCH 0/4] Fix some bugs of the vop driver and mpssd user space tool Sherry Sun
2020-09-25  7:18 ` [PATCH 1/4] samples: mpssd: fix the build errors when enable DEBUG in mpssd.c Sherry Sun
2020-09-25  7:18 ` [PATCH 2/4] misc: vop: build VOP based on CONFIG_VOP Sherry Sun
2020-09-25  7:18 ` [PATCH 3/4] misc: vop: add round_up(x,4) for vring_size to avoid kernel panic Sherry Sun
2020-09-25  7:18 ` [PATCH 4/4] mic: vop: copy data to kernel space then write to io memory Sherry Sun
2020-09-25  7:32   ` Arnd Bergmann
2020-09-25  7:50     ` Sherry Sun
2020-09-25 10:55   ` kernel test robot [this message]
2020-09-25 11:03   ` kernel test robot

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=202009251854.wIYgO6ar%lkp@intel.com \
    --to=lkp@intel.com \
    --cc=arnd@arndb.de \
    --cc=ashutosh.dixit@intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kbuild-all@lists.01.org \
    --cc=lee.jones@linaro.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=rikard.falkeborn@gmail.com \
    --cc=sherry.sun@nxp.com \
    --cc=sudeep.dutt@intel.com \
    /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