Message ID | 20141209165807.GJ31129@e104818-lin.cambridge.arm.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Tue, 2014-12-09 at 16:58 +0000, Catalin Marinas wrote: <...> > You mix timer and counter terms here. Anyway, of we use physical timer, > you could argue that it makes sense to use the corresponding physical > counter (CNTPCT). However, on arm64 we only expose CNTVCT to user VDSO > and we want to use the same in the kernel. When booting at EL2, CNTVCT > == CNTPCT because we control CNTVOFF, that's unless we have some broken > firmware that does not restore CNTVOFF correctly. That's what we want > to spot early, hence the aim to always use the virtual counter (but not > the timer, use use the physical timer as it makes it easier for KVM). > > So the patch below, on top of linux-next, should solve the BUG(): Thanks for detail explanation and the patch. I tested it on my platform and it did solve the issue. So, Tested-by: Yingjoe Chen <yingjoe.chen@mediatek.com> Joe.C
diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c index 6a79fc4f900c..095c1774592c 100644 --- a/drivers/clocksource/arm_arch_timer.c +++ b/drivers/clocksource/arm_arch_timer.c @@ -462,7 +462,7 @@ static void __init arch_counter_register(unsigned type) /* Register the CP15 based counter if we have one */ if (type & ARCH_CP15_TIMER) { - if (arch_timer_use_virtual) + if (IS_ENABLED(CONFIG_ARM64) || arch_timer_use_virtual) arch_timer_read_counter = arch_counter_get_cntvct; else arch_timer_read_counter = arch_counter_get_cntpct;