[PATCH 2/6] x86/cpu: Add missing #include

Dave Hansen posted 6 patches 2 days, 1 hour ago
[PATCH 2/6] x86/cpu: Add missing #include
Posted by Dave Hansen 2 days, 1 hour ago

From: Dave Hansen <dave.hansen@linux.intel.com>

The intel-family.h header uses Vendor/Family/Model macros but it does
not #include the header where they are defined. It must be depending
on implicit includes.

Include the required header explicitly.

Note that having this code in an explicitly #include'd header, non-x86
header means that the PECI code can zap its copy. Do that as well.

Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Thomas Gleixner <tglx@kernel.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
Cc: "Peter Zijlstra (Intel)" <peterz@infradead.org>
Cc: x86@kernel.org
Cc: Jon Kohler <jon@nutanix.com>
---

 b/arch/x86/include/asm/intel-family.h |    7 +++++++
 b/include/linux/peci-cpu.h            |   20 --------------------
 2 files changed, 7 insertions(+), 20 deletions(-)

diff -puN arch/x86/include/asm/intel-family.h~fam-missing-include arch/x86/include/asm/intel-family.h
--- a/arch/x86/include/asm/intel-family.h~fam-missing-include	2026-02-06 15:14:22.380749864 -0800
+++ b/arch/x86/include/asm/intel-family.h	2026-02-06 15:14:22.387750111 -0800
@@ -3,6 +3,13 @@
 #define _ASM_X86_INTEL_FAMILY_H
 
 /*
+ * Note: despite being in arch/x86, the PECI driver(s) use
+ * this header in arch-independent drivers. Do not use
+ * any x86-specific headers here:
+ */
+#include <asm-generic/x86-vfm.h>
+
+/*
  * "Big Core" Processors (Branded as Core, Xeon, etc...)
  *
  * While adding a new CPUID for a new microarchitecture, add a new
diff -puN include/linux/peci-cpu.h~fam-missing-include include/linux/peci-cpu.h
--- a/include/linux/peci-cpu.h~fam-missing-include	2026-02-06 15:14:22.383749970 -0800
+++ b/include/linux/peci-cpu.h	2026-02-06 15:14:22.387750111 -0800
@@ -8,26 +8,6 @@
 
 /* Copied from x86 <asm/processor.h> */
 #define X86_VENDOR_INTEL       0
-
-/* Copied from x86 <asm/cpu_device_id.h> */
-#define VFM_MODEL_BIT	0
-#define VFM_FAMILY_BIT	8
-#define VFM_VENDOR_BIT	16
-#define VFM_RSVD_BIT	24
-
-#define	VFM_MODEL_MASK	GENMASK(VFM_FAMILY_BIT - 1, VFM_MODEL_BIT)
-#define	VFM_FAMILY_MASK	GENMASK(VFM_VENDOR_BIT - 1, VFM_FAMILY_BIT)
-#define	VFM_VENDOR_MASK	GENMASK(VFM_RSVD_BIT - 1, VFM_VENDOR_BIT)
-
-#define VFM_MODEL(vfm)	(((vfm) & VFM_MODEL_MASK) >> VFM_MODEL_BIT)
-#define VFM_FAMILY(vfm)	(((vfm) & VFM_FAMILY_MASK) >> VFM_FAMILY_BIT)
-#define VFM_VENDOR(vfm)	(((vfm) & VFM_VENDOR_MASK) >> VFM_VENDOR_BIT)
-
-#define	VFM_MAKE(_vendor, _family, _model) (	\
-	((_model) << VFM_MODEL_BIT) |		\
-	((_family) << VFM_FAMILY_BIT) |		\
-	((_vendor) << VFM_VENDOR_BIT)		\
-)
 /* End of copied code */
 
 #include "../../arch/x86/include/asm/intel-family.h"
_