drm/radeon: allow selection of alignment in the sub-allocator
authorAlex Deucher <alexander.deucher@amd.com>
Fri, 12 Jul 2013 19:46:09 +0000 (15:46 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Sun, 14 Jul 2013 14:11:31 +0000 (10:11 -0400)
There are cases where we need more than 4k alignment.  No
functional change with this commit.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
drivers/gpu/drm/radeon/radeon.h
drivers/gpu/drm/radeon/radeon_gart.c
drivers/gpu/drm/radeon/radeon_object.h
drivers/gpu/drm/radeon/radeon_ring.c
drivers/gpu/drm/radeon/radeon_sa.c

index 7b7d23ae3f27e95587a58240a5ac758c1166aa8d..82e8e36064e37377a5abdac00457e58ca085e789 100644 (file)
@@ -455,6 +455,7 @@ struct radeon_sa_manager {
        uint64_t                gpu_addr;
        void                    *cpu_ptr;
        uint32_t                domain;
+       uint32_t                align;
 };
 
 struct radeon_sa_bo;
index 43ec4a401f077809371e0360f22aa7f10c21af3b..5ce190b8bd1f148ff0fb7deac9ba873d1ef2422d 100644 (file)
@@ -467,6 +467,7 @@ int radeon_vm_manager_init(struct radeon_device *rdev)
                size *= 2;
                r = radeon_sa_bo_manager_init(rdev, &rdev->vm_manager.sa_manager,
                                              RADEON_GPU_PAGE_ALIGN(size),
+                                             RADEON_GPU_PAGE_SIZE,
                                              RADEON_GEM_DOMAIN_VRAM);
                if (r) {
                        dev_err(rdev->dev, "failed to allocate vm bo (%dKB)\n",
index 91519a5622b4358b6fa82e24698427bb0278a554..49c82c4800134aa5500c8999c1e2e7c196330d2c 100644 (file)
@@ -174,7 +174,7 @@ static inline void * radeon_sa_bo_cpu_addr(struct radeon_sa_bo *sa_bo)
 
 extern int radeon_sa_bo_manager_init(struct radeon_device *rdev,
                                     struct radeon_sa_manager *sa_manager,
-                                    unsigned size, u32 domain);
+                                    unsigned size, u32 align, u32 domain);
 extern void radeon_sa_bo_manager_fini(struct radeon_device *rdev,
                                      struct radeon_sa_manager *sa_manager);
 extern int radeon_sa_bo_manager_start(struct radeon_device *rdev,
index 5f1c51a776edca912da7d3e64d2f4cfd1d03c2ba..fb5ea6208970638d67240f16b0cd3947108ad624 100644 (file)
@@ -224,6 +224,7 @@ int radeon_ib_pool_init(struct radeon_device *rdev)
        }
        r = radeon_sa_bo_manager_init(rdev, &rdev->ring_tmp_bo,
                                      RADEON_IB_POOL_SIZE*64*1024,
+                                     RADEON_GPU_PAGE_SIZE,
                                      RADEON_GEM_DOMAIN_GTT);
        if (r) {
                return r;
index 0abe5a9431bb0a6abecd239919ac64bb68f32d5f..f0bac68254b79a5dd31cfdc14ce80a98bca91065 100644 (file)
@@ -49,7 +49,7 @@ static void radeon_sa_bo_try_free(struct radeon_sa_manager *sa_manager);
 
 int radeon_sa_bo_manager_init(struct radeon_device *rdev,
                              struct radeon_sa_manager *sa_manager,
-                             unsigned size, u32 domain)
+                             unsigned size, u32 align, u32 domain)
 {
        int i, r;
 
@@ -57,13 +57,14 @@ int radeon_sa_bo_manager_init(struct radeon_device *rdev,
        sa_manager->bo = NULL;
        sa_manager->size = size;
        sa_manager->domain = domain;
+       sa_manager->align = align;
        sa_manager->hole = &sa_manager->olist;
        INIT_LIST_HEAD(&sa_manager->olist);
        for (i = 0; i < RADEON_NUM_RINGS; ++i) {
                INIT_LIST_HEAD(&sa_manager->flist[i]);
        }
 
-       r = radeon_bo_create(rdev, size, RADEON_GPU_PAGE_SIZE, true,
+       r = radeon_bo_create(rdev, size, align, true,
                             domain, NULL, &sa_manager->bo);
        if (r) {
                dev_err(rdev->dev, "(%d) failed to allocate bo for manager\n", r);
@@ -317,7 +318,7 @@ int radeon_sa_bo_new(struct radeon_device *rdev,
        unsigned tries[RADEON_NUM_RINGS];
        int i, r;
 
-       BUG_ON(align > RADEON_GPU_PAGE_SIZE);
+       BUG_ON(align > sa_manager->align);
        BUG_ON(size > sa_manager->size);
 
        *sa_bo = kmalloc(sizeof(struct radeon_sa_bo), GFP_KERNEL);