Subject: Re: [PATCH net-next 10/11] sfc: implement vdpa config_ops for dma operations

From: kernel test robot <[email-masked]>
Date: Thu, 8 Dec 2022 03:23:31 +0800

Hi Gautam,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on net-next/master]

url:    https://github.com/intel-lab-lkp/linux/commits/Gautam-Dawar/sfc-add-vDPA-support-for-EF100-devices/20221207-230026
patch link:    https://lore.kernel.org/r/20221207145428.31544-11-gautam.dawar%40amd.com
patch subject: [PATCH net-next 10/11] sfc: implement vdpa config_ops for dma operations
config: mips-allyesconfig
compiler: mips-linux-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/intel-lab-lkp/linux/commit/439c0b3c236e7df427ffe3f4fde5281a1678c08a
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Gautam-Dawar/sfc-add-vDPA-support-for-EF100-devices/20221207-230026
        git checkout 439c0b3c236e7df427ffe3f4fde5281a1678c08a
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=mips SHELL=/bin/bash drivers/net/ethernet/sfc/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email-masked]>

All warnings (new ones prefixed by >>):

   In file included from include/linux/device.h:15,
                    from include/linux/vdpa.h:6,
                    from drivers/net/ethernet/sfc/ef100_vdpa_ops.c:11:
   drivers/net/ethernet/sfc/ef100_vdpa_ops.c: In function 'ef100_vdpa_dma_map':
>> drivers/net/ethernet/sfc/ef100_vdpa_ops.c:783:26: warning: format '%llx' expects argument of type 'long long unsigned int', but argument 4 has type 'dma_addr_t' {aka 'unsigned int'} [-Wformat=]
     783 |                          "%s: mcdi iova overlap detected: %llx\n",
         |                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/dev_printk.h:110:30: note: in definition of macro 'dev_printk_index_wrap'
     110 |                 _p_func(dev, fmt, ##__VA_ARGS__);                       \
         |                              ^~~
   include/linux/dev_printk.h:150:58: note: in expansion of macro 'dev_fmt'
     150 |         dev_printk_index_wrap(_dev_info, KERN_INFO, dev, dev_fmt(fmt), ##__VA_ARGS__)
         |                                                          ^~~~~~~
   drivers/net/ethernet/sfc/ef100_vdpa_ops.c:782:17: note: in expansion of macro 'dev_info'
     782 |                 dev_info(&vdpa_nic->vdpa_dev.dev,
         |                 ^~~~~~~~
   drivers/net/ethernet/sfc/ef100_vdpa_ops.c:783:62: note: format string is defined here
     783 |                          "%s: mcdi iova overlap detected: %llx\n",
         |                                                           ~~~^
         |                                                              |
         |                                                              long long unsigned int
         |                                                           %x

vim +783 drivers/net/ethernet/sfc/ef100_vdpa_ops.c

   747	
   748	static int ef100_vdpa_dma_map(struct vdpa_device *vdev,
   749				      unsigned int asid,
   750				      u64 iova, u64 size,
   751				      u64 pa, u32 perm, void *opaque)
   752	{
   753		struct ef100_vdpa_nic *vdpa_nic;
   754		struct ef100_nic_data *nic_data;
   755		unsigned int mcdi_buf_len;
   756		dma_addr_t mcdi_buf_addr;
   757		u64 mcdi_iova = 0;
   758		int rc;
   759	
   760		vdpa_nic = get_vdpa_nic(vdev);
   761		nic_data = vdpa_nic->efx->nic_data;
   762		mcdi_buf_addr = nic_data->mcdi_buf.dma_addr;
   763		mcdi_buf_len = nic_data->mcdi_buf.len;
   764	
   765		/* Validate the iova range against geo aperture */
   766		if (iova < vdpa_nic->geo_aper_start ||
   767		    ((iova + size - 1) > vdpa_nic->geo_aper_end)) {
   768			dev_err(&vdpa_nic->vdpa_dev.dev,
   769				"%s: iova range (%llx, %llx) not within geo aperture\n",
   770				__func__, iova, (iova + size));
   771			return -EINVAL;
   772		}
   773	
   774		rc = efx_ef100_insert_iova_node(vdpa_nic, iova, size);
   775		if (rc) {
   776			dev_err(&vdpa_nic->vdpa_dev.dev,
   777				"%s: iova_node insert failure: %d\n", __func__, rc);
   778			return rc;
   779		}
   780	
   781		if (is_iova_overlap(mcdi_buf_addr, mcdi_buf_len, iova, size)) {
   782			dev_info(&vdpa_nic->vdpa_dev.dev,
 > 783				 "%s: mcdi iova overlap detected: %llx\n",
   784				 __func__, mcdi_buf_addr);
   785			/* find the new iova for mcdi buffer */
   786			rc = efx_ef100_find_new_iova(vdpa_nic, mcdi_buf_len,
   787						     &mcdi_iova);
   788			if (rc) {
   789				dev_err(&vdpa_nic->vdpa_dev.dev,
   790					"new mcdi iova not found, err: %d\n", rc);
   791				goto fail;
   792			}
   793	
   794			if (vdpa_nic->efx->mcdi_buf_mode == EFX_BUF_MODE_VDPA)
   795				rc = ef100_remap_vdpa_mcdi_buffer(vdpa_nic->efx,
   796								  mcdi_iova);
   797			else if (vdpa_nic->efx->mcdi_buf_mode == EFX_BUF_MODE_EF100)
   798				rc = ef100_setup_vdpa_mcdi_buffer(vdpa_nic->efx,
   799								  mcdi_iova);
   800			else
   801				goto fail;
   802	
   803			if (rc) {
   804				dev_err(&vdpa_nic->vdpa_dev.dev,
   805					"mcdi buf update failed, err: %d\n", rc);
   806				goto fail;
   807			}
   808		}
   809	
   810		rc = iommu_map(vdpa_nic->domain, iova, pa, size, perm);
   811		if (rc) {
   812			dev_err(&vdev->dev,
   813				"%s: iommu_map iova: %llx size: %llx rc: %d\n",
   814				__func__, iova, size, rc);
   815			goto fail;
   816		}
   817	
   818		return 0;
   819	
   820	fail:
   821		efx_ef100_remove_iova_node(vdpa_nic, iova);
   822		return rc;
   823	}
   824	

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp