Commit 0f9ce985 authored by Philippe Gerum's avatar Philippe Gerum Committed by Jan Kiszka

cobalt/tick: use the underlying pipeline timer API directly

Since the low-level tick management code is pipeline specific, we may
flatten the call stack by using the underlying pipeline API directly.

At this chance, fix a uniprocessor build issue with IPIs.
Signed-off-by: Philippe Gerum's avatarPhilippe Gerum <rpm@xenomai.org>
[Jan: fix non-SMP build issues on ppc32]
Signed-off-by: Jan Kiszka's avatarJan Kiszka <jan.kiszka@siemens.com>

smp fixup
parent 7857a1b1
......@@ -74,7 +74,28 @@ static inline void pipeline_send_timer_ipi(const struct cpumask *dest)
TODO();
}
#endif
#else /* !CONFIG_SMP */
static inline int pipeline_request_resched_ipi(void (*handler)(void))
{
return 0;
}
static inline void pipeline_free_resched_ipi(void)
{
}
static inline int pipeline_request_timer_ipi(void (*handler)(void))
{
return 0;
}
static inline void pipeline_free_timer_ipi(void)
{
}
#endif /* CONFIG_SMP */
static inline void pipeline_prepare_panic(void)
{
......
......@@ -51,26 +51,24 @@ static inline void pipeline_send_resched_ipi(const struct cpumask *dest)
ipipe_send_ipi(IPIPE_RESCHEDULE_IPI, *dest);
}
static inline int pipeline_request_timer_ipi(void (*handler)(void))
static inline void pipeline_send_timer_ipi(const struct cpumask *dest)
{
return ipipe_request_irq(&cobalt_pipeline.domain,
IPIPE_HRTIMER_IPI,
(ipipe_irq_handler_t)handler,
NULL, NULL);
ipipe_send_ipi(IPIPE_HRTIMER_IPI, *dest);
}
static inline void pipeline_free_timer_ipi(void)
#else /* !CONFIG_SMP */
static inline int pipeline_request_resched_ipi(void (*handler)(void))
{
return ipipe_free_irq(&cobalt_pipeline.domain,
IPIPE_HRTIMER_IPI);
return 0;
}
static inline void pipeline_send_timer_ipi(const struct cpumask *dest)
static inline void pipeline_free_resched_ipi(void)
{
ipipe_send_ipi(IPIPE_HRTIMER_IPI, *dest);
}
#endif
#endif /* CONFIG_SMP */
static inline void pipeline_prepare_panic(void)
{
......
......@@ -517,10 +517,6 @@ void xntimer_migrate(struct xntimer *timer, struct xnsched *sched)
__xntimer_migrate(timer, sched);
}
int xntimer_setup_ipi(void);
void xntimer_release_ipi(void);
void __xntimer_set_affinity(struct xntimer *timer,
struct xnsched *sched);
......@@ -539,13 +535,6 @@ static inline void xntimer_migrate(struct xntimer *timer,
timer->sched = sched;
}
static inline int xntimer_setup_ipi(void)
{
return 0;
}
static inline void xntimer_release_ipi(void) { }
static inline void xntimer_set_affinity(struct xntimer *timer,
struct xnsched *sched)
{
......
......@@ -187,9 +187,14 @@ int pipeline_install_tick_proxy(void)
nkclock.wallclock_offset =
ktime_to_ns(ktime_get_real()) - xnclock_read_monotonic(&nkclock);
ret = xntimer_setup_ipi();
#ifdef CONFIG_SMP
ret = ipipe_request_irq(&cobalt_pipeline.domain,
IPIPE_HRTIMER_IPI,
(ipipe_irq_handler_t)xnintr_core_clock_handler,
NULL, NULL);
if (ret)
return ret;
#endif
for_each_realtime_cpu(cpu) {
ret = grab_timer_on_cpu(cpu);
......@@ -244,7 +249,10 @@ fail:
ipipe_timer_stop(_cpu);
}
xntimer_release_ipi();
#ifdef CONFIG_SMP
ipipe_free_irq(&cobalt_pipeline.domain,
IPIPE_HRTIMER_IPI);
#endif
return ret;
}
......@@ -270,7 +278,10 @@ void pipeline_uninstall_tick_proxy(void)
for_each_realtime_cpu(cpu)
ipipe_timer_stop(cpu);
xntimer_release_ipi();
#ifdef CONFIG_SMP
ipipe_free_irq(&cobalt_pipeline.domain,
IPIPE_HRTIMER_IPI);
#endif
#ifdef CONFIG_XENO_OPT_STATS_IRQS
xnintr_destroy(&nktimer);
......
......@@ -235,9 +235,7 @@ void xnsched_init_all(void)
xnsched_init(sched, cpu);
}
#ifdef CONFIG_SMP
pipeline_request_resched_ipi(__xnsched_run_handler);
#endif
}
static void xnsched_destroy(struct xnsched *sched)
......@@ -258,9 +256,7 @@ void xnsched_destroy_all(void)
int cpu;
spl_t s;
#ifdef CONFIG_SMP
pipeline_free_resched_ipi();
#endif
xnlock_get_irqsave(&nklock, s);
......
......@@ -574,16 +574,6 @@ void __xntimer_set_affinity(struct xntimer *timer, struct xnsched *sched)
}
EXPORT_SYMBOL_GPL(__xntimer_set_affinity);
int xntimer_setup_ipi(void)
{
return pipeline_request_timer_ipi(xnintr_core_clock_handler);
}
void xntimer_release_ipi(void)
{
pipeline_free_timer_ipi();
}
#endif /* CONFIG_SMP */
/**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment