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

Chen, Guchun Guchun.Chen at amd.com
Thu Mar 17 13:22:40 UTC 2022


Thanks for the info, Christian, and I will abandon this patch. We don’t have a generic amdgpu_gmc_sw_fini.

Regards,
Guchun

-----Original Message-----
From: Koenig, Christian <Christian.Koenig at amd.com> 
Sent: Thursday, March 17, 2022 8:55 PM
To: Chen, Guchun <Guchun.Chen at amd.com>; Christian König <ckoenig.leichtzumerken at gmail.com>; amd-gfx at lists.freedesktop.org; Zhang, Hawking <Hawking.Zhang at amd.com>; Pan, Xinhui <Xinhui.Pan at amd.com>; Deucher, Alexander <Alexander.Deucher at amd.com>
Subject: Re: [PATCH] drm/amdgpu: move PDB bo release into a generic gmc function

Mhm, actually that is indeed purely gmc 9 specific.

This is a workaround for a very specific hardware bug issue which will hopefully never happen again :)

We just implemented it in the common handler to be able to test it with gmc 8 before gmc 9 came out of production.

Do we have a generic amdgpu_gmc_sw_finit()? If yes I would put it there instead, if no we might want to create one.

Regards,
Christian.

Am 17.03.22 um 13:50 schrieb Chen, Guchun:
> Hi Christian,
>
> My intention is to use a paired generic gmc alloc/free function to proceed PDB bo. Current code is gmc v9 code calls amdgpu_gmc_pdb0_alloc to allocate PDB bo buffer, and release the bo directly in gmc_v9_0_sw_fini. I guess PDB bo is not a gmc v9 specific buffer, so it's better to use a release function from amdgpu_gem.c in fini. This may benefit the case that users do the same in GMC newer IP code.
>
> Regards,
> Guchun
>
> -----Original Message-----
> From: Christian König <ckoenig.leichtzumerken at gmail.com>
> Sent: Thursday, March 17, 2022 8:14 PM
> To: Chen, Guchun <Guchun.Chen at amd.com>; amd-gfx at lists.freedesktop.org; 
> Zhang, Hawking <Hawking.Zhang at amd.com>; Koenig, Christian 
> <Christian.Koenig at amd.com>; Pan, Xinhui <Xinhui.Pan at amd.com>; Deucher, 
> Alexander <Alexander.Deucher at amd.com>
> Subject: Re: [PATCH] drm/amdgpu: move PDB bo release into a generic 
> gmc function
>
> 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