- Moving late bus scanning to up..just after eal_parsing.
- Auto detect iova mapping mode, based on the result of
  rte_bus_scan_iommu_class.

Signed-off-by: Santosh Shukla <santosh.shu...@caviumnetworks.com>
Signed-off-by: Jerin Jacob <jerin.ja...@caviumnetworks.com>
---
 lib/librte_eal/linuxapp/eal/eal.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/lib/librte_eal/linuxapp/eal/eal.c 
b/lib/librte_eal/linuxapp/eal/eal.c
index 2546b55e4..7b4dd70de 100644
--- a/lib/librte_eal/linuxapp/eal/eal.c
+++ b/lib/librte_eal/linuxapp/eal/eal.c
@@ -799,6 +799,16 @@ rte_eal_init(int argc, char **argv)
                return -1;
        }
 
+       if (rte_bus_scan()) {
+               rte_eal_init_alert("Cannot scan the buses for devices\n");
+               rte_errno = ENODEV;
+               return -1;
+       }
+
+       /* autodetect the iova mapping mode (default is iova_pa) */
+       if (rte_bus_get_iommu_class() == RTE_IOVA_VA)
+               rte_eal_get_configuration()->iova_mode = RTE_IOVA_VA;
+
        if (internal_config.no_hugetlbfs == 0 &&
                        internal_config.process_type != RTE_PROC_SECONDARY &&
                        internal_config.xen_dom0_support == 0 &&
@@ -896,12 +906,6 @@ rte_eal_init(int argc, char **argv)
                return -1;
        }
 
-       if (rte_bus_scan()) {
-               rte_eal_init_alert("Cannot scan the buses for devices\n");
-               rte_errno = ENODEV;
-               return -1;
-       }
-
        RTE_LCORE_FOREACH_SLAVE(i) {
 
                /*
-- 
2.13.0

Reply via email to