<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Nov 23, 2023 at 4:52 PM <<a href="mailto:christian.ehrhardt@canonical.com">christian.ehrhardt@canonical.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">From: David Wilder <<a href="mailto:dwilder@us.ibm.com" target="_blank">dwilder@us.ibm.com</a>><br>
<br>
When using --no-huge option physical address are not guaranteed<br>
to be persistent.<br>
<br>
This change effectively makes "--no-huge" the same as<br>
"--no-huge --iova-mode=va".<br>
<br>
When --no-huge is used (or any other condition making physical<br>
addresses unavailable) setting --iova-mode=pa will have no effect.<br>
<br>
Signed-off-by: Christian Ehrhardt <<a href="mailto:christian.ehrhardt@canonical.com" target="_blank">christian.ehrhardt@canonical.com</a>><br>
---<br>
 doc/guides/prog_guide/env_abstraction_layer.rst |  9 ++++++---<br>
 lib/eal/linux/eal.c                             | 14 ++++++++------<br>
 2 files changed, 14 insertions(+), 9 deletions(-)<br>
<br>
diff --git a/doc/guides/prog_guide/env_abstraction_layer.rst b/doc/guides/prog_guide/env_abstraction_layer.rst<br>
index 6debf54efb..20c7355e0f 100644<br>
--- a/doc/guides/prog_guide/env_abstraction_layer.rst<br>
+++ b/doc/guides/prog_guide/env_abstraction_layer.rst<br>
@@ -559,9 +559,12 @@ IOVA Mode is selected by considering what the current usable Devices on the<br>
 system require and/or support.<br>
<br>
 On FreeBSD, RTE_IOVA_PA is always the default. On Linux, the IOVA mode is<br>
-detected based on a 2-step heuristic detailed below.<br>
+detected based on a heuristic detailed below.<br>
<br>
-For the first step, EAL asks each bus its requirement in terms of IOVA mode<br>
+For the first step, if no Physical Addresses are available RTE_IOVA_VA is<br>
+selected.<br>
+<br>
+Then EAL asks each bus its requirement in terms of IOVA mode<br>
 and decides on a preferred IOVA mode.<br>
<br>
 - if all buses report RTE_IOVA_PA, then the preferred IOVA mode is RTE_IOVA_PA,<br>
@@ -575,7 +578,7 @@ and decides on a preferred IOVA mode.<br>
 If the buses have expressed no preference on which IOVA mode to pick, then a<br>
 default is selected using the following logic:<br>
<br>
-- if physical addresses are not available, RTE_IOVA_VA mode is used<br>
+- if enable_iova_as_pa was not set at build RTE_IOVA_VA mode is used<br>
 - if /sys/kernel/iommu_groups is not empty, RTE_IOVA_VA mode is used<br>
 - otherwise, RTE_IOVA_PA mode is used<br>
<br>
diff --git a/lib/eal/linux/eal.c b/lib/eal/linux/eal.c<br>
index 57da058cec..7d0eedef57 100644<br>
--- a/lib/eal/linux/eal.c<br>
+++ b/lib/eal/linux/eal.c<br>
@@ -1067,6 +1067,14 @@ rte_eal_init(int argc, char **argv)<br>
<br>
        phys_addrs = rte_eal_using_phys_addrs() != 0;<br>
<br>
+       if (!phys_addrs) {<br>
+               /* if we have no access to physical addresses,<br>
+                * pick IOVA as VA mode.<br>
+                */<br>
+               iova_mode = RTE_IOVA_VA;<br></blockquote><div><br></div><div>^^ this won't work, thanks for trying to rush it :-/</div><div>I'll fix and test it before v2</div><div>But since it wasn't my patch initially I'm happy if anyone else wants to take over ...</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
+               RTE_LOG(INFO, EAL, "Physical addresses are unavailable, selecting IOVA as VA mode.\n");<br>
+       }<br>
+<br>
        /* if no EAL option "--iova-mode=<pa|va>", use bus IOVA scheme */<br>
        if (internal_conf->iova_mode == RTE_IOVA_DC) {<br>
                /* autodetect the IOVA mapping mode */<br>
@@ -1078,12 +1086,6 @@ rte_eal_init(int argc, char **argv)<br>
                        if (!RTE_IOVA_IN_MBUF) {<br>
                                iova_mode = RTE_IOVA_VA;<br>
                                RTE_LOG(DEBUG, EAL, "IOVA as VA mode is forced by build option.\n");<br>
-                       } else if (!phys_addrs) {<br>
-                               /* if we have no access to physical addresses,<br>
-                                * pick IOVA as VA mode.<br>
-                                */<br>
-                               iova_mode = RTE_IOVA_VA;<br>
-                               RTE_LOG(DEBUG, EAL, "Physical addresses are unavailable, selecting IOVA as VA mode.\n");<br>
                        } else if (is_iommu_enabled()) {<br>
                                /* we have an IOMMU, pick IOVA as VA mode */<br>
                                iova_mode = RTE_IOVA_VA;<br>
-- <br>
2.34.1<br>
<br>
</blockquote></div><br clear="all"><div><br></div><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature"><div dir="ltr">Christian Ehrhardt<br><span style="color:rgb(34,34,34)">Director of Engineering</span>, Ubuntu Server<br>Canonical Ltd</div></div></div>