Skip to content

Commit 8681573

Browse files
Anshuman KhandualMarc Zyngier
authored andcommitted
KVM: arm64: PMU: Replace version number '0' with ID_AA64DFR0_EL1_PMUVer_NI
kvm_host_pmu_init() returns when detected PMU is either not implemented, or implementation defined. kvm_pmu_probe_armpmu() also has a similar situation. Extracted ID_AA64DFR0_EL1_PMUVer value, when PMU is not implemented is '0', which can be replaced with ID_AA64DFR0_EL1_PMUVer_NI defined as '0b0000'. Cc: Arnaldo Carvalho de Melo <acme@kernel.org> Cc: Marc Zyngier <maz@kernel.org> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Will Deacon <will@kernel.org> Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: linux-perf-users@vger.kernel.org Cc: linux-kernel@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com> Signed-off-by: Marc Zyngier <maz@kernel.org> Link: https://lore.kernel.org/r/20221128135629.118346-1-anshuman.khandual@arm.com
1 parent d56bdce commit 8681573

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

arch/arm64/kvm/pmu-emul.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,8 @@ void kvm_host_pmu_init(struct arm_pmu *pmu)
668668
{
669669
struct arm_pmu_entry *entry;
670670

671-
if (pmu->pmuver == 0 || pmu->pmuver == ID_AA64DFR0_EL1_PMUVer_IMP_DEF)
671+
if (pmu->pmuver == ID_AA64DFR0_EL1_PMUVer_NI ||
672+
pmu->pmuver == ID_AA64DFR0_EL1_PMUVer_IMP_DEF)
672673
return;
673674

674675
mutex_lock(&arm_pmus_lock);
@@ -721,7 +722,7 @@ static struct arm_pmu *kvm_pmu_probe_armpmu(void)
721722

722723
if (event->pmu) {
723724
pmu = to_arm_pmu(event->pmu);
724-
if (pmu->pmuver == 0 ||
725+
if (pmu->pmuver == ID_AA64DFR0_EL1_PMUVer_NI ||
725726
pmu->pmuver == ID_AA64DFR0_EL1_PMUVer_IMP_DEF)
726727
pmu = NULL;
727728
}

0 commit comments

Comments
 (0)