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

[PATCH 2/6] x86: Break struct x86_cpu_id out of processor.h



Only 5 files use struct x86_cpu_id, so it should not be in processor.h.  This
is in preparation to extend it with VFM support.

No functional change.

Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
CC: Jan Beulich <JBeulich@xxxxxxxx>
CC: Roger Pau Monné <roger.pau@xxxxxxxxxx>
---
 xen/arch/x86/acpi/cpu_idle.c         |  2 +-
 xen/arch/x86/apic.c                  |  1 +
 xen/arch/x86/cpu/common.c            | 21 +--------------------
 xen/arch/x86/cpu/intel.c             |  2 +-
 xen/arch/x86/cpu/mwait-idle.c        |  1 +
 xen/arch/x86/include/asm/match-cpu.h | 25 +++++++++++++++++++++++++
 xen/arch/x86/include/asm/processor.h | 10 ----------
 7 files changed, 30 insertions(+), 32 deletions(-)
 create mode 100644 xen/arch/x86/include/asm/match-cpu.h

diff --git a/xen/arch/x86/acpi/cpu_idle.c b/xen/arch/x86/acpi/cpu_idle.c
index 86f32fd9a6f0..fee29353439e 100644
--- a/xen/arch/x86/acpi/cpu_idle.c
+++ b/xen/arch/x86/acpi/cpu_idle.c
@@ -50,8 +50,8 @@
 #include <asm/hpet.h>
 #include <asm/io.h>
 #include <asm/iocap.h>
+#include <asm/match-cpu.h>
 #include <asm/mwait.h>
-#include <asm/processor.h>
 #include <asm/spec_ctrl.h>
 
 #include <acpi/cpufreq/cpufreq.h>
diff --git a/xen/arch/x86/apic.c b/xen/arch/x86/apic.c
index a058c435878a..c4272ab4de4f 100644
--- a/xen/arch/x86/apic.c
+++ b/xen/arch/x86/apic.c
@@ -37,6 +37,7 @@
 #include <asm/io-ports.h>
 #include <asm/io_apic.h>
 #include <asm/irq-vectors.h>
+#include <asm/match-cpu.h>
 #include <asm/mc146818rtc.h>
 #include <asm/microcode.h>
 #include <asm/mpspec.h>
diff --git a/xen/arch/x86/cpu/common.c b/xen/arch/x86/cpu/common.c
index 77364fd728db..cc004fc976f5 100644
--- a/xen/arch/x86/cpu/common.c
+++ b/xen/arch/x86/cpu/common.c
@@ -11,9 +11,9 @@
 #include <asm/debugreg.h>
 #include <asm/idt.h>
 #include <asm/io.h>
+#include <asm/match-cpu.h>
 #include <asm/mpspec.h>
 #include <asm/msr.h>
-#include <asm/processor.h>
 #include <asm/prot-key.h>
 #include <asm/random.h>
 #include <asm/setup.h>
@@ -998,25 +998,6 @@ void cpu_uninit(unsigned int cpu)
        cpumask_clear_cpu(cpu, &cpu_initialized);
 }
 
-/*
- * x86_match_cpu - match the current CPU against an array of
- * x86_cpu_ids
- * @match: Pointer to array of x86_cpu_ids. Last entry terminated with
- *         {}.
- * Return the entry if the current CPU matches the entries in the
- * passed x86_cpu_id match table. Otherwise NULL.  The match table
- * contains vendor (X86_VENDOR_*), family, model and feature bits or
- * respective wildcard entries.
- *
- * A typical table entry would be to match a specific CPU
- * { X86_VENDOR_INTEL, 6, 0x12 }
- * or to match a specific CPU feature
- * { X86_FEATURE_MATCH(X86_FEATURE_FOOBAR) }
- *
- * This always matches against the boot cpu, assuming models and
-features are
- * consistent over all CPUs.
- */
 const struct x86_cpu_id *x86_match_cpu(const struct x86_cpu_id table[])
 {
        const struct x86_cpu_id *m;
diff --git a/xen/arch/x86/cpu/intel.c b/xen/arch/x86/cpu/intel.c
index 59b5828fa9e9..ee1ae92cd7e6 100644
--- a/xen/arch/x86/cpu/intel.c
+++ b/xen/arch/x86/cpu/intel.c
@@ -8,9 +8,9 @@
 #include <asm/apic.h>
 #include <asm/i387.h>
 #include <asm/intel-family.h>
+#include <asm/match-cpu.h>
 #include <asm/mpspec.h>
 #include <asm/msr.h>
-#include <asm/processor.h>
 #include <asm/trampoline.h>
 
 #include "cpu.h"
diff --git a/xen/arch/x86/cpu/mwait-idle.c b/xen/arch/x86/cpu/mwait-idle.c
index c733a672d1e0..eec2823cbacf 100644
--- a/xen/arch/x86/cpu/mwait-idle.c
+++ b/xen/arch/x86/cpu/mwait-idle.c
@@ -52,6 +52,7 @@
 #include <asm/cpuidle.h>
 #include <asm/hpet.h>
 #include <asm/intel-family.h>
+#include <asm/match-cpu.h>
 #include <asm/msr.h>
 #include <asm/mwait.h>
 #include <asm/spec_ctrl.h>
diff --git a/xen/arch/x86/include/asm/match-cpu.h 
b/xen/arch/x86/include/asm/match-cpu.h
new file mode 100644
index 000000000000..2704b84d74c9
--- /dev/null
+++ b/xen/arch/x86/include/asm/match-cpu.h
@@ -0,0 +1,25 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+#ifndef X86_MATCH_CPU_H
+#define X86_MATCH_CPU_H
+
+#include <xen/stdint.h>
+
+struct x86_cpu_id {
+    uint16_t vendor;
+    uint16_t family;
+    uint16_t model;
+    uint16_t feature;
+    const void *driver_data;
+};
+
+/*
+ * x86_match_cpu() - match the CPU against an array of x86_cpu_ids[]
+ *
+ * @table: Array of x86_cpu_ids. Last entry terminated with {}.
+ *
+ * Returns the matching entry, otherwise NULL.  This always matches against
+ * the boot CPU, assuming models and features are consistent over all CPUs.
+ */
+const struct x86_cpu_id *x86_match_cpu(const struct x86_cpu_id table[]);
+
+#endif /* X86_MATCH_CPU_H */
diff --git a/xen/arch/x86/include/asm/processor.h 
b/xen/arch/x86/include/asm/processor.h
index 04824c3633cf..c58617631bf3 100644
--- a/xen/arch/x86/include/asm/processor.h
+++ b/xen/arch/x86/include/asm/processor.h
@@ -80,14 +80,6 @@
 struct domain;
 struct vcpu;
 
-struct x86_cpu_id {
-    uint16_t vendor;
-    uint16_t family;
-    uint16_t model;
-    uint16_t feature;   /* bit index */
-    const void *driver_data;
-};
-
 extern struct cpuinfo_x86 cpu_data[];
 #define current_cpu_data cpu_data[smp_processor_id()]
 
@@ -104,8 +96,6 @@ extern unsigned int hap_paddr_bits;
 /* Maximum width of virtual addresses supported by the hardware. */
 extern unsigned int vaddr_bits;
 
-extern const struct x86_cpu_id *x86_match_cpu(const struct x86_cpu_id table[]);
-
 extern void identify_cpu(struct cpuinfo_x86 *c);
 extern void setup_clear_cpu_cap(unsigned int cap);
 extern void setup_force_cpu_cap(unsigned int cap);
-- 
2.39.5




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.