| cbbd847d | 18-Jul-2024 |
Ahmed S. Darwish <[email protected]> |
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-
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 <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> 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/[email protected]
show more ...
|
| 58921443 | 18-Jul-2024 |
Ahmed S. Darwish <[email protected]> |
tools/x86/kcpuid: Parse subleaf ranges if provided
It's a common pattern in cpuid leaves to have the same bitfields format repeated across a number of subleaves. Typically, this is used for enumera
tools/x86/kcpuid: Parse subleaf ranges if provided
It's a common pattern in cpuid leaves to have the same bitfields format repeated across a number of subleaves. Typically, this is used for enumerating hierarchial structures like cache and TLB levels, CPU topology levels, etc.
Modify kcpuid.c to handle subleaf ranges in the CSV file subleaves column. For example, make it able to parse lines in the form:
# LEAF, SUBLEAVES, reg, bits, short_name , ... 0xb, 1:0, eax, 4:0, x2apic_id_shift , ... 0xb, 1:0, ebx, 15:0, domain_lcpus_count , ... 0xb, 1:0, ecx, 7:0, domain_nr , ...
This way, full output can be printed to the user.
Signed-off-by: Ahmed S. Darwish <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Link: https://lore.kernel.org/all/[email protected]
show more ...
|
| b0a59d14 | 18-Jul-2024 |
Ahmed S. Darwish <[email protected]> |
tools/x86/kcpuid: Recognize all leaves with subleaves
cpuid.csv will be extended in further commits with all-publicly-known CPUID leaves and bitfields. Thus, modify has_subleafs() to identify all k
tools/x86/kcpuid: Recognize all leaves with subleaves
cpuid.csv will be extended in further commits with all-publicly-known CPUID leaves and bitfields. Thus, modify has_subleafs() to identify all known leaves with subleaves.
Remove the redundant "is_amd" check since all x86 vendors already report the maxium supported extended leaf at leaf 0x80000000 EAX register.
The extra mentioned leaves are:
- Leaf 0x12, Intel Software Guard Extensions (SGX) enumeration - Leaf 0x14, Intel process trace (PT) enumeration - Leaf 0x17, Intel SoC vendor attributes enumeration - Leaf 0x1b, Intel PCONFIG (Platform configuration) enumeration - Leaf 0x1d, Intel AMX (Advanced Matrix Extensions) tile information - Leaf 0x1f, Intel v2 extended topology enumeration - Leaf 0x23, Intel ArchPerfmonExt (Architectural PMU ext) enumeration - Leaf 0x80000020, AMD Platform QoS extended features enumeration - Leaf 0x80000026, AMD v2 extended topology enumeration
Set the 'max_subleaf' variable for all the newly marked leaves with extra subleaves. Ideally, this should be fetched from the CSV file instead, but the current kcpuid code architecture has two runs: one run to serially invoke the cpuid instructions and save all the output in-memory, and one run to parse this in-memory output through the CSV specification.
Signed-off-by: Ahmed S. Darwish <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Link: https://lore.kernel.org/all/[email protected]
show more ...
|
| 9ecbc60a | 18-Jul-2024 |
Ahmed S. Darwish <[email protected]> |
tools/x86/kcpuid: Strip bitfield names leading/trailing whitespace
While parsing and saving bitfield names from the CSV file, an extra leading space is copied verbatim. That extra space is not a bi
tools/x86/kcpuid: Strip bitfield names leading/trailing whitespace
While parsing and saving bitfield names from the CSV file, an extra leading space is copied verbatim. That extra space is not a big issue now, but further commits will add a new CSV file with much more padding for the bitfield's name column.
Strip leading/trailing whitespaces while saving bitfield names.
Signed-off-by: Ahmed S. Darwish <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Link: https://lore.kernel.org/all/[email protected]
show more ...
|
| cf96ab1a | 18-Jul-2024 |
Ahmed S. Darwish <[email protected]> |
tools/x86/kcpuid: Protect against faulty "max subleaf" values
Protect against the kcpuid code parsing faulty max subleaf numbers through a min() expression. Thus, ensuring that max_subleaf will alw
tools/x86/kcpuid: Protect against faulty "max subleaf" values
Protect against the kcpuid code parsing faulty max subleaf numbers through a min() expression. Thus, ensuring that max_subleaf will always be ≤ MAX_SUBLEAF_NUM.
Use "u32" for the subleaf numbers since kcpuid is compiled with -Wextra, which includes signed/unsigned comparisons warnings.
Signed-off-by: Ahmed S. Darwish <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Link: https://lore.kernel.org/all/[email protected]
show more ...
|
| 5dd7ca42 | 18-Jul-2024 |
Ahmed S. Darwish <[email protected]> |
tools/x86/kcpuid: Set max possible subleaves count to 64
cpuid.csv will be extended in further commits with all-publicly-known CPUID leaves and bitfields. One of the new leaves is 0xd for extended
tools/x86/kcpuid: Set max possible subleaves count to 64
cpuid.csv will be extended in further commits with all-publicly-known CPUID leaves and bitfields. One of the new leaves is 0xd for extended CPU state enumeration. Depending on XCR0 dword bits, it can export up to 64 subleaves.
Set kcpuid.c MAX_SUBLEAF_NUM to 64.
Signed-off-by: Ahmed S. Darwish <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Link: https://lore.kernel.org/all/[email protected]
show more ...
|
| a52e735f | 18-Jul-2024 |
Ahmed S. Darwish <[email protected]> |
tools/x86/kcpuid: Properly align long-description columns
When kcpuid is invoked with "--all --details", the detailed description column is not properly aligned for all bitfield rows:
CPUID_0x4_ECX
tools/x86/kcpuid: Properly align long-description columns
When kcpuid is invoked with "--all --details", the detailed description column is not properly aligned for all bitfield rows:
CPUID_0x4_ECX[0x0]: cache_level : 0x1 - Cache Level ... cache_self_init - Cache Self Initialization
This is due to differences in output handling between boolean single-bit "bitflags" and multi-bit bitfields. For the former, the bitfield's value is not outputted as it is implied to be true by just outputting the bitflag's name in its respective line.
If long descriptions were requested through the --all parameter, properly align the bitflag's description columns through extra tabs. With that, the sample output above becomes:
CPUID_0x4_ECX[0x0]: cache_level : 0x1 - Cache Level ... cache_self_init - Cache Self Initialization
Signed-off-by: Ahmed S. Darwish <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Link: https://lore.kernel.org/all/[email protected]
show more ...
|
| cd3ad661 | 06-Feb-2023 |
Borislav Petkov (AMD) <[email protected]> |
tools/x86/kcpuid: Dump the CPUID function in detailed view
Sometimes it is useful to know which CPUID leaf contains the fields so add it to -d output so that it looks like this:
CPUID_0x8000001e_
tools/x86/kcpuid: Dump the CPUID function in detailed view
Sometimes it is useful to know which CPUID leaf contains the fields so add it to -d output so that it looks like this:
CPUID_0x8000001e_ECX[0x0]: extended_apic_id : 0x8 - Extended APIC ID core_id : 0x4 - Identifies the logical core ID threads_per_core : 0x1 - The number of threads per core is threads_per_core + 1 node_id : 0x0 - Node ID nodes_per_processor : 0x0 - Nodes per processor { 0: 1 node, else reserved }
CPUID_0x8000001f_ECX[0x0]: sme - Secure Memory Encryption
...
Signed-off-by: Borislav Petkov (AMD) <[email protected]> Signed-off-by: Terry Bowman <[email protected]> Reviewed-by: Feng Tang <[email protected]> Link: https://lore.kernel.org/r/[email protected]
show more ...
|
| ce22e434 | 06-Feb-2023 |
Terry Bowman <[email protected]> |
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 <ter
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 <[email protected]> Signed-off-by: Borislav Petkov (AMD) <[email protected]> Reviewed-by: Feng Tang <[email protected]> Link: https://lore.kernel.org/r/[email protected]
show more ...
|
| f281854f | 15-Mar-2021 |
Borislav Petkov <[email protected]> |
tools/x86/kcpuid: Add AMD leaf 0x8000001E
Contains core IDs, node IDs and other topology info.
Signed-off-by: Borislav Petkov <[email protected]> Acked-by: Feng Tang <[email protected]> Link: https://lk
tools/x86/kcpuid: Add AMD leaf 0x8000001E
Contains core IDs, node IDs and other topology info.
Signed-off-by: Borislav Petkov <[email protected]> Acked-by: Feng Tang <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
show more ...
|
| e20f6702 | 15-Mar-2021 |
Borislav Petkov <[email protected]> |
tools/x86/kcpuid: Check last token too
Input lines like
0x8000001E, 0, EAX, 31:0, Extended APIC ID
where the short name is missing lead to a segfault because the loop takes the long name f
tools/x86/kcpuid: Check last token too
Input lines like
0x8000001E, 0, EAX, 31:0, Extended APIC ID
where the short name is missing lead to a segfault because the loop takes the long name for the short name and tokens[5] becomes NULL which explodes later in strcpy().
Check its value too before further processing.
Signed-off-by: Borislav Petkov <[email protected]> Acked-by: Feng Tang <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
show more ...
|