diff options
author | Huang Rui <ray.huang@amd.com> | 2017-03-21 22:16:05 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2017-04-28 16:37:57 -0400 |
commit | 2b0c3aee2172451e9f982b25f3fdf59a1b687dc3 (patch) | |
tree | 7eff824ff1de66f8b4a95bf9d0827082ca6228de /drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | |
parent | 53a5cf57d819f12b2de365aa3137c9175a032608 (diff) |
drm/amdgpu: use private memory to store psp firmware data
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 | 28 |
1 files changed, 8 insertions, 20 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c index f70ab550934c..ed9c04b7a286 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | |||
@@ -209,9 +209,9 @@ static void psp_prep_asd_cmd_buf(struct psp_gfx_cmd_resp *cmd, | |||
209 | static int psp_asd_load(struct psp_context *psp) | 209 | static int psp_asd_load(struct psp_context *psp) |
210 | { | 210 | { |
211 | int ret; | 211 | int ret; |
212 | struct amdgpu_bo *asd_bo, *asd_shared_bo; | 212 | struct amdgpu_bo *asd_shared_bo; |
213 | uint64_t asd_mc_addr, asd_shared_mc_addr; | 213 | uint64_t asd_shared_mc_addr; |
214 | void *asd_buf, *asd_shared_buf; | 214 | void *asd_shared_buf; |
215 | struct psp_gfx_cmd_resp *cmd; | 215 | struct psp_gfx_cmd_resp *cmd; |
216 | 216 | ||
217 | cmd = kzalloc(sizeof(struct psp_gfx_cmd_resp), GFP_KERNEL); | 217 | cmd = kzalloc(sizeof(struct psp_gfx_cmd_resp), GFP_KERNEL); |
@@ -224,38 +224,26 @@ static int psp_asd_load(struct psp_context *psp) | |||
224 | */ | 224 | */ |
225 | ret = amdgpu_bo_create_kernel(psp->adev, PSP_ASD_SHARED_MEM_SIZE, PAGE_SIZE, | 225 | ret = amdgpu_bo_create_kernel(psp->adev, PSP_ASD_SHARED_MEM_SIZE, PAGE_SIZE, |
226 | AMDGPU_GEM_DOMAIN_VRAM, | 226 | AMDGPU_GEM_DOMAIN_VRAM, |
227 | &asd_shared_bo, &asd_shared_mc_addr, &asd_buf); | 227 | &asd_shared_bo, &asd_shared_mc_addr, &asd_shared_buf); |
228 | if (ret) | 228 | if (ret) |
229 | goto failed; | 229 | goto failed; |
230 | 230 | ||
231 | /* | 231 | memset(psp->fw_pri_buf, 0, PSP_1_MEG); |
232 | * Allocate 256k memory aligned to 4k from Frame Buffer (local | 232 | memcpy(psp->fw_pri_buf, psp->asd_start_addr, psp->asd_ucode_size); |
233 | * physical) for ASD firmware | ||
234 | */ | ||
235 | ret = amdgpu_bo_create_kernel(psp->adev, PSP_ASD_BIN_SIZE, PAGE_SIZE, | ||
236 | AMDGPU_GEM_DOMAIN_VRAM, | ||
237 | &asd_bo, &asd_mc_addr, &asd_buf); | ||
238 | if (ret) | ||
239 | goto failed_mem; | ||
240 | 233 | ||
241 | memcpy(asd_buf, psp->asd_start_addr, psp->asd_ucode_size); | 234 | psp_prep_asd_cmd_buf(cmd, psp->fw_pri_mc_addr, asd_shared_mc_addr, |
242 | |||
243 | psp_prep_asd_cmd_buf(cmd, asd_mc_addr, asd_shared_mc_addr, | ||
244 | psp->asd_ucode_size, PSP_ASD_SHARED_MEM_SIZE); | 235 | psp->asd_ucode_size, PSP_ASD_SHARED_MEM_SIZE); |
245 | 236 | ||
246 | ret = psp_cmd_submit_buf(psp, NULL, cmd, | 237 | ret = psp_cmd_submit_buf(psp, NULL, cmd, |
247 | psp->fence_buf_mc_addr, 2); | 238 | psp->fence_buf_mc_addr, 2); |
248 | if (ret) | 239 | if (ret) |
249 | goto failed_mem1; | 240 | goto failed_mem; |
250 | 241 | ||
251 | amdgpu_bo_free_kernel(&asd_bo, &asd_mc_addr, &asd_buf); | ||
252 | amdgpu_bo_free_kernel(&asd_shared_bo, &asd_shared_mc_addr, &asd_shared_buf); | 242 | amdgpu_bo_free_kernel(&asd_shared_bo, &asd_shared_mc_addr, &asd_shared_buf); |
253 | kfree(cmd); | 243 | kfree(cmd); |
254 | 244 | ||
255 | return 0; | 245 | return 0; |
256 | 246 | ||
257 | failed_mem1: | ||
258 | amdgpu_bo_free_kernel(&asd_bo, &asd_mc_addr, &asd_buf); | ||
259 | failed_mem: | 247 | failed_mem: |
260 | amdgpu_bo_free_kernel(&asd_shared_bo, &asd_shared_mc_addr, &asd_shared_buf); | 248 | amdgpu_bo_free_kernel(&asd_shared_bo, &asd_shared_mc_addr, &asd_shared_buf); |
261 | failed: | 249 | failed: |