aboutsummaryrefslogtreecommitdiffstats
path: root/meta-amd-bsp/recipes-kernel/linux-4.19/linux-yocto-4.19.8/0146-drm-amdgpu-hybrid-Restore-scalable-VM-size-calculati.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta-amd-bsp/recipes-kernel/linux-4.19/linux-yocto-4.19.8/0146-drm-amdgpu-hybrid-Restore-scalable-VM-size-calculati.patch')
-rw-r--r--meta-amd-bsp/recipes-kernel/linux-4.19/linux-yocto-4.19.8/0146-drm-amdgpu-hybrid-Restore-scalable-VM-size-calculati.patch69
1 files changed, 69 insertions, 0 deletions
diff --git a/meta-amd-bsp/recipes-kernel/linux-4.19/linux-yocto-4.19.8/0146-drm-amdgpu-hybrid-Restore-scalable-VM-size-calculati.patch b/meta-amd-bsp/recipes-kernel/linux-4.19/linux-yocto-4.19.8/0146-drm-amdgpu-hybrid-Restore-scalable-VM-size-calculati.patch
new file mode 100644
index 00000000..40249b38
--- /dev/null
+++ b/meta-amd-bsp/recipes-kernel/linux-4.19/linux-yocto-4.19.8/0146-drm-amdgpu-hybrid-Restore-scalable-VM-size-calculati.patch
@@ -0,0 +1,69 @@
+From 5e8918863efa9e6bec9b316ba4f8b07e71d84a50 Mon Sep 17 00:00:00 2001
+From: ozeng <oak.zeng@amd.com>
+Date: Thu, 6 Jul 2017 15:07:50 -0500
+Subject: [PATCH 0146/2940] drm/amdgpu: [hybrid] Restore scalable VM size
+ calculation
+
+fa2f1a68af48de01c775585c552438aba795b2f5 made both the GART size
+and VM size scalable to system memory size. This was reverted later
+to solve SWDEV-123010. However the revert caused KFD huge buffer
+test failure reported in SWDEV-126381. This restore the scalable
+VM size calculation to allow KFD allocate huge buffer.
+
+BUG: SWDEV-126381
+
+Change-Id: I68cf765dfcb94921aae1a815ab896a367e3f3005
+Signed-off-by: Oak Zeng <oak.zeng@amd.com>
+Reviewed-by: Roger.He <Hongbo.He@amd.com>
+
+ Conflicts:
+ drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+---
+ drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 24 ++++++++++++++++++++++
+ 1 file changed, 24 insertions(+)
+
+diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+index d36c8bf3dba8..ca2ee7a67029 100644
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+@@ -983,6 +983,9 @@ static void amdgpu_device_check_smu_prv_buffer_size(struct amdgpu_device *adev)
+ */
+ static void amdgpu_device_check_arguments(struct amdgpu_device *adev)
+ {
++ struct sysinfo si;
++ int phys_ram_gb, amdgpu_vm_size_aligned;
++
+ if (amdgpu_sched_jobs < 4) {
+ dev_warn(adev->dev, "sched jobs (%d) must be at least 4\n",
+ amdgpu_sched_jobs);
+@@ -1007,6 +1010,27 @@ static void amdgpu_device_check_arguments(struct amdgpu_device *adev)
+ amdgpu_gtt_size = -1;
+ }
+
++ /* Compute the GPU VM space only if the user
++ * hasn't changed it from the default.
++ */
++ if (amdgpu_vm_size == -1) {
++ /* 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;
++ }
++
+ /* valid range is between 4 and 9 inclusive */
+ if (amdgpu_vm_fragment_size != -1 &&
+ (amdgpu_vm_fragment_size > 9 || amdgpu_vm_fragment_size < 4)) {
+--
+2.17.1
+