[PATCH] drm/amdgpu: fix warning of drm_mm_clean

Christian König christian.koenig at amd.com
Mon Mar 31 12:06:30 UTC 2025


Am 31.03.25 um 13:26 schrieb ZhenGuo Yin:
> Kernel doorbell BOs needs to be freed before ttm_fini.

Good catch, but does anybody remember why we have the drm_dev_enter()/drm_dev_exit() here?

It's clearly for hotplug, but it doesn't make sense to have the amdgpu_doorbell_fini() under it as far as I can see.

Regards,
Christian.

>
> Fixes: 54c30d2a8def ("drm/amdgpu: create kernel doorbell pages")
> Signed-off-by: ZhenGuo Yin <zhenguo.yin at amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 15 +++++++--------
>  1 file changed, 7 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> index d4b01ef00025..b49604ade6c2 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> @@ -4807,6 +4807,13 @@ void amdgpu_device_fini_sw(struct amdgpu_device *adev)
>  	int i, idx;
>  	bool px;
>  
> +	if (drm_dev_enter(adev_to_drm(adev), &idx)) {
> +		iounmap(adev->rmmio);
> +		adev->rmmio = NULL;
> +		amdgpu_doorbell_fini(adev);
> +		drm_dev_exit(idx);
> +	}
> +
>  	amdgpu_device_ip_fini(adev);
>  	amdgpu_fence_driver_sw_fini(adev);
>  	amdgpu_ucode_release(&adev->firmware.gpu_info_fw);
> @@ -4847,14 +4854,6 @@ void amdgpu_device_fini_sw(struct amdgpu_device *adev)
>  	if ((adev->pdev->class >> 8) == PCI_CLASS_DISPLAY_VGA)
>  		vga_client_unregister(adev->pdev);
>  
> -	if (drm_dev_enter(adev_to_drm(adev), &idx)) {
> -
> -		iounmap(adev->rmmio);
> -		adev->rmmio = NULL;
> -		amdgpu_doorbell_fini(adev);
> -		drm_dev_exit(idx);
> -	}
> -
>  	if (IS_ENABLED(CONFIG_PERF_EVENTS))
>  		amdgpu_pmu_fini(adev);
>  	if (adev->mman.discovery_bin)



More information about the amd-gfx mailing list