Hugepages get an iova address which could be out of range for devices with addressing limitations. This patch checks hugepages are withint the range if dma mask is set by a device.
Signed-off-by: Alejandro Lucero <alejandro.luc...@netronome.com> --- lib/librte_eal/common/eal_private.h | 3 +++ lib/librte_eal/linuxapp/eal/eal.c | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/lib/librte_eal/common/eal_private.h b/lib/librte_eal/common/eal_private.h index 462226f..05db535 100644 --- a/lib/librte_eal/common/eal_private.h +++ b/lib/librte_eal/common/eal_private.h @@ -224,4 +224,7 @@ */ struct rte_bus *rte_bus_find_by_device_name(const char *str); +/* if dma mask set by a device, check hugepages are not out of range */ +int rte_eal_memory_dma_mask_check(void); + #endif /* _EAL_PRIVATE_H_ */ diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c index 229eec9..eaa9325 100644 --- a/lib/librte_eal/linuxapp/eal/eal.c +++ b/lib/librte_eal/linuxapp/eal/eal.c @@ -960,6 +960,10 @@ static void rte_eal_init_alert(const char *msg) return -1; } + /* If dma mask set, check hugepages iovas are within the range */ + if (rte_eal_memory_dma_mask_check() < 0) + rte_panic("iovas out of range\n"); + /* initialize default service/lcore mappings and start running. Ignore * -ENOTSUP, as it indicates no service coremask passed to EAL. */ -- 1.9.1