diff options
author | Shannon Zhao <shannon.zhao@linaro.org> | 2015-09-10 23:30:22 -0400 |
---|---|---|
committer | Marc Zyngier <marc.zyngier@arm.com> | 2016-02-29 13:34:21 -0500 |
commit | 2aa36e9840d71710f06b3c29634f044fde8bcbe5 (patch) | |
tree | aa646883c34800a0e363cbbb9d14df78407d3e59 /virt | |
parent | b02386eb7dac7555a208d81aef2a0e5c6f0f8085 (diff) |
arm64: KVM: Reset PMU state when resetting vcpu
When resetting vcpu, it needs to reset the PMU state to initial status.
Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
Reviewed-by: Marc Zyngier <marc.zyngier@arm.com>
Reviewed-by: Andrew Jones <drjones@redhat.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Diffstat (limited to 'virt')
-rw-r--r-- | virt/kvm/arm/pmu.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/virt/kvm/arm/pmu.c b/virt/kvm/arm/pmu.c index 74e858c42ae1..1dbbc2c51559 100644 --- a/virt/kvm/arm/pmu.c +++ b/virt/kvm/arm/pmu.c | |||
@@ -84,6 +84,23 @@ static void kvm_pmu_stop_counter(struct kvm_vcpu *vcpu, struct kvm_pmc *pmc) | |||
84 | } | 84 | } |
85 | } | 85 | } |
86 | 86 | ||
87 | /** | ||
88 | * kvm_pmu_vcpu_reset - reset pmu state for cpu | ||
89 | * @vcpu: The vcpu pointer | ||
90 | * | ||
91 | */ | ||
92 | void kvm_pmu_vcpu_reset(struct kvm_vcpu *vcpu) | ||
93 | { | ||
94 | int i; | ||
95 | struct kvm_pmu *pmu = &vcpu->arch.pmu; | ||
96 | |||
97 | for (i = 0; i < ARMV8_PMU_MAX_COUNTERS; i++) { | ||
98 | kvm_pmu_stop_counter(vcpu, &pmu->pmc[i]); | ||
99 | pmu->pmc[i].idx = i; | ||
100 | pmu->pmc[i].bitmask = 0xffffffffUL; | ||
101 | } | ||
102 | } | ||
103 | |||
87 | u64 kvm_pmu_valid_counter_mask(struct kvm_vcpu *vcpu) | 104 | u64 kvm_pmu_valid_counter_mask(struct kvm_vcpu *vcpu) |
88 | { | 105 | { |
89 | u64 val = vcpu_sys_reg(vcpu, PMCR_EL0) >> ARMV8_PMU_PMCR_N_SHIFT; | 106 | u64 val = vcpu_sys_reg(vcpu, PMCR_EL0) >> ARMV8_PMU_PMCR_N_SHIFT; |