diff options
author | Heiko Carstens <heiko.carstens@de.ibm.com> | 2012-06-05 03:59:52 -0400 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2012-06-14 03:09:02 -0400 |
commit | fbe765680d1fe9d08187ea4dad5041a7955a2c3a (patch) | |
tree | cfa5ba11106bb5535552cf6b29ff6aa81f32c606 /arch/s390/include/asm | |
parent | 72f6e3a8bc956fddf6e004ae9b804977d1458e77 (diff) |
s390/smp: make absolute lowcore / cpu restart parameter accesses more robust
Setting the cpu restart parameters is done in three different fashions:
- directly setting the four parameters individually
- copying the four parameters with memcpy (using 4 * sizeof(long))
- copying the four parameters using a private structure
In addition code in entry*.S relies on a certain order of the restart
members of struct _lowcore.
Make all of this more robust to future changes by adding a
mem_absolute_assign(dest, val) define, which assigns val to dest
using absolute addressing mode. Also the load multiple instructions
in entry*.S have been split into separate load instruction so the
order of the struct _lowcore members doesn't matter anymore.
In addition move the prototypes of memcpy_real/absolute from uaccess.h
to processor.h. These memcpy* variants are not related to uaccess at all.
string.h doesn't seem to match as well, so lets use processor.h.
Also replace the eight byte array in struct _lowcore which represents a
misaliged u64 with a u64. The compiler will always create code that
handles the misaligned u64 correctly.
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'arch/s390/include/asm')
-rw-r--r-- | arch/s390/include/asm/lowcore.h | 7 | ||||
-rw-r--r-- | arch/s390/include/asm/processor.h | 10 | ||||
-rw-r--r-- | arch/s390/include/asm/uaccess.h | 2 |
3 files changed, 11 insertions, 8 deletions
diff --git a/arch/s390/include/asm/lowcore.h b/arch/s390/include/asm/lowcore.h index 47853debb3b9..a47c6e221a95 100644 --- a/arch/s390/include/asm/lowcore.h +++ b/arch/s390/include/asm/lowcore.h | |||
@@ -302,12 +302,7 @@ struct _lowcore { | |||
302 | */ | 302 | */ |
303 | __u64 ipib; /* 0x0e00 */ | 303 | __u64 ipib; /* 0x0e00 */ |
304 | __u32 ipib_checksum; /* 0x0e08 */ | 304 | __u32 ipib_checksum; /* 0x0e08 */ |
305 | /* | 305 | __u64 vmcore_info; /* 0x0e0c */ |
306 | * Because the vmcore_info pointer is not 8 byte aligned it never | ||
307 | * should not be accessed directly. For accessing the pointer, first | ||
308 | * copy it to a local pointer variable. | ||
309 | */ | ||
310 | __u8 vmcore_info[8]; /* 0x0e0c */ | ||
311 | __u8 pad_0x0e14[0x0e18-0x0e14]; /* 0x0e14 */ | 306 | __u8 pad_0x0e14[0x0e18-0x0e14]; /* 0x0e14 */ |
312 | __u64 os_info; /* 0x0e18 */ | 307 | __u64 os_info; /* 0x0e18 */ |
313 | __u8 pad_0x0e20[0x0f00-0x0e20]; /* 0x0e20 */ | 308 | __u8 pad_0x0e20[0x0f00-0x0e20]; /* 0x0e20 */ |
diff --git a/arch/s390/include/asm/processor.h b/arch/s390/include/asm/processor.h index 20d0585cf905..f1700c5c8884 100644 --- a/arch/s390/include/asm/processor.h +++ b/arch/s390/include/asm/processor.h | |||
@@ -348,4 +348,14 @@ extern void (*s390_base_ext_handler_fn)(void); | |||
348 | ".previous\n" | 348 | ".previous\n" |
349 | #endif | 349 | #endif |
350 | 350 | ||
351 | extern int memcpy_real(void *, void *, size_t); | ||
352 | extern void memcpy_absolute(void *, void *, size_t); | ||
353 | |||
354 | #define mem_assign_absolute(dest, val) { \ | ||
355 | __typeof__(dest) __tmp = (val); \ | ||
356 | \ | ||
357 | BUILD_BUG_ON(sizeof(__tmp) != sizeof(val)); \ | ||
358 | memcpy_absolute(&(dest), &__tmp, sizeof(__tmp)); \ | ||
359 | } | ||
360 | |||
351 | #endif /* __ASM_S390_PROCESSOR_H */ | 361 | #endif /* __ASM_S390_PROCESSOR_H */ |
diff --git a/arch/s390/include/asm/uaccess.h b/arch/s390/include/asm/uaccess.h index 1f3a79bcd262..7e7285179aad 100644 --- a/arch/s390/include/asm/uaccess.h +++ b/arch/s390/include/asm/uaccess.h | |||
@@ -381,8 +381,6 @@ clear_user(void __user *to, unsigned long n) | |||
381 | return n; | 381 | return n; |
382 | } | 382 | } |
383 | 383 | ||
384 | extern int memcpy_real(void *, void *, size_t); | ||
385 | extern void memcpy_absolute(void *, void *, size_t); | ||
386 | extern int copy_to_user_real(void __user *dest, void *src, size_t count); | 384 | extern int copy_to_user_real(void __user *dest, void *src, size_t count); |
387 | extern int copy_from_user_real(void *dest, void __user *src, size_t count); | 385 | extern int copy_from_user_real(void *dest, void __user *src, size_t count); |
388 | 386 | ||