Blame SOURCES/0068-lscpu-use-cpu-and-revision-tag-if-available.patch

b394b9
From cd0d8ef86151d72a246d565844d4c0470feb6b20 Mon Sep 17 00:00:00 2001
b394b9
From: Ruediger Meier <ruediger.meier@ga-group.nl>
b394b9
Date: Wed, 16 Mar 2016 13:18:18 +0100
b394b9
Subject: [PATCH 68/84] lscpu: use cpu and revision tag if available
b394b9
b394b9
Avoid ifdef which does not work with --sysroot. Our existing test
b394b9
dumps produce even better output now for ppc and sparc.
b394b9
b394b9
The logic moved to the printing section.
b394b9
b394b9
Upstream: http://github.com/karelzak/util-linux/commit/641350fe822e7f1ac10873dad9a364bdeaba8083
b394b9
Upstream: http://github.com/karelzak/util-linux/commit/86c4817e0ea02656ddb62fe27757a9fd4f13b2d3
b394b9
Upstream: http://github.com/karelzak/util-linux/commit/c95e3889725389e9d7e24d29c2a71b015959575f
b394b9
Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=1326615
b394b9
CC: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
b394b9
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
b394b9
Signed-off-by: Karel Zak <kzak@redhat.com>
b394b9
---
b394b9
 sys-utils/lscpu.c                             | 17 ++++++++---------
b394b9
 tests/expected/lscpu/lscpu-ppc64-POWER7       |  3 ++-
b394b9
 tests/expected/lscpu/lscpu-ppc64-POWER7-64cpu |  3 ++-
b394b9
 3 files changed, 12 insertions(+), 11 deletions(-)
b394b9
b394b9
diff --git a/sys-utils/lscpu.c b/sys-utils/lscpu.c
b394b9
index 68b15af..7a00636 100644
b394b9
--- a/sys-utils/lscpu.c
b394b9
+++ b/sys-utils/lscpu.c
b394b9
@@ -141,6 +141,8 @@ struct lscpu_desc {
b394b9
 	char	*family;
b394b9
 	char	*model;
b394b9
 	char	*modelname;
b394b9
+	char	*revision;  /* alternative for model (ppc) */
b394b9
+	char	*cpu;       /* alternative for modelname (ppc, sparc) */
b394b9
 	char	*virtflag;	/* virtualization flag (vmx, svm) */
b394b9
 	char	*hypervisor;	/* hypervisor software */
b394b9
 	int	hyper;		/* hypervisor vendor ID */
b394b9
@@ -355,13 +357,8 @@ read_basicinfo(struct lscpu_desc *desc, struct lscpu_modifier *mod)
b394b9
 		else if (lookup(buf, "vendor_id", &desc->vendor)) ;
b394b9
 		else if (lookup(buf, "family", &desc->family)) ;
b394b9
 		else if (lookup(buf, "cpu family", &desc->family)) ;
b394b9
-#if defined(__powerpc__) || defined(__powerpc64__)
b394b9
-		else if (lookup(buf, "revision", &desc->model)) ;
b394b9
-		else if (lookup(buf, "cpu", &desc->modelname)) ;
b394b9
-#else
b394b9
 		else if (lookup(buf, "model", &desc->model)) ;
b394b9
 		else if (lookup(buf, "model name", &desc->modelname)) ;
b394b9
-#endif
b394b9
 		else if (lookup(buf, "stepping", &desc->stepping)) ;
b394b9
 		else if (lookup(buf, "cpu MHz", &desc->mhz)) ;
b394b9
 		else if (lookup(buf, "flags", &desc->flags)) ;		/* x86 */
b394b9
@@ -369,6 +366,8 @@ read_basicinfo(struct lscpu_desc *desc, struct lscpu_modifier *mod)
b394b9
 		else if (lookup(buf, "type", &desc->flags)) ;		/* sparc64 */
b394b9
 		else if (lookup(buf, "bogomips", &desc->bogomips)) ;
b394b9
 		else if (lookup(buf, "bogomips per cpu", &desc->bogomips)) ; /* s390 */
b394b9
+		else if (lookup(buf, "cpu", &desc->cpu)) ;
b394b9
+		else if (lookup(buf, "revision", &desc->revision)) ;
b394b9
 		else
b394b9
 			continue;
b394b9
 	}
b394b9
@@ -1264,10 +1263,10 @@ print_summary(struct lscpu_desc *desc, struct lscpu_modifier *mod)
b394b9
 		print_s(_("Vendor ID:"), desc->vendor);
b394b9
 	if (desc->family)
b394b9
 		print_s(_("CPU family:"), desc->family);
b394b9
-	if (desc->model)
b394b9
-		print_s(_("Model:"), desc->model);
b394b9
-	if (desc->modelname)
b394b9
-		print_s(_("Model name:"), desc->modelname);
b394b9
+	if (desc->model || desc->revision)
b394b9
+		print_s(_("Model:"), desc->revision ? desc->revision : desc->model);
b394b9
+	if (desc->modelname || desc->cpu)
b394b9
+		print_s(_("Model name:"), desc->cpu ? desc->cpu : desc->modelname);
b394b9
 	if (desc->stepping)
b394b9
 		print_s(_("Stepping:"), desc->stepping);
b394b9
 	if (desc->mhz)
b394b9
diff --git a/tests/expected/lscpu/lscpu-ppc64-POWER7 b/tests/expected/lscpu/lscpu-ppc64-POWER7
b394b9
index 0d6c5ba..9a3c0c9 100644
b394b9
--- a/tests/expected/lscpu/lscpu-ppc64-POWER7
b394b9
+++ b/tests/expected/lscpu/lscpu-ppc64-POWER7
b394b9
@@ -4,7 +4,8 @@ Thread(s) per core:    4
b394b9
 Core(s) per socket:    1
b394b9
 Socket(s):             4
b394b9
 NUMA node(s):          1
b394b9
-Model:                 IBM,8233-E8B
b394b9
+Model:                 2.1 (pvr 003f 0201)
b394b9
+Model name:            POWER7 (architected), altivec supported
b394b9
 L1d cache:             32K
b394b9
 L1i cache:             32K
b394b9
 NUMA node0 CPU(s):     0-15
b394b9
diff --git a/tests/expected/lscpu/lscpu-ppc64-POWER7-64cpu b/tests/expected/lscpu/lscpu-ppc64-POWER7-64cpu
b394b9
index 40e2736..d4ae6c1 100644
b394b9
--- a/tests/expected/lscpu/lscpu-ppc64-POWER7-64cpu
b394b9
+++ b/tests/expected/lscpu/lscpu-ppc64-POWER7-64cpu
b394b9
@@ -4,7 +4,8 @@ Thread(s) per core:    4
b394b9
 Core(s) per socket:    1
b394b9
 Socket(s):             16
b394b9
 NUMA node(s):          2
b394b9
-Model:                 IBM,8231-E2B
b394b9
+Model:                 2.1 (pvr 003f 0201)
b394b9
+Model name:            POWER7 (architected), altivec supported
b394b9
 L1d cache:             32K
b394b9
 L1i cache:             32K
b394b9
 NUMA node0 CPU(s):     0-63
b394b9
-- 
b394b9
2.7.4
b394b9