[PATCH] drm/ttm: ioremap buffer according to TTM mem caching setting

kernel test robot lkp at intel.com
Thu Mar 4 19:04:10 UTC 2021


Hi Oak,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on drm-intel/for-linux-next]
[also build test ERROR on drm-tip/drm-tip linus/master v5.12-rc1 next-20210304]
[cannot apply to tegra-drm/drm/tegra/for-next drm-exynos/exynos-drm-next drm/drm-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/Oak-Zeng/drm-ttm-ioremap-buffer-according-to-TTM-mem-caching-setting/20210305-000626
base:   git://anongit.freedesktop.org/drm-intel for-linux-next
config: arm64-randconfig-r021-20210304 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project eec7f8f7b1226be422a76542cb403d02538f453a)
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
        # install arm64 cross compiling tool for clang build
        # apt-get install binutils-aarch64-linux-gnu
        # https://github.com/0day-ci/linux/commit/e89ba86e56d95eb097cacfac83b667a92acbf56b
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Oak-Zeng/drm-ttm-ioremap-buffer-according-to-TTM-mem-caching-setting/20210305-000626
        git checkout e89ba86e56d95eb097cacfac83b667a92acbf56b
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp at intel.com>

All errors (new ones prefixed by >>):

>> drivers/gpu/drm/ttm/ttm_bo_util.c:508:3: error: expected expression
                   else
                   ^
   1 error generated.


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

ba4e7d973dd09b66 Thomas Hellstrom  2009-06-10  485  
43676605f890b218 Thomas Zimmermann 2020-11-03  486  int ttm_bo_vmap(struct ttm_buffer_object *bo, struct dma_buf_map *map)
43676605f890b218 Thomas Zimmermann 2020-11-03  487  {
43676605f890b218 Thomas Zimmermann 2020-11-03  488  	struct ttm_resource *mem = &bo->mem;
43676605f890b218 Thomas Zimmermann 2020-11-03  489  	int ret;
43676605f890b218 Thomas Zimmermann 2020-11-03  490  
43676605f890b218 Thomas Zimmermann 2020-11-03  491  	ret = ttm_mem_io_reserve(bo->bdev, mem);
43676605f890b218 Thomas Zimmermann 2020-11-03  492  	if (ret)
43676605f890b218 Thomas Zimmermann 2020-11-03  493  		return ret;
43676605f890b218 Thomas Zimmermann 2020-11-03  494  
43676605f890b218 Thomas Zimmermann 2020-11-03  495  	if (mem->bus.is_iomem) {
43676605f890b218 Thomas Zimmermann 2020-11-03  496  		void __iomem *vaddr_iomem;
43676605f890b218 Thomas Zimmermann 2020-11-03  497  
43676605f890b218 Thomas Zimmermann 2020-11-03  498  		if (mem->bus.addr)
43676605f890b218 Thomas Zimmermann 2020-11-03  499  			vaddr_iomem = (void __iomem *)mem->bus.addr;
43676605f890b218 Thomas Zimmermann 2020-11-03  500  		else if (mem->bus.caching == ttm_write_combined)
e11bfb99d6ece23b Christian König   2020-12-09  501  			vaddr_iomem = ioremap_wc(mem->bus.offset,
e11bfb99d6ece23b Christian König   2020-12-09  502  						 bo->base.size);
e89ba86e56d95eb0 Oak Zeng          2021-03-04  503  		else if (mem->bus.caching == ttm_cached)
e89ba86e56d95eb0 Oak Zeng          2021-03-04  504  #ifdef CONFIG_X86
e89ba86e56d95eb0 Oak Zeng          2021-03-04  505  			vaddr_iomem = ioremap_cache(mem->bus.offset,
e89ba86e56d95eb0 Oak Zeng          2021-03-04  506  						  bo->base.size);
e89ba86e56d95eb0 Oak Zeng          2021-03-04  507  #endif
43676605f890b218 Thomas Zimmermann 2020-11-03 @508  		else
e11bfb99d6ece23b Christian König   2020-12-09  509  			vaddr_iomem = ioremap(mem->bus.offset, bo->base.size);
43676605f890b218 Thomas Zimmermann 2020-11-03  510  
43676605f890b218 Thomas Zimmermann 2020-11-03  511  		if (!vaddr_iomem)
43676605f890b218 Thomas Zimmermann 2020-11-03  512  			return -ENOMEM;
43676605f890b218 Thomas Zimmermann 2020-11-03  513  
43676605f890b218 Thomas Zimmermann 2020-11-03  514  		dma_buf_map_set_vaddr_iomem(map, vaddr_iomem);
43676605f890b218 Thomas Zimmermann 2020-11-03  515  
43676605f890b218 Thomas Zimmermann 2020-11-03  516  	} else {
43676605f890b218 Thomas Zimmermann 2020-11-03  517  		struct ttm_operation_ctx ctx = {
43676605f890b218 Thomas Zimmermann 2020-11-03  518  			.interruptible = false,
43676605f890b218 Thomas Zimmermann 2020-11-03  519  			.no_wait_gpu = false
43676605f890b218 Thomas Zimmermann 2020-11-03  520  		};
43676605f890b218 Thomas Zimmermann 2020-11-03  521  		struct ttm_tt *ttm = bo->ttm;
43676605f890b218 Thomas Zimmermann 2020-11-03  522  		pgprot_t prot;
43676605f890b218 Thomas Zimmermann 2020-11-03  523  		void *vaddr;
43676605f890b218 Thomas Zimmermann 2020-11-03  524  
43676605f890b218 Thomas Zimmermann 2020-11-03  525  		ret = ttm_tt_populate(bo->bdev, ttm, &ctx);
43676605f890b218 Thomas Zimmermann 2020-11-03  526  		if (ret)
43676605f890b218 Thomas Zimmermann 2020-11-03  527  			return ret;
43676605f890b218 Thomas Zimmermann 2020-11-03  528  
43676605f890b218 Thomas Zimmermann 2020-11-03  529  		/*
43676605f890b218 Thomas Zimmermann 2020-11-03  530  		 * We need to use vmap to get the desired page protection
43676605f890b218 Thomas Zimmermann 2020-11-03  531  		 * or to make the buffer object look contiguous.
43676605f890b218 Thomas Zimmermann 2020-11-03  532  		 */
43676605f890b218 Thomas Zimmermann 2020-11-03  533  		prot = ttm_io_prot(bo, mem, PAGE_KERNEL);
e11bfb99d6ece23b Christian König   2020-12-09  534  		vaddr = vmap(ttm->pages, ttm->num_pages, 0, prot);
43676605f890b218 Thomas Zimmermann 2020-11-03  535  		if (!vaddr)
43676605f890b218 Thomas Zimmermann 2020-11-03  536  			return -ENOMEM;
43676605f890b218 Thomas Zimmermann 2020-11-03  537  
43676605f890b218 Thomas Zimmermann 2020-11-03  538  		dma_buf_map_set_vaddr(map, vaddr);
43676605f890b218 Thomas Zimmermann 2020-11-03  539  	}
43676605f890b218 Thomas Zimmermann 2020-11-03  540  
43676605f890b218 Thomas Zimmermann 2020-11-03  541  	return 0;
43676605f890b218 Thomas Zimmermann 2020-11-03  542  }
43676605f890b218 Thomas Zimmermann 2020-11-03  543  EXPORT_SYMBOL(ttm_bo_vmap);
43676605f890b218 Thomas Zimmermann 2020-11-03  544  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 32097 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/amd-gfx/attachments/20210305/3ab423f4/attachment-0001.gz>


More information about the amd-gfx mailing list