[dpdk-dev] [PATCH v2] eal: sPAPR IOMMU support in pci probing for vfio-pci in ppc64le

Burakov, Anatoly anatoly.burakov at intel.com
Fri Mar 3 10:08:43 CET 2017


Hi Muthurkrishnan,

> From: Gowrishankar Muthukrishnan <gowrishankar.m at linux.vnet.ibm.com>
> 
> Below changes adds pci probing support for vfio-pci devices in power8.
> 
> Changes:
> v2 - kernel version checked and doc updated
> 
> Signed-off-by: Gowrishankar Muthukrishnan
> <gowrishankar.m at linux.vnet.ibm.com>
> ---
>  doc/guides/rel_notes/release_17_05.rst |  4 ++
>  lib/librte_eal/linuxapp/eal/eal_vfio.c | 90
> ++++++++++++++++++++++++++++++++++
>  lib/librte_eal/linuxapp/eal/eal_vfio.h |  6 +++
>  3 files changed, 100 insertions(+)
> 
> diff --git a/doc/guides/rel_notes/release_17_05.rst
> b/doc/guides/rel_notes/release_17_05.rst
> index e25ea9f..4b90036 100644
> --- a/doc/guides/rel_notes/release_17_05.rst
> +++ b/doc/guides/rel_notes/release_17_05.rst
> @@ -42,6 +42,10 @@ New Features
> 
> =========================================================
> 
> 
> +* **Added powerpc support in pci probing for vfio-pci devices.**
> +
> +  sPAPR IOMMU based pci probing enabled for vfio-pci devices.
> +
>  Resolved Issues
>  ---------------
> 
> diff --git a/lib/librte_eal/linuxapp/eal/eal_vfio.c
> b/lib/librte_eal/linuxapp/eal/eal_vfio.c
> index 702f7a2..9377a66 100644
> --- a/lib/librte_eal/linuxapp/eal/eal_vfio.c
> +++ b/lib/librte_eal/linuxapp/eal/eal_vfio.c
> @@ -50,12 +50,15 @@
>  static struct vfio_config vfio_cfg;
> 
>  static int vfio_type1_dma_map(int);
> +static int vfio_spapr_dma_map(int);
>  static int vfio_noiommu_dma_map(int);
> 
>  /* IOMMU types we support */
>  static const struct vfio_iommu_type iommu_types[] = {
>  	/* x86 IOMMU, otherwise known as type 1 */
>  	{ RTE_VFIO_TYPE1, "Type 1", &vfio_type1_dma_map},
> +	/* ppc64 IOMMU, otherwise known as spapr */
> +	{ RTE_VFIO_SPAPR, "sPAPR", &vfio_spapr_dma_map},
>  	/* IOMMU-less mode */
>  	{ RTE_VFIO_NOIOMMU, "No-IOMMU",
> &vfio_noiommu_dma_map},
>  };
> @@ -540,6 +543,93 @@ int vfio_setup_device(const char *sysfs_base, const
> char *dev_addr,
>  }
> 
>  static int
> +vfio_spapr_dma_map(int vfio_container_fd)
> +{
> +	const struct rte_memseg *ms = rte_eal_get_physmem_layout();
> +	int i, ret;
> +
> +	struct vfio_iommu_spapr_register_memory reg = {
> +		.argsz = sizeof(reg),
> +		.flags = 0
> +	};
> +	struct vfio_iommu_spapr_tce_info info = {
> +		.argsz = sizeof(info),
> +	};
> +	struct vfio_iommu_spapr_tce_create create = {
> +		.argsz = sizeof(create),
> +	};
> +	struct vfio_iommu_spapr_tce_remove remove = {
> +		.argsz = sizeof(remove),
> +	};
> +
> +	/* query spapr iommu info */
> +	ret = ioctl(vfio_container_fd, VFIO_IOMMU_SPAPR_TCE_GET_INFO,

Please correct me if I'm wrong here, but wouldn't all of these SPAPR-specific defines
and structures not be available for pre-4.2? So the kernel check should also
contain all the definitions and structs as well. Maybe it's better to just not compile
SPAPR support on older kernels, rather than duplicating all the VFIO code.

Any opinions?


More information about the dev mailing list