From 11a1640f9366192fafba7471e51a7093c995ab95 Mon Sep 17 00:00:00 2001 From: Alex Deucher Date: Wed, 20 Oct 2010 13:43:13 -0400 Subject: [PATCH] drm/radeon/kms: Make sure GTT and VRAM are not adjacent v2 If VRAM and GTT are directly adjacent in the MC's address space we seem to get hangs. Should fix: https://bugs.freedesktop.org/show_bug.cgi?id=28402 v2: don't overlap gtt and vram if vram is at 0. Signed-off-by: Alex Deucher Cc: stable@kernel.org --- drivers/gpu/drm/radeon/radeon_device.c | 16 ++++++++++++++++ 1 files changed, 16 insertions(+), 0 deletions(-) diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c index 8adfedf..7adc81e 100644 --- a/drivers/gpu/drm/radeon/radeon_device.c +++ b/drivers/gpu/drm/radeon/radeon_device.c @@ -286,6 +286,14 @@ void radeon_vram_location(struct radeon_device *rdev, struct radeon_mc *mc, u64 mc->mc_vram_size = mc->aper_size; } mc->vram_end = mc->vram_start + mc->mc_vram_size - 1; + /* Make sure GTT and VRAM are not adjacent */ + if (rdev->flags & RADEON_IS_AGP && + (mc->gtt_start > 0) && + (((mc->vram_end + 1) == mc->gtt_start) || + ((mc->gtt_end + 1) == mc->vram_start))) { + mc->vram_start = 0; + mc->vram_end = mc->vram_start + mc->mc_vram_size - 1; + } dev_info(rdev->dev, "VRAM: %lluM 0x%08llX - 0x%08llX (%lluM used)\n", mc->mc_vram_size >> 20, mc->vram_start, mc->vram_end, mc->real_vram_size >> 20); @@ -323,6 +331,14 @@ void radeon_gtt_location(struct radeon_device *rdev, struct radeon_mc *mc) mc->gtt_start = (mc->vram_end + 1 + mc->gtt_base_align) & ~mc->gtt_base_align; } mc->gtt_end = mc->gtt_start + mc->gtt_size - 1; + /* Make sure GTT and VRAM are not adjacent */ + if ((mc->gtt_start > 0) && + (mc->vram_start > 0) && + (((mc->vram_end + 1) == mc->gtt_start) || + ((mc->gtt_end + 1) == mc->vram_start))) { + mc->gtt_start = 0; + mc->gtt_end = mc->gtt_start + mc->gtt_size - 1; + } dev_info(rdev->dev, "GTT: %lluM 0x%08llX - 0x%08llX\n", mc->gtt_size >> 20, mc->gtt_start, mc->gtt_end); } -- 1.7.1.1