Commit 12fd3146 authored by Philippe Gerum's avatar Philippe Gerum Committed by Jan Kiszka

cobalt/sched, clock: pipeline: abstract IPI management

The I-pipe and Dovetail share the very same concept of out-of-band,
high-priority IPI, but using a different interface. Let's abstract the
calls manipulating those IPIs to make them pipeline-specific.

No functional change is introduced.
Signed-off-by: Philippe Gerum's avatarPhilippe Gerum <rpm@xenomai.org>
Signed-off-by: Jan Kiszka's avatarJan Kiszka <jan.kiszka@siemens.com>
parent 1dc8ee0c
Pipeline #5809 passed with stage
in 59 minutes and 50 seconds
......@@ -5,7 +5,13 @@
#ifndef _COBALT_KERNEL_IPIPE_PIPELINE_H
#define _COBALT_KERNEL_IPIPE_PIPELINE_H
#include <linux/ipipe.h>
#ifdef CONFIG_IPIPE_LEGACY
#error "CONFIG_IPIPE_LEGACY must be switched off"
#endif
#include <pipeline/machine.h>
#define PIPELINE_NR_IRQS IPIPE_NR_IRQS
typedef unsigned long spl_t;
......@@ -22,4 +28,46 @@ typedef unsigned long spl_t;
#define is_secondary_domain() ipipe_root_p
#define is_primary_domain() (!ipipe_root_p)
#ifdef CONFIG_SMP
static inline int pipeline_request_resched_ipi(void (*handler)(void))
{
return ipipe_request_irq(&cobalt_pipeline.domain,
IPIPE_RESCHEDULE_IPI,
(ipipe_irq_handler_t)handler,
NULL, NULL);
}
static inline void pipeline_free_resched_ipi(void)
{
ipipe_free_irq(&cobalt_pipeline.domain,
IPIPE_RESCHEDULE_IPI);
}
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))
{
return ipipe_request_irq(&cobalt_pipeline.domain,
IPIPE_HRTIMER_IPI,
(ipipe_irq_handler_t)handler,
NULL, NULL);
}
static inline void pipeline_free_timer_ipi(void)
{
return ipipe_free_irq(&cobalt_pipeline.domain,
IPIPE_HRTIMER_IPI);
}
static inline void pipeline_send_timer_ipi(const struct cpumask *dest)
{
ipipe_send_ipi(IPIPE_HRTIMER_IPI, *dest);
}
#endif
#endif /* !_COBALT_KERNEL_IPIPE_PIPELINE_H */
......@@ -228,7 +228,7 @@ void xnclock_core_local_shot(struct xnsched *sched)
#ifdef CONFIG_SMP
void xnclock_core_remote_shot(struct xnsched *sched)
{
ipipe_send_ipi(IPIPE_HRTIMER_IPI, *cpumask_of(xnsched_cpu(sched)));
pipeline_send_timer_ipi(cpumask_of(xnsched_cpu(sched)));
}
#endif
......
......@@ -20,10 +20,6 @@
#include <linux/xenomai/wrappers.h>
#ifdef CONFIG_IPIPE_LEGACY
#error "CONFIG_IPIPE_LEGACY must be switched off"
#endif
#define COBALT_BACKPORT(__sym) __cobalt_backport_ ##__sym
/*
......
......@@ -235,10 +235,7 @@ void xnsched_init_all(void)
}
#ifdef CONFIG_SMP
ipipe_request_irq(&xnsched_realtime_domain,
IPIPE_RESCHEDULE_IPI,
(ipipe_irq_handler_t)__xnsched_run_handler,
NULL, NULL);
pipeline_request_resched_ipi(__xnsched_run_handler);
#endif
}
......@@ -261,7 +258,7 @@ void xnsched_destroy_all(void)
spl_t s;
#ifdef CONFIG_SMP
ipipe_free_irq(&xnsched_realtime_domain, IPIPE_RESCHEDULE_IPI);
pipeline_free_resched_ipi();
#endif
xnlock_get_irqsave(&nklock, s);
......@@ -860,7 +857,7 @@ static inline int test_resched(struct xnsched *sched)
/* Send resched IPI to remote CPU(s). */
if (unlikely(!cpumask_empty(&sched->resched))) {
smp_mb();
ipipe_send_ipi(IPIPE_RESCHEDULE_IPI, sched->resched);
pipeline_send_resched_ipi(&sched->resched);
cpumask_clear(&sched->resched);
}
#endif
......@@ -1280,7 +1277,7 @@ static int vfile_schedstat_next(struct xnvfile_snapshot_iterator *it,
scan_irqs:
#ifdef CONFIG_XENO_OPT_STATS_IRQS
if (priv->irq >= IPIPE_NR_IRQS)
if (priv->irq >= PIPELINE_NR_IRQS)
return 0; /* All done. */
ret = xnintr_query_next(priv->irq, &priv->intr_it, p->name);
......
......@@ -578,15 +578,12 @@ EXPORT_SYMBOL_GPL(__xntimer_set_affinity);
int xntimer_setup_ipi(void)
{
return ipipe_request_irq(&xnsched_realtime_domain,
IPIPE_HRTIMER_IPI,
(ipipe_irq_handler_t)xnintr_core_clock_handler,
NULL, NULL);
return pipeline_request_timer_ipi(xnintr_core_clock_handler);
}
void xntimer_release_ipi(void)
{
ipipe_free_irq(&xnsched_realtime_domain, IPIPE_HRTIMER_IPI);
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