Commit 9ceaeeaf authored by Felix Kuehling's avatar Felix Kuehling Committed by Alex Deucher

drm/amdgpu: Fix Vega10 VM initialization

adev->family is not initialized yet when amdgpu_get_block_size is
called. Use adev->asic_type instead.

Minimum VM size is 512GB, not 256GB, for a single page table entry
in the root page table.

gmc_v9_0_vm_init is called after adev->vm_manager.max_pfn is
initialized. Move the minimum VM-size enforcement ahead of max_pfn
initializtion. Cast to 64-bit before the left-shift.
Signed-off-by: default avatarFelix Kuehling <Felix.Kuehling@amd.com>
Reviewed-by: default avatarChunming Zhou <david1.zhou@amd.com>
Reviewed-by: default avatarJunwei Zhang <Jerry.Zhang@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 22770e5a
...@@ -1043,10 +1043,10 @@ static bool amdgpu_check_pot_argument(int arg) ...@@ -1043,10 +1043,10 @@ static bool amdgpu_check_pot_argument(int arg)
static void amdgpu_get_block_size(struct amdgpu_device *adev) static void amdgpu_get_block_size(struct amdgpu_device *adev)
{ {
/* from AI, asic starts to support multiple level VMPT */ /* from AI, asic starts to support multiple level VMPT */
if (adev->family >= AMDGPU_FAMILY_AI) { if (adev->asic_type >= CHIP_VEGA10) {
if (amdgpu_vm_block_size != 9) if (amdgpu_vm_block_size != 9)
dev_warn(adev->dev, "Multi-VMPT limits block size to" dev_warn(adev->dev,
"one page!\n"); "Multi-VMPT limits block size to one page!\n");
amdgpu_vm_block_size = 9; amdgpu_vm_block_size = 9;
return; return;
} }
......
...@@ -511,12 +511,6 @@ static int gmc_v9_0_vm_init(struct amdgpu_device *adev) ...@@ -511,12 +511,6 @@ static int gmc_v9_0_vm_init(struct amdgpu_device *adev)
* amdkfd will use VMIDs 8-15 * amdkfd will use VMIDs 8-15
*/ */
adev->vm_manager.num_ids = AMDGPU_NUM_OF_VMIDS; adev->vm_manager.num_ids = AMDGPU_NUM_OF_VMIDS;
/* Because of four level VMPTs, vm size at least is 256GB.
256TB is OK as well */
if (amdgpu_vm_size < 256) {
DRM_WARN("vm size at least is 256GB!\n");
amdgpu_vm_size = 256;
}
adev->vm_manager.num_level = 3; adev->vm_manager.num_level = 3;
amdgpu_vm_manager_init(adev); amdgpu_vm_manager_init(adev);
...@@ -563,11 +557,14 @@ static int gmc_v9_0_sw_init(void *handle) ...@@ -563,11 +557,14 @@ static int gmc_v9_0_sw_init(void *handle)
if (r) if (r)
return r; return r;
/* Adjust VM size here. /* Because of four level VMPTs, vm size is at least 512GB.
* Currently default to 64GB ((16 << 20) 4k pages). * The maximum size is 256TB (48bit).
* Max GPUVM size is 48 bits.
*/ */
adev->vm_manager.max_pfn = amdgpu_vm_size << 18; if (amdgpu_vm_size < 512) {
DRM_WARN("VM size is at least 512GB!\n");
amdgpu_vm_size = 512;
}
adev->vm_manager.max_pfn = (uint64_t)amdgpu_vm_size << 18;
/* Set the internal MC address mask /* Set the internal MC address mask
* This is the max address of the GPU's * This is the max address of the GPU's
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment