[PATCH] drm/amdgpu/psp: always call psp_load_toc()

Lazar, Lijo lijo.lazar at amd.com
Thu Nov 24 03:10:05 UTC 2022



On 11/23/2022 7:30 PM, Alex Deucher wrote:
> 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.

Reviewed-by: Lijo Lazar <lijo.lazar at amd.com>

Thanks,
Lijo
	
> 
> Fixes: 36238df85ade ("drm/amdgpu/psp: don't free PSP buffers on suspend")
> Reported-by: Skikai Guo <shikai.guo at amd.com>
> Signed-off-by: Alex Deucher <alexander.deucher at amd.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 42 ++++++++++++-------------
>   1 file changed, 21 insertions(+), 21 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
> index 621723f510a9..7978307e1d6d 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
> @@ -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,


More information about the amd-gfx mailing list