05ad79
From 246ab88515fca389c02602521fc765d3e597fd7a Mon Sep 17 00:00:00 2001
05ad79
From: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
05ad79
Date: Mon, 14 Mar 2016 20:18:07 +0530
05ad79
Subject: [PATCH 67/84] lscpu: Fix model and model name on Power Systems
05ad79
05ad79
On Power System, lspcu presently displays system model number instead of
05ad79
processor model name. 'model' tag in cpuinfo contains system model name,
05ad79
not processor model. Instead it uses 'cpu' tag for processor model name.
05ad79
Also it uses 'revision' tag for processor model.
05ad79
05ad79
Fix lspcu so that it displays processor model number. Also display processor
05ad79
model name.
05ad79
05ad79
cpuinfo output on Power System:
05ad79
  ...
05ad79
  ...
05ad79
05ad79
  processor	: 127
05ad79
  cpu		: POWER8E (raw), altivec supported
05ad79
  clock		: 4322.000000MHz
05ad79
  revision	: 2.1 (pvr 004b 0201)
05ad79
05ad79
  timebase	: 512000000
05ad79
  platform	: PowerNV
05ad79
  model		: 8286-42A
05ad79
  machine	: PowerNV 8286-42A
05ad79
  firmware	: OPAL
05ad79
05ad79
Output without this patch:
05ad79
  Architecture:          ppc64le
05ad79
  Byte Order:            Little Endian
05ad79
  CPU(s):                128
05ad79
  On-line CPU(s) list:   0-127
05ad79
  Thread(s) per core:    8
05ad79
  Core(s) per socket:    4
05ad79
  Socket(s):             4
05ad79
  NUMA node(s):          4
05ad79
  Model:                 8286-42A
05ad79
  ...
05ad79
  ...
05ad79
05ad79
Output with this patch:
05ad79
  Architecture:          ppc64le
05ad79
  Byte Order:            Little Endian
05ad79
  CPU(s):                128
05ad79
  On-line CPU(s) list:   0-127
05ad79
  Thread(s) per core:    8
05ad79
  Core(s) per socket:    4
05ad79
  Socket(s):             4
05ad79
  NUMA node(s):          4
05ad79
  Model:                 2.1 (pvr 004b 0201)
05ad79
  Model name:            POWER8E (raw), altivec supported
05ad79
  ...
05ad79
  ...
05ad79
05ad79
Upstream: http://github.com/karelzak/util-linux/commit/3ac03fe4d20558b55635a048d7f2fb0f5e85ee2a
05ad79
Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=1326615
05ad79
Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
05ad79
---
05ad79
 sys-utils/lscpu.c | 5 +++++
05ad79
 1 file changed, 5 insertions(+)
05ad79
05ad79
diff --git a/sys-utils/lscpu.c b/sys-utils/lscpu.c
05ad79
index 4af8176..68b15af 100644
05ad79
--- a/sys-utils/lscpu.c
05ad79
+++ b/sys-utils/lscpu.c
05ad79
@@ -355,8 +355,13 @@ read_basicinfo(struct lscpu_desc *desc, struct lscpu_modifier *mod)
05ad79
 		else if (lookup(buf, "vendor_id", &desc->vendor)) ;
05ad79
 		else if (lookup(buf, "family", &desc->family)) ;
05ad79
 		else if (lookup(buf, "cpu family", &desc->family)) ;
05ad79
+#if defined(__powerpc__) || defined(__powerpc64__)
05ad79
+		else if (lookup(buf, "revision", &desc->model)) ;
05ad79
+		else if (lookup(buf, "cpu", &desc->modelname)) ;
05ad79
+#else
05ad79
 		else if (lookup(buf, "model", &desc->model)) ;
05ad79
 		else if (lookup(buf, "model name", &desc->modelname)) ;
05ad79
+#endif
05ad79
 		else if (lookup(buf, "stepping", &desc->stepping)) ;
05ad79
 		else if (lookup(buf, "cpu MHz", &desc->mhz)) ;
05ad79
 		else if (lookup(buf, "flags", &desc->flags)) ;		/* x86 */
05ad79
-- 
05ad79
2.7.4
05ad79