diff options
Diffstat (limited to 'common/recipes-kernel/linux/linux-yocto-4.19.8/0134-drm-amdgpu-Compute-GPU-VM-space-if-unchanged-from-de.patch')
-rw-r--r-- | common/recipes-kernel/linux/linux-yocto-4.19.8/0134-drm-amdgpu-Compute-GPU-VM-space-if-unchanged-from-de.patch | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/common/recipes-kernel/linux/linux-yocto-4.19.8/0134-drm-amdgpu-Compute-GPU-VM-space-if-unchanged-from-de.patch b/common/recipes-kernel/linux/linux-yocto-4.19.8/0134-drm-amdgpu-Compute-GPU-VM-space-if-unchanged-from-de.patch new file mode 100644 index 00000000..264e015c --- /dev/null +++ b/common/recipes-kernel/linux/linux-yocto-4.19.8/0134-drm-amdgpu-Compute-GPU-VM-space-if-unchanged-from-de.patch @@ -0,0 +1,58 @@ +From cee2fb237aff722d2b5c6ee81cd7ded51776cbbf 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 0134/2940] drm/amdgpu: Compute GPU VM space if unchanged from + default + +Change-Id: I9a20db93c2ad75a0cd07c7d084e9faee5d554cf4 +Signed-off-by: Kent Russell <kent.russell@amd.com> +--- + drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 31 +++++++++++++++++++--- + 1 file changed, 27 insertions(+), 4 deletions(-) + +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +index 63668764bf5d..227bbc1f689e 100644 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +@@ -899,11 +899,34 @@ 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) { ++ 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; +-- +2.17.1 + |