aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Deucher <alexander.deucher@amd.com>2015-12-09 15:36:40 -0500
committerAlex Deucher <alexander.deucher@amd.com>2015-12-17 11:56:41 -0500
commita1493cd575678910f90d488069a8a2c41a144fda (patch)
tree548acec1eb9a959f95a361dc644069290d427b71
parentb70f014d58b976930b9e8337980954a958c01d7f (diff)
drm/amdgpu: limit visible vram if it's smaller than the BAR
In some cases the amount of vram may be less than the BAR size, if so, limit visible vram to the amount of actual vram, not the BAR size. Reviewed-by: Christian König <christian.koenig@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r--drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c4
-rw-r--r--drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c4
2 files changed, 8 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c
index 7427d8cd4c43..868505753a9a 100644
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c
@@ -370,6 +370,10 @@ static int gmc_v7_0_mc_init(struct amdgpu_device *adev)
370 adev->mc.real_vram_size = RREG32(mmCONFIG_MEMSIZE) * 1024ULL * 1024ULL; 370 adev->mc.real_vram_size = RREG32(mmCONFIG_MEMSIZE) * 1024ULL * 1024ULL;
371 adev->mc.visible_vram_size = adev->mc.aper_size; 371 adev->mc.visible_vram_size = adev->mc.aper_size;
372 372
373 /* In case the PCI BAR is larger than the actual amount of vram */
374 if (adev->mc.visible_vram_size > adev->mc.real_vram_size)
375 adev->mc.visible_vram_size = adev->mc.real_vram_size;
376
373 /* unless the user had overridden it, set the gart 377 /* unless the user had overridden it, set the gart
374 * size equal to the 1024 or vram, whichever is larger. 378 * size equal to the 1024 or vram, whichever is larger.
375 */ 379 */
diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
index cb0e50ebb528..a2d869d30cf4 100644
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
@@ -476,6 +476,10 @@ static int gmc_v8_0_mc_init(struct amdgpu_device *adev)
476 adev->mc.real_vram_size = RREG32(mmCONFIG_MEMSIZE) * 1024ULL * 1024ULL; 476 adev->mc.real_vram_size = RREG32(mmCONFIG_MEMSIZE) * 1024ULL * 1024ULL;
477 adev->mc.visible_vram_size = adev->mc.aper_size; 477 adev->mc.visible_vram_size = adev->mc.aper_size;
478 478
479 /* In case the PCI BAR is larger than the actual amount of vram */
480 if (adev->mc.visible_vram_size > adev->mc.real_vram_size)
481 adev->mc.visible_vram_size = adev->mc.real_vram_size;
482
479 /* unless the user had overridden it, set the gart 483 /* unless the user had overridden it, set the gart
480 * size equal to the 1024 or vram, whichever is larger. 484 * size equal to the 1024 or vram, whichever is larger.
481 */ 485 */