From mboxrd@z Thu Jan 1 00:00:00 1970 From: Philippe Gerum Subject: [PATCH Dovetail 10/13] cobalt/wrappers: pipeline: abstract pipeline-related bits Date: Sat, 2 Jan 2021 10:33:50 +0100 Message-Id: <20210102093353.3195090-11-rpm@xenomai.org> In-Reply-To: <20210102093353.3195090-1-rpm@xenomai.org> References: <20210102093353.3195090-1-rpm@xenomai.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: Discussions about the Xenomai project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: xenomai@xenomai.org From: Philippe Gerum No functional change is introduced. Signed-off-by: Philippe Gerum --- .../cobalt/kernel/ipipe/pipeline/wrappers.h | 25 +++++++++++++++++++ .../cobalt/include/linux/xenomai/wrappers.h | 23 ++++------------- kernel/cobalt/posix/process.c | 2 +- 3 files changed, 31 insertions(+), 19 deletions(-) create mode 100644 include/cobalt/kernel/ipipe/pipeline/wrappers.h diff --git a/include/cobalt/kernel/ipipe/pipeline/wrappers.h b/include/cobalt/kernel/ipipe/pipeline/wrappers.h new file mode 100644 index 000000000..ac940fb32 --- /dev/null +++ b/include/cobalt/kernel/ipipe/pipeline/wrappers.h @@ -0,0 +1,25 @@ +/* + * SPDX-License-Identifier: GPL-2.0 + */ +#ifndef _COBALT_KERNEL_IPIPE_WRAPPERS_H +#define _COBALT_KERNEL_IPIPE_WRAPPERS_H + +#include + +#if LINUX_VERSION_CODE < KERNEL_VERSION(4,11,0) +#define cobalt_set_task_state(tsk, state_value) \ + set_task_state(tsk, state_value) +#else +/* + * The co-kernel can still set the current task state safely if it + * runs on the head stage. + */ +#define cobalt_set_task_state(tsk, state_value) \ + smp_store_mb((tsk)->state, (state_value)) +#endif + +#ifndef ipipe_root_nr_syscalls +#define ipipe_root_nr_syscalls(ti) NR_syscalls +#endif + +#endif /* !_COBALT_KERNEL_IPIPE_WRAPPERS_H */ diff --git a/kernel/cobalt/include/linux/xenomai/wrappers.h b/kernel/cobalt/include/linux/xenomai/wrappers.h index 847d68088..3e825e366 100644 --- a/kernel/cobalt/include/linux/xenomai/wrappers.h +++ b/kernel/cobalt/include/linux/xenomai/wrappers.h @@ -21,12 +21,13 @@ #include +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 20, 0) +typedef siginfo_t kernel_siginfo_t; +#endif + #if LINUX_VERSION_CODE < KERNEL_VERSION(4,11,0) #include #include - -#define cobalt_set_task_state(tsk, state_value) \ - set_task_state(tsk, state_value) #else #include #include @@ -35,22 +36,8 @@ #include #include #include -/* - * The co-kernel can still do this sanely for a thread which is - * currently active on the head stage. - */ -#define cobalt_set_task_state(tsk, state_value) \ - smp_store_mb((tsk)->state, (state_value)) #endif -#include - -#ifndef ipipe_root_nr_syscalls -#define ipipe_root_nr_syscalls(ti) NR_syscalls -#endif - -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 20, 0) -typedef siginfo_t kernel_siginfo_t; -#endif +#include #endif /* !_COBALT_LINUX_WRAPPERS_H */ diff --git a/kernel/cobalt/posix/process.c b/kernel/cobalt/posix/process.c index accd989ca..fcae7df06 100644 --- a/kernel/cobalt/posix/process.c +++ b/kernel/cobalt/posix/process.c @@ -640,7 +640,7 @@ int cobalt_map_user(struct xnthread *thread, __u32 __user *u_winoff) * it. */ xnthread_run_handler(thread, map_thread); - pipeline_enable_kevents(current); + pipeline_enable_kevents(); attr.mode = 0; attr.entry = NULL; -- 2.26.2