Hi,
I'm developing a baremetal hypervisor for Cortex-A15 and I'm using Arndale Board as a reference platform. ATM, I'm working on running Linaro 13.02 as a guest.
I've noticed that `arch/arm/kernel/arch_timer.c` Linux prefers the virtual IRQ timers (CNTV_):
static bool arch_timer_use_virtual = false;
as a timer source and I'm wondering if there's a reason for this. Is it even possible for virtual timer to be available, while physical one is not? I don't think so. So why would Linux want to default to virtual one instead of physical one, especially in the situation when it was started in SVC mode and HYP is not accessible to it?
From Hypervisor point of view, it seems natural that guest does not
care about virtualization stuff, does not try to be smarter than necessary and simply uses physical timer (PL1) all the time.
It's hypervisor's job to trap guest accesses to physical timer (CNTP_) and route them to virtual timer (CNTV_) so virtual offset (CNTVOFF) value can be easily switched (again, by hypervisor, not the guest) when handling multiple guests, to correctly handle virtual time for them. In opposite direction the hardware virtual timer irq is just renumbered to appear to guest as a physical one.
While emulating the CNTVOFF and CNTV_ is entirely possible too and required for completeness, it seems like additional work for no apparent reason. So I wanted to clarify this. Maybe there is something that I don't understand or I misread the intentions described in reference manual.