[dpdk-dev] [PATCH v2 4/6] bus/pci: use IOVAs dmak mask check when setting IOVA mode

Burakov, Anatoly anatoly.burakov at intel.com
Fri Oct 5 14:18:28 CEST 2018


On 05-Oct-18 1:06 PM, Alejandro Lucero wrote:
> 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.

^^ memory

> 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 <alejandro.lucero at netronome.com>
> ---
>   drivers/bus/pci/linux/pci.c | 4 +---
>   1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/bus/pci/linux/pci.c b/drivers/bus/pci/linux/pci.c
> index a871549..5cf78d7 100644
> --- a/drivers/bus/pci/linux/pci.c
> +++ b/drivers/bus/pci/linux/pci.c
> @@ -588,10 +588,8 @@
>   	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;

Still looks weird but OK, no big deal :)

Acked-by: Anatoly Burakov <anatoly.burakov at intel.com>

>   }
>   #elif defined(RTE_ARCH_PPC_64)
>   static bool
> 


-- 
Thanks,
Anatoly


More information about the dev mailing list