drm/amdgpu/gmc7: use the vram location programmed by the vbios
authorAlex Deucher <alexander.deucher@amd.com>
Tue, 1 Nov 2016 17:14:45 +0000 (13:14 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 14 Jul 2017 15:05:47 +0000 (11:05 -0400)
This makes mc programming much simpler in future patches.

Since evergreen, the vbios has been programming the fb location
to the proper vram size.  The only reason to reprogram it would
be to change the location.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c

index 7e9ea53edf8bfe65ef5667a4a6a8002c9e0ef0cf..0fc7d31176a5b38ddc70bca6c6a3f88153a6d105 100644 (file)
@@ -242,13 +242,16 @@ static int gmc_v7_0_mc_load_microcode(struct amdgpu_device *adev)
 static void gmc_v7_0_vram_gtt_location(struct amdgpu_device *adev,
                                       struct amdgpu_mc *mc)
 {
+       u64 base = RREG32(mmMC_VM_FB_LOCATION) & 0xFFFF;
+       base <<= 24;
+
        if (mc->mc_vram_size > 0xFFC0000000ULL) {
                /* leave room for at least 1024M GTT */
                dev_warn(adev->dev, "limiting VRAM\n");
                mc->real_vram_size = 0xFFC0000000ULL;
                mc->mc_vram_size = 0xFFC0000000ULL;
        }
-       amdgpu_vram_location(adev, &adev->mc, 0);
+       amdgpu_vram_location(adev, &adev->mc, base);
        adev->mc.gtt_base_align = 0;
        amdgpu_gtt_location(adev, mc);
 }