From patchwork Mon Jul 18 17:49:27 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Milard X-Patchwork-Id: 72225 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp211002qga; Mon, 18 Jul 2016 09:56:17 -0700 (PDT) X-Received: by 10.55.33.138 with SMTP id f10mr44936998qki.86.1468860977767; Mon, 18 Jul 2016 09:56:17 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id 143si16814963qkg.49.2016.07.18.09.56.17; Mon, 18 Jul 2016 09:56:17 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 5E43F68090; Mon, 18 Jul 2016 16:56:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 3C42768818; Mon, 18 Jul 2016 16:51:16 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 1F40B687EB; Mon, 18 Jul 2016 16:50:49 +0000 (UTC) Received: from mail-lf0-f50.google.com (mail-lf0-f50.google.com [209.85.215.50]) by lists.linaro.org (Postfix) with ESMTPS id 9B2CD687E8 for ; Mon, 18 Jul 2016 16:50:45 +0000 (UTC) Received: by mail-lf0-f50.google.com with SMTP id f93so136186980lfi.2 for ; Mon, 18 Jul 2016 09:50:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=30nzZOMaeRe9+kDt6ti7YLnh2McnYW8rwKdyRUFUPGk=; b=Hj3AQqEH4Q137s3aG5/ZcXCKgfDaooSgX5r7lMkRGTQfrSIY6PqUQhrw/QYeeTFui6 m5sqg5uaBtNC8sTNcoTh1Ey5W8t6RgMCxOabzVAnZMFktS/fbdycHLAtJjDhwcfPmvE8 XxLm3AHn1RltyQxMRpPHGpQPf7kn8vl5wuiDpdBiS61WFw2tZ0WnEw4QAihzDJLCfqTH /1pxELK3JnLiAz84k+a8pwMn6QPH2SEiifra6Rk7R+Vp8QfHb5+Hsi3hKLRCbxJq5Ma0 5yosDg4WKoYnVG/vcx5sFU9l0gEBa7WDfvFfSLc8u2Qudk7vMPgxN9sk8DcLRWkkE0Vb rw5g== X-Gm-Message-State: ALyK8tJBFkXyrxszhk8UeP3iZvZ45xUuEX2y9MRAxTVlYPYxrs/IFhr/Dr/HIxmKVjvbgTuFSkE= X-Received: by 10.25.157.146 with SMTP id g140mr6839742lfe.172.1468860644434; Mon, 18 Jul 2016 09:50:44 -0700 (PDT) Received: from erachmi-ericsson.ki.sw.ericsson.se (c-83-233-90-46.cust.bredband2.com. [83.233.90.46]) by smtp.gmail.com with ESMTPSA id y200sm2226229lfd.12.2016.07.18.09.50.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 18 Jul 2016 09:50:43 -0700 (PDT) From: Christophe Milard To: mike.holmes@linaro.org, yi.he@linaro.org, balakrishna.garapati@linaro.org, lng-odp@lists.linaro.org Date: Mon, 18 Jul 2016 19:49:27 +0200 Message-Id: <1468864178-43721-8-git-send-email-christophe.milard@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1468864178-43721-1-git-send-email-christophe.milard@linaro.org> References: <1468864178-43721-1-git-send-email-christophe.milard@linaro.org> X-Topics: patch Subject: [lng-odp] [API-NEXT PATCH 07/18] drv: adding sync.h X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" copied from API side, hash 77a27212b563299959fb2a609b86bb9117a8f918. Signed-off-by: Christophe Milard --- include/odp/drv/spec/sync.h | 91 +++++++++++++++++++++++++++++++++++++++++++++ platform/Makefile.inc | 3 +- 2 files changed, 93 insertions(+), 1 deletion(-) create mode 100644 include/odp/drv/spec/sync.h -- 2.7.4 diff --git a/include/odp/drv/spec/sync.h b/include/odp/drv/spec/sync.h new file mode 100644 index 0000000..ea60685 --- /dev/null +++ b/include/odp/drv/spec/sync.h @@ -0,0 +1,91 @@ +/* Copyright (c) 2016, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +/** + * @file + * + * ODPDRV memory barriers + */ + +#ifndef ODPDRV_API_SYNC_H_ +#define ODPDRV_API_SYNC_H_ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @addtogroup odpdrv_barrier + * @details + * Memory barriers + * + * Memory barriers enforce ordering of memory load and store operations + * specified before and after the barrier. These barriers may affect both + * compiler optimizations and CPU out-of-order execution. All ODPDRV + * synchronization mechanisms (e.g. execution barriers, locks, queues, etc ) + * include all necessary memory barriers, so these calls are not needed when + * using those. Also ODPDRV atomic operations have memory ordered versions. + * These explicit barriers may be needed when thread synchronization is based on + * a non-ODPDRV defined mechanism. Depending on the HW platform, heavy usage of + * memory barriers may cause significant performance degradation. + * + * @{ + */ + +/** + * Memory barrier for release operations + * + * This memory barrier has release semantics. It synchronizes with a pairing + * barrier for acquire operations. The releasing and acquiring threads + * synchronize through shared memory. The releasing thread must call this + * barrier before signaling the acquiring thread. After the acquiring thread + * receives the signal, it must call odpdrv_mb_acquire() before it reads the + * memory written by the releasing thread. + * + * This call is not needed when using ODPDRV defined synchronization mechanisms. + * + * @see odpdrv_mb_acquire() + */ +void odpdrv_mb_release(void); + +/** + * Memory barrier for acquire operations + * + * This memory barrier has acquire semantics. It synchronizes with a pairing + * barrier for release operations. The releasing and acquiring threads + * synchronize through shared memory. The releasing thread must call + * odpdrv_mb_release() before signaling the acquiring thread. After the + * acquiring thread receives the signal, it must call this barrier before it + * read the memory written by the releasing thread. + * + * This call is not needed when using ODPDRV defined synchronization mechanisms. + * + * @see odpdrv_mb_release() + */ +void odpdrv_mb_acquire(void); + +/** + * Full memory barrier + * + * This is a full memory barrier. It guarantees that all load and store + * operations specified before it are visible to other threads before + * all load and store operations specified after it. + * + * This call is not needed when using ODPDRV defined synchronization mechanisms. + */ +void odpdrv_mb_full(void); + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#include +#endif diff --git a/platform/Makefile.inc b/platform/Makefile.inc index 9fea4a7..21f2922 100644 --- a/platform/Makefile.inc +++ b/platform/Makefile.inc @@ -63,4 +63,5 @@ odpapispecinclude_HEADERS = \ odpdrvspecincludedir= $(includedir)/odp/drv/spec odpdrvspecinclude_HEADERS = \ - $(top_srcdir)/include/odp/drv/spec/byteorder.h + $(top_srcdir)/include/odp/drv/spec/byteorder.h \ + $(top_srcdir)/include/odp/drv/spec/sync.h