[PATCH] drm/amdgpu: use adev_to_drm to get drm_device

Felix Kuehling felix.kuehling at amd.com
Wed Jun 9 15:32:11 UTC 2021


Am 2021-06-09 um 11:20 a.m. schrieb Luben Tuikov:
> On 2021-06-09 10:01 a.m., Felix Kuehling wrote:
>> Am 2021-06-09 um 5:23 a.m. schrieb Guchun Chen:
>>> Fixes:
>>> 9faf262c32d3 drm/amdgpu: Add DMA mapping of GTT BOs
>>> 090f3a60d7e8 drm/amdgpu: Use delayed work to collect RAS error counters
>> A Fixes tag implies that something was broken. However, the
>> implementation of adev_to_drm does the exact same thing. I don't see the
>> point of this patch. It doesn't fix any problem, and IMHO doesn't make
>> the code more readable.
> We added this due to some changes in DRM:
>
> 8aba21b75136c3 drm/amdgpu: Embed drm_device into amdgpu_device (v3)
> 4a580877bdcb83 drm/amdgpu: Get DRM dev from adev by inline-f
>
> It's good to use this inline function, to accommodate more flexible DRM.

Thanks for the explanation. I found your changes as well and it makes
sense now, especially for the DKMS branch. Unfortunately that's not a
justification we can use for upstream.

Regards,
  Felix


>
> Regards,
> Luben
>
>> Regards,
>>   Felix
>>
>>
>>> Signed-off-by: Guchun Chen <guchun.chen at amd.com>
>>> ---
>>>  drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 2 +-
>>>  drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c          | 2 +-
>>>  2 files changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
>>> index 016815b7a773..fb6bcc386de1 100644
>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
>>> @@ -639,7 +639,7 @@ kfd_mem_attach_dmabuf(struct amdgpu_device *adev, struct kgd_mem *mem,
>>>  		}
>>>  	}
>>>  
>>> -	gobj = amdgpu_gem_prime_import(&adev->ddev, mem->dmabuf);
>>> +	gobj = amdgpu_gem_prime_import(adev_to_drm(adev), mem->dmabuf);
>>>  	if (IS_ERR(gobj))
>>>  		return PTR_ERR(gobj);
>>>  
>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
>>> index ec936cde2726..bfbcb9ff2453 100644
>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
>>> @@ -2122,7 +2122,7 @@ static void amdgpu_ras_counte_dw(struct work_struct *work)
>>>  	struct amdgpu_ras *con = container_of(work, struct amdgpu_ras,
>>>  					      ras_counte_delay_work.work);
>>>  	struct amdgpu_device *adev = con->adev;
>>> -	struct drm_device *dev = &adev->ddev;
>>> +	struct drm_device *dev = adev_to_drm(adev->ddev);
>>>  	unsigned long ce_count, ue_count;
>>>  	int res;
>>>  


More information about the amd-gfx mailing list