aboutsummaryrefslogtreecommitdiffstats
path: root/common/recipes-kernel/linux/linux-yocto-4.19.8/2113-drm-amdgpu-don-t-check-the-default-value-for-vm-size.patch
blob: 8209de665fd1987b627e125e681e6acdc77fb42a (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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
From 0db90a9b5a60ae36851551208c1afd515117dfb1 Mon Sep 17 00:00:00 2001
From: Alex Deucher <alexander.deucher@amd.com>
Date: Thu, 15 Jun 2017 18:20:09 -0400
Subject: [PATCH 2113/2940] drm/amdgpu: don't check the default value for vm
 size
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Avoids printing spurious messages like this:
[    3.102059] amdgpu 0000:01:00.0: VM size (-1) must be a power of 2

Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Chaudhary Amit Kumar <Chaudharyamit.Kumar@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 41 +++++-----------------
 1 file changed, 9 insertions(+), 32 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index f91247952fc9..b4faffb88434 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -873,38 +873,15 @@ static void amdgpu_device_check_block_size(struct amdgpu_device *adev)
  */
 static void amdgpu_device_check_vm_size(struct amdgpu_device *adev)
 {
-	struct sysinfo si;
-	int phys_ram_gb, amdgpu_vm_size_aligned;
-
-	/* Compute the GPU VM space only if the user
-	 * hasn't changed it from the default.
-	 * In order for Raven ATC memory to work, vm size should be 256TB.
-	 * So we do not compute the new vm size here for Raven.
-	 */
-	if (amdgpu_vm_size == -1 && adev->asic_type != CHIP_RAVEN) {
-		/* Computation depends on the amount of physical RAM available.
-		 * Cannot exceed 1TB.
-		 */
-		si_meminfo(&si);
-		phys_ram_gb = ((uint64_t)si.totalram * si.mem_unit) >> 30;
-		amdgpu_vm_size = min(phys_ram_gb * 3 + 16, 1024);
-
-		/* GPUVM sizes are almost never perfect powers of two.
-		 * Round up to nearest power of two starting from
-		 * the minimum allowed but aligned size of 32GB
-		 */
-		amdgpu_vm_size_aligned = 32;
-		while (amdgpu_vm_size > amdgpu_vm_size_aligned)
-			amdgpu_vm_size_aligned *= 2;
-
-		amdgpu_vm_size = amdgpu_vm_size_aligned;
-	}
-
-	if (amdgpu_vm_size != -1 && amdgpu_vm_size < 1) {
-		dev_warn(adev->dev, "VM size (%d) too small, min is 1GB\n",
-			 amdgpu_vm_size);
-		amdgpu_vm_size = -1;
-	}
+        /* no need to check the default value */
+        if (amdgpu_vm_size == -1)
+                return;
+
+        if (amdgpu_vm_size < 1) {
+                dev_warn(adev->dev, "VM size (%d) too small, min is 1GB\n",
+                         amdgpu_vm_size);
+                amdgpu_vm_size = -1;
+        }
 }
 
 static void amdgpu_device_check_smu_prv_buffer_size(struct amdgpu_device *adev)
-- 
2.17.1