drivers/vfio/pci/vfio_pci_nvlink2.c:101:10: error: implicit declaration of function 'mm_iommu_put'; did you mean 'mm_iommu_init'?
From: kernel test robot
Date: Sun Mar 28 2021 - 14:52:49 EST
Hi Jason,
First bad commit (maybe != root cause):
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 0f4498cef9f5cd18d7c6639a2a902ec1edc5be4e
commit: 179209fa12709a3df8888c323b37315da2683c24 vfio: IOMMU_API should be selected
date: 12 days ago
config: powerpc64-randconfig-r014-20210328 (attached as .config)
compiler: powerpc64le-linux-gcc (GCC) 9.3.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://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=179209fa12709a3df8888c323b37315da2683c24
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 179209fa12709a3df8888c323b37315da2683c24
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=powerpc64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>
All errors (new ones prefixed by >>):
drivers/vfio/pci/vfio_pci_nvlink2.c: In function 'vfio_pci_nvgpu_release':
>> drivers/vfio/pci/vfio_pci_nvlink2.c:101:10: error: implicit declaration of function 'mm_iommu_put'; did you mean 'mm_iommu_init'? [-Werror=implicit-function-declaration]
101 | ret = mm_iommu_put(data->mm, data->mem);
| ^~~~~~~~~~~~
| mm_iommu_init
drivers/vfio/pci/vfio_pci_nvlink2.c: In function 'vfio_pci_nvgpu_mmap':
>> drivers/vfio/pci/vfio_pci_nvlink2.c:165:14: error: implicit declaration of function 'mm_iommu_newdev' [-Werror=implicit-function-declaration]
165 | ret = (int) mm_iommu_newdev(data->mm, data->useraddr,
| ^~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
vim +101 drivers/vfio/pci/vfio_pci_nvlink2.c
7f92891778dff6 Alexey Kardashevskiy 2018-12-20 91
7f92891778dff6 Alexey Kardashevskiy 2018-12-20 92 static void vfio_pci_nvgpu_release(struct vfio_pci_device *vdev,
7f92891778dff6 Alexey Kardashevskiy 2018-12-20 93 struct vfio_pci_region *region)
7f92891778dff6 Alexey Kardashevskiy 2018-12-20 94 {
7f92891778dff6 Alexey Kardashevskiy 2018-12-20 95 struct vfio_pci_nvgpu_data *data = region->data;
7f92891778dff6 Alexey Kardashevskiy 2018-12-20 96 long ret;
7f92891778dff6 Alexey Kardashevskiy 2018-12-20 97
7f92891778dff6 Alexey Kardashevskiy 2018-12-20 98 /* If there were any mappings at all... */
7f92891778dff6 Alexey Kardashevskiy 2018-12-20 99 if (data->mm) {
338b4e10f939a7 Alexey Kardashevskiy 2019-12-23 100 if (data->mem) {
7f92891778dff6 Alexey Kardashevskiy 2018-12-20 @101 ret = mm_iommu_put(data->mm, data->mem);
7f92891778dff6 Alexey Kardashevskiy 2018-12-20 102 WARN_ON(ret);
338b4e10f939a7 Alexey Kardashevskiy 2019-12-23 103 }
7f92891778dff6 Alexey Kardashevskiy 2018-12-20 104
7f92891778dff6 Alexey Kardashevskiy 2018-12-20 105 mmdrop(data->mm);
7f92891778dff6 Alexey Kardashevskiy 2018-12-20 106 }
7f92891778dff6 Alexey Kardashevskiy 2018-12-20 107
7f92891778dff6 Alexey Kardashevskiy 2018-12-20 108 vfio_unregister_notifier(&data->gpdev->dev, VFIO_GROUP_NOTIFY,
7f92891778dff6 Alexey Kardashevskiy 2018-12-20 109 &data->group_notifier);
7f92891778dff6 Alexey Kardashevskiy 2018-12-20 110
7f92891778dff6 Alexey Kardashevskiy 2018-12-20 111 pnv_npu2_unmap_lpar_dev(data->gpdev);
7f92891778dff6 Alexey Kardashevskiy 2018-12-20 112
7f92891778dff6 Alexey Kardashevskiy 2018-12-20 113 kfree(data);
7f92891778dff6 Alexey Kardashevskiy 2018-12-20 114 }
7f92891778dff6 Alexey Kardashevskiy 2018-12-20 115
7f92891778dff6 Alexey Kardashevskiy 2018-12-20 116 static vm_fault_t vfio_pci_nvgpu_mmap_fault(struct vm_fault *vmf)
7f92891778dff6 Alexey Kardashevskiy 2018-12-20 117 {
7f92891778dff6 Alexey Kardashevskiy 2018-12-20 118 vm_fault_t ret;
7f92891778dff6 Alexey Kardashevskiy 2018-12-20 119 struct vm_area_struct *vma = vmf->vma;
7f92891778dff6 Alexey Kardashevskiy 2018-12-20 120 struct vfio_pci_region *region = vma->vm_private_data;
7f92891778dff6 Alexey Kardashevskiy 2018-12-20 121 struct vfio_pci_nvgpu_data *data = region->data;
7f92891778dff6 Alexey Kardashevskiy 2018-12-20 122 unsigned long vmf_off = (vmf->address - vma->vm_start) >> PAGE_SHIFT;
7f92891778dff6 Alexey Kardashevskiy 2018-12-20 123 unsigned long nv2pg = data->gpu_hpa >> PAGE_SHIFT;
7f92891778dff6 Alexey Kardashevskiy 2018-12-20 124 unsigned long vm_pgoff = vma->vm_pgoff &
7f92891778dff6 Alexey Kardashevskiy 2018-12-20 125 ((1U << (VFIO_PCI_OFFSET_SHIFT - PAGE_SHIFT)) - 1);
7f92891778dff6 Alexey Kardashevskiy 2018-12-20 126 unsigned long pfn = nv2pg + vm_pgoff + vmf_off;
7f92891778dff6 Alexey Kardashevskiy 2018-12-20 127
7f92891778dff6 Alexey Kardashevskiy 2018-12-20 128 ret = vmf_insert_pfn(vma, vmf->address, pfn);
7f92891778dff6 Alexey Kardashevskiy 2018-12-20 129 trace_vfio_pci_nvgpu_mmap_fault(data->gpdev, pfn << PAGE_SHIFT,
7f92891778dff6 Alexey Kardashevskiy 2018-12-20 130 vmf->address, ret);
7f92891778dff6 Alexey Kardashevskiy 2018-12-20 131
7f92891778dff6 Alexey Kardashevskiy 2018-12-20 132 return ret;
7f92891778dff6 Alexey Kardashevskiy 2018-12-20 133 }
7f92891778dff6 Alexey Kardashevskiy 2018-12-20 134
7f92891778dff6 Alexey Kardashevskiy 2018-12-20 135 static const struct vm_operations_struct vfio_pci_nvgpu_mmap_vmops = {
7f92891778dff6 Alexey Kardashevskiy 2018-12-20 136 .fault = vfio_pci_nvgpu_mmap_fault,
7f92891778dff6 Alexey Kardashevskiy 2018-12-20 137 };
7f92891778dff6 Alexey Kardashevskiy 2018-12-20 138
7f92891778dff6 Alexey Kardashevskiy 2018-12-20 139 static int vfio_pci_nvgpu_mmap(struct vfio_pci_device *vdev,
7f92891778dff6 Alexey Kardashevskiy 2018-12-20 140 struct vfio_pci_region *region, struct vm_area_struct *vma)
7f92891778dff6 Alexey Kardashevskiy 2018-12-20 141 {
7f92891778dff6 Alexey Kardashevskiy 2018-12-20 142 int ret;
7f92891778dff6 Alexey Kardashevskiy 2018-12-20 143 struct vfio_pci_nvgpu_data *data = region->data;
7f92891778dff6 Alexey Kardashevskiy 2018-12-20 144
7f92891778dff6 Alexey Kardashevskiy 2018-12-20 145 if (data->useraddr)
7f92891778dff6 Alexey Kardashevskiy 2018-12-20 146 return -EPERM;
7f92891778dff6 Alexey Kardashevskiy 2018-12-20 147
7f92891778dff6 Alexey Kardashevskiy 2018-12-20 148 if (vma->vm_end - vma->vm_start > data->size)
7f92891778dff6 Alexey Kardashevskiy 2018-12-20 149 return -EINVAL;
7f92891778dff6 Alexey Kardashevskiy 2018-12-20 150
7f92891778dff6 Alexey Kardashevskiy 2018-12-20 151 vma->vm_private_data = region;
7f92891778dff6 Alexey Kardashevskiy 2018-12-20 152 vma->vm_flags |= VM_PFNMAP;
7f92891778dff6 Alexey Kardashevskiy 2018-12-20 153 vma->vm_ops = &vfio_pci_nvgpu_mmap_vmops;
7f92891778dff6 Alexey Kardashevskiy 2018-12-20 154
7f92891778dff6 Alexey Kardashevskiy 2018-12-20 155 /*
7f92891778dff6 Alexey Kardashevskiy 2018-12-20 156 * Calling mm_iommu_newdev() here once as the region is not
7f92891778dff6 Alexey Kardashevskiy 2018-12-20 157 * registered yet and therefore right initialization will happen now.
7f92891778dff6 Alexey Kardashevskiy 2018-12-20 158 * Other places will use mm_iommu_find() which returns
7f92891778dff6 Alexey Kardashevskiy 2018-12-20 159 * registered @mem and does not go gup().
7f92891778dff6 Alexey Kardashevskiy 2018-12-20 160 */
7f92891778dff6 Alexey Kardashevskiy 2018-12-20 161 data->useraddr = vma->vm_start;
7f92891778dff6 Alexey Kardashevskiy 2018-12-20 162 data->mm = current->mm;
7f92891778dff6 Alexey Kardashevskiy 2018-12-20 163
bb3d3cf928d4cc Julia Lawall 2019-12-29 164 mmgrab(data->mm);
7f92891778dff6 Alexey Kardashevskiy 2018-12-20 @165 ret = (int) mm_iommu_newdev(data->mm, data->useraddr,
e66e02c4d96d33 Peng Hao 2019-07-02 166 vma_pages(vma), data->gpu_hpa, &data->mem);
7f92891778dff6 Alexey Kardashevskiy 2018-12-20 167
7f92891778dff6 Alexey Kardashevskiy 2018-12-20 168 trace_vfio_pci_nvgpu_mmap(vdev->pdev, data->gpu_hpa, data->useraddr,
7f92891778dff6 Alexey Kardashevskiy 2018-12-20 169 vma->vm_end - vma->vm_start, ret);
7f92891778dff6 Alexey Kardashevskiy 2018-12-20 170
7f92891778dff6 Alexey Kardashevskiy 2018-12-20 171 return ret;
7f92891778dff6 Alexey Kardashevskiy 2018-12-20 172 }
7f92891778dff6 Alexey Kardashevskiy 2018-12-20 173
:::::: The code at line 101 was first introduced by commit
:::::: 7f92891778dff62303c070ac81de7b7d80de331a vfio_pci: Add NVIDIA GV100GL [Tesla V100 SXM2] subdriver
:::::: TO: Alexey Kardashevskiy <aik@xxxxxxxxx>
:::::: CC: Michael Ellerman <mpe@xxxxxxxxxxxxxx>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx
Attachment:
.config.gz
Description: application/gzip