From patchwork Thu Jul 21 12:06:15 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Milard X-Patchwork-Id: 72545 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp378711qga; Thu, 21 Jul 2016 04:10:18 -0700 (PDT) X-Received: by 10.37.199.75 with SMTP id w72mr29903499ybe.33.1469099411819; Thu, 21 Jul 2016 04:10:11 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id q23si4639084qkl.56.2016.07.21.04.10.10; Thu, 21 Jul 2016 04:10:11 -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 7425D681F7; Thu, 21 Jul 2016 11:10:10 +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 ECEEC68572; Thu, 21 Jul 2016 11:07:41 +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 D91E464D77; Thu, 21 Jul 2016 11:07:26 +0000 (UTC) Received: from mail-lf0-f41.google.com (mail-lf0-f41.google.com [209.85.215.41]) by lists.linaro.org (Postfix) with ESMTPS id 0D8F461673 for ; Thu, 21 Jul 2016 11:07:24 +0000 (UTC) Received: by mail-lf0-f41.google.com with SMTP id f93so58655737lfi.2 for ; Thu, 21 Jul 2016 04:07:23 -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=6pTtkDN3umgU8XxPTnldeDaa/LmAWR4a5dEgseVRXZE=; b=ap+jlL/MBwfqMI9ohkvwoBp1sDRqlbca/zjsNJYqD+AiucJ+ptyJ7TKLA1ZVIRnhAa j+dLWW8t8ZFem5pv4/MMIJpg8gGinOyMr6XlBJJuFBXgC1ZKy5AuXyQCrKQhK+dSHkuf uLBT7xJnOnCRvektMvIOq+cocfExUgaIQ8beufO0d7PCD3yItAJNK5+i/GP54wWFlhbs 432QRr9w6dZhp8t+Y6XvvdjCzxMNCO2ii7vOCVOSRw1Pb89pnZr6K+GIjSi+OYtBdq8S KFn69KtDkfbfTabhHql0ffTSp1AFAy4orYmTfHk6Fsmqk8RwAbu0QnDrxjh7VgFW8zv3 X1Cg== X-Gm-Message-State: ALyK8tKGc03lKmfY1OTP0L/zDRRQ3QjF/ZCa4DFEYGGaKU1RYxRJbzBfM9VkpoSA4Q8wDCjjEvk= X-Received: by 10.25.165.71 with SMTP id o68mr5619501lfe.95.1469099242688; Thu, 21 Jul 2016 04:07:22 -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 i80sm1577861lfg.6.2016.07.21.04.07.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 21 Jul 2016 04:07:22 -0700 (PDT) From: Christophe Milard To: mike.holmes@linaro.org, lng-odp@lists.linaro.org, balakrishna.garapati@linaro.org Date: Thu, 21 Jul 2016 14:06:15 +0200 Message-Id: <1469102786-65530-8-git-send-email-christophe.milard@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1469102786-65530-1-git-send-email-christophe.milard@linaro.org> References: <1469102786-65530-1-git-send-email-christophe.milard@linaro.org> X-Topics: patch Subject: [lng-odp] [API-NEXT PATCHv3 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" Based on API interface file. 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