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

clocksource/drivers/arm_arch_timer: Drop unnecessary ISB on CVAL programming

Switching from TVAL to CVAL has a small drawback: we need an ISB
before reading the counter. We cannot get rid of it, but we can
instead remove the one that comes just after writing to CVAL.

This reduces the number of ISBs from 3 to 2 when programming
the timer.

Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20211017124225.3018098-12-maz@kernel.org
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>

authored by

Marc Zyngier and committed by
Daniel Lezcano
ec8f7f33 41f8d02a

+4 -4
+2 -2
arch/arm/include/asm/arch_timer.h
··· 31 31 switch (reg) { 32 32 case ARCH_TIMER_REG_CTRL: 33 33 asm volatile("mcr p15, 0, %0, c14, c2, 1" : : "r" ((u32)val)); 34 + isb(); 34 35 break; 35 36 case ARCH_TIMER_REG_CVAL: 36 37 asm volatile("mcrr p15, 2, %Q0, %R0, c14" : : "r" (val)); ··· 43 42 switch (reg) { 44 43 case ARCH_TIMER_REG_CTRL: 45 44 asm volatile("mcr p15, 0, %0, c14, c3, 1" : : "r" ((u32)val)); 45 + isb(); 46 46 break; 47 47 case ARCH_TIMER_REG_CVAL: 48 48 asm volatile("mcrr p15, 3, %Q0, %R0, c14" : : "r" (val)); ··· 54 52 } else { 55 53 BUILD_BUG(); 56 54 } 57 - 58 - isb(); 59 55 } 60 56 61 57 static __always_inline
+2 -2
arch/arm64/include/asm/arch_timer.h
··· 95 95 switch (reg) { 96 96 case ARCH_TIMER_REG_CTRL: 97 97 write_sysreg(val, cntp_ctl_el0); 98 + isb(); 98 99 break; 99 100 case ARCH_TIMER_REG_CVAL: 100 101 write_sysreg(val, cntp_cval_el0); ··· 107 106 switch (reg) { 108 107 case ARCH_TIMER_REG_CTRL: 109 108 write_sysreg(val, cntv_ctl_el0); 109 + isb(); 110 110 break; 111 111 case ARCH_TIMER_REG_CVAL: 112 112 write_sysreg(val, cntv_cval_el0); ··· 118 116 } else { 119 117 BUILD_BUG(); 120 118 } 121 - 122 - isb(); 123 119 } 124 120 125 121 static __always_inline