[PATCH 3/6] lscpu: show machine type (s390)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Show also the machine type within the lscpu output. With the machine
type it is possible to identify the cpu generation and the supported
features.

Signed-off-by: Heiko Carstens <heiko.carstens@xxxxxxxxxx>
---
 sys-utils/lscpu.c                           | 12 ++++++++++++
 tests/expected/lscpu/lscpu-s390-kvm         |  1 +
 tests/expected/lscpu/lscpu-s390-lpar        |  1 +
 tests/expected/lscpu/lscpu-s390-lpar-drawer |  1 +
 tests/expected/lscpu/lscpu-s390-zvm         |  1 +
 5 files changed, 16 insertions(+)

diff --git a/sys-utils/lscpu.c b/sys-utils/lscpu.c
index 9b87e0431bac..883dff68bb85 100644
--- a/sys-utils/lscpu.c
+++ b/sys-utils/lscpu.c
@@ -198,6 +198,7 @@ struct polarization_modes polar_modes[] = {
 struct lscpu_desc {
 	char	*arch;
 	char	*vendor;
+	char	*machinetype;	/* s390 */
 	char	*family;
 	char	*model;
 	char	*modelname;
@@ -581,6 +582,15 @@ read_basicinfo(struct lscpu_desc *desc, struct lscpu_modifier *mod)
 
 	if (mod->system == SYSTEM_LIVE)
 		read_physical_info_powerpc(desc);
+
+	if (path_exist(_PATH_PROC_SYSINFO)) {
+		FILE *fd = path_fopen("r", 0, _PATH_PROC_SYSINFO);
+
+		while (fd && fgets(buf, sizeof(buf), fd) != NULL && !desc->machinetype)
+			lookup(buf, "Type", &desc->machinetype);
+		if (fd)
+			fclose(fd);
+	}
 }
 
 static int
@@ -1712,6 +1722,8 @@ print_summary(struct lscpu_desc *desc, struct lscpu_modifier *mod)
 		print_n(_("NUMA node(s):"), desc->nnodes);
 	if (desc->vendor)
 		print_s(_("Vendor ID:"), desc->vendor);
+	if (desc->machinetype)
+		print_s(_("Machine type:"), desc->machinetype);
 	if (desc->family)
 		print_s(_("CPU family:"), desc->family);
 	if (desc->model || desc->revision)
diff --git a/tests/expected/lscpu/lscpu-s390-kvm b/tests/expected/lscpu/lscpu-s390-kvm
index 9632b055aef3..66d1c047c59c 100644
--- a/tests/expected/lscpu/lscpu-s390-kvm
+++ b/tests/expected/lscpu/lscpu-s390-kvm
@@ -6,6 +6,7 @@ Core(s) per socket:    1
 Socket(s) per book:    1
 Book(s):               3
 Vendor ID:             IBM/S390
+Machine type:          2817
 BogoMIPS:              14367.00
 Hypervisor:            KVM/Linux
 Hypervisor vendor:     KVM
diff --git a/tests/expected/lscpu/lscpu-s390-lpar b/tests/expected/lscpu/lscpu-s390-lpar
index a4265667f51d..9c8ac2c4f8dd 100644
--- a/tests/expected/lscpu/lscpu-s390-lpar
+++ b/tests/expected/lscpu/lscpu-s390-lpar
@@ -7,6 +7,7 @@ Core(s) per socket:    4
 Socket(s) per book:    6
 Book(s):               4
 Vendor ID:             IBM/S390
+Machine type:          2817
 BogoMIPS:              14367.00
 Hypervisor:            PR/SM
 Hypervisor vendor:     IBM
diff --git a/tests/expected/lscpu/lscpu-s390-lpar-drawer b/tests/expected/lscpu/lscpu-s390-lpar-drawer
index 88fe1009ea0a..587e7a6ed18d 100644
--- a/tests/expected/lscpu/lscpu-s390-lpar-drawer
+++ b/tests/expected/lscpu/lscpu-s390-lpar-drawer
@@ -8,6 +8,7 @@ Book(s) per drawer:    2
 Drawer(s):             4
 NUMA node(s):          1
 Vendor ID:             IBM/S390
+Machine type:          2964
 Model name:            0
 CPU dynamic MHz:       5000
 CPU static MHz:        5000
diff --git a/tests/expected/lscpu/lscpu-s390-zvm b/tests/expected/lscpu/lscpu-s390-zvm
index 6cf24bf867c0..4cd6b8fa0fc1 100644
--- a/tests/expected/lscpu/lscpu-s390-zvm
+++ b/tests/expected/lscpu/lscpu-s390-zvm
@@ -6,6 +6,7 @@ Core(s) per socket:    1
 Socket(s) per book:    1
 Book(s):               4
 Vendor ID:             IBM/S390
+Machine type:          2817
 BogoMIPS:              14367.00
 Hypervisor:            z/VM 6.1.0
 Hypervisor vendor:     IBM
-- 
2.6.6

--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux