drm/amdgpu: defer test IBs on the rings at boot (V3)
amdgpu_ib_ring_tests() runs test IB's on rings at boot
contributes to ~500 ms of amdgpu driver's boot time.
This patch defers it and ensures that its executed
in amdgpu_info_ioctl() if it wasn't scheduled.
V2: Use queue_delayed_work() & flush_delayed_work().
V3: removed usage of separate wq, ensure ib tests is
    run before enabling clockgating.
Signed-off-by: Shirish S <shirish.s@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
			
			
This commit is contained in:
		
							parent
							
								
									5c3517d0c2
								
							
						
					
					
						commit
						2c773de2ec
					
				| @ -1656,6 +1656,10 @@ static int amdgpu_device_ip_late_set_cg_state(struct amdgpu_device *adev) | |||||||
| 	if (amdgpu_emu_mode == 1) | 	if (amdgpu_emu_mode == 1) | ||||||
| 		return 0; | 		return 0; | ||||||
| 
 | 
 | ||||||
|  | 	r = amdgpu_ib_ring_tests(adev); | ||||||
|  | 	if (r) | ||||||
|  | 		DRM_ERROR("ib ring test failed (%d).\n", r); | ||||||
|  | 
 | ||||||
| 	for (i = 0; i < adev->num_ip_blocks; i++) { | 	for (i = 0; i < adev->num_ip_blocks; i++) { | ||||||
| 		if (!adev->ip_blocks[i].status.valid) | 		if (!adev->ip_blocks[i].status.valid) | ||||||
| 			continue; | 			continue; | ||||||
| @ -1706,8 +1710,8 @@ static int amdgpu_device_ip_late_init(struct amdgpu_device *adev) | |||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	mod_delayed_work(system_wq, &adev->late_init_work, | 	queue_delayed_work(system_wq, &adev->late_init_work, | ||||||
| 			msecs_to_jiffies(AMDGPU_RESUME_MS)); | 			   msecs_to_jiffies(AMDGPU_RESUME_MS)); | ||||||
| 
 | 
 | ||||||
| 	amdgpu_device_fill_reset_magic(adev); | 	amdgpu_device_fill_reset_magic(adev); | ||||||
| 
 | 
 | ||||||
| @ -2374,10 +2378,6 @@ fence_driver_init: | |||||||
| 		goto failed; | 		goto failed; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	r = amdgpu_ib_ring_tests(adev); |  | ||||||
| 	if (r) |  | ||||||
| 		DRM_ERROR("ib ring test failed (%d).\n", r); |  | ||||||
| 
 |  | ||||||
| 	if (amdgpu_sriov_vf(adev)) | 	if (amdgpu_sriov_vf(adev)) | ||||||
| 		amdgpu_virt_init_data_exchange(adev); | 		amdgpu_virt_init_data_exchange(adev); | ||||||
| 
 | 
 | ||||||
| @ -2639,11 +2639,6 @@ int amdgpu_device_resume(struct drm_device *dev, bool resume, bool fbcon) | |||||||
| 	} | 	} | ||||||
| 	amdgpu_fence_driver_resume(adev); | 	amdgpu_fence_driver_resume(adev); | ||||||
| 
 | 
 | ||||||
| 	if (resume) { |  | ||||||
| 		r = amdgpu_ib_ring_tests(adev); |  | ||||||
| 		if (r) |  | ||||||
| 			DRM_ERROR("ib ring test failed (%d).\n", r); |  | ||||||
| 	} |  | ||||||
| 
 | 
 | ||||||
| 	r = amdgpu_device_ip_late_init(adev); | 	r = amdgpu_device_ip_late_init(adev); | ||||||
| 	if (r) | 	if (r) | ||||||
|  | |||||||
| @ -279,6 +279,9 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file | |||||||
| 	if (!info->return_size || !info->return_pointer) | 	if (!info->return_size || !info->return_pointer) | ||||||
| 		return -EINVAL; | 		return -EINVAL; | ||||||
| 
 | 
 | ||||||
|  | 	/* Ensure IB tests are run on ring */ | ||||||
|  | 	flush_delayed_work(&adev->late_init_work); | ||||||
|  | 
 | ||||||
| 	switch (info->query) { | 	switch (info->query) { | ||||||
| 	case AMDGPU_INFO_ACCEL_WORKING: | 	case AMDGPU_INFO_ACCEL_WORKING: | ||||||
| 		ui32 = adev->accel_working; | 		ui32 = adev->accel_working; | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user