From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Burakov, Anatoly" Subject: Re: [PATCH v2] eal: sPAPR IOMMU support in pci probing for vfio-pci in ppc64le Date: Fri, 3 Mar 2017 09:08:43 +0000 Message-ID: References: <89825b7a9e0758dea19a01eb347c0753bf2c4134.1488480000.git.gowrishankar.m@linux.vnet.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Cc: Chao Zhu , Thomas Monjalon , Pradeep To: Gowrishankar , "dev@dpdk.org" Return-path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 52DED3DC for ; Fri, 3 Mar 2017 10:08:48 +0100 (CET) In-Reply-To: <89825b7a9e0758dea19a01eb347c0753bf2c4134.1488480000.git.gowrishankar.m@linux.vnet.ibm.com> Content-Language: en-US List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Hi Muthurkrishnan, > From: Gowrishankar Muthukrishnan >=20 > Below changes adds pci probing support for vfio-pci devices in power8. >=20 > Changes: > v2 - kernel version checked and doc updated >=20 > Signed-off-by: Gowrishankar Muthukrishnan > > --- > 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(+) >=20 > 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 >=20 > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D >=20 >=20 > +* **Added powerpc support in pci probing for vfio-pci devices.** > + > + sPAPR IOMMU based pci probing enabled for vfio-pci devices. > + > Resolved Issues > --------------- >=20 > 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; >=20 > static int vfio_type1_dma_map(int); > +static int vfio_spapr_dma_map(int); > static int vfio_noiommu_dma_map(int); >=20 > /* IOMMU types we support */ > static const struct vfio_iommu_type iommu_types[] =3D { > /* 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, > } >=20 > static int > +vfio_spapr_dma_map(int vfio_container_fd) > +{ > + const struct rte_memseg *ms =3D rte_eal_get_physmem_layout(); > + int i, ret; > + > + struct vfio_iommu_spapr_register_memory reg =3D { > + .argsz =3D sizeof(reg), > + .flags =3D 0 > + }; > + struct vfio_iommu_spapr_tce_info info =3D { > + .argsz =3D sizeof(info), > + }; > + struct vfio_iommu_spapr_tce_create create =3D { > + .argsz =3D sizeof(create), > + }; > + struct vfio_iommu_spapr_tce_remove remove =3D { > + .argsz =3D sizeof(remove), > + }; > + > + /* query spapr iommu info */ > + ret =3D 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-specif= ic defines and structures not be available for pre-4.2? So the kernel check should als= o 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?