]> git.ipfire.org Git - thirdparty/util-linux.git/commit
lscpu: use SMBIOS tables on ARM for lscpu
authorJeffrey Bastian <jbastian@redhat.com>
Tue, 29 Sep 2020 11:28:16 +0000 (13:28 +0200)
committerKarel Zak <kzak@redhat.com>
Tue, 29 Sep 2020 11:28:16 +0000 (13:28 +0200)
commit367c85c472869b75eaf770d4be0b360e30710b95
tree48191991b51ac9df86b54034a0f6317ce44bc695
parenta625b32e2c716723a28a49702a02c78274dd3bb6
lscpu: use SMBIOS tables on ARM for lscpu

ARM SBBR (Sever Base Boot Requirements) require SMBIOS tables, and
SMBIOS Type 4 describes the CPU manufacturer and model name (among other
details).  If SMBIOS Type 4 is present, use it to extract these strings.

Example output (before and after the patch) on an HP m400, Lenovo HR330A,
and HPE Apollo 70:

[root@hp-m400 ~]# /usr/bin/lscpu | grep -i -e vendor -e model -e stepping
Vendor ID:           APM
Model:               1
Model name:          X-Gene
Stepping:            0x0
[root@hp-m400 ~]# ./lscpu | grep -i -e vendor -e model -e stepping
Vendor ID:                       AppliedMicro
Model:                           1
Model name:                      X-Gene
Stepping:                        0x0

[root@lenovo-hr330a ~]# /usr/bin/lscpu | grep -i -e vendor -e model -e stepping
Vendor ID:           APM
Model:               2
Model name:          X-Gene
Stepping:            0x3
[root@lenovo-hr330a ~]# ./lscpu | grep -i -e vendor -e model -e stepping
Vendor ID:                       Ampere(TM)
Model:                           2
Model name:                      eMAG
Stepping:                        0x3

[root@hpe-apollo-70 ~]# /usr/bin/lscpu | grep -i -e vendor -e model -e stepping
Vendor ID:           Cavium
Model:               1
Model name:          ThunderX2 99xx
Stepping:            0x1
[root@hpe-apollo-70 ~]# ./lscpu | grep -i -e vendor -e model -e stepping
Vendor ID:                       Cavium Inc.
Model:                           1
Model name:                      Cavium ThunderX2(R) CPU CN9980 v2.1 @ 2.20GHz
Stepping:                        0x1

[kzak@redhat.com: - move dmi_header to lscpu.h
                  - make arm_cpu_smbios() more robust for failed
    open() and read()
                  - use original arm_cpu_decode() also on failed
    arm_cpu_smbios()]

Signed-off-by: Jeffrey Bastian <jbastian@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
sys-utils/lscpu-arm.c
sys-utils/lscpu-dmi.c
sys-utils/lscpu.h