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

[xen master] x86: Break struct x86_cpu_id out of processor.h



commit 8e7962d68b8e0da5e63de69b5f3a090e69f9ffb6
Author:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
AuthorDate: Wed Jul 16 12:36:18 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Fri Jul 18 13:40:12 2025 +0100

    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>
    Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
---
 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 | 26 ++++++++++++++++++++++++++
 xen/arch/x86/include/asm/processor.h | 10 ----------
 7 files changed, 31 insertions(+), 32 deletions(-)

diff --git a/xen/arch/x86/acpi/cpu_idle.c b/xen/arch/x86/acpi/cpu_idle.c
index 72fed52204..d1b1a0555f 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 a058c43587..c4272ab4de 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 08261edf17..f221b9497c 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>
@@ -1005,25 +1005,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 59b5828fa9..ee1ae92cd7 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 c733a672d1..eec2823cba 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 0000000000..4521bbddc6
--- /dev/null
+++ b/xen/arch/x86/include/asm/match-cpu.h
@@ -0,0 +1,26 @@
+/* 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. Table terminated with {}.
+ *
+ * Returns the first 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 b6e8de5e86..2799d59e38 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);
--
generated by git-patchbot for /home/xen/git/xen.git#master



 


Rackspace

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