aboutsummaryrefslogtreecommitdiffstats
path: root/sys-utils
diff options
context:
space:
mode:
authorKarel Zak <kzak@redhat.com>2025-09-03 11:46:35 +0200
committerKarel Zak <kzak@redhat.com>2025-09-03 11:46:35 +0200
commit90c0b7658c08ba01abfd12a189b17535ceb067bd (patch)
treebc595de0f1c93cc6cacf4fb786111aaf36ff20ba /sys-utils
parent0c57a76da61e5ab1f15eada0553b2ef85026269c (diff)
parent523faa741835e86aadc5183a61598937ac5290d9 (diff)
downloadutil-linux-90c0b7658c08ba01abfd12a189b17535ceb067bd.tar.gz
Merge branch 'feat/lscpu_add_microcode_column' of https://github.com/cgoesche/util-linux-fork
* 'feat/lscpu_add_microcode_column' of https://github.com/cgoesche/util-linux-fork: bash-completion: add MICROCODE to $OPTS_ALL lscpu: add MICROCODE output column
Diffstat (limited to 'sys-utils')
-rw-r--r--sys-utils/lscpu.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/sys-utils/lscpu.c b/sys-utils/lscpu.c
index fe996ebf93..f144b1d655 100644
--- a/sys-utils/lscpu.c
+++ b/sys-utils/lscpu.c
@@ -100,6 +100,7 @@ enum {
COL_CPU_ADDRESS,
COL_CPU_CONFIGURED,
COL_CPU_ONLINE,
+ COL_CPU_MICROCODE,
COL_CPU_MHZ,
COL_CPU_SCALMHZ,
COL_CPU_MAXMHZ,
@@ -148,6 +149,7 @@ static struct lscpu_coldesc coldescs_cpu[] =
[COL_CPU_ADDRESS] = { "ADDRESS", N_("physical address of a CPU") },
[COL_CPU_CONFIGURED] = { "CONFIGURED", N_("shows if the hypervisor has allocated the CPU"), 0, 0, SCOLS_JSON_BOOLEAN_OPTIONAL },
[COL_CPU_ONLINE] = { "ONLINE", N_("shows if Linux currently makes use of the CPU"), SCOLS_FL_RIGHT, 0, SCOLS_JSON_BOOLEAN_OPTIONAL },
+ [COL_CPU_MICROCODE] = { "MICROCODE", N_("shows the loaded CPU microcode version"), 0, 0, SCOLS_JSON_STRING },
[COL_CPU_MHZ] = { "MHZ", N_("shows the current MHz of the CPU"), SCOLS_FL_RIGHT, 0, SCOLS_JSON_NUMBER },
[COL_CPU_SCALMHZ] = { "SCALMHZ%", N_("shows scaling percentage of the CPU frequency"), SCOLS_FL_RIGHT, SCOLS_JSON_NUMBER },
[COL_CPU_MAXMHZ] = { "MAXMHZ", N_("shows the maximum MHz of the CPU"), SCOLS_FL_RIGHT, 0, SCOLS_JSON_NUMBER },
@@ -434,6 +436,10 @@ static char *get_cell_data(
case COL_CPU_ONLINE:
get_cell_boolean(cxt, !!cxt->online, is_cpu_online(cxt, cpu), buf, bufsz);
break;
+ case COL_CPU_MICROCODE:
+ if (cpu->type && cpu->type->microcode)
+ xstrncpy(buf, cpu->type->microcode, bufsz);
+ break;
case COL_CPU_MHZ:
if (cpu->mhz_cur_freq)
snprintf(buf, bufsz, "%.4f", cpu->mhz_cur_freq);