]> git.ipfire.org Git - thirdparty/util-linux.git/commit
lscpu: get the processor information by DMI
authorHuang Shijie <shijie@os.amperecomputing.com>
Tue, 15 Jun 2021 10:06:38 +0000 (10:06 +0000)
committerKarel Zak <kzak@redhat.com>
Wed, 16 Jun 2021 09:09:19 +0000 (11:09 +0200)
commita772d7c493afcec32f0123fc947013f74db6e45d
tree32c73fd3322e45923a38cb9e8bb0f9afa6e4baf4
parent66e259c746e5dc5db7ac6b67c98b0abbc2ab2e6c
lscpu: get the processor information by DMI

The patch :367c85c47286 ("lscpu: use SMBIOS tables on ARM for lscpu")
relies on the existence of "/sys/firmware/dmi/entries/4-0/raw",
which may not exist in standard linux kernel.

But "/sys/firmware/dmi/tables/DMI" should exist and can provide the required
processor information.

This patch uses "/sys/firmware/dmi/tables/DMI"
to get the processor information:

Before this patch, in Ampere Altra platform, the lscpu output is:
   ---------------------------------------------
Architecture:                    aarch64
CPU op-mode(s):                  32-bit, 64-bit
Byte Order:                      Little Endian
CPU(s):                          160
On-line CPU(s) list:             0-159
Vendor ID:                       ARM
Model name:                      Neoverse-N1
Model:                           1
Thread(s) per core:              1
Core(s) per socket:              80
Socket(s):                       2
    ........................................
   ---------------------------------------------

After this patch, we can use get the lscpu output
in Ampere Altra platform:
   ---------------------------------------------
Architecture:                    aarch64
CPU op-mode(s):                  32-bit, 64-bit
Byte Order:                      Little Endian
CPU(s):                          160
On-line CPU(s) list:             0-159
Vendor ID:                       ARM
BIOS Vendor ID:                  Ampere(R)
Model name:                      Neoverse-N1
BIOS Model name:                 Ampere(R) Altra(R) Processor Q00-00 CPU @ 3.0GHz
Model:                           1
Thread(s) per core:              1
Core(s) per socket:              80
Socket(s):                       2
    ........................................
   ---------------------------------------------

[kzak@redhat.com: - s/sprintf/snprintf/]

Signed-off-by: Huang Shijie <shijie@os.amperecomputing.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
sys-utils/lscpu-arm.c
sys-utils/lscpu-dmi.c
sys-utils/lscpu.h