Re: drivers/vfio/pci/vfio_pci_nvlink2.c:101:10: error: implicit declaration of function 'mm_iommu_put'

From: Jason Gunthorpe
Date: Sun Mar 28 2021 - 16:05:38 EST


On Sun, Mar 28, 2021 at 03:06:40AM +0800, kernel test robot wrote:
> 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: 11 days ago
> config: powerpc64-randconfig-r031-20210328 (attached as .config)
> compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project d50fe9f0d6b9ee61df8830a67ea0a33c27a637e7)
> 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
> # install powerpc64 cross compiling tool for clang build
> # apt-get install binutils-powerpc64-linux-gnu
> # 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=clang 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:101:10: error: implicit declaration of function 'mm_iommu_put' [-Werror,-Wimplicit-function-declaration]
> ret = mm_iommu_put(data->mm, data->mem);
> ^
> drivers/vfio/pci/vfio_pci_nvlink2.c:101:10: note: did you mean 'mm_iommu_init'?
> arch/powerpc/include/asm/mmu_context.h:57:20: note: 'mm_iommu_init' declared here
> static inline void mm_iommu_init(struct mm_struct *mm) { }
> ^
> >> drivers/vfio/pci/vfio_pci_nvlink2.c:165:14: error: implicit declaration of function 'mm_iommu_newdev' [-Werror,-Wimplicit-function-declaration]
> ret = (int) mm_iommu_newdev(data->mm, data->useraddr,
> ^
> 2 errors generated.

This is because of a missing CONFIG_SPAPR_TCE_IOMMU combined
incomplete function stubbing in arch/powerpc/include/asm/mmu_context.h

I'll send a patch to 'add && SPAPR_TCE_IOMMU' to 'config VFIO_PCI_NVLINK2'

(it is interesting we are seeing these now as these patches sat on my
github which is linked to 0-day too for quite a long time)

Jason