diff options
author | Emily Deng <Emily.Deng@amd.com> | 2018-10-10 03:43:47 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2018-10-10 15:48:02 -0400 |
commit | f2d9bbc9968997c139d906162b3da9d97ffbed6f (patch) | |
tree | f608717f57d9860f9c723b9cb2121b0aab918d35 | |
parent | f9f97e3c7fe681bc8dcb9625856a559e2c7e11d8 (diff) |
drm/amdgpu: Limit the max mc address to hole start
For the vram_start is 0 case, the gart range will be from 0x0000FFFF00000000
to 0x0000FFFF1FFFFFFF, which will cause the engine hang.
So to avoid the hole, limit the max mc address to AMDGPU_GMC_HOLE_START.:wq
Signed-off-by: Emily Deng <Emily.Deng@amd.com>
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/amdgpu_gmc.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c index 999e15945355..d73367cab4f3 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c | |||
@@ -146,6 +146,8 @@ void amdgpu_gmc_gart_location(struct amdgpu_device *adev, struct amdgpu_gmc *mc) | |||
146 | { | 146 | { |
147 | const uint64_t four_gb = 0x100000000ULL; | 147 | const uint64_t four_gb = 0x100000000ULL; |
148 | u64 size_af, size_bf; | 148 | u64 size_af, size_bf; |
149 | /*To avoid the hole, limit the max mc address to AMDGPU_GMC_HOLE_START*/ | ||
150 | u64 max_mc_address = min(adev->gmc.mc_mask, AMDGPU_GMC_HOLE_START - 1); | ||
149 | 151 | ||
150 | mc->gart_size += adev->pm.smu_prv_buffer_size; | 152 | mc->gart_size += adev->pm.smu_prv_buffer_size; |
151 | 153 | ||
@@ -153,7 +155,7 @@ void amdgpu_gmc_gart_location(struct amdgpu_device *adev, struct amdgpu_gmc *mc) | |||
153 | * the GART base on a 4GB boundary as well. | 155 | * the GART base on a 4GB boundary as well. |
154 | */ | 156 | */ |
155 | size_bf = mc->fb_start; | 157 | size_bf = mc->fb_start; |
156 | size_af = adev->gmc.mc_mask + 1 - ALIGN(mc->fb_end + 1, four_gb); | 158 | size_af = max_mc_address + 1 - ALIGN(mc->fb_end + 1, four_gb); |
157 | 159 | ||
158 | if (mc->gart_size > max(size_bf, size_af)) { | 160 | if (mc->gart_size > max(size_bf, size_af)) { |
159 | dev_warn(adev->dev, "limiting GART\n"); | 161 | dev_warn(adev->dev, "limiting GART\n"); |
@@ -164,7 +166,7 @@ void amdgpu_gmc_gart_location(struct amdgpu_device *adev, struct amdgpu_gmc *mc) | |||
164 | (size_af < mc->gart_size)) | 166 | (size_af < mc->gart_size)) |
165 | mc->gart_start = 0; | 167 | mc->gart_start = 0; |
166 | else | 168 | else |
167 | mc->gart_start = mc->mc_mask - mc->gart_size + 1; | 169 | mc->gart_start = max_mc_address - mc->gart_size + 1; |
168 | 170 | ||
169 | mc->gart_start &= ~(four_gb - 1); | 171 | mc->gart_start &= ~(four_gb - 1); |
170 | mc->gart_end = mc->gart_start + mc->gart_size - 1; | 172 | mc->gart_end = mc->gart_start + mc->gart_size - 1; |