[dpdk-dev,v4,02/15] mem: introduce IOVA type

Message ID 20171106014141.13266-3-thomas@monjalon.net
State Accepted, archived
Headers show

Checks

Context Check Description
ci/Intel-compilation success Compilation OK
ci/checkpatch success coding style OK

Commit Message

Thomas Monjalon Nov. 6, 2017, 1:41 a.m.
The IO virtual addresses may be used instead of physical addresses.
As IOVA is more generic, it should be used in most places instead
of physical address wording.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
 lib/librte_eal/common/include/rte_memory.h | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

Comments

Santosh Shukla Nov. 6, 2017, 5:38 a.m. | #1
On Monday 06 November 2017 07:11 AM, Thomas Monjalon wrote:
> The IO virtual addresses may be used instead of physical addresses.
> As IOVA is more generic, it should be used in most places instead
> of physical address wording.
>
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> ---
>  lib/librte_eal/common/include/rte_memory.h | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/lib/librte_eal/common/include/rte_memory.h b/lib/librte_eal/common/include/rte_memory.h
> index 5a3a956e3..f7eed9ab6 100644
> --- a/lib/librte_eal/common/include/rte_memory.h
> +++ b/lib/librte_eal/common/include/rte_memory.h
> @@ -92,8 +92,16 @@ enum rte_page_sizes {
>   */
>  #define __rte_cache_min_aligned __rte_aligned(RTE_CACHE_LINE_MIN_SIZE)
>  
> -typedef uint64_t phys_addr_t; /**< Physical address definition. */
> +typedef uint64_t phys_addr_t; /**< Physical address. */
>  #define RTE_BAD_PHYS_ADDR ((phys_addr_t)-1)
> +/**
> + * IO virtual address type.
> + * When the physical addressing mode is in use,
> + * the translation from a virtual address to a physical address
> + * is a direct mapping, i.e. the same value.
> + */

I guess - that description applicable for iova=va mode
and for iova=pa mode - Need to do explicit virt2phy translation.
I believe you mis-wrote - s/physical addressing mode/virtual addressing mode.

With that:
Acked-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>

Thanks. 

> +typedef uint64_t rte_iova_t;
> +#define RTE_BAD_IOVA ((rte_iova_t)-1)
>  
>  /**
>   * Physical memory segment descriptor.
Thomas Monjalon Nov. 6, 2017, 8:37 a.m. | #2
06/11/2017 06:38, santosh:
> 
> On Monday 06 November 2017 07:11 AM, Thomas Monjalon wrote:
> > The IO virtual addresses may be used instead of physical addresses.
> > As IOVA is more generic, it should be used in most places instead
> > of physical address wording.
> >
> > Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> > ---
> > +/**
> > + * IO virtual address type.
> > + * When the physical addressing mode is in use,
> > + * the translation from a virtual address to a physical address
> > + * is a direct mapping, i.e. the same value.
> > + */
> 
> I guess - that description applicable for iova=va mode
> and for iova=pa mode - Need to do explicit virt2phy translation.
> I believe you mis-wrote - s/physical addressing mode/virtual addressing mode.

Not sure to understand your comment.
Let me reword the description to be less ambiguous:

* When the physical addressing mode (IOVA as PA) is in use,
* the translation from an IO virtual address (IOVA) to a physical address
* is a direct mapping, i.e. the same value.
* Otherwise, in virtual mode (IOVA as VA), an IOMMU may do the translation.

Is this description correct?
Santosh Shukla Nov. 6, 2017, 8:51 a.m. | #3
On Monday 06 November 2017 02:07 PM, Thomas Monjalon wrote:
> 06/11/2017 06:38, santosh:
>> On Monday 06 November 2017 07:11 AM, Thomas Monjalon wrote:
>>> The IO virtual addresses may be used instead of physical addresses.
>>> As IOVA is more generic, it should be used in most places instead
>>> of physical address wording.
>>>
>>> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
>>> ---
>>> +/**
>>> + * IO virtual address type.
>>> + * When the physical addressing mode is in use,
>>> + * the translation from a virtual address to a physical address
>>> + * is a direct mapping, i.e. the same value.
>>> + */
>> I guess - that description applicable for iova=va mode
>> and for iova=pa mode - Need to do explicit virt2phy translation.
>> I believe you mis-wrote - s/physical addressing mode/virtual addressing mode.
> Not sure to understand your comment.
> Let me reword the description to be less ambiguous:
>
> * When the physical addressing mode (IOVA as PA) is in use,
> * the translation from an IO virtual address (IOVA) to a physical address
> * is a direct mapping, i.e. the same value.
> * Otherwise, in virtual mode (IOVA as VA), an IOMMU may do the translation.
>
> Is this description correct?
>
Yes.
Thomas Monjalon Nov. 6, 2017, 9:08 a.m. | #4
06/11/2017 09:51, santosh:
> 
> On Monday 06 November 2017 02:07 PM, Thomas Monjalon wrote:
> > 06/11/2017 06:38, santosh:
> >> On Monday 06 November 2017 07:11 AM, Thomas Monjalon wrote:
> >>> The IO virtual addresses may be used instead of physical addresses.
> >>> As IOVA is more generic, it should be used in most places instead
> >>> of physical address wording.
> >>>
> >>> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> >>> ---
> >>> +/**
> >>> + * IO virtual address type.
> >>> + * When the physical addressing mode is in use,
> >>> + * the translation from a virtual address to a physical address
> >>> + * is a direct mapping, i.e. the same value.
> >>> + */
> >> I guess - that description applicable for iova=va mode
> >> and for iova=pa mode - Need to do explicit virt2phy translation.
> >> I believe you mis-wrote - s/physical addressing mode/virtual addressing mode.
> > Not sure to understand your comment.
> > Let me reword the description to be less ambiguous:
> >
> > * When the physical addressing mode (IOVA as PA) is in use,
> > * the translation from an IO virtual address (IOVA) to a physical address
> > * is a direct mapping, i.e. the same value.
> > * Otherwise, in virtual mode (IOVA as VA), an IOMMU may do the translation.
> >
> > Is this description correct?
> >
> Yes.

Good, so I can change the description with this one
and add your ack, right?

Patch

diff --git a/lib/librte_eal/common/include/rte_memory.h b/lib/librte_eal/common/include/rte_memory.h
index 5a3a956e3..f7eed9ab6 100644
--- a/lib/librte_eal/common/include/rte_memory.h
+++ b/lib/librte_eal/common/include/rte_memory.h
@@ -92,8 +92,16 @@  enum rte_page_sizes {
  */
 #define __rte_cache_min_aligned __rte_aligned(RTE_CACHE_LINE_MIN_SIZE)
 
-typedef uint64_t phys_addr_t; /**< Physical address definition. */
+typedef uint64_t phys_addr_t; /**< Physical address. */
 #define RTE_BAD_PHYS_ADDR ((phys_addr_t)-1)
+/**
+ * IO virtual address type.
+ * When the physical addressing mode is in use,
+ * the translation from a virtual address to a physical address
+ * is a direct mapping, i.e. the same value.
+ */
+typedef uint64_t rte_iova_t;
+#define RTE_BAD_IOVA ((rte_iova_t)-1)
 
 /**
  * Physical memory segment descriptor.