From: Ferruh Yigit Date: Thu, 2 Nov 2017 00:06:00 +0000 (+0000) Subject: eal/linux: force IOVA as PA mode if KNI module inserted X-Git-Url: http://git.droids-corp.org/?p=dpdk.git;a=commitdiff_plain;h=2b252686bac0c3d8c7e2e64d0227ac5603a09a30 eal/linux: force IOVA as PA mode if KNI module inserted Fix kernel crash with KNI because KNI requires physical addresses. When IOVA VA mode used, memzones and mbufs physical address fields contain virtual addresses. But KNI relies on these fields to enable kernel access for buffers. Those fields having virtual address cause crash in kernel. This is a workaround until KNI fixed properly to work with virtual addresses. Fixes: 72d013644bd6 ("mem: honor IOVA mode in malloc virt2phy") Signed-off-by: Ferruh Yigit --- diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c index a5a71c6a64..229eec9f11 100644 --- a/lib/librte_eal/linuxapp/eal/eal.c +++ b/lib/librte_eal/linuxapp/eal/eal.c @@ -807,6 +807,15 @@ rte_eal_init(int argc, char **argv) /* autodetect the iova mapping mode (default is iova_pa) */ rte_eal_get_configuration()->iova_mode = rte_bus_get_iommu_class(); + /* Workaround for KNI which requires physical address to work */ + if (rte_eal_get_configuration()->iova_mode == RTE_IOVA_VA && + rte_eal_check_module("rte_kni") == 1) { + rte_eal_get_configuration()->iova_mode = RTE_IOVA_PA; + RTE_LOG(WARNING, EAL, + "Some devices want IOVA as VA but PA will be used because.. " + "KNI module inserted\n"); + } + if (internal_config.no_hugetlbfs == 0 && internal_config.process_type != RTE_PROC_SECONDARY && eal_hugepage_info_init() < 0) {