Messages in this thread Patch in this message | | | Subject | [4/7] Xen VMM patch set : /dev/mem io_remap_page_range for CONFIG_XEN | Date | Fri, 19 Nov 2004 23:22:51 +0000 | From | Ian Pratt <> |
| |
This patch modifies /dev/mem to call io_remap_page_range rather than remap_pfn_range under CONFIG_XEN. This is required because in arch xen we need to use a different function for mapping MMIO space vs mapping psueudo-physical memory. This allows the X server and other programs that use /dev/mem for MMIO to work under Xen.
Signed-off-by: ian.pratt@cl.cam.ac.uk
---
diff -Nurp pristine-linux-2.6.10-rc2/drivers/char/mem.c tmp-linux-2.6.10-rc2-xen.patch/drivers/char/mem.c --- pristine-linux-2.6.10-rc2/drivers/char/mem.c 2004-11-15 01:27:41.000000000 +0000 +++ tmp-linux-2.6.10-rc2-xen.patch/drivers/char/mem.c 2004-11-19 16:33:04.000000000 +0000 @@ -42,7 +42,12 @@ extern void tapechar_init(void); */ static inline int uncached_access(struct file *file, unsigned long addr) { -#if defined(__i386__) +#ifdef CONFIG_XEN + if (file->f_flags & O_SYNC) + return 1; + /* Xen sets correct MTRR type on non-RAM for us. */ + return 0; +#elif defined(__i386__) /* * On the PPro and successors, the MTRRs are used to set * memory types for physical addresses outside main memory, @@ -201,6 +206,14 @@ static int mmap_mem(struct file * file, vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); #endif +#if defined(CONFIG_XEN) + if (io_remap_page_range(vma, + vma->vm_start, + vma->vm_pgoff << PAGE_SHIFT, + vma->vm_end-vma->vm_start, + vma->vm_page_prot)) + return -EAGAIN; +#else /* Remap-pfn-range will mark the range VM_IO and VM_RESERVED */ if (remap_pfn_range(vma, vma->vm_start, @@ -208,6 +221,7 @@ static int mmap_mem(struct file * file, vma->vm_end-vma->vm_start, vma->vm_page_prot)) return -EAGAIN; +#endif return 0; } - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |