All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 01/13] cobalt/kernel: pipeline: abstract context switching support
@ 2021-01-31 14:45 Philippe Gerum
  2021-01-31 14:45 ` [PATCH 02/13] cobalt/thread: pipeline: abstract synchronous single-stepping code Philippe Gerum
                   ` (11 more replies)
  0 siblings, 12 replies; 18+ messages in thread
From: Philippe Gerum @ 2021-01-31 14:45 UTC (permalink / raw)
  To: xenomai

From: Philippe Gerum <rpm@xenomai.org>

Implement an abstract API for the low-level context switching code,
moving the legacy open coded support to the I-pipe specific section
(e.g. fpu management, register file switching, root context tracking).
Dovetail provides built-in support for all these nitty-gritty details,
which we may tap into for the same purpose instead.

The changes have been introduced in a way which properly maps to the
Dovetail interface, while remaining compatible with the interface to
the legacy code.

No functional change is introduced.

Signed-off-by: Philippe Gerum <rpm@xenomai.org>
---
 include/cobalt/kernel/ipipe/pipeline/sched.h |  38 ++++
 include/cobalt/kernel/sched.h                |   3 +-
 include/cobalt/kernel/thread.h               |   4 -
 kernel/cobalt/ipipe/Makefile                 |   2 +-
 kernel/cobalt/ipipe/sched.c                  | 178 +++++++++++++++++++
 kernel/cobalt/posix/process.c                |   3 +-
 kernel/cobalt/sched.c                        |  70 ++------
 kernel/cobalt/thread.c                       |  91 ++--------
 8 files changed, 248 insertions(+), 141 deletions(-)
 create mode 100644 include/cobalt/kernel/ipipe/pipeline/sched.h
 create mode 100644 kernel/cobalt/ipipe/sched.c

diff --git a/include/cobalt/kernel/ipipe/pipeline/sched.h b/include/cobalt/kernel/ipipe/pipeline/sched.h
new file mode 100644
index 000000000..692ee6228
--- /dev/null
+++ b/include/cobalt/kernel/ipipe/pipeline/sched.h
@@ -0,0 +1,38 @@
+/*
+ * SPDX-License-Identifier: GPL-2.0
+ *
+ * Copyright (C) 2020 Philippe Gerum  <rpm@xenomai.org>
+ */
+
+#ifndef _COBALT_KERNEL_IPIPE_SCHED_H
+#define _COBALT_KERNEL_IPIPE_SCHED_H
+
+struct xnthread;
+struct xnsched;
+struct task_struct;
+
+void pipeline_init_shadow_tcb(struct xnthread *thread);
+
+void pipeline_init_root_tcb(struct xnthread *thread);
+
+int pipeline_schedule(struct xnsched *sched);
+
+void pipeline_prep_switch_oob(struct xnthread *root);
+
+bool pipeline_switch_to(struct xnthread *prev,
+			struct xnthread *next,
+			bool leaving_inband);
+
+int pipeline_leave_inband(void);
+
+void pipeline_leave_oob_prepare(void);
+
+void pipeline_leave_oob_finish(void);
+
+void pipeline_finalize_thread(struct xnthread *thread);
+
+void pipeline_raise_mayday(struct task_struct *tsk);
+
+void pipeline_clear_mayday(void);
+
+#endif /* !_COBALT_KERNEL_IPIPE_SCHED_H */
diff --git a/include/cobalt/kernel/sched.h b/include/cobalt/kernel/sched.h
index ad815b595..c13f46ff7 100644
--- a/include/cobalt/kernel/sched.h
+++ b/include/cobalt/kernel/sched.h
@@ -30,6 +30,7 @@
 #include <cobalt/kernel/vfile.h>
 #include <cobalt/kernel/assert.h>
 #include <asm/xenomai/machine.h>
+#include <pipeline/sched.h>
 
 /**
  * @addtogroup cobalt_core_sched
@@ -300,7 +301,7 @@ static inline int __xnsched_run(struct xnsched *sched)
 	     (XNINIRQ|XNINSW|XNRESCHED)) != XNRESCHED)
 		return 0;
 
-	return ___xnsched_run(sched);
+	return pipeline_schedule(sched);
 }
 
 static inline int xnsched_run(void)
diff --git a/include/cobalt/kernel/thread.h b/include/cobalt/kernel/thread.h
index 2d57b8398..fe7390088 100644
--- a/include/cobalt/kernel/thread.h
+++ b/include/cobalt/kernel/thread.h
@@ -427,10 +427,6 @@ void xnthread_switch_fpu(struct xnsched *sched);
 static inline void xnthread_switch_fpu(struct xnsched *sched) { }
 #endif /* CONFIG_XENO_ARCH_FPU */
 
-void xnthread_init_shadow_tcb(struct xnthread *thread);
-
-void xnthread_init_root_tcb(struct xnthread *thread);
-
 void xnthread_deregister(struct xnthread *thread);
 
 char *xnthread_format_status(unsigned long status,
diff --git a/kernel/cobalt/ipipe/Makefile b/kernel/cobalt/ipipe/Makefile
index 1daa84440..eae6a4a7c 100644
--- a/kernel/cobalt/ipipe/Makefile
+++ b/kernel/cobalt/ipipe/Makefile
@@ -2,4 +2,4 @@ ccflags-y += -I$(srctree)/kernel
 
 obj-y +=	pipeline.o
 
-pipeline-y :=	init.o intr.o kevents.o tick.o syscall.o
+pipeline-y :=	init.o intr.o kevents.o tick.o syscall.o sched.o
diff --git a/kernel/cobalt/ipipe/sched.c b/kernel/cobalt/ipipe/sched.c
new file mode 100644
index 000000000..4850b229d
--- /dev/null
+++ b/kernel/cobalt/ipipe/sched.c
@@ -0,0 +1,178 @@
+/*
+ * SPDX-License-Identifier: GPL-2.0
+ *
+ * Copyright (C) 2001-2020 Philippe Gerum <rpm@xenomai.org>.
+ */
+
+#include <cobalt/kernel/thread.h>
+#include <cobalt/kernel/sched.h>
+#include <cobalt/kernel/assert.h>
+#include <pipeline/sched.h>
+#include <trace/events/cobalt-core.h>
+
+int pipeline_schedule(struct xnsched *sched)
+{
+	int ret = 0;
+
+	XENO_WARN_ON_ONCE(COBALT,
+		!hard_irqs_disabled() && is_secondary_domain());
+
+	if (!xnarch_escalate())
+		ret = ___xnsched_run(sched);
+
+	return ret;
+}
+EXPORT_SYMBOL_GPL(pipeline_schedule);
+
+void pipeline_prep_switch_oob(struct xnthread *root)
+{
+	struct xnarchtcb *rootcb = xnthread_archtcb(root);
+	struct task_struct *p = current;
+
+	ipipe_notify_root_preemption();
+	/* Remember the preempted Linux task pointer. */
+	rootcb->core.host_task = p;
+	rootcb->core.tsp = &p->thread;
+	rootcb->core.mm = rootcb->core.active_mm = ipipe_get_active_mm();
+	rootcb->core.tip = task_thread_info(p);
+	xnarch_leave_root(root);
+}
+
+#ifdef CONFIG_XENO_ARCH_FPU
+
+static void switch_fpu(void)
+{
+	struct xnsched *sched = xnsched_current();
+	struct xnthread *curr = sched->curr;
+
+	if (!xnthread_test_state(curr, XNFPU))
+		return;
+
+	xnarch_switch_fpu(sched->fpuholder, curr);
+	sched->fpuholder = curr;
+}
+
+void giveup_fpu(struct xnthread *thread)
+{
+	struct xnsched *sched = thread->sched;
+
+	if (thread == sched->fpuholder)
+		sched->fpuholder = NULL;
+}
+
+#else
+
+static inline void giveup_fpu(struct xnthread *thread)
+{ }
+
+#endif /* !CONFIG_XENO_ARCH_FPU */
+
+bool pipeline_switch_to(struct xnthread *prev, struct xnthread *next,
+			bool leaving_inband)
+{
+	xnarch_switch_to(prev, next);
+
+	/*
+	 * Test whether we transitioned from primary mode to secondary
+	 * over a shadow thread, caused by a call to xnthread_relax().
+	 * In such a case, we are running over the regular schedule()
+	 * tail code, so we have to tell the caller to skip the Cobalt
+	 * tail code.
+	 */
+	if (!leaving_inband && is_secondary_domain()) {
+		__ipipe_complete_domain_migration();
+		XENO_BUG_ON(COBALT, xnthread_current() == NULL);
+		/*
+		 * Interrupts must be disabled here (has to be done on
+		 * entry of the Linux [__]switch_to function), but it
+		 * is what callers expect, specifically the reschedule
+		 * of an IRQ handler that hit before we call
+		 * xnsched_run in xnthread_suspend() when relaxing a
+		 * thread.
+		 */
+		XENO_BUG_ON(COBALT, !hard_irqs_disabled());
+		return true;
+	}
+
+	switch_fpu();
+
+	return false;
+}
+
+void pipeline_init_shadow_tcb(struct xnthread *thread)
+{
+	struct xnarchtcb *tcb = xnthread_archtcb(thread);
+	struct task_struct *p = current;
+
+	/*
+	 * If the current task is a kthread, the pipeline will take
+	 * the necessary steps to make the FPU usable in such
+	 * context. The kernel already took care of this issue for
+	 * userland tasks (e.g. setting up a clean backup area).
+	 */
+	__ipipe_share_current(0);
+
+	tcb->core.host_task = p;
+	tcb->core.tsp = &p->thread;
+	tcb->core.mm = p->mm;
+	tcb->core.active_mm = p->mm;
+	tcb->core.tip = task_thread_info(p);
+#ifdef CONFIG_XENO_ARCH_FPU
+	tcb->core.user_fpu_owner = p;
+#endif /* CONFIG_XENO_ARCH_FPU */
+	xnarch_init_shadow_tcb(thread);
+
+	trace_cobalt_shadow_map(thread);
+}
+
+void pipeline_init_root_tcb(struct xnthread *thread)
+{
+	struct xnarchtcb *tcb = xnthread_archtcb(thread);
+	struct task_struct *p = current;
+
+	tcb->core.host_task = p;
+	tcb->core.tsp = &tcb->core.ts;
+	tcb->core.mm = p->mm;
+	tcb->core.tip = NULL;
+	xnarch_init_root_tcb(thread);
+}
+
+int pipeline_leave_inband(void)
+{
+	int ret;
+
+	ret = __ipipe_migrate_head();
+	if (ret)
+		return ret;
+
+	switch_fpu();
+
+	return 0;
+}
+
+void pipeline_leave_oob_prepare(void)
+{
+	struct task_struct *p = current;
+
+	set_current_state(p->state & ~TASK_NOWAKEUP);
+}
+
+void pipeline_leave_oob_finish(void)
+{
+	__ipipe_reenter_root();
+}
+
+void pipeline_finalize_thread(struct xnthread *thread)
+{
+	giveup_fpu(thread);
+}
+
+void pipeline_raise_mayday(struct task_struct *tsk)
+{
+	ipipe_raise_mayday(tsk);
+}
+
+void pipeline_clear_mayday(void) /* May solely affect current. */
+{
+	ipipe_clear_thread_flag(TIP_MAYDAY);
+}
diff --git a/kernel/cobalt/posix/process.c b/kernel/cobalt/posix/process.c
index 5926eb49e..945a52a35 100644
--- a/kernel/cobalt/posix/process.c
+++ b/kernel/cobalt/posix/process.c
@@ -47,6 +47,7 @@
 #include <cobalt/kernel/thread.h>
 #include <cobalt/uapi/signal.h>
 #include <cobalt/uapi/syscall.h>
+#include <pipeline/sched.h>
 #include <trace/events/cobalt-core.h>
 #include <rtdm/driver.h>
 #include <asm/xenomai/features.h>
@@ -624,7 +625,7 @@ int cobalt_map_user(struct xnthread *thread, __u32 __user *u_winoff)
 	 * positive in debug code from handle_schedule_event() and
 	 * friends.
 	 */
-	xnthread_init_shadow_tcb(thread);
+	pipeline_init_shadow_tcb(thread);
 	xnthread_suspend(thread, XNRELAX, XN_INFINITE, XN_RELATIVE, NULL);
 	pipeline_attach_current(thread);
 	xnthread_set_state(thread, XNMAPPED);
diff --git a/kernel/cobalt/sched.c b/kernel/cobalt/sched.c
index a44109e78..8a5621642 100644
--- a/kernel/cobalt/sched.c
+++ b/kernel/cobalt/sched.c
@@ -27,6 +27,7 @@
 #include <cobalt/kernel/heap.h>
 #include <cobalt/kernel/arith.h>
 #include <cobalt/uapi/signal.h>
+#include <pipeline/sched.h>
 #define CREATE_TRACE_POINTS
 #include <trace/events/cobalt-core.h>
 
@@ -212,7 +213,7 @@ static void xnsched_init(struct xnsched *sched, int cpu)
 	sched->fpuholder = &sched->rootcb;
 #endif /* CONFIG_XENO_ARCH_FPU */
 
-	xnthread_init_root_tcb(&sched->rootcb);
+	pipeline_init_root_tcb(&sched->rootcb);
 	list_add_tail(&sched->rootcb.glink, &nkthreadq);
 	cobalt_nrthreads++;
 
@@ -875,16 +876,7 @@ static inline void enter_root(struct xnthread *root)
 
 static inline void leave_root(struct xnthread *root)
 {
-	struct xnarchtcb *rootcb = xnthread_archtcb(root);
-	struct task_struct *p = current;
-
-	ipipe_notify_root_preemption();
-	/* Remember the preempted Linux task pointer. */
-	rootcb->core.host_task = p;
-	rootcb->core.tsp = &p->thread;
-	rootcb->core.mm = rootcb->core.active_mm = ipipe_get_active_mm();
-	rootcb->core.tip = task_thread_info(p);
-	xnarch_leave_root(root);
+	pipeline_prep_switch_oob(root);
 
 #ifdef CONFIG_XENO_OPT_WATCHDOG
 	xntimer_start(&root->sched->wdtimer, get_watchdog_timeout(),
@@ -905,15 +897,11 @@ static inline void do_lazy_user_work(struct xnthread *curr)
 
 int ___xnsched_run(struct xnsched *sched)
 {
+	bool switched = false, leaving_inband;
 	struct xnthread *prev, *next, *curr;
-	int switched, shadow;
 	spl_t s;
 
-	XENO_WARN_ON_ONCE(COBALT,
-			  !hard_irqs_disabled() && is_secondary_domain());
-
-	if (xnarch_escalate())
-		return 0;
+	XENO_WARN_ON_ONCE(COBALT, is_secondary_domain());
 
 	trace_cobalt_schedule(sched);
 
@@ -931,7 +919,6 @@ int ___xnsched_run(struct xnsched *sched)
 	if (xnthread_test_state(curr, XNUSER))
 		do_lazy_user_work(curr);
 
-	switched = 0;
 	if (!test_resched(sched))
 		goto out;
 
@@ -958,11 +945,11 @@ int ___xnsched_run(struct xnsched *sched)
 	 * store tearing.
 	 */
 	WRITE_ONCE(sched->curr, next);
-	shadow = 1;
+	leaving_inband = false;
 
 	if (xnthread_test_state(prev, XNROOT)) {
 		leave_root(prev);
-		shadow = 0;
+		leaving_inband = true;
 	} else if (xnthread_test_state(next, XNROOT)) {
 		if (sched->lflags & XNHTICK)
 			xnintr_host_tick(sched);
@@ -973,46 +960,23 @@ int ___xnsched_run(struct xnsched *sched)
 
 	xnstat_exectime_switch(sched, &next->stat.account);
 	xnstat_counter_inc(&next->stat.csw);
-	xnarch_switch_to(prev, next);
 
-	/*
-	 * Test whether we transitioned from primary mode to secondary
-	 * over a shadow thread, caused by a call to xnthread_relax().
-	 * In such a case, we are running over the regular schedule()
-	 * tail code, so we have to skip our tail code.
-	 */
-	if (shadow && is_secondary_domain())
-		goto shadow_epilogue;
+	if (pipeline_switch_to(prev, next, leaving_inband))
+		/* oob -> in-band transition detected. */
+		return true;
 
-	switched = 1;
-	sched = xnsched_current();
 	/*
-	 * Re-read the currently running thread, this is needed
-	 * because of relaxed/hardened transitions.
+	 * Re-read sched->curr for tracing: the current thread may
+	 * have switched from in-band to oob context.
 	 */
-	curr = sched->curr;
-	xnthread_switch_fpu(sched);
-	xntrace_pid(task_pid_nr(current), xnthread_current_priority(curr));
+	xntrace_pid(task_pid_nr(current),
+		xnthread_current_priority(xnsched_current()->curr));
+
+	switched = true;
 out:
 	xnlock_put_irqrestore(&nklock, s);
 
-	return switched;
-
-shadow_epilogue:
-	__ipipe_complete_domain_migration();
-
-	XENO_BUG_ON(COBALT, xnthread_current() == NULL);
-
-	/*
-	 * Interrupts must be disabled here (has to be done on entry
-	 * of the Linux [__]switch_to function), but it is what
-	 * callers expect, specifically the reschedule of an IRQ
-	 * handler that hit before we call xnsched_run in
-	 * xnthread_suspend() when relaxing a thread.
-	 */
-	XENO_BUG_ON(COBALT, !hard_irqs_disabled());
-
-	return 1;
+	return !!switched;
 }
 EXPORT_SYMBOL_GPL(___xnsched_run);
 
diff --git a/kernel/cobalt/thread.c b/kernel/cobalt/thread.c
index a02c09db4..a2eae7ffc 100644
--- a/kernel/cobalt/thread.c
+++ b/kernel/cobalt/thread.c
@@ -40,6 +40,7 @@
 #include <cobalt/kernel/thread.h>
 #include <pipeline/kevents.h>
 #include <pipeline/inband_work.h>
+#include <pipeline/sched.h>
 #include <trace/events/cobalt-core.h>
 #include "debug.h"
 
@@ -236,44 +237,6 @@ err_out:
 	return ret;
 }
 
-void xnthread_init_shadow_tcb(struct xnthread *thread)
-{
-	struct xnarchtcb *tcb = xnthread_archtcb(thread);
-	struct task_struct *p = current;
-
-	/*
-	 * If the current task is a kthread, the pipeline will take
-	 * the necessary steps to make the FPU usable in such
-	 * context. The kernel already took care of this issue for
-	 * userland tasks (e.g. setting up a clean backup area).
-	 */
-	__ipipe_share_current(0);
-
-	tcb->core.host_task = p;
-	tcb->core.tsp = &p->thread;
-	tcb->core.mm = p->mm;
-	tcb->core.active_mm = p->mm;
-	tcb->core.tip = task_thread_info(p);
-#ifdef CONFIG_XENO_ARCH_FPU
-	tcb->core.user_fpu_owner = p;
-#endif /* CONFIG_XENO_ARCH_FPU */
-	xnarch_init_shadow_tcb(thread);
-
-	trace_cobalt_shadow_map(thread);
-}
-
-void xnthread_init_root_tcb(struct xnthread *thread)
-{
-	struct xnarchtcb *tcb = xnthread_archtcb(thread);
-	struct task_struct *p = current;
-
-	tcb->core.host_task = p;
-	tcb->core.tsp = &tcb->core.ts;
-	tcb->core.mm = p->mm;
-	tcb->core.tip = NULL;
-	xnarch_init_root_tcb(thread);
-}
-
 void xnthread_deregister(struct xnthread *thread)
 {
 	if (thread->handle != XN_NO_HANDLE)
@@ -408,35 +371,6 @@ void xnthread_prepare_wait(struct xnthread_wait_context *wc)
 }
 EXPORT_SYMBOL_GPL(xnthread_prepare_wait);
 
-#ifdef CONFIG_XENO_ARCH_FPU
-
-static inline void giveup_fpu(struct xnsched *sched,
-			      struct xnthread *thread)
-{
-	if (thread == sched->fpuholder)
-		sched->fpuholder = NULL;
-}
-
-void xnthread_switch_fpu(struct xnsched *sched)
-{
-	struct xnthread *curr = sched->curr;
-
-	if (!xnthread_test_state(curr, XNFPU))
-		return;
-
-	xnarch_switch_fpu(sched->fpuholder, curr);
-	sched->fpuholder = curr;
-}
-
-#else /* !CONFIG_XENO_ARCH_FPU */
-
-static inline void giveup_fpu(struct xnsched *sched,
-				      struct xnthread *thread)
-{
-}
-
-#endif /* !CONFIG_XENO_ARCH_FPU */
-
 static inline void release_all_ownerships(struct xnthread *curr)
 {
 	struct xnsynch *synch, *tmp;
@@ -455,8 +389,6 @@ static inline void release_all_ownerships(struct xnthread *curr)
 
 static inline void cleanup_tcb(struct xnthread *curr) /* nklock held, irqs off */
 {
-	struct xnsched *sched = curr->sched;
-
 	list_del(&curr->glink);
 	cobalt_nrthreads--;
 	xnvfile_touch_tag(&nkthreadlist_tag);
@@ -479,7 +411,7 @@ static inline void cleanup_tcb(struct xnthread *curr) /* nklock held, irqs off *
 	 */
 	release_all_ownerships(curr);
 
-	giveup_fpu(sched, curr);
+	pipeline_finalize_thread(curr);
 	xnsched_forget(curr);
 	xnthread_deregister(curr);
 }
@@ -1912,7 +1844,6 @@ int xnthread_harden(void)
 {
 	struct task_struct *p = current;
 	struct xnthread *thread;
-	struct xnsched *sched;
 	int ret;
 
 	secondary_mode_only();
@@ -1928,16 +1859,14 @@ int xnthread_harden(void)
 
 	xnthread_clear_sync_window(thread, XNRELAX);
 
-	ret = __ipipe_migrate_head();
+	ret = pipeline_leave_inband();
 	if (ret) {
 		xnthread_test_cancel();
 		xnthread_set_sync_window(thread, XNRELAX);
 		return ret;
 	}
 
-	/* "current" is now running into the Xenomai domain. */
-	sched = xnsched_current();
-	xnthread_switch_fpu(sched);
+	/* "current" is now running on the out-of-band stage. */
 
 	xnlock_clear_irqon(&nklock);
 	xnthread_test_cancel();
@@ -2097,8 +2026,8 @@ void xnthread_relax(int notify, int reason)
 		suspension |= XNDBGSTOP;
 	}
 #endif
-	set_current_state(p->state & ~TASK_NOWAKEUP);
 	xnthread_run_handler_stack(thread, relax_thread);
+	pipeline_leave_oob_prepare();
 	xnthread_suspend(thread, suspension, XN_INFINITE, XN_RELATIVE, NULL);
 	splnone();
 
@@ -2110,7 +2039,7 @@ void xnthread_relax(int notify, int reason)
 		  "xnthread_relax() failed for thread %s[%d]",
 		  thread->name, xnthread_host_pid(thread));
 
-	__ipipe_reenter_root();
+	pipeline_leave_oob_finish();
 
 	/* Account for secondary mode switch. */
 	xnstat_counter_inc(&thread->stat.ssw);
@@ -2162,7 +2091,7 @@ void xnthread_relax(int notify, int reason)
 	 */
 	xnthread_clear_localinfo(thread, XNSYSRST);
 
-	ipipe_clear_thread_flag(TIP_MAYDAY);
+	pipeline_clear_mayday();
 
 	trace_cobalt_shadow_relaxed(thread);
 }
@@ -2320,7 +2249,7 @@ void __xnthread_kick(struct xnthread *thread) /* nklock locked, irqs off */
 	 */
 	if (thread != xnsched_current_thread() &&
 	    xnthread_test_state(thread, XNUSER))
-		ipipe_raise_mayday(p);
+		pipeline_raise_mayday(p);
 }
 
 void xnthread_kick(struct xnthread *thread)
@@ -2510,7 +2439,7 @@ int xnthread_map(struct xnthread *thread, struct completion *done)
 	thread->u_window = NULL;
 	xnthread_pin_initial(thread);
 
-	xnthread_init_shadow_tcb(thread);
+	pipeline_init_shadow_tcb(thread);
 	xnthread_suspend(thread, XNRELAX, XN_INFINITE, XN_RELATIVE, NULL);
 	init_kthread_info(thread);
 	xnthread_set_state(thread, XNMAPPED);
@@ -2568,7 +2497,7 @@ void xnthread_call_mayday(struct xnthread *thread, int reason)
 	XENO_BUG_ON(COBALT, !xnthread_test_state(thread, XNUSER));
 	xnthread_set_info(thread, XNKICKED);
 	xnthread_signal(thread, SIGDEBUG, reason);
-	ipipe_raise_mayday(p);
+	pipeline_raise_mayday(p);
 }
 EXPORT_SYMBOL_GPL(xnthread_call_mayday);
 
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 02/13] cobalt/thread: pipeline: abstract synchronous single-stepping code
  2021-01-31 14:45 [PATCH 01/13] cobalt/kernel: pipeline: abstract context switching support Philippe Gerum
@ 2021-01-31 14:45 ` Philippe Gerum
  2021-01-31 14:45 ` [PATCH 03/13] cobalt/clock: pipeline: abstract access to host (real)time Philippe Gerum
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 18+ messages in thread
From: Philippe Gerum @ 2021-01-31 14:45 UTC (permalink / raw)
  To: xenomai

From: Philippe Gerum <rpm@xenomai.org>

Although the synchronous single-stepping code has moved to the I-pipe
section, we should be able to reuse the current logic nearly as is on
top of Dovetail, with only minor adjustments.

However, compared to the previous implementation, the single-stepping
status (XNCONTHI) and the user return notifier are armed _after_ the
personality handlers have run, in the relaxing path for the current
thread (see xnthread_relax()). This change should not affect the
overall logic, assuming no custom relax handler was depending on the
original sequence of actions (which they should definitely not
anyway).

We keep this commit which does introduce a small functional change
separated from the other scheduler-related modifications, as a
convenience for chasing regressions if need be.

Signed-off-by: Philippe Gerum <rpm@xenomai.org>
---
 include/cobalt/kernel/ipipe/pipeline/sched.h |  2 +-
 kernel/cobalt/ipipe/sched.c                  | 24 +++++++++++++++++++-
 kernel/cobalt/thread.c                       | 18 ++-------------
 3 files changed, 26 insertions(+), 18 deletions(-)

diff --git a/include/cobalt/kernel/ipipe/pipeline/sched.h b/include/cobalt/kernel/ipipe/pipeline/sched.h
index 692ee6228..3fd5c4bea 100644
--- a/include/cobalt/kernel/ipipe/pipeline/sched.h
+++ b/include/cobalt/kernel/ipipe/pipeline/sched.h
@@ -25,7 +25,7 @@ bool pipeline_switch_to(struct xnthread *prev,
 
 int pipeline_leave_inband(void);
 
-void pipeline_leave_oob_prepare(void);
+int pipeline_leave_oob_prepare(void);
 
 void pipeline_leave_oob_finish(void);
 
diff --git a/kernel/cobalt/ipipe/sched.c b/kernel/cobalt/ipipe/sched.c
index 4850b229d..b6ad8dca5 100644
--- a/kernel/cobalt/ipipe/sched.c
+++ b/kernel/cobalt/ipipe/sched.c
@@ -150,11 +150,33 @@ int pipeline_leave_inband(void)
 	return 0;
 }
 
-void pipeline_leave_oob_prepare(void)
+int pipeline_leave_oob_prepare(void)
 {
+	struct xnthread *curr = xnthread_current();
 	struct task_struct *p = current;
+	int suspmask = XNRELAX;
 
 	set_current_state(p->state & ~TASK_NOWAKEUP);
+
+#ifdef IPIPE_KEVT_USERINTRET
+	/*
+	 * If current is being debugged, record that it should migrate
+	 * back in case it resumes in userspace. If it resumes in
+	 * kernel space, i.e.  over a restarting syscall, the
+	 * associated hardening will both clear XNCONTHI and disable
+	 * the user return notifier again.
+	 */
+	if (xnthread_test_state(curr, XNSSTEP)) {
+		xnthread_set_info(curr, XNCONTHI);
+		ipipe_enable_user_intret_notifier();
+		suspmask |= XNDBGSTOP;
+	}
+#endif
+	/*
+	 * Return the suspension bits the caller should pass to
+	 * xnthread_suspend().
+	 */
+	return suspmask;
 }
 
 void pipeline_leave_oob_finish(void)
