s390/time: always use stckf instead of stck if available
authorHeiko Carstens <heiko.carstens@de.ibm.com>
Wed, 9 May 2012 14:27:39 +0000 (16:27 +0200)
committerMartin Schwidefsky <schwidefsky@de.ibm.com>
Wed, 16 May 2012 12:42:41 +0000 (14:42 +0200)
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>
arch/s390/include/asm/setup.h
arch/s390/include/asm/timex.h
arch/s390/kernel/early.c
arch/s390/kernel/entry64.S
drivers/s390/cio/qdio_main.c

index b21e46e..7244e1f 100644 (file)
@@ -82,7 +82,6 @@ extern unsigned int user_mode;
 #define MACHINE_FLAG_LPAR      (1UL << 12)
 #define MACHINE_FLAG_SPP       (1UL << 13)
 #define MACHINE_FLAG_TOPOLOGY  (1UL << 14)
-#define MACHINE_FLAG_STCKF     (1UL << 15)
 
 #define MACHINE_IS_VM          (S390_lowcore.machine_flags & MACHINE_FLAG_VM)
 #define MACHINE_IS_KVM         (S390_lowcore.machine_flags & MACHINE_FLAG_KVM)
@@ -101,7 +100,6 @@ extern unsigned int user_mode;
 #define MACHINE_HAS_PFMF       (0)
 #define MACHINE_HAS_SPP                (0)
 #define MACHINE_HAS_TOPOLOGY   (0)
-#define MACHINE_HAS_STCKF      (0)
 #else /* __s390x__ */
 #define MACHINE_HAS_IEEE       (1)
 #define MACHINE_HAS_CSP                (1)
@@ -113,7 +111,6 @@ extern unsigned int user_mode;
 #define MACHINE_HAS_PFMF       (S390_lowcore.machine_flags & MACHINE_FLAG_PFMF)
 #define MACHINE_HAS_SPP                (S390_lowcore.machine_flags & MACHINE_FLAG_SPP)
 #define MACHINE_HAS_TOPOLOGY   (S390_lowcore.machine_flags & MACHINE_FLAG_TOPOLOGY)
-#define MACHINE_HAS_STCKF      (S390_lowcore.machine_flags & MACHINE_FLAG_STCKF)
 #endif /* __s390x__ */
 
 #define ZFCPDUMP_HSA_SIZE      (32UL<<20)
index c447a27..72eaa85 100644 (file)
@@ -73,11 +73,15 @@ static inline void local_tick_enable(unsigned long long comp)
 
 typedef unsigned long long cycles_t;
 
-static inline unsigned long long get_clock (void)
+static inline unsigned long long get_clock(void)
 {
        unsigned long long clk;
 
+#if defined(CONFIG_64BIT) && !defined(CONFIG_MARCH_Z900) && !defined(CONFIG_MARCH_Z990)
+       asm volatile(".insn s,0xb27c0000,%0" : "=Q" (clk) : : "cc");
+#else
        asm volatile("stck %0" : "=Q" (clk) : : "cc");
+#endif
        return clk;
 }
 
@@ -86,17 +90,6 @@ static inline void get_clock_ext(char *clk)
        asm volatile("stcke %0" : "=Q" (*clk) : : "cc");
 }
 
-static inline unsigned long long get_clock_fast(void)
-{
-       unsigned long long clk;
-
-       if (MACHINE_HAS_STCKF)
-               asm volatile(".insn     s,0xb27c0000,%0" : "=Q" (clk) : : "cc");
-       else
-               clk = get_clock();
-       return clk;
-}
-
 static inline unsigned long long get_clock_xt(void)
 {
        unsigned char clk[16];
index 9475e68..d84181f 100644 (file)
@@ -374,8 +374,6 @@ static __init void detect_machine_facilities(void)
                S390_lowcore.machine_flags |= MACHINE_FLAG_MVCOS;
        if (test_facility(40))
                S390_lowcore.machine_flags |= MACHINE_FLAG_SPP;
-       if (test_facility(25))
-               S390_lowcore.machine_flags |= MACHINE_FLAG_STCKF;
 #endif
 }
 
index 3a633af..444fd72 100644 (file)
@@ -148,6 +148,14 @@ _TIF_EXIT_SIE = (_TIF_SIGPENDING | _TIF_NEED_RESCHED | _TIF_MCCK_PENDING)
        ssm     __LC_RETURN_PSW
        .endm
 
+       .macro STCK savearea
+#if defined(CONFIG_64BIT) && !defined(CONFIG_MARCH_Z900) && !defined(CONFIG_MARCH_Z990)
+       .insn   s,0xb27c0000,\savearea          # store clock fast
+#else
+       .insn   s,0xb2050000,\savearea          # store clock
+#endif
+       .endm
+
        .section .kprobes.text, "ax"
 
 /*
@@ -458,7 +466,7 @@ pgm_svcper:
  * IO interrupt handler routine
  */
 ENTRY(io_int_handler)
-       stck    __LC_INT_CLOCK
+       STCK    __LC_INT_CLOCK
        stpt    __LC_ASYNC_ENTER_TIMER
        stmg    %r8,%r15,__LC_SAVE_AREA_ASYNC
        lg      %r10,__LC_LAST_BREAK
@@ -604,7 +612,7 @@ io_notify_resume:
  * External interrupt handler routine
  */
 ENTRY(ext_int_handler)
-       stck    __LC_INT_CLOCK
+       STCK    __LC_INT_CLOCK
        stpt    __LC_ASYNC_ENTER_TIMER
        stmg    %r8,%r15,__LC_SAVE_AREA_ASYNC
        lg      %r10,__LC_LAST_BREAK
@@ -639,7 +647,7 @@ ENTRY(psw_idle)
        larl    %r1,psw_idle_lpsw+4
        stg     %r1,__SF_EMPTY+8(%r15)
        larl    %r1,.Lvtimer_max
-       stck    __IDLE_ENTER(%r2)
+       STCK    __IDLE_ENTER(%r2)
        ltr     %r5,%r5
        stpt    __VQ_IDLE_ENTER(%r3)
        jz      psw_idle_lpsw
@@ -655,7 +663,7 @@ __critical_end:
  * Machine check handler routines
  */
 ENTRY(mcck_int_handler)
-       stck    __LC_MCCK_CLOCK
+       STCK    __LC_MCCK_CLOCK
        la      %r1,4095                # revalidate r1
        spt     __LC_CPU_TIMER_SAVE_AREA-4095(%r1)      # revalidate cpu timer
        lmg     %r0,%r15,__LC_GPREGS_SAVE_AREA-4095(%r1)# revalidate gprs
index 19902cd..7493efa 100644 (file)
@@ -517,7 +517,7 @@ static int get_inbound_buffer_frontier(struct qdio_q *q)
        int count, stop;
        unsigned char state = 0;
 
-       q->timestamp = get_clock_fast();
+       q->timestamp = get_clock();
 
        /*
         * Don't check 128 buffers, as otherwise qdio_inbound_q_moved
@@ -788,7 +788,7 @@ static int get_outbound_buffer_frontier(struct qdio_q *q)
        int count, stop;
        unsigned char state = 0;
 
-       q->timestamp = get_clock_fast();
+       q->timestamp = get_clock();
 
        if (need_siga_sync(q))
                if (((queue_type(q) != QDIO_IQDIO_QFMT) &&