drm/amdkfd: Store xcp partition id to amdgpu bo

For memory accounting per compute partition and export drm amdgpu bo and
then import to KFD, we need the xcp id to account the memory usage or
find the KFD node of the original amdgpu bo to create the KFD bo on the
correct adev KFD node.

Set xcp_id_plus1 of amdgpu_bo_param to create bo and store xcp_id to
amddgpu bo. Add helper macro to get the mem_id from adev and xcp_id.

v2: squash in fix ("drm/amdgpu: Fix BO creation failure on GFX 9.4.3 dGPU")

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:
Philip Yang
2023-03-08 11:57:00 -05:00
committed by Alex Deucher
parent 6cfba94a77
commit 3ebfd221c1
10 changed files with 42 additions and 23 deletions

View File

@@ -56,8 +56,8 @@ struct amdgpu_bo_param {
bool no_wait_gpu;
struct dma_resv *resv;
void (*destroy)(struct ttm_buffer_object *bo);
/* memory partition number plus 1, 0 means any partition */
int8_t mem_id_plus1;
/* xcp partition number plus 1, 0 means any partition */
int8_t xcp_id_plus1;
};
/* bo virtual addresses in a vm */
@@ -111,8 +111,12 @@ struct amdgpu_bo {
#endif
struct kgd_mem *kfd_bo;
/* memory partition number, -1 means any partition */
int8_t mem_id;
/*
* For GPUs with spatial partitioning, xcp partition number, -1 means
* any partition. For other ASICs without spatial partition, always 0
* for memory accounting.
*/
int8_t xcp_id;
};
struct amdgpu_bo_user {