]> git.baikalelectronics.ru Git - kernel.git/commitdiff
KVM: x86/pmu: Move pmc_speculative_in_use() to arch/x86/kvm/pmu.h
authorLike Xu <like.xu@linux.intel.com>
Mon, 11 Apr 2022 10:19:42 +0000 (18:19 +0800)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 8 Jun 2022 08:48:11 +0000 (04:48 -0400)
It allows this inline function to be reused by more callers in
more files, such as pmu_intel.c.

Signed-off-by: Like Xu <like.xu@linux.intel.com>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Message-Id: <20220411101946.20262-14-likexu@tencent.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/pmu.c
arch/x86/kvm/pmu.h

index 162dfe23c07162c63a01bc0121215a9ccc4f3a39..6e6898ef001197f52b61e1b6783dc88a8f5677ca 100644 (file)
@@ -503,17 +503,6 @@ void kvm_pmu_init(struct kvm_vcpu *vcpu)
        kvm_pmu_refresh(vcpu);
 }
 
-static inline bool pmc_speculative_in_use(struct kvm_pmc *pmc)
-{
-       struct kvm_pmu *pmu = pmc_to_pmu(pmc);
-
-       if (pmc_is_fixed(pmc))
-               return fixed_ctrl_field(pmu->fixed_ctr_ctrl,
-                       pmc->idx - INTEL_PMC_IDX_FIXED) & 0x3;
-
-       return pmc->eventsel & ARCH_PERFMON_EVENTSEL_ENABLE;
-}
-
 /* Release perf_events for vPMCs that have been unused for a full time slice.  */
 void kvm_pmu_cleanup(struct kvm_vcpu *vcpu)
 {
index 5966ce18a82ba5eaa18d21cb681cd06ba02371b7..d01c883ca95cf617967b770589acfe7ef7a77e9c 100644 (file)
@@ -152,6 +152,17 @@ static inline void pmc_update_sample_period(struct kvm_pmc *pmc)
                          get_sample_period(pmc, pmc->counter));
 }
 
+static inline bool pmc_speculative_in_use(struct kvm_pmc *pmc)
+{
+       struct kvm_pmu *pmu = pmc_to_pmu(pmc);
+
+       if (pmc_is_fixed(pmc))
+               return fixed_ctrl_field(pmu->fixed_ctr_ctrl,
+                                       pmc->idx - INTEL_PMC_IDX_FIXED) & 0x3;
+
+       return pmc->eventsel & ARCH_PERFMON_EVENTSEL_ENABLE;
+}
+
 void reprogram_gp_counter(struct kvm_pmc *pmc, u64 eventsel);
 void reprogram_fixed_counter(struct kvm_pmc *pmc, u8 ctrl, int fixed_idx);
 void reprogram_counter(struct kvm_pmu *pmu, int pmc_idx);