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

Nirmoy nirmodas at amd.com
Tue Feb 11 14:54:48 UTC 2020


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.


Regards,

Nirmoy

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


More information about the amd-gfx mailing list