[radeon-alex:amd-mainline-dkms-5.0 3711/3724] drivers/gpu/drm/ttm/ttm_bo_vm.c:137:44: error: 'struct vm_fault' has no member named 'virtual_address'

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

 



tree:   git://people.freedesktop.org/~agd5f/linux.git amd-mainline-dkms-5.0
head:   a51a5ad4b8daf0dd0a437d51a19c2baa98953675
commit: 5165cd1453625e59650a1ed9b0f269b41529e421 [3711/3724] Revert "Revert "drm/amd/autoconf: Test whether vm_fault->{address/vma} is available""
config: x86_64-allyesconfig (attached as .config)
compiler: gcc-7 (Debian 7.4.0-13) 7.4.0
reproduce:
        git checkout 5165cd1453625e59650a1ed9b0f269b41529e421
        # save the attached .config to linux build tree
        make ARCH=x86_64 

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

All errors (new ones prefixed by >>):

                    from <command-line>:0:
   include/linux/sched/mm.h:234:20: note: previous definition of 'memalloc_nofs_restore' was here
    static inline void memalloc_nofs_restore(unsigned int flags)
                       ^~~~~~~~~~~~~~~~~~~~~
   In file included from drivers/gpu/drm/ttm/backport/backport.h:11:0,
                    from <command-line>:0:
   include/kcl/kcl_mm.h:61:21: error: redefinition of 'kvmalloc'
    static inline void *kvmalloc(size_t size, gfp_t flags)
                        ^~~~~~~~
   In file included from include/linux/scatterlist.h:8:0,
                    from include/linux/dma-mapping.h:11,
                    from include/drm/drmP.h:37,
                    from include/kcl/kcl_drm.h:6,
                    from drivers/gpu/drm/ttm/backport/backport.h:6,
                    from <command-line>:0:
   include/linux/mm.h:602:21: note: previous definition of 'kvmalloc' was here
    static inline void *kvmalloc(size_t size, gfp_t flags)
                        ^~~~~~~~
   In file included from drivers/gpu/drm/ttm/backport/backport.h:11:0,
                    from <command-line>:0:
   include/kcl/kcl_mm.h:71:21: error: redefinition of 'kvzalloc'
    static inline void *kvzalloc(size_t size, gfp_t flags)
                        ^~~~~~~~
   In file included from include/linux/scatterlist.h:8:0,
                    from include/linux/dma-mapping.h:11,
                    from include/drm/drmP.h:37,
                    from include/kcl/kcl_drm.h:6,
                    from drivers/gpu/drm/ttm/backport/backport.h:6,
                    from <command-line>:0:
   include/linux/mm.h:610:21: note: previous definition of 'kvzalloc' was here
    static inline void *kvzalloc(size_t size, gfp_t flags)
                        ^~~~~~~~
   In file included from drivers/gpu/drm/ttm/backport/backport.h:11:0,
                    from <command-line>:0:
   include/kcl/kcl_mm.h:81:20: error: static declaration of 'kvfree' follows non-static declaration
    static inline void kvfree(const void *addr)
                       ^~~~~~
   In file included from include/linux/scatterlist.h:8:0,
                    from include/linux/dma-mapping.h:11,
                    from include/drm/drmP.h:37,
                    from include/kcl/kcl_drm.h:6,
                    from drivers/gpu/drm/ttm/backport/backport.h:6,
                    from <command-line>:0:
   include/linux/mm.h:630:13: note: previous declaration of 'kvfree' was here
    extern void kvfree(const void *addr);
                ^~~~~~
   In file included from drivers/gpu/drm/ttm/backport/backport.h:11:0,
                    from <command-line>:0:
   include/kcl/kcl_mm.h:101:21: error: redefinition of 'kvmalloc_array'
    static inline void *kvmalloc_array(size_t n, size_t size, gfp_t flags)
                        ^~~~~~~~~~~~~~
   In file included from include/linux/scatterlist.h:8:0,
                    from include/linux/dma-mapping.h:11,
                    from include/drm/drmP.h:37,
                    from include/kcl/kcl_drm.h:6,
                    from drivers/gpu/drm/ttm/backport/backport.h:6,
                    from <command-line>:0:
   include/linux/mm.h:615:21: note: previous definition of 'kvmalloc_array' was here
    static inline void *kvmalloc_array(size_t n, size_t size, gfp_t flags)
                        ^~~~~~~~~~~~~~
   In file included from drivers/gpu/drm/ttm/backport/backport.h:11:0,
                    from <command-line>:0:
   include/kcl/kcl_mm.h:114:21: error: redefinition of 'kvcalloc'
    static inline void *kvcalloc(size_t n, size_t size, gfp_t flags)
                        ^~~~~~~~
   In file included from include/linux/scatterlist.h:8:0,
                    from include/linux/dma-mapping.h:11,
                    from include/drm/drmP.h:37,
                    from include/kcl/kcl_drm.h:6,
                    from drivers/gpu/drm/ttm/backport/backport.h:6,
                    from <command-line>:0:
   include/linux/mm.h:625:21: note: previous definition of 'kvcalloc' was here
    static inline void *kvcalloc(size_t n, size_t size, gfp_t flags)
                        ^~~~~~~~
   In file included from drivers/gpu/drm/ttm/backport/backport.h:11:0,
                    from <command-line>:0:
   include/kcl/kcl_mm.h:121:20: error: redefinition of 'mmgrab'
    static inline void mmgrab(struct mm_struct *mm)
                       ^~~~~~
   In file included from include/kcl/kcl_mm.h:6:0,
                    from drivers/gpu/drm/ttm/backport/backport.h:11,
                    from <command-line>:0:
   include/linux/sched/mm.h:34:20: note: previous definition of 'mmgrab' was here
    static inline void mmgrab(struct mm_struct *mm)
                       ^~~~~~
   In file included from drivers/gpu/drm/ttm/backport/backport.h:12:0,
                    from <command-line>:0:
   include/kcl/kcl_list.h:6:20: error: redefinition of 'list_bulk_move_tail'
    static inline void list_bulk_move_tail(struct list_head *head,
                       ^~~~~~~~~~~~~~~~~~~
   In file included from include/linux/preempt.h:11:0,
                    from include/linux/rcupdate.h:40,
                    from include/kcl/kcl_rcupdate.h:4,
                    from include/kcl/kcl_fence.h:5,
                    from drivers/gpu/drm/ttm/backport/backport.h:5,
                    from <command-line>:0:
   include/linux/list.h:195:20: note: previous definition of 'list_bulk_move_tail' was here
    static inline void list_bulk_move_tail(struct list_head *head,
                       ^~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/ttm/ttm_bo_vm.c: In function 'ttm_bo_vm_fault':
>> drivers/gpu/drm/ttm/ttm_bo_vm.c:137:44: error: 'struct vm_fault' has no member named 'virtual_address'
     unsigned long address = (unsigned long)vmf->virtual_address;
                                               ^~
   cc1: some warnings being treated as errors

vim +137 drivers/gpu/drm/ttm/ttm_bo_vm.c

cbe12e74ee4e29 Thomas Hellstrom    2013-10-09  104  
c67fa6edc8b11a Tan Xiaojun         2017-12-25  105  static unsigned long ttm_bo_io_mem_pfn(struct ttm_buffer_object *bo,
c67fa6edc8b11a Tan Xiaojun         2017-12-25  106  				       unsigned long page_offset)
c67fa6edc8b11a Tan Xiaojun         2017-12-25  107  {
c67fa6edc8b11a Tan Xiaojun         2017-12-25  108  	struct ttm_bo_device *bdev = bo->bdev;
c67fa6edc8b11a Tan Xiaojun         2017-12-25  109  
c67fa6edc8b11a Tan Xiaojun         2017-12-25  110  	if (bdev->driver->io_mem_pfn)
c67fa6edc8b11a Tan Xiaojun         2017-12-25  111  		return bdev->driver->io_mem_pfn(bo, page_offset);
c67fa6edc8b11a Tan Xiaojun         2017-12-25  112  
e83bf4adf54ad3 Tan Xiaojun         2017-12-25  113  	return ((bo->mem.bus.base + bo->mem.bus.offset) >> PAGE_SHIFT)
e83bf4adf54ad3 Tan Xiaojun         2017-12-25  114  		+ page_offset;
c67fa6edc8b11a Tan Xiaojun         2017-12-25  115  }
d37fb8b746a5e8 Anatoli Antonovitch 2019-06-26  116  #if defined(HAVE_2ARGS_VIRTUAL_MM_FAULT_FUNCTION)
1eb7eed2b3f8a5 Evan Quan           2017-05-12  117  static vm_fault_t ttm_bo_vm_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
1eb7eed2b3f8a5 Evan Quan           2017-05-12  118  #else
4daa4fba3a3899 Souptick Joarder    2018-06-02  119  static vm_fault_t ttm_bo_vm_fault(struct vm_fault *vmf)
1eb7eed2b3f8a5 Evan Quan           2017-05-12  120  #endif
ba4e7d973dd09b Thomas Hellstrom    2009-06-10  121  {
fadbbdd244af97 Flora Cui           2019-09-06  122  #if !defined(HAVE_2ARGS_VIRTUAL_MM_FAULT_FUNCTION)
11bac80004499e Dave Jiang          2017-02-24  123  	struct vm_area_struct *vma = vmf->vma;
1eb7eed2b3f8a5 Evan Quan           2017-05-12  124  #endif
ba4e7d973dd09b Thomas Hellstrom    2009-06-10  125  	struct ttm_buffer_object *bo = (struct ttm_buffer_object *)
ba4e7d973dd09b Thomas Hellstrom    2009-06-10  126  	    vma->vm_private_data;
ba4e7d973dd09b Thomas Hellstrom    2009-06-10  127  	struct ttm_bo_device *bdev = bo->bdev;
ba4e7d973dd09b Thomas Hellstrom    2009-06-10  128  	unsigned long page_offset;
ba4e7d973dd09b Thomas Hellstrom    2009-06-10  129  	unsigned long page_last;
ba4e7d973dd09b Thomas Hellstrom    2009-06-10  130  	unsigned long pfn;
ba4e7d973dd09b Thomas Hellstrom    2009-06-10  131  	struct ttm_tt *ttm = NULL;
ba4e7d973dd09b Thomas Hellstrom    2009-06-10  132  	struct page *page;
4daa4fba3a3899 Souptick Joarder    2018-06-02  133  	int err;
ba4e7d973dd09b Thomas Hellstrom    2009-06-10  134  	int i;
4daa4fba3a3899 Souptick Joarder    2018-06-02  135  	vm_fault_t ret = VM_FAULT_NOPAGE;
5165cd1453625e Flora Cui           2019-09-11  136  #ifndef HAVE_VM_FAULT_ADDRESS_VMA
1eb7eed2b3f8a5 Evan Quan           2017-05-12 @137  	unsigned long address = (unsigned long)vmf->virtual_address;
1eb7eed2b3f8a5 Evan Quan           2017-05-12  138  #else
1a29d85eb0f19b Jan Kara            2016-12-14  139  	unsigned long address = vmf->address;
1eb7eed2b3f8a5 Evan Quan           2017-05-12  140  #endif
eba67093f53532 Thomas Hellstrom    2010-11-11  141  	struct ttm_mem_type_manager *man =
eba67093f53532 Thomas Hellstrom    2010-11-11  142  		&bdev->man[bo->mem.mem_type];
3943875e7b73fd Thomas Hellstrom    2013-11-06  143  	struct vm_area_struct cvma;
ba4e7d973dd09b Thomas Hellstrom    2009-06-10  144  
ba4e7d973dd09b Thomas Hellstrom    2009-06-10  145  	/*
ba4e7d973dd09b Thomas Hellstrom    2009-06-10  146  	 * Work around locking order reversal in fault / nopfn
ba4e7d973dd09b Thomas Hellstrom    2009-06-10  147  	 * between mmap_sem and bo_reserve: Perform a trylock operation
c58f009e01c918 Thomas Hellstrom    2013-11-14  148  	 * for reserve, and if it fails, retry the fault after waiting
c58f009e01c918 Thomas Hellstrom    2013-11-14  149  	 * for the buffer to become unreserved.
ba4e7d973dd09b Thomas Hellstrom    2009-06-10  150  	 */
1bebc270578bf8 Evan Quan           2019-02-18  151  	if (unlikely(!kcl_reservation_object_trylock(bo->resv))) {
c58f009e01c918 Thomas Hellstrom    2013-11-14  152  		if (vmf->flags & FAULT_FLAG_ALLOW_RETRY) {
e6b6346419c9f5 Chengming Gui       2019-08-28  153  #ifdef FAULT_FLAG_RETRY_NOWAIT
c58f009e01c918 Thomas Hellstrom    2013-11-14  154  			if (!(vmf->flags & FAULT_FLAG_RETRY_NOWAIT)) {
8129fdad387ae3 Thomas Zimmermann   2018-06-21  155  				ttm_bo_get(bo);
9bd71d59838222 changzhu            2018-09-30  156  				up_read(&vma->vm_mm->mmap_sem);
c58f009e01c918 Thomas Hellstrom    2013-11-14  157  				(void) ttm_bo_wait_unreserved(bo);
f44907593d746d Thomas Zimmermann   2018-06-21  158  				ttm_bo_put(bo);
c58f009e01c918 Thomas Hellstrom    2013-11-14  159  			}
1eb7eed2b3f8a5 Evan Quan           2017-05-12  160  #else
1eb7eed2b3f8a5 Evan Quan           2017-05-12  161  			up_read(&vma->vm_mm->mmap_sem);
1eb7eed2b3f8a5 Evan Quan           2017-05-12  162  #endif
c58f009e01c918 Thomas Hellstrom    2013-11-14  163  
c58f009e01c918 Thomas Hellstrom    2013-11-14  164  			return VM_FAULT_RETRY;
c58f009e01c918 Thomas Hellstrom    2013-11-14  165  		}
c58f009e01c918 Thomas Hellstrom    2013-11-14  166  
c58f009e01c918 Thomas Hellstrom    2013-11-14  167  		/*
c58f009e01c918 Thomas Hellstrom    2013-11-14  168  		 * If we'd want to change locking order to
c58f009e01c918 Thomas Hellstrom    2013-11-14  169  		 * mmap_sem -> bo::reserve, we'd use a blocking reserve here
c58f009e01c918 Thomas Hellstrom    2013-11-14  170  		 * instead of retrying the fault...
c58f009e01c918 Thomas Hellstrom    2013-11-14  171  		 */
ba4e7d973dd09b Thomas Hellstrom    2009-06-10  172  		return VM_FAULT_NOPAGE;
ba4e7d973dd09b Thomas Hellstrom    2009-06-10  173  	}
ba4e7d973dd09b Thomas Hellstrom    2009-06-10  174  
667a50db0477d4 Thomas Hellstrom    2014-01-03  175  	/*
667a50db0477d4 Thomas Hellstrom    2014-01-03  176  	 * Refuse to fault imported pages. This should be handled
667a50db0477d4 Thomas Hellstrom    2014-01-03  177  	 * (if at all) by redirecting mmap to the exporter.
667a50db0477d4 Thomas Hellstrom    2014-01-03  178  	 */
667a50db0477d4 Thomas Hellstrom    2014-01-03  179  	if (bo->ttm && (bo->ttm->page_flags & TTM_PAGE_FLAG_SG)) {
de8dfb8e3449c7 Tom St Denis        2018-01-26  180  		ret = VM_FAULT_SIGBUS;
667a50db0477d4 Thomas Hellstrom    2014-01-03  181  		goto out_unlock;
667a50db0477d4 Thomas Hellstrom    2014-01-03  182  	}
667a50db0477d4 Thomas Hellstrom    2014-01-03  183  
82c5da6bf8b55a Jerome Glisse       2010-04-09  184  	if (bdev->driver->fault_reserve_notify) {
5d50fcbda7b0ac Christian König     2019-01-11  185  		struct dma_fence *moving = dma_fence_get(bo->moving);
5d50fcbda7b0ac Christian König     2019-01-11  186  
4daa4fba3a3899 Souptick Joarder    2018-06-02  187  		err = bdev->driver->fault_reserve_notify(bo);
4daa4fba3a3899 Souptick Joarder    2018-06-02  188  		switch (err) {
82c5da6bf8b55a Jerome Glisse       2010-04-09  189  		case 0:
82c5da6bf8b55a Jerome Glisse       2010-04-09  190  			break;
82c5da6bf8b55a Jerome Glisse       2010-04-09  191  		case -EBUSY:
82c5da6bf8b55a Jerome Glisse       2010-04-09  192  		case -ERESTARTSYS:
de8dfb8e3449c7 Tom St Denis        2018-01-26  193  			ret = VM_FAULT_NOPAGE;
82c5da6bf8b55a Jerome Glisse       2010-04-09  194  			goto out_unlock;
82c5da6bf8b55a Jerome Glisse       2010-04-09  195  		default:
de8dfb8e3449c7 Tom St Denis        2018-01-26  196  			ret = VM_FAULT_SIGBUS;
82c5da6bf8b55a Jerome Glisse       2010-04-09  197  			goto out_unlock;
82c5da6bf8b55a Jerome Glisse       2010-04-09  198  		}
5d50fcbda7b0ac Christian König     2019-01-11  199  
5d50fcbda7b0ac Christian König     2019-01-11  200  		if (bo->moving != moving) {
5d50fcbda7b0ac Christian König     2019-01-11  201  			spin_lock(&bdev->glob->lru_lock);
5d50fcbda7b0ac Christian König     2019-01-11  202  			ttm_bo_move_to_lru_tail(bo, NULL);
5d50fcbda7b0ac Christian König     2019-01-11  203  			spin_unlock(&bdev->glob->lru_lock);
5d50fcbda7b0ac Christian König     2019-01-11  204  		}
5d50fcbda7b0ac Christian König     2019-01-11  205  		dma_fence_put(moving);
82c5da6bf8b55a Jerome Glisse       2010-04-09  206  	}
e024e11070a0a0 Dave Airlie         2009-06-24  207  
ba4e7d973dd09b Thomas Hellstrom    2009-06-10  208  	/*
ba4e7d973dd09b Thomas Hellstrom    2009-06-10  209  	 * Wait for buffer data in transit, due to a pipelined
ba4e7d973dd09b Thomas Hellstrom    2009-06-10  210  	 * move.
ba4e7d973dd09b Thomas Hellstrom    2009-06-10  211  	 */
1eb7eed2b3f8a5 Evan Quan           2017-05-12  212  	ret = ttm_bo_vm_fault_idle(bo, vma, vmf);
ba4e7d973dd09b Thomas Hellstrom    2009-06-10  213  	if (unlikely(ret != 0)) {
e6b6346419c9f5 Chengming Gui       2019-08-28  214  #ifdef FAULT_FLAG_RETRY_NOWAIT
de8dfb8e3449c7 Tom St Denis        2018-01-26  215  		if (ret == VM_FAULT_RETRY &&
3089c1df10e293 Nicolai Hähnle      2017-02-18  216  		    !(vmf->flags & FAULT_FLAG_RETRY_NOWAIT)) {
1eb7eed2b3f8a5 Evan Quan           2017-05-12  217  #else
1eb7eed2b3f8a5 Evan Quan           2017-05-12  218  		if (ret == VM_FAULT_RETRY) {
1eb7eed2b3f8a5 Evan Quan           2017-05-12  219  #endif
3089c1df10e293 Nicolai Hähnle      2017-02-18  220  			/* The BO has already been unreserved. */
de8dfb8e3449c7 Tom St Denis        2018-01-26  221  			return ret;
3089c1df10e293 Nicolai Hähnle      2017-02-18  222  		}
3089c1df10e293 Nicolai Hähnle      2017-02-18  223  
ba4e7d973dd09b Thomas Hellstrom    2009-06-10  224  		goto out_unlock;
ba4e7d973dd09b Thomas Hellstrom    2009-06-10  225  	}
ba4e7d973dd09b Thomas Hellstrom    2009-06-10  226  
4daa4fba3a3899 Souptick Joarder    2018-06-02  227  	err = ttm_mem_io_lock(man, true);
4daa4fba3a3899 Souptick Joarder    2018-06-02  228  	if (unlikely(err != 0)) {
de8dfb8e3449c7 Tom St Denis        2018-01-26  229  		ret = VM_FAULT_NOPAGE;
ba4e7d973dd09b Thomas Hellstrom    2009-06-10  230  		goto out_unlock;
ba4e7d973dd09b Thomas Hellstrom    2009-06-10  231  	}
4daa4fba3a3899 Souptick Joarder    2018-06-02  232  	err = ttm_mem_io_reserve_vm(bo);
4daa4fba3a3899 Souptick Joarder    2018-06-02  233  	if (unlikely(err != 0)) {
de8dfb8e3449c7 Tom St Denis        2018-01-26  234  		ret = VM_FAULT_SIGBUS;
eba67093f53532 Thomas Hellstrom    2010-11-11  235  		goto out_io_unlock;
eba67093f53532 Thomas Hellstrom    2010-11-11  236  	}
ba4e7d973dd09b Thomas Hellstrom    2009-06-10  237  
ba4e7d973dd09b Thomas Hellstrom    2009-06-10  238  	page_offset = ((address - vma->vm_start) >> PAGE_SHIFT) +
d386735588c3e2 Thomas Hellstrom    2013-12-08  239  		vma->vm_pgoff - drm_vma_node_start(&bo->vma_node);
d386735588c3e2 Thomas Hellstrom    2013-12-08  240  	page_last = vma_pages(vma) + vma->vm_pgoff -
d386735588c3e2 Thomas Hellstrom    2013-12-08  241  		drm_vma_node_start(&bo->vma_node);
ba4e7d973dd09b Thomas Hellstrom    2009-06-10  242  
ba4e7d973dd09b Thomas Hellstrom    2009-06-10  243  	if (unlikely(page_offset >= bo->num_pages)) {
de8dfb8e3449c7 Tom St Denis        2018-01-26  244  		ret = VM_FAULT_SIGBUS;
eba67093f53532 Thomas Hellstrom    2010-11-11  245  		goto out_io_unlock;
ba4e7d973dd09b Thomas Hellstrom    2009-06-10  246  	}
ba4e7d973dd09b Thomas Hellstrom    2009-06-10  247  
ba4e7d973dd09b Thomas Hellstrom    2009-06-10  248  	/*
3943875e7b73fd Thomas Hellstrom    2013-11-06  249  	 * Make a local vma copy to modify the page_prot member
3943875e7b73fd Thomas Hellstrom    2013-11-06  250  	 * and vm_flags if necessary. The vma parameter is protected
3943875e7b73fd Thomas Hellstrom    2013-11-06  251  	 * by mmap_sem in write mode.
ba4e7d973dd09b Thomas Hellstrom    2009-06-10  252  	 */
3943875e7b73fd Thomas Hellstrom    2013-11-06  253  	cvma = *vma;
3943875e7b73fd Thomas Hellstrom    2013-11-06  254  	cvma.vm_page_prot = vm_get_page_prot(cvma.vm_flags);
3943875e7b73fd Thomas Hellstrom    2013-11-06  255  
82c5da6bf8b55a Jerome Glisse       2010-04-09  256  	if (bo->mem.bus.is_iomem) {
3943875e7b73fd Thomas Hellstrom    2013-11-06  257  		cvma.vm_page_prot = ttm_io_prot(bo->mem.placement,
3943875e7b73fd Thomas Hellstrom    2013-11-06  258  						cvma.vm_page_prot);
ba4e7d973dd09b Thomas Hellstrom    2009-06-10  259  	} else {
d0cef9fa4411eb Roger He            2017-12-21  260  		struct ttm_operation_ctx ctx = {
d0cef9fa4411eb Roger He            2017-12-21  261  			.interruptible = false,
aa7662b67bf6f5 Roger He            2018-01-17  262  			.no_wait_gpu = false,
aa7662b67bf6f5 Roger He            2018-01-17  263  			.flags = TTM_OPT_FLAG_FORCE_ALLOC
aa7662b67bf6f5 Roger He            2018-01-17  264  
d0cef9fa4411eb Roger He            2017-12-21  265  		};
d0cef9fa4411eb Roger He            2017-12-21  266  
ba4e7d973dd09b Thomas Hellstrom    2009-06-10  267  		ttm = bo->ttm;
3943875e7b73fd Thomas Hellstrom    2013-11-06  268  		cvma.vm_page_prot = ttm_io_prot(bo->mem.placement,
3943875e7b73fd Thomas Hellstrom    2013-11-06  269  						cvma.vm_page_prot);
b1e5f172325547 Jerome Glisse       2011-11-02  270  
b1e5f172325547 Jerome Glisse       2011-11-02  271  		/* Allocate all page at once, most common usage */
25893a14c938d5 Christian König     2018-02-01  272  		if (ttm_tt_populate(ttm, &ctx)) {
de8dfb8e3449c7 Tom St Denis        2018-01-26  273  			ret = VM_FAULT_OOM;
b1e5f172325547 Jerome Glisse       2011-11-02  274  			goto out_io_unlock;
b1e5f172325547 Jerome Glisse       2011-11-02  275  		}
ba4e7d973dd09b Thomas Hellstrom    2009-06-10  276  	}
ba4e7d973dd09b Thomas Hellstrom    2009-06-10  277  
ba4e7d973dd09b Thomas Hellstrom    2009-06-10  278  	/*
ba4e7d973dd09b Thomas Hellstrom    2009-06-10  279  	 * Speculatively prefault a number of pages. Only error on
ba4e7d973dd09b Thomas Hellstrom    2009-06-10  280  	 * first page.
ba4e7d973dd09b Thomas Hellstrom    2009-06-10  281  	 */
ba4e7d973dd09b Thomas Hellstrom    2009-06-10  282  	for (i = 0; i < TTM_BO_VM_NUM_PREFAULT; ++i) {
95cf9264d5f36c Tom Lendacky        2017-07-17  283  		if (bo->mem.bus.is_iomem) {
18e2e6b7e2735e Anatoli Antonovitch 2019-06-28  284  #ifdef pgprot_decrypted
95cf9264d5f36c Tom Lendacky        2017-07-17  285  			/* Iomem should not be marked encrypted */
95cf9264d5f36c Tom Lendacky        2017-07-17  286  			cvma.vm_page_prot = pgprot_decrypted(cvma.vm_page_prot);
1eb7eed2b3f8a5 Evan Quan           2017-05-12  287  #endif
c67fa6edc8b11a Tan Xiaojun         2017-12-25  288  			pfn = ttm_bo_io_mem_pfn(bo, page_offset);
95cf9264d5f36c Tom Lendacky        2017-07-17  289  		} else {
b1e5f172325547 Jerome Glisse       2011-11-02  290  			page = ttm->pages[page_offset];
ba4e7d973dd09b Thomas Hellstrom    2009-06-10  291  			if (unlikely(!page && i == 0)) {
de8dfb8e3449c7 Tom St Denis        2018-01-26  292  				ret = VM_FAULT_OOM;
eba67093f53532 Thomas Hellstrom    2010-11-11  293  				goto out_io_unlock;
ba4e7d973dd09b Thomas Hellstrom    2009-06-10  294  			} else if (unlikely(!page)) {
ba4e7d973dd09b Thomas Hellstrom    2009-06-10  295  				break;
ba4e7d973dd09b Thomas Hellstrom    2009-06-10  296  			}
58aa6622d32af7 Thomas Hellstrom    2014-01-03  297  			page->index = drm_vma_node_start(&bo->vma_node) +
58aa6622d32af7 Thomas Hellstrom    2014-01-03  298  				page_offset;
ba4e7d973dd09b Thomas Hellstrom    2009-06-10  299  			pfn = page_to_pfn(page);
ba4e7d973dd09b Thomas Hellstrom    2009-06-10  300  		}
ba4e7d973dd09b Thomas Hellstrom    2009-06-10  301  
7dfe8b6187f43d Thomas Hellstrom    2014-01-03  302  		if (vma->vm_flags & VM_MIXEDMAP)
1eb7eed2b3f8a5 Evan Quan           2017-05-12  303  			ret = vmf_insert_mixed(&cvma, address,
bb02f27489fe44 Junwei Zhang        2018-08-22  304  				__pfn_to_pfn_t(pfn, PFN_DEV | (bo->ssg_can_map ? PFN_MAP : 0)));
7dfe8b6187f43d Thomas Hellstrom    2014-01-03  305  		else
4daa4fba3a3899 Souptick Joarder    2018-06-02  306  			ret = vmf_insert_pfn(&cvma, address, pfn);
ba4e7d973dd09b Thomas Hellstrom    2009-06-10  307  		/*
ba4e7d973dd09b Thomas Hellstrom    2009-06-10  308  		 * Somebody beat us to this PTE or prefaulting to
ba4e7d973dd09b Thomas Hellstrom    2009-06-10  309  		 * an already populated PTE, or prefaulting error.
ba4e7d973dd09b Thomas Hellstrom    2009-06-10  310  		 */
ba4e7d973dd09b Thomas Hellstrom    2009-06-10  311  
4daa4fba3a3899 Souptick Joarder    2018-06-02  312  		if (unlikely((ret == VM_FAULT_NOPAGE && i > 0)))
ba4e7d973dd09b Thomas Hellstrom    2009-06-10  313  			break;
4daa4fba3a3899 Souptick Joarder    2018-06-02  314  		else if (unlikely(ret & VM_FAULT_ERROR))
eba67093f53532 Thomas Hellstrom    2010-11-11  315  			goto out_io_unlock;
ba4e7d973dd09b Thomas Hellstrom    2009-06-10  316  
ba4e7d973dd09b Thomas Hellstrom    2009-06-10  317  		address += PAGE_SIZE;
ba4e7d973dd09b Thomas Hellstrom    2009-06-10  318  		if (unlikely(++page_offset >= page_last))
ba4e7d973dd09b Thomas Hellstrom    2009-06-10  319  			break;
ba4e7d973dd09b Thomas Hellstrom    2009-06-10  320  	}
de8dfb8e3449c7 Tom St Denis        2018-01-26  321  	ret = VM_FAULT_NOPAGE;
eba67093f53532 Thomas Hellstrom    2010-11-11  322  out_io_unlock:
eba67093f53532 Thomas Hellstrom    2010-11-11  323  	ttm_mem_io_unlock(man);
ba4e7d973dd09b Thomas Hellstrom    2009-06-10  324  out_unlock:
1bebc270578bf8 Evan Quan           2019-02-18  325  	kcl_reservation_object_unlock(bo->resv);
de8dfb8e3449c7 Tom St Denis        2018-01-26  326  	return ret;
ba4e7d973dd09b Thomas Hellstrom    2009-06-10  327  }
ba4e7d973dd09b Thomas Hellstrom    2009-06-10  328  

:::::: The code at line 137 was first introduced by commit
:::::: 1eb7eed2b3f8a53b8f348b415501f1ba07cc383c drm/amdkcl: [4.11] fix for uapi/linux/sched/types.h

:::::: TO: Evan Quan <evan.quan@xxxxxxx>
:::::: CC: tianci yin <tianci.yin@xxxxxxx>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

Attachment: .config.gz
Description: application/gzip

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux