mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	drm/amdgpu/userq: add suspend and resume helpers
Add helpers to unmap and map user queues on suspend and resume. Reviewed-by: Sunil Khatri <sunil.khatri@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
		
							parent
							
								
									c0bbf64870
								
							
						
					
					
						commit
						73e12e98ec
					
				
					 2 changed files with 42 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -681,3 +681,42 @@ void amdgpu_userq_mgr_fini(struct amdgpu_userq_mgr *userq_mgr)
 | 
			
		|||
	mutex_unlock(&userq_mgr->userq_mutex);
 | 
			
		||||
	mutex_destroy(&userq_mgr->userq_mutex);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int amdgpu_userq_suspend(struct amdgpu_device *adev)
 | 
			
		||||
{
 | 
			
		||||
	const struct amdgpu_userq_funcs *userq_funcs;
 | 
			
		||||
	struct amdgpu_usermode_queue *queue;
 | 
			
		||||
	struct amdgpu_userq_mgr *uqm, *tmp;
 | 
			
		||||
	int queue_id;
 | 
			
		||||
	int ret = 0;
 | 
			
		||||
 | 
			
		||||
	mutex_lock(&adev->userq_mutex);
 | 
			
		||||
	list_for_each_entry_safe(uqm, tmp, &adev->userq_mgr_list, list) {
 | 
			
		||||
		cancel_delayed_work_sync(&uqm->resume_work);
 | 
			
		||||
		idr_for_each_entry(&uqm->userq_idr, queue, queue_id) {
 | 
			
		||||
			userq_funcs = adev->userq_funcs[queue->queue_type];
 | 
			
		||||
			ret |= userq_funcs->unmap(uqm, queue);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	mutex_unlock(&adev->userq_mutex);
 | 
			
		||||
	return ret;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int amdgpu_userq_resume(struct amdgpu_device *adev)
 | 
			
		||||
{
 | 
			
		||||
	const struct amdgpu_userq_funcs *userq_funcs;
 | 
			
		||||
	struct amdgpu_usermode_queue *queue;
 | 
			
		||||
	struct amdgpu_userq_mgr *uqm, *tmp;
 | 
			
		||||
	int queue_id;
 | 
			
		||||
	int ret = 0;
 | 
			
		||||
 | 
			
		||||
	mutex_lock(&adev->userq_mutex);
 | 
			
		||||
	list_for_each_entry_safe(uqm, tmp, &adev->userq_mgr_list, list) {
 | 
			
		||||
		idr_for_each_entry(&uqm->userq_idr, queue, queue_id) {
 | 
			
		||||
			userq_funcs = adev->userq_funcs[queue->queue_type];
 | 
			
		||||
			ret |= userq_funcs->map(uqm, queue);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	mutex_unlock(&adev->userq_mutex);
 | 
			
		||||
	return ret;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -111,4 +111,7 @@ uint64_t amdgpu_userqueue_get_doorbell_index(struct amdgpu_userq_mgr *uq_mgr,
 | 
			
		|||
					     struct amdgpu_db_info *db_info,
 | 
			
		||||
					     struct drm_file *filp);
 | 
			
		||||
 | 
			
		||||
int amdgpu_userq_suspend(struct amdgpu_device *adev);
 | 
			
		||||
int amdgpu_userq_resume(struct amdgpu_device *adev);
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue