summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAlejandro Lucero <alejandro.lucero@netronome.com>2018-11-01 19:53:29 +0000
committerThomas Monjalon <thomas@monjalon.net>2018-11-05 01:02:13 +0100
commit165c89b84538fdd1a922ade2f251f9556a72ea5d (patch)
tree10015f7ceacc8f1e21a11b63901c7c65f9a4beb2 /lib
parent4374ebc24bc1aab70a6044d5fb57d7c3819e2fb8 (diff)
downloaddpdk-165c89b84538fdd1a922ade2f251f9556a72ea5d.zip
dpdk-165c89b84538fdd1a922ade2f251f9556a72ea5d.tar.gz
dpdk-165c89b84538fdd1a922ade2f251f9556a72ea5d.tar.xz
mem: use DMA mask check for legacy memory
If a device reports addressing limitations through a dma mask, the IOVAs for mapped memory needs to be checked out for ensuring correct functionality. Previous patches introduced this DMA check for main memory code currently being used but other options like legacy memory and the no hugepages option need to be also considered. This patch adds the DMA check for those cases. Signed-off-by: Alejandro Lucero <alejandro.lucero@netronome.com> Tested-by: Ferruh Yigit <ferruh.yigit@intel.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/librte_eal/linuxapp/eal/eal_memory.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/librte_eal/linuxapp/eal/eal_memory.c b/lib/librte_eal/linuxapp/eal/eal_memory.c
index fce86fd..c793587 100644
--- a/lib/librte_eal/linuxapp/eal/eal_memory.c
+++ b/lib/librte_eal/linuxapp/eal/eal_memory.c
@@ -1393,6 +1393,18 @@ eal_legacy_hugepage_init(void)
addr = RTE_PTR_ADD(addr, (size_t)page_sz);
}
+ if (mcfg->dma_maskbits &&
+ rte_mem_check_dma_mask(mcfg->dma_maskbits)) {
+ RTE_LOG(ERR, EAL,
+ "%s(): couldnt allocate memory due to IOVA exceeding limits of current DMA mask.\n",
+ __func__);
+ if (rte_eal_iova_mode() == RTE_IOVA_VA &&
+ rte_eal_using_phys_addrs())
+ RTE_LOG(ERR, EAL,
+ "%s(): Please try initializing EAL with --iova-mode=pa parameter.\n",
+ __func__);
+ goto fail;
+ }
return 0;
}
@@ -1628,6 +1640,14 @@ eal_legacy_hugepage_init(void)
rte_fbarray_destroy(&msl->memseg_arr);
}
+ if (mcfg->dma_maskbits &&
+ rte_mem_check_dma_mask(mcfg->dma_maskbits)) {
+ RTE_LOG(ERR, EAL,
+ "%s(): couldn't allocate memory due to IOVA exceeding limits of current DMA mask.\n",
+ __func__);
+ goto fail;
+ }
+
return 0;
fail: