| 1 |
.\" Copyright 2009, Intel Corp. |
| 2 |
.\" Copyright, the authors of the Linux man-pages project |
| 3 |
.\" |
| 4 |
.\" SPDX-License-Identifier: Linux-man-pages-copyleft |
| 5 |
.\" |
| 6 |
.TH cpuid 4 2026-02-08 "Linux man-pages 6.18" |
| 7 |
.SH NAME |
| 8 |
cpuid \- x86 CPUID access device |
| 9 |
.SH DESCRIPTION |
| 10 |
CPUID provides an interface for querying information about the x86 CPU. |
| 11 |
.P |
| 12 |
This device is accessed by |
| 13 |
.BR lseek (2) |
| 14 |
or |
| 15 |
.BR pread (2) |
| 16 |
to the appropriate CPUID level and reading in chunks of 16 bytes. |
| 17 |
A larger read size means multiple reads of consecutive levels. |
| 18 |
.P |
| 19 |
The lower 32 bits of the file position is used as the incoming |
| 20 |
.IR %eax , |
| 21 |
and the upper 32 bits of the file position as the incoming |
| 22 |
.IR %ecx , |
| 23 |
the latter is intended for "counting" |
| 24 |
.I eax |
| 25 |
levels like |
| 26 |
.IR eax=4 . |
| 27 |
.P |
| 28 |
This driver uses |
| 29 |
.IR /dev/cpu/CPUNUM/cpuid , |
| 30 |
where |
| 31 |
.I CPUNUM |
| 32 |
is the minor number, |
| 33 |
and on an SMP box will direct the access to CPU |
| 34 |
.I CPUNUM |
| 35 |
as listed in |
| 36 |
.IR /proc/cpuinfo . |
| 37 |
.P |
| 38 |
This file is protected so that it can be read only by the user |
| 39 |
.IR root , |
| 40 |
or members of the group |
| 41 |
.IR root . |
| 42 |
.SH NOTES |
| 43 |
The CPUID instruction can be directly executed by a program |
| 44 |
using inline assembler. |
| 45 |
However this device allows convenient |
| 46 |
access to all CPUs without changing process affinity. |
| 47 |
.P |
| 48 |
Most of the information in |
| 49 |
.I cpuid |
| 50 |
is reported by the kernel in cooked form either in |
| 51 |
.I /proc/cpuinfo |
| 52 |
or through subdirectories in |
| 53 |
.IR /sys/devices/system/cpu . |
| 54 |
Direct CPUID access through this device should only |
| 55 |
be used in exceptional cases. |
| 56 |
.P |
| 57 |
The |
| 58 |
.I cpuid |
| 59 |
driver is not auto-loaded. |
| 60 |
On modular kernels you might need to use the following command |
| 61 |
to load it explicitly before use: |
| 62 |
.P |
| 63 |
.in +4n |
| 64 |
.EX |
| 65 |
$ modprobe cpuid |
| 66 |
.EE |
| 67 |
.in |
| 68 |
.P |
| 69 |
There is no support for CPUID functions that require additional |
| 70 |
input registers. |
| 71 |
.P |
| 72 |
Early i486 CPUs do not support the CPUID instruction; |
| 73 |
.\" arch/x86/kernel/cpuid.c cpuid_open() |
| 74 |
opening this device for those CPUs fails with EIO. |
| 75 |
.SH SEE ALSO |
| 76 |
.BR cpuid (1) |
| 77 |
.P |
| 78 |
Intel Corporation, Intel 64 and IA-32 Architectures |
| 79 |
Software Developer's Manual Volume 2A: |
| 80 |
Instruction Set Reference, A-M, 3-180 CPUID reference. |
| 81 |
.P |
| 82 |
Intel Corporation, Intel Processor Identification and |
| 83 |
the CPUID Instruction, Application note 485. |