arch/powerpc/kernel/iommu.c:1055:13: sparse: sparse: function 'iommu_tce_xchg_no_kill' with external linkage has definition

From: kernel test robot
Date: Thu Nov 18 2021 - 13:36:20 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 42eb8fdac2fc5d62392dcfcf0253753e821a97b0
commit: 179209fa12709a3df8888c323b37315da2683c24 vfio: IOMMU_API should be selected
date: 8 months ago
config: powerpc64-randconfig-s032-20211118 (attached as .config)
compiler: powerpc64-linux-gcc (GCC) 11.2.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.4-dirty
# 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-11.2.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=powerpc SHELL=/bin/bash arch/powerpc/ drivers/

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


sparse warnings: (new ones prefixed by >>)
>> arch/powerpc/kernel/iommu.c:1055:13: sparse: sparse: function 'iommu_tce_xchg_no_kill' with external linkage has definition
arch/powerpc/kernel/iommu.c:1098:9: sparse: sparse: context imbalance in 'iommu_take_ownership' - different lock contexts for basic block
arch/powerpc/kernel/iommu.c:1126:9: sparse: sparse: context imbalance in 'iommu_release_ownership' - different lock contexts for basic block

vim +/iommu_tce_xchg_no_kill +1055 arch/powerpc/kernel/iommu.c

4e13c1ac6baa1d Alexey Kardashevskiy 2013-05-21 1054
35872480da47ec Alexey Kardashevskiy 2019-08-29 @1055 extern long iommu_tce_xchg_no_kill(struct mm_struct *mm,
35872480da47ec Alexey Kardashevskiy 2019-08-29 1056 struct iommu_table *tbl,
c10c21efa4bcca Alexey Kardashevskiy 2018-12-19 1057 unsigned long entry, unsigned long *hpa,
c10c21efa4bcca Alexey Kardashevskiy 2018-12-19 1058 enum dma_data_direction *direction)
4e13c1ac6baa1d Alexey Kardashevskiy 2013-05-21 1059 {
05c6cfb9dce0d1 Alexey Kardashevskiy 2015-06-05 1060 long ret;
c10c21efa4bcca Alexey Kardashevskiy 2018-12-19 1061 unsigned long size = 0;
4e13c1ac6baa1d Alexey Kardashevskiy 2013-05-21 1062
35872480da47ec Alexey Kardashevskiy 2019-08-29 1063 ret = tbl->it_ops->xchg_no_kill(tbl, entry, hpa, direction, false);
05c6cfb9dce0d1 Alexey Kardashevskiy 2015-06-05 1064 if (!ret && ((*direction == DMA_FROM_DEVICE) ||
c10c21efa4bcca Alexey Kardashevskiy 2018-12-19 1065 (*direction == DMA_BIDIRECTIONAL)) &&
c10c21efa4bcca Alexey Kardashevskiy 2018-12-19 1066 !mm_iommu_is_devmem(mm, *hpa, tbl->it_page_shift,
c10c21efa4bcca Alexey Kardashevskiy 2018-12-19 1067 &size))
05c6cfb9dce0d1 Alexey Kardashevskiy 2015-06-05 1068 SetPageDirty(pfn_to_page(*hpa >> PAGE_SHIFT));
4e13c1ac6baa1d Alexey Kardashevskiy 2013-05-21 1069
4e13c1ac6baa1d Alexey Kardashevskiy 2013-05-21 1070 return ret;
4e13c1ac6baa1d Alexey Kardashevskiy 2013-05-21 1071 }
35872480da47ec Alexey Kardashevskiy 2019-08-29 1072 EXPORT_SYMBOL_GPL(iommu_tce_xchg_no_kill);
35872480da47ec Alexey Kardashevskiy 2019-08-29 1073

:::::: The code at line 1055 was first introduced by commit
:::::: 35872480da47ec714fd9c4f2f3d2d83daf304851 powerpc/powernv/ioda: Split out TCE invalidation from TCE updates

:::::: 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