]> xenbits.xensource.com Git - people/julieng/linux-arm.git/commitdiff
xen/gnttdev: Add support for 64KB pages
authorJulien Grall <julien.grall@citrix.com>
Wed, 12 Aug 2015 17:02:06 +0000 (18:02 +0100)
committerJulien Grall <julien.grall@citrix.com>
Mon, 28 Sep 2015 11:07:27 +0000 (12:07 +0100)
Signed-off-by: Julien Grall <julien.grall@citrix.com>
drivers/xen/gntdev.c

index 0dbb222daaf1c694b1f073f3e206f755f5f77cc6..dc44127489b215bcffa15a54aadfa7c50504c7e9 100644 (file)
@@ -333,11 +333,11 @@ static int __unmap_grant_pages(struct grant_map *map, int offset, int pages)
        struct gntab_unmap_queue_data unmap_data;
 
        if (map->notify.flags & UNMAP_NOTIFY_CLEAR_BYTE) {
-               int pgno = (map->notify.addr >> PAGE_SHIFT);
+               int pgno = (map->notify.addr >> XEN_PAGE_SHIFT);
                if (pgno >= offset && pgno < offset + pages) {
                        /* No need for kmap, pages are in lowmem */
                        uint8_t *tmp = pfn_to_kaddr(page_to_pfn(map->pages[pgno]));
-                       tmp[map->notify.addr & (PAGE_SIZE-1)] = 0;
+                       tmp[map->notify.addr & (XEN_PAGE_SIZE-1)] = 0;
                        map->notify.flags &= ~UNMAP_NOTIFY_CLEAR_BYTE;
                }
        }
@@ -596,6 +596,20 @@ static long gntdev_ioctl_map_grant_ref(struct gntdev_priv *priv,
        if (unlikely(op.count <= 0))
                return -EINVAL;
 
+       /* The grant API is always allocating one Linux page per grant.
+        * So it's not possible to map multiple grant as they won't be
+        * contiguous in the virtual memory.
+        *
+        * For now only allow to map one grant by one grant when the Linux
+        * and Xen page granularity are different.
+        *
+        * XXX: Handle support of multiple grant per Linux page
+        */
+#if XEN_PAGE_SIZE != PAGE_SIZE
+       if (op.count != 1)
+               return -EINVAL;
+#endif
+
        err = -ENOMEM;
        map = gntdev_alloc_map(priv, op.count);
        if (!map)