diff mbox series

[v5,1/1] eal: add internal function to get base address

Message ID 20220118133340.25225-1-syalavarthi@marvell.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers show
Series [v5,1/1] eal: add internal function to get base address | expand

Checks

Context Check Description
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/github-robot: build success github build: passed
ci/intel-Testing success Testing PASS
ci/Intel-compilation success Compilation OK
ci/checkpatch success coding style OK

Commit Message

Srikanth Yalavarthi Jan. 18, 2022, 1:33 p.m. UTC
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 <syalavarthi@marvell.com>
---
 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(+)

Comments

Thomas Monjalon Feb. 2, 2022, 2:19 p.m. UTC | #1
Dmitry, Anatoly,
any new comment on this v5?


18/01/2022 14:33, Srikanth Yalavarthi:
> 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 <syalavarthi@marvell.com>
> ---
>  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;
>
Dmitry Kozlyuk Feb. 4, 2022, 7:28 p.m. UTC | #2
2022-01-18 05:33 (UTC-0800), Srikanth Yalavarthi:
> 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 <syalavarthi@marvell.com>
> ---
>  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(+)

Acked-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
Burakov, Anatoly Feb. 8, 2022, 5:15 p.m. UTC | #3
On 18-Jan-22 1:33 PM, Srikanth Yalavarthi wrote:
> 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 <syalavarthi@marvell.com>
> ---

Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
Thomas Monjalon Feb. 8, 2022, 10:58 p.m. UTC | #4
08/02/2022 18:15, Burakov, Anatoly:
> On 18-Jan-22 1:33 PM, Srikanth Yalavarthi wrote:
> > 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 <syalavarthi@marvell.com>
> Acked-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
> Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>

Applied, thanks.
diff mbox series

Patch

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;