From patchwork Fri Nov 11 15:05:41 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Milard X-Patchwork-Id: 81839 Delivered-To: patch@linaro.org Received: by 10.182.1.168 with SMTP id 8csp1481365obn; Fri, 11 Nov 2016 06:06:49 -0800 (PST) X-Received: by 10.36.250.201 with SMTP id v192mr9122633ith.106.1478873209213; Fri, 11 Nov 2016 06:06:49 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id o123si19664439ita.61.2016.11.11.06.06.48; Fri, 11 Nov 2016 06:06:49 -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 509CD60F12; Fri, 11 Nov 2016 14:06:48 +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 3DCFA60EFF; Fri, 11 Nov 2016 14:06:25 +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 5D56A60ED5; Fri, 11 Nov 2016 14:06:21 +0000 (UTC) Received: from mail-lf0-f51.google.com (mail-lf0-f51.google.com [209.85.215.51]) by lists.linaro.org (Postfix) with ESMTPS id ED32760A54 for ; Fri, 11 Nov 2016 14:06:19 +0000 (UTC) Received: by mail-lf0-f51.google.com with SMTP id c13so13170050lfg.0 for ; Fri, 11 Nov 2016 06:06:19 -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=zLccQnq3Q8Pw8EQUuhe7/fGelqNcnBcDfloEwTiyLMY=; b=YRw0P4e/gtzS7beHWKMJ8dK24ISMYUNZABJxLl1ggwGp6a1UPzzJ1Vd/VGMRyFx1UH 2io9ksKAVy7TIlIw8j05E0xYLP9O3quwtNaKcy1TlgRmqGaRuknn1RpHwTD53VPJqnwb UB2rDLBs7Rc9yqRN7cNk5c6TqijkLUl5bTlELaB/SOOJ9l5CBZy6RGXvfUaYMB0JwZsi JdYLaq1jrTFO+nB4pqZebC3Idqa4U6ymUgdmLNDzeEC+4KIBrNtB+vfxgqBQc2zjXt0a PgN3x6eQXAjyZG+C8ORYhbWRo8qXcx/1kFdl2+wWpmPUuT7SIkl6BfSoqbz9V4hgAEh/ O0OQ== X-Gm-Message-State: ABUngveNngZIIasCjuwDfyaOBw9Q5RxAQOZ4sbyedPLBYn+oilVK5GduUc1RzygzYstyCZYUg/E= X-Received: by 10.25.154.199 with SMTP id c190mr1444023lfe.76.1478873178724; Fri, 11 Nov 2016 06:06:18 -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.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 11 Nov 2016 06:06:18 -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:41 +0100 Message-Id: <1478876743-35846-2-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 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 "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 --- 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..761e294 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 (1) value means that odpdrv_virt_to_phys() can be + * used to retrieve physical memory addresses, (as well as + * the debug function odp_drv_memmap_print() */ + int phys_addr:1; + } 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 "phys_addr" is true. + */ +odpdrv_phys_addr_t odpdrv_virt_to_phys(const void *addr); + +/** + * Print physical address mapping on debug output + * + * @addr virtual address. + * @len virtual address area length (bytes) + * + * @note This routine will work only if capability "phys_addr" is true. + * @note This routine is intended to be used for diagnostic purposes, + * and uses ODP_DBG printouts (--enable-debug-print required) + */ +void odpdrv_memmap_print(void *addr, uint64_t len); + +/** * @} */