[PATCH] drm/amdgpu: move PDB bo release into a generic gmc function

Christian König ckoenig.leichtzumerken at gmail.com
Thu Mar 17 12:14:27 UTC 2022


Am 17.03.22 um 12:21 schrieb Guchun Chen:
> To pair with amdgpu_gmc_pdb0_alloc as a more generic handling
> in amdgpu_gmc.c, no functional change.
>
> Signed-off-by: Guchun Chen <guchun.chen at amd.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c | 6 ++++++
>   drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h | 1 +
>   drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c   | 2 +-
>   3 files changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
> index 7021e8f390bd..36f6b321438f 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
> @@ -136,6 +136,12 @@ uint64_t amdgpu_gmc_pd_addr(struct amdgpu_bo *bo)
>   	return pd_addr;
>   }
>   
> +/* amdgpu_gmc_pdb0_free - free pdb0 vram */
> +void amdgpu_gmc_pdb0_free(struct amdgpu_device *adev)
> +{
> +	amdgpu_bo_free_kernel(&adev->gmc.pdb0_bo, NULL, &adev->gmc.ptr_pdb0);
> +}
> +

Single line function usually doesn't look that useful to me.

Why is that any improvement?

Regards,
Christian.

>   /**
>    * amdgpu_gmc_set_pte_pde - update the page tables using CPU
>    *
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h
> index 032b0313f277..6f425e3a9b6e 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h
> @@ -299,6 +299,7 @@ static inline uint64_t amdgpu_gmc_sign_extend(uint64_t addr)
>   }
>   
>   int amdgpu_gmc_pdb0_alloc(struct amdgpu_device *adev);
> +void amdgpu_gmc_pdb0_free(struct amdgpu_device *adev);
>   void amdgpu_gmc_get_pde_for_bo(struct amdgpu_bo *bo, int level,
>   			       uint64_t *addr, uint64_t *flags);
>   int amdgpu_gmc_set_pte_pde(struct amdgpu_device *adev, void *cpu_pt_addr,
> diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
> index 08ceabd6c853..ad600f72a51c 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
> @@ -1721,7 +1721,7 @@ static int gmc_v9_0_sw_fini(void *handle)
>   	amdgpu_gem_force_release(adev);
>   	amdgpu_vm_manager_fini(adev);
>   	amdgpu_gart_table_vram_free(adev);
> -	amdgpu_bo_free_kernel(&adev->gmc.pdb0_bo, NULL, &adev->gmc.ptr_pdb0);
> +	amdgpu_gmc_pdb0_free(adev);
>   	amdgpu_bo_fini(adev);
>   
>   	return 0;



More information about the amd-gfx mailing list