diff options
author | Tkhai Kirill <tkhai@yandex.ru> | 2012-04-04 15:49:26 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-04-15 13:28:50 -0400 |
commit | 62f082830d63cf753ed0dab16f8d3b2d0ffc7f43 (patch) | |
tree | 39770d13d3dbff835eb3500c6a913da5c784fec3 /arch/sparc/kernel/sun4m_smp.c | |
parent | 472bc4f2ad164a5aac2e85d891c4faecfc5d62c4 (diff) |
sparc32: generic clockevent support
The kernel uses l14 timers as clockevents. l10 timer is used
as clocksource if platform master_l10_counter isn't constantly
zero. The clocksource is continuous, so it's possible to use
high resolution timers. l10 timer is also used as clockevent
on UP configurations.
This realization is for sun4m, sun4d, sun4c, microsparc-IIep
and LEON platforms. The appropriate LEON changes was made by
Konrad Eisele.
In case of sun4m's oneshot mode, profile irq is zeroed in
smp4m_percpu_timer_interrupt(). It is maybe
needless (double, triple etc overflow does nothing).
sun4d is able to have oneshot mode too, but I haven't
any way to test it. So code of its percpu timer handler
is made as much equal to the current code as possible.
The patch is tested on sun4m box in SMP mode by me,
and tested by Konrad on leon in up mode (leon smp
is broken atm - due to other reasons).
Signed-off-by: Tkhai Kirill <tkhai@yandex.ru>
Tested-by: Konrad Eisele <konrad@gaisler.com> [leon up]
[sam: revised patch to provide generic support for leon]
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc/kernel/sun4m_smp.c')
-rw-r--r-- | arch/sparc/kernel/sun4m_smp.c | 38 |
1 files changed, 13 insertions, 25 deletions
diff --git a/arch/sparc/kernel/sun4m_smp.c b/arch/sparc/kernel/sun4m_smp.c index 02db9a0412ce..29f8ace10b59 100644 --- a/arch/sparc/kernel/sun4m_smp.c +++ b/arch/sparc/kernel/sun4m_smp.c | |||
@@ -4,6 +4,7 @@ | |||
4 | * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu) | 4 | * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu) |
5 | */ | 5 | */ |
6 | 6 | ||
7 | #include <linux/clockchips.h> | ||
7 | #include <linux/interrupt.h> | 8 | #include <linux/interrupt.h> |
8 | #include <linux/profile.h> | 9 | #include <linux/profile.h> |
9 | #include <linux/delay.h> | 10 | #include <linux/delay.h> |
@@ -12,6 +13,7 @@ | |||
12 | #include <asm/cacheflush.h> | 13 | #include <asm/cacheflush.h> |
13 | #include <asm/switch_to.h> | 14 | #include <asm/switch_to.h> |
14 | #include <asm/tlbflush.h> | 15 | #include <asm/tlbflush.h> |
16 | #include <asm/timer.h> | ||
15 | 17 | ||
16 | #include "irq.h" | 18 | #include "irq.h" |
17 | #include "kernel.h" | 19 | #include "kernel.h" |
@@ -31,7 +33,6 @@ swap_ulong(volatile unsigned long *ptr, unsigned long val) | |||
31 | } | 33 | } |
32 | 34 | ||
33 | static void smp4m_ipi_init(void); | 35 | static void smp4m_ipi_init(void); |
34 | static void smp_setup_percpu_timer(void); | ||
35 | 36 | ||
36 | void __cpuinit smp4m_callin(void) | 37 | void __cpuinit smp4m_callin(void) |
37 | { | 38 | { |
@@ -42,8 +43,7 @@ void __cpuinit smp4m_callin(void) | |||
42 | 43 | ||
43 | notify_cpu_starting(cpuid); | 44 | notify_cpu_starting(cpuid); |
44 | 45 | ||
45 | /* Get our local ticker going. */ | 46 | register_percpu_ce(cpuid); |
46 | smp_setup_percpu_timer(); | ||
47 | 47 | ||
48 | calibrate_delay(); | 48 | calibrate_delay(); |
49 | smp_store_cpu_info(cpuid); | 49 | smp_store_cpu_info(cpuid); |
@@ -87,7 +87,7 @@ void __cpuinit smp4m_callin(void) | |||
87 | void __init smp4m_boot_cpus(void) | 87 | void __init smp4m_boot_cpus(void) |
88 | { | 88 | { |
89 | smp4m_ipi_init(); | 89 | smp4m_ipi_init(); |
90 | smp_setup_percpu_timer(); | 90 | sun4m_unmask_profile_irq(); |
91 | local_flush_cache_all(); | 91 | local_flush_cache_all(); |
92 | } | 92 | } |
93 | 93 | ||
@@ -260,37 +260,25 @@ void smp4m_cross_call_irq(void) | |||
260 | void smp4m_percpu_timer_interrupt(struct pt_regs *regs) | 260 | void smp4m_percpu_timer_interrupt(struct pt_regs *regs) |
261 | { | 261 | { |
262 | struct pt_regs *old_regs; | 262 | struct pt_regs *old_regs; |
263 | struct clock_event_device *ce; | ||
263 | int cpu = smp_processor_id(); | 264 | int cpu = smp_processor_id(); |
264 | 265 | ||
265 | old_regs = set_irq_regs(regs); | 266 | old_regs = set_irq_regs(regs); |
266 | 267 | ||
267 | sun4m_clear_profile_irq(cpu); | 268 | ce = &per_cpu(sparc32_clockevent, cpu); |
268 | 269 | ||
269 | profile_tick(CPU_PROFILING); | 270 | if (ce->mode & CLOCK_EVT_MODE_PERIODIC) |
271 | sun4m_clear_profile_irq(cpu); | ||
272 | else | ||
273 | load_profile_irq(cpu, 0); /* Is this needless? */ | ||
270 | 274 | ||
271 | if (!--prof_counter(cpu)) { | 275 | irq_enter(); |
272 | int user = user_mode(regs); | 276 | ce->event_handler(ce); |
277 | irq_exit(); | ||
273 | 278 | ||
274 | irq_enter(); | ||
275 | update_process_times(user); | ||
276 | irq_exit(); | ||
277 | |||
278 | prof_counter(cpu) = prof_multiplier(cpu); | ||
279 | } | ||
280 | set_irq_regs(old_regs); | 279 | set_irq_regs(old_regs); |
281 | } | 280 | } |
282 | 281 | ||
283 | static void __cpuinit smp_setup_percpu_timer(void) | ||
284 | { | ||
285 | int cpu = smp_processor_id(); | ||
286 | |||
287 | prof_counter(cpu) = prof_multiplier(cpu) = 1; | ||
288 | load_profile_irq(cpu, lvl14_resolution); | ||
289 | |||
290 | if (cpu == boot_cpu_id) | ||
291 | sun4m_unmask_profile_irq(); | ||
292 | } | ||
293 | |||
294 | static void __init smp4m_blackbox_id(unsigned *addr) | 282 | static void __init smp4m_blackbox_id(unsigned *addr) |
295 | { | 283 | { |
296 | int rd = *addr & 0x3e000000; | 284 | int rd = *addr & 0x3e000000; |