From: Konrad Rzeszutek Wilk Date: Fri, 23 Sep 2011 19:54:05 +0000 (-0400) Subject: xen/v86d: Fix /dev/mem to access memory below 1MB X-Git-Tag: v2.6.39-400.9.0~830^2~2^2~2 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=0cfd8ac8e702db147a9a664212f597f627b3f7e9;p=users%2Fjedix%2Flinux-maple.git xen/v86d: Fix /dev/mem to access memory below 1MB 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 Signed-off-by: Konrad Rzeszutek Wilk --- diff --git a/drivers/char/mem.c b/drivers/char/mem.c index 8fc04b4f311f..a1be5259aabb 100644 --- a/drivers/char/mem.c +++ b/drivers/char/mem.c @@ -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;