drivers/gpu/drm/ttm/ttm_bo_util.c:465:28: sparse: sparse: incorrect type in argument 1 (different address spaces)

kernel test robot <[email protected]>
Newsgroups dev.linux.lists.oe-kbuild-all,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
Hi Julian,

First bad commit (maybe != root cause):

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   94515f3a7d4256a5062176b7d6ed0471938cd51a
commit: df75430515c33ece3de46562f917acd9792505ad drm: fix dead default for DRM_TTM_KUNIT_TEST
date:   4 months ago
config: mips-randconfig-r122-20260718 (https://download.01.org/0day-ci/archive/20260718/[email protected]/config)
compiler: clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18)
sparse: v0.6.5-rc1
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260718/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Fixes: df75430515c3 ("drm: fix dead default for DRM_TTM_KUNIT_TEST")
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

sparse warnings: (new ones prefixed by >>)
   drivers/gpu/drm/ttm/ttm_bo_util.c:329:38: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected void *virtual @@     got void [noderef] __iomem * @@
   drivers/gpu/drm/ttm/ttm_bo_util.c:329:38: sparse:     expected void *virtual
   drivers/gpu/drm/ttm/ttm_bo_util.c:329:38: sparse:     got void [noderef] __iomem *
   drivers/gpu/drm/ttm/ttm_bo_util.c:335:38: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected void *virtual @@     got void [noderef] __iomem * @@
   drivers/gpu/drm/ttm/ttm_bo_util.c:335:38: sparse:     expected void *virtual
   drivers/gpu/drm/ttm/ttm_bo_util.c:335:38: sparse:     got void [noderef] __iomem *
>> drivers/gpu/drm/ttm/ttm_bo_util.c:465:28: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const volatile [noderef] __iomem *addr @@     got void *virtual @@
   drivers/gpu/drm/ttm/ttm_bo_util.c:465:28: sparse:     expected void const volatile [noderef] __iomem *addr
   drivers/gpu/drm/ttm/ttm_bo_util.c:465:28: sparse:     got void *virtual

vim +465 drivers/gpu/drm/ttm/ttm_bo_util.c

ba4e7d973dd09b Thomas Hellstrom 2009-06-10  451  
a3185f91d0579b Christian König  2022-05-09  452  /**
a3185f91d0579b Christian König  2022-05-09  453   * ttm_bo_kunmap
a3185f91d0579b Christian König  2022-05-09  454   *
a3185f91d0579b Christian König  2022-05-09  455   * @map: Object describing the map to unmap.
a3185f91d0579b Christian König  2022-05-09  456   *
a3185f91d0579b Christian König  2022-05-09  457   * Unmaps a kernel map set up by ttm_bo_kmap.
a3185f91d0579b Christian König  2022-05-09  458   */
ba4e7d973dd09b Thomas Hellstrom 2009-06-10  459  void ttm_bo_kunmap(struct ttm_bo_kmap_obj *map)
ba4e7d973dd09b Thomas Hellstrom 2009-06-10  460  {
ba4e7d973dd09b Thomas Hellstrom 2009-06-10  461  	if (!map->virtual)
ba4e7d973dd09b Thomas Hellstrom 2009-06-10  462  		return;
ba4e7d973dd09b Thomas Hellstrom 2009-06-10  463  	switch (map->bo_kmap_type) {
ba4e7d973dd09b Thomas Hellstrom 2009-06-10  464  	case ttm_bo_map_iomap:
ba4e7d973dd09b Thomas Hellstrom 2009-06-10 @465  		iounmap(map->virtual);
ba4e7d973dd09b Thomas Hellstrom 2009-06-10  466  		break;
ba4e7d973dd09b Thomas Hellstrom 2009-06-10  467  	case ttm_bo_map_vmap:
ba4e7d973dd09b Thomas Hellstrom 2009-06-10  468  		vunmap(map->virtual);
ba4e7d973dd09b Thomas Hellstrom 2009-06-10  469  		break;
ba4e7d973dd09b Thomas Hellstrom 2009-06-10  470  	case ttm_bo_map_kmap:
ba4e7d973dd09b Thomas Hellstrom 2009-06-10  471  		kunmap(map->page);
ba4e7d973dd09b Thomas Hellstrom 2009-06-10  472  		break;
ba4e7d973dd09b Thomas Hellstrom 2009-06-10  473  	case ttm_bo_map_premapped:
ba4e7d973dd09b Thomas Hellstrom 2009-06-10  474  		break;
ba4e7d973dd09b Thomas Hellstrom 2009-06-10  475  	default:
ba4e7d973dd09b Thomas Hellstrom 2009-06-10  476  		BUG();
ba4e7d973dd09b Thomas Hellstrom 2009-06-10  477  	}
d3116756a710e3 Christian König  2021-04-12  478  	ttm_mem_io_free(map->bo->bdev, map->bo->resource);
ba4e7d973dd09b Thomas Hellstrom 2009-06-10  479  	map->virtual = NULL;
ba4e7d973dd09b Thomas Hellstrom 2009-06-10  480  	map->page = NULL;
ba4e7d973dd09b Thomas Hellstrom 2009-06-10  481  }
ba4e7d973dd09b Thomas Hellstrom 2009-06-10  482  EXPORT_SYMBOL(ttm_bo_kunmap);
ba4e7d973dd09b Thomas Hellstrom 2009-06-10  483  

:::::: The code at line 465 was first introduced by commit
:::::: ba4e7d973dd09b66912ac4c0856add8b0703a997 drm: Add the TTM GPU memory manager subsystem.

:::::: TO: Thomas Hellstrom <[email protected]>
:::::: CC: Dave Airlie <[email protected]>

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.