diff options
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c')
| -rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c | 47 | 
1 files changed, 39 insertions, 8 deletions
| diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c index a00cf4756ad0..5ca5c47ab54e 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c @@ -32,6 +32,18 @@  #define AMDGPU_MES_MAX_NUM_OF_QUEUES_PER_PROCESS 1024  #define AMDGPU_ONE_DOORBELL_SIZE 8 +signed long amdgpu_mes_fence_wait_polling(u64 *fence, +					  u64 wait_seq, +					  signed long timeout) +{ + +	while ((s64)(wait_seq - *fence) > 0 && timeout > 0) { +		udelay(2); +		timeout -= 2; +	} +	return timeout > 0 ? timeout : 0; +} +  int amdgpu_mes_doorbell_process_slice(struct amdgpu_device *adev)  {  	return roundup(AMDGPU_ONE_DOORBELL_SIZE * @@ -40,7 +52,6 @@ int amdgpu_mes_doorbell_process_slice(struct amdgpu_device *adev)  }  static int amdgpu_mes_kernel_doorbell_get(struct amdgpu_device *adev, -					 struct amdgpu_mes_process *process,  					 int ip_type, uint64_t *doorbell_index)  {  	unsigned int offset, found; @@ -65,7 +76,6 @@ static int amdgpu_mes_kernel_doorbell_get(struct amdgpu_device *adev,  }  static void amdgpu_mes_kernel_doorbell_free(struct amdgpu_device *adev, -					   struct amdgpu_mes_process *process,  					   uint32_t doorbell_index)  {  	unsigned int old, rel_index; @@ -656,7 +666,7 @@ int amdgpu_mes_add_hw_queue(struct amdgpu_device *adev, int gang_id,  	*queue_id = queue->queue_id = r;  	/* allocate a doorbell index for the queue */ -	r = amdgpu_mes_kernel_doorbell_get(adev, gang->process, +	r = amdgpu_mes_kernel_doorbell_get(adev,  					  qprops->queue_type,  					  &qprops->doorbell_off);  	if (r) @@ -714,8 +724,7 @@ int amdgpu_mes_add_hw_queue(struct amdgpu_device *adev, int gang_id,  	return 0;  clean_up_doorbell: -	amdgpu_mes_kernel_doorbell_free(adev, gang->process, -				       qprops->doorbell_off); +	amdgpu_mes_kernel_doorbell_free(adev, qprops->doorbell_off);  clean_up_queue_id:  	spin_lock_irqsave(&adev->mes.queue_id_lock, flags);  	idr_remove(&adev->mes.queue_id_idr, queue->queue_id); @@ -769,8 +778,7 @@ int amdgpu_mes_remove_hw_queue(struct amdgpu_device *adev, int queue_id)  			  queue_id);  	list_del(&queue->list); -	amdgpu_mes_kernel_doorbell_free(adev, gang->process, -				       queue->doorbell_off); +	amdgpu_mes_kernel_doorbell_free(adev, queue->doorbell_off);  	amdgpu_mes_unlock(&adev->mes);  	amdgpu_mes_queue_free_mqd(queue); @@ -778,6 +786,28 @@ int amdgpu_mes_remove_hw_queue(struct amdgpu_device *adev, int queue_id)  	return 0;  } +int amdgpu_mes_map_legacy_queue(struct amdgpu_device *adev, +				struct amdgpu_ring *ring) +{ +	struct mes_map_legacy_queue_input queue_input; +	int r; + +	memset(&queue_input, 0, sizeof(queue_input)); + +	queue_input.queue_type = ring->funcs->type; +	queue_input.doorbell_offset = ring->doorbell_index; +	queue_input.pipe_id = ring->pipe; +	queue_input.queue_id = ring->queue; +	queue_input.mqd_addr = amdgpu_bo_gpu_offset(ring->mqd_obj); +	queue_input.wptr_addr = ring->wptr_gpu_addr; + +	r = adev->mes.funcs->map_legacy_queue(&adev->mes, &queue_input); +	if (r) +		DRM_ERROR("failed to map legacy queue\n"); + +	return r; +} +  int amdgpu_mes_unmap_legacy_queue(struct amdgpu_device *adev,  				  struct amdgpu_ring *ring,  				  enum amdgpu_unmap_queues_action action, @@ -1132,6 +1162,7 @@ void amdgpu_mes_remove_ring(struct amdgpu_device *adev,  		return;  	amdgpu_mes_remove_hw_queue(adev, ring->hw_queue_id); +	del_timer_sync(&ring->fence_drv.fallback_timer);  	amdgpu_ring_fini(ring);  	kfree(ring);  } @@ -1474,7 +1505,7 @@ int amdgpu_mes_init_microcode(struct amdgpu_device *adev, int pipe)  	const struct mes_firmware_header_v1_0 *mes_hdr;  	struct amdgpu_firmware_info *info;  	char ucode_prefix[30]; -	char fw_name[40]; +	char fw_name[50];  	bool need_retry = false;  	int r; | 
