From 0db90a9b5a60ae36851551208c1afd515117dfb1 Mon Sep 17 00:00:00 2001 From: Alex Deucher 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 Reviewed-by: Michel Dänzer Signed-off-by: Alex Deucher Signed-off-by: Chaudhary Amit Kumar --- 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