[Xenomai-git] Philippe Gerum : cobalt/arm64: disable callee-saved logic in fptest helpers

2017-05-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: bc8659089dcaa4a49e05e101fb4aee456031b58f
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=bc8659089dcaa4a49e05e101fb4aee456031b58f

Author: Philippe Gerum 
Date:   Thu Oct 22 14:45:05 2015 +0200

cobalt/arm64: disable callee-saved logic in fptest helpers

We don't want GCC to apply any callee-saved logic to fpsimd registers
in fp_regs_set() before fp_regs_check() can verify their contents, but
we still want GCC to know about the registers we have clobbered.

---

 .../arch/arm64/include/asm/xenomai/uapi/fptest.h   |  160 ++--
 testsuite/switchtest/switchtest.c  |   14 +-
 2 files changed, 92 insertions(+), 82 deletions(-)

diff --git a/kernel/cobalt/arch/arm64/include/asm/xenomai/uapi/fptest.h 
b/kernel/cobalt/arch/arm64/include/asm/xenomai/uapi/fptest.h
index 84607b7..7a2cb92 100644
--- a/kernel/cobalt/arch/arm64/include/asm/xenomai/uapi/fptest.h
+++ b/kernel/cobalt/arch/arm64/include/asm/xenomai/uapi/fptest.h
@@ -20,86 +20,86 @@
 
 #define __COBALT_HAVE_FPU  0x1
 
