mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	drm/amdgpu: added api for stopping psp ring (v2)
- v2: reuse the ring stop api in ring destory Signed-off-by: Evan Quan <evan.quan@amd.com> Reviewed-by: Junwei Zhang <Jerry.Zhang@amd.com> Acked-by: Christian König <christian.koenig@amd.com> Reviewed-by: Huang Rui <ray.huang@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
		
							parent
							
								
									f1ac0fc2f2
								
							
						
					
					
						commit
						4ef7245331
					
				
					 6 changed files with 36 additions and 2 deletions
				
			
		| 
						 | 
					@ -57,6 +57,7 @@ static int psp_sw_init(void *handle)
 | 
				
			||||||
		psp->prep_cmd_buf = psp_v3_1_prep_cmd_buf;
 | 
							psp->prep_cmd_buf = psp_v3_1_prep_cmd_buf;
 | 
				
			||||||
		psp->ring_init = psp_v3_1_ring_init;
 | 
							psp->ring_init = psp_v3_1_ring_init;
 | 
				
			||||||
		psp->ring_create = psp_v3_1_ring_create;
 | 
							psp->ring_create = psp_v3_1_ring_create;
 | 
				
			||||||
 | 
							psp->ring_stop = psp_v3_1_ring_stop;
 | 
				
			||||||
		psp->ring_destroy = psp_v3_1_ring_destroy;
 | 
							psp->ring_destroy = psp_v3_1_ring_destroy;
 | 
				
			||||||
		psp->cmd_submit = psp_v3_1_cmd_submit;
 | 
							psp->cmd_submit = psp_v3_1_cmd_submit;
 | 
				
			||||||
		psp->compare_sram_data = psp_v3_1_compare_sram_data;
 | 
							psp->compare_sram_data = psp_v3_1_compare_sram_data;
 | 
				
			||||||
