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

Configure Feed

Select the types of activity you want to include in your feed.

drm/amdgpu: reduce the full gpu access time in amdgpu_device_init.

[Why]
function "devm_memremap_pages" in function "kgd2kfd_init_zone_device",
sometimes cost too much time.

[How]
move the function "kgd2kfd_init_zone_device"
after release full gpu access(amdgpu_virt_release_full_gpu).

v2:
improve the coding style.

Signed-off-by: chong li <chongli2@amd.com>
Reviewed-by: Emily Deng <Emily.Deng@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

chong li and committed by
Alex Deucher
c71980a3 ec62b7de

+37 -2
+1 -1
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h
··· 37 37 #include "amdgpu_sync.h" 38 38 #include "amdgpu_vm.h" 39 39 #include "amdgpu_xcp.h" 40 - 40 + #include "kfd_topology.h" 41 41 extern uint64_t amdgpu_amdkfd_total_mem_size; 42 42 43 43 enum TLB_FLUSH_TYPE {
+7 -1
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
··· 3317 3317 3318 3318 /* Don't init kfd if whole hive need to be reset during init */ 3319 3319 if (adev->init_lvl->level != AMDGPU_INIT_LEVEL_MINIMAL_XGMI) { 3320 - kgd2kfd_init_zone_device(adev); 3321 3320 amdgpu_amdkfd_device_init(adev); 3322 3321 } 3323 3322 ··· 4933 4934 4934 4935 if (adev->init_lvl->level == AMDGPU_INIT_LEVEL_MINIMAL_XGMI) 4935 4936 amdgpu_xgmi_reset_on_init(adev); 4937 + 4938 + /* Don't init kfd if whole hive need to be reset during init */ 4939 + if (adev->init_lvl->level != AMDGPU_INIT_LEVEL_MINIMAL_XGMI) { 4940 + kgd2kfd_init_zone_device(adev); 4941 + kfd_update_svm_support_properties(adev); 4942 + } 4943 + 4936 4944 /* 4937 4945 * Place those sysfs registering after `late_init`. As some of those 4938 4946 * operations performed in `late_init` might affect the sysfs
+23
drivers/gpu/drm/amd/amdkfd/kfd_topology.c
··· 2404 2404 } 2405 2405 2406 2406 #endif 2407 + 2408 + void kfd_update_svm_support_properties(struct amdgpu_device *adev) 2409 + { 2410 + struct kfd_topology_device *dev; 2411 + int ret; 2412 + 2413 + down_write(&topology_lock); 2414 + list_for_each_entry(dev, &topology_device_list, list) { 2415 + if (!dev->gpu || dev->gpu->adev != adev) 2416 + continue; 2417 + 2418 + if (KFD_IS_SVM_API_SUPPORTED(adev)) { 2419 + dev->node_props.capability |= HSA_CAP_SVMAPI_SUPPORTED; 2420 + ret = kfd_topology_update_sysfs(); 2421 + if (!ret) 2422 + sys_props.generation_count++; 2423 + else 2424 + dev_err(adev->dev, "Failed to update SVM support properties. ret=%d\n", ret); 2425 + } else 2426 + dev->node_props.capability &= ~HSA_CAP_SVMAPI_SUPPORTED; 2427 + } 2428 + up_write(&topology_lock); 2429 + }
+6
drivers/gpu/drm/amd/amdkfd/kfd_topology.h
··· 201 201 struct list_head *device_list); 202 202 void kfd_release_topology_device_list(struct list_head *device_list); 203 203 204 + #if IS_ENABLED(CONFIG_HSA_AMD) 205 + void kfd_update_svm_support_properties(struct amdgpu_device *adev); 206 + #else 207 + static inline void kfd_update_svm_support_properties(struct amdgpu_device *adev) {} 208 + #endif 209 + 204 210 #endif /* __KFD_TOPOLOGY_H__ */