0001
0002
0003
0004
0005
0006
0007 #include <clocksource/arm_arch_timer.h>
0008 #include <linux/compiler.h>
0009 #include <linux/kvm_host.h>
0010
0011 #include <asm/kvm_hyp.h>
0012
0013 void __kvm_timer_set_cntvoff(u64 cntvoff)
0014 {
0015 write_sysreg(cntvoff, cntvoff_el2);
0016 }
0017
0018
0019
0020
0021
0022 void __timer_disable_traps(struct kvm_vcpu *vcpu)
0023 {
0024 u64 val;
0025
0026
0027 val = read_sysreg(cnthctl_el2);
0028 val |= CNTHCTL_EL1PCTEN | CNTHCTL_EL1PCEN;
0029 write_sysreg(val, cnthctl_el2);
0030 }
0031
0032
0033
0034
0035
0036 void __timer_enable_traps(struct kvm_vcpu *vcpu)
0037 {
0038 u64 val;
0039
0040
0041
0042
0043
0044 val = read_sysreg(cnthctl_el2);
0045 val &= ~CNTHCTL_EL1PCEN;
0046 val |= CNTHCTL_EL1PCTEN;
0047 write_sysreg(val, cnthctl_el2);
0048 }