diff options
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 18 | ||||
-rw-r--r-- | include/uapi/drm/amdgpu_drm.h | 8 |
2 files changed, 26 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c index 67b6274e25c8..09b94901faec 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | |||
@@ -421,6 +421,24 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file | |||
421 | min((size_t)size, sizeof(vram_gtt_total))) | 421 | min((size_t)size, sizeof(vram_gtt_total))) |
422 | ? -EFAULT : 0; | 422 | ? -EFAULT : 0; |
423 | } | 423 | } |
424 | case AMDGPU_INFO_VRAM_GTT_MAX: { | ||
425 | struct drm_amdgpu_info_vram_gtt_max vram_gtt_max; | ||
426 | u64 max_size; | ||
427 | |||
428 | max_size = adev->mc.real_vram_size - adev->vram_pin_size; | ||
429 | vram_gtt_max.vram_max_size = max_size * 3 / 4; | ||
430 | |||
431 | max_size = adev->mc.visible_vram_size - (adev->vram_pin_size - | ||
432 | adev->invisible_pin_size); | ||
433 | vram_gtt_max.vram_cpu_accessible_max_size = max_size * 3 / 4; | ||
434 | |||
435 | max_size = adev->mc.gtt_size - adev->gart_pin_size; | ||
436 | vram_gtt_max.gtt_max_size = max_size * 3 / 4; | ||
437 | |||
438 | return copy_to_user(out, &vram_gtt_max, | ||
439 | min((size_t)size, sizeof(vram_gtt_max))) | ||
440 | ? -EFAULT : 0; | ||
441 | } | ||
424 | case AMDGPU_INFO_READ_MMR_REG: { | 442 | case AMDGPU_INFO_READ_MMR_REG: { |
425 | unsigned n, alloc_size; | 443 | unsigned n, alloc_size; |
426 | uint32_t *regs; | 444 | uint32_t *regs; |
diff --git a/include/uapi/drm/amdgpu_drm.h b/include/uapi/drm/amdgpu_drm.h index dbfce2035b1f..0db0d66dc2ba 100644 --- a/include/uapi/drm/amdgpu_drm.h +++ b/include/uapi/drm/amdgpu_drm.h | |||
@@ -489,6 +489,8 @@ struct drm_amdgpu_cs_chunk_data { | |||
489 | #define AMDGPU_INFO_NUM_EVICTIONS 0x18 | 489 | #define AMDGPU_INFO_NUM_EVICTIONS 0x18 |
490 | /* Query the total size of VRAM and GTT domains */ | 490 | /* Query the total size of VRAM and GTT domains */ |
491 | #define AMDGPU_INFO_VRAM_GTT_TOTAL 0x19 | 491 | #define AMDGPU_INFO_VRAM_GTT_TOTAL 0x19 |
492 | /* Query the max allocation size of VRAM and GTT domains */ | ||
493 | #define AMDGPU_INFO_VRAM_GTT_MAX 0x1a | ||
492 | 494 | ||
493 | #define AMDGPU_INFO_MMR_SE_INDEX_SHIFT 0 | 495 | #define AMDGPU_INFO_MMR_SE_INDEX_SHIFT 0 |
494 | #define AMDGPU_INFO_MMR_SE_INDEX_MASK 0xff | 496 | #define AMDGPU_INFO_MMR_SE_INDEX_MASK 0xff |
@@ -580,6 +582,12 @@ struct drm_amdgpu_info_vram_gtt_total { | |||
580 | __u64 gtt_total_size; | 582 | __u64 gtt_total_size; |
581 | }; | 583 | }; |
582 | 584 | ||
585 | struct drm_amdgpu_info_vram_gtt_max { | ||
586 | __u64 vram_max_size; | ||
587 | __u64 vram_cpu_accessible_max_size; | ||
588 | __u64 gtt_max_size; | ||
589 | }; | ||
590 | |||
583 | struct drm_amdgpu_info_firmware { | 591 | struct drm_amdgpu_info_firmware { |
584 | __u32 ver; | 592 | __u32 ver; |
585 | __u32 feature; | 593 | __u32 feature; |