From patchwork Thu Dec 19 11:53:15 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Ishchuk X-Patchwork-Id: 3377521 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id CC0BBC0D4B for ; Thu, 19 Dec 2013 11:54:06 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B695320626 for ; Thu, 19 Dec 2013 11:54:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0D01B20613 for ; Thu, 19 Dec 2013 11:54:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752314Ab3LSLyA (ORCPT ); Thu, 19 Dec 2013 06:54:00 -0500 Received: from e06smtp14.uk.ibm.com ([195.75.94.110]:38231 "EHLO e06smtp14.uk.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751525Ab3LSLx7 (ORCPT ); Thu, 19 Dec 2013 06:53:59 -0500 Received: from /spool/local by e06smtp14.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 19 Dec 2013 11:53:58 -0000 Received: from d06dlp03.portsmouth.uk.ibm.com (9.149.20.15) by e06smtp14.uk.ibm.com (192.168.101.144) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 19 Dec 2013 11:53:56 -0000 Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by d06dlp03.portsmouth.uk.ibm.com (Postfix) with ESMTP id E37E91B08061 for ; Thu, 19 Dec 2013 11:53:04 +0000 (GMT) Received: from d06av12.portsmouth.uk.ibm.com (d06av12.portsmouth.uk.ibm.com [9.149.37.247]) by b06cxnps4076.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id rBJBrh6E63438870 for ; Thu, 19 Dec 2013 11:53:43 GMT Received: from d06av12.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av12.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id rBJBrrTq027323 for ; Thu, 19 Dec 2013 04:53:54 -0700 Received: from tuxmaker.boeblingen.de.ibm.com (tuxmaker.boeblingen.de.ibm.com [9.152.85.9]) by d06av12.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id rBJBrdCQ026833; Thu, 19 Dec 2013 04:53:52 -0700 From: Alexey Ishchuk To: linux-rdma@vger.kernel.org Cc: arlin.r.davis@intel.com, gilr@dev.mellanox.co.il, roland@kernel.org, klaus.wacker@de.ibm.com, alexey_ishchuk@ru.ibm.com Subject: [PATCH 3/4] DAPL: Support for Linux on System z in dapl package Date: Thu, 19 Dec 2013 12:53:15 +0100 Message-Id: <1387453998-27416-3-git-send-email-alexey_ishchuk@ru.ibm.com> X-Mailer: git-send-email 1.8.3.4 In-Reply-To: <1387453998-27416-1-git-send-email-alexey_ishchuk@ru.ibm.com> References: <1387453998-27416-1-git-send-email-alexey_ishchuk@ru.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 13121911-1948-0000-0000-000007465A95 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-7.4 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 s390: Add support for Linux on System z This patch adds the required code to support Linux on System z. --- 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 diff -aurp /usr/src/packages/BUILD/dapl-2.0.38/dapl/udapl/linux/dapl_osd.h dapl-2.0.38/dapl/udapl/linux/dapl_osd.h --- /usr/src/packages/BUILD/dapl-2.0.38/dapl/udapl/linux/dapl_osd.h 2013-07-22 21:30:02.000000000 +0200 +++ dapl-2.0.38/dapl/udapl/linux/dapl_osd.h 2013-12-12 10:16:35.943796712 +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\ diff -aurp /usr/src/packages/BUILD/dapl-2.0.38/dat/common/dat_strerror.c dapl-2.0.38/dat/common/dat_strerror.c --- /usr/src/packages/BUILD/dapl-2.0.38/dat/common/dat_strerror.c 2013-06-07 02:42:48.000000000 +0200 +++ dapl-2.0.38/dat/common/dat_strerror.c 2013-12-12 10:16:35.943796712 +0100 @@ -43,6 +43,10 @@ #include #endif /* __UDAPL__ */ +#ifndef NULL +#define NULL ((void *) 0) +#endif + /********************************************************************* * * * Internal Function Declarations *