]> git.baikalelectronics.ru Git - kernel.git/commitdiff
KVM: x86/pmu: Move the vmx_icl_pebs_cpu[] definition out of the header file
authorLike Xu <likexu@tencent.com>
Wed, 18 May 2022 17:01:16 +0000 (01:01 +0800)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 8 Jun 2022 08:48:27 +0000 (04:48 -0400)
Defining a static const array in a header file would introduce redundant
definitions to the point of confusing semantics, and such a use case would
only bring complaints from the compiler:

arch/x86/kvm/pmu.h:20:32: warning: ‘vmx_icl_pebs_cpu’ defined but not used [-Wunused-const-variable=]
   20 | static const struct x86_cpu_id vmx_icl_pebs_cpu[] = {
      |                                ^~~~~~~~~~~~~~~~

Fixes: a095df2c5f48 ("KVM: x86/pmu: Adjust precise_ip to emulate Ice Lake guest PDIR counter")
Signed-off-by: Like Xu <likexu@tencent.com>
Message-Id: <20220518170118.66263-1-likexu@tencent.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/pmu.c
arch/x86/kvm/pmu.h

index a8f0618a5ebe97bfdcf190685bff554e8db5220e..1ed63ea19c00ef82737d4914f51588b2993c3063 100644 (file)
@@ -16,6 +16,7 @@
 #include <linux/bsearch.h>
 #include <linux/sort.h>
 #include <asm/perf_event.h>
+#include <asm/cpu_device_id.h>
 #include "x86.h"
 #include "cpuid.h"
 #include "lapic.h"
 struct x86_pmu_capability __read_mostly kvm_pmu_cap;
 EXPORT_SYMBOL_GPL(kvm_pmu_cap);
 
+static const struct x86_cpu_id vmx_icl_pebs_cpu[] = {
+       X86_MATCH_INTEL_FAM6_MODEL(ICELAKE_D, NULL),
+       X86_MATCH_INTEL_FAM6_MODEL(ICELAKE_X, NULL),
+       {}
+};
+
 /* NOTE:
  * - Each perf counter is defined as "struct kvm_pmc";
  * - There are two types of perf counters: general purpose (gp) and fixed.
index 9e25cdd2bd1a3f54196a923c6ee91227eba503c6..796ff839493ba5bf8fc29f3d3115cdbf1a70d8a1 100644 (file)
@@ -4,8 +4,6 @@
 
 #include <linux/nospec.h>
 
-#include <asm/cpu_device_id.h>
-
 #define vcpu_to_pmu(vcpu) (&(vcpu)->arch.pmu)
 #define pmu_to_vcpu(pmu)  (container_of((pmu), struct kvm_vcpu, arch.pmu))
 #define pmc_to_pmu(pmc)   (&(pmc)->vcpu->arch.pmu)
 #define VMWARE_BACKDOOR_PMC_REAL_TIME          0x10001
 #define VMWARE_BACKDOOR_PMC_APPARENT_TIME      0x10002
 
-static const struct x86_cpu_id vmx_icl_pebs_cpu[] = {
-       X86_MATCH_INTEL_FAM6_MODEL(ICELAKE_D, NULL),
-       X86_MATCH_INTEL_FAM6_MODEL(ICELAKE_X, NULL),
-       {}
-};
-
 struct kvm_event_hw_type_mapping {
        u8 eventsel;
        u8 unit_mask;