diff options
Diffstat (limited to 'meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/3705-drm-amdgpu-Compute-GPU-VM-space-if-unchanged-from-de.patch')
-rw-r--r-- | meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/3705-drm-amdgpu-Compute-GPU-VM-space-if-unchanged-from-de.patch | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/3705-drm-amdgpu-Compute-GPU-VM-space-if-unchanged-from-de.patch b/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/3705-drm-amdgpu-Compute-GPU-VM-space-if-unchanged-from-de.patch new file mode 100644 index 00000000..008aee89 --- /dev/null +++ b/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/3705-drm-amdgpu-Compute-GPU-VM-space-if-unchanged-from-de.patch @@ -0,0 +1,56 @@ +From 89c5d94ac1687ff38fc3ef5ada7772be1d0eb5c1 Mon Sep 17 00:00:00 2001 +From: Kent Russell <kent.russell@amd.com> +Date: Fri, 23 Feb 2018 11:49:46 -0500 +Subject: [PATCH 3705/4131] drm/amdgpu: Compute GPU VM space if unchanged from + default + +Change-Id: I9a20db93c2ad75a0cd07c7d084e9faee5d554cf4 +Signed-off-by: Kent Russell <kent.russell@amd.com> +Signed-off-by: Kalyan Alle <kalyan.alle@amd.com> +--- + drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 29 ++++++++++++++++++++++++++--- + 1 file changed, 26 insertions(+), 3 deletions(-) + +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +index e8501a4..953d2fb 100644 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +@@ -763,9 +763,32 @@ static void amdgpu_device_check_block_size(struct amdgpu_device *adev) + + static void amdgpu_device_check_vm_size(struct amdgpu_device *adev) + { +- /* no need to check the default value */ +- if (amdgpu_vm_size == -1) +- return; ++ 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", +-- +2.7.4 + |