]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
xen/v86d: Fix /dev/mem to access memory below 1MB
authorKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Fri, 23 Sep 2011 19:54:05 +0000 (15:54 -0400)
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Wed, 9 Nov 2011 21:04:29 +0000 (16:04 -0500)
We need to provide the VM_IO (and _PAGE_IOMAP) to see the contents
of the memory below 1MB.

Reported-and-Tested-by: Ben Guthro <ben.guthro@virtualcomputer.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
drivers/char/mem.c

index 8fc04b4f311f72c802a1df13af7108e3082a1b3f..a1be5259aabbc4d3cfa9022bbc9655c382555103 100644 (file)
@@ -313,9 +313,14 @@ static int mmap_mem(struct file *file, struct vm_area_struct *vma)
                                                &vma->vm_page_prot))
                return -EINVAL;
 
-       vma->vm_page_prot = phys_mem_access_prot(file, vma->vm_pgoff,
-                                                size,
-                                                vma->vm_page_prot);
+       vma->vm_flags |= VM_RESERVED | VM_IO | VM_PFNMAP | VM_DONTEXPAND;
+       vma->vm_page_prot =  __pgprot(
+                       pgprot_val(vm_get_page_prot(vma->vm_flags)) |
+                       _PAGE_IOMAP |
+                       pgprot_val(phys_mem_access_prot(file,
+                               vma->vm_pgoff,
+                               size,
+                               vma->vm_page_prot)));
 
        vma->vm_ops = &mmap_mem_ops;