All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Matt Evans <mattev@meta.com>
Cc: oe-kbuild-all@lists.linux.dev, 0day robot <lkp@intel.com>
Subject: drivers/vfio/pci/vfio_pci_core.c:1775:13: warning: unused variable 'ret'
Date: Thu, 07 May 2026 23:49:32 +0200	[thread overview]
Message-ID: <202605072358.FqfGLAt1-lkp@intel.com> (raw)

tree:   https://github.com/intel-lab-lkp/linux/commits/Matt-Evans/vfio-pci-Set-up-barmap-in-vfio_pci_core_enable/20260426-165316
head:   3a69d9395a88f53b7a52aa91446b93c305a510ba
commit: 3a69d9395a88f53b7a52aa91446b93c305a510ba vfio/pci: Remove vfio_pci_core_setup_barmap()
date:   12 days ago
config: x86_64-rhel-9.4-ltp (https://download.01.org/0day-ci/archive/20260507/202605072358.FqfGLAt1-lkp@intel.com/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260507/202605072358.FqfGLAt1-lkp@intel.com/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@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202605072358.FqfGLAt1-lkp@intel.com/

All warnings (new ones prefixed by >>):

   drivers/vfio/pci/vfio_pci_core.c: In function 'vfio_pci_core_mmap':
>> drivers/vfio/pci/vfio_pci_core.c:1775:13: warning: unused variable 'ret' [-Wunused-variable]
    1775 |         int ret;
         |             ^~~


vim +/ret +1775 drivers/vfio/pci/vfio_pci_core.c

11c4cd07ba111a drivers/vfio/pci/vfio_pci.c      Alex Williamson       2020-04-28  1767  
ff53edf6d6ab09 drivers/vfio/pci/vfio_pci_core.c Max Gurtovoy          2021-08-26  1768  int vfio_pci_core_mmap(struct vfio_device *core_vdev, struct vm_area_struct *vma)
89e1f7d4c66d85 drivers/vfio/pci/vfio_pci.c      Alex Williamson       2012-07-31  1769  {
536475109c8284 drivers/vfio/pci/vfio_pci_core.c Max Gurtovoy          2021-08-26  1770  	struct vfio_pci_core_device *vdev =
536475109c8284 drivers/vfio/pci/vfio_pci_core.c Max Gurtovoy          2021-08-26  1771  		container_of(core_vdev, struct vfio_pci_core_device, vdev);
89e1f7d4c66d85 drivers/vfio/pci/vfio_pci.c      Alex Williamson       2012-07-31  1772  	struct pci_dev *pdev = vdev->pdev;
89e1f7d4c66d85 drivers/vfio/pci/vfio_pci.c      Alex Williamson       2012-07-31  1773  	unsigned int index;
34002f54d2bd8e drivers/vfio/pci/vfio_pci.c      Alex Williamson       2012-10-10  1774  	u64 phys_len, req_len, pgoff, req_start;
89e1f7d4c66d85 drivers/vfio/pci/vfio_pci.c      Alex Williamson       2012-07-31 @1775  	int ret;
89e1f7d4c66d85 drivers/vfio/pci/vfio_pci.c      Alex Williamson       2012-07-31  1776  
89e1f7d4c66d85 drivers/vfio/pci/vfio_pci.c      Alex Williamson       2012-07-31  1777  	index = vma->vm_pgoff >> (VFIO_PCI_OFFSET_SHIFT - PAGE_SHIFT);
89e1f7d4c66d85 drivers/vfio/pci/vfio_pci.c      Alex Williamson       2012-07-31  1778  
909290786ea335 drivers/vfio/pci/vfio_pci.c      Christian A. Ehrhardt 2021-04-12  1779  	if (index >= VFIO_PCI_NUM_REGIONS + vdev->num_regions)
909290786ea335 drivers/vfio/pci/vfio_pci.c      Christian A. Ehrhardt 2021-04-12  1780  		return -EINVAL;
89e1f7d4c66d85 drivers/vfio/pci/vfio_pci.c      Alex Williamson       2012-07-31  1781  	if (vma->vm_end < vma->vm_start)
89e1f7d4c66d85 drivers/vfio/pci/vfio_pci.c      Alex Williamson       2012-07-31  1782  		return -EINVAL;
89e1f7d4c66d85 drivers/vfio/pci/vfio_pci.c      Alex Williamson       2012-07-31  1783  	if ((vma->vm_flags & VM_SHARED) == 0)
89e1f7d4c66d85 drivers/vfio/pci/vfio_pci.c      Alex Williamson       2012-07-31  1784  		return -EINVAL;
a15b1883fee11e drivers/vfio/pci/vfio_pci.c      Alexey Kardashevskiy  2018-12-19  1785  	if (index >= VFIO_PCI_NUM_REGIONS) {
a15b1883fee11e drivers/vfio/pci/vfio_pci.c      Alexey Kardashevskiy  2018-12-19  1786  		int regnum = index - VFIO_PCI_NUM_REGIONS;
a15b1883fee11e drivers/vfio/pci/vfio_pci.c      Alexey Kardashevskiy  2018-12-19  1787  		struct vfio_pci_region *region = vdev->region + regnum;
a15b1883fee11e drivers/vfio/pci/vfio_pci.c      Alexey Kardashevskiy  2018-12-19  1788  
909290786ea335 drivers/vfio/pci/vfio_pci.c      Christian A. Ehrhardt 2021-04-12  1789  		if (region->ops && region->ops->mmap &&
a15b1883fee11e drivers/vfio/pci/vfio_pci.c      Alexey Kardashevskiy  2018-12-19  1790  		    (region->flags & VFIO_REGION_INFO_FLAG_MMAP))
a15b1883fee11e drivers/vfio/pci/vfio_pci.c      Alexey Kardashevskiy  2018-12-19  1791  			return region->ops->mmap(vdev, region, vma);
a15b1883fee11e drivers/vfio/pci/vfio_pci.c      Alexey Kardashevskiy  2018-12-19  1792  		return -EINVAL;
a15b1883fee11e drivers/vfio/pci/vfio_pci.c      Alexey Kardashevskiy  2018-12-19  1793  	}
89e1f7d4c66d85 drivers/vfio/pci/vfio_pci.c      Alex Williamson       2012-07-31  1794  	if (index >= VFIO_PCI_ROM_REGION_INDEX)
89e1f7d4c66d85 drivers/vfio/pci/vfio_pci.c      Alex Williamson       2012-07-31  1795  		return -EINVAL;
05f0c03fbac181 drivers/vfio/pci/vfio_pci.c      Yongji Xie            2016-06-30  1796  	if (!vdev->bar_mmap_supported[index])
89e1f7d4c66d85 drivers/vfio/pci/vfio_pci.c      Alex Williamson       2012-07-31  1797  		return -EINVAL;
89e1f7d4c66d85 drivers/vfio/pci/vfio_pci.c      Alex Williamson       2012-07-31  1798  
05f0c03fbac181 drivers/vfio/pci/vfio_pci.c      Yongji Xie            2016-06-30  1799  	phys_len = PAGE_ALIGN(pci_resource_len(pdev, index));
89e1f7d4c66d85 drivers/vfio/pci/vfio_pci.c      Alex Williamson       2012-07-31  1800  	req_len = vma->vm_end - vma->vm_start;
89e1f7d4c66d85 drivers/vfio/pci/vfio_pci.c      Alex Williamson       2012-07-31  1801  	pgoff = vma->vm_pgoff &
89e1f7d4c66d85 drivers/vfio/pci/vfio_pci.c      Alex Williamson       2012-07-31  1802  		((1U << (VFIO_PCI_OFFSET_SHIFT - PAGE_SHIFT)) - 1);
89e1f7d4c66d85 drivers/vfio/pci/vfio_pci.c      Alex Williamson       2012-07-31  1803  	req_start = pgoff << PAGE_SHIFT;
89e1f7d4c66d85 drivers/vfio/pci/vfio_pci.c      Alex Williamson       2012-07-31  1804  
05f0c03fbac181 drivers/vfio/pci/vfio_pci.c      Yongji Xie            2016-06-30  1805  	if (req_start + req_len > phys_len)
89e1f7d4c66d85 drivers/vfio/pci/vfio_pci.c      Alex Williamson       2012-07-31  1806  		return -EINVAL;
89e1f7d4c66d85 drivers/vfio/pci/vfio_pci.c      Alex Williamson       2012-07-31  1807  
89e1f7d4c66d85 drivers/vfio/pci/vfio_pci.c      Alex Williamson       2012-07-31  1808  	vma->vm_private_data = vdev;
89e1f7d4c66d85 drivers/vfio/pci/vfio_pci.c      Alex Williamson       2012-07-31  1809  	vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
aac6db75a9fc2c drivers/vfio/pci/vfio_pci_core.c Alex Williamson       2024-05-29  1810  	vma->vm_page_prot = pgprot_decrypted(vma->vm_page_prot);
89e1f7d4c66d85 drivers/vfio/pci/vfio_pci.c      Alex Williamson       2012-07-31  1811  
11c4cd07ba111a drivers/vfio/pci/vfio_pci.c      Alex Williamson       2020-04-28  1812  	/*
aac6db75a9fc2c drivers/vfio/pci/vfio_pci_core.c Alex Williamson       2024-05-29  1813  	 * Set vm_flags now, they should not be changed in the fault handler.
aac6db75a9fc2c drivers/vfio/pci/vfio_pci_core.c Alex Williamson       2024-05-29  1814  	 * We want the same flags and page protection (decrypted above) as
aac6db75a9fc2c drivers/vfio/pci/vfio_pci_core.c Alex Williamson       2024-05-29  1815  	 * io_remap_pfn_range() would set.
a39d3a966a0909 drivers/vfio/pci/vfio_pci_core.c Ankit Agrawal         2024-02-24  1816  	 *
a39d3a966a0909 drivers/vfio/pci/vfio_pci_core.c Ankit Agrawal         2024-02-24  1817  	 * VM_ALLOW_ANY_UNCACHED: The VMA flag is implemented for ARM64,
a39d3a966a0909 drivers/vfio/pci/vfio_pci_core.c Ankit Agrawal         2024-02-24  1818  	 * allowing KVM stage 2 device mapping attributes to use Normal-NC
a39d3a966a0909 drivers/vfio/pci/vfio_pci_core.c Ankit Agrawal         2024-02-24  1819  	 * rather than DEVICE_nGnRE, which allows guest mappings
a39d3a966a0909 drivers/vfio/pci/vfio_pci_core.c Ankit Agrawal         2024-02-24  1820  	 * supporting write-combining attributes (WC). ARM does not
a39d3a966a0909 drivers/vfio/pci/vfio_pci_core.c Ankit Agrawal         2024-02-24  1821  	 * architecturally guarantee this is safe, and indeed some MMIO
a39d3a966a0909 drivers/vfio/pci/vfio_pci_core.c Ankit Agrawal         2024-02-24  1822  	 * regions like the GICv2 VCPU interface can trigger uncontained
a39d3a966a0909 drivers/vfio/pci/vfio_pci_core.c Ankit Agrawal         2024-02-24  1823  	 * faults if Normal-NC is used.
a39d3a966a0909 drivers/vfio/pci/vfio_pci_core.c Ankit Agrawal         2024-02-24  1824  	 *
a39d3a966a0909 drivers/vfio/pci/vfio_pci_core.c Ankit Agrawal         2024-02-24  1825  	 * To safely use VFIO in KVM the platform must guarantee full
a39d3a966a0909 drivers/vfio/pci/vfio_pci_core.c Ankit Agrawal         2024-02-24  1826  	 * safety in the guest where no action taken against a MMIO
a39d3a966a0909 drivers/vfio/pci/vfio_pci_core.c Ankit Agrawal         2024-02-24  1827  	 * mapping can trigger an uncontained failure. The assumption is
a39d3a966a0909 drivers/vfio/pci/vfio_pci_core.c Ankit Agrawal         2024-02-24  1828  	 * that most VFIO PCI platforms support this for both mapping types,
a39d3a966a0909 drivers/vfio/pci/vfio_pci_core.c Ankit Agrawal         2024-02-24  1829  	 * at least in common flows, based on some expectations of how
a39d3a966a0909 drivers/vfio/pci/vfio_pci_core.c Ankit Agrawal         2024-02-24  1830  	 * PCI IP is integrated. Hence VM_ALLOW_ANY_UNCACHED is set in
a39d3a966a0909 drivers/vfio/pci/vfio_pci_core.c Ankit Agrawal         2024-02-24  1831  	 * the VMA flags.
11c4cd07ba111a drivers/vfio/pci/vfio_pci.c      Alex Williamson       2020-04-28  1832  	 */
a39d3a966a0909 drivers/vfio/pci/vfio_pci_core.c Ankit Agrawal         2024-02-24  1833  	vm_flags_set(vma, VM_ALLOW_ANY_UNCACHED | VM_IO | VM_PFNMAP |
a39d3a966a0909 drivers/vfio/pci/vfio_pci_core.c Ankit Agrawal         2024-02-24  1834  			VM_DONTEXPAND | VM_DONTDUMP);
11c4cd07ba111a drivers/vfio/pci/vfio_pci.c      Alex Williamson       2020-04-28  1835  	vma->vm_ops = &vfio_pci_mmap_ops;
11c4cd07ba111a drivers/vfio/pci/vfio_pci.c      Alex Williamson       2020-04-28  1836  
11c4cd07ba111a drivers/vfio/pci/vfio_pci.c      Alex Williamson       2020-04-28  1837  	return 0;
89e1f7d4c66d85 drivers/vfio/pci/vfio_pci.c      Alex Williamson       2012-07-31  1838  }
7fa005caa35ed9 drivers/vfio/pci/vfio_pci_core.c Max Gurtovoy          2021-08-26  1839  EXPORT_SYMBOL_GPL(vfio_pci_core_mmap);
89e1f7d4c66d85 drivers/vfio/pci/vfio_pci.c      Alex Williamson       2012-07-31  1840  

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

                 reply	other threads:[~2026-05-07 21:49 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=202605072358.FqfGLAt1-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=mattev@meta.com \
    --cc=oe-kbuild-all@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.