]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lscpu: show RISC-V MMU mode
authorZephyr Li <fritchleybohrer@gmail.com>
Thu, 11 Jun 2026 12:58:34 +0000 (20:58 +0800)
committerZephyr Li <fritchleybohrer@gmail.com>
Thu, 11 Jun 2026 12:58:34 +0000 (20:58 +0800)
Signed-off-by: Zephyr Li <fritchleybohrer@gmail.com>
sys-utils/lscpu-cputype.c
sys-utils/lscpu.c
sys-utils/lscpu.h

index a56ace76cda86055de0c5a66eb2059f58b8a13d9..9b43f0e3f4ea6ae8848ef62e7fc72ec2d4bdec22 100644 (file)
@@ -105,6 +105,7 @@ void lscpu_unref_cputype(struct lscpu_cputype *ct)
                free(ct->static_mhz);
                free(ct->dynamic_mhz);
                free(ct->isa);
+               free(ct->mmu);
                free(ct);
        }
 }
@@ -202,6 +203,7 @@ enum {
        PAT_VENDOR,
        PAT_CACHE,
        PAT_ISA,
+       PAT_MMU,
 };
 
 /*
@@ -243,6 +245,7 @@ static const struct cpuinfo_pattern type_patterns[] =
        DEF_PAT_CPUTYPE( "max thread id",       PAT_MAX_THREAD_ID, mtid),       /* s390 */
        DEF_PAT_CPUTYPE( "microcode",           PAT_MICROCODE, microcode),
        DEF_PAT_CPUTYPE( "mimpid",              PAT_MODEL,      model),         /* riscv */
+       DEF_PAT_CPUTYPE( "mmu",                 PAT_MMU,        mmu),           /* riscv */
        DEF_PAT_CPUTYPE( "model",               PAT_MODEL,      model),
        DEF_PAT_CPUTYPE( "model name",          PAT_MODEL_NAME, modelname),
        DEF_PAT_CPUTYPE( "mvendorid",           PAT_VENDOR,     vendor),        /* riscv */
index 0c8bdf63b3b217b97d6ee7770c5af3864e4ae2ff..66ad03f4b58966c27d5ff613b68721db5486a6af 100644 (file)
@@ -973,6 +973,10 @@ print_summary_cputype(struct lscpu_cxt *cxt,
                lscpu_format_isa_riscv(ct);
                add_summary_s(tb, sec, _("ISA:"), ct->isa);
        }
+
+       if (ct->mmu && is_riscv(ct)) {
+               add_summary_s(tb, sec, _("MMU:"), ct->mmu);
+       }
 }
 
 /*
index b01f081e8c23639e4604f9f2e6f1a240e571b454..476312d183fbe45c9506d996e1c2b994a468b814 100644 (file)
@@ -115,7 +115,8 @@ struct lscpu_cputype {
 
        size_t nr_socket_on_cluster; /* the number of sockets if the is_cluster is 1 */
 
-       char    *isa;   /* loongarch */
+       char    *isa;   /* loongarch, riscv */
+       char    *mmu;   /* riscv */
 };
 
 /* dispatching modes */