From f25866c7104169550a1893e2aa8ab3fee6bdb56b Mon Sep 17 00:00:00 2001 From: Alex Deucher Date: Mon, 21 Mar 2011 13:08:23 -0400 Subject: [PATCH] drm/radeon/kms: fail if GART table is not aligned to size For systems with the GART table stored in system ram, the table base address needs to be aligned to the size. For a 512 MB GART aperture, the table must be 512KB aligned. Signed-off-by: Alex Deucher --- drivers/gpu/drm/radeon/radeon_gart.c | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-) diff --git a/drivers/gpu/drm/radeon/radeon_gart.c b/drivers/gpu/drm/radeon/radeon_gart.c index f0534ef..52a3c32 100644 --- a/drivers/gpu/drm/radeon/radeon_gart.c +++ b/drivers/gpu/drm/radeon/radeon_gart.c @@ -42,6 +42,17 @@ int radeon_gart_table_ram_alloc(struct radeon_device *rdev) if (ptr == NULL) { return -ENOMEM; } + + /* gart table needs to be aligned to size */ + if (!IS_ALIGNED((u64)rdev->gart.table_addr, (u64)rdev->gart.table_size)) { + pci_free_consistent(rdev->pdev, rdev->gart.table_size, + (void *)rdev->gart.table.ram.ptr, + rdev->gart.table_addr); + DRM_ERROR("GART table address (0x%llx) needs to be aligned to size (0x%x)\n", + (u64)rdev->gart.table_addr, rdev->gart.table_size); + return -EINVAL; + } + #ifdef CONFIG_X86 if (rdev->family == CHIP_RS400 || rdev->family == CHIP_RS480 || rdev->family == CHIP_RS690 || rdev->family == CHIP_RS740) { -- 1.7.1.1