diff options
author | Junwei Zhang <Jerry.Zhang@amd.com> | 2017-04-05 13:54:56 +0800 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2017-04-07 15:15:43 -0400 |
commit | bab4fee703ae5bfccb9ba2d1d92294f9db0887c7 (patch) | |
tree | 44fb61c13f9b8b86c7c325467cf9b41bc6578ab1 /drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | |
parent | e190ed1ea7458e446230de4113cc5d53b8dc4ec8 (diff) | |
download | blackbird-op-linux-bab4fee703ae5bfccb9ba2d1d92294f9db0887c7.tar.gz blackbird-op-linux-bab4fee703ae5bfccb9ba2d1d92294f9db0887c7.zip |
drm/amdgpu: set vm size and block size by individual gmc by default (v3)
By default, the value is set by individual gmc.
if a specific value is input, it overrides the global value for all
v2: create helper funcs
v3: update gmc9 APU's num_level athough it may be updated in the future.
Signed-off-by: Junwei Zhang <Jerry.Zhang@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_device.c')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 31 |
1 files changed, 13 insertions, 18 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c index 831c2bfd2072..483660742f75 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c @@ -1040,35 +1040,31 @@ static bool amdgpu_check_pot_argument(int arg) return (arg & (arg - 1)) == 0; } -static void amdgpu_get_block_size(struct amdgpu_device *adev) +static void amdgpu_check_block_size(struct amdgpu_device *adev) { /* defines number of bits in page table versus page directory, * a page is 4KB so we have 12 bits offset, minimum 9 bits in the * page table and the remaining bits are in the page directory */ - if (amdgpu_vm_block_size == -1) { - - /* Total bits covered by PD + PTs */ - unsigned bits = ilog2(amdgpu_vm_size) + 18; - - /* Make sure the PD is 4K in size up to 8GB address space. - Above that split equal between PD and PTs */ - if (amdgpu_vm_size <= 8) - amdgpu_vm_block_size = bits - 9; - else - amdgpu_vm_block_size = (bits + 3) / 2; + if (amdgpu_vm_block_size == -1) + return; - } else if (amdgpu_vm_block_size < 9) { + if (amdgpu_vm_block_size < 9) { dev_warn(adev->dev, "VM page table size (%d) too small\n", amdgpu_vm_block_size); - amdgpu_vm_block_size = 9; + goto def_value; } if (amdgpu_vm_block_size > 24 || (amdgpu_vm_size * 1024) < (1ull << amdgpu_vm_block_size)) { dev_warn(adev->dev, "VM page table size (%d) too large\n", amdgpu_vm_block_size); - amdgpu_vm_block_size = 9; + goto def_value; } + + return; + +def_value: + amdgpu_vm_block_size = -1; } static void amdgpu_check_vm_size(struct amdgpu_device *adev) @@ -1097,8 +1093,7 @@ static void amdgpu_check_vm_size(struct amdgpu_device *adev) return; def_value: - amdgpu_vm_size = 8; - dev_info(adev->dev, "set default VM size %dGB\n", amdgpu_vm_size); + amdgpu_vm_size = -1; } /** @@ -1132,7 +1127,7 @@ static void amdgpu_check_arguments(struct amdgpu_device *adev) amdgpu_check_vm_size(adev); - amdgpu_get_block_size(adev); + amdgpu_check_block_size(adev); if (amdgpu_vram_page_split != -1 && (amdgpu_vram_page_split < 16 || !amdgpu_check_pot_argument(amdgpu_vram_page_split))) { |