All of lore.kernel.org
 help / color / mirror / Atom feed
* [yiliu1765-iommufd:iommufd-v5.19-rc5 84/104] drivers/iommu/iommufd/device.c:72: warning: Function parameter or member 'flags' not described in 'iommufd_bind_device'
@ 2023-11-12 18:23 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2023-11-12 18:23 UTC (permalink / raw)
  To: Yi Liu, Kevin Tian; +Cc: oe-kbuild-all

tree:   https://github.com/yiliu1765/iommufd.git iommufd-v5.19-rc5
head:   f200d9a1de755f3bb98e21535e22b9adf6ba83f7
commit: 4e9347bc44832ec0e1557796ed0b42674a960a4e [84/104] iommufd: Add driver facing API for PASID support
config: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20231113/202311130251.Ms1SvRC0-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231113/202311130251.Ms1SvRC0-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/202311130251.Ms1SvRC0-lkp@intel.com/

All warnings (new ones prefixed by >>):

   drivers/iommu/iommufd/device.c:72: warning: Function parameter or member 'dev' not described in 'iommufd_bind_device'
>> drivers/iommu/iommufd/device.c:72: warning: Function parameter or member 'flags' not described in 'iommufd_bind_device'
   drivers/iommu/iommufd/device.c:72: warning: Excess function parameter 'pdev' description in 'iommufd_bind_device'


vim +72 drivers/iommu/iommufd/device.c

