title: How kvm guest access Virtual timer in ARM
body: <p>ARMv7 architectures with hardware virtualization support also include virtualization support for timers and the interrupt controller. </p>
  
  <p>I would like to know how guest access virtual timer in this Virtualized environment?</p>
  
  <p>Is it like when guest trying to access virtual timer it(Guest KVM) would Inject virtual interrupt(kvm_vgic_inject_irq) to vgic code?</p>
  
  <p>Could any one please provide the details on Guest access Virtual timer in ARM?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>I am trying to understand source flow from the point Guest access the Virtual timer. As per my understanding </p>
  
  <p>When KVM Guest trying to access(read VTimer tick/count) , it would inject virtual interrupt to vgic code via ach_timer.c</p>
  
  <pre><code>                    kvm_timer_inject_irq()
                               |
                               |
                       kvm_vgic_inject_irq()
                               |                                 
                               |
                         kvm_vcpu_kick()  
                               | 
                               | 
                         timer_handler()
                               |
                               |
                        arch_timer_reg_read()
                               |
                               |
                      arch_timer_reg_read_cp15()    
  </code></pre>
  
  <p>Also,reading Vtimer count from guest would not generate any trap as can't find any vmexit or vmentry in code flow, right?</p>