From patchwork Fri Nov 11 15:05:42 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Milard X-Patchwork-Id: 81840 Delivered-To: patch@linaro.org Received: by 10.182.1.168 with SMTP id 8csp1481620obn; Fri, 11 Nov 2016 06:07:15 -0800 (PST) X-Received: by 10.107.165.139 with SMTP id o133mr8079767ioe.42.1478873235205; Fri, 11 Nov 2016 06:07:15 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id 138si6628848iou.228.2016.11.11.06.07.14; Fri, 11 Nov 2016 06:07:15 -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; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id B7F1F60F02; Fri, 11 Nov 2016 14:07:14 +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 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 991E860ED4; Fri, 11 Nov 2016 14:06:28 +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 EE90F60EFC; Fri, 11 Nov 2016 14:06:22 +0000 (UTC) Received: from mail-lf0-f48.google.com (mail-lf0-f48.google.com [209.85.215.48]) by lists.linaro.org (Postfix) with ESMTPS id CE0D460ED2 for ; Fri, 11 Nov 2016 14:06:20 +0000 (UTC) Received: by mail-lf0-f48.google.com with SMTP id b14so13106449lfg.2 for ; Fri, 11 Nov 2016 06:06:20 -0800 (PST) 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=aQT3OO6usgCHhRaqySn78U0YQRJ/KQYraMGe4tM9yGg=; b=NJfabf5jxIERwL6oZAPjzZflE+WvAcsgc/doqAL2L56Ckau6zVPbI9iULbuwK9KfCk q21HkE46ZP1hQRMZ9cosPwspiuzkcxy+ozOfjds1uXA8Xpuuw+aVvUzgc+9JZ7DAFzI5 HTju1sy4wEEClfZyumjEkcfY6DLi80dixUbuzXLuAeT1AArWa11YvwAAZacjns5GQwim PbvhPJVFHayvDxMUbNgPR2H/bAxCrCauC4b2co5BsvWX+DpZ3K5lGNkfOndWK1Uga++S g7kP/x9THNIZn+2F21VnuuDIHY/u7CiJDgEf0tGcjXJn92IBigK0xqXLHP/WNoJ46dZ1 V6hw== X-Gm-Message-State: ABUngvfEA0Zrr6JkDZLBNp7l5NjoTLi16F4a1XFxvnQUzcjNsL4ET6CksvZ3+H3s8Vjxqdu901M= X-Received: by 10.25.32.17 with SMTP id g17mr1486189lfg.78.1478873179646; Fri, 11 Nov 2016 06:06:19 -0800 (PST) Received: from erachmi-ericsson.ki.sw.ericsson.se (c-83-233-76-66.cust.bredband2.com. [83.233.76.66]) by smtp.gmail.com with ESMTPSA id u12sm2249671lja.4.2016.11.11.06.06.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 11 Nov 2016 06:06:19 -0800 (PST) From: Christophe Milard To: mike.holmes@linaro.org, bill.fischofer@linaro.org, lng-odp@lists.linaro.org Date: Fri, 11 Nov 2016 16:05:42 +0100 Message-Id: <1478876743-35846-3-git-send-email-christophe.milard@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1478876743-35846-1-git-send-email-christophe.milard@linaro.org> References: <1478876743-35846-1-git-send-email-christophe.milard@linaro.org> X-Topics: patch Subject: [lng-odp] [API-NEXT PATCHv2 2/3] linux-gen: drv: functions to query for physical addresses 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" The capability "phys_addr" is introduced and tells whether physical address queries are available. The function odpdrv_virt_to_phys() is added to query for physical address (from virtual address) Signed-off-by: Christophe Milard --- platform/linux-generic/drv_shm.c | 12 ++++++++++++ platform/linux-generic/include/_ishmphy_internal.h | 3 ++- platform/linux-generic/include/odp/drv/plat/shm_types.h | 3 +++ 3 files changed, 17 insertions(+), 1 deletion(-) -- 2.7.4 diff --git a/platform/linux-generic/drv_shm.c b/platform/linux-generic/drv_shm.c index 9b2560d..6005f69 100644 --- a/platform/linux-generic/drv_shm.c +++ b/platform/linux-generic/drv_shm.c @@ -8,6 +8,7 @@ #include #include #include <_ishm_internal.h> +#include <_ishmphy_internal.h> static inline uint32_t from_handle(odpdrv_shm_t shm) { @@ -24,6 +25,7 @@ int odpdrv_shm_capability(odpdrv_shm_capability_t *capa) capa->max_blocks = ODPDRV_CONFIG_SHM_BLOCKS; capa->max_size = 0; capa->max_align = 0; + capa->phys_addr = _odp_ishmphy_can_virt_to_phys(); return 0; } @@ -100,3 +102,13 @@ int odpdrv_shm_print_all(const char *title) { return _odp_ishm_status(title); } + +odpdrv_phys_addr_t odpdrv_virt_to_phys(const void *addr) +{ + return (odpdrv_phys_addr_t)_odp_ishmphy_virt_to_phys(addr); +} + +void odpdrv_memmap_print(void *addr, uint64_t len) +{ + _odp_ishmphy_memmap_print(addr, len); +} diff --git a/platform/linux-generic/include/_ishmphy_internal.h b/platform/linux-generic/include/_ishmphy_internal.h index c8752c0..00a5f8e 100644 --- a/platform/linux-generic/include/_ishmphy_internal.h +++ b/platform/linux-generic/include/_ishmphy_internal.h @@ -12,8 +12,9 @@ extern "C" { #endif #include +#include -typedef uint64_t phys_addr_t; /* Physical address definition. */ +typedef odpdrv_phys_addr_t phys_addr_t; /* Physical address definition. */ #define PHYS_ADDR_INVALID ((phys_addr_t)-1) void *_odp_ishmphy_book_va(uintptr_t len, intptr_t align); diff --git a/platform/linux-generic/include/odp/drv/plat/shm_types.h b/platform/linux-generic/include/odp/drv/plat/shm_types.h index c48eeca..a54d806 100644 --- a/platform/linux-generic/include/odp/drv/plat/shm_types.h +++ b/platform/linux-generic/include/odp/drv/plat/shm_types.h @@ -29,6 +29,9 @@ typedef ODPDRV_HANDLE_T(odpdrv_shm_t); #define ODPDRV_SHM_INVALID _odpdrv_cast_scalar(odpdrv_shm_t, 0) +/* a physical address: */ +typedef uint64_t odpdrv_phys_addr_t; + /** Get printable format of odpdrv_shm_t */ static inline uint64_t odpdrv_shm_to_u64(odpdrv_shm_t hdl) {