From patchwork Fri Jan 8 20:29:48 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Milard X-Patchwork-Id: 59390 Delivered-To: patch@linaro.org Received: by 10.112.130.2 with SMTP id oa2csp750977lbb; Fri, 8 Jan 2016 11:37:01 -0800 (PST) X-Received: by 10.140.22.210 with SMTP id 76mr94213338qgn.70.1452281821753; Fri, 08 Jan 2016 11:37:01 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id b77si96749063qhb.46.2016.01.08.11.37.01; Fri, 08 Jan 2016 11:37:01 -0800 (PST) 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; dkim=neutral (body hash did not verify) header.i=@linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 13C99616E9; Fri, 8 Jan 2016 19:37:01 +0000 (UTC) Authentication-Results: lists.linaro.org; dkim=fail reason="verification failed; unprotected key" header.d=linaro.org header.i=@linaro.org header.b=CQ1yrNBc; dkim-adsp=none (unprotected policy); dkim-atps=neutral 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.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID, 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 DB89D6172C; Fri, 8 Jan 2016 19:32:52 +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 2A2A0616E9; Fri, 8 Jan 2016 19:32:49 +0000 (UTC) Received: from mail-lf0-f43.google.com (mail-lf0-f43.google.com [209.85.215.43]) by lists.linaro.org (Postfix) with ESMTPS id 9F8186172C for ; Fri, 8 Jan 2016 19:31:39 +0000 (UTC) Received: by mail-lf0-f43.google.com with SMTP id m198so33830705lfm.0 for ; Fri, 08 Jan 2016 11:31:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=PQtGnjkZ5EHTnVk3vn8z5s7v/61tXCWd286XaLN6XxM=; b=CQ1yrNBcrg/oySyD+Qk5oNCaqyBJq0JacYgCEUmtd2khlezgGjbOVfDyNjyKbg0oXP ypIdx2+pdYVg9ZxSyOlkFF1sobtlzMpq4NEh1wjEq21e05soTF9ZzXQ7vNMuPjApUXz2 mqi45YHnxjUkEhwrnuJlz3zz2AR/h3e1f99mw= 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=PQtGnjkZ5EHTnVk3vn8z5s7v/61tXCWd286XaLN6XxM=; b=banedOLNPDXoeVgOZTXiWadDxcTtU1JP3NlS3xshd5Y1ap9o15lzGUjL9ZY5oFIO3h R/8wu5IDGHARtId+vzxSh2iAO4LgZJFxL30pd9Id6lsC8IDr/zT8+CX0gnS8BNFiGWVP D//eiAeteel9WVvcx34N1zFneAhtvgNCG4JB8K63QJAvtmfk5IkqMvhFECe7Ms3MEiPp 8MBV72dshM44CyBGYeOXgG+Dgi55YyZH/52TlZBk7glUTYB0eRbjQvXH704OpzmwWWCT 7rtygmBQugU4sjphhokRvUty16zGGDyQvZdbUBI8oF3lqoXxdQxiYzB86kZEq6csdDA5 o3Tg== X-Gm-Message-State: ALoCoQnynzeLog3IeYyJZwTo2RF0OyGa9X2PkKtI+qVFYeSuIoGk66GskIppxj+RkQd1Pqc7eXsj4uzzysEaFMiTWxlw7F7sKA== X-Received: by 10.25.146.193 with SMTP id u184mr2206382lfd.86.1452281498551; Fri, 08 Jan 2016 11:31:38 -0800 (PST) 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 l204sm2085534lfg.49.2016.01.08.11.31.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 08 Jan 2016 11:31:37 -0800 (PST) From: Christophe Milard To: anders.roxell@linaro.org, mike.holmes@linaro.org, stuart.haslam@linaro.org, maxim.uvarov@linaro.org, bill.fischofer@linaro.org, petri.savolainen@linaro.org, edavis@broadcom.com Date: Fri, 8 Jan 2016 21:29:48 +0100 Message-Id: <1452285014-60320-6-git-send-email-christophe.milard@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1452285014-60320-1-git-send-email-christophe.milard@linaro.org> References: <1452285014-60320-1-git-send-email-christophe.milard@linaro.org> Cc: lng-odp@lists.linaro.org Subject: [lng-odp] [API-NEXT RFC 05/31] linux-generic: shmem: retrieving DMA map desriptor 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: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" Linux-generic implementation of the function returning a DMA mapping descriptor for an allocated shared memory block. Signed-off-by: Christophe Milard --- platform/linux-generic/odp_shared_memory.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/platform/linux-generic/odp_shared_memory.c b/platform/linux-generic/odp_shared_memory.c index ab48dda..6ef89c8 100644 --- a/platform/linux-generic/odp_shared_memory.c +++ b/platform/linux-generic/odp_shared_memory.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -363,6 +364,31 @@ int odp_shm_info(odp_shm_t shm, odp_shm_info_t *info) return 0; } +odp_dma_map_t odp_shm_get_dma_map(odp_shm_t shm) +{ + odp_shm_block_t *block; + uint32_t i; + dma_map_t *dma_map; + + i = from_handle(shm); + + if (i > (ODP_CONFIG_SHM_BLOCKS - 1)) + return ODP_DMA_REGION_INVALID; + + block = &odp_shm_tbl->block[i]; + if (!(block->flags & ODP_SHM_DMA)) + return ODP_DMA_REGION_INVALID; + + dma_map = _odp_dma_map_alloc(); + if (odp_unlikely(dma_map == NULL)) + return ODP_DMA_REGION_INVALID; + + dma_map->addr = block->addr; + dma_map->dma_addr = (odp_dma_addr_t)block->addr; + dma_map->size = block->size; + + return (odp_dma_map_t)dma_map; +} void odp_shm_print_all(void) {