This is a note to let you know that I've just added the patch titled drm/amdgpu/psp: don't free PSP buffers on suspend to the 6.0-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: drm-amdgpu-psp-don-t-free-psp-buffers-on-suspend.patch and it can be found in the queue-6.0 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 4f2bea62cf3874c5a58e987b0b472f9fb57117a2 Mon Sep 17 00:00:00 2001 From: Alex Deucher <alexander.deucher@xxxxxxx> Date: Wed, 16 Nov 2022 11:26:53 -0500 Subject: drm/amdgpu/psp: don't free PSP buffers on suspend MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Alex Deucher <alexander.deucher@xxxxxxx> commit 4f2bea62cf3874c5a58e987b0b472f9fb57117a2 upstream. We can reuse the same buffers on resume. v2: squash in S4 fix from Shikai Bug: https://gitlab.freedesktop.org/drm/amd/-/issues/2213 Reviewed-by: Christian König <christian.koenig@xxxxxxx> Tested-by: Guilherme G. Piccoli <gpiccoli@xxxxxxxxxx> Signed-off-by: Alex Deucher <alexander.deucher@xxxxxxx> Cc: stable@xxxxxxxxxxxxxxx Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c @@ -171,6 +171,7 @@ void psp_ta_free_shared_buf(struct ta_me { amdgpu_bo_free_kernel(&mem_ctx->shared_bo, &mem_ctx->shared_mc_addr, &mem_ctx->shared_buf); + mem_ctx->shared_bo = NULL; } static void psp_free_shared_bufs(struct psp_context *psp) @@ -181,6 +182,7 @@ static void psp_free_shared_bufs(struct /* free TMR memory buffer */ pptr = amdgpu_sriov_vf(psp->adev) ? &tmr_buf : NULL; amdgpu_bo_free_kernel(&psp->tmr_bo, &psp->tmr_mc_addr, pptr); + psp->tmr_bo = NULL; /* free xgmi shared memory */ psp_ta_free_shared_buf(&psp->xgmi_context.context.mem_context); @@ -728,7 +730,7 @@ static int psp_load_toc(struct psp_conte /* Set up Trusted Memory Region */ static int psp_tmr_init(struct psp_context *psp) { - int ret; + int ret = 0; int tmr_size; void *tmr_buf; void **pptr; @@ -755,10 +757,12 @@ static int psp_tmr_init(struct psp_conte } } - 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, - &psp->tmr_bo, &psp->tmr_mc_addr, pptr); + 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, + &psp->tmr_bo, &psp->tmr_mc_addr, pptr); + } return ret; } @@ -2720,8 +2724,6 @@ static int psp_suspend(void *handle) } out: - psp_free_shared_bufs(psp); - return ret; } Patches currently in stable-queue which might be from alexander.deucher@xxxxxxx are queue-6.0/drm-amdgpu-partially-revert-drm-amdgpu-update-drm_display_info-correctly-when-the-edid-is-read.patch queue-6.0/drm-amdgpu-drop-eviction-lock-when-allocating-pt-bo.patch queue-6.0/drm-amd-display-no-display-after-resume-from-wb-cb.patch queue-6.0/drm-amd-display-zeromem-mypipe-heap-struct-before-us.patch queue-6.0/drm-amdgpu-enable-sa-software-trap.patch queue-6.0/drm-amdgpu-disable-baco-support-on-more-cards.patch queue-6.0/drm-amd-display-update-soc-bounding-box-for-dcn32-dcn321.patch queue-6.0/drm-amdgpu-always-register-an-mmu-notifier-for-userptr.patch queue-6.0/drm-amd-display-add-debug-option-for-allocating-extr.patch queue-6.0/drm-amd-display-added-debug-option-for-forcing-subvp.patch queue-6.0/drm-amdgpu-enable-aldebaran-devices-to-report-cu-occupancy.patch queue-6.0/revert-drm-amdgpu-revert-drm-amdgpu-getting-fan-spee.patch queue-6.0/drm-amd-display-use-uclk-pstate-latency-for-fw-assis.patch queue-6.0/drm-amd-display-fix-calculation-for-cursor-cab-alloc.patch queue-6.0/drm-amd-display-only-fill-dirty-rectangles-when-psr-.patch queue-6.0/drm-amd-display-fix-gpio-port-mapping-issue.patch queue-6.0/drm-amd-dc-dce120-fix-audio-register-mapping-stop-triggering-kasan.patch queue-6.0/drm-amd-display-update-mall-ss-numways-calculation.patch queue-6.0/drm-amd-display-fix-fclk-deviation-and-tool-compile-.patch queue-6.0/drm-display-dp_mst-fix-drm_dp_mst_add_affected_dsc_crtcs-return-code.patch queue-6.0/drm-amdkfd-update-gfx11-cwsr-trap-handler.patch queue-6.0/drm-amdgpu-psp-don-t-free-psp-buffers-on-suspend.patch queue-6.0/drm-amd-amdgpu-reserve-vm-invalidation-engine-for-firmware.patch queue-6.0/drm-amdkfd-fix-a-memory-limit-issue.patch