# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Date 1184338990 -3600
# Node ID cc33c63a5afed6d76323f85a4801ae481a1d5e13
# Parent e9dea8b7fde7851b6c8b14ba01e6eb2036ff8f0b
Revert xen-unstable 12513 (changes to xen devmem for ia64).
Signed-off-by: Akio Takebe <takebe_akio@xxxxxxxxxxxxxx>
Signed-off-by: Jun Kamada <kama@xxxxxxxxxxxxxx>
---
drivers/xen/char/mem.c | 31 +++++++++----------------------
include/asm-i386/mach-xen/asm/io.h | 3 +--
include/asm-powerpc/io.h | 2 --
include/asm-x86_64/mach-xen/asm/io.h | 3 +--
4 files changed, 11 insertions(+), 28 deletions(-)
diff -r e9dea8b7fde7 -r cc33c63a5afe drivers/xen/char/mem.c
--- a/drivers/xen/char/mem.c Fri Jul 13 13:57:42 2007 +0100
+++ b/drivers/xen/char/mem.c Fri Jul 13 16:03:10 2007 +0100
@@ -26,12 +26,13 @@
#include <asm/io.h>
#include <asm/hypervisor.h>
-#ifndef ARCH_HAS_VALID_PHYS_ADDR_RANGE
-static inline int valid_phys_addr_range(unsigned long addr, size_t count)
+static inline int uncached_access(struct file *file)
{
- return 1;
+ if (file->f_flags & O_SYNC)
+ return 1;
+ /* Xen sets correct MTRR type on non-RAM for us. */
+ return 0;
}
-#endif
/*
* This funcion reads the *physical* memory. The f_pos points directly to the
@@ -44,9 +45,6 @@ static ssize_t read_mem(struct file * fi
ssize_t read = 0, sz;
void __iomem *v;
- if (!valid_phys_addr_range(p, count))
- return -EFAULT;
-
while (count > 0) {
/*
* Handle first page in case it's not aligned
@@ -58,7 +56,7 @@ static ssize_t read_mem(struct file * fi
sz = min_t(unsigned long, sz, count);
- v = xen_xlate_dev_mem_ptr(p, sz);
+ v = ioremap(p, sz);
if (IS_ERR(v) || v == NULL) {
/*
* Some programs (e.g., dmidecode) groove off into
@@ -75,7 +73,7 @@ static ssize_t read_mem(struct file * fi
}
ignored = copy_to_user(buf, v, sz);
- xen_xlate_dev_mem_ptr_unmap(v);
+ iounmap(v);
if (ignored)
return -EFAULT;
buf += sz;
@@ -95,9 +93,6 @@ static ssize_t write_mem(struct file * f
ssize_t written = 0, sz;
void __iomem *v;
- if (!valid_phys_addr_range(p, count))
- return -EFAULT;
-
while (count > 0) {
/*
* Handle first page in case it's not aligned
@@ -109,7 +104,7 @@ static ssize_t write_mem(struct file * f
sz = min_t(unsigned long, sz, count);
- v = xen_xlate_dev_mem_ptr(p, sz);
+ v = ioremap(p, sz);
if (v == NULL)
break;
if (IS_ERR(v)) {
@@ -119,7 +114,7 @@ static ssize_t write_mem(struct file * f
}
ignored = copy_from_user(v, buf, sz);
- xen_xlate_dev_mem_ptr_unmap(v);
+ iounmap(v);
if (ignored) {
written += sz - ignored;
if (written)
@@ -137,14 +132,6 @@ static ssize_t write_mem(struct file * f
}
#ifndef ARCH_HAS_DEV_MEM_MMAP_MEM
-static inline int uncached_access(struct file *file)
-{
- if (file->f_flags & O_SYNC)
- return 1;
- /* Xen sets correct MTRR type on non-RAM for us. */
- return 0;
-}
-
static int xen_mmap_mem(struct file * file, struct vm_area_struct * vma)
{
size_t size = vma->vm_end - vma->vm_start;
diff -r e9dea8b7fde7 -r cc33c63a5afe include/asm-i386/mach-xen/asm/io.h
--- a/include/asm-i386/mach-xen/asm/io.h Fri Jul 13 13:57:42 2007 +0100
+++ b/include/asm-i386/mach-xen/asm/io.h Fri Jul 13 16:03:10 2007 +0100
@@ -53,8 +53,7 @@
* Convert a physical pointer to a virtual kernel pointer for /dev/mem
* access
*/
-#define xen_xlate_dev_mem_ptr(p, sz) ioremap(p, sz)
-#define xen_xlate_dev_mem_ptr_unmap(p) iounmap(p)
+#define xen_xlate_dev_mem_ptr(p) __va(p)
/*
* Convert a virtual cached pointer to an uncached pointer
diff -r e9dea8b7fde7 -r cc33c63a5afe include/asm-powerpc/io.h
--- a/include/asm-powerpc/io.h Fri Jul 13 13:57:42 2007 +0100
+++ b/include/asm-powerpc/io.h Fri Jul 13 16:03:10 2007 +0100
@@ -456,9 +456,7 @@ out:
* access
*/
#define xlate_dev_mem_ptr(p) __va(p)
-
#define xen_xlate_dev_mem_ptr(p,sz) xlate_dev_mem_ptr(p)
-#define xen_xlate_dev_mem_ptr_unmap(p)
/*
* Convert a virtual cached pointer to an uncached pointer
diff -r e9dea8b7fde7 -r cc33c63a5afe include/asm-x86_64/mach-xen/asm/io.h
--- a/include/asm-x86_64/mach-xen/asm/io.h Fri Jul 13 13:57:42 2007 +0100
+++ b/include/asm-x86_64/mach-xen/asm/io.h Fri Jul 13 16:03:10 2007 +0100
@@ -315,8 +315,7 @@ extern int iommu_bio_merge;
* Convert a physical pointer to a virtual kernel pointer for /dev/mem
* access
*/
-#define xen_xlate_dev_mem_ptr(p, sz) ioremap(p, sz)
-#define xen_xlate_dev_mem_ptr_unmap(p) iounmap(p)
+#define xen_xlate_dev_mem_ptr(p) __va(p)
/*
* Convert a virtual cached pointer to an uncached pointer
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|