diff options
author | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2007-07-10 05:24:14 -0400 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2007-07-10 05:24:47 -0400 |
commit | 8a88367088a6b9964d99694b30d80720f019bea2 (patch) | |
tree | 6fe082e731cdf56983934e11ebfcfc1d10664e5b | |
parent | 285f67227b63309d699f5bda25ba34962503398f (diff) |
[S390] Bogomips calculation for 64 bit.
The bogomips calculation triggered via reading from /proc/cpuinfo
can return incorrect values if the qrnnd assembly is called with a
pointer in %r2 with any of the upper 32 bits set.
Fix this by using 64 bit division / remainder operation provided by
gcc instead of calling the assembly.
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
-rw-r--r-- | arch/s390/lib/Makefile | 4 | ||||
-rw-r--r-- | include/asm-s390/sfp-machine.h | 6 | ||||
-rw-r--r-- | include/asm-s390/sfp-util.h | 11 |
3 files changed, 16 insertions, 5 deletions
diff --git a/arch/s390/lib/Makefile b/arch/s390/lib/Makefile index 59aea65ce99f..52084436ab69 100644 --- a/arch/s390/lib/Makefile +++ b/arch/s390/lib/Makefile | |||
@@ -4,7 +4,7 @@ | |||
4 | 4 | ||
5 | EXTRA_AFLAGS := -traditional | 5 | EXTRA_AFLAGS := -traditional |
6 | 6 | ||
7 | lib-y += delay.o string.o uaccess_std.o uaccess_pt.o qrnnd.o | 7 | lib-y += delay.o string.o uaccess_std.o uaccess_pt.o |
8 | obj-$(CONFIG_32BIT) += div64.o | 8 | obj-$(CONFIG_32BIT) += div64.o qrnnd.o |
9 | lib-$(CONFIG_64BIT) += uaccess_mvcos.o | 9 | lib-$(CONFIG_64BIT) += uaccess_mvcos.o |
10 | lib-$(CONFIG_SMP) += spinlock.o | 10 | lib-$(CONFIG_SMP) += spinlock.o |
diff --git a/include/asm-s390/sfp-machine.h b/include/asm-s390/sfp-machine.h index 8ca8c77b2d04..4e16aede4b06 100644 --- a/include/asm-s390/sfp-machine.h +++ b/include/asm-s390/sfp-machine.h | |||
@@ -27,9 +27,9 @@ | |||
27 | 27 | ||
28 | 28 | ||
29 | #define _FP_W_TYPE_SIZE 32 | 29 | #define _FP_W_TYPE_SIZE 32 |
30 | #define _FP_W_TYPE unsigned long | 30 | #define _FP_W_TYPE unsigned int |
31 | #define _FP_WS_TYPE signed long | 31 | #define _FP_WS_TYPE signed int |
32 | #define _FP_I_TYPE long | 32 | #define _FP_I_TYPE int |
33 | 33 | ||
34 | #define _FP_MUL_MEAT_S(R,X,Y) \ | 34 | #define _FP_MUL_MEAT_S(R,X,Y) \ |
35 | _FP_MUL_MEAT_1_wide(_FP_WFRACBITS_S,R,X,Y,umul_ppmm) | 35 | _FP_MUL_MEAT_1_wide(_FP_WFRACBITS_S,R,X,Y,umul_ppmm) |
diff --git a/include/asm-s390/sfp-util.h b/include/asm-s390/sfp-util.h index 8cabcd23d976..0addc6466d95 100644 --- a/include/asm-s390/sfp-util.h +++ b/include/asm-s390/sfp-util.h | |||
@@ -51,6 +51,16 @@ | |||
51 | wl = __wl; \ | 51 | wl = __wl; \ |
52 | }) | 52 | }) |
53 | 53 | ||
54 | #ifdef __s390x__ | ||
55 | #define udiv_qrnnd(q, r, n1, n0, d) \ | ||
56 | do { unsigned long __n; \ | ||
57 | unsigned int __r, __d; \ | ||
58 | __n = ((unsigned long)(n1) << 32) + n0; \ | ||
59 | __d = (d); \ | ||
60 | (q) = __n / __d; \ | ||
61 | (r) = __n % __d; \ | ||
62 | } while (0) | ||
63 | #else | ||
54 | #define udiv_qrnnd(q, r, n1, n0, d) \ | 64 | #define udiv_qrnnd(q, r, n1, n0, d) \ |
55 | do { unsigned int __r; \ | 65 | do { unsigned int __r; \ |
56 | (q) = __udiv_qrnnd (&__r, (n1), (n0), (d)); \ | 66 | (q) = __udiv_qrnnd (&__r, (n1), (n0), (d)); \ |
@@ -58,6 +68,7 @@ | |||
58 | } while (0) | 68 | } while (0) |
59 | extern unsigned long __udiv_qrnnd (unsigned int *, unsigned int, | 69 | extern unsigned long __udiv_qrnnd (unsigned int *, unsigned int, |
60 | unsigned int , unsigned int); | 70 | unsigned int , unsigned int); |
71 | #endif | ||
61 | 72 | ||
62 | #define UDIV_NEEDS_NORMALIZATION 0 | 73 | #define UDIV_NEEDS_NORMALIZATION 0 |
63 | 74 | ||