Skip to content

Commit 8c21fc4

Browse files
alexsierragalexdeucher
authored andcommitted
drm/amdkfd: add owner ref param to get hmm pages
The parameter is used in the dev_private_owner to decide if device pages in the range require to be migrated back to system memory, based if they are or not in the same memory domain. In this case, this reference could come from the same memory domain with devices connected to the same hive. 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 3a61dae commit 8c21fc4

4 files changed

Lines changed: 6 additions & 5 deletions

File tree

drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ int amdgpu_hmm_range_get_pages(struct mmu_interval_notifier *notifier,
160160
struct mm_struct *mm, struct page **pages,
161161
uint64_t start, uint64_t npages,
162162
struct hmm_range **phmm_range, bool readonly,
163-
bool mmap_locked)
163+
bool mmap_locked, void *owner)
164164
{
165165
struct hmm_range *hmm_range;
166166
unsigned long timeout;
@@ -185,6 +185,7 @@ int amdgpu_hmm_range_get_pages(struct mmu_interval_notifier *notifier,
185185
hmm_range->hmm_pfns = pfns;
186186
hmm_range->start = start;
187187
hmm_range->end = start + npages * PAGE_SIZE;
188+
hmm_range->dev_private_owner = owner;
188189

189190
/* Assuming 512MB takes maxmium 1 second to fault page address */
190191
timeout = max(npages >> 17, 1ULL) * HMM_RANGE_DEFAULT_TIMEOUT;

drivers/gpu/drm/amd/amdgpu/amdgpu_mn.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ int amdgpu_hmm_range_get_pages(struct mmu_interval_notifier *notifier,
3434
struct mm_struct *mm, struct page **pages,
3535
uint64_t start, uint64_t npages,
3636
struct hmm_range **phmm_range, bool readonly,
37-
bool mmap_locked);
37+
bool mmap_locked, void *owner);
3838
int amdgpu_hmm_range_get_pages_done(struct hmm_range *hmm_range);
3939

4040
#if defined(CONFIG_HMM_MIRROR)

drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -692,7 +692,7 @@ int amdgpu_ttm_tt_get_user_pages(struct amdgpu_bo *bo, struct page **pages)
692692
readonly = amdgpu_ttm_tt_is_readonly(ttm);
693693
r = amdgpu_hmm_range_get_pages(&bo->notifier, mm, pages, start,
694694
ttm->num_pages, &gtt->range, readonly,
695-
false);
695+
false, NULL);
696696
out_putmm:
697697
mmput(mm);
698698

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1416,7 +1416,7 @@ static int svm_range_validate_and_map(struct mm_struct *mm,
14161416
r = amdgpu_hmm_range_get_pages(&prange->notifier, mm, NULL,
14171417
prange->start << PAGE_SHIFT,
14181418
prange->npages, &hmm_range,
1419-
false, true);
1419+
false, true, NULL);
14201420
if (r) {
14211421
pr_debug("failed %d to get svm range pages\n", r);
14221422
goto unreserve_out;
@@ -2728,7 +2728,7 @@ void svm_range_prefault(struct svm_range *prange, struct mm_struct *mm)
27282728
r = amdgpu_hmm_range_get_pages(&prange->notifier, mm, NULL,
27292729
prange->start << PAGE_SHIFT,
27302730
prange->npages, &hmm_range,
2731-
false, true);
2731+
false, true, NULL);
27322732
if (!r) {
27332733
amdgpu_hmm_range_get_pages_done(hmm_range);
27342734
prange->validated_once = true;

0 commit comments

Comments
 (0)