aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390
diff options
context:
space:
mode:
authorHeiko Carstens <heiko.carstens@de.ibm.com>2012-05-09 10:27:39 -0400
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2012-05-16 08:42:41 -0400
commit473e66baad1e83e6c5dfdca65aba03bf21727202 (patch)
treeaab0bd4a295b41d1e29952b2b1260ad72150496b /arch/s390
parent2739b6d12407792f253b7a15233930338e6831c9 (diff)
s390/time: always use stckf instead of stck if available
The store clock fast instruction saves a couple of instructions compared to the store clock instruction. Always use stckf instead of stck if it is available. Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Reviewed-by: Martin Schwidefsky <schwidefsky@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'arch/s390')
-rw-r--r--arch/s390/include/asm/setup.h3
-rw-r--r--arch/s390/include/asm/timex.h17
-rw-r--r--arch/s390/kernel/early.c2
-rw-r--r--arch/s390/kernel/entry64.S16
4 files changed, 17 insertions, 21 deletions
diff --git a/arch/s390/include/asm/setup.h b/arch/s390/include/asm/setup.h
index b21e46e5d4b8..7244e1f64126 100644
--- a/arch/s390/include/asm/setup.h
+++ b/arch/s390/include/asm/setup.h
@@ -82,7 +82,6 @@ extern unsigned int user_mode;
82#define MACHINE_FLAG_LPAR (1UL << 12) 82#define MACHINE_FLAG_LPAR (1UL << 12)
83#define MACHINE_FLAG_SPP (1UL << 13) 83#define MACHINE_FLAG_SPP (1UL << 13)
84#define MACHINE_FLAG_TOPOLOGY (1UL << 14) 84#define MACHINE_FLAG_TOPOLOGY (1UL << 14)
85#define MACHINE_FLAG_STCKF (1UL << 15)
86 85
87#define MACHINE_IS_VM (S390_lowcore.machine_flags & MACHINE_FLAG_VM) 86#define MACHINE_IS_VM (S390_lowcore.machine_flags & MACHINE_FLAG_VM)
88#define MACHINE_IS_KVM (S390_lowcore.machine_flags & MACHINE_FLAG_KVM) 87#define MACHINE_IS_KVM (S390_lowcore.machine_flags & MACHINE_FLAG_KVM)
@@ -101,7 +100,6 @@ extern unsigned int user_mode;
101#define MACHINE_HAS_PFMF (0) 100#define MACHINE_HAS_PFMF (0)
102#define MACHINE_HAS_SPP (0) 101#define MACHINE_HAS_SPP (0)
103#define MACHINE_HAS_TOPOLOGY (0) 102#define MACHINE_HAS_TOPOLOGY (0)
104#define MACHINE_HAS_STCKF (0)
105#else /* __s390x__ */ 103#else /* __s390x__ */
106#define MACHINE_HAS_IEEE (1) 104#define MACHINE_HAS_IEEE (1)
107#define MACHINE_HAS_CSP (1) 105#define MACHINE_HAS_CSP (1)
@@ -113,7 +111,6 @@ extern unsigned int user_mode;
113#define MACHINE_HAS_PFMF (S390_lowcore.machine_flags & MACHINE_FLAG_PFMF) 111#define MACHINE_HAS_PFMF (S390_lowcore.machine_flags & MACHINE_FLAG_PFMF)
114#define MACHINE_HAS_SPP (S390_lowcore.machine_flags & MACHINE_FLAG_SPP) 112#define MACHINE_HAS_SPP (S390_lowcore.machine_flags & MACHINE_FLAG_SPP)
115#define MACHINE_HAS_TOPOLOGY (S390_lowcore.machine_flags & MACHINE_FLAG_TOPOLOGY) 113#define MACHINE_HAS_TOPOLOGY (S390_lowcore.machine_flags & MACHINE_FLAG_TOPOLOGY)
116#define MACHINE_HAS_STCKF (S390_lowcore.machine_flags & MACHINE_FLAG_STCKF)
117#endif /* __s390x__ */ 114#endif /* __s390x__ */
118 115
119#define ZFCPDUMP_HSA_SIZE (32UL<<20) 116#define ZFCPDUMP_HSA_SIZE (32UL<<20)
diff --git a/arch/s390/include/asm/timex.h b/arch/s390/include/asm/timex.h
index c447a27a7fdb..72eaa8511a4f 100644
--- a/arch/s390/include/asm/timex.h
+++ b/arch/s390/include/asm/timex.h
@@ -73,11 +73,15 @@ static inline void local_tick_enable(unsigned long long comp)
73 73
74typedef unsigned long long cycles_t; 74typedef unsigned long long cycles_t;
75 75
76static inline unsigned long long get_clock (void) 76static inline unsigned long long get_clock(void)
77{ 77{
78 unsigned long long clk; 78 unsigned long long clk;
79 79
80#if defined(CONFIG_64BIT) && !defined(CONFIG_MARCH_Z900) && !defined(CONFIG_MARCH_Z990)
81 asm volatile(".insn s,0xb27c0000,%0" : "=Q" (clk) : : "cc");
82#else
80 asm volatile("stck %0" : "=Q" (clk) : : "cc"); 83 asm volatile("stck %0" : "=Q" (clk) : : "cc");
84#endif
81 return clk; 85 return clk;
82} 86}
83 87
@@ -86,17 +90,6 @@ static inline void get_clock_ext(char *clk)
86 asm volatile("stcke %0" : "=Q" (*clk) : : "cc"); 90 asm volatile("stcke %0" : "=Q" (*clk) : : "cc");
87} 91}
88 92
89static inline unsigned long long get_clock_fast(void)
90{
91 unsigned long long clk;
92
93 if (MACHINE_HAS_STCKF)
94 asm volatile(".insn s,0xb27c0000,%0" : "=Q" (clk) : : "cc");
95 else
96 clk = get_clock();
97 return clk;
98}
99
100static inline unsigned long long get_clock_xt(void) 93static inline unsigned long long get_clock_xt(void)
101{ 94{
102 unsigned char clk[16]; 95 unsigned char clk[16];
diff --git a/arch/s390/kernel/early.c b/arch/s390/kernel/early.c
index 9475e682727f..d84181f1f5e8 100644
--- a/arch/s390/kernel/early.c
+++ b/arch/s390/kernel/early.c
@@ -374,8 +374,6 @@ static __init void detect_machine_facilities(void)
374 S390_lowcore.machine_flags |= MACHINE_FLAG_MVCOS; 374 S390_lowcore.machine_flags |= MACHINE_FLAG_MVCOS;
375 if (test_facility(40)) 375 if (test_facility(40))
376 S390_lowcore.machine_flags |= MACHINE_FLAG_SPP; 376 S390_lowcore.machine_flags |= MACHINE_FLAG_SPP;
377 if (test_facility(25))
378 S390_lowcore.machine_flags |= MACHINE_FLAG_STCKF;
379#endif 377#endif
380} 378}
381 379
diff --git a/arch/s390/kernel/entry64.S b/arch/s390/kernel/entry64.S
index 3a633af72bae..444fd72e0787 100644
--- a/arch/s390/kernel/entry64.S
+++ b/arch/s390/kernel/entry64.S
@@ -148,6 +148,14 @@ _TIF_EXIT_SIE = (_TIF_SIGPENDING | _TIF_NEED_RESCHED | _TIF_MCCK_PENDING)
148 ssm __LC_RETURN_PSW 148 ssm __LC_RETURN_PSW
149 .endm 149 .endm
150 150
151 .macro STCK savearea
152#if defined(CONFIG_64BIT) && !defined(CONFIG_MARCH_Z900) && !defined(CONFIG_MARCH_Z990)
153 .insn s,0xb27c0000,\savearea # store clock fast
154#else
155 .insn s,0xb2050000,\savearea # store clock
156#endif
157 .endm
158
151 .section .kprobes.text, "ax" 159 .section .kprobes.text, "ax"
152 160
153/* 161/*
@@ -458,7 +466,7 @@ pgm_svcper:
458 * IO interrupt handler routine 466 * IO interrupt handler routine
459 */ 467 */
460ENTRY(io_int_handler) 468ENTRY(io_int_handler)
461 stck __LC_INT_CLOCK 469 STCK __LC_INT_CLOCK
462 stpt __LC_ASYNC_ENTER_TIMER 470 stpt __LC_ASYNC_ENTER_TIMER
463 stmg %r8,%r15,__LC_SAVE_AREA_ASYNC 471 stmg %r8,%r15,__LC_SAVE_AREA_ASYNC
464 lg %r10,__LC_LAST_BREAK 472 lg %r10,__LC_LAST_BREAK
@@ -604,7 +612,7 @@ io_notify_resume:
604 * External interrupt handler routine 612 * External interrupt handler routine
605 */ 613 */
606ENTRY(ext_int_handler) 614ENTRY(ext_int_handler)
607 stck __LC_INT_CLOCK 615 STCK __LC_INT_CLOCK
608 stpt __LC_ASYNC_ENTER_TIMER 616 stpt __LC_ASYNC_ENTER_TIMER
609 stmg %r8,%r15,__LC_SAVE_AREA_ASYNC 617 stmg %r8,%r15,__LC_SAVE_AREA_ASYNC
610 lg %r10,__LC_LAST_BREAK 618 lg %r10,__LC_LAST_BREAK
@@ -639,7 +647,7 @@ ENTRY(psw_idle)
639 larl %r1,psw_idle_lpsw+4 647 larl %r1,psw_idle_lpsw+4
640 stg %r1,__SF_EMPTY+8(%r15) 648 stg %r1,__SF_EMPTY+8(%r15)
641 larl %r1,.Lvtimer_max 649 larl %r1,.Lvtimer_max
642 stck __IDLE_ENTER(%r2) 650 STCK __IDLE_ENTER(%r2)
643 ltr %r5,%r5 651 ltr %r5,%r5
644 stpt __VQ_IDLE_ENTER(%r3) 652 stpt __VQ_IDLE_ENTER(%r3)
645 jz psw_idle_lpsw 653 jz psw_idle_lpsw
@@ -655,7 +663,7 @@ __critical_end:
655 * Machine check handler routines 663 * Machine check handler routines
656 */ 664 */
657ENTRY(mcck_int_handler) 665ENTRY(mcck_int_handler)
658 stck __LC_MCCK_CLOCK 666 STCK __LC_MCCK_CLOCK
659 la %r1,4095 # revalidate r1 667 la %r1,4095 # revalidate r1
660 spt __LC_CPU_TIMER_SAVE_AREA-4095(%r1) # revalidate cpu timer 668 spt __LC_CPU_TIMER_SAVE_AREA-4095(%r1) # revalidate cpu timer
661 lmg %r0,%r15,__LC_GPREGS_SAVE_AREA-4095(%r1)# revalidate gprs 669 lmg %r0,%r15,__LC_GPREGS_SAVE_AREA-4095(%r1)# revalidate gprs