提交 2c8b3d39 编写于 作者: M Marc Zyngier 提交者: huangfangrun

KVM: arm64: Use symbolic names for the PMU versions

mainline inclusion
from mainline-v5.12-rc1
commit 8e26d11f
category: cleanup
bugzilla: https://gitee.com/openeuler/kernel/issues/I6OMSU
CVE: NA

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=8e26d11f680a323f7e1073038c454df39307dfad

----------------------------------------------------------------------

Instead of using a bunch of magic numbers, use the existing definitions
that have been added since 8673e02e ("arm64: perf: Add support
for ARMv8.5-PMU 64-bit counters")
Reviewed-by: NAlexandru Elisei <alexandru.elisei@arm.com>
Reviewed-by: NEric Auger <eric.auger@redhat.com>
Signed-off-by: NMarc Zyngier <maz@kernel.org>
Signed-off-by: Nhuangfangrun <huangfangrun1@h-partners.com>
上级 153d1a86
...@@ -23,11 +23,11 @@ static void kvm_pmu_stop_counter(struct kvm_vcpu *vcpu, struct kvm_pmc *pmc); ...@@ -23,11 +23,11 @@ static void kvm_pmu_stop_counter(struct kvm_vcpu *vcpu, struct kvm_pmc *pmc);
static u32 kvm_pmu_event_mask(struct kvm *kvm) static u32 kvm_pmu_event_mask(struct kvm *kvm)
{ {
switch (kvm->arch.pmuver) { switch (kvm->arch.pmuver) {
case 1: /* ARMv8.0 */ case ID_AA64DFR0_PMUVER_8_0:
return GENMASK(9, 0); return GENMASK(9, 0);
case 4: /* ARMv8.1 */ case ID_AA64DFR0_PMUVER_8_1:
case 5: /* ARMv8.4 */ case ID_AA64DFR0_PMUVER_8_4:
case 6: /* ARMv8.5 */ case ID_AA64DFR0_PMUVER_8_5:
return GENMASK(15, 0); return GENMASK(15, 0);
default: /* Shouldn't be here, just for sanity */ default: /* Shouldn't be here, just for sanity */
WARN_ONCE(1, "Unknown PMU version %d\n", kvm->arch.pmuver); WARN_ONCE(1, "Unknown PMU version %d\n", kvm->arch.pmuver);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册