From patchwork Thu Nov 10 17:21:52 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Milard X-Patchwork-Id: 81712 Delivered-To: patch@linaro.org Received: by 10.140.97.165 with SMTP id m34csp841518qge; Thu, 10 Nov 2016 09:22:28 -0800 (PST) X-Received: by 10.55.125.193 with SMTP id y184mr7581711qkc.181.1478798548626; Thu, 10 Nov 2016 09:22:28 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id k42si3940951qtk.83.2016.11.10.09.22.28; Thu, 10 Nov 2016 09:22:28 -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 4927160E51; Thu, 10 Nov 2016 17:22:28 +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=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, 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 679DA609A4; Thu, 10 Nov 2016 17:22:06 +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 C612B60975; Thu, 10 Nov 2016 17:22:02 +0000 (UTC) Received: from mail-lf0-f47.google.com (mail-lf0-f47.google.com [209.85.215.47]) by lists.linaro.org (Postfix) with ESMTPS id 821946096D for ; Thu, 10 Nov 2016 17:22:01 +0000 (UTC) Received: by mail-lf0-f47.google.com with SMTP id b14so195051799lfg.2 for ; Thu, 10 Nov 2016 09:22:01 -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=f02iGmLCrRdFBo5VNMAdXo/Civ87XLNPntCVLSgy0VA=; b=KnSJZOkmBvhUP9AopElKFgunzMH2BbsEDxBvOlUAMQOSW1IkhSq97GkyL/GzBLyUJ4 4FvZk1I+D3VadejOMm3T+eakpMeE+vyxsgWVhov0e+IddoV4ocGXMUTanVeX+P51zVB5 aws9kPfzOccWVIS+0/BWMWsYqz+7CyRb9ChqHMa74/XYWUdUg0doUdHwuSMicCHArggZ 9XOJhOE6siQH/qY1CjoZQ1uxW5grZvn2UIb7O9n2BEaL4gaPIAQkCs/JdLaWDnwQvQ1I iiNNeF8l7MSjTsWZQNqcjY967YkMWRL4AxDkMVxML2hH5B4fLnOmVaCK46xElqfx5IE/ uuNQ== X-Gm-Message-State: ABUngveSDBz+mqKNJzWW7z/qCkcP6h/DYBYfjI/uOaAGXmmub1H6szk0WwOiWckZO9x6ezGh/1g= X-Received: by 10.25.92.5 with SMTP id q5mr3693635lfb.82.1478798520183; 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.21.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 10 Nov 2016 09:21:59 -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:52 +0100 Message-Id: <1478798514-20999-2-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 1/3] drv: shm: function 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 --- include/odp/drv/spec/shm.h | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) -- 2.7.4 diff --git a/include/odp/drv/spec/shm.h b/include/odp/drv/spec/shm.h index ef64f5d..ca3aae2 100644 --- a/include/odp/drv/spec/shm.h +++ b/include/odp/drv/spec/shm.h @@ -43,6 +43,12 @@ extern "C" { #define ODPDRV_SHM_LOCK 0x02 /**< Memory shall be locked (no swap) */ /** + * @typedef odpdrv_phys_addr_t + * A physical memory address + * + */ + +/** * Shared memory block info */ typedef struct odpdrv_shm_info_t { @@ -75,6 +81,13 @@ typedef struct odpdrv_shm_capability_t { * available memory size. */ uint64_t max_align; + /** Can retrieve physical addresses + * + * A true (non-zero) value means that odpdrv_getphy() can be + * used to retrieve physical memory addresses, (as well as + * the debug function odp_drv_dumpphy() */ + int can_getphy; + } odpdrv_shm_capability_t; /** @@ -220,6 +233,28 @@ int odpdrv_shm_print_all(const char *title); uint64_t odpdrv_shm_to_u64(odpdrv_shm_t hdl); /** + * Get physical address from virtual address + * + * @addr virtual address. + * @return Physicall address or NULL + * + * @note This routine will work only if capability "can_getphy" is true. + */ +odpdrv_phys_addr_t odpdrv_getphy(const void *addr); + +/** + * Print physical address mapping + * + * @addr virtual address. + * @return Physicall address or NULL + * + * @note This routine will work only if capability "can_getphy" is true. + * @note This routine is intended to be used for diagnostic purposes, + * and uses ODP_DBG printouts + */ +void odpdrv_dumpphy(void *addr, uint64_t len); + +/** * @} */