mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git/
synced 2026-04-18 06:33:43 -04:00
drm/amdkfd: Alloc memory of GPU support memory partition
For dGPU mode VRAM allocation, create amdgpu_bo from amdgpu_vm->mem_id, to alloc from the correct memory range. For APU mode VRAM allocation, set alloc domain to GTT, and set bp->mem_id_plus1 from amdgpu_vm->mem_id + 1 to create amdgpu_bo, to allocate system memory from correct NUMA node. For GTT allocation, use mem_id -1 to allocate system memory from any NUMA nodes. Remove amdgpu_ttm_tt_set_mem_pool, to avoid the confusion that memory maybe allocated from different mem_id. Signed-off-by: Philip Yang <Philip.Yang@amd.com> Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
committed by
Alex Deucher
parent
f24e924b7e
commit
53c5692e7a
@@ -1060,7 +1060,7 @@ static struct ttm_tt *amdgpu_ttm_tt_create(struct ttm_buffer_object *bo,
|
||||
return NULL;
|
||||
}
|
||||
gtt->gobj = &bo->base;
|
||||
gtt->pool_id = NUMA_NO_NODE;
|
||||
gtt->pool_id = abo->mem_id;
|
||||
|
||||
if (abo->flags & AMDGPU_GEM_CREATE_CPU_GTT_USWC)
|
||||
caching = ttm_write_combined;
|
||||
@@ -1155,24 +1155,6 @@ static void amdgpu_ttm_tt_unpopulate(struct ttm_device *bdev,
|
||||
return ttm_pool_free(pool, ttm);
|
||||
}
|
||||
|
||||
/**
|
||||
* amdgpu_ttm_tt_set_mem_pool - Set the TTM memory pool for the TTM BO
|
||||
* @tbo: The ttm_buffer_object that backs the VRAM bo
|
||||
* @mem_id: to select the initialized ttm pool corresponding to the memory partition
|
||||
*/
|
||||
int amdgpu_ttm_tt_set_mem_pool(struct ttm_buffer_object *tbo, int mem_id)
|
||||
{
|
||||
struct ttm_tt *ttm = tbo->ttm;
|
||||
struct amdgpu_ttm_tt *gtt;
|
||||
|
||||
if (!ttm && !ttm_tt_is_populated(ttm))
|
||||
return -EINVAL;
|
||||
|
||||
gtt = ttm_to_amdgpu_ttm_tt(ttm);
|
||||
gtt->pool_id = mem_id;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* amdgpu_ttm_tt_get_userptr - Return the userptr GTT ttm_tt for the current
|
||||
* task
|
||||
|
||||
Reference in New Issue
Block a user