diff --git a/kernel/cobalt/thread.c b/kernel/cobalt/thread.c
index a2eae7ffc..d3a827eaa 100644
--- a/kernel/cobalt/thread.c
+++ b/kernel/cobalt/thread.c
@@ -1981,9 +1981,8 @@ void __xnthread_propagate_schedparam(struct xnthread *curr)
 void xnthread_relax(int notify, int reason)
 {
 	struct xnthread *thread = xnthread_current();
+	int cpu __maybe_unused, suspension;
 	struct task_struct *p = current;
-	int suspension = XNRELAX;
-	int cpu __maybe_unused;
 	kernel_siginfo_t si;
 
 	primary_mode_only();
@@ -2013,21 +2012,8 @@ void xnthread_relax(int notify, int reason)
 	 * dropped by xnthread_suspend().
 	 */
 	xnlock_get(&nklock);
-#ifdef IPIPE_KEVT_USERINTRET
-	/*
-	 * If the thread is being debugged, record that it should migrate back
-	 * in case it resumes in userspace. If it resumes in kernel space, i.e.
-	 * over a restarting syscall, the associated hardening will both clear
-	 * XNCONTHI and disable the user return notifier again.
-	 */
-	if (xnthread_test_state(thread, XNSSTEP)) {
-		xnthread_set_info(thread, XNCONTHI);
-		ipipe_enable_user_intret_notifier();
-		suspension |= XNDBGSTOP;
-	}
-#endif
 	xnthread_run_handler_stack(thread, relax_thread);
-	pipeline_leave_oob_prepare();
+	suspension = pipeline_leave_oob_prepare();
 	xnthread_suspend(thread, suspension, XN_INFINITE, XN_RELATIVE, NULL);
 	splnone();
 
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 03/13] cobalt/clock: pipeline: abstract access to host (real)time
  2021-01-31 14:45 [PATCH 01/13] cobalt/kernel: pipeline: abstract context switching support Philippe Gerum
  2021-01-31 14:45 ` [PATCH 02/13] cobalt/thread: pipeline: abstract synchronous single-stepping code Philippe Gerum
@ 2021-01-31 14:45 ` Philippe Gerum
  2021-01-31 14:45 ` [PATCH 04/13] cobalt/arch: pipeline: move architecture code to pipeline-specific section Philippe Gerum
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 18+ messages in thread
From: Philippe Gerum @ 2021-01-31 14:45 UTC (permalink / raw)
  To: xenomai

From: Philippe Gerum <rpm@xenomai.org>

Dovetail enables applications to get timestamps from the
CLOCK_MONOTONIC and CLOCK_REALTIME clocks via the regular vDSO by
calling clock_gettime(), including from the out-of-band stage
(i.e. primary mode).

Legacy support involving IPIPE_HOSTRT can move to the I-pipe specific
section.

No functional change is introduced.

Signed-off-by: Philippe Gerum <rpm@xenomai.org>
---
 include/cobalt/kernel/ipipe/pipeline/clock.h |  4 ++
 include/cobalt/uapi/kernel/vdso.h            |  5 ++
 kernel/cobalt/ipipe/Makefile                 |  2 +-
 kernel/cobalt/ipipe/clock.c                  | 62 ++++++++++++++++++++
 kernel/cobalt/posix/clock.c                  | 57 +-----------------
 5 files changed, 73 insertions(+), 57 deletions(-)
 create mode 100644 kernel/cobalt/ipipe/clock.c

diff --git a/include/cobalt/kernel/ipipe/pipeline/clock.h b/include/cobalt/kernel/ipipe/pipeline/clock.h
index c607d9585..eeeae6602 100644
--- a/include/cobalt/kernel/ipipe/pipeline/clock.h
+++ b/include/cobalt/kernel/ipipe/pipeline/clock.h
@@ -7,6 +7,8 @@
 
 #include <linux/ipipe_tickdev.h>
 
+struct timespec;
+
 static inline u64 pipeline_read_cycle_counter(void)
 {
 	u64 t;
@@ -29,4 +31,6 @@ static inline const char *pipeline_clock_name(void)
 	return ipipe_clock_name();
 }
 
+int pipeline_get_host_time(struct timespec *tp);
+
 #endif /* !_COBALT_KERNEL_IPIPE_CLOCK_H */
diff --git a/include/cobalt/uapi/kernel/vdso.h b/include/cobalt/uapi/kernel/vdso.h
index 396594bb0..5b9b1b66b 100644
--- a/include/cobalt/uapi/kernel/vdso.h
+++ b/include/cobalt/uapi/kernel/vdso.h
@@ -20,6 +20,11 @@
 
 #include <cobalt/uapi/kernel/urw.h>
 
+/*
+ * I-pipe only. Dovetail enables the common vDSO for getting
+ * CLOCK_REALTIME timestamps from the out-of-band stage
+ * (XNVDSO_FEAT_HOST_REALTIME is cleared in this case).
+ */
 struct xnvdso_hostrt_data {
 	__u64 wall_sec;
 	__u64 wtom_sec;
diff --git a/kernel/cobalt/ipipe/Makefile b/kernel/cobalt/ipipe/Makefile
index eae6a4a7c..f2b877d45 100644
--- a/kernel/cobalt/ipipe/Makefile
+++ b/kernel/cobalt/ipipe/Makefile
@@ -2,4 +2,4 @@ ccflags-y += -I$(srctree)/kernel
 
 obj-y +=	pipeline.o
 
-pipeline-y :=	init.o intr.o kevents.o tick.o syscall.o sched.o
+pipeline-y :=	init.o intr.o kevents.o tick.o syscall.o sched.o clock.o
diff --git a/kernel/cobalt/ipipe/clock.c b/kernel/cobalt/ipipe/clock.c
new file mode 100644
index 000000000..d0135dc7a
--- /dev/null
+++ b/kernel/cobalt/ipipe/clock.c
@@ -0,0 +1,62 @@
+/*
+ * SPDX-License-Identifier: GPL-2.0
+ *
+ * Written by Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>.
+ */
+
+#include <cobalt/kernel/clock.h>
+#include <cobalt/kernel/vdso.h>
+
+int pipeline_get_host_time(struct timespec *tp)
+{
+#ifdef CONFIG_IPIPE_HAVE_HOSTRT
+	struct xnvdso_hostrt_data *hostrt_data;
+	u64 now, base, mask, cycle_delta;
+	__u32 mult, shift;
+	unsigned long rem;
+	urwstate_t tmp;
+	__u64 nsec;
+
+	hostrt_data = get_hostrt_data();
+	BUG_ON(!hostrt_data);
+
+	if (unlikely(!hostrt_data->live))
+		return -1;
+
+	/*
+	 * Note: Disabling HW interrupts around writes to hostrt_data
+	 * ensures that a reader (on the Xenomai side) cannot
+	 * interrupt a writer (on the Linux kernel side) on the same
+	 * CPU.  The urw block is required when a reader is
+	 * interleaved by a writer on a different CPU. This follows
+	 * the approach from userland, where taking the spinlock is
+	 * not possible.
+	 */
+	unsynced_read_block(&tmp, &hostrt_data->lock) {
+		now = xnclock_read_raw(&nkclock);
+		base = hostrt_data->cycle_last;
+		mask = hostrt_data->mask;
+		mult = hostrt_data->mult;
+		shift = hostrt_data->shift;
+		tp->tv_sec = hostrt_data->wall_sec;
+		nsec = hostrt_data->wall_nsec;
+	}
+
+	/*
+	 * At this point, we have a consistent copy of the fundamental
+	 * data structure - calculate the interval between the current
+	 * and base time stamp cycles, and convert the difference
+	 * to nanoseconds.
+	 */
+	cycle_delta = (now - base) & mask;
+	nsec += (cycle_delta * mult) >> shift;
+
+	/* Convert to the desired sec, usec representation */
+	tp->tv_sec += xnclock_divrem_billion(nsec, &rem);
+	tp->tv_nsec = rem;
+
+	return 0;
+#else
+	return -EINVAL;
+#endif
+}
diff --git a/kernel/cobalt/posix/clock.c b/kernel/cobalt/posix/clock.c
index 40271f3ed..e957dd956 100644
--- a/kernel/cobalt/posix/clock.c
+++ b/kernel/cobalt/posix/clock.c
@@ -18,7 +18,6 @@
 
 #include <linux/clocksource.h>
 #include <linux/bitmap.h>
-#include <cobalt/kernel/vdso.h>
 #include <cobalt/kernel/clock.h>
 #include "internal.h"
 #include "thread.h"
@@ -29,60 +28,6 @@ static struct xnclock *external_clocks[COBALT_MAX_EXTCLOCKS];
 
 DECLARE_BITMAP(cobalt_clock_extids, COBALT_MAX_EXTCLOCKS);
 
-static int do_clock_host_realtime(struct timespec *tp)
-{
-#ifdef CONFIG_IPIPE_HAVE_HOSTRT
-	struct xnvdso_hostrt_data *hostrt_data;
-	u64 now, base, mask, cycle_delta;
-	__u32 mult, shift;
-	unsigned long rem;
-	urwstate_t tmp;
-	__u64 nsec;
-
-	hostrt_data = get_hostrt_data();
-	BUG_ON(!hostrt_data);
-
-	if (unlikely(!hostrt_data->live))
-		return -1;
-
-	/*
-	 * Note: Disabling HW interrupts around writes to hostrt_data
-	 * ensures that a reader (on the Xenomai side) cannot
-	 * interrupt a writer (on the Linux kernel side) on the same
-	 * CPU.  The urw block is required when a reader is
-	 * interleaved by a writer on a different CPU. This follows
-	 * the approach from userland, where taking the spinlock is
-	 * not possible.
-	 */
-	unsynced_read_block(&tmp, &hostrt_data->lock) {
-		now = xnclock_read_raw(&nkclock);
-		base = hostrt_data->cycle_last;
-		mask = hostrt_data->mask;
-		mult = hostrt_data->mult;
-		shift = hostrt_data->shift;
-		tp->tv_sec = hostrt_data->wall_sec;
-		nsec = hostrt_data->wall_nsec;
-	}
-
-	/*
-	 * At this point, we have a consistent copy of the fundamental
-	 * data structure - calculate the interval between the current
-	 * and base time stamp cycles, and convert the difference
-	 * to nanoseconds.
-	 */
-	cycle_delta = (now - base) & mask;
-	nsec += (cycle_delta * mult) >> shift;
-
-	/* Convert to the desired sec, usec representation */
-	tp->tv_sec += xnclock_divrem_billion(nsec, &rem);
-	tp->tv_nsec = rem;
-
-	return 0;
-#else
-	return -EINVAL;
-#endif
-}
-
 #define do_ext_clock(__clock_id, __handler, __ret, __args...)	\
 ({								\
 	struct xnclock *__clock;				\
@@ -161,7 +106,7 @@ int __cobalt_clock_gettime(clockid_t clock_id, struct timespec *ts)
 		ns2ts(ts, xnclock_read_monotonic(&nkclock));
 		break;
 	case CLOCK_HOST_REALTIME:
-		if (do_clock_host_realtime(ts) != 0)
+		if (pipeline_get_host_time(ts) != 0)
 			return -EINVAL;
 		break;
 	default:
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 04/13] cobalt/arch: pipeline: move architecture code to pipeline-specific section
  2021-01-31 14:45 [PATCH 01/13] cobalt/kernel: pipeline: abstract context switching support Philippe Gerum
  2021-01-31 14:45 ` [PATCH 02/13] cobalt/thread: pipeline: abstract synchronous single-stepping code Philippe Gerum
  2021-01-31 14:45 ` [PATCH 03/13] cobalt/clock: pipeline: abstract access to host (real)time Philippe Gerum
@ 2021-01-31 14:45 ` Philippe Gerum
  2021-02-03 10:18   ` Jan Kiszka
  2021-01-31 14:45 ` [PATCH 05/13] cobalt/clock: pipeline: move TSC-related code to the I-pipe section Philippe Gerum
                   ` (8 subsequent siblings)
  11 siblings, 1 reply; 18+ messages in thread
From: Philippe Gerum @ 2021-01-31 14:45 UTC (permalink / raw)
  To: xenomai

From: Philippe Gerum <rpm@xenomai.org>

The Cobalt architecture code is overwhelmingly specific to a pipeline
flavour, most of it for interfacing with the I-pipe. We may still need
very little arch-specific code in the Dovetail set up though,
specifically for implementing Cobalt's built-in FPU tests.

Let's move the existing architecture code under the ipipe/ hierarchy,
fixing up the kernel prep script accordingly.

No functional change is introduced.

Signed-off-by: Philippe Gerum <rpm@xenomai.org>
---
 kernel/cobalt/arch/arm/{ => ipipe}/Makefile   |  2 +-
 kernel/cobalt/arch/arm/{ => ipipe}/README     |  0
 .../include/asm/xenomai/calibration.h         |  0
 .../include/asm/xenomai/features.h            |  0
 .../{ => ipipe}/include/asm/xenomai/fptest.h  |  0
 .../{ => ipipe}/include/asm/xenomai/machine.h |  0
 .../{ => ipipe}/include/asm/xenomai/syscall.h |  0
 .../include/asm/xenomai/syscall32.h           |  0
 .../{ => ipipe}/include/asm/xenomai/thread.h  |  0
 .../include/asm/xenomai/wrappers.h            |  0
 kernel/cobalt/arch/arm/{ => ipipe}/machine.c  |  0
 kernel/cobalt/arch/arm/{ => ipipe}/switch.S   |  0
 kernel/cobalt/arch/arm/{ => ipipe}/syscall.c  |  0
 kernel/cobalt/arch/arm/{ => ipipe}/thread.c   |  0
 kernel/cobalt/arch/arm64/{ => ipipe}/Makefile |  0
 kernel/cobalt/arch/arm64/{ => ipipe}/README   |  0
 .../include/asm/xenomai/calibration.h         |  0
 .../include/asm/xenomai/features.h            |  0
 .../{ => ipipe}/include/asm/xenomai/fptest.h  |  0
 .../{ => ipipe}/include/asm/xenomai/machine.h |  0
 .../{ => ipipe}/include/asm/xenomai/syscall.h |  0
 .../include/asm/xenomai/syscall32.h           |  0
 .../{ => ipipe}/include/asm/xenomai/thread.h  |  0
 .../include/asm/xenomai/wrappers.h            |  0
 .../cobalt/arch/arm64/{ => ipipe}/machine.c   |  0
 .../cobalt/arch/arm64/{ => ipipe}/syscall.c   |  0
 kernel/cobalt/arch/arm64/{ => ipipe}/thread.c |  0
 .../cobalt/arch/powerpc/{ => ipipe}/Makefile  |  0
 kernel/cobalt/arch/powerpc/{ => ipipe}/README |  0
 kernel/cobalt/arch/powerpc/{ => ipipe}/fpu.S  |  0
 .../include/asm/xenomai/calibration.h         |  0
 .../include/asm/xenomai/features.h            |  0
 .../{ => ipipe}/include/asm/xenomai/fptest.h  |  0
 .../{ => ipipe}/include/asm/xenomai/machine.h |  0
 .../{ => ipipe}/include/asm/xenomai/syscall.h |  0
 .../include/asm/xenomai/syscall32.h           |  0
 .../{ => ipipe}/include/asm/xenomai/thread.h  |  0
 .../include/asm/xenomai/wrappers.h            |  0
 .../cobalt/arch/powerpc/{ => ipipe}/machine.c |  0
 .../cobalt/arch/powerpc/{ => ipipe}/thread.c  |  0
 kernel/cobalt/arch/x86/{ => ipipe}/Makefile   |  0
 kernel/cobalt/arch/x86/{ => ipipe}/README     |  0
 kernel/cobalt/arch/x86/{ => ipipe}/c1e.c      |  0
 .../x86/{ => ipipe}/include/asm/xenomai/c1e.h |  0
 .../include/asm/xenomai/calibration.h         |  0
 .../include/asm/xenomai/features.h            |  0
 .../{ => ipipe}/include/asm/xenomai/fptest.h  |  0
 .../{ => ipipe}/include/asm/xenomai/machine.h |  0
 .../x86/{ => ipipe}/include/asm/xenomai/smi.h |  0
 .../{ => ipipe}/include/asm/xenomai/syscall.h |  0
 .../include/asm/xenomai/syscall32-table.h     |  0
 .../include/asm/xenomai/syscall32.h           |  0
 .../{ => ipipe}/include/asm/xenomai/thread.h  |  0
 .../include/asm/xenomai/wrappers.h            |  0
 kernel/cobalt/arch/x86/{ => ipipe}/machine.c  |  0
 kernel/cobalt/arch/x86/{ => ipipe}/smi.c      |  0
 kernel/cobalt/arch/x86/{ => ipipe}/thread.c   |  0
 scripts/prepare-kernel.sh                     | 84 ++++++++++++-------
 58 files changed, 53 insertions(+), 33 deletions(-)
 rename kernel/cobalt/arch/arm/{ => ipipe}/Makefile (64%)
 rename kernel/cobalt/arch/arm/{ => ipipe}/README (100%)
 rename kernel/cobalt/arch/arm/{ => ipipe}/include/asm/xenomai/calibration.h (100%)
 rename kernel/cobalt/arch/arm/{ => ipipe}/include/asm/xenomai/features.h (100%)
 rename kernel/cobalt/arch/arm/{ => ipipe}/include/asm/xenomai/fptest.h (100%)
 rename kernel/cobalt/arch/arm/{ => ipipe}/include/asm/xenomai/machine.h (100%)
 rename kernel/cobalt/arch/arm/{ => ipipe}/include/asm/xenomai/syscall.h (100%)
 rename kernel/cobalt/arch/arm/{ => ipipe}/include/asm/xenomai/syscall32.h (100%)
 rename kernel/cobalt/arch/arm/{ => ipipe}/include/asm/xenomai/thread.h (100%)
 rename kernel/cobalt/arch/arm/{ => ipipe}/include/asm/xenomai/wrappers.h (100%)
 rename kernel/cobalt/arch/arm/{ => ipipe}/machine.c (100%)
 rename kernel/cobalt/arch/arm/{ => ipipe}/switch.S (100%)
 rename kernel/cobalt/arch/arm/{ => ipipe}/syscall.c (100%)
 rename kernel/cobalt/arch/arm/{ => ipipe}/thread.c (100%)
 rename kernel/cobalt/arch/arm64/{ => ipipe}/Makefile (100%)
 rename kernel/cobalt/arch/arm64/{ => ipipe}/README (100%)
 rename kernel/cobalt/arch/arm64/{ => ipipe}/include/asm/xenomai/calibration.h (100%)
 rename kernel/cobalt/arch/arm64/{ => ipipe}/include/asm/xenomai/features.h (100%)
 rename kernel/cobalt/arch/arm64/{ => ipipe}/include/asm/xenomai/fptest.h (100%)
 rename kernel/cobalt/arch/arm64/{ => ipipe}/include/asm/xenomai/machine.h (100%)
 rename kernel/cobalt/arch/arm64/{ => ipipe}/include/asm/xenomai/syscall.h (100%)
 rename kernel/cobalt/arch/arm64/{ => ipipe}/include/asm/xenomai/syscall32.h (100%)
 rename kernel/cobalt/arch/arm64/{ => ipipe}/include/asm/xenomai/thread.h (100%)
 rename kernel/cobalt/arch/arm64/{ => ipipe}/include/asm/xenomai/wrappers.h (100%)
 rename kernel/cobalt/arch/arm64/{ => ipipe}/machine.c (100%)
 rename kernel/cobalt/arch/arm64/{ => ipipe}/syscall.c (100%)
 rename kernel/cobalt/arch/arm64/{ => ipipe}/thread.c (100%)
 rename kernel/cobalt/arch/powerpc/{ => ipipe}/Makefile (100%)
 rename kernel/cobalt/arch/powerpc/{ => ipipe}/README (100%)
 rename kernel/cobalt/arch/powerpc/{ => ipipe}/fpu.S (100%)
 rename kernel/cobalt/arch/powerpc/{ => ipipe}/include/asm/xenomai/calibration.h (100%)
 rename kernel/cobalt/arch/powerpc/{ => ipipe}/include/asm/xenomai/features.h (100%)
 rename kernel/cobalt/arch/powerpc/{ => ipipe}/include/asm/xenomai/fptest.h (100%)
 rename kernel/cobalt/arch/powerpc/{ => ipipe}/include/asm/xenomai/machine.h (100%)
 rename kernel/cobalt/arch/powerpc/{ => ipipe}/include/asm/xenomai/syscall.h (100%)
 rename kernel/cobalt/arch/powerpc/{ => ipipe}/include/asm/xenomai/syscall32.h (100%)
 rename kernel/cobalt/arch/powerpc/{ => ipipe}/include/asm/xenomai/thread.h (100%)
 rename kernel/cobalt/arch/powerpc/{ => ipipe}/include/asm/xenomai/wrappers.h (100%)
 rename kernel/cobalt/arch/powerpc/{ => ipipe}/machine.c (100%)
 rename kernel/cobalt/arch/powerpc/{ => ipipe}/thread.c (100%)
 rename kernel/cobalt/arch/x86/{ => ipipe}/Makefile (100%)
 rename kernel/cobalt/arch/x86/{ => ipipe}/README (100%)
 rename kernel/cobalt/arch/x86/{ => ipipe}/c1e.c (100%)
 rename kernel/cobalt/arch/x86/{ => ipipe}/include/asm/xenomai/c1e.h (100%)
 rename kernel/cobalt/arch/x86/{ => ipipe}/include/asm/xenomai/calibration.h (100%)
 rename kernel/cobalt/arch/x86/{ => ipipe}/include/asm/xenomai/features.h (100%)
 rename kernel/cobalt/arch/x86/{ => ipipe}/include/asm/xenomai/fptest.h (100%)
 rename kernel/cobalt/arch/x86/{ => ipipe}/include/asm/xenomai/machine.h (100%)
 rename kernel/cobalt/arch/x86/{ => ipipe}/include/asm/xenomai/smi.h (100%)
 rename kernel/cobalt/arch/x86/{ => ipipe}/include/asm/xenomai/syscall.h (100%)
 rename kernel/cobalt/arch/x86/{ => ipipe}/include/asm/xenomai/syscall32-table.h (100%)
 rename kernel/cobalt/arch/x86/{ => ipipe}/include/asm/xenomai/syscall32.h (100%)
 rename kernel/cobalt/arch/x86/{ => ipipe}/include/asm/xenomai/thread.h (100%)
 rename kernel/cobalt/arch/x86/{ => ipipe}/include/asm/xenomai/wrappers.h (100%)
 rename kernel/cobalt/arch/x86/{ => ipipe}/machine.c (100%)
 rename kernel/cobalt/arch/x86/{ => ipipe}/smi.c (100%)
 rename kernel/cobalt/arch/x86/{ => ipipe}/thread.c (100%)

diff --git a/kernel/cobalt/arch/arm/Makefile b/kernel/cobalt/arch/arm/ipipe/Makefile
similarity index 64%
rename from kernel/cobalt/arch/arm/Makefile
rename to kernel/cobalt/arch/arm/ipipe/Makefile
index 295ba614b..c482fb337 100644
--- a/kernel/cobalt/arch/arm/Makefile
+++ b/kernel/cobalt/arch/arm/ipipe/Makefile
@@ -1,5 +1,5 @@
 obj-$(CONFIG_XENOMAI) += xenomai.o
 
-xenomai-y := machine.o thread.o switch.o syscall.o
+xenomai-$(CONFIG_IPIPE) := machine.o thread.o switch.o syscall.o
 
 ccflags-y := -I$(srctree)/arch/arm/xenomai/include -I$(srctree)/include/xenomai
diff --git a/kernel/cobalt/arch/arm/README b/kernel/cobalt/arch/arm/ipipe/README
similarity index 100%
rename from kernel/cobalt/arch/arm/README
rename to kernel/cobalt/arch/arm/ipipe/README
diff --git a/kernel/cobalt/arch/arm/include/asm/xenomai/calibration.h b/kernel/cobalt/arch/arm/ipipe/include/asm/xenomai/calibration.h
similarity index 100%
rename from kernel/cobalt/arch/arm/include/asm/xenomai/calibration.h
rename to kernel/cobalt/arch/arm/ipipe/include/asm/xenomai/calibration.h
diff --git a/kernel/cobalt/arch/arm/include/asm/xenomai/features.h b/kernel/cobalt/arch/arm/ipipe/include/asm/xenomai/features.h
similarity index 100%
rename from kernel/cobalt/arch/arm/include/asm/xenomai/features.h
rename to kernel/cobalt/arch/arm/ipipe/include/asm/xenomai/features.h
diff --git a/kernel/cobalt/arch/arm/include/asm/xenomai/fptest.h b/kernel/cobalt/arch/arm/ipipe/include/asm/xenomai/fptest.h
similarity index 100%
rename from kernel/cobalt/arch/arm/include/asm/xenomai/fptest.h
rename to kernel/cobalt/arch/arm/ipipe/include/asm/xenomai/fptest.h
diff --git a/kernel/cobalt/arch/arm/include/asm/xenomai/machine.h b/kernel/cobalt/arch/arm/ipipe/include/asm/xenomai/machine.h
similarity index 100%
rename from kernel/cobalt/arch/arm/include/asm/xenomai/machine.h
rename to kernel/cobalt/arch/arm/ipipe/include/asm/xenomai/machine.h
diff --git a/kernel/cobalt/arch/arm/include/asm/xenomai/syscall.h b/kernel/cobalt/arch/arm/ipipe/include/asm/xenomai/syscall.h
similarity index 100%
rename from kernel/cobalt/arch/arm/include/asm/xenomai/syscall.h
rename to kernel/cobalt/arch/arm/ipipe/include/asm/xenomai/syscall.h
diff --git a/kernel/cobalt/arch/arm/include/asm/xenomai/syscall32.h b/kernel/cobalt/arch/arm/ipipe/include/asm/xenomai/syscall32.h
similarity index 100%
rename from kernel/cobalt/arch/arm/include/asm/xenomai/syscall32.h
rename to kernel/cobalt/arch/arm/ipipe/include/asm/xenomai/syscall32.h
diff --git a/kernel/cobalt/arch/arm/include/asm/xenomai/thread.h b/kernel/cobalt/arch/arm/ipipe/include/asm/xenomai/thread.h
similarity index 100%
rename from kernel/cobalt/arch/arm/include/asm/xenomai/thread.h
rename to kernel/cobalt/arch/arm/ipipe/include/asm/xenomai/thread.h
diff --git a/kernel/cobalt/arch/arm/include/asm/xenomai/wrappers.h b/kernel/cobalt/arch/arm/ipipe/include/asm/xenomai/wrappers.h
similarity index 100%
rename from kernel/cobalt/arch/arm/include/asm/xenomai/wrappers.h
rename to kernel/cobalt/arch/arm/ipipe/include/asm/xenomai/wrappers.h
diff --git a/kernel/cobalt/arch/arm/machine.c b/kernel/cobalt/arch/arm/ipipe/machine.c
similarity index 100%
rename from kernel/cobalt/arch/arm/machine.c
rename to kernel/cobalt/arch/arm/ipipe/machine.c
diff --git a/kernel/cobalt/arch/arm/switch.S b/kernel/cobalt/arch/arm/ipipe/switch.S
similarity index 100%
rename from kernel/cobalt/arch/arm/switch.S
rename to kernel/cobalt/arch/arm/ipipe/switch.S
diff --git a/kernel/cobalt/arch/arm/syscall.c b/kernel/cobalt/arch/arm/ipipe/syscall.c
similarity index 100%
rename from kernel/cobalt/arch/arm/syscall.c
rename to kernel/cobalt/arch/arm/ipipe/syscall.c
diff --git a/kernel/cobalt/arch/arm/thread.c b/kernel/cobalt/arch/arm/ipipe/thread.c
similarity index 100%
rename from kernel/cobalt/arch/arm/thread.c
rename to kernel/cobalt/arch/arm/ipipe/thread.c
diff --git a/kernel/cobalt/arch/arm64/Makefile b/kernel/cobalt/arch/arm64/ipipe/Makefile
similarity index 100%
rename from kernel/cobalt/arch/arm64/Makefile
rename to kernel/cobalt/arch/arm64/ipipe/Makefile
diff --git a/kernel/cobalt/arch/arm64/README b/kernel/cobalt/arch/arm64/ipipe/README
similarity index 100%
rename from kernel/cobalt/arch/arm64/README
rename to kernel/cobalt/arch/arm64/ipipe/README
diff --git a/kernel/cobalt/arch/arm64/include/asm/xenomai/calibration.h b/kernel/cobalt/arch/arm64/ipipe/include/asm/xenomai/calibration.h
similarity index 100%
rename from kernel/cobalt/arch/arm64/include/asm/xenomai/calibration.h
rename to kernel/cobalt/arch/arm64/ipipe/include/asm/xenomai/calibration.h
diff --git a/kernel/cobalt/arch/arm64/include/asm/xenomai/features.h b/kernel/cobalt/arch/arm64/ipipe/include/asm/xenomai/features.h
similarity index 100%
rename from kernel/cobalt/arch/arm64/include/asm/xenomai/features.h
rename to kernel/cobalt/arch/arm64/ipipe/include/asm/xenomai/features.h
diff --git a/kernel/cobalt/arch/arm64/include/asm/xenomai/fptest.h b/kernel/cobalt/arch/arm64/ipipe/include/asm/xenomai/fptest.h
similarity index 100%
rename from kernel/cobalt/arch/arm64/include/asm/xenomai/fptest.h
rename to kernel/cobalt/arch/arm64/ipipe/include/asm/xenomai/fptest.h
diff --git a/kernel/cobalt/arch/arm64/include/asm/xenomai/machine.h b/kernel/cobalt/arch/arm64/ipipe/include/asm/xenomai/machine.h
similarity index 100%
rename from kernel/cobalt/arch/arm64/include/asm/xenomai/machine.h
rename to kernel/cobalt/arch/arm64/ipipe/include/asm/xenomai/machine.h
diff --git a/kernel/cobalt/arch/arm64/include/asm/xenomai/syscall.h b/kernel/cobalt/arch/arm64/ipipe/include/asm/xenomai/syscall.h
similarity index 100%
rename from kernel/cobalt/arch/arm64/include/asm/xenomai/syscall.h
rename to kernel/cobalt/arch/arm64/ipipe/include/asm/xenomai/syscall.h
diff --git a/kernel/cobalt/arch/arm64/include/asm/xenomai/syscall32.h b/kernel/cobalt/arch/arm64/ipipe/include/asm/xenomai/syscall32.h
similarity index 100%
rename from kernel/cobalt/arch/arm64/include/asm/xenomai/syscall32.h
rename to kernel/cobalt/arch/arm64/ipipe/include/asm/xenomai/syscall32.h
diff --git a/kernel/cobalt/arch/arm64/include/asm/xenomai/thread.h b/kernel/cobalt/arch/arm64/ipipe/include/asm/xenomai/thread.h
similarity index 100%
rename from kernel/cobalt/arch/arm64/include/asm/xenomai/thread.h
rename to kernel/cobalt/arch/arm64/ipipe/include/asm/xenomai/thread.h
diff --git a/kernel/cobalt/arch/arm64/include/asm/xenomai/wrappers.h b/kernel/cobalt/arch/arm64/ipipe/include/asm/xenomai/wrappers.h
similarity index 100%
rename from kernel/cobalt/arch/arm64/include/asm/xenomai/wrappers.h
rename to kernel/cobalt/arch/arm64/ipipe/include/asm/xenomai/wrappers.h
diff --git a/kernel/cobalt/arch/arm64/machine.c b/kernel/cobalt/arch/arm64/ipipe/machine.c
similarity index 100%
rename from kernel/cobalt/arch/arm64/machine.c
rename to kernel/cobalt/arch/arm64/ipipe/machine.c
diff --git a/kernel/cobalt/arch/arm64/syscall.c b/kernel/cobalt/arch/arm64/ipipe/syscall.c
similarity index 100%
rename from kernel/cobalt/arch/arm64/syscall.c
rename to kernel/cobalt/arch/arm64/ipipe/syscall.c
diff --git a/kernel/cobalt/arch/arm64/thread.c b/kernel/cobalt/arch/arm64/ipipe/thread.c
similarity index 100%
rename from kernel/cobalt/arch/arm64/thread.c
rename to kernel/cobalt/arch/arm64/ipipe/thread.c
diff --git a/kernel/cobalt/arch/powerpc/Makefile b/kernel/cobalt/arch/powerpc/ipipe/Makefile
similarity index 100%
rename from kernel/cobalt/arch/powerpc/Makefile
rename to kernel/cobalt/arch/powerpc/ipipe/Makefile
diff --git a/kernel/cobalt/arch/powerpc/README b/kernel/cobalt/arch/powerpc/ipipe/README
similarity index 100%
rename from kernel/cobalt/arch/powerpc/README
rename to kernel/cobalt/arch/powerpc/ipipe/README
diff --git a/kernel/cobalt/arch/powerpc/fpu.S b/kernel/cobalt/arch/powerpc/ipipe/fpu.S
similarity index 100%
rename from kernel/cobalt/arch/powerpc/fpu.S
rename to kernel/cobalt/arch/powerpc/ipipe/fpu.S
diff --git a/kernel/cobalt/arch/powerpc/include/asm/xenomai/calibration.h b/kernel/cobalt/arch/powerpc/ipipe/include/asm/xenomai/calibration.h
similarity index 100%
rename from kernel/cobalt/arch/powerpc/include/asm/xenomai/calibration.h
rename to kernel/cobalt/arch/powerpc/ipipe/include/asm/xenomai/calibration.h
diff --git a/kernel/cobalt/arch/powerpc/include/asm/xenomai/features.h b/kernel/cobalt/arch/powerpc/ipipe/include/asm/xenomai/features.h
similarity index 100%
rename from kernel/cobalt/arch/powerpc/include/asm/xenomai/features.h
rename to kernel/cobalt/arch/powerpc/ipipe/include/asm/xenomai/features.h
diff --git a/kernel/cobalt/arch/powerpc/include/asm/xenomai/fptest.h b/kernel/cobalt/arch/powerpc/ipipe/include/asm/xenomai/fptest.h
similarity index 100%
rename from kernel/cobalt/arch/powerpc/include/asm/xenomai/fptest.h
rename to kernel/cobalt/arch/powerpc/ipipe/include/asm/xenomai/fptest.h
diff --git a/kernel/cobalt/arch/powerpc/include/asm/xenomai/machine.h b/kernel/cobalt/arch/powerpc/ipipe/include/asm/xenomai/machine.h
similarity index 100%
rename from kernel/cobalt/arch/powerpc/include/asm/xenomai/machine.h
rename to kernel/cobalt/arch/powerpc/ipipe/include/asm/xenomai/machine.h
diff --git a/kernel/cobalt/arch/powerpc/include/asm/xenomai/syscall.h b/kernel/cobalt/arch/powerpc/ipipe/include/asm/xenomai/syscall.h
similarity index 100%
rename from kernel/cobalt/arch/powerpc/include/asm/xenomai/syscall.h
rename to kernel/cobalt/arch/powerpc/ipipe/include/asm/xenomai/syscall.h
diff --git a/kernel/cobalt/arch/powerpc/include/asm/xenomai/syscall32.h b/kernel/cobalt/arch/powerpc/ipipe/include/asm/xenomai/syscall32.h
similarity index 100%
rename from kernel/cobalt/arch/powerpc/include/asm/xenomai/syscall32.h
rename to kernel/cobalt/arch/powerpc/ipipe/include/asm/xenomai/syscall32.h
diff --git a/kernel/cobalt/arch/powerpc/include/asm/xenomai/thread.h b/kernel/cobalt/arch/powerpc/ipipe/include/asm/xenomai/thread.h
similarity index 100%
rename from kernel/cobalt/arch/powerpc/include/asm/xenomai/thread.h
rename to kernel/cobalt/arch/powerpc/ipipe/include/asm/xenomai/thread.h
diff --git a/kernel/cobalt/arch/powerpc/include/asm/xenomai/wrappers.h b/kernel/cobalt/arch/powerpc/ipipe/include/asm/xenomai/wrappers.h
similarity index 100%
rename from kernel/cobalt/arch/powerpc/include/asm/xenomai/wrappers.h
rename to kernel/cobalt/arch/powerpc/ipipe/include/asm/xenomai/wrappers.h
diff --git a/kernel/cobalt/arch/powerpc/machine.c b/kernel/cobalt/arch/powerpc/ipipe/machine.c
similarity index 100%
rename from kernel/cobalt/arch/powerpc/machine.c
rename to kernel/cobalt/arch/powerpc/ipipe/machine.c
diff --git a/kernel/cobalt/arch/powerpc/thread.c b/kernel/cobalt/arch/powerpc/ipipe/thread.c
similarity index 100%
rename from kernel/cobalt/arch/powerpc/thread.c
rename to kernel/cobalt/arch/powerpc/ipipe/thread.c
diff --git a/kernel/cobalt/arch/x86/Makefile b/kernel/cobalt/arch/x86/ipipe/Makefile
similarity index 100%
rename from kernel/cobalt/arch/x86/Makefile
rename to kernel/cobalt/arch/x86/ipipe/Makefile
diff --git a/kernel/cobalt/arch/x86/README b/kernel/cobalt/arch/x86/ipipe/README
similarity index 100%
rename from kernel/cobalt/arch/x86/README
rename to kernel/cobalt/arch/x86/ipipe/README
diff --git a/kernel/cobalt/arch/x86/c1e.c b/kernel/cobalt/arch/x86/ipipe/c1e.c
similarity index 100%
rename from kernel/cobalt/arch/x86/c1e.c
rename to kernel/cobalt/arch/x86/ipipe/c1e.c
diff --git a/kernel/cobalt/arch/x86/include/asm/xenomai/c1e.h b/kernel/cobalt/arch/x86/ipipe/include/asm/xenomai/c1e.h
similarity index 100%
rename from kernel/cobalt/arch/x86/include/asm/xenomai/c1e.h
rename to kernel/cobalt/arch/x86/ipipe/include/asm/xenomai/c1e.h
diff --git a/kernel/cobalt/arch/x86/include/asm/xenomai/calibration.h b/kernel/cobalt/arch/x86/ipipe/include/asm/xenomai/calibration.h
similarity index 100%
rename from kernel/cobalt/arch/x86/include/asm/xenomai/calibration.h
rename to kernel/cobalt/arch/x86/ipipe/include/asm/xenomai/calibration.h
diff --git a/kernel/cobalt/arch/x86/include/asm/xenomai/features.h b/kernel/cobalt/arch/x86/ipipe/include/asm/xenomai/features.h
similarity index 100%
rename from kernel/cobalt/arch/x86/include/asm/xenomai/features.h
rename to kernel/cobalt/arch/x86/ipipe/include/asm/xenomai/features.h
diff --git a/kernel/cobalt/arch/x86/include/asm/xenomai/fptest.h b/kernel/cobalt/arch/x86/ipipe/include/asm/xenomai/fptest.h
similarity index 100%
rename from kernel/cobalt/arch/x86/include/asm/xenomai/fptest.h
rename to kernel/cobalt/arch/x86/ipipe/include/asm/xenomai/fptest.h
diff --git a/kernel/cobalt/arch/x86/include/asm/xenomai/machine.h b/kernel/cobalt/arch/x86/ipipe/include/asm/xenomai/machine.h
similarity index 100%
rename from kernel/cobalt/arch/x86/include/asm/xenomai/machine.h
rename to kernel/cobalt/arch/x86/ipipe/include/asm/xenomai/machine.h
diff --git a/kernel/cobalt/arch/x86/include/asm/xenomai/smi.h b/kernel/cobalt/arch/x86/ipipe/include/asm/xenomai/smi.h
similarity index 100%
rename from kernel/cobalt/arch/x86/include/asm/xenomai/smi.h
rename to kernel/cobalt/arch/x86/ipipe/include/asm/xenomai/smi.h
diff --git a/kernel/cobalt/arch/x86/include/asm/xenomai/syscall.h b/kernel/cobalt/arch/x86/ipipe/include/asm/xenomai/syscall.h
similarity index 100%
rename from kernel/cobalt/arch/x86/include/asm/xenomai/syscall.h
rename to kernel/cobalt/arch/x86/ipipe/include/asm/xenomai/syscall.h
diff --git a/kernel/cobalt/arch/x86/include/asm/xenomai/syscall32-table.h b/kernel/cobalt/arch/x86/ipipe/include/asm/xenomai/syscall32-table.h
similarity index 100%
rename from kernel/cobalt/arch/x86/include/asm/xenomai/syscall32-table.h
rename to kernel/cobalt/arch/x86/ipipe/include/asm/xenomai/syscall32-table.h
diff --git a/kernel/cobalt/arch/x86/include/asm/xenomai/syscall32.h b/kernel/cobalt/arch/x86/ipipe/include/asm/xenomai/syscall32.h
similarity index 100%
rename from kernel/cobalt/arch/x86/include/asm/xenomai/syscall32.h
rename to kernel/cobalt/arch/x86/ipipe/include/asm/xenomai/syscall32.h
diff --git a/kernel/cobalt/arch/x86/include/asm/xenomai/thread.h b/kernel/cobalt/arch/x86/ipipe/include/asm/xenomai/thread.h
similarity index 100%
rename from kernel/cobalt/arch/x86/include/asm/xenomai/thread.h
rename to kernel/cobalt/arch/x86/ipipe/include/asm/xenomai/thread.h
diff --git a/kernel/cobalt/arch/x86/include/asm/xenomai/wrappers.h b/kernel/cobalt/arch/x86/ipipe/include/asm/xenomai/wrappers.h
similarity index 100%
rename from kernel/cobalt/arch/x86/include/asm/xenomai/wrappers.h
rename to kernel/cobalt/arch/x86/ipipe/include/asm/xenomai/wrappers.h
diff --git a/kernel/cobalt/arch/x86/machine.c b/kernel/cobalt/arch/x86/ipipe/machine.c
similarity index 100%
rename from kernel/cobalt/arch/x86/machine.c
rename to kernel/cobalt/arch/x86/ipipe/machine.c
diff --git a/kernel/cobalt/arch/x86/smi.c b/kernel/cobalt/arch/x86/ipipe/smi.c
similarity index 100%
rename from kernel/cobalt/arch/x86/smi.c
rename to kernel/cobalt/arch/x86/ipipe/smi.c
diff --git a/kernel/cobalt/arch/x86/thread.c b/kernel/cobalt/arch/x86/ipipe/thread.c
similarity index 100%
rename from kernel/cobalt/arch/x86/thread.c
rename to kernel/cobalt/arch/x86/ipipe/thread.c
diff --git a/scripts/prepare-kernel.sh b/scripts/prepare-kernel.sh
index 1b5fb427d..7dba3d5a5 100755
--- a/scripts/prepare-kernel.sh
+++ b/scripts/prepare-kernel.sh
@@ -147,7 +147,7 @@ generate_patch() {
 }
 
 
-usage='usage: prepare-kernel --linux=<linux-tree> --ipipe=<ipipe-patch> [--arch=<arch>] [--outpatch=<file> [--filterkvers=y|n] [--filterarch=y|n]] [--forcelink] [--default] [--verbose]'
+usage='usage: prepare-kernel --linux=<linux-tree> [--dovetail=<dovetail-patch>]|[--ipipe=<ipipe-patch>] [--arch=<arch>] [--outpatch=<file> [--filterkvers=y|n] [--filterarch=y|n]] [--forcelink] [--default] [--verbose]'
 me=`basename $0`
 
 while test $# -gt 0; do
@@ -157,12 +157,25 @@ while test $# -gt 0; do
 	linux_tree=`eval "echo $linux_tree"`
 	;;
     --adeos=*)
-	ipipe_patch=`echo $1|sed -e 's,^--adeos=\\(.*\\)$,\\1,g'`
-	ipipe_patch=`eval "echo $ipipe_patch"`
+	pipeline_patch=`echo $1|sed -e 's,^--adeos=\\(.*\\)$,\\1,g'`
+	pipeline_patch=`eval "echo $pipeline_patch"`
+	probe_header=include/linux/ipipe.h
+	arch_probe_header=include/asm/ipipe.h
+	pipeline_type=ipipe
 	;;
     --ipipe=*)
-	ipipe_patch=`echo $1|sed -e 's,^--ipipe=\\(.*\\)$,\\1,g'`
-	ipipe_patch=`eval "echo $ipipe_patch"`
+	pipeline_patch=`echo $1|sed -e 's,^--ipipe=\\(.*\\)$,\\1,g'`
+	pipeline_patch=`eval "echo $pipeline_patch"`
+	probe_header=include/linux/ipipe.h
+	arch_probe_header=include/asm/ipipe.h
+	pipeline_type=ipipe
+	;;
+    --dovetail=*)
+	pipeline_patch=`echo $1|sed -e 's,^--dovetail=\\(.*\\)$,\\1,g'`
+	pipeline_patch=`eval "echo $pipeline_patch"`
+	probe_header=include/linux/dovetail.h
+	arch_probe_header=include/asm/dovetail.h
+	pipeline_type=dovetail
 	;;
     --arch=*)
 	linux_arch=`echo $1|sed -e 's,^--arch=\\(.*\\)$,\\1,g'`
@@ -305,51 +318,58 @@ eval linux_`grep '^VERSION =' $linux_tree/Makefile | sed -e 's, ,,g'`
 
 linux_version="$linux_VERSION.$linux_PATCHLEVEL.$linux_SUBLEVEL"
 
+if test x$pipeline_type = x; then
+    if test -r include/linux/ipipe.h; then
+	probe_header=include/linux/ipipe.h
+	arch_probe_header=include/asm/ipipe.h
+	pipeline_type=ipipe
+    elif test -r include/linux/dovetail.h; then
+	probe_header=include/linux/dovetail.h
+	arch_probe_header=include/asm/dovetail.h
+	pipeline_type=dovetail
+    fi
+fi
+
 if test x$verbose = x1; then
 echo "Preparing kernel $linux_version$linux_EXTRAVERSION in $linux_tree..."
 fi
 
-if test -r $linux_tree/include/linux/ipipe.h; then
+if test -r $linux_tree/$probe_header; then
     if test x$verbose = x1; then
-       echo "I-pipe found - bypassing patch."
+       echo "IRQ pipeline found - bypassing patch."
     fi
 else
    if test x$verbose = x1; then
-      echo "$me: no I-pipe support found." >&2
+      echo "$me: no IRQ pipeline support found." >&2
    fi
-   while test x$ipipe_patch = x; do
-      echo -n "I-pipe patch: "
-      read ipipe_patch
-      if test \! -r "$ipipe_patch" -o x$ipipe_patch = x; then
-         echo "$me: cannot read I-pipe patch from $ipipe_patch" >&2
-         ipipe_patch=
+   while test x$pipeline_patch = x; do
+      echo -n "IRQ pipeline patch: "
+      read pipeline_patch
+      if test \! -r "$pipeline_patch" -o x$pipeline_patch = x; then
+         echo "$me: cannot read IRQ pipeline support from $pipeline_patch" >&2
+         pipeline_patch=
       fi
    done
-   patchdir=`dirname $ipipe_patch`; 
+   patchdir=`dirname $pipeline_patch`; 
    patchdir=`cd $patchdir && pwd`
-   ipipe_patch=$patchdir/`basename $ipipe_patch`
+   pipeline_patch=$patchdir/`basename $pipeline_patch`
    curdir=$PWD
-   cd $linux_tree && patch --dry-run -p1 -f < $ipipe_patch || { 
+   cd $linux_tree && patch --dry-run -p1 -f < $pipeline_patch || { 
         cd $curdir;
-        echo "$me: Unable to patch kernel $linux_version$linux_EXTRAVERSION with `basename $ipipe_patch`." >&2
+        echo "$me: Unable to patch kernel $linux_version$linux_EXTRAVERSION with `basename $pipeline_patch`." >&2
         exit 2;
    }
-   patch -p1 -f -s < $ipipe_patch
+   patch -p1 -f -s < $pipeline_patch
    cd $curdir
 fi
 
-if test \! -r $linux_tree/arch/$linux_arch/include/asm/ipipe.h; then
-   echo "$me: $linux_tree has no I-pipe support for $linux_arch" >&2
+if test \! -r $linux_tree/arch/$linux_arch/$arch_probe_header; then
+   echo "$me: $linux_tree has no IRQ pipeline support for $linux_arch" >&2
    exit 2
 fi
 
-ipipe_core=`grep '^#define.*IPIPE_CORE_RELEASE.*' $linux_tree/arch/$linux_arch/include/asm/ipipe.h 2>/dev/null|head -n1|sed -e 's,[^0-9]*\([0-9]*\)$,\1,'`
-if test "x$ipipe_core" = x; then
-    echo "$me: $linux_tree has no I-pipe support for $linux_arch" >&2
-    exit 2
-fi
 if test x$verbose = x1; then
-   echo "I-pipe core/$linux_arch #$ipipe_core installed."
+   echo "IRQ pipeline installed."
 fi
 
 patch_kernelversion_specific="y"
@@ -387,9 +407,9 @@ case $linux_VERSION.$linux_PATCHLEVEL in
 test "x$CONFIG_XENO_REVISION_LEVEL" = "x" && CONFIG_XENO_REVISION_LEVEL=0
 
     if ! grep -q CONFIG_XENOMAI $linux_tree/arch/$linux_arch/Makefile; then
-	p="KBUILD_CFLAGS += -I\$(srctree)/arch/\$(SRCARCH)/xenomai/include -I\$(srctree)/include/xenomai"
+	p="KBUILD_CFLAGS += -I\$(srctree)/arch/\$(SRCARCH)/xenomai/include -I\$(srctree)/arch/\$(SRCARCH)/xenomai/$pipeline_type/include -I\$(srctree)/include/xenomai"
 	(echo; echo $p) | patch_append arch/$linux_arch/Makefile
-	p="core-\$(CONFIG_XENOMAI)	+= arch/$linux_arch/xenomai/"
+	p="core-\$(CONFIG_XENOMAI)	+= arch/$linux_arch/xenomai/$pipeline_type/"
 	echo $p | patch_append arch/$linux_arch/Makefile
     fi
 
@@ -415,7 +435,7 @@ esac
 patch_kernelversion_specific="n"
 patch_architecture_specific="y"
 patch_link r m kernel/cobalt/arch/$linux_arch arch/$linux_arch/xenomai
-patch_link n n kernel/cobalt/include/ipipe arch/$linux_arch/include/ipipe
+patch_link n n kernel/cobalt/include/$pipeline_type arch/$linux_arch/include/$pipeline_type
 patch_architecture_specific="n"
 patch_link n m kernel/cobalt kernel/xenomai
 patch_link n cobalt-core.h kernel/cobalt/trace include/trace/events
@@ -425,11 +445,11 @@ patch_link r n kernel/cobalt/include/asm-generic/xenomai include/asm-generic/xen
 patch_link r n kernel/cobalt/include/linux/xenomai include/linux/xenomai
 patch_link n m kernel/cobalt/posix kernel/xenomai/posix
 patch_link n m kernel/cobalt/rtdm kernel/xenomai/rtdm
-patch_link n m kernel/cobalt/ipipe kernel/xenomai/pipeline
+patch_link n m kernel/cobalt/$pipeline_type kernel/xenomai/pipeline
 patch_link r m kernel/drivers drivers/xenomai
 patch_link n n include/cobalt/kernel include/xenomai/cobalt/kernel
 patch_link r n include/cobalt/kernel/rtdm include/xenomai/rtdm
-patch_link r n include/cobalt/kernel/ipipe/pipeline include/xenomai/pipeline
+patch_link r n include/cobalt/kernel/$pipeline_type/pipeline include/xenomai/pipeline
 patch_link r n include/cobalt/uapi include/xenomai/cobalt/uapi
 patch_link r n include/rtdm/uapi include/xenomai/rtdm/uapi
 patch_link n version.h include/xenomai include/xenomai
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 05/13] cobalt/clock: pipeline: move TSC-related code to the I-pipe section
  2021-01-31 14:45 [PATCH 01/13] cobalt/kernel: pipeline: abstract context switching support Philippe Gerum
                   ` (2 preceding siblings ...)
  2021-01-31 14:45 ` [PATCH 04/13] cobalt/arch: pipeline: move architecture code to pipeline-specific section Philippe Gerum
@ 2021-01-31 14:45 ` Philippe Gerum
  2021-01-31 14:45 ` [PATCH 06/13] cobalt/clock: drop timer calibration Philippe Gerum
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 18+ messages in thread
From: Philippe Gerum @ 2021-01-31 14:45 UTC (permalink / raw)
  To: xenomai

From: Philippe Gerum <rpm@xenomai.org>

Cobalt over Dovetail represents time values as counts of nanoseconds,
dismissing the legacy (hardware) TSC representation entirely. For this
reason, we can move any code which implements TSC/nanosecs conversion
to the I-pipe specific section.

This includes the handler applying CPU frequency updates
(xnclock_update_freq()) which has no purpose over Dovetail, since
these events are transparently dealt with for the proxy device by the
generic clockevent framework.

No functional change is introduced.

Signed-off-by: Philippe Gerum <rpm@xenomai.org>
---
 include/cobalt/kernel/clock.h                |  4 +-
 include/cobalt/kernel/ipipe/pipeline/clock.h |  4 +
 kernel/cobalt/clock.c                        | 80 ++-----------------
 kernel/cobalt/ipipe/clock.c                  | 81 ++++++++++++++++++++
 kernel/cobalt/ipipe/init.c                   |  2 +-
 kernel/cobalt/ipipe/kevents.c                |  3 +-
 6 files changed, 96 insertions(+), 78 deletions(-)

diff --git a/include/cobalt/kernel/clock.h b/include/cobalt/kernel/clock.h
index 2d17c0422..59835951c 100644
--- a/include/cobalt/kernel/clock.h
+++ b/include/cobalt/kernel/clock.h
@@ -348,9 +348,7 @@ static inline void xnclock_init_proc(void) { }
 static inline void xnclock_cleanup_proc(void) { }
 #endif
 
-void xnclock_update_freq(unsigned long long freq);
-
-int xnclock_init(unsigned long long freq);
+int xnclock_init(void);
 
 void xnclock_cleanup(void);
 
diff --git a/include/cobalt/kernel/ipipe/pipeline/clock.h b/include/cobalt/kernel/ipipe/pipeline/clock.h
index eeeae6602..fa7ac2a5e 100644
--- a/include/cobalt/kernel/ipipe/pipeline/clock.h
+++ b/include/cobalt/kernel/ipipe/pipeline/clock.h
@@ -33,4 +33,8 @@ static inline const char *pipeline_clock_name(void)
 
 int pipeline_get_host_time(struct timespec *tp);
 
+void pipeline_update_clock_freq(unsigned long long freq);
+
+void pipeline_init_clock(void);
+
 #endif /* !_COBALT_KERNEL_IPIPE_CLOCK_H */
diff --git a/kernel/cobalt/clock.c b/kernel/cobalt/clock.c
index cae9dd7a1..7d1e00ea1 100644
--- a/kernel/cobalt/clock.c
+++ b/kernel/cobalt/clock.c
@@ -34,22 +34,10 @@
  */
 unsigned long nktimerlat;
 
-static unsigned long long clockfreq;
-
-#ifdef XNARCH_HAVE_LLMULSHFT
-
-static unsigned int tsc_scale, tsc_shift;
-
 #ifdef XNARCH_HAVE_NODIV_LLIMD
 
-static struct xnarch_u32frac tsc_frac;
 static struct xnarch_u32frac bln_frac;
 
-long long xnclock_core_ns_to_ticks(long long ns)
-{
-	return xnarch_nodiv_llimd(ns, tsc_frac.frac, tsc_frac.integ);
-}
-
 unsigned long long xnclock_divrem_billion(unsigned long long value,
 					  unsigned long *rem)
 {
@@ -66,57 +54,17 @@ unsigned long long xnclock_divrem_billion(unsigned long long value,
 	return q;
 }
 
-#else /* !XNARCH_HAVE_NODIV_LLIMD */
-
-long long xnclock_core_ns_to_ticks(long long ns)
-{
-	return xnarch_llimd(ns, 1 << tsc_shift, tsc_scale);
-}
-
-#endif /* !XNARCH_HAVE_NODIV_LLIMD */
-
-xnsticks_t xnclock_core_ticks_to_ns(xnsticks_t ticks)
-{
-	return xnarch_llmulshft(ticks, tsc_scale, tsc_shift);
-}
-
-xnsticks_t xnclock_core_ticks_to_ns_rounded(xnsticks_t ticks)
-{
-	unsigned int shift = tsc_shift - 1;
-	return (xnarch_llmulshft(ticks, tsc_scale, shift) + 1) / 2;
-}
-
-#else  /* !XNARCH_HAVE_LLMULSHFT */
-
-xnsticks_t xnclock_core_ticks_to_ns(xnsticks_t ticks)
-{
-	return xnarch_llimd(ticks, 1000000000, clockfreq);
-}
+#else
 
-xnsticks_t xnclock_core_ticks_to_ns_rounded(xnsticks_t ticks)
-{
-	return (xnarch_llimd(ticks, 1000000000, clockfreq/2) + 1) / 2;
-}
-
-xnsticks_t xnclock_core_ns_to_ticks(xnsticks_t ns)
-{
-	return xnarch_llimd(ns, clockfreq, 1000000000);
-}
-
-#endif /* !XNARCH_HAVE_LLMULSHFT */
-
-#ifndef XNARCH_HAVE_NODIV_LLIMD
 unsigned long long xnclock_divrem_billion(unsigned long long value,
 					  unsigned long *rem)
 {
 	return xnarch_ulldiv(value, 1000000000, rem);
 
 }
+
 #endif /* !XNARCH_HAVE_NODIV_LLIMD */
 
-EXPORT_SYMBOL_GPL(xnclock_core_ticks_to_ns);
-EXPORT_SYMBOL_GPL(xnclock_core_ticks_to_ns_rounded);
-EXPORT_SYMBOL_GPL(xnclock_core_ns_to_ticks);
 EXPORT_SYMBOL_GPL(xnclock_divrem_billion);
 
 DEFINE_PRIVATE_XNLOCK(ratelimit_lock);
@@ -823,23 +771,6 @@ void xnclock_tick(struct xnclock *clock)
 }
 EXPORT_SYMBOL_GPL(xnclock_tick);
 
-void xnclock_update_freq(unsigned long long freq)
-{
-	spl_t s;
-
-	xnlock_get_irqsave(&nklock, s);
-	clockfreq = freq;
-#ifdef XNARCH_HAVE_LLMULSHFT
-	xnarch_init_llmulshft(1000000000, freq, &tsc_scale, &tsc_shift);
-#ifdef XNARCH_HAVE_NODIV_LLIMD
-	xnarch_init_u32frac(&tsc_frac, 1 << tsc_shift, tsc_scale);
-	xnarch_init_u32frac(&bln_frac, 1, 1000000000);
-#endif
-#endif
-	cobalt_pipeline.clock_freq = freq;
-	xnlock_put_irqrestore(&nklock, s);
-}
-
 static int set_core_clock_gravity(struct xnclock *clock,
 				  const struct xnclock_gravity *p)
 {
@@ -880,9 +811,12 @@ void xnclock_cleanup(void)
 	xnclock_deregister(&nkclock);
 }
 
-int __init xnclock_init(unsigned long long freq)
+int __init xnclock_init()
 {
-	xnclock_update_freq(freq);
+#ifdef XNARCH_HAVE_NODIV_LLIMD
+	xnarch_init_u32frac(&bln_frac, 1, 1000000000);
+#endif
+	pipeline_init_clock();
 	nktimerlat = xnarch_timer_calibrate();
 	xnclock_reset_gravity(&nkclock);
 	xnclock_register(&nkclock, &xnsched_realtime_cpus);
diff --git a/kernel/cobalt/ipipe/clock.c b/kernel/cobalt/ipipe/clock.c
index d0135dc7a..606c6bf8c 100644
--- a/kernel/cobalt/ipipe/clock.c
+++ b/kernel/cobalt/ipipe/clock.c
@@ -6,6 +6,66 @@
 
 #include <cobalt/kernel/clock.h>
 #include <cobalt/kernel/vdso.h>
+#include <cobalt/kernel/arith.h>
+#include <pipeline/machine.h>
+
+static unsigned long long clockfreq;
+
+#ifdef XNARCH_HAVE_LLMULSHFT
+
+static unsigned int tsc_scale, tsc_shift;
+
+#ifdef XNARCH_HAVE_NODIV_LLIMD
+
+static struct xnarch_u32frac tsc_frac;
+
+long long xnclock_core_ns_to_ticks(long long ns)
+{
+	return xnarch_nodiv_llimd(ns, tsc_frac.frac, tsc_frac.integ);
+}
+
+#else /* !XNARCH_HAVE_NODIV_LLIMD */
+
+long long xnclock_core_ns_to_ticks(long long ns)
+{
+	return xnarch_llimd(ns, 1 << tsc_shift, tsc_scale);
+}
+
+#endif /* !XNARCH_HAVE_NODIV_LLIMD */
+
+xnsticks_t xnclock_core_ticks_to_ns(xnsticks_t ticks)
+{
+	return xnarch_llmulshft(ticks, tsc_scale, tsc_shift);
+}
+
+xnsticks_t xnclock_core_ticks_to_ns_rounded(xnsticks_t ticks)
+{
+	unsigned int shift = tsc_shift - 1;
+	return (xnarch_llmulshft(ticks, tsc_scale, shift) + 1) / 2;
+}
+
+#else  /* !XNARCH_HAVE_LLMULSHFT */
+
+xnsticks_t xnclock_core_ticks_to_ns(xnsticks_t ticks)
+{
+	return xnarch_llimd(ticks, 1000000000, clockfreq);
+}
+
+xnsticks_t xnclock_core_ticks_to_ns_rounded(xnsticks_t ticks)
+{
+	return (xnarch_llimd(ticks, 1000000000, clockfreq/2) + 1) / 2;
+}
+
+xnsticks_t xnclock_core_ns_to_ticks(xnsticks_t ns)
+{
+	return xnarch_llimd(ns, clockfreq, 1000000000);
+}
+
+#endif /* !XNARCH_HAVE_LLMULSHFT */
+
+EXPORT_SYMBOL_GPL(xnclock_core_ticks_to_ns);
+EXPORT_SYMBOL_GPL(xnclock_core_ticks_to_ns_rounded);
+EXPORT_SYMBOL_GPL(xnclock_core_ns_to_ticks);
 
 int pipeline_get_host_time(struct timespec *tp)
 {
@@ -60,3 +120,24 @@ int pipeline_get_host_time(struct timespec *tp)
 	return -EINVAL;
 #endif
 }
+
+void pipeline_update_clock_freq(unsigned long long freq)
+{
+	spl_t s;
+
+	xnlock_get_irqsave(&nklock, s);
+	clockfreq = freq;
+#ifdef XNARCH_HAVE_LLMULSHFT
+	xnarch_init_llmulshft(1000000000, freq, &tsc_scale, &tsc_shift);
+#ifdef XNARCH_HAVE_NODIV_LLIMD
+	xnarch_init_u32frac(&tsc_frac, 1 << tsc_shift, tsc_scale);
+#endif
+#endif
+	cobalt_pipeline.clock_freq = freq;
+	xnlock_put_irqrestore(&nklock, s);
+}
+
+void pipeline_init_clock(void)
+{
+	pipeline_update_clock_freq(cobalt_pipeline.clock_freq);
+}
diff --git a/kernel/cobalt/ipipe/init.c b/kernel/cobalt/ipipe/init.c
index d61d150d7..1dde7bc4b 100644
--- a/kernel/cobalt/ipipe/init.c
+++ b/kernel/cobalt/ipipe/init.c
@@ -61,7 +61,7 @@ int __init pipeline_init(void)
 			  (ipipe_irq_handler_t)__xnsched_run_handler,
 			  NULL, NULL);
 
-	ret = xnclock_init(cobalt_pipeline.clock_freq);
+	ret = xnclock_init();
 	if (ret)
 		goto fail_clock;
 
diff --git a/kernel/cobalt/ipipe/kevents.c b/kernel/cobalt/ipipe/kevents.c
index e1e1e3a95..f0314cd44 100644
--- a/kernel/cobalt/ipipe/kevents.c
+++ b/kernel/cobalt/ipipe/kevents.c
@@ -16,6 +16,7 @@
 #include <pipeline/kevents.h>
 #include <cobalt/kernel/sched.h>
 #include <cobalt/kernel/thread.h>
+#include <cobalt/kernel/clock.h>
 #include <cobalt/kernel/vdso.h>
 #include <rtdm/driver.h>
 #include <trace/events/cobalt-core.h>
@@ -675,7 +676,7 @@ static inline int handle_clockfreq_event(unsigned int *p)
 {
 	unsigned int newfreq = *p;
 
-	xnclock_update_freq(newfreq);
+	pipeline_update_clock_freq(newfreq);
 
 	return KEVENT_PROPAGATE;
 }
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 06/13] cobalt/clock: drop timer calibration
  2021-01-31 14:45 [PATCH 01/13] cobalt/kernel: pipeline: abstract context switching support Philippe Gerum
                   ` (3 preceding siblings ...)
  2021-01-31 14:45 ` [PATCH 05/13] cobalt/clock: pipeline: move TSC-related code to the I-pipe section Philippe Gerum
@ 2021-01-31 14:45 ` Philippe Gerum
  2021-02-01 18:14   ` Jan Kiszka
  2021-01-31 14:45 ` [PATCH 07/13] cobalt/arm: ipipe: remove obsolete calibration handler Philippe Gerum
                   ` (6 subsequent siblings)
  11 siblings, 1 reply; 18+ messages in thread
From: Philippe Gerum @ 2021-01-31 14:45 UTC (permalink / raw)
  To: xenomai

From: Philippe Gerum <rpm@xenomai.org>

The calibrated timer setup time is currently accounted for in the
timer gravity triplet (.user, also used as default .irq latency),
exclusively. This forces in a dynamically calculated parameter with no
way to override it. Meanwhile, this value would be already included in
every gravity value which autotune may determine, so this setting is
pretty much redundant.

Drop nktimerlat and the requirement for the machine section to provide
a timer calibration handler, we don't need these.

Signed-off-by: Philippe Gerum <rpm@xenomai.org>
---
 include/cobalt/kernel/clock.h                  | 2 --
 include/cobalt/kernel/ipipe/pipeline/machine.h | 6 ------
 kernel/cobalt/clock.c                          | 7 -------
 3 files changed, 15 deletions(-)

diff --git a/include/cobalt/kernel/clock.h b/include/cobalt/kernel/clock.h
index 59835951c..bbf34c53c 100644
--- a/include/cobalt/kernel/clock.h
+++ b/include/cobalt/kernel/clock.h
@@ -104,8 +104,6 @@ struct xnclock_ratelimit_state {
 
 extern struct xnclock nkclock;
 
-extern unsigned long nktimerlat;
-
 int xnclock_register(struct xnclock *clock,
 		     const cpumask_t *affinity);
 
diff --git a/include/cobalt/kernel/ipipe/pipeline/machine.h b/include/cobalt/kernel/ipipe/pipeline/machine.h
index 32d5cd2a2..a5a5197e9 100644
--- a/include/cobalt/kernel/ipipe/pipeline/machine.h
+++ b/include/cobalt/kernel/ipipe/pipeline/machine.h
@@ -24,7 +24,6 @@ struct cobalt_machine {
 	int (*late_init)(void);
 	void (*cleanup)(void);
 	void (*prefault)(struct vm_area_struct *vma);
-	unsigned long (*calibrate)(void);
 	const char *const *fault_labels;
 };
 
@@ -46,11 +45,6 @@ struct cobalt_pipeline {
 #endif
 };
 
-static inline unsigned long xnarch_timer_calibrate(void)
-{
-	return cobalt_machine.calibrate();
-}
-
 int pipeline_init(void);
 
 int pipeline_late_init(void);
diff --git a/kernel/cobalt/clock.c b/kernel/cobalt/clock.c
index 7d1e00ea1..bf24e1693 100644
--- a/kernel/cobalt/clock.c
+++ b/kernel/cobalt/clock.c
@@ -32,7 +32,6 @@
  *
  * @{
  */
-unsigned long nktimerlat;
 
 #ifdef XNARCH_HAVE_NODIV_LLIMD
 
@@ -456,8 +455,6 @@ void print_core_clock_status(struct xnclock *clock,
 	xnvfile_printf(it, "%8s: timer=%s, clock=%s\n",
 		       "devices", pipeline_timer_name(), pipeline_clock_name());
 	xnvfile_printf(it, "%8s: %s\n", "watchdog", wd_status);
-	xnvfile_printf(it, "%8s: %Lu\n", "setup",
-		       xnclock_ticks_to_ns(&nkclock, nktimerlat));
 }
 
 static int clock_show(struct xnvfile_regular_iterator *it, void *data)
@@ -784,11 +781,8 @@ static void reset_core_clock_gravity(struct xnclock *clock)
 	struct xnclock_gravity gravity;
 
 	xnarch_get_latencies(&gravity);
-	gravity.user += nktimerlat;
 	if (gravity.kernel == 0)
 		gravity.kernel = gravity.user;
-	if (gravity.irq == 0)
-		gravity.irq = nktimerlat;
 	set_core_clock_gravity(clock, &gravity);
 }
 
@@ -817,7 +811,6 @@ int __init xnclock_init()
 	xnarch_init_u32frac(&bln_frac, 1, 1000000000);
 #endif
 	pipeline_init_clock();
-	nktimerlat = xnarch_timer_calibrate();
 	xnclock_reset_gravity(&nkclock);
 	xnclock_register(&nkclock, &xnsched_realtime_cpus);
 
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 07/13] cobalt/arm: ipipe: remove obsolete calibration handler
  2021-01-31 14:45 [PATCH 01/13] cobalt/kernel: pipeline: abstract context switching support Philippe Gerum
                   ` (4 preceding siblings ...)
  2021-01-31 14:45 ` [PATCH 06/13] cobalt/clock: drop timer calibration Philippe Gerum
@ 2021-01-31 14:45 ` Philippe Gerum
  2021-01-31 14:45 ` [PATCH 08/13] cobalt/arm64: " Philippe Gerum
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 18+ messages in thread
From: Philippe Gerum @ 2021-01-31 14:45 UTC (permalink / raw)
  To: xenomai

From: Philippe Gerum <rpm@xenomai.org>

Signed-off-by: Philippe Gerum <rpm@xenomai.org>
---
 kernel/cobalt/arch/arm/ipipe/machine.c | 59 --------------------------
 1 file changed, 59 deletions(-)

diff --git a/kernel/cobalt/arch/arm/ipipe/machine.c b/kernel/cobalt/arch/arm/ipipe/machine.c
index 721567182..0fd48cae1 100644
--- a/kernel/cobalt/arch/arm/ipipe/machine.c
+++ b/kernel/cobalt/arch/arm/ipipe/machine.c
@@ -19,13 +19,8 @@
  */
 
 #include <linux/mm.h>
-#include <linux/ipipe_tickdev.h>
-#include <cobalt/kernel/arith.h>
-#include <asm/cacheflush.h>
 #include <asm/xenomai/machine.h>
 
-#define CALIBRATION_LOOPS 10
-
 static void mach_arm_prefault(struct vm_area_struct *vma)
 {
 	unsigned long addr;
@@ -43,59 +38,6 @@ static void mach_arm_prefault(struct vm_area_struct *vma)
 	}
 }
 
-static unsigned long mach_arm_calibrate(void)
-{
-	unsigned long delay = (cobalt_pipeline.timer_freq + HZ / 2) / HZ;
-	unsigned long long start, end, sum = 0, sum_sq = 0;
-	unsigned long result, flags, tsc_lat;
-	long long diff;
-	int i, j;
-
-	flags = ipipe_critical_enter(NULL);
-
-	/*
-	 * Hw interrupts off, other CPUs quiesced, no migration
-	 * possible. We can now fiddle with the timer chip (per-cpu
-	 * local or global, ipipe_timer_set() will handle this
-	 * transparently).
-	 */
-	ipipe_read_tsc(start);
-	barrier();
-	ipipe_read_tsc(end);
-	tsc_lat = end - start;
-	barrier();
-
-	for (i = 0; i < CALIBRATION_LOOPS; i++) {
-		flush_cache_all();
-		for (j = 0; j < CALIBRATION_LOOPS; j++) {
-			ipipe_read_tsc(start);
-			barrier();
-			ipipe_timer_set(delay);
-			barrier();
-			ipipe_read_tsc(end);
-			diff = end - start - tsc_lat;
-			if (diff > 0) {
-				sum += diff;
-				sum_sq += diff * diff;
-			}
-		}
-	}
-
-	ipipe_critical_exit(flags);
-
-	/* Use average + standard deviation as timer programming latency. */
-	do_div(sum, CALIBRATION_LOOPS * CALIBRATION_LOOPS);
-	do_div(sum_sq, CALIBRATION_LOOPS * CALIBRATION_LOOPS);
-	result = sum + int_sqrt(sum_sq - sum * sum) + 1;
-	/*
-	 * Reset the max trace, since it contains the calibration time
-	 * now.
-	 */
-	ipipe_trace_max_reset();
-
-	return result;
-}
-
 static const char *const fault_labels[] = {
 	[IPIPE_TRAP_ACCESS] = "Data or instruction access",
 	[IPIPE_TRAP_SECTION] = "Section fault",
@@ -116,7 +58,6 @@ struct cobalt_machine cobalt_machine = {
 	.init = NULL,
 	.late_init = NULL,
 	.cleanup = NULL,
-	.calibrate = mach_arm_calibrate,
 	.prefault = mach_arm_prefault,
 	.fault_labels = fault_labels,
 };
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 08/13] cobalt/arm64: ipipe: remove obsolete calibration handler
  2021-01-31 14:45 [PATCH 01/13] cobalt/kernel: pipeline: abstract context switching support Philippe Gerum
                   ` (5 preceding siblings ...)
  2021-01-31 14:45 ` [PATCH 07/13] cobalt/arm: ipipe: remove obsolete calibration handler Philippe Gerum
@ 2021-01-31 14:45 ` Philippe Gerum
  2021-01-31 14:45 ` [PATCH 09/13] cobalt/x86: " Philippe Gerum
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 18+ messages in thread
From: Philippe Gerum @ 2021-01-31 14:45 UTC (permalink / raw)
  To: xenomai

From: Philippe Gerum <rpm@xenomai.org>

Signed-off-by: Philippe Gerum <rpm@xenomai.org>
---
 kernel/cobalt/arch/arm64/ipipe/machine.c | 58 ------------------------
 1 file changed, 58 deletions(-)

diff --git a/kernel/cobalt/arch/arm64/ipipe/machine.c b/kernel/cobalt/arch/arm64/ipipe/machine.c
index cb2867492..a215e4caa 100644
--- a/kernel/cobalt/arch/arm64/ipipe/machine.c
+++ b/kernel/cobalt/arch/arm64/ipipe/machine.c
@@ -19,13 +19,8 @@
  */
 
 #include <linux/mm.h>
-#include <linux/ipipe_tickdev.h>
-#include <cobalt/kernel/arith.h>
-#include <asm/cacheflush.h>
 #include <asm/xenomai/machine.h>
 
-#define CALIBRATION_LOOPS 10
-
 static void mach_arm_prefault(struct vm_area_struct *vma)
 {
 	unsigned long addr;
@@ -43,58 +38,6 @@ static void mach_arm_prefault(struct vm_area_struct *vma)
 	}
 }
 
-static unsigned long mach_arm_calibrate(void)
-{
-	unsigned long delay = (cobalt_pipeline.timer_freq + HZ / 2) / HZ;
-	unsigned long long start, end, sum = 0, sum_sq = 0;
-	unsigned long result, flags, tsc_lat;
-	long long diff;
-	int i, j;
-
-	flags = ipipe_critical_enter(NULL);
-
-	/*
-	 * Hw interrupts off, other CPUs quiesced, no migration
-	 * possible. We can now fiddle with the timer chip (per-cpu
-	 * local or global, ipipe_timer_set() will handle this
-	 * transparently).
-	 */
-	ipipe_read_tsc(start);
-	barrier();
-	ipipe_read_tsc(end);
-	tsc_lat = end - start;
-	barrier();
-
-	for (i = 0; i < CALIBRATION_LOOPS; i++) {
-		for (j = 0; j < CALIBRATION_LOOPS; j++) {
-			ipipe_read_tsc(start);
-			barrier();
-			ipipe_timer_set(delay);
-			barrier();
-			ipipe_read_tsc(end);
-			diff = end - start - tsc_lat;
-			if (diff > 0) {
-				sum += diff;
-				sum_sq += diff * diff;
-			}
-		}
-	}
-
-	ipipe_critical_exit(flags);
-
-	/* Use average + standard deviation as timer programming latency. */
-	do_div(sum, CALIBRATION_LOOPS * CALIBRATION_LOOPS);
-	do_div(sum_sq, CALIBRATION_LOOPS * CALIBRATION_LOOPS);
-	result = sum + int_sqrt(sum_sq - sum * sum) + 1;
-	/*
-	 * Reset the max trace, since it contains the calibration time
-	 * now.
-	 */
-	ipipe_trace_max_reset();
-
-	return result;
-}
-
 static const char *const fault_labels[] = {
 	[IPIPE_TRAP_ACCESS] = "Data or instruction access",
 	[IPIPE_TRAP_SECTION] = "Section fault",
@@ -115,7 +58,6 @@ struct cobalt_machine cobalt_machine = {
 	.init = NULL,
 	.late_init = NULL,
 	.cleanup = NULL,
-	.calibrate = mach_arm_calibrate,
 	.prefault = mach_arm_prefault,
 	.fault_labels = fault_labels,
 };
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 09/13] cobalt/x86: ipipe: remove obsolete calibration handler
  2021-01-31 14:45 [PATCH 01/13] cobalt/kernel: pipeline: abstract context switching support Philippe Gerum
                   ` (6 preceding siblings ...)
  2021-01-31 14:45 ` [PATCH 08/13] cobalt/arm64: " Philippe Gerum
@ 2021-01-31 14:45 ` Philippe Gerum
  2021-01-31 14:45 ` [PATCH 10/13] cobalt/powerpc: " Philippe Gerum
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 18+ messages in thread
From: Philippe Gerum @ 2021-01-31 14:45 UTC (permalink / raw)
  To: xenomai

From: Philippe Gerum <rpm@xenomai.org>

Signed-off-by: Philippe Gerum <rpm@xenomai.org>
---
 kernel/cobalt/arch/x86/ipipe/machine.c | 39 +-------------------------
 1 file changed, 1 insertion(+), 38 deletions(-)

diff --git a/kernel/cobalt/arch/x86/ipipe/machine.c b/kernel/cobalt/arch/x86/ipipe/machine.c
index 4b25486da..95d2ab2ff 100644
--- a/kernel/cobalt/arch/x86/ipipe/machine.c
+++ b/kernel/cobalt/arch/x86/ipipe/machine.c
@@ -17,11 +17,9 @@
  *   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  *   02111-1307, USA.
  */
-#include <linux/ipipe_tickdev.h>
-#include <cobalt/kernel/arith.h>
-#include <asm/xenomai/syscall.h>
 #include <asm/xenomai/machine.h>
 #include <asm/xenomai/thread.h>
+#include <asm/xenomai/syscall.h>
 #include <asm/xenomai/smi.h>
 #include <asm/xenomai/c1e.h>
 
@@ -44,40 +42,6 @@ long strncpy_from_user_nocheck(char *dst, const char __user *src, long count)
 }
 EXPORT_SYMBOL_GPL(strncpy_from_user_nocheck);
 
-static unsigned long mach_x86_calibrate(void)
-{
-	unsigned long delay = (cobalt_pipeline.timer_freq + HZ / 2) / HZ;
-	unsigned long long t0, t1, dt;
-	unsigned long flags;
-	int i;
-
-	flags = ipipe_critical_enter(NULL);
-
-	ipipe_timer_set(delay);
-
-	ipipe_read_tsc(t0);
-
-	for (i = 0; i < 100; i++)
-		ipipe_timer_set(delay);
-
-	ipipe_read_tsc(t1);
-	dt = t1 - t0;
-
-	ipipe_critical_exit(flags);
-
-	/*
-	 * Reset the max trace, since it contains the calibration time
-	 * now.
-	 */
-	ipipe_trace_max_reset();
-
-	/*
-	 * Compute average with a 5% margin to avoid negative
-	 * latencies with PIT.
-	 */
-	return xnarch_ulldiv(dt, i + 5, NULL);
-}
-
 static int mach_x86_init(void)
 {
 	int ret;
@@ -128,7 +92,6 @@ struct cobalt_machine cobalt_machine = {
 	.init = mach_x86_init,
 	.late_init = NULL,
 	.cleanup = mach_x86_cleanup,
-	.calibrate = mach_x86_calibrate,
 	.prefault = NULL,
 	.fault_labels = fault_labels,
 };
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 10/13] cobalt/powerpc: ipipe: remove obsolete calibration handler
  2021-01-31 14:45 [PATCH 01/13] cobalt/kernel: pipeline: abstract context switching support Philippe Gerum
                   ` (7 preceding siblings ...)
  2021-01-31 14:45 ` [PATCH 09/13] cobalt/x86: " Philippe Gerum
@ 2021-01-31 14:45 ` Philippe Gerum
  2021-01-31 14:45 ` [PATCH 11/13] cobalt/machine: ipipe: drop timer frequency setting Philippe Gerum
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 18+ messages in thread
From: Philippe Gerum @ 2021-01-31 14:45 UTC (permalink / raw)
  To: xenomai

From: Philippe Gerum <rpm@xenomai.org>

Signed-off-by: Philippe Gerum <rpm@xenomai.org>
---
 kernel/cobalt/arch/powerpc/ipipe/machine.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/kernel/cobalt/arch/powerpc/ipipe/machine.c b/kernel/cobalt/arch/powerpc/ipipe/machine.c
index 2e1643a24..14e2c4f90 100644
--- a/kernel/cobalt/arch/powerpc/ipipe/machine.c
+++ b/kernel/cobalt/arch/powerpc/ipipe/machine.c
@@ -24,11 +24,6 @@
 #include <asm/cputable.h>
 #include <asm/xenomai/machine.h>
 
-static unsigned long mach_powerpc_calibrate(void)
-{
-	return 5;	/* 5 clock cycles. */
-}
-
 static int mach_powerpc_init(void)
 {
 #ifdef CONFIG_ALTIVEC
@@ -67,7 +62,6 @@ struct cobalt_machine cobalt_machine = {
 	.init = mach_powerpc_init,
 	.late_init = NULL,
 	.cleanup = NULL,
-	.calibrate = mach_powerpc_calibrate,
 	.prefault = NULL,
 	.fault_labels = fault_labels,
 };
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 11/13] cobalt/machine: ipipe: drop timer frequency setting
  2021-01-31 14:45 [PATCH 01/13] cobalt/kernel: pipeline: abstract context switching support Philippe Gerum
                   ` (8 preceding siblings ...)
  2021-01-31 14:45 ` [PATCH 10/13] cobalt/powerpc: " Philippe Gerum
@ 2021-01-31 14:45 ` Philippe Gerum
  2021-01-31 14:45 ` [PATCH 12/13] cobalt/init: ipipe: remove clock frequency override Philippe Gerum
  2021-01-31 14:45 ` [PATCH 13/13] cobalt/assert: pipeline: add TODO() marker Philippe Gerum
  11 siblings, 0 replies; 18+ messages in thread
From: Philippe Gerum @ 2021-01-31 14:45 UTC (permalink / raw)
  To: xenomai

From: Philippe Gerum <rpm@xenomai.org>

The only user of the timer frequency setting was the machine-specific
timer calibration handler, which is now gone. Therefore we don't need
to know the timer frequency anymore. As a consequence, we don't care
about overriding its value as determined by the I-pipe either.

Let's drop all of these antiquated bits.

Signed-off-by: Philippe Gerum <rpm@xenomai.org>
---
 doc/asciidoc/MIGRATION.adoc                    | 1 -
 doc/asciidoc/README.INSTALL.adoc               | 7 -------
 include/cobalt/kernel/ipipe/pipeline/machine.h | 1 -
 kernel/cobalt/ipipe/init.c                     | 7 -------
 4 files changed, 16 deletions(-)

diff --git a/doc/asciidoc/MIGRATION.adoc b/doc/asciidoc/MIGRATION.adoc
index cf1346415..ced356548 100644
--- a/doc/asciidoc/MIGRATION.adoc
+++ b/doc/asciidoc/MIGRATION.adoc
@@ -76,7 +76,6 @@ System parameters renamed::
 * xeno_hal.supported_cpus -> xenomai.supported_cpus
 * xeno_hal.clockfreq -> xenomai.clockfreq
 * xeno_hal.disable -> xenomai.state=disabled
-* xeno_hal.timerfreq -> xenomai.timerfreq
 * xeno_hal.cpufreq -> xenomai.cpufreq
 * xeno_nucleus.watchdog_timeout -> xenomai.watchdog_timeout
 * xeno_nucleus.xenomai_gid -> xenomai.allowed_group
diff --git a/doc/asciidoc/README.INSTALL.adoc b/doc/asciidoc/README.INSTALL.adoc
index cbd2adcd5..fc3f52964 100644
--- a/doc/asciidoc/README.INSTALL.adoc
+++ b/doc/asciidoc/README.INSTALL.adoc
@@ -154,13 +154,6 @@ when initializing. It is strongly recommended *not* to use this option
 unless you really know what you are doing. This value is expressed in
 HZ. | 0 (=calibrated)
 
-|xenomai.timerfreq=<hz-freq> | Override the real-time timer frequency
-used in programming timer shots with the given value. The most
-accurate value is normally determined by the Cobalt core automatically
-when initializing. It is strongly recommended *not* to use this option
-unless you really know what you are doing. This value is expressed in
-HZ. | 0 (=calibrated)
-
 |xenomai.smi=<state> | *x86-specific*: Set the state of the SMI
 workaround. The possible values are _disabled_, _detect_ and
 _enabled_. See the discussion about link:dealing-with-x86-SMI[SMIs]
