aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/drm/drm_vm.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char/drm/drm_vm.c')
-rw-r--r--drivers/char/drm/drm_vm.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/drivers/char/drm/drm_vm.c b/drivers/char/drm/drm_vm.c
index f7d4e29d5073..2d83b0b3a514 100644
--- a/drivers/char/drm/drm_vm.c
+++ b/drivers/char/drm/drm_vm.c
@@ -175,8 +175,7 @@ static __inline__ struct page *drm_do_vm_shm_nopage(struct vm_area_struct *vma,
175 175
176 offset = address - vma->vm_start; 176 offset = address - vma->vm_start;
177 i = (unsigned long)map->handle + offset; 177 i = (unsigned long)map->handle + offset;
178 page = (map->type == _DRM_CONSISTENT) ? 178 page = vmalloc_to_page((void *)i);
179 virt_to_page((void *)i) : vmalloc_to_page((void *)i);
180 if (!page) 179 if (!page)
181 return NOPAGE_SIGBUS; 180 return NOPAGE_SIGBUS;
182 get_page(page); 181 get_page(page);
@@ -651,10 +650,15 @@ static int drm_mmap_locked(struct file *filp, struct vm_area_struct *vma)
651 vma->vm_start, vma->vm_end, map->offset + offset); 650 vma->vm_start, vma->vm_end, map->offset + offset);
652 vma->vm_ops = &drm_vm_ops; 651 vma->vm_ops = &drm_vm_ops;
653 break; 652 break;
654 case _DRM_SHM:
655 case _DRM_CONSISTENT: 653 case _DRM_CONSISTENT:
656 /* Consistent memory is really like shared memory. It's only 654 /* Consistent memory is really like shared memory. But
657 * allocate in a different way */ 655 * it's allocated in a different way, so avoid nopage */
656 if (remap_pfn_range(vma, vma->vm_start,
657 page_to_pfn(virt_to_page(map->handle)),
658 vma->vm_end - vma->vm_start, vma->vm_page_prot))
659 return -EAGAIN;
660 /* fall through to _DRM_SHM */
661 case _DRM_SHM:
658 vma->vm_ops = &drm_vm_shm_ops; 662 vma->vm_ops = &drm_vm_shm_ops;
659 vma->vm_private_data = (void *)map; 663 vma->vm_private_data = (void *)map;
660 /* Don't let this area swap. Change when 664 /* Don't let this area swap. Change when