diff options
author | Christian König <christian.koenig@amd.com> | 2018-08-23 09:20:43 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2018-08-29 13:35:18 -0400 |
commit | 961c75cf203179d0c546722290bf4b1147e5feb1 (patch) | |
tree | e0aa2398b814eb1bfa752f2f4eaed428e53c816f /drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | |
parent | efa9a5ef10fbbf500e6b479359dde72947a9799e (diff) |
drm/amdgpu: move amdgpu_device_(vram|gtt)_location
Move that into amdgpu_gmc.c since we are really deadling with GMC
address space here.
Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Junwei Zhang <Jerry.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_device.c')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 65 |
1 files changed, 0 insertions, 65 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c index a20c13c6f6f1..93476b8c2e72 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | |||
@@ -652,71 +652,6 @@ void amdgpu_device_wb_free(struct amdgpu_device *adev, u32 wb) | |||
652 | } | 652 | } |
653 | 653 | ||
654 | /** | 654 | /** |
655 | * amdgpu_device_vram_location - try to find VRAM location | ||
656 | * | ||
657 | * @adev: amdgpu device structure holding all necessary informations | ||
658 | * @mc: memory controller structure holding memory informations | ||
659 | * @base: base address at which to put VRAM | ||
660 | * | ||
661 | * Function will try to place VRAM at base address provided | ||
662 | * as parameter. | ||
663 | */ | ||
664 | void amdgpu_device_vram_location(struct amdgpu_device *adev, | ||
665 | struct amdgpu_gmc *mc, u64 base) | ||
666 | { | ||
667 | uint64_t limit = (uint64_t)amdgpu_vram_limit << 20; | ||
668 | |||
669 | mc->vram_start = base; | ||
670 | mc->vram_end = mc->vram_start + mc->mc_vram_size - 1; | ||
671 | if (limit && limit < mc->real_vram_size) | ||
672 | mc->real_vram_size = limit; | ||
673 | dev_info(adev->dev, "VRAM: %lluM 0x%016llX - 0x%016llX (%lluM used)\n", | ||
674 | mc->mc_vram_size >> 20, mc->vram_start, | ||
675 | mc->vram_end, mc->real_vram_size >> 20); | ||
676 | } | ||
677 | |||
678 | /** | ||
679 | * amdgpu_device_gart_location - try to find GART location | ||
680 | * | ||
681 | * @adev: amdgpu device structure holding all necessary informations | ||
682 | * @mc: memory controller structure holding memory informations | ||
683 | * | ||
684 | * Function will place try to place GART before or after VRAM. | ||
685 | * | ||
686 | * If GART size is bigger than space left then we ajust GART size. | ||
687 | * Thus function will never fails. | ||
688 | */ | ||
689 | void amdgpu_device_gart_location(struct amdgpu_device *adev, | ||
690 | struct amdgpu_gmc *mc) | ||
691 | { | ||
692 | u64 size_af, size_bf; | ||
693 | |||
694 | mc->gart_size += adev->pm.smu_prv_buffer_size; | ||
695 | |||
696 | size_af = adev->gmc.mc_mask - mc->vram_end; | ||
697 | size_bf = mc->vram_start; | ||
698 | if (size_bf > size_af) { | ||
699 | if (mc->gart_size > size_bf) { | ||
700 | dev_warn(adev->dev, "limiting GART\n"); | ||
701 | mc->gart_size = size_bf; | ||
702 | } | ||
703 | mc->gart_start = 0; | ||
704 | } else { | ||
705 | if (mc->gart_size > size_af) { | ||
706 | dev_warn(adev->dev, "limiting GART\n"); | ||
707 | mc->gart_size = size_af; | ||
708 | } | ||
709 | /* VCE doesn't like it when BOs cross a 4GB segment, so align | ||
710 | * the GART base on a 4GB boundary as well. | ||
711 | */ | ||
712 | mc->gart_start = ALIGN(mc->vram_end + 1, 0x100000000ULL); | ||
713 | } | ||
714 | mc->gart_end = mc->gart_start + mc->gart_size - 1; | ||
715 | dev_info(adev->dev, "GART: %lluM 0x%016llX - 0x%016llX\n", | ||
716 | mc->gart_size >> 20, mc->gart_start, mc->gart_end); | ||
717 | } | ||
718 | |||
719 | /** | ||
720 | * amdgpu_device_resize_fb_bar - try to resize FB BAR | 655 | * amdgpu_device_resize_fb_bar - try to resize FB BAR |
721 | * | 656 | * |
722 | * @adev: amdgpu_device pointer | 657 | * @adev: amdgpu_device pointer |