Commit 4ef72453 authored by Evan Quan's avatar Evan Quan Committed by Alex Deucher

drm/amdgpu: added api for stopping psp ring (v2)

- v2: reuse the ring stop api in ring destory
Signed-off-by: default avatarEvan Quan <evan.quan@amd.com>
Reviewed-by: default avatarJunwei Zhang <Jerry.Zhang@amd.com>
Acked-by: default avatarChristian König <christian.koenig@amd.com>
Reviewed-by: default avatarHuang Rui <ray.huang@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent f1ac0fc2
...@@ -57,6 +57,7 @@ static int psp_sw_init(void *handle) ...@@ -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) ...@@ -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 ...@@ -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) ...@@ -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 ...@@ -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, ...@@ -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) ...@@ -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) ...@@ -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, ...@@ -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,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment