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

cobalt/sched: dovetail: add placeholders for context switching

Signed-off-by: Philippe Gerum's avatarPhilippe Gerum <rpm@xenomai.org>
Signed-off-by: Jan Kiszka's avatarJan Kiszka <jan.kiszka@siemens.com>
parent ab4365ff
/*
* SPDX-License-Identifier: GPL-2.0
*
* Copyright (C) 2020 Philippe Gerum <rpm@xenomai.org>
*/
#ifndef _COBALT_KERNEL_DOVETAIL_SCHED_H
#define _COBALT_KERNEL_DOVETAIL_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 ___xnsched_run(struct xnsched *sched);
static inline int pipeline_schedule(struct xnsched *sched)
{
return run_oob_call((int (*)(void *))___xnsched_run, sched);
}
static inline void pipeline_prep_switch_oob(struct xnthread *root)
{
/* N/A */
}
bool pipeline_switch_to(struct xnthread *prev,
struct xnthread *next,
bool leaving_inband);
int pipeline_leave_inband(void);
int pipeline_leave_oob_prepare(void);
void pipeline_leave_oob_finish(void);
static inline
void pipeline_finalize_thread(struct xnthread *thread)
{
/* N/A */
}
void pipeline_raise_mayday(struct task_struct *tsk);
void pipeline_clear_mayday(void);
#endif /* !_COBALT_KERNEL_DOVETAIL_SCHED_H */
......@@ -2,4 +2,4 @@ ccflags-y += -I$(srctree)/kernel
obj-y += pipeline.o
pipeline-y := init.o kevents.o
pipeline-y := init.o kevents.o sched.o
/*
* SPDX-License-Identifier: GPL-2.0
*
* Copyright (C) 2001-2020 Philippe Gerum <rpm@xenomai.org>.
*/
#include <linux/cpuidle.h>
#include <cobalt/kernel/thread.h>
#include <cobalt/kernel/sched.h>
#include <pipeline/sched.h>
#include <trace/events/cobalt-core.h>
/* in-band stage, hard_irqs_disabled() */
bool irq_cpuidle_control(struct cpuidle_device *dev,
struct cpuidle_state *state)
{
/*
* Deny entering sleep state if this entails stopping the
* timer (i.e. C3STOP misfeature).
*/
if (state && (state->flags & CPUIDLE_FLAG_TIMER_STOP))
return false;
return true;
}
bool pipeline_switch_to(struct xnthread *prev, struct xnthread *next,
bool leaving_inband)
{
return dovetail_context_switch(&xnthread_archtcb(prev)->altsched,
&xnthread_archtcb(next)->altsched, leaving_inband);
}
void pipeline_init_shadow_tcb(struct xnthread *thread)
{
/*
* Initialize the alternate scheduling control block.
*/
TODO();
trace_cobalt_shadow_map(thread);
}
void pipeline_init_root_tcb(struct xnthread *thread)
{
/*
* Initialize the alternate scheduling control block.
*/
TODO();
}
int pipeline_leave_inband(void)
{
return dovetail_leave_inband();
}
int pipeline_leave_oob_prepare(void)
{
dovetail_leave_oob();
return XNRELAX;
}
void pipeline_leave_oob_finish(void)
{
dovetail_resume_inband();
}
void pipeline_raise_mayday(struct task_struct *tsk)
{
dovetail_send_mayday(tsk);
}
void pipeline_clear_mayday(void) /* May solely affect current. */
{
clear_thread_flag(TIF_MAYDAY);
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment