[PATCH 04/37] drm/amdgpu: Implement get_local_mem_info

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2018-01-04 06:54 PM, Felix Kuehling wrote:
> I see. resource_size_t (alias for phys_addr_t) is u64 on x86 and x86_64.
> But probably only u32 on ARM-32. This depends on
> CONFIG_PHYS_ADDR_T_64BIT: include/linux/types.h:
>
>     #ifdef CONFIG_PHYS_ADDR_T_64BIT
>     typedef u64 phys_addr_t;
>     #else
>     typedef u32 phys_addr_t;
>     #endif
>
> The easiest solution is probably to define aper_limit as uint64_t.

That said, KFD isn't supported on 32-bit kernels anyway. We probably
don't need to compile this file at all on 32-bit kernels. That would
probably need more changes elsewhere to make sure no one tries to call
these functions on 32-bit kernels, or define empty stubs.

>
> Regards,
>   Felix
>
>
> On 2018-01-04 06:35 PM, Dave Airlie wrote:
>> On 9 December 2017 at 14:08, Felix Kuehling <Felix.Kuehling at amd.com> wrote:
>>> From: Harish Kasiviswanathan <Harish.Kasiviswanathan at amd.com>
>>>
>>> Implement new kgd-kfd interface function get_local_mem_info.
>>>
>>> Signed-off-by: Harish Kasiviswanathan <Harish.Kasiviswanathan at amd.com>
>>> Signed-off-by: Ben Goz <ben.goz at amd.com>
>>> Signed-off-by: Felix Kuehling <Felix.Kuehling at amd.com>
>>> ---
>>>  drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c        | 30 +++++++++++++++++++++++
>>>  drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h        |  2 ++
>>>  drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v7.c |  1 +
>>>  drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v8.c |  1 +
>>>  4 files changed, 34 insertions(+)
>>>
>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c
>>> index cfb7827..56f6c12 100644
>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c
>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c
>>> @@ -252,6 +252,36 @@ uint64_t get_vmem_size(struct kgd_dev *kgd)
>>>         return adev->mc.real_vram_size;
>>>  }
>>>
>>> +void get_local_mem_info(struct kgd_dev *kgd,
>>> +                       struct kfd_local_mem_info *mem_info)
>>> +{
>>> +       struct amdgpu_device *adev = (struct amdgpu_device *)kgd;
>>> +       uint64_t address_mask = adev->dev->dma_mask ? ~*adev->dev->dma_mask :
>>> +                                            ~((1ULL << 32) - 1);
>>> +       resource_size_t aper_limit = adev->mc.aper_base + adev->mc.aper_size;
>>> +
>>> +       memset(mem_info, 0, sizeof(*mem_info));
>>> +       if (!(adev->mc.aper_base & address_mask || aper_limit & address_mask)) {
>>> +               mem_info->local_mem_size_public = adev->mc.visible_vram_size;
>>> +               mem_info->local_mem_size_private = adev->mc.real_vram_size -
>>> +                               adev->mc.visible_vram_size;
>>> +       } else {
>>> +               mem_info->local_mem_size_public = 0;
>>> +               mem_info->local_mem_size_private = adev->mc.real_vram_size;
>>> +       }
>>> +       mem_info->vram_width = adev->mc.vram_width;
>>> +
>>> +       pr_debug("Address base: 0x%llx limit 0x%llx public 0x%llx private 0x%llx\n",
>>> +                       adev->mc.aper_base, aper_limit,
>>> +                       mem_in/home/airlied/devel/kernel/drm-next/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.cfo->local_mem_size_public,
>>> +                       mem_info->local_mem_size_private);
>> This patches introduces:
>>
>> In file included from
>> /home/airlied/devel/kernel/drm-next/include/linux/kernel.h:14:0,
>>                  from
>> /home/airlied/devel/kernel/drm-next/include/asm-generic/bug.h:18,
>>                  from
>> /home/airlied/devel/kernel/drm-next/arch/arm/include/asm/bug.h:60,
>>                  from /home/airlied/devel/kernel/drm-next/include/linux/bug.h:5,
>>                  from
>> /home/airlied/devel/kernel/drm-next/include/linux/thread_info.h:12,
>>                  from
>> /home/airlied/devel/kernel/drm-next/include/asm-generic/current.h:5,
>>                  from ./arch/arm/include/generated/asm/current.h:1,
>>                  from
>> /home/airlied/devel/kernel/drm-next/include/linux/sched.h:12,
>>                  from
>> /home/airlied/devel/kernel/drm-next/arch/arm/include/asm/mmu_context.h:17,
>>                  from
>> /home/airlied/devel/kernel/drm-next/include/linux/mmu_context.h:5,
>>                  from
>> /home/airlied/devel/kernel/drm-next/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h:29,
>>                  from
>> /home/airlied/devel/kernel/drm-next/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c:23:
>> /home/airlied/devel/kernel/drm-next/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c:
>> In function â??get_local_mem_infoâ??:
>> /home/airlied/devel/kernel/drm-next/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c:297:11:
>> warning: format â??%llxâ?? expects argument of type â??long long unsigned
>> intâ??, but argument 3 has type â??resource_size_t {aka unsigned int}â??
>> [-Wformat=]
>>   pr_debug("Address base: 0x%llx limit 0x%llx public 0x%llx private 0x%llx\n",
>>            ^
>> /home/airlied/devel/kernel/drm-next/include/linux/printk.h:285:21:
>> note: in definition of macro â??pr_fmtâ??
>>  #define pr_fmt(fmt) fmt
>>                      ^~~
>> /home/airlied/devel/kernel/drm-next/include/linux/printk.h:333:2:
>> note: in expansion of macro â??dynamic_pr_debugâ??
>>   dynamic_pr_debug(fmt, ##__VA_ARGS__)
>>   ^~~~~~~~~~~~~~~~
>> /home/airlied/devel/kernel/drm-next/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c:297:2:
>> note: in expansion of macro â??pr_debugâ??
>>   pr_debug("Address base: 0x%llx limit 0x%llx public 0x%llx private 0x%llx\n",
>>   ^~~~~~~~
>> /home/airlied/devel/kernel/drm-next/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c:297:11:
>> warning: format â??%llxâ?? expects argument of type â??long long unsigned
>> intâ??, but argument 4 has type â??resource_size_t {aka unsigned int}â??
>> [-Wformat=]
>>   pr_debug("Address base: 0x%llx limit 0x%llx public 0x%llx private 0x%llx\n",
>>            ^
>> /home/airlied/devel/kernel/drm-next/include/linux/printk.h:285:21:
>> note: in definition of macro â??pr_fmtâ??
>>  #define pr_fmt(fmt) fmt
>>                      ^~~
>> /home/airlied/devel/kernel/drm-next/include/linux/printk.h:333:2:
>> note: in expansion of macro â??dynamic_pr_debugâ??
>>   dynamic_pr_debug(fmt, ##__VA_ARGS__)
>>   ^~~~~~~~~~~~~~~~
>> /home/airlied/devel/kernel/drm-next/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c:297:2:
>> note: in expansion of macro â??pr_debugâ??
>>   pr_debug("Address base: 0x%llx limit 0x%llx public 0x%llx private 0x%llx\n",
>>   ^~~~~~~~
>>
>> On 32-bit arm build.
>>
>> Dave.
> _______________________________________________
> amd-gfx mailing list
> amd-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx



[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux