[PATCH] MIPS: kernel/proc: expose elf_hwcap flags through cpuinfo

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



According to the kernel man pages for getauxval, all flags that are
exposed through AT_HWCAP should also be presented in human-readable form
in /proc/cpuinfo. MIPS currently lacks that feature.

At the moment only 2 flags (r6, msa) are available which somewhat
duplicates information already exposed through the 'isa' and 'ASEs'
fields of cpuinfo, but they are scattered around various fields now that
do not directly map to the AT_HWCAP flags. This field will also be
useful when more feature flags are available that do not map to features
exposed through existing interfaces.

Signed-off-by: Marcin Nowakowski <marcin.nowakowski@xxxxxxxxxx>
---
 arch/mips/kernel/proc.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/arch/mips/kernel/proc.c b/arch/mips/kernel/proc.c
index 4eff2ae..593aaac 100644
--- a/arch/mips/kernel/proc.c
+++ b/arch/mips/kernel/proc.c
@@ -10,6 +10,7 @@
 #include <asm/bootinfo.h>
 #include <asm/cpu.h>
 #include <asm/cpu-features.h>
+#include <asm/elf.h>
 #include <asm/idle.h>
 #include <asm/mipsregs.h>
 #include <asm/processor.h>
@@ -32,6 +33,12 @@ int proc_cpuinfo_notifier_call_chain(unsigned long val, void *v)
 	return raw_notifier_call_chain(&proc_cpuinfo_chain, val, v);
 }
 
+static const char *const hwcap_str[] = {
+	"r6",
+	"msa",
+	NULL
+};
+
 static int show_cpuinfo(struct seq_file *m, void *v)
 {
 	struct proc_cpuinfo_notifier_args proc_cpuinfo_notifier_args;
@@ -122,7 +129,12 @@ static int show_cpuinfo(struct seq_file *m, void *v)
 	if (cpu_has_eva)	seq_printf(m, "%s", " eva");
 	if (cpu_has_htw)	seq_printf(m, "%s", " htw");
 	if (cpu_has_xpa)	seq_printf(m, "%s", " xpa");
-	seq_printf(m, "\n");
+
+	seq_puts(m, "\nfeatures\t\t: ");
+	for (i = 0; hwcap_str[i]; i++)
+		if (elf_hwcap & (1 << i))
+			seq_printf(m, "%s ", hwcap_str[i]);
+	seq_puts(m, "\n");
 
 	if (cpu_has_mmips) {
 		seq_printf(m, "micromips kernel\t: %s\n",
-- 
2.7.4





[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux