/* * Copyright (C) 2012-2015 - ARM Ltd * Author: Marc Zyngier <marc.zyngier@arm.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <clocksource/arm_arch_timer.h> #include <linux/compiler.h> #include <linux/kvm_host.h> #include <asm/kvm_hyp.h> /* vcpu is already in the HYP VA space */
void __hyp_text __timer_save_state(struct kvm_vcpu *vcpu) { struct arch_timer_cpu *timer = &vcpu->arch.timer_cpu; u64 val; if (timer->enabled) { timer->cntv_ctl = read_sysreg_el0(cntv_ctl); timer->cntv_cval = read_sysreg_el0(cntv_cval); } /* Disable the virtual timer */ write_sysreg_el0(0, cntv_ctl); /* Allow physical timer/counter access for the host */ val = read_sysreg(cnthctl_el2); val |= CNTHCTL_EL1PCTEN | CNTHCTL_EL1PCEN; write_sysreg(val, cnthctl_el2); /* Clear cntvoff for the host */ write_sysreg(0, cntvoff_el2); }Contributors
| Person | Tokens | Prop | Commits | CommitProp | |
| marc zyngier | marc zyngier | 88 | 98.88% | 2 | 66.67% |
| christoffer dall | christoffer dall | 1 | 1.12% | 1 | 33.33% |
| Total | 89 | 100.00% | 3 | 100.00% |
| Person | Tokens | Prop | Commits | CommitProp | |
| marc zyngier | marc zyngier | 103 | 99.04% | 2 | 66.67% |
| christoffer dall | christoffer dall | 1 | 0.96% | 1 | 33.33% |
| Total | 104 | 100.00% | 3 | 100.00% |
| Person | Tokens | Prop | Commits | CommitProp | |
| marc zyngier | marc zyngier | 205 | 99.03% | 3 | 75.00% |
| christoffer dall | christoffer dall | 2 | 0.97% | 1 | 25.00% |
| Total | 207 | 100.00% | 4 | 100.00% |