aboutsummaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/amd/amdkfd/kfd_svm.h
diff options
context:
space:
mode:
authorGravatar Felix Kuehling <Felix.Kuehling@amd.com> 2021-02-24 23:24:53 -0500
committerGravatar Alex Deucher <alexander.deucher@amd.com> 2021-04-20 21:49:39 -0400
commitb41896e3eeb5cfb9f906f5d72d9b9c735dc234d4 (patch)
tree1ad9ae4936067c0833a56e531f2bdb0f3b2dbb09 /drivers/gpu/drm/amd/amdkfd/kfd_svm.h
parentdrm/amdgpu: add param bit flag to create SVM BOs (diff)
downloadlinux-b41896e3eeb5cfb9f906f5d72d9b9c735dc234d4.tar.gz
linux-b41896e3eeb5cfb9f906f5d72d9b9c735dc234d4.tar.bz2
linux-b41896e3eeb5cfb9f906f5d72d9b9c735dc234d4.zip
drm/amdkfd: add svm_bo eviction mechanism support
svm_bo eviction mechanism is different from regular BOs. Every SVM_BO created contains one eviction fence and one worker item for eviction process. SVM_BOs can be attached to one or more pranges. For SVM_BO eviction mechanism, TTM will start to call enable_signal callback for every SVM_BO until VRAM space is available. Here, all the ttm_evict calls are synchronous, this guarantees that each eviction has completed and the fence has signaled before it returns. Signed-off-by: Alex Sierra <alex.sierra@amd.com> Signed-off-by: Philip Yang <Philip.Yang@amd.com> Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com> Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdkfd/kfd_svm.h')
-rw-r--r--drivers/gpu/drm/amd/amdkfd/kfd_svm.h13
1 files changed, 9 insertions, 4 deletions
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_svm.h b/drivers/gpu/drm/amd/amdkfd/kfd_svm.h
index 9a078d354cba..11b04a706ff9 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_svm.h
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_svm.h
@@ -34,10 +34,14 @@
#include "kfd_priv.h"
struct svm_range_bo {
- struct amdgpu_bo *bo;
- struct kref kref;
- struct list_head range_list; /* all svm ranges shared this bo */
- spinlock_t list_lock;
+ struct amdgpu_bo *bo;
+ struct kref kref;
+ struct list_head range_list; /* all svm ranges shared this bo */
+ spinlock_t list_lock;
+ struct amdgpu_amdkfd_fence *eviction_fence;
+ struct work_struct eviction_work;
+ struct svm_range_list *svms;
+ uint32_t evicting;
};
enum svm_work_list_ops {
@@ -157,6 +161,7 @@ int svm_range_split_by_granularity(struct kfd_process *p, struct mm_struct *mm,
struct svm_range *prange);
int svm_range_restore_pages(struct amdgpu_device *adev,
unsigned int pasid, uint64_t addr);
+int svm_range_schedule_evict_svm_bo(struct amdgpu_amdkfd_fence *fence);
void svm_range_add_list_work(struct svm_range_list *svms,
struct svm_range *prange, struct mm_struct *mm,
enum svm_work_list_ops op);