6f915f4df4ae49 Jason Gunthorpe 2021-11-11   53  
6f915f4df4ae49 Jason Gunthorpe 2021-11-11   54  /**
6f915f4df4ae49 Jason Gunthorpe 2021-11-11   55   * iommufd_bind_device - Bind a physical device to an iommu fd
6f915f4df4ae49 Jason Gunthorpe 2021-11-11   56   * @fd: iommufd file descriptor.
6f915f4df4ae49 Jason Gunthorpe 2021-11-11   57   * @pdev: Pointer to a physical PCI device struct
6f915f4df4ae49 Jason Gunthorpe 2021-11-11   58   * @id: Output ID number to return to userspace for this device
6f915f4df4ae49 Jason Gunthorpe 2021-11-11   59   *
6f915f4df4ae49 Jason Gunthorpe 2021-11-11   60   * A successful bind establishes an ownership over the device and returns
6f915f4df4ae49 Jason Gunthorpe 2021-11-11   61   * struct iommufd_device pointer, otherwise returns error pointer.
6f915f4df4ae49 Jason Gunthorpe 2021-11-11   62   *
6f915f4df4ae49 Jason Gunthorpe 2021-11-11   63   * A driver using this API must set driver_managed_dma and must not touch
6f915f4df4ae49 Jason Gunthorpe 2021-11-11   64   * the device until this routine succeeds and establishes ownership.
6f915f4df4ae49 Jason Gunthorpe 2021-11-11   65   *
6f915f4df4ae49 Jason Gunthorpe 2021-11-11   66   * Binding a PCI device places the entire RID under iommufd control.
6f915f4df4ae49 Jason Gunthorpe 2021-11-11   67   *
6f915f4df4ae49 Jason Gunthorpe 2021-11-11   68   * The caller must undo this with iommufd_unbind_device()
6f915f4df4ae49 Jason Gunthorpe 2021-11-11   69   */
4e9347bc44832e Yi Liu          2022-06-22   70  struct iommufd_device *iommufd_bind_device(int fd, struct device *dev,
4e9347bc44832e Yi Liu          2022-06-22   71  					   unsigned int flags, u32 *id)
6f915f4df4ae49 Jason Gunthorpe 2021-11-11  @72  {
6f915f4df4ae49 Jason Gunthorpe 2021-11-11   73  	struct iommufd_device *idev;
6f915f4df4ae49 Jason Gunthorpe 2021-11-11   74  	struct iommufd_ctx *ictx;
6f915f4df4ae49 Jason Gunthorpe 2021-11-11   75  	struct iommu_group *group;
6f915f4df4ae49 Jason Gunthorpe 2021-11-11   76  	int rc;
6f915f4df4ae49 Jason Gunthorpe 2021-11-11   77  
6f915f4df4ae49 Jason Gunthorpe 2021-11-11   78         /*
6f915f4df4ae49 Jason Gunthorpe 2021-11-11   79          * iommufd always sets IOMMU_CACHE because we offer no way for userspace
6f915f4df4ae49 Jason Gunthorpe 2021-11-11   80          * to restore cache coherency.
6f915f4df4ae49 Jason Gunthorpe 2021-11-11   81          */
6f915f4df4ae49 Jason Gunthorpe 2021-11-11   82         if (!iommu_capable(dev->bus, IOMMU_CAP_CACHE_COHERENCY))
6f915f4df4ae49 Jason Gunthorpe 2021-11-11   83  		return ERR_PTR(-EINVAL);
6f915f4df4ae49 Jason Gunthorpe 2021-11-11   84  
6f915f4df4ae49 Jason Gunthorpe 2021-11-11   85  	ictx = iommufd_fget(fd);
6f915f4df4ae49 Jason Gunthorpe 2021-11-11   86  	if (!ictx)
6f915f4df4ae49 Jason Gunthorpe 2021-11-11   87  		return ERR_PTR(-EINVAL);
6f915f4df4ae49 Jason Gunthorpe 2021-11-11   88  
6f915f4df4ae49 Jason Gunthorpe 2021-11-11   89  	group = iommu_group_get(dev);
6f915f4df4ae49 Jason Gunthorpe 2021-11-11   90  	if (!group) {
6f915f4df4ae49 Jason Gunthorpe 2021-11-11   91  		rc = -ENODEV;
6f915f4df4ae49 Jason Gunthorpe 2021-11-11   92  		goto out_file_put;
6f915f4df4ae49 Jason Gunthorpe 2021-11-11   93  	}
6f915f4df4ae49 Jason Gunthorpe 2021-11-11   94  
6f915f4df4ae49 Jason Gunthorpe 2021-11-11   95  	/*
6f915f4df4ae49 Jason Gunthorpe 2021-11-11   96  	 * FIXME: Use a device-centric iommu api and this won't work with
6f915f4df4ae49 Jason Gunthorpe 2021-11-11   97  	 * multi-device groups
6f915f4df4ae49 Jason Gunthorpe 2021-11-11   98  	 */
4e9347bc44832e Yi Liu          2022-06-22   99  	if (!(flags & IOMMUFD_BIND_FLAGS_BYPASS_DMA_OWNERSHIP)) {
6f915f4df4ae49 Jason Gunthorpe 2021-11-11  100  		rc = iommu_group_claim_dma_owner(group, ictx->filp);
6f915f4df4ae49 Jason Gunthorpe 2021-11-11  101  		if (rc)
6f915f4df4ae49 Jason Gunthorpe 2021-11-11  102  			goto out_group_put;
4e9347bc44832e Yi Liu          2022-06-22  103  	}
6f915f4df4ae49 Jason Gunthorpe 2021-11-11  104  
6f915f4df4ae49 Jason Gunthorpe 2021-11-11  105  	idev = iommufd_object_alloc(ictx, idev, IOMMUFD_OBJ_DEVICE);
6f915f4df4ae49 Jason Gunthorpe 2021-11-11  106  	if (IS_ERR(idev)) {
6f915f4df4ae49 Jason Gunthorpe 2021-11-11  107  		rc = PTR_ERR(idev);
6f915f4df4ae49 Jason Gunthorpe 2021-11-11  108  		goto out_release_owner;
6f915f4df4ae49 Jason Gunthorpe 2021-11-11  109  	}
6f915f4df4ae49 Jason Gunthorpe 2021-11-11  110  	idev->ictx = ictx;
6f915f4df4ae49 Jason Gunthorpe 2021-11-11  111  	idev->dev = dev;
4e9347bc44832e Yi Liu          2022-06-22  112  	idev->dma_owner_claimed =
4e9347bc44832e Yi Liu          2022-06-22  113  		!(flags & IOMMUFD_BIND_FLAGS_BYPASS_DMA_OWNERSHIP);
4e9347bc44832e Yi Liu          2022-06-22  114  	xa_init_flags(&idev->pasid_xa, XA_FLAGS_ALLOC | XA_FLAGS_ACCOUNT);
4e9347bc44832e Yi Liu          2022-06-22  115  	mutex_init(&idev->pasid_lock);
6f915f4df4ae49 Jason Gunthorpe 2021-11-11  116  	/* The calling driver is a user until iommufd_unbind_device() */
6f915f4df4ae49 Jason Gunthorpe 2021-11-11  117  	refcount_inc(&idev->obj.users);
6f915f4df4ae49 Jason Gunthorpe 2021-11-11  118  	/* group refcount moves into iommufd_device */
6f915f4df4ae49 Jason Gunthorpe 2021-11-11  119  	idev->group = group;
6f915f4df4ae49 Jason Gunthorpe 2021-11-11  120  
6f915f4df4ae49 Jason Gunthorpe 2021-11-11  121  	/*
6f915f4df4ae49 Jason Gunthorpe 2021-11-11  122  	 * If the caller fails after this success it must call
6f915f4df4ae49 Jason Gunthorpe 2021-11-11  123  	 * iommufd_unbind_device() which is safe since we hold this refcount.
6f915f4df4ae49 Jason Gunthorpe 2021-11-11  124  	 * This also means the device is a leaf in the graph and no other object
6f915f4df4ae49 Jason Gunthorpe 2021-11-11  125  	 * can take a reference on it.
6f915f4df4ae49 Jason Gunthorpe 2021-11-11  126  	 */
6f915f4df4ae49 Jason Gunthorpe 2021-11-11  127  	iommufd_object_finalize(ictx, &idev->obj);
6f915f4df4ae49 Jason Gunthorpe 2021-11-11  128  	*id = idev->obj.id;
6f915f4df4ae49 Jason Gunthorpe 2021-11-11  129  	return idev;
6f915f4df4ae49 Jason Gunthorpe 2021-11-11  130  out_release_owner:
4e9347bc44832e Yi Liu          2022-06-22  131  	if ((!flags & IOMMUFD_BIND_FLAGS_BYPASS_DMA_OWNERSHIP))
6f915f4df4ae49 Jason Gunthorpe 2021-11-11  132  		iommu_group_release_dma_owner(group);
6f915f4df4ae49 Jason Gunthorpe 2021-11-11  133  out_group_put:
6f915f4df4ae49 Jason Gunthorpe 2021-11-11  134  	iommu_group_put(group);
6f915f4df4ae49 Jason Gunthorpe 2021-11-11  135  out_file_put:
6f915f4df4ae49 Jason Gunthorpe 2021-11-11  136  	fput(ictx->filp);
6f915f4df4ae49 Jason Gunthorpe 2021-11-11  137  	return ERR_PTR(rc);
6f915f4df4ae49 Jason Gunthorpe 2021-11-11  138  }
6f915f4df4ae49 Jason Gunthorpe 2021-11-11  139  EXPORT_SYMBOL_GPL(iommufd_bind_device);
6f915f4df4ae49 Jason Gunthorpe 2021-11-11  140  

:::::: The code at line 72 was first introduced by commit
:::::: 6f915f4df4ae494e0d6d26991ddc8ebb672f9101 iommufd: Add kAPI toward external drivers

:::::: TO: Jason Gunthorpe <jgg@nvidia.com>
:::::: CC: Yi Liu <yi.l.liu@intel.com>

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-11-12 18:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-12 18:23 [yiliu1765-iommufd:iommufd-v5.19-rc5 84/104] drivers/iommu/iommufd/device.c:72: warning: Function parameter or member 'flags' not described in 'iommufd_bind_device' kernel test robot

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.