drm/amdgpu: Enable the gpu reset from KFD
authorShaoyun Liu <Shaoyun.Liu@amd.com>
Thu, 12 Jul 2018 02:32:57 +0000 (22:32 -0400)
committerOded Gabbay <oded.gabbay@gmail.com>
Thu, 12 Jul 2018 02:32:57 +0000 (22:32 -0400)
Hook up the gpu_recover callback from KFD to amdgpu to enable
handling of GPU hangs detected by KFD.

Signed-off-by: Shaoyun Liu <Shaoyun.Liu@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v7.c
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v8.c
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c

index f3a3aba08c2ff01dbf34ba3ff1d0cc3cccfd2182..454c22c722c24be6d146a11d96dffed17c149cbd 100644 (file)
@@ -263,6 +263,13 @@ int amdgpu_amdkfd_post_reset(struct amdgpu_device *adev)
        return r;
 }
 
+void amdgpu_amdkfd_gpu_reset(struct kgd_dev *kgd)
+{
+       struct amdgpu_device *adev = (struct amdgpu_device *)kgd;
+
+       amdgpu_device_gpu_recover(adev, NULL, false);
+}
+
 int alloc_gtt_mem(struct kgd_dev *kgd, size_t size,
                        void **mem_obj, uint64_t *gpu_addr,
                        void **cpu_ptr)
index 7dc551b8f682e260d8536ecb0abfb0c69ab48180..60207ea48bf5de53a3614be78a2f99e59ab05739 100644 (file)
@@ -130,6 +130,8 @@ int amdgpu_amdkfd_pre_reset(struct amdgpu_device *adev);
 
 int amdgpu_amdkfd_post_reset(struct amdgpu_device *adev);
 
+void amdgpu_amdkfd_gpu_reset(struct kgd_dev *kgd);
+
 /* Shared API */
 int alloc_gtt_mem(struct kgd_dev *kgd, size_t size,
                        void **mem_obj, uint64_t *gpu_addr,
index b4a05c510c75fe62afc5accd1a1681a9ff185121..70b275a711c229bc388d22a3fde23de919534cf6 100644 (file)
@@ -218,7 +218,8 @@ static const struct kfd2kgd_calls kfd2kgd = {
        .invalidate_tlbs_vmid = invalidate_tlbs_vmid,
        .submit_ib = amdgpu_amdkfd_submit_ib,
        .get_vm_fault_info = amdgpu_amdkfd_gpuvm_get_vm_fault_info,
-       .read_vmid_from_vmfault_reg = read_vmid_from_vmfault_reg
+       .read_vmid_from_vmfault_reg = read_vmid_from_vmfault_reg,
+       .gpu_recover = amdgpu_amdkfd_gpu_reset
 };
 
 struct kfd2kgd_calls *amdgpu_amdkfd_gfx_7_get_functions(void)
index c68ef85f775385d148dc1a6055ae6069f58f2b25..6053b1d143ae017eef6b0443c27dba066fd834a7 100644 (file)
@@ -176,7 +176,8 @@ static const struct kfd2kgd_calls kfd2kgd = {
        .invalidate_tlbs = invalidate_tlbs,
        .invalidate_tlbs_vmid = invalidate_tlbs_vmid,
        .submit_ib = amdgpu_amdkfd_submit_ib,
-       .get_vm_fault_info = amdgpu_amdkfd_gpuvm_get_vm_fault_info
+       .get_vm_fault_info = amdgpu_amdkfd_gpuvm_get_vm_fault_info,
+       .gpu_recover = amdgpu_amdkfd_gpu_reset
 };
 
 struct kfd2kgd_calls *amdgpu_amdkfd_gfx_8_0_get_functions(void)
index 1db60aa5b7f0eab0c012cc41af2181bb678a7813..56d29cfd8227b9b11f1792214de9a643befefb55 100644 (file)
@@ -213,6 +213,7 @@ static const struct kfd2kgd_calls kfd2kgd = {
        .invalidate_tlbs = invalidate_tlbs,
        .invalidate_tlbs_vmid = invalidate_tlbs_vmid,
        .submit_ib = amdgpu_amdkfd_submit_ib,
+       .gpu_recover = amdgpu_amdkfd_gpu_reset
 };
 
 struct kfd2kgd_calls *amdgpu_amdkfd_gfx_9_0_get_functions(void)