Merge lp:~manjo/ubuntu/wily/lshw/cpuinfo-backport-upstream into lp:ubuntu/wily/lshw

Proposed by Manoj Iyer
Status: Merged
Merge reported by: Michael Terry
Merged at revision: not available
Proposed branch: lp:~manjo/ubuntu/wily/lshw/cpuinfo-backport-upstream
Merge into: lp:ubuntu/wily/lshw
Diff against target: 253 lines (+238/-0)
2 files modified
debian/patches/cpuinfo-arm-aarch64-s390-support.patch (+237/-0)
debian/patches/series (+1/-0)
To merge this branch: bzr merge lp:~manjo/ubuntu/wily/lshw/cpuinfo-backport-upstream
Reviewer Review Type Date Requested Status
Michael Terry Approve
Review via email: mp+268128@code.launchpad.net

Description of the change

Backport cpuinfo support for arm, aarch64, and s390 from upstream development tree. This fixes lshw displaying incorrect information on aarch64 systems.

Before the patch:
  *-core
       description: Motherboard
       physical id: 0
       capabilities: < removed >
     *-cpu:0
          description: CPU
          product: cpu
          physical id: 0
          bus info: cpu@0
     *-cpu:1 DISABLED
          description: CPU
          product: cpu
          physical id: 2
          bus info: cpu@1
     *-cpu:2 DISABLED
          description: CPU
          product: cpu
          physical id: 4
          bus info: cpu@2

After the patch:
  *-core
       description: Motherboard
       physical id: 0
       capabilities: < removed >
     *-cpu:0
          description: CPU
          product: cpu
          physical id: 0
          bus info: cpu@0
          capabilities: fp asimd aes pmull sha1 sha2 crc32
     *-cpu:1
          description: CPU
          product: cpu
          physical id: 2
          bus info: cpu@1
          capabilities: fp asimd aes pmull sha1 sha2 crc32
     *-cpu:2
          description: CPU
          product: cpu
          physical id: 4
          bus info: cpu@2
          capabilities: fp asimd aes pmull sha1 sha2 crc32

To post a comment you must log in.
Revision history for this message
Michael Terry (mterry) wrote :

