mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-22 14:41:27 +00:00
drm/amdgpu: split psp tmr init function
Rework in order to properly support suspend. Signed-off-by: Huang Rui <ray.huang@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
parent
6524e494a8
commit
6f2b1fcccb
1 changed files with 17 additions and 10 deletions
|
@ -152,11 +152,6 @@ static void psp_prep_tmr_cmd_buf(struct psp_gfx_cmd_resp *cmd,
|
||||||
static int psp_tmr_init(struct psp_context *psp)
|
static int psp_tmr_init(struct psp_context *psp)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
struct psp_gfx_cmd_resp *cmd;
|
|
||||||
|
|
||||||
cmd = kzalloc(sizeof(struct psp_gfx_cmd_resp), GFP_KERNEL);
|
|
||||||
if (!cmd)
|
|
||||||
return -ENOMEM;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Allocate 3M memory aligned to 1M from Frame Buffer (local
|
* Allocate 3M memory aligned to 1M from Frame Buffer (local
|
||||||
|
@ -168,22 +163,30 @@ static int psp_tmr_init(struct psp_context *psp)
|
||||||
ret = amdgpu_bo_create_kernel(psp->adev, 0x300000, 0x100000,
|
ret = amdgpu_bo_create_kernel(psp->adev, 0x300000, 0x100000,
|
||||||
AMDGPU_GEM_DOMAIN_VRAM,
|
AMDGPU_GEM_DOMAIN_VRAM,
|
||||||
&psp->tmr_bo, &psp->tmr_mc_addr, &psp->tmr_buf);
|
&psp->tmr_bo, &psp->tmr_mc_addr, &psp->tmr_buf);
|
||||||
if (ret)
|
|
||||||
goto failed;
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int psp_tmr_load(struct psp_context *psp)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
struct psp_gfx_cmd_resp *cmd;
|
||||||
|
|
||||||
|
cmd = kzalloc(sizeof(struct psp_gfx_cmd_resp), GFP_KERNEL);
|
||||||
|
if (!cmd)
|
||||||
|
return -ENOMEM;
|
||||||
|
|
||||||
psp_prep_tmr_cmd_buf(cmd, psp->tmr_mc_addr, 0x300000);
|
psp_prep_tmr_cmd_buf(cmd, psp->tmr_mc_addr, 0x300000);
|
||||||
|
|
||||||
ret = psp_cmd_submit_buf(psp, NULL, cmd,
|
ret = psp_cmd_submit_buf(psp, NULL, cmd,
|
||||||
psp->fence_buf_mc_addr, 1);
|
psp->fence_buf_mc_addr, 1);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto failed_mem;
|
goto failed;
|
||||||
|
|
||||||
kfree(cmd);
|
kfree(cmd);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
failed_mem:
|
|
||||||
amdgpu_bo_free_kernel(&psp->tmr_bo, &psp->tmr_mc_addr, &psp->tmr_buf);
|
|
||||||
failed:
|
failed:
|
||||||
kfree(cmd);
|
kfree(cmd);
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -298,6 +301,10 @@ static int psp_load_fw(struct amdgpu_device *adev)
|
||||||
if (ret)
|
if (ret)
|
||||||
goto failed_mem;
|
goto failed_mem;
|
||||||
|
|
||||||
|
ret = psp_tmr_load(psp);
|
||||||
|
if (ret)
|
||||||
|
goto failed_mem;
|
||||||
|
|
||||||
ret = psp_asd_load(psp);
|
ret = psp_asd_load(psp);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto failed_mem;
|
goto failed_mem;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue