KVM: arm64: pmu: Guard PMU emulation definitions with CONFIG_KVM
authorMarc Zyngier <maz@kernel.org>
Wed, 23 Aug 2023 09:14:48 +0000 (10:14 +0100)
committerMarc Zyngier <maz@kernel.org>
Wed, 23 Aug 2023 19:01:03 +0000 (20:01 +0100)
Most of the internal definitions for PMU emulation are guarded with
CONFIG_HW_PERF_EVENTS. However, this isn't enough, and leads to
these definitions leaking if CONFIG_KVM isn't enabled.

This leads to some compilation breakage in this exact configuration.
Fix it by falling back to the dummy stubs if either perf or KVM
isn't selected.

Reported-by: Alexander Stein <alexander.stein@ew.tq-group.com>
Tested-by: Alexander Stein <alexander.stein@ew.tq-group.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
include/kvm/arm_pmu.h

index 3a8a70a607942cf9eab0ff0811a611d132ee3f5c..31029f4f7be851d684c9500c243b59e979e6df67 100644 (file)
@@ -12,7 +12,7 @@
 
 #define ARMV8_PMU_CYCLE_IDX            (ARMV8_PMU_MAX_COUNTERS - 1)
 
-#ifdef CONFIG_HW_PERF_EVENTS
+#if IS_ENABLED(CONFIG_HW_PERF_EVENTS) && IS_ENABLED(CONFIG_KVM)
 
 struct kvm_pmc {
        u8 idx; /* index into the pmu->pmc array */