Revert "drm/amdgpu: use the kernel zone memory size as the max remote memory in amdgpu"
authorAlex Deucher <alexander.deucher@amd.com>
Tue, 15 Nov 2016 21:55:53 +0000 (16:55 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 6 Dec 2016 23:08:21 +0000 (18:08 -0500)
This reverts commit a693e050edfe794fea81d7cfe72429a406aa380b.

This breaks on systems with huge amounts of system memory as we do not have
enough vram to store the page tables.  Additionally, this is less of an issue
with the recent gtt manager changes.

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

index f53e52f4d672b5dfc2eebc439c015b3ae84c6fe1..29d3a914fc88e970ae18ebe8181f9dc8a45097cb 100644 (file)
@@ -1679,8 +1679,6 @@ uint32_t amdgpu_ttm_tt_pte_flags(struct amdgpu_device *adev, struct ttm_tt *ttm,
 void amdgpu_vram_location(struct amdgpu_device *adev, struct amdgpu_mc *mc, u64 base);
 void amdgpu_gtt_location(struct amdgpu_device *adev, struct amdgpu_mc *mc);
 void amdgpu_ttm_set_active_vram_size(struct amdgpu_device *adev, u64 size);
-u64 amdgpu_ttm_get_gtt_mem_size(struct amdgpu_device *adev);
-int amdgpu_ttm_global_init(struct amdgpu_device *adev);
 int amdgpu_ttm_init(struct amdgpu_device *adev);
 void amdgpu_ttm_fini(struct amdgpu_device *adev);
 void amdgpu_program_register_sequence(struct amdgpu_device *adev,
index 8f18b8ed2b3a22991e6ab1adee3f30d545a78fd9..bc70f80260d849b9b51c3bbcc5c1135500e0dbed 100644 (file)
@@ -34,7 +34,6 @@
 #include <ttm/ttm_placement.h>
 #include <ttm/ttm_module.h>
 #include <ttm/ttm_page_alloc.h>
-#include <ttm/ttm_memory.h>
 #include <drm/drmP.h>
 #include <drm/amdgpu_drm.h>
 #include <linux/seq_file.h>
@@ -65,7 +64,7 @@ static void amdgpu_ttm_mem_global_release(struct drm_global_reference *ref)
        ttm_mem_global_release(ref->object);
 }
 
-int amdgpu_ttm_global_init(struct amdgpu_device *adev)
+static int amdgpu_ttm_global_init(struct amdgpu_device *adev)
 {
        struct drm_global_reference *global_ref;
        struct amdgpu_ring *ring;
@@ -1151,6 +1150,10 @@ int amdgpu_ttm_init(struct amdgpu_device *adev)
        unsigned i, j;
        int r;
 
+       r = amdgpu_ttm_global_init(adev);
+       if (r) {
+               return r;
+       }
        /* No others user of address space so set it to 0 */
        r = ttm_bo_device_init(&adev->mman.bdev,
                               adev->mman.bo_global_ref.ref.object,
@@ -1650,8 +1653,3 @@ static void amdgpu_ttm_debugfs_fini(struct amdgpu_device *adev)
 
 #endif
 }
-
-u64 amdgpu_ttm_get_gtt_mem_size(struct amdgpu_device *adev)
-{
-       return ttm_get_kernel_zone_memory_size(adev->mman.mem_global_ref.object);
-}
index 64d3c1e6014c08ddfd1a3f0ef1c809254ea2325d..45a573e63d4ae9778cff0b022ef53e22163e9a7b 100644 (file)
@@ -335,7 +335,7 @@ static int gmc_v6_0_mc_init(struct amdgpu_device *adev)
         * size equal to the 1024 or vram, whichever is larger.
         */
        if (amdgpu_gart_size == -1)
-               adev->mc.gtt_size = amdgpu_ttm_get_gtt_mem_size(adev);
+               adev->mc.gtt_size = max((1024ULL << 20), adev->mc.mc_vram_size);
        else
                adev->mc.gtt_size = (uint64_t)amdgpu_gart_size << 20;
 
@@ -795,11 +795,6 @@ static int gmc_v6_0_sw_init(void *handle)
                return r;
        }
 
-       r = amdgpu_ttm_global_init(adev);
-       if (r) {
-               return r;
-       }
-
        r = gmc_v6_0_mc_init(adev);
        if (r)
                return r;
index fbe1d9ac500add22390260018b675be83bffcc4d..273b16fb9459fe17dedd0c3c928a5b4e5edf93e7 100644 (file)
@@ -385,7 +385,7 @@ static int gmc_v7_0_mc_init(struct amdgpu_device *adev)
         * size equal to the 1024 or vram, whichever is larger.
         */
        if (amdgpu_gart_size == -1)
-               adev->mc.gtt_size = amdgpu_ttm_get_gtt_mem_size(adev);
+               adev->mc.gtt_size = max((1024ULL << 20), adev->mc.mc_vram_size);
        else
                adev->mc.gtt_size = (uint64_t)amdgpu_gart_size << 20;
 
@@ -945,11 +945,6 @@ static int gmc_v7_0_sw_init(void *handle)
                return r;
        }
 
-       r = amdgpu_ttm_global_init(adev);
-       if (r) {
-               return r;
-       }
-
        r = gmc_v7_0_mc_init(adev);
        if (r)
                return r;
index 12ea3404dd65c0ed20299514f93e3276a045c557..0daac3a5be79572e65a2fff812453c2bd541940c 100644 (file)
@@ -472,7 +472,7 @@ static int gmc_v8_0_mc_init(struct amdgpu_device *adev)
         * size equal to the 1024 or vram, whichever is larger.
         */
        if (amdgpu_gart_size == -1)
-               adev->mc.gtt_size = amdgpu_ttm_get_gtt_mem_size(adev);
+               adev->mc.gtt_size = max((1024ULL << 20), adev->mc.mc_vram_size);
        else
                adev->mc.gtt_size = (uint64_t)amdgpu_gart_size << 20;
 
@@ -952,11 +952,6 @@ static int gmc_v8_0_sw_init(void *handle)
                return r;
        }
 
-       r = amdgpu_ttm_global_init(adev);
-       if (r) {
-               return r;
-       }
-
        r = gmc_v8_0_mc_init(adev);
        if (r)
                return r;