pci: get IOMMU class on Linux
authorSantosh Shukla <santosh.shukla@caviumnetworks.com>
Fri, 6 Oct 2017 11:03:40 +0000 (16:33 +0530)
committerThomas Monjalon <thomas@monjalon.net>
Fri, 6 Oct 2017 18:39:03 +0000 (20:39 +0200)
commit815c7deaed2d9e325968e82cb599984088a5c55a
tree118591700a49f3e1d41f4e85bd86eb293b434e94
parenta4f0a2dbe5abc2cadf0300fb4d5767b66254035d
pci: get IOMMU class on Linux

Get iommu class of PCI device on the bus and returns preferred iova
mapping mode for that bus.

Patch also introduces RTE_PCI_DRV_IOVA_AS_VA drv flag.
Flag used when driver needs to operate in iova=va mode.

Algorithm for iova scheme selection for PCI bus:
0. If no device bound then return with RTE_IOVA_DC mapping mode,
else goto 1).
1. Look for device attached to vfio kdrv and has .drv_flag set
to RTE_PCI_DRV_IOVA_AS_VA.
2. Look for any device attached to UIO class of driver.
3. Check for vfio-noiommu mode enabled.

If 2) & 3) is false and 1) is true then select
mapping scheme as RTE_IOVA_VA. Otherwise use default
mapping scheme (RTE_IOVA_PA).

Signed-off-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Reviewed-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Tested-by: Hemant Agrawal <hemant.agrawal@nxp.com>
lib/librte_eal/common/include/rte_pci.h
lib/librte_eal/linuxapp/eal/eal_pci.c
lib/librte_eal/linuxapp/eal/eal_vfio.c
lib/librte_eal/linuxapp/eal/eal_vfio.h