diff --git a/include/cobalt/kernel/ipipe/pipeline/machine.h b/include/cobalt/kernel/ipipe/pipeline/machine.h
index a5a5197e9..062722a02 100644
--- a/include/cobalt/kernel/ipipe/pipeline/machine.h
+++ b/include/cobalt/kernel/ipipe/pipeline/machine.h
@@ -37,7 +37,6 @@ DECLARE_PER_CPU(struct cobalt_machine_cpudata, cobalt_machine_cpudata);
 
 struct cobalt_pipeline {
 	struct ipipe_domain domain;
-	unsigned long timer_freq;
 	unsigned long clock_freq;
 	unsigned int escalate_virq;
 #ifdef CONFIG_SMP
diff --git a/kernel/cobalt/ipipe/init.c b/kernel/cobalt/ipipe/init.c
index 1dde7bc4b..2533d99ba 100644
--- a/kernel/cobalt/ipipe/init.c
+++ b/kernel/cobalt/ipipe/init.c
@@ -11,9 +11,6 @@
 #include <cobalt/kernel/sched.h>
 #include <cobalt/kernel/clock.h>
 
-static unsigned long timerfreq_arg;
-module_param_named(timerfreq, timerfreq_arg, ulong, 0444);
-
 static unsigned long clockfreq_arg;
 module_param_named(clockfreq, clockfreq_arg, ulong, 0444);
 
@@ -28,9 +25,6 @@ int __init pipeline_init(void)
 
 	ipipe_get_sysinfo(&sysinfo);
 
-	if (timerfreq_arg == 0)
-		timerfreq_arg = sysinfo.sys_hrtimer_freq;
-
 	if (clockfreq_arg == 0)
 		clockfreq_arg = sysinfo.sys_hrclock_freq;
 
@@ -39,7 +33,6 @@ int __init pipeline_init(void)
 		return -ENODEV;
 	}
 
-	cobalt_pipeline.timer_freq = timerfreq_arg;
 	cobalt_pipeline.clock_freq = clockfreq_arg;
 
 	if (cobalt_machine.init) {
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 12/13] cobalt/init: ipipe: remove clock frequency override
  2021-01-31 14:45 [PATCH 01/13] cobalt/kernel: pipeline: abstract context switching support Philippe Gerum
                   ` (9 preceding siblings ...)
  2021-01-31 14:45 ` [PATCH 11/13] cobalt/machine: ipipe: drop timer frequency setting Philippe Gerum
@ 2021-01-31 14:45 ` Philippe Gerum
  2021-01-31 14:45 ` [PATCH 13/13] cobalt/assert: pipeline: add TODO() marker Philippe Gerum
  11 siblings, 0 replies; 18+ messages in thread
From: Philippe Gerum @ 2021-01-31 14:45 UTC (permalink / raw)
  To: xenomai

From: Philippe Gerum <rpm@xenomai.org>

Regarding the frequency of the clock hardware, the kernel knows
better. This parameter dates back to the dark ages when the kernel
might not have detected variations in (per-CPU) clock frequency, which
is no more an issue nowadays.

Actually, we do want to rely on the non-trivial logic the kernel has
to figure out that value dynamically for us.

So let's drop the user override for this parameter.

Signed-off-by: Philippe Gerum <rpm@xenomai.org>
---
 doc/asciidoc/MIGRATION.adoc      |  1 -
 doc/asciidoc/README.INSTALL.adoc |  7 -------
 kernel/cobalt/ipipe/init.c       | 13 +------------
 3 files changed, 1 insertion(+), 20 deletions(-)

diff --git a/doc/asciidoc/MIGRATION.adoc b/doc/asciidoc/MIGRATION.adoc
index ced356548..dce7f40e9 100644
--- a/doc/asciidoc/MIGRATION.adoc
+++ b/doc/asciidoc/MIGRATION.adoc
@@ -74,7 +74,6 @@ enabled (default), unless *linuxthreads* are used instead of *NPTL*.
 System parameters renamed::
 
 * xeno_hal.supported_cpus -> xenomai.supported_cpus
-* xeno_hal.clockfreq -> xenomai.clockfreq
 * xeno_hal.disable -> xenomai.state=disabled
 * xeno_hal.cpufreq -> xenomai.cpufreq
 * xeno_nucleus.watchdog_timeout -> xenomai.watchdog_timeout
diff --git a/doc/asciidoc/README.INSTALL.adoc b/doc/asciidoc/README.INSTALL.adoc
index fc3f52964..da96686b4 100644
--- a/doc/asciidoc/README.INSTALL.adoc
+++ b/doc/asciidoc/README.INSTALL.adoc
@@ -147,13 +147,6 @@ documentation about the
 link:../documentation/xenomai-3/html/man1/corectl/index.html[corectl(1)]
 utility for a description of these states. | enabled
 
-|xenomai.clockfreq=<hz-freq> | Override the real-time clock frequency
-used in measuring time intervals with the given value. The most
-accurate value is normally determined by the Cobalt core automatically
-when initializing. It is strongly recommended *not* to use this option
-unless you really know what you are doing. This value is expressed in
-HZ. | 0 (=calibrated)
-
 |xenomai.smi=<state> | *x86-specific*: Set the state of the SMI
 workaround. The possible values are _disabled_, _detect_ and
 _enabled_. See the discussion about link:dealing-with-x86-SMI[SMIs]
diff --git a/kernel/cobalt/ipipe/init.c b/kernel/cobalt/ipipe/init.c
index 2533d99ba..1b3696b2f 100644
--- a/kernel/cobalt/ipipe/init.c
+++ b/kernel/cobalt/ipipe/init.c
@@ -11,9 +11,6 @@
 #include <cobalt/kernel/sched.h>
 #include <cobalt/kernel/clock.h>
 
-static unsigned long clockfreq_arg;
-module_param_named(clockfreq, clockfreq_arg, ulong, 0444);
-
 int __init pipeline_init(void)
 {
 	struct ipipe_sysinfo sysinfo;
@@ -25,15 +22,7 @@ int __init pipeline_init(void)
 
 	ipipe_get_sysinfo(&sysinfo);
 
-	if (clockfreq_arg == 0)
-		clockfreq_arg = sysinfo.sys_hrclock_freq;
-
-	if (clockfreq_arg == 0) {
-		printk(XENO_ERR "null clock frequency? Aborting.\n");
-		return -ENODEV;
-	}
-
-	cobalt_pipeline.clock_freq = clockfreq_arg;
+	cobalt_pipeline.clock_freq = sysinfo.sys_hrclock_freq;
 
 	if (cobalt_machine.init) {
 		ret = cobalt_machine.init();
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 13/13] cobalt/assert: pipeline: add TODO() marker
  2021-01-31 14:45 [PATCH 01/13] cobalt/kernel: pipeline: abstract context switching support Philippe Gerum
                   ` (10 preceding siblings ...)
  2021-01-31 14:45 ` [PATCH 12/13] cobalt/init: ipipe: remove clock frequency override Philippe Gerum
@ 2021-01-31 14:45 ` Philippe Gerum
  2021-02-01 18:20   ` Jan Kiszka
  11 siblings, 1 reply; 18+ messages in thread
From: Philippe Gerum @ 2021-01-31 14:45 UTC (permalink / raw)
  To: xenomai

From: Philippe Gerum <rpm@xenomai.org>

As its name suggests, TODO() can be added to the code in order to
highlight a place where some implementation bits are known to be
missing. Turning on CONFIG_XENO_TODO reveals the places where such
markers might linger by triggering a build time assertion, so that
they don't go unnoticed.

We may drop this helper when the port to Dovetail is complete.

Signed-off-by: Philippe Gerum <rpm@xenomai.org>
---
 include/cobalt/kernel/assert.h | 2 ++
 kernel/cobalt/Kconfig          | 6 ++++++
 2 files changed, 8 insertions(+)

diff --git a/include/cobalt/kernel/assert.h b/include/cobalt/kernel/assert.h
index 7d9433abc..8d004476b 100644
--- a/include/cobalt/kernel/assert.h
+++ b/include/cobalt/kernel/assert.h
@@ -58,6 +58,8 @@
 	do { } while (0)
 #endif
 
+#define TODO()    BUILD_BUG_ON(IS_ENABLED(CONFIG_XENO_TODO))
+
 #define primary_mode_only()	XENO_BUG_ON(CONTEXT, is_secondary_domain())
 #define secondary_mode_only()	XENO_BUG_ON(CONTEXT, !is_secondary_domain())
 #define interrupt_only()	XENO_BUG_ON(CONTEXT, !xnsched_interrupt_p())
diff --git a/kernel/cobalt/Kconfig b/kernel/cobalt/Kconfig
index ead4740c1..a266011d4 100644
--- a/kernel/cobalt/Kconfig
+++ b/kernel/cobalt/Kconfig
@@ -485,3 +485,9 @@ config XENO_OPT_WATCHDOG_TIMEOUT
 	  Watchdog timeout value (in seconds).
 
 endif # XENO_OPT_DEBUG
+
+config XENO_TODO
+	bool "Reveal TODO places"
+	help
+	  This option causes a build time assertion to trigger
+	  when the TODO() marker is found in the compiled code.
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 18+ messages in thread

* Re: [PATCH 06/13] cobalt/clock: drop timer calibration
  2021-01-31 14:45 ` [PATCH 06/13] cobalt/clock: drop timer calibration Philippe Gerum
@ 2021-02-01 18:14   ` Jan Kiszka
  2021-02-02 16:26     ` Philippe Gerum
  0 siblings, 1 reply; 18+ messages in thread
From: Jan Kiszka @ 2021-02-01 18:14 UTC (permalink / raw)
  To: Philippe Gerum, xenomai

On 31.01.21 15:45, Philippe Gerum wrote:
> From: Philippe Gerum <rpm@xenomai.org>
> 
> The calibrated timer setup time is currently accounted for in the
> timer gravity triplet (.user, also used as default .irq latency),
> exclusively. This forces in a dynamically calculated parameter with no
> way to override it. Meanwhile, this value would be already included in
> every gravity value which autotune may determine, so this setting is
> pretty much redundant.
> 
> Drop nktimerlat and the requirement for the machine section to provide
> a timer calibration handler, we don't need these.
> 

Do you recall the history of this features? Was it first, and then
autotune came along, silently obsoleting it?

Jan

> Signed-off-by: Philippe Gerum <rpm@xenomai.org>
> ---
>  include/cobalt/kernel/clock.h                  | 2 --
>  include/cobalt/kernel/ipipe/pipeline/machine.h | 6 ------
>  kernel/cobalt/clock.c                          | 7 -------
>  3 files changed, 15 deletions(-)
> 
> diff --git a/include/cobalt/kernel/clock.h b/include/cobalt/kernel/clock.h
> index 59835951c..bbf34c53c 100644
> --- a/include/cobalt/kernel/clock.h
> +++ b/include/cobalt/kernel/clock.h
> @@ -104,8 +104,6 @@ struct xnclock_ratelimit_state {
>  
>  extern struct xnclock nkclock;
>  
> -extern unsigned long nktimerlat;
> -
>  int xnclock_register(struct xnclock *clock,
>  		     const cpumask_t *affinity);
>  
> diff --git a/include/cobalt/kernel/ipipe/pipeline/machine.h b/include/cobalt/kernel/ipipe/pipeline/machine.h
> index 32d5cd2a2..a5a5197e9 100644
> --- a/include/cobalt/kernel/ipipe/pipeline/machine.h
> +++ b/include/cobalt/kernel/ipipe/pipeline/machine.h
> @@ -24,7 +24,6 @@ struct cobalt_machine {
>  	int (*late_init)(void);
>  	void (*cleanup)(void);
>  	void (*prefault)(struct vm_area_struct *vma);
> -	unsigned long (*calibrate)(void);
>  	const char *const *fault_labels;
>  };
>  
> @@ -46,11 +45,6 @@ struct cobalt_pipeline {
>  #endif
>  };
>  
> -static inline unsigned long xnarch_timer_calibrate(void)
> -{
> -	return cobalt_machine.calibrate();
> -}
> -
>  int pipeline_init(void);
>  
>  int pipeline_late_init(void);
> diff --git a/kernel/cobalt/clock.c b/kernel/cobalt/clock.c
> index 7d1e00ea1..bf24e1693 100644
> --- a/kernel/cobalt/clock.c
> +++ b/kernel/cobalt/clock.c
> @@ -32,7 +32,6 @@
>   *
>   * @{
>   */
> -unsigned long nktimerlat;
>  
>  #ifdef XNARCH_HAVE_NODIV_LLIMD
>  
> @@ -456,8 +455,6 @@ void print_core_clock_status(struct xnclock *clock,
>  	xnvfile_printf(it, "%8s: timer=%s, clock=%s\n",
>  		       "devices", pipeline_timer_name(), pipeline_clock_name());
>  	xnvfile_printf(it, "%8s: %s\n", "watchdog", wd_status);
> -	xnvfile_printf(it, "%8s: %Lu\n", "setup",
> -		       xnclock_ticks_to_ns(&nkclock, nktimerlat));
>  }
>  
>  static int clock_show(struct xnvfile_regular_iterator *it, void *data)
> @@ -784,11 +781,8 @@ static void reset_core_clock_gravity(struct xnclock *clock)
>  	struct xnclock_gravity gravity;
>  
>  	xnarch_get_latencies(&gravity);
> -	gravity.user += nktimerlat;
>  	if (gravity.kernel == 0)
>  		gravity.kernel = gravity.user;
> -	if (gravity.irq == 0)
> -		gravity.irq = nktimerlat;
>  	set_core_clock_gravity(clock, &gravity);
>  }
>  
> @@ -817,7 +811,6 @@ int __init xnclock_init()
>  	xnarch_init_u32frac(&bln_frac, 1, 1000000000);
>  #endif
>  	pipeline_init_clock();
> -	nktimerlat = xnarch_timer_calibrate();
>  	xnclock_reset_gravity(&nkclock);
>  	xnclock_register(&nkclock, &xnsched_realtime_cpus);
>  
> 

-- 
Siemens AG, T RDA IOT
Corporate Competence Center Embedded Linux


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 13/13] cobalt/assert: pipeline: add TODO() marker
  2021-01-31 14:45 ` [PATCH 13/13] cobalt/assert: pipeline: add TODO() marker Philippe Gerum
@ 2021-02-01 18:20   ` Jan Kiszka
  2021-02-02 16:17     ` Philippe Gerum
  0 siblings, 1 reply; 18+ messages in thread
From: Jan Kiszka @ 2021-02-01 18:20 UTC (permalink / raw)
  To: Philippe Gerum, xenomai

On 31.01.21 15:45, Philippe Gerum wrote:
> From: Philippe Gerum <rpm@xenomai.org>
> 
> As its name suggests, TODO() can be added to the code in order to
> highlight a place where some implementation bits are known to be
> missing. Turning on CONFIG_XENO_TODO reveals the places where such
> markers might linger by triggering a build time assertion, so that
> they don't go unnoticed.
> 
> We may drop this helper when the port to Dovetail is complete.
> 
> Signed-off-by: Philippe Gerum <rpm@xenomai.org>
> ---
>  include/cobalt/kernel/assert.h | 2 ++
>  kernel/cobalt/Kconfig          | 6 ++++++
>  2 files changed, 8 insertions(+)
> 
> diff --git a/include/cobalt/kernel/assert.h b/include/cobalt/kernel/assert.h
> index 7d9433abc..8d004476b 100644
> --- a/include/cobalt/kernel/assert.h
> +++ b/include/cobalt/kernel/assert.h
> @@ -58,6 +58,8 @@
>  	do { } while (0)
>  #endif
>  
> +#define TODO()    BUILD_BUG_ON(IS_ENABLED(CONFIG_XENO_TODO))
> +
>  #define primary_mode_only()	XENO_BUG_ON(CONTEXT, is_secondary_domain())
>  #define secondary_mode_only()	XENO_BUG_ON(CONTEXT, !is_secondary_domain())
>  #define interrupt_only()	XENO_BUG_ON(CONTEXT, !xnsched_interrupt_p())
> diff --git a/kernel/cobalt/Kconfig b/kernel/cobalt/Kconfig
> index ead4740c1..a266011d4 100644
> --- a/kernel/cobalt/Kconfig
> +++ b/kernel/cobalt/Kconfig
> @@ -485,3 +485,9 @@ config XENO_OPT_WATCHDOG_TIMEOUT
>  	  Watchdog timeout value (in seconds).
>  
>  endif # XENO_OPT_DEBUG
> +
> +config XENO_TODO
> +	bool "Reveal TODO places"
> +	help
> +	  This option causes a build time assertion to trigger
> +	  when the TODO() marker is found in the compiled code.
> 

No user at this stage. Do you think we will have any while finishing the
port in-tree?

Jan

-- 
Siemens AG, T RDA IOT
Corporate Competence Center Embedded Linux


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 13/13] cobalt/assert: pipeline: add TODO() marker
  2021-02-01 18:20   ` Jan Kiszka
@ 2021-02-02 16:17     ` Philippe Gerum
  0 siblings, 0 replies; 18+ messages in thread
From: Philippe Gerum @ 2021-02-02 16:17 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: xenomai


Jan Kiszka <jan.kiszka@siemens.com> writes:

> On 31.01.21 15:45, Philippe Gerum wrote:
>> From: Philippe Gerum <rpm@xenomai.org>
>> 
>> As its name suggests, TODO() can be added to the code in order to
>> highlight a place where some implementation bits are known to be
>> missing. Turning on CONFIG_XENO_TODO reveals the places where such
>> markers might linger by triggering a build time assertion, so that
>> they don't go unnoticed.
>> 
>> We may drop this helper when the port to Dovetail is complete.
>> 
>> Signed-off-by: Philippe Gerum <rpm@xenomai.org>
>> ---
>>  include/cobalt/kernel/assert.h | 2 ++
>>  kernel/cobalt/Kconfig          | 6 ++++++
>>  2 files changed, 8 insertions(+)
>> 
>> diff --git a/include/cobalt/kernel/assert.h b/include/cobalt/kernel/assert.h
>> index 7d9433abc..8d004476b 100644
>> --- a/include/cobalt/kernel/assert.h
>> +++ b/include/cobalt/kernel/assert.h
>> @@ -58,6 +58,8 @@
>>  	do { } while (0)
>>  #endif
>>  
>> +#define TODO()    BUILD_BUG_ON(IS_ENABLED(CONFIG_XENO_TODO))
>> +
>>  #define primary_mode_only()	XENO_BUG_ON(CONTEXT, is_secondary_domain())
>>  #define secondary_mode_only()	XENO_BUG_ON(CONTEXT, !is_secondary_domain())
>>  #define interrupt_only()	XENO_BUG_ON(CONTEXT, !xnsched_interrupt_p())
>> diff --git a/kernel/cobalt/Kconfig b/kernel/cobalt/Kconfig
>> index ead4740c1..a266011d4 100644
>> --- a/kernel/cobalt/Kconfig
>> +++ b/kernel/cobalt/Kconfig
>> @@ -485,3 +485,9 @@ config XENO_OPT_WATCHDOG_TIMEOUT
>>  	  Watchdog timeout value (in seconds).
>>  
>>  endif # XENO_OPT_DEBUG
>> +
>> +config XENO_TODO
>> +	bool "Reveal TODO places"
>> +	help
>> +	  This option causes a build time assertion to trigger
>> +	  when the TODO() marker is found in the compiled code.
>> 
>
> No user at this stage. Do you think we will have any while finishing the
> port in-tree?
>

Many users follow, until the last patch of the remain stack is in (~70
commits), at which point a handful only should remain.

-- 
Philippe.


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 06/13] cobalt/clock: drop timer calibration
  2021-02-01 18:14   ` Jan Kiszka
@ 2021-02-02 16:26     ` Philippe Gerum
  0 siblings, 0 replies; 18+ messages in thread
From: Philippe Gerum @ 2021-02-02 16:26 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: xenomai


Jan Kiszka <jan.kiszka@siemens.com> writes:

