aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390/include
diff options
context:
space:
mode:
authorMichael Holzheu <holzheu@linux.vnet.ibm.com>2012-05-09 10:27:36 -0400
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2012-05-16 08:42:38 -0400
commitb2a68c235663c65365c4b4424c6e6c5ee90ae3a1 (patch)
tree2602a18a860e0dadd9a1332e6b9dd81f26ffb301 /arch/s390/include
parent6022afc060425864c33f4ab62bbe41d20ac85362 (diff)
s390: allow absolute memory access for /dev/mem
Currently dev/mem for s390 provides only real memory access. This means that the CPU prefix pages are swapped. The prefix swap for real memory works as follows: Each CPU owns a prefix register that points to a page aligned memory location "P". If this CPU accesses the address range [0,0x1fff], it is translated by the hardware to [P,P+0x1fff]. Accordingly if this CPU accesses the address range [P,P+0x1fff], it is translated by the hardware to [0,0x1fff]. Therefore, if [P,P+0x1fff] or [0,0x1fff] is read from the current /dev/mem device, the incorrectly swapped memory content is returned. With this patch the /dev/mem architecture code is modified to provide absolute memory access. This is done via the arch specific functions xlate_dev_mem_ptr() and unxlate_dev_mem_ptr(). For swapped pages on s390 the function xlate_dev_mem_ptr() now returns a new buffer with a copy of the requested absolute memory. In case the buffer was allocated, the unxlate_dev_mem_ptr() function frees it after /dev/mem code has called copy_to_user(). Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'arch/s390/include')
-rw-r--r--arch/s390/include/asm/io.h7
1 files changed, 2 insertions, 5 deletions
diff --git a/arch/s390/include/asm/io.h b/arch/s390/include/asm/io.h
index b7ff6afc3caa..27216d317991 100644
--- a/arch/s390/include/asm/io.h
+++ b/arch/s390/include/asm/io.h
@@ -38,11 +38,8 @@ static inline void * phys_to_virt(unsigned long address)
38 return (void *) address; 38 return (void *) address;
39} 39}
40 40
41/* 41void *xlate_dev_mem_ptr(unsigned long phys);
42 * Convert a physical pointer to a virtual kernel pointer for /dev/mem 42void unxlate_dev_mem_ptr(unsigned long phys, void *addr);
43 * access
44 */
45#define xlate_dev_mem_ptr(p) __va(p)
46 43
47/* 44/*
48 * Convert a virtual cached pointer to an uncached pointer 45 * Convert a virtual cached pointer to an uncached pointer