| 
						 | 
					@ -69,6 +70,7 @@ static int psp_sw_init(void *handle)
 | 
				
			||||||
		psp->prep_cmd_buf = psp_v10_0_prep_cmd_buf;
 | 
							psp->prep_cmd_buf = psp_v10_0_prep_cmd_buf;
 | 
				
			||||||
		psp->ring_init = psp_v10_0_ring_init;
 | 
							psp->ring_init = psp_v10_0_ring_init;
 | 
				
			||||||
		psp->ring_create = psp_v10_0_ring_create;
 | 
							psp->ring_create = psp_v10_0_ring_create;
 | 
				
			||||||
 | 
							psp->ring_stop = psp_v10_0_ring_stop;
 | 
				
			||||||
		psp->ring_destroy = psp_v10_0_ring_destroy;
 | 
							psp->ring_destroy = psp_v10_0_ring_destroy;
 | 
				
			||||||
		psp->cmd_submit = psp_v10_0_cmd_submit;
 | 
							psp->cmd_submit = psp_v10_0_cmd_submit;
 | 
				
			||||||
		psp->compare_sram_data = psp_v10_0_compare_sram_data;
 | 
							psp->compare_sram_data = psp_v10_0_compare_sram_data;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -66,6 +66,8 @@ struct psp_context
 | 
				
			||||||
			    struct psp_gfx_cmd_resp *cmd);
 | 
								    struct psp_gfx_cmd_resp *cmd);
 | 
				
			||||||
	int (*ring_init)(struct psp_context *psp, enum psp_ring_type ring_type);
 | 
						int (*ring_init)(struct psp_context *psp, enum psp_ring_type ring_type);
 | 
				
			||||||
	int (*ring_create)(struct psp_context *psp, enum psp_ring_type ring_type);
 | 
						int (*ring_create)(struct psp_context *psp, enum psp_ring_type ring_type);
 | 
				
			||||||
 | 
						int (*ring_stop)(struct psp_context *psp,
 | 
				
			||||||
 | 
								    enum psp_ring_type ring_type);
 | 
				
			||||||
	int (*ring_destroy)(struct psp_context *psp,
 | 
						int (*ring_destroy)(struct psp_context *psp,
 | 
				
			||||||
			    enum psp_ring_type ring_type);
 | 
								    enum psp_ring_type ring_type);
 | 
				
			||||||
	int (*cmd_submit)(struct psp_context *psp, struct amdgpu_firmware_info *ucode,
 | 
						int (*cmd_submit)(struct psp_context *psp, struct amdgpu_firmware_info *ucode,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -207,7 +207,7 @@ int psp_v10_0_ring_create(struct psp_context *psp, enum psp_ring_type ring_type)
 | 
				
			||||||
	return ret;
 | 
						return ret;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int psp_v10_0_ring_destroy(struct psp_context *psp, enum psp_ring_type ring_type)
 | 
					int psp_v10_0_ring_stop(struct psp_context *psp, enum psp_ring_type ring_type)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	int ret = 0;
 | 
						int ret = 0;
 | 
				
			||||||
	struct psp_ring *ring;
 | 
						struct psp_ring *ring;
 | 
				
			||||||
| 
						 | 
					@ -227,6 +227,19 @@ int psp_v10_0_ring_destroy(struct psp_context *psp, enum psp_ring_type ring_type
 | 
				
			||||||
	ret = psp_wait_for(psp, SOC15_REG_OFFSET(MP0, 0, mmMP0_SMN_C2PMSG_64),
 | 
						ret = psp_wait_for(psp, SOC15_REG_OFFSET(MP0, 0, mmMP0_SMN_C2PMSG_64),
 | 
				
			||||||
			   0x80000000, 0x80000000, false);
 | 
								   0x80000000, 0x80000000, false);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						return ret;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					int psp_v10_0_ring_destroy(struct psp_context *psp, enum psp_ring_type ring_type)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						int ret = 0;
 | 
				
			||||||
 | 
						struct psp_ring *ring = &psp->km_ring;
 | 
				
			||||||
 | 
						struct amdgpu_device *adev = psp->adev;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						ret = psp_v10_0_ring_stop(psp, ring_type);
 | 
				
			||||||
 | 
						if (ret)
 | 
				
			||||||
 | 
							DRM_ERROR("Fail to stop psp ring\n");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	amdgpu_bo_free_kernel(&adev->firmware.rbuf,
 | 
						amdgpu_bo_free_kernel(&adev->firmware.rbuf,
 | 
				
			||||||
			      &ring->ring_mem_mc_addr,
 | 
								      &ring->ring_mem_mc_addr,
 | 
				
			||||||
			      (void **)&ring->ring_mem);
 | 
								      (void **)&ring->ring_mem);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -34,6 +34,8 @@ extern int psp_v10_0_ring_init(struct psp_context *psp,
 | 
				
			||||||
			      enum psp_ring_type ring_type);
 | 
								      enum psp_ring_type ring_type);
 | 
				
			||||||
extern int psp_v10_0_ring_create(struct psp_context *psp,
 | 
					extern int psp_v10_0_ring_create(struct psp_context *psp,
 | 
				
			||||||
				 enum psp_ring_type ring_type);
 | 
									 enum psp_ring_type ring_type);
 | 
				
			||||||
 | 
					extern int psp_v10_0_ring_stop(struct psp_context *psp,
 | 
				
			||||||
 | 
									  enum psp_ring_type ring_type);
 | 
				
			||||||
extern int psp_v10_0_ring_destroy(struct psp_context *psp,
 | 
					extern int psp_v10_0_ring_destroy(struct psp_context *psp,
 | 
				
			||||||
				  enum psp_ring_type ring_type);
 | 
									  enum psp_ring_type ring_type);
 | 
				
			||||||
extern int psp_v10_0_cmd_submit(struct psp_context *psp,
 | 
					extern int psp_v10_0_cmd_submit(struct psp_context *psp,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -319,7 +319,7 @@ int psp_v3_1_ring_create(struct psp_context *psp, enum psp_ring_type ring_type)
 | 
				
			||||||
	return ret;
 | 
						return ret;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int psp_v3_1_ring_destroy(struct psp_context *psp, enum psp_ring_type ring_type)
 | 
					int psp_v3_1_ring_stop(struct psp_context *psp, enum psp_ring_type ring_type)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	int ret = 0;
 | 
						int ret = 0;
 | 
				
			||||||
	struct psp_ring *ring;
 | 
						struct psp_ring *ring;
 | 
				
			||||||
| 
						 | 
					@ -339,6 +339,19 @@ int psp_v3_1_ring_destroy(struct psp_context *psp, enum psp_ring_type ring_type)
 | 
				
			||||||
	ret = psp_wait_for(psp, SOC15_REG_OFFSET(MP0, 0, mmMP0_SMN_C2PMSG_64),
 | 
						ret = psp_wait_for(psp, SOC15_REG_OFFSET(MP0, 0, mmMP0_SMN_C2PMSG_64),
 | 
				
			||||||
			   0x80000000, 0x80000000, false);
 | 
								   0x80000000, 0x80000000, false);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						return ret;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					int psp_v3_1_ring_destroy(struct psp_context *psp, enum psp_ring_type ring_type)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						int ret = 0;
 | 
				
			||||||
 | 
						struct psp_ring *ring = &psp->km_ring;
 | 
				
			||||||
 | 
						struct amdgpu_device *adev = psp->adev;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						ret = psp_v3_1_ring_stop(psp, ring_type);
 | 
				
			||||||
 | 
						if (ret)
 | 
				
			||||||
 | 
							DRM_ERROR("Fail to stop psp ring\n");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	amdgpu_bo_free_kernel(&adev->firmware.rbuf,
 | 
						amdgpu_bo_free_kernel(&adev->firmware.rbuf,
 | 
				
			||||||
			      &ring->ring_mem_mc_addr,
 | 
								      &ring->ring_mem_mc_addr,
 | 
				
			||||||
			      (void **)&ring->ring_mem);
 | 
								      (void **)&ring->ring_mem);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -41,6 +41,8 @@ extern int psp_v3_1_ring_init(struct psp_context *psp,
 | 
				
			||||||
			      enum psp_ring_type ring_type);
 | 
								      enum psp_ring_type ring_type);
 | 
				
			||||||
extern int psp_v3_1_ring_create(struct psp_context *psp,
 | 
					extern int psp_v3_1_ring_create(struct psp_context *psp,
 | 
				
			||||||
				enum psp_ring_type ring_type);
 | 
									enum psp_ring_type ring_type);
 | 
				
			||||||
 | 
					extern int psp_v3_1_ring_stop(struct psp_context *psp,
 | 
				
			||||||
 | 
									enum psp_ring_type ring_type);
 | 
				
			||||||
extern int psp_v3_1_ring_destroy(struct psp_context *psp,
 | 
					extern int psp_v3_1_ring_destroy(struct psp_context *psp,
 | 
				
			||||||
				enum psp_ring_type ring_type);
 | 
									enum psp_ring_type ring_type);
 | 
				
			||||||
extern int psp_v3_1_cmd_submit(struct psp_context *psp,
 | 
					extern int psp_v3_1_cmd_submit(struct psp_context *psp,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue