From patchwork Thu Nov 10 17:21:53 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Milard X-Patchwork-Id: 81713 Delivered-To: patch@linaro.org Received: by 10.140.97.165 with SMTP id m34csp841714qge; Thu, 10 Nov 2016 09:22:53 -0800 (PST) X-Received: by 10.55.71.74 with SMTP id u71mr7088339qka.251.1478798573890; Thu, 10 Nov 2016 09:22:53 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id 63si3919031qke.298.2016.11.10.09.22.53; Thu, 10 Nov 2016 09:22:53 -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 85AB560D67; Thu, 10 Nov 2016 17:22:53 +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 B730C6096E; Thu, 10 Nov 2016 17:22:09 +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 69BB66096C; Thu, 10 Nov 2016 17:22:03 +0000 (UTC) Received: from mail-lf0-f49.google.com (mail-lf0-f49.google.com [209.85.215.49]) by lists.linaro.org (Postfix) with ESMTPS id 24DC56096C for ; Thu, 10 Nov 2016 17:22:02 +0000 (UTC) Received: by mail-lf0-f49.google.com with SMTP id b14so195052044lfg.2 for ; Thu, 10 Nov 2016 09:22:02 -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=qRruIUNmb1Jz9p5Q0VNcm/B+UqAL4JSnNlxut/PIuTs=; b=Ud1UOC1Yst70gqzovw91h4iwg7K6+Qg4fDScXQFFVtDovRINDjZk7lFLk1oBrOzFVJ c/Lw9KkJ5B7Cbt0UauS6BLlRxupLIW0bwlH2jsdYqcFxP7iECEQPGRIY3nj7Wqbr2LyY VS5Rt+xmHkf/ALL7dV5zGAmWj4NVUBmxbXSvhYvuFWdfAQBvfEwTowDRqW2fQcfQ6KdK WxPx6I31r+PN7WRW1omanYayCAOZlN0Zront01zel8U0e2AkNDlEtSZltP+RKW7zDPie r4IVqtwm+1tqQaVFdSNXXej5WRQjFIJ3zVdxmdKsPeLf3X5ZouzgIaT7RzLnO+ujDMqz 2Z8w== X-Gm-Message-State: ABUngvcp7g6ZMwG0hYZSi/NVN0jhpjfxffuAZrR0q60yg2oRzbPiwe8u+MTcgvQFCdtLGCZXBM8= X-Received: by 10.25.24.98 with SMTP id o95mr3720545lfi.4.1478798520923; Thu, 10 Nov 2016 09:22:00 -0800 (PST) Received: from localhost.localdomain (c-83-233-76-66.cust.bredband2.com. [83.233.76.66]) by smtp.gmail.com with ESMTPSA id h35sm1225175lji.29.2016.11.10.09.22.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 10 Nov 2016 09:22:00 -0800 (PST) From: Christophe Milard To: mike.holmes@linaro.org, bill.fischofer@linaro.org, yi.he@linaro.org, lng-odp@lists.linaro.org Date: Thu, 10 Nov 2016 18:21:53 +0100 Message-Id: <1478798514-20999-3-git-send-email-christophe.milard@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1478798514-20999-1-git-send-email-christophe.milard@linaro.org> References: <1478798514-20999-1-git-send-email-christophe.milard@linaro.org> X-Topics: patch Subject: [lng-odp] [API-NEXT PATCH 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 "can_getphy" is introduced and tells whether physical address queries are available. The function odpdrv_getphy() 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..831c325 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->can_getphy = _odp_ishmphy_can_getphy(); return 0; } @@ -100,3 +102,13 @@ int odpdrv_shm_print_all(const char *title) { return _odp_ishm_status(title); } + +odpdrv_phys_addr_t odpdrv_getphy(const void *addr) +{ + return (odpdrv_phys_addr_t)_odp_ishmphy_getphy(addr); +} + +void odpdrv_dumpphy(void *addr, uint64_t len) +{ + _odp_ishmphy_dumpphy(addr, len); +} diff --git a/platform/linux-generic/include/_ishmphy_internal.h b/platform/linux-generic/include/_ishmphy_internal.h index bb61ab4..1b56a64 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) {