From: Ian Pratt <Ian.Pratt@cl.cam.ac.uk>
To: linux-kernel@vger.kernel.org
Cc: Ian.Pratt@cl.cam.ac.uk, akpm@osdl.org, Keir.Fraser@cl.cam.ac.uk,
Christian.Limpach@cl.cam.ac.uk
Subject: [patch 4/4] Xen core patch : /dev/mem calls io_remap_page_range
Date: Wed, 17 Nov 2004 23:56:38 +0000 [thread overview]
Message-ID: <E1CUZfD-00059Q-00@mta1.cl.cam.ac.uk> (raw)
This patch modifies /dev/mem to call io_remap_page_range rather than
remap_page_range under CONFIG_XEN. (the two definitions are different
under arch xen, unlike most other architectures). 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.9/drivers/char/mem.c linux-2.6.9-xen0/drivers/char/mem.c
--- pristine-linux-2.6.9/drivers/char/mem.c 2004-10-18 22:54:19.000000000 +0100
+++ linux-2.6.9-xen0/drivers/char/mem.c 2004-11-17 00:12:37.000000000 +0000
@@ -26,6 +26,7 @@
#include <asm/uaccess.h>
#include <asm/io.h>
+#include <asm/pgalloc.h>
#ifdef CONFIG_IA64
# include <linux/efi.h>
@@ -42,7 +43,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,
@@ -210,9 +216,15 @@ static int mmap_mem(struct file * file,
if (uncached)
vma->vm_flags |= VM_IO;
+#if defined(CONFIG_XEN)
+ if (io_remap_page_range(vma, vma->vm_start, offset,
+ vma->vm_end-vma->vm_start, vma->vm_page_prot))
+ return -EAGAIN;
+#else
if (remap_page_range(vma, vma->vm_start, offset, vma->vm_end-vma->vm_start,
vma->vm_page_prot))
return -EAGAIN;
+#endif
return 0;
}
next reply other threads:[~2004-11-18 0:03 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-11-17 23:56 Ian Pratt [this message]
2004-11-18 0:25 ` Dave Hansen
2004-11-18 1:05 ` Ian Pratt
2004-11-18 1:20 ` Dave Hansen
2004-11-18 3:01 ` Andrew Morton
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=E1CUZfD-00059Q-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=akpm@osdl.org \
--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®