1 /******************************************************************************
4 * Device for accessing (in user-space) pages that have been granted by other
7 * Copyright (c) 2006-2007, D G Murray.
8 * (c) 2009 Gerd Hoffmann <kraxel@redhat.com>
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #define pr_fmt(fmt) "xen:" KBUILD_MODNAME ": " fmt
24 #include <linux/module.h>
25 #include <linux/kernel.h>
26 #include <linux/init.h>
27 #include <linux/miscdevice.h>
30 #include <linux/mman.h>
31 #include <linux/mmu_notifier.h>
32 #include <linux/types.h>
33 #include <linux/uaccess.h>
34 #include <linux/sched.h>
35 #include <linux/spinlock.h>
36 #include <linux/slab.h>
37 #include <linux/highmem.h>
40 #include <xen/grant_table.h>
41 #include <xen/balloon.h>
42 #include <xen/gntdev.h>
43 #include <xen/events.h>
44 #include <asm/xen/hypervisor.h>
45 #include <asm/xen/hypercall.h>
46 #include <asm/xen/page.h>
48 MODULE_LICENSE("GPL");
49 MODULE_AUTHOR("Derek G. Murray <Derek.Murray@cl.cam.ac.uk>, "
50 "Gerd Hoffmann <kraxel@redhat.com>");
51 MODULE_DESCRIPTION("User-space granted page access driver");
53 static int limit = 1024*1024;
54 module_param(limit, int, 0644);
55 MODULE_PARM_DESC(limit, "Maximum number of grants that may be mapped by "
58 static atomic_t pages_mapped = ATOMIC_INIT(0);
60 static int use_ptemod;
61 #define populate_freeable_maps use_ptemod
64 /* maps with visible offsets in the file descriptor */
65 struct list_head maps;
66 /* maps that are not visible; will be freed on munmap.
67 * Only populated if populate_freeable_maps == 1 */
68 struct list_head freeable_maps;
69 /* lock protects maps and freeable_maps */
72 struct mmu_notifier mn;
77 /* Address relative to the start of the grant_map */
83 struct list_head next;
84 struct vm_area_struct *vma;
89 struct unmap_notify notify;
90 struct ioctl_gntdev_grant_ref *grants;
91 struct gnttab_map_grant_ref *map_ops;
92 struct gnttab_unmap_grant_ref *unmap_ops;
93 struct gnttab_map_grant_ref *kmap_ops;
94 struct gnttab_unmap_grant_ref *kunmap_ops;
98 static int unmap_grant_pages(struct grant_map *map, int offset, int pages);
100 /* ------------------------------------------------------------------ */
102 static void gntdev_print_maps(struct gntdev_priv *priv,
103 char *text, int text_index)
106 struct grant_map *map;
108 pr_debug("%s: maps list (priv %p)\n", __func__, priv);
109 list_for_each_entry(map, &priv->maps, next)
110 pr_debug(" index %2d, count %2d %s\n",
111 map->index, map->count,
112 map->index == text_index && text ? text : "");
116 static void gntdev_free_map(struct grant_map *map)
122 gnttab_free_pages(map->count, map->pages);
126 kfree(map->unmap_ops);
127 kfree(map->kmap_ops);
128 kfree(map->kunmap_ops);
132 static struct grant_map *gntdev_alloc_map(struct gntdev_priv *priv, int count)
134 struct grant_map *add;
137 add = kzalloc(sizeof(struct grant_map), GFP_KERNEL);
141 add->grants = kcalloc(count, sizeof(add->grants[0]), GFP_KERNEL);
142 add->map_ops = kcalloc(count, sizeof(add->map_ops[0]), GFP_KERNEL);
143 add->unmap_ops = kcalloc(count, sizeof(add->unmap_ops[0]), GFP_KERNEL);
144 add->kmap_ops = kcalloc(count, sizeof(add->kmap_ops[0]), GFP_KERNEL);
145 add->kunmap_ops = kcalloc(count, sizeof(add->kunmap_ops[0]), GFP_KERNEL);
146 add->pages = kcalloc(count, sizeof(add->pages[0]), GFP_KERNEL);
147 if (NULL == add->grants ||
148 NULL == add->map_ops ||
149 NULL == add->unmap_ops ||
150 NULL == add->kmap_ops ||
151 NULL == add->kunmap_ops ||
155 if (gnttab_alloc_pages(count, add->pages))
158 for (i = 0; i < count; i++) {
159 add->map_ops[i].handle = -1;
160 add->unmap_ops[i].handle = -1;
161 add->kmap_ops[i].handle = -1;
162 add->kunmap_ops[i].handle = -1;
167 atomic_set(&add->users, 1);
172 gntdev_free_map(add);
176 static void gntdev_add_map(struct gntdev_priv *priv, struct grant_map *add)
178 struct grant_map *map;
180 list_for_each_entry(map, &priv->maps, next) {
181 if (add->index + add->count < map->index) {
182 list_add_tail(&add->next, &map->next);
185 add->index = map->index + map->count;
187 list_add_tail(&add->next, &priv->maps);
190 gntdev_print_maps(priv, "[new]", add->index);
193 static struct grant_map *gntdev_find_map_index(struct gntdev_priv *priv,
194 int index, int count)
196 struct grant_map *map;
198 list_for_each_entry(map, &priv->maps, next) {
199 if (map->index != index)
201 if (count && map->count != count)
208 static void gntdev_put_map(struct gntdev_priv *priv, struct grant_map *map)
213 if (!atomic_dec_and_test(&map->users))
216 atomic_sub(map->count, &pages_mapped);
218 if (map->notify.flags & UNMAP_NOTIFY_SEND_EVENT) {
219 notify_remote_via_evtchn(map->notify.event);
220 evtchn_put(map->notify.event);
223 if (populate_freeable_maps && priv) {
224 mutex_lock(&priv->lock);
225 list_del(&map->next);
226 mutex_unlock(&priv->lock);
229 if (map->pages && !use_ptemod)
230 unmap_grant_pages(map, 0, map->count);
231 gntdev_free_map(map);
234 /* ------------------------------------------------------------------ */
236 static int find_grant_ptes(pte_t *pte, pgtable_t token,
237 unsigned long addr, void *data)
239 struct grant_map *map = data;
240 unsigned int pgnr = (addr - map->vma->vm_start) >> PAGE_SHIFT;
241 int flags = map->flags | GNTMAP_application_map | GNTMAP_contains_pte;
244 BUG_ON(pgnr >= map->count);
245 pte_maddr = arbitrary_virt_to_machine(pte).maddr;
248 * Set the PTE as special to force get_user_pages_fast() fall
249 * back to the slow path. If this is not supported as part of
250 * the grant map, it will be done afterwards.
252 if (xen_feature(XENFEAT_gnttab_map_avail_bits))
253 flags |= (1 << _GNTMAP_guest_avail0);
255 gnttab_set_map_op(&map->map_ops[pgnr], pte_maddr, flags,
256 map->grants[pgnr].ref,
257 map->grants[pgnr].domid);
258 gnttab_set_unmap_op(&map->unmap_ops[pgnr], pte_maddr, flags,
264 static int set_grant_ptes_as_special(pte_t *pte, pgtable_t token,
265 unsigned long addr, void *data)
267 set_pte_at(current->mm, addr, pte, pte_mkspecial(*pte));
272 static int map_grant_pages(struct grant_map *map)
277 /* Note: it could already be mapped */
278 if (map->map_ops[0].handle != -1)
280 for (i = 0; i < map->count; i++) {
281 unsigned long addr = (unsigned long)
282 pfn_to_kaddr(page_to_pfn(map->pages[i]));
283 gnttab_set_map_op(&map->map_ops[i], addr, map->flags,
285 map->grants[i].domid);
286 gnttab_set_unmap_op(&map->unmap_ops[i], addr,
287 map->flags, -1 /* handle */);
291 * Setup the map_ops corresponding to the pte entries pointing
292 * to the kernel linear addresses of the struct pages.
293 * These ptes are completely different from the user ptes dealt
294 * with find_grant_ptes.
296 for (i = 0; i < map->count; i++) {
297 unsigned long address = (unsigned long)
298 pfn_to_kaddr(page_to_pfn(map->pages[i]));
299 BUG_ON(PageHighMem(map->pages[i]));
301 gnttab_set_map_op(&map->kmap_ops[i], address,
302 map->flags | GNTMAP_host_map,
304 map->grants[i].domid);
305 gnttab_set_unmap_op(&map->kunmap_ops[i], address,
306 map->flags | GNTMAP_host_map, -1);
310 pr_debug("map %d+%d\n", map->index, map->count);
311 err = gnttab_map_refs(map->map_ops, use_ptemod ? map->kmap_ops : NULL,
312 map->pages, map->count);
316 for (i = 0; i < map->count; i++) {
317 if (map->map_ops[i].status) {
322 map->unmap_ops[i].handle = map->map_ops[i].handle;
324 map->kunmap_ops[i].handle = map->kmap_ops[i].handle;
329 struct unmap_grant_pages_callback_data
331 struct completion completion;
335 static void unmap_grant_callback(int result,
336 struct gntab_unmap_queue_data *data)
338 struct unmap_grant_pages_callback_data* d = data->data;
341 complete(&d->completion);
344 static int __unmap_grant_pages(struct grant_map *map, int offset, int pages)
347 struct gntab_unmap_queue_data unmap_data;
348 struct unmap_grant_pages_callback_data data;
350 init_completion(&data.completion);
351 unmap_data.data = &data;
352 unmap_data.done= &unmap_grant_callback;
354 if (map->notify.flags & UNMAP_NOTIFY_CLEAR_BYTE) {
355 int pgno = (map->notify.addr >> PAGE_SHIFT);
356 if (pgno >= offset && pgno < offset + pages) {
357 /* No need for kmap, pages are in lowmem */
358 uint8_t *tmp = pfn_to_kaddr(page_to_pfn(map->pages[pgno]));
359 tmp[map->notify.addr & (PAGE_SIZE-1)] = 0;
360 map->notify.flags &= ~UNMAP_NOTIFY_CLEAR_BYTE;
364 unmap_data.unmap_ops = map->unmap_ops + offset;
365 unmap_data.kunmap_ops = use_ptemod ? map->kunmap_ops + offset : NULL;
366 unmap_data.pages = map->pages + offset;
367 unmap_data.count = pages;
369 gnttab_unmap_refs_async(&unmap_data);
371 wait_for_completion(&data.completion);
375 for (i = 0; i < pages; i++) {
376 if (map->unmap_ops[offset+i].status)
378 pr_debug("unmap handle=%d st=%d\n",
379 map->unmap_ops[offset+i].handle,
380 map->unmap_ops[offset+i].status);
381 map->unmap_ops[offset+i].handle = -1;
386 static int unmap_grant_pages(struct grant_map *map, int offset, int pages)
390 pr_debug("unmap %d+%d [%d+%d]\n", map->index, map->count, offset, pages);
392 /* It is possible the requested range will have a "hole" where we
393 * already unmapped some of the grants. Only unmap valid ranges.
395 while (pages && !err) {
396 while (pages && map->unmap_ops[offset].handle == -1) {
401 while (range < pages) {
402 if (map->unmap_ops[offset+range].handle == -1) {
408 err = __unmap_grant_pages(map, offset, range);
416 /* ------------------------------------------------------------------ */
418 static void gntdev_vma_open(struct vm_area_struct *vma)
420 struct grant_map *map = vma->vm_private_data;
422 pr_debug("gntdev_vma_open %p\n", vma);
423 atomic_inc(&map->users);
426 static void gntdev_vma_close(struct vm_area_struct *vma)
428 struct grant_map *map = vma->vm_private_data;
429 struct file *file = vma->vm_file;
430 struct gntdev_priv *priv = file->private_data;
432 pr_debug("gntdev_vma_close %p\n", vma);
434 /* It is possible that an mmu notifier could be running
435 * concurrently, so take priv->lock to ensure that the vma won't
436 * vanishing during the unmap_grant_pages call, since we will
437 * spin here until that completes. Such a concurrent call will
438 * not do any unmapping, since that has been done prior to
439 * closing the vma, but it may still iterate the unmap_ops list.
441 mutex_lock(&priv->lock);
443 mutex_unlock(&priv->lock);
445 vma->vm_private_data = NULL;
446 gntdev_put_map(priv, map);
449 static struct vm_operations_struct gntdev_vmops = {
450 .open = gntdev_vma_open,
451 .close = gntdev_vma_close,
454 /* ------------------------------------------------------------------ */
456 static void unmap_if_in_range(struct grant_map *map,
457 unsigned long start, unsigned long end)
459 unsigned long mstart, mend;
464 if (map->vma->vm_start >= end)
466 if (map->vma->vm_end <= start)
468 mstart = max(start, map->vma->vm_start);
469 mend = min(end, map->vma->vm_end);
470 pr_debug("map %d+%d (%lx %lx), range %lx %lx, mrange %lx %lx\n",
471 map->index, map->count,
472 map->vma->vm_start, map->vma->vm_end,
473 start, end, mstart, mend);
474 err = unmap_grant_pages(map,
475 (mstart - map->vma->vm_start) >> PAGE_SHIFT,
476 (mend - mstart) >> PAGE_SHIFT);
480 static void mn_invl_range_start(struct mmu_notifier *mn,
481 struct mm_struct *mm,
482 unsigned long start, unsigned long end)
484 struct gntdev_priv *priv = container_of(mn, struct gntdev_priv, mn);
485 struct grant_map *map;
487 mutex_lock(&priv->lock);
488 list_for_each_entry(map, &priv->maps, next) {
489 unmap_if_in_range(map, start, end);
491 list_for_each_entry(map, &priv->freeable_maps, next) {
492 unmap_if_in_range(map, start, end);
494 mutex_unlock(&priv->lock);
497 static void mn_invl_page(struct mmu_notifier *mn,
498 struct mm_struct *mm,
499 unsigned long address)
501 mn_invl_range_start(mn, mm, address, address + PAGE_SIZE);
504 static void mn_release(struct mmu_notifier *mn,
505 struct mm_struct *mm)
507 struct gntdev_priv *priv = container_of(mn, struct gntdev_priv, mn);
508 struct grant_map *map;
511 mutex_lock(&priv->lock);
512 list_for_each_entry(map, &priv->maps, next) {
515 pr_debug("map %d+%d (%lx %lx)\n",
516 map->index, map->count,
517 map->vma->vm_start, map->vma->vm_end);
518 err = unmap_grant_pages(map, /* offset */ 0, map->count);
521 list_for_each_entry(map, &priv->freeable_maps, next) {
524 pr_debug("map %d+%d (%lx %lx)\n",
525 map->index, map->count,
526 map->vma->vm_start, map->vma->vm_end);
527 err = unmap_grant_pages(map, /* offset */ 0, map->count);
530 mutex_unlock(&priv->lock);
533 static struct mmu_notifier_ops gntdev_mmu_ops = {
534 .release = mn_release,
535 .invalidate_page = mn_invl_page,
536 .invalidate_range_start = mn_invl_range_start,
539 /* ------------------------------------------------------------------ */
541 static int gntdev_open(struct inode *inode, struct file *flip)
543 struct gntdev_priv *priv;
546 priv = kzalloc(sizeof(*priv), GFP_KERNEL);
550 INIT_LIST_HEAD(&priv->maps);
551 INIT_LIST_HEAD(&priv->freeable_maps);
552 mutex_init(&priv->lock);
555 priv->mm = get_task_mm(current);
560 priv->mn.ops = &gntdev_mmu_ops;
561 ret = mmu_notifier_register(&priv->mn, priv->mm);
570 flip->private_data = priv;
571 pr_debug("priv %p\n", priv);
576 static int gntdev_release(struct inode *inode, struct file *flip)
578 struct gntdev_priv *priv = flip->private_data;
579 struct grant_map *map;
581 pr_debug("priv %p\n", priv);
583 while (!list_empty(&priv->maps)) {
584 map = list_entry(priv->maps.next, struct grant_map, next);
585 list_del(&map->next);
586 gntdev_put_map(NULL /* already removed */, map);
588 WARN_ON(!list_empty(&priv->freeable_maps));
591 mmu_notifier_unregister(&priv->mn, priv->mm);
596 static long gntdev_ioctl_map_grant_ref(struct gntdev_priv *priv,
597 struct ioctl_gntdev_map_grant_ref __user *u)
599 struct ioctl_gntdev_map_grant_ref op;
600 struct grant_map *map;
603 if (copy_from_user(&op, u, sizeof(op)) != 0)
605 pr_debug("priv %p, add %d\n", priv, op.count);
606 if (unlikely(op.count <= 0))
610 map = gntdev_alloc_map(priv, op.count);
614 if (unlikely(atomic_add_return(op.count, &pages_mapped) > limit)) {
615 pr_debug("can't map: over limit\n");
616 gntdev_put_map(NULL, map);
620 if (copy_from_user(map->grants, &u->refs,
621 sizeof(map->grants[0]) * op.count) != 0) {
622 gntdev_put_map(NULL, map);
626 mutex_lock(&priv->lock);
627 gntdev_add_map(priv, map);
628 op.index = map->index << PAGE_SHIFT;
629 mutex_unlock(&priv->lock);
631 if (copy_to_user(u, &op, sizeof(op)) != 0)
637 static long gntdev_ioctl_unmap_grant_ref(struct gntdev_priv *priv,
638 struct ioctl_gntdev_unmap_grant_ref __user *u)
640 struct ioctl_gntdev_unmap_grant_ref op;
641 struct grant_map *map;
644 if (copy_from_user(&op, u, sizeof(op)) != 0)
646 pr_debug("priv %p, del %d+%d\n", priv, (int)op.index, (int)op.count);
648 mutex_lock(&priv->lock);
649 map = gntdev_find_map_index(priv, op.index >> PAGE_SHIFT, op.count);
651 list_del(&map->next);
652 if (populate_freeable_maps)
653 list_add_tail(&map->next, &priv->freeable_maps);
656 mutex_unlock(&priv->lock);
658 gntdev_put_map(priv, map);
662 static long gntdev_ioctl_get_offset_for_vaddr(struct gntdev_priv *priv,
663 struct ioctl_gntdev_get_offset_for_vaddr __user *u)
665 struct ioctl_gntdev_get_offset_for_vaddr op;
666 struct vm_area_struct *vma;
667 struct grant_map *map;
670 if (copy_from_user(&op, u, sizeof(op)) != 0)
672 pr_debug("priv %p, offset for vaddr %lx\n", priv, (unsigned long)op.vaddr);
674 down_read(¤t->mm->mmap_sem);
675 vma = find_vma(current->mm, op.vaddr);
676 if (!vma || vma->vm_ops != &gntdev_vmops)
679 map = vma->vm_private_data;
683 op.offset = map->index << PAGE_SHIFT;
684 op.count = map->count;
688 up_read(¤t->mm->mmap_sem);
690 if (rv == 0 && copy_to_user(u, &op, sizeof(op)) != 0)
695 static long gntdev_ioctl_notify(struct gntdev_priv *priv, void __user *u)
697 struct ioctl_gntdev_unmap_notify op;
698 struct grant_map *map;
701 unsigned int out_event;
703 if (copy_from_user(&op, u, sizeof(op)))
706 if (op.action & ~(UNMAP_NOTIFY_CLEAR_BYTE|UNMAP_NOTIFY_SEND_EVENT))
709 /* We need to grab a reference to the event channel we are going to use
710 * to send the notify before releasing the reference we may already have
711 * (if someone has called this ioctl twice). This is required so that
712 * it is possible to change the clear_byte part of the notification
713 * without disturbing the event channel part, which may now be the last
714 * reference to that event channel.
716 if (op.action & UNMAP_NOTIFY_SEND_EVENT) {
717 if (evtchn_get(op.event_channel_port))
721 out_flags = op.action;
722 out_event = op.event_channel_port;
724 mutex_lock(&priv->lock);
726 list_for_each_entry(map, &priv->maps, next) {
727 uint64_t begin = map->index << PAGE_SHIFT;
728 uint64_t end = (map->index + map->count) << PAGE_SHIFT;
729 if (op.index >= begin && op.index < end)
736 if ((op.action & UNMAP_NOTIFY_CLEAR_BYTE) &&
737 (map->flags & GNTMAP_readonly)) {
742 out_flags = map->notify.flags;
743 out_event = map->notify.event;
745 map->notify.flags = op.action;
746 map->notify.addr = op.index - (map->index << PAGE_SHIFT);
747 map->notify.event = op.event_channel_port;
752 mutex_unlock(&priv->lock);
754 /* Drop the reference to the event channel we did not save in the map */
755 if (out_flags & UNMAP_NOTIFY_SEND_EVENT)
756 evtchn_put(out_event);
761 static long gntdev_ioctl(struct file *flip,
762 unsigned int cmd, unsigned long arg)
764 struct gntdev_priv *priv = flip->private_data;
765 void __user *ptr = (void __user *)arg;
768 case IOCTL_GNTDEV_MAP_GRANT_REF:
769 return gntdev_ioctl_map_grant_ref(priv, ptr);
771 case IOCTL_GNTDEV_UNMAP_GRANT_REF:
772 return gntdev_ioctl_unmap_grant_ref(priv, ptr);
774 case IOCTL_GNTDEV_GET_OFFSET_FOR_VADDR:
775 return gntdev_ioctl_get_offset_for_vaddr(priv, ptr);
777 case IOCTL_GNTDEV_SET_UNMAP_NOTIFY:
778 return gntdev_ioctl_notify(priv, ptr);
781 pr_debug("priv %p, unknown cmd %x\n", priv, cmd);
788 static int gntdev_mmap(struct file *flip, struct vm_area_struct *vma)
790 struct gntdev_priv *priv = flip->private_data;
791 int index = vma->vm_pgoff;
792 int count = (vma->vm_end - vma->vm_start) >> PAGE_SHIFT;
793 struct grant_map *map;
794 int i, err = -EINVAL;
796 if ((vma->vm_flags & VM_WRITE) && !(vma->vm_flags & VM_SHARED))
799 pr_debug("map %d+%d at %lx (pgoff %lx)\n",
800 index, count, vma->vm_start, vma->vm_pgoff);
802 mutex_lock(&priv->lock);
803 map = gntdev_find_map_index(priv, index, count);
806 if (use_ptemod && map->vma)
808 if (use_ptemod && priv->mm != vma->vm_mm) {
809 pr_warn("Huh? Other mm?\n");
813 atomic_inc(&map->users);
815 vma->vm_ops = &gntdev_vmops;
817 vma->vm_flags |= VM_DONTEXPAND | VM_DONTDUMP;
820 vma->vm_flags |= VM_DONTCOPY;
822 vma->vm_private_data = map;
828 if ((vma->vm_flags & VM_WRITE) &&
829 (map->flags & GNTMAP_readonly))
832 map->flags = GNTMAP_host_map;
833 if (!(vma->vm_flags & VM_WRITE))
834 map->flags |= GNTMAP_readonly;
837 mutex_unlock(&priv->lock);
840 err = apply_to_page_range(vma->vm_mm, vma->vm_start,
841 vma->vm_end - vma->vm_start,
842 find_grant_ptes, map);
844 pr_warn("find_grant_ptes() failure.\n");
849 err = map_grant_pages(map);
854 for (i = 0; i < count; i++) {
855 err = vm_insert_page(vma, vma->vm_start + i*PAGE_SIZE,
863 * If the PTEs were not made special by the grant map
864 * hypercall, do so here.
866 * This is racy since the mapping is already visible
867 * to userspace but userspace should be well-behaved
868 * enough to not touch it until the mmap() call
871 if (!xen_feature(XENFEAT_gnttab_map_avail_bits)) {
872 apply_to_page_range(vma->vm_mm, vma->vm_start,
873 vma->vm_end - vma->vm_start,
874 set_grant_ptes_as_special, NULL);
882 mutex_unlock(&priv->lock);
886 mutex_unlock(&priv->lock);
890 gntdev_put_map(priv, map);
894 static const struct file_operations gntdev_fops = {
895 .owner = THIS_MODULE,
897 .release = gntdev_release,
899 .unlocked_ioctl = gntdev_ioctl
902 static struct miscdevice gntdev_miscdev = {
903 .minor = MISC_DYNAMIC_MINOR,
904 .name = "xen/gntdev",
905 .fops = &gntdev_fops,
908 /* ------------------------------------------------------------------ */
910 static int __init gntdev_init(void)
917 use_ptemod = !xen_feature(XENFEAT_auto_translated_physmap);
919 err = misc_register(&gntdev_miscdev);
921 pr_err("Could not register gntdev device\n");
927 static void __exit gntdev_exit(void)
929 misc_deregister(&gntdev_miscdev);
932 module_init(gntdev_init);
933 module_exit(gntdev_exit);
935 /* ------------------------------------------------------------------ */