浏览代码

s390: show virtualization support in /proc/cpuinfo

This patch exposes the SIE capability (aka virtualization support) via
/proc/cpuinfo -> "features" as "sie".

As we don't want to expose this hwcap via elf, let's add a second,
"internal"/non-elf capability list. The content is simply concatenated
to the existing features when printing /proc/cpuinfo.

We also add the defines to elf.h to keep the hwcap stuff at a common
place.

Acked-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
David Hildenbrand 10 年之前
父节点
当前提交
7f16d7e787
共有 3 个文件被更改,包括 22 次插入0 次删除
  1. 7 0
      arch/s390/include/asm/elf.h
  2. 6 0
      arch/s390/kernel/processor.c
  3. 9 0
      arch/s390/kernel/setup.c

+ 7 - 0
arch/s390/include/asm/elf.h

@@ -104,6 +104,9 @@
 #define HWCAP_S390_TE		1024
 #define HWCAP_S390_TE		1024
 #define HWCAP_S390_VXRS		2048
 #define HWCAP_S390_VXRS		2048
 
 
+/* Internal bits, not exposed via elf */
+#define HWCAP_INT_SIE		1UL
+
 /*
 /*
  * These are used to set parameters in the core dumps.
  * These are used to set parameters in the core dumps.
  */
  */
@@ -169,6 +172,10 @@ extern unsigned int vdso_enabled;
 extern unsigned long elf_hwcap;
 extern unsigned long elf_hwcap;
 #define ELF_HWCAP (elf_hwcap)
 #define ELF_HWCAP (elf_hwcap)
 
 
+/* Internal hardware capabilities, not exposed via elf */
+
+extern unsigned long int_hwcap;
+
 /* This yields a string that ld.so will use to load implementation
 /* This yields a string that ld.so will use to load implementation
    specific libraries for optimization.  This is more specific in
    specific libraries for optimization.  This is more specific in
    intent than poking at uname or /proc/cpuinfo.
    intent than poking at uname or /proc/cpuinfo.

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

@@ -61,6 +61,9 @@ static int show_cpuinfo(struct seq_file *m, void *v)
 		"esan3", "zarch", "stfle", "msa", "ldisp", "eimm", "dfp",
 		"esan3", "zarch", "stfle", "msa", "ldisp", "eimm", "dfp",
 		"edat", "etf3eh", "highgprs", "te", "vx"
 		"edat", "etf3eh", "highgprs", "te", "vx"
 	};
 	};
+	static const char * const int_hwcap_str[] = {
+		"sie"
+	};
 	unsigned long n = (unsigned long) v - 1;
 	unsigned long n = (unsigned long) v - 1;
 	int i;
 	int i;
 
 
@@ -75,6 +78,9 @@ static int show_cpuinfo(struct seq_file *m, void *v)
 		for (i = 0; i < ARRAY_SIZE(hwcap_str); i++)
 		for (i = 0; i < ARRAY_SIZE(hwcap_str); i++)
 			if (hwcap_str[i] && (elf_hwcap & (1UL << i)))
 			if (hwcap_str[i] && (elf_hwcap & (1UL << i)))
 				seq_printf(m, "%s ", hwcap_str[i]);
 				seq_printf(m, "%s ", hwcap_str[i]);
+		for (i = 0; i < ARRAY_SIZE(int_hwcap_str); i++)
+			if (int_hwcap_str[i] && (int_hwcap & (1UL << i)))
+				seq_printf(m, "%s ", int_hwcap_str[i]);
 		seq_puts(m, "\n");
 		seq_puts(m, "\n");
 		show_cacheinfo(m);
 		show_cacheinfo(m);
 	}
 	}

+ 9 - 0
arch/s390/kernel/setup.c

@@ -80,6 +80,8 @@ EXPORT_SYMBOL(console_irq);
 unsigned long elf_hwcap __read_mostly = 0;
 unsigned long elf_hwcap __read_mostly = 0;
 char elf_platform[ELF_PLATFORM_SIZE];
 char elf_platform[ELF_PLATFORM_SIZE];
 
 
+unsigned long int_hwcap = 0;
+
 int __initdata memory_end_set;
 int __initdata memory_end_set;
 unsigned long __initdata memory_end;
 unsigned long __initdata memory_end;
 unsigned long __initdata max_physmem_end;
 unsigned long __initdata max_physmem_end;
@@ -793,6 +795,13 @@ static int __init setup_hwcaps(void)
 		strcpy(elf_platform, "z13");
 		strcpy(elf_platform, "z13");
 		break;
 		break;
 	}
 	}
+
+	/*
+	 * Virtualization support HWCAP_INT_SIE is bit 0.
+	 */
+	if (sclp.has_sief2)
+		int_hwcap |= HWCAP_INT_SIE;
+
 	return 0;
 	return 0;
 }
 }
 arch_initcall(setup_hwcaps);
 arch_initcall(setup_hwcaps);