MIPS: Probe for presence of KScratch registers.
authorDavid Daney <ddaney@caviumnetworks.com>
Tue, 21 Dec 2010 22:19:09 +0000 (14:19 -0800)
committerRalf Baechle <ralf@linux-mips.org>
Tue, 18 Jan 2011 18:30:22 +0000 (19:30 +0100)
Probe c0_config4 for KScratch registers and report them in /proc/cpuinfo.

Signed-off-by: David Daney <ddaney@caviumnetworks.com>
To: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/1877/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
arch/mips/include/asm/cpu-info.h
arch/mips/kernel/cpu-probe.c
arch/mips/kernel/proc.c

index b39def3f6e03bdd950544b05cd4f765fbeb2b2e2..c454550eb0c07195874926969578c1367a6bd19b 100644 (file)
@@ -78,6 +78,7 @@ struct cpuinfo_mips {
        unsigned int            watch_reg_use_cnt; /* Usable by ptrace */
 #define NUM_WATCH_REGS 4
        u16                     watch_reg_masks[NUM_WATCH_REGS];
+       unsigned int            kscratch_mask; /* Usable KScratch mask. */
 } __attribute__((aligned(SMP_CACHE_BYTES)));
 
 extern struct cpuinfo_mips cpu_data[];
index 68dae7b6b5db62a0a48a17e6fe339a2d56bd8bd8..f65d4c8c65a6a19ec4be040091861444a8ea78a3 100644 (file)
@@ -739,6 +739,8 @@ static inline unsigned int decode_config4(struct cpuinfo_mips *c)
            && cpu_has_tlb)
                c->tlbsize += (config4 & MIPS_CONF4_MMUSIZEEXT) * 0x40;
 
+       c->kscratch_mask = (config4 >> 16) & 0xff;
+
        return config4 & MIPS_CONF_M;
 }
 
index 4195abb55e5901b1f9eb2912d571817e23b21a5f..e309665b6c81962a82cb247b76f7b0312b0ba172 100644 (file)
@@ -74,6 +74,8 @@ static int show_cpuinfo(struct seq_file *m, void *v)
                );
        seq_printf(m, "shadow register sets\t: %d\n",
                       cpu_data[n].srsets);
+       seq_printf(m, "kscratch registers\t: %d\n",
+                  hweight8(cpu_data[n].kscratch_mask));
        seq_printf(m, "core\t\t\t: %d\n", cpu_data[n].core);
 
        sprintf(fmt, "VCE%%c exceptions\t\t: %s\n",