drm/amdgpu: reserve the first 2x512 pages of GART
authorChristian König <christian.koenig@amd.com>
Wed, 28 Jun 2017 10:18:54 +0000 (12:18 +0200)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 14 Jul 2017 15:06:20 +0000 (11:06 -0400)
We want to use them as remap address space.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h

index 1ef625550442d237b088f66495aa6cabcd833be6..f46a97d9167513c14d0405d2b53790e6a511b838 100644 (file)
@@ -43,12 +43,15 @@ static int amdgpu_gtt_mgr_init(struct ttm_mem_type_manager *man,
                               unsigned long p_size)
 {
        struct amdgpu_gtt_mgr *mgr;
+       uint64_t start, size;
 
        mgr = kzalloc(sizeof(*mgr), GFP_KERNEL);
        if (!mgr)
                return -ENOMEM;
 
-       drm_mm_init(&mgr->mm, 0, p_size);
+       start = AMDGPU_GTT_MAX_TRANSFER_SIZE * AMDGPU_GTT_NUM_TRANSFER_WINDOWS;
+       size = p_size - start;
+       drm_mm_init(&mgr->mm, start, size);
        spin_lock_init(&mgr->lock);
        mgr->available = p_size;
        man->priv = mgr;
index 776a20ae40c4e61bafb2102f73049fd434ee2350..c8059f0671859ff063af8d9865d4e6d18b6eeac4 100644 (file)
@@ -34,6 +34,9 @@
 #define AMDGPU_PL_FLAG_GWS             (TTM_PL_FLAG_PRIV << 1)
 #define AMDGPU_PL_FLAG_OA              (TTM_PL_FLAG_PRIV << 2)
 
+#define AMDGPU_GTT_MAX_TRANSFER_SIZE   512
+#define AMDGPU_GTT_NUM_TRANSFER_WINDOWS        2
+
 struct amdgpu_mman {
        struct ttm_bo_global_ref        bo_global_ref;
        struct drm_global_reference     mem_global_ref;