[dpdk-dev] [PATCH] bus/pci: always check IOMMU capabilities

Jerin Jacob Kollanukkaran jerinj at marvell.com
Sat Aug 3 20:22:09 CEST 2019


> -----Original Message-----
> From: dev <dev-bounces at dpdk.org> On Behalf Of David Marchand
> Sent: Friday, August 2, 2019 3:45 PM
> To: dev at dpdk.org
> Cc: anatoly.burakov at intel.com; tyos at jp.ibm.com; drc at linux.vnet.ibm.com
> Subject: [dpdk-dev] [PATCH] bus/pci: always check IOMMU capabilities
> 
> IOMMU capabilities won't change and must be checked even if no PCI device
> seem to be supported yet when EAL initialised.
> 
> This is to accommodate with SPDK that registers its drivers after
> rte_eal_init(), especially on PPC platform where the IOMMU does not
> support VA.
> 
> Fixes: 703458e19c16 ("bus/pci: consider only usable devices for IOVA mode")
> 
> Signed-off-by: David Marchand <david.marchand at redhat.com>
> ---
>  drivers/bus/pci/bsd/pci.c    |  6 ++++++
>  drivers/bus/pci/linux/pci.c  | 25 ++++++-------------------
> drivers/bus/pci/pci_common.c | 16 +++++++++++++++-
>  drivers/bus/pci/private.h    |  5 ++++-
>  4 files changed, 31 insertions(+), 21 deletions(-)
> 
> diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c
> index 9794552..8d1d6ab 100644
> --- a/drivers/bus/pci/pci_common.c
> +++ b/drivers/bus/pci/pci_common.c
> @@ -616,8 +616,16 @@ rte_pci_get_iommu_class(void)
>  	const struct rte_pci_driver *drv;
>  	bool devices_want_va = false;
>  	bool devices_want_pa = false;
> +	static int iommu_no_va = -1;

I think, "static" is not required in this context of rte_pci_get_iommu_class()
function. Not a big deal, Trying to avoid unnecessary global variable here.

Either way,

Acked-by: Jerin Jacob <jerinj at marvell.com>
Tested-by: Jerin Jacob <jerinj at marvell.com>


 
>  	FOREACH_DEVICE_ON_PCIBUS(dev) {
> +		/*
> +		 * We can check this only once, because the IOMMU
> hardware is
> +		 * the same for all of them.
> +		 */
> +		if (iommu_no_va == -1)
> +			iommu_no_va =
> pci_device_iommu_support_va(dev)
> +					? 0 : 1;
>  		if (pci_ignore_device(dev))
>  			continue;
>  		if (dev->kdrv == RTE_KDRV_UNKNOWN ||
> @@ -643,7 +651,13 @@ rte_pci_get_iommu_class(void)
>  				devices_want_va = true;
>  		}
>  	}



More information about the dev mailing list