[RFC PATCH v2] drm/amdgpu: move ttm bo->offset to amdgpu_bo

Christian König ckoenig.leichtzumerken at gmail.com
Tue Feb 11 15:16:37 UTC 2020


Am 11.02.20 um 15:54 schrieb Nirmoy:
>
>
> On 2/11/20 3:09 PM, Christian König wrote:
>> Am 11.02.20 um 15:06 schrieb Nirmoy Das:
>>> GPU address should belong to driver not in memory management.
>>> This patch moves ttm bo.offset and gpu_offset calculation to amdgpu 
>>> driver.
>>>
>>> Signed-off-by: Nirmoy Das <nirmoy.das at amd.com>
>>> ---
>>>   drivers/gpu/drm/amd/amdgpu/amdgpu_object.c  | 22 
>>> +++++++++++++++++++--
>>>   drivers/gpu/drm/amd/amdgpu/amdgpu_object.h  |  1 +
>>>   drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c     |  8 +-------
>>>   drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c |  4 ++--
>>>   4 files changed, 24 insertions(+), 11 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c 
>>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
>>> index 6f60a581e3ba..e25924be33ca 100644
>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
>>> @@ -917,7 +917,7 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo 
>>> *bo, u32 domain,
>>>           bo->pin_count++;
>>>             if (max_offset != 0) {
>>> -            u64 domain_start = bo->tbo.bdev->man[mem_type].gpu_offset;
>>> +            u64 domain_start = amdgpu_bo_gpu_start(adev, mem_type);
>>>               WARN_ON_ONCE(max_offset <
>>>                        (amdgpu_bo_gpu_offset(bo) - domain_start));
>>>           }
>>> @@ -1248,6 +1248,18 @@ int amdgpu_bo_get_metadata(struct amdgpu_bo 
>>> *bo, void *buffer,
>>>       return 0;
>>>   }
>>>   +uint64_t amdgpu_bo_gpu_start(struct amdgpu_device *adev, uint32_t 
>>> type)
>>
>> Probably better to put that into amdgpu_ttm.[ch] or amdgpu_gmc.[ch] 
>> and name it an amdgpu_ttm_domain_start.
>>
>>> +{
>>> +    switch(type) {
>>> +        case TTM_PL_TT:
>>
>> Coding style here is of, what editor and setting do you use?
> vi with *set tabstop=8 softtabstop=8 shiftwidth=8 noexpandtab cindent*
>
>
> My bad, I didn't check existing switch style.
>

Try this one here: https://github.com/vivien/vim-linux-coding-style

That should help,
Christian.

>
> Regards,
>
> Nirmoy
>
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/amd-gfx/attachments/20200211/d5bfc66f/attachment.htm>


More information about the amd-gfx mailing list