Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Heiko Carstens and committed by
Martin Schwidefsky
473e66ba 2739b6d1

+19 -23
-3
arch/s390/include/asm/setup.h
··· 82 82 #define MACHINE_FLAG_LPAR (1UL << 12) 83 83 #define MACHINE_FLAG_SPP (1UL << 13) 84 84 #define MACHINE_FLAG_TOPOLOGY (1UL << 14) 85 - #define MACHINE_FLAG_STCKF (1UL << 15) 86 85 87 86 #define MACHINE_IS_VM (S390_lowcore.machine_flags & MACHINE_FLAG_VM) 88 87 #define MACHINE_IS_KVM (S390_lowcore.machine_flags & MACHINE_FLAG_KVM) ··· 100 101 #define MACHINE_HAS_PFMF (0) 101 102 #define MACHINE_HAS_SPP (0) 102 103 #define MACHINE_HAS_TOPOLOGY (0) 103 - #define MACHINE_HAS_STCKF (0) 104 104 #else /* __s390x__ */ 105 105 #define MACHINE_HAS_IEEE (1) 106 106 #define MACHINE_HAS_CSP (1) ··· 111 113 #define MACHINE_HAS_PFMF (S390_lowcore.machine_flags & MACHINE_FLAG_PFMF) 112 114 #define MACHINE_HAS_SPP (S390_lowcore.machine_flags & MACHINE_FLAG_SPP) 113 115 #define MACHINE_HAS_TOPOLOGY (S390_lowcore.machine_flags & MACHINE_FLAG_TOPOLOGY) 114 - #define MACHINE_HAS_STCKF (S390_lowcore.machine_flags & MACHINE_FLAG_STCKF) 115 116 #endif /* __s390x__ */ 116 117 117 118 #define ZFCPDUMP_HSA_SIZE (32UL<<20)
+5 -12
arch/s390/include/asm/timex.h
··· 73 73 74 74 typedef unsigned long long cycles_t; 75 75 76 - static inline unsigned long long get_clock (void) 76 + static inline unsigned long long get_clock(void) 77 77 { 78 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 83 asm volatile("stck %0" : "=Q" (clk) : : "cc"); 84 + #endif 81 85 return clk; 82 86 } 83 87 84 88 static inline void get_clock_ext(char *clk) 85 89 { 86 90 asm volatile("stcke %0" : "=Q" (*clk) : : "cc"); 87 - } 88 - 89 - static 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 91 } 99 92 100 93 static inline unsigned long long get_clock_xt(void)
-2
arch/s390/kernel/early.c
··· 374 374 S390_lowcore.machine_flags |= MACHINE_FLAG_MVCOS; 375 375 if (test_facility(40)) 376 376 S390_lowcore.machine_flags |= MACHINE_FLAG_SPP; 377 - if (test_facility(25)) 378 - S390_lowcore.machine_flags |= MACHINE_FLAG_STCKF; 379 377 #endif 380 378 } 381 379
+12 -4
arch/s390/kernel/entry64.S
··· 148 148 ssm __LC_RETURN_PSW 149 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 159 .section .kprobes.text, "ax" 152 160 153 161 /* ··· 466 458 * IO interrupt handler routine 467 459 */ 468 460 ENTRY(io_int_handler) 469 - stck __LC_INT_CLOCK 461 + STCK __LC_INT_CLOCK 470 462 stpt __LC_ASYNC_ENTER_TIMER 471 463 stmg %r8,%r15,__LC_SAVE_AREA_ASYNC 472 464 lg %r10,__LC_LAST_BREAK ··· 612 604 * External interrupt handler routine 613 605 */ 614 606 ENTRY(ext_int_handler) 615 - stck __LC_INT_CLOCK 607 + STCK __LC_INT_CLOCK 616 608 stpt __LC_ASYNC_ENTER_TIMER 617 609 stmg %r8,%r15,__LC_SAVE_AREA_ASYNC 618 610 lg %r10,__LC_LAST_BREAK ··· 647 639 larl %r1,psw_idle_lpsw+4 648 640 stg %r1,__SF_EMPTY+8(%r15) 649 641 larl %r1,.Lvtimer_max 650 - stck __IDLE_ENTER(%r2) 642 + STCK __IDLE_ENTER(%r2) 651 643 ltr %r5,%r5 652 644 stpt __VQ_IDLE_ENTER(%r3) 653 645 jz psw_idle_lpsw ··· 663 655 * Machine check handler routines 664 656 */ 665 657 ENTRY(mcck_int_handler) 666 - stck __LC_MCCK_CLOCK 658 + STCK __LC_MCCK_CLOCK 667 659 la %r1,4095 # revalidate r1 668 660 spt __LC_CPU_TIMER_SAVE_AREA-4095(%r1) # revalidate cpu timer 669 661 lmg %r0,%r15,__LC_GPREGS_SAVE_AREA-4095(%r1)# revalidate gprs
+2 -2
drivers/s390/cio/qdio_main.c
··· 517 517 int count, stop; 518 518 unsigned char state = 0; 519 519 520 - q->timestamp = get_clock_fast(); 520 + q->timestamp = get_clock(); 521 521 522 522 /* 523 523 * Don't check 128 buffers, as otherwise qdio_inbound_q_moved ··· 788 788 int count, stop; 789 789 unsigned char state = 0; 790 790 791 - q->timestamp = get_clock_fast(); 791 + q->timestamp = get_clock(); 792 792 793 793 if (need_siga_sync(q)) 794 794 if (((queue_type(q) != QDIO_IQDIO_QFMT) &&