Commit | Line | Data |
---|---|---|
41c594ab RB |
1 | /* |
2 | * /proc hooks for SMTC kernel | |
3 | * Copyright (C) 2005 Mips Technologies, Inc | |
4 | */ | |
5 | ||
6 | #include <linux/kernel.h> | |
7 | #include <linux/sched.h> | |
8 | #include <linux/cpumask.h> | |
9 | #include <linux/interrupt.h> | |
10 | ||
11 | #include <asm/cpu.h> | |
12 | #include <asm/processor.h> | |
13 | #include <asm/atomic.h> | |
14 | #include <asm/system.h> | |
15 | #include <asm/hardirq.h> | |
16 | #include <asm/mmu_context.h> | |
41c594ab RB |
17 | #include <asm/mipsregs.h> |
18 | #include <asm/cacheflush.h> | |
19 | #include <linux/proc_fs.h> | |
20 | ||
21 | #include <asm/smtc_proc.h> | |
22 | ||
23 | /* | |
24 | * /proc diagnostic and statistics hooks | |
25 | */ | |
26 | ||
27 | /* | |
28 | * Statistics gathered | |
29 | */ | |
30 | unsigned long selfipis[NR_CPUS]; | |
31 | ||
32 | struct smtc_cpu_proc smtc_cpu_stats[NR_CPUS]; | |
33 | ||
34 | static struct proc_dir_entry *smtc_stats; | |
35 | ||
36 | atomic_t smtc_fpu_recoveries; | |
37 | ||
38 | static int proc_read_smtc(char *page, char **start, off_t off, | |
39 | int count, int *eof, void *data) | |
40 | { | |
41 | int totalen = 0; | |
42 | int len; | |
43 | int i; | |
44 | extern unsigned long ebase; | |
45 | ||
46 | len = sprintf(page, "SMTC Status Word: 0x%08x\n", smtc_status); | |
47 | totalen += len; | |
48 | page += len; | |
49 | len = sprintf(page, "Config7: 0x%08x\n", read_c0_config7()); | |
50 | totalen += len; | |
51 | page += len; | |
52 | len = sprintf(page, "EBASE: 0x%08lx\n", ebase); | |
53 | totalen += len; | |
54 | page += len; | |
55 | len = sprintf(page, "Counter Interrupts taken per CPU (TC)\n"); | |
56 | totalen += len; | |
57 | page += len; | |
58 | for (i=0; i < NR_CPUS; i++) { | |
59 | len = sprintf(page, "%d: %ld\n", i, smtc_cpu_stats[i].timerints); | |
60 | totalen += len; | |
61 | page += len; | |
62 | } | |
63 | len = sprintf(page, "Self-IPIs by CPU:\n"); | |
64 | totalen += len; | |
65 | page += len; | |
66 | for(i = 0; i < NR_CPUS; i++) { | |
67 | len = sprintf(page, "%d: %ld\n", i, smtc_cpu_stats[i].selfipis); | |
68 | totalen += len; | |
69 | page += len; | |
70 | } | |
71 | len = sprintf(page, "%d Recoveries of \"stolen\" FPU\n", | |
72 | atomic_read(&smtc_fpu_recoveries)); | |
73 | totalen += len; | |
74 | page += len; | |
75 | ||
76 | return totalen; | |
77 | } | |
78 | ||
79 | void init_smtc_stats(void) | |
80 | { | |
81 | int i; | |
82 | ||
83 | for (i=0; i<NR_CPUS; i++) { | |
84 | smtc_cpu_stats[i].timerints = 0; | |
85 | smtc_cpu_stats[i].selfipis = 0; | |
86 | } | |
87 | ||
88 | atomic_set(&smtc_fpu_recoveries, 0); | |
89 | ||
90 | smtc_stats = create_proc_read_entry("smtc", 0444, NULL, | |
91 | proc_read_smtc, NULL); | |
92 | } |