From mboxrd@z Thu Jan 1 00:00:00 1970 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) Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Mar 2017 01:08:47 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.35,236,1484035200"; d="scan'208";a="71165508" Received: from irsmsx101.ger.corp.intel.com ([163.33.3.153]) by orsmga005.jf.intel.com with ESMTP; 03 Mar 2017 01:08:46 -0800 Received: from irsmsx109.ger.corp.intel.com ([169.254.13.44]) by IRSMSX101.ger.corp.intel.com ([169.254.1.112]) with mapi id 14.03.0248.002; Fri, 3 Mar 2017 09:08:43 +0000 From: "Burakov, Anatoly" To: Gowrishankar , "dev@dpdk.org" CC: Chao Zhu , Thomas Monjalon , Pradeep Thread-Topic: [PATCH v2] eal: sPAPR IOMMU support in pci probing for vfio-pci in ppc64le Thread-Index: AQHSk9CoFsU4cgVwXUGC61CjFoWER6GC0iHQ Date: Fri, 3 Mar 2017 09:08:43 +0000 Message-ID: References: <89825b7a9e0758dea19a01eb347c0753bf2c4134.1488480000.git.gowrishankar.m@linux.vnet.ibm.com> In-Reply-To: <89825b7a9e0758dea19a01eb347c0753bf2c4134.1488480000.git.gowrishankar.m@linux.vnet.ibm.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ctpclassification: CTP_IC x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYTdlMDlmNWMtODUxNS00YzY0LWI1ODQtNmUyM2ExMzFjZWVlIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE2LjUuOS4zIiwiVHJ1c3RlZExhYmVsSGFzaCI6InZXTllvXC9vNmNVaHJhREVqdGdnbkdSQU4xeTFLQXB3SHhnT3ZlWEkxbnMwPSJ9 x-originating-ip: [163.33.239.182] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v2] eal: sPAPR IOMMU support in pci probing for vfio-pci in ppc64le X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Mar 2017 09:08:48 -0000 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?