From: Ian Pratt <Ian.Pratt@cl.cam.ac.uk>
To: Ian Pratt <Ian.Pratt@cl.cam.ac.uk>
Cc: linux-kernel@vger.kernel.org, Steven.Hand@cl.cam.ac.uk,
Christian.Limpach@cl.cam.ac.uk, Keir.Fraser@cl.cam.ac.uk,
Ian.Pratt@cl.cam.ac.uk
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 [thread overview]
Message-ID: <E1CVI5c-0004bf-00@mta1.cl.cam.ac.uk> (raw)
In-Reply-To: Your message of "Fri, 19 Nov 2004 23:16:33 GMT." <E1CVHzW-0004XC-00@mta1.cl.cam.ac.uk>
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;
}
next prev parent reply other threads:[~2004-11-19 23:30 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-11-19 23:16 Xen VMM patch set - take 2 Ian Pratt
2004-11-19 23:20 ` [1/7] Xen VMM patch set : add ptep_establish_new to make va available Ian Pratt
2004-11-19 23:20 ` [2/7] Xen VMM patch set : return code for arch_free_page Ian Pratt
2004-11-30 2:28 ` Andrea Arcangeli
2004-11-19 23:21 ` [3/7] Xen VMM patch set : runtime disable of VT console Ian Pratt
2004-11-19 23:22 ` Ian Pratt [this message]
2004-11-20 2:03 ` [4/7] Xen VMM patch set : /dev/mem io_remap_page_range for CONFIG_XEN William Lee Irwin III
2004-11-20 16:31 ` Christoph Hellwig
2004-11-20 18:03 ` Ian Pratt
2004-11-27 12:39 ` Ian Pratt
2004-11-27 16:51 ` Randy.Dunlap
2004-11-30 3:08 ` Andrea Arcangeli
2004-11-30 3:14 ` David S. Miller
2004-11-30 3:38 ` William Lee Irwin III
2004-11-30 8:56 ` Ian Pratt
2004-11-30 9:04 ` Arjan van de Ven
2004-11-30 12:09 ` Ian Pratt
2004-11-30 12:14 ` Arjan van de Ven
2004-11-30 12:18 ` Arjan van de Ven
2004-11-30 13:16 ` Ian Pratt
2004-11-30 18:03 ` Andrea Arcangeli
2004-12-04 23:49 ` Ian Pratt
2004-12-05 0:40 ` Andrea Arcangeli
2004-12-05 2:47 ` William Lee Irwin III
2004-11-19 23:23 ` [5/7] Xen VMM patch set : split free_irq into teardown_irq Ian Pratt
2004-11-20 16:32 ` Christoph Hellwig
2004-11-20 19:20 ` Ian Pratt
2004-11-27 12:45 ` Ian Pratt
2004-11-19 23:25 ` [6/7] Xen VMM patch set : add alloc_skb_from_cache Ian Pratt
2004-11-20 2:11 ` James Morris
2004-11-20 6:03 ` Chris Wedgwood
2004-11-20 6:47 ` David S. Miller
2004-11-20 10:28 ` Keir Fraser
2004-11-20 10:33 ` Chris Wedgwood
2004-11-19 23:28 ` [7/7] Xen VMM patch set : handle fragemented skbs correctly in icmp_filter Ian Pratt
2004-11-25 15:46 ` Xen VMM patch set - take 2 Ian Pratt
2004-11-28 17:07 ` Rik van Riel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=E1CVI5c-0004bf-00@mta1.cl.cam.ac.uk \
--to=ian.pratt@cl.cam.ac.uk \
--cc=Christian.Limpach@cl.cam.ac.uk \
--cc=Keir.Fraser@cl.cam.ac.uk \
--cc=Steven.Hand@cl.cam.ac.uk \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®