|
@@ -465,6 +465,9 @@ static bool check_pmu_access_disabled(struct kvm_vcpu *vcpu, u64 flags)
|
|
|
u64 reg = vcpu_sys_reg(vcpu, PMUSERENR_EL0);
|
|
|
bool enabled = (reg & flags) || vcpu_mode_priv(vcpu);
|
|
|
|
|
|
+ if (!enabled)
|
|
|
+ kvm_inject_undefined(vcpu);
|
|
|
+
|
|
|
return !enabled;
|
|
|
}
|
|
|
|
|
@@ -564,8 +567,10 @@ static bool pmu_counter_idx_valid(struct kvm_vcpu *vcpu, u64 idx)
|
|
|
|
|
|
pmcr = vcpu_sys_reg(vcpu, PMCR_EL0);
|
|
|
val = (pmcr >> ARMV8_PMU_PMCR_N_SHIFT) & ARMV8_PMU_PMCR_N_MASK;
|
|
|
- if (idx >= val && idx != ARMV8_PMU_CYCLE_IDX)
|
|
|
+ if (idx >= val && idx != ARMV8_PMU_CYCLE_IDX) {
|
|
|
+ kvm_inject_undefined(vcpu);
|
|
|
return false;
|
|
|
+ }
|
|
|
|
|
|
return true;
|
|
|
}
|