[linux-next:master 282/8423] drivers/gpu/drm/i915/gem/i915_gem_ttm.c:137:60: warning: unused parameter 'bo'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   b9011c7e671dbbf59bb753283ddfd03f0c9eb865
commit: 213d5092776345ad5d6e2efa36a6bfbe9899e8b3 [282/8423] drm/i915/ttm: Introduce a TTM i915 gem object backend
config: i386-randconfig-r021-20210816 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 44d0a99a12ec7ead4d2f5ef649ba05b40f6d463d)
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://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=213d5092776345ad5d6e2efa36a6bfbe9899e8b3
        git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
        git fetch --no-tags linux-next master
        git checkout 213d5092776345ad5d6e2efa36a6bfbe9899e8b3
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=i386 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

                                                            ^
   include/linux/pci.h:2154:69: warning: unused parameter 'dev' [-Wunused-parameter]
   static inline resource_size_t pci_iov_resource_size(struct pci_dev *dev, int resno)
                                                                       ^
   include/linux/pci.h:2154:78: warning: unused parameter 'resno' [-Wunused-parameter]
   static inline resource_size_t pci_iov_resource_size(struct pci_dev *dev, int resno)
                                                                                ^
   include/linux/pci.h:2156:61: warning: unused parameter 'dev' [-Wunused-parameter]
   static inline void pci_vf_drivers_autoprobe(struct pci_dev *dev, bool probe) { }
                                                               ^
   include/linux/pci.h:2156:71: warning: unused parameter 'probe' [-Wunused-parameter]
   static inline void pci_vf_drivers_autoprobe(struct pci_dev *dev, bool probe) { }
                                                                         ^
   In file included from drivers/gpu/drm/i915/gem/i915_gem_ttm.c:9:
   In file included from drivers/gpu/drm/i915/i915_drv.h:84:
   In file included from drivers/gpu/drm/i915/gt/intel_engine.h:17:
   In file included from drivers/gpu/drm/i915/gt/intel_gt_types.h:18:
   In file included from drivers/gpu/drm/i915/gt/uc/intel_uc.h:9:
   drivers/gpu/drm/i915/gt/uc/intel_guc.h:109:59: warning: unused parameter 'guc' [-Wunused-parameter]
   static inline u32 intel_guc_ggtt_offset(struct intel_guc *guc,
                                                             ^
   In file included from drivers/gpu/drm/i915/gem/i915_gem_ttm.c:9:
   In file included from drivers/gpu/drm/i915/i915_drv.h:84:
   In file included from drivers/gpu/drm/i915/gt/intel_engine.h:17:
   In file included from drivers/gpu/drm/i915/gt/intel_gt_types.h:18:
   In file included from drivers/gpu/drm/i915/gt/uc/intel_uc.h:10:
   drivers/gpu/drm/i915/gt/uc/intel_guc_submission.h:24:72: warning: unused parameter 'guc' [-Wunused-parameter]
   static inline bool intel_guc_submission_is_supported(struct intel_guc *guc)
                                                                          ^
   In file included from drivers/gpu/drm/i915/gem/i915_gem_ttm.c:9:
   In file included from drivers/gpu/drm/i915/i915_drv.h:101:
   drivers/gpu/drm/i915/i915_gpu_error.h:276:43: warning: unused parameter 'gt' [-Wunused-parameter]
   i915_capture_error_state(struct intel_gt *gt, intel_engine_mask_t engine_mask)
                                             ^
   drivers/gpu/drm/i915/i915_gpu_error.h:276:67: warning: unused parameter 'engine_mask' [-Wunused-parameter]
   i915_capture_error_state(struct intel_gt *gt, intel_engine_mask_t engine_mask)
                                                                     ^
   drivers/gpu/drm/i915/i915_gpu_error.h:281:50: warning: unused parameter 'i915' [-Wunused-parameter]
   i915_gpu_coredump_alloc(struct drm_i915_private *i915, gfp_t gfp)
                                                    ^
   drivers/gpu/drm/i915/i915_gpu_error.h:281:62: warning: unused parameter 'gfp' [-Wunused-parameter]
   i915_gpu_coredump_alloc(struct drm_i915_private *i915, gfp_t gfp)
                                                                ^
   drivers/gpu/drm/i915/i915_gpu_error.h:287:42: warning: unused parameter 'gt' [-Wunused-parameter]
   intel_gt_coredump_alloc(struct intel_gt *gt, gfp_t gfp)
                                            ^
   drivers/gpu/drm/i915/i915_gpu_error.h:287:52: warning: unused parameter 'gfp' [-Wunused-parameter]
   intel_gt_coredump_alloc(struct intel_gt *gt, gfp_t gfp)
                                                      ^
   drivers/gpu/drm/i915/i915_gpu_error.h:293:53: warning: unused parameter 'engine' [-Wunused-parameter]
   intel_engine_coredump_alloc(struct intel_engine_cs *engine, gfp_t gfp)
                                                       ^
   drivers/gpu/drm/i915/i915_gpu_error.h:293:67: warning: unused parameter 'gfp' [-Wunused-parameter]
   intel_engine_coredump_alloc(struct intel_engine_cs *engine, gfp_t gfp)
                                                                     ^
   drivers/gpu/drm/i915/i915_gpu_error.h:299:65: warning: unused parameter 'ee' [-Wunused-parameter]
   intel_engine_coredump_add_request(struct intel_engine_coredump *ee,
                                                                   ^
   drivers/gpu/drm/i915/i915_gpu_error.h:300:28: warning: unused parameter 'rq' [-Wunused-parameter]
                                     struct i915_request *rq,
                                                          ^
   drivers/gpu/drm/i915/i915_gpu_error.h:301:13: warning: unused parameter 'gfp' [-Wunused-parameter]
                                     gfp_t gfp)
                                           ^
   drivers/gpu/drm/i915/i915_gpu_error.h:307:61: warning: unused parameter 'ee' [-Wunused-parameter]
   intel_engine_coredump_add_vma(struct intel_engine_coredump *ee,
                                                               ^
   drivers/gpu/drm/i915/i915_gpu_error.h:308:43: warning: unused parameter 'capture' [-Wunused-parameter]
                                 struct intel_engine_capture_vma *capture,
                                                                  ^
   drivers/gpu/drm/i915/i915_gpu_error.h:309:36: warning: unused parameter 'compress' [-Wunused-parameter]
                                 struct i915_vma_compress *compress)
                                                           ^
   drivers/gpu/drm/i915/i915_gpu_error.h:314:52: warning: unused parameter 'gt' [-Wunused-parameter]
   i915_vma_capture_prepare(struct intel_gt_coredump *gt)
                                                      ^
   drivers/gpu/drm/i915/i915_gpu_error.h:320:51: warning: unused parameter 'gt' [-Wunused-parameter]
   i915_vma_capture_finish(struct intel_gt_coredump *gt,
                                                     ^
   drivers/gpu/drm/i915/i915_gpu_error.h:321:30: warning: unused parameter 'compress' [-Wunused-parameter]
                           struct i915_vma_compress *compress)
                                                     ^
   drivers/gpu/drm/i915/i915_gpu_error.h:326:50: warning: unused parameter 'error' [-Wunused-parameter]
   i915_error_state_store(struct i915_gpu_coredump *error)
                                                    ^
   drivers/gpu/drm/i915/i915_gpu_error.h:330:68: warning: unused parameter 'gpu' [-Wunused-parameter]
   static inline void i915_gpu_coredump_put(struct i915_gpu_coredump *gpu)
                                                                      ^
   drivers/gpu/drm/i915/i915_gpu_error.h:335:49: warning: unused parameter 'i915' [-Wunused-parameter]
   i915_first_error_state(struct drm_i915_private *i915)
                                                   ^
   drivers/gpu/drm/i915/i915_gpu_error.h:340:68: warning: unused parameter 'i915' [-Wunused-parameter]
   static inline void i915_reset_error_state(struct drm_i915_private *i915)
                                                                      ^
   drivers/gpu/drm/i915/i915_gpu_error.h:344:70: warning: unused parameter 'i915' [-Wunused-parameter]
   static inline void i915_disable_error_state(struct drm_i915_private *i915,
                                                                        ^
   drivers/gpu/drm/i915/i915_gpu_error.h:345:14: warning: unused parameter 'err' [-Wunused-parameter]
                                               int err)
                                                   ^
>> drivers/gpu/drm/i915/gem/i915_gem_ttm.c:137:60: warning: unused parameter 'bo' [-Wunused-parameter]
   static void i915_ttm_evict_flags(struct ttm_buffer_object *bo,
                                                              ^
>> drivers/gpu/drm/i915/gem/i915_gem_ttm.c:275:61: warning: unused parameter 'evict' [-Wunused-parameter]
   static int i915_ttm_move(struct ttm_buffer_object *bo, bool evict,
                                                               ^
>> drivers/gpu/drm/i915/gem/i915_gem_ttm.c:278:23: warning: unused parameter 'hop' [-Wunused-parameter]
                            struct ttm_place *hop)
                                              ^
>> drivers/gpu/drm/i915/gem/i915_gem_ttm.c:396:28: warning: unused parameter 'st' [-Wunused-parameter]
                                  struct sg_table *st)
                                                   ^
   1566 warnings and 1 error generated.


vim +/bo +137 drivers/gpu/drm/i915/gem/i915_gem_ttm.c

   136	
 > 137	static void i915_ttm_evict_flags(struct ttm_buffer_object *bo,
   138					 struct ttm_placement *placement)
   139	{
   140		*placement = i915_sys_placement;
   141	}
   142	
   143	static int i915_ttm_move_notify(struct ttm_buffer_object *bo)
   144	{
   145		struct drm_i915_gem_object *obj = i915_ttm_to_gem(bo);
   146		int ret;
   147	
   148		ret = i915_gem_object_unbind(obj, I915_GEM_OBJECT_UNBIND_ACTIVE);
   149		if (ret)
   150			return ret;
   151	
   152		ret = __i915_gem_object_put_pages(obj);
   153		if (ret)
   154			return ret;
   155	
   156		return 0;
   157	}
   158	
   159	static void i915_ttm_free_cached_io_st(struct drm_i915_gem_object *obj)
   160	{
   161		if (obj->ttm.cached_io_st) {
   162			sg_free_table(obj->ttm.cached_io_st);
   163			kfree(obj->ttm.cached_io_st);
   164			obj->ttm.cached_io_st = NULL;
   165		}
   166	}
   167	
   168	static void i915_ttm_purge(struct drm_i915_gem_object *obj)
   169	{
   170		struct ttm_buffer_object *bo = i915_gem_to_ttm(obj);
   171		struct ttm_operation_ctx ctx = {
   172			.interruptible = true,
   173			.no_wait_gpu = false,
   174		};
   175		struct ttm_placement place = {};
   176		int ret;
   177	
   178		if (obj->mm.madv == __I915_MADV_PURGED)
   179			return;
   180	
   181		/* TTM's purge interface. Note that we might be reentering. */
   182		ret = ttm_bo_validate(bo, &place, &ctx);
   183	
   184		if (!ret) {
   185			i915_ttm_free_cached_io_st(obj);
   186			obj->mm.madv = __I915_MADV_PURGED;
   187		}
   188	}
   189	
   190	static void i915_ttm_swap_notify(struct ttm_buffer_object *bo)
   191	{
   192		struct drm_i915_gem_object *obj = i915_ttm_to_gem(bo);
   193		int ret = i915_ttm_move_notify(bo);
   194	
   195		GEM_WARN_ON(ret);
   196		GEM_WARN_ON(obj->ttm.cached_io_st);
   197		if (!ret && obj->mm.madv != I915_MADV_WILLNEED)
   198			i915_ttm_purge(obj);
   199	}
   200	
   201	static void i915_ttm_delete_mem_notify(struct ttm_buffer_object *bo)
   202	{
   203		struct drm_i915_gem_object *obj = i915_ttm_to_gem(bo);
   204	
   205		if (likely(obj)) {
   206			/* This releases all gem object bindings to the backend. */
   207			__i915_gem_free_object(obj);
   208		}
   209	}
   210	
   211	static struct intel_memory_region *
   212	i915_ttm_region(struct ttm_device *bdev, int ttm_mem_type)
   213	{
   214		struct drm_i915_private *i915 = container_of(bdev, typeof(*i915), bdev);
   215	
   216		/* There's some room for optimization here... */
   217		GEM_BUG_ON(ttm_mem_type != I915_PL_SYSTEM &&
   218			   ttm_mem_type < I915_PL_LMEM0);
   219		if (ttm_mem_type == I915_PL_SYSTEM)
   220			return intel_memory_region_lookup(i915, INTEL_MEMORY_SYSTEM,
   221							  0);
   222	
   223		return intel_memory_region_lookup(i915, INTEL_MEMORY_LOCAL,
   224						  ttm_mem_type - I915_PL_LMEM0);
   225	}
   226	
   227	static struct sg_table *i915_ttm_tt_get_st(struct ttm_tt *ttm)
   228	{
   229		struct i915_ttm_tt *i915_tt = container_of(ttm, typeof(*i915_tt), ttm);
   230		struct scatterlist *sg;
   231		struct sg_table *st;
   232		int ret;
   233	
   234		if (i915_tt->cached_st)
   235			return i915_tt->cached_st;
   236	
   237		st = kzalloc(sizeof(*st), GFP_KERNEL);
   238		if (!st)
   239			return ERR_PTR(-ENOMEM);
   240	
   241		sg = __sg_alloc_table_from_pages
   242			(st, ttm->pages, ttm->num_pages, 0,
   243			 (unsigned long)ttm->num_pages << PAGE_SHIFT,
   244			 i915_sg_segment_size(), NULL, 0, GFP_KERNEL);
   245		if (IS_ERR(sg)) {
   246			kfree(st);
   247			return ERR_CAST(sg);
   248		}
   249	
   250		ret = dma_map_sgtable(i915_tt->dev, st, DMA_BIDIRECTIONAL, 0);
   251		if (ret) {
   252			sg_free_table(st);
   253			kfree(st);
   254			return ERR_PTR(ret);
   255		}
   256	
   257		i915_tt->cached_st = st;
   258		return st;
   259	}
   260	
   261	static struct sg_table *
   262	i915_ttm_resource_get_st(struct drm_i915_gem_object *obj,
   263				 struct ttm_resource *res)
   264	{
   265		struct ttm_buffer_object *bo = i915_gem_to_ttm(obj);
   266		struct ttm_resource_manager *man =
   267			ttm_manager_type(bo->bdev, res->mem_type);
   268	
   269		if (man->use_tt)
   270			return i915_ttm_tt_get_st(bo->ttm);
   271	
   272		return intel_region_ttm_node_to_st(obj->mm.region, res);
   273	}
   274	
 > 275	static int i915_ttm_move(struct ttm_buffer_object *bo, bool evict,
   276				 struct ttm_operation_ctx *ctx,
   277				 struct ttm_resource *dst_mem,
 > 278				 struct ttm_place *hop)
   279	{
   280		struct drm_i915_gem_object *obj = i915_ttm_to_gem(bo);
   281		struct ttm_resource_manager *dst_man =
   282			ttm_manager_type(bo->bdev, dst_mem->mem_type);
   283		struct ttm_resource_manager *src_man =
   284			ttm_manager_type(bo->bdev, bo->resource->mem_type);
   285		struct intel_memory_region *dst_reg, *src_reg;
   286		union {
   287			struct ttm_kmap_iter_tt tt;
   288			struct ttm_kmap_iter_iomap io;
   289		} _dst_iter, _src_iter;
   290		struct ttm_kmap_iter *dst_iter, *src_iter;
   291		struct sg_table *dst_st;
   292		int ret;
   293	
   294		dst_reg = i915_ttm_region(bo->bdev, dst_mem->mem_type);
   295		src_reg = i915_ttm_region(bo->bdev, bo->resource->mem_type);
   296		GEM_BUG_ON(!dst_reg || !src_reg);
   297	
   298		/* Sync for now. We could do the actual copy async. */
   299		ret = ttm_bo_wait_ctx(bo, ctx);
   300		if (ret)
   301			return ret;
   302	
   303		ret = i915_ttm_move_notify(bo);
   304		if (ret)
   305			return ret;
   306	
   307		if (obj->mm.madv != I915_MADV_WILLNEED) {
   308			i915_ttm_purge(obj);
   309			ttm_resource_free(bo, &dst_mem);
   310			return 0;
   311		}
   312	
   313		/* Populate ttm with pages if needed. Typically system memory. */
   314		if (bo->ttm && (dst_man->use_tt ||
   315				(bo->ttm->page_flags & TTM_PAGE_FLAG_SWAPPED))) {
   316			ret = ttm_tt_populate(bo->bdev, bo->ttm, ctx);
   317			if (ret)
   318				return ret;
   319		}
   320	
   321		dst_st = i915_ttm_resource_get_st(obj, dst_mem);
   322		if (IS_ERR(dst_st))
   323			return PTR_ERR(dst_st);
   324	
   325		/* If we start mapping GGTT, we can no longer use man::use_tt here. */
   326		dst_iter = dst_man->use_tt ?
   327			ttm_kmap_iter_tt_init(&_dst_iter.tt, bo->ttm) :
   328			ttm_kmap_iter_iomap_init(&_dst_iter.io, &dst_reg->iomap,
   329						 dst_st, dst_reg->region.start);
   330	
   331		src_iter = src_man->use_tt ?
   332			ttm_kmap_iter_tt_init(&_src_iter.tt, bo->ttm) :
   333			ttm_kmap_iter_iomap_init(&_src_iter.io, &src_reg->iomap,
   334						 obj->ttm.cached_io_st,
   335						 src_reg->region.start);
   336	
   337		ttm_move_memcpy(bo, dst_mem->num_pages, dst_iter, src_iter);
   338		ttm_bo_move_sync_cleanup(bo, dst_mem);
   339		i915_ttm_free_cached_io_st(obj);
   340	
   341		if (!dst_man->use_tt)
   342			obj->ttm.cached_io_st = dst_st;
   343	
   344		return 0;
   345	}
   346	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux