Skip to content

Commit db26f8f

Browse files
Marc Zyngierdlezcano
authored andcommitted
clocksource/drivers/arch_arm_timer: Move workaround synchronisation around
We currently handle synchronisation when workarounds are enabled by having an ISB in the __arch_counter_get_cnt?ct_stable() helpers. While this works, this prevents us from relaxing this synchronisation. Instead, move it closer to the point where the synchronisation is actually needed. Further patches will subsequently relax this. Signed-off-by: Marc Zyngier <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Daniel Lezcano <[email protected]>
1 parent c1153d5 commit db26f8f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

arch/arm64/include/asm/arch_timer.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
({ \
3333
const struct arch_timer_erratum_workaround *__wa; \
3434
__wa = __this_cpu_read(timer_unstable_counter_workaround); \
35-
(__wa && __wa->h) ? __wa->h : arch_timer_##h; \
35+
(__wa && __wa->h) ? ({ isb(); __wa->h;}) : arch_timer_##h; \
3636
})
3737

3838
#else
@@ -64,11 +64,13 @@ DECLARE_PER_CPU(const struct arch_timer_erratum_workaround *,
6464

6565
static inline notrace u64 arch_timer_read_cntpct_el0(void)
6666
{
67+
isb();
6768
return read_sysreg(cntpct_el0);
6869
}
6970

7071
static inline notrace u64 arch_timer_read_cntvct_el0(void)
7172
{
73+
isb();
7274
return read_sysreg(cntvct_el0);
7375
}
7476

@@ -163,7 +165,6 @@ static __always_inline u64 __arch_counter_get_cntpct_stable(void)
163165
{
164166
u64 cnt;
165167

166-
isb();
167168
cnt = arch_timer_reg_read_stable(cntpct_el0);
168169
arch_counter_enforce_ordering(cnt);
169170
return cnt;
@@ -183,7 +184,6 @@ static __always_inline u64 __arch_counter_get_cntvct_stable(void)
183184
{
184185
u64 cnt;
185186

186-
isb();
187187
cnt = arch_timer_reg_read_stable(cntvct_el0);
188188
arch_counter_enforce_ordering(cnt);
189189
return cnt;

0 commit comments

Comments
 (0)