From 6d1704f45c27e7274ec8f6580a7a65ee47057308 Mon Sep 17 00:00:00 2001 From: fly_fzc <2385803914@qq.com> Date: Mon, 7 Jul 2025 20:56:37 +0800 Subject: [PATCH] Add new cpu model name of arm Kunpeng --- Add-new-cpu-model-name-of-arm-Kunpeng.patch | 80 +++++++++++++++++++++ util-linux.spec | 9 ++- 2 files changed, 88 insertions(+), 1 deletion(-) create mode 100644 Add-new-cpu-model-name-of-arm-Kunpeng.patch diff --git a/Add-new-cpu-model-name-of-arm-Kunpeng.patch b/Add-new-cpu-model-name-of-arm-Kunpeng.patch new file mode 100644 index 0000000..ce8fc46 --- /dev/null +++ b/Add-new-cpu-model-name-of-arm-Kunpeng.patch @@ -0,0 +1,80 @@ +From b3128c17d74233a4de449464559f26094be41d5e Mon Sep 17 00:00:00 2001 +From: YunYi Yang +Date: Sat, 29 Mar 2025 15:31:39 +0800 +Subject: [PATCH] Add new cpu model name of arm Kunpeng + +Add the display of the CPU model name when the CPU part id is 0xd02/0xd03 +for Kunpeng. The ID may correspond to multiple cpu model names. Therefore, +refer to the bios model name. + +https://gitee.com/src-openeuler/util-linux/issues/IBBNGQ +--- + sys-utils/lscpu-arm.c | 37 ++++++++++++++++++++++++++++++++++--- + 1 file changed, 34 insertions(+), 3 deletions(-) + +diff --git a/sys-utils/lscpu-arm.c b/sys-utils/lscpu-arm.c +index 79b8e3a..4c60973 100644 +--- a/sys-utils/lscpu-arm.c ++++ b/sys-utils/lscpu-arm.c +@@ -29,6 +29,7 @@ + struct id_part { + const int id; + const char* name; ++ char* (*inner)(const int, const char*, struct lscpu_cputype *ct); + }; + + static const struct id_part arm_part[] = { +@@ -183,9 +184,13 @@ static const struct id_part fujitsu_part[] = { + { -1, "unknown" }, + }; + ++ ++char* hisi_get_inner_name_compatible(const int id, const char* name, struct lscpu_cputype *ct); ++ + static const struct id_part hisi_part[] = { +- { 0xd01, "Kunpeng-920" }, /* aka tsv110 */ +- { -1, "unknown" }, ++ { 0xd01, "Kunpeng-920", NULL }, ++ { 0xd02, "unknown", hisi_get_inner_name_compatible}, ++ { -1, "unknown", NULL }, + }; + + static const struct id_part ft_part[] = { +@@ -252,6 +2597,19 @@ static inline int parse_implementer_id(struct lscpu_cputype *ct) + return ct->vendor_id; + } + ++char* hisi_get_inner_name_compatible(const int id __attribute__((unused)), const char* name, struct lscpu_cputype *ct) ++{ ++ char* bios_modelname = ct->bios_modelname; ++ if (bios_modelname == NULL) { ++ return (char*)name; ++ } ++ // Compatible with HUAWEI Kunpeng 920 7282C models ++ if (strstr(bios_modelname, "7282C") != NULL) { ++ return "Kunpeng 920 7282C"; ++ } ++ return bios_modelname; ++} ++ + /* + * Use model and vendor IDs to decode to human readable names. + */ +@@ -285,7 +303,13 @@ static int arm_ids_decode(struct lscpu_cputype *ct) + for (j = 0; parts[j].id != -1; j++) { + if (parts[j].id == part) { + free(ct->modelname); +- ct->modelname = xstrdup(parts[j].name); ++ char* real_name = NULL; ++ if (parts[j].inner != NULL) { ++ real_name = parts[j].inner(parts[j].id, parts[j].name, ct); ++ } else { ++ real_name = (char*)parts[j].name; ++ } ++ ct->modelname = xstrdup(real_name); + break; + } + } +-- +2.33.0 + diff --git a/util-linux.spec b/util-linux.spec index 4949334..aa13f99 100644 --- a/util-linux.spec +++ b/util-linux.spec @@ -3,7 +3,7 @@ Name: util-linux Version: 2.37.2 -Release: 43 +Release: 44 Summary: A random collection of Linux utilities License: GPLv2 and GPLv2+ and LGPLv2+ and BSD with advertising and Public Domain URL: https://git.kernel.org/pub/scm/utils/util-linux/util-linux.git @@ -180,6 +180,7 @@ Patch9002: util-linux-Add-sw64-architecture.patch %endif Patch9003: backport-uuidd-fix-open-lock-state-issue.patch Patch9004: sfdisk-fix-crash-casued-by-out-of-bounds-access.patch +Patch9005: Add-new-cpu-model-name-of-arm-Kunpeng.patch BuildRequires: audit-libs-devel >= 1.0.6 gettext-devel libselinux-devel ncurses-devel pam-devel zlib-devel popt-devel BuildRequires: libutempter-devel systemd-devel systemd libuser-devel libcap-ng-devel python3-devel gcc autoconf automake @@ -550,6 +551,12 @@ fi %{_mandir}/man8/{swapoff.8*,swapon.8*,switch_root.8*,umount.8*,wdctl.8.gz,wipefs.8*,zramctl.8*} %changelog +* Mon Jul 7 2025 YunYi Yang - 2.37.2-44 +- Type:bugfix +- ID:NA +- SUG:NA +- DESC:Add new cpu model name of arm Kunpeng + * Mon Jun 16 2025 markeryang - 2.37.2-43 - Type:bugfix - CVE:NA -- Gitee