From patchwork Fri Nov 11 15:05:43 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Milard X-Patchwork-Id: 81841 Delivered-To: patch@linaro.org Received: by 10.182.1.168 with SMTP id 8csp1482177obn; Fri, 11 Nov 2016 06:08:08 -0800 (PST) X-Received: by 10.36.94.194 with SMTP id h185mr16625511itb.82.1478873287968; Fri, 11 Nov 2016 06:08:07 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id f128si6637369itc.41.2016.11.11.06.08.07; Fri, 11 Nov 2016 06:08:07 -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 8049160F04; Fri, 11 Nov 2016 14:08:07 +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 0B91D60F0E; Fri, 11 Nov 2016 14:06:34 +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 5B6E360F04; Fri, 11 Nov 2016 14:06:28 +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 BDAF160A54 for ; Fri, 11 Nov 2016 14:06:21 +0000 (UTC) Received: by mail-lf0-f49.google.com with SMTP id o141so13145399lff.1 for ; Fri, 11 Nov 2016 06:06:21 -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=w1FxCcET5IBzNQlEzNv/Vva7znyNDxvih/y92oVgd2Y=; b=X6xGbVdoSsixMXfiL/YtB+75upozDfEJ+QS4ptY9uKsBQQ2TDyOkJezFJ2dbFYuiDs TbdBIr8NQHvSlEi//W6d16qkFkAO7685tzNjpMC84fOwIV3E2ieIt3jzB4JpxLaCqi/Y /I6+VyLCwLCzHXA4112TYjT2ASOxgIPxRiW01Wc99u3teOs1eqzQyab/QI7rDIHo6Y8m 4Ea6rrA3I9sMZP39gYfreG2rZ10w3OyaFevSbSB3YELo798oAKWSfPbQ1YUPXmIcbNPG CufQA122YWePj5jTC8JEisyAH5p7G/2X6s7OhHYsQgP7uKT85f8F7xg+ORP3ArVaZNjk ssGA== X-Gm-Message-State: ABUngvcn8TIHk7E8fhnoOe+ftGBT/8XJWfER3cadLuclVRv1NVhmfkkg48PdCv3DSSvjmCoIqvk= X-Received: by 10.25.8.6 with SMTP id 6mr1431464lfi.48.1478873180560; Fri, 11 Nov 2016 06:06:20 -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.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 11 Nov 2016 06:06:20 -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:43 +0100 Message-Id: <1478876743-35846-4-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 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..73ba726 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.phys_addr) + 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_virt_to_phys((void *)shared_test_data); + CU_ASSERT(phy_addr != 0); + + /* Also run the debug dump function: */ + odpdrv_memmap_print((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[];