diff options
author | Deng-Cheng Zhu <dengcheng.zhu@imgtec.com> | 2015-03-07 13:30:28 -0500 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2015-04-01 11:21:28 -0400 |
commit | 7cb24b700349f4287f4104bb9f3266d7f383d4cc (patch) | |
tree | 4953a11b939572e90f8e702201244b6ac143739c | |
parent | 317adb12e5417167162bf7f8a3265c06ae9ef216 (diff) |
MIPS: csrc-ioasic: Implement read_sched_clock
Use DEC I/O ASIC's free-running counter for sched_clock source. This
implementation will give high resolution cputime accounting.
Acked-by: Maciej W. Rozycki <macro@linux-mips.org>
Signed-off-by: Deng-Cheng Zhu <dengcheng.zhu@imgtec.com>
Cc: linux-mips@linux-mips.org
Cc: macro@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/9482/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
-rw-r--r-- | arch/mips/kernel/csrc-ioasic.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/arch/mips/kernel/csrc-ioasic.c b/arch/mips/kernel/csrc-ioasic.c index 54e394df9f7a..722f5589cd1d 100644 --- a/arch/mips/kernel/csrc-ioasic.c +++ b/arch/mips/kernel/csrc-ioasic.c | |||
@@ -14,6 +14,7 @@ | |||
14 | * GNU General Public License for more details. | 14 | * GNU General Public License for more details. |
15 | */ | 15 | */ |
16 | #include <linux/clocksource.h> | 16 | #include <linux/clocksource.h> |
17 | #include <linux/sched_clock.h> | ||
17 | #include <linux/init.h> | 18 | #include <linux/init.h> |
18 | 19 | ||
19 | #include <asm/ds1287.h> | 20 | #include <asm/ds1287.h> |
@@ -33,6 +34,11 @@ static struct clocksource clocksource_dec = { | |||
33 | .flags = CLOCK_SOURCE_IS_CONTINUOUS, | 34 | .flags = CLOCK_SOURCE_IS_CONTINUOUS, |
34 | }; | 35 | }; |
35 | 36 | ||
37 | static u64 notrace dec_ioasic_read_sched_clock(void) | ||
38 | { | ||
39 | return ioasic_read(IO_REG_FCTR); | ||
40 | } | ||
41 | |||
36 | int __init dec_ioasic_clocksource_init(void) | 42 | int __init dec_ioasic_clocksource_init(void) |
37 | { | 43 | { |
38 | unsigned int freq; | 44 | unsigned int freq; |
@@ -61,5 +67,8 @@ int __init dec_ioasic_clocksource_init(void) | |||
61 | 67 | ||
62 | clocksource_dec.rating = 200 + freq / 10000000; | 68 | clocksource_dec.rating = 200 + freq / 10000000; |
63 | clocksource_register_hz(&clocksource_dec, freq); | 69 | clocksource_register_hz(&clocksource_dec, freq); |
70 | |||
71 | sched_clock_register(dec_ioasic_read_sched_clock, 32, freq); | ||
72 | |||
64 | return 0; | 73 | return 0; |
65 | } | 74 | } |