diff options
author | Huang Rui <ray.huang@amd.com> | 2017-03-21 04:18:11 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2017-04-28 16:37:56 -0400 |
commit | 6f2b1fcccb6dad1d68c0955144af3ad56bacb25c (patch) | |
tree | 8d526759f57444ee29c7bcea1ad532dca7135378 /drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | |
parent | 6524e494a8acf1a281f349e6f726918d41b5a8de (diff) |
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>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c index ed6e5799016e..6aba417b7c95 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | |||
@@ -152,11 +152,6 @@ static void psp_prep_tmr_cmd_buf(struct psp_gfx_cmd_resp *cmd, | |||
152 | static int psp_tmr_init(struct psp_context *psp) | 152 | static int psp_tmr_init(struct psp_context *psp) |
153 | { | 153 | { |
154 | int ret; | 154 | int ret; |
155 | struct psp_gfx_cmd_resp *cmd; | ||
156 | |||
157 | cmd = kzalloc(sizeof(struct psp_gfx_cmd_resp), GFP_KERNEL); | ||
158 | if (!cmd) | ||
159 | return -ENOMEM; | ||
160 | 155 | ||
161 | /* | 156 | /* |
162 | * Allocate 3M memory aligned to 1M from Frame Buffer (local | 157 | * Allocate 3M memory aligned to 1M from Frame Buffer (local |
@@ -168,22 +163,30 @@ static int psp_tmr_init(struct psp_context *psp) | |||
168 | ret = amdgpu_bo_create_kernel(psp->adev, 0x300000, 0x100000, | 163 | ret = amdgpu_bo_create_kernel(psp->adev, 0x300000, 0x100000, |
169 | AMDGPU_GEM_DOMAIN_VRAM, | 164 | AMDGPU_GEM_DOMAIN_VRAM, |
170 | &psp->tmr_bo, &psp->tmr_mc_addr, &psp->tmr_buf); | 165 | &psp->tmr_bo, &psp->tmr_mc_addr, &psp->tmr_buf); |
171 | if (ret) | 166 | |
172 | goto failed; | 167 | return ret; |
168 | } | ||
169 | |||
170 | static int psp_tmr_load(struct psp_context *psp) | ||
171 | { | ||
172 | int ret; | ||
173 | struct psp_gfx_cmd_resp *cmd; | ||
174 | |||
175 | cmd = kzalloc(sizeof(struct psp_gfx_cmd_resp), GFP_KERNEL); | ||
176 | if (!cmd) | ||
177 | return -ENOMEM; | ||
173 | 178 | ||
174 | psp_prep_tmr_cmd_buf(cmd, psp->tmr_mc_addr, 0x300000); | 179 | psp_prep_tmr_cmd_buf(cmd, psp->tmr_mc_addr, 0x300000); |
175 | 180 | ||
176 | ret = psp_cmd_submit_buf(psp, NULL, cmd, | 181 | ret = psp_cmd_submit_buf(psp, NULL, cmd, |
177 | psp->fence_buf_mc_addr, 1); | 182 | psp->fence_buf_mc_addr, 1); |
178 | if (ret) | 183 | if (ret) |
179 | goto failed_mem; | 184 | goto failed; |
180 | 185 | ||
181 | kfree(cmd); | 186 | kfree(cmd); |
182 | 187 | ||
183 | return 0; | 188 | return 0; |
184 | 189 | ||
185 | failed_mem: | ||
186 | amdgpu_bo_free_kernel(&psp->tmr_bo, &psp->tmr_mc_addr, &psp->tmr_buf); | ||
187 | failed: | 190 | failed: |
188 | kfree(cmd); | 191 | kfree(cmd); |
189 | return ret; | 192 | return ret; |
@@ -298,6 +301,10 @@ static int psp_load_fw(struct amdgpu_device *adev) | |||
298 | if (ret) | 301 | if (ret) |
299 | goto failed_mem; | 302 | goto failed_mem; |
300 | 303 | ||
304 | ret = psp_tmr_load(psp); | ||
305 | if (ret) | ||
306 | goto failed_mem; | ||
307 | |||
301 | ret = psp_asd_load(psp); | 308 | ret = psp_asd_load(psp); |
302 | if (ret) | 309 | if (ret) |
303 | goto failed_mem; | 310 | goto failed_mem; |