Re: [PATCH 2/3] vfio/pci: refactor vfio_pci_bar_rw

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Yunxiang,

kernel test robot noticed the following build warnings:

[auto build test WARNING on awilliam-vfio/next]
[also build test WARNING on awilliam-vfio/for-linus linus/master v6.13-rc3 next-20241220]
[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#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Yunxiang-Li/vfio-pci-refactor-vfio_pci_bar_rw/20241213-045257
base:   https://github.com/awilliam/linux-vfio.git next
patch link:    https://lore.kernel.org/r/20241212205050.5737-2-Yunxiang.Li%40amd.com
patch subject: [PATCH 2/3] vfio/pci: refactor vfio_pci_bar_rw
config: i386-buildonly-randconfig-004-20241220 (https://download.01.org/0day-ci/archive/20241221/202412210450.yl9DrP8o-lkp@xxxxxxxxx/config)
compiler: clang version 19.1.3 (https://github.com/llvm/llvm-project ab51eccf88f5321e7c60591c5546b254b6afab99)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241221/202412210450.yl9DrP8o-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/202412210450.yl9DrP8o-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

   In file included from drivers/vfio/pci/vfio_pci_rdwr.c:14:
   In file included from include/linux/pci.h:1650:
   In file included from include/linux/dmapool.h:14:
   In file included from include/linux/scatterlist.h:8:
   In file included from include/linux/mm.h:2213:
   include/linux/vmstat.h:518:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
     518 |         return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
         |                               ~~~~~~~~~~~ ^ ~~~
>> drivers/vfio/pci/vfio_pci_rdwr.c:289:1: warning: unused label 'out' [-Wunused-label]
     289 | out:
         | ^~~~
   2 warnings generated.


vim +/out +289 drivers/vfio/pci/vfio_pci_rdwr.c

0d77ed3589ac054 Alex Williamson 2018-03-21  232  
536475109c82841 Max Gurtovoy    2021-08-26  233  ssize_t vfio_pci_bar_rw(struct vfio_pci_core_device *vdev, char __user *buf,
89e1f7d4c66d85f Alex Williamson 2012-07-31  234  			size_t count, loff_t *ppos, bool iswrite)
89e1f7d4c66d85f Alex Williamson 2012-07-31  235  {
89e1f7d4c66d85f Alex Williamson 2012-07-31  236  	struct pci_dev *pdev = vdev->pdev;
89e1f7d4c66d85f Alex Williamson 2012-07-31  237  	loff_t pos = *ppos & VFIO_PCI_OFFSET_MASK;
89e1f7d4c66d85f Alex Williamson 2012-07-31  238  	int bar = VFIO_PCI_OFFSET_TO_INDEX(*ppos);
1378a17537c2699 Yunxiang Li     2024-12-12  239  	size_t x_start, x_end;
89e1f7d4c66d85f Alex Williamson 2012-07-31  240  	resource_size_t end;
906ee99dd2a5c81 Alex Williamson 2013-02-14  241  	void __iomem *io;
906ee99dd2a5c81 Alex Williamson 2013-02-14  242  	ssize_t done;
89e1f7d4c66d85f Alex Williamson 2012-07-31  243  
a13b64591747e8a Alex Williamson 2016-02-22  244  	if (pci_resource_start(pdev, bar))
89e1f7d4c66d85f Alex Williamson 2012-07-31  245  		end = pci_resource_len(pdev, bar);
a13b64591747e8a Alex Williamson 2016-02-22  246  	else
a13b64591747e8a Alex Williamson 2016-02-22  247  		return -EINVAL;
89e1f7d4c66d85f Alex Williamson 2012-07-31  248  
906ee99dd2a5c81 Alex Williamson 2013-02-14  249  	if (pos >= end)
89e1f7d4c66d85f Alex Williamson 2012-07-31  250  		return -EINVAL;
89e1f7d4c66d85f Alex Williamson 2012-07-31  251  
906ee99dd2a5c81 Alex Williamson 2013-02-14  252  	count = min(count, (size_t)(end - pos));
89e1f7d4c66d85f Alex Williamson 2012-07-31  253  
89e1f7d4c66d85f Alex Williamson 2012-07-31  254  	if (bar == PCI_ROM_RESOURCE) {
1378a17537c2699 Yunxiang Li     2024-12-12  255  		if (iswrite)
1378a17537c2699 Yunxiang Li     2024-12-12  256  			return -EINVAL;
906ee99dd2a5c81 Alex Williamson 2013-02-14  257  		/*
906ee99dd2a5c81 Alex Williamson 2013-02-14  258  		 * The ROM can fill less space than the BAR, so we start the
906ee99dd2a5c81 Alex Williamson 2013-02-14  259  		 * excluded range at the end of the actual ROM.  This makes
906ee99dd2a5c81 Alex Williamson 2013-02-14  260  		 * filling large ROM BARs much faster.
906ee99dd2a5c81 Alex Williamson 2013-02-14  261  		 */
89e1f7d4c66d85f Alex Williamson 2012-07-31  262  		io = pci_map_rom(pdev, &x_start);
1378a17537c2699 Yunxiang Li     2024-12-12  263  		if (!io)
1378a17537c2699 Yunxiang Li     2024-12-12  264  			return -ENOMEM;
89e1f7d4c66d85f Alex Williamson 2012-07-31  265  		x_end = end;
1378a17537c2699 Yunxiang Li     2024-12-12  266  
1378a17537c2699 Yunxiang Li     2024-12-12  267  		done = vfio_pci_core_do_io_rw(vdev, 1, io, buf, pos,
1378a17537c2699 Yunxiang Li     2024-12-12  268  					      count, x_start, x_end, 0);
1378a17537c2699 Yunxiang Li     2024-12-12  269  
1378a17537c2699 Yunxiang Li     2024-12-12  270  		pci_unmap_rom(pdev, io);
0d77ed3589ac054 Alex Williamson 2018-03-21  271  	} else {
1378a17537c2699 Yunxiang Li     2024-12-12  272  		done = vfio_pci_core_setup_barmap(vdev, bar);
1378a17537c2699 Yunxiang Li     2024-12-12  273  		if (done)
1378a17537c2699 Yunxiang Li     2024-12-12  274  			return done;
89e1f7d4c66d85f Alex Williamson 2012-07-31  275  
89e1f7d4c66d85f Alex Williamson 2012-07-31  276  		io = vdev->barmap[bar];
89e1f7d4c66d85f Alex Williamson 2012-07-31  277  
89e1f7d4c66d85f Alex Williamson 2012-07-31  278  		if (bar == vdev->msix_bar) {
89e1f7d4c66d85f Alex Williamson 2012-07-31  279  			x_start = vdev->msix_offset;
89e1f7d4c66d85f Alex Williamson 2012-07-31  280  			x_end = vdev->msix_offset + vdev->msix_size;
1378a17537c2699 Yunxiang Li     2024-12-12  281  		} else {
1378a17537c2699 Yunxiang Li     2024-12-12  282  			x_start = 0;
1378a17537c2699 Yunxiang Li     2024-12-12  283  			x_end = 0;
89e1f7d4c66d85f Alex Williamson 2012-07-31  284  		}
89e1f7d4c66d85f Alex Williamson 2012-07-31  285  
1378a17537c2699 Yunxiang Li     2024-12-12  286  		done = vfio_pci_core_do_io_rw(vdev, pci_resource_flags(pdev, bar) & IORESOURCE_MEM, io, buf, pos,
bc93b9ae0151ae5 Alex Williamson 2020-08-17  287  				      count, x_start, x_end, iswrite);
1378a17537c2699 Yunxiang Li     2024-12-12  288  	}
abafbc551fddede Alex Williamson 2020-04-22 @289  out:
1378a17537c2699 Yunxiang Li     2024-12-12  290  	if (done > 0)
1378a17537c2699 Yunxiang Li     2024-12-12  291  		*ppos += done;
906ee99dd2a5c81 Alex Williamson 2013-02-14  292  	return done;
89e1f7d4c66d85f Alex Williamson 2012-07-31  293  }
84237a826b261de Alex Williamson 2013-02-18  294  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux