From 7389d90a5fbc79adc3e2fb459c256bf976623028 Mon Sep 17 00:00:00 2001 From: Alex Deucher Date: Thu, 14 Oct 2010 19:56:15 -0400 Subject: [PATCH] drm/radeon/kms: Make sure GTT and VRAM are not adjacent 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 Signed-off-by: Alex Deucher Cc: stable@kernel.org --- drivers/gpu/drm/radeon/radeon_device.c | 15 +++++++++++++++ 1 files changed, 15 insertions(+), 0 deletions(-) diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c index 256d204..d679d2b 100644 --- a/drivers/gpu/drm/radeon/radeon_device.c +++ b/drivers/gpu/drm/radeon/radeon_device.c @@ -205,6 +205,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); @@ -242,6 +250,13 @@ 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_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