Attachment '01-amdgpu_19.20_on_linux_4.19-v1.patch'

Download

   1 diff -Naur amdgpu-19.20-812932.bak/amd/amdgpu/amdgpu_mn.c amdgpu-19.20-812932/amd/amdgpu/amdgpu_mn.c
   2 --- amdgpu-19.20-812932.bak/amd/amdgpu/amdgpu_mn.c	2019-05-10 19:57:47.000000000 +0200
   3 +++ amdgpu-19.20-812932/amd/amdgpu/amdgpu_mn.c	2019-07-11 08:30:51.916515905 +0200
   4 @@ -257,7 +257,8 @@
   5  	}
   6  }
   7  
   8 -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0)
   9 +//#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0)
  10 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 0, 0)
  11  /**
  12   * amdgpu_mn_invalidate_range_start_gfx - callback to notify about mm change
  13   *
  14 @@ -365,10 +366,11 @@
  15   * Block for operations on BOs to finish and mark pages as accessed and
  16   * potentially dirty.
  17   */
  18 -static void amdgpu_mn_invalidate_range_start_gfx(struct mmu_notifier *mn,
  19 +static int amdgpu_mn_invalidate_range_start_gfx(struct mmu_notifier *mn,
  20  						 struct mm_struct *mm,
  21  						 unsigned long start,
  22 -						 unsigned long end)
  23 +						 unsigned long end,
  24 +						 bool blockable)
  25  {
  26  	struct amdgpu_mn *amn = container_of(mn, struct amdgpu_mn, mn);
  27  	struct interval_tree_node *it;
  28 @@ -376,17 +378,27 @@
  29  	/* notification is exclusive, but interval is inclusive */
  30  	end -= 1;
  31  
  32 -	amdgpu_mn_read_lock(amn);
  33 +	/* TODO we should be able to split locking for interval tree and
  34 +	 * amdgpu_mn_invalidate_node
  35 +	 */
  36 +	if (amdgpu_mn_read_lock(amn, blockable))
  37 +		return -EAGAIN;
  38  
  39  	it = interval_tree_iter_first(&amn->objects, start, end);
  40  	while (it) {
  41  		struct amdgpu_mn_node *node;
  42  
  43 +		if (!blockable) {
  44 +			amdgpu_mn_read_unlock(amn);
  45 +			return -EAGAIN;
  46 +		}
  47 +
  48  		node = container_of(it, struct amdgpu_mn_node, it);
  49  		it = interval_tree_iter_next(it, start, end);
  50  
  51  		amdgpu_mn_invalidate_node(node, start, end);
  52  	}
  53 +	return 0;
  54  }
  55  
  56  
  57 @@ -402,10 +414,11 @@
  58   * necessitates evicting all user-mode queues of the process. The BOs
  59   * are restorted in amdgpu_mn_invalidate_range_end_hsa.
  60   */
  61 -static void amdgpu_mn_invalidate_range_start_hsa(struct mmu_notifier *mn,
  62 +static int amdgpu_mn_invalidate_range_start_hsa(struct mmu_notifier *mn,
  63  						 struct mm_struct *mm,
  64  						 unsigned long start,
  65 -						 unsigned long end)
  66 +						 unsigned long end,
  67 +						 bool blockable)
  68  {
  69  	struct amdgpu_mn *amn = container_of(mn, struct amdgpu_mn, mn);
  70  	struct interval_tree_node *it;
  71 @@ -413,13 +426,19 @@
  72  	/* notification is exclusive, but interval is inclusive */
  73  	end -= 1;
  74  
  75 -	amdgpu_mn_read_lock(amn);
  76 +	if (amdgpu_mn_read_lock(amn, blockable))
  77 +		return -EAGAIN;
  78  
  79  	it = interval_tree_iter_first(&amn->objects, start, end);
  80  	while (it) {
  81  		struct amdgpu_mn_node *node;
  82  		struct amdgpu_bo *bo;
  83  
  84 +		if (!blockable) {
  85 +			amdgpu_mn_read_unlock(amn);
  86 +			return -EAGAIN;
  87 +		}
  88 +
  89  		node = container_of(it, struct amdgpu_mn_node, it);
  90  		it = interval_tree_iter_next(it, start, end);
  91  
  92 @@ -431,6 +450,7 @@
  93  				amdgpu_amdkfd_evict_userptr(mem, mm);
  94  		}
  95  	}
  96 +	return 0;
  97  }
  98  
  99  #endif
 100 diff -Naur amdgpu-19.20-812932.bak/Makefile amdgpu-19.20-812932/Makefile
 101 --- amdgpu-19.20-812932.bak/Makefile	2019-05-10 19:57:47.000000000 +0200
 102 +++ amdgpu-19.20-812932/Makefile	2019-07-11 07:51:58.646571741 +0200
 103 @@ -33,6 +33,9 @@
 104  DRM_VER=$(shell sed -n 's/^VERSION = \(.*\)/\1/p' $(kdir)/Makefile)
 105  DRM_PATCH=$(shell sed -n 's/^PATCHLEVEL = \(.*\)/\1/p' $(kdir)/Makefile)
 106  endif
 107 +else
 108 +DRM_VER=$(shell make kernelversion | sed -n 's/\(.*\)\.\(.*\)\.\(.*\)/\1/p')
 109 +DRM_PATCH=$(shell make kernelversion | sed -n 's/\(.*\)\.\(.*\)\.\(.*\)/\2/p')
 110  endif
 111  
 112  subdir-ccflags-y += \

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.
  • [get | view] (2019-06-12 16:42:32, 9.6 KB) [[attachment:01-amdgpu_19.10_on_linux_4.19-v4.patch]]
  • [get | view] (2019-07-11 07:02:16, 3.4 KB) [[attachment:01-amdgpu_19.20_on_linux_4.19-v1.patch]]
 All files | Selected Files: delete move to page copy to page

You are not allowed to attach a file to this page.