const struct rte_config *config = rte_eal_get_configuration();
struct internal_config *internal_conf =
eal_get_internal_configuration();
+ bool has_phys_addr;
+ enum rte_iova_mode iova_mode;
int ret;
eal_log_init(NULL, 0);
internal_conf->memory = MEMSIZE_IF_NO_HUGE_PAGE;
}
+ if (rte_eal_intr_init() < 0) {
+ rte_eal_init_alert("Cannot init interrupt-handling thread");
+ return -1;
+ }
+
+ if (rte_eal_timer_init() < 0) {
+ rte_eal_init_alert("Cannot init TSC timer");
+ rte_errno = EFAULT;
+ return -1;
+ }
+
+ bscan = rte_bus_scan();
+ if (bscan < 0) {
+ rte_eal_init_alert("Cannot scan the buses");
+ rte_errno = ENODEV;
+ return -1;
+ }
+
if (eal_mem_win32api_init() < 0) {
rte_eal_init_alert("Cannot access Win32 memory management");
rte_errno = ENOTSUP;
return -1;
}
+ has_phys_addr = true;
if (eal_mem_virt2iova_init() < 0) {
/* Non-fatal error if physical addresses are not required. */
- RTE_LOG(WARNING, EAL, "Cannot access virt2phys driver, "
+ RTE_LOG(DEBUG, EAL, "Cannot access virt2phys driver, "
"PA will not be available\n");
+ has_phys_addr = false;
}
+ iova_mode = internal_conf->iova_mode;
+ if (iova_mode == RTE_IOVA_PA && !has_phys_addr) {
+ rte_eal_init_alert("Cannot use IOVA as 'PA' since physical addresses are not available");
+ rte_errno = EINVAL;
+ return -1;
+ }
+ if (iova_mode == RTE_IOVA_DC) {
+ RTE_LOG(DEBUG, EAL, "Specific IOVA mode is not requested, autodetecting\n");
+ if (has_phys_addr) {
+ RTE_LOG(DEBUG, EAL, "Selecting IOVA mode according to bus requests\n");
+ iova_mode = rte_bus_get_iommu_class();
+ if (iova_mode == RTE_IOVA_DC)
+ iova_mode = RTE_IOVA_PA;
+ } else {
+ iova_mode = RTE_IOVA_VA;
+ }
+ }
+ RTE_LOG(DEBUG, EAL, "Selected IOVA mode '%s'\n",
+ iova_mode == RTE_IOVA_PA ? "PA" : "VA");
+ rte_eal_get_configuration()->iova_mode = iova_mode;
+
if (rte_eal_memzone_init() < 0) {
rte_eal_init_alert("Cannot init memzone");
rte_errno = ENODEV;
return -1;
}
- if (rte_eal_intr_init() < 0) {
- rte_eal_init_alert("Cannot init interrupt-handling thread");
- return -1;
- }
-
- if (rte_eal_timer_init() < 0) {
- rte_eal_init_alert("Cannot init TSC timer");
- rte_errno = EFAULT;
- return -1;
- }
-
__rte_thread_init(config->main_lcore,
&lcore_config[config->main_lcore].cpuset);
- bscan = rte_bus_scan();
- if (bscan < 0) {
- rte_eal_init_alert("Cannot init PCI");
- rte_errno = ENODEV;
- return -1;
- }
-
RTE_LCORE_FOREACH_WORKER(i) {
/*
*/
*(volatile int *)addr = *(volatile int *)addr;
- /* Only try to obtain IOVA if it's available, so that applications
- * that do not need IOVA can use this allocator.
- */
- if (rte_eal_using_phys_addrs()) {
- iova = rte_mem_virt2iova(addr);
- if (iova == RTE_BAD_IOVA) {
- RTE_LOG(DEBUG, EAL,
- "Cannot get IOVA of allocated segment\n");
- goto error;
- }
+ iova = rte_mem_virt2iova(addr);
+ if (iova == RTE_BAD_IOVA) {
+ RTE_LOG(DEBUG, EAL,
+ "Cannot get IOVA of allocated segment\n");
+ goto error;
}
/* Only "Ex" function can handle hugepages. */