DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Eelco Chaudron" <echaudro@redhat.com>
To: "Alejandro Lucero" <alejandro.lucero@netronome.com>
Cc: dev@dpdk.org, stable@dpdk.org, anatoly.burakov@intel.com,
	maxime.coquelin@redhat.com, ferruh.yigit@intel.com
Subject: Re: [dpdk-dev] [dpdk-stable] [PATCH v3 3/6] bus/pci: use IOVAs check when setting IOVA mode
Date: Tue, 10 Jul 2018 12:14:30 +0200	[thread overview]
Message-ID: <79AD128F-0B7B-49B6-8F20-3C9A72036769@redhat.com> (raw)
In-Reply-To: <1530708838-2682-4-git-send-email-alejandro.lucero@netronome.com>



On 4 Jul 2018, at 14:53, Alejandro Lucero wrote:

> Although VT-d emulation currently only supports 39 bits, it could
> be iovas being within that supported range. This patch allows
> IOVA mode in such a case.
>
> Indeed, memory initialization code can be 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 system. And this is likely 100% true for VMs.
>
> Signed-off-by: Alejandro Lucero <alejandro.lucero@netronome.com>
> ---
>  drivers/bus/pci/linux/pci.c | 15 +++++++++++----
>  1 file changed, 11 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/bus/pci/linux/pci.c b/drivers/bus/pci/linux/pci.c
> index 74deef3..792c819 100644
> --- a/drivers/bus/pci/linux/pci.c
> +++ b/drivers/bus/pci/linux/pci.c
> @@ -43,6 +43,7 @@
>  #include <rte_devargs.h>
>  #include <rte_memcpy.h>
>  #include <rte_vfio.h>
> +#include <rte_memory.h>
>
>  #include "eal_private.h"
>  #include "eal_filesystem.h"
> @@ -613,10 +614,12 @@
>  	fclose(fp);
>
>  	mgaw = ((vtd_cap_reg & VTD_CAP_MGAW_MASK) >> VTD_CAP_MGAW_SHIFT) + 
> 1;
> -	if (mgaw < X86_VA_WIDTH)
> +
> +	if (!rte_eal_check_dma_mask(mgaw))

If think in this case we still need to check the X86_VA_WIDTH, i.e.
if (mgaw < X86_VA_WIDTH && !rte_eal_check_dma_mask(mgaw))


> +		return true;
> +	else
>  		return false;
>
> -	return true;
>  }
>  #elif defined(RTE_ARCH_PPC_64)
>  static bool
> @@ -640,13 +643,17 @@
>  {
>  	struct rte_pci_device *dev = NULL;
>  	struct rte_pci_driver *drv = NULL;
> +	int iommu_dma_mask_check_done = 0;
>
>  	FOREACH_DRIVER_ON_PCIBUS(drv) {
>  		FOREACH_DEVICE_ON_PCIBUS(dev) {
>  			if (!rte_pci_match(drv, dev))
>  				continue;
> -			if (!pci_one_device_iommu_support_va(dev))
> -				return false;
> +			if (!iommu_dma_mask_check_done) {
> +				if (pci_one_device_iommu_support_va(dev) < 0)
> +					return false;
> +				iommu_dma_mask_check_done  = 1;

Not sure why this change? Why do we only need to check one device on the 
bus?

In addition, if this is what was intended, rather than a variable you 
can return true in this case, or did you intended to clear the 
iommu_dma_mask_check_done on every PCI BUS iteration?

> +			}
>  		}
>  	}
>  	return true;
> -- 
> 1.9.1

  reply	other threads:[~2018-07-10 10:14 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-04 12:53 [dpdk-dev] [PATCH v3 0/6] use IOVAs check based on DMA mask Alejandro Lucero
2018-07-04 12:53 ` [dpdk-dev] [PATCH v3 1/6] mem: add function for checking memsegs IOVAs addresses Alejandro Lucero
2018-07-10  8:56   ` [dpdk-dev] [dpdk-stable] " Eelco Chaudron
2018-07-10  9:34     ` Alejandro Lucero
2018-07-10 10:06       ` Eelco Chaudron
2018-07-10 10:52         ` Alejandro Lucero
2018-07-10 11:14           ` Eelco Chaudron
2018-07-10 11:33             ` Burakov, Anatoly
2018-07-10 11:43               ` Alejandro Lucero
2018-07-10 11:55                 ` Eelco Chaudron
2018-07-10 11:40             ` Alejandro Lucero
2018-07-04 12:53 ` [dpdk-dev] [PATCH v3 2/6] ethdev: add function for checking IOVAs by a device Alejandro Lucero
2018-07-07 17:30   ` Andrew Rybchenko
2018-07-10  8:57   ` [dpdk-dev] [dpdk-stable] " Eelco Chaudron
2018-07-10  9:42     ` Alejandro Lucero
2018-07-10  9:44       ` Alejandro Lucero
2018-07-04 12:53 ` [dpdk-dev] [PATCH v3 3/6] bus/pci: use IOVAs check when setting IOVA mode Alejandro Lucero
2018-07-10 10:14   ` Eelco Chaudron [this message]
2018-07-10 15:37     ` [dpdk-dev] [dpdk-stable] " Alejandro Lucero
2018-07-04 12:53 ` [dpdk-dev] [PATCH v3 4/6] mem: use address hint for mapping hugepages Alejandro Lucero
2018-07-10 11:15   ` [dpdk-dev] [dpdk-stable] " Eelco Chaudron
2018-07-04 12:53 ` [dpdk-dev] [PATCH v3 5/6] net/nfp: check hugepages IOVAs based on DMA mask Alejandro Lucero
2018-07-10 10:17   ` [dpdk-dev] [dpdk-stable] " Eelco Chaudron
2018-07-04 12:53 ` [dpdk-dev] [PATCH v3 6/6] net/nfp: support IOVA VA mode Alejandro Lucero
2018-07-10 10:18   ` [dpdk-dev] [dpdk-stable] " Eelco Chaudron

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=79AD128F-0B7B-49B6-8F20-3C9A72036769@redhat.com \
    --to=echaudro@redhat.com \
    --cc=alejandro.lucero@netronome.com \
    --cc=anatoly.burakov@intel.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=maxime.coquelin@redhat.com \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).