drm/amdgpu/psp: always call psp_load_toc()
Subsystems (2)
Alex Deucher
maintainerPATCH 1/1 drm/amdgpu/psp: always call psp_load_toc()
We need to always call psp_load_toc() regardless of whether we re-allocate the TMR buffer or not. Fixes S4.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 42 ++++++++++++------------- 1 file changed, 21 insertions(+), 21 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +21 -21
@@ -750,29 +750,29 @@ static int psp_tmr_init(struct psp_context *psp)void *tmr_buf;void **pptr; -if (!psp->tmr_bo) { -/* -* According to HW engineer, they prefer the TMR address be "naturally -* aligned" , e.g. the start address be an integer divide of TMR size. -* -* Note: this memory need be reserved till the driver -* uninitializes. -*/ - tmr_size =PSP_TMR_SIZE (psp->adev); - -/* For ASICs support RLC autoload, psp will parse the toc -* and calculate the total size of TMR needed */ -if (!amdgpu_sriov_vf (psp->adev) && - psp->toc.start_addr && - psp->toc.size_bytes && - psp->fw_pri_buf) { - ret =psp_load_toc (psp, &tmr_size); -if (ret) { -DRM_ERROR ("Failed to load toc\n" ); -return ret; - } +/* +* According to HW engineer, they prefer the TMR address be "naturally +* aligned" , e.g. the start address be an integer divide of TMR size. +* +* Note: this memory need be reserved till the driver +* uninitializes. +*/ + tmr_size =PSP_TMR_SIZE (psp->adev); + +/* For ASICs support RLC autoload, psp will parse the toc +* and calculate the total size of TMR needed */ +if (!amdgpu_sriov_vf (psp->adev) && + psp->toc.start_addr && + psp->toc.size_bytes && + psp->fw_pri_buf) { + ret =psp_load_toc (psp, &tmr_size); +if (ret) { +DRM_ERROR ("Failed to load toc\n" ); +return ret; } + } +if (!psp->tmr_bo) { pptr =amdgpu_sriov_vf (psp->adev) ? &tmr_buf :NULL ; ret = amdgpu_bo_create_kernel(psp->adev, tmr_size, PSP_TMR_ALIGNMENT, AMDGPU_GEM_DOMAIN_VRAM,
Signature · 1 line
2.38.1
Quoted 3 lines · Alex Deucher
We need to always call
psp_load_toc()regardless of whether we re-allocate the TMR buffer or not. Fixes S4.
I guess this fixes all cases where psp_suspend is called (regression introduced by the fixes-tag patch) and not just S4. Suggest to refine the commit comment.
Thanks,
Lijo
Quoted 63 lines
Fixes 36238df85ade ("drm/amdgpu/psp: don't free PSP buffers on suspend")Reported-by Skikai Guo <[email protected]>Signed-off-by Alex Deucher <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 42 ++++++++++++------------- 1 file changed, 21 insertions(+), 21 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +21
-21@@ -750,29 +750,29 @@ static int psp_tmr_init(struct psp_context *psp)void *tmr_buf;void **pptr; -if (!psp->tmr_bo) { -/* -* According to HW engineer, they prefer the TMR address be "naturally -* aligned" , e.g. the start address be an integer divide of TMR size. -* -* Note: this memory need be reserved till the driver -* uninitializes. -*/ - tmr_size =PSP_TMR_SIZE (psp->adev); - -/* For ASICs support RLC autoload, psp will parse the toc -* and calculate the total size of TMR needed */ -if (!amdgpu_sriov_vf (psp->adev) && - psp->toc.start_addr && - psp->toc.size_bytes && - psp->fw_pri_buf) { - ret =psp_load_toc (psp, &tmr_size); -if (ret) { -DRM_ERROR ("Failed to load toc\n" ); -return ret; - } +/* +* According to HW engineer, they prefer the TMR address be "naturally +* aligned" , e.g. the start address be an integer divide of TMR size. +* +* Note: this memory need be reserved till the driver +* uninitializes. +*/ + tmr_size =PSP_TMR_SIZE (psp->adev); + +/* For ASICs support RLC autoload, psp will parse the toc +* and calculate the total size of TMR needed */ +if (!amdgpu_sriov_vf (psp->adev) && + psp->toc.start_addr && + psp->toc.size_bytes && + psp->fw_pri_buf) { + ret =psp_load_toc (psp, &tmr_size); +if (ret) { +DRM_ERROR ("Failed to load toc\n" ); +return ret; } + } +if (!psp->tmr_bo) { pptr =amdgpu_sriov_vf (psp->adev) ? &tmr_buf :NULL ; ret = amdgpu_bo_create_kernel(psp->adev, tmr_size, PSP_TMR_ALIGNMENT, AMDGPU_GEM_DOMAIN_VRAM,
[AMD Official Use Only - General]
-----Original Message-----
From: Deucher, Alexander <[email protected]>
Sent: Wednesday, November 23, 2022 10:00 PM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Guo, Shikai <[email protected]>
Subject: [PATCH] drm/amdgpu/psp: always call psp_load_toc()
We need to always call psp_load_toc() regardless of whether we re-allocate the TMR buffer or not. Fixes S4.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 42 ++++++++++++------------- 1 file changed, 21 insertions(+), 21 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +21 -21
@@ -750,29 +750,29 @@ static int psp_tmr_init(struct psp_context *psp)void *tmr_buf;void **pptr; -if (!psp->tmr_bo) { -/* -* According to HW engineer, they prefer the TMR address be "naturally -* aligned" , e.g. the start address be an integer divide of TMR size. -* -* Note: this memory need be reserved till the driver -* uninitializes. -*/ - tmr_size =PSP_TMR_SIZE (psp->adev); - -/* For ASICs support RLC autoload, psp will parse the toc -* and calculate the total size of TMR needed */ -if (!amdgpu_sriov_vf (psp->adev) && - psp->toc.start_addr && - psp->toc.size_bytes && - psp->fw_pri_buf) { - ret =psp_load_toc (psp, &tmr_size); -if (ret) { -DRM_ERROR ("Failed to load toc\n" ); -return ret; - } +/* +* According to HW engineer, they prefer the TMR address be "naturally +* aligned" , e.g. the start address be an integer divide of TMR size. +* +* Note: this memory need be reserved till the driver +* uninitializes. +*/ + tmr_size =PSP_TMR_SIZE (psp->adev); + +/* For ASICs support RLC autoload, psp will parse the toc +* and calculate the total size of TMR needed */ +if (!amdgpu_sriov_vf (psp->adev) && + psp->toc.start_addr && + psp->toc.size_bytes && + psp->fw_pri_buf) { + ret =psp_load_toc (psp, &tmr_size); +if (ret) { +DRM_ERROR ("Failed to load toc\n" ); +return ret; } + } +if (!psp->tmr_bo) { pptr =amdgpu_sriov_vf (psp->adev) ? &tmr_buf :NULL ; ret = amdgpu_bo_create_kernel(psp->adev, tmr_size, PSP_TMR_ALIGNMENT, AMDGPU_GEM_DOMAIN_VRAM,
--
2.38.1