Hi Chen, FYI, the error/warning still remains. tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: ef2e9a563b0cd7965e2a1263125dcbb1c86aa6cc commit: ee8642162a9edd40daafd3fb894e3fd3f909e361 drm/nouveau: fix build error without CONFIG_IOMMU_API date: 8 months ago config: powerpc64-randconfig-r012-20200913 (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 git checkout ee8642162a9edd40daafd3fb894e3fd3f909e361 # 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 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:100:9: error: implicit declaration of function 'mm_iommu_put'; did you mean 'mm_iommu_init'? [-Werror=implicit-function-declaration] 100 | 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:163:14: error: implicit declaration of function 'mm_iommu_newdev' [-Werror=implicit-function-declaration] 163 | ret = (int) mm_iommu_newdev(data->mm, data->useraddr, | ^~~~~~~~~~~~~~~ cc1: some warnings being treated as errors # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=ee8642162a9edd40daafd3fb894e3fd3f909e361 git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git git fetch --no-tags linus master git checkout ee8642162a9edd40daafd3fb894e3fd3f909e361 vim +100 drivers/vfio/pci/vfio_pci_nvlink2.c 7f92891778dff62 Alexey Kardashevskiy 2018-12-20 91 7f92891778dff62 Alexey Kardashevskiy 2018-12-20 92 static void vfio_pci_nvgpu_release(struct vfio_pci_device *vdev, 7f92891778dff62 Alexey Kardashevskiy 2018-12-20 93 struct vfio_pci_region *region) 7f92891778dff62 Alexey Kardashevskiy 2018-12-20 94 { 7f92891778dff62 Alexey Kardashevskiy 2018-12-20 95 struct vfio_pci_nvgpu_data *data = region->data; 7f92891778dff62 Alexey Kardashevskiy 2018-12-20 96 long ret; 7f92891778dff62 Alexey Kardashevskiy 2018-12-20 97 7f92891778dff62 Alexey Kardashevskiy 2018-12-20 98 /* If there were any mappings at all... */ 7f92891778dff62 Alexey Kardashevskiy 2018-12-20 99 if (data->mm) { 7f92891778dff62 Alexey Kardashevskiy 2018-12-20 @100 ret = mm_iommu_put(data->mm, data->mem); 7f92891778dff62 Alexey Kardashevskiy 2018-12-20 101 WARN_ON(ret); 7f92891778dff62 Alexey Kardashevskiy 2018-12-20 102 7f92891778dff62 Alexey Kardashevskiy 2018-12-20 103 mmdrop(data->mm); 7f92891778dff62 Alexey Kardashevskiy 2018-12-20 104 } 7f92891778dff62 Alexey Kardashevskiy 2018-12-20 105 7f92891778dff62 Alexey Kardashevskiy 2018-12-20 106 vfio_unregister_notifier(&data->gpdev->dev, VFIO_GROUP_NOTIFY, 7f92891778dff62 Alexey Kardashevskiy 2018-12-20 107 &data->group_notifier); 7f92891778dff62 Alexey Kardashevskiy 2018-12-20 108 7f92891778dff62 Alexey Kardashevskiy 2018-12-20 109 pnv_npu2_unmap_lpar_dev(data->gpdev); 7f92891778dff62 Alexey Kardashevskiy 2018-12-20 110 7f92891778dff62 Alexey Kardashevskiy 2018-12-20 111 kfree(data); 7f92891778dff62 Alexey Kardashevskiy 2018-12-20 112 } 7f92891778dff62 Alexey Kardashevskiy 2018-12-20 113 7f92891778dff62 Alexey Kardashevskiy 2018-12-20 114 static vm_fault_t vfio_pci_nvgpu_mmap_fault(struct vm_fault *vmf) 7f92891778dff62 Alexey Kardashevskiy 2018-12-20 115 { 7f92891778dff62 Alexey Kardashevskiy 2018-12-20 116 vm_fault_t ret; 7f92891778dff62 Alexey Kardashevskiy 2018-12-20 117 struct vm_area_struct *vma = vmf->vma; 7f92891778dff62 Alexey Kardashevskiy 2018-12-20 118 struct vfio_pci_region *region = vma->vm_private_data; 7f92891778dff62 Alexey Kardashevskiy 2018-12-20 119 struct vfio_pci_nvgpu_data *data = region->data; 7f92891778dff62 Alexey Kardashevskiy 2018-12-20 120 unsigned long vmf_off = (vmf->address - vma->vm_start) >> PAGE_SHIFT; 7f92891778dff62 Alexey Kardashevskiy 2018-12-20 121 unsigned long nv2pg = data->gpu_hpa >> PAGE_SHIFT; 7f92891778dff62 Alexey Kardashevskiy 2018-12-20 122 unsigned long vm_pgoff = vma->vm_pgoff & 7f92891778dff62 Alexey Kardashevskiy 2018-12-20 123 ((1U << (VFIO_PCI_OFFSET_SHIFT - PAGE_SHIFT)) - 1); 7f92891778dff62 Alexey Kardashevskiy 2018-12-20 124 unsigned long pfn = nv2pg + vm_pgoff + vmf_off; 7f92891778dff62 Alexey Kardashevskiy 2018-12-20 125 7f92891778dff62 Alexey Kardashevskiy 2018-12-20 126 ret = vmf_insert_pfn(vma, vmf->address, pfn); 7f92891778dff62 Alexey Kardashevskiy 2018-12-20 127 trace_vfio_pci_nvgpu_mmap_fault(data->gpdev, pfn << PAGE_SHIFT, 7f92891778dff62 Alexey Kardashevskiy 2018-12-20 128 vmf->address, ret); 7f92891778dff62 Alexey Kardashevskiy 2018-12-20 129 7f92891778dff62 Alexey Kardashevskiy 2018-12-20 130 return ret; 7f92891778dff62 Alexey Kardashevskiy 2018-12-20 131 } 7f92891778dff62 Alexey Kardashevskiy 2018-12-20 132 7f92891778dff62 Alexey Kardashevskiy 2018-12-20 133 static const struct vm_operations_struct vfio_pci_nvgpu_mmap_vmops = { 7f92891778dff62 Alexey Kardashevskiy 2018-12-20 134 .fault = vfio_pci_nvgpu_mmap_fault, 7f92891778dff62 Alexey Kardashevskiy 2018-12-20 135 }; 7f92891778dff62 Alexey Kardashevskiy 2018-12-20 136 7f92891778dff62 Alexey Kardashevskiy 2018-12-20 137 static int vfio_pci_nvgpu_mmap(struct vfio_pci_device *vdev, 7f92891778dff62 Alexey Kardashevskiy 2018-12-20 138 struct vfio_pci_region *region, struct vm_area_struct *vma) 7f92891778dff62 Alexey Kardashevskiy 2018-12-20 139 { 7f92891778dff62 Alexey Kardashevskiy 2018-12-20 140 int ret; 7f92891778dff62 Alexey Kardashevskiy 2018-12-20 141 struct vfio_pci_nvgpu_data *data = region->data; 7f92891778dff62 Alexey Kardashevskiy 2018-12-20 142 7f92891778dff62 Alexey Kardashevskiy 2018-12-20 143 if (data->useraddr) 7f92891778dff62 Alexey Kardashevskiy 2018-12-20 144 return -EPERM; 7f92891778dff62 Alexey Kardashevskiy 2018-12-20 145 7f92891778dff62 Alexey Kardashevskiy 2018-12-20 146 if (vma->vm_end - vma->vm_start > data->size) 7f92891778dff62 Alexey Kardashevskiy 2018-12-20 147 return -EINVAL; 7f92891778dff62 Alexey Kardashevskiy 2018-12-20 148 7f92891778dff62 Alexey Kardashevskiy 2018-12-20 149 vma->vm_private_data = region; 7f92891778dff62 Alexey Kardashevskiy 2018-12-20 150 vma->vm_flags |= VM_PFNMAP; 7f92891778dff62 Alexey Kardashevskiy 2018-12-20 151 vma->vm_ops = &vfio_pci_nvgpu_mmap_vmops; 7f92891778dff62 Alexey Kardashevskiy 2018-12-20 152 7f92891778dff62 Alexey Kardashevskiy 2018-12-20 153 /* 7f92891778dff62 Alexey Kardashevskiy 2018-12-20 154 * Calling mm_iommu_newdev() here once as the region is not 7f92891778dff62 Alexey Kardashevskiy 2018-12-20 155 * registered yet and therefore right initialization will happen now. 7f92891778dff62 Alexey Kardashevskiy 2018-12-20 156 * Other places will use mm_iommu_find() which returns 7f92891778dff62 Alexey Kardashevskiy 2018-12-20 157 * registered @mem and does not go gup(). 7f92891778dff62 Alexey Kardashevskiy 2018-12-20 158 */ 7f92891778dff62 Alexey Kardashevskiy 2018-12-20 159 data->useraddr = vma->vm_start; 7f92891778dff62 Alexey Kardashevskiy 2018-12-20 160 data->mm = current->mm; 7f92891778dff62 Alexey Kardashevskiy 2018-12-20 161 7f92891778dff62 Alexey Kardashevskiy 2018-12-20 162 atomic_inc(&data->mm->mm_count); 7f92891778dff62 Alexey Kardashevskiy 2018-12-20 @163 ret = (int) mm_iommu_newdev(data->mm, data->useraddr, e66e02c4d96d335 Peng Hao 2019-07-02 164 vma_pages(vma), data->gpu_hpa, &data->mem); 7f92891778dff62 Alexey Kardashevskiy 2018-12-20 165 7f92891778dff62 Alexey Kardashevskiy 2018-12-20 166 trace_vfio_pci_nvgpu_mmap(vdev->pdev, data->gpu_hpa, data->useraddr, 7f92891778dff62 Alexey Kardashevskiy 2018-12-20 167 vma->vm_end - vma->vm_start, ret); 7f92891778dff62 Alexey Kardashevskiy 2018-12-20 168 7f92891778dff62 Alexey Kardashevskiy 2018-12-20 169 return ret; 7f92891778dff62 Alexey Kardashevskiy 2018-12-20 170 } 7f92891778dff62 Alexey Kardashevskiy 2018-12-20 171 :::::: The code at line 100 was first introduced by commit :::::: 7f92891778dff62303c070ac81de7b7d80de331a vfio_pci: Add NVIDIA GV100GL [Tesla V100 SXM2] subdriver :::::: TO: Alexey Kardashevskiy :::::: CC: Michael Ellerman --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org