From: Srikanth Yalavarthi Date: Tue, 18 Jan 2022 13:33:40 +0000 (-0800) Subject: eal: add internal function to get base address X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=f3ca33bb20925cca90184bd3f05ebedc78a929b2;p=dpdk.git eal: add internal function to get base address 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 --- diff --git a/lib/eal/common/eal_common_config.c b/lib/eal/common/eal_common_config.c index 1c4c4dd585..6d19aadb20 100644 --- a/lib/eal/common/eal_common_config.c +++ b/lib/eal/common/eal_common_config.c @@ -62,6 +62,15 @@ rte_eal_iova_mode(void) return rte_eal_get_configuration()->iova_mode; } +/* 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(); +} + enum rte_proc_type_t rte_eal_process_type(void) { diff --git a/lib/eal/include/rte_eal.h b/lib/eal/include/rte_eal.h index 5a34a6acd9..5dfc50e987 100644 --- a/lib/eal/include/rte_eal.h +++ b/lib/eal/include/rte_eal.h @@ -449,6 +449,15 @@ static inline int rte_gettid(void) return RTE_PER_LCORE(_thread_id); } +/** + * Get the OS-specific EAL base address. + * + * @return + * The base address. + */ +__rte_internal +uint64_t rte_eal_get_baseaddr(void); + /** * Get the iova mode * 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;