Re: [PATCH RESEND v12 09/17] KVM: x86/pmu: Adjust precise_ip to emulate Ice Lake guest PDIR counter

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 11/4/2022 6:19 pm, Like Xu wrote:

+++ b/arch/x86/kvm/pmu.h
@@ -4,6 +4,8 @@
#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)
@@ -15,6 +17,12 @@
  #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),
+	{}
+};
The gcc [-Wunused-const-variable] flag would complain about
not moving vmx_icl_pebs_cpu[] from pmu.h to pmu.c:

diff --git a/arch/x86/kvm/pmu.c b/arch/x86/kvm/pmu.c
index b5d0c36b869b..17c9bfc2527d 100644
--- a/arch/x86/kvm/pmu.c
+++ b/arch/x86/kvm/pmu.c
@@ -27,6 +27,12 @@
 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.
diff --git a/arch/x86/kvm/pmu.h b/arch/x86/kvm/pmu.h
index dbf4c83519a4..8064d074f3be 100644
--- a/arch/x86/kvm/pmu.h
+++ b/arch/x86/kvm/pmu.h
@@ -17,12 +17,6 @@
 #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;






[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux