Skip to content

Commit 3a61dae

Browse files
alexsierragalexdeucher
authored andcommitted
drm/amdkfd: device pgmap owner at the svm migrate init
GPUs in the same XGMI hive have direct access to all members'VRAM. When mapping memory to a GPU, we don't need hmm_range_fault to fault device-private pages in the same hive back to the host. Identifying the page owner as the hive, rather than the individual GPU, accomplishes this. Signed-off-by: Alex Sierra <alex.sierra@amd.com> Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent 9e4a91c commit 3a61dae

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

drivers/gpu/drm/amd/amdkfd/kfd_migrate.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ svm_migrate_vma_to_vram(struct amdgpu_device *adev, struct svm_range *prange,
379379
migrate.start = start;
380380
migrate.end = end;
381381
migrate.flags = MIGRATE_VMA_SELECT_SYSTEM;
382-
migrate.pgmap_owner = adev;
382+
migrate.pgmap_owner = SVM_ADEV_PGMAP_OWNER(adev);
383383

384384
size = 2 * sizeof(*migrate.src) + sizeof(uint64_t) + sizeof(dma_addr_t);
385385
size *= npages;
@@ -601,7 +601,7 @@ svm_migrate_vma_to_ram(struct amdgpu_device *adev, struct svm_range *prange,
601601
migrate.start = start;
602602
migrate.end = end;
603603
migrate.flags = MIGRATE_VMA_SELECT_DEVICE_PRIVATE;
604-
migrate.pgmap_owner = adev;
604+
migrate.pgmap_owner = SVM_ADEV_PGMAP_OWNER(adev);
605605

606606
size = 2 * sizeof(*migrate.src) + sizeof(uint64_t) + sizeof(dma_addr_t);
607607
size *= npages;
@@ -873,7 +873,7 @@ int svm_migrate_init(struct amdgpu_device *adev)
873873
pgmap->range.start = res->start;
874874
pgmap->range.end = res->end;
875875
pgmap->ops = &svm_migrate_pgmap_ops;
876-
pgmap->owner = adev;
876+
pgmap->owner = SVM_ADEV_PGMAP_OWNER(adev);
877877
pgmap->flags = MIGRATE_VMA_SELECT_DEVICE_PRIVATE;
878878
r = devm_memremap_pages(adev->dev, pgmap);
879879
if (IS_ERR(r)) {

drivers/gpu/drm/amd/amdkfd/kfd_svm.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@
3535
#include "amdgpu.h"
3636
#include "kfd_priv.h"
3737

38+
#define SVM_ADEV_PGMAP_OWNER(adev)\
39+
((adev)->hive ? (void *)(adev)->hive : (void *)(adev))
40+
3841
struct svm_range_bo {
3942
struct amdgpu_bo *bo;
4043
struct kref kref;

0 commit comments

Comments
 (0)