]> xenbits.xensource.com Git - people/julieng/linux-arm.git/commitdiff
fb/xen-fbfront: Support 64KB pages
authorJulien Grall <julien.grall@citrix.com>
Fri, 28 Aug 2015 17:54:56 +0000 (18:54 +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/video/fbdev/xen-fbfront.c
include/xen/interface/io/fbif.h

index 0567d517eed34b2993a2bdf6df963ab55564297a..5e1423712011a25e983e91749fae6597c8db9f80 100644 (file)
@@ -43,7 +43,7 @@ struct xenfb_info {
        int                     x1, y1, x2, y2; /* dirty rectangle,
                                                   protected by dirty_lock */
        spinlock_t              dirty_lock;
-       int                     nr_pages;
+       int                     nr_gfns;
        int                     irq;
        struct xenfb_page       *page;
        unsigned long           *gfns;
@@ -400,9 +400,11 @@ static int xenfb_probe(struct xenbus_device *dev,
        if (info->fb == NULL)
                goto error_nomem;
 
-       info->nr_pages = (fb_size + PAGE_SIZE - 1) >> PAGE_SHIFT;
+       info->nr_gfns = XEN_PFN_UP(fb_size);
+       printk("%s: fb_size %u nr_gfns = %u\n",
+              __FUNCTION__, fb_size, info->nr_gfns);
 
-       info->gfns = vmalloc(sizeof(unsigned long) * info->nr_pages);
+       info->gfns = vmalloc(sizeof(unsigned long) * info->nr_gfns);
        if (!info->gfns)
                goto error_nomem;
 
@@ -537,21 +539,23 @@ static int xenfb_remove(struct xenbus_device *dev)
        return 0;
 }
 
-static unsigned long vmalloc_to_gfn(void *address)
+static unsigned long vmalloc_to_gfn(void *v)
 {
-       return xen_page_to_gfn(vmalloc_to_page(address));
+       struct page *p = vmalloc_to_page(v);
+
+       return pfn_to_gfn(XEN_PFN_DOWN(page_to_phys(p) + offset_in_page(v)));
 }
 
 static void xenfb_init_shared_page(struct xenfb_info *info,
                                   struct fb_info *fb_info)
 {
        int i;
-       int epd = PAGE_SIZE / sizeof(info->gfns[0]);
+       int epd = XEN_PAGE_SIZE / sizeof(info->gfns[0]);
 
-       for (i = 0; i < info->nr_pages; i++)
-               info->gfns[i] = vmalloc_to_gfn(info->fb + i * PAGE_SIZE);
+       for (i = 0; i < info->nr_gfns; i++)
+               info->gfns[i] = vmalloc_to_gfn(info->fb + i * XEN_PAGE_SIZE);
 
-       for (i = 0; i * epd < info->nr_pages; i++)
+       for (i = 0; i * epd < info->nr_gfns; i++)
                info->page->pd[i] = vmalloc_to_gfn(&info->gfns[i * epd]);
 
        info->page->width = fb_info->var.xres;
index 974a51ed91654f39dc58a3664312642f0cfd369d..7b2c7d520d9b2af1599cdab0a8301c4f48fd3ceb 100644 (file)
@@ -118,9 +118,9 @@ struct xenfb_page {
        /*
         * Framebuffer page directory
         *
-        * Each directory page holds PAGE_SIZE / sizeof(*pd)
-        * framebuffer pages, and can thus map up to PAGE_SIZE *
-        * PAGE_SIZE / sizeof(*pd) bytes.  With PAGE_SIZE == 4096 and
+        * Each directory page holds XEN_PAGE_SIZE / sizeof(*pd)
+        * framebuffer pages, and can thus map up to XEN_PAGE_SIZE *
+        * XEN_PAGE_SIZE / sizeof(*pd) bytes.  With XEN_PAGE_SIZE == 4096 and
         * sizeof(unsigned long) == 4/8, that's 4 Megs 32 bit and 2
         * Megs 64 bit.  256 directories give enough room for a 512
         * Meg framebuffer with a max resolution of 12,800x10,240.