From patchwork Tue Jan 18 13:33:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srikanth Yalavarthi X-Patchwork-Id: 106028 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 06DD6A034C; Tue, 18 Jan 2022 14:33:48 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 83B9E4272C; Tue, 18 Jan 2022 14:33:48 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 4699A4068E for ; Tue, 18 Jan 2022 14:33:47 +0100 (CET) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.1.2/8.16.1.2) with ESMTP id 20IBfG8V021214; Tue, 18 Jan 2022 05:33:43 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=pfpt0220; bh=dFSFlPBHyrFej5j04rx3iZsYm3ZWKIuBmhSV9v5SUJs=; b=NqVhPynFTkYsImNQ4NuSgYz2E1Wjv3A1o0kKPWFnfkQ6C0GmNxh9P5FX1ZnCJ+p0Gd7a V51RvdSCu5ffyD/kBEsPzNQCDffLNmB6APWksAqHLe46ZjCKaWNneeyeNT62ywHHj9DM 0xEg3YEYdCaIk/KOLkFV5c/gpCvtfBRVpLVs/ooHnRv85umHpDJdU/vUSuGei0F4TS0W qdkyzwgMwgNVp3im0nVuo4qO3Wy6AFB3qP5wk4RUGdFZVhCnVrgi+A6fX9f2PrsUigLs 7nIIRGW6TgsAcuqNXgUjbJ1PLHaLcKEt16TrQeN8PAtfGqTmvWdSagCYvsoImc894H4U lw== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3dnmttsuvk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Tue, 18 Jan 2022 05:33:43 -0800 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 18 Jan 2022 05:33:42 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Tue, 18 Jan 2022 05:33:42 -0800 Received: from ml-host-33.caveonetworks.com (unknown [10.110.143.233]) by maili.marvell.com (Postfix) with ESMTP id F1FF23F705D; Tue, 18 Jan 2022 05:33:41 -0800 (PST) From: Srikanth Yalavarthi To: Ray Kinsella CC: , , , , Srikanth Yalavarthi Subject: [PATCH v5 1/1] eal: add internal function to get base address Date: Tue, 18 Jan 2022 05:33:40 -0800 Message-ID: <20220118133340.25225-1-syalavarthi@marvell.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220117112228.32572-1-syalavarthi@marvell.com> References: <20220117112228.32572-1-syalavarthi@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: 19NzTrFjdmBb0Yhh_UqHzPjVFnT5CHFS X-Proofpoint-ORIG-GUID: 19NzTrFjdmBb0Yhh_UqHzPjVFnT5CHFS X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.816,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2022-01-18_04,2022-01-18_01,2021-12-02_01 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Added an internal helper to get OS-specific EAL mapping base address This helper can be used by the drivers to program offload / accelerator devices, where the base address can be used as a reference address by the accelerator to access the host memory An address can also be represented as an offset relative to the base address using smaller data types Signed-off-by: Srikanth Yalavarthi Acked-by: Dmitry Kozlyuk Acked-by: Anatoly Burakov --- lib/eal/common/eal_common_config.c | 9 +++++++++ lib/eal/include/rte_eal.h | 9 +++++++++ lib/eal/version.map | 1 + 3 files changed, 19 insertions(+) diff --git a/lib/eal/common/eal_common_config.c b/lib/eal/common/eal_common_config.c index 1c4c4dd585..19598cb28d 100644 --- a/lib/eal/common/eal_common_config.c +++ b/lib/eal/common/eal_common_config.c @@ -87,3 +87,12 @@ rte_eal_has_pci(void) { return !internal_config.no_pci; } + +/* Get the EAL base address */ +uint64_t +rte_eal_get_baseaddr(void) +{ + return (internal_config.base_virtaddr != 0) ? + (uint64_t) internal_config.base_virtaddr : + eal_get_baseaddr(); +} diff --git a/lib/eal/include/rte_eal.h b/lib/eal/include/rte_eal.h index 5a34a6acd9..29298c3c83 100644 --- a/lib/eal/include/rte_eal.h +++ b/lib/eal/include/rte_eal.h @@ -475,6 +475,15 @@ rte_eal_mbuf_user_pool_ops(void); const char * rte_eal_get_runtime_dir(void); +/** + * Get the OS-specific EAL base address. + * + * @return + * The base address. + */ +__rte_internal +uint64_t rte_eal_get_baseaddr(void); + #ifdef __cplusplus } #endif diff --git a/lib/eal/version.map b/lib/eal/version.map index ab28c22791..b53eeb30d7 100644 --- a/lib/eal/version.map +++ b/lib/eal/version.map @@ -425,6 +425,7 @@ EXPERIMENTAL { INTERNAL { global: + rte_eal_get_baseaddr; rte_firmware_read; rte_intr_allow_others; rte_intr_cap_multiple;