lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20260119195049.43DDFD4E@davehans-spike.ostc.intel.com>
Date: Mon, 19 Jan 2026 11:50:49 -0800
From: Dave Hansen <dave.hansen@...ux.intel.com>
To: linux-kernel@...r.kernel.org
Cc: sohil.mehta@...el.com, Dave Hansen <dave.hansen@...ux.intel.com>, Borislav Petkov <bp@...en8.de>, "H. Peter Anvin" <hpa@...or.com>, Ingo Molnar <mingo@...hat.com>, Jon Kohler <jon@...anix.com>, Pawan Gupta <pawan.kumar.gupta@...ux.intel.com>, "Peter Zijlstra (Intel)" <peterz@...radead.org>, Thomas Gleixner <tglx@...nel.org>, Tony Luck <tony.luck@...el.com>, x86@...nel.org
Subject: [PATCH 1/6] x86/cpu: Break Vendor/Family/Model macros into separate header


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

The intel-family.h header uses Vendor/Family/Model macros but it does not
#include the header where they are defined. If that header is included,
the build blows up in #include hell.

Luckily, these macros are completely independent and do not themselves
have any dependencies on other code.

Break the VFM_*() macros out into their own header.

Signed-off-by: Dave Hansen <dave.hansen@...ux.intel.com>
Cc: Thomas Gleixner <tglx@...nel.org>
Cc: Ingo Molnar <mingo@...hat.com>
Cc: Borislav Petkov <bp@...en8.de>
Cc: Dave Hansen <dave.hansen@...ux.intel.com>
Cc: "H. Peter Anvin" <hpa@...or.com>
Cc: Tony Luck <tony.luck@...el.com>
Cc: Pawan Gupta <pawan.kumar.gupta@...ux.intel.com>
Cc: "Peter Zijlstra (Intel)" <peterz@...radead.org>
Cc: x86@...nel.org
Cc: Jon Kohler <jon@...anix.com>
---

 b/arch/x86/include/asm/cpu_device_id.h |   33 ----------------------------
 b/arch/x86/include/asm/vfm.h           |   38 +++++++++++++++++++++++++++++++++
 2 files changed, 39 insertions(+), 32 deletions(-)

diff -puN arch/x86/include/asm/cpu_device_id.h~x86-vfm_h arch/x86/include/asm/cpu_device_id.h
--- a/arch/x86/include/asm/cpu_device_id.h~x86-vfm_h	2026-01-19 11:38:07.714851835 -0800
+++ b/arch/x86/include/asm/cpu_device_id.h	2026-01-19 11:38:07.717851949 -0800
@@ -2,38 +2,7 @@
 #ifndef _ASM_X86_CPU_DEVICE_ID
 #define _ASM_X86_CPU_DEVICE_ID
 
-/*
- * Can't use <linux/bitfield.h> because it generates expressions that
- * cannot be used in structure initializers. Bitfield construction
- * here must match the union in struct cpuinfo_86:
- *	union {
- *		struct {
- *			__u8	x86_model;
- *			__u8	x86;
- *			__u8	x86_vendor;
- *			__u8	x86_reserved;
- *		};
- *		__u32		x86_vfm;
- *	};
- */
-#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)		\
-)
+#include <asm/vfm.h>
 
 /*
  * Declare drivers belonging to specific x86 CPUs
diff -puN /dev/null arch/x86/include/asm/vfm.h
--- /dev/null	2025-12-13 18:24:00.793641044 -0800
+++ b/arch/x86/include/asm/vfm.h	2026-01-19 11:38:07.717851949 -0800
@@ -0,0 +1,38 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _ASM_X86_VFM
+#define _ASM_X86_VFM
+
+/*
+ * Can't use <linux/bitfield.h> because it generates expressions that
+ * cannot be used in structure initializers. Bitfield construction
+ * here must match the union in struct cpuinfo_86:
+ *	union {
+ *		struct {
+ *			__u8	x86_model;
+ *			__u8	x86;
+ *			__u8	x86_vendor;
+ *			__u8	x86_reserved;
+ *		};
+ *		__u32		x86_vfm;
+ *	};
+ */
+#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)		\
+)
+
+#endif /* _ASM_X86_VFM */
_

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