Commit ec210e32 authored by Christian König's avatar Christian König Committed by Alex Deucher

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: default avatarChristian König <christian.koenig@amd.com>
Reviewed-by: default avatarJunwei Zhang <Jerry.Zhang@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent d9997b64
...@@ -116,6 +116,7 @@ void amdgpu_gmc_vram_location(struct amdgpu_device *adev, struct amdgpu_gmc *mc, ...@@ -116,6 +116,7 @@ void amdgpu_gmc_vram_location(struct amdgpu_device *adev, struct amdgpu_gmc *mc,
*/ */
void amdgpu_gmc_gart_location(struct amdgpu_device *adev, struct amdgpu_gmc *mc) void amdgpu_gmc_gart_location(struct amdgpu_device *adev, struct amdgpu_gmc *mc)
{ {
const uint64_t four_gb = 0x100000000ULL;
u64 size_af, size_bf; u64 size_af, size_bf;
mc->gart_size += adev->pm.smu_prv_buffer_size; 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,8 +125,7 @@ void amdgpu_gmc_gart_location(struct amdgpu_device *adev, struct amdgpu_gmc *mc)
* the GART base on a 4GB boundary as well. * the GART base on a 4GB boundary as well.
*/ */
size_bf = mc->vram_start; size_bf = mc->vram_start;
size_af = adev->gmc.mc_mask + 1 - size_af = adev->gmc.mc_mask + 1 - ALIGN(mc->vram_end + 1, four_gb);
ALIGN(mc->vram_end + 1, 0x100000000ULL);
if (mc->gart_size > max(size_bf, size_af)) { if (mc->gart_size > max(size_bf, size_af)) {
dev_warn(adev->dev, "limiting GART\n"); 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,7 +136,9 @@ void amdgpu_gmc_gart_location(struct amdgpu_device *adev, struct amdgpu_gmc *mc)
(size_af < mc->gart_size)) (size_af < mc->gart_size))
mc->gart_start = 0; mc->gart_start = 0;
else else
mc->gart_start = ALIGN(mc->vram_end + 1, 0x100000000ULL); mc->gart_start = mc->mc_mask - mc->gart_size + 1;
mc->gart_start &= four_gb - 1;
mc->gart_end = mc->gart_start + mc->gart_size - 1; mc->gart_end = mc->gart_start + mc->gart_size - 1;
dev_info(adev->dev, "GART: %lluM 0x%016llX - 0x%016llX\n", dev_info(adev->dev, "GART: %lluM 0x%016llX - 0x%016llX\n",
mc->gart_size >> 20, mc->gart_start, mc->gart_end); mc->gart_size >> 20, mc->gart_start, mc->gart_end);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment