Re: [PATCH v1 2/2] iommu: add Unisoc iommu basic driver

From: kernel test robot
Date: Thu Jan 21 2021 - 13:59:44 EST


Hi Chunyan,

I love your patch! Yet something to improve:

[auto build test ERROR on robh/for-next]
[also build test ERROR on v5.11-rc4 next-20210121]
[cannot apply to iommu/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/Chunyan-Zhang/Add-Unisoc-iommu-basic-driver/20210121-194023
base: https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next
config: arc-allyesconfig (attached as .config)
compiler: arceb-elf-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://github.com/0day-ci/linux/commit/891db11d7229149235a02e5bc31a61188243a5d7
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Chunyan-Zhang/Add-Unisoc-iommu-basic-driver/20210121-194023
git checkout 891db11d7229149235a02e5bc31a61188243a5d7
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arc

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/iommu/sprd-iommu.c: In function 'sprd_iommu_attach_device':
>> drivers/iommu/sprd-iommu.c:248:16: error: implicit declaration of function 'dma_alloc_coherent' [-Werror=implicit-function-declaration]
248 | dom->pgt_va = dma_alloc_coherent(sdev->dev, pgt_size, &dom->pgt_pa, GFP_KERNEL);
| ^~~~~~~~~~~~~~~~~~
drivers/iommu/sprd-iommu.c:248:14: warning: assignment to 'u32 *' {aka 'unsigned int *'} from 'int' makes pointer from integer without a cast [-Wint-conversion]
248 | dom->pgt_va = dma_alloc_coherent(sdev->dev, pgt_size, &dom->pgt_pa, GFP_KERNEL);
| ^
drivers/iommu/sprd-iommu.c: In function 'sprd_iommu_detach_device':
>> drivers/iommu/sprd-iommu.c:270:2: error: implicit declaration of function 'dma_free_coherent' [-Werror=implicit-function-declaration]
270 | dma_free_coherent(sdev->dev, pgt_size, dom->pgt_va, dom->pgt_pa);
| ^~~~~~~~~~~~~~~~~
In file included from include/linux/device.h:15,
from drivers/iommu/sprd-iommu.c:10:
drivers/iommu/sprd-iommu.c: In function 'sprd_iommu_map':
drivers/iommu/sprd-iommu.c:296:27: warning: format '%lx' expects argument of type 'long unsigned int', but argument 4 has type 'size_t' {aka 'unsigned int'} [-Wformat=]
296 | dev_err(dom->sdev->dev, "(iova(0x%lx) + sixe(0x%lx)) are not in the range!\n",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/dev_printk.h:19:22: note: in definition of macro 'dev_fmt'
19 | #define dev_fmt(fmt) fmt
| ^~~
drivers/iommu/sprd-iommu.c:296:3: note: in expansion of macro 'dev_err'
296 | dev_err(dom->sdev->dev, "(iova(0x%lx) + sixe(0x%lx)) are not in the range!\n",
| ^~~~~~~
drivers/iommu/sprd-iommu.c:296:52: note: format string is defined here
296 | dev_err(dom->sdev->dev, "(iova(0x%lx) + sixe(0x%lx)) are not in the range!\n",
| ~~^
| |
| long unsigned int
| %x
drivers/iommu/sprd-iommu.c:279:38: warning: variable 'mdata' set but not used [-Wunused-but-set-variable]
279 | const struct sprd_iommu_match_data *mdata;
| ^~~~~
drivers/iommu/sprd-iommu.c: In function 'sprd_iommu_probe':
drivers/iommu/sprd-iommu.c:483:21: warning: assignment to 'u32 *' {aka 'unsigned int *'} from 'int' makes pointer from integer without a cast [-Wint-conversion]
483 | sdev->prot_page_va = dma_alloc_coherent(dev, SPRD_IOMMU_PAGE_SIZE,
| ^
cc1: some warnings being treated as errors


vim +/dma_alloc_coherent +248 drivers/iommu/sprd-iommu.c

240
241 static int sprd_iommu_attach_device(struct iommu_domain *domain,
242 struct device *dev)
243 {
244 struct sprd_iommu_device *sdev = dev_iommu_priv_get(dev);
245 struct sprd_iommu_domain *dom = to_sprd_domain(domain);
246 size_t pgt_size = sprd_iommu_pgt_size(domain);
247
> 248 dom->pgt_va = dma_alloc_coherent(sdev->dev, pgt_size, &dom->pgt_pa, GFP_KERNEL);
249 if (!dom->pgt_va)
250 return -ENOMEM;
251
252 dom->sdev = sdev;
253
254 sprd_iommu_first_ppn(dom);
255 sprd_iommu_first_vpn(dom);
256 sprd_iommu_vpn_range(dom);
257 sprd_iommu_default_ppn(sdev);
258 sprd_iommu_hw_en(sdev, true);
259
260 return 0;
261 }
262
263 static void sprd_iommu_detach_device(struct iommu_domain *domain,
264 struct device *dev)
265 {
266 struct sprd_iommu_domain *dom = to_sprd_domain(domain);
267 struct sprd_iommu_device *sdev = dom->sdev;
268 size_t pgt_size = sprd_iommu_pgt_size(domain);
269
> 270 dma_free_coherent(sdev->dev, pgt_size, dom->pgt_va, dom->pgt_pa);
271 sprd_iommu_hw_en(sdev, false);
272 dom->sdev = NULL;
273 }
274

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

Attachment: .config.gz
Description: application/gzip