-static inline void fp_regs_set(int features, unsigned int val)
-{
-
-   unsigned long long e[32];
-   unsigned int i;
-
-   if (features & __COBALT_HAVE_FPU) {
-
-   for (i = 0; i < 32; i++)
-   e[i] = val;
-
-   __asm__ __volatile__("ldp d0, d1, [%0, #8 * 0] \n\
-   ldp   d2, d3, [%0, #8 * 
2] \n\
-   ldp d4, d5, [%0, #8 
* 4]\n\
-   ldp d6, d7, [%0, #8 
* 6]\n\
-   ldp d8, d9, [%0, #8 
* 8]\n\
-   ldp d10, d11, [%0, 
#8 * 10]\n\
-   ldp d12, d13, [%0, 
#8 * 12]\n\
-   ldp d14, d15, [%0, 
#8 * 14]\n\
-   ldp d16, d17, [%0, 
#8 * 16]\n\
-   ldp d18, d19, [%0, 
#8 * 18]\n\
-   ldp d20, d21, [%0, 
#8 * 20]\n\
-   ldp d22, d23, [%0, 
#8 * 22]\n\
-   ldp d24, d25, [%0, 
#8 * 24]\n\
-   ldp d26, d27, [%0, 
#8 * 26]\n\
-   ldp d28, d29, [%0, 
#8 * 28]\n\
-   ldp d30, d31, [%0, 
#8 * 30]"
-
-   : /* No outputs. */
-   : "r"([0])
- : "d0", "d1", "d2", "d3", "d4", "d5", "d6", 
"d7", "d8", "d9", "d10", "d11", "d12", "d13", "d14", "d15",
-   "d16", "d17", "d18", "d19", "d20", 
"d21", "d22", "d23", "d24", "d25", "d26", "d27", "d28", "d29", "d30", "d31", 
"memory"
-   );
-   }
-
-}
-
-static inline unsigned int fp_regs_check(int features, unsigned int val,
-int (*report)(const char *fmt, ...))
-{
-   unsigned int result = val;
-
-   unsigned int i;
-   unsigned long long e[32];
-
-   if (features & __COBALT_HAVE_FPU) {
-
-   __asm__ __volatile__("stp d0, d1, [%0, #8 * 0] \n\
-   stp   d2, d3, [%0, #8 * 
2] \n\
-   stp d4, d5, [%0, #8 
* 4]\n\
-   stp d6, d7, [%0, #8 
* 6]\n\
-   stp d8, d9, 
[%0, #8 * 8]\n\
-   stp d10, d11, [%0, 
#8 * 10]\n\
-   stp d12, d13, [%0, 
#8 * 12]\n\
-   stp d14, d15, [%0, 
#8 * 14]\n\
-   stp d16, d17, [%0, 
#8 * 16]\n\
-   stp d18, d19, [%0, 
#8 * 18]\n\
-   stp d20, d21, [%0, 
#8 * 20]\n\
-   stp d22, d23, [%0, 
#8 * 22]\n\
-   stp d24, d25, [%0, 
#8 * 24]\n\
-   stp d26, d27, [%0, 
#8 * 26]\n\
-   stp d28, d29, [%0, 
#8 * 28]\n\
-   stp d30, d31, [%0, 
#8 * 30]"
-
-   :  /* No 

[Xenomai-git] Don Mahurin : cobalt/arm64: fix build for mismatched printf type (%lx, u64) on arm64.

2017-05-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 4544f1c54fed1f54454b6060cc50e164dd4c6260
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=4544f1c54fed1f54454b6060cc50e164dd4c6260

Author: Don Mahurin 
Date:   Wed Sep  2 13:48:36 2015 -0700

cobalt/arm64: fix build for mismatched printf type (%lx,u64) on arm64.

pc and orig_r0 are u64 on arm64 and 'unsigned long' or arm and other platforms. 
printf referencing these are using %lx. On arm64, long and long long (and u64) 
are 64 bits. Rather than changing printf format, chnage arm64 macros to cast to 
unsigned long.

---

 kernel/cobalt/arch/arm64/include/asm/xenomai/syscall.h |2 +-
 kernel/cobalt/arch/arm64/include/asm/xenomai/thread.h  |2 +-
 kernel/cobalt/posix/syscall.c  |2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/kernel/cobalt/arch/arm64/include/asm/xenomai/syscall.h 
b/kernel/cobalt/arch/arm64/include/asm/xenomai/syscall.h
index 7bf95fb..77c1716 100644
--- a/kernel/cobalt/arch/arm64/include/asm/xenomai/syscall.h
+++ b/kernel/cobalt/arch/arm64/include/asm/xenomai/syscall.h
@@ -45,7 +45,7 @@
 #else /* !CONFIG_OABI_COMPAT */
 #define __xn_syscall_p(__regs) ((__regs)->regs[8] == __ARM_NR_ipipe)
 #endif /* !CONFIG_OABI_COMPAT */
-#define __xn_syscall(__regs)   (__xn_reg_sys(__regs) & ~__COBALT_SYSCALL_BIT)
+#define __xn_syscall(__regs)   ((unsigned long)(__xn_reg_sys(__regs) & 
~__COBALT_SYSCALL_BIT))
 
 #define __xn_reg_rval(__regs)  ((__regs)->regs[0])
 #define __xn_reg_arg1(__regs)  ((__regs)->regs[1])
diff --git a/kernel/cobalt/arch/arm64/include/asm/xenomai/thread.h 
b/kernel/cobalt/arch/arm64/include/asm/xenomai/thread.h
index 958f340..a8d7ed4 100644
--- a/kernel/cobalt/arch/arm64/include/asm/xenomai/thread.h
+++ b/kernel/cobalt/arch/arm64/include/asm/xenomai/thread.h
@@ -52,7 +52,7 @@ struct xnarchtcb {
 #define xnarch_fault_regs(d)   ((d)->regs)
 #define xnarch_fault_trap(d)   ((d)->exception)
 #define xnarch_fault_code(d)   (0)
-#define xnarch_fault_pc(d) ((d)->regs->pc - 4) /* XXX ? */
+#define xnarch_fault_pc(d) ((unsigned long)((d)->regs->pc - 4)) /* XXX ? */
 
 #define xnarch_fault_pf_p(d)   ((d)->exception == IPIPE_TRAP_ACCESS)
 #define xnarch_fault_bp_p(d)   ((current->ptrace & PT_PTRACED) &&  \
diff --git a/kernel/cobalt/posix/syscall.c b/kernel/cobalt/posix/syscall.c
index 2926d7e..8186a0f 100644
--- a/kernel/cobalt/posix/syscall.c
+++ b/kernel/cobalt/posix/syscall.c
@@ -666,7 +666,7 @@ linux_syscall:
return KEVENT_PROPAGATE;
 
 bad_syscall:
-   printk(XENO_WARNING "bad syscall <%#llx>\n", __xn_syscall(regs));
+   printk(XENO_WARNING "bad syscall <%#lx>\n", __xn_syscall(regs));
 
__xn_error_return(regs, -ENOSYS);
 


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Dmitriy Cherkasov : cobalt/arm64: xenomai/syscall.h: update syscall register

2017-05-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 89d30c0e067da31cd6562ddba4202a31bd43c88b
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=89d30c0e067da31cd6562ddba4202a31bd43c88b

Author: Dmitriy Cherkasov 
Date:   Fri May  8 15:54:18 2015 -0700

cobalt/arm64: xenomai/syscall.h: update syscall register

---

 kernel/cobalt/arch/arm64/include/asm/xenomai/syscall.h |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/kernel/cobalt/arch/arm64/include/asm/xenomai/syscall.h 
b/kernel/cobalt/arch/arm64/include/asm/xenomai/syscall.h
index 2fdd890..7bf95fb 100644
--- a/kernel/cobalt/arch/arm64/include/asm/xenomai/syscall.h
+++ b/kernel/cobalt/arch/arm64/include/asm/xenomai/syscall.h
@@ -40,10 +40,10 @@
 #define __xn_reg_sys(__regs)   ((__regs)->orig_x0)
 /* In OABI_COMPAT mode, handle both OABI and EABI userspace syscalls */
 #ifdef CONFIG_OABI_COMPAT
-#define __xn_syscall_p(__regs) (((__regs)->regs[7] == __NR_OABI_SYSCALL_BASE + 
XENO_ARM_SYSCALL) || \
-((__regs)->regs[7] == __ARM_NR_ipipe))
+#define __xn_syscall_p(__regs) (((__regs)->regs[8] == __NR_OABI_SYSCALL_BASE + 
XENO_ARM_SYSCALL) || \
+((__regs)->regs[8] == __ARM_NR_ipipe))
 #else /* !CONFIG_OABI_COMPAT */
-#define __xn_syscall_p(__regs) ((__regs)->regs[7] == __ARM_NR_ipipe)
+#define __xn_syscall_p(__regs) ((__regs)->regs[8] == __ARM_NR_ipipe)
 #endif /* !CONFIG_OABI_COMPAT */
 #define __xn_syscall(__regs)   (__xn_reg_sys(__regs) & ~__COBALT_SYSCALL_BIT)
 


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Dmitriy Cherkasov : cobalt/arm64: populate arch/arm64 with a copy of arch/ arm.

2017-05-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 7c9b5cc0eef0d7d86eb829e5cecaadc69eb7de81
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=7c9b5cc0eef0d7d86eb829e5cecaadc69eb7de81

Author: Dmitriy Cherkasov 
Date:   Wed May  6 15:27:23 2015 -0700

cobalt/arm64: populate arch/arm64 with a copy of arch/arm.

kernel/cobalt/arch/arm -> kernel/cobalt/arch/arm64
lib/cobalt/arch/arm -> lib/cobalt/arch/arm64

---

 configure.ac   |   12 +-
 kernel/cobalt/arch/arm64/Kconfig   |   40 +++
 kernel/cobalt/arch/arm64/Makefile  |5 +
 .../arch/arm64/include/asm/xenomai/calibration.h   |   59 
 .../arch/arm64/include/asm/xenomai/features.h  |   30 ++
 .../cobalt/arch/arm64/include/asm/xenomai/fptest.h |   52 +++
 .../arch/arm64/include/asm/xenomai/machine.h   |   85 +
 .../arch/arm64/include/asm/xenomai/syscall.h   |   74 
 .../arch/arm64/include/asm/xenomai/syscall32.h |   24 ++
 .../cobalt/arch/arm64/include/asm/xenomai/thread.h |  123 +++
 .../arch/arm64/include/asm/xenomai/uapi/arith.h|  142 
 .../arch/arm64/include/asm/xenomai/uapi/features.h |   43 +++
 .../arch/arm64/include/asm/xenomai/uapi/fptest.h   |   61 
 .../arch/arm64/include/asm/xenomai/uapi/syscall.h  |   34 ++
 .../arch/arm64/include/asm/xenomai/uapi/tsc.h  |   25 ++
 .../arch/arm64/include/asm/xenomai/wrappers.h  |   27 ++
 kernel/cobalt/arch/arm64/machine.c |  119 +++
 kernel/cobalt/arch/arm64/mayday.c  |  146 
 kernel/cobalt/arch/arm64/switch.S  |  167 +
 kernel/cobalt/arch/arm64/syscall.c |   53 +++
 kernel/cobalt/arch/arm64/thread.c  |  355 
 lib/cobalt/arch/Makefile.am|2 +-
 lib/cobalt/arch/arm64/Makefile.am  |   13 +
 lib/cobalt/arch/arm64/features.c   |  102 ++
 lib/cobalt/arch/arm64/include/Makefile.am  |2 +
 lib/cobalt/arch/arm64/include/asm/Makefile.am  |2 +
 .../arch/arm64/include/asm/xenomai/Makefile.am |5 +
 .../arch/arm64/include/asm/xenomai/features.h  |   62 
 .../arch/arm64/include/asm/xenomai/syscall.h   |  138 
 lib/cobalt/arch/arm64/include/asm/xenomai/tsc.h|   48 +++
 30 files changed, 2047 insertions(+), 3 deletions(-)

diff --git a/configure.ac b/configure.ac
index 6593f5d..97bebf0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -139,6 +139,10 @@ case "$build_for" in
target_cpu_arch=arm
CONFIG_XENO_DEFAULT_PERIOD=100
;;
+ aarch64-*)
+   target_cpu_arch=arm64
+   CONFIG_XENO_DEFAULT_PERIOD=100
+   ;;
  x86_64-*|amd64-*)
use_tls=yes
target_cpu_arch=x86
@@ -361,7 +365,7 @@ fi
 
 dnl VSYSCALL (default: enabled) for Cobalt/x86
 
-if test $XENO_TARGET_ARCH = x86 -a $rtcore_type = cobalt; then
+if test $target_cpu_arch = x86 -a $rtcore_type = cobalt; then
   CONFIG_XENO_X86_VSYSCALL=y
   AC_MSG_CHECKING(for x86 VSYSCALL availability)
   AC_ARG_ENABLE(x86-vsyscall,
@@ -788,7 +792,7 @@ dnl Autoconf-generated symbols have been listed.
 AH_BOTTOM([#endif /* __IN_XENO__ */])
 
 if test $rtcore_type = cobalt; then
-   XENO_USER_CFLAGS="-I$topdir/lib/cobalt/arch/$XENO_TARGET_ARCH/include 
-I$topdir/kernel/cobalt/arch/$XENO_TARGET_ARCH/include $XENO_USER_CFLAGS"
+   XENO_USER_CFLAGS="-I$topdir/lib/cobalt/arch/$target_cpu_arch/include 
-I$topdir/kernel/cobalt/arch/$target_cpu_arch/include $XENO_USER_CFLAGS"
XENO_COBALT_CFLAGS="$XENO_USER_CFLAGS"
case "$build_for" in
 i*86*-*) XENO_COBALT_CFLAGS="$XENO_COBALT_CFLAGS -fno-omit-frame-pointer";;
@@ -868,6 +872,10 @@ AC_CONFIG_FILES([ \
lib/cobalt/arch/arm/include/Makefile \
lib/cobalt/arch/arm/include/asm/Makefile \
lib/cobalt/arch/arm/include/asm/xenomai/Makefile \
+   lib/cobalt/arch/arm64/Makefile \
+   lib/cobalt/arch/arm64/include/Makefile \
+   lib/cobalt/arch/arm64/include/asm/Makefile \
+   lib/cobalt/arch/arm64/include/asm/xenomai/Makefile \
lib/cobalt/arch/powerpc/Makefile \
lib/cobalt/arch/powerpc/include/Makefile \
lib/cobalt/arch/powerpc/include/asm/Makefile \
diff --git a/kernel/cobalt/arch/arm64/Kconfig b/kernel/cobalt/arch/arm64/Kconfig
new file mode 100644
index 000..dc6485d
--- /dev/null
+++ b/kernel/cobalt/arch/arm64/Kconfig
@@ -0,0 +1,40 @@
+source "kernel/xenomai/Kconfig"
+source "drivers/xenomai/Kconfig"
+
+menu "Machine/platform-specific options"
+
+config XENO_ARCH_UNLOCKED_SWITCH
+   bool "Unlocked context switch"
+   default y
+   help
+   The Cobalt core may allow non-atomic execution of the
+   machine-dependent context switching code, so that other CPUs
+   and/or local interrupts may execute concurrently.
+
+   This option reduces interrupt latency when costly cache and
+   TLB flushes are required to switch context.
+
+  

[Xenomai-git] Philippe Gerum : cobalt/arm64: leave mm tracking to the pipeline

2017-05-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 997cd57cfa8e294fee53ff3f220389cd5defba7e
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=997cd57cfa8e294fee53ff3f220389cd5defba7e

Author: Philippe Gerum 
Date:   Thu Sep 17 15:08:34 2015 +0200

cobalt/arm64: leave mm tracking to the pipeline

---

 kernel/cobalt/arch/arm64/Kconfig |3 ---
 1 file changed, 3 deletions(-)

diff --git a/kernel/cobalt/arch/arm64/Kconfig b/kernel/cobalt/arch/arm64/Kconfig
index 927c647..dd5a8c6 100644
--- a/kernel/cobalt/arch/arm64/Kconfig
+++ b/kernel/cobalt/arch/arm64/Kconfig
@@ -4,9 +4,6 @@ source "drivers/xenomai/Kconfig"
 config XENO_ARCH_UNLOCKED_SWITCH
def_bool IPIPE_WANT_PREEMPTIBLE_SWITCH
 
-config IPIPE_WANT_ACTIVE_MM
-   def_bool y
-
 config XENO_ARCH_WANT_TIP
def_bool y
 


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : cobalt/arm64: restrict unlocked switch to SMP

2017-05-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 8b742e6c590899f4f9ee53302a05e6a0a7ed7a46
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=8b742e6c590899f4f9ee53302a05e6a0a7ed7a46

Author: Philippe Gerum 
Date:   Thu Sep 17 11:43:50 2015 +0200

cobalt/arm64: restrict unlocked switch to SMP

Unlocked switching for Xenomai/ARM was specifically introduced for
improving the interrupt latency on low-end armv4/armv5 platforms with
VIVT caches.

The once massive overhead imposed on the MMU context switching code
for invalidating the cache is long gone with VIPT indexing, and
keeping IRQs off while switching the memory context on armv8 these
days is not an issue. Actually, the complexity of the code involved in
dealing with unlocked switching may overbalance the expected gain.

However, the mainline kernel implementation for ASID management in the
SMP case currently requires us to keep IRQs enabled when allocating a
new MM context over the Xenomai domain, just like it did for aarch32
during the 2.6.3x time frame until the IPI-based approach was
eventually dropped.

So, let's restrict unlocked switching to the SMP case, forcing it off
otherwise, in the hope we can drop it entirely in the future.

At this chance, CONFIG_IPIPE_WANT_PREEMPTIBLE_SWITCH moves to the
kernel area, where it actually belongs.

---

 kernel/cobalt/arch/arm64/Kconfig |   21 +
 1 file changed, 1 insertion(+), 20 deletions(-)

diff --git a/kernel/cobalt/arch/arm64/Kconfig b/kernel/cobalt/arch/arm64/Kconfig
index dc6485d..927c647 100644
--- a/kernel/cobalt/arch/arm64/Kconfig
+++ b/kernel/cobalt/arch/arm64/Kconfig
@@ -1,27 +1,8 @@
 source "kernel/xenomai/Kconfig"
 source "drivers/xenomai/Kconfig"
 
-menu "Machine/platform-specific options"
-
 config XENO_ARCH_UNLOCKED_SWITCH
-   bool "Unlocked context switch"
-   default y
-   help
-   The Cobalt core may allow non-atomic execution of the
-   machine-dependent context switching code, so that other CPUs
-   and/or local interrupts may execute concurrently.
-
-   This option reduces interrupt latency when costly cache and
-   TLB flushes are required to switch context.
-
-   You definitely want to enable that option on low-end ARM
-   platforms.
-endmenu
-
-config IPIPE_WANT_PREEMPTIBLE_SWITCH
-   bool
-   default y if XENO_ARCH_UNLOCKED_SWITCH
-   default n if !XENO_ARCH_UNLOCKED_SWITCH
+   def_bool IPIPE_WANT_PREEMPTIBLE_SWITCH
 
 config IPIPE_WANT_ACTIVE_MM
def_bool y


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : cobalt/arm64: add README for I-pipe support

2017-05-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 9c41dabcde2028a3b947cf9b633d6b412e1b5294
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=9c41dabcde2028a3b947cf9b633d6b412e1b5294

Author: Philippe Gerum 
Date:   Sun Nov  1 17:22:33 2015 +0100

cobalt/arm64: add README for I-pipe support

---

 kernel/cobalt/arch/arm64/patches/README |   16 
 1 file changed, 16 insertions(+)

diff --git a/kernel/cobalt/arch/arm64/patches/README 
b/kernel/cobalt/arch/arm64/patches/README
new file mode 100644
index 000..fd85e06
--- /dev/null
+++ b/kernel/cobalt/arch/arm64/patches/README
@@ -0,0 +1,16 @@
+-- arch/arm64/patches
+
+Xenomai needs special kernel support to deliver fast and deterministic
+response time to external interrupts, and also to provide real-time
+services highly integrated with the standard Linux kernel.
+
+This support is provided by the interrupt pipeline (aka I-pipe) in the
+form of a kernel patch you have to apply against a vanilla kernel
+tree, before you attempt to compile the Xenomai codebase against the
+latter kernel.
+
+The Xenomai arm64 port is work in progress. The I-pipe support for
+this architecture is exclusively available from this development tree
+at the moment:
+
+git://git.xenomai.org/ipipe.git, branch devel/ipipe-3.18-linaro-arm64.


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Dmitriy Cherkasov : cobalt/arm64: FPU code cleanup

2017-05-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 283f9cf0111f1208123ad758401a94039d9e1bd0
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=283f9cf0111f1208123ad758401a94039d9e1bd0

Author: Dmitriy Cherkasov 
Date:   Fri Oct  2 12:54:37 2015 -0700

cobalt/arm64: FPU code cleanup

---

 kernel/cobalt/arch/arm64/thread.c |   89 -
 1 file changed, 39 insertions(+), 50 deletions(-)

diff --git a/kernel/cobalt/arch/arm64/thread.c 
b/kernel/cobalt/arch/arm64/thread.c
index db369be..35dbd72 100644
--- a/kernel/cobalt/arch/arm64/thread.c
+++ b/kernel/cobalt/arch/arm64/thread.c
@@ -36,31 +36,44 @@
 
 #if defined(CONFIG_XENO_ARCH_FPU)
 
-static void enable_fpsimd(void) {
-   __asm__ __volatile__("mrs x1, cpacr_el1\n\
-   orr x1, x1, #(0x3 << 20)\n\
-   msr cpacr_el1, x1\n\
-   isb" : : : "x1", "memory", "cc");
+#define FPSIMD_EN (0x3 << 20)
+
+static inline unsigned long get_cpacr(void)
+{
+   unsigned long result;
+   __asm__ __volatile__("mrs %0, cpacr_el1": "=r"(result));
+   return result;
+}
+
+static inline void set_cpacr(long val)
+{
+   __asm__ __volatile__ (
+   "msr cpacr_el1, %0\n\t"
+   "isb"
+   : /* */ : "r"(val));
 }
 
-static void disable_fpsimd(void) {
-   __asm__ __volatile__("mrs x1, cpacr_el1\n\
-   and x1, x1, #~(0x3 << 20)\n\
-   msr cpacr_el1, x1\n\
-   isb" : : : "x1", "memory", "cc");
+static void enable_fpsimd(void)
+{
+   unsigned long cpacr = get_cpacr();
+   cpacr |= FPSIMD_EN;
+   set_cpacr(cpacr);
+}
+
+static void disable_fpsimd(void)
+{
+   unsigned long cpacr = get_cpacr();
+   cpacr &= ~FPSIMD_EN;
+   set_cpacr(cpacr);
 }
 
 int xnarch_fault_fpu_p(struct ipipe_trap_data *d)
 {
-   /* check if this is an FPU access trap to be handled by Xenomai */
-   if(d->exception == IPIPE_TRAP_FPU_ACC){
-   return 1;
-   }
-   /* FPU already enabled, propagate fault to kernel */
-   return 0;
+   return (d->exception == IPIPE_TRAP_FPU_ACC);
 }
 
-static inline struct fpsimd_state *get_fpu_owner(struct xnarchtcb *tcb) {
+static inline struct fpsimd_state *get_fpu_owner(struct xnarchtcb *tcb)
+{
return &(tcb->core.tsp->fpsimd_state);
 }
 
@@ -68,7 +81,6 @@ void xnarch_leave_root(struct xnthread *root)
 {
struct xnarchtcb *rootcb = xnthread_archtcb(root);
rootcb->fpup = get_fpu_owner(rootcb);
-   disable_fpsimd();
 }
 
 void xnarch_save_fpu(struct xnthread *thread)
@@ -83,29 +95,15 @@ void xnarch_switch_fpu(struct xnthread *from, struct 
xnthread *to)
struct fpsimd_state *const from_fpup = from ? from->tcb.fpup : NULL;
struct fpsimd_state *const to_fpup = to->tcb.fpup;
 
-   /*
-* This only gets called if XNFPU flag is set, or if migrating to Linux.
-* In both cases, this means turn on FPU and switch.
-*/
enable_fpsimd();
 
-   if (xnthread_test_state(to, XNROOT) == 0) {
-   if (from_fpup == to_fpup)
-   return;
-
-   if (from_fpup)
-   fpsimd_save_state(from_fpup);
-
-   fpsimd_load_state(to_fpup);
-   }
-   else {
-   /* Going to Linux. */
-   if (from_fpup)
-   fpsimd_save_state(from_fpup);
+   if (from_fpup == to_fpup)
+   return;
 
-   fpsimd_load_state(to_fpup);
-   }
+   if (from_fpup)
+   fpsimd_save_state(from_fpup);
 
+   fpsimd_load_state(to_fpup);
 }
 
 int xnarch_handle_fpu_fault(struct xnthread *from, 
@@ -113,9 +111,9 @@ int xnarch_handle_fpu_fault(struct xnthread *from,
 {
spl_t s;
 
+   /* FPU should already be enabled for XNFPU tasks. */
if (xnthread_test_state(to, XNFPU))
-   /* FPU is already enabled, probably an exception */
-  return 0;
+   BUG();
 
xnlock_get_irqsave(, s);
xnthread_set_state(to, XNFPU);
@@ -124,20 +122,13 @@ int xnarch_handle_fpu_fault(struct xnthread *from,
xnarch_switch_fpu(from, to);
 
return 1;
-
 }
 
 void xnarch_init_shadow_tcb(struct xnthread *thread)
 {
-   spl_t s;
struct xnarchtcb *tcb = xnthread_archtcb(thread);
-
tcb->fpup = &(tcb->core.host_task->thread.fpsimd_state);
-
-   xnlock_get_irqsave(, s);
xnthread_clear_state(thread, XNFPU);
-   xnlock_put_irqrestore(, s);
-
 }
 #endif /* CONFIG_XENO_ARCH_FPU */
 
@@ -210,16 +201,14 @@ void xnarch_switch_to(struct xnthread *out, struct 
xnthread *in)
xnarch_tls_thread_switch(in_tcb->core.tip->task);
xnarch_contextidr_thread_switch(in_tcb->core.tip->task);
 
-   /* check if we need to switch FPU on return to Linux */
-   if (xnthread_test_state(in, XNROOT) == 1)
-   

[Xenomai-git] Dmitriy Cherkasov : cobalt/arm64: thread: use kernel switch_to

2017-05-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 70428fab9a5c37238f56031aebeb769f16b1f445
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=70428fab9a5c37238f56031aebeb769f16b1f445

Author: Dmitriy Cherkasov 
Date:   Fri May 15 23:26:18 2015 -0700

cobalt/arm64: thread: use kernel switch_to

---

 kernel/cobalt/arch/arm64/Makefile |2 +-
 kernel/cobalt/arch/arm64/switch.S |  167 -
 kernel/cobalt/arch/arm64/thread.c |5 +-
 3 files changed, 2 insertions(+), 172 deletions(-)

diff --git a/kernel/cobalt/arch/arm64/Makefile 
b/kernel/cobalt/arch/arm64/Makefile
index a135f99..af0a0e8 100644
--- a/kernel/cobalt/arch/arm64/Makefile
+++ b/kernel/cobalt/arch/arm64/Makefile
@@ -1,5 +1,5 @@
 obj-$(CONFIG_XENOMAI) += xenomai.o
 
-xenomai-y := machine.o mayday.o thread.o switch.o syscall.o
+xenomai-y := machine.o mayday.o thread.o syscall.o
 
 ccflags-y := -Iarch/arm64/xenomai/include -Iinclude/xenomai
diff --git a/kernel/cobalt/arch/arm64/switch.S 
b/kernel/cobalt/arch/arm64/switch.S
deleted file mode 100644
index 505fd5a..000
--- a/kernel/cobalt/arch/arm64/switch.S
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- * Copyright (C) 2005 Stelian Pop.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, Inc., 675 Mass Ave, Cambridge MA 02139,
- * USA; either version 2 of the License, or (at your option) any later
- * version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#ifdef CONFIG_VFP
-#include 
-#endif
-
-   .macro fpu_switch tmp
-#ifdef CONFIG_VFP
-#if __LINUX_ARM_ARCH__ <= 6
-#ifdef CONFIG_JUMP_LABEL
-9998:  nop
-   .pushsection __jump_table, "aw"
-   .word   9998b, f, __xeno_vfp_key
-   .popsection
-#else
-   ldr \tmp, =elf_hwcap
-   ldr \tmp, [\tmp]
-   tst \tmp, #HWCAP_VFP
-   beq f
-#endif
-#endif
-   @ Always disable VFP so we can lazily save/restore the old
-   @ state. This occurs in the context of the previous thread.
-   VFPFMRX \tmp, FPEXC
-   bic \tmp, \tmp, #FPEXC_EN
-   VFPFMXR FPEXC, \tmp
-#if __LINUX_ARM_ARCH__ <= 6
-:
-#endif
-#endif
-   .endm
-
-   .text
-
-#if defined(CONFIG_VFP) && defined(CONFIG_XENO_ARCH_FPU)
-/* Copied from vfp_save_state in arch/arm/vfp/vfphw.S
- * r0 = pointer to union vfp_state, r1 = fpexc
- */
-ENTRY(__asm_vfp_save)
-   VFPFSTMIA   r0, r2  @ save the working registers
-   VFPFMRX r2, FPSCR   @ current status
-   tst r1, #FPEXC_EX   @ is there additional state to save?
-   beq 1f
-   VFPFMRX r3, FPINST  @ FPINST (only if FPEXC.EX is set)
-   tst r1, #FPEXC_FP2V @ is there an FPINST2 to read?
-   beq 1f
-   VFPFMRX r12, FPINST2@ FPINST2 if needed (and present)
-1:
-   stmia   r0, {r1, r2, r3, r12}   @ save FPEXC, FPSCR, FPINST, 
FPINST2
-   mov pc, lr
-ENDPROC(__asm_vfp_save)
-
-/* Copied from no_old_VFP_process in arch/arm/vfp/vfphw.S
- * r0 = pointer to union vfp_state
- * r1 = current cpu
- */
-ENTRY(__asm_vfp_load)
-#ifdef CONFIG_SMP
-   str r1, [r0, #VFP_CPU]
-#endif
-   VFPFLDMIA   r0, r2  @ reload the working registers while
-   @ FPEXC is in a safe state
-   ldmia   r0, {r1, r2, r3, r12}   @ load FPEXC, FPSCR, FPINST, 
FPINST2
-   tst r1, #FPEXC_EX   @ is there additional state to restore?
-   beq 1f
-   VFPFMXR FPINST, r3  @ restore FPINST (only if FPEXC.EX is 
set)
-   tst r1, #FPEXC_FP2V @ is there an FPINST2 to write?
-   beq 1f
-   VFPFMXR FPINST2, r12@ FPINST2 if needed (and present)
-1:
-   VFPFMXR FPSCR, r2   @ restore status
-   mov pc, lr
-ENDPROC(__asm_vfp_load)
-#endif
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 11, 0)
-   .macro load_tls base, tp, tpuser
-   ldr \tp, [\base, #TI_TP_VALUE]
-   .endm
-
-   .macro switch_tls base, tp, tpuser, tmp1, tmp2
-   set_tls \tp, \tmp1, \tmp2
-   .endm
-#else
-   .macro load_tls base, tp, tpuser
-   ldr \tp, [\base, #TI_TP_VALUE]
-   ldr \tpuser, [\base, #TI_TP_VALUE + 4]
-   .endm
-#endif
-
-/*
-/*
- * Switch context routine.
- *
- * Registers 

[Xenomai-git] Don Mahurin : lib/cobalt/arm64: replace tsc counter

2017-05-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: ced6fc7b93ea8ea7bafda069dcc769e0e28d17c5
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=ced6fc7b93ea8ea7bafda069dcc769e0e28d17c5

Author: Don Mahurin 
Date:   Wed May 13 09:36:25 2015 -0700

lib/cobalt/arm64: replace tsc counter

---

 lib/cobalt/arch/arm64/include/asm/xenomai/tsc.h |   19 +++
 1 file changed, 19 insertions(+)

diff --git a/lib/cobalt/arch/arm64/include/asm/xenomai/tsc.h 
b/lib/cobalt/arch/arm64/include/asm/xenomai/tsc.h
index 594c4ad..a055427 100644
--- a/lib/cobalt/arch/arm64/include/asm/xenomai/tsc.h
+++ b/lib/cobalt/arch/arm64/include/asm/xenomai/tsc.h
@@ -27,6 +27,8 @@
 
 #include 
 #include 
+#include 
+#include 
 
 /*
  * Putting kuser_tsc_get and kinfo.counter in the same struct results
@@ -39,10 +41,27 @@ struct __xn_full_tscinfo {
 };
 extern struct __xn_full_tscinfo __xn_tscinfo;
 
+static inline uint64_t get_counter(void)
+{
+uint64_t cval;
+
+#ifdef __aarch64__
+   asm volatile("isb; mrs %0, cntvct_el0; isb; " : "=r" (cval) :: 
"memory");
+#else
+   asm volatile("isb; mrrc p15, 1, %Q0, %R0, c14; isb" : "=r" (cval) :: 
"memory");
+#endif
+
+   return cval;
+}
+
 static inline __attribute__((always_inline))
 unsigned long long cobalt_read_tsc(void)
 {
+#ifndef __aarch64__
return __xn_tscinfo.kuser_tsc_get(__xn_tscinfo.kinfo.counter);
+#else
+   return get_counter();
+#endif
 }
 
 #endif /* !_LIB_COBALT_ARM_TSC_H */


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Dmitriy Cherkasov : cobalt/arm64: features.h: disable XNARCH_HAVE_LLMULSHFT, XNARCH_HAVE_NODIV_LLIMD for armv8/aarch64, as arm64 does not have these

2017-05-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: fb3dffa2bcb6ab9a54214d8dac38e02168ef25d0
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=fb3dffa2bcb6ab9a54214d8dac38e02168ef25d0

Author: Dmitriy Cherkasov 
Date:   Thu May  7 16:40:07 2015 -0700

cobalt/arm64: features.h: disable XNARCH_HAVE_LLMULSHFT, 
XNARCH_HAVE_NODIV_LLIMD for armv8/aarch64, as arm64 does not have these

---

 kernel/cobalt/arch/arm64/include/asm/xenomai/uapi/features.h |2 ++
 1 file changed, 2 insertions(+)

diff --git a/kernel/cobalt/arch/arm64/include/asm/xenomai/uapi/features.h 
b/kernel/cobalt/arch/arm64/include/asm/xenomai/uapi/features.h
index 2dd1ada..cf7bbf4 100644
--- a/kernel/cobalt/arch/arm64/include/asm/xenomai/uapi/features.h
+++ b/kernel/cobalt/arch/arm64/include/asm/xenomai/uapi/features.h
@@ -28,8 +28,10 @@
 
 #define XENOMAI_FEAT_MAN (__xn_feat_generic_man_mask)
 
+#ifndef __aarch64__
 #define XNARCH_HAVE_LLMULSHFT1
 #define XNARCH_HAVE_NODIV_LLIMD  1
+#endif
 
 struct cobalt_featinfo_archdep { /* no arch-specific feature */ };
 


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Don Mahurin : cobalt/arm64: Use empty mayday implementation for arm64.

2017-05-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 8e01baf52cf27af6c875846fc874a8ef91c92a8c
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=8e01baf52cf27af6c875846fc874a8ef91c92a8c

Author: Don Mahurin 
Date:   Mon Sep 14 12:52:27 2015 -0700

cobalt/arm64: Use empty mayday implementation for arm64.

The arm mayday implementation was not correct for arm64. Replace with empty 
implementation.
Handle mayday in the linux domain, using xnthread_relax. This change is 
essentially the same as the general change proposed in the 'Mayday issues 
again' discussion (Jan Kiszka, Jun 21), though only applied to arch/arm64.

---

 kernel/cobalt/arch/arm64/mayday.c |   86 +
 1 file changed, 1 insertion(+), 85 deletions(-)

diff --git a/kernel/cobalt/arch/arm64/mayday.c 
b/kernel/cobalt/arch/arm64/mayday.c
index bc51ad6..ca1151c 100644
--- a/kernel/cobalt/arch/arm64/mayday.c
+++ b/kernel/cobalt/arch/arm64/mayday.c
@@ -28,72 +28,6 @@ static void *mayday;
 
 static inline void setup_mayday(void *page)
 {
-   /*
-* We want this code to appear at the top of the MAYDAY page:
-*
-* ifdef ARM_EABI
-*
-* e59f000c ldr r0, [pc, #12]
-* e59f700c ldr r7, [pc, #12]
-* ef00 svc 0x
-* e3a0 mov r0, #0
-* e580 str r0, [r0]; 
-* 105e .word   0x105e  ; sc_cobalt_mayday | 
__COBALT_SYSCALL_BIT
-* 000f0042 .word   0x000f0042
-*
-* elif ARM_OABI
-*
-* e59f0008 ldr r0, [pc, #8]
-* ef9f0042 swi 0x009f0042
-* e3a0 mov r0, #0
-* e580 str r0, [r0]; 
-* 105e .word   0x105e  ; sc_cobalt_mayday | 
__COBALT_SYSCALL_BIT
-*
-* endif
-*
-* 32bit instruction words will be laid out by the compiler as
-* the target endianness requires.
-*
-* We don't mess with CPSR here, so no need to save/restore it
-* in handle/fixup code.
-*/
-#ifdef __ARM_EABI__
-   static const struct {
-   u32 ldr_r0;
-   u32 ldr_r7;
-   u32 swi_0;
-   u32 mov_r0;
-   u32 str_r0;
-   u32 cst_r0;
-   u32 cst_r7;
-   } code = {
-   .ldr_r0 = 0xe59f000c,
-   .ldr_r7 = 0xe59f700c,
-   .swi_0 = 0xef00,
-   .mov_r0 = 0xe3a0,
-   .str_r0 = 0xe580,
-   .cst_r0 =  __xn_syscode(sc_cobalt_mayday),
-   .cst_r7 = 0x000f0042,
-   };
-#else /* OABI */
-   static const struct {
-   u32 ldr_r0;
-   u32 swi_syscall;
-   u32 mov_r0;
-   u32 str_r0;
-   u32 cst_r0;
-   } code = {
-   .ldr_r0 = 0xe59f0008,
-   .swi_syscall = 0xef9f0042,
-   .mov_r0 = 0xe3a0,
-   .str_r0 = 0xe580,
-   .cst_r0 =  __xn_syscode(sc_cobalt_mayday),
-   };
-#endif /* OABI */
-
-   memcpy(page, , sizeof(code));
-
-   flush_dcache_page(vmalloc_to_page(page));
 }
 
 int xnarch_init_mayday(void)
@@ -120,27 +54,9 @@ void *xnarch_get_mayday_page(void)
 void xnarch_handle_mayday(struct xnarchtcb *tcb, struct pt_regs *regs,
  unsigned long tramp)
 {
-   tcb->mayday.pc = regs->pc;
-   tcb->mayday.r0 = regs->regs[0];
-#ifdef __ARM_EABI__
-   tcb->mayday.r7 = regs->regs[7];
-#endif
-#ifdef CONFIG_ARM_THUMB
-   /* The code on the mayday page must be run in ARM mode */
-   tcb->mayday.psr = regs->cpsr;
-   regs->cpsr &= ~PSR_T_BIT;
-#endif
-   regs->pc = tramp;
+   xnthread_relax(0, 0);
 }
 
 void xnarch_fixup_mayday(struct xnarchtcb *tcb, struct pt_regs *regs)
 {
-   regs->pc = tcb->mayday.pc;
-   regs->regs[0] = tcb->mayday.r0;
-#ifdef __ARM_EABI__
-   regs->regs[7] = tcb->mayday.r7;
-#endif
-#ifdef CONFIG_ARM_THUMB
-   regs->cpsr = tcb->mayday.psr;
-#endif
 }


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Don Mahurin : lib/cobalt/arm64: add __LINUX_ARM_ARCH__ form armv8/aarch64

2017-05-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: c63ca0384a9dc196aa62d2e7ccff5c8825cf
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=c63ca0384a9dc196aa62d2e7ccff5c8825cf

Author: Don Mahurin 
Date:   Fri May  8 10:39:01 2015 -0700

lib/cobalt/arm64: add __LINUX_ARM_ARCH__ form armv8/aarch64

---

 lib/cobalt/arch/arm64/include/asm/xenomai/features.h |4 
 1 file changed, 4 insertions(+)

diff --git a/lib/cobalt/arch/arm64/include/asm/xenomai/features.h 
b/lib/cobalt/arch/arm64/include/asm/xenomai/features.h
index 10bd0c7..0d6702b 100644
--- a/lib/cobalt/arch/arm64/include/asm/xenomai/features.h
+++ b/lib/cobalt/arch/arm64/include/asm/xenomai/features.h
@@ -47,6 +47,10 @@
 #define __LINUX_ARM_ARCH__ 7
 #endif /* armv7 */
 
+#if defined(__aarch64__)
+#define __LINUX_ARM_ARCH__ 8
+#endif /* armv8 */
+
 #ifndef __LINUX_ARM_ARCH__
 #error "Could not find current ARM architecture"
 #endif


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Don Mahurin : cobalt/arm64: fix warning: expects argument of type ' long unsigned int', but argument has type 'u64'

2017-05-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 0e7a66f33a25e5f1f92f83b9c6650953b244
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=0e7a66f33a25e5f1f92f83b9c6650953b244

Author: Don Mahurin 
Date:   Thu May 14 17:34:53 2015 -0700

cobalt/arm64: fix warning: expects argument of type 'long unsigned int', but 
argument has type 'u64'

---

 kernel/cobalt/posix/syscall.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/cobalt/posix/syscall.c b/kernel/cobalt/posix/syscall.c
index 8186a0f..2926d7e 100644
--- a/kernel/cobalt/posix/syscall.c
+++ b/kernel/cobalt/posix/syscall.c
@@ -666,7 +666,7 @@ linux_syscall:
return KEVENT_PROPAGATE;
 
 bad_syscall:
-   printk(XENO_WARNING "bad syscall <%#lx>\n", __xn_syscall(regs));
+   printk(XENO_WARNING "bad syscall <%#llx>\n", __xn_syscall(regs));
 
__xn_error_return(regs, -ENOSYS);
 


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Dmitriy Cherkasov : cobalt/arm64: add lazy FPU switching

2017-05-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: bc0058ac420b833229ee5b44fcef986378fd6042
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=bc0058ac420b833229ee5b44fcef986378fd6042

Author: Dmitriy Cherkasov 
Date:   Thu Oct  1 15:47:41 2015 -0700

cobalt/arm64: add lazy FPU switching

---

 kernel/cobalt/arch/arm64/thread.c |   83 +++--
 1 file changed, 62 insertions(+), 21 deletions(-)

diff --git a/kernel/cobalt/arch/arm64/thread.c 
b/kernel/cobalt/arch/arm64/thread.c
index 316525f6..db369be 100644
--- a/kernel/cobalt/arch/arm64/thread.c
+++ b/kernel/cobalt/arch/arm64/thread.c
@@ -32,16 +32,31 @@
 #include 
 #include 
 #include 
-
+#include 
 
 #if defined(CONFIG_XENO_ARCH_FPU)
 
-static DEFINE_MUTEX(vfp_check_lock);
+static void enable_fpsimd(void) {
+   __asm__ __volatile__("mrs x1, cpacr_el1\n\
+   orr x1, x1, #(0x3 << 20)\n\
+   msr cpacr_el1, x1\n\
+   isb" : : : "x1", "memory", "cc");
+}
 
+static void disable_fpsimd(void) {
+   __asm__ __volatile__("mrs x1, cpacr_el1\n\
+   and x1, x1, #~(0x3 << 20)\n\
+   msr cpacr_el1, x1\n\
+   isb" : : : "x1", "memory", "cc");
+}
 
 int xnarch_fault_fpu_p(struct ipipe_trap_data *d)
 {
-   /* FPU never trapped, this will be a fault */
+   /* check if this is an FPU access trap to be handled by Xenomai */
+   if(d->exception == IPIPE_TRAP_FPU_ACC){
+   return 1;
+   }
+   /* FPU already enabled, propagate fault to kernel */
return 0;
 }
 
@@ -53,6 +68,7 @@ void xnarch_leave_root(struct xnthread *root)
 {
struct xnarchtcb *rootcb = xnthread_archtcb(root);
rootcb->fpup = get_fpu_owner(rootcb);
+   disable_fpsimd();
 }
 
 void xnarch_save_fpu(struct xnthread *thread)
@@ -65,45 +81,67 @@ void xnarch_save_fpu(struct xnthread *thread)
 void xnarch_switch_fpu(struct xnthread *from, struct xnthread *to)
 {
struct fpsimd_state *const from_fpup = from ? from->tcb.fpup : NULL;
-
-   /* always switch, no lazy switching */
-
struct fpsimd_state *const to_fpup = to->tcb.fpup;
 
-   if (from_fpup == to_fpup)
-   return;
+   /*
+* This only gets called if XNFPU flag is set, or if migrating to Linux.
+* In both cases, this means turn on FPU and switch.
+*/
+   enable_fpsimd();
+
+   if (xnthread_test_state(to, XNROOT) == 0) {
+   if (from_fpup == to_fpup)
+   return;
 
-   if (from_fpup)
-   fpsimd_save_state(from_fpup);
+   if (from_fpup)
+   fpsimd_save_state(from_fpup);
 
-   fpsimd_load_state(to_fpup);
+   fpsimd_load_state(to_fpup);
+   }
+   else {
+   /* Going to Linux. */
+   if (from_fpup)
+   fpsimd_save_state(from_fpup);
 
-   /* always set FPU enabled */
-   xnthread_set_state(to, XNFPU);
+   fpsimd_load_state(to_fpup);
+   }
 
 }
 
 int xnarch_handle_fpu_fault(struct xnthread *from, 
struct xnthread *to, struct ipipe_trap_data *d)
 {
-   /* FPU always enabled, faults force exit to Linux */
-   return 0;
+   spl_t s;
+
+   if (xnthread_test_state(to, XNFPU))
+   /* FPU is already enabled, probably an exception */
+  return 0;
+
+   xnlock_get_irqsave(, s);
+   xnthread_set_state(to, XNFPU);
+   xnlock_put_irqrestore(, s);
+
+   xnarch_switch_fpu(from, to);
+
+   return 1;
+
 }
 
 void xnarch_init_shadow_tcb(struct xnthread *thread)
 {
+   spl_t s;
struct xnarchtcb *tcb = xnthread_archtcb(thread);
 
tcb->fpup = &(tcb->core.host_task->thread.fpsimd_state);
 
-   /* XNFPU is always set, no lazy switching */
-   xnthread_set_state(thread, XNFPU);
+   xnlock_get_irqsave(, s);
+   xnthread_clear_state(thread, XNFPU);
+   xnlock_put_irqrestore(, s);
+
 }
 #endif /* CONFIG_XENO_ARCH_FPU */
 
-
 /* Switch support functions */
-
 static void xnarch_tls_thread_switch(struct task_struct *next)
 {
unsigned long tpidr, tpidrro;
@@ -141,8 +179,7 @@ static inline void xnarch_contextidr_thread_switch(struct 
task_struct *next)
 {
 }
 #endif
-
-/*/Switch support functions */
+/* End switch support functions */
 
 void xnarch_switch_to(struct xnthread *out, struct xnthread *in)
 {
@@ -173,6 +210,10 @@ void xnarch_switch_to(struct xnthread *out, struct 
xnthread *in)
xnarch_tls_thread_switch(in_tcb->core.tip->task);
xnarch_contextidr_thread_switch(in_tcb->core.tip->task);
 
+   /* check if we need to switch FPU on return to Linux */
+   if (xnthread_test_state(in, XNROOT) == 1)
+   xnarch_switch_fpu(out, in);
+
/*
 * Complete any pending TLB or cache maintenance on this CPU in case
 * the thread 

[Xenomai-git] Philippe Gerum : cobalt/thread: track thread_info unconditionally

2017-05-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: a81155e9220c1404296c9bc71ab1126e1b294e60
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=a81155e9220c1404296c9bc71ab1126e1b294e60

Author: Philippe Gerum 
Date:   Sat Nov 14 14:47:44 2015 +0100

cobalt/thread: track thread_info unconditionally

We almost always want to track the thread_info structure of the host
task in the core tcb, and doing so is cheap, so there is no point in
building this support conditionally.

---

 kernel/cobalt/arch/arm/Kconfig |3 ---
 kernel/cobalt/arch/arm64/Kconfig   |3 ---
 kernel/cobalt/arch/powerpc/Kconfig |4 
 kernel/cobalt/include/asm-generic/xenomai/thread.h |2 --
 kernel/cobalt/sched.c  |2 --
 kernel/cobalt/thread.c |4 
 6 files changed, 18 deletions(-)

diff --git a/kernel/cobalt/arch/arm/Kconfig b/kernel/cobalt/arch/arm/Kconfig
index dc6485d..2043d70 100644
--- a/kernel/cobalt/arch/arm/Kconfig
+++ b/kernel/cobalt/arch/arm/Kconfig
@@ -26,9 +26,6 @@ config IPIPE_WANT_PREEMPTIBLE_SWITCH
 config IPIPE_WANT_ACTIVE_MM
def_bool y
 
-config XENO_ARCH_WANT_TIP
-   def_bool y
-
 config XENO_ARCH_FPU
def_bool VFP
 
diff --git a/kernel/cobalt/arch/arm64/Kconfig b/kernel/cobalt/arch/arm64/Kconfig
index 27b5026..572de3e 100644
--- a/kernel/cobalt/arch/arm64/Kconfig
+++ b/kernel/cobalt/arch/arm64/Kconfig
@@ -4,9 +4,6 @@ source "drivers/xenomai/Kconfig"
 config XENO_ARCH_UNLOCKED_SWITCH
def_bool IPIPE_WANT_PREEMPTIBLE_SWITCH
 
-config XENO_ARCH_WANT_TIP
-   def_bool y
-
 config XENO_ARCH_FPU
def_bool y
 
diff --git a/kernel/cobalt/arch/powerpc/Kconfig 
b/kernel/cobalt/arch/powerpc/Kconfig
index 3e950f5..4d5e6db 100644
--- a/kernel/cobalt/arch/powerpc/Kconfig
+++ b/kernel/cobalt/arch/powerpc/Kconfig
@@ -10,9 +10,6 @@ config IPIPE_WANT_PREEMPTIBLE_SWITCH
default y if XENO_ARCH_UNLOCKED_SWITCH
default n if !XENO_ARCH_UNLOCKED_SWITCH
 
-config XENO_ARCH_WANT_TIP
-   bool
-
 config XENO_ARCH_FPU
def_bool PPC_FPU
 
@@ -24,7 +21,6 @@ menu "Machine/platform-specific options"
 config XENO_ARCH_UNLOCKED_SWITCH
bool "Unlocked context switch"
depends on IPIPE_HAVE_PREEMPTIBLE_SWITCH
-   select XENO_ARCH_WANT_TIP
default y
help
 
diff --git a/kernel/cobalt/include/asm-generic/xenomai/thread.h 
b/kernel/cobalt/include/asm-generic/xenomai/thread.h
index 2ff19a4..cd0c6e9 100644
--- a/kernel/cobalt/include/asm-generic/xenomai/thread.h
+++ b/kernel/cobalt/include/asm-generic/xenomai/thread.h
@@ -33,9 +33,7 @@ struct xntcb {
struct mm_struct *mm;
struct mm_struct *active_mm;
struct thread_struct ts;
-#ifdef CONFIG_XENO_ARCH_WANT_TIP
struct thread_info *tip;
-#endif
 #ifdef CONFIG_XENO_ARCH_FPU
struct task_struct *user_fpu_owner;
 #endif
diff --git a/kernel/cobalt/sched.c b/kernel/cobalt/sched.c
index cbe14bd..09960ac 100644
--- a/kernel/cobalt/sched.c
+++ b/kernel/cobalt/sched.c
@@ -806,9 +806,7 @@ static inline void leave_root(struct xnthread *root)
rootcb->core.host_task = p;
rootcb->core.tsp = >thread;
rootcb->core.mm = rootcb->core.active_mm = ipipe_get_active_mm();
-#ifdef CONFIG_XENO_ARCH_WANT_TIP
rootcb->core.tip = task_thread_info(p);
-#endif
xnarch_leave_root(root);
 }
 
diff --git a/kernel/cobalt/thread.c b/kernel/cobalt/thread.c
index 6a86265..b5817c5 100644
--- a/kernel/cobalt/thread.c
+++ b/kernel/cobalt/thread.c
@@ -261,9 +261,7 @@ void xnthread_init_shadow_tcb(struct xnthread *thread)
tcb->core.tsp = >thread;
tcb->core.mm = p->mm;
tcb->core.active_mm = p->mm;
-#ifdef CONFIG_XENO_ARCH_WANT_TIP
tcb->core.tip = task_thread_info(p);
-#endif
 #ifdef CONFIG_XENO_ARCH_FPU
tcb->core.user_fpu_owner = p;
 #endif /* CONFIG_XENO_ARCH_FPU */
@@ -279,9 +277,7 @@ void xnthread_init_root_tcb(struct xnthread *thread)
tcb->core.host_task = p;
tcb->core.tsp = >core.ts;
tcb->core.mm = p->mm;
-#ifdef CONFIG_XENO_ARCH_WANT_TIP
tcb->core.tip = NULL;
-#endif
xnarch_init_root_tcb(thread);
 }
 


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : cobalt/arm64: sanitize calibration file

2017-05-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: d7d3c830d451d2d3d228098fe7146b58576d0f6e
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=d7d3c830d451d2d3d228098fe7146b58576d0f6e

Author: Philippe Gerum 
Date:   Thu Sep 17 04:01:49 2015 +0200

cobalt/arm64: sanitize calibration file

---

 .../arch/arm64/include/asm/xenomai/calibration.h   |   44 +---
 1 file changed, 11 insertions(+), 33 deletions(-)

diff --git a/kernel/cobalt/arch/arm64/include/asm/xenomai/calibration.h 
b/kernel/cobalt/arch/arm64/include/asm/xenomai/calibration.h
index e303a04..e85521e 100644
--- a/kernel/cobalt/arch/arm64/include/asm/xenomai/calibration.h
+++ b/kernel/cobalt/arch/arm64/include/asm/xenomai/calibration.h
@@ -1,13 +1,10 @@
 /*
- * Copyright (C) 2001,2002,2003,2004,2005 Philippe Gerum .
+ * Copyright (C) 2015 Philippe Gerum .
  *
- * ARM port
- *   Copyright (C) 2005 Stelian Pop
- *
- * Xenomai is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * Xenomai is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published
+ * by the Free Software Foundation; either version 2 of the License,
+ * or (at your option) any later version.
  *
  * Xenomai is distributed in the hope that it will be useful, but
  * WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -19,41 +16,22 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  * 02111-1307, USA.
  */
-#ifndef _COBALT_ARM_ASM_CALIBRATION_H
-#define _COBALT_ARM_ASM_CALIBRATION_H
-
-unsigned int omap_rev(void);
-#define cpu_is_omap44xx() ((omap_rev() & 0xff) == 0x44)
+#ifndef _COBALT_ARM64_ASM_CALIBRATION_H
+#define _COBALT_ARM64_ASM_CALIBRATION_H
 
 static inline void xnarch_get_latencies(struct xnclock_gravity *p)
 {
unsigned int ulat;
 #if CONFIG_XENO_OPT_TIMING_SCHEDLAT != 0
ulat = CONFIG_XENO_OPT_TIMING_SCHEDLAT;
-#elif defined(CONFIG_ARCH_AT91RM9200)
-   ulat = 8500;
-#elif defined(CONFIG_ARCH_AT91SAM9263)
-   ulat = 11000;
-#elif defined(CONFIG_SOC_IMX6Q)
-   ulat = 6000;
-#elif defined(CONFIG_ARCH_MX51)
-   ulat = 5000;
-#elif defined(CONFIG_ARCH_MX53)
-   ulat = 5000;
-#elif defined(CONFIG_ARCH_MX6)
-   ulat = 2000;
-#elif defined(CONFIG_SOC_IMX7)
-   ulat = 2000;
-#elif defined(CONFIG_SOC_LS1021A)
-   ulat = 2800;
-#elif defined(CONFIG_ARCH_OMAP)
-   ulat = cpu_is_omap44xx() ? 2500 : 5000;
+#elif defined(CONFIG_ARCH_HISI)
+   ulat = 4000;
 #else
-   ulat = 9500;/* XXX sane? */
+   ulat = 4000;
 #endif
p->user = xnclock_ns_to_ticks(, ulat);
p->kernel = xnclock_ns_to_ticks(, 
CONFIG_XENO_OPT_TIMING_KSCHEDLAT);
p->irq = xnclock_ns_to_ticks(, CONFIG_XENO_OPT_TIMING_IRQLAT);
 }
 
-#endif /* !_COBALT_ARM_ASM_CALIBRATION_H */
+#endif /* !_COBALT_ARM64_ASM_CALIBRATION_H */


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : cobalt/x86: silence warning about unused variable

2017-05-21 Thread git repository hosting
Module: xenomai-3
Branch: stable-3.0.x
Commit: e94cd3482b96e5688d1ef4686a5ae18336695771
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=e94cd3482b96e5688d1ef4686a5ae18336695771

Author: Philippe Gerum 
Date:   Thu May 18 17:32:36 2017 +0200

cobalt/x86: silence warning about unused variable

---

 kernel/cobalt/arch/x86/thread.c |1 +
 1 file changed, 1 insertion(+)

diff --git a/kernel/cobalt/arch/x86/thread.c b/kernel/cobalt/arch/x86/thread.c
index e40dd6f..7fb1363 100644
--- a/kernel/cobalt/arch/x86/thread.c
+++ b/kernel/cobalt/arch/x86/thread.c
@@ -240,6 +240,7 @@ void xnarch_switch_to(struct xnthread *out, struct xnthread 
*in)
  out_tcb->spp, in_tcb->spp,
  out_tcb->ipp, in_tcb->ipp);
 #endif /* CONFIG_X86_64 */
+   (void)last;
 #else /* LINUX_VERSION_CODE >= 4.8 */
switch_to(prev, next, last);
 #endif /* LINUX_VERSION_CODE >= 4.8 */


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Dmitriy Cherkasov : cobalt/arm64: Makefile: fix arch path

2017-05-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 01b301ba3d675ffb387b4476ed3fea7a3a74f9b0
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=01b301ba3d675ffb387b4476ed3fea7a3a74f9b0

Author: Dmitriy Cherkasov 
Date:   Thu May  7 13:54:32 2015 -0700

cobalt/arm64: Makefile: fix arch path

---

 kernel/cobalt/arch/arm64/Makefile |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/cobalt/arch/arm64/Makefile 
b/kernel/cobalt/arch/arm64/Makefile
index f2e4e20..a135f99 100644
--- a/kernel/cobalt/arch/arm64/Makefile
+++ b/kernel/cobalt/arch/arm64/Makefile
@@ -2,4 +2,4 @@ obj-$(CONFIG_XENOMAI) += xenomai.o
 
 xenomai-y := machine.o mayday.o thread.o switch.o syscall.o
 
-ccflags-y := -Iarch/arm/xenomai/include -Iinclude/xenomai
+ccflags-y := -Iarch/arm64/xenomai/include -Iinclude/xenomai


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Dmitriy Cherkasov : cobalt/arm64: fix fpu exception names

2017-05-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 8bb61e244a00d5f8bc1f5d9980e2fd3dd2f8971a
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=8bb61e244a00d5f8bc1f5d9980e2fd3dd2f8971a

Author: Dmitriy Cherkasov 
Date:   Mon Sep 28 16:13:45 2015 -0700

cobalt/arm64: fix fpu exception names

---

 kernel/cobalt/arch/arm64/machine.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/cobalt/arch/arm64/machine.c 
b/kernel/cobalt/arch/arm64/machine.c
index f48d4a8..ddf65a8 100644
--- a/kernel/cobalt/arch/arm64/machine.c
+++ b/kernel/cobalt/arch/arm64/machine.c
@@ -99,8 +99,8 @@ static const char *const fault_labels[] = {
[IPIPE_TRAP_DABT] = "Generic data abort",
[IPIPE_TRAP_UNKNOWN] = "Unknown exception",
[IPIPE_TRAP_BREAK] = "Instruction breakpoint",
-   [IPIPE_TRAP_FPU] = "Floating point exception",
-   [IPIPE_TRAP_VFP] = "VFP Floating point exception",
+   [IPIPE_TRAP_FPU_ACC] = "Floating point access",
+   [IPIPE_TRAP_FPU_EXC] = "Floating point exception",
[IPIPE_TRAP_UNDEFINSTR] = "Undefined instruction",
 #ifdef IPIPE_TRAP_ALIGNMENT
[IPIPE_TRAP_ALIGNMENT] = "Unaligned access exception",


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : doc/README: mention per-arch READMEs

2017-05-21 Thread git repository hosting
Module: xenomai-3
Branch: stable-3.0.x
Commit: 8c0f8161373d483ca827d22056b8fe53e16cf847
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=8c0f8161373d483ca827d22056b8fe53e16cf847

Author: Philippe Gerum 
Date:   Sun May 21 16:33:55 2017 +0200

doc/README: mention per-arch READMEs

---

 README |3 +++
 1 file changed, 3 insertions(+)

diff --git a/README b/README
index f0be8a7..bfb2207 100644
--- a/README
+++ b/README
@@ -5,6 +5,9 @@ Where to start from?
 http://xenomai.org/start-here/ is the best place to start learning
 about Xenomai 3.
 
+Also, make sure to read the per-architecture README files, i.e.:
+kernel/cobalt/arch/*/README
+
 Built-in documentation
 ==
 


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Henning Schild : scripts/xeno-config: add -Wl, --no-as-needed

2017-05-21 Thread git repository hosting
Module: xenomai-3
Branch: stable-3.0.x
Commit: 83dea2ad712ee2d2137942c7ab9891da7d4ef841
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=83dea2ad712ee2d2137942c7ab9891da7d4ef841

Author: Henning Schild 
Date:   Tue May 16 15:50:00 2017 +0200

scripts/xeno-config: add -Wl,--no-as-needed

Linking with "--as-needed" could cause the linker to not list essential
wrapping libraries as needed for a shared library or a dynamically
linked binary. The result would be runtime ld.so errors for the binaries
or linking problems with the .so.
gcc defaults to "--no-as-needed" that is why we never needed to specify
that flag explicitly. But gcc from Ubuntu is patched to default to
"--as-needed".
This patch enforces "--no-as-needed", which will have no effect on most
toolchains. On Ubuntu it will override the default and make sure xenomai
applications get linked as expected.

Signed-off-by: Henning Schild 

---

 scripts/xeno-config-cobalt.in  |1 +
 scripts/xeno-config-mercury.in |1 +
 2 files changed, 2 insertions(+)

diff --git a/scripts/xeno-config-cobalt.in b/scripts/xeno-config-cobalt.in
index 82815e1..ae313d3 100644
--- a/scripts/xeno-config-cobalt.in
+++ b/scripts/xeno-config-cobalt.in
@@ -282,6 +282,7 @@ if test x$do_ldflags = xy; then
fi
bootstrap="${XENO_LIBRARY_DIR}/xenomai/bootstrap${codegen}.o"
 fi
+ldflags="-Wl,--no-as-needed $ldflags"
 echo "$ldflags $copperplate $bootstrap $wrap_main $XENO_POSIX_LDFLAGS"
 fi
 
diff --git a/scripts/xeno-config-mercury.in b/scripts/xeno-config-mercury.in
index a0aa75b..2d2842f 100644
--- a/scripts/xeno-config-mercury.in
+++ b/scripts/xeno-config-mercury.in
@@ -213,6 +213,7 @@ if test x$do_ldflags = xy; then
fi
bootstrap="${XENO_LIBRARY_DIR}/xenomai/bootstrap${codegen}.o"
 fi
+ldflags="-Wl,--no-as-needed $ldflags"
 echo "$ldflags $copperplate $bootstrap $wrap_main $XENO_BASE_LDFLAGS"
 fi
 


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : doc/README: mention per-arch READMEs

2017-05-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 8c0f8161373d483ca827d22056b8fe53e16cf847
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=8c0f8161373d483ca827d22056b8fe53e16cf847

Author: Philippe Gerum 
Date:   Sun May 21 16:33:55 2017 +0200

doc/README: mention per-arch READMEs

---

 README |3 +++
 1 file changed, 3 insertions(+)

diff --git a/README b/README
index f0be8a7..bfb2207 100644
--- a/README
+++ b/README
@@ -5,6 +5,9 @@ Where to start from?
 http://xenomai.org/start-here/ is the best place to start learning
 about Xenomai 3.
 
+Also, make sure to read the per-architecture README files, i.e.:
+kernel/cobalt/arch/*/README
+
 Built-in documentation
 ==
 


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : cobalt/arm64: assume TLS is properly supported

2017-05-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 8ce4b1540382a6cb2cff90230b2266a9cbed9f0d
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=8ce4b1540382a6cb2cff90230b2266a9cbed9f0d

Author: Philippe Gerum 
Date:   Thu Sep 17 02:19:57 2015 +0200

cobalt/arm64: assume TLS is properly supported

---

 lib/cobalt/arch/arm64/include/asm/xenomai/syscall.h |9 +++--
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/lib/cobalt/arch/arm64/include/asm/xenomai/syscall.h 
b/lib/cobalt/arch/arm64/include/asm/xenomai/syscall.h
index 1d5806c..8e7ad61 100644
--- a/lib/cobalt/arch/arm64/include/asm/xenomai/syscall.h
+++ b/lib/cobalt/arch/arm64/include/asm/xenomai/syscall.h
@@ -18,8 +18,8 @@
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.
  */
-#ifndef _LIB_COBALT_ARM_SYSCALL_H
-#define _LIB_COBALT_ARM_SYSCALL_H
+#ifndef _LIB_COBALT_ARM64_SYSCALL_H
+#define _LIB_COBALT_ARM64_SYSCALL_H
 
 #include 
 #include 
@@ -29,9 +29,6 @@
  * Some of the following macros have been adapted from Linux's
  * implementation of the syscall mechanism in :
  */
-#if defined(HAVE_TLS) && __GNUC__ == 4 && __GNUC_MINOR__ >= 3
-#error TLS support (__thread) is broken with GCC >= 4.3, use --disable-tls 
when configuring
-#endif
 
 #define LOADARGS_0(syscode, dummy...)  \
__a0 = (unsigned long) (syscode)
@@ -143,4 +140,4 @@
 #define XENOMAI_SYSBIND(breq)  \
XENOMAI_DO_SYSCALL(1,sc_cobalt_bind,breq)
 
-#endif /* !_LIB_COBALT_ARM_SYSCALL_H */
+#endif /* !_LIB_COBALT_ARM64_SYSCALL_H */


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : cobalt/kernel: fixup for v3.19+ (trace_seq)

2017-05-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 447c10a385c5ac83ea291e83aa5de31fa318906a
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=447c10a385c5ac83ea291e83aa5de31fa318906a

Author: Philippe Gerum 
Date:   Tue Nov  3 13:11:25 2015 +0100

cobalt/kernel: fixup for v3.19+ (trace_seq)

---

 kernel/cobalt/include/asm-generic/xenomai/wrappers.h |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/cobalt/include/asm-generic/xenomai/wrappers.h 
b/kernel/cobalt/include/asm-generic/xenomai/wrappers.h
index 7b191e4..05be40d 100644
--- a/kernel/cobalt/include/asm-generic/xenomai/wrappers.h
+++ b/kernel/cobalt/include/asm-generic/xenomai/wrappers.h
@@ -55,6 +55,7 @@
 
 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,17,0)
 #include 
+#include 
 
 #undef alloc_netdev
 #define alloc_netdev(sizeof_priv, name, name_assign_type, setup) \
@@ -67,7 +68,6 @@ trace_seq_buffer_ptr(struct trace_seq *s)
 {
return s->buffer + s->len;
 }
-
 #endif /* < 3.17 */
 
 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,16,0)


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Dmitriy Cherkasov : cobalt/arm64: add basic FPU support

2017-05-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: bfda6bf6febb298d6f4bf5eee3591afdc2d1c900
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=bfda6bf6febb298d6f4bf5eee3591afdc2d1c900

Author: Dmitriy Cherkasov 
Date:   Fri Sep 11 17:58:54 2015 -0700

cobalt/arm64: add basic FPU support

---

 kernel/cobalt/arch/arm64/Kconfig   |2 +-
 .../cobalt/arch/arm64/include/asm/xenomai/fptest.h |   11 +-
 .../cobalt/arch/arm64/include/asm/xenomai/thread.h |   17 +-
 .../arch/arm64/include/asm/xenomai/uapi/fptest.h   |   83 +++--
 kernel/cobalt/arch/arm64/thread.c  |  329 +---
 lib/cobalt/arch/arm64/features.c   |4 +-
 6 files changed, 153 insertions(+), 293 deletions(-)

diff --git a/kernel/cobalt/arch/arm64/Kconfig b/kernel/cobalt/arch/arm64/Kconfig
index dd5a8c6..27b5026 100644
--- a/kernel/cobalt/arch/arm64/Kconfig
+++ b/kernel/cobalt/arch/arm64/Kconfig
@@ -8,7 +8,7 @@ config XENO_ARCH_WANT_TIP
def_bool y
 
 config XENO_ARCH_FPU
-   def_bool VFP
+   def_bool y
 
 config XENO_ARCH_SYS3264
 def_bool n
diff --git a/kernel/cobalt/arch/arm64/include/asm/xenomai/fptest.h 
b/kernel/cobalt/arch/arm64/include/asm/xenomai/fptest.h
index a76f1e6..743d758 100644
--- a/kernel/cobalt/arch/arm64/include/asm/xenomai/fptest.h
+++ b/kernel/cobalt/arch/arm64/include/asm/xenomai/fptest.h
@@ -20,15 +20,10 @@
 #define _COBALT_ARM_ASM_FPTEST_H
 
 #include 
+#include 
 #include 
 
-#ifdef CONFIG_VFP
-#define have_vfp (elf_hwcap & HWCAP_VFP)
-#else /* !CONFIG_VFP */
-#define have_vfp 0
-#endif /* !CONFIG_VFP */
-
-#include 
+#define have_fp (elf_hwcap & HWCAP_FP)
 
 static inline int fp_kernel_supported(void)
 {
@@ -46,7 +41,7 @@ static inline void fp_linux_end(void)
 
 static inline int fp_detect(void)
 {
-   return have_vfp ? __COBALT_HAVE_VFP : 0;
+   return have_fp ? __COBALT_HAVE_FPU : 0;
 }
 
 #endif /* _COBALT_ARM_ASM_FPTEST_H */
diff --git a/kernel/cobalt/arch/arm64/include/asm/xenomai/thread.h 
b/kernel/cobalt/arch/arm64/include/asm/xenomai/thread.h
index a8d7ed4..bfcceb4 100644
--- a/kernel/cobalt/arch/arm64/include/asm/xenomai/thread.h
+++ b/kernel/cobalt/arch/arm64/include/asm/xenomai/thread.h
@@ -21,21 +21,12 @@
 
 #include 
 
-#ifdef CONFIG_XENO_ARCH_FPU
-#ifdef CONFIG_VFP
-#include 
-#endif /* CONFIG_VFP */
-#endif /* !CONFIG_XENO_ARCH_FPU */
 
 struct xnarchtcb {
struct xntcb core;
 #ifdef CONFIG_XENO_ARCH_FPU
-#ifdef CONFIG_VFP
-   union vfp_state *fpup;
+   struct fpsimd_state *fpup;
 #define xnarch_fpu_ptr(tcb) ((tcb)->fpup)
-#else
-#define xnarch_fpu_ptr(tcb) NULL
-#endif
 #endif
struct {
unsigned long pc;
@@ -67,7 +58,7 @@ static inline void xnarch_enter_root(struct xnthread *root) { 
}
 
 int xnarch_escalate(void);
 
-#if defined(CONFIG_XENO_ARCH_FPU) && defined(CONFIG_VFP)
+#if defined(CONFIG_XENO_ARCH_FPU)
 
 static inline void xnarch_init_root_tcb(struct xnthread *thread)
 {
@@ -88,7 +79,7 @@ void xnarch_switch_fpu(struct xnthread *from, struct xnthread 
*thread);
 int xnarch_handle_fpu_fault(struct xnthread *from, 
struct xnthread *to, struct ipipe_trap_data *d);
 
-#else /* !CONFIG_XENO_ARCH_FPU || !CONFIG_VFP */
+#else /* !CONFIG_XENO_ARCH_FPU */
 
 static inline void xnarch_init_root_tcb(struct xnthread *thread) { }
 static inline void xnarch_init_shadow_tcb(struct xnthread *thread) { }
@@ -114,7 +105,7 @@ static inline int xnarch_handle_fpu_fault(struct xnthread 
*from,
 {
return 0;
 }
-#endif /*  !CONFIG_XENO_ARCH_FPU || !CONFIG_VFP */
+#endif /*  !CONFIG_XENO_ARCH_FPU */
 
 static inline void xnarch_enable_kfpu(void) { }
 
diff --git a/kernel/cobalt/arch/arm64/include/asm/xenomai/uapi/fptest.h 
b/kernel/cobalt/arch/arm64/include/asm/xenomai/uapi/fptest.h
index 65a3e31..25bc976 100644
--- a/kernel/cobalt/arch/arm64/include/asm/xenomai/uapi/fptest.h
+++ b/kernel/cobalt/arch/arm64/include/asm/xenomai/uapi/fptest.h
@@ -18,53 +18,86 @@
 #ifndef _COBALT_ARM_ASM_UAPI_FPTEST_H
 #define _COBALT_ARM_ASM_UAPI_FPTEST_H
 
-#ifdef __aarch64__
-/* CP10 and CP11, used for the FP/NEON operations, are already excluded from
-the list of valid operands for the generic coprocessor instructions */
-#define __COBALT_HAVE_VFP  0
-#else
-#define __COBALT_HAVE_VFP  0x1
-#endif
+#define __COBALT_HAVE_FPU  0x1
 
 static inline void fp_regs_set(int features, unsigned int val)
 {
-#if __COBALT_HAVE_VFP != 0
-   unsigned long long e[16];
+
+   unsigned long long e[32];
unsigned int i;
 
-   if (features & __COBALT_HAVE_VFP) {
-   for (i = 0; i < 16; i++)
+   if (features & __COBALT_HAVE_FPU) {
+
+   for (i = 0; i < 32; i++)
e[i] = val;
 
-   /* vldm %0!, {d0-d15},
-  AKA fldmiax %0!, {d0-d15} */
-   __asm__ __volatile__("ldc p11, cr0, [%0],#32*4":
-"=r"(i): "0"([0]): "memory");
+

[Xenomai-git] Philippe Gerum : cobalt/arm64: use regular context switching code

2017-05-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 858c70b2b6ee9c8f09068007c4cba30b418a127c
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=858c70b2b6ee9c8f09068007c4cba30b418a127c

Author: Philippe Gerum 
Date:   Sat Oct 17 18:07:59 2015 +0200

cobalt/arm64: use regular context switching code

Instead of open coding a copy of the regular context switching code,
use __switch_to() directly, assuming the pipeline properly serializes
switches from all domains.

---

 kernel/cobalt/arch/arm64/thread.c |   66 +++--
 1 file changed, 5 insertions(+), 61 deletions(-)

diff --git a/kernel/cobalt/arch/arm64/thread.c 
b/kernel/cobalt/arch/arm64/thread.c
index 35dbd72..5282b0c 100644
--- a/kernel/cobalt/arch/arm64/thread.c
+++ b/kernel/cobalt/arch/arm64/thread.c
@@ -34,7 +34,7 @@
 #include 
 #include 
 
-#if defined(CONFIG_XENO_ARCH_FPU)
+#ifdef CONFIG_XENO_ARCH_FPU
 
 #define FPSIMD_EN (0x3 << 20)
 
@@ -60,13 +60,6 @@ static void enable_fpsimd(void)
set_cpacr(cpacr);
 }
 
-static void disable_fpsimd(void)
-{
-   unsigned long cpacr = get_cpacr();
-   cpacr &= ~FPSIMD_EN;
-   set_cpacr(cpacr);
-}
-
 int xnarch_fault_fpu_p(struct ipipe_trap_data *d)
 {
return (d->exception == IPIPE_TRAP_FPU_ACC);
@@ -130,55 +123,17 @@ void xnarch_init_shadow_tcb(struct xnthread *thread)
tcb->fpup = &(tcb->core.host_task->thread.fpsimd_state);
xnthread_clear_state(thread, XNFPU);
 }
-#endif /* CONFIG_XENO_ARCH_FPU */
 
-/* Switch support functions */
-static void xnarch_tls_thread_switch(struct task_struct *next)
-{
-   unsigned long tpidr, tpidrro;
-
-   if (!is_compat_task()) {
-   asm("mrs %0, tpidr_el0" : "=r" (tpidr));
-   current->thread.tp_value = tpidr;
-   }
-
-   if (is_compat_thread(task_thread_info(next))) {
-   tpidr = 0;
-   tpidrro = next->thread.tp_value;
-   } else {
-   tpidr = next->thread.tp_value;
-   tpidrro = 0;
-   }
-
-   asm(
-   "   msr tpidr_el0, %0\n"
-   "   msr tpidrro_el0, %1"
-   : : "r" (tpidr), "r" (tpidrro));
-}
-
-#ifdef CONFIG_PID_IN_CONTEXTIDR
-static inline void xnarch_contextidr_thread_switch(struct task_struct *next)
-{
-   asm(
-   "   msr contextidr_el1, %0\n"
-   "   isb"
-   :
-   : "r" (task_pid_nr(next)));
-}
-#else
-static inline void xnarch_contextidr_thread_switch(struct task_struct *next)
-{
-}
-#endif
-/* End switch support functions */
+#endif /* CONFIG_XENO_ARCH_FPU */
 
 void xnarch_switch_to(struct xnthread *out, struct xnthread *in)
 {
struct xnarchtcb *out_tcb = >tcb, *in_tcb = >tcb;
struct mm_struct *prev_mm, *next_mm;
-   struct task_struct *next;
+   struct task_struct *prev, *next;
 
next = in_tcb->core.host_task;
+   prev = out_tcb->core.host_task;
prev_mm = out_tcb->core.active_mm;
 
next_mm = in_tcb->core.mm;
@@ -198,18 +153,7 @@ void xnarch_switch_to(struct xnthread *out, struct 
xnthread *in)
enter_lazy_tlb(prev_mm, next);
}
 
-   xnarch_tls_thread_switch(in_tcb->core.tip->task);
-   xnarch_contextidr_thread_switch(in_tcb->core.tip->task);
-
-   /*
-* Complete any pending TLB or cache maintenance on this CPU in case
-* the thread migrates to a different CPU.
-*/
-   dsb(ish);
-
-   disable_fpsimd();
-
-   cpu_switch_to(out_tcb->core.tip->task, in_tcb->core.tip->task);
+   __switch_to(prev, next);
 }
 
 int xnarch_escalate(void)


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Dmitriy Cherkasov : cobalt/arm64: set cache aliasing and disable floating point coprocessor instructions form aarch64 /arm64

2017-05-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 7ca3da7e91c8d6df4f5bd9313fc41e25071665ce
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=7ca3da7e91c8d6df4f5bd9313fc41e25071665ce

Author: Dmitriy Cherkasov 
Date:   Thu May  7 16:41:45 2015 -0700

cobalt/arm64: set cache aliasing and disable floating point coprocessor 
instructions form aarch64/arm64

---

 kernel/cobalt/arch/arm64/include/asm/xenomai/machine.h|3 ++-
 .../cobalt/arch/arm64/include/asm/xenomai/uapi/fptest.h   |   13 -
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/kernel/cobalt/arch/arm64/include/asm/xenomai/machine.h 
b/kernel/cobalt/arch/arm64/include/asm/xenomai/machine.h
index cf07a3f..e078564 100644
--- a/kernel/cobalt/arch/arm64/include/asm/xenomai/machine.h
+++ b/kernel/cobalt/arch/arm64/include/asm/xenomai/machine.h
@@ -38,7 +38,8 @@
 #include 
 #include 
 
-#define xnarch_cache_aliasing() cache_is_vivt()
+/* D-side always behaves as PIPT on AArch64 (see 
arch/arm64/include/asm/cachetype.h) */
+#define xnarch_cache_aliasing() 0
 
 static inline __attribute_const__ unsigned long ffnz(unsigned long ul)
 {
diff --git a/kernel/cobalt/arch/arm64/include/asm/xenomai/uapi/fptest.h 
b/kernel/cobalt/arch/arm64/include/asm/xenomai/uapi/fptest.h
index b81d109..65a3e31 100644
--- a/kernel/cobalt/arch/arm64/include/asm/xenomai/uapi/fptest.h
+++ b/kernel/cobalt/arch/arm64/include/asm/xenomai/uapi/fptest.h
@@ -18,10 +18,17 @@
 #ifndef _COBALT_ARM_ASM_UAPI_FPTEST_H
 #define _COBALT_ARM_ASM_UAPI_FPTEST_H
 
+#ifdef __aarch64__
+/* CP10 and CP11, used for the FP/NEON operations, are already excluded from
+the list of valid operands for the generic coprocessor instructions */
+#define __COBALT_HAVE_VFP  0
+#else
 #define __COBALT_HAVE_VFP  0x1
+#endif
 
 static inline void fp_regs_set(int features, unsigned int val)
 {
+#if __COBALT_HAVE_VFP != 0
unsigned long long e[16];
unsigned int i;
 
@@ -34,12 +41,15 @@ static inline void fp_regs_set(int features, unsigned int 
val)
__asm__ __volatile__("ldc p11, cr0, [%0],#32*4":
 "=r"(i): "0"([0]): "memory");
}
+#endif
 }
 
 static inline unsigned int fp_regs_check(int features, unsigned int val,
 int (*report)(const char *fmt, ...))
 {
-   unsigned int result = val, i;
+   unsigned int result = val;
+#if __COBALT_HAVE_VFP != 0
+   unsigned int i;
unsigned long long e[16];
 
if (features & __COBALT_HAVE_VFP) {
@@ -54,6 +64,7 @@ static inline unsigned int fp_regs_check(int features, 
unsigned int val,
result = e[i];
}
}
+#endif
 
return result;
 }


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Dmitriy Cherkasov : cobalt/arm64: machine.h: Add 64-bit ffnz implementation. This fixes crash when running xddp-echo.

2017-05-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 1c7ade3a20c13b666fefa129b3e607c58e8cac37
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=1c7ade3a20c13b666fefa129b3e607c58e8cac37

Author: Dmitriy Cherkasov 
Date:   Mon Jun 15 17:10:37 2015 -0700

cobalt/arm64: machine.h: Add 64-bit ffnz implementation. This fixes crash when 
running xddp-echo.

---

 kernel/cobalt/arch/arm64/include/asm/xenomai/machine.h |4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/kernel/cobalt/arch/arm64/include/asm/xenomai/machine.h 
b/kernel/cobalt/arch/arm64/include/asm/xenomai/machine.h
index e078564..417a7b0 100644
--- a/kernel/cobalt/arch/arm64/include/asm/xenomai/machine.h
+++ b/kernel/cobalt/arch/arm64/include/asm/xenomai/machine.h
@@ -43,9 +43,7 @@
 
 static inline __attribute_const__ unsigned long ffnz(unsigned long ul)
 {
-   int __r;
-   __asm__("clz\t%0, %1" : "=r" (__r) : "r"(ul & (-ul)) : "cc");
-   return 31 - __r;
+   return __builtin_ffsl(ul) - 1;
 }
 
 #include 


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : cobalt/arm64: drop aarch32 bits from feature set

2017-05-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 442de6f5a826cf5bf133a110d3af0048de37a73e
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=442de6f5a826cf5bf133a110d3af0048de37a73e

Author: Philippe Gerum 
Date:   Thu Sep 17 02:16:10 2015 +0200

cobalt/arm64: drop aarch32 bits from feature set

---

 .../arch/arm64/include/asm/xenomai/features.h  |   44 ++--
 1 file changed, 4 insertions(+), 40 deletions(-)

diff --git a/lib/cobalt/arch/arm64/include/asm/xenomai/features.h 
b/lib/cobalt/arch/arm64/include/asm/xenomai/features.h
index 0d6702b..6dfe64c 100644
--- a/lib/cobalt/arch/arm64/include/asm/xenomai/features.h
+++ b/lib/cobalt/arch/arm64/include/asm/xenomai/features.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005 Philippe Gerum .
+ * Copyright (C) 2015 Philippe Gerum .
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -15,52 +15,16 @@
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.
  */
-#ifndef _LIB_COBALT_ARM_FEATURES_H
-#define _LIB_COBALT_ARM_FEATURES_H
+#ifndef _LIB_COBALT_ARM64_FEATURES_H
+#define _LIB_COBALT_ARM64_FEATURES_H
 
 #include_next 
 #include 
 
-#if defined(__ARM_ARCH_2__)
-#define __LINUX_ARM_ARCH__ 2
-#endif /* armv2 */
-
-#if defined(__ARM_ARCH_3__)
-#define __LINUX_ARM_ARCH__ 3
-#endif /* armv3 */
-
-#if defined(__ARM_ARCH_4__) || defined(__ARM_ARCH_4T__)
-#define __LINUX_ARM_ARCH__ 4
-#endif /* armv4 */
-
-#if defined(__ARM_ARCH_5__) || defined(__ARM_ARCH_5T__) \
-   || defined(__ARM_ARCH_5E__) || defined(__ARM_ARCH_5TE__)
-#define __LINUX_ARM_ARCH__ 5
-#endif /* armv5 */
-
-#if defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6K__) \
-   || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__)
-#define __LINUX_ARM_ARCH__ 6
-#endif /* armv6 */
-
-#if defined(__ARM_ARCH_7A__)
-#define __LINUX_ARM_ARCH__ 7
-#endif /* armv7 */
-
-#if defined(__aarch64__)
 #define __LINUX_ARM_ARCH__ 8
-#endif /* armv8 */
-
-#ifndef __LINUX_ARM_ARCH__
-#error "Could not find current ARM architecture"
-#endif
-
-#if __LINUX_ARM_ARCH__ < 6 && defined(CONFIG_SMP)
-#error "SMP not supported below armv6, compile with -march=armv6 or above"
-#endif
 
 #include 
 
 int cobalt_fp_detect(void);
 
-#endif /* !_LIB_COBALT_ARM_FEATURES_H */
+#endif /* !_LIB_COBALT_ARM64_FEATURES_H */


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Jan Kiszka : cobalt/kernel: Trigger missing reschedule after PP deboost

2017-05-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 57b9e783df68bd6c9146df99969fa7d59230af10
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=57b9e783df68bd6c9146df99969fa7d59230af10

Author: Jan Kiszka 
Date:   Mon May  9 21:22:23 2016 +0200

cobalt/kernel: Trigger missing reschedule after PP deboost

xnsynch_release also needs to tell the caller about the potential need
for a reschedule after deboosting for prio-protection.

Signed-off-by: Jan Kiszka 

---

 kernel/cobalt/synch.c |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/kernel/cobalt/synch.c b/kernel/cobalt/synch.c
index d8b83d9..f3b70a2 100644
--- a/kernel/cobalt/synch.c
+++ b/kernel/cobalt/synch.c
@@ -949,8 +949,10 @@ bool xnsynch_release(struct xnsynch *synch, struct 
xnthread *curr)
else if (h != currh)/* FLCEIL set, FLCLAIM clear. */
atomic_set(lockp, XN_NO_HANDLE);
 
-   if (synch->status & XNSYNCH_PP)
+   if (synch->status & XNSYNCH_PP) {
clear_pp_boost(synch, curr);
+   need_resched = true;
+   }
 
xnlock_put_irqrestore(, s);
 


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : lib/cobalt: add config switch to enable lazy setsched update mode

2017-05-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 1b2ba3e415e365d1b1d7982638a437e99bd1e3ef
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=1b2ba3e415e365d1b1d7982638a437e99bd1e3ef

Author: Philippe Gerum 
Date:   Sun Mar 20 17:58:33 2016 +0100

lib/cobalt: add config switch to enable lazy setsched update mode

--enable-lazy-setsched should be given for enabling lazy propagation
of scheduling parameters upon calls to pthread_setschedparam*(),
sched_setscheduler(). Defaults to off.

---

 configure.ac  |   19 +++
 lib/cobalt/internal.h |   12 
 lib/cobalt/sched.c|2 +-
 lib/cobalt/thread.c   |3 ++-
 4 files changed, 34 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index dd3a1ec..b90fa70 100644
--- a/configure.ac
+++ b/configure.ac
@@ -291,6 +291,25 @@ if test x$workaround_condvar_pi = xy; then
fi
 fi
 
+dnl Lazy schedparam propagation for Cobalt (default: off)
+
+unset lazy_setsched_update
+AC_MSG_CHECKING(whether to enable lazy scheduling parameter update)
+AC_ARG_ENABLE(lazy-setsched,
+   AS_HELP_STRING([--enable-lazy-setsched], [Enable lazy scheduling 
parameter update]),
+   [case "$enableval" in
+   y | yes) lazy_setsched_update=y ;;
+   *) unset lazy_setsched_update ;;
+   esac])
+AC_MSG_RESULT(${lazy_setsched_update:-no})
+if test x$lazy_setsched_update = xy; then
+   if test x$rtcore_type = xcobalt; then
+   AC_DEFINE(CONFIG_XENO_LAZY_SETSCHED,1,[config])
+   else
+AC_MSG_WARN([No lazy scheduling parameter updates over Mercury - 
ignoring])
+   fi
+fi
+
 dnl Enable shared multi-processing (default: off)
 
 use_pshared=
diff --git a/lib/cobalt/internal.h b/lib/cobalt/internal.h
index 3241e9b..cccbbf1 100644
--- a/lib/cobalt/internal.h
+++ b/lib/cobalt/internal.h
@@ -37,6 +37,18 @@ static inline int cobalt_should_warn(void)
return (cobalt_get_current_mode() & (XNRELAX|XNWARN)) == XNWARN;
 }
 
+#ifdef CONFIG_XENO_LAZY_SETSCHED
+static inline int cobalt_eager_setsched(void)
+{
+   return cobalt_is_relaxed();
+}
+#else
+static inline int cobalt_eager_setsched(void)
+{
+   return 1;
+}
+#endif
+
 static inline
 struct cobalt_mutex_state *mutex_get_state(struct cobalt_mutex_shadow *shadow)
 {
diff --git a/lib/cobalt/sched.c b/lib/cobalt/sched.c
index 87b9235..94f3323 100644
--- a/lib/cobalt/sched.c
+++ b/lib/cobalt/sched.c
@@ -297,7 +297,7 @@ int sched_setscheduler_ex(pid_t pid,
 
/* See pthread_setschedparam_ex(). */
 
-   if (cobalt_is_relaxed()) {
+   if (cobalt_eager_setsched()) {
std_policy = cobalt_xlate_schedparam(policy, param_ex, 
_param);
ret = __STD(sched_setscheduler(pid, std_policy, _param));
if (ret)
diff --git a/lib/cobalt/thread.c b/lib/cobalt/thread.c
index 8b4568d..908516f 100644
--- a/lib/cobalt/thread.c
+++ b/lib/cobalt/thread.c
@@ -629,7 +629,8 @@ int pthread_setschedparam_ex(pthread_t thread,
 * threads should refrain from mixing APIs for managing
 * scheduling parameters, and only rely on libcobalt for this.
 */
-   if (cobalt_is_relaxed()) { /* True if shadow not mapped yet. */
+   if (cobalt_eager_setsched()) {
+   /* True if disabled or shadow not mapped yet. */
std_policy = cobalt_xlate_schedparam(policy, param_ex, 
_param);
ret = __STD(pthread_setschedparam(thread, std_policy, 
_param));
if (ret)


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Jan Kiszka : cobalt/kernel: Introduce __SCHED_CURRENT policy to setschedparam_ex

2017-05-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 575f1da2f77606db441dcb1cb5b5fdbde968dfcc
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=575f1da2f77606db441dcb1cb5b5fdbde968dfcc

Author: Jan Kiszka 
Date:   Tue Mar  8 14:41:28 2016 +0100

cobalt/kernel: Introduce __SCHED_CURRENT policy to setschedparam_ex

Define the internal scheduling policy "current": it shall refer to the
target thread's current scheduling policy. This will allow to model
pthread_setschedprio on top of pthread_setschedparam_ex with only a
single syscall.

Signed-off-by: Jan Kiszka 

---

 include/cobalt/uapi/sched.h|3 +++
 kernel/cobalt/posix/thread.c   |   10 ++
 kernel/cobalt/trace/cobalt-posix.h |3 ++-
 3 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/include/cobalt/uapi/sched.h b/include/cobalt/uapi/sched.h
index b672095..2a1df44 100644
--- a/include/cobalt/uapi/sched.h
+++ b/include/cobalt/uapi/sched.h
@@ -21,6 +21,9 @@
 #define SCHED_COBALT   42
 #define SCHED_WEAK 43
 
+/* for internal use */
+#define __SCHED_CURRENT44
+
 #ifndef SCHED_SPORADIC
 #define SCHED_SPORADIC 10
 #define sched_ss_low_priority  sched_u.ss.__sched_low_priority
diff --git a/kernel/cobalt/posix/thread.c b/kernel/cobalt/posix/thread.c
index d87edb1..217b81b 100644
--- a/kernel/cobalt/posix/thread.c
+++ b/kernel/cobalt/posix/thread.c
@@ -242,6 +242,7 @@ struct xnthread_personality *cobalt_thread_finalize(struct 
xnthread *zombie)
 int __cobalt_thread_setschedparam_ex(struct cobalt_thread *thread, int policy,
 const struct sched_param_ex *param_ex)
 {
+   struct xnthread *base_thread = >threadbase;
struct xnsched_class *sched_class;
union xnsched_policy_param param;
xnticks_t tslice;
@@ -256,6 +257,15 @@ int __cobalt_thread_setschedparam_ex(struct cobalt_thread 
*thread, int policy,
goto out;
}
 
+   if (policy == __SCHED_CURRENT) {
+   policy = base_thread->base_class->policy;
+   if (xnthread_base_priority(base_thread) == 0)
+   policy = SCHED_NORMAL;
+   else if (base_thread->base_class == _class_rt &&
+xnthread_test_state(base_thread, XNRRB))
+   policy = SCHED_RR;
+   }
+
tslice = thread->threadbase.rrperiod;
sched_class = cobalt_sched_policy_param(, policy,
param_ex, );
diff --git a/kernel/cobalt/trace/cobalt-posix.h 
b/kernel/cobalt/trace/cobalt-posix.h
index eaac70d..45f920f 100644
--- a/kernel/cobalt/trace/cobalt-posix.h
+++ b/kernel/cobalt/trace/cobalt-posix.h
@@ -88,7 +88,8 @@ DECLARE_EVENT_CLASS(syscall_exit,
 {SCHED_QUOTA, "quota"},\
 {SCHED_SPORADIC, "sporadic"},  \
 {SCHED_COBALT, "cobalt"},  \
-{SCHED_WEAK, "weak"})
+{SCHED_WEAK, "weak"},  \
+{__SCHED_CURRENT, ""})
 
 #define cobalt_print_sched_params(__policy, __p_ex)\
 ({ \


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Gilles Chanteperdrix : testsuite/smokey: add RTnet raw packets test

2017-05-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: be6a26fb0c6849043f7081c0f9c98ae9aa40de79
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=be6a26fb0c6849043f7081c0f9c98ae9aa40de79

Author: Gilles Chanteperdrix 
Date:   Sun Nov  1 19:14:40 2015 +0100

testsuite/smokey: add RTnet raw packets test

---

 configure.ac |1 +
 1 file changed, 1 insertion(+)

diff --git a/configure.ac b/configure.ac
index 7f258ed..457d026 100644
--- a/configure.ac
+++ b/configure.ac
@@ -924,6 +924,7 @@ AC_CONFIG_FILES([ \
testsuite/smokey/fpu-stress/Makefile \
testsuite/smokey/net_udp/Makefile \
testsuite/smokey/net_packet_dgram/Makefile \
+   testsuite/smokey/net_packet_raw/Makefile \
testsuite/smokey/net_common/Makefile \
testsuite/clocktest/Makefile \
testsuite/xeno-test/Makefile \


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Gilles Chanteperdrix : cobalt/arm64: attempt at fixing fpu switch

2017-05-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 210dd59c9160a91d3452a69db5ebb9c4e051b926
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=210dd59c9160a91d3452a69db5ebb9c4e051b926

Author: Gilles Chanteperdrix 
Date:   Fri Oct 30 17:14:00 2015 +0100

cobalt/arm64: attempt at fixing fpu switch

Return to eager switching, since user-space applications use FPU
registers even when not using the FPU, but use an auxiliary backup area
when the "TIF_FOREIGN_FPSTATE" bit is set, in order to avoid clobbering
the saved FPU state.

---

 .../cobalt/arch/arm64/include/asm/xenomai/thread.h |   14 +++--
 kernel/cobalt/arch/arm64/thread.c  |   54 +---
 2 files changed, 25 insertions(+), 43 deletions(-)

diff --git a/kernel/cobalt/arch/arm64/include/asm/xenomai/thread.h 
b/kernel/cobalt/arch/arm64/include/asm/xenomai/thread.h
index 9055e58..4b247ac 100644
--- a/kernel/cobalt/arch/arm64/include/asm/xenomai/thread.h
+++ b/kernel/cobalt/arch/arm64/include/asm/xenomai/thread.h
@@ -24,6 +24,7 @@
 struct xnarchtcb {
struct xntcb core;
 #ifdef CONFIG_XENO_ARCH_FPU
+   struct fpsimd_state xnfpsimd_state;
struct fpsimd_state *fpup;
 #define xnarch_fpu_ptr(tcb) ((tcb)->fpup)
 #endif
@@ -67,7 +68,10 @@ static inline void xnarch_init_root_tcb(struct xnthread 
*thread)
 
 void xnarch_init_shadow_tcb(struct xnthread *thread);
 
-int xnarch_fault_fpu_p(struct ipipe_trap_data *d);
+static inline int xnarch_fault_fpu_p(struct ipipe_trap_data *d)
+{
+   return xnarch_fault_trap(d) == IPIPE_TRAP_FPU_ACC;
+}
 
 void xnarch_leave_root(struct xnthread *root);
 
@@ -75,8 +79,12 @@ void xnarch_save_fpu(struct xnthread *thread);
 
 void xnarch_switch_fpu(struct xnthread *from, struct xnthread *thread);
 
-int xnarch_handle_fpu_fault(struct xnthread *from, 
-   struct xnthread *to, struct ipipe_trap_data *d);
+static inline int
+xnarch_handle_fpu_fault(struct xnthread *from,
+   struct xnthread *to, struct ipipe_trap_data *d)
+{
+   return 0;
+}
 
 #else /* !CONFIG_XENO_ARCH_FPU */
 
diff --git a/kernel/cobalt/arch/arm64/thread.c 
b/kernel/cobalt/arch/arm64/thread.c
index 2238751..b987e09 100644
--- a/kernel/cobalt/arch/arm64/thread.c
+++ b/kernel/cobalt/arch/arm64/thread.c
@@ -6,6 +6,7 @@
  * 
  * ARM64 port
  *   Copyright (C) 2015 Dmitriy Cherkasov 
+ *   Copyright (C) 2015 Gilles Chanteperdrix 
  *
  * Xenomai is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License as published by
@@ -41,7 +42,7 @@
 static inline unsigned long get_cpacr(void)
 {
unsigned long result;
-   __asm__ __volatile__("mrs %0, cpacr_el1": "=r"(result));
+   __asm__ ("mrs %0, cpacr_el1": "=r"(result));
return result;
 }
 
@@ -53,21 +54,20 @@ static inline void set_cpacr(long val)
: /* */ : "r"(val));
 }
 
-static void enable_fpsimd(void)
+static inline void enable_fpsimd(void)
 {
-   unsigned long cpacr = get_cpacr();
-   cpacr |= FPSIMD_EN;
-   set_cpacr(cpacr);
+   set_cpacr(get_cpacr() | FPSIMD_EN);
 }
 
-int xnarch_fault_fpu_p(struct ipipe_trap_data *d)
+static inline struct fpsimd_state *get_fpu_owner(struct xnarchtcb *rootcb)
 {
-   return (d->exception == IPIPE_TRAP_FPU_ACC);
-}
+   struct task_struct *curr = rootcb->core.host_task;
 
-static inline struct fpsimd_state *get_fpu_owner(struct xnarchtcb *tcb)
-{
-   return &(tcb->core.tsp->fpsimd_state);
+   if (test_ti_thread_flag(task_thread_info(curr), TIF_FOREIGN_FPSTATE))
+   /* Foreign fpu state, use auxiliary backup area */
+   return >xnfpsimd_state;
+
+   return >thread.fpsimd_state;
 }
 
 void xnarch_leave_root(struct xnthread *root)
@@ -76,13 +76,6 @@ void xnarch_leave_root(struct xnthread *root)
rootcb->fpup = get_fpu_owner(rootcb);
 }
 
-void xnarch_save_fpu(struct xnthread *thread)
-{
-   struct xnarchtcb *tcb = &(thread->tcb);
-   if (xnarch_fpu_ptr(tcb))
-   fpsimd_save_state(tcb->fpup);
-}
-
 void xnarch_switch_fpu(struct xnthread *from, struct xnthread *to)
 {
struct fpsimd_state *const from_fpup = from ? from->tcb.fpup : NULL;
@@ -93,35 +86,16 @@ void xnarch_switch_fpu(struct xnthread *from, struct 
xnthread *to)
if (from_fpup == to_fpup)
return;
 
-   if (from_fpup)
-   fpsimd_save_state(from_fpup);
+   fpsimd_save_state(from_fpup);
 
fpsimd_load_state(to_fpup);
-}
-
-int xnarch_handle_fpu_fault(struct xnthread *from, 
-   struct xnthread *to, struct ipipe_trap_data *d)
-{
-   spl_t s;
-
-   /* FPU should already be enabled for XNFPU tasks. */
-   if (xnthread_test_state(to, XNFPU))
-   BUG();
-
-   xnlock_get_irqsave(, s);
-   xnthread_set_state(to, XNFPU);
-   xnlock_put_irqrestore(, s);
-
-   xnarch_switch_fpu(from, 

[Xenomai-git] Philippe Gerum : cobalt/arm64: drop useless test on target architecture

2017-05-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 4ba66deff2b4720c73f5be3d63ac79edf1b575f9
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=4ba66deff2b4720c73f5be3d63ac79edf1b575f9

Author: Philippe Gerum 
Date:   Sat Oct 17 14:43:25 2015 +0200

cobalt/arm64: drop useless test on target architecture

---

 kernel/cobalt/arch/arm64/include/asm/xenomai/uapi/features.h |7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/kernel/cobalt/arch/arm64/include/asm/xenomai/uapi/features.h 
b/kernel/cobalt/arch/arm64/include/asm/xenomai/uapi/features.h
index ea1b06e..74423f6 100644
--- a/kernel/cobalt/arch/arm64/include/asm/xenomai/uapi/features.h
+++ b/kernel/cobalt/arch/arm64/include/asm/xenomai/uapi/features.h
@@ -28,10 +28,9 @@
 
 #define XENOMAI_FEAT_MAN (__xn_feat_generic_man_mask)
 
-#ifndef __aarch64__
-#define XNARCH_HAVE_LLMULSHFT1
-#define XNARCH_HAVE_NODIV_LLIMD  1
-#endif
+#undef XNARCH_HAVE_LLMULSHFT
+
+#undef XNARCH_HAVE_NODIV_LLIMD
 
 struct cobalt_featinfo_archdep { /* no arch-specific feature */ };
 


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Don Mahurin : lib/cobalt/arm64: implement syscall for armv8/aarch64

2017-05-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: ac8d3e24b109f50f208744153870cab2755806e4
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=ac8d3e24b109f50f208744153870cab2755806e4

Author: Don Mahurin 
Date:   Fri May  8 10:39:32 2015 -0700

lib/cobalt/arm64: implement syscall for armv8/aarch64

---

 lib/cobalt/arch/arm64/include/asm/xenomai/syscall.h |8 
 1 file changed, 8 insertions(+)

diff --git a/lib/cobalt/arch/arm64/include/asm/xenomai/syscall.h 
b/lib/cobalt/arch/arm64/include/asm/xenomai/syscall.h
index 8f48eb1..1d5806c 100644
--- a/lib/cobalt/arch/arm64/include/asm/xenomai/syscall.h
+++ b/lib/cobalt/arch/arm64/include/asm/xenomai/syscall.h
@@ -88,6 +88,7 @@
 #define __sys2(x)  #x
 #define __sys1(x)  __sys2(x)
 
+#ifndef __aarch64__
 #ifdef __ARM_EABI__
 #define __SYS_REG , "r7"
 #define __SYS_REG_DECL register unsigned long __r7 __asm__ ("r7")
@@ -102,6 +103,13 @@
 #define __NR_OABI_SYSCALL_BASE 0x90
 #define __SYS_CALLOP "swi\t" __sys1(__NR_OABI_SYSCALL_BASE + XENO_ARM_SYSCALL) 
""
 #endif
+#else
+#define __SYS_REG , "r8"
+#define __SYS_REG_DECL register unsigned long __r8 __asm__ ("r8")
+#define __SYS_REG_SET __r8 = XENO_ARM_SYSCALL
+#define __SYS_REG_INPUT ,"r" (__r8)
+#define __SYS_CALLOP "svc\t0"
+#endif
 
 #define XENOMAI_DO_SYSCALL(nr, op, args...)\
({  \


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : cobalt/x86: silence warning about unused variable

2017-05-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: e94cd3482b96e5688d1ef4686a5ae18336695771
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=e94cd3482b96e5688d1ef4686a5ae18336695771

Author: Philippe Gerum 
Date:   Thu May 18 17:32:36 2017 +0200

cobalt/x86: silence warning about unused variable

---

 kernel/cobalt/arch/x86/thread.c |1 +
 1 file changed, 1 insertion(+)

diff --git a/kernel/cobalt/arch/x86/thread.c b/kernel/cobalt/arch/x86/thread.c
index e40dd6f..7fb1363 100644
--- a/kernel/cobalt/arch/x86/thread.c
+++ b/kernel/cobalt/arch/x86/thread.c
@@ -240,6 +240,7 @@ void xnarch_switch_to(struct xnthread *out, struct xnthread 
*in)
  out_tcb->spp, in_tcb->spp,
  out_tcb->ipp, in_tcb->ipp);
 #endif /* CONFIG_X86_64 */
+   (void)last;
 #else /* LINUX_VERSION_CODE >= 4.8 */
switch_to(prev, next, last);
 #endif /* LINUX_VERSION_CODE >= 4.8 */


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : lib/copperplate: prevent unwanted mode switch during thread prologue

2017-05-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: cc4ecb09efd530248d11910db1626d83bbb143b8
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=cc4ecb09efd530248d11910db1626d83bbb143b8

Author: Philippe Gerum 
Date:   Tue May 16 11:12:57 2017 +0200

lib/copperplate: prevent unwanted mode switch during thread prologue

copperplate_renice_local_thread() causes a switch to secondary mode
for an emerging thread context, we want it to happen before such
thread handshakes with its parent, so that the later is released only
after the child is waiting in primary mode on the start barrier.

e.g.

tA(prio=10) creates tB(prio=5), tC(prio=7), then starts them in that
order. The proper scheduling sequence must be: tA -> tC -> tB.

See http://xenomai.org/pipermail/xenomai/2017-May/037311.html for more
details.

---

 lib/copperplate/internal.c |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/copperplate/internal.c b/lib/copperplate/internal.c
index 2549ab0..1d96526 100644
--- a/lib/copperplate/internal.c
+++ b/lib/copperplate/internal.c
@@ -239,14 +239,14 @@ static void *thread_trampoline(void *arg)
 * with the cleanup code the client may run whenever
 * copperplate_create_thread() fails.
 */
-   prepare_wait_corespec();
-   __RT(sem_post(>__reserved.warm));
-   thread_spawn_wait();
-   __RT(sem_destroy());
ret = __bt(copperplate_renice_local_thread(pthread_self(),
   _cta.policy, &_cta.param_ex));
if (ret)
warning("cannot renice core thread, %s", symerror(ret));
+   prepare_wait_corespec();
+   __RT(sem_post(>__reserved.warm));
+   thread_spawn_wait();
+   __RT(sem_destroy());
 
return _cta.run(_cta.arg);
 fail:


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Dmitriy Cherkasov : cobalt/arm64: remove code for unrelated arm architecture

2017-05-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 8f37232e8261010cbe349d23f4b8f24ff711843b
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=8f37232e8261010cbe349d23f4b8f24ff711843b

Author: Dmitriy Cherkasov 
Date:   Thu May  7 13:56:22 2015 -0700

cobalt/arm64: remove code for unrelated arm architecture

---

 .../arch/arm64/include/asm/xenomai/machine.h   |   33 
 .../arch/arm64/include/asm/xenomai/uapi/arith.h|4 +--
 2 files changed, 2 insertions(+), 35 deletions(-)

diff --git a/kernel/cobalt/arch/arm64/include/asm/xenomai/machine.h 
b/kernel/cobalt/arch/arm64/include/asm/xenomai/machine.h
index d6e965f..cf07a3f 100644
--- a/kernel/cobalt/arch/arm64/include/asm/xenomai/machine.h
+++ b/kernel/cobalt/arch/arm64/include/asm/xenomai/machine.h
@@ -32,53 +32,20 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
 #include 
-#include 
 #include 
 
 #define xnarch_cache_aliasing() cache_is_vivt()
 
-#if __LINUX_ARM_ARCH__ < 5
-static inline __attribute_const__ unsigned long ffnz(unsigned long x)
-{
-   int r = 0;
-
-   if (!x)
-   return 0;
-   if (!(x & 0x)) {
-   x >>= 16;
-   r += 16;
-   }
-   if (!(x & 0xff)) {
-   x >>= 8;
-   r += 8;
-   }
-   if (!(x & 0xf)) {
-   x >>= 4;
-   r += 4;
-   }
-   if (!(x & 3)) {
-   x >>= 2;
-   r += 2;
-   }
-   if (!(x & 1)) {
-   x >>= 1;
-   r += 1;
-   }
-   return r;
-}
-#else
 static inline __attribute_const__ unsigned long ffnz(unsigned long ul)
 {
int __r;
__asm__("clz\t%0, %1" : "=r" (__r) : "r"(ul & (-ul)) : "cc");
return 31 - __r;
 }
-#endif
 
 #include 
 
diff --git a/kernel/cobalt/arch/arm64/include/asm/xenomai/uapi/arith.h 
b/kernel/cobalt/arch/arm64/include/asm/xenomai/uapi/arith.h
index cf897b4..165cd9d 100644
--- a/kernel/cobalt/arch/arm64/include/asm/xenomai/uapi/arith.h
+++ b/kernel/cobalt/arch/arm64/include/asm/xenomai/uapi/arith.h
@@ -20,7 +20,7 @@
 
 #include 
 
-#if __LINUX_ARM_ARCH__ >= 4 && (!defined(CONFIG_THUMB2_KERNEL) || 
!defined(CONFIG_FTRACE))
+#if !defined(CONFIG_FTRACE)
 static inline __attribute__((__const__)) unsigned long long
 mach_arm_nodiv_ullimd(const unsigned long long op,
   const unsigned long long frac,
@@ -49,7 +49,7 @@ mach_arm_nodiv_llimd(const long long op,
 
 #include 
 
-#if __LINUX_ARM_ARCH__ >= 4 && (!defined(CONFIG_THUMB2_KERNEL) || 
!defined(CONFIG_FTRACE))
+#if !defined(CONFIG_FTRACE)
 #define mach_arm_nodiv_ullimd_str  \
"umull %[tl], %[rl], %[opl], %[fracl]\n\t"  \
"umull %[rm], %[rh], %[oph], %[frach]\n\t"  \


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : boilerplate/libc: provide placeholders for prioceiling ops

2017-05-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: b0b8403cd7358f2335b3b50751a81f92afaa59da
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=b0b8403cd7358f2335b3b50751a81f92afaa59da

Author: Philippe Gerum 
Date:   Sun Mar 20 17:20:58 2016 +0100

boilerplate/libc: provide placeholders for prioceiling ops

---

 configure.ac   |2 ++
 include/boilerplate/libc.h |   19 +++
 2 files changed, 21 insertions(+)

diff --git a/configure.ac b/configure.ac
index c9d0fcf..dd3a1ec 100644
--- a/configure.ac
+++ b/configure.ac
@@ -514,6 +514,8 @@ AC_CHECK_FUNCS([pthread_mutexattr_setprotocol   \
pthread_mutexattr_getprioceiling \
pthread_mutexattr_setprioceiling \
pthread_mutexattr_setrobust_np  \
+   pthread_mutex_getprioceiling\
+   pthread_mutex_setprioceiling\
pthread_condattr_getclock   \
pthread_condattr_setclock   \
pthread_spin_lock fork  \
diff --git a/include/boilerplate/libc.h b/include/boilerplate/libc.h
index 80ababf..1b26c84 100644
--- a/include/boilerplate/libc.h
+++ b/include/boilerplate/libc.h
@@ -127,6 +127,25 @@ int pthread_mutexattr_getprioceiling(const 
pthread_mutexattr_t *
 }
 #endif /* !HAVE_PTHREAD_MUTEXATTR_GETPRIOCEILING */
 
+#ifndef HAVE_PTHREAD_MUTEX_SETPRIOCEILING
+static inline
+int pthread_mutex_setprioceiling(pthread_mutex_t *__restrict attr,
+int prioceiling,
+int *__restrict old_ceiling)
+{
+   return ENOSYS;
+}
+#endif /* !HAVE_PTHREAD_MUTEXATTR_SETPRIOCEILING */
+
+#ifndef HAVE_PTHREAD_MUTEX_GETPRIOCEILING
+static inline
+int pthread_mutex_getprioceiling(pthread_mutex_t *__restrict attr,
+int *__restrict prioceiling)
+{
+   return ENOSYS;
+}
+#endif /* !HAVE_PTHREAD_MUTEXATTR_GETPRIOCEILING */
+
 #ifndef HAVE_PTHREAD_ATTR_SETAFFINITY_NP
 #include 
 static inline


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : doc: prebuild

2017-05-21 Thread git repository hosting
Module: xenomai-3
Branch: refs/tags/v3.0.5
Commit: ded4ede2d16dcac6975bedab5b9cda59b96739fa
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=ded4ede2d16dcac6975bedab5b9cda59b96739fa

Author: Philippe Gerum 
Date:   Sun May 21 18:03:47 2017 +0200

doc: prebuild

---

 doc/prebuilt/html/MIGRATION/index.html |6 ++--
 doc/prebuilt/html/README.APPLICATIONS/index.html   |2 +-
 doc/prebuilt/html/README.INSTALL/index.html|2 +-
 .../html/TROUBLESHOOTING.COBALT/index.html |2 +-
 .../html/TROUBLESHOOTING.MERCURY/index.html|2 +-
 doc/prebuilt/html/man1/xeno-config/index.html  |2 +-
 .../html/xeno3prm/16550A__io_8h_source.html|2 +-
 .../html/xeno3prm/16550A__pci_8h_source.html   |4 +--
 .../html/xeno3prm/16550A__pnp_8h_source.html   |2 +-
 doc/prebuilt/html/xeno3prm/8255_8h_source.html |2 +-
 doc/prebuilt/html/xeno3prm/af__inet_8h_source.html |2 +-
 .../html/xeno3prm/alchemy_2compat_8h_source.html   |2 +-
 doc/prebuilt/html/xeno3prm/analogy_2driver_8h.html |2 +-
 .../html/xeno3prm/analogy_2driver_8h_source.html   |2 +-
 doc/prebuilt/html/xeno3prm/analogy_8h.html |2 +-
 doc/prebuilt/html/xeno3prm/analogy_8h_source.html  |2 +-
 doc/prebuilt/html/xeno3prm/annotated.html  |2 +-
 doc/prebuilt/html/xeno3prm/apc_8h_source.html  |2 +-
 doc/prebuilt/html/xeno3prm/api-tags.html   |2 +-
 ..._2include_2asm_2xenomai_2machine_8h_source.html |2 +-
 ...include_2asm_2xenomai_2syscall32_8h_source.html |2 +-
 ..._2include_2asm_2xenomai_2machine_8h_source.html |2 +-
 ...include_2asm_2xenomai_2syscall32_8h_source.html |2 +-
 ..._2include_2asm_2xenomai_2machine_8h_source.html |2 +-
 ...include_2asm_2xenomai_2syscall32_8h_source.html |2 +-
 ..._2include_2asm_2xenomai_2machine_8h_source.html |2 +-
 ...include_2asm_2xenomai_2syscall32_8h_source.html |4 +--
 ...m_2include_2asm_2xenomai_2fptest_8h_source.html |2 +-
 ...lude_2asm_2xenomai_2uapi_2fptest_8h_source.html |2 +-
 doc/prebuilt/html/xeno3prm/arp_8h_source.html  |2 +-
 doc/prebuilt/html/xeno3prm/assert_8h_source.html   |2 +-
 doc/prebuilt/html/xeno3prm/async_8c.html   |2 +-
 doc/prebuilt/html/xeno3prm/atomic_8h_source.html   |2 +-
 ...n_2include_2asm_2xenomai_2fptest_8h_source.html |2 +-
 ...lude_2asm_2xenomai_2uapi_2fptest_8h_source.html |2 +-
 .../boilerplate_2ancillaries_8h_source.html|2 +-
 .../html/xeno3prm/boilerplate_2list_8h_source.html |2 +-
 .../html/xeno3prm/boilerplate_2lock_8h_source.html |2 +-
 .../html/xeno3prm/boilerplate_2time_8h_source.html |2 +-
 .../xeno3prm/boilerplate_2tunables_8h_source.html  |2 +-
 doc/prebuilt/html/xeno3prm/bufd_8h_source.html |2 +-
 .../html/xeno3prm/bufp-label_8c-example.html   |2 +-
 .../html/xeno3prm/bufp-readwrite_8c-example.html   |2 +-
 doc/prebuilt/html/xeno3prm/c1e_8h_source.html  |2 +-
 doc/prebuilt/html/xeno3prm/calibration_8c.html |2 +-
 doc/prebuilt/html/xeno3prm/can-rtt_8c-example.html |2 +-
 doc/prebuilt/html/xeno3prm/channel__range_8h.html  |2 +-
 .../html/xeno3prm/channel__range_8h_source.html|2 +-
 doc/prebuilt/html/xeno3prm/classes.html|2 +-
 doc/prebuilt/html/xeno3prm/clockobj_8h_source.html |2 +-
 doc/prebuilt/html/xeno3prm/cluster_8h_source.html  |2 +-
 .../html/xeno3prm/cobalt-core_8h_source.html   |4 +--
 .../html/xeno3prm/cobalt-posix_8h_source.html  |4 +--
 .../html/xeno3prm/cobalt-rtdm_8h_source.html   |4 +--
 .../cobalt_2boilerplate_2limits_8h_source.html |2 +-
 .../cobalt_2boilerplate_2trace_8h_source.html  |2 +-
 .../cobalt_2kernel_2ancillaries_8h_source.html |2 +-
 .../xeno3prm/cobalt_2kernel_2compat_8h_source.html |2 +-
 .../xeno3prm/cobalt_2kernel_2init_8h_source.html   |2 +-
 .../xeno3prm/cobalt_2kernel_2list_8h_source.html   |2 +-
 .../xeno3prm/cobalt_2kernel_2lock_8h_source.html   |2 +-
 .../cobalt_2kernel_2registry_8h_source.html|2 +-
 .../cobalt_2kernel_2rtdm_2autotune_8h_source.html  |2 +-
 .../cobalt_2kernel_2rtdm_2can_8h_source.html   |2 +-
 .../cobalt_2kernel_2rtdm_2compat_8h_source.html|2 +-
 .../cobalt_2kernel_2rtdm_2ipc_8h_source.html   |2 +-
 .../cobalt_2kernel_2rtdm_2rtdm_8h_source.html  |2 +-
 .../cobalt_2kernel_2rtdm_2serial_8h_source.html|2 +-
 .../cobalt_2kernel_2rtdm_2testing_8h_source.html   |2 +-
 .../xeno3prm/cobalt_2kernel_2rtdm_2udd_8h.html |2 +-
 .../cobalt_2kernel_2rtdm_2udd_8h_source.html   |2 +-
 .../xeno3prm/cobalt_2kernel_2trace_8h_source.html  |2 +-
 .../html/xeno3prm/cobalt_2pthread_8h_source.html   |   10 +++---
 .../html/xeno3prm/cobalt_2sys_2time_8h_source.html |2 +-
 .../html/xeno3prm/cobalt_2time_8h_source.html  |2 +-