aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/math-emu/cp1emu.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/mips/math-emu/cp1emu.c')
-rw-r--r--arch/mips/math-emu/cp1emu.c57
1 files changed, 1 insertions, 56 deletions
diff --git a/arch/mips/math-emu/cp1emu.c b/arch/mips/math-emu/cp1emu.c
index 3ef9d99a729e..c4b855e7b0e0 100644
--- a/arch/mips/math-emu/cp1emu.c
+++ b/arch/mips/math-emu/cp1emu.c
@@ -35,6 +35,7 @@
35 */ 35 */
36#include <linux/sched.h> 36#include <linux/sched.h>
37#include <linux/debugfs.h> 37#include <linux/debugfs.h>
38#include <linux/percpu-defs.h>
38#include <linux/perf_event.h> 39#include <linux/perf_event.h>
39 40
40#include <asm/branch.h> 41#include <asm/branch.h>
@@ -66,12 +67,6 @@ static int fpux_emu(struct pt_regs *,
66 struct mips_fpu_struct *, mips_instruction, void *__user *); 67 struct mips_fpu_struct *, mips_instruction, void *__user *);
67#endif 68#endif
68 69
69/* Further private data for which no space exists in mips_fpu_struct */
70
71#ifdef CONFIG_DEBUG_FS
72DEFINE_PER_CPU(struct mips_fpu_emulator_stats, fpuemustats);
73#endif
74
75/* Control registers */ 70/* Control registers */
76 71
77#define FPCREG_RID 0 /* $0 = revision id */ 72#define FPCREG_RID 0 /* $0 = revision id */
@@ -2158,53 +2153,3 @@ int fpu_emulator_cop1Handler(struct pt_regs *xcp, struct mips_fpu_struct *ctx,
2158 2153
2159 return sig; 2154 return sig;
2160} 2155}
2161
2162#ifdef CONFIG_DEBUG_FS
2163
2164static int fpuemu_stat_get(void *data, u64 *val)
2165{
2166 int cpu;
2167 unsigned long sum = 0;
2168 for_each_online_cpu(cpu) {
2169 struct mips_fpu_emulator_stats *ps;
2170 local_t *pv;
2171 ps = &per_cpu(fpuemustats, cpu);
2172 pv = (void *)ps + (unsigned long)data;
2173 sum += local_read(pv);
2174 }
2175 *val = sum;
2176 return 0;
2177}
2178DEFINE_SIMPLE_ATTRIBUTE(fops_fpuemu_stat, fpuemu_stat_get, NULL, "%llu\n");
2179
2180extern struct dentry *mips_debugfs_dir;
2181static int __init debugfs_fpuemu(void)
2182{
2183 struct dentry *d, *dir;
2184
2185 if (!mips_debugfs_dir)
2186 return -ENODEV;
2187 dir = debugfs_create_dir("fpuemustats", mips_debugfs_dir);
2188 if (!dir)
2189 return -ENOMEM;
2190
2191#define FPU_STAT_CREATE(M) \
2192 do { \
2193 d = debugfs_create_file(#M , S_IRUGO, dir, \
2194 (void *)offsetof(struct mips_fpu_emulator_stats, M), \
2195 &fops_fpuemu_stat); \
2196 if (!d) \
2197 return -ENOMEM; \
2198 } while (0)
2199
2200 FPU_STAT_CREATE(emulated);
2201 FPU_STAT_CREATE(loads);
2202 FPU_STAT_CREATE(stores);
2203 FPU_STAT_CREATE(cp1ops);
2204 FPU_STAT_CREATE(cp1xops);
2205 FPU_STAT_CREATE(errors);
2206
2207 return 0;
2208}
2209__initcall(debugfs_fpuemu);
2210#endif