[PATCH] drm/ttm: cleanup BO size handling v2

kernel test robot lkp at intel.com
Wed Dec 9 18:15:19 UTC 2020


Hi "Christian,

I love your patch! Perhaps something to improve:

[auto build test WARNING on drm-tip/drm-tip]
[also build test WARNING on next-20201209]
[cannot apply to drm-exynos/exynos-drm-next drm-intel/for-linux-next tegra-drm/drm/tegra/for-next linus/master drm/drm-next v5.10-rc7]
[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/Christian-K-nig/drm-ttm-cleanup-BO-size-handling-v2/20201209-221144
base:   git://anongit.freedesktop.org/drm/drm-tip drm-tip
config: i386-allyesconfig (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce (this is a W=1 build):
        # https://github.com/0day-ci/linux/commit/d00372c14267d592b785c5d0c72ec167d48ade73
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Christian-K-nig/drm-ttm-cleanup-BO-size-handling-v2/20201209-221144
        git checkout d00372c14267d592b785c5d0c72ec167d48ade73
        # save the attached .config to linux build tree
        make W=1 ARCH=i386 

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

All warnings (new ones prefixed by >>):

   In file included from include/drm/drm_mm.h:49,
                    from include/drm/drm_vma_manager.h:26,
                    from include/drm/drm_gem.h:40,
                    from include/drm/ttm/ttm_bo_api.h:34,
                    from drivers/gpu/drm/nouveau/nouveau_drv.h:54,
                    from drivers/gpu/drm/nouveau/nouveau_display.h:5,
                    from drivers/gpu/drm/nouveau/nouveau_fbcon.h:32,
                    from drivers/gpu/drm/nouveau/nouveau_display.c:38:
   drivers/gpu/drm/nouveau/nouveau_display.c: In function 'nouveau_check_bl_size':
>> drivers/gpu/drm/nouveau/nouveau_display.c:289:16: warning: format '%lu' expects argument of type 'long unsigned int', but argument 11 has type 'size_t' {aka 'unsigned int'} [-Wformat=]
     289 |  DRM_DEBUG_KMS("offset=%u stride=%u h=%u tile_mode=0x%02x bw=%u bh=%u gob_size=%u bl_size=%llu size=%lu\n",
         |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     290 |         offset, stride, h, tile_mode, bw, bh, gob_size, bl_size,
     291 |         nvbo->bo.base.size);
         |         ~~~~~~~~~~~~~~~~~~
         |                      |
         |                      size_t {aka unsigned int}
   include/drm/drm_print.h:510:24: note: in definition of macro 'DRM_DEBUG_KMS'
     510 |  __drm_dbg(DRM_UT_KMS, fmt, ##__VA_ARGS__)
         |                        ^~~
   drivers/gpu/drm/nouveau/nouveau_display.c:289:103: note: format string is defined here
     289 |  DRM_DEBUG_KMS("offset=%u stride=%u h=%u tile_mode=0x%02x bw=%u bh=%u gob_size=%u bl_size=%llu size=%lu\n",
         |                                                                                                     ~~^
         |                                                                                                       |
         |                                                                                                       long unsigned int
         |                                                                                                     %u
   drivers/gpu/drm/nouveau/nouveau_display.c: In function 'nouveau_framebuffer_new':
   drivers/gpu/drm/nouveau/nouveau_display.c:309:15: warning: variable 'width' set but not used [-Wunused-but-set-variable]
     309 |  unsigned int width, height, i;
         |               ^~~~~

vim +289 drivers/gpu/drm/nouveau/nouveau_display.c

4f5746c863db1a9 James Jones     2020-02-10  259  
4f5746c863db1a9 James Jones     2020-02-10  260  static int
4f5746c863db1a9 James Jones     2020-02-10  261  nouveau_check_bl_size(struct nouveau_drm *drm, struct nouveau_bo *nvbo,
4f5746c863db1a9 James Jones     2020-02-10  262  		      uint32_t offset, uint32_t stride, uint32_t h,
4f5746c863db1a9 James Jones     2020-02-10  263  		      uint32_t tile_mode)
4f5746c863db1a9 James Jones     2020-02-10  264  {
4f5746c863db1a9 James Jones     2020-02-10  265  	uint32_t gob_size, bw, bh;
4f5746c863db1a9 James Jones     2020-02-10  266  	uint64_t bl_size;
4f5746c863db1a9 James Jones     2020-02-10  267  
4f5746c863db1a9 James Jones     2020-02-10  268  	BUG_ON(drm->client.device.info.family < NV_DEVICE_INFO_V0_TESLA);
4f5746c863db1a9 James Jones     2020-02-10  269  
4f5746c863db1a9 James Jones     2020-02-10  270  	if (drm->client.device.info.chipset >= 0xc0) {
4f5746c863db1a9 James Jones     2020-02-10  271  		if (tile_mode & 0xF)
4f5746c863db1a9 James Jones     2020-02-10  272  			return -EINVAL;
4f5746c863db1a9 James Jones     2020-02-10  273  		tile_mode >>= 4;
4f5746c863db1a9 James Jones     2020-02-10  274  	}
4f5746c863db1a9 James Jones     2020-02-10  275  
4f5746c863db1a9 James Jones     2020-02-10  276  	if (tile_mode & 0xFFFFFFF0)
4f5746c863db1a9 James Jones     2020-02-10  277  		return -EINVAL;
4f5746c863db1a9 James Jones     2020-02-10  278  
4f5746c863db1a9 James Jones     2020-02-10  279  	if (drm->client.device.info.family < NV_DEVICE_INFO_V0_FERMI)
4f5746c863db1a9 James Jones     2020-02-10  280  		gob_size = 256;
4f5746c863db1a9 James Jones     2020-02-10  281  	else
4f5746c863db1a9 James Jones     2020-02-10  282  		gob_size = 512;
4f5746c863db1a9 James Jones     2020-02-10  283  
4f5746c863db1a9 James Jones     2020-02-10  284  	bw = nouveau_get_width_in_blocks(stride);
4f5746c863db1a9 James Jones     2020-02-10  285  	bh = nouveau_get_height_in_blocks(drm, h, tile_mode);
4f5746c863db1a9 James Jones     2020-02-10  286  
4f5746c863db1a9 James Jones     2020-02-10  287  	bl_size = bw * bh * (1 << tile_mode) * gob_size;
4f5746c863db1a9 James Jones     2020-02-10  288  
4f5746c863db1a9 James Jones     2020-02-10 @289  	DRM_DEBUG_KMS("offset=%u stride=%u h=%u tile_mode=0x%02x bw=%u bh=%u gob_size=%u bl_size=%llu size=%lu\n",
4f5746c863db1a9 James Jones     2020-02-10  290  		      offset, stride, h, tile_mode, bw, bh, gob_size, bl_size,
d00372c14267d59 Christian König 2020-12-09  291  		      nvbo->bo.base.size);
4f5746c863db1a9 James Jones     2020-02-10  292  
d00372c14267d59 Christian König 2020-12-09  293  	if (bl_size + offset > nvbo->bo.base.size)
4f5746c863db1a9 James Jones     2020-02-10  294  		return -ERANGE;
4f5746c863db1a9 James Jones     2020-02-10  295  
4f5746c863db1a9 James Jones     2020-02-10  296  	return 0;
4f5746c863db1a9 James Jones     2020-02-10  297  }
4f5746c863db1a9 James Jones     2020-02-10  298  

---
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: 75950 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20201210/6aef70d1/attachment-0001.gz>


More information about the dri-devel mailing list