Re: [PATCH] drm/amdgpu: Implement mmap of imported dma-bufs

From: kernel test robot
Date: Fri Mar 03 2023 - 09:19:26 EST


Hi Marek,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on drm-misc/drm-misc-next]
[also build test WARNING on drm/drm-next drm-intel/for-linux-next drm-tip/drm-tip linus/master next-20230303]
[cannot apply to drm-intel/for-linux-next-fixes v6.2]
[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#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Marek-Maslanka/drm-amdgpu-Implement-mmap-of-imported-dma-bufs/20230303-191145
base: git://anongit.freedesktop.org/drm/drm-misc drm-misc-next
patch link: https://lore.kernel.org/r/20230303110951.3777850-1-mmaslanka%40chromium.org
patch subject: [PATCH] drm/amdgpu: Implement mmap of imported dma-bufs
config: sparc-allyesconfig (https://download.01.org/0day-ci/archive/20230303/202303032218.9kvEePUv-lkp@xxxxxxxxx/config)
compiler: sparc64-linux-gcc (GCC) 12.1.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/intel-lab-lkp/linux/commit/2916257baab842afa387781faf1b595b73249767
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Marek-Maslanka/drm-amdgpu-Implement-mmap-of-imported-dma-bufs/20230303-191145
git checkout 2916257baab842afa387781faf1b595b73249767
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=sparc olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=sparc SHELL=/bin/bash drivers/gpu/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Link: https://lore.kernel.org/oe-kbuild-all/202303032218.9kvEePUv-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c: In function 'amdgpu_try_dma_buf_mmap':
>> drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c:286:27: warning: variable 'bo' set but not used [-Wunused-but-set-variable]
286 | struct amdgpu_bo *bo = NULL;
| ^~
In file included from drivers/gpu/drm/amd/amdgpu/../display/dc/dc_types.h:36,
from drivers/gpu/drm/amd/amdgpu/../display/dc/dm_services_types.h:30,
from drivers/gpu/drm/amd/amdgpu/../include/dm_pp_interface.h:26,
from drivers/gpu/drm/amd/amdgpu/amdgpu.h:64,
from drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c:34:
drivers/gpu/drm/amd/amdgpu/../display/dc/dc_hdmi_types.h: At top level:
drivers/gpu/drm/amd/amdgpu/../display/dc/dc_hdmi_types.h:53:22: warning: 'dp_hdmi_dongle_signature_str' defined but not used [-Wunused-const-variable=]
53 | static const uint8_t dp_hdmi_dongle_signature_str[] = "DP-HDMI ADAPTOR";
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~


vim +/bo +286 drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c

278
279 int amdgpu_try_dma_buf_mmap(struct file *filp, struct vm_area_struct *vma)
280 {
281 struct drm_file *priv = filp->private_data;
282 struct drm_device *dev = priv->minor->dev;
283 struct amdgpu_device *adev = drm_to_adev(dev);
284 struct ttm_device *bdev = &adev->mman.bdev;
285 struct ttm_buffer_object *tbo = NULL;
> 286 struct amdgpu_bo *bo = NULL;
287 struct drm_gem_object *obj = NULL;
288 struct drm_vma_offset_node *node;
289 int ret;
290
291 if (drm_dev_is_unplugged(dev))
292 return -ENODEV;
293
294 drm_vma_offset_lock_lookup(bdev->vma_manager);
295 node = drm_vma_offset_exact_lookup_locked(bdev->vma_manager,
296 vma->vm_pgoff,
297 vma_pages(vma));
298
299 if (likely(node)) {
300 tbo = container_of(node, struct ttm_buffer_object,
301 base.vma_node);
302 tbo = ttm_bo_get_unless_zero(tbo);
303 }
304 drm_vma_offset_unlock_lookup(bdev->vma_manager);
305
306 if (!tbo)
307 return -EINVAL;
308
309 bo = ttm_to_amdgpu_bo(tbo);
310 obj = &tbo->base;
311
312 if (!obj->import_attach) {
313 ret = -EINVAL;
314 goto done;
315 }
316
317 ret = dma_buf_mmap(obj->import_attach->dmabuf, vma, 0);
318
319 done:
320 ttm_bo_put(tbo);
321 return ret;
322 }
323

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