aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian König <christian.koenig@amd.com>2018-08-24 04:48:12 -0400
committerAlex Deucher <alexander.deucher@amd.com>2018-08-30 10:03:37 -0400
commitec210e3226dc0b481ac1b33082b3b508f89387e3 (patch)
treea7daa5f0e005183cc288c8018a2ca126f79f0ef4
parentd9997b64c52b70bd98c48f443f068253621d1ffc (diff)
drm/amdgpu: put GART away from VRAM v2
Always try to put the GART away from where VRAM is. v2: correctly handle the 4GB limitation Signed-off-by: Christian König <christian.koenig@amd.com> Reviewed-by: Junwei Zhang <Jerry.Zhang@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
index 265ec6807130..c6bcc4715373 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
@@ -116,6 +116,7 @@ void amdgpu_gmc_vram_location(struct amdgpu_device *adev, struct amdgpu_gmc *mc,
116 */ 116 */
117void amdgpu_gmc_gart_location(struct amdgpu_device *adev, struct amdgpu_gmc *mc) 117void amdgpu_gmc_gart_location(struct amdgpu_device *adev, struct amdgpu_gmc *mc)
118{ 118{
119 const uint64_t four_gb = 0x100000000ULL;
119 u64 size_af, size_bf; 120 u64 size_af, size_bf;
120 121
121 mc->gart_size += adev->pm.smu_prv_buffer_size; 122 mc->gart_size += adev->pm.smu_prv_buffer_size;
@@ -124,8 +125,7 @@ void amdgpu_gmc_gart_location(struct amdgpu_device *adev, struct amdgpu_gmc *mc)
124 * the GART base on a 4GB boundary as well. 125 * the GART base on a 4GB boundary as well.
125 */ 126 */
126 size_bf = mc->vram_start; 127 size_bf = mc->vram_start;
127 size_af = adev->gmc.mc_mask + 1 - 128 size_af = adev->gmc.mc_mask + 1 - ALIGN(mc->vram_end + 1, four_gb);
128 ALIGN(mc->vram_end + 1, 0x100000000ULL);
129 129
130 if (mc->gart_size > max(size_bf, size_af)) { 130 if (mc->gart_size > max(size_bf, size_af)) {
131 dev_warn(adev->dev, "limiting GART\n"); 131 dev_warn(adev->dev, "limiting GART\n");
@@ -136,7 +136,9 @@ void amdgpu_gmc_gart_location(struct amdgpu_device *adev, struct amdgpu_gmc *mc)
136 (size_af < mc->gart_size)) 136 (size_af < mc->gart_size))
137 mc->gart_start = 0; 137 mc->gart_start = 0;
138 else 138 else
139 mc->gart_start = ALIGN(mc->vram_end + 1, 0x100000000ULL); 139 mc->gart_start = mc->mc_mask - mc->gart_size + 1;
140
141 mc->gart_start &= four_gb - 1;
140 mc->gart_end = mc->gart_start + mc->gart_size - 1; 142 mc->gart_end = mc->gart_start + mc->gart_size - 1;
141 dev_info(adev->dev, "GART: %lluM 0x%016llX - 0x%016llX\n", 143 dev_info(adev->dev, "GART: %lluM 0x%016llX - 0x%016llX\n",
142 mc->gart_size >> 20, mc->gart_start, mc->gart_end); 144 mc->gart_size >> 20, mc->gart_start, mc->gart_end);