mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git
synced 2026-04-18 11:33:36 -04:00
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:
committed by
Alex Deucher
parent
6cfba94a77
commit
3ebfd221c1
@@ -131,14 +131,15 @@ void amdgpu_bo_placement_from_domain(struct amdgpu_bo *abo, u32 domain)
|
||||
|
||||
if (domain & AMDGPU_GEM_DOMAIN_VRAM) {
|
||||
unsigned int visible_pfn = adev->gmc.visible_vram_size >> PAGE_SHIFT;
|
||||
int8_t mem_id = KFD_XCP_MEM_ID(adev, abo->xcp_id);
|
||||
|
||||
if (adev->gmc.mem_partitions && abo->mem_id >= 0) {
|
||||
places[c].fpfn = adev->gmc.mem_partitions[abo->mem_id].range.fpfn;
|
||||
if (adev->gmc.mem_partitions && mem_id >= 0) {
|
||||
places[c].fpfn = adev->gmc.mem_partitions[mem_id].range.fpfn;
|
||||
/*
|
||||
* memory partition range lpfn is inclusive start + size - 1
|
||||
* TTM place lpfn is exclusive start + size
|
||||
*/
|
||||
places[c].lpfn = adev->gmc.mem_partitions[abo->mem_id].range.lpfn + 1;
|
||||
places[c].lpfn = adev->gmc.mem_partitions[mem_id].range.lpfn + 1;
|
||||
} else {
|
||||
places[c].fpfn = 0;
|
||||
places[c].lpfn = 0;
|
||||
@@ -583,8 +584,12 @@ int amdgpu_bo_create(struct amdgpu_device *adev,
|
||||
|
||||
bo->flags = bp->flags;
|
||||
|
||||
/* bo->mem_id -1 means any partition */
|
||||
bo->mem_id = bp->mem_id_plus1 - 1;
|
||||
if (adev->gmc.mem_partitions)
|
||||
/* For GPUs with spatial partitioning, bo->xcp_id=-1 means any partition */
|
||||
bo->xcp_id = bp->xcp_id_plus1 - 1;
|
||||
else
|
||||
/* For GPUs without spatial partitioning */
|
||||
bo->xcp_id = 0;
|
||||
|
||||
if (!amdgpu_bo_support_uswc(bo->flags))
|
||||
bo->flags &= ~AMDGPU_GEM_CREATE_CPU_GTT_USWC;
|
||||
|
||||
Reference in New Issue
Block a user