drm/ttm: rework on ttm_resource to use size_t type
Change ttm_resource structure from num_pages to size_t size in bytes. v1 -> v2: change PFN_UP(dst_mem->size) to ttm->num_pages v1 -> v2: change bo->resource->size to bo->base.size at some places v1 -> v2: remove the local variable v1 -> v2: cleanup cmp_size_smaller_first() v2 -> v3: adding missing PFN_UP in ttm_bo_vm_fault_reserved Signed-off-by: Somalapuram Amaranath <Amaranath.Somalapuram@amd.com> Link: https://patchwork.freedesktop.org/patch/msgid/20221027091237.983582-1-Amaranath.Somalapuram@amd.com Reviewed-by: Christian König <christian.koenig@amd.com> Signed-off-by: Christian König <christian.koenig@amd.com>
This commit is contained in:
committed by
Christian König
parent
e1e7bc481d
commit
e3c92eb4a8
@@ -439,7 +439,7 @@ static int amdgpu_vram_mgr_new(struct ttm_resource_manager *man,
|
||||
/* Allocate blocks in desired range */
|
||||
vres->flags |= DRM_BUDDY_RANGE_ALLOCATION;
|
||||
|
||||
remaining_size = (u64)vres->base.num_pages << PAGE_SHIFT;
|
||||
remaining_size = (u64)vres->base.size;
|
||||
|
||||
mutex_lock(&mgr->lock);
|
||||
while (remaining_size) {
|
||||
@@ -498,7 +498,7 @@ static int amdgpu_vram_mgr_new(struct ttm_resource_manager *man,
|
||||
LIST_HEAD(temp);
|
||||
|
||||
trim_list = &vres->blocks;
|
||||
original_size = (u64)vres->base.num_pages << PAGE_SHIFT;
|
||||
original_size = (u64)vres->base.size;
|
||||
|
||||
/*
|
||||
* If size value is rounded up to min_block_size, trim the last
|
||||
@@ -533,8 +533,8 @@ static int amdgpu_vram_mgr_new(struct ttm_resource_manager *man,
|
||||
amdgpu_vram_mgr_block_size(block);
|
||||
start >>= PAGE_SHIFT;
|
||||
|
||||
if (start > vres->base.num_pages)
|
||||
start -= vres->base.num_pages;
|
||||
if (start > PFN_UP(vres->base.size))
|
||||
start -= PFN_UP(vres->base.size);
|
||||
else
|
||||
start = 0;
|
||||
vres->base.start = max(vres->base.start, start);
|
||||
|
||||
Reference in New Issue
Block a user