Commit 9c203239 authored by Heiko Carstens's avatar Heiko Carstens Committed by Martin Schwidefsky

s390: calculate loops_per_jiffies with fp instructions

Implement calculation of loops_per_jiffies with fp instructions which
are available on all 64 bit machines.
To save and restore floating point register context use the new vx support
functions.
Reviewed-by: default avatarHendrik Brueckner <brueckner@linux.vnet.ibm.com>
Signed-off-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent a086171a
...@@ -16,11 +16,7 @@ ...@@ -16,11 +16,7 @@
#include <asm/sysinfo.h> #include <asm/sysinfo.h>
#include <asm/cpcmd.h> #include <asm/cpcmd.h>
#include <asm/topology.h> #include <asm/topology.h>
#include <asm/fpu/api.h>
/* Sigh, math-emu. Don't ask. */
#include <asm/sfp-util.h>
#include <math-emu/soft-fp.h>
#include <math-emu/single.h>
int topology_max_mnest; int topology_max_mnest;
...@@ -414,10 +410,8 @@ subsys_initcall(create_proc_service_level); ...@@ -414,10 +410,8 @@ subsys_initcall(create_proc_service_level);
void s390_adjust_jiffies(void) void s390_adjust_jiffies(void)
{ {
struct sysinfo_1_2_2 *info; struct sysinfo_1_2_2 *info;
const unsigned int fmil = 0x4b189680; /* 1e7 as 32-bit float. */ unsigned long capability;
FP_DECL_S(SA); FP_DECL_S(SB); FP_DECL_S(SR); struct kernel_fpu fpu;
FP_DECL_EX;
unsigned int capability;
info = (void *) get_zeroed_page(GFP_KERNEL); info = (void *) get_zeroed_page(GFP_KERNEL);
if (!info) if (!info)
...@@ -433,15 +427,25 @@ void s390_adjust_jiffies(void) ...@@ -433,15 +427,25 @@ void s390_adjust_jiffies(void)
* higher cpu capacity. Bogomips are the other way round. * higher cpu capacity. Bogomips are the other way round.
* To get to a halfway suitable number we divide 1e7 * To get to a halfway suitable number we divide 1e7
* by the cpu capability number. Yes, that means a floating * by the cpu capability number. Yes, that means a floating
* point division .. math-emu here we come :-) * point division ..
*/ */
FP_UNPACK_SP(SA, &fmil); kernel_fpu_begin(&fpu, KERNEL_FPR);
if ((info->capability >> 23) == 0) asm volatile(
FP_FROM_INT_S(SB, (long) info->capability, 64, long); " sfpc %3\n"
else " l %0,%1\n"
FP_UNPACK_SP(SB, &info->capability); " tmlh %0,0xff80\n"
FP_DIV_S(SR, SA, SB); " jnz 0f\n"
FP_TO_INT_S(capability, SR, 32, 0); " cefbr %%f2,%0\n"
" j 1f\n"
"0: le %%f2,%1\n"
"1: cefbr %%f0,%2\n"
" debr %%f0,%%f2\n"
" cgebr %0,5,%%f0\n"
: "=&d" (capability)
: "Q" (info->capability), "d" (10000000), "d" (0)
: "cc"
);
kernel_fpu_end(&fpu);
} else } else
/* /*
* Really old machine without stsi block for basic * Really old machine without stsi block for basic
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment