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

From: kernel test robot
Date: Sat Nov 18 2023 - 23:46:52 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: b8f1fa2419c19c81bc386a6b350879ba54a573e1
commit: e3912d09bf8ddd8e274118d4c9cc550d9665115d drm/ttm: Introduce KUnit test
date: 3 months ago
config: nios2-randconfig-r133-20231119 (https://download.01.org/0day-ci/archive/20231119/202311191230.koBEsMLv-lkp@xxxxxxxxx/config)
compiler: nios2-linux-gcc (GCC) 13.2.0
reproduce: (https://download.01.org/0day-ci/archive/20231119/202311191230.koBEsMLv-lkp@xxxxxxxxx/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
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202311191230.koBEsMLv-lkp@xxxxxxxxx/

sparse warnings: (new ones prefixed by >>)
drivers/gpu/drm/ttm/ttm_bo_util.c:318: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:318:38: sparse: expected void *virtual
drivers/gpu/drm/ttm/ttm_bo_util.c:318:38: sparse: got void [noderef] __iomem *
drivers/gpu/drm/ttm/ttm_bo_util.c:324: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:324:38: sparse: expected void *virtual
drivers/gpu/drm/ttm/ttm_bo_util.c:324:38: sparse: got void [noderef] __iomem *
>> drivers/gpu/drm/ttm/ttm_bo_util.c:427:28: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void [noderef] __iomem *addr @@ got void *virtual @@
drivers/gpu/drm/ttm/ttm_bo_util.c:427:28: sparse: expected void [noderef] __iomem *addr
drivers/gpu/drm/ttm/ttm_bo_util.c:427:28: sparse: got void *virtual

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

ba4e7d973dd09b Thomas Hellstrom 2009-06-10 413
a3185f91d0579b Christian König 2022-05-09 414 /**
a3185f91d0579b Christian König 2022-05-09 415 * ttm_bo_kunmap
a3185f91d0579b Christian König 2022-05-09 416 *
a3185f91d0579b Christian König 2022-05-09 417 * @map: Object describing the map to unmap.
a3185f91d0579b Christian König 2022-05-09 418 *
a3185f91d0579b Christian König 2022-05-09 419 * Unmaps a kernel map set up by ttm_bo_kmap.
a3185f91d0579b Christian König 2022-05-09 420 */
ba4e7d973dd09b Thomas Hellstrom 2009-06-10 421 void ttm_bo_kunmap(struct ttm_bo_kmap_obj *map)
ba4e7d973dd09b Thomas Hellstrom 2009-06-10 422 {
ba4e7d973dd09b Thomas Hellstrom 2009-06-10 423 if (!map->virtual)
ba4e7d973dd09b Thomas Hellstrom 2009-06-10 424 return;
ba4e7d973dd09b Thomas Hellstrom 2009-06-10 425 switch (map->bo_kmap_type) {
ba4e7d973dd09b Thomas Hellstrom 2009-06-10 426 case ttm_bo_map_iomap:
ba4e7d973dd09b Thomas Hellstrom 2009-06-10 @427 iounmap(map->virtual);
ba4e7d973dd09b Thomas Hellstrom 2009-06-10 428 break;
ba4e7d973dd09b Thomas Hellstrom 2009-06-10 429 case ttm_bo_map_vmap:
ba4e7d973dd09b Thomas Hellstrom 2009-06-10 430 vunmap(map->virtual);
ba4e7d973dd09b Thomas Hellstrom 2009-06-10 431 break;
ba4e7d973dd09b Thomas Hellstrom 2009-06-10 432 case ttm_bo_map_kmap:
ba4e7d973dd09b Thomas Hellstrom 2009-06-10 433 kunmap(map->page);
ba4e7d973dd09b Thomas Hellstrom 2009-06-10 434 break;
ba4e7d973dd09b Thomas Hellstrom 2009-06-10 435 case ttm_bo_map_premapped:
ba4e7d973dd09b Thomas Hellstrom 2009-06-10 436 break;
ba4e7d973dd09b Thomas Hellstrom 2009-06-10 437 default:
ba4e7d973dd09b Thomas Hellstrom 2009-06-10 438 BUG();
ba4e7d973dd09b Thomas Hellstrom 2009-06-10 439 }
d3116756a710e3 Christian König 2021-04-12 440 ttm_mem_io_free(map->bo->bdev, map->bo->resource);
ba4e7d973dd09b Thomas Hellstrom 2009-06-10 441 map->virtual = NULL;
ba4e7d973dd09b Thomas Hellstrom 2009-06-10 442 map->page = NULL;
ba4e7d973dd09b Thomas Hellstrom 2009-06-10 443 }
ba4e7d973dd09b Thomas Hellstrom 2009-06-10 444 EXPORT_SYMBOL(ttm_bo_kunmap);
ba4e7d973dd09b Thomas Hellstrom 2009-06-10 445

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

:::::: TO: Thomas Hellstrom <thellstrom@xxxxxxxxxx>
:::::: CC: Dave Airlie <airlied@xxxxxxxxxx>

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki