We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9d15f82 commit fe827f9Copy full SHA for fe827f9
arch/arm64/kvm/pmu-emul.c
@@ -620,8 +620,15 @@ void kvm_pmu_handle_pmcr(struct kvm_vcpu *vcpu, u64 val)
620
static bool kvm_pmu_counter_is_enabled(struct kvm_pmc *pmc)
621
{
622
struct kvm_vcpu *vcpu = kvm_pmc_to_vcpu(pmc);
623
- return (kvm_vcpu_read_pmcr(vcpu) & ARMV8_PMU_PMCR_E) &&
624
- (__vcpu_sys_reg(vcpu, PMCNTENSET_EL0) & BIT(pmc->idx));
+ unsigned int mdcr = __vcpu_sys_reg(vcpu, MDCR_EL2);
+
625
+ if (!(__vcpu_sys_reg(vcpu, PMCNTENSET_EL0) & BIT(pmc->idx)))
626
+ return false;
627
628
+ if (kvm_pmu_counter_is_hyp(vcpu, pmc->idx))
629
+ return mdcr & MDCR_EL2_HPME;
630
631
+ return kvm_vcpu_read_pmcr(vcpu) & ARMV8_PMU_PMCR_E;
632
}
633
634
static bool kvm_pmc_counts_at_el0(struct kvm_pmc *pmc)
0 commit comments