From patchwork Wed Aug 27 10:24:39 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Ishchuk X-Patchwork-Id: 4787381 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 32C1E9F2A9 for ; Wed, 27 Aug 2014 10:25:53 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 62EA720123 for ; Wed, 27 Aug 2014 10:25:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8530C2017E for ; Wed, 27 Aug 2014 10:25:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933640AbaH0KZm (ORCPT ); Wed, 27 Aug 2014 06:25:42 -0400 Received: from e06smtp15.uk.ibm.com ([195.75.94.111]:50066 "EHLO e06smtp15.uk.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933393AbaH0KZl (ORCPT ); Wed, 27 Aug 2014 06:25:41 -0400 Received: from /spool/local by e06smtp15.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 27 Aug 2014 11:25:40 +0100 Received: from d06dlp02.portsmouth.uk.ibm.com (9.149.20.14) by e06smtp15.uk.ibm.com (192.168.101.145) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 27 Aug 2014 11:25:37 +0100 Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by d06dlp02.portsmouth.uk.ibm.com (Postfix) with ESMTP id D8DA22190046; Wed, 27 Aug 2014 11:25:18 +0100 (BST) Received: from d06av01.portsmouth.uk.ibm.com (d06av01.portsmouth.uk.ibm.com [9.149.37.212]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id s7RAPbTa13172930; Wed, 27 Aug 2014 10:25:37 GMT Received: from d06av01.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av01.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id s7RAPZse003181; Wed, 27 Aug 2014 04:25:36 -0600 Received: from tuxmaker.boeblingen.de.ibm.com (tuxmaker.boeblingen.de.ibm.com [9.152.85.9]) by d06av01.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id s7RAP1jm001480; Wed, 27 Aug 2014 04:25:34 -0600 From: Alexey Ishchuk To: linux-rdma@vger.kernel.org Cc: arlin.r.davis@intel.com, gilr@dev.mellanox.co.il, roland@kernel.org, linux-s390@vger.kernel.org, gmuelas@de.ibm.com, utz.bacher@de.ibm.com, martin.schwidefsky@de.ibm.com, frank.blaschka@de.ibm.com, Alexey Ishchuk Subject: [PATCH 4/5] dapl: add support for the s390x platform Date: Wed, 27 Aug 2014 12:24:39 +0200 Message-Id: <1409135080-44991-5-git-send-email-aishchuk@linux.vnet.ibm.com> X-Mailer: git-send-email 1.8.5.5 In-Reply-To: <1409135080-44991-1-git-send-email-aishchuk@linux.vnet.ibm.com> References: <1409135080-44991-1-git-send-email-aishchuk@linux.vnet.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 14082710-0342-0000-0000-000000DD0202 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch adds the dapl_os_atopmic_inc, dapl_os_atomic_dec, and dapl_os_atomic_assign function implementatios to the dapl userspace package to provide the DAPL API support on the s390x platform by adding Assembler language implemenation of those platform specific functions. Signed-off-by: Alexey Ishchuk Acked-by: Arlin Davis --- dapl/udapl/linux/dapl_osd.h | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- a/dapl/udapl/linux/dapl_osd.h +++ b/dapl/udapl/linux/dapl_osd.h @@ -49,7 +49,9 @@ #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 +158,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 +197,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 +241,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 +301,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\