Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/amd/amdgpu: add info about vram and gtt total size

Signed-off-by: Junwei Zhang <Jerry.Zhang@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Junwei Zhang and committed by
Alex Deucher
9f6163e7 46c9cc11

+18
+10
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
··· 411 411 return copy_to_user(out, &vram_gtt, 412 412 min((size_t)size, sizeof(vram_gtt))) ? -EFAULT : 0; 413 413 } 414 + case AMDGPU_INFO_VRAM_GTT_TOTAL: { 415 + struct drm_amdgpu_info_vram_gtt_total vram_gtt_total; 416 + 417 + vram_gtt_total.vram_total_size = adev->mc.real_vram_size; 418 + vram_gtt_total.vram_cpu_accessible_total_size = adev->mc.visible_vram_size; 419 + vram_gtt_total.gtt_total_size = adev->mc.gtt_size; 420 + return copy_to_user(out, &vram_gtt_total, 421 + min((size_t)size, sizeof(vram_gtt_total))) 422 + ? -EFAULT : 0; 423 + } 414 424 case AMDGPU_INFO_READ_MMR_REG: { 415 425 unsigned n, alloc_size; 416 426 uint32_t *regs;
+8
include/uapi/drm/amdgpu_drm.h
··· 487 487 #define AMDGPU_INFO_VIS_VRAM_USAGE 0x17 488 488 /* number of TTM buffer evictions */ 489 489 #define AMDGPU_INFO_NUM_EVICTIONS 0x18 490 + /* Query the total size of VRAM and GTT domains */ 491 + #define AMDGPU_INFO_VRAM_GTT_TOTAL 0x19 490 492 491 493 #define AMDGPU_INFO_MMR_SE_INDEX_SHIFT 0 492 494 #define AMDGPU_INFO_MMR_SE_INDEX_MASK 0xff ··· 572 570 __u64 vram_size; 573 571 __u64 vram_cpu_accessible_size; 574 572 __u64 gtt_size; 573 + }; 574 + 575 + struct drm_amdgpu_info_vram_gtt_total { 576 + __u64 vram_total_size; 577 + __u64 vram_cpu_accessible_total_size; 578 + __u64 gtt_total_size; 575 579 }; 576 580 577 581 struct drm_amdgpu_info_firmware {