Browse Source

s390/cpuinfo: show facilities as reported by stfle

Add a new line to /proc/cpuinfo which shows all available facilities
as reported by the stfle instruction:

> cat /proc/cpuinfo
...
facilities      : 0 1 2 3 4 6 7 ...
...

Reviewed-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Heiko Carstens 8 years ago
parent
commit
157467ba9f
1 changed files with 14 additions and 0 deletions
  1. 14 0
      arch/s390/kernel/processor.c

+ 14 - 0
arch/s390/kernel/processor.c

@@ -7,6 +7,7 @@
 #define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
 #define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
 
 
 #include <linux/cpufeature.h>
 #include <linux/cpufeature.h>
+#include <linux/bitops.h>
 #include <linux/kernel.h>
 #include <linux/kernel.h>
 #include <linux/sched/mm.h>
 #include <linux/sched/mm.h>
 #include <linux/init.h>
 #include <linux/init.h>
@@ -91,6 +92,18 @@ int cpu_have_feature(unsigned int num)
 }
 }
 EXPORT_SYMBOL(cpu_have_feature);
 EXPORT_SYMBOL(cpu_have_feature);
 
 
+static void show_facilities(struct seq_file *m)
+{
+	unsigned int bit;
+	long *facilities;
+
+	facilities = (long *)&S390_lowcore.stfle_fac_list;
+	seq_puts(m, "facilities      :");
+	for_each_set_bit_inv(bit, facilities, MAX_FACILITY_BIT)
+		seq_printf(m, " %d", bit);
+	seq_putc(m, '\n');
+}
+
 static void show_cpu_summary(struct seq_file *m, void *v)
 static void show_cpu_summary(struct seq_file *m, void *v)
 {
 {
 	static const char *hwcap_str[] = {
 	static const char *hwcap_str[] = {
@@ -116,6 +129,7 @@ static void show_cpu_summary(struct seq_file *m, void *v)
 		if (int_hwcap_str[i] && (int_hwcap & (1UL << i)))
 		if (int_hwcap_str[i] && (int_hwcap & (1UL << i)))
 			seq_printf(m, "%s ", int_hwcap_str[i]);
 			seq_printf(m, "%s ", int_hwcap_str[i]);
 	seq_puts(m, "\n");
 	seq_puts(m, "\n");
+	show_facilities(m);
 	show_cacheinfo(m);
 	show_cacheinfo(m);
 	for_each_online_cpu(cpu) {
 	for_each_online_cpu(cpu) {
 		struct cpuid *id = &per_cpu(cpu_info.cpu_id, cpu);
 		struct cpuid *id = &per_cpu(cpu_info.cpu_id, cpu);