KVM
Functions
timer-sr.c File Reference
#include <clocksource/arm_arch_timer.h>
#include <linux/compiler.h>
#include <linux/kvm_host.h>
#include <asm/kvm_hyp.h>
#include <asm/kvm_mmu.h>
Include dependency graph for timer-sr.c:

Go to the source code of this file.

Functions

void __kvm_timer_set_cntvoff (u64 cntvoff)
 
void __timer_disable_traps (struct kvm_vcpu *vcpu)
 
void __timer_enable_traps (struct kvm_vcpu *vcpu)
 

Function Documentation

◆ __kvm_timer_set_cntvoff()

void __kvm_timer_set_cntvoff ( u64  cntvoff)

Definition at line 14 of file timer-sr.c.

15 {
16  write_sysreg(cntvoff, cntvoff_el2);
17 }
Here is the caller graph for this function:

◆ __timer_disable_traps()

void __timer_disable_traps ( struct kvm_vcpu *  vcpu)

Definition at line 23 of file timer-sr.c.

24 {
25  u64 val, shift = 0;
26 
27  if (has_hvhe())
28  shift = 10;
29 
30  /* Allow physical timer/counter access for the host */
31  val = read_sysreg(cnthctl_el2);
32  val |= (CNTHCTL_EL1PCTEN | CNTHCTL_EL1PCEN) << shift;
33  write_sysreg(val, cnthctl_el2);
34 }
Here is the caller graph for this function:

◆ __timer_enable_traps()

void __timer_enable_traps ( struct kvm_vcpu *  vcpu)

Definition at line 40 of file timer-sr.c.

41 {
42  u64 clr = 0, set = 0;
43 
44  /*
45  * Disallow physical timer access for the guest
46  * Physical counter access is allowed if no offset is enforced
47  * or running protected (we don't offset anything in this case).
48  */
49  clr = CNTHCTL_EL1PCEN;
50  if (is_protected_kvm_enabled() ||
51  !kern_hyp_va(vcpu->kvm)->arch.timer_data.poffset)
52  set |= CNTHCTL_EL1PCTEN;
53  else
54  clr |= CNTHCTL_EL1PCTEN;
55 
56  if (has_hvhe()) {
57  clr <<= 10;
58  set <<= 10;
59  }
60 
61  sysreg_clear_set(cnthctl_el2, clr, set);
62 }
Here is the caller graph for this function: