Commit 4f2bea62 authored by Alex Deucher's avatar Alex Deucher

drm/amdgpu/psp: don't free PSP buffers on suspend

We can reuse the same buffers on resume.

v2: squash in S4 fix from Shikai

Bug: https://gitlab.freedesktop.org/drm/amd/-/issues/2213Reviewed-by: default avatarChristian König <christian.koenig@amd.com>
Tested-by: default avatarGuilherme G. Piccoli <gpiccoli@igalia.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
parent 91abf28a
...@@ -172,6 +172,7 @@ void psp_ta_free_shared_buf(struct ta_mem_context *mem_ctx) ...@@ -172,6 +172,7 @@ void psp_ta_free_shared_buf(struct ta_mem_context *mem_ctx)
{ {
amdgpu_bo_free_kernel(&mem_ctx->shared_bo, &mem_ctx->shared_mc_addr, amdgpu_bo_free_kernel(&mem_ctx->shared_bo, &mem_ctx->shared_mc_addr,
&mem_ctx->shared_buf); &mem_ctx->shared_buf);
mem_ctx->shared_bo = NULL;
} }
static void psp_free_shared_bufs(struct psp_context *psp) static void psp_free_shared_bufs(struct psp_context *psp)
...@@ -182,6 +183,7 @@ static void psp_free_shared_bufs(struct psp_context *psp) ...@@ -182,6 +183,7 @@ static void psp_free_shared_bufs(struct psp_context *psp)
/* free TMR memory buffer */ /* free TMR memory buffer */
pptr = amdgpu_sriov_vf(psp->adev) ? &tmr_buf : NULL; pptr = amdgpu_sriov_vf(psp->adev) ? &tmr_buf : NULL;
amdgpu_bo_free_kernel(&psp->tmr_bo, &psp->tmr_mc_addr, pptr); amdgpu_bo_free_kernel(&psp->tmr_bo, &psp->tmr_mc_addr, pptr);
psp->tmr_bo = NULL;
/* free xgmi shared memory */ /* free xgmi shared memory */
psp_ta_free_shared_buf(&psp->xgmi_context.context.mem_context); psp_ta_free_shared_buf(&psp->xgmi_context.context.mem_context);
...@@ -743,7 +745,7 @@ static int psp_load_toc(struct psp_context *psp, ...@@ -743,7 +745,7 @@ static int psp_load_toc(struct psp_context *psp,
/* Set up Trusted Memory Region */ /* Set up Trusted Memory Region */
static int psp_tmr_init(struct psp_context *psp) static int psp_tmr_init(struct psp_context *psp)
{ {
int ret; int ret = 0;
int tmr_size; int tmr_size;
void *tmr_buf; void *tmr_buf;
void **pptr; void **pptr;
...@@ -770,10 +772,12 @@ static int psp_tmr_init(struct psp_context *psp) ...@@ -770,10 +772,12 @@ static int psp_tmr_init(struct psp_context *psp)
} }
} }
pptr = amdgpu_sriov_vf(psp->adev) ? &tmr_buf : NULL; if (!psp->tmr_bo) {
ret = amdgpu_bo_create_kernel(psp->adev, tmr_size, PSP_TMR_ALIGNMENT, pptr = amdgpu_sriov_vf(psp->adev) ? &tmr_buf : NULL;
AMDGPU_GEM_DOMAIN_VRAM, ret = amdgpu_bo_create_kernel(psp->adev, tmr_size, PSP_TMR_ALIGNMENT,
&psp->tmr_bo, &psp->tmr_mc_addr, pptr); AMDGPU_GEM_DOMAIN_VRAM,
&psp->tmr_bo, &psp->tmr_mc_addr, pptr);
}
return ret; return ret;
} }
...@@ -2732,8 +2736,6 @@ static int psp_suspend(void *handle) ...@@ -2732,8 +2736,6 @@ static int psp_suspend(void *handle)
} }
out: out:
psp_free_shared_bufs(psp);
return ret; return ret;
} }
......
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