From: Alejandro Lucero Date: Thu, 1 Nov 2018 19:53:27 +0000 (+0000) Subject: bus/pci: avoid call to DMA mask check X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=ec200687132acc351e077ae525fa271e6b636114;p=dpdk.git bus/pci: avoid call to DMA mask check Calling rte_mem_check_dma_mask when memory has not been initialized yet is wrong. This patch use rte_mem_set_dma_mask instead. Once memory initialization is done, the dma mask set will be used for checking memory mapped is within the specified mask. Fixes: fe822eb8c565 ("bus/pci: use IOVA DMA mask check when setting IOVA mode") Signed-off-by: Alejandro Lucero Tested-by: Ferruh Yigit --- diff --git a/drivers/bus/pci/linux/pci.c b/drivers/bus/pci/linux/pci.c index 7576b0e739..f87533c5c8 100644 --- a/drivers/bus/pci/linux/pci.c +++ b/drivers/bus/pci/linux/pci.c @@ -615,7 +615,16 @@ pci_one_device_iommu_support_va(struct rte_pci_device *dev) mgaw = ((vtd_cap_reg & VTD_CAP_MGAW_MASK) >> VTD_CAP_MGAW_SHIFT) + 1; - return rte_mem_check_dma_mask(mgaw) == 0 ? true : false; + /* + * Assuming there is no limitation by now. We can not know at this point + * because the memory has not been initialized yet. Setting the dma mask + * will force a check once memory initialization is done. We can not do + * a fallback to IOVA PA now, but if the dma check fails, the error + * message should advice for using '--iova-mode pa' if IOVA VA is the + * current mode. + */ + rte_mem_set_dma_mask(mgaw); + return true; } #elif defined(RTE_ARCH_PPC_64) static bool