diff options
author | Christian König <christian.koenig@amd.com> | 2014-08-07 03:36:01 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2014-08-11 11:04:24 -0400 |
commit | ddd00e33e17a62c5f44377ab42e7562ccfae7bd1 (patch) | |
tree | c891a3a9198cc82fafc2e4b2881c055a5351a272 /drivers/gpu/drm/radeon/radeon_ttm.c | |
parent | f72a113a71ab08c4df8a5f80ab2f8a140feb81f6 (diff) |
drm/radeon: add userptr flag to limit it to anonymous memory v2
Avoid problems with writeback by limiting userptr to anonymous memory.
v2: add commit and code comments
Signed-off-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/radeon/radeon_ttm.c')
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_ttm.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c b/drivers/gpu/drm/radeon/radeon_ttm.c index b20933fa35c6..12e37b1ddc40 100644 --- a/drivers/gpu/drm/radeon/radeon_ttm.c +++ b/drivers/gpu/drm/radeon/radeon_ttm.c | |||
@@ -538,6 +538,16 @@ static int radeon_ttm_tt_pin_userptr(struct ttm_tt *ttm) | |||
538 | if (current->mm != gtt->usermm) | 538 | if (current->mm != gtt->usermm) |
539 | return -EPERM; | 539 | return -EPERM; |
540 | 540 | ||
541 | if (gtt->userflags & RADEON_GEM_USERPTR_ANONONLY) { | ||
542 | /* check that we only pin down anonymous memory | ||
543 | to prevent problems with writeback */ | ||
544 | unsigned long end = gtt->userptr + ttm->num_pages * PAGE_SIZE; | ||
545 | struct vm_area_struct *vma; | ||
546 | vma = find_vma(gtt->usermm, gtt->userptr); | ||
547 | if (!vma || vma->vm_file || vma->vm_end < end) | ||
548 | return -EPERM; | ||
549 | } | ||
550 | |||
541 | do { | 551 | do { |
542 | unsigned num_pages = ttm->num_pages - pinned; | 552 | unsigned num_pages = ttm->num_pages - pinned; |
543 | uint64_t userptr = gtt->userptr + pinned * PAGE_SIZE; | 553 | uint64_t userptr = gtt->userptr + pinned * PAGE_SIZE; |