From: Alejandro Lucero Date: Fri, 5 Oct 2018 12:45:25 +0000 (+0100) Subject: bus/pci: use IOVA DMA mask check when setting IOVA mode X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=fe822eb8c5651d00ef5b8eeed6f8511e7a86560f;p=dpdk.git bus/pci: use IOVA DMA mask check when setting IOVA mode Currently the code precludes IOVA mode if IOMMU hardware reports less addressing bits than necessary for full virtual memory range. Although VT-d emulation currently only supports 39 bits, it could be iovas for allocated memlory being within that supported range. This patch allows IOVA mode in such a case adding a call to rte_eal_check_dma_mask using the reported addressing bits by the IOMMU hardware. Indeed, memory initialization code has been modified for using lower virtual addresses than those used by the kernel for 64 bits processes by default, and therefore memsegs iovas can use 39 bits or less for most systems. And this is likely 100% true for VMs. Signed-off-by: Alejandro Lucero Acked-by: Anatoly Burakov --- diff --git a/drivers/bus/pci/linux/pci.c b/drivers/bus/pci/linux/pci.c index 649ef3c392..d5faa893d8 100644 --- a/drivers/bus/pci/linux/pci.c +++ b/drivers/bus/pci/linux/pci.c @@ -589,10 +589,8 @@ pci_one_device_iommu_support_va(struct rte_pci_device *dev) fclose(fp); mgaw = ((vtd_cap_reg & VTD_CAP_MGAW_MASK) >> VTD_CAP_MGAW_SHIFT) + 1; - if (mgaw < X86_VA_WIDTH) - return false; - return true; + return rte_eal_check_dma_mask(mgaw) == 0 ? true : false; } #elif defined(RTE_ARCH_PPC_64) static bool