x86_match_cpu(9)
π NAME π
x86_match_cpu β match current CPU against an array of x86_cpu_ids. This is the x86_match_cpu(9) page from the Kernel API Manual, bestie. π
β¨ SYNOPSIS β¨
const struct x86_cpu_id * x86_match_cpu (const struct x86_cpu_id *match
);
πΈ ARGUMENTS πΈ
matchβ Pointer to array ofx86_cpu_ids. Last entry terminated with{}. π«Ά
π DESCRIPTION π
Okay so: it returns the entry if the current CPU matches the entries in the passed x86_cpu_id match table. Otherwise it gives you NULL. π
The match table contains vendor (X86_VENDOR_*), family, model and feature bits or respective wildcard entries. Iconic. β¨
A typical table entry would be to match a specific CPU:
X86_MATCH_VFM_FEATURE(INTEL_BROADWELL, X86_FEATURE_ANY, NULL);
Fields can be wildcarded with X86_VENDOR_ANY, X86_FAMILY_ANY, X86_MODEL_ANY, X86_FEATURE_ANY (except for vendor) β yes, keep that caveat exactly, bestie. π«‘
asm/cpu_device_id.h contains a set of useful macros which are shortcuts for various common selections. The above can be shortened to:
X86_MATCH_VFM(INTEL_BROADWELL, NULL);
Arrays used to match for this should also be declared using MODULE_DEVICE_TABLE(x86cpu, ...). Slay that declaration. π
This always matches against the boot cpu, assuming models and features are consistent over all CPUs. No cap. π§
π SEE ALSO π
Kernel file ./arch/x86/kernel/cpu/match.c β go peek at it, iykyk. π¦
Catch you later, bestie π β this pageβs source/version is ./arch/x86/kernel/cpu, and the date is October 2026. πβ¨
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms