aboutsummaryrefslogtreecommitdiffstats
path: root/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/2800-drm-amd-amdgpu-not-allow-gtt-size-exceed-75-system-m.patch
blob: e76964e4fe760aa88eaf0eb0e2f58245922539e2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
From dd5d6fc77fcae17b0c574db57e159284c4e5d4df Mon Sep 17 00:00:00 2001
From: Roger He <Hongbo.He@amd.com>
Date: Fri, 10 Nov 2017 19:05:13 +0800
Subject: [PATCH 2800/4131] drm/amd/amdgpu: not allow gtt size exceed
 75%*system memory size
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

keep consistency with threshold of swapout

Change-Id: I3348581d8d33a87b71888b688d98db02561bfa45
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Roger He <Hongbo.He@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index a05451a..c5bbbbe 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -1568,10 +1568,11 @@ int amdgpu_ttm_init(struct amdgpu_device *adev)
 		struct sysinfo si;
 
 		si_meminfo(&si);
-		gtt_size = max3((AMDGPU_DEFAULT_GTT_SIZE_MB << 20),
-				adev->mc.mc_vram_size,
-				((uint64_t)si.totalram * si.mem_unit));
-	} else
+		gtt_size = min(max((AMDGPU_DEFAULT_GTT_SIZE_MB << 20),
+			       adev->mc.mc_vram_size),
+			       ((uint64_t)si.totalram * si.mem_unit * 3/4));
+	}
+	else
 		gtt_size = (uint64_t)amdgpu_gtt_size << 20;
 
 	/* reserve for DGMA import domain */
-- 
2.7.4