Re: [PATCH v11 05/13] vfio/pci: Register an iommu fault handler

From: kernel test robot
Date: Mon Nov 16 2020 - 14:32:03 EST


Hi Eric,

I love your patch! Perhaps something to improve:

[auto build test WARNING on v5.10-rc4]
[also build test WARNING on next-20201116]
[cannot apply to vfio/next]
[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/Eric-Auger/SMMUv3-Nested-Stage-Setup-VFIO-part/20201116-190742
base: 09162bc32c880a791c6c0668ce0745cf7958f576
config: x86_64-allyesconfig (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce (this is a W=1 build):
# https://github.com/0day-ci/linux/commit/747ef402696e1192684908ca99f06f3d68466c04
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Eric-Auger/SMMUv3-Nested-Stage-Setup-VFIO-part/20201116-190742
git checkout 747ef402696e1192684908ca99f06f3d68466c04
# save the attached .config to linux build tree
make W=1 ARCH=x86_64

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

All warnings (new ones prefixed by >>):

In file included from include/linux/vfio.h:16,
from drivers/vfio/pci/vfio_pci.c:26:
include/uapi/linux/vfio.h:1231:34: error: field 'config' has incomplete type
1231 | struct iommu_pasid_table_config config; /* used on SET */
| ^~~~~~
>> drivers/vfio/pci/vfio_pci.c:339:5: warning: no previous prototype for 'vfio_pci_iommu_dev_fault_handler' [-Wmissing-prototypes]
339 | int vfio_pci_iommu_dev_fault_handler(struct iommu_fault *fault, void *data)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

vim +/vfio_pci_iommu_dev_fault_handler +339 drivers/vfio/pci/vfio_pci.c

338
> 339 int vfio_pci_iommu_dev_fault_handler(struct iommu_fault *fault, void *data)
340 {
341 struct vfio_pci_device *vdev = (struct vfio_pci_device *)data;
342 struct vfio_region_dma_fault *reg =
343 (struct vfio_region_dma_fault *)vdev->fault_pages;
344 struct iommu_fault *new;
345 u32 head, tail, size;
346 int ret = -EINVAL;
347
348
349 if (WARN_ON(!reg))
350 return ret;
351
352 mutex_lock(&vdev->fault_queue_lock);
353
354 head = reg->head;
355 tail = reg->tail;
356 size = reg->nb_entries;
357
358 new = (struct iommu_fault *)(vdev->fault_pages + reg->offset +
359 head * reg->entry_size);
360
361 if (CIRC_SPACE(head, tail, size) < 1) {
362 ret = -ENOSPC;
363 goto unlock;
364 }
365
366 *new = *fault;
367 reg->head = (head + 1) % size;
368 ret = 0;
369 unlock:
370 mutex_unlock(&vdev->fault_queue_lock);
371 return ret;
372 }
373

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

Attachment: .config.gz
Description: application/gzip