diff options
author | Marc Zyngier <marc.zyngier@arm.com> | 2017-03-27 19:03:41 +0300 |
---|---|---|
committer | Christoffer Dall <cdall@linaro.org> | 2017-04-09 17:49:14 +0300 |
commit | e04432301607a6750e31d7db4cc4dfdd742ee7f8 (patch) | |
tree | 1ead31012b0df480add2bed9be469dade53b1df2 /arch/arm64 | |
parent | 7b5b4df1a79954e0b208630fc63b16ec0231a516 (diff) | |
download | linux-e04432301607a6750e31d7db4cc4dfdd742ee7f8.tar.xz |
arm64: KVM: PMU: Inject UNDEF on read access to PMSWINC_EL0
PMSWINC_EL0 is a WO register, so let's UNDEF when reading from it
(in the highly hypothetical case where this doesn't UNDEF at EL1).
Reviewed-by: Christoffer Dall <cdall@linaro.org>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Diffstat (limited to 'arch/arm64')
-rw-r--r-- | arch/arm64/kvm/sys_regs.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c index 20f90c01af33..3fef01d75164 100644 --- a/arch/arm64/kvm/sys_regs.c +++ b/arch/arm64/kvm/sys_regs.c @@ -772,16 +772,15 @@ static bool access_pmswinc(struct kvm_vcpu *vcpu, struct sys_reg_params *p, if (!kvm_arm_pmu_v3_ready(vcpu)) return trap_raz_wi(vcpu, p, r); + if (!p->is_write) + return read_from_write_only(vcpu, p); + if (pmu_write_swinc_el0_disabled(vcpu)) return false; - if (p->is_write) { - mask = kvm_pmu_valid_counter_mask(vcpu); - kvm_pmu_software_increment(vcpu, p->regval & mask); - return true; - } - - return false; + mask = kvm_pmu_valid_counter_mask(vcpu); + kvm_pmu_software_increment(vcpu, p->regval & mask); + return true; } static bool access_pmuserenr(struct kvm_vcpu *vcpu, struct sys_reg_params *p, |