Looks good, thank you so much! I've uploaded this to wily.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'debian/patches/cpuinfo-arm-aarch64-s390-support.patch'
2--- debian/patches/cpuinfo-arm-aarch64-s390-support.patch 1970-01-01 00:00:00 +0000
3+++ debian/patches/cpuinfo-arm-aarch64-s390-support.patch 2015-08-14 19:15:20 +0000
4@@ -0,0 +1,237 @@
5+Description: Backport cpuinfo support for arm, aarch64, and s390.
6+ On certain platforms lshw does not print the correct CPU infomation.
7+ This patch backports support for these architectures from upstream svn source.
8+Origin: backport, http://ezix.org/source/packages/lshw/development
9+Forwarded: not-needed
10+---
11+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
12+--- a/src/core/cpuinfo.cc
13++++ b/src/core/cpuinfo.cc
14+@@ -9,7 +9,7 @@
15+ #include <stdlib.h>
16+ #include <vector>
17+
18+-__ID("@(#) $Id: cpuinfo.cc 2497 2012-05-20 00:03:55Z lyonel $");
19++__ID("@(#) $Id: cpuinfo.cc 2580 2015-07-16 15:33:56Z lyonel $");
20+
21+ static int currentcpu = 0;
22+
23+@@ -77,6 +77,184 @@
24+ }
25+ #endif
26+
27++#ifdef __s390x__
28++static vector <string> s390x_features;
29++static string s390x_vendor;
30++static void cpuinfo_s390x(hwNode & node,
31++string id,
32++string value)
33++{
34++ if (id == "features")
35++ {
36++ while (value.length() > 0)
37++ {
38++ size_t pos = value.find(' ');
39++ string capability = (pos==string::npos)?value:value.substr(0, pos);
40++ s390x_features.push_back(capability);
41++ if (pos == string::npos)
42++ value = "";
43++ else
44++ value = hw::strip(value.substr(pos));
45++ }
46++ }
47++
48++ if (id == "vendor_id")
49++ s390x_vendor = value;
50++
51++ if (matches(id, "^processor"))
52++ currentcpu++;
53++
54++ hwNode *cpu = getcpu(node, currentcpu);
55++ if (cpu)
56++ {
57++ cpu->addHint("logo", string("s390x"));
58++ cpu->claim(true);
59++ cpu->setVendor(s390x_vendor);
60++
61++ for(int i=0; i < s390x_features.size(); i++)
62++ cpu->addCapability(s390x_features[i]);
63++ /* many thanks to Martin Schwidefsky for communicating the descriptions
64++ of the feature flags
65++ */
66++ cpu->describeCapability("esan3", "ESA new instructions 3 (N3)");
67++ cpu->describeCapability("zarch", "x/Architecture (64-bit) mode)");
68++ cpu->describeCapability("stfle", "store facility list extended instruction");
69++ cpu->describeCapability("msa", "message security assist facility");
70++ cpu->describeCapability("ldisp", "long displacement facility");
71++ cpu->describeCapability("eimm", "extended immediate facility");
72++ cpu->describeCapability("dfp", "decimal floating point facility");
73++ cpu->describeCapability("edat", "enhanced DAT facility");
74++ cpu->describeCapability("etf3eh", "ETF3 enhancement facility");
75++ cpu->describeCapability("highgprs", "support for 64-bit registers for 31-bit programs");
76++ cpu->describeCapability("te", "transactional/constraint transactional execution facilities");
77++ }
78++}
79++#endif
80++
81++#ifdef __arm__
82++static void cpuinfo_arm(hwNode & node,
83++ string id,
84++ string value)
85++{
86++
87++ if (id.substr(0, string("processor").size())=="processor")
88++ currentcpu++;
89++
90++ hwNode *cpu = getcpu(node, currentcpu);
91++ if (cpu)
92++ {
93++ cpu->addHint("logo", string("arm"));
94++ if (id == "model name" && node.getDescription() == "")
95++ node.setDescription(value);
96++ cpu->claim(true);
97++ if (id == "Features")
98++ {
99++ while (value.length() > 0)
100++ {
101++ size_t pos = value.find(' ');
102++ string capability = (pos==string::npos)?value:value.substr(0, pos);
103++ cpu->addCapability(capability);
104++ if (pos == string::npos)
105++ value = "";
106++ else
107++ value = hw::strip(value.substr(pos));
108++ }
109++ }
110++ /* With help from:
111++ http://infocenter.arm.com/help/index.jsp
112++ http://unix.stackexchange.com/questions/43539/what-do-the-flags-in-proc-cpuinfo-mean
113++ http://en.wikipedia.org/wiki/ARM_architecture
114++ */
115++ cpu->describeCapability("swp", "Swap instruction");
116++ cpu->describeCapability("swpb", "Swap Byte instruction");
117++ cpu->describeCapability("half", "Unknown");
118++ cpu->describeCapability("thumb", "Thumb instruction set");
119++ cpu->describeCapability("26bit", "26-bit Model");
120++ cpu->describeCapability("fastmult", "Fast Multiplication");
121++ cpu->describeCapability("fpa", "Floating point accelerator");
122++ cpu->describeCapability("vfp", "VFP (vector floating point instructions)");
123++ cpu->describeCapability("vfpv3", "VFP version 3");
124++ cpu->describeCapability("vfpv3d16", "VFP version 3 with 16 64-bit FPU registers");
125++ cpu->describeCapability("vfpv4", "VFP version 4");
126++ cpu->describeCapability("vfpd32", "Unknown");
127++ cpu->describeCapability("edsp", "DSP extensions");
128++ cpu->describeCapability("java", "Jazelle (Java bytecode accelerator)");
129++ cpu->describeCapability("thumbee", "Thumb Execution Environment");
130++ cpu->describeCapability("neon", "NEON aka MPE - Media Processing Engine");
131++ cpu->describeCapability("tls", "TLS register");
132++ cpu->describeCapability("iwmmxt", "SIMD instructions");
133++ cpu->describeCapability("crunch", "MaverickCrunch coprocessor");
134++ cpu->describeCapability("idiva", "SDIV and UDIV hardware division in ARM mode");
135++ cpu->describeCapability("idivt", "SDIV and UDIV hardware division in Thumb mode");
136++ cpu->describeCapability("lpae", "Large Physical Address Extension architecture");
137++ cpu->describeCapability("evtstrm", "Unknown");
138++ }
139++}
140++#endif
141++
142++#ifdef __aarch64__
143++static vector <string> aarch64_features;
144++static string aarch64_processor_name;
145++static void cpuinfo_aarch64(hwNode & node,
146++ string id,
147++ string value)
148++{
149++
150++ /*
151++ * If we already have CPU info extracted from SMBIOS, ignore /proc/cpuinfo
152++ * entirely. This is because the kernel's /proc/cpuinfo output on aarch64
153++ * does not distinguish between cores and physical processors (every core is
154++ * treated as a separate processor) so we may end up creating too many CPU
155++ * nodes.
156++ */
157++ if (getcpu(node)->getHandle().compare(0, 4, "DMI:") == 0)
158++ return;
159++
160++ if (id.substr(0, string("processor").size())=="processor")
161++ currentcpu++;
162++
163++ if (id.substr(0, string("Processor").size())=="Processor")
164++ aarch64_processor_name = value;
165++
166++ if (id == "Features")
167++ {
168++ while (value.length() > 0)
169++ {
170++ size_t pos = value.find(' ');
171++ string capability = (pos==string::npos)?value:value.substr(0, pos);
172++ aarch64_features.push_back(capability);
173++ if (pos == string::npos)
174++ value = "";
175++ else
176++ value = hw::strip(value.substr(pos));
177++ }
178++ for(int i=0; i<=currentcpu; i++)
179++ {
180++ hwNode *cpu = getcpu(node, i);
181++ if (cpu)
182++ {
183++ cpu->addHint("logo", string("aarch64"));
184++ if (node.getDescription() == "")
185++ node.setDescription(aarch64_processor_name);
186++ cpu->claim(true);
187++ for(int i=0; i < aarch64_features.size(); i++)
188++ {
189++ cpu->addCapability(aarch64_features[i]);
190++ cpu->describeCapability("fp", "Floating point instructions");
191++ cpu->describeCapability("asimd", "Advanced SIMD");
192++ cpu->describeCapability("evtstrm", "Event stream");
193++ cpu->describeCapability("aes", "AES instructions");
194++ cpu->describeCapability("pmull", "PMULL instruction");
195++ cpu->describeCapability("sha1", "SHA1 instructions");
196++ cpu->describeCapability("sha2", "SHA2 instructions");
197++ cpu->describeCapability("crc32", "CRC extension");
198++ }
199++ }
200++ }
201++ }
202++}
203++#endif
204++
205+ #ifdef __ia64__
206+ static void cpuinfo_ia64(hwNode & node,
207+ string id,
208+@@ -270,7 +448,7 @@
209+ cpu->setVendor(value);
210+ }
211+ if (id == "model name")
212+- if(cpu->getProduct() == "") cpu->setProduct(value);
213++ cpu->setProduct(value);
214+ //if ((id == "cpu MHz") && (cpu->getSize() == 0))
215+ //{
216+ //cpu->setSize((long long) (1000000L * atof(value.c_str())));
217+@@ -423,6 +601,9 @@
218+ #ifdef __powerpc__
219+ cpuinfo_ppc(n, id, value);
220+ #endif
221++#ifdef __s390x__
222++ cpuinfo_s390x(n, id, value);
223++#endif
224+ #ifdef __hppa__
225+ cpuinfo_hppa(n, id, value);
226+ #endif
227+@@ -432,6 +613,14 @@
228+ #ifdef __ia64__
229+ cpuinfo_ia64(n, id, value);
230+ #endif
231++
232++#ifdef __arm__
233++ cpuinfo_arm(n, id, value);
234++#endif
235++#ifdef __aarch64__
236++ cpuinfo_aarch64(n, id, value);
237++#endif
238++
239+ }
240+ }
241+ }
242
243=== modified file 'debian/patches/series'
244--- debian/patches/series 2015-04-03 21:34:15 +0000
245+++ debian/patches/series 2015-08-14 19:15:20 +0000
246@@ -5,6 +5,7 @@
247 cflags.patch
248 #alpha.patch
249 gcc45.gcc
250+cpuinfo-arm-aarch64-s390-support.patch
251 lshw-X.patch
252 privacy.patch
253 sparc.patch

Subscribers

People subscribed via source and target branches

to all changes: