Commit fdd5faaa authored by Christian König's avatar Christian König Committed by Alex Deucher

drm/amdgpu: cleanup vm_size handling

It's pointless to have the same value twice, just always use max_pfn.
Signed-off-by: default avatarChristian König <christian.koenig@amd.com>
Reviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent c47b41a7
...@@ -2576,27 +2576,27 @@ void amdgpu_vm_set_fragment_size(struct amdgpu_device *adev, ...@@ -2576,27 +2576,27 @@ void amdgpu_vm_set_fragment_size(struct amdgpu_device *adev,
* @adev: amdgpu_device pointer * @adev: amdgpu_device pointer
* @vm_size: the default vm size if it's set auto * @vm_size: the default vm size if it's set auto
*/ */
void amdgpu_vm_adjust_size(struct amdgpu_device *adev, uint64_t vm_size, void amdgpu_vm_adjust_size(struct amdgpu_device *adev, uint32_t vm_size,
uint32_t fragment_size_default) uint32_t fragment_size_default)
{ {
/* adjust vm size firstly */ /* adjust vm size firstly */
if (amdgpu_vm_size == -1) if (amdgpu_vm_size != -1)
adev->vm_manager.vm_size = vm_size; vm_size = amdgpu_vm_size;
else
adev->vm_manager.vm_size = amdgpu_vm_size; adev->vm_manager.max_pfn = (uint64_t)vm_size << 18;
/* block size depends on vm size */ /* block size depends on vm size */
if (amdgpu_vm_block_size == -1) if (amdgpu_vm_block_size == -1)
adev->vm_manager.block_size = adev->vm_manager.block_size =
amdgpu_vm_get_block_size(adev->vm_manager.vm_size); amdgpu_vm_get_block_size(vm_size);
else else
adev->vm_manager.block_size = amdgpu_vm_block_size; adev->vm_manager.block_size = amdgpu_vm_block_size;
amdgpu_vm_set_fragment_size(adev, fragment_size_default); amdgpu_vm_set_fragment_size(adev, fragment_size_default);
DRM_INFO("vm size is %llu GB, block size is %u-bit, fragment size is %u-bit\n", DRM_INFO("vm size is %u GB, block size is %u-bit, fragment size is %u-bit\n",
adev->vm_manager.vm_size, adev->vm_manager.block_size, vm_size, adev->vm_manager.block_size,
adev->vm_manager.fragment_size); adev->vm_manager.fragment_size);
} }
/** /**
......
...@@ -221,7 +221,6 @@ struct amdgpu_vm_manager { ...@@ -221,7 +221,6 @@ struct amdgpu_vm_manager {
uint64_t max_pfn; uint64_t max_pfn;
uint32_t num_level; uint32_t num_level;
uint64_t vm_size;
uint32_t block_size; uint32_t block_size;
uint32_t fragment_size; uint32_t fragment_size;
/* vram base address for page table entry */ /* vram base address for page table entry */
...@@ -313,9 +312,9 @@ struct amdgpu_bo_va_mapping *amdgpu_vm_bo_lookup_mapping(struct amdgpu_vm *vm, ...@@ -313,9 +312,9 @@ struct amdgpu_bo_va_mapping *amdgpu_vm_bo_lookup_mapping(struct amdgpu_vm *vm,
void amdgpu_vm_bo_rmv(struct amdgpu_device *adev, void amdgpu_vm_bo_rmv(struct amdgpu_device *adev,
struct amdgpu_bo_va *bo_va); struct amdgpu_bo_va *bo_va);
void amdgpu_vm_set_fragment_size(struct amdgpu_device *adev, void amdgpu_vm_set_fragment_size(struct amdgpu_device *adev,
uint32_t fragment_size_default); uint32_t fragment_size_default);
void amdgpu_vm_adjust_size(struct amdgpu_device *adev, uint64_t vm_size, void amdgpu_vm_adjust_size(struct amdgpu_device *adev, uint32_t vm_size,
uint32_t fragment_size_default); uint32_t fragment_size_default);
int amdgpu_vm_ioctl(struct drm_device *dev, void *data, struct drm_file *filp); int amdgpu_vm_ioctl(struct drm_device *dev, void *data, struct drm_file *filp);
bool amdgpu_vm_need_pipeline_sync(struct amdgpu_ring *ring, bool amdgpu_vm_need_pipeline_sync(struct amdgpu_ring *ring,
struct amdgpu_job *job); struct amdgpu_job *job);
......
...@@ -838,7 +838,6 @@ static int gmc_v6_0_sw_init(void *handle) ...@@ -838,7 +838,6 @@ static int gmc_v6_0_sw_init(void *handle)
return r; return r;
amdgpu_vm_adjust_size(adev, 64, 9); amdgpu_vm_adjust_size(adev, 64, 9);
adev->vm_manager.max_pfn = adev->vm_manager.vm_size << 18;
adev->mc.mc_mask = 0xffffffffffULL; adev->mc.mc_mask = 0xffffffffffULL;
......
...@@ -978,7 +978,6 @@ static int gmc_v7_0_sw_init(void *handle) ...@@ -978,7 +978,6 @@ static int gmc_v7_0_sw_init(void *handle)
* Max GPUVM size for cayman and SI is 40 bits. * Max GPUVM size for cayman and SI is 40 bits.
*/ */
amdgpu_vm_adjust_size(adev, 64, 9); amdgpu_vm_adjust_size(adev, 64, 9);
adev->vm_manager.max_pfn = adev->vm_manager.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
......
...@@ -1075,7 +1075,6 @@ static int gmc_v8_0_sw_init(void *handle) ...@@ -1075,7 +1075,6 @@ static int gmc_v8_0_sw_init(void *handle)
* Max GPUVM size for cayman and SI is 40 bits. * Max GPUVM size for cayman and SI is 40 bits.
*/ */
amdgpu_vm_adjust_size(adev, 64, 9); amdgpu_vm_adjust_size(adev, 64, 9);
adev->vm_manager.max_pfn = adev->vm_manager.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
......
...@@ -564,7 +564,7 @@ static int gmc_v9_0_sw_init(void *handle) ...@@ -564,7 +564,7 @@ static int gmc_v9_0_sw_init(void *handle)
case CHIP_RAVEN: case CHIP_RAVEN:
adev->mc.vram_type = AMDGPU_VRAM_TYPE_UNKNOWN; adev->mc.vram_type = AMDGPU_VRAM_TYPE_UNKNOWN;
if (adev->rev_id == 0x0 || adev->rev_id == 0x1) { if (adev->rev_id == 0x0 || adev->rev_id == 0x1) {
adev->vm_manager.vm_size = 1U << 18; adev->vm_manager.max_pfn = 1ULL << 36;
adev->vm_manager.block_size = 9; adev->vm_manager.block_size = 9;
adev->vm_manager.num_level = 3; adev->vm_manager.num_level = 3;
amdgpu_vm_set_fragment_size(adev, 9); amdgpu_vm_set_fragment_size(adev, 9);
...@@ -582,7 +582,7 @@ static int gmc_v9_0_sw_init(void *handle) ...@@ -582,7 +582,7 @@ static int gmc_v9_0_sw_init(void *handle)
* vm size is 256TB (48bit), maximum size of Vega10, * vm size is 256TB (48bit), maximum size of Vega10,
* block size 512 (9bit) * block size 512 (9bit)
*/ */
adev->vm_manager.vm_size = 1U << 18; adev->vm_manager.max_pfn = 1ULL << 36;
adev->vm_manager.block_size = 9; adev->vm_manager.block_size = 9;
adev->vm_manager.num_level = 3; adev->vm_manager.num_level = 3;
amdgpu_vm_set_fragment_size(adev, 9); amdgpu_vm_set_fragment_size(adev, 9);
...@@ -591,10 +591,9 @@ static int gmc_v9_0_sw_init(void *handle) ...@@ -591,10 +591,9 @@ static int gmc_v9_0_sw_init(void *handle)
break; break;
} }
DRM_INFO("vm size is %llu GB, block size is %u-bit,fragment size is %u-bit\n", DRM_INFO("vm size is %llu GB, block size is %u-bit, fragment size is %u-bit\n",
adev->vm_manager.vm_size, adev->vm_manager.max_pfn >> 18, adev->vm_manager.block_size,
adev->vm_manager.block_size, adev->vm_manager.fragment_size);
adev->vm_manager.fragment_size);
/* This interrupt is VMC page fault.*/ /* This interrupt is VMC page fault.*/
r = amdgpu_irq_add_id(adev, AMDGPU_IH_CLIENTID_VMC, 0, r = amdgpu_irq_add_id(adev, AMDGPU_IH_CLIENTID_VMC, 0,
...@@ -605,8 +604,6 @@ static int gmc_v9_0_sw_init(void *handle) ...@@ -605,8 +604,6 @@ static int gmc_v9_0_sw_init(void *handle)
if (r) if (r)
return r; return r;
adev->vm_manager.max_pfn = adev->vm_manager.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
* internal address space. * internal address space.
......
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