Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/amdgpu: Simplify kgd2kfd interface

After amdkfd is merged into amdgpu module, amdgpu can call amdkfd
functions directly.

Signed-off-by: Amber Lin <Amber.Lin@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Amber Lin and committed by
Alex Deucher
8e07e267 2d3d25b6

+14 -21
+11 -15
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c
··· 61 61 62 62 void amdgpu_amdkfd_fini(void) 63 63 { 64 - if (kgd2kfd) 65 - kgd2kfd->exit(); 64 + kgd2kfd_exit(); 66 65 } 67 66 68 67 void amdgpu_amdkfd_device_probe(struct amdgpu_device *adev) 69 68 { 70 69 const struct kfd2kgd_calls *kfd2kgd; 71 - 72 - if (!kgd2kfd) 73 - return; 74 70 75 71 switch (adev->asic_type) { 76 72 #ifdef CONFIG_DRM_AMDGPU_CIK ··· 94 98 return; 95 99 } 96 100 97 - adev->kfd.dev = kgd2kfd->probe((struct kgd_dev *)adev, 98 - adev->pdev, kfd2kgd); 101 + adev->kfd.dev = kgd2kfd_probe((struct kgd_dev *)adev, 102 + adev->pdev, kfd2kgd); 99 103 100 104 if (adev->kfd.dev) 101 105 amdgpu_amdkfd_total_mem_size += adev->gmc.real_vram_size; ··· 178 182 &gpu_resources.doorbell_start_offset); 179 183 180 184 if (adev->asic_type < CHIP_VEGA10) { 181 - kgd2kfd->device_init(adev->kfd.dev, &gpu_resources); 185 + kgd2kfd_device_init(adev->kfd.dev, &gpu_resources); 182 186 return; 183 187 } 184 188 ··· 207 211 gpu_resources.reserved_doorbell_mask = 0x1e0; 208 212 gpu_resources.reserved_doorbell_val = 0x0e0; 209 213 210 - kgd2kfd->device_init(adev->kfd.dev, &gpu_resources); 214 + kgd2kfd_device_init(adev->kfd.dev, &gpu_resources); 211 215 } 212 216 } 213 217 214 218 void amdgpu_amdkfd_device_fini(struct amdgpu_device *adev) 215 219 { 216 220 if (adev->kfd.dev) { 217 - kgd2kfd->device_exit(adev->kfd.dev); 221 + kgd2kfd_device_exit(adev->kfd.dev); 218 222 adev->kfd.dev = NULL; 219 223 } 220 224 } ··· 223 227 const void *ih_ring_entry) 224 228 { 225 229 if (adev->kfd.dev) 226 - kgd2kfd->interrupt(adev->kfd.dev, ih_ring_entry); 230 + kgd2kfd_interrupt(adev->kfd.dev, ih_ring_entry); 227 231 } 228 232 229 233 void amdgpu_amdkfd_suspend(struct amdgpu_device *adev) 230 234 { 231 235 if (adev->kfd.dev) 232 - kgd2kfd->suspend(adev->kfd.dev); 236 + kgd2kfd_suspend(adev->kfd.dev); 233 237 } 234 238 235 239 int amdgpu_amdkfd_resume(struct amdgpu_device *adev) ··· 237 241 int r = 0; 238 242 239 243 if (adev->kfd.dev) 240 - r = kgd2kfd->resume(adev->kfd.dev); 244 + r = kgd2kfd_resume(adev->kfd.dev); 241 245 242 246 return r; 243 247 } ··· 247 251 int r = 0; 248 252 249 253 if (adev->kfd.dev) 250 - r = kgd2kfd->pre_reset(adev->kfd.dev); 254 + r = kgd2kfd_pre_reset(adev->kfd.dev); 251 255 252 256 return r; 253 257 } ··· 257 261 int r = 0; 258 262 259 263 if (adev->kfd.dev) 260 - r = kgd2kfd->post_reset(adev->kfd.dev); 264 + r = kgd2kfd_post_reset(adev->kfd.dev); 261 265 262 266 return r; 263 267 }
+1 -2
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_fence.c
··· 31 31 32 32 static const struct dma_fence_ops amdkfd_fence_ops; 33 33 static atomic_t fence_seq = ATOMIC_INIT(0); 34 - extern const struct kgd2kfd_calls *kgd2kfd; 35 34 36 35 /* Eviction Fence 37 36 * Fence helper functions to deal with KFD memory eviction. ··· 122 123 if (dma_fence_is_signaled(f)) 123 124 return true; 124 125 125 - if (!kgd2kfd->schedule_evict_and_restore_process(fence->mm, f)) 126 + if (!kgd2kfd_schedule_evict_and_restore_process(fence->mm, f)) 126 127 return true; 127 128 128 129 return false;
+2 -4
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
··· 44 44 */ 45 45 #define AMDGPU_USERPTR_RESTORE_DELAY_MS 1 46 46 47 - extern const struct kgd2kfd_calls *kgd2kfd; 48 - 49 47 /* Impose limit on how much memory KFD can use */ 50 48 static struct { 51 49 uint64_t max_system_mem_limit; ··· 1790 1792 evicted_bos = atomic_inc_return(&process_info->evicted_bos); 1791 1793 if (evicted_bos == 1) { 1792 1794 /* First eviction, stop the queues */ 1793 - r = kgd2kfd->quiesce_mm(mm); 1795 + r = kgd2kfd_quiesce_mm(mm); 1794 1796 if (r) 1795 1797 pr_err("Failed to quiesce KFD\n"); 1796 1798 schedule_delayed_work(&process_info->restore_userptr_work, ··· 2082 2084 evicted_bos) 2083 2085 goto unlock_out; 2084 2086 evicted_bos = 0; 2085 - if (kgd2kfd->resume_mm(mm)) { 2087 + if (kgd2kfd_resume_mm(mm)) { 2086 2088 pr_err("%s: Failed to resume KFD\n", __func__); 2087 2089 /* No recovery from this failure. Probably the CP is 2088 2090 * hanging. No point trying again.