@@ -209,80 +209,79 @@ static const char *const compat_hwcap2_str[] = {
209
209
210
210
static int c_show (struct seq_file * m , void * v )
211
211
{
212
- int i , j ;
212
+ int j ;
213
+ int cpu = m -> index ;
213
214
bool compat = personality (current -> personality ) == PER_LINUX32 ;
215
+ struct cpuinfo_arm64 * cpuinfo = v ;
216
+ u32 midr = cpuinfo -> reg_midr ;
214
217
215
- for_each_online_cpu (i ) {
216
- struct cpuinfo_arm64 * cpuinfo = & per_cpu (cpu_data , i );
217
- u32 midr = cpuinfo -> reg_midr ;
218
-
219
- /*
220
- * glibc reads /proc/cpuinfo to determine the number of
221
- * online processors, looking for lines beginning with
222
- * "processor". Give glibc what it expects.
223
- */
224
- seq_printf (m , "processor\t: %d\n" , i );
225
- if (compat )
226
- seq_printf (m , "model name\t: ARMv8 Processor rev %d (%s)\n" ,
227
- MIDR_REVISION (midr ), COMPAT_ELF_PLATFORM );
218
+ /*
219
+ * glibc reads /proc/cpuinfo to determine the number of
220
+ * online processors, looking for lines beginning with
221
+ * "processor". Give glibc what it expects.
222
+ */
223
+ seq_printf (m , "processor\t: %d\n" , cpu );
224
+ if (compat )
225
+ seq_printf (m , "model name\t: ARMv8 Processor rev %d (%s)\n" ,
226
+ MIDR_REVISION (midr ), COMPAT_ELF_PLATFORM );
228
227
229
- seq_printf (m , "BogoMIPS\t: %lu.%02lu\n" ,
230
- loops_per_jiffy / (500000UL /HZ ),
231
- loops_per_jiffy / (5000UL /HZ ) % 100 );
228
+ seq_printf (m , "BogoMIPS\t: %lu.%02lu\n" ,
229
+ loops_per_jiffy / (500000UL /HZ ),
230
+ loops_per_jiffy / (5000UL /HZ ) % 100 );
232
231
233
- /*
234
- * Dump out the common processor features in a single line.
235
- * Userspace should read the hwcaps with getauxval(AT_HWCAP)
236
- * rather than attempting to parse this, but there's a body of
237
- * software which does already (at least for 32-bit).
238
- */
239
- seq_puts (m , "Features\t:" );
240
- if (compat ) {
232
+ /*
233
+ * Dump out the common processor features in a single line.
234
+ * Userspace should read the hwcaps with getauxval(AT_HWCAP)
235
+ * rather than attempting to parse this, but there's a body of
236
+ * software which does already (at least for 32-bit).
237
+ */
238
+ seq_puts (m , "Features\t:" );
239
+ if (compat ) {
241
240
#ifdef CONFIG_COMPAT
242
- for (j = 0 ; j < ARRAY_SIZE (compat_hwcap_str ); j ++ ) {
243
- if (compat_elf_hwcap & (1 << j )) {
244
- /*
245
- * Warn once if any feature should not
246
- * have been present on arm64 platform.
247
- */
248
- if (WARN_ON_ONCE (!compat_hwcap_str [j ]))
249
- continue ;
250
-
251
- seq_printf (m , " %s" , compat_hwcap_str [j ]);
252
- }
241
+ for (j = 0 ; j < ARRAY_SIZE (compat_hwcap_str ); j ++ ) {
242
+ if (compat_elf_hwcap & (1 << j )) {
243
+ /*
244
+ * Warn once if any feature should not
245
+ * have been present on arm64 platform.
246
+ */
247
+ if (WARN_ON_ONCE (!compat_hwcap_str [j ]))
248
+ continue ;
249
+
250
+ seq_printf (m , " %s" , compat_hwcap_str [j ]);
253
251
}
252
+ }
254
253
255
- for (j = 0 ; j < ARRAY_SIZE (compat_hwcap2_str ); j ++ )
256
- if (compat_elf_hwcap2 & (1 << j ))
257
- seq_printf (m , " %s" , compat_hwcap2_str [j ]);
254
+ for (j = 0 ; j < ARRAY_SIZE (compat_hwcap2_str ); j ++ )
255
+ if (compat_elf_hwcap2 & (1 << j ))
256
+ seq_printf (m , " %s" , compat_hwcap2_str [j ]);
258
257
#endif /* CONFIG_COMPAT */
259
- } else {
260
- for (j = 0 ; j < ARRAY_SIZE (hwcap_str ); j ++ )
261
- if (cpu_have_feature (j ))
262
- seq_printf (m , " %s" , hwcap_str [j ]);
263
- }
264
- seq_puts (m , "\n" );
265
-
266
- seq_printf (m , "CPU implementer\t: 0x%02x\n" ,
267
- MIDR_IMPLEMENTOR (midr ));
268
- seq_printf (m , "CPU architecture: 8\n" );
269
- seq_printf (m , "CPU variant\t: 0x%x\n" , MIDR_VARIANT (midr ));
270
- seq_printf (m , "CPU part\t: 0x%03x\n" , MIDR_PARTNUM (midr ));
271
- seq_printf (m , "CPU revision\t: %d\n\n" , MIDR_REVISION (midr ));
258
+ } else {
259
+ for (j = 0 ; j < ARRAY_SIZE (hwcap_str ); j ++ )
260
+ if (cpu_have_feature (j ))
261
+ seq_printf (m , " %s" , hwcap_str [j ]);
272
262
}
263
+ seq_puts (m , "\n" );
264
+
265
+ seq_printf (m , "CPU implementer\t: 0x%02x\n" ,
266
+ MIDR_IMPLEMENTOR (midr ));
267
+ seq_puts (m , "CPU architecture: 8\n" );
268
+ seq_printf (m , "CPU variant\t: 0x%x\n" , MIDR_VARIANT (midr ));
269
+ seq_printf (m , "CPU part\t: 0x%03x\n" , MIDR_PARTNUM (midr ));
270
+ seq_printf (m , "CPU revision\t: %d\n\n" , MIDR_REVISION (midr ));
273
271
274
272
return 0 ;
275
273
}
276
274
277
275
static void * c_start (struct seq_file * m , loff_t * pos )
278
276
{
279
- return * pos < 1 ? (void * )1 : NULL ;
277
+ * pos = cpumask_next (* pos - 1 , cpu_online_mask );
278
+ return * pos < nr_cpu_ids ? & per_cpu (cpu_data , * pos ) : NULL ;
280
279
}
281
280
282
281
static void * c_next (struct seq_file * m , void * v , loff_t * pos )
283
282
{
284
283
++ * pos ;
285
- return NULL ;
284
+ return c_start ( m , pos ) ;
286
285
}
287
286
288
287
static void c_stop (struct seq_file * m , void * v )
0 commit comments