Commit Graph

11 Commits

Author SHA1 Message Date
Ahmed S. Darwish
49394b5af4 tools/x86/kcpuid: Update bitfields to x86-cpuid-db v2.4
Update kcpuid's CSV file to version 2.4, as generated by x86-cpuid-db.

Summary of the v2.4 changes:

* Mark CPUID(0x80000001) EDX:23 bit, 'e_mmx', as not exclusive to
  Transmeta since it is supported by AMD as well.

Signed-off-by: Ahmed S. Darwish <darwi@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: John Ogness <john.ogness@linutronix.de>
Cc: x86-cpuid@lists.linux.dev
Link: https://gitlab.com/x86-cpuid.org/x86-cpuid-db/-/blob/v2.4/CHANGELOG.rst
Link: https://lore.kernel.org/r/20250506050437.10264-2-darwi@linutronix.de
2025-05-06 10:01:57 +02:00
Ahmed S. Darwish
300ba89141 tools/x86/kcpuid: Update bitfields to x86-cpuid-db v2.3
Update kcpuid's CSV file to version 2.3, as generated by x86-cpuid-db.

Summary of the v2.3 changes:

* Per H. Peter Anvin's feedback, leaf 0x3 is not unique to Transmeta as
  the CSV file earlier claimed.  Since leaf 0x3's format differs between
  Intel and Transmeta, and the project does not yet support having the
  same CPUID bitfield with varying interpretations across vendors, leaf
  0x3 is removed for now.  Given that Intel discontinued support for PSN
  from Pentium 4 onward, and Linux force disables it on early boot for
  privacy concerns, this should have minimal impact.

* Leaf 0x80000021: Make bitfield IDs and descriptions coherent with each
  other.  Remove "_support" from bitfield IDs, as no other leaf has such
  convention.

Reported-by: "H. Peter Anvin" <hpa@zytor.com>
Signed-off-by: Ahmed S. Darwish <darwi@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Link: https://gitlab.com/x86-cpuid.org/x86-cpuid-db/-/blob/v2.3/CHANGELOG.rst
Link: https://lore.kernel.org/r/20250324142042.29010-20-darwi@linutronix.de

Closes: https://lkml.kernel.org/r/C7684E03-36E0-4D58-B6F0-78F4DB82D737@zytor.com
2025-03-25 09:53:47 +01:00
Ahmed S. Darwish
5e0c3c5e95 tools/x86/kcpuid: Update bitfields to x86-cpuid-db v2.2
Update kcpuid's CSV file to version 2.2, as generated by x86-cpuid-db.

Per Ingo Molnar's feedback, it is desired to always use CPUID in its
capitalized form.  The v2.2 release fixed all instances of small case
"cpuid" at the project's XML database, and thus all of its generated
files.

Reported-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Ahmed S. Darwish <darwi@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Link: https://gitlab.com/x86-cpuid.org/x86-cpuid-db/-/blob/v2.2/CHANGELOG.rst
Link: https://lore.kernel.org/r/20250324142042.29010-19-darwi@linutronix.de

Closes: https://lkml.kernel.org/r/Z8bHK391zKE4gUEW@gmail.com
2025-03-25 09:53:47 +01:00
Ahmed S. Darwish
f5e7fd6857 tools/x86/kcpuid: Update bitfields to x86-cpuid-db v2.1
Update kcpuid's CSV file to version 2.1, as generated by x86-cpuid-db.

Summary of the v2.1 changes:

* Use a standardized style for all x86 trademarks, registers, opcodes,
  byte units, hexadecimal digits, and x86 technical terms. This was
  enforced by a number of x86-specific hunspell(5) dictionary and affix
  files at the x86-cpuid-db project's CI pipeline.

* Expand abbreviated terms that might be OK in code but not in official
  listings (e.g., "addr", "instr", "reg", "virt", etc.)

* Add new Zen5 SoC bits to leaf 0x80000020 and leaf 0x80000021.

Signed-off-by: Ahmed S. Darwish <darwi@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Link: https://gitlab.com/x86-cpuid.org/x86-cpuid-db/-/blob/v2.1/CHANGELOG.rst
Link: https://lore.kernel.org/r/20250324142042.29010-18-darwi@linutronix.de
2025-03-25 09:53:47 +01:00
Ahmed S. Darwish
e1dde2f5a4 tools/x86/kcpuid: Update bitfields to x86-cpuid-db v2.0
Update kcpuid's CSV file to version v2.0, as generated by x86-cpuid-db.

Summary of the v2.0 changes:

* Introduce the leaves:

  - Leaf 0x00000003, Transmeta Processor serial number
  - Leaf 0x80860000, Transmeta max leaf number + CPU vendor ID
  - Leaf 0x80860001, Transmeta extended CPU information
  - Leaf 0x80860002, Transmeta Code Morphing Software (CMS) enumeration
  - Leaf 0x80860003 => 0x80860006, Transmeta CPU information string
  - Leaf 0x80860007, Transmeta "live" CPU information
  - Leaf 0xc0000000, Centaur/Zhaoxin's max leaf number
  - Leaf 0xc0000001, Centaur/Zhaoxin's extended CPU features

* Add a 0x prefix for leaves 0x0 to 0x9.  This maintains consistency with
  the rest of the CSV entries.

* Add the new bitfields:

  - Leaf 0x7: nmi_src, NMI-source reporting
  - Leaf 0x80000001: e_base_type and e_mmx (Transmeta)

* Update the section headers for leaves 0x80000000 and 0x80000005 to
  indicate that they are also valid for Transmeta.

Notes:
    Leaf 0x3, being not unique to Transmeta, is handled at the generated
    CSV file v2.3 update, later in this patch queue.

    Leaf 0x80000001 EDX:23 bit, e_mmx, is also available on AMD.  A bugfix
    is already merged at x86-cpuid-db's -tip for that, and it will be part
    of the project's upcoming v2.4 release.:

        https://gitlab.com/x86-cpuid.org/x86-cpuid-db/-/commit/65fff25daa41

Signed-off-by: Ahmed S. Darwish <darwi@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Link: https://gitlab.com/x86-cpuid.org/x86-cpuid-db/-/blob/v2.0/CHANGELOG.rst
Link: https://lore.kernel.org/r/20250324142042.29010-17-darwi@linutronix.de
2025-03-25 09:53:47 +01:00
Ahmed S. Darwish
cbbd847d10 tools/x86/kcpuid: Introduce a complete cpuid bitfields CSV file
For parsing the cpuid bitfields, kcpuid uses an incomplete CSV file with
300+ bitfields.

Use an auto-generated CSV file from the x86-cpuid.org project instead.
It provides complete bitfields coverage: 830+ bitfields, all with proper
descriptions.

The auto-generated file has the following blurb automatically added:

   # SPDX-License-Identifier: CC0-1.0
   # Generator: x86-cpuid-db v1.0

The generator tag includes the project's workspace "git describe"
version string.  It is intended for projects like KernelCI, to aid in
verifying that the auto-generated files have not been tampered with.

The file also has the blurb:

   # Auto-generated file.
   # Please submit all updates and bugfixes to https://x86-cpuid.org

It's thus kindly requested that the Linux kernel's x86 tree maintainers
enforce sending all updates to x86-cpuid.org's upstream database first,
thus benefiting the whole ecosystem.

Signed-off-by: Ahmed S. Darwish <darwi@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://gitlab.com/x86-cpuid.org/x86-cpuid-db/-/blob/v1.0/LICENSE.rst
Link: https://gitlab.com/x86-cpuid.org/x86-cpuid-db
Link: https://lore.kernel.org/all/20240718134755.378115-9-darwi@linutronix.de
2024-08-02 09:17:19 +02:00
Terry Bowman
ce22e4346f tools/x86/kcpuid: Update AMD leaf Fn80000001
Add missing features to sub-leafs EAX, ECX, and EDX of 'Extended
Processor Signature and Feature Bits' leaf Fn80000001.

Signed-off-by: Terry Bowman <terry.bowman@amd.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Reviewed-by: Feng Tang <feng.tang@intel.com>
Link: https://lore.kernel.org/r/20230206141832.4162264-3-terry.bowman@amd.com
2023-03-07 23:29:07 +01:00
Terry Bowman
4e347bdf44 tools/x86/kcpuid: Fix avx512bw and avx512lvl fields in Fn00000007
Leaf Fn00000007 contains avx512bw at bit 26 and avx512vl at bit 28. This
is incorrect per the SDM. Correct avx512bw to be bit 30 and avx512lvl to
be bit 31.

Fixes: c6b2f240bf ("tools/x86: Add a kcpuid tool to show raw CPU features")
Signed-off-by: Terry Bowman <terry.bowman@amd.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Reviewed-by: Feng Tang <feng.tang@intel.com>
Link: https://lore.kernel.org/r/20230206141832.4162264-2-terry.bowman@amd.com
2023-03-07 23:27:07 +01:00
Borislav Petkov
f281854fa7 tools/x86/kcpuid: Add AMD leaf 0x8000001E
Contains core IDs, node IDs and other topology info.

Signed-off-by: Borislav Petkov <bp@suse.de>
Acked-by: Feng Tang <feng.tang@intel.com>
Link: https://lkml.kernel.org/r/20210315125901.30315-2-bp@alien8.de
2021-03-18 11:36:14 +01:00
Borislav Petkov
2d4177c01b tools/x86/kcpuid: Add AMD Secure Encryption leaf
Add the 0x8000001f leaf's fields.

Signed-off-by: Borislav Petkov <bp@suse.de>
Acked-by: Feng Tang <feng.tang@intel.com>
Link: https://lkml.kernel.org/r/20210313140118.17010-1-bp@alien8.de
2021-03-15 14:01:25 +01:00
Feng Tang
c6b2f240bf tools/x86: Add a kcpuid tool to show raw CPU features
End users frequently want to know what features their processor
supports, independent of what the kernel supports.

/proc/cpuinfo is great. It is omnipresent and since it is provided by
the kernel it is always as up to date as the kernel. But, it could be
ambiguous about processor features which can be disabled by the kernel
at boot-time or compile-time.

There are some user space tools showing more raw features, but they are
not bound with kernel, and go with distros. Many end users are still
using old distros with new kernels (upgraded by themselves), and may
not upgrade the distros only to get a newer tool.

So here arise the need for a new tool, which
  * shows raw CPU features read from the CPUID instruction
  * will be easier to update compared to existing userspace
    tooling (perhaps distributed like perf)
  * inherits "modern" kernel development process, in contrast to some
    of the existing userspace CPUID tools which are still being developed
    without git and distributed in tarballs from non-https sites.
  * Can produce output consistent with /proc/cpuinfo to make comparison
    easier.

The CPUID leaf definitions are kept in an .csv file which allows for
updating only that file to add support for new feature leafs.

This is based on prototype code from Borislav Petkov
(http://sr71.net/~dave/intel/stupid-cpuid.c).

 [ bp:
   - Massage, add #define _GNU_SOURCE to fix implicit declaration of
     function ‘strcasestr' warning
   - remove superfluous newlines
   - fallback to cpuid.csv in the current dir if none found
   - fix typos
   - move comments over the lines instead of sideways. ]

Originally-from: Borislav Petkov <bp@alien8.de>
Suggested-by: Dave Hansen <dave.hansen@intel.com>
Suggested-by: Borislav Petkov <bp@alien8.de>
Signed-off-by: Feng Tang <feng.tang@intel.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Link: https://lkml.kernel.org/r/1614928878-86075-1-git-send-email-feng.tang@intel.com
2021-03-08 12:50:19 +01:00