summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h
diff options
context:
space:
mode:
authorPhilip Yang <Philip.Yang@amd.com>2023-03-08 11:57:00 -0500
committerAlex Deucher <alexander.deucher@amd.com>2023-06-09 10:36:38 -0400
commit3ebfd221c1a83e5f0edadb87d173d8fd93d1d125 (patch)
treeac81bd8c25170d61d01a2627fe14f72ac38fda28 /drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h
parent6cfba94a77c5cbad2d7c106ac5f026b6a8b1efe6 (diff)
downloadlinux-stable-3ebfd221c1a83e5f0edadb87d173d8fd93d1d125.tar.gz
linux-stable-3ebfd221c1a83e5f0edadb87d173d8fd93d1d125.tar.bz2
linux-stable-3ebfd221c1a83e5f0edadb87d173d8fd93d1d125.zip
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>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h
index 324cb566ca2f..05c54776951b 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h
@@ -330,6 +330,10 @@ int amdgpu_amdkfd_reserve_mem_limit(struct amdgpu_device *adev,
void amdgpu_amdkfd_unreserve_mem_limit(struct amdgpu_device *adev,
uint64_t size, u32 alloc_flag);
+#define KFD_XCP_MEM_ID(adev, xcp_id) \
+ ((adev)->xcp_mgr && (xcp_id) >= 0 ?\
+ (adev)->xcp_mgr->xcp[(xcp_id)].mem_id : -1)
+
#define KFD_XCP_MEMORY_SIZE(n) ((n)->adev->gmc.num_mem_partitions ?\
(n)->adev->gmc.mem_partitions[(n)->xcp->mem_id].size /\
(n)->adev->xcp_mgr->num_xcp_per_mem_partition :\