diff options
author | Glenn Elliott <gelliott@cs.unc.edu> | 2012-03-04 19:47:13 -0500 |
---|---|---|
committer | Glenn Elliott <gelliott@cs.unc.edu> | 2012-03-04 19:47:13 -0500 |
commit | c71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch) | |
tree | ecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /arch/tile/kernel/time.c | |
parent | ea53c912f8a86a8567697115b6a0d8152beee5c8 (diff) | |
parent | 6a00f206debf8a5c8899055726ad127dbeeed098 (diff) |
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts:
litmus/sched_cedf.c
Diffstat (limited to 'arch/tile/kernel/time.c')
-rw-r--r-- | arch/tile/kernel/time.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/arch/tile/kernel/time.c b/arch/tile/kernel/time.c index 6bed820e1421..c4be58cc5d50 100644 --- a/arch/tile/kernel/time.c +++ b/arch/tile/kernel/time.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/sched.h> | 22 | #include <linux/sched.h> |
23 | #include <linux/smp.h> | 23 | #include <linux/smp.h> |
24 | #include <linux/delay.h> | 24 | #include <linux/delay.h> |
25 | #include <linux/module.h> | ||
25 | #include <asm/irq_regs.h> | 26 | #include <asm/irq_regs.h> |
26 | #include <asm/traps.h> | 27 | #include <asm/traps.h> |
27 | #include <hv/hypervisor.h> | 28 | #include <hv/hypervisor.h> |
@@ -56,6 +57,7 @@ cycles_t get_cycles(void) | |||
56 | 57 | ||
57 | return (((cycles_t)high) << 32) | low; | 58 | return (((cycles_t)high) << 32) | low; |
58 | } | 59 | } |
60 | EXPORT_SYMBOL(get_cycles); | ||
59 | #endif | 61 | #endif |
60 | 62 | ||
61 | /* | 63 | /* |
@@ -132,7 +134,7 @@ static int tile_timer_set_next_event(unsigned long ticks, | |||
132 | { | 134 | { |
133 | BUG_ON(ticks > MAX_TICK); | 135 | BUG_ON(ticks > MAX_TICK); |
134 | __insn_mtspr(SPR_TILE_TIMER_CONTROL, ticks); | 136 | __insn_mtspr(SPR_TILE_TIMER_CONTROL, ticks); |
135 | raw_local_irq_unmask_now(INT_TILE_TIMER); | 137 | arch_local_irq_unmask_now(INT_TILE_TIMER); |
136 | return 0; | 138 | return 0; |
137 | } | 139 | } |
138 | 140 | ||
@@ -143,7 +145,7 @@ static int tile_timer_set_next_event(unsigned long ticks, | |||
143 | static void tile_timer_set_mode(enum clock_event_mode mode, | 145 | static void tile_timer_set_mode(enum clock_event_mode mode, |
144 | struct clock_event_device *evt) | 146 | struct clock_event_device *evt) |
145 | { | 147 | { |
146 | raw_local_irq_mask_now(INT_TILE_TIMER); | 148 | arch_local_irq_mask_now(INT_TILE_TIMER); |
147 | } | 149 | } |
148 | 150 | ||
149 | /* | 151 | /* |
@@ -172,7 +174,7 @@ void __cpuinit setup_tile_timer(void) | |||
172 | evt->cpumask = cpumask_of(smp_processor_id()); | 174 | evt->cpumask = cpumask_of(smp_processor_id()); |
173 | 175 | ||
174 | /* Start out with timer not firing. */ | 176 | /* Start out with timer not firing. */ |
175 | raw_local_irq_mask_now(INT_TILE_TIMER); | 177 | arch_local_irq_mask_now(INT_TILE_TIMER); |
176 | 178 | ||
177 | /* Register tile timer. */ | 179 | /* Register tile timer. */ |
178 | clockevents_register_device(evt); | 180 | clockevents_register_device(evt); |
@@ -188,7 +190,7 @@ void do_timer_interrupt(struct pt_regs *regs, int fault_num) | |||
188 | * Mask the timer interrupt here, since we are a oneshot timer | 190 | * Mask the timer interrupt here, since we are a oneshot timer |
189 | * and there are now by definition no events pending. | 191 | * and there are now by definition no events pending. |
190 | */ | 192 | */ |
191 | raw_local_irq_mask(INT_TILE_TIMER); | 193 | arch_local_irq_mask(INT_TILE_TIMER); |
192 | 194 | ||
193 | /* Track time spent here in an interrupt context */ | 195 | /* Track time spent here in an interrupt context */ |
194 | irq_enter(); | 196 | irq_enter(); |
@@ -224,3 +226,13 @@ int setup_profiling_timer(unsigned int multiplier) | |||
224 | { | 226 | { |
225 | return -EINVAL; | 227 | return -EINVAL; |
226 | } | 228 | } |
229 | |||
230 | /* | ||
231 | * Use the tile timer to convert nsecs to core clock cycles, relying | ||
232 | * on it having the same frequency as SPR_CYCLE. | ||
233 | */ | ||
234 | cycles_t ns2cycles(unsigned long nsecs) | ||
235 | { | ||
236 | struct clock_event_device *dev = &__get_cpu_var(tile_timer); | ||
237 | return ((u64)nsecs * dev->mult) >> dev->shift; | ||
238 | } | ||