From patchwork Thu Nov 10 17:21:54 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Milard X-Patchwork-Id: 81714 Delivered-To: patch@linaro.org Received: by 10.140.97.165 with SMTP id m34csp841955qge; Thu, 10 Nov 2016 09:23:29 -0800 (PST) X-Received: by 10.55.155.7 with SMTP id d7mr7523907qke.81.1478798609492; Thu, 10 Nov 2016 09:23:29 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id g46si3927884qtg.137.2016.11.10.09.23.29; Thu, 10 Nov 2016 09:23:29 -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 20FC260988; Thu, 10 Nov 2016 17:23:29 +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 0D36C60E52; Thu, 10 Nov 2016 17:22:12 +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 37CED60E49; Thu, 10 Nov 2016 17:22:08 +0000 (UTC) Received: from mail-lf0-f46.google.com (mail-lf0-f46.google.com [209.85.215.46]) by lists.linaro.org (Postfix) with ESMTPS id 060776096D for ; Thu, 10 Nov 2016 17:22:03 +0000 (UTC) Received: by mail-lf0-f46.google.com with SMTP id c13so195142756lfg.0 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=qeXPlclSiomS01z1iWKVMbUU7/EHuyzHJ+ss8575uRE=; b=D//DaHJL9F/zBg1IorSwrDANFaMr7KqpcXbIXuA37tDL8CmwsNPiphv4su6u4wEpdK dDJElTpMNKXTO7KvhKC/QH4X5P9frfL+PDIFpxJjmAwMOssO5vmi67zipA1ywEv2b7Kg 8nli3ipO4PsmOblNPMrxvg/H+hqW1FbMcckSr32pQiElo4L9aUYN+O9WF/7fn815o3V3 2Kx0Mt+yBCbKUeEcFd4UlVqqmozHeQdBG3qBWxD4w7CPgtf8Np/APtDMzdJYUUoeCTKs 7ywraB3DMSRkjAWJW3hK6elPCKqxLiQWPUT1f1Qi4f5Jin58z8/aVOzNbFQ6Ak+noVdh 21VQ== X-Gm-Message-State: ABUngvd/XTa4Ksv7LQUF1FMjMA584ECGzdRdn95jbkTyXlXlewQbfIpaY/Ze66hSYrHKUc67ODU= X-Received: by 10.25.213.68 with SMTP id m65mr3119215lfg.43.1478798521871; Thu, 10 Nov 2016 09:22:01 -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:01 -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:54 +0100 Message-Id: <1478798514-20999-4-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 3/3] test: drv: shm: adding test for physical address queries 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" Signed-off-by: Christophe Milard --- .../common_plat/validation/drv/drvshmem/drvshmem.c | 37 ++++++++++++++++++++++ .../common_plat/validation/drv/drvshmem/drvshmem.h | 1 + 2 files changed, 38 insertions(+) -- 2.7.4 diff --git a/test/common_plat/validation/drv/drvshmem/drvshmem.c b/test/common_plat/validation/drv/drvshmem/drvshmem.c index 559c55d..274aeb2 100644 --- a/test/common_plat/validation/drv/drvshmem/drvshmem.c +++ b/test/common_plat/validation/drv/drvshmem/drvshmem.c @@ -764,11 +764,48 @@ void drvshmem_test_stress(void) CU_ASSERT(odpdrv_shm_print_all("After stress tests") == base); } +/* + * test basic things: shmem creation, info, share, and free + */ +void drvshmem_test_physical(void) +{ + shared_test_data_big_t *shared_test_data; + odpdrv_shm_t shm; + odpdrv_shm_capability_t capa; + odpdrv_phys_addr_t phy_addr; + + /* query_capabilities: */ + CU_ASSERT(odpdrv_shm_capability(&capa) == 0) + + /* if we cannot handle phy queries, end of story... */ + if (!capa.can_getphy) + return; + + /* allocated shared mem (locked, for real physical) */ + shm = odpdrv_shm_reserve(MEM_NAME, + sizeof(shared_test_data_big_t), + ALIGN_SIZE, ODPDRV_SHM_LOCK); + CU_ASSERT(ODPDRV_SHM_INVALID != shm); + + /* query for the physical address and check its validity as we can: */ + shared_test_data = odpdrv_shm_addr(shm); + + phy_addr = odpdrv_getphy((void *)shared_test_data); + CU_ASSERT(phy_addr != 0); + + /* Also run the debug dump function: */ + odpdrv_dumpphy((void *)shared_test_data, + sizeof(shared_test_data_big_t)); + + CU_ASSERT(0 == odpdrv_shm_free_by_handle(shm)); +} + odp_testinfo_t drvshmem_suite[] = { ODP_TEST_INFO(drvshmem_test_basic), ODP_TEST_INFO(drvshmem_test_reserve_after_fork), ODP_TEST_INFO(drvshmem_test_singleva_after_fork), ODP_TEST_INFO(drvshmem_test_stress), + ODP_TEST_INFO(drvshmem_test_physical), ODP_TEST_INFO_NULL, }; diff --git a/test/common_plat/validation/drv/drvshmem/drvshmem.h b/test/common_plat/validation/drv/drvshmem/drvshmem.h index f4c26a1..056c0de 100644 --- a/test/common_plat/validation/drv/drvshmem/drvshmem.h +++ b/test/common_plat/validation/drv/drvshmem/drvshmem.h @@ -14,6 +14,7 @@ void drvshmem_test_basic(void); void drvshmem_test_reserve_after_fork(void); void drvshmem_test_singleva_after_fork(void); void drvshmem_test_stress(void); +void drvshmem_test_physical(void); /* test arrays: */ extern odp_testinfo_t drvshmem_suite[];