Re: [PATCH v2] drm/amdgpu/gfx7,8: remove redundant RLC cleanup

From: Alex Deucher

Date: Thu Oct 15 2026 - 10:09:51 EST


On Wed, Oct 14, 2026 at 8:41 PM Willian Oliveira
<williandossantosdeoliveira287@xxxxxxxxx> wrote:
>
> gfx_v7_0_sw_fini() and gfx_v8_0_sw_fini() already call
> amdgpu_gfx_rlc_fini(), which releases the RLC objects used by these
> IP blocks.
>
> Remove the duplicated explicit frees of clear_state_obj and
> cp_table_obj.
>
> Signed-off-by: Willian Oliveira <williandossantosdeoliveira287@xxxxxxxxx>

Reviewed-by: Alex Deucher <alexander.deucher@xxxxxxx>
and applied.

> ---
> v2:
> - Keep amdgpu_gfx_rlc_fini() and remove the explicit RLC object frees
> as suggested by Alex Deucher.
> - Apply the same cleanup to gfx7.
>
> drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c | 8 --------
> drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 9 ---------
> 2 files changed, 17 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
> index 5fc19fefca81..7c56e36665c7 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
> @@ -4454,14 +4454,6 @@ static int gfx_v7_0_sw_fini(struct amdgpu_ip_block *ip_block)
> amdgpu_gfx_mqd_sw_fini(adev, 0);
> amdgpu_gfx_rlc_fini(adev);
> gfx_v7_0_mec_fini(adev);
> - amdgpu_bo_free_kernel(&adev->gfx.rlc.clear_state_obj,
> - &adev->gfx.rlc.clear_state_gpu_addr,
> - (void **)&adev->gfx.rlc.cs_ptr);
> - if (adev->gfx.rlc.cp_table_size) {
> - amdgpu_bo_free_kernel(&adev->gfx.rlc.cp_table_obj,
> - &adev->gfx.rlc.cp_table_gpu_addr,
> - (void **)&adev->gfx.rlc.cp_table_ptr);
> - }
> gfx_v7_0_free_microcode(adev);
>
> return 0;
> diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
> index 7f91186ef1d1..27fbb5b59645 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
> @@ -2060,15 +2060,6 @@ static int gfx_v8_0_sw_fini(struct amdgpu_ip_block *ip_block)
>
> gfx_v8_0_mec_fini(adev);
> amdgpu_gfx_rlc_fini(adev);
> - amdgpu_bo_free_kernel(&adev->gfx.rlc.clear_state_obj,
> - &adev->gfx.rlc.clear_state_gpu_addr,
> - (void **)&adev->gfx.rlc.cs_ptr);
> - if ((adev->asic_type == CHIP_CARRIZO) ||
> - (adev->asic_type == CHIP_STONEY)) {
> - amdgpu_bo_free_kernel(&adev->gfx.rlc.cp_table_obj,
> - &adev->gfx.rlc.cp_table_gpu_addr,
> - (void **)&adev->gfx.rlc.cp_table_ptr);
> - }
> gfx_v8_0_free_microcode(adev);
>
> return 0;
> --
> 2.47.3
>