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

From: kernel test robot
Date: Wed Feb 03 2021 - 08:01:33 EST


Hi Chunyan,

I love your patch! Perhaps something to improve:

[auto build test WARNING on iommu/next]
[also build test WARNING on robh/for-next v5.11-rc6 next-20210125]
[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/20210203-171459
base: https://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu.git next
config: nios2-allyesconfig (attached as .config)
compiler: nios2-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://github.com/0day-ci/linux/commit/02726f17be90f0d6226117f44cef3497250e378f
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Chunyan-Zhang/Add-Unisoc-iommu-basic-driver/20210203-171459
git checkout 02726f17be90f0d6226117f44cef3497250e378f
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=nios2

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

All warnings (new ones prefixed by >>):

In file included from ./arch/nios2/include/generated/asm/bug.h:1,
from include/linux/bug.h:5,
from include/linux/thread_info.h:12,
from include/asm-generic/current.h:5,
from ./arch/nios2/include/generated/asm/current.h:1,
from include/linux/mutex.h:14,
from include/linux/notifier.h:14,
from include/linux/clk.h:14,
from drivers/iommu/sprd-iommu.c:9:
drivers/iommu/sprd-iommu.c: In function 'sprd_iommu_iova_to_phys':
>> drivers/iommu/sprd-iommu.c:375:4: warning: format '%llx' expects argument of type 'long long unsigned int', but argument 5 has type 'dma_addr_t' {aka 'unsigned int'} [-Wformat=]
375 | "iova (0x%llx) exceeds the vpn range[0x%lx-0x%lx]\n",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
376 | iova, start, end))
| ~~~~
| |
| dma_addr_t {aka unsigned int}
include/asm-generic/bug.h:89:48: note: in definition of macro '__WARN_printf'
89 | warn_slowpath_fmt(__FILE__, __LINE__, taint, arg); \
| ^~~
drivers/iommu/sprd-iommu.c:374:6: note: in expansion of macro 'WARN'
374 | if (WARN(iova < start || iova > end,
| ^~~~
drivers/iommu/sprd-iommu.c:375:16: note: format string is defined here
375 | "iova (0x%llx) exceeds the vpn range[0x%lx-0x%lx]\n",
| ~~~^
| |
| long long unsigned int
| %x
drivers/iommu/sprd-iommu.c: At top level:
drivers/iommu/sprd-iommu.c:438:20: error: initialization of 'void (*)(struct iommu_domain *, long unsigned int, size_t)' {aka 'void (*)(struct iommu_domain *, long unsigned int, unsigned int)'} from incompatible pointer type 'void (*)(struct iommu_domain *)' [-Werror=incompatible-pointer-types]
438 | .iotlb_sync_map = sprd_iommu_sync_map,
| ^~~~~~~~~~~~~~~~~~~
drivers/iommu/sprd-iommu.c:438:20: note: (near initialization for 'sprd_iommu_ops.iotlb_sync_map')
cc1: some warnings being treated as errors


vim +375 drivers/iommu/sprd-iommu.c

364
365 static phys_addr_t sprd_iommu_iova_to_phys(struct iommu_domain *domain,
366 dma_addr_t iova)
367 {
368 struct sprd_iommu_domain *dom = to_sprd_domain(domain);
369 unsigned long flags;
370 phys_addr_t pa;
371 unsigned long start = domain->geometry.aperture_start;
372 unsigned long end = domain->geometry.aperture_end;
373
374 if (WARN(iova < start || iova > end,
> 375 "iova (0x%llx) exceeds the vpn range[0x%lx-0x%lx]\n",
376 iova, start, end))
377 return 0;
378
379 spin_lock_irqsave(&dom->pgtlock, flags);
380 pa = *(dom->pgt_va + ((iova - start) >> SPRD_IOMMU_PAGE_SHIFT));
381 pa = (pa << SPRD_IOMMU_PAGE_SHIFT) + ((iova - start) & (SPRD_IOMMU_PAGE_SIZE - 1));
382 spin_unlock_irqrestore(&dom->pgtlock, flags);
383
384 return pa;
385 }
386

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

Attachment: .config.gz
Description: application/gzip