103 lines
2.9 KiB
Diff
103 lines
2.9 KiB
Diff
|
Cc: alexey_ishchuk@ru.ibm.com
|
||
|
Subject: DAPL support for Linux on System z
|
||
|
|
||
|
s390: Add support for Linux on System z
|
||
|
|
||
|
This patch adds the required code to support Linux on System z.
|
||
|
|
||
|
|
||
|
---
|
||
|
dapl/udapl/linux/dapl_osd.h | 35 ++++++++++++++++++++++++++++++++++-
|
||
|
dat/common/dat_strerror.c | 4 ++++
|
||
|
2 files changed, 38 insertions(+), 1 deletion(-)
|
||
|
|
||
|
Index: dapl-2.0.39/dapl/udapl/linux/dapl_osd.h
|
||
|
===================================================================
|
||
|
--- dapl-2.0.39.orig/dapl/udapl/linux/dapl_osd.h 2013-10-02 00:42:16.000000000 +0200
|
||
|
+++ dapl-2.0.39/dapl/udapl/linux/dapl_osd.h 2014-01-21 18:07:26.226177293 +0100
|
||
|
@@ -49,7 +49,7 @@
|
||
|
#error UNDEFINED OS TYPE
|
||
|
#endif /* __linux__ */
|
||
|
|
||
|
-#if !defined (__i386__) && !defined (__ia64__) && !defined(__x86_64__) && !defined(__PPC__) && !defined(__PPC64__)
|
||
|
+#if !defined (__i386__) && !defined (__ia64__) && !defined(__x86_64__) && !defined(__PPC__) && !defined(__PPC64__) && !defined(__s390x__)
|
||
|
#error UNDEFINED ARCH
|
||
|
#endif
|
||
|
|
||
|
@@ -156,6 +156,22 @@ int dapl_os_get_env_val (
|
||
|
|
||
|
|
||
|
/* atomic functions */
|
||
|
+#ifdef __s390x__
|
||
|
+#define DAPL_CS_ADD(ptr, op_val) ({ \
|
||
|
+ int old_val, new_val; \
|
||
|
+ __asm__ __volatile__( \
|
||
|
+ " l %0,%2\n" \
|
||
|
+ "0: lr %1,%0\n" \
|
||
|
+ " ar %1,%3\n" \
|
||
|
+ " cs %0,%1,%2\n" \
|
||
|
+ " jl 0b" \
|
||
|
+ : "=&d" (old_val), "=&d" (new_val), \
|
||
|
+ "=Q" (*ptr) \
|
||
|
+ : "d" (op_val), "Q" (*ptr) \
|
||
|
+ : "cc", "memory"); \
|
||
|
+ new_val; \
|
||
|
+})
|
||
|
+#endif
|
||
|
|
||
|
/* dapl_os_atomic_inc
|
||
|
*
|
||
|
@@ -179,6 +195,11 @@ dapl_os_atomic_inc (
|
||
|
#else
|
||
|
IA64_FETCHADD(old_value,v,1,4);
|
||
|
#endif
|
||
|
+#elif defined(__s390x__)
|
||
|
+ DAT_COUNT tmp;
|
||
|
+ DAT_COUNT delta = 1;
|
||
|
+
|
||
|
+ tmp = DAPL_CS_ADD(v, delta);
|
||
|
#elif defined(__PPC__) || defined(__PPC64__)
|
||
|
int tmp;
|
||
|
|
||
|
@@ -218,6 +239,11 @@ dapl_os_atomic_dec (
|
||
|
#else
|
||
|
IA64_FETCHADD(old_value,v,-1,4);
|
||
|
#endif
|
||
|
+#elif defined(__s390x__)
|
||
|
+ DAT_COUNT tmp;
|
||
|
+ DAT_COUNT delta = -1;
|
||
|
+
|
||
|
+ tmp = DAPL_CS_ADD(v, delta);
|
||
|
#elif defined (__PPC__) || defined(__PPC64__)
|
||
|
int tmp;
|
||
|
|
||
|
@@ -273,6 +299,13 @@ dapl_os_atomic_assign (
|
||
|
#else
|
||
|
current_value = ia64_cmpxchg(acq,v,match_value,new_value,4);
|
||
|
#endif /* __ia64__ */
|
||
|
+#elif defined(__s390x__)
|
||
|
+ __asm__ __volatile__(
|
||
|
+ " cs %0,%2,%1\n"
|
||
|
+ : "+d" (match_value), "=Q" (*v)
|
||
|
+ : "d" (new_value), "Q" (*v)
|
||
|
+ : "cc", "memory");
|
||
|
+ current_value = match_value;
|
||
|
#elif defined(__PPC__) || defined(__PPC64__)
|
||
|
__asm__ __volatile__ (
|
||
|
" lwsync\n\
|
||
|
Index: dapl-2.0.39/dat/common/dat_strerror.c
|
||
|
===================================================================
|
||
|
--- dapl-2.0.39.orig/dat/common/dat_strerror.c 2014-01-21 18:07:26.206177756 +0100
|
||
|
+++ dapl-2.0.39/dat/common/dat_strerror.c 2014-01-21 18:07:26.226177293 +0100
|
||
|
@@ -47,6 +47,10 @@
|
||
|
#include <dat2/udat.h>
|
||
|
#endif /* __UDAPL__ */
|
||
|
|
||
|
+#ifndef NULL
|
||
|
+#define NULL ((void *) 0)
|
||
|
+#endif
|
||
|
+
|
||
|
/*********************************************************************
|
||
|
* *
|
||
|
* Internal Function Declarations *
|