> On 31.01.21 15:45, Philippe Gerum wrote:
>> From: Philippe Gerum <rpm@xenomai.org>
>> 
>> The calibrated timer setup time is currently accounted for in the
>> timer gravity triplet (.user, also used as default .irq latency),
>> exclusively. This forces in a dynamically calculated parameter with no
>> way to override it. Meanwhile, this value would be already included in
>> every gravity value which autotune may determine, so this setting is
>> pretty much redundant.
>> 
>> Drop nktimerlat and the requirement for the machine section to provide
>> a timer calibration handler, we don't need these.
>> 
>
> Do you recall the history of this features? Was it first, and then
> autotune came along, silently obsoleting it?

This stuff dates back to the early 2k, when we still used the i8254 for
timing on x86. Programming the I/O ports to schedule the next clock tick
was so excruciatingly slow that we had to account for such overhead in
the timeout date. Other archs simply mimicked this for their own
hardware timers following x86, but certainly with much less of a reason
to do so (some would actually set nktimerlat to 1 clock cycle...).

When autotune came in, the reasoning for having nktimelat was not
reconsidered, although it should have since as a result, this setting
became not only useless, but in fact redundant.

-- 
Philippe.


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 04/13] cobalt/arch: pipeline: move architecture code to pipeline-specific section
  2021-01-31 14:45 ` [PATCH 04/13] cobalt/arch: pipeline: move architecture code to pipeline-specific section Philippe Gerum
@ 2021-02-03 10:18   ` Jan Kiszka
  0 siblings, 0 replies; 18+ messages in thread
From: Jan Kiszka @ 2021-02-03 10:18 UTC (permalink / raw)
  To: Philippe Gerum, xenomai

On 31.01.21 15:45, Philippe Gerum wrote:
> From: Philippe Gerum <rpm@xenomai.org>
> 
> The Cobalt architecture code is overwhelmingly specific to a pipeline
> flavour, most of it for interfacing with the I-pipe. We may still need
> very little arch-specific code in the Dovetail set up though,
> specifically for implementing Cobalt's built-in FPU tests.
> 
> Let's move the existing architecture code under the ipipe/ hierarchy,
> fixing up the kernel prep script accordingly.
> 
> No functional change is introduced.
> 
> Signed-off-by: Philippe Gerum <rpm@xenomai.org>
> ---
>  kernel/cobalt/arch/arm/{ => ipipe}/Makefile   |  2 +-
>  kernel/cobalt/arch/arm/{ => ipipe}/README     |  0
>  .../include/asm/xenomai/calibration.h         |  0
>  .../include/asm/xenomai/features.h            |  0
>  .../{ => ipipe}/include/asm/xenomai/fptest.h  |  0
>  .../{ => ipipe}/include/asm/xenomai/machine.h |  0
>  .../{ => ipipe}/include/asm/xenomai/syscall.h |  0
>  .../include/asm/xenomai/syscall32.h           |  0
>  .../{ => ipipe}/include/asm/xenomai/thread.h  |  0
>  .../include/asm/xenomai/wrappers.h            |  0
>  kernel/cobalt/arch/arm/{ => ipipe}/machine.c  |  0
>  kernel/cobalt/arch/arm/{ => ipipe}/switch.S   |  0
>  kernel/cobalt/arch/arm/{ => ipipe}/syscall.c  |  0
>  kernel/cobalt/arch/arm/{ => ipipe}/thread.c   |  0
>  kernel/cobalt/arch/arm64/{ => ipipe}/Makefile |  0
>  kernel/cobalt/arch/arm64/{ => ipipe}/README   |  0
>  .../include/asm/xenomai/calibration.h         |  0
>  .../include/asm/xenomai/features.h            |  0
>  .../{ => ipipe}/include/asm/xenomai/fptest.h  |  0
>  .../{ => ipipe}/include/asm/xenomai/machine.h |  0
>  .../{ => ipipe}/include/asm/xenomai/syscall.h |  0
>  .../include/asm/xenomai/syscall32.h           |  0
>  .../{ => ipipe}/include/asm/xenomai/thread.h  |  0
>  .../include/asm/xenomai/wrappers.h            |  0
>  .../cobalt/arch/arm64/{ => ipipe}/machine.c   |  0
>  .../cobalt/arch/arm64/{ => ipipe}/syscall.c   |  0
>  kernel/cobalt/arch/arm64/{ => ipipe}/thread.c |  0
>  .../cobalt/arch/powerpc/{ => ipipe}/Makefile  |  0
>  kernel/cobalt/arch/powerpc/{ => ipipe}/README |  0
>  kernel/cobalt/arch/powerpc/{ => ipipe}/fpu.S  |  0
>  .../include/asm/xenomai/calibration.h         |  0
>  .../include/asm/xenomai/features.h            |  0
>  .../{ => ipipe}/include/asm/xenomai/fptest.h  |  0
>  .../{ => ipipe}/include/asm/xenomai/machine.h |  0
>  .../{ => ipipe}/include/asm/xenomai/syscall.h |  0
>  .../include/asm/xenomai/syscall32.h           |  0
>  .../{ => ipipe}/include/asm/xenomai/thread.h  |  0
>  .../include/asm/xenomai/wrappers.h            |  0
>  .../cobalt/arch/powerpc/{ => ipipe}/machine.c |  0
>  .../cobalt/arch/powerpc/{ => ipipe}/thread.c  |  0
>  kernel/cobalt/arch/x86/{ => ipipe}/Makefile   |  0
>  kernel/cobalt/arch/x86/{ => ipipe}/README     |  0
>  kernel/cobalt/arch/x86/{ => ipipe}/c1e.c      |  0
>  .../x86/{ => ipipe}/include/asm/xenomai/c1e.h |  0
>  .../include/asm/xenomai/calibration.h         |  0
>  .../include/asm/xenomai/features.h            |  0
>  .../{ => ipipe}/include/asm/xenomai/fptest.h  |  0
>  .../{ => ipipe}/include/asm/xenomai/machine.h |  0
>  .../x86/{ => ipipe}/include/asm/xenomai/smi.h |  0
>  .../{ => ipipe}/include/asm/xenomai/syscall.h |  0
>  .../include/asm/xenomai/syscall32-table.h     |  0
>  .../include/asm/xenomai/syscall32.h           |  0
>  .../{ => ipipe}/include/asm/xenomai/thread.h  |  0
>  .../include/asm/xenomai/wrappers.h            |  0
>  kernel/cobalt/arch/x86/{ => ipipe}/machine.c  |  0
>  kernel/cobalt/arch/x86/{ => ipipe}/smi.c      |  0
>  kernel/cobalt/arch/x86/{ => ipipe}/thread.c   |  0
>  scripts/prepare-kernel.sh                     | 84 ++++++++++++-------
>  58 files changed, 53 insertions(+), 33 deletions(-)
>  rename kernel/cobalt/arch/arm/{ => ipipe}/Makefile (64%)
>  rename kernel/cobalt/arch/arm/{ => ipipe}/README (100%)
>  rename kernel/cobalt/arch/arm/{ => ipipe}/include/asm/xenomai/calibration.h (100%)
>  rename kernel/cobalt/arch/arm/{ => ipipe}/include/asm/xenomai/features.h (100%)
>  rename kernel/cobalt/arch/arm/{ => ipipe}/include/asm/xenomai/fptest.h (100%)
>  rename kernel/cobalt/arch/arm/{ => ipipe}/include/asm/xenomai/machine.h (100%)
>  rename kernel/cobalt/arch/arm/{ => ipipe}/include/asm/xenomai/syscall.h (100%)
>  rename kernel/cobalt/arch/arm/{ => ipipe}/include/asm/xenomai/syscall32.h (100%)
>  rename kernel/cobalt/arch/arm/{ => ipipe}/include/asm/xenomai/thread.h (100%)
>  rename kernel/cobalt/arch/arm/{ => ipipe}/include/asm/xenomai/wrappers.h (100%)
>  rename kernel/cobalt/arch/arm/{ => ipipe}/machine.c (100%)
>  rename kernel/cobalt/arch/arm/{ => ipipe}/switch.S (100%)
>  rename kernel/cobalt/arch/arm/{ => ipipe}/syscall.c (100%)
>  rename kernel/cobalt/arch/arm/{ => ipipe}/thread.c (100%)
>  rename kernel/cobalt/arch/arm64/{ => ipipe}/Makefile (100%)
>  rename kernel/cobalt/arch/arm64/{ => ipipe}/README (100%)
>  rename kernel/cobalt/arch/arm64/{ => ipipe}/include/asm/xenomai/calibration.h (100%)
>  rename kernel/cobalt/arch/arm64/{ => ipipe}/include/asm/xenomai/features.h (100%)
>  rename kernel/cobalt/arch/arm64/{ => ipipe}/include/asm/xenomai/fptest.h (100%)
>  rename kernel/cobalt/arch/arm64/{ => ipipe}/include/asm/xenomai/machine.h (100%)
>  rename kernel/cobalt/arch/arm64/{ => ipipe}/include/asm/xenomai/syscall.h (100%)
>  rename kernel/cobalt/arch/arm64/{ => ipipe}/include/asm/xenomai/syscall32.h (100%)
>  rename kernel/cobalt/arch/arm64/{ => ipipe}/include/asm/xenomai/thread.h (100%)
>  rename kernel/cobalt/arch/arm64/{ => ipipe}/include/asm/xenomai/wrappers.h (100%)
>  rename kernel/cobalt/arch/arm64/{ => ipipe}/machine.c (100%)
>  rename kernel/cobalt/arch/arm64/{ => ipipe}/syscall.c (100%)
>  rename kernel/cobalt/arch/arm64/{ => ipipe}/thread.c (100%)
>  rename kernel/cobalt/arch/powerpc/{ => ipipe}/Makefile (100%)
>  rename kernel/cobalt/arch/powerpc/{ => ipipe}/README (100%)
>  rename kernel/cobalt/arch/powerpc/{ => ipipe}/fpu.S (100%)
>  rename kernel/cobalt/arch/powerpc/{ => ipipe}/include/asm/xenomai/calibration.h (100%)
>  rename kernel/cobalt/arch/powerpc/{ => ipipe}/include/asm/xenomai/features.h (100%)
>  rename kernel/cobalt/arch/powerpc/{ => ipipe}/include/asm/xenomai/fptest.h (100%)
>  rename kernel/cobalt/arch/powerpc/{ => ipipe}/include/asm/xenomai/machine.h (100%)
>  rename kernel/cobalt/arch/powerpc/{ => ipipe}/include/asm/xenomai/syscall.h (100%)
>  rename kernel/cobalt/arch/powerpc/{ => ipipe}/include/asm/xenomai/syscall32.h (100%)
>  rename kernel/cobalt/arch/powerpc/{ => ipipe}/include/asm/xenomai/thread.h (100%)
>  rename kernel/cobalt/arch/powerpc/{ => ipipe}/include/asm/xenomai/wrappers.h (100%)
>  rename kernel/cobalt/arch/powerpc/{ => ipipe}/machine.c (100%)
>  rename kernel/cobalt/arch/powerpc/{ => ipipe}/thread.c (100%)
>  rename kernel/cobalt/arch/x86/{ => ipipe}/Makefile (100%)
>  rename kernel/cobalt/arch/x86/{ => ipipe}/README (100%)
>  rename kernel/cobalt/arch/x86/{ => ipipe}/c1e.c (100%)
>  rename kernel/cobalt/arch/x86/{ => ipipe}/include/asm/xenomai/c1e.h (100%)
>  rename kernel/cobalt/arch/x86/{ => ipipe}/include/asm/xenomai/calibration.h (100%)
>  rename kernel/cobalt/arch/x86/{ => ipipe}/include/asm/xenomai/features.h (100%)
>  rename kernel/cobalt/arch/x86/{ => ipipe}/include/asm/xenomai/fptest.h (100%)
>  rename kernel/cobalt/arch/x86/{ => ipipe}/include/asm/xenomai/machine.h (100%)
>  rename kernel/cobalt/arch/x86/{ => ipipe}/include/asm/xenomai/smi.h (100%)
>  rename kernel/cobalt/arch/x86/{ => ipipe}/include/asm/xenomai/syscall.h (100%)
>  rename kernel/cobalt/arch/x86/{ => ipipe}/include/asm/xenomai/syscall32-table.h (100%)
>  rename kernel/cobalt/arch/x86/{ => ipipe}/include/asm/xenomai/syscall32.h (100%)
>  rename kernel/cobalt/arch/x86/{ => ipipe}/include/asm/xenomai/thread.h (100%)
>  rename kernel/cobalt/arch/x86/{ => ipipe}/include/asm/xenomai/wrappers.h (100%)
>  rename kernel/cobalt/arch/x86/{ => ipipe}/machine.c (100%)
>  rename kernel/cobalt/arch/x86/{ => ipipe}/smi.c (100%)
>  rename kernel/cobalt/arch/x86/{ => ipipe}/thread.c (100%)
> 
> diff --git a/kernel/cobalt/arch/arm/Makefile b/kernel/cobalt/arch/arm/ipipe/Makefile
> similarity index 64%
> rename from kernel/cobalt/arch/arm/Makefile
> rename to kernel/cobalt/arch/arm/ipipe/Makefile
> index 295ba614b..c482fb337 100644
> --- a/kernel/cobalt/arch/arm/Makefile
> +++ b/kernel/cobalt/arch/arm/ipipe/Makefile
> @@ -1,5 +1,5 @@
>  obj-$(CONFIG_XENOMAI) += xenomai.o
>  
> -xenomai-y := machine.o thread.o switch.o syscall.o
> +xenomai-$(CONFIG_IPIPE) := machine.o thread.o switch.o syscall.o
>  
>  ccflags-y := -I$(srctree)/arch/arm/xenomai/include -I$(srctree)/include/xenomai
> diff --git a/kernel/cobalt/arch/arm/README b/kernel/cobalt/arch/arm/ipipe/README
> similarity index 100%
> rename from kernel/cobalt/arch/arm/README
> rename to kernel/cobalt/arch/arm/ipipe/README
> diff --git a/kernel/cobalt/arch/arm/include/asm/xenomai/calibration.h b/kernel/cobalt/arch/arm/ipipe/include/asm/xenomai/calibration.h
> similarity index 100%
> rename from kernel/cobalt/arch/arm/include/asm/xenomai/calibration.h
> rename to kernel/cobalt/arch/arm/ipipe/include/asm/xenomai/calibration.h
> diff --git a/kernel/cobalt/arch/arm/include/asm/xenomai/features.h b/kernel/cobalt/arch/arm/ipipe/include/asm/xenomai/features.h
> similarity index 100%
> rename from kernel/cobalt/arch/arm/include/asm/xenomai/features.h
> rename to kernel/cobalt/arch/arm/ipipe/include/asm/xenomai/features.h
> diff --git a/kernel/cobalt/arch/arm/include/asm/xenomai/fptest.h b/kernel/cobalt/arch/arm/ipipe/include/asm/xenomai/fptest.h
> similarity index 100%
> rename from kernel/cobalt/arch/arm/include/asm/xenomai/fptest.h
> rename to kernel/cobalt/arch/arm/ipipe/include/asm/xenomai/fptest.h
> diff --git a/kernel/cobalt/arch/arm/include/asm/xenomai/machine.h b/kernel/cobalt/arch/arm/ipipe/include/asm/xenomai/machine.h
> similarity index 100%
> rename from kernel/cobalt/arch/arm/include/asm/xenomai/machine.h
> rename to kernel/cobalt/arch/arm/ipipe/include/asm/xenomai/machine.h
> diff --git a/kernel/cobalt/arch/arm/include/asm/xenomai/syscall.h b/kernel/cobalt/arch/arm/ipipe/include/asm/xenomai/syscall.h
> similarity index 100%
> rename from kernel/cobalt/arch/arm/include/asm/xenomai/syscall.h
> rename to kernel/cobalt/arch/arm/ipipe/include/asm/xenomai/syscall.h
> diff --git a/kernel/cobalt/arch/arm/include/asm/xenomai/syscall32.h b/kernel/cobalt/arch/arm/ipipe/include/asm/xenomai/syscall32.h
> similarity index 100%
> rename from kernel/cobalt/arch/arm/include/asm/xenomai/syscall32.h
> rename to kernel/cobalt/arch/arm/ipipe/include/asm/xenomai/syscall32.h
> diff --git a/kernel/cobalt/arch/arm/include/asm/xenomai/thread.h b/kernel/cobalt/arch/arm/ipipe/include/asm/xenomai/thread.h
> similarity index 100%
> rename from kernel/cobalt/arch/arm/include/asm/xenomai/thread.h
> rename to kernel/cobalt/arch/arm/ipipe/include/asm/xenomai/thread.h
> diff --git a/kernel/cobalt/arch/arm/include/asm/xenomai/wrappers.h b/kernel/cobalt/arch/arm/ipipe/include/asm/xenomai/wrappers.h
> similarity index 100%
> rename from kernel/cobalt/arch/arm/include/asm/xenomai/wrappers.h
> rename to kernel/cobalt/arch/arm/ipipe/include/asm/xenomai/wrappers.h
> diff --git a/kernel/cobalt/arch/arm/machine.c b/kernel/cobalt/arch/arm/ipipe/machine.c
> similarity index 100%
> rename from kernel/cobalt/arch/arm/machine.c
> rename to kernel/cobalt/arch/arm/ipipe/machine.c
> diff --git a/kernel/cobalt/arch/arm/switch.S b/kernel/cobalt/arch/arm/ipipe/switch.S
> similarity index 100%
> rename from kernel/cobalt/arch/arm/switch.S
> rename to kernel/cobalt/arch/arm/ipipe/switch.S
> diff --git a/kernel/cobalt/arch/arm/syscall.c b/kernel/cobalt/arch/arm/ipipe/syscall.c
> similarity index 100%
> rename from kernel/cobalt/arch/arm/syscall.c
> rename to kernel/cobalt/arch/arm/ipipe/syscall.c
> diff --git a/kernel/cobalt/arch/arm/thread.c b/kernel/cobalt/arch/arm/ipipe/thread.c
> similarity index 100%
> rename from kernel/cobalt/arch/arm/thread.c
> rename to kernel/cobalt/arch/arm/ipipe/thread.c
> diff --git a/kernel/cobalt/arch/arm64/Makefile b/kernel/cobalt/arch/arm64/ipipe/Makefile
> similarity index 100%
> rename from kernel/cobalt/arch/arm64/Makefile
> rename to kernel/cobalt/arch/arm64/ipipe/Makefile
> diff --git a/kernel/cobalt/arch/arm64/README b/kernel/cobalt/arch/arm64/ipipe/README
> similarity index 100%
> rename from kernel/cobalt/arch/arm64/README
> rename to kernel/cobalt/arch/arm64/ipipe/README
> diff --git a/kernel/cobalt/arch/arm64/include/asm/xenomai/calibration.h b/kernel/cobalt/arch/arm64/ipipe/include/asm/xenomai/calibration.h
> similarity index 100%
> rename from kernel/cobalt/arch/arm64/include/asm/xenomai/calibration.h
> rename to kernel/cobalt/arch/arm64/ipipe/include/asm/xenomai/calibration.h
> diff --git a/kernel/cobalt/arch/arm64/include/asm/xenomai/features.h b/kernel/cobalt/arch/arm64/ipipe/include/asm/xenomai/features.h
> similarity index 100%
> rename from kernel/cobalt/arch/arm64/include/asm/xenomai/features.h
> rename to kernel/cobalt/arch/arm64/ipipe/include/asm/xenomai/features.h
> diff --git a/kernel/cobalt/arch/arm64/include/asm/xenomai/fptest.h b/kernel/cobalt/arch/arm64/ipipe/include/asm/xenomai/fptest.h
> similarity index 100%
> rename from kernel/cobalt/arch/arm64/include/asm/xenomai/fptest.h
> rename to kernel/cobalt/arch/arm64/ipipe/include/asm/xenomai/fptest.h
> diff --git a/kernel/cobalt/arch/arm64/include/asm/xenomai/machine.h b/kernel/cobalt/arch/arm64/ipipe/include/asm/xenomai/machine.h
> similarity index 100%
> rename from kernel/cobalt/arch/arm64/include/asm/xenomai/machine.h
> rename to kernel/cobalt/arch/arm64/ipipe/include/asm/xenomai/machine.h
> diff --git a/kernel/cobalt/arch/arm64/include/asm/xenomai/syscall.h b/kernel/cobalt/arch/arm64/ipipe/include/asm/xenomai/syscall.h
> similarity index 100%
> rename from kernel/cobalt/arch/arm64/include/asm/xenomai/syscall.h
> rename to kernel/cobalt/arch/arm64/ipipe/include/asm/xenomai/syscall.h
> diff --git a/kernel/cobalt/arch/arm64/include/asm/xenomai/syscall32.h b/kernel/cobalt/arch/arm64/ipipe/include/asm/xenomai/syscall32.h
> similarity index 100%
> rename from kernel/cobalt/arch/arm64/include/asm/xenomai/syscall32.h
> rename to kernel/cobalt/arch/arm64/ipipe/include/asm/xenomai/syscall32.h
> diff --git a/kernel/cobalt/arch/arm64/include/asm/xenomai/thread.h b/kernel/cobalt/arch/arm64/ipipe/include/asm/xenomai/thread.h
> similarity index 100%
> rename from kernel/cobalt/arch/arm64/include/asm/xenomai/thread.h
> rename to kernel/cobalt/arch/arm64/ipipe/include/asm/xenomai/thread.h
> diff --git a/kernel/cobalt/arch/arm64/include/asm/xenomai/wrappers.h b/kernel/cobalt/arch/arm64/ipipe/include/asm/xenomai/wrappers.h
> similarity index 100%
> rename from kernel/cobalt/arch/arm64/include/asm/xenomai/wrappers.h
> rename to kernel/cobalt/arch/arm64/ipipe/include/asm/xenomai/wrappers.h
> diff --git a/kernel/cobalt/arch/arm64/machine.c b/kernel/cobalt/arch/arm64/ipipe/machine.c
> similarity index 100%
> rename from kernel/cobalt/arch/arm64/machine.c
> rename to kernel/cobalt/arch/arm64/ipipe/machine.c
> diff --git a/kernel/cobalt/arch/arm64/syscall.c b/kernel/cobalt/arch/arm64/ipipe/syscall.c
> similarity index 100%
> rename from kernel/cobalt/arch/arm64/syscall.c
> rename to kernel/cobalt/arch/arm64/ipipe/syscall.c
> diff --git a/kernel/cobalt/arch/arm64/thread.c b/kernel/cobalt/arch/arm64/ipipe/thread.c
> similarity index 100%
> rename from kernel/cobalt/arch/arm64/thread.c
> rename to kernel/cobalt/arch/arm64/ipipe/thread.c
> diff --git a/kernel/cobalt/arch/powerpc/Makefile b/kernel/cobalt/arch/powerpc/ipipe/Makefile
> similarity index 100%
> rename from kernel/cobalt/arch/powerpc/Makefile
> rename to kernel/cobalt/arch/powerpc/ipipe/Makefile
> diff --git a/kernel/cobalt/arch/powerpc/README b/kernel/cobalt/arch/powerpc/ipipe/README
> similarity index 100%
> rename from kernel/cobalt/arch/powerpc/README
> rename to kernel/cobalt/arch/powerpc/ipipe/README
> diff --git a/kernel/cobalt/arch/powerpc/fpu.S b/kernel/cobalt/arch/powerpc/ipipe/fpu.S
> similarity index 100%
> rename from kernel/cobalt/arch/powerpc/fpu.S
> rename to kernel/cobalt/arch/powerpc/ipipe/fpu.S
> diff --git a/kernel/cobalt/arch/powerpc/include/asm/xenomai/calibration.h b/kernel/cobalt/arch/powerpc/ipipe/include/asm/xenomai/calibration.h
> similarity index 100%
> rename from kernel/cobalt/arch/powerpc/include/asm/xenomai/calibration.h
> rename to kernel/cobalt/arch/powerpc/ipipe/include/asm/xenomai/calibration.h
> diff --git a/kernel/cobalt/arch/powerpc/include/asm/xenomai/features.h b/kernel/cobalt/arch/powerpc/ipipe/include/asm/xenomai/features.h
> similarity index 100%
> rename from kernel/cobalt/arch/powerpc/include/asm/xenomai/features.h
> rename to kernel/cobalt/arch/powerpc/ipipe/include/asm/xenomai/features.h
> diff --git a/kernel/cobalt/arch/powerpc/include/asm/xenomai/fptest.h b/kernel/cobalt/arch/powerpc/ipipe/include/asm/xenomai/fptest.h
> similarity index 100%
> rename from kernel/cobalt/arch/powerpc/include/asm/xenomai/fptest.h
> rename to kernel/cobalt/arch/powerpc/ipipe/include/asm/xenomai/fptest.h
> diff --git a/kernel/cobalt/arch/powerpc/include/asm/xenomai/machine.h b/kernel/cobalt/arch/powerpc/ipipe/include/asm/xenomai/machine.h
> similarity index 100%
> rename from kernel/cobalt/arch/powerpc/include/asm/xenomai/machine.h
> rename to kernel/cobalt/arch/powerpc/ipipe/include/asm/xenomai/machine.h
> diff --git a/kernel/cobalt/arch/powerpc/include/asm/xenomai/syscall.h b/kernel/cobalt/arch/powerpc/ipipe/include/asm/xenomai/syscall.h
> similarity index 100%
> rename from kernel/cobalt/arch/powerpc/include/asm/xenomai/syscall.h
> rename to kernel/cobalt/arch/powerpc/ipipe/include/asm/xenomai/syscall.h
> diff --git a/kernel/cobalt/arch/powerpc/include/asm/xenomai/syscall32.h b/kernel/cobalt/arch/powerpc/ipipe/include/asm/xenomai/syscall32.h
> similarity index 100%
> rename from kernel/cobalt/arch/powerpc/include/asm/xenomai/syscall32.h
> rename to kernel/cobalt/arch/powerpc/ipipe/include/asm/xenomai/syscall32.h
> diff --git a/kernel/cobalt/arch/powerpc/include/asm/xenomai/thread.h b/kernel/cobalt/arch/powerpc/ipipe/include/asm/xenomai/thread.h
> similarity index 100%
> rename from kernel/cobalt/arch/powerpc/include/asm/xenomai/thread.h
> rename to kernel/cobalt/arch/powerpc/ipipe/include/asm/xenomai/thread.h
> diff --git a/kernel/cobalt/arch/powerpc/include/asm/xenomai/wrappers.h b/kernel/cobalt/arch/powerpc/ipipe/include/asm/xenomai/wrappers.h
> similarity index 100%
> rename from kernel/cobalt/arch/powerpc/include/asm/xenomai/wrappers.h
> rename to kernel/cobalt/arch/powerpc/ipipe/include/asm/xenomai/wrappers.h
> diff --git a/kernel/cobalt/arch/powerpc/machine.c b/kernel/cobalt/arch/powerpc/ipipe/machine.c
> similarity index 100%
> rename from kernel/cobalt/arch/powerpc/machine.c
> rename to kernel/cobalt/arch/powerpc/ipipe/machine.c
> diff --git a/kernel/cobalt/arch/powerpc/thread.c b/kernel/cobalt/arch/powerpc/ipipe/thread.c
> similarity index 100%
> rename from kernel/cobalt/arch/powerpc/thread.c
> rename to kernel/cobalt/arch/powerpc/ipipe/thread.c
> diff --git a/kernel/cobalt/arch/x86/Makefile b/kernel/cobalt/arch/x86/ipipe/Makefile
> similarity index 100%
> rename from kernel/cobalt/arch/x86/Makefile
> rename to kernel/cobalt/arch/x86/ipipe/Makefile
> diff --git a/kernel/cobalt/arch/x86/README b/kernel/cobalt/arch/x86/ipipe/README
> similarity index 100%
> rename from kernel/cobalt/arch/x86/README
> rename to kernel/cobalt/arch/x86/ipipe/README
> diff --git a/kernel/cobalt/arch/x86/c1e.c b/kernel/cobalt/arch/x86/ipipe/c1e.c
> similarity index 100%
> rename from kernel/cobalt/arch/x86/c1e.c
> rename to kernel/cobalt/arch/x86/ipipe/c1e.c
> diff --git a/kernel/cobalt/arch/x86/include/asm/xenomai/c1e.h b/kernel/cobalt/arch/x86/ipipe/include/asm/xenomai/c1e.h
> similarity index 100%
> rename from kernel/cobalt/arch/x86/include/asm/xenomai/c1e.h
> rename to kernel/cobalt/arch/x86/ipipe/include/asm/xenomai/c1e.h
> diff --git a/kernel/cobalt/arch/x86/include/asm/xenomai/calibration.h b/kernel/cobalt/arch/x86/ipipe/include/asm/xenomai/calibration.h
> similarity index 100%
> rename from kernel/cobalt/arch/x86/include/asm/xenomai/calibration.h
> rename to kernel/cobalt/arch/x86/ipipe/include/asm/xenomai/calibration.h
> diff --git a/kernel/cobalt/arch/x86/include/asm/xenomai/features.h b/kernel/cobalt/arch/x86/ipipe/include/asm/xenomai/features.h
> similarity index 100%
> rename from kernel/cobalt/arch/x86/include/asm/xenomai/features.h
> rename to kernel/cobalt/arch/x86/ipipe/include/asm/xenomai/features.h
> diff --git a/kernel/cobalt/arch/x86/include/asm/xenomai/fptest.h b/kernel/cobalt/arch/x86/ipipe/include/asm/xenomai/fptest.h
> similarity index 100%
> rename from kernel/cobalt/arch/x86/include/asm/xenomai/fptest.h
> rename to kernel/cobalt/arch/x86/ipipe/include/asm/xenomai/fptest.h
> diff --git a/kernel/cobalt/arch/x86/include/asm/xenomai/machine.h b/kernel/cobalt/arch/x86/ipipe/include/asm/xenomai/machine.h
> similarity index 100%
> rename from kernel/cobalt/arch/x86/include/asm/xenomai/machine.h
> rename to kernel/cobalt/arch/x86/ipipe/include/asm/xenomai/machine.h
> diff --git a/kernel/cobalt/arch/x86/include/asm/xenomai/smi.h b/kernel/cobalt/arch/x86/ipipe/include/asm/xenomai/smi.h
> similarity index 100%
> rename from kernel/cobalt/arch/x86/include/asm/xenomai/smi.h
> rename to kernel/cobalt/arch/x86/ipipe/include/asm/xenomai/smi.h
> diff --git a/kernel/cobalt/arch/x86/include/asm/xenomai/syscall.h b/kernel/cobalt/arch/x86/ipipe/include/asm/xenomai/syscall.h
> similarity index 100%
> rename from kernel/cobalt/arch/x86/include/asm/xenomai/syscall.h
> rename to kernel/cobalt/arch/x86/ipipe/include/asm/xenomai/syscall.h
> diff --git a/kernel/cobalt/arch/x86/include/asm/xenomai/syscall32-table.h b/kernel/cobalt/arch/x86/ipipe/include/asm/xenomai/syscall32-table.h
> similarity index 100%
> rename from kernel/cobalt/arch/x86/include/asm/xenomai/syscall32-table.h
> rename to kernel/cobalt/arch/x86/ipipe/include/asm/xenomai/syscall32-table.h
> diff --git a/kernel/cobalt/arch/x86/include/asm/xenomai/syscall32.h b/kernel/cobalt/arch/x86/ipipe/include/asm/xenomai/syscall32.h
> similarity index 100%
> rename from kernel/cobalt/arch/x86/include/asm/xenomai/syscall32.h
> rename to kernel/cobalt/arch/x86/ipipe/include/asm/xenomai/syscall32.h
> diff --git a/kernel/cobalt/arch/x86/include/asm/xenomai/thread.h b/kernel/cobalt/arch/x86/ipipe/include/asm/xenomai/thread.h
> similarity index 100%
> rename from kernel/cobalt/arch/x86/include/asm/xenomai/thread.h
> rename to kernel/cobalt/arch/x86/ipipe/include/asm/xenomai/thread.h
> diff --git a/kernel/cobalt/arch/x86/include/asm/xenomai/wrappers.h b/kernel/cobalt/arch/x86/ipipe/include/asm/xenomai/wrappers.h
> similarity index 100%
> rename from kernel/cobalt/arch/x86/include/asm/xenomai/wrappers.h
> rename to kernel/cobalt/arch/x86/ipipe/include/asm/xenomai/wrappers.h
> diff --git a/kernel/cobalt/arch/x86/machine.c b/kernel/cobalt/arch/x86/ipipe/machine.c
> similarity index 100%
> rename from kernel/cobalt/arch/x86/machine.c
> rename to kernel/cobalt/arch/x86/ipipe/machine.c
> diff --git a/kernel/cobalt/arch/x86/smi.c b/kernel/cobalt/arch/x86/ipipe/smi.c
> similarity index 100%
> rename from kernel/cobalt/arch/x86/smi.c
> rename to kernel/cobalt/arch/x86/ipipe/smi.c
> diff --git a/kernel/cobalt/arch/x86/thread.c b/kernel/cobalt/arch/x86/ipipe/thread.c
> similarity index 100%
> rename from kernel/cobalt/arch/x86/thread.c
> rename to kernel/cobalt/arch/x86/ipipe/thread.c
> diff --git a/scripts/prepare-kernel.sh b/scripts/prepare-kernel.sh
> index 1b5fb427d..7dba3d5a5 100755
> --- a/scripts/prepare-kernel.sh
> +++ b/scripts/prepare-kernel.sh
> @@ -147,7 +147,7 @@ generate_patch() {
>  }
>  
>  
> -usage='usage: prepare-kernel --linux=<linux-tree> --ipipe=<ipipe-patch> [--arch=<arch>] [--outpatch=<file> [--filterkvers=y|n] [--filterarch=y|n]] [--forcelink] [--default] [--verbose]'
> +usage='usage: prepare-kernel --linux=<linux-tree> [--dovetail=<dovetail-patch>]|[--ipipe=<ipipe-patch>] [--arch=<arch>] [--outpatch=<file> [--filterkvers=y|n] [--filterarch=y|n]] [--forcelink] [--default] [--verbose]'
>  me=`basename $0`
>  
>  while test $# -gt 0; do
> @@ -157,12 +157,25 @@ while test $# -gt 0; do
>  	linux_tree=`eval "echo $linux_tree"`
>  	;;
>      --adeos=*)
> -	ipipe_patch=`echo $1|sed -e 's,^--adeos=\\(.*\\)$,\\1,g'`
> -	ipipe_patch=`eval "echo $ipipe_patch"`
> +	pipeline_patch=`echo $1|sed -e 's,^--adeos=\\(.*\\)$,\\1,g'`
> +	pipeline_patch=`eval "echo $pipeline_patch"`
> +	probe_header=include/linux/ipipe.h
> +	arch_probe_header=include/asm/ipipe.h
> +	pipeline_type=ipipe
>  	;;
>      --ipipe=*)
> -	ipipe_patch=`echo $1|sed -e 's,^--ipipe=\\(.*\\)$,\\1,g'`
> -	ipipe_patch=`eval "echo $ipipe_patch"`
> +	pipeline_patch=`echo $1|sed -e 's,^--ipipe=\\(.*\\)$,\\1,g'`
> +	pipeline_patch=`eval "echo $pipeline_patch"`
> +	probe_header=include/linux/ipipe.h
> +	arch_probe_header=include/asm/ipipe.h
> +	pipeline_type=ipipe
> +	;;
> +    --dovetail=*)
> +	pipeline_patch=`echo $1|sed -e 's,^--dovetail=\\(.*\\)$,\\1,g'`
> +	pipeline_patch=`eval "echo $pipeline_patch"`
> +	probe_header=include/linux/dovetail.h
> +	arch_probe_header=include/asm/dovetail.h
> +	pipeline_type=dovetail
>  	;;
>      --arch=*)
>  	linux_arch=`echo $1|sed -e 's,^--arch=\\(.*\\)$,\\1,g'`
> @@ -305,51 +318,58 @@ eval linux_`grep '^VERSION =' $linux_tree/Makefile | sed -e 's, ,,g'`
>  
>  linux_version="$linux_VERSION.$linux_PATCHLEVEL.$linux_SUBLEVEL"
>  
> +if test x$pipeline_type = x; then
> +    if test -r include/linux/ipipe.h; then

Missing $linux_tree/, here an below. Fixed up in next.

Jan

> +	probe_header=include/linux/ipipe.h
> +	arch_probe_header=include/asm/ipipe.h
> +	pipeline_type=ipipe
> +    elif test -r include/linux/dovetail.h; then
> +	probe_header=include/linux/dovetail.h
> +	arch_probe_header=include/asm/dovetail.h
> +	pipeline_type=dovetail
> +    fi
> +fi
> +
>  if test x$verbose = x1; then
>  echo "Preparing kernel $linux_version$linux_EXTRAVERSION in $linux_tree..."
>  fi
>  
> -if test -r $linux_tree/include/linux/ipipe.h; then
> +if test -r $linux_tree/$probe_header; then
>      if test x$verbose = x1; then
> -       echo "I-pipe found - bypassing patch."
> +       echo "IRQ pipeline found - bypassing patch."
>      fi
>  else
>     if test x$verbose = x1; then
> -      echo "$me: no I-pipe support found." >&2
> +      echo "$me: no IRQ pipeline support found." >&2
>     fi
> -   while test x$ipipe_patch = x; do
> -      echo -n "I-pipe patch: "
> -      read ipipe_patch
> -      if test \! -r "$ipipe_patch" -o x$ipipe_patch = x; then
> -         echo "$me: cannot read I-pipe patch from $ipipe_patch" >&2
> -         ipipe_patch=
> +   while test x$pipeline_patch = x; do
> +      echo -n "IRQ pipeline patch: "
> +      read pipeline_patch
> +      if test \! -r "$pipeline_patch" -o x$pipeline_patch = x; then
> +         echo "$me: cannot read IRQ pipeline support from $pipeline_patch" >&2
> +         pipeline_patch=
>        fi
>     done
> -   patchdir=`dirname $ipipe_patch`; 
> +   patchdir=`dirname $pipeline_patch`; 
>     patchdir=`cd $patchdir && pwd`
> -   ipipe_patch=$patchdir/`basename $ipipe_patch`
> +   pipeline_patch=$patchdir/`basename $pipeline_patch`
>     curdir=$PWD
> -   cd $linux_tree && patch --dry-run -p1 -f < $ipipe_patch || { 
> +   cd $linux_tree && patch --dry-run -p1 -f < $pipeline_patch || { 
>          cd $curdir;
> -        echo "$me: Unable to patch kernel $linux_version$linux_EXTRAVERSION with `basename $ipipe_patch`." >&2
> +        echo "$me: Unable to patch kernel $linux_version$linux_EXTRAVERSION with `basename $pipeline_patch`." >&2
>          exit 2;
>     }
> -   patch -p1 -f -s < $ipipe_patch
> +   patch -p1 -f -s < $pipeline_patch
>     cd $curdir
>  fi
>  
> -if test \! -r $linux_tree/arch/$linux_arch/include/asm/ipipe.h; then
> -   echo "$me: $linux_tree has no I-pipe support for $linux_arch" >&2
> +if test \! -r $linux_tree/arch/$linux_arch/$arch_probe_header; then
> +   echo "$me: $linux_tree has no IRQ pipeline support for $linux_arch" >&2
>     exit 2
>  fi
>  
> -ipipe_core=`grep '^#define.*IPIPE_CORE_RELEASE.*' $linux_tree/arch/$linux_arch/include/asm/ipipe.h 2>/dev/null|head -n1|sed -e 's,[^0-9]*\([0-9]*\)$,\1,'`
> -if test "x$ipipe_core" = x; then
> -    echo "$me: $linux_tree has no I-pipe support for $linux_arch" >&2
> -    exit 2
> -fi
>  if test x$verbose = x1; then
> -   echo "I-pipe core/$linux_arch #$ipipe_core installed."
> +   echo "IRQ pipeline installed."
>  fi
>  
>  patch_kernelversion_specific="y"
> @@ -387,9 +407,9 @@ case $linux_VERSION.$linux_PATCHLEVEL in
>  test "x$CONFIG_XENO_REVISION_LEVEL" = "x" && CONFIG_XENO_REVISION_LEVEL=0
>  
>      if ! grep -q CONFIG_XENOMAI $linux_tree/arch/$linux_arch/Makefile; then
> -	p="KBUILD_CFLAGS += -I\$(srctree)/arch/\$(SRCARCH)/xenomai/include -I\$(srctree)/include/xenomai"
> +	p="KBUILD_CFLAGS += -I\$(srctree)/arch/\$(SRCARCH)/xenomai/include -I\$(srctree)/arch/\$(SRCARCH)/xenomai/$pipeline_type/include -I\$(srctree)/include/xenomai"
>  	(echo; echo $p) | patch_append arch/$linux_arch/Makefile
> -	p="core-\$(CONFIG_XENOMAI)	+= arch/$linux_arch/xenomai/"
> +	p="core-\$(CONFIG_XENOMAI)	+= arch/$linux_arch/xenomai/$pipeline_type/"
>  	echo $p | patch_append arch/$linux_arch/Makefile
>      fi
>  
> @@ -415,7 +435,7 @@ esac
>  patch_kernelversion_specific="n"
>  patch_architecture_specific="y"
>  patch_link r m kernel/cobalt/arch/$linux_arch arch/$linux_arch/xenomai
> -patch_link n n kernel/cobalt/include/ipipe arch/$linux_arch/include/ipipe
> +patch_link n n kernel/cobalt/include/$pipeline_type arch/$linux_arch/include/$pipeline_type
>  patch_architecture_specific="n"
>  patch_link n m kernel/cobalt kernel/xenomai
>  patch_link n cobalt-core.h kernel/cobalt/trace include/trace/events
> @@ -425,11 +445,11 @@ patch_link r n kernel/cobalt/include/asm-generic/xenomai include/asm-generic/xen
>  patch_link r n kernel/cobalt/include/linux/xenomai include/linux/xenomai
>  patch_link n m kernel/cobalt/posix kernel/xenomai/posix
>  patch_link n m kernel/cobalt/rtdm kernel/xenomai/rtdm
> -patch_link n m kernel/cobalt/ipipe kernel/xenomai/pipeline
> +patch_link n m kernel/cobalt/$pipeline_type kernel/xenomai/pipeline
>  patch_link r m kernel/drivers drivers/xenomai
>  patch_link n n include/cobalt/kernel include/xenomai/cobalt/kernel
>  patch_link r n include/cobalt/kernel/rtdm include/xenomai/rtdm
> -patch_link r n include/cobalt/kernel/ipipe/pipeline include/xenomai/pipeline
> +patch_link r n include/cobalt/kernel/$pipeline_type/pipeline include/xenomai/pipeline
>  patch_link r n include/cobalt/uapi include/xenomai/cobalt/uapi
>  patch_link r n include/rtdm/uapi include/xenomai/rtdm/uapi
>  patch_link n version.h include/xenomai include/xenomai
> 


-- 
Siemens AG, T RDA IOT
Corporate Competence Center Embedded Linux


^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2021-02-03 10:18 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-31 14:45 [PATCH 01/13] cobalt/kernel: pipeline: abstract context switching support Philippe Gerum
2021-01-31 14:45 ` [PATCH 02/13] cobalt/thread: pipeline: abstract synchronous single-stepping code Philippe Gerum
2021-01-31 14:45 ` [PATCH 03/13] cobalt/clock: pipeline: abstract access to host (real)time Philippe Gerum
2021-01-31 14:45 ` [PATCH 04/13] cobalt/arch: pipeline: move architecture code to pipeline-specific section Philippe Gerum
2021-02-03 10:18   ` Jan Kiszka
2021-01-31 14:45 ` [PATCH 05/13] cobalt/clock: pipeline: move TSC-related code to the I-pipe section Philippe Gerum
2021-01-31 14:45 ` [PATCH 06/13] cobalt/clock: drop timer calibration Philippe Gerum
2021-02-01 18:14   ` Jan Kiszka
2021-02-02 16:26     ` Philippe Gerum
2021-01-31 14:45 ` [PATCH 07/13] cobalt/arm: ipipe: remove obsolete calibration handler Philippe Gerum
2021-01-31 14:45 ` [PATCH 08/13] cobalt/arm64: " Philippe Gerum
2021-01-31 14:45 ` [PATCH 09/13] cobalt/x86: " Philippe Gerum
2021-01-31 14:45 ` [PATCH 10/13] cobalt/powerpc: " Philippe Gerum
2021-01-31 14:45 ` [PATCH 11/13] cobalt/machine: ipipe: drop timer frequency setting Philippe Gerum
2021-01-31 14:45 ` [PATCH 12/13] cobalt/init: ipipe: remove clock frequency override Philippe Gerum
2021-01-31 14:45 ` [PATCH 13/13] cobalt/assert: pipeline: add TODO() marker Philippe Gerum
2021-02-01 18:20   ` Jan Kiszka
2021-02-02 16:17     ` Philippe Gerum

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.