diff options
-rw-r--r-- | drivers/xen/gntdev.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/xen/gntdev.c b/drivers/xen/gntdev.c index 20c65771017d..d5bb1a33d0a3 100644 --- a/drivers/xen/gntdev.c +++ b/drivers/xen/gntdev.c | |||
@@ -93,6 +93,7 @@ struct grant_map { | |||
93 | struct gnttab_map_grant_ref *kmap_ops; | 93 | struct gnttab_map_grant_ref *kmap_ops; |
94 | struct gnttab_unmap_grant_ref *kunmap_ops; | 94 | struct gnttab_unmap_grant_ref *kunmap_ops; |
95 | struct page **pages; | 95 | struct page **pages; |
96 | unsigned long pages_vm_start; | ||
96 | }; | 97 | }; |
97 | 98 | ||
98 | static int unmap_grant_pages(struct grant_map *map, int offset, int pages); | 99 | static int unmap_grant_pages(struct grant_map *map, int offset, int pages); |
@@ -446,9 +447,18 @@ static void gntdev_vma_close(struct vm_area_struct *vma) | |||
446 | gntdev_put_map(priv, map); | 447 | gntdev_put_map(priv, map); |
447 | } | 448 | } |
448 | 449 | ||
450 | static struct page *gntdev_vma_find_special_page(struct vm_area_struct *vma, | ||
451 | unsigned long addr) | ||
452 | { | ||
453 | struct grant_map *map = vma->vm_private_data; | ||
454 | |||
455 | return map->pages[(addr - map->pages_vm_start) >> PAGE_SHIFT]; | ||
456 | } | ||
457 | |||
449 | static struct vm_operations_struct gntdev_vmops = { | 458 | static struct vm_operations_struct gntdev_vmops = { |
450 | .open = gntdev_vma_open, | 459 | .open = gntdev_vma_open, |
451 | .close = gntdev_vma_close, | 460 | .close = gntdev_vma_close, |
461 | .find_special_page = gntdev_vma_find_special_page, | ||
452 | }; | 462 | }; |
453 | 463 | ||
454 | /* ------------------------------------------------------------------ */ | 464 | /* ------------------------------------------------------------------ */ |
@@ -874,6 +884,7 @@ static int gntdev_mmap(struct file *flip, struct vm_area_struct *vma) | |||
874 | set_grant_ptes_as_special, NULL); | 884 | set_grant_ptes_as_special, NULL); |
875 | } | 885 | } |
876 | #endif | 886 | #endif |
887 | map->pages_vm_start = vma->vm_start; | ||
877 | } | 888 | } |
878 | 889 | ||
879 | return 0; | 890 